diff --git a/.gitignore b/.gitignore index 2f0e02e7dc..b99aa3fd3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,91 @@ +# Unixen: object and executable files. +*.o +src/vim +src/xxd/xxd +src/auto/if_perl.c +src/auto/gui_gtk_gresources.c +src/auto/gui_gtk_gresources.h +src/objects/.dirstamp +src/tags + +# We do need src/auto/configure. +src/auto/config.aap +src/auto/config.cache +src/auto/config.h +src/auto/config.log +src/auto/config.mk +src/auto/config.status +src/auto/configure.aap +src/auto/osdef.h +src/auto/link.log +src/auto/link.sed +src/auto/pathdef.c + +# Windows +*.exe +*.idb +*.manifest +*.exp +*.obj +*.pdb +*.ilk +*.sln +*.suo +*.res +*.RES +src/if_perl.c +src/pathdef.c +src/Obj*/pathdef.c +gvimext.dll +gvimext.lib +gvim.lib +runtime/doc/uganda.nsis.txt + +# Borland C++ +bcc.cfg +*.ilc +*.ild +*.ilf +*.ils +*.map +*.tds + +# NetBeans +nbproject/* + +# Mac OSX +src/xxd/xxd.dSYM + +# All platforms +*.rej +*.orig +*.mo +*.swp +*~ +*.pyc +*.log +src/po/vim.pot + +# Generated by "make test" +src/po/*.ck +src/testdir/mbyte.vim +src/testdir/mzscheme.vim +src/testdir/lua.vim +src/testdir/small.vim +src/testdir/tiny.vim +src/testdir/test*.out +src/testdir/test*.failed +src/testdir/test.log +src/testdir/dostmp/* +src/testdir/messages +src/testdir/viminfo +src/testdir/opt_test.vim +src/memfile_test +src/json_test +src/message_test +src/kword_test + +# From MacVim .*.swp .DS_Store src/MacVim/MacVim.xcodeproj/*.mode1 @@ -20,8 +108,13 @@ src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.mode1v3 src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.pbxuser src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/xcuserdata src/MacVim/PSMTabBarControl/build -src/MacVim/PSMTabBarControl/build +src/MacVim/qlstephen/QuickLookStephen.xcodeproj/*.mode1 +src/MacVim/qlstephen/QuickLookStephen.xcodeproj/*.mode1v3 +src/MacVim/qlstephen/QuickLookStephen.xcodeproj/*.pbxuser +src/MacVim/qlstephen/QuickLookStephen.xcodeproj/xcuserdata +src/MacVim/qlstephen/build src/MacVim/build +src/MacVim/DerivedData src/TAGS src/Vim src/auto/config.cache diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 9ff923c9f6..0000000000 --- a/.hgignore +++ /dev/null @@ -1,75 +0,0 @@ -syntax: glob - -# Unixen: object and executable files. -*.o -src/vim -src/xxd/xxd -src/auto/if_perl.c -src/tags - -# We do need src/auto/configure. -src/auto/config.aap -src/auto/config.cache -src/auto/config.h -src/auto/config.log -src/auto/config.mk -src/auto/config.status -src/auto/configure.aap -src/auto/osdef.h -src/auto/link.log -src/auto/link.sed -src/auto/pathdef.c - -# Windows -*.exe -*.idb -*.manifest -*.exp -*.obj -*.pdb -*.ilk -*.sln -*.suo -*.res -*.RES -src/if_perl.c -src/pathdef.c -src/Obj*/pathdef.c -gvimext.dll -gvimext.lib - -# Borland C++ -bcc.cfg -*.ilc -*.ild -*.ilf -*.ils -*.map -*.tds - -# NetBeans -nbproject/* - -# Mac OSX -src/xxd/xxd.dSYM - -# All platforms -*.rej -*.orig -*.mo -*.swp -*~ -*.pyc -*.log -src/po/vim.pot - -# Generated by "make test" -src/po/*.ck -src/testdir/mbyte.vim -src/testdir/mzscheme.vim -src/testdir/lua.vim -src/testdir/small.vim -src/testdir/tiny.vim -src/testdir/test*.out -src/testdir/test.log -src/memfile_test diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 3f26008c9e..0000000000 --- a/.hgtags +++ /dev/null @@ -1,3108 +0,0 @@ -004eb98eb3c30714cb6a24ec3e810275080a8413 v7-1-117 -006e9c8a6a8ad354a5cb6adcce6ebfceddeb20ee v7-0079 -010397e1770eec8ff399cfc3bbd79f853849ffc1 v7-0160 -0137e7c3d31b09f1c1e494405f3f99f6423b74cd v7-0196 -0139403c8eb088d58773f7e76dc2a025719a8e8c v7-3-135 -01583c79d5f4d3f29d4c33dd10dd29efd349cad0 v7-0d03 -01762f635babb0fecb3a9f04549a54e86f67cf8b v7-1-047 -01a0da54773eb2af0215762629db5c6eed01ba06 v7-1-138 -021f9d0f60a1700989e2deeab78da32837c1041b v7-2-079 -028158b1362b55a23cc6d8d086976c4dfd6e094a v7-0090 -033e7b49356c11b2d9cc45dec6dc3d695d7ef95a v7-3-083 -0358abf2b5d4ab5981a5a1dd651ecf63d40ffbfb v7-1-315 -03714c67a82b8557cb8ee0789cbced75d804d949 v7-2-134 -039ce9407934bd97142aab06c5d1869d8e2ba3c7 v7-0-032 -03b3684919e3299ff560609c0c5f577822f64614 v7-0084 -03c191181749e422b375fbb8cd0763dede7d9beb v7-2-313 -03c4ceec6bec956646c07390aa09052cf5f0468f v7-0-054 -03d49a7c83196a406cbd12f4898fc988731af927 v7-3-010 -03ec0f2b9a403b1cbc494eac6c038076ece0b37c v7-1-242 -04265ffbda1f9b14729bc5d85069ff0711ce3744 v7-1-210 -044d5e9b1292f694e73ae929eeceaa9685fa0580 v7-2-194 -04613e770ec0bd536f04c0fb6d80b76e1af1d6e4 v7-2-189 -048f26eb43a348e49fc4f9deaca03779c2de595e v7-1-082 -04943f31135747da59cbed2b39fb109dd2796426 v7-0-165 -04fc2a0e98ed7af6ee11a2025d6a0c877114c039 v7-2-057 -057029bf347002408541ec73da1373ae64002a3f v7-2-338 -05952d133506353938f50f0b22b0097b6cdf0afd v7-2-095 -05b48b16b627b63ee0f6dda7d7f07704c3d2fe64 v7-1-198 -05c8ff7f128406d2d6052abbf5b92635d3cb0284 v7-2-162 -05dc93b9c61f63c1691849fe7407c9472a7f6288 v7-0208 -0606065af0a02f79b43b4a89383b04c21e2f0be3 v7-3-111 -062104a823df0f5a225b327b00a3766e41e4610f v7-2-201 -06234af3a8b7df68bfaf0efa87edfed2d743f6c7 v7-0106 -06317850ad3acd03765fc0f8002f17417773d906 v7-2-045 -066778e39c2ae6bbf23708d98e1a7a7e53a9a6d0 v7-1-232 -0670d0df210a891f82d38c38f1b3b256dd1a5f8d v7-2-017 -0691866e6cc92996f4fbc881e134248571ae7c82 v7-1-180 -06959e7212e521904f3b7d75bac5005b9f44bde3 v7-0-077 -06aa43dde5610dff598940ccde1dd25a617a1a52 v7-3-006 -06bc859d1a32de8763e310669d0c008b3945af1c v7-0049 -06e0f7482cef3412ecb4b0b62b65b1e7c4ed92b2 v7-1-052 -071166147fc55311bb86bc9367aca005c4a1447c v7-2-299 -0713c530729ba6d2bdc9fdb4fd400f46b16c37be v7-1-169 -073f98f45a447a137c2e2d74f936a9e26179ce1b v7-0-035 -077c15286de8e37250ed1337a448c740c86ee740 v7-2-293 -07d199fe02ed46fff935b2daa4efc979eacaab4c v7-0209 -07de57cbcb25d63bf515b67de654dd89004888fa v7-2-327 -08012a1ff8d4b4f5736a47440a907ec6e5e1610d v7-0137 -0836531167ab2f1cd48382b093c3080c3bc47786 v7-2-059 -0868e4e53fb2e9f9bd469fae0323a1df43be476b v7-1-029 -0887e8a13e5f33db2f832a52654a0d1fa82f322f v7-3-109 -09cc86b6665358a20d9faf54ce8eec45ca4fc5de v7-2-387 -09d0e83c29b805f127c6756231bb4adfb1b2974c v7-0-130 -09f00d57222b6d8de104660ea3f9c6bb42b9d31a v7-2-172 -09fcdfde9afca8990c086e60fe5e122cb258cadc v7-0-046 -0a1d45e2d8e30fc0aef25d5fd7505840d1e0e836 v7-2-258 -0a60be12e47e322c4dbae7b083321c60f599c0b8 v7-0125 -0a80dc6d78048478d4e7f0f99f573c947d5d95c0 v7-1-131 -0a908b65de1dbebbde1aacfd50aa41ef09e6865e v7-2b-012 -0a9371c70540d0d42c79a1d76e590fa2ccb978b3 v7-0220 -0b056c1350dd2ff28249130194d9a2be7b606a86 v7-0-193 -0b1b7560c456a32ad921e3985b90008ef1f82a91 v7-0174 -0b211ebefd4e6ee52ae81a75938b4ee61ca15770 v7-0-071 -0b42546f036bb3ff8023b6015a5acf032a2ae1f1 v7-2-076 -0b4a515b125474db496caa0be22a28e8bd99c88e v7-3-132 -0b796e045c429253e9ce8825ad05aad2474553bd v7-2b-000 -0c0a2b25d10aaaf556344d7404d12aba81632cf4 v7-0-015 -0c381fb7846cda92fbdb327bbfe4ab1f73a86d8d v7-0214 -0c39ff7a90a81c62f2718f71bf0a4d636a8ac69c v7-3-127 -0c4a465bd7419d51017354b70ead01c18b589e9d v7-2b-029 -0c61c201ba76d7235913010395e065991ac059b9 v7-1-196 -0c6c64edcbe0481659fdd91f6312296e7c1bb303 v7-2-052 -0c7d6d01e0582b54f34ab66852116d559c39550c v7-3-101 -0d0bf7598dcb63fdb5be9300f407e043102ab895 v7-1-256 -0d31f8a78ab35b256359b6ae53c80cecce59d44c v7-0-143 -0d6554dfc71e5e58866ef0118ed05007a4c59672 v7-0061 -0dbc46d14443418020e3868a08877a365ced11e1 v7-2b-028 -0de47f0d731e32af52784171986734b735ac626f v7-3-051 -0e3bd80a3f74a99241a4857685912dc8efeb9bdf v7-1-286 -0e3e208b4b901f22beecc85c5781170f3c4e5351 v7-0-104 -0e3e601e66cf233986924652f7801dc8d2568a84 v7-1-288 -0e45a0c50acaa31dd4052c57053bb86afd4e711e v7-2-154 -0e4631bf94411717193870a5ad7d62945d06cadc v7-2-377 -0e4c64dfc61141a68b83b5204a160b5c01986279 v7-2-125 -0e4fa55d20e025a70e3e6b82abc58333902c45db v7-2-040 -0e57be57fa49a0d2c0b7f17b7cb137b4260b79d6 v7-0-207 -0e5eb96dc18ce7986eadf32bb700e503da52ae47 v7-1-142 -0e6b369b9760459289b84a9c2e07478c063cd386 v7-1-126 -0e902b8f511f0442ee2b28314d6e085e3e00798e v7-0051 -0eef0f62181190700a01129a88f693503ae94947 v7-2a-006 -0ef5b70c3eaf694c9e9b85aed3f80af53e6fd9cf v7-0045 -0ef9cebc4f5d1c00554543918fea2a0b7539b922 v7-0031 -0f109c56b521834af0d9492b21d0ef1ead5b01ef v7-2-014 -0f3f3090491faea043fa144780d1287e011390ac v7-1-205 -0f552ca271c27681ed126261ce49e52ef144175e v7-2-393 -0f9f4761ad9cafbf1e72de338aa3fc59f1dd693d v7-0216 -1002128c68dbe2f69466b1b2cb354b00eec2980b v7-1-109 -103dea6545430092db1851d1b712a742af1a74f2 v7-3-017 -10a1b67c0885aabdac7c76a96169cd9e36414428 v7-1-068 -10ce04af8c5b26e55cd2157408883d9ed79b9a3d v7-3-021 -10d7ebdbe8a3a9787360b21a9836c6bae6a6a7a2 v7-0-169 -11155435487064d64efb296f7c2966baae8d27e3 v7-2-402 -111e109dad1301c7699d18e5689f1842f4b67e6c v7-0b01 -11472bbcdb6e2effe1c248d09b4d7089fa7a26d2 v7-2-183 -11a74d2cab9dbe41af2ed5d08b18fbdac14f6e43 v7-2-147 -11c004cc1a4df89b9246a96106db6c6f0260b7d8 v7-0-241 -11c6bda3b53abb2c98ed9221ba89880eeef7514f v7-2-268 -125e80798a85dbead9a91815cabd1d0aed63f455 v7-0021 -1287e2bbeb405c10201d4caa6b2dab284f84efbf v7-2-207 -12aba62fa7c6812ec46eb3be6759d82a4a651a93 v7-2-422 -12f9cd68b9c3aaf3659d9219551a5822cf798857 v7-1-257 -131dbd3d2a4bba5d1514c2842952ca7b77b6902e v7-2a-019 -1324b7b755f3b5570ce9aa7fb27c075c89a1d2df v7-1-322 -134c7695af324bd4118f52b9235aeff7e374a425 v7-2-121 -1378bc45ebe5754c0d3ec64d37810eaad3a544f3 v7-2-348 -144ad7f25f6741815c8297fe77965f93ee359c2a v7-0-118 -15130d4dfea14898029686b72536f54197a73062 v7-2-117 -15146eaa0e9c6dd6802cf70a2da3b220992eda1e v7-0-001 -15154710ed57eab29f7e4b848eafe63ea2dfdf85 v7-1-140 -151a805b2ddc219d4a968154a43daefbb2e41fe1 v7-1-081 -152883db0edf63f35e8459dcc5862ef3f4b48c9e v7-1-321 -152e526245217fedd07f0480e08ea59b0075a8b0 v7-1-001 -15674e198164c10b08e138f4c18b58e76306d9be v7-2-389 -158a68529622f90d0b0f1f5596f55cc5ce06c9ee v7-2-060 -159d87361e4b0d99c3863b3c82b7121a474cdf1f v7-1-168 -15e847397be75c6b0590505a9e201c793d070eee v7-2-205 -165c628aa9fc3cca34ccf63dc8ab953745d4e228 v7-0108 -169533a9699fa7d3fd67b57ad99d04076d060831 v7-0g02 -17526daaf79dbf2004c78311abdad05e6e3070dc v7-2b-021 -1780e6046802498a3c4d0ddc7b99f1bd9ac75f31 v7-0-157 -17a83c0532e83e9f4cd89f03dcbf206662d25b1f v7-1-062 -17b9587ff6d5beef34d98043ca5f3111e5d29e4d v7-0-202 -17b96d8dcc5c8356e10135f5735d6de2fa5da3e8 v7-2-038 -17c88d44ace9bc9e76485811ffa459b5c15a6bb7 v7-1-234 -18061514324fefb37ea7a7e7783985004ea0874d v7-3-084 -183c3187b20dbc6ecc74958e9ba141f0d4f72d23 v7-0-205 -184a6091124e80e1c9f66ed0908deab552ca369c v7-1-220 -184d2020d8f12823a2f2cb96335a68ac1bda3270 v7-1a-001 -18ee39301b822de39caf5fa023107ddf508b42e0 v7-2a -18f024844150562a9e56522edcad3fc1d5c257e4 v7-0086 -19106f131c872dc79bb409ffe8b5e35ebe885c1b v7-0188 -196d564759eb256f62e7fb7ec4561c1e2d533726 v7-2-072 -198a695ca8e7273641991bcf346085bbce70d740 v7-1b-001 -198ea7a9c633089ef2638513d05611a9d1b6e39c v7-1-182 -19ed3bfbe488a730858d0d26b433029b85e231cd v7-0-159 -19ef2bbf569cba64ae5125d5b1f3f205efc25e89 v7-1-263 -1a00e831244b1e509286ea35a586c6c43dcdaaaa v7-2-202 -1a040c25c44485c85e838a7530051f6d4f9793a2 v7-2-123 -1a0d346695fa3525a08a27174fbdf016afdbb9a9 v7-3-085 -1a44839049aefb0722d43a87d7ed1708c9c94b18 v7-0229 -1a511b7b69ebdf866088b9e765dc42543cd76d0a v7-0-212 -1a85f952cdfe4716be162e308fbccb0117489915 v7-0195 -1a8b518bb993e00f546c4cef8bae9b51f91fe0d7 v7-2-198 -1aba098d6abc680214b3b31c954abd53ddc772ef v7-0-039 -1b55bbf5c58077e54b83307bbe715e131c57b750 v7-1-219 -1b7cac059babfb3365c0a44c0537c7aa9b286a71 v7-0172 -1baac9d06c83400c474e6484dc20229187d27a64 v7-3-024 -1bb06e6512a2fc961eaf9a8e7a749247c408e7f6 v7-2-358 -1bc46149d9195d9134d526ef524242ede65c2457 v7-1-167 -1bdb13b8e947b85e612afec3a1b5e09c29c30551 v7-2-039 -1c00ea3641a8a1e58e70cd51ab831003bdb41d50 v7-3-005 -1c1cbdc42f75d8fa0ca5a799b5e843e9aa2c098c v7-0077 -1c4ec9ed71caf24dbec13f6d3d4adbb48bce9436 v7-3-056 -1c586ee8dd452d305bebf633d5b8c78ba1ab170d v7-0183 -1c597397f0061fd2c750c65c961a31f70dd6747f v7-1-269 -1c64bf25bbcd49a83cc08dd60a6c3e5785266790 v7-2-247 -1c7a66d820e4dc9b0a9f696ed6e7a59cd9a20e19 v7-2-360 -1c85355293f92cd8bb41eaf6ce8a8be1d77302f1 v7-2-062 -1ccc1ace9e5b6c1223ba191ce20729a49f13970e v7-3-050 -1cdd2661f34c2aa93ae2f0317194d29d3a43f5be v7-0d01 -1d0ef79659afec337c26655216a1debbd1c74497 v7-0-002 -1d12208efb3732d6f520b05a47283208f12e3856 v7-0-209 -1d4c67f8470981d280aaf1d2a25877a00ec5d240 v7-1-084 -1d6d99daf4dcba733e5517045f70e53c185aa895 v7-1-165 -1d7f46148bf4ec36a42e959cece1f9f6199a87a7 v7-2b-006 -1da25369227bead09cf603ebfa93ebe1d206c871 v7-2-345 -1dd4e0ccd822156b87516f9cd5a6a004d0d85a11 v7-1-278 -1ddec6983d9ebdb4f7a748cc171199cc8ad3d1e0 v7-2-036 -1de53700b1d9f26a420a319d9c44ba0c43950035 v7-0-127 -1df41c98fc2e9a230ab9d05be84f4c91e4078619 v7-0-239 -1dfe9032bd92ef7ab7bf0baf0f0c1f61da68bce6 v7-0-131 -1e25b58fbf7babbbe054e118617a49790f532fd4 v7-2-024 -1e52efdc900cab1dd64f6a987bbe5117fa1f9748 v7-2-270 -1ee00a062acbd04360de8b754e834f7ef6025328 v7-2-246 -1f099ff4f6fb2b0731bb38e279d0c692ee05df8d v7-1-129 -1f3902f3eb5c20e7872c42cdee9c91e2b25d3f47 v7-0038 -1f3b1021f002ac9703c1de0e80703b8067546a41 v7-0e05 -1f53050b38688e127c4ea67251ab2730002541bd v7-2-294 -1f90fab89ce32126849aa28d2918bae96603f3bd v7-2-069 -1f929f3ca8066b3170c7a58c414837d47bef707e v7-0c03 -1f93fbcb4e0cf1dcd8682242f40aa5f2906c42ac v7-1-201 -1f9e2c8e642a29d93b9c32062c785f4c38883e0c v7-1-034 -1fbbe04a950f9ed82b53ddf67d8e034224fc98ad v7-2-286 -1fc8d918d9fc076304ef0dbaad897e8e5b6ba4ab v7-2-093 -200b706675a56daad05f8b0d60991825c45b6e2d v7-1-183 -20308f30826db09e99d531214eaaf03ea8b13d15 v7-0-162 -205a26fab11655d086ce185525193d16f37d60b5 v7-1-203 -20b2e52ca96255a8d99ed9504e90a960266c4d21 v7-2-009 -20b4b6a2a212584f182a2d69a37512bf9094d85e v7-1-279 -20b52d44daafbd65b01db735c4d5597ccb9e386d v7-1-130 -20c18291deb21dcc69b6ceb3c11c309a92396fb4 v7-2-302 -20d9fc2f13a4132d6344fb6457040b02720774cf v7-2-403 -215d6b2a1816a5eaf5f5d2cb7cb1b22d24adbdab v7-1-159 -217c9aa4c3ba6ea559ec5675871d6d89313363e8 v7-2-114 -21b11491a33fee3cd77dcfcc2448382f060543f2 v7-1-156 -21c3634c211345ea79e90c4927513e7dc1381617 v7-0134 -21ce954cbdcac9dea2aa826ff40adc2fb2184600 v7-0-201 -220a9309067dfc6e7e8301b392c3499054666396 v7-1-266 -2244be18d9e9ce602a12e7529614c25ca8cef1ee v7-0162 -22886f3d882d231a528dcc012c23e54180c8248c v7-1-040 -232a4740aa0ed615c52b289a111b51171e74a78f v7-0-005 -2392a6da4aa430f896451d97da8c49ed3fcdb9cb v7-0186 -23aeaff961412f06544babde36a80a6c22be0fd9 v7-1-307 -23d23246742e7d301d09f0cb03533226b64043b4 v7-0-219 -23d366df193868572eacd04e1a32bc2283a30e56 v7-2-335 -23f82b5d2814be7ca4dee000226bd67dc6cd02cf v7-0c10 -24100651daa9d7140d33f298c987c9d42bd919bf v7-2-411 -2430fc9a18d1270a5ad7b5f7acac3e19aa8908fb v7-1-306 -2448f4c8afc65a91130fa0237c253e6698481c64 v7-0-055 -24b7b3cc4eec4387713a615519489fa5a34b253d v7-1-251 -24eb7921b8f004c8c462297cf53afad8f5578243 v7-2-367 -251307ebe1dbacd972e35e923f7360d12733f2b7 v7-1-049 -25154b22dc967b158645be9cb87017f548ee5446 v7-0-198 -2548cf0a5f625110a5cd42ee5566c2709c2c34f0 v7-0-011 -25bc02d83cf438d5794ce106edad2959e2f89454 v7-1-292 -25dd5036f2b0b5e68492c49f15eaa228aa957f69 v7-0092 -2651e7d07cd631af64818f5d3cf5dbb199fa6f64 v7-0-140 -266f9d9f5109421afcbc8169896b484ff7a19a8d v7-3-061 -26876d0f15e9294aa4fcbfc43260a5f2a703e313 v7-2-256 -26b0b2f606d2953068951dca673d963b7c5cccb7 v7-1-122 -26cbd39f22513d82cc43d2b1badefcea8db1c546 v7-1-103 -26d879bcab3aa016ccaf77cfd3a9aa5085d4776e v7-1-284 -26fb122355d4d6b04850f7608f1d82da8dbc51c7 v7-3-107 -26ff011aec2dbc96736396430403d572d4f111d5 v7-0-172 -27060fe297d0ce872dfa3bc20416f7189b9fbc59 v7-2-273 -2750661e93d556868d97f49fae32a1f470bca107 v7-1-253 -27621abffed24f1e2849ea616f91f0a99747608f v7-3-099 -276244befa5b2a34893ba581818df14cd7e4504e v7-1-189 -2775dcd056031e0a7314da9a9e0b2cebbb089525 v7-2-426 -27782797c331b8800c12ad17c5d05adab5e92edb v7-1-107 -2787b8483e6498f536e66ac134a073246ab6f5e4 v7-0-125 -279380a812add1307a2a20c444f2334b7a45106d v7-2-412 -27d8fe1c096407ddca428c52f62d002dfed7879f v7-2-090 -2832243e801ec537589809059f65efb3b8a57f93 v7-2-399 -28398206597f975583c9f8f212d336fc9f67953f v7-3-089 -28558ab31051fc1870ac690c0b576ca9365021f5 v7-1-202 -28641f0ed9deb579934416e6161260d4d218f394 v7-2-211 -288fb648badba86a0bdce6dbcecb55eb386263ab v7-2-128 -289b19a6f2edb5b46df57195d5fae41dfe963290 v7-0103 -28d0c20ad8a09dd63fa34768eac4be3cf96ed239 v7-2-051 -28e9eb0f2d849e7e32d70b4e1f06dad812288578 v7-2-077 -2928a6b338c3f434723520a12fa378895d4b24cf v7-2-187 -2930fd8e7d9f1514448261365b787501dbd9a0b7 v7-0171 -293621502c4daa122ae601398d854857bb732a83 v7-0010 -2951f28a9bd3b08c5be9bc9b3745f062b95635b8 v7-1-192 -2981ad79c362bff0c21d3ff0d68be57213bca837 v7-0-025 -29bf49bad20d3b1ad35af5cf21d91c4aa486d4a5 v7-0-068 -29c09fa57168acd665a85ed5a210b48b60d0b5e2 v7-1-211 -2a11407a5a8f4efccc04dfde8a61e40ec5eb9fc5 v7-2-066 -2a256978a64649b75d424eec6e703f99f7f28636 v7-1-003 -2a8bf2ba504f422d53dac30da8b58d76e54b4428 v7-3-003 -2a9d26c95a2a9b2f1a279e04de22ee4c7298552c v7-3-077 -2ab007070fc86d20596dfbded70d0f986c084304 v7-1-113 -2ae2dd2591fae798e4212e9b2c47281eca0c8483 v7-1-055 -2b273c71a14b7d0e64b6ae9bdcf60ef7e4d45aa8 v7-2-415 -2b475ed86e6491b20046d5c34fec8ea86988dade v7-3-074 -2b4debdc8d2c73d1fc37b750010e3a4098b035af v7-0035 -2b913f7eb9d2b411f9ef2c0fa44f313b7382bd89 v7-0039 -2bd29808d1f640f027ab7a4a4f2b5b6a0e6c8e38 v7-2-429 -2bd96108392ec08b6c384893939968d94bab4dbb v7-2-351 -2bebfa810a66caed9562541776d92f73a71de7f1 v7-0-091 -2bfc2b7033147de9689cf2d651bd8ef36fdac68b v7-0078 -2c1ffe8953ee85cf04d4db5c03ab711c1c6c015a v7-0080 -2c4ca49319a689ad9caa4429cd90bceda4e210a3 v7-1-271 -2c5e70e2858fa46c7b80b022f217103b8c90e9e9 v7-3-016 -2c885fab04e31a34d91e4375d2d0397cadb818ce v7-0e06 -2cdbc91795ca0d15343fe954ae2af71f830f9656 v7-3-007 -2cdccc96d730501ce4e509e7efe4f8fd3f2b2e29 v7-1-150 -2ced59eaf1e5c67060fe124902407a8bf77a1a78 v7-0-233 -2d0f22897a4d1f71600540e64a5cbf80a178e46a v7-0-173 -2d9eebf2c48f0bd3b51e8ba085b97da871cd4184 v7-3-126 -2df7e2d753061b54b9120ae4b34d4bf050cf17f5 v7-1-246 -2e1e9b708941e1cfc2c0540196719f78e1ab18f5 v7-0-023 -2e42153b37f171ed28293fa12e4f538070bf8619 v7-2-021 -2e915ea7110f0dc0507a733e4330ec6cc91e53ff v7-2-266 -2f016b638c0ca912d89f352f6b9b83231cf9e83b v7-1-312 -2f57d93bdbf64461c4eaeaacdba26548a2abb9cf v7-3-030 -2f6e519726f19c2f6cb58e9cd75e827eaafa0ab3 v7-2-346 -2f70b8f1f1e32dca34db07fedf9cbb56ff97007f v7-1-076 -2f9308b31181f36bf605ee060fa763a28deacb03 v7-2b-030 -2fa8cb05b861d49dec0501a2531eec39e1d0a688 v7-0218 -2fb204616c9b4e4df95f1560899d02e5bb739678 v7-0-079 -2fcd444c4bd37f916da718bf5bbe9535d2667331 v7-0057 -300fac7c5a2bafb002ee97d52da19bae8a344d51 v7-0059 -302a6aa7aca2ee9cf24958c2277a90fcfc01c939 v7-1-061 -30534c76776ab088a4142f9e15faa23d86efe020 v7-2-078 -306fc545fe2cd5d77953811fccec0d5c4bf7744e v7-0-066 -3112fcc8923830fd9060c76d1ec9c75c59487d59 v7-2-371 -31208ed42de95ba5738675cb78bd0f66c34ed785 v7-0-065 -313ec58cdc49a69c4386a4aa18fb9bcd01155feb v7-0-206 -316dad0565b8943c978c8c58b212f3c4469b1cf7 v7-0-103 -31757405c0c5408f9c83dba9d83ea74b2bd680d5 v7-3-134 -31bff9be0a7730f36e7de4792fec0688f2fc7076 v7-0g04 -31df87b80e562b6a83b97e2610f539afc94bc440 v7-2-278 -32c1b275ba6419fc014ffba3d2e55eca1ef06d4c v7-0-196 -32e19278c1ad1be6f92fc6cbcefb7e23ddf928cb v7-0-105 -32f48534fa0fa9b8e6833850fcbd77cd002ce8e0 v7-1-187 -3328b87305efcc6a8db6923c31cbf78a05983eff v7-1-077 -3372616fe1f1def653875bedaa8c059c399197ac v7-1-144 -3376d79d40f2d2c8e09cf8a3c07e15fc2424ecb3 v7-0-148 -33792c36e3aadc7f313785705f39d7ea6e214319 v7-1-018 -339999b511a0d529f09219a5d61b810fc75261ef v7-0148 -33a2652c13268ca53bb9ce0cfb7232655864c373 v7-0-231 -33d28f1c4d1dad3d4ce7f768c57820a8203c3e51 v7-2-006 -342cf2a9f5cce4f70e6a974253b20c8e309de7ef v7-1-145 -342d2b3a072a6cbc3cff898a663c4889317b32a9 v7-0-208 -3479f9aacaf57d583abb468cfe393eead386f15a v7-2b-008 -34f62bcce014d9c0b275002a1001cd1582ffa121 v7-3-123 -351bf13db8071317d7add1e55a50ae284ff53a4f v7-2-334 -354ea37841d13e0d9bb5ae995a09fb28beaa0d13 v7-0-022 -35abb70264158760c724bd0290c6c441afec4fa0 v7-2-033 -35cef95a6b7646d045b97bd4a54bb90000b5a753 v7-0168 -35edf814f2230c2bfdf403073fdcf89094c8216a v7-3-100 -35effbd07a25d1df122e795165d26ceb65510c3a v7-2-421 -35f3b20de2dd2c821675c61a11f4b227d31e9cdd v7-1-102 -36071a92cb764412276e067fed099164b0170436 v7-0167 -36275e20d997b91a357433debf8fbac0885768a0 v7-1-051 -3686831cf3da094c66ca4d2ab2c671d3d2e2d497 v7-0166 -3709cf52b9b56befb1c7a98e5f58cf39d16cf953 v7-0119 -371201c6b4c1538b593b5dc72f36c79a1f2644de v7-1-327 -378e33d47ab09cbb564a2aa6e975659a7f742a67 v7-2-250 -3796d11fde3c141d30cc3446038c20bf280c4b5f v7-1-267 -37d62d968182826522e378b31b76cf0a8c7a3cb7 v7-3-058 -389c8abd59258ba5ebc164dc7158a025bfa893a2 v7-0048 -38d7bf77e55068a5157faac7d871f2f3a66cbfad v7-0226 -38de872507e1c6440c9252a7bad077ae8c1bd488 v7-1-280 -396a9b65abe6a8fd08a6c232b443d541717cad0e v7-1-121 -39aaf0cc59e83148991c7482fa82d2bc29129d3a v7-0-150 -39d115408c71e1bf72439d5a92d98c8e551a5750 v7-0-186 -39ebe9e88854b766c569529a96dac3b67aba0e65 v7-0165 -3a6ba07b3b9fa89e94e002d44f57f5378eb59f08 v7-1-302 -3a779b47f235a62d799147b25445b01866f7c0dd v7-0223 -3acbcd0d3fd3d81ce94a40af4510fcc2e7870a82 v7-1-317 -3adc6dd2d122c76a211d88769227e447e4f8f821 v7-3-136 -3ae106044109e65b5bce1ea8938e0658729349ed v7-1-008 -3af28ecf9e56315a8617b2c58da078b6df989f2c v7-2-122 -3af484dca921e30a0bb1e4975a4fb214c3911f94 v7-2-150 -3b1d692e5a2c3053fa066d202ffc0b51779d2c71 v7-0040 -3b226f4693dc8dd1fb8886221335c39a64bb1fa9 v7-1-207 -3b241fd8d7c09d7a93694a0abcdc283dcd6b4675 v7-2-441 -3b48421dbde112f3a6dae67a651a9f114d85c874 v7-1-301 -3b705e71c7b07ba1309d08a8b370ae8ad3fc17cd v7-0124 -3ba373b54370d830e3fda93eee83e3f0b1ea2a0b v7-0008 -3bfd2e1e2609c8470c5b4f75184b66e5a4d8faef v7-1-053 -3c17132458a1538d3f1d6ab00544df8069bd983d v7-1-208 -3c17f4d2196f2f280de13a417652529c417548ff v7-0-028 -3c251a30c8cc44946e5871a7073d88ce195874cd v7-1-325 -3c6417b7e6efed4cb13673383489efb47399a902 v7-2b-027 -3c838658fc357dc48e457bdbc1f5a63ae5a73d19 v7-2-257 -3cd88bdcd97d7d0a3e2f5a00a6627f00970ce5b9 v7-0-045 -3cdf2a653e005387c4deeceb7281d62fffd34687 v7-2-391 -3d698caa5dfc7b11c8a6ada5f57e75c7a6a117dc v7-1-064 -3d842a9e2baefc023d9e4f163ea138b9e29931e8 v7-0-051 -3dc6072e0a25f24ad5d888af77d858036a9185f1 v7-0-083 -3dd986bfef63bd08894294a0828a1bca737320e1 v7-2-181 -3dfff6a80088c921b391d493c6c1231e4e64a656 v7-2-217 -3e0f9984e98e8f020260ff015cc994ccc34059a9 v7-1-111 -3e7d17e425b0f58513002797b3310e722757893f v7-0044 -3ea3dcbf2cd6e5ddb9d827c60ce999b2e4a5e755 v7-3-108 -3eb34a777f49f7f656b32c8db829fd0b153abe23 v7-2-220 -3ee6db0a746e990164e288fed6344e519a5bd1d2 v7-0083 -3ee896333e3eebba8a5e10e04649f1bd20e98770 v7-1-290 -3f1b2e6496debe5ee3068d1916ea15926d5a0f99 v7-2-252 -3f44e9abe4ec65f797cbd12f1d46bd08eb48c2ef v7-0015 -3f661e42f262e7839e2f04c50a447c53f6c4214c v7-2-228 -3f8cf4c668c30ec99289b5683f4fd36a1df602fa v7-0-115 -3fc0f57ecb91686b33630dcac973ab9d7db31c6e v7-0001 -3ffdc64af1e53617586ad0cf14e039cb6f1cad34 v7-0120 -404aac550f357223e7bab3656343827f641d9f74 v7-0017 -40a0699b6c62f93e58ae233fcdfd395bbc1bc80f v7-0046 -40a8e388692b53d36104e9c9b6ed351c01707308 v7-2-241 -40aa7ae37901ce256da18bcc84dc5ee21f83829a v7-1-149 -40f2a904bffbbe8fb600089d1b04f1115a2a4a71 v7-1-115 -4102fb4ea78127b1a95b2df3274a55d9bfba68c2 v7-0002 -410fa1a31baff929c7876be744142723c1573c75 v7-0023 -417c04135ca2ec03b6357404b62761ca9453cdba v7-3-137 -417c4d78a09c07162879dfb79e25e672e6e9218d v7-1-043 -41ab6b381572fcef699480ffb759d3c4543f0dd0 v7-0-128 -41d8447a84570ca22fe07277a2f8e9db694f66f0 v7-2-236 -41f9fd58cf132788bde73ab1954cb987521e3bd2 v7-0019 -421a77b136c2bec5d2056a799e2fa8021178beda v7-2-002 -4238b697bfff46433c49d60cc20b43761ab3c128 v7-1-097 -4256f76f72668271d9d986cc3736eb188b4400a4 v7-0-080 -4269a0673478b966f8d0e08b5681ea0cf2acd68d v7-2-432 -42ac369bd824634488b569ec5516fc435b700be8 v7-2-070 -42cafbf4b6e81160c26fc99148eb333aab5d2f96 v7-3-110 -430793c2a2315e1d0ed2de460071eb83a4f9c97f v7-2-319 -430f555d7d152cfa5b7dc43b8b8b0dfa0d520520 v7-2-195 -431ebc9412a816440aaed887a3d318deb08c6407 v7-2-418 -43243f7ce351aecf1f41932a9d02d6723fe49e34 v7-3-128 -4353593fc2c07753d40f71998688985cf96689d3 v7-1-244 -437fb19625c9e24e2157563cf0a55aeb432b2990 v7-1-275 -439f44b874a731461a187dc720edc0c663ab47b2 v7-2-291 -43a60ac87145f10d827e08b02c8241b359697740 v7-2-263 -43bf0bcf2110ffd8d42f0ea9b1469b1024def86c v7-0115 -43d337097e4ceffd268685809aa1e8e0f2a2dbec v7-2-223 -441f938ea9e90e07a05e55fef17ab22d2607f5f3 v7-0192 -4483ee552619492639c69f4345d6554b7bcbef2b v7-2-355 -44c01fae1181944162c94bfba919ac9867ceec40 v7-2-160 -44fe912b5a1b3961c7bdfbd2a8277d38eeed1e77 v7-2-145 -451bed7e9572b45d2bc98bb5c6680e7bdf4a3fc3 v7-2-321 -4541e06d4fb9dd8b69a7ab43653c72022f95151f v7-1-323 -4549e0e7fbb661089184c7b0ba1888cb6564ef2c v7-3-076 -454d71a434176e2d1ce0c2a7d47bfe2583a5069c v7-1-037 -456ae41254c975189c55a6ad28b1255936c847fb v7-2-159 -4577899b8ff1548f3f03e6516715087c9aa15e6e v7-2c-003 -45898756e0598f357776ae5aa05d717a7017e0cc v7-1-105 -4589d1792c036e15d1f9e72c0252fb243aa6d5e4 v7-2-094 -45ba31f9ba0cad526601d1d15d4e05180967133f v7-1-127 -45bae37de0373ed58d6f4ed8721d594ae322782d v7-1-031 -45d9e2f80fe18c663346a2e88409bf2476e874cd v7-2-061 -45fe7cf4a89e3963ed9c0d6a34600dcff8de3f9f v7-0-176 -463e25d28b334622df784faea456a98ddbc0b5ce v7-1 -464da5b48d277d1052e3c211000717947fa13da6 v7-3-130 -469c42f90fda78344dd4b33e7c0dd0860b777939 v7-1-030 -46d39f2eff86c940486c2da466283d7526b98c9e v7-0027 -476336a5ae9588c4a13721b5ec1cd792fa44ea2c v7-2-404 -4772a5e3f9fa652baa1cb6d5295d60daeef6ef0b v7-0138 -47a0dcad7216bfe602a2ee241df60bfc41c04979 v7-3-120 -4842e7421b5207294cc90f7e2d2d18c24e65753c v7-2b-024 -4845822f6a6c21860e0a1b4627996d745d455da2 v7-1-213 -484987f8e04c44e19e1ef2f3f6864b4c6fe61f1c v7-2-118 -4869457735a9133c39202f797a6694301c41abc5 v7-2-290 -48775ea99f249b75872e9f0268c5bda8cb8af8da v7-0-007 -48b22e2eb1ed7782c4dfb90051b64d6614fc6d3b v7-1-185 -48c9c2bf59afb140dfae3f4b7182ca410e72cb25 v7-0060 -49b5a7f186aae9fdd9b633037e8da484c61c55bf v7-1-002 -4a317df1696281eaee0e54b5c1636186290863a3 v7-1-298 -4a4287c09953fff6a65f7324c5f223f7359c46f2 v7-2-390 -4a4b16c67c62174b3b66848a32f4e5554b9cf6c0 v7-0-183 -4a6554fb0483f5cab10876ff0d9a0e92a9787119 v7-0-161 -4a7320e53f32e1f6d60c498d870e6c4b8c7acc35 v7-0126 -4a79d6d376f0897e3a899ccb104a324a94bb846c v7-0c02 -4aa4510d548c9fff9d8317977e3801a68fe2aaba v7-2-341 -4ac0c84d1c5038d0f6171c68d9c58ef0fefd4226 v7-3-079 -4ac1dce8dd5e8d8e97e3e7b921f3ada9db2fe2de v7-0012 -4b8583e82cb8875d14ff928db281aea8145d0b0d v7-0201 -4b9fef49d7ff02cf781d26d5b85a0a03c8784fd8 v7-0095 -4bac29d27e2f4c2779ecb72a5e78cd4a65cb455e v7-0 -4bac7ed34007ad41b7870888c739c1b4a129cfc3 v7-2-368 -4bc81d4dc6be1c45e41f1b083ad7fc07c58d840c v7-0-142 -4be6da0fa3d9978434273d3abc021d7e68455864 v7-2-400 -4c02214d1465ac2b014a9a1096927ad04eb710e8 v7-2-200 -4c41f0da2a2e35b42334d091130440d1b1479e7b v7-2-324 -4c70a10ce2bb6d83a4cbf3e3baab19d1752f2230 v7-1-042 -4c7cf05f60b5885e1a5caadb787cc6e290d7ee34 v7-2-110 -4c8008ab94d8da38529991004a56e65547faed15 v7-2-431 -4c8b90b7a94a123db784dea518f3c9a3bdfe85c4 v7-0-221 -4ca6669af2cdc06f39d77bfef82663e5bbdedd56 v7-2-046 -4ce0a7e4c6b3a305419590c746d2a11040fb2b92 v7-1-036 -4d53c2a2af94cf7a657d85e27f891b2d53b698c3 v7-0054 -4dccbe792a5e00c40a6e5b4f9e74d20b5aed2c50 v7-1-057 -4dd75cfd946f31e81eaa4b03ec81ef141c562137 v7-1-071 -4e22214f84640bdfbad591ec2da5eef9bc328dc5 v7-2-409 -4e581f1b08dac0b7f9345bd51b03a5fdbdd49ddc v7-1-281 -4ec11bb387a559fb6168fdae70e7d0ad78e15c3a v7-2-372 -4ec4c53046b5be6700810b9b92996a0cfb4ed52a v7-0-021 -4ee809acd1ab9c2fadee72e0fae32de57040447b v7-1-124 -4f1130893a1c135b1200f6857bd0ebfb143350e1 v7-1-320 -4f1b94b51e99370161ceb5a923573772ca068582 v7-0b02 -4f3857aa17853ab6c36005520ae723af92f50b9e v7-2-264 -4fb859cd9ba955957ad712ea390e87cffec6a540 v7-0-072 -4fe8e1a7758ea8170eaa4b1abf11cc9682437cbe v7-0102 -501b107b335af7ffcffea060c38f4b34dafe4101 v7-2-012 -5027d3220e2adb2f2f54e85f469a7b4302a010da v7-1-308 -5044d9d784ed2958022fd3446910567a4b84dacc v7-0-154 -509230ed2036945be2d9db7e1ecded3c59518c2d v7-0g05 -5098908178cdede4656e3f96f2df2847573e6ed9 v7-2-050 -50a93218720458be104f03ce1be00bcc8b898eb9 v7-0-228 -50e0337c25cae29dd3e63b333d4bfb68cc9b3740 v7-1-239 -50f5ac5b90dedfc7f88a67d7a435014e07c298ca v7-1-094 -5117153003bdb002aa3e68d3b90a98a973d38078 v7-0e -513866ffe6af0bcc09e7275c0e9130170de66acb v7-0200 -513d037fad505a5169add3116ae459bd1adac381 v7-0154 -5232b9862f238a2a109f15527825e5cac1668a04 v7-2-000 -5232b9862f238a2a109f15527825e5cac1668a04 v7-2-080 -529c6a431ff5d5612bfba4424c023dcf073c2cc1 v7-0-056 -52c87a746f4ab8397933a53388389aba6a16bdd3 v7-0181 -52d17d53b555c45b0b9f4ddaf3551bc8ad5623ce v7-0d05 -52e76e2b5b65eae81c4ea93d290194763d7edcd7 v7-0140 -53175322ef40dd7f50dc4153e6e6fb530a4b2b29 v7-0070 -5332dd13733cd57e814b7e21cb577f6ad0c15408 v7-0094 -537cb92935b690665a72f2b31dead8d9b322dcb1 v7-0-223 -538cd3220874d9a98abc7219e7be6666e49f853b v7-3-011 -539d9b8f418aeeeac3d0da1932e1cdbe709456a1 v7-1-265 -53b2bedccfdf5ab8cbff6c3fb1f6f83ac7112b85 v7-1-091 -53b47a10825a20cd7684046146393a641d89972f v7-2-163 -53d475dff0e363bfeb31d6d171337cb19c309098 v7-2-374 -53fd0a213cff86b7185c5391cef34c1265f8b8f5 v7-0-237 -54a6b47d473e64d7ae5212f00b8b125c721d2c41 v7-1-160 -54d5eb36689f1a409d13cd6ff9b06d68a30b0d48 v7-2-092 -553c97222cc0d0adb7beecd6f73be1c512f2f37c v7-2b-005 -55e117ed68724567167ed25bfb5a320585f1bb5c v7-1-075 -563bd9a63fdcb08d55b6f6087cc8ededd31b891d v7-2-010 -56609cdae088c4d5b38ac94a95a07f1520b56fcc v7-0-059 -56695f1182f01d75843d0433484c94c1eade71de v7-0-238 -56b638f2029e728f1fb20382a7184a8e4ebdce9f v7-3-018 -56ecdb792c3353d9fc587a515fa4991e69363dd5 v7-3-036 -56fb4ab9f62f19b9812d483aa76f8b53104db26e v7-1-225 -575dacb554d8b134356fae0135383d5e2231113f v7-0096 -58059676e24a6fbbc686faf84c612cfa8c25485d v7-0-134 -5858c00d0f2c47b395e3c63cc809ee667f8c02a4 v7-0-122 -5898cc36322e7f1dc371e89dfb5e2ffc3c6c6e3e v7-1-309 -58a14bafc1f08b9712732a26a44c2a93e34e6ae2 v7-1-209 -58cad056e60844274b103ff3fdb56d7a6749b121 v7-2a-00 -58f47e17ba1565ec9c538c7f216cb9ea66e58a63 v7-3-122 -594f25e4a8065bcb865784556adf556004bddb24 v7-0144 -5950b03fc906f434d5a1b899bcee8ff839b05a34 v7-2-020 -59edc8429da0ca92da8913823f56b219e3a99051 v7-2-065 -59fd8376545beba122700d5a481793f29ff0a69e v7-0058 -5a1d8468d1fad7189c8c781149f034dbb4208b39 v7-0-224 -5a1d8468d1fad7189c8c781149f034dbb4208b39 v7-0-225 -5a1fe35a6eafb1c994955a34d8152996d53838e3 v7-3-092 -5a7384b9ca6691ee880dd4e01dddcba5dcac4f6d v7-2-031 -5a7843c57316c63d1118b6a5c2f42d330e57183b v7-0e02 -5a84b6388a5589d6f3b53a1aa6f8fcc369989a0e v7-2-369 -5a97d0c03b593699d6e0bb2ea49073dca03153f8 v7-2-397 -5abd3e3c0085de46b37ac9bcee90be8160dccafe v7-2-363 -5b101ff9d4c43c566e7adfb0a7c0978d2150d741 v7-0203 -5b154df6fcd89b4d24d34da63626cc01d9b5c0c2 v7-3-033 -5b43a3a9454ad69432d5cc82b70d59ec6c92a45a v7-2-003 -5ba8e25f7fc159a684a965ea9e6626f62b76997c v7-1-188 -5bbc2d6658adb0dd3c67dd80c59f3a7ade3ba3d6 v7-2a-013 -5bedef935ce38062e866c72aec633d38d95dfbf2 v7-2-357 -5c3844ad7d5677953eac88ec4ee317b298812bce v7-2a-017 -5c4b2fc4f067cd04bed4fd0a13bdec7d26036d26 v7-3-049 -5c6a3e894d43ed024662462cf5c6f77feb743132 v7-2-288 -5c6fa259c9236cfacc66dfeade89414479b5aa58 v7-2-328 -5d1ca05fa8ffd87bf59d26121e6cff5f91e9afd4 v7-2-199 -5d25cdc3c3f31d4893f646d5e7b94435ef59aa5e v7-2b-003 -5d2f6d04c82f900b01c18a7bcf2287a42cf09ffb v7-2-253 -5d5a41a95347bf4a1382babc697a1f940a83e43c v7-0-227 -5d5cad78a8380735abb8ca0e7d3ffb11e9eb98e6 v7-2-300 -5d84650b569c7800de8012d91660441bda95e5c0 v7-2-108 -5df74a812b7b20bd7e33634453c645be0eb8a2c4 v7-3-012 -5e0c164fc1c25fdfcef07fc03c6634216e6ac066 v7-2-277 -5e168526af25c0a59c55dd009e10a63d2f156114 v7-0-033 -5e225f973b5d22208869bfbf151c5fd03b5a3451 v7-2-089 -5e75d07bfe75fc81e0dac043b6bc0ba417736b17 v7-1-293 -5ea1f7516c2cb92422abed07129357a0d5a6a787 v7-2-165 -5eb1ac6f92ad40da9bbb585f5ff8fe003e85122c v7-1b -5ed9395c1864269b18ffad462291eb37c92792f0 v7-2-235 -5ef53a1677ee9c831d7a18ee44d1041f182a82b2 v7-1-099 -5f0c7aae4da272c73cfc625f35dc050897b6afe7 v7-1-330 -5f33b64a6694dbc2c167b86c56488ddeeb7f46c5 v7-0107 -5fafc42c22d246e4dcef5c09d70b757e0d374b2c v7-2-053 -5fbc411a611de301397bf4f8edf494fe07bcf6f8 v7-3-042 -5fd44cf99b6ddccdadcf70ff8351999e4bf5dc38 v7-2-398 -605f5c2f77bace46037afea6841f7876af85a4b4 v7-2-182 -607cff4bc0cbd7ddf84007a20bf3e6bb01e70694 v7-0088 -60d21d224d251c448ef76b1b9df087497c06adf4 v7-1-038 -613517f0b72a1600d58abeb8c44df9b3de1ac997 v7-2-284 -61709607f5e26dc1d4cf420a25292ccc857d3575 v7-1-228 -619b90abfdc95e3b1d0981a8995b942c6a7c3c29 v7-2-032 -61b50044616bc626b27630b3c9f03322db0ec609 v7-1-090 -61d080cb268e21cc2275da3a0ff2b2081d97ff51 v7-2-086 -61e5d40135d0d90f5d1689c469958bb7a37e074f v7-0-139 -62716fd61fe94fb9e7f39294dfa9dba4aa06fbf8 v7-1-204 -630eca9496e07d9a778fe87d087832816a01a850 v7-2a-010 -631143ac4a01c32e465380ba2ab7f82949f20d75 v7-0007 -63157185aea525b39b1238df3ffbf4ec0fea10b1 v7-2-442 -63369d73b551cb0b72202c29dfdf59aa6049a333 v7-2-161 -63613d8d7e4dff96ba2f34be50fa4b002f56cff6 v7-2-354 -63bf37c1e7a2c323b368df6e926b026139ec3144 v7-2-401 -6412b0befebc17db58a1e8acbef86d3a3e4f742c v7-2a-007 -649d340f34d3ccb1c96efa9522a65803575d901c v7-2-067 -64be6e0b070a5f5f58eddedc8b57dc0356642cd5 v7-0-004 -64dd70f176c92013bc7efd0f3c50083fe4ca0972 v7-1-021 -64e2b75e16158d89c4a600bb97a62a4616632884 v7-0-141 -64ed4359d9570e345dc109b51138c36ac8769614 v7-1-221 -6510d834609f78327cf78465d6849601bfe39108 v7-2-380 -652d074e0264f453cbf76df0ce041b5032504085 v7-0-048 -656853d9c014add434086291b7af40ad828f126a v7-0-111 -656b4c052203990d56ca731d2e3ca39ebd9bd775 v7-2-029 -656ca7102064d711eed5cc678b4a5cf03b5d9c05 v7-2-026 -656e652c6579a812d9f48a0e5e4d8ee47ebc1a35 v7-3-068 -65c332f15dbf3376ed5aeea423e8f1584a65ff29 v7-2-083 -65e0c2e3a3521c9782728f307ced58a5740d87ac v7-0-166 -65fa3b16f040f5320bad34c324f230099bfd8f0c v7-0222 -6605dca2960f5c597f981c60cd3009e98b173883 v7-2-178 -66080ac5dab745208cfd8f385faea24ed68be68c v7-0130 -66263e241ce35e11faf9b33ef6e2d509e1ada4eb v7-0176 -6632670ff6fc2bd4dbe01001086874b9f75b0929 v7-0-053 -66475621f0bfacb601f38c15625c15c2a478e672 v7-0147 -6675076019ae7e7444c526b342c91ae2ef6cfaac v7-0d -66b1822ba176a2f7d7e2878b2907af6d86e5b5c8 v7-2-326 -66ddf49935fb8979def275bcf7c56acdfac7ef6d v7-1-015 -66e40876590bca973973b6aae208a14cb428c266 v7-1-007 -680834cb19eb2dfdc88aded4bfb36518ca4caa60 v7-2-022 -684ea86baabb6ead7b673d20de6f4b5b27a3335d v7-2-101 -68f00510705229a9b8653612b806dbbcccd5aebf v7-2a-001 -694e8715dce6af134be79c99e97f90786088078f v7-1-316 -6974b167d75eabdf70005f666e3dd0e82e47be4e v7-1-056 -697dec8ec5e723ae32e12229d3ca111fe7f4ba92 v7-0-037 -69bcc0c891d706d3383f013e9e5f8876b6c76d4f v7-1-158 -69e8006af73433fa27ecf32b695919bd665be1c6 v7-0212 -6a2e4860134bf0e4b5edf382627809dc6cec309c v7-3-091 -6a80537ac7aa6d4c9011edf4db84a6aea85d2911 v7-3-041 -6a85219723b98ddd686d1a80c481a545bcb535d8 v7-3-027 -6aea606c9e911f768a5e6c9626581721f460f756 v7-2-068 -6b5d641bcdd45e53c24e0b4e0b6085a696e336a8 v7-2-395 -6b89fd4ffcc698278ecc582280c79916a425498b v7-0-008 -6ba0265d1f1b70b8a4a2b3337b18ded763f58f09 v7-2-295 -6bb1fa855dc91259d295a1beeb4144aa51b3cab6 v7-0e03 -6c05b5e5c1be4ee9b8f96334b7fba7afa832524e v7-3-032 -6c3c2e464a9628bcbfe21317b8fd90ae27076735 v7-2-392 -6c4da3e24371945408401d6330a930d44cb5d716 v7-0-232 -6c62b9b939bd8f3df4ec59b2c2d72bbbecc723d8 v7-0093 -6c7719f94811d10db3f86578e5286e5da2fd8514 v7-2-170 -6cc8a093e4a9b14df444effaef7274d2318d00d1 v7-3-115 -6d421b3c485b2da5a04529c6b71041031d41b80c v7-1-046 -6d80dbca8501a4152908713778ce03e0f45b93f3 v7-3-118 -6d95d8976b00540c053d11fff36e20556d125152 v7-1-200 -6ddd55ac6ce50b94713303278888da04d21f489f v7-2-249 -6df4e719ce4eb637d6db90febd0d1eb48bf8e96a v7-1-112 -6e03ee418b50de776b583358fe2ba20bbaf043ad v7-0-137 -6e9c10c63e25ce9212c5d629c9fdb60b67e6658a v7-2-216 -6ed4a82fcfc6f1c354906dfaa5e13a192b3246a9 v7-2-175 -6edf4a4f6cac62dd123f7d1017a7624c9f48e71c v7-0110 -6ee9d7fa5df6d00c892f7e93a63435de5c50e083 v7-3-057 -6f12c4eae4f69d1379427e8b0cee82769f75c35d v7-2-153 -6f4740f72d3d2018bfb19d4c8d8064e3682fd883 v7-3-090 -6f8b578776ab0204bf16f669383aefb0661610f0 v7-0131 -6fdbaf2bba0459270702479d6c4cd04f4f6bc034 v7-1-098 -7002404b17b15ea37887cb1dd5b5b95883cdd27f v7-3-054 -7015ddf8105575fcf48eac35b14c61a24fc38d7f v7-2b-018 -7033303ea0c065c16d5fc31d485c949f7949c10b v7-0089 -70661384379a0dd305576f64554608a396b0821f v7-2-056 -70a5e723eea2c648aa82f7c8f28a2a5dd5429132 v7-2-213 -70c67b1bb1f1aeddc1dea55438e11ae6f9ca3d14 v7-2-329 -710b52d02c4a0649d5b20c38e3394a2e248be9f5 v7-1-237 -710da9abc3c1191eec6633477eea663fada04939 v7-2-317 -71219f47ccd9551fc7d090e73afb83cc395232d8 v7-3-025 -717e759932cb94af9ee8dc9e93f33b67f292e8c1 v7-1-217 -71bd485d8fa572ac15207c5c1059b2ad0ae685fc v7-1-166 -71db8539b8c487eef0df17f2069d96fea1911cf1 v7-1-268 -71eaeb69efe49baf0f63c6e9cebde1aade638ccf v7-2-007 -7209e03df1005fc037c029799b068f545b60433d v7-2-075 -720a59d79bcd3d606bb9837492295d0c52835500 v7-2-168 -721ebb602db0fd2a5a9cded8e0830800d734469a v7-0-135 -727ab557c58a3257743a8b7589d91e21975b54ea v7-0-102 -7281a86ae640e65e5eff6d6b565be20032f736b3 v7-1-016 -72ef7987368de4715599707a85f74a8e6d029c9c v7-2-139 -730697e82c43a8bc8b5975bea39fd180fb62a4be v7-2-091 -7317e0e2775877fa0b817e20d29de9eba1a4f95d v7-2-254 -732c7ae5743ec2d22423a8bb631e2d3c5fb8e549 v7-0180 -73354c21f1e40dc792e5829152992e76f7a607ee v7-0066 -734d5bdae499eb2fa3f818e843efd9727e7f69f3 v7-2-041 -7387540b6e52e3faad6c78182de9d1354ac9e6b4 v7-1-297 -73995e7c06e668b3eafc366b3c959d32f6bc00e7 v7-1-174 -73c0eeeee0b789738812c1cf821de3f86e1fee53 v7-0-174 -73c5752b957d49da8312ef87383a7368c78df74c v7-1-295 -73d947c20291fd857fba24ddf4725b9b831188eb v7-3-038 -73dd10c18ec4eb2cc0857417fb8cc20f63dd42e1 v7-3-060 -73f10d8124f48510e0ad1468ee9e29c010009621 v7-0136 -7472c565592a373abca2ea571e229b4bcbfd7b15 v7-0117 -74e9d19831c2357d7b998f484ebc609dbc08c5e4 v7-0081 -7557b6ea0fb14ba4e97f5a8a04438db30cf902bb v7-0030 -758822790b43d2fc184878c3a50a12d71dda794e v7-3-031 -75a69023117c516ca184ed479727f105af12cc39 v7-2-221 -75a89c7c204e0f478f480598cc3f2a8c45dee8b3 v7-3-059 -75ab683fdb50e83cb9037454f5dd8d602e08e4c1 v7-1-233 -75b3f9cc19da44ef65c962deb7a6049c305f49d4 v7-2-283 -75c88515e0db5fd6f88a05634d9abd22795aacbd v7-1-214 -75dbeedddaa9b0e0784c4d23d71de713a533c5b4 v7-2b-016 -75f5889a5d8e8272fd17a104ef148776f9133aa8 v7-1-260 -763272b18e4ffe717ebb58827315badc09824e86 v7-3-098 -76406c9cbbaa1ab6a8f6ca7f079c3ba8cf06e2ca v7-1-176 -7644c80ca87b75a7dd85a7b4089e74bf5c503f3c v7-0-089 -766918de9e3a76816ebdee3b90cdb1f9f76bca6a v7-3-004 -76985a406456362dbdb4e7e4bef67656b84de965 v7-1-240 -76a42a81f68505f7b99af53a919e3cc7895096b6 v7-1-087 -76c2b2dd25c9c6945489a1c636f7e375ef1f40d0 v7-1-033 -77310929a1f94745e3d49f0cf1a6908785d3cfb0 v7-1-151 -777d5460622d4a9aac084695524d0c85b39f4174 v7-0-164 -7781fcd2b74f26a37da0d1186a1c44d904a8f11f v7-2-011 -77f3dd990b12aa963aa0a63f0db50f6443f3f41d v7-3-119 -77f8a648d2e6c765329ee6544bd8716835bda3bb v7-0-062 -78b9d5dce950b348235ee667f8573c6592920088 v7-2-420 -78e032bb32605c1437e30f7ec3215ad4c0772dd5 v7-2-303 -799c1db62b42a7c9d504c45ed313910c2e3d169b v7-1-164 -79a23c19108a8b1eb9d1b97d5844fabee6525e23 v7-1-079 -79b395ba0ea5e2bc7d27ace528d84d47aa1f5a66 v7-2-311 -79b8d69a4588b93516410e519bb9459242f46d81 v7-2-340 -79bba9e6af2b6588349ac2b3e9fb722d6ecbdc85 v7-1-224 -79d111ea8ef64e7bab0a5e27b7d5903f10e45a43 v7-2-425 -7a4ad3fb109d42f37f82664390f128dc9b7e44bd v7-2-188 -7aee5e68548a7cd13c74e67439f8c3b8ae6327be v7-2-417 -7b0e89b77216baf928145ce14741650806004c31 v7-2-365 -7b258a166daa98eb01237988ec954895a2e6ff0e v7-2-018 -7b44c70ee8ab87d5265ebec758a6f5ea9d5cfa75 v7-3-104 -7b875bfb39b871d5d40525d579e30358bab6be1a v7-2-434 -7bc38b35f1e87c1749f157ef91b6cab86bfd9561 v7-0-026 -7bcd81b96e2abb28ffb000145c917bd05e88e5c5 v7-2-267 -7c28790fa8b4054bdde6d358a9132581de76df62 v7-0-009 -7c2e6ba1d702579761d7ddc4020797bbc97805e3 v7-3-008 -7c3302e07dd7cf0d746776234ed4e9cb376d3611 v7-2-023 -7c46737918cb0adc9a51849b75b1c03da7bd77f3 v7-3-117 -7caa503b63a9b193f3b9e016a0a466ff8065f2f0 v7-2-225 -7d121c69f540272878af6fafdf658443360a698b v7-2-383 -7d127d580b6d2d86853fc0a322323cdee2eca343 v7-1-318 -7d2641e6af75b3cfb4dc29e7c88812dee6c003ae v7-2-261 -7d29124f77f5e794008c746c69a0f79da0cd966a v7-0-133 -7df2d171ef1c1284e10a4c53fb079d02e6d7b028 v7-0-163 -7e0c8a18c915a4c7dccf01be813488e27d03fdc5 v7-2-275 -7e5284f58094dd557b1502e1536c78846a59049c v7-1-134 -7e6d264ec0a270beb9692df71fedb210c1896640 v7-0141 -7e7da11555d27f62984297f3e1debc8242baf995 v7-1-080 -7f01e52cc97aca6eff92948b67876e800eb67fc3 v7-0-171 -7f2d3b3c15a2ffbd259c2ee99966124c2c2087ee v7-0122 -7f788cd2741586586a34b41627a1c978fa465666 v7-0020 -7fd70926e2e1c299ecd9dff6ddfb51ef71f7f08b v7-0055 -7fe13e0f5dce15cd16dd61c898e63899a9aff561 v7-0175 -7ff9f75f9c59f7b600ada6ac4b3234398df5f38f v7-2-245 -801d5544828215bf644cbc6ababfc66beec6cb2d v7-1-195 -802898d3afd12da41c305c495b121e41ed880659 v7-2-214 -80b9076e9e177bbcb455eef9928283077ed1c861 v7-1-310 -80e5b1da667656a146cad7a749ac9fd2afb659bb v7-2-231 -81059e8b657d911c9876f557975f34624988624f v7-2b-015 -811f29447aea27adaf1f54879ddf0fbd05a1e094 v7-1-270 -813a407a63af8773c585b0baae4d22296503ac03 v7-2-271 -8173ec1e9f1f746657dd598b6e876b11c99e1049 v7-0034 -819d952a0a5cc810c52b34e8df400f83eb3353ce v7-2-142 -81cf1b6e0a2d59192534f884135108f788a20b91 v7-0-147 -81fe2ccc1207699c377b42f1d8ca426a70177afd v7-0179 -823e9ddf23f77858f1b866fadf3e4ec5ae5d55b8 v7-2-141 -826f00fef9e338c7afebef68658716bb0aab62f4 v7-1-096 -8272535dee77ded630f57073b428e89673f1ee45 v7-2-035 -82885ffcad10aaf6d11170dc45d2721ee222c37c v7-2-310 -82add1e7c154fbbd5926df49fd4afe768e6007db v7-1-013 -82b2594be40863fef91c163200db2f56b2e4e52b v7-0-155 -82ca8ff21fd7181e16dcc58863d0d251b9228374 v7-0-175 -82f866f19e91a19ae44e7dbe5eb8747e98acfd85 v7-2-269 -8389197c91f3ecaaf28b776e69b9336eb08828d3 v7-2-133 -83a006f81bac04bf9b975347bf8d6bddc7996eb6 v7-0199 -83a126db2895ba22f2fff13b488f028ff83bec28 v7-2-027 -83eda510dbc07b4fe4db5b5f324680f60c307fff v7-0-222 -843bfffb04c739ec456e5c5f612c6d025f2a6188 v7-1-058 -8464d084fa7475830cdc53529cd20f7334c81232 v7-3-095 -8531f7ee366297c58506f9a3130f45c350ce1fe5 v7-0-218 -8562c6804861cd26020e1a004edb1c1b218af9f2 v7-2-388 -85a99ba3eb5ab45127c996c4e7b4dea2e7a76c54 v7-2-233 -85ad197907065fd92f29bf3dcc190779a20aba46 v7-2-396 -85da0376313011aa957a9132df2686c9aba079d0 v7-2-333 -86079b930b3e8735933c9349e44184761bbf56b0 v7-1-010 -862863033fddf5f0bb2f18988b79bbe0d289ba45 v7-0158 -86289e90a4bbb818e9cf8bae6e57f7b91b9671cc v7-0-123 -862d920800b1a8a5ebca3e7db5dbe431982f7d0d v7-3-103 -8647018a15f3e4e89c706b6290ab0151565f394a v7-0-178 -869c92bcfb697875d5580fdf3a13eacd5648c5f3 v7-0085 -86ce35c9750f60054f48c1bfb80507345b862d8f v7-0231 -86d71ae0c85a546d4a00b53481b540a4ade2c9bd v7-0042 -871231399cf547112a50a9f93497d40d01b66d51 v7-1-118 -87401adbf5fcbc6fb8edf329290c445528266bc5 v7-1-067 -87a777aea8993a49e61394e7a84847e91b014090 v7-1-005 -87ac4be389523f44914899c37180d22b60757ffa v7-0128 -87b6a6a065ab60f6ca4ed094c2afafe16e0b590e v7-2-171 -87b9f21264a79be4ecfd14f69da0577f9d41f260 v7-1-247 -88095f75d63b5a486f603cf28801df0118ed1218 v7-3-015 -880ece6b24762edd52b414aa1f005478707a3179 v7-1-101 -882b2fa49a2a888a8231f3cf2428b91439decb93 v7-0-014 -888c0645d64f3a844b22525387981f17317d8502 v7-1-069 -88c0c6c9eadab09b029312433f246f65e216a1f0 v7-1-184 -88c68e59d39cee12c580f1df72a5759e58574978 v7-1-088 -89189f7aaad9c28435aa5cbd4db359ae54d0769e v7-2-312 -89300f5e013c7d217d5f891113a57705cdeb017c v7-2-414 -8978513bb5e31d3f20c941e5141d228ca95a6f58 v7-2-100 -89d1e8ed6c1d6d9a672880fc73df97486b2d5966 v7-2-227 -89dc68c0ab6fd676ade26cca39e16b81896a5069 v7-2-386 -8a0a8f10b43e02d44ff26d608cd80fb61ce4773d v7-2-356 -8a2092b558c2fc11605dded24c4c5a817ca92ac9 v7-2-443 -8a22a90c964a168cf3d93f5ff8d5c531a4327ea6 v7-1-229 -8a5a95f7ef2a7dfeb585d0392489fb57ea4c5af9 v7-0185 -8a6982d59d8ef4afa5c178d772bd2943665f0146 v7-0224 -8a6c67218fccfc536fdf829075e99549fb8247dd v7-1-173 -8aa3cd045aefc5d324d820f2239ca1f533e9632f v7-2-379 -8aa94f8080bdeb8908de30bbcf62945dabba1aa3 v7-3-022 -8abc0abf8cbd09abaab555fbbaedbbc231d42b41 v7-1-248 -8ac6392acb0a87a779340f949e280bafcc49f55b v7-1-136 -8ae24f338cab86cb35fd495ddc3cbe2101ae1558 v7-0217 -8ae4de2d02af315b1c0abc2230c3ccd5a31f1013 v7-2-384 -8b2e9257cc116bf30b755aeb37a742ac83f5da42 v7-1-152 -8b84fe17e147219e6ff181f6bd7e809e5116588c v7-0159 -8bebcabccc2c430f05c5d85f8532adccb18a6136 v7-0e01 -8c229eb52e347be77c76c1c2c96f717cbfdba4c5 v7-0099 -8c25f10d49e7186c9785a0f01612166f20a29298 v7-0028 -8c60f65311fa6358488f671adc226950c18a993d v7-0052 -8c8d07318d8d0b1bcfbd395ae7aeec6813725b33 v7-0-086 -8c9396275bfaf3ba6c759c26fef07c0b687a8abb v7-1-277 -8ca3c9ad0bee0c265345decd180d971197e36194 v7-2-366 -8cd72985156286e77ac5d271a13cfb569b29ed76 v7-0g -8d09c1eed8a57bb2df53fb1f1747137e5a3489f5 v7-1-074 -8d1db3e3ac5f3f33dcf5f68ea132502082e787db v7-2-262 -8d2b705a5a51d2a6756f16dee861dae4ea97101a v7-0113 -8d34af900baedf0db9a3e57bbf48eeee75068e06 v7-0072 -8d74df00f7daa4e79bf7fc56164369781408e1be v7-1-262 -8d8dc7e07999acbfd89d0b646d72fab69e06bef0 v7-1-230 -8dc36a64ae8b36d124bc0767ccadba3daea943ec v7-1-294 -8dd456c1e283bf8c85e9ff38994fdfc6dd009ff5 v7-0c13 -8e2d14a3e7d2860527d39f0b662beade84db9d23 v7-2-352 -8e42199f51218e2a14a946ee50c1e8d8ef38205c v7-1-054 -8e5830943bff21c0a2aa18399d18c8269ed9d3f7 v7-0e04 -8eec9649b7a2ea1a441723ce7a4e8637c294ffbb v7-0064 -8ef9da918a98e7f8fecb4d88914e4691a8da88b8 v7-2-413 -8f72e3512b437d2390860bf9fb6605b778cb0346 v7-2-381 -8fa8d7964cf116fa98895d029808a0d5e1cf201b v7-0073 -8fafff87aedbcc1a7c71e29a9369056e5c08e84e v7-0-075 -8fd2e00c44ae10bd9e8a8f5c12db47378314457a v7-0-112 -8fdc1210333357780019fa8dbabc34f07d545775 v7-3-035 -8ff7fd162d3cf15129e377401e49f8210d62aee6 v7-0016 -903088c7a7c61b7f30d35c8a184d90b7af4a44e6 v7-0193 -9032e466829601e6c56046813d0a9a00946a1d10 v7-0189 -903fcd726d9058a0b0c14a85cadf31aae3ad27a2 v7-2-359 -906b37d2f9c3a85fc9c67a29005ad1538e60efcc v7-0056 -907cf09fbb32d7b189d3372f3c4f1220f198a9d1 v7-2-385 -9090f866cd57a7febdb2e0679bf0a5e86951e314 v7-0197 -90ee46d7f4927c095141dd4afa92400f2fe4c697 v7-0164 -912b18745defca4b03d5738fc7ae6c76d701f2f7 v7-1-143 -91e7d4a7b3b0e20b6f5bf9468ad17625e745d640 v7-0178 -91fff9db214e21eeaacd20da86b22629ba6d92cf v7-2-297 -920a993902e8332e3fd539a54997278364fdbcf3 v7-0062 -92168cfd558c53f1fb0d8014559f16be0a795171 v7-2-167fix -9230c45fdde65ac15a42c39d851c68b248fd6836 v7-2-226 -92809ecb9a476994296e51001486b3934561fc87 v7-2-292 -92f3089a7b10dc9e8f5f3c69ab1e490d52ad2f0a v7-0-082 -932fe018ad166a9f8e4b6b0ae91d562cab7c37db v7-0-168 -932ff0c0f57bb90d48470b70cc728058e0c56e3e v7-2-173 -932ff0c0f57bb90d48470b70cc728058e0c56e3e v7-2-176 -9364d114ed8d089f3a42c910442957d33e5480cc v7-0204 -9368159253f847f95c6c1f39a894e26fa3c954e8 v7-2b-007 -93ffa40b532038ad22824047b15c6edec3b6af5a v7-1-155 -94164a5b0626984b565ae6421c64bfd6d993e162 v7-0-043 -94694351f592a56f8a379510eb6992ed0dbee821 v7-3-029 -946f0cbdd535d6fb8915ccc87b837edb15287663 v7-0074 -94f44da44d2e0874a562918005789418793bb507 v7-2-339 -951641b8784de5175cadf9fdbc361db2b6b45060 v7-3-102 -954947a70580c6c5d94bd110f974bdf103dd6fd0 v7-2-166 -95723058b8ff365843508cfa47a3bc2ecb1b0cf8 v7-0-229 -9577a28005e10fab0a0cada6c41b96c9a3e1bfe9 v7-2-446 -95b507e6c9e75d5b4c114a63a98b4bc36c643eea v7-0-145 -95b659982b7c17ff93304a37f43be8dc508e20dd v7-2-375 -95dac6af3b3a8f50af24432b7e355ea44ec69f95 v7-0232 -95dd473d2d28a088822c73309c3dee597c96facd v7-2-044 -96276cc11d8e68ee320e0f61e20406dcb7a0b995 v7-2-240 -96445585f1d9d1abbc74d9c24efbf0408b2cbb12 v7-2-151 -9656552c468d29773423dcd62a323aceee0b6c55 v7-1-072 -96580558098272cca6f93085d79aa7164c7abf41 v7-0-215 -966289a3dd7ea565980bb03abc9b52d88378f96c v7-2-316 -97a73b6f28925dea4310c00225cc6210af00468a v7-2-113 -98a2a6e6b966668c810986b6ddd4820bc09db426 v7-2-353 -98a88a884610aa911950623d7cce8d067feda66c v7-0230 -98cc757f7e3dbff20ade108b82582d7a7d88ed33 v7-2-376 -98cdf5c477ec3c3ce8851a517ca3021aeda6573a v7-2-298 -98d1c149be76b44332bdb72e986bfc8b0f9f21d3 v7-0-160 -98ef5b0fe07610170bd68aac5ba6e739410c913c v7-0-029 -9913ff5706164031d5f847bc0980cc61eeed3974 v7-2-119 -992d5c69d5e917b03abcee24d2fbed8348e21c23 v7-0-132 -9947133ce85b86df83b86f476c09c0454c47a310 v7-1-078 -994ea4e6f0238f12a5516eb75f7a6d7ce86362e6 v7-0-094 -995536cad50e5c08be60c2d82c7b32a63db1e434 v7-1-218 -99a9e42e5688aeecaeaa4642d17be0ca54ab5945 v7-1-095 -99b225e0dbc1989ecae75200aaf0e5329e6bedac v7-2-430 -99ccc8932b6c450cbcdcf86de05dbd5129a370fe v7-0-180 -9a10e4d195b342292cb8ce0d368afafac146abf9 v7-0076 -9a3b65713280ebf8750989758b4b2d42f757ca9b v7-0-216 -9ab23f1e137fd5b0e35c1604ffb95979713f83e4 v7-0c12 -9adbd26f7fee884be78276fb400ee77d333cf335 v7-0-116 -9aec644c45dcc33b3f3571ba0035e7f85430eef6 v7-0-121 -9b78bb3794ba4dba44ab3eab9ab2984797e839d6 v7-2-350 -9b7d8fd5dc68074119d5a609210fc1ba924e9d7a v7-1-148 -9bc164a2c8143f6019d0b13a2aee4be89da3a9fe v7-2-204 -9be44c669f4c67406132ede84d1d2951eac7d63c v7-1-172 -9be87deaeb527ef18daf09d6c75b21d1d7a65d78 v7-0009 -9c510840e896fc3776ec7694fe90e18808036fad v7-2-439 -9c5a9e4356f8ef42ea2c177568b63bfbb1779bb0 v7-2a-003 -9c970d8681f46de0b13ff16d67c2327a19f33626 v7-1-226 -9cbe94fd5c8f1ca388ccd2be94f17caa33ef093d v7-2-314 -9d6a886aceb23fcaf8f64f9cf1ebf3f83d14b2da v7-2-242 -9d74e2f433c0370cb458c83d12b05f72226df489 v7-2c-001 -9dbb57025f2542dad344102c571c06da6b840b34 v7-1-139 -9dc77520c6d3ee0c3e689bc3e6d635cde80909ff v7-0-013 -9dd62cb57ed5845c9c2294b6002a29702ef043fb v7-1-319 -9e0174515abb6667a9e74e6fefc74ad50d7821d2 v7-1-291 -9e084588b706867fae28f93f67d163635a79ae51 v7-0-188 -9e1cefec84dde22d62c1bd2dd0ceb4e072470981 v7-2c-002 -9e265d9089fd4afcc03a4ac7c1ccbd754c8ef6f5 v7-2-436 -9e359e5759f628fd0ff90172d533636440b464e6 v7-0177 -9e554211caf55e33249908747d9259ac77f10b72 v7-2-301 -9edb5759494281d90ae0f312b2ac32c30f51ca50 v7-2-260 -9edc96495747bd354e68dfd76b6ca525d39e715c v7-2-206 -9f184758f277b816c95fd946cd2d63578d296578 v7-0-010 -9f279ebda75194c26ba5c917f68a7102348215b6 v7-0f01 -9f345c48220b7a503fde0367df20e576fd46b04a v7-0c -9f8fd6a14cfc84953deae7d00287a1949c0f0eff v7-2-004 -9fb5bb1ea79b5ba402e51051d79a3476ffce3c35 v7-1-044 -9fbb40a1228a4d8a5f26d1dff8e2ab4e3bd870fe v7-1-282 -a03f7551baccc60bedef5ef6a9f92ccdfe69a9a3 v7-3-081 -a041f68d05909431f0a525eace55307214c33d43 v7-3-114 -a0451524244d6387ea49cfda296f6550a2a9aebd v7-0082 -a07007166d518f51749cc9e145afeb023638a415 v7-0-044 -a0a98a0f12816722b1792141edb3625dd72eb5bb v7-1-326 -a0b03b7e9168b7f7fd61b1563ffdd6d09ca54260 v7-3-028 -a0c01df852e1d183c879ee114b35b2b5b0d06746 v7-1-300 -a0c70314350fde9e0948e598fe57dddc6192468e v7-2a-012 -a1059cda45f226497278c53752d5c07d21cda09d v7-0142 -a112fdce9ebd6d538c70602550e94f29a2fc60fc v7-0-200 -a11e2070c964de1cfb9fdf3ce339ec75b7a983cd v7-0-203 -a135270b75498b76b5bacbd1e381059283c5e383 v7-1-206 -a13e4b242735dd0b3285b7f36fccda195ba1d5f5 v7-0-243 -a14db0b78c590d4bb8e1a190b80fbf3dfff89560 v7-3-121 -a157c4786b79ae94758574d5ecb4a8f4959de5e6 v7-0-073 -a16af0072ea82b2dcd265d050b349850cf8f28b6 v7-2-410 -a1c1f001b99dd591d9082db95de70e2bf8f9e8de v7-0-129 -a1c5a6cb26756450d2b7065999de140c2fb6ca74 v7-0112 -a209672376fd537735f6ab55ce926cb80fa56ca0 v7-0f -a2271decbce54d46f62e7cc9a0c4e3ea3ae9080d v7-3-065 -a27c581d2618b9bab1c7105fba966af40e23d57a v7-2-016 -a285f0cd8a462ff5cb17053fd457646f9d33573d v7-2b-022 -a2b128f7d705ef08ae91a8616cbaf40883827cdc v7-0c11 -a33e606ceea66c946219da3899de9566fb0cad35 v7-1-024 -a3552c04f4e193d981013fa4c077e49d729abb6f v7-2-251 -a36d21d4a87596abd8775c322fced6a539385ab3 v7-0-204 -a3a4be6bdcdd0f43aea2aa09288e8f515a2c2f05 v7-2-308 -a420bba0d851093bb949070895a9dcf4c25e6c4f v7-0184 -a4365075d05c40606c2ace3340e9484a6b045f32 v7-1-093 -a509e3ba61f6e541dc8772a0f9de0c38999fd610 v7-0100 -a53e7d3fd741c68a30085fd9b22d260aec93396b v7-3-086 -a565175274f6efd9d4f725dcdee1b6e049258d3c v7-0-184 -a58806285f2086c1591272962d0b5709a63a74fd v7-2-152 -a5b3a7fb6a5a0f1857b8d0eec380aa7a0f780729 v7-1-154 -a5beb9fb4da85dfc21dbb68af0fd6aec616dd1dc v7-0-024 -a5e1d6526ac7c92fcad2ae100b1d43ae238067b0 v7-2-103 -a5fcf36ef5129596fc281d76369077ad01323b3f v7-0127 -a5fd859f69f1b5c70de7d0439150f2c681d0d915 v7-1-020 -a66a49322b6bc2a82c6cc3e8092db7d502f64c4b v7-1-073 -a66c405786754105eaa63f3264c94ce134bd275f v7-2-105 -a6776e2c9f014491c7476c3a12b2b7f108e1b6f2 v7-1-222 -a686fd6c8beb2c41110e0a65f6a403f0ccaef83d v7-0065 -a711f7a6852db37b1687044ce8a96b6f48e9855b v7-0067 -a73a117542b8b5ec22eb3c61e45ad888d3d76b51 v7-1-171 -a75120dc3e2691218f3144bbc24369283d74eb53 v7-2-190 -a7c4842a0be340d06de659940f9396f969bdae77 v7-2-212 -a81bc802c17ce7002b08d2e327136e3ac4d11d5a v7-0011 -a83f48a17efb871266ffbcb3b6c9cd5a62408410 v7-1-274 -a8752f2805d69f51f1f6370eee8c7e2c89c57db4 v7-2-037 -a881e15f44d8b5888733fc98c39984c2fe6316ef v7-2b-011 -a8aae2e1d2ae6c22551400d451e4ecaccceffcd9 v7-2-049 -a8bcc7553263bb7a12eec8813270ed34242dcdfd v7-0-190 -a8caf7dd853dd5f5ea2bbc671467ab2f78989f44 v7-0205 -a954a30e407394f51218ead2a7d832e022fd2378 v7-2-115 -a9e353f7fcc48a2b603ead42451ea8e89ee7b9d0 v7-1-285 -a9e90b3356b62da552b62eb62b8dff78438f2dc8 v7-0036 -a9f561ffbc53a7097873cce7e8a8e1615ac0c38a v7-2-243 -a9f814054152b658c1b90aadf0f75428e1130cd3 v7-2-074 -a9ffa7c7db7757ae7c1ba0e7d3b990bafaefb558 v7-0-097 -aa6caa23a4b834360b82d3d078d1d17f33d673b7 v7-0152 -aa7c51f81f46cc5379386ac622a5ba44aae1c4dc v7-1-227 -aab202d244b6bb286a62508a432222d26d5d215e v7-2-394 -abff2f6a3ad7790f86e055519dcb851a06fe78c0 v7-0-036 -ac0458d9b9dde727d1bf11e9e9221edc20b623a3 v7-3-026 -ac04f392ba48436bc1b90d3d8b8d384fef4f8135 v7-3-073 -ac33b7c03fac7bf435346233114939fec2e187e6 v7-0018 -ac6d15d91466b34e4ff31765d1d1e1733f02ffc9 v7-2a-014 -acc572c5660c90020f42c9f31c1d2c776c5dce47 v7-2-097 -acfe86afd651f1abcfb6eb38ad0101e61a27c65f v7-0135 -ad8f5bdc727441118cf45678b031d04d1a77aae0 v7-2-001 -ada3271481ceab448c69588c5cf837c2dbc91987 v7-2-289 -adf6a9dcadeda32a2a339069336ebed7fe6d53da v7-0-038 -ae2251be41f935706f7e634a832ff5ff8a91d023 v7-2-185 -ae22c450546cfc001c90ca17999318e053838c30 v7-2-433 -ae7e29b64923da886325215a1a5b20bd60e4cbc0 v7-1-194 -aeac63ad9430d81a0dfdc21080f1f05cdc633baf v7-2-048 -af7afd2bb4c235544fc9da6b34898ea93d477d77 v7-0-078 -af98ef7f5a39aadfe18dd44df9afeedbb0665778 v7-0-003 -afad99b3612ca54f3668c232e8d3ef235d74c9a2 v7-1-028 -afb64d9f5b8ee1eb6e787e1d34ef8b80f15d4749 v7-2-013 -afb740b5dfabffdc759d3428254c944bd4badeab v7-2-191 -afbe4a4c884ceacc349264075afe26e93bc75f07 v7-2-208 -afc60a6339a68f659addfbbb849e249964c9107c v7-0104 -afcf9db31561c7fe2b62b346aca751bf7bb31bc3 v7-2-336 -b00bc2bf23eb62a1883318c6565d3fe0d1b4e30e v7-1-119 -b00d5f429a4b2f0a23710200cdf2a672ed9d5501 v7-0-108 -b04bb35fcd4b7edeeb8e175955a2909a86dad118 v7-0-240 -b0605f2f9786c14e943a0ab440c16b444f2a9cac v7-3-113 -b090b216a832197c70f60ead52026a53ecb0cdd8 v7-1-009 -b0dabd584b8f89ac32af9758c221e948016e2b0e v7-1-175 -b0f8f28a67c23c9e9b6b8087b373d6fb2add726a v7-1-197 -b1706a94f9f9638cc0ecb624dd7519cc9beb6ca1 v7-2-405 -b1b09b68d7069755425a2c1849f517f3f9e760d9 v7-2-279 -b1e87b7f5db64eb40fafb0e9bcbb0c39fa2bac63 v7-0133 -b209c3f94ab7ca3ff559d255c395fa013fee31a3 v7-2-073 -b254cfdd740542f5778d787845134db3c7584335 v7-3-071 -b2789846ed3978ec3dd9a91b6e1ef2f4d054431b v7-3-069 -b2a7d143abe2f572e713acda4a67ebce76511bc8 v7-3-072 -b2cfe84c96ccbf87a7c765442f0e32c62fa112a9 v7-3-044 -b2dcb84570675cbdb4fea2d017bcd093b3f34be3 v7-0-070 -b2e037ed7e33b48a1feb69174850acc393254864 v7-2b-020 -b2f4319efde1edbabcd900a63db8998bfc117152 v7-2-084 -b31702c473ae10db32dcedae94af25228d6c920c v7-0-049 -b34d985598f68b97fe1bdf1d34bf689ea1b8355d v7-2-130 -b4791bb4fbff451efa3ffdabd4e26a668eda2283 v7-1-108 -b4b1b5324380cad36827cc211a2f92fb165d9777 v7-1-026 -b4d11ddb7303ebc28f6a40fea28f003287e77352 v7-0-187 -b4d92472f168c90d60359f6a592d6461686c2db9 v7-1-085 -b515624f6d7dc7597b0b01c5cb03076e4daf3347 v7-0-234 -b54d2f702d41f4fbb8bb3d33e52faf94568b2170 v7-2-127 -b57babddb32b2df9f04b636154a26c51f78d73a2 v7-2-281 -b57f2617965fd682c6284a706a999b58f00bdc3c v7-3-014 -b5ad00887b816469ab8f7733643380a690c1322f v7-2-111 -b5c1cb6f8d565b4fa5b714660e8a0d7f8d8f7a5e v7-2-174 -b60a569eb708bc6563cc1104335cf56bb38ea901 v7-2b-010 -b61422c4dc7a81d340e33e0ddb8ce8cf0f94aec4 v7-2-025 -b62965091b8d258aaa26871ccf80ff9b4037168e v7-1-254 -b63792dadc23ed5ff4e0e9e8c7acc24d9c61e779 v7-1-120 -b63fe7400eb30f9c7b98199a21ed0bdc583aef62 v7-1-135 -b6627f01c67dd0bcdc2f24d56d0a9342cb5dacda v7-0-151 -b6632d553df3c8d25e419d62cbbbd1d8aa5d2489 v7-0182 -b686fb4898d1fd8579e5bf61f36c2a08fee85a20 v7-1-025 -b6ffc2045211c67d42d806af38dae64626aba605 v7-2b-026 -b76637e5ace1cd75c1894c44e132ea1e4fdc1a9f v7-1-289 -b77f790d53f6b57604b1ad5113da4ab08b4ca918 v7-0-236 -b7c22e34316251f32fa1034d11a3eba1829c2b92 v7-2-043 -b7c89e3e19f703c0ebccecc10ee044367a65ea20 v7-2a-011 -b803b277688037509ad1b6d30466721396d8967f v7-3-062 -b8744d1982d1fe26fc41d62b6e84fd315dd6c941 v7-2-407 -b88f0420148e5e65c2f71f47ed2324fd83b3bd2b v7-2-155 -b8ab4ba6b11018e468362bbadf077654f9cb4be3 v7-2-304 -b8c880d61acb8d5e08ae0cb558ece76d96d12341 v7-0-185 -b8ebbfa519b990d6b892dcf943576761e714c2c3 v7-1-050 -b8ed23ef6ff15604ead321f758ecc624a9d35c2c v7-0-042 -b9202c4cf847ac1898b4af225494197671111785 v7-2-124 -b93a3fc3897b3e16e96b80e35dbd72aabf9cf37d v7-3-078 -b9897545378516c8afe3140b7172d838f33e5b29 v7-2b-009 -b99303b1483f26763f0c4b6c9d244763ad32d476 v7-2-309 -b9975513fe244047a60acc818edd8de94935cc28 v7-0169 -ba2ac6b5bfb9679edffd08edef9cd0db1237ea12 v7-2-259 -ba32a005373a78e0b07972880704e2183f578f86 v7-0-136 -ba51f75bd4b514d5c4d48e57c6018c955434b936 v7-0221 -ba9375e24d4937d863ab87d28e6b7c1ed42b3960 v7-0-050 -baa5f81197c865fd8847f6af95fb1d48cea6aa65 v7-3-043 -babbc735b80efd1ef23f35dcc77c5f5cc9e68fea start -bac7c3fce15019af25562f5c19b099c55487a6e7 v7-1-133 -bacdeee78827acbae22a7626a93318ee1919c883 v7-1-014 -bae8347a9ae1131d95a7af1d751fa47df5d3baec v7-2a-015 -bb3661a2eccc165bd5d2a87a8d4696f89431a459 v7-3-116 -bb4797166e4c610516eaa16865682ab14411ecb5 v7-2-064 -bb7a0b90100aae1f77748f6f38aec95520825c3e v7-1-023 -bbf0ba46e51d5a4e58b872b840c5dc3e1ca44234 v7-2-116 -bc3f88ca060d25cad633a20548ca38cc529fa0ca v7-3-045 -bc68103ea3f6a13d26598bfc1958a57eae377a92 v7-0-040 -bc7ec0f1f7f35c3b58b3e32bd2ba1b87501b17d9 v7-0170 -bc95c6c4bac13d4a0f8a4bd6ec10f495d3fa5eea v7-0191 -bca50c9e1374c176a63f9baf0ed7fcb34ea16967 v7-1-147 -bce687811199a7866c7728b09f00406ac1294745 v7-2-287 -bce7c73fd56da29730fff999a1fa4b0edea3285c v7-1-157 -bd7e26d05a3fc8e010566ad8f8aea9c31ddf55c8 v7-0-034 -bd94e22dd3db36f07fd31b2e282f25ccc7335f58 v7-1-163 -bdbaeab157e6f88d82056df6b927acb5b342ae01 v7-1-272 -bdbdec22a225553f5d78db019e13cdfe92b9cb5b v7-0161 -bdcfe793d49fa832470953794583b4bb74ab9fb6 v7-1-104 -bddda5d8caa1c6bf174c5e202d3b08a51dbd54a7 v7-2-210 -bde3b38593f9d07da76cdf37ea574fc9d80aa43e v7-0-052 -bdfbf8ef447a4fabef09ee9d28eedcf0e6b99e57 v7-1-249 -be0f21f63d2c9651429a6ec9e97b8e6e9d0d102a v7-0091 -be1d64f82db26bf7892605332aea6126d6343e47 v7-2-325 -be8e2719caa6c7194ce4713206da6f1f8db694ca v7-0-138 -be9fbf8b0cdb6a42c07a8be94e9fba866cff00c8 v7-0-146 -bec979a53f47ff6866d390eff6c4ddd4d5ce8a8b v7-2-307 -bf5ba8a0cdee590c0841391f9a8b65c456ed06bb v7-0129 -bf63a31b77017d78197bc0155c0ec59e31559df3 v7-0-210 -bf7803d0f5b9d0a9cb16636b9490d723623c57e8 v7-0-019 -bf9579ab26e59cda4bdebcd934c43b6fbded60ce v7-3-019 -bfade53bcafb7b6d297f23ce3ba9e6a72dcb7949 v7-3-087 -bfd69bfb41491b83ac7a4b948c649eaec251c54d v7-3-046 -bfd8935d62009b625c37dc373404b67d0019d7f1 v7-0087 -bffbbb566d6b1004cfe26df89e102c465bed4312 v7-0-192 -c00efaa0af249c086557487d172edd6a1cfc0706 v7-3-053 -c050d5bbe79b6a0bd83fb5dc0c13c350492c7c4a v7-2-063 -c06c658691e20f22ae95d4cf117057c7d0736308 v7-0-087 -c0bb3c1dd44695b4eda074afd1a7394d2b7e4552 v7-1-132 -c11845a465ae63ea7f9942484988dd4e441c891f v7-2-370 -c12f39141bbc7c031b51352896a78324ad27398c v7-0053 -c1709e3f8536100dc87defb9f788f895b4e73578 v7-2-140 -c17a42da3920c34a75c17fe8696d2f04bf683f24 v7-2-428 -c17ba3fb433e7cddfdbf2244b777550970493b0a v7-1-106 -c19f6b8d0393dd28a2673da19e8acef59d371f65 v7-1-304 -c1b61096e3d0e4383db1ef01a5dc2f3ebd5eb0fc v7-0-074 -c1f67ce5740adaa7e1e164d706f204252711d5df v7-2-382 -c21975c58b4497d08a2fa30601723537ab1f03ec v7-0123 -c22ded254d0591df640c3ee0ea3dd0a490fa2396 v7-2-071 -c2cae213194d26214a9132c1ec7cddbdafd18175 v7-0e07 -c3242ae88ef1d4cb6eea51fdf96670cae48fc64a v7-2-081 -c3242ae88ef1d4cb6eea51fdf96670cae48fc64a v7-2-082 -c37ed44f014fdcb211ba3decf81d1f3ec94a210b v7-0-153 -c38cdd201cec8e9a774b7256a5eadf2d7194aa0e v7-1-059 -c3b5d3fe94046702944964c32eea7522ecf92c4c v7-3-020 -c3ba2dcc4cf4b96ddd1e3df9beacd1e11abe7868 v7-0-214 -c3bd0a84e11ad1caf53402dbebc39ea8b01fc832 v7-0-167 -c3e225bc213a1a91a278fdcb3c5fc003ae886f02 v7-2a-009 -c3f63ed316b621743f44a5ab6b9a5438b88feded v7-0227 -c44058ba78bc108e98fc15a14756716c3d3241fb v7-1-141 -c474f5691c0c6461414e65601a97e817e976099a v7-2-164 -c4d200412ae9b66732f2c9be98273802a0acdb95 v7-0121 -c4d5f3d8ad71c4d30397ca0101a89925f1666df8 v7-2-099 -c50c82c5e230a9ef1cb570be0a57d3dc9e295993 v7-0069 -c50ed526966abc52d825a36d5114bebc21f850b2 v7-0-220 -c51a4f9936751df0e9bbdc454727bced532da3c5 v7-2-255 -c524f99c79251a7b614776a5d064ba40c8d4d5cc v7-0022 -c544a3507e839f3ad4db6e1d7dd7474ed0167b96 v7-1-066 -c5871806d7e6c121c80030dde025a96c0ddec820 v7-0-057 -c58b9479e304ff055b0404d9d73a51da4e9bf7e5 v7-2-315 -c5a806b29372c033c3b616083c86159a8719635c v7-2-306 -c5b05f6de1adf8bf800da0bcdfa04a262e0e8329 v7-0047 -c5cafb21c45b5e1e16c006056dd5b8f5ad91145d v7-0-096 -c5d5e0f3403f65e77307d1bcb5d71acc73cbc90a v7-0-120 -c5e1b4b9016ff900a005057fd1a055c70b812414 v7-2-047 -c60d231453cfd59c8b313a894027cecc0a4315ec v7-2-424 -c6296b0ad9eae4122e31dd3b4f363e073f388a38 v7-0151 -c649cc22da98e2eee72352917030fc6068883317 v7-1-060 -c669f3280f595ba6133a94d8ceb3ed3ef6c2a4ad v7-1-324 -c6b06a4a8f928b1868a3d48d95293730262a041e v7-2b-023 -c6fe65c000d27b9ddb0cbdffe43cf188b7a51f2e v7-3-037 -c7537662746d8bae8bcdf8502a23a573a54d3855 v7-2-186 -c7654c4db8fd57c397bdfd3b3142632a4e761f32 v7-1-153 -c773cb978acfd216004c871e883d2b31cd4cc0bf v7-0116 -c78d973dce9e0456b96725f55b853ecbe4ebda96 v7-0211 -c7905d03c72e74540d91b1ebf3fc9cfffc2ba699 v7-1-273 -c7c53db66b5521d2deed3b889fbfb13030868942 v7-2b-019 -c82bb7ade452d18a121a6b0b8ff654dfad30532a v7-1-137 -c845dcf7fafa91d8cb370f690c16748758b20332 v7-1-110 -c8568bc2db390972c94374a031bbd195c4403ffd v7-1-311 -c87ce0b2ee2a14d3daf3902bdd4163a002ec7a22 v7-1-190 -c87f38b71d27d9e420e5947d4e99eba9e3eb2e19 v7-1-070 -c89903e16772bebee28ec935f7459c8c83bdf05e v7-1-223 -c8b6b7e1005daebc2d72c578d70b455f42b5bd16 v7-0150 -c8b87fa14d277702b7ca6b9ba18470c3d64ad83f v7-2-179 -c8c47cc9dab1eb6976b9c214c58e65beb3a45e97 v7-2b-025 -c8cae82dee305d003f809d91025ed21582785597 v7-0-061 -c8f343a465a271cec752fce3efdf5fa8476d3c96 v7-2-180 -c94bbf85eb160aa9eabe33b13b267c1446019eaa v7-0-213 -c9b7b1e711d194070184c9c198fbe8126701d1ee v7-0-235 -c9ddc2338f41c43a30044dbdca1775b919f80707 v7-0-058 -ca4883686f934bb338dfe3a2fd7d6d3995c3e0e2 v7-0-088 -ca501ab2fdb3a4477a6b8e469c1a4d8f1859d92a v7-1-170 -ca5b52e99385825f0083c4b122ebfb50c2653039 v7-1-255 -ca82de29ac1903bb1295c04da5624cf295b6447c v7-0g01 -caa550fe445725dea9531b9fe9f0d0f88961baf7 v7-0-191 -cab25717c6a69a7d9ebd010153fd9be9529fb49a v7-1b-002 -cb49fa8c71963b7b69529dfc2abd00b791119fd6 v7-0-126 -cb6487d683f2260fc0b47b5e95f78a297360b1fa v7-1-216 -cb7043482eca744ad9ba1eb11f08cc2906b6bd3c v7-0-149 -cb94c42c0e1a1e00f643be8a96939e42c3afff81 v7-2-445 -cba9c4003cb554f909fdb6426b8870bef24b3edf v7-2-085 -cbc9c335ddb17f9b0e9d281e1c5d97a20ed4fd94 v7-0-119 -cbe70f2e756d80015f6f0057e13a882ee7567276 v7-1-259 -cc03a79fdbb9315956fc22887483a15b414278ea v7-0-197 -cc4fe241baa3596ae9cd27ce65ad25077bfb2e71 v7-1-236 -ccbd8177e1f439fc23ef56be942ab0253d5dcc26 v7-2-132 -ccc9eda1cfcf918fbd1933bca9db01e246d5ef12 v7-2-138 -cd3689efd90a5934dcf2e4e232d97939737414c3 v7-0173 -cd3f52531f6c8f16e89e97f335f974fa25f4b498 v7-3-124 -cd6175cc27d9c8b4d4f4dadc7c38f6c490f3fa62 v7-1-235 -cd7eb2a18060734504ff974065d6a7adfc903b34 v7-1-041 -cd9471bd8e9eb1d2c59d00a7d18dc07dd97fcea6 v7-0-047 -cda8f3aceb85c72c94498120fa171939b83cc8a3 v7-2-120 -cdd82acd75b449784a574058387449096667e56f v7-1-125 -cdf37c8f46163497e0d7fabf9655be37b692fd1a v7-2-008 -cdfc3897c8950aa84c84c1a05158afd32ba71d06 v7-2-222 -ce2181d14aa08a59250267dbec36bba362eeb908 v7-0139 -ce6bc4bf2b87f2303bf47fe64ebdd470711973d0 v7-2-244 -ceaf71b15d813665b3b02036a619bc967db90d8f v7-1-177 -cec8b867838bc2a5b5f5bb0146010060639fea90 v7-0-114 -cf080795d202ac2ef02d282f4aec111b2ec126b7 v7-2-135 -cf0979c30cafc4fbe239ebb9de3c427a265207a3 v7-2-144 -cf4d73a8924e715fb5fc7db94af9a7e67d7643dc v7-0-095 -cf83dacfa25fb1fd8d4929ff2abe871c72ad94a8 v7-0105 -cf8f86128f4c428af72c116cc53d92ad7c1e40e9 v7-2-435 -cfcc1421f5e431d3984c3e9ef3f360ceafaef76f v7-2-146 -cfccbe492612c69ee77d6cca4adb690794e5feac v7-2-126 -d065616e083680035f38a54409e857ebc2202db3 v7-1-146 -d06a461924a3f92575d81c2d1c0c3a74cd0a2929 v7-2-322 -d0cf8c843186301d546870c2661cfa3e8526b3e4 v7-1-100 -d166fe2bfe7438b1539cdedf1810dc91a1cae01e v7-2a-005 -d20d37ef86c8844da2c9c45b2d9fc8b6a2dc3f78 v7-3-129 -d225695aa7945c27e1eed207e3e683b16824ea87 v7-2-282 -d23a400b718419e039eaf4f8ce23517144d41faa v7-2-019 -d2612392202f9b87c122b7233b0bbc67c9edc004 v7-1-004 -d2796c60ca6f11e05cbe080114a3cfc6006488c7 v7-0032 -d2a4f08396fe8c01ebca988db5eb95b7c3f9db8b v7-0f05 -d3571ca62cd6a9138b0aaa4673b09dec78e540e1 v7-2-323 -d38420e2fafe99d58b915213b73f8d1b8c7848d5 v7-1a -d3bbb5dd3913b6425ffebd18b232fcc2d1907046 v7-0f02 -d3cff90680f3f985c21e34e03607a5808ed4dcbe v7-0-144 -d433f43849ba1dd0006dbc4d794cda3502fc24af v7-2-332 -d4b1aca2e3a97415460ba21ec81eba2218cc0be1 v7-1-128 -d4bc24e6a28144ebb16f143efb72ffdd98bbe0fc v7-0-156 -d4ea645c77489da3d5f0f0f48a14bb63793e1505 v7-0041 -d4f3db33d782da9d33b2715fbd14f5acac280ce0 v7-0037 -d51bf80e8fc9b1048c93bd26e308af7c250ef629 v7-1-045 -d5681bd2661b3e75b506a7d6ffe8bd053e04608b v7-3-013 -d5867fd6b2b72d8095795f4db9aea88035e49e5c v7-2-330 -d5892839ed90bb1a8f9f1b3ce88bcc205e7617cc v7-0156 -d5ec1b42ceb06062f03d828acca852a4ccfbc7a4 v7-0111 -d607b48414b79e7cacccb66391683b23cf1b2cbb v7-0-099 -d608343d25e6ce4b1e6435720c48762501b0fc7e v7-2-197 -d66394147eea6cd5b304fd2b78e5dde46fbb1b02 v7-2-136 -d6a69271cb9a787af6b3a05b01275c9694a144c0 v7-0194 -d6d6ca94371317962df5d92c9b879f7602d3e234 v7-0098 -d6f0d3db1c641e451f9cb0d0697f1b18939d6cf7 v7-2-087 -d75027183cf4b44b2a92333e57b9bc3fe2b2f5dd v7-0-230 -d763e7d7e938d8dd3887b7279b44e3a857285d38 v7-0-189 -d766b2ba2fc6d5b6211cd10d90236dfa8479d617 v7-2b-002 -d7860ee7eb7ef5c27d45c4569107376d3cbdbdef v7-0207 -d7ce3adb8dda9d7acf8aef39cda0b936ce3f3d15 v7-2-362 -d7e33248b9c80fb5c1af5880d6c6a4eb507de990 v7-0206 -d87865573d809129e6d25071cffe8ab451ea2db2 v7-0-041 -d88bdbabfbc6539ce6cb149a3e8b025740a7f351 v7-2-109 -d8983769c9ddbffc13ab427a5e44693070d7788a v7-2-361 -d8af28dbfb80aa6c6248000b011bc9df6f8f337a v7-0-152 -d8b9701a3b7bb58e3f7f2c72145a0dfa33501f31 v7-2-193 -d8dbf7d55c5e9ac3e345eb1b2b86986be3582fdd v7-0-018 -d8e7b6762aaaa48f6bb72b1c51d535119e79c379 v7-2-096 -d8f905020502b0f35d810f27b4d5d28689bb7764 v7-0b -d9030055c432b20797f883c956f094416e00c622 v7-0033 -d92358c7d6216ff56093067384eb7d96ae47696d v7-2-238 -d92ac5a199fe88f1630678f81e0b47d5f3f1a921 v7-2-196 -d92bab35a16720d2b4e3a2b836fd68df0ee00aca v7-2-234 -d94c322508140c4cc0d36364d994f475aa84f8d0 v7-3-075 -d95676480093879730aed5ba678e3e8305977a4e v7-0-067 -d97518d6b3257b4ab48aace82f9197bd099ff758 v7-0063 -d976f4da2a4d56ed9b59c61f6971ec0cb18c84db v7-1-264 -d982226b7aaaff40647eaa5ad05e01538e90065b v7-3-023 -d9cc61139d12c315d790d79890402ef957be00ff v7-0146 -da0991871b02a5ba7bce7d3c1180d01d50d7646e v7-1-017 -da1d62fe5379f77a2a165e40bf4bcad0466c60cb v7-1-063 -da9142bd190a5ee0e45536ae4c2913be5bdb02b6 v7-0149 -daa1e34570ff649af9d7b64a447cc6d2c0b60e38 v7-0-093 -dabcabce3f9d67ee2cd22246ea16769513982910 v7-2-419 -dac5006b4443f99681d2068d0af065bec10d7a99 v7-1-162 -dae4cd29a0b7d899201c2e6a10f0441e7173bcfd v7-2-347 -db3ca1048f7f800fec81696d29ff8a7a3027a64d v7-2-320 -db44f7b81373a02990aa6030b85024478b7d82bf v7-0f03 -db83098657947521e0e797662c135516a4a300ea v7-1-123 -dbd226be80b18c494f4438045d34b65530dcc198 v7-1-027 -dbef8434a2ea19482b3ba72b428c57dafaad29a4 v7-1-329 -dbf53ece2e23fd6e8652c531ce7976f54ae85635 v7-0029 -dc8197342755fda6ca4d6619dac228406867a7ce v7-0d04 -dc81a4fc63185c72c940e8ade45b5e1534523351 v7-2-143 -dc8a5699253b833ec796460f9ac877d02ab7b165 v7-2-406 -dc8ee74574f80c7eabc90ff7a3973f882993cab5 v7-2-444 -dc948c8dfd1550972011e38d59b9a8ade5a000c4 v7-1-019 -dd9db57ee7ce46bdc86cd787fb58907f20c0a973 v7-0118 -ddafd2ba3a863054041f2f71248f0ea91fc3b1d2 v7-0-117 -dde812fb22478c1fbd34d935ec466b2cd9869da4 v7-2-437 -ddfb6f3f3b2be6e5397db2601f392c45f4a05b84 v7-0-012 -de0e7ca61893d31a4a5ad8e129691650e31477c9 v7-2-427 -de8224965034eaf748c4205cc2a61e097b4aef90 v7-0-063 -decce137e7beaa2edbfb4783d1cac714c7d84d14 v7-0-098 -df6967461cef05aa96ff708863d380e9d15f3bb7 v7-1-065 -df6b12c84b2359415cd987c016f5de135c680100 v7-3-047 -df7ceb64b0c65cc5ea525f7df25ecdbba80b0208 v7-2-137 -dfcff6590aba6d93a69b414759b164c255fda08f v7-1-238 -dfd5dcc73daa3934ff1f47d6d53207de2f9034ed v7-3-067 -dfdaac31aa5df021b444bc2ba64307709d863c63 v7-2-230 -dfdaac31aa5df021b444bc2ba64307709d863c63 v7-2-232 -e038754d419a3ab5ec25d014513bf8773cb9459c v7-2-408 -e03cb9499b83f972c2bdef503b1faa15481da81e v7-2-015 -e06e177de52ae555685a6126213dff168048fcc6 v7-1-305 -e0e0d1ae601197ad22eaad3b721407a2d0cd6294 v7-2-318 -e1070b3b03e9b1490157dce8db81b026460aea35 v7-0-081 -e10d3c07344929c21377722bd3c66d3c54ef582e v7-2-423 -e12f574898a9b21e39af38cd57e50ca87ccdea81 v7-2-272 -e1336150cfcf7e64f66563629accb1cc84fea036 v7-1-089 -e14d0a530351fe26450893977197e81e9e9ae5f2 v7-0-177 -e180933b876a74ded043348c0cff4fb209d4d92c v7-0219 -e19ecdb13f34ca1ccb3dd3c382a08423c385e847 v7-3-080 -e1c7d0ea5dacf4184cf49c3d05d6ce77d944a367 v7-2a-002 -e1d77e652cb7f9e84072f16b3ac6dcbb73a1fd81 v7-2a-018 -e1efa991c2b6992bf361cb432895749fc6b1109e v7-0-106 -e212d1a40ca9638a4b306013d54417dfcbe9d8ab v7-1-243 -e2680bc6a18024d68ce8100e21d4d307dd647aec v7-1-011 -e2d7622d70894e506f9c722bc8ce145521d098b7 v7-2-106 -e2f5c1597829256cfd784681163c232bf907f1c9 v7-1-092 -e319a4fe6e32e0297f1be2c1a8c763f7f7b26cd7 v7-2-378 -e351146e7974acd49f2e9aab749f31670b2c6044 v7-1-116 -e44523d45bf5e276817b7f1f8987f2a8ed3132b7 v7-3-125 -e44efb3af0d58fc58a392e58c604bee91bc52e2e v7-0-060 -e4fa26ce87694c7d810796d41d0f03981e500d1d v7-0187 -e5145ff9c9b0dd7b29154c2ffd220988737c99f7 v7-2-285 -e5602d92da8ccb4822917b2df3e6099344bb4ed4 v7-2-177 -e625dad74346d76132cbcf6ddf98b95d2c8fbfe5 v7-0-113 -e6372ac3ebe536aee65848e52e58fc817697b98e v7-3-063 -e641c7a27c470de82019d313a158a9894e0befc1 v7-1-181 -e649c78407e600ab28819574efd7d2d67f066171 v7-0202 -e65e50609469f1c5d98ab7396803fb697a78bc17 v7-2-219 -e68d8541494dc36b5778d9eda2814014201b0335 v7-0228 -e697bd3c3876c27addb414ae170d741aa1eb1917 v7-0075 -e6a8d55a1626baa2e38837b0e7a4a6bc65783623 v7-1-178 -e6aed39f12648124b0b4e23c669cab6ceda2ea1e v7-0-158 -e6bd96f2d7b81a8963c9c8dcfd9e2b3f08a9f0e4 v7-0-017 -e6d25347de2cc7f7632cb0cbe5adef45d9712aca v7-0-182 -e70aad5761b59933a1f69a8756457fdb3a9aad40 v7-0-069 -e70c0d863e0cb2b26f16acd17ead7ed267faef53 v7-1-022 -e72e30c69d582a55cf3c4836aa274a006a457fe3 v7-1-261 -e73f2978bd4061868337a25ff09c3c84b54dd2da v7-0f04 -e753954c86e2ce32648d9b12c3c135c22748f75f v7-2-237 -e7633eb32cfd9cd631a73f4d412272506261b427 v7-2-098 -e76a088056dd38e02a99daec0741aad6f32a24f8 v7-0-242 -e77e3c11f5076d6eae8a67bd2f531f72d33eed7e v7-2-331 -e7904492cb75b7a69964c331945b261cd4232a7f v7-0071 -e7f6ca5594cf9c6a3902458e0635bec7a7c40d87 v7-2-149 -e8450dbf6f031f2727798a7d955e83dda7ba0288 v7-1-086 -e856f9cc2aee46628ecb83351489d4f41d66c6c6 v7-3-064 -e88950f0d4f699846875e45dd3887cbdf92bc3b9 v7-0-084 -e905716f6a3aaba3c0ba1d18093d4f4f09550524 v7-0-090 -e943e5502fc9cc439294de385dc564226b7311a1 v7-0050 -e9624acb93a750d835c361c08bf3e78f587f6510 v7-2-028 -e965cf54d887eb9bc20b6668d83541992cc4e8a7 v7-2-157 -e97a97d6a0eb98b21bd068283f192e0a2f2b1a89 v7-2a-004 -e980e93d2ac2c7838acfd45fbf2de06939c929bf v7-1-186 -e9c9f37be3066d64d7d87d1b314b2913d0d751f6 v7-2-416 -e9d018b58830d50906a81e1b1ddbb3e2bdd9126a v7-2-107 -e9ddb2181f063b67b3075844b4aa7359db5750be v7-0155 -e9e3355861ba8785dba619e2358a239a9443a580 v7-2-342 -ea15087a42cd21520e628faa3c53385246c04743 v7-0-085 -ea1a2950ed16f441f66ba319615d47f1ac67402c v7-1-191 -ea399ac2c1b963b068beed88bfaff7620d345333 v7-3-138 -ea9f418ed072f45fc1cb04e455379e3db1c0f182 v7-1-215 -eac2556d46208785a173d44b4efff339a7e2fab8 v7-2-215 -eaecfa88c2469471804768932f823f5b264dd0b9 v7-2-148 -eb0504d00480ca6a7758bfa35d64a09b3d389fca v7-1-250 -eb1ce51c1cb0dc7825570f7cf30b0e2c3e9749c1 v7-2-129 -eb27e3e2df706466ccf9bd00e407d2d3419a81e7 v7-2-265 -eb4ee2010aae8f4361054eb367a7b13dcfd738c2 v7-0-107 -eb531146be0ec6cce1187568cc841718df44a296 v7-0114 -eb57516376d4b43889fe43594048f183af15c31e v7-1-032 -eb6fc577c96c2b5e322ca3760fa4e9c043ba5a8c v7-2a-008 -eb800128bd894e9b2c661627d2a302344162987c v7-0-092 -eb9cbad50fa34fad2b422758d6d814059aa89f94 v7-1-313 -ebe059f69b9e46ada2c6e02b3979e31d1b11c906 v7-1-296 -ec5ed41eea2f1d83df5a2507ab2f469fadbbfbfa v7-2b-001 -ec7a570696ac0e50147e2419d8b269ccfb75f25e v7-0-199 -ecc637a844592d48cec38bd795a17ecf6e0253ec v7-1-114 -ecee28dd16d25024fe584cfb8cd0923f1184398f v7-0213 -ed44c1c436d3d61a94062c7a781b77dabeb8ebbe v7-0-100 -ed7fefbef738386c39248b501556bdea80d0f8b4 v7-1-276 -edb3bc186e97a3392b3aac634526a4f4f84f4011 v7-0-020 -ee41e031dfe14ebe50c289158213f05eca869bb1 v7-1-179 -ee50cd1a303271c6be6cf6121f50c0abb8772dbb v7-3-088 -ee9d2d24ea9bd0a7d500f1c37cbea802d8d1d88c v7-1-231 -eef96cfdbbbebe5aa61b420d3eea31c3c5b6d719 v7-1-314 -ef0fe6201b843f699b3ed7483e52eb3348ae5b11 v7-0-006 -ef2890033e88391e92eba7d1ade8a43e9e200abc v7-2-337 -ef3a3ec8940cb0c55d35d2e5fe924a09d6815f2c v7-3-070 -ef6b11bee7d06a843474888d0bbd67d14dd2065d v7-0-181 -ef7fdb3c6927725abb07731a46ab78404ad4c7e8 v7-3-105 -ef886129f0c0be912c7b6c21e695bd9980d31210 v7-2-088 -efd0ce477ae789445312ebb08a0f78b835dd6f5b v7-0-194 -f012c4ed8c38499ed2901d139f4409e2edfe51da v7-0132 -f016c3708ae32436ab545762a1bfb8ebd31af975 v7-3-106 -f018c759e4ed5e1a851c1353c118883efab6a155 v7-2-274 -f04e890524be4a82ade7526f62a967390d3f1cf1 v7-0153 -f08390485cd365abce88ade8987e56bd267cf3e4 v7-0210 -f099adbff8871627d897979b432d74ad1623369e v7-0-031 -f0b3b9ac2147350b1d1fd762cfda0b3073b0bca3 v7-1-161 -f0c598082dff6f0332c9af602b5b4996bce01ff7 v7-2-104 -f0cfff4dcc2f7cad78ce86aae0f4cbd3371ce46d v7-1-283 -f0d6b2bb1093eb12925cea635cd58de0594c422a v7-1-245 -f10fe14748e260eb0d8bfe375cadbbaa0e5ceeca v7-2-055 -f12d38ee49de595d11efb50674bccfe0417c7063 v7-1-006 -f138491673309c018ffede08cd4858c3bf318dba v7-2-169 -f13a0227fb8844e591b6526e4393c8f93dadda29 v7-2-305 -f14cbd913415ac4d6a9968dce20a20291f8c0d05 v7-0097 -f14f7aab518707c29a8ffb75a4e8217de58dda91 v7-1-212 -f1d1214744679d401e17e9ba97ecbb6255696ed0 v7-1-287 -f1d2a58883b96144abcd5b44dbdd190a67b3eb79 v7-0024 -f1d46f94824128251d1212cfaef0b1bfea4dc71b v7-0163 -f234c87ac7e9807004cdc559cf68aa5e04850f5e v7-2-248 -f26d0c74a329cceeed80a7985f5efb5662064283 v7-1-039 -f2927225367a3ac3fbe86d6d03ebb7a526072ed9 v7-3-039 -f299f0bf32d76986d5596d279bc0733cebe1942b v7-0-211 -f2d46e4a859d0f12f12fbf332c40a717dd07df14 v7-0068 -f30c8ac7741c82503bf897fcebc68f199e5b0998 v7-0225 -f339305875fa7cd21cb4d42619f5b9789a027eb2 v7-2-229 -f3669fbc9a31512a0b81fe7f647b935243a76520 v7-0-109 -f38283ce871c19cb82b1c4d364fbc3a242c057bd v7-3-131 -f38b7359dafd1f168a15698412d266c17a16520e v7-2-102 -f398e0cc5b7a032f327aa2f33b71c3bb6a22d46b v7-2-349 -f3abb6aec8c83ada21d56b8be4ffc6be55ce39ba v7-1-048 -f3d3545d6bf6405662476b40e019044b880d8f81 v7-2-058 -f3d7fa7dcf634b669a7d7859bcc39796300346e0 v7-1-035 -f40f1a8520ffaa57ae73a720c179780025aacd64 v7-0c01 -f41b6108e46b7cb3794b2a3680f2ce91b402fb21 v7-2a-016 -f41fa84cd738b945ab34271a92f44e0d1445dda2 v7-0g03 -f455396f3c3fb524ff1082cfe2cd7731f67877b0 v7-0043 -f49d72bf9c5c425dfb8bb94c6bac975716e3023c v7-0-124 -f4a775df722b13250c2b9e6f1154c31ffd9b211f v7-0145 -f4c7b5da017adf78554a240587384823e58ba80c v7-1-012 -f4f8014d516e9b9620311aa2bb7a5a2d5749f451 v7-2c-000 -f529edb9bab3de35ca7451e4d45cc90e9f7aaf81 v7-0025 -f54dab7cebabe6aa275dd6a379b42a15c365af0a v7-2-280 -f55897d6921d622ac2649e4c94ddb38d121c2832 v7-0026 -f5bd6753cdc40733c903090cef1cff033942dcf7 v7-2-440 -f607f15ab091b6a51b0546db6a6d42adfa599c3d v7-0143 -f628d19361d9812a1266baec9f76d60c798f92d5 v7-0-195 -f637471a3607a43bab09a2b61913201a5100e636 v7-2-192 -f66abfa335bb76d20f2a375f148fb7705bfde287 v7-0-170 -f6c72dd1962a46aec26c7caac6f1c3789321e91f v7-0-030 -f713fc55bf7b9a5cbb9ae3628547a78f4e44bcc9 v7-0109 -f765f9c139de3555cd181bd4fa8de50d4aaf41c8 v7-2-158 -f798c90439866d3d29eb0fa460d51e4de26f27d8 v7-2-224 -f79bb032002565143e3392cca0540216e7f93e28 v7-1-241 -f815aad6c05549bfa36f193dc57b1f03d646bb79 v7-2-343 -f84061aa57e4498f15155a4a30da40ea07be84e0 v7-2-030 -f85fe1a05c2ae4c03994c9ea2eb87da590bb3214 v7-3-133 -f88008797313e07112b8c4e549dc2217747fed98 v7-0-101 -f892bda292a89e7592ccee5fc0e296659066d7c5 v7-0198 -f896a7dfd47d15f11ac663f132fa2c5aba91c829 v7-3-052 -f8f35d8208e6c242026dcedd8300b82f415fc59b v7-0-179 -f921368d43c3f0b9b32f52f881e7e58242489bb4 v7-3-093 -f927ca2cedb40441abcd9cf5e18cbde2863761b4 v7-0-226 -f92bb184582321910573561c941167ca46b9850f v7-0101 -f9366d458bd09b73aa46cb202c7c6329e608bf0e v7-0-217 -f959cda54600f8d014cf3a3c69285c598985d828 v7-0-027 -f987220caa57c4d13b64fcfd24cb4bc6a156bb00 v7-3-094 -f9bd6784f393aa771d497611b75a8623c20a8269 v7-3-009 -f9c55e12835e88f072c46b20ac9dac25a46ca839 v7-2-218 -f9eaf0a9872df3ef8610d3fae404231447954d5e v7-0157 -f9f6e35c9f00ee6ee518069ff2bf0f93b635b8af v7-2-005 -fa07532e69c6eec9a6860ef1362f1d8187b8244a v7-1-193 -fa5dee44df3fd23f96090d225dc11dbc4de7bf20 v7-3-034 -fa7e62dd58d779149c96570bc8943f1a1b035e3b v7-2-364 -fa9ee618000f51e5da6c951f24c9bab78f2bb428 v7-0-110 -fae6fb779a6be78f2609dac4fddb8da508735dc9 v7-3-048 -faf4b09c396e8572e84eab84eeb60ea0f3785529 v7-3-097 -fb1222c880fc037f9b76580423c5a57c74acba28 v7-2-344 -fb60c9f35517660092b161abc1e4aa17a7d0ac05 v7-3-040 -fbecb12e37f5b1523aa8e6ecc07ea6c07ed65270 v7-2-131 -fc0c566b91075643f259863d171bb253703698bf v7-0-064 -fc2ee817dc9861774c31bbe768cddcaca4690e4e v7-1-328 -fc42d9cc7ad054a21ac8bab2584732ebb191e5a6 v7-1-258 -fc89a4f98a8b2e51dcdd380a7eede9dbc5cd1282 v7-2-184 -fc8bf5d4051a1c13085db00c902092215ac9852b v7-2b-017 -fcb916bed51a5ae096a9f5f5f697a909b2062040 v7-3-055 -fcea35e2a41fdc928cb92784a4405b4fd220f560 v7-3-112 -fcf44bf1218f63d94e1807c05f470a4eb87e61a3 v7-2-209 -fd1b3406fd1cbe1e7250c95f7b30604d7e46b2d1 v7-0d02 -fd24e02210c9c05b4035ebc717f25ad64d20470a v7-2-276 -fd3346e3ccc02a11f0c2fa9c2c7351b3cead3941 v7-3-082 -fd68db1a72b5f05cc5e586ffe89a10ec6930005d v7-1-199 -fd8864aeb52aa72333573d62f0a9913b0d3e8c8d v7-2-373 -fddea6c03deefda18c971466e0688d196a62fd6c v7-2b-004 -fde086181841aa124af8a38b5c0bba132de3ea94 v7-3-002 -fe26299d6f7015c324bef3829e9ecdf7d08526df v7-2-239 -fe3ec5ea62f76a623c95a2a4bcc0d396c83488bf v7-1-303 -fe4ebbec775a55ba5d9bec6070d8d87dc28138f9 v7-2b-014 -fe52f9888eaaafda72e6f37610327206383ff6a6 v7-2-034 -fe7db192c7cc7ef3d8cdc6bbd8680833338fd7fe v7-1-299 -fea3207b800d97b802892d8edabd1d688817249a v7-3-096 -feb9b421585385b226b4adb98e10f33972068846 v7-2-042 -febddd8d11b0f8f48e3d3297628fcbfd9f427b19 v7-2-112 -fef4bd7afb263aa411f12ff13dd1d12c88ad992e v7-2-438 -ff3a304b4ac2f672e8cc3c60795f0c79c5b191b1 v7-3-066 -ff5a4a71a761f859af81821d340ac609d9309083 v7-2-156 -ff77f541d69df4e538f7db4879eb194378c04458 v7-1-252 -ff9ecf14efe3e2373f2b28fc3e32db4fe19e5ee1 v7-2-203 -ffa17de19445569ea573550eef332323d83e70bd v7-0-016 -fff7028d50c8a44a6285ab23b451d975764b8bd5 v7-2-296 -62e8d93241cd15962f895da4788f21b514238b14 v7-3-142 -632f43801ddb568f872599499fdcfd9522f8c13f v7-3-143 -322a5c8d392bd47ceebd24cd21dacf70409fcc91 v7-3-144 -329a9676040c3182f78e2014322125f8839b5cb6 v7-3-145 -2bd574a2ef1c0ad487a0673a5867b09cd332d176 v7-3-146 -55fe8407514f5387ad872a338d77f64a2ad4b5f5 v7-3-147 -d67916de812ad684718c02e3ff93455ce577be81 v7-3-148 -7f937a04cdbafd7d179b200f75e988408f8caf3c v7-3-149 -6146c9859f6558d618e950fe702c11e41ca21105 v7-3-150 -f169a51f7eadf9a07ed95161143e6209387a4f34 v7-3-151 -0f7f66682a5563c76ab47e9976fd590d9423a013 v7-3-152 -d0cae598360945a425859bf8acf22923c29501f4 v7-3-153 -d72d709f0e18c309069e42d3d7865d68db9e89d7 v7-3-154 -5747cd65d62b613d5060254849ed4bc1e1e5d714 v7-3-155 -7fb8cdb9cb25e1409abe45bba959f5f27608d713 v7-3-156 -9a98d8562637d4c90439125a14224a3403d8bee3 v7-3-157 -b5f774f159274af375455f32d628881c027417d1 v7-3-158 -415c55534d901aa4617bf584462faf0c7198e07e v7-3-159 -c5e47b752f07a95534bbfa83f031a58af67054cb v7-3-160 -25672ad7f377341ff1de9a0773d8cfcad1d37883 v7-3-161 -18ad854f5dcd0ba1700c73b03677dbc88b9844c3 v7-3-162 -e8f012b00187c5a957def85bb3c6f0430f20fed5 v7-3-163 -cdefcbb70e8cdc1f7185f1023d3a4660d30a074b v7-3-164 -e92a4b9b4484d1c07d930719ab1370fcaf94d3c5 v7-3-165 -5ddb68c2a845ad7941d1ae7533a81c12b106dffc v7-3-166 -0a0d7961b4fe83151b03d98ee904ea7038f64123 v7-3-167 -930b171ce3fc9dbca3f9da6bf883faa725593c67 v7-3-168 -5f45bacf31efef21f9b60543504d1832ded3e098 v7-3-169 -64c3402df964791a7b8c925905423f83af83e930 v7-3-170 -1bd8af13fb434e4c99bb756052556f4d56cde200 v7-3-171 -ee48b3da9d53a487f3636df34cace6400d13f32c v7-3-172 -133d089f247eb7156a6e8c49e0526f41cc082c3c v7-3-173 -820f12659c50890dbda80e7280086ae1176d1378 v7-3-174 -537e0102c0f9cc2c0656c298ed1534ef30176eb8 v7-3-175 -94f42ae4e4e66483fb6cc7305c61820b004c6182 v7-3-176 -66f2d62271fe77d4acdda5808bd0d3a45be3149c v7-3-177 -ac639ca9f58f7c71551c19090473395d81a021b6 v7-3-178 -11e62fb6f8154537f92be5f278c31e737247f781 v7-3-179 -ed47d18b39c6a672ad4f0caa2f2c3ee897e784a7 v7-3-180 -5381eb5b1eb9c39797c435ad904bfcb71f1efb01 v7-3-181 -21346361ce6c7e9afca2e475ceb62f6244197919 v7-3-182 -e4403440e192d082af7dc8fe3e1a12d24f0e259c v7-3-183 -b941cc96926a26b62d59f759a021ddb5b51823ed v7-3-184 -9c8dffc62a41a143230f76376f9a3abf46ff3536 v7-3-185 -3d1a3aa0240c7a9acdf3feb77b664798e3703463 v7-3-186 -8bd38abda3149cce7043da86e6093dbebecf63df v7-3-187 -f2e1c3a90a3bda6ce8977187b365745efd4e5c35 v7-3-188 -71e1da07e1414740d1d0eed47a346cb3292a9e2e v7-3-189 -30b7cde2194064040cb7d7e6485a5712b2fc9b40 v7-3-190 -107b03fdf1ad831e2697c22a04bd3eeaca08c291 v7-3-191 -8470ac4679c17b69aefb06989c6e8a267761988a v7-3-192 -e1c5f69de95b99112fae28c23ce6427ca251e50f v7-3-193 -664c1adcb909aca654c4fe9200364cc741068803 v7-3-194 -8dbea5adc937ecddf8ca336856cd487e1b118b1a v7-3-195 -d641f141f9376b3ecf2146e5d68c38bf0227c970 v7-3-196 -45c536fe48db330c4ee8f1056befe702d9d19cfe v7-3-197 -b0190e93e601f9061a797689a1eb95a86805f769 v7-3-198 -c76efe33a3c1db5767cfa4f4bb433466cba6e351 v7-3-199 -41b17dd070295783af37698b1229a7052ab0549c v7-3-200 -78859ef2982bbc75dcfbc551e3d8a0ec5c9126eb v7-3-201 -f80e67bd627114cf7f16098ec4ed7d878816a46b v7-3-202 -ce1dce2af2a34aec196b7fbe29cf8c653b6ec6de v7-3-203 -e6ce47f06836721108394f0b921af076606cf715 v7-3-204 -8d8bd6307b1aa51fe2f592ce45d32abf0f6666d8 v7-3-205 -46544d3ae7ecb245a2646ae5005a3d67ca380f88 v7-3-206 -d1445b72ddb7d8b4a44393756b00d21c81212db1 v7-3-207 -205adc87d579512482c27f309c73d5fe8f612ff3 v7-3-208 -82cd9f1e8d6b21ef4d59f27b39f041d5cddec19d v7-3-209 -eeb1ac4f66d1d69c0c75f1028655a81890cf65c2 v7-3-210 -c7d942260772003e21039f9891775b479311b40e v7-3-211 -6bbdb9c7a425b0bd90d5823eba9475b850a409fd v7-3-212 -493897f8bf9057aa0fee4c18d269558d32053cc7 v7-3-213 -d84a564f28c9e64c3c2a1689af0e0851bc7e5027 v7-3-214 -b7523ef31e23f1a40cc3950b6ec75b39ad7f762d v7-3-215 -eb6c704607025d89a0a5d3fd2769a694ac47e0af v7-3-216 -15705b520c298738588a9a3b8d724c6d86d4cb8c v7-3-217 -cf89a1d3a0ddd21fe6b734fd72346468b808836f v7-3-218 -acda456c788ae1b0b45b8c67a93edcccde594819 v7-3-219 -fe9c7da98b5e2f92e4212e948e98f2d44bf06320 v7-3-220 -fd4224d9ee09801ed1ad9341a72c4683e291bb76 v7-3-221 -c3b4b1c89d8ed62a2624bf9404fc79f60223bd81 v7-3-222 -4e21fd3cfc3084db66f65aef132cb6c5e076cb96 v7-3-223 -69e0783ed0ef40f72ebeba41f8c98c9992f368c7 v7-3-224 -c249d9aa60f759286f54781829c1e3da8680c4a7 v7-3-225 -8477b2cc2b81603408b3fb1a84cd65afb2aadc65 v7-3-226 -b65a26a2aa095c739e90edb7b980154476529d35 v7-3-227 -c6df8554b39d009ed146baa48c0cfb351aa8379a v7-3-228 -07647a0545c9f0fad4e1e84062e0572a07d94659 v7-3-229 -70c8f54e7efbd7b59bbe6764d0fbfa1f1602273f v7-3-230 -455a4c85d04d04c732367f915d82c5b3c9a65b50 v7-3-231 -b67d3a44262a97e7b3ae212fcffb36926b5f53f4 v7-3-232 -69b90e43b728ec28939b0a536de32f818b7ee756 v7-3-233 -7653420fdc454be197d59e420a1672909fac7b82 v7-3-234 -441d364773dc53264b5f26042f8fc6f8b77c8044 v7-3-235 -c1733ef5b6e87dde521d0d85a1e5e62259854ac1 v7-3-236 -e3bb93df6c34da672244bce5695c1426da139614 v7-3-237 -f2c108f44f415c7cfe92862e791a01cc542ac378 v7-3-238 -0bef86c5c985218a9448fa16d935b913e67af8d5 v7-3-239 -bf283e37792b4b557a2b9081e4fdb0e10acb9655 v7-3-240 -0a650db0265381b540df8ca6bd716c4b2d47dfc9 v7-3-241 -3d96ddbeb3b0003de29b736f63b76675909f133c v7-3-242 -512ddd87f1a817749c8362bd043682a7bbd87014 v7-3-243 -be6b6509636242cd7e6fab9a4b8772e97fc9a0db v7-3-244 -52512eddb876f64399e98d12643233a87c9f2823 v7-3-245 -3f1a4ed36d1b520a1ad5aa6cbf50d68bc8b9c7a5 v7-3-246 -7fe2c092913e84e6717782da1f1a220069eebbe7 v7-3-247 -57a7998e0fa8854a7a8c3946df1d4c9b1ee220e5 v7-3-248 -9f71f5a526aff4f1e0eefe1068d9534aee427afa v7-3-249 -f909f4f0f38c71594266b3595d31ce04d4ebe3ec v7-3-250 -fe6ad3fd85322b394824a5c495a78061a747b074 v7-3-251 -0b4289bcf8364854dd5f94c42d0252504103e5b9 v7-3-252 -c21429d7768cd4b834a086dd47881d01bca74e8c v7-3-253 -1eb805225de7750c03af7b0f7ac2f5dd18d032be v7-3-254 -aa998de9f9592426c17396b60c5db9170a234024 v7-3-255 -c296c225736e4489706c62c95752a0c4788be1d3 v7-3-256 -1fad9c73d77a0030586704cccab1b1a7aba8b58b v7-3-257 -bdc3335bd72eea207b28fcf8af90a73c855c8847 v7-3-258 -59130cd78dfc73bd04f22d201b8f7c0772d98e79 v7-3-259 -cb4682b959098e486977eb4b5969c9eb07d2798e v7-3-260 -410d42e3d4da09284394456186143d595e9b2efc v7-3-261 -847733973bfdd716bfafc364a4102e76f88e7fe8 v7-3-262 -a56259157c935b4e78e9f5f4dfb1436e3461eefb v7-3-263 -aa40bddeea9a44c6c6b4ffa32c1ef373df437a16 v7-3-264 -eff686fb8de66a26367f5e6430d34729f1a0e336 v7-3-265 -25be7c9dda549e4cfa1eb57937dc2b38b3d1e997 v7-3-266 -ad404f2a4bfa5374e97f29335f41b7ef34cd6bfa v7-3-267 -ee17ee712512451a54046d6bcd3ddb9f70cb5cdf v7-3-268 -7f4f5ca70dbde4e31c2de494b982bfb9bd71ed75 v7-3-269 -b9182da84c7eeda221e5219ef4361cca201b3b41 v7-3-270 -32a52f06f33b9e2d4817330099b410c1fcf64db2 v7-3-271 -02f5abca10aee570d5a9cf00928ffaa663daba66 v7-3-272 -7d4e5e31d8c10c767cdf774a2b13aedd2f95f096 v7-3-273 -1bb6776fa8c445e0b3f9dd2ed14fdf2a56f5873e v7-3-274 -125c7bf52271461dfbf46cc33317eadc67aaf742 v7-3-275 -37a54a85413eae68932233e64a0ab88c99c9d811 v7-3-276 -e5b17a5f651696ad4c523a21822692115d371250 v7-3-277 -6622f28b7e87a93de6f1520945d1c5d2a1fc0dab v7-3-278 -342b176089678e86cde3e1afac4aaaa1e5153f99 v7-3-279 -58bba69b3371d9ff02b27fe24f044e229c8aa99a v7-3-280 -45ead8a0bedeade57c320d72e9f710a703e61cf0 v7-3-281 -92167bb91c95410a0550ff8c94370307bb7d9d80 v7-3-282 -47b6d37b60122f45eb147106b8da1322c1cdbc60 v7-3-283 -27d43855b72312500e6fc2122e167a579a1f35f2 v7-3-284 -6018c815e1205e7db9328fe6ed91b26b514465f3 v7-3-285 -3f822e54765c54a1112a953e3c37bb60185fd51c v7-3-286 -07bc2ccfe5559035e785f22851365b3a31dec67e v7-3-287 -e4f3fa1a474e677dce486ea07ee31270f92b2b4a v7-3-288 -44ffd0a8abcdba441216514cb711649eb1169876 v7-3-289 -df33dba4e553f8fa27ba467042f16315c613a00d v7-3-290 -e8ee4b4ebf41abb199ea9a9e9cc38f9b0c2f7192 v7-3-291 -b6af1c5dd22f08db2b9e52ae763f193ba82965ad v7-3-292 -6cd0d6413a2e03687aca8138b2843f1f2aac5b84 v7-3-293 -dbd73fe939cf772a8b07c19230e5ee60aa0cfcc7 v7-3-294 -0d8494c051131b6470fe8af67646e235bc63fcf7 v7-3-295 -c19c15a9e9bf2914b25748c0544936e84a5c77c0 v7-3-296 -22550986c713ce5f37f069f0c8f99a54dc4a421b v7-3-297 -43b1d031e3028248abcbd5099841d3aafda7f68d v7-3-298 -eb4972982bfea006ead5b461f319744d5ecd58f5 v7-3-299 -2665b456ee59652c7b590dff0fa522ce337e0f16 v7-3-300 -4a70971530899e32058207cae683a69e7b8f85dc v7-3-301 -61b2f26623104f75850b1568bf61663597fe7fb0 v7-3-302 -d832d642f520d426f111b35102450617922547d3 v7-3-303 -b3a523ced6bd1173e4c17611559c173094830d43 v7-3-304 -0e06c025f66ffdfea20c8b73a995d23448b8dbfb v7-3-305 -0787bb5f387b79842d5c9353ae3541a992d1b9f1 v7-3-306 -880b7dd69331d1fefaf2d8735b118b39d546280c v7-3-307 -61c5e1527bd857e724f8396c89d0687126390675 v7-3-308 -6eae1b42c6684f3fcdb4d6cdbfb7dc1942d9b364 v7-3-309 -51ce22ba89d11505e18aa585fbd7dcbb22097f9a v7-3-310 -2cbde6bcc6238f41506f87bf31ff7d90f632345a v7-3-311 -0ed06069aaf32dbb2aa3827b23280b0028954ce7 v7-3-312 -dc60200a16b21c3e4157708bb825ea61b9e5bdc1 v7-3-313 -6ab1b45cc95ed56105b2130dc9938bb8344ff903 v7-3-314 -3ecf9e91d88acdb5eaaf93cc15a18914b60e0eb3 v7-3-315 -33c140e4664d102c34ec3ec5a17318f75cf475d7 v7-3-316 -92a181a1cec3fec52cde1b3d71f628a3a2dc53c6 v7-3-317 -d68f20a86a3ec75d927955be5d31983b6c37eb1d v7-3-318 -dc7f2f9759208aa07bf136deca661fd080a1ee68 v7-3-319 -738ea87c196431c452bd499c5a9849597ac938de v7-3-320 -fc0804089b2945bfe683f9bc9ee0238b8c64a46e v7-3-321 -38a7fd9043474dfb464c338ffd7f393361f5a6c1 v7-3-322 -3bdb646fc8a46ee5a5fe474dccdce098680d24d6 v7-3-323 -f04619f1fc1663f4ab05798c410e4fa35a9dd863 v7-3-324 -8aca621c00910556d4f52bd650d6841d6059d6ec v7-3-325 -d3758064ff9946d23aeccc9d2340686766647b84 v7-3-326 -9028c70adafd109ab294102f74dfb5005a20bbfb v7-3-327 -5b53cea62e5d1be2a1a36ce685c15f99bb8a41ba v7-3-328 -ec901ddc84d5c66c5d0c1dcca093584598487f9f v7-3-329 -abb03be99d661455fd3790cd25355459448fa432 v7-3-330 -4b8c614c1c914ce5d712368a75dbfea9b7e44e17 v7-3-331 -0ecfe54a273f6bc440684aca4ebe5926a2dfc6e2 v7-3-332 -992b24149a9ee0d6f417e40a7462891a9f62ec6a v7-3-333 -fdc72363229865cc6fd2da9db66f1d6e683b87c0 v7-3-334 -dc3f90a73fb375092ea9d870ae48ff31b31a56ab v7-3-335 -52526aec4afb220a1271e9a645194c42d3b2a538 v7-3-336 -176bfa951339a0a36366cbc8def41ae75f5034e0 v7-3-337 -7919a3d7333b99cece7d1a2657c89c18de78bf82 v7-3-338 -b5a2b4c0c1cac1758990ea449bc1c552522f39a9 v7-3-339 -49b08c9b9f5b72d930a1c02f00aa4128dc58532d v7-3-340 -6963603ec6dc2b47da9a7e951b2d0b3e024535eb v7-3-341 -314d9368069ec0458631ca150c202e7f724ad6d3 v7-3-342 -98a05814f1b466c87611b810eeafe8e7d9c581b6 v7-3-343 -7ba2f171cdaca18571b5e73dece426411c4f124a v7-3-344 -35f098371af699aa7e614a6397a068119b54cabf v7-3-345 -af76a61a7f79ccd3bcf64e15c73f2a3ea0eb77da v7-3-346 -72528c5eb87ea315a7c1a48f7734d1717c28820f v7-3-347 -4d4a328f199e4020457b4bf8f077622966bb3563 v7-3-348 -075acc2dccaa621998ccb1d671a987090367d485 v7-3-349 -07956eab189c0c776b79bc42235833d234480559 v7-3-350 -ff69efc4bc55d83b5f2bb68aeede1d921e8f1036 v7-3-351 -ca65249eb34bc62e82d54f74e14271be7f7f8a44 v7-3-352 -12bb368fef2c8c5478f0f8905aac381a56a75fe0 v7-3-353 -6672b1645306ceab4348caaffec40990dc319b98 v7-3-354 -d2f70593afeb432611cdb0ea2a0600c2869a20e0 v7-3-355 -c349a670716ab5e5f01b8121f3b7f07560ce0b8a v7-3-356 -e618700297e83c0d51efbb77a849ce5f0b19b507 v7-3-357 -97a52300ef2b496b6c8e2487973f134d9e0afba8 v7-3-358 -b7f0f23bf90603f83854fd1aece09fcc64876a29 v7-3-359 -28480c9006e6e6936aae05de1f3ca3eaf4d2f267 v7-3-360 -e42252611e74c1df2063955d6086f59fb3e3247d v7-3-361 -074ddc768feadcb3164973c7f7be8bf78dbdd56e v7-3-362 -c025592d7b1dd658955b9a6d2d159c04e83c31e0 v7-3-363 -b0bbaf1020f08fa6dbeb059e251127e27fab9ecc v7-3-364 -54ef99c39139cad53db24bcdc18470394d76b40f v7-3-365 -436b42f3cba1896b65ad32e791d131a7c3978738 v7-3-366 -972bd3fca5562b8752ae18313e8cb3e6fac207c5 v7-3-367 -4e9c5338f44c24d511a989b5ea50850a2b9110b6 v7-3-368 -0df9718c45b68c0aaa40934bb54b3217b0c24495 v7-3-369 -3801e4811b0ecd56667fe89172ed37a84047307d v7-3-370 -e757e1127d210632cc920d9a0d2d2a3b89be7ffe v7-3-371 -6ff80dd02b51e9bd6d3c1b0167b81e295b0b4881 v7-3-372 -a1d2f741d45c8731450db862e89eb4a650796fe9 v7-3-373 -0a9d7cf90f94945578b83883e2ade369ecfbfc6d v7-3-374 -767bb493e7d31273edc45f4cb6602784f639f516 v7-3-375 -1d7434010de186b02fd6a5c8eef3e28108a4a251 v7-3-376 -cd145cc2f2c918b9fd77dc177f69805c77e31e41 v7-3-377 -a7517e84d9b8191092ff849e520558d61be01f71 v7-3-378 -0f193ef0f4298ed632b5e9dc88c7efefe093728b v7-3-379 -534b3ef1cf1440a9e22c2efc7f2673017024f124 v7-3-380 -6cc788692b2e8e043a3d7fff4e1efa2601ad39c7 v7-3-381 -2260435283f2ba0ac8d0b35e216b297605ef81db v7-3-382 -f8d2ef4512f8d78c00a7aff24fb8f99aced6f2d6 v7-3-383 -e958eeffa0a7d0ed2021f2f4b61ed9e5daf3d9a5 v7-3-384 -910eb66c97684b3c0511789e7655dce2c7ba254a v7-3-385 -1cedbee50ca65fc96eca2d360ddf886b3e7ad74f v7-3-386 -ac16c62282ac0e961afa44b556fe850dd6c8e1aa v7-3-387 -683fab13904c115b4e1f8b9ecb902d192501245d v7-3-388 -c97c3272d7a67a2980ddc291f12f09c36568c54c v7-3-389 -48252b5fd17042ae95c6736073ba3c5b12820f2c v7-3-390 -819322e0e93e50c04fa79163f9b88085cbe7db8d v7-3-391 -c4898d6d73a2ffa55fc91f79f8e110260eda29cb v7-3-392 -e0248b732a5cf0c4e6d61253564f3f855d11a755 v7-3-393 -927c7377cf49bbbf87d12863c2a2d462c9cf97a7 v7-3-394 -80c529a5650f1d70342f18c681b69d7897495006 v7-3-395 -2f075595590f498f1a9cfc42dfce24cd0d980e96 v7-3-396 -75217982ea460e7bdfdd2517d8d4e4f0d0ebaef4 v7-3-397 -9eb7fdfb5e63ad98f6feb81b03566fbdc5ebd895 v7-3-398 -ce6afdc00290520fb2d9677b44a0cbb70bc401e6 v7-3-399 -320cc46d0eb022bfb24d1b636050becc83ac0014 v7-3-400 -1251e1ce94610b265d3c1f636d379a0504cf2ae5 v7-3-401 -4eda43e1fce06ef32d0a79721fa0a6850a72b4dc v7-3-402 -5850b58276918de8edf19ece0bd258e179967af8 v7-3-403 -8b928bc814a8d502f25a06ddfa66b0474b89a73f v7-3-404 -c75a8d2404bd4f1297aafbb10ab1ae68ba678249 v7-3-405 -fbb23bd517f8614f512cd81b253519cbf4548863 v7-3-406 -55cebc7e5de078ef323a94ad79319c0ab33b09ef v7-3-407 -1fec3c62f6e8065c2f7ea7422213e78b50032de6 v7-3-408 -7b59c2c032ca8a15425afb1b519c809abfd572f0 v7-3-409 -5cf2a671d8ebdf46590b8fe349ad2b6f84eed868 v7-3-410 -8066fb7e356481b52019a52696072594d2590d4f v7-3-411 -aaee6093302281b70798ae4dc599145b95891908 v7-3-412 -821c8be2e9d604282481f50f7c5a1a210b9b1696 v7-3-413 -c7861dd3b593a2011ae46dbe43d78f44cdf2d99f v7-3-414 -e7e4dbac7ded5e048e289c7fd92c40e29f775758 v7-3-415 -5c5ca538693fbfd3a574998693094b48f19ec12e v7-3-416 -5c5ca538693fbfd3a574998693094b48f19ec12e v7-3-416 -22a626604672b37914ae929b0d5e11e3efb0d79f v7-3-416 -63d3541d07339c65d602bac2bbc72d755b416ad8 v7-3-417 -4500a0ad2e0a24f54e5c4b4a3266456cd5ccb2eb v7-3-418 -f4574729f6df749668df181a9dc09030f37de2ad v7-3-419 -ded8f5add04c9477c47098a66991f971324787f2 v7-3-420 -076003f52582c2ec0b4851df539edf512945778c v7-3-421 -60f6df978a413952e37d03b85a50ca858456b53b v7-3-422 -b7811ab264bf31e0049e7a9b689a399ead6cbda6 v7-3-423 -2e4539dc2de7da0aed83286304d1afeb0a4cdb3d v7-3-424 -7b17a38eb223b4b56327f019267c1156121f5c0f v7-3-425 -c70c005f61fb08ca032b4eab533908cfc6e6f40a v7-3-426 -45467d77047df9134a7694367bf97344441b1b3c v7-3-427 -d473f39aeadf6d022e520968db17257b42b52b61 v7-3-428 -c9366ca36f6feb95bd8e01dbed9973a404f5391e v7-3-429 -a9f8dd20a49f9b8296a6ef6d9e17e3446c0974eb v7-3-430 -a27fac494e709a3cb78399f5dbc5d807a1dc7a46 v7-3-431 -81201fb337a58a58cbac43c2b89025c681361df7 v7-3-432 -8a731d7f0664b13176afb640ed0325949836962d v7-3-433 -636c2b1cdc8b6cc5279ac7d5986da1085484b98a v7-3-434 -afbf45d854965f9e557497ab9d4d9aca87e220fd v7-3-435 -2a6eb75275d94b864eba6d6135de650a903a4a7e v7-3-436 -539613ce999d3a938c602a6b6eb230fd0d77a1d1 v7-3-437 -bb67cd961fc3011d367357c215a0603dcc46ea40 v7-3-438 -dec4338a7da22b02e7c7cc65668d35db264d3400 v7-3-439 -e3cbb11f3555d5dbb1cbd3daac4a958a9e1f01ea v7-3-440 -af4ed13ca541f034e3241f2eda1abdb3b45d1770 v7-3-441 -198ec1fff71a44a35aa7a59b4952583a82a296fa v7-3-442 -de050fcc24cfb56a7dc07dd283cc1132d774e7b7 v7-3-443 -72146e7f47fa647f19fe419f4c8602897880eed5 v7-3-444 -397e7e49bb0b831f7260d3ad70f6b07175c44a0c v7-3-445 -20ca2e05ae20ece942490182691ed45746f64cb6 v7-3-446 -6a03b0ea2e12d748c1e4199e3f428ee080760939 v7-3-447 -756d712b3118b896b57ddb4f4c071135bc031607 v7-3-448 -9ccdc4a69d8ff7aab8abf89f9a3cc9dad12249dd v7-3-449 -3479ac596f6c4b38849d2e5235ad590378605eb8 v7-3-450 -045fdc5b6056a18579f28b40a4914f4a7cb8d4a3 v7-3-451 -f1cde9cf023e15cd1bc26ae720d6380fa5ceac7d v7-3-452 -791baa7b35e1b6244cdecd4a2feed933f78fd84f v7-3-453 -1632640a24b42a9193eeb8f6e8150afaeee5ee35 v7-3-454 -e6392f2aed4c13170664b4ec13dd2d8b3ce968aa v7-3-455 -07fd030f89be62aa11c4ea1a188ee2d8f4348677 v7-3-456 -4a2744311b3f3c8207189dee4ef405959a2e2446 v7-3-457 -da670fb71d30a1eefb07b19256f8c0d677807550 v7-3-458 -cb2ae92ce106de532c53f8a16a82bc2bf6edacd2 v7-3-459 -981c7ad9dd48cac1b4030b97c2f0dc0b8fe82337 v7-3-460 -de60f6fa3d8d77442a39ec13efef89f6ca76af03 v7-3-461 -70eff6af1158f9dc99118ba73e81f456015c3ebd v7-3-462 -8e0fe5a723adfb45c44978083db7aeac11e6d72b v7-3-463 -43259e4542c76e950fecc86114c43065064d1b34 v7-3-464 -d1096a4e96bdd5bfc0ce2f1aaddcbff1475c69ad v7-3-465 -df9c7798b5e2c022310cd12e199c9de8d866aa39 v7-3-466 -276d58e9265cfee76c04bc5450681090900a16f4 v7-3-467 -38a1357304234dcea96f96019abf0f3e5ae290ab v7-3-468 -e61c3b09ae86a8a448ad2d028df6fa6b9778666b v7-3-469 -636e4db6e2075bd22640cfc8229af62059f8ffe0 v7-3-470 -3465a9e7758850684d18a9bb11ac033efdcd1755 v7-3-471 -8332129d9ae8f11f8ecb9f016e5292c6582bbb4e v7-3-472 -7f1bce9c9b79d4ebbf798d6122612934d55d70d9 v7-3-473 -7613c9ab083f3e9262be5a21fe086921b757da4c v7-3-474 -36160830a5e8d0e3b4174aa7d98363623468b77c v7-3-475 -fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 -62dc0d69ab11d5b5a67c6139a0dd3e2618d2c2a1 v7-3-477 -754db405921292fc57dbdaa85e62af333dce5912 v7-3-478 -3db4282d5e6bb74a5c1094f35a81472d5a98f313 v7-3-479 -b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 -8e21ac7f2d6e9f269b057939dda58d3a31beb894 v7-3-481 -3229335d0c4e6cd7e91e6e61d791d7dff7d3082d v7-3-482 -19040069b8bf1818db44396a150acb54f47c3a96 v7-3-483 -00fa605e7d7ba7d522c627a93de6e2f5017d2884 v7-3-484 -94374e0b6267d8983a73a22166888c2282ee793d v7-3-485 -08a37c57af479b54fa327bedc0ef31c42dd96f63 v7-3-486 -21219ffc97903684349f1fcc843eb61838877874 v7-3-487 -8691bdcdbf66733c7ec1ef8161da1d4ef49dce66 v7-3-488 -c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 -b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 -e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 -214c7ec1c8f995664d5684da8cbeaaa86850468f v7-3-492 -bf5960ec253293b7240f59a7682f2e862dacd205 v7-3-493 -5240610f277823478983e3f04abfbed4e85141cf v7-3-494 -27f6a22ff88eea07f24163fe470b7335f3c1b32b v7-3-495 -3daba355b0c15ef66a9d2810ae7c7cc534dccf62 v7-3-496 -e34c620007be9fd805556c43fe848de521f3b64c v7-3-497 -b1a42d2522fb4ff627a0c381e994e2a598f7bbbb v7-3-498 -4a2cb025b6417b00f2ced076eb79739e03acd7d4 v7-3-499 -b36640b2f671c006fe26b573fd42347227efbfa8 v7-3-500 -d7b335626ddc7a61667cb3e23ecadfe399b676fb v7-3-501 -1d1cce57421c78884cff2d3234d3759bc858d6fb v7-3-502 -65d036fd449e488303e78d2c6679a736551c39a6 v7-3-503 -17bfcb054cb770ac685acaa349165f210bdd36ca v7-3-504 -fe7bf24804e195209bef4cd008f0bac7eec7fc60 v7-3-505 -982f84487daf102f1203977a09f2c6c76d1ed3d5 v7-3-506 -f9a865d97614940f817b76642282d966781296e5 v7-3-507 -2722f11ddc998ac7c578c68c0248b58468179418 v7-3-508 -8101253704f6504bed3f0209e9a6fcae3966c6e7 v7-3-509 -53786601213cd9f86db8714f7b0e077b05e2704f v7-3-510 -b782e2f9e6892116ae5d068249b5198bbe0042c6 v7-3-511 -454646820185cbe13e1f2e4f7533b984d3b07b18 v7-3-512 -75037f9bc97ad76bca58dbbc0ddac69cc7f5d9ac v7-3-513 -7e4428115d2cea86fcfa980097c98c11380ae196 v7-3-514 -6c318419e3310fb9658ee6ead6b4ea33def8cb6d v7-3-515 -02440d1fcc9aa953ebb7c0719405ccf2525f2777 v7-3-516 -9a1dba1f969ac4cb2477626cd79a7a6b0bea1894 v7-3-517 -ec4ab9d832b0f5308c861423d99253fa496b3a3b v7-3-518 -ebec52bc2800b8e51e522425fdca5c252e6d4f8e v7-3-519 -7bafe52b6245761a242321352daca224e6b9df78 v7-3-520 -b14842cf382bd3f99ca090c985609c6dead5f9e0 v7-3-521 -e4899d2ff5d8e552ace52b7eafe02b2c5dcdb409 v7-3-522 -d8ce4a2eb44e3e3d56db5e26d9982aeb48d7814b v7-3-523 -ae1641c4fbcc8c25d27802d6048cb0767c4021d1 v7-3-524 -ac2e00f917df566b81b9e33891b102cba5b390e0 v7-3-525 -257c2878e0fcabd5504dcfed910287374405440a v7-3-526 -a17918b76ca1296f63db0e81dea0e37b8b880150 v7-3-527 -fa17c8646feb4719639150f1c301ce6c1557afb7 v7-3-528 -d83218a156dd8258a5f2f3ae019c56f3e8851d48 v7-3-529 -81d5f3a3e27fff9188ae34c41b939fc88c9837de v7-3-530 -c44f0f7424b98d321d90994198374628911623ce v7-3-531 -9755d151c7492a5f1d0e77a2d3c9e414f20f3b4e v7-3-532 -74d51b51f3e69df7d3295255ee10391b3409055b v7-3-533 -65f905eb14cd373e205ff4c8a53027514e96d819 v7-3-534 -f52d2ea0f81c20e6f026d74cec66b135d5470d2d v7-3-535 -a8897fd5d074d7baaba692013521304b13beb784 v7-3-536 -96715c3a905faa1bbdc50b16b0f57671b4758e0c v7-3-537 -bbf1fbbe4ab45442f8876790004805503e25f563 v7-3-538 -7a710cf51d73cb3c3c76fcea34ee706443800c54 v7-3-539 -af083cb521bcb69aae315654a3873c488dc58c43 v7-3-540 -5c1aaf9b4b1bc2d14d627fe22d414f3a2525c50b v7-3-541 -8d1b63e6d3173625324f4adfe733efc8091f9422 v7-3-542 -ce7bd50bafa74f4da979f27c4e5fa9a47e69d739 v7-3-543 -09d0bda69df0c5eb505a02e37a978e92fbc89332 v7-3-544 -e7ff3251dfa157284a48c5322783499d079e3eb0 v7-3-545 -0a364618c0e59fa777f526c99bee608bb5cf55ce v7-3-546 -4f4db5d661c4fae42f2d917c09549d58a2f4d05f v7-3-547 -8625e38066dbf6a4d5e2563fbe191c3910681d2e v7-3-548 -c0c935956ac3b7c706043e5c7c0ba840636fb10f v7-3-549 -297771eff080ed3bcfb2ade57c2dcab34bac5de8 v7-3-550 -e83c5dcea112a44f9a7b06042b52798e32d96541 v7-3-551 -443c50cd3e8811b58a4ca131ab21abd18aea9489 v7-3-552 -583e46e4a56c40fa1a7336be85eaec93f6800edf v7-3-553 -a967a979c37f458bd4d164afb8a6192a5b4a6fde v7-3-554 -8fb7bd9dfb2b26b43725c90e042d2089762466a6 v7-3-555 -b8924014a03991b79947d735a894e2c2e8f94980 v7-3-556 -a220dd97b5c7218558eaea27d301af2ed4f9ec2d v7-3-557 -34724dc5172bb81a9e670c5bd23edbe6a124fd28 v7-3-558 -74adc9f7e15b8c088abd04de35615cad6c83a811 v7-3-559 -0abd38ba64557c4a6d62575aaa3fc7ab6482d747 v7-3-560 -a1de7928a7aba45240c85a2bc8d70adadc49e4dc v7-3-561 -b2763055bdf26e1f11bf8cfb0601fefbefb34e0d v7-3-562 -02c86cdcf9a23f092400c7631e5906cb9053703b v7-3-563 -683de93060968ed4e9dfb7992910c75f479471ec v7-3-564 -5f811338b1186e1aef683d03fa05a8026d30e9f1 v7-3-565 -18c6b1752d0baab043792d3f6267ec393f7a11e1 v7-3-566 -f90bb88c261582fef85c16009f19168b38debd74 v7-3-567 -3b5f541269e2d9e57b82ea1ec89c6747e2003434 v7-3-568 -c052f3b79b9948e7072580e7db42f90c92eb40af v7-3-569 -4f1c511e71f851c4f1c14e950f95ebd6967c6ed1 v7-3-570 -43fd3896fab7be5ad01deed2960d37d91ba65691 v7-3-571 -3ae387af405f46e200fdf9bc204d0a251864abb9 v7-3-572 -802b1a1b275f5c8f95724d50d53642f221621d79 v7-3-573 -3ac005f02cf015b3aa246482c6331bd61c08d91a v7-3-574 -79ae10bd056520fb6367247804af22e52d2de8b8 v7-3-575 -7e3fedfc3d08d020e3ce047ec1a1cfd195af9ed7 v7-3-576 -286ba0251c0aff1a664a481846c1f4107fae0c11 v7-3-577 -0e9b2622c94a8edf906d6c44831c1cded7184d13 v7-3-578 -80ed6aa7b9eb18058a0b105af2ecd7b213891be2 v7-3-579 -f02b6ad168ae82ead0286b64627762ab2343ee96 v7-3-580 -96249a1803e28e6173faed53f8687334aa63360c v7-3-581 -d383bc2ba8112103389a44c2c747eaa1016da935 v7-3-582 -a69b1d711ff9d8b227acff694c53310cf237933f v7-3-583 -2d107086903af80afee524549e57d3ba016b3f12 v7-3-584 -d258a0c5c38a6a604b983b6499a0f02bc061c816 v7-3-585 -8393a16069fb5f7b22ab766167b698e4dc129911 v7-3-586 -a34fb0a077c9c26946727a25222e0a99dc08db0d v7-3-587 -e92cc285632dc29d932061970e43b53cdbb3460d v7-3-588 -e82937b753a8ca6705bf55dbf258f077746ec428 v7-3-589 -bdf7f3e4c763f2a038c397af8eb6b8950e58db6b v7-3-590 -e5b925ae56e36e86eb2ff059aa28d6a2dd332845 v7-3-591 -0e06193d4bd7be03924dd9c6251a64c6c6adf78d v7-3-592 -46896c29edd74418c665af7c1ed685aa52a41e1a v7-3-593 -5e7b500dbb7e9e964457d300b536aeba9771af6c v7-3-594 -928e7cef8836d13d4f2a17234e127b928ee63ff4 v7-3-595 -5aad2c444a00a2309e6e373b6bcb5441669ba126 v7-3-596 -b9aa7fb4a9281b87a651251f799e049409634757 v7-3-597 -f0747581607924c30530687fa88ebaa57602eb5f v7-3-598 -b06578f1390fea339a2d9d18e12758ec1dbcc279 v7-3-599 -8f98038a0bf34310a8224a569eacd539b7b8b649 v7-3-600 -c1780b4cb9955fc113c3c993c18c139e06425ef5 v7-3-601 -5cacdf56c94b6fa1992f7e9c07c95bfe52bcccec v7-3-602 -085f14642fe828b1cbae5706ca87f2932cebeb75 v7-3-603 -acd91c9741a6d0185b7c63db412888de4f904118 v7-3-604 -4873d9c4ad3b7214d3ea8af9712a87ff69948380 v7-3-605 -c612d154bcdd642e4097ae88526a81ed7868c184 v7-3-606 -002f2c5de317aaedb93bd2e506a295efe2d552ce v7-3-607 -d47e6222d1cde1caf08fa63104375f5750c25d90 v7-3-608 -d29aa05b7e311bc05491521f4059ca2b625c5550 v7-3-609 -9f48a54329975434d73ddfc19e33c343653d5c73 v7-3-610 -e13f2f3568e1e21fbd223a1c0627605e2b670c53 v7-3-611 -2b4b6185054ff05fb6ee3ab1bcde47409bf2ebe0 v7-3-612 -c03b6363492b26c02b4f8a725a91849a1a5cf548 v7-3-613 -2bb51730ef4bb0824658f7507edad165e194dd45 v7-3-614 -169ccc471a8a947c046b7ff41023b9045beb3496 v7-3-615 -baba6286c91e63dd42039206e3e0990fb0ac346f v7-3-616 -73db39ca1877a07008310a2ec98a2220e50c52f1 v7-3-617 -0b1cb3f839c48daaccbb3abcbd5f1c394c57cb10 v7-3-618 -27ecf0c87bd20140d9e85d4fd581332e0916191e v7-3-619 -a6ebae140d89f35876628cde44f0e7ee5a0ae1d2 v7-3-620 -ac13ea2b098d98e62408ec2d88026f690f68f940 v7-3-621 -52247eb615118965bb6a949307e9abfd378cd088 v7-3-622 -a46a101bfddd4fcf30759f3847fa1e18546907f4 v7-3-623 -06749e351b1c030acf50cf8c469f8973aff4a96a v7-3-624 -f43ffd820a46bf47b3e55b56d3e5334302383757 v7-3-625 -956b1ed19282518e0287891d4e7b2b8a3f850402 v7-3-626 -dc65e6429d2c1b79719455d7303f3f95c5897965 v7-3-627 -1ed93878d6e224d46a7c125a82e52338b9bf0f6b v7-3-628 -7de7ef01288db1abc944293a28aac13ddd87879e v7-3-629 -3416ac23d0758528919aaffbe02cecc6420b8aac v7-3-630 -99f076ca8d846d553aefd7e626ca938bcf93f259 v7-3-631 -44038a9777aaf0e6502e0eb57b8f7ccf31798ec4 v7-3-632 -ad5fbf3596e0a8ad15c260c5b529efc5ac689e13 v7-3-633 -b7eea24095073d55ac3c59664466b78a0525bebc v7-3-634 -f7f68f83fc335379bc9e3371c5118b8f81c8d5bc v7-3-635 -616bc1ad4f12be0ef37fe67d2f6ed7535f20e515 v7-3-636 -3b62d8f36cdf709d4e0575d63486ebe57ce7150c v7-3-637 -c0256c4bd91ed7b806aab002e4a45e440dd00343 v7-3-638 -1ec385a8faf4002fa300caf370ef2ac380d9702a v7-3-639 -c2c3577021ed4e354853d330e5fc60691d8750c5 v7-3-640 -c068389057c9a89fa351678b5f5776278971dabe v7-3-641 -79ac6744237ce5076a6d2e2b21198dfddc2cc9dd v7-3-642 -fdac34e3afa5f0dea26dba5e96932e3b9a0be50a v7-3-643 -fb7c028dcac7555fee78096813e3846d157cc91b v7-3-644 -1810ee914648ef3e16a8cf866299a32c4a9a00cb v7-3-645 -e70485d3f81df4d72cb40d6fa4ad4218cf1e8392 v7-3-646 -29fe4e5c1db17a62b16a95fdda84f08cd05c27b5 v7-3-647 -76c099d45772a233982c39a29510d89eaa4d5a1c v7-3-648 -063765c3cebbd6040dc091b8c1ba28739fef9118 v7-3-649 -a638ae0f1b0cc41d8d753d79503238f11215f3ea v7-3-650 -ece544e85821a6118da55dad1538ea4c3625bd1c v7-3-651 -5edf3c51aa93110e57fcd0428c30e5bed149df34 v7-3-652 -fd0c7452fa51118d8f6557b34b4cc96e830ef6c7 v7-3-653 -73557eda70271b49015265b7147562b63a7a094d v7-3-654 -0d3238b54963c4b1358a1f33221f75e067c1613f v7-3-655 -a2f61b2b8e770bb8d233ce50c8c7508508578a8b v7-3-656 -3958b0e672d676a310d756bff1b9c629a7b0142f v7-3-657 -15cdcb8ddcfb848c929cc37e239d5da8fe48a8d9 v7-3-658 -e75da4a3225d48e59ee321411134cf9999348b7d v7-3-659 -8fdadfccd184b7de73811a3a18dc8815b7eb3434 v7-3-660 -5e909c379a1e87491bfa95ba1a37b39d0725933b v7-3-661 -87afa95a2992a31b1937def0e1db4a193b0ab32f v7-3-662 -2a200527131fac8f50487790ec201badbccdaf0e v7-3-663 -f86619764a1e0338ef9e14c653a5909847304b8b v7-3-664 -35939e1e25ff5a3862b83248f8039971c81936d0 v7-3-665 -1e22adc6176ec07f52102f383a9c3c414d43f9c2 v7-3-666 -cd36c0fed43e63a94d6e87b5c5c0b4d95628da27 v7-3-667 -dde6d0216a08a5554f3c351e519134c386d14232 v7-3-668 -2b3b7b48370848149c8b831b2b7aee9b7f4f88bb v7-3-669 -2bf8c00741f7f07d9b58596764236a92eaeca862 v7-3-670 -530f5a9030315f984e096794938c61f9d3562e22 v7-3-671 -fd6ef931aa77239804860b74ed2362b29c1a6d4a v7-3-672 -ca1c025079b11c98363e11576d903af756a593fc v7-3-673 -4da6003f0f0eee0f3908f8627af6d13a94c10cc6 v7-3-674 -9963f7a9b41b555a0660288dd94df44b6dee7c2e v7-3-675 -5309996ddcedd7e2dcc8c46624348405290b8940 v7-3-676 -8115f449a574bc146f75449161f1757aaa5bbb66 v7-3-677 -de253f606048a2862a338190b071e5e3c7de7a41 v7-3-678 -dd0f25ede9a8322b5b638961835cc4743cd479a2 v7-3-679 -52acec46b75ecf24d044982d4cc067ef7890e7d6 v7-3-680 -a2fe24ec6a0d06d0af286b9fee9e307c33f27cca v7-3-681 -8eb5b61161b4c56b378ec829e360204102d22db4 v7-3-682 -0f5ee262963528ddccfa1f54b83696f939d21b53 v7-3-683 -1cc37b8cfaa1c670e442e2f9444feeb1820228bc v7-3-684 -34aa94a421b7a03a71013ddbb92937dbaf83b1aa v7-3-685 -ba9c9d0c4ff4cf56c3c5d2dec2da71decbbe9f6a v7-3-686 -0545dab1517f8ce2b8319c02572e4bb357567034 v7-3-687 -2696da84d37093da0dea419878e4241385eb515b v7-3-688 -3c072c1cb87372f3ebd345463abbc451e80143e2 v7-3-689 -caa0ca9ad06cb515b7e6d2e4410e03802b58e167 v7-3-690 -7f10daa706bb6ed0c39f1d2905cd78368a98d19f v7-3-691 -337a4368fd2b68b9822b94e595d77b4d6773bfa4 v7-3-692 -fd96b3cc88ed71d4c4d24c6ac67c9d3a68ae6e6b v7-3-693 -8235ccf121bb241f8105d0ba6e1c92e9f8b04555 v7-3-694 -cd6c420e31d6843fa1231e1cf7a3d9eff0ad4e07 v7-3-695 -447c688b82eb4a5eb7cd0e16521094b77160fd0f v7-3-696 -7c72b5f7ada1f4a028315aa50f8739e0e83c2e74 v7-3-697 -b5b892472ecb1a10cce1709e41700b264b6485d2 v7-3-698 -4ffb6f9b58e0b51923fe6a71e6af158b6e3f7864 v7-3-699 -c656847932d33b5d68394ae1ea3153dbdba4d3ff v7-3-700 -48af8656094539f8f71dc51e0a6aa14d48ddffd0 v7-3-701 -916b5c11a13e9978c85f9742546e70d614116883 v7-3-702 -f69321485951a3c9bd0e9e7484a1901b94cae726 v7-3-703 -be8ad9c9b973a4d87b9bcfee2b6a8de1f6d3e071 v7-3-704 -0aa74f2f50a8333fd5544f5d4b383132be41704c v7-3-705 -d0ae72c2f5f94e2483ab0979eec652b1289679a8 v7-3-706 -d24d309c365fc5c6a9324a6183d7b927d9f5132f v7-3-707 -64427849c1582299f2af389c6225eead529f0329 v7-3-708 -fb7dec372910b61478abdd7f79871724153ebfdd v7-3-709 -906eb5c0ef129b6876fa9c6c5a13e44807f7a503 v7-3-710 -2a7b2943be22c27edb3c0334423c1b17275f18fb v7-3-711 -557ef119999ea687ccb84eddca295755c24989da v7-3-712 -f15769bce0b811fc840fd455035270288e8d744d v7-3-713 -9ea14f097855e0929f86c86d405725717efb044d v7-3-714 -4f0ddf4137eeb08753f2593a32b42a1dcb1e6f4c v7-3-715 -eb268db98f321b93f5e7552920b6389f9dddfd3f v7-3-716 -6a76846b84eb0fe1220f8cfa19b1161145932d4d v7-3-717 -18e95db59826aa9379e6e3ada5d3540cbae1e596 v7-3-718 -e6d8b44065bc05741effbc0635c21506032d97b4 v7-3-719 -9e119e0ade5d804f174a3b67ad5e0d0e7449739f v7-3-720 -b23f583e132e88ec98f2b449b7216642ba64a8a8 v7-3-721 -de6968039340db04ec65164a3450a40773488e00 v7-3-722 -ee138f29259e02f62fe8181073e7a063523e50b8 v7-3-723 -6e5acfdf7a5a2b3fa27a529881af77c1e1b1c0f7 v7-3-724 -f4aa43d952f5bacc752951c80495fd20c72ba90c v7-3-725 -5049eacbff0e9688af99eb67a408cae5919ff52c v7-3-726 -d3c291efdb0b9f5cd286013b789eb1c91ae868ca v7-3-727 -233666f859339f425684af70dd008354776259af v7-3-728 -d08f05285dd102d8f071ee42869416d25dd4e72d v7-3-729 -37a4cacd20511ead4cf1a8ecb235276bc448fddf v7-3-730 -778ff2e87806133faa8fcfefbd41cad2b601bdb6 v7-3-731 -fa8bf69d3866eaf31e6c8fed74862feea11a40b0 v7-3-732 -509e55bd4a3feeb651ea173cefcbd933f723d8b6 v7-3-733 -fc8b4a06af9db05af800b1304599afd3e1229980 v7-3-734 -d3158bf4dee9270477defcde85949ce58fa350e5 v7-3-735 -b1536bbbda104edb11b0f5772e433d2b5388905e v7-3-736 -1773d5aa6437b0f88029a192cdde2c510faf517d v7-3-737 -eccae034465b9a44aa2389039ba06b25dc6ae7dc v7-3-738 -e2d36f345a7f1131e085336e7b471f718fad6c9d v7-3-739 -2c12cd5c1381dd9691af5e7d3e1fe1f54c929ee1 v7-3-740 -6e1fe64cf4404d899232a880552cf52998934656 v7-3-741 -4d1753f3e85c7fb6d9cde1a8aa9ded8d11cdcd01 v7-3-742 -67e3b2753a6ef97a94084b85f87873c309fea3d6 v7-3-743 -26c8b3b49f743ca163a63463da08cc3822322bc2 v7-3-744 -aab4b29520e79134e33f2c641f1d960de2dcdc1e v7-3-745 -4934eb2e22dc0bc03fd5d4f95706a69a1ddffb94 v7-3-746 -cd59ba19985a3b3bd66dffdcf59b00427f844818 v7-3-747 -56bb88c68f985365b0545a0370be59fcd97a4178 v7-3-748 -3e22fe67fa6935d1156738a34e50bffdf62006c9 v7-3-749 -5c36fe9f19a529fb6064b37b8e47e82cdeeb7ca8 v7-3-750 -d149f18b289fdf19363214e7805a0637307bd264 v7-3-751 -ed936effb1f374004db15f092b8c8ab87631fdd4 v7-3-752 -c83cd3d01128204d6926550cbe1064daaf8dee8c v7-3-753 -beceb0a18c79b5b1bda4822b34cb2d62b2967d27 v7-3-754 -d9b4cf53be2edbb872cc489aea32a4441b39eaf9 v7-3-755 -706c87d16d40ecdf9c6fba45bc47b911d8e140cc v7-3-756 -65ef7c96d65fb2fbf660797608809f0ac5d0c4b7 v7-3-757 -9eb0d30510f7b02aa5f55f400bfab08d847ab447 v7-3-758 -25ea15fdfa5c7d5894a06814fe9411b75050ebff v7-3-759 -8e54a32bcd56226647cfd3d8c5e142e3a98c0ca7 v7-3-760 -6834d6aeae099d6bfdff5151aa2174cafc22647f v7-3-761 -699f8d8f096d4627f97e8d3bcf64b8634a484c26 v7-3-762 -b6148e4a9c397b5dd1716cdac2f96730bd0f353d v7-3-763 -b29e55d0ef01c506ec48c0c5782e669bb1d80f14 v7-3-764 -915fb3d2dd8ffc322a5cc9e294d9bb7dfa8c5a83 v7-3-765 -b5103b7d9e1284ef9ffbc7d1170d9105c0769c4d v7-3-766 -be1cffa1e477c4a96bb54a3097d3369b23f32825 v7-3-767 -9ea81cd9b1f50054629547ce2eccfac1fa00d096 v7-3-768 -d179a8eff9d7b0adc561f4a4dcfb0b7612c1f301 v7-3-769 -da7a7ba36ed2a51f28e4d3f7e1fd550303e3ece8 v7-3-770 -3bd2c055319e086665af5e449498a4d5bf40f25e v7-3-771 -d828cab6964f4249db54bff6df0fe02d0f290387 v7-3-772 -3db9aee957f7eea6729e5bfd294e3a24d41c79e4 v7-3-773 -a8f5876e498125f4916c5f7168823885c27dad8c v7-3-774 -a6e60677aea727622dde15d1306c61588b805500 v7-3-775 -80b041b994d156360992666110964e74f7473d3e v7-3-776 -9a1a4c486e6bb367c639c29c6120d5fb1fadcc38 v7-3-777 -562bbee33aa4f9896cb23ed6de8fbf60cac323e0 v7-3-778 -2067ed78d37c331685ef8f293d6a23c372ca4b78 v7-3-779 -42edc5dac33c92876d93f00f8ab8c1f6bb25d3fc v7-3-780 -29f29e86602e4a7f83d4572d2fe75b9b0de2752f v7-3-781 -0de969850c0687d2018e025f31e5cef9e9ce1444 v7-3-782 -a80af62d5e3b3614ff9e058f42647c99bffe7481 v7-3-783 -fbadf0f6987790d98c3b3fd935fea0494743830a v7-3-784 -be4baed0c933e1f1543ea175e2e36551ff6caa18 v7-3-785 -8b3e88bab70215a18768fca5a90c6f07ac1aa5eb v7-3-786 -e1b98967a985f4d1ad889c8e69b822d9126411ab v7-3-787 -386fc822dd002958fdade4329845013cbfaa3dab v7-3-788 -43c15135926fb95fa82b01424677a9c37f4d0e46 v7-3-789 -8819ea6dcb72dcf61fd0d20f8ea1904a7546917f v7-3-790 -16e8a09e8ab08d2226dc84b12b7e434bda6b4fa9 v7-3-791 -7061704c2014e4563efa032672264a47b4b7b0d9 v7-3-792 -fdbded463fdcc861630b3ea61b9654374847231a v7-3-793 -9867f92c9b9fb082ee6daca816f859b53ed8e58b v7-3-794 -17a312ba38a0b606cfd64d82ed2ebc844828085f v7-3-795 -2c12c4e2fae8db60fbdf58b34c8b73eacdc32665 v7-3-796 -0cbea05f19c73c01dbd0f04378a65ab7de6719e7 v7-3-797 -cdaa688e3dddc442c1d39780b6ac0b5ac98c253e v7-3-798 -5e9730de25e9b4fc2abe14b8d6b0968a9e59983a v7-3-799 -c0cc0e0620dd935956a472e5b23369d1d78f5fb9 v7-3-800 -48b54c590dc83b705f2e19f9aea1e9a69fe09720 v7-3-801 -cd5145d2408bb52217417af654f5664af269e19e v7-3-802 -77fa4dee43fcd1c0bacad9dc85b3deb39e0ba487 v7-3-803 -2eb4b9ed2d42312eff32e845336aab748f7fe311 v7-3-804 -dc30c01f995623e65ee6651a46b12ff062df8860 v7-3-805 -f7e3f87ac9928df0079741258a3c6034ecc48806 v7-3-806 -1efc30385c417bb413f5199253edca2795f9da0e v7-3-807 -3b2a771abb39f670269b0ee9c4041bf02c2d5b84 v7-3-808 -918d7df425afb77261428968ae646efb95b15224 v7-3-809 -8904ccd5ee85ff326a05530c02cc90e1260f768a v7-3-810 -ad21448af931b3923d9b76e4efdcf0e966c9d199 v7-3-811 -4584e59860b8db6fc5870f0b8f0425f540ea90a7 v7-3-812 -4e6e012af15028dde0f55bd9bc676bbb14e481ff v7-3-813 -d5b1d6177b374bbecfbd5c75fbce28e148eeecea v7-3-814 -448a6e7cf32e14a4adcbc4066743e2f058f7e1c0 v7-3-815 -2b340e5c5baaf66015f3367208d9bf22ce1dfc8e v7-3-816 -01fa9313d4b560997234b94b2408e6bf64808afc v7-3-817 -ad7b6062a7f4041b736d45c5f045671d60eb782f v7-3-818 -36fd800b8c6c527c75bfe285d0ed0c3bc1cf45f7 v7-3-819 -688da4d486a019afa3565ffc553af6ee1a4e67d8 v7-3-820 -4936ee89b4bcfaa33f74114bd07f20af382af14d v7-3-821 -2f7883063b19039840a4a73fa227f6f42b9e3281 v7-3-822 -db401e5e4c5d868b7848486c84521f047dc04b01 v7-3-823 -f5ef9b9c18cd9345eca783fb0c6d4ed50e215cb8 v7-3-824 -6b1f3fc893cdb6d0a4fff5997cc8ff083940e727 v7-3-825 -646cb6b6ff2372c26cb9dc9ef1a0f8d562204950 v7-3-826 -5e17a12a3b1438a7ce044db02d9916ef36e404a9 v7-3-827 -13170a796134824375a42e77af4ff012ceed2b5a v7-3-828 -7728d626ae038dedbf3347508238ef3ab4216a9e v7-3-829 -454d35a4339251adf125de78a8a98d99105533eb v7-3-830 -cb185366f5c84852a7221ed6d9b274a7239ad06d v7-3-831 -670e576a58d19c2033877d26b4338873d8a7db12 v7-3-832 -b971097606032c6fceb961fd559121d5bd74a260 v7-3-833 -3ac9d7d8274e669d10178c4d95eac55080ee0ea5 v7-3-834 -d356b5ce84ceac41b036136807ebe887208fb6f0 v7-3-835 -ff193256398a81a520b44c67d661eee36c64ee95 v7-3-836 -14698f63de8db5b034939aa66b7076ab76bcd529 v7-3-837 -1c819b05529cbbc39982513271499e0217382124 v7-3-838 -2030aca407edf6c865114f459bf2d5d79adea390 v7-3-839 -1778d51fcbc37e819c305b860f98c949915d35eb v7-3-840 -b40e6a47ee53789e91b57c04d9ee7328fa9237d5 v7-3-841 -78321dcaa8e263cdf408f7880530b7aea7401a49 v7-3-842 -f4960ddda07ce46a098d9106ac1b22fd0f6d0f0a v7-3-843 -eccc0e8a82fb632efdfa600db3f65f4ed3dff01b v7-3-844 -171234e02b1e74a2482003d56e7110d37fb4a62b v7-3-845 -b06bb07d906be3be689f90399effd2b3b2ac2ee3 v7-3-846 -4dd43d6b3df705a513be75db8a1b50a83f72088d v7-3-847 -e49b80f267dc3cde78de78026368dec3a20520f2 v7-3-848 -dc77c2a14a05810bda7e53373d76b7f41341f44d v7-3-849 -07fef68eb0188adb3d750b92b78059cf41fc8c7c v7-3-850 -dd669f296568a7525e02ab54b615bde20d37c466 v7-3-851 -3fd805ca2a6a6ef231f111c6a7b3cd512abaf537 v7-3-852 -eea32254940fb4cd61339650e10a808f4e702e62 v7-3-853 -14cdb6e4d5b88aaaf7e33eaee87efec5b1c1ebf5 v7-3-854 -6604853dd8227c7983dc1b10f804f6aa4b28578f v7-3-855 -fb533fb6c015f40a3b1301c0c876c35665b0d6ef v7-3-856 -4905e038b1057e133d0e72c48cf88580cdedf26b v7-3-857 -0a3fab86f34d6bab27e0be69db4f39ffb664557a v7-3-858 -ecf21be84def6033137d168e0a66500c29aeffec v7-3-859 -6ce32844727d8d04e8dc91310d0a4118d81aa161 v7-3-860 -6fe728bf165e9b6974ef47e86d98b0eb14ce21f3 v7-3-861 -dd4f3ceb5d86f8367d4cfd6fdc898e493c6d0aad v7-3-862 -5c0652f455c9f2ae72790a782fe5b5fd1a0e857c v7-3-863 -a82ef37d38c09523bab204253b52e177dbbc0581 v7-3-864 -94342b0605fb9111b7fd4a45a8bbc72992c4c255 v7-3-865 -90d72df431e54d677f03171cbe558434029c027e v7-3-866 -0fcb050fd79d84ed190452e6387e42d320678fec v7-3-867 -b31989e2b05832d432557a32ed8901dce237dec2 v7-3-868 -23ce9a61bdc2a35892ec4e4fa22e8964d60dc6cd v7-3-869 -26e59a39fdd965ffe83bd654b705540551c8e0c8 v7-3-870 -d52c45b35fb0c3b77bbace6cec3deda8100fbb7a v7-3-871 -edd0bc1f26bd019cfd328a0dc2c9a854607e4a41 v7-3-872 -7faeece39228fde0ac5c26a362a223d0dbe9bba5 v7-3-873 -4d0b39bcec207130e483ffa66b6f51f999d8e95b v7-3-874 -beab15a2ef147b880bf7b5add269142b9af58317 v7-3-875 -787df0fc6539ff7886e9fabc85ea403096577440 v7-3-876 -96f478b812b14fb1a5710450a1174baa55c73409 v7-3-877 -97a5ce76cb7d5f635876bbddf35b421c0c76690c v7-3-878 -79176b78969cf5d182b378ffb8e341e22f18775b v7-3-879 -9945fe0536a32496fe4842524199b5c24bb8b0d0 v7-3-880 -d8acfc49d94e485f839d8e2534d302b91a98bf9d v7-3-881 -8653c39b85ea93e052bb0cbda571e7298451eebe v7-3-882 -76aa34cef80f5d22bbbcf60278c833fdadd70131 v7-3-883 -22adc26aaa9f701267bd1ee4636592859ee2dc70 v7-3-884 -c5eab656ec51dc2d40ef6e39194c74af868a4b5e v7-3-885 -902d6ab377ee2f011279b3aaebeb05d0f5c2bf80 v7-3-886 -015e53d9978721bbb9283a999c668c98ad2554a9 v7-3-887 -b0b253898cf9ff8f5fbacf69de76b5640b1b6a55 v7-3-888 -cb0c694517a08f1f8f548f0771e874537a390dd4 v7-3-889 -89bdd6d575101291c66f9e701c456ee71085d147 v7-3-890 -1dc160bf2488fb1332250edaefcc9f1e320c8e57 v7-3-891 -6c2e8074ea2588f710adc669e7a15041f6e80adc v7-3-892 -dc3efb6d5a0821c79f939db8e3b77a714292195c v7-3-893 -52e946d654e0fe978609e0a23dde3c8998f2ce24 v7-3-894 -11007e80829ca9d72813a9c60a2eded80a0c1855 v7-3-895 -af3a3680fc75f090e896d902f0b4c7a710c41d41 v7-3-896 -5aa74a2f8f9de4a6c10bdebbef910d6750f2a980 v7-3-897 -aca1886102bdf19f755dc5eb1ac379f1f0680f6d v7-3-898 -bb3cfdb626077d9236447f40ee725b9a5d78216b v7-3-899 -b53fa3b431934de82d3bee329643bbe0856f651b v7-3-900 -790238e5a46c70f45232c0a54d0c73a6ca1d37dd v7-3-901 -b01e3cff92530f6c317e0cf2c0ba0fb4f97df883 v7-3-902 -166b3df562ead7b4f85a494fb8a6eef40affdf85 v7-3-903 -bdab73bf24a8b361a42ffcf429c0aa705d4594e0 v7-3-904 -8e1d1da398b378cf03c0910979cf475ddb2df7e3 v7-3-905 -ff1f3e42df08b2ebc39e3b1f2c80f4751bf16dbc v7-3-906 -9f3da1dea7c0944837e8d5a080eb59a24f6c9dd7 v7-3-907 -4281875776fb2c3127d08a03c3600b58353c9796 v7-3-908 -b79f3c3a584c701e93acd1881a934c931634c39f v7-3-909 -d8d9c591c50fec51b64c12bd2f42d3550bd31d7d v7-3-910 -f1eab4f77a6fe4b77508d86a68a6681195806607 v7-3-911 -62eadd7de409641de83ce61e1eb311e9116e06fa v7-3-912 -0d3573091d42d4797f10cff1c4139557d384f899 v7-3-913 -9f642ac84df9303d34d0214da2ade28f78ecfb6c v7-3-914 -d8053e6bf72a555ed34201c6edb55a23b4fc9965 v7-3-915 -f39af34195702c5587eff88dec51b40e327f418d v7-3-916 -3887b02953cec045611021e0adcd512b3d127692 v7-3-917 -6a8ffaf0585660badbb817f6a2f1cb583c9f1447 v7-3-918 -12636b8248163628e7c8df68210dc17932440157 v7-3-919 -923277a9cce4316d6b4cb3c6571dab538a6b0108 v7-3-920 -97474f967eec7f24f09d20dbac65ec9bb660bb2e v7-3-921 -1d56e5dfa08e68c9ef0645cabf076e401799e3bd v7-3-922 -6ecb80dc6521837e28bc58d27539767d6947037d v7-3-923 -7eaccdaa530431c15fb0e0803e5495074e883bb9 v7-3-924 -04736b4030ecfa2c9e8d6046ea533718dc5d8ff0 v7-3-925 -c80838526eebf3374fc42febcf40cd911cc1523c v7-3-926 -d67e292af6f9d259d0893c8062f3896a8aac000f v7-3-927 -6d45e6f974159e816a4300877296e9a0760ad113 v7-3-928 -94aa0d30a3ea6291daf7e6207810ec5282cc97a4 v7-3-929 -d85196defe0da017ff6d547e36bcf40aecba9661 v7-3-930 -fe0c7437ae8b0e05b57990549e1ddc71e456f18e v7-3-931 -b7f2d97ae2b7442c46c48ef36d9e33c3ddd34db7 v7-3-932 -c9820396afb971035e722ddce2058d5db2f0fc64 v7-3-933 -000bb500208d54e17de26bd5cc5a18fae8d1729c v7-3-934 -c42e130ebf36515e574d89efbe98fe380ec7c694 v7-3-935 -e7361b2d8136f6468daedf1bec7390d77c5c5bb1 v7-3-936 -8ec7323f417d998685afc26bbb4e466eb0204352 v7-3-937 -a2f03b41dca7024da5e702d016ae52fe7f51594c v7-3-938 -48a22f36ff45659594ca865f502fe95691b2e332 v7-3-939 -e2db42528a5bf380bc7e92e41afc807b27f01c12 v7-3-940 -da71e66dc1d4300cd792f0da77a5afd99d634c6c v7-3-941 -358c10968c7fcb2599356b419473a3fd46edcb69 v7-3-942 -736b8e18a3bced7e498a6b81e7189d78cf4671e0 v7-3-943 -71fa86c8fd4a1af0a27a880ea15e3a7b97334453 v7-3-944 -80eea7a9d6b9c2e7e8ceb18d6a090387f7e1e9f5 v7-3-945 -11376842075637114ee3714ccbc2e0e8a432a4ac v7-3-946 -a84f21892563be88839b4026bafba77f9e9a1fec v7-3-947 -a6f0544df95e5f783861d3c67d84bc5a28a315da v7-3-948 -cfd76908da252e03f46ea15cde44a3664e895fb0 v7-3-949 -d4816e7c33289b9c8aec739850133484c5c3e8fa v7-3-950 -907b1f035ee7cc61fec1463db85a9eaba4717120 v7-3-951 -2a166caf8709876053f9b32f4f88590a4fbc6899 v7-3-952 -7b789d337820088f09f6a8fb488efd418f702133 v7-3-953 -1afdb7d21c14e15a1239d406205563dd702d7d24 v7-3-954 -fa90ebf2c8f36d98ef27b2668ac1e1c11db75bbe v7-3-955 -0bbacb6a83bd678266a0a864e47f4e03927103fd v7-3-956 -c16602758d847665ed50138a562f1513ca5dedc8 v7-3-957 -58b74ab7f29df09e54bf76ac84697f04b9f4c163 v7-3-958 -ef6b11bb183da058edf52c86ce705726ccf72600 v7-3-959 -e67522c4f56646bd6ef91ad63b152bcec96b2e05 v7-3-960 -d5177d5ece0c539680390448c8ce8d05a6d61201 v7-3-961 -0a94ac379769762200c427995551fa4325ec8f28 v7-3-962 -7eafa576528e6921f337da5c1e3e2d0a9617993a v7-3-963 -7d81f4e967285d14c9e9901328d2c66911a9a2f2 v7-3-964 -8a3ca4adb5d8046f87aabcf30a2b7aefb8b9d46c v7-3-965 -9b800f0a757fcbedc2c6a1851353c3e5044d39b2 v7-3-966 -20e30e31bd86390590e288516670b81caec6188c v7-3-967 -dfbe53a54c790d63f8788c13a6a2d18198825605 v7-3-968 -137f9d41f50894cd25e5b47764af817dd84037cd v7-3-969 -ccecb03e5e8ba41db171a5535047f9a30b5d391d v7-3-970 -8d6bb2338a583af5eb85589949065cfe46c42bd4 v7-3-971 -ba53304245f033b6cf2f6088c09f45dc0d98c47c v7-3-972 -09e1e574a52d38522a35af8741b3f8ce92336398 v7-3-973 -92fec4b83be56a65ed81f25885717f6db7639854 v7-3-974 -44b89b025cdfb6a7371a036ef1b2dd93670b2a15 v7-3-975 -015a8fabf90072ae0eadee5c013f7db00f83977c v7-3-976 -21e13403140aec6f32a8f9b49dac02c37945ab11 v7-3-977 -fe8a0a6a1c2a2ca51c92275a9010999106505ed8 v7-3-978 -a63361b9097952faa9c9eba2caebef09b9f8b62b v7-3-979 -c83656c9745a005df1aa7d6985787048a1884734 v7-3-980 -4ff8fa416a0dd64046e0471933d09f7f19a4ea0f v7-3-981 -dde1cf311be6edf32243f03fd8436bdf9798de93 v7-3-982 -ab5154170c3dfc0dd769243e1da53a865e1f69d7 v7-3-983 -94c5441984cc47971ac49435d184c13cd6d3014b v7-3-984 -0c940b6f282836186f428d201760c6f6b9b52fc6 v7-3-985 -3cc2dca142a0aed29befbe6d2944ed580d728545 v7-3-986 -032c9f916f257ed59f7c55a6c8113791d3def365 v7-3-987 -035fb0d5e7ce67eaff19a6cadb37b57c0c25a36b v7-3-988 -cd005ab15ef3fce8f551c81ea10c93889f42d09d v7-3-989 -9a1d78f828261181232734378f73d648148a42bc v7-3-990 -8fe768bc1234fc817db3cda61ae9e9dabf4ae958 v7-3-991 -89ea7593fc0cb9ec66cc04619217447715289a78 v7-3-992 -dff1542e64f95a3fe10ea24f4007206d53880087 v7-3-993 -f74611bfb1b77eb2ad42b6d74b3e3657cf3f0725 v7-3-994 -6d517f6e5f0b031cdb386878d8d428f7f2cfc2a1 v7-3-995 -ebd94eabfd8013a605d8efc7df64a970531fd5a8 v7-3-996 -ef02f32d8e53a7b3d7327ac79359a18070e4a101 v7-3-997 -47e6dec5ce3cbc8e833480b8300132d4bf5f035e v7-3-998 -e6e60d9da892296ad770b26a22f98bb72c4e1b7d v7-3-999 -d037b9cbdaaa0af2b383c93acd0fd87e8eb2b8f1 v7-3-1000 -9dbbddb2ed10936c20048ad28a2dcb9fdb6cdd79 v7-3-1001 -b498224f5b417bc436c9b967978628703191c0d9 v7-3-1002 -ce94a870b59bbaad92399eb782edc33a855e0b93 v7-3-1003 -cadb57fbb78165c81fe4718a355b5f73c641bb62 v7-3-1004 -90e9917d4114461c5f7258c04e61de1dff2e1a74 v7-3-1005 -9a2183bd829502597d52f22a1c27fec8399298fd v7-3-1006 -fba9c0f86f77942d47a5505b065e01a733e7f111 v7-3-1007 -8cb14f59a3275cb183f031e2aa1e29e230635d6f v7-3-1008 -57393dc4b811a1283a77c759a09bc52ba78acb8d v7-3-1009 -36ddcf4cecbc96b9854af6956f371dea205a6890 v7-3-1010 -55bcaa1d2749f9dc22187bea848b002220cfe960 v7-3-1011 -432a6b8c7d933dee8faf25a342e857fa0a538eea v7-3-1012 -1be43c095affe8e945751a5cb4e21210f31c02ab v7-3-1013 -6a2005efa02b4ae30fa4867db1463fd4a3689843 v7-3-1014 -45f97c34953728cfe859cfe5212c241fab1da20f v7-3-1015 -5cc98a5898cf9ff0841c78acfe1056ae075a217a v7-3-1016 -532c2e850256cced37b8864ee7042ef8240f135a v7-3-1017 -80170d61a85cc03d66228c16c80cd8a4898a971e v7-3-1018 -08ac4698095359c3a888b34074548435e9775973 v7-3-1019 -f7944ce459ac77416617e0b2f8a91a9c8cb385b6 v7-3-1020 -fc997f05cbc7b566df765c79452a541afaadccb8 v7-3-1021 -849180347ac359fd52b92d70b545800126178eab v7-3-1022 -f0c37f5cf4eabb04044ccab4031cc4056c5a47a2 v7-3-1023 -7b835b2969af137f979b633977d59e13cc0960df v7-3-1024 -b2946c06d1b6d4e9d38fad1d4281e2d4db3523f3 v7-3-1025 -888c12c899e552deb33b2e1e8ea3c8141352c3ce v7-3-1026 -04086e29756318d7a7cfe3d35fd38ccf550ac366 v7-3-1027 -4d81fdda8f35cf764744161118aeaec948b9fc90 v7-3-1028 -e7016af0cbf92a5562c01e95f2cec306b6465783 v7-3-1029 -d1f3c77159f9b69f229ee0f70fd98464b2546920 v7-3-1030 -96c1a785009768720fcb16add8b9daf1290ce56d v7-3-1031 -f262fb02889d46743226a78363250e2e1ed7426b v7-3-1032 -b2a8e3a66f8cc73c3942ef5cb9c0519df86203cd v7-3-1033 -37e444aeb33b2adf359f8736807f18ff5dc11019 v7-3-1034 -626e9ccb7c48b3fa7ff6d2ca5efe91bff39135dc v7-3-1035 -b22bff1a6af81dd78f8e9ff0bcded471ab858245 v7-3-1036 -7a2be4a39423e4763ca164dc77fcfd4b27f91a8e v7-3-1037 -6a73ac422c67d7ad4642ae9194cf9d4c832021d2 v7-3-1038 -321cfbef943199e8e967f6354877ca8fc07e4551 v7-3-1039 -b9f87487d93597f69f09ecab8cdca11bef6c09d0 v7-3-1040 -63c9b681c3dba1cfcd2df48085de2453c43855af v7-3-1041 -fa39483a1363d533f9c7897d476bf0ebd1b8f44b v7-3-1042 -1e8952a5a726ddc1458ff40270cd5da16be3f272 v7-3-1043 -0cf552b325b55d417079ad28dff4e27afec5a2ca v7-3-1044 -29b2be2bba0d369fef85af7aa3196f8b84cce35c v7-3-1045 -00eecb2f8e3e9664ff00682d278a2b1e19cc4b09 v7-3-1046 -89bec74fd7936cc425b42f9e882f1f3864b1c95d v7-3-1047 -19d406a8509d9755b05af7d5ea521925b01f0d76 v7-3-1048 -074491a83571596acb6aac6d371140e8f99fbc24 v7-3-1049 -38276cfe40b2069f94b159cc14b4ade47257c836 v7-3-1050 -70600448f9e7f3bff3b8b0c2f2733662bac08ea8 v7-3-1051 -12421d8a45d5597828b8343c31faa79f77d9c512 v7-3-1052 -49f0fcd9762ce5057e4ac22417105b3ce43a35f3 v7-3-1053 -219b2fcad60d27febcaf7251a91be331484b2c98 v7-3-1054 -5679b8ddd8cc0eb004cbb61babb336c3af398c92 v7-3-1055 -21a99611149b0f1c200e001ec26b8b07c6e28c45 v7-3-1056 -90beab957ba9ebeac150bc5a56cf6ad90f53336d v7-3-1057 -66e615ce7f61948a2a4a8615d703a42d56763490 v7-3-1058 -548b889fe3cfbf06ab50de373df5e65f52cb249c v7-3-1059 -cb5c1e37ad4d4811e5fe178f14c523b178da81ec v7-3-1060 -18ba89e06fab93e8cdf7ca8dfbb34b66ff9d61d1 v7-3-1061 -e4e48d4ee0409509d56f7d654b77a35133283bc7 v7-3-1062 -4157fef7b95074cac55977127964adfa883ec030 v7-3-1063 -3857d399ab41ee8af64c5307c27da64b01e0a233 v7-3-1064 -07c534fe9b6cdbfecfd100b7e01f894d6708de1b v7-3-1065 -4c46e1487c634997f4701d8e68ba9ab019f85227 v7-3-1066 -52a4f66ae1f5695426de21877b2954d11ad8a4f4 v7-3-1067 -59e6c2bd68e38244d2133fc8d76bfc9c7b082d9f v7-3-1068 -6ec3dada4ad3c7e2551191e598cfb6d37bedac36 v7-3-1069 -c316a30a889217be4158fba900c85d9d44ad3a1b v7-3-1070 -857f6c53f1172ed836d44f105f6832973369bef5 v7-3-1071 -9f502d8d5165a79b361ad6048e84c278e1397f88 v7-3-1072 -f10f63aaec5c08e6f3b1b3abdef6ce3eef1cff6f v7-3-1073 -b943fd24c351141113dba360bd1d1f02b38813f5 v7-3-1074 -779ca415f8e142ab5ca74f95c8f732d1f00fb7dc v7-3-1075 -93b7ed814bec8a9a0b43138be7500b948d48eb92 v7-3-1076 -80b0081824fa3084d0e12f0b21f6e504b4e5e076 v7-3-1077 -0dce3d812e7acc74c39b3d87d8bb5b3a4dbee878 v7-3-1078 -bce2051173f01564805158ff669255359953fcad v7-3-1079 -7a35419393c36edcb710602edba31d5096d357d0 v7-3-1080 -9e7ef781d494694a36e056631dbd2c4357ab1090 v7-3-1081 -2d15582e132f62aa37e5eea5e837b3824f148dd2 v7-3-1082 -b3c59716e7001ab5127c259c9fd3552de0d36d53 v7-3-1083 -05d57d7c2d5578f1d794151be9cbb5aef89d821e v7-3-1084 -811a4c9b51d808cbd54dd0bab606d7cc1cc2e412 v7-3-1085 -c1622ff9ed8d984604a47ad0805d3fc528452bde v7-3-1086 -4d92b873acefb69e112fd73b642bfdf7979f1355 v7-3-1087 -2f51ee8825dbeb31713e635fd8d77ef77742ad64 v7-3-1088 -79522bb1712556183073b148e085d302967d7260 v7-3-1089 -8db697ae406a8ceb05f9fb8b45a70980904f230a v7-3-1090 -371cc0c44097772ac13e0e3cb59350c6be52257a v7-3-1091 -9d97a0c045ef5c86652c7fae4d4cd5752bcb42d6 v7-3-1092 -08fbb1ce1bc56e3884c5d35106df31a9cae1f954 v7-3-1093 -efc4fb311d5d45f6320b9d17ed47d24748335bcb v7-3-1094 -ed4e689bbea1c45a8aeb808b526dfd052470ef20 v7-3-1095 -2db0050523719e39f17f4bd855310bf5688155f5 v7-3-1096 -0c25fa1dfd97721cd4c92f4e7a9a524a24f3f43e v7-3-1097 -26f2dbea7443f719c854c7a1fc35dbacdd129307 v7-3-1098 -542af01979be709a4763eb8b9cc1cbcfaf584838 v7-3-1099 -bf917ee1fad22f643d7ef1a919b233f07fc1fb3c v7-3-1100 -761e42cc79c2560af55ebec0ec1060f547e64577 v7-3-1101 -1c5da99d1b708b7af2928e7bc0d9d57935872958 v7-3-1102 -832bf8136d86dd17489d962cd2d7316d7edf5087 v7-3-1103 -fc4d7f02ea3ac731a9717438c72aba098b117e8e v7-3-1104 -a804309e7327f0ece015aace3c855e7987f0ac3d v7-3-1105 -ec72bb4a0fc2e7f0d517cb12f784770cea9cc19c v7-3-1106 -bd6bef0bd0fbeb79b440e429f5e077169388198c v7-3-1107 -3534e9b4fa42b392399d66d08a1dcdd230accba5 v7-3-1108 -450e13fe16211217f32bc57c3827f439540398bf v7-3-1109 -3849c811cc0bccbe09a559e2be5fec7e810510cc v7-3-1110 -43de4ebbe7ad009199987337b864240ba19bfec6 v7-3-1111 -749e2b2755d59eedd6fd28e7d9ec47523b722be7 v7-3-1112 -0798b096bab3efde994f0b50d6776ac72ca0f41c v7-3-1113 -532c31f9e92fd44526d02d26c503a15c1c1c78c2 v7-3-1114 -3f2319a953b3c2fc8cbe9ae9225080a5b30a638a v7-3-1115 -66a9e8fa6f45ddd8dec5b98c193abc576330e4d4 v7-3-1116 -97560c16ca99a1341f31d88ed9f508d777647b5c v7-3-1117 -6a706ca7a889d27ecd6b671e31dbe28ab6b66f28 v7-3-1118 -a62695305e031260557ff0cde6eca1db5ab9e3e9 v7-3-1119 -d1376091d18b5a742ada87bf825d20e99ccbef19 v7-3-1120 -4b9503f0c7d3d75d772c2c0dbe19616da2480749 v7-3-1121 -7793e737ec8723a18d4c5468b33a895249ba4f02 v7-3-1122 -77ecab3bb2078fe525602172b35c2031c819ade3 v7-3-1123 -be1e4acb30cab46ab439e45b9b6871a7aff23800 v7-3-1124 -96f3348f9f119a996ae8826ef4d5a06c3f7e677f v7-3-1125 -b25a1b2e3175902e49a69e8d9ccc5c1cc43fbe3f v7-3-1126 -532a9855bd30d28cc14848ce5136658a273bc999 v7-3-1127 -47906f888725760ac704668b71057629e266e486 v7-3-1128 -f824cb97eb922975cdc1025f3c2c62f1bdbcfdd6 v7-3-1129 -ec24ff78a79c1851d8003780035d6c55f98dcceb v7-3-1130 -82e6588762e4aee5b0f0cd51d5c124ebfec6424d v7-3-1131 -b20dbf3a5370543ffaa1d6fc337df1969843477e v7-3-1132 -03375ccf28a27ed72f6cf347383aaacbd1a51e4d v7-3-1133 -531e598651fc6a7c28bc808d82c09ddc1759bf4f v7-3-1134 -e4bc21965079eb6948d8e22ad96d145659852707 v7-3-1135 -343d09006056ff408f08850317b8e8caf056f5fe v7-3-1136 -c02c7df9bdc91ae08ef626d4a8262fed47285c41 v7-3-1137 -47222d8b1e94c962f9daf6c2ff3f6c6ddcb71613 v7-3-1138 -3b5a023a45434e825b8dbeed551cf7f4578243f6 v7-3-1139 -7fde662e1db24077abbe26e6d78c286928f5c9b6 v7-3-1140 -10673b3531ebcc18467d04bb806036cbee1b8e2b v7-3-1141 -65cef998f860b3745880622cba74135bfa249ae2 v7-3-1142 -66e849c4558aca6c522026882159b41994d0c0c1 v7-3-1143 -8360a59aa04b8668e377a66d1fc46e9e52b35110 v7-3-1144 -a30e3762957d61966152040315d160f860433576 v7-3-1145 -e3f9e33fb28c367aac7b2270b6fd304fd755b6d4 v7-3-1146 -3cd3cc1e91193a0b45e6aff1373cd4802e595a16 v7-3-1147 -220bdea4f57919c290d92b1f6c83a7252cd660b6 v7-3-1148 -66803af09906a828b9f41d7ae0f7a379137eaf99 v7-3-1149 -3dbd251777de232c168d87650acda5fec408146c v7-3-1150 -4d7e3df04256790855f7a6dc289f32ffc04da133 v7-3-1151 -9909e44879b9f80679fd05af19a423b2673b2301 v7-3-1152 -bc3f4804cf470cec5773d8842743efb760f69102 v7-3-1153 -6419ee8098c80f0418081c73b790b09c61f13c3a v7-3-1154 -bf1e6326df1104cabc04b8490f9456dbda901fd2 v7-3-1155 -8c4324e6f4779ee316361511ff783f6344750be9 v7-3-1156 -2f1ee97f5f23a5f9e1c572ed4afb50fb79ce7a35 v7-3-1157 -46077370bc605815f5e41cbfc925120a913acbaa v7-3-1158 -208a6c04e6b8221c1f5187391d86c5b57e61445b v7-3-1159 -60301d4d16827a961019d72a78e811f41326c680 v7-3-1160 -ff393592644960783e9a1c7c7959a8cbb0954673 v7-3-1161 -b8eabb6a96871321bec8526fa04ba1ff1a96780e v7-3-1162 -70b1178dec7919120632cdeee6056e38108356a7 v7-3-1163 -4db0bf9f1b44d1f0d42a1863732dfaef73c9971d v7-3-1164 -05b8436873d48055cbd24f043548092755d77be7 v7-3-1165 -d59ff2114733a526847ea38d093897f496f73ffc v7-3-1166 -81dedcd648216d6b3fc6b967368fef23d8ee1154 v7-3-1167 -ed47632fd1498d50e31ab5b30aac403de3db2496 v7-3-1168 -a83fb2bd8c8ea8865f460f7d82d8ebff8202cced v7-3-1169 -14c2e63caec65cca0d315e82f90b5e1d84430487 v7-3-1170 -fc7f985df53745d157182585b01ee5dadb722a62 v7-3-1171 -96e154e825a7441274a615e7d7fdbe68e5534ee9 v7-3-1172 -b584d361e7461c79728585f16f408984b0234fdd v7-3-1173 -52850ef928f85755f005267c1f02fe9e9f898c99 v7-3-1174 -84a8d1ba81c393dcc3a45eb3b20fb6ac5f18df7b v7-3-1175 -e48cabe984537b06cfa945926844c4af96799331 v7-3-1176 -e79a20f07daa91051435208887cc31b245555046 v7-3-1177 -c4d4f0fc12b9b8665d6859680155797be960c36f v7-3-1178 -d84833983de7708de27774e3f01e7ffc8c03eec6 v7-3-1179 -04b8912a9c85e72728a2cd6a4f8e6aee82525b31 v7-3-1180 -b7bb20390111b75616eb66558aa9517901eb0144 v7-3-1181 -fa98c2b030ed5ac8d8c8139405d20ad6c611c065 v7-3-1182 -044d23a64c177549b4b5e3183642f3a5b286d14f v7-3-1183 -9e36c6b1ebf4554a24bd879965f348b81ad5ca6a v7-3-1184 -6d935f45c489b346f06aef5b1bdd87cb98b8400b v7-3-1185 -7b8991e084f9bea2dde9ceef7a245254d656b6f9 v7-3-1186 -fefd8d33a7ea43f86d6e5a2ab30440140ada14f6 v7-3-1187 -6f7ed9b799a3db282f0fc076d8232752716a4e00 v7-3-1188 -dc78a26f6f64bb1330b9027559ce0c8fe54ba1de v7-3-1189 -25d64a4edc0b0f3f17330a7b12f3c1ca141ccfb3 v7-3-1190 -4c42efb4c0982d305ec9ee99bb3bddfaeec2cf87 v7-3-1191 -07b9c48a30e973833ee70d38633934f6fc2177d8 v7-3-1192 -8b46c37c4b843039e5a543be98978e79ff6f3d31 v7-3-1193 -91136a41f83f3716e7ccb4f2402216ea215a4acf v7-3-1194 -4837fd61be52d420c69fcde0621cd5ecc298d2b6 v7-3-1195 -56fbf60e94766a202ee71749eea19a862695c92f v7-3-1196 -2fc1f3346bfb3229f35455101a5944e6785a02af v7-3-1197 -517fa1a34c7cf1c8fb04d43976ad6c381f48cebd v7-3-1198 -be2973afe77045bd749c63c46ea02f61efa55862 v7-3-1199 -2945fe016b936c9e3a89db48692495c83f1843a1 v7-3-1200 -d8f65e6238fa2bac706f1a4868e8d38ad71ded64 v7-3-1201 -1707ddb6f5aed99b69fff8a66dc3eb8ab40d7f46 v7-3-1202 -ba328b4a990ee460cc907ec59aabee8d872b7768 v7-3-1203 -0792cc5133ce1f37ad9e1d49804100b28d0a391b v7-3-1204 -d02448031708fca0df590f46f850e33acc9f9651 v7-3-1205 -8dd2769ab75c07d88feb49d1dd489a1282854217 v7-3-1206 -6ae32a64e153d7275058d965e0c1c12d106bc7de v7-3-1207 -784e342ddcaeb260ffaab5f0dd30ec5db832842e v7-3-1208 -afb00cc8caacb8969705ffae0316bb9c01156e7f v7-3-1209 -7155782d94fb88e47e252b159dd677c31a3f14e8 v7-3-1210 -1cf02fbe6281c8efe63f866470b6c44d5835125c v7-3-1211 -81e623ff2e554695c372b7b06bd826c6298bb8b5 v7-3-1212 -ae05437a744a3b6f87d6f3304a19e5256849bb1c v7-3-1213 -bcb84438bb5bf27101b25ffb2c2267ab6ff0e946 v7-3-1214 -8bbd0ff486b3cfa711e0a7f305b4a0241bd5dd52 v7-3-1215 -b89aa3374b7fe64968421f4e20cf22cd3e95713b v7-3-1216 -613651492c1905f62cbbcbfc616d7935234badab v7-3-1217 -d10ede931224a9818a98a58bd9382f77728ced1b v7-3-1218 -eb5c3508cd7da14f8d3337ca4dfabe4122ded20c v7-3-1219 -ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 -9f7b92f232d31450fd04ecec3e89b027c0f28b02 v7-3-1221 -07831d280e90a87ab9f42a9c96775ef2bc0cdedf v7-3-1222 -5cd32322154c1c5970194eb5300eec2ddb8ccc30 v7-3-1223 -0a379dea13c97df4ec2ba1487dd50c1e8ba0c912 v7-3-1224 -27b008d5b7ac5fab02c6934b87f258bc4715aed6 v7-3-1225 -b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 -5cee875f30961cf1adadf386b7e2764ea8aeeb64 v7-3-1227 -620d9b59d4ed9deaac614c707c71257907b1dd21 v7-3-1228 -b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 -f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 -537bbfff0c5c0bc2307a85133f59f07b00c55e41 v7-3-1231 -a594ce86b5eade96cb84415b3b027abe611c2238 v7-3-1232 -4ed713442c51625160cd0bca612d9a3417e4ba14 v7-3-1233 -f4969f8f66e974584e8e7815d0a262c5dca79638 v7-3-1234 -9ae0fe46777674504e0f372e68cfb8e0be81b2ee v7-3-1235 -39980afcf54aafdb9255424adf5808af45ab2242 v7-3-1236 -5b2c8f3b390632e1e57a3839f040146f6798a969 v7-3-1237 -048c69ebe8eecb218320030d9ea41fe4f6290848 v7-3-1238 -e130cc3d17af412971143b8420d6e7b1cbd13ff2 v7-3-1239 -bc9125136c69a4feecb4b68912fa04380f42b77f v7-3-1240 -c8747604696795a300f6ff05091813d691f9a488 v7-3-1241 -b4a2eaf28b51327b4e56b4eacf4b5d72a52560f6 v7-3-1242 -8a7d3a73adabaad5e9fe079acf6431982145c7d1 v7-3-1243 -b4a71dbdb78790ca423103ad5deb71b1df9b5b04 v7-3-1244 -43329b2b5b79ed2e1017869ee2e0b1caeaf2f0f6 v7-3-1245 -a1b41dabc682ed8f8770a12c2d3a227eb348885b v7-3-1246 -f451d60ab8ec56d02a7b5f2d5c16187566279886 v7-3-1247 -3717d569027d8ec8b62e42e33f91333ac22ce6ba v7-3-1248 -b614332f7df2f6f471bb4bd93767becd7844b90c v7-3-1249 -6aecf486bb347ac6885afe36d62ddbbf2457f898 v7-3-1250 -788f4802967766b7f3d6dce83cc027baef422f4a v7-3-1251 -875a0aeb301c3fb2be8a79f2d82e324d80caf4f3 v7-3-1252 -d6a7dea44a8667d834e463b8658cf85ea938112d v7-3-1253 -5eff37e92f03771aee77a3688d79a73e5b6107e9 v7-3-1254 -f8d307ebd74a4097f7083ea8117be0433f00c7ce v7-3-1255 -322441058afca6a8aa52d34eda9fa307608354d3 v7-3-1256 -5751284311f37399cb7a66d99fe317de4ae86ea9 v7-3-1257 -c9e2ccc53f2e119e247da7fc9111b6b9c9385d93 v7-3-1258 -7ab94cb688bebd694109442be4dd6edb6ebe3c85 v7-3-1259 -7aa4e0822dec0840770d9f41052a772a887cd213 v7-3-1260 -1cf89d38aa7628b55f1a45a5325adc83abe85dc2 v7-3-1261 -5e0b6a9282df8b9435da372cad77482f1f5b20aa v7-3-1262 -a02575cd564ade1019ea89db07c1c1d0c4b5418c v7-3-1263 -558c815e1a38d7ac2fc61c4155aabf8e81a14034 v7-3-1264 -53c1b30632df47993bc00947078dd31a226c9a97 v7-3-1265 -bbe4bd64c68c64afaa6636e8c3e9a9a6241e91cb v7-3-1266 -cabdcfe72dc398fd67bbbe02cff5e11e4dc2506e v7-3-1267 -72fcf674e545eb87bb4ea996df56e4eb7c04f6cc v7-3-1268 -350239b0e9eb063d9f84dfa4bc7a2b47d78e9afb v7-3-1269 -35b6fc57a2868b235284d914820da0815e62d54b v7-3-1270 -034abed357a1a2fabe624ed59ea49ebdec09d790 v7-3-1271 -a00cd1839ac4f3467e1e51e619b4c65ce4e0ee81 v7-3-1272 -30910831e5b0f0eb28a8eea7412f5ec9f3533ab2 v7-3-1273 -761cef8f5d1d42e315fb85765ee90857981fec06 v7-3-1274 -8875401008da99a39878478a293f833f68481ffc v7-3-1275 -d2f9f67924e77ec3d90164dd6ff2e50c5107faf0 v7-3-1276 -6a7ae677d6a1f116b685fa0f892052e20003eaad v7-3-1277 -cf52d2a8c05cd037c049abef0f58fd918146f3bb v7-3-1278 -cca600e6092839efeb3795db863916959921bb0e v7-3-1279 -1cacf785299e771ca463c493c8c870e395c09cd0 v7-3-1280 -19ed30f7cef76224ef39ceadefb64387eb986342 v7-3-1281 -22ac43fb6d30ad1097d0c7e8937b28efcb162137 v7-3-1282 -d6ceddc0be86e46a5a9a696e36c54b9d133f2203 v7-3-1283 -7b20dc8041645778eeb2f7823a4c1c647f735d24 v7-3-1284 -14e7a115d54d2c095f31ccda2d04fbcf775dacde v7-3-1285 -6ddc1785c4ff3779c18f5c313da591a052388b2d v7-3-1286 -34c629c3b4bab5fc755e83869d929f8cb322bfcd v7-3-1287 -8b7baf39a345aecf00a6116b5da211b51c6e3457 v7-3-1288 -1ed945570d47e9a60694ed1ef3a5b208243657e9 v7-3-1289 -08d4c11cdaed2c5d95e2c0be3b0df91d01f52b84 v7-3-1290 -a6ddcab6a240d22f965c4961bb93ddfea6a74c73 v7-3-1291 -cad8d29b0bc0356a49a455296e5e79eb6f38139d v7-3-1292 -18b43970fb7a796ab740e65baa4ff2ba46f929a8 v7-3-1293 -11d0c6df1d7bdc399b34a8cc70f354d6ee908661 v7-3-1294 -93cccad6a26b439728bf3c155ed5532001a2f2ab v7-3-1295 -c3a82208e143e4cd4a3b9d9b1716eb9d876bf462 v7-3-1296 -cb0a5c9c0f9bcc6c5a18ed97762206309d3e334c v7-3-1297 -dafd77a15d44cced4e405a9fcfe67fc48a02004a v7-3-1298 -f063be86b6323f396e6d3a7be73e860e636eb51d v7-3-1299 -56bc3698f8c6ac275a9a05b64ae056de619d226b v7-3-1300 -6cabac58f26fe9d8b608542d9fdbfed3fc437c90 v7-3-1301 -5569d11ef585033ef40e4402cd6a52453e4d13d9 v7-3-1302 -6e611380b4cf586f210de94d92a4f158b6900a5f v7-3-1303 -46d6318d5b965b77278ea252b25209468214dd2d v7-3-1304 -6f24376028af97c93b426cdbd46379795be7cdfd v7-3-1305 -71859e71b1f902c28b8842bc7092dd155b8c7f88 v7-3-1306 -3dafc80e781b8d5ed12d6107a2c804067aeafd90 v7-3-1307 -71e066e10a4789eeb9553aa08f9ca8e7eec96532 v7-3-1308 -a686295448918b7066bc52e3fd9748e6702c2219 v7-3-1309 -b49784c49d537fabe083cc3f8cc460629bb6957f v7-3-1310 -28e6f5f889683fe161b7bc260bd02b742157fc5b v7-3-1311 -80bab8b1a30db72b7eda880b0442ab0b0f4a1611 v7-3-1312 -afbc9dd67cea81e73d64f7ecce47dfcd35d48865 v7-3-1313 -29e57603bf6f3a2e3c178a63d332ed4d2eccfa82 v7-3-1314 -6ec6b7ff2d43842d04a8d653356d0ff3850707c0 v7-4a -0ddba00c204d855c0b3da30cb338d9bdb0ded847 v7-4a-001 -d0288faf3086e6ccd5046edc91f1baf21bf1babf v7-4a-002 -b5abda4e7c4b8b04cb823c160c47097448823ba8 v7-4a-003 -f72d49c406c48293e30d774303493e4c8d120bfb v7-4a-004 -7a6ce0c426fec6051523bb00e050b826fa664beb v7-4a-005 -6b6e1786c7dfb2d1190373dfddc3cd33e5346e18 v7-4a-006 -c624928fbc49408ab932e5c79f5f79e53327d700 v7-4a-007 -b3bd43ef012d975cafb7b2a4c41fb78486ee4cc0 v7-4a-008 -467efeee8f9e2060891bc718e6aeffaf79eab43b v7-4a-009 -a4e08386a6aa29c5e58302f1650fa2ad3f03b76b v7-4a-010 -ce587b26b8d6bec140af41712bb99c4c73c3bf99 v7-4a-011 -fca6ba0d2d66d38da8ae023e73944a69662c0d66 v7-4a-012 -42d592dbbec3706429e3f3f75c9c394db6b9c1bd v7-4a-013 -08eb573821869727e5951e6586207dfbe5fd982c v7-4a-014 -7a1b782ec64ac55052755ed72ff023093b246d96 v7-4a-015 -4104bed69ea561a105c3db590aa6c75be2a24836 v7-4a-016 -4cbff53717d4920cb64d417c7a603b45519138f1 v7-4a-017 -c6dd0c545e5ca25e0b45fc1dbd7d1cb20642830e v7-4a-018 -bea5eb942011c09a6a8805e6b21079375462a710 v7-4a-019 -fa76be660fa914de79e3856caea8261cc7ab6c5b v7-4a-020 -fc6f4a653265f9e6b3dfa82faf067329dd5044a2 v7-4a-021 -c28202427d71b4460122754884bb548f084c3d7a v7-4a-022 -45b2278e6f461689d068f138428e9f3fdb01615c v7-4a-023 -ba9a11fe25637103e1a77fefbbaed4ac2ff182f9 v7-4a-024 -1b89e3f916c59fbdfdbd31e4d8af8b22274275b2 v7-4a-025 -b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 -8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027 -7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028 -2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029 -bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 -839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031 -2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032 -fa024ce48542356206bf86bdc9286ecf0510ad49 v7-4a-033 -947edb6335d1e196c27e2e7e0e0a5ed8f6b78498 v7-4a-034 -4ceacc1b00548c0b21c0dc2628608515899df721 v7-4a-035 -9982ec574beb1866536f0e8a0ace3073faa3bb97 v7-4a-036 -91d478da863e0779c482c790cc96b14188f3ecaf v7-4a-037 -8f983df0299fb4f1c7359eb3b844ee93e8f7e8fb v7-4a-038 -a08fa2919f2b39be0416109d87a42fbb5880ac76 v7-4a-039 -1261caf9bc5193d304140647c08ca5b52120ce52 v7-4a-040 -74d2f3188cd0aaa0d3d7cd3df001d88b04f77f5c v7-4a-041 -1899acc5aebd40f625b9fed7bc4c1b5f67e5bc3f v7-4a-042 -6fa64615c8d38ecf464702b102538c09fe250813 v7-4a-043 -647596ab1ae2f4b36bfc20293adf4b3a43372818 v7-4a-044 -da95a7f1d5a8413ae719188cec5b706b99db4a91 v7-4a-045 -f0361e297d9ceb533a17530647b4482c3990df3c v7-4a-046 -8c6615a30951fb9f2d2b218e55626f5dfa3fa24e v7-4a-047 -09c88160095d98a0b1403e9230c76e8adbb75d59 v7-4b-000 -47a09a572ea670d0498983eaa6ded5ab4f12fd15 v7-4b-001 -2e63b6c763f7af2ef11f751d3047847652dddfe0 v7-4b-002 -ea876fe914833a69018c54d6927dbbdb42ce6ecc v7-4b-003 -3c6e2b89875f39c8417021aa369695ec1ba762df v7-4b-004 -e63e4b4be9236c2d811b5ec7bdd79e387ec8bac9 v7-4b-005 -6b7ab6a4f31a54bceb4e7d6f0f9404b5a37bdad3 v7-4b-006 -b882d4b14e00af23444fd630aae3ac32214dd097 v7-4b-007 -3059c799fcd997ea60a63ed10a2a09d73e3ed3cf v7-4b-008 -cd971e951b0626c253059d8e25859032560920a6 v7-4b-009 -585b623a1aa3baea87a1584e6064612b2183d312 v7-4b-010 -7d1f89b2710305a00e6adac35a1fa6edd47982ba v7-4b-011 -25f67b62afd8c58b6c661961cc762f00ee89e562 v7-4b-012 -1ed6fd19c36051da73f9987777002b331853f5ea v7-4b-013 -3ddec3d25bd178d4f90114bce9ce889f3889e6d2 v7-4b-014 -d96f16667cc48d89c380fae29d86286b20040d5b v7-4b-015 -ba37e955913e85700677b89a720c6e5fc8d23cc3 v7-4b-016 -8c42772f05438e9f06200bca731cf301097be8ea v7-4b-017 -7ed1ec814dafe8109a2f34302174267d31bbc924 v7-4b-018 -74a211a0d3a3135dd67329cd981f5100f5e4d064 v7-4b-019 -46cf49cc9289920704999a971f397eee1efdb3fc v7-4b-020 -059c8a4b103f6971276435127c7ad970a81b0b2c v7-4b-021 -d5d6b78cff090e87d52924179e44131b5ba7436d v7-4b-022 -359743c1f59af353454dd80a26d9f8c20ae6ee8e v7-4 -3e9107b86b68d83bfa94e43afffbf17623afe55e v7-4-001 -e29f11399ccec9215cc8cfab1f9307dea0567d70 v7-4-002 -560a6a2329503d483db019a88cacc3307e5c30b7 v7-4-003 -f6247eaf4e1d556f782321890d725663f74babe6 v7-4-004 -3640cf4c0d4b6e5687bb7a31678fab70c88ed94b v7-4-005 -2374a05efe20287d55bd824689a41becc7662505 v7-4-006 -4fe1dfc7014e57b4beb5a01c9e94357265d19a92 v7-4-007 -b04bdb2c5fce70a278d26c477debb65a388da0ca v7-4-008 -8b5d80861c5e0403ea9f54ddddce2752a463c8a5 v7-4-009 -bb358cc41d920983629ace62bcf26decbf06cab4 v7-4-010 -54e66395831c1a58b4a9804e7884e505842157e8 v7-4-011 -8e28c23e482c5b3c8296d8022271822886793456 v7-4-012 -07737d3aa81725672796cbc9a010d63414ab6fea v7-4-013 -9801d06e7b4ccdcd02cf40bee34eaaada0ca0409 v7-4-014 -a7478f9f2551e95bff138cd658f7a86ced804ab1 v7-4-015 -8d5cd0ec3e7183a289f9bac41d3981307cdc1fac v7-4-016 -c47c8cd5fe5c014c141d9fb3fa8935b268436a4e v7-4-017 -460d5be9395ef3e05f4b1397ea98a5b54d825fc5 v7-4-018 -d5eb32dc231cd870c562e7b0be96fa994b505d9f v7-4-019 -c1ae5baa41f47bbf96be81e0158707a88af48b34 v7-4-020 -c514693882b9f1c7be2e76a0307926df799da3ea v7-4-021 -965044860b7f4884657fcaa042853238c7b13e69 v7-4-022 -09361f13580b075b6e87707c47165e8d45ee98a5 v7-4-023 -00d61a47df66cad21b80c6a683164e8d19180045 v7-4-024 -9085d32d7424963013650805452ede5dad22211c v7-4-025 -6bbb2ae990c92f6858b86c047e16dd12183d4273 v7-4-026 -73cc7272de5e0173b9578f715c4794a8b3803bce v7-4-027 -923738744a60e5e0bd2d9990758a2169106807ca v7-4-028 -2d3fbc68b3a84ad2bf4d58c77244043328e3fb81 v7-4-029 -0978e99043d2a9faedb1a3bad75b59121c270bde v7-4-030 -b21b5dcdca2197fc86b9bde77bd6777f0e2d5175 v7-4-031 -71e92a1cb37db719d6406858a50ca3bdfc9881fb v7-4-032 -91f6a28e010d49ae73c13c85dbb8b14c9e5edb36 v7-4-033 -22dfcd1494e4f7ea8ddc96e8dd895482e77e3b5a v7-4-034 -5481f188dcbb7143596f2d470c7d674bf36efe64 v7-4-035 -90e2f0729a0df249931a2dbe5f4310ba6c91cab4 v7-4-036 -c3d379c2a115b957d82eaa5f2215b688f36a22da v7-4-037 -6daa78b6b99a2ec07d20336db47c9f8165098062 v7-4-038 -4dfba3df303c51fe31efd1255338e9fcbedc5401 v7-4-039 -8336fd924e057d8c797043430325379d9a3ae37b v7-4-040 -408f2a1a953feef25a2c5c96352c82674655e797 v7-4-041 -70915ede509a737ac78c421f43c4447c9682ba41 v7-4-042 -6d11572e2c8b1117b90adf588ff1467b185c1b57 v7-4-043 -c0e3990aed3f179ef006e6de1458e9818c9ab896 v7-4-044 -8ced827b2e8ba49f9ae0da2033670fee83e7b55b v7-4-045 -68056d414f09fccb39219d7fde77fa06769ffa3b v7-4-046 -c21b2f52f1dd003d860e3b574602ed3fdc2b4f1c v7-4-047 -31c9acfeda8f1b84d51a480c1efbb56f384e76b1 v7-4-048 -15c1b8a20da6d650ee3ed0e73c2e3832093b60dd v7-4-049 -eb33cadafcabfc9cb3fc0741e169e84cafec11f8 v7-4-050 -e7a2f217a385e6aebfddc4d29182924ac017d262 v7-4-051 -b9c1c1f4cda9b82a2e703feec441d865b4722d56 v7-4-052 -733193bf24c3a80883c60964922c7cdc83662eb2 v7-4-053 -7b760cda2bbf086ba975fd5a4bdc6190a0f08caf v7-4-054 -38a755adc58063894c6695d702cc37f4910bad14 v7-4-055 -8d83c219fc7b2ec8685ab9e0dd7d3067b7f9d1e9 v7-4-056 -3109053ce4e3d17ca6ecab06c0ea0f38581d2f41 v7-4-057 -fa8447ec582378ca8d2c0245bd4ac195876abf2b v7-4-058 -2a72805a3038285c35f47dc0327a57cdabbdf09d v7-4-059 -46ca8fcee5257cc036ac928d91b2a490cf47a956 v7-4-060 -739074bdceb85d16b9e70791d91a59c2b846ed8d v7-4-061 -d59a0b8e5584c6e093990abb1b1e640aff7620bd v7-4-062 -9cedb4dfd4c830783ac65128dbbb118da2e3c638 v7-4-063 -d062239654688774d38e60ac42cec8ae1fd0f14b v7-4-064 -7f341db39d5bee0a9259a14a65e19bc9efa65417 v7-4-065 -38b948f534e4646bf879cb4d30151474e093d139 v7-4-066 -86bf09a1b6d0275131caf7ffc51598608e7242de v7-4-067 -efa40be729c2c94c1d8d0bf95000c4a7d2976dbc v7-4-068 -878ed73c70706d68bc7175343e4deb24b11963c2 v7-4-069 -e6f3f66028d448bb49ee2336cee60b13ced7cea9 v7-4-070 -faf7e86203b5d5c98bdd30dd92524e5062b2412a v7-4-071 -d563839a9be0be6e85d93e366b4f7ffe705d8e3b v7-4-072 -d0595545e98a3b7b6fe1a96ab0106d8afd63c31e v7-4-073 -9818311eeca0d76641879e95143f314e7295cc26 v7-4-074 -829aa8c8449d85d0de3a29ac8ce647ec706efd02 v7-4-075 -8f0c264db1e76a65499f0846d961907d7ecade9e v7-4-076 -53bc55e58fefee7a83a7a56fc7f05e0a4d36dd47 v7-4-077 -5c3064feddd7c9bfef18d8067172335f101122c5 v7-4-078 -6ae816249627b34aee618b49c4169b7ca1f54ff3 v7-4-079 -c5166fa1046462d73891f0b395d6619e7ce96c82 v7-4-080 -42927712b3d997bdba9d8ff5a1199fe4652c5899 v7-4-081 -9c777e2c702487bd0b5c48a22edc17c98b87e070 v7-4-082 -6367a766027d3b60caff43c35d8d3597ad90f6c6 v7-4-083 -a56f60cf683455bea96daf077458158041e4d6ba v7-4-084 -70c3289803b3129f34ffc327b113dcf152222a56 v7-4-085 -60a5b7b82016da631dd7acc6121913d02c5677f8 v7-4-086 -9334c994be7bb5e16a1f9c6b67e1c4342a6a386c v7-4-087 -853a76c7fdedefbc1dfdc2a4896d37a3806500e2 v7-4-088 -6707c44cec61d76026d5dcdd6573fb41cb89d0bd v7-4-089 -31217cc48e7d8c9aca703688d3d04d8edbc85bba v7-4-090 -9502d1caf90bf56f0125c99b7d17ba70944ebd85 v7-4-091 -1b4cb2c6b285265da4ffbe242af35a73e1b118e6 v7-4-092 -33f3e277ceab43179c74093f68196bd370199dbc v7-4-093 -68b5f8abca93dd035ba180aa673a5bbf035b89db v7-4-094 -acbe5414cb7f302f548bc1cbdc1ddb029dbf9094 v7-4-095 -645358801356c7b1c53a1d3b1543781a669a7733 v7-4-096 -93c8296281dd64e513d52db9f745965926df5cab v7-4-097 -79a8bac614c0c565617b404764f28675687ad442 v7-4-098 -8451f643a13eaf22e35a45e6bdd47c8d5b24c222 v7-4-099 -5ad60cd88339c6217fbea8cf4f92dae04ac1c71d v7-4-100 -ec5d11403c1952b2ed192f28afb6261d0867bb20 v7-4-101 -9417f4de27a2a6acfa6b1660ac6ef2b5692e4554 v7-4-102 -4db151014f93b7512919e452e6b3f4184758db7b v7-4-103 -dd7d1a86b311c11e9c03b7ca95c7b62206bbc7ab v7-4-104 -eed95874f30e9d9dad577f2361f2dfed93c5db4d v7-4-105 -de9a01851ebd1ce1d225b40c182b6f1e105863a7 v7-4-106 -064e2a080e2e158177acc017c318bc953fb7535b v7-4-107 -fa31c5b82424373885d2fa55b4f8531ac21baacd v7-4-108 -1cdf517067743dc33ebb9c7af8844abd9d9c7863 v7-4-109 -6e54d1b3408ca745341b0b219c588c265fa52494 v7-4-110 -3fbda56bb2008e2459951f3ad0258ff0500ba07c v7-4-111 -af8217e4ed7e28b797c628f067ebfd4433c07326 v7-4-112 -0e21e2a38ec6df5c4fe37d639906f56f9f445b96 v7-4-113 -6db758f82227989426560c19fdd234b154b54419 v7-4-114 -e35c69ad482370b2685bf1360a63fb27ce8b3819 v7-4-115 -40aff213baff00d43ea8c1b6a9734ccad63a3921 v7-4-116 -805ad8488dc88a575b841589f36c278aaead4e52 v7-4-117 -62c720661f81c17348636956c1158639d59e1e9f v7-4-118 -2f99966971b0556bc302ec809712f5ba3f030028 v7-4-119 -ca0e43bbf8f9e409130d5d1ce29621edbcdff92a v7-4-120 -4bf53c1ef37a5023e06f3c6b4f1c24857b4f52a6 v7-4-121 -270c62fe685ae943de64e1a4ab295dae6f4ccabe v7-4-122 -32e50f85d2c7a56c600a2c36107e56fa9f2952cb v7-4-123 -9faba192ea90a32ee137aa42f5027b098931ddb2 v7-4-124 -45ef9d2096e82d6a56a58606b6811620a61cb1ba v7-4-125 -b14554844756422a39c72e62b8c2391c2d5a2e17 v7-4-126 -6f5a7d3943007afc6bc03c445380776e18787f0c v7-4-127 -4b92012f6b18f56664c268200fb54f1316495dc5 v7-4-128 -1e28c0fad344549665c60c62374e6f511e5aec76 v7-4-129 -cf722c09236098ae585840d62eca68dbf8065247 v7-4-130 -4b23119cb58473ab70cf1a1204d4d3fad83881ec v7-4-131 -1b09d6792520cbe1c94c20f6c833ad57316e75bb v7-4-132 -6a28a9cf51537b81da7e9ec3f70fea55e393b345 v7-4-133 -0defb460a0ebbc954b0f22267cb06e9d210be43a v7-4-134 -1aeb7f4d6527369cf5f9101813ce8f10caf7a869 v7-4-135 -3881cd916014605875de128226b83a24d18afe46 v7-4-136 -6fdb1d6646b6b256623edb05f9dd770eeacaeb05 v7-4-137 -6eb60041548ce42748cd8d7d49bdbf9dd164c967 v7-4-138 -c8c80c9d2e2237fedeadfb1c6856c53c7a5e90d2 v7-4-139 -505cf1943dc238c2383dcbc37a93fbb136e1f08b v7-4-140 -2ca470c6096e3ec7cbbedeb1d0281056b088812b v7-4-141 -735b70faac4a54ca9d8ebc2303ba28d5d18017e2 v7-4-142 -d11f223f4c753889fa8f974f295c2a0a451c653c v7-4-143 -bcf25cc08236c2adc27a4d7d556e11e8ea6ddce2 v7-4-144 -1098b7b6e147cdd324ac665340540922c2cdceb3 v7-4-145 -ec93f50f1d93c4c279606117a9f3eb37301b051a v7-4-146 -d289f2167d702c87493d1934db863df29676e261 v7-4-147 -8507bf8874d816a79411bc74df71fa58b557b71d v7-4-148 -b43363a7b4c71a7a4e20dc21f4906f4595785983 v7-4-149 -15960ebc2ee8539a1f15f660d43df1a502c34829 v7-4-150 -ec02e1474bc2bbfd73349e7fedf62ae45f941ad9 v7-4-151 -2ace11abcfb59f6e88c3a40aa1d849d335cfd993 v7-4-152 -30e300c0b2c1c069d953afb258dba39c50772463 v7-4-153 -71837ace77dfdd6c01e0a334314a7c6c713a095c v7-4-154 -fa53233519c693591ce60f9270cf259c07d6cc26 v7-4-155 -05a5cb0d6b37eb7806eb902a72d8b00dde48bc1c v7-4-156 -be61f315eafe5cbadbd00bf7275e004fe09779db v7-4-157 -d59544f3022ba0a35af174d1085a321de6d3b9b4 v7-4-158 -a95a151402be5155cd89f8758e2e09ca95473ad1 v7-4-159 -f29febf858be9c7df896cc86ea89c3da8823b4fb v7-4-160 -91f3908748c29b0e8e759ac4cdafc95e536eab9a v7-4-161 -477665b4105fa80e3655981790e55fc9babfeed5 v7-4-162 -7db84aadd37aaf9d59f8f15dd6783a4e28dcb63c v7-4-163 -a01819fb6e2b5c270dac492ab2fe923ea9301651 v7-4-164 -c82339d8fdae0d43d51cde5216c979a5c9415bc4 v7-4-165 -5d03c374712128077ac4c342aad02120ed98df70 v7-4-166 -22387c8eec43ea8b1b704cad49c8f7187e2fd579 v7-4-167 -e61a2b709f693eea9108d475b9bab5ed10ac675d v7-4-168 -4e3a9dd25d428e7c08ed401afc244972e27e08e6 v7-4-169 -8122eab8fcdbbdaac62dfbf7c6458cb3e6f46b04 v7-4-170 -beb037a6c2708f539d50840637f70eed0811d93c v7-4-171 -391e10afccf6879dcfab8b28cb1587a13eb835c0 v7-4-172 -233ad7b960d0fbeb224b383918113b25c74ebe35 v7-4-173 -f2c8d86c460d75fec17a0527a2fe93ac7220693e v7-4-174 -6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72 v7-4-175 -ae228baaec2c5eda4cd948382c2bab498d1a34cc v7-4-176 -df3b0b70d8c1d29817597f45d19bb72755f86bd1 v7-4-177 -647e6bb15aa3f864eaf447fe77e3e3ae7e37b134 v7-4-178 -d1c8c1d6403485ff0135f0cf5c1ef07272a07173 v7-4-179 -b1b8b097539a001043d1f0aac4663d6ee358dee8 v7-4-180 -cb5683bcde03796baa7e845fd9a2fcaec3383538 v7-4-181 -708a6a5905217736a2a231e36ced82f9535c4954 v7-4-182 -1e2bfe4f3e903110f27cb6231f6642e721808837 v7-4-183 -9ac2fc63501d3eff92446c03b2822b30b169db5a v7-4-184 -b06e58f8dd3037f7f17145968d08432423ac8665 v7-4-185 -4d12112c5efae071aecbeed1a7196f18950457b3 v7-4-186 -a1c07956171a133583df42627d3498f935e59988 v7-4-187 -136f05449f29388e9023f7934d6344bf4ca61d0f v7-4-188 -0a9990bbd94a7dbdf20ca3f897cdf364c356d228 v7-4-189 -6050f52d7cd8d6f79ed5ee8ef3efff332aca4932 v7-4-190 -40f18a1c1592c8b4047f6f2a413557f48a99c55f v7-4-191 -04c4ef8c0a1b757494500e46400552b135135e94 v7-4-192 -a8650e2a0b5a5936f7d503429180df47df2aa775 v7-4-193 -767103b5bcb05171fc1be0d6f480e0aa39aff731 v7-4-194 -c2e88a40d530b7999cd29218555515bcd282d661 v7-4-195 -1ed6acdbfef55e6e80aea55c8bc52d05f8458bbd v7-4-196 -47a673b20e493db91844999f74aa3724808ac624 v7-4-197 -705f398ce6f58016fae80c945a570721fc989117 v7-4-198 -54b1a90c937380195fad6a52408aa3b4eed6d8d1 v7-4-199 -0559091e6f09b5b96619513639ac14578a019612 v7-4-200 -06e5f65c34d8136c3a9d2219429b7eca35cb3a21 v7-4-201 -22d7af9ff3e5e2b93fdbe8603df2f15155a5976b v7-4-202 -fb24b025c7cf07db79a559a3091db42e02c1af86 v7-4-203 -f5120cbf16b9a9c6e0fbb599a6524e05ecf11393 v7-4-204 -0ace3a24c2a0153f0aaf9b619d3958e7f486705f v7-4-205 -7e826028d3999b6125b4741d45b22a2d0a520679 v7-4-206 -2aa909427e44cd3aac7def024b66e41d0c9d0e0d v7-4-207 -9b5541e276aa56fd72c3bbba85a17ef023c54ba8 v7-4-208 -bb402c49379de97fcd475fbbbbdc5ed41e5dff07 v7-4-209 -420fd9cb86d51a92c4307a746557e81914c6d6c4 v7-4-210 -e90bef2240c8d187da6e8d8fa5007ec5afc12284 v7-4-211 -50dbef5e774af6a998d1798569566429c38378b1 v7-4-212 -e25a04c1c515e6eb32197291472f89bcadfabf89 v7-4-213 -fe02fdfbdec077d0dc501bca0c65c51e56e1bd11 v7-4-214 -f069a3a0f84451aa498c6c22d8f922d1e695e96d v7-4-215 -bf1775553d3bf561e289bbf367d014915d09eaad v7-4-216 -2f225a17c26b26eab87cfb89142fc0f95726ee92 v7-4-217 -ddc3f32a4b2191f829206322d46f0e9c7e365e22 v7-4-218 -37af1e6e91bb1e8ceb89d3ba1c49a04ffd889880 v7-4-219 -1e272e318daaba51ec932be83a2481987a133429 v7-4-220 -a548aae15b3a27a56d814900049785c29c01a37a v7-4-221 -9123b4d3ef05c7434b6f6cd011b63f63a9a4a539 v7-4-222 -4b78922d557c324de6b6a75515fb658235fa782c v7-4-223 -092b8f61021b91024b127de3983d1afb74b64996 v7-4-224 -eeb150c07647b3691d2696a3a4cdb96f6db5a63e v7-4-225 -b650f2db8f9604124c0ddfb14af0c04bd4ae0580 v7-4-226 -b0a9df477096e4abe938f998476e84e77db42e0b v7-4-227 -3ee5808a293c7436e34a696a09ed29ce38750d9a v7-4-228 -839cca5ec18d560e3714065e54ed38b6e812aaf7 v7-4-229 -57ecd7a8c0f052296b41b916eb1ae7f2a9a48b27 v7-4-230 -0a295a3c9e473512ad3b006a0fb752ad43d19094 v7-4-231 -845608965bd9d0b2755997a7be812746885ff105 v7-4-232 -22a1d5762ba3a75984e89dcc47a65498f63a6c2c v7-4-233 -d2286df8719d6e99c743e3bf6ac14d1f9debc84d v7-4-234 -5ab2946f7ce560985830fbc3c453bb0f7a01f385 v7-4-235 -a44087db72386d080e9da870d751daf498004be8 v7-4-236 -71b165a378ad580818f6d497ecf0f8ad054a9683 v7-4-237 -410ef4f1a3d2f4a6ecad9aaa87dae645d1578a19 v7-4-238 -98bfec9ea7608f312129475d4ca0ae6d1c6c232e v7-4-239 -8d1ba0a23588932d22ad37cbd87ae3bbd4bfeff8 v7-4-240 -a63d0cd691dc925283815d17d62f4e948d723a59 v7-4-241 -f084024c0ddbba46aabfafa2996c3f7d13080ab6 v7-4-242 -9f8fa56f1906f4f634cd602a7a2b4f8631faf526 v7-4-243 -da17c7de616e3829e4f59923ffa138a067928d9e v7-4-244 -80421d934ebde183ce545ab8d9eb3a4c2065c169 v7-4-245 -2cbac5608217cdce725a0f04d397d4466a3322fe v7-4-246 -76863b4b48a3684905527dcc688e5a8c4c5e23d9 v7-4-247 -e5f1f2ea0b4a4834791924880f78272ef52eb087 v7-4-248 -0b9a66ea49f435536745be0e0a6154be7b607249 v7-4-249 -a8f3f45896288bd7e0a27e0c28c3cc3457ccc507 v7-4-250 -29eb4c2a33ac701bfcd4d2e2bed7864eba876e0e v7-4-251 -a43a8262e1ceffc393625c53a1ffed9e6bcaba62 v7-4-252 -4901a36479f200b2e6700ad91c26911d92deb886 v7-4-253 -251acc686ca41e4bccb037ef44cd7b486774d580 v7-4-254 -5595506b985a198abae41ab0150ee50b8bf1686c v7-4-255 -afb542ea210cb9fc5fa8c5359bb4814370024b80 v7-4-256 -17903ded5e9a9d49ca73b324657b944f2954d4fd v7-4-257 -e8ffd1e6c8dc62c604d34e879791404bd15cab33 v7-4-258 -e4cd5bb75029d2c1208f3e31ebde4e03b16e8123 v7-4-259 -6bc874e4789a0f912b4fd6b23afecf19d80b1605 v7-4-260 -43c6cd07c8defd8505acbe479c6970764c08e6f9 v7-4-261 -0ea551fa607dc443b97c2fba97dc0c9cb0bcf303 v7-4-262 -af1bb39774f41c28eabd24d80cffc775695bc124 v7-4-263 -00acac0af680c2d8c82db5258474b121a5908926 v7-4-264 -8ec9d2196bee0c5108f2d2c196a660a7f4e5f29f v7-4-265 -8f84e906d454a95d3167678a745dde9de442b604 v7-4-266 -75f222d67cea335efbe0274de6340dba174c1e7e v7-4-267 -1a5ed2626b26a982e307a206572121a557adf709 v7-4-268 -81c26975e8f9dc7435353581346542409403f296 v7-4-269 -c519c446c5488bfd48c93a03efae4ae3e0c1f162 v7-4-270 -88b0571de4327ba5127a483493bd7d46e6a9850e v7-4-271 -00228400629e28384f7f52556c3c119ba0d0a44d v7-4-272 -747afb6a6de437131d9674e6b2bcc73d74863a89 v7-4-273 -1ee3fc5b40ae94c2a7fc5a62bca38d4f730f9bb2 v7-4-274 -8a3117a4887c1e12a1165c9719491f96753787d6 v7-4-275 -a6b59ee633a355095e6473ec5e2a7d9088bfb853 v7-4-276 -373204662d82e894b27ee76bc3319bc62c91f6ae v7-4-277 -b4ce0e1fb5a67d7d6b0bca8eaa3edc2e94a085d8 v7-4-278 -8e9db1f27a0063df023cc05a760fce73255dad24 v7-4-279 -daf7e98675cf395e1ef96f8040567affb2782a11 v7-4-280 -24c90f1fec859b54cf2b854b98c4c9e614c46061 v7-4-281 -6d0a1132dd71c7f55f7ed53fe99e97c79bfd05a4 v7-4-282 -aa99d04fa7e288a8580e3a5d4a9d6433a1572b48 v7-4-283 -3c35ca9666e88a8024af6dab585b8e79ab295f83 v7-4-284 -5cb1828fd0056de3c166e71fbafc67a74c57d7b1 v7-4-285 -be19015ef43cc17825929206790696c2e716035d v7-4-286 -66fe4908b649ba18426af6f69e8ccb01b487dcbd v7-4-287 -7965cb6a435ae1ea331c7c2f8740d3d4c3625f3b v7-4-288 -99374096a76b96d1128f5e6aa1fa92b4ba70fee9 v7-4-289 -b871734bf54ea185dbd2cc759d86dbfbe21cde26 v7-4-290 -b5972833add9de714f4651e26fd9ea63ec4a880c v7-4-291 -60cdaa05a6ad31cef55eb6b3dc1f57ecac6fcf79 v7-4-292 -10fc95f48546f438648b8357062e93c9c2c0a377 v7-4-293 -fdea5ea9afd139ea59dee6bdb3f1675b8b882bdf v7-4-294 -662ae48e7e246a63d38c9f3165b15b62252edaee v7-4-295 -53b87d790574b6d19034fb3390987c22fb928c58 v7-4-296 -81f5a056b2a582c8109da10cc538dc16a326a34d v7-4-297 -156f891d520e93eab5d3ce02784660fb13a3b0d3 v7-4-298 -daebf8ce66089c0c179fb436ceba359ef8d593d5 v7-4-299 -1157079ca5f167bcf8746dfc52ea5a85e6c87a30 v7-4-300 -8cb42aa3c4957a543e5dffe307475dbab969612f v7-4-301 -df141c80ea3a1ffcbf82d05c1314675231fcfa75 v7-4-302 -463ef551e9f62b63ac3f85f1f297b668b14bcd09 v7-4-303 -fed2e0967f8133ba9a44b0701f151c8d88c4896a v7-4-304 -63e7cc62402dffb180b40c04c63ceeb5f53957d7 v7-4-305 -05e1d8afcc5e375bf708ccc9810e2fd1a5a8a3cf v7-4-306 -06c10522d321d98874546b2a4d3b0ae145386f2e v7-4-307 -e3d2b8d83bb30c428a051f50791e454fcbc080af v7-4-308 -88a6e9f33822d33b6c32db578750c6c178c63f50 v7-4-309 -ccac0aa34eeaf46dad4b831461a532fc3fe71096 v7-4-310 -f6f7543043246107075f0d3739c471d51b7226da v7-4-311 -66eead134d6800fd4cf2d5d4b135d300c933f09a v7-4-312 -332a5c2b2956d9b18d85268a724d01deea27ec83 v7-4-313 -4d7af1962d6ce61df65fdc5c86544a61951f9517 v7-4-314 -646616b6ff4defcc7bef0b198b540f6d965a8126 v7-4-315 -0fc665889e8f0af532cb4e3be2f0ff0421bf2fbc v7-4-316 -8ffcb546d782121dfc9d88c7edc6f62421efce89 v7-4-317 -5c47dacf397c1c65d2dfc237b3ff395c66ec3d4d v7-4-318 -a076237d1c3849535681e82946a9041ed5525d7f v7-4-319 -f7bc601823e5c81e2ca412506a42eff9fd790ace v7-4-320 -c052937aae8ca5082f308b8ff0712c7eccdd30c8 v7-4-321 -fd96c55d683d76ece4ba01490d9796c13c988cdc v7-4-322 -238f5027830cad22e17a970483af9b160869cdf3 v7-4-323 -c476e0ac8b406693c3877baffa0e97ff25e59b06 v7-4-324 -1f288d2475488c3f44c7248e99019e2612580716 v7-4-325 -1dbcb23ae7a8b68ddbc28b4feb794c4c1db12395 v7-4-326 -99d8f2d72dcd4b850de81998cc9b1120c8165762 v7-4-327 -01d9ffdd6e6ffb39faf946e13ec63bd7dc31e162 v7-4-328 -018df65085f8990c1407442f8c783d4cee72a479 v7-4-329 -f9fa2e506b9f07549cd91074835c5c553db7b3a7 v7-4-330 -6d984caa0409fd284722c44cb09a0a2b5360bd4f v7-4-331 -8fed02d53b45848b0fff60de13d06858963cfb17 v7-4-332 -8ae50e3ef8bf733c0869c01b5132d02feffc0955 v7-4-333 -03d260a8ea0c0c67f424c387dbe2af5754e5e589 v7-4-334 -8ad2ecd116021ad5c945426e8bb80d741392b780 v7-4-335 -a42ba1e5099290a86cac1a9ac490c49e82e4c2cf v7-4-336 -0206ac84ff5fdce6d893c470e0909d2aed547a24 v7-4-337 -ef83b423ebf7de11c1063c795dd2186a9b59b90f v7-4-338 -fd7110d0c3bf4fea3cfa3d16da6c2a945d327c27 v7-4-339 -03f95f5e311b84653df70fb3c08a9d92cf21b8f0 v7-4-340 -adc4a84f72eb44dae657af713922a6e2c1f64ae3 v7-4-341 -8dcc6f142460b2d5eee119a174d441d46d95cd99 v7-4-342 -539ce56d8f35fe2deb5c4f57335e1adf97ae4e74 v7-4-343 -ce284c205558d103326a4c3f22f181774690b3eb v7-4-344 -ea2c5dfee1b04d216ebf992c5f46ecbdfee2854a v7-4-345 -3248c6e40aee01a7254d111dd846c6ec7889a804 v7-4-346 -a162d41f10e1c3c8673d86d8b0c58fdaf1bddeaf v7-4-347 -0b7586868f6da0372af7510650240e22dc1e6e64 v7-4-348 -79950dae1d7de8fc2cb0f8ddd087d403e2b9ce8e v7-4-349 -ad005d0114c1d2d83490787ef7ea2a3c6e5e7b9e v7-4-350 -f9ec944e4474c649faad642797ffd798a7102549 v7-4-351 -b4962cf3a1c06a1f60f1d750df8fcf7035b00b99 v7-4-352 -d42a1d3b74d40f580359dbd139d2d0dfa7235252 v7-4-353 -5deaa4e9812d4b4ae59d8a3e70bf19983e07e6da v7-4-354 -9a4efda75b5ef0f496d6a29c0a4dfcc7c03412f9 v7-4-355 -34465a179ce21c827cab4c65a75e6b490600a96f v7-4-356 -4eedfc4911a1db9c4874689f6c652be0094838f2 v7-4-357 -771b97ba3b4768c77f2070423a93152d6977f012 v7-4-358 -182c7b987283a567121e9c43d831779d1c88645f v7-4-359 -761687c6808f4c9c80d33a919a6bb506dfe9f674 v7-4-360 -a97e5b9dbc26800830e46cf3c1aa6efbfe258097 v7-4-361 -7fa2bed947fde3514a700c96861a537d816d6fd4 v7-4-362 -ff3816167b73fde35017d364b1a820014cd42e76 v7-4-363 -7b324826757595b21b0410a7b6f00227d73c655f v7-4-364 -4625fa27ba6f5b06294675b7f0d1bf8ae8f249fb v7-4-365 -ad775b58706587b6acfb0bb2c732e184efe4f778 v7-4-366 -bdbe2037066df6a463346be1768a56d98001fb36 v7-4-367 -021e16be3c026c9f883b2aba0b48469ecbae5d88 v7-4-368 -72ee0db83788638c36bbcb076cabc2ba6c8cd4e7 v7-4-369 -50575818a97fa4777e52272f5ffc769179d76a8d v7-4-370 -d44f298c43c74555f4ea21b710d377133f948d61 v7-4-371 -a122efb555c4f08405051369310451a627ed524b v7-4-372 -353330c512a9488cf5c1a3f8b8a57fa8cdd83a7a v7-4-373 -f59c4bf0ac3b525f703cafba9a9cb0aeb3cc7745 v7-4-374 -5a5492d676ab1e8334aa86ec552e7e33ee8828e1 v7-4-375 -c3bb76e5b2355c57d7f89997aa9e125e46afdea1 v7-4-376 -255561411d7ae4b3c713bfb2e2f13c5f08ce0c61 v7-4-377 -75ae211df37d789c54f660ccddddd0e370aa67ae v7-4-378 -16cfdf28be40ccbefaeb80ec574a098362a36a34 v7-4-379 -7cfbad4a78bf306e5aaf84dc9c29b48e7d77c1ef v7-4-380 -0a3d958e346ee051667d3e541273b78fb1dfed9a v7-4-381 -dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 -2f02675bc4b051fff7be63f5107f659045a010e1 v7-4-383 diff --git a/.lgtm.yml b/.lgtm.yml new file mode 100644 index 0000000000..abe9ff6541 --- /dev/null +++ b/.lgtm.yml @@ -0,0 +1,4 @@ +# Format of this file: https://lgtm.com/help/lgtm/lgtm.yml-configuration-file +path_classifiers: + documentation: + - runtime/tutor/tutor* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..13b2851df2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,61 @@ +language: c +dist: trusty + +os: + - osx + +osx_image: xcode9.3 + +compiler: + - clang + +env: + - MACOSX_DEPLOYMENT_TARGET=10.9 + XCODEFLAGS="MACOSX_DEPLOYMENT_TARGET=10.9" + VERSIONER_PERL_VERSION=5.18 + VERSIONER_PYTHON_VERSION=2.7 + LUA_INC=/lua5.1 + LUA52_INC=/lua5.3 + vi_cv_path_python=/usr/bin/python + vi_cv_path_python3=/usr/local/bin/python3 + vi_cv_path_plain_lua=/usr/local/bin/lua-5.1 + vi_cv_dll_name_perl=/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE/libperl.dylib + vi_cv_dll_name_python=/System/Library/Frameworks/Python.framework/Versions/2.7/Python + vi_cv_dll_name_python3=/usr/local/Frameworks/Python.framework/Versions/3.6/Python + VIMCMD=src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim + "CONFOPT='--with-features=huge --enable-multibyte --enable-terminal --enable-netbeans --with-tlib=ncurses --enable-cscope --enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --with-ruby-command=/usr/local/bin/ruby --enable-luainterp=dynamic --with-lua-prefix=/usr/local --enable-lua52interp=dynamic --with-lua52-prefix=/usr/local --enable-gui=macvim'" + +sudo: false + +before_install: + - brew update || brew update + - brew install lua@5.1 + - brew install lua + - brew upgrade python + - brew install ruby + - brew install gettext + - brew tap splhack/splhack + - brew install --HEAD cmigemo-mk + - brew list --versions + +script: + - NPROC=$(getconf _NPROCESSORS_ONLN) + - ./configure $CONFOPT + - cat src/auto/config.mk + - grep -q -- "-DDYNAMIC_PERL_DLL=\\\\\"$vi_cv_dll_name_perl\\\\\"" src/auto/config.mk + - grep -q -- "-DDYNAMIC_PYTHON_DLL=\\\\\"$vi_cv_dll_name_python\\\\\"" src/auto/config.mk + - grep -q -- "-DDYNAMIC_PYTHON3_DLL=\\\\\"$vi_cv_dll_name_python3\\\\\"" src/auto/config.mk + - GETTEXT=$(find /usr/local/Cellar/gettext -name bin) + - PATH=$PATH:$GETTEXT make -C src/po MSGFMT=$GETTEXT/msgfmt + - make -j$NPROC + - rm -f result; $VIMCMD -c "redir>result" -c "set luadll=/usr/local/lib/liblua.5.1.dylib" -c "lua print(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - rm -f result; $VIMCMD -c "redir>result" -c "set luadll=/usr/local/lib/liblua.5.3.dylib" -c "lua print(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - rm -f result; $VIMCMD -c "redir>result" -c "perl VIM::Msg(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - rm -f result; $VIMCMD -c "redir>result" -c "py import sys; print(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - rm -f result; $VIMCMD -c "redir>result" -c "py3 import sys; print(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - rm -f result; $VIMCMD -c "redir>result" -c "ruby puts(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result + - make test + - make -C src/testdir clean + - make -C src testgui + +# vim:set sts=2 sw=2 tw=0 et: diff --git a/CHANGES_kaoriya.md b/CHANGES_kaoriya.md new file mode 100644 index 0000000000..d813697a1a --- /dev/null +++ b/CHANGES_kaoriya.md @@ -0,0 +1,47 @@ +## 2017/05/02 の変更点 + +* ベースコードを8.0.0596に更新しました +* contrib 更新 + * autofmt (2017-02-13 99f2b50) + * lang-ja (2017-02-16 92ba192) + * LuaJIT (2017-05-01 8271c643c) + * vimdoc-ja (2017-04-22 8d0c593d) + +## 2017/01/01 の変更点 + +* ベースコードを8.0.0134に更新しました +* contrib 更新 + * autofmt (2016-12-03 4bf8dbb) + * lang-ja (2016-12-08 4c3c613) + * LuaJIT (2016-12-30 8e5d7be) + * vimdoc-ja (2016-12-23 489d8a0) + +## 2016/11/13 の変更点 + +* ベースコードを8.0.0082に更新しました +* diff.exe をバンドルするようにしました +* contrib 追加 + * diffutils (2016-11-13 4a42ca2) +* contrib 更新 + * LuaJIT (2016-10-20 716f2da) + * vimdoc-ja (2016-11-03 6b6b902) + +## 2016/10/16 の変更点 + +* ベースコードを8.0.0039に更新しました +* contrib 更新 + * lang-ja (2016-09-22 8080fc7) + * LuaJIT (2016-10-13 3f43f09) + * vimdoc-ja (2016-10-14 4a43b59) +* 既知の問題 + * https://github.com/vim-jp/issues/issues/970 + +## 2016/09/13 の変更点 + +* ベースコードを8.0.0003に更新しました +* contrib 更新 + * lang-ja (2016-09-13 57db842) + * vimdoc-ja (2016-09-12 da005d9) +* 過去の変更点(CHANGES.txt)を移動しました + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..b03f03e68e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,54 @@ +# Contributing to Vim + +Patches are welcome in whatever form. +Discussions about patches happen on the vim-dev maillist. +If you create a pull request on GitHub it will be +forwarded to the vim-dev maillist. You can also send your patch there +directly. An attachment with a unified diff format is preferred. +Information about the maillist can be found [on the Vim website]. + +[on the Vim website]: http://www.vim.org/maillist.php#vim-dev + +Please consider adding a test. Test coverage isn't very good yet, this needs +to improve. Look through recent patches for examples. The tests are located +under "src/testdir". + + +# Reporting issues + +We use GitHub issues, but that is not a requirement. Writing to the Vim +maillist is also fine. + +Please use the GitHub issues only for actual issues. If you are not 100% sure +that your problem is a Vim issue, please first discuss this on the Vim user +maillist. Try reproducing the problem without any plugins or settings: + + vim -N -u NONE + +If you report an issue, please describe exactly how to reproduce it. +For example, don't say "insert some text" but say what you did exactly: +"ahere is some text<Esc>". +Ideally, the steps you list can be used to write a test to verify the problem +is fixed. + +Feel free to report even the smallest problem, also typos in the documentation. + +You can find known issues in the todo file: ":help todo". +Or open [the todo file] on GitHub to see the latest version. + +[the todo file]: https://github.com/vim/vim/blob/master/runtime/doc/todo.txt + + +# Syntax, indent and other runtime files + +The latest version of these files can be obtained from the repository. +They are usually not updated with numbered patches. + +If you find a problem with one of these files or have a suggestion for +improvement, please first try to contact the maintainer directly. +Look in the header of the file for the name and email address. + +The maintainer will take care of issues and send updates to Bram for +distribution with Vim. + +If the maintainer does not react, contact the vim-dev maillist. diff --git a/Filelist b/Filelist index 46aaa964e3..205c077684 100644 --- a/Filelist +++ b/Filelist @@ -4,17 +4,30 @@ # source files for all source archives SRC_ALL = \ .hgignore \ + .lgtm.yml \ + .travis.yml \ + appveyor.yml \ + src/appveyor.bat \ src/README.txt \ + src/alloc.h \ src/arabic.c \ src/arabic.h \ src/ascii.h \ + src/beval.c \ + src/beval.h \ src/blowfish.c \ src/buffer.c \ + src/channel.c \ src/charset.c \ + src/crypt.c \ + src/crypt_zip.c \ + src/dict.c \ src/diff.c \ src/digraph.c \ src/edit.c \ src/eval.c \ + src/evalfunc.c \ + src/ex_cmdidxs.h \ src/ex_cmds.c \ src/ex_cmds.h \ src/ex_cmds2.c \ @@ -31,9 +44,12 @@ SRC_ALL = \ src/gui.c \ src/gui.h \ src/gui_beval.c \ - src/gui_beval.h \ src/hardcopy.c \ src/hashtab.c \ + src/json.c \ + src/json_test.c \ + src/kword_test.c \ + src/list.c \ src/keymap.h \ src/macros.h \ src/main.c \ @@ -44,6 +60,7 @@ SRC_ALL = \ src/memline.c \ src/menu.c \ src/message.c \ + src/message_test.c \ src/misc1.c \ src/misc2.c \ src/move.c \ @@ -65,28 +82,45 @@ SRC_ALL = \ src/sha256.c \ src/structs.h \ src/spell.c \ + src/spell.h \ + src/spellfile.c \ src/syntax.c \ src/tag.c \ src/term.c \ + src/terminal.c \ src/term.h \ src/termlib.c \ src/ui.c \ src/undo.c \ + src/userfunc.c \ src/version.c \ src/version.h \ src/vim.h \ src/winclip.c \ src/window.c \ + src/tee/tee.c \ src/xxd/xxd.c \ src/main.aap \ + src/testdir/gen_opt_test.vim \ src/testdir/main.aap \ + src/testdir/README.txt \ + src/testdir/Make_all.mak \ src/testdir/*.in \ + src/testdir/*.py \ + src/testdir/lsan-suppress.txt \ src/testdir/sautest/autoload/*.vim \ + src/testdir/runtest.vim \ + src/testdir/shared.vim \ + src/testdir/screendump.vim \ + src/testdir/view_util.vim \ + src/testdir/setup.vim \ + src/testdir/gui_init.vim \ + src/testdir/setup_gui.vim \ + src/testdir/gui_preinit.vim \ src/testdir/test[0-9]*.ok \ src/testdir/test[0-9]*a.ok \ src/testdir/test_[a-z]*.ok \ src/testdir/test49.vim \ - src/testdir/test60.vim \ src/testdir/test83-tags? \ src/testdir/test77a.com \ src/testdir/test_*.vim \ @@ -99,19 +133,35 @@ SRC_ALL = \ src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \ src/testdir/python_after/*.py \ src/testdir/python_before/*.py \ + src/testdir/pyxfile/*.py \ + src/testdir/bench*.in \ + src/testdir/bench*.vim \ + src/testdir/dumps/*.dump \ + src/testdir/samples/*.txt \ + src/testdir/samples/test000 \ + src/testdir/if_ver*.vim \ + src/testdir/color_ramp.vim \ src/proto.h \ + src/proto/arabic.pro \ + src/proto/beval.pro \ src/proto/blowfish.pro \ src/proto/buffer.pro \ + src/proto/channel.pro \ src/proto/charset.pro \ + src/proto/crypt.pro \ + src/proto/crypt_zip.pro \ + src/proto/dict.pro \ src/proto/diff.pro \ src/proto/digraph.pro \ src/proto/edit.pro \ src/proto/eval.pro \ + src/proto/evalfunc.pro \ src/proto/ex_cmds.pro \ src/proto/ex_cmds2.pro \ src/proto/ex_docmd.pro \ src/proto/ex_eval.pro \ src/proto/ex_getln.pro \ + src/proto/farsi.pro \ src/proto/fileio.pro \ src/proto/fold.pro \ src/proto/getchar.pro \ @@ -119,6 +169,8 @@ SRC_ALL = \ src/proto/gui_beval.pro \ src/proto/hardcopy.pro \ src/proto/hashtab.pro \ + src/proto/json.pro \ + src/proto/list.pro \ src/proto/main.pro \ src/proto/mark.pro \ src/proto/mbyte.pro \ @@ -140,15 +192,88 @@ SRC_ALL = \ src/proto/search.pro \ src/proto/sha256.pro \ src/proto/spell.pro \ + src/proto/spellfile.pro \ src/proto/syntax.pro \ src/proto/tag.pro \ src/proto/term.pro \ + src/proto/terminal.pro \ src/proto/termlib.pro \ src/proto/ui.pro \ src/proto/undo.pro \ + src/proto/userfunc.pro \ src/proto/version.pro \ src/proto/winclip.pro \ src/proto/window.pro \ + src/libvterm/.bzrignore \ + src/libvterm/.gitignore \ + src/libvterm/LICENSE \ + src/libvterm/Makefile \ + src/libvterm/README \ + src/libvterm/tbl2inc_c.pl \ + src/libvterm/vterm.pc.in \ + src/libvterm/bin/unterm.c \ + src/libvterm/bin/vterm-ctrl.c \ + src/libvterm/bin/vterm-dump.c \ + src/libvterm/doc/URLs \ + src/libvterm/doc/seqs.txt \ + src/libvterm/include/vterm.h \ + src/libvterm/include/vterm_keycodes.h \ + src/libvterm/src/encoding.c \ + src/libvterm/src/encoding/DECdrawing.inc \ + src/libvterm/src/encoding/DECdrawing.tbl \ + src/libvterm/src/encoding/uk.inc \ + src/libvterm/src/encoding/uk.tbl \ + src/libvterm/src/keyboard.c \ + src/libvterm/src/mouse.c \ + src/libvterm/src/parser.c \ + src/libvterm/src/pen.c \ + src/libvterm/src/rect.h \ + src/libvterm/src/screen.c \ + src/libvterm/src/state.c \ + src/libvterm/src/unicode.c \ + src/libvterm/src/utf8.h \ + src/libvterm/src/vterm.c \ + src/libvterm/src/vterm_internal.h \ + src/libvterm/t/02parser.test \ + src/libvterm/t/03encoding_utf8.test \ + src/libvterm/t/10state_putglyph.test \ + src/libvterm/t/11state_movecursor.test \ + src/libvterm/t/12state_scroll.test \ + src/libvterm/t/13state_edit.test \ + src/libvterm/t/14state_encoding.test \ + src/libvterm/t/15state_mode.test \ + src/libvterm/t/16state_resize.test \ + src/libvterm/t/17state_mouse.test \ + src/libvterm/t/18state_termprops.test \ + src/libvterm/t/20state_wrapping.test \ + src/libvterm/t/21state_tabstops.test \ + src/libvterm/t/22state_save.test \ + src/libvterm/t/25state_input.test \ + src/libvterm/t/26state_query.test \ + src/libvterm/t/27state_reset.test \ + src/libvterm/t/28state_dbl_wh.test \ + src/libvterm/t/29state_fallback.test \ + src/libvterm/t/30pen.test \ + src/libvterm/t/40screen_ascii.test \ + src/libvterm/t/41screen_unicode.test \ + src/libvterm/t/42screen_damage.test \ + src/libvterm/t/43screen_resize.test \ + src/libvterm/t/44screen_pen.test \ + src/libvterm/t/45screen_protect.test \ + src/libvterm/t/46screen_extent.test \ + src/libvterm/t/47screen_dbl_wh.test \ + src/libvterm/t/48screen_termprops.test \ + src/libvterm/t/90vttest_01-movement-1.test \ + src/libvterm/t/90vttest_01-movement-2.test \ + src/libvterm/t/90vttest_01-movement-3.test \ + src/libvterm/t/90vttest_01-movement-4.test \ + src/libvterm/t/90vttest_02-screen-1.test \ + src/libvterm/t/90vttest_02-screen-2.test \ + src/libvterm/t/90vttest_02-screen-3.test \ + src/libvterm/t/90vttest_02-screen-4.test \ + src/libvterm/t/92lp1640917.test \ + src/libvterm/t/harness.c \ + src/libvterm/t/run-test.pl \ # source files for Unix only @@ -158,6 +283,7 @@ SRC_UNIX = \ README_src.txt \ configure \ pixmaps/*.xpm \ + pixmaps/*.png \ pixmaps/gen-inline-pixbufs.sh \ pixmaps/stock_icons.h \ src/INSTALL \ @@ -169,7 +295,8 @@ SRC_UNIX = \ src/config.mk.dist \ src/config.mk.in \ src/configure \ - src/configure.in \ + src/configure.ac \ + src/create_cmdidxs.vim \ src/gui_at_fs.c \ src/gui_at_sb.c \ src/gui_at_sb.h \ @@ -178,6 +305,7 @@ SRC_UNIX = \ src/gui_gtk_f.c \ src/gui_gtk_f.h \ src/gui_gtk_x11.c \ + src/gui_gtk_res.xml \ src/gui_motif.c \ src/gui_xmdlg.c \ src/gui_xmebw.c \ @@ -192,7 +320,7 @@ SRC_UNIX = \ src/link.sh \ src/installman.sh \ src/installml.sh \ - src/mkinstalldirs \ + src/install-sh \ src/os_unix.c \ src/os_unix.h \ src/os_unixx.h \ @@ -203,6 +331,7 @@ SRC_UNIX = \ src/proto/gui_athena.pro \ src/proto/gui_gtk.pro \ src/proto/gui_gtk_x11.pro \ + src/proto/gui_gtk_gresources.pro \ src/proto/gui_motif.pro \ src/proto/gui_xmdlg.pro \ src/proto/gui_x11.pro \ @@ -224,6 +353,7 @@ SRC_UNIX = \ src/workshop.h \ src/wsdebug.c \ src/wsdebug.h \ + src/tee/Makefile \ src/xxd/Makefile \ # source files for both DOS and Unix @@ -239,7 +369,6 @@ SRC_DOS_UNIX = \ src/if_python3.c \ src/if_py_both.h \ src/if_ruby.c \ - src/if_sniff.h \ src/if_tcl.c \ src/proto/if_cscope.pro \ src/proto/if_lua.pro \ @@ -269,50 +398,45 @@ SRC_DOS = \ src/GvimExt/uninst.bat \ README_srcdos.txt \ src/INSTALLpc.txt \ - src/Make_bc3.mak \ src/Make_bc5.mak \ src/Make_cyg.mak \ - src/Make_djg.mak \ + src/Make_cyg_ming.mak \ src/Make_ivc.mak \ src/Make_dvc.mak \ src/Make_ming.mak \ src/Make_mvc.mak \ - src/Make_w16.mak \ + tools/rename.bat \ src/bigvim.bat \ src/bigvim64.bat \ src/msvcsetup.bat \ src/msvc2008.bat \ src/msvc2010.bat \ + src/msvc2015.bat \ src/dimm.idl \ src/dlldata.c \ src/dosinst.c \ src/dosinst.h \ src/glbl_ime.cpp \ src/glbl_ime.h \ - src/gui_w16.c \ + src/gui_dwrite.cpp \ + src/gui_dwrite.h \ src/gui_w32.c \ - src/gui_w48.c \ - src/guiw16rc.h \ src/gui_w32_rc.h \ src/if_ole.cpp \ src/if_ole.h \ src/if_ole.idl \ + src/if_perl_msvc/stdbool.h \ + src/iscygpty.c \ + src/iscygpty.h \ src/iid_ole.c \ src/os_dos.h \ - src/os_msdos.c \ - src/os_msdos.h \ src/os_w32dll.c \ src/os_w32exe.c \ - src/os_win16.c \ src/os_win32.c \ src/os_mswin.c \ - src/os_win16.h \ src/os_win32.h \ - src/proto/gui_w16.pro \ src/proto/gui_w32.pro \ src/proto/if_ole.pro \ - src/proto/os_msdos.pro \ - src/proto/os_win16.pro \ src/proto/os_win32.pro \ src/proto/os_mswin.pro \ src/testdir/Make_dos.mak \ @@ -323,19 +447,16 @@ SRC_DOS = \ src/vim.rc \ src/vimio.h \ src/gvim.exe.mnf \ - src/vim16.def \ - src/vim16.rc \ src/vimrun.c \ - src/vimtbar.h \ src/xpm_w32.c \ src/xpm_w32.h \ - src/xxd/Make_bc3.mak \ + src/tee/Make_mvc.mak \ src/xxd/Make_bc5.mak \ - src/xxd/Make_cyg.mak \ - src/xxd/Make_djg.mak \ src/xxd/Make_ming.mak \ src/xxd/Make_mvc.mak \ nsis/gvim.nsi \ + nsis/gvim_version.nsh \ + nsis/vimrc.ini \ nsis/README.txt \ uninstal.txt \ src/VisVim/Commands.cpp \ @@ -364,18 +485,17 @@ SRC_DOS_BIN = \ src/VisVim/Res/*.bmp \ src/tearoff.bmp \ src/tools.bmp \ - src/tools16.bmp \ src/vim*.ico \ src/vim.tlb \ - src/vimtbar.lib \ src/xpm/COPYRIGHT \ src/xpm/README.txt \ src/xpm/include/*.h \ src/xpm/x64/lib/libXpm.a \ src/xpm/x64/lib/libXpm.lib \ + src/xpm/x64/lib-vc14/libXpm.lib \ src/xpm/x86/lib/libXpm.a \ src/xpm/x86/lib/libXpm.lib \ - src/vimtbar.dll \ + src/xpm/x86/lib-vc14/libXpm.lib \ nsis/icons/*.bmp \ nsis/icons/*.ico \ @@ -426,15 +546,6 @@ SRC_VMS = \ src/xxd/Make_vms.mms \ vimtutor.com \ -# source files for OS/2 (in the extra archive) -SRC_OS2 = \ - src/Make_os2.mak \ - src/os_os2_cfg.h \ - src/testdir/Make_os2.mak \ - src/testdir/todos.vim \ - src/testdir/os2.vim \ - src/xxd/Make_os2.mak \ - # source files for QNX (in the extra archive) SRC_QNX = \ src/os_qnx.c \ @@ -451,12 +562,10 @@ SRC_EXTRA = \ $(SRC_DOS) \ $(SRC_DOS_BIN) \ $(SRC_MAC) \ - $(SRC_OS2) \ $(SRC_QNX) \ $(SRC_VMS) \ README_os390.txt \ src/Make_mint.mak \ - src/if_sniff.c \ src/infplist.xml \ src/link.390 \ src/os_beos.c \ @@ -470,12 +579,15 @@ SRC_EXTRA = \ # runtime files for all distributions RT_ALL = \ README.txt \ + README.md \ + CONTRIBUTING.md \ runtime/bugreport.vim \ runtime/doc/*.awk \ runtime/doc/*.pl \ runtime/doc/*.txt \ runtime/doc/Makefile \ runtime/doc/doctags.c \ + runtime/doc/test_urls.vim \ runtime/doc/vim.1 \ runtime/doc/evim.1 \ runtime/doc/vimdiff.1 \ @@ -484,7 +596,6 @@ RT_ALL = \ runtime/ftoff.vim \ runtime/gvimrc_example.vim \ runtime/macros/README.txt \ - runtime/macros/dvorak \ runtime/macros/editexisting.vim \ runtime/macros/hanoi/click.me \ runtime/macros/hanoi/hanoi.vim \ @@ -496,7 +607,6 @@ RT_ALL = \ runtime/macros/life/click.me \ runtime/macros/life/life.vim \ runtime/macros/matchit.vim \ - runtime/macros/matchit.txt \ runtime/macros/maze/README.txt \ runtime/macros/maze/[mM]akefile \ runtime/macros/maze/main.aap \ @@ -512,8 +622,9 @@ RT_ALL = \ runtime/macros/urm/examples \ runtime/macros/urm/urm \ runtime/macros/urm/urm.vim \ - runtime/mswin.vim \ + runtime/defaults.vim \ runtime/evim.vim \ + runtime/mswin.vim \ runtime/optwin.vim \ runtime/ftplugin.vim \ runtime/ftplugof.vim \ @@ -526,6 +637,17 @@ RT_ALL = \ runtime/tutor/tutor \ runtime/tutor/tutor.vim \ runtime/vimrc_example.vim \ + runtime/pack/dist/opt/dvorak/plugin/dvorak.vim \ + runtime/pack/dist/opt/dvorak/dvorak/enable.vim \ + runtime/pack/dist/opt/dvorak/dvorak/disable.vim \ + runtime/pack/dist/opt/editexisting/plugin/editexisting.vim \ + runtime/pack/dist/opt/justify/plugin/justify.vim \ + runtime/pack/dist/opt/matchit/plugin/matchit.vim \ + runtime/pack/dist/opt/matchit/doc/matchit.txt \ + runtime/pack/dist/opt/matchit/doc/tags \ + runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim \ + runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim \ + runtime/pack/dist/opt/termdebug/plugin/termdebug.vim \ # runtime files for all distributions without CR-NL translation RT_ALL_BIN = \ @@ -543,9 +665,11 @@ RT_SCRIPTS = \ runtime/makemenu.vim \ runtime/autoload/*.vim \ runtime/autoload/README.txt \ + runtime/autoload/dist/*.vim \ runtime/autoload/xml/*.vim \ runtime/colors/*.vim \ runtime/colors/README.txt \ + runtime/colors/tools/*.vim \ runtime/compiler/*.vim \ runtime/compiler/README.txt \ runtime/indent/*.vim \ @@ -569,6 +693,8 @@ RT_UNIX = \ runtime/vim32x32.xpm \ runtime/vim48x48.png \ runtime/vim48x48.xpm \ + runtime/gvim.desktop \ + runtime/vim.desktop \ # Unix and DOS runtime without CR-LF translation RT_UNIX_DOS_BIN = \ @@ -604,7 +730,6 @@ RT_AMI = \ README.txt.info \ README_ami.txt \ README_ami.txt.info \ - libs/arp.library \ runtime/doc.info \ runtime/doc/*.info \ runtime/icons/README.txt \ @@ -687,10 +812,38 @@ EXTRA = \ farsi/README.txt \ farsi/fonts/*/far-* \ runtime/vimlogo.xpm \ - src/swis.s \ src/tee/Makefile \ + src/tee/Make_mvc.mak \ src/tee/tee.c \ - csdpmi4b.zip \ + +# files in READMEdir that are included from the top dir +IN_README_DIR = \ + README.txt.info \ + README_ami.txt \ + README_ami.txt.info \ + README_amibin.txt \ + README_amibin.txt.info \ + README_amisrc.txt \ + README_amisrc.txt.info \ + README_bindos.txt \ + README_dos.txt \ + README_extra.txt \ + README_mac.txt \ + README_ole.txt \ + README_os2.txt \ + README_os390.txt \ + README_src.txt \ + README_srcdos.txt \ + README_unix.txt \ + README_vms.txt \ + README_w32s.txt \ + Contents \ + Contents.info \ + Vim.info \ + Xxd.info \ + runtime.info \ + src.info \ + vimdir.info \ # generic language files LANG_GEN = \ diff --git a/Makefile b/Makefile index 3565357d8a..4a7c4c6642 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ first: # Some make programs use the last target for the $@ default; put the other # targets separately to always let $@ expand to "first" by default. -all install uninstall tools config configure reconfig proto depend lint tags types test testclean clean distclean: +all install uninstall tools config configure reconfig proto depend lint tags types test scripttests unittests testclean clean distclean: @if test ! -f src/auto/config.mk; then \ cp src/config.mk.dist src/auto/config.mk; \ fi @@ -51,21 +51,15 @@ all install uninstall tools config configure reconfig proto depend lint tags typ # # dossrc vim##src.zip sources for MS-DOS # dosrt vim##rt.zip runtime for MS-DOS -# dosbin vim##d16.zip binary for MS-DOS 16 bits -# vim##d32.zip binary for MS-DOS 32 bits -# vim##w32.zip binary for Win32 +# dosbin vim##w32.zip binary for Win32 # gvim##.zip binary for GUI Win32 # gvim##ole.zip OLE exe for Win32 GUI -# gvim##_s.zip exe for Win32s GUI # # OBSOLETE # amisrc vim##src.tgz sources for Amiga # amirt vim##rt.tgz runtime for Amiga # amibin vim##bin.tgz binary for Amiga # -# os2bin vim##os2.zip binary for OS/2 -# (use RT from dosrt) -# # farsi farsi##.zip Farsi fonts # # All output files are created in the "dist" directory. Existing files are @@ -73,24 +67,16 @@ all install uninstall tools config configure reconfig proto depend lint tags typ # To do all this you need the Unix archive and compiled binaries. # Before creating an archive first delete all backup files, *.orig, etc. -MAJOR = 7 -MINOR = 4 - -# Uncomment this line if the Win32s version is to be included. -# DOSBIN_S = dosbin_s - -# Uncomment this line if the 16 bit DOS version is to be included. -# DOSBIN_D16 = dosbin_d16 - -# Uncomment this line if the 32 bit DOS version is to be included. -# DOSBIN_D32 = dosbin_d32 +MAJOR = 8 +MINOR = 1 # CHECKLIST for creating a new version: # -# - Update Vim version number. For a test version in: src/version.h, Contents, -# MAJOR/MINOR above, VIMMAJOR and VIMMINOR in src/Makefile, README*.txt, -# runtime/doc/*.txt and nsis/gvim.nsi. Other things in README_os2.txt. For a -# minor/major version: src/GvimExt/GvimExt.reg, src/vim.def, src/vim16.def, +# - Update Vim version number. For a test version in: src/version.h, +# READMEdir/Contents, MAJOR/MINOR above, VIMMAJOR and VIMMINOR in +# src/Makefile, README.txt, README.md, READMEdir/README*.txt, +# runtime/doc/*.txt and make nsis/gvim_version.nsh. +# For a minor/major version: src/GvimExt/GvimExt.reg, src/vim.def, # src/gvim.exe.mnf. # - Compile Vim with GTK, Perl, Python, Python3, TCL, Ruby, MZscheme, Lua (if # you can make it all work), Cscope and "huge" features. Exclude workshop @@ -111,7 +97,7 @@ MINOR = 4 # - Check for missing entries in runtime/makemenu.vim (with checkmenu script). # - Check for missing options in runtime/optwin.vim et al. (with check.vim). # - Do "make menu" to update the runtime/synmenu.vim file. -# - Add remarks for changes to runtime/doc/version7.txt. +# - Add remarks for changes to runtime/doc/version8.txt. # - Check that runtime/doc/help.txt doesn't contain entries in "LOCAL # ADDITIONS". # - In runtime/doc run "make" and "make html" to check for errors. @@ -132,94 +118,110 @@ MINOR = 4 # flag). # - "make amirt", "make amibin". # -# PC: +# MS-Windows: # - Run make on Unix to update the ".mo" files. -# - "make dossrc" and "make dosrt". Unpack the archives on a PC. -# Win32 console version: -# - Set environment for Visual C++ 2008, e.g.: "msvc2008.bat" Or: -# "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat". -# Or, when using the Visual C++ Toolkit 2003: "msvcsetup.bat" (adjust the -# paths when necessary). -# For Windows 98/ME the 2003 version is required, but then the executable -# won't work on Windows 7 and 64 bit systems. -# - "nmake -f Make_mvc.mak" (use the same path as for vcvars32.bat) -# - "rm testdir/*.out", "nmake -f Make_mvc.mak test" and check the output. -# - Rename vim.exe to vimw32.exe, xxd/xxd.exe to xxdw32.exe. -# - Rename vim.pdb to vimw32.pdb. -# - Rename install.exe to installw32.exe and uninstal.exe to uninstalw32.exe. -# Win32 GUI version: -# - "nmake -f Make_mvc.mak GUI=yes" +# - Get 32 bit libintl-8.dll, libiconv-2.dll and libgcc_s_sjlj-1.dll. E.g. from +# https://mlocati.github.io/gettext-iconv-windows/ . +# Use the "shared-32.zip file and extract the archive to get the files. +# Put them in the gettext32 directory, "make dosrt" uses them. +# - Get 64 bit libintl-8.dll and libiconv-2.dll. E.g. from +# https://mlocati.github.io/gettext-iconv-windows/ . +# Use the "shared-64.zip file and extract the archive to get the files. +# Put them in the gettext64 directory, "make dosrt" uses them. +# - > make dossrc +# > make dosrt +# Unpack dist/vim##rt.zip and dist/vim##src.zip on an MS-Windows PC. +# This creates the directory vim/vim81 and puts all files in there. +# Win32 console version build: +# - See src/INSTALLpc.txt for installing the compiler and SDK. +# - Set environment for Visual C++ 2015: +# > cd src +# > msvc2015.bat +# - Build the console binary: +# > nmake -f Make_mvc.mak +# - Run the tests and check the ouput: +# > nmake -f Make_mvc.mak testclean +# > nmake -f Make_mvc.mak test +# - Rename (using ../tools/rename.bat): +# vim.exe to vimw32.exe +# tee/tee.exe to teew32.exe +# xxd/xxd.exe to xxdw32.exe +# vim.pdb to vimw32.pdb +# install.exe to installw32.exe +# uninstal.exe to uninstalw32.exe +# Win32 GUI version build: +# - > cd src +# > nmake -f Make_mvc.mak GUI=yes +# - Run the tests and check the output: +# > nmake -f Make_mvc.mak testclean +# > nmake -f Make_mvc.mak testgvim # - move "gvim.exe" to here (otherwise the OLE version will overwrite it). # - Move gvim.pdb to here. -# - Delete vimrun.exe, install.exe and uninstal.exe. # - Copy "GvimExt/gvimext.dll" to here. -# Win32 GUI version with OLE, PERL, TCL, PYTHON and dynamic IME: -# - Run src/bigvim.bat ("nmake -f Make_mvc.mak GUI=yes OLE=yes IME=yes ...) +# - Delete vimrun.exe, install.exe and uninstal.exe. +# Win32 GUI version with OLE, PERL, Ruby, TCL, PYTHON and dynamic IME: +# - Install the interfaces you want, see src/INSTALLpc.txt +# Adjust bigvim.bat to match the version of each interface you want. +# - Build: +# > cd src +# > bigvim.bat +# - Run the tests: +# > nmake -f Make_mvc.mak testclean +# > nmake -f Make_mvc.mak testgvim +# - check the output. # - Rename "gvim.exe" to "gvim_ole.exe". # - Rename gvim.pdb to "gvim_ole.pdb". # - Delete install.exe and uninstal.exe. # Create the archives: # - Copy all the "*.exe" files to where this Makefile is. # - Copy all the "*.pdb" files to where this Makefile is. -# - "make dosbin". +# - in this directory: +# > make dosbin # NSIS self installing exe: # - To get NSIS see http://nsis.sourceforge.net # - Make sure gvim_ole.exe, vimw32.exe, installw32.exe, -# uninstalw32.exe and xxdw32.exe have been build as mentioned above. +# uninstalw32.exe, teew32.exe and xxdw32.exe have been build as mentioned +# above. # - copy these files (get them from a binary archive or build them): # gvimext.dll in src/GvimExt # gvimext64.dll in src/GvimExt # VisVim.dll in src/VisVim # Note: VisVim needs to be build with MSVC 5, newer versions don't work. -# gvimext64.dll can be obtained from http://code.google.com/p/vim-win3264/ -# It is part of vim72.zip as vim72/gvimext.dll. -# - make sure there is a diff.exe two levels up -# - go to ../nsis and do "makensis gvim.nsi" (takes a few minutes). +# gvimext64.dll can be obtained from: +# https://github.com/vim/vim-win32-installer/releases +# It is part of gvim_8.0.*_x64.zip as vim/vim80/GvimExt/gvimext64.dll. +# - Make sure there is a diff.exe two levels up (get it from a previous Vim +# version). Also put winpty32.dll and winpty-agent.exe there. +# - go to ../nsis and do: +# > makensis gvim.nsi (takes a few minutes). +# ignore warning for libwinpthread-1.dll # - Copy gvim##.exe to the dist directory. # # 64 bit builds (these are not in the normal distribution, the 32 bit build # works just fine on 64 bit systems). # Like the console and GUI version, but first run vcvars64.bat or # "..\VC\vcvarsall.bat x86_amd64". -# - "nmake -f Make_mvc.mak" -# - "nmake -f Make_mvc.mak GUI=yes" -# Or run src/bigvim64.bat for an OLE version. +# - Build the console version: +# > nmake -f Make_mvc.mak +# - Build the GUI version: +# > nmake -f Make_mvc.mak GUI=yes +# - Build the OLE version with interfaces: +# > bigvim64.bat # -# OBSOLETE systems: You can build this if you have an appropriate system. # -# 16 bit DOS version: (doesn't build anywhere) -# - Set environment for compiling with Borland C++ 3.1. -# - "bmake -f Make_bc3.mak BOR=E:\borlandc" (compiling xxd might fail, in that -# case set environment for compiling with Borland C++ 4.0 and do -# "make -f make_bc3.mak BOR=E:\BC4 xxd/xxd.exe"). -# NOTE: this currently fails because Vim is too big. -# - "make test" and check the output. -# - Rename the executables to "vimd16.exe", "xxdd16.exe", "installd16.exe" and -# "uninstald16.exe". +# OBSOLETE systems: You can build these if you have an appropriate system. # -# 32 bit DOS version: (requires Windows XP or earlier) -# - Set environment for compiling with DJGPP; "gmake -f Make_djg.mak". -# - "rm testdir/*.out", "gmake -f Make_djg.mak test" and check the output for -# "ALL DONE". -# - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and -# "uninstald32.exe". +# 16 bit DOS version: You need to get a very old version of Vim, for several +# years even the tiny build is too big to fit in DOS memory. # -# Win32s GUI version: (requires very old compiler) -# - Set environment for Visual C++ 4.1 (requires a new console window): -# "vcvars32.bat" (use the path for VC 4.1 e:\msdev\bin) -# - "nmake -f Make_mvc.mak GUI=yes INTL=no clean" (use the path for VC 4.1) -# - "nmake -f Make_mvc.mak GUI=yes INTL=no" (use the path for VC 4.1) -# - Rename "gvim.exe" to "gvim_w32s.exe". -# - Rename "install.exe" to "installw32.exe" -# - Rename "uninstal.exe" to "uninstalw32.exe" -# - The produced uninstalw32.exe and vimrun.exe are used. +# 32 bit DOS version: Support was removed in 7.4.1399. When syncing to before +# that it probably won't build. # -# OS/2: (requires an OS/2 system) -# - Unpack the Unix archive. -# - "make -f Make_os2.mak". -# - Rename the executables to vimos2.exe, xxdos2.exe and teeos2.exe and copy -# them to here. -# - "make os2bin". +# Win32s GUI version: Support was removed in patch 7.4.1364. +# +# OS/2 support was removed in patch 7.4.1008. If you want to give it a try +# sync to before that and check the old version of this Makefile for +# instructions. VIMVER = vim-$(MAJOR).$(MINOR) VERSION = $(MAJOR)$(MINOR) @@ -241,35 +243,29 @@ dist: mkdir dist # Clean up some files to avoid they are included. +# Copy README files to the top directory. prepare: if test -f runtime/doc/uganda.nsis.txt; then \ rm runtime/doc/uganda.nsis.txt; fi + for name in $(IN_README_DIR); do \ + cp READMEdir/"$$name" .; \ + done # For the zip files we need to create a file with the comment line dist/comment: mkdir dist/comment COMMENT_RT = comment/$(VERSION)-rt -COMMENT_D16 = comment/$(VERSION)-bin-d16 -COMMENT_D32 = comment/$(VERSION)-bin-d32 COMMENT_W32 = comment/$(VERSION)-bin-w32 COMMENT_GVIM = comment/$(VERSION)-bin-gvim COMMENT_OLE = comment/$(VERSION)-bin-ole -COMMENT_W32S = comment/$(VERSION)-bin-w32s COMMENT_SRC = comment/$(VERSION)-src -COMMENT_OS2 = comment/$(VERSION)-bin-os2 COMMENT_HTML = comment/$(VERSION)-html COMMENT_FARSI = comment/$(VERSION)-farsi dist/$(COMMENT_RT): dist/comment echo "Vim - Vi IMproved - v$(VDOT) runtime files for MS-DOS and MS-Windows" > dist/$(COMMENT_RT) -dist/$(COMMENT_D16): dist/comment - echo "Vim - Vi IMproved - v$(VDOT) binaries for MS-DOS 16 bit real mode" > dist/$(COMMENT_D16) - -dist/$(COMMENT_D32): dist/comment - echo "Vim - Vi IMproved - v$(VDOT) binaries for MS-DOS 32 bit protected mode" > dist/$(COMMENT_D32) - dist/$(COMMENT_W32): dist/comment echo "Vim - Vi IMproved - v$(VDOT) binaries for MS-Windows NT/95" > dist/$(COMMENT_W32) @@ -279,15 +275,9 @@ dist/$(COMMENT_GVIM): dist/comment dist/$(COMMENT_OLE): dist/comment echo "Vim - Vi IMproved - v$(VDOT) MS-Windows GUI binaries with OLE support" > dist/$(COMMENT_OLE) -dist/$(COMMENT_W32S): dist/comment - echo "Vim - Vi IMproved - v$(VDOT) GUI binaries for MS-Windows 3.1/3.11" > dist/$(COMMENT_W32S) - dist/$(COMMENT_SRC): dist/comment echo "Vim - Vi IMproved - v$(VDOT) sources for MS-DOS and MS-Windows" > dist/$(COMMENT_SRC) -dist/$(COMMENT_OS2): dist/comment - echo "Vim - Vi IMproved - v$(VDOT) binaries + runtime files for OS/2" > dist/$(COMMENT_OS2) - dist/$(COMMENT_HTML): dist/comment echo "Vim - Vi IMproved - v$(VDOT) documentation in HTML" > dist/$(COMMENT_HTML) @@ -312,6 +302,7 @@ unixall: dist prepare $(EXTRA) \ $(LANG_SRC) \ | (cd dist/$(VIMRTDIR); tar xf -) + -rm $(IN_README_DIR) # Need to use a "distclean" config.mk file # Note: this file is not included in the repository to avoid problems, but it's # OK to put it in the archive. @@ -348,6 +339,7 @@ amirt: dist prepare $(RT_NO_UNIX) \ $(RT_AMI_DOS) \ | (cd dist/Vim/$(VIMRTDIR); tar xf -) + -rm $(IN_README_DIR) mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info mv dist/Vim/$(VIMRTDIR)/runtime/* dist/Vim/$(VIMRTDIR) @@ -368,6 +360,7 @@ amibin: dist prepare Vim \ Xxd \ | (cd dist/Vim/$(VIMRTDIR); tar xf -) + -rm $(IN_README_DIR) mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info cd dist && tar cf vim$(VERSION)bin.tar Vim Vim.info @@ -386,6 +379,7 @@ amisrc: dist prepare $(SRC_AMI) \ $(SRC_AMI_DOS) \ | (cd dist/Vim/$(VIMRTDIR); tar xf -) + -rm $(IN_README_DIR) mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info cd dist && tar cf vim$(VERSION)src.tar Vim Vim.info @@ -396,7 +390,9 @@ no_title.vim: Makefile echo "set notitle noicon nocp nomodeline viminfo=" >no_title.vim # MS-DOS sources -dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt +dossrc: dist no_title.vim dist/$(COMMENT_SRC) \ + runtime/doc/uganda.nsis.txt \ + nsis/gvim_version.nsh -rm -rf dist/vim$(VERSION)src.zip -rm -rf dist/vim mkdir dist/vim @@ -407,10 +403,12 @@ dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt $(SRC_AMI_DOS) \ $(SRC_DOS_UNIX) \ runtime/doc/uganda.nsis.txt \ + nsis/gvim_version.nsh \ | (cd dist/vim/$(VIMRTDIR); tar xf -) mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR) rmdir dist/vim/$(VIMRTDIR)/runtime - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; + # This file needs to be in dos fileformat for NSIS. + $(VIM) -e -X -u no_title.vim -c ":set tx|wq" dist/vim/$(VIMRTDIR)/doc/uganda.nsis.txt tar cf - \ $(SRC_DOS_BIN) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) @@ -419,12 +417,21 @@ dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt runtime/doc/uganda.nsis.txt: runtime/doc/uganda.txt cd runtime/doc && $(MAKE) uganda.nsis.txt -dosrt: dist dist/$(COMMENT_RT) dosrt_unix2dos +nsis/gvim_version.nsh: Makefile + echo "# Generated from Makefile: define the version numbers" > $@ + echo "!ifndef __GVIM_VER__NSH__" >> $@ + echo "!define __GVIM_VER__NSH__" >> $@ + echo "!define VER_MAJOR $(MAJOR)" >> $@ + echo "!define VER_MINOR $(MINOR)" >> $@ + echo "!endif" >> $@ + +dosrt: dist dist/$(COMMENT_RT) dosrt_files -rm -rf dist/vim$(VERSION)rt.zip cd dist && zip -9 -rD -z vim$(VERSION)rt.zip vim <$(COMMENT_RT) # Split in two parts to avoid an "argument list too long" error. -dosrt_unix2dos: dist prepare no_title.vim +# We no longer convert the files from unix to dos fileformat. +dosrt_files: dist prepare no_title.vim -rm -rf dist/vim mkdir dist/vim mkdir dist/vim/$(VIMRTDIR) @@ -440,13 +447,13 @@ dosrt_unix2dos: dist prepare no_title.vim $(RT_AMI_DOS) \ $(LANG_GEN) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; tar cf - \ $(RT_UNIX_DOS_BIN) \ $(RT_ALL_BIN) \ $(RT_DOS_BIN) \ $(LANG_GEN_BIN) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) + -rm $(IN_README_DIR) mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR) rmdir dist/vim/$(VIMRTDIR)/runtime # Add the message translations. Trick: skip ja.mo and use ja.sjis.mo instead. @@ -460,17 +467,23 @@ dosrt_unix2dos: dist prepare no_title.vim cp $$i dist/vim/$(VIMRTDIR)/lang/$$n/LC_MESSAGES/vim.mo; \ fi \ done - cp libintl.dll dist/vim/$(VIMRTDIR)/ + mkdir dist/vim/$(VIMRTDIR)/gettext32 + cp gettext32/libintl-8.dll dist/vim/$(VIMRTDIR)/gettext32/ + cp gettext32/libiconv-2.dll dist/vim/$(VIMRTDIR)/gettext32/ + cp gettext32/libgcc_s_sjlj-1.dll dist/vim/$(VIMRTDIR)/gettext32/ + mkdir dist/vim/$(VIMRTDIR)/gettext64 + cp gettext64/libintl-8.dll dist/vim/$(VIMRTDIR)/gettext64/ + cp gettext64/libiconv-2.dll dist/vim/$(VIMRTDIR)/gettext64/ -# Convert runtime files from Unix fileformat to dos fileformat. # Used before uploading. Don't delete the AAPDIR/sign files! -runtime_unix2dos: dosrt_unix2dos +runtime_unix2dos: dosrt_files -rm -rf `find runtime/dos -type f -print | sed -e /AAPDIR/d` cd dist/vim/$(VIMRTDIR); tar cf - * \ | (cd ../../../runtime/dos; tar xf -) -dosbin: prepare dosbin_gvim dosbin_w32 $(DOSBIN_D32) dosbin_ole $(DOSBIN_S) $(DOSBIN_D16) +dosbin: prepare dosbin_gvim dosbin_w32 dosbin_ole $(DOSBIN_S) + -rm $(IN_README_DIR) # make Win32 gvim dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM) @@ -481,13 +494,16 @@ dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM) tar cf - \ $(BIN_DOS) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; cp gvim.exe dist/vim/$(VIMRTDIR)/gvim.exe + cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe - cp gvimext.dll dist/vim/$(VIMRTDIR)/gvimext.dll + mkdir dist/vim/$(VIMRTDIR)/GvimExt32 + cp gvimext.dll dist/vim/$(VIMRTDIR)/GvimExt32/gvimext.dll + mkdir dist/vim/$(VIMRTDIR)/GvimExt64 + cp gvimext64.dll dist/vim/$(VIMRTDIR)/GvimExt64/gvimext.dll cd dist && zip -9 -rD -z gvim$(VERSION).zip vim <$(COMMENT_GVIM) cp gvim.pdb dist/gvim$(VERSION).pdb @@ -500,47 +516,14 @@ dosbin_w32: dist no_title.vim dist/$(COMMENT_W32) tar cf - \ $(BIN_DOS) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; cp vimw32.exe dist/vim/$(VIMRTDIR)/vim.exe + cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe cd dist && zip -9 -rD -z vim$(VERSION)w32.zip vim <$(COMMENT_W32) cp vimw32.pdb dist/vim$(VERSION)w32.pdb -# make 32bit DOS -dosbin_d32: dist no_title.vim dist/$(COMMENT_D32) - -rm -rf dist/vim$(VERSION)d32.zip - -rm -rf dist/vim - mkdir dist/vim - mkdir dist/vim/$(VIMRTDIR) - tar cf - \ - $(BIN_DOS) \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; - cp vimd32.exe dist/vim/$(VIMRTDIR)/vim.exe - cp xxdd32.exe dist/vim/$(VIMRTDIR)/xxd.exe - cp installd32.exe dist/vim/$(VIMRTDIR)/install.exe - cp uninstald32.exe dist/vim/$(VIMRTDIR)/uninstal.exe - cp csdpmi4b.zip dist/vim/$(VIMRTDIR) - cd dist && zip -9 -rD -z vim$(VERSION)d32.zip vim <$(COMMENT_D32) - -# make 16bit DOS -dosbin_d16: dist no_title.vim dist/$(COMMENT_D16) - -rm -rf dist/vim$(VERSION)d16.zip - -rm -rf dist/vim - mkdir dist/vim - mkdir dist/vim/$(VIMRTDIR) - tar cf - \ - $(BIN_DOS) \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; - cp vimd16.exe dist/vim/$(VIMRTDIR)/vim.exe - cp xxdd16.exe dist/vim/$(VIMRTDIR)/xxd.exe - cp installd16.exe dist/vim/$(VIMRTDIR)/install.exe - cp uninstald16.exe dist/vim/$(VIMRTDIR)/uninstal.exe - cd dist && zip -9 -rD -z vim$(VERSION)d16.zip vim <$(COMMENT_D16) - # make Win32 gvim with OLE dosbin_ole: dist no_title.vim dist/$(COMMENT_OLE) -rm -rf dist/gvim$(VERSION)ole.zip @@ -550,8 +533,8 @@ dosbin_ole: dist no_title.vim dist/$(COMMENT_OLE) tar cf - \ $(BIN_DOS) \ | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; cp gvim_ole.exe dist/vim/$(VIMRTDIR)/gvim.exe + cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe @@ -563,38 +546,6 @@ dosbin_ole: dist no_title.vim dist/$(COMMENT_OLE) cd dist && zip -9 -rD -z gvim$(VERSION)ole.zip vim <$(COMMENT_OLE) cp gvim_ole.pdb dist/gvim$(VERSION)ole.pdb -# make Win32s gvim -dosbin_s: dist no_title.vim dist/$(COMMENT_W32S) - -rm -rf dist/gvim$(VERSION)_s.zip - -rm -rf dist/vim - mkdir dist/vim - mkdir dist/vim/$(VIMRTDIR) - tar cf - \ - $(BIN_DOS) \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; - cp gvim_w32s.exe dist/vim/$(VIMRTDIR)/gvim.exe - cp xxdd32.exe dist/vim/$(VIMRTDIR)/xxd.exe - cp README_w32s.txt dist/vim/$(VIMRTDIR) - cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe - cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe - cd dist && zip -9 -rD -z gvim$(VERSION)_s.zip vim <$(COMMENT_W32S) - -os2bin: dist no_title.vim dist/$(COMMENT_OS2) - -rm -rf dist/vim$(VERSION)os2.zip - -rm -rf dist/vim - mkdir dist/vim - mkdir dist/vim/$(VIMRTDIR) - tar cf - \ - $(BIN_OS2) \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; - cp vimos2.exe dist/vim/$(VIMRTDIR)/vim.exe - cp xxdos2.exe dist/vim/$(VIMRTDIR)/xxd.exe - cp teeos2.exe dist/vim/$(VIMRTDIR)/tee.exe - cp emx.dll emxlibcs.dll dist/vim/$(VIMRTDIR) - cd dist && zip -9 -rD -z vim$(VERSION)os2.zip vim <$(COMMENT_OS2) - html: dist dist/$(COMMENT_HTML) -rm -rf dist/vim$(VERSION)html.zip cd runtime/doc && zip -9 -z ../../dist/vim$(VERSION)html.zip *.html <../../dist/$(COMMENT_HTML) diff --git a/README.md b/README.md new file mode 100644 index 0000000000..fee2f6b118 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +Vim - the text editor - for Mac OS X + +This is the official GitHub repository for MacVim, the macOS port of [vim](https://github.com/vim/vim). It is based on +[Björn Winckler's repository](https://github.com/b4winckler/macvim), which was official until he stepped down as the +maintainer of the port. + +- MacVim homepage http://macvim-dev.github.io/macvim + +- Vim README https://github.com/macvim-dev/macvim/blob/master/README_vim.md + +- Travis CI Build StatusBuild Status + diff --git a/README.txt b/README.txt index c2fc2a955a..e0132dc92a 100644 --- a/README.txt +++ b/README.txt @@ -1,26 +1,33 @@ -README.txt for version 7.4 of Vim: Vi IMproved. +README.txt for version 8.1 of Vim: Vi IMproved. -WHAT IS VIM +WHAT IS VIM? -Vim is an almost compatible version of the UNIX editor Vi. Many new features -have been added: multi-level undo, syntax highlighting, command line history, -on-line help, spell checking, filename completion, block operations, etc. -There is also a Graphical User Interface (GUI) available. See -"runtime/doc/vi_diff.txt" for differences with Vi. +Vim is a greatly improved version of the good old UNIX editor Vi. Many new +features have been added: multi-level undo, syntax highlighting, command line +history, on-line help, spell checking, filename completion, block operations, +script language, etc. There is also a Graphical User Interface (GUI) +available. Still, Vi compatibility is maintained, those who have Vi "in the +fingers" will feel at home. See "runtime/doc/vi_diff.txt" for differences with +Vi. This editor is very useful for editing programs and other plain text files. All commands are given with normal keyboard characters, so those who can type with ten fingers can work very fast. Additionally, function keys can be -defined by the user, and the mouse can be used. +mapped to commands by the user, and the mouse can be used. -Vim runs under Amiga DOS, MS-DOS, MS-Windows (95, 98, Me, NT, 2000, XP, Vista, -7), Atari MiNT, Macintosh, BeOS, VMS, RISC OS, OS/2 and almost all flavours of -UNIX. Porting to other systems should not be very difficult. +Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and +almost all flavours of UNIX. Porting to other systems should not be very +difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga +DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained. DISTRIBUTION +You can often use your favorite package manager to install Vim. On Mac and +Linux a small version of Vim is pre-installed, you still need to install Vim +if you want more features. + There are separate distributions for Unix, PC, Amiga and some other systems. This README.txt file comes with the runtime archive. It includes the documentation, syntax files and other files that are used at runtime. To run @@ -29,10 +36,38 @@ Which one you need depends on the system you want to run it on and whether you want or must compile it yourself. Check "http://www.vim.org/download.php" for an overview of currently available distributions. +Some popular places to get the latest Vim: +* Check out the git repository from github: https://github.com/vim/vim. +* Get the source code as an archive: https://github.com/vim/vim/releases. +* Get a Windows executable from the vim-win32-installer repository: + https://github.com/vim/vim-win32-installer/releases. + + +COMPILING + +If you obtained a binary distribution you don't need to compile Vim. If you +obtained a source distribution, all the stuff for compiling Vim is in the +"src" directory. See src/INSTALL for instructions. + + +INSTALLATION + +See one of these files for system-specific instructions. Either in the +READMEdir directory (in the repository) or the top directory (if you unpack an +archive): + +README_ami.txt Amiga +README_unix.txt Unix +README_dos.txt MS-DOS and MS-Windows +README_mac.txt Macintosh +README_vms.txt VMS + +There are more README_*.txt files, depending on the distribution you used. + DOCUMENTATION -The vim tutor is a one hour training course for beginners. Mostly it can be +The Vim tutor is a one hour training course for beginners. Often it can be started as "vimtutor". See ":help tutor" for more information. The best is to use ":help" in Vim. If you don't have an executable yet, read @@ -69,24 +104,9 @@ For the most recent information about sponsoring look on the Vim web site: http://www.vim.org/sponsor/ -COMPILING - -If you obtained a binary distribution you don't need to compile Vim. If you -obtained a source distribution, all the stuff for compiling Vim is in the -"src" directory. See src/INSTALL for instructions. - - -INSTALLATION +CONTRIBUTING -See one of these files for system-specific instructions: -README_ami.txt Amiga -README_unix.txt Unix -README_dos.txt MS-DOS and MS-Windows -README_os2.txt OS/2 -README_mac.txt Macintosh -README_vms.txt VMS - -There are more README_*.txt files, depending on the distribution you used. +If you would like to help making Vim better, see the CONTRIBUTING.md file. INFORMATION @@ -94,8 +114,9 @@ INFORMATION The latest news about Vim can be found on the Vim home page: http://www.vim.org/ -If you have problems, have a look at the Vim FAQ: - http://vimdoc.sf.net/vimfaq.html +If you have problems, have a look at the Vim documentation or tips: + http://www.vim.org/docs.php + http://vim.wikia.com/wiki/Vim_Tips_Wiki If you still have problems or any other questions, use one of the mailing lists to discuss them with Vim users and developers: @@ -110,6 +131,3 @@ MAIN AUTHOR Send any other comments, patches, flowers and suggestions to: Bram Moolenaar E-mail: Bram@vim.org - Finsterruetihof 1 - 8134 Adliswil - Switzerland diff --git a/README_amibin.txt b/README_amibin.txt deleted file mode 100644 index fbf5ba4c4d..0000000000 --- a/README_amibin.txt +++ /dev/null @@ -1,12 +0,0 @@ -README_amibin.txt for version 7.4 of Vim: Vi IMproved. - -See "README.txt" for general information about Vim. -See "README_ami.txt" for installation instructions for the Amiga. -These files are in the runtime archive (vim60rt.tgz). - - -The Amiga "bin" archive contains the Vim executable for the Amiga. It was -compiled with "big" features. - -Postscript printing is not included to avoid requiring floating point -computations. diff --git a/README_amisrc.txt b/README_amisrc.txt deleted file mode 100644 index ddc58be95f..0000000000 --- a/README_amisrc.txt +++ /dev/null @@ -1,11 +0,0 @@ -README_amisrc.txt for version 7.4 of Vim: Vi IMproved. - -See "README.txt" for general information about Vim. -See "README_ami.txt" for installation instructions for the Amiga. -These files are in the runtime archive (vim60rt.tgz). - - -The Amiga source archive contains the files needed to compile Vim on the -Amiga. - -See "src/INSTALLami.txt" for instructions on how to compile Vim on the Amiga. diff --git a/README_bindos.txt b/README_bindos.txt deleted file mode 100644 index 03c7c19ecf..0000000000 --- a/README_bindos.txt +++ /dev/null @@ -1,16 +0,0 @@ -README_bindos.txt for version 7.4 of Vim: Vi IMproved. - -See "README.txt" for general information about Vim. -See "README_dos.txt" for installation instructions for MS-DOS and MS-Windows. -These files are in the runtime archive (vim74rt.zip). - - -There are several binary distributions of Vim for the PC. You would normally -pick only one of them, but it's also possible to install several. -These ones are available (the version number may differ): - vim74w32.zip Windows 95/98/NT/etc. console version - gvim74.zip Windows 95/98/NT/etc. GUI version - gvim74ole.zip Windows 95/98/NT/etc. GUI version with OLE - -You MUST also get the runtime archive (vim74rt.zip). -The sources are also available (vim74src.zip). diff --git a/README_kaoriya.txt b/README_kaoriya.txt new file mode 100644 index 0000000000..54f014a026 --- /dev/null +++ b/README_kaoriya.txt @@ -0,0 +1,258 @@ + Vim version 8.0 艮 }jA + + Version: 1.9.1 + Author: MURAOKA Taro + Since: 23-Aug-1999 + Last Change: 01-Jan-2017. + +Tv + VimviN[ɕނeLXgGfB^łB + + IWiVimhttp://www.vim.org/ŌJĂÂ܂܂ł{ + ރeLXg͕ҏWł܂A艮ł͓{舵Ղ邽߂̏Cƒ + s艮łƂČJĂ܂B + + [Xɂ32bitł64bitł܂B32bit OSł͕K32bitłp + B64bit OSł64bitł32bitłǂłp܂B + +CXg[@ + zzt@CZIPɂłBzzt@CɂVimvOtH_i[ + ̂ŁA𓀂ăVXe̍DȏꏊɔzuĂB + + 32bit + zzt@C: vim80-kaoriya-win32-V.V.V-YYYYMMDD.zip + VimvOtH_: vim80-kaoriya-win32.zip + + 64bit + zzt@C: vim80-kaoriya-win64-V.V.V-YYYYMMDD.zip + VimvOtH_: vim80-kaoriya-win64 + + LV.V.Vɂ̓x[XƂȂVim̃o[Wpb`ԍ܂Ŋ܂߂ē܂B + LYYYYMMDDɂ̓[X̔N܂B + +s@ + VimvOtH_̒gvimvim_uNbNĂB + +ACXg[ (Windows) + VimvOtH_폜ĂBʂȑ͕svłB + +S҂̕ + ܂Vim̑Ɋ邽߃g[jO邱ƂIXX܂B1̃g[ + jOɂ鎞Ԃɂ͌l܂301Ԃ炢łBg[j + OJnɂVimN + + :Tutorial + + Ɠ͂ă^[L[܂BƂ͉ʂɕ\ꂽ͂ɂđ + 邱ƂŁAVim̊{IȑK邱Ƃł܂B܂ʼnxJ + ԂKƂʓIłB + +Vim̊g@\ɂ‚ + {͂łVim̊g@\̏ЉƃCXg[@ɂ‚ďqׂ܂Bg@\C + Xg[ȂĂAVimgƂ͂ł܂B + + ctagsɂ‚ + ݂Vimctags𓯍Ă܂BKvƂ͈ȉ̃TCge + CXg[ĂB + + - h_east's website (ctags{ΉŃoCizzꏊ) + http://hp.vector.co.jp/authors/VA025040/ + + - ctagsIWiTCg + http://ctags.sourceforge.net/ + + LuaƂ̘Ag + KaoriYałɂLua (LuaJIT)ohĂ̂ŁALuaC^[tF[X͎ + IɗLɂȂ܂BLuaC^[tF[X̏ڍׂɂ‚Ă":help lua"Ƃ + Vimt̃}jAQƂĂB + + - LuaJIT TCg + http://luajit.org/ + + Perl(ActivePerl)Ƃ̘Ag + : PerlCXg[ȂĂVim͎gpł܂B + + ActiveStateЂɂJĂActivePerl 5.24CXg[邱ƂŁA + PerlC^[tF[Xgp邱Ƃł܂BActivePerlCXg[ + Ȃꍇ́APerlC^[tF[X͎IɖƂȂ܂BPerlC^[ + tF[X̏ڍׂɂ‚Ă":help perl"ƂVimt̃}jAQƂĂ + B + + 64bitłVimgꍇ64bitłPerlA32bitłgꍇ32bitłPerl + CXg[ĂB + + - ActiveState (ActivePerl) + http://www.activestate.com/ + + PythonƂ̘Ag + : PythonCXg[ȂĂVim͎gpł܂B + + Python.orgɂJĂPython 2.7CXg[邱ƂŁAPythonC + ^[tF[Xgp邱Ƃł܂BPythonCXg[ĂȂꍇ + ́APythonC^[tF[X͎IɖƂȂ܂BPythonC^[tF[X + ̏ڍׂɂ‚Ă":help python"ƂVimt̃}jAQƂĂ + B + + 64bitłVimgꍇ64bitłPythonA32bitłgꍇ32bitł + PythonCXg[ĂB + + - Python.org + http://www.python.org/ + + Python 2.7.11 𗘗pꍇɂ́APython 2.7.11̃oO邽߂ɁA + ҂ƂĈȉ̃R}hsKv܂B + + - 32rbg + reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:32 + - 64rbg + reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:64 + + Q: https://github.com/vim-jp/issues/issues/843#issuecomment-189205350 + + Python3Ƃ̘Ag + : Python3CXg[ȂĂVim͎gpł܂B + + Python.orgɂJĂPython 3.5CXg[邱ƂŁAPythonC + ^[tF[Xgp邱Ƃł܂BPythonCXg[ĂȂꍇ + ́APythonC^[tF[X͎IɖƂȂ܂BPythonC^[tF[X + ̏ڍׂɂ‚Ă":help python3"ƂVimt̃}jAQƂĂ + B + + 64bitłVimgꍇ64bitłPython3A32bitłgꍇ32bitł + Python3CXg[ĂB + + - Python.org + http://www.python.org/ + + RubyƂ̘Ag + : RubyCXg[ȂĂVim͎gpł܂B + + Ruby 2.3.1CXg[RubyC^[tF[X𗘗pł܂BRubyC + Xg[ĂȂꍇRubyC^[tF[X͎IɖƂȂ܂B + RubyC^[tF[X̏ڍׂɂ‚Ă":help ruby"ƂVimt̃}jA + QƂĂB + + 64bitłVimgꍇ64bitłRubyA32bitłgꍇ32bitł + RubyCXg[ĂB + + - Ruby zzTCg + http://rubyinstaller.org/ + - RubySʂ̏ + http://www.ruby-lang.org/ja/ + +gp + 艮ł̃CZX̓IWiVimɏ]܂Bڂorigdoc/README.txt + B + + Vim̓`eB[EFAƏ̂Ă܂AI[v\[Xł薳Ŏgp + Ƃł܂BVim̗pɍۂđΉxƍl̂Ȃ΁A + EK_̌ǎB邽߂̊t肢܂B + + ȒP()t̕@ + COCD{𒍕ۂɈȉ̃NoRčw邱ƂŁA̔ + ̉p[Zgt܂Bw҂ɂ͐K̑ȊO̕S͂܂ + BmȂǂp̍ۂɂ́AiłpB + + - ɂt + http://iccf-holland.org/click.html + + VimJX|T[x + VimJX|T[xƋ@\v][xn܂܂BLuVim̊Jɂ + oBramɊJ֐OĂ炨Ƃ|łBo҂ɂ͌Ԃ + @\v][̌^܂Bŋ߂łfoldingł悤ɁA + ̋@\v][ő̕[W߂@\D悵Ď܂Bo1 + 10[ȏォŁAPayPalʂăNWbgJ[hɂ錈ς”\łB + t\邱Ƃ܂Ȃ΁A100[ȏtꍇ + ɂ́uHall of honourvɌfڂ܂Bڍׂ͈ȉURLQƂĂB + + - Sponsor Vim development + http://www.vim.org/sponsor/index.php + +IWiƂ̑_ + \[X + patchtH_ɍ𓯍Ă܂B̎geɊւ鎿R + gȂǂ܂獁艮Ńei܂ŘAB\[X1s1sɎ + ܂ł̌؂劽}܂B + + ȉ̃|Wgł͓pb`̍ŐVłJĂ܂B + + - vim-kaoriya-patches: +kaoriyapb` + https://github.com/koron/vim-kaoriya-patches + + patchtH_yvim-kaoriya-patches̖OXŎn܂pb`͔Ɏ + IȂ̂łJłɂ͓KpĂ܂B̂䗗B + + gitɂ\[Xƃpb`̓@ + 艮ł̃\[XR[h(yуpb`)github|Wg擾ɂ͈ȉ + TCgQlɂĂB + + - vim-kaoriya: rhpXNvg + https://github.com/koron/vim-kaoriya + +m̖_ + * qkc-njtOŃRo[gJISt@C͊JȂ(iconv.dll) + * scrolloff̒x̎Aւ̃XN[2sPʂɂȂ + +EA + {Vim[UGoogleO[v(vim_jp)pӂĂ܂BǂȂɊȒP + ȂƂł킩ȂƂ̂Ȃ΂ŕĂ݂Ɨǂł傤B + 炩̏ɂ͂Ȃ͂łB + + http://groups.google.com/group/vim_jp/?hl=ja + + 񃁁[ō艮ŃeiɒڕĂĂ\܂B{ꉻ + Ȃǂ̕ss͍艮Ńei܂ŘA΁A܂݂ďC + B + + Vim{̂ɑƎvssɂ‚ẮAVim{Ƃ̂ق։pŘA + A艮Ńeiɖ₢킹ĂB}Iɏuł̂ł΂ + ܂AłȂÂȂpɂȂ܂Vim{ƂփtB[hob + Nł邩܂BVim{œ̊֘A͎URLɂ܂B + + - Vim{ + http://www.vim.org/ + https://github.com/vim/vim + - Vim̓{R~jeBvim-jp + http://vim-jp.org/ + https://github.com/vim-jp/issues/issues (oO񍐁A@\v]) + - vim_jp Google O[v + http://groups.google.com/group/vim_jp/?hl=ja + - {hLg + https://github.com/vim-jp/vimdoc-ja/ + https://github.com/vim-jp/vimdoc-ja-working/ + https://github.com/vim-jp/lang-ja/ + - 艮Ńei + https://github.com/koron/vim-kaoriya/ + MURAOKA Taro + Twitter @kaoriya + +ӎ + Af炵GfB^łVimt[\tgEFAƂČJ&ǗA + ̓{ł̌JĂBram Moolenaarɍő̊ӂ + ܂B܂A̔zzpbP[Wɂ͈ȉ̕Xɂt@CEhLg + ܂Ă܂Bč艮ł̍쐬Ɋ֘AāA̕XlXȃACfA + oO񍐂܂BFl͂肪Ƃ܂B + + (At@xbg) + - 215 (Vimf:1587) + autodate.vim̉phLgY + - FUJITA Yasuhiro + runtime/keymap/tcode_cp932.vim (}bvCElj) + - KIHARA, Hideto + runtime/keymap/tutcode_cp932.vim + - MATSUMOTO Yasuhiro + diffs/ (ꕔR[hp/AhoCX/Vђ) + googletranslate.vim + - NAKADAIRA Yukihiro + plugins/autofmt + - NISHIOKA Takuhiro + runtime/plugin/format.vim (Vim6Ή) + - TAKASUKA Yoshihiro + runtime/keymap/tcode_cp932.vim + + đĂVim[UɁB + +------------------------------------------------------------------------------ + 鎖ւ̋ӎuɎƈقȂ鐶ԐSƂȂ + MURAOKA Taro + vim:set ts=8 sts=2 sw=2 tw=78 et ft=memo: diff --git a/README_mac.txt b/README_mac.txt deleted file mode 100644 index 92d0c35e12..0000000000 --- a/README_mac.txt +++ /dev/null @@ -1,38 +0,0 @@ -README_mac.txt for version 7.4 of Vim: Vi IMproved. - -This file explains the installation of MacVim. -See "README.txt" for general information about Vim. -See "src/MacVim/README" for an overview of the MacVim specific source code. - -MacVim uses the usual configure/make steps to build the binary but instead of -"make install" you just drag the app bundle into the directory you wish to -install in (usually `/Applications'). - - -How to build and install -======================== - -Run `./configure` in the `src/` directory with the flags you want (call -`./configure --help` to see a list of flags) e.g.: - - $ cd src - $ ./configure --with-features=huge \ - --enable-rubyinterp \ - --enable-pythoninterp \ - --enable-perlinterp \ - --enable-cscope - -Now build the project using `make`: - - $ make - -The resulting app bundle will reside under `MacVim/build/Release`. To try it -out quickly, type: - - $ open MacVim/build/Release/MacVim.app - -To install MacVim, type - - $ open MacVim/build/Release - -and drag the MacVim icon into your `Applications` folder. diff --git a/README_os2.txt b/README_os2.txt deleted file mode 100644 index 5602706e71..0000000000 --- a/README_os2.txt +++ /dev/null @@ -1,58 +0,0 @@ -README_os2.txt for version 7.4 of Vim: Vi IMproved. - -This file explains the installation of Vim on OS/2 systems. -See "README.txt" for general information about Vim. - - -NOTE: You will need two archives: - vim74rt.zip contains the runtime files (same as for the PC version) - vim74os2.zip contains the OS/2 executables - -1. Go to the directory where you want to put the Vim files. Examples: - cd C:\ - cd D:\editors - -2. Unpack the zip archives. This will create a new directory "vim/vim74", - in which all the distributed Vim files are placed. Since the directory - name includes the version number, it is unlikely that you overwrite - existing files. - Examples: - pkunzip -d vim74os2.zip - unzip vim74os2.zip - - After you unpacked the files, you can still move the whole directory tree - to another location. - -3. Add the directory where vim.exe is to your path. The simplest is to add a - line to your autoexec.bat. Examples: - set path=%path%;C:\vim\vim74 - set path=%path%;D:\editors\vim\vim74 - -That's it! - - -Extra remarks: - -- To avoid confusion between distributed files of different versions and your - own modified vim scripts, it is recommended to use this directory layout: - ("C:\vim" is used here as the root, replace with the path you use) - Your own files: - C:\vim\_vimrc Your personal vimrc. - C:\vim\_viminfo Dynamic info for 'viminfo'. - C:\vim\... Other files you made. - Distributed files: - C:\vim\vim74\vim.exe The Vim version 7.4 executable. - C:\vim\vim74\doc\*.txt The version 7.4 documentation files. - C:\vim\vim74\bugreport.vim A Vim version 7.4 script. - C:\vim\vim74\... Other version 7.4 distributed files. - In this case the $VIM environment variable would be set like this: - set VIM=C:\vim - -- You can put your Vim executable anywhere else. If the executable is not - with the other distributed Vim files, you should set $VIM. The simplest is - to add a line to your autoexec.bat. Examples: - set VIM=c:\vim - set VIM=d:\editors\vim - -For further information, type this inside Vim: - :help os2 diff --git a/README_src.txt b/README_src.txt deleted file mode 100644 index 3af95f23c7..0000000000 --- a/README_src.txt +++ /dev/null @@ -1,8 +0,0 @@ -README_src.txt for version 7.4 of Vim: Vi IMproved. - -The source archive contains the files needed to compile Vim on Unix systems. -It is packed for Unix systems (NL line separator). - -For more information, see the README.txt file that comes with the runtime -archive (vim-7.4-rt.tar.gz). To be able to run Vim you MUST get the runtime -archive too! diff --git a/README_vim.md b/README_vim.md new file mode 100644 index 0000000000..71bc498504 --- /dev/null +++ b/README_vim.md @@ -0,0 +1,136 @@ +`README.md` for version 8.0 of Vim: Vi IMproved. +[![Build Status](https://travis-ci.org/vim/vim.svg?branch=master)](https://travis-ci.org/vim/vim) +[![Coverage Status](https://coveralls.io/repos/vim/vim/badge.svg?branch=master&service=github)](https://coveralls.io/github/vim/vim?branch=master) +[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/o2qht2kjm02sgghk?svg=true)](https://ci.appveyor.com/project/chrisbra/vim) +[![Coverity Scan](https://scan.coverity.com/projects/241/badge.svg)](https://scan.coverity.com/projects/vim) + + +## What is Vim? ## + +Vim is a greatly improved version of the good old UNIX editor Vi. Many new +features have been added: multi-level undo, syntax highlighting, command line +history, on-line help, spell checking, filename completion, block operations, +script language, etc. There is also a Graphical User Interface (GUI) +available. Still, Vi compatibility is maintained, those who have Vi "in the +fingers" will feel at home. See `runtime/doc/vi_diff.txt` for differences with +Vi. + +This editor is very useful for editing programs and other plain text files. +All commands are given with normal keyboard characters, so those who can type +with ten fingers can work very fast. Additionally, function keys can be +mapped to commands by the user, and the mouse can be used. + +Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and +almost all flavours of UNIX. Porting to other systems should not be very +difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga +DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained. + + +## Distribution ## + +You can often use your favorite package manager to install Vim. On Mac and +Linux a small version of Vim is pre-installed, you still need to install Vim +if you want more features. + +There are separate distributions for Unix, PC, Amiga and some other systems. +This `README.md` file comes with the runtime archive. It includes the +documentation, syntax files and other files that are used at runtime. To run +Vim you must get either one of the binary archives or a source archive. +Which one you need depends on the system you want to run it on and whether you +want or must compile it yourself. Check http://www.vim.org/download.php for +an overview of currently available distributions. + +Some popular places to get the latest Vim: +* Check out the git repository from [github](https://github.com/vim/vim). +* Get the source code as an [archive](https://github.com/vim/vim/releases). +* Get a Windows executable from the +[vim-win32-installer](https://github.com/vim/vim-win32-installer/releases) repository. + + + +## Compiling ## + +If you obtained a binary distribution you don't need to compile Vim. If you +obtained a source distribution, all the stuff for compiling Vim is in the +`src` directory. See `src/INSTALL` for instructions. + + +## Installation ## + +See one of these files for system-specific instructions. Either in the +READMEdir directory (in the repository) or the top directory (if you unpack an +archive): + + README_ami.txt Amiga + README_unix.txt Unix + README_dos.txt MS-DOS and MS-Windows + README_mac.txt Macintosh + README_vms.txt VMS + +There are other `README_*.txt` files, depending on the distribution you used. + + +## Documentation ## + +The Vim tutor is a one hour training course for beginners. Often it can be +started as `vimtutor`. See `:help tutor` for more information. + +The best is to use `:help` in Vim. If you don't have an executable yet, read +`runtime/doc/help.txt`. It contains pointers to the other documentation +files. The User Manual reads like a book and is recommended to learn to use +Vim. See `:help user-manual`. + + +## Copying ## + +Vim is Charityware. You can use and copy it as much as you like, but you are +encouraged to make a donation to help orphans in Uganda. Please read the file +`runtime/doc/uganda.txt` for details (do `:help uganda` inside Vim). + +Summary of the license: There are no restrictions on using or distributing an +unmodified copy of Vim. Parts of Vim may also be distributed, but the license +text must always be included. For modified versions a few restrictions apply. +The license is GPL compatible, you may compile Vim with GPL libraries and +distribute it. + + +## Sponsoring ## + +Fixing bugs and adding new features takes a lot of time and effort. To show +your appreciation for the work and motivate Bram and others to continue +working on Vim please send a donation. + +Since Bram is back to a paid job the money will now be used to help children +in Uganda. See `runtime/doc/uganda.txt`. But at the same time donations +increase Bram's motivation to keep working on Vim! + +For the most recent information about sponsoring look on the Vim web site: + http://www.vim.org/sponsor/ + + +## Contributing ## + +If you would like to help making Vim better, see the [CONTRIBUTING.md](https://github.com/vim/vim/blob/master/CONTRIBUTING.md) file. + + +## Information ## + +The latest news about Vim can be found on the Vim home page: + http://www.vim.org/ + +If you have problems, have a look at the Vim documentation or tips: + http://www.vim.org/docs.php + http://vim.wikia.com/wiki/Vim_Tips_Wiki + +If you still have problems or any other questions, use one of the mailing +lists to discuss them with Vim users and developers: + http://www.vim.org/maillist.php + +If nothing else works, report bugs directly: + Bram Moolenaar + + +## Main author ## + +Send any other comments, patches, flowers and suggestions to: + Bram Moolenaar diff --git a/Contents b/READMEdir/Contents similarity index 77% rename from Contents rename to READMEdir/Contents index e34ae25600..822eb2c5d9 100644 --- a/Contents +++ b/READMEdir/Contents @@ -9,15 +9,15 @@ Vim Vi IMproved. A clone of the UNIX text editor Vi. Very useful messages, shows current file name in window title, on-line help, rectangular cut/paste, etc., etc., etc... - Version 7.4. Also runs under UNIX, MSDOS and other systems. - vim74rt.tgz contains the documentation and syntax files. - vim74bin.tgz contains the binaries. - vim74src.tgz contains the sources. + Version 8.1. Also runs under UNIX, MS-Windows, Mac, etc. + vim81rt.tgz contains the documentation and syntax files. + vim81bin.tgz contains the binaries. + vim81src.tgz contains the sources. Author: Bram Moolenaar et al. Xxd Hex dumper and reader. Can be used to view files as hex, edit them and write them back. Can also be used to patch files. - Version 1.8 (1997 May 22) + Version 1.10 (1997 May 22) Author: Juergen Weigert diff --git a/Contents.info b/READMEdir/Contents.info old mode 100755 new mode 100644 similarity index 100% rename from Contents.info rename to READMEdir/Contents.info diff --git a/README.txt.info b/READMEdir/README.txt.info old mode 100755 new mode 100644 similarity index 100% rename from README.txt.info rename to READMEdir/README.txt.info diff --git a/README_ami.txt b/READMEdir/README_ami.txt similarity index 92% rename from README_ami.txt rename to READMEdir/README_ami.txt index 03cb6e24ab..fc9a30d428 100644 --- a/README_ami.txt +++ b/READMEdir/README_ami.txt @@ -1,4 +1,4 @@ -README_ami.txt for version 7.4 of Vim: Vi IMproved. +README_ami.txt for version 8.1 of Vim: Vi IMproved. This file explains the installation of Vim on Amiga systems. See README.txt for general information about Vim. @@ -16,8 +16,8 @@ easily upgrade to a new version. For example: You would then unpack the archives like this: cd dh0:editors - tar xf t:vim60bin.tar - tar xf t:vim60rt.tar + tar xf t:vim81bin.tar + tar xf t:vim81rt.tar Set the $VIM environment variable to point to the top directory of your Vim files. For the above example: diff --git a/README_ami.txt.info b/READMEdir/README_ami.txt.info old mode 100755 new mode 100644 similarity index 100% rename from README_ami.txt.info rename to READMEdir/README_ami.txt.info diff --git a/READMEdir/README_amibin.txt b/READMEdir/README_amibin.txt new file mode 100644 index 0000000000..5b9b02f926 --- /dev/null +++ b/READMEdir/README_amibin.txt @@ -0,0 +1,12 @@ +README_amibin.txt for version 8.1 of Vim: Vi IMproved. + +See "README.txt" for general information about Vim. +See "README_ami.txt" for installation instructions for the Amiga. +These files are in the runtime archive (vim81rt.tgz). + + +The Amiga "bin" archive contains the Vim executable for the Amiga. It was +compiled with "big" features. + +Postscript printing is not included to avoid requiring floating point +computations. diff --git a/README_amibin.txt.info b/READMEdir/README_amibin.txt.info old mode 100755 new mode 100644 similarity index 100% rename from README_amibin.txt.info rename to READMEdir/README_amibin.txt.info diff --git a/READMEdir/README_amisrc.txt b/READMEdir/README_amisrc.txt new file mode 100644 index 0000000000..966bd34088 --- /dev/null +++ b/READMEdir/README_amisrc.txt @@ -0,0 +1,11 @@ +README_amisrc.txt for version 8.1 of Vim: Vi IMproved. + +See "README.txt" for general information about Vim. +See "README_ami.txt" for installation instructions for the Amiga. +These files are in the runtime archive (vim81rt.tgz). + + +The Amiga source archive contains the files needed to compile Vim on the +Amiga. + +See "src/INSTALLami.txt" for instructions on how to compile Vim on the Amiga. diff --git a/README_amisrc.txt.info b/READMEdir/README_amisrc.txt.info old mode 100755 new mode 100644 similarity index 100% rename from README_amisrc.txt.info rename to READMEdir/README_amisrc.txt.info diff --git a/READMEdir/README_bindos.txt b/READMEdir/README_bindos.txt new file mode 100644 index 0000000000..7d10a6ffcc --- /dev/null +++ b/READMEdir/README_bindos.txt @@ -0,0 +1,16 @@ +README_bindos.txt for version 8.1 of Vim: Vi IMproved. + +See "README.txt" for general information about Vim. +See "README_dos.txt" for installation instructions for MS-DOS and MS-Windows. +These files are in the runtime archive (vim81rt.zip). + + +There are several binary distributions of Vim for the PC. You would normally +pick only one of them, but it's also possible to install several. +These ones are available (the version number may differ): + vim81w32.zip Windows 95/98/NT/etc. console version + gvim81.zip Windows 95/98/NT/etc. GUI version + gvim81ole.zip Windows 95/98/NT/etc. GUI version with OLE + +You MUST also get the runtime archive (vim81rt.zip). +The sources are also available (vim81src.zip). diff --git a/README_dos.txt b/READMEdir/README_dos.txt similarity index 88% rename from README_dos.txt rename to READMEdir/README_dos.txt index 662a7e785b..ac6f090afe 100644 --- a/README_dos.txt +++ b/READMEdir/README_dos.txt @@ -1,4 +1,4 @@ -README_dos.txt for version 7.4 of Vim: Vi IMproved. +README_dos.txt for version 8.1 of Vim: Vi IMproved. This file explains the installation of Vim on MS-DOS and MS-Windows systems. See "README.txt" for general information about Vim. @@ -41,19 +41,19 @@ These are the normal steps to install Vim from the .zip archives: located. Check the $VIM setting to see where it points to: set VIM For example, if you have - C:\vim\vim54 + C:\vim\vim81 do cd C:\ Binary and runtime Vim archives are normally unpacked in the same location, on top of each other. -2. Unpack the zip archives. This will create a new directory "vim\vim74", +2. Unpack the zip archives. This will create a new directory "vim\vim81", in which all the distributed Vim files are placed. Since the directory name includes the version number, it is unlikely that you overwrite existing files. Examples: - pkunzip -d gvim74.zip - unzip vim74w32.zip + pkunzip -d gvim81.zip + unzip vim81w32.zip You need to unpack the runtime archive and at least one of the binary archives. When using more than one binary version, be careful not to @@ -69,7 +69,7 @@ These are the normal steps to install Vim from the .zip archives: archive and follow the instructions in the documentation. 3. Change to the new directory: - cd vim\vim74 + cd vim\vim81 Run the "install.exe" program. It will ask you a number of questions about how you would like to have your Vim setup. Among these are: - You can tell it to write a "_vimrc" file with your preferences in the @@ -80,8 +80,8 @@ These are the normal steps to install Vim from the .zip archives: console or in a shell. You can select one of the directories in your $PATH. If you skip this, you can add Vim to the search path manually: The simplest is to add a line to your autoexec.bat. Examples: - set path=%path%;C:\vim\vim74 - set path=%path%;D:\editors\vim\vim74 + set path=%path%;C:\vim\vim81 + set path=%path%;D:\editors\vim\vim81 - Create entries for Vim on the desktop and in the Start menu. That's it! @@ -93,8 +93,8 @@ Remarks: won't show a menubar. Then you need to set the $VIM environment variable to point to the top directory of your Vim files. Example: set VIM=C:\editors\vim - Vim version 7.4 will look for your vimrc file in $VIM, and for the runtime - files in $VIM/vim74. See ":help $VIM" for more information. + Vim version 8.1 will look for your vimrc file in $VIM, and for the runtime + files in $VIM/vim81. See ":help $VIM" for more information. - To avoid confusion between distributed files of different versions and your own modified vim scripts, it is recommended to use this directory layout: @@ -105,14 +105,14 @@ Remarks: C:\vim\vimfiles\ftplugin\*.vim Filetype plugins C:\vim\... Other files you made. Distributed files: - C:\vim\vim74\vim.exe The Vim version 7.4 executable. - C:\vim\vim74\doc\*.txt The version 7.4 documentation files. - C:\vim\vim74\bugreport.vim A Vim version 7.4 script. - C:\vim\vim74\... Other version 7.4 distributed files. + C:\vim\vim81\vim.exe The Vim version 8.1 executable. + C:\vim\vim81\doc\*.txt The version 8.1 documentation files. + C:\vim\vim81\bugreport.vim A Vim version 8.1 script. + C:\vim\vim81\... Other version 8.1 distributed files. In this case the $VIM environment variable would be set like this: set VIM=C:\vim - Then $VIMRUNTIME will automatically be set to "$VIM\vim74". Don't add - "vim74" to $VIM, that won't work. + Then $VIMRUNTIME will automatically be set to "$VIM\vim81". Don't add + "vim81" to $VIM, that won't work. - You can put your Vim executable anywhere else. If the executable is not with the other Vim files, you should set $VIM. The simplest is to add a line @@ -136,8 +136,8 @@ Remarks: Select Properties. 5. In the Program tab, change the "Cmdline" to add "/c" and the name of the Vim executable. Examples: - C:\command.com /c C:\vim\vim74\vim.exe - C:\command.com /c D:\editors\vim\vim74\vim.exe + C:\command.com /c C:\vim\vim81\vim.exe + C:\command.com /c D:\editors\vim\vim81\vim.exe 6. Select the font, window size, etc. that you like. If this isn't possible, select "Advanced" in the Program tab, and deselect "MS-DOS mode". diff --git a/README_extra.txt b/READMEdir/README_extra.txt similarity index 96% rename from README_extra.txt rename to READMEdir/README_extra.txt index f16e7c0190..0b53b4ce7b 100644 --- a/README_extra.txt +++ b/READMEdir/README_extra.txt @@ -1,4 +1,4 @@ -README_extra.txt for version 7.4 of Vim: Vi IMproved. +README_extra.txt for version 8.1 of Vim: Vi IMproved. These extra files of Vim are for special purposes. This README explains what the files are for. For general information about Vim, see the "README.txt" diff --git a/READMEdir/README_mac.txt b/READMEdir/README_mac.txt new file mode 100644 index 0000000000..2ad5c8ae5a --- /dev/null +++ b/READMEdir/README_mac.txt @@ -0,0 +1,13 @@ +README_mac.txt for version 8.1 of Vim: Vi IMproved. + +How to install MacVim? +======================== + +Download MacVim.dmg from latest binary release page https://github.com/macvim-dev/macvim/releases/latest , open the dmg file, and copy MacVim.app to /Applications. + + +Questions? +======================== + +Please take a look at the home page http://macvim-dev.github.io/macvim/ + diff --git a/README_ole.txt b/READMEdir/README_ole.txt similarity index 94% rename from README_ole.txt rename to READMEdir/README_ole.txt index 233c0532f4..4c7e645438 100644 --- a/README_ole.txt +++ b/READMEdir/README_ole.txt @@ -1,4 +1,4 @@ -README_ole.txt for version 7.4 of Vim: Vi IMproved. +README_ole.txt for version 8.1 of Vim: Vi IMproved. This archive contains gvim.exe with OLE interface and VisVim. This version of gvim.exe can also load a number of interface dynamically (you diff --git a/READMEdir/README_os2.txt b/READMEdir/README_os2.txt new file mode 100644 index 0000000000..7d9c5ce77f --- /dev/null +++ b/READMEdir/README_os2.txt @@ -0,0 +1,5 @@ +README_os2.txt for version 8.1 of Vim: Vi IMproved. + +This file used to explain the installation of Vim on OS/2 systems. +However, support for OS/2 has been removed in patch 7.4.1008. +See "README.txt" for general information about Vim. diff --git a/README_os390.txt b/READMEdir/README_os390.txt similarity index 96% rename from README_os390.txt rename to READMEdir/README_os390.txt index 502b6f8b17..24c668c17d 100644 --- a/README_os390.txt +++ b/READMEdir/README_os390.txt @@ -1,4 +1,4 @@ -README_zOS.txt for version 7.4 of Vim: Vi IMproved. +README_zOS.txt for version 8.1 of Vim: Vi IMproved. This readme explains how to build Vim on z/OS. Formerly called OS/390. See "README.txt" for general information about Vim. @@ -78,7 +78,7 @@ Change to the vim directory and do: With X11: --------- -WARNING: This instruction was not tested with Vim 7.4. +WARNING: This instruction was not tested with Vim 7.4 or later. There are two ways for building VIM with X11 support. The first way is simple and results in a big executable (~13 Mb), the second needs a few additional diff --git a/READMEdir/README_src.txt b/READMEdir/README_src.txt new file mode 100644 index 0000000000..89b83570e1 --- /dev/null +++ b/READMEdir/README_src.txt @@ -0,0 +1,8 @@ +README_src.txt for version 8.1 of Vim: Vi IMproved. + +The source archive contains the files needed to compile Vim on Unix systems. +It is packed for Unix systems (NL line separator). + +For more information, see the README.txt file that comes with the runtime +archive (vim-8.1-rt.tar.gz). To be able to run Vim you MUST get the runtime +archive too! diff --git a/README_srcdos.txt b/READMEdir/README_srcdos.txt similarity index 77% rename from README_srcdos.txt rename to READMEdir/README_srcdos.txt index 1b7cbcf5cb..6acb65265a 100644 --- a/README_srcdos.txt +++ b/READMEdir/README_srcdos.txt @@ -1,8 +1,8 @@ -README_srcdos.txt for version 7.4 of Vim: Vi IMproved. +README_srcdos.txt for version 8.1 of Vim: Vi IMproved. See "README.txt" for general information about Vim. See "README_dos.txt" for installation instructions for MS-DOS and MS-Windows. -These files are in the runtime archive (vim74rt.zip). +These files are in the runtime archive (vim81rt.zip). The DOS source archive contains the files needed to compile Vim on MS-DOS or diff --git a/README_unix.txt b/READMEdir/README_unix.txt similarity index 85% rename from README_unix.txt rename to READMEdir/README_unix.txt index 7aff642c6c..ab8d18848f 100644 --- a/README_unix.txt +++ b/READMEdir/README_unix.txt @@ -1,4 +1,4 @@ -README_unix.txt for version 7.4 of Vim: Vi IMproved. +README_unix.txt for version 8.1 of Vim: Vi IMproved. This file explains the installation of Vim on Unix systems. See "README.txt" for general information about Vim. diff --git a/README_vms.txt b/READMEdir/README_vms.txt similarity index 97% rename from README_vms.txt rename to READMEdir/README_vms.txt index 53364a127e..c1c76137a9 100644 --- a/README_vms.txt +++ b/READMEdir/README_vms.txt @@ -1,4 +1,4 @@ -README_vms.txt for version 7.4 of Vim: Vi IMproved. +README_vms.txt for version 8.1 of Vim: Vi IMproved. This file explains the installation of Vim on VMS systems. See "README.txt" in the runtime archive for information about Vim. diff --git a/README_w32s.txt b/READMEdir/README_w32s.txt similarity index 91% rename from README_w32s.txt rename to READMEdir/README_w32s.txt index 0b5d1aee01..c4f9a0cecf 100644 --- a/README_w32s.txt +++ b/READMEdir/README_w32s.txt @@ -1,4 +1,4 @@ -README_w32s.txt for version 7.4 of Vim: Vi IMproved. +README_w32s.txt for version 8.1 of Vim: Vi IMproved. This archive contains the gvim.exe that was specifically compiled for use in the Win32s subsystem in MS-Windows 3.1 and 3.11. diff --git a/Vim.info b/READMEdir/Vim.info old mode 100755 new mode 100644 similarity index 100% rename from Vim.info rename to READMEdir/Vim.info diff --git a/Xxd.info b/READMEdir/Xxd.info old mode 100755 new mode 100644 similarity index 100% rename from Xxd.info rename to READMEdir/Xxd.info diff --git a/runtime.info b/READMEdir/runtime.info old mode 100755 new mode 100644 similarity index 100% rename from runtime.info rename to READMEdir/runtime.info diff --git a/src.info b/READMEdir/src.info old mode 100755 new mode 100644 similarity index 100% rename from src.info rename to READMEdir/src.info diff --git a/vimdir.info b/READMEdir/vimdir.info old mode 100755 new mode 100644 similarity index 100% rename from vimdir.info rename to READMEdir/vimdir.info diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..bdeb1621fd --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,33 @@ +version: "{build}" + +skip_tags: true + +environment: + matrix: + - FEATURE: HUGE + - FEATURE: NORMAL +# disabled +# - FEATURE: TINY +# - FEATURE: SMALL +# - FEATURE: BIG + +matrix: + fast_finish: true + +before_build: + - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release' + - 'set INCLUDE=%INCLUDE%C:\Program Files (x86)\Windows Kits\8.1\Include\um' + +build_script: + - src/appveyor.bat + +test_script: + - cd src/testdir + # Testing with MSVC gvim + - path C:\Python35-x64;%PATH% + - nmake -f Make_dos.mak VIMPROG=..\gvim + - nmake -f Make_dos.mak clean + # Testing with MingW console version + - nmake -f Make_dos.mak VIMPROG=..\vim + +# vim: sw=2 sts=2 et ts=8 sr diff --git a/csdpmi4b.zip b/csdpmi4b.zip deleted file mode 100755 index 211396fae1..0000000000 Binary files a/csdpmi4b.zip and /dev/null differ diff --git a/gvimrc b/gvimrc new file mode 100644 index 0000000000..d837273382 --- /dev/null +++ b/gvimrc @@ -0,0 +1,177 @@ +scriptencoding utf-8 +" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照) +" +" An example for a Japanese version gvimrc file. +" 日本語版のデフォルトGUI設定ファイル(gvimrc) - Vim 7.4 +" +" Last Change: 26-Mar-2017. +" Maintainer: MURAOKA Taro +" +" 解説: +" このファイルにはVimの起動時に必ず設定される、GUI関連の設定が書かれていま +" す。編集時の挙動に関する設定はvimrcに書かかれています。 +" +" 個人用設定は_gvimrcというファイルを作成しそこで行ないます。_gvimrcはこの +" ファイルの後に読込まれるため、ここに書かれた内容を上書きして設定することが +" 出来ます。_gvimrcは$HOMEまたは$VIMに置いておく必要があります。$HOMEは$VIM +" よりも優先され、$HOMEでみつかった場合$VIMは読込まれません。 +" +" 管理者向けに本設定ファイルを直接書き換えずに済ませることを目的として、サイ +" トローカルな設定を別ファイルで行なえるように配慮してあります。Vim起動時に +" サイトローカルな設定ファイル($VIM/gvimrc_local.vim)が存在するならば、本設 +" 定ファイルの主要部分が読み込まれる前に自動的に読み込みます。 +" +" 読み込み後、変数g:gvimrc_local_finishが非0の値に設定されていた場合には本設 +" 定ファイルに書かれた内容は一切実行されません。デフォルト動作を全て差し替え +" たい場合に利用して下さい。 +" +" 参考: +" :help gvimrc +" :echo $HOME +" :echo $VIM +" :version + +"--------------------------------------------------------------------------- +" サイトローカルな設定($VIM/gvimrc_local.vim)があれば読み込む。読み込んだ後 +" に変数g:gvimrc_local_finishに非0な値が設定されていた場合には、それ以上の設 +" 定ファイルの読込を中止する。 +if 1 && filereadable($VIM . '/gvimrc_local.vim') + source $VIM/gvimrc_local.vim + if exists('g:gvimrc_local_finish') && g:gvimrc_local_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" ユーザ優先設定($HOME/.gvimrc_first.vim)があれば読み込む。読み込んだ後に変 +" 数g:gvimrc_first_finishに非0な値が設定されていた場合には、それ以上の設定 +" ファイルの読込を中止する。 +if 1 && exists('$HOME') && filereadable($HOME . '/.gvimrc_first.vim') + unlet! g:gvimrc_first_finish + source $HOME/.gvimrc_first.vim + if exists('g:gvimrc_first_finish') && g:gvimrc_first_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" Bram氏の提供する設定例をインクルード (別ファイル:vimrc_example.vim)。これ +" 以前にg:no_gvimrc_exampleに非0な値を設定しておけばインクルードしない。 +if 1 && (!exists('g:no_gvimrc_example') || g:no_gvimrc_example == 0) + source $VIMRUNTIME/gvimrc_example.vim +endif + +"--------------------------------------------------------------------------- +" カラー設定: +colorscheme morning + +"--------------------------------------------------------------------------- +" フォント設定: +" +if has('win32') + " Windows用 + set guifont=MS_Gothic:h12:cSHIFTJIS + "set guifont=MS_Mincho:h12:cSHIFTJIS + " 行間隔の設定 + set linespace=1 + " 一部のUCS文字の幅を自動計測して決める + if has('kaoriya') + set ambiwidth=auto + endif +elseif has('mac') + set guifont=Osaka-等幅:h14 +elseif has('xfontset') + " UNIX用 (xfontsetを使用) + set guifontset=a14,r14,k14 +endif + +"--------------------------------------------------------------------------- +" ウインドウに関する設定: +" +" ウインドウの幅 +set columns=80 +" ウインドウの高さ +set lines=25 +" コマンドラインの高さ(GUI使用時) +set cmdheight=2 +" 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる) +"colorscheme evening " (GUI使用時) + +"--------------------------------------------------------------------------- +" 日本語入力に関する設定: +" +if has('multi_byte_ime') || has('xim') + " IME ON時のカーソルの色を設定(設定例:紫) + highlight CursorIM guibg=Purple guifg=NONE + " 挿入モード・検索モードでのデフォルトのIME状態設定 + set iminsert=0 imsearch=0 + if has('xim') && has('GUI_GTK') + " XIMの入力開始キーを設定: + " 下記の s-space はShift+Spaceの意味でkinput2+canna用設定 + "set imactivatekey=s-space + endif + " 挿入モードでのIME状態を記憶させない場合、次行のコメントを解除 + "inoremap :set iminsert=0 +endif + +"--------------------------------------------------------------------------- +" マウスに関する設定: +" +" 解説: +" mousefocusは幾つか問題(一例:ウィンドウを分割しているラインにカーソルがあっ +" ている時の挙動)があるのでデフォルトでは設定しない。Windowsではmousehide +" が、マウスカーソルをVimのタイトルバーに置き日本語を入力するとチラチラする +" という問題を引き起す。 +" +" どのモードでもマウスを使えるようにする +set mouse=a +" マウスの移動でフォーカスを自動的に切替えない (mousefocus:切替る) +set nomousefocus +" 入力時にマウスポインタを隠す (nomousehide:隠さない) +set mousehide +" ビジュアル選択(D&D他)を自動的にクリップボードへ (:help guioptions_a) +"set guioptions+=a + +"--------------------------------------------------------------------------- +" メニューに関する設定: +" +" 解説: +" "M"オプションが指定されたときはメニュー("m")・ツールバー("T")供に登録され +" ないので、自動的にそれらの領域を削除するようにした。よって、デフォルトのそ +" れらを無視してユーザが独自の一式を登録した場合には、それらが表示されないと +" いう問題が生じ得る。しかしあまりにレアなケースであると考えられるので無視す +" る。 +" +if &guioptions =~# 'M' + let &guioptions = substitute(&guioptions, '[mT]', '', 'g') +endif + +"--------------------------------------------------------------------------- +" その他、見栄えに関する設定: +" +" 検索文字列をハイライトしない(_vimrcではなく_gvimrcで設定する必要がある) +"set nohlsearch + +"--------------------------------------------------------------------------- +" 印刷に関する設定: +" +" 注釈: +" 印刷はGUIでなくてもできるのでvimrcで設定したほうが良いかもしれない。この辺 +" りはWindowsではかなり曖昧。一般的に印刷には明朝、と言われることがあるらし +" いのでデフォルトフォントは明朝にしておく。ゴシックを使いたい場合はコメント +" アウトしてあるprintfontを参考に。 +" +" 参考: +" :hardcopy +" :help 'printfont' +" :help printing +" +" 印刷用フォント +if has('printer') + if has('win32') + set printfont=MS_Mincho:h12:cSHIFTJIS + "set printfont=MS_Gothic:h12:cSHIFTJIS + endif +endif + +" Copyright (C) 2009-2016 KaoriYa/MURAOKA Taro diff --git a/libs/arp.library b/libs/arp.library deleted file mode 100644 index 1a99560c05..0000000000 Binary files a/libs/arp.library and /dev/null differ diff --git a/nsis/README.txt b/nsis/README.txt index ad209e9f6d..b61580c9b0 100644 --- a/nsis/README.txt +++ b/nsis/README.txt @@ -1,5 +1,5 @@ This builds a one-click install for Vim for Win32 using the Nullsoft -Installation System (NSIS), available at http://www.nullsoft.com/free/nsis/ +Installation System (NSIS), available at http://nsis.sourceforge.net/ To build the installable .exe: @@ -17,8 +17,14 @@ To build the installable .exe: uninstal.exe, xxd/xxd.exe, + Then execute tools/rename.bat to rename the executables. (mv command is + required.) + 3. Go to the GvimExt directory and build gvimext.dll (or get it from a binary - archive). + archive). Both 64- and 32-bit versions are needed and should be placed + as follows: + 64-bit: src/GvimExt/gvimext64.dll + 32-bit: src/GvimExt/gvimext.dll 4. Go to the VisVim directory and build VisVim.dll (or get it from a binary archive). @@ -27,13 +33,35 @@ To build the installable .exe: get them from a binary archive). 6. Get a "diff.exe" program and put it in the "../.." directory (above the - "vim61" directory, it's the same for all Vim versions). + "vim80" directory, it's the same for all Vim versions). You can find one in previous Vim versions or in this archive: http://www.mossbayeng.com/~ron/vim/diffutils.tar.gz + Also put winpty32.dll and winpty-agent.exe there. 7. Do "make uganda.nsis.txt" in runtime/doc. This requires sed, you may have to do this on Unix. Make sure the file is in DOS file format! +8. Get gettext and iconv DLLs from the following site: + https://github.com/mlocati/gettext-iconv-windows/releases + Both 64- and 32-bit versions are needed. + Download the files gettextX.X.X.X-iconvX.XX-shared-{32,64}.zip, extract + DLLs and place them as follows: + + + | + + gettext32/ + | libintl-8.dll + | libiconv-2.dll + | libgcc_s_sjlj-1.dll + | + ` gettext64/ + libintl-8.dll + libiconv-2.dll + + The default is "..", however, you can change it by + passing /DGETTEXT=... option to the makensis command. + + Install NSIS if you didn't do that already. Also install UPX, if you want a compressed file. diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 7b69e7d9cb..55bb4ce007 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -1,28 +1,40 @@ # NSIS file to create a self-installing exe for Vim. # It requires NSIS version 2.0 or later. -# Last Change: 2010 Jul 30 +# Last Change: 2014 Nov 5 # WARNING: if you make changes to this script, look out for $0 to be valid, # because uninstall deletes most files in $0. # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. -!define VIMSRC "..\src" +!ifndef VIMSRC + !define VIMSRC "..\src" +!endif # Location of runtime files -!define VIMRT ".." +!ifndef VIMRT + !define VIMRT ".." +!endif # Location of extra tools: diff.exe -!define VIMTOOLS ..\.. +!ifndef VIMTOOLS + !define VIMTOOLS ..\.. +!endif + +# Location of gettext. +# It must contain two directories: gettext32 and gettext64. +# See README.txt for detail. +!ifndef GETTEXT + !define GETTEXT ${VIMRT} +!endif # Comment the next line if you don't have UPX. -# Get it at http://upx.sourceforge.net +# Get it at https://upx.github.io/ !define HAVE_UPX # comment the next line if you do not want to add Native Language Support !define HAVE_NLS -!define VER_MAJOR 7 -!define VER_MINOR 4 +!include gvim_version.nsh # for version number # ----------- No configurable settings below this line ----------- @@ -33,12 +45,13 @@ Name "Vim ${VER_MAJOR}.${VER_MINOR}" OutFile gvim${VER_MAJOR}${VER_MINOR}.exe CRCCheck force -SetCompressor lzma +SetCompressor /SOLID lzma SetDatablockOptimize on RequestExecutionLevel highest +XPStyle on ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." -DirText "Choose a directory to install Vim (must end in 'vim')" +DirText "Choose a directory to install Vim (should contain 'vim')" Icon icons\vim_16c.ico # NSIS2 uses a different strategy with six different images in a strip... #EnabledBitmap icons\enabled.bmp @@ -56,9 +69,6 @@ LicenseData ${VIMRT}\doc\uganda.nsis.txt !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" !endif -SetCompressor /SOLID lzma -XPStyle on - # This adds '\vim' to the user choice automagically. The actual value is # obtained below with ReadINIStr. InstallDir "$PROGRAMFILES\Vim" @@ -73,17 +83,24 @@ SilentInstall normal # These are the pages we use Page license Page components +Page custom SetCustom ValidateCustom ": _vimrc setting" Page directory "" "" CheckInstallDir Page instfiles UninstPage uninstConfirm UninstPage instfiles +# Reserve files +# Needed for showing the _vimrc setting page faster. +ReserveFile /plugin InstallOptions.dll +ReserveFile vimrc.ini + ########################################################## # Functions Function .onInit MessageBox MB_YESNO|MB_ICONQUESTION \ "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ + /SD IDYES \ IDYES NoAbort Abort ; causes installer to quit. NoAbort: @@ -124,6 +141,10 @@ Function .onInit StrCpy $1 "-register-OLE" StrCpy $2 "gvim evim gview gvimdiff vimtutor" + # Extract InstallOptions files + # $PLUGINSDIR will automatically be removed when the installer closes + InitPluginsDir + File /oname=$PLUGINSDIR\vimrc.ini "vimrc.ini" FunctionEnd Function .onUserAbort @@ -135,11 +156,6 @@ FunctionEnd # We only accept the directory if it ends in "vim". Using .onVerifyInstDir has # the disadvantage that the browse dialog is difficult to use. Function CheckInstallDir - StrCpy $0 $INSTDIR 3 -3 - StrCmp $0 "vim" PathGood - MessageBox MB_OK "The path must end in 'vim'." - Abort - PathGood: FunctionEnd Function .onInstSuccess @@ -180,7 +196,7 @@ FunctionEnd ########################################################## Section "Vim executables and runtime files" - SectionIn 1 2 3 + SectionIn 1 2 3 RO # we need also this here if the user changes the instdir StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" @@ -190,14 +206,18 @@ Section "Vim executables and runtime files" File /oname=install.exe ${VIMSRC}\installw32.exe File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe File ${VIMSRC}\vimrun.exe + File /oname=tee.exe ${VIMSRC}\teew32.exe File /oname=xxd.exe ${VIMSRC}\xxdw32.exe - File ${VIMTOOLS}\diff.exe File ${VIMRT}\vimtutor.bat File ${VIMRT}\README.txt File ..\uninstal.txt File ${VIMRT}\*.vim File ${VIMRT}\rgb.txt + File ${VIMTOOLS}\diff.exe + File ${VIMTOOLS}\winpty32.dll + File ${VIMTOOLS}\winpty-agent.exe + SetOutPath $0\colors File ${VIMRT}\colors\*.* @@ -216,6 +236,39 @@ Section "Vim executables and runtime files" SetOutPath $0\macros File ${VIMRT}\macros\*.* + SetOutPath $0\macros\hanoi + File ${VIMRT}\macros\hanoi\*.* + SetOutPath $0\macros\life + File ${VIMRT}\macros\life\*.* + SetOutPath $0\macros\maze + File ${VIMRT}\macros\maze\*.* + SetOutPath $0\macros\urm + File ${VIMRT}\macros\urm\*.* + + SetOutPath $0\pack\dist\opt\dvorak\dvorak + File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.* + SetOutPath $0\pack\dist\opt\dvorak\plugin + File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.* + + SetOutPath $0\pack\dist\opt\editexisting\plugin + File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.* + + SetOutPath $0\pack\dist\opt\justify\plugin + File ${VIMRT}\pack\dist\opt\justify\plugin\*.* + + SetOutPath $0\pack\dist\opt\matchit\doc + File ${VIMRT}\pack\dist\opt\matchit\doc\*.* + SetOutPath $0\pack\dist\opt\matchit\plugin + File ${VIMRT}\pack\dist\opt\matchit\plugin\*.* + + SetOutPath $0\pack\dist\opt\shellmenu\plugin + File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.* + + SetOutPath $0\pack\dist\opt\swapmouse\plugin + File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.* + + SetOutPath $0\pack\dist\opt\termdebug\plugin + File ${VIMRT}\pack\dist\opt\termdebug\plugin\*.* SetOutPath $0\plugin File ${VIMRT}\plugin\*.* @@ -223,6 +276,9 @@ Section "Vim executables and runtime files" SetOutPath $0\autoload File ${VIMRT}\autoload\*.* + SetOutPath $0\autoload\dist + File ${VIMRT}\autoload\dist\*.* + SetOutPath $0\autoload\xml File ${VIMRT}\autoload\xml\*.* @@ -295,24 +351,67 @@ Section "Add an Edit-with-Vim context menu entry" SetOutPath $0 ClearErrors SetOverwrite try + ${If} ${RunningX64} + # Install 64-bit gvimext.dll into the GvimExt64 directory. + SetOutPath $0\GvimExt64 + ClearErrors File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll - ${Else} - File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll +!ifdef HAVE_NLS + File ${GETTEXT}\gettext64\libintl-8.dll + File ${GETTEXT}\gettext64\libiconv-2.dll +!endif + + IfErrors 0 GvimExt64Done + + # Can't copy gvimext.dll, create it under another name and rename it + # on next reboot. + GetTempFileName $3 $0\GvimExt64 + File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll + Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll +!ifdef HAVE_NLS + GetTempFileName $3 $0\GvimExt64 + File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll + Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll + GetTempFileName $3 $0\GvimExt64 + File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll + Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll +!endif ${EndIf} - IfErrors 0 GvimExtDone + + GvimExt64Done: + + # Install 32-bit gvimext.dll into the GvimExt32 directory. + SetOutPath $0\GvimExt32 + ClearErrors + + File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll +!ifdef HAVE_NLS + File ${GETTEXT}\gettext32\libintl-8.dll + File ${GETTEXT}\gettext32\libiconv-2.dll + File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll +!endif + + IfErrors 0 GvimExt32Done # Can't copy gvimext.dll, create it under another name and rename it on # next reboot. - GetTempFileName $3 $0 - ${If} ${RunningX64} - File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll - ${Else} - File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll - ${EndIf} - Rename /REBOOTOK $3 $0\gvimext.dll + GetTempFileName $3 $0\GvimExt32 + File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll + Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll +!ifdef HAVE_NLS + GetTempFileName $3 $0\GvimExt32 + File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll + Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll + GetTempFileName $3 $0\GvimExt32 + File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll + Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll + GetTempFileName $3 $0\GvimExt32 + File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll + Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll +!endif - GvimExtDone: + GvimExt32Done: SetOverwrite lastused # We don't have a separate entry for the "Open With..." menu, assume @@ -321,7 +420,7 @@ Section "Add an Edit-with-Vim context menu entry" SectionEnd ########################################################## -Section "Create a _vimrc if it doesn't exist" +Section "Create a _vimrc if it doesn't exist" sec_vimrc_id SectionIn 1 3 StrCpy $1 "$1 -create-vimrc" @@ -361,7 +460,10 @@ SectionEnd File ${VIMRT}\keymap\README.txt File ${VIMRT}\keymap\*.vim SetOutPath $0 - File ${VIMRT}\libintl.dll + File ${GETTEXT}\gettext32\libintl-8.dll + File ${GETTEXT}\gettext32\libiconv-2.dll + #File /nonfatal ${VIMRT}\libwinpthread-1.dll + File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll SectionEnd !endif @@ -376,6 +478,43 @@ Section -post BringToFront SectionEnd +########################################################## +Function SetCustom + # Display the InstallOptions dialog + + # Check if a _vimrc should be created + SectionGetFlags ${sec_vimrc_id} $3 + IntOp $3 $3 & 1 + StrCmp $3 "1" +2 0 + Abort + + InstallOptions::dialog "$PLUGINSDIR\vimrc.ini" + Pop $3 +FunctionEnd + +Function ValidateCustom + ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 2" "State" + StrCmp $3 "1" 0 +3 + StrCpy $1 "$1 -vimrc-remap no" + Goto behave + + StrCpy $1 "$1 -vimrc-remap win" + + behave: + ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 5" "State" + StrCmp $3 "1" 0 +3 + StrCpy $1 "$1 -vimrc-behave unix" + Goto done + + ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 6" "State" + StrCmp $3 "1" 0 +3 + StrCpy $1 "$1 -vimrc-behave mswin" + Goto done + + StrCpy $1 "$1 -vimrc-behave default" + done: +FunctionEnd + ########################################################## Section Uninstall # Apparently $INSTDIR is set to the directory where the uninstaller is @@ -401,6 +540,11 @@ Section Uninstall $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes Delete /REBOOTOK $0\*.dll + Delete /REBOOTOK $0\GvimExt32\*.dll + ${If} ${RunningX64} + Delete /REBOOTOK $0\GvimExt64\*.dll + ${EndIf} + ClearErrors # Remove everything but *.dll files. Avoids that # a lot remains when gvimext.dll cannot be deleted. diff --git a/nsis/gvim_version.nsh b/nsis/gvim_version.nsh new file mode 100644 index 0000000000..f34feab0a5 --- /dev/null +++ b/nsis/gvim_version.nsh @@ -0,0 +1,6 @@ +# Generated from Makefile: define the version numbers +!ifndef __GVIM_VER__NSH__ +!define __GVIM_VER__NSH__ +!define VER_MAJOR 8 +!define VER_MINOR 1 +!endif diff --git a/nsis/vimrc.ini b/nsis/vimrc.ini new file mode 100644 index 0000000000..a3e9ecb5bb --- /dev/null +++ b/nsis/vimrc.ini @@ -0,0 +1,68 @@ +[Settings] +NumFields=7 + +[Field 1] +Type=GroupBox +Left=0 +Right=-1 +Top=0 +Bottom=53 +Text=" Key remapping " + +[Field 2] +Type=radiobutton +Text=Do not remap keys for Windows behavior (Default) +Left=10 +Right=-10 +Top=17 +Bottom=25 +State=1 +Flags=GROUP + +[Field 3] +Type=radiobutton +Text=Remap a few keys for Windows behavior (, , , , , etc) +Left=10 +Right=-10 +Top=30 +Bottom=47 +State=0 +Flags=NOTABSTOP + +[Field 4] +Type=GroupBox +Left=0 +Right=-1 +Top=55 +Bottom=-5 +Text=" Mouse behavior " + +[Field 5] +Type=radiobutton +Text=Right button extends selection, left button starts visual mode (Unix) +Left=10 +Right=-5 +Top=72 +Bottom=80 +State=0 +Flags=GROUP + +[Field 6] +Type=radiobutton +Text=Right button has a popup menu, left button starts select mode (Windows) +Left=10 +Right=-5 +Top=85 +Bottom=93 +State=0 +Flags=NOTABSTOP + +[Field 7] +Type=radiobutton +Text=Right button has a popup menu, left button starts visual mode (Default) +Left=10 +Right=-5 +Top=98 +Bottom=106 +State=1 +Flags=NOTABSTOP diff --git a/pixmaps/stock_vim_build_tags.png b/pixmaps/stock_vim_build_tags.png new file mode 100644 index 0000000000..3ed7085b2e Binary files /dev/null and b/pixmaps/stock_vim_build_tags.png differ diff --git a/pixmaps/stock_vim_find_help.png b/pixmaps/stock_vim_find_help.png new file mode 100644 index 0000000000..9214945d8d Binary files /dev/null and b/pixmaps/stock_vim_find_help.png differ diff --git a/pixmaps/stock_vim_save_all.png b/pixmaps/stock_vim_save_all.png new file mode 100644 index 0000000000..1f9e781372 Binary files /dev/null and b/pixmaps/stock_vim_save_all.png differ diff --git a/pixmaps/stock_vim_session_load.png b/pixmaps/stock_vim_session_load.png new file mode 100644 index 0000000000..34251d1fe3 Binary files /dev/null and b/pixmaps/stock_vim_session_load.png differ diff --git a/pixmaps/stock_vim_session_new.png b/pixmaps/stock_vim_session_new.png new file mode 100644 index 0000000000..5fb0626b7a Binary files /dev/null and b/pixmaps/stock_vim_session_new.png differ diff --git a/pixmaps/stock_vim_session_save.png b/pixmaps/stock_vim_session_save.png new file mode 100644 index 0000000000..6256c79de7 Binary files /dev/null and b/pixmaps/stock_vim_session_save.png differ diff --git a/pixmaps/stock_vim_shell.png b/pixmaps/stock_vim_shell.png new file mode 100644 index 0000000000..ca9b8037c5 Binary files /dev/null and b/pixmaps/stock_vim_shell.png differ diff --git a/pixmaps/stock_vim_window_maximize.png b/pixmaps/stock_vim_window_maximize.png new file mode 100644 index 0000000000..c3aea0fd21 Binary files /dev/null and b/pixmaps/stock_vim_window_maximize.png differ diff --git a/pixmaps/stock_vim_window_maximize_width.png b/pixmaps/stock_vim_window_maximize_width.png new file mode 100644 index 0000000000..f4173213e7 Binary files /dev/null and b/pixmaps/stock_vim_window_maximize_width.png differ diff --git a/pixmaps/stock_vim_window_minimize.png b/pixmaps/stock_vim_window_minimize.png new file mode 100644 index 0000000000..4dd17afd71 Binary files /dev/null and b/pixmaps/stock_vim_window_minimize.png differ diff --git a/pixmaps/stock_vim_window_minimize_width.png b/pixmaps/stock_vim_window_minimize_width.png new file mode 100644 index 0000000000..8aa4f67c08 Binary files /dev/null and b/pixmaps/stock_vim_window_minimize_width.png differ diff --git a/pixmaps/stock_vim_window_split.png b/pixmaps/stock_vim_window_split.png new file mode 100644 index 0000000000..dcf5a3c7bd Binary files /dev/null and b/pixmaps/stock_vim_window_split.png differ diff --git a/pixmaps/stock_vim_window_split_vertical.png b/pixmaps/stock_vim_window_split_vertical.png new file mode 100644 index 0000000000..7522d1f294 Binary files /dev/null and b/pixmaps/stock_vim_window_split_vertical.png differ diff --git a/plugins/autofmt/Makefile b/plugins/autofmt/Makefile new file mode 100644 index 0000000000..0e709cd02d --- /dev/null +++ b/plugins/autofmt/Makefile @@ -0,0 +1,17 @@ + +.PHONY: dist test clean + +all: dist + +dist: clean test + svn export . autofmt + rm -f autofmt.zip + zip -r autofmt.zip autofmt + rm -r autofmt + +test: + cd test && $(MAKE) + +clean: + cd test && $(MAKE) clean + diff --git a/plugins/autofmt/README b/plugins/autofmt/README new file mode 100644 index 0000000000..b23c4d774d --- /dev/null +++ b/plugins/autofmt/README @@ -0,0 +1,15 @@ +This is a 'formatexpr' plugin. + +License: + public domain + +Usage: + :set runtimepath+=/path/to/autofmt/ + :set formatexpr=autofmt#compat#formatexpr() + +Following method can be used: + autofmt#compat#formatexpr(): Vim compatible + autofmt#uax14#formatexpr(): Implementation of UAX #14 + autofmt#japanese#formatexpr(): Japanese + +See doc/autofmt.txt for more information. diff --git a/plugins/autofmt/autoload/autofmt/compat.vim b/plugins/autofmt/autoload/autofmt/compat.vim new file mode 100644 index 0000000000..2ee38af5c5 --- /dev/null +++ b/plugins/autofmt/autoload/autofmt/compat.vim @@ -0,0 +1,925 @@ +" Maintainer: Yukihiro Nakadaira +" License: This file is placed in the public domain. +" Last Change: 2012-01-25 +" +" Options: +" +" None +" +" +" Related Options: +" textwidth +" formatoptions +" formatlistpat +" joinspaces +" cpoptions ('j' flag) +" comments +" expandtab +" tabstop +" ambiwidth +" autoindent +" copyindent +" wrapmargin +" foldcolumn +" number +" relativenumber +" cindent +" lispindent +" smartindent +" indentexpr +" paste +" +" +" Note: +" This script is very slow. Only one or two paragraph (and also Insert mode +" formatting) can be formatted in practical. +" +" Do not work when 'formatoptions' have 'a' flag. +" +" v:lnum can be changed when using "normal! i\" or something that uses +" v:lnum. Take care to use such command in formatexpr. +" +" v:char is never be space or tab. When completion is used, v:char is +" empty. +" +" Make text reformattable. Do not insert or remove spaces when it +" considered unexpected. +" +" +" TODO: +" 'formatoptions': 'a' 'w' 'v' 'b' 'l' +" +" hoge(); /* format comment here */ +" hoge(); /* format +" * comment +" * here +" */ +" +" /* comment */ do_not() + format() + here(); +" +" How to recognize if text is list formatted? +" 1 We have +" 2 20 files. +" Line 2 is not list but it matches 'formatlistpat'. +" +" Justify with padding or removing spaces. How to re-format without +" breaking user typed space. +" +" +" Reference: +" UAX #14: Line Breaking Properties +" http://unicode.org/reports/tr14/ +" +" UAX #11: East Asian Width +" http://unicode.org/reports/tr11/ +" +" Word wrap - Wikipedia +" http://en.wikipedia.org/wiki/Word_wrap + +let s:cpo_save = &cpo +set cpo&vim + +function autofmt#compat#formatexpr() + return s:lib.formatexpr() +endfunction + +function autofmt#compat#import() + return s:lib +endfunction + +if exists('*strdisplaywidth') + let s:strdisplaywidth = function('strdisplaywidth') +else + function s:strdisplaywidth(str, ...) + let vcol = get(a:000, 0, 0) + let w = 0 + for c in split(a:str, '\zs') + if c == "\t" + let w += &tabstop - ((vcol + w) % &tabstop) + elseif c =~ '^.\%2v' " single-width char + let w += 1 + elseif c =~ '^.\%3v' " double-width char or ctrl-code (^X) + let w += 2 + elseif c =~ '^.\%5v' " (^X with :set display=uhex) + let w += 4 + elseif c =~ '^.\%7v' " (e.g. U+FEFF) + let w += 6 + endif + endfor + return w + endfunction +endif + +let s:lib = {} + +function s:lib.formatexpr() + if mode() =~# '[iR]' && self.has_format_options('a') + " When 'formatoptions' have "a" flag (paragraph formatting), it is + " impossible to format using User Function. Paragraph is concatenated to + " one line before this function is invoked and cursor is placed at end of + " line. + return 1 + elseif mode() !~# '[niR]' || (mode() =~# '[iR]' && v:count != 1) || v:char =~# '\s' + echohl ErrorMsg + echomsg "Assert(formatexpr): Unknown State: " mode() v:lnum v:count string(v:char) + echohl None + return 1 + endif + if mode() == 'n' + call self.format_normal_mode(v:lnum, v:count) + else + call self.format_insert_mode(v:char) + endif + return 0 +endfunction + +function s:lib.format_normal_mode(lnum, count) + let self.textwidth = self.comp_textwidth(1) + + if self.textwidth == 0 + return + endif + + let offset = 0 + let para = self.get_paragraph(getline(a:lnum, a:lnum + a:count - 1)) + for [i, lines] in para + let lnum = a:lnum + i + offset + call setline(lnum, self.retab(getline(lnum))) + + let offset += self.format_lines(lnum, len(lines)) + + if self.is_comment_enabled() + " " * */" -> " */" + let lnum = a:lnum + i + (len(lines) - 1) + offset + let line = getline(lnum) + let [indent, com_str, mindent, text, com_flags] = self.parse_leader(line) + if com_flags =~# 'm' + let [s, m, e] = self.find_three_piece_comments(&comments, com_flags, com_str) + if text == e[1] + let line = indent . e[1] + call setline(lnum, line) + endif + endif + endif + + endfor + + " The cursor is left on the first non-blank of the last formatted line. + let lnum = a:lnum + (a:count - 1) + offset + execute printf('keepjumps normal! %dG', lnum) +endfunction + +function s:lib.format_insert_mode(char) + " @warning char can be "" when completion is used + " @return a:char for debug + + let self.textwidth = self.comp_textwidth(0) + + let lnum = line('.') + let col = col('.') - 1 + let vcol = (virtcol('.') - 1) + s:strdisplaywidth(a:char) + let line = getline(lnum) + + if self.textwidth == 0 + \ || vcol <= self.textwidth + \ || (!self.has_format_options('t') && !self.has_format_options('c')) + \ || (!self.has_format_options('t') && self.has_format_options('c') + \ && !self.is_comment(line)) + return a:char + endif + + " split line at the cursor and insert v:char temporarily + let [line, rest] = [line[: col - 1] . a:char, line[col :]] + call setline(lnum, line) + + let lnum += self.format_lines(lnum, 1) + + " remove v:char and restore actual line + let line = getline(lnum) + let col = len(line) - len(a:char) + if a:char != "" + let line = substitute(line, '.$', '', '') + endif + call setline(lnum, line . rest) + call cursor(lnum, col + 1) + + return a:char +endfunction + +function s:lib.format_lines(lnum, count) + let lnum = a:lnum + let prev_lines = line('$') + let fo_2 = self.get_second_line_leader(getline(lnum, lnum + a:count - 1)) + " If the line doesn't start with a comment leader, then don't start + " one in a following broken line. (edit.c:internal_format():6063) + let no_leader = !self.is_comment(getline(lnum)) + let lines = getline(lnum, lnum + a:count - 1) + let line = self.join_lines(lines) + call setline(lnum, line) + if a:count > 1 + execute printf('silent %ddelete _ %d', lnum + 1, a:count - 1) + endif + while 1 + let line = getline(lnum) + let col = self.find_boundary(line) + if col == -1 + break + endif + let line1 = substitute(line[: col - 1], '\s*$', '', '') + let line2 = substitute(line[col :], '^\s*', '', '') + call setline(lnum, line1) + call append(lnum, line2) + if fo_2 != -1 + let leader = fo_2 + else + let leader = self.make_leader(lnum + 1, no_leader) + endif + call setline(lnum + 1, leader . line2) + let lnum += 1 + let fo_2 = -1 + endwhile + return line('$') - prev_lines +endfunction + +function s:lib.find_boundary(line) + let start_col = self.skip_leader(a:line) + if start_col == len(a:line) + return -1 + endif + let lst = self.line2list(a:line) + let break_idx = -1 + let i = 0 + while lst[i].col < start_col + let i += 1 + endwhile + let is_prev_one_letter = 0 + let start_idx = i + let i = self.skip_word(lst, i) + let i = self.skip_space(lst, i) + while i < len(lst) + let brk = self.check_boundary(lst, i) + let next = self.skip_word(lst, i) + if is_prev_one_letter && brk == "allow_break" && &fo =~ '1' + " don't break a line after a one-letter word. + let brk = "allow_break_before" + endif + if brk == "allow_break" + let break_idx = i + if self.textwidth < lst[next - 1].virtcol + return lst[break_idx].col + endif + let is_prev_one_letter = (i == 0 || lst[i - 1].c =~ '\s') && + \ (i + 1 == len(lst) || lst[i + 1].c =~ '\s') + elseif brk == "allow_break_before" + if self.textwidth < lst[next - 1].virtcol && break_idx != -1 + return lst[break_idx].col + endif + let is_prev_one_letter = (i == 0 || lst[i - 1].c =~ '\s') && + \ (i + 1 == len(lst) || lst[i + 1].c =~ '\s') + endif + let i = self.skip_space(lst, next) + endwhile + return -1 +endfunction + +function s:lib.check_boundary(lst, i) + " Check whether a line can be broken before lst[i]. + " + " @param lst line as List of Dictionary + " lst[i].c character + " lst[i].w width of character + " lst[i].col same as col(), but 0 based + " lst[i].virtcol same as virtcol(), but 0 based + " @param i index of lst + " @return line break status + " "allow_break" Line can be broken between lst[i-1] and lst[i]. + " "allow_break_before" If lst[i] is over the 'textwidth', break a line at + " previous breakable point, if possible. + " other Do not break. + " + + let [lst, i] = [a:lst, a:i] + + if lst[i-1].c =~ '\s' + return "allow_break" + elseif &fo =~# 'm' + let bc = char2nr(lst[i-1].c) + let ac = char2nr(lst[i].c) + if bc > 255 || ac > 255 + return "allow_break" + endif + endif + return "allow_break_before" +endfunction + +function s:lib.skip_word(lst, i) + " @return end_of_word + 1 + + let [lst, i] = [a:lst, a:i + 1] + if lst[i - 1].c =~ '\h' + while i < len(lst) && lst[i].c =~ '\w' + let i += 1 + endwhile + endif + return i +endfunction + +function s:lib.skip_space(lst, i) + let [lst, i] = [a:lst, a:i] + while i < len(lst) && lst[i].c =~ '\s' + let i += 1 + endwhile + return i +endfunction + +function s:lib.skip_leader(line) + let col = 0 + if self.is_comment_enabled() + let [indent, com_str, mindent, text, com_flags] = self.parse_leader(a:line) + let col += len(indent) + len(com_str) + len(mindent) + else + let [indent, text] = matchlist(a:line, '\v^(\s*)(.*)$')[1:2] + let col += len(indent) + endif + if self.has_format_options('n') + let listpat = matchstr(text, &formatlistpat) + if listpat != "" + let col += len(listpat) + let col += len(matchstr(text, '\s*', len(listpat))) + endif + endif + return col +endfunction + +function s:lib.get_paragraph(lines) + " @param lines List of String + " @return List of Paragraph + " [ [start_index, [line1 ,line2, ...]], ...] + " For example: + " lines = ["", "line2", "line3", "", "", "line6", ""] + " => [ [1, ["line2", "line3"]], [5, ["line6"]] ] + " + " @see opt.c:same_leader() + " + " TODO: check for 'f' comment or 'formatlistpat'. make option? + " orig vim useful? + " 1: - line1 1: - line1 line2 1: - line1 + " 2: line2 2: line2 + " use indent? + " 1: hoge fuga 1: hoge fuga 1: hoge fuga + " 2: - list1 2: - list1 2: - list1 + " 3: - list2 3: - list2 hoge 3: - list2 + " 4: hoge fuga 4: fuga 4: hoge fuga + + let res = [] + let pl = [] + for line in a:lines + call add(pl, self.parse_leader(line)) + endfor + let i = 0 + while i < len(a:lines) + while i < len(a:lines) && pl[i][3] == "" + let i += 1 + endwhile + if i == len(a:lines) + break + endif + let start = i + let i += 1 + while i < len(a:lines) && pl[i][3] != "" + if pl[start][4] =~# 'f' + if pl[i][1] != '' + break + endif + elseif pl[start][4] =~# 'e' + break + elseif pl[start][4] =~# 's' + if pl[i][4] !~# 'm' + break + endif + elseif pl[i-1][1] != pl[i][1] || (pl[i-1][2] != '' && pl[i][2] == '') + " start/end of comment or different comment + break + endif + if self.has_format_options('n') && pl[i][3] =~ &formatlistpat + " start of list + break + elseif self.has_format_options('2') + " separate with indent + " make this behavior optional? + let indent1 = s:strdisplaywidth(pl[i-1][0] . pl[i-1][1] . pl[i-1][2]) + let indent2 = s:strdisplaywidth(pl[i][0] . pl[i][1] . pl[i][2]) + if indent1 < indent2 + break + endif + endif + let i += 1 + endwhile + call add(res, [start, a:lines[start : i - 1]]) + endwhile + return res +endfunction + +function s:lib.join_lines(lines) + " :join + remove comment leader + + let res = a:lines[0] + for line in a:lines[1:] + if self.is_comment_enabled() + let [indent, com_str, mindent, text, com_flags] = self.parse_leader(line) + if com_flags =~# '[se]' + let text = com_str . mindent . text + endif + else + let text = substitute(line, '^\s\+', '', '') + endif + if res == "" + let res = text + elseif text != "" + let res = self.join_line(substitute(res, '\s\+$', '', ''), text) + endif + endfor + " To remove trailing space? Vim doesn't do it. + " let res = substitute(res, '\s\+$', '', '') + return res +endfunction + +function s:lib.join_line(line1, line2) + " Join two lines. + " + " Spaces at end of line1 and comment leader of line2 should be removed + " before invoking. + " + " Make sure that broken line should be joined as original line, so that we + " can re-format a paragraph without losing user typed space or adding + " unexpected space. + + let bc = matchstr(a:line1, '.$') + let ac = matchstr(a:line2, '^.') + + if a:line2 == "" + return a:line1 + elseif &joinspaces && bc =~# ((&cpoptions =~# 'j') ? '[.]' : '[.?!]') + return a:line1 . " " . a:line2 + elseif (self.has_format_options('M') && (len(bc) != 1 || len(ac) != 1)) + \ || (self.has_format_options('B') && (len(bc) != 1 && len(ac) != 1)) + return a:line1 . a:line2 + else + return a:line1 . " " . a:line2 + endif +endfunction + +" vim/src/options.c +" Return TRUE if format option 'x' is in effect. +" Take care of no formatting when 'paste' is set. +function s:lib.has_format_options(x) + if &paste + return 0 + endif + return stridx(&formatoptions, a:x) != -1 +endfunction + +function s:lib.is_comment_enabled() + if mode() == 'n' + return self.has_format_options('q') + else + return self.has_format_options('c') + endif +endfunction + +function s:lib.is_comment(line) + let com_str = self.parse_leader(a:line)[1] + return com_str != "" +endfunction + +function s:lib.parse_leader(line) + " +-------- indent + " | +------ com_str + " | | +---- mindent + " | | | + text + " v v v v + " | /* xxx| + " + " @return [indent, com_str, mindent, text, com_flags] + + if a:line =~# '^\s*$' + return [a:line, "", "", "", ""] + endif + let middle = [] + for [flags, str] in self.parse_opt_comments(&comments) + let mx = printf('\v^(\s*)(\V%s\v)(\s%s|$)(.*)$', escape(str, '\'), + \ (flags =~# 'b') ? '+' : '*') + " If we found a middle match previously, use that match when this is + " not a middle or end. */ + if !empty(middle) && flags !~# '[me]' + break + endif + if a:line =~# mx + let res = matchlist(a:line, mx)[1:4] + [flags] + " We have found a match, stop searching unless this is a middle + " comment. The middle comment can be a substring of the end + " comment in which case it's better to return the length of the + " end comment and its flags. Thus we keep searching with middle + " and end matches and use an end match if it matches better. + if flags =~# 'm' + let middle = res + continue + elseif flags =~# 'e' + if !empty(middle) && strchars(res[1]) <= strchars(middle[1]) + let res = middle + endif + elseif flags =~# 'n' + " nested comment + while 1 + let [indent, com_str, mindent, text, com_flags] = self.parse_leader(res[3]) + if com_flags !~# 'n' + break + endif + let res = [res[0], res[1] . res[2] . com_str, mindent, text, res[4]] + endwhile + endif + return res + endif + endfor + if !empty(middle) + return middle + endif + return matchlist(a:line, '\v^(\s*)()()(.*)$')[1:4] + [""] +endfunction + +function s:lib.parse_opt_comments(comments) + " @param comments 'comments' option + " @return [[flags, str], ...] + + let res = [] + for com in split(a:comments, '[^\\]\zs,') + let [flags; _] = split(com, ':', 1) + " str can contain ':' and ',' + let str = join(_, ':') + let str = substitute(str, '\\,', ',', 'g') + call add(res, [flags, str]) + endfor + return res +endfunction + +function s:lib.find_three_piece_comments(comments, flags, str) + let coms = self.parse_opt_comments(a:comments) + for i in range(len(coms)) + if coms[i][0] == a:flags && coms[i][1] == a:str + if a:flags =~# 's' + return coms[i : i + 2] + elseif a:flags =~# 'm' + return coms[i - 1 : i + 1] + elseif a:flags =~# 'e' + return coms[i - 2 : i] + endif + endif + endfor +endfunction + +function s:lib.line2list(line) + let res = [] + let [col, virtcol] = [0, 0] + for c in split(a:line, '\zs') + let w = s:strdisplaywidth(c, virtcol) + let virtcol += w + call add(res, { + \ "c": c, + \ "w": w, + \ "col": col, + \ "virtcol": virtcol, + \ }) + let col += len(c) + endfor + return res +endfunction + +function s:lib.list2line(lst) + return join(map(copy(a:lst), 'v:val.c'), '') +endfunction + +function s:lib.get_second_line_leader(lines) + if !self.has_format_options('2') || len(a:lines) <= 1 + return -1 + endif + let [indent1, com_str1, mindent1, text1, _] = self.parse_leader(a:lines[0]) + let [indent2, com_str2, mindent2, text2, _] = self.parse_leader(a:lines[1]) + if com_str1 == "" && com_str2 == "" && text2 != "" + if s:strdisplaywidth(indent1) > s:strdisplaywidth(indent2) + return indent2 + endif + elseif com_str1 != "" && com_str2 != "" && text2 != "" + if s:strdisplaywidth(indent1 . com_str1 . mindent1) > s:strdisplaywidth(indent2 . com_str2 . mindent2) + return indent2 . com_str2 . mindent2 + endif + endif + return -1 +endfunction + +function s:lib.make_leader(lnum, no_leader) + let prev_line = getline(a:lnum - 1) + + if !a:no_leader && self.is_comment_enabled() && self.is_comment(prev_line) + return self.make_comment_leader(prev_line) + endif + + let listpat = matchstr(prev_line, &formatlistpat) + + if self.has_format_options('n') && listpat != '' + let indent = repeat(' ', s:strdisplaywidth(listpat)) + else + let indent = repeat(' ', self.comp_indent(a:lnum)) + endif + + if ©indent + let [indent, rest] = self.copy_indent(prev_line, indent) + let indent = indent . rest + else + let indent = self.retab(indent) + endif + + return indent +endfunction + +function s:lib.make_comment_leader(line) + let do_si = !&paste && &smartindent && !&cindent + let [indent, com_str, mindent, text, com_flags] = self.parse_leader(a:line) + let extra_space = '' + let leader = indent . com_str . mindent + if self.has_format_options('n') + let listpat = matchstr(text, &formatlistpat) + let listpat_indent = repeat(' ', s:strdisplaywidth(listpat)) + else + let listpat_indent = "" + endif + if com_str == "" + if !&autoindent + let indent = '' + endif + let [indent, com_str, mindent] = [indent, '', listpat_indent] + elseif com_flags =~# 'e' + let [indent, com_str, mindent] = [indent, '', ''] + else + let extra_space = '' + if com_flags =~# 's' + if !&autoindent + let indent = '' + endif + let [s, m, e] = self.find_three_piece_comments(&comments, com_flags, com_str) + let lead_repl = m[1] + if leader !~ ' $' && m[0] =~# 'b' + let extra_space = ' ' + endif + elseif com_flags =~# 'm' + " pass + elseif com_flags =~# 'f' + let lead_repl = '' + else + " pass + endif + if exists('lead_repl') + let off = matchstr(com_flags, '-\?\d\+\ze[^0-9]*') + 0 + let adjust = matchstr(com_flags, '\c[lr]\ze[^lr]*') + if adjust ==# 'r' + let newindent = s:strdisplaywidth(indent . com_str) - s:strdisplaywidth(lead_repl) + if newindent < 0 + let newindent = 0 + endif + else + let newindent = s:strdisplaywidth(indent) + let w1 = s:strdisplaywidth(com_str) + let w2 = s:strdisplaywidth(lead_repl) + if w1 > w2 && mindent[0] != "\t" + let mindent = repeat(' ', w1 - w2) . mindent + endif + endif + let _leader = repeat(' ', newindent) . lead_repl . mindent + " Recompute the indent, it may have changed. + if &autoindent || do_si + let newindent = s:strdisplaywidth(matchstr(_leader, '^\s*')) + endif + if newindent + off < 0 + let off = -newindent + let newindent = 0 + else + let newindent += off + endif + " Correct trailing spaces for the shift, so that alignment remains equal. + " Don't do it when there is a tab before the space + while off > 0 && _leader != '' && _leader =~ ' $' && _leader !~ '\t' + let _leader = strpart(_leader, 0, len(_leader) - 1) + let off -= 1 + endwhile + let _ = matchlist(_leader, '^\s*\(\S*\)\(\s*\)$') + if _[2] != '' + let extra_space = '' + endif + let [indent, com_str, mindent] = [repeat(' ', newindent), _[1], _[2] . extra_space . listpat_indent] + else + let [indent, com_str, mindent] = [indent, com_str, mindent . listpat_indent] + endif + endif + if ©indent + let [indent, rest] = self.copy_indent(a:line, indent) + else + let indent = self.retab(indent) + let rest = '' + endif + let leader = indent . rest . com_str . mindent + if com_str == '' + let leader = self.retab(leader, len(indent)) + endif + return leader +endfunction + +function s:lib.copy_indent(line1, line2) + " @return [copied_indent, rest_indent . text] + let indent1 = matchstr(a:line1, '^\s*') + let indent2 = matchstr(a:line2, '^\s*') + let text = matchstr(a:line2, '^\s*\zs.*$') + let n1 = s:strdisplaywidth(indent1) + let n2 = s:strdisplaywidth(indent2) + let indent = matchstr(indent1, '^\s*\%<' . (n2 + 2) . 'v') + if n2 > n1 + let text = repeat(' ', n2 - n1) . text + endif + return [indent, text] +endfunction + +function s:lib.retab(line, ...) + let col = get(a:000, 0, 0) + let expandtab = get(a:000, 1, &expandtab) + let tabstop = get(a:000, 2, &tabstop) + let s2 = matchstr(a:line, '^\s*', col) + if s2 == '' + return a:line + endif + let s1 = strpart(a:line, 0, col) + let t = strpart(a:line, col + len(s2)) + let n1 = s:strdisplaywidth(s1) + let n2 = s:strdisplaywidth(s2, n1) + if expandtab + let s2 = repeat(' ', n2) + else + if n1 != 0 && n2 >= (tabstop - (n1 % tabstop)) + let n2 += n1 % tabstop + endif + let s2 = repeat("\t", n2 / tabstop) . repeat(' ', n2 % tabstop) + endif + return s1 . s2 . t +endfunction + +function s:lib.get_opt(name) + return get(w:, a:name, + \ get(t:, a:name, + \ get(b:, a:name, + \ get(g:, a:name, + \ get(self, a:name))))) +endfunction + +" vim/src/edit.c +" Find out textwidth to be used for formatting: +" if 'textwidth' option is set, use it +" else if 'wrapmargin' option is set, use W_WIDTH(curwin) - 'wrapmargin' +" if invalid value, use 0. +" Set default to window width (maximum 79) for "gq" operator. +" @param ff force formatting (for "gq" command) +function s:lib.comp_textwidth(ff) + let textwidth = &textwidth + + if textwidth == 0 && &wrapmargin + " The width is the window width minus 'wrapmargin' minus all the + " things that add to the margin. + let textwidth = winwidth(0) - &wrapmargin + + if self.is_cmdwin() + let textwidth -= 1 + endif + + if has('folding') + let textwidth -= &foldcolumn + endif + + if has('signs') + if self.has_sign() || has('netbeans_enabled') + let textwidth -= 1 + endif + endif + + if &number || &relativenumber + let textwidth -= 8 + endif + endif + + if textwidth < 0 + let textwidth = 0 + endif + + if a:ff && textwidth == 0 + let textwidth = winwidth(0) - 1 + if textwidth > 79 + let textwidth = 79 + endif + endif + + return textwidth +endfunction + +if exists('*getcmdwintype') + function s:lib.is_cmdwin() + return getcmdwintype() != '' + endfunction +else + function s:lib.is_cmdwin() + + " workaround1 + "return bufname('%') == '[Command Line]' + + " workaround2 + " MEMO: In formatexpr, exception is not raised without setting 'debug'. + let debug_save = &debug + set debug=throw + try + execute winnr() . "wincmd w" + " or + "execute "tabnext " . tabpagenr() + catch /^Vim\%((\a\+)\)\=:E11:/ + " Vim(wincmd):E11: Invalid in command-line window; executes, CTRL-C quits: 2wincmd w + " Vim(tabnext):E11: Invalid in command-line window; executes, CTRL-C quits: tabnext 1 + return 1 + finally + let &debug = debug_save + endtry + return 0 + + endfunction +endif + +" FIXME: This may break another :redir session? +" It is useful if vim provide builtin function for this. +function s:lib.has_sign() + redir => s + execute printf('silent sign place buffer=%d', bufnr('%')) + redir END + let lines = split(s, '\n') + " When no sign, lines == ['--- Signs ---'] + return len(lines) > 1 +endfunction + +function s:lib.comp_indent(lnum) + if &indentexpr != '' + if &paste + return 0 + endif + let v:lnum = a:lnum + return eval(&indentexpr) + elseif &cindent + if &paste + return 0 + endif + return cindent(a:lnum) + elseif &lisp + if &paste + return 0 + endif + if !&autoindent + return 0 + endif + return lispindent(a:lnum) + elseif &smartindent + if &paste + return 0 + endif + return self.smartindent(a:lnum) + elseif &autoindent + return indent(a:lnum - 1) + endif + return 0 +endfunction + +function s:lib.smartindent(lnum) + if &paste + return 0 + endif + let prev_lnum = a:lnum - 1 + while prev_lnum > 1 && getline(prev_lnum) =~ '^#' + let prev_lnum -= 1 + endwhile + if prev_lnum <= 1 + return 0 + endif + let prev_line = getline(prev_lnum) + let firstword = matchstr(prev_line, '^\s*\zs\w\+') + let cinwords = split(&cinwords, ',') + if prev_line =~ '{$' || index(cinwords, firstword) != -1 + let n = indent(prev_lnum) + &shiftwidth + if &shiftround + let n = n - (n % &shiftwidth) + endif + return n + endif + return indent(prev_lnum) +endfunction + +let &cpo = s:cpo_save + diff --git a/plugins/autofmt/autoload/autofmt/japanese.vim b/plugins/autofmt/autoload/autofmt/japanese.vim new file mode 100644 index 0000000000..35a729692a --- /dev/null +++ b/plugins/autofmt/autoload/autofmt/japanese.vim @@ -0,0 +1,111 @@ +" Maintainer: Yukihiro Nakadaira +" License: This file is placed in the public domain. +" Last Change: 2011-01-11 +" +" Options: +" +" autofmt_allow_over_tw number (default: 0) +" +" Allow character, prohibited a line break before, to over 'textwidth' +" only given width. +" +" +" autofmt_allow_over_tw_char string (default: see below) +" +" Character, prohibited a line break before. This variable is used with +" autofmt_allow_over_tw. +" + +scriptencoding utf-8 + +let s:cpo_save = &cpo +set cpo&vim + +function autofmt#japanese#formatexpr() + return s:lib.formatexpr() +endfunction + +function autofmt#japanese#import() + return s:lib +endfunction + +let s:compat = autofmt#compat#import() +let s:uax14 = autofmt#uax14#import() + +let s:lib = {} +call extend(s:lib, s:compat) + +let s:lib.autofmt_allow_over_tw = 0 + +" JIS X 4051 (Formatting rules for Japanese documents) +" 4.3 Handling character prohibited a line break before +" These character is not allowed to position at start of line. It +" should be dangled over the 'textwidth' or commited to next line with +" previous character. +let s:lib.autofmt_allow_over_tw_char = "" + \ . ",)]}、〕〉》」』】〟’”»" + \ . "ヽヾーァィゥェォッャュョヮヵヶゝゞぁぃぅぇぉっゃゅょゃゎ々" + \ . "‐" + \ . "?!" + \ . "・:;" + \ . "。." +" compatible character with different width or code point +let s:lib.autofmt_allow_over_tw_char .= "" + \ . "°′″,.:;?!)]}…~" +" not in cp932 +if &encoding == 'utf-8' + let s:lib.autofmt_allow_over_tw_char .= "〙〗⦆ゕゖ゠–〜‼⁇⁈⁉" +endif + + +function! s:lib.check_boundary(lst, i) + let [lst, i] = [a:lst, a:i] + let tw = self.textwidth + self.get_opt("autofmt_allow_over_tw") + let tw_char = self.get_opt("autofmt_allow_over_tw_char") + if self.textwidth < lst[i].virtcol && lst[i].virtcol <= tw + " Dangling wrap. Allow character, prohibited a line break before, to + " over 'textwidth'. + if stridx(tw_char, lst[i].c) != -1 + return "no_break" + endif + endif + " use compat for single byte text + if len(lst[i - 1].c) == 1 && len(lst[i].c) == 1 + return s:compat.check_boundary(lst, i) + endif + " use UAX #14 as default + return s:uax14.check_boundary(lst, i) +endfunction + +function! s:lib.join_line(line1, line2) + if matchstr(a:line1, '.$') =~ '[、。]' + " Don't insert space after Japanese punctuation. + return a:line1 . a:line2 + endif + return call(s:compat.join_line, [a:line1, a:line2], self) +endfunction + +function! s:lib.get_paragraph(lines) + let para = call(s:compat.get_paragraph, [a:lines], self) + let i = 0 + while i < len(para) + let [lnum, lines] = para[i] + let j = 1 + while j < len(lines) + if lines[j] =~ '^ ' || self.parse_leader(lines[j])[3] =~ '^ ' + " U+3000 at start of line means new paragraph. split this paragraph. + call insert(para, [para[i][0], remove(para[i][1], 0, j - 1)], i) + let i += 1 + let para[i][0] += j + let j = 1 + else + let j += 1 + endif + endwhile + let i += 1 + endwhile + return para +endfunction + +let &cpo = s:cpo_save + diff --git a/plugins/autofmt/autoload/autofmt/uax14.vim b/plugins/autofmt/autoload/autofmt/uax14.vim new file mode 100644 index 0000000000..abd8f9ac5b --- /dev/null +++ b/plugins/autofmt/autoload/autofmt/uax14.vim @@ -0,0 +1,74 @@ +" Maintainer: Yukihiro Nakadaira +" License: This file is placed in the public domain. +" Last Change: 2016-11-24 +" +" Options: +" +" autofmt_strict_japanese_linebreak number (default: 1) +" +" If set to 1, line break before KATAKANA-HIRAGANA PROLONGED SOUND MARK +" and small kana letters are disallowed. If set to 0, they are allowed. +" + +let s:cpo_save = &cpo +set cpo&vim + +function autofmt#uax14#formatexpr() + return s:lib.formatexpr() +endfunction + +function autofmt#uax14#import() + return s:lib +endfunction + +let s:compat = autofmt#compat#import() + +let s:lib = {} +call extend(s:lib, s:compat) + +let s:lib.autofmt_strict_japanese_linebreak = 1 +let s:lib.uni = autofmt#unicode#import() + +function! s:lib.check_boundary(lst, i) + " UAX #14: Line Breaking Properties + " 7. Pair Table-Based Implementation + + let [lst, i] = [a:lst, a:i] + + let after = self.uni.prop_line_break(lst[i].c) + if after == "AI" " Ambiguous (Alphabetic or Ideograph) + let after = (lst[i].w == 1) ? "AL" : "ID" + elseif after == "CJ" " Conditional Japanese Starter + let after = self.get_opt("autofmt_strict_japanese_linebreak") ? "NS" : "ID" + endif + + let j = i - 1 + while j > 0 && lst[j].c =~ '\s' + let j -= 1 + endwhile + + let before = self.uni.prop_line_break(lst[j].c) + if before == "AI" " Ambiguous (Alphabetic or Ideograph) + let before = (lst[j].w == 1) ? "AL" : "ID" + elseif before == "CJ" " Conditional Japanese Starter + let before = self.get_opt("autofmt_strict_japanese_linebreak") ? "NS" : "ID" + endif + + let brk = self.uni.uax14_pair_table(before, after) + if brk == self.uni.INDIRECT_BRK + if lst[i - 1].c =~ '\s' + let brk = self.uni.INDIRECT_BRK + else + let brk = self.uni.PROHIBITED_BRK + endif + endif + + if brk == self.uni.DIRECT_BRK || brk == self.uni.INDIRECT_BRK + return "allow_break" + else + return "allow_break_before" + endif +endfunction + +let &cpo = s:cpo_save + diff --git a/plugins/autofmt/autoload/autofmt/unicode.vim b/plugins/autofmt/autoload/autofmt/unicode.vim new file mode 100644 index 0000000000..4149c02e6b --- /dev/null +++ b/plugins/autofmt/autoload/autofmt/unicode.vim @@ -0,0 +1,1316 @@ +" Maintainer: Yukihiro Nakadaira +" License: This file is placed in the public domain. +" Last Change: 2016-11-24 + +if &encoding != "utf-8" && !has("iconv") + " Use echomsg because echoerr is not displayed in formatexpr context. + " Echomsg is same but message is logged in :messages buffer. + echomsg "autofmt/unicode.vim requires iconv() in non utf-8 encoding" + echoerr "autofmt/unicode.vim requires iconv() in non utf-8 encoding" + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +function autofmt#unicode#import() + return s:lib +endfunction + +if v:version > 702 || v:version == 702 && has('patch780') + let s:char2nr_utf8 = function('char2nr') +else + function s:char2nr_utf8(expr, utf8) + if a:utf8 && &encoding != 'utf-8' + let x = map(range(len(a:expr)), 'char2nr(a:expr[v:val])') + if len(x) == 0 + return -1 + elseif len(x) == 1 + return x[0] + elseif len(x) == 2 + return ((x[0] % 0x20) * 0x40) + \ + (x[1] % 0x40) + elseif len(x) == 3 + return ((x[0] % 0x10) * 0x1000) + \ + ((x[1] % 0x40) * 0x40) + \ + (x[2] % 0x40) + elseif len(x) >= 4 + return ((x[0] % 0x8) * 0x40000) + \ + ((x[1] % 0x40) * 0x1000) + \ + ((x[2] % 0x40) * 0x40) + \ + (x[3] % 0x40) + endif + else + return char2nr(a:expr) + endif + endfunction +endif + +let s:lib = {} + +let s:lib.lb_cache = [] + +function s:lib.prop_line_break(char) + let ucs4 = self.to_ucs4(a:char) + if ucs4 < 0x10000 + let row = self.linebreak_bmp[ucs4 / 0x100] + return len(row) == 1 ? row[0] : row[ucs4 % 0x100] + endif + return self.prop_search(ucs4, "XX", self.linebreak_table, self.lb_cache) +endfunction + +function s:lib.prop_search(ucs4, default, table, cache) + let item = self.prop_bsearch(a:ucs4, a:cache) + if item != [] + return item[2] + endif + let item = self.prop_bsearch(a:ucs4, a:table) + if item == [] + return a:default + endif + for i in range(len(a:cache) + 1) + if i == len(a:cache) || item[1] < a:cache[i][0] + call insert(a:cache, item, i) + break + endif + endfor + return item[2] +endfunction + +function s:lib.prop_bsearch(ucs4, table) + let [left, right] = [0, len(a:table)] + while left < right + let mid = (left + right) / 2 + let item = a:table[mid] + if a:ucs4 < item[0] + let right = mid + elseif item[1] < a:ucs4 + let left = mid + 1 + else + return item + endif + endwhile + return [] +endfunction + +function s:lib.uax14_pair_table(before, after) + " these are not handled in the pair tables + let not_in_table = '\vAI|BK|CB|CJ|CR|LF|NL|SA|SG|SP|XX' + if a:before =~ not_in_table || a:after =~ not_in_table + return self.PROHIBITED_BRK + else + let b = self.uax14_pair_table_cols[a:before] + let a = self.uax14_pair_table_cols[a:after] + return self.uax14_pair_table_rows[b][a] + endif +endfunction + +function s:lib.to_ucs4(c) + if &encoding == 'utf-8' + return char2nr(a:c) + else + let u = iconv(a:c, &encoding, "utf-8") + return s:char2nr_utf8(u, 1) + endif +endfunction + +" Line Breaking Algorithm (B=before, A=after) +" B ! A Mandatory break at the indicated position +" B × A No break allowed at the indicated position +" B ÷ A Break allowed at the indicated position +" B % A same as (B SP+ ÷ A) +" +" Table notation +" ^ (B SP* × A) +" % (B × A) and (B SP+ ÷ A) +" @ (B SP* × A), where A is of class CM +" # (B × A) and (B SP+ ÷ A), where A is of class CM +" _ (B ÷ A) + +let s:lib.DIRECT_BRK = '_' +let s:lib.INDIRECT_BRK = '%' +let s:lib.COMBINING_INDIRECT_BRK = '#' +let s:lib.COMBINING_PROHIBITED_BRK = '@' +let s:lib.PROHIBITED_BRK = '^' +let s:lib.EXPLICIT_BRK = '!' + +" Unicode Standard Annex #14 +" Unicode Line Breaking Algorithm +" Revision 37 +" Table 2. Example Pair Table +let s:cols = split("OP CL CP QU GL NS EX SY IS PR PO NU AL HL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT RI EB EM ZWJ") +let s:lib.uax14_pair_table_cols = {} +for s:i in range(len(s:cols)) + let s:lib.uax14_pair_table_cols[s:cols[s:i]] = s:i +endfor +unlet s:cols s:i + +" table[before][after] +let s:lib.uax14_pair_table_rows = [ + \ "^^^^^^^^^^^^^^^^^^^^^@^^^^^^^^^^", + \ "_^^%%^^^^%%_____%%__^#^________%", + \ "_^^%%^^^^%%%%%__%%__^#^________%", + \ "^^^%%%^^^%%%%%%%%%%%^#^%%%%%%%%%", + \ "%^^%%%^^^%%%%%%%%%%%^#^%%%%%%%%%", + \ "_^^%%%^^^_______%%__^#^________%", + \ "_^^%%%^^^______%%%__^#^________%", + \ "_^^%%%^^^__%_%__%%__^#^________%", + \ "_^^%%%^^^__%%%__%%__^#^________%", + \ "%^^%%%^^^__%%%%_%%__^#^%%%%%_%%%", + \ "%^^%%%^^^__%%%__%%__^#^________%", + \ "%^^%%%^^^%%%%%_%%%__^#^________%", + \ "%^^%%%^^^%%%%%_%%%__^#^________%", + \ "%^^%%%^^^%%%%%_%%%__^#^________%", + \ "_^^%%%^^^_%____%%%__^#^________%", + \ "_^^%%%^^^______%%%__^#^________%", + \ "_^^%_%^^^__%____%%__^#^________%", + \ "_^^%_%^^^_______%%__^#^________%", + \ "%^^%%%^^^%%%%%%%%%%%^#^%%%%%%%%%", + \ "_^^%%%^^^_______%%_^^#^________%", + \ "____________________^___________", + \ "%^^%%%^^^%%%%%_%%%__^#^________%", + \ "%^^%%%^^^%%%%%%%%%%%^#^%%%%%%%%%", + \ "_^^%%%^^^_%____%%%__^#^___%%___%", + \ "_^^%%%^^^_%____%%%__^#^____%___%", + \ "_^^%%%^^^_%____%%%__^#^%%%%____%", + \ "_^^%%%^^^_%____%%%__^#^___%%___%", + \ "_^^%%%^^^_%____%%%__^#^____%___%", + \ "_^^%%%^^^_______%%__^#^_____%__%", + \ "_^^%%%^^^_%____%%%__^#^_______%%", + \ "_^^%%%^^^_%____%%%__^#^________%", + \ "_^^%%%^^^_____%_%%__^#^______%%%", + \ ] + + +" LineBreak-9.0.0.txt +" Date: 2016-05-26, 01:00:00 GMT [KW, LI] +let s:tmp = [] +call extend(s:tmp, [[0x0000,0x0008,'CM'],[0x0009,0x0009,'BA'],[0x000A,0x000A,'LF']]) +call extend(s:tmp, [[0x000B,0x000C,'BK'],[0x000D,0x000D,'CR'],[0x000E,0x001F,'CM']]) +call extend(s:tmp, [[0x0020,0x0020,'SP'],[0x0021,0x0021,'EX'],[0x0022,0x0022,'QU']]) +call extend(s:tmp, [[0x0023,0x0023,'AL'],[0x0024,0x0024,'PR'],[0x0025,0x0025,'PO']]) +call extend(s:tmp, [[0x0026,0x0026,'AL'],[0x0027,0x0027,'QU'],[0x0028,0x0028,'OP']]) +call extend(s:tmp, [[0x0029,0x0029,'CP'],[0x002A,0x002A,'AL'],[0x002B,0x002B,'PR']]) +call extend(s:tmp, [[0x002C,0x002C,'IS'],[0x002D,0x002D,'HY'],[0x002E,0x002E,'IS']]) +call extend(s:tmp, [[0x002F,0x002F,'SY'],[0x0030,0x0039,'NU'],[0x003A,0x003B,'IS']]) +call extend(s:tmp, [[0x003C,0x003E,'AL'],[0x003F,0x003F,'EX'],[0x0040,0x005A,'AL']]) +call extend(s:tmp, [[0x005B,0x005B,'OP'],[0x005C,0x005C,'PR'],[0x005D,0x005D,'CP']]) +call extend(s:tmp, [[0x005E,0x007A,'AL'],[0x007B,0x007B,'OP'],[0x007C,0x007C,'BA']]) +call extend(s:tmp, [[0x007D,0x007D,'CL'],[0x007E,0x007E,'AL'],[0x007F,0x0084,'CM']]) +call extend(s:tmp, [[0x0085,0x0085,'NL'],[0x0086,0x009F,'CM'],[0x00A0,0x00A0,'GL']]) +call extend(s:tmp, [[0x00A1,0x00A1,'OP'],[0x00A2,0x00A2,'PO'],[0x00A3,0x00A5,'PR']]) +call extend(s:tmp, [[0x00A6,0x00A6,'AL'],[0x00A7,0x00A8,'AI'],[0x00A9,0x00A9,'AL']]) +call extend(s:tmp, [[0x00AA,0x00AA,'AI'],[0x00AB,0x00AB,'QU'],[0x00AC,0x00AC,'AL']]) +call extend(s:tmp, [[0x00AD,0x00AD,'BA'],[0x00AE,0x00AF,'AL'],[0x00B0,0x00B0,'PO']]) +call extend(s:tmp, [[0x00B1,0x00B1,'PR'],[0x00B2,0x00B3,'AI'],[0x00B4,0x00B4,'BB']]) +call extend(s:tmp, [[0x00B5,0x00B5,'AL'],[0x00B6,0x00BA,'AI'],[0x00BB,0x00BB,'QU']]) +call extend(s:tmp, [[0x00BC,0x00BE,'AI'],[0x00BF,0x00BF,'OP'],[0x00C0,0x00D6,'AL']]) +call extend(s:tmp, [[0x00D7,0x00D7,'AI'],[0x00D8,0x00F6,'AL'],[0x00F7,0x00F7,'AI']]) +call extend(s:tmp, [[0x00F8,0x02C6,'AL'],[0x02C7,0x02C7,'AI'],[0x02C8,0x02C8,'BB']]) +call extend(s:tmp, [[0x02C9,0x02CB,'AI'],[0x02CC,0x02CC,'BB'],[0x02CD,0x02CD,'AI']]) +call extend(s:tmp, [[0x02CE,0x02CF,'AL'],[0x02D0,0x02D0,'AI'],[0x02D1,0x02D7,'AL']]) +call extend(s:tmp, [[0x02D8,0x02DB,'AI'],[0x02DC,0x02DC,'AL'],[0x02DD,0x02DD,'AI']]) +call extend(s:tmp, [[0x02DE,0x02DE,'AL'],[0x02DF,0x02DF,'BB'],[0x02E0,0x02FF,'AL']]) +call extend(s:tmp, [[0x0300,0x034E,'CM'],[0x034F,0x034F,'GL'],[0x0350,0x035B,'CM']]) +call extend(s:tmp, [[0x035C,0x0362,'GL'],[0x0363,0x036F,'CM'],[0x0370,0x0377,'AL']]) +call extend(s:tmp, [[0x037A,0x037D,'AL'],[0x037E,0x037E,'IS'],[0x037F,0x037F,'AL']]) +call extend(s:tmp, [[0x0384,0x038A,'AL'],[0x038C,0x038C,'AL'],[0x038E,0x03A1,'AL']]) +call extend(s:tmp, [[0x03A3,0x0482,'AL'],[0x0483,0x0489,'CM'],[0x048A,0x052F,'AL']]) +call extend(s:tmp, [[0x0531,0x0556,'AL'],[0x0559,0x055F,'AL'],[0x0561,0x0587,'AL']]) +call extend(s:tmp, [[0x0589,0x0589,'IS'],[0x058A,0x058A,'BA'],[0x058D,0x058E,'AL']]) +call extend(s:tmp, [[0x058F,0x058F,'PR'],[0x0591,0x05BD,'CM'],[0x05BE,0x05BE,'BA']]) +call extend(s:tmp, [[0x05BF,0x05BF,'CM'],[0x05C0,0x05C0,'AL'],[0x05C1,0x05C2,'CM']]) +call extend(s:tmp, [[0x05C3,0x05C3,'AL'],[0x05C4,0x05C5,'CM'],[0x05C6,0x05C6,'EX']]) +call extend(s:tmp, [[0x05C7,0x05C7,'CM'],[0x05D0,0x05EA,'HL'],[0x05F0,0x05F2,'HL']]) +call extend(s:tmp, [[0x05F3,0x05F4,'AL'],[0x0600,0x0608,'AL'],[0x0609,0x060B,'PO']]) +call extend(s:tmp, [[0x060C,0x060D,'IS'],[0x060E,0x060F,'AL'],[0x0610,0x061A,'CM']]) +call extend(s:tmp, [[0x061B,0x061B,'EX'],[0x061C,0x061C,'CM'],[0x061E,0x061F,'EX']]) +call extend(s:tmp, [[0x0620,0x064A,'AL'],[0x064B,0x065F,'CM'],[0x0660,0x0669,'NU']]) +call extend(s:tmp, [[0x066A,0x066A,'PO'],[0x066B,0x066C,'NU'],[0x066D,0x066F,'AL']]) +call extend(s:tmp, [[0x0670,0x0670,'CM'],[0x0671,0x06D3,'AL'],[0x06D4,0x06D4,'EX']]) +call extend(s:tmp, [[0x06D5,0x06D5,'AL'],[0x06D6,0x06DC,'CM'],[0x06DD,0x06DE,'AL']]) +call extend(s:tmp, [[0x06DF,0x06E4,'CM'],[0x06E5,0x06E6,'AL'],[0x06E7,0x06E8,'CM']]) +call extend(s:tmp, [[0x06E9,0x06E9,'AL'],[0x06EA,0x06ED,'CM'],[0x06EE,0x06EF,'AL']]) +call extend(s:tmp, [[0x06F0,0x06F9,'NU'],[0x06FA,0x070D,'AL'],[0x070F,0x0710,'AL']]) +call extend(s:tmp, [[0x0711,0x0711,'CM'],[0x0712,0x072F,'AL'],[0x0730,0x074A,'CM']]) +call extend(s:tmp, [[0x074D,0x07A5,'AL'],[0x07A6,0x07B0,'CM'],[0x07B1,0x07B1,'AL']]) +call extend(s:tmp, [[0x07C0,0x07C9,'NU'],[0x07CA,0x07EA,'AL'],[0x07EB,0x07F3,'CM']]) +call extend(s:tmp, [[0x07F4,0x07F7,'AL'],[0x07F8,0x07F8,'IS'],[0x07F9,0x07F9,'EX']]) +call extend(s:tmp, [[0x07FA,0x07FA,'AL'],[0x0800,0x0815,'AL'],[0x0816,0x0819,'CM']]) +call extend(s:tmp, [[0x081A,0x081A,'AL'],[0x081B,0x0823,'CM'],[0x0824,0x0824,'AL']]) +call extend(s:tmp, [[0x0825,0x0827,'CM'],[0x0828,0x0828,'AL'],[0x0829,0x082D,'CM']]) +call extend(s:tmp, [[0x0830,0x083E,'AL'],[0x0840,0x0858,'AL'],[0x0859,0x085B,'CM']]) +call extend(s:tmp, [[0x085E,0x085E,'AL'],[0x08A0,0x08B4,'AL'],[0x08B6,0x08BD,'AL']]) +call extend(s:tmp, [[0x08D4,0x08E1,'CM'],[0x08E2,0x08E2,'AL'],[0x08E3,0x0903,'CM']]) +call extend(s:tmp, [[0x0904,0x0939,'AL'],[0x093A,0x093C,'CM'],[0x093D,0x093D,'AL']]) +call extend(s:tmp, [[0x093E,0x094F,'CM'],[0x0950,0x0950,'AL'],[0x0951,0x0957,'CM']]) +call extend(s:tmp, [[0x0958,0x0961,'AL'],[0x0962,0x0963,'CM'],[0x0964,0x0965,'BA']]) +call extend(s:tmp, [[0x0966,0x096F,'NU'],[0x0970,0x0980,'AL'],[0x0981,0x0983,'CM']]) +call extend(s:tmp, [[0x0985,0x098C,'AL'],[0x098F,0x0990,'AL'],[0x0993,0x09A8,'AL']]) +call extend(s:tmp, [[0x09AA,0x09B0,'AL'],[0x09B2,0x09B2,'AL'],[0x09B6,0x09B9,'AL']]) +call extend(s:tmp, [[0x09BC,0x09BC,'CM'],[0x09BD,0x09BD,'AL'],[0x09BE,0x09C4,'CM']]) +call extend(s:tmp, [[0x09C7,0x09C8,'CM'],[0x09CB,0x09CD,'CM'],[0x09CE,0x09CE,'AL']]) +call extend(s:tmp, [[0x09D7,0x09D7,'CM'],[0x09DC,0x09DD,'AL'],[0x09DF,0x09E1,'AL']]) +call extend(s:tmp, [[0x09E2,0x09E3,'CM'],[0x09E6,0x09EF,'NU'],[0x09F0,0x09F1,'AL']]) +call extend(s:tmp, [[0x09F2,0x09F3,'PO'],[0x09F4,0x09F8,'AL'],[0x09F9,0x09F9,'PO']]) +call extend(s:tmp, [[0x09FA,0x09FA,'AL'],[0x09FB,0x09FB,'PR'],[0x0A01,0x0A03,'CM']]) +call extend(s:tmp, [[0x0A05,0x0A0A,'AL'],[0x0A0F,0x0A10,'AL'],[0x0A13,0x0A28,'AL']]) +call extend(s:tmp, [[0x0A2A,0x0A30,'AL'],[0x0A32,0x0A33,'AL'],[0x0A35,0x0A36,'AL']]) +call extend(s:tmp, [[0x0A38,0x0A39,'AL'],[0x0A3C,0x0A3C,'CM'],[0x0A3E,0x0A42,'CM']]) +call extend(s:tmp, [[0x0A47,0x0A48,'CM'],[0x0A4B,0x0A4D,'CM'],[0x0A51,0x0A51,'CM']]) +call extend(s:tmp, [[0x0A59,0x0A5C,'AL'],[0x0A5E,0x0A5E,'AL'],[0x0A66,0x0A6F,'NU']]) +call extend(s:tmp, [[0x0A70,0x0A71,'CM'],[0x0A72,0x0A74,'AL'],[0x0A75,0x0A75,'CM']]) +call extend(s:tmp, [[0x0A81,0x0A83,'CM'],[0x0A85,0x0A8D,'AL'],[0x0A8F,0x0A91,'AL']]) +call extend(s:tmp, [[0x0A93,0x0AA8,'AL'],[0x0AAA,0x0AB0,'AL'],[0x0AB2,0x0AB3,'AL']]) +call extend(s:tmp, [[0x0AB5,0x0AB9,'AL'],[0x0ABC,0x0ABC,'CM'],[0x0ABD,0x0ABD,'AL']]) +call extend(s:tmp, [[0x0ABE,0x0AC5,'CM'],[0x0AC7,0x0AC9,'CM'],[0x0ACB,0x0ACD,'CM']]) +call extend(s:tmp, [[0x0AD0,0x0AD0,'AL'],[0x0AE0,0x0AE1,'AL'],[0x0AE2,0x0AE3,'CM']]) +call extend(s:tmp, [[0x0AE6,0x0AEF,'NU'],[0x0AF0,0x0AF0,'AL'],[0x0AF1,0x0AF1,'PR']]) +call extend(s:tmp, [[0x0AF9,0x0AF9,'AL'],[0x0B01,0x0B03,'CM'],[0x0B05,0x0B0C,'AL']]) +call extend(s:tmp, [[0x0B0F,0x0B10,'AL'],[0x0B13,0x0B28,'AL'],[0x0B2A,0x0B30,'AL']]) +call extend(s:tmp, [[0x0B32,0x0B33,'AL'],[0x0B35,0x0B39,'AL'],[0x0B3C,0x0B3C,'CM']]) +call extend(s:tmp, [[0x0B3D,0x0B3D,'AL'],[0x0B3E,0x0B44,'CM'],[0x0B47,0x0B48,'CM']]) +call extend(s:tmp, [[0x0B4B,0x0B4D,'CM'],[0x0B56,0x0B57,'CM'],[0x0B5C,0x0B5D,'AL']]) +call extend(s:tmp, [[0x0B5F,0x0B61,'AL'],[0x0B62,0x0B63,'CM'],[0x0B66,0x0B6F,'NU']]) +call extend(s:tmp, [[0x0B70,0x0B77,'AL'],[0x0B82,0x0B82,'CM'],[0x0B83,0x0B83,'AL']]) +call extend(s:tmp, [[0x0B85,0x0B8A,'AL'],[0x0B8E,0x0B90,'AL'],[0x0B92,0x0B95,'AL']]) +call extend(s:tmp, [[0x0B99,0x0B9A,'AL'],[0x0B9C,0x0B9C,'AL'],[0x0B9E,0x0B9F,'AL']]) +call extend(s:tmp, [[0x0BA3,0x0BA4,'AL'],[0x0BA8,0x0BAA,'AL'],[0x0BAE,0x0BB9,'AL']]) +call extend(s:tmp, [[0x0BBE,0x0BC2,'CM'],[0x0BC6,0x0BC8,'CM'],[0x0BCA,0x0BCD,'CM']]) +call extend(s:tmp, [[0x0BD0,0x0BD0,'AL'],[0x0BD7,0x0BD7,'CM'],[0x0BE6,0x0BEF,'NU']]) +call extend(s:tmp, [[0x0BF0,0x0BF8,'AL'],[0x0BF9,0x0BF9,'PR'],[0x0BFA,0x0BFA,'AL']]) +call extend(s:tmp, [[0x0C00,0x0C03,'CM'],[0x0C05,0x0C0C,'AL'],[0x0C0E,0x0C10,'AL']]) +call extend(s:tmp, [[0x0C12,0x0C28,'AL'],[0x0C2A,0x0C39,'AL'],[0x0C3D,0x0C3D,'AL']]) +call extend(s:tmp, [[0x0C3E,0x0C44,'CM'],[0x0C46,0x0C48,'CM'],[0x0C4A,0x0C4D,'CM']]) +call extend(s:tmp, [[0x0C55,0x0C56,'CM'],[0x0C58,0x0C5A,'AL'],[0x0C60,0x0C61,'AL']]) +call extend(s:tmp, [[0x0C62,0x0C63,'CM'],[0x0C66,0x0C6F,'NU'],[0x0C78,0x0C80,'AL']]) +call extend(s:tmp, [[0x0C81,0x0C83,'CM'],[0x0C85,0x0C8C,'AL'],[0x0C8E,0x0C90,'AL']]) +call extend(s:tmp, [[0x0C92,0x0CA8,'AL'],[0x0CAA,0x0CB3,'AL'],[0x0CB5,0x0CB9,'AL']]) +call extend(s:tmp, [[0x0CBC,0x0CBC,'CM'],[0x0CBD,0x0CBD,'AL'],[0x0CBE,0x0CC4,'CM']]) +call extend(s:tmp, [[0x0CC6,0x0CC8,'CM'],[0x0CCA,0x0CCD,'CM'],[0x0CD5,0x0CD6,'CM']]) +call extend(s:tmp, [[0x0CDE,0x0CDE,'AL'],[0x0CE0,0x0CE1,'AL'],[0x0CE2,0x0CE3,'CM']]) +call extend(s:tmp, [[0x0CE6,0x0CEF,'NU'],[0x0CF1,0x0CF2,'AL'],[0x0D01,0x0D03,'CM']]) +call extend(s:tmp, [[0x0D05,0x0D0C,'AL'],[0x0D0E,0x0D10,'AL'],[0x0D12,0x0D3A,'AL']]) +call extend(s:tmp, [[0x0D3D,0x0D3D,'AL'],[0x0D3E,0x0D44,'CM'],[0x0D46,0x0D48,'CM']]) +call extend(s:tmp, [[0x0D4A,0x0D4D,'CM'],[0x0D4E,0x0D4F,'AL'],[0x0D54,0x0D56,'AL']]) +call extend(s:tmp, [[0x0D57,0x0D57,'CM'],[0x0D58,0x0D61,'AL'],[0x0D62,0x0D63,'CM']]) +call extend(s:tmp, [[0x0D66,0x0D6F,'NU'],[0x0D70,0x0D78,'AL'],[0x0D79,0x0D79,'PO']]) +call extend(s:tmp, [[0x0D7A,0x0D7F,'AL'],[0x0D82,0x0D83,'CM'],[0x0D85,0x0D96,'AL']]) +call extend(s:tmp, [[0x0D9A,0x0DB1,'AL'],[0x0DB3,0x0DBB,'AL'],[0x0DBD,0x0DBD,'AL']]) +call extend(s:tmp, [[0x0DC0,0x0DC6,'AL'],[0x0DCA,0x0DCA,'CM'],[0x0DCF,0x0DD4,'CM']]) +call extend(s:tmp, [[0x0DD6,0x0DD6,'CM'],[0x0DD8,0x0DDF,'CM'],[0x0DE6,0x0DEF,'NU']]) +call extend(s:tmp, [[0x0DF2,0x0DF3,'CM'],[0x0DF4,0x0DF4,'AL'],[0x0E01,0x0E3A,'SA']]) +call extend(s:tmp, [[0x0E3F,0x0E3F,'PR'],[0x0E40,0x0E4E,'SA'],[0x0E4F,0x0E4F,'AL']]) +call extend(s:tmp, [[0x0E50,0x0E59,'NU'],[0x0E5A,0x0E5B,'BA'],[0x0E81,0x0E82,'SA']]) +call extend(s:tmp, [[0x0E84,0x0E84,'SA'],[0x0E87,0x0E88,'SA'],[0x0E8A,0x0E8A,'SA']]) +call extend(s:tmp, [[0x0E8D,0x0E8D,'SA'],[0x0E94,0x0E97,'SA'],[0x0E99,0x0E9F,'SA']]) +call extend(s:tmp, [[0x0EA1,0x0EA3,'SA'],[0x0EA5,0x0EA5,'SA'],[0x0EA7,0x0EA7,'SA']]) +call extend(s:tmp, [[0x0EAA,0x0EAB,'SA'],[0x0EAD,0x0EB9,'SA'],[0x0EBB,0x0EBD,'SA']]) +call extend(s:tmp, [[0x0EC0,0x0EC4,'SA'],[0x0EC6,0x0EC6,'SA'],[0x0EC8,0x0ECD,'SA']]) +call extend(s:tmp, [[0x0ED0,0x0ED9,'NU'],[0x0EDC,0x0EDF,'SA'],[0x0F00,0x0F00,'AL']]) +call extend(s:tmp, [[0x0F01,0x0F04,'BB'],[0x0F05,0x0F05,'AL'],[0x0F06,0x0F07,'BB']]) +call extend(s:tmp, [[0x0F08,0x0F08,'GL'],[0x0F09,0x0F0A,'BB'],[0x0F0B,0x0F0B,'BA']]) +call extend(s:tmp, [[0x0F0C,0x0F0C,'GL'],[0x0F0D,0x0F11,'EX'],[0x0F12,0x0F12,'GL']]) +call extend(s:tmp, [[0x0F13,0x0F13,'AL'],[0x0F14,0x0F14,'EX'],[0x0F15,0x0F17,'AL']]) +call extend(s:tmp, [[0x0F18,0x0F19,'CM'],[0x0F1A,0x0F1F,'AL'],[0x0F20,0x0F29,'NU']]) +call extend(s:tmp, [[0x0F2A,0x0F33,'AL'],[0x0F34,0x0F34,'BA'],[0x0F35,0x0F35,'CM']]) +call extend(s:tmp, [[0x0F36,0x0F36,'AL'],[0x0F37,0x0F37,'CM'],[0x0F38,0x0F38,'AL']]) +call extend(s:tmp, [[0x0F39,0x0F39,'CM'],[0x0F3A,0x0F3A,'OP'],[0x0F3B,0x0F3B,'CL']]) +call extend(s:tmp, [[0x0F3C,0x0F3C,'OP'],[0x0F3D,0x0F3D,'CL'],[0x0F3E,0x0F3F,'CM']]) +call extend(s:tmp, [[0x0F40,0x0F47,'AL'],[0x0F49,0x0F6C,'AL'],[0x0F71,0x0F7E,'CM']]) +call extend(s:tmp, [[0x0F7F,0x0F7F,'BA'],[0x0F80,0x0F84,'CM'],[0x0F85,0x0F85,'BA']]) +call extend(s:tmp, [[0x0F86,0x0F87,'CM'],[0x0F88,0x0F8C,'AL'],[0x0F8D,0x0F97,'CM']]) +call extend(s:tmp, [[0x0F99,0x0FBC,'CM'],[0x0FBE,0x0FBF,'BA'],[0x0FC0,0x0FC5,'AL']]) +call extend(s:tmp, [[0x0FC6,0x0FC6,'CM'],[0x0FC7,0x0FCC,'AL'],[0x0FCE,0x0FCF,'AL']]) +call extend(s:tmp, [[0x0FD0,0x0FD1,'BB'],[0x0FD2,0x0FD2,'BA'],[0x0FD3,0x0FD3,'BB']]) +call extend(s:tmp, [[0x0FD4,0x0FD8,'AL'],[0x0FD9,0x0FDA,'GL'],[0x1000,0x103F,'SA']]) +call extend(s:tmp, [[0x1040,0x1049,'NU'],[0x104A,0x104B,'BA'],[0x104C,0x104F,'AL']]) +call extend(s:tmp, [[0x1050,0x108F,'SA'],[0x1090,0x1099,'NU'],[0x109A,0x109F,'SA']]) +call extend(s:tmp, [[0x10A0,0x10C5,'AL'],[0x10C7,0x10C7,'AL'],[0x10CD,0x10CD,'AL']]) +call extend(s:tmp, [[0x10D0,0x10FF,'AL'],[0x1100,0x115F,'JL'],[0x1160,0x11A7,'JV']]) +call extend(s:tmp, [[0x11A8,0x11FF,'JT'],[0x1200,0x1248,'AL'],[0x124A,0x124D,'AL']]) +call extend(s:tmp, [[0x1250,0x1256,'AL'],[0x1258,0x1258,'AL'],[0x125A,0x125D,'AL']]) +call extend(s:tmp, [[0x1260,0x1288,'AL'],[0x128A,0x128D,'AL'],[0x1290,0x12B0,'AL']]) +call extend(s:tmp, [[0x12B2,0x12B5,'AL'],[0x12B8,0x12BE,'AL'],[0x12C0,0x12C0,'AL']]) +call extend(s:tmp, [[0x12C2,0x12C5,'AL'],[0x12C8,0x12D6,'AL'],[0x12D8,0x1310,'AL']]) +call extend(s:tmp, [[0x1312,0x1315,'AL'],[0x1318,0x135A,'AL'],[0x135D,0x135F,'CM']]) +call extend(s:tmp, [[0x1360,0x1360,'AL'],[0x1361,0x1361,'BA'],[0x1362,0x137C,'AL']]) +call extend(s:tmp, [[0x1380,0x1399,'AL'],[0x13A0,0x13F5,'AL'],[0x13F8,0x13FD,'AL']]) +call extend(s:tmp, [[0x1400,0x1400,'BA'],[0x1401,0x167F,'AL'],[0x1680,0x1680,'BA']]) +call extend(s:tmp, [[0x1681,0x169A,'AL'],[0x169B,0x169B,'OP'],[0x169C,0x169C,'CL']]) +call extend(s:tmp, [[0x16A0,0x16EA,'AL'],[0x16EB,0x16ED,'BA'],[0x16EE,0x16F8,'AL']]) +call extend(s:tmp, [[0x1700,0x170C,'AL'],[0x170E,0x1711,'AL'],[0x1712,0x1714,'CM']]) +call extend(s:tmp, [[0x1720,0x1731,'AL'],[0x1732,0x1734,'CM'],[0x1735,0x1736,'BA']]) +call extend(s:tmp, [[0x1740,0x1751,'AL'],[0x1752,0x1753,'CM'],[0x1760,0x176C,'AL']]) +call extend(s:tmp, [[0x176E,0x1770,'AL'],[0x1772,0x1773,'CM'],[0x1780,0x17D3,'SA']]) +call extend(s:tmp, [[0x17D4,0x17D5,'BA'],[0x17D6,0x17D6,'NS'],[0x17D7,0x17D7,'SA']]) +call extend(s:tmp, [[0x17D8,0x17D8,'BA'],[0x17D9,0x17D9,'AL'],[0x17DA,0x17DA,'BA']]) +call extend(s:tmp, [[0x17DB,0x17DB,'PR'],[0x17DC,0x17DD,'SA'],[0x17E0,0x17E9,'NU']]) +call extend(s:tmp, [[0x17F0,0x17F9,'AL'],[0x1800,0x1801,'AL'],[0x1802,0x1803,'EX']]) +call extend(s:tmp, [[0x1804,0x1805,'BA'],[0x1806,0x1806,'BB'],[0x1807,0x1807,'AL']]) +call extend(s:tmp, [[0x1808,0x1809,'EX'],[0x180A,0x180A,'AL'],[0x180B,0x180D,'CM']]) +call extend(s:tmp, [[0x180E,0x180E,'GL'],[0x1810,0x1819,'NU'],[0x1820,0x1877,'AL']]) +call extend(s:tmp, [[0x1880,0x1884,'AL'],[0x1885,0x1886,'CM'],[0x1887,0x18A8,'AL']]) +call extend(s:tmp, [[0x18A9,0x18A9,'CM'],[0x18AA,0x18AA,'AL'],[0x18B0,0x18F5,'AL']]) +call extend(s:tmp, [[0x1900,0x191E,'AL'],[0x1920,0x192B,'CM'],[0x1930,0x193B,'CM']]) +call extend(s:tmp, [[0x1940,0x1940,'AL'],[0x1944,0x1945,'EX'],[0x1946,0x194F,'NU']]) +call extend(s:tmp, [[0x1950,0x196D,'SA'],[0x1970,0x1974,'SA'],[0x1980,0x19AB,'SA']]) +call extend(s:tmp, [[0x19B0,0x19C9,'SA'],[0x19D0,0x19D9,'NU'],[0x19DA,0x19DA,'SA']]) +call extend(s:tmp, [[0x19DE,0x19DF,'SA'],[0x19E0,0x1A16,'AL'],[0x1A17,0x1A1B,'CM']]) +call extend(s:tmp, [[0x1A1E,0x1A1F,'AL'],[0x1A20,0x1A5E,'SA'],[0x1A60,0x1A7C,'SA']]) +call extend(s:tmp, [[0x1A7F,0x1A7F,'CM'],[0x1A80,0x1A89,'NU'],[0x1A90,0x1A99,'NU']]) +call extend(s:tmp, [[0x1AA0,0x1AAD,'SA'],[0x1AB0,0x1ABE,'CM'],[0x1B00,0x1B04,'CM']]) +call extend(s:tmp, [[0x1B05,0x1B33,'AL'],[0x1B34,0x1B44,'CM'],[0x1B45,0x1B4B,'AL']]) +call extend(s:tmp, [[0x1B50,0x1B59,'NU'],[0x1B5A,0x1B5B,'BA'],[0x1B5C,0x1B5C,'AL']]) +call extend(s:tmp, [[0x1B5D,0x1B60,'BA'],[0x1B61,0x1B6A,'AL'],[0x1B6B,0x1B73,'CM']]) +call extend(s:tmp, [[0x1B74,0x1B7C,'AL'],[0x1B80,0x1B82,'CM'],[0x1B83,0x1BA0,'AL']]) +call extend(s:tmp, [[0x1BA1,0x1BAD,'CM'],[0x1BAE,0x1BAF,'AL'],[0x1BB0,0x1BB9,'NU']]) +call extend(s:tmp, [[0x1BBA,0x1BE5,'AL'],[0x1BE6,0x1BF3,'CM'],[0x1BFC,0x1C23,'AL']]) +call extend(s:tmp, [[0x1C24,0x1C37,'CM'],[0x1C3B,0x1C3F,'BA'],[0x1C40,0x1C49,'NU']]) +call extend(s:tmp, [[0x1C4D,0x1C4F,'AL'],[0x1C50,0x1C59,'NU'],[0x1C5A,0x1C7D,'AL']]) +call extend(s:tmp, [[0x1C7E,0x1C7F,'BA'],[0x1C80,0x1C88,'AL'],[0x1CC0,0x1CC7,'AL']]) +call extend(s:tmp, [[0x1CD0,0x1CD2,'CM'],[0x1CD3,0x1CD3,'AL'],[0x1CD4,0x1CE8,'CM']]) +call extend(s:tmp, [[0x1CE9,0x1CEC,'AL'],[0x1CED,0x1CED,'CM'],[0x1CEE,0x1CF1,'AL']]) +call extend(s:tmp, [[0x1CF2,0x1CF4,'CM'],[0x1CF5,0x1CF6,'AL'],[0x1CF8,0x1CF9,'CM']]) +call extend(s:tmp, [[0x1D00,0x1DBF,'AL'],[0x1DC0,0x1DF5,'CM'],[0x1DFB,0x1DFF,'CM']]) +call extend(s:tmp, [[0x1E00,0x1F15,'AL'],[0x1F18,0x1F1D,'AL'],[0x1F20,0x1F45,'AL']]) +call extend(s:tmp, [[0x1F48,0x1F4D,'AL'],[0x1F50,0x1F57,'AL'],[0x1F59,0x1F59,'AL']]) +call extend(s:tmp, [[0x1F5B,0x1F5B,'AL'],[0x1F5D,0x1F5D,'AL'],[0x1F5F,0x1F7D,'AL']]) +call extend(s:tmp, [[0x1F80,0x1FB4,'AL'],[0x1FB6,0x1FC4,'AL'],[0x1FC6,0x1FD3,'AL']]) +call extend(s:tmp, [[0x1FD6,0x1FDB,'AL'],[0x1FDD,0x1FEF,'AL'],[0x1FF2,0x1FF4,'AL']]) +call extend(s:tmp, [[0x1FF6,0x1FFC,'AL'],[0x1FFD,0x1FFD,'BB'],[0x1FFE,0x1FFE,'AL']]) +call extend(s:tmp, [[0x2000,0x2006,'BA'],[0x2007,0x2007,'GL'],[0x2008,0x200A,'BA']]) +call extend(s:tmp, [[0x200B,0x200B,'ZW'],[0x200C,0x200C,'CM'],[0x200D,0x200D,'ZWJ']]) +call extend(s:tmp, [[0x200E,0x200F,'CM'],[0x2010,0x2010,'BA'],[0x2011,0x2011,'GL']]) +call extend(s:tmp, [[0x2012,0x2013,'BA'],[0x2014,0x2014,'B2'],[0x2015,0x2016,'AI']]) +call extend(s:tmp, [[0x2017,0x2017,'AL'],[0x2018,0x2019,'QU'],[0x201A,0x201A,'OP']]) +call extend(s:tmp, [[0x201B,0x201D,'QU'],[0x201E,0x201E,'OP'],[0x201F,0x201F,'QU']]) +call extend(s:tmp, [[0x2020,0x2021,'AI'],[0x2022,0x2023,'AL'],[0x2024,0x2026,'IN']]) +call extend(s:tmp, [[0x2027,0x2027,'BA'],[0x2028,0x2029,'BK'],[0x202A,0x202E,'CM']]) +call extend(s:tmp, [[0x202F,0x202F,'GL'],[0x2030,0x2037,'PO'],[0x2038,0x2038,'AL']]) +call extend(s:tmp, [[0x2039,0x203A,'QU'],[0x203B,0x203B,'AI'],[0x203C,0x203D,'NS']]) +call extend(s:tmp, [[0x203E,0x2043,'AL'],[0x2044,0x2044,'IS'],[0x2045,0x2045,'OP']]) +call extend(s:tmp, [[0x2046,0x2046,'CL'],[0x2047,0x2049,'NS'],[0x204A,0x2055,'AL']]) +call extend(s:tmp, [[0x2056,0x2056,'BA'],[0x2057,0x2057,'AL'],[0x2058,0x205B,'BA']]) +call extend(s:tmp, [[0x205C,0x205C,'AL'],[0x205D,0x205F,'BA'],[0x2060,0x2060,'WJ']]) +call extend(s:tmp, [[0x2061,0x2064,'AL'],[0x2066,0x206F,'CM'],[0x2070,0x2071,'AL']]) +call extend(s:tmp, [[0x2074,0x2074,'AI'],[0x2075,0x207C,'AL'],[0x207D,0x207D,'OP']]) +call extend(s:tmp, [[0x207E,0x207E,'CL'],[0x207F,0x207F,'AI'],[0x2080,0x2080,'AL']]) +call extend(s:tmp, [[0x2081,0x2084,'AI'],[0x2085,0x208C,'AL'],[0x208D,0x208D,'OP']]) +call extend(s:tmp, [[0x208E,0x208E,'CL'],[0x2090,0x209C,'AL'],[0x20A0,0x20A6,'PR']]) +call extend(s:tmp, [[0x20A7,0x20A7,'PO'],[0x20A8,0x20B5,'PR'],[0x20B6,0x20B6,'PO']]) +call extend(s:tmp, [[0x20B7,0x20BA,'PR'],[0x20BB,0x20BB,'PO'],[0x20BC,0x20BD,'PR']]) +call extend(s:tmp, [[0x20BE,0x20BE,'PO'],[0x20BF,0x20CF,'PR'],[0x20D0,0x20F0,'CM']]) +call extend(s:tmp, [[0x2100,0x2102,'AL'],[0x2103,0x2103,'PO'],[0x2104,0x2104,'AL']]) +call extend(s:tmp, [[0x2105,0x2105,'AI'],[0x2106,0x2108,'AL'],[0x2109,0x2109,'PO']]) +call extend(s:tmp, [[0x210A,0x2112,'AL'],[0x2113,0x2113,'AI'],[0x2114,0x2115,'AL']]) +call extend(s:tmp, [[0x2116,0x2116,'PR'],[0x2117,0x2120,'AL'],[0x2121,0x2122,'AI']]) +call extend(s:tmp, [[0x2123,0x212A,'AL'],[0x212B,0x212B,'AI'],[0x212C,0x2153,'AL']]) +call extend(s:tmp, [[0x2154,0x2155,'AI'],[0x2156,0x215A,'AL'],[0x215B,0x215B,'AI']]) +call extend(s:tmp, [[0x215C,0x215D,'AL'],[0x215E,0x215E,'AI'],[0x215F,0x215F,'AL']]) +call extend(s:tmp, [[0x2160,0x216B,'AI'],[0x216C,0x216F,'AL'],[0x2170,0x2179,'AI']]) +call extend(s:tmp, [[0x217A,0x2188,'AL'],[0x2189,0x2189,'AI'],[0x218A,0x218B,'AL']]) +call extend(s:tmp, [[0x2190,0x2199,'AI'],[0x219A,0x21D1,'AL'],[0x21D2,0x21D2,'AI']]) +call extend(s:tmp, [[0x21D3,0x21D3,'AL'],[0x21D4,0x21D4,'AI'],[0x21D5,0x21FF,'AL']]) +call extend(s:tmp, [[0x2200,0x2200,'AI'],[0x2201,0x2201,'AL'],[0x2202,0x2203,'AI']]) +call extend(s:tmp, [[0x2204,0x2206,'AL'],[0x2207,0x2208,'AI'],[0x2209,0x220A,'AL']]) +call extend(s:tmp, [[0x220B,0x220B,'AI'],[0x220C,0x220E,'AL'],[0x220F,0x220F,'AI']]) +call extend(s:tmp, [[0x2210,0x2210,'AL'],[0x2211,0x2211,'AI'],[0x2212,0x2213,'PR']]) +call extend(s:tmp, [[0x2214,0x2214,'AL'],[0x2215,0x2215,'AI'],[0x2216,0x2219,'AL']]) +call extend(s:tmp, [[0x221A,0x221A,'AI'],[0x221B,0x221C,'AL'],[0x221D,0x2220,'AI']]) +call extend(s:tmp, [[0x2221,0x2222,'AL'],[0x2223,0x2223,'AI'],[0x2224,0x2224,'AL']]) +call extend(s:tmp, [[0x2225,0x2225,'AI'],[0x2226,0x2226,'AL'],[0x2227,0x222C,'AI']]) +call extend(s:tmp, [[0x222D,0x222D,'AL'],[0x222E,0x222E,'AI'],[0x222F,0x2233,'AL']]) +call extend(s:tmp, [[0x2234,0x2237,'AI'],[0x2238,0x223B,'AL'],[0x223C,0x223D,'AI']]) +call extend(s:tmp, [[0x223E,0x2247,'AL'],[0x2248,0x2248,'AI'],[0x2249,0x224B,'AL']]) +call extend(s:tmp, [[0x224C,0x224C,'AI'],[0x224D,0x2251,'AL'],[0x2252,0x2252,'AI']]) +call extend(s:tmp, [[0x2253,0x225F,'AL'],[0x2260,0x2261,'AI'],[0x2262,0x2263,'AL']]) +call extend(s:tmp, [[0x2264,0x2267,'AI'],[0x2268,0x2269,'AL'],[0x226A,0x226B,'AI']]) +call extend(s:tmp, [[0x226C,0x226D,'AL'],[0x226E,0x226F,'AI'],[0x2270,0x2281,'AL']]) +call extend(s:tmp, [[0x2282,0x2283,'AI'],[0x2284,0x2285,'AL'],[0x2286,0x2287,'AI']]) +call extend(s:tmp, [[0x2288,0x2294,'AL'],[0x2295,0x2295,'AI'],[0x2296,0x2298,'AL']]) +call extend(s:tmp, [[0x2299,0x2299,'AI'],[0x229A,0x22A4,'AL'],[0x22A5,0x22A5,'AI']]) +call extend(s:tmp, [[0x22A6,0x22BE,'AL'],[0x22BF,0x22BF,'AI'],[0x22C0,0x22EE,'AL']]) +call extend(s:tmp, [[0x22EF,0x22EF,'IN'],[0x22F0,0x2307,'AL'],[0x2308,0x2308,'OP']]) +call extend(s:tmp, [[0x2309,0x2309,'CL'],[0x230A,0x230A,'OP'],[0x230B,0x230B,'CL']]) +call extend(s:tmp, [[0x230C,0x2311,'AL'],[0x2312,0x2312,'AI'],[0x2313,0x2319,'AL']]) +call extend(s:tmp, [[0x231A,0x231B,'ID'],[0x231C,0x2328,'AL'],[0x2329,0x2329,'OP']]) +call extend(s:tmp, [[0x232A,0x232A,'CL'],[0x232B,0x23EF,'AL'],[0x23F0,0x23F3,'ID']]) +call extend(s:tmp, [[0x23F4,0x23FE,'AL'],[0x2400,0x2426,'AL'],[0x2440,0x244A,'AL']]) +call extend(s:tmp, [[0x2460,0x24FE,'AI'],[0x24FF,0x24FF,'AL'],[0x2500,0x254B,'AI']]) +call extend(s:tmp, [[0x254C,0x254F,'AL'],[0x2550,0x2574,'AI'],[0x2575,0x257F,'AL']]) +call extend(s:tmp, [[0x2580,0x258F,'AI'],[0x2590,0x2591,'AL'],[0x2592,0x2595,'AI']]) +call extend(s:tmp, [[0x2596,0x259F,'AL'],[0x25A0,0x25A1,'AI'],[0x25A2,0x25A2,'AL']]) +call extend(s:tmp, [[0x25A3,0x25A9,'AI'],[0x25AA,0x25B1,'AL'],[0x25B2,0x25B3,'AI']]) +call extend(s:tmp, [[0x25B4,0x25B5,'AL'],[0x25B6,0x25B7,'AI'],[0x25B8,0x25BB,'AL']]) +call extend(s:tmp, [[0x25BC,0x25BD,'AI'],[0x25BE,0x25BF,'AL'],[0x25C0,0x25C1,'AI']]) +call extend(s:tmp, [[0x25C2,0x25C5,'AL'],[0x25C6,0x25C8,'AI'],[0x25C9,0x25CA,'AL']]) +call extend(s:tmp, [[0x25CB,0x25CB,'AI'],[0x25CC,0x25CD,'AL'],[0x25CE,0x25D1,'AI']]) +call extend(s:tmp, [[0x25D2,0x25E1,'AL'],[0x25E2,0x25E5,'AI'],[0x25E6,0x25EE,'AL']]) +call extend(s:tmp, [[0x25EF,0x25EF,'AI'],[0x25F0,0x25FF,'AL'],[0x2600,0x2603,'ID']]) +call extend(s:tmp, [[0x2604,0x2604,'AL'],[0x2605,0x2606,'AI'],[0x2607,0x2608,'AL']]) +call extend(s:tmp, [[0x2609,0x2609,'AI'],[0x260A,0x260D,'AL'],[0x260E,0x260F,'AI']]) +call extend(s:tmp, [[0x2610,0x2613,'AL'],[0x2614,0x2615,'ID'],[0x2616,0x2617,'AI']]) +call extend(s:tmp, [[0x2618,0x2618,'ID'],[0x2619,0x2619,'AL'],[0x261A,0x261C,'ID']]) +call extend(s:tmp, [[0x261D,0x261D,'EB'],[0x261E,0x261F,'ID'],[0x2620,0x2638,'AL']]) +call extend(s:tmp, [[0x2639,0x263B,'ID'],[0x263C,0x263F,'AL'],[0x2640,0x2640,'AI']]) +call extend(s:tmp, [[0x2641,0x2641,'AL'],[0x2642,0x2642,'AI'],[0x2643,0x265F,'AL']]) +call extend(s:tmp, [[0x2660,0x2661,'AI'],[0x2662,0x2662,'AL'],[0x2663,0x2665,'AI']]) +call extend(s:tmp, [[0x2666,0x2666,'AL'],[0x2667,0x2667,'AI'],[0x2668,0x2668,'ID']]) +call extend(s:tmp, [[0x2669,0x266A,'AI'],[0x266B,0x266B,'AL'],[0x266C,0x266D,'AI']]) +call extend(s:tmp, [[0x266E,0x266E,'AL'],[0x266F,0x266F,'AI'],[0x2670,0x267E,'AL']]) +call extend(s:tmp, [[0x267F,0x267F,'ID'],[0x2680,0x269D,'AL'],[0x269E,0x269F,'AI']]) +call extend(s:tmp, [[0x26A0,0x26BC,'AL'],[0x26BD,0x26C8,'ID'],[0x26C9,0x26CC,'AI']]) +call extend(s:tmp, [[0x26CD,0x26CD,'ID'],[0x26CE,0x26CE,'AL'],[0x26CF,0x26D1,'ID']]) +call extend(s:tmp, [[0x26D2,0x26D2,'AI'],[0x26D3,0x26D4,'ID'],[0x26D5,0x26D7,'AI']]) +call extend(s:tmp, [[0x26D8,0x26D9,'ID'],[0x26DA,0x26DB,'AI'],[0x26DC,0x26DC,'ID']]) +call extend(s:tmp, [[0x26DD,0x26DE,'AI'],[0x26DF,0x26E1,'ID'],[0x26E2,0x26E2,'AL']]) +call extend(s:tmp, [[0x26E3,0x26E3,'AI'],[0x26E4,0x26E7,'AL'],[0x26E8,0x26E9,'AI']]) +call extend(s:tmp, [[0x26EA,0x26EA,'ID'],[0x26EB,0x26F0,'AI'],[0x26F1,0x26F5,'ID']]) +call extend(s:tmp, [[0x26F6,0x26F6,'AI'],[0x26F7,0x26F8,'ID'],[0x26F9,0x26F9,'EB']]) +call extend(s:tmp, [[0x26FA,0x26FA,'ID'],[0x26FB,0x26FC,'AI'],[0x26FD,0x2704,'ID']]) +call extend(s:tmp, [[0x2705,0x2707,'AL'],[0x2708,0x2709,'ID'],[0x270A,0x270D,'EB']]) +call extend(s:tmp, [[0x270E,0x2756,'AL'],[0x2757,0x2757,'AI'],[0x2758,0x275A,'AL']]) +call extend(s:tmp, [[0x275B,0x2760,'QU'],[0x2761,0x2761,'AL'],[0x2762,0x2763,'EX']]) +call extend(s:tmp, [[0x2764,0x2764,'ID'],[0x2765,0x2767,'AL'],[0x2768,0x2768,'OP']]) +call extend(s:tmp, [[0x2769,0x2769,'CL'],[0x276A,0x276A,'OP'],[0x276B,0x276B,'CL']]) +call extend(s:tmp, [[0x276C,0x276C,'OP'],[0x276D,0x276D,'CL'],[0x276E,0x276E,'OP']]) +call extend(s:tmp, [[0x276F,0x276F,'CL'],[0x2770,0x2770,'OP'],[0x2771,0x2771,'CL']]) +call extend(s:tmp, [[0x2772,0x2772,'OP'],[0x2773,0x2773,'CL'],[0x2774,0x2774,'OP']]) +call extend(s:tmp, [[0x2775,0x2775,'CL'],[0x2776,0x2793,'AI'],[0x2794,0x27C4,'AL']]) +call extend(s:tmp, [[0x27C5,0x27C5,'OP'],[0x27C6,0x27C6,'CL'],[0x27C7,0x27E5,'AL']]) +call extend(s:tmp, [[0x27E6,0x27E6,'OP'],[0x27E7,0x27E7,'CL'],[0x27E8,0x27E8,'OP']]) +call extend(s:tmp, [[0x27E9,0x27E9,'CL'],[0x27EA,0x27EA,'OP'],[0x27EB,0x27EB,'CL']]) +call extend(s:tmp, [[0x27EC,0x27EC,'OP'],[0x27ED,0x27ED,'CL'],[0x27EE,0x27EE,'OP']]) +call extend(s:tmp, [[0x27EF,0x27EF,'CL'],[0x27F0,0x2982,'AL'],[0x2983,0x2983,'OP']]) +call extend(s:tmp, [[0x2984,0x2984,'CL'],[0x2985,0x2985,'OP'],[0x2986,0x2986,'CL']]) +call extend(s:tmp, [[0x2987,0x2987,'OP'],[0x2988,0x2988,'CL'],[0x2989,0x2989,'OP']]) +call extend(s:tmp, [[0x298A,0x298A,'CL'],[0x298B,0x298B,'OP'],[0x298C,0x298C,'CL']]) +call extend(s:tmp, [[0x298D,0x298D,'OP'],[0x298E,0x298E,'CL'],[0x298F,0x298F,'OP']]) +call extend(s:tmp, [[0x2990,0x2990,'CL'],[0x2991,0x2991,'OP'],[0x2992,0x2992,'CL']]) +call extend(s:tmp, [[0x2993,0x2993,'OP'],[0x2994,0x2994,'CL'],[0x2995,0x2995,'OP']]) +call extend(s:tmp, [[0x2996,0x2996,'CL'],[0x2997,0x2997,'OP'],[0x2998,0x2998,'CL']]) +call extend(s:tmp, [[0x2999,0x29D7,'AL'],[0x29D8,0x29D8,'OP'],[0x29D9,0x29D9,'CL']]) +call extend(s:tmp, [[0x29DA,0x29DA,'OP'],[0x29DB,0x29DB,'CL'],[0x29DC,0x29FB,'AL']]) +call extend(s:tmp, [[0x29FC,0x29FC,'OP'],[0x29FD,0x29FD,'CL'],[0x29FE,0x2B54,'AL']]) +call extend(s:tmp, [[0x2B55,0x2B59,'AI'],[0x2B5A,0x2B73,'AL'],[0x2B76,0x2B95,'AL']]) +call extend(s:tmp, [[0x2B98,0x2BB9,'AL'],[0x2BBD,0x2BC8,'AL'],[0x2BCA,0x2BD1,'AL']]) +call extend(s:tmp, [[0x2BEC,0x2BEF,'AL'],[0x2C00,0x2C2E,'AL'],[0x2C30,0x2C5E,'AL']]) +call extend(s:tmp, [[0x2C60,0x2CEE,'AL'],[0x2CEF,0x2CF1,'CM'],[0x2CF2,0x2CF3,'AL']]) +call extend(s:tmp, [[0x2CF9,0x2CF9,'EX'],[0x2CFA,0x2CFC,'BA'],[0x2CFD,0x2CFD,'AL']]) +call extend(s:tmp, [[0x2CFE,0x2CFE,'EX'],[0x2CFF,0x2CFF,'BA'],[0x2D00,0x2D25,'AL']]) +call extend(s:tmp, [[0x2D27,0x2D27,'AL'],[0x2D2D,0x2D2D,'AL'],[0x2D30,0x2D67,'AL']]) +call extend(s:tmp, [[0x2D6F,0x2D6F,'AL'],[0x2D70,0x2D70,'BA'],[0x2D7F,0x2D7F,'CM']]) +call extend(s:tmp, [[0x2D80,0x2D96,'AL'],[0x2DA0,0x2DA6,'AL'],[0x2DA8,0x2DAE,'AL']]) +call extend(s:tmp, [[0x2DB0,0x2DB6,'AL'],[0x2DB8,0x2DBE,'AL'],[0x2DC0,0x2DC6,'AL']]) +call extend(s:tmp, [[0x2DC8,0x2DCE,'AL'],[0x2DD0,0x2DD6,'AL'],[0x2DD8,0x2DDE,'AL']]) +call extend(s:tmp, [[0x2DE0,0x2DFF,'CM'],[0x2E00,0x2E0D,'QU'],[0x2E0E,0x2E15,'BA']]) +call extend(s:tmp, [[0x2E16,0x2E16,'AL'],[0x2E17,0x2E17,'BA'],[0x2E18,0x2E18,'OP']]) +call extend(s:tmp, [[0x2E19,0x2E19,'BA'],[0x2E1A,0x2E1B,'AL'],[0x2E1C,0x2E1D,'QU']]) +call extend(s:tmp, [[0x2E1E,0x2E1F,'AL'],[0x2E20,0x2E21,'QU'],[0x2E22,0x2E22,'OP']]) +call extend(s:tmp, [[0x2E23,0x2E23,'CL'],[0x2E24,0x2E24,'OP'],[0x2E25,0x2E25,'CL']]) +call extend(s:tmp, [[0x2E26,0x2E26,'OP'],[0x2E27,0x2E27,'CL'],[0x2E28,0x2E28,'OP']]) +call extend(s:tmp, [[0x2E29,0x2E29,'CL'],[0x2E2A,0x2E2D,'BA'],[0x2E2E,0x2E2E,'EX']]) +call extend(s:tmp, [[0x2E2F,0x2E2F,'AL'],[0x2E30,0x2E31,'BA'],[0x2E32,0x2E32,'AL']]) +call extend(s:tmp, [[0x2E33,0x2E34,'BA'],[0x2E35,0x2E39,'AL'],[0x2E3A,0x2E3B,'B2']]) +call extend(s:tmp, [[0x2E3C,0x2E3E,'BA'],[0x2E3F,0x2E3F,'AL'],[0x2E40,0x2E41,'BA']]) +call extend(s:tmp, [[0x2E42,0x2E42,'OP'],[0x2E43,0x2E44,'BA'],[0x2E80,0x2E99,'ID']]) +call extend(s:tmp, [[0x2E9B,0x2EF3,'ID'],[0x2F00,0x2FD5,'ID'],[0x2FF0,0x2FFB,'ID']]) +call extend(s:tmp, [[0x3000,0x3000,'BA'],[0x3001,0x3002,'CL'],[0x3003,0x3004,'ID']]) +call extend(s:tmp, [[0x3005,0x3005,'NS'],[0x3006,0x3007,'ID'],[0x3008,0x3008,'OP']]) +call extend(s:tmp, [[0x3009,0x3009,'CL'],[0x300A,0x300A,'OP'],[0x300B,0x300B,'CL']]) +call extend(s:tmp, [[0x300C,0x300C,'OP'],[0x300D,0x300D,'CL'],[0x300E,0x300E,'OP']]) +call extend(s:tmp, [[0x300F,0x300F,'CL'],[0x3010,0x3010,'OP'],[0x3011,0x3011,'CL']]) +call extend(s:tmp, [[0x3012,0x3013,'ID'],[0x3014,0x3014,'OP'],[0x3015,0x3015,'CL']]) +call extend(s:tmp, [[0x3016,0x3016,'OP'],[0x3017,0x3017,'CL'],[0x3018,0x3018,'OP']]) +call extend(s:tmp, [[0x3019,0x3019,'CL'],[0x301A,0x301A,'OP'],[0x301B,0x301B,'CL']]) +call extend(s:tmp, [[0x301C,0x301C,'NS'],[0x301D,0x301D,'OP'],[0x301E,0x301F,'CL']]) +call extend(s:tmp, [[0x3020,0x3029,'ID'],[0x302A,0x302F,'CM'],[0x3030,0x3034,'ID']]) +call extend(s:tmp, [[0x3035,0x3035,'CM'],[0x3036,0x303A,'ID'],[0x303B,0x303C,'NS']]) +call extend(s:tmp, [[0x303D,0x303F,'ID'],[0x3041,0x3041,'CJ'],[0x3042,0x3042,'ID']]) +call extend(s:tmp, [[0x3043,0x3043,'CJ'],[0x3044,0x3044,'ID'],[0x3045,0x3045,'CJ']]) +call extend(s:tmp, [[0x3046,0x3046,'ID'],[0x3047,0x3047,'CJ'],[0x3048,0x3048,'ID']]) +call extend(s:tmp, [[0x3049,0x3049,'CJ'],[0x304A,0x3062,'ID'],[0x3063,0x3063,'CJ']]) +call extend(s:tmp, [[0x3064,0x3082,'ID'],[0x3083,0x3083,'CJ'],[0x3084,0x3084,'ID']]) +call extend(s:tmp, [[0x3085,0x3085,'CJ'],[0x3086,0x3086,'ID'],[0x3087,0x3087,'CJ']]) +call extend(s:tmp, [[0x3088,0x308D,'ID'],[0x308E,0x308E,'CJ'],[0x308F,0x3094,'ID']]) +call extend(s:tmp, [[0x3095,0x3096,'CJ'],[0x3099,0x309A,'CM'],[0x309B,0x309E,'NS']]) +call extend(s:tmp, [[0x309F,0x309F,'ID'],[0x30A0,0x30A0,'NS'],[0x30A1,0x30A1,'CJ']]) +call extend(s:tmp, [[0x30A2,0x30A2,'ID'],[0x30A3,0x30A3,'CJ'],[0x30A4,0x30A4,'ID']]) +call extend(s:tmp, [[0x30A5,0x30A5,'CJ'],[0x30A6,0x30A6,'ID'],[0x30A7,0x30A7,'CJ']]) +call extend(s:tmp, [[0x30A8,0x30A8,'ID'],[0x30A9,0x30A9,'CJ'],[0x30AA,0x30C2,'ID']]) +call extend(s:tmp, [[0x30C3,0x30C3,'CJ'],[0x30C4,0x30E2,'ID'],[0x30E3,0x30E3,'CJ']]) +call extend(s:tmp, [[0x30E4,0x30E4,'ID'],[0x30E5,0x30E5,'CJ'],[0x30E6,0x30E6,'ID']]) +call extend(s:tmp, [[0x30E7,0x30E7,'CJ'],[0x30E8,0x30ED,'ID'],[0x30EE,0x30EE,'CJ']]) +call extend(s:tmp, [[0x30EF,0x30F4,'ID'],[0x30F5,0x30F6,'CJ'],[0x30F7,0x30FA,'ID']]) +call extend(s:tmp, [[0x30FB,0x30FB,'NS'],[0x30FC,0x30FC,'CJ'],[0x30FD,0x30FE,'NS']]) +call extend(s:tmp, [[0x30FF,0x30FF,'ID'],[0x3105,0x312D,'ID'],[0x3131,0x318E,'ID']]) +call extend(s:tmp, [[0x3190,0x31BA,'ID'],[0x31C0,0x31E3,'ID'],[0x31F0,0x31FF,'CJ']]) +call extend(s:tmp, [[0x3200,0x321E,'ID'],[0x3220,0x3247,'ID'],[0x3248,0x324F,'AI']]) +call extend(s:tmp, [[0x3250,0x32FE,'ID'],[0x3300,0x4DBF,'ID'],[0x4DC0,0x4DFF,'AL']]) +call extend(s:tmp, [[0x4E00,0xA014,'ID'],[0xA015,0xA015,'NS'],[0xA016,0xA48C,'ID']]) +call extend(s:tmp, [[0xA490,0xA4C6,'ID'],[0xA4D0,0xA4FD,'AL'],[0xA4FE,0xA4FF,'BA']]) +call extend(s:tmp, [[0xA500,0xA60C,'AL'],[0xA60D,0xA60D,'BA'],[0xA60E,0xA60E,'EX']]) +call extend(s:tmp, [[0xA60F,0xA60F,'BA'],[0xA610,0xA61F,'AL'],[0xA620,0xA629,'NU']]) +call extend(s:tmp, [[0xA62A,0xA62B,'AL'],[0xA640,0xA66E,'AL'],[0xA66F,0xA672,'CM']]) +call extend(s:tmp, [[0xA673,0xA673,'AL'],[0xA674,0xA67D,'CM'],[0xA67E,0xA69D,'AL']]) +call extend(s:tmp, [[0xA69E,0xA69F,'CM'],[0xA6A0,0xA6EF,'AL'],[0xA6F0,0xA6F1,'CM']]) +call extend(s:tmp, [[0xA6F2,0xA6F2,'AL'],[0xA6F3,0xA6F7,'BA'],[0xA700,0xA7AE,'AL']]) +call extend(s:tmp, [[0xA7B0,0xA7B7,'AL'],[0xA7F7,0xA801,'AL'],[0xA802,0xA802,'CM']]) +call extend(s:tmp, [[0xA803,0xA805,'AL'],[0xA806,0xA806,'CM'],[0xA807,0xA80A,'AL']]) +call extend(s:tmp, [[0xA80B,0xA80B,'CM'],[0xA80C,0xA822,'AL'],[0xA823,0xA827,'CM']]) +call extend(s:tmp, [[0xA828,0xA82B,'AL'],[0xA830,0xA837,'AL'],[0xA838,0xA838,'PO']]) +call extend(s:tmp, [[0xA839,0xA839,'AL'],[0xA840,0xA873,'AL'],[0xA874,0xA875,'BB']]) +call extend(s:tmp, [[0xA876,0xA877,'EX'],[0xA880,0xA881,'CM'],[0xA882,0xA8B3,'AL']]) +call extend(s:tmp, [[0xA8B4,0xA8C5,'CM'],[0xA8CE,0xA8CF,'BA'],[0xA8D0,0xA8D9,'NU']]) +call extend(s:tmp, [[0xA8E0,0xA8F1,'CM'],[0xA8F2,0xA8FB,'AL'],[0xA8FC,0xA8FC,'BB']]) +call extend(s:tmp, [[0xA8FD,0xA8FD,'AL'],[0xA900,0xA909,'NU'],[0xA90A,0xA925,'AL']]) +call extend(s:tmp, [[0xA926,0xA92D,'CM'],[0xA92E,0xA92F,'BA'],[0xA930,0xA946,'AL']]) +call extend(s:tmp, [[0xA947,0xA953,'CM'],[0xA95F,0xA95F,'AL'],[0xA960,0xA97C,'JL']]) +call extend(s:tmp, [[0xA980,0xA983,'CM'],[0xA984,0xA9B2,'AL'],[0xA9B3,0xA9C0,'CM']]) +call extend(s:tmp, [[0xA9C1,0xA9C6,'AL'],[0xA9C7,0xA9C9,'BA'],[0xA9CA,0xA9CD,'AL']]) +call extend(s:tmp, [[0xA9CF,0xA9CF,'AL'],[0xA9D0,0xA9D9,'NU'],[0xA9DE,0xA9DF,'AL']]) +call extend(s:tmp, [[0xA9E0,0xA9EF,'SA'],[0xA9F0,0xA9F9,'NU'],[0xA9FA,0xA9FE,'SA']]) +call extend(s:tmp, [[0xAA00,0xAA28,'AL'],[0xAA29,0xAA36,'CM'],[0xAA40,0xAA42,'AL']]) +call extend(s:tmp, [[0xAA43,0xAA43,'CM'],[0xAA44,0xAA4B,'AL'],[0xAA4C,0xAA4D,'CM']]) +call extend(s:tmp, [[0xAA50,0xAA59,'NU'],[0xAA5C,0xAA5C,'AL'],[0xAA5D,0xAA5F,'BA']]) +call extend(s:tmp, [[0xAA60,0xAAC2,'SA'],[0xAADB,0xAADF,'SA'],[0xAAE0,0xAAEA,'AL']]) +call extend(s:tmp, [[0xAAEB,0xAAEF,'CM'],[0xAAF0,0xAAF1,'BA'],[0xAAF2,0xAAF4,'AL']]) +call extend(s:tmp, [[0xAAF5,0xAAF6,'CM'],[0xAB01,0xAB06,'AL'],[0xAB09,0xAB0E,'AL']]) +call extend(s:tmp, [[0xAB11,0xAB16,'AL'],[0xAB20,0xAB26,'AL'],[0xAB28,0xAB2E,'AL']]) +call extend(s:tmp, [[0xAB30,0xAB65,'AL'],[0xAB70,0xABE2,'AL'],[0xABE3,0xABEA,'CM']]) +call extend(s:tmp, [[0xABEB,0xABEB,'BA'],[0xABEC,0xABED,'CM'],[0xABF0,0xABF9,'NU']]) +call extend(s:tmp, [[0xAC00,0xAC00,'H2'],[0xAC01,0xAC1B,'H3'],[0xAC1C,0xAC1C,'H2']]) +call extend(s:tmp, [[0xAC1D,0xAC37,'H3'],[0xAC38,0xAC38,'H2'],[0xAC39,0xAC53,'H3']]) +call extend(s:tmp, [[0xAC54,0xAC54,'H2'],[0xAC55,0xAC6F,'H3'],[0xAC70,0xAC70,'H2']]) +call extend(s:tmp, [[0xAC71,0xAC8B,'H3'],[0xAC8C,0xAC8C,'H2'],[0xAC8D,0xACA7,'H3']]) +call extend(s:tmp, [[0xACA8,0xACA8,'H2'],[0xACA9,0xACC3,'H3'],[0xACC4,0xACC4,'H2']]) +call extend(s:tmp, [[0xACC5,0xACDF,'H3'],[0xACE0,0xACE0,'H2'],[0xACE1,0xACFB,'H3']]) +call extend(s:tmp, [[0xACFC,0xACFC,'H2'],[0xACFD,0xAD17,'H3'],[0xAD18,0xAD18,'H2']]) +call extend(s:tmp, [[0xAD19,0xAD33,'H3'],[0xAD34,0xAD34,'H2'],[0xAD35,0xAD4F,'H3']]) +call extend(s:tmp, [[0xAD50,0xAD50,'H2'],[0xAD51,0xAD6B,'H3'],[0xAD6C,0xAD6C,'H2']]) +call extend(s:tmp, [[0xAD6D,0xAD87,'H3'],[0xAD88,0xAD88,'H2'],[0xAD89,0xADA3,'H3']]) +call extend(s:tmp, [[0xADA4,0xADA4,'H2'],[0xADA5,0xADBF,'H3'],[0xADC0,0xADC0,'H2']]) +call extend(s:tmp, [[0xADC1,0xADDB,'H3'],[0xADDC,0xADDC,'H2'],[0xADDD,0xADF7,'H3']]) +call extend(s:tmp, [[0xADF8,0xADF8,'H2'],[0xADF9,0xAE13,'H3'],[0xAE14,0xAE14,'H2']]) +call extend(s:tmp, [[0xAE15,0xAE2F,'H3'],[0xAE30,0xAE30,'H2'],[0xAE31,0xAE4B,'H3']]) +call extend(s:tmp, [[0xAE4C,0xAE4C,'H2'],[0xAE4D,0xAE67,'H3'],[0xAE68,0xAE68,'H2']]) +call extend(s:tmp, [[0xAE69,0xAE83,'H3'],[0xAE84,0xAE84,'H2'],[0xAE85,0xAE9F,'H3']]) +call extend(s:tmp, [[0xAEA0,0xAEA0,'H2'],[0xAEA1,0xAEBB,'H3'],[0xAEBC,0xAEBC,'H2']]) +call extend(s:tmp, [[0xAEBD,0xAED7,'H3'],[0xAED8,0xAED8,'H2'],[0xAED9,0xAEF3,'H3']]) +call extend(s:tmp, [[0xAEF4,0xAEF4,'H2'],[0xAEF5,0xAF0F,'H3'],[0xAF10,0xAF10,'H2']]) +call extend(s:tmp, [[0xAF11,0xAF2B,'H3'],[0xAF2C,0xAF2C,'H2'],[0xAF2D,0xAF47,'H3']]) +call extend(s:tmp, [[0xAF48,0xAF48,'H2'],[0xAF49,0xAF63,'H3'],[0xAF64,0xAF64,'H2']]) +call extend(s:tmp, [[0xAF65,0xAF7F,'H3'],[0xAF80,0xAF80,'H2'],[0xAF81,0xAF9B,'H3']]) +call extend(s:tmp, [[0xAF9C,0xAF9C,'H2'],[0xAF9D,0xAFB7,'H3'],[0xAFB8,0xAFB8,'H2']]) +call extend(s:tmp, [[0xAFB9,0xAFD3,'H3'],[0xAFD4,0xAFD4,'H2'],[0xAFD5,0xAFEF,'H3']]) +call extend(s:tmp, [[0xAFF0,0xAFF0,'H2'],[0xAFF1,0xB00B,'H3'],[0xB00C,0xB00C,'H2']]) +call extend(s:tmp, [[0xB00D,0xB027,'H3'],[0xB028,0xB028,'H2'],[0xB029,0xB043,'H3']]) +call extend(s:tmp, [[0xB044,0xB044,'H2'],[0xB045,0xB05F,'H3'],[0xB060,0xB060,'H2']]) +call extend(s:tmp, [[0xB061,0xB07B,'H3'],[0xB07C,0xB07C,'H2'],[0xB07D,0xB097,'H3']]) +call extend(s:tmp, [[0xB098,0xB098,'H2'],[0xB099,0xB0B3,'H3'],[0xB0B4,0xB0B4,'H2']]) +call extend(s:tmp, [[0xB0B5,0xB0CF,'H3'],[0xB0D0,0xB0D0,'H2'],[0xB0D1,0xB0EB,'H3']]) +call extend(s:tmp, [[0xB0EC,0xB0EC,'H2'],[0xB0ED,0xB107,'H3'],[0xB108,0xB108,'H2']]) +call extend(s:tmp, [[0xB109,0xB123,'H3'],[0xB124,0xB124,'H2'],[0xB125,0xB13F,'H3']]) +call extend(s:tmp, [[0xB140,0xB140,'H2'],[0xB141,0xB15B,'H3'],[0xB15C,0xB15C,'H2']]) +call extend(s:tmp, [[0xB15D,0xB177,'H3'],[0xB178,0xB178,'H2'],[0xB179,0xB193,'H3']]) +call extend(s:tmp, [[0xB194,0xB194,'H2'],[0xB195,0xB1AF,'H3'],[0xB1B0,0xB1B0,'H2']]) +call extend(s:tmp, [[0xB1B1,0xB1CB,'H3'],[0xB1CC,0xB1CC,'H2'],[0xB1CD,0xB1E7,'H3']]) +call extend(s:tmp, [[0xB1E8,0xB1E8,'H2'],[0xB1E9,0xB203,'H3'],[0xB204,0xB204,'H2']]) +call extend(s:tmp, [[0xB205,0xB21F,'H3'],[0xB220,0xB220,'H2'],[0xB221,0xB23B,'H3']]) +call extend(s:tmp, [[0xB23C,0xB23C,'H2'],[0xB23D,0xB257,'H3'],[0xB258,0xB258,'H2']]) +call extend(s:tmp, [[0xB259,0xB273,'H3'],[0xB274,0xB274,'H2'],[0xB275,0xB28F,'H3']]) +call extend(s:tmp, [[0xB290,0xB290,'H2'],[0xB291,0xB2AB,'H3'],[0xB2AC,0xB2AC,'H2']]) +call extend(s:tmp, [[0xB2AD,0xB2C7,'H3'],[0xB2C8,0xB2C8,'H2'],[0xB2C9,0xB2E3,'H3']]) +call extend(s:tmp, [[0xB2E4,0xB2E4,'H2'],[0xB2E5,0xB2FF,'H3'],[0xB300,0xB300,'H2']]) +call extend(s:tmp, [[0xB301,0xB31B,'H3'],[0xB31C,0xB31C,'H2'],[0xB31D,0xB337,'H3']]) +call extend(s:tmp, [[0xB338,0xB338,'H2'],[0xB339,0xB353,'H3'],[0xB354,0xB354,'H2']]) +call extend(s:tmp, [[0xB355,0xB36F,'H3'],[0xB370,0xB370,'H2'],[0xB371,0xB38B,'H3']]) +call extend(s:tmp, [[0xB38C,0xB38C,'H2'],[0xB38D,0xB3A7,'H3'],[0xB3A8,0xB3A8,'H2']]) +call extend(s:tmp, [[0xB3A9,0xB3C3,'H3'],[0xB3C4,0xB3C4,'H2'],[0xB3C5,0xB3DF,'H3']]) +call extend(s:tmp, [[0xB3E0,0xB3E0,'H2'],[0xB3E1,0xB3FB,'H3'],[0xB3FC,0xB3FC,'H2']]) +call extend(s:tmp, [[0xB3FD,0xB417,'H3'],[0xB418,0xB418,'H2'],[0xB419,0xB433,'H3']]) +call extend(s:tmp, [[0xB434,0xB434,'H2'],[0xB435,0xB44F,'H3'],[0xB450,0xB450,'H2']]) +call extend(s:tmp, [[0xB451,0xB46B,'H3'],[0xB46C,0xB46C,'H2'],[0xB46D,0xB487,'H3']]) +call extend(s:tmp, [[0xB488,0xB488,'H2'],[0xB489,0xB4A3,'H3'],[0xB4A4,0xB4A4,'H2']]) +call extend(s:tmp, [[0xB4A5,0xB4BF,'H3'],[0xB4C0,0xB4C0,'H2'],[0xB4C1,0xB4DB,'H3']]) +call extend(s:tmp, [[0xB4DC,0xB4DC,'H2'],[0xB4DD,0xB4F7,'H3'],[0xB4F8,0xB4F8,'H2']]) +call extend(s:tmp, [[0xB4F9,0xB513,'H3'],[0xB514,0xB514,'H2'],[0xB515,0xB52F,'H3']]) +call extend(s:tmp, [[0xB530,0xB530,'H2'],[0xB531,0xB54B,'H3'],[0xB54C,0xB54C,'H2']]) +call extend(s:tmp, [[0xB54D,0xB567,'H3'],[0xB568,0xB568,'H2'],[0xB569,0xB583,'H3']]) +call extend(s:tmp, [[0xB584,0xB584,'H2'],[0xB585,0xB59F,'H3'],[0xB5A0,0xB5A0,'H2']]) +call extend(s:tmp, [[0xB5A1,0xB5BB,'H3'],[0xB5BC,0xB5BC,'H2'],[0xB5BD,0xB5D7,'H3']]) +call extend(s:tmp, [[0xB5D8,0xB5D8,'H2'],[0xB5D9,0xB5F3,'H3'],[0xB5F4,0xB5F4,'H2']]) +call extend(s:tmp, [[0xB5F5,0xB60F,'H3'],[0xB610,0xB610,'H2'],[0xB611,0xB62B,'H3']]) +call extend(s:tmp, [[0xB62C,0xB62C,'H2'],[0xB62D,0xB647,'H3'],[0xB648,0xB648,'H2']]) +call extend(s:tmp, [[0xB649,0xB663,'H3'],[0xB664,0xB664,'H2'],[0xB665,0xB67F,'H3']]) +call extend(s:tmp, [[0xB680,0xB680,'H2'],[0xB681,0xB69B,'H3'],[0xB69C,0xB69C,'H2']]) +call extend(s:tmp, [[0xB69D,0xB6B7,'H3'],[0xB6B8,0xB6B8,'H2'],[0xB6B9,0xB6D3,'H3']]) +call extend(s:tmp, [[0xB6D4,0xB6D4,'H2'],[0xB6D5,0xB6EF,'H3'],[0xB6F0,0xB6F0,'H2']]) +call extend(s:tmp, [[0xB6F1,0xB70B,'H3'],[0xB70C,0xB70C,'H2'],[0xB70D,0xB727,'H3']]) +call extend(s:tmp, [[0xB728,0xB728,'H2'],[0xB729,0xB743,'H3'],[0xB744,0xB744,'H2']]) +call extend(s:tmp, [[0xB745,0xB75F,'H3'],[0xB760,0xB760,'H2'],[0xB761,0xB77B,'H3']]) +call extend(s:tmp, [[0xB77C,0xB77C,'H2'],[0xB77D,0xB797,'H3'],[0xB798,0xB798,'H2']]) +call extend(s:tmp, [[0xB799,0xB7B3,'H3'],[0xB7B4,0xB7B4,'H2'],[0xB7B5,0xB7CF,'H3']]) +call extend(s:tmp, [[0xB7D0,0xB7D0,'H2'],[0xB7D1,0xB7EB,'H3'],[0xB7EC,0xB7EC,'H2']]) +call extend(s:tmp, [[0xB7ED,0xB807,'H3'],[0xB808,0xB808,'H2'],[0xB809,0xB823,'H3']]) +call extend(s:tmp, [[0xB824,0xB824,'H2'],[0xB825,0xB83F,'H3'],[0xB840,0xB840,'H2']]) +call extend(s:tmp, [[0xB841,0xB85B,'H3'],[0xB85C,0xB85C,'H2'],[0xB85D,0xB877,'H3']]) +call extend(s:tmp, [[0xB878,0xB878,'H2'],[0xB879,0xB893,'H3'],[0xB894,0xB894,'H2']]) +call extend(s:tmp, [[0xB895,0xB8AF,'H3'],[0xB8B0,0xB8B0,'H2'],[0xB8B1,0xB8CB,'H3']]) +call extend(s:tmp, [[0xB8CC,0xB8CC,'H2'],[0xB8CD,0xB8E7,'H3'],[0xB8E8,0xB8E8,'H2']]) +call extend(s:tmp, [[0xB8E9,0xB903,'H3'],[0xB904,0xB904,'H2'],[0xB905,0xB91F,'H3']]) +call extend(s:tmp, [[0xB920,0xB920,'H2'],[0xB921,0xB93B,'H3'],[0xB93C,0xB93C,'H2']]) +call extend(s:tmp, [[0xB93D,0xB957,'H3'],[0xB958,0xB958,'H2'],[0xB959,0xB973,'H3']]) +call extend(s:tmp, [[0xB974,0xB974,'H2'],[0xB975,0xB98F,'H3'],[0xB990,0xB990,'H2']]) +call extend(s:tmp, [[0xB991,0xB9AB,'H3'],[0xB9AC,0xB9AC,'H2'],[0xB9AD,0xB9C7,'H3']]) +call extend(s:tmp, [[0xB9C8,0xB9C8,'H2'],[0xB9C9,0xB9E3,'H3'],[0xB9E4,0xB9E4,'H2']]) +call extend(s:tmp, [[0xB9E5,0xB9FF,'H3'],[0xBA00,0xBA00,'H2'],[0xBA01,0xBA1B,'H3']]) +call extend(s:tmp, [[0xBA1C,0xBA1C,'H2'],[0xBA1D,0xBA37,'H3'],[0xBA38,0xBA38,'H2']]) +call extend(s:tmp, [[0xBA39,0xBA53,'H3'],[0xBA54,0xBA54,'H2'],[0xBA55,0xBA6F,'H3']]) +call extend(s:tmp, [[0xBA70,0xBA70,'H2'],[0xBA71,0xBA8B,'H3'],[0xBA8C,0xBA8C,'H2']]) +call extend(s:tmp, [[0xBA8D,0xBAA7,'H3'],[0xBAA8,0xBAA8,'H2'],[0xBAA9,0xBAC3,'H3']]) +call extend(s:tmp, [[0xBAC4,0xBAC4,'H2'],[0xBAC5,0xBADF,'H3'],[0xBAE0,0xBAE0,'H2']]) +call extend(s:tmp, [[0xBAE1,0xBAFB,'H3'],[0xBAFC,0xBAFC,'H2'],[0xBAFD,0xBB17,'H3']]) +call extend(s:tmp, [[0xBB18,0xBB18,'H2'],[0xBB19,0xBB33,'H3'],[0xBB34,0xBB34,'H2']]) +call extend(s:tmp, [[0xBB35,0xBB4F,'H3'],[0xBB50,0xBB50,'H2'],[0xBB51,0xBB6B,'H3']]) +call extend(s:tmp, [[0xBB6C,0xBB6C,'H2'],[0xBB6D,0xBB87,'H3'],[0xBB88,0xBB88,'H2']]) +call extend(s:tmp, [[0xBB89,0xBBA3,'H3'],[0xBBA4,0xBBA4,'H2'],[0xBBA5,0xBBBF,'H3']]) +call extend(s:tmp, [[0xBBC0,0xBBC0,'H2'],[0xBBC1,0xBBDB,'H3'],[0xBBDC,0xBBDC,'H2']]) +call extend(s:tmp, [[0xBBDD,0xBBF7,'H3'],[0xBBF8,0xBBF8,'H2'],[0xBBF9,0xBC13,'H3']]) +call extend(s:tmp, [[0xBC14,0xBC14,'H2'],[0xBC15,0xBC2F,'H3'],[0xBC30,0xBC30,'H2']]) +call extend(s:tmp, [[0xBC31,0xBC4B,'H3'],[0xBC4C,0xBC4C,'H2'],[0xBC4D,0xBC67,'H3']]) +call extend(s:tmp, [[0xBC68,0xBC68,'H2'],[0xBC69,0xBC83,'H3'],[0xBC84,0xBC84,'H2']]) +call extend(s:tmp, [[0xBC85,0xBC9F,'H3'],[0xBCA0,0xBCA0,'H2'],[0xBCA1,0xBCBB,'H3']]) +call extend(s:tmp, [[0xBCBC,0xBCBC,'H2'],[0xBCBD,0xBCD7,'H3'],[0xBCD8,0xBCD8,'H2']]) +call extend(s:tmp, [[0xBCD9,0xBCF3,'H3'],[0xBCF4,0xBCF4,'H2'],[0xBCF5,0xBD0F,'H3']]) +call extend(s:tmp, [[0xBD10,0xBD10,'H2'],[0xBD11,0xBD2B,'H3'],[0xBD2C,0xBD2C,'H2']]) +call extend(s:tmp, [[0xBD2D,0xBD47,'H3'],[0xBD48,0xBD48,'H2'],[0xBD49,0xBD63,'H3']]) +call extend(s:tmp, [[0xBD64,0xBD64,'H2'],[0xBD65,0xBD7F,'H3'],[0xBD80,0xBD80,'H2']]) +call extend(s:tmp, [[0xBD81,0xBD9B,'H3'],[0xBD9C,0xBD9C,'H2'],[0xBD9D,0xBDB7,'H3']]) +call extend(s:tmp, [[0xBDB8,0xBDB8,'H2'],[0xBDB9,0xBDD3,'H3'],[0xBDD4,0xBDD4,'H2']]) +call extend(s:tmp, [[0xBDD5,0xBDEF,'H3'],[0xBDF0,0xBDF0,'H2'],[0xBDF1,0xBE0B,'H3']]) +call extend(s:tmp, [[0xBE0C,0xBE0C,'H2'],[0xBE0D,0xBE27,'H3'],[0xBE28,0xBE28,'H2']]) +call extend(s:tmp, [[0xBE29,0xBE43,'H3'],[0xBE44,0xBE44,'H2'],[0xBE45,0xBE5F,'H3']]) +call extend(s:tmp, [[0xBE60,0xBE60,'H2'],[0xBE61,0xBE7B,'H3'],[0xBE7C,0xBE7C,'H2']]) +call extend(s:tmp, [[0xBE7D,0xBE97,'H3'],[0xBE98,0xBE98,'H2'],[0xBE99,0xBEB3,'H3']]) +call extend(s:tmp, [[0xBEB4,0xBEB4,'H2'],[0xBEB5,0xBECF,'H3'],[0xBED0,0xBED0,'H2']]) +call extend(s:tmp, [[0xBED1,0xBEEB,'H3'],[0xBEEC,0xBEEC,'H2'],[0xBEED,0xBF07,'H3']]) +call extend(s:tmp, [[0xBF08,0xBF08,'H2'],[0xBF09,0xBF23,'H3'],[0xBF24,0xBF24,'H2']]) +call extend(s:tmp, [[0xBF25,0xBF3F,'H3'],[0xBF40,0xBF40,'H2'],[0xBF41,0xBF5B,'H3']]) +call extend(s:tmp, [[0xBF5C,0xBF5C,'H2'],[0xBF5D,0xBF77,'H3'],[0xBF78,0xBF78,'H2']]) +call extend(s:tmp, [[0xBF79,0xBF93,'H3'],[0xBF94,0xBF94,'H2'],[0xBF95,0xBFAF,'H3']]) +call extend(s:tmp, [[0xBFB0,0xBFB0,'H2'],[0xBFB1,0xBFCB,'H3'],[0xBFCC,0xBFCC,'H2']]) +call extend(s:tmp, [[0xBFCD,0xBFE7,'H3'],[0xBFE8,0xBFE8,'H2'],[0xBFE9,0xC003,'H3']]) +call extend(s:tmp, [[0xC004,0xC004,'H2'],[0xC005,0xC01F,'H3'],[0xC020,0xC020,'H2']]) +call extend(s:tmp, [[0xC021,0xC03B,'H3'],[0xC03C,0xC03C,'H2'],[0xC03D,0xC057,'H3']]) +call extend(s:tmp, [[0xC058,0xC058,'H2'],[0xC059,0xC073,'H3'],[0xC074,0xC074,'H2']]) +call extend(s:tmp, [[0xC075,0xC08F,'H3'],[0xC090,0xC090,'H2'],[0xC091,0xC0AB,'H3']]) +call extend(s:tmp, [[0xC0AC,0xC0AC,'H2'],[0xC0AD,0xC0C7,'H3'],[0xC0C8,0xC0C8,'H2']]) +call extend(s:tmp, [[0xC0C9,0xC0E3,'H3'],[0xC0E4,0xC0E4,'H2'],[0xC0E5,0xC0FF,'H3']]) +call extend(s:tmp, [[0xC100,0xC100,'H2'],[0xC101,0xC11B,'H3'],[0xC11C,0xC11C,'H2']]) +call extend(s:tmp, [[0xC11D,0xC137,'H3'],[0xC138,0xC138,'H2'],[0xC139,0xC153,'H3']]) +call extend(s:tmp, [[0xC154,0xC154,'H2'],[0xC155,0xC16F,'H3'],[0xC170,0xC170,'H2']]) +call extend(s:tmp, [[0xC171,0xC18B,'H3'],[0xC18C,0xC18C,'H2'],[0xC18D,0xC1A7,'H3']]) +call extend(s:tmp, [[0xC1A8,0xC1A8,'H2'],[0xC1A9,0xC1C3,'H3'],[0xC1C4,0xC1C4,'H2']]) +call extend(s:tmp, [[0xC1C5,0xC1DF,'H3'],[0xC1E0,0xC1E0,'H2'],[0xC1E1,0xC1FB,'H3']]) +call extend(s:tmp, [[0xC1FC,0xC1FC,'H2'],[0xC1FD,0xC217,'H3'],[0xC218,0xC218,'H2']]) +call extend(s:tmp, [[0xC219,0xC233,'H3'],[0xC234,0xC234,'H2'],[0xC235,0xC24F,'H3']]) +call extend(s:tmp, [[0xC250,0xC250,'H2'],[0xC251,0xC26B,'H3'],[0xC26C,0xC26C,'H2']]) +call extend(s:tmp, [[0xC26D,0xC287,'H3'],[0xC288,0xC288,'H2'],[0xC289,0xC2A3,'H3']]) +call extend(s:tmp, [[0xC2A4,0xC2A4,'H2'],[0xC2A5,0xC2BF,'H3'],[0xC2C0,0xC2C0,'H2']]) +call extend(s:tmp, [[0xC2C1,0xC2DB,'H3'],[0xC2DC,0xC2DC,'H2'],[0xC2DD,0xC2F7,'H3']]) +call extend(s:tmp, [[0xC2F8,0xC2F8,'H2'],[0xC2F9,0xC313,'H3'],[0xC314,0xC314,'H2']]) +call extend(s:tmp, [[0xC315,0xC32F,'H3'],[0xC330,0xC330,'H2'],[0xC331,0xC34B,'H3']]) +call extend(s:tmp, [[0xC34C,0xC34C,'H2'],[0xC34D,0xC367,'H3'],[0xC368,0xC368,'H2']]) +call extend(s:tmp, [[0xC369,0xC383,'H3'],[0xC384,0xC384,'H2'],[0xC385,0xC39F,'H3']]) +call extend(s:tmp, [[0xC3A0,0xC3A0,'H2'],[0xC3A1,0xC3BB,'H3'],[0xC3BC,0xC3BC,'H2']]) +call extend(s:tmp, [[0xC3BD,0xC3D7,'H3'],[0xC3D8,0xC3D8,'H2'],[0xC3D9,0xC3F3,'H3']]) +call extend(s:tmp, [[0xC3F4,0xC3F4,'H2'],[0xC3F5,0xC40F,'H3'],[0xC410,0xC410,'H2']]) +call extend(s:tmp, [[0xC411,0xC42B,'H3'],[0xC42C,0xC42C,'H2'],[0xC42D,0xC447,'H3']]) +call extend(s:tmp, [[0xC448,0xC448,'H2'],[0xC449,0xC463,'H3'],[0xC464,0xC464,'H2']]) +call extend(s:tmp, [[0xC465,0xC47F,'H3'],[0xC480,0xC480,'H2'],[0xC481,0xC49B,'H3']]) +call extend(s:tmp, [[0xC49C,0xC49C,'H2'],[0xC49D,0xC4B7,'H3'],[0xC4B8,0xC4B8,'H2']]) +call extend(s:tmp, [[0xC4B9,0xC4D3,'H3'],[0xC4D4,0xC4D4,'H2'],[0xC4D5,0xC4EF,'H3']]) +call extend(s:tmp, [[0xC4F0,0xC4F0,'H2'],[0xC4F1,0xC50B,'H3'],[0xC50C,0xC50C,'H2']]) +call extend(s:tmp, [[0xC50D,0xC527,'H3'],[0xC528,0xC528,'H2'],[0xC529,0xC543,'H3']]) +call extend(s:tmp, [[0xC544,0xC544,'H2'],[0xC545,0xC55F,'H3'],[0xC560,0xC560,'H2']]) +call extend(s:tmp, [[0xC561,0xC57B,'H3'],[0xC57C,0xC57C,'H2'],[0xC57D,0xC597,'H3']]) +call extend(s:tmp, [[0xC598,0xC598,'H2'],[0xC599,0xC5B3,'H3'],[0xC5B4,0xC5B4,'H2']]) +call extend(s:tmp, [[0xC5B5,0xC5CF,'H3'],[0xC5D0,0xC5D0,'H2'],[0xC5D1,0xC5EB,'H3']]) +call extend(s:tmp, [[0xC5EC,0xC5EC,'H2'],[0xC5ED,0xC607,'H3'],[0xC608,0xC608,'H2']]) +call extend(s:tmp, [[0xC609,0xC623,'H3'],[0xC624,0xC624,'H2'],[0xC625,0xC63F,'H3']]) +call extend(s:tmp, [[0xC640,0xC640,'H2'],[0xC641,0xC65B,'H3'],[0xC65C,0xC65C,'H2']]) +call extend(s:tmp, [[0xC65D,0xC677,'H3'],[0xC678,0xC678,'H2'],[0xC679,0xC693,'H3']]) +call extend(s:tmp, [[0xC694,0xC694,'H2'],[0xC695,0xC6AF,'H3'],[0xC6B0,0xC6B0,'H2']]) +call extend(s:tmp, [[0xC6B1,0xC6CB,'H3'],[0xC6CC,0xC6CC,'H2'],[0xC6CD,0xC6E7,'H3']]) +call extend(s:tmp, [[0xC6E8,0xC6E8,'H2'],[0xC6E9,0xC703,'H3'],[0xC704,0xC704,'H2']]) +call extend(s:tmp, [[0xC705,0xC71F,'H3'],[0xC720,0xC720,'H2'],[0xC721,0xC73B,'H3']]) +call extend(s:tmp, [[0xC73C,0xC73C,'H2'],[0xC73D,0xC757,'H3'],[0xC758,0xC758,'H2']]) +call extend(s:tmp, [[0xC759,0xC773,'H3'],[0xC774,0xC774,'H2'],[0xC775,0xC78F,'H3']]) +call extend(s:tmp, [[0xC790,0xC790,'H2'],[0xC791,0xC7AB,'H3'],[0xC7AC,0xC7AC,'H2']]) +call extend(s:tmp, [[0xC7AD,0xC7C7,'H3'],[0xC7C8,0xC7C8,'H2'],[0xC7C9,0xC7E3,'H3']]) +call extend(s:tmp, [[0xC7E4,0xC7E4,'H2'],[0xC7E5,0xC7FF,'H3'],[0xC800,0xC800,'H2']]) +call extend(s:tmp, [[0xC801,0xC81B,'H3'],[0xC81C,0xC81C,'H2'],[0xC81D,0xC837,'H3']]) +call extend(s:tmp, [[0xC838,0xC838,'H2'],[0xC839,0xC853,'H3'],[0xC854,0xC854,'H2']]) +call extend(s:tmp, [[0xC855,0xC86F,'H3'],[0xC870,0xC870,'H2'],[0xC871,0xC88B,'H3']]) +call extend(s:tmp, [[0xC88C,0xC88C,'H2'],[0xC88D,0xC8A7,'H3'],[0xC8A8,0xC8A8,'H2']]) +call extend(s:tmp, [[0xC8A9,0xC8C3,'H3'],[0xC8C4,0xC8C4,'H2'],[0xC8C5,0xC8DF,'H3']]) +call extend(s:tmp, [[0xC8E0,0xC8E0,'H2'],[0xC8E1,0xC8FB,'H3'],[0xC8FC,0xC8FC,'H2']]) +call extend(s:tmp, [[0xC8FD,0xC917,'H3'],[0xC918,0xC918,'H2'],[0xC919,0xC933,'H3']]) +call extend(s:tmp, [[0xC934,0xC934,'H2'],[0xC935,0xC94F,'H3'],[0xC950,0xC950,'H2']]) +call extend(s:tmp, [[0xC951,0xC96B,'H3'],[0xC96C,0xC96C,'H2'],[0xC96D,0xC987,'H3']]) +call extend(s:tmp, [[0xC988,0xC988,'H2'],[0xC989,0xC9A3,'H3'],[0xC9A4,0xC9A4,'H2']]) +call extend(s:tmp, [[0xC9A5,0xC9BF,'H3'],[0xC9C0,0xC9C0,'H2'],[0xC9C1,0xC9DB,'H3']]) +call extend(s:tmp, [[0xC9DC,0xC9DC,'H2'],[0xC9DD,0xC9F7,'H3'],[0xC9F8,0xC9F8,'H2']]) +call extend(s:tmp, [[0xC9F9,0xCA13,'H3'],[0xCA14,0xCA14,'H2'],[0xCA15,0xCA2F,'H3']]) +call extend(s:tmp, [[0xCA30,0xCA30,'H2'],[0xCA31,0xCA4B,'H3'],[0xCA4C,0xCA4C,'H2']]) +call extend(s:tmp, [[0xCA4D,0xCA67,'H3'],[0xCA68,0xCA68,'H2'],[0xCA69,0xCA83,'H3']]) +call extend(s:tmp, [[0xCA84,0xCA84,'H2'],[0xCA85,0xCA9F,'H3'],[0xCAA0,0xCAA0,'H2']]) +call extend(s:tmp, [[0xCAA1,0xCABB,'H3'],[0xCABC,0xCABC,'H2'],[0xCABD,0xCAD7,'H3']]) +call extend(s:tmp, [[0xCAD8,0xCAD8,'H2'],[0xCAD9,0xCAF3,'H3'],[0xCAF4,0xCAF4,'H2']]) +call extend(s:tmp, [[0xCAF5,0xCB0F,'H3'],[0xCB10,0xCB10,'H2'],[0xCB11,0xCB2B,'H3']]) +call extend(s:tmp, [[0xCB2C,0xCB2C,'H2'],[0xCB2D,0xCB47,'H3'],[0xCB48,0xCB48,'H2']]) +call extend(s:tmp, [[0xCB49,0xCB63,'H3'],[0xCB64,0xCB64,'H2'],[0xCB65,0xCB7F,'H3']]) +call extend(s:tmp, [[0xCB80,0xCB80,'H2'],[0xCB81,0xCB9B,'H3'],[0xCB9C,0xCB9C,'H2']]) +call extend(s:tmp, [[0xCB9D,0xCBB7,'H3'],[0xCBB8,0xCBB8,'H2'],[0xCBB9,0xCBD3,'H3']]) +call extend(s:tmp, [[0xCBD4,0xCBD4,'H2'],[0xCBD5,0xCBEF,'H3'],[0xCBF0,0xCBF0,'H2']]) +call extend(s:tmp, [[0xCBF1,0xCC0B,'H3'],[0xCC0C,0xCC0C,'H2'],[0xCC0D,0xCC27,'H3']]) +call extend(s:tmp, [[0xCC28,0xCC28,'H2'],[0xCC29,0xCC43,'H3'],[0xCC44,0xCC44,'H2']]) +call extend(s:tmp, [[0xCC45,0xCC5F,'H3'],[0xCC60,0xCC60,'H2'],[0xCC61,0xCC7B,'H3']]) +call extend(s:tmp, [[0xCC7C,0xCC7C,'H2'],[0xCC7D,0xCC97,'H3'],[0xCC98,0xCC98,'H2']]) +call extend(s:tmp, [[0xCC99,0xCCB3,'H3'],[0xCCB4,0xCCB4,'H2'],[0xCCB5,0xCCCF,'H3']]) +call extend(s:tmp, [[0xCCD0,0xCCD0,'H2'],[0xCCD1,0xCCEB,'H3'],[0xCCEC,0xCCEC,'H2']]) +call extend(s:tmp, [[0xCCED,0xCD07,'H3'],[0xCD08,0xCD08,'H2'],[0xCD09,0xCD23,'H3']]) +call extend(s:tmp, [[0xCD24,0xCD24,'H2'],[0xCD25,0xCD3F,'H3'],[0xCD40,0xCD40,'H2']]) +call extend(s:tmp, [[0xCD41,0xCD5B,'H3'],[0xCD5C,0xCD5C,'H2'],[0xCD5D,0xCD77,'H3']]) +call extend(s:tmp, [[0xCD78,0xCD78,'H2'],[0xCD79,0xCD93,'H3'],[0xCD94,0xCD94,'H2']]) +call extend(s:tmp, [[0xCD95,0xCDAF,'H3'],[0xCDB0,0xCDB0,'H2'],[0xCDB1,0xCDCB,'H3']]) +call extend(s:tmp, [[0xCDCC,0xCDCC,'H2'],[0xCDCD,0xCDE7,'H3'],[0xCDE8,0xCDE8,'H2']]) +call extend(s:tmp, [[0xCDE9,0xCE03,'H3'],[0xCE04,0xCE04,'H2'],[0xCE05,0xCE1F,'H3']]) +call extend(s:tmp, [[0xCE20,0xCE20,'H2'],[0xCE21,0xCE3B,'H3'],[0xCE3C,0xCE3C,'H2']]) +call extend(s:tmp, [[0xCE3D,0xCE57,'H3'],[0xCE58,0xCE58,'H2'],[0xCE59,0xCE73,'H3']]) +call extend(s:tmp, [[0xCE74,0xCE74,'H2'],[0xCE75,0xCE8F,'H3'],[0xCE90,0xCE90,'H2']]) +call extend(s:tmp, [[0xCE91,0xCEAB,'H3'],[0xCEAC,0xCEAC,'H2'],[0xCEAD,0xCEC7,'H3']]) +call extend(s:tmp, [[0xCEC8,0xCEC8,'H2'],[0xCEC9,0xCEE3,'H3'],[0xCEE4,0xCEE4,'H2']]) +call extend(s:tmp, [[0xCEE5,0xCEFF,'H3'],[0xCF00,0xCF00,'H2'],[0xCF01,0xCF1B,'H3']]) +call extend(s:tmp, [[0xCF1C,0xCF1C,'H2'],[0xCF1D,0xCF37,'H3'],[0xCF38,0xCF38,'H2']]) +call extend(s:tmp, [[0xCF39,0xCF53,'H3'],[0xCF54,0xCF54,'H2'],[0xCF55,0xCF6F,'H3']]) +call extend(s:tmp, [[0xCF70,0xCF70,'H2'],[0xCF71,0xCF8B,'H3'],[0xCF8C,0xCF8C,'H2']]) +call extend(s:tmp, [[0xCF8D,0xCFA7,'H3'],[0xCFA8,0xCFA8,'H2'],[0xCFA9,0xCFC3,'H3']]) +call extend(s:tmp, [[0xCFC4,0xCFC4,'H2'],[0xCFC5,0xCFDF,'H3'],[0xCFE0,0xCFE0,'H2']]) +call extend(s:tmp, [[0xCFE1,0xCFFB,'H3'],[0xCFFC,0xCFFC,'H2'],[0xCFFD,0xD017,'H3']]) +call extend(s:tmp, [[0xD018,0xD018,'H2'],[0xD019,0xD033,'H3'],[0xD034,0xD034,'H2']]) +call extend(s:tmp, [[0xD035,0xD04F,'H3'],[0xD050,0xD050,'H2'],[0xD051,0xD06B,'H3']]) +call extend(s:tmp, [[0xD06C,0xD06C,'H2'],[0xD06D,0xD087,'H3'],[0xD088,0xD088,'H2']]) +call extend(s:tmp, [[0xD089,0xD0A3,'H3'],[0xD0A4,0xD0A4,'H2'],[0xD0A5,0xD0BF,'H3']]) +call extend(s:tmp, [[0xD0C0,0xD0C0,'H2'],[0xD0C1,0xD0DB,'H3'],[0xD0DC,0xD0DC,'H2']]) +call extend(s:tmp, [[0xD0DD,0xD0F7,'H3'],[0xD0F8,0xD0F8,'H2'],[0xD0F9,0xD113,'H3']]) +call extend(s:tmp, [[0xD114,0xD114,'H2'],[0xD115,0xD12F,'H3'],[0xD130,0xD130,'H2']]) +call extend(s:tmp, [[0xD131,0xD14B,'H3'],[0xD14C,0xD14C,'H2'],[0xD14D,0xD167,'H3']]) +call extend(s:tmp, [[0xD168,0xD168,'H2'],[0xD169,0xD183,'H3'],[0xD184,0xD184,'H2']]) +call extend(s:tmp, [[0xD185,0xD19F,'H3'],[0xD1A0,0xD1A0,'H2'],[0xD1A1,0xD1BB,'H3']]) +call extend(s:tmp, [[0xD1BC,0xD1BC,'H2'],[0xD1BD,0xD1D7,'H3'],[0xD1D8,0xD1D8,'H2']]) +call extend(s:tmp, [[0xD1D9,0xD1F3,'H3'],[0xD1F4,0xD1F4,'H2'],[0xD1F5,0xD20F,'H3']]) +call extend(s:tmp, [[0xD210,0xD210,'H2'],[0xD211,0xD22B,'H3'],[0xD22C,0xD22C,'H2']]) +call extend(s:tmp, [[0xD22D,0xD247,'H3'],[0xD248,0xD248,'H2'],[0xD249,0xD263,'H3']]) +call extend(s:tmp, [[0xD264,0xD264,'H2'],[0xD265,0xD27F,'H3'],[0xD280,0xD280,'H2']]) +call extend(s:tmp, [[0xD281,0xD29B,'H3'],[0xD29C,0xD29C,'H2'],[0xD29D,0xD2B7,'H3']]) +call extend(s:tmp, [[0xD2B8,0xD2B8,'H2'],[0xD2B9,0xD2D3,'H3'],[0xD2D4,0xD2D4,'H2']]) +call extend(s:tmp, [[0xD2D5,0xD2EF,'H3'],[0xD2F0,0xD2F0,'H2'],[0xD2F1,0xD30B,'H3']]) +call extend(s:tmp, [[0xD30C,0xD30C,'H2'],[0xD30D,0xD327,'H3'],[0xD328,0xD328,'H2']]) +call extend(s:tmp, [[0xD329,0xD343,'H3'],[0xD344,0xD344,'H2'],[0xD345,0xD35F,'H3']]) +call extend(s:tmp, [[0xD360,0xD360,'H2'],[0xD361,0xD37B,'H3'],[0xD37C,0xD37C,'H2']]) +call extend(s:tmp, [[0xD37D,0xD397,'H3'],[0xD398,0xD398,'H2'],[0xD399,0xD3B3,'H3']]) +call extend(s:tmp, [[0xD3B4,0xD3B4,'H2'],[0xD3B5,0xD3CF,'H3'],[0xD3D0,0xD3D0,'H2']]) +call extend(s:tmp, [[0xD3D1,0xD3EB,'H3'],[0xD3EC,0xD3EC,'H2'],[0xD3ED,0xD407,'H3']]) +call extend(s:tmp, [[0xD408,0xD408,'H2'],[0xD409,0xD423,'H3'],[0xD424,0xD424,'H2']]) +call extend(s:tmp, [[0xD425,0xD43F,'H3'],[0xD440,0xD440,'H2'],[0xD441,0xD45B,'H3']]) +call extend(s:tmp, [[0xD45C,0xD45C,'H2'],[0xD45D,0xD477,'H3'],[0xD478,0xD478,'H2']]) +call extend(s:tmp, [[0xD479,0xD493,'H3'],[0xD494,0xD494,'H2'],[0xD495,0xD4AF,'H3']]) +call extend(s:tmp, [[0xD4B0,0xD4B0,'H2'],[0xD4B1,0xD4CB,'H3'],[0xD4CC,0xD4CC,'H2']]) +call extend(s:tmp, [[0xD4CD,0xD4E7,'H3'],[0xD4E8,0xD4E8,'H2'],[0xD4E9,0xD503,'H3']]) +call extend(s:tmp, [[0xD504,0xD504,'H2'],[0xD505,0xD51F,'H3'],[0xD520,0xD520,'H2']]) +call extend(s:tmp, [[0xD521,0xD53B,'H3'],[0xD53C,0xD53C,'H2'],[0xD53D,0xD557,'H3']]) +call extend(s:tmp, [[0xD558,0xD558,'H2'],[0xD559,0xD573,'H3'],[0xD574,0xD574,'H2']]) +call extend(s:tmp, [[0xD575,0xD58F,'H3'],[0xD590,0xD590,'H2'],[0xD591,0xD5AB,'H3']]) +call extend(s:tmp, [[0xD5AC,0xD5AC,'H2'],[0xD5AD,0xD5C7,'H3'],[0xD5C8,0xD5C8,'H2']]) +call extend(s:tmp, [[0xD5C9,0xD5E3,'H3'],[0xD5E4,0xD5E4,'H2'],[0xD5E5,0xD5FF,'H3']]) +call extend(s:tmp, [[0xD600,0xD600,'H2'],[0xD601,0xD61B,'H3'],[0xD61C,0xD61C,'H2']]) +call extend(s:tmp, [[0xD61D,0xD637,'H3'],[0xD638,0xD638,'H2'],[0xD639,0xD653,'H3']]) +call extend(s:tmp, [[0xD654,0xD654,'H2'],[0xD655,0xD66F,'H3'],[0xD670,0xD670,'H2']]) +call extend(s:tmp, [[0xD671,0xD68B,'H3'],[0xD68C,0xD68C,'H2'],[0xD68D,0xD6A7,'H3']]) +call extend(s:tmp, [[0xD6A8,0xD6A8,'H2'],[0xD6A9,0xD6C3,'H3'],[0xD6C4,0xD6C4,'H2']]) +call extend(s:tmp, [[0xD6C5,0xD6DF,'H3'],[0xD6E0,0xD6E0,'H2'],[0xD6E1,0xD6FB,'H3']]) +call extend(s:tmp, [[0xD6FC,0xD6FC,'H2'],[0xD6FD,0xD717,'H3'],[0xD718,0xD718,'H2']]) +call extend(s:tmp, [[0xD719,0xD733,'H3'],[0xD734,0xD734,'H2'],[0xD735,0xD74F,'H3']]) +call extend(s:tmp, [[0xD750,0xD750,'H2'],[0xD751,0xD76B,'H3'],[0xD76C,0xD76C,'H2']]) +call extend(s:tmp, [[0xD76D,0xD787,'H3'],[0xD788,0xD788,'H2'],[0xD789,0xD7A3,'H3']]) +call extend(s:tmp, [[0xD7B0,0xD7C6,'JV'],[0xD7CB,0xD7FB,'JT'],[0xD800,0xDFFF,'SG']]) +call extend(s:tmp, [[0xE000,0xF8FF,'XX'],[0xF900,0xFAFF,'ID'],[0xFB00,0xFB06,'AL']]) +call extend(s:tmp, [[0xFB13,0xFB17,'AL'],[0xFB1D,0xFB1D,'HL'],[0xFB1E,0xFB1E,'CM']]) +call extend(s:tmp, [[0xFB1F,0xFB28,'HL'],[0xFB29,0xFB29,'AL'],[0xFB2A,0xFB36,'HL']]) +call extend(s:tmp, [[0xFB38,0xFB3C,'HL'],[0xFB3E,0xFB3E,'HL'],[0xFB40,0xFB41,'HL']]) +call extend(s:tmp, [[0xFB43,0xFB44,'HL'],[0xFB46,0xFB4F,'HL'],[0xFB50,0xFBC1,'AL']]) +call extend(s:tmp, [[0xFBD3,0xFD3D,'AL'],[0xFD3E,0xFD3E,'CL'],[0xFD3F,0xFD3F,'OP']]) +call extend(s:tmp, [[0xFD50,0xFD8F,'AL'],[0xFD92,0xFDC7,'AL'],[0xFDF0,0xFDFB,'AL']]) +call extend(s:tmp, [[0xFDFC,0xFDFC,'PO'],[0xFDFD,0xFDFD,'AL'],[0xFE00,0xFE0F,'CM']]) +call extend(s:tmp, [[0xFE10,0xFE10,'IS'],[0xFE11,0xFE12,'CL'],[0xFE13,0xFE14,'IS']]) +call extend(s:tmp, [[0xFE15,0xFE16,'EX'],[0xFE17,0xFE17,'OP'],[0xFE18,0xFE18,'CL']]) +call extend(s:tmp, [[0xFE19,0xFE19,'IN'],[0xFE20,0xFE2F,'CM'],[0xFE30,0xFE34,'ID']]) +call extend(s:tmp, [[0xFE35,0xFE35,'OP'],[0xFE36,0xFE36,'CL'],[0xFE37,0xFE37,'OP']]) +call extend(s:tmp, [[0xFE38,0xFE38,'CL'],[0xFE39,0xFE39,'OP'],[0xFE3A,0xFE3A,'CL']]) +call extend(s:tmp, [[0xFE3B,0xFE3B,'OP'],[0xFE3C,0xFE3C,'CL'],[0xFE3D,0xFE3D,'OP']]) +call extend(s:tmp, [[0xFE3E,0xFE3E,'CL'],[0xFE3F,0xFE3F,'OP'],[0xFE40,0xFE40,'CL']]) +call extend(s:tmp, [[0xFE41,0xFE41,'OP'],[0xFE42,0xFE42,'CL'],[0xFE43,0xFE43,'OP']]) +call extend(s:tmp, [[0xFE44,0xFE44,'CL'],[0xFE45,0xFE46,'ID'],[0xFE47,0xFE47,'OP']]) +call extend(s:tmp, [[0xFE48,0xFE48,'CL'],[0xFE49,0xFE4F,'ID'],[0xFE50,0xFE50,'CL']]) +call extend(s:tmp, [[0xFE51,0xFE51,'ID'],[0xFE52,0xFE52,'CL'],[0xFE54,0xFE55,'NS']]) +call extend(s:tmp, [[0xFE56,0xFE57,'EX'],[0xFE58,0xFE58,'ID'],[0xFE59,0xFE59,'OP']]) +call extend(s:tmp, [[0xFE5A,0xFE5A,'CL'],[0xFE5B,0xFE5B,'OP'],[0xFE5C,0xFE5C,'CL']]) +call extend(s:tmp, [[0xFE5D,0xFE5D,'OP'],[0xFE5E,0xFE5E,'CL'],[0xFE5F,0xFE66,'ID']]) +call extend(s:tmp, [[0xFE68,0xFE68,'ID'],[0xFE69,0xFE69,'PR'],[0xFE6A,0xFE6A,'PO']]) +call extend(s:tmp, [[0xFE6B,0xFE6B,'ID'],[0xFE70,0xFE74,'AL'],[0xFE76,0xFEFC,'AL']]) +call extend(s:tmp, [[0xFEFF,0xFEFF,'WJ'],[0xFF01,0xFF01,'EX'],[0xFF02,0xFF03,'ID']]) +call extend(s:tmp, [[0xFF04,0xFF04,'PR'],[0xFF05,0xFF05,'PO'],[0xFF06,0xFF07,'ID']]) +call extend(s:tmp, [[0xFF08,0xFF08,'OP'],[0xFF09,0xFF09,'CL'],[0xFF0A,0xFF0B,'ID']]) +call extend(s:tmp, [[0xFF0C,0xFF0C,'CL'],[0xFF0D,0xFF0D,'ID'],[0xFF0E,0xFF0E,'CL']]) +call extend(s:tmp, [[0xFF0F,0xFF19,'ID'],[0xFF1A,0xFF1B,'NS'],[0xFF1C,0xFF1E,'ID']]) +call extend(s:tmp, [[0xFF1F,0xFF1F,'EX'],[0xFF20,0xFF3A,'ID'],[0xFF3B,0xFF3B,'OP']]) +call extend(s:tmp, [[0xFF3C,0xFF3C,'ID'],[0xFF3D,0xFF3D,'CL'],[0xFF3E,0xFF5A,'ID']]) +call extend(s:tmp, [[0xFF5B,0xFF5B,'OP'],[0xFF5C,0xFF5C,'ID'],[0xFF5D,0xFF5D,'CL']]) +call extend(s:tmp, [[0xFF5E,0xFF5E,'ID'],[0xFF5F,0xFF5F,'OP'],[0xFF60,0xFF61,'CL']]) +call extend(s:tmp, [[0xFF62,0xFF62,'OP'],[0xFF63,0xFF64,'CL'],[0xFF65,0xFF65,'NS']]) +call extend(s:tmp, [[0xFF66,0xFF66,'ID'],[0xFF67,0xFF70,'CJ'],[0xFF71,0xFF9D,'ID']]) +call extend(s:tmp, [[0xFF9E,0xFF9F,'NS'],[0xFFA0,0xFFBE,'ID'],[0xFFC2,0xFFC7,'ID']]) +call extend(s:tmp, [[0xFFCA,0xFFCF,'ID'],[0xFFD2,0xFFD7,'ID'],[0xFFDA,0xFFDC,'ID']]) +call extend(s:tmp, [[0xFFE0,0xFFE0,'PO'],[0xFFE1,0xFFE1,'PR'],[0xFFE2,0xFFE4,'ID']]) +call extend(s:tmp, [[0xFFE5,0xFFE6,'PR'],[0xFFE8,0xFFEE,'AL'],[0xFFF9,0xFFFB,'CM']]) +call extend(s:tmp, [[0xFFFC,0xFFFC,'CB'],[0xFFFD,0xFFFD,'AI'],[0x10000,0x1000B,'AL']]) +call extend(s:tmp, [[0x1000D,0x10026,'AL'],[0x10028,0x1003A,'AL'],[0x1003C,0x1003D,'AL']]) +call extend(s:tmp, [[0x1003F,0x1004D,'AL'],[0x10050,0x1005D,'AL'],[0x10080,0x100FA,'AL']]) +call extend(s:tmp, [[0x10100,0x10102,'BA'],[0x10107,0x10133,'AL'],[0x10137,0x1018E,'AL']]) +call extend(s:tmp, [[0x10190,0x1019B,'AL'],[0x101A0,0x101A0,'AL'],[0x101D0,0x101FC,'AL']]) +call extend(s:tmp, [[0x101FD,0x101FD,'CM'],[0x10280,0x1029C,'AL'],[0x102A0,0x102D0,'AL']]) +call extend(s:tmp, [[0x102E0,0x102E0,'CM'],[0x102E1,0x102FB,'AL'],[0x10300,0x10323,'AL']]) +call extend(s:tmp, [[0x10330,0x1034A,'AL'],[0x10350,0x10375,'AL'],[0x10376,0x1037A,'CM']]) +call extend(s:tmp, [[0x10380,0x1039D,'AL'],[0x1039F,0x1039F,'BA'],[0x103A0,0x103C3,'AL']]) +call extend(s:tmp, [[0x103C8,0x103CF,'AL'],[0x103D0,0x103D0,'BA'],[0x103D1,0x103D5,'AL']]) +call extend(s:tmp, [[0x10400,0x1049D,'AL'],[0x104A0,0x104A9,'NU'],[0x104B0,0x104D3,'AL']]) +call extend(s:tmp, [[0x104D8,0x104FB,'AL'],[0x10500,0x10527,'AL'],[0x10530,0x10563,'AL']]) +call extend(s:tmp, [[0x1056F,0x1056F,'AL'],[0x10600,0x10736,'AL'],[0x10740,0x10755,'AL']]) +call extend(s:tmp, [[0x10760,0x10767,'AL'],[0x10800,0x10805,'AL'],[0x10808,0x10808,'AL']]) +call extend(s:tmp, [[0x1080A,0x10835,'AL'],[0x10837,0x10838,'AL'],[0x1083C,0x1083C,'AL']]) +call extend(s:tmp, [[0x1083F,0x10855,'AL'],[0x10857,0x10857,'BA'],[0x10858,0x1089E,'AL']]) +call extend(s:tmp, [[0x108A7,0x108AF,'AL'],[0x108E0,0x108F2,'AL'],[0x108F4,0x108F5,'AL']]) +call extend(s:tmp, [[0x108FB,0x1091B,'AL'],[0x1091F,0x1091F,'BA'],[0x10920,0x10939,'AL']]) +call extend(s:tmp, [[0x1093F,0x1093F,'AL'],[0x10980,0x109B7,'AL'],[0x109BC,0x109CF,'AL']]) +call extend(s:tmp, [[0x109D2,0x10A00,'AL'],[0x10A01,0x10A03,'CM'],[0x10A05,0x10A06,'CM']]) +call extend(s:tmp, [[0x10A0C,0x10A0F,'CM'],[0x10A10,0x10A13,'AL'],[0x10A15,0x10A17,'AL']]) +call extend(s:tmp, [[0x10A19,0x10A33,'AL'],[0x10A38,0x10A3A,'CM'],[0x10A3F,0x10A3F,'CM']]) +call extend(s:tmp, [[0x10A40,0x10A47,'AL'],[0x10A50,0x10A57,'BA'],[0x10A58,0x10A58,'AL']]) +call extend(s:tmp, [[0x10A60,0x10A9F,'AL'],[0x10AC0,0x10AE4,'AL'],[0x10AE5,0x10AE6,'CM']]) +call extend(s:tmp, [[0x10AEB,0x10AEF,'AL'],[0x10AF0,0x10AF5,'BA'],[0x10AF6,0x10AF6,'IN']]) +call extend(s:tmp, [[0x10B00,0x10B35,'AL'],[0x10B39,0x10B3F,'BA'],[0x10B40,0x10B55,'AL']]) +call extend(s:tmp, [[0x10B58,0x10B72,'AL'],[0x10B78,0x10B91,'AL'],[0x10B99,0x10B9C,'AL']]) +call extend(s:tmp, [[0x10BA9,0x10BAF,'AL'],[0x10C00,0x10C48,'AL'],[0x10C80,0x10CB2,'AL']]) +call extend(s:tmp, [[0x10CC0,0x10CF2,'AL'],[0x10CFA,0x10CFF,'AL'],[0x10E60,0x10E7E,'AL']]) +call extend(s:tmp, [[0x11000,0x11002,'CM'],[0x11003,0x11037,'AL'],[0x11038,0x11046,'CM']]) +call extend(s:tmp, [[0x11047,0x11048,'BA'],[0x11049,0x1104D,'AL'],[0x11052,0x11065,'AL']]) +call extend(s:tmp, [[0x11066,0x1106F,'NU'],[0x1107F,0x11082,'CM'],[0x11083,0x110AF,'AL']]) +call extend(s:tmp, [[0x110B0,0x110BA,'CM'],[0x110BB,0x110BD,'AL'],[0x110BE,0x110C1,'BA']]) +call extend(s:tmp, [[0x110D0,0x110E8,'AL'],[0x110F0,0x110F9,'NU'],[0x11100,0x11102,'CM']]) +call extend(s:tmp, [[0x11103,0x11126,'AL'],[0x11127,0x11134,'CM'],[0x11136,0x1113F,'NU']]) +call extend(s:tmp, [[0x11140,0x11143,'BA'],[0x11150,0x11172,'AL'],[0x11173,0x11173,'CM']]) +call extend(s:tmp, [[0x11174,0x11174,'AL'],[0x11175,0x11175,'BB'],[0x11176,0x11176,'AL']]) +call extend(s:tmp, [[0x11180,0x11182,'CM'],[0x11183,0x111B2,'AL'],[0x111B3,0x111C0,'CM']]) +call extend(s:tmp, [[0x111C1,0x111C4,'AL'],[0x111C5,0x111C6,'BA'],[0x111C7,0x111C7,'AL']]) +call extend(s:tmp, [[0x111C8,0x111C8,'BA'],[0x111C9,0x111C9,'AL'],[0x111CA,0x111CC,'CM']]) +call extend(s:tmp, [[0x111CD,0x111CD,'AL'],[0x111D0,0x111D9,'NU'],[0x111DA,0x111DA,'AL']]) +call extend(s:tmp, [[0x111DB,0x111DB,'BB'],[0x111DC,0x111DC,'AL'],[0x111DD,0x111DF,'BA']]) +call extend(s:tmp, [[0x111E1,0x111F4,'AL'],[0x11200,0x11211,'AL'],[0x11213,0x1122B,'AL']]) +call extend(s:tmp, [[0x1122C,0x11237,'CM'],[0x11238,0x11239,'BA'],[0x1123A,0x1123A,'AL']]) +call extend(s:tmp, [[0x1123B,0x1123C,'BA'],[0x1123D,0x1123D,'AL'],[0x1123E,0x1123E,'CM']]) +call extend(s:tmp, [[0x11280,0x11286,'AL'],[0x11288,0x11288,'AL'],[0x1128A,0x1128D,'AL']]) +call extend(s:tmp, [[0x1128F,0x1129D,'AL'],[0x1129F,0x112A8,'AL'],[0x112A9,0x112A9,'BA']]) +call extend(s:tmp, [[0x112B0,0x112DE,'AL'],[0x112DF,0x112EA,'CM'],[0x112F0,0x112F9,'NU']]) +call extend(s:tmp, [[0x11300,0x11303,'CM'],[0x11305,0x1130C,'AL'],[0x1130F,0x11310,'AL']]) +call extend(s:tmp, [[0x11313,0x11328,'AL'],[0x1132A,0x11330,'AL'],[0x11332,0x11333,'AL']]) +call extend(s:tmp, [[0x11335,0x11339,'AL'],[0x1133C,0x1133C,'CM'],[0x1133D,0x1133D,'AL']]) +call extend(s:tmp, [[0x1133E,0x11344,'CM'],[0x11347,0x11348,'CM'],[0x1134B,0x1134D,'CM']]) +call extend(s:tmp, [[0x11350,0x11350,'AL'],[0x11357,0x11357,'CM'],[0x1135D,0x11361,'AL']]) +call extend(s:tmp, [[0x11362,0x11363,'CM'],[0x11366,0x1136C,'CM'],[0x11370,0x11374,'CM']]) +call extend(s:tmp, [[0x11400,0x11434,'AL'],[0x11435,0x11446,'CM'],[0x11447,0x1144A,'AL']]) +call extend(s:tmp, [[0x1144B,0x1144E,'BA'],[0x1144F,0x1144F,'AL'],[0x11450,0x11459,'NU']]) +call extend(s:tmp, [[0x1145B,0x1145B,'BA'],[0x1145D,0x1145D,'AL'],[0x11480,0x114AF,'AL']]) +call extend(s:tmp, [[0x114B0,0x114C3,'CM'],[0x114C4,0x114C7,'AL'],[0x114D0,0x114D9,'NU']]) +call extend(s:tmp, [[0x11580,0x115AE,'AL'],[0x115AF,0x115B5,'CM'],[0x115B8,0x115C0,'CM']]) +call extend(s:tmp, [[0x115C1,0x115C1,'BB'],[0x115C2,0x115C3,'BA'],[0x115C4,0x115C5,'EX']]) +call extend(s:tmp, [[0x115C6,0x115C8,'AL'],[0x115C9,0x115D7,'BA'],[0x115D8,0x115DB,'AL']]) +call extend(s:tmp, [[0x115DC,0x115DD,'CM'],[0x11600,0x1162F,'AL'],[0x11630,0x11640,'CM']]) +call extend(s:tmp, [[0x11641,0x11642,'BA'],[0x11643,0x11644,'AL'],[0x11650,0x11659,'NU']]) +call extend(s:tmp, [[0x11660,0x1166C,'BB'],[0x11680,0x116AA,'AL'],[0x116AB,0x116B7,'CM']]) +call extend(s:tmp, [[0x116C0,0x116C9,'NU'],[0x11700,0x11719,'SA'],[0x1171D,0x1172B,'SA']]) +call extend(s:tmp, [[0x11730,0x11739,'NU'],[0x1173A,0x1173B,'SA'],[0x1173C,0x1173E,'BA']]) +call extend(s:tmp, [[0x1173F,0x1173F,'SA'],[0x118A0,0x118DF,'AL'],[0x118E0,0x118E9,'NU']]) +call extend(s:tmp, [[0x118EA,0x118F2,'AL'],[0x118FF,0x118FF,'AL'],[0x11AC0,0x11AF8,'AL']]) +call extend(s:tmp, [[0x11C00,0x11C08,'AL'],[0x11C0A,0x11C2E,'AL'],[0x11C2F,0x11C36,'CM']]) +call extend(s:tmp, [[0x11C38,0x11C3F,'CM'],[0x11C40,0x11C40,'AL'],[0x11C41,0x11C45,'BA']]) +call extend(s:tmp, [[0x11C50,0x11C59,'NU'],[0x11C5A,0x11C6C,'AL'],[0x11C70,0x11C70,'BB']]) +call extend(s:tmp, [[0x11C71,0x11C71,'EX'],[0x11C72,0x11C8F,'AL'],[0x11C92,0x11CA7,'CM']]) +call extend(s:tmp, [[0x11CA9,0x11CB6,'CM'],[0x12000,0x12399,'AL'],[0x12400,0x1246E,'AL']]) +call extend(s:tmp, [[0x12470,0x12474,'BA'],[0x12480,0x12543,'AL'],[0x13000,0x13257,'AL']]) +call extend(s:tmp, [[0x13258,0x1325A,'OP'],[0x1325B,0x1325D,'CL'],[0x1325E,0x13281,'AL']]) +call extend(s:tmp, [[0x13282,0x13282,'CL'],[0x13283,0x13285,'AL'],[0x13286,0x13286,'OP']]) +call extend(s:tmp, [[0x13287,0x13287,'CL'],[0x13288,0x13288,'OP'],[0x13289,0x13289,'CL']]) +call extend(s:tmp, [[0x1328A,0x13378,'AL'],[0x13379,0x13379,'OP'],[0x1337A,0x1337B,'CL']]) +call extend(s:tmp, [[0x1337C,0x1342E,'AL'],[0x14400,0x145CD,'AL'],[0x145CE,0x145CE,'OP']]) +call extend(s:tmp, [[0x145CF,0x145CF,'CL'],[0x145D0,0x14646,'AL'],[0x16800,0x16A38,'AL']]) +call extend(s:tmp, [[0x16A40,0x16A5E,'AL'],[0x16A60,0x16A69,'NU'],[0x16A6E,0x16A6F,'BA']]) +call extend(s:tmp, [[0x16AD0,0x16AED,'AL'],[0x16AF0,0x16AF4,'CM'],[0x16AF5,0x16AF5,'BA']]) +call extend(s:tmp, [[0x16B00,0x16B2F,'AL'],[0x16B30,0x16B36,'CM'],[0x16B37,0x16B39,'BA']]) +call extend(s:tmp, [[0x16B3A,0x16B43,'AL'],[0x16B44,0x16B44,'BA'],[0x16B45,0x16B45,'AL']]) +call extend(s:tmp, [[0x16B50,0x16B59,'NU'],[0x16B5B,0x16B61,'AL'],[0x16B63,0x16B77,'AL']]) +call extend(s:tmp, [[0x16B7D,0x16B8F,'AL'],[0x16F00,0x16F44,'AL'],[0x16F50,0x16F50,'AL']]) +call extend(s:tmp, [[0x16F51,0x16F7E,'CM'],[0x16F8F,0x16F92,'CM'],[0x16F93,0x16F9F,'AL']]) +call extend(s:tmp, [[0x16FE0,0x16FE0,'NS'],[0x17000,0x187EC,'ID'],[0x18800,0x18AF2,'ID']]) +call extend(s:tmp, [[0x1B000,0x1B001,'ID'],[0x1BC00,0x1BC6A,'AL'],[0x1BC70,0x1BC7C,'AL']]) +call extend(s:tmp, [[0x1BC80,0x1BC88,'AL'],[0x1BC90,0x1BC99,'AL'],[0x1BC9C,0x1BC9C,'AL']]) +call extend(s:tmp, [[0x1BC9D,0x1BC9E,'CM'],[0x1BC9F,0x1BC9F,'BA'],[0x1BCA0,0x1BCA3,'CM']]) +call extend(s:tmp, [[0x1D000,0x1D0F5,'AL'],[0x1D100,0x1D126,'AL'],[0x1D129,0x1D164,'AL']]) +call extend(s:tmp, [[0x1D165,0x1D169,'CM'],[0x1D16A,0x1D16C,'AL'],[0x1D16D,0x1D182,'CM']]) +call extend(s:tmp, [[0x1D183,0x1D184,'AL'],[0x1D185,0x1D18B,'CM'],[0x1D18C,0x1D1A9,'AL']]) +call extend(s:tmp, [[0x1D1AA,0x1D1AD,'CM'],[0x1D1AE,0x1D1E8,'AL'],[0x1D200,0x1D241,'AL']]) +call extend(s:tmp, [[0x1D242,0x1D244,'CM'],[0x1D245,0x1D245,'AL'],[0x1D300,0x1D356,'AL']]) +call extend(s:tmp, [[0x1D360,0x1D371,'AL'],[0x1D400,0x1D454,'AL'],[0x1D456,0x1D49C,'AL']]) +call extend(s:tmp, [[0x1D49E,0x1D49F,'AL'],[0x1D4A2,0x1D4A2,'AL'],[0x1D4A5,0x1D4A6,'AL']]) +call extend(s:tmp, [[0x1D4A9,0x1D4AC,'AL'],[0x1D4AE,0x1D4B9,'AL'],[0x1D4BB,0x1D4BB,'AL']]) +call extend(s:tmp, [[0x1D4BD,0x1D4C3,'AL'],[0x1D4C5,0x1D505,'AL'],[0x1D507,0x1D50A,'AL']]) +call extend(s:tmp, [[0x1D50D,0x1D514,'AL'],[0x1D516,0x1D51C,'AL'],[0x1D51E,0x1D539,'AL']]) +call extend(s:tmp, [[0x1D53B,0x1D53E,'AL'],[0x1D540,0x1D544,'AL'],[0x1D546,0x1D546,'AL']]) +call extend(s:tmp, [[0x1D54A,0x1D550,'AL'],[0x1D552,0x1D6A5,'AL'],[0x1D6A8,0x1D7CB,'AL']]) +call extend(s:tmp, [[0x1D7CE,0x1D7FF,'NU'],[0x1D800,0x1D9FF,'AL'],[0x1DA00,0x1DA36,'CM']]) +call extend(s:tmp, [[0x1DA37,0x1DA3A,'AL'],[0x1DA3B,0x1DA6C,'CM'],[0x1DA6D,0x1DA74,'AL']]) +call extend(s:tmp, [[0x1DA75,0x1DA75,'CM'],[0x1DA76,0x1DA83,'AL'],[0x1DA84,0x1DA84,'CM']]) +call extend(s:tmp, [[0x1DA85,0x1DA86,'AL'],[0x1DA87,0x1DA8A,'BA'],[0x1DA8B,0x1DA8B,'AL']]) +call extend(s:tmp, [[0x1DA9B,0x1DA9F,'CM'],[0x1DAA1,0x1DAAF,'CM'],[0x1E000,0x1E006,'CM']]) +call extend(s:tmp, [[0x1E008,0x1E018,'CM'],[0x1E01B,0x1E021,'CM'],[0x1E023,0x1E024,'CM']]) +call extend(s:tmp, [[0x1E026,0x1E02A,'CM'],[0x1E800,0x1E8C4,'AL'],[0x1E8C7,0x1E8CF,'AL']]) +call extend(s:tmp, [[0x1E8D0,0x1E8D6,'CM'],[0x1E900,0x1E943,'AL'],[0x1E944,0x1E94A,'CM']]) +call extend(s:tmp, [[0x1E950,0x1E959,'NU'],[0x1E95E,0x1E95F,'OP'],[0x1EE00,0x1EE03,'AL']]) +call extend(s:tmp, [[0x1EE05,0x1EE1F,'AL'],[0x1EE21,0x1EE22,'AL'],[0x1EE24,0x1EE24,'AL']]) +call extend(s:tmp, [[0x1EE27,0x1EE27,'AL'],[0x1EE29,0x1EE32,'AL'],[0x1EE34,0x1EE37,'AL']]) +call extend(s:tmp, [[0x1EE39,0x1EE39,'AL'],[0x1EE3B,0x1EE3B,'AL'],[0x1EE42,0x1EE42,'AL']]) +call extend(s:tmp, [[0x1EE47,0x1EE47,'AL'],[0x1EE49,0x1EE49,'AL'],[0x1EE4B,0x1EE4B,'AL']]) +call extend(s:tmp, [[0x1EE4D,0x1EE4F,'AL'],[0x1EE51,0x1EE52,'AL'],[0x1EE54,0x1EE54,'AL']]) +call extend(s:tmp, [[0x1EE57,0x1EE57,'AL'],[0x1EE59,0x1EE59,'AL'],[0x1EE5B,0x1EE5B,'AL']]) +call extend(s:tmp, [[0x1EE5D,0x1EE5D,'AL'],[0x1EE5F,0x1EE5F,'AL'],[0x1EE61,0x1EE62,'AL']]) +call extend(s:tmp, [[0x1EE64,0x1EE64,'AL'],[0x1EE67,0x1EE6A,'AL'],[0x1EE6C,0x1EE72,'AL']]) +call extend(s:tmp, [[0x1EE74,0x1EE77,'AL'],[0x1EE79,0x1EE7C,'AL'],[0x1EE7E,0x1EE7E,'AL']]) +call extend(s:tmp, [[0x1EE80,0x1EE89,'AL'],[0x1EE8B,0x1EE9B,'AL'],[0x1EEA1,0x1EEA3,'AL']]) +call extend(s:tmp, [[0x1EEA5,0x1EEA9,'AL'],[0x1EEAB,0x1EEBB,'AL'],[0x1EEF0,0x1EEF1,'AL']]) +call extend(s:tmp, [[0x1F000,0x1F0FF,'ID'],[0x1F100,0x1F10C,'AI'],[0x1F10D,0x1F10F,'ID']]) +call extend(s:tmp, [[0x1F110,0x1F12D,'AI'],[0x1F12E,0x1F12E,'AL'],[0x1F12F,0x1F12F,'ID']]) +call extend(s:tmp, [[0x1F130,0x1F169,'AI'],[0x1F16A,0x1F16B,'AL'],[0x1F16C,0x1F16F,'ID']]) +call extend(s:tmp, [[0x1F170,0x1F1AC,'AI'],[0x1F1AD,0x1F1E5,'ID'],[0x1F1E6,0x1F1FF,'RI']]) +call extend(s:tmp, [[0x1F200,0x1F384,'ID'],[0x1F385,0x1F385,'EB'],[0x1F386,0x1F39B,'ID']]) +call extend(s:tmp, [[0x1F39C,0x1F39D,'AL'],[0x1F39E,0x1F3B4,'ID'],[0x1F3B5,0x1F3B6,'AL']]) +call extend(s:tmp, [[0x1F3B7,0x1F3BB,'ID'],[0x1F3BC,0x1F3BC,'AL'],[0x1F3BD,0x1F3C2,'ID']]) +call extend(s:tmp, [[0x1F3C3,0x1F3C4,'EB'],[0x1F3C5,0x1F3C9,'ID'],[0x1F3CA,0x1F3CB,'EB']]) +call extend(s:tmp, [[0x1F3CC,0x1F3FA,'ID'],[0x1F3FB,0x1F3FF,'EM'],[0x1F400,0x1F441,'ID']]) +call extend(s:tmp, [[0x1F442,0x1F443,'EB'],[0x1F444,0x1F445,'ID'],[0x1F446,0x1F450,'EB']]) +call extend(s:tmp, [[0x1F451,0x1F465,'ID'],[0x1F466,0x1F469,'EB'],[0x1F46A,0x1F46D,'ID']]) +call extend(s:tmp, [[0x1F46E,0x1F46E,'EB'],[0x1F46F,0x1F46F,'ID'],[0x1F470,0x1F478,'EB']]) +call extend(s:tmp, [[0x1F479,0x1F47B,'ID'],[0x1F47C,0x1F47C,'EB'],[0x1F47D,0x1F480,'ID']]) +call extend(s:tmp, [[0x1F481,0x1F483,'EB'],[0x1F484,0x1F484,'ID'],[0x1F485,0x1F487,'EB']]) +call extend(s:tmp, [[0x1F488,0x1F49F,'ID'],[0x1F4A0,0x1F4A0,'AL'],[0x1F4A1,0x1F4A1,'ID']]) +call extend(s:tmp, [[0x1F4A2,0x1F4A2,'AL'],[0x1F4A3,0x1F4A3,'ID'],[0x1F4A4,0x1F4A4,'AL']]) +call extend(s:tmp, [[0x1F4A5,0x1F4A9,'ID'],[0x1F4AA,0x1F4AA,'EB'],[0x1F4AB,0x1F4AE,'ID']]) +call extend(s:tmp, [[0x1F4AF,0x1F4AF,'AL'],[0x1F4B0,0x1F4B0,'ID'],[0x1F4B1,0x1F4B2,'AL']]) +call extend(s:tmp, [[0x1F4B3,0x1F4FF,'ID'],[0x1F500,0x1F506,'AL'],[0x1F507,0x1F516,'ID']]) +call extend(s:tmp, [[0x1F517,0x1F524,'AL'],[0x1F525,0x1F531,'ID'],[0x1F532,0x1F549,'AL']]) +call extend(s:tmp, [[0x1F54A,0x1F574,'ID'],[0x1F575,0x1F575,'EB'],[0x1F576,0x1F579,'ID']]) +call extend(s:tmp, [[0x1F57A,0x1F57A,'EB'],[0x1F57B,0x1F58F,'ID'],[0x1F590,0x1F590,'EB']]) +call extend(s:tmp, [[0x1F591,0x1F594,'ID'],[0x1F595,0x1F596,'EB'],[0x1F597,0x1F5D3,'ID']]) +call extend(s:tmp, [[0x1F5D4,0x1F5DB,'AL'],[0x1F5DC,0x1F5F3,'ID'],[0x1F5F4,0x1F5F9,'AL']]) +call extend(s:tmp, [[0x1F5FA,0x1F644,'ID'],[0x1F645,0x1F647,'EB'],[0x1F648,0x1F64A,'ID']]) +call extend(s:tmp, [[0x1F64B,0x1F64F,'EB'],[0x1F650,0x1F675,'AL'],[0x1F676,0x1F678,'QU']]) +call extend(s:tmp, [[0x1F679,0x1F67B,'NS'],[0x1F67C,0x1F67F,'AL'],[0x1F680,0x1F6A2,'ID']]) +call extend(s:tmp, [[0x1F6A3,0x1F6A3,'EB'],[0x1F6A4,0x1F6B3,'ID'],[0x1F6B4,0x1F6B6,'EB']]) +call extend(s:tmp, [[0x1F6B7,0x1F6BF,'ID'],[0x1F6C0,0x1F6C0,'EB'],[0x1F6C1,0x1F6FF,'ID']]) +call extend(s:tmp, [[0x1F700,0x1F773,'AL'],[0x1F774,0x1F77F,'ID'],[0x1F780,0x1F7D4,'AL']]) +call extend(s:tmp, [[0x1F7D5,0x1F7FF,'ID'],[0x1F800,0x1F80B,'AL'],[0x1F80C,0x1F80F,'ID']]) +call extend(s:tmp, [[0x1F810,0x1F847,'AL'],[0x1F848,0x1F84F,'ID'],[0x1F850,0x1F859,'AL']]) +call extend(s:tmp, [[0x1F85A,0x1F85F,'ID'],[0x1F860,0x1F887,'AL'],[0x1F888,0x1F88F,'ID']]) +call extend(s:tmp, [[0x1F890,0x1F8AD,'AL'],[0x1F8AE,0x1F917,'ID'],[0x1F918,0x1F91E,'EB']]) +call extend(s:tmp, [[0x1F91F,0x1F925,'ID'],[0x1F926,0x1F926,'EB'],[0x1F927,0x1F92F,'ID']]) +call extend(s:tmp, [[0x1F930,0x1F930,'EB'],[0x1F931,0x1F932,'ID'],[0x1F933,0x1F939,'EB']]) +call extend(s:tmp, [[0x1F93A,0x1F93B,'ID'],[0x1F93C,0x1F93E,'EB'],[0x1F93F,0x1FFFD,'ID']]) +call extend(s:tmp, [[0x20000,0x2FFFD,'ID'],[0x30000,0x3FFFD,'ID'],[0xE0001,0xE0001,'CM']]) +call extend(s:tmp, [[0xE0020,0xE007F,'CM'],[0xE0100,0xE01EF,'CM'],[0xF0000,0xFFFFD,'XX']]) +call extend(s:tmp, [[0x100000,0x10FFFD,'XX']]) +let s:lib.linebreak_table = s:tmp +unlet s:tmp + +let s:tmp = [] +call add(s:tmp, ['CM','CM','CM','CM','CM','CM','CM','CM','CM','BA','LF','BK','BK','CR','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','SP','EX','QU','AL','PR','PO','AL','QU','OP','CP','AL','PR','IS','HY','IS','SY','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','IS','IS','AL','AL','AL','EX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','PR','CP','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','BA','CL','AL','CM','CM','CM','CM','CM','CM','NL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','GL','OP','PO','PR','PR','PR','AL','AI','AI','AL','AI','QU','AL','BA','AL','AL','PO','PR','AI','AI','BB','AL','AI','AI','AI','AI','AI','QU','AI','AI','AI','OP','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','BB','AI','AI','AI','BB','AI','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AI','AI','AI','AI','AL','AI','AL','BB','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','GL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','GL','GL','GL','GL','GL','GL','GL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','IS','AL','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','IS','BA','XX','XX','AL','AL','PR','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','BA','CM','AL','CM','CM','AL','CM','CM','EX','CM','XX','XX','XX','XX','XX','XX','XX','XX','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','XX','XX','XX','XX','XX','HL','HL','HL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','PO','PO','PO','IS','IS','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','EX','CM','XX','EX','EX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','PO','NU','NU','AL','AL','AL','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','EX','AL','CM','CM','CM','CM','CM','CM','CM','AL','AL','CM','CM','CM','CM','CM','CM','AL','AL','CM','CM','AL','CM','CM','CM','CM','AL','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','IS','EX','AL','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','CM','CM','CM','AL','CM','CM','CM','CM','CM','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','XX','XX','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM']) +call add(s:tmp, ['CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','BA','BA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','XX','XX','AL','AL','AL','AL','XX','XX','CM','AL','CM','CM','CM','CM','CM','CM','CM','XX','XX','CM','CM','XX','XX','CM','CM','CM','AL','XX','XX','XX','XX','XX','XX','XX','XX','CM','XX','XX','XX','XX','AL','AL','XX','AL','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','PO','PO','AL','AL','AL','AL','AL','PO','AL','PR','XX','XX','XX','XX']) +call add(s:tmp, ['XX','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','XX','AL','AL','XX','AL','AL','XX','XX','CM','XX','CM','CM','CM','CM','CM','XX','XX','XX','XX','CM','CM','XX','XX','CM','CM','CM','XX','XX','XX','CM','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','XX','AL','XX','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','CM','CM','AL','AL','AL','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','XX','AL','AL','AL','AL','AL','XX','XX','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','XX','CM','CM','CM','XX','CM','CM','CM','XX','XX','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','PR','XX','XX','XX','XX','XX','XX','XX','AL','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['XX','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','XX','AL','AL','AL','AL','AL','XX','XX','CM','AL','CM','CM','CM','CM','CM','CM','CM','XX','XX','CM','CM','XX','XX','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','XX','XX','XX','XX','AL','AL','XX','AL','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CM','AL','XX','AL','AL','AL','AL','AL','AL','XX','XX','XX','AL','AL','AL','XX','AL','AL','AL','AL','XX','XX','XX','AL','AL','XX','AL','XX','AL','AL','XX','XX','XX','AL','AL','XX','XX','XX','AL','AL','AL','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','CM','CM','CM','CM','CM','XX','XX','XX','CM','CM','CM','XX','CM','CM','CM','CM','XX','XX','AL','XX','XX','XX','XX','XX','XX','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','PR','AL','XX','XX','XX','XX','XX']) +call add(s:tmp, ['CM','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','AL','CM','CM','CM','CM','CM','CM','CM','XX','CM','CM','CM','XX','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','CM','CM','XX','AL','AL','AL','XX','XX','XX','XX','XX','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','XX','XX','CM','AL','CM','CM','CM','CM','CM','CM','CM','XX','CM','CM','CM','XX','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','CM','CM','XX','XX','XX','XX','XX','XX','XX','AL','XX','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['XX','CM','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','CM','CM','CM','CM','CM','CM','CM','XX','CM','CM','CM','XX','CM','CM','CM','CM','AL','AL','XX','XX','XX','XX','AL','AL','AL','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','PO','AL','AL','AL','AL','AL','AL','XX','XX','CM','CM','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','CM','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','XX','CM','XX','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','CM','CM','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','XX','XX','PR','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','BA','BA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','SA','SA','XX','SA','XX','XX','SA','SA','XX','SA','XX','XX','SA','XX','XX','XX','XX','XX','XX','SA','SA','SA','SA','XX','SA','SA','SA','SA','SA','SA','SA','XX','SA','SA','SA','XX','SA','XX','SA','XX','XX','SA','SA','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','SA','SA','SA','XX','XX','SA','SA','SA','SA','SA','XX','SA','XX','SA','SA','SA','SA','SA','SA','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','SA','SA','SA','SA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','BB','BB','BB','BB','AL','BB','BB','GL','BB','BB','BA','GL','EX','EX','EX','EX','EX','GL','AL','EX','AL','AL','AL','CM','CM','AL','AL','AL','AL','AL','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','CM','AL','CM','AL','CM','OP','CL','OP','CL','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','BA','CM','CM','CM','CM','CM','BA','CM','CM','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','BA','BA','AL','AL','AL','AL','AL','AL','CM','AL','AL','AL','AL','AL','AL','XX','AL','AL','BB','BB','BA','BB','AL','AL','AL','AL','AL','GL','GL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','BA','BA','AL','AL','AL','AL','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','SA','SA','SA','SA','SA','SA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','XX','XX','XX','XX','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','CM','CM','CM','AL','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','XX']) +call add(s:tmp, ['BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','BA','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','BA','BA','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','XX','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','BA','BA','NS','SA','BA','AL','BA','PR','SA','SA','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','EX','EX','BA','BA','BB','AL','EX','EX','AL','CM','CM','CM','GL','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','AL','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','AL','XX','XX','XX','EX','EX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','SA','SA','SA','SA','SA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','XX','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','SA','XX','XX','XX','SA','SA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','XX','XX','AL','AL','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','CM','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','BA','BA','AL','BA','BA','BA','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','BA','BA','BA','BA','BA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','AL','AL','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','CM','AL','AL','AL','AL','CM','CM','CM','AL','AL','XX','CM','CM','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','CM','CM','CM','CM','CM']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','AL','XX','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','BB','AL','XX']) +call add(s:tmp, ['BA','BA','BA','BA','BA','BA','BA','GL','BA','BA','BA','ZW','CM','ZWJ','CM','CM','BA','GL','BA','BA','B2','AI','AI','AL','QU','QU','OP','QU','QU','QU','OP','QU','AI','AI','AL','AL','IN','IN','IN','BA','BK','BK','CM','CM','CM','CM','CM','GL','PO','PO','PO','PO','PO','PO','PO','PO','AL','QU','QU','AI','NS','NS','AL','AL','AL','AL','AL','AL','IS','OP','CL','NS','NS','NS','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','AL','BA','BA','BA','BA','AL','BA','BA','BA','WJ','AL','AL','AL','AL','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','XX','XX','AI','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','AI','AL','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','PR','PR','PR','PR','PR','PR','PR','PO','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PO','PR','PR','PR','PR','PO','PR','PR','PO','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','PR','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','PO','AL','AI','AL','AL','AL','PO','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','PR','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AL','AL','AL','AI','AL','AL','AI','AL','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','XX','XX','XX','XX','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AI','AL','AI','AI','AL','AL','AL','AI','AI','AL','AL','AI','AL','AL','AL','AI','AL','AI','PR','PR','AL','AI','AL','AL','AL','AL','AI','AL','AL','AI','AI','AI','AI','AL','AL','AI','AL','AI','AL','AI','AI','AI','AI','AI','AI','AL','AI','AL','AL','AL','AL','AL','AI','AI','AI','AI','AL','AL','AL','AL','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AI','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AI','AI','AI','AI','AL','AL','AI','AI','AL','AL','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','IN','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','OP','CL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','ID','ID','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','ID','ID','ID','ID','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL']) +call add(s:tmp, ['AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AI','AI','AL','AL','AL','AL','AI','AI','AL','AL','AI','AI','AL','AL','AL','AL','AI','AI','AI','AL','AL','AI','AL','AL','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['ID','ID','ID','ID','AL','AI','AI','AL','AL','AI','AL','AL','AL','AL','AI','AI','AL','AL','AL','AL','ID','ID','AI','AI','ID','AL','ID','ID','ID','EB','ID','ID','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','ID','ID','ID','AL','AL','AL','AL','AI','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AI','AI','AI','AL','AI','ID','AI','AI','AL','AI','AI','AL','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','ID','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','AI','AI','AI','AI','ID','AL','ID','ID','ID','AI','ID','ID','AI','AI','AI','ID','ID','AI','AI','ID','AI','AI','ID','ID','ID','AL','AI','AL','AL','AL','AL','AI','AI','ID','AI','AI','AI','AI','AI','AI','ID','ID','ID','ID','ID','AI','ID','ID','EB','ID','AI','AI','ID','ID','ID']) +call add(s:tmp, ['ID','ID','ID','ID','ID','AL','AL','AL','ID','ID','EB','EB','EB','EB','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AL','AL','AL','QU','QU','QU','QU','QU','QU','AL','EX','EX','ID','AL','AL','AL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','OP','CL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','OP','CL','AL','AL']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AI','AI','AI','AI','AI','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','AL','AL','XX','XX','XX','XX','XX','EX','BA','BA','BA','AL','EX','BA']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','XX','XX','XX','XX','XX','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','AL','BA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM']) +call add(s:tmp, ['QU','QU','QU','QU','QU','QU','QU','QU','QU','QU','QU','QU','QU','QU','BA','BA','BA','BA','BA','BA','BA','BA','AL','BA','OP','BA','AL','AL','QU','QU','AL','AL','QU','QU','OP','CL','OP','CL','OP','CL','OP','CL','BA','BA','BA','BA','EX','AL','BA','BA','AL','BA','BA','AL','AL','AL','AL','AL','B2','B2','BA','BA','BA','AL','BA','BA','OP','BA','BA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX']) +call add(s:tmp, ['BA','CL','CL','ID','ID','NS','ID','ID','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','ID','ID','OP','CL','OP','CL','OP','CL','OP','CL','NS','OP','CL','CL','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','CM','CM','CM','CM','CM','CM','ID','ID','ID','ID','ID','CM','ID','ID','ID','ID','ID','NS','NS','ID','ID','ID','XX','CJ','ID','CJ','ID','CJ','ID','CJ','ID','CJ','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','CJ','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','CJ','ID','CJ','ID','CJ','ID','ID','ID','ID','ID','ID','CJ','ID','ID','ID','ID','ID','ID','CJ','CJ','XX','XX','CM','CM','NS','NS','NS','NS','ID','NS','CJ','ID','CJ','ID','CJ','ID','CJ','ID','CJ','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','CJ','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','CJ','ID','CJ','ID','CJ','ID','ID','ID','ID','ID','ID','CJ','ID','ID','ID','ID','ID','ID','CJ','CJ','ID','ID','ID','ID','NS','CJ','NS','NS','ID']) +call add(s:tmp, ['XX','XX','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ']) +call add(s:tmp, ['ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','AI','AI','AI','AI','AI','AI','AI','AI','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','NS','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','BA']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BA','EX','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','AL','BA','BA','BA','BA','BA','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL','AL','CM','AL','AL','AL','CM','AL','AL','AL','AL','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','AL','AL','AL','AL','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','PO','AL','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BB','BB','EX','EX','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','BA','BA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','BB','AL','XX','XX']) +call add(s:tmp, ['NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','BA','BA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','JL','XX','XX','XX','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','AL','AL','AL','AL','AL','AL','BA','BA','BA','AL','AL','AL','AL','XX','AL','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','AL','AL','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','SA','SA','SA','SA','SA','XX']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','CM','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','AL','BA','BA','BA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','SA','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','SA','SA','SA','SA','SA','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','BA','BA','AL','AL','AL','CM','CM','XX','XX','XX','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['XX','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CM','CM','CM','CM','CM','CM','CM','CM','BA','CM','CM','XX','XX','NU','NU','NU','NU','NU','NU','NU','NU','NU','NU','XX','XX','XX','XX','XX','XX']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3']) +call add(s:tmp, ['H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3']) +call add(s:tmp, ['H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H2','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','H3','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','JV','XX','XX','XX','XX','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','JT','XX','XX','XX','XX']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['SG']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['XX']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['ID']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','HL','CM','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','AL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','XX','HL','HL','HL','HL','HL','XX','HL','XX','HL','HL','XX','HL','HL','XX','HL','HL','HL','HL','HL','HL','HL','HL','HL','HL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL']) +call add(s:tmp, ['AL']) +call add(s:tmp, ['AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','CL','OP','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','PO','AL','XX','XX']) +call add(s:tmp, ['CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','IS','CL','CL','IS','IS','EX','EX','OP','CL','IN','XX','XX','XX','XX','XX','XX','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','CM','ID','ID','ID','ID','ID','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','OP','CL','ID','ID','OP','CL','ID','ID','ID','ID','ID','ID','ID','CL','ID','CL','XX','NS','NS','EX','EX','ID','OP','CL','OP','CL','OP','CL','ID','ID','ID','ID','ID','ID','ID','ID','XX','ID','PR','PO','ID','XX','XX','XX','XX','AL','AL','AL','AL','AL','XX','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','AL','XX','XX','WJ']) +call add(s:tmp, ['XX','EX','ID','ID','PR','PO','ID','ID','OP','CL','ID','ID','CL','ID','CL','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','NS','NS','ID','ID','ID','EX','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','OP','ID','CL','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','OP','ID','CL','ID','OP','CL','CL','OP','CL','CL','NS','ID','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','CJ','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','NS','NS','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','ID','XX','XX','XX','ID','ID','ID','ID','ID','ID','XX','XX','ID','ID','ID','ID','ID','ID','XX','XX','ID','ID','ID','ID','ID','ID','XX','XX','ID','ID','ID','XX','XX','XX','PO','PR','ID','ID','ID','PR','PR','XX','AL','AL','AL','AL','AL','AL','AL','XX','XX','XX','XX','XX','XX','XX','XX','XX','XX','CM','CM','CM','CB','AI','XX','XX']) +let s:lib.linebreak_bmp = s:tmp +unlet s:tmp + +let &cpo = s:cpo_save + diff --git a/plugins/autofmt/doc/autofmt.txt b/plugins/autofmt/doc/autofmt.txt new file mode 100644 index 0000000000..bd0dcd8160 --- /dev/null +++ b/plugins/autofmt/doc/autofmt.txt @@ -0,0 +1,85 @@ +*autofmt.txt* Text Formatting Plugin + +Maintainer: Yukihiro Nakadaira +License: public domain + + +This is a 'formatexpr' plugin. + +1. Usage |autofmt-usage| +2. Language |autofmt-language| +3. Customize Unicode Line Break Property |autofmt-customize| + +{only works when 'encoding' is utf-8 or |+iconv| is enabled} + +============================================================================== +1. Usage *autofmt-usage* +> + :set runtimepath+=/path/to/autofmt/ + :set formatexpr=autofmt#compat#formatexpr() + +Following method can be used: + + autofmt#compat#formatexpr(): Vim compatible + autofmt#uax14#formatexpr(): Implementation of UAX #14 + autofmt#japanese#formatexpr(): Japanese + +UAX #14: Line Breaking Properties: http://unicode.org/reports/tr14/. + +============================================================================== +2. Language *autofmt-language* + +If you want to create your 'formatexpr' plugin, autofmt can be used as +framework. You can define your language specific formatting easily. +For example: > + + set formatexpr=myfmt.formatexpr() + + let s:compat = autofmt#compat#import() + + let myfmt = {} + call extend(myfmt, s:compat) + + function! myfmt.check_boundary(lst, i) + if a:lst[a:i].c == "x" + " It is possible to break a line before 'x'. + return "allow_break" + elseif a:lst[a:i].c == "y" + " It is impossible to break a line before 'y'. + return "no_break" + else + " Use default behavior. + return call(s:compat.check_boundary, [a:lst, a:i], self) + endif + endfunction +< +============================================================================== +3. Customize Unicode Line Break Property *autofmt-customize* + +uax14.vim is Pair Table-Based implementation of UAX #14. It uses Unicode Line +Break Property. But it is not useful for all language. You can customize it +for your language. +For example, line break is not allowed before LEFT DOUBLE QUOTATION MARK +(U+201C) without space. To change its behavior as Open Punctuation (e.g. "(", +"{", etc...): +> + " Use uax14 + set formatexpr=autofmt#uax14#formatexpr() + + " Customize Line Break Property + let s:unicode = unicode#import() + let s:orig_prop_line_break = s:unicode.prop_line_break + function! s:unicode.prop_line_break(char) + if a:char == "\u201c" || a:char == "\u2018" + return "OP" " Open Punctuation + elseif a:char == "\u201d" || a:char == "\u2019" + return "CL" " Close Punctuation + endif + return call(s:orig_prop_line_break, [a:char], self) + endfunction +< +Add this code in your vimrc. + +See http://unicode.org/reports/tr14/ for more information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/autofmt/doc/tags b/plugins/autofmt/doc/tags new file mode 100644 index 0000000000..4a8d080681 --- /dev/null +++ b/plugins/autofmt/doc/tags @@ -0,0 +1,4 @@ +autofmt-customize autofmt.txt /*autofmt-customize* +autofmt-language autofmt.txt /*autofmt-language* +autofmt-usage autofmt.txt /*autofmt-usage* +autofmt.txt autofmt.txt /*autofmt.txt* diff --git a/plugins/autofmt/memo.txt b/plugins/autofmt/memo.txt new file mode 100644 index 0000000000..31e00d0eca --- /dev/null +++ b/plugins/autofmt/memo.txt @@ -0,0 +1,222 @@ + +UAX #11: East Asian Width +http://unicode.org/reports/tr11/ + +UAX #14: Line Breaking Properties +http://unicode.org/reports/tr14/ + +Word wrap - Wikipedia +http://en.wikipedia.org/wiki/Word_wrap + +Requirements for Japanese Text Layout +https://www.w3.org/TR/jlreq/ +日本語組版処理の要件 +https://www.w3.org/TR/jlreq/ja/ +Mainly based on JIS X 4051 + +JISC 日本工業標準調査会 +http://www.jisc.go.jp/ +JIS X 4051 - Wikipedia +http://ja.wikipedia.org/wiki/JIS_X_4051 + +JIS X 4051 日本語文書の組版方法 (Formatting rules for Japanese documents) + +4.3 行頭禁則処理 + 終わり括弧類、行頭禁止和字、ハイフン類、区切り約物、中点類及び句点類 + が、行頭又は割注行頭にきてはならない。 +4.4 行末禁則処理 + 始め括弧類が行末又は割注行末にきてはならない。 +4.5 分離禁止処理 + 4.5.1 分割禁止 + 分離禁止文字の組を構成する文字間では、分割してはならない。ただし、 + 連数字と欧文間隔以外の欧文用文字との間を分割可とするか否かは、処理 + 系定義とする。 + 4.5.2 分離禁止 + 延ばし処理によって行を調整する場合も、分離禁止文字の組を構成するも + 時間には延ばし処理による空き量を入れてはならない。ただし、連数字と + 欧文間隔以外の欧文用文字との間を延ばし可とするか否かは、処理系定義 + とする。 + +(付属書1より) 文字クラス + 名前 (JIS X 0213 面区点番号) +(1) 始め括弧類 + LEFT PARENTHESIS (1-1-42) + LEFT SQUARE BRACKET (1-1-46) + LEFT CURLY BRACKET (1-1-48) + LEFT TORTOISE SHELL BRACKET (1-1-44) + LEFT ANGLE BRACKET (1-1-50) + LEFT DOUBLE ANGLE BRACKET (1-1-52) + LEFT CORNER BRACKET (1-1-54) + LEFT WHITE CORNER BRACKET (1-1-56) + LEFT BLACK LENTICULAR BRACKET (1-1-58) + LEFT WHITE TORTOISE SHELL BRACKET (1-2-56) + LEFT WHITE LENTICULAR BRACKET (1-2-58) + REVERSED DOUBLE PRIME QUOTATION (1-13-64) + LEFT SINGLE QUOTATION MARK (1-1-38) + LEFT DOUBLE QUOTATION MARK (1-1-40) + LEFT WHITE PARENTHESIS (1-2-54) + LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (1-9-8) +(2) 終わり括弧類 + COMMA (1-1-4) + RIGHT PARENTHESIS (1-1-43) + RIGHT SQUARE BRACKET (1-1-47) + RIGHT CURLY BRACKET (1-1-49) + IDEOGRAPHIC COMMA (1-1-2) + RIGHT TORTOISE SHELL BRACKET (1-1-45) + RIGHT ANGLE BRACKET (1-1-51) + RIGHT DOUBLE ANGLE BRACKET (1-1-53) + RIGHT CORNER BRACKET (1-1-55) + RIGHT WHITE CORNER BRACKET (1-1-57) + RIGHT BLACK LENTICULAR BRACKET (1-1-59) + RIGHT WHITE TORTOISE SHELL BRACKET (1-2-57) + RIGHT WHITE LENTICULAR BRACKET (1-2-59) + LOW DOUBLE PRIME QUOTATION MARK (1-13-65) + RIGHT SINGLE QUOTATION MARK (1-1-39) + RIGHT DOUBLE QUOTATION MARK (1-1-41) + RIGHT WHITE PARENTHESIS (1-2-55) + RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (1-9-18) +(3) 行頭禁則和字 + KATAKANA ITERATION MARK (1-1-19) + KATAKANA VOICED ITERATION MARK (1-1-20) + KATAKANA-HIRAGANA PROLONGED SOUND MARK (1-1-28) + KATAKANA LETTER SMALL A (1-5-1) + KATAKANA LETTER SMALL I (1-5-3) + KATAKANA LETTER SMALL U (1-5-5) + KATAKANA LETTER SMALL O (1-5-7) + KATAKANA LETTER SMALL TU (1-5-35) + KATAKANA LETTER SMALL YA (1-5-67) + KATAKANA LETTER SMALL YU (1-5-69) + KATAKANA LETTER SMALL YO (1-5-71) + KATAKANA LETTER SMALL WA (1-5-78) + KATAKANA LETTER SMALL WA (1-5-85) + KATAKANA LETTER SMALL KE (1-5-86) + HIRAGANA ITERATION MARK (1-1-21) + HIRAGANA VOICED ITERATION MARK (1-1-22) + HIRAGANA LETTER SMALL A (1-4-1) + HIRAGANA LETTER SMALL I (1-4-3) + HIRAGANA LETTER SMALL U (1-4-5) + HIRAGANA LETTER SMALL E (1-4-7) + HIRAGANA LETTER SMALL O (1-4-9) + HIRAGANA LETTER SMALL TU (1-4-35) + HIRAGANA LETTER SMALL YA (1-4-67) + HIRAGANA LETTER SMALL YU (1-4-69) + HIRAGANA LETTER SMALL YO (1-4-71) + HIRAGANA LETTER SMALL WA (1-4-78) + HIRAGANA LETTER SMALL KA (1-4-85) + HIRAGANA LETTER SMALL KE (1-4-86) + KATAKANA LETTER AINU K (1-6-78) [コード不明] + KATAKANA LETTER AINU SI(S) (1-6-79) [コード不明] + KATAKANA LETTER AINU SU(S) (1-6-80) [コード不明] + KATAKANA LETTER AINU T (1-6-81) [コード不明] + KATAKANA LETTER AINU N (1-6-82) [コード不明] + KATAKANA LETTER AINU AX (1-6-83) [コード不明] + KATAKANA LETTER AINU IX (1-6-84) [コード不明] + KATAKANA LETTER AINU UX (1-6-85) [コード不明] + KATAKANA LETTER AINU EX (1-6-86) [コード不明] + KATAKANA LETTER AINU OX (1-6-87) [コード不明] + KATAKANA LETTER AINU M (1-6-89) [コード不明] + KATAKANA LETTER AINU AR (1-6-90) [コード不明] + KATAKANA LETTER AINU IR (1-6-91) [コード不明] + KATAKANA LETTER AINU UR (1-6-92) [コード不明] + KATAKANA LETTER AINU ER (1-6-93) [コード不明] + KATAKANA LETTER AINU OR (1-6-94) [コード不明] + IDEOGRAPHIC ITERATION MARK (1-1-25) + ITERATION MARK (1-2-22) [コード不明] +(4) ハイフン類 + HYPHEN (1-1-30) + DOUBLE HYPHEN (1-3-91) + EN DASH (1-3-92) + WAVE DASH (1-1-33) +(5) 区切り約物 + QUESTION MARK (1-1-9) + EXCLAMATION MARK (1-1-10) + DOUBLE EXCLAMATION MARK (1-8-75) + DOUBLE QUESTION MARK (1-8-76) + QUESTION EXCLAMATION MARK (1-8-77) + EXCLAMATION QUESTION MARK (1-8-78) +(6) 中点類 + KATAKANA MIDDLE DOT (1-1-6) + COLON (1-1-7) + SEMICOLON (1-1-8) +(7) 句点類 + IDEOGRAPHIC FULL STOP (1-1-3) + FULL STOP (1-1-5) +(8) 分離禁止文字 + EM DASH (1-1-29) + HORIZONTAL ELLIPSIS (1-1-36) + TWO DOT LEADER (1-1-37) + VERTICAL KANA REPEAT MARK UPPER HALF (1-2-19) + VERTICAL KANA REPEAT WITH VOICED SOUND MARK UPPER HALF (1-2-20) + VERTICAL KANA REPEAT MARK LOWER HALF (1-2-21) +(9) 前置省略記号 + YEN SIGN (1-1-79) + POUND SIGN (1-1-82) + DOLLAR SIGN (1-1-80) + NUMBER SIGN (1-1-84) + EURO SIGN (1-9-1) + NUMERO SIGN (1-13-66) +(10) 後置省略記号 + DEGREE SIGN (1-1-75) + CENT SIGN (1-1-81) + PRIME (1-1-76) + DOUBLE PRIME (1-1-77) + PER MILLE SIGN (1-2-83) + DEGREE CELSIUS (1-1-78) + SCRIPT SMALL L (1-3-63) + PERCENT SIGN (1-1-83) + SQUARE HP (1-3-62) +(11) 和字間隔 + IDEOGRAPHIC SPACE (1-1-1) +(12) 平仮名 + 1-4-2~1-4-91 (ただし、行頭禁則和字に含まれる文字を除く。) +(13) (1)~(12) 以外の和字 + 1-1-23, 1-1-24, 1-1-26, 1-1-27, 1-1-31, 1-1-32, 1-1-34, + 1-1-35, 1-1-60~1-1-74, 1-1-85~1-2-14, 1-2-23~1-2-53, + 1-2-60~1-2-62, 1-2-65~1-2-81, 1-2-84~1-3-15, 1-3-26~1-3-32, + 1-3-59, 1-3-93, 1-3-94, 1-5-1~1-5-94 (ただし、行頭禁則和字に含まれる文字を除く。), + 1-6-25~1-6-32, 1-6-58~1-6-77, 1-6-88, 1-7-82~1-7-94, + 1-8-33~1-8-62, 1-8-71~1-8-74, 1-9-6, 1-9-10, 1-9-19~1-9-21, + 1-12-1~1-12-83, 1-12-93~1-13-55, 1-13-63, 1-13-67~1-13-79, + 1-13-83, 1-13-88, 1-13-89, 1-13-93, 1-13-94, 1-14-2~1-15-93, + 1-16-1~1-94-89, 2-1-1~2-1-94, 2-3-1~2-5-94, 2-8-1~2-8-94, + 2-12-1~2-15-94, 2-78-1~2-94-86 +(14) 合印中の文字 +(15) 添え字付き親文字群中の文字 +(16) 熟語ルビ以外のルビ付き親文字群中の文字 +(17) 熟語ルビ付き親文字郡中の文字 +(18) 連数字中の文字 + 2/0 (位取りの空白) (JIS X 0201 の 2 列 0 行の空白 (SPACE)) + 1-1-4 (位取りのコンマ) + 1-1-5 (小数点) + 1-3-16~1-3-25 (数字) +(19) 単位記号中の文字 + 2/0 (空白) + 1-1-6 (中点) + 1-1-31 (斜線) (単位記号中に使用する 1-1-31 (斜線の字幅は、半角とする。) + 1-1-42 (始め小括弧) + 1-1-43 (終わり小括弧) + 1-1-61 (負符号) + 1-2-82 + 1-3-17~1-3-20 (数字) + 1-3-33~1-3-58, 1-3-64~1-3-90, 1-6-24, 1-6-44 +(20) 欧文間隔 + 2/0 (SPACE) +(21) 欧文間隔以外の欧文用文字 + 1-1-4, 1-1-5, 1-1-7~1-1-10, 1-1-13~1-1-18, 1-1-29, 1-1-31, + 1-1-32, 1-1-34~1-1-43, 1-1-46~1-1-49, 1-1-60~1-1-77, + 1-1-79~1-2-7, 1-2-10~1-2-13, 1-2-15~1-2-18, 1-2-26~1-2-53, + 1-1-79~1-2-7, 1-2-10~1-2-13, 1-2-15~1-2-18, 1-2-26~1-2-53, + 1-2-60~1-3-25, 1-3-31~1-3-61, 1-3-64~1-3-90, 1-3-92, 1-6-1~1-6-67, + 1-6-71~1-6-75, 1-6-77, 1-7-1~1-7-33, 1-7-49~1-7-81, + 1-7-86~1-7-94, 1-8-33~1-8-62, 1-8-71~1-8-74, 1-8-79~1-8-92, + 1-9-1~1-12-20, 1-12-33~1-12-58, 1-12-93~1-13-20, + 1-13-83, 1-13-88, 1-13-89, 1-13-93, 1-13-94 +(22) 割注始め括弧類 + LEFT PARENTHESIS (1-1-42) + LEFT SQUARE BRACKET (1-1-46) + LEFT TORTOISE SHELL BRACKET (1-1-44) +(23) 割注終わり括弧類 + RIGHT PARENTHESIS (1-1-43) + RIGHT SQUARE BRACKET (1-1-47) + RIGHT TORTOISE SHELL BRACKET (1-1-45) + diff --git a/plugins/autofmt/test/Makefile b/plugins/autofmt/test/Makefile new file mode 100644 index 0000000000..6f52c5eb71 --- /dev/null +++ b/plugins/autofmt/test/Makefile @@ -0,0 +1,36 @@ +VIMPROG = vim + +SCRIPTS := $(patsubst %.ok, %.out, $(wildcard *.ok)) + +.SUFFIXES: .in .out + +all: nolog $(SCRIPTS) report + +report: + @echo + @echo 'Test results:' + @/bin/sh -c "if test -f test.log; \ + then cat test.log; echo TEST FAILURE; exit 1; \ + else echo ALL DONE; \ + fi" + +clean: + -rm -rf *.out *.failed test.log test.ok X* debug.log + +.in.out: + -rm -rf $*.failed test.ok test.out X* + cp $*.ok test.ok + # Sleep a moment to avoid that the xterm title is messed up + @-sleep .2 + -$(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in + @/bin/sh -c "if test -f test.out; then\ + if diff test.out $*.ok; \ + then mv -f test.out $*.out; \ + else echo $* FAILED >>test.log; mv -f test.out $*.failed; \ + fi \ + else echo $* NO OUTPUT >>test.log; \ + fi" + -rm -rf X* test.ok + +nolog: + -rm -f test.log diff --git a/plugins/autofmt/test/bug1.in b/plugins/autofmt/test/bug1.in new file mode 100644 index 0000000000..0f52edd1a3 --- /dev/null +++ b/plugins/autofmt/test/bug1.in @@ -0,0 +1,57 @@ +BUG: second line is not properly indented. + + +Results of bug1: + +STARTTEST +:set fo=cq tw=10 ai +/^{/+1 +:set formatexpr= +3gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +3gqgq +ENDTEST + +case1 +{ + aaaaa + bbbbb + ccccc +} +{ + aaaaa + bbbbb + ccccc +} + +STARTTEST +:set fo=cq tw=10 ai +/^{/+1 +:set formatexpr= +5gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +5gqgq +ENDTEST + +case2 +{ +/* + * aaaaa + * bbbbb + * ccccc + */ +} +{ +/* + * aaaaa + * bbbbb + * ccccc + */ +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/bug1.ok b/plugins/autofmt/test/bug1.ok new file mode 100644 index 0000000000..e8f2593785 --- /dev/null +++ b/plugins/autofmt/test/bug1.ok @@ -0,0 +1,32 @@ +Results of bug1: + + +case1 +{ + aaaaa + bbbbb + ccccc +} +{ + aaaaa + bbbbb + ccccc +} + + +case2 +{ +/* + * aaaaa + * bbbbb + * ccccc + */ +} +{ +/* + * aaaaa + * bbbbb + * ccccc + */ +} + diff --git a/plugins/autofmt/test/dotest.in b/plugins/autofmt/test/dotest.in new file mode 100644 index 0000000000..cd6822271b --- /dev/null +++ b/plugins/autofmt/test/dotest.in @@ -0,0 +1,4 @@ +:set cp +:map clean :set all& cp :source `=g:__vimrc` +:map dotest /^STARTTEST j:set ff=unix cpo-=A :.,/ENDTEST/-1w! Xdotest :set ff& cpo+=A nj0:so! Xdotest cleandotest +dotest diff --git a/plugins/autofmt/test/test1.in b/plugins/autofmt/test/test1.in new file mode 100644 index 0000000000..bc1331c3ff --- /dev/null +++ b/plugins/autofmt/test/test1.in @@ -0,0 +1,934 @@ +Test for compatible behavior. + +Results of test1: + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa +ENDTEST + +1254595097 +{ +aaaaa +} +{ +aaaaa +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbb +ENDTEST + +1254595115 +{ +aaaaa bbbb +} +{ +aaaaa bbbb +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbbb +ENDTEST + +1254595131 +{ +aaaaa bbbbb +} +{ +aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbbb  +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbbb  +ENDTEST + +1254595132 +{ +aaaaa bbbbb +} +{ +aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbbb ccccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbbb ccccc +ENDTEST + +1254595140 +{ +aaaaa bbbbb ccccc +} +{ +aaaaa bbbbb ccccc +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaaaaaaabbbbbbbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaaaaaaabbbbbbbbbb +ENDTEST + +1254595141 +{ +aaaaaaaaaabbbbbbbbbb +} +{ +aaaaaaaaaabbbbbbbbbb +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo + aaaaaaaaaabbbbbbbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo + aaaaaaaaaabbbbbbbbbb +ENDTEST + +1254595143 +{ + aaaaaaaaaabbbbbbbbbb +} +{ + aaaaaaaaaabbbbbbbbbb +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gq/^}/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/^}/ +ENDTEST + +1254595144 +{ +aaaa +bbbb +cccccccccccc +dddd +} +{ +aaaa +bbbb +cccccccccccc +dddd +} + +STARTTEST +:set tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbb +ENDTEST + +1254595145 +{ +aaaaa bbb +} +{ +aaaaa bbb +} + +STARTTEST +:set autoindent tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbbb +ENDTEST + +1254595146 +{ + aaaaa bbbbb +} +{ + aaaaa bbbbb +} + +STARTTEST +:set noautoindent tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqo + aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo + aaaaa bbbbb +ENDTEST + +1254595147 +{ + aaaaa bbbbb +} +{ + aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=2 +/^{/+1 +:set formatexpr= +gq/^}/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/^}/ +ENDTEST + +1254595148 +{ + aaaaa bbbbb +ccccc ddddd +} +{ + aaaaa bbbbb +ccccc ddddd +} + +STARTTEST +:set tw=10 fo= +/^{/+1 +:set formatexpr= +gqgqo +aaaa bbbb cccc dddd eeee ffff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaa bbbb cccc dddd eeee ffff +ENDTEST + +1254595150 +{ +aaaa bbbb cccc dddd eeee ffff +} +{ +aaaa bbbb cccc dddd eeee ffff +} + +STARTTEST +:set tw=10 fo= comments=:# +/^{/+1 +:set formatexpr= +gqgqo +# aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +# aaaaa bbbbb +ENDTEST + +1254595151 +{ +# aaaaa bbbbb +} +{ +# aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=q comments=:# +/^{/+1 +:set formatexpr= +gqgqo +# aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +# aaaaa bbbbb +ENDTEST + +1254595155 +{ +# aaaaa bbbbb +} +{ +# aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=c comments=:# +/^{/+1 +gqgqo +# aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +# aaaaa bbbbb +ENDTEST + +1254595156 +{ +# aaaaa bbbbb +} +{ +# aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqo +/* aaaaa bbbbb ccccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +/* aaaaa bbbbb ccccc +ENDTEST + +1254595157 +{ +/* aaaaa bbbbb ccccc +} +{ +/* aaaaa bbbbb ccccc +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gq/^}/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/^}/ +ENDTEST + +1254595158 +{ +/* aaa + * bbb + * ccc + * ddd + */ +} +{ +/* aaa + * bbb + * ccc + * ddd + */ +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gq/^}/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/^}/ +ENDTEST + +1254595159 +{ + + +aaa +aaa + +/* + * bbb + * bbb + * + * ccc + */ + +} +{ + + +aaa +aaa + +/* + * bbb + * bbb + * + * ccc + */ + +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gq/^}/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/^}/ +ENDTEST + +1254595160 +{ +/* aaaaa bbbbb +} +{ +/* aaaaa bbbbb +} + +STARTTEST +:set autoindent tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqoi + /* aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + /* aaaaa bbbbb +ENDTEST + +1254595162 +{ + /* aaaaa bbbbb +} +{ + /* aaaaa bbbbb +} + +STARTTEST +:set noautoindent tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqoi + /* aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + /* aaaaa bbbbb +ENDTEST + +1254595163 +{ + /* aaaaa bbbbb +} +{ + /* aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqjgqgqjgqgqoi +/* aaaaa bbbbb +i/* aaaaa bbbbb +i/* aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqjgqgqoi +/* aaaaa bbbbb +i/* aaaaa bbbbb +i/* aaaaa bbbbb +ENDTEST + +1254595164 +{ +/* aaaaa bbbbb +/* aaaaa bbbbb +/* aaaaa bbbbb +} +{ +/* aaaaa bbbbb +/* aaaaa bbbbb +/* aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqoi +/** aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi +/** aaaaa bbbbb +ENDTEST + +1254596280 +{ +/** aaaaa bbbbb +} +{ +/** aaaaa bbbbb +} + +STARTTEST +:set tw=10 fo=tn formatlistpat=^\\s*\\d\\+[\\].)}\\t\ ]\\s* +/^{/+1 +:set formatexpr= +gqgqo +1. aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1. aaaaa bbbbb +ENDTEST + +1254595165 +{ +1. aaaaa bbbbb +} +{ +1. aaaaa bbbbb +} + +STARTTEST +:set autoindent tw=10 fo=tn formatlistpat=^\\s*\\d\\+[\\].)}\\t\ ]\\s* +/^{/+1 +:set formatexpr= +gqgqoi + 1. aaa bbb ccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + 1. aaa bbb ccc +ENDTEST + +1254595166 +{ + 1. aaa bbb ccc +} +{ + 1. aaa bbb ccc +} + +STARTTEST +:set noautoindent tw=10 fo=tn formatlistpat=^\\s*\\d\\+[\\].)}\\t\ ]\\s* +/^{/+1 +:set formatexpr= +gqgqoi + 1. aaa bbb ccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + 1. aaa bbb ccc +ENDTEST + +1254595168 +{ + 1. aaa bbb ccc +} +{ + 1. aaa bbb ccc +} + +STARTTEST +:setl tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +ABC +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +ABC +ENDTEST + +1254595169 +{ +ABC +} +{ +ABC +} + +STARTTEST +:setl tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +ABCDE +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +ABCDE +ENDTEST + +1254595170 +{ +ABCDE +} +{ +ABCDE +} + +STARTTEST +:setl tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +ABCDEF +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +ABCDEF +ENDTEST + +1254595171 +{ +ABCDEF +} +{ +ABCDEF +} + +STARTTEST +:setl tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +aaaaa bbbbA +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aaaaa bbbbA +ENDTEST + +1254595172 +{ +aaaaa bbbbA +} +{ +aaaaa bbbbA +} + +STARTTEST +:setl tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqqgjgqgqo +ABCDEa +ABCDabc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +ABCDEa +ABCDabc +ENDTEST + +1254595173 +{ +ABCDEa +ABCDabc +} +{ +ABCDEa +ABCDabc +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +4liXXX +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +4liXXX +ENDTEST + +1254595175 +{ +ABCDEFGHIJKLMNO +} +{ +ABCDEFGHIJKLMNO +} + +STARTTEST +:set autoindent noexpandtab tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqoi + aaa bbb ccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + aaa bbb ccc +ENDTEST + +1254595176 +{ + aaa bbb ccc +} +{ + aaa bbb ccc +} + +STARTTEST +:set autoindent expandtab tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqoi + aaa bbb ccc +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi + aaa bbb ccc +ENDTEST + +1254595177 +{ + aaa bbb ccc +} +{ + aaa bbb ccc +} + +STARTTEST +:"MEMO: copyindent does not effect for gq operator. +:set autoindent noexpandtab copyindent tw=10 fo=t +/^{/+1 +:set formatexpr= +gqgqjgqgqjgqgqoi + aaa bbb +i  aaa bbb +i  aaa bbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqjgqgqoi + aaa bbb +i  aaa bbb +i  aaa bbb +ENDTEST + +1254595178 +{ + aaa bbb + aaa bbb + aaa bbb +} +{ + aaa bbb + aaa bbb + aaa bbb +} + +STARTTEST +:set autoindent noexpandtab copyindent tw=10 fo=c comments=fb:- +/^{/+1 +:set formatexpr= +i  - aaa bbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +i  - aaa bbb +ENDTEST + +1254595179 +{ + +} +{ + +} + +STARTTEST +:set autoindent tw=10 fo=c comments=fb3:- +/^{/+1 +:set formatexpr= +i- aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +i- aaaaa bbbbb +ENDTEST + +1257457620 +{ + +} +{ + +} + +STARTTEST +:set autoindent tw=10 fo=c comments=fb-1:- +/^{/+1 +:set formatexpr= +i- aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +i- aaaaa bbbbb +ENDTEST + +1257468164 +{ + +} +{ + +} + +STARTTEST +:set tw=10 fo=cqr comments=sr:/***,m:**,ex2:******/ +/^{/+1 +:set formatexpr= +3gqgq +/^{/+1 +4gqgq +/^{/+1 +i/*** aaa bbb +/ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +3gqgq +/^{/+1 +4gqgq +/^{/+1 +i/*** aaa bbb +/ +ENDTEST + +1257500340 +{ +/*** aaa + ** bbb + ******/ +} +{ +/*** + ** aaa + ** bbb + ******/ +} +{ + +} +{ +/*** aaa + ** bbb + ******/ +} +{ +/*** + ** aaa + ** bbb + ******/ +} +{ + +} + +STARTTEST +:set tw=10 fo=q comments=:# +/^{/+1 +:set formatexpr= +2gqgq +/^{/+1 +2gqgq +/^{/+1 +2gqgq +/^{/+1 +2gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +2gqgq +/^{/+1 +2gqgq +/^{/+1 +2gqgq +/^{/+1 +2gqgq +ENDTEST + +1257516766 +{ +# aaa +#bbb +} +{ +#aaa +# bbb +} +{ +# aaa +## bbb +} +{ +## aaa +# bbb +} +{ +# aaa +#bbb +} +{ +#aaa +# bbb +} +{ +# aaa +## bbb +} +{ +## aaa +# bbb +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test1.ok b/plugins/autofmt/test/test1.ok new file mode 100644 index 0000000000..a61eb5039f --- /dev/null +++ b/plugins/autofmt/test/test1.ok @@ -0,0 +1,737 @@ +Results of test1: + + +1254595097 +{ +aaaaa + +aaaaa +} +{ +aaaaa + +aaaaa +} + + +1254595115 +{ +aaaaa bbbb + +aaaaa bbbb +} +{ +aaaaa bbbb + +aaaaa bbbb +} + + +1254595131 +{ +aaaaa +bbbbb + +aaaaa +bbbbb +} +{ +aaaaa +bbbbb + +aaaaa +bbbbb +} + + +1254595132 +{ +aaaaa +bbbbb + +aaaaa +bbbbb +} +{ +aaaaa +bbbbb + +aaaaa +bbbbb +} + + +1254595140 +{ +aaaaa +bbbbb +ccccc + +aaaaa +bbbbb +ccccc +} +{ +aaaaa +bbbbb +ccccc + +aaaaa +bbbbb +ccccc +} + + +1254595141 +{ +aaaaaaaaaabbbbbbbbbb + +aaaaaaaaaabbbbbbbbbb +} +{ +aaaaaaaaaabbbbbbbbbb + +aaaaaaaaaabbbbbbbbbb +} + + +1254595143 +{ + aaaaaaaaaabbbbbbbbbb + + aaaaaaaaaabbbbbbbbbb +} +{ + aaaaaaaaaabbbbbbbbbb + + aaaaaaaaaabbbbbbbbbb +} + + +1254595144 +{ +aaaa bbbb +cccccccccccc +dddd +} +{ +aaaa bbbb +cccccccccccc +dddd +} + + +1254595145 +{ +aaaaa +bbb + +aaaaa +bbb +} +{ +aaaaa +bbb + +aaaaa +bbb +} + + +1254595146 +{ + aaaaa + bbbbb + + aaaaa + bbbbb +} +{ + aaaaa + bbbbb + + aaaaa + bbbbb +} + + +1254595147 +{ + aaaaa +bbbbb + + aaaaa +bbbbb +} +{ + aaaaa +bbbbb + + aaaaa +bbbbb +} + + +1254595148 +{ + aaaaa +bbbbb +ccccc +ddddd +} +{ + aaaaa +bbbbb +ccccc +ddddd +} + + +1254595150 +{ +aaaa bbbb +cccc dddd +eeee ffff + +aaaa bbbb cccc dddd eeee ffff +} +{ +aaaa bbbb +cccc dddd +eeee ffff + +aaaa bbbb cccc dddd eeee ffff +} + + +1254595151 +{ +# aaaaa +bbbbb + +# aaaaa bbbbb +} +{ +# aaaaa +bbbbb + +# aaaaa bbbbb +} + + +1254595155 +{ +# aaaaa +# bbbbb + +# aaaaa bbbbb +} +{ +# aaaaa +# bbbbb + +# aaaaa bbbbb +} + + +1254595156 +{ +# aaaaa +bbbbb + +# aaaaa +# bbbbb +} +{ +# aaaaa +bbbbb + +# aaaaa +# bbbbb +} + + +1254595157 +{ +/* aaaaa + * bbbbb + * ccccc + +/* aaaaa + * bbbbb + * ccccc +} +{ +/* aaaaa + * bbbbb + * ccccc + +/* aaaaa + * bbbbb + * ccccc +} + + +1254595158 +{ +/* aaa bbb + * ccc ddd + */ +} +{ +/* aaa bbb + * ccc ddd + */ +} + + +1254595159 +{ + + +aaa aaa + +/* + * bbb bbb + * + * ccc + */ + +} +{ + + +aaa aaa + +/* + * bbb bbb + * + * ccc + */ + +} + + +1254595160 +{ +/* aaaaa + * bbbbb +} +{ +/* aaaaa + * bbbbb +} + + +1254595162 +{ + /* aaaaa + * bbbbb + + /* aaaaa + * bbbbb +} +{ + /* aaaaa + * bbbbb + + /* aaaaa + * bbbbb +} + + +1254595163 +{ + /* aaaaa + * bbbbb + + /* aaaaa + * bbbbb +} +{ + /* aaaaa + * bbbbb + + /* aaaaa + * bbbbb +} + + +1254595164 +{ +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb + +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +} +{ +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb + +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +/* aaaaa + * bbbbb +} + + +1254596280 +{ +/** aaaaa + * bbbbb + +/** aaaaa + * bbbbb +} +{ +/** aaaaa + * bbbbb + +/** aaaaa + * bbbbb +} + + +1254595165 +{ +1. aaaaa + bbbbb + +1. aaaaa + bbbbb +} +{ +1. aaaaa + bbbbb + +1. aaaaa + bbbbb +} + + +1254595166 +{ + 1. aaa + bbb + ccc + + 1. aaa + bbb + ccc +} +{ + 1. aaa + bbb + ccc + + 1. aaa + bbb + ccc +} + + +1254595168 +{ + 1. aaa + bbb +ccc + + 1. aaa + bbb +ccc +} +{ + 1. aaa + bbb +ccc + + 1. aaa + bbb +ccc +} + + +1254595169 +{ +ABC + +ABC +} +{ +ABC + +ABC +} + + +1254595170 +{ +ABCDE + +ABCDE +} +{ +ABCDE + +ABCDE +} + + +1254595171 +{ +ABCDE +F + +ABCDE +F +} +{ +ABCDE +F + +ABCDE +F +} + + +1254595172 +{ +aaaaa bbbb +A + +aaaaa bbbb +A +} +{ +aaaaa bbbb +A + +aaaaa bbbb +A +} + + +1254595173 +{ +ABCDE +a +ABCD +abc + +ABCDE +a +ABCD +abc +} +{ +ABCDE +a +ABCD +abc + +ABCDE +a +ABCD +abc +} + + +1254595175 +{ +ABCDX +XXEFGHIJKLMNO +} +{ +ABCDX +XXEFGHIJKLMNO +} + + +1254595176 +{ + aaa + bbb + ccc + + aaa + bbb + ccc +} +{ + aaa + bbb + ccc + + aaa + bbb + ccc +} + + +1254595177 +{ + aaa + bbb + ccc + + aaa + bbb + ccc +} +{ + aaa + bbb + ccc + + aaa + bbb + ccc +} + + +1254595178 +{ + aaa + bbb + aaa + bbb + aaa + bbb + + aaa + bbb + aaa + bbb + aaa + bbb +} +{ + aaa + bbb + aaa + bbb + aaa + bbb + + aaa + bbb + aaa + bbb + aaa + bbb +} + + +1254595179 +{ + - aaa + bbb +} +{ + - aaa + bbb +} + + +1257457620 +{ +- aaaaa + bbbbb +} +{ +- aaaaa + bbbbb +} + + +1257468164 +{ +- aaaaa + bbbbb +} +{ +- aaaaa + bbbbb +} + + +1257500340 +{ +/*** aaa + ** bbb + ******/ +} +{ +/*** + ** aaa + ** bbb + ******/ +} +{ +/*** aaa + ** bbb + ******/ +} +{ +/*** aaa + ** bbb + ******/ +} +{ +/*** + ** aaa + ** bbb + ******/ +} +{ +/*** aaa + ** bbb + ******/ +} + + +1257516766 +{ +# aaa +#bbb +} +{ +#aaa bbb +} +{ +# aaa +## bbb +} +{ +## aaa bbb +} +{ +# aaa +#bbb +} +{ +#aaa bbb +} +{ +# aaa +## bbb +} +{ +## aaa bbb +} + diff --git a/plugins/autofmt/test/test10.in b/plugins/autofmt/test/test10.in new file mode 100644 index 0000000000..6e88637853 --- /dev/null +++ b/plugins/autofmt/test/test10.in @@ -0,0 +1,27 @@ +TODO: Test for comment. + +Results of test10: + +STARTTEST +:set tw=80 formatoptions=tcq comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" +/^{/+1 +2gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +2gqgq +ENDTEST + +case1 +{ +" hoge +" fuga +} +{ +" hoge +" fuga +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test10.ok b/plugins/autofmt/test/test10.ok new file mode 100644 index 0000000000..d014399daf --- /dev/null +++ b/plugins/autofmt/test/test10.ok @@ -0,0 +1,11 @@ +Results of test10: + + +case1 +{ +" hoge fuga +} +{ +" hoge fuga +} + diff --git a/plugins/autofmt/test/test2.in b/plugins/autofmt/test/test2.in new file mode 100644 index 0000000000..60369993a6 --- /dev/null +++ b/plugins/autofmt/test/test2.in @@ -0,0 +1,71 @@ +Test for incompatible and/or improved behavior. + +Results of test2: + +STARTTEST +:" don't split line at just after a listpat. +:set tw=10 fo=tn formatlistpat=^\\s*\\d\\+[\\].)}\\t\ ]\\s* +/^{/+1 +:set formatexpr= +gqgqo + 1. aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo + 1. aaaaa bbbbb +ENDTEST + +1254595216 +{ + 1. aaaaa bbbbb +} +{ + 1. aaaaa bbbbb +} + +STARTTEST +:" allow listpat in comment. +:set tw=10 fo=cqn formatlistpat=^\\s*\\d\\+[\\].)}\\t\ ]\\s* comments=:# +/^{/+1 +:set formatexpr= +gqgqo +# 1. aaa bbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +# 1. aaa bbb +ENDTEST + +1254595217 +{ +# 1. aaa bbb +} +{ +# 1. aaa bbb +} + +STARTTEST +:" " * */" -> " */" +:set tw=10 fo=cq comments=s1:/*,mb:*,ex:*/ +/^{/+1 +:set formatexpr= +gqgqo +/* aaaaa bbbbb ccccc */ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +/* aaaaa bbbbb ccccc */ +ENDTEST + +1254595219 +{ +/* aaaaa bbbbb ccccc */ +} +{ +/* aaaaa bbbbb ccccc */ +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test2.ok b/plugins/autofmt/test/test2.ok new file mode 100644 index 0000000000..a0a56c7588 --- /dev/null +++ b/plugins/autofmt/test/test2.ok @@ -0,0 +1,63 @@ +Results of test2: + + +1254595216 +{ + 1. +aaaaa +bbbbb + + 1. +aaaaa +bbbbb +} +{ + 1. aaaaa + bbbbb + + 1. aaaaa + bbbbb +} + + +1254595217 +{ +# 1. aaa +# bbb + +# 1. aaa +# bbb +} +{ +# 1. aaa +# bbb + +# 1. aaa +# bbb +} + + +1254595219 +{ +/* aaaaa + * bbbbb + * ccccc + * */ + +/* aaaaa + * bbbbb + * ccccc + * */ +} +{ +/* aaaaa + * bbbbb + * ccccc + */ + +/* aaaaa + * bbbbb + * ccccc + * */ +} + diff --git a/plugins/autofmt/test/test3.in b/plugins/autofmt/test/test3.in new file mode 100644 index 0000000000..69105f7553 --- /dev/null +++ b/plugins/autofmt/test/test3.in @@ -0,0 +1,162 @@ +Test for Japanese. + +Note: In the :source! script, you can not write some multi-byte +character which have 0x80 byte (e.g. U+3000 UTF8:E3 80 80). Use +u3000. 0x80 is a CSI byte and it is used to represent a special +key-code (e.g. ). To see how key-code and multi-byte character +are stored in the memory, use -w argument. + +Results of test3: + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +あいうえおu3002かきくけこ +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqo +あいうえおu3002かきくけこ +ENDTEST + +1254595249 +{ +あいうえお。かきくけこ +} +{ +あいうえお。かきくけこ +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +あいうえu3002u3002かきく +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqo +あいうえu3002u3002かきく +ENDTEST + +1254595243 +{ +あいうえ。。かきく +} +{ +あいうえ。。かきく +} + +STARTTEST +:set tw=2 fo=tm +/^{/+1 +:set formatexpr= +gqgqo + あu3002 +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqo + あu3002 +ENDTEST + +1254595244 +{ + あ。 +} +{ + あ。 +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +あいうえu300cお +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqo +あいうえu300cお +ENDTEST + +1254595245 +{ +あいうえ「お +} +{ +あいうえ「お +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +あああああu3002いいい +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +:let b:autofmt_allow_over_tw = 2 +gqgqo +あああああu3002いいい +:unlet b:autofmt_allow_over_tw +ENDTEST + +1254595246 +{ +あああああ。いいい +} +{ +あああああ。いいい +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqo +あああああu3002いいい +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +:let b:autofmt_allow_over_tw = 1 +gqgqo +あああああu3002いいい +:unlet b:autofmt_allow_over_tw +ENDTEST + +1254595248 +{ +あああああ。いいい +} +{ +あああああ。いいい +} + +STARTTEST +:set tw=10 fo=tm +/^{/+1 +:set formatexpr= +gqgqjgqgqo +あいうえu3002abcd +あいうえu3002u300d +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqjgqgqo +あいうえu3002abcd +あいうえu3002u300d +ENDTEST + +1295124892 +{ +あいうえ。abcd +あいうえ。」 +} +{ +あいうえ。abcd +あいうえ。」 +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test3.ok b/plugins/autofmt/test/test3.ok new file mode 100644 index 0000000000..97ea31a547 --- /dev/null +++ b/plugins/autofmt/test/test3.ok @@ -0,0 +1,133 @@ +Results of test3: + + +1254595249 +{ +あいうえお +。かきくけ +こ + +あいうえお +。かきくけ +こ +} +{ +あいうえ +お。かきく +けこ + +あいうえ +お。かきく +けこ +} + + +1254595243 +{ +あいうえ。 +。かきく + +あいうえ。 +。かきく +} +{ +あいう +え。。かき +く + +あいう +え。。かき +く +} + + +1254595244 +{ + あ +。 + + あ +。 +} +{ + あ。 + + あ。 +} + + +1254595245 +{ +あいうえ「 +お + +あいうえ「 +お +} +{ +あいうえ +「お + +あいうえ +「お +} + + +1254595246 +{ +あああああ +。いいい + +あああああ +。いいい +} +{ +あああああ。 +いいい + +あああああ。 +いいい +} + + +1254595248 +{ +あああああ +。いいい + +あああああ +。いいい +} +{ +ああああ +あ。いいい + +ああああ +あ。いいい +} + + +1295124892 +{ +あいうえ。 +abcd +あいうえ。 +」 + +あいうえ。 +abcd +あいうえ。 +」 +} +{ +あいうえ。 +abcd +あいう +え。」 + +あいうえ。 +abcd +あいう +え。」 +} + diff --git a/plugins/autofmt/test/test4.in b/plugins/autofmt/test/test4.in new file mode 100644 index 0000000000..5066122868 --- /dev/null +++ b/plugins/autofmt/test/test4.in @@ -0,0 +1,342 @@ +Test for textwidth=0. + +This test changes 'columns'. + +columns +wrapmargin +foldcolumn +number +relativenumber + + +Results of test4: + +STARTTEST +:let g:columns = &columns +:set columns=80 +ENDTEST + +STARTTEST +:set fo=t +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case1 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set columns=100 +:set fo=t +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:set columns=80 +ENDTEST + +case2 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set columns=40 +:set fo=t +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:set columns=80 +ENDTEST + +case3 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case4 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set columns=100 +:set fo=t wrapmargin=1 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:set columns=80 +ENDTEST + +case5 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set columns=40 +:set fo=t wrapmargin=1 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:set columns=80 +ENDTEST + +case6 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 foldcolumn=1 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case7 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 foldcolumn=2 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case8 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 number +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case9 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 number relativenumber +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case10 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:set fo=t wrapmargin=1 number relativenumber +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case11 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:sign define sign1 text=>> +:exe ':sign place 1 line=1 name=sign1 buffer=' . bufnr('%') +:set fo=t wrapmargin=1 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:sign unplace 1 +:sign undefine sign1 +ENDTEST + +case12 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:sign define sign1 text=>> +:exe ':sign place 1 line=1 name=sign1 buffer=' . bufnr('%') +:set fo=t textwidth=80 wrapmargin=0 foldcolumn=2 number relativenumber +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +:sign unplace 1 +:sign undefine sign1 +ENDTEST + +case14 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:" test for command-line window +:set fo=t wrapmargin=1 +/^{/+1 +:set formatexpr= +q:i1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0k2yy:q +P +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +q:i1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0k2yy:q +P +ENDTEST + +case15 +{ +} +{ +} + +STARTTEST +:" if "winwidth(0) - &wrapmargin - .... < 0" then same as textwidth=0. +:set fo=t wrapmargin=100 +/^{/+1 +:set formatexpr= +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +ENDTEST + +case16 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + +STARTTEST +:let &columns = g:columns +ENDTEST + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test4.ok b/plugins/autofmt/test/test4.ok new file mode 100644 index 0000000000..2c688db663 --- /dev/null +++ b/plugins/autofmt/test/test4.ok @@ -0,0 +1,247 @@ +Results of test4: + + + +case1 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case2 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case3 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case4 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} + + +case5 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case6 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 +5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} + + +case7 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} + + +case8 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} + + +case9 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case10 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case11 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 +8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + +case12 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} + + +case14 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 +} + + +case15 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 +8 9 9 9 9 9 0 0 0 0 0 +} + + +case16 +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} +{ +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 +9 9 9 9 9 0 0 0 0 0 + +1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 0 0 0 0 0 +} + + diff --git a/plugins/autofmt/test/test5.in b/plugins/autofmt/test/test5.in new file mode 100644 index 0000000000..7563d8fa67 --- /dev/null +++ b/plugins/autofmt/test/test5.in @@ -0,0 +1,54 @@ +Test for cursor position. + +Results of test5: + +STARTTEST +:set tw=10 +/^{/+1 +:set formatexpr= +V/xx +gq:call setline('.', '[cursor]') +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +V/xx +gq:call setline('.', '[cursor]') +ENDTEST + +case1 +{ + +aa bb cc dd ee ff + +xx + +} +{ + +aa bb cc dd ee ff + +xx + +} + +STARTTEST +:set tw=10 autoindent +/^{/+1 +:set formatexpr= +gqgq:call append('.', printf('col=%d', col('.'))) +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgq:call append('.', printf('col=%d', col('.'))) +ENDTEST + +case2 +{ + aa bb cc dd ee ff +} +{ + aa bb cc dd ee ff +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test5.ok b/plugins/autofmt/test/test5.ok new file mode 100644 index 0000000000..10b063ae83 --- /dev/null +++ b/plugins/autofmt/test/test5.ok @@ -0,0 +1,34 @@ +Results of test5: + + +case1 +{ + +aa bb cc +dd ee ff + +[cursor] + +} +{ + +aa bb cc +dd ee ff + +[cursor] + +} + + +case2 +{ + aa bb cc + dd ee ff +col=3 +} +{ + aa bb cc + dd ee ff +col=3 +} + diff --git a/plugins/autofmt/test/test6.in b/plugins/autofmt/test/test6.in new file mode 100644 index 0000000000..f894aa56cd --- /dev/null +++ b/plugins/autofmt/test/test6.in @@ -0,0 +1,58 @@ +Test for join line. + +Results of test6: + +STARTTEST +:set fo= tw=0 +/^{/+1 +gq} +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq} +ENDTEST + +case1 +{ + +aa bb cc + dd ee ff + gg hh ii + +} +{ + +aa bb cc + dd ee ff + gg hh ii + +} + +STARTTEST +:set fo=q tw=0 +/^{/+1 +gq} +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq} +ENDTEST + +case2 +{ + +aa bb cc + dd ee ff + gg hh ii + +} +{ + +aa bb cc + dd ee ff + gg hh ii + +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test6.ok b/plugins/autofmt/test/test6.ok new file mode 100644 index 0000000000..2edb7f3522 --- /dev/null +++ b/plugins/autofmt/test/test6.ok @@ -0,0 +1,28 @@ +Results of test6: + + +case1 +{ + +aa bb cc dd ee ff gg hh ii + +} +{ + +aa bb cc dd ee ff gg hh ii + +} + + +case2 +{ + +aa bb cc dd ee ff gg hh ii + +} +{ + +aa bb cc dd ee ff gg hh ii + +} + diff --git a/plugins/autofmt/test/test7.in b/plugins/autofmt/test/test7.in new file mode 100644 index 0000000000..979927ec6e --- /dev/null +++ b/plugins/autofmt/test/test7.in @@ -0,0 +1,365 @@ +Test for indent. + +autoindent +cindent +lispindent +smartindent +indentexpr + + +Results of test7: + +STARTTEST +:set tw=10 +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case1 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 autoindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case2 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 cindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case3 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 cindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff; + aa bb cc dd ee ff; +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff; + aa bb cc dd ee ff; +ENDTEST + +case4 +{ +aa bb cc dd ee ff; + aa bb cc dd ee ff; +} +{ +aa bb cc dd ee ff; + aa bb cc dd ee ff; +} + +STARTTEST +:set tw=10 lisp +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case5 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 lisp +/^{/+1 +:set formatexpr= +gqgqjgqgqo +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +ENDTEST + +case6 +{ +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +} +{ +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +} + +STARTTEST +:set tw=10 lisp autoindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case7 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 lisp autoindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +ENDTEST + +case8 +{ +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +} +{ +(aa bb cc dd ee ff) + (aa bb cc dd ee ff) +} + +STARTTEST +:set tw=10 smartindent +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case9 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 sw=2 smartindent +/^{/+1 +:set formatexpr= +gqgqoi +if aaa +do bbb +while ccc +#if ddd +eee +#endif +fff +{ +aaa +{ +bbb +} +} +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqoi +if aaa +do bbb +while ccc +#if ddd +eee +#endif +fff +{ +aaa +{ +bbb +} +} +ENDTEST + +case10 +{ +if aaa do bbb while ccc #if ddd #endif { aaa { bbb } } +} +{ +if aaa do bbb while ccc #if ddd #endif { aaa { bbb } } +} + +STARTTEST +:set tw=10 indentexpr=indent(v:lnum-1)+1 +/^{/+1 +:set formatexpr= +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjgqgqo +aa bb cc dd ee ff + aa bb cc dd ee ff +ENDTEST + +case11 +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff + aa bb cc dd ee ff +} + +STARTTEST +:set tw=10 cindent +/^{/+1 +:set formatexpr= +gqgqjo{ + +}k aa label: +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjo{ + +}k aa label: +ENDTEST + +case12 +{ + aa label: +} +{ + aa label: +} + +STARTTEST +:set tw=10 cindent +/^{/+1 +:set formatexpr= +gqgqjo{ + +}k a; label: +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjo{ + +}k a; label: +ENDTEST + +case13 +{ + a; label: +} +{ + a; label: +} + +STARTTEST +:set tw=10 cindent +/^{/+1 +:set formatexpr= +gqgqjo{ + +}k a; bbbbb; +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqjo{ + +}k a; bbbbb; +ENDTEST + +case14 +{ + a; bbbbb; +} +{ + a; bbbbb; +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test7.ok b/plugins/autofmt/test/test7.ok new file mode 100644 index 0000000000..782213a50e --- /dev/null +++ b/plugins/autofmt/test/test7.ok @@ -0,0 +1,422 @@ +Results of test7: + + +case1 +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} + + +case2 +{ +aa bb cc +dd ee ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} +{ +aa bb cc +dd ee ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} + + +case3 +{ +aa bb cc + dd + ee + ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} +{ +aa bb cc + dd + ee + ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} + + +case4 +{ +aa bb cc + dd + ee + ff; + aa bb cc + dd + ee + ff; + + aa bb cc + dd + ee + ff; + aa bb + cc + dd + ee + ff; +} +{ +aa bb cc + dd + ee + ff; + aa bb cc + dd + ee + ff; + + aa bb cc + dd + ee + ff; + aa bb + cc + dd + ee + ff; +} + + +case5 +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} + + +case6 +{ +(aa bb cc +dd ee ff) + (aa bb +cc dd ee +ff) + +(aa bb cc +dd ee ff) + (aa bb +cc dd ee +ff) +} +{ +(aa bb cc +dd ee ff) + (aa bb +cc dd ee +ff) + +(aa bb cc +dd ee ff) + (aa bb +cc dd ee +ff) +} + + +case7 +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} +{ +aa bb cc +dd ee ff + aa bb cc +dd ee ff + +aa bb cc +dd ee ff + aa bb cc +dd ee ff +} + + +case8 +{ +(aa bb cc + dd ee + ff) + (aa bb + cc + dd + ee + ff) + +(aa bb cc + dd ee + ff) + (aa bb + cc + dd + ee + ff) +} +{ +(aa bb cc + dd ee + ff) + (aa bb + cc + dd + ee + ff) + +(aa bb cc + dd ee + ff) + (aa bb + cc + dd + ee + ff) +} + + +case9 +{ +aa bb cc +dd ee ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} +{ +aa bb cc +dd ee ff + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + aa bb + cc dd + ee ff +} + + +case10 +{ +if aaa do + bbb + while + ccc + #if + ddd + #endif + { aaa + { bbb + } } + +if aaa + do bbb + while + ccc +#if ddd + eee +#endif + fff + { + aaa + { + bbb + } + } +} +{ +if aaa do + bbb + while + ccc + #if + ddd + #endif + { aaa + { bbb + } } + +if aaa + do bbb + while + ccc +#if ddd + eee +#endif + fff + { + aaa + { + bbb + } + } +} + + +case11 +{ +aa bb cc + dd ee ff + aa bb cc + dd ee + ff + + aa bb cc + dd ee ff + aa bb + cc + dd + ee + ff +} +{ +aa bb cc + dd ee ff + aa bb cc + dd ee + ff + + aa bb cc + dd ee ff + aa bb + cc + dd + ee + ff +} + + +case12 +{ + aa + label: +} +{ + aa + label: +} +{ + aa + label: +} +{ + aa + label: +} + + +case13 +{ + a; +label: +} +{ + a; +label: +} +{ + a; +label: +} +{ + a; +label: +} + + +case14 +{ + a; + bbbbb; +} +{ + a; + bbbbb; +} +{ + a; + bbbbb; +} +{ + a; + bbbbb; +} + diff --git a/plugins/autofmt/test/test8.in b/plugins/autofmt/test/test8.in new file mode 100644 index 0000000000..da70cb2e05 --- /dev/null +++ b/plugins/autofmt/test/test8.in @@ -0,0 +1,104 @@ +Test for paste. + + +Results of test8: + +STARTTEST +:set paste autoindent tw=10 +/^{/+1 +gqgqo +i aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +i aaaaa bbbbb +ENDTEST + +case1 +{ + aaaaa bbbbb +} +{ + aaaaa bbbbb +} + +STARTTEST +:set paste cindent tw=10 +/^{/+1 +gqgqo +i aaaaa bbbbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +i aaaaa bbbbb +ENDTEST + +case2 +{ + aaaaa bbbbb +} +{ + aaaaa bbbbb +} + +STARTTEST +:set paste lisp autoindent tw=10 +/^{/+1 +gqgqo +i(aaaaa bbbbb) +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +i(aaaaa bbbbb) +ENDTEST + +case3 +{ +(aaaaa bbbbb) +} +{ +(aaaaa bbbbb) +} + +STARTTEST +:set paste smartindent tw=10 +/^{/+1 +gqgqo +i if aa bbb +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +i if aa bbb +ENDTEST + +case4 +{ + if aa bbb +} +{ + if aa bbb +} + +STARTTEST +:set paste indentexpr=indent(v:lnum-1)+1 tw=10 +/^{/+1 +gqgqo +aa bb cc dd ee ff +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +aa bb cc dd ee ff +ENDTEST + +case5 +{ +aa bb cc dd ee ff +} +{ +aa bb cc dd ee ff +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test8.ok b/plugins/autofmt/test/test8.ok new file mode 100644 index 0000000000..e29a03612a --- /dev/null +++ b/plugins/autofmt/test/test8.ok @@ -0,0 +1,77 @@ +Results of test8: + + +case1 +{ + aaaaa + bbbbb + + aaaaa bbbbb +} +{ + aaaaa + bbbbb + + aaaaa bbbbb +} + + +case2 +{ + aaaaa +bbbbb + + aaaaa bbbbb +} +{ + aaaaa +bbbbb + + aaaaa bbbbb +} + + +case3 +{ +(aaaaa +bbbbb) + +(aaaaa bbbbb) +} +{ +(aaaaa +bbbbb) + +(aaaaa bbbbb) +} + + +case4 +{ + if aa +bbb + + if aa bbb +} +{ + if aa +bbb + + if aa bbb +} + + +case5 +{ +aa bb cc +dd ee ff + +aa bb cc dd ee ff +} +{ +aa bb cc +dd ee ff + +aa bb cc dd ee ff +} + diff --git a/plugins/autofmt/test/test9.in b/plugins/autofmt/test/test9.in new file mode 100644 index 0000000000..fb57f549fa --- /dev/null +++ b/plugins/autofmt/test/test9.in @@ -0,0 +1,54 @@ +Test for no_leader. + +edit.c: +6063 /* If the line doesn't start with a comment leader, then don't +6064 * start one in a following broken line. Avoids that a %word +6065 * moved to the start of the next line causes all following lines +6066 * to start with %. */ +6067 if (leader_len == 0) +6068 no_leader = TRUE; + +Results of test9: + +STARTTEST +:set tw=4 formatoptions=tcq comments=:\" +/^{/+1 +gqgqo +innoremap "hoge" fuga puyo +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +innoremap "hoge" fuga puyo +ENDTEST + +case1 +{ +nnoremap "hoge" fuga puyo +} +{ +nnoremap "hoge" fuga puyo +} + +STARTTEST +:set tw=4 formatoptions=tcq cindent comments=s1:/*,mb:*,ex:*/ +/^{/+1 +gqgqo +iint xxx /* a b c d */ +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gqgqo +iint xxx /* a b c d */ +ENDTEST + +case2 +{ +int xxx /* a b c d */ +} +{ +int xxx /* a b c d */ +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/test9.ok b/plugins/autofmt/test/test9.ok new file mode 100644 index 0000000000..3c0c33f099 --- /dev/null +++ b/plugins/autofmt/test/test9.ok @@ -0,0 +1,65 @@ +Results of test9: + + +case1 +{ +nnoremap +"hoge" +fuga +puyo + +nnoremap +"hoge" +"fuga +"puyo +} +{ +nnoremap +"hoge" +fuga +puyo + +nnoremap +"hoge" +"fuga +"puyo +} + + +case2 +{ +int + xxx + /* + a + b + c + d + */ + +int +xxx +/* a + * b + * c + * d + * */ +} +{ +int + xxx + /* a + b + c + d + */ + +int +xxx +/* a + * b + * c + * d + * */ +} + diff --git a/plugins/autofmt/test/todo.in b/plugins/autofmt/test/todo.in new file mode 100644 index 0000000000..09e3884376 --- /dev/null +++ b/plugins/autofmt/test/todo.in @@ -0,0 +1,111 @@ +Test for fo=2. + + +Results of todo: + +STARTTEST +:set fo=2 noai tw=10 +/^{/+1 +:set formatexpr= +j2gqgq2j3gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +j2gqgq2j3gqgq +ENDTEST + +case1 +{ + + aa bb cc + dd ee ff + +aa bb cc + dd ee ff + gg hh ii + +} +{ + + aa bb cc + dd ee ff + +aa bb cc + dd ee ff + gg hh ii + +} + +STARTTEST +:set fo=2 noai tw=20 +/^{/+1 +:set formatexpr= +j2gqgq2j2gqgq +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +j2gqgq2j2gqgq +ENDTEST + +case2 +{ + + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + +} +{ + + aa bb cc + dd ee ff + + aa bb cc + dd ee ff + +} + +STARTTEST +:set fo=t2 noai tw=10 +/^{/+1 +:set formatexpr= +A xx yy +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +A xx yy +ENDTEST + +case3 +{ + aa bb + cc dd ee +} +{ + aa bb + cc dd ee +} + +STARTTEST +:set fo=t2 ai tw=10 +/^{/+1 +:set formatexpr= +A xx yy +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +A xx yy +ENDTEST + +case4 +{ + aa bb + cc dd ee +} +{ + aa bb + cc dd ee +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/todo.ok b/plugins/autofmt/test/todo.ok new file mode 100644 index 0000000000..1d352dec83 --- /dev/null +++ b/plugins/autofmt/test/todo.ok @@ -0,0 +1,80 @@ +Results of todo: + + +case1 +{ + + aa bb + cc dd ee +ff + +aa bb cc + dd ee +ff gg hh +ii + +} +{ + + aa bb + cc dd ee +ff + +aa bb cc + dd ee +ff gg hh +ii + +} + + +case2 +{ + + aa + bb cc dd +ee ff + + aa + bb cc dd +ee ff + +} +{ + + aa + bb cc dd +ee ff + + aa + bb cc dd +ee ff + +} + + +case3 +{ + aa bb +xx yy + cc dd ee +} +{ + aa bb +xx yy + cc dd ee +} + + +case4 +{ + aa bb + xx yy + cc dd ee +} +{ + aa bb + xx yy + cc dd ee +} + diff --git a/plugins/autofmt/test/todo2.in b/plugins/autofmt/test/todo2.in new file mode 100644 index 0000000000..d52c8ef395 --- /dev/null +++ b/plugins/autofmt/test/todo2.in @@ -0,0 +1,41 @@ +When using gq{motion}, we can't set cursor position to correct place. +v:lnum=1 and v:count=5 for both "gq/xx" and "V/yygq". + +Results of todo2: + +STARTTEST +:set tw=10 +/^{/+1 +:set formatexpr= +gq/xx +:call setline('.', '[cursor]') +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +gq/xx +:call setline('.', '[cursor]') +ENDTEST + +case1 +{ + +aa bb cc +dd ee ff + +yy +xx + +} +{ + +aa bb cc +dd ee ff + +yy +xx + +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/todo2.ok b/plugins/autofmt/test/todo2.ok new file mode 100644 index 0000000000..44f97b683c --- /dev/null +++ b/plugins/autofmt/test/todo2.ok @@ -0,0 +1,23 @@ +Results of todo2: + + +case1 +{ + +aa bb cc +dd ee ff + +yy +[cursor] + +} +{ + +aa bb cc +dd ee ff + +[cursor] +xx + +} + diff --git a/plugins/autofmt/test/todo3.in b/plugins/autofmt/test/todo3.in new file mode 100644 index 0000000000..4faae043e7 --- /dev/null +++ b/plugins/autofmt/test/todo3.in @@ -0,0 +1,43 @@ +Quotation mark may require special handling. + +line break class +QU Quotation Quotation marks Act like they are both opening and closing + +1. +odd: handle as opening +even: handle as closing + +2. +... + + +Results of todo3: + +STARTTEST +:set fo=tm tw=10 +/^{/+1 +:set formatexpr= +gqgqjgqgqo +あいうえu3002'abcd' +"あいうu3002"abcd +/^{/+1 +:set formatexpr=autofmt#japanese#formatexpr() +gqgqjgqgqo +あいうえu3002'abcd' +"あいうu3002"abcd +ENDTEST + +case1 +{ +あいうえ。'abcd' +"あいう。"abcd +} +{ +あいうえ。'abcd' +"あいう。"abcd +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/todo3.ok b/plugins/autofmt/test/todo3.ok new file mode 100644 index 0000000000..75614eb361 --- /dev/null +++ b/plugins/autofmt/test/todo3.ok @@ -0,0 +1,27 @@ +Results of todo3: + + +case1 +{ +あいうえ。 +'abcd' +"あいう。 +"abcd + +あいうえ。 +'abcd' +"あいう。 +"abcd +} +{ +あいう +え。'abcd' +"あい +う。"abcd + +あいう +え。'abcd' +"あい +う。"abcd +} + diff --git a/plugins/autofmt/test/todo5.in b/plugins/autofmt/test/todo5.in new file mode 100644 index 0000000000..3068e513b7 --- /dev/null +++ b/plugins/autofmt/test/todo5.in @@ -0,0 +1,91 @@ +Test for mark. + +Results of todo5: + +STARTTEST +:function! GetMarks(s) +: return map(split(a:s, '\zs'), 'getpos("''" . v:val)') +:endfunction +ENDTEST + +STARTTEST +:set tw=10 +/^{/+1 +:set formatexpr= +:normal! mawmbwmcwmdwmewmf +:let before = GetMarks('abcdef') +:normal! k2gqgq +:let after = GetMarks('abcdef') +:call append('.', [string(before), string(after), before == after ? "ok" : "ng"]) +/^{/+1 +:set formatexpr=autofmt#compat#formatexpr() +:normal! mawmbwmcwmdwmewmf +:let before = GetMarks('abcdef') +:normal! k2gqgq +:let after = GetMarks('abcdef') +:call append('.', [string(before), string(after), before == after ? "ok" : "ng"]) +:delmarks! +ENDTEST + +case1 +{ +aa bb cc +dd ee ff +} +{ +aa bb cc +dd ee ff +} + +STARTTEST +:set tw=10 +/^{/+1 +:set formatexpr= +:normal! mawmbwmcwmdwmewmf +:normal! gqgq +:let marks_vim = GetMarks('abcdef') +:-1,.delete +:delmarks! +:set formatexpr=autofmt#compat#formatexpr() +:normal! mawmbwmcwmdwmewmf +:normal! gqgq +:let marks_autofmt = GetMarks('abcdef') +:call append('.', [string(marks_vim), string(marks_autofmt), marks_vim == marks_autofmt ? 'ok' : 'ng']) +:delmarks! +ENDTEST + +case2 +{ +aa bb cc dd ee ff +aa bb cc dd ee ff +} + +STARTTEST +:set tw=20 +/^{/+1 +:set formatexpr= +:normal! mawmbwmcwmdwmewmf +:normal! k2gqgq +:let marks_vim = GetMarks('abcdef') +:delete +:delmarks! +:set formatexpr=autofmt#compat#formatexpr() +:normal! mawmbwmcwmdwmewmf +:normal! k2gqgq +:let marks_autofmt = GetMarks('abcdef') +:call append('.', [string(marks_vim), string(marks_autofmt), marks_vim == marks_autofmt ? 'ok' : 'ng']) +:delmarks! +ENDTEST + +case3 +{ +aa bb cc +dd ee ff +aa bb cc +dd ee ff +} + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:1;/^Results/,$wq! test.out +ENDTEST diff --git a/plugins/autofmt/test/todo5.ok b/plugins/autofmt/test/todo5.ok new file mode 100644 index 0000000000..06d64aa724 --- /dev/null +++ b/plugins/autofmt/test/todo5.ok @@ -0,0 +1,39 @@ +Results of todo5: + + + +case1 +{ +aa bb cc +dd ee ff +[[0, 32, 1, 0], [0, 32, 4, 0], [0, 32, 7, 0], [0, 33, 1, 0], [0, 33, 4, 0], [0, 33, 7, 0]] +[[0, 32, 1, 0], [0, 32, 4, 0], [0, 32, 7, 0], [0, 33, 1, 0], [0, 33, 4, 0], [0, 33, 7, 0]] +ok +} +{ +aa bb cc +dd ee ff +[[0, 39, 1, 0], [0, 39, 4, 0], [0, 39, 7, 0], [0, 40, 1, 0], [0, 40, 4, 0], [0, 40, 7, 0]] +[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] +ng +} + + +case2 +{ +aa bb cc +dd ee ff +[[0, 65, 1, 0], [0, 65, 4, 0], [0, 65, 7, 0], [0, 66, 1, 0], [0, 66, 4, 0], [0, 66, 7, 0]] +[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] +ng +} + + +case3 +{ +aa bb cc dd ee ff +[[0, 91, 1, 0], [0, 91, 4, 0], [0, 91, 7, 0], [0, 91, 10, 0], [0, 91, 13, 0], [0, 91, 16, 0]] +[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] +ng +} + diff --git a/plugins/autofmt/test/unix.vim b/plugins/autofmt/test/unix.vim new file mode 100644 index 0000000000..b041cd54bd --- /dev/null +++ b/plugins/autofmt/test/unix.vim @@ -0,0 +1,7 @@ +" Settings for test script execution +" Always use "sh", don't use the value of "$SHELL". +let g:__vimrc = expand(":p") +set shell=sh +set debug=msg +set verbosefile=debug.log +let &runtimepath = expand(":p:h:h") diff --git a/plugins/autofmt/tools/unicode.vim b/plugins/autofmt/tools/unicode.vim new file mode 100644 index 0000000000..3e9dd55933 --- /dev/null +++ b/plugins/autofmt/tools/unicode.vim @@ -0,0 +1,113 @@ + +function s:parse_prop(lines) + " items = [[start, end, prop], ...] + let items = [] + + " 1. parse lines + for line in getline(1, '$') + let line = substitute(line, '\s*#.*', '', '') + if line == "" + continue + endif + if line =~ '\.\.' + "UUUU..UUUU;XX + let m = matchlist(line, '\v^(\x+)\.\.(\x+);(\S+)$') + call add(items, [str2nr(m[1], 16), str2nr(m[2], 16), m[3]]) + else + "UUUU;XX + let m = matchlist(line, '\v^(\x+);(\S+)$') + call add(items, [str2nr(m[1], 16), str2nr(m[1], 16), m[2]]) + endif + endfor + + " 2. reduce + let i = 0 + while i < len(items) - 1 + if items[i][2] == items[i + 1][2] && items[i][1] + 1 == items[i + 1][0] + let items[i][1] = items[i + 1][1] + unlet items[i + 1] + else + let i += 1 + endif + endwhile + + return items +endfunction + +function s:prop_bsearch(ucs4, table) + let [left, right] = [0, len(a:table)] + while left < right + let mid = (left + right) / 2 + let item = a:table[mid] + if a:ucs4 < item[0] + let right = mid + elseif item[1] < a:ucs4 + let left = mid + 1 + else + return item + endif + endwhile + return [] +endfunction + +function! s:main() + if !filereadable('LineBreak.txt') + edit http://www.unicode.org/Public/UNIDATA/LineBreak.txt + write LineBreak.txt + else + edit LineBreak.txt + endif + let header = getline(1, 2) + let linebreak = s:parse_prop(getline(1, '$')) + + enew + + if header[0] =~# '^# LineBreak-.*\.txt' + $put ='\"' . header[0][1:] + endif + if header[1] =~# '^# Date: ' + $put ='\"' . header[1][1:] + endif + + " MEMO: line length is optimized for Vim's reading buffer size. + $put ='let s:tmp = []' + let n = 3 + for i in range(0, len(linebreak) - 1, n) + let s = '' + for [start, end, prop] in linebreak[i : i + n - 1] + if s != '' + let s .= ',' + endif + let s .= printf('[0x%04X,0x%04X,''%s'']', start, end, prop) + endfor + $put =printf('call extend(s:tmp, [%s])', s) + endfor + $put ='let s:lib.linebreak_table = s:tmp' + $put ='unlet s:tmp' + $put ='' + + $put ='let s:tmp = []' + for x in range(0x100) + let row = [] + for y in range(0x100) + let item = s:prop_bsearch(x * 0x100 + y, linebreak) + if empty(item) + let prop = 'XX' + else + let [start, end, prop] = item + endif + call add(row, prop) + endfor + if count(row, prop) == len(row) + let row = [prop] + endif + let s = join(map(row, "'''' . v:val . ''''"), ',') + $put =printf('call add(s:tmp, [%s])', s) + endfor + $put ='let s:lib.linebreak_bmp = s:tmp' + $put ='unlet s:tmp' + $put ='' + +endfunction + +call s:main() diff --git a/plugins/golang/README.md b/plugins/golang/README.md new file mode 100644 index 0000000000..be44411353 --- /dev/null +++ b/plugins/golang/README.md @@ -0,0 +1,47 @@ +Extra Vim plugins for Go +======================== + +This is a collection of extra vim plugins for Go. This is based on go's official repository located at `misc/vim`. +This plugins provides following feature: + +* `:Godoc` command to open documentation window. +* `:Fmt` command to format current buffer. +* `:Import` command to add import statement. + +And if you has installed some go utilities, this will add runtime path to the vim plugins which is the utilities provides. +Below is the list of supported utilities. + +* gocode (https://github.com/nsf/gocode) +* lint (https://github.com/golang/lint) + +Installation +------------ + +To install using pathogen.vim: + + cd ~/.vim/bundle + git clone https://github.com/vim-jp/vim-go-extra.git + +To install using [Vundle](https://github.com/gmarik/vundle): + + " add this line to your .vimrc file + Plugin 'vim-jp/vim-go-extra' + +To checkout the source from repository: + + cd ~/.vim/bundle + git clone https://github.com/vim-jp/vim-go-extra.git + + +Configuration +------------- + +A popular configuration is to gofmt Go source files when they are saved. +To do that, add this line to the end of your $HOME/.vimrc. + + autocmd FileType go autocmd BufWritePre Fmt + +License +------- + +Same as original plugins that go was provided. i.e. BSD diff --git a/plugins/golang/autoload/go/complete.vim b/plugins/golang/autoload/go/complete.vim new file mode 100644 index 0000000000..fc9a56d729 --- /dev/null +++ b/plugins/golang/autoload/go/complete.vim @@ -0,0 +1,96 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" This file provides a utility function that performs auto-completion of +" package names, for use by other commands. + +let s:goos = $GOOS +let s:goarch = $GOARCH + +if len(s:goos) == 0 + if exists('g:golang_goos') + let s:goos = g:golang_goos + elseif has('win32') || has('win64') + let s:goos = 'windows' + elseif has('macunix') + let s:goos = 'darwin' + else + let s:goos = '*' + endif +endif + +if len(s:goarch) == 0 + if exists('g:golang_goarch') + let s:goarch = g:golang_goarch + else + let s:goarch = '*' + endif +endif + +function! go#complete#PackageMembers(package, member) + silent! let content = system('godoc ' . a:package) + if v:shell_error || !len(content) + return [] + endif + let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'") + try + let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*' + let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*' + let candidates = + \ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")') + \ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")') + return filter(candidates, '!stridx(v:val, a:member)') + catch + return [] + endtry +endfunction + +function! go#complete#Package(ArgLead, CmdLine, CursorPos) + let dirs = [] + + let words = split(a:CmdLine, '\s\+', 1) + if len(words) > 2 + " Complete package members + return go#complete#PackageMembers(words[1], words[2]) + endif + + let goroot = go#env#root() + + if len(goroot) != 0 && isdirectory(goroot) + let dirs += [goroot] + endif + + let pathsep = ':' + if s:goos == 'windows' + let pathsep = ';' + endif + let workspaces = split($GOPATH, pathsep) + if workspaces != [] + let dirs += workspaces + endif + + if len(dirs) == 0 + " should not happen + return [] + endif + + let ret = {} + for dir in dirs + " this may expand to multiple lines + let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") + call add(root, expand(dir . '/src')) + for r in root + for i in split(globpath(r, a:ArgLead.'*'), "\n") + if isdirectory(i) + let i .= '/' + elseif i !~ '\.a$' + continue + endif + let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g') + let ret[i] = i + endfor + endfor + endfor + return sort(keys(ret)) +endfunction diff --git a/plugins/golang/autoload/go/env.vim b/plugins/golang/autoload/go/env.vim new file mode 100644 index 0000000000..84dfceace3 --- /dev/null +++ b/plugins/golang/autoload/go/env.vim @@ -0,0 +1,22 @@ +let s:cache = {} + +function! go#env#cache_clear(key) + call remove(s:cache, a:key) +endfunction + +function! go#env#root() + if has_key(s:cache, 'root') + return s:cache['root'] + endif + if executable('go') + let root = substitute(system('go env GOROOT'), '\n', '', 'g') + if v:shell_error + echomsg '''go env GOROOT'' failed' + return '' + endif + else + let root = $GOROOT + endif + let s:cache['root'] = root + return root +endfunction diff --git a/plugins/golang/ftplugin/go/fmt.vim b/plugins/golang/ftplugin/go/fmt.vim new file mode 100644 index 0000000000..359545bd40 --- /dev/null +++ b/plugins/golang/ftplugin/go/fmt.vim @@ -0,0 +1,69 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" fmt.vim: Vim command to format Go files with gofmt. +" +" This filetype plugin add a new commands for go buffers: +" +" :Fmt +" +" Filter the current Go buffer through gofmt. +" It tries to preserve cursor position and avoids +" replacing the buffer with stderr output. +" +" Options: +" +" g:go_fmt_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. +" +" g:gofmt_command [default="gofmt"] +" +" Flag naming the gofmt executable to use. +" +if exists("b:did_ftplugin_go_fmt") + finish +endif + +if !exists("g:go_fmt_commands") + let g:go_fmt_commands = 1 +endif + +if !exists("g:gofmt_command") + let g:gofmt_command = "gofmt" +endif + +if g:go_fmt_commands + command! -buffer Fmt call s:GoFormat() +endif + +function! s:GoFormat() + let view = winsaveview() + silent execute "%!" . g:gofmt_command + if v:shell_error + let errors = [] + for line in getline(1, line('$')) + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[4]}) + endif + endfor + if empty(errors) + % | " Couldn't detect gofmt error format, output errors + endif + undo + if !empty(errors) + call setqflist(errors, 'r') + endif + echohl Error | echomsg "Gofmt returned error" | echohl None + endif + call winrestview(view) +endfunction + +let b:did_ftplugin_go_fmt = 1 + +" vim:ts=4:sw=4:et diff --git a/plugins/golang/ftplugin/go/import.vim b/plugins/golang/ftplugin/go/import.vim new file mode 100644 index 0000000000..91c8697a4c --- /dev/null +++ b/plugins/golang/ftplugin/go/import.vim @@ -0,0 +1,250 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" import.vim: Vim commands to import/drop Go packages. +" +" This filetype plugin adds three new commands for go buffers: +" +" :Import {path} +" +" Import ensures that the provided package {path} is imported +" in the current Go buffer, using proper style and ordering. +" If {path} is already being imported, an error will be +" displayed and the buffer will be untouched. +" +" :ImportAs {localname} {path} +" +" Same as Import, but uses a custom local name for the package. +" +" :Drop {path} +" +" Remove the import line for the provided package {path}, if +" present in the current Go buffer. If {path} is not being +" imported, an error will be displayed and the buffer will be +" untouched. +" +" If you would like to add shortcuts, you can do so by doing the following: +" +" Import fmt +" au Filetype go nnoremap f :Import fmt +" +" Drop fmt +" au Filetype go nnoremap F :Drop fmt +" +" Import the word under your cursor +" au Filetype go nnoremap k +" \ :exe 'Import ' . expand('') +" +" The backslash '\' is the default maplocalleader, so it is possible that +" your vim is set to use a different character (:help maplocalleader). +" +" Options: +" +" g:go_import_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. +" +if exists("b:did_ftplugin_go_import") + finish +endif + +if !exists("g:go_import_commands") + let g:go_import_commands = 1 +endif + +if g:go_import_commands + command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', ) + command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', ) + command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, ) +endif + +function! s:SwitchImport(enabled, localname, path) + let view = winsaveview() + let path = a:path + + " Quotes are not necessary, so remove them if provided. + if path[0] == '"' + let path = strpart(path, 1) + endif + if path[len(path)-1] == '"' + let path = strpart(path, 0, len(path) - 1) + endif + if path == '' + call s:Error('Import path not provided') + return + endif + + " Extract any site prefix (e.g. github.com/). + " If other imports with the same prefix are grouped separately, + " we will add this new import with them. + " Only up to and including the first slash is used. + let siteprefix = matchstr(path, "^[^/]*/") + + let qpath = '"' . path . '"' + if a:localname != '' + let qlocalpath = a:localname . ' ' . qpath + else + let qlocalpath = qpath + endif + let indentstr = 0 + let packageline = -1 " Position of package name statement + let appendline = -1 " Position to introduce new import + let deleteline = -1 " Position of line with existing import + let linesdelta = 0 " Lines added/removed + + " Find proper place to add/remove import. + let line = 0 + while line <= line('$') + let linestr = getline(line) + + if linestr =~# '^package\s' + let packageline = line + let appendline = line + + elseif linestr =~# '^import\s\+(' + let appendstr = qlocalpath + let indentstr = 1 + let appendline = line + let firstblank = -1 + let lastprefix = "" + while line <= line("$") + let line = line + 1 + let linestr = getline(line) + let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)') + if empty(m) + if siteprefix == "" && a:enabled + " must be in the first group + break + endif + " record this position, but keep looking + if firstblank < 0 + let firstblank = line + endif + continue + endif + if m[1] == ')' + " if there's no match, add it to the first group + if appendline < 0 && firstblank >= 0 + let appendline = firstblank + endif + break + endif + let lastprefix = matchstr(m[4], "^[^/]*/") + if a:localname != '' && m[3] != '' + let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath) + endif + let appendstr = m[2] . qlocalpath + let indentstr = 0 + if m[4] == path + let appendline = -1 + let deleteline = line + break + elseif m[4] < path + " don't set candidate position if we have a site prefix, + " we've passed a blank line, and this doesn't share the same + " site prefix. + if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0 + let appendline = line + endif + elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0 + " first entry of site group + let appendline = line - 1 + break + endif + endwhile + break + + elseif linestr =~# '^import ' + if appendline == packageline + let appendstr = 'import ' . qlocalpath + let appendline = line - 1 + endif + let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"') + if !empty(m) + if m[3] == path + let appendline = -1 + let deleteline = line + break + endif + if m[3] < path + let appendline = line + endif + if a:localname != '' && m[2] != '' + let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath) + endif + let appendstr = 'import' . m[1] . qlocalpath + endif + + elseif linestr =~# '^\(var\|const\|type\|func\)\>' + break + + endif + let line = line + 1 + endwhile + + " Append or remove the package import, as requested. + if a:enabled + if deleteline != -1 + call s:Error(qpath . ' already being imported') + elseif appendline == -1 + call s:Error('No package line found') + else + if appendline == packageline + call append(appendline + 0, '') + call append(appendline + 1, 'import (') + call append(appendline + 2, ')') + let appendline += 2 + let linesdelta += 3 + let appendstr = qlocalpath + let indentstr = 1 + endif + call append(appendline, appendstr) + execute appendline + 1 + if indentstr + execute 'normal >>' + endif + let linesdelta += 1 + endif + else + if deleteline == -1 + call s:Error(qpath . ' not being imported') + else + execute deleteline . 'd' + let linesdelta -= 1 + + if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)' + " Delete empty import block + let deleteline -= 1 + execute deleteline . "d" + execute deleteline . "d" + let linesdelta -= 2 + endif + + if getline(deleteline) == '' && getline(deleteline - 1) == '' + " Delete spacing for removed line too. + execute deleteline . "d" + let linesdelta -= 1 + endif + endif + endif + + " Adjust view for any changes. + let view.lnum += linesdelta + let view.topline += linesdelta + if view.topline < 0 + let view.topline = 0 + endif + + " Put buffer back where it was. + call winrestview(view) + +endfunction + +function! s:Error(s) + echohl Error | echo a:s | echohl None +endfunction + +let b:did_ftplugin_go_import = 1 + +" vim:ts=4:sw=4:et diff --git a/plugins/golang/ftplugin/go/test.sh b/plugins/golang/ftplugin/go/test.sh new file mode 100755 index 0000000000..d8a5b89511 --- /dev/null +++ b/plugins/golang/ftplugin/go/test.sh @@ -0,0 +1,78 @@ +#!/bin/bash -e +# +# Copyright 2012 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. +# +# Tests for import.vim. + +cd $(dirname $0) + +cat > base.go <&1 -n "$1: " + vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \ + -c "$1" -c 'wq! test.go' base.go + # ensure blank lines are treated correctly + if ! gofmt test.go | cmp test.go -; then + echo 2>&1 "gofmt conflict" + gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1 + fail=1 + return + fi + if ! [[ $(cat test.go) =~ $2 ]]; then + echo 2>&1 "$2 did not match" + cat test.go | sed "s/^/ /" 2>&1 + fail=1 + return + fi + echo 2>&1 "ok" +} + +# Tests for Import + +test_one "Import baz" '"baz".*"bytes"' +test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"' +test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix +test_one "Import nat" '"io".*"nat".*"net"' +test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"' +test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"' +test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"' +test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"' + +# Tests for Drop + +cat > base.go <&1 "FAIL" + exit 1 +fi +echo 2>&1 "PASS" diff --git a/plugins/golang/plugin/go/extra.vim b/plugins/golang/plugin/go/extra.vim new file mode 100644 index 0000000000..b93efdf7e9 --- /dev/null +++ b/plugins/golang/plugin/go/extra.vim @@ -0,0 +1,23 @@ +if $GOPATH == '' + finish +endif + +let s:extras = [ +\"github.com/nsf/gocode/vim", +\"github.com/golang/lint/misc/vim", +\"code.google.com/p/go.tools/cmd/misc/vim", +\] + +function! s:install_extras() + let gopath = substitute($GOPATH, (has('win32') || has('win64')) ? ';' : ':', ',', 'g') + let gopath = join(filter(map(s:extras, " + \ substitute(globpath(gopath, 'src/' . v:val, 0), '\n', ',', 'g') + \"), 'len(v:val)>0'), ',') + if len(gopath) > 0 + exec 'set rtp+=' . gopath + endif +endfunction + +call s:install_extras() +delfunction s:install_extras +unlet s:extras diff --git a/plugins/golang/plugin/go/godoc.vim b/plugins/golang/plugin/go/godoc.vim new file mode 100644 index 0000000000..0c2c5c9ed8 --- /dev/null +++ b/plugins/golang/plugin/go/godoc.vim @@ -0,0 +1,138 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" godoc.vim: Vim command to see godoc. +" +" +" Commands: +" +" :Godoc +" +" Open the relevant Godoc for either the word[s] passed to the command or +" the, by default, the word under the cursor. +" +" Options: +" +" g:go_godoc_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. + +if exists("g:loaded_godoc") + finish +endif +let g:loaded_godoc = 1 + +let s:buf_nr = -1 +let s:last_word = '' + +if !exists('g:go_godoc_commands') + let g:go_godoc_commands = 1 +endif + +if g:go_godoc_commands + command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc() +endif + +nnoremap (godoc-keyword) :call Godoc('') + +function! s:GodocView() + if !bufexists(s:buf_nr) + leftabove new + file `="[Godoc]"` + let s:buf_nr = bufnr('%') + elseif bufwinnr(s:buf_nr) == -1 + leftabove split + execute s:buf_nr . 'buffer' + delete _ + elseif bufwinnr(s:buf_nr) != bufwinnr('%') + execute bufwinnr(s:buf_nr) . 'wincmd w' + endif + + setlocal filetype=godoc + setlocal bufhidden=delete + setlocal buftype=nofile + setlocal noswapfile + setlocal nobuflisted + setlocal modifiable + setlocal nocursorline + setlocal nocursorcolumn + setlocal iskeyword+=: + setlocal iskeyword-=- + + nnoremap K :Godoc + + au BufHidden call let buf_nr = -1 +endfunction + +function! s:GodocNotFound(content) + if !len(a:content) + return 1 + endif + + return a:content =~# '^.*: no such file or directory\n' +endfunction + +function! s:GodocWord(word) + if !executable('godoc') + echohl WarningMsg + echo "godoc command not found." + echo " install with: go get code.google.com/p/go.tools/cmd/godoc" + echohl None + return 0 + endif + let word = a:word + silent! let content = system('godoc ' . word) + if v:shell_error || !len(content) + if len(s:last_word) + silent! let content = system('godoc ' . s:last_word.'/'.word) + if v:shell_error || s:GodocNotFound(content) + echo 'No documentation found for "' . word . '".' + return 0 + endif + let word = s:last_word.'/'.word + else + echo 'No documentation found for "' . word . '".' + return 0 + endif + endif + let s:last_word = word + silent! call s:GodocView() + setlocal modifiable + silent! %d _ + silent! put! =content + silent! normal gg + setlocal nomodifiable + setfiletype godoc + return 1 +endfunction + +function! s:Godoc(...) + if !len(a:000) + let oldiskeyword = &iskeyword + setlocal iskeyword+=. + let word = expand('') + let &iskeyword = oldiskeyword + let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g') + let words = split(word, '\.\ze[^./]\+$') + else + let words = a:000 + endif + if !len(words) + return + endif + if s:GodocWord(words[0]) + if len(words) > 1 + if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s') + return + endif + if search('^func ' . words[1] . '(') + silent! normal zt + return + endif + echo 'No documentation found for "' . words[1] . '".' + endif + endif +endfunction + +" vim:ts=4:sw=4:et diff --git a/plugins/kaoriya/autoload/kaoriya/switch.vim b/plugins/kaoriya/autoload/kaoriya/switch.vim new file mode 100644 index 0000000000..df76100015 --- /dev/null +++ b/plugins/kaoriya/autoload/kaoriya/switch.vim @@ -0,0 +1,24 @@ +scriptencoding utf-8 +" vim:set ts=8 sts=2 sw=2 tw=0 et: +" +" Switches by existence of files in $VIM/switches/enabled directory. +" +" (ほぼ)起動時の$VIM/switches/enabledディレクトリ下のファイルの有無を調べるス +" イッチ. +" +" Last Change: 16-Sep-2011. +" Maintainer: MURAOKA Taro + +let g:kaoriya_switch = {} +for path in split(glob($VIM.'/switches/enabled/*.vim'), '\n') + let g:kaoriya_switch[fnamemodify(path, ':t:r')] = 1 +endfor + +function! kaoriya#switch#enabled(name) + if exists('g:kaoriya_switch') + if has_key(g:kaoriya_switch, a:name) + return g:kaoriya_switch[a:name] + endif + endif + return 0 +endfunction diff --git a/plugins/kaoriya/encode_japan.vim b/plugins/kaoriya/encode_japan.vim new file mode 100644 index 0000000000..7a340689ef --- /dev/null +++ b/plugins/kaoriya/encode_japan.vim @@ -0,0 +1,88 @@ +" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照) +" +" 日本語向けにエンコードを設定するサンプル - Vim7用 +" +" Last Change: 23-Apr-2013. +" Maintainer: MURAOKA Taro + +" 各エンコードを示す文字列のデフォルト値。s:CheckIconvCapabilityを()呼ぶことで +" 実環境に合わせた値に修正される。 +" +let s:enc_cp932 = 'cp932' +let s:enc_eucjp = 'euc-jp' +let s:enc_jisx = 'iso-2022-jp' +let s:enc_utf8 = 'utf-8' + +" 利用しているiconvライブラリの性能を調べる。 +" +" 比較的新しいJISX0213をサポートしているか検査する。euc-jisx0213が定義してい +" る範囲の文字をcp932からeuc-jisx0213へ変換できるかどうかで判断する。 +" +function! s:CheckIconvCapability() + if !has('iconv') | return | endif + if iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" + let s:enc_eucjp = 'euc-jisx0213,euc-jp' + let s:enc_jisx = 'iso-2022-jp-3' + else + let s:enc_eucjp = 'euc-jp' + let s:enc_jisx = 'iso-2022-jp' + endif +endfunction + +" 'fileencodings'を決定する。 +" +" 利用しているiconvライブラリの性能及び、現在利用している'encoding'の値に応じ +" て、日本語で利用するのに最適な'fileencodings'を設定する。 +" +function! s:DetermineFileencodings() + if !has('iconv') | return | endif + "let value = 'ucs-bom,ucs-2le,ucs-2' + let value = 'ucs-bom,latin1' + if &encoding ==? 'utf-8' + " UTF-8環境向けにfileencodingsを設定する + let value = s:enc_jisx. ','.s:enc_cp932. ','.s:enc_eucjp. ',ucs-bom' + elseif &encoding ==? 'cp932' + " CP932環境向けにfileencodingsを設定する + let value = value. ','.s:enc_jisx. ','.s:enc_utf8. ','.s:enc_eucjp + elseif &encoding ==? 'euc-jp' || &encoding ==? 'euc-jisx0213' + " EUC-JP環境向けにfileencodingsを設定する + let value = value. ','.s:enc_jisx. ','.s:enc_utf8. ','.s:enc_cp932 + else + " TODO: 必要ならばその他のエンコード向けの設定をココに追加する + endif + if has('guess_encode') + let value = 'guess,'.value + endif + let &fileencodings = value +endfunction + +"=========================================================================== +" パスに日本語を含む際にencを変更した場合の処置. + +let s:last_enc = &enc + +function! s:OnEncodingChanged() + " runtimepath(rtp)を変換する. + if s:last_enc !=# &enc + if has('iconv') + let &rtp = iconv(&rtp, s:last_enc, &enc) + endif + let s:last_enc = &enc + endif +endfunction + +augroup EncodeJapan +autocmd! +autocmd EncodingChanged * call OnEncodingChanged() +augroup END + +"=========================================================================== +" 本ファイルを読み込み(sourceした)時に、最適な設定を実行する。 +" +if kaoriya#switch#enabled('utf-8') + set encoding=utf-8 +else + set encoding=japan +endif +call s:CheckIconvCapability() +call s:DetermineFileencodings() diff --git a/plugins/kaoriya/keymap/azik_cp932.vim b/plugins/kaoriya/keymap/azik_cp932.vim new file mode 100644 index 0000000000..c84772359d --- /dev/null +++ b/plugins/kaoriya/keymap/azik_cp932.vim @@ -0,0 +1,653 @@ +" Vim Keymap file for Japanese (AZIK) +" +" Maintainer: MURAOKA Taro +" Last Change: 06-Feb-2006. +" +" You can get more information about AZIK in here: +" http://hp.vector.co.jp/authors/VA002116/azik/azikindx.htm + +scriptencoding cp932 + +" Use this short name in the status line. +let b:keymap_name = "azik" + +loadkeymap + +' [ +, A +- [ +. B +: [ +; +a +b. +ba +bd ׂ +be +bh Ԃ +bi +bj Ԃ +bk т +bl ڂ +bn ΂ +bo +bp ڂ +bq ΂ +br ΂ +bt т +bu +bw ׂ +bx ׂ +bya т +byd т +bye т +byh тイ +byi т +byj т +byl т +byn т +byo т +byp т傤 +byq тႢ +byu т +byw т +byz т +bz ΂ +ca +cc +cd +ce +cf +ch イ +ci +cj +ck +cl +cn +co +cp 傤 +cq Ⴂ +cu +cv Ⴂ +cw +cx +cya +cye +cyi +cyo +cyu +cz +da +dch ł[ +dci ł +dck ł +dcp ǂ[ +dcu ł +dd ł +de +df +dg +dh  +di +dj  +dk +dl ǂ +dm ł +dn +do +dp ǂ +dq +dr ł +ds ł +dt +du +dv ł +dw ł +dy ł +dz +e +fa ӂ +fd ӂ +fe ӂ +fh ӂ +fi ӂ +fj ӂ +fk ӂ +fl ӂ +fm ӂ +fn ӂ +fo ӂ +fp ӂ[ +fq ӂ +fr ӂ +fs ӂ +fu +fw ӂ +fya ӂ +fye ӂ +fyi ӂ +fyo ӂ +fyu ӂ +fz ӂ +ga +gd +ge +gh +gi +gj +gk +gl +gn +go +gp +gq +gr +gt +gu +gw +gya +gyd +gye +gyh イ +gyi +gyj +gyl +gyn +gyo +gyp 傤 +gyq Ⴂ +gyu +gyw +gyz +gz +ha +hd ւ +he +hf +hga Ђ +hgd Ђ +hge Ђ +hgh Ђイ +hgj Ђ +hgl Ђ +hgn Ђ +hgo Ђ +hgp Ђ傤 +hgq ЂႢ +hgu Ђ +hgw Ђ +hgz Ђ +hh ӂ +hi +hj ӂ +hk Ђ +hl ق +hn ͂ +ho +hp ق +hq ͂ +ht Ђ +hu +hw ւ +hya Ђ +hyd Ђ +hye Ђ +hyh Ђイ +hyi Ђ +hyl Ђ +hyo Ђ +hyp Ђ傤 +hyq ЂႢ +hyu Ђ +hyw Ђ +hyz Ђ +hz ͂ +i +ja +jd +je +jf +jh イ +ji +jj +jk +jl +jn +jo +jp 傤 +jq Ⴂ +ju +jv イ +jw +jya +jye +jyi +jyo +jyu +jz +kA +kE +ka +kd +ke +kf +kga +kgd +kge +kgh イ +kgl +kgn +kgo +kgp 傤 +kgq Ⴂ +kgu +kgw +kgz +kh +ki +kj +kk +kl +km +kn +ko +kp +kq +kr +kt +ku +kv +kw +kya +kyd +kye +kyh イ +kyi +kyj +kyl +kyn +kyo +kyp 傤 +kyq Ⴂ +kyu +kyw +kyz +kz +la +le +li +lka +lke +lo +ltu +lu +lwa +lya +lye +lyi +lyo +lyu +m. +ma +md ߂ +me +mf +mga ݂ +mgd ݂ +mge ݂ +mgh ݂イ +mgj ݂ +mgl ݂ +mgn ݂ +mgo ݂ +mgp ݂傤 +mgq ݂Ⴂ +mgu ݂ +mgw ݂ +mgz ݂ +mh ނ +mi +mj ނ +mk ݂ +ml +mn +mo +mp +mq ܂ +mr ܂ +ms ܂ +mt ܂ +mu +mv ނ +mw ߂ +mya ݂ +myd ݂ +mye ݂ +myh ݂イ +myi ݂ +myj ݂ +myl ݂ +myn ݂ +myo ݂ +myp ݂傤 +myq ݂Ⴂ +myu ݂ +myw ݂ +myz ݂ +mz ܂ +n' +n. +na +nb ˂ +nd ˂ +ne +nf +nga ɂ +ngd ɂ +nge ɂ +ngh ɂイ +ngj ɂ +ngl ɂ +ngn ɂ +ngo ɂ +ngp ɂ傤 +ngq ɂႢ +ngu ɂ +ngw ɂ +ngz ɂ +nh ʂ +ni +nj ʂ +nk ɂ +nl ̂ +nn +no +np ̂ +nq Ȃ +nr Ȃ +nt ɂ +nu +nv ʂ +nw ˂ +nya ɂ +nyd ɂ +nye ɂ +nyh ɂイ +nyi ɂ +nyj ɂ +nyl ɂ +nyn ɂ +nyo ɂ +nyp ɂ傤 +nyq ɂႢ +nyu ɂ +nyw ɂ +nyz ɂ +nz Ȃ +o +pa +pd ؂ +pe +pf ۂ +pga ҂ +pgd ҂ +pge ҂ +pgh ҂イ +pgj ҂ +pgl ҂ +pgn ҂ +pgo ҂ +pgp ҂傤 +pgq ҂Ⴂ +pgu ҂ +pgw ҂ +pgz ҂ +ph Ղ +pi +pj Ղ +pk ҂ +pl ۂ +pn ς +po +pp ۂ +pq ς +pu +pv ۂ +pw ؂ +pya ҂ +pyd ҂ +pye ҂ +pyh ҂イ +pyi ҂ +pyj ҂ +pyl ҂ +pyn ҂ +pyo ҂ +pyp ҂傤 +pyq ҂Ⴂ +pyu ҂ +pyw ҂ +pyz ҂ +pz ς +q +ra +rd +re +rh 邤 +ri +rj +rk +rl +rn +ro +rp 낤 +rq 炢 +rr +ru +rw ꂢ +rya +ryd 肥 +rye 肥 +ryh イ +ryi 股 +ryj +ryk 傭 +ryl +ryn +ryo +ryp 傤 +ryq Ⴂ +ryu +ryw 肥 +ryz +rz +sa +sd +se +sf +sh +si +sj +sk +sl +sm +sn +so +sp +sq +sr +ss +st +su +sv +sw +sya +syd +sye +syh イ +syi +syj +syl +syo +syp 傤 +syq Ⴂ +syu +syw +syz +sz +tU +ta +tb +td Ă +te +tgh Ă[ +tgi Ă +tgk Ă +tgp Ƃ[ +tgu Ă +th ‚ +ti +tj ‚ +tk +tl Ƃ +tm +tn +to +tp Ƃ +tq +tr +tsU +tsa ‚ +tse ‚ +tsi ‚ +tso ‚ +tsu +tt +tu +tw Ă +tya +tyd +tye +tyh イ +tyj +tyl +tyn +tyo +typ 傤 +tyq Ⴂ +tyu +tyw +tyz +tz +u +va +vd +ve +vi +vk +vl +vn +vo +vp [ +vq +vu +vw +vya +vye +vyi +vyo +vyu +vz +wA +wa +wd +we +wf +wha +whe +whi +who +whu +wi +wk +wl +wn +wo +wp [ +wq 킢 +wr +wso +wt 킽 +wu +wz +xa +xc +xd +xe +xh イ +xi +xj +xk +xl +xn +xo +xp 傤 +xq Ⴂ +xt +xu +xv Ⴂ +xw +xx +xz +y< +y> +y^ +ya +yf +yh 䂤 +yi +yj +yl +yn +yo +yp 悤 +yq ₢ +yr +yu +yv 䂤 +yz +z. +za +zc +zd +ze +zf +zh +zi +zj +zk +zl +zn +zo +zp +zq +zr +zu +zv +zw +zx +zya +zyd +zye +zyh イ +zyi +zyj +zyl +zyn +zyo +zyp 傤 +zyq Ⴂ +zyu +zyw +zyz +zz diff --git a/plugins/kaoriya/keymap/japanese_cp932.vim b/plugins/kaoriya/keymap/japanese_cp932.vim new file mode 100644 index 0000000000..ba572cd90b --- /dev/null +++ b/plugins/kaoriya/keymap/japanese_cp932.vim @@ -0,0 +1,666 @@ +" Vim Keymap file for Japanese (ROMA) +" Maintainer: MURAOKA Taro +" Last Change: 06-Feb-2006. + +scriptencoding cp932 + +" Use this short name in the status line. +let b:keymap_name = "jpn" + +loadkeymap + +" s +a +i +u +e +o + +xa +xi +xu +xe +xo + +A A +I C +U E +E G +O I + +xA @ +xI B +xU D +xE F +xO H + +va @ +vA @ +vi B +vI B +vu +vU +ve F +vE F +vo H +vO H + +" s +ka +ki +ku +ke +ko + +kya +kyu +kyo + +ga +gi +gu +ge +go + +gya +gyu +gyo + +kA J +kI L +kU N +kE P +kO R + +kyA L +kyU L +kyO L + +gA K +gI M +gU O +gE Q +gO S + +gyA M +gyU M +gyO M + +" s +sa +si +su +se +so + +sya +syu +syo + +za +zi +ji +zu +ze +zo + +zya +jya +zyu +jyu +zyo +jyo + +sA T +sI V +sU X +sE Z +sO \ + +syA V +syU V +syO V + +zA U +zI W +zU Y +zE [ +zO ] + +zyA W +zyU W +zyO W + +" s +ta +ti +chi +tu +tsu +te +to + +tya +cha +tyu +chu +tyo +cho + +da +di +du +dsu +de +do + +dya +dyu +dyo + +xtu +xtsu + +tA ^ +tI ` +chI ` +tU c +tsU c +tE e +tO g + +tyA ` +chA ` +tyU ` +chU ` +tyO ` +chO ` + +dA _ +dI a +dU d +dsU d +dE f +dO h + +dyA a +dyU a +dyO a + +xtU b +xtsU b + +" ȍs +na +ni +nu +ne +no + +nya ɂ +nyu ɂ +nyo ɂ + +nA i +nI j +nU k +nE l +nO m + +nyA j +nyU j +nyO j + +" ͍s +ha +hi +hu +he +ho + +hya Ђ +hyu Ђ +hyo Ђ + +ba +bi +bu +be +bo + +bya т +byu т +byo т + +pa +pi +pu +pe +po + +pya ҂ +pyu ҂ +pyo ҂ + +hA n +hI q +hU t +hE w +hO z + +hyA q +hyU q +hyO q + +bA o +bI r +bU u +bE x +bO { + +byA r +byU r +byO r + +pA p +pI s +pU v +pE y +pO | + +pyA s +pyU s +pyO s + +" ܍s +ma +mi +mu +me +mo + +mya ݂ +myu ݂ +myo ݂ + +mA } +mI ~ +mU +mE +mO + +myA ~ +myU ~ +myO ~ + +" s +ya +yu +yo + +xya +xyu +xyo + +yA +yU +yO + +xyA +xyU +xyO + +" s +ra +ri +ru +re +ro + +rya +ryu +ryo + +rA +rI +rU +rE +rO + +ryA +ryU +ryO + +" s +wa +wi +we +wo + +wA +wI +wE +wO + +" +nn +nN + +" +xxa +xxi +xxu +xxe +xxo + +xxA b@ +xxI bB +xxU bD +xxE bF +xxO bH + +vva b@ +vvA b@ +vvi bB +vvI bB +vvu b +vvU b +vve bF +vvE bF +vvo bH +vvO bH + +kka +kki +kku +kke +kko + +kkya +kkyu +kkyo + +gga +ggi +ggu +gge +ggo + +ggya +ggyu +ggyo + +kkA bJ +kkI bL +kkU bN +kkE bP +kkO bR + +kkyA bL +kkyU bL +kkyO bL + +ggA bK +ggI bM +ggU bO +ggE bQ +ggO bS + +ggyA bM +ggyU bM +ggyO bM + +ssa +ssi +ssu +sse +sso + +ssya +ssyu +ssyo + +zza +zzi +jji +zzu +zze +zzo + +zzya +jjya +zzyu +jjyu +zzyo +jjyo + +ssA bT +ssI bV +ssU bX +ssE bZ +ssO b\ + +ssyA bV +ssyU bV +ssyO bV + +zzA bU +zzI bW +zzU bY +zzE b[ +zzO b] + +zzyA bW +zzyU bW +zzyO bW + +tta +tti +cchi +ttu +ttsu +tte +tto + +ttya +ccha +ttyu +cchu +ttyo +ccho + +dda +ddi +ddu +ddsu +dde +ddo + +ddya +ddyu +ddyo + +xxtu +xxtsu + +ttA b^ +ttI b` +cchI b` +ttU bc +ttsU bc +ttE be +ttO bg + +ttyA b` +cchA b` +ttyU b` +cchU b` +ttyO b` +cchO b` + +ddA b_ +ddI ba +ddU bd +ddsU bd +ddE bf +ddO bh + +ddyA ba +ddyU ba +ddyO ba + +xxtU bb +xxtsU bb + +" nna +" nni +" nnu +" nne +" nno + +" nnya ɂ +" nnyu ɂ +" nnyo ɂ + +" nnA bi +" nnI bj +" nnU bk +" nnE bl +" nnO bm + +" nnyA bj +" nnyU bj +" nnyO bj + +hha +hhi +hhu +hhe +hho + +hhya Ђ +hhyu Ђ +hhyo Ђ + +bba +bbi +bbu +bbe +bbo + +bbya т +bbyu т +bbyo т + +ppa +ppi +ppu +ppe +ppo + +ppya ҂ +ppyu ҂ +ppyo ҂ + +hhA bn +hhI bq +hhU bt +hhE bw +hhO bz + +hhyA bq +hhyU bq +hhyO bq + +bbA bo +bbI br +bbU bu +bbE bx +bbO b{ + +bbyA br +bbyU br +bbyO br + +ppA bp +ppI bs +ppU bv +ppE by +ppO b| + +ppyA bs +ppyU bs +ppyO bs + +mma +mmi +mmu +mme +mmo + +mmya ݂ +mmyu ݂ +mmyo ݂ + +mmA b} +mmI b~ +mmU b +mmE b +mmO b + +mmyA b~ +mmyU b~ +mmyO b~ + +yya +yyu +yyo + +xxya +xxyu +xxyo + +yyA b +yyU b +yyO b + +xxyA b +xxyU b +xxyO b + +rra +rri +rru +rre +rro + +rrya +rryu +rryo + +rrA b +rrI b +rrU b +rrE b +rrO b + +rryA b +rryU b +rryO b + +wwa +wwi +wwe +wwo + +wwA b +wwI b +wwE b +wwO b + +" L +- [ +, A +. B +[ u +] v diff --git a/plugins/kaoriya/keymap/tcode_cp932.vim b/plugins/kaoriya/keymap/tcode_cp932.vim new file mode 100644 index 0000000000..e04c3c4a8e --- /dev/null +++ b/plugins/kaoriya/keymap/tcode_cp932.vim @@ -0,0 +1,1407 @@ +" Vim Keymap file for T-CODE (Japanese) +" Maintainer: FUJITA Yasuhiro +" Past Maintainer: Takasuka Yoshihiro +" Last Change: 13-Oct-2004. + +scriptencoding cp932 + +" Use this short name in the status line. +let b:keymap_name = "tcode" + +loadkeymap + +q1 +w1 +e1 +r1 +t1 +y1 +u1 +i1 n +o1 T +p1 +a1 +s1 +d1 +h1 +j1 v +k1 +l1 +;1 +n1 +m1 @ +,1 +.1 { +/1 +q2 N +w2 P +e2 +r2 +t2 g +y2 +u2 +i2 +o2 +p2 +a2 +s2 +d2 +f2 +h2 v +j2 +k2 +l2 +;2 r +n2 D +m2 +,2 +.2 +/2 +q3 S +w3 +e3 +r3 +t3 +y3 +u3 +i3 +o3 u +p3 +a3 +s3 +d3 e +f3 p +g3 +h3 N +j3 k +k3 i +l3 +;3 +n3 +m3 w +,3 +.3 ~ +/3 +q4 +w4 +e4 +r4 @ +t4 k +y4 z +u4 +i4 +o4 b +p4 +a4 I +s4 +d4 +f4 +g4 +h4 M +j4 +k4 G +l4 +;4 +n4 +m4 +,4 F +.4 +/4 +q5 +w5 ^ +e5 e +r5 m +y5 p +u5 +i5 +o5 +p5 +h5 O +j5 +k5 +l5 +;5 +n5 +m5 +,5 U +.5 +/5 +q6 +w6 +e6 +r6 +t6 +a6 +s6 +d6 w +f6 +g6 +z6 +x6 +c6 +v6 +b6 b +q7 [ +w7 +e7 X +r7 +t7 Q +u7 +i7 +o7 J +p7 +a7 g +s7 +d7 +f7 +g7 E +h7 l +j7 +k7 t +l7 +z7 +x7 +c7 +v7 +b7 +q8 +w8 +e8 +r8 +t8 +y8 +u8 +i8 +o8 +p8 +a8 +s8 [ +d8 i +f8 r +g8 \ +z8 +x8 c +c8 +v8 +b8 +q9 k +w9 +e9 +r9 D +t9 +u9 T +i9 @ +o9 +p9 +a9 +s9 | +d9 +f9 +g9 +z9 A +x9 +c9 +v9 O +b9 N +q0 O +w0 +e0 [ +r0 i +t0 +y0 +u0 +i0 +o0 +p0 +a0 +s0 +d0 { +f0 +g0 +z0 j +x0 +c0 n +v0 w +b0 +1q +2q +3q +4q [ +5q c +6q _ +7q +8q Y +9q +0q +qq +wq +eq +rq +tq _ +yq +uq +iq +oq +pq J +aq +sq +dq +fq +gq +hq +jq +kq +lq +;q +zq +xq +cq +vq +bq P +nq +mq +,q I +.q +/q +1w D +2w +3w +4w f +5w +6w f +7w { +8w +9w +0w +qw T +ww +ew +rw R +tw +yw L +uw +iw +ow S +pw +aw +sw +dw +fw X +gw +hw +jw +kw +lw +;w A +zw +xw j +cw +vw +bw +nw t +mw v +,w +.w +/w +1e +2e +3e +4e g +5e +6e U +7e +8e +9e +0e [ +qe +we c +ee +re +te ! +ye +ue o +ie ^ +oe +pe +ae +se +de +fe +ge E +he 7 +je +ke ( +le g +;e +ze ] +xe +ce +ve +be +ne +me H +,e +.e e +/e +1r a +2r +3r r +4r +5r +6r +7r +8r +9r +0r g +qr +wr K +er \ +rr _ +tr +yr R +ur R +ir +or +pr +ar +sr +dr h +fr +gr o +hr +jr +kr +lr +;r +zr K +xr +cr +vr F +br +nr +mr +,r +.r @ +/r ` +1t d +2t +3t +4t +5t +6t D +7t +8t +9t +0t +qt +wt +et +rt y +tt +yt i +ut +it } +ot a +pt +at +st +dt +ft +gt +ht +jt +kt 8 +lt +;t N +zt +xt +ct +vt +bt L +nt T +mt +,t p +.t +/t +1y +2y +3y G +4y @ +5y A +7y +8y +9y +0y +qy Q +wy +ey +ry y +ty ] +yy +uy @ +iy +oy Y +py k +ay +sy +dy C +fy +gy L +hy +jy +ky +ly m +;y +zy +xy +cy +vy +by +ny +my Z +,y +.y +/y s +1u +2u +3u +4u r +5u +7u +8u +9u +0u +qu +wu +eu +ru +tu p +yu +uu +iu +ou } +pu +au +su R +du +fu +gu | +hu h +ju +ku W +lu +;u +zu z +xu \ +cu +vu { +bu j +nu +mu H +,u +.u +/u +1i +2i +3i +4i M +5i +7i M +8i S +9i ~ +0i +qi +wi G +ei +ri t +ti K +yi L +ui +ii m +oi +pi +ai +si +di J +fi +gi +hi Z +ji ^ +ki c +li +;i J +zi @ +xi +ci F +vi +bi +ni +mi U +,i +.i O +/i +1o +2o [ +3o +4o +5o Q +7o ^ +8o u +9o +0o r +qo +wo +eo f +ro +to +yo +uo +io m +oo +po B +ao t +so +do +fo +go +ho _ +jo +ko +lo +;o +zo E +xo +co +vo +bo +no +mo +,o +.o +/o +1p +2p +3p +4p +5p +8p +9p +qp +wp z +ep +rp +tp ~ +yp +up +ip +op +pp +ap +sp +dp +fp R +gp m +hp D +jp +kp i +lp +;p +zp +xp +cp H +vp +bp +np +mp +,p +.p +/p +1a +2a +3a +4a +5a H +6a +7a +8a +9a +0a +qa +wa +ea +ra +ta D +ya +ua X +ia +oa +pa +aa +sa +da +fa i +ga ^ +ha 3 +ja +ka Z +la +;a +za q +xa ] +ca +va l +ba +na b +ma l +,a O +.a +/a +1s +2s +3s | +4s +5s R +6s T +7s +8s +9s +0s +qs +ws Y +es +rs +ts +ys +us +is +os +ps +as +ss n +ds +fs +gs +hs [ +js +ks +ls +;s +zs y +xs v +cs +vs +bs +ns +ms N +,s +.s +/s t +1d +2d A +3d +4d +5d ` +6d +7d w +8d +9d +0d @ +qd w +wd +ed +rd +td F +yd +ud 4 +id ) +od \ +pd +ad +sd y +dd +fd +gd Q +hd +jd A +kd +ld 5 +;d 1 +zd +xd ` +cd Z +vd +bd +nd +md +,d +.d +/d l +1f +2f B +3f +4f +5f +6f N +7f +8f +9f +0f W +qf +wf i +ef +rf K +tf +yf +uf +if 6 +of w +pf +af +sf \ +df +ff +gf r +hf B +jf +kf 0 +lf E +;f 2 +zf +xf +cf R +vf +bf +nf +mf C +,f +.f d +/f n +1g +2g +3g +4g +5g +6g +7g ] +8g x +9g +0g +qg v +wg p +eg L +rg +tg +yg { +ug +ig +og +pg V +ag p +sg { +dg +fg +gg +hg +jg +kg +lg +;g +zg ] +xg +cg +vg g +bg +ng +mg +,g u +.g +/g +1h +2h x +3h b +4h v +5h +7h +8h +9h +0h +qh a +wh I +eh N +rh H +th z +yh +uh +ih +oh w +ph +ah +sh K +dh u +fh +gh +hh v +jh +kh +lh +;h L +zh f +xh +ch +vh e +bh +nh z +mh +,h u +.h +/h y +1j w +2j +3j +4j +5j +7j +8j +9j Y +0j +qj +wj +ej +rj h +tj +yj P +uj +ij +oj +pj j +aj A +sj ` +dj +fj +gj +hj A +jj S +kj +lj +;j x +zj +xj i +cj \ +vj +bj +nj +mj S +,j +.j M +/j +1k +2k +3k +4k +5k G +7k +8k r +9k O +0k +qk +wk +ek +rk ` +tk +yk b +uk +ik +ok _ +pk +ak +sk D +dk +fk +gk +hk f +jk +kk G +lk +;k x +zk +xk +ck +vk +bk +nk +mk K +,k +.k Z +/k +1l +2l +3l +4l +5l +7l +9l +0l b +ql +wl +el e +rl +tl E +yl +ul +il \ +ol _ +pl +al +sl +dl z +fl +gl +hl +jl +kl V +ll +;l +zl +xl q +cl t +vl +bl +nl m +ml +,l d +.l +/l e +1; x +2; Y +3; +4; _ +5; +7; +8; +9; +q; +w; u +e; +r; +t; +y; +u; ] +i; +o; +p; W +a; w +s; i +d; q +f; z +g; a +h; +j; f +k; +l; +;; +z; ` +x; +c; +v; +b; +n; +m; O +,; +.; +/; +1z +3z +6z +7z +8z +9z +0z +qz +wz n +ez +rz o +tz +yz X +uz +iz +oz +pz +az +sz F +dz +fz +gz +hz s +jz h +kz ~ +lz +;z W +zz +xz +cz +vz +bz % +nz C +mz +,z +.z +/z +1x +6x I +7x j +8x S +9x R +0x +qx B +wx +ex K +rx Z +tx J +yx S +ux +ix +ox c +px +ax { +sx +dx +fx Z +gx +hx +jx J +kx +lx +;x +zx +xx K +cx +vx l +bx M +nx +mx +,x +.x E +/x O +1c +6c [ +7c +8c +9c +0c +qc +wc n +ec +rc +tc M +yc o +uc +ic Z +oc o +pc +ac +sc +dc z +fc +gc @ +hc +jc +kc \ +lc +;c +zc +xc g +cc +vc +bc +nc s +mc +,c +.c +/c I +1v +6v +7v ^ +8v +9v +0v +qv +wv +ev +rv +tv +yv +uv +iv +ov j +pv Y +av +sv { +dv x +fv +gv q +hv V +jv v +kv 9 +lv q +;v +zv +xv T +cv +vv t +bv h +nv +mv +,v r +.v +/v s +1b +6b b +7b +8b j +9b e +0b +qb +wb +eb +rb +tb +yb +ub +ib +ob Z +pb k +ab +sb +db +fb ] +gb +hb +jb c +kb +lb O +;b +zb x +xb +cb +vb +bb +nb C +mb +,b +.b s +/b +1n ~ +2n +3n +4n q +5n N +qn A +wn +en +rn +tn Q +yn +un H +in +on +pn +an +sn ^ +dn +fn z +gn +hn x +jn +kn p +ln \ +;n +zn } +xn +cn +vn [ +bn g +nn +mn S +,n E +.n +/n +1m +2m +3m +4m ] +5m V +qm +wm +em +rm B +tm +ym +um Y +im +om j +pm +am F +sm +dm +fm +gm d +hm +jm +km +lm n +;m +zm V +xm +cm +vm X +bm +nm +mm l +,m ` +.m +/m +1, +2, +3, +4, +5, +q, | +w, +e, +r, +t, +y, i +u, } +i, +o, +p, +a, +s, +d, +f, h +g, U +h, +j, +k, | +l, +;, ~ +z, B +x, +c, +v, +b, +n, c +m, v +,, v +., H +/, +1. +2. +3. ? +4. +5. +q. +w. C +e. +r. +t. { +y. +u. +i. Y +o. +p. +a. +s. W +d. x +f. ^ +g. N +h. g +j. I +k. } +l. +;. +z. +x. +c. +v. +b. V +n. +m. +,. +.. +/. ^ +1/ +2/ X +3/ +4/ +5/ +q/ u +w/ +e/ q +r/ w +t/ [ +y/ S +u/ +i/ +o/ +p/ +a/ +s/ l +d/ +f/ ~ +g/ +h/ +j/ +k/ k +l/ c +;/ +z/ +x/ +c/ +v/ +b/ P +n/ g +m/ s +,/ +./ +// Y +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +0 0 +q q +w w +e e +r r +t t +y y +u u +i i +o o +p p +a a +s s +d d +f f +g g +h h +j j +k k +l l +; ; +z z +x x +c c +v v +b b +n n +m m +, , +. . +/ / diff --git a/plugins/kaoriya/keymap/tutcode_cp932.vim b/plugins/kaoriya/keymap/tutcode_cp932.vim new file mode 100644 index 0000000000..88ec95c859 --- /dev/null +++ b/plugins/kaoriya/keymap/tutcode_cp932.vim @@ -0,0 +1,2826 @@ +" Vim Keymap file for Japanese (TUT-Code) +" Maintainer: KIHARA, Hideto +" Last Change: 18-Sep-2002. + +scriptencoding cp932 + +" Use this short name in the status line. +let b:keymap_name = "tutcode" + +loadkeymap + +rk +ri +ru +rh +rj +ek +ei +eu +eh +ej +sk +si +su +sh +sj +dk +di +du +dh +dj +fk +fi +fu +fh +fj +tk +ti +tu +th +tj +wk +wi +wu +wh +wj +qk +qu +qj +gk +gi +gu +gh +gj +ak +ai +ah +aj +rlk +rli +rlu +rlru +rlh +rlj +elk +elek +eli +elu +elh +eleh +elj +slk +sli +slu +slh +slj +dlk +dli +dlu +dldu +dlh +dlj +fl +tlk +tli +tlu +tlh +tlj +tltk +tlti +tltu +tlth +tltj +qlk +qlu +qlj +alk +Rk A +Ri C +Ru E +Rh G +Rj I +Ek J +Ei L +Eu N +Eh P +Ej R +Sk T +Si V +Su X +Sh Z +Sj \ +Dk ^ +Di ` +Du c +Dh e +Dj g +Fk i +Fi j +Fu k +Fh l +Fj m +Tk n +Ti q +Tu t +Th w +Tj z +Wk } +Wi ~ +Wu +Wh +Wj +Qk +Qu +Qj +Gk +Gi +Gu +Gh +Gj +Ak +Ai +Ah +Aj +Rlk @ +Rli B +Rlu D +Rlru +Rlh F +Rlj H +Elk K +Elek +Eli M +Elu O +Elh Q +Eleh +Elj S +Slk U +Sli W +Slu Y +Slh [ +Slj ] +Dlk _ +Dli a +Dlu b +Dldu d +Dlh f +Dlj h +Fl +Tlk o +Tli r +Tlu u +Tlh x +Tlj { +Tltk p +Tlti s +Tltu v +Tlth y +Tltj | +Qlk +Qlu +Qlj +Alk +RK A +RI C +RU E +RH G +RJ I +EK J +EI L +EU N +EH P +EJ R +SK T +SI V +SU X +SH Z +SJ \ +DK ^ +DI ` +DU c +DH e +DJ g +FK i +FI j +FU k +FH l +FJ m +TK n +TI q +TU t +TH w +TJ z +WK } +WI ~ +WU +WH +WJ +QK +QU +QJ +GK +GI +GU +GH +GJ +AK +AI +AH +AJ +RLK @ +RLI B +RLU D +RLRU +RLH F +RLJ H +ELK K +ELEK +ELI M +ELU O +ELH Q +ELEH +ELJ S +SLK U +SLI W +SLU Y +SLH [ +SLJ ] +DLK _ +DLI a +DLU b +DLDU d +DLH f +DLJ h +FL +TLK o +TLI r +TLU u +TLH x +TLJ { +TLTK p +TLTI s +TLTU v +TLTH y +TLTJ | +QLK +QLU +QLJ +ALK +q g +w +e [ +E [ +r y +t u +y v +u z +i c +o E +O E +p h +a e +s +d A +f B +g w +h x +j X +k +l _ +; f +z Y +x +c +v +b +n +m ~ +, s +. t +/ ^ +,, +,. +,/ +,; +,a q +,b i +,c h +,d s +,e +,f +,g +,i +,j +,k H +,l +,o +,p +,q +,r +,s +,t i +,u +,v +,w +,x +,z ~ +., +.. +./ +.; +.a H +.b H +.c +.d x +.e +.f +.g +.i \ +.j ^ +.k +.l s +.o i +.p B +.q G +.r x +.s _ +.t g +.u +.v j +.w z +.x | +.z Z +/, J +/. +// i +/; +/a +/b +/c g +/d X +/e a +/f n +/g +/i X +/j +/k +/l +/o +/p +/q +/r L +/s +/t +/u +/v +/w p +/x +/z Y +;, +;. +;/ } +;; +;a +;b | +;c ] +;d s +;e k +;f +;g +;i Z +;j +;k W +;l +;o i +;p +;q +;r +;s +;t +;u e +;v +;w +;x +;z +a, +a. \ +a/ m +a; +aa [ +ac +ad +ae V +af +am +an +ao +ap +aq +ar +as +au +aw +ax +ay +az +b, +b. +b/ +b; h +ba +bc j +bd +be +bf +bh +bi +bj +bk +bl v +bm +bn +bo g +bp +bq n +br +bs +bu +bw } +bx +by +bz F +c, +c. +c/ +c; ` +ca +cc +cd +ce +cf h +ch +ci +cj +ck +cl } +cm +cn +co +cp +cq +cr { +cs +cu +cw +cx o +cy +cz n +d, +d. +d/ l +d; +da +dc +dd S +de e +df +dm +dn b +do l +dp +dq +dr +ds +dw +dx +dy +dz X +e, J +e. w +e/ +e; +ea c +ec +ed +ee +ef +em k +en +eo +ep c +eq +er M +es c +ew +ex +ey q +ez +f, X +f. +f/ ] +f; +fa +fc +fd +fe +ff +fm +fn +fo +fp +fq +fr +fs +fw +fx +fy +fz +g, j +g. +g/ K +g; +ga K +gc +gd Z +ge ^ +gf +gl +gm d +gn _ +go +gp +gq +gr v +gs +gw z +gx +gy +gz +h, +h. +h/ +h; +ha +hb R +hc +hd +he +hf V +hg ~ +hi A +hj +hk +hl +ho R +hp +hq +hr R +hs +ht +hu +hv +hw +hx l +hz +i, q +i. +i/ +i; +ia +ib E +ic f +id +ie +if +ig +ii v +ij +ik Z +il +io +ip +iq m +ir +is O +it +iu y +iv +iw +ix K +iz | +j, +j. ~ +j/ +j; +ja t +jb y +jc J +jd +je +jf N +jg l +ji +jj +jk +jl +jo +jp +jq +jr d +js +jt +ju +jv +jw +jx +jz F +k, +k. R +k/ +k; +ka o +kb _ +kc +kd +ke O +kf +kg \ +ki +kj +kk +kl +ko +kp +kq s +kr +ks c +kt +ku p +kv +kw +kx +kz +l, t +l. E +l/ K +l; +la +lb +lc +ld +le +lf +lg +li +lj +lk +ll +lo +lp F +lq ^ +lr +ls +lt +lu E +lv +lw +lx +lz +m, Q +m. +m/ +m; +ma t +mb +mc +md C +me h +mf Y +mg +mi f +mj l +mk l +ml +mo { +mp S +mq z +mr +ms +mt +mu V +mv K +mw +mx +mz z +n, +n. +n/ +n; +na +nb +nc +nd } +ne +nf +ng +ni R +nj +nk _ +nl +no +np t +nq +nr +ns +nt +nu +nv +nw +nx +nz U +o, +o. +o/ +o; e +oa m +ob Y +oc +od Z +oe +of +og +oi +oj S +ok +ol +oo +op +oq D +or +os S +ot +ou +ov +ow w +ox J +oz +p, +p. +p/ +p; +pa +pb t +pc +pd +pe S +pf +pg O +pi \ +pj +pk ] +pl +po +pp +pq v +pr c +ps +pt x +pu I +pv +pw +px +pz B +q, g +q. +q/ W +q; +qa O +qc +qd +qe +qf x +qh +qi +qm u +qn K +qo +qp z +qq +qr +qs +qw ` +qx +qy H +qz +r, +r. +r/ A +r; +ra +rc +rd i +re D +rf +rm +rn +ro +rp +rq +rr +rs Q +rw +rx C +ry o +rz M +s, I +s. +s/ +s; +sa +sc +sd L +se +sf +sm +sn +so +sp +sq a +sr L +ss +sw d +sx ] +sy +sz +t, +t. +t/ +t; W +ta ` +tc +td +te +tf +tm +tn +to I +tp @ +tq +tr +ts +tw ` +tx +ty s +tz +u, +u. z +u/ P +u; q +ua +ub { +uc +ud { +ue n +uf +ug +ui \ +uj +uk x +ul p +uo @ +up +uq +ur +us +ut a +uu y +uv r +uw Y +ux T +uz +v, w +v. ^ +v/ +v; +va u +vc +vd +ve y +vf f +vh g +vi v +vj +vk +vl +vm +vn +vo p +vp +vq +vr A +vs +vu m +vw +vx +vy +vz +w, ^ +w. Z +w/ +w; +wa E +wc +wd +we +wf +wl +wm { +wn +wo C +wp \ +wq +wr +ws +ww +wx K +wy +wz +x, +x. +x/ +x; +xa +xc +xd +xe +xf +xh +xi i +xj +xk L +xl +xm z +xn F +xo +xp +xq H +xr V +xs P +xu +xw Z +xx +xy +xz +y, +y. +y/ +y; +ya +yb +yc +yd w +ye +yf H +yg +yi +yj +yk +yl +yo +yp +yq +yr +ys @ +yt +yu +yv +yw +yx +yz +z, N +z. +z/ +z; u +za t +zc +zd ] +ze +zf +zh +zi +zj +zk +zl C +zm +zn +zo +zp B +zq L +zr +zs +zu D +zw +zx +zy +zz G +,ha } +,hb +,hc +,hd [ +,he +,hf G +,hg +,hq C +,hr R +,hs +,ht f +,hv +,hw a +,hx +,hz k +,ma ~ +,mb +,mc m +,md +,me +,mf J +,mg +,mq +,mr t +,ms +,mt +,mv +,mw +,mx ` +,mz +,na +,nb +,nc +,nd @ +,ne +,nf B +,ng +,nq +,nr +,ns +,nt +,nv \ +,nw +,nx +,nz ] +,ya q +,yb m +,yc +,yd +,ye +,yf m +,yg z +,yq +,yr +,ys +,yt +,yv +,yw +,yx +,yz l +.ha +.hb +.hc +.hd +.he +.hf +.hg +.hq y +.hr +.hs +.ht +.hv +.hw +.hx c +.hz G +.ma G +.mb +.mc +.md +.me ] +.mf +.mg +.mq +.mr +.ms +.mt t +.mv +.mw +.mx +.mz +.na +.nb +.nc +.nd +.ne +.nf N +.ng s +.nq B +.nr +.ns +.nt +.nv +.nw +.nx o +.nz e +.ya +.yb C +.yc +.yd +.ye +.yf +.yg +.yq I +.yr I +.ys +.yt +.yv z +.yw +.yx O +.yz ` +/ha +/hb +/hc +/hd +/he +/hf +/hg I +/hq +/hr +/hs d +/ht +/hv +/hw +/hx +/hz +/ma e +/mb +/mc +/md x +/me E +/mf +/mg +/mq +/mr o +/ms ` +/mt Z +/mv +/mw M +/mx +/mz +/na G +/nb +/nc o +/nd +/ne +/nf +/ng J +/nq +/nr g +/ns +/nt +/nv V +/nw +/nx +/nz +/ya +/yb K +/yc I +/yd +/ye +/yf +/yg +/yq +/yr +/ys +/yt +/yv +/yw W +/yx +/yz +;ha a +;hb +;hc d +;hd +;he +;hf D +;hg +;hq q +;hr +;hs +;ht b +;hv +;hw +;hx | +;hz Q +;ma +;mb f +;mc +;md b +;me +;mf +;mg Z +;mq +;mr +;ms +;mt +;mv +;mw +;mx +;mz +;na @ +;nb +;nc d +;nd +;ne +;nf +;ng +;nq ] +;nr +;ns c +;nt +;nv +;nw +;nx +;nz F +;ya ` +;yb +;yc +;yd +;ye +;yf b +;yg +;yq K +;yr +;ys P +;yt +;yv +;yw q +;yx +;yz Y +ab, +ab. b +ab/ ~ +ab; +abh R +abi +abj +abk +abl +abm +abn +abo +abp +abu @ +aby +ag, D +ag. +ag/ +ag; +agh | +agi +agj +agk g +agl +agm +agn i +ago +agp Y +agu +agy [ +at, T +at. +at/ +at; | +ath +ati +atj +atk +atl +atm +atn O +ato +atp { +atu F +aty +av, +av. +av/ _ +av; W +avh +avi +avj N +avk +avl E +avm +avn ^ +avo +avp +avu +avy +bb, +bb. ^ +bb/ +bb; +bbh W +bbi B +bbj +bbk k +bbl +bbm +bbn ^ +bbo | +bbp +bbu +bby +bg, +bg. y +bg/ +bg; a +bgh +bgi +bgj B +bgk +bgl r +bgm h +bgn +bgo s +bgp r +bgu +bgy z +bt, u +bt. +bt/ +bt; R +bth +bti +btj k +btk +btl +btm +btn +bto +btp +btu +bty +bv, +bv. +bv/ +bv; +bvh D +bvi +bvj V +bvk +bvl +bvm +bvn | +bvo +bvp +bvu +bvy +cb, Y +cb. +cb/ +cb; m +cbh +cbi \ +cbj P +cbk +cbl +cbm +cbn } +cbo +cbp +cbu +cby +cg, +cg. +cg/ +cg; +cgh K +cgi _ +cgj +cgk +cgl O +cgm +cgn +cgo [ +cgp l +cgu r +cgy _ +ct, +ct. d +ct/ +ct; +cth +cti +ctj +ctk p +ctl +ctm C +ctn R +cto +ctp +ctu @ +cty +cv, +cv. +cv/ +cv; +cvh +cvi +cvj +cvk +cvl n +cvm +cvn +cvo +cvp +cvu w +cvy +db, +db. +db/ K +db; +dbh Y +dbi +dbj +dbk e +dbl +dbm U +dbn +dbo F +dbp ] +dbu +dby +dg, +dg. S +dg/ T +dg; +dgh +dgi +dgj +dgk +dgl +dgm +dgn +dgo +dgp +dgu +dgy +dt, +dt. M +dt/ +dt; E +dth b +dti +dtj +dtk q +dtl +dtm +dtn +dto +dtp +dtu +dty +dv, +dv. @ +dv/ +dv; +dvh +dvi +dvj +dvk { +dvl Z +dvm +dvn +dvo K +dvp +dvu +dvy C +eb, +eb. \ +eb/ v +eb; h +ebh +ebi +ebj +ebk +ebl +ebm +ebn j +ebo d +ebp +ebu +eby q +eg, j +eg. +eg/ S +eg; g +egh +egi +egj u +egk +egl +egm +egn N +ego +egp @ +egu +egy Y +et, +et. +et/ +et; ] +eth +eti +etj +etk v +etl +etm +etn +eto +etp +etu +ety +ev, +ev. +ev/ +ev; r +evh +evi n +evj +evk T +evl +evm +evn L +evo +evp b +evu { +evy +fb, +fb. +fb/ +fb; +fbh G +fbi +fbj X +fbk ~ +fbl +fbm +fbn +fbo b +fbp +fbu r +fby h +fg, +fg. G +fg/ +fg; w +fgh +fgi +fgj +fgk +fgl +fgm +fgn +fgo N +fgp k +fgu r +fgy +ft, +ft. +ft/ +ft; +fth +fti x +ftj +ftk +ftl +ftm Q +ftn +fto +ftp [ +ftu +fty +fv, +fv. ^ +fv/ +fv; +fvh E +fvi +fvj +fvk +fvl A +fvm R +fvn +fvo M +fvp +fvu +fvy c +gb, +gb. z +gb/ +gb; +gbh } +gbi L +gbj +gbk +gbl +gbm a +gbn +gbo +gbp +gbu e +gby +gg, +gg. } +gg/ +gg; +ggh +ggi +ggj +ggk @ +ggl +ggm +ggn +ggo +ggp +ggu +ggy M +gt, +gt. F +gt/ J +gt; +gth +gti n +gtj +gtk T +gtl +gtm +gtn +gto x +gtp +gtu x +gty +gv, +gv. +gv/ +gv; +gvh Z +gvi j +gvj g +gvk +gvl t +gvm +gvn +gvo g +gvp +gvu +gvy +hha +hhb +hhc +hhd +hhe { +hhf +hhg +hhq Q +hhr +hhs +hht +hhv +hhw A +hhx +hhz +hma +hmb +hmc T +hmd +hme W +hmf +hmg Y +hmq +hmr +hms g +hmt +hmv D +hmw +hmx +hmz u +hna +hnb +hnc +hnd +hne c +hnf +hng +hnq +hnr +hns u +hnt +hnv +hnw +hnx +hnz +hya f +hyb +hyc +hyd +hye +hyf +hyg +hyq C +hyr +hys +hyt ` +hyv +hyw c +hyx +hyz +iha +ihb +ihc +ihd +ihe F +ihf +ihg +ihq w +ihr +ihs [ +iht j +ihv +ihw ] +ihx +ihz } +ima +imb +imc O +imd j +ime +imf +img +imq +imr +ims +imt +imv +imw +imx +imz +ina y +inb X +inc f +ind +ine e +inf +ing E +inq +inr C +ins +int +inv +inw +inx s +inz u +iya +iyb I +iyc +iyd +iye +iyf +iyg @ +iyq +iyr +iys S +iyt +iyv +iyw +iyx +iyz Y +jha +jhb +jhc V +jhd N +jhe z +jhf a +jhg +jhq +jhr +jhs +jht +jhv +jhw +jhx +jhz +jma +jmb +jmc s +jmd +jme +jmf +jmg +jmq +jmr +jms +jmt l +jmv +jmw +jmx +jmz +jna +jnb +jnc M +jnd +jne +jnf T +jng G +jnq +jnr +jns +jnt ~ +jnv +jnw +jnx +jnz y +jya x +jyb +jyc +jyd +jye +jyf ^ +jyg +jyq { +jyr +jys b +jyt +jyv +jyw +jyx { +jyz +kha +khb v +khc i +khd j +khe +khf k +khg +khq +khr +khs n +kht +khv +khw w +khx +khz +kma +kmb +kmc +kmd +kme +kmf +kmg +kmq a +kmr k +kms +kmt +kmv +kmw +kmx +kmz +kna +knb G +knc +knd +kne +knf +kng E +knq +knr q +kns +knt +knv S +knw +knx +knz N +kya +kyb +kyc +kyd M +kye +kyf O +kyg p +kyq +kyr +kys U +kyt [ +kyv b +kyw +kyx +kyz r +lha p +lhb o +lhc +lhd +lhe j +lhf +lhg +lhq +lhr +lhs +lht +lhv +lhw +lhx +lhz +lma A +lmb } +lmc +lmd +lme +lmf +lmg +lmq +lmr +lms +lmt +lmv d +lmw X +lmx +lmz +lna f +lnb e +lnc +lnd +lne +lnf P +lng +lnq W +lnr +lns J +lnt @ +lnv +lnw +lnx d +lnz +lya +lyb x +lyc +lyd _ +lye +lyf D +lyg O +lyq +lyr +lys +lyt e +lyv D +lyw +lyx +lyz w +mha n +mhb +mhc +mhd +mhe +mhf +mhg +mhq +mhr P +mhs +mht +mhv | +mhw +mhx +mhz +mma +mmb r +mmc +mmd p +mme +mmf +mmg +mmq +mmr b +mms +mmt +mmv +mmw p +mmx h +mmz +mna +mnb +mnc +mnd c +mne H +mnf I +mng +mnq +mnr +mns +mnt +mnv ^ +mnw +mnx +mnz +mya U +myb +myc U +myd +mye +myf +myg +myq +myr +mys s +myt F +myv +myw S +myx +myz +nha +nhb +nhc i +nhd j +nhe B +nhf +nhg o +nhq +nhr +nhs j +nht +nhv +nhw i +nhx +nhz T +nma +nmb +nmc I +nmd +nme +nmf +nmg _ +nmq +nmr \ +nms N +nmt J +nmv +nmw +nmx V +nmz +nna r +nnb h +nnc +nnd +nne +nnf +nng +nnq +nnr j +nns +nnt +nnv B +nnw +nnx G +nnz Q +nya +nyb I +nyc +nyd +nye P +nyf +nyg +nyq P +nyr +nys +nyt +nyv g +nyw k +nyx +nyz +oha _ +ohb m +ohc +ohd +ohe +ohf +ohg +ohq +ohr ~ +ohs h +oht +ohv +ohw +ohx U +ohz +oma R +omb +omc +omd +ome +omf _ +omg +omq +omr +oms +omt +omv +omw q +omx [ +omz I +ona y +onb +onc B +ond _ +one A +onf e +ong +onq A +onr A +ons +ont s +onv +onw +onx w +onz X +oya s +oyb +oyc @ +oyd [ +oye +oyf w +oyg h +oyq +oyr +oys M +oyt +oyv +oyw +oyx a +oyz +pha G +phb +phc +phd +phe N +phf +phg +phq +phr ~ +phs [ +pht T +phv W +phw +phx +phz +pma t +pmb i +pmc +pmd +pme +pmf +pmg W +pmq +pmr +pms +pmt +pmv +pmw +pmx ` +pmz +pna +pnb G +pnc M +pnd +pne +pnf +png U +pnq +pnr +pns Q +pnt T +pnv +pnw u +pnx +pnz +pya +pyb +pyc A +pyd r +pye +pyf +pyg +pyq T +pyr +pys c +pyt +pyv +pyw +pyx S +pyz } +qb, +qb. ] +qb/ M +qb; P +qbh +qbi +qbj +qbk +qbl +qbm T +qbn +qbo r +qbp +qbu +qby +qg, | +qg. a +qg/ +qg; C +qgh +qgi +qgj +qgk +qgl +qgm +qgn +qgo U +qgp +qgu +qgy N +qt, _ +qt. O +qt/ } +qt; +qth +qti +qtj ~ +qtk p +qtl l +qtm P +qtn z +qto +qtp Q +qtu Y +qty q +qv, +qv. +qv/ +qv; +qvh U +qvi +qvj +qvk E +qvl +qvm +qvn ] +qvo +qvp +qvu u +qvy V +rb, +rb. +rb/ +rb; +rbh +rbi +rbj +rbk +rbl +rbm +rbn +rbo ~ +rbp +rbu +rby | +rg, +rg. +rg/ +rg; +rgh +rgi +rgj U +rgk +rgl { +rgm r +rgn +rgo +rgp S +rgu +rgy +rt, +rt. +rt/ E +rt; +rth +rti +rtj +rtk +rtl R +rtm +rtn +rto c +rtp f +rtu +rty +rv, +rv. +rv/ +rv; +rvh +rvi +rvj +rvk u +rvl +rvm +rvn +rvo b +rvp +rvu v +rvy +sb, +sb. +sb/ +sb; h +sbh e +sbi y +sbj +sbk n +sbl +sbm +sbn +sbo +sbp Q +sbu k +sby L +sg, I +sg. d +sg/ +sg; +sgh +sgi D +sgj +sgk ~ +sgl +sgm o +sgn +sgo +sgp p +sgu +sgy +st, x +st. O +st/ +st; +sth +sti +stj +stk +stl +stm +stn +sto +stp +stu +sty T +sv, +sv. +sv/ j +sv; U +svh +svi +svj +svk X +svl E +svm +svn R +svo +svp +svu ] +svy +tb, +tb. v +tb/ +tb; +tbh f +tbi +tbj R +tbk y +tbl +tbm +tbn +tbo +tbp +tbu o +tby +tg, l +tg. l +tg/ +tg; | +tgh +tgi +tgj +tgk f +tgl t +tgm +tgn e +tgo +tgp +tgu F +tgy +tt, +tt. +tt/ +tt; +tth w +tti N +ttj +ttk +ttl +ttm J +ttn +tto +ttp e +ttu a +tty +tv, +tv. +tv/ +tv; +tvh +tvi +tvj +tvk D +tvl +tvm +tvn +tvo +tvp u +tvu +tvy +uha +uhb +uhc r +uhd +uhe +uhf +uhg +uhq F +uhr W +uhs +uht +uhv +uhw +uhx +uhz +uma R +umb h +umc +umd Z +ume +umf +umg \ +umq d +umr +ums D +umt +umv +umw B +umx P +umz +una +unb +unc +und +une +unf +ung +unq \ +unr +uns +unt +unv +unw z +unx +unz +uya ^ +uyb +uyc +uyd +uye +uyf @ +uyg +uyq +uyr v +uys \ +uyt i +uyv T +uyw +uyx P +uyz +vb, S +vb. +vb/ +vb; +vbh n +vbi d +vbj +vbk +vbl J +vbm ^ +vbn +vbo R +vbp y +vbu +vby +vg, +vg. +vg/ S +vg; T +vgh +vgi +vgj | +vgk +vgl +vgm +vgn +vgo P +vgp } +vgu _ +vgy t +vt, V +vt. +vt/ +vt; r +vth +vti +vtj +vtk +vtl +vtm +vtn +vto B +vtp f +vtu +vty L +vv, @ +vv. +vv/ \ +vv; +vvh +vvi +vvj +vvk +vvl +vvm m +vvn +vvo +vvp +vvu +vvy k +wb, +wb. O +wb/ +wb; +wbh ^ +wbi H +wbj +wbk +wbl +wbm +wbn @ +wbo +wbp +wbu +wby +wg, +wg. +wg/ P +wg; +wgh +wgi +wgj +wgk +wgl +wgm L +wgn +wgo +wgp +wgu +wgy e +wt, n +wt. O +wt/ C +wt; +wth +wti q +wtj +wtk +wtl o +wtm +wtn s +wto +wtp +wtu o +wty +wv, G +wv. +wv/ +wv; H +wvh +wvi +wvj +wvk +wvl ` +wvm +wvn +wvo +wvp w +wvu Y +wvy +xb, X +xb. +xb/ +xb; +xbh +xbi l +xbj +xbk +xbl +xbm H +xbn +xbo +xbp l +xbu +xby ` +xg, +xg. +xg/ +xg; +xgh +xgi +xgj +xgk V +xgl +xgm +xgn c +xgo r +xgp J +xgu +xgy +xt, +xt. +xt/ H +xt; +xth +xti +xtj B +xtk +xtl p +xtm A +xtn a +xto +xtp E +xtu [ +xty +xv, M +xv. +xv/ p +xv; +xvh { +xvi +xvj +xvk a +xvl +xvm +xvn +xvo +xvp +xvu +xvy +yha ~ +yhb F +yhc _ +yhd I +yhe O +yhf +yhg V +yhq +yhr +yhs +yht +yhv +yhw +yhx +yhz v +yma +ymb +ymc +ymd +yme +ymf +ymg +ymq +ymr +yms +ymt +ymv +ymw +ymx +ymz +yna +ynb +ync F +ynd b +yne +ynf x +yng +ynq c +ynr +yns +ynt V +ynv +ynw y +ynx +ynz +yya t +yyb +yyc +yyd Q +yye A +yyf +yyg +yyq +yyr } +yys +yyt +yyv +yyw X +yyx [ +yyz k +zb, U +zb. +zb/ +zb; +zbh +zbi +zbj +zbk Q +zbl i +zbm j +zbn +zbo | +zbp +zbu +zby +zg, +zg. A +zg/ +zg; +zgh +zgi +zgj +zgk +zgl +zgm C +zgn H +zgo +zgp +zgu v +zgy | +zt, +zt. +zt/ +zt; +zth +zti X +ztj +ztk +ztl S +ztm +ztn +zto +ztp +ztu +zty +zv, +zv. +zv/ +zv; +zvh +zvi +zvj +zvk +zvl M +zvm +zvn k +zvo E +zvp +zvu m +zvy diff --git a/plugins/kaoriya/plugin/autodate.vim b/plugins/kaoriya/plugin/autodate.vim new file mode 100644 index 0000000000..5ad67575cd --- /dev/null +++ b/plugins/kaoriya/plugin/autodate.vim @@ -0,0 +1,469 @@ +" vi:set ts=8 sts=2 sw=2 tw=0: +" +" autodate.vim - A plugin to update time stamps automatically +" +" Maintainer: MURAOKA Taro +" Last Change: 06-Feb-2006. + +" Description: +" Command: +" :Autodate Manually autodate. +" :AutodateON Turn on autodate in current buffer (default). +" :AutodateOFF Turn off autodate in current buffer. +" +" Options: +" Each global variable (option) is overruled by buffer variable (what +" starts with "b:"). +" +" 'autodate_format' +" Format string used for time stamps. See |strftime()| for details. +" See MonthnameString() for special extension of format. +" Default: '%d-%3m-%Y' +" +" 'autodate_lines' +" The number of lines searched for the existence of a time stamp when +" writing a buffer. The search range will be from top of buffer (or +" line 'autodate_start_line') to 'autodate_lines' lines below. The +" bigger value you have, the longer it'll take to search words. You +" can expect to improve performance by decreasing the value of this +" option. +" Default: 50 +" +" 'autodate_start_line' +" Line number to start searching for time stamps when writing buffer +" to file. +" If minus, line number is counted from the end of file. +" Default: 1 +" +" 'autodate_keyword_pre' +" A prefix pattern (see |pattern| for details) which denotes time +" stamp's location. If empty, default value will be used. +" Default: '\cLast Change:' +" +" 'autodate_keyword_post' +" A postfix pattern which denotes time stamp's location. If empty, +" default value will be used. +" Default: '\.' +" +" Usage: +" Write a line as below (case ignored) somewhere in the first 50 lines of +" a buffer: +" Last Change: . +" When writing the buffer to a file, this line will be modified and a time +" stamp will be inserted automatically. Example: +" Last Change: 11-May-2002. +" +" You can execute :Autodate command to update time stamps manually. The +" range of lines which looks for a time stamp can also be specified. When +" no range is given, the command will be applied to the current line. +" Example: +" :%Autodate " Whole file +" :\<,\>Autodate " Range selected by visual mode +" :Autodate " Current cursor line +" +" The format of the time stamp to insert can be specified by +" 'autodate_format' option. See |strftime()| (vim script function) for +" details. Sample format settings and the corresponding outputs are show +" below. +" FORMAT: %Y/%m/%d OUTPUT: 2001/12/24 +" FORMAT: %H:%M:%S OUTPUT: 10:06:32 +" FORMAT: %y%m%d-%H%M OUTPUT: 011224-1006 +" +" Autodate.vim determines where to insert a time stamp by looking for a +" KEYWORD. A keyword consists of a PREFIX and a POSTFIX part, and they +" can be set by 'autodate_keyword_pre' and 'autodate_keyword_post' +" options, respectively. If you set these values as below in your .vimrc: +" :let autodate_format = ': %Y/%m/%d %H:%M:%S ' +" :let autodate_keyword_pre = '\$Date' +" :let autodate_keyword_post = '\$' +" They will function like $Date$ in cvs. Example: +" $Date: 2001/12/24 10:06:32 $ +" +" Just another application. To insert a time stamp between '' +" when writing HTML, try below: +" :let b:autodate_keyword_pre = '' +" :let b:autodate_keyword_post = '' +" It will be useful if to put these lines in your ftplugin/html.vim. +" Example: +" 24-Dec-2001 +" +" In addition, priority is given to a buffer local option (what starts in +" b:) about all the options of autodate. +" +" +" To make vim NOT TO LOAD this plugin, write next line in your .vimrc: +" :let plugin_autodate_disable = 1 + +" Japanese Description: +" R}h: +" :Autodate 蓮Ń^CX^vXV +" :AutodateON ݂̃obt@̎XVL +" :AutodateOFF ݂̃obt@̎XV𖳌 +" +" IvV: (ꂼ̃IvV̓obt@(b:)D悳) +" +" 'autodate_format' +" ^CX^vɎgptH[}bgBtH[}bg̏ڍׂ +" |strftime()|QƁBtH[}bgւ̓Ǝgɂ‚ĂMonthnameString() +" QƁBȗl: '%d-%3m-%Y' +" +" 'autodate_lines' +" ۑɃ^CX^v݂̑`FbNsB₹Α₷ق +" L[[h邽߂ɎԂ蓮삪xȂBtɒxƊ +" Ƃɂ͏Ȓlݒ肷΃ptH[}X̉P҂łB +" ȗl: 50 +" +" 'autodate_keyword_pre' +" ^CX^v݂̑OuL[[h(K\)BK{B󕶎 +" w肷ƏȗlgBȗl: '\cLast Change:' +" +" 'autodate_keyword_post' +" ^CX^v݂̑uL[[h(K\)BK{B󕶎 +" w肷ƏȗlgBȗl: '\.' +" +" gp@: +" t@C̐擪50sȓ +" Last Change: . +" Əs(啶͋ʂ܂)pӂƁAt@C̕ۑ(:w) +" ɎIɂ̎(^CX^v)}܂Bʗ: +" Last Change: 11-May-2002. +" +" ExR}h:Autodates邱ƂŎ蓮Ń^CX^v̍XVsȂ +" ܂B̍ۂɃ^CX^vT͈͂w肷邱Ƃł܂Bɔ͈ +" w肵Ȃ΃J[\̂sΏۂɂȂ܂B: +" :%Autodate " t@CS +" :\<,\>Autodate " rWAÏ +" :Autodate " ݃J[\̂s +" +" }^CX^v̏̓IvV'autodate_format'Ŏw肷邱 +" ł܂BڍׂVimXNvg֐|strftime()|̐ɏ]܂Bȉ +" Ƃ̏o̗͂܂: +" : %Y/%m/%d o: 2001/12/24 +" : %H:%M:%S o: 10:06:32 +" : %y%m%d-%H%M o: 011224-1006 +" +" autodate.vim̓L[[hTƂŃ^CX^v}ׂʒu +" Ă܂BL[[h͑OuƌuȂAꂼIvV +" 'autodate_keyword_pre''autodate_keyword_post'ݒ肷邱ƂŕύXł +" ܂Blݒt@C(_vimrc)Ŏ̂悤ɐݒ肷: +" :let autodate_format = ': %Y/%m/%d %H:%M:%S ' +" :let autodate_keyword_pre = '\$Date' +" :let autodate_keyword_post = '\$' +" cvsɂ$Date$̂悤ɓ삵܂B: +" $Date: 2001/12/24 10:06:32 $ +" +" pƂHTMLLqۂň͂܂ꂽɃ^CX^v} +" ꍇɂ: +" :let b:autodate_keyword_pre = '' +" :let b:autodate_keyword_post = '' +" Ǝw肵܂Bftplugin/html.vimŐݒ肷ƕ֗ł傤B: +" 24-Dec-2001 +" +" ȂautodatȇẴIvVɂ‚āAobt@[JIvV(b: +" n܂)D悳܂B +" +" ̃vOCǍ݂Ȃ.vimrcɎ̂悤ɏ: +" :let plugin_autodate_disable = 1 + +if exists('plugin_autodate_disable') + finish +endif +let s:debug = 0 + +"--------------------------------------------------------------------------- +" Options + +" +" 'autodate_format' +" +if !exists('autodate_format') + let g:autodate_format = '%d-%3m-%Y' +endif + +" +" 'autodate_lines' +" +if !exists('autodate_lines') + let g:autodate_lines = 50 +endif + +" +" 'autodate_start_line' +" +if !exists('autodate_start_line') + let g:autodate_start_line = 1 +endif + +" +" 'autodate_keyword_pre' +" +if !exists('autodate_keyword_pre') + let g:autodate_keyword_pre = '\cLast Change:' +endif + +" +" 'autodate_keyword_post' +" +if !exists('autodate_keyword_post') + let g:autodate_keyword_post = '\.' +endif + +"--------------------------------------------------------------------------- +" Mappings + +command! -range Autodate call Autodate(, ) +command! AutodateOFF let b:autodate_disable = 1 +command! AutodateON let b:autodate_disable = 0 +if has("autocmd") + augroup Autodate + au! + autocmd BufUnload,FileWritePre,BufWritePre * call Autodate() + augroup END +endif " has("autocmd") + +"--------------------------------------------------------------------------- +" Implementation + +" +" Autodate([{firstline} [, {lastline}]]) +" +" {firstline}{lastline}Ŏw肳ꂽ͈͂ɂ‚āA^CX^v̎ +" Abvf[gsȂB{firstline}ȗꂽꍇ̓t@C̐擪A +" {lastline}ȗꂽꍇ{firstline}'autodate_lines's͈̔͂ +" ۂɂȂB +" +function! s:Autodate(...) + " Check enable + if (exists('b:autodate_disable') && b:autodate_disable != 0) || &modified == 0 + return + endif + + " Verify {firstline} + if a:0 > 0 && a:1 > 0 + let firstline = a:1 + else + let firstline = s:GetAutodateStartLine() + endif + + " Verify {lastline} + if a:0 > 1 && a:2 <= line('$') + let lastline = a:2 + else + let lastline = firstline + s:GetAutodateLines() - 1 + " Range check + if lastline > line('$') + let lastline = line('$') + endif + endif + + if firstline <= lastline + call s:AutodateStub(firstline, lastline) + endif +endfunction + +" +" GetAutodateStartLine() +" +" TJn_擾 +" +function! s:GetAutodateStartLine() + let retval = 1 + if exists('b:autodate_start_line') + let retval = b:autodate_start_line + elseif exists('g:autodate_start_line') + let retval = g:autodate_start_line + endif + + if retval < 0 + let retval = retval + line('$') + 1 + endif + if retval <= 0 + let retval = 1 + endif + return retval +endfunction + +" +" GetAutodateLines() +" +" autodateΏ۔͈͂擾 +" +function! s:GetAutodateLines() + if exists('b:autodate_lines') && b:autodate_lines > 0 + return b:autodate_lines + elseif exists('g:autodate_lines') && g:autodate_lines > 0 + return g:autodate_lines + else + return 50 + endif +endfunction + +" +" AutodateStub(first, last) +" +" w肳ꂽ͈͂ɂ‚ă^CX^v̎Abvf[gsȂB +" +function! s:AutodateStub(first, last) + + " Verify pre-keyword. + if exists('b:autodate_keyword_pre') && b:autodate_keyword_pre != '' + let pre = b:autodate_keyword_pre + else + if exists('g:autodate_keyword_pre') && g:autodate_keyword_pre != '' + let pre = g:autodate_keyword_pre + else + let pre = '\cLast Change:' + endif + endif + + " Verify post-keyword. + if exists('b:autodate_keyword_post') && b:autodate_keyword_post != '' + let post = b:autodate_keyword_post + else + if exists('g:autodate_keyword_post') && g:autodate_keyword_post != '' + let post = g:autodate_keyword_post + else + let post = '\.' + endif + endif + + " Verify format. + if exists('b:autodate_format') && b:autodate_format != '' + let format = b:autodate_format + else + if exists('g:autodate_format') && g:autodate_format != '' + let format = g:autodate_format + else + let format = '%d-%3m-%Y' + endif + endif + + " Generate substitution pattern + let pat = '\('.pre.'\s*\)\(\S.*\)\?\('.post.'\)' + let sub = Strftime2(format) + " For debug + if s:debug + echo "range=".a:first."-".a:last + echo "pat= ".pat + echo "sub= ".sub + endif + + " Process + let i = a:first + while i <= a:last + let curline = getline(i) + if curline =~ pat + let newline = substitute(curline, pat, '\1' . sub . '\3', '') + if curline !=# newline + call setline(i, newline) + endif + endif + let i = i + 1 + endwhile +endfunction + +" +" Strftime2({format} [, {time}]) +" Enhanced version of strftime(). +" +" strftime()̃tH[}bggo[WBtH[}bg͂قƂǃIW +" iƈꏏB̉pꖼɒuʂȏ %{n}m gp”\B{n} +" ͉pꖼ̒̕w肷(ő9)B0w肷Η]ȋ󔒂͕t +" ȂB +" : +" :echo Strftime2("%d-%3m-%Y") +" 07-Oct-2001 +" :echo Strftime2("%d-%0m-%Y") +" 07-October-2001 +" +function! Strftime2(...) + if a:0 > 0 + " Get {time} argument. + if a:0 > 1 + let time = a:2 + else + let time = localtime() + endif + " Parse special format. + let format = a:1 + let format = substitute(format, '%\(\d\+\)m', '\=MonthnameString(-1, submatch(1), time)', 'g') + let format = substitute(format, '%\(\d\+\)a', '\=DaynameString(-1, submatch(1), time)', 'g') + return strftime(format, time) + endif + " Genrate error! + return strftime() +endfunction + +" +" MonthnameString([{month} [, {length} [, {time}]]]) +" Get month name string in English with first specified letters. +" +" p̌w肵ŕԂB{month}ȗꍇɂ݂͌̌ +" B{month}ɖȎw(1`12ȊO)sȂꂽꍇ{time}Ŏ +" ԂB{time}ȗꍇɂ͑|localtime()|gp +" B{length}ɂ͕ԂO̒w肷邪ȗƔCӒɂȂB +" : +" :echo MonthnameString(8) . " 2001" +" August 2001 +" :echo MonthnameString(8,3) . " 2001" +" Aug 2001 +" +function! MonthnameString(...) + " Get {time} argument. + if a:0 > 2 + let time = a:3 + else + let time = localtime() + endif + " Verify {month}. + if a:0 > 0 && (a:1 >= 1 && a:1 <= 12) + let month = a:1 + else + let month = substitute(strftime('%m', time), '^0\+', '', '') + endif + " Verify {length}. + if a:0 > 1 && (a:2 >= 1 && a:2 <= 9) + let length = a:2 + else + let length = strpart('785534469788', month - 1, 1) + endif + " Generate string of month name. + return strpart('January February March April May June July August SeptemberOctober November December ', month * 9 - 9, length) +endfunction + +" +" DaynameString([{month} [, {length} [, {time}]]]) +" Get day name string in English with first specified letters. +" +" p̗jw肵ŕԂB{day}ȗꍇɂ͖{̗j +" ԂB{day}ɖȎw(0`6ȊO)sȂꂽꍇ{time}Ŏ +" jԂB{time}ȗꍇɂ͑|localtime()|gp +" B{length}ɂ͕ԂO̒w肷邪ȗƔCӒɂȂB +" : +" :echo DaynameString(0) +" Sunday +" :echo DaynameString(5,3).', 13th' +" Fri, 13th +" +function! DaynameString(...) + " Get {time} argument. + if a:0 > 2 + let time = a:3 + else + let time = localtime() + endif + " Verify {day}. + if a:0 > 0 && (a:1 >= 0 && a:1 <= 6) + let day = a:1 + else + let day = strftime('%w', time) + 0 + endif + " Verify {length}. + if a:0 > 1 && (a:2 >= 1 && a:2 <= 9) + let length = a:2 + else + let length = strpart('6798686', day, 1) + endif + " Generate string of day name. + return strpart('Sunday Monday Tuesday WednesdayThursday Friday Saturday ', day * 9, length) +endfunction diff --git a/plugins/kaoriya/plugin/cmdex.vim b/plugins/kaoriya/plugin/cmdex.vim new file mode 100644 index 0000000000..a4b64dcf26 --- /dev/null +++ b/plugins/kaoriya/plugin/cmdex.vim @@ -0,0 +1,131 @@ +" vi:set ts=8 sts=2 sw=2 tw=0: +" +" cmdex.vim - Extra commands +" +" Maintainer: Muraoka Taro +" Last Change: 19-Mar-2013. +" Commands: +" :MenuLang {language} +" (language: none/ja/zh...etc.) +" :Scratch +" :IminsertOff +" :IminsertOn +" :VDsplit {filename} +" :Tutorial +" :Nohlsearch +" :Transform +" c_CTRL-X +" :Undiff +" +" To make vim DO NOT LOAD this plugin, write next line in your .vimrc: +" :let plugin_cmdex_disable = 1 + +if exists('plugin_cmdex_disable') + finish +endif + +" :Transform +" Like perl's "=~ tr/ABC/xyz/" +" function Transform(from_group, to_group, target) +command! -nargs=* -range Transform ,call Transform() +function! Transform(from_str, to_str, ...) + if a:0 | let string = a:1 | else | let string = getline(".") | endif + let from_ptr = 0 | let to_ptr = 0 + while 1 + let from_char = matchstr(a:from_str, '^.', from_ptr) + if from_char == '' + break + endif + let to_char = matchstr(a:to_str, '^.', to_ptr) + let from_ptr = from_ptr + strlen(from_char) + let to_ptr = to_ptr + strlen(to_char) + let string = substitute(string, from_char, to_char, 'g') + endwhile + if a:0 | return string | else | call setline(".", string) | endif +endfunction + +" :Nohlsearch +" Stronger :nohlsearch +command! -nargs=0 Nohlsearch let @/ = '' +" :Tutorial +" Start vim training. +command! -nargs=0 Tutorial call StartTutorial() +function! s:StartTutorial() + let tutor = 'tutor' + if $LANG !=# '' + let tutor = tutor . '.' . strpart($LANG, 0, 2) + endif + " Japan special + if $LANG =~ '^ja' + let enc = 'utf-8' + if &encoding ==# 'cp932' + let enc='sjis' + elseif &encoding =~ 'euc' + let enc = 'euc' + endif + let tutor = tutor . '.' . enc + endif + execute "edit! $VIMRUNTIME/tutor/" . tutor + execute "file TUTORCOPY" + execute "write!" +endfunction + +" :CdCurrent +" Change current directory to current file's one. +command! -nargs=0 CdCurrent cd %:p:h + +" :VDsplit +command! -nargs=1 -complete=file VDsplit vertical diffsplit + +" :IminsertOff/On +command! -nargs=0 IminsertOff inoremap :set iminsert=0 +command! -nargs=0 IminsertOn iunmap + +" :Scratch +" Open a scratch (no file) buffer. +command! -nargs=0 Scratch new | setlocal bt=nofile noswf | let b:cmdex_scratch = 1 +function! s:CheckScratchWritten() + if &buftype ==# 'nofile' && expand('%').'x' !=# 'x' && exists('b:cmdex_scratch') && b:cmdex_scratch == 1 + setlocal buftype= swapfile + unlet b:cmdex_scratch + endif +endfunction +augroup CmdexScratch +autocmd! +autocmd BufWritePost * call CheckScratchWritten() +augroup END + +" :MenuLang {language} +command! -nargs=1 MenuLang call ChangeMenu("") +function! s:ChangeMenu(name) + source $VIMRUNTIME/delmenu.vim + let &langmenu=a:name + source $VIMRUNTIME/menu.vim +endfunction + +" :HTMLConvert +command! -nargs=0 HTMLConvert call HTMLConvert() +function! s:HTMLConvert() + source $VIMRUNTIME/syntax/2html.vim + "silent! %s!\%(https\|http\|ftp\):[^<]*!&!g + call histdel("search", -1) +endfunction + +" c_CTRL-X +" Input current buffer's directory on command line. +cnoremap =GetBufferDirectory() +function! s:GetBufferDirectory() + let path = expand('%:p:h') + let cwd = getcwd() + let dir = '.' + if match(path, escape(cwd, '\')) != 0 + let dir = path + elseif strlen(path) > strlen(cwd) + let dir = strpart(path, strlen(cwd) + 1) + endif + return dir . (exists('+shellslash') && !&shellslash ? '\' : '/') +endfunction + +" :Undiff +" Turn off diff mode for current buffer. +command! -nargs=0 Undiff set nodiff noscrollbind wrap nocursorbind diff --git a/plugins/kaoriya/plugin/dicwin.vim b/plugins/kaoriya/plugin/dicwin.vim new file mode 100644 index 0000000000..cb4201b811 --- /dev/null +++ b/plugins/kaoriya/plugin/dicwin.vim @@ -0,0 +1,288 @@ +" vi:set ts=8 sts=2 sw=2 tw=0 nowrap: +" +" dicwin.vim - Dictionary window +" +" Maintainer: MURAOKA Taro +" Last Change: 08-Mar-2016. +" Commands: Search word under cursor. +" / Search prompted word. +" c Close dictionary window. +" n Search next. (with last word) +" p Search previous. (with last word) +" w Jump to dictionary window (if exists) +" Require: &runtimepath/dict/gene.txt or &runtimepath/gene.txt +" +" URL where you can get 'gene.txt': +" http://www.namazu.org/~tsuchiya/sdic/data/gene.html + +scriptencoding utf-8 + +if exists('plugin_dicwin_disable') + finish +endif +let s:myname = expand(':t:r') + +let s:lastword = '' +let s:lastpattern = '' + +function! s:DicwinOnload() + call s:DetermineDictpath() + if filereadable(g:dicwin_dictpath) + call s:SetupKeymap() + endif +endfunction + +function! s:DetermineDictpath() + " Search default dictionary + if !exists('g:dicwin_dictpath') + let s:dict = 'gene.txt' + let g:dicwin_dictpath = s:GlobPath(&rtp, 'dict/'.s:dict) + if g:dicwin_dictpath == '' + let g:dicwin_dictpath = s:GlobPath(&rtp, s:dict) + endif + unlet s:dict + endif + " Windows return '\\' as directory separator in globpath(), replace it. + "let g:dicwin_dictpath = substitute(g:dicwin_dictpath, '\\', '/', 'g') +endfunction + +function! s:GlobPath(paths, target) + let list = split(globpath(a:paths, a:target), "\n") + if len(list) <= 0 + return '' + else + return list[0] + end +endfunction + +" Kemaps +function! s:SetupKeymap() + let s:use_mapleader = 0 + if !exists('g:mapleader') + let g:mapleader = "\" + let s:use_mapleader = 1 + endif + nnoremap k :call OpenDictionary(g:dicwin_dictpath, expand('')) + nnoremap n :call Search(g:dicwin_dictpath, 0) + nnoremap p :call Search(g:dicwin_dictpath, 1) + nnoremap w :call GoDictWindow() + nnoremap c :call Close() + nnoremap / :call Query() + nnoremap :call OpenDictionary(g:dicwin_dictpath, expand('')) + nnoremap :call Search(g:dicwin_dictpath, 0) + nnoremap :call Search(g:dicwin_dictpath, 1) + nnoremap :call GoDictWindow() + if s:use_mapleader > 0 + unlet s:use_mapleader + unlet g:mapleader + endif +endfunction + +" +" WinEnter/WinLeave hooks +" +function! s:DicWinEnter() + if winbufnr(2) > 0 + exe "normal! 8\_" + else + exe "quit!" + endif + setlocal wrap +endfunction + +function! s:DicWinLeave() + setlocal nowrap + 2 wincmd _ + normal! zt +endfunction + +function! s:DicWinUnload() + if exists('w:dicwin_dicwin') + unlet w:dicwin_dicwin + endif +endfunction + +" +" GenerateSearchPatternEnglish(word) +" +function! s:GenerateSearchPatternEnglish(word) + let pat = a:word + if pat =~ 's$' + if pat =~ 'ies$' + let pat = substitute(pat, 'ies$', '\\(ies\\=\\|y\\)', '') + else + let pat = pat . '\=' + endif + elseif pat =~ 'ied$' + let pat = substitute(pat, 'ied$', '\\(y\\|ied\\|ie\\)\\=', '') + elseif pat =~ 'ed$' + let pat = substitute(pat, 'ed$', '\\(ed\\|e\\)\\=', '') + elseif pat =~ 'ing$' + if pat =~ '\(.\)\1ing$' + let pat = substitute(pat, '\(.\)ing$', '\1\\=\\(ing\\|e\\)\\=', '') + else + let pat = substitute(pat, 'ing$', '\\(ing\\|e\\)\\=', '') + endif + elseif pat =~ 'able$' + let pat = substitute(pat, 'able$', '\\(able\\|e\\)', '') + elseif pat =~ '[.,]$' + let pat = substitute(pat, '[,.]$', '', '') + endif + return "\\c" . pat +endfunction + +function! s:Query() + let wquery = input(s:myname. ': Input search word: ') + return s:OpenDictionary(g:dicwin_dictpath, wquery) +endfunction + +" +" Close() +" Close window of dictionary [a:dic]. +" +function! s:Close() + call s:PrevWindowMark() + if s:GoDictWindow() >= 0 + close + call s:PrevWindowRevert() + endi +endfunction + +" Search(dic, dir) +" dir: 0:next / 1:previous +" Search next/previous word in dictionary. +function! s:Search(dic, dir) + if filereadable(a:dic) != 1 + return + endif + " Check existance of previous searched word + if s:lastpattern == '' || s:lastword == '' + echohl Error + echo s:myname. ': No given word before.' + echohl None + return + endif + " Initialize variables for direction + if a:dir == 0 + let cmd = '/' + let dirname = 'next' + let restart = 'TOP' + else + let cmd = '?' + let dirname = 'previous' + let restart = 'BOTTOM' + endif + " Do search + call s:PrevWindowMark() + call s:OpenDictionaryWindow(a:dic) + let line_before = line('.') + execute 'silent! normal! ' .cmd. '^' .s:lastpattern. "\\>\" + let line_after = line('.') + " Output result + if line_before == line_after + echohl WarningMsg + echo s:myname. ': No other "' .s:lastword. '".' + elseif (a:dir == 0 && line_before < line_after) || (a:dir != 0 && line_before > line_after) + echo s:myname. ': Found ' .dirname. ' "' .s:lastword. '" in line ' .line_after. '.' + else + echohl WarningMsg + echo s:myname. ': Search from ' .restart. ' and found ' .dirname. ' "' .s:lastword. '".' + endif + echohl None + " Revert previous window + call s:PrevWindowRevert() +endfunction + +" OpenDictionary(dic, word) +" Open window of dictionary [a:dic] and search a:word. +" +function! s:OpenDictionary(dic, word) + if filereadable(a:dic) != 1 + return + endif + if a:word != '' + if a:word ==# s:lastword + call s:Search(a:dic, 0) + return + endif + " Remember previous window and open dictionary window + call s:PrevWindowMark() + call s:OpenDictionaryWindow(a:dic) + " Search the word + let s:lastword = a:word + let s:lastpattern = s:GenerateSearchPatternEnglish(a:word) + execute "silent! normal! gg/^" . s:lastpattern . "\\%( [+~]\\|$\\)\" + " Output result + if line('.') != 1 + echo s:myname . ": Found \"" . s:lastword . '".' + else + echohl ErrorMsg + echo s:myname . ": Can't find \"" . s:lastword . '".' + endif + echohl None + else + " output 'no word message' + echohl WarningMsg + echo s:myname . ": No word at under cursor." + echohl None + endif + " Leave dictionary window + call s:PrevWindowRevert() +endfunction + +function! s:OpenDictionaryWindow(name) + if filereadable(a:name) != 1 + return + endif + if s:GoDictWindow() < 0 + if &shellslash == 0 + let name = substitute(a:name, '\\', '/', 'g') + endif + execute "augroup Dictionary" + execute "autocmd!" + execute "autocmd WinEnter " . name . " call DicWinEnter()" + execute "autocmd WinLeave " . name . " call DicWinLeave()" + execute "autocmd BufUnload " . name . " call DicWinUnload()" + execute "augroup END" + execute 'silent normal! :sview ' . a:name ."\" + let w:dicwin_dicwin = 1 + let s:lastword = '' + let s:lastpattern = '' + setlocal nowrap + endif +endfunction + +function! s:GoDictWindow() + return s:GoMarkedWindow('dicwin_dicwin') +endfunction + +function! s:GetMarkedWindow(name) + let winnum = 1 + while winbufnr(winnum) >= 0 + if getwinvar(winnum, a:name) > 0 + return winnum + endif + let winnum = winnum + 1 + endwhile + return -1 +endfunction + +function! s:GoMarkedWindow(name) + let winnum = s:GetMarkedWindow(a:name) + if winnum > 0 && winnr() != winnum + execute winnum.'wincmd w' + endif + return winnum +endfunction + +function! s:PrevWindowMark() + let w:dicwin_prevwin = 1 +endfunction + +function! s:PrevWindowRevert() + if s:GoMarkedWindow('dicwin_prevwin') > 0 + unlet w:dicwin_prevwin + endif +endfunction + +call s:DicwinOnload() diff --git a/plugins/kaoriya/plugin/hz_ja.vim b/plugins/kaoriya/plugin/hz_ja.vim new file mode 100644 index 0000000000..7f81e4484f --- /dev/null +++ b/plugins/kaoriya/plugin/hz_ja.vim @@ -0,0 +1,282 @@ +" vim:set ts=8 sts=2 sw=2 tw=0 nowrap: +" +" hz_ja.vim - Convert character between HANKAKU and ZENKAKU +" +" Last Change: 27-Aug-2015. +" Written By: MURAOKA Taro +" +" Commands: +" :Hankaku Convert to HANKAKU. +" :Zenkaku Convert to ZENKAKU. +" :ToggleHZ Toggle convert between HANKAKU and ZENKAKU. +" +" Functions: +" ToHankaku(str) Convert given string to HANKAKU. +" ToZenkaku(str) Convert given string to ZENKAKU. +" +" To make vim DO NOT LOAD this plugin, write next line in your .vimrc: +" :let plugin_hz_ja_disable = 1 + +" Japanese Description: +" R}h: +" :[range]Hankaku +" :[range]Zenkaku +" :[range]ToggleHZ +" :[range]HzjaConvert {target} +" +" L[}bsO: +" ȉ̓rWAÏɑ΂鑀łB܂()HzjaConvertR}h +" Ɗ֐ɓnAtargetɎw”\ȕłB +" gHL ”\ȕSĔpɕϊ (han_all) +" gZL ”\ȕSđSpɕϊ (zen_all) +" gHA ASCIISĔpɕϊ (han_ascii) +" gZA ASCIISđSpɕϊ (zen_ascii) +" gHM LSĔpɕϊ (han_kigou) +" gZM LSđSpɕϊ (zen_kigou) +" gHW pSĔpɕϊ (han_eisu) +" gZW pSđSpɕϊ (zen_eisu) +" gHJ J^JiSĔpɕϊ (han_kana) +" gZJ J^JiSđSpɕϊ (zen_kana) +" ȉ͎gppx̍lāALƏd@\ƂĊ蓖Ăꂽ +" L[}bvłB +" gHH ASCIISĔpɕϊ (han_ascii) +" gZZ J^JiSđSpɕϊ (zen_kana) +" +" ֐: +" ToHankaku(str) 𔼊p֕ϊ +" ToZenkaku(str) Sp֕ϊ +" HzjaConvert(str, target) +" targetɏ]ϊBtargeẗӖ̓L[}b +" sO̍ڂQƁB +" +" j[g: +" GUI‹ł̓rWAĨ|bvAbvj[(ENbNj[) +" ϊp̃R}hlj܂B +" +" ̃vOCǍ݂Ȃ.vimrcɎ̂悤ɏ: +" :let plugin_hz_ja_disable = 1 + +scriptencoding cp932 + +if exists('plugin_hz_ja_disable') + finish +endif +if !has('multi_byte') + finish +endif + +command! -nargs=0 -range Hankaku ,call ToggleLineWise('Hankaku') +command! -nargs=0 -range Zenkaku ,call ToggleLineWise('Zenkaku') +command! -nargs=0 -range ToggleHZ ,call ToggleLineWise('Toggle') +command! -nargs=1 -range -complete=custom,HzjaConvertComplete HzjaConvert ,call HzjaConvert() + +vnoremap gHL :call HzjaConvertVisual('han_all') +vnoremap gZL :call HzjaConvertVisual('zen_all') +vnoremap gHA :call HzjaConvertVisual('han_ascii') +vnoremap gZA :call HzjaConvertVisual('zen_ascii') +vnoremap gHM :call HzjaConvertVisual('han_kigou') +vnoremap gZM :call HzjaConvertVisual('zen_kigou') +vnoremap gHW :call HzjaConvertVisual('han_eisu') +vnoremap gZW :call HzjaConvertVisual('zen_eisu') +vnoremap gHJ :call HzjaConvertVisual('han_kana') +vnoremap gZJ :call HzjaConvertVisual('zen_kana') + +vnoremap gHH :call HzjaConvertVisual('han_ascii') +vnoremap gZZ :call HzjaConvertVisual('zen_kana') + +if has('gui_running') + vnoremenu 1.120 PopUp.-SEP3- + vnoremenu 1.130.100 PopUp.Spp(&H).S(&L) :call HzjaConvertVisual('han_all') + vnoremenu 1.130.110 PopUp.Spp(&H).ASCII(&A) :call HzjaConvertVisual('han_ascii') + vnoremenu 1.130.120 PopUp.Spp(&H).L(&M) :call HzjaConvertVisual('han_kigou') + vnoremenu 1.130.130 PopUp.Spp(&H).p(&W) :call HzjaConvertVisual('han_eisu') + vnoremenu 1.130.140 PopUp.Spp(&H).J^Ji(&J) :call HzjaConvertVisual('han_kana') + vnoremenu 1.140.100 PopUp.pSp(&Z).S(&L) :call HzjaConvertVisual('zen_all') + vnoremenu 1.140.110 PopUp.pSp(&Z).ASCII(&A) :call HzjaConvertVisual('zen_ascii') + vnoremenu 1.140.120 PopUp.pSp(&Z).L(&M) :call HzjaConvertVisual('zen_kigou') + vnoremenu 1.140.130 PopUp.pSp(&Z).p(&W) :call HzjaConvertVisual('zen_eisu') + vnoremenu 1.140.140 PopUp.pSp(&Z).J^Ji(&J) :call HzjaConvertVisual('zen_kana') +endif + +function! HzjaConvertComplete(argleand, cmdline, curpos) + call s:Initialize() + return s:targetlist +endfunction + +function! s:HzjaConvert(target) range + let nline = a:firstline + while nline <= a:lastline + call setline(nline, HzjaConvert(getline(nline), a:target)) + let nline = nline + 1 + endwhile +endfunction + +" ^ꂽ̔pSp𑊌݂ɕϊBϊ̕@͈targetŕ +" ƂĎw肷Bwł镶͈ȉ̂ƂB +" +" han_all SĂ̑Spp +" han_ascii SpAXL[p +" han_kana SpJ^Jip +" han_eisu Sppp +" han_kigou SpLp +" zen_all SĂ̔pSp +" zen_ascii pAXL[Sp +" zen_kana pJ^JiSp +" zen_eisu ppSp +" zen_kigou pLSp +" +function! HzjaConvert(line, target) + call s:Initialize() + if !exists('s:mx_'.a:target) + return a:line + else + let mode = a:target =~# '^han_' ? 'Hankaku' : 'Zenkaku' + return substitute(a:line, s:mx_{a:target}, '\=s:ToggleLine(submatch(0),0,0,mode)', 'g') + endif +endfunction + +function! s:HzjaConvertVisual(target) + call s:Initialize() + let save_regcont = @" + let save_regtype = getregtype('"') + normal! gvy + call setreg('"', HzjaConvert(@", a:target), getregtype('"')) + normal! gv""p + call setreg('"', save_regcont, save_regtype) +endfunction + +let s:init = 0 +function! s:Initialize() + if s:init != 0 + return + endif + let s:init = 1 + + let s:match_character = '\%([]\|[]\|.\)' + let s:match_hankaku = '\%([]\|[]\|[ -~]\)' + + let zen_ascii = '@Ihfij{C|D^OPQRSTUVWXFGH`abcdefghijklmnopqrstuvwxymnOQeobp`' + let zen_kana = 'BuvA@BDFHb[ACEGIJLNPRTVXZ\^`cegijklmnqtwz}~JKKMOQSUWY[]_adfhorux{psvy|' + let han_ascii = " !\"#$%&'()*+,\\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" + let han_kana = '' + let s:mx_han_all = "[".zen_ascii.zen_kana."]\\+" + let s:mx_zen_all = "[".han_ascii.han_kana."]\\+" + let s:mx_han_ascii = "[".zen_ascii."]\\+" + let s:mx_zen_ascii = "[".han_ascii."]\\+" + let s:mx_han_kana = "[".zen_kana."]\\+" + let s:mx_zen_kana = "[".han_kana."]\\+" + let s:mx_han_eisu = '[OPQRSTUVWX`abcdefghijklmnopqrstuvwxy]\+' + let s:mx_zen_eisu = '[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]\+' + let s:mx_han_kigou = '[Ihfij{C|D^FGHmnOQeobp`]\+' + let s:mx_zen_kigou = "[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~]\\+" + let s:targetlist = "han_all\zen_all\han_ascii\zen_ascii\han_kana\zen_kana\han_eisu\zen_eisu\han_kigou\zen_kigou" + + " pSpe[u쐬 + let tmp = '' + let tmp = tmp . " @!I\"h#$%&'f(i)j*+{,C-|.D/^" + let tmp = tmp . '0O1P2Q3R4S5T6U7V8W9X:F;G<=>?H' + let tmp = tmp . '@A`BaCbDcEdFeGfHgIhJiKjLkMlNmOn' + let tmp = tmp . 'PoQpRqSrTsUtVuWvXwYxZy[m\]n^O_Q' + let tmp = tmp . '`eabcdefghijklmno' + let tmp = tmp . 'pqrstuvwxyz{o|b}p~`' + let tmp = tmp . 'BuvA@BDFHb' + let tmp = tmp . '[ACEGIJLNPRTVXZ\' + let tmp = tmp . '^`ƒcÃeăgŃiƃjǃkȃlɃmʃn˃q̃t̓w΃zσ}' + let tmp = tmp . 'Ѓ~у҃ӃԃՃփ׃؃كڃۃ܃݃ށJ߁K' + let tmp = tmp . 'ރރKރMރOރQރSރUރWރYރ[ރ]' + let tmp = tmp . 'ރ_ރaރdރfރhރoރrރuރxރ{' + let tmp = tmp . '߃p߃s߃v߃y߃|' + let tmp = tmp . '' + let s:table_h2z = tmp + + " Sppϊe[u쐬B + let s:table_z2h = '' + let startcol = 0 + let endcol = strlen(s:table_h2z) + let curcol = 0 + let mx = '^\(' . s:match_hankaku . '\)\(.\)' + while curcol < endcol + let char = matchstr(s:table_h2z, mx, curcol) + let s:table_z2h = s:table_z2h . substitute(char, mx, '\2\1', '') + let curcol = curcol + strlen(char) + endwhile +endfunction + +" +" R}hŎw肳ꂽ̈ϊ +" +function! s:ToggleLineWise(operator) range + call s:Initialize() + + let ncurline = a:firstline + while ncurline <= a:lastline + call setline(ncurline, s:ToggleLine(getline(ncurline), 0, 0, a:operator)) + let ncurline = ncurline + 1 + endwhile +endfunction + +" +" ^ꂽϊĕԂB +" +function! s:ToggleLine(line, startcolumn, endcolumn, operator) + let endcol = ((a:endcolumn > 0 && a:endcolumn < strlen(a:line))? a:endcolumn : strlen(a:line)) - 1 + let startcol = a:startcolumn > 0 ? a:startcolumn - 1: 0 + let curcol = startcol + let newline = '' + while curcol <= endcol + let char = matchstr(a:line, s:match_character, curcol) + let newline = newline . s:{a:operator}Char(char) + let curcol = curcol + strlen(char) + endwhile + return strpart(a:line, 0, startcol) . newline . strpart(a:line, curcol) +endfunction + +function! ToHankaku(str) + call s:Initialize() + return s:ToggleLine(a:str, 0, 0, 'Hankaku') +endfunction + +function! ToZenkaku(str) + call s:Initialize() + return s:ToggleLine(a:str, 0, 0, 'Zenkaku') +endfunction + +" +" char”\ȂΔp/SpϊĕԂBϊłȂꍇ͂̂܂܁B +" +function! s:ToggleChar(char) + return (s:IsHankaku(a:char)) ? (s:ZenkakuChar(a:char)) : (s:HankakuChar(a:char)) +endfunction + +" +" char”\ȂΑSpɕϊĕԂBϊłȂꍇ͂̂܂܁B +" +function! s:ZenkakuChar(char) + if s:IsHankaku(a:char) + let pos = matchend(s:table_h2z, '\V\C' . escape(a:char, '\')) + if pos >= 0 + return matchstr(s:table_h2z, '.', pos) + endif + endif + return a:char +endfunction + +" +" char”\ȂΔpɕϊĕԂBϊłȂꍇ͂̂܂܁B +" +function! s:HankakuChar(char) + if !s:IsHankaku(a:char) + let pos = matchend(s:table_z2h, '\V\C' . escape(a:char, '\')) + if pos >= 0 + return matchstr(s:table_z2h, s:match_hankaku, pos) + endif + endif + return a:char +endfunction + +" +" ^ꂽpǂ𔻒肷B +" +function! s:IsHankaku(char) + return a:char =~ '^' . s:match_hankaku . '$' +endfunction diff --git a/plugins/kaoriya/plugin/scrnmode.vim b/plugins/kaoriya/plugin/scrnmode.vim new file mode 100644 index 0000000000..02fce3010e --- /dev/null +++ b/plugins/kaoriya/plugin/scrnmode.vim @@ -0,0 +1,143 @@ +" vim:set ts=8 sts=2 sw=2 tw=0: +" +" scrnmode.vim - Screen mode changer. +" +" Maintainer: MURAOKA Taro +" Last Change: 09-Dec-2011. +" +" Commands: :ScreenMode {n} Set screen mode {n} n:0-8 +" :SM {n} Same as :ScreenMode +" :Revert Revert screen mode to start up (SM0) +" :Double Double width (SM2) +" :Fever Double width (SM8) +" :FullScreen Make window maximum with removing +" UI components. +" +" Options: 'fever_guifont' 'guifont' for fever mode +" +" Old Commands: :HDensity Start high-density mode (SM7) +" :WWidth Double width mode (SM2) +" :NDensity Return normal-density mode (SM0) +" +" Bug: After set full screen mode (more than 4), to set screen mode +" 4 cause too small edit area. + +let s:version = '1.1' + +if exists('g:plugin_scrnmode_disable') + finish +endif + +"--------------------------------------------------------------------------- + +"--------------------------------------------------------------------------- + +let s:save_original_options = 0 + +function! s:SaveOptions() + if !exists('g:fever_guifont') + if has('win32') + let g:fever_guifont = substitute(&guifont, ':h[^:]*:', ':h7.5:', '') + else + let g:fever_guifont = &guifont + endif + endif + + if !s:save_original_options + let s:save_guioptions = &guioptions + let s:save_guifont = &guifont + let s:save_linespace = &linespace + let s:save_columns = &columns + let s:save_lines = &lines + if has('win32') && has('kaoriya') + let s:save_charspace = &charspace + endif + let s:save_original_options = 1 + endif +endfunction + +function! s:LoadOptions() + if s:save_original_options + if has('win32') && has('kaoriya') + let &charspace = s:save_charspace + endif + let &guioptions = s:save_guioptions + let &guifont = s:save_guifont + let &linespace = s:save_linespace + let &columns = s:save_columns + let &lines = s:save_lines + endif +endfunction + +"--------------------------------------------------------------------------- + +function! s:ScreenMode(modenum) + if !has('gui_running') + return + endif + + call s:SaveOptions() + if a:modenum < 4 + if has('win32') | simalt ~r | endif + endif + call s:LoadOptions() + + if a:modenum <= 0 + return + endif + if a:modenum == 1 + let &guioptions = substitute(s:save_guioptions, '[lLrRmT]', '', 'g') + return + endif + + if a:modenum <= 3 + let &columns = s:save_columns * 2 + 1 + if a:modenum == 3 + let &guioptions = substitute(s:save_guioptions, '[lLrRmT]', '', 'g') + endif + return + endif + + if a:modenum >= 4 + " Full screen window + if a:modenum >= 7 + let &guifont = g:fever_guifont + endif + if a:modenum >= 6 + if has('win32') && has('kaoriya') + set charspace=0 + endif + if a:modenum != 7 + set linespace=0 + endif + endif + let new_guioptions = s:save_guioptions + if a:modenum >= 5 + let new_guioptions = substitute(new_guioptions, '[lLrRmT]', '', 'g') + if has('win32') && has('kaoriya') + let new_guioptions = new_guioptions.'C' + endif + endif + let &guioptions = new_guioptions + if has('win32') | simalt ~x | endif + return + endif +endfunction + +function! s:FullScreen() + let &guioptions = substitute(&guioptions, '[LRTlrm]', '', 'g') + if has('win32') | simalt ~x | endif +endfunction + +"--------------------------------------------------------------------------- + +command! -nargs=1 ScreenMode call ScreenMode() +command! -nargs=1 SM call ScreenMode() +command! -nargs=0 Revert call ScreenMode(0) +command! -nargs=0 Double call ScreenMode(2) +command! -nargs=0 Fever call ScreenMode(8) +command! -nargs=0 FullScreen call FullScreen() + +command! -nargs=0 NDensity call ScreenMode(0) +command! -nargs=0 WWidth call ScreenMode(2) +command! -nargs=0 HDensity call ScreenMode(7) diff --git a/plugins/kaoriya/plugin/verifyenc.vim b/plugins/kaoriya/plugin/verifyenc.vim new file mode 100644 index 0000000000..76f53614bb --- /dev/null +++ b/plugins/kaoriya/plugin/verifyenc.vim @@ -0,0 +1,181 @@ +" vi:set ts=8 sts=2 sw=2 tw=0 et: +" +" verifyenc.vim +" Verify the file is truly in 'fileencoding' encoding. +" +" Maintainer: MURAOKA Taro +" Last Change: 10-Mar-2013. +" Options: 'verifyenc_enable' When 0, checking become disable. +" 'verifyenc_maxlines' Maximum range to check (for speed). +" +" To make vim NOT TO LOAD this plugin, write next line in your .vimrc: +" :let plugin_verifyenc_disable = 1 + +if exists('plugin_verifyenc_disable') + finish +endif + +" Set default options +if !exists("verifyenc_enable") + let verifyenc_enable = 1 +endif +if !exists("verifyenc_maxlines") + let verifyenc_maxlines = 100 +endif + +"----------------------------------------------------------------------------- + +command! -nargs=? VerifyEnc call Status() + +" Set autocmd for VerifyEncoding +if has('autocmd') + augroup VerifyEncoding + au! + autocmd BufReadPost * call VerifyEncoding() + augroup END +endif + +function! s:Status(argv) + if a:argv == '' + let g:verifyenc_enable = g:verifyenc_enable + elseif a:argv ==? 'on' + let g:verifyenc_enable = 1 + elseif a:argv ==? 'off' + let g:verifyenc_enable = 0 + elseif a:argv =~? '^t\%[oggle]$' + let g:verifyenc_enable = g:verifyenc_enable ? 0 : 1 + endif + echo 'Verify encoding is *'.(g:verifyenc_enable ? 'ON' : 'OFF').'*' +endfunction + +function! s:EditByGlobalFenc() + if len(bufname('%')) != 0 + execute 'edit! ++enc='.&g:fileencoding + endif + let b:verifyenc_guard = 1 + doautocmd BufReadPost + unlet b:verifyenc_guard +endfunction + +function! s:GetMaxlines() + return min([line('$'), g:verifyenc_maxlines]) +endfunction + +function! s:IsDisabled() + if !has('iconv') || &modifiable == 0 || g:verifyenc_enable == 0 || exists('b:verifyenc_guard') + return 1 + else + return 0 + endif +endfunction + +function! s:VerifyEncoding() + if s:IsDisabled() + return + endif + " Check fenc=guess has been worked yet, to cancel verification. + if exists('b:x_guessed_fileencoding') + let b:verifyenc = 'CANCELED BY GUESS' + return + endif + " Check if empty file. + if &fileencoding != '' && line2byte(1) < 0 + call s:EditByGlobalFenc() + let b:verifyenc = 'SUPPRESSED' + return + endif + " Check whether multibyte is exists or not. + if &fileencoding != '' && &fileencoding !~ '^ucs' && s:HasMultibyteChar() + let b:verifyenc = 'NO MULTIBYTE' + return + endif + " Check to be force euc-jp + if &encoding =~# '^euc-\%(jp\|jisx0213\)$' && s:Verify_euc_jp() + call s:EditByGlobalFenc() + let b:verifyenc = 'FORCE EUC-JP' + return + endif + " Check to be force cp932 + if &encoding == 'cp932' && s:Verify_cp932() + call s:EditByGlobalFenc() + let b:verifyenc = 'FORCE CP-932' + return + endif + " Nop + let b:verifyenc = 'NONE' +endfunction + +function! s:SearchFromTop(pattern) + let stopline = s:GetMaxlines() + let timeout = 1000 + let pos = getpos('.') + normal! 1G + let retval = search(a:pattern, 'cnW', stopline, timeout) > 0 + call setpos('.', pos) + return retval +endfunction + +"----------------------------------------------------------------------------- +" multibyte character + +function! s:HasMultibyteChar() + if &fileencoding == '' || &encoding == &fileencoding + return 0 + endif + + " Assure latency for big files without multibyte chars. + let stopline = s:GetMaxlines() + let timeout = 1000 + + if s:SearchFromTop("[^\t -~]") > 0 + return 0 + else + " No multibyte characters, then set global 'fileencoding'. + let &l:fileencoding = &g:fileencoding + return 1 + endif +endfunction + +"----------------------------------------------------------------------------- +" euc-jp + +let s:mx_euc_kana = '['.nr2char(0x8ea4).nr2char(0x8ea5).']'.'\%([^\t -~]\)' + +" For development purpose. +if 0 + function! CheckEucEUC() + echo "charlen=".strlen(substitute(substitute(getline('.'),'[\t -~]', '', 'g'), '.', "\1", 'g')) + echo "kanalen=".strlen(substitute(substitute(getline('.'), s:mx_euc_kana, "\1", 'g'), "[^\1]", '', 'g')) + endfunction +endif + +function! s:Verify_euc_jp() + if &encoding =~# '^euc-\%(jp\|jisx0213\)$' && &fileencoding != '' && &encoding != &fileencoding + " Range to check + let rangelast = s:GetMaxlines() + " Checking loop + let linenum = 1 + while linenum <= rangelast + let curline = getline(linenum) + let charlen = strlen(substitute(substitute(curline,'[\t -~]', '', 'g'), '.', "\1", 'g')) + let kanalen = strlen(substitute(substitute(curline, s:mx_euc_kana, "\1", 'g'), "[^\1]", '', 'g')) + if charlen / 2 < kanalen * 3 + return 1 + endif + let linenum = linenum + 1 + endwhile + endif + return 0 +endfunction + +function! s:Verify_cp932() + if &encoding == 'cp932' && &fileencoding == 'cp932' + let stopline = s:GetMaxlines() + let timeout = 10000 + if s:SearchFromTop('[\x82]$') > 0 + return 1 + endif + " TODO: Verify another encodings that didn't be recognized. + endif + return 0 +endfunction diff --git a/plugins/kaoriya/syntax/memo.vim b/plugins/kaoriya/syntax/memo.vim new file mode 100644 index 0000000000..c7b7c05803 --- /dev/null +++ b/plugins/kaoriya/syntax/memo.vim @@ -0,0 +1,51 @@ +" vim:ts=8 sts=2 sw=2 tw=0 nowrap: +" +" memo.vim - pV^bNX` +" +" Language: memo +" Maintainer: MURAOKA Taro +" Last Change: 18-Jan-2013. + +scriptencoding cp932 + +syntax match memoLabel display "^\%>1l\k\+\>" +syntax match memoLabelUpper display "^[A-Z]\+\>\(\s\|\d\|$\)" +syntax match memoLabelDate display "^\d\+-\k\+-\d\+\(\.\)\=" +syntax match memoLabelSquare display "^\s*[]"hs=e-1 +syntax match memoLabelRound display "^\s*[Z]"hs=e-1 +syntax match memoLabelParenthesis display "\(^\s*\)\@<=([^)]*)" +syntax match memoLabelWarning display ":" +"syntax match memoLabelNote display "⑫:"he=e-1 + +syntax match memoTitle display "\%1l.*" +syntax match memoDate display "\<\([012]\d\|3[01]\)-\k\+-\d\+\(\.\)\=" +syntax match memoUrl display "\(https\=\|ftp\):[-!#%&+,./0-9:;=?@A-Za-z_~]\+" + +syntax match memoListItem display "^\s*[-+*]\s\+\S.*$" +syntax match memoListOrderedItem display "^\s*\d\+[.):]\s\+\S.*$" + +syntax match memoComment display '^\s*#\s\+\S.*$' +syntax match memoCommentTitle display '^\s*\u\a*\(\s\+\u\a*\)*:' +syntax match memoCommentVim display '^\s*vi\(m\)\=:[^:]*:' + + +hi def link memoLabel Statement +hi def link memoLabelUpper Todo +hi def link memoLabelDate Todo +hi def link memoLabelSquare Comment +hi def link memoLabelRound WarningMsg +hi def link memoLabelWarning Error +hi def link memoLabelParenthesis Special + +hi def link memoTitle Title +hi def link memoDate Constant +hi def link memoUrl Underlined + +hi def link memoListItem Identifier +hi def link memoListOrderedItem Identifier + +hi def link memoComment Comment +hi def link memoCommentTitle PreProc +hi def link memoCommentVim PreProc + +let b:current_syntax = "memo" diff --git a/plugins/vimdoc-ja/README.md b/plugins/vimdoc-ja/README.md new file mode 100644 index 0000000000..488778b396 --- /dev/null +++ b/plugins/vimdoc-ja/README.md @@ -0,0 +1,16 @@ +# vimdoc-ja + +[![Build Status](https://travis-ci.org/vim-jp/vimdoc-ja-working.svg?branch=master)](https://travis-ci.org/vim-jp/vimdoc-ja-working) + +日本語に翻訳した Vim 付属のヘルプを配布するためのプロジェクトです。 + +詳しい利用方法については [wiki](https://github.com/vim-jp/vimdoc-ja/wiki) を参照してください。 + +HTML 版は [http://vim-jp.org/vimdoc-ja/](http://vim-jp.org/vimdoc-ja/) から参照することができます。 + +間違いを見つけた場合、メーリングリストか issue トラッカーでお知らせください。 + +- メーリングリスト http://groups.google.com/group/vimdoc-ja +- issue トラッカー https://github.com/vim-jp/vimdoc-ja-working/issues + +翻訳作業に協力していただける方は [https://github.com/vim-jp/vimdoc-ja-working](https://github.com/vim-jp/vimdoc-ja-working) をご覧ください。 diff --git a/plugins/vimdoc-ja/doc/arabic.jax b/plugins/vimdoc-ja/doc/arabic.jax new file mode 100644 index 0000000000..e07b65eae0 --- /dev/null +++ b/plugins/vimdoc-ja/doc/arabic.jax @@ -0,0 +1,301 @@ +*arabic.txt* For Vim バージョン 8.0. Last change: 2010 Nov 13 + + + VIMリファレンスマニュアル by Nadim Shaikli + + +アラビア語サポート (オプション & マッピング) *Arabic* + +{Vi にはこれらのコマンドはありません} + + *E800* +right-to-left (右横書き) とアラビア語マッピングを使用するには、Vim を +|+arabic| 機能付きでコンパイルする必要があります。 + +これらの機能は Nadim Shaikli によって作成されました。 + +このファイルは GUI の Vim で以下の設定をして表示するのが最適です: > + + :set encoding=utf-8 + :set arabicshape + + +はじめに +-------- +アラビア語はいくつかの特殊な機能を必要とする言語です。文字は右から左へ向かうの +でスクリーン上でもそのように表示する必要があります (つまり右から左へ表示す +る)。アラビア語は文字変形 (shaping) も必要とします。文字を書く位置によって同じ +文字でも別の字形になります (単語の最初、中、最後、または単独で書くかで変わ +る)。アラビア語は二種類の文字合成も必要とします。場合によっては、一つの文字に +他の文字を最大二つまで重ねる (合成、composing) か、二つの文字を一つの文字に置 +換する (結合、combining) かします。 +アラビア語を適切に表示するには ISO-8859-6 (U+0600-U+06FF) のフォントに加えて +Presentation Form-B (U+FE70-U+FEFF) のフォントも必要です。これらはいわゆる +ISO-10646-1 フォントのサブセットです。 + +コマンド、プロンプト、ヘルプファイルはアラビア語にはなりません。したがってユー +ザーインターフェイスは標準の Vi インターフェイスのままです。 + + +特徴 +----- +o left-to-right ファイルの編集はオリジナルの VIM と変わりません。 + +o right-to-left ウィンドウでのファイルの表示と編集。表示方向はウィンドウ単位 + なので、同じファイルを right-to-left と left-to-right で同時に表示できま + す。 + +o right-to-left のための特殊な端末を必要としない。 + right-to-left の機能はハードウェアに依存していません。必要なのはアラビア語 + フォントだけです。 + +o オリジナルの VIM との互換性。ほとんどの機能は right-to-left モードでも機能 + します (バグになりやすい) + +o キーボードマッピングと反転挿入モード (reverse insert mode) を一つのコマンド + で切り替える。 + +o アラビア語サポートを一つのコマンドで切り替える。 + +o アラビア語モードでは数字は左から右へ入力されます。その後で数字以外の文字を + 入力すると、その文字は数字の一番左側に挿入されます。 + +o 反転挿入モードでのコマンドラインのアラビア語キーマッピング。 + +o 正式な双方向機能は VIM を双方向対応端末エミュレータ上で実行すれば利用可能で + す。 + + +アラビア語フォント *arabicfonts* +------------------ + +VIM は固定幅フォントを使います。アラビア語には ISO-8859-6 と Presentation +Form-B のフォントが必要です (Form-B 無しではアラビア語は使用できない)。フォン +トを探す際にはいわゆる 'ISO-10646-1' フォントを探してください。インターネット +を検索するか www.arabeyes.org を見て必要なアラビア語フォントを手に入れてくださ +い。 + + +フォントのインストール +---------------------- + +o X ウィンドウシステム (Unix/Linux) でのフォントのインストール + + システムによって違いますが、アラビア語フォントのファイルを適当なディレクト + リにコピーします。そのアラビア語フォントをコピーしたディレクトリに移動して + 次のコマンドを実行します: + + % mkfontdir + % xset +fp path_name_of_arabic_fonts_directory + + +使用方法 +-------- +実際に Vim でアラビア語を使用する前に、しなければならない設定がいくつかありま +す。 + +o アラビア語フォントを設定する + + + VIM GUI で 'guifont' をアラビア語フォントに設定します。VIM ウィンドウで + 次のように入力します。 +> + :set guifont=your_ARABIC_FONT +< + NOTE: 'your_ARABIC_FONT' の部分には Linux/Unix システムで使用されている + 実際のフォント名を入れてください。 + (例: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1) + + 'guifont' の設定を .vimrc ファイルに書くこともできます。言い換えると、 + ':set guifont=your_ARABIC_FONT' を .vimrc ファイルに書くことができます。 + + + X ウィンドウ環境では、'-fn your_ARABIC_FONT' を VIM の起動引数に指定する + 方法もあります。 + +o 適切なエンコーディングを設定する + アラビア語に適したエンコーディングを設定するには次のコマンドを .vimrc ファ + イルに追加します。 +> + :set encoding=utf-8 +< + (このコマンドを VIM ウィンドウで直接実行しないでください) + 簡単に言えば ':set encoding=utf-8' を .vimrc ファイルに書くだけです。 + + アラビア語を UTF-8 以外のエンコーディングで使用すると次の警告メッセージが表 + 示されます。 + + *W17* > + Arabic requires UTF-8, do ':set encoding=utf-8' + +o アラビア語設定の有効化 [近道] + + 手っ取り早く設定するには、コマンドラインから次のようにして VIM を起動する + か、 + + % vim -A my_utf8_arabic_file ... + + または VIM の中で次のコマンドを実行して 'arabic' を有効にします +> + :set arabic +< + これが最も簡単な方法です。'termbidi' が有効化されていなければ、次の設定が実 + 行されます: + + 1. 適切なキーマップを設定する + 2. 合成文字を一度で削除できるようにする + 3. rightleft モードを有効にする + 4. rightleftcmd モードを有効にする (コマンドラインに作用する) + 5. arabicshape モードを有効にする (表示文字を変更する) + + .vimrc ファイルに ':set arabic' を書いておくこともできます。 + + 次のコマンドでアラビア語サポートを無効化できます +> + :set noarabic +< + コマンドによって有効にされた設定がすべてリセットされます。他のバッファに影 + 響があるようなグローバル設定は変更されません。 + 簡単に言えば 'noarabic' コマンドによって次の設定が実行されます: + + 1. キーマップ切替をリセットする + 2. 合成文字を一度で削除できる機能を無効化にする + 3. rightleft モードを無効化する + + NOTE: 'arabic' コマンドは 'termbidi' を見て端末が双方向テキスト + (bi-directional, bidi) をサポートしているかどうかを考慮します (例えば + "mlterm" がサポートしています)。 + 'termbidi' が利用できる場合は、rightleft のサポートが優れているそちら + の使用をお勧めします。 + 'termbidi' が有効な場合は 'arabic' はキーマップのみ設定します。 + + もし、冗長で明示的な方法が好きで、'arabic' コマンドを使って近道をしたくない + という場合は、以下の説明を読んでください (':set arabic' を使用する方はこの + 節は飛ばして構いません)。 + + + アラビア語キーマッピングの有効化 + + アラビア語キーマップを有効可するには (つまり English/Latin キーボードを + 標準のアラビア語キーボードのようにするには)、'keymap' コマンドを + "arabic" に設定します。VIM ウィンドウで次のように入力します +> + :set keymap=arabic +< + 'keymap' 設定コマンドを .vimrc ファイルに書くこともできます。言い換えれ + ば、.vimrc ファイルに ':set keymap=arabic' を含めることができます。 + + アラビア語のキーマッピングとデフォルト (English) のキーマッピングを切り + 替えるには、挿入モード (または追加/置換モード) で 'CTRL-^' キーを押しま + す。コマンドラインのモード表示の隣に "Arabic" の文字列が表示され + (例: -- INSERT Arabic --)、それが現在のキーマップを示します。 + + + 合成文字の削除 + + 初期設定では 'delcombine' オプションは無効化されています。このオプション + は LAM_ALEF (LAA) 合成文字内の ALEF を削除し、LAM だけを残すことを可能に + します (つまり合成文字を解除して元の字形に戻す。これは harakat とその合 + 成字形にも関係する)。このオプションを有効化するには VIM ウィンドウで次の + ように入力します +> + :set delcombine +< + 'delcombine' の設定コマンドを .vimrc ファイルに書くこともできます。言い + 換えれば、.vimrc ファイルに ':set delcombine' を含めることができます。 + + + アラビア語 right-to-left モード + + 初期設定では VIM は left-to-right モードで起動します。'rightleft' を設定 + することでウィンドウの方向を変更できます。使用方法は次のとおり。 + + - left-to-right モードと right-to-left モードの切り替えは ':set + rightleft' と ':set norightleft' でできます。 + + - left-to-right モードでは、':set rl' コマンドを実行します + ('rl' は rightleft の省略形)。 + + - Vim を起動したときに常に right-to-left モードにしたい場合は '.vimrc' + ファイルに ':set rl' を書いてください。 + + + アラビア語 right-to-left コマンドラインモード + + 特定のコマンドでは right-to-left モードで編集ができます。現在対応してい + るのは検索コマンドだけです。 + + 動作は 'rightleftcmd' オプションで変更できます。初期設定は "search" で、 + これは 'rightleft' がオンになっているウィンドウで検索コマンドを使うと + right-left モードでの編集になります。これを無効化するには次のようにしま + す。 +> + :set rightleftcmd= +< + 再び検索コマンドでの right-left 編集を有効化するには次のようにします。 +> + :set rightleftcmd& +< + + アラビア語字形モード + + アラビア語は視覚字形変更 (shaping(文字変形), composing(合成), + combining(結合)) を必要としますが、それを有効にするには 'arabicshape' を + 設定します。VIM ウィンドウで次のコマンドを実行します。 +> + :set arabicshape +< + .vimrc ファイルで 'arabicshape' を設定することもできます。その場合は + ':set arabicshape' を .vimrc ファイルに書きます。 + + +Keymap/Keyboard *arabickeymap* +--------------- + +VIM で使用する文字エンコーディングは標準の UTF-8 です。 +他のエンコーディングの使用は推奨されていません。 + +Note: UTF-8 はあらゆるものを含むエンコーディングで、アラビア語において唯一サ + ポートされている (そして推奨されている) エンコーディングです (他のプロプ + ライエタリなエンコーディングは非推奨であり使うべきではありません)。 + +o キーボード + + + 挿入モードと置換モードでは CTRL-^ でアラビア語モードとラテン語モードが切 + り替わります。 + + + キーボードマッピングはマイクロソフトのアラビア語キーマップに基づいていま + す (アラビア語圏のデファクトスタンダードです): + + +---------------------------------------------------------------------+ + |! |@ |# |$ |% |^ |& |* |( |) |_ |+ || |~ ّ | + |1 ١ |2 ٢ |3 ٣ |4 ٤ |5 ٥ |6 ٦ |7 ٧ |8 ٨ |9 ٩ |0 ٠ |- |= |\ |` ذ | + +---------------------------------------------------------------------+ + |Q َ |W ً |E ُ |R ٌ |T لإ |Y إ |U ` |I ÷ |O x |P ؛ |{ < |} > | + |q ض |w ص |e ث |r ق |t ف |y غ |u ع |i ه |o خ |p ح |[ ج |] د | + +-----------------------------------------------------------+ + |A ِ |S ٍ |D [ |F ] |G لأ |H أ |J ـ |K ، |L / |: |" | + |a ش |s س |d ي |f ب |g ل |h ا |j ت |k ن |l م |; ك |' ط | + +------------------------------------------------------+ + |Z ~ |X ْ |C { |V } |B لآ |N آ |M ' |< , |> . |? ؟ | + |z ئ |x ء |c ؤ |v ر |b لا |n ى |m ة |, و |. ز |/ ظ | + +-------------------------------------------------+ + +制限 +----- + +o VIM の GUI では Bi-directionality (双方向性) は正しくサポートされていません + (つまりアラビア語とラテン語を同じ行に書いたときに正しく表示されません)。 + + +既知のバグ +---------- + +既知の小さなバグが一つあります。 + + 1. LAM (U+0644) のうしろに haraka (例: Fatha (U+064E)) を入力して、そして + ALEF (U+0627) を入力したとき、文字が正しく結合されません。これは二つの文字 + に挟まれた haraka が正しく表示されないために起こります。 + + WORK-AROUND: LAM と ALEF の間に harakats を置かないでください。 + 一般に、harakats と LAM+ALEF の結合文字が正しく表示されること + は期待できません (二つの文字のうしろに入力したとしてもです)。 + これは表示上の問題なので、ファイルを保存するときには正しい情 + 報が書き込まれます。情報は失われません。 + +他に既知のバグはありません。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/autocmd.jax b/plugins/vimdoc-ja/doc/autocmd.jax new file mode 100644 index 0000000000..0ed77c99d4 --- /dev/null +++ b/plugins/vimdoc-ja/doc/autocmd.jax @@ -0,0 +1,1469 @@ +*autocmd.txt* For Vim バージョン 8.0. Last change: 2017 Jan 14 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +自動コマンド *autocommand* + +基本的な説明については、ユーザーマニュアルの |40.3| 章を参照。 + +1. はじめに |autocmd-intro| +2. 自動コマンドの定義 |autocmd-define| +3. 自動コマンドの削除 |autocmd-remove| +4. 自動コマンドの列挙 |autocmd-list| +5. イベント |autocmd-events| +6. パターン |autocmd-patterns| +7. バッファローカルな自動コマンド |autocmd-buflocal| +8. グループ |autocmd-groups| +9. 自動コマンドの実行 |autocmd-execute| +10.自動コマンドの使用 |autocmd-use| +11.自動コマンドを無効にする |autocmd-disable| + +{Vi にはこれらのコマンドはない} +{only: |+autocmd| の機能は、コンパイル時に有効にされていなければ使えない。} + +============================================================================== +1. はじめに *autocmd-intro* + +ファイルを読み込んだり書き込むときや、バッファやウィンドウに入ったり出たりし +たとき、あるいはVimを終了させるときに、コマンドを自動的に実行するように指定で +きる。例えば "*.c" にマッチするファイルに対して、オプション 'cindent' をオンに +する自動コマンドを作ることができる。また自動コマンドでさらに高度な機能を実装す +ることができる。圧縮ファイルを編集するといったような機能だ (|gzip-example| を +参照)。こういった自動コマンドはファイル .vimrc かファイル .exrc に書き込む。 + + *E203* *E204* *E143* *E855* *E937* +警告: 自動コマンドは大変強力であるので、思いも寄らない副作用をもたらすことがあ +る。テキストを壊さないように注意しなければならない。 +- 捨ててもよいようなファイルのコピーに対して、最初にテストしておくのがよい。例 + えば、ファイルの編集開始時にファイルを解凍する自動コマンドを使うときには、 + 書き込みするときに圧縮を行う自動コマンドが正しく働くか確かめること。 +- 実行中のエラー (例えばディスクが満杯になる) に対して、対処の準備をしておかな + ければならない。バッファへの変更に対しては大抵アンドゥができるが、他のファイ + ルへの変更は、自分で処理しなければならないかもしれない (例えば、解凍されたファ + イルを圧縮する、等)。 +- もしイベント BufRead* の自動コマンドによって圧縮ファイルを編集できるなら、 + FileRead* でも同じ事ができるようにするべきである (こうすることで復旧可能にな + る場合がたまにある)。可能であれば、イベント File* や Buf* には同じ自動コマン + ドを使うのはよい考えだ。 + +============================================================================== +2. 自動コマンドの定義 *autocmd-define* + + *:au* *:autocmd* +:au[tocmd] [group] {event} {pat} [nested] {cmd} + {pat} |autocmd-patterns| に一致するファイルで、{event} + のときに自動的に実行するコマンドのリストに、{cmd} を加 + える。 + {cmd} は常に既存の自動コマンドの後に追加されるので、 + 自動コマンドは指定された順に実行される。 [nested] につ + いては|autocmd-nested| を参照。 + +特殊なパターンはバッファローカルな自動コマンドを定義する。 +|autocmd-buflocal|を参照。 + +Note: '|' が {cmd} の前にある場合、":autocmd" コマンドの後には別のコマンドを続 +けることができる。これは動作する: > + :augroup mine | au! BufRead | augroup END +しかし、これは定義されたコマンドの一部として "augroup" を見る: > + :augroup mine | au BufRead * set tw=70 | augroup END + +Note ":autocmd" の引数の中の特別な文字 (例えば "%" や "" 等) は、 +自動コマンドが定義されたときに展開されるのではなく、イベントの発生が認識され、 +{cmd} が実行されるときに展開されることに注意せよ。唯一の例外は、"" が +自動コマンドが定義されたときに展開されることである。例: > + + :au BufNewFile,BufRead *.html so :h/html.vim + +ここで は、この行を含むファイルの名前に展開される。 + +`:autocmd` は、すでに存在しているかどうかに関わらず、自動コマンドのリストに +追加する。.vimrc ファイルが2回読み込まれると、自動コマンドが2回表示される。こ +れを避けるには、グループ内に自動コマンドを定義することで、簡単にクリアできる: +> + augroup vimrc + autocmd! " 「全ての」vimrcの自動コマンドを削除する + au BufNewFile,BufRead *.html so :h/html.vim + augroup END + +もし全ての自動コマンドを消去したくなかったら、代わりに変数を使って +自動コマンドを読み込むのがただ1度だけにすることができる。 > + + :if !exists("autocommands_loaded") + : let autocommands_loaded = 1 + : au ... + :endif + +引数 [group] が指定されないと、現在のグループが使われる (":augroup" で定義さ +れたもの)。そうでなければ、Vimは [group] で定義されたグループを使う。 +Note [group] はあらかじめ定義されていなければならないことに注意。 +":au group ..." で新しいグループを定義することはできない。それには ":augroup" +を使うこと。 + +自動コマンドをテストするとき、オプション 'verbose' が便利かもしれない。 > + :set verbose=9 +この設定により、Vimは自動コマンドが実行されるとそれらを表示するようになる。 + +スクリプト内で自動コマンドを定義するときには、スクリプト内でのみ有効なローカ +ル関数とローカルキーマップを利用できる。イベントが発生してコマンドが実行される +とき、コマンドは自分の定義されたスクリプト内での設定に従って働く。これはコマン +ドに || が使われているときに問題になる。 + +コマンドを実行するとき、あるコマンドからのメッセージは前のメッセージを上書きし +てしまう。これはコマンドを手動で実行するときとは違う動作である。大抵、メッセー +ジスクリーンはスクロールしないので、「続けるには」というプロンプトは現れない。 +また1個のコマンドが2つのメッセージを出すときには、何にせよメッセージは上書きさ +れてしまう。 + +============================================================================== +3. 自動コマンドの除去 *autocmd-remove* + +:au[tocmd]! [group] {event} {pat} [nested] {cmd} + {event} と {pat} に関連づけられた全ての自動コマンドを + 除去し、コマンド {cmd} を加える。 [nested] については + |autocmd-nested| を参照。 + +:au[tocmd]! [group] {event} {pat} + {event} と {pat} に関連づけられた全ての自動コマンドを + 除去する。 + +:au[tocmd]! [group] * {pat} + {pat} に関連づけられた、全てのイベントに関する + 自動コマンドを全て除去する。 + +:au[tocmd]! [group] {event} + {event} に関連づけられた「全ての」自動コマンドを除去す + る。 + 警告: |BufRead| や他の一般的なイベントのためのグループ + なしでこれを行うべきではない。プラグインや構文のハイラ + イトなどを壊すことがある。 + +:au[tocmd]! [group] 「全ての」自動コマンドを除去する。 + 警告: 通常はグループなしでこれを行うべきではない。プラ + グインや構文の強調表示などが壊れる。 + +引数 [group] が指定されないと、現在のグループが使われる (":augroup" で定義され +たもの)。そうでなければ、[group] で定義されたグループが使われる。 + +============================================================================== +4. 自動コマンドの列挙 *autocmd-list* + +:au[tocmd] [group] {event} {pat} + {event} と {pat} に関連づけられた全ての自動コマンドを + 表示する。 + +:au[tocmd] [group] * {pat} + {pat} に関連づけられた、全てのイベントに関する + 自動コマンドを表示する。 + +:au[tocmd] [group] {event} + {event} に関連づけられた全ての自動コマンドを表示する。 + +:au[tocmd] [group] 全ての自動コマンドを表示する。 + +引数 [group] を指定すると、[group] に関する自動コマンドのみが列挙される。そ +うでなければ、「全ての」グループに関する自動コマンドが表示される。Note ここで +の引数による動作の違いは、自動コマンドを定義したり除去するときとは違うことに注 +意。 + +バッファローカルな自動コマンドを列挙するには、またはという形 +のパターンを使う。|autocmd-buflocal|を参照。 + + *:autocmd-verbose* +'verbose'がゼロでないならば、自動コマンドを列挙するときに、それが最後にどこで +定義されたかも表示する。例: > + + :verbose autocmd BufEnter + FileExplorer BufEnter + * call s:LocalBrowse(expand("")) + Last set from /usr/share/vim/vim-7.0/plugin/NetrwPlugin.vim +< +より詳しい情報は|:verbose-cmd|を参照。 + +============================================================================== +5. イベント *autocmd-events* *E215* *E216* + +複数のイベントをコンマ (,) で区切ったリストにして指定することもできる。そのリ +ストにはスペースを含めてはいけない。そのコマンドは指定したリストにある全てのイ +ベントに適用される。 + +「ファイル読み込み」には次の4種類のイベントが発生しうる。 + BufNewFile 存在しないファイルの編集を開始する。 + BufReadPre BufReadPost 既存のファイルの編集を開始する。 + FilterReadPre FilterReadPost フィルタの出力による一時ファイルを読み + 込む。 + FileReadPre FileReadPost その他のファイルを読み込む。 +Vimはファイルを読み込むときにこの4種類のうちどれか1つを利用する。"Pre"と"Post" +のイベントは、ファイル読み込みの前後で両方とも起動される。 + +Note イベント *ReadPre や、全てのイベント Filter に関する自動コマンドは、カレ +ントバッファを変更してはならないことに注意 (これが起きると、エラーメッセージが +表示される)。これは、間違ったバッファにファイルを読み込むのを防ぐためである。 + +Note オプション 'modified' は、BufReadPost と BufNewFile の自動コマンドを実行 +した「後に」オフに設定されることに注意。しかし 'modified' が自動コマンドから +オンに設定されたときはそうならない。 + +'eventignore' は、いくつかあるいは全てのイベントを無視するために使える。 + + + *autocommand-events* *{event}* +Vimは以下のイベントを認識する。イベント名が大文字か小文字かは無視される (例え +ば "BufRead" の代わりに "BUFread" や "bufread" が使える)。 + +まず機能ごとに短い説明とともに概要を解説する。それから完全な説明とともにアル +ファベット順のリストを載せる |autocmd-events-abc|。 + +名前 発生するとき ~ + + 読み込み +|BufNewFile| 存在しないファイルの編集を始めたとき +|BufReadPre| 新しいバッファの編集を始めたとき。ファイルを読み込む前 +|BufRead| 新しいバッファの編集を始めたとき。 + ファイルを読み込んだ後 +|BufReadPost| 新しいバッファの編集を始めたとき。 + ファイルを読み込んだ後 +|BufReadCmd| 新しいバッファの編集を始める前 |Cmd-event| + +|FileReadPre| ":read"でファイルを読み込む前 +|FileReadPost| ":read"でファイルを読み込んだ後 +|FileReadCmd| ":read"でファイルを読み込む前 |Cmd-event| + +|FilterReadPre| フィルタコマンドでファイルを読み込む前 +|FilterReadPost| フィルタコマンドでファイルを読み込んだ後 + +|StdinReadPre| 標準入力からバッファに読み込む前 +|StdinReadPost| 標準入力からバッファに読み込んだ後 + + 書き込み +|BufWrite| バッファ全体をファイルに書き込むとき +|BufWritePre| バッファ全体をファイルに書き込むとき +|BufWritePost| バッファ全体をファイルに書き込んだ後 +|BufWriteCmd| バッファ全体をファイルに書き込む前 |Cmd-event| + +|FileWritePre| バッファの一部をファイルに書き込むとき +|FileWritePost| バッファの一部をファイルに書き込んだ後 +|FileWriteCmd| バッファの一部をファイルに書き込む前 |Cmd-event| + +|FileAppendPre| ファイルに追加するとき +|FileAppendPost| ファイルに追加した後 +|FileAppendCmd| ファイルに追加する前 |Cmd-event| + +|FilterWritePre| フィルタコマンドやdiff用にファイルを書き込むとき +|FilterWritePost| フィルタコマンドやdiff用にファイルを書き込んだ後 + + バッファ +|BufAdd| バッファリストにバッファを追加した直後 +|BufCreate| バッファリストにバッファを追加した直後 +|BufDelete| バッファリストからバッファを削除する前 +|BufWipeout| 完全にバッファを削除する前 + +|BufFilePre| カレントバッファの名前を変える前 +|BufFilePost| カレントバッファの名前を変えた後 + +|BufEnter| バッファに入った後 +|BufLeave| 別のバッファへ移る前 +|BufWinEnter| バッファがウィンドウに表示された後 +|BufWinLeave| バッファがウィンドウから削除される前 + +|BufUnload| バッファをアンロードする前 +|BufHidden| バッファが隠れバッファになった直後 +|BufNew| 新規バッファを作成した直後 + +|SwapExists| 既存のスワップファイルを検出したとき + + オプション +|FileType| オプション'filetype'がセットされたとき +|Syntax| オプション'syntax'がセットされたとき +|EncodingChanged| オプション'encoding'が変更された後 +|TermChanged| オプション'term'が変更された後 +|OptionSet| オプションが設定された後 + + 起動と終了 +|VimEnter| 全ての起動処理が終わった後 +|GUIEnter| GUIの起動が成功した後 +|GUIFailed| GUIの起動が失敗した後 +|TermResponse| |t_RV|に対する端末の反応を受け取った後 + +|QuitPre| `:quit` を使ったとき、本当に閉じるか決定する前 +|VimLeavePre| Vimを終了する前、viminfoファイルを書き出す前 +|VimLeave| Vimを終了する前、viminfoファイルを書き出した後 + + その他 +|FileChangedShell| 編集を始めた後にファイルが変更されたことを検出したとき +|FileChangedShellPost| 編集を始めた後にファイルが変更されたことに対処した後 +|FileChangedRO| 読み込み専用ファイルに対して最初に変更を加える前 + +|ShellCmdPost| シェルコマンドを実行した後 +|ShellFilterPost| シェルコマンドでフィルタをかけた後 + +|CmdUndefined| 呼び出そうとしたユーザー定義コマンドが定義されていな + かったとき +|FuncUndefined| 呼び出そうとしたユーザー定義関数が定義されていなかった + とき +|SpellFileMissing| スペリングファイルを使おうとしたが見つからなかったとき +|SourcePre| Vim script を読み込む前 +|SourceCmd| Vim script を読み込む前 |Cmd-event| + +|VimResized| Vimのウィンドウサイズが変わったとき +|FocusGained| Vimが入力フォーカスを得たとき +|FocusLost| Vimが入力フォーカスを失ったとき +|CursorHold| ユーザーが一定時間キーを押さなかったとき +|CursorHoldI| 挿入モードでユーザーが一定時間キーを押さなかったとき +|CursorMoved| ノーマルモードでカーソルが移動したとき +|CursorMovedI| 挿入モードでカーソルが移動したとき + +|WinNew| 新しいウィンドウを作成した後 +|TabNew| 新しいタブページを作成した後 +|TabClosed| タブページを閉じた後 +|WinEnter| 別のウィンドウに入った後 +|WinLeave| ウィンドウから離れる前 +|TabEnter| 別のタブページに入った後 +|TabLeave| タブページから離れる前 +|CmdwinEnter| コマンドラインウィンドウに入った後 +|CmdwinLeave| コマンドラインウィンドウから離れる前 + +|InsertEnter| 挿入モードを開始したとき +|InsertChange| 挿入や置換モードでをタイプしたとき +|InsertLeave| 挿入モードを抜けるとき +|InsertCharPre| 挿入モードで文字が入力されたとき、その文字が挿入される + 前 + +|TextChanged| ノーマルモードでテキストが変更された後 +|TextChangedI| 挿入モードでテキストが変更された後 + +|ColorScheme| カラースキームを読み込んだ後 + +|RemoteReply| Vimサーバーからの返答を受け取ったとき + +|QuickFixCmdPre| QuickFixコマンドを実行する前 +|QuickFixCmdPost| QuickFixコマンドを実行した後 + +|SessionLoadPost| セッションファイルを読み込んだ後 + +|MenuPopup| ポップアップメニューを表示する直前 +|CompleteDone| 挿入モード補完が完了したとき + +|User| ":doautocmd"との組合せで使われる + +自動コマンドイベントのアルファベット順リスト: *autocmd-events-abc* + + *BufCreate* *BufAdd* +BufAdd or BufCreate バッファリストに追加されるバッファを作った直後 + か、バッファをバッファリストに追加した直後。 + バッファリスト内のバッファがリネームされた直後 + にも発生する。 + イベント BufCreate は歴史上の理由で存在してい + る。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される作成されたバッファは異なる + かもしれないことに注意。 + *BufDelete* +BufDelete バッファリストからバッファを削除する前。(バッ + ファが読み込まれているなら) BufUnload が最初に + 呼び出されるだろう。 + また、バッファリスト内のバッファがリネームされ + た直前にも使われる。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" と "" で表される削除されるバッ + ファとは異なるかもしれないことに注意。 + 他のバッファに切り替えないこと。もしすると問題 + が発生するだろう。 + *BufEnter* +BufEnter バッファに入った後。ファイルタイプに関するオプ + ションの設定に便利である。バッファの編集を始め + るときにも、BufReadPost の自動コマンドの後に + 実行される。 + *BufFilePost* +BufFilePost 現在のバッファの名前をコマンド ":file" または + ":saveas" で変更した後。 + *BufFilePre* +BufFilePre 現在のバッファの名前をコマンド ":file" または + ":saveas" で変更する前。 + *BufHidden* +BufHidden バッファが隠れ状態 (hidden) になった直後。つま + りそのバッファを表示するウィンドウがもう存在し + ないのに、バッファが解放されなかったり、削除さ + れないとき。":qa" や "q" でVimを終了するときに + は使われない。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される解放されるバッファとは異な + るかもしれないことに注意。 + *BufLeave* +BufLeave 他のバッファに移る前。カレントウィンドウを離れ + たり、閉じたりするときで、新しいカレントウィン + ドウが同じバッファを開いていないとき。":qa" や + "q" でVimを閉じるときには使われない。 + *BufNew* +BufNew 新しいバッファを作った直後。バッファがリネーム + された直後にも発生する。バッファがバッファリス + トに追加されると、イベント BufAdd も発生する。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される作成されるバッファとは異な + るかもしれないことに注意。 + *BufNewFile* +BufNewFile 存在しないファイルの編集を始めたとき。スケルト + ンファイル {訳注: テンプレートファイルともいう} + に読み込むときに使える。 + *BufRead* *BufReadPost* +BufRead or BufReadPost 新しいバッファの編集を始めたときの、ファイルを + バッファに読み込んだ後で、モードラインを実行す + る前。モードラインを実行した後に何かするには + |BufWinEnter|を参照すること。これは ":r file" + には「動作しない」。ファイルが存在しないときも + 使えない。またファイルの復旧に成功したときにも + 使われる。 + また、":filetype detect" を実行したとき、ある + いは無名バッファを保存してバッファに名前がつい + たとき、filetypedetect グループを対象として発 + 行される。 + *BufReadCmd* +BufReadCmd 新しいバッファの編集を始める前。ファイルをバッ + ファ内に読み込む役目を負う。 |Cmd-event| + *BufReadPre* *E200* *E201* +BufReadPre 新しいバッファの編集を始めたときの、ファイルを + バッファに読み込む前。読み込むファイルが存在し + ないときは使えない。 + *BufUnload* +BufUnload バッファを解放する前。これは、バッファ内のテキ + ストが解放されるときである。BufWritePost の後 + で、BufDelete の前かもしれない。Vimが終了しよ + うとしているとき、読み込まれた全てのバッファに + ついて発生する。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される解放されるバッファとは異な + るかもしれないことに注意。 + 他のバッファやウィンドウに切り替えないこと。問 + 題が発生するだろう。 + 終了時に v:dying が 2 以上のときはこのイベント + は発生しません。 + *BufWinEnter* +BufWinEnter バッファがウィンドウ内に表示された後。これはバッ + ファが読み込まれたとき (モードラインの処理後) + か、隠れ (hidden) バッファがウィンドウ内に表示 + されたとき (もう隠れバッファでなくなったとき)。 + 引数なしで |:split| をしたときや、既にウィンド + ウに表示されているバッファを指定して ":split" + をしたときは、同じバッファを開いたままなので、 + このイベントは発生しない。既存のバッファがその + まま使われるためである。しかし、カレントバッファ + の名前を指定して ":split" をすると、そのバッファ + を再読み込みすることになるので、発生する。 + *BufWinLeave* +BufWinLeave バッファがウィンドウから取り除かれる前。そのバッ + ファが別のウィンドウ内で表示中ならば発生しない。 + Vimの終了時にも発生する。イベント BufUnload や + BufHidden よりも前に発生する。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される解放されるバッファとは異な + るかもしれないことに注意。 + 他のバッファに切り替えないこと。もしすると問題 + が発生するだろう。 + 終了時に v:dying が 2 以上のときはこのイベント + は発生しません。 + *BufWipeout* +BufWipeout バッファを完全に削除する前。イベント BufUnload + と BufDelete が先に発生するかもしれない (バッ + ファが読み込まれていて、バッファリスト内に存在 + するなら)。バッファがリネームされる直前にも発 + 生する (そのバッファがバッファリスト内になくと + も)。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される削除されるバッファとは異な + るかもしれないことに注意。 + *BufWrite* *BufWritePre* +BufWrite or BufWritePre バッファ全体をファイルに書き込む前。 + *BufWriteCmd* +BufWriteCmd バッファ全体をファイルに書き込む前。ファイルへ + の書き込みの役目を負い、成功したときはオプショ + ン 'modified' をオフにする。バッファの内容を変 + 更すべきではない。 + 'modified' をオフにすると、以前の undo 状態が + 'modified' (変更あり) になるように undo 情報が + 調整される (|:write| と同様)。 + |Cmd-event| + *BufWritePost* +BufWritePost バッファ全体をファイルに書き込んだ後 (イベント + BufWritePre によるコマンドをアンドゥする役目を + 果たす)。 + *CmdUndefined* +CmdUndefined ユーザー定義コマンドが使われたが、定義されてい + なかったとき。必要なときのみコマンドを定義する + のに便利である。パターンはコマンド名に対して照 + 合される。 の両方ともコマン + ド名に設定される。 + NOTE: 未定義のコマンドに対して自動補完は機能し + ない。このイベントを使う代わりにユーザー定義コ + マンドを常に定義するようにしてそのコマンドから + autoload 関数を呼び出すようにするという方法も + ある。|autoload| 参照。 + *CmdwinEnter* +CmdwinEnter Command-lineウィンドウに入った後。この特殊な + ウィンドウに対してのみオプションを設定するのに + 便利である。このイベントは BufEnter や + WinEnter の「代わりに」発生する。 + は、command-lineの種類を示す1文字に設 + 定される。 |cmdwin-char| + *CmdwinLeave* +CmdwinLeave Command-lineウィンドウから出る前。イベント + CmdwinEnter で行ったグローバル設定を消去するの + に便利である。このイベントは BufLeave や + WinLeave の「代わりに」発生する。 + は、command-lineの種類を示す1文字に設 + 定される。 |cmdwin-char| + *ColorScheme* +ColorScheme カラースキームを読み込んだ後。 |:colorscheme| + パターンはカラースキーム名にマッチする。 + はこのオプションを設定したファイルの名 + 前になる。 はカラースキーム名になる。 + + *CompleteDone* +CompleteDone 挿入モード補完が完了したとき。補完が実行されて + も中止されても発行される。 |ins-completion| + 変数 |v:completed_item| には補完された候補につい + ての情報が含まれている。 + + *CursorHold* +CursorHold 'updatetime' の時間の間、ユーザーがキーを押さ + なかったとき。ユーザーが何かキーを押すまで、再 + び発生することはない (例えば、もしあなたがコー + ヒーを入れるためにVimの前を離れても、その間の + 'updatetime' ミリ秒ごと発生することはない :-)。 + タグをプレビューするためには、 + |CursorHold-example| を参照。 + このイベントはノーマルモードのときのみ呼ばれる。 + コマンドの引数の入力待ち状態、またはオペレータ + の後の移動コマンド入力待ち状態のときは発生しな + い。 + レコーディングの最中にはCursorHoldイベントは発 + 生しない。|q| + ** + この自動コマンドは内部的に キーが + 引き金になっている。式による指定のマッピング内 + では |getchar()| によってこの文字が取得されるこ + とがある。 + + Note: このイベントには対話的なコマンドは使えな + いことに注意。「続けるには」プロンプトは現れず、 + スクリーンは必要に応じて直接更新される。 + Note: 近いうちに、発生するまでの時間を設定する + 別のオプションができるだろう。 + ヒント: ステータスラインの更新を強制的に行うに + は、これを使うこと: > + :let &ro = &ro +< {VimのAmiga版、Unix版、Win32版、MSDOS版および + 全てのGUI 版でのみ有効} + *CursorHoldI* +CursorHoldI CursorHoldと同様だが、挿入モードのとき発生す + る。例えば別のキーを待っているとき、例えば + CTRL-V の後で、CTRL-X モード |insert_expand| + ではないときにはトリガーされない。 + *CursorMoved* +CursorMoved ノーマルモードかビジュアルモードでカーソルが移 + 動した後。カーソル行のテキストが変更されたとき + にも発生する(例: "x", "rx", "p"などで)。 + 先行入力があったりオペレータが実行待ちになって + いる場合は発生しない。 + |match-parens|の例を参照。 + 注意: このイベントは頻繁に発生するので、ユーザー + が予期しないことや時間のかかる処理は行わないこ + と。 + *CursorMovedI* +CursorMovedI 挿入モードでカーソルが移動した後。ポップアップ + メニューが表示されているときは発行されない。 + それ以外はCursorMovedと同じ。 + *EncodingChanged* +EncodingChanged オプション 'encoding' が変更されたとき。例えば、 + フォント等の設定に便利である。 + *FileAppendCmd* +FileAppendCmd ファイルに追加する前。ファイルへの追加の役目を + 負う。 |Cmd-event| + *FileAppendPost* +FileAppendPost ファイルに追加した後。 + *FileAppendPre* +FileAppendPre ファイルに追加する前。 + *FileChangedRO* +FileChangedRO 読み込み専用ファイルに最初の変更を加える前。ソー + ス管理システム {訳注: CVSやRCS} からファイルを + チェックアウトするのに使われる。変更が + 自動コマンドによるときには発生しない。 + このイベントが発生するのは、バッファに最初の変 + 更を行うときや、'readonly'がセットされた後に最 + 初の変更を行うときの、変更が適用される直前であ + る。 + 警告: 自動コマンドでカーソルが動かされるときの + 動作は、定義されていない。 + *E788* + ここで他のバッファに変更をしてはならない。バッ + ファを再読み込みするとはよいが、他のバッファを + 編集してはならない。 + *E881* + 行数が変化した場合 undo のための保存は失敗し、 + その変更は中止されるだろう。 + *FileChangedShell* +FileChangedShell ファイルのタイムスタンプが、ファイルの編集が始 + まってから変更されたことを発見したとき。 + ファイルの属性やファイルサイズが変更されたとき + にも使われる。|timestamp| + 大抵はシェルコマンドの実行後に発生する。またコ + マンド |:checktime| の実行後や、Vimが入力フォー + カスを一度失い、再び得たときにも発生する。 + このイベントは変更されたファイルそれぞれに対し + て発生する。オプション 'autoread' がオンであり、 + かつバッファが変更されていないときには使われな + い。もし FileChangedShell の自動コマンドが存 + 在しても、警告メッセージやプロンプトは現れない。 + 変数|v:fcs_reason|に何が起こったのかが設定さ + れ、|v:fcs_choice|によってVimに次に何をすべき + かを指示できる。 + NOTE: このイベントで自動コマンドが実行された + ときは、"%" で表されるカレントバッファと + "" で表される変更されたバッファとは異な + るかもしれないことに注意。 + NOTE: この自動コマンドはカレントバッファを変 + 更したり、別のバッファにジャンプしたり、バッ + ファを消去してはいけない。 *E246* *E811* + NOTE: このイベントは、無限ループを避けるために + 決してネストしてはいけない (入れ子にならない)。 + つまり、FielChangedShellイベントの処理中は他の + FileChangedShellイベントは呼ばれない。 + *FileChangedShellPost* +FileChangedShellPost Vimの外部でファイルが変更されたのを検出・対処 + した後。ステータスラインを更新するのに使える。 + *FileEncoding* +FileEncoding 時代遅れである。まだ有効だがイベント + |EncodingChanged| と同等である。 + *FileReadCmd* +FileReadCmd コマンド ":read" でファイルを読み込む前。ファ + イルを読み込む役目を負う。 |Cmd-event| + *FileReadPost* +FileReadPost コマンド ":read" でファイルを読み込んだ後。 + Note 読み込んだテキストの先頭行と末尾行には、 + マーク '[ と '] が設定されることに注意。これは、 + 読み込まれた行に対して操作を行うのに使われる。 + *FileReadPre* +FileReadPre コマンド ":read" でファイルを読み込む前。 + *FileType* +FileType オプション 'filetype' が設定されたとき。 + パターンはファイルタイプに対して照合される。 + は 'filetype' が設定されたファイルの名 + 前として使える。 は 'filetype' の新し + い値として使える。 + |filetypes| を参照。 + *FileWriteCmd* +FileWriteCmd バッファ全体を書き込まない場合の、ファイルに書 + き込む前。ファイルへの書き込みの役目を負う。バッ + ファを変更すべきではない。 |Cmd-event| + *FileWritePost* +FileWritePost バッファ全体を書き込まない場合の、ファイルに書 + き込んだ後。 + *FileWritePre* +FileWritePre バッファ全体を書き込まない場合の、ファイルに書 + き込む前。 + *FilterReadPost* +FilterReadPost フィルタコマンドからファイルを読み込んだ後。 + Vimは FilterReadPre と同様に、現在のバッファの + 名前に対してパターンを調べる。 + *FilterReadPre* *E135* +FilterReadPre フィルタコマンドからファイルを読み込む前。Vim + は、フィルタコマンドの出力である一時ファイルの + 名前ではなく、現在のバッファの名前に対してパター + ンを調べる。 + *FilterWritePost* +FilterWritePost フィルタコマンド用のファイルを書き込んだり、差 + 分表示用のファイルを作った後。 + Vimは FilterWritePre と同様、現在のバッファの + 名前に対してパターンをチェックする。 + 'shelltemp' がオフのときは発生しない。 + *FilterWritePre* +FilterWritePre フィルタコマンド用のファイルを書き込んだり、差 + 分表示用のファイルを作る前。 + Vimはフィルタコマンドの出力である一時ファイル + の名前ではなく、現在のバッファの名前に対してパ + ターンをチェックする。 + 'shelltemp' がオフのときは発生しない。 + *FocusGained* +FocusGained Vimが入力フォーカスを得たとき。GUI版と、入力 + フォーカスを認識できるいくつかのコンソール版で + のみ有効。 + *FocusLost* +FocusLost Vimが入力フォーカスを失ったとき。GUI版と、入力 + フォーカスを認識できるいくつかのコンソール版で + のみ有効。 + *FuncUndefined* +FuncUndefined ユーザー定義関数が使われたが、定義されていなかっ + たとき。必要なときのみ関数を定義するのに便利で + ある。パターンは関数名に対して照合される。 + の両方とも関数名に設定され + る。 + NOTE: Vim script を書くときには autoload 関数 + を使う方がよい。 + |autoload-functions|を参照。 + *GUIEnter* +GUIEnter GUI の開始に成功し、ウィンドウを開いた後。 + gvim を使ったときは、VimEnter の前に発生する。 + ファイル .gvimrc からウィンドウの配置場所を設 + 定するために使うことができる。 > + :autocmd GUIEnter * winpos 100 50 +< *GUIFailed* +GUIFailed GUIの開始に失敗した後。可能ならば、Vimはターミ + ナル内で実行を継続する(Unix系のみ。Xサーバーへ + 接続が失敗したとき)。ここでVimを終了させるには、 + 次のようにする: > + :autocmd GUIFailed * qall +< *InsertChange* +InsertChange 挿入・置換モードで をタイプしたとき。 + 変数 |v:insertmode| が新しいモードを示す。 + カーソルを移動したりなどユーザーが予期しないこ + とは行わないように注意。 + *InsertCharPre* +InsertCharPre 挿入モードで文字が入力されたとき、その文字が挿 + 入される前。|v:char| 変数に入力された文字が + 入っている。イベント内でそれを変更することで実 + 際に挿入される文字を変更できる。|v:char| に 2 + つ以上の文字を入れた場合はそのテキストはそのま + ま (literally) 挿入される。 + テキストを変更することはできない |textlock|。 + このイベントは 'paste' がオンに設定されている + ときは発行されない。 + *InsertEnter* +InsertEnter 挿入モード・置換モード・仮想置換モードを開始す + る直前。変数|v:insertmode|がモードを示す。 + ユーザーが予期しないことは行わないように注意。 + カーソルはコマンド実行後に復元される。復元され + たくない場合は |v:char| に非空文字を設定する。 + *InsertLeave* +InsertLeave 挿入モードを抜けるとき。CTRL-O |i_CTRL-O| を + 使ったときにも発生する。|i_CTRL-C| のときは発 + 生しない。 + *MenuPopup* +MenuPopup (マウス右ボタンで)ポップアップメニューを表示す + る直前。カーソル下やマウスポインタの下にあるも + のによってメニューを調整するのに便利。 + パターンにはモードを表す文字を記述する: + n ノーマル + v ビジュアル + o オペレータ実行待ち + i 挿入 + c コマンドライン + *OptionSet* +OptionSet オプションが設定された後。パターンは長い(短縮 + しない)オプション名に対してマッチする。 + 変数 |v:option_old| に変更前の値が格納され、 + |v:option_new| には新しく設定された値が格納さ + れ、 |v:option_type| にはオプションの変更のス + コープがグローバルかローカルかが格納される。 + || は対象のオプション名が設定される。 + + 'key' の変更の際にはあえてイベントが発生しない + ようにしている。 + + 使用例: 'backupdir' や 'undodir' で指定された + ディレクトリが存在しているかチェックし、もしな + ければディレクトリを作成する。 + + Note: この自動コマンド中でオプションの値をリセ + ットするのは、プラグインの挙動を破壊するため、 + 良くない。この自動コマンドの実行は `:noa` を使 + うことで抑制することができる。 + *QuickFixCmdPre* +QuickFixCmdPre QuickFixコマンドが実行される前 (|:make|, + |:lmake|, |:grep|, |:lgrep|, |:grepadd|, + |:lgrepadd|, |:vimgrep|, |:lvimgrep|, + |:vimgrepadd|, |:lvimgrepadd|, |:cscope|, + |:cfile|, |:cgetfile|, |:caddfile|, |:lfile|, + |:lgetfile|, |:laddfile|, |:helpgrep|, + |:lhelpgrep|, |:cexpr|, |:cgetexpr|, + |:caddexpr|, |:cbuffer|, |:cgetbuffer|, + |:caddbuffer|)。 + パターンには実行されるコマンドを記述する。 + |:grep| が書かれていると、'grepprg' が + "internal" にセットされていても実行される。 + このコマンドを使って変数 'makeprg' と + 'grepprg' を設定することはできない。 + このコマンドでエラーになるとQuickFixコマンドは + 実行されない。 + *QuickFixCmdPost* +QuickFixCmdPost QuickFixCmdPreと同様だが、QuickFixコマンドが実 + 行された後、最初の位置にジャンプする前に発生す + る。|:cfile| コマンドと |:lfile| コマンドの場 + 合はイベントはエラーファイルを読み込んだ後、最 + 初のエラーに移動する前に実行される。 + |QuickFixCmdPost-example| を参照。 + *QuitPre* +QuitPre `:quit`, `:wq`, `:qall` を使ったとき、カレント + ウィンドウを閉じるのか、Vim を終了するのかを決 + 定する前に発行される。例えば、普通のウィンドウ + がカレントウィンドウだけだったときに、他の余分 + なウィンドウを閉じることができる。 + *RemoteReply* +RemoteReply サーバーとして働くVimからの応答を受け取ったとき + |server2client()|。パターンは{serverid}に対し + て照合される。 + は応答が送られてきたサーバーの + {serverid} になり、 は応答の実際の内容 + になる。 + Note これに自動コマンドを定義したときも、応答 + を読み込むのには、読み込んだ応答を処理できるよ + うに関数 |remote_read()| を使うべきであること + に注意。 + *SessionLoadPost* +SessionLoadPost |:mksession|で作られたセッションファイルを読み + 込んだ後。 + *ShellCmdPost* +ShellCmdPost |:!cmd|, |:shell|, |:make|, |:grep|を使って + シェルコマンドを実行した後。変更されたファイル + をチェックするのに使える。 + *ShellFilterPost* +ShellFilterPost ":{range}!cmd", ":w !cmd", ":r !cmd"を使って + シェルコマンドを実行した後。変更されたファイル + をチェックするのに使える。 + *SourcePre* +SourcePre Vim script を読み込む前。|:source| + は読み込まれるファイルの名前となる。 + *SourceCmd* +SourceCmd Vim script を読み込むとき。|:source| + は読み込まれるファイルの名前となる。こ + の自動コマンドはこのファイルを読み込まねばなら + ない。 + *SpellFileMissing* +SpellFileMissing スペルチェックファイルを読み込もうとしたが、見 + つからなかったとき。パターンは言語に対して照合 + される。は言語。'encoding'も関係する。 + |spell-SpellFileMissing|を参照。 + *StdinReadPost* +StdinReadPost 標準入力からバッファへ読み込んだ後で、モードラ + インを実行する前。Vimを開始したときに引数 "-" + が使われた場合のみ使われる (|--| 参照)。 + *StdinReadPre* +StdinReadPre 標準入力からバッファへ読み込む前。Vimを開始し + たときに引数 "-" が指定された場合のみ使われる + (|--| 参照)。 + *SwapExists* +SwapExists ファイルの編集を始めようとしてスワップファイル + が存在することを検出したとき。この状況に対応す + る方法を選択できるときだけユーザーにどうするか + 問い合わせる。 + 変数|v:swapname|が見つかったスワップファイルの + 名前を保持する。は編集しようとしている + ファイルである。|v:swapcommand|が開かれたファ + イルで実行するコマンドを含んでいるかもしれな + い。 + このコマンドは変数|v:swapchoice|をVimが次にど + うするべきかを示す1文字の文字列にセットしなけ + ればならない: + 'o' 読み込み専用で開く + 'e' とにかくファイルを編集する + 'r' 復元する + 'd' スワップファイルを削除する + 'q' ファイルを編集せずに終了する + 'a' CTRL-Cを押したのと同様に強制終 + 了する + これが空文字列にセットされると、自動コマンド + SwapExistsが存在しないときと同様にユーザーに問 + い合わせをする。 + 注意: バッファを変更しようとしてはならない。そ + うすると予測できない結果になる。 + *E812* + ここでは他のバッファに切り替えること、バッファ + 名を変更すること、ディレクトリを変更することは + 許可されていない。 + *Syntax* +Syntax オプション 'syntax' が設定されたとき。 + パターンは構文名に対して照合される。 + は 'syntax' が設定されたファイルの名前 + として使える。 は 'syntax' の新しい値 + として使える。 + |:syn-on| を参照。 + *TabClosed* +TabClosed タブページを閉じた後。 + *TabEnter* +TabEnter タブページに入った直後 |tab-page|。WinEnterが + 発生した後、BufEnterが発生する前。 + *TabLeave* +TabLeave タブページを離れる直前 |tab-page|。最初に + WinLeaveが発生する。 + *TabNew* +TabNew タブページが作成されたとき。 |tab-page| + WinEnter イベントが最初にトリガーされ、 + TabEnter が実行される。 + *TermChanged* +TermChanged オプション 'term' を変更した後。色やフォント等、 + ターミナル依存の設定を更新するために構文定義ファ + イルを再読み込みするのに便利である。読み込まれ + たバッファ全てで発生する。 + *TermResponse* +TermResponse |t_RV| に対する応答をターミナルから受け取った + とき。Vim変数 |v:termresponse| の値を使って、 + ターミナルのバージョンに応じた処理ができる。 + Note: このイベントは他のイベントの処理中にも発 + 行されることがある。特に、ファイル入出力、シェ + ルコマンドの実行、時間の掛かる処理など。 + *TextChanged* +TextChanged ノーマルモードでカレントバッファのテキストが変 + 更されたとき。つまり |b:changedtick| が更新さ + れるとき。 + 未処理のキー入力がまだあるとき、またはオペレー + タを待機しているときは、発生しない。 + 注意: このイベントは頻繁に発生するので、ユー + ザーが予期しないことや時間のかかる処理は行わな + いこと。 + *TextChangedI* +TextChangedI 挿入モードでカレントバッファのテキストが変更さ + れたとき。 + ポップアップメニューが表示されているときは発生 + しない。 + 他は TextChanged と同じ。 + *User* +User 自動的に実行されることはない。コマンド + ":doautocmd" によってのみ実行される + 自動コマンドのために使用される。 + *UserGettingBored* +UserGettingBored ユーザーが同じキーを 42 回押したとき。 + ただの冗談! :-) + *VimEnter* +VimEnter ファイル .vimrc の読み込みを含む、全てのスター + トアップ処理を行い、"-c cmd" の引数を実行し、 + 全てのウィンドウを構築し、それらにバッファを読 + み込んだ後。 + このイベントがトリガーされる直前に、 + |v:vim_did_enter| 変数が設定されているので、以 + 下のことができる: > + if v:vim_did_enter + call s:init() + else + au VimEnter * call s:init() + endif +< *VimLeave* +VimLeave Vim を終了する前で、ファイル .viminfo を書き込 + んだ後。VimLeavePre のように、ただ1度だけ実行 + される。 + 異常終了の検出には |v:dying| を使うこと。 + 終了時に v:dying が 2 以上のときはこのイベント + は発生しない。 + *VimLeavePre* +VimLeavePre Vim を終了する前で、ファイル .viminfo を書き込 + む直前。これは終了時にたまたまカレントバッファ + になったバッファの名前とマッチしたときに、ただ + 1度だけ実行される。大抵、パターンには "*" を使 + うと便利である。 > + :autocmd VimLeavePre * call CleanupStuff() +< 異常終了の検出には |v:dying| を使うこと。 + 終了時に v:dying が 2 以上のときはこのイベント + は発生しない。 + *VimResized* +VimResized Vimウィンドウのサイズが変わったとき。よって + 'lines'と'columns'が変更される。しかし開始時 + には発生しない。 + *WinEnter* +WinEnter 別のウィンドウに入った後。Vimの開始直後、1個目 + のウィンドウに入ったときは発生しない。ウィンド + ウの高さを設定するのに便利である。 + そのウィンドウで他のバッファを開いていたときは、 + イベント WinEnter の後に BufEnter が発生する。 + Note: ":split fname" を実行したとき、WinEnter + が発生するのは、ウィンドウ分割の後だがファイル + "fname" が読み込まれる前の時点である。 + *WinLeave* +WinLeave ウィンドウを離れる前。次に入るウィンドウで他の + バッファを開いていたときは、イベント WinLeave + の前に BufLeave が発生する (ただし ":new" を使っ + たときはそうならない)。 + ":qa" や "q" でVimを終了するときには発生しない。 + *WinNew* +WinNew 新しいウィンドウが作成されたとき。Vim がちょう + ど開始したとき、最初のウィンドウのためには行わ + れない。WinEnter イベントの前。 + +============================================================================== +6. パターン *autocmd-patterns* *{pat}* + +引数 {pat} にはコンマ区切りのリストを指定することができる。これによりコマンドは +指定されたそれぞれのパターンについて実行される。例えばこのコマンド: > + :autocmd BufRead *.txt,*.info set et +は下記と等しくなる: + :autocmd BufRead *.txt set et + :autocmd BufRead *.info set et + +ファイルパターン {pat} がファイル名とマッチするかどうかは、2通りの方法で調べら +れる。 +1. パターンに '/' が含まれないとき: Vimはファイル名の後ろの部分からのみマッチ + を調べる (ファイル名の前につくディレクトリパスは除く)。 +2. パターンに '/' が含まれるとき: Vimは短いファイル名 (ユーザーが打ち込んだも + の) と長いファイル名 (短いファイル名をフルパスに展開し、シンボリックリンク + ならその実体を探したもの) との両方から一致を調べる。 + +例: > + :autocmd BufRead *.txt set et +全てのテキストファイルに対しオプション 'expandtab' をオンにする。 > + + :autocmd BufRead /vim/src/*.c set cindent +ディレクトリ /vim/src 内のC言語ファイルに対しオプション 'cindent' をオンにす +る。 > + + :autocmd BufRead /tmp/*.c set ts=5 +"/tmp/test.c" から "/home/nobody/vim/src/test.c" にリンクを張っていると、 +"/tmp/test.c" の編集を始めたとき、この自動コマンドは実行される。 + +Note: パスの途中だけにマッチさせ、ルートディレクトリにマッチさせたくないとき +は、最初の1文字目に '*' を使う。例: > + :autocmd BufRead */doc/*.txt set tw=78 +この自動コマンドは、例えば "/tmp/doc/xx.txt" や "/usr/home/piet/doc/yy.txt" +にマッチする。ここで、ディレクトリの深さは関係ない。 + + +パターンがマッチするファイル名は、ワイルドカードを展開した後のものである。その +ため、次のコマンドを実行すると > + :e $ROOTDIR/main.$EXT +まずコマンドの引数は、ファイル名が自動コマンドのパターンにマッチする前に、次 +のように展開される。 > + /usr/root/main.py +イベント FileReadCmd 等を使うときにはこれに注意すること。 の値が、ユー +ザーの予期するものと違うかもしれない。 + + +パターンの中で環境変数を使うこともできる。 > + :autocmd BufRead $VIMRUNTIME/doc/*.txt set expandtab +環境変数 $HOME が定義されているなら、~ をホームディレクトリとして使うこともで +きる。 > + :autocmd BufWritePost ~/.vimrc so ~/.vimrc + :autocmd BufRead ~archive/* set readonly +環境変数は、自動コマンドが定義されるときに展開される。自動コマンドが実行される +ときではない。これは command とは違っている! + + *file-pattern* +パターンの解釈方法は、ファイル名の解釈方法と大体同じである。 + * はあらゆる文字の列にマッチ。注意: パス区切り文字も含まれる。 + ? はあらゆる1文字にマッチ + \? は '?' にマッチ + . は '.' にマッチ + ~ は '~' にマッチ + , はパターンを分割する + \, は ',' にマッチ + { } は |pattern| の \( \) と同様 + , ('{' '}' の内側では) |pattern| の \| と同様 + \} リテラルの } + \{ リテラルの { + \\\{n,m\} |pattern| の \{n,m} と同様 + \ は |pattern| で使われるものと同様の特別な意味を持つ + [ch] は 'c' または 'h' にマッチ + [^ch] は 'c' と 'h' 以外の文字にマッチ + +'/' という文字は、全てのシステムでパスの区切り文字に使われることに注意すること +(MS-DOSとOS/2でさえも)。これは、パターン内でバックスラッシュを使うことが難しい +上に、別々のシステムでも自動コマンドが動作するようにするためである。 + +|pattern| を使うことができる。上記の翻訳が行われているため、期待通りに機能しな +い可能性がある。 + + *autocmd-changes* +パターンマッチの検索は、イベントの発生時に行われる。自動コマンドのどれかでバッ +ファ名を変更しても、それどころかバッファを削除しても、実行される 自動コマンド +は変わらない。例: > + + au BufEnter *.foo bdel + au BufEnter *.foo set modified + +これはカレントバッファを削除し、代わりにカレントバッファになったバッファ内でオ +プション 'modified' をオンにする。Vimは "*.foo" が新しいカレントバッファのバッ +ファ名にマッチしなくとも気にしない。"*.foo" はイベントが発生した時点でのバッファ +名にマッチする。 + +しかし、|:bwipe|でワイプアウトされたバッファに対しては、バッファローカルな +自動コマンドは実行されない。|:bdel|で削除されたバッファは実際にはまだ存在して +いる(リストされなくなっただけ)なので、自動コマンドは実行される。 + +============================================================================== +7. バッファローカルな自動コマンド *autocmd-buflocal* + *autocmd-buffer-local* + ** ** *E680* + +バッファローカルな自動コマンドは特定のバッファに結びつけられている。これは名前 +を持たないバッファや特定のパターンにマッチしない名前のバッファに使うと便利であ +る。しかしそれぞれのバッファに明示的に追加する必要がある。 + +バッファローカルな自動コマンドはパターンの代わりに以下の形式のどれかを使う: + カレントバッファ + バッファ番号99 + の使用(自動コマンドを実行するときのみ) + || + +例: > + :au CursorHold echo 'hold' + :au CursorHold echo 'hold' + :au BufNewFile * au CursorHold echo 'hold' + +自動コマンドに対するコマンドは全てバッファローカルな自動コマンドに対しても機能 +する。パターンの代わりに特別な文字列を使う。例: > + :au! * " カレントバッファのバッファローカル自動 + " コマンドを削除する + :au! * " バッファ#33のバッファローカル自動コマン + " ドを削除する。 + :bufdo :au! CursorHold " 全バッファから指定されたイベントに対す + " る自動コマンドを削除する + :au * " カレントバッファのバッファローカル自動 + " コマンドをリストする + +カレントバッファに対して自動コマンドを定義するとき、それがバッファ番号とともに +保存されることに注意。つまりカレントバッファ番号が12なら""という形 +になる。例えば自動コマンドをリストするときこの形式で表示される。 + +バッファローカル自動コマンドが存在するかを判定するには関数|exists()|を次のよう +に使う: > + :if exists("#CursorHold#") | ... | endif + :if exists("#CursorHold#") | ... | endif " for current buffer + +バッファがワイプアウトされると当然バッファローカル自動コマンドも失われる。 +":bdel" などでバッファを削除するときは、それがリストからなくなるだけで、自動コ +マンドはまだ存在していることに注意。バッファローカル自動コマンドの削除を表示さ +せるにはこうする: > + :set verbose=6 + +存在しないバッファに対してバッファローカル自動コマンドを定義することはできな +い。 + +============================================================================== +8. グループ *autocmd-groups* + +自動コマンドはグループにまとめることができる。これは一連の自動コマンドを取り +除いたり実行したりする際に便利である。例えば、構文強調表示のための全ての +自動コマンドはグループ "highlight" に入っていて、GUIの開始時に +":doautoall highlight BufRead" で実行できる。 + +特定のグループが選択されないとき、既定のグループが使われる。既定のグループには +名前がない。既定のグループから個別に自動コマンドを実行することはできない。そ +れらを実行できるのは、全てのグループに対する自動コマンドを実行するときのみで +ある。 + +普通、自動コマンドを自動的に実行するときは、全てのグループに対する 自動コマン +ドが使われる。グループが問題になってくるのは、":doautocmd" や ":doautoall" に +よって自動コマンドを実行するときと、自動コマンドを定義したり削除するときであ +る。 + +グループ名には空白を除く全ての文字が使える。"end" というグループ名は予約語になっ +ている (大文字も)。 + +グループ名では大文字と小文字を区別して扱う。イベントの名前とは違うことに注意す +ること。 + + *:aug* *:augroup* +:aug[roup] {name} 後に続くコマンド ":autocmd" のためのグループ名 + を定義する。{name} を "end" や "END" にすると + 既定のグループが選ばれる。 + 混乱を避けるため、既存の {event} の名前とは違う + 名前をつけるべきである。これはたいてい意図しな + い動作を引き起こす。 + + *:augroup-delete* *E367* *W19* *E936* +:aug[roup]! {name} 自動コマンドのグループ {name} を削除する。その + グループを使っている自動コマンドがまだあるな + ら、これは使わないこと!その点はチェックされな + い。とにかくそれをしたら、警告が表示される。グ + ループが現在のグループの場合、エラーE936が表示 + される。 + +特定のグループとして自動コマンドを定義するには、次の手順に従うこと。 +1. ":augroup {name}" によってグループを選択する。 +2. ":au!" によって古い自動コマンドを全て消去する。 +3. 自動コマンドを定義する。 +4. ":augroup END" によって既定のグループに戻る。 + +例: > + :augroup uncompress + : au! + : au BufEnter *.gz %!gunzip + :augroup END + +これで自動コマンドを (例えばファイル .vimrc を再び読み込んだ後) 2回定義するこ +とが防げる。 + +============================================================================== +9. 自動コマンドの実行 *autocmd-execute* + +自動コマンドは「自動的」でなくとも実行できる。これはあなたが自動コマンドを変 +更したときや、間違った自動コマンドが実行されたとき (つまりファイルパターンの +マッチングが間違っていたとき) に便利である。 + +NOTE オプション 'eventignore' はここにも適用されることに注意。ここに列挙された +イベントでは、どんな自動コマンドも実行されない。 + + *:do* *:doau* *:doautocmd* *E217* +:do[autocmd] [] [group] {event} [fname] + [fname] (省略するとカレントファイルの名前) にマッチす + る、{event} のための自動コマンドをカレントバッファに + 適用する。カレントファイル名が正しいファイルパターンに + マッチしないときや設定を変えた後、またはあるイベントの + ために自動コマンドを実行するために使用できる。 + これを自動コマンドの内部で実行することも可能である。 + だから、ある拡張子用の自動コマンドを元にして別の拡張 + 子用のものを作ることができる。例: > + :au BufEnter *.cpp so ~/.vimrc_cpp + :au BufEnter *.cpp doau BufEnter x.c +< 無限の循環に陥らないよう注意すること。また + |autocmd-nested| を参照すること。 + + 引数 [group] が省かれると、全てのグループの自動コマン + ドが実行される。[group] が指定されると、それにマッチす + るグループの自動コマンドのみが実行される。NOTE 定義さ + れていないグループ名を使うと、エラーメッセージが表示さ + れる。 + ** + 自動コマンドを適用した後にモードラインが処理される。 + ファイルを編集するときと同じように、自動コマンドでなさ + れた設定を上書きするためである。 が指定さ + れている場合はモードラインは処理されない。バッファの + ロード以外で使われるイベント (例えば |User|) などは + を指定したほうがよいかもしれない。 + 一致する自動コマンドが実行されなかった場合も、モードラ + インの処理はスキップされる。 + + *:doautoa* *:doautoall* +:doautoa[ll] [] [group] {event} [fname] + ":doautocmd" と似ているが、読み込まれたバッファそれぞ + れに自動コマンドを適用する。[fname]は自動コマンドを選 + 択するのに使われる。コマンドを適用するバッファではな + い。{訳注: |:autocmd|の{pat}に使う?} + Note: このコマンドで、バッファを削除したり、バッファを + 変えたり、バッファの内容を変えるような自動コマンドを + 実行しないこと。結果は予期できない。このコマンドは、オ + プションを設定したり、構文強調表示を変えたりする + 自動コマンドのためのものである。 + +============================================================================== +10. 自動コマンドを使う *autocmd-use* + +「ファイルの書き込み」には、4組のイベントが起こりうる。1回の書き込みコマンドで +は、これらのうち1組しか使われない。 + +BufWriteCmd BufWritePre BufWritePost バッファ全体を書き込む + FilterWritePre FilterWritePost フィルタ用一時ファイルに書込む +FileAppendCmd FileAppendPre FileAppendPost ファイルに追加する +FileWriteCmd FileWritePre FileWritePost その他の書き込み + +"*Cmd" にマッチする自動コマンドがあるときは、それが書き込み作業を行うものと想 +定される。書き込みはそれ以上行われず、他のイベントも発生しない。 |Cmd-event| + +Note イベント *WritePost による自動コマンドは、イベント *WritePre による +自動コマンドの引き起こしたバッファに対する変化を、どのようなものでもアンドゥす +べきであることに注意。さもないと、ファイルの書き込みがバッファを変更するという +副作用を持ってしまう。 + +あるバッファの中の行をファイルに書き込むとき、自動コマンドを実行する前にそのバッ +ファが一時的にカレントバッファになる。自動コマンドがカレントバッファを変更した +り、元のカレントバッファを消去しない限り、カレントバッファは再び元に戻る。 + +イベント *WritePre や *AppendPre による自動コマンドは、書き込み元のバッファを +削除してはならない。 + +マーク '[ と '] は特別な位置を記憶している。 +- イベント *ReadPre の前に、新しい行が挿入される所の上の行にマーク '[ が設定 + される。 +- イベント *ReadPost の前に、読み込まれた最初の行にマーク '[ が、最後の行にマー + ク '] が設定される。 +- イベント *WriteCmd, *WritePre と *AppendPre による自動コマンドが実行される前 + に、書き込まれる最初の行にマーク '[ が、最後の行にマーク '] が設定される。 +注意: バッファを変更するコマンドを使うと、'[ と '] の場所も変更される。 + +ファイル名を必要とするコマンドでは、読み込まれるファイル名に "" を使う +ことができる (カレントファイル名に "%" を使うこともできる) |:|。現在有 +効なバッファ番号には "" を使うことができる。これは名前を持たないバッファ +に対しても有効だが、バッファを持たないファイルには使えない (例えば、":r file" +で読み込まれたファイル)。 + + *gzip-example* +圧縮されたファイルを読み書きする例: > + :augroup gzip + : autocmd! + : autocmd BufReadPre,FileReadPre *.gz set bin + : autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip + : autocmd BufReadPost,FileReadPost *.gz set nobin + : autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") + : autocmd BufWritePost,FileWritePost *.gz !mv :r + : autocmd BufWritePost,FileWritePost *.gz !gzip :r +> + : autocmd FileAppendPre *.gz !gunzip + : autocmd FileAppendPre *.gz !mv :r + : autocmd FileAppendPost *.gz !mv :r + : autocmd FileAppendPost *.gz !gzip :r + :augroup END + +グループ "gzip" は、":autocmd!" で既存の自動コマンドを全て削除できるようにす +るために使われている。これはスクリプトファイルが2回読み込まれたときのためであ +る。 + +(":r" は拡張子のないファイル名である。|:_%:| を参照) + +イベント BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost, +VimLeave によって実行された自動コマンドは、バッファの被修正フラグを切り替えな +い。BufReadPost による自動コマンドで、圧縮されているバッファを解凍したときは、 +":q" でVimを終了することができる。BufWritePre による自動コマンドの起こした変 +更を戻すために BufWritePost で ":undo" を使ったときも、":q" を使うことができる +("ZZ" も可)。バッファが変更されたことにしたいなら、":set modified" とすること。 + +自動コマンドからノーマルモードのコマンドを実行したいときは、コマンド ":normal" +を使うこと。使うときは注意!ノーマルモードのコマンドが完結していないと、ユーザー +が文字を打ち込まないといけない (例えば、":normal m" の後にはマーク名を打ち込ま +ないといけない)。 + +バッファの内容を変更した後に、変更されていないことにしたいなら、オプション +'modified' をオフにすること。こうすると ":q!" ではなく ":q" でもVimを終了でき +る。 + + *autocmd-nested* *E218* +既定では、自動コマンドはネストしない (入れ子にならない)。自動コマンド内で ":e" +や ":w" を使っても、これらに対してはイベント BufRead や BufWrite による +自動コマンドは実行されない。もしこれを実行してほしいなら、ネストしてほしいコマ +ンド内でフラグ "nested" を使うこと。例: > + :autocmd FileChangedShell *.c nested e! +再帰的ループを避けるために、ネストは10段階までに制限されている。 + +自動コマンドの中でコマンド ":au" を使うこともできる。これは自己修正的 {訳注: +原文 "self-modifying"} なコマンドになりうる! これは1回だけ実行すべき +自動コマンドに便利である。 + +あるコマンドを実行するときだけ自動コマンドをスキップしたい場合は、修飾子 +|:noautocmd|を使うかオプション'eventignore'を使う。 + +Note (":read file" やフィルタコマンドで) 読み込んだファイルの最後の行に +がないとき、Vimはこのことを記憶する。その次の (":write file" やフィルタコマン +ドでの) 書き込みで、先ほどの最後の行が再び最後の行として書き込まれ、かつオプショ +ン 'binary' がオンになっていると、 は付け足されない。これにより、読み込ま +れた行に対するフィルタコマンドで、読み込まれた通りに書き出すことができる。また、 +フィルタ処理された行に対する書き込みのコマンドで、フィルタが出力した通りに書き +出すことができる。例えば、圧縮されたファイルを書き込むもう一つの例は以下のよう +になる。 > + + :autocmd FileWritePre *.gz set bin|'[,']!gzip + :autocmd FileWritePost *.gz undo|set nobin +< + *autocommand-pattern* +コンマで区切られた複数のパターンを指定することもできる。以下にいくつか例を挙げ +る。 > + + :autocmd BufRead * set tw=79 nocin ic infercase fo=2croq + :autocmd BufRead .letter set tw=72 fo=2tcrq + :autocmd BufEnter .letter set dict=/usr/lib/dict/words + :autocmd BufLeave .letter set dict= + :autocmd BufRead,BufNewFile *.c,*.h set tw=0 cin noic + :autocmd BufEnter *.c,*.h abbr FOR for (i = 0; i < 3; ++i){}O + :autocmd BufLeave *.c,*.h unabbr FOR + +Makefile (makefile, Makefile, imakefile, makefile.unix 等) にマッチさせるには +こうする。 > + + :autocmd BufEnter ?akefile* set include=^s\=include + :autocmd BufLeave ?akefile* set include& + +Cソースファイルを編集するとき、常に最初の関数から始めるにはこうする。 > + + :autocmd BufRead *.c,*.h 1;/^{ + +上の "1;" がないと、検索が始まる場所はファイルの最初ではなく、ファイルの挿入さ +れた場所になる。 + + *skeleton* *template* +新しいファイルを作るときにスケルトン (テンプレート) ファイルを読み込むにはこう +する。 > + + autocmd BufNewFile *.c 0r ~/vim/skeleton.c + autocmd BufNewFile *.h 0r ~/vim/skeleton.h + autocmd BufNewFile *.java 0r ~/vim/skeleton.java + +HTMLファイルを書き込むときに現在の日付と時刻を挿入したいならこうする {訳注: +KoRoN氏作成のautodate.vimを使った方がよい} > + + :autocmd BufWritePre,FileWritePre *.html ks|call LastMod()|'s + :fun LastMod() + : if line("$") > 20 + : let l = 20 + : else + : let l = line("$") + : endif + : exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " . + : \ strftime("%Y %b %d") + :endfun + +これを機能させるためには、ファイルの先頭から20行以内に"Last modified: " という行を入れる必要がある。Vimは (とその行内のそれ以後を) +を現在の日付と時刻に置き換える。説明: + ks 現在の位置をマーク 's' に設定する + call LastMod() 関数 LastMod() を呼び出して実際の作業を行う + 's カーソルを元の位置に戻す +関数 LastMod() はファイルの長さが20行以下であるかを調べ、キーワード +"Last modified: " の含まれる行を探すためにコマンド ":g" を実行する。キーワード +の含まれる行に対しては ":s" が実行され、既存の日付を現在のものに置き換える。 +":execute" は ":g" や ":s" で expression を使えるようにするためのものである。 +日付は関数 strftime() から得られる。strftime() の引数を変更して、別の形の日付 +を得ることもできる。 + +コマンドラインから自動コマンドを入力すると、( や CTRL-D などで) イベント +とコマンド名が適切に補完される。 + +Vimはマッチする全ての自動コマンドをユーザーの指定した順に実行する。ユーザーが +実行させる最初の自動コマンドにはファイルパターンに "*" を使い、全てのファイル +に適用されるようにするとよい。これはつまり、あらゆる設定のための既定を好きなよ +うに定義することができ、もしマッチする自動コマンドが別にあれば、そちらの方が設 +定を上書きできるということである。しかしマッチする自動コマンドが他になければ、 +少なくともあなたの設定した既定は回復される (もし自動コマンドがマッチした別の +ファイルから、マッチしなかったファイルに移っても)。 Note Unixのシェルと違い、 +"*" は "." で始まるファイルにもマッチすることに注意。 + + *autocmd-searchpat* +自動コマンドは現在の検索パターンを変更しない。Vimは自動コマンドの実行前に現在 +の検索パターンを保存し、自動コマンドが終了してから復元する。つまり自動コマンド +はオプション 'hlsearch' で強調表示されている文字列に影響しないということである。 +自動コマンド内でも、例えばコマンド "n" 等で、検索パターンは普通に使用できる。 +もし自動コマンドの中で終了後に使う検索パターンを設定したいなら、":let @/ =" と +すること。 +自動コマンドの中で ":nohlsearch" を使って、検索語の強調表示を無効にすることは +できない。Vimの開始時に検索語の強調表示を行わないためには、'viminfo' のフラグ +'h' を使うこと。 + + *Cmd-event* +イベント "*Cmd" のうちどれかを使うと、それによる自動コマンドが読み込み、書き +込み、またはsourceを行うものと想定される。これは特殊なファイル、例えばリモート +システム上のファイルに作業をするときに使える。 +注意: これらのイベントを誤った方法で使うと、そのイベントが発生するファイルの読 +み書きが不可能になってしまう。自分の自動コマンドをしっかりテストすること。最 +良の方法は、普通のファイル名には決してマッチしないパターン (例えば "ftp://*") +を使うことである。 + +BufReadCmd に対して自動コマンドを定義すると、クラッシュしたセッションの復旧が +難しくなる。元のファイルから復旧するとき、Vimはスワップファイル内に見つからな +かった部分のみを読み込む。それは BufReadCmd の自動コマンドを使ったときは不可 +能なので、コマンド |:preserve| を使って元のファイルが復旧に必要ないようにする +こと。そうするのはファイルが変更を受けたと判断したときのみでもよい。 + +読み込みと書き込みのコマンドの場合、Vim変数 |v:cmdarg| は引数 "++enc=" と +"++ff=" の、有効だったものを保持している。これらはファイルを読み書きするコマン +ドで使われるべきである。Vim変数 |v:cmdbang|はコマンドに "!" が使われたときに +1、そうでないときに 0 が設定される。 + +例は標準プラグイン $VIMRUNTIME/plugin/netrwPlugin.vim を参照。 + +============================================================================== +11. 自動コマンドを無効にする *autocmd-disable* + +一時的に自動コマンドを無効にするにはオプション 'eventignore' を使う。これは予 +期しない振るまいを引き起こす可能性がある。|:finally|つきの|:try|ブロックを使っ +て後で 'eventignore' を元に戻すようにすること。 + + *:noautocmd* *:noa* +1つのコマンドを実行する間だけ自動コマンドを無効にするには修飾子 ":noautocmd" +を使う。これは後に続くコマンドを実行する間だけ、'eventignore' を "all" にセッ +トする。例: > + + :noautocmd w fname.gz + +これはgzipプラグインで定義された自動コマンドを発生させずにファイルを書き込む。 + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/change.jax b/plugins/vimdoc-ja/doc/change.jax new file mode 100644 index 0000000000..83127d5078 --- /dev/null +++ b/plugins/vimdoc-ja/doc/change.jax @@ -0,0 +1,1770 @@ +*change.txt* For Vim バージョン 8.0. Last change: 2017 Feb 17 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +このファイルでは、テキストを削除したり変更するコマンドの説明をする。この文章の +中では、「テキストを変更する」とは、一つのコマンドでテキストを削除し、別のテキ +ストに置き換えることを意味する。これらのコマンドは全てアンドゥできる。非Exコマ +ンドはコマンド "." で繰り返すことができる。 + +1. テキストの削除 |deleting| +2. 削除と挿入 |delete-insert| +3. 単純な変更 |simple-change| *changing* +4. 複雑な変更 |complex-change| + 4.1 フィルタコマンド |filter| + 4.2 置換 |:substitute| + 4.3 検索と置換 |search-replace| + 4.4 タブの変換 |change-tabs| +5. テキストのコピーと移動 |copy-move| +6. テキストの整形 |formatting| +7. テキストのソート |sorting| + +テキストの挿入に関しては |insert.txt| を参照。 + +============================================================================== +1. テキストの削除 *deleting* *E470* + +["x] または ** *x* *dl* +["x]x カーソル下から後の [count] 文字を [レジスタ x に入れ] + 削除する (行単位ではない|linewise|)。"dl" と同じであ + る。 キーには [count] が使えない。代わりに、 + [count] の最後の文字を削除する {訳注: 123と押すと + 3が消え12になる}。 キーが思ったように動作しない + ときは、|:fixdel| を参照。 の削除 (行の連結) につ + いては、'whichwrap' を参照。{Vi では が使えない} + + *X* *dh* +["x]X カーソルから前の [count] 文字を [レジスタ x に入れ] 削 + 除する (行単位ではない|linewise|)。"dh" と同じである。 + 'whichwrap' も参照。 + + *d* +["x]d{motion} {motion} でカーソルが動く範囲のテキストを [レジスタ x + に入れ] 削除する。例外については以下を参照。 + + *dd* +["x]dd [count] 行を [レジスタ x に入れ] 削除する (行単位 + |linewise|)。 + + *D* +["x]D カーソル下から行の最後までの文字と、[count]-1 行を、 + [レジスタ x に入れ] 削除する。"d$" と同義 + (行単位ではない|linewise|)。 + 'cpoptions' にフラグ '#' が入っているとカウントは無視 + される。 + +{Visual}["x]x または *v_x* *v_d* *v_* +{Visual}["x]d または +{Visual}["x] ビジュアル選択されたテキストを [レジスタ x に入れ] 削 + 除する({Visual} については |Visual-mode| を参照)。{Vi + にはない} + +{Visual}["x]CTRL-H または *v_CTRL-H* *v_* +{Visual}["x] 選択モード内で: ビジュアル選択されたテキストを [レジス + タ x に入れ] 削除する。 + +{Visual}["x]X または *v_X* *v_D* *v_b_D* +{Visual}["x]D ビジュアル選択された行を [レジスタ x に入れ] 削除する + ({Visual} については |Visual-mode| を参照)。矩形ビジュ + アルモードでは、"D" はビジュアル選択されたテキストと行 + 末までの全てのテキストを削除する。 {Vi にはない} + + *:d* *:de* *:del* *:delete* *:dl* *:dp* +:[range]d[elete] [x] [range] 行 (既定値: 現在行) を [レジスタ x に入れ] 削 + 除する。 + Note これらの変な短縮入力: + :dl delete と list + :dell 同上 + :delel 同上 + :deletl 同上 + :deletel 同上 + :dp delete と print + :dep 同上 + :delp 同上 + :delep 同上 + :deletp 同上 + :deletep 同上 + +:[range]d[elete] [x] {count} + [range] 行目 (既定: 現在行 |cmdline-ranges|) から + {count} 行を [レジスタ x に入れ] 削除する。 + +これらのコマンドはテキストを削除する。これらは (`:d` を除いて) コマンド `.` で +繰り返したり、アンドゥできる。テキストのブロックを削除するには、ビジュアルモー +ドを使う。レジスタの説明については、|registers| を参照。 + +コマンド "d{motion}" に関する例外: 移動が行単位でなく、移動の開始点と終了点が +同じ行になく、移動の開始点の前に空白しかなく終了点の後に空行以外がない場合に +は、削除は行単位となる。このときユーザーは空白のみの行が残ると期待するかもしれ +ないが、共に削除される。削除を文字単位に強制したい場合は |o_v| を使うこと。 + +オプション 'cpoptions' がフラグ 'E' を含んでいるときは、テキストの空の範囲を削 +除しようとすると (例えば、1列目での "d0")、エラーになる。 + + *J* +J [count] 行を連結する (最低は 2 行)。インデントを削除 + し、空白を最大 2 個まで挿入する (以下を参照)。バッファ + の最終行では失敗する。 + 大きすぎる [count] は、有効な行数まで減少される。 + + *v_J* +{Visual}J ビジュアル選択された行を連結する (最低は 2 行)。インデ + ントを削除し、空白を最大 2 個まで挿入する (以下を参照) + {Vi にはない} + + *gJ* +gJ [count] 行を連結する (最低は 2 行)。空白の挿入や削除を + 行わない。 {Vi にはない} + + *v_gJ* +{Visual}gJ ビジュアル選択された行を連結する (最低は 2 行)。空白の + 挿入や削除を行わない。 {Vi にはない} + + *:j* *:join* +:[range]j[oin][!] [flags] + [range] 行を連結する。"J" と同様だが、[!] と共に使うと + 空白の挿入や削除を行わない。[range] の開始点と終了点が + 同じときは、このコマンドは何もしない。既定の動作では、 + 現在行を次行と連結する。 {Vi にはない} + [flags]については|ex-flags|を参照。 + +:[range]j[oin][!] {count} [flags] + [range] 行目 (既定では現在行 |cmdline-ranges|) からの + {count} 行を連結する。"J" と同様だが、[!] と共に使うと + 空白の挿入や削除を行わない。 {Vi にはない} + [flags]については|ex-flags|を参照。 + +これらのコマンドは、行の間の を削除する。この結果、複数行が1行に連結され +る。これらのコマンド (`:j` 以外) は、繰り返しやアンドゥができる。 + +これらのコマンド ("gJ" 以外) は の場所に空白を1個挿入する。ただし行末に +空白が付いていたり、次の行が ')' で始まるときは挿入しない。これらのコマンド +("gJ" 以外) は次行の先頭あたりにある空白を全て削除する。オプション +'joinspaces' がオンのときは、これらのコマンドは '.', '!', '?' の後に2個の空白 +を挿入する (しかし 'cpoptions' がフラグ 'j' を含んでいるときは、2個の空白は +'.' の後にしか挿入しない)。 +'formatoptions' のフラグ 'M' と 'B' は、マルチバイト文字の前後に空白を挿入する +ときの動作を変更する |fo-table|。 + +'[ マークは連結前の最初の行の末尾に設定される。'] マークは連結後の行の末尾に設 +定される。 + + +============================================================================== +2. 削除と挿入 *delete-insert* *replacing* + + *R* +R 置換モードに入る。打ち込んだ文字がカーソル下の既存の文 + 字をどんどん置き換えていく。入力されたテキストを + [count]-1 回繰り返す。詳細は |Replace-mode| を参照。 + + *gR* +gR 仮想置換モードに入る。打ち込んだ文字が画面上の既存の文 + 字をどんどん置き換えていく。そのため は数文字を + 一回で置き換えることができる。入力されたテキストを + [count]-1 回繰り返す。詳細は |Virtual-Replace-mode| を + 参照。 + {Vimが |+vreplace| 機能付きでコンパイルされたときのみ + 有効} + + *c* +["x]c{motion} {motion} のテキストを [レジスタ x にいれ] 削除し、挿入 + を始める。'cpoptions' がフラグ 'E' を含むときは、削除 + すべきテキストがないと (例えば、"cTx" でカーソルが 'x' + の直後にあるとき)、エラーが発生し挿入モードは始まらな + い (これはVi互換である)。 + 'cpoptions' がフラグ 'E' を含まないときは、コマンド + "c" は削除すべきテキストがなくても、必ず挿入モードを始 + める。 + + *cc* +["x]cc [count] 行を [レジスタ x に入れ] 削除し、挿入を始める + (行単位|linewise|)。'autoindent' がオンのとき、最初の + 行のインデントを保持する。 + + *C* +["x]C カーソル位置から行の終わりまでと、[count]-1 行を [レジ + スタ x に入れ] 削除し、挿入を始める。"c$" と同義である + (行単位でない|linewise|)。 + + *s* +["x]s [count] 文字を [レジスタ x に入れ] 削除し、挿入を始め + る (s は Substitute --置換 を意味する)。"cl" と同義で + ある (行単位でない|linewise|)。 + + *S* +["x]S [count] 行を [レジスタ x に入れ] 削除し、挿入を始める。 + "cc" と同義である (行単位|linewise|)。 + +{Visual}["x]c または *v_c* *v_s* +{Visual}["x]s ビジュアル選択されたテキストを [レジスタ x に入れ] 削 + 除し、挿入を始める ({Visual} については |Visual-mode| + を参照)。{Vi にはない} + + *v_r* +{Visual}["x]r{char} ビジュアル選択されたテキストを全て {char} に置き換える。 + + *v_C* +{Visual}["x]C ビジュアル選択された行を [レジスタ x に入れ] 削除し、 + 挿入を始める。矩形ビジュアルモードでは少し動作が違う + |v_b_C|。 + {Vi にはない} + *v_S* +{Visual}["x]S ビジュアル選択された行を [レジスタ x に入れ] 削除し、 + 挿入を始める ({Visual} については |Visual-mode| を参 + 照)。{Vi にはない} + *v_R* +{Visual}["x]R 現在のところ {Visual}["x]S と同じである。次のバージョ + ンでは動作が変わるかもしれない。 {Vi にはない} + +Note: +- 挿入モード、置換モードは で終了できる。 +- これらのモードでの他の特殊文字については、「テキストの挿入と置換」の章 + |mode-ins-repl| を参照。 +- [count] の効果は、Vimが挿入モードや置換モードを抜けた後で発生する。 +- 'cpoptions' がフラグ '$' を含んでいて、変更が1行以内である場合、Vimは削除さ + れるテキストを表示しつづけ、最後に削除された文字の位置に '$' を置く。 + +レジスタに関する説明は |registers| を参照。 + +置換モードは挿入モードと似ているが、文字を打ち込むたびに一文字ずつ削除される点 +が違う。行の最後に達すると、Vimはそれ以降は (挿入モードと同様に) 文字を追加す +る。置換モードでは、バックスペースキーは (もしあれば) 以前のテキストを復元する +(「テキストの挿入と置換」の章 |mode-ins-repl| を参照すること)。 + + *cw* *cW* +特別な場合: "cw" と "cW" は、カーソルが単語の上にあるとき、単語のあとにつづく +空白を含めず、単語の末尾までを変更する("ce" と "cE" と同じ働きをする)。これは +Vimが "cw" を単語の変更(change-word)として解釈し、また「単語」にはあとに続く空 +白は含まれないからである。 {Vi: あとに空白が続く空白上での "cw" は、最初の空白 +のみを変更する。これは多分バグである。"dw" は全ての空白を削除するからだ。とに +かく、Vi風に動作させるときには 'cpoptions' にフラグ 'w' を含めること} + +"cw" の変更範囲に単語の後の空白も含めたいときは、次のマップを使うこと。 > + :map cw dwi +または "caw" を使う(|aw| を参照)。 + + *:c* *:ch* *:change* +:{range}c[hange][!] テキストを行単位で別のテキストと置き換える。 + "." のみを含む行を打ち込むことで置換を終了する。 + {range} なしの場合、現在行のみを変更する。 + [!]をつけると、このコマンドを実行するときだけ + 'autoindent' をトグルする。 + +============================================================================== +3. 単純な変更 *simple-change* + + *r* +r{char} カーソル下の文字を {char} に置き換える。 + {char} が のとき、文字は改行に置き換わる。 + 文字を本当の に置き換えるには、CTRL-V を使う。 + CTRL-V は文字を に置き換える。 + {Vi: CTRL-V は改行に置き換わり、何かの文字を + に置き換えることはできない} + + {char} が CTRL-E または CTRL-Y のとき、ちょうど + |i_CTRL-E| と |i_CTRL-Y| と同じように、下の行または上 + の行の文字が使われる。回数も指定することができるため、 + `10r` は下の行から 10 文字をコピーすることになる。 + + [count] を指定すると、[count] 文字が [count] 個の + {char} に置き換わる。しかし {char} が の + 場合、挿入される はただ1個である。"5r" は5文 + 字を1個の改行に置き換える。 + {char} が のとき、Vimは自動インデントを行 + う。これは置き換えるべき文字を削除した後 "i" + を実行したような動作になる。 + {char} はダイグラフでもよい |digraph-arg|。 + |:lmap| のマッピングは {char} に適用される。挿入モード + では、コマンド CTRL-^ を使ってマッピングを切り替えられ + る |i_CTRL-^|。オプション 'encoding' がUnicodeの一種の + ときに composing character を使うことについては + |utf-8-char-arg| を参照。 + + *gr* +gr{char} カーソル下の仮想文字を {char} に置き換える。このコマン + ドはファイル上の文字単位ではなく、画面上の文字幅単位で + 置き換える。詳細は |gR| と |Virtual-Replace-mode| を参 + 照。|r| と同様、回数を指定できる。 + {char} の入力方法は |r| と同様である。 + {Vimが |+vreplace| 機能付きでコンパイルされたときのみ + 有効} + + *digraph-arg* +|r| や |t| 等のノーマルモードコマンドの引数は、1個の文字である。オプション +'cpoptions' がフラグ 'D' を含まないとき、この文字はダイグラフ |digraphs| と同 +様に入力できる。まず CTRL-K を打ち込み、次にダイグラフの2文字を入力する。 +{Vimが |+digraphs| 機能付きでコンパイルされたときのみ有効} + + *case* +以下のコマンドは、アルファベットの大文字/小文字を切り替える。現在有効なロケー +ル |locale| が使われる。|:language| を参照。環境変数 LC_CTYPE の値に影響される。 + + *~* +~ オプション 'tildeop' がオフのとき: カーソル下の文字の + 大文字/小文字を切り替え、カーソルを右に移動させる。 + [count] が指定されたときは、[count] 文字に作用する。 + {Vi: カウントが使えない} + +~{motion} オプション 'tildeop' がオンのとき: {motion} のテキスト + の大文字/小文字を切り替える。 {Vi: チルダは operator + として使用できない} + + *g~* +g~{motion} {motion} のテキストの大文字/小文字を切り替える。 + {Vi にはない} + +g~g~ *g~g~* *g~~* +g~~ 現在行の大文字/小文字を切り替える。 {Vi にはない} + + *v_~* +{Visual}~ ビジュアル選択されたテキストの大文字/小文字を切り替え + る({Visual} については |Visual-mode| を参照)。 + {Vi にはない} + + *v_U* +{Visual}U ビジュアル選択されたテキストを大文字にする ({Visual} + については |Visual-mode| を参照)。 {Vi にはない} + + *gU* *uppercase* +gU{motion} {motion} のテキストを大文字にする。{Vi にはない} + 例: > + :map! gUcw`]a +< これは挿入モードで機能する。カーソルの前の単語を大文字 + にするときに CTRL-F を打ち込めばよい。単語は小文字で入 + 力し、後から大文字にする方が楽だ。 + + +gUgU *gUgU* *gUU* +gUU 現在行を大文字にする。 {Vi にはない} + + *v_u* +{Visual}u ビジュアル選択されたテキストを小文字にする ({Visual} + については |Visual-mode| を参照)。 {Vi にはない} + + *gu* *lowercase* +gu{motion} {motion} のテキストを小文字にする。 {Vi にはない} + +gugu *gugu* *guu* +guu 現在行を小文字にする。 {Vi にはない} + + *g?* *rot13* +g?{motion} {motion} のテキストをRot13エンコードする。{Vi にはない} + + *v_g?* +{Visual}g? ビジュアル選択されたテキストをRot13エンコードする + ({Visual}については |Visual-mode| を参照)。 + {Vi にはない} + +g?g? *g?g?* *g??* +g?? 現在行をRot13エンコードする。 {Vi にはない} + +各単語の最初の文字を大文字にする: > + :s/\v<(.)(\w*)/\u\1\L\2/g + +加算と減算 ~ + *CTRL-A* +CTRL-A カーソルの下または後の数字またはアルファベットに + [count] を加える。 {Vi にはない} + + *v_CTRL-A* +{Visual}CTRL-A ビジュアル選択されたテキスト中の数字またはアル + ファベットに [count] を加える。{Vi にはない} + + *v_g_CTRL-A* +{Visual}g CTRL-A ビジュアル選択されたテキスト中の数字またはアルファベッ + トに [count] を加える。複数行がビジュアル選択されてい + る場合、各行は付加された [count] ごとに増やされる (そ + のため効果的に [count] ごとに増加する配列を作ることが + できる)。 {Vi にはない} + 例えば、このような数字のリストがあるとする: + 1. ~ + 1. ~ + 1. ~ + 1. ~ + 2番目の "1." に移動し3行をビジュアル選択してから + g CTRL-A を押すと、このようになる: + 1. ~ + 2. ~ + 3. ~ + 4. ~ + + *CTRL-X* +CTRL-X カーソルの下または後の数字またはアルファベットから + [count] を減じる。 {Vi にはない} + + *v_CTRL-X* +{Visual}CTRL-X ビジュアル選択されたテキスト中の数字またはアルファベッ + トから [count] を減じる。 {Vi にはない} + + MS-Windows では、ビジュアルモードでのテキストの切り取 + りにマップされる |dos-standard-mappings|。このマッピン + グを無効にしたいなら、次のようにする: > + silent! vunmap +< + *v_g_CTRL-X* +{Visual}g CTRL-X ビジュアル選択されたテキスト中の数字またはアルファベッ + トから [count] を減じる。複数行がビジュアル選択されて + いる場合、各値は付加された [count] ごとに減らされる + (そのため効果的に [count] ごとに減少する配列を作ること + ができる)。 {Vi にはない} + +CTRL-A と CTRL-X が適用できるのは: +- 符号付き及び符号なし10進数 +- 符号なし2進数、8進数および16進数 +- アルファベット文字 + +'nrformats' オプションに依存している: +- 'nrformats' に "bin" が含まれる時、Vim は '0b' または '0B' で始まる数値を2進 + 数として扱う。 +- 'nrformats' が "octal" を含むときは、Vimは '0' で始まり、'8' や '9' を含まな + い数字を8進数として取り扱う。他の数は10進数とみなされ、マイナス符号が付いて + もよい。カーソルが数の上にあれば、コマンドはその数に適用される。そうでなけれ + ば、カーソルの右の数に適用される。 +- 'nrformats' が "hex" を含むときは、Vimは '0x' か '0X' で始まる数を16進数とし + て取り扱う。その数の最も右の文字が大文字であるか小文字であるかによって、変更 + 結果の16進数が大文字か小文字かが決定する。対象となった数にアルファベットが含 + まれない場合、Vimは前回の決定を使う。 +- 'nrformats' が "alpha" を含むときは、Vimはカーソル下または後のアルファベット + を変更する。これはアルファベットのインデックスつきのリストを作るときに便利で + ある。 + +10進数では先頭の負の符号は増加/減少に対して考慮される。しかし2進数、8進数およ +び16進数では考慮されない。符号を無視するには CTRL-A または CTRL-X を使う前に数 +字をビジュアル選択する。 + +ゼロから始まる数 (全ての8進数、16進数を含む) に対して、Vimはできる限りその数の +文字数を保とうとする。"0077" 上で CTRL-A を使うと "0100" となり、"0x100" 上で +CTRL-X を使うと "0x0ff" となる。 +1つだけ例外がある: ゼロで始まるが8進数でないとき('8' や '9' を含んでいるとき)、 +'nrformats' が "octal" を含んでいるならば、結果が8進数とみなされないように、前 +方のゼロは削除される。 + +Note: 'nrformats' が "octal" を含んでいるとき、0で始まる10進数は、8進数と区別 +しづらいため、意図しない結果になる可能性がある。 + +Note: 'nrformats' が "bin" を含んでいるとき、'0x' または '0X' で始まる2進数は +16進数として解釈される。これは '0b' が16進数の桁として有効だからである。 +{訳注: 0x0b0011 のような値のこと。} + +コマンド CTRL-A はマクロ内でたいへん便利である。例: 番号付きリストを作るには、 +次の方法を使う。 + +1. リストの最初の項目を作る。番号から始まるようにすること。 +2. qa - レジスタ 'a' への記録を始める +3. Y - 項目をコピーする +4. p - 項目のコピーを最初の項目の後に貼り付ける +5. CTRL-A - 番号を増やす +6. q - 記録をストップする +7. @a - コピー、貼り付け、番号増加を 回繰り返す + + +行を左右にずらす *shift-left-right* + + *<* +<{motion} {motion} の行を 'shiftwidth' 1個分左にずらす。 + + *<<* +<< [count] 行を 'shiftwidth' 1個分左にずらす。 + + *v_<* +{Visual}[count]< ビジュアル選択された行を、'shiftwidth' の [count] 個分 + 左にずらす ({Visual} については |Visual-mode| を参照)。 + {Vi にはない} + + *>* + >{motion} {motion} の行を 'shiftwidth' 1個分右にずらす。 + + *>>* + >> [count] 行を 'shiftwidth' 1個分右にずらす。 + + *v_>* +{Visual}[count]> ビジュアル選択された行を、'shiftwidth' の [count] 個分 + 右にずらす ({Visual} については |Visual-mode| を参照)。 + {Vi にはない} + + *:<* +:[range]< [range] の行を、'shiftwidth' 1個分左にずらす。 + 'shiftwidth' の複数個分ずらすには、'<' を繰り返す。 + +:[range]< {count} [range] (既定は現在行 |cmdline-ranges|) から始まる + {count} 行を 'shiftwidth' 1個分左にずらす。 + 'shiftwidth' の複数個分ずらすには、'<' を繰り返す。 + +:[range]le[ft] [indent] [range] の行を左揃えする。行のインデントは [indent] + (既定値は 0) に設定される。 {Vi にはない} + + *:>* +:[range]> [flags] [range] の行を、'shiftwidth' 1個分右にずらす。 + 'shiftwidth' の複数個分ずらすには、'>' を繰り返す。 + [flags]については|ex-flags|を参照。 + +:[range]> {count} [flags] + [range] (既定は現在の行 |cmdline-ranges|) から始まる + {count} 行を、'shiftwidth' 1個分右にずらす。 + 'shiftwidth' の複数個分ずらすには、'>' を繰り返す。 + [flags]については|ex-flags|を参照。 + +コマンド ">" と "<" は、プログラムに含まれるインデントを変更するのに便利であ +る。オプション 'shiftwidth' には、これらのコマンドが挿入、削除する空白の幅を設 +定する。'shiftwidth' は既定では 8 だが、例えば 3 に設定して、インデントをもっ +と少なくすることもできる。左方向へのシフトは、インデントがなくなったときに終了 +する。右方向へのシフトは、空行には適用されない。 + +'shiftround' がオンのとき、インデントは 'shiftwidth' の倍数に丸められる。 + +'shiftwidth' がオンのとき、あるいは 'cindent' がオンで 'cinkeys' が値 0 の '#' +を含むとき、右方向へのシフトは '#' で始まる行に適用されない (これらの行は、行 +の最初に位置すべきCプリプロセッサー指令であると考えられる)。 + +'expandtab' がオフ (既定値) のとき、Vimはインデントにできる限り多くの を +使う。">><<" によって、空白のみで構成されたインデントを、 (と必要ならばい +くつかの空白) で構成されたインデントに置換できる。'expandtab' がオンのときは、 +Vimは空白のみを使う。">><<" によって、インデント内の を空白に置換できる +(あるいは `:retab!` を使う)。 + +行を 'shiftwidth' の複数個分ずらすには、ビジュアルモードかコマンド `:` を使う。 +例: > + Vjj4> 3行をインデント4個分右に移動 + :<<< 現在の行をインデント3個分左に移動 + :>> 5 5行をインデント2個分右へ移動 + :5>> 5行目をインデント2個分右に移動 + +============================================================================== +4. 複雑な変更 *complex-change* + +4.1 フィルタコマンド *filter* + +フィルタとは、テキストを標準入力から受け取り、何らかの変更を加え、標準出力に送 +るプログラムのことである。以下のコマンドにより、テキストの一部をフィルタにかけ +ることができる。フィルタの例としては、行をアルファベット順にソートする "sort"、 +Cのプログラムを整形する "indent" (ただし、フィルタ機能を持ったバージョンが必 +要。全てのバージョンでできるわけではない) などがある。オプション 'shell' は、 +Vimがフィルタコマンドを実行するときに使うシェルを指定する ('shelltype' も参 +照)。フィルタコマンドはコマンド "." で繰り返せる。Vimは `:!` の後の ('"' で始 +まる) コメントを認識しない。 + + *!* +!{motion}{filter} {motion} のテキストを外部プログラム {filter} でフィル + タ処理する。 + + *!!* +!!{filter} [count] 行を外部プログラム {filter} でフィルタ処理する。 + + *v_!* +{Visual}!{filter} ビジュアル選択された行を外部プログラム {filter} でフィ + ルタ処理する。({Visual} については |Visual-mode| を参 + 照)。 {Vi にはない} + +:{range}![!]{filter} [!][arg] *:range!* + {range} 行を外部プログラム {filter} でフィルタ処理する。 + {filter} の後ろには '!' を付けてもよい。これは最後に実 + 行されたコマンドに置き換えられる。さらに [arg] を付け + ると、それがコマンドに付け加えられる。Vimはフィルタコ + マンドの出力を一時ファイルに保存し、そのファイルをバッ + ファに読み込む |tempfile|。フィルタの出力を一時ファイ + ルにリダイレクトするときはオプション 'shellredir' が使 + われる。Unixでは 'shellredir' がオフのとき、可能ならば + パイプが使われる。 + 'cpoptions' に 'R' フラグが含まれるとき、フィルタ処理 + された行のマークは削除される。|:keepmarks| コマンドを + 使うと削除されない。例: > + :keepmarks '<,'>!sort +< フィルタ処理のあと行数が少なくなっていた場合、すでにな + い行を指しているマークは削除される。 + + *=* +={motion} {motion} の行を、オプション 'equalprg' で指定された外 + 部プログラムでフィルタ処理する。'equalprg' が空のとき + (これが既定) は、組み込みの整形機能の |C-indenting| と + |'lisp'| を使う。しかし 'indentexpr' が空でないとき + は、それが使われる |indent-expression|。Vim が内部 + フォーマット機能なしでコンパイルされているときは、最後 + の手段として "indent" プログラムが使われる。 + + *==* +== [count] 行を ={motion} と同様にフィルタ処理する。 + + *v_=* +{Visual}= ビジュアル選択されたテキストを ={motion} と同様にフィ + ルタ処理する。 {Vi にはない} + + + *tempfile* *setuid* +フィルタリング、diff の生成、tempname() などを行うときには、一時ファイルが作成 +される。Unix ではこのファイルはプライベートな (自分だけがアクセスできる) ディ +レクトリに置かれる。セキュリティ上の問題 (symlink attack や他の人があなたのファ +イルを読むなど) を避けるためである。Vim が終了するとき、そのディレクトリと中に +あるファイルは自動的に削除される。Vim に setuid ビットが立っているとこれが問題 +を引き起こすことがある。一時ファイルは setuid されたユーザーが所有するのに対 +し、フィルタコマンドは元のユーザーとして動作するためである。 +MS-DOS と OS/2 では、以下のディレクトリのうち最初に利用可能なものが使われる: +$TMP, $TEMP, c:\TMP, c:\TEMP。 +Unix におけるディレクトリのリストは: $TMPDIR, /tmp, current-dir, $HOME。 +MS-Windows ではシステム関数 GetTempFileName() が使われる。 +他のシステムではライブラリ関数 tmpnam() が使われる。 + + + +4.2 置換 *:substitute* + *:s* *:su* +:[range]s[ubstitute]/{pattern}/{string}/[flags] [count] + [range] の各行で {pattern} のマッチを {string} に置き + 換える。 + {pattern}については|pattern|を参照すること。 + {string} は普通の文字列でもよいし、特別な指定方法を使っ + てもよい。|sub-replace-special| を参照。 + *E939* + [range] と [count] が指定されないと、現在行内でのみ置 + 換を行う。[count] が指定されると、[range] の最終行から + 数えて [count] 行で置換を行う。[range] が指定されない + と、現在行から開始する。[count] は正の数でなければなら + ない。|cmdline-ranges| も参照。 + + フラグについては |:s_flags| を参照。 + +:[range]s[ubstitute] [flags] [count] +:[range]&[&][flags] [count] *:&* + 最後の置換を同じパターンかつ同じ置換文字列で、フラグを + つけずに繰り返す。フラグを追加することもできる + (|:s_flags|を参照)。 + Note `:substitute` の後ではフラグ '&' は使えないことに + 注意。パターンの区切り文字だと認識されてしまう。 + `:substitute` とフラグ 'c', 'g', 'i', 'I', 'r' の間の + 空白は必要不可欠ではない。しかしスクリプト内では、混乱 + しないように空白を入れておくのはよい考えである。 + +:[range]~[&][flags] [count] *:~* + 最後の置換を同じ置換文字列で、最後の検索パターン {訳注: + "/" で使ったもの} に対して繰り返す。`:&r` に似ている。 + フラグについては |:s_flags| を参照。 + + *&* +& `:s` と同義 (最後の置換を繰り返す)。 Note 同じフラグが + 使われるわけではないので注意。実際の動作は違うかもしれ + ない。フラグも同じにするには `:&&` を使うこと。 + + *g&* +g& `:%s//~/&` と同義 (全ての行に対し、最後の検索パターン + で、同じフラグで最後の置換を繰り返す)。 + 例えば、`:s/pattern/repl/flags` と置換を実行し、次に + `/search` と検索を実行すると、`g&` は + `:%s/search/repl/flags` を実行する。 + 覚え方: 「グローバル (global --全体的な) 置換」 + {Vi にはない} + + *:snomagic* *:sno* +:[range]sno[magic] ... `:substitute` と同じだが、常に 'nomagic' を使う。 + {Vi にはない} + + *:smagic* *:sm* +:[range]sm[agic] ... `:substitute` と同じだが、常に 'magic' を使う。 + {Vi にはない} + + *:s_flags* +置換コマンドで使えるフラグ: + + *:&&* +[&] 先頭に指定しなければならない。前回の置換コマンドと同じフラグを使う。 + 例: > + :&& + :s/this/that/& +< Note コマンド `:s` と `:&` では、前回と同じフラグは使われない。 + {Vi にはない} + +[c] 置換前に毎回確認する。マッチしている文字列を (強調表示グループ + |hl-IncSearch| で) 強調表示する。確認を求められたら、ユーザーは以下のよ + うに応答する。 *:s_c* + 'y' そのマッチを置換する ("yes") + 'l' そのマッチを置換し、置換を終了する ("last") + 'n' そのマッチを置換せず、次に移る ("no") + 置換を終了する + 'a' そのマッチと、以降の全てのマッチを置換する {Vi にはない} + 'q' 置換を終了する {Vi にはない} + CTRL-E 画面を上にスクロールする {Vi にはない。Vimが + |+insert_expand| 機能付きでコンパイルされたときのみ有効} + CTRL-Y 画面を下にスクロールする {Vi にはない。Vimが + |+insert_expand| 機能付きでコンパイルされたときのみ有効} + オプション 'edcompatible' がオンのとき、Vimはフラグ [c] を記憶し、それ + が指定される度にオン/オフを切り替えるが、新しい検索パターンが使われる + とリセットする。 + {Vi にはないもの: マッチの強調表示、'y' と 'n' 以外の応答} + +[e] 検索パターンが何もマッチしなかったとき、エラーメッセージを表示しない。 + 特にマッピング内ではエラーが発生しなかったかのように続行される。これは + 「パターンは見つかりませんでした」のエラーによるマッピングの中断を防ぐ + のに使える。しかし以下のエラーの発生は抑制されない。 + 「正規表現は文字で区切ることができません」 + 「\ の後は / か ? か & でなければなりません」 + 「正規表現置換がまだ実行されていません」 + 「余分な文字が後ろにあります」 + 「(割込まれました)」 + {Vi にはない} + +[g] 行中の全てのマッチを置換する。このフラグなしだと、各行の1個目のマッチ + のみが置換される。オプション 'edcompatible' がオンのとき、Vimはこのフ + ラグを記憶し、指定される度にオン/オフを切り替えるが、新しい検索パター + ンが使われるとリセットする。'gdefault' がオンのときは、このフラグはオ + ンが既定値になり、フラグ [g] を指定したときにはオフになる。 + +[i] パターンの大文字/小文字の区別をしない。オプション 'ignorecase' と + 'smartcase' は使われない。 + {Vi にはない} + +[I] パターンの大文字/小文字を区別する。オプション 'ignorecase' と + 'smartcase' は使われない。 + {Vi にはない} + +[n] マッチの個数を表示し、実際には置換を行わない。フラグ [c] は無視される。 + 'report' が 0 のときと同じようにマッチが表示される。 + 何個あるか調べるときに便利。|count-items| + \= |sub-replace-expression| が使われたときは、式はそれぞれのマッチに対 + してサンドボックス (|sandbox|) で実行される。 + +[p] 最後に置換を行った行を表示する。 + {Vi にはない} + +[#] [p] と同様。行番号をつける。 + +[l] [p] と同様だが、|:list| のように表示する。 + +[r] 引数のない `:&` か `:s` との連携でのみ有効。`:&r` は `:~` と同様に動作 + する。検索パターンが空のとき、最後の置換コマンドや `:global` でのパター + ンではなく、最後の検索パターンを使用する。最後に検索パターンを使用した + コマンドが置換や `:global` だったときは、何もしない。最後のコマンドが + "/" のような検索コマンドだったときは、そのコマンドの検索パターンを使う。 + 引数付きの `:s` では、すでにそう動作するようになっていた。 > + :s/blue/red/ + /green + :s//red/ または :~ または :&r +< 最後のコマンドは "green" を "red" に置き換える。 > + :s/blue/red/ + /green + :& +< 最後のコマンドは "blue" を "red" に置き換える。 + {Vi にはない} + +NOTE パターンに 'magic' が適用されるかどうかを変更するフラグはないことに注意。 +代わりに違うコマンド{訳注: |:snomagic|}または |/\v| などを使う。これは、パター +ン解釈を飛ばすことでのみフラグを認識できるが、その一方でパターン解釈を飛ばす +には 'magic' の適用状態が知られている必要があるためである。 Catch 22! {訳注: +どうにもならないという意味} + +置換コマンドで {pattern} が空のときは、最後に使われた置換コマンドまたはコマン +ド `:global` のパターンが使われる。それが無い場合は、直前の検索パターンがあれ +ばそれが使われる。フラグ [r] を指定すると、最後の置換、`:global`、または検索コ +マンドのパターンが使われる。 + +{string}を省略した場合は、空文字列を指定したのと同じ結果になる。すなわち、マッ +チしたパターンが削除される。{pattern}の後のセパレータも省略することができる。 +例: > + :%s/TESTING +これは、全行から "TESTING" を削除する例である。ただし、1つの行に2個以上あって +も1個しか削除されない。 + +Viとの互換性のため、これら2つの例外が許される。 +"\/{string}/" と "\?{string}?" は "//{string}/r" と同様の効果。 +"\&{string}&" は "//{string}/" と同様の効果。 + *E146* +'/' でパターンと置換文字列を囲む代わりに、英数字や '\', '"', '|' 以外であれば、 +他の1バイト文字を使うことができる。これは検索パターンや置換文字列に '/' を含む +場合に有益である。例 > + :s+/+//+ + +パターンの定義については |pattern| を参照。矩形ビジュアルモードで、置換をその +領域内だけで行いたい場合は、パターンに |/\%V| を含める。これを使わない場合は、 +置換は常に行全体に対して行われる。 + + *sub-replace-special* *:s\=* +{string} が "\=" で始まるときは、それは式として評価される。 +|sub-replace-expression| を参照のこと。複雑な置換や特殊な文字を使うことができ +る。そうでなければ、{string} の中のこれらの文字は特別な意味を持つ: + + *:s%* +'cpoptions' に '/' が含まれている場合、{string} が "%" に等しいならば前の置換 +コマンドの {string} が使われる。|cpo-/| 参照 + + magic nomagic 作用 ~ + & \& マッチしたパターン全体に置き換わる *s/\&* + \& & '&' に置き換わる + \0 マッチしたパターン全体に置き換わる *\0* *s/\0* + \1 1番目の () 内のマッチしたパターンに置き換わる *s/\1* + \2 2番目の () 内のマッチしたパターンに置き換わる *s/\2* + .. .. *s/\3* + \9 9番目の () 内のマッチしたパターンに置き換わる *s/\9* + ~ \~ 前回の置換の {string} に置き換わる *s~* + \~ ~ '~' に置き換わる *s/\~* + \u 次の文字が大文字になる *s/\u* + \U 後に続く文字が (\E まで) 大文字になる *s/\U* + \l 次の文字が小文字になる *s/\l* + \L 後に続く文字が (\E まで) 小文字になる *s/\L* + \e \u, \U, \l, \L の終わり ( NOTE: の意味ではない!) + *s/\e* + \E \u, \U, \l, \L の終わり *s/\E* + ここで行を2つに分ける ( は CTRL-V と入力する) + *s* + \r 同上 *s/\r* + \ キャリッジリターン (CTRL-M) の挿入 ( は CTRL-V + と入力する) *s/\* + \n (ファイル内では ) の挿入 (改行を「起こさない」) + *s/\n* + \b の挿入 *s/\b* + \t の挿入 *s/\t* + \\ '\' の挿入 *s/\\* + \x ('x' は上で説明されていない文字) 将来の拡張用に予約済み + +特別な意味は |substitute()| の 第三引数 {sub} でも使えるがいくつか例外がある: + - % は 'cpoptions' に関係なくパーセント文字を挿入する。 + - 'magic' に関係なく magic は常にオンである。 + - ~ はチルダをそのまま挿入する。 + - と \r はキャリッジリターン (CTRL-M) を挿入する。 + - \ は特別な意味を持たない。単に \x の一種として扱われる。 + +例: > + :s/a\|b/xxx\0xxx/g "a b" を "xxxaxxx xxxbxxx" に置換 + :s/\([abc]\)\([efg]\)/\2\1/g "af fa bg" を "fa fa gb" に置換 + :s/abcde/abc^Mde/ "abcde" を "abc", "de" (2行) に置換 + :s/$/^V^M/ "abcde" を "abcde^M" に置換 + :s/\w\+/\u\0/g "bla bla" を "Bla Bla" に置換 + :s/\w\+/\L\u\0/g "BLA bla" を "Bla Bla" に置換 + +Note: "\L\u" を使うと単語の最初の文字をキャピタライズできる。これは Vi や古い +Vim とは互換性がない。それらの古い環境では "\u" は "\L" をキャンセルする。 +"\U\l" も同様。 + +NOTE: 以前のバージョンでは CTRL-V が特別に扱われていた。これはVi互換ではないの +で変更された。代わりに '\' を使うこと。 + +コマンド テキスト 置換結果 ~ +:s/aa/a^Ma/ aa aa +:s/aa/a\^Ma/ aa a^Ma +:s/aa/a\\^Ma/ aa a\a + +(ここで ^M を使うには CTRL-V と打ち込むこと) + +"\1", "\2" などの番号付けは、パターン内でどの "\(" が最初に来るかによって決ま +る (左から右の順)。括弧でくくられたグループが複数回マッチするときは、最後のも +のが "\1", "\2" 等に使われる。例: > + :s/\(\(a[a-d] \)*\)/\2/ "aa ab x" を "ab x" に置換 +"\2" は、"\(a[a-d] \)" を参照する。このパターンはまず "aa " にマッチし、次に +"ab " にマッチする。 + +\([ab]\)\|\([cd]\) のように括弧を '|' と連携して使っているとき、1番目か2番目の +どちらかの括弧内のパターンにはマッチしない、すなわち、\1 か \2 のどちらかは空 +になる。例: > + :s/\([ab]\)\|\([cd]\)/\1x/g "a b c d" を "ax bx x x" に置換 +< + + *:sc* *:sce* *:scg* *:sci* *:scI* *:scl* *:scp* *:sg* *:sgc* + *:sge* *:sgi* *:sgI* *:sgl* *:sgn* *:sgp* *:sgr* *:sI* *:si* + *:sic* *:sIc* *:sie* *:sIe* *:sIg* *:sIl* *:sin* *:sIn* *:sIp* + *:sip* *:sIr* *:sir* *:sr* *:src* *:srg* *:sri* *:srI* *:srl* + *:srn* *:srp* +2文字もしくは3文字の :substitute コマンド ~ + + :substitute コマンド一覧 + | c e g i I n p l r + | c :sc :sce :scg :sci :scI :scn :scp :scl --- + | e + | g :sgc :sge :sg :sgi :sgI :sgn :sgp :sgl :sgr + | i :sic :sie --- :si :siI :sin :sip --- :sir + | I :sIc :sIe :sIg :sIi :sI :sIn :sIp :sIl :sIr + | n + | p + | l + | r :src --- :srg :sri :srI :srn :srp :srl :sr + +例外: + :scr is `:scriptnames` + :se is `:set` + :sig is `:sign` + :sil is `:silent` + :sn is `:snext` + :sp is `:split` + :sl is `:sleep` + :sre is `:srewind` + + +式で置換する *sub-replace-expression* + *sub-replace-\=* *s/\=* + +置換文字列が "\=" で始まるとき、それ以降の文字列は式として解釈される。これは再 +帰的に機能しない。 + +"" 以外の文字の特別な意味 |sub-replace-special| は無効になる。 文字は +改行として使われるのでダブルクォート文字列 "\n" で改行を入れることができる。 +実際の 文字 (ファイルにおける NUL 文字) を挿入するにはバックスラッシュを +前置する。 + +"\=" 表記は |substitute()| 関数の第三引数 {sub} でも使うことができる。その場 +合、|sub-replace-special| で説明されている文字は特別な意味を持たなくなる。特 +に、 は改行として解釈されるのではなく、そのままキャリッジリターン +とニューラインとして解釈される。 + +結果が|List|のときはその要素が改行を区切りとして連結される。よって要素がそれぞ +れ行となる。ただし要素が改行を含んでいる場合は除く。 + +マッチしたテキストの全体は "submatch(0)" で参照できる。1番目の () 内でマッチし +たテキストは "submatch(1)" で参照できる。以降の () 内でマッチしたテキストも同 +様に参照できる。 + +注意: 正規表現の区切り文字が expression 内に現れてはいけない!区切りには "@" +や ":" を使うよう検討すること。Expression の結果に区切り文字が現れても問題はな +い。 + +例: > + :s@\n@\="\r" . expand("$HOME") . "\r"@ +こうすると置換を行った行の下に、環境変数 $HOME の値を含む新しい行が挿入される。 +> + s/E/\="\"/g +これは文字 'E' をユーロ記号で置換する。詳しくは || を参照。 + + +4.3 検索と置換 *search-replace* + + *:pro* *:promptfind* +:promptf[ind] [string] + 検索ダイアログを表示する。 [string] が与えられると、そ + れが初期検索文字列になる。 + {VimのWin32版、Motif版、GTKのGUI版のみ} + + *:promptr* *:promptrepl* +:promptr[epl] [string] + 検索/置換ダイアログを表示する。 [string] が与えられる + と、それが初期検索文字列になる。 + {VimのWin32版、Motif版、GTKのGUI版のみ} + + +4.4 タブの変換 *change-tabs* + *:ret* *:retab* *:retab!* +:[range]ret[ab][!] [new_tabstop] + 新たに指定されたタブストップ (タブ幅) に基づき、 + を含む空白の連続を全て、新しい空白と の列に置き + 換える。新たなタブストップの指定がないか0が指定された + ときは、Vimはオプション 'tabstop' の現在の値を使用す + る。'tabstop' の現在の値は、既存のタブの幅を計るために + 常に使用される。'!' を付けると、Vimは通常の空白のみの + 列も、適切なタブに置き換える。 + 'expandtab' がオンのとき、Vimは全てのタブを適切な数の + 空白に置き換える。 + このコマンドは 'tabstop' を新たに指定された値に設定す + る {訳注: この事実は重要である}。ファイル全体に適用さ + れたときは (それが既定の動作)、ファイルの見かけに変化 + が起こることはないはずだ。 + 注意: このコマンドはCプログラム中の文字列内部にある + 文字も修正する。これを避けるためには、プログラム + 内では "\t" を使うとよい (そうでなくても、これはよい習 + 慣である)。 + `:retab!` も空白の連続を 文字に変えてしまい、 + printf() の出力をめちゃくちゃにするかもしれない。 + {Vi にはない} + + *retab-example* +タブストップが 8 で保存され、タブストップが 4 で編集されたファイルを編集するた +めに autocommand と ":retab" を使う例。警告: 文字列内の空白は変わってしまうこ +とがある!オプション 'softtabstop' も参照。 > + + :auto BufReadPost *.xx retab! 4 + :auto BufWritePre *.xx retab! 8 + :auto BufWritePost *.xx retab! 4 + :auto BufNewFile *.xx set ts=4 + +============================================================================== +5. テキストのコピーと移動 *copy-move* + + *quote* +"{a-zA-Z0-9.%#:-"} 続く操作 (削除、コピー、貼り付け) にレジスタ + {a-zA-Z0-9.%#:-"} を使う (削除、コピーでは大文字を使う + ことでレジスタに追記できる) + ({.%#:} は貼り付けにのみ使用可能)。 + + *:reg* *:registers* +:reg[isters] 全ての名前付きレジスタおよび番号付きレジスタの内容を表 + 示する。レジスタが |:redir| の書き込み先になっている場 + 合はそのレジスタは表示されない。 + {Vi にはない} + +:reg[isters] {arg} {arg} に指定された名前付きレジスタおよび番号付きレジス + タを表示する。例: > + :reg 1a +< レジスタ '1' と 'a' が表示される。{arg} の中では空白を + 用いてよい。 {Vi にはない} + + *:di* *:display* +:di[splay] [arg] :registers と同じ。 {Vi にはない} + + *y* *yank* +["x]y{motion} {motion} のテキストを [レジスタ x に] コピーする。 + コピーされるテキストがないとき (例えば 1 桁目で "y0" + を行う)、オプション 'cpoptions' がフラグ 'E' を含んで + いるならエラーになる。 + + *yy* +["x]yy [count] 行を [レジスタ x に] コピーする (行単位 + |linewise|)。 + + *Y* +["x]Y [count] 行を [レジスタ x に] コピーする ("yy" と同義、 + 行単位|linewise|)。"Y" でカーソル位置から行の終わりま + でコピーしたいときは (この方が論理的と言えるが、Vi互換 + ではない) ":map Y y$" を使う。 + + *v_y* +{Visual}["x]y ビジュアル選択されたテキストを [レジスタ x に] コピー + する + ({Visual} については |Visual-mode| を参照)。 + {Vi にはない} + + *v_Y* +{Visual}["x]Y ビジュアル選択された行を [レジスタ x に] コピーする + ({Visual} については |Visual-mode| を参照)。 + {Vi にはない} + + *:y* *:yank* *E850* +:[range]y[ank] [x] [range] の行を [レジスタ x に] コピーする。"* レジスタ + と "+ レジスタへのコピーは |+clipboard| 機能が有効な場 + 合のみ可能。 + +:[range]y[ank] [x] {count} + [range] の最後の行 (省略時は現在行 |cmdline-ranges|) + から数えて {count} 行を [レジスタ x に] コピーする。 + + *p* *put* *E353* +["x]p カーソルの後に、テキストを [count]回 [レジスタ x から] + 貼り付ける。 {Vi: カウントはない} + + *P* +["x]P カーソルの前に、テキストを [count]回 [レジスタ x から] + 貼り付ける。 {Vi: カウントはない} + + ** +["x] カーソルの前に、テキストを [count]回 [レジスタ x から] + 貼り付ける。レジスタ指定がない場合は "* が使われる。 + カーソルは挿入したテキストの末尾に置かれる。 + マウスは 'mouse' が 'n' か 'a' を含むときのみ使える。 + {Vi にはない} + もしあなたがスクロールホイールを持っていて意図せずにテ + キストを貼り付けてしまうのなら、次のマッピングでマウス + の真ん中のボタンを無効化できる。 > + :map + :imap +< 複数クリックも無効にしたいなら |double-click| も参照のこ + と。 + + *gp* +["x]gp "p" と似ているが、カーソルは挿入したテキストの直後に置 + かれる。 {Vi にはない} + + *gP* +["x]gP "P" と似ているが、カーソルは挿入したテキストの直後に置 + かれる。 {Vi にはない} + + *:pu* *:put* +:[line]pu[t] [x] [line] 行目 (省略時は現在行) の後にテキストを [レジス + タ x から] コピーする。このコマンドは常に行単位 + |linewise| の動作をするので、コピーされたブロックを新 + しい行として挿入するときに使える。 + レジスタが指定されていないときのレジスタは 'cb' オプ + ションに依存する。'cb' が "unnamedplus" を含むときは + + レジスタ |quoteplus| からペーストする。そうではなく、 + 'cb' が "unnamed" を含むときは * レジスタ |quotestar| + からペーストする。そうでなければ、無名レジスタ + |quote_quote| からペーストする。 + レジスタには '=' に続けて式を指定することもできる。コ + マンドの末尾までが式として評価される。文字 '|' と '"' + がコマンドの末尾として解釈されないようにするには、それ + らをエスケープする {訳注: 前に '\' を置く} 必要がある。 + 例: > + :put ='path' . \",/test\" +< '=' の後に式がないときは前回の式が使われる。それはコマ + ンド ":dis =" で見ることができる。 + +:[line]pu[t]! [x] [line] 行目 (省略時は現在行) の前にテキストを [レジス + タ x から] コピーする。 + +["x]]p または *]p* *]* +["x]] "p" と似ているが、現在行に合わせてインデントが調整され + る。マウスは、'mouse' が 'n' か 'a' を含むときだけ使え + る。 {Vi にはない} + +["x][P または *[P* +["x]]P または *]P* +["x][p または *[p* *[* +["x][ "P" と似ているが、現在行に合わせてインデントが調整され + る。マウスは、'mouse' が 'n' か 'a' を含むときだけ使え + る。 {Vi にはない} + +これらのコマンドを使って、ある場所から別の場所へテキストをコピーできる。まずコ +ピー、削除または変更コマンドを使って、テキストをレジスタに蓄える。そしてレジス +タの内容を、貼り付けコマンドで文章中に挿入する。これらのコマンドで、あるファイ +ルから別のファイルへテキストを移動させることもできる。Vim はバッファを切り替え +ても、全てのレジスタの内容を保っているからである (コマンド CTRL-^ は、2個のバッ +ファを素早く切り替えられる)。 + + *linewise-register* *characterwise-register* +貼り付けコマンド (":put" 以外) は、"." で繰り返したり、アンドゥできる。テキス +トをレジスタに蓄えるのに使われたコマンドが行単位|linewise|のものだったら、テキ +ストはカーソルのある行の次の行 ("p" のとき) や前の行 ("P" のとき) に貼り付けら +れる。そうでなければ、テキストはカーソルの後 ("p" のとき) や前 ("P" のとき) に +挿入される。コマンド ":put" を使ったときは、テキストは常に次の行へ挿入される。 +"xp" というコマンド列で、カーソル上の文字と次の文字との入れ替えができる。現在 +行と次の行との入れ替えには、コマンド列 "ddp" を使う。(カーソルが単語の前の空白 +の上にあるとき) 次の単語とその次の単語との入れ替えには、コマンド列 "deep" を使 +う。貼り付けコマンドを使った後には、コマンド "']" か "`]" で挿入された行の終わ +りに移動でき、コマンド "'[" か "`[" で挿入された行の最初に移動できる。 + + *put-Visual-mode* *v_p* *v_P* +ビジュアルモードで |p| や |P| 等の貼り付けコマンドを使ったとき、Vimは選択され +たテキストをレジスタの中身で置き換えようとする。これがうまく動作するかどうか +は、選択領域の種類とレジスタ内のテキストの種類による。矩形選択では、ブロックの +サイズと、選択領域の角が既存の文字上にあるかどうかにもよる。(実装上の詳細:実際 +の動作は、まずレジスタの中身を選択領域の後に貼り付け、その後で選択領域を削除す +るようになっている) +それまで選択されていたテキストが無名レジスタに保存される。同じテキストを複数の +ビジュアル選択領域にプットしたい場合は、ほかのレジスタを使う必要がある。例え +ば、コピーしたいテキストをヤンクして、選択したテキストを "0p で置き換える。こ +れを好きなだけ繰り返す。このとき、無名レジスタはプットするたびに変わる。 + +矩形ビジュアルモードで一行のみをヤンクしたとき、それをビジュアル選択した範囲に +貼り付けると、選択範囲にその一行が貼り付けされる (つまり貼り付けた行のブロック +によって矩形選択範囲が置換される)。 + + *blockwise-register* +矩形ビジュアルモードで、レジスタにテキストを蓄えるコマンドを使うと、テキストの +ブロックはカーソルの前 ("P" のとき) または後 ("p" のとき) から、現在行と引き続 +く行にわたって、挿入される。テキストのブロック全体は同じ列から始まるように挿入 +される。そのため挿入されたテキストはコピーや削除されたときと同じ形を保っている。 +Vimは、このようにするために を空白で置き換えることがある。しかし、テキ +ストのブロックの幅が の幅の整数倍でなく、さらに挿入されたブロックの後の +テキストが を含むとき、列揃えがおかしくなることがある。 + +Note 文字単位のコピーコマンドの後、コピーされたテキストの中でバッファの先頭に +一番近い文字の上にカーソルが置かれることに注意。つまり "yl" ではカーソルは動か +ないが、"yh" ではカーソルは1文字左に動く。 +理論的説明: Viでは、後方移動を伴ったコマンド "y" ではコピーされたテキスト + の先頭にカーソルを移動させないことがあった。これは再表示が省か + れたためである。Vimでは Posix に定められた通り、常に先頭の文字 + にカーソルを移動させる。 +行単位のコピーコマンドではカーソルは選択の最初の行に置かれるが、カラムは変更さ +れない。なのでその位置はコピーされた最初の文字の上ではないかもしれない。 + +レジスタには 10 種類ある: *registers* *E354* +1. 無名レジスタ "" +2. 10個の番号付きレジスタ "0 から "9 +3. 小削除用レジスタ "- +4. 26個の名前付きレジスタ "a から "z または "A から "Z +5. 3個の読み取り専用レジスタ ": と ". と "% +6. 代替バッファ用レジスタ "# +7. expression 用レジスタ "= +8. 選択領域用レジスタ "* と "+ と "~ +9. 消去専用レジスタ "_ +10. 最終検索パターン用レジスタ "/ + +1. 無名レジスタ "" *quote_quote* *quotequote* +このレジスタには、コマンド "d", "c", "s", "x" 等で削除されたテキストや、"y" 等 +のコピーコマンドでコピーされたテキストが蓄えられる。特定のレジスタが指定されて +いてもいなくても関係ない (例えば "xdd でもこれが使われる)。つまり無名レジスタ +は最後に使われたレジスタを指していると考えられる。よって、大文字レジスタを使っ +て名前つきレジスタにテキストを追加したときも、無名レジスタの中身は、その名前つ +きレジスタと同じになる。 +例外はレジスタ '_' である。"_dd は、削除されたテキストをどのレジスタにも蓄え +ない。 +無名レジスタの中身は、レジスタを指定しない貼り付けコマンド (p や P) で使うこと +ができる。加えて、このレジスタは '"' という名前で使うことができる。これは、使 +うときには二重引用符 '"' を 2 個打ち込むということである。レジスタ "" に対する +書き込みはレジスタ "0 にも書き込むことになる。 +{Vi ではレジスタの内容はファイルを変更するときに失われ、'"' もない} + +2. 番号付きレジスタ "0 から "9 *quote_number* *quote0* *quote1* + *quote2* *quote3* *quote4* *quote9* +これらのレジスタには、コピーや削除コマンドによってテキストが蓄えられる。 +番号付きレジスタの 0 には、一番最近にコピーしたテキストが蓄えられるが、コピー +の際に ["x] として別のレジスタ名を指定したときは、これには蓄えられない。 +番号付きレジスタ 1 には、一番最近に削除したり変更したテキストが蓄えられるが、 +コマンドに別のレジスタ名を指定したり、削除や変更したテキストが1行以下だったり +したときは、これには蓄えられない (そのときは小削除用レジスタが使われる)。例外 +は、以下の移動コマンドと削除コマンドを組み合わせたときである。|%|, |(|, |)|, +|`|, |/|, |?|, |n|, |N|, |{|, |}|。このときは必ずレジスタ "1 が使われる (これ +はVi互換の動作である)。削除や変更したテキストが1行以下だったときは、レジスタ +"- も使われる。 Note: これらの文字はマップ可能である。例: |%| は matchit プラ +グインによってマップされている。 +削除や変更が行われるたびに、レジスタ 1 の内容はレジスタ 2 に、レジスタ 2 の内 +容はレジスタ 3 に、という風にずれていく。レジスタ 9 の内容は失われる。 +{Vi では番号付きレジスタの内容はファイルを変更する際に失われる。レジスタ 0 は +ない} + +3. 小削除用レジスタ "- *quote_-* *quote-* +このレジスタには、範囲が1行以下の削除コマンドで削除されたテキストが蓄えられる。 +ただし、コマンドに ["x] で別のレジスタ名を指定したときはこれには蓄えられない。 +{Vi にはない} + +4. 名前付きレジスタ "a から "z または "A から "Z *quote_alpha* *quotea* +これらのレジスタが使われるのは、ユーザーに指定されたときのみである。コピーや削 +除の際にこれらのレジスタを小文字で指定すると、コピーや削除されたテキストが蓄え +られ、元から入っていたテキストは消える。大文字で指定すると、元から入っていた内 +容の後ろに新しいテキストを付け加える。'cpoptions' にフラグ '>' が入っていると、 +新しいテキストの前に改行が挿入される。 + +5. 読みとり専用レジスタ ": と ". と "% +読みとり専用レジスタには '%' と '#' と ':' と '.' がある。コマンド "p", "P", +":put" および CTRL-R でのみ使うことができる。 {Vi にはない} + *quote_.* *quote.* *E29* + ". 最後に挿入されたテキストが蓄えられる (挿入モードのコマンド + CTRL-A や CTRL-@ で挿入されるものと同じテキストである)。 Note: + これはコマンドライン上での CTRL-R では使えないことに注意。動作 + が少し異なり、テキストを貼り付けるというより挿入するような動作 + をする (挿入されるテキストに 'textwidth' 等のオプションが影響 + する)。 + *quote_%* *quote%* + "% カレントファイルの名前が蓄えられる。 + *quote_:* *quote:* *E30* + ": 一番最近に実行されたコマンドラインの内容が蓄えられる。例: 前回 + のコマンドラインによるコマンドを実行するには、"@:" が使える。 + コマンドラインがこのレジスタに蓄えられるのは、コマンドライン内 + にコマンドが最低でも1文字打ち込まれたときである。そのため、コ + マンドが完全にキーマッピングから実行されたときには、この内容に + 変化はない。 + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + + *quote_#* *quote#* +6. 代替ファイルレジスタ "# +カレントウィンドウの代替ファイルの名前を含む。これは |CTRL-^| コマンドがどのよ +うに働くかを変更する。 +このレジスタは書き込み可能で、主にプラグインがこのレジスタを変更した後で元に戻 +すためである。バッファ番号を許容する: > + let altbuf = bufnr(@#) + ... + let @# = altbuf +バッファ番号が越えるあるいはそのバッファが存在しない場合はエラー |E86| を返す。 +また存在するバッファ名でのマッチングを許容する: > + let @# = 'buffer_name' +与えられた名前にマッチしたバッファが1つより多い場合はエラー |E93| を、与えられ +た名前にマッチするバッファがない場合は |E94| を返す。 + +7. Expression レジスタ "= *quote_=* *quote=* *@=* +これは、本当はテキストを蓄えるレジスタではないが、レジスタを使うコマンドで式を +評価するために使える。この expression レジスタは読み取り/書き込み可能である。 + +" または CTRL-R の後に '=' を打ち込むと、カーソルはコマンド行に移動し、あらゆ +る式を入力することができる (|expression| を参照)。コマンドラインから入力できる +普通の編集用コマンドは、式用の特別履歴も含め、全て使用可能である。 を打ち +込んでコマンドライン入力を終了させると、式の結果が計算される。を打ち込ん +で終了させると、式は破棄される。式が入力されないときは、(コマンド "/" と同様) +前回の式が使われる。 + +式を評価した結果は文字列でなければならない。評価した結果が数値なら、文字列に変 +換される。"p" と ":put" コマンドの場合、結果が浮動小数点数なら文字列に変換され +る。リストの場合、各要素が文字列に変換され、それぞれが 1 行として挿入される。 +辞書または FuncRef はエラーメッセージが出る(string()を使って変換する)。 + +レジスタ "= が "p" で使われると、文字列は 文字 {訳注: New Line -- 改行} +の所で分割される。文字列が で終わっていたら、これは行単位のレジスタと見な +される。 {Vi にはない} + +8. 選択範囲レジスタ "* と "+ と "~ +これらのレジスタは、GUIで、選択されたテキストを蓄えたり取り出すために使われる。 +|quotestar| と |quoteplus| を参照。クリップボードが利用できないときは、無名レ +ジスタが代わりに使われる。Unixでは|+xterm_clipboard|が有効になっているときだけ +クリップボードを利用できる。{Vi にはない} + +Note "* と "+ に区別があるのは X11 システムのみであることに注意。違いについて +は |x11-selection| を参照。MS-Windowsでは "* と "+ は実際には同義で、クリップ +ボード |gui-clipboard| を使用する。 + + *quote_~* *quote~* ** +この読み込み専用の "~ レジスタは最後にドラッグアンドドロップされたテキストを提 +供する。何かがVimにドロップされたとき、"~ レジスタがそれで埋められ、仮想 +キーが通知される。このキーをリマップして使うことができる。デフォルトでは(全て +のモードにおいて) "~ レジスタの内容をカーソルの位置に挿入する。 +{Vi にはない} +{|+dnd|付きでコンパイルされたときのみ有効。現在はGTK GUIでのみ使える。} + +Note: "~ レジスタはプレーンテキストをVimにドロップしたときのみ使われる。URIの +リストは内部で扱われる。 + +9. 消去専用レジスタ "_ *quote_* +このレジスタを指定してテキストを削除しても、{訳注: レジスタには} 何も起こらな +い。そのため、普通のレジスタに影響を与えずに削除が行える。このレジスタから貼り +付けようとしても、何も出てこない。 {Vi にはない} + +10. 最終検索パターン用レジスタ "/ *quote_/* *quote/* +最後に使われた検索パターンが蓄えられる。これはコマンド "n" やオプション +'hlsearch' による強調表示に使われる。 +このレジスタは `:let` で変更できるので、'hlsearch' による強調表示を、実際に検 +索を行わずに別のマッチに適用することができる。このレジスタを使ってコピーしたり +削除することはできない。 +Note 関数から抜けると、この値は関数に入る前の値に復元される。 +|function-search-undo| +{Vi にはない} + + *@/* +レジスタには、コマンド `:let` で書き込むことができる |:let-@|。例: > + :let @/ = "the" + +レジスタを指定せずに貼り付けコマンドを使うと、最後に書き込みが行われたレジスタ +が使われる (その内容は無名レジスタと同じである)。混乱したときは、コマンド +`:dis` を使うとレジスタの内容が分かる (このコマンドは、全てのレジスタの内容を +表示する。無名レジスタは '"' と示される)。 + +以下の3個のコマンドは、必ず行全体に対して働く。 + +:[range]co[py] {address} *:co* *:copy* + [range] 行を、{address} 行目の下にコピーする。 + + *:t* +:t ":copy" と同義。 + +:[range]m[ove] {address} *:m* *:mo* *:move* *E134* + [range] 行を、{address} 行目の下に移動する。 + +============================================================================== +6. テキストの整形 *formatting* + +:[range]ce[nter] [width] *:ce* *:center* + [range] の行を、幅 [width] (既定値は 'textwidth'、 + 'textwidth' が 0 のときは 80) に基づいて中央揃えする。 + {Vi にはない} + +:[range]ri[ght] [width] *:ri* *:right* + [range] の行を、幅 [width] (既定値は 'textwidth'、 + 'textwidth' が 0 のときは 80) に基づいて右揃えする。 + {Vi にはない} + + *:le* *:left* +:[range]le[ft] [indent] + [range] の行を左揃えする。行中のインデントを [indent] + (既定値 0) に設定する。 {Vi にはない} + + *gq* +gq{motion} {motion} の行を整形する。整形は3種類の方法のうちどれか + で行われる。 + 1. 'formatexpr' が空でなければそのexpressionが評価さ + れる。これはバッファごとに異なってもよい。 + 2. 'formatprg' が空でなければ外部プログラムが使われる。 + 3. それ以外の場合は内部整形ルーチンが使われる。 + + 3番目の場合は、オプション 'textwidth' が整形された各行 + の長さを制御する (後述)。'textwidth' が 0 なら、整形さ + れた行の長さは画面の幅となる (ただし、最大で79)。 + 'formatoptions' は、整形の仕方を制御する |fo-table|。 + カーソルは最後に整形された行の最初の非空白文字の上に置 + かれる。 + NOTE: 以前はコマンド "Q" でこの機能を行っていた。やは + り整形に "Q" を使いたいならば、次のマッピングを使うこ + と。 > + :nnoremap Q gq + +gqgq *gqgq* *gqq* +gqq 現在行を整形する。カウントを指定するとその行数だけ整形 + される。 {Vi にはない} + + *v_gq* +{Visual}gq ビジュアル選択されたテキストを整形する。({Visual}につ + いては|Visual-mode| を参照)。 {Vi にはない} + + *gw* +gw{motion} {motion}で動いた範囲の行を整形する。|gq|に似ているが + カーソルは元の位置に戻る。'formatprg' と 'formatexpr' + は使われない。{Vi にはない} + +gwgw *gwgw* *gww* +gww "gw" と同様にして現在行を整形する。 {Vi にはない} + + *v_gw* +{Visual}gw 選択されたテキストを "gw" と同様にして整形する。 + ({Visual}については|Visual-mode|を参照). {Vi にはない} + +例: 現在の段落を整形するには、次のようにする。 *gqap* > + gqap + +コマンド "gq" は、移動コマンドによってカーソルが動くはずの位置にカーソルを移動 +させる。このため、"." で整形を繰り返すことができる。これは、"gqj" (現在行と次 +行を整形) と、"gq}" (段落の最後までを整形) で有用である。 NOTE: 'formatprg' が +設定されているときは、"gq" を実行すると (フィルタコマンド使用時と同様に) カー +ソルは整形された最初の行に移動する。 + +カーソルのある位置の段落をフォーマットし、その位置からさらに編集を再開するには +こうする。 > + gwap +いつも段落をフォーマットしておきたいなら 'formatoptions' に 'a' フラグを追加す +ればよい。|auto-format| も参照のこと。 + +オプション 'autoindent' がオンのとき、Vimは最初の行のインデントを続く行に対し +て適用する。 + +テキストの整形処理は空の行には変更を加えない (しかし、空白のみで構成された行に +は変更を行う!)。 + +オプション 'joinspaces' は、行が連結されるときに使われる。 + +オプション 'formatexpr' でテキストの整形に使うexpressionを設定したり、 +'formatprg' で外部プログラムの名前を設定することができる。 +外部プログラムによる整形処理には、'textwidth' や他のオプションは何の影響も与え +ない。 + + *right-justify* +テキストを右揃えするコマンドは、Vimには存在しない。"par" 等の外部コマンド (例: +"!}par" で段落の最後までを整形する) を実行したり、'formatprg' に "par" を指定 +することで、これを行うことができる。 + + *format-comments* +コメント整形の概要がユーザーマニュアルの |30.6| にある。 + +Vimは特殊な方法で自動的にコメントを挿入・整形できる。Vimは行の最初の特定の文字 +列 (空白を無視する) によって、コメントを認識できる。コメントには3種類が使える。 + +- 各行の最初で繰り返されるコメント文字列。例えば、"#" で始まるシェルスクリプト + のコメントなど。 +- 最初の行にのみ現れ、続きの行には現れないコメント文字列。例えば、このリストに + おけるダッシュ '-'。 +- 最初の文字列、最後の文字列、そしてその間の行の3つの部分から成るコメント。開 + 始部分、中間部分、終了部分に使われる文字列は異なる。例えば、C言語形式のコメ + ント。 > + /* + * これは C のコメント + */ + +オプション 'comments' は要素のコンマ区切りのリストである。各要素はコメント文字 +列の種類を定義している。要素は次のように構成される。 + {flags}:{string} + +{string} は普通のテキストで、これがなければならない。 + +{flags}: + n 入れ子になったコメント。混在した要素の入れ子も有効である。'comments' + が "n:),n:>" であれば、"> ) >" で始まる行はコメント。 + + b {string} の後に余白 ( または ) が必要。 + + f 最初の行のみがコメント文字列を持つ。次の行にはコメントを繰り返さない + が、インデントは保持する(例、bullet-list)。 + + s 3部コメントの開始部分。 + + m 3部コメントの中間部分。 + + e 3部コメントの終了部分。 + + l 左揃え。's' か 'e' と共に指定された場合、それぞれ最初または最後の部分 + の一番左の文字が、真ん中の一番左の文字に対して揃えられる。この動作は + デフォルトであるが、省略もできる。詳しくは後述。 + + r 右揃え。一番左でなく一番右であること以外、l と同じ。詳しくは後述。 + + O コマンド "O" ではこのコメントを考慮しない。 + + x 3部コメントで、中間部分のコメントがすでに自動で挿入されているとき、新 + しい行の最初のアクションとして、終了部分のコメント文字列の最後の文字 + を打ち込むだけで、コメントを終了させる。詳細は以下を参照。 + + {digits} + 's' か 'e' と共に指定された場合: 自動的に挿入された、中間または最後 + のコメントの最初の部分に対し、{digits} 分のオフセットを加える。この + オフセットは左端を基準とする。詳しくは後述。 + + -{digits} + {digits} に似ているが、インデントを減らす。開始部分と終了部分に減らす + べきインデントが存在しているときのみ機能する。 + +コメント文字列にフラグ 'f', 's', 'm', 'e' のいずれも指定しないとき、Vimはコメ +ント文字列を行の最初に繰り返すと仮定する。フラグ欄は空になる。 + +{string} の前や後にある余白は、{string} の一部とされる。コメント文字列に必要で +ない限り、余白を前や後に付けないこと。 + +あるコメント開始文字列が他のコメントの一部であるときは、共通部分の後で特定の部 +分を指定すること。例えば、"-" と "->" の両方を含みたいときは、次のようにする。 > + :set comments=f:->,f:- + +3部コメントには常に開始部分、中間部分、終了部分を指定しなければならない。そし +て、他の要素を間に入れてはならない。C言語での3部コメントの例は次の通り。 > + sr:/*,mb:*,ex:*/ +"*ptr" がコメントとして認識されないように、中間部分の文字列がフラグ 'b' を含ん +でいる。3部コメントでは、Vimは開始部分と中間部分の文字列の後のテキスト内に、最 +後の文字列が含まれていないかを調べる。終了部分の文字列が見つかると、コメントは +次の行には続かない。3部コメントには、Vimが中間の行を認識できるようにするため +に、中間部分の文字列を指定しなければならない。 + +上記の3部コメントの定義における、フラグ "x" の使用について注意しておく。Cコメ +ントでリターンを打てば、Vimは新しい行に対して " * " のようなコメントの中間部分 +の開始文字列を挿入する。このコメントを閉じるには、新しい行において何も打ち込む +前に "/" と打ち込めばよい。これは中間のコメント指示を最後のコメント指示に置き +換え、" */" とする。指定された桁揃えは適用される。その前にバックスペースを打ち +込む必要はない。 + +中間部分がマッチしたとき、終了部分もマッチしていてそちらの方が長い場合は、終了 +部分が使われる。これによって C スタイルコメントが中間部分の末尾にスペースを付 +けなくても機能するようになる。 + +桁揃えフラグを使ってコメントを目立たせる例を示す。'comments' が次のようになっ +ている場合: > + :set comments=sr:/***,m:**,ex-2:******/ +< + /*** ~ + **<--"r" フラグによって右揃えされている ~ + ** ~ + "-2" フラグによってスペース ** ~ + 2 個分のオフセットがついている --->** ~ + ******/ ~ +これを入力する際、コメントの開始行を入力し、リターンを 4 回押す。そして "/" を +押せばコメントが終了する。 + +3部コメントについて、より細かいことをいくつか説明する。桁揃えフラグとオフセッ +トフラグが考慮される箇所は、次の3箇所ある。コメント開始行のあとの新規行を開く +とき、コメント終了行の前の新規行を開くとき、自動的にコメントを終了させるときで +ある。終了部分の桁揃えフラグは、上の行を参照する。これによって、"s" と "e" に +同じ桁揃えフラグを指定したとき、開始部分と終了部分のインデント量が同じになる。 +コメントの部分ごとに1個だけの桁揃えが使われるようになっている。しかし、オフセッ +トの数は "r" と "l" フラグより優先する。 + +'cindent' をオンにしていると、多くの場合、桁揃えフラグより優先される。 +|gq| や |=| を使って再インデントするときも、桁揃えフラグは適用されない。同じ挙 +動を定義するには、それらのコマンドのオプションを使う。一つの考えとしては、 +'cindent' に文脈に応じてコメントをインデントさせるオプションを追加することで +あるが、3部コメントの桁揃えを模倣することはほとんどできない。しかし +'indentexpr' は3部コメントをもっとうまく扱える可能性を持つ。 + +他の例: > + "b:*" "*" の後に非ブランク文字が付いていなければ、"*" で始まる行を + 含む。これはポインタの値への参照 "*str" が、コメントとして認識 + されるのを防ぐ。 + "n:>" ">", ">>", ">>>" などで始まる行を含む。 + "fb:-" "- " で始まるリストを整形する。 + +既定では "b:#" が含まれている。これは "#include" で始まる行がコメントとならな +いことを意味する。しかし、"# define" で始まる行はコメントとなる。これは妥協的 +解決である。 + +{Vimが |+comments| 機能付きでコンパイルされたときのみ有効} + + *fo-table* +テキストの整形方法はオプション 'formatoptions' で調整できる。 'formatoptions' +は以下のフラグを含む文字列である。既定値は "tcq" である。読みやすくするために、 +フラグをコンマで区切ってもよい。 + +フラグ 'formatoptions' に指定されたときの作用 ~ + +t 'textwidth' を使ってテキストを自動折返しする +c 'textwidth' を使ってコメントを自動折返して、現在のコメント開始文字列を + 自動挿入する。 +r 挿入モードで を打ち込んだ後に、現在のコメント開始文字列を自動 + 挿入する。 +o ノーマルモードで 'o', 'O' を打ち込んだ後に、現在のコメント開始文字列を + 自動的に挿入する。 +q "gq" でコメントを整形する。 + NOTE 整形は空行やコメント開始文字列のみの行は変更しないことに注意。新 + しい段落はそのような行の次、またはコメント開始文字列が変わった所から始 + まる。 +w 行末に空白が付いているとき、段落が次行に続いていると認識する。行末が空 + 白以外の行で段落が終わるとする。 +a 段落を自動整形する。テキストが挿入されたり削除されるたび、段落は再整形 + される。|auto-format| を参照。 + 'c' フラグも設定されているときはコメント挿入時のみ機能する。 +n テキストの整形時、番号付きリストを認識する。これは実際には + 'formatlistpat' を使う。それゆえ、どんな種類のリストでも処理できる。 + 数字の後のテキストのインデントが次の行に使われる。数字の後に '.', ':', + ')', ']' や '}' が付いてもよい。オプション 'autoindent' がオンでなけれ + ばならないことに注意。"2" と一緒には機能しない。例: > + 1. 一つ目の項目 + 折り返し + 2. 二つ目の項目 +2 テキストを整形するとき、段落の最初の行ではなく2番目の行のインデントを + 使ってそれ以降の行を整形する。これは最初の行のインデントが他の行と異な + るような段落をサポートする。'autoindent' もオンである必要がある。例: > + ここはある段落の一行目 + ここは上の行と同じ段落の二行目 + ここは三行目。 +< これはコメントの中でも機能します (コメント文字がないかのように)。 +v 挿入モードでVi互換の自動折返しを使う: 挿入モードに入って以来入力された + 空白でのみ折返しが行われる。( NOTE: これは100%のVi互換ではない。Viには + このあたりに「予期できない機能」、というかバグがあった。Viは実際のテキ + ストの列の代わりに画面上の列を使用する。) +b 'v' と同様だが、折返し余白の中または前で、空白を入力したときのみ自動折 + 返しをする。挿入開始時に 'textwidth' より行が長かったり、'textwidth' + に達するまで空白を入力しなかったときは、Vimは自動折返しをしない。 +l 挿入モードでは長い行は折り返されない: 挿入開始時に行が 'textwidth' よ + り長い場合、Vimは自動で整形を行わない。 +m 文字コードが 255 より後のマルチバイト文字の間でも改行する。これは文字 + 全てがそれだけで単語であるような、アジア言語のテキストで便利である。 +M 行の連結時に、マルチバイト文字の前後に空白を挿入しない。こちらの方がフ + ラグ 'B' より優先する。 +B 行の連結時に、マルチバイト文字同士の間に空白を挿入しない。こちらよりフ + ラグ 'M' の方が優先する。 +1 1文字の単語の後では改行しない。代わりにその前で改行される (可能ならば)。 +j 可能ならば、行を連結する際にコメントリーダーを削除する。例えば、以下の + 行を連結する場合: + int i; // the index ~ + // in the list ~ + 以下のようになる: + int i; // the index in the list ~ + + +'t' と 'c' でVimが自動折返しを行うタイミングを指定できる。 +フラグ 作用 ~ +"" 自動整形しない ("gq" で手動の整形処理を行う) +"t" テキストを自動整形するが、コメントにはしない +"c" コメントを自動整形するが、テキストにはしない (C言語コードに適している) +"tc" テキストとコメントを自動整形する + +NOTE 'textwidth' が 0 のとき、Vimはいかなる自動整形も行わないので注意 +('comments' によるコメント開始文字列の挿入はする)。例外はフラグ 'a' が入ってい +る場合である。|auto-format| + +NOTE 'paste' がオンのとき、Vimは全ての整形処理を行わないので注意。 + +NOTE Vimに自動折返しをさせなくても、'textwidth' は非 0 であってよいことに注意。 +'textwidth' は "gq" による整形処理でも便利だからである。 + +'comments' が "/*" と ("*" と) "*/" を含んでいるときは、Vim組み込みの機能によ +りこれらのタイプのコメントをもう少し巧く扱うことができる。 +('formatoptions' に 'r' か 'o' が含まれているとき) "/*" または "*/" の前か後で +新しい行を始めると、行の正しい開始位置が自動的に与えられる。同じことが整形処理 +と自動折返しでも行われる。"/*" や "*" で始まり、かつ "*/" を含む行の後で行を始 +めるときは、コメント開始文字列が挿入されず、新しい行のインデントはコメントの最 +初の行に合わせられる。 +例: + /* ~ + * 典型的なコメント。 ~ + */ ~ + この行のインデントは、上のコメントの先頭行と同じになる。 + +これら全ては、特に異なるファイルタイプに対する異なる設定に対応する際、新しい +autocommand と連携して、クールに振舞うはずである。 + +いくつかの例: + C言語コード用 (コメントの整形のみ): > + :set fo=croq +< メール/ネットニューズ用 (全て整形、コマンド "o" でコメントを始めない): > + :set fo=tcrq +< + +自動整形 *auto-format* *autoformat* + +オプション 'formatoptions' にフラグ 'a' が含まれると、テキストを挿入したり削除 +したときに自動整形が行われる。これはテキストの段落分けを編集するときに便利であ +る。以下では使い方についてのヒントをいくつか。 + +- 段落を適切に定義する必要がある。もっとも単純なものは、空行が区切りになる場合 + である。区切りとなる空行がないときは、フラグ 'w' を使い、段落の最終行以外の + 行末に空白を付けるようにしてみること。 + +- 'formatoptions' をファイルタイプ |filetype| に基づいて設定することができる。 + またはモードライン |modeline| で特定のファイルに対して設定することもできる。 + +- 'formatoptions' を "aw2tcq" に設定し、テキストのインデントを次のようにするこ + ともできる。 + + bla bla foobar bla + bla foobar bla foobar bla + bla bla foobar bla + bla foobar bla bla foobar + +- コメントだけを自動整形するには 'c' フラグを追加する。ソースコードの編集向き。 + +- 行の長さを望みどおりにするには 'textwidth' を設定する。これが0ならば79になる。 + 画面の幅が79桁より小さい場合は画面幅になる。 + +次にいくつかの警告: + +- テキストの部分部分が段落内で適切に分割されていないとき、そのテキスト内で変更 + を行うと、有無をいわさず整形が始まってしまう。次のようにしてみること。 > + + :set fo-=a + +- フラグ 'w' (行末の空白で段落が終わっていないことを判断する) を使っているとき + に |dd| で段落の最終行を削除すると、その段落が次の段落とつながってしまう。 + +- 変更されたテキストは、アンドゥのために記憶される。整形も変更の一種である。そ + のため、整形を行う度にテキストがアンドゥ用に記憶される。すると大量のメモリを + 消費するかもしれない。 + +- 長い段落や、複雑なインデントの段落を整形するのには、時間がかかることがある。 + +============================================================================== +7. テキストのソート *sorting* + +Vimはソート関数とソートコマンドを備えている。ソート関数については |sort()|、 +|uniq()| を参照。 + + *:sor* *:sort* +:[range]sor[t][!] [b][f][i][n][o][r][u][x] [/{pattern}/] + [range]の行をソートする。範囲が指定されない場合は全行 + をソートする。 + + [!]をつけると順序が逆になる。 + + [i]をつけると大文字・小文字を区別しない。 + + [n][f][x][o][b] オプションはどれかひとつのみ指定できる。 + + [n]をつけると行の({pattern}のマッチの後ろまたは内側 + の)最初の10進数の数字でソートする。 + 数字が '-' で始まる場合、マイナスとみなされる。 + + [f] をつけると行の小数点数でソートする。 + 小数点数の値は ({pattern} によるマッチの後ろまたは内側 + の) テキストを str2float() に渡すようにして決定される。 + このオプションは Vim が小数点数サポートを有効にしてコ + ンパイルされたときのみ使える。 + + [x]をつけると行の({pattern}のマッチの後ろまたは内側の) + 最初の16進数の数字でソートする。"0x" と "0X" は無視さ + れる。 + 数字が '-' で始まる場合、マイナスとみなされる。 + + [o]をつけると行の({pattern}のマッチの後ろまたは内側の) + 最初の8進数の数字でソートする。 + + [b] をつけると({pattern}によるマッチの後ろまたは内側の) + 行の最初の2進数でソートする。 + + [u]をつけると (u は unique=「一意の」という意味に基づ + く) 連続する同一行の最初の行だけを残す。([i]がつくと大 + 文字・小文字を無視する) このフラグがつかない場合、連続 + する同一行はそのままの順序で残される。 + Note: 先頭と末尾の空白が原因で異なる行にみなされるかも + しれない。 + + /pattern/が指定され、フラグ[r]がない場合は{pattern}に + マッチするテキストはスキップされる。これによって、その + マッチの後に来るテキストでソートできる。 + スラッシュの代わりにどんなnon-letterでも使うことができ + る。 + 例えば、コンマで区切られた2番目のフィールドでソートす + るには: > + :sort /[^,]*,/ +< 画面上の10桁目でソートするには(そのためタブとスペース + は同一視される): > + :sort /.*\%10v/ +< 行中の最初の数字でソートするには: > + :sort /.\{-}\ze\d/ +< (解説: ".\{-}" は任意のテキストにマッチする。"\ze" + はそのマッチの終わりをセットし、"\d" は数字にマッチ + する。) + [r]がつくと、前述のように{pattern}をスキップするのでな + く、{pattern}にマッチする部分でソートする。 + 例えば、各行の最初の3文字だけでソートするには: > + :sort /\a\a\a/ r + +< {pattern}が使われると{pattern}を含まない行は現在の順序 + のままになる。逆順でソートすると、それらはソートされた + 行の後で逆順になる。逆順でなければ、ソートされた行の前 + でもとの順序のまま置かれる。 + + {pattern} が空である場合(例: // が指定されたとき)、 + 最後に使われた検索パターンが使われる。よって、まず検 + 索コマンドでパターンを確かめてみることができる。 + +Note: `:global` といっしょに `:sort` を使ってもマッチする行をソートすることに +はならない。これはまったく無意味である。 + +ソートの詳細は使っているライブラリ関数による。ソートが現在のロケールに従うとい +う保証はない。それを調べるには実行してみるしかない。ソートは「安定」ソートであ +る。 + +ソートは中断することができる。しかし中断するのが遅いと行が重複してしまうかもし +れない。これも使っているシステムのライブラリ関数による。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/channel.jax b/plugins/vimdoc-ja/doc/channel.jax new file mode 100644 index 0000000000..ed2a6e1989 --- /dev/null +++ b/plugins/vimdoc-ja/doc/channel.jax @@ -0,0 +1,764 @@ +*channel.txt* For Vim バージョン 8.0. Last change: 2016 Dec 02 + + + VIMリファレンスマニュアル by Bram Moolenaar + + + プロセス間通信 *channel* + +Vimは別のプロセスと通信するのにチャンネルを用います。 +チャンネルはソケットまたはパイプを用います。 *socket-interface* +ジョブはプロセスを開始し、プロセスと通信するために使用できます。 +Netbeansインターフェイスもチャンネルを使っています。|netbeans| + +1. 概要 |job-channel-overview| +2. チャンネルデモ |channel-demo| +3. チャンネルを開く |channel-open| +4. JSON、JSチャンネルを使う |channel-use| +5. チャンネルコマンド |channel-commands| +6. RAW、NLチャンネルをつかう |channel-raw| +7. その他のチャンネル機能 |channel-more| +8. チャンネルでジョブを開始する |job-start| +9. チャンネルなしでジョブを開始する |job-start-nochannel| +10. ジョブオプション |job-options| +11. ジョブを制御する |job-control| + +{Vi にはこれらの機能はありません} +{Vim が |+channel| 機能付きでコンパイルされたときのみ有効} + `has('channel')` でこれを確認できる +{Vim が |+job| 機能付きでコンパイルされたときのみ有効} + `has('job')` でこれを確認できる + +============================================================================== +1. 概要 *job-channel-overview* + +主に4種類のジョブがあります: +1. いくつかの Vim インスタンスを扱うデーモン。Vim はソケットで接続します。 +2. 1つの Vim インスタンスを1つのジョブが非同期に処理する。ソケットまたはパイプ + を使用します。 +3. 短時間、非同期で仕事をするジョブ。ソケットまたはパイプを使用します。 +4. フィルタを同期して実行する。パイプを使用します。 + +ソケットを使用する場合 |job-start|、|job-start-nochannel|、および +|channel-open| 参照。2と3の場合は、パイプを使用する1つ以上のジョブです +(|job-start| 参照)。 +4の場合、":{range}!cmd" コマンドを使用します(|filter| 参照)。 + +ソケットとパイプ上でこれらのプロトコルを利用できます: +RAW 何も知られていない、Vim はメッセージの終わりを知らせない。 +NL すべてのメッセージは NL (改行)文字で終わります。 +JSON JSON エンコーディング |json_encode()| +JS JavaScript スタイルの JSON 風のエンコーディング |js_encode()| + +共通の組み合わせ: +- NL モードでパイプを介して接続されたジョブを使用します。例えば、スタイルチェッ + カーを実行し、エラーと警告を受け取ります。 +- デーモンを使用して、JSON モードでソケットに接続します。例えば、データベース + 内の相互参照を参照します。 + +============================================================================== +2. チャンネルデモ *channel-demo* *demoserver.py* + +デモにはPythonが必要です。デモプログラムは次の場所にあります。 +$VIMRUNTIME/tools/demoserver.py +それをあるターミナルで実行しましょう。そのターミナルをT1と呼びます。 + +次に別のターミナルでVimを実行します。そして以下のコマンドでサーバーに接続しま +す: > + let channel = ch_open('localhost:8765') + +T1の中に次のように表示されます: + === socket opened === ~ + +ついにサーバーにメッセージを送信できます: > + echo ch_evalexpr(channel, 'hello!') + +このメッセージはT1で受信され、Vimには応答が送り返されます。 +T1ではVimが送った生のメッセージを確認できます: + [1,"hello!"] ~ +そしてレスポンスはこうなります: + [1,"got it"] ~ +この数値はメッセージを送るたびに増加していきます。 + +サーバーはVimにコマンドを送信できます。T1において、次のように正確に(引用符を含 +めて文字通りに)タイプしてください: + ["ex","echo 'hi there'"] ~ +するとそのメッセージがVimに表示されます。カーソルを1単語先に移動することができ +ます: + ["normal","w"] ~ + +非同期通信を取り扱うためにはコールバック(以下ハンドラー)が必要です: > + func MyHandler(channel, msg) + echo "from the handler: " . a:msg + endfunc + call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"}) +Vim は応答を待つことはありません。これで、サーバーは応答を後で送信し、 +MyHandler が呼び出されます。 + +sendを呼ぶたびに毎回コールバックを指定する代わりに、チャンネルを開く際に指定す +ることもできます: > + call ch_close(channel) + let channel = ch_open('localhost:8765', {'callback': "MyHandler"}) + call ch_sendexpr(channel, 'hello!') + +チャンネルを試してみると、何が起こっているのかを知ることができます。あなたは +Vim にログファイルに行を書くよう指示することができます: > + call ch_logfile('channellog', 'w') +|ch_logfile()| 参照. + +============================================================================== +3. チャンネルを開く *channel-open* + +チャンネルを開くには次のようにします: > + let channel = ch_open({address} [, {options}]) + if ch_status(channel) == "open" + " use the channel + +|ch_status()| を使用して、チャンネルを開くことができたかどうかを確認します。 + +{address} は "ホスト名:ポート番号" の形式です。例:"localhost:8765" + +{options} はオプションのエントリを持つ辞書です: *channel-open-options* + +"mode" でモード(通信フォーマット)を指定します: *channel-mode* + "json" - JSONを使う(詳しくは下記を参照。もっとも使いやすい方法。既定) + "js" - JS(JavaScript) エンコーディングを使用し、JSON よりも効率的。 + "nl" - NL 文字で終わるメッセージを使う + "raw" - rawメッセージを使う + *channel-callback* *E921* +"callback" メッセージ受信時に他のハンドラーで扱われない時に呼ばれます。 + これはチャンネルのハンドルと、受信したメッセージの2つの引数を + 取ります。例: > + func Handle(channel, msg) + echo '受信した: ' . a:msg + endfunc + let channel = ch_open("localhost:8765", {"callback": "Handle"}) +< + "mode" が "json", "js" の時には、"msg" 引数は受信したメッセー + ジの本文で、Vimの型に変換されています。 + "mode" が "nl" の時には、"msg" 引数は NL を除く1つのメッセージ + です。 + "mode" が "raw" の時には、"msg" 引数はメッセージ全体を格納し + た文字列です。 + + すべてのコールバック: |function()| を使用して、引数および/また + は辞書にバインドします。または、"dict.function" という形式を使 + 用して辞書をバインドします。 + + コールバックは、通常、Vim がユーザーが文字を入力するのを待って + いるとき、「安全な」瞬間にのみ呼び出されます。Vim はマルチス + レッドを使用しません。 + + *close_cb* +"close_cb" |ch_close()| を呼び出す以外に、チャンネルが閉じられたときに呼 + び出される関数。このように定義する必要があります: > + func MyCloseHandler(channel) +< Vim は close_cb を呼び出す前にデータを処理するコールバックを呼 + び出します。したがって、この関数が呼び出されると、それ以上の + データはコールバックに渡されません。 + *channel-drop* +"drop" メッセージをいつドロップするかを指定します: + "auto" メッセージを処理するコールバックがない場合。 + "close_cb" もこのために考慮されます。 + "never" すべてのメッセージが保存されます。 + *waittime* +"waittime" 接続がミリ秒単位で待機する時間。負の数は永遠に待ちます。 + + デフォルトはゼロで、待機しません。これは、ローカルサーバーがす + でに実行されている場合に便利です。Unix Vim では実際には1msのタ + イムアウトが使われます。多くのシステムではそれが必要なためで + す。リモートサーバーには大きな値を使用してください。例: 少なく + とも10msec。 + *channel-timeout* +"timeout" ブロッキング時にリクエストを待つ時間(例: |ch_evalexpr()| を使用 + するとき。ミリ秒単位。デフォルトは2000(2秒)です。 + +"mode" が "json" か "js" の時には "callback" はオプションです。これを省略した +場合、メッセージを1つ受信するにはメッセージを1つ送信する必要があります。 + +チャンネルオプションを開いた後に変更するには、|ch_setoptions()| を使用します。 +引数は |ch_open()| に渡されるものと似ていますが、"waittime" は与えられません。 +これはチャンネルを開く場合にのみ適用されるためです。 + +例えば、ハンドラーは後から追加したり、変更したりできます: > + call ch_setoptions(channel, {'callback': callback}) +"callback" が空の場合 (一度も指定しないか、空文字列を指定した場合) ハンドラー +は削除されます。 + +コールバックが呼び出された後、Vim は画面を更新し、カーソルをそれが属する場所に +戻します。コールバックは `:redraw` を行う必要はありません。 + +タイムアウトは次のように変更できます: > + call ch_setoptions(channel, {'timeout': msec}) +< + *channel-close* *E906* +チャンネルを使い終わったら、以下のように切断してください: > + call ch_close(channel) +ソケットが使用されていると、両方向のソケットが閉じられます。パイプが使用されて +いると(stdin/stdout/stderr)、それらはすべて閉じられます。これはあなたが望むもの +ではないかもしれません! |job_stop()| でジョブを停止する方が良いかもしれません。 +すべての先読みは破棄され、コールバックは呼び出されなくなります。 + +チャンネルは3つの段階で閉じられることに注意してください: + - I/O が終了し、ログメッセージ: "Closing channel" が表示されます。呼び出すた + めの読み込みまたはコールバックのキューに入れられたメッセージがまだ残ってい + る可能性があります。 + - 先読みがクリアされ、ログメッセージ: "Clearing channel" が表示されます。変 + 数によっては引き続きチャンネルを参照することがあります。 + - チャンネルが解放され、ログメッセージ: "Freeing channel" が表示されます。 + +チャンネルを開くことができない場合、エラーメッセージが表示されます。MS-Windows +と Unix には違いがあります: Unix では、ポートが存在しないとき、|ch_open()| は +すぐに失敗します。MS-Windows では "waittime" が適用されます。 +*E898* *E901* *E902* + +チャンネルを読み書きする際にエラーが発生した場合、チャンネルは閉じられます。 +*E630* *E631* + +============================================================================== +4. JSON、JSチャンネルを使う *channel-use* + +"mode" が JSON の場合は、以下のようにメッセージを同期的に送信できます: > + let response = ch_evalexpr(channel, {expr}) +これは通信相手から応答があるまで待ち合わせます。 + +mode が JS の場合は、メッセージが JavaScript エンコーディングを使用する点を除 +いて、これは同じです。その違いについては、|js_encode()|参照。 + +応答を処理せずにメッセージを送信する、またはチャンネルコールバックに応答を処理 +させるには: > + call ch_sendexpr(channel, {expr}) + +メッセージを送信し、応答を特別な関数で非同期的に処理する場合には、このようにし +ます: > + call ch_sendexpr(channel, {expr}, {'callback': Handler}) + +Vim は、メッセージIDを使用して要求との応答を照合します。応答が受信されると、 +コールバックが呼び出されます。同じIDを持つさらなる応答は無視されます。あなたの +サーバーが複数の応答を返信する場合、IDゼロで送信する必要があります。それらは +チャンネルコールバックに渡されます。 + +{expr} は JSON に変換され、配列で包まれます。{expr} として文字列 "hello" を送 +信した場合に、通信相手が受け取るメッセージの例は次のようになります: + [12,"hello"] ~ + +送信されるJSONのフォーマットはこのようになっています: + [{number},{expr}] + +{number} には毎回異なる値が入ります。これは応答があるならば、必ず使われます: + + [{number},{response}] + +このようにして、受信したメッセージがどの送信メッセージに対応するかを知ることが +でき、正しいハンドラーを呼び出すことができます。これによって応答メッセージの到 +着順序を気にしなくても良くなります。 + +改行文字が JSON テキストを終了しています。これは、読み込まれたテキストを区切る +ために使用できます。例えばPythonでは: + splitidx = read_text.find('\n') + message = read_text[:splitidx] + rest = read_text[splitidx + 1:] + +送信側はかならず有効なJSONをVimへ送らなければなりません。VimはJSONとして解釈す +ることで、受信メッセージの終端をチェックします。終端を受信することが、 +メッセージを受理する唯一の方法です。A newline after the message is optional. + +サーバープロセスがVimからのメッセージを受信すること無く、メッセージを送信する +には、数値に 0 を使う必要があります。 + [0,{response}] + +するとチャンネルのハンドラーが {response} をVimの方に変換したものを受け取るで +しょう。チャンネルにハンドラーが関連付けられていない場合には、メッセージは破棄 +されます。 + +JSON または JS チャンネルで |ch_sendraw()| および |ch_evalraw()| を使用するこ +ともできます。その場合呼び出し元は、正しくエンコードとデコードを行う完全な責任 +があります。 + +============================================================================== +5. チャンネルコマンド *channel-commands* + +JSON チャンネルを使用すると、サーバープロセス側はVimへコマンドを送信できます。 +そのコマンドはチャンネルのハンドラーを介さずに、Vimの内部で実行されます。 + +実行可能なコマンドは以下のとおりです: *E903* *E904* *E905* + ["redraw", {forced}] + ["ex", {Ex コマンド}] + ["normal", {ノーマルモードコマンド}] + ["eval", {式}, {数値}] + ["expr", {式}] + ["call", {関数名}, {引数リスト}, {数値}] + ["call", {関数名}, {引数リスト}] + +これらを使うときは、これらのコマンドが何をするかに十分気をつけてください! +ユーザーが何をしているかによっては容易に干渉してしまいます。トラブルを避けるに +は |mode()| を使い、エディタが期待した状態にあるかチェックしてください。例え +ば、コマンド実行ではなくテキストとして入力させたい文字列を送るには、以下のよう +にします: + ["ex","if mode() == 'i' | call feedkeys('ClassName') | endif"] ~ + +これらのコマンドのエラーは、表示が乱れないようにするため、通常は報告されませ +ん。表示したい場合は、'verbose' オプションを3以上に設定してください。 + + +コマンド "redraw" ~ + +他のコマンドは画面を更新しないので、カーソルを動かさずに一連のコマンドを送るこ +とができます。変更されたテキストを表示し、それが属する場所にカーソルを表示する +には、"redraw" コマンドで終了する必要があります。 + +引数は通常は空の文字列です: + ["redraw", ""] ~ +最初に画面をクリアするには "force" を渡してください: + ["redraw", "force"] ~ + + +コマンド "ex" ~ + +"ex" コマンドは Ex コマンドを実行します。完了やエラーの応答はありませ +ん。|autoload| スクリプトの中の関数を使えます: + ["ex","call myscript#MyFunc(arg)"] + + +"call |feedkeys()|" を使用してキーシーケンスを挿入することもできます。 + +エラーが発生すると、チャンネルログにメッセージが書き込まれ、存在する場合は +v:errmsg にエラーが設定されます。 + + +コマンド "normal" ~ + +"normal" コマンドは ":normal!" のように実行され、コマンドはマップされません。 +カーソルの下の折畳を開く例: + ["normal" "zO"] + + +コマンド "expr" (応答あり) ~ + +"expr" コマンドは、式の結果を得るために使うことができます。たとえば、現在のバッ +ファ内の行数を取得するには、次のようにします: + ["expr","line('$')", -2] ~ + +式の結果を返します: + [-2, "last line"] ~ +形式は次のとおりです: + [{number}, {result}] + +{number} は、リクエストに指定したのと同じものです。Vim が送信するメッセージと +の混乱を避けるには、負の数を使用します。リクエストとレスポンスを一致させるに +は、リクエストごとに異なる番号を使用します。 + +{result} は評価の結果であり、JSON エンコードされています。評価が失敗したり、結 +果を JSON でエンコードできない場合は、文字列 "ERROR" となります。 + + +コマンド "expr" (応答なし) ~ + +このコマンドは上記の "expr" に近いのですが、応答を返信しません。 +例: + ["expr","setline('$', ['one', 'two', 'three'])"] ~ +リクエストに第3引数はありません。 + + +コマンド "call" ~ + +これは "expr" に似ていますが、式全体を文字列として渡す代わりに、関数の名前と引 +数のリストを渡します。これは、引数の文字列への変換を避け、エスケープして連結し +ます。例: + ["call", "line", ["$"], -2] ~ + +応答が送信されない場合は、第4引数を省いてください: + ["call", "setline", ["$", ["one", "two", "three"]]] ~ + +============================================================================== +6. RAW、NL チャンネルを使う *channel-raw* + +モードがRAWかNLの場合には、以下のようにしてメッセージを送信します: > + let response = ch_evalraw(channel, {string}) + +{string} はそのまま送信されます。受信した応答メッセージは直ちにチャンネルから +読み込み可能になります。この時、Vimにはメッセージの終了をどう判断するかがわか +りませんから、あなた自身が面倒を見る必要があります。タイムアウトは、最初のバイ +トを読み取るために適用され、その後は何も待つことはありません。 + +mode が "nl" の場合、同様の方法でメッセージを送信できます。あなたは各メッセー +ジの後に NL に入れなければなりません。したがって、一度に NL で終わる複数のメッ +セージを送信することもできます。応答は最初の NL までのテキストとなります。これ +は空のレスポンスの NL だけでもかまいません。チャンネルタイムアウトの前に NL が +読み取られなかった場合、空の文字列が返されます。 + + +応答を必要としないメッセージを送信するには以下のようにします: > + call ch_sendraw(channel, {string}) +プロセス{訳注:サーバーのこと}はレスポンスを返し、チャンネルのハンドラーに渡さ +れます。 + +メッセージを送信し、レスポンスを特定の関数で非同期的に取り扱うには以下のように +します: > + call ch_sendraw(channel, {string}, {'callback': 'MyHandler'}) + +この {string} はJSONにもできます。その場合、|json_encode()| でそれを作成し +|json_decode()| で受信したJSONメッセージを取り扱います。 + +生のチャンネルで |ch_evalexpr()| または |ch_sendexpr()| を使用することはできま +せん。 + +Vim の文字列に NUL バイトを含めることはできません。NUL バイトを送受信するには、 +バッファから読み書きしてください。|in_io-buffer| と |out_io-buffer| 参照。 + +============================================================================== +7. その他のチャンネル機能 *channel-more* + +チャンネルのステータスを取得するには、ch_status(channel)を使用します。ありうる +結果は次のとおりです: + "fail" チャンネルを開くことができませんでした。 + "open" チャンネルを使用することができます。 + "buffered" チャンネルは閉じられましたが読み込むデータがあります。 + "closed" チャンネルが閉じられました。 + +チャンネルに関連付けられたジョブを取得するには: ch_getjob(channel) + +チャンネルから1つのメッセージを読むには: > + let output = ch_read(channel) +これは、チャンネルのタイムアウトを使用します。タイムアウトなしで読むには、利用 +可能なメッセージを取得するだけです: > + let output = ch_read(channel, {'timeout': 0}) +メッセージが利用できなかった場合、結果は JSON またはJSモードのチャンネルでは +v:none、RAW または NL チャンネルでは空の文字列です。|ch_canread()| を使用して、 +何かがあるかどうかを調べることができます。 + +コールバックメッセージがない場合、メッセージは破棄されます。これを回避するに +は、チャンネルにコールバックを追加します。 + +使用可能なRAWチャンネルからすべての出力を読み込むには: > + let output = ch_readraw(channel) +エラー出力を読むには: > + let output = ch_readraw(channel, {"part": "err"}) + +ch_read() と ch_readraw() はチャンネルタイムアウトを使用します。その時間内に何 +も読み込めない場合、空の文字列が返されます。別のタイムアウトをミリ秒で指定する +には、"timeout" オプションを使用します: + {"timeout": 123} ~ +エラー出力から読み込むには、"part" オプションを使用します: + {"part": "err"} ~ +特定の ID を持つメッセージを JS または JSON チャンネルで読み取るには: + {"id": 99} ~ +ID が指定されていないか、または ID が-1の場合、最初のメッセージが返されます。 +これは、このメッセージを待っているコールバックをすべて無効にします。 + +RAW チャンネルの場合、Vim はメッセージの終わりを知らないので、利用可能なものを +返します。 +NL チャンネルの場合、これは1つのメッセージを返します。 +JS または JSON チャンネルの場合、これは1つのデコードされたメッセージを返しま +す。 +これには、任意のシーケンス番号が含まれます。 + +============================================================================== +8. チャンネルでジョブを開始する *job-start* *job* + + +ジョブを開始し、stdin/stdout/stderr のチャンネルを開くには: > + let job = job_start(command, {options}) + +チャンネルを得るには: > + let channel = job_getchannel(job) + +チャンネルは NL モードを使用します。別のモードが必要な場合は、{options} でこれ +を指定することをお勧めします。後でモードを変更すると、一部のテキストがすでに受 +信され、正しく解析されていない可能性があります。 + +コマンドが処理したい出力行を生成する場合は、stdout のハンドラを指定します: > + let job = job_start(command, {"out_cb": "MyHandler"}) +この関数は、チャンネルとメッセージで呼び出されます。あなたはこれをこのように定 +義します: > + func MyHandler(channel, msg) + +ハンドラがなければ、|ch_read()| または |ch_readraw()| で出力を読み取る必要があ +ります。クローズコールバックでこれを行うことができます。|read-in-close-cb| 参 +照。 + +出力を読み取る前にジョブが終了すると、出力が失われる可能性があることに注意して +ください。これはシステムによって異なります(Unix 上では、パイプの書き込み終了を +閉じると EOF が得られます)。これを避けるには、ジョブが終了する前にそれをしばら +くスリープさせること。 + +"out_cb" に定義されたハンドラは stderr を受け取りません。もし個別に扱いたい場 +合は、"err_cb" ハンドラを追加します: > + let job = job_start(command, {"out_cb": "MyHandler", + \ "err_cb": "ErrHandler"}) + +1つのハンドラで stderr と stdout の両方を処理する場合は、"callback" オプション +を使用します: > + let job = job_start(command, {"callback": "MyHandler"}) + +ch_evalraw() でコマンドにメッセージを送ることができます。チャンネルが JSON ま +たは JS モードの場合、ch_evalexpr() を使用できます。 + +使用できるオプションがいくつかあります。|job-options| 参照。 +例えば、ジョブを開始し、その出力をバッファ "dummy" に書き込むには: > + let logjob = job_start("tail -f /tmp/log", + \ {'out_io': 'buffer', 'out_name': 'dummy'}) + sbuf dummy + + +バッファからのジョブ入力 ~ + *in_io-buffer* +バッファから読み取るジョブを実行するには: > + let job = job_start({command}, + \ {'in_io': 'buffer', 'in_name': 'mybuffer'}) +< + *E915* *E918* +バッファは、|bufnr()| と同様の名前で見つけられます。バッファは、job_start() +が呼び出されたときに存在し、ロードされていなければなりません。 + +デフォルトでは、これはバッファ全体を読み込みます。これは "in_top" と "in_bot" +オプションで変更できます。 + +特殊モードは、in_top が0に設定され、in_bot が設定されていない場合です。バッファ +に行が追加されるたびに、最後の1行がジョブ stdin に送信されます。これにより、 +最後の行を編集し、Enter を押したときに送信することができます。 + *channel-close-in* +特殊モードを使用しないときは、最後の行が書き込まれた後にパイプまたはソケットが +閉じられます。これは、入力が終了した読み取り終了を知らせます。|ch_close_in()| +を使用すると、より早く終了することもできます。 + +テキストの NUL バイトはジョブに渡されます(内部では Vim はこれらを NL バイトと +して格納します)。 + + +クローズコールバックでジョブ出力を読み込む ~ + *read-in-close-cb* +ジョブに時間がかかり、中間結果が必要ない場合は、クローズコールバックを追加して +そこの出力を読み取ることができます: > + + func! CloseHandler(channel) + while ch_status(a:channel, {'part': 'out'}) == 'buffered' + echomsg ch_read(a:channel) + endwhile + endfunc + let job = job_start(command, {'close_cb': 'CloseHandler'}) + +あなたは "echomsg" よりも役に立つ何かをしたいでしょう。 + +============================================================================== +9. チャンネルなしでジョブを開始する *job-start-nochannel* + +チャンネルを作成せずに別のプロセスを開始するには: > + let job = job_start(command, + \ {"in_io": "null", "out_io": "null", "err_io": "null"}) + +これはバックグラウンドで {command} を開始し、Vim はそれが完了するのを待ちませ +ん。 + +Vim が stdin、stdout、stderr のいずれも接続されていないと判断すると、チャンネ +ルは作成されません。コマンドが停止するのを避けるために、リダイレクションをコマ +ンドに含めることがよくあります。 + +使用できるオプションがいくつかあります。|job-options| 参照。 + + *job-start-if-needed* +アドレスへの接続が動作しない時にのみジョブを開始するには、次のような操作を行い +ます: > + let channel = ch_open(address, {"waittime": 0}) + if ch_status(channel) == "fail" + let job = job_start(command) + let channel = ch_open(address, {"waittime": 1000}) + endif + +ch_open() の待ち時間は、ポートを利用可能にするためにジョブに1秒を与えることに +注意してください。 + +============================================================================== +10. ジョブオプション *job-options* + +job_start() の {options} 引数は辞書です。すべての入力はオプションです。 +job_setoptions(job, {options}) を使用して、ジョブの開始後にいくつかのオプショ +ンを使用できます。ch_setoptions(channel, {options}) を使用して、ジョブに関連す +るチャンネルで多くのオプションを使用できます。|job_setoptions()| および +|ch_setoptions()| 参照。 + + *in_mode* *out_mode* *err_mode* +"in_mode" stdin 用のモード、パイプを使用している場合にのみ。 +"out_mode" stdout 用のモード、パイプを使用している場合にのみ。 +"err_mode" stderr 用のモード、パイプを使用している場合にのみ。 + 値については、|channel-mode| 参照。 + + Note: "mode" を設定すると、パーツ固有のモードが上書き + されます。したがって、最初に "mode" を、後でパーツ固 + 有のモードを設定します。 + + Note: ファイルやバッファに書き込むときやバッファから読 + み込むときは、NL モードがデフォルトで使用されます。 + + *job-callback* +"callback": handler チャンネルの任意の部分で何かを読むためのコールバック。 + *job-out_cb* *out_cb* +"out_cb": handler stdout で読み込むべきものがあるときのコールバック。チャ + ンネルがパイプを使用している場合のみ。"out_cb" が設定 + されていない場合は、チャンネルコールバックが使用されま + す。2つの引数はチャンネルとメッセージです。 + + *job-err_cb* *err_cb* +"err_cb": handler stderr で読み込むべきものがあるときのコールバック。チャ + ンネルがパイプを使用している場合のみ。"err_cb" が設定 + されていない場合は、チャンネルコールバックが使用されま + す。2つの引数はチャンネルとメッセージです。 + *job-close_cb* +"close_cb": handler チャンネルが閉じられるときのコールバック。 + |ch_open()| の "close_cb" と同じです。|close_cb| 参照。 + *job-drop* +"drop" メッセージをいつドロップするかを指定します。 + |ch_open()| の "drop" と同様(|channel-drop| 参照)。 + "auto" の場合、exit_cb は考慮されません。 + *job-exit_cb* +"exit_cb": handler ジョブが終了したときのコールバック。引数はジョブと終 + 了ステータスです。 + Vim は、終了したジョブに対して最大10回/秒をチェックし + ます。チェックは、|job_status()| を呼び出すことによっ + てトリガーすることもでき、exit_cb ハンドラを呼び出すこ + とができます。 + データがバッファリングされ、プロセスが終了した後もコー + ルバックが呼び出されることに注意してください。 + *job-timeout* +"timeout" ブロッキング時にリクエストを待つ時間(例: ch_evalexpr() + を使用するとき。ミリ秒単位。デフォルトは2000(2秒)です。 + *out_timeout* *err_timeout* +"out_timeout" stdout のタイムアウト。パイプ使用時のみ。 +"err_timeout" stderr のタイムアウト。パイプ使用時のみ。 + Note: "timeout" を設定すると、パーツ固有のモードが上書 + きされます。したがって、最初に "timeout" を設定し、後 + でパーツ固有のモードを設定します。 + + *job-stoponexit* +"stoponexit": {signal} Vim が終了すると {signal} をジョブに送ります。可能な値 + については、|job_stop()| 参照。 +"stoponexit": "" Vim が終了してもジョブを停止しません。 + デフォルトは "term" です。 + + *job-term* +"term":"open" ターミナルを起動し、ジョブ stdin/stdout/stderr を接続 + します。 + NOTE: まだ実装されていません! + +"channel": {channel} 新しいチャンネルを作成する代わりに、既存のチャンネルを + 使用します。新しいジョブに使用されるチャンネルの部分 + は、以前使用された部分から切り離されます。チャンネル + が別のジョブで引き続き使用されていた場合、I/O エラーが + 発生する可能性があります。 + 既存のコールバックやその他の設定が残っています。 + + *job-in_io* *in_top* *in_bot* *in_name* *in_buf* +"in_io": "null" stdin を切断する(/dev/null から読み込む) +"in_io": "pipe" 標準入力がチャンネルに接続されている(デフォルト) +"in_io": "file" stdin はファイルから読み込む +"in_io": "buffer" stdin はバッファから読み込む +"in_top": number "buffer" を使用する場合: 送信する最初の行(デフォルト:1) +"in_bot": number "buffer" を使用する場合: 送信する最後の行(デフォルト: + 最後) +"in_name": "/path/file" 読み込むファイルまたはバッファの名前 +"in_buf": number 読み込むバッファの番号 + + *job-out_io* *out_name* *out_buf* +"out_io": "null" stdout を切断する(/dev/nullに行く) +"out_io": "pipe" stdout がチャンネルに接続されている(デフォルト) +"out_io": "file" stdout がファイルに書き込む +"out_io": "buffer" stdout はバッファに追加する(下記参照) +"out_name": "/path/file" 書き込むファイルまたはバッファの名前 +"out_buf": number 書き込むバッファの番号 +"out_modifiable": 0 バッファに書き込むときに、'modifiable' はオフになる + (下記参照) +"out_msg": 0 新しいバッファに書き込むとき、最初の行は "Reading from + channel output..." に設定される + + *job-err_io* *err_name* *err_buf* +"err_io": "out" stderr のメッセージは stdout に行く +"err_io": "null" stderr を切断する(/dev/nullに行く) +"err_io": "pipe" stderr がチャンネルに接続されている(デフォルト) +"err_io": "file" stderr はファイルに書き込む +"err_io": "buffer" stderr はバッファに追加する(下記参照) +"err_name": "/path/file" 書き込むファイルまたはバッファの名前 +"err_buf": number 書き込むバッファの番号 +"err_modifiable": 0 バッファに書き込むときに、'modifiable' はオフになる + (下記参照) +"err_msg": 0 新しいバッファに書き込むとき、最初の行は "Reading from + channel error..." に設定される + +"block_write": number テストのためにのみ: stdin への他のすべての書き込みをブ + ロックするふりをする + + +バッファへの書き込み ~ + *out_io-buffer* +out_io または err_io モードが "buffer" で、コールバックがある場合、コールバッ +クを呼び出す前にテキストがバッファに追加されます。 + +入力と出力の両方にバッファが使用されている場合、最後の行はチャンネル入力に書き +込まれたものなので、出力行は最後の行の上に置かれます。それ以外の場合は最後の行 +の下に行が追加されます。 + +"buffer" を指定して JS または JSON モードを使用すると、デコード+エンコーディン +グ後に、ゼロまたは負の ID を持つメッセージのみがバッファに追加されます。正の数 +を持つメッセージはコールバックによって処理され、コマンドは通常通り処理されま +す。 + +"out_name" または "err_name" のバッファ名は、現在のディレクトリの名前を拡張し +た後も、既存のバッファの完全名と比較されます。たとえば、":edit somename" でバッ +ファが作成され、バッファ名が "somename" の場合、そのバッファが使用されます。 + +一致するバッファがない場合、新しいバッファが作成されます。新しいバッファを常に +作成するには、空の名前を使用します。|ch_getbufnr()| を使用してバッファ番号を +取得できます。 + +新しいバッファの場合、'buftype' は "nofile" に設定され、'bufhidden' は "hide" +に設定されます。他の設定が必要な場合は、まずバッファを作成し、バッファ番号を渡 +します。 + *out_modifiable* *err_modifiable* +"out_modifiable" と "err_modifiable" オプションは、'modifiable' オプションをオ +フにするか、'modifiable' になっているバッファに書き込むために使用できます。つ +まり、行がバッファに追加されますが、ユーザーはバッファを簡単に変更できません。 + *out_msg* *err_msg* +"out_msg" オプションは、新しいバッファが最初の行を "Reading from channel +output..." に設定するかどうかを指定するために使用できます。デフォルトではメッ +セージを追加します。"err_msg" はチャンネルエラーでも同じです。 + +'modifiable' オプションをオフにしたり、'modifiable' オフなバッファを書き込んだ +りすることができます。つまり、行がバッファに追加されますが、ユーザーはバッファ +を簡単に変更できません。 + +既存のバッファに 'modifiable' が指定されておらず、"out_modifiable" または +"err_modifiable" オプションがゼロでない場合、エラーが発生し、バッファに書き込 +まれません。 + +書き込まれたバッファがウィンドウに表示され、カーソルが最後の行の最初の列にある +場合、カーソルは新しく追加された行に移動され、ウィンドウは必要に応じてカーソル +を表示するために上にスクロールされます。 + +追加されたすべての行に対して、取り消しが同期されます。NUL バイトは受け入れら +れます(内部では Vim はこれらを NL バイトとして格納します)。 + + +ファイルへの書き込み ~ + *E920* +ファイルはアクセス許可600(ユーザーに対しては読み書き可能、他のユーザーはアクセ +ス不可)で作成されます。これを変更するには、|setfperm()| を使用してください。 + +ファイルがすでに存在する場合は切り捨てられます。 + +============================================================================== +11. ジョブを制御する *job-control* + +ジョブの状態を取得するには: > + echo job_status(job) + +ジョブの実行を停止するには: > + job_stop(job) + +これはジョブを終了させる通常の方法です。Unix では、ジョブに SIGTERM を送信し +ます。他の方法でジョブを停止したり、任意の信号を送信したりすることもできます。 +例えば、ジョブを強制的に停止させるには、"kill it": > + job_stop(job, "kill") + +他のオプションについては、|job_stop()| 参照。 + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/cmdline.jax b/plugins/vimdoc-ja/doc/cmdline.jax new file mode 100644 index 0000000000..e4264d59b5 --- /dev/null +++ b/plugins/vimdoc-ja/doc/cmdline.jax @@ -0,0 +1,1099 @@ +*cmdline.txt* For Vim バージョン 8.0. Last change: 2016 Sep 27 + + + VIMリファレンスマニュアル by Bram Moolenaar + + *Cmdline-mode* *Command-line-mode* +コマンドラインモード *Cmdline* *Command-line* *mode-cmdline* *:* + +コマンドラインモードはExコマンド (":")、検索パターン ("/" と "?")、フィルタコ +マンド ("!") の入力に使われる。 + +コマンドライン編集の基本は、ユーザーマニュアルの第20章で説明されている +|usr_20.txt|。 + +1. コマンドラインの編集 |cmdline-editing| +2. コマンドラインの補完 |cmdline-completion| +3. Exコマンドライン |cmdline-lines| +4. Exコマンドラインの範囲 |cmdline-ranges| +5. Exコマンドラインのフラグ |ex-flags| +6. Exコマンド用の特別な文字 |cmdline-special| +7. コマンドラインウィンドウ |cmdline-window| + +============================================================================== +1. コマンドラインの編集 *cmdline-editing* + +通常、文字はカーソル位置の前に挿入される。コマンドラインでは左右のカーソルキー +で移動ができる。キーで挿入と上書を切り替えることができる。 +{Vi: 行の最後の文字しか変更できない} + +Note キーボードに有効なカーソルキーまたは他の特殊なキーが一切ないときでも、コ +マンド ":cnoremap" を使って他のキーをそれらに割り当てられることに注意。 +例えば、tcsh風の編集キーを定義する方法は以下の通り。 *tcsh-style* > + :cnoremap + :cnoremap + :cnoremap + :cnoremap b + :cnoremap f +(<> 記法を使っている |<>|.これらを全て文字通り打ち込むこと) + + *cmdline-too-long* +コマンドラインが長くなりすぎて画面に収まらなくなったときは、画面に入るだけの部 +分が表示される。カーソルはこの見える部分しか動けない。そのため、これ以上は編集 +できない。 + + *cmdline-history* *history* +ユーザーの打ち込んだコマンドは、履歴表に記録される。これらの履歴は上下矢印キー +で呼び出せる。実際には4つの履歴表がある。 +履歴表: +- ':' コマンド用 +- 検索文字列用 +- 式 (expression) 用 +- インプット行 (関数 |input()| に対して入力されたテキスト) 用 +- デバッグモードコマンド用 +これらは全く別のものである。それぞれの履歴は同種の入力をしたときだけ使用できる。 +オプション 'history' で保存されるコマンド数を設定できる (既定値: 50)。 +NOTE: +- 以前と全く同じコマンドを打ち込んだときは、古い方の記録が消される (繰り返され + たコマンドが古いコマンドの履歴を追い出して消すのを避けるため)。 +- 打ち込んだコマンドだけが記録される。完全にマッピングから実行されたコマンドは + 履歴に残らない。 +- 全ての検索パターンは、コマンド "*" や "#" 等によるものも含め、検索用の履歴に + 記録される。しかしマッピングからの検索に対しては、最後の検索のみが記録される + (長いマッピングが履歴の内容を捨ててしまうのを避けるため)。 +{Vi: 履歴はない} +{Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + +コマンドラインには名前の自動補完機能がある。|cmdline-completion| を参照。 + + *c_CTRL-V* +CTRL-V 次に打ち込まれた非数字文字を、その通りに挿入する。また最大3個 + の数字により、1バイト文字をコードの10進表現に基づいて入力でき + る。打ち込んだ非数字文字と3個の数字にはマッピングは適用されな + い。これは挿入モードと同じ働きをする (|i_CTRL-V| を参照)。 + NOTE: Windowsでは CTRL-V はテキストの貼り付けにマッピングされ + ていることが多い。そのときは代わりに CTRL-Q を使うこと。 + *c_CTRL-Q* +CTRL-Q CTRL-V と同様だが、ターミナルによっては表示制御に使われている。 + その場合は使えない。 + + *c_* *c_Left* + カーソルを左へ + *c_* *c_Right* + カーソルを右へ + *c_* + または *c_* + カーソルを 1WORD 分左へ + *c_* + または *c_* + カーソルを 1WORD 分右へ +CTRL-B または *c_CTRL-B* *c_* *c_Home* + カーソルをコマンドライン先頭へ +CTRL-E または *c_CTRL-E* *c_* *c_End* + カーソルをコマンドライン末尾へ + + *c_* + カーソルをマウスでクリックした所へ移動する + + *c_* + クリップボード(X11 ではプライマリ選択)の内容を貼り付ける。これ + は CTRL-R * を使った動作に似ているが、行間に CR は挿入されな + い。 + +CTRL-H *c_* *c_CTRL-H* *c_BS* + カーソル前の文字を削除する ( キーが思い通り働かないときは + |:fixdel| を参照)。 + *c_* *c_Del* + カーソル下の文字を削除する (行の最後では: カーソル前の文字) + ( キーが思い通り働かないときは |:fixdel| を参照。) + *c_CTRL-W* +CTRL-W カーソルの前の |word| を削除。これは 'iskeyword' オプションに + 依存する。 + *c_CTRL-U* +CTRL-U 行頭とカーソル位置の間の全ての文字を削除する。Vimの以前の + バージョンでは行内の文字を全て削除していた。その動作の方がよい + なら、次の行をファイル .vimrc に加えること。 > + :cnoremap +< + *c_* *c_Insert* + 挿入/上書の切り替え {Vi にはない} + +{char1} {char2} または *c_digraph* +CTRL-K {char1} {char2} *c_CTRL-K* + ダイグラフの入力 (|digraphs| を参照)。{char1} が特殊キーのとき + は、そのキーコードは <> 形式で挿入される。 {Vi にはない} + +CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_* + 番号/名前付きレジスタの内容を挿入する。CTRL-R を打ち込んで次の + 文字を打ち込むまでの間、レジスタ名の入力待ちであることを示すた + め '"' が表示される。 + テキストは打ち込まれた通りに挿入され、マッピングや短縮入力は無 + 効である。'wildchar' によるコマンドライン補完も行われない。 + またコマンドラインを終了する文字 (, , , ) も + 文字通り挿入される。 や CTRL-W はコマンドラインを終了でき + るが、コマンドラインに残っている文字が違うモードで解釈されるこ + となるので、意図とは異なる動作になるかもしれない。 + 特殊なレジスタ: + '"' 無名レジスタ、最後の削除やコピーによるテキスト + を格納する。 + '%' カレントファイル名 + '#' 代替ファイル名 + '*' クリップボードの内容 (X11: プライマリ選択) + '+' クリップボードの内容 + '/' 最後の検索パターン + ':' 最後のコマンドラインの内容 + '-' 最後の小規模な (1行未満の) 削除の内容 + '.' 最後に挿入されたテキスト + *c_CTRL-R_=* + '=' Expression レジスタ: 式を入力するよう要求され + る (|expression| を参照) + (Expressionプロンプトでは機能しない。バッファ + 変更やカレントウィンドウ変更などは副作用を避け + るため許可されていない) + 結果がリスト |List| である場合、各要素が1行と + して挿入される。行の中に改行文字が含まれていて + もよい。 + 結果が浮動小数点数である場合、自動的に文字列に + 変換される。 + レジスタに関しては |registers| を参照。 {Vi にはない} + 実装上の詳細: |expression|レジスタを使っているときに + setcmdpos()を呼ぶと結果文字列を挿入する前の位置をセットする。 + 挿入後の位置をセットするにはCTRL-R CTRL-Rを使うこと。 + +CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c__* +CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *c__* +CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c__* +CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c__* + カーソル下にオブジェクトを挿入する。 + CTRL-F カーソル下のファイル名 + CTRL-P |gf| と同様に 'path' を使って展開された、カー + ソル下のファイル名 + CTRL-W カーソル下の word + CTRL-A カーソル下の WORD; |WORD| を参照 + + 'incsearch' がセットされてるとき、現在表示されているマッチの末 + 尾のカーソル位置が使われる。CTRL-Wではwordの一部がすでに入力さ + れているとき、その部分がもう一度入力されることはない。 + {訳注: wordという単語のrの上にカーソルを置き、:woと + してみると、'incsearch' の値によって結果が違うことがわかる} + + {Vi にはない} + CTRL-F と CTRL-P: {Vimが |+file_in_path| 機能付きでコンパイル + されたときのみ有効} + + *c_CTRL-R_CTRL-R* *c__* + *c_CTRL-R_CTRL-O* *c__* +CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} +CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} + カーソル下にレジスタの内容またはオブジェクトを挿入。|c_CTRL-R| + と同様の動作だが、テキストを文字通り挿入する。例えば、レジスタ + "a の内容が "xy^Hz" (ここで ^H はバックスペース) のとき、 + "CTRL-R a" は "xz" を挿入するのに対し、"CTRL-R CTRL-R a" は + "xy^Hz" を挿入する。 + +CTRL-\ e {expr} *c_CTRL-\_e* + コマンドラインを {expr} を評価した結果で置き換える。式を入力し + を押せば完了する。マッピングする時に使うと便利である。 + |expression| も参照のこと。 + 式の評価を挿入するには |c_CTRL-R_=| を使う。便利な関数に + |getcmdtype()| と |getcmdline()| と |getcmdpos()| がある。 + カーソルが行末になければカーソル位置は変更されない。カーソルが + 行末にあるときのコマンドライン変更後のカーソル位置は行末であ + る。|setcmdpos()| を使うとカーソル位置を変更できる。 + |sandbox| を使うと不要な副作用を避けて式を評価することができ + る。 + 例: > + :cmap eAppendSome() + :func AppendSome() + :let cmd = getcmdline() . " Some()" + :" place the cursor on the ) + :call setcmdpos(strlen(cmd)) + :return cmd + :endfunc +< これは再帰的には機能しない。つまり、すでに式を編集しているとき + は動作しない。ただしマップの中では再帰的に使える。 + + *c_CTRL-Y* +CTRL-Y モードレスセレクションでテキストを選択中のとき、テキストをクリッ + プボードにコピーする。 |modeless-selection| + 選択中でないときは、CTRL-Y は文字として挿入される。 + +CTRL-M or CTRL-J *c_CTRL-M* *c_CTRL-J* *c_* *c_* *c_CR* + または + 入力されたコマンドの実行 + +CTRL-[ *c_CTRL-[* *c_* *c_Esc* + 打ち込まれたときにオプション 'cpoptions' にフラグ 'x' が含まれ + ていなければ、コマンドを実行せずにコマンドラインモードを終了す + る。マクロ内で使われたとき、または 'cpoptions' に 'x' が含まれ + ているときは、コマンドラインを実行する。 + Note: お使いのキーボードで が押しづらい場合は、CTRL-[ + を使うよう練習してください。 + *c_CTRL-C* +CTRL-C コマンドを実行せずにコマンドラインモードを終了する。 + + *c_* *c_Up* + 古いコマンドラインの内容のうち、先頭部分が現在のコマンドライン + とマッチするものを履歴から呼び出す (下を参照)。 + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + *c_* *c_Down* + さらに最近のコマンドラインの内容のうち、先頭部分が現在のコマン + ドラインとマッチするものを履歴から呼び出す (下を参照)。{訳注: + 変な訳ですが、 で行き過ぎたら で戻るということです} + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + + *c_* *c_* + または + 履歴から古いコマンドラインの内容を呼び出す。 + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + *c_* *c_* + または + 履歴からさらに最近のコマンドラインの内容を呼び出す。 + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + +CTRL-D コマンドライン補完 (|cmdline-completion|を参照) +オプション 'wildchar' で指定したキー + コマンドライン補完 (|cmdline-completion|を参照) +CTRL-N コマンドライン補完 (|cmdline-completion|を参照) +CTRL-P コマンドライン補完 (|cmdline-completion|を参照) +CTRL-A コマンドライン補完 (|cmdline-completion|を参照) +CTRL-L コマンドライン補完 (|cmdline-completion|を参照) + + *c_CTRL-_* +CTRL-_ 1. キーボードのヘブライ語モードと英語モードを切り替える。これ + はコマンドラインのみに適用され、'hkmap' とは関係ない。 + コマンドライン、検索や短縮入力等にヘブライ語テキストの項目が必 + 要とされるときに便利である。Vimが |+rightleft| 機能付きでコン + パイルされ、'allowrevins' がオンのときのみ有効。 + |rileft.txt| を参照。 + + 2. キーボードのペルシア語モードと英語モードを切り替える。これ + はコマンドラインのみに適用され、オプション 'fkmap' には関係し + ない。ペルシア語モードでは、文字は普段とは反対の方向に挿入され + る。コマンドライン、検索や短縮入力等にペルシア語テキストの項目 + が必要とされるときに便利である。Vimが |+farsi| 機能付きでコン + パイルされたときのみ有効。 + |farsi.txt|を参照。 + + *c_CTRL-^* +CTRL-^ 言語マッピング |:lmap| を切り替えたり、Input Method (IM) を切 + り替える。 + 検索コマンドのためにパターンを入力するとき、オプション + 'imsearch' が -1 でなければ VAL は 'imsearch' の値に、そうでな + ければ VAL は 'iminsert' の値になる。 + 言語マッピングが定義されているとき: + - VAL が 1 のとき (言語マッピングが使われているとき) 0 に変わ + る (言語マッピングは使われなくなる)。 + - VAL が 1 でなければ 1 に変わり、言語マッピングが有効になる。 + 言語マッピングが全く定義されていないとき: + - VAL が 2 のとき (IMが使われているとき) 0 に変わる (IMは使わ + れなくなる) + - VAL が 2 以外のときは 2 に変わり、IMが有効になる。 + 普通、言語マッピングは、キーボードが生成するのと違う文字を打ち + 込むのに使われる。オプション 'keymap' を使えばまとめて設定でき + る。 + コマンドラインに入ったときは、コマンドを打ち込むはずなので、言 + 語マッピングはオフに切り替えられる。CTRL-^ でオンにした後も、 + 次にコマンドや検索パターンを打ち込むときにはその状態は使われな + い。 + {Vi にはない} + + *c_CTRL-]* +CTRL-] 文字を挿入することなく短縮入力を展開する。{Vi にはない} + +コマンドラインをEmacsスタイルで編集する方法については |emacs-keys| を参照。 + +キー は現在のコマンドラインを検索文字列として扱う。次/以前のコ +マンドラインの先頭部分が、この文字列と比較される。マッチした最初の行が新しいコ +マンドラインとなる。これら2つのキーを繰り返し入力すると、同じ文字列が検索に使 +われる。例えば、以前の置換コマンドを見つけるためにはこうする: ":s" の後 +を打ち込むこと。同じことは、 を望んだ行が出るまで数回打ち込むことでもで +きる。( Note: シフトキーと矢印キーとの同時押しは、全ての端末で機能するわけでは +ないことに注意) + + *:his* *:history* +:his[tory] 最近入力されたコマンドの履歴を表示する。 + {Vi にはない} + {Vimが |+cmdline_hist| 機能付きでコンパイルされたときのみ有効} + +:his[tory] [{name}] [{first}][, [{last}]] + {name} の種類の履歴内容を一覧表示する。{name} に入るものは: + c[md] または : コマンドラインの履歴 + s[earch] または / または ? 検索文字列の履歴 + e[xpr] または = Expression レジスタの履歴 + i[nput] または @ 入力行の履歴 + d[ebug] または > デバッグコマンドの履歴 + a[ll] 上記のもの全て + {Vi にはない} + + {first}や{last}が指定されたときは、履歴中の指定された範囲の + 項目が表示される。これらの数字は次の形式で指定する。 + *:history-indexing* + 正数は、":history" の一覧表示で最初の列に表示される、項目の絶 + 対的な番号を表す。この数字は、他の項目が削除されても固定された + ままである。 + + 負数は項目の相対的な位置を示す。これは最も新しい項目 (番号 -1 + を持つ) から後ろ向きに数えたものである。 + + 例: + 検索履歴の項目6から12までを一覧表示する。 > + :history / 6,12 +< + 全履歴の最後から2番目を一覧表示する。 > + :history all -2 +< + 全履歴の最近の2項目を一覧表示する。 > + :history all -2, + +:keepp[atterns] {command} *:keepp* *:keeppatterns* + 検索履歴に何も加えずに、{command} を実行する。 + +============================================================================== +2. コマンドラインの補完 *cmdline-completion* + +コマンドラインの編集をしているとき、いくつかのコマンドを使ってカーソル前の単語 +を補完できる。補完は以下のものに対して有効である。 + +- コマンド名: コマンドラインの先頭で使われる +- タグ: コマンド ":tag" の後でのみ使われる +- ファイル名: ファイル名を取るコマンドの後、またはファイル名に対して設定される + オプションの設定時のみ使われる。これはファイル名補完と呼ばれる。 +- シェルコマンド名: ":!cmd"、":r !cmd"、":w !cmd" の後で使われる。$PATHが考慮 + される。 +- オプション: コマンド ":set" の後でのみ使われる。 +- マッピング: ":map" や類似コマンドの後でのみ使われる。 +- 変数/関数名: ":if", ":call" や類似コマンドの後でのみ使われる。 + +Vimが |+cmdline_compl| 機能付きでコンパイルされなかったときは、ファイル名、ディ +レクトリ名、ヘルプの項目のみが補完される。マッチするヘルプ項目の個数には上限が +ある(現在のところは 300)。非常に多くのマッチがあったとき、遅くなるのを避けるた +めである。 + +補完に使えるコマンドは以下の通り。 + + *c_CTRL-D* +CTRL-D カーソルより前のパターンに一致する名前を一覧表示する。ファイル + 名を表示しているときには、ディレクトリは強調表示される (オプショ + ン 'highlight' を参照)。オプション 'suffixes' の値がマッチした + 名前は、末尾の方に移動される。 + 'wildoptions' を "tagfile" にセットすると、マッチするタグを含 + むファイル名をリストすることができる。 + *c_CTRL-I* *c_wildchar* *c_* +オプション 'wildchar' で指定したキー + カーソルより前のパターンに対してマッチの検索が行われる。マッチ + (いくつかあるなら、最初のもの) が、そのパターンの位置に挿入さ + れる。( Note: これはマクロの中では機能しない。なぜなら + と は大抵 'wildchar' として使われ、またいくつかのマクロ + の中ではこれらが特別な意味を持つからである) このキーを再び入力 + すると、複数のマッチがあるときは、次のマッチが挿入される。最後 + のマッチの後には、最初のマッチが再び使われる (繰り返し)。 + この動作は、オプション 'wildmode' で変更できる。 + *c_CTRL-N* +CTRL-N 'wildchar' を使ったら複数のマッチがあったとき、その後に使うと + 次のマッチが挿入される。それ以外のときには、より最近使ったコマ + ンドラインを履歴から呼び出す。 + *c_CTRL-P* *c_* +CTRL-P 'wildchar' を使ったら複数のマッチがあったとき、その後に使うと + 前のマッチが挿入される。それ以外のときには、より昔に使ったコマ + ンドラインを履歴から呼び出す。 はGUI版、Amiga版と + MS-DOS版でのみ機能する。 + *c_CTRL-A* +CTRL-A カーソルより前のパターンに一致する、全ての名前が挿入される。 + *c_CTRL-L* +CTRL-L カーソルより前のパターンに対してマッチの検索が行われる。マッチ + が1個のときは、それがパターンの位置に挿入される。複数個のマッ + チがあったときは、最も長い共通部分がパターンの位置に挿入される。 + その結果がパターンより短い場合には、補完は行われない。 + */_CTRL-L* + 'incsearch' がセットされていると、"/" や "?" で検索パターンを + 入力するとき現在のマッチが表示され、CTRL-Lを押すと現在のマッチ + の末尾から1文字追加する。'ignorecase' と 'smartcase' がセット + されていてコマンドラインに大文字が含まれていないときは、追加さ + れた文字は小文字に変換される。 + *c_CTRL-G* */_CTRL-G* +CTRL-G 'incsearch' が設定され "/" や "?" にパターンを入力して現在のマ + ッチが表示されている時に、CTRL-G を押すと次のマッチに移動する( + |search-offset| は考慮しない)。CTRL-T を押すと前のマッチに移動 + する。ヒント: 通常のキーボードでは、T は G より上にある。 + *c_CTRL-T* */_CTRL-T* +CTRL-T 'incsearch' が設定され "/" や "?" にパターンを入力して現在のマ + ッチが表示されている時に、CTRL-T は前のマッチに移動する( + |search-offset| は考慮しない)。CTRL-G を使うと次のマッチに移動 + する。ヒント: 通常のキーボードは、T は G より上にある。 + +オプション 'wildchar' の既定値は である (Vi互換モードの場合は CTRL-E で +ある。以前のバージョンでは が使われていた)。パターンがファイル名に対して +適用されるときは標準のワイルドカード '*' と '?' が使用できる。'*' はあらゆる文 +字列に一致し、'?' はちょうど 1文字に一致する。 + +オプション 'wildignorecase' を設定するとファイル名の大文字と小文字を区別しない +ようにできる。 + +tcshのautolist補完が好みなら、このマッピングが使える。 > + :cnoremap X +(ここで X は使いたいコマンドキー。 は CTRL-L, は CTRL-D のこと) +これは最長のマッチを見つけ、マッチしたファイルを全て一覧表示する。 + +tcshのautolist補完が好みなら、オプション 'wildmode' を使ってその動作をエミュ +レートできる。例えば、次の設定は autolist=ambiguous という設定を真似る。 > + :set wildmode=longest,list +これは、最初の 'wildchar' で最長のマッチを見つけ、次はマッチするファイルを全て +一覧表示する。 + + *suffixes* +ファイル名補完では、オプション 'suffixes' を使い、ほぼ同じ名前のファイル名に優 +先度を設定できる。複数のマッチがあったとき、あるファイルの拡張子が 'suffixes' +の値に含まれていると、そのファイルは無視される。既定値は +".bak,~,.o,.h,.info,.swp" であり、これは ".bak", "~", ".o", ".h", ".info", +".swp" で終わるファイルが無視されることがあるということである。 + +空の項目(つまり2つの連続するコンマ)は "." を含まないファイル名(つまり拡張子を +持たない)にマッチする。これは "prog" を無視させ、かつ "prog.c" にマッチさせた +いときに便利である。 + +例: + + パターン: 存在するファイル: マッチ: ~ + test* test.c test.h test.o test.c + test* test.h test.o test.h and test.o + test* test.i test.h test.c test.i and test.c + +2つのドットを持つ拡張子を無視することはできない。 + +(オプション 'suffixes' による除外が行われた後で) マッチするファイルが複数個あ +るときは、最初のファイル名が挿入される。'wildchar' のキーを2度打ち込んでも補完 +されたマッチが同じだったら、マッチが1つしかないことが分かる。他のマッチは、 +'wildchar' のキーまたは CTRL-N, CTRL-P を入力することで得られる。それには +'suffixes' に設定された拡張子にマッチするものも含め、全てのファイルが含まれる。 + +ある拡張子のファイルを完全に無視するにはオプション 'wildignore' を使うこと。 + +入力されたテキストで終わるファイルにのみマッチさせるには、"$" をつけること。例 +として、".c" で終わるファイルにのみマッチさせるには: > + :e *.c$ +これは ".cpp" で終わるファイルにはマッチしない。"$" をつけないとマッチする。 + +オプションの、以前に設定された値は、'=' の後で 'wildchar' のキーを打ち込むこと +で得られる。例えば、":set dir=" の後で 'wildchar' のキーを打ち込むと、'dir' の +現在の値が挿入される。この動作は、ファイル名を取るオプションに対するファイル名 +補完より優先する。 + +xtermで を CTRL-P として使いたいときは、このコマンドをユーザーの +.cshrc に加えること。 > + xmodmap -e "keysym Tab = Tab Find" +そして次を .vimrc に加えること。 > + cmap [1~ + +============================================================================== +3. Exコマンドライン *cmdline-lines* + +Exコマンドはいくつかの特徴を持っている。 + + *:quote* *:comment* +行の最初に '"' があると、その行全てが無視される。'"' がコマンドの後にあると、 +その行の残りの部分が無視される。これはコメントを加えるために使われる。例: > + :set ai "set 'autoindent' option +シェルコマンド ":!cmd", コマンド ":map" とその他いくつかのコマンドにはコメント +を付けることができない。これらのコマンドは '"' を引数の一部として認識するから +である。各コマンドの説明のところにその旨の注意がある。 + + *:bar* *:\bar* +'|' を使ってコマンドを区切ることができる。これにより一行に複数のコマンドを書き +込める。引数に '|' を使いたいときは、'\' を前に置くこと。 + +以下のコマンドは '|' を引数として認識するため、後に他のコマンドを続けることは +できない。 + :argdo + :autocmd + :bufdo + :cdo + :cfdo + :command + :cscope + :debug + :folddoopen + :folddoclosed + :function + :global + :help + :helpfind + :lcscope + :ldo + :lfdo + :make + :normal + :perl + :perldo + :promptfind + :promptrepl + :pyfile + :python + :registers + :read ! + :scscope + :sign + :tcl + :tcldo + :tclfile + :vglobal + :windo + :write ! + :[range]! + 引数 "-bar" なしで定義されたユーザーコマンド |:command| + +Note: (Viから継承されたのだが) 次の点は混乱を招きやすいので注意: '|' は ":g" +と共に使うとコマンドの引数に含まれるが、":s" ではコマンドの区切りになる。 + +どうしても他のコマンドを使いたいときは、コマンド ":execute" を使うこと。 +例 (バッファに外部コマンド "ls" の出力を追加し、最初の行にジャンプする): > + :execute 'r !ls' | '[ + +例外が1点ある: オプション 'cpoptions' にフラグ 'b' が含まれるときは、":map", +":abbr" またはその類似コマンドの引数に '|' を使うとき、'\' の代わりに CTRL-V +を使う必要がある。代わりに "" を使うこともできる。|map_bar| も参照。 + +例: > + :!ls | wc 2つのコマンドの出力を見る + :r !ls | wc その出力をテキストに挿入する + :%g/foo/p|> 一致した全ての行をshiftwidth1個分ずらす + :%s/foo/bar/|> 1つの行をshiftwidth1個分ずらす + :map q 10^V| "q" に "10|" をマッピングする + :map q 10\| map \ l "q" に "10\" を、"\" に "l" をマッピングする + ('b' が 'cpoptions' に含まれるとき) +< + を使って、'|' と同様にコマンドを区切ることができる。 を挿入するには +CTRL-V CTRL-J を使うこと。すると "^@" が表示される。'|' を使う方が好ましいが、 +外部コマンドに対しては、'|' が外部コマンドに含まれてしまうため、 を使わな +ければならない。 の特別な作用を避けるためには、前に '\' を置く必要がある。 +例: > + :r !date-join +これは現在の日時をファイルに読み込み、それを前の行につなげる。 + +Note: '|' の前のコマンドがエラーを起こしたときは、以降のコマンドは実行されない +ことに注意。 + + +Viとの互換性のために、以下の奇妙なコマンドがサポートされている。 > + :| 現在行を表示する (":p" と同様) + :3| 3行目を表示する (":3p" と同様) + :3 3行目に移動する + +範囲とコマンド名の間にコロンを入れることができる。このコロンは無視される (これ +はVi互換の動作である)。例: > + :1,$:s/パターン/文字列 + +ファイル名が入るべき場所に、文字 '%' または '#' が使われているときは、それらは +カレントファイル名、代替ファイル名に展開される ("ファイルの編集" の章を参照 +|:_%| |:_#|)。 + +Amigaでは、引数がファイル名1個になるはずのとき、空白を含むファイル名が使用でき +る。ファイル名末尾の空白は、'\' や CTRL-V でエスケープされていない限り無視され +る。NOTE: コマンド ":next" では、ファイル名の区切りに空白を使うことに注意。ファ +イル名に空白を含むには、エスケープすること。例: > + :next foo\ bar goes\ to school\ +こうすると3個のファイル "foo bar", "goes to", "school " の編集を開始する。 + +コマンドで特別な文字 '"', '|' を使いたいとき、あるいはファイル名に '%', '#' を +使いたいときは、'\' を前に置く。範囲指定やコマンド ":substitute" では '\' は必 +要ない。|`=| も参照のこと。 + + *:_!* +Exコマンドの後に文字 '!' (bang) を置くと、コマンドの動作方法が変わる。'!' はコ +マンドの直後に置かなければならず、間に空白を入れてはならない。空白を挿入すると、 +'!' はコマンドの引数と見なされ、違った意味を持つことになる。例: > + :w! name 現在のバッファをファイル "name" に保存し、ファイルがす + でに存在していると上書きする + :w !name 現在のバッファを、標準入力からの入力としてコマンド + "name" に送る + +============================================================================== +4. Exコマンドラインの範囲 *cmdline-ranges* *[range]* *E16* + +Exコマンドには、その前に行単位の範囲を指定できるものがある。これは [range] と +表記される。それは ',' か ';' で区切られた、1個以上の行指定子から成る。 + +基本事項はユーザーマニュアルの |10.3| 章で説明されている。 + + *:,* *:;* +区切りに ';' を使うと、次の行指定子を解釈する前にカーソル位置がその行に移動 +する。',' ではこうならない。例: > + 4,/この行/ + 4行目から、カーソルより後の、"この行" がマッチする行まで。 + 5;/あの行/ + 5行目から、5行目より後の、"あの行" がマッチする行まで。 + +ほとんどのコマンドでは、範囲の既定値はカーソルのある行である。しかしコマンド +":write", ":global" での既定値はファイル全体 (1,$) である。 + +コマンドに必要以上の行指定子が指定されたときは、先頭の方に指定されたものから順 +に除外される。 + +行番号は以下の方法で指定できる: *:range* *E14* *{address}* + {number} 絶対的な行番号 + . 現在の行 *:.* + $ ファイルの最終行 *:$* + % 1,$と同じ (ファイル全体) *:%* + 't マーク tの位置 (小文字) *:'* + 'T マーク Tの位置 (大文字); マーク位置が別ファイルにある + ときには範囲指定には使えない + /{pattern}[/] 次に {pattern} のマッチする行 (下向き) *:/* + ?{pattern}[?] 次に {pattern} のマッチする行 (上向き) *:?* + \/ 次に直前の検索パターンのマッチする行 (下向き) + \? 次に直前の検索パターンのマッチする行 (上向き) + \& 次に直前の置換元パターンのマッチする行 (下向き) + +これらの後に '+' または '-' と数値を付けてもよい (複数も可)。この数は直前の行 +番号に加算または減算される。数が省略された場合は 1 が指定されたと見なされる。 + +{pattern} の後の "/" と "?" は、パターンとその後の項目とを区別するために必要と +なる。 + +"/" と "?" は別の場所指定の後に付くことがある。すると検索はそこから始まる。';' +との違いは、カーソルが移動しない点である。例: > + /pat1//pat2/ "pat1" を含む行より後の、"pat2" を含む行を見つける。こ + のときカーソルは移動しない。 + 7;/pat2/ 7行目より後の、"pat2" を含む行を見つける。このときカー + ソルは7行目に留まる。 + +{number} は 0 からファイルの行数までの数でなければならない。0 (零) を使うと、 +コマンドの大半では 1 と解釈される。その数をカウントとして使うコマンド (|:tag|, +|:pop| 等) では確かに 0 として使われる。0 を「先頭行の前」として解釈するコマン +ドもある (|:read|, 検索パターン等)。 + +例: > + .+3 カーソルの3行下 + /that/+1 次行より下の、"that" を含む行 + .,$ 現在行からファイル末尾まで + 0;/that "that" を含む最初の行 (第1行にもマッチ可能) + 1;/that 第1行より下の、"that" を含む行 + +いくつかのコマンドには、後にカウントを指定できる。そのコマンドは、最後の行指定 +子で指定された行 (既定値はカーソルの行) から始まる、そのカウントの行数の範囲に +使われる。カウントを取ることができるのは、範囲指定は取るがファイル名の引数を取 +らないコマンドである (ファイル名は数字でもよいから)。 + +例: > + :s/x/X/g 5 現在行から始まる5行で 'x' を 'X' に置換 + :23d 4 第23, 24, 25, 26行を削除 + + +折り畳みと範囲指定 + +折り畳みがアクティブなときは、閉じられた折り畳み全体を含むように範囲が切り上げ +/切り下げられる。|fold-behavior| を参照。 + + +逆向きの範囲指定 *E493* + +範囲には小さい行番号を先に指定しなければならない。そうでないときは、Vimはその +行番号を入れ替えてよいかを尋ねる。 + Backwards range given, OK to swap ~ +ただしグローバルコマンド ":g" では尋ねない。 + +コマンドの前に ":silent" をつけるとこの質問が出ないようになる。そのときは常に +範囲が入れ替えられる。 + + +カウントと範囲指定 *N:* + +":" を入力する前にカウントを指定すると、次のように変換される。 > + :.,.+(count - 1) +つまりカーソルの行から始まる [count] 行のことである。例: 3行を削除するにはこう +する。 > + 3:d は .,.+2d に変換される +< + +ビジュアルモードと範囲指定 *v_:* + +{Visual}: ビジュアルに選択された行を範囲として、コマンドライン入力を始め + る。この範囲指定にはコード `:'<,'>` が使われるので、コマンドラ + イン履歴から同様のコマンド行を呼び出して、別のビジュアル選択行 + にコマンドを繰り返すことができる。 + ビジュアルモードがすでに終了しているときは、`:*` を使うことで + 簡単にビジュアル選択を範囲指定できる。ただし "*" が 'cpo' オプ + ションに含まれているときは使えない (|cpo-star| 参照)。そのとき + は `:'<,'>` を使う必要がある。 + + +============================================================================== +5. Ex コマンドラインのフラグ *ex-flags* + +以下のフラグがExコマンドの選択においてサポートされている。 +これらはコマンドを実行した後にカーソルが移動する位置の行を表示する: + + l |:list|のように表示する + # 行番号をつける + p |:print|のように表示する + +これらのフラグは組み合わせることができる。つまり "l#" とすると行番号をつけて +":list" のスタイルで表示する。 + +============================================================================== +6. Exコマンド用の特別な文字 *cmdline-special* + +Note: 以下はコマンドラインの実行における特別な文字である。CTRL-Rコマンドを使う +とこれらの特別な文字列を挿入することができる。例えば "%" は現在のファイル名を +表す。CTRL-R %とするとその場に現在のファイル名を挿入する。|c_CTRL-R|を参照。 + +Note: Vim script 内で特別な文字をエスケープするには |fnameescape()| を使うとよ +いかもしれない。|`=| も参照のこと。 + +Exコマンドの、ファイル名が使えるところでは、以下の文字は特別な意味を持つ。これ +らは式や関数 |expand()| 内でも使うことができる。 + % カレントファイル名に置き換えられる。 *:_%* *c_%* + # 代替ファイル名に置き換えられる。 *:_#* *c_#* + これはウィンドウごとに記憶される。 + #n (ここで n は数) バッファ n のファイル名に置き *:_#0* *:_#n* + 換えられる。"#0" は "#" と同じ。 *c_#n* + ## 引数リスト内の全てのファイル名を、空白で区切って *:_##* *c_##* + 列挙したものに置き換えられる。ファイル名の中の空白には、 + 全て前に '\' が付けられる。 + # 0 の数値)。 *:_#<* *c_#<* + n 番目の old file 名に置き換えられる。 + この番号については |:oldfiles| や |v:oldfiles| を参照。 + *E809* + {|+eval| と |+viminfo| 機能つきでコンパイルされたときのみ有効} + +Note: "# + :!ls "%" + :r !spell "%" + +'%' と '#' の特別な意味を避けるためには、その前に '\' を挿入する。 +詳細: これらの文字の特別な意味は、'\' がその前に置かれれば、それがいくつあるか +に関わらず、常にエスケープ (無効化) される。 + 打ち込むキー: 結果 ~ + # 代替ファイル名 + \# # + \\# \# +|`=| も参照のこと。 + + *:* *:* *:* ** + *:* ** *:* ** + *:* ** *:* ** + ** *E495* *E496* *E497* *E499* *E500* +Note: これらは文字通りに打ち込まれる、これらは特別なキーではない! + カーソル下の word に置き換えられる (|star| と同様) + カーソル下の WORD に置き換えられる (|WORD| を参照) + カーソル下のパス名に置き換えられる (|gf| が使うものと同様) + 自動コマンドの実行時、ファイルの読み書き用のファイル名に置 + き換えられる + 自動コマンドの実行時、カレントバッファの番号に置き換えられ + る (":r file" と ":so file" のときにもカレントバッファの番 + 号に置き換えられる。読み込まれているファイルはバッファ内に + ない) + 自動コマンドの実行時、この自動コマンドが実行されたときのマッ + チに置き換えられる。そのファイル名がマッチの検索に使われて + いないときのみ、 と違う値になる (イベント FileType、 + Syntax、SpellFileMissing 用)。 + コマンド ":source" の実行時、取り込まれたファイルのファイル + 名に置き換えられる。 *E498* + 関数の実行時はこのように置き換えられる: + "function {関数名}[{行番号}]" + 関数呼び出しのネスト (入れ子状態) はこのように表される: + "function {関数名1}[{行番号}]..{関数名2}[{行番号}]" + Note 関数内で が使われている場合、ファイル名修飾子 + は無効になることに注意。 + コマンド ":source" の実行時、行番号に置き換えられる。 *E842* + 関数の中では、関数の先頭からの相対的な行番号になる。 + + *filename-modifiers* +*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S* + *%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S* +ファイル名修飾子は "%", "#", "#n", "", "", "", "" +の後で使うことができる。これらは関数 |fnamemodify()| と使うこともできる。Vim +が |+modify_fname| 機能付きでコンパイルされていなければ、これらの修飾子を使う +ことはできない。 +これらの修飾子は次の順で指定できる。 + :p ファイル名を完全パスにする。最初の修飾子でなければならない。 + また "~/" (およびUnixやVMSで使われる "~user/" の形式のもの) も + ホームディレクトリのパスに変換する。これが付けられたものがディ + レクトリ名に展開されるならば、パスの区切り文字が末尾に追加され + る。これが付けられたものが、ディスク上に存在せず絶対パスを持た + ないファイルに展開されるときは、結果は予期できない。MS-Windows + では 8.3 形式のファイル名はロングファイル名に展開される。 + :8 パスを短い8.3形式に変換する (現在のところ MS-Windows 版での + み)。パスの内、実際に存在する部分に対して機能する。 + :~ ファイル名をホームディレクトリについて相対的な名前に (可能なら + ば) 切り詰める。ファイルがホームディレクトリの下になければ、ファ + イル名は修正されない。 + :. ファイル名をカレントディレクトリについて相対的な名前に (可能な + らば) 切り詰める。ファイル名がカレントディレクトリの下になけれ + ば、ファイル名は修正されない。 + 最も短く切り詰めるには ":~:." を使う。 + :h ファイル名のヘッド (末尾の部分と全ての区切りが除かれたもの)。 + :e, :r, :t には使えない。 + 繰り返すと、末尾から順に複数の部分を取り除くことができる。 + ファイル名がパス区切りで終わるときは、パス区切りのみが取り除か + れる。そのためディレクトリ名に ":p:h" を使うと、(末尾にパス区 + 切りなしの) ディレクトリ名そのものが得られる。 + ファイル名が絶対パス (Unixでは "/"; MS-DOS, WIN32, OS/2では + "x:\"; Amigaでは "drive:" で始まるもの) のときは、この部分は取 + り除かれない。ヘッドがないときは (パスがカレントディレクトリに + 対して相対的なとき)、結果は空となる。 + :t ファイル名のテイル (名前の末尾の部分)。:r または :e よりも前に + 指定しなければならない。 + :r ファイル名のルート (最後の拡張子が取り除かれたもの)。拡張子だ + けしかないときは ('.' で始まるファイル名、例えば ".vimrc" 等)、 + それは取り除かれない。繰り返し使うと、複数の拡張子を (最後のも + のから順に) 取り除くことができる。 + :e ファイル名の拡張子。単独で使われたときのみ意味を持つ。 + 拡張子がないときは、結果は空となる。 + 拡張子だけしかないときは ('.' で始まるファイル名)、結果は空と + なる。繰り返すと、複数の拡張子が得られる。繰り返した回数より拡 + 張子の数の方が少ないときは、可能なだけ取り込まれる (しかし最低 + でも1個はないと取り込まれない)。 + :s?pat?sub? + 最初に "pat" に一致したものを "sub" に置き換える。これはコマン + ド |:s| と同様に機能する。"pat" は正規表現である。'?' には任意 + の文字を使えるが、"pat" や "sub" 内に現れてはならない。 + この後、上述の修飾子を再び使うことができる。例えば、":p" では + 置換した後でフルパスに変える。 + :gs?pat?sub? + "pat" に一致したものを全て "sub" に置き換える。その他の点では + ":s" と同様に機能する。 + :S シェルコマンドで利用できるように特別な文字をエスケープする。 + (|shellescape()|を参照)。最後でなければならない。例: > + :!dir :S + :call system('chmod +w -- ' . expand('%:S')) + +ファイル名が "src/version.c"、カレントディレクトリが "/home/mool/vim" のときの +例: > + :p /home/mool/vim/src/version.c + :p:. src/version.c + :p:~ ~/vim/src/version.c + :h src + :p:h /home/mool/vim/src + :p:h:h /home/mool/vim + :t version.c + :p:t version.c + :r src/version + :p:r /home/mool/vim/src/version + :t:r version + :e c + :s?version?main? src/main.c + :s?version?main?:p /home/mool/vim/src/main.c + :p:gs?/?\\? \home\mool\vim\src\version.c + +ファイル名が "src/version.c.gz" のときの例: > + :p /home/mool/vim/src/version.c.gz + :e gz + :e:e c.gz + :e:e:e c.gz + :e:e:r c + :r src/version.c + :r:e c + :r:r src/version + :r:r:r src/version +< + *extension-removal* *:_%<* +"%", "#", "#n" または "CTRL-V p" に "<" を付け加えたとき、ファイル名の拡張子 +(ファイル名の最後の '.' とそれ以降の全て) は取り除かれる。これは +Vim version 3.0 との下位互換性のために残されており、":r" 形式を使う方がよい。 +例: > + + % カレントファイル名 + %< 拡張子なしのカレントファイル名 + # カレントウィンドウでの代替ファイル名 + #< 同上、ただし拡張子なし + #31 代替ファイル番号31 + #31< 同上、ただし拡張子なし + カーソル下の word + カーソル下の WORD (|WORD| を参照) + カーソル下のパス名 + < 同上、ただし拡張子なし + +Note: ファイル名が来る筈の所では、ワイルドカードの展開が行われる。Unixでは展開 +にはシェルが使われる。ただしVim内部でできない展開だけである (スピードのため)。 +|restricted-mode| でなければ、バッククォート '`' も次のように使える。 > + :n `echo *.c` +しかし展開は、'%' や '#' 等が展開される前にワイルドカードが存在したときにのみ +行われる。これはファイル名に含まれるワイルドカードを展開しないためである。 + の結果を展開したいときは、ワイルドカードの文字を追加すればよい。 +例: (代替ファイル名は "?readme?" とする) + コマンド 展開結果 ~ + :e # :e ?readme? + :e `ls #` :e {"?readme?" にマッチしたファイル全て} + :e #.* :e {"?readme?.*" にマッチしたファイル全て} + :cd :cd {カーソル下のファイル名} + :cd * :cd {カーソル下のファイル名に "*" を加え展開したもの} +|`=| も参照のこと。 + +展開された後のコマンド引数に "!" に含まれていて、それがシェルコマンドに使われ +る (":!cmd", ":r !cmd" や ":w !cmd") とき、"!" は '\' でエスケープされ、前回の +コマンドに展開されるのを防ぐ。オプション 'shell' の値が "sh" を含むときは、エ +スケープは2回行われ、シェルが "!" を展開するのを防ぐ。 + + *filename-backslash* +'\' をディレクトリの区切りに使うファイルシステム (MS-DOS、Windows、OS/2) では、 +次のキャラクタの特別な意味をエスケープする目的の '\' を認識するのが少し困難で +ある。一般的な規則は次の通り。'\' が普通のファイル名の文字の後にある場合は、特 +別な意味を持たない。したがって、"\file\foo" は有効なファイル名であり、'\' を2 +度打つ必要はない。 + +例外は '$' 記号である。これはファイル名で有効な文字である。しかし "$home" のよ +うなファイル名が環境変数として解釈されるのを避けるため、'\' をこの前に付ける必 +要がある。従ってルートディレクトリのファイル "$home" の指定には、"/\$home" を +使う必要がある。いくつかの例: + + ファイル名 その解釈 ~ + $home 環境変数 $home の値に展開される + \$home カレントディレクトリのファイル "$home" + /\$home ルートディレクトリのファイル "$home" + \\$home "\\" の後に $home の値を付け加えた名前のファイル + +|`=| も参照のこと。 + +============================================================================== +7. コマンドラインウィンドウ *cmdline-window* *cmdwin* + *command-line-window* + +コマンドラインウィンドウでは、普通のウィンドウでテキストを編集するのと同じよう +にコマンドラインを編集できる。コマンドラインウィンドウは特殊なウィンドウで、普 +通の方法でそこから出ることはできない。 +{Vimが |+cmdline_hist| 機能と |+vertsplit| 機能付きでコンパイルされたときのみ +有効である。} + + +開 始 *c_CTRL-F* *q:* *q/* *q?* + +コマンドラインウィンドウを開くには2通りの方法がある。 +1. コマンドラインモードで、オプション 'cedit' で指定されたキーを使う。 + 'compatible' がオフのときの既定値は CTRL-F である。 +2. ノーマルモードで、コマンド "q:", "q/" または "q?" を使う。 + "q:" でExコマンドラインの編集を始め、"q/" または "q?" で文字列を検索する。 + Note: 打ち込んだキーの記録中にはこの方法は使えないことに注意 (そのときは + "q" では記録が終了する)。 + +コマンドラインウィンドウが開かれたとき、中にはコマンドラインの履歴が並んでいる。 +末尾の行には、その時点までに打ち込まれたコマンドが含まれる。左の列には、編集さ +れているコマンドラインの種類を表す1文字が表示される。|cmdwin-char| を参照。 + +コマンドラインウィンドウが開かれたとき、Vimはノーマルモードに移るが、オプショ +ン 'insertmode' がオンのときは挿入モードに移る。 + +コマンドラインウィンドウの高さはオプション 'cmdwinheight' で指定できる (ただし +余裕がないとこれより低くなる)。常に幅は最大になり、場所はコマンドラインの直上 +である。 + + +編 集 + +コマンドラインウィンドウ内では、コマンドを使ってあちこちへ移動したり、ウィンド +ウ内のテキストを編集できる。ノーマルモードと挿入モードが使える。 + +":" や "/" を始めとする、コマンドラインを使うコマンドも使えるが、そこから別の +コマンドラインウィンドウを開くことはできない。コマンドラインウィンドウはネスト +(入れ子状になること) できない。 + *E11* +コマンドラインウィンドウは普通のウィンドウではないので、別のウィンドウに移動し +たり、別のバッファを編集したりはできない。コマンドラインウィンドウでは、それら +を行うコマンドは無効化されている。もちろんコマンドラインウィンドウで入力したコ +マンドならどんなものでも 実 行 可 能 である。他のテキスト編集はコマンドライン +ウィンドウを閉じるときに破棄される。 + + +終 了 *E199* + +コマンドラインウィンドウを終了するには、以下の通りの方法がある。 + + カーソル下のコマンドラインを実行する。挿入モードとNormalモー + ドの両方で有効である。 +CTRL-C コマンドラインモードとして継続する。カーソル下のコマンドライン + が引き継がれる。挿入モードとノーマルモードの両方で有効である。 + 再描画は行われないので、ウィンドウは可視状態のままになる。 +:quit コマンドラインを破棄してノーマルモードに戻る。 + ":close", ":exit", ":xit" や CTRL-\ CTRL-N も有効である。 +:qall Vimを終了する (他のバッファに変更がない限り)。 +:qall! Vimを終了し、どのバッファの変更も破棄する。 + +コマンドラインウィンドウが閉じられると、他のウィンドウのサイズは復元される。実 +行されたコマンドはコマンドラインウィンドウの開始元のウィンドウやバッファに適用 +される。これはコマンドラインウィンドウがなかったかのように動作するが、画面の再 +描画だけは余計に行われる。 +コマンドラインウィンドウに使われたバッファは削除される。 で実行された行以 +外に対する変更は、全て失われる。 + +カーソル下のコマンドを実行した後、もう一度コマンドラインウィンドウを開きたけれ +ば、このマップを使うとよいかもしれない: > + + :autocmd CmdwinEnter * map q: + + +そ の 他 + +コマンドラインウィンドウは、以下のときには使えない。 +- 既にコマンドラインウィンドウを開いているとき (ネストすなわち入れ子は不可) +- 暗号化キーの入力時や関数 |inputsecret()| の使用時 +- Vimが |+vertsplit| 機能付きでコンパイルされていないとき + +コマンドラインウィンドウが開かれると、以下のオプションの設定が変わる。 +'filetype' "vim" (Exコマンドラインの編集時に) これは、可能ならVim script + に対する構文強調表示を開始する +'rightleft' オフ +'modifiable' オン +'buftype' "nofile" +'swapfile' オフ + +コマンドラインウィンドウの内容をファイルに書き出すことができる。こうすれば、簡 +単にコマンドライン履歴を保存し、後で読み込むことができる。 + +オプション 'wildchar' が であり、コマンドラインウィンドウがExコマンドに +対して使われているときは、以下の2個のマッピングが追加され、コマンドラインウィ +ンドウ内でも で補完ができるようになる。 > + :imap + :nmap a +Note: ノーマルモードで を打ち込むと、カーソルの次の文字の位置で補完を行 +うことに注意。この方法なら行末でも補完が行われる。 +それらのマッピングを望まないなら、次のようにして無効化すること。 > + au CmdwinEnter [:>] iunmap + au CmdwinEnter [:>] nunmap +ユーザーの .vimrc ファイルに上の行を書き込んでおけばよい。 + +コマンドラインウィンドウ内では、マウスでカーソルを別のウィンドウに移したり、別 +のウィンドウのステータスラインをドラッグしたりはできない。コマンドラインウィン +ドウ自身のステータスラインはドラッグできる。上向きにずっとドラッグすると、直上 +のウィンドウのステータスラインも動き、コマンドラインウィンドウがさらに広くなる。 + +|getcmdwintype()| 関数は開いているコマンドラインの種類を返す。値の説明は +|cmdwin-char| 参照。 + + +自動コマンド の 適 用 + +2種類の 自動コマンドのイベントが使われる: |CmdwinEnter| と |CmdwinLeave|。コマ +ンドラインウィンドウは特別なウィンドウなので、イベント WinEnter, WinLeave, +BufEnter, BufLeave は発生しない。コマンドラインウィンドウに対して特別に設定を +するには、イベント Cmdwin を使う。副作用を引き起こさないよう注意! +例: > + :au CmdwinEnter : let b:cpt_save = &cpt | set cpt=. + :au CmdwinLeave : let &cpt = b:cpt_save +これはカレントウィンドウで |i_CTRL-N| によって補完を行うよう 'complete' を設定 +する。 +別の例: > + :au CmdwinEnter [/?] startinsert +こうすれば、コマンドラインウィンドウではVimは挿入モードに移る。 + + *cmdwin-char* +パターンに使われる文字は、コマンドラインの種類を表す。 + : 普通のExコマンド + > デバッグモードのコマンド |debug-mode| + / 前方検索に使われる文字列 + ? 後方検索に使われる文字列 + = Expressionレジスタ "= 用の expression |expr-register| + @ 関数 |input()| に対して入力する文字列 + - コマンド |:insert| や |:append| に対して入力する文字列 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/debug.jax b/plugins/vimdoc-ja/doc/debug.jax new file mode 100644 index 0000000000..5baa26a470 --- /dev/null +++ b/plugins/vimdoc-ja/doc/debug.jax @@ -0,0 +1,180 @@ +*debug.txt* For Vim バージョン 8.0. Last change: 2012 Feb 11 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vim のデバッグ *debug-vim* + +Vim のデバッグ方法についての説明です。 +Vim script や関数などのデバッグについては、|debug-scripts| を参照してください。 + +1. gcc と gdb を使ってクラッシュの場所を特定する |debug-gcc| +2. メモリリークの検出 |debug-leaks| +3. Windows でのバグレポート |debug-win32| + +============================================================================== + +1. gcc と gdb を使ってクラッシュの場所を特定する *debug-gcc* *gdb* + +テストファイルで Vim がクラッシュした場合、gcc を使っているなら、以下の方法で +場所を特定できます。MinGW でも同じようにできます。 + +1. "-g" オプション付きで Vim をコンパイル (src/Makefile にそのための行があるの + で、それをコメントアウトしてください)。さらに "strip" を無効化 (strip をイ + ンストールしないか、"STRIP = /bin/true" の行を使う)。 + +2. 次のコマンドを実行 ("11" の所を失敗したテストの番号に変えてください): > + cd testdir + gdb ../vim + run -u unix.vim -U NONE -s dotest.in test11.in + +3. Vim のクラッシュを確認。gdb がメッセージを表示します。 + +4. 次のコマンドでスタックトレースを表示できます: > + where +< 次のコマンドで別の場所のスタックトレースを表示できます: > + frame 3 +< "3" のところにスタックトレースの番号を指定してください。 + +============================================================================== + +2. メモリリークの検出 *debug-leaks* *valgrind* + +もし Vim がメモリリークを起こしているような感じがして、そしてあなたが Linux を +使っているなら、valgrind ツールを使うことでメモリリークをピンポイントで検出す +ることができます。 + +まず、Vim を EXITFREE の定義付きでビルドします。MAKEFILE を検索して該当行のコ +メントを外してください。 + +次のコマンドで Vim を起動してください: +> + valgrind --log-file=valgrind.log --leak-check=full ./vim + +Note: Vim の実行はとても遅くなります。.vimrc が大きかったり多くのプラグインを +入れていたりすると起動にとても時間がかかるので、その場合は "-u NONE" 引数を指 +定して起動してみてください。 + +ライブラリがメモリリークを起こしている場合もあります。例えば getpwuid() や +XtVaAppCreateShell() などです。それらを避けることはできません。リークしている +バイト数は数キロバイト以下のはずです。 + +============================================================================== + +3. Windows でのバグレポート *debug-win32* + +Windows版の Vim が再現可能な手段でクラッシュした場合、次の方法で有用なバグレ +ポートを作成できます。 + +3.1 一般事項 ~ + +実行ファイルに対応したデバッグシンボルファイル (PDB) を用意してください。 +gvim.exe には gvim.pdb、vim.exe には vim.pdb が必要です。あなたが実行ファイル +を入手したのと同じ場所に用意されているはずです。EXE に対応した (同じ日付の) +PDB でなければいけません。 + +Microsoft Visual C++ コンパイラを使って自分で実行ファイルを作成した場合は、PDB +は EXE といっしょに作成されています。 + +他の方法もあります。ソースファイルを入手し、Visual Studio のワークスペースに +Make_ivc.mak を取り込んでください。そして、デバッグの設定を選択し、ビルドして +ください。ブレークポイントの設定や変数の監視など、すべてのデバッグ機能が使えま +す。 + +Visual Studio を持っている場合はそれを使ってください。VC Toolkit と WinDbg は +必要ありません。 + +他のコンパイラを使っている場合は、それぞれ適切なデバッガを使ってください。 +Borland コンパイラで作成した Vim 実行ファイルなら TD を使ってください。Cygwin +または MinGW のコンパイラなら gdb を使ってください (上記参照 |debug-gcc|)。 + + + *debug-vs2005* +3.2 Visual Studio 2005/Visual C++ 2005 Express で Vim をデバッグする ~ + +vim.exe か gvim.exe を起動し、Visual Studio を起動してください。(Visual Studio +を持っていない場合は、|get-ms-debuggers| の説明に従って、無料の Visual C++ +2005 Express Edition を入手してください。) + +メニューから「ツール/プロセスにアタッチ」を選択し、Vim のプロセスを選択します。 + +そして、Vim を操作してクラッシュを再現します。「ハンドルされていない例外が発生 +しました」という Visual Studio のダイアログが表示されるので、中断ボタンをク +リックしてプロセスを中断してください。 + +シンボルが読み込めず、ソースコードを表示できなかったときは、もう一つダイアログ +が表示されます。OK をクリックしてください。 + +ウィンドウがいくつか開きます。呼び出し履歴ウィンドウの右クリックメニューから +「シンボルの読み込み」を選択してください。シンボル検索ダイアログが開くので、 +(g)vim.pdb のあるディレクトリを選択してください。 + +このとき、呼び出し履歴ウィンドウには Vim の関数名や行番号が表示されているはず +です。どれかをダブルクリックするとソースの検索ダイアログが表示されます。Vim の +ソースがあるディレクトリを選択してください (もしソースがあるなら)。 + +さらに詳しくデバッグする方法が分からないときは、":help bug-reports" の説明に +従ってください。バグレポートに呼び出し履歴を貼り付けてください。 + +有料版の Visual Studio を使っている場合は、デバッグメニューから minidump を保 +存できるので、それをバグレポートに添付してください。minidump は 100KB 以下の小 +さなファイルで、Vim のプロセスに関する情報が入っています。 +Visual C++ 2005 Express Edition では minidump を保存できません。just-in-time +デバッガ (クラッシュを検出して自動的に起動されるデバッガ) もインストールされま +せん。それらが必要なときは WinDbg (|debug-windbg|) を使ってください。 + + *debug-windbg* +3.3 WinDbg を使って Vim をデバッグする ~ + +WinDbg の入手方法は |get-ms-debuggers| を参照してください。 + +Visual Studio IDE を使うのと同じように、WinDbg から Vim のプロセスにアタッチで +きます。プログラムがクラッシュしたときに、事後分析デバッガ (postmortem +debugger) として、WinDebug を自動的に起動することができます。事後分析デバッガ +として WinDeb を設定するには "windbg -I" を実行してください。 + +WinDbg から、実行中の Vim のプロセスにアタッチするには、WinDeb を起動し、File +メニューから「プロセスにアタッチ」を選択し、Vim のプロセスを選択して OK をク +リックします。 + +メニューから「File->Symbol File Path」を選択し、Vim PDB の入っているフォルダを +symbolpath に追加してください。Vim のソースファイルもある場合は、File メニュー +のSource File Path を使ってください。WinDbg でソースファイルを開いたり、ブレー +クポイントを設定したりできます。Vim をクラッシュさせると、クラッシュした場所の +ソースファイルが WinDbg で開かれます。View メニューを使って、コールスタック、 +ローカル変数、ウォッチウィンドウなどを見ることができます。 + +事後分析デバッガとして WinDbg を使っている場合、WinDbg から Vim のプロセスにア +タッチする必要はありません。Vim をクラッシュさせるだけで WinDbg が自動的に起動 +します。上述のように、シンボルファイルパスとソースファイルパスを設定してくださ +い。 + +minidump を保存するには、WinDbg コマンドラインで次のコマンドを入力します: > + .dump vim.dmp +< + *debug-minidump* +3.4 Minidump を開く ~ + +Visual Studio か WinDbg を使って minidump を開くことができます。 + +Visual Studio 2005 の場合: メニューから「ファイル->開く->プロジェクト/ソリュー +ション」選択し、.dmp ファイルを開いてください。F5 キーを押してデバッガを起動し +ます。Symbol File Path の設定について |debug-vs2005| の説明も参照してくださ +い。 + +WinDbg の場合: メニューから「File->Open Crash Dump」を選択します。Symbol File +Pathの設定について |debug-windbg| の説明も参照してください。 + + *get-ms-debuggers* +3.5 Microsoft デバッグツールの入手方法 ~ + +Windows 用のデバッグツールは次の場所からダウンロードできます + http://www.microsoft.com/whdc/devtools/debugging/default.mspx +これには WinDbg デバッガが含まれています。 + +Visual C++ 2005 Express Edition は次の場所からダウンロードできます。無料です。 + http://msdn.microsoft.com/vstudio/express/visualC/default.aspx + +========================================================================= + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/debugger.jax b/plugins/vimdoc-ja/doc/debugger.jax new file mode 100644 index 0000000000..4f5cb66536 --- /dev/null +++ b/plugins/vimdoc-ja/doc/debugger.jax @@ -0,0 +1,133 @@ +*debugger.txt* For Vim バージョン 8.0. Last change: 2005 Mar 29 + + + VIMリファレンスマニュアル by Gordon Prieur + + +デバッガ支援機能 *debugger-support* + +1. デバッガ機能 |debugger-features| +2. Vimのコンパイルオプション |debugger-compilation| +3. 統合デバッガ |debugger-integration| + +{Vi にはこれらの機能は無い} + +============================================================================== +1. デバッガ機能 *debugger-features* + +以下の機能はデバッガ、統合プログラミング環境(IPE)、統合開発環境(IDE)との統合に +利用できる: + + もう1つのコマンド入力 |alt-input| + デバッグ目印 |debug-signs| + デバッグソースコード強調 |debug-highlight| + メッセージフッター |gui-footer| + バルーンウィンドウ |balloon-eval| + +これらの機能はMotifバージョンのgvimで使うために特別に追加された。しかしなが +ら、|alt-input| と |debug-highlight|はvimとgvimでも使用できるように書かれてい +る。その他の機能は非GUIバージョンのVimでもわずかな変更で使うことができる。だ +が、著者はそのような変更をしていないし、Motif GUIではないバージョンのVimではテ +ストしていない。 + + +1.1 もう1つのコマンド入力 *alt-input* + +Vimがデバッガと協調動作するには、最低限デバッガや外部ツールからの入力のための +接続が必要である。多くの場合は出力のための接続も必要であるがこれは絶対に必要と +いうわけではない。 + +外部デバッガがVimにコマンドを送ることが入力接続の目的である。デバッガから送ら +れるコマンドは現在のデバッグ環境や状態を表示するために充分である必要がある。 + +現在の実装はXツールキット(X Toolkit)の発送ループとXtAddInput()ファンクション +コールを基本にしている。 + + +1.2 デバッグ目印 *debug-signs* + +多くのデバッガは小さな目印を表示したりその行を色で強調することで特定の行に印を +付ける。デバッガは|:sign|コマンドを使って(Vimに)グラフィカルな目印を設定させる +ことができる。この機能の使われ方の一例は、デバッグしているプログラムの実行位置 +(プログラムカウンタ:PC)を表示するのにデバッガが表示する矢印に見る事ができる。 +別の例ではブレークポイントを示す小さな停止記号がある。これらの視覚的な強調は +ユーザーがデバッガ状態の経過を追う助けになる。 + +この機能はデバッガ以外の用途にも使用できる。IPEはビルドエラー、検索したテキス +ト、その他を強調するのに何かしらの目印を使用する。この機能は印がより高い視認性 +を確保するために|debug-highlight|と一緒に利用できる。 + +デバッグ目印は|:sign|コマンドを使って定義、設置する。 + + +1.3 デバッグソースコード強調 *debug-highlight* + +この機能により行に優れた強調を施すことができる。これは特定の行を目立たせること +を目的としている。この強調はvimとgvim両方で動作させることができ、gvimに限り多 +くの場合デバッグ目印と一緒に使うことができる。唯一の例外はSun Microsystemの +dttermである。dttermには目印を表示するためのスペースがある。{訳注: なので、こ +れを利用する際はコンソールvimでも目印を利用可能となる} + + +1.4 メッセージフッター *gui-footer* + +メッセージフッターはデバッガやIPEからのメッセージを表示するのに使用する。また +メニューやツールバーのtips(一言ヒント)を表示するのにも使用できる。GUIウィンド +ウの下のフッターエリアは、Exコマンドを表示する行のさらに下に位置する。 + +フッターエリアの表示・非表示は 'guioptions' の 'F' フラグで制御する。 + + +1.5 バルーンウィンドウ *balloon-eval* + +この機能はデバッガや外部ツールに、マウスが指す位置に応じた動的な情報を表示する +機能を提供する。この機能は「Sun's Visual WorkShop」のデバッガに式の評価結果を +表示させることを目的とした。しかしながら、その他の情報を表示するのに利用できる +よう、可能な限り一般的な様式で実現されている。 + +バルーンウィンドウには幾つかの設定可能なパラメーターがある。Motifではフォント +リストと色はXリソース経由で設定される(XmNballoonEvalFontList, +XmNballoonEvalBackground, XmNballoonEvalForeground)。 +オプション 'balloondelay' はバルーンを表示するまでの遅延時間を設定する。 +この機能を有効にするにはオプション 'ballooneval' をオンにする必要がある。 + +バルーンウィンドウは|+balloon_eval|機能をコンパイル時にした時のみ利用できる。 + +バルーンウィンドウ関数はツールバーのツールチップを表示する際にも利用されてい +る。これにはオプション 'ballooneval' を設定する必要はない。しかしその他の設定 +はこのツールチップにも適用される。 + +バルーンウィンドウを使うもう1つの方法は、オプション 'balloonexpr' を使うことで +ある。これは完全にユーザーが定義できる。 + +============================================================================== +2. Vimのコンパイルオプション *debugger-compilation* + +デバッガ機能はSunの「Visual WorkShop Integrated Programming Environment」(ipe) +と一緒に使うために明示的に加えられた。しかし、それらのSunのipeと共に使用する機 +能は他のデバッガも一部もしくは全部を使うことができるように、可能な限り一般的な +様式で実現されている。 + +以下のコンパイル時のプリプロセッサー変数で機能の有無効を制御する: + + もう1つのコマンド入力 ALT_X_INPUT + デバッグ目印 FEAT_SIGNS + デバッグソースコード強調 FEAT_SIGNS + メッセージフッター FEAT_FOOTER + バルーンウィンドウ FEAT_BEVAL + +最初の完全なIPE/IDEとの統合はSun Visual WorkShopである。gvimをVWSとのインター +フェイスを有効にしてコンパイルするには次のフラグを設定する。これにより上で述べ +た全てのフラグを設定される: + + Sun Visual WorkShop FEAT_SUN_WORKSHOP + +============================================================================== +3. 統合デバッガ *debugger-integration* + +完全に統合されたデバッガ/IPE/IDEは、唯一Sunの「Visual WorkShop Integrated +Programming Environment」だけである。 + +SunのNetBeansのサポートについては|netbeans|を参照。 + + vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/develop.jax b/plugins/vimdoc-ja/doc/develop.jax new file mode 100644 index 0000000000..b8f36e9b37 --- /dev/null +++ b/plugins/vimdoc-ja/doc/develop.jax @@ -0,0 +1,536 @@ +*develop.txt* For Vim バージョン 8.0. Last change: 2017 Jan 05 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vimの開発 *development* + +この文書は、Vimの更なる開発に参加しようという人にとって重要である。 + +1. 設計上の目標 |design-goals| +2. コーディングスタイル |coding-style| +3. 決定事項 |design-decisions| +4. 想定していること |design-assumptions| + +ソースコードの概要については "src" ディレクトリのREADME.txtを見てください。 + +Vimはオープンソースソフトウェアです。誰でもVimの開発に協力できます。パッチを送 +る時はなるべく "context diff" 形式 ("diff -c" で作る) でお願いします。 +http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch も見てください。 + +============================================================================== +1. 設計上の目標 *design-goals* + +重要度の順に従って書かれている(大雑把であるが)。 + +かなりの項目が矛盾していることを注意しておく。これは故意である。それらの +間で、バランスを取っていかねばならない。 + + +VIM IS... VI COMPATIBLE *design-compatible* + +何より、VimはViの気軽な置き換えとして使うことができるべきである。ユーザーが望 +むなら、Vimを、オリジナルのViとの区別がほとんど付かない互換モードで使うことが +できる。 + +例外: +- 明白なViのバグをVimに再現しない。 +- Viには異なるバージョンが存在する。私はバージョン3.7(6/7/85)を参考として + 使っている。しかし、他のバージョンのサポートも可能な限り取り込まれる。 + POSIXにおけるViのパートは、決定的な資料とは考えない。 +- Vimは新しいコマンドを持つため、Viにないコマンドを入力しても機能してしまう + 場合がある。 +- VimはViの持っていない多くの特徴を持つ。VimからViへ戻ることは問題を引き起こ + すが、これは避けられないことである。 +- いくつかの事柄はめったに使われた例がない(オープンモード、クラッシュ時の + e-mailの送信、など)。これらは、誰かが何らかの理由でそれを入れるべきだと考 + え、さらにその機能が働き過ぎない場合に限って取り入れられる。 +- いくつかの項目に関しては、Vi互換を保つべきかどうか、議論の余地がある。これ + らに関しては、オプションフラグが作られるだろう。 + + +VIM IS... IMPROVED *design-improved* + +Vimの改良点は、それをよりよいViにすべきであって、まったく違ったエディタに +してしまってはならない。拡張は "Viの精神" に従って行われる。 +- 可能な限りキーボードを使う。マウスは私たちの持たぬ第3の手を必要とする。 + 多くの端末はマウスを備えていない。 +- それでもマウスを使うようであれば、キーボードに切り替える必要をなくす。 + マウスとキーボードの操作の混在を避けよ。 +- コマンドとオプションを矛盾なく追加せよ。でなければ、それらを見つけ出し、思い + 出すのに、人々は苦労を強いられるだろう。後々、さらにコマンドやオプションが + 追加されることを忘れてはならない。 +- 特性は、人々が知らなければ役に立たない。目立たない特性は追加しない、あるいは、 + 少なくともその特性が存在するというヒントをドキュメントに追加すること。 +- CTRLや他の修飾子の使用は最小限に留めよ、これらはタイプしにくい。 +- 多くの初心者、不慣れなVimユーザーがいる。Vimを使いはじめること、そしてより多 + くを学んでいくことが、簡単にできるようにせよ。 +- 特性は限りなく追加できる。新しく追加される特性は、(1)ユーザーが求めているこ + と、(2)実装にどれほどの労力が必要か、そして(3)誰かが実際に実装している、と + いったことに基づいて選択される。 + + +VIM IS... MULTI PLATFORM *design-multi-platform* + +Vimは、可能な限り、多くのプラットフォーム上の多くのユーザーの助けでありたい。 +- 多くの種類の端末をサポートする。最低限の要求は、カーソルの配置機能と画面の + クリアである。コマンドはたいていのキーボードが持つキーのみを使う。マッピン + グには、キーボード上の全てのキーを使うことができる。 +- 多くのプラットフォームをサポートする。必要条件は、誰かがそのプラットフォーム + 上でVimの開発をしたいと考えること、それによってコードに混乱をきたさないこと、 + である。 +- 多くのコンパイラとライブラリをサポートする。全ての人が、他のコンパイラや + GUIライブラリをインストールできるわけではないからである。 +- 人々は、あるプラットフォームから別のプラットフォームへ、そしてGUIから端末 + バージョンへ移行する。特性は全てのバージョン、あるいは、少なくとも理に叶った + 労力でできる限りのバージョンで、提供されるべきである。ユーザーが能率的に仕事 + を仕上げるために、プラットフォームを切り替えねばならないような事態は避けたい。 +- いくつかのプラットフォームでは実現できない、または、ただひとつのプラット + フォームでしか実現できないような特性も、実装できないというわけではない。[こ + れは前項と故意に矛盾するものであり、両者の間でバランスが取られる。] + + +VIM IS... WELL DOCUMENTED *design-documented* + +- 文書化されていない特性は、役に立たない。新しい特性を含んだパッチには、必ず + ドキュメントが含まれているべきである。 +- ドキュメントは、わかりやすく、理解できるものであるべきだ。例を使うことが推 + 奨される。 +- 文章を不必要に長くしてはならない。短い文章は、その項目を見つけやすくする。 + + +VIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size* + +Vimを使うことで、システムリソースに大打撃を与えてはならない。Vimを小さく、 +速く保つこと。 +- コンピュータは年毎により速く、大容量になっている。Vimも成長しうるが、コン + ピュータの成長速度より速くなってはならない。Vimを古いシステム上でも使える + よう保つ必要がある。 +- 多くのユーザーは、Vimを頻繁にシェルから立ち上げる。起動は短時間でなくてはな + らない。 +- コマンドは能率的に働く必要がある。コマンドが消費する時間は、可能な限り短く + あるべきだ。役に立つコマンドなら、多少時間がかかってもよい。 +- Vimを、遅い接続を通して使う人がいることを忘れてはならない。通信にかかるオー + バーヘッドは最小にすること。 +- サイズがかなり大きく、多くの人によって使われるわけではない項目は、無効化で + きる特性とすべきである。 +- Vimは、他のいろいろな構成要素の中にある、ひとつのコンポーネントである。巨大 + なアプリケーションに変えてはならない、むしろ他のプログラムとよく協調するよう + にせよ。 + + +VIM IS... MAINTAINABLE *design-maintain* + +- ソースコードは乱雑になってはならない。そして、信頼できるものでなくてはな + らない。 +- 読みやすくするため、すべてのファイルで同じレイアウトを取ること + |coding-style|。 +- 役に立つコメントをいれること!関数名と引数名を引用しても役に立たない。それ + が何のためにあるのか説明すること。 +- プラットフォーム独立のコードに多くの変更を加える必要をなくし、他のプラット + フォームへの移植を簡単にできるようにすること。 +- オブジェクト指向の精神を使う: データとコードを同じ場所に。コードの他の部分 + に関する知識は最小で済むように。 + + +VIM IS... FLEXIBLE *design-flexible* + +Vimは、そのユーザーに特定の作業パターンを強いるよりは、ユーザーの好むスタイル +での作業を支援すべきである。これは大きなインパクトをもつ項目(例えば、 +'compatible' オプション)や、その他の詳細によって実現される。デフォルトは、多く +のユーザーがそのままのVimを楽しんで使えるように、慎重に選ばれている。コマンド +とオプションは、Vimをユーザーの希望と環境に調整するために使われる。 + + +VIM IS... NOT *design-not* + +- Vim はシェルでもオペレーティングシステムでもない。Vim の中でシェルを走らせた + りデバッガを制御したりできるようにはならない。これらは他の方法で成されるべき + である: Vim をシェルや IDE のコンポーネントとして使おう。 + 風刺を込めて曰く: "Vim は Emacs のように流し台以外ならなんでもかんでも取り込 + んでしまうようなことはしないが、Vim で流し台を洗うことはできるぞ。 ;-)" + Vim と gdb を連携させる方法については次を参照: + http://www.agide.org と http://clewn.sf.net. +- Vimは、全てのプラットフォームに渡って調和を欠くという代償を払って、見栄えを + よくしようとする装飾的なGUIエディタではない。しかし、機能的なGUI特性は歓迎さ + れる。 + +============================================================================== +2. コーディングスタイル *coding-style* + +Vimのソースコードに変更を加える際、守るべきルールがある。ソースを読めるもの、 +保守できるものとして保つため、これらのルールに従って欲しい。 + +このリストは完全ではない。より多くの例は、ソースコードを見て欲しい。 + + +MAKING CHANGES *style-changes* + +コードに変更を加える基本的なステップは: +1. GitHub からコードを取得する。これによりあなたが変更したコードをメインのコー + ドベースに同期するのがより簡単になる (あなたの変更がメインのコードベースに含 + まれるようになるまで少しかかるかもしれない) 。いくらか時間を費やして git に + ついて学ぶ必要がある。git はあまりユーザーフレンドリーなツールではない。 +2. ドキュメントを調整する。最初にこれをやることで、あなたの行う変更がユーザー + に与える影響について、おおまかな印象をもつことができる。 +3. ソースコードに変更を加える。 +4. 変更がリストされた項目に影響を与えていないか、../doc/todo.txtをチェックす + る。 +5. "git diff" でパッチを作成する。GitHub でプルリクエストを作成しても良いが、重 + 要なのはその diff である。 +6. 何が変更されたかのノートを作成する。問題点とその解決策について書かれている + のが望ましい。|vim-dev| のメーリングリストに説明と diff を含めたメールを送 + るか GitHub でプルリクエストを作成する。 + + +C COMPILER *style-compiler* + +サポートされている最小の C コンパイラのバージョンは C89 (ANSI C とも呼ばれてい +る) である。C89 以降の標準規格にはあまり多くの機能追加が無く C89 はもっとも普及 +している。 + +この項目が暗に示している制限の1つとして、 // コメントではなく /* コメント */ を +使わなければならない。 + + +USE OF COMMON FUNCTIONS *style-functions* + +よく使われる関数のうち、特別なVimバージョンを持つものがある。これらは理由あっ +て導入されたものなので、常にVimバージョンを使うように意識すること。 + +NORMAL NAME VIM NAME DIFFERENCE OF VIM VERSION +free() vim_free() NULLの解放をチェックする +malloc() alloc() アウトオブメモリの状況をチェックする +malloc() lalloc() alloc()に似ているが、long型の引数を持つ +strcpy() STRCPY() char_u *引数を、(char *)へキャストする +strchr() vim_strchr() スペシャルキャラクタを受け入れる +strrchr() vim_strrchr() スペシャルキャラクタを受け入れる +isspace() vim_isspace() 128以上のキャラクタを扱うことができる +iswhite() vim_iswhite() Tabとスペースに対してのみTRUE +memcpy() mch_memmove() オーバーラップしたコピーを扱う +bcopy() mch_memmove() オーバーラップしたコピーを扱う +memset() vim_memset() 全てのシステムで一定である + + +NAMES *style-names* + +関数の名前に31文字より長い名前は使えない。(VMSのために) + +"delete" や "this" という名前の変数を使わないこと。C++で問題となる。 + +Vimができる限り多くのシステム上で走るという必要上、システムによってすでに定義 +されている名前を使うことは避けねばならない。これは、問題となることが知られて +いる名前のリストである。名前はregexpパターンとして与えられている。 + +is.*() POSIX, ctype.h +to.*() POSIX, ctype.h + +d_.* POSIX, dirent.h +l_.* POSIX, fcntl.h +gr_.* POSIX, grp.h +pw_.* POSIX, pwd.h +sa_.* POSIX, signal.h +mem.* POSIX, string.h +str.* POSIX, string.h +wcs.* POSIX, string.h +st_.* POSIX, stat.h +tms_.* POSIX, times.h +tm_.* POSIX, time.h +c_.* POSIX, termios.h +MAX.* POSIX, limits.h +__.* POSIX, system +_[A-Z].* POSIX, system +E[A-Z0-9]* POSIX, errno.h + +.*_t POSIX, for typedefs, *_T を使うこと。 + +wait types.hとコンフリクトするため、関数の引数として使わない +index グローバル宣言を覆い隠す +time グローバル宣言を覆い隠す +new C++の予約語 +try Borland C++は、これを変数として使うことを好まない + +clear Mac curses.h +echo Mac curses.h +instr Mac curses.h +meta Mac curses.h +newwin Mac curses.h +nl Mac curses.h +overwrite Mac curses.h +refresh Mac curses.h +scroll Mac curses.h +typeahead Mac curses.h + +basename() GNU 文字列関数(GNU string function) +dirname() GNU 文字列関数(GNU string function) +get_env_value() Linux システム関数 + + +VARIOUS *style-various* + +型の定義に使う名前は最後を "_T" にする: > + typedef int some_T; +マクロ定義はすべて大文字にする: > + #define SOME_THING +機能に関する定義は "FEAT_" で始める: > + #define FEAT_FOO + +'\"' を使わない、あるコンパイラはこれを扱えない。'"' はうまく機能する。 + +次を使ってはならない: + #if HAVE_SOME +あるコンパイラはこれを扱えず、"HAVE_SOME" が定義されていないと訴える。 +次を使う + #ifdef HAVE_SOME +または + #if defined(HAVE_SOME) + + +STYLE *style-examples* + +一般的なルール: 1行に1つのステートメント。 + +間違い: if (cond) a = 1; + +OK: if (cond) + a = 1; + +間違い: while (cond); + +OK: while (cond) + ; + +間違い: do a = 1; while (cond); + +OK: do + a = 1; + while (cond); + +間違い: if (cond) { + cmd; + cmd; + } else { + cmd; + cmd; + } + +OK: if (cond) + { + cmd; + cmd; + } + else + { + cmd; + cmd; + } + +関数宣言には ANSI スタイルを使い、戻り値の型は独立した行にインデントをつけて書 +くこと。 + +間違い: int function_name(int arg1, int arg2) + +OK: /* + * Explanation of what this function is used for. + * この関数が何に使われるかの説明。 + * + * Return value explanation. + * 戻り値の説明。 + */ + int + function_name( + int arg1, /* short comment about arg1 */ + int arg2) /* short comment about arg2 */ + { + int local; /* comment about local */ + + local = arg1 * arg2; + + + +SPACES AND PUNCTUATION *style-spaces* + +関数名とブラケットの間にスペースを入れないこと: + +間違い: func (arg); +OK: func(arg); + +if、while、switchなどの後には、スペースを入れること。 + +間違い: if(arg) for(;;) +OK: if (arg) for (;;) + +コンマ、セミコロンの後にはスペースを入れること: + +間違い: func(arg1,arg2); for (i = 0;i < 2;++i) +OK: func(arg1, arg2); for (i = 0; i < 2; ++i) + +'='、'+'、'/' などの前と後には、スペースを入れること。 + +間違い: var=a*5; +OK: var = a * 5; + +一般的なこと: コードの行をグループ分けするために、空行を使う。行グループのす +ぐ上にコメントを入れる。こうすることによって、何が行われるのかをより簡単に知 +ることができる。 + +OK: /* Prepare for building the table. */ + /* テーブルの作成の準備 */ + get_first_item(); + table_idx = 0; + + /* Build the table */ + /* テーブルの作成 */ + while (has_item()) + table[table_idx++] = next_item(); + + /* Finish up. */ + /* 仕上げ */ + cleanup_items(); + generate_hash(table); + +============================================================================== +3. 決定事項 *design-decisions* + +折畳(folding) + +同じバッファにいくつもの折畳状態を設定可能にする。例えば、あるウィンドウに関 +数を折畳んだ状態で表示し、他のウィンドウで関数の中身を表示するなど。 + +折畳はテキストを表示する方法である。テキストを変更すべきではない。したがってバッ +ファ内のテキストをウィンドウに表示する際のフィルタとして実行される。 + + +ウィンドウの名前 + +"ウィンドウ" という単語は一般にいくつかの意味で使われている。スクリーン上のウィ +ンドウ、xtermのウィンドウ、Vimのバッファを表示するウィンドウなど。 + +混乱を避けるため、時にウィンドウと呼ばれる他の物には別の名前が付けられてい +る。ここに関連する物の概観を示す。 + +スクリーン(screen) ディスプレイ全体。GUIでは例えば1024x768ピクセルの画 + 面。Vimシェルはスクリーン全体を使うことも一部を使う + こともできる。 + +シェル(shell) Vimアプリケーション。スクリーン全体(例えばコンソール + で実行した時)、あるいはその一部(xtermやGUI)。 + +ウィンドウ(window) バッファの表示画面。Vimは複数のウィンドウを持つこと + ができる。ウィンドウはコマンドラインやメニューバー、 + ツールバーなどといっしょに表示される。これらはシェル + に納まる。 + +スペルチェック *develop-spell* + +Vim にスペルチェックを追加することになったとき、利用可能なスペルチェックのライ +ブラリやプログラムについて調査が行われた。その結果は残念なことに、Vim 内でスペ +ルチェックエンジンとして使えるものはないとわかった。これには様々な理由がある: + +- マルチバイトエンコーディングをサポートしていない。1つのファイル内で複数の言 + 語を使えるようにするために、少なくとも UTF-8 はサポートしていなければならな + い。 + オンザフライな変換は常に可能とは限らない(iconv に対応している必要がある)。 +- プログラムとライブラリに対して: それらをそのまま(as-is)使うには、Vim と別個 + にインストールしなければならない。これはたいてい不可能ではないが、難点である。 +- パフォーマンス: いくつかのテストによると、スペルチェックを構文強調のようにオ + ンザフライで(再描画中に)行うことは可能であった。しかし他のコードで使われたメ + カニズムはもっと遅かった。例えば、Myspell はハッシュテーブルを使用する。ほと + んどのスペルチェッカが使用している接辞圧縮を使うと遅くなった。 +- aspell のような外部プログラムを使うには、通信メカニズムを用意しなければなら + ない。これをポータブルな方法で行うのは複雑過ぎる(Unix だけなら比較的簡単だが、 + それでは十分ではない)。そしてパフォーマンスが問題になる(何回ものプロセス切替 + が行われる)。 +- "Etten-Leur" や "et al." など、単語でない単語のサポートを欠いている。そのた + めこれらの部分を OK とマークしなければならないが、そうすると信頼性が低下する。 +- 地域や方言のサポートを欠いている。英語の単語をすべて受け付け、カナダ語でない + 単語を別に扱うことが難しくなる。 +- 頻度が低い単語のサポートを欠いている。正しいがめったに使われないたくさんの単 + 語が、よく使われる単語のスペルミスとみなされてしまう。 +- スペル候補を作成するには速度はそれほど重要ではなく、他のプログラムやライブラ + リをインストールすることは許容できる。しかし、単語リストが異なるとスペル候補 + が誤単語になってしまう。 + + +スペル候補 *develop-spell-suggestions* + +候補の作成には2つの基本的なメカニズムがある: +1. 誤った単語を少し変更して正しい単語とマッチするかチェックする。あるいは、正 + しい単語全てに対し、それを少し変更して誤った単語とマッチするかチェックする。 + 変更とは、文字の削除・文字の挿入・2つの文字の交換などである。 +2. 誤った単語と正しい単語のリストの両方に soundfolding (発音が近い単語を同じグ + ループとみなすこと) を行って、そこでマッチを見つける。1番目のメカニズムと同 + 様にいくつか変更をしてもよい。 + +最初のメカニズムはタイプミスを見つけるのにはよい。ハッシュテーブルの実験と、他 +のスペルチェッカのソリューションを見ると、これにはtrie(ツリー構造の一種)が最適 +であるとの結論になった。メモリ使用量の削減と、賢い変更を試みるということの両方 +の面でである。例えば、文字を挿入するときは正しい単語につながる文字だけを試せば +よい。他の(ハッシュテーブルを使った)メカニズムは、単語のすべての位置で、ありう +るすべての文字を試さねばならない、また、ハッシュテーブルを使うには、単語の境界 +が個別に認識されなければならないのに対し、trie はそれを要求しない。そのためメ +カニズムがより単純になる。 + +ある単語の発音は知っているがスペルを知らないという場合に soundfolding は有用で +ある。例えば、"dictionary" という単語を "daktonerie" と書いてしまうかもしれな +い。これを最初の方法で訂正しようとすると変更回数が非常に多くなってしまい、正し +いスペルを見つけるのは困難である。それに対し、これらの単語にsoundfoldingを行う +と "tktnr" と "tkxnry" になり、2文字しか違わない。 + +soundfoldの同値(音が似ている単語)により単語を見つけるには全てのsoundfolded +wordsのリストが必要である。どれが最良の方法かを探すための実験が行われた。案: +1. 修正候補を探すときに、その場でsound foldingを行う。つまり、正しい単語のtrie + をたどりながら、各単語をsoundfoldingし、それがスペルミスしている単語からど + れだけ異なるかをチェックする。これはメモリ効率の面でとても優れているが、時 + 間は長くかかる。英語の場合、高速なPCで2秒ほどかかる。これは対話的な利用とし + て受け入れられる。しかしいくつかの言語(ドイツ語、カタルニャ語など)に対して + は10秒以上かかり、受け入れがたい。バッチ処理(自動訂正)に使うには全ての言語 + で遅すぎる。 +2. soundfoldされた単語に対してtrieを使い、soundfoldingなしのときとまったく同じ + ように検索できるようにする。そのためには、soundfoldされた各単語に対し、正し + い単語のリストを記憶しておく必要がある。そうすると照合がとても高速になるが、 + 1MB〜10MBのオーダーの大量のメモリを必要とする。ある言語の場合は元の単語のリ + ストよりも多くなる。 +3. 2番目の案と同様だが、接辞圧縮を使い、soundfoldした基本単語だけを保存するこ + とによりメモリ消費量を減らす。これはAspellが採用している方法である。不利点 + は、誤った単語をsoundfoldする前に接辞を取り除いておかねばならないことである。 + そのため、単語の先頭・末尾における誤りに対しては対応できない。また、誤った + 単語が正しい単語から大きく異なるときは遅くなる。 + +我々が採用したのは、2番目のメカニズムを使い、別ファイルを使う方法である。こう +することによって、十分なメモリを持っているユーザーはとてもよい候補を得ることが +できるし、メモリが不足しているユーザーやスペルチェックだけで候補は出さなくてよ +いというユーザーはそれほどメモリを使わなくてすむ。 + + +単語の頻度 + +候補をソートするにはどの単語が共通であるかを知ると役に立つ。理論的には単語の頻 +度は単語とともに辞書の中に保持することができる。しかしそうすると単語につき回数 +を保持しなければならない。これは単語ツリー圧縮を大いに劣化させる。また、全ての +言語に対して単語の頻度を保守するのは大変な作業である。 +また、テキストに既に出てきている単語を優先するとよいだろう。このようにして特定 +のテキスト内に表れる単語は候補の中で優先度が高くなる。 + +実装されたのは、表示中に単語を数えることである。ハッシュテーブルを使ってその単 +語の回数を高速に検索する。回数は接辞ファイルでCOMMONアイテムにリストされている +単語から初期化される。そのため新規ファイルの編集を始めたときも機能する。 + +これは理想的ではない。Vimが長時間稼動しているほど回数は大きくなるためである。 +しかし実用的には単語の回数を使わない場合に比べて注目に値するほどの改善である。 + +============================================================================== +4. 想定していること *design-assumptions* + +変数のサイズ: +char 8 bit signed +char_u 8 bit unsigned +int 32 or 64 bit signed (限定された機能については16ビットもありうる) +unsigned 32 or 64 bit unsigned (16ビットについてはintと同様) +long 32 or 64 bit signed, can hold a pointer + +Note いくつかのコンパイラは長すぎる行は文字列をうまく扱えない。C89の標準規格で +は509文字までに制限されている。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/diff.jax b/plugins/vimdoc-ja/doc/diff.jax new file mode 100644 index 0000000000..cdb8f495f6 --- /dev/null +++ b/plugins/vimdoc-ja/doc/diff.jax @@ -0,0 +1,439 @@ +*diff.txt* For Vim バージョン 8.0. Last change: 2017 Feb 03 + + + VIMリファレンスマニュアル by Bram Moolenaar + + + *diff* *vimdiff* *gvimdiff* *diff-mode* +このファイルでは |+diff| 機能 (同じファイルの2つから8つまでのバージョン間の違 +いを表示する機能) について解説する。 + +基本はユーザーマニュアルのセクション|08.7|に記載されている。 + +1. 差分モードを開始する |vimdiff| +2. 差分を眺める |view-diffs| +3. 差分へ移動する |jumpto-diffs| +4. 差分を写す |copy-diffs| +5. 差分モードのオプション |diff-options| + +{Vi にはない} + +============================================================================== +1. 差分モードを開始する + +差分モードで編集を開始するいちばん簡単な方法は "vimdiff" コマンドである。これ +はVimを通常どおり起動して、加えて引数で与えたファイル間の違いを表示する。 > + + vimdiff file1 file2 [file3 [file4]] + +これは以下に等しい: > + + vim -d file1 file2 [file3 [file4]] + +"gvimdiff" もしくは "vim -d -g" を使うこともできる。その際はGUIがスタートする。 +"viewdiff" もしくは "gviewdiff" を使うこともできる。その際は読込専用モードでス +タートする。 +"r" が先頭に付け加われば制限モードになる(|-Z|参照)。 + +2つ目以降の引数にはディレクトリ名を指定することもできる。その際には第1引数の +ファイル名がそのディレクトリ名に追加され、ファイルを検索するのに利用される。 + +これは外部コマンドの "diff" が存在する場合にだけ動作する。'diffexpr' 参照。 + +diff はカレントタブページ |tab-page| にローカルである。他のタブページにある +ウィンドウとの差分を見ることはできない。これによって、複数の差分を同時に見るこ +とが可能になっている。それぞれを別々のタブで開けばよい。 + +Vimが各ファイルについてウィンドウを開く時に起こることは、|-O|引数を使った時に +起こることに似ている。これには垂直分割が使用される。水平分割を行いたいならば +|-o|引数を追加する: > + + vimdiff -o file1 file2 [file3 [file4]] + +常に水平分割にしたければ 'diffopt' に "horizontal" を含めること。 + +編集される各ファイルには以下のオプションが設定される: + + 'diff' on + 'scrollbind' on + 'cursorbind' on + 'scrollopt' "hor" を入れる + 'wrap' off + 'foldmethod' "diff" + 'foldcolumn' 2 + +これらのオプションはウィンドウローカルに設定される。別のファイルを開いた時に +は、これらはグローバルの値へリセットされる。 +このオプションはさらにそのファイルを再読み込みするときモードラインから上書きさ +れることがある。しかし 'diff' がオンのとき、'foldmethod' と 'wrap' はモードラ +インからはセットされない。 + +表示される差分はバッファ内の違いである。だからファイルを読み込んだ後に変更を行 +えば、その変更分は差分として表示される。全ての変更が即表示に反映されるわけでは +ないので、時々 ":diffupdate" を行うと良いだろう。 + +差分モードで起動した時の特別な設定を.vimrcファイルに記すことができる。このよう +にすれば良い: > + + if &diff + setup for diff mode + else + setup for non-diff mode + endif + +既にVimを利用している時には、3つの方法で差分モードへ移行することができる。 + + *E98* +:diffs[plit] {filename} *:diffs* *:diffsplit* + ファイル{filename}の新しいウィンドウを開く。現在と新しく開く + ウィンドウについて "vimdiff" と同様のオプションをセットする。 + 'diffexpr' も参照。 + + *:difft* *:diffthis* +:difft[his] 現在のウィンドウを差分ウィンドウの1つにする。これにより + "vimdiff" と同じオプションが設定される。 + +:diffp[atch] {patchfile} *E816* *:diffp* *:diffpatch* + {patchfile}内の差分情報を現在のバッファへ適用し、結果を新しく + 作成したバッファへ出力する。オプションは "vimdiff" と同様に設 + 定される。 + {patchexpr}の形式は "patch" プログラムか 'patchexpr' が取り扱 + える形式ならどのようなものでもかまわない。 + {patchfile}は現在のファイルに対して適用可能な差分情報だけを含 + んでなければならないことに注意。もしも{patchfile}が他のファイ + ル用の差分情報を含んでいた場合は、結果は予想不可能となる。Vim + は現在のディレクトリのファイルが偶発的に書き換えられてしまうの + を避けるためディレクトリを/tmpへ変更する。しかし様々な ".rej" + ファイルが作成されてしまう問題は依然としてある。また差分情報内 + にファイルが絶対パスとして与えられた場合には、やはり適用されて + しまう。 + +このコマンドを垂直分割で使うには、|:vertical|を先行させる。例: > + + :vert diffsplit main.c~ + :vert diffpatch /tmp/diff + +常に垂直分割にしたければ 'diffopt' に "vertical" を含めること。 + + *E96* +'diff' オプションは最大で8つのバッファにまで同時に設定できる。 + +オプションの値はバッファへ記憶されるので、しばらくの間異なるファイルを編集し、 +また同じファイルへ戻って再び差分モードを継続することができる。 + + *:diffo* *:diffoff* +:diffo[ff] カレントウィンドウの差分モードを終了する。'diff' が設定されて + いてもいなくても、関連オプションはリセットされる。 + +:diffo[ff]! カレントウィンドウとカレントタブページのすべてのウィンドウの差 + 分モードを終了する。'diff' が設定されているウィンドウのみ、関 + 連オプションがリセットされる。カレントウィンドウの 'diff' オプ + ションが設定されていない場合は、そのウィンドウの関連オプション + は変更されない。 + 隠れバッファも、diff対象のバッファの一覧から削除される。 + +コマンド `:diffoff` は関連するオプションを差分モード実行前の設定値に戻す。それ +は `:diffsplit`、`:diffpatch`、`:diffthis` を実行したときの設定値、または Vim +を差分モードで起動したときの設定値である。`:diffoff` を2回実行したときは最後に +保存された値が復元される。 +それ以外の場合はデフォルト値に戻す: + + 'diff' off + 'scrollbind' off + 'cursorbind' off + 'scrollopt' "hor" を外す + 'wrap' on + 'foldmethod' "manual" + 'foldcolumn' 0 + +============================================================================== +2. 差分を眺める *view-diffs* + +差分ウィンドウには同じテキストが、異なるハイライト方法で表示される。テキストを +スクロールした際には 'scrollbind' オプションにより、他のウィンドウも同じように +スクロールする。垂直分割をしている場合にはテキストは正しく同期する。 + +テキストの位置は次のような場合に狂っていく: +- 'wrap' が有効で、幾つかの行が折り返され複数行を占めている時 +- 折畳が一方のウィンドウでは開かれているが、もう一方では閉じられている +- 'scrollbind' が無効になっている +- テキストが変更された +- 'diffopt' に "filler" が指定されておらず、削除・追加された行が配置を狂わせて + いる +'diff' オプションが設定されているウィンドウで編集されている全てのバッファが差 +分へ連結される。これは隠し(hidden)バッファにもあてはまる。これを可能にするには +初めに1つのウィンドウでそれらが編集される必要がある。隠れバッファを取り除くに +は、`:diffoff!` を用いること。 + + *:DiffOrig* *diff-original-file* +'diff' はウィンドウローカルのオプションであるから、1つのバッファをあるウィンド +ウでは差分モードで、別のウィンドウでは通常のウィンドウで表示することも可能であ +る。ファイルを読み込んで以来バッファに対して行った変更を表示することも可能であ +る。だが、Vimは1つのファイルに対して複数のバッファを持つことはできないから、別 +のバッファを作る必要がある。 +次のコマンドが便利である: > + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ + \ | diffthis | wincmd p | diffthis +(これは|vimrc_example.vim|に書かれている)。":DiffOrig" を実行すると、カレント +バッファと元のファイルの差分を見ることができる。 + +アンロードされたバッファの差分をとることはできない。隠れバッファの差分をとるこ +とはできる。コマンド ":hide" を使うと、バッファをアンロードせずにウィンドウを +閉じることができる。そのときバッファを差分対象から外したいならば、隠れバッファ +にする前に ":set nodiff" をする。 + + *:dif* *:diffupdate* +:dif[fupdate][!] 差分の強調と折り畳みを更新する。 + +テキストを変更した時には、Vimは差分情報を最新に保とうと試みる。これの大部分は +挿入と削除をされた行 (複数も可) に着目して行われる。1行内で行われた変更、及び +それよりも複雑な変更に対しては差分情報は更新されない。差分情報を強制的に更新す +るには次のコマンドを使う: > + + :diffupdate + +!が含まれている場合、Vimはファイルが外部で変更され、再読み込みが必要かどうかを +チェックする。その際、`:checktime` を使ったときと同様に、変更されたそれぞれの +ファイルについてプロンプトが表示される。 + +Vimは片方のウィンドウには存在しないがもう一方には存在する行については補充して +表示する。これらはもう一方のファイルで追加されたかこのファイルで削除された行で +ある。'diffopt' オプションから "filler" を削除するとVimはこのような行の補充は +行わない。 + + +変更されていないテキストについては折畳を使用して隠される。折畳に使用できる全て +のコマンドについては|folding|を参照。 + +差分の近辺の折畳に含まれない領域はコンテキストと呼び、その行数を 'diffopt' オ +プションで設定できる。以下の例ではこのコンテキストを3行に設定している: > + + :set diffopt=filler,context:3 + + +差分は以下の強調グループで強調表示される: + +|hl-DiffAdd| DiffAdd 追加(挿入)された行。このバッファに存在する行 + は、別のバッファには存在しない。 +|hl-DiffChange| DiffChange 変更された行。 +|hl-DiffText| DiffText 変更された行の中の変更されたテキスト。Vimは異 + なる最初の文字と、最後の文字を発見する (検索は + 行末から行われる)。その文字の間のテキストが強 + 調される。これはその間にあるテキストが例え同じ + だったとしても強調されることを意味する。ここで + は 'diffopt' の "iwhite" だけが適用される。 +|hl-DiffDelete| DiffDelete 削除された行。補充された行についても、実際その + バッファには存在していないことから、このグルー + プが適用される。 + +============================================================================== +3. 差分へ移動する *jumpto-diffs* + +差分へ移動するのに2つのコマンドを使える: + *[c* + [c 前(上方)の変更の先頭へ移動する。 + カウントが与えられた場合、その回数繰り返される。 + *]c* + ]c 次(下方)の変更の先頭へ移動する。 + カウントが与えられた場合、その回数繰り返される。 + +カーソルの動く方向に変更がなかった場合にはエラーになる。 + +============================================================================== +4. 差分を写す *copy-diffs* *E99* *E100* *E101* *E102* *E103* + *merge* + +あるバッファから別のバッファへテキストを複写する2つのコマンドがある。結果的に +ある範囲について2つのバッファの内容は等しくなる。 + + *:diffg* *:diffget* +:[range]diffg[et] [bufspec] + 現在のバッファをもう1つのバッファと同じくなるように変更をす + る。 [bufspec]が与えられた時は、そのバッファが使用される。 + [bufspec] がカレントバッファである場合は何も起こらない。 + そうでなければ差分モードのバッファが他に1つしかない時にだけ動 + 作する。 + [range]については以下を参照。 + + *:diffpu* *:diffput* *E793* +:[range]diffpu[t] [bufspec] + もう1つのバッファを現在のバッファと同じくなるように変更する。 + ":diffget" と同様だが現在のバッファではなく、もう一方のバッファ + が変更を受ける。 + [bufspec] が省略され、かつ 'modifiable' がオンで差分モードにあ + るバッファが2個以上あると、このコマンドは失敗する。 + [range]については以下を参照。 + + *do* +[count]do 範囲のない ":diffget" と同じ。"o" は "obtain" の意味 ("dgg" と + 区別できないので、"dg" は使えない)。Note: これはビジュアル + モードでは機能しない。 + [count] を与えた場合、それは ":diffget" に対して [bufspec]引数 + として用いられる。 + + *dp* +[count]dp 範囲のない ":diffput" と同じ。Note: これはビジュアルモードでは + 機能しない。 + [count] を与えた場合、それは ":diffput" に対して [bufspec]引数 + として用いられる。 + + +[range]が与えられない場合にはカーソルの位置かその上の差分が適用される。[range] +が使われた時にはその範囲だけを適用(put/get)しようと試みる。削除された場合には +必ずしも可能なわけではない。 + +バッファの最後の行のさらに下方に削除された行があることも考えられる。そのとき +カーソルが最終行にあり、最終行より上に差異がないとき、":diffget" と "do" コマ +ンドはそれらの行を取得する。 + +超えた位置の行をもう一方のバッファから取得するには、最終行+1の行番号を指定す +る。次のコマンドはもう一方のバッファから完全な差分情報を受け取る: > + + :1,$+1diffget + +削除された行は画面に表示こそされているが、テキストラインとしては数えられていな +いことに注意。消された範囲にカーソルを移動することはできない。もう一方のバッ +ファから、削除された行を ":diffget" で取得するには対象行の下方で行う必要があ +る。 + *E787* +変更を受けるバッファが読み込み専用で、 |FileChangedRO| で引き起こされる自動コ +マンドがバッファを変更するとき、このコマンドは失敗する。 +この自動コマンドはバッファを変更してはならない。 + +引数 [bufspec]にはバッファ番号、バッファ名のパターンもしくはバッファ名の一部を +使用できる。例: + + :diffget 差分モードにある別のバッファを使用する + :diffget 3 3番のバッファを使用する。 + :diffget v2 差分モードにある "v2" にマッチするバッファを使 + 用する (例, "file.c.v2") + +============================================================================== +5. 差分モードオプション *diff-options* + +|'diffopt'| と |'fillchars'| の "diff" 項目も参照。 + + *diff-slow* *diff_translations* +行がとても長いと diff 構文ハイライトが遅くなるかもしれない。その場合は特にたく +さんの異なったローカライゼーションをマッチしようと試みるからである。ローカライ +ゼーションを無効化して構文ハイライトを高速化するには、グローバル変数 +g:diff_translations を 0 に設定する: > + + let g:diff_translations = 0 +< +この変数を設定した後、構文スクリプトを再読み込みする: > + + set syntax=diff +< + + +差分を発見する *diff-diffexpr* + +'diffexpr' オプションは、2つのファイルを比較し差分を取得する標準的な "diff" プ +ログラム以外の何かを利用する場合に設定する。 + +'diffexpr' が空ならば、Vimはfile1とfile2間の差分を得るために次のコマンドを使用 +する: > + + diff file1 file2 > outfile + +">" は 'shellredir' の値に置き換えられる。 + +"diff" の出力は通常の "ed" 形式の差分でなければならない。コンテキスト差分を使 +用してはいけない。この例はVimが求めるフォーマットを示している: > + + 1a2 + > bbb + 4d4 + < 111 + 7c7 + < GGG + --- + > ggg + +項目 "1a2" が 行 "bbb" を追加する。 +項目 "4d4" が 行 "111" を削除する。 +項目 "7c7" が 行 "GGG" を 行 "ggg" で置き換える。 + +'diffexpr' が空でなければ、差分ファイルを述べた形式で取得するためにそれを評価 +実行する。これらの変数がファイル名として設定される: + + v:fname_in 基準となるファイル + v:fname_new 同ファイルの新バージョン + v:fname_out 結果を出力する差分ファイル + +その上、'diffexpr' は 'diffopt' オプションの "icase" と "iwhite" についても考 +慮するべきだろう。'diffexpr' は 'lines' と 'columns' の値を変更できない。 + +例 (これは 'diffexpr' が空の時とほぼ同じように働く): > + + set diffexpr=MyDiff() + function MyDiff() + let opt = "" + if &diffopt =~ "icase" + let opt = opt . "-i " + endif + if &diffopt =~ "iwhite" + let opt = opt . "-b " + endif + silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new . + \ " > " . v:fname_out + endfunction + +引数の "-a" は強制的にテキストファイルとして比較するために使われる。バイナリで +の比較は使いにくい。引数の "--binary" はファイルをバイナリモードで読み込むため +に使われる。DOSでCTRL-Zをテキストの終わりとしないためである。 + + *E810* *E97* +Vimは差分の出力結果が妥当であるか検証する。妥当でない場合、エラーメッセージを +得るだろう。起こりうるエラーは: +- プログラム "diff" を実行できなかった。 +- プログラム "diff" が通常の "ed" スタイルの差分を出力しなかった(上記参照)。 +- 'shell' と関連するオプションが正しく設定されていなかった。":!sort" のような + フィルタリングコマンドが正しく動作するか確認すること。 +- 'diffexpr' を使っているが動作しなかった。 +エラーメッセージがよくわからないときは 'verbose' オプションを設定してより多く +のメッセージを見ることができる。 + +MS-Windows 用の Vim インストーラには diff プログラムが含まれている。もし diff +プログラムを持っていない場合はどこかから diff.exe をダウンロードすること。例え +ば次の場所から入手できる。 +http://gnuwin32.sourceforge.net/packages/diffutils.htm. + + +パッチを使用する *diff-patchexpr* + +'patchexpr' オプションは、標準的な "patch" プログラム以外の何かを利用する場合 +に設定する。 + +'patchexpr' が空ならば、Vimは "patch" を次のように呼び出す: > + + patch -o outfile origfile < patchfile + +これはほとんどのバージョンの "patch" で正しく働くだろう。行中間のCRが、改行記 +号として解釈され問題を起こすことはあるかもしれない。 + +デフォルトが正しく働かないのならば、同様の働きをする式を 'patchexpr' に設定す +る。これらの変数がファイル名として設定される。 + + v:fname_in 基準となるファイル + v:fname_diff パッチファイル + v:fname_out パッチ適用結果を出力するファイル + +例 (これは 'patchexpr' を空にしたのと同じ働きをする): > + + set patchexpr=MyPatch() + function MyPatch() + :call system("patch -o " . v:fname_out . " " . v:fname_in . + \ " < " . v:fname_diff) + endfunction + +利用する "patch" プログラムが望んでいない副作用をしていないことを確認する必要 +がある。例えば消されるべき付加的なファイルが生成されていないか用心する必要があ +る。ファイルにパッチをあてる以上のことは何もすべきではない。 + Vimは 'patchexpr' を実行する前に "/tmp" か他の一時ディレクトリへ現在のディ +レクトリを移動する。これにはカレントディレクトリの別のファイルへ偶然にパッチが +あたってしまうのを避ける狙いがある。Vimはv:fname_inで始まり ".rej" や ".orig" +で終わる名前のファイルを消すこともする。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/digraph.jax b/plugins/vimdoc-ja/doc/digraph.jax new file mode 100644 index 0000000000..2eed6af61b --- /dev/null +++ b/plugins/vimdoc-ja/doc/digraph.jax @@ -0,0 +1,1488 @@ +*digraph.txt* For Vim バージョン 8.0. Last change: 2016 Nov 04 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +ダイグラフ (Digraphs) *digraph* *digraphs* *Digraphs* + +ダイグラフは、通常のキーボードから普通に入力できないキャラクタを入力するために +使われる。これらは多くの場合、印字可能な非 ASCII キャラクタである。ダイグラフ +は、CTRL-Vと共に入力される10進表記よりも覚えやすい(|i_CTRL-V|を参照せよ)。 + +ユーザーマニュアルの|24.9|に簡単な説明がある。 +代わりに 'keymap' オプションを使う方法もある。 + +1. ダイグラフを定義する |digraphs-define| +2. ダイグラフを使う |digraphs-use| +3. 標準のダイグラフ |digraphs-default| + +{Vi にはこれらのコマンドはない} + +============================================================================== +1. ダイグラフを定義する *digraphs-define* + + *:dig* *:digraphs* +:dig[raphs] 現在定義されているダイグラフを表示する。 + *E104* *E39* +:dig[raphs] {char1}{char2} {number} ... + ダイグラフ{char1}{char2}をリストに追加する。{number}は + そのキャラクタを表す10進表記。通常、文字はUnicodeであ + る。|digraph-encoding| を参照。 + 例: > + :digr e: 235 a: 228 +< 最初の文字として '_' (underscore) を持つダイグラフは + 定義しないようにすること。将来は特別な意味を持つ。 + +Vimは普通|+digraphs|特性を持ってコンパイルされる。この特性が無効である場合、 +":digraph" コマンドはエラーメッセージを表示する。 + +":digraphs" の出力例: > + TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228 + +各欄の最初の2つのキャラクタは、そのダイグラフを入力するために打たねばならない +キャラクタである。 + +各欄の中央は、結果として表示されるキャラクタである。この表は、ダイグラフをサポ +ートしていないシステム上で閲覧した場合、また、このファイルをプリントアウトした +ときには乱れる可能性がある。 + +{訳注: 10進数はそのキャラクタのASCIIコードである。} + + *digraph-encoding* +10進数の数字は通常、その文字のUnicode番号である。Note その数字の意味は +'encoding' が変わっても変わらない。必要ならば、その文字がUnicodeから 'encoding' +へと変換される。そのためには変換が有効になっていなければならない。そうでないと +処理が失敗する。NUL 文字は "10" と表示される。これは、内部的に NUL文字は NL で +表現されているからである。ファイルに書き込むときに NUL 文字に変換される。 + +Vim が |+multi_byte| 機能なしでコンパイルされている場合は、その文字を +'encoding' と同じエンコーディングで指定しなければならない。次のようにするとよ +いだろう: > + + if has("multi_byte") + digraph oe 339 + elseif &encoding == "iso-8859-15" + digraph oe 189 + endif + +これは、Unicodeで番号339、latin9 (iso-8859-15) で番号189の文字に対してダイグラ +フ "oe" を定義している。 + +============================================================================== +2. ダイグラフを使う *digraphs-use* + +ダイグラフの入力には2つの方法がある: *i_digraph* + CTRL-K {char1} {char2} または + {char1} {char2} +最初のものは常に使える; 2番目のものは 'digraph' オプションが設定されていると +きのみ使える。 + +{char1}{char2}によるダイグラフが存在しない場合、Vimは{char2}{char1}による +ダイグラフを検索する。これは、どちらのキャラクタが先か思い出せない場合に役立 +つ。 + +CTRL-K {char1}と入力したとき、{char1}がスペシャルキーであれば、Vimはスペシャ +ルキーに対するコードを入力する。これはダイグラフではない。 + +一旦ダイグラフを入力してしまえば、Vimはそのキャラクタを、ファイル上でも画面上 +でも1キャラクタぶんを占める、普通のキャラクタとして取り扱う。例えば: > + 'B' 'B' will enter the broken '|' character (166) + 'a' '>' will enter an 'a' with a circumflex (226) + CTRL-K '-' '-' will enter a soft hyphen (173) + +現在のダイグラフは、":digraphs" コマンドで一覧できる。標準のダイグラフのいくつ +かを、以下の|digraph-table|に一覧してある。 + +CTRL-Kについて、ひとつの汎用的なダイグラフがある: CTRL-K {char}で、 +{char}の最高位のビットを立てて入力する。これはメタキャラクタの入力に使える。 + +キャラクタは、ダイグラフの一部になることはできない。を押すと、Vimは +ダイグラフの入力を止め、ダイグラフを使用していないときと同様に、挿入モード、あ +るいはコマンドラインモードを終了する。meta-ESC (CSI) を入力するには CTRL-V 155 +を使うこと。 + +'e' とタイプすべきところを 'a' と間違ってしまったときには、'a' 'e' と打つ +だろう。しかし、それはダイグラフであるので、望んだものは得られない。これを正し +くするためには、 eをもう一度打ち込む必要がある。これを避けるためには、 +'digraph' オプションを設定せず、ダイグラフの入力にCTRL-Kを使う。 + +値が128以上のキャラクタをVimで使う際は問題に遭遇するかもしれない。例えば: +挿入モードでue(u-umlaut)を入力した際、エディタは\334を表示する。挿入モード +を抜ければ、全て正常になる。fmtは整形中のテキストから128以上の値を持つ全てのキャ +ラクタを取り除くことに注意せよ。いくつかのUnixシステムにおいては、LC_CTYPE環境 +変数を定義する必要があるということである。cshを使っているならば、.cshrcに次の +1行を加える: > + setenv LC_CTYPE iso_8859_1 + +============================================================================== +3. 標準のダイグラフ *digraphs-default* + +Vimには標準のダイグラフキャラクタがある。それらを見るには ":digraphs" の出力を +確認すること。 + +ほとんどのシステムでVimは同じダイグラフを使う。それはUnicodeかISO-8859-1文字 +セットで使える。標準のダイグラフの出典はRFC1345である。覚えやすいように2番目の +文字は標準的な意味を持っている。 + + char name char meaning ~ + Exclamation mark ! Grave + Apostrophe ' Acute accent + Greater-Than sign > Circumflex accent + Question mark ? Tilde + Hyphen-Minus - Macron + Left parenthesis ( Breve + Full stop . Dot above + Colon : Diaeresis + Comma , Cedilla + Underline _ Underline + Solidus / Stroke + Quotation mark " Double acute accent + Semicolon ; Ogonek + Less-Than sign < Caron + Zero 0 Ring above + Two 2 Hook + Nine 9 Horn + + Equals = Cyrillic (= used as second char) + Asterisk * Greek + Percent sign % Greek/Cyrillic special + Plus + smalls: Arabic, capitals: Hebrew + Three 3 some Latin/Greek/Cyrillic letters + Four 4 Bopomofo + Five 5 Hiragana + Six 6 Katakana + +例: a: is ä and o: is ö + +これらはRFC1345における1バイト文字用のものである。他は ":digraphs" の出力を見 +ること。255よりも大きい値の文字はVimが|+multi_byte|付きでコンパイルされたとき +のみ有効である。 + +ユーロ + +例外: RFC1345 はユーロ記号を定めていない。Vim はダイグラフ =e をユーロ記号に +あてている。latin1 ではダイグラフ Cu が通貨記号になっていて、latin9 +(iso-8859-15) ではダイグラフ =e がユーロ記号になっている。どちらでもその文字 +は 164, 0xa4 である。zsh との互換性のために、Eu でもユーロ記号になる。 + +ルーブル + +ルーブル記号は 2014 年に 0x20bd として追加された。Vim はダイグラフ =R と =P と +してそれをサポートしている。Note: R= と P= は別の文字である。 + + *digraph-table* +char digraph hex dec official name ~ +^@ NU 0x00 0 NULL (NUL) +^A SH 0x01 1 START OF HEADING (SOH) +^B SX 0x02 2 START OF TEXT (STX) +^C EX 0x03 3 END OF TEXT (ETX) +^D ET 0x04 4 END OF TRANSMISSION (EOT) +^E EQ 0x05 5 ENQUIRY (ENQ) +^F AK 0x06 6 ACKNOWLEDGE (ACK) +^G BL 0x07 7 BELL (BEL) +^H BS 0x08 8 BACKSPACE (BS) +^I HT 0x09 9 CHARACTER TABULATION (HT) +^@ LF 0x0a 10 LINE FEED (LF) +^K VT 0x0b 11 LINE TABULATION (VT) +^L FF 0x0c 12 FORM FEED (FF) +^M CR 0x0d 13 CARRIAGE RETURN (CR) +^N SO 0x0e 14 SHIFT OUT (SO) +^O SI 0x0f 15 SHIFT IN (SI) +^P DL 0x10 16 DATALINK ESCAPE (DLE) +^Q D1 0x11 17 DEVICE CONTROL ONE (DC1) +^R D2 0x12 18 DEVICE CONTROL TWO (DC2) +^S D3 0x13 19 DEVICE CONTROL THREE (DC3) +^T D4 0x14 20 DEVICE CONTROL FOUR (DC4) +^U NK 0x15 21 NEGATIVE ACKNOWLEDGE (NAK) +^V SY 0x16 22 SYNCHRONOUS IDLE (SYN) +^W EB 0x17 23 END OF TRANSMISSION BLOCK (ETB) +^X CN 0x18 24 CANCEL (CAN) +^Y EM 0x19 25 END OF MEDIUM (EM) +^Z SB 0x1a 26 SUBSTITUTE (SUB) +^[ EC 0x1b 27 ESCAPE (ESC) +^\ FS 0x1c 28 FILE SEPARATOR (IS4) +^] GS 0x1d 29 GROUP SEPARATOR (IS3) +^^ RS 0x1e 30 RECORD SEPARATOR (IS2) +^_ US 0x1f 31 UNIT SEPARATOR (IS1) + SP 0x20 32 SPACE +# Nb 0x23 35 NUMBER SIGN +$ DO 0x24 36 DOLLAR SIGN +@ At 0x40 64 COMMERCIAL AT +[ <( 0x5b 91 LEFT SQUARE BRACKET +\ // 0x5c 92 REVERSE SOLIDUS +] )> 0x5d 93 RIGHT SQUARE BRACKET +^ '> 0x5e 94 CIRCUMFLEX ACCENT +` '! 0x60 96 GRAVE ACCENT +{ (! 0x7b 123 LEFT CURLY BRACKET +| !! 0x7c 124 VERTICAL LINE +} !) 0x7d 125 RIGHT CURLY BRACKET +~ '? 0x7e 126 TILDE +^? DT 0x7f 127 DELETE (DEL) +~@ PA 0x80 128 PADDING CHARACTER (PAD) +~A HO 0x81 129 HIGH OCTET PRESET (HOP) +~B BH 0x82 130 BREAK PERMITTED HERE (BPH) +~C NH 0x83 131 NO BREAK HERE (NBH) +~D IN 0x84 132 INDEX (IND) +~E NL 0x85 133 NEXT LINE (NEL) +~F SA 0x86 134 START OF SELECTED AREA (SSA) +~G ES 0x87 135 END OF SELECTED AREA (ESA) +~H HS 0x88 136 CHARACTER TABULATION SET (HTS) +~I HJ 0x89 137 CHARACTER TABULATION WITH JUSTIFICATION (HTJ) +~J VS 0x8a 138 LINE TABULATION SET (VTS) +~K PD 0x8b 139 PARTIAL LINE FORWARD (PLD) +~L PU 0x8c 140 PARTIAL LINE BACKWARD (PLU) +~M RI 0x8d 141 REVERSE LINE FEED (RI) +~N S2 0x8e 142 SINGLE-SHIFT TWO (SS2) +~O S3 0x8f 143 SINGLE-SHIFT THREE (SS3) +~P DC 0x90 144 DEVICE CONTROL STRING (DCS) +~Q P1 0x91 145 PRIVATE USE ONE (PU1) +~R P2 0x92 146 PRIVATE USE TWO (PU2) +~S TS 0x93 147 SET TRANSMIT STATE (STS) +~T CC 0x94 148 CANCEL CHARACTER (CCH) +~U MW 0x95 149 MESSAGE WAITING (MW) +~V SG 0x96 150 START OF GUARDED AREA (SPA) +~W EG 0x97 151 END OF GUARDED AREA (EPA) +~X SS 0x98 152 START OF STRING (SOS) +~Y GC 0x99 153 SINGLE GRAPHIC CHARACTER INTRODUCER (SGCI) +~Z SC 0x9a 154 SINGLE CHARACTER INTRODUCER (SCI) +~[ CI 0x9b 155 CONTROL SEQUENCE INTRODUCER (CSI) +~\ ST 0x9c 156 STRING TERMINATOR (ST) +~] OC 0x9d 157 OPERATING SYSTEM COMMAND (OSC) +~^ PM 0x9e 158 PRIVACY MESSAGE (PM) +~_ AC 0x9f 159 APPLICATION PROGRAM COMMAND (APC) +| NS 0xa0 160 NO-BREAK SPACE +¡ !I 0xa1 161 INVERTED EXCLAMATION MARK +¢ Ct 0xa2 162 CENT SIGN +£ Pd 0xa3 163 POUND SIGN +¤ Cu 0xa4 164 CURRENCY SIGN +¥ Ye 0xa5 165 YEN SIGN +¦ BB 0xa6 166 BROKEN BAR +§ SE 0xa7 167 SECTION SIGN +¨ ': 0xa8 168 DIAERESIS +© Co 0xa9 169 COPYRIGHT SIGN +ª -a 0xaa 170 FEMININE ORDINAL INDICATOR +« << 0xab 171 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +¬ NO 0xac 172 NOT SIGN +­ -- 0xad 173 SOFT HYPHEN +® Rg 0xae 174 REGISTERED SIGN +¯ 'm 0xaf 175 MACRON +° DG 0xb0 176 DEGREE SIGN +± +- 0xb1 177 PLUS-MINUS SIGN +² 2S 0xb2 178 SUPERSCRIPT TWO +³ 3S 0xb3 179 SUPERSCRIPT THREE +´ '' 0xb4 180 ACUTE ACCENT +µ My 0xb5 181 MICRO SIGN +¶ PI 0xb6 182 PILCROW SIGN +· .M 0xb7 183 MIDDLE DOT +¸ ', 0xb8 184 CEDILLA +¹ 1S 0xb9 185 SUPERSCRIPT ONE +º -o 0xba 186 MASCULINE ORDINAL INDICATOR +» >> 0xbb 187 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +¼ 14 0xbc 188 VULGAR FRACTION ONE QUARTER +½ 12 0xbd 189 VULGAR FRACTION ONE HALF +¾ 34 0xbe 190 VULGAR FRACTION THREE QUARTERS +¿ ?I 0xbf 191 INVERTED QUESTION MARK +À A! 0xc0 192 LATIN CAPITAL LETTER A WITH GRAVE +Á A' 0xc1 193 LATIN CAPITAL LETTER A WITH ACUTE + A> 0xc2 194 LATIN CAPITAL LETTER A WITH CIRCUMFLEX +à A? 0xc3 195 LATIN CAPITAL LETTER A WITH TILDE +Ä A: 0xc4 196 LATIN CAPITAL LETTER A WITH DIAERESIS +Å AA 0xc5 197 LATIN CAPITAL LETTER A WITH RING ABOVE +Æ AE 0xc6 198 LATIN CAPITAL LETTER AE +Ç C, 0xc7 199 LATIN CAPITAL LETTER C WITH CEDILLA +È E! 0xc8 200 LATIN CAPITAL LETTER E WITH GRAVE +É E' 0xc9 201 LATIN CAPITAL LETTER E WITH ACUTE +Ê E> 0xca 202 LATIN CAPITAL LETTER E WITH CIRCUMFLEX +Ë E: 0xcb 203 LATIN CAPITAL LETTER E WITH DIAERESIS +Ì I! 0xcc 204 LATIN CAPITAL LETTER I WITH GRAVE +Í I' 0xcd 205 LATIN CAPITAL LETTER I WITH ACUTE +Î I> 0xce 206 LATIN CAPITAL LETTER I WITH CIRCUMFLEX +Ï I: 0xcf 207 LATIN CAPITAL LETTER I WITH DIAERESIS +Ð D- 0xd0 208 LATIN CAPITAL LETTER ETH (Icelandic) +Ñ N? 0xd1 209 LATIN CAPITAL LETTER N WITH TILDE +Ò O! 0xd2 210 LATIN CAPITAL LETTER O WITH GRAVE +Ó O' 0xd3 211 LATIN CAPITAL LETTER O WITH ACUTE +Ô O> 0xd4 212 LATIN CAPITAL LETTER O WITH CIRCUMFLEX +Õ O? 0xd5 213 LATIN CAPITAL LETTER O WITH TILDE +Ö O: 0xd6 214 LATIN CAPITAL LETTER O WITH DIAERESIS +× *X 0xd7 215 MULTIPLICATION SIGN +Ø O/ 0xd8 216 LATIN CAPITAL LETTER O WITH STROKE +Ù U! 0xd9 217 LATIN CAPITAL LETTER U WITH GRAVE +Ú U' 0xda 218 LATIN CAPITAL LETTER U WITH ACUTE +Û U> 0xdb 219 LATIN CAPITAL LETTER U WITH CIRCUMFLEX +Ü U: 0xdc 220 LATIN CAPITAL LETTER U WITH DIAERESIS +Ý Y' 0xdd 221 LATIN CAPITAL LETTER Y WITH ACUTE +Þ TH 0xde 222 LATIN CAPITAL LETTER THORN (Icelandic) +ß ss 0xdf 223 LATIN SMALL LETTER SHARP S (German) +à a! 0xe0 224 LATIN SMALL LETTER A WITH GRAVE +á a' 0xe1 225 LATIN SMALL LETTER A WITH ACUTE +â a> 0xe2 226 LATIN SMALL LETTER A WITH CIRCUMFLEX +ã a? 0xe3 227 LATIN SMALL LETTER A WITH TILDE +ä a: 0xe4 228 LATIN SMALL LETTER A WITH DIAERESIS +å aa 0xe5 229 LATIN SMALL LETTER A WITH RING ABOVE +æ ae 0xe6 230 LATIN SMALL LETTER AE +ç c, 0xe7 231 LATIN SMALL LETTER C WITH CEDILLA +è e! 0xe8 232 LATIN SMALL LETTER E WITH GRAVE +é e' 0xe9 233 LATIN SMALL LETTER E WITH ACUTE +ê e> 0xea 234 LATIN SMALL LETTER E WITH CIRCUMFLEX +ë e: 0xeb 235 LATIN SMALL LETTER E WITH DIAERESIS +ì i! 0xec 236 LATIN SMALL LETTER I WITH GRAVE +í i' 0xed 237 LATIN SMALL LETTER I WITH ACUTE +î i> 0xee 238 LATIN SMALL LETTER I WITH CIRCUMFLEX +ï i: 0xef 239 LATIN SMALL LETTER I WITH DIAERESIS +ð d- 0xf0 240 LATIN SMALL LETTER ETH (Icelandic) +ñ n? 0xf1 241 LATIN SMALL LETTER N WITH TILDE +ò o! 0xf2 242 LATIN SMALL LETTER O WITH GRAVE +ó o' 0xf3 243 LATIN SMALL LETTER O WITH ACUTE +ô o> 0xf4 244 LATIN SMALL LETTER O WITH CIRCUMFLEX +õ o? 0xf5 245 LATIN SMALL LETTER O WITH TILDE +ö o: 0xf6 246 LATIN SMALL LETTER O WITH DIAERESIS +÷ -: 0xf7 247 DIVISION SIGN +ø o/ 0xf8 248 LATIN SMALL LETTER O WITH STROKE +ù u! 0xf9 249 LATIN SMALL LETTER U WITH GRAVE +ú u' 0xfa 250 LATIN SMALL LETTER U WITH ACUTE +û u> 0xfb 251 LATIN SMALL LETTER U WITH CIRCUMFLEX +ü u: 0xfc 252 LATIN SMALL LETTER U WITH DIAERESIS +ý y' 0xfd 253 LATIN SMALL LETTER Y WITH ACUTE +þ th 0xfe 254 LATIN SMALL LETTER THORN (Icelandic) +ÿ y: 0xff 255 LATIN SMALL LETTER Y WITH DIAERESIS + +Vim がマルチバイト (|multibyte|) サポート付きでコンパイルされていて、あなたが +マルチバイトの 'encoding' を使っているなら、さらに以下のダイグラフを使用でき +る: + + *digraph-table-mbyte* +char digraph hex dec official name ~ +Ā A- 0100 0256 LATIN CAPITAL LETTER A WITH MACRON +ā a- 0101 0257 LATIN SMALL LETTER A WITH MACRON +Ă A( 0102 0258 LATIN CAPITAL LETTER A WITH BREVE +ă a( 0103 0259 LATIN SMALL LETTER A WITH BREVE +Ą A; 0104 0260 LATIN CAPITAL LETTER A WITH OGONEK +ą a; 0105 0261 LATIN SMALL LETTER A WITH OGONEK +Ć C' 0106 0262 LATIN CAPITAL LETTER C WITH ACUTE +ć c' 0107 0263 LATIN SMALL LETTER C WITH ACUTE +Ĉ C> 0108 0264 LATIN CAPITAL LETTER C WITH CIRCUMFLEX +ĉ c> 0109 0265 LATIN SMALL LETTER C WITH CIRCUMFLEX +Ċ C. 010A 0266 LATIN CAPITAL LETTER C WITH DOT ABOVE +ċ c. 010B 0267 LATIN SMALL LETTER C WITH DOT ABOVE +Č C< 010C 0268 LATIN CAPITAL LETTER C WITH CARON +č c< 010D 0269 LATIN SMALL LETTER C WITH CARON +Ď D< 010E 0270 LATIN CAPITAL LETTER D WITH CARON +ď d< 010F 0271 LATIN SMALL LETTER D WITH CARON +Đ D/ 0110 0272 LATIN CAPITAL LETTER D WITH STROKE +đ d/ 0111 0273 LATIN SMALL LETTER D WITH STROKE +Ē E- 0112 0274 LATIN CAPITAL LETTER E WITH MACRON +ē e- 0113 0275 LATIN SMALL LETTER E WITH MACRON +Ĕ E( 0114 0276 LATIN CAPITAL LETTER E WITH BREVE +ĕ e( 0115 0277 LATIN SMALL LETTER E WITH BREVE +Ė E. 0116 0278 LATIN CAPITAL LETTER E WITH DOT ABOVE +ė e. 0117 0279 LATIN SMALL LETTER E WITH DOT ABOVE +Ę E; 0118 0280 LATIN CAPITAL LETTER E WITH OGONEK +ę e; 0119 0281 LATIN SMALL LETTER E WITH OGONEK +Ě E< 011A 0282 LATIN CAPITAL LETTER E WITH CARON +ě e< 011B 0283 LATIN SMALL LETTER E WITH CARON +Ĝ G> 011C 0284 LATIN CAPITAL LETTER G WITH CIRCUMFLEX +ĝ g> 011D 0285 LATIN SMALL LETTER G WITH CIRCUMFLEX +Ğ G( 011E 0286 LATIN CAPITAL LETTER G WITH BREVE +ğ g( 011F 0287 LATIN SMALL LETTER G WITH BREVE +Ġ G. 0120 0288 LATIN CAPITAL LETTER G WITH DOT ABOVE +ġ g. 0121 0289 LATIN SMALL LETTER G WITH DOT ABOVE +Ģ G, 0122 0290 LATIN CAPITAL LETTER G WITH CEDILLA +ģ g, 0123 0291 LATIN SMALL LETTER G WITH CEDILLA +Ĥ H> 0124 0292 LATIN CAPITAL LETTER H WITH CIRCUMFLEX +ĥ h> 0125 0293 LATIN SMALL LETTER H WITH CIRCUMFLEX +Ħ H/ 0126 0294 LATIN CAPITAL LETTER H WITH STROKE +ħ h/ 0127 0295 LATIN SMALL LETTER H WITH STROKE +Ĩ I? 0128 0296 LATIN CAPITAL LETTER I WITH TILDE +ĩ i? 0129 0297 LATIN SMALL LETTER I WITH TILDE +Ī I- 012A 0298 LATIN CAPITAL LETTER I WITH MACRON +ī i- 012B 0299 LATIN SMALL LETTER I WITH MACRON +Ĭ I( 012C 0300 LATIN CAPITAL LETTER I WITH BREVE +ĭ i( 012D 0301 LATIN SMALL LETTER I WITH BREVE +Į I; 012E 0302 LATIN CAPITAL LETTER I WITH OGONEK +į i; 012F 0303 LATIN SMALL LETTER I WITH OGONEK +İ I. 0130 0304 LATIN CAPITAL LETTER I WITH DOT ABOVE +ı i. 0131 0305 LATIN SMALL LETTER DOTLESS I +IJ IJ 0132 0306 LATIN CAPITAL LIGATURE IJ +ij ij 0133 0307 LATIN SMALL LIGATURE IJ +Ĵ J> 0134 0308 LATIN CAPITAL LETTER J WITH CIRCUMFLEX +ĵ j> 0135 0309 LATIN SMALL LETTER J WITH CIRCUMFLEX +Ķ K, 0136 0310 LATIN CAPITAL LETTER K WITH CEDILLA +ķ k, 0137 0311 LATIN SMALL LETTER K WITH CEDILLA +ĸ kk 0138 0312 LATIN SMALL LETTER KRA +Ĺ L' 0139 0313 LATIN CAPITAL LETTER L WITH ACUTE +ĺ l' 013A 0314 LATIN SMALL LETTER L WITH ACUTE +Ļ L, 013B 0315 LATIN CAPITAL LETTER L WITH CEDILLA +ļ l, 013C 0316 LATIN SMALL LETTER L WITH CEDILLA +Ľ L< 013D 0317 LATIN CAPITAL LETTER L WITH CARON +ľ l< 013E 0318 LATIN SMALL LETTER L WITH CARON +Ŀ L. 013F 0319 LATIN CAPITAL LETTER L WITH MIDDLE DOT +ŀ l. 0140 0320 LATIN SMALL LETTER L WITH MIDDLE DOT +Ł L/ 0141 0321 LATIN CAPITAL LETTER L WITH STROKE +ł l/ 0142 0322 LATIN SMALL LETTER L WITH STROKE +Ń N' 0143 0323 LATIN CAPITAL LETTER N WITH ACUTE ` +ń n' 0144 0324 LATIN SMALL LETTER N WITH ACUTE ` +Ņ N, 0145 0325 LATIN CAPITAL LETTER N WITH CEDILLA ` +ņ n, 0146 0326 LATIN SMALL LETTER N WITH CEDILLA ` +Ň N< 0147 0327 LATIN CAPITAL LETTER N WITH CARON ` +ň n< 0148 0328 LATIN SMALL LETTER N WITH CARON ` +ʼn 'n 0149 0329 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE ` +Ŋ NG 014A 0330 LATIN CAPITAL LETTER ENG +ŋ ng 014B 0331 LATIN SMALL LETTER ENG +Ō O- 014C 0332 LATIN CAPITAL LETTER O WITH MACRON +ō o- 014D 0333 LATIN SMALL LETTER O WITH MACRON +Ŏ O( 014E 0334 LATIN CAPITAL LETTER O WITH BREVE +ŏ o( 014F 0335 LATIN SMALL LETTER O WITH BREVE +Ő O" 0150 0336 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +ő o" 0151 0337 LATIN SMALL LETTER O WITH DOUBLE ACUTE +Œ OE 0152 0338 LATIN CAPITAL LIGATURE OE +œ oe 0153 0339 LATIN SMALL LIGATURE OE +Ŕ R' 0154 0340 LATIN CAPITAL LETTER R WITH ACUTE +ŕ r' 0155 0341 LATIN SMALL LETTER R WITH ACUTE +Ŗ R, 0156 0342 LATIN CAPITAL LETTER R WITH CEDILLA +ŗ r, 0157 0343 LATIN SMALL LETTER R WITH CEDILLA +Ř R< 0158 0344 LATIN CAPITAL LETTER R WITH CARON +ř r< 0159 0345 LATIN SMALL LETTER R WITH CARON +Ś S' 015A 0346 LATIN CAPITAL LETTER S WITH ACUTE +ś s' 015B 0347 LATIN SMALL LETTER S WITH ACUTE +Ŝ S> 015C 0348 LATIN CAPITAL LETTER S WITH CIRCUMFLEX +ŝ s> 015D 0349 LATIN SMALL LETTER S WITH CIRCUMFLEX +Ş S, 015E 0350 LATIN CAPITAL LETTER S WITH CEDILLA +ş s, 015F 0351 LATIN SMALL LETTER S WITH CEDILLA +Š S< 0160 0352 LATIN CAPITAL LETTER S WITH CARON +š s< 0161 0353 LATIN SMALL LETTER S WITH CARON +Ţ T, 0162 0354 LATIN CAPITAL LETTER T WITH CEDILLA +ţ t, 0163 0355 LATIN SMALL LETTER T WITH CEDILLA +Ť T< 0164 0356 LATIN CAPITAL LETTER T WITH CARON +ť t< 0165 0357 LATIN SMALL LETTER T WITH CARON +Ŧ T/ 0166 0358 LATIN CAPITAL LETTER T WITH STROKE +ŧ t/ 0167 0359 LATIN SMALL LETTER T WITH STROKE +Ũ U? 0168 0360 LATIN CAPITAL LETTER U WITH TILDE +ũ u? 0169 0361 LATIN SMALL LETTER U WITH TILDE +Ū U- 016A 0362 LATIN CAPITAL LETTER U WITH MACRON +ū u- 016B 0363 LATIN SMALL LETTER U WITH MACRON +Ŭ U( 016C 0364 LATIN CAPITAL LETTER U WITH BREVE +ŭ u( 016D 0365 LATIN SMALL LETTER U WITH BREVE +Ů U0 016E 0366 LATIN CAPITAL LETTER U WITH RING ABOVE +ů u0 016F 0367 LATIN SMALL LETTER U WITH RING ABOVE +Ű U" 0170 0368 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +ű u" 0171 0369 LATIN SMALL LETTER U WITH DOUBLE ACUTE +Ų U; 0172 0370 LATIN CAPITAL LETTER U WITH OGONEK +ų u; 0173 0371 LATIN SMALL LETTER U WITH OGONEK +Ŵ W> 0174 0372 LATIN CAPITAL LETTER W WITH CIRCUMFLEX +ŵ w> 0175 0373 LATIN SMALL LETTER W WITH CIRCUMFLEX +Ŷ Y> 0176 0374 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX +ŷ y> 0177 0375 LATIN SMALL LETTER Y WITH CIRCUMFLEX +Ÿ Y: 0178 0376 LATIN CAPITAL LETTER Y WITH DIAERESIS +Ź Z' 0179 0377 LATIN CAPITAL LETTER Z WITH ACUTE +ź z' 017A 0378 LATIN SMALL LETTER Z WITH ACUTE +Ż Z. 017B 0379 LATIN CAPITAL LETTER Z WITH DOT ABOVE +ż z. 017C 0380 LATIN SMALL LETTER Z WITH DOT ABOVE +Ž Z< 017D 0381 LATIN CAPITAL LETTER Z WITH CARON +ž z< 017E 0382 LATIN SMALL LETTER Z WITH CARON +Ơ O9 01A0 0416 LATIN CAPITAL LETTER O WITH HORN +ơ o9 01A1 0417 LATIN SMALL LETTER O WITH HORN +Ƣ OI 01A2 0418 LATIN CAPITAL LETTER OI +ƣ oi 01A3 0419 LATIN SMALL LETTER OI +Ʀ yr 01A6 0422 LATIN LETTER YR +Ư U9 01AF 0431 LATIN CAPITAL LETTER U WITH HORN +ư u9 01B0 0432 LATIN SMALL LETTER U WITH HORN +Ƶ Z/ 01B5 0437 LATIN CAPITAL LETTER Z WITH STROKE +ƶ z/ 01B6 0438 LATIN SMALL LETTER Z WITH STROKE +Ʒ ED 01B7 0439 LATIN CAPITAL LETTER EZH +Ǎ A< 01CD 0461 LATIN CAPITAL LETTER A WITH CARON +ǎ a< 01CE 0462 LATIN SMALL LETTER A WITH CARON +Ǐ I< 01CF 0463 LATIN CAPITAL LETTER I WITH CARON +ǐ i< 01D0 0464 LATIN SMALL LETTER I WITH CARON +Ǒ O< 01D1 0465 LATIN CAPITAL LETTER O WITH CARON +ǒ o< 01D2 0466 LATIN SMALL LETTER O WITH CARON +Ǔ U< 01D3 0467 LATIN CAPITAL LETTER U WITH CARON +ǔ u< 01D4 0468 LATIN SMALL LETTER U WITH CARON +Ǟ A1 01DE 0478 LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON +ǟ a1 01DF 0479 LATIN SMALL LETTER A WITH DIAERESIS AND MACRON +Ǡ A7 01E0 0480 LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON +ǡ a7 01E1 0481 LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON +Ǣ A3 01E2 0482 LATIN CAPITAL LETTER AE WITH MACRON +ǣ a3 01E3 0483 LATIN SMALL LETTER AE WITH MACRON +Ǥ G/ 01E4 0484 LATIN CAPITAL LETTER G WITH STROKE +ǥ g/ 01E5 0485 LATIN SMALL LETTER G WITH STROKE +Ǧ G< 01E6 0486 LATIN CAPITAL LETTER G WITH CARON +ǧ g< 01E7 0487 LATIN SMALL LETTER G WITH CARON +Ǩ K< 01E8 0488 LATIN CAPITAL LETTER K WITH CARON +ǩ k< 01E9 0489 LATIN SMALL LETTER K WITH CARON +Ǫ O; 01EA 0490 LATIN CAPITAL LETTER O WITH OGONEK +ǫ o; 01EB 0491 LATIN SMALL LETTER O WITH OGONEK +Ǭ O1 01EC 0492 LATIN CAPITAL LETTER O WITH OGONEK AND MACRON +ǭ o1 01ED 0493 LATIN SMALL LETTER O WITH OGONEK AND MACRON +Ǯ EZ 01EE 0494 LATIN CAPITAL LETTER EZH WITH CARON +ǯ ez 01EF 0495 LATIN SMALL LETTER EZH WITH CARON +ǰ j< 01F0 0496 LATIN SMALL LETTER J WITH CARON +Ǵ G' 01F4 0500 LATIN CAPITAL LETTER G WITH ACUTE +ǵ g' 01F5 0501 LATIN SMALL LETTER G WITH ACUTE +ʿ ;S 02BF 0703 MODIFIER LETTER LEFT HALF RING +ˇ '< 02C7 0711 CARON +˘ '( 02D8 0728 BREVE +˙ '. 02D9 0729 DOT ABOVE +˚ '0 02DA 0730 RING ABOVE +˛ '; 02DB 0731 OGONEK +˝ '" 02DD 0733 DOUBLE ACUTE ACCENT +Ά A% 0386 0902 GREEK CAPITAL LETTER ALPHA WITH TONOS +Έ E% 0388 0904 GREEK CAPITAL LETTER EPSILON WITH TONOS +Ή Y% 0389 0905 GREEK CAPITAL LETTER ETA WITH TONOS +Ί I% 038A 0906 GREEK CAPITAL LETTER IOTA WITH TONOS +Ό O% 038C 0908 GREEK CAPITAL LETTER OMICRON WITH TONOS +Ύ U% 038E 0910 GREEK CAPITAL LETTER UPSILON WITH TONOS +Ώ W% 038F 0911 GREEK CAPITAL LETTER OMEGA WITH TONOS +ΐ i3 0390 0912 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +Α A* 0391 0913 GREEK CAPITAL LETTER ALPHA +Β B* 0392 0914 GREEK CAPITAL LETTER BETA +Γ G* 0393 0915 GREEK CAPITAL LETTER GAMMA +Δ D* 0394 0916 GREEK CAPITAL LETTER DELTA +Ε E* 0395 0917 GREEK CAPITAL LETTER EPSILON +Ζ Z* 0396 0918 GREEK CAPITAL LETTER ZETA +Η Y* 0397 0919 GREEK CAPITAL LETTER ETA +Θ H* 0398 0920 GREEK CAPITAL LETTER THETA +Ι I* 0399 0921 GREEK CAPITAL LETTER IOTA +Κ K* 039A 0922 GREEK CAPITAL LETTER KAPPA +Λ L* 039B 0923 GREEK CAPITAL LETTER LAMDA +Μ M* 039C 0924 GREEK CAPITAL LETTER MU +Ν N* 039D 0925 GREEK CAPITAL LETTER NU +Ξ C* 039E 0926 GREEK CAPITAL LETTER XI +Ο O* 039F 0927 GREEK CAPITAL LETTER OMICRON +Π P* 03A0 0928 GREEK CAPITAL LETTER PI +Ρ R* 03A1 0929 GREEK CAPITAL LETTER RHO +Σ S* 03A3 0931 GREEK CAPITAL LETTER SIGMA +Τ T* 03A4 0932 GREEK CAPITAL LETTER TAU +Υ U* 03A5 0933 GREEK CAPITAL LETTER UPSILON +Φ F* 03A6 0934 GREEK CAPITAL LETTER PHI +Χ X* 03A7 0935 GREEK CAPITAL LETTER CHI +Ψ Q* 03A8 0936 GREEK CAPITAL LETTER PSI +Ω W* 03A9 0937 GREEK CAPITAL LETTER OMEGA +Ϊ J* 03AA 0938 GREEK CAPITAL LETTER IOTA WITH DIALYTIKA +Ϋ V* 03AB 0939 GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA +ά a% 03AC 0940 GREEK SMALL LETTER ALPHA WITH TONOS +έ e% 03AD 0941 GREEK SMALL LETTER EPSILON WITH TONOS +ή y% 03AE 0942 GREEK SMALL LETTER ETA WITH TONOS +ί i% 03AF 0943 GREEK SMALL LETTER IOTA WITH TONOS +ΰ u3 03B0 0944 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +α a* 03B1 0945 GREEK SMALL LETTER ALPHA +β b* 03B2 0946 GREEK SMALL LETTER BETA +γ g* 03B3 0947 GREEK SMALL LETTER GAMMA +δ d* 03B4 0948 GREEK SMALL LETTER DELTA +ε e* 03B5 0949 GREEK SMALL LETTER EPSILON +ζ z* 03B6 0950 GREEK SMALL LETTER ZETA +η y* 03B7 0951 GREEK SMALL LETTER ETA +θ h* 03B8 0952 GREEK SMALL LETTER THETA +ι i* 03B9 0953 GREEK SMALL LETTER IOTA +κ k* 03BA 0954 GREEK SMALL LETTER KAPPA +λ l* 03BB 0955 GREEK SMALL LETTER LAMDA +μ m* 03BC 0956 GREEK SMALL LETTER MU +ν n* 03BD 0957 GREEK SMALL LETTER NU +ξ c* 03BE 0958 GREEK SMALL LETTER XI +ο o* 03BF 0959 GREEK SMALL LETTER OMICRON +π p* 03C0 0960 GREEK SMALL LETTER PI +ρ r* 03C1 0961 GREEK SMALL LETTER RHO +ς *s 03C2 0962 GREEK SMALL LETTER FINAL SIGMA +σ s* 03C3 0963 GREEK SMALL LETTER SIGMA +τ t* 03C4 0964 GREEK SMALL LETTER TAU +υ u* 03C5 0965 GREEK SMALL LETTER UPSILON +φ f* 03C6 0966 GREEK SMALL LETTER PHI +χ x* 03C7 0967 GREEK SMALL LETTER CHI +ψ q* 03C8 0968 GREEK SMALL LETTER PSI +ω w* 03C9 0969 GREEK SMALL LETTER OMEGA +ϊ j* 03CA 0970 GREEK SMALL LETTER IOTA WITH DIALYTIKA +ϋ v* 03CB 0971 GREEK SMALL LETTER UPSILON WITH DIALYTIKA +ό o% 03CC 0972 GREEK SMALL LETTER OMICRON WITH TONOS +ύ u% 03CD 0973 GREEK SMALL LETTER UPSILON WITH TONOS +ώ w% 03CE 0974 GREEK SMALL LETTER OMEGA WITH TONOS +Ϙ 'G 03D8 0984 GREEK LETTER ARCHAIC KOPPA +ϙ ,G 03D9 0985 GREEK SMALL LETTER ARCHAIC KOPPA +Ϛ T3 03DA 0986 GREEK LETTER STIGMA +ϛ t3 03DB 0987 GREEK SMALL LETTER STIGMA +Ϝ M3 03DC 0988 GREEK LETTER DIGAMMA +ϝ m3 03DD 0989 GREEK SMALL LETTER DIGAMMA +Ϟ K3 03DE 0990 GREEK LETTER KOPPA +ϟ k3 03DF 0991 GREEK SMALL LETTER KOPPA +Ϡ P3 03E0 0992 GREEK LETTER SAMPI +ϡ p3 03E1 0993 GREEK SMALL LETTER SAMPI +ϴ '% 03F4 1012 GREEK CAPITAL THETA SYMBOL +ϵ j3 03F5 1013 GREEK LUNATE EPSILON SYMBOL +Ё IO 0401 1025 CYRILLIC CAPITAL LETTER IO +Ђ D% 0402 1026 CYRILLIC CAPITAL LETTER DJE +Ѓ G% 0403 1027 CYRILLIC CAPITAL LETTER GJE +Є IE 0404 1028 CYRILLIC CAPITAL LETTER UKRAINIAN IE +Ѕ DS 0405 1029 CYRILLIC CAPITAL LETTER DZE +І II 0406 1030 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +Ї YI 0407 1031 CYRILLIC CAPITAL LETTER YI +Ј J% 0408 1032 CYRILLIC CAPITAL LETTER JE +Љ LJ 0409 1033 CYRILLIC CAPITAL LETTER LJE +Њ NJ 040A 1034 CYRILLIC CAPITAL LETTER NJE +Ћ Ts 040B 1035 CYRILLIC CAPITAL LETTER TSHE +Ќ KJ 040C 1036 CYRILLIC CAPITAL LETTER KJE +Ў V% 040E 1038 CYRILLIC CAPITAL LETTER SHORT U +Џ DZ 040F 1039 CYRILLIC CAPITAL LETTER DZHE +А A= 0410 1040 CYRILLIC CAPITAL LETTER A +Б B= 0411 1041 CYRILLIC CAPITAL LETTER BE +В V= 0412 1042 CYRILLIC CAPITAL LETTER VE +Г G= 0413 1043 CYRILLIC CAPITAL LETTER GHE +Д D= 0414 1044 CYRILLIC CAPITAL LETTER DE +Е E= 0415 1045 CYRILLIC CAPITAL LETTER IE +Ж Z% 0416 1046 CYRILLIC CAPITAL LETTER ZHE +З Z= 0417 1047 CYRILLIC CAPITAL LETTER ZE +И I= 0418 1048 CYRILLIC CAPITAL LETTER I +Й J= 0419 1049 CYRILLIC CAPITAL LETTER SHORT I +К K= 041A 1050 CYRILLIC CAPITAL LETTER KA +Л L= 041B 1051 CYRILLIC CAPITAL LETTER EL +М M= 041C 1052 CYRILLIC CAPITAL LETTER EM +Н N= 041D 1053 CYRILLIC CAPITAL LETTER EN +О O= 041E 1054 CYRILLIC CAPITAL LETTER O +П P= 041F 1055 CYRILLIC CAPITAL LETTER PE +Р R= 0420 1056 CYRILLIC CAPITAL LETTER ER +С S= 0421 1057 CYRILLIC CAPITAL LETTER ES +Т T= 0422 1058 CYRILLIC CAPITAL LETTER TE +У U= 0423 1059 CYRILLIC CAPITAL LETTER U +Ф F= 0424 1060 CYRILLIC CAPITAL LETTER EF +Х H= 0425 1061 CYRILLIC CAPITAL LETTER HA +Ц C= 0426 1062 CYRILLIC CAPITAL LETTER TSE +Ч C% 0427 1063 CYRILLIC CAPITAL LETTER CHE +Ш S% 0428 1064 CYRILLIC CAPITAL LETTER SHA +Щ Sc 0429 1065 CYRILLIC CAPITAL LETTER SHCHA +Ъ =" 042A 1066 CYRILLIC CAPITAL LETTER HARD SIGN +Ы Y= 042B 1067 CYRILLIC CAPITAL LETTER YERU +Ь %" 042C 1068 CYRILLIC CAPITAL LETTER SOFT SIGN +Э JE 042D 1069 CYRILLIC CAPITAL LETTER E +Ю JU 042E 1070 CYRILLIC CAPITAL LETTER YU +Я JA 042F 1071 CYRILLIC CAPITAL LETTER YA +а a= 0430 1072 CYRILLIC SMALL LETTER A +б b= 0431 1073 CYRILLIC SMALL LETTER BE +в v= 0432 1074 CYRILLIC SMALL LETTER VE +г g= 0433 1075 CYRILLIC SMALL LETTER GHE +д d= 0434 1076 CYRILLIC SMALL LETTER DE +е e= 0435 1077 CYRILLIC SMALL LETTER IE +ж z% 0436 1078 CYRILLIC SMALL LETTER ZHE +з z= 0437 1079 CYRILLIC SMALL LETTER ZE +и i= 0438 1080 CYRILLIC SMALL LETTER I +й j= 0439 1081 CYRILLIC SMALL LETTER SHORT I +к k= 043A 1082 CYRILLIC SMALL LETTER KA +л l= 043B 1083 CYRILLIC SMALL LETTER EL +м m= 043C 1084 CYRILLIC SMALL LETTER EM +н n= 043D 1085 CYRILLIC SMALL LETTER EN +о o= 043E 1086 CYRILLIC SMALL LETTER O +п p= 043F 1087 CYRILLIC SMALL LETTER PE +р r= 0440 1088 CYRILLIC SMALL LETTER ER +с s= 0441 1089 CYRILLIC SMALL LETTER ES +т t= 0442 1090 CYRILLIC SMALL LETTER TE +у u= 0443 1091 CYRILLIC SMALL LETTER U +ф f= 0444 1092 CYRILLIC SMALL LETTER EF +х h= 0445 1093 CYRILLIC SMALL LETTER HA +ц c= 0446 1094 CYRILLIC SMALL LETTER TSE +ч c% 0447 1095 CYRILLIC SMALL LETTER CHE +ш s% 0448 1096 CYRILLIC SMALL LETTER SHA +щ sc 0449 1097 CYRILLIC SMALL LETTER SHCHA +ъ =' 044A 1098 CYRILLIC SMALL LETTER HARD SIGN +ы y= 044B 1099 CYRILLIC SMALL LETTER YERU +ь %' 044C 1100 CYRILLIC SMALL LETTER SOFT SIGN +э je 044D 1101 CYRILLIC SMALL LETTER E +ю ju 044E 1102 CYRILLIC SMALL LETTER YU +я ja 044F 1103 CYRILLIC SMALL LETTER YA +ё io 0451 1105 CYRILLIC SMALL LETTER IO +ђ d% 0452 1106 CYRILLIC SMALL LETTER DJE +ѓ g% 0453 1107 CYRILLIC SMALL LETTER GJE +є ie 0454 1108 CYRILLIC SMALL LETTER UKRAINIAN IE +ѕ ds 0455 1109 CYRILLIC SMALL LETTER DZE +і ii 0456 1110 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +ї yi 0457 1111 CYRILLIC SMALL LETTER YI +ј j% 0458 1112 CYRILLIC SMALL LETTER JE +љ lj 0459 1113 CYRILLIC SMALL LETTER LJE +њ nj 045A 1114 CYRILLIC SMALL LETTER NJE +ћ ts 045B 1115 CYRILLIC SMALL LETTER TSHE +ќ kj 045C 1116 CYRILLIC SMALL LETTER KJE +ў v% 045E 1118 CYRILLIC SMALL LETTER SHORT U +џ dz 045F 1119 CYRILLIC SMALL LETTER DZHE +Ѣ Y3 0462 1122 CYRILLIC CAPITAL LETTER YAT +ѣ y3 0463 1123 CYRILLIC SMALL LETTER YAT +Ѫ O3 046A 1130 CYRILLIC CAPITAL LETTER BIG YUS +ѫ o3 046B 1131 CYRILLIC SMALL LETTER BIG YUS +Ѳ F3 0472 1138 CYRILLIC CAPITAL LETTER FITA +ѳ f3 0473 1139 CYRILLIC SMALL LETTER FITA +Ѵ V3 0474 1140 CYRILLIC CAPITAL LETTER IZHITSA +ѵ v3 0475 1141 CYRILLIC SMALL LETTER IZHITSA +Ҁ C3 0480 1152 CYRILLIC CAPITAL LETTER KOPPA +ҁ c3 0481 1153 CYRILLIC SMALL LETTER KOPPA +Ґ G3 0490 1168 CYRILLIC CAPITAL LETTER GHE WITH UPTURN +ґ g3 0491 1169 CYRILLIC SMALL LETTER GHE WITH UPTURN +א A+ 05D0 1488 HEBREW LETTER ALEF +ב B+ 05D1 1489 HEBREW LETTER BET +ג G+ 05D2 1490 HEBREW LETTER GIMEL +ד D+ 05D3 1491 HEBREW LETTER DALET +ה H+ 05D4 1492 HEBREW LETTER HE +ו W+ 05D5 1493 HEBREW LETTER VAV +ז Z+ 05D6 1494 HEBREW LETTER ZAYIN +ח X+ 05D7 1495 HEBREW LETTER HET +ט Tj 05D8 1496 HEBREW LETTER TET +י J+ 05D9 1497 HEBREW LETTER YOD +ך K% 05DA 1498 HEBREW LETTER FINAL KAF +כ K+ 05DB 1499 HEBREW LETTER KAF +ל L+ 05DC 1500 HEBREW LETTER LAMED +ם M% 05DD 1501 HEBREW LETTER FINAL MEM +מ M+ 05DE 1502 HEBREW LETTER MEM +ן N% 05DF 1503 HEBREW LETTER FINAL NUN ` +נ N+ 05E0 1504 HEBREW LETTER NUN ` +ס S+ 05E1 1505 HEBREW LETTER SAMEKH +ע E+ 05E2 1506 HEBREW LETTER AYIN +ף P% 05E3 1507 HEBREW LETTER FINAL PE +פ P+ 05E4 1508 HEBREW LETTER PE +ץ Zj 05E5 1509 HEBREW LETTER FINAL TSADI +צ ZJ 05E6 1510 HEBREW LETTER TSADI +ק Q+ 05E7 1511 HEBREW LETTER QOF +ר R+ 05E8 1512 HEBREW LETTER RESH +ש Sh 05E9 1513 HEBREW LETTER SHIN +ת T+ 05EA 1514 HEBREW LETTER TAV +، ,+ 060C 1548 ARABIC COMMA +؛ ;+ 061B 1563 ARABIC SEMICOLON +؟ ?+ 061F 1567 ARABIC QUESTION MARK +ء H' 0621 1569 ARABIC LETTER HAMZA +آ aM 0622 1570 ARABIC LETTER ALEF WITH MADDA ABOVE +أ aH 0623 1571 ARABIC LETTER ALEF WITH HAMZA ABOVE +ؤ wH 0624 1572 ARABIC LETTER WAW WITH HAMZA ABOVE +إ ah 0625 1573 ARABIC LETTER ALEF WITH HAMZA BELOW +ئ yH 0626 1574 ARABIC LETTER YEH WITH HAMZA ABOVE +ا a+ 0627 1575 ARABIC LETTER ALEF +ب b+ 0628 1576 ARABIC LETTER BEH +ة tm 0629 1577 ARABIC LETTER TEH MARBUTA +ت t+ 062A 1578 ARABIC LETTER TEH +ث tk 062B 1579 ARABIC LETTER THEH +ج g+ 062C 1580 ARABIC LETTER JEEM +ح hk 062D 1581 ARABIC LETTER HAH +خ x+ 062E 1582 ARABIC LETTER KHAH +د d+ 062F 1583 ARABIC LETTER DAL +ذ dk 0630 1584 ARABIC LETTER THAL +ر r+ 0631 1585 ARABIC LETTER REH +ز z+ 0632 1586 ARABIC LETTER ZAIN +س s+ 0633 1587 ARABIC LETTER SEEN +ش sn 0634 1588 ARABIC LETTER SHEEN +ص c+ 0635 1589 ARABIC LETTER SAD +ض dd 0636 1590 ARABIC LETTER DAD +ط tj 0637 1591 ARABIC LETTER TAH +ظ zH 0638 1592 ARABIC LETTER ZAH +ع e+ 0639 1593 ARABIC LETTER AIN +غ i+ 063A 1594 ARABIC LETTER GHAIN +ـ ++ 0640 1600 ARABIC TATWEEL +ف f+ 0641 1601 ARABIC LETTER FEH +ق q+ 0642 1602 ARABIC LETTER QAF +ك k+ 0643 1603 ARABIC LETTER KAF +ل l+ 0644 1604 ARABIC LETTER LAM +م m+ 0645 1605 ARABIC LETTER MEEM +ن n+ 0646 1606 ARABIC LETTER NOON +ه h+ 0647 1607 ARABIC LETTER HEH +و w+ 0648 1608 ARABIC LETTER WAW +ى j+ 0649 1609 ARABIC LETTER ALEF MAKSURA +ي y+ 064A 1610 ARABIC LETTER YEH +ً :+ 064B 1611 ARABIC FATHATAN +ٌ "+ 064C 1612 ARABIC DAMMATAN +ٍ =+ 064D 1613 ARABIC KASRATAN +َ /+ 064E 1614 ARABIC FATHA +ُ '+ 064F 1615 ARABIC DAMMA +ِ 1+ 0650 1616 ARABIC KASRA +ّ 3+ 0651 1617 ARABIC SHADDA +ْ 0+ 0652 1618 ARABIC SUKUN +ٰ aS 0670 1648 ARABIC LETTER SUPERSCRIPT ALEF +پ p+ 067E 1662 ARABIC LETTER PEH +ڤ v+ 06A4 1700 ARABIC LETTER VEH +گ gf 06AF 1711 ARABIC LETTER GAF +۰ 0a 06F0 1776 EXTENDED ARABIC-INDIC DIGIT ZERO +۱ 1a 06F1 1777 EXTENDED ARABIC-INDIC DIGIT ONE +۲ 2a 06F2 1778 EXTENDED ARABIC-INDIC DIGIT TWO +۳ 3a 06F3 1779 EXTENDED ARABIC-INDIC DIGIT THREE +۴ 4a 06F4 1780 EXTENDED ARABIC-INDIC DIGIT FOUR +۵ 5a 06F5 1781 EXTENDED ARABIC-INDIC DIGIT FIVE +۶ 6a 06F6 1782 EXTENDED ARABIC-INDIC DIGIT SIX +۷ 7a 06F7 1783 EXTENDED ARABIC-INDIC DIGIT SEVEN +۸ 8a 06F8 1784 EXTENDED ARABIC-INDIC DIGIT EIGHT +۹ 9a 06F9 1785 EXTENDED ARABIC-INDIC DIGIT NINE +Ḃ B. 1E02 7682 LATIN CAPITAL LETTER B WITH DOT ABOVE +ḃ b. 1E03 7683 LATIN SMALL LETTER B WITH DOT ABOVE +Ḇ B_ 1E06 7686 LATIN CAPITAL LETTER B WITH LINE BELOW +ḇ b_ 1E07 7687 LATIN SMALL LETTER B WITH LINE BELOW +Ḋ D. 1E0A 7690 LATIN CAPITAL LETTER D WITH DOT ABOVE +ḋ d. 1E0B 7691 LATIN SMALL LETTER D WITH DOT ABOVE +Ḏ D_ 1E0E 7694 LATIN CAPITAL LETTER D WITH LINE BELOW +ḏ d_ 1E0F 7695 LATIN SMALL LETTER D WITH LINE BELOW +Ḑ D, 1E10 7696 LATIN CAPITAL LETTER D WITH CEDILLA +ḑ d, 1E11 7697 LATIN SMALL LETTER D WITH CEDILLA +Ḟ F. 1E1E 7710 LATIN CAPITAL LETTER F WITH DOT ABOVE +ḟ f. 1E1F 7711 LATIN SMALL LETTER F WITH DOT ABOVE +Ḡ G- 1E20 7712 LATIN CAPITAL LETTER G WITH MACRON +ḡ g- 1E21 7713 LATIN SMALL LETTER G WITH MACRON +Ḣ H. 1E22 7714 LATIN CAPITAL LETTER H WITH DOT ABOVE +ḣ h. 1E23 7715 LATIN SMALL LETTER H WITH DOT ABOVE +Ḧ H: 1E26 7718 LATIN CAPITAL LETTER H WITH DIAERESIS +ḧ h: 1E27 7719 LATIN SMALL LETTER H WITH DIAERESIS +Ḩ H, 1E28 7720 LATIN CAPITAL LETTER H WITH CEDILLA +ḩ h, 1E29 7721 LATIN SMALL LETTER H WITH CEDILLA +Ḱ K' 1E30 7728 LATIN CAPITAL LETTER K WITH ACUTE +ḱ k' 1E31 7729 LATIN SMALL LETTER K WITH ACUTE +Ḵ K_ 1E34 7732 LATIN CAPITAL LETTER K WITH LINE BELOW +ḵ k_ 1E35 7733 LATIN SMALL LETTER K WITH LINE BELOW +Ḻ L_ 1E3A 7738 LATIN CAPITAL LETTER L WITH LINE BELOW +ḻ l_ 1E3B 7739 LATIN SMALL LETTER L WITH LINE BELOW +Ḿ M' 1E3E 7742 LATIN CAPITAL LETTER M WITH ACUTE +ḿ m' 1E3F 7743 LATIN SMALL LETTER M WITH ACUTE +Ṁ M. 1E40 7744 LATIN CAPITAL LETTER M WITH DOT ABOVE +ṁ m. 1E41 7745 LATIN SMALL LETTER M WITH DOT ABOVE +Ṅ N. 1E44 7748 LATIN CAPITAL LETTER N WITH DOT ABOVE ` +ṅ n. 1E45 7749 LATIN SMALL LETTER N WITH DOT ABOVE ` +Ṉ N_ 1E48 7752 LATIN CAPITAL LETTER N WITH LINE BELOW ` +ṉ n_ 1E49 7753 LATIN SMALL LETTER N WITH LINE BELOW ` +Ṕ P' 1E54 7764 LATIN CAPITAL LETTER P WITH ACUTE +ṕ p' 1E55 7765 LATIN SMALL LETTER P WITH ACUTE +Ṗ P. 1E56 7766 LATIN CAPITAL LETTER P WITH DOT ABOVE +ṗ p. 1E57 7767 LATIN SMALL LETTER P WITH DOT ABOVE +Ṙ R. 1E58 7768 LATIN CAPITAL LETTER R WITH DOT ABOVE +ṙ r. 1E59 7769 LATIN SMALL LETTER R WITH DOT ABOVE +Ṟ R_ 1E5E 7774 LATIN CAPITAL LETTER R WITH LINE BELOW +ṟ r_ 1E5F 7775 LATIN SMALL LETTER R WITH LINE BELOW +Ṡ S. 1E60 7776 LATIN CAPITAL LETTER S WITH DOT ABOVE +ṡ s. 1E61 7777 LATIN SMALL LETTER S WITH DOT ABOVE +Ṫ T. 1E6A 7786 LATIN CAPITAL LETTER T WITH DOT ABOVE +ṫ t. 1E6B 7787 LATIN SMALL LETTER T WITH DOT ABOVE +Ṯ T_ 1E6E 7790 LATIN CAPITAL LETTER T WITH LINE BELOW +ṯ t_ 1E6F 7791 LATIN SMALL LETTER T WITH LINE BELOW +Ṽ V? 1E7C 7804 LATIN CAPITAL LETTER V WITH TILDE +ṽ v? 1E7D 7805 LATIN SMALL LETTER V WITH TILDE +Ẁ W! 1E80 7808 LATIN CAPITAL LETTER W WITH GRAVE +ẁ w! 1E81 7809 LATIN SMALL LETTER W WITH GRAVE +Ẃ W' 1E82 7810 LATIN CAPITAL LETTER W WITH ACUTE +ẃ w' 1E83 7811 LATIN SMALL LETTER W WITH ACUTE +Ẅ W: 1E84 7812 LATIN CAPITAL LETTER W WITH DIAERESIS +ẅ w: 1E85 7813 LATIN SMALL LETTER W WITH DIAERESIS +Ẇ W. 1E86 7814 LATIN CAPITAL LETTER W WITH DOT ABOVE +ẇ w. 1E87 7815 LATIN SMALL LETTER W WITH DOT ABOVE +Ẋ X. 1E8A 7818 LATIN CAPITAL LETTER X WITH DOT ABOVE +ẋ x. 1E8B 7819 LATIN SMALL LETTER X WITH DOT ABOVE +Ẍ X: 1E8C 7820 LATIN CAPITAL LETTER X WITH DIAERESIS +ẍ x: 1E8D 7821 LATIN SMALL LETTER X WITH DIAERESIS +Ẏ Y. 1E8E 7822 LATIN CAPITAL LETTER Y WITH DOT ABOVE +ẏ y. 1E8F 7823 LATIN SMALL LETTER Y WITH DOT ABOVE +Ẑ Z> 1E90 7824 LATIN CAPITAL LETTER Z WITH CIRCUMFLEX +ẑ z> 1E91 7825 LATIN SMALL LETTER Z WITH CIRCUMFLEX +Ẕ Z_ 1E94 7828 LATIN CAPITAL LETTER Z WITH LINE BELOW +ẕ z_ 1E95 7829 LATIN SMALL LETTER Z WITH LINE BELOW +ẖ h_ 1E96 7830 LATIN SMALL LETTER H WITH LINE BELOW +ẗ t: 1E97 7831 LATIN SMALL LETTER T WITH DIAERESIS +ẘ w0 1E98 7832 LATIN SMALL LETTER W WITH RING ABOVE +ẙ y0 1E99 7833 LATIN SMALL LETTER Y WITH RING ABOVE +Ả A2 1EA2 7842 LATIN CAPITAL LETTER A WITH HOOK ABOVE +ả a2 1EA3 7843 LATIN SMALL LETTER A WITH HOOK ABOVE +Ẻ E2 1EBA 7866 LATIN CAPITAL LETTER E WITH HOOK ABOVE +ẻ e2 1EBB 7867 LATIN SMALL LETTER E WITH HOOK ABOVE +Ẽ E? 1EBC 7868 LATIN CAPITAL LETTER E WITH TILDE +ẽ e? 1EBD 7869 LATIN SMALL LETTER E WITH TILDE +Ỉ I2 1EC8 7880 LATIN CAPITAL LETTER I WITH HOOK ABOVE +ỉ i2 1EC9 7881 LATIN SMALL LETTER I WITH HOOK ABOVE +Ỏ O2 1ECE 7886 LATIN CAPITAL LETTER O WITH HOOK ABOVE +ỏ o2 1ECF 7887 LATIN SMALL LETTER O WITH HOOK ABOVE +Ủ U2 1EE6 7910 LATIN CAPITAL LETTER U WITH HOOK ABOVE +ủ u2 1EE7 7911 LATIN SMALL LETTER U WITH HOOK ABOVE +Ỳ Y! 1EF2 7922 LATIN CAPITAL LETTER Y WITH GRAVE +ỳ y! 1EF3 7923 LATIN SMALL LETTER Y WITH GRAVE +Ỷ Y2 1EF6 7926 LATIN CAPITAL LETTER Y WITH HOOK ABOVE +ỷ y2 1EF7 7927 LATIN SMALL LETTER Y WITH HOOK ABOVE +Ỹ Y? 1EF8 7928 LATIN CAPITAL LETTER Y WITH TILDE +ỹ y? 1EF9 7929 LATIN SMALL LETTER Y WITH TILDE +ἀ ;' 1F00 7936 GREEK SMALL LETTER ALPHA WITH PSILI +ἁ ,' 1F01 7937 GREEK SMALL LETTER ALPHA WITH DASIA +ἂ ;! 1F02 7938 GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA +ἃ ,! 1F03 7939 GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA +ἄ ?; 1F04 7940 GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA +ἅ ?, 1F05 7941 GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA +ἆ !: 1F06 7942 GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI +ἇ ?: 1F07 7943 GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI +  1N 2002 8194 EN SPACE +  1M 2003 8195 EM SPACE +  3M 2004 8196 THREE-PER-EM SPACE +  4M 2005 8197 FOUR-PER-EM SPACE +  6M 2006 8198 SIX-PER-EM SPACE +  1T 2009 8201 THIN SPACE +  1H 200A 8202 HAIR SPACE +‐ -1 2010 8208 HYPHEN +– -N 2013 8211 EN DASH ` +— -M 2014 8212 EM DASH +― -3 2015 8213 HORIZONTAL BAR +‖ !2 2016 8214 DOUBLE VERTICAL LINE +‗ =2 2017 8215 DOUBLE LOW LINE +‘ '6 2018 8216 LEFT SINGLE QUOTATION MARK +’ '9 2019 8217 RIGHT SINGLE QUOTATION MARK +‚ .9 201A 8218 SINGLE LOW-9 QUOTATION MARK +‛ 9' 201B 8219 SINGLE HIGH-REVERSED-9 QUOTATION MARK +“ "6 201C 8220 LEFT DOUBLE QUOTATION MARK +” "9 201D 8221 RIGHT DOUBLE QUOTATION MARK +„ :9 201E 8222 DOUBLE LOW-9 QUOTATION MARK +‟ 9" 201F 8223 DOUBLE HIGH-REVERSED-9 QUOTATION MARK +† /- 2020 8224 DAGGER +‡ /= 2021 8225 DOUBLE DAGGER +‥ .. 2025 8229 TWO DOT LEADER +… ,. 2026 8230 HORIZONTAL ELLIPSIS +‰ %0 2030 8240 PER MILLE SIGN +′ 1' 2032 8242 PRIME +″ 2' 2033 8243 DOUBLE PRIME +‴ 3' 2034 8244 TRIPLE PRIME +‵ 1" 2035 8245 REVERSED PRIME +‶ 2" 2036 8246 REVERSED DOUBLE PRIME +‷ 3" 2037 8247 REVERSED TRIPLE PRIME +‸ Ca 2038 8248 CARET +‹ <1 2039 8249 SINGLE LEFT-POINTING ANGLE QUOTATION MARK +› >1 203A 8250 SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +※ :X 203B 8251 REFERENCE MARK +‾ '- 203E 8254 OVERLINE +⁄ /f 2044 8260 FRACTION SLASH +⁰ 0S 2070 8304 SUPERSCRIPT ZERO +⁴ 4S 2074 8308 SUPERSCRIPT FOUR +⁵ 5S 2075 8309 SUPERSCRIPT FIVE +⁶ 6S 2076 8310 SUPERSCRIPT SIX +⁷ 7S 2077 8311 SUPERSCRIPT SEVEN +⁸ 8S 2078 8312 SUPERSCRIPT EIGHT +⁹ 9S 2079 8313 SUPERSCRIPT NINE +⁺ +S 207A 8314 SUPERSCRIPT PLUS SIGN +⁻ -S 207B 8315 SUPERSCRIPT MINUS +⁼ =S 207C 8316 SUPERSCRIPT EQUALS SIGN +⁽ (S 207D 8317 SUPERSCRIPT LEFT PARENTHESIS +⁾ )S 207E 8318 SUPERSCRIPT RIGHT PARENTHESIS +ⁿ nS 207F 8319 SUPERSCRIPT LATIN SMALL LETTER N ` +₀ 0s 2080 8320 SUBSCRIPT ZERO +₁ 1s 2081 8321 SUBSCRIPT ONE +₂ 2s 2082 8322 SUBSCRIPT TWO +₃ 3s 2083 8323 SUBSCRIPT THREE +₄ 4s 2084 8324 SUBSCRIPT FOUR +₅ 5s 2085 8325 SUBSCRIPT FIVE +₆ 6s 2086 8326 SUBSCRIPT SIX +₇ 7s 2087 8327 SUBSCRIPT SEVEN +₈ 8s 2088 8328 SUBSCRIPT EIGHT +₉ 9s 2089 8329 SUBSCRIPT NINE +₊ +s 208A 8330 SUBSCRIPT PLUS SIGN +₋ -s 208B 8331 SUBSCRIPT MINUS +₌ =s 208C 8332 SUBSCRIPT EQUALS SIGN +₍ (s 208D 8333 SUBSCRIPT LEFT PARENTHESIS +₎ )s 208E 8334 SUBSCRIPT RIGHT PARENTHESIS +₤ Li 20A4 8356 LIRA SIGN +₧ Pt 20A7 8359 PESETA SIGN +₩ W= 20A9 8361 WON SIGN +€ Eu 20AC 8364 EURO SIGN +₽ =R 20BD 8381 ROUBLE SIGN +₽ =P 20BD 8381 ROUBLE SIGN +℃ oC 2103 8451 DEGREE CELSIUS +℅ co 2105 8453 CARE OF +℉ oF 2109 8457 DEGREE FAHRENHEIT +№ N0 2116 8470 NUMERO SIGN +℗ PO 2117 8471 SOUND RECORDING COPYRIGHT +℞ Rx 211E 8478 PRESCRIPTION TAKE +℠ SM 2120 8480 SERVICE MARK +™ TM 2122 8482 TRADE MARK SIGN +Ω Om 2126 8486 OHM SIGN +Å AO 212B 8491 ANGSTROM SIGN +⅓ 13 2153 8531 VULGAR FRACTION ONE THIRD +⅔ 23 2154 8532 VULGAR FRACTION TWO THIRDS +⅕ 15 2155 8533 VULGAR FRACTION ONE FIFTH +⅖ 25 2156 8534 VULGAR FRACTION TWO FIFTHS +⅗ 35 2157 8535 VULGAR FRACTION THREE FIFTHS +⅘ 45 2158 8536 VULGAR FRACTION FOUR FIFTHS +⅙ 16 2159 8537 VULGAR FRACTION ONE SIXTH +⅚ 56 215A 8538 VULGAR FRACTION FIVE SIXTHS +⅛ 18 215B 8539 VULGAR FRACTION ONE EIGHTH +⅜ 38 215C 8540 VULGAR FRACTION THREE EIGHTHS +⅝ 58 215D 8541 VULGAR FRACTION FIVE EIGHTHS +⅞ 78 215E 8542 VULGAR FRACTION SEVEN EIGHTHS +Ⅰ 1R 2160 8544 ROMAN NUMERAL ONE +Ⅱ 2R 2161 8545 ROMAN NUMERAL TWO +Ⅲ 3R 2162 8546 ROMAN NUMERAL THREE +Ⅳ 4R 2163 8547 ROMAN NUMERAL FOUR +Ⅴ 5R 2164 8548 ROMAN NUMERAL FIVE +Ⅵ 6R 2165 8549 ROMAN NUMERAL SIX +Ⅶ 7R 2166 8550 ROMAN NUMERAL SEVEN +Ⅷ 8R 2167 8551 ROMAN NUMERAL EIGHT +Ⅸ 9R 2168 8552 ROMAN NUMERAL NINE +Ⅹ aR 2169 8553 ROMAN NUMERAL TEN +Ⅺ bR 216A 8554 ROMAN NUMERAL ELEVEN +Ⅻ cR 216B 8555 ROMAN NUMERAL TWELVE +ⅰ 1r 2170 8560 SMALL ROMAN NUMERAL ONE +ⅱ 2r 2171 8561 SMALL ROMAN NUMERAL TWO +ⅲ 3r 2172 8562 SMALL ROMAN NUMERAL THREE +ⅳ 4r 2173 8563 SMALL ROMAN NUMERAL FOUR +ⅴ 5r 2174 8564 SMALL ROMAN NUMERAL FIVE +ⅵ 6r 2175 8565 SMALL ROMAN NUMERAL SIX +ⅶ 7r 2176 8566 SMALL ROMAN NUMERAL SEVEN +ⅷ 8r 2177 8567 SMALL ROMAN NUMERAL EIGHT +ⅸ 9r 2178 8568 SMALL ROMAN NUMERAL NINE +ⅹ ar 2179 8569 SMALL ROMAN NUMERAL TEN +ⅺ br 217A 8570 SMALL ROMAN NUMERAL ELEVEN +ⅻ cr 217B 8571 SMALL ROMAN NUMERAL TWELVE +← <- 2190 8592 LEFTWARDS ARROW +↑ -! 2191 8593 UPWARDS ARROW +→ -> 2192 8594 RIGHTWARDS ARROW +↓ -v 2193 8595 DOWNWARDS ARROW +↔ <> 2194 8596 LEFT RIGHT ARROW +↕ UD 2195 8597 UP DOWN ARROW +⇐ <= 21D0 8656 LEFTWARDS DOUBLE ARROW +⇒ => 21D2 8658 RIGHTWARDS DOUBLE ARROW +⇔ == 21D4 8660 LEFT RIGHT DOUBLE ARROW +∀ FA 2200 8704 FOR ALL +∂ dP 2202 8706 PARTIAL DIFFERENTIAL +∃ TE 2203 8707 THERE EXISTS +∅ /0 2205 8709 EMPTY SET +∆ DE 2206 8710 INCREMENT +∇ NB 2207 8711 NABLA +∈ (- 2208 8712 ELEMENT OF +∋ -) 220B 8715 CONTAINS AS MEMBER +∏ *P 220F 8719 N-ARY PRODUCT ` +∑ +Z 2211 8721 N-ARY SUMMATION ` +− -2 2212 8722 MINUS SIGN +∓ -+ 2213 8723 MINUS-OR-PLUS SIGN +∗ *- 2217 8727 ASTERISK OPERATOR +∘ Ob 2218 8728 RING OPERATOR +∙ Sb 2219 8729 BULLET OPERATOR +√ RT 221A 8730 SQUARE ROOT +∝ 0( 221D 8733 PROPORTIONAL TO +∞ 00 221E 8734 INFINITY +∟ -L 221F 8735 RIGHT ANGLE +∠ -V 2220 8736 ANGLE +∥ PP 2225 8741 PARALLEL TO +∧ AN 2227 8743 LOGICAL AND +∨ OR 2228 8744 LOGICAL OR +∩ (U 2229 8745 INTERSECTION +∪ )U 222A 8746 UNION +∫ In 222B 8747 INTEGRAL +∬ DI 222C 8748 DOUBLE INTEGRAL +∮ Io 222E 8750 CONTOUR INTEGRAL +∴ .: 2234 8756 THEREFORE +∵ :. 2235 8757 BECAUSE +∶ :R 2236 8758 RATIO +∷ :: 2237 8759 PROPORTION +∼ ?1 223C 8764 TILDE OPERATOR +∾ CG 223E 8766 INVERTED LAZY S +≃ ?- 2243 8771 ASYMPTOTICALLY EQUAL TO +≅ ?= 2245 8773 APPROXIMATELY EQUAL TO +≈ ?2 2248 8776 ALMOST EQUAL TO +≌ =? 224C 8780 ALL EQUAL TO +≓ HI 2253 8787 IMAGE OF OR APPROXIMATELY EQUAL TO +≠ != 2260 8800 NOT EQUAL TO +≡ =3 2261 8801 IDENTICAL TO +≤ =< 2264 8804 LESS-THAN OR EQUAL TO +≥ >= 2265 8805 GREATER-THAN OR EQUAL TO +≪ <* 226A 8810 MUCH LESS-THAN +≫ *> 226B 8811 MUCH GREATER-THAN +≮ !< 226E 8814 NOT LESS-THAN +≯ !> 226F 8815 NOT GREATER-THAN +⊂ (C 2282 8834 SUBSET OF +⊃ )C 2283 8835 SUPERSET OF +⊆ (_ 2286 8838 SUBSET OF OR EQUAL TO +⊇ )_ 2287 8839 SUPERSET OF OR EQUAL TO +⊙ 0. 2299 8857 CIRCLED DOT OPERATOR +⊚ 02 229A 8858 CIRCLED RING OPERATOR +⊥ -T 22A5 8869 UP TACK +⋅ .P 22C5 8901 DOT OPERATOR +⋮ :3 22EE 8942 VERTICAL ELLIPSIS +⋯ .3 22EF 8943 MIDLINE HORIZONTAL ELLIPSIS +⌂ Eh 2302 8962 HOUSE +⌈ <7 2308 8968 LEFT CEILING +⌉ >7 2309 8969 RIGHT CEILING +⌊ 7< 230A 8970 LEFT FLOOR +⌋ 7> 230B 8971 RIGHT FLOOR +⌐ NI 2310 8976 REVERSED NOT SIGN +⌒ (A 2312 8978 ARC +⌕ TR 2315 8981 TELEPHONE RECORDER +⌠ Iu 2320 8992 TOP HALF INTEGRAL +⌡ Il 2321 8993 BOTTOM HALF INTEGRAL +〈 232A 9002 RIGHT-POINTING ANGLE BRACKET +␣ Vs 2423 9251 OPEN BOX +⑀ 1h 2440 9280 OCR HOOK +⑁ 3h 2441 9281 OCR CHAIR +⑂ 2h 2442 9282 OCR FORK +⑃ 4h 2443 9283 OCR INVERTED FORK +⑆ 1j 2446 9286 OCR BRANCH BANK IDENTIFICATION +⑇ 2j 2447 9287 OCR AMOUNT OF CHECK +⑈ 3j 2448 9288 OCR DASH +⑉ 4j 2449 9289 OCR CUSTOMER ACCOUNT NUMBER +⒈ 1. 2488 9352 DIGIT ONE FULL STOP +⒉ 2. 2489 9353 DIGIT TWO FULL STOP +⒊ 3. 248A 9354 DIGIT THREE FULL STOP +⒋ 4. 248B 9355 DIGIT FOUR FULL STOP +⒌ 5. 248C 9356 DIGIT FIVE FULL STOP +⒍ 6. 248D 9357 DIGIT SIX FULL STOP +⒎ 7. 248E 9358 DIGIT SEVEN FULL STOP +⒏ 8. 248F 9359 DIGIT EIGHT FULL STOP +⒐ 9. 2490 9360 DIGIT NINE FULL STOP +─ hh 2500 9472 BOX DRAWINGS LIGHT HORIZONTAL +━ HH 2501 9473 BOX DRAWINGS HEAVY HORIZONTAL +│ vv 2502 9474 BOX DRAWINGS LIGHT VERTICAL +┃ VV 2503 9475 BOX DRAWINGS HEAVY VERTICAL +┄ 3- 2504 9476 BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL +┅ 3_ 2505 9477 BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL +┆ 3! 2506 9478 BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL +┇ 3/ 2507 9479 BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL +┈ 4- 2508 9480 BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL +┉ 4_ 2509 9481 BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL +┊ 4! 250A 9482 BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL +┋ 4/ 250B 9483 BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL +┌ dr 250C 9484 BOX DRAWINGS LIGHT DOWN AND RIGHT +┍ dR 250D 9485 BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY +┎ Dr 250E 9486 BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT +┏ DR 250F 9487 BOX DRAWINGS HEAVY DOWN AND RIGHT +┐ dl 2510 9488 BOX DRAWINGS LIGHT DOWN AND LEFT +┑ dL 2511 9489 BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY +┒ Dl 2512 9490 BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT +┓ LD 2513 9491 BOX DRAWINGS HEAVY DOWN AND LEFT +└ ur 2514 9492 BOX DRAWINGS LIGHT UP AND RIGHT +┕ uR 2515 9493 BOX DRAWINGS UP LIGHT AND RIGHT HEAVY +┖ Ur 2516 9494 BOX DRAWINGS UP HEAVY AND RIGHT LIGHT +┗ UR 2517 9495 BOX DRAWINGS HEAVY UP AND RIGHT +┘ ul 2518 9496 BOX DRAWINGS LIGHT UP AND LEFT +┙ uL 2519 9497 BOX DRAWINGS UP LIGHT AND LEFT HEAVY +┚ Ul 251A 9498 BOX DRAWINGS UP HEAVY AND LEFT LIGHT +┛ UL 251B 9499 BOX DRAWINGS HEAVY UP AND LEFT +├ vr 251C 9500 BOX DRAWINGS LIGHT VERTICAL AND RIGHT +┝ vR 251D 9501 BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY +┠ Vr 2520 9504 BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT +┣ VR 2523 9507 BOX DRAWINGS HEAVY VERTICAL AND RIGHT +┤ vl 2524 9508 BOX DRAWINGS LIGHT VERTICAL AND LEFT +┥ vL 2525 9509 BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY +┨ Vl 2528 9512 BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT +┫ VL 252B 9515 BOX DRAWINGS HEAVY VERTICAL AND LEFT +┬ dh 252C 9516 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +┯ dH 252F 9519 BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY +┰ Dh 2530 9520 BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT +┳ DH 2533 9523 BOX DRAWINGS HEAVY DOWN AND HORIZONTAL +┴ uh 2534 9524 BOX DRAWINGS LIGHT UP AND HORIZONTAL +┷ uH 2537 9527 BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY +┸ Uh 2538 9528 BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT +┻ UH 253B 9531 BOX DRAWINGS HEAVY UP AND HORIZONTAL +┼ vh 253C 9532 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL +┿ vH 253F 9535 BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY +╂ Vh 2542 9538 BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT +╋ VH 254B 9547 BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL +╱ FD 2571 9585 BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT +╲ BD 2572 9586 BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT +▀ TB 2580 9600 UPPER HALF BLOCK +▄ LB 2584 9604 LOWER HALF BLOCK +█ FB 2588 9608 FULL BLOCK +▌ lB 258C 9612 LEFT HALF BLOCK +▐ RB 2590 9616 RIGHT HALF BLOCK +░ .S 2591 9617 LIGHT SHADE +▒ :S 2592 9618 MEDIUM SHADE +▓ ?S 2593 9619 DARK SHADE +■ fS 25A0 9632 BLACK SQUARE +□ OS 25A1 9633 WHITE SQUARE +▢ RO 25A2 9634 WHITE SQUARE WITH ROUNDED CORNERS +▣ Rr 25A3 9635 WHITE SQUARE CONTAINING BLACK SMALL SQUARE +▤ RF 25A4 9636 SQUARE WITH HORIZONTAL FILL +▥ RY 25A5 9637 SQUARE WITH VERTICAL FILL +▦ RH 25A6 9638 SQUARE WITH ORTHOGONAL CROSSHATCH FILL +▧ RZ 25A7 9639 SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL +▨ RK 25A8 9640 SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL +▩ RX 25A9 9641 SQUARE WITH DIAGONAL CROSSHATCH FILL +▪ sB 25AA 9642 BLACK SMALL SQUARE +▬ SR 25AC 9644 BLACK RECTANGLE +▭ Or 25AD 9645 WHITE RECTANGLE +▲ UT 25B2 9650 BLACK UP-POINTING TRIANGLE +△ uT 25B3 9651 WHITE UP-POINTING TRIANGLE +▶ PR 25B6 9654 BLACK RIGHT-POINTING TRIANGLE +▷ Tr 25B7 9655 WHITE RIGHT-POINTING TRIANGLE +▼ Dt 25BC 9660 BLACK DOWN-POINTING TRIANGLE +▽ dT 25BD 9661 WHITE DOWN-POINTING TRIANGLE +◀ PL 25C0 9664 BLACK LEFT-POINTING TRIANGLE +◁ Tl 25C1 9665 WHITE LEFT-POINTING TRIANGLE +◆ Db 25C6 9670 BLACK DIAMOND +◇ Dw 25C7 9671 WHITE DIAMOND +◊ LZ 25CA 9674 LOZENGE +○ 0m 25CB 9675 WHITE CIRCLE +◎ 0o 25CE 9678 BULLSEYE +● 0M 25CF 9679 BLACK CIRCLE +◐ 0L 25D0 9680 CIRCLE WITH LEFT HALF BLACK +◑ 0R 25D1 9681 CIRCLE WITH RIGHT HALF BLACK +◘ Sn 25D8 9688 INVERSE BULLET +◙ Ic 25D9 9689 INVERSE WHITE CIRCLE +◢ Fd 25E2 9698 BLACK LOWER RIGHT TRIANGLE +◣ Bd 25E3 9699 BLACK LOWER LEFT TRIANGLE +★ *2 2605 9733 BLACK STAR +☆ *1 2606 9734 WHITE STAR +☜ H 261E 9758 WHITE RIGHT POINTING INDEX +☺ 0u 263A 9786 WHITE SMILING FACE +☻ 0U 263B 9787 BLACK SMILING FACE +☼ SU 263C 9788 WHITE SUN WITH RAYS +♀ Fm 2640 9792 FEMALE SIGN +♂ Ml 2642 9794 MALE SIGN +♠ cS 2660 9824 BLACK SPADE SUIT +♡ cH 2661 9825 WHITE HEART SUIT +♢ cD 2662 9826 WHITE DIAMOND SUIT +♣ cC 2663 9827 BLACK CLUB SUIT +♩ Md 2669 9833 QUARTER NOTE ` +♪ M8 266A 9834 EIGHTH NOTE ` +♫ M2 266B 9835 BEAMED EIGHTH NOTES +♭ Mb 266D 9837 MUSIC FLAT SIGN +♮ Mx 266E 9838 MUSIC NATURAL SIGN +♯ MX 266F 9839 MUSIC SHARP SIGN +✓ OK 2713 10003 CHECK MARK +✗ XX 2717 10007 BALLOT X +✠ -X 2720 10016 MALTESE CROSS +  IS 3000 12288 IDEOGRAPHIC SPACE +、 ,_ 3001 12289 IDEOGRAPHIC COMMA +。 ._ 3002 12290 IDEOGRAPHIC FULL STOP +〃 +" 3003 12291 DITTO MARK +〄 +_ 3004 12292 JAPANESE INDUSTRIAL STANDARD SYMBOL +々 *_ 3005 12293 IDEOGRAPHIC ITERATION MARK +〆 ;_ 3006 12294 IDEOGRAPHIC CLOSING MARK +〇 0_ 3007 12295 IDEOGRAPHIC NUMBER ZERO +《 <+ 300A 12298 LEFT DOUBLE ANGLE BRACKET +》 >+ 300B 12299 RIGHT DOUBLE ANGLE BRACKET +「 <' 300C 12300 LEFT CORNER BRACKET +」 >' 300D 12301 RIGHT CORNER BRACKET +『 <" 300E 12302 LEFT WHITE CORNER BRACKET +』 >" 300F 12303 RIGHT WHITE CORNER BRACKET +【 (" 3010 12304 LEFT BLACK LENTICULAR BRACKET +】 )" 3011 12305 RIGHT BLACK LENTICULAR BRACKET +〒 =T 3012 12306 POSTAL MARK +〓 =_ 3013 12307 GETA MARK +〔 (' 3014 12308 LEFT TORTOISE SHELL BRACKET +〕 )' 3015 12309 RIGHT TORTOISE SHELL BRACKET +〖 (I 3016 12310 LEFT WHITE LENTICULAR BRACKET +〗 )I 3017 12311 RIGHT WHITE LENTICULAR BRACKET +〜 -? 301C 12316 WAVE DASH +ぁ A5 3041 12353 HIRAGANA LETTER SMALL A +あ a5 3042 12354 HIRAGANA LETTER A +ぃ I5 3043 12355 HIRAGANA LETTER SMALL I +い i5 3044 12356 HIRAGANA LETTER I +ぅ U5 3045 12357 HIRAGANA LETTER SMALL U +う u5 3046 12358 HIRAGANA LETTER U +ぇ E5 3047 12359 HIRAGANA LETTER SMALL E +え e5 3048 12360 HIRAGANA LETTER E +ぉ O5 3049 12361 HIRAGANA LETTER SMALL O +お o5 304A 12362 HIRAGANA LETTER O +か ka 304B 12363 HIRAGANA LETTER KA +が ga 304C 12364 HIRAGANA LETTER GA +き ki 304D 12365 HIRAGANA LETTER KI +ぎ gi 304E 12366 HIRAGANA LETTER GI +く ku 304F 12367 HIRAGANA LETTER KU +ぐ gu 3050 12368 HIRAGANA LETTER GU +け ke 3051 12369 HIRAGANA LETTER KE +げ ge 3052 12370 HIRAGANA LETTER GE +こ ko 3053 12371 HIRAGANA LETTER KO +ご go 3054 12372 HIRAGANA LETTER GO +さ sa 3055 12373 HIRAGANA LETTER SA +ざ za 3056 12374 HIRAGANA LETTER ZA +し si 3057 12375 HIRAGANA LETTER SI +じ zi 3058 12376 HIRAGANA LETTER ZI +す su 3059 12377 HIRAGANA LETTER SU +ず zu 305A 12378 HIRAGANA LETTER ZU +せ se 305B 12379 HIRAGANA LETTER SE +ぜ ze 305C 12380 HIRAGANA LETTER ZE +そ so 305D 12381 HIRAGANA LETTER SO +ぞ zo 305E 12382 HIRAGANA LETTER ZO +た ta 305F 12383 HIRAGANA LETTER TA +だ da 3060 12384 HIRAGANA LETTER DA +ち ti 3061 12385 HIRAGANA LETTER TI +ぢ di 3062 12386 HIRAGANA LETTER DI +っ tU 3063 12387 HIRAGANA LETTER SMALL TU +つ tu 3064 12388 HIRAGANA LETTER TU +づ du 3065 12389 HIRAGANA LETTER DU +て te 3066 12390 HIRAGANA LETTER TE +で de 3067 12391 HIRAGANA LETTER DE +と to 3068 12392 HIRAGANA LETTER TO +ど do 3069 12393 HIRAGANA LETTER DO +な na 306A 12394 HIRAGANA LETTER NA +に ni 306B 12395 HIRAGANA LETTER NI +ぬ nu 306C 12396 HIRAGANA LETTER NU +ね ne 306D 12397 HIRAGANA LETTER NE +の no 306E 12398 HIRAGANA LETTER NO +は ha 306F 12399 HIRAGANA LETTER HA +ば ba 3070 12400 HIRAGANA LETTER BA +ぱ pa 3071 12401 HIRAGANA LETTER PA +ひ hi 3072 12402 HIRAGANA LETTER HI +び bi 3073 12403 HIRAGANA LETTER BI +ぴ pi 3074 12404 HIRAGANA LETTER PI +ふ hu 3075 12405 HIRAGANA LETTER HU +ぶ bu 3076 12406 HIRAGANA LETTER BU +ぷ pu 3077 12407 HIRAGANA LETTER PU +へ he 3078 12408 HIRAGANA LETTER HE +べ be 3079 12409 HIRAGANA LETTER BE +ぺ pe 307A 12410 HIRAGANA LETTER PE +ほ ho 307B 12411 HIRAGANA LETTER HO +ぼ bo 307C 12412 HIRAGANA LETTER BO +ぽ po 307D 12413 HIRAGANA LETTER PO +ま ma 307E 12414 HIRAGANA LETTER MA +み mi 307F 12415 HIRAGANA LETTER MI +む mu 3080 12416 HIRAGANA LETTER MU +め me 3081 12417 HIRAGANA LETTER ME +も mo 3082 12418 HIRAGANA LETTER MO +ゃ yA 3083 12419 HIRAGANA LETTER SMALL YA +や ya 3084 12420 HIRAGANA LETTER YA +ゅ yU 3085 12421 HIRAGANA LETTER SMALL YU +ゆ yu 3086 12422 HIRAGANA LETTER YU +ょ yO 3087 12423 HIRAGANA LETTER SMALL YO +よ yo 3088 12424 HIRAGANA LETTER YO +ら ra 3089 12425 HIRAGANA LETTER RA +り ri 308A 12426 HIRAGANA LETTER RI +る ru 308B 12427 HIRAGANA LETTER RU +れ re 308C 12428 HIRAGANA LETTER RE +ろ ro 308D 12429 HIRAGANA LETTER RO +ゎ wA 308E 12430 HIRAGANA LETTER SMALL WA +わ wa 308F 12431 HIRAGANA LETTER WA +ゐ wi 3090 12432 HIRAGANA LETTER WI +ゑ we 3091 12433 HIRAGANA LETTER WE +を wo 3092 12434 HIRAGANA LETTER WO +ん n5 3093 12435 HIRAGANA LETTER N ` +ゔ vu 3094 12436 HIRAGANA LETTER VU +゛ "5 309B 12443 KATAKANA-HIRAGANA VOICED SOUND MARK +゜ 05 309C 12444 KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK +ゝ *5 309D 12445 HIRAGANA ITERATION MARK +ゞ +5 309E 12446 HIRAGANA VOICED ITERATION MARK +ァ a6 30A1 12449 KATAKANA LETTER SMALL A +ア A6 30A2 12450 KATAKANA LETTER A +ィ i6 30A3 12451 KATAKANA LETTER SMALL I +イ I6 30A4 12452 KATAKANA LETTER I +ゥ u6 30A5 12453 KATAKANA LETTER SMALL U +ウ U6 30A6 12454 KATAKANA LETTER U +ェ e6 30A7 12455 KATAKANA LETTER SMALL E +エ E6 30A8 12456 KATAKANA LETTER E +ォ o6 30A9 12457 KATAKANA LETTER SMALL O +オ O6 30AA 12458 KATAKANA LETTER O +カ Ka 30AB 12459 KATAKANA LETTER KA +ガ Ga 30AC 12460 KATAKANA LETTER GA +キ Ki 30AD 12461 KATAKANA LETTER KI +ギ Gi 30AE 12462 KATAKANA LETTER GI +ク Ku 30AF 12463 KATAKANA LETTER KU +グ Gu 30B0 12464 KATAKANA LETTER GU +ケ Ke 30B1 12465 KATAKANA LETTER KE +ゲ Ge 30B2 12466 KATAKANA LETTER GE +コ Ko 30B3 12467 KATAKANA LETTER KO +ゴ Go 30B4 12468 KATAKANA LETTER GO +サ Sa 30B5 12469 KATAKANA LETTER SA +ザ Za 30B6 12470 KATAKANA LETTER ZA +シ Si 30B7 12471 KATAKANA LETTER SI +ジ Zi 30B8 12472 KATAKANA LETTER ZI +ス Su 30B9 12473 KATAKANA LETTER SU +ズ Zu 30BA 12474 KATAKANA LETTER ZU +セ Se 30BB 12475 KATAKANA LETTER SE +ゼ Ze 30BC 12476 KATAKANA LETTER ZE +ソ So 30BD 12477 KATAKANA LETTER SO +ゾ Zo 30BE 12478 KATAKANA LETTER ZO +タ Ta 30BF 12479 KATAKANA LETTER TA +ダ Da 30C0 12480 KATAKANA LETTER DA +チ Ti 30C1 12481 KATAKANA LETTER TI +ヂ Di 30C2 12482 KATAKANA LETTER DI +ッ TU 30C3 12483 KATAKANA LETTER SMALL TU +ツ Tu 30C4 12484 KATAKANA LETTER TU +ヅ Du 30C5 12485 KATAKANA LETTER DU +テ Te 30C6 12486 KATAKANA LETTER TE +デ De 30C7 12487 KATAKANA LETTER DE +ト To 30C8 12488 KATAKANA LETTER TO +ド Do 30C9 12489 KATAKANA LETTER DO +ナ Na 30CA 12490 KATAKANA LETTER NA +ニ Ni 30CB 12491 KATAKANA LETTER NI +ヌ Nu 30CC 12492 KATAKANA LETTER NU +ネ Ne 30CD 12493 KATAKANA LETTER NE +ノ No 30CE 12494 KATAKANA LETTER NO +ハ Ha 30CF 12495 KATAKANA LETTER HA +バ Ba 30D0 12496 KATAKANA LETTER BA +パ Pa 30D1 12497 KATAKANA LETTER PA +ヒ Hi 30D2 12498 KATAKANA LETTER HI +ビ Bi 30D3 12499 KATAKANA LETTER BI +ピ Pi 30D4 12500 KATAKANA LETTER PI +フ Hu 30D5 12501 KATAKANA LETTER HU +ブ Bu 30D6 12502 KATAKANA LETTER BU +プ Pu 30D7 12503 KATAKANA LETTER PU +ヘ He 30D8 12504 KATAKANA LETTER HE +ベ Be 30D9 12505 KATAKANA LETTER BE +ペ Pe 30DA 12506 KATAKANA LETTER PE +ホ Ho 30DB 12507 KATAKANA LETTER HO +ボ Bo 30DC 12508 KATAKANA LETTER BO +ポ Po 30DD 12509 KATAKANA LETTER PO +マ Ma 30DE 12510 KATAKANA LETTER MA +ミ Mi 30DF 12511 KATAKANA LETTER MI +ム Mu 30E0 12512 KATAKANA LETTER MU +メ Me 30E1 12513 KATAKANA LETTER ME +モ Mo 30E2 12514 KATAKANA LETTER MO +ャ YA 30E3 12515 KATAKANA LETTER SMALL YA +ヤ Ya 30E4 12516 KATAKANA LETTER YA +ュ YU 30E5 12517 KATAKANA LETTER SMALL YU +ユ Yu 30E6 12518 KATAKANA LETTER YU +ョ YO 30E7 12519 KATAKANA LETTER SMALL YO +ヨ Yo 30E8 12520 KATAKANA LETTER YO +ラ Ra 30E9 12521 KATAKANA LETTER RA +リ Ri 30EA 12522 KATAKANA LETTER RI +ル Ru 30EB 12523 KATAKANA LETTER RU +レ Re 30EC 12524 KATAKANA LETTER RE +ロ Ro 30ED 12525 KATAKANA LETTER RO +ヮ WA 30EE 12526 KATAKANA LETTER SMALL WA +ワ Wa 30EF 12527 KATAKANA LETTER WA +ヰ Wi 30F0 12528 KATAKANA LETTER WI +ヱ We 30F1 12529 KATAKANA LETTER WE +ヲ Wo 30F2 12530 KATAKANA LETTER WO +ン N6 30F3 12531 KATAKANA LETTER N ` +ヴ Vu 30F4 12532 KATAKANA LETTER VU +ヵ KA 30F5 12533 KATAKANA LETTER SMALL KA +ヶ KE 30F6 12534 KATAKANA LETTER SMALL KE +ヷ Va 30F7 12535 KATAKANA LETTER VA +ヸ Vi 30F8 12536 KATAKANA LETTER VI +ヹ Ve 30F9 12537 KATAKANA LETTER VE +ヺ Vo 30FA 12538 KATAKANA LETTER VO +・ .6 30FB 12539 KATAKANA MIDDLE DOT +ー -6 30FC 12540 KATAKANA-HIRAGANA PROLONGED SOUND MARK +ヽ *6 30FD 12541 KATAKANA ITERATION MARK +ヾ +6 30FE 12542 KATAKANA VOICED ITERATION MARK +ㄅ b4 3105 12549 BOPOMOFO LETTER B +ㄆ p4 3106 12550 BOPOMOFO LETTER P +ㄇ m4 3107 12551 BOPOMOFO LETTER M +ㄈ f4 3108 12552 BOPOMOFO LETTER F +ㄉ d4 3109 12553 BOPOMOFO LETTER D +ㄊ t4 310A 12554 BOPOMOFO LETTER T +ㄋ n4 310B 12555 BOPOMOFO LETTER N ` +ㄌ l4 310C 12556 BOPOMOFO LETTER L +ㄍ g4 310D 12557 BOPOMOFO LETTER G +ㄎ k4 310E 12558 BOPOMOFO LETTER K +ㄏ h4 310F 12559 BOPOMOFO LETTER H +ㄐ j4 3110 12560 BOPOMOFO LETTER J +ㄑ q4 3111 12561 BOPOMOFO LETTER Q +ㄒ x4 3112 12562 BOPOMOFO LETTER X +ㄓ zh 3113 12563 BOPOMOFO LETTER ZH +ㄔ ch 3114 12564 BOPOMOFO LETTER CH +ㄕ sh 3115 12565 BOPOMOFO LETTER SH +ㄖ r4 3116 12566 BOPOMOFO LETTER R +ㄗ z4 3117 12567 BOPOMOFO LETTER Z +ㄘ c4 3118 12568 BOPOMOFO LETTER C +ㄙ s4 3119 12569 BOPOMOFO LETTER S +ㄚ a4 311A 12570 BOPOMOFO LETTER A +ㄛ o4 311B 12571 BOPOMOFO LETTER O +ㄜ e4 311C 12572 BOPOMOFO LETTER E +ㄞ ai 311E 12574 BOPOMOFO LETTER AI +ㄟ ei 311F 12575 BOPOMOFO LETTER EI +ㄠ au 3120 12576 BOPOMOFO LETTER AU +ㄡ ou 3121 12577 BOPOMOFO LETTER OU +ㄢ an 3122 12578 BOPOMOFO LETTER AN +ㄣ en 3123 12579 BOPOMOFO LETTER EN +ㄤ aN 3124 12580 BOPOMOFO LETTER ANG +ㄥ eN 3125 12581 BOPOMOFO LETTER ENG +ㄦ er 3126 12582 BOPOMOFO LETTER ER +ㄧ i4 3127 12583 BOPOMOFO LETTER I +ㄨ u4 3128 12584 BOPOMOFO LETTER U +ㄩ iu 3129 12585 BOPOMOFO LETTER IU +ㄪ v4 312A 12586 BOPOMOFO LETTER V +ㄫ nG 312B 12587 BOPOMOFO LETTER NG +ㄬ gn 312C 12588 BOPOMOFO LETTER GN +㈠ 1c 3220 12832 PARENTHESIZED IDEOGRAPH ONE +㈡ 2c 3221 12833 PARENTHESIZED IDEOGRAPH TWO +㈢ 3c 3222 12834 PARENTHESIZED IDEOGRAPH THREE +㈣ 4c 3223 12835 PARENTHESIZED IDEOGRAPH FOUR +㈤ 5c 3224 12836 PARENTHESIZED IDEOGRAPH FIVE +㈥ 6c 3225 12837 PARENTHESIZED IDEOGRAPH SIX +㈦ 7c 3226 12838 PARENTHESIZED IDEOGRAPH SEVEN +㈧ 8c 3227 12839 PARENTHESIZED IDEOGRAPH EIGHT +㈨ 9c 3228 12840 PARENTHESIZED IDEOGRAPH NINE +ff ff FB00 64256 LATIN SMALL LIGATURE FF +fi fi FB01 64257 LATIN SMALL LIGATURE FI +fl fl FB02 64258 LATIN SMALL LIGATURE FL +ſt ft FB05 64261 LATIN SMALL LIGATURE LONG S T +st st FB06 64262 LATIN SMALL LIGATURE ST + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/editing.jax b/plugins/vimdoc-ja/doc/editing.jax new file mode 100644 index 0000000000..3f678872ea --- /dev/null +++ b/plugins/vimdoc-ja/doc/editing.jax @@ -0,0 +1,1707 @@ +*editing.txt* For Vim バージョン 8.0. Last change: 2016 Nov 24 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +ファイルの編集 *edit-files* + +1. はじめに |edit-intro| +2. ファイルの編集 |edit-a-file| +3. 引数リスト |argument-list| +4. 書き込み |writing| +5. 書き込みと終了 |write-quit| +6. ダイアログ |edit-dialogs| +7. カレントディレクトリ |current-directory| +8. バイナリファイルの編集 |edit-binary| +9. 暗号化 |encryption| +10. タイムスタンプ |timestamps| +11. ファイル検索 |file-searching| + +============================================================================== +1. はじめに *edit-intro* + +「Vimでファイルを編集する」とは、以下のことを表す。 + +1. バッファへファイルを読み込む +2. 編集コマンドによりバッファの内容を変更する +3. バッファをファイルへ書き込む + + *current-file* +バッファを書き込まない限り、元のファイルは変更を受けないままで残っている。ファ +イルの編集を始めると (バッファにファイルを読み込むと)、そのファイルの名前は +「カレントファイル名」として記憶される。これをカレントバッファの名前とも呼ぶ。 +コマンドラインでは "%" で表せる。|:_%| + + *alternate-file* +カレントファイル名が既に存在したときは、前の方は「代替ファイル名」になる。これ +はコマンドラインでは "#" で表され|:_#|、|CTRL-^|を使うとカレントファイルと代替 +ファイルを切り替えることができる。ただし|:keepalt|を使ったときは代替ファイル名 +は変わらない。代替ファイル名はウィンドウごとに記憶される。 + + *:keepalt* *:keepa* +:keepalt {cmd} 現在の代替ファイル名を変えずに{cmd}を実行する。Note 間 + 接的に呼び出されるコマンド(例えば関数によって)は代替 + ファイル名を変えてしまう。{Vi にはない} + +全てのファイル名はバッファリストに記憶される。編集 (例えば ":e filename") や保 +存(例えば ":w filename") のためにファイル名を入力すると、そのファイル名がリス +トに追加される。このリストを使えば、どのファイルを編集したかを覚えておいたり、 +コマンド CTRL-^ によってあるファイルから別のファイルへ素早く移行できる (例えば +テキストをコピーするとき)。まずファイルの番号を、次に CTRL-^ を打ち込む。{Vi: +代替ファイル名は1個だけ使える} + +CTRL-G または *CTRL-G* *:f* *:fi* *:file* +:f[ile] カレントファイル名 (これは ":cd" が使われたとき以外は + 打ち込まれた通り {訳注: 普通、カレントディレクトリの + ファイルを編集するときはパスを省いて打ち込むと思うが、 + そうするとパスなしのファイル名になる})、カーソル位置 + (これはオプション 'ruler' がオフのとき) とファイルの状 + 態 (読込専用、変更あり、読込エラー、新規ファイル) を表 + 示する。このメッセージを短くする方法については、オプショ + ン 'shortmess' を参照。{Vi では列番号が表示されない} + +:f[ile]! |:file|と同様だが、'shortmess' が設定されているときで + も名前を切り詰めない。 + +{count}CTRL-G CTRL-G と同様だが、カレントファイル名をフルパスで表示 + する。{count} が2以上なら、カレントバッファの番号も表 + 示する。 {Vi にはない} + + *g_CTRL-G* *word-count* *byte-count* +g CTRL-G カーソルの現在の位置を、列、行、単語、文字、バイト、の + 5種類の単位で表示する。文字数とバイト数が同じのときは + 文字位置が省略される。 + 行の中に画面上で1文字分以上の幅を占める文字 ( ま + たは特殊文字) があるときは、「実際」の列番号と画面上の + 列番号の両方が、ダッシュで区切られて表示される {訳注: + 例えば、タブ幅 'tabstop' が8のとき、行頭の の次 + では「実際」の列番号は2、画面上の列番号は9となり、 + "1-8" と表示される}。 + オプション 'ruler' と |wordcount()| 関数も参照。 + {Vi にはない} + + *v_g_CTRL-G* +{Visual}g CTRL-G "g CTRL-G" と似ているが、単語、文字、行、バイトの項目 + はビジュアル選択領域内で数えられて表示される。矩形ビジュ + アルモードでは、何列目かも表示される。 + 矩形ビジュアルモードでは桁数も表示される({Visual}につ + いては|Visual-mode| を参照) + {Vi にはない} + + *:file_f* +:f[ile][!] {name} カレントファイル名を {name} に設定する。!をつけると + |:file|のようにメッセージを切り詰めなくなる。 + バッファが名前を持つならその名前が代替ファイル名 + |alternate-file|になる。元の名前を保持するためにリスト + されない(unlisted)バッファが作成される。 + *:0file* +:0f[ile][!] カレントバッファの名前を削除する。!をつけると|:file|の + ようにメッセージを切り詰めなくなる。{Vi にはない} + +:buffers +:files +:ls 現在認識しているファイル名を全て一覧表示する。 + |windows.txt| |:files| |:buffers| |:ls| を参照。 + {Vi にはない} + +Vim は入力したファイル名のフルパス名を記憶している。ファイル名が表示されるとき、 +大抵は打ち込んだ名前だけが表示されるが、コマンド |:cd| でディレクトリを移動し +た後では、フルパス名が使われる。 + + *home-replace* +環境変数 $HOME が設定されていて、ファイル名がその文字列で始まっているならば、 +ファイル名のその部分は "~" に置き換えられて表示される。これはファイル名を短く +するためである。ファイルを読み書きするときはフルパス名が使われ、"~" はファイル +名を表示するときだけ使われる。ファイル名の置き換えを行ったところ "~" だけになっ +てしまうときは、代わりに "~/" が使われる (オプション 'backupext' が "~" に設定 +されたときに混乱を防ぐため)。 + +バッファを書き出すとき、既定ではカレントファイル名を用いる。そのため、コマンド +"ZZ" や ":wq" を使うと、元のファイルは上書きされてしまうことになる。これを望ま +ないならば、コマンド ":write" の引数にファイル名を与えることで、バッファを別の +ファイルに書き出せる。例: > + + vim テスト用 {訳注: これはシェルに対して} + [コマンドでバッファを編集する] + :w 新ファイル + :q + +こうすると "新ファイル" が生成されるが、これは "テスト用" を編集してコピーした +ものである。ファイル "テスト用" は変更されないまま残る。しかしどちらにしろ、オ +プション 'backup' がオンのときは、Vim は元のファイルを上書きする前に、元のファ +イルの名前を変更するかコピーする。元のファイルが必要なことに気づいたときは、こ +のファイルを使える。'patchmode' も参照。普通、バックアップファイルの名前は元の +ファイル名に 'backupext' を追加したものである。既定値は "~" という妙なものだが、 +これはたまたま存在しているファイルに上書きするのを避けるためである。".bak" の +方がよければ、'backupext' を変更すること。MS-DOS 機等で、MS-DOS 系のファイルシ +ステム (例えば、messydos や crossdos ) が使われていることが検出されたときや、 +'shortname' がオンのときには、余分なドットは '_' に置き換えられる。'backupdir' +を設定することで、バックアップファイルを他のディレクトリに置くことができる。 + + *auto-shortname* +技術的情報: Amiga ではファイル名に 30 文字まで使える。しかし MS-DOS 互換のファ + イルシステムで有効なのは 8 文字+ 3 文字に過ぎない。Vim は ".swp" + ファイルを生成するときにファイルシステムの判別を試みる。MS-DOS 系 + のファイルシステムと思われるときは、'shortname' をオンにするのと同 + じ効果を持つフラグがオンになる。このフラグは新ファイルの編集を開始 + するとすぐにオフにされる。このフラグはカレントファイルのための + ".swp" ファイルと ".~" ファイルの名前を作るときに使われる。しかし、 + ユーザーが普通のファイルシステムで編集作業を行い、MS-DOS 系のファ + イルシステムに保存するときには、フラグはオンにならない。そのとき + は、".~" ファイルの生成が失敗してエラーメッセージが表示される。そ + のときはオプション 'shortname' を使うこと。 + +ファイル名を指定せずに編集を始めたときは、メッセージ欄に "[無題]" と表示される。 +コマンド ":write" がファイル名引数付きで使われたときは、そのファイル名がカレン +トファイルのファイル名に設定される。こうなるのはフラグ 'F' |cpo-F| がオプション +'cpoptions' に含まれているときだけである (既定では含まれている)。これは空のバッ +ファにテキストを入力してから、それをファイルに保存するときに便利である。 +'cpoptions' が 'f' |cpo-f| を含んでいるときは (既定では含まれて「いない」)、 +":read file" でファイル名が設定される。これは引数なしでVimを起動してから、 +":read file" でファイルの編集を開始するときに便利である。 +ファイル名が設定されていて 'filetype' が空のとき、ファイルタイプ判別オートコマ +ンドが発生する。 + *not-edited* +ファイル名が設定されるのはその名前のファイルの編集を本当に始めるより前なので、 +そのファイルを誤って上書きしないようになっている。これはフラグ "notedited" を +設定することで可能になる。このフラグの状態はコマンド CTRL-G か ":file" で確認 +できる。フラグ "notedited" がオンのときは "[Not edited]" と表示される。 +カレントファイルの名前でバッファ内容を書き出すとき (":w!" で)、フラグ +"notedited" はオフに設定される。 + + *abandon* +Vim はバッファが変更されたかどうかを記憶していて、変更点が誤って失われないよう +になっている。保存せずに終了しようとしたり、別のファイルの編集を開始しようとす +ると、Vim は拒否する。この保護を無効にするためには、コマンドに '!' を追加する +こと。その場合、変更は失われる。例えばバッファの内容が変更されているとき、":q" +は使えないが ":q!" は使える。バッファの内容が変更されたかどうかを見るためには +コマンド CTRL-G を使うこと。バッファが変更されていたときは、メッセージに文字列 +"[変更あり]"、'm' フラグが 'shortmess' のときは "+" が含まれる。 + +確認なしで変更を保存してほしいなら、オプション 'autowriteall' をオンにすること。 +関連するオプションには 'autowrite' があるが、これは Vi 互換で、全てのコマンド +に対して動作するわけではない。 + +変更されたバッファを保存せずにそのままにしておきたいなら、オプション 'hidden' +をオンにすること。|hidden-buffer| を参照。いくつかのコマンドは 'hidden' がオン +になっていなくてもこのように振る舞うので、コマンドについてはヘルプを参照。 + +============================================================================== +2. ファイルの編集 *edit-a-file* + + *:e* *:edit* *reload* +:e[dit] [++opt] [+cmd] カレントファイルを開く。これは Vim 外部でカレントファ + イルに変更が加えられたとき、開き直すのに便利である。 + カレントバッファに変更が加えられているのに、オプション + 'autowriteall' がオフであるか、ファイルが書き込み可能 + でないときは、実行に失敗する。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt は使えない} + + *:edit!* *discard* +:e[dit]! [++opt] [+cmd] + どのような場合でもカレントファイルを開く。カレントバッ + ファに対する変更は全て失われる。これは編集作業をもう一 + 度最初からやり直したいときに便利である。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt は使えない} + + *:edit_f* +:e[dit] [++opt] [+cmd] {file} + {file} を開く。 + カレントバッファに変更が加えられていると実行に失敗する。 + ただしオプション 'hidden' がオンであるときと、 + 'autowriteall' がオンであり、かつファイルが書き込み可 + 能なときには実行できる。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt は使えない} + + +:e[dit]! [++opt] [+cmd] {file} *:edit!_f* + どのような場合でも {file} を開く。カレントバッファに対 + する変更は全て失われる。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt は使えない} + +:e[dit] [++opt] [+cmd] #[count] + [count] 番目のバッファ (コマンド |:files| で表示される + もの) を開く。このコマンドは [count] CTRL-^ と同じであ + る。しかし代替バッファがファイル名を持たないと":e #" + は機能しないが、CTRL-^ はそのときも機能する。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt は使えない} + + *:ene* *:enew* +:ene[w] 無名のバッファの編集を新規に開始する。カレントバッファ + に変更が加えられていると実行に失敗する。ただしオプショ + ン 'hidden' がオンであるときと、'autowriteall' がオン + であり、かつファイルが書き込み可能なときには実行できる。 + 'fileformats' の値が空でないとき、その先頭の形式が新バッ + ファに適用される。'fileformats' の値が空のときは、カレ + ントバッファの 'fileformat' の値が使われる。 + {Vi にはない} + + *:ene!* *:enew!* +:ene[w]! 無名のバッファの編集を新規に開始する。カレントバッファ + に対する変更は全て失われる。 + オプション 'fileformat' の値はコマンド |:enew| と同様 + に設定される。 + {Vi にはない} + + *:fin* *:find* +:fin[d][!] [++opt] [+cmd] {file} + オプション 'path' 内のディレクトリから {file} を探し、 + それを |:edit| する。 + {Vi にはない} {Vimが |+file_in_path| 機能付きでコンパ + イルされたときのみ有効} + +:{count}fin[d][!] [++opt] [+cmd] {file} + コマンド ":find" と同様だが、オプション 'path' 内のディ + レクトリで {count} にマッチしたファイルを編集する。つ + まり ":2find file" とすると 'path' 内で2番目に見つかっ + た "file" を編集する。'path' 内で見つかったマッチが + {count} より少ないと、エラーメッセージが表示される。 + + +:ex [++opt] [+cmd] [file] *:ex* + |:edit| と同じ。 + + *:vi* *:visual* +:vi[sual][!] [++opt] [+cmd] [file] + Ex モード内では: Ex モード (|Ex-mode|) からノーマルモー + ドに戻る。それ以外はコマンド |:edit| と同じ。 + + *:vie* *:view* +:vie[w][!] [++opt] [+cmd] file + Ex モード内では: Ex モード (|Ex-mode|) からノーマルモー + ドに戻る。それ以外はコマンド |:edit| と同じだが、その + バッファに対してオプション 'readonly' をオンにする。 + {Vi にはない} + + *CTRL-^* *CTRL-6* +CTRL-^ 代替ファイルを編集する。たいていの場合、代替ファイルは + 前に編集したファイルである。これを使うと2つのファイル + 間を素早く切り替えることができる。これは ":e #" と同じ + だが、対象のファイル名が無い場合も機能する。 + オプション 'autowrite' か 'autowriteall' がオンなら + ば、バッファを移動するときに書き込みをする。 + たいていは "^" と "6" は同じキーである。CTRL を押しな + がら 6 のキーを押せば CTRL-^ を押したのと同じ効果を得 + られる。しかし英語配列でないキーボードでは他のキーが割 + り当てられる。 + +[count]CTRL-^ [count] 番目の代替ファイルを編集する (コマンド + ":e #[count]" と同じ)。[count] が指定されないと、前に + 編集したファイルを編集する。これを使うと2つ (かそれ以 + 上) のファイル間を素早く行き来できる。 + さらに詳しくは上の|CTRL-^|を参照。 + {Vi にはない} + +[count]]f *]f* *[f* +[count][f コマンド "gf" と同じ。推奨されない。 + + *gf* *E446* *E447* +[count]gf カーソルの下か後ろの名前のファイルを編集する。 + 覚え方: "goto file"。 + オプション 'isfname' により、どの文字がファイル名に使 + われるはずなのかを調べる。ファイル名に続く句読点の + ".,:;!" は無視される。エスケープされた複数のスペース + "\ " は1つのスペースに減らされる。 + 'path' により、ファイルを探すディレクトリ名のリストを + 調べる。カレントファイルに対して相対的なファイルも探 + される。 + 'suffixesadd' により、拡張子を補ったファイル名を調べる。 + ファイルが見つからないと、'includeexpr' によってファイ + ル名を修正し、再びファイルを探す。 + [count] が指定されると、'path' 内で見つかった [count] + 番目のファイルを編集する。 + Vim がカレントファイルの破棄 |abandon| を拒否したとき + は、このコマンドの実行は失敗する。 + このファイルを新しいウィンドウで編集したいときは + |CTRL-W_CTRL-F| を使うこと。 + 新しいファイルを編集したいならば、次のようにする。 > + :e +< どのような場合でもコマンド gf を機能させるには、次のよ + うにする。 > + :map gf :e +< カーソル下のファイル名が "type://machine/path" のよう + なハイパーテキストリンクであるならば、プラグイン + |netrw| が必要になる。 + Unixでは、文字 '~' は "~user/file" のように展開される。 + 環境変数も展開される |expand-env|。 + {Vi にはない} {Vimが |+file_in_path| 機能付きでコンパ + イルされたときのみ有効} + + *v_gf* +{Visual}[count]gf コマンド "gf" と同様だが、編集するファイルの名前にはビ + ジュアル選択されたテキストが使われる。オプション + 'isfname' の値は無視される。先頭の空白は無視されるが、 + それ以外の空白や特殊文字はファイル名に含まれる。 + ({Visual} については |Visual-mode| を参照。) + {Vi にはない} + + *gF* +[count]gF "gf" と同じだが、ファイル名の後に番号があるとき、その + 行へカーソルが移動する点が異なる。ファイル名と行番号は + ファイル名でない文字('isfname' を参照)かつ数字でない文 + 字で区切られてなければならない。ファイル名、区切り文字、 + 番号の間の空白文字は無視される。 + 例: + eval.c:10 ~ + eval.c @ 20 ~ + eval.c (30) ~ + eval.c 40 ~ + + *v_gF* +{Visual}[count]gF "v_gf" と同じ。 + +以上のコマンドは1つのファイルの編集を開始するために使用される。これはファイル +がバッファに読み込まれ、カレントファイル名が設定されることを意味する。開かれる +ファイルはカレントディレクトリに依存する。コマンド |:cd| を参照。 + +ファイルが読み込まれた後に表示されるメッセージの説明については、 +|read-messages| を参照。 + +バッファ内がめちゃめちゃになって最初からもう1度やり直したいときには、コマンド +":e!" が使える。コマンド ":e" が便利なのは、カレントファイル名を変更したときだ +けである。 + + *:filename* *{file}* +ファイル名を指定する場所で使える特殊なアイテムについては、この節に書かれている +ことの他に |cmdline-special| に書かれている。 + +Note Unix と MS-DOS 以外に対する注意: 1つのファイル名を受け付けるコマンド +(":edit file" 等) では、ファイル名に空白が入っていても構わないが、ファイル名末 +尾の空白は無視される。これは、空白を含むファイル名が普通にあるシステム +(MS-Windows, Amiga等) では便利である。例: ":e Long File Name " を実行すると、 +ファイル "Long File Name" を開く。2つ以上のファイル名を受け付けるコマンド +(":next file1 file2" 等) では、ファイル名内の空白は '\' でエスケープしなければ +ならない。 + + *wildcard* *wildcards* +{file} 内のワイルドカードは展開される。ただし、ファイル名補完と同様に +'wildignore' と 'suffixes' が適用される。使用できるワイルドカードの種類はシス +テムによって異なる。以下は標準的なものである。 + ? あらゆる1文字にマッチ + * 何もないのも含め、全てにマッチ + ** 何もないのも含め、全てにマッチ。ディレクトリを再帰的にたどる。 + [abc] 'a', 'b' または 'c' にマッチ +ワイルドカードとしての特別な意味を無効にするには、前に '\' を置くこと。しかし +MS-Windowsでは '\' がパスの区切り文字なので、オプション 'isfname' の値に "[" +が含まれていると、"path\[abc]" はワイルドカード扱いになってしまう。これを避け +る単純な方法は、"path\[[]abc]" とすることである。すると文字通りのファイル +"path[abc]" を編集できる。 + + *starstar-wildcard* +"**" の展開は、Unix, Win32, Mac OS/X、その他数種類のシステムでのみ使用できる。 +"**" はディレクトリツリーを再帰的に検索する。深さの上限は100ディレクトリである。 +Note: いくつかのコマンドでは、この挙動が少し異なる。|file-searching| を参照。 +例: > + :n **/*.txt +これは次のファイルにマッチする: + aaa.txt ~ + subdir/bbb.txt ~ + a/b/c/d/ccc.txt ~ +"**" の直前または直後にワイルドカード以外の文字が使用されている場合、これらは +トップディレクトリでのみマッチする。これらは、ツリーのさらに下のディレクトリに +は使用されない。例: > + :n /usr/inc**/types.h +これは次のファイルにマッチする: + /usr/include/types.h ~ + /usr/include/sys/types.h ~ + /usr/inc/old/types.h ~ +Note "/inc" とマッチする必要がないため、"/sys" を含むパスが含まれている。した +がって、"/usr/inc*/inc*/inc*" ではなく、"/usr/inc*/*/*..." にマッチするような +ものである。 + + *backtick-expansion* *`-expansion* +Unix などではファイル名の引数にバッククォート '`' も使える。例: > + :next `find . -name ver\\*.c -print` + :view `ls -t *.patch \| head -n1` +アスタリスク '*' の前の '\' は、シェルが find を実行する前に "ver*.c" を展開し +てしまうのを防ぐために必要となる。シェルのパイプ記号 "|" の前のバックスラッシ +ュは Vim がコマンドの終わりとしてパースするのを防ぐ。 +これは、必ず項目全体がバッククォートで括られているという制限付きで、他の多くの +システムでも機能する。最初のバッククォートの直前や最後のバッククォートの直後に +文字列を書くことはできない。 + + *`=* +バッククォート内を、外部コマンドとしてではなく Vim の式として展開させることも +できる。そのためには初めのバッククォートのすぐ後に等号を置けばよい。例: > + :e `=tempname()` +この式はほとんど何を含んでもよい。そのため、これを使って '"', '|', '%', '#' の +特別な意味を打ち消すこともできる。ただし、他のワイルドカードと同様に +'wildignore' は適用される。 + +この式の中の環境変数は式が評価される時に展開される。したがってこれは機能する: > + :e `=$HOME . '/.vimrc'` +これは機能しない。$HOME は文字列内にあり、文字通りに用いられる: > + :e `='$HOME' . '/.vimrc'` + +式が文字列を返したときは名前は改行で区切られる。式の結果がリスト (|List|) のと +きは各要素が名前として扱われる。改行によっても名前は区切られる。 +Note そのような式はファイル名が Ex コマンドの引数として期待される場所でのみサ +ポートされる。 + + *++opt* *[++opt]* +引数のうち [++opt] はオプション 'fileformat', 'fileencoding' または +'binary' の値を、そのコマンドに限ってある値に指定し、不正な文字への対応を指定 +するために使われる。指定の形式は次の通り。 > + ++{optname} +または > + ++{optname}={value} + +{optname} は次のうちのどれか: *++ff* *++enc* *++bin* *++nobin* *++edit* + ff または fileformat 'fileformat' を指定 + enc または encoding 'fileencoding' を指定 + bin または binary 'binary' を指定 + nobin または nobinary 'binary' を無効にする + bad 不正な文字への対応を指定する + edit |:read| 用。ファイルを編集するときと同じように + オプションの値を保つ。 + +{value} に空白を含めてはいけない。値は、そのオプションに対して適切なものなら何 +でもよい。例: > + :e ++ff=unix +こうすると 'fileformat' を "unix" に設定して同じファイルを編集し直す。 > + + :w ++enc=latin1 newfile +こうするとカレントバッファの内容を latin1 の文字コードで "newfile" に書き出す。 + +引数 [++opt] は空白で区切って複数指定してもよい。それらはみな引数 |+cmd| より +前に指定しなければならない。 + + *++bad* +"++bad=" の引数は、変換できない文字と不正なバイトをどうするかを指定する。とり +うる値は次の3つのうちどれかである: + ++bad=X 不正な文字をこの1バイト文字で置き換える。 + ++bad=keep 不正な文字を変換せずにそのままにしておく。Note これを使うとテ + キスト中に不正なバイトが現れることになる。 + ++bad=drop 不正な文字を削除する。 + +既定値は "++bad=?" となっている。つまり、不正な文字をそれぞれクエスチョンマー +クで置き換える。逆クエスチョンマーク(latin-1 の 0xBF)が使われる場所もある。 + +Note ++bad をつけてエラーにならなかったとしても、すべてのコマンドが ++bad に対 +応しているわけではない。 + +Note 読み込み時に上の方法で 'fileformat' と 'fileencoding' を指定すると、それ +らは以後その値に設定されることに注意。書き込み時に設定してもそうはならず、次に +書き込むときには以前の値が使われる。'binary' オプションも同様。 + + *+cmd* *[+cmd]* +引数 [+cmd] は、新しく開いたファイルでカーソルの位置を指定したり、他のあらゆる +コマンドを実行するために使われる: + + 最後の行で編集を開始する。 + +{num} {num} 行目で編集を開始する。 + +/{pat} {pat} を含んだ最初の行で編集を開始する。 + +{command} 新しいファイルを開いた後に {command} を実行する。 + {command} には任意の Ex コマンドが使える。 +{pat} や {command} に空白を含めるためには、その前に '\' を付ける。'\' そのもの +を使うには、2回ずつ繰り返すこと。 > + :edit +/The\ book ファイル + :edit +/dir\ dirname\\ ファイル + :edit +set\ dir=c:\\\\temp ファイル +Note 最後の例では '\' の繰り返しが2回行われていることに注意。"+cmd" の引数なの +で1回、コマンド ":set" のためにもう1回だ。 + + *file-formats* +オプション 'fileformat' はファイルに対して の形式を設定する。 +'fileformat' の文字 形式の名称 ~ + "dos" または DOS形式 *DOS-format* + "unix" Unix形式 *Unix-format* + "mac" Mac形式 *Mac-format* +以前はオプション 'textmode' が使われていた。現在ではそれは時代遅れである。 + +ファイルを読み込むときに、上で述べた文字は として解釈される。DOS 形式 +(MS-DOS、OS/2 と Win32 での既定値) では、 の両方が と解 +釈される。 Note DOS 形式でファイルを保存するときには、 1 個ごとに対して + が追加されることに注意。|file-read| も参照。 + +ファイルを書き込むときには、上で述べた文字が として使われる。DOS形式では + が使われる。|DOS-format-write| も参照。 + +DOS 形式でファイルを読み込んで、Unix 形式でそれを保存することも可能である。 +('fileformats' が "dos" を含んでいると仮定すると) 以下の操作は全ての +を で置き換えることになる。 > + :e ファイル + :set fileformat=unix + :w +('fileformats' の値に "unix" が含まれているとき) Unix形式でファイルを読み込ん +で、DOS形式で保存すると、 は全て で置き換えられる。 > + :e ファイル + :set fileformat=dos + :w + +新しいファイルの編集を開始したときオプション 'fileformats' の値が空でないなら +ば(それがデフォルト)、Vim はファイルが指定された形式で改行されているかどうか検 +出を試みる。値が "unix,dos" であるときは、Vim は1個の (Unix と Amiga 形 +式)か の組 (MS-DOS 形式) が使われるものとして行を調べる。全ての行が + で終わっているときだけ、'fileformat' の値は "dos" に設定され、そうで +なければ "unix" に設定される。'fileformats' の値が "mac" を含んでいて、ファイ +ルに が1個も見つからないときは、'fileformat' の値は "mac" に設定される。 + +'fileformat' の値が MS-DOS 以外のシステム上で "dos" に設定されると、普通でない +ことが起きていることを気づかせるために、メッセージ "[dosフォーマット]" が表示 +される。'fileformat' の値が "unix" であると、MS-DOSシステムでは +"[unixフォーマット]" のメッセージが表示される。'fileformat' の値が "mac" であ +ると、Macintosh以外の全てのシステムでは、メッセージ "[macフォーマット]" が表示 +される。 + +オプション 'fileformats' の値が空で、DOS 形式が使用されているが、ファイルを読 +み込んでいるときにいくつかの行が で終わっていなかったならば、ファイル +のメッセージ内に "[CR無]" が含まれる。 +'fileformats' の値が空で、Mac 形式が使用されているが、ファイルを読み込んでいる +ときに が見つかったならば、ファイルのメッセージ内に "[NL無]" が含まれる。 + +新しいファイルが存在しないと、'fileformats' の値が空のときにはカレントバッファ +の 'fileformat' の値が使われる。そうでなければ、'fileformats' 内の1番目の形式 +が新しいファイルに対して用いられる。 + +実行可能ファイルやバイナリファイル、Vim script ファイルを編集する前には、オプ +ション 'binary' をオンに設定するべきだ。これにはオプション "-b" を付けてVimを +起動するのが簡単である。こうすると 'fileformat' が使われなくなる。こうしないと +1個の が不意に で置き換えられてしまうことを覚悟しなければならな +い。 + +オプション 'key' をオンに設定することで、保存されるファイルを暗号化できる。こ +れは他人がユーザーのファイルを読むことに対して、ある程度の安全を保証する。 +|encryption| + +============================================================================== +3. 引数リスト *argument-list* *arglist* + +Vim の開始時に複数のファイル名を与えると、それらは引数リストとして記憶される。 +リスト内のファイルにはどれでも移動できる。 + +これをコマンド |:buffers| で表示されるバッファリストと混同してはいけない。引数 +リストは Vi から既にあったが、バッファリストは Vim で新たに導入された。引数リ +スト内のファイルはバッファリストにも含まれる (コマンド |:bdel| や |:bwipe| で +消去されない限り)。逆にバッファリスト内のファイルが引数リストに含まれないこと +は普通にある。 + +この話題はユーザーマニュアルの第 |07.2| 章で紹介されている。 + +グローバルな引数リストが1個あり、これは既定では全てのウィンドウに使われる。ウィ +ンドウについてローカルな引数リストを新たに創ることもできる。|:arglocal| を参照。 + +引数リストは以下のコマンド及び expression 用関数 |argc()| と |argv()| で利用で +きる。これらはみなカレントウィンドウの引数リストに対して働く。 + + *:ar* *:args* +:ar[gs] 引数リストを表示する。カレントファイルは '[' ']' で挟 + まれて表示される。 + +:ar[gs] [++opt] [+cmd] {arglist} *:args_f* + {arglist} を新たな引数リストとして定義し、そのうち最初 + のファイルの編集を始める。変更点があり、Vimがカレント + バッファを放棄 |abandon| したくないときには失敗する。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt はない} + +:ar[gs]! [++opt] [+cmd] {arglist} *:args_f!* + {arglist} を新たな引数リストとして定義し、そのうち最初 + のファイルの編集を始める。カレントバッファに対する変更 + 点は全て失われる。 + |++opt| と |+cmd| も参照。 + {Vi: ++opt はない} + +:[count]arge[dit][!] [++opt] [+cmd] {name} *:arge* *:argedit* + 引数リストに {name} を追加し、その編集を始める。 + {name} が既に引数リスト内にあるときは、その編集を始め + る。 + これはコマンド |:argadd| を使い、次に |:edit| を使うの + と同じである。 + Note 指定できるファイルは1個であり、|:edit| と同様ファ + イル名の中に空白が使えることに注意。[count] は + |:argadd| と同様に使われる。 + カレントファイルが放棄 |abandon| できないときは '!' が + 必要になる。 + |++opt| と |+cmd| も参照。 + {Vi にはない} + +:[count]arga[dd] {name} .. *:arga* *:argadd* *E479* +:[count]arga[dd] + 引数リストに {name} を追加する。{name} が省略された時 + は引数リストに現在のバッファ名を追加する。 + [count] が省かれると {name} は引数リストの現在の項目の + 次に挿入される。指定されると [count] 番目の項目の次に + 挿入される。引数リストが "a b c" で "b" が現在の引数の + 場合のコマンドの結果一覧: + コマンド 新たな引数リスト ~ + :argadd x a b x c + :0argadd x x a b c + :1argadd x a x b c + :$argadd x a b c x + 最後の1つの後に: + :+2argadd y a b c x y + 重複検査はないので、1個のファイルを引数リストに2回加え + ることもできる。 + 現在編集中のファイルは変更されない。 + {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + Note 次の方法が使えることに注意。 > + :args ## x +< これは項目 "x" を追加し、新たなリストを並び替える。 + +:argd[elete] {pattern} .. *:argd* *:argdelete* *E480* + {pattern} にマッチするファイルを引数リストから削除する。 + {pattern} の意味はファイルパターンと同様なので、 + |file-pattern| を参照。現在の項目を削除するには "%" が + 使える。 + このコマンドは現在編集中のファイルが引数リストから削除 + されたときでも、それをそのままに保つ。 + 例: > + :argdel *.obj +< {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + +:[range]argd[elete] 引数リストから {range} の範囲のファイルを削除する。 + 例: > + :10,$argdel +< 10以降が削除され、1から9は残る。 > + :$argd +< 最後の引数を削除する。 > + :argd + :.argd +< 現在の引数を削除する。 > + :%argd +< 引数リストから全てのファイルを削除する。 + 範囲の上限が大きすぎるときは、最後の引数までが削除され + る。 + {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + + *:argu* *:argument* +:[count]argu[ment] [count] [++opt] [+cmd] + 引数リスト内で [count] 番目のファイルを編集する。 + [count] が省かれると現在の項目を編集する。変更点があり、 + Vimがカレントバッファを放棄 |abandon| したくないときに + は失敗する。 + |++opt| と |+cmd| も参照。 + {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + +:[count]argu[ment]! [count] [++opt] [+cmd] + 引数リスト内で [count] 番目のファイルを編集する。カレ + ントバッファに対するいかなる変更も失われる。[count] が + 省かれると現在の項目を編集する。 + |++opt| と |+cmd| も参照。 + {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + +:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* + 引数リストの中で [count] 個次のファイルを編集する。 + 変更点があり、Vimがカレントバッファを放棄 |abandon| し + たくないときには失敗する。 + |++opt| と |+cmd| も参照。 {Vi: count や ++opt はない} + +:[count]n[ext]! [++opt] [+cmd] + 引数リストの中で [count] 個次のファイルを編集する。カ + レントバッファに対するいかなる変更も失われる。 + |++opt| と |+cmd| も参照。 + {Vi: count や ++opt はない} + +:n[ext] [++opt] [+cmd] {arglist} *:next_f* + コマンド |:args_f| と同じ。 + +:n[ext]! [++opt] [+cmd] {arglist} + コマンド |:args_f!| と同じ。 + +:[count]N[ext] [count] [++opt] [+cmd] *:Next* *:N* *E164* + 引数リストの中で [count] 個前のファイルを編集する。変 + 更点があり、Vimがカレントバッファを破棄 |abandon| した + くないときには失敗する。 + |++opt| と |+cmd| も参照。 {Vi: count や ++opt はない} + +:[count]N[ext]! [count] [++opt] [+cmd] + 引数リスト内で [count] 個前のファイルを編集する。カレ + ントバッファに対するいかなる変更も失われる。 + |++opt| と |+cmd| も参照。 {Vi: count や ++opt はない} + +:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* + コマンド |:Next| と同じ。 + |++opt| と |+cmd| も参照。 {Vi: 幾つかのバージョンにの + み存在} + + *:rew* *:rewind* +:rew[ind] [++opt] [+cmd] + 引数リスト内で最初のファイルの編集を始める。変更点があ + り、Vimがカレントバッファを放棄 |abandon| したくないと + きには失敗する。 + |++opt| と |+cmd| も参照。 {Vi: ++opt はない} + +:rew[ind]! [++opt] [+cmd] + 引数リスト内で最初のファイルを編集する。カレントバッ + ファに対するいかなる変更も失われる。 + |++opt| と |+cmd| も参照。 {Vi: ++opt はない} + + *:fir* *:first* +:fir[st][!] [++opt] [+cmd] + コマンド |:rewind| の別名。 {Vi にはない} + + *:la* *:last* +:la[st] [++opt] [+cmd] + 引数リスト内で最後のファイルの編集を始める。変更点があ + り、Vimがカレントバッファを放棄 |abandon| したくないと + きには失敗する。 + |++opt| と |+cmd| も参照。 {Vi にはない} + +:la[st]! [++opt] [+cmd] + 引数リスト内で最初のファイルを編集する。カレントバッ + ファに対するいかなる変更も失われる。 + |++opt| と |+cmd| も参照。 {Vi にはない} + + *:wn* *:wnext* +:[count]wn[ext] [++opt] + カレントファイルを書き込み、引数リスト内で [count] 個 + 次のファイルの編集を始める。 + |++opt| と |+cmd| も参照。 {Vi にはない} + +:[count]wn[ext] [++opt] {file} + カレントファイルを {file} に書き込み、引数リスト内で + [count] 個次のファイルの編集を始める。ただし {file} が + 既に存在し、オプション 'writeany' がオフのときは失敗す + る。 + |++opt| と |+cmd| も参照。 {Vi にはない} + +:[count]wn[ext]! [++opt] {file} + カレントファイルを {file} に書き込み、引数リスト内で + [count] 個次のファイルの編集を始める。 + |++opt| と |+cmd| も参照。 {Vi にはない} + +:[count]wN[ext][!] [++opt] [file] *:wN* *:wNext* +:[count]wp[revious][!] [++opt] [file] *:wp* *:wprevious* + コマンド |:wnext| と同じだが、次でなく前のファイルに移 + る。 {Vi にはない} + +上のコマンドの [count] の既定値は1である。[count] を2回使えるコマンドもある。 +最後 (最も右) のものが使われる。 + +引数 [+cmd] が存在しないならば、カーソルはそのファイルに対して最後に認識された +位置に置かれる。オプション 'startofline' がオンのときは、カーソルは行の最初の +非空白文字に置かれ、オフのときは最後に認識された列が使われる。最後に認識された +カーソル位置がないときは、カーソルは最初の行 (Exモードでは最後の行) に置かれる。 + + *{arglist}* +引数リスト内のワイルドカードは展開され、ファイル名は並び替えられる。だからCの +ソースファイルを全て編集するには、コマンド "vim *.c" が使える。Vimの中でコマン +ド ":n *.c" としても同じである。 + +ファイル名は空白文字によって区切られる。ファイル名にスペースまたはタブを含める +には、その前にバックスラッシュを書くこと。例えば、"foo bar" という1つのファイ +ルを開くにはこうする: > + :next foo\ bar + +Unix およびその他いくつかのシステムではバッククォートも使える。例: > + :n `find . -name \\*.c -print` +アスタリスクの前の '\' は、"*.c" がプログラム find を実行する前にシェルで展開 +されるのを防ぐために必要となる。 + + *arglist-position* +引数リストがあるときは、ウィンドウのタイトル (それがあって、オプション 'title' +オンならば) やコマンド CTRL-G で出るファイルメッセージで編集しているファイルを +知ることができる。次のようなものが表示されるだろう。 + (file 4 of 11) +オプション 'shortmess' の値が 'f' を含んでいるときは以下のようになる。 + (4 of 11) +実際は引数リスト内の現在の位置でないファイルを編集しているならば、以下のように +なる。 + (file (4) of 11) +これは、引数リストの中の4番目にいるが、編集中のファイルは引数リストの中の4番目 +でないことを意味する。これは ":e file" をするときに起こる。 + + +ローカルな引数リスト + +{Vi にはない} +{Vimが |+windows| 機能と |+listcmds| 機能付きでコンパイルされたときのみ有効} + + *:arglocal* +:argl[ocal] グローバルな引数リストのローカルなコピーを作る。 + 別のファイルの編集は始めない。 + +:argl[ocal][!] [++opt] [+cmd] {arglist} + カレントウィンドウについてローカルな、新たな引数リスト + を定義する。 + ウィンドウが1個のときは |:args_f| と同じである。 + + *:argglobal* +:argg[lobal] カレントウィンドウにグローバルな引数リストを使う。 + 別のファイルの編集は始めない。 + +:argg[lobal][!] [++opt] [+cmd] {arglist} + カレントウィンドウにグローバルな引数リストを使う。 + コマンド |:args_f| と同様、グローバルな引数リストを新 + たに定義する。グローバルな引数リストを使っているウィン + ドウは全てこの新しいリストを参照するようになる。 + +複数の引数リストが存在可能であり、それらはウィンドウ同士で共有できる。共有され +ているときは、あるウィンドウ内で引数リストに変更を加えると、別のウィンドウの引 +数リストも影響を受ける。 + +ウィンドウが分割されると、新しいウィンドウはカレントウィンドウから引数リストを +受け継ぐ。すると2個のウィンドウは、片方でコマンド |:arglocal| か |:argglobal| +を使って別の引数リストを使うようになるまで、そのリストを共有することになる。 + + +引数リストを使う + + *:argdo* +:[range]argdo[!] {cmd} 引数リスト内の全てのファイルで {cmd} を実行する。また + は [range] が指定された場合、その範囲内の引数のみで実 + 行する。以下と同様の動作になる。 > + :rewind + :{cmd} + :next + :{cmd} + etc. +< カレントファイルを放棄 |abandon| できず、'!' も付けら + れていないときは、実行は失敗する。どれかのファイル内で + エラーが検出されると、引数リスト内の以降のファイルには + 進まない。 + 引数リスト末尾のファイル (またはエラーの起きたファイル) + がカレントファイルになる。 + {cmd} の中では '|' で複数のコマンドを連結できる。 + {cmd} は引数リストに変更を加えてはならない。 + Note: このコマンドの実行中、オプション 'eventignore' + でオートコマンドのイベント Syntax を指定することでそれ + を無効化できる。こうすると各ファイルの処理がかなり高速 + になる。 + {Vi にはない} {Vimが |+listcmds| 機能付きでコンパイル + されたときのみ有効} + |:windo|、|:tabdo|、|:bufdo|、|:cdo|、|:ldo|、|:cfdo|、 + |:lfdo|も参照。 + +例: > + :args *.c + :argdo set ff=unix | update +こうするとオプション 'fileformat' の値を "unix" に設定し、変更があったファイル +を保存する。それが全ての *.c ファイルについて行われる。 + +例: > + :args *.[ch] + :argdo %s/\/My_Foo/ge | update +こうすると全ての *.c ファイルと *.h ファイルで単語 "my_foo" を "My_Foo" に変え +る。コマンド ":substitute" でフラグ "e" を使って "my_foo" という単語の使われて +いないファイルでエラーが起きるのを防いでいる。コマンド ":update" は変更のあっ +たファイルのみを保存する。 + +============================================================================== +4. 書き込み *writing* *save-file* + +Note: オプション 'write' がオフのときは、どのファイルも書き込めないことに注意。 + + *:w* *:write* + *E502* *E503* *E504* *E505* + *E512* *E514* *E667* *E796* +:w[rite] [++opt] バッファ全体をカレントファイルに書き込む。これはファイ + ルに対する変更点を保存するときの普通の方法である。 + オプション 'readonly' がオンであるかファイルに書き込め + ない理由が何かあるときには実行に失敗する。 + +:w[rite]! [++opt] ":write" と似ているが、'readonly' がオンであったり書き + 込みが拒否される理由があっても無理矢理書き込みを行う。 + Note: これはファイルの権限や所属を変更したり、(シンボ + リック) リンクを途切れさせるかもしれないので注意。それ + を避けるには 'cpoptions' にフラグ 'W' を追加すること。 + +:[range]w[rite][!] [++opt] + 指定された範囲の行をカレントファイルに書き出す。これは + 普通の操作ではない。ファイルがバッファ内の全ての行を + 含むようにならないからだ。 + + *:w_f* *:write_f* +:[range]w[rite] {file} 指定された範囲の行をファイル {file} に書き出す。ただし + それが既に存在し、かつオプション 'writeany' がオフのと + きは失敗する。 + + *:w!* +:[range]w[rite]! [++opt] {file} + 指定された範囲の行をファイル {file} に書き出す。既存の + ファイルは上書きされる。 + + *:w_a* *:write_a* *E494* +:[range]w[rite][!] [++opt] >> + 指定された範囲の行をカレントファイルに追加する。 + +:[range]w[rite][!] [++opt] >> {file} + 指定された範囲の行をファイル {file} に追加する。'!' を + 付けるとそのファイルがまだ存在しなくても書き込みを行う。 + + *:w_c* *:write_c* +:[range]w[rite] [++opt] !{cmd} + [range] の行を標準入力として {cmd} を実行する ('!' の + 前の空白に注意)。{cmd} は ":!{cmd}" のように実行され、 + 全ての '!' は前回のコマンドに置き換えられる |:!|。 + +コマンド ":w" での [range] の既定値はバッファ全体 (1,$) である。バッファ全体を +書き込むと、そのバッファは変更されていないとみなされるようになる。 +":w somefile" によって別のファイルに書き出した場合は、'cpoptions' の "+" フラ +グに依存する。"+" が含まれている場合は、バッファがまだ元のファイルと異なってい +たとしても、書き込みコマンドによって 'modified' フラグがオフになる。 + +":w" にファイル名が与えられるとそれが代替ファイルになる。これは例えば書き込み +に失敗した後に ":w #" でもう一度試したいときに使える。オプション'cpoptions' か +らフラグ 'A' を取り除くとこれを無効化できる。 + + *:sav* *:saveas* +:sav[eas][!] [++opt] {file} + カレントファイルをファイル名 {file} として保存し、カレ + ントバッファのファイル名を {file} に変える。それまでの + カレントファイルの名前は代替ファイルの名前になる。既存 + のファイルを上書きするには [!] が必要になる。 + 'filetype' が空の場合、保存の前に新しいファイル名に対 + してファイルタイプ検出が行われる。 + 保存が成功すると 'readonly' がオフになる。 + {Vi にはない} + + *:up* *:update* +:[range]up[date][!] [++opt] [>>] [file] + ":write" と似ているが、バッファに変更点があるときのみ + 書き込みを行う。 {Vi にはない} + + +複数バッファでの書き込み *buffer-write* + + *:wa* *:wall* +:wa[ll] 変更点のあるバッファを全て書き込む。ファイル名を持たな + いバッファに対してはエラーメッセージが表示される。読み + 込み専用のバッファは書き込まれない。{Vi にはない} + +:wa[ll]! 変更点のあるバッファを、読み込み専用であっても全て書き + 込む。ファイル名を持たないバッファは書き込まれず、エ + ラーメッセージが表示される。 + {Vi にはない} + + +Vimは別の場所で変更を受けたファイルを上書きしようとしたときには警告する。 +|timestamp| を参照。 + + *backup* *E207* *E506* *E507* *E508* *E509* *E510* +オプション 'backup', 'writebackup' または 'patchmode' がオンのときに既存のファ +イルに (追加でなく) 書き込もうとすると、元のファイルのバックアップが作られる。 +ファイルは元のコピーかリネームしたものである ('backupcopy' を参照)。ファイルの +書き込みに成功したとき 'writebackup' がオンで 'backup' がオフだと、バックアッ +プファイルは削除される。'patchmode' がオンのときはバックアップファイルはリネー +ムされるかも知れない。 + + *backup-table* +'backup' 'writebackup' 動作 ~ + off off バックアップは作られない + off on カレントファイルをバックアップし、後で消去する (既定) + on off 古いバックアップを消去し、カレントファイルをバックアッ + プする + on on 古いバックアップを消去し、カレントファイルをバックアッ + プする + +'backupskip' に指定したパターンが書き込まれるファイルの名前にマッチしたときは、 +バックアップファイルは作られない。その場合 'backup' と 'writebackup' の値は無 +視される。 + +'backup' がオンのときは、古いバックアップファイル (新しいバックアップファイル +と同名) は削除される。'backup' がオフだが 'writebackup' がオンのときは、既存の +バックアップファイルは削除されない。ファイルの書き込み中に作られたバックアップ +ファイルは別の名前になる。 + +ファイルシステムによってはクラッシュで新しいファイルとバックアップを両方失うこ +ともあり得る (新しいファイルは存在はしても中身が滅茶苦茶になっていたり)。その +場合は復帰機能を試すこと。スワップファイルがまだディスクに残っているかもしれな +いからだ。 |:recover| + +オプション 'backupdir' で指定されたディレクトリはバックアップファイルをしまう +のに使われる。 (既定値: 書き込まれたファイルと同じディレクトリ) + +バックアップが、元のファイルのコピーである新規のファイルになるか、元のファイル +がリネームされたものになるかは、オプション 'backupcopy' で決まる。コピーが作ら +れるのがいつでファイルがリネームされるのがいつかについてはその箇所を参照。 + +バックアップファイルの生成に失敗すると、書き込みは行われない。それでも書き込み +たいときにはコマンドに '!' を追加すること。 + + *write-permissions* +新しいファイルを書き込むときは読み書きの権限が付く。unix ではマスクの値は 0666 +に umask を適用させたものになる。Vim で開いたファイルに書き込むときは権限は維 +持されるが、s ビットはクリアされる。 + + *write-readonly* +オプション 'cpoptions' の値にフラグ 'W' が含まれるときは、Vimは読み込み専用 +ファイルの上書きを拒否する。'W' が含まれないと、システムが許可すれば (ディレク +トリは書き込み可能でなければならない) ":w!" は読込専用ファイルを上書きする。 + + *write-fail* +新ファイルの書き込みに失敗したときは、変更点と元のファイルを同時に失わないよう +注意しなければならない。バックアップファイルがないときに書き込みに失敗すると、 +その時点で元のファイルはなくなっているのだ!ファイルを書き出すまでVIMを終了し +てはいけない!バックアップが作られていたら、それが元のファイルの所に戻される +(可能ならば)。Vimを終了して変更点が失われても、大抵は元のファイルはそこに残っ +ている。Vimが元のファイルを戻すのに失敗すると、元のファイルが失われた旨のエ +ラーメッセージが出る。 + + *DOS-format-write* +オプション 'fileformat' の値が "dos" のときは、 には が使われ +る。これは MS-DOS, Win32とOS/2での既定値である。その他のシステムでは +"[dos format]" というメッセージが表示され、普通でない が使われていること +を知らせてくれる。 + *Unix-format-write* +'fileformat' の値が "unix" のときは、 には が使われる。MS-DOS, Win32 +とOS/2では "[unix format]" というメッセージが表示される。 + *Mac-format-write* +'fileformat' の値が "mac" のときは、 には が使われる。Mac以外のシス +テムでは "[mac format]" というメッセージが表示される。 + +|file-formats| やオプション 'fileformat' 及び 'fileformats' も参照。 + + *ACL* +ACLは Access Control List を表す。これはファイルのアクセス権を制御するための先 +進的な手段である。新しいMS-WindowsとUnixシステムで使われるが、ファイルシステム +がそれをサポートするときのみである。 +Vimはファイルを書き込むときにACL情報を保とうとする。バックアップファイルは元の +ファイルのACL情報を受け継ぐ。 +ACL情報は (ファイルを開くときに) ファイルが読込専用かどうか調べるのにも使われ +る。 + + *read-only-share* +MS-Windowsがネットワーク上でドライブを共有するとき、そこは読込専用にすることが +できる。つまりファイルに読込専用の属性がなく、NCネットワーク共有ドライブ上の +ACL設定が書き込みを許可していても、そのファイルには書き込みができない。Win32プ +ラットフォーム上のVimは読込専用のネットワークドライブを判別し、ファイルを読込 +専用とマークする。そのファイルは |:write| で上書きできない。 + + *write-device* +ファイル名が実際はデバイス名のとき、Vimはバックアップを作ろうとはしない (無理 +な話だ)。デバイスは既に存在するので、保存にはフラグ "!" が必要である。 +Unixでの例: > + :w! /dev/lpt0 +MS-DOSやMS-Windowsでの例: > + :w! lpt0 +Unixでは、ファイル名が通常ファイルやディレクトリを指していないときにデバイスと +判断される。VimはFifo及び名前付きパイプもデバイスと判断する。 +MS-DOSとMS-Windowsでは、デバイスは名前から判断される: + AUX + CON + CLOCK$ + NUL + PRN + COMn n=1,2,3... 等 + LPTn n=1,2,3... 等 +ファイル名は大文字でも小文字でもよい。 + +============================================================================== +5. 書き込みと終了 *write-quit* + + *:q* *:quit* +:q[uit] カレントウィンドウを閉じる。最後のウィンドウで使うと + Vimを終了させる。変更点があってVimがカレントバッファを + 放棄 |abandon| しようとしないときや、引数リストの最後 + のファイルが編集されていないときは失敗する。 + 他のタブページが存在するとき、カレントタブページ内の最 + 後のウィンドウを閉じるとカレントタブページが閉じられる。 + |tab-page| + |QuitPre| オートコマンドイベントが発行される。 + +:conf[irm] q[uit] 終了だが、変更点があるときや、引数リスト内で末尾にない + ファイルを編集しているときにはプロンプトを表示する。 + コマンド |:confirm| やオプション 'confirm' を参照。 + {Vi にはない} + +:q[uit]! 現在のバッファに変更点があっても、書き込まずにVimを終 + 了する。バッファは、'hidden' が設定されているときにも + 読み込まれない。そのウィンドウが最後の1つで、変更点の + ある隠しバッファがある場合には、終了せずにカレントバッ + ファを破棄したあとで、最初の変更点がある隠しバッファを + 新たな現在のバッファとする。 + 必ず終了するにはコマンド ":qall!" を使うこと。 + +:cq[uit] 書き込みをせずに必ず終了し、エラーコードを返す。コマン + ド |:cq| を参照。Manx の QuickFix モードで使われる + (|quickfix| を参照)。 {Vi にはない} + + *:wq* +:wq [++opt] カレントファイルを書き込んでVimを終了する。ファイルが + 読込専用であるときや、バッファに名前が付いていないとき + には書き込みに失敗する。引数リスト内の末尾のファイルが + まだ編集されていないときには終了に失敗する。 + +:wq! [++opt] カレントファイルを書き込んでVimを終了する。バッファに + 名前が付いていないときには書き込みに失敗する。 + +:wq [++opt] {file} {file} に書き込んでVimを終了する。引数リスト内の末尾の + ファイルがまだ編集されていないときには終了に失敗する。 + +:wq! [++opt] {file} {file} に書き込んでVimを終了する。 + +:[range]wq[!] [++opt] [file] + 上と同様だが、[range] の範囲内の行のみを書き込む。 + + *:x* *:xit* +:[range]x[it][!] [++opt] [file] + |:wq| と似ているが、変更点があるときのみ書き込む。 + オプション 'hidden' がオンで複数のウィンドウが存在する + とき、ファイルを書き込んだ後はカレントバッファは隠れ + バッファになる。 + + *:exi* *:exit* +:[range]exi[t][!] [++opt] [file] + |:xit| と同様。 + + *ZZ* +ZZ 変更点があればカレントファイルを書き込み、Vimを終了す + る (コマンド |:x| と同様)。 Note: カレントファイルを複 + 数のウィンドウで開いているときは、ファイルに変更点があ + れば書き込まれ、そしてウィンドウが閉じられることに注意。 + + *ZQ* +ZQ 変更点を確かめずに終了する (コマンド ":q!" と同様)。 + {Vi にはない} + +複数のウィンドウとバッファ *window-exit* + + *:qa* *:qall* +:qa[ll] 変更点のあるバッファがない限り、Vimを終了する (変更点のある次 + のバッファに移動するにはコマンド ":bmod" を使うこと)。 + オプション 'autowriteall' がオンのときは、|:wqall| と同様に変 + 更点のあるバッファが全て書き込まれる。 {Vi にはない} + +:conf[irm] qa[ll] + Vimを終了する。変更点のあるバッファがあるときはプロンプトを表 + 示する。コマンド |:confirm| を参照すること。 {Vi にはない} + +:qa[ll]! Vimを終了する。バッファの変更点は全て失われる。 {Vi にはない} + 終了コードを非ゼロにしたい場合は |:cquit| を使う。 + + *:quita* *:quitall* +:quita[ll][!] コマンド |:qall| と同様。 {Vi にはない} + +:wqa[ll] [++opt] *:wqa* *:wqall* *:xa* *:xall* +:xa[ll] 変更点のあるバッファを全て書き込み、Vimを終了する。ファイル名 + のないバッファや読込専用または何らかの理由で書き込めないバッ + ファがあるときは、Vimを終了しない。 {Vi にはない} + +:conf[irm] wqa[ll] [++opt] +:conf[irm] xa[ll] + 変更点のあるバッファを全て書き込み、Vimを終了する。読込専用ま + たは何らかの理由で書き込めないバッファがあるときは、プロンプト + を表示する。コマンド |:confirm| を参照。 {Vi にはない} + +:wqa[ll]! [++opt] +:xa[ll]! 変更点のあるバッファを、読込専用であっても全て書き込み、Vimを + 終了する。ファイル名のないバッファや何らかの理由で書き込めない + バッファがあるときは、Vimを終了しない。 {Vi にはない} + +============================================================================== +6. ダイアログ *edit-dialogs* + + *:confirm* *:conf* +:conf[irm] {command} {command} を実行する際、確認が必要ならばダイアログを表 + 示する。コマンド |:q|, |:qa| や |:w| あるいは、 + |:only|, |:buffer|, |:bdelete| など、同様に失敗しうる + コマンドと共に使える(|:w| では読み取り専用属性を無視す + るかどうかを尋ねる)。 + +例: > + :confirm w foo +< ファイル "foo" が既に存在するときに確認を取る。 > + :confirm q +< バッファに修正個所があるときに確認を取る。 > + :confirm qa +< 修正個所があり、保存されていないバッファがあるとき、各バッファについて + 保存するか破棄するか尋ねる。「全て保存」や「全て破棄」という選択肢もあ + る。 + +常に ":confirm" を使いたいなら、代わりにオプション 'confirm' をオンにすること。 + + *:browse* *:bro* *E338* *E614* *E615* *E616* +:bro[wse] {command} {command} の引数のためにファイル選択ダイアログを開く。 + 現在の所、これらのコマンドと共に使える |:e|, |:w|, + |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|, + |:view|, |:sview|, |:r|, |:saveas|, |:sp|, |:mkexrc|, + |:mkvimrc|, |:mksession|, |:mkview|, |:split|, + |:vsplit|, |:tabe|, |:tabnew|, |:cfile|, |:cgetfile|, + |:caddfile|, |:lfile|, |:lgetfile|, |:laddfile|, + |:diffsplit|, |:diffpatch|, |:open|, |:pedit|, + |:redir|, |:source|, |:update|, |:visual|, |:vsplit|, + 'confirm' がオンのときは |:qall| も。 + {VimのWin32版、Motif、Athena、GTKやMacのGUI版でのみ利 + 用可能。} + |:browse|が使えない時はエラーが表示される。|+browse| + の機能がなかったり、{command} が :browse に対応してい + ない場合、{command} はダイアログなしで実行される。 + ":browse oldfiles" については |:oldfiles| を参照。 + +使用法については、例をいくつか見るのが一番分かりやすい。 > + :browse e $vim/foo +< ファイル選択ダイアログをディレクトリ $vim/foo 内で開き、選択さ + れたファイルを編集する。 > + :browse e +< ファイル選択ダイアログを 'browsedir' で指定されたディレクトリ + 内で開き、選択されたファイルを編集する。 > + :browse w +< ファイル選択ダイアログをカレントファイルのディレクトリ内で、カ + レントファイルの名前を既定値として開き、選択されたファイル名を + 使ってバッファを保存する。 > + :browse w C:/bar +< ファイル選択ダイアログをディレクトリ C:/bar 内で、カレントファ + イルの名前を既定値として開き、選択されたファイル名を使ってバッ + ファを保存する。 +オプション 'browsedir' も参照すること。 +Vimのファイル選択ダイアログをサポートしないバージョンでは、コマンドはそのまま +実行される。 + + *browsefilter* +MS-Windows と GTK では、ファイル選択ダイアログで使われるフィルタを指定できる。 +グローバル変数 g:browsefilter かローカル変数 b:browsefilter を設定すると、フィ +ルタをグローバルにまたはバッファについてローカルに変更できる。この変数を指定す +る際の書式は "{filter label}\t{pattern};{pattern}\n" で、{filter label} はコン +ボボックス「ファイルの種類」に使われるテキスト、{pattern} はファイル名を選別す +るフィルタである。';' で区切れば複数のパターンを指定できる。 + +Motif上のVimでは同じ書式が使えるが、実際には1番目のパターンだけが使われる +(Motifではパターンは1種類しか使えないが、それをユーザーが編集できる)。 + +例えばダイアログでVim関連ファイルだけを表示するには、以下のコマンドを使う。 > + + let g:browsefilter = "Vim Scripts\t*.vim\nVim Startup Files\t*vimrc\n" + +フィルタは、変数 b:browsefilter を設定することでバッファ毎に設定できる。 +b:browsefilter はファイルタイププラグインで設定することが一番多いだろう。 +するとファイルブラウザーダイアログには現在編集中のファイルのタイプに関連した候 +補が表示される。弊害: 別の種類のファイルの編集が始め辛くなる。対策は、フィルタ +の最後の項目に "All Files\t*.*\n" を加え、ユーザーが望みのファイルにアクセスで +きる道を残すことだ。 + +Vim が browsefilter をサポートしていないときにそれを設定しないようにするには、 +has("browsefilter") が使える: > + + if has("browsefilter") + let g:browsefilter = "whatever" + endif + +============================================================================== +7. カレントディレクトリ *current-directory* + +コマンド |:cd| や |:lcd| を使って別のディレクトリに移ることができる。すると +{訳注: そのディレクトリ内のファイルを編集するとき} そのディレクトリ名をファイ +ル名の前に付けなくても良くなる。また違いは ":!ls" 等の外部コマンドの実行の際に +も現れる。 + +'cpoptions' にフラグ '.' が含まれている場合、カレントバッファが変更されている +と、"!" をつけない限りディレクトリ変更は失敗する。 + + *:cd* *E747* *E472* +:cd[!] Unix以外のシステムでは: カレントディレクトリ名を表示す + る。Unixシステムでは: カレントディレクトリをホームディ + レクトリに変更する。全てのシステムで、カレントディレク + トリの表示にはコマンド |:pwd| が使える。 + +:cd[!] {path} カレントディレクトリを {path} に変更する。 + {path} が相対的な指定なら、オプション 'cdpath' 内に列 + 挙されたディレクトリを基準に判断される。既に開かれたファ + イルについては、フルパスが把握されているので変化はない。 + しかし引数リスト |arglist| 内のファイルの意味は変わる + かもしれない! + MS-DOSではアクティブなドライブも変更する。 + カレントファイルのディレクトリに移るにはこうする。 > + :cd %:h +< + *:cd-* *E186* +:cd[!] - 前のカレントディレクトリ (前にコマンド ":cd {path}" で + 移った所) に移る。 {Vi にはない} + + *:chd* *:chdir* +:chd[ir][!] [path] コマンド |:cd| と同じ。 + + *:lc* *:lcd* +:lc[d][!] {path} コマンド |:cd| と似ているが、カレントウィンドウのカレ + ントディレクトリのみを変更する。別のウィンドウのカレン + トディレクトリに変化はない。 {Vi にはない} + + *:lch* *:lchdir* +:lch[dir][!] |:lcd| と同じ。 {Vi にはない} + + *:pw* *:pwd* *E187* +:pw[d] カレントディレクトリ名を表示する。 {Vi: pwdはない} + |getcwd()| も参照。 + +コマンド |:lcd| が使われない限り、全てのウィンドウは同じカレントディレクトリを +共有する。別のウィンドウに移るコマンドを使ってもカレントディレクトリについての +変化は何もない。 +コマンド |:lcd| があるウィンドウ内で使われると、指定されたディレクトリがそのウィ +ンドウに対してのカレントディレクトリになる。コマンド |:lcd| が使われたことのな +いウィンドウはグローバルなカレントディレクトリを使い続ける。別のウィンドウに移っ +たときは、カレントディレクトリは {訳注: 移動先に対して} 最後に指定されたローカ +ルなカレントディレクトリになる。何も指定されていなかったら、グローバルなカレン +トディレクトリが使われる。 +コマンド |:cd| が使われると、カレントウィンドウは固有のローカルなカレントディ +レクトリを失い、グローバルなカレントディレクトリを使うようになる。 + +|:cd| を使った後は、ファイルの読み書きにはフルパス名が使われる。ネットワーク接 +続されたファイルシステムではこれが問題を起こすことがある。フルパス名を使った結 +果、現在使用中のファイル名は同じファイルを指し続けることになる。例: ファイル +a:test とディレクトリ a:vim があるとき、":e test" ":cd vim" ":w" とするとファ +イル a:test を上書きし、a:vim/test には書き込まない。しかし ":w test" とすると +ファイル a:vim/test が書き込まれる。それは新しいファイル名が指定され、":cd" 以 +前のファイル名には言及してないからだ。 + +============================================================================== +8. バイナリファイルの編集 *edit-binary* + +Vimはテキストファイルの編集のために作られたが、バイナリファイルを編集すること +もできる。Vimの引数 |-b| (バイナリ "binary" の 'b') はVimにファイル入出力をバ +イナリモードで行わせ、バイナリファイルの編集のためにいくつかのオプションを設定 +する ('binary' をオン、'textwidth' を0、'modeline' をオフ、'expandtab' をオフ +にする)。オプション 'binary' をオンにすることも同じ効果を持つ。これはファイル +の読み込み前にするということを忘れてはならない。 + +バイナリファイルを編集するときに忘れてはならないことがいくつかある: +- 実行可能ファイルを編集するときには、文字数が変わってはならない。テキストを変 + 更するには "R" か "r" だけを使用すること。"x" やバックスペースで文字を削除し + てはならない。 +- オプション 'textwidth' の値を0に設定する。そうしないと行が不意に2つに分割さ + れてしまう。 +- の数があまり多くないときは、一行は非常に長くなる。スクリーンに収まりき + らない行を編集したいならば、オプション 'wrap' をオフにすること。その時には水 + 平スクロールが使われる。行が余りにも長いならば (Amigaでは約32767文字以上、 + 32bitシステムではそれ以上、|limits| を参照)、その行は編集できない。ファイル + を読み込むときに、その行は分割される。ファイルを読み込むときに + "out of memory" エラーが出る可能性もある。 +- ファイルを読み込む前にオプション 'binary' がオンになっていることを確かめるこ + と。さもないと の両方が行末とみなされ、ファイルが保存され + るときに で置き換えられてしまう。 +- 文字はスクリーンでは ^@ として表示される。それは "CTRL-V CTRL-@" か + "CTRL-V 000" で入力できる。{Vi ファイル内で 文字を扱えない} +- 文字を挿入すると、行が分割される。バッファをファイルに保存するときには、 + として保存される。 +- ファイルの終わりに が一つもないとき、通常Vimはそれを追加する。これを防 + ぐにはオプション 'binary' をオンにすること。最後の を追加したいならば、 + オプション 'endofline' をオンにする。最後の行に があったかどうかを知る + ためにこのオプションの値を見てもよい (テキストからは判断できない)。 + +============================================================================== +9. 暗号化 *encryption* + +Vimはファイルを暗号化して保存し、再び読み取ることができる。暗号化されたテキス +トは正しい鍵がないと読むことができない。 +{Vimが |+cryptv| 機能付きでコンパイルされたときのみ有効} *E833* + +スワップファイルやアンドゥファイル内のテキストも暗号化される。 *E843* +しかしながら、これはブロック単位で実行されるので、より少ない時間でパスワードが +クラックされる可能性がある。スワップファイルを無効化することもできるが、クラッ +シュ時には作業内容が失われることになる。アンドゥファイルは無効化してもそれほど +の不利益はない。 > + :set noundofile + :noswapfile edit secrets + +Note: メモリ内のテキストは暗号化されない。ユーザーがテキストを編集している間、 +システム管理者はそれを見ることができる。":!filter" や ":w !command" によって +フィルタに通しているときもテキストは暗号化されておらず、他人に見られる可能性が +ある。'viminfo' ファイルは暗号化されない。 + +機密テキストを編集するときは次のように設定するという手もある: > + :set noundofile viminfo= + :noswapfile edit secrets.txt +スワップファイルを無効化するとクラッシュまたは停電の時に編集内容が失われてしま +うので注意。 + +警告: 鍵の入力時にタイプミスをしてファイルを保存し、Vimを終了すると、テキスト +は失われてしまう! + +暗号化を利用する通常の方法は、コマンド |:X| を使うことだ。これは鍵を入力するよ +う求める。次の保存コマンドでファイルを暗号化するためにその鍵が使われる。後で同 +じファイルを編集するときは、Vimは鍵の入力を求める。保存に使われたものと同じ鍵 +を打ち込むと、再びテキストを読み込むことができる。間違ったキーを使うと、テキス +トはめちゃめちゃになって表示される。 + + *:X* +:X 暗号化キーを入力するよう求める。ディスプレイを見ている誰かが鍵を見ない + ように、打ち込むときには実際のテキストは表示されない。 + 打ち込まれた鍵はオプション 'key' に保存される。これはファイルを書き込 + むときの暗号化に使われる。Vimの引数 |-x| も参照。 + +オプション 'key' の値はテキストが書き込まれるときに使われる。値が空でないとき、 +書き込まれたファイルは、その値を鍵として暗号化されている。Vimがファイルが暗号 +化されていることを認識できるよう、ファイル先頭に特殊な数が付加される。 + +暗号化を無効にするには、オプション 'key' に空の値を入れてリセットする。 > + :set key= + +'cryptmethod' オプションを設定することで暗号化メソッドを選択できる。次の中から +選択できる: > + :setlocal cm=zip " 弱いメソッド。後方互換。 + :setlocal cm=blowfish " 脆弱性ありのメソッド + :setlocal cm=blowfish2 " 中強度のメソッド +ファイルを保存する前に設定する。暗号化されたファイルを読み込んだとき、このオプ +ションは自動的にファイル保存時に使われたメソッドに設定される。ファイルを保存す +る前に 'cryptmethod' を変更することで使用するメソッドを変更できる。 + +新しいファイルに使われるデフォルトのメソッドを設定したい場合は |vimrc| ファイ +ルで次を設定すること: > + set cm=blowfish2 +"blowfish2" の使用が強く推奨される。"blowfish2" をサポートしていない古いバージ +ョンの Vim を使わなければならない場合のみ、他のメソッドを使用する。 + +ファイルを読み込んだり書き込んだりしたとき、zip なら "[crypted]"、blowfish な +ら "[blowfish]" とメッセージが表示される。 + +アンドゥファイルが保存されるとき、同じキーとメソッドがアンドゥファイル内のテキ +ストに適用される。|persistent-undo|。 + +"blowfish" をサポートしているかどうかテストするには下記の条件を使う: > + has('crypt-blowfish') + has('crypt-blowfish2') +上記の条件が利用できるのは Vim 7.4.1099 からであるが、"blowfish" のサポート自体 +はより古くからある。 +よって上記の条件が偽になったとしても "blowfish" をサポートしていることがある。 +"blowfish" を使えるかどうかは次の条件でテストできる: > + v:version >= 703 +また "blowfish2" については次の条件でテストできる: > + v:version > 704 || (v:version == 704 && has('patch401')) +Vim にパッチ 7.4.237 が含まれていることが分かっているなら、次の条件で簡単にチ +ェックできる: > + has('patch-7.4.401') +< + *E817* *E818* *E819* *E820* +暗号化が正しく機能しないと、保存したファイルが後で読めなくなってしまう。そのた +め、暗号化が期待したとおりに機能しているかどうかを確認するための検査が実行され +る。これらのエラーが表示されたときはファイルを暗号化して保存しないこと。これを +直すためには Vim を再ビルドする必要があるだろう。 + +*E831* これは内部エラーで普通は発生しない。このエラーの再現手順を見つけた方は +開発者へ連絡していただきたい。 + +暗号化されたファイルを読み込んだとき、'key' オプションの値が空でなければその値 +が復号に使われる。空のときは入力プロンプトが表示される。キーを入力しないか間 +違ったキーを入力するとファイルは復号されずに開かれる。キーが間違っていても警告 +は表示されない (総当たり攻撃を難しくするため)。 + +異なる鍵で暗号化したファイルの読み込みを始めたいときは、オプション 'key' の値 +に空文字列を設定すること。するとVimが新しい値の入力を求める。値の入力にコマン +ド ":set" を使ってはならない。他の人が肩越しにコマンドの入力を読むことができる +からだ。 + +オプション 'key' の値は秘密であることになっているので、その値は決して見られて +はならない。vimrcファイル内でこのオプションを設定してはいけない。 + +"/etc/magic", "/usr/share/misc/magic" 等、システムの持っている "magic" ファイ +ルならどれでもよいが、下の行を追加すると、暗号化されたファイルが "file" コマン +ドに認識されるようになる: > + 0 string VimCrypt~ Vim encrypted file + >9 string 01 - "zip" cryptmethod + >9 string 02 - "blowfish" cryptmethod + >9 string 03 - "blowfish2" cryptmethod + +Note: +- オプション 'charconvert' でコード変換をしているときには暗号化はできない。 +- コピーや削除したテキストは番号付きレジスタに格納される。レジスタの内容は + .viminfoファイル内に保存できるが、ここからは読み出せるかもしれない。安全のた + めオプション 'viminfo' を変更すること。 +- コンピュータからしばらく離れているときには誰かがVimにコマンドを入力できるが、 + 鍵を入手できるようになっていてはいけない。 +- キーを入力しているときにタイプミスをすると、テキストを復元できなくなってしま + うだろう! +- コマンド ":set key=value" で鍵を入力すると、それは履歴の中に保存され、 + viminfoファイル内に 'key' の値を晒すことになる。 +- 100パーセント安全ということは決してない。Vimの暗号化は強度についてはテストさ + れていない。 +- 'cryptmethod' が "zip" のときに使用されるアルゴリズムは簡単に破れる。4 文字 + の鍵なら約1時間以内、6文字の鍵なら1日以内で破れる (Pentium 133 PCで)。これに + はファイル内に必ず現れるはずのテキストをいくつか知っている必要がある。暗号破 + りの熟練者はどのような鍵であっても破ることができる。テキストが復号化されたと + いうことは鍵も明らかになったということであり、同じ鍵で暗号化された他のテキス + トも復号化できてしまう。 +- Pkzip は 'cryptmethod' の "zip" と同じ暗号化を用いており、合衆国政府はその輸 + 出に対して異議を唱えていない。Pkzipの公開ファイル APPNOTE.TXT にはこのアルゴ + リズムが詳細に記述されている。 +- 'cryptmethod' の "blowfish" の実装には脆弱性がある。ファイルの最初の 64 バイ + ト (条件によってはもっと) はクラック可能である。これの使用は推奨されないが、 + Vim 7.3 と 7.4 でサポートされている中ではそれが一番強度のあるメソッドであ + る。"zip" メソッドはさらに弱い。 +- Vimはオランダに起源を持つ。そこがソースの出処である。従って、暗号化コードは + アメリカ合衆国から輸出されてはいない。 + +============================================================================== +10. タイムスタンプ *timestamp* *timestamps* + +Vimは編集を始めたときのファイルの修正タイムスタンプとモードとサイズを覚えてい +る。これは同じファイルの別のバージョンを (知らずに) 作ってしまうのを防ぐためで +ある。 + +シェルコマンド (|:!cmd| |suspend| |:read!| |K|) の実行後、ウィンドウ内の全ての +バッファでタイムスタンプとファイルモードとファイルサイズが比較される。Vimは変 +更を受けたファイルに関して、イベント |FileChangedShell| に関連付けられた任意の +自動コマンドを実行するか、警告を表示する。GUIを使っているときは、それらはVimに +入力フォーカスが戻ってきたときに行われる。 + + *E321* *E462* +ファイルがVimの外部で変更を受けたときに自動的に読み直して欲しいなら、オプショ +ン 'autoread' をオンにすること。しかしこれはファイルを書き込んだ時点では機能し +ない。ファイルがVim内部で変更されていないときだけだ。 + +Note イベント |FileChangedShell| に自動コマンドが定義されていると、警告メッセー +ジやプロンプトは表示されない。その自動コマンドが対処するものとされている。 + +ディレクトリに関する警告はない (例えば |netrw-browse| で)。しかし新しいファイ +ルの編集を始めた後、同名のディレクトリが作られたときには警告される。 + +ファイルのタイムスタンプが変更されたことにVimが気づいたとき、そのファイルが +バッファ内で編集されているがまだ変更されていないならば、Vimはファイルの中身が +同じかどうかを調べる。このためにはファイルを読み直し、テキストを比較する (隠れ +バッファに読み込むが、これはすぐに削除される)。内容が同じならば警告は出ない。 + +自動警告では足りないと思ったならば、以下のコマンドが使える。 + + *:checkt* *:checktime* +:checkt[ime] Vimの外部で変更を受けたバッファがないかどうか調べる。 + これはファイルのバージョンが2個になってしまわないかど + うかを調べ、警告する。 + これがオートコマンドや ":global" コマンドから呼ばれた + ときや、直に打ち込まれたのではないときは、実際に調べる + のは副作用 (ファイルの再読み込み) が無害となる時点まで + 延期される。 + 読み込まれているバッファそれぞれについて関連付けられた + ファイルが変更を受けていないか調べる。変更を受けていた + ら、Vimは対処動作を行う。すなわちバッファに変更点が無 + く、かつオプション 'autoread' がオンのときは、バッファ + は読み直される。そうでなければ、ファイルを読み直すかど + うかの選択肢が与えられる。ファイルが削除されていたら、 + エラーメッセージが表示される。 + 以前には存在しなかったファイルが存在していたら、エラー + メッセージが表示される。 + 一度ファイルが調べられるとタイムスタンプ情報が更新され、 + 再び警告されることは無い。 + +:[N]checkt[ime] {filename} +:[N]checkt[ime] [N] + 特定のバッファのタイムスタンプを調べる。バッファの指定 + は名前、番号またはパターンでもよい。 + + *E813* *E814* +ここでユーザーがバッファを再読み込みすることを選ぶと、再読み込みされる。そのバッ +ファを含むウィンドウが表示されている場合、再読み込みはそのウィンドウの中で行わ +れる。そのようなウィンドウがなければ、オートコマンドが正常に動作するよう、特殊 +なウィンドウが使われる。このウィンドウを閉じることはできない。他にもいくつかの +制限が適用される。カレントバッファの外では何も起こらないようにするのがベストで +ある。例えば、ウィンドウローカルなオプションをセットすると、間違ったウィンドウ +の中でセットされてしまう。ウィンドウを分割し、そこで何かをして、閉じることは大 +丈夫である(他のオートコマンドによる副作用が何もなければ)。無関係なウィンドウや +バッファを閉じると問題を引き起こすだろう。 + +書き込み前にはタイムスタンプが調べられる。もし変更されていたら、Vimはそのファ +イルを本当に上書きするかどうかを尋ねる。 + + 警告: 読込んだ後にファイルに変更がありました!!! + 本当に上書きしますか (y/n)? + +'y' を打ち込むと、Vimは続けて書き込みを行う。'n' を打ち込むと、書き込みは中止 +される。コマンド ":wq" や "ZZ" を使った場合にはVimは終了せず、書き込む機会が再 +び得られる。 + +普通、メッセージは編集セッションが始まった後に誰かがファイルに書き込んだことを +示している。それは別の人物かもしれない。この場合、あなたの行った変更とその人物 +が行った変更が合併されるべきか調べたいことだろう。ファイルを別の名前で書き込み、 +差分を調べること (これにはプログラム "diff" が使える)。 + +別の編集セッションや別のコマンドで (例えばフィルタコマンド) そのファイルに自分 +自身で変更を加えたということもあり得る。その場合、どちらのバージョンを保管した +いかは自分でお分かりだろう。 + +何も間違ったことはしていないのにこのメッセージが現れる場合が1つある: +Win32 でサマータイムが始まる日である。Win32 ライブラリにより、Vim が時間の差を +混乱してしまう。この問題は次の日には直る。 + +============================================================================== +11. ファイル検索 *file-searching* + +{Vimが |+path_extra| 機能付きでコンパイルされたときのみ有効} + +現在の所、オプション 'path', 'cdpath', 'tags' と|finddir()|, |findfile()| で、 +本節で説明する「ファイル検索」にしたがってワイルドカードの展開が行われる。 +それ以外のコマンドでは |wildcards| という少し異なるルールにしたがう。 + +ファイル検索には以下の3種類がある: + +1) 下向き検索: *starstar* + 下向き検索にはワイルドカード '*' と '**' 及びユーザーのOSがサポートするその + 他のものが使える。'*' と '**' はVim内部で処理されるので、全てのOSで機能する。 + Note "**" はパス名の先頭で使われた場合のみ特別なワイルドカードとなる。 + + '*' の使用法はきわめて単純: 0 個以上の文字にマッチする。 + 正規表現パターンでいうと ".*" と同じである。正規表現と異なり "." は必要ない + ことに注意。 + + '**' はもっとすばらしい。 + - これはディレクトリのみにマッチする。 + - これはデフォルトで 30 段階までの深さのディレクトリにマッチするので、ディ + レクトリツリー全体の検索に使える。 + - マッチする深さの最大値は '**' の後に数字を付け加えて指定できる。 + だから '/usr/**2' は下のようにマッチする。 > + /usr + /usr/include + /usr/include/sys + /usr/include/g++ + /usr/lib + /usr/lib/X11 + .... +< '/usr/include/g++/std' には、深さが3なのでマッチしない。 + 指定可能な範囲は 0 ('**0' は無視される) から 100 である。 + 負数を指定すると 30 を、100 より大きい数を指定すると 100 を指定したも + のとされる。システムにもパスの長さの限界が存在する場合がある。通常は + 256 または 1024 バイトである。 + - '**' はパスの末尾にのみ使える。後ろにパス区切り文字か、数字とパス区切 + り文字の組み合わせを付けてもよい。 + + '*' と '**' を組み合わせる順番は自由である。 > + /usr/**/sys/* + /usr/*tory/sys/** + /usr/**2/sys/* + +2) 上向き検索: + この方法ではディレクトリを指定すると、そのディレクトリから上に遡ってファイ + ルを探す。上向き探索の上限となるディレクトリが指定できる。それはパス (オプ + ション 'path') かファイル名 (オプション 'tags') の末尾に ';' で区切って指定 + する。複数のディレクトリを指定したいときはそれらを ';' で区切る。上限ディレ + クトリを指定したくないときは (ルートディレクトリまで上向き検索したいとき) + ';' だけを付ける。 > + /usr/include/sys;/usr +< で検索されるディレクトリは: > + /usr/include/sys + /usr/include + /usr +< + 相対パスを使うと上向き検索はVimのカレントディレクトリから始まる。相対パスの + 指定が './' で始まり、'cpoptions' にフラグ 'd' が含まれていないときはカレン + トファイルのディレクトリから始まる。 + + Vimのカレントパスが /u/user_x/work/release のときに > + :set path=include;/u/user_x +< とすると、コマンド |gf| でファイルを探す範囲は: > + /u/user_x/work/release/include + /u/user_x/work/include + /u/user_x/include + +3) 複合検索: + Vimのカレントパスが /u/user_x/work/release のときに > + set path=**;/u/user_x +< とすると、コマンド |gf| でファイルを探す範囲は: > + /u/user_x/work/release/** + /u/user_x/work/** + /u/user_x/** +< + 注 意 ! これはかなりの時間を食うかもしれない。'/u/user_x/**' は + '/u/user_x/work/**' や '/u/user_x/work/release/**' を含むからだ。つまり + '/u/user_x/work/release/**' は3回、'/u/user_x/work/**' は2回繰り返して検索 + される。 + + 上の例では次のように設定したほうがいいかもしれない: > + :set path=**,/u/user_x/** +< これに含まれる範囲は + /u/user_x/work/release/** ~ + /u/user_x/** ~ + となり、同じディレクトリだが順番が違う。 + + Note: 現在 ":find"、":sfind"、":tabfind" コマンドは、'path' アイテムに url + や深さ制限付きのダブルスター (/usr/**2) や 上方検索 (;) などが含まれている + と機能しない。 +> + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/eval.jax b/plugins/vimdoc-ja/doc/eval.jax new file mode 100644 index 0000000000..94a0ab4ce0 --- /dev/null +++ b/plugins/vimdoc-ja/doc/eval.jax @@ -0,0 +1,10344 @@ +*eval.txt* For Vim バージョン 8.0. Last change: 2017 Mar 09 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vim script *expression* *expr* *E15* *eval* + +Vim script の利用についてはユーザーマニュアルの41章|usr_41.txt|でも解説され +ている。 + +注意: Vim script はコンパイル時に無効化できる。もしそうなっているとこのド +キュメントに書かれている事は有効ではない。|+eval|と|no-eval-feature|を参照。 + +1. 変数 |variables| + 1.1 変数の型 + 1.2 関数への参照 |Funcref| + 1.3 リスト |Lists| + 1.4 辞書 |Dictionaries| + 1.5 変数について補足 |more-variables| +2. 式の文法 |expression-syntax| +3. 内部変数 |internal-variables| +4. 組み込み関数 |functions| +5. 関数定義 |user-functions| +6. 波括弧{}変数 |curly-braces-names| +7. コマンド |expression-commands| +8. 例外処理 |exception-handling| +9. 例 |eval-examples| +10. +eval機能が無効 |no-eval-feature| +11. サンドボックス |eval-sandbox| +12. テキストロック |textlock| +13. テスト |testing| + +{Vi にはこれらのコマンドはない} + +============================================================================== +1. 変数 *variables* + +1.1 変数の型 ~ + *E712* +変数には9種類の型がある: + +数値 32ビットまたは64ビットの符号有整数。|expr-number| *Number* + 64ビット数値は |+num64| 機能つきでコンパイルされたときのみ有効。 + 例: -123 0x10 0177 0b1011 + +浮動小数点数 浮動小数点数。|floating-point-format| *Float* + {|+float| 機能つきでコンパイルされたときのみ} + 例: 123.456 1.15e-6 -1.1e3 + +文字列 終端がNUL文字である8ビットの符号無し文字(バイト)。 + |expr-string| 例: "ab\txx\"--" 'x-z''a,c' + +リスト 要素の順序つきの列 |List|。 + 例: [1, 2, ['a', 'b']] + +辞書 順序を持たない連想配列: 各要素はキーと値を持つ。|Dictionary| + 例: {'blue': "#0000ff", 'red': "#ff0000"} + +Funcref 関数への参照 |Funcref|。 + 例: function("strlen") + 辞書や引数とバインドすることができ、そのときは部分適用(Partial) + のように働く。 + 例: function("Callback", [arg], myDict) + +特殊値 |v:false|, |v:true|, |v:none| と |v:null|。 *Special* + +ジョブ ジョブに使われる。|job_start()|を参照。 *Job* *Jobs* + +チャンネル チャンネルに使われる。|ch_open()|を参照。 *Channel* *Channels* + +数値と文字列は文脈に応じて相互に変換される。 + +数値から文字列への変換は数字のASCII表現によって行われる。例: + 数値 123 --> 文字列 "123" ~ + 数値 0 --> 文字列 "0" ~ + 数値 -1 --> 文字列 "-1" ~ + *octal* +文字列から数値への変換は最初の数字を用いて数値に変換する。16進表記 "0xf9" や +8進表記 "017"、2進数表記の "0b10" も認識される。文字列が数字で始まらない場合結 +果は0となる。例: + 文字列 "456" --> 数値 456 ~ + 文字列 "6bar" --> 数値 6 ~ + 文字列 "foo" --> 数値 0 ~ + 文字列 "0xf1" --> 数値 241 ~ + 文字列 "0100" --> 数値 64 ~ + 文字列 "0b101" --> 数値 5 ~ + 文字列 "-8" --> 数値 -8 ~ + 文字列 "+8" --> 数値 0 ~ + +文字列を強制的に数値に変換するには0を足す: > + :echo "0100" + 0 +< 64 ~ + +先頭の0によって8進数とみなされるのを防いだり、異なる基数を使うには|str2nr()|を +使う。 + + *TRUE* *FALSE* +ブール(真理値)演算には数値が使われる。0は偽を意味し、非0は真を表す。また、 +|v:false| と |v:true| を使うこともできる。関数から真が返されたときは数値の 1 +であり、偽が返されたときは数値の 0 である。 + +Note 次のコマンドをみると > + :if "foo" + :" 実行されない +"foo" は 0 に変換され、それは偽を意味する。もし文字列がゼロでない数値から始ま +る場合は真を意味する: > + :if "8foo" + :" 実行される +文字列が空ではないか調べるためには empty() を使用して次のようにする。 > + :if !empty("foo") +< + *non-zero-arg* +関数の引数は、|TRUE| とは少し異なる場合がある: 引数が存在し、それが非ゼロの +Number、|v:true| または空でない String に評価される場合、値は TRUE と見なされ +る。" " と "0" も空文字列ではないので、モードをクリアするのに注意すること。 +List、Dictionary、または Float は数値または文字列ではないため、FALSE と評価さ +れる。 + + *E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910* *E913* +リスト、辞書、Funcref、ジョブ、チャンネルは自動的に変換されない。 + + *E805* *E806* *E808* +数値と浮動小数点数をまぜると浮動小数点数になる。それ以外には浮動小数点数への自 +動的な変換は存在しない。文字列から浮動小数点数へは str2float() を使い、浮動小 +数点数から文字列へは printf() を、浮動小数点数から数値へは float2nr() を使う。 + + *E891* *E892* *E893* *E894* *E907* *E911* *E914* +浮動小数点数が予期されているところでは数値も使用可能だが、それ以外は使用できな +い。 + + *no-type-checking* +変数の型を変更しようとしてもエラーは発生しない。 + + +1.2 関数への参照 ~ + *Funcref* *E695* *E718* +関数への参照は、関数|function()|、関数|funcref()|またはラムダ式|expr-lambda|を +使うことで得られる。関数への参照は、式の中で関数名が要求される場所で使うと参照 +先の関数を呼び出す。例: > + + :let Fn = function("MyFunc") + :echo Fn() +< *E704* *E705* *E707* +関数参照の変数名は、大文字、"s:"、"w:"、"t:"、"b:" のいずれかで始めなければな +らない。"g:" も使えるが、あとに続く名前は大文字で始めなければならない。関数参 +照と参照先の関数の名前を同じにすることはできない。 + +関数を定義して、それへの参照を直接辞書に入れるための特別な形式がある。例: > + :function dict.init() dict + : let self.val = 0 + :endfunction + +この辞書のキーは小文字で始めなければならない。実際の関数名はここでは使われない。 +|numbered-function|も参照。 + +|:call|コマンドでも関数参照を使うことができる: > + :call Fn() + :call dict.init() + +参照先の関数名は|string()|で得られる。 > + :let func = string(Fn) + +|call()|を使うと、リスト型の変数を引数として関数参照を呼び出すことができる: > + :let r = call(Fn, mylist) +< + *Partial* +関数参照は、辞書および/もしくは引数とバインドすることができる。これは部分適用 +(Partial)とも呼ばれる。これは、辞書および/もしくは引数を function() または +funcref() に渡すことで作成される。その関数を呼び出すと、その辞書および/もしく +は引数がその関数に渡される。例: > + + let Cb = function('Callback', ['foo'], myDict) + call Cb() + +これは、関数を以下のようにして呼び出す: > + call myDict.Callback('foo') + +これは関数を何かに渡す場合、例えば |ch_open()| の引数とする場合などに非常に有 +用である。 + +Note 関数の辞書へのバインドは、その関数が辞書のメンバーであるときにも発生する +ことに注意: > + + let myDict.myFunction = MyFunction + call myDict.myFunction() + +ここで、MyFunction() は myDict を "self" として受け取る。これは、"myFunction" +メンバーがアクセスされたときに起こる。"myFunction" を別の辞書 otherDict に代入 +して呼び出すと、それは otherDict にバインドされる: > + + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +今度は、"self" は "otherDict" になる。しかし、辞書を明示的にバインドしたときに +はこれは起こらない: > + + let myDict.myFunction = function(MyFunction, myDict) + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +ここでは、"self" は "myDict" である。なぜなら明示的にバインドされているからで +ある。 + + +1.3 リスト ~ + *list* *List* *Lists* *E686* +リストとは順序を保つ要素の列である。要素はどんな型でもよい。要素へはインデック +ス番号を使ってアクセスする。列の任意の位置に要素を追加したり削除することができ +る。 + + +リストの作成 ~ + *E696* *E697* +リストを作るには、[]の中にコンマで区切って要素を書く。 +例: > + :let mylist = [1, two, 3, "four"] + :let emptylist = [] + +要素はどんな式でもよい。要素としてリストを指定すると、リストのリストができる: +> + :let nestlist = [[11, 12], [21, 22], [31, 32]] + +最後の要素の後に余分なコンマがあると無視される。 + + +リストのインデックス ~ + *list-index* *E684* +リストの要素にアクセスするには、リスト名の後に[]を書き、その中にインデックスを +書く。インデックスは0基点(つまり最初の要素のインデックスは0)である。 > + :let item = mylist[0] " 最初の要素(1)を取得 + :let item = mylist[2] " 3番目の要素(3)を取得 + +取得した要素がリストならば、さらに続けてインデックスを書くことができる: > + :let item = nestlist[0][1] " 最初のリストの2番目の要素(12)を取得 +< +負のインデックスを指定すると、リストの末尾から数えられる。インデックス-1は最後 +の要素を示し、-2は最後から2番目を指す > + :let last = mylist[-1] " 最後の要素("four")を取得 + +無効なインデックスによるエラーを回避するには関数|get()|を使う。するとインデッ +クスが無効な場合は、0かまたは自分で指定した既定値が返る: > + :echo get(mylist, idx) + :echo get(mylist, idx, "NONE") + + +リストの連結 ~ + +2つのリストを連結するには演算子 "+" を使う: > + :let longlist = mylist + [5, 6] + :let mylist += [7, 8] + +1個の要素を先頭または末尾に付け加えるには、[]で囲んでリストにして連結する。リ +ストの特定の要素を変更するには後述の|list-modification|を参照。 + + +部分リスト ~ + *sublist* +リストの一部分を取り出すには、[]の中に始点と終点のインデックスを書き、コロンで +区切る: > + :let shortlist = mylist[2:-1] " リスト[3, "four"]を得る + +始点のインデックスを省略すると0となる。終点のインデックスを省略すると-1となる > + :let endlist = mylist[2:] " 2番目から最後まで: [3, "four"] + :let shortlist = mylist[2:2] " 1個の要素からなるリスト: [3] + :let otherlist = mylist[:] " リストのコピーを作る + +終点のインデックスが始点のインデックスよりも前になってしまった場合は空リストと +なる。エラーメッセージは表示されない。 + +終点のインデックスがリストの長さより大きい場合は、長さ-1を指定したときと同じに +なる: > + :let mylist = [0, 1, 2, 3] + :echo mylist[2:8] " 結果: [2, 3] + +NOTE: mylist[s:e]と書くと変数 "s:e" をインデックスとして使ったと解釈される。 +":" の前に1文字の変数を使うときは十分注意すること。必要ならこのようにスペース +を入れるとよい: mylist[s : e]. + + +リストの同一性 ~ + *list-identity* +変数 "aa" がリストであり、それを別の変数 "bb" に代入したとすると、両方とも同じ +変数を参照するようになる。よってリスト "aa" を変更すると "bb" も変更される: > + :let aa = [1, 2, 3] + :let bb = aa + :call add(aa, 4) + :echo bb +< [1, 2, 3, 4] + +リストのコピーを作るには関数|copy()|を使う。前述の通り[:]を使ってもできる。こ +れは浅いコピーである。つまりリストの要素であるリストに変更を加えると、コピーさ +れたリスト内の同じ要素も変更される: > + :let aa = [[1, 'a'], 2, 3] + :let bb = copy(aa) + :call add(aa, 4) + :let aa[0][1] = 'aaa' + :echo aa +< [[1, aaa], 2, 3, 4] > + :echo bb +< [[1, aaa], 2, 3] + +完全に独立したコピーを作るには|deepcopy()|を使う。これは再帰的にリストの要素の +コピーを作る。ただし深さは100レベルまでである。 + +2つの変数が同じリストを指しているかは演算子 "is" で判定できる。"isnot" はその +逆である。一方、"==" は2つのリストが同じ値を持っているかを判定する。 > + :let alist = [1, 2, 3] + :let blist = [1, 2, 3] + :echo alist is blist +< 0 > + :echo alist == blist +< 1 + +Note リストの比較について注意: 2つのリストは、同じ長さを持ち、全要素が "==" の +意味で等しいとき、等しいとみなされる。ただ、1つ例外がある: 数値と文字列を比較 +するとそれらは異なるとみなされる。変数に対して "==" で比較したときに行われるよ +うな自動的な型変換は行われない。例: > + echo 4 == "4" +< 1 > + echo [4] == ["4"] +< 0 + +つまり、リストの比較は数値や文字列の比較よりも厳格である。単純な値もリストに入 +れることによりこの方法で比較することができる: > + + :let a = 5 + :let b = "5" + :echo a == b +< 1 > + :echo [a] == [b] +< 0 + + +リストのアンパック ~ + +リストの要素を個々の変数としてアンパックするには、[]の中に変数を書く: > + :let [var1, var2] = mylist + +変数の個数とリストの要素数が一致しないときはエラーになる。リストにある余分な要 +素をまとめて受け取るには、";" と受け取る変数名を書いておく: > + :let [var1, var2; rest] = mylist + +上の例は次とほぼ同じである: > + :let var1 = mylist[0] + :let var2 = mylist[1] + :let rest = mylist[2:] + +要素が 2 つしかないときでもエラーにはならない。"rest" は空リストになる。 + + +リストの変更 ~ + *list-modification* +リストの中の特定の要素を変更するには次のように|:let|を使う: > + :let list[4] = "four" + :let listlist[0][3] = item + +始点と終点を指定してリストの一部分を変更することができる。代入する値は、少なく +とも削除する範囲の要素数と同じ数だけ必要である: > + :let list[3:5] = [3, 4, 5] + +リストに要素を追加したり削除するには関数を使う。いくつか例を示す: > + :call insert(list, 'a') " 先頭に要素 'a' を挿入する + :call insert(list, 'a', 3) " 要素 'a' をlist[3]の前に挿入する + :call add(list, "new") " 文字列の要素を最後に追加する + :call add(list, [1, 2]) " 1個の要素としてリストを追加する + :call extend(list, [1, 2]) " 2個の要素からなるリストを連結する + :let i = remove(list, 3) " 要素3を削除する + :unlet list[3] " 同上 + :let l = remove(list, 3, -1) " 要素3から最後までを削除する + :unlet list[3 : ] " 同上 + :call filter(list, 'v:val !~ "x"') " 要素 'x' を削除 + +要素の順番を変更する: > + :call sort(list) " リストをアルファベット順にソート + :call reverse(list) " 要素の順序を反転させる + :call uniq(sort(list)) " ソートして重複を削除する + + +for ループ ~ + +|:for|ループは、1つの変数に対してリストの各要素を順番に代入し、コマンドを実行 +していく。例: > + :for item in mylist + : call Doit(item) + :endfor + +上の例は次と同じ: > + :let index = 0 + :while index < len(mylist) + : let item = mylist[index] + : :call Doit(item) + : let index = index + 1 + :endwhile + +やりたいことがリストの各要素を変更するだけなら、forループを使うより関数|map()| +を使った方がよりシンプルになる。 + +|:let|コマンドと同じように、|:for|は変数のリストをループ変数にすることができる。 +この場合、引数はリストのリストでなければならない。 > + :for [lnum, col] in [[1, 3], [2, 8], [3, 0]] + : call Doit(lnum, col) + :endfor + +これはリストの各要素に対して|:let|コマンドを実行するかのように実行される。また +この場合も引数の型は全て同じでないとエラーになる。 + +引数の残りを1個のリスト変数に代入することもできる: > + :for [i, j; rest] in listlist + : call Doit(i, j) + : if !empty(rest) + : echo "remainder: " . string(rest) + : endif + :endfor + + +リスト操作関数 ~ + *E714* +以下はリスト操作に使える関数である: > + :let r = call(funcname, list) " 引数リストをつけて関数を呼び出す + :if empty(list) " リストが空かどうか判定する + :let l = len(list) " リストの要素数 + :let big = max(list) " リスト中の最大値 + :let small = min(list) " リスト中の最小値 + :let xs = count(list, 'x') " 'x' の出現回数を数える + :let i = index(list, 'x') " 最初に 'x' が現れる位置のインデックス + :let lines = getline(1, 10) " バッファから10行を取得 + :call append('$', lines) " バッファに行を追加する + :let list = split("a b c") " 文字列を分割してリストにする + :let string = join(list, ', ') " リストの要素を連結して文字列にする + :let s = string(list) " リストの文字列表現 + :call map(list, '">> " . v:val') " 各要素の前に ">> " をつける + +機能を組み合わせると、処理を単純に記述できることを覚えておくとよい。例えば、リ +スト中の全ての数値の和を求める例: > + :exe 'let sum = ' . join(nrlist, '+') + + +1.4 辞書 ~ + *dict* *Dictionaries* *Dictionary* +辞書とは連想配列である。各要素はキーと値を持つ。要素はキーによって特定できる。 +要素は特に順序を持たずに保持される。 + + +辞書の作成 ~ + *E720* *E721* *E722* *E723* +辞書を作るには、{}の中にコンマで区切って要素を書く。各要素のキーと値はコロンで +区切る。それぞれのキーは1度しか現れてはならない。例: > + :let mydict = {1: 'one', 2: 'two', 3: 'three'} + :let emptydict = {} +< *E713* *E716* *E717* +キーは必ず文字列である。数値を使うこともできるが、自動的に文字列に変換される。 +よって文字列 '4' のキーと数値4のキーは同一の要素を参照する。 +Note 文字列 '04' と数値04は異なることに注意。なぜなら数値04は文字列 '4' に変換 +されるからである。空文字列もキーとして使用できる。 + +値はどんな式でもよい。辞書を値にすると、ネストした辞書ができる: > + :let nestdict = {1: {11: 'a', 12: 'b'}, 2: {21: 'c'}} + +最後の要素の後に余分なコンマがあると無視される。 + + +要素にアクセスする ~ + +通常、要素にアクセスするには[]の中にキーを書く: > + :let val = mydict["one"] + :let mydict["four"] = 4 + +また、この書き方で既存の辞書に要素を追加できる。この点はリストと異なる。 + +キー名がアルファベット、数字、アンダースコアだけからなる場合は、以下の形式が使 +える|expr-entry|: > + :let val = mydict.one + :let mydict.four = 4 + +要素はリストや辞書を含むどんな型でもよいため、インデックス参照とキー参照を続け +て書くことができる: > + :echo dict.key[idx].key + + +辞書からリストへの変換 ~ + +辞書の全要素に対してループを行いたい場合がある。そのためには辞書をリストに変換 +し、そのリストに対して|:for|ループを行う。 + +多くの場合はキーに対してループを行う。これには関数|keys()|を使う: > + :for key in keys(mydict) + : echo key . ': ' . mydict[key] + :endfor + +このキーのリストはソートされていない。ソートさせるには関数|sort()|を使う: > + :for key in sort(keys(mydict)) + +値に対してループを行うには関数|values()|を使う: > + :for v in values(mydict) + : echo "value: " . v + :endfor + +キーと値両方を得るには関数|items()|を使う。この関数は、キーと値の2個の要素から +なるリストのリストを返す: > + :for [key, value] in items(mydict) + : echo key . ': ' . value + :endfor + + +辞書の同一性 ~ + *dict-identity* +辞書のコピーを作るにはリストと同様に|copy()|と|deepcopy()|を使う必要がある。そ +うでなく代入を行うと同一の辞書を参照するようになる: > + :let onedict = {'a': 1, 'b': 2} + :let adict = onedict + :let adict['a'] = 11 + :echo onedict['a'] + 11 + +2つの辞書は、全てのキー・値のペアが等しいとき等しいとみなされる。より詳しくは +|list-identity|を参照。 + + +辞書の変更 ~ + *dict-modification* +辞書の要素を変更したり、新しい要素を追加するには|:let|を使う: > + :let dict[4] = "four" + :let dict['one'] = item + +辞書から要素を取り除くには|remove()|か|:unlet|を使う。以下のように辞書からキー +"aaa" を取り除くには3つの方法がある: > + :let i = remove(dict, 'aaa') + :unlet dict.aaa + :unlet dict['aaa'] + +2つの辞書を併合させるには|extend()|を使う: > + :call extend(adict, bdict) +上のコマンドはbdictの全ての要素をadictに追加する。キーが重複した要素はbdictの +要素により上書きされる。この動作は3番目の引数により変更できる。 +Note 辞書の要素間に順序は定まっていない。そのため ":echo adict" としたとき、も +ともとadictにあった要素が先に、bdictから追加された要素が後に表示されると考えて +はならない。 + +辞書から条件を指定して要素を取り除くには|filter()|が使える: > + :call filter(dict, 'v:val =~ "x"') +このコマンドは "dict" から 'x' にマッチしない要素を全て取り除く。 + + +関数を辞書に入れる ~ + *Dictionary-function* *self* *E725* *E862* +関数が "dict" 属性つきで定義されると、特殊な方法で呼び出すことができる。例: > + :function Mylen() dict + : return len(self.data) + :endfunction + :let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} + :echo mydict.len() + +これはオブジェクト指向プログラミングのメソッドに似ている。この辞書の要素は +|Funcref|である。暗黙に定義されるローカル変数 "self" は、この関数を呼び出した +辞書を参照している。 + +"dict" 属性をつけないでFuncrefを辞書に入れることもできる。しかしその場合、変 +数 "self" は定義されない。 + + *numbered-function* *anonymous-function* +関数に名前をつける必要をなくすために、関数を定義して直接辞書に代入することがで +きる: > + :let mydict = {'data': [0, 1, 2, 3]} + :function mydict.len() + : return len(self.data) + :endfunction + :echo mydict.len() + +こうすると関数に番号がふられ、dict.lenがこの関数を参照する|Funcref|となる。こ +の関数は|Funcref|を通してのみ呼び出せる。参照している|Funcref|がなくなると、こ +の関数は自動的に削除される。 + +番号付き関数には "dict" 属性を付ける必要はない。 + +番号付き関数でエラーが発生したときは、あるトリックを使うことで発生源を確認でき +る。例えば 42 という関数なら次のようにする: > + :function {42} + + +辞書操作関数 ~ + *E715* +以下は辞書操作に使える関数である: > + :if has_key(dict, 'foo') " 辞書がキー "foo" の要素を持つなら真 + :if empty(dict) " 辞書が空なら真 + :let l = len(dict) " 辞書の要素数 + :let big = max(dict) " 辞書中の最大値 + :let small = min(dict) " 辞書中の最小値 + :let xs = count(dict, 'x') " 'x' の出現回数を数える + :let s = string(dict) " 辞書の文字列表現 + :call map(dict, '">> " . v:val') " 各要素の前に ">> " をつける + + +1.5 変数について補足 ~ + *more-variables* + +変数や式の結果の型を知りたいのならば、関数|type()|を使う。 + +オプション 'viminfo' にフラグ '!' が含まれるならば、大文字で始まり小文字を含ま +ない名前のグローバル変数は、viminfoファイル|viminfo-file|に格納される。 + +オプション 'sessionoptions' が "global" を含むなら、大文字で始まり少なくとも一 +文字以上の小文字を含む名前のグローバル変数は、sessionファイル|session-file|に +格納される。 + +変数名 何処に保存されるか ~ +my_var_6 されない +My_Var_6 sessionファイル +MY_VAR_6 viminfoファイル + + +波括弧を使って変数名を構成できる。詳細は|curly-braces-names|を参照。 + +============================================================================== +2. 式の文法 *expression-syntax* + +式文法一覧、優先順位の低いものから高い順に: + +|expr1| expr2 + expr2 ? expr1 : expr1 if-then-else 条件式 + +|expr2| expr3 + expr3 || expr3 .. 論理和 + +|expr3| expr4 + expr4 && expr4 .. 論理積 + +|expr4| expr5 + expr5 == expr5 等しい + expr5 != expr5 等しくない + expr5 > expr5 より大きい + expr5 >= expr5 大きいか等しい + expr5 < expr5 より小さい + expr5 <= expr5 小さいか等しい + expr5 =~ expr5 正規表現にマッチする + expr5 !~ expr5 正規表現にマッチしない + + expr5 ==? expr5 文字列として等しい(大文字/小文字区別無し) + expr5 ==# expr5 文字列として等しい(大文字/小文字区別有り) + etc. 上記の各式は大小文字の区別を、?を付加すると行 + わず、#を付加すると行う + + expr5 is expr5 同一の |List| のインスタンス + expr5 isnot expr5 異なる |List| のインスタンス + +|expr5| expr6 + expr6 + expr6 .. 足し算またはリストの連結 + expr6 - expr6 .. 引き算 + expr6 . expr6 .. 文字列の連結 + +|expr6| expr7 + expr7 * expr7 .. 掛け算 + expr7 / expr7 .. 割り算 + expr7 % expr7 .. 剰余(割った余り) + +|expr7| expr8 + ! expr7 論理否定 + - expr7 単項のマイナス {訳注: -1等} + + expr7 単項のプラス + +|expr8| expr9 + expr8[expr1] 文字列のバイト、またはリストの要素 + expr8[expr1 : expr1] 文字列の部分文字列、またはリストの部分リスト + expr8.name 辞書 |Dictionary| の要素 + expr8(expr1, ...) |Funcref| 変数による関数呼び出し + +|expr9| number 数定数 + "string" 文字列定数。バックスラッシュは特別な意味を持つ + 'string' リテラル文字列定数。'を含めるには2重にする + [expr1, ...] リスト |List| + {expr1: expr1, ...} 辞書 |Dictionary| + &option オプション変数 + (expr1) 式の入れ子 + variable 内部変数 + va{ria}ble 波括弧付きの内部変数 + $VAR 環境変数 + @r レジスタ 'r' の値 + function(expr1, ...) 関数呼出し + func{ti}on(expr1, ...) 波括弧付きの関数呼出し + {args -> expr1} ラムダ式 + +".." はその演算が、その後に他の演算を続ける事ができることを示している。 +例: > + &nu || &list && &shell == "csh" + +一つのレベルにある全ての式は左から右に解釈される。 + + +expr1 *expr1* *E109* +----- + +expr2 ? expr1 : expr1 + +'?' より前の式は数値として評価される。その結果が|TRUE|であった場合、'?' と ':' +に挟まれた式の値がこの式全体の値となり、そうでなかった場合は ':' 以降の式の値 +が全体の値となる。 +例: > + :echo lnum == 1 ? "先頭" : lnum + +始めの式が "expr2" であるから、そこに別の?:を含むことはできない。残り二つの式 +については以下のように再帰的な?:の利用が許される。 +例: > + :echo lnum == 1 ? "top" : lnum == 1000 ? "last" : lnum + +読み易くするために、行継続|line-continuation|を利用することが推奨される: > + :echo lnum == 1 + :\ ? "top" + :\ : lnum == 1000 + :\ ? "last" + :\ : lnum + +':' の前には必ずスペースを入れること。そうでないと "a:1" のような変数の使用と +間違えてしまう可能性がある。 + + +expr2 and expr3 *expr2* *expr3* +--------------- + +expr3 || expr3 .. 論理和 *expr-barbar* +expr4 && expr4 .. 論理積 *expr-&&* + +演算子 "||" と "&&" は左右に一つずつ引数を取る。引数は数値に変換される。結果は: + + 入力 出力 ~ +n1 n2 n1 || n2 n1 && n2 ~ +|FALSE| |FALSE| |FALSE| |FALSE| +|FALSE| |TRUE| |TRUE| |FALSE| +|TRUE| |FALSE| |TRUE| |FALSE| +|TRUE| |TRUE| |TRUE| |TRUE| + +演算子は続けて書く事ができる。例: > + + &nu || &list && &shell == "csh" + +Note "&&" は "||" よりも高い優先順位を持っている。これは次の事を意味する: > + + &nu || (&list && &shell == "csh") + +結果が確定した時点で残りの式は省略され、解釈されない。これはC言語で行われるこ +とに似ている。例: > + + let a = 1 + echo a || b + +これはaが|TRUE|であるため、変数bが宣言されていなくても有効であり、結果は絶対 +に|TRUE|である。次のも同様に: > + + echo exists("b") && b == "yes" + +これもbが宣言されているいないに関わらず有効である。後半の項はbが定義されている +時にだけ評価される。 + + +expr4 *expr4* +----- + +expr5 {cmp} expr5 + +2つの式expr5を比較し、結果が偽なら0を、真なら1を返す。 + + *expr-==* *expr-!=* *expr->* *expr->=* + *expr-<* *expr-<=* *expr-=~* *expr-!~* + *expr-==#* *expr-!=#* *expr->#* *expr->=#* + *expr-<#* *expr-<=#* *expr-=~#* *expr-!~#* + *expr-==?* *expr-!=?* *expr->?* *expr->=?* + *expr- ># >? +より大きいか等しい >= >=# >=? +より小さい < <# + if get(Part1, 'name') == get(Part2, 'name') + " Part1 と Part2 は同じ関数を指している + +リスト (|List|) や 辞書 (|Dictionary|) に対して "is" や "isnot" を使うと、それ +らの式が同じリストのインスタンスを参照しているか判定される。リストのコピーと元 +のリストは異なると判定される。リスト以外に対して "is" は "equal" と同じで、 +"isnot" は "not equal" と同じである。ただし "is"、"isnot" は型が異なると値が等 +しくない点が "==" とは異なる。 > + echo 4 == '4' + 1 + echo 4 is '4' + 0 + echo 0 is [] + 0 +"is#"/"isnot#" と "is?"/"isnot?" は大文字小文字を区別するかどうかが違う。 + +文字列と数値を比較した場合、文字列が数値に変換され、数値として比較される。これ +は以下のようになることを意味する: > + echo 0 == 'x' + 1 +なぜなら、'x' は数値のゼロに変換されるからである。しかし、 > + echo [0] == ['x'] + 0 +リストや辞書の中ではこの変換は行われない。 + +文字列同士を比較した場合、strcmp()やstricmp()によって比較される。これは数値的 +に(バイトの値で)比較されるのであって、必ずしも言語に基づく文字種の違いではな +い。 + +'#' を付けた演算子を使うか、省略形かつ 'ignorecase' が設定されていない場合、比 +較はstrcmp()で行われる。大文字・小文字は区別される。 + +'?' を付けた演算子を使うか、省略形かつ 'ignorecase' が設定されている場合、比較 +はstricmp()で行われる。大文字・小文字は区別されない。 + +'smartcase' は適用されない。 + +"=~" と "!~" 演算子は右側の引数を正規表現のパターンとして、左側の引数に対して +マッチを試みる。正規表現のパターンに関しては|pattern|を参照。このマッチは +'magic' が設定され 'cpoptions' が空であるように振舞い、実際の 'magic' や +'cpoptions' に何が設定されているには依存しない。これがスクリプトをポータブルに +してくれる。正規表現中のバックスラッシュが重複してしまうのを避けるには、シング +ルクォーテーションの文字列を使用する。詳細は|literal-string|を参照。 +文字列は単一行として扱われるので、複数行のパターン(\nを含むもの)はマッチしな +い。しかしながらリテラルなヌル文字(NL)を、普通の文字として代用することはでき +る。例: + "foo\nbar" =~ "\n" 1として評価される + "foo\nbar" =~ "\\n" 0として評価される + + +expr5 and expr6 *expr5* *expr6* +--------------- +expr6 + expr6 .. 足し算、またはリストの連結 *expr-+* +expr6 - expr6 .. 引き算 *expr--* +expr6 . expr6 .. 文字列の連結 *expr-.* + +リストに対しては "+" のみ可能で、expr6は両方ともリストでなければならない。結果 +は2つのリストを連結した新しいリスト。 + +expr7 * expr7 .. 掛け算 *expr-star* +expr7 / expr7 .. 割り算 *expr-/* +expr7 % expr7 .. 剰余(割った余り) *expr-%* + +"." を除く全ての演算子は自動的に文字列を数値に変換する。 +ビット演算については |and()|, |or()|, |xor()| を参照。 + +"+" と "." の違いに注意: + "123" + "456" = 579 + "123" . "456" = "123456" + +'.' は '+' と '-' と等しい優先順位を持つので、次の式は: > + 1 . 90 + 90.0 +次のように解釈される: > + (1 . 90) + 90.0 +これはエラーにならない。というのは、"190" は自動的に数値 190 に変換さ +れ、それと浮動小数点数 90.0 との和になる。しかし次の式は: > + 1 . 90 * 90.0 +次のように解釈される: > + 1 . (90 * 90.0) +'.' は '*' より優先順位が低いためである。これはエラーになる。というのは、浮動 +小数点数と文字列を結合することになるからである。 + +数値をゼロで割った結果は、被除数によって次のようになる: + 0 / 0 = -0x80000000 (浮動小数点数の NaN のようなもの) + >0 / 0 = 0x7fffffff (正の無限大のようなもの) + <0 / 0 = -0x7fffffff (負の無限大のようなもの) + {訳注: >0 は正の数、<0 は負の数の意味} + (Vim 7.2 以前では常に 0x7fffffff だった) + +64ビット数値が有効化されている場合は: + 0 / 0 = -0x8000000000000000 (浮動小数点数の NaN のようなもの) + >0 / 0 = 0x7fffffffffffffff (正の無限大のようなもの) + <0 / 0 = -0x7fffffffffffffff (負の無限大のようなもの) + +'%' の右辺(法)が0の場合、結果は0になる。 + +これらは全て|Funcref|には適用できない。 + +. と % は浮動小数点数には適用できない。 *E804* + + +expr7 *expr7* +----- +! expr7 論理否定 *expr-!* +- expr7 単項マイナス *expr-unary--* ++ expr7 単項プラス *expr-unary-+* + +'!' 演算子では|TRUE|は|FALSE|に、|FALSE|は|TRUE|になる。 +'-' では数値の符号が反転される。 +'+" では変化はない。 + +文字列はまず数値に変換される。 + +これら2つは繰り返したり混ぜたりできる。例: + !-1 == 0 + !!8 == 1 + --9 == 9 + + +expr8 *expr8* +----- +expr8[expr1] 文字列またはリストの要素 *expr-[]* *E111* + *E909* *subscript* +expr8が数値か文字列ならば、この値は文字列 expr8 の第 expr1 番目のバイトからな +る 1 バイトの文字列となる。expr8は文字列、expr1は数として扱われる。ただし +expr8 がマルチバイト文字列である場合、この値は単なるバイトコードであり、1文字 +とはならないかもしれないことに注意。マルチバイト文字列に対する代替方法は +`byteidx()` を参照するか、`split()`を使って文字列を文字のリストに変換すれば良 +い。 + +インデックスが0の場合、先頭のバイトが得られることに注意。これはC言語のように働 +く。注意:カラム番号は1から始まる。例えばカーソルの下のバイトを得るためには、次 +のようにする必要がある: > + :let c = getline(".")[col(".") - 1] + +文字列の長さよりも大きなインデックスが指定された場合、結果は空文字列になる。負 +数のインデックスを指定すると、結果は常に空文字列になる(後方互換性のため)。 +最後のバイトを得るには[-1:]を使うこと。 + +expr8がリスト|List|ならばインデックスexpr1の要素が返る。取りうるインデックスの +値については|list-index|を参照。インデックスが範囲を超えている場合はエラーとな +る。例: > + :let item = mylist[-1] " 最後の要素を取得 + +一般的には、インデックスが正でリストの長さ以上または、負でリストの長さ×-1より +小さいときエラーとなる。 + + +expr8[expr1a : expr1b] 部分文字列または部分リスト *expr-[:]* + +expr8が数値か文字列ならば、expr1aバイトからexpr1bバイトまでの部分文字列となる +(両端を含む)。expr8は文字列として扱われ、expr1aとexpr1bは数値として扱われる。 +Note マルチバイトのエンコーディングは認識しない。マルチバイト文字列のイン +デックスを計算する方法については |byteidx()| を参照。 + +expr1aが省略されたときは0となる。expr1bが省略されたときは文字列の長さ-1となる。 + +負数のインデックスを使うことによって文字列の末尾から取り出すことができる。-1は +最後の文字、-2は最後から2文字目…を表す。 + +インデックスがその文字の範囲外に出てしまったときは、その文字は省かれる。expr1b +がexpr1aより小さいときは空文字列となる。 + +例: > + :let c = name[-1:] " 文字列の最後のバイト + :let c = name[-2:-2] " 文字列の最後から2バイト目 + :let s = line(".")[4:] " 5バイト目から末尾まで + :let s = s[:-3] " 最後の2文字を削除する +< + *slice* +expr8がリストならば、インデックスexpr1aとexpr1bの間の要素からなる新しいリスト +となる。すぐ上で説明した文字列の場合と同様である。部分リスト|sublist|も参照の +こと。例: > + :let l = mylist[:3] " 最初の4個の要素 + :let l = mylist[4:4] " 1個の要素からなるリスト + :let l = mylist[:] " リストの浅いコピー + +|Funcref|に対してexpr8[expr1]やexpr8[expr1a : expr1b]を使うとエラーになる。 + +部分リストでスコープと変数に続くコロンとの混乱に注意してください: > + mylist[n:] " 変数nは使える + mylist[s:] " スコープs:を使うとエラー! + + +expr8.name 辞書|Dictionary|の要素 *expr-entry* + +expr8が辞書|Dictionary|のとき、ドットをつけるとその後に書かれた名前が辞書の +キーと見なされる。例: expr8[name]。 + +名前は変数名と同じようにアルファベットと数字だけから構成されなければならない +が、数字で始まってもよい。波括弧は使えない。 + +ドットの前後に空白があってはならない。 + +例: > + :let dict = {"one": 1, 2: "two"} + :echo dict.one + :echo dict .2 + +Note ドットは文字列連結にも使われる。混乱を避けるために、文字列連結のドットの +周りには必ずスペースを入れること。 + + +expr8(expr1, ...) |Funcref| 関数呼び出し + +expr8が|Funcref|型の変数のとき、その参照する関数を呼び出す。 + + + + *expr9* +数 +------ +number 数定数 *expr-number* + *hex-number* *octal-number* *binary-number* + +10進数、16進数(0xか0Xで始まる)、2進数(0bか0Bで始まる)、もしくは8進数(0で始まる) +の数定数。 + + *floating-point-format* +浮動小数点数は次の2つの形式で書ける: + + [-+]{N}.{M} + [-+]{N}.{M}[eE][-+]{exp} + +ここで {N} と {M} は数値である。{N} と {M} の両方とも省略してはならず、数値の +みを含めることができる。 +[-+] は、省略可能なプラスまたはマイナス記号である。 +{exp} は指数で、10 のベキ。 +現在のロケールが何であれ、小数点にはドットのみを使える。コンマは使えない。 +{|+float| 機能つきでコンパイルされたときのみ有効} + +例: + 123.456 + +0.0001 + 55.0 + -0.123 + 1.234e03 + 1.0E-6 + -3.1416e+88 + +次のものは無効である: + 3. {M} が空 + 1e40 .{M} がない + + *float-pi* *float-e* +コピー&ペーストしておくのに便利な値: > + :let pi = 3.14159265359 + :let e = 2.71828182846 + +論理的根拠: +浮動小数点数が導入される前は、123.456 と書くと 123 と 456 の2つの数値と解釈 +され、それらが文字列に変換されて結合されて "123456" という文字列になった。 +これは無意味であり、Vim script 内で意図的に使われているものが見つからなかった +ので、浮動小数点数の普通の表記法を用いるため、この後方非互換性は許容された。 + + *floating-point-precision* +浮動小数点数の精度と範囲は、Vim とリンクしたライブラリの "double" の意味によ +る。実行時にこれを変更することはできない。 + +浮動小数点数 |Float| は printf("%g", f) とするのと同様に、小数点以下6桁まで表 +示される。表示する桁数は |printf()| を使えば変えられる。例: > + :echo printf('%.15e', atan(1)) +< 7.853981633974483e-01 + + + +文字列 *string* *String* *expr-string* *E114* +------ +"string" 文字列定数 *expr-quote* + +ダブルクォートが使われていることに注意。 + +文字列定数には以下の特殊文字が使用できる: +\... 3桁の8進数字 (例 "\316") +\.. 2桁の8進数字 (非数字が続かなければならない) +\. 1桁の8進数字 (非数字が続かなければならない) +\x.. 2桁の16進数字 (例 "\x1f") +\x. 1桁の16進数字 (16進数字でないものが続かなければならない) +\X.. \x..に同じ +\X. \x.に同じ +\u.... 文字を4桁の16進数で表現したもので、実際の値は現在の 'encoding' の値に + 依存する (例えば "\u02a4") +\U.... \u と同じだが8桁までの16進数が使える +\b バックスペース +\e エスケープ +\f フォームフィード +\n 改行 +\r 改行(キャリッジリターン) +\t タブ +\\ 円記号(バックスラッシュ) +\" ダブルクォート +\ "xxx" という名の特殊キー。 例 "\" は CTRL-W。これはマップで使うた + めのものであり、0x80 バイトはエスケープされる。 + ダブルクォート文字を使う場合はエスケープしなければならない: "" + utf-8 文字を得るためには を使わずに、上述の \uxxxx を使う + こと。 + +Note "\xff" は値255の1バイトとなる。これはエンコーディングによっては無効な値か +もしれない。現在の 'encoding' の値に応じた文字255を得るには "\u00ff" を使う。 + +Note "\000" と "\x00" は強制的に文字列の終端として扱われる。 + + +リテラル文字列 *literal-string* *E115* +-------------- +'string' 文字列定数 *expr-'* + +Note シングルクォートが使われていることに注意。 + +この文字列は文字通りに扱われる。バックスラッシュは取り除かれないし、また特別な +意味を持ったりもしない。唯一の例外は、2つのシングルクォートで1つのシングル +クォートになることである。 + +シングルクォートの文字列は、バックスラッシュを2重にしなくてよいため、正規表現 +パターンを表すのに便利である。以下の2つのコマンドは同値である: > + if a =~ "\\s*" + if a =~ '\s*' + + +オプション *expr-option* *E112* *E113* +--------- +&option オプション変数、ローカルなものが優先 +&g:option グローバルオプション変数 +&l:option ローカルオプション変数 + +例: > + echo "タブストップは " . &tabstop . " です" + if &insertmode + +ここにはあらゆるオプション名を使うことができる。|options|を参照。ローカル変数 +を使おうとして、実際にはバッファローカルもウィンドウローカルも存在しない場合に +は、グローバル変数が利用される。 + + +レジスタ *expr-register* *@r* +-------- +@r レジスタ 'r' の値 + +名前付きレジスタの中身を1つの文字列として得る。必要なところには改行文字が挿入 +されている。無名レジスタの中身を取得するには@"か@@を使う。利用可能なレジスタの +説明については|registers|を参照。 + +レジスタ '=' を使うと、式の値でなく式そのものを得る。それを評価するには +|eval()|を使う。 + + +入れ子 *expr-nesting* *E110* +------- +(expr1) 式の入れ子 + + +環境変数 *expr-env* +-------- +$VAR 環境変数 + +環境変数の文字列。定義されていない環境変数を指定した場合、結果は空文字列。 + *expr-env-expand* +Note $VARを直接使用した場合とexpand("$VAR")を使用した場合では、動作に違いがあ +ることに注意。直接使用した場合には、現在のVimのセッション中で既知の値に展開さ +れるだけである。expand()を使用した場合、まず最初にVimのセッション中で既知の値 +に展開される。それが失敗した場合、変数の展開にシェルが使用されることになる。こ +れは遅くはなるが、シェルの知りうる全ての変数を展開することができる。例: > + :echo $shell + :echo expand("$shell") +最初の一つは恐らく何も返ってこず、2つ目は $shell の値が返ってくるだろう (貴方 +のシェルがそれをサポートしているなら) + + +内部変数 *expr-variable* +-------- +variable 内部変数 +以下の|internal-variables|を参照。 + + +関数呼出 *expr-function* *E116* *E118* *E119* *E120* +-------- +function(expr1, ...) 関数呼出 +以下の|functions|を参照。 + + +ラムダ式 *expr-lambda* *lambda* +-------- +{args -> expr1} ラムダ式 + +ラムダ式は、|expr1| を評価した結果を返す新しい無名関数を作成する。ラムダ式は以 +下の点がユーザー定義関数|user-functions|と異なる: + +1. ラムダ式の本体は単一の式|expr1|であり、|Ex|コマンド列ではない。 +2. 引数に前置詞 "a:" を使用しない。例: > + :let F = {arg1, arg2 -> arg1 - arg2} + :echo F(5, 2) +< 3 + +引数は任意である。例: > + :let F = {-> 'error function'} + :echo F() +< error function + *closure* +ラムダ式は外側のスコープの変数と引数にアクセスできる。これはよくクロージャと呼 +ばれる。以下の例ではラムダの中で "i" と "a:arg" が使われているが、これらは関数 +のスコープに存在する。これらは関数から抜けても有効であり続ける: > + :function Foo(arg) + : let i = 3 + : return {x -> x + i - a:arg} + :endfunction + :let Bar = Foo(4) + :echo Bar(6) +< 5 + +|:func-closure|も参照。ラムダとクロージャのサポートは以下のように判定できる: > + if has('lambda') + +|sort()|, |map()|, |filter()|とともにラムダ式を使う例: > + :echo map([1, 2, 3], {idx, val -> val + 1}) +< [2, 3, 4] > + :echo sort([3,7,2,1,4], {a, b -> a - b}) +< [1, 2, 3, 4, 7] + +ラムダ式は、チャンネル、ジョブ、タイマーを使う際にも有用である: > + :let timer = timer_start(500, + \ {-> execute("echo 'Handler called'", "")}, + \ {'repeat': 3}) +< Handler called + Handler called + Handler called + +Note Exコマンドを実行するためにどのように execute() を使っているかに注意。 +醜いが。 + + +ラムダ式は '42' のような内部名を持っている。もしラムダ式でエラーが発生 +した場合には、以下のコマンドでどのラムダ式でエラーが起きたかを調べることができ +る: > + :function {'42'} +|numbered-function|も参照。 + +============================================================================== +3. 内部変数 *internal-variables* *E461* + +内部変数の名前には文字と、数字とアンダーバー('_')を使うことができる。しかし数 +字で始めることはできない。波括弧を使うこともできる。 +詳細は|curly-braces-names|を参照。 + +内部変数は ":let" コマンドで作成される |:let|。":unlet" コマンドで明示的に内部 +変数を破棄することができる |:unlet|。内部変数に使われてない名前か、既に破棄さ +れた内部変数を使うとエラーとなる。 + +変数には幾つもの名前空間が存在する。実際にどれが利用されるかは、どのような前置 +子が使われたかで決まる: + + (無し) 関数の中では関数ローカル、それ以外ではグローバル +|buffer-variable| b: 現在のバッファにローカル +|window-variable| w: 現在のウィンドウにローカル +|tabpage-variable| t: 現在のタブページにローカル +|global-variable| g: グローバル +|local-variable| l: 関数にローカル +|script-variable| s: |:source|されたVim scriptにローカル +|function-argument| a: 関数の引数(関数内のみ) +|vim-variable| v: グローバル、Vimがあらかじめ定義 + +これらのスコープそのものに辞書を通じてアクセスできる。例えば、全てのスクリプト +ローカル変数を削除するには次のようにする: > + :for k in keys(s:) + : unlet s:[k] + :endfor +< + *buffer-variable* *b:var* *b:* +"b:" で始まる変数名は、カレントバッファに局所的な変数を意味する。このように一 +つ一つのバッファ毎に、変数 "b:foo" を別々に使用することができる。この種の変数 +はバッファが掃除(wipe out)された時や、":bdelete" で削除された時に一緒に削除さ +れる。 + +1つのバッファローカル変数が定義済: + *b:changedtick* *changetick* +b:changedtick 現在のバッファに対する総変更の回数。変更を行うたびに増加する。 + これには一回のアンドゥ操作もカウントされる。この変数はバッファ + に変更が行われた際にだけアクションを起こしたい時に利用できる。 + 例: > + :if my_changedtick != b:changedtick + : let my_changedtick = b:changedtick + : call My_Update() + :endif +< b:changedtick 変数を変更したり削除することはできない。 + + *window-variable* *w:var* *w:* +"w:" で始まる変数名は、カレントウィンドウにローカルな変数を意味する。これはウィ +ンドウを閉じるときに破棄される。 + + *tabpage-variable* *t:var* *t:* +"t:" で始まる変数名は、カレントタブページにローカルな変数を意味する。これはタ +ブページを閉じるときに破棄される。{|+windows| 機能つきでコンパイルしたときのみ +利用可能} + + *global-variable* *g:var* *g:* +関数の中からグローバル変数へアクセスするには、"g:" を付けた名前を使用する。こ +れが省略された場合は関数ローカルな変数にアクセスする。ただし "g:" 自体は、関数 +の外でも使うことができる。 + + *local-variable* *l:var* *l:* +関数の中からそのローカル変数にアクセスするには何も前置しなければ良い。明示的 +に "l:" を付けることも可能である。ただし "l:" をつけないと予約されている変数名 +と衝突してしまうことがある。例: "count" とすると "v:count" を参照してしまう。 +"l:count" とすればローカル変数countを参照できる。 + + *script-variable* *s:var* +Vim script 内では "s:" で始まる変数名を使うことができる。これはスクリプトに +ついてローカルであり、スクリプトの外部からはアクセスできない。 + +スクリプト変数は次の場所で使える: +- そのスクリプトをsourceしている間に実行されるコマンド +- そのスクリプト内で定義される関数 +- そのスクリプト内で定義されるオートコマンド +- そのスクリプト内で定義される関数やオートコマンドで定義される関数やオートコマ + ンド(再帰的) +- そのスクリプト内で定義されるユーザー定義コマンド +次の場面では使えない: +- そのスクリプトからsourceされる他のスクリプト +- マッピング +- メニュー +- など。 + +グローバル変数との衝突を避けるにはスクリプト変数を使う。 +次の例を参照: > + + let s:counter = 0 + function MyCounter() + let s:counter = s:counter + 1 + echo s:counter + endfunction + command Tick call MyCounter() + +ここで他のスクリプトから "Tick" を実行してみると、そのスクリプト内の変数 +"s:counter" は変化せず、"Tick" が定義されたスクリプト内の "s:counter" だけが変 +化する。 + +これと同じことをするもう1つの例: > + + let s:counter = 0 + command Tick let s:counter = s:counter + 1 | echo s:counter + +関数呼び出しやユーザー定義コマンドを実行するとき、スクリプト変数のコンテキスト +はその関数、コマンドが定義されたスクリプトとなる。 + +関数の中で関数を定義した場合、スクリプト変数も共有される。例: > + + let s:counter = 0 + function StartCounting(incr) + if a:incr + function MyCounter() + let s:counter = s:counter + 1 + endfunction + else + function MyCounter() + let s:counter = s:counter - 1 + endfunction + endif + endfunction + +このStartCounting()を呼ぶと、カウントアップかカウントダウンのどちらかを行う関 +数MyCounter()を定義する。StartCounting()がどこで呼ばれたかに関係なく、 +MyCounter()の中では変数s:counterにアクセスできる。 + +同じスクリプトが再度読み込まれた場合、同一のスクリプト変数が使われる。スクリプ +ト変数はVimが終了するまで存続する。以下の例はカウンタを保持する: > + + if !exists("s:counter") + let s:counter = 1 + echo "script executed for the first time" + else + let s:counter = s:counter + 1 + echo "script executed " . s:counter . " times now" + endif + +Note これはつまり、ファイルタイププラグインはバッファごとにスクリプト変数を1セッ +ト持つのではないということを意味する。そのような目的にはバッファローカル変数 +|b:var|を使うこと。 + + +Vimの定義済変数: *vim-variable* *v:var* *v:* + + *v:beval_col* *beval_col-variable* +v:beval_col マウスポインタがある桁の桁番号。|v:beval_lnum|行目のバイトイン + デックスである。オプション 'balloonexpr' を評価している最中の + み有効。 + + *v:beval_bufnr* *beval_bufnr-variable* +v:beval_bufnr マウスポインタがあるバッファの番号。オプション 'balloonexpr' + を評価している最中のみ有効。 + + *v:beval_lnum* *beval_lnum-variable* +v:beval_lnum マウスポインタがある行の行番号。オプション 'balloonexpr' を + 評価している最中のみ有効。 + + *v:beval_text* *beval_text-variable* +v:beval_text マウスポインタの下もしくは後ろにあるテキスト。Cプログラムのデ + バッグのために有用。'iskeyword' が適用されるが、マウスポインタ + の下より前にあるドットと "->" は含まれる。マウスポインタが ']' + の上にあるときは、そこから対応する '[' とその前にあるテキスト + までが含まれる。マウスポインタが1行に収まるビジュアル領域の上 + にあるときはその選択領域となる。オプション 'balloonexpr' を評 + 価している最中のみ有効。 + + *v:beval_winnr* *beval_winnr-variable* +v:beval_winnr マウスポインタがあるウィンドウの番号。オプション 'balloonexpr' + を評価している最中のみ有効。1番目のウィンドウの番号はゼロであ + る(他の場所でのウィンドウ番号と異なっている)。 + + *v:beval_winid* *beval_winid-variable* +v:beval_winid マウスポインタがあるウィンドウのウィンドウID |window-ID|。 + それ以外は v:beval_winnr と同様。 + + *v:char* *char-variable* +v:char 'formatexpr' を評価しているときの引数。また、短縮入力 + |:map-| で を指定しているとき、タイプされた文字を + 保持する。 + これは |InsertCharPre| と |InsertEnter| イベントでも使われる。 + + *v:charconvert_from* *charconvert_from-variable* +v:charconvert_from + 変換しようとしているファイルの文字エンコーディング名。オプショ + ン 'charconvert' を評価している最中のみ有効。 + + *v:charconvert_to* *charconvert_to-variable* +v:charconvert_to + 変換後のファイルの文字エンコーディング名。オプション + 'charconvert' を評価している最中のみ有効。 + + *v:cmdarg* *cmdarg-variable* +v:cmdarg 2つの目的のために使われる: + 1. ファイルの読み書きコマンドに与えられる余分な引数。現在のと + ころ "++enc=" と "++ff=" がそれである。読み書きコマンドに対 + するオートコマンドイベントが発生する前にこの変数が代入され + る。その読み書きコマンドの後に直接この変数を連結できるよう + に、先頭にスペースがついている。Note: ここには "+cmd" 引数 + は含まれていない。どちらにしろそれは実行されるからである。 + 2. ":hardcopy" でPostScriptファイルを印刷するとき、これが + ":hardcopy" への引数になる。'printexpr' の中で使うことがで + きる。 + + *v:cmdbang* *cmdbang-variable* +v:cmdbang v:cmdargと同じく読み書きコマンドを実行したとき設定される。読み + 書きコマンドに "!" が使われたときは1となり、使われていなければ + 0となる。Note オートコマンドの中でのみ利用可能なことに注意。 + ユーザー定義コマンドでは||を使えば同じことができる。 + + *v:completed_item* *completed_item-variable* +v:completed_item + 最も最近補完された単語が含まれた|complete-items|の|Dictionary| + が|CompleteDone|イベント後に設定される。補完に失敗した時、その + |Dictionary|は空である。 + + *v:count* *count-variable* +v:count 最後に実行されたノーマルモードコマンドに渡されたコマンドの実行 + 回数を返す。読出し専用。使用例: > + :map _x :echo "the count is " . v:count +< Note: は、カウントの後に ':' をタイプした時に示される行範 + 囲指定を削除するために必要となる。 + "3d2w" のようにカウントが2個指定された場合、その数が掛けられる。 + よって "d6w" となる。 + オプション 'formatexpr' を評価するためにも使われる。 + また "count" は、以前の版のVimとの互換性の為に動作する。 + + *v:count1* *count1-variable* +v:count1 "v:count" と同じように、しかしカウントが指定されなかった時の省 + 略値として存在する。 + + *v:ctype* *ctype-variable* +v:ctype 文字に関する実行環境の現在のロケール設定。これを使えばVim + script内で現在のロケール設定に対応できるようになる。技術的な詳 + 細: LC_CTYPEに等しい。ロケールを使用していないときは "C"になる。 + この変数を設定するには|:language|コマンドを使うこと。直接設定 + することはできない。 + |multi-lang|を参照。 + + *v:dying* *dying-variable* +v:dying 通常時は0。致命的なシグナルを受信したとき1が代入される。複数 + のシグナルを受信すると値が増加していく。オートコマンド内でVim + が正常に終了するかチェックするために使える。{Unix でのみ動作} + 例: > + :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif + +< Note: v:dying が 1 のときに別の致命的なシグナルを受信した場合 + は VimLeave 自動コマンドは実行されない。 + + *v:errmsg* *errmsg-variable* +v:errmsg 最後に表示されたエラーメッセージ。この変数は代入することが許 + されている。例: > + :let errmsg = "" + :next + :if (errmsg != "") + : ... +< また "errmsg" は、以前の版のVimとの互換性の為に動作する。 + + *v:errors* *errors-variable* +v:errors |assert_true()|のような、テスト用関数によって見つかったエラー。 + これは文字列のリストである。 + テスト用関数はテストに失敗した時にエラーを末尾に追加する。 + 古い結果を削除する方法はこの変数を空にする: > + :let v:errors = [] +< たとえ|v:errors| にリスト以外のいかなる値をセットしたとしても、 + (次に実行される時に)テスト用関数によって空のリストが設定(上書 + き)される。 + + *v:exception* *exception-variable* +v:exception 最も直近に捕捉され、まだ終了していない例外の値。 + |v:throwpoint|と|throw-variables|を参照。 + 例: > + :try + : throw "oops" + :catch /.*/ + : echo "caught" v:exception + :endtry +< 出力: "caught oops". + + *v:false* *false-variable* +v:false 数値0。JSONでは "false" として使われる。|json_encode()|を参照。 + 文字列として使われた時、これは "v:false" として評価される。 > + echo v:false +< v:false ~ + これは eval() がその文字列をパースしたときに、元の値に戻せるよ + うにするためである。読出し専用。 + + *v:fcs_reason* *fcs_reason-variable* +v:fcs_reason |FileChangedShell|イベントが発生した理由。オートコマンドの中で + 何をすべきかやv:fcs_choiceに何を代入すべきかを決めるために使う。 + 値は次のどれかとなる: + deleted もはやファイルが存在しない + conflict ファイルの内容、モード、タイムスタンプ + が変化しており、バッファが変更されてい + る状態。 + changed ファイルの内容が変化している + mode ファイルのモードが変化している + time タイムスタンプだけが変化している + + *v:fcs_choice* *fcs_choice-variable* +v:fcs_choice |FileChangedShell|イベントが発生した後に何をすべきかを表す。 + オートコマンドの中で、そのバッファに対して何をすべきかを指示す + るために使う。 + reload バッファを読み直す(バッファが削除され + ている場合には効果がない)。 + ask 何をすべきかをユーザーに問い合わせる。 + これはこのオートコマンドがない場合と同 + じである。ただしタイムスタンプだけが変 + 化しているときは何もしない。 + 何もしない。オートコマンドの中だけで必 + 要なことは全て行ってしまっているという + 場合にこの値を代入する。 + 既定値は。これら以外の(無効な)値が代入されたときは空の + ときと同じ動作になり、警告メッセージは表示されない。 + + *v:fname_in* *fname_in-variable* +v:fname_in 入力ファイルの名前。以下のオプションを評価している最中のみ + 有効: + オプション このファイル名の意味 ~ + 'charconvert' 変換するファイル + 'diffexpr' 元のファイル + 'patchexpr' 元のファイル + 'printexpr' 印刷するファイル + また、オートコマンドイベント|SwapExists|が発生したときスワップ + ファイル名が代入される。 + + *v:fname_out* *fname_out-variable* +v:fname_out 出力ファイルの名前。以下のオプションを評価している最中のみ + 有効: + オプション このファイル名の意味 ~ + 'charconvert' 変換した結果のファイル (*) + 'diffexpr' diffの出力 + 'patchexpr' パッチを当てた結果のファイル + (*) 書き込みコマンド(":w file" など)を実行する際の変換では + v:fname_inと同じになる。読み込みコマンド(":e file" など)を実行 + する際の変換では一時ファイル名になり、v:fname_inと異なる。 + + *v:fname_new* *fname_new-variable* +v:fname_new 新しい方のファイル名。'diffexpr' を評価している最中のみ有効。 + + *v:fname_diff* *fname_diff-variable* +v:fname_diff diff(patch)ファイルの名前。'patchexpr' を評価している最中のみ + 有効。 + + *v:folddashes* *folddashes-variable* +v:folddashes 'foldtext' 用。閉じた折り畳みのレベルを表すダッシュ。 + サンドボックス|sandbox|の中では読出し専用。|fold-foldtext| + + *v:foldlevel* *foldlevel-variable* +v:foldlevel 'foldtext' 用。閉じた折り畳みのレベル。 + サンドボックス|sandbox|の中では読出し専用。|fold-foldtext| + + *v:foldend* *foldend-variable* +v:foldend 'foldtext' 用。閉じた折り畳みの最後の行。 + サンドボックス|sandbox|の中では読出し専用。|fold-foldtext| + + *v:foldstart* *foldstart-variable* +v:foldstart 'foldtext' 用。閉じた折り畳みの最初の行。 + サンドボックス|sandbox|の中では読出し専用。|fold-foldtext| + + *v:hlsearch* *hlsearch-variable* +v:hlsearch 検索による強調表示がオンになっているかどうかを示す変数。 + 設定は |+extra_search| 機能が必要な 'hlsearch' が有効になって + いる時のみ意味をなす。この変数を0に設定することは、 + |:nohlsearch|コマンドを実行することと同様に働き、1に設定するこ + とは以下と同様に働く > + let &hlsearch = &hlsearch +< 関数から戻ったときに値が復元されることに注意すること。 + |function-search-undo| + + *v:insertmode* *insertmode-variable* +v:insertmode オートコマンドイベント|InsertEnter|と|InsertChange|用。 + 値は次のどれか: + i 挿入モード + r 置換モード + v 仮想置換モード + + *v:key* *key-variable* +v:key 辞書|Dictionary|の現在の要素のキー。|map()|と|filter()|で使わ + れる式を評価している最中のみ有効。 + 読出し専用。 + + *v:lang* *lang-variable* +v:lang メッセージに関する実行環境の現在のロケール設定。これを使えば + Vim script内で現在のロケール設定に対応できるようになる。 + 技術的な詳細: LC_MESSAGESに等しい。この値はシステムに依存する。 + この変数を設定するには|:language|コマンドを使うこと。直接設定 + することはできない。 + 文字エンコーディングに使うのと違う言語でメッセージを表示させた + い場合は|v:ctype|と異なる値でもよい。|multi-lang|を参照。 + + *v:lc_time* *lc_time-variable* +v:lc_time 時刻のメッセージに関する実行環境の現在のロケール設定。これを使 + えばVim script内で現在のロケール設定に対応できるようになる。 + 技術的な詳細: LC_TIMEに等しい。この値はシステムに依存する。こ + の変数を設定するには|:language|コマンドを使うこと。直接設定す + ることはできない。 + + *v:lnum* *lnum-variable* +v:lnum 'foldexpr' |fold-expr| と 'indentexpr' に使うための行番号。ま + た 'guitablabel' と 'guitabtooltip' の文脈ではタブページ番号に + なる。これらの式のどれかを評価しているときのみ有効。サンドボッ + クス |sandbox| の中では読出し専用。 + + *v:mouse_win* *mouse_win-variable* +v:mouse_win |getchar()|でマウスクリックイベントが発生したときのウィンドウ + 番号。|winnr()|と同じく番号は1から始まる。マウスがクリックされ + なかったときは0となる。 + + *v:mouse_winid* *mouse_winid-variable* +v:mouse_winid |getchar()|でマウスクリックイベントが発生したときのウィンドウ + ID。マウスがクリックされていないときは0になる。 + + *v:mouse_lnum* *mouse_lnum-variable* +v:mouse_lnum |getchar()|でマウスクリックイベントが発生したときの行番号。物 + 理行ではなく論理行。マウスがクリックされていないときは0となる。 + + *v:mouse_col* *mouse_col-variable* +v:mouse_col |getchar()|でマウスクリックイベントが発生したときの桁番号。 + |virtcol()|と同じく画面上の桁番号。マウスがクリックされていな + いときは0となる。 + + *v:none* *none-variable* +v:none 空の文字列。JSONでは空の要素として使われる。 + |json_encode()|を参照。 + 数値として使われた時、これは 0 として評価される。 + 文字列として使われた時、これは "v:none" として評価される。 > + echo v:none +< v:none ~ + これは eval() がその文字列をパースしたときに、元の値に戻せるよ + うにするためである。読出し専用。 + + *v:null* *null-variable* +v:null 空の文字列。JSONでは "null" として使われる。|json_encode()|を + 参照。数値として使われた時、これは 0 として評価される。 + 文字列として使われた時、これは "v:null" として評価される。 > + echo v:null +< v:null ~ + これは eval() がその文字列をパースしたときに、元の値に戻せるよ + うにするためである。読出し専用。 + + *v:oldfiles* *oldfiles-variable* +v:oldfiles 起動時に |viminfo| から読み込まれたファイルの名前のリスト。 + これらはマークを記憶しているファイルである。リストの長さの上限 + はオプション 'viminfo' の引数 ' によって決まる(既定では 100)。 + |viminfo| ファイルが使われていない時、リストは空となる。 + |:oldfiles| と |c_#<| を参照。 + このリストは変更可能であるが、後で |viminfo| ファイルに書き込ま + れるものには影響しない。文字列以外の値を使うと問題を引き起こす + だろう。 + {|+viminfo| 機能つきでコンパイルされたときのみ有効} + + *v:option_new* +v:option_new オプションに設定された新しい値。自動コマンド |OptionSet| を実 + 行している間のみ有効。 + *v:option_old* +v:option_old オプションの以前の値。自動コマンド |OptionSet| を実行している + 間のみ有効。 + *v:option_type* +v:option_type set コマンドのスコープ。自動コマンド |OptionSet| を実行している + 間のみ有効。"global" もしくは "local" のどちらかとなる。 + + *v:operator* *operator-variable* +v:operator ノーマルモードにおいて最後に実行したオペレータコマンド。基本的 + に1文字である。例外は で始まるコマンドで、その場合 + は2文字になる。|v:prevcount| と |v:register| と組み合わせて使う + とよい。オペレータ待機モードをキャンセルして、それからオペレー + タを使いたいときに便利である。例: > + :omap O :call MyMotion(v:operator) +< この値は他のオペレータが入力されるまでセットされてい + る。よって空になると期待してはいけない。 + |:delete|, |:yank| などの Ex コマンドに対しては v:operator は + セットされない。 + 読出し専用。 + + *v:prevcount* *prevcount-variable* +v:prevcount 最後のノーマルモードコマンドに与えられたカウントの値。前のコマ + ンドのv:countの値である。ビジュアルモードやオペレータ待機モー + ドをキャンセルし、その後にカウントを使う場合に便利である。 + 例: > + :vmap % :call MyFilter(v:prevcount) +< 読出し専用。 + + *v:profiling* *profiling-variable* +v:profiling 通常時は0。":profile start" を実行すると1が代入される。 + |profiling|を参照。 + + *v:progname* *progname-variable* +v:progname Vimを起動したときのプログラム名(パスは除かれる)。|view|、 + |evim| などの名前やシンボリックリンクなどで起動した場合に特別な + 初期化を行うのに便利。 + 読出し専用。 + + *v:progpath* *progpath-variable* +v:progpath Vim を起動したときのコマンド (パスを含む)。|--remote-expr| で + Vim サーバーにメッセージを送信するときに便利。 + フルパスを得るには: > + echo exepath(v:progpath) +< パスが相対の場合、フルパスに展開され、これにより `:cd` 後でも + 機能する。例えば "./vim" で開始すると + "/home/user/path/to/vim/src/vim" という結果になる。 + MS-Windows では実行ファイルが "vim.exe" として呼び出されるかも + しれないが、".exe" は v:progpath には追加されない。 + 読出し専用。 + + *v:register* *register-variable* +v:register 現在のノーマルモードコマンドに適用されるレジスタの名前 (そのコ + マンドが実際にレジスタを使うかどうかには依らない)。または、現 + 在実行しているノーマルモードマッピング用のレジスタの名前 (レジ + スタを使うカスタムコマンドの中で使う)。レジスタが指定されなかっ + たときはデフォルトレジスタ '"' になる。'clipboard' に + "unnamed" か "unnamedplus" が含まれているときはデフォルトはそ + れぞれ '*' か '+' になる。 + |getreg()| と |setreg()| も参照。 + + *v:scrollstart* *scrollstart-variable* +v:scrollstart 画面のスクロールの原因となったスクリプトや関数を説明する + 文字列。空であるときのみ代入される。よってこの変数には最初の原 + 因だけが記録されている。原因がキーボードから入力されたコマンド + の場合は "Unknown" が代入される。 + スクリプトを実行したとき現れたhit-enterプロンプトの原因を探る + ために便利。 + + *v:servername* *servername-variable* +v:servername |x11-clientserver|に登録されている名前。 + 読出し専用。 + + +v:searchforward *v:searchforward* *searchforward-variable* + 検索方向: 前方検索の後なら1、後方検索の後なら0。|quote/| で示す + 方法によって最終検索パターンを直接セットしたときは1(前方検索) + にリセットされる。 + 関数から戻るとき、この値は呼び出し前の値に復元される。 + |function-search-undo|。 + 読み書き両用。 + + *v:shell_error* *shell_error-variable* +v:shell_error 最後に実行したシェルコマンドの結果。シェルコマンドの実行時に何 + かエラーがあったならば、非零の値を取る。問題がなければ零になる。 + これはシェルがエラーコードをVimに通知する時のみ働く。コマンドが + 実行されなかった時には、値として-1が良く使われる。読出し専用。 + 例: > + :!mv foo bar + :if v:shell_error + : echo 'could not rename "foo" to "bar"!' + :endif +< また "shell_error" は、以前の版のVimとの互換性の為に動作する。 + + *v:statusmsg* *statusmsg-variable* +v:statusmsg 最後に表示されたステータスメッセージ。この変数は代入すること + が許されている。 + + *v:swapname* *swapname-variable* +v:swapname オートコマンド|SwapExists|を実行している最中のみ有効。見つかっ + たスワップファイルの名前。読出し専用。 + + *v:swapchoice* *swapchoice-variable* +v:swapchoice イベント|SwapExists|により実行されたオートコマンドが、見つかっ + たスワップファイルをどう処理するかをこの変数に代入する。 + 'o' 読込専用で開く + 'e' とにかく編集する + 'r' 復活させる + 'd' スワップファイルを削除する + 'q' 終了する + 'a' 中止する + この変数の値は1文字の文字列でなければならない。値が空のときは + オートコマンドSwapExistsが存在しないときと同じようにユーザーに + 問い合わせる。既定値は空。 + + *v:swapcommand* *swapcommand-variable* +v:swapcommand ファイルを開いた後に実行するノーマルモードコマンド。オートコマ + ンド|SwapExists|で、他のVimインスタンスにファイルを開かせ、指 + 定位置までジャンプするために使うことができる。例えば、あるタグ + へジャンプするには、この変数に ":tag tagname\r" という値を代入 + する。":edit +cmd file" を実行させるには ":cmd\r" を代入する。 + + *v:t_TYPE* *v:t_bool* *t_bool-variable* +v:t_bool 真偽値型の値。読出し専用。 参照: |type()| + *v:t_channel* *t_channel-variable* +v:t_channel チャンネル型の値。読出し専用。 参照: |type()| + *v:t_dict* *t_dict-variable* +v:t_dict 辞書型の値。読出し専用。 参照: |type()| + *v:t_float* *t_float-variable* +v:t_float 浮動小数点数型の値。読出し専用。 参照: |type()| + *v:t_func* *t_func-variable* +v:t_func Funcref型の値。読出し専用。 参照: |type()| + *v:t_job* *t_job-variable* +v:t_job ジョブ型の値。読出し専用。 参照: |type()| + *v:t_list* *t_list-variable* +v:t_list リスト型の値。読出し専用。 参照: |type()| + *v:t_none* *t_none-variable* +v:t_none 特殊値型の値。読出し専用。 参照: |type()| + *v:t_number* *t_number-variable* +v:t_number 数値型の値。読出し専用。 参照: |type()| + *v:t_string* *t_string-variable* +v:t_string 文字列型の値。読出し専用。 参照: |type()| + + *v:termresponse* *termresponse-variable* +v:termresponse termcapのエントリ|t_RV|で端末から返されるエスケープシーケン + ス。ESC [またはCSIで始まり、途中数字と ';' と '.' だけから構成 + され 'c' で終わるエスケープシーケンスを受け取ったとき代入され + る。このオプションがセットされるとオートコマンドイベント + TermResponseが発生し、端末からの応答に反応することができる。 + 新しいxtermからの応答は次の形式である: + "[ Pp ; Pv ; Pc c"。ここでPpは端末のタイプ: 0ならvt100、 + 1ならvt220。Pvはパッチレベル(パッチ95で導入されたため常 + に95以上)。Pcは常に0。 + {Vimが|+termresponse|機能付きでコンパイルされたときのみ有効} + + *v:testing* *testing-variable* +v:testing `test_garbagecollect_now()` を使う前に設定する必要がある。 + また、これが設定されていると、特定のエラーメッセージが 2 秒間 + 表示されなくなる。(例: "'dictionary' option is empty") + + *v:this_session* *this_session-variable* +v:this_session 最後にロードされたか、セーブされたセッションファイルの完全な + ファイル名。|:mksession|を参照。この変数は代入することが許さ + れている。それ以前にセーブされたセッションがなければ、この変数 + は空となる。 + また "this_session" は、以前の版のVimとの互換性の為に動作する。 + + *v:throwpoint* *throwpoint-variable* +v:throwpoint 最も直近に捕捉されてまだ終了していない例外が発生した位置。キー + ボードから入力されたコマンドは記録されていない。|v:exception| + と|throw-variables|も参照。 + 例: > + :try + : throw "oops" + :catch /.*/ + : echo "Exception from" v:throwpoint + :endtry +< 出力: "Exception from test.vim, line 2" + + *v:true* *true-variable* +v:true 数値1。JSONでは "true" として使われる。|json_encode()|を参照。 + 文字列として使われた時、これは "v:true" として評価される。 > + echo v:true +< v:true ~ + これは eval() がその文字列をパースしたときに、元の値に戻せるよ + うにするためである。読出し専用。 + *v:val* *val-variable* +v:val 辞書|Dictionary|の現在の要素の値。|map()|と|filter()|で使わ + れる式を評価している最中のみ有効。 + 読出し専用。 + + *v:version* *version-variable* +v:version Vimのバージョン番号。メジャーバージョン番号は100倍され、マイ + ナーバージョン番号と足されている。Version 5.0は500。Version + 5.1 (5.01)は501となる。読出し専用。また "version" は、以前の版 + のVimとの互換性の為に動作する。 + 特定のパッチが適用されているかを調べるには|has()|を使う。例: > + if has("patch-7.4.123") +< Note 5.0と5.1には両方ともパッチ123が存在しているが、バージョン + が違えば番号は同じでもパッチの内容は全く異なっている。 + + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter ほとんどのスタートアップが完了するまでの間 0。|VimEnter| 自動 + コマンドが実行される直前に 1 にセットされる。 + + *v:warningmsg* *warningmsg-variable* +v:warningmsg 最後に表示された警告メッセージ。この変数は代入することが許され + ている。 + + *v:windowid* *windowid-variable* +v:windowid X11 ベースの GUI を使っているとき、もしくは端末の Vim を使って + いて X サーバーに接続しているとき (|-X|) は、ウィンドウ ID が + セットされる。 + MS-Windows の GUI を使っているときはウィンドウハンドルがセット + される。 + それ以外では値はゼロである。 + Note: Vim の中のウィンドウを扱うときは |winnr()| または + |win_getid()| を使う。|window-ID| を参照。 + +============================================================================== +4. 組み込み関数 *functions* + +機能別に分類された一覧は |function-list| を参照のこと。 + +(関数名の上でCTRL-]を使うことで、詳細な説明へ飛ぶことができる。) + +使用法 結果 説明 ~ + +abs({expr}) 浮動小数点数または数値 {expr}の絶対値 +acos({expr}) 浮動小数点数 {expr}のアークコサイン +add({list}, {item}) リスト {item}をリスト{list}に追加する +and({expr}, {expr}) 数値 ビット論理積 +append({lnum}, {string}) 数値 {string}を{lnum}行目に付け加える +append({lnum}, {list}) 数値 行{list}を{lnum}行目に付け加える +argc() 数値 引数内のファイルの数 +argidx() 数値 引数リスト内の現在のインデックス +arglistid([{winnr} [, {tabnr}]]) + 数値 引数リストID +argv({nr}) 文字列 引数の第{nr}番目 +argv() リスト 引数リスト +assert_equal({exp}, {act} [, {msg}]) + なし {exp}と{act}が等しいかどうかテストする +assert_exception({error} [, {msg}]) + なし |v:exception|が{error}であるかテストする +assert_fails({cmd} [, {error}]) + なし {cmd}が失敗するかどうかテストする +assert_false({actual} [, {msg}]) + なし {actual}がfalseかどうかテストする +assert_inrange({lower}, {upper}, {actual} [, {msg}]) + なし {actual}が範囲内にあるかテストする +assert_match({pat}, {text} [, {msg}]) なし {pat}が{text}にマッチするかテス + トする +assert_notequal({exp}, {act} [, {msg}]) なし {exp}が{act}と等しくないことを + テストする +assert_notmatch({pat}, {text} [, {msg}]) なし {pat}が{text}とマッチしないこと + をテストする +assert_true({actual} [, {msg}]) + なし {actual}がtrueかどうかテストする +asin({expr}) 浮動小数点数 {expr}のアークサイン +atan({expr}) 浮動小数点数 {expr}のアークタンジェント +atan2({expr}, {expr}) 浮動小数点数 {expr1} / {expr2} のアークタン + ジェント +balloon_show({msg}) なし {msg} をバルーン内に表示 +browse({save}, {title}, {initdir}, {default}) + 文字列 ファイル選択ダイアログを表示 +browsedir({title}, {initdir}) 文字列 ディレクトリ選択ダイアログを表示 +bufexists({expr}) 数値 バッファ{expr}が存在すれば|TRUE| +buflisted({expr}) 数値 バッファ{expr}がリストにあるなら|TRUE| +bufloaded({expr}) 数値 バッファ{expr}がロード済みなら|TRUE| +bufname({expr}) 文字列 バッファ{expr}の名前 +bufnr({expr} [, {create}]) 数値 バッファ{expr}の番号 +bufwinid({expr}) 数値 バッファ{expr}のウィンドウID +bufwinnr({nr}) 数値 バッファ{nr}のウィンドウ番号 +byte2line({byte}) 数値 {byte}番目のバイトの行番号 +byteidx({expr}, {nr}) 数値 {expr}の{nr}文字目のバイトインデックス +byteidxcomp({expr}, {nr}) 数値 {expr}の{nr}文字目のバイトインデックス +call({func}, {arglist} [, {dict}]) + 任意 引数{arglist}をつけて{func}を呼ぶ +ceil({expr}) 浮動小数点数 {expr} を切り上げる +ch_canread({handle}) 数値 何か読むものがあるかをチェックする +ch_close({handle}) なし {handle} を閉じる +ch_close_in({handle}) なし {handle} の入力を閉じる +ch_evalexpr({handle}, {expr} [, {options}]) + 任意 {handle} に {expr} を送り応答をJSONと + して評価する +ch_evalraw({handle}, {string} [, {options}]) + 任意 {handle} に {string} を送り応答を生の + 文字列として評価する +ch_getbufnr({handle}, {what}) 数値 {handle}/{what} に割り当てられたバッ + ファ番号を得る +ch_getjob({channel}) ジョブ {channel} の Job を得る +ch_info({handle}) 文字列 チャンネル {handle} に関する情報を得る +ch_log({msg} [, {handle}]) なし チャンネルのログファイルに {msg} を書 + き込む +ch_logfile({fname} [, {mode}]) なし チャンネルの挙動ログ出力を開始する +ch_open({address} [, {options}]) + チャンネル {address} へのチャンネルを開く +ch_read({handle} [, {options}]) 文字列 {handle} から読み込む +ch_readraw({handle} [, {options}]) + 文字列 {handle} から生の文字列を読み込む +ch_sendexpr({handle}, {expr} [, {options}]) + 任意 {expr}をJSONチャンネル{handle}に送る +ch_sendraw({handle}, {string} [, {options}]) + 任意 {string}をrawチャンネル{handle}に送る +ch_setoptions({handle}, {options}) + なし {handle}にオプションを設定する +ch_status({handle} [, {options}]) + 文字列 チャンネル{handle}の状態 +changenr() 数値 現在の変更番号 +char2nr({expr}[, {utf8}]) 数値 {expr}の先頭文字のASCII/UTF8コード +cindent({lnum}) 数値 {lnum}行目のCインデント量 +clearmatches() なし 全マッチをクリアする +col({expr}) 数値 カーソルかマークのカラム番号 +complete({startcol}, {matches}) なし 挿入モード補完を設定する +complete_add({expr}) 数値 補完候補を追加する +complete_check() 数値 補完中に押されたキーをチェックする +confirm({msg} [, {choices} [, {default} [, {type}]]]) + 数値 ユーザーへの選択肢と番号 +copy({expr}) 任意 {expr}の浅いコピーを作る +cos({expr}) 浮動小数点数 {expr} の余弦(コサイン) +cosh({expr}) 浮動小数点数 {expr}のハイパボリックコサイン +count({list}, {expr} [, {ic} [, {start}]]) + 数値 {list}中に{expr}が何個現れるか数える +cscope_connection([{num} , {dbpath} [, {prepend}]]) + 数値 cscope接続の存在を判定する +cursor({lnum}, {col} [, {off}]) + 数値 カーソルを{lnum}, {col}, {off}へ移動 +cursor({list}) 数値 カーソルを{list}の位置へ移動 +deepcopy({expr} [, {noref}]) 任意 {expr}の完全なコピーを作る +delete({fname} [, {flags}]) 数値 ファイルやディレクトリ{fname}を消す +did_filetype() 数値 FileTypeのautocommandが実行されたか? +diff_filler({lnum}) 数値 差分モードで{lnum}に挿入された行 +diff_hlID({lnum}, {col}) 数値 差分モードで{lnum}/{col}位置の強調 +empty({expr}) 数値 {expr}が空なら|TRUE| +escape({string}, {chars}) 文字列 {string}内の{chars}を '\' でエスケープ +eval({string}) 任意 {string}を評価し、値を得る +eventhandler() 数値 イベントハンドラの内側なら|TRUE| +executable({expr}) 数値 実行可能な{expr}が存在するなら1 +execute({command}) 文字列 {command}を実行し、出力を得る +exepath({expr}) 文字列 コマンド {expr} のフルパス +exists({var}) 数値 変数{var}が存在したら|TRUE| +extend({expr1}, {expr2} [, {expr3}]) + リスト/辞書 {expr1}に{expr2}の要素を挿入 +exp({expr}) 浮動小数点数 {expr}の指数 +expand({expr} [, {nosuf} [, {list}]]) + 任意 {expr}内の特別なキーワードを展開 +feedkeys({string} [, {mode}]) 数値 先行入力バッファにキーシーケンスを追加 +filereadable({file}) 数値 {file}が読みこみ可能なら|TRUE| +filewritable({file}) 数値 {file}が書き込み可能なら|TRUE| +filter({expr1}, {expr2}) リスト/辞書 {expr2}が0となる要素を{expr1}から + とり除く +finddir({name}[, {path}[, {count}]]) + 文字列 {path}からディレクトリ{name}を探す +findfile({name}[, {path}[, {count}]]) + 文字列 {path}からファイル{name}を探す +float2nr({expr}) 数値 浮動小数点数 {expr} を数値に変換する +floor({expr}) 浮動小数点数 {expr} を切り捨てる +fmod({expr1}, {expr2}) 浮動小数点数 {expr1} / {expr2} の余り +fnameescape({fname}) 文字列 {fname} 内の特殊文字をエスケープする +fnamemodify({fname}, {mods}) 文字列 ファイル名を変更 +foldclosed({lnum}) 数値 {lnum}の折り畳みの最初の行(閉じている + なら) +foldclosedend({lnum}) 数値 {lnum}の折り畳みの最後の行(閉じている + なら) +foldlevel({lnum}) 数値 {lnum}の折り畳みレベル +foldtext() 文字列 閉じた折り畳みに表示されている行 +foldtextresult({lnum}) 文字列 {lnum}で閉じている折り畳みのテキスト +foreground() 数値 Vimウィンドウを前面に移動する +funcref({name} [, {arglist}] [, {dict}]) + Funcref 関数{name}への参照 +function({name} [, {arglist}] [, {dict}]) + Funcref 名前による関数{name}への参照 +garbagecollect([{atexit}]) なし メモリを解放する。循環参照を断ち切る +get({list}, {idx} [, {def}]) 任意 {list}や{def}から要素{idx}を取得 +get({dict}, {key} [, {def}]) 任意 {dict}や{def}から要素{key}を取得 +get({func}, {what}) 任意 funcref/partial {func}のプロパティ取得 +getbufinfo([{expr}]) リスト バッファに関する情報 +getbufline({expr}, {lnum} [, {end}]) + リスト バッファ{expr}の{lnum}から{end}行目 +getbufvar({expr}, {varname} [, {def}]) + 任意 バッファ{expr}の変数 {varname} +getchar([expr]) 数値 ユーザーから1文字を取得する +getcharmod() 数値 修飾キーの状態を表す数値を取得 +getcharsearch() 辞書 最後の文字検索を取得 +getcmdline() 文字列 現在のコマンドラインを取得 +getcmdpos() 数値 コマンドラインのカーソル位置を取得 +getcmdtype() 文字列 現在のコマンドラインの種類を取得 +getcmdwintype() 文字列 現在のコマンドラインウィンドウの種類 +getcompletion({pat}, {type} [, {filtered}]) + リスト コマンドライン補完にマッチするリスト +getcurpos() リスト カーソルの位置 +getcwd([{winnr} [, {tabnr}]]) 文字列 現在の作業ディレクトリを取得 +getfontname([{name}]) 文字列 使用しているフォントの名前 +getfperm({fname}) 文字列 ファイル{fname}の許可属性を取得 +getfsize({fname}) 数値 ファイル{fname}のバイト数を取得 +getftime({fname}) 数値 ファイルの最終更新時間 +getftype({fname}) 文字列 ファイル{fname}の種類の説明 +getline({lnum}) 文字列 現在のバッファから行の内容を取得 +getline({lnum}, {end}) リスト カレントバッファの{lnum}から{end}行目 +getloclist({nr}) リスト ロケーションリストの要素のリスト +getmatches() リスト 現在のマッチのリスト +getpid() 数値 Vim のプロセス ID +getpos({expr}) リスト カーソル・マークなどの位置を取得 +getqflist([{what}]) リスト quickfix要素のリスト +getreg([{regname} [, 1 [, {list}]]]) + 文字列/リスト レジスタの中身を取得 +getregtype([{regname}]) 文字列 レジスタの種類を取得 +gettabinfo([{expr}]) リスト タブページのリスト +gettabvar({nr}, {varname} [, {def}]) + 任意 タブ{nr}の変数{varname}または{def} +gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) + 任意 タブページ{tabnr}の{winnr}の{name} +getwininfo([{winid}]) リスト ウィンドウのリスト +getwinposx() 数値 GUI vim windowのX座標 +getwinposy() 数値 GUI vim windowのY座標 +getwinvar({nr}, {varname} [, {def}]) + 文字列 ウィンドウ{nr}の変数{varname} +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) + 任意 {expr}内のfile wildcardを展開 +glob2regpat({expr}) 文字列 globパターンを検索パターンに変換 +globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) + 文字列 {path}の全ディレクトリに対し + glob({expr})を行う +has({feature}) 数値 機能{feature}がサポートならば|TRUE| +has_key({dict}, {key}) 数値 {dict}が要素{key}を持つなら|TRUE| +haslocaldir([{winnr} [, {tabnr}]]) + 数値 現在のウィンドウで|:lcd|が実行された + なら|TRUE| +hasmapto({what} [, {mode} [, {abbr}]]) + 数値 {what}のマッピングが存在するなら|TRUE| +histadd({history}, {item}) 文字列 ヒストリに追加 +histdel({history} [, {item}]) 文字列 ヒストリからitemを削除 +histget({history} [, {index}]) 文字列 ヒストリから{index}アイテムを取得 +histnr({history}) 数値 ヒストリの数 +hlexists({name}) 数値 highlight group {name}が存在したら|TRUE| +hlID({name}) 数値 highlight group {name}のID +hostname() 文字列 vimが動作しているマシンの名前 +iconv({expr}, {from}, {to}) 文字列 {expr}のエンコーディングを変換する +indent({lnum}) 文字列 行{lnum}のインデントを取得 +index({list}, {expr} [, {start} [, {ic}]]) + 数値 {list}中に{expr}が現れる位置 +input({prompt} [, {text} [, {completion}]]) + 文字列 ユーザーからの入力を取得 +inputdialog({prompt} [, {text} [, {completion}]]]) + 文字列 input()と同様。GUIのダイアログを使用 +inputlist({textlist}) 数値 ユーザーに選択肢から選ばせる +inputrestore() 数値 先行入力を復元する +inputsave() 数値 先行入力を保存し、クリアする +inputsecret({prompt} [, {text}]) 文字列 input()だがテキストを隠す +insert({list}, {item} [, {idx}]) リスト {list}に要素{item}を挿入 [{idx}の前] +invert({expr}) 数値 ビット反転 +isdirectory({directory}) 数値 {directory}がディレクトリならば|TRUE| +islocked({expr}) 数値 {expr}がロックされているなら|TRUE| +isnan({expr}) 数値 {expr}がNaNならば|TRUE| +items({dict}) リスト {dict}のキーと値のペアを取得 +job_getchannel({job}) チャンネル {job}のチャンネルハンドルを取得 +job_info({job}) 辞書 {job}についての情報を取得 +job_setoptions({job}, {options}) なし {job}のオプションを設定する +job_start({command} [, {options}]) + ジョブ ジョブを開始する +job_status({job}) 文字列 {job}のステータスを取得する +job_stop({job} [, {how}]) 数値 {job}を停止する +join({list} [, {sep}]) 文字列 {list}の要素を連結して文字列にする +js_decode({string}) 任意 JS形式のJSONをデコードする +js_encode({expr}) 文字列 JS形式のJSONにエンコードする +json_decode({string}) 任意 JSONをデコードする +json_encode({expr}) 文字列 JSONにエンコードする +keys({dict}) リスト {dict}のキーを取得 +len({expr}) 数値 {expr}の長さを取得 +libcall({lib}, {func}, {arg} 文字列 ライブラリ{lib}の関数{func}をコール +libcallnr({lib}, {func}, {arg}) 数値 上と同じ。ただし数値を返す +line({expr}) 数値 行番号の取得 +line2byte({lnum}) 数値 行{lnum}のバイトカウント +lispindent({lnum}) 数値 {lnum}行目のLispインデント量を取得 +localtime() 数値 現在時刻 +log({expr}) 浮動小数点数 {expr}の自然対数(底e) +log10({expr}) 浮動小数点数 浮動小数点数 {expr} の 10 を底 + とする対数 +luaeval({expr}[, {expr}]) 任意 |Lua| の式を評価する +map({expr1}, {expr2}) リスト/辞書 {expr1}の各要素を{expr2}に変える +maparg({name}[, {mode} [, {abbr} [, {dict}]]]) + 文字列/辞書 + モード{mode}でのマッピング{name}の値 +mapcheck({name}[, {mode} [, {abbr}]]) + 文字列 {name}にマッチするマッピングを確認 +match({expr}, {pat}[, {start}[, {count}]]) + 数値 {expr}内で{pat}がマッチする位置 +matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) + 数値 {pattern} を {group} で強調表示する +matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) + 数値 位置を {group} で強調表示する +matcharg({nr}) リスト |:match|の引数 +matchdelete({id}) 数値 {id} で指定されるマッチを削除する +matchend({expr}, {pat}[, {start}[, {count}]]) + 数値 {expr}内で{pat}が終了する位置 +matchlist({expr}, {pat}[, {start}[, {count}]]) + リスト {expr}内の{pat}のマッチと部分マッチ +matchstr({expr}, {pat}[, {start}[, {count}]]) + 文字列 {expr}内の{count}番目の{pat}のマッチ +matchstrpos({expr}, {pat}[, {start}[, {count}]]) + リスト {expr}内の{count}番目の{pat}のマッチ +max({expr}) 数値 {expr}内の要素の最大値 +min({expr}) 数値 {expr}内の要素の最小値 +mkdir({name} [, {path} [, {prot}]]) + 数値 ディレクトリ{name}を作成 +mode([expr]) 文字列 現在の編集モード +mzeval({expr}) 任意 |MzScheme| の式を評価する +nextnonblank({lnum}) 数値 {lnum}行目以降で空行でない行の行番号 +nr2char({expr}[, {utf8}]) 文字列 ASCII/UTF8コード{expr}で示される文字 +or({expr}, {expr}) 数値 ビット論理和 +pathshorten({expr}) 文字列 path内の短縮したディレクトリ名 +perleval({expr}) 任意 |Perl|の式を評価する +pow({x}, {y}) 浮動小数点数 {x} の {y} 乗 +prevnonblank({lnum}) 数値 {lnum}行目以前の空行でない行の行番号 +printf({fmt}, {expr1}...) 文字列 文字列を組み立てる +pumvisible() 数値 ポップアップメニューが表示されているか +pyeval({expr}) 任意 |Python| の式を評価する +py3eval({expr}) 任意 |python3| の式を評価する +pyxeval({expr}) 任意 |python_x| の式を評価する +range({expr} [, {max} [, {stride}]]) + リスト {expr}から{max}までの要素のリスト +readfile({fname} [, {binary} [, {max}]]) + リスト ファイル{fname}から行のリストを取得 +reltime([{start} [, {end}]]) リスト 時刻の値を取得 +reltimefloat({time}) 浮動小数点数 時刻の値を浮動小数点に変換 +reltimestr({time}) 文字列 時刻の値を文字列に変換 +remote_expr({server}, {string} [, {idvar}]) + 文字列 式を送信する +remote_foreground({server}) 数値 Vimサーバーを前面に出す +remote_peek({serverid} [, {retvar}]) + 数値 返信文字列を確認する +remote_read({serverid}) 文字列 返信文字列を読み込む +remote_send({server}, {string} [, {idvar}]) + 文字列 キーシーケンスを送信する +remove({list}, {idx} [, {end}]) 任意 {list}から{idx}と{end}間の要素を削除 +remove({dict}, {key}) 任意 {dict}から要素{key}を削除 +rename({from}, {to}) 数値 {file}から{to}へファイル名変更 +repeat({expr}, {count}) 文字列 {expr}を{count}回繰り返す +resolve({filename}) 文字列 ショートカットが指す先のファイル名 +reverse({list}) 文字列 {list}をその場で反転させる +round({expr}) 浮動小数点数 {expr} を四捨五入する +screenattr({row}, {col}) 数値 スクリーン位置の属性 +screenchar({row}, {col}) 数値 スクリーン位置の文字 +screencol() 数値 現在のカーソル列 +screenrow() 数値 現在のカーソル行 +search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) + 数値 {pattern} を検索する +searchdecl({name} [, {global} [, {thisblock}]]) + 数値 変数の宣言を検索 +searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) + 数値 開始/終端のペアの他方を検索 +searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) + リスト 開始/終端のペアの他方を検索 +searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) + リスト {pattern}を検索 +server2client({clientid}, {string}) + 数値 返信文字列を送信する +serverlist() 文字列 利用可能なサーバーのリストを取得 +setbufvar({expr}, {varname}, {val}) バッファ{expr}内の変数{varname}に{val} + をセット +setcharsearch({dict}) 辞書 文字検索を{dict}に設定 +setcmdpos({pos}) 数値 コマンドライン内のカーソル位置を設定 +setfperm({fname}, {mode}) 数値 ファイル {fname} のパーミッションを + {mode} に設定 +setline({lnum}, {line}) 数値 行{lnum}に{line}(文字列)をセット +setloclist({nr}, {list}[, {action}[, {what}]]) + 数値 {list}を使ってロケーションリストを変更 +setmatches({list}) 数値 マッチのリストを復元する +setpos({expr}, {list}) なし {expr}の位置を{list}にする +setqflist({list}[, {action}[, {what}]]) + 数値 {list}を使ってQuickFixリストを変更 +setreg({n}, {v}[, {opt}]) 数値 レジスタの値とタイプを設定 +settabvar({nr}, {varname}, {val}) なし タブページ{nr}の変数{varname}を{val}に + 設定する +settabwinvar({tabnr}, {winnr}, {varname}, {val}) + なし タブページ{tabnr}内のウィンドウ{winnr} + の変数{varname}に{val}をセット +setwinvar({nr}, {varname}, {val}) なし ウィンドウ{nr}の変数{varname}に{val}を + セット +sha256({string}) 文字列 {string}のSHA256チェックサム +shellescape({string} [, {special}]) + 文字列 {string}をシェルコマンド引数として使う + ためにエスケープする。 +shiftwidth() 数値 実際に使用される 'shiftwidth' の値 +simplify({filename}) 文字列 ファイル名を可能なかぎり簡略化する +sin({expr}) 浮動小数点数 {expr} の正弦(サイン) +sinh({expr}) 浮動小数点数 {expr}のハイパボリックサイン +sort({list} [, {func} [, {dict}]]) + リスト 比較に{func}を使って{list}をソートする +soundfold({word}) 文字列 {word}のsound-fold +spellbadword() 文字列 カーソル位置のスペルミスした単語 +spellsuggest({word} [, {max} [, {capital}]]) + リスト スペリング補完 +split({expr} [, {pat} [, {keepempty}]]) + リスト {expr}を{pat}で区切ってリストを作る +sqrt({expr}) 浮動小数点数 {expr} の平方根 +str2float({expr}) 浮動小数点数 文字列を浮動小数点数に変換する +str2nr({expr} [, {base}]) 数値 文字列を数値に変換する +strchars({expr} [, {skipcc}]) 数値 文字列{expr}の文字の数 +strcharpart({str}, {start}[, {len}]) + 文字列 {str} の {start} から長さ {len} の文字 + 列を得る +strdisplaywidth({expr} [, {col}]) 数値 文字列{expr}の表示幅 +strftime({format}[, {time}]) 文字列 指定されたフォーマットでの時刻 +strgetchar({str}, {index}) 数値 {str} から {index} 番目の文字インデッ + クスを得る +stridx({haystack}, {needle}[, {start}]) + 数値 {haystack}内の{needle}のインデックス +string({expr}) 文字列 {expr}の値の文字列表現 +strlen({expr}) 数値 文字列{expr}の長さ +strpart({src}, {start}[, {len}]) + 文字列 {src}内{start}から長さ{len}の部分 +strridx({haystack}, {needle} [, {start}]) + 数値 {haystack}内の最後の{needle}のインデッ + クス +strtrans({expr}) 文字列 文字列を表示可能に変更 +strwidth({expr}) 数値 文字列{expr}の表示セル幅 +submatch({nr}[, {list}]) 文字列/リスト + ":s" やsubstitute()における特定のマッチ +substitute({expr}, {pat}, {sub}, {flags}) + 文字列 {expr}の{pat}を{sub}に置換え +synID({line}, {col}, {trans}) 数値 {line}と{col}のsyntax IDを取得 +synIDattr({synID}, {what} [, {mode}]) + 文字列 syntax ID{synID}の属性{what}を取得 +synIDtrans({synID}) 数値 {synID}の翻訳されたsyntax ID +synconcealed({lnum}, {col}) リスト Conceal の情報 +synstack({lnum}, {col}) リスト {lnum}行{col}列目における構文IDの + スタック +system({expr} [, {input}]) 文字列 シェルコマンド{expr}の出力結果 +systemlist({expr} [, {input}]) リスト シェルコマンド{expr}の出力結果 +tabpagebuflist([{arg}]) リスト タブページ内のバッファ番号のリスト +tabpagenr([{arg}]) 数値 現在または最後のタブページの番号 +tabpagewinnr({tabarg}[, {arg}]) + 数値 タブページ内の現在のウィンドウの番号 +taglist({expr}) リスト {expr}にマッチするタグのリスト +tagfiles() リスト 使用しているタグファイルのリスト +tan({expr}) 浮動小数点数 {expr}のタンジェント +tanh({expr}) 浮動小数点数 {expr}のハイパボリックタンジェ + ント +tempname() 文字列 テンポラリファイルの名前 +test_alloc_fail({id}, {countdown}, {repeat}) + なし メモリの確保を失敗にさせる +test_autochdir() なし 起動時に 'autochdir' を有効にする +test_garbagecollect_now() なし テスト用に直ちにメモリを解放する +test_ignore_error({expr}) なし 特定のエラーを無視する +test_null_channel() チャンネル テスト用のnull値 +test_null_dict() 辞書 テスト用のnull値 +test_null_job() ジョブ テスト用のnull値 +test_null_list() リスト テスト用のnull値 +test_null_partial() Funcref テスト用のnull値 +test_null_string() 文字列 テスト用のnull値 +test_override({expr}, {val}) なし Vimの内部処理を置き換えてテストする +test_settime({expr}) なし テスト用に現在の時刻を設定する +timer_info([{id}]) リスト タイマーに関する情報 +timer_pause({id}, {pause}) なし タイマーの一時停止または一時停止解除 +timer_start({time}, {callback} [, {options}]) + 数値 タイマーを作成する +timer_stop({timer}) なし タイマーを停止する +timer_stopall() なし すべてのタイマーを停止する +tolower({expr}) 文字列 文字列{expr}を小文字にする +toupper({expr}) 文字列 文字列{expr}を大文字にする +tr({src}, {fromstr}, {tostr}) 文字列 {src}中に現れる文字{fromstr}を{tostr} + に変換する +trunc({expr}) 浮動小数点数 浮動小数点数{expr}を切り詰める +type({name}) 数値 変数{name}の型 +undofile({name}) 文字列 {name}に対するアンドゥファイルの名前 +undotree() リスト アンドゥファイルツリー +uniq({list} [, {func} [, {dict}]]) + リスト リストから隣接した重複を削除 +values({dict}) リスト {dict}の値のリスト +virtcol({expr}) 数値 カーソルのスクリーンカラム位置 +visualmode([expr]) 文字列 最後に使われたビジュアルモード +wildmenumode() 数値 'wildmenu' モードが有効かどうか +win_findbuf({bufnr}) リスト {bufnr}を含むウィンドウを見つける +win_getid([{win} [, {tab}]]) 数値 {tab}の{win}のウィンドウIDを取得 +win_gotoid({expr}) 数値 ID {expr}のウィンドウに行く +win_id2tabwin({expr}) リスト ウィンドウIDからタブとウィンドウnr取得 +win_id2win({expr}) 数値 ウィンドウIDからウィンドウnr取得 +winbufnr({nr}) 数値 ウィンドウ{nr}のバッファ番号 +wincol() 数値 カーソル位置のウィンドウ桁 +winheight({nr}) 数値 ウィンドウ{nr}の高さ +winline() 数値 カーソル位置のウィンドウ行 +winnr([{expr}]) 数値 現在のウィンドウの番号 +winrestcmd() 文字列 ウィンドウサイズを復元するコマンド +winrestview({dict}) なし 現在のウィンドウのビューを復元 +winsaveview() 辞書 現在のウィンドウのビューを保存 +winwidth({nr}) 数値 ウィンドウ{nr}の幅を取得 +wordcount() 辞書 バイト/文字/単語の統計情報を取得 +writefile({list}, {fname} [, {flags}]) + 数値 行のリストをファイル{fname}に書き込む +xor({expr}, {expr}) 数値 ビット排他的論理和 + + +abs({expr}) *abs()* + {expr} の絶対値を返す。{expr} の値が浮動小数点数である場合は浮 + 動小数点数を返す。{expr} が|Number|に変換可能な場合は数値が戻 + り値になる。それ以外の場合はエラーメッセージを表示し、-1 + を返す。 + 例: > + echo abs(1.456) +< 1.456 > + echo abs(-5.456) +< 5.456 > + echo abs(-4) +< 4 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +acos({expr}) *acos()* + {expr} の逆余弦 (アークコサイン) をラジアンで返す。 + 値は [0, pi] の範囲の浮動小数点数 (|Float|)。 + {expr} は [-1, 1] の範囲の浮動小数点数 (|Float|) か数値 + (|Number|) でなければならない。 + 例: > + :echo acos(0) +< 1.570796 > + :echo acos(-0.5) +< 2.094395 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +add({list}, {expr}) *add()* + リスト|List|{list}の末尾に要素{expr}を追加する。結果のリストを + 返す。例: > + :let alist = add([1, 2, 3], item) + :call add(mylist, "woodstock") +< Note {expr}がリストのときは、1個の要素として追加される。リスト + を連結するには|extend()|を使う。 + 他の位置に要素を追加するには|insert()|を使う。 + + +and({expr}, {expr}) *and()* + 二つの引数のビット論理積。引数は数値に変換される。リスト、辞 + 書、浮動小数点数を指定するとエラーになる。 + 例: > + :let flag = and(bits, 0x80) + + +append({lnum}, {expr}) *append()* + {expr}がリスト|List|のときは、各要素をカレントバッファの{lnum} + 行目以降にテキストとして追加する。 + リストでないときは、{expr}をテキストとしてカレントバッファの + {lnum}行目以降にテキストとして追加する。 + {lnum}は0でもよく、その場合は1行目の前に行を挿入する。 + 失敗した場合は1を返す({lnum}が不正な範囲であるか、メモリ不足)。 + 成功なら0を返す。例: > + :let failed = append(line('$'), "# THE END") + :let failed = append(0, ["Chapter 1", "the beginning"]) +< + *argc()* +argc() カレントウィンドウの引数リスト内の、ファイルの数を返す。 + |arglist|を参照。 + + *argidx()* +argidx() 引数リスト内の現在のインデックスを返す。最初のファイルは0とな + る。argc() - 1が最後のファイルとなる。|arglist|を参照。 + + *arglistid()* +arglistid([{winnr} [, {tabnr}]]) + 引数リストの ID を返す。値は引数リストを区別するための数値であ + る。ゼロはグローバル引数リストを意味する。 |arglist| 参照。 + 引数が無効な場合は -1 を返す。 + + 引数を指定しなかった場合はカレントウィンドウが使われる。 + {winnr} を指定した場合はカレントタブページ内のウィンドウが使わ + れる。 + {winnr} と {tabnr} を指定した場合は指定したタブページ内のウィ + ンドウが使われる。 + {winnr} にはウィンドウ番号または|window-ID|が使える。 + + *argv()* +argv([{nr}]) 結果は引数リスト内の、{nr}番目のファイル。|arglist|を参照。 + "argv(0)" は一番最初のファイルを示す。例: > + :let i = 0 + :while i < argc() + : let f = escape(fnameescape(argv(i)), '.') + : exe 'amenu Arg.' . f . ' :e ' . f . '' + : let i = i + 1 + :endwhile +< 引数{nr}が指定されなかった場合は、引数リスト|arglist|全体を返 + す。 + + *assert_equal()* +assert_equal({expected}, {actual} [, {msg}]) + {expected}と{actual}が等しくない場合、|v:errors|にエラーメッセ + ージを追加する。 + 暗黙的な変換は行われないため、文字列 "4" は数値 4 とは異なる。 + 同様に、数値 4 は浮動小数点数 4.0 と異なる。ここでは + 'ignorecase' の値は使われず、大文字小文字は常に区別される。 + {msg}が省略された場合、"Expected {expected} but got {actual}" + という形式のメッセージが生成される。 + 例: > + assert_equal('foo', 'bar') +< 以下の結果が|v:errors|に追加される: + test.vim line 12: Expected 'foo' but got 'bar' ~ + +assert_exception({error} [, {msg}]) *assert_exception()* + v:exception に{error}が含まれていない時、|v:errors|にエラーメッ + セージを追加する。 + これは例外を投げるコマンドのテストを行う場合に使うことができ + る。コロンが続くエラー番号を使えば、翻訳の問題を回避できる: > + try + 失敗するコマンド + call assert_false(1, 'command should have failed') + catch + call assert_exception('E492:') + endtry + +assert_fails({cmd} [, {error}]) *assert_fails()* + {cmd}を実行しエラーを生成しなかった場合、|v:errors|にエラーメッ + セージを追加する。 + {error}が渡された場合、|v:errmsg|の一部にマッチしなければなら + ない。 + +assert_false({actual} [, {msg}]) *assert_false()* + |assert_equal()|と同様に、{actual}がfalseでない場合、|v:errors| + にエラーメッセージを追加する。 + ゼロである時、その値はfalseである。{actual}が数値でない場合、 + テストが失敗する。 + {msg}が省略された場合、"Expected False but got {actual}" とい + う形式のメッセージが生成される。 + +assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* + これは数値の値かをテストする。{actual}が{lower}より低いか + {upper}より大きい場合、|v:errors|にエラーメッセージが追加され + る。 + {msg}を省略すると、"Expected range {lower} - {upper}, but + got {actual}" という形式のエラーが生成される。 + + *assert_match()* +assert_match({pattern}, {actual} [, {msg}]) + {pattern}が{actual}と一致しない場合、|v:errors|にエラーメッセー + ジが追加される。 + + |=~|と同じように{pattern}が使われる: マッチングは 'magic' や + 'cpoptions' の実際の値に関係なく、'magic' が設定され、 + 'cpoptions' が空であるように常に行われる。 + + {actual}は文字列として使用され、自動変換が適用される。テキスト + の先頭と最後に一致させるためには、"^" と "$" を使用すること。 + 両方を使用してテキスト全体を一致させる。{訳注: 使わなければ、 + 部分一致で判定が行われる。} + + {msg}を省略すると、"Pattern {pattern} does not match {actual}" + という形式のエラーが生成される。例: > + assert_match('^f.*o$', 'foobar') +< これは |v:errors| に文字列が追加されることになる: + test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + + *assert_notequal()* +assert_notequal({expected}, {actual} [, {msg}]) + `assert_equal()` の反対: {expected}と{actual}が等しいときにエ + ラーメッセージを |v:errors| に追加する。 + + *assert_notmatch()* +assert_notmatch({pattern}, {actual} [, {msg}]) + `assert_match()` の反対: {pattern}が{actual}にマッチするときに + |v:errors| にエラーメッセージを追加する。 + +assert_true({actual} [, {msg}]) *assert_true()* + |assert_equal()|と同様に、{actual}がtrueでない場合、|v:errors| + にエラーメッセージを追加する。 + 非ゼロである時、その値はTRUEである。{actual}が数値でない場合、 + テストが失敗する。 + {msg}が省略された場合、"Expected True but got {actual}" とい + う形式のメッセージが生成される。 + +asin({expr}) *asin()* + {expr} の逆正弦 (アークサイン) をラジアンで返す。 + 値は [-pi/2, pi/2] の範囲の浮動小数点数 (|Float|)。 + {expr} は [-1, 1] の範囲の浮動小数点数 (|Float|) か数値 + (|Number|) でなければならない。 + 例: > + :echo asin(0.8) +< 0.927295 > + :echo asin(-0.5) +< -0.523599 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +atan({expr}) *atan()* + {expr} の逆正接(アークタンジェント)の主値を浮動小数点数 + |Float| で返す。主値はラジアンで[-pi/2, +pi/2]の範囲内にある。 + {expr} は |Float| か |Number| に評価されなければならない。 + 例: > + :echo atan(100) +< 1.560797 > + :echo atan(-4.01) +< -1.326405 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +atan2({expr1}, {expr2}) *atan2()* + {expr1} / {expr2} の逆正接 (アークタンジェント) をラジアンで返 + す。値は [-pi, pi] の範囲の浮動小数点数 (|Float|)。 + {expr1} と {expr2} は浮動小数点数 (|Float|) か数値 (|Number|) + でなければならない。 + 例: > + :echo atan2(-1, 1) +< -0.785398 > + :echo atan2(1, -1) +< 2.356194 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + +balloon_show({msg}) *balloon_show()* + {msg} をバルーン内に表示する。 + 例: > + func GetBalloonContent() + " 内容の取得を開始 + return '' + endfunc + set balloonexpr=GetBalloonContent() + + func BalloonCallback(result) + call balloon_show(a:result) + endfunc +< + 想定される使用方法は、バルーンの内容の取得が 'balloonexpr' か + ら開始されることである。そこから非同期メソッドを呼び出し、コー + ルバックから balloon_show() を呼び出す。'balloonexpr' 自身は + 空文字列かプレースホルダーを返すことができる。 + + バルーンを表示できないときは何も起こらず、エラーメッセージも表 + 示されない。 + {Vimが |+balloon_eval| 機能付きでコンパイルされたときのみ有効} + + *browse()* +browse({save}, {title}, {initdir}, {default}) + ファイル選択ダイアログを起動。"has("browse")" が|TRUE|を返すと + き (幾つかのGUIバージョンに限定)だけ利用可能。 + 入力フィールドの意味は: + {save} |TRUE|ならば書込み用ファイルの選択 + {title} ダイアログのタイトル + {initdir} ダイアログの始まるディレクトリ + {default} ファイル名の省略値 + ダイアログがキャンセルされるか、何かエラーがあるか、もしくはブ + ラウジングが不可能ならば、空文字列が戻ってくる。 + + *browsedir()* +browsedir({title}, {initdir}) + ディレクトリ選択ダイアログを起動。"has("browse")" が|TRUE|を返 + すとき(幾つかのGUIバージョンに限定)だけ利用可能。 + ディレクトリ選択ダイアログがないシステムにおいてはファイル選択 + ダイアログが使われる。その場合は、指定したいディレクトリの中の + ファイルを選択すること。 + 入力フィールドの意味は: + {title} ダイアログのタイトル + {initdir} ダイアログの始まるディレクトリ + ダイアログがキャンセルされるか、何かエラーがあるか、もしくはブ + ラウジングが不可能ならば、空文字列が戻ってくる。 + + *bufexists()* +bufexists({expr}) + 結果は数値で、{expr}と呼ばれるバッファが存在すれば|TRUE|とな + る。 + {expr}が数値の場合、バッファ番号とみなされる。 + {expr}が文字列の場合、バッファ名に正確にマッチしなければな + らない。名前として以下のものが許される: + - カレントディレクトリからの相対パス。 + - フルパス。 + - 'buftype' が "nofile" であるバッファの名前 + - URL名。 + バッファリストにないバッファも検索される。 + Note |:buffers|の出力で、ヘルプファイルは短い名前でリストされ + ているが、bufexists()は長い名前でないと見つけることができない。 + ある名前を bufexists() に与えて非零になったとしても、その名前 + をコマンド |:buffer| に与える際には |expand()| を使って展開し + なければならない場合がある。特に MS-Windows の "c:\DOCUME~1" + という 8.3 名形式において。 + 代替ファイル名が存在するかを判定するには "bufexists(0)" を使う。 + *buffer_exists()* + 以前の名前: buffer_exists(). + +buflisted({expr}) *buflisted()* + 戻り値は数値で、{expr}と呼ばれるバッファが存在しリストされてい + る ('buflisted' オプションがオンになっている) ならば結果は + |TRUE|となる。引数{expr}は|bufexists()|と同じように扱われる。 + + *bufloaded()* +bufloaded({expr}) + 戻り値は数値で、{expr}と呼ばれるバッファが存在しロード済み( + ウィンドウに表示されているか、隠されているかは問わない)ならば + 結果は|TRUE|となる。引数{expr}は|bufexists()|と同じように扱わ + れる。 + + *bufname()* +bufname({expr}) + 戻り値はバッファの名前。バッファ名はコマンド ":ls" で表示され + るものと同様。 + {expr}が数値ならば、その番号のバッファ名が返される。0は現在の + ウィンドウの代替バッファを意味する。{expr}が文字列ならば、バッ + ファ名に対してファイル名マッチング |file-pattern| を行うパター + ンとなる。このマッチングは常に、'magic' をセットし 'cpoptions' + を空にした状態で行われる。複数マッチしてしまった場合には空文字 + 列が返される。 + "" や "%" は現在のバッファを意味し、"#" は代替バッファを意味す + る。 + 完全マッチのものが優先され、完全マッチがなければ、バッファ名の + 先頭でのマッチ、末尾でのマッチ、中間でのマッチが探される。完全 + マッチのみを探すには、パターン先頭に "^" を、末尾に "$" をつけ + る。 + まずバッファリストにあるバッファが探される。そこで1個だけマッ + チが見つかればそれを返す。次にバッファリストにないものが探され + る。 + {expr}が文字列のときに、それをバッファ番号として使いたいなら + ば、0を足すことによって強制的に数値にすることができる: > + echo bufname("3" + 0) +< バッファが存在しないか名前を持っていない場合には、空文字列が返 + される。 > + bufname("#") alternate buffer name + bufname(3) name of buffer 3 + bufname("%") name of current buffer + bufname("file2") name of buffer where "file2" matches. +< *buffer_name()* + 以前の名前: buffer_name(). + + *bufnr()* +bufnr({expr} [, {create}]) + 結果はバッファの番号。バッファ番号はコマンド ":ls" で表示され + るものと同様。{expr}の使い方は前述のbufname()を参照。バッファ + が存在しない場合-1が返される。ただし、{create}が与えられて0で + ないときは、バッファリストに載せない新しいバッファを作成しその + 番号を返す。 + bufnr("$")は最後のバッファを意味する: > + :let last_buffer = bufnr("$") +< 結果は存在しているバッファのうちで、もっとも大きなバッファ番号 + となる。 Note そのバッファ番号より小さいバッファ番号を持つ(ハ + ズの)バッファが、必ずしも全て存在するとは限らない。なぜなら + ":bwipeout" がバッファを消すことができるからだ。バッファが存在 + するかテストするにはbufexists()を使う。 + *buffer_number()* + 以前の名前: buffer_number(). + *last_buffer_nr()* + bufnr("$")の以前の名前: last_buffer_nr(). + +bufwinid({expr}) *bufwinid()* + その結果は数値で、バッファ{expr}に関連付けられた最初のウィンド + ウの|window-ID|。 {expr}の使い方は前述の|bufname()|を参照。バッ + ファ{expr}が存在しないか、ウィンドウが無い場合は、-1が返され + る。例: > + + echo "A window containing buffer 1 is " . (bufwinid(1)) +< + 現在のタブページのみを処理する。 + + *bufwinnr()* +bufwinnr({expr}) + 結果は数値で、バッファ{expr}に関連付けられた最初のウィンドウの + 番号。{expr}の使い方は前述の|bufname()|を参照。バッファ{expr} + が存在しないか、ウィンドウが無い場合には-1を返す。例: > + + echo "A window containing buffer 1 is " . (bufwinnr(1)) + +< この番号は|CTRL-W_w|や ":wincmd w" |:wincmd|で使える。 + カレントタブページ内のウィンドウだけを探す。 + + *byte2line()* +byte2line({byte}) + カレントバッファの先頭から{byte}番目の文字が、何行目に含まれる + かを返す。これにはカレントバッファの 'fileformat' に依存した、 + 改行文字も含まれる。先頭の文字にはバイトカウント1が与えられる。 + |line2byte()|と|go|と|:goto|も参照。 + {|+byte_offset| 機能付きでコンパイルされたときのみ有効} + +byteidx({expr}, {nr}) *byteidx()* + 文字列{expr}の{nr}番目の文字のバイトインデックスを返す。 + 最初の文字の{nr}は0であり、戻り値は0となる。この関数はマルチバ + イト文字が存在するときのみ有用であり、そうでなければこの関数が + 返す値は{nr}に等しい。 + 合成文字はまとめて計算される。合成文字のバイト数はそれが合成さ + れているベース文字のバイト数に合算される。合成文字を別々に数え + るには |byteidxcomp()| を参照。 + 例 : > + echo matchstr(str, ".", byteidx(str, 3)) +< は4文字目を表示する。次も同じことをする: > + let s = strpart(str, byteidx(str, 3)) + echo strpart(s, 0, byteidx(s, 1)) +< |strgetchar()| と |strcharpart()| も参照。 + {expr}が{nr}文字以下の場合は-1を返す。 + {expr}がちょうど{nr}文字の場合は文字列の長さ(バイト単位)を返す。 + +byteidxcomp({expr}, {nr}) *byteidxcomp()* + byteidx() と同じだが、合成文字は個別にカウントされる。例: > + let s = 'e' . nr2char(0x301) + echo byteidx(s, 1) + echo byteidxcomp(s, 1) + echo byteidxcomp(s, 2) +< 1 番目と 3 番目は 3 が出力される ('e' の長さと合成文字の長さを + 足すと 3 バイト)。2 番目は 1 が出力される ('e' は 1 バイト)。 + 'encoding' に Unicode が設定されているときのみ byteidx() と違う + 動作になる。 + +call({func}, {arglist} [, {dict}]) *call()* *E699* + リスト|List|{arglist}の要素を引数として関数{func}を呼ぶ。 + {func}は|Funcref|でも関数の名前でもよい。 + a:firstlineとa:lastlineにはカレント行が代入される。 + 呼び出した関数の戻り値を返す。 + {dict}は "dict" 属性つきの関数用で、これがローカル変数 "self" + に代入される。|Dictionary-function|を参照。 + +ceil({expr}) *ceil()* + {expr} 以上となる最小の整数を浮動小数点数 |Float| で返す + (切り上げる)。 + {expr} は |Float| か |Number| に評価されなければならない。 + 例: > + echo ceil(1.456) +< 2.0 > + echo ceil(-5.456) +< -5.0 > + echo ceil(4.0) +< 4.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + +ch_canread({handle}) *ch_canread()* + {handle} から何か読むものがあれば非ゼロを返す。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + + これはチャンネルから、都合のよいときに読むのに便利である。例え + ば、タイマーから。 + + チャンネルがコールバックを持っていない場合、メッセージはドロッ + プされることに注意。それを防ぐには close コールバックを追加す + ること。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_close({handle}) *ch_close()* + {handle} を閉じる。|channel-close| を参照。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + 閉じられたコールバックは呼び出されない。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_close_in({handle}) *ch_close_in()* + {handle} の "入力" を閉じる。|channel-close-in| を参照。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + 閉じられたコールバックは呼び出されない。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()* + {handle} へ {expr} を送信する。{expr} はチャンネル側と同じ型に + エンコードされる。この関数は生のチャンネルでは使用できない。 + |channel-use| を参照。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + *E917* + {options} は辞書でなければならない。また "callback" のエントリ + を持ってはならない。また個別のリクエストに対して "timeout" を + 持つ事ができる。 + + ch_evalexpr() は応答を待ち、式をデコードした物が返される。エ + ラーもしくはタイムアウトの場合は空文字列が返る。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()* + {handle} へ {expr} を送信する。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + + |ch_evalexpr()| と同様に動作する。しかしリクエストをエンコード + したり応答をデコードしたりはしない。呼び出しは正しいコンテンツ + である事が保証される。また NL モードでは改行が行われるが、ここ + では改行が付与されない。NL は応答から削除される。 + |channel-use| を参照。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_getbufnr({handle}, {what}) *ch_getbufnr()* + {what} に使用されている {handle} のバッファ番号を得る。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + {what} は標準エラーの為の "err"、標準出力の為の "out"、もしく + はソケット出力の為の空文字列が指定できる。 + バッファが存在しない場合は -1 が返る。 + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_getjob({channel}) *ch_getjob()* + {channel} に関連付けられた Job を得る。 + もしジョブが無い場合、戻り値の Job で |job_status()| を呼び出 + すと "fail" が返される。 + + {|+channel| と |+job| 機能付きでコンパイルされたときのみ有効} + +ch_info({handle}) *ch_info()* + {handle} に関する情報を辞書で返す。アイテムは: + "id" チャネル番号 + "status" ch_status() と同様に、"open", "buffered" ま + たは "closed" + ch_open() で開いた場合: + "hostname" アドレスのホスト名 + "port" アドレスのポート + "sock_status" "open" または "closed" + "sock_mode" "NL", "RAW", "JSON" または "JS" + "sock_io" "socket" + "sock_timeout" タイムアウト(ミリ秒) + job_start() で開いた場合: + "out_status" "open", "buffered" または "closed" + "out_mode" "NL", "RAW", "JSON" または "JS" + "out_io" "null", "pipe", "file" または "buffer" + "out_timeout" タイムアウト(ミリ秒) + "err_status" "open", "buffered" または "closed" + "err_mode" "NL", "RAW", "JSON" または "JS" + "err_io" "out", "null", "pipe", "file" または "buffer" + "err_timeout" タイムアウト(ミリ秒) + "in_status" "open" または "closed" + "in_mode" "NL", "RAW", "JSON" または "JS" + "in_io" "null", "pipe", "file" または "buffer" + "in_timeout" タイムアウト(ミリ秒) + +ch_log({msg} [, {handle}]) *ch_log()* + |ch_logfile()| によってログファイルが開かれている場合はチャン + ネルのログファイルに {msg} を書き込む。 + {handle} が渡されている場合はチャンネル番号がメッセージの中で + 使われる。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。使用されるチャンネル番号のチャンネルは開いていなければな + らない。 + +ch_logfile({fname} [, {mode}]) *ch_logfile()* + {fname} へチャンネルの挙動ログ出力を開始する。 + {fname} が空の場合、ロギングは停止する。 + + {mode} が省略されるか "a" の場合、ファイルへの追加になる。 + {mode} が "w" の場合、空のファイルへで開始される。 + + UNIX で "tail -f" にてリアルタイムで何が行われているかが見える + 様に、ファイルはメッセージ毎にフラッシュされる。 + + +ch_open({address} [, {options}]) *ch_open()* + {address}へのチャンネルを開く。|channel|を参照。 + チャンネルを返す。失敗をチェックするには |ch_status()| を使用 + する。 + + {address} は "localhost:8765" のように "ホスト名:ポート" の形 + 式である。 + + {options} が与えられる場合は辞書でなければならない。 + |channel-open-options| を参照。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_read({handle} [, {options}]) *ch_read()* + {handle} から読み込みメッセージを受信する。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + |channel-more| を参照。 + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_readraw({handle} [, {options}]) *ch_readraw()* + ch_read() と同様に動作するが JS や JSON の場合でもメッセージは + デコードされない。|channel-more| を参照。 + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()* + {handle} へ {expr} を送信する。{expr} はチャンネル側と同じ型に + エンコードされる。この関数は生のチャンネルでは使用できない。 + |channel-use| を参照。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。チャンネルは開いていなければならない。。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()* + {handle} を {string} に送る。 + |ch_sendexpr()| と同様に動作するが、リクエストをエンコードした + り応答をデコードしたりはしない。呼び出しは正しいコンテンツで + ある事が保証される。また NL モードでは改行が行われるが、ここ + では改行が付与されない。NL は応答から削除される。 + |channel-use| を参照。 + + {|+channel| 機能付きでコンパイルされたときのみ有効} + +ch_setoptions({handle}, {options}) *ch_setoptions()* + {handle} にオプションを設定する: + "callback" チャンネルのコールバック + "timeout" デフォルトの読み込みタイムアウト(ミリ秒) + "mode" チャンネル全体のモード + より詳しい説明は |ch_open()| を参照。 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + + Note: モードの変更はキューイングされているメッセージを失ってし + まうかもしれない。 + + 以下のオプションは変更できない: + "waittime" |ch_open()|だけで適用できる + +ch_status({handle} [, {options}]) *ch_status()* + {handle} の状態を返す: + "fail" チャンネルのオープンに失敗 + "open" チャンネルは利用可能 + "buffered" チャンネルは読込可能、または書き込まれ + ていない + "closed" チャンネルは利用不可 + {handle} はチャンネルもしくはチャンネルを持つジョブであっても + 良い。 + チャンネルは閉じられているが |ch_read()| を使って残ったデータ + をまだ読み取る事ができる場合には "buffered" が利用できる。 + + {options} が指定された場合、"part" 要素でチャンネルのどのパー + ト ("out" または "err") の状態を返すかを指定できる。例えば、エ + ラーの状態を得るには: > + ch_status(job, {"part": "err"}) +< +changenr() *changenr()* + 最も最近の変更の番号を返す。|:undolist|で表示される番号と同じ + であり、|:undo|コマンドの引数として使うことができる。 + 変更を行った直後ではその変更の番号となる。redoを行った直後は + redoされた変更の番号となる。undoを行った直後はundoされた変更よ + り1小さい番号になる。 + +char2nr({expr}[, {utf8}]) *char2nr()* + {expr}の最初の文字のASCIIコードを返す。例: > + char2nr(" ") returns 32 + char2nr("ABC") returns 65 +< {utf8} を省略、またはゼロを指定すると、現在の 'encoding' が適 + 用される。"utf-8" の場合の例: > + char2nr("á") returns 225 + char2nr("á"[0]) returns 195 +< {utf8} に 1 を指定すると、常に utf-8 文字として扱われる。 + 合成文字は個別の文字として扱われる。 + |nr2char()| はこの逆を行う。 + +cindent({lnum}) *cindent()* + 'cindent' で使われるのと同じC言語用のインデント規則に従った場 + 合の{lnum}行目のインデント量を返す。 + インデント量はスペースで数えられ、'tabstop' の値は関係ない。 + {lnum}は|getline()|の場合と同様に扱われる。 + {lnum}が無効な値のときや|+cindent|機能なしでコンパイルされてい + るときは-1を返す。 + |C-indenting|を参照。 + +clearmatches() *clearmatches()* + |matchadd()| と コマンド |:match| により定義されたマッチをすべ + て消去する。 + + *col()* +col({expr}) 戻り値は数値で、{expr}で与えられる位置の桁番号(バイトインデッ + クス)。有効な位置は: + . 現在の位置 + $ カレント行の末尾(カレント行のバイト数+1を返す) + 'x マークxの位置(マークが設定されていない場合0) + v ビジュアルモードでは: ビジュアル選択領域の開始行 + (カーソルがその端)。ビジュアルモード以外ではカーソ + ル位置を返す。すぐに更新される点が |'<| と違う。 + さらに {expr} は [lnum, col] という行番号と桁番号のリストで + あってもよい。col に "$" を指定して、ある行の最後の桁を取得す + るのにとても便利である。"lnum" か "col" が範囲外である場合は + 0 を返す。 + 行番号を取得するには|line()|を使う。行番号と桁番号両方を取得す + るには|getpos()|を使う。 + 画面上の桁番号を取得するには|virtcol()|を使う。 + Note 現在のファイルのマークしか使えないことに注意。 + 例: > + col(".") カーソルの桁 + col("$") カレント行の長さ+1 + col("'t") マークtの桁 + col("'" . markname) マークmarknameの桁 +< 先頭の桁は1になる。戻り値0はエラーを意味する。 + 大文字のマークは他のバッファを指しているかもしれない。 + 'virtualedit' が有効なとき、カーソルが行末を越えていると、桁番 + 号は行の長さより1大きい値を返す。挿入モードで桁番号を取得する + には次のマップが使える: > + :imap :let save_ve = &ve + \:set ve=all + \:echo col(".") . "\n" + \let &ve = save_ve +< +complete({startcol}, {matches}) *complete()* *E785* + 挿入モード補完の候補を設定する。 + 挿入モードでのみ使用できる。CTRL-R = (|i_CTRL-R| を参照)と組み + 合わせてマッピングを作る必要がある。CTRL-Oの後や、マッピ + ングの中では正しく動作しない。 + {startcol}は補完すべき単語の開始位置を示す、行内のバイトオフセッ + トである。その位置からカーソルまでのテキストが補完すべき単語と + なる。 + {matches}はリスト|List|でなければならない。リストの各要素が1つ + の候補となる。この要素として許される値については + |complete-items|を参照。 + Note この関数を呼んだ後は補完を停止させるようなテキストの挿入 + をしないように注意しなければならない。 + この関数で設定した候補は普通の挿入モード補完と同じ様にCTRL-Nと + CTRL-Pで選択できる。設定されていればポップアップメニューが表示 + される。|ins-completion-menu|を参照。 + 例: > + inoremap =ListMonths() + func! ListMonths() + call complete(col('.'), ['January', 'February', 'March', + \ 'April', 'May', 'June', 'July', 'August', 'September', + \ 'October', 'November', 'December']) + return '' + endfunc +< この例はそれほど役には立たないが、使い方を示している。Note 0が + 挿入されてしまわないように空文字列を返していることに注意。 + +complete_add({expr}) *complete_add()* + 候補のリストに{expr}を追加する。'completefunc' で指定された関 + 数の中でのみ使われる。 + 失敗したときは0を返す(空文字列かメモリ不足)。候補が追加された + ときは1を返し、その候補が既にリストに存在するときは2を返す。 + {expr}の説明については|complete-functions|を参照。'omnifunc' + が返すリストと同じである。 + +complete_check() *complete_check()* + 補完候補を探している間にキーがタイプされたかどうか確認する。補 + 完の検索に時間がかかる場合に使われる。候補の検索を中断しようと + しているときは|TRUE|を返す。そうでないときは0を返す。 + 'completefunc' で指定された関数の中でのみ使われる。 + + *confirm()* +confirm({msg} [, {choices} [, {default} [, {type}]]]) + confirm()はユーザーに選択させるためのダイアログを提供する。戻 + り値は選択した番号になる。最初の選択肢が1である。 + Note: confirm()は、ダイアログサポートを有効にしてコンパイルし + た時にだけ動作する。|+dialog_con|と|+dialog_gui|を参照。 + + ダイアログには{msg}に加えて{choices}の選択肢が表示される。 + {choices}が指定されない、または空の場合は選択肢 "&OK" が表示さ + れる(使用している言語に翻訳される)。 + {msg}は文字列で '\n' を改行として使用できる。幾つかのシステム + では、長すぎる行は自動的に折り返される。 + + {choices}は文字列で、個々の選択肢は '\n' によって区切られる。 + 例: > + confirm("Save changes?", "&Yes\n&No\n&Cancel") +< '&' の後の文字は選択肢のショートカットキーになる。この場合 + "Cancel" を選択するのに 'c' をタイプすることができる。ショート + カットキーは最初の文字である必要は無い: > + confirm("file has been modified", "&Save\nSave &All") +< コンソールでは、デフォルトのショートカットキーとして、各選択肢 + の最初の文字が使われる。 + + 省略可能な引数{default}はキーを叩いた時に選択される選択肢 + の番号を指定する。最初の選択肢をデフォルトにするならば1を使用 + する。デフォルトを設定したくないのならば0を使用する。 + {default}を省略した場合、1が使用される。 + + 省略可能な引数{type}はダイアログの種類を指定する。これは GTK, + Mac, Motif, Win32 の GUI でアイコンを指定するのに使われる。 + "Error", "Question", "Info", "Warning", "Generic" のうちどれか + 一つを指定する。以上のうちの先頭の文字だけで指定できる。{type} + が省略された場合、"Generic" が使用される。 + + ユーザーがやCTRL-Cや、その他の割りこみキーでダイアログを + 中断した場合、confirm()は0を返す。 + + 例: > + :let choice = confirm("What do you want?", "&Apples\n&Oranges\n&Bananas", 2) + :if choice == 0 + : echo "make up your mind!" + :elseif choice == 3 + : echo "tasteful" + :else + : echo "I prefer bananas myself." + :endif +< GUIのダイアログではボタンが使用される。ボタンの配置は + 'guioptions' の 'v' フラグに依存する。もしも 'v' フラグが含ま + れているのなら、ボタンは常に垂直に配置される。そうでなければ水 + 平に配置しようと試みられる。水平配置がうまくマッチしない場合 + は、垂直配置が使われる。幾つかのシステムでは常に水平配置が使わ + れる。 + + *copy()* +copy({expr}) {expr}のコピーを作る。数値と文字列の場合は、{expr}そのものとコ + ピーの間に違いはない。 + {expr}がリスト|List|の場合は浅いコピーを作る。つまり元のリスト + を変更してもコピーは変更されず、逆も同じである。しかし要素は共 + 通で、片方の要素に対し変更を加えると、もう一方の要素も変更され + る。 + 辞書はリストと同様な方法でコピーされる。 + |deepcopy()|も参照。 + +cos({expr}) *cos()* + {expr} の余弦(コサイン)をラジアンで浮動小数点数 |Float| で返す。 + {expr} は |Float| または |Number| に評価されなければならない。 + 例: > + :echo cos(100) +< 0.862319 > + :echo cos(-4.01) +< -0.646043 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +cosh({expr}) *cosh()* + {expr} の双曲線余弦 (ハイパボリックコサイン) を返す。 + 値は [1, inf] の範囲の浮動小数点数 (|Float|)。 + {expr} は浮動小数点数 (|Float|) か 数値 (|Number|) でなければ + ならない。 + 例: > + :echo cosh(0.5) +< 1.127626 > + :echo cosh(-0.5) +< -1.127626 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +count({comp}, {expr} [, {ic} [, {start}]]) *count()* + リスト|List|または辞書|Dictionary| {comp}の中に値{expr}が何回 + 現れるかを返す。 + {start}が指定されたときはそのインデックスの要素から検索を開始 + する。{start}は{comp}がリストの場合のみ使用できる。 + {ic}が指定され、|TRUE|の場合は大文字・小文字は区別されない。 + + + *cscope_connection()* +cscope_connection([{num} , {dbpath} [, {prepend}]]) + |cscope|接続が存在するかどうか判定する。引数が1個も指定されな + かった場合、戻り値は以下のようになる: + 0, cscopeが利用できない(コンパイル時に無効化されている) + またはcscope接続が存在しない場合 + 1, 1個以上のcscope接続が存在する場合 + + 引数が与えられた場合は次のようになる。{num}は、接続の存在を確 + 認する際のマッチング方法を指定する。 + + {num} 存在確認の方法 + ----- ------------------------------ + 0 引数なしの場合と同じ (例: "cscope_connection()")。 + 1 {prepend}を無視し、{dbpath}に部分マッチを行う。 + 2 {prepend}を無視し、{dbpath}に部分マッチを行う。 + 3 {prepend}を使用し、{dbpath}と{prepend}に部分マッチを行 + う。 + 4 {prepend}を使用し、{dbpath}と{prepend}に完全マッチを行 + う。 + + Note: 以上のどの場合も文字列の比較は大文字・小文字を区別する。 + + 例: ":cs show" の表示が以下のようになったとする: > + + # pid database name prepend path + 0 27664 cscope.out /usr/local +< + 実行 戻り値 ~ + ---------- ---------- > + cscope_connection() 1 + cscope_connection(1, "out") 1 + cscope_connection(2, "out") 0 + cscope_connection(3, "out") 0 + cscope_connection(3, "out", "local") 1 + cscope_connection(4, "out") 0 + cscope_connection(4, "out", "local") 0 + cscope_connection(4, "cscope.out", "/usr/local") 1 +< +cursor({lnum}, {col} [, {off}]) *cursor()* +cursor({list}) + {lnum}行目の{col}桁目(バイトで数える)にカーソルを移動させる。 + 桁番号{col}は1から始まる。 + + 引数に {list} が 1 つだけ指定された場合は、それは要素が 2 個か + 3 個、または 4 個の |List| として解釈される: + [{lnum}, {col}] + [{lnum}, {col}, {off}] + [{lnum}, {col}, {off}, {curswant}] + これは |getpos()| や |getcurpos()| の戻り値とほぼ同じである。 + 違いは最初の要素がないこと。 + + この関数を呼んでもジャンプリストは変更されない。 + {lnum}がバッファの行数よりも大きい場合は、最後の行へ移動する。 + {lnum}が0の場合はカレント行に留まる。 + {col}がその行のバイト数より大きい場合は、その行の最後の文字へ + 移動する。 + {col}が0の場合は、カレント桁に留まる。 + {curswant} が与えられた場合は、縦方向移動の優先的列番号として + 使われる。指定がない場合は {col} が使われる。 + + 'virtualedit' が有効のとき、{off}は文字の先頭からの画面上のオ + フセットを指定する。例えば、の中の位置や最後の文字より後 + などへも移動できる。 + カーソルを移動できたときは 0 を、できなかったときは-1 を返す。 + +deepcopy({expr}[, {noref}]) *deepcopy()* *E698* + {expr}のコピーを作る。数値と文字列の場合は、{expr}そのものとコ + ピーの間に違いはない。 + {expr}がリスト|List|の場合は完全なコピーを作る。つまり元のリス + トを変更してもコピーは変更されず、逆も同じである。要素の1つが + リストまたは辞書であるときは、再帰的にコピーが作成される。 + よってコピーの要素に変更を加えても元のリストの要素は変更を受け + ない。 + 辞書はリストと同様な方法でコピーされる。 + {noref}が省略された、または0のとき、含まれているリストや辞書は + 1度だけコピーされる。全ての参照はこのただ1つのコピーを指す。 + {noref}が1の場合、リストや辞書は現れるたびに新しいコピーが作ら + れる。そのため循環参照があるとdeepcopy()は失敗する。 + *E724* + ネストは100レベルまで可能である。それ以上参照を繰り返している + 要素があると、{noref}が1の場合は失敗する。 + |copy()|も参照。 + +delete({fname} [, {flags}]) *delete()* + {flags}を指定しないもしくは{flags}を空で指定した場合: ファイル + {fname}を削除する。 + これは{fname}がシンボリックリンクの時でも動作する。 + + {flags}が "d" の場合: ディレクトリ{fname}を削除する。 + これはディレクトリ{fname}が空でない場合は失敗する。 + + {flags}が "rf" の場合: ディレクトリ{fname}、その中に含むすべて + のものを再帰的に削除する。気をつけて! + Note: MS-Windowsでは、使用中のディレクトリを削除することはでき + ない。 + + シンボリックリンクは、それが示すものではなく、リンク自身が削除 + される。 + + 結果は数値であり、削除に成功すれば 0、削除に失敗すれば -1 であ + る。 + + バッファから行を削除するには|:delete|を使う。行番号が変数に入っ + ている場合は|:exe|を使う。 + + *did_filetype()* +did_filetype() autocommandが実行されFileTypeイベントが一度でも起こっていれば、 + |TRUE|が返る。スクリプトのFileTypeイベントが、複数回呼び出され + るのを回避するのに使える。 |FileType| + 他のファイルへ移動すると、このカウンタはリセットされる。よって + 実際は、カレントバッファに対してFileTypeイベントが発生したかど + うかを判定する。他のバッファを開くオートコマンドの中でこの関数 + を使って 'filetype' を設定し、構文ファイルを読み込むために使え + る。 + +diff_filler({lnum}) *diff_filler()* + {lnum}行目より上にある削除行の数を返す。削除行とは、差分モード + で他方のウィンドウにテキストが挿入されていることを表す行のこと + である。削除行は表示はされているが、実際にはバッファに存在しな + い。 + {lnum}は|getline()|と同様に扱われる。つまり "." はカレント行と + なり、"'m" はマークmを表す。 + カレントウィンドウが差分モードでないときは0を返す。 + +diff_hlID({lnum}, {col}) *diff_hlID()* + 差分モードで{lnum}行{col}桁(バイト単位)の位置のハイライトIDを + 返す。カレント行に変更がないときは0を返す。 + {lnum}は|getline()|と同様に扱われる。つまり "." はカレント行と + なり、"'m" はマークmを表す。 + 先頭の桁の{col}は1となり、最初の行の{lnum}は1となる。 + ハイライトIDは|synIDattr()|を使って構文情報を得るために使える。 + +empty({expr}) *empty()* + {expr}が空なら1を、そうでなければ0を返す。 + - リスト|List|または辞書|Dictionary|は要素を1個も持たないとき + 空とみなされる。 + - 数値と浮動小数点数は値が0のとき空とみなされる。 + - |v:false|, |v:none|, |v:null| は空であり、|v:true| は空では + ない。 + - ジョブは開始に失敗したときは空である。 + - チャンネルは閉じられていると空である。 + 長いリストに対しては長さを0と比較するよりこちらの方がずっと高 + 速である。 + +escape({string}, {chars}) *escape()* + {string}内に現れる{chars}の文字をバックスラッシュでエスケープ + する。例: > + :echo escape('c:\program files\vim', ' \') +< 結果: > + c:\\program\ files\\vim +< |shellescape()| も参照。 + + *eval()* +eval({string}) {string}を評価し、値を返す。|string()|の戻り値を元の値に戻すの + に非常に便利である。数値、浮動小数点数文字列、それらの複合に対 + して動作する。実際に存在する関数への|Funcref|に対しても動作す + る。 + +eventhandler() *eventhandler()* + イベントハンドラの中では1を返す。つまり、ユーザーの文字入力を + 待っている間に、ファイルをドラッグ&ドロップするなど割り込みさ + れたことを表す。このときは対話的なコマンドは使えない。イベント + ハンドラの中でないときは0を返す。 + +executable({expr}) *executable()* + {expr}という名前の実行可能ファイルが存在するかどうか判定する。 + {expr}は引数を何もつけないプログラム名でなければならない。 + executable()は$PATHと通常のプログラム検索ディレクトリを参照す + る。 *PATHEXT* + MS-DOSとMS-Windowsでは ".exe"、".bat" などの拡張子は含めても含 + めなくてもよい。省略された場合は$PATHEXTの拡張子を検索する。 + よって "foo.exe" が存在しなければ "foo.exe.bat" が見つかること + もありうる。$PATHEXTが存在しなければ ".exe;.com;.bat;.cmd" が + 使われる。$PATHEXTにドットだけを含めると拡張子なしの名前を検索 + することができる。'shell' がUnixシェルのように思われるときは、 + {expr}の後に拡張子をつけない名前も検索される。 + MS-DOSとMS-Windowsではファイルが存在するかどうかだけを判定し、 + それがディレクトリでないことや、それが本当に実行可能であるかど + うかは判定されない。 + MS-WindowsではVimと同じディレクトリにある実行ファイルは必ず発 + 見できる。Vimがこのディレクトリを$PATHに加えるためである。 + |win32-PATH|。 + 戻り値は数値: + 1 存在する + 0 存在しない + -1 このシステム上では実装されていない + +execute({command} [, {silent}]) *execute()* + 単一あるいは複数のExコマンドを実行して、出力を文字列として返 + す。 + {command} は文字列かリストを使える。リストの場合はそれらの行は + 一行ずつ実行される。 + 以下と同等である: > + redir => var + {command} + redir END +< + オプションの {silent} の引数は以下の値を取ることができる: + "" `:silent` を使わない + "silent" `:silent` を使う + "silent!" `:silent!`を使う + デフォルトは "silent" である。 Note "silent!" は `redir` とは + 異なり、エラーメッセージは削除されることに注意すること。もし外 + 部コマンドを使って画面がおかしくなる様であれば、代わりに + `system()`を使うことができる。 + *E930* + {command} の中のどこかで`:redir`を使うことができない。 + + 行のリストを得るために、出力に|split()|を使うことができる: +> + split(execute('args'), "\n") + +< 再帰的に使用されると、再帰呼び出しの出力は、上位呼び出しの出力 + に含まれません。 + +exepath({expr}) *exepath()* + {expr} が実行ファイルで、それが絶対パス、相対パス、または + $PATH の中に存在する場合は、そのフルパスを返す。 + Note: {expr} が "./" で開始している場合はカレントディレクトリ + が使われる。Vim のパスを得る場合に問題になるかもしれない: > + echo exepath(v:progpath) +< {expr} が $PATH の中に見つからないか、それが実行ファイルではな + かった場合は空文字列が返る。 + + *exists()* +exists({expr}) 結果は数値で、変数{expr}が存在すれば|TRUE|となり、そうでなけれ + ば0となる。 + + ある機能がサポートされているか判定するには|has()|を使う。 + ファイルが存在するかを判定するには|filereadable()|を使う。 + + 引数{expr}は文字列で次のうちいずれかである。 + &option-name Vimオプション(存在するかだけを判定し、 + 本当に動作するかは判定しない) + +option-name 動作するVimオプション + $ENVNAME 環境変数(空文字列と比較することでも判 + 定できる) + *funcname 組み込み関数(|functions|参照)かユーザー + が定義した関数(|user-functions|参照)。 + また Funcref である変数に対しても動作 + する。 + varname 内部変数(|internal-variables|) + |curly-braces-names|, |Dictionary|の要 + 素、|List|の要素などに対しても動作する。 + インデックスの評価で無効な式であるとエ + ラーメッセージが出る可能性があることに + 注意。例: > + :let l = [1, 2, 3] + :echo exists("l[5]") +< 0 > + :echo exists("l[xx]") +< E121: Undefined variable: xx + 0 + :cmdname exコマンド: 組み込みコマンド、ユーザー + 定義コマンド、コマンド修飾子|:command|。 + 戻り値: + 1 コマンド名の先頭に一致 + 2 コマンド名に完全一致 + 3 複数のユーザー定義コマンドに一致 + コマンドが定義されているかどうかを判定 + するには、必ず戻り値が2であるかを確認 + すること。 + :2match |:2match|のコマンド。 + :3match |:3match|のコマンド。 + #event このイベントに対するオートコマンド定義 + #event#pattern このイベントとパターンに対するオートコ + マンド定義(パターンは文字そのままに解 + 釈され、オートコマンドのパターンと1文 + 字ずつ比較される) + #group オートコマンドグループが存在するか + #group#event このグループとイベントに対してオートコ + マンドが定義されているか + #group#event#pattern + このグループ、イベント、パターンに対す + るオートコマンド定義 + ##event このイベントに対するオートコマンドがサ + ポートされているか + + 例: > + exists("&shortname") + exists("$HOSTNAME") + exists("*strftime") + exists("*s:MyFunc") + exists("bufcount") + exists(":Make") + exists("#CursorHold") + exists("#BufReadPre#*.gz") + exists("#filetypeindent") + exists("#filetypeindent#FileType") + exists("#filetypeindent#FileType#*") + exists("##ColorScheme") +< シンボルである&/$/*と名前の間には、空白文字があってはならな + い。 + ある少数の場合では無視されるが、名前の後に余計な文字があっては + ならない。将来はもっと厳格になる可能性があるので、現在許される + からといって頼ってはならない。 + 正しい例: > + exists(":make") +< 正しくない例: > + exists(":make install") + +< Note 引数は変数そのものではなく、文字列でなければならない。例 + えば、次は動作しない: > + exists(bufcount) +< これは変数 "bufcount" の存在を判定するのではなく、bufcountの値 + を渡し、それが存在するかどうか判定してしまう。 + +exp({expr}) *exp()* + {expr} の指数を返す。 + 値は [0, inf] の範囲の浮動小数点数 (|Float|)。 + {expr} は浮動小数点数 (|Float|) か数値 (|Number|) でなければな + らない。 + 例: > + :echo exp(2) +< 7.389056 > + :echo exp(-1) +< 0.367879 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +expand({expr} [, {nosuf} [, {list}]]) *expand()* + ワイルドカードと{expr}内の特殊なキーワードを展開する。 + 'wildignorecase' が適用される。 + + {list} が指定されその値が|TRUE|なら、結果はリストで返される。 + そうでない場合は結果は文字列で返される。その場合、複数のマッチ + があるときはそれらは文字 で区切られる。[Note: バージョン + 5.0 では空白文字が用いられ、スペースを含むファイル名について問 + 題を引き起こしていた] + + 展開が失敗した場合、結果は空文字列となる。{expr} が '%'、'#'、 + '<' で始まらない限り、存在しないファイル名というのは、結果の文 + 字列には含まれない。下記を参照のこと。 + + {expr} が '%' か '#' か '<' で始まる場合には、展開は + |cmdline-special|のように、変換子を受け付け、それらに関連付け + られた変換が施される。ここに簡単な概略を示す: + + % 現在のファイル名 + # 代替バッファのファイル名 + #n n番の代替バッファのファイル名 + カーソルの下のファイル名 + autocmdのファイル名 + autocmdのバッファ名 + 取り込み(source)中のファイル名、関数名 + 取り込み(source)中の行番号 + カーソル下の単語(word) + カーソル下の単語(WORD) + 最後に受け取ったメッセージの{clientid} + |server2client()| + 変換子: + :p フルパス名を展開 + :h ヘッド(ディレクトリ) + :t テイル(ファイル名だけ) + :r 拡張子が削除される + :e 拡張子だけ + + 例: > + :let &tags = expand("%:p:h") . "/tags" +< '%' や '#' や '<' で始まる文字列を展開する時には、それに続くテ + キストは無視されることに注意。従ってこれは正しくない: > + :let doesntwork = expand("%:h.bak") +< こうすると良い: > + :let doeswork = expand("%:h") . ".bak" +< "" やそれらを展開する時には、戻り値が完全な展開をされな + い参照名であることにも注意が必要。もしも "" が + "~/.cshrc" であった場合、"~/" を展開してホームディレクトリにす + るために、もう一度expand()を呼び出す必要がある: > + :echo expand(expand("")) +< + 変数と変換子の間には空白文字があってはならない。関数 + |fnamemodify()|が通常のファイル名の変換には使用可能である。 + + カレントバッファや代替バッファの名前が未定義のときに '%' や + '#' を使うと空文字列になる。"%:p" を名無しのバッファに使用した + 場合、結果はカレントディレクトリに '/' が付加されたものになる。 + + '%' や '#' や '<' で始まらない{expr}は、コマンドラインのファイ + ル名と同じように展開される。{nosuf}引数に|TRUE|を指定しない限 + り、'suffixes' と 'wildignore' が使用される。 + 存在しないファイルの名前も結果の文字列に含まれる。"**" を使う + とディレクトリツリーを検索できる。例えば、カレントディレクトリ + 以下にある全ての "README" を見つけるには次のようにする: > + :echo expand("**/README") +< + expand() はシェルの持っている変数や環境変数を展開できる。しか + し展開のためにシェルを起動するかもしれないので速度が遅くなるこ + とがある。|expr-env-expand| 参照。 + 展開された変数はファイル名のリストのように扱われる。環境変数を + 展開できないときはそのままになる。よって、 + ":echo expand('$FOOBAR')" の結果は "$FOOBAR" となる。 + + 存在するファイルを探すには|glob()|を参照。外部コマンドの「生 + の」実行結果を扱うには|system()|を参照。 + +extend({expr1}, {expr2} [, {expr3}]) *extend()* + {expr1}と{expr2}は両方ともリスト|List|であるか、両方とも辞書 + |Dictionaries|でなければならない。 + + 両方ともリストであるなら、{expr2}を{expr1}に付け加える。 + {expr3}が指定された場合は、{expr1}の第{expr3}番目の要素の前に + {expr2}の要素を挿入する。{expr3}が0のときは最初の要素の前に挿 + 入する。{expr3}がlen({expr1})に等しいときは末尾に{expr2}が付け + 加えられる。 + 例: > + :echo sort(extend(mylist, [7, 5])) + :call extend(mylist, [2, 3], 1) +< {expr1} が {expr2} と同じリストである場合、コピーされる要素の + 数はリストの元の長さと同じである。 + 例として {expr3} が 1 のとき、最初の要素の N 個の新しいコピー + が挿入される(ここで N はリストの元の長さ)。 + リストに1個の要素を加えるには|add()|を使う。2つのリストを連結 + して新しいリストを作るには演算子+を使う: > + :let newlist = [1, 2, 3] + [4, 5] +< + 両方とも辞書である場合: + {expr2}の全要素を{expr1}に加える。 + {expr1}と{expr2}で共通のキーがある場合は、{expr3}によって動作 + が決まる: + {expr3} = "keep" の場合: {expr1}の値そのままにする + {expr3} = "force" の場合: {expr2}の値で上書きする + {expr3} = "error" の場合: エラーメッセージを表示する *E737* + {expr3}が省略された場合は "force" と同じになる。 + + {expr2}が空でないならば{expr1}が変更される。必要ならば最初に + {expr1}のコピーを作ること。 + {expr2}は変更されない。 + {expr1} がロックされていて、かつ {expr2} が空でない場合は操作 + は失敗する。 + {expr1}を返す。 + + +feedkeys({string} [, {mode}]) *feedkeys()* + {string}中の各文字を、あたかもマッピングまたはユーザーによって + タイプされたかのように、処理キューに入れる。デフォルトではこれ + らの文字は先行入力バッファの末尾に付け足される。そのためマッピ + ングを展開している途中であれば、これらの文字はマッピングを展開 + した後に来ることになる。他の文字の前に挿入するには、'i' フラグ + を使用する。それらはマッピングからの任意の文字の前の挿入の次に + 実行される。 + この関数は、{string}中の文字が処理されるまでは待たない。 + 特殊なキーを{string}に含めるにはダブルクォートと "\..." 記法を + 使う(|expr-quote|を参照)。例えば、feedkeys("\")は + キーの押下をシミュレートする。しかしfeedkeys('\')とすると、 + この文字の通り5文字を挿入する。 + {mode}が省略されたときは、挿入されたキーはマップ展開の対象にな + る。{mode}は以下の文字フラグを含む文字列: + 'm' キーをマップ展開する。これが既定である。 + 'n' キーをマップ展開しない。 + 't' キーをタイプされたかのように扱う。そうでない場合は + マッピングから展開されたかのように扱われる。これは + undoや折り畳みの展開などで違いが現れる。 + 'i' 追加する代わりに文字を挿入する。(上記参照) + 'x' 先行入力が空になるまでコマンドを実行する。 + これは ":normal!" を使うのと似ている。 + 'x' なしで数回feedkeys()を呼んだ後、'x' ありで1回 + ({string}が空でも可能) feedkeys()を呼ぶことで先行入力 + をすべて実行できる。Note Vimが挿入モードを終了したとき + は、スクリプト続行前の文字入力待ちによる立ち往生を避け + るために、が入力されたかのように振る舞う。 + '!' 'x' と一緒に使用すると挿入モードを終了しない。タイマー + が少し後で挿入モードを終了するように設定されているとき + にテストで使用できる。CursorHoldIのテストに便利である。 + + 戻り値は常に0。 + + *filereadable()* +filereadable({file}) + 結果は数値で、{file}というファイルが存在し、読みこむことが可能 + ならば|TRUE|となる。ファイル{file}が存在しないかディレクトリ + だった場合には、結果は|FALSE|となる。引数{file}は文字列として + 使えればどのような表現でもよい。 + ファイルが読み込み可能でなくてもよい場合には|glob()|を使う。 + *file_readable()* + 以前の名前: file_readable(). + +filewritable({file}) *filewritable()* + 結果は数値で、{file}というファイルが存在し、書き込むことが可能 + ならば1となる。ファイル{file}が存在しないか書き込み不可能であ + る場合には、結果は0となる。{file}がディレクトリであり、書き込 + み可能な場合、結果は2となる。 + + +filter({expr1}, {expr2}) *filter()* + {expr1}はリスト|List|または辞書|Dictionary|でなければならない。 + {expr1}の各要素に対して{expr2}を評価し、その結果が0ならばリス + トまたは辞書からその要素を削除する。 + {expr2}は文字列|string|または関数参照|Funcref|でなければならな + い。 + + {expr2}が文字列の場合、{expr2}の内部では|v:val|が現在の要素の + 値を保持している。辞書の場合は|v:key|が現在の要素のキーを保持 + しており、リストの場合は|v:key|が現在の要素のインデックスを保 + 持している。 + 例: > + call filter(mylist, 'v:val !~ "OLD"') +< は要素 "OLD" を削除する。 > + call filter(mydict, 'v:key >= 8') +< は8未満のキーを持つ要素を削除する。 > + call filter(var, 0) +< は全要素を削除する。つまりリストまたは辞書をクリアする。 + + Note {expr2}は式を表す文字列である。バックスラッシュを二重に + しなくても済むように|literal-string|を使うとよいだろう。ただし + その場合はシングルクォートを二重にしなければならない。 + + {expr2}が|Funcref|の場合は、2つの引数で呼び出される: + 1. 現在の要素のキーまたはインデックス。 + 2. 現在の要素の値。 + 関数は、その要素を保持すべきときは|TRUE|を返さなければならな + い。リストの奇数版目の要素を保持する例: > + func Odd(idx, val) + return a:idx % 2 == 1 + endfunc + call filter(mylist, function('Odd')) +< |lambda| を使えばより短く書ける: > + call filter(myList, {idx, val -> idx * val <= 42}) +< "val" を使わない場合は省略できる: > + call filter(myList, {idx -> idx % 2 == 1}) +< + この操作はその場で(in-place)行われる。リストや辞書を変更したく + ない場合は最初にコピーを作ること: > + :let l = filter(copy(mylist), 'v:val =~ "KEEP"') + +< {expr1}のリストまたは辞書をフィルターした結果を返す。{expr2}を + 評価している最中にエラーが発生した場合は、{expr1}内のそれ以降 + の要素の処理は行われない。{expr2}が関数参照の場合、関数が + "abort" フラグつきで定義されていない限り、関数内のエラーは無視 + される。 + + +finddir({name}[, {path}[, {count}]]) *finddir()* + {path}から{name}という名前のディレクトリを探す。ディレクトリを + 上方・下方のどちらにも再帰的に検索できる。{path}の記法について + は|file-searching|を参照。 + 最初に見つかったディレクトリのパスを返す。そのディレクトリがカ + レントディレクトリの下にある場合は相対パスを返す。そうでなけれ + ば絶対パスを返す。 + {path}が省略されたとき、または空のときはオプション 'path' の値 + が使われる。 + 省略可能な引数{count}が指定されたときは、最初に見つかったディ + レクトリでなく、{count}番目に見つかったディレクトリを返す。 + {count}が負の場合は、見つかったディレクトリ全てのリスト|List| + を返す。これはexコマンド|:find|によく似ている。 + {|+file_in_path| 機能付きでコンパイルされたときのみ利用可能} + +findfile({name}[, {path}[, {count}]]) *findfile()* + |finddir()|と同様だが、ディレクトリでなくファイルを検索する。 + 'suffixesadd' が適用される。 + 例: > + :echo findfile("tags.vim", ".;") +< この例は、カレントファイルがあるディレクトリから上方に + "tags.vim" を見つけるまで再帰的に検索する。 + +float2nr({expr}) *float2nr()* + {expr} の小数点以下を切り捨てて |Number| に変換する。 + {expr} は |Float| または |Number| に評価されなければならない。 + {expr} の値が |Number| の範囲外の場合、結果は 0x7fffffff また + は -0x7fffffff になる(64ビット数値が有効化されている場合は + 0x7fffffffffffffff または -0x7fffffffffffffff)。 + NaN は -0x80000000 になる(64ビット数値が有効化されている場合は + -0x8000000000000000)。 + 例: > + echo float2nr(3.95) +< 3 > + echo float2nr(-23.45) +< -23 > + echo float2nr(1.0e100) +< 2147483647 (または 9223372036854775807) > + echo float2nr(-1.0e150) +< -2147483647 (または -9223372036854775807) > + echo float2nr(1.0e-100) +< 0 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +floor({expr}) *floor()* + {expr} 以下の最大の整数を |Float| で返す(切り捨て)。 + {expr} は |Float| または |Number| に評価されなければならな + い。 + 例: > + echo floor(1.856) +< 1.0 > + echo floor(-5.456) +< -6.0 > + echo floor(4.0) +< 4.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +fmod({expr1}, {expr2}) *fmod()* + {expr1} / {expr2} の余りを返す (割り算が表現できなくても)。 + {expr2} が非ゼロなら {expr1} - i * {expr2} の結果を返す (i は + 戻り値が {expr1} と同じ符号を持ちその絶対値が {expr2} よりも小 + さくなるような値)。{expr2} がゼロならゼロが返る。戻り値の型は + 浮動小数点数 (|Float|)。 + {expr1} と {expr2} は浮動小数点数 (|Float|) か数値 (|Number|) + でなければならない。 + 例: > + :echo fmod(12.33, 1.22) +< 0.13 > + :echo fmod(-12.33, 1.22) +< -0.13 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +fnameescape({string}) *fnameescape()* + コマンド引数のファイル名として使うために {string} をエスケープ + する。'%' や '|' など特別な意味を持つ全ての文字がバックスラッ + シュでエスケープされる。 + 特別な文字とは、ほとんどのシステムにおいて + " \t\n*?[{`$\\%#'\"|!<" である。ファイル名にバックスラッシュが + 現れるシステムにおいては 'isfname' の値に依存する。 + 先頭の '+' と '>' もエスケープされる(|:edit| と |:write| の引 + 数では特別な意味を持つ)。{string} が "-" である場合もエスケー + プされる(|:cd| の引数では意味を持つ)。 + 例: > + :let fname = '+some str%nge|name' + :exe "edit " . fnameescape(fname) +< 上記は次と同じ結果になる: > + edit \+some\ str\%nge\|name + +fnamemodify({fname}, {mods}) *fnamemodify()* + ファイル名{fname}を{mods}にしたがって変更する。{mods}はコマン + ドラインで使われるのと同様な文字列である。詳細は + |filename-modifiers|を参照。 + 例: > + :echo fnamemodify("main.c", ":p:h") +< 結果: > + /home/mool/vim/vim/src/ +< Note: {fname}の中の環境変数は展開されない。環境変数を展開させ + るには|expand()|を使うこと。 + +foldclosed({lnum}) *foldclosed()* + 結果は数値。{lnum}行目が閉じた折り畳みの中にあるなら、その折り + 畳みを構成する最初の行の行番号を返す。{lnum}行目が閉じた折り畳 + みに入っていないなら-1を返す。 + +foldclosedend({lnum}) *foldclosedend()* + 結果は数値。{lnum}行目が閉じた折り畳みの中にあるなら、その折り + 畳みを構成する最後の行の行番号を返す。{lnum}行目が閉じた折り畳 + みに入っていないなら-1を返す。 + +foldlevel({lnum}) *foldlevel()* + カレントバッファの{lnum}行目の折り畳みレベルを表す数値を返す。 + 折り畳みがネストしているときは一番下のレベルを返す。{lnum}行目 + に折り畳みがまったくないときは0を返す。折り畳みが開いているか + 閉じているかは関係ない。('foldexpr' の中で)折り畳みを更新して + いる最中に呼ぶと、まだ折り畳みを更新していなく、折り畳みレベル + が未知の行に対しては-1を返す。特別な場合として、普通は1行前の + レベルは取得できる。 + + *foldtext()* +foldtext() 閉じた折り畳みに表示する文字列を返す。これはオプション + 'foldtext' のデフォルトの関数であり、'foldtext' を評価している + ときにだけ呼ぶようにすべきである。この関数は変数|v:foldstart|, + |v:foldend|, |v:folddashes|を使用する。 + 戻り値の文字列は次のようになる: > + +-- 45 lines: abcdef +< + ダッシュ(-)の数は折り畳みレベルによって決まる。"45" はその折り + 畳みに含まれている行数である。"abcdef" はその折り畳みの中の最 + 初の空行でない行のテキストである。行頭の空白と、"//" や "/*"、 + 'foldmarker' と 'commentstring' に設定されている文字列は削除さ + れる。 + {|+folding|機能付きでコンパイルされたときのみ利用可能} + +foldtextresult({lnum}) *foldtextresult()* + {lnum}行目の閉じた折り畳みに表示される文字列を返す。'foldtext' + を適切なコンテキストの中で評価する。{lnum}行目に閉じた折り畳み + がないときは空文字列を返す。 + {lnum}は|getline()|のときと同様に扱われる。つまり "." はカレン + ト行、"'m" はマークmを表す。 + 折り畳まれたテキストをHTMLなどにエクスポートするときに有用。 + {|+folding|機能付きでコンパイルされたときのみ利用可能} + + *foreground()* +foreground() Vimのウィンドウを前面に移動する。この関数はクライアントからVim + サーバーへ送ると便利である。|remote_send()| + Win32では自分自身のウィンドウを前面に持ってくることが必ずしも + 許可されていないので、動作しないかもしれない。そのときは代わり + に|remote_foreground()|を使うこと。 + {Win32, Athena, Motif, GTKいずれかのGUI版とWin32コンソール版で + のみ利用できる} + + *funcref()* +funcref({name} [, {arglist}] [, {dict}]) + |function()|と全く同じである。ただし、Funcrefは名前ではなく関 + 数の参照で検索された関数の参照を返す。これは関数{name}が後で + 再定義されるときに重要である。 + + |function()|とは違い、{name}はユーザー定義関数として存在してい + なければならない。また、autoload関数についても同様である。 + {name}は組込み関数であってはならない。 + + *function()* *E700* *E922* *E923* +function({name} [, {arglist}] [, {dict}]) + 関数{name}を参照する|Funcref|の変数を返す。{name}はユーザー定義 + 関数でも組み込み関数でもよい。 + + ここで{name}は関数の参照、もしくは部分適用である。部分適用であ + るとき、それに格納されている辞書が使用され、{dict}引数が使用で + きない。例: > + let FuncWithArg = function(dict.Func, [arg]) + let Broken = function(dict.Func, [arg], dict) +< + Funcrefが利用されるとき、その関数は{name}から見つけられる。こ + れは後で再定義された場合も同様である。常に同じ関数を見つけるた + めには|funcref()|を使うこと。 + + {arglist}もしくは{dict}が与えられると、関数の部分適用が作られ + る。すなわち引数のリスト及び/または辞書はFuncrefに格納され、 + そのFuncrefが呼ばれるときに使用される。 + + 格納された引数は他の引数よりも前に関数に渡される。例えば: > + func Callback(arg1, arg2, name) + ... + let Func = function('Callback', ['one', 'two']) + ... + call Func('name') +< 関数は次のように呼び出す: > + call Callback('one', 'two', 'name') + +< function()はFuncrefにより多くの引数を加えるためにネストして呼 + び出すことができる。余分な引数は、引数のリストに追加される。 + 例えば: > + func Callback(arg1, arg2, name) + ... + let Func = function('Callback', ['one']) + let Func2 = function(Func, ['two']) + ... + call Func2('name') +< これは次のように関数を呼び出す: > + call Callback('one', 'two', 'name') + +< 辞書は "dict" 関数を呼び出すときのみ有用である。この場合、 + {dict}は "self" として渡される。例えば: > + function Callback() dict + echo "called for " . self.name + endfunction + ... + let context = {"name": "example"} + let Func = function('Callback', context) + ... + call Func() " will echo: called for example +< 余分な引数がない場合、funciton()は必要ない。以下の二つは同等で + ある: > + let Func = function('Callback', context) + let Func = context.Callback + +< 引数のリストと辞書を同時に使用することもできる: > + function Callback(arg1, count) dict + ... + let context = {"name": "example"} + let Func = function('Callback', ['one'], context) + ... + call Func(500) +< これは次のように関数を呼び出す: > + call context.Callback('one', 500) + + +garbagecollect([{atexit}]) *garbagecollect()* + 循環参照を持ち、使われていないリスト|List|、辞書 + |Dictionaries|、チャンネル|Channels|、ジョブ|Jobs| をクリーン + アップする。 + + これはメモリ不足に陥ったときや、'updatetime' 経過後ユーザーの + キー入力を待っているときに自動的に行われるので、この関数を呼ぶ + 必要があることはほとんどない。循環参照を持たない要素は、使われ + なくなったとき必ず解放される。長時間実行されるスクリプトの中で + 循環参照を持つ非常に大きなリストや辞書を削除したときに有用であ + る。 + + 省略可能な引数 {atexit} に 1 を指定すると、Vim を終了するとき + にもガーべッジコレクションが行われる。これはメモリリークを発見 + するのに役に立つ。 + + ガーベッジコレクションはすぐには実行されず、安全な場合のみ実行 + される。これはユーザーが文字を入力するのを待っているときであ + る。ガーベッジコレクションを強制するには、すぐに + |test_garbagecollect_now()|を使用すること。 + +get({list}, {idx} [, {default}]) *get()* + リスト|List| {list}から{idx}番目の要素を取得する。この要素を取 + 得できないときは{default}を返す。{default}が省略されたときは0 + を返す。 +get({dict}, {key} [, {default}]) + 辞書|Dictionary| {dict}からキー{key}に関連づけられた値を取得す + る。この要素を取得できないときは{default}を返す。{default}が省 + 略されたときは0を返す。 +get({func}, {what}) + Funcref {func}から項目を取得する。{what}の可能な値は: + "name" 関数名 + "func" 関数 + "dict" 辞書 + "args" 引数リスト + + *getbufinfo()* +getbufinfo([{expr}]) +getbufinfo([{dict}]) + バッファの情報を辞書のリストとして取得する。 + + 引数なしの場合、すべてのバッファに関する情報が返される。 + + 引数が辞書の場合、指定された条件を満たすバッファのみが返され + る。{dict}には以下のキーを指定できる: + buflisted リストされたバッファのみを含む。 + bufloaded ロードされたバッファのみを含む。 + + それ以外の場合、{expr}は情報を返す特定のバッファを指定する。 + {expr}の使用については、上記の|bufname()|を参照。バッファが見 + つかった場合、返されるListには1つの項目がある。それ以外の場合、 + 結果は空のリストになる。 + + 返される各List項目は、次のエントリを持つ辞書である: + bufnr バッファ番号。 + changed バッファが変更されている場合はTRUE。 + changedtick バッファに加えられた変更の数。 + hidden バッファが隠されている場合はTRUE。 + listed バッファがリストされている場合はTRUE。 + lnum バッファ内の現在の行番号。 + loaded バッファがロードされている場合はTRUE。 + name バッファ内のファイルへのフルパス。 + signs バッファに配置された目印のリスト。 + 各リスト項目は、次のフィールドを含む辞 + 書である: + id 目印識別子 + lnum 行番号 + name 目印名 + variables バッファローカル変数の辞書への参照。 + windows バッファを表示する|window-ID|のリスト + + 例: > + for buf in getbufinfo() + echo buf.name + endfor + for buf in getbufinfo({'buflisted':1}) + if buf.changed + .... + endif + endfor +< + バッファローカルオプションを取得するには: > + getbufvar({bufnr}, '&') + +< + *getbufline()* +getbufline({expr}, {lnum} [, {end}]) + バッファ{expr}の{lnum}行目から{end}行目まで(両端含む)の行から + なるリスト|List|を返す。{end}が省略されたときは{lnum}行目だけ + からなるリストを返す。 + + {expr}の指定の仕方については|bufname()|を参照。 + + {lnum}と{end}では "$" でバッファの最後の行を表すことができる。 + それ以外は数値でなければならない。 + + {lnum}が1より小さいときや、バッファの行数より大きいときは空リ + ストを返す。 + + {end}がバッファの行数より大きいときは、バッファの行数が設定さ + れたものとして扱う。{end}が{lnum}行目より前に設定された場合は + 空リストを返す。 + + この関数は読み込まれているバッファに対してのみ動作する。既にア + ンロードされているバッファや存在しないバッファに対しては空リス + トを返す。 + + 例: > + :let lines = getbufline(bufnr("myfile"), 1, "$") + +getbufvar({expr}, {varname} [, {def}]) *getbufvar()* + バッファ{expr}のオプションの値やバッファローカル変数{varname} + の値を返す。Note "b:" をつけない変数名を指定すること。 + {varname} が空文字列の場合、全てのバッファローカル変数からなる + 辞書を返す。 + {varname} が "&" に等しいとき、すべてのバッファローカルオプショ + ンを持つ辞書を返す。 + そうでなく、{varname} が "&" で始まるとき、バッファローカルオ + プションの値を返す。 + グローバルオプション、バッファローカルオプションのどちらに対し + ても動作するが、グローバル変数、ウィンドウローカル変数、ウィン + ドウローカルオプションに対しては動作しない。 + {expr}の指定の仕方については|bufname()|を参照。 + バッファや変数が存在しないときは{def}または空文字列を返し、エ + ラーメッセージは表示されない。 + 例: > + :let bufmodified = getbufvar(1, "&mod") + :echo "todo myvar = " . getbufvar("todo", "myvar") +< +getchar([expr]) *getchar()* + ユーザーまたは入力ストリームから1文字を取得する。 + [expr] が省略されたときは1文字を取得できるまで待つ。 + [expr] が0のときは1文字を取得できる場合のみ取得する。取得でき + なければ0を返す。 + [expr] が1のときは1文字を取得できるか判定し、実際には取得しな + い。取得できないときは0を返す。 + + [expr] が省略されたときや [expr] が0のときは、文字全体または特 + 殊キーを返す。それが8ビット文字なら戻り値は数値である。これを + 文字列に戻すにはnr2char()を使う。8ビット文字でないならばエン + コードして文字列にして返す。 + 特殊キーとは0x80(10進数で128)で始まるバイト列である。これは + 文字列 "\" と同じ値である(例: "\")。戻り値は文字列 + であり、修飾キー(shift, control, alt)は含まれない。 + + [expr] が0や Esc が入力された場合は、これがエスケープシーケン + スの始まりであるかどうかをVimが知るために待つ間、短い遅延があ + るだろう。 + + [expr] が1のときは最初のバイトだけを返す。1バイト文字の場合、 + これはその文字そのものを表す数値である。これを文字列に変換する + にはnr2char()を使う。 + + 修飾キーを取得するには getcharmod() を使う。 + + ユーザーがマウスをクリックしたときはマウスイベントを返す。クリッ + クした位置は|v:mouse_col|, |v:mouse_lnum|, |v:mouse_winid|, + |v:mouse_win|で得られる。以下の例は、普通にマウスがクリックさ + れたときと同じようにカーソルを移動させる。 > + let c = getchar() + if c == "\" && v:mouse_win > 0 + exe v:mouse_win . "wincmd w" + exe v:mouse_lnum + exe "normal " . v:mouse_col . "|" + endif +< + bracketed pasteを使用しているときは最初の文字のみが返され、ペー + ストされた残りのテキストは切り捨てられる。 + |xterm-bracketed-paste|. + + この関数を呼んだときプロンプトは表示されない。文字入力を待って + いることをなんらかの方法でユーザーがわかるようにしなければなら + ないだろう。 + 入力された文字に対してマッピングは適用されない。 + キーコードは置換される。つまりユーザーがを押した場合、 + 「生の」文字シーケンスでなくキーに対応するコードが得られ + る。 + 例: > + getchar() == "\" + getchar() == "\" +< 以下の例は大文字・小文字を区別しないように "f" を再定義する: > + :nmap f :call FindChar() + :function FindChar() + : let c = nr2char(getchar()) + : while col('.') < col('$') - 1 + : normal l + : if getline('.')[col('.') - 1] ==? c + : break + : endif + : endwhile + :endfunction +< + あなたは||のような合成文字も取得するかもしれない。 + 多くの場合、あなたはこれを無視して別の文字を取得することにな + る: > + :function GetKey() + : let c = getchar() + : while c == "\" + : let c = getchar() + : endwhile + : return c + :endfunction + +getcharmod() *getcharmod()* + 最後にgetchar()などで得た文字に対する修飾キーの状態を表す数値 + を返す。以下の値の和となる: + 2 shift + 4 control + 8 alt (meta) + 16 meta (ALT と META が区別される場合) + 32 マウスのダブルクリック + 64 マウスのトリプルクリック + 96 マウスのクアドラプルクリック (== 32 + 64) + 128 command (Macintosh のみ) + 文字自身に含まれていない修飾キーのみ取得できる。つまり、 + Shift-aは修飾キーなしの "A" となる。 + +getcharsearch() *getcharsearch()* + 現在の文字検索の情報である{dict}を返し、この辞書は下記のエント + リを持つ: + + char 文字検索(|t|, |f|, |T|, |F|)で以前に使われた文字。 + もし文字検索が実行されていないなら空文字列。 + forward 文字検索の方向。1は前方、0は後方。 + until 文字検索の種類。1は|t|もしくは|T|の文字検索、0は + |f|もしくは|F|の文字検索。 + + 下記の設定は前回の文字検索の方向に関わらず、|;| で前方検索、 + |,| で後方検索を常に行えるようになり便利である: > + :nnoremap ; getcharsearch().forward ? ';' : ',' + :nnoremap , getcharsearch().forward ? ',' : ';' +< |setcharsearch()|も参照。 + +getcmdline() *getcmdline()* + 現在のコマンドラインの内容を取得する。コマンドラインを編集して + いるときのみ動作する。つまり|c_CTRL-\_e|または|c_CTRL-R_=|を使っ + ているときのみ有効。 + 例: > + :cmap eescape(getcmdline(), ' \') +< |getcmdtype()|, |getcmdpos()|, |setcmdpos()|も参照。 + +getcmdpos() *getcmdpos()* + コマンドラインにおけるカーソル位置をバイト単位で取得する。最初 + の桁は1となる。コマンドラインを編集しているときのみ動作する。 + つまり|c_CTRL-\_e|または|c_CTRL-R_=|または式マッピングを使って + いるときのみ有効。そうでないときは 0 を返す。 + |getcmdtype()|, |setcmdpos()|, |getcmdline()|も参照。 + +getcmdtype() *getcmdtype()* + 現在のコマンドラインの種類を返す。戻り値は次のいずれか: + : 通常のexコマンド + > デバッグモードコマンド |debug-mode| + / 前方検索コマンド + ? 後方検索コマンド + @ |input()| コマンド + - |:insert| または |:append| コマンド + = |i_CTRL-R_=| + コマンドラインを編集しているときのみ動作する。つまり + |c_CTRL-\_e|または|c_CTRL-R_=|または式マッピングを使っていると + きのみ有効。そうでないときは空文字列を返す。 + |getcmdpos()|, |setcmdpos()|, |getcmdline()|も参照。 + +getcmdwintype() *getcmdwintype()* + 現在のコマンドラインウィンドウ (|command-line-window|) の種類 + を返す。戻り値の意味は |getcmdtype()| と同じ。コマンドライン + ウィンドウでなければ空文字列を返す。 + +getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* + コマンドライン補完のマッチするリストを返す。{type}は何のための + ものかを指定する。 次の補完タイプがサポートされている: + + augroup 自動コマンドグループ + buffer バッファ名 + behave |:behave|サブオプション + color カラースキーム + command Exコマンド (および引数) + compiler コンパイラ + cscope |:cscope|のサブオプション + dir 辞書名 + environment 環境変数名 + event 自動コマンドのイベント + expression Vim式 + file ファイルおよびディレクトリ名 + file_in_path |'path'|のファイルおよびディレクトリ名 + filetype ファイルタイプ名 |'filetype'| + function 関数名 + help ヘルプ項目 + highlight ハイライトグループ + history |:history|サブオプション + locale ロケール名 (locale -aの出力) + mapping マッピング名 + menu メニュー + messages |:messages|サブオプション + option オプション + packadd 任意パッケージ |pack-add| 名 + shellcmd シェルコマンド + sign |:sign|サブオプション + syntax 構文ファイル名 |'syntax'| + syntime |:syntime|サブオプション + tag タグ + tag_listfiles タグ、ファイル名 + user ユーザー名 + var ユーザー変数 + + {pat}が空文字列の場合、すべてのマッチが返される。それ以外の場 + 合、{pat}と一致する項目のみが返される。{pat}での特殊文字の使用 + については、|wildcards|を参照。 + + オプションの{filtered}フラグが1に設定されている場合、結果をフィ + ルタリングするために 'wildignore'が適用される。そうでなければ、 + すべての一致が返される。'wildignorecase'オプションは常に適用さ + れる。 + + 一致するものがなければ、空のリストが返される。{type}の値が無効 + だと、エラーが発生する。 + + *getcurpos()* +getcurpos() カーソルの位置を返す。これは getpos('.') に似ているが、追加の + 情報を含む: + [bufnum, lnum, col, off, curswant] ~ + "curswant" は縦方向移動の優先的列番号である。 + 次のようにしてカーソル位置の保存と復元ができる: > + let save_cursor = getcurpos() + MoveTheCursorAround + call setpos('.', save_cursor) +< + *getcwd()* +getcwd([{winnr} [, {tabnr}]]) + 結果は現在の作業ディレクトリ名の文字列である。 + 引数が指定されない場合、現在のウィンドウである。 + + {winnr}が指定された場合、現在のタブページ内の{winnr}のウィンド + ウのローカルカレントディレクトリを返す。 + {winnr}と{tabnr}が指定された場合、{tabnr}のタブページ内の + {winnr}のウィンドウのローカルカレントディレクトリを返す。 + {winnr} にはウィンドウ番号または|window-ID|が使える。 + もし引数が不正の場合、空文字列を返す。 + +getfsize({fname}) *getfsize()* + 結果は数値で、{fname}で指定されるファイルのサイズをバイト単位 + で返す。 + {fname}がディレクトリのときは0を返す。 + ファイル{fname}が見つからないときは-1を返す。 + {fname} のサイズが |Number| の範囲外の場合は -2 を返す。 + +getfontname([{name}]) *getfontname()* + 引数なしで使われた場合には現在の通常のフォント名を返す。ハイラ + イトグループNormalに対して使われるものと同様|hl-Normal|。 + 引数が指定された場合には{name}が有効なフォント名であるか判定さ + れる。有効でないときは空文字列を返す。 + 有効なときは実際のフォント名を返す。またはGUIが実際の名前の取 + 得をサポートしていないときは{name}をそのまま返す。 + GUIモードで実行しているときのみ動作する。よってvimrcやgvimrcの + 中では使えない。GUIモードが起動した直後にこの関数を呼ぶには、 + オートコマンド|GUIEnter|を使うこと。 + Note GTKのGUIはどんなフォント名でも受け付けてしまうため、名前 + が有効であるかのチェックは機能しない。 + +getfperm({fname}) *getfperm()* + {fname}で指定されたファイルの読み込み、書き込み、実行の許可属 + 性を示す文字列を返す。 + {fname}が存在しない、またはそのディレクトリが読み込み不可能な + ときは空文字列を返す。 + 戻り値は "rwxrwxrwx" の形で、"rwx" フラグの各グループは順にファ + イルの所有者、ファイルが所属するグループ、その他のユーザーを表 + す。許可属性が与えられていないフラグは "-" で置き換えられる。 + 例: > + :echo getfperm("/etc/passwd") + :echo getfperm(expand("~/.vimrc")) +< この例は、(セキュリティの観点から望ましい設定がされているなら + ば) "rw-r--r--" あるいは "rw-------" と表示する。 + + 許可属性を設定するには|setfperm()|を使用する。 + + *getftime()* +getftime({fname}) + 結果は{fname}で与えられたファイルの、最終更新時間を示す数値。 + 1970年1月1日からの経過時間(秒)で、strftime()に渡すことができる + だろう。|localtime()|と|strftime()|も参照。 + ファイル{fname}が見つからなかった場合には-1を返す。 + +getftype({fname}) *getftype()* + {fname}で指定されたファイルの種別を示す文字列を返す。 + {fname}が存在しないときは空文字列を返す。 + ファイルの種別とそれらの結果の表を以下に示す: + 通常ファイル "file" + ディレクトリ "dir" + シンボリックリンク "link" + ブロックデバイス "bdev" + キャラクタデバイス "cdev" + ソケット "socket" + FIFO "fifo" + それ以外 "other" + 例: > + getftype("/home") +< Note "link" などの種別はそれをサポートしているシステムでのみ返 + される。"dir" と "file" しか返らないシステムもある。 + MS-Windowsでは、ディレクトリへのシンボリックリンクは "link" の + 代わりに "dir" を返す。 + + *getline()* +getline({lnum} [, {end}]) + {end}が指定されない場合は、カレントバッファの{lnum}行目の内容 + を文字列にして返す。例: > + getline(1) +< {lnum}が数字ではない文字で始まる文字列であった場合、line()に + よってその文字列が数字に変換される。よって、カーソルのある行の + 文字列を取得するには: > + getline(".") +< {lnum}が1より小さいかバッファの行数よりも大きい数値の場合、空 + 文字列が返される。 + + {end}が指定された場合は、カレントバッファの{lnum}行目から + {end}行目までを要素とするリスト|List|を返す。 + {end}は{lnum}と同様に解釈される。 + 存在しない行は省略され、エラーメッセージは表示されない。 + {end}が{lnum}より前になる場合は空リストを返す。 + 例: > + :let start = line('.') + :let end = search("^$") - 1 + :let lines = getline(start, end) + +< 他のバッファの行を取得するには|getbufline()|を参照。 + +getloclist({nr}[, {what}]) *getloclist()* + ウィンドウ{nr}のロケーションリストの全項目からなるリストを返す。 + {nr} にはウィンドウ番号または|window-ID|が使える。{nr}に0を指 + 定するとカレントウィンドウになる。 + + ロケーションリストウィンドウに対して使用すると、そこに表示され + ているロケーションリストが返る。ウィンドウ番号{nr}が無効な場合 + は、空リストが返る。それ以外は|getqflist()|と同じ。 + + オプションの{what}辞書引数が指定されている場合、{what}にリスト + されている項目を辞書として返す。{what}のサポートされている項目 + については、|getqflist()|を参照。 + +getmatches() *getmatches()* + |matchadd()| と |:match| により定義された全てのマッチの |List| + を返す。|setmatches()| は |getmatches()| で保存されたマッチの + リストを復元できるので、|getmatches()| と |setmatches()| は組 + み合わせて使うと便利である。 + 例: > + :echo getmatches() +< [{'group': 'MyGroup1', 'pattern': 'TODO', + 'priority': 10, 'id': 1}, {'group': 'MyGroup2', + 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > + :let m = getmatches() + :call clearmatches() + :echo getmatches() +< [] > + :call setmatches(m) + :echo getmatches() +< [{'group': 'MyGroup1', 'pattern': 'TODO', + 'priority': 10, 'id': 1}, {'group': 'MyGroup2', + 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > + :unlet m +< + *getpid()* +getpid() Vim のプロセス ID を数値で返す。Unix と MS-Windows では Vim が + 終了するまでこれは一意な数値である。MS-DOS では常にゼロである。 + + *getpos()* +getpos({expr}) {expr}の位置を返す。{expr}として指定できる値については + |line()|を参照。カーソル位置を得るには |getcurpos()| を参照。 + 結果は次の4個の要素を持つリスト|List|: + [bufnum, lnum, col, off] + "bufnum" は、'0 や 'A のようなマークが指定されたときは、その + マークのバッファ番号となる。それ以外では0となる。 + "lnum" と "col" はバッファ中の位置。桁番号は1から始まる。 + "off" の値は、'virtualedit' がオフのときは常に0で、オンのとき + はその文字の始点からの画面上の桁のオフセットである。つまり、 + カーソルがの中や、その行の最後の文字より後にあるとき意味 + を持つ。 + Note: ビジュアルモードの '< と '> について: ビジュアルモードが + "V" (行選択モード) のとき、'< の桁番号はゼロ、'> の桁番号は大 + きな値になる。 + この関数はマークの位置を保存し、復元するために使われる: > + let save_a_mark = getpos("'a") + ... + call setpos("'a", save_a_mark) +< |getcurpos()| と |setpos()|も参照。 + + +getqflist([{what}]) *getqflist()* + 現在の全quickfixエラーのリストを返す。リストの各要素は辞書で、 + 以下の要素を持つ: + bufnr ファイル名を持つバッファの番号。その名前を取得 + するにはbufname()を使う。 + lnum バッファ中の行番号(最初の行は1) + col 桁番号(最初の桁は1) + vcol |TRUE|: "col" は画面上の桁 + |FALSE|: "col" はバイトインデックス + nr エラー番号 + pattern エラーの位置を特定するために使う検索パターン + text エラーの説明 + type エラーメッセージの種類。'E', '1' など。 + valid |TRUE|: エラーメッセージが認識されている + + エラーリストがまったくないか、空であるときは空リストを返す。 + 存在しないバッファ番号を持つquickfixリストの項目は "bufnr" を0 + にして返される。 + + 役に立つ応用例: 複数のファイルから正規表現検索を行い、見つかっ + たものに対してなんらかの操作をする: > + :vimgrep /theword/jg *.c + :for d in getqflist() + : echo bufname(d.bufnr) ':' d.lnum '=' d.text + :endfor +< + オプションの{what}辞書引数が指定されている場合は、{what}にリス + トされている項目のみを辞書として返す。{what}では、以下の文字列 + 項目がサポートされている: + nr このquickfixリストの情報を取得。0 は現在の + quickfixリストを意味する + title リストタイトルを取得 + winid |window-ID|を取得 (もし開かれていれば) + all 上記のquickfixのすべてのプロパティ + {what}の文字列以外の項目は無視される。 + "nr" が存在しない場合、現在のquickfixリストが使用される。{what} + の処理中にエラーとなった場合、空の辞書が返される。 + + 返される辞書には、次のエントリが含まれる: + nr quickfixリスト番号 + title quickfixリストのタイトルテキスト + winid quickfixの|window-ID| (もし開かれていれば) + + 例: > + :echo getqflist({'all': 1}) + :echo getqflist({'nr': 2, 'title': 1}) +< + +getreg([{regname} [, 1 [, {list}]]]) *getreg()* + レジスタ{regname}の中身を文字列にして返す。例: > + :let cliptext = getreg('*') +< {regname} がセットされていないときは、結果は空文字列となる。 + getreg('=')は最後に評価した式レジスタの値を返す。(マップの中で + 使用する)。 + getreg('=', 1)はその式そのものを返す。これを使って|setreg()|で + 復元することができる。他のレジスタの場合は、この引数は無視され + るので、常に指定していても害はない。 + {list} が指定され、その値が|TRUE|のときは、戻り値はリスト + (|List|) になる。リストの各要素はテキスト 1 行である。これはレ + ジスタの中に値ゼロのバイトが含まれる場合に使用する。{list} を + 指定しなかった場合は NL 文字と値ゼロのバイトは両方とも NL 文字 + として扱われる (|NL-used-for-Nul| 参照)。 + 指定したレジスタがセットされていないときは、空のリストが返され + る。 + {regname}を指定しないときは|v:register|が使われる。 + + +getregtype([{regname}]) *getregtype()* + レジスタ{regname}の種類を表す文字列を返す。 + 戻り値は次のいずれかとなる: + "v" 文字単位|characterwise|の場合 + "V" 行単位|linewise|の場合 + "{width}" 矩形|blockwise-visual|の場合 + "" 空、または未知のレジスタの場合 + は値0x16の1文字である。 + {regname}を指定しないときは|v:register|が使われる。 + +gettabinfo([{arg}]) *gettabinfo()* + {arg}を指定しないと、すべてのタブページに関する情報がリストと + して返される。各リスト項目は辞書である。それ以外の場合、{arg} + はタブページ番号を指定し、それに関する情報が返される。タブペー + ジが存在しない場合、空のリストが返される。 + + 各リストアイテムは、次のエントリを持つ辞書である: + tabnr タブページ番号。 + variables タブページローカル変数の辞書への参照。 + windows タブページの|window-ID|のリスト。 + +gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* + タブページ {tabnr} のタブローカル変数 {varname} を取得する。 + |t:var| + タブの番号は 1 から始まる。 + {varname} が空のときは全タブローカル変数からなる辞書を返す。 + Note: 指定する変数名は "t:" を除いた名前。 + タブや変数が存在しないときは{def}または空文字列を返し、エラー + メッセージは表示されない。 + +gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* + タブページ{tabnr}内のウィンドウ{winnr}のウィンドウローカル変数 + {varname}の値を取得する。 + {varname}が空のときは全ウィンドウローカル変数からなる辞書を返 + す。 + {varname}が "&" と等しい場合はすべてのウィンドウローカルオプ + ションの値を辞書に入れて返す。 + {varname}が文字 "&" で始まるときはウィンドウローカルオプション + の値を取得する。 + Note {varname}は "w:" をつけずに指定しなければならない。 + タブページ番号は1から始まる。カレントタブページを指定するには + |getwinvar()|を指定する。 + {winnr} にはウィンドウ番号または|window-ID|が使える。 + {winnr}が0のときはカレントウィンドウとなる。 + グローバルオプション、バッファローカルオプション、ウィンドウ + ローカルオプションに対しても動作するが、グローバル変数やバッ + ファローカル変数に対しては動作しない。 + ウィンドウやタブや変数が存在しないときは{def}または空文字列を + 返し、エラーメッセージは表示されない。 + 例: > + :let list_is_on = gettabwinvar(1, 2, '&list') + :echo "myvar = " . gettabwinvar(3, 1, 'myvar') +< + + *getwinposx()* +getwinposx() 結果はGUIのVimウィンドウの左端の、デスクトップ上でのX座標値(数 + 値)。情報が存在しない(コンソールの)場合は-1となる。 + + *getwinposy()* +getwinposy() 結果はGUIのVimウィンドウの上端の、デスクトップ上でのY座標値(数 + 値)。情報が存在しない(コンソールの)場合は-1となる。 + +getwininfo([{winid}]) *getwininfo()* + ウィンドウに関する情報を、辞書のリストとして返す。 + + {winid}が与えられた場合、そのIDを持つウィンドウに関する情報が + 返される。ウィンドウが存在しない場合、結果は空のリストになる。 + + {winid}がなければすべてのタブページのすべてのウィンドウに関す + る情報が返される。 + + 各Listアイテムは次のエントリを持つ辞書である: + bufnr ウィンドウ内のバッファ数 + height ウィンドウの高さ + loclist ロケーションリストを表示してる場合は1 + {Vimが|+quickfix|機能付きでコンパイルさ + れたときのみ有効} + quickfix quickfixまたはロケーションリストウィン + ドウの場合は1 + {Vimが|+quickfix|機能付きでコンパイルさ + れたときのみ有効} + tabnr タブページ番号 + variables ウィンドウローカル変数の辞書への参照 + width ウィンドウ幅 + winid |window-ID| + winnr ウィンドウ番号 + + すべてのウィンドウローカル変数を取得するには: > + gettabwinvar({tabnr}, {winnr}, '&') + +getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* + カレントタブページに対する|gettabwinvar()|と同様。 + 例: > + :let list_is_on = getwinvar(2, '&list') + :echo "myvar = " . getwinvar(1, 'myvar') +< +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* + {expr}内のファイル名のワイルドカードを展開する。特殊文字につい + ては|wildcards|を参照。 + + {nosuf} に|TRUE|を指定しない限り、'suffixes' と 'wildignore' + が適用される。つまり 'wildignore' のパターンにマッチする名前は + スキップされ、'suffixes' がマッチの順番に影響を与える。 + 'wildignorecase' は常に適用される。 + + {list} が指定されその値が|TRUE|なら、マッチしたすべてのファイ + ルがリストとして返される。リストを使うことで、改行を含むファイ + ル名があっても結果を正しく受け取ることができる。 + そうでない場合は結果は文字列で返される。その場合、複数のマッチ + があるときはそれらは文字 で区切られる。 + + 展開が失敗した場合、空の文字列またはリストが返される。 + + 存在しないファイル名は結果に含まれない。シンボリックリンクは、 + それが存在するファイルを指す場合のみ含まれる。 + ただし、{alllinks} 引数が存在し、それが|TRUE|である場合はすべ + てのシンボリックリンクが含まれる。 + + 多くのシステムではバッククォート(「`」という文字のこと)を、外 + 部コマンドの実行結果からファイル名を取得するために使用できる。 + 例: > + :let tagfiles = glob("`find . -name tags -print`") + :let &tags = substitute(tagfiles, "\n", ",", "g") +< バッククォート内のプログラムの実行結果は、一行に一つずつの項目 + が含まれてなければならない。項目内のスペースは許容される。 + + 特殊なVimの変数を展開するためには|expand()|を参照。外部コマン + ドの生の出力を得るためには|system()|を参照。 + +glob2regpat({expr}) *glob2regpat()* + glob()に使われるファイルパターンを検索パターンに変換する。 + 結果はファイル名の文字列とのマッチに使用できる。例えば、 > + if filename =~ glob2regpat('Make*.mak') +< 上記は次と同じである: > + if filename =~ '^Make.*\.mak$' +< {expr}が空文字列の場合、結果は "^$" で、空文字列にマッチする。 + 結果はシステムによって異なることに注意すること。MS-Windowsで + は、バックスラッシュは通常、パス区切りを意味する。 + + *globpath()* +globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) + {path}の中の全ディレクトリに対して|glob()|を実行し、結果を連結 + する。例: > + :echo globpath(&rtp, "syntax/c.vim") +< + {path}はコンマ区切りのディレクトリのリスト。各ディレクトリを + {expr}の前に付加し、glob()と同様にそれを展開する。必要に応じて + パスの区切り文字が挿入される。 + ディレクトリ名の中にコンマを含めるには、バックスラッシュでエス + ケープすること。Note MS-Windowsではディレクトリ名の末尾にバッ + クスラッシュがつくことがある。その後に区切りのコンマを書くとエ + スケープと見なされてしまうので、バックスラッシュは削除すること。 + どれかのディレクトリに対して展開が失敗してもエラーメッセージは + 表示されない。 + + {nosuf} に|TRUE|が指定されない限り、オプション 'wildignore' が + 適用される。つまり、'wildignore' のパターンにマッチする名前は + スキップされる。 + + {list} が指定され、その値が|TRUE|なら、マッチしたすべてのファ + イルがリストとして返る。リストとして受け取る利点は、改行文字を + 含んだファイル名も正しく扱えることである。{list} を指定しな + かった場合は、戻り値は文字列であり、マッチした複数のファイル名 + は 文字で連結されてしまう。例: > + :echo globpath(&rtp, "syntax/c.vim", 0, 1) +< + {alllinks} は|glob()|の場合と同様に扱われる。 + + "**" を使ってディレクトリツリーを再帰的に検索することができる。 + 例えば、'runtimepath' とそれ以下のディレクトリから全ての + "README.txt" を探すには次のようにする: > + :echo globpath(&rtp, "**/README.txt") +< 上向き検索と、"**" の深さの限界はサポートされていない。よって + オプション 'path' の値をそのまま使うとうまく動かないことが + ある。 + + *has()* +has({feature}) 結果は機能{feature}がサポートされる場合1、されない場合0とな + る。引数{feature}は文字列。下記の|feature-list|を参照。 + |exists()|も参照。 + +has_key({dict}, {key}) *has_key()* + 結果は数値で、辞書|Dictionary| {dict}がキー{key}の要素を持つな + ら1、持たないなら0となる。 + +haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()* + 結果は数値でウィンドウが|:lcd|によってローカルなカレントディレ + クトリを持つようセットされているなら1、そうでないなら0となる。 + + 引数が指定されない場合、現在のウィンドウを対象とする。 + {winnr}が指定された場合、現在のタブページ内の{winnr}のウィンド + ウを対象とする。 + {winnr}と{tabnr}が指定された場合、{tabnr}のタブページ内の + {winnr}のウィンドウを対象とする。 + {winnr} にはウィンドウ番号または|window-ID|が使える。 + もし引数が不正の場合、0 を返す。 + +hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* + 結果は数値。右辺側(マップした先)の一部分に{what}を含むマッピン + グが存在し、それが{mode}で指定されたモードのいずれかで定義され + ているなら1を返す。 + {abbr}が指定されていて|TRUE|のときはマッピングでなく短縮入力の + 存在を判定する。挿入モードまたはコマンドモードを指定することを + 忘れないように。 + グローバルマップとバッファローカルマップの両方をチェックする。 + マッピングが1個も見つからなかったときは0を返す。 + {mode}に対しては以下の文字が利用できる: + n ノーマルモード + v ビジュアルモード + o オペレータ待機モード (Operator-pending) + i 挿入モード + l Language-Argumentモード ("r", "f", "t" など) + c コマンドラインモード + {mode}が省略されたときは "nvo" となる。 + + この関数はVim scriptの中で、ある関数へのマッピングが既に存在す + るか判定するために有用である。例: > + :if !hasmapto('\ABCdoit') + : map d \ABCdoit + :endif +< この例は、"\ABCdoit" へのマッピングが存在しないときだけ + "\ABCdoit" へのマッピングを作成する。 + +histadd({history}, {item}) *histadd()* + 文字列{item}を履歴{history}に追加する。履歴{history}は以下のう + ちどれか一つから選択: *hist-names* + "cmd" or ":" コマンドライン履歴 + "search" or "/" 検索パターン履歴 + "expr" or "=" タイプされた式の履歴 + "input" or "@" input()の履歴 + "debug" or ">" デバッグコマンドの履歴 + {history} 文字列はフルネームで指定する必要はありません。頭文字 + だけでも構いません。 + {item}が履歴内に既に存在する場合、それが最新の項目の位置へシフ + トされる。結果は数値:操作が成功した場合1、そうでなければ0 + + 例: > + :call histadd("input", strftime("%Y %b %d")) + :let date=input("Enter date: ") +< サンドボックス|sandbox|の中では利用できない。 + +histdel({history} [, {item}]) *histdel()* + {history}の内容を削除する。例えば全てのエントリを消すこともで + きる。{history}の部分に可能な値は|hist-names|を参照。 + + パラメーター{item}が文字列に評価される場合、これは正規表現と + して扱われる。その表現にマッチする全てのエントリがhistoryから + 削除される(複数あっても)。 + "\c" をつけない場合、大文字・小文字が一致しなければならない。 + |/\c|。 + {item}が数値に評価される場合、インデックスとして解釈される。イ + ンデックスについては|:history-indexing|を参照。関連するエント + リ{訳注: The respective entry}も、存在すれば削除される。 + + 結果は数値: 削除に成功すれば1を、そうでなければ0が返る。 + + 例: + 式レジスタの履歴を削除する: > + :call histdel("expr") +< + 検索履歴から、"*" で始まるエントリを全て削除する: > + :call histdel("/", '^\*') +< + 次の3つは等価である: > + :call histdel("search", histnr("search")) + :call histdel("search", -1) + :call histdel("search", '^'.histget("search", -1).'$') +< + 最後の検索パターンを削除し、一つ前のパターンを "n" コマンド(次 + のマッチへ移動)と 'hlsearch' の為に設定する: > + :call histdel("search", -1) + :let @/ = histget("search", -1) + +histget({history} [, {index}]) *histget()* + 結果は{history}の第{index}エントリを表わす文字列。{history} の + 部分に可能な値は|hist-names|を、{index}については + |:history-indexing|を参照。指定されたエントリが存在しない場合 + は空文字列が返される。{index}が省略された場合には、履歴中の最 + 新のエントリが戻り値として使用される。 + + 例: + 2つ前に行われた検索をやり直す: > + :execute '/' . histget("search", -2) + +< |:history|によって出力される{num}番目のエントリを、再度実行す + るための ":H {num}" というコマンドを定義する。 > + :command -nargs=1 H execute histget("cmd",0+) +< +histnr({history}) *histnr()* + 結果は数値で{history}の現在のエントリ数。{history}の部分に可能 + な値は|hist-names|を参照。エラーが起こった場合、-1が返される。 + + 例: > + :let inp_index = histnr("expr") +< +hlexists({name}) *hlexists()* + 結果は数値で、{name}という名のハイライトグループが存在すれば、 + 非ゼロの値が返される。これはなんらかの方法でそのグループが既に + 定義されている時にのみ起こる。これの為に実際に何らかのハイライ + ティングアイテムが設定されている必要はなく、単に構文アイテムと + しても使われるだろう。 + *highlight_exists()* + 以前の名前: highlight_exists(). + + *hlID()* +hlID({name}) 結果は数値で、{name}という名前のハイライトグループのID番号。そ + のハイライトグループが存在しない場合は0が返される。 + これはハイライトグループについての情報を獲得するために使用され + る。例えば "Comment" グループの背景色を取得するにはこのように + する: > + :echo synIDattr(synIDtrans(hlID("Comment")), "bg") +< *highlightID()* + 以前の名前: highlightID() + +hostname() *hostname()* + 結果は文字列で、現在Vimが実行されているマシンの名前。名前が256 + 文字を超える場合、超えた部分は切り捨てられる。 + +iconv({expr}, {from}, {to}) *iconv()* + 文字列{expr}をエンコーディング{from}からエンコーディング{to}に + 変換した文字列を返す。 + 変換が完全に失敗したときは空文字列を返す。一部の文字が変換でき + なかった場合、その文字は "?" に置き換わる。 + エンコーディング名はライブラリ関数iconv()が受け付けるものなら + なんでもよい。":!man 3 iconv" を参照。 + ほとんどの変換は、Vimが|+iconv|機能つきでコンパイルされている + ときのみ利用可能。|+iconv|つきでないときもUTF-8からlatin1への + 変換とその逆は行える。 + オプション 'encoding' の値に関係なく、特殊な文字を含むメッセー + ジを表示するために使える。UTF-8でエンコードされたメッセージを + 表示するには次のようにする: > + echo iconv(utf8_str, "utf-8", &enc) +< Note Vimは全てのUnicodeエンコーディングに対してUTF-8を使う。 + UCS-2との変換を行おうとしても、自動的にUTF-8との変換に変更され + る。いずれにせよ、UCS-2はNULバイトを含むため、文字列にUCS-2を + 使うことはできない。 + {|+multi_byte| 機能付きでコンパイルされたときのみ利用可能} + + *indent()* +indent({lnum}) カレントバッファの{lnum}行目のインデント量を数値で返す。この + インデント量はスペース単位で数えられ、'tabstop' の値が関係する。 + {lnum}は|getline()|の場合と同様に扱われる。 + {lnum}が無効なときは-1を返す。 + + +index({list}, {expr} [, {start} [, {ic}]]) *index()* + リスト|List| {list}の中で、{expr}に等しい要素の最小のインデッ + クスを返す。自動的な変換は行われないので、文字列の "4" は数値 + の 4 とは異なると判定される。そして数値の 4 は浮動小数点数の + 4.0 とも異なる。'ignorecase' はここでは適用されず、常に大文字・ + 小文字は区別される。 + {start}が指定された場合はインデックス{start}から要素の検索を始 + める(負数を指定すると末尾からの相対位置となる)。 + {ic}に|TRUE|が指定された場合、大文字・小文字は区別されない。 + そうでない場合は区別される。 + {list}の中に{expr}が見つからない場合は-1を返す。 + 例: > + :let idx = index(words, "the") + :if index(numbers, 123) >= 0 + +input({prompt} [, {text} [, {completion}]]) *input()* + 結果は文字列で、ユーザーがコマンドラインに入力したものが返され + る。引数 {prompt} にはプロンプト文字列か空文字列を指定する。空 + 文字列の場合はプロンプトなしになる。'\n' を使ってプロンプトに + 改行を含めることができる。 + |:echohl|によるハイライトの設定がプロンプトに適用される。 + 入力はコマンドラインと同様に行え、同じ編集コマンドやキーマップ + が使用できる。input()に入力された文字列には、他の履歴とは独立 + した履歴が与えられる。 + 例: > + :if input("Coffee or beer? ") == "beer" + : echo "Cheers!" + :endif +< + 省略可能な引数{text}が与えられ、空でないならば、それが入力の初 + 期値として、ユーザーが入力したのと同じ様に表示される。例: > + :let color = input("Color? ", "white") + +< 省略可能な引数{completion}はこの入力において利用できる補完の種 + 類を指定する。この引数がないときは補完は行われない。対応してい + る補完の種類は、ユーザー定義コマンドにおいて引数 "-complete=" + で指定するものと同じである。詳しくは|:command-completion|を参 + 照。 + 例: > + let fname = input("File: ", "", "file") +< + NOTE: この関数はGUIモードしか持たないバージョン(例、Win32 GUI) + のVimでは、スタートアップファイルの中で使用することはできな + い。 + NOTE: マッピングの中からinput()を呼ぶと、そのマッピングの残り + の文字が消費される。マッピングは、その文字が入力されたときと同 + じように処理されるためである。 + これを避けるには、input()の前に|inputsave()|を呼び、input()の + 後に|inputrestore()|を呼ぶ。もう1つの対策は、|:execute|や + |:normal|を使うなどして、そのマッピングでそれ以上文字を続けな + いようにすることである。 + + マッピングと同時に使う例: > + :nmap \x :call GetFoo():exe "/" . Foo + :function GetFoo() + : call inputsave() + : let g:Foo = input("enter search pattern: ") + : call inputrestore() + :endfunction + +inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()* + |input()|と同様。GUIで動作していて、テキストダイアログがサポー + トされている場合はダイアログを表示してテキストを入力させる。 + 例: > + :let n = inputdialog("value for shiftwidth", shiftwidth()) + :if n != "" + : let &sw = n + :endif +< ダイアログがキャンセルされたときは{cancelreturn}を返す。 + {cancelreturn}が省略されているときは空文字列を返す。 + を押すとOKボタンを押すのと同じ動作になる。を押すと + キャンセルボタンを押すのと同じ動作になる。 + NOTE: コマンドライン補完は対応していない。 + +inputlist({textlist}) *inputlist()* + {textlist}は文字列のリスト|List|でなければならない。1行につき + リストの要素を1個表示し、ユーザーに数字を入力するよう促す。入 + 力された数字を返す。 + ユーザーはマウスで文字列をクリックすることでも選択できる。最初 + の文字列を選択すると0が返る。最初の文字列より上をクリックする + と負数が返る。プロンプト自身をクリックすると{textlist}の長さ+1 + が返る。 + {textlist}の要素数はオプション 'lines' の値より少なくなければ + ならない。そうでないと動作しない。最初の要素にメッセージを書 + き、各文字列の先頭に番号をつけておくとよい。 + 例: > + let color = inputlist(['Select color:', '1. red', + \ '2. green', '3. blue']) + +inputrestore() *inputrestore()* + 前回の|inputsave()|で保存しておいた先行入力を復元する。 + inputsave()と同じ回数だけ呼ぶようにしなければならない。しかし + 多く呼びすぎても害はない。復元するものがなければ1を、そうでな + ければ0を返す。 + +inputsave() *inputsave()* + 先行入力(マッピングにより入力された文字も含む)を保存し、クリア + することにより、これ以降のプロンプトがユーザーからの入力を得る + ようにする。プロンプトの後で、対応するinputrestore()を呼び出さ + ねばならない。複数回呼ぶこともできる。ただしその場合は同じ回数 + だけinputrestore()を呼ばなくてはならない。 + メモリ不足のときは1を、そうでなければ0を返す。 + +inputsecret({prompt} [, {text}]) *inputsecret()* + |input()|とほぼ同じだが、以下の2点が異なる: + a) ユーザーの入力をアスタリスク("*")の列として表示し、入力内容 + を読めないようにする。 + b) ユーザーの入力が入力履歴|history|に残らない。 + ユーザーの入力内容を文字列として返す。 + NOTE: コマンドライン補完には対応していない。 + +insert({list}, {item} [, {idx}]) *insert()* + リスト|List| {list}の初めに{item}を挿入する。 + {idx}が指定されたときはインデックス{idx}の要素の前に{item}を挿 + 入する。{idx}が0のときは{idx}を省略した場合と同じ様に最初の要 + 素の前に挿入する。{idx}は負数でもよい(|list-index|参照)。-1を + 指定すると最後の要素の前に挿入する。 + 挿入した結果のリストを返す。例: > + :let mylist = insert([2, 3, 5], 1) + :call insert(mylist, 4, -1) + :call insert(mylist, 6, len(mylist)) +< 最後の例は|add()|を使うともっと簡単に書ける。 + Note {item}がリストの場合は、1個の要素として追加される。リスト + を連結するには|extend()|を使うこと。 + +invert({expr}) *invert()* + ビット反転。引数は数値に変換される。リスト、辞書、浮動小数点数 + を指定するとエラーになる。例: > + :let bits = invert(bits) + +isdirectory({directory}) *isdirectory()* + 結果は数値で、{directory}という名前のディレクトリが存在すれば + |TRUE|となる。{directory}が存在しないか、存在したとしても + ディレクトリではなかった場合には、|FALSE|が返される。文字列と + して解釈できるのならば{directory}の表現はどのようなもので + あってもかまわない。 + +islocked({expr}) *islocked()* *E786* + 結果は数値で、{expr}がロックされている変数の名前ならば|TRUE|を + 返す。 + {expr}は変数の名前、リストの要素、辞書の要素のいずれかでなけれ + ばならない。変数そのものを指定しないように注意。例: > + :let alist = [0, ['a', 'b'], 2, 3] + :lockvar 1 alist + :echo islocked('alist') " 1 + :echo islocked('alist[1]') " 0 + +< {expr}が存在しない変数のときはエラーメッセージが表示される。変 + 数の存在を確認するには|exists()|を使う。 + +isnan({expr}) *isnan()* + {expr} が NaN の値を持つ浮動小数点数ならば |TRUE| を返す。 > + echo isnan(0.0 / 0.0) +< 1 ~ + + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + +items({dict}) *items()* + {dict}の全要素のキー・値のペアからなるリストを返す。戻り値の各 + 要素はリストであり、キーと値の2個の要素を持つ。戻り値のリスト + の要素の順序は不定である。 + +job_getchannel({job}) *job_getchannel()* + {job}が使用しているチャンネルハンドルを取得する。 + ジョブにチャンネルがないかどうかを確認するには: > + if string(job_getchannel()) == 'channel fail' +< + {Vimが|+job|機能付きでコンパイルされたときのみ有効} + +job_info({job}) *job_info()* + {job}に関する情報を持つ辞書を返す: + "status" |job_status()|が返すもの + "channel" |job_getchannel()|が返すもの + "exitval" "status" が "dead" のときのみ有効 + "exit_cb" 終了時に呼び出される関数 + "stoponexit" |job-stoponexit| + +job_setoptions({job}, {options}) *job_setoptions()* + {job}のオプションを変更する。サポートされているものは: + "stoponexit" |job-stoponexit| + "exit_cb" |job-exit_cb| + +job_start({command} [, {options}]) *job_start()* + ジョブを開始し、ジョブオブジェクトを返す。|system()|と|:!cmd| + とは異なり、これはジョブが終了するのを待つことはない。 + + {command}は文字列にできる。これはMS-Windowsで最も効果的である。 + Unixでは、それはexecvp()に渡すために空白で区切られたパーツに分 + 割される。二重引用符で囲まれた引数には空白を含められる。 + + {command}はリストにでき、最初の項目は実行可能ファイルであり、 + 残りの項目は引数である。すべての項目は文字列に変換される。これ + はUnixで最も効果的である。 + + MS-Windowsでは、|job_start()|はGUIアプリケーションを隠す。それ + を表示したい場合は、|:!start|を代わりに使用すること。 + + コマンドはシェルではなく直接実行され、'shell' オプションは使用 + されない。シェルを使用するには: > + let job = job_start(["/bin/sh", "-c", "echo hello"]) +< または: > + let job = job_start('/bin/sh -c "echo hello"') +< これは2つのプロセス、シェルとそれが実行するコマンドを開始する + ことに注意すること。これを望まない場合は、"exec" シェルコマン + ドを使用する。 + + Unixでは$PATHは、コマンドにスラッシュが含まれていない場合にの + み実行可能ファイルを検索するために使用される。 + + ジョブはVimと同じ端末を使用する。ジョブがstdinを読む場合、ジョ + ブとVimが入力を奪い合うことになるのでうまく動作しない。問題を + 避けるためにstdinとstdoutをリダイレクトする: > + let job = job_start(['sh', '-c', "myserver /dev/null"]) +< + 返されたジョブオブジェクトを使用して、|job_status()|でステータ + スを取得し、|job_stop()|でジョブを停止することができる。 + + {options}は辞書でなければならない。多くのオプション項目を含め + ることができる。|job-options|参照。 + + {Vimが|+job|機能付きでコンパイルされたときのみ有効} + +job_status({job}) *job_status()* *E916* + {job}のステータスをStringで返す: + "run" ジョブが実行中 + "fail" ジョブを開始できなかった + "dead" ジョブが死んだか実行後にジョブが停止した + + Unixでは存在しないコマンドは、失敗が検出される前にフォークが発 + 生するため、"fail" ではなく "dead" になる。 + + exitコールバックが "exit_cb" オプションで設定され、ジョブが + "dead" と検出された場合、コールバックが呼び出される。 + + 詳細は|job_info()|参照。 + + {Vimが|+job|機能付きでコンパイルされたときのみ有効} + +job_stop({job} [, {how}]) *job_stop()* + {job}を停止する。これはジョブを通知するためにも使用できる。 + + {how}が省略されたり、"term" の場合、ジョブは終了する。Unixでは + SIGTERMが送信される。MS-Windowsでは、ジョブは強制的に終了する + ("優しい"方法は存在しない)。これはプロセスグループに行くので、 + 子供たちも影響を受けるかもしれない。 + + UNIXへの影響: + "term" SIGTERM (既定) + "hup" SIGHUP + "quit" SIGQUIT + "int" SIGINT + "kill" SIGKILL (停止するための最も強い方法) + number その番号の信号 + + MS-Windowsへの影響: + "term" プロセスを強制終了 (既定) + "hup" CTRL_BREAK + "quit" CTRL_BREAK + "int" CTRL_C + "kill" プロセスを強制終了 + Others CTRL_BREAK + + Unixでは、シグナルはプロセスグループに送られる。これは、ジョブ + が "sh -c command" であるときにシェルとコマンドの両方に影響を + 与えることを意味する。 + + 結果は数値で、操作が実行できる場合は1、システムでは "how" がサ + ポートされていない場合は0。 + ジョブが実際に停止したかどうかは、操作が実行された場合でも、 + job_status()でチェックする必要があることに注意すること。 + ジョブのステータスがチェックされていない場合、Vimがジョブが実 + 行されていないと判断した場合でも操作が実行される。 + + {Vimが|+job|機能付きでコンパイルされたときのみ有効} + +join({list} [, {sep}]) *join()* + リスト{list}の要素を連結し、1個の文字列にして返す。 + {sep}が指定されたときは、要素の間にそれを挿入する。{sep}が指定 + されなかったときは1個のスペースが使われる。 + Note 末尾には{sep}がつかない。末尾にもつけたければ以下のように + する: > + let lines = join(mylist, "\n") . "\n" +< {list}の要素が文字列なら、そのまま使われる。リストと辞書は + |string()|を使ったときと同じようにして文字列に変換される。 + この逆を行う関数は|split()|である。 + +js_decode({string}) *js_decode()* + |json_decode()| に似ているが以下が異なる: + - オブジェクトのキー名はクォートされてなくてもよい。 + - 文字列はシングルクォートでくくることができる。 + - 配列内の(2つのコンマで区切られた)空アイテムが許可され結果と + して v:none のアイテムとなる。 + +js_encode({expr}) *js_encode()* + |json_encode()| に似ているが以下が異なる: + - オブジェクトのキー名がクォートされない + - 配列の中のアイテム v:none はコンマで区切られた空のアイテムに + なる。 + 例えば Vim オブジェクト: + [1,v:none,{"one":1},v:none] ~ + は以下にエンコードされ: + [1,,{one:1},,] ~ + json_encode() であれば以下にエンコードされる: + [1,null,{"one":1},null] ~ + このエンコードは JavaScript では妥当である。特に配列内でオプ + ショナルアイテムを扱う場合には JSON より能率的である。 + + +json_decode({string}) *json_decode()* + これはJSONフォーマットの文字列を解析し、それと同等のVimの値を + 返す。JSONとVimの値の関係は|json_encode()|を参照。 + デコードは寛容である: + - 配列やオブジェクトの末尾コンマは無視される。 + - 多くの浮動小数点数を認識する。例えば "1." は "1.0" として認 + 識される。 + *E938* + しかし、1つのオブジェクトに重複するキーを含むことはできない。 + 結果は必ずVimの型として有効になる: + - オブジェクトの空のメンバ名は許されない。 + - オブジェクトのメンバ名の重複は許されない。 + +json_encode({expr}) *json_encode()* + {expr}をJSONフォーマットの文字列にエンコードし、この文字列を返 + す。 + このエンコード方式の詳細はここに記載されている: + https://tools.ietf.org/html/rfc7159.html + Vimの値は以下の通りに変換される: + 数値 10進数 + 浮動小数点数 浮動小数点数 + 浮動小数点数 nan "NaN" + 浮動小数点数 inf "Infinity" + 文字列 ダブルクォートで括られた文字列(null可) + Funcref 不可、エラー + リスト 配列(null可) + 再帰的に使用された場合: [] + 辞書 オブジェクト(null可) + 再帰的に使用された場合: {} + v:false "false" + v:true "true" + v:none "null" + v:null "null" + NaNとInfinityは値として渡されることに注意すること。これはJSON + 標準には存在しないが、いくつかの実装でそれが可能である。そうで + ない場合、エラーが発生する。 + +keys({dict}) *keys()* + {dict}の全キーからなるリストを返す。リストの順序は不定である。 + + *len()* *E701* +len({expr}) 結果は数値で、引数{expr}の長さ。{expr}が文字列または数値のとき + は|strlen()|と同じようにバイト単位での長さを返す。 + {expr}がリストのときは要素数を返す。 + {expr}が辞書のときは要素数を返す。 + それ以外のときはエラーとなる。 + + *libcall()* *E364* *E368* +libcall({libname}, {funcname}, {argument}) + ランタイムライブラリ{libname}の関数{funcname}を、単一の引数 + {argument}で呼び出す。 + Vimで使うように特別に作ったライブラリの関数を呼ぶために使われ + る。引数は1個しか指定できないため、普通のライブラリ関数を呼ぶ + にはかなり制限がある。 + 結果には、呼び出した関数から返された文字列が返される。呼び出し + た関数がNULLを返した場合には、Vimには空文字列 "" が戻される。 + 関数の戻り値が数値である場合には|libcallnr()|を使うこと。 + もしも引数が数値ならば、関数にはint型の引数が1つ渡される。引数 + が文字列の場合には、関数にはヌル終端記号を持つ文字列が引数とし + て渡される。 + |restricted-mode|の中で呼ぶと失敗する。 + + libcall()によってVimを再コンパイルすることなく 'plug-in' と呼 + ばれる独自の拡張を行うことができるようになる。それは (直接) シ + ステムの関数を呼ぶ、ということではない。システム関数を呼ぶとお + そらくVimがクラッシュするだろう。 + + Win32では、あなたが書いた関数をDLLに置かなければならず、また通 + 常のC呼出し規約を使用しなければならない(WindowsのシステムDLLが + 使うPascalではない)。関数は正確に1つのパラメーター、char型ポイ + ンタもしくはint型を取らなければならず、戻り値としてchar型ポイ + ンタかNULLを返さなければならない。返されるchar型ポインタは、関 + 数終了後も有効なポインタ(例えばDLL内の静的なデータ)を指さなけ + ればならない。(malloc等で)割り当てられたメモリを保持していた場 + 合、それはリークしてしまう。DLL内のスタティックバッファを用い + る方法は動くかもしれないが、使用済みDLLがメモリから削除される + と同時に解放されてしまう。 + + 警告: もしも関数が有効ではないポインタを返すと、Vimはクラッ + シュしてしまう。関数が数値を返してしまった場合、Vimはそれをポ + インタとして扱ってしまうので、やはりクラッシュが起こる。 + Win32のシステムでは、{libname}はDLLのファイル名の拡張子 ".DLL" + を付けてはならない。通常の(パスの通った)場所にDLLがない場合に + は、フルパスで指定する必要がある。 + Unixでは、独自のプラグインをコンパイルするときはオブジェクト + コードを位置独立('PIC')としてコンパイルしなければならない。 + {Win32 といくつかの Unix で、|+libcall| 機能が有効になっている + ときのみ利用可能} + 例: > + :echo libcall("libc.so", "getenv", "HOME") +< + *libcallnr()* +libcallnr({libname}, {funcname}, {argument}) + |libcall()|とほぼ同様だが、文字列でなくintを返す関数に使う。 + {Win32と、|+libcall|機能が有効になっているUnixでのみ利用可能} + 例: > + :echo libcallnr("/usr/lib/libc.so", "getpid", "") + :call libcallnr("libc.so", "printf", "Hello World!\n") + :call libcallnr("libc.so", "sleep", 10) +< + *line()* +line({expr}) 結果は数値で、{expr}で与えられた位置のファイル内での行番号。受 + け付けられる位置指定は次の通り: + . カーソルの位置 + $ 現在のバッファの最後の位置 + 'x マークxの位置(マークが設定されていない場合、0が返 + る) + w0 カレントウィンドウの最上行 + w$ カレントウィンドウの最下行 + v ビジュアルモードでは: ビジュアル選択領域の開始行 + (カーソルがその端)。ビジュアルモード以外ではカーソ + ル位置を返す。すぐに更新される点が |'<| と違う。 + Note 他のファイルのマークも使える。その場合、戻り値はそのファ + イルの行番号となる。 + 桁番号を取得するには|col()|を使う。両方を取得するには + |getpos()|を使う。 + 例: > + line(".") カーソルの行番号 + line("'t") マークtの位置の行番号 + line("'" . marker) マークmarkerの位置の行番号 +< *last-position-jump* + このオートコマンドはファイルを開いた時に、最後に開かれていた時 + の行へ自動的にジャンプするものである。これは '" マークがセット + されている時にのみ有効である: > + :au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + +line2byte({lnum}) *line2byte()* + バッファの先頭から、{lnum}行目までのバイト数を返す。これには現 + 在のバッファのオプション 'fileformat' に従った、end-of-line(行 + 終端)文字も含まれている。最初の行においては1が返る。バイト数は + 'encoding' に基づく。'fileencoding' は無視される。 + 次のようにすることで最終行を含むバイトサイズを獲得することがで + きる: > + line2byte(line("$") + 1) +< これはバッファの大きさプラス1になる。もし 'fileencoding' が空 + ならその値はファイルの大きさプラス1に等しい。 + {lnum}が無効であるか、|+byte_offset|機能がコンパイル時に無効に + されている場合、-1が返される。 + |byte2line()|、|go|及び|:goto|も参照。 + +lispindent({lnum}) *lispindent()* + 'lisp' をオンにしたときと同じlisp用のインデント規則に従った場 + 合の{lnum}行目のインデント量を返す。 + インデント量はスペースで数えられ、'tabstop' の値は関係ない。 + {lnum}は|getline()|の場合と同様に扱われる。 + {lnum}が無効な値のときや|+lispindent|機能なしでコンパイルされ + ているときは-1を返す。 + + *localtime()* +localtime() + 現在の時刻、1970年1月1日からの経過秒数を返す。|strftime()|と + |getftime()|も参照。 + + +log({expr}) *log()* + {expr} の自然対数 (底e) を浮動小数点数 (|Float|) で返す。 + {expr} は (0, inf] の範囲の浮動小数点数 (|Float|) か数値 + (|Number|) でなければならない。 + 例: > + :echo log(10) +< 2.302585 > + :echo log(exp(5)) +< 5.0 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +log10({expr}) *log10()* + 浮動小数点数 {expr} の 10 を底とする対数を |Float| で返す。 + {expr} は |Float| または |Number| に評価されなければならな + い。 + 例: > + :echo log10(1000) +< 3.0 > + :echo log10(0.01) +< -2.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + +luaeval({expr}[, {expr}]) *luaeval()* + Lua の式 {expr} を評価し、その結果を Vim のデータ構造に変換し + たものを返す。2番目の {expr} は、最初の {expr} の中では _A と + してアクセスできる追加の引数を保持する。 + 文字列はそのまま返される。 + ブーリアンオブジェクトは数値に変換される。 + 数値は、vim が |+float| つきでコンパイルされたときは |Float| + 値に変換され、そうでなければ数値に変換される。 + vim.eval() で取得される辞書とリストはそのまま返される。 + それ以外のオブジェクトは 0 が返され、エラーにはならない。 + 詳細は |lua-luaeval| を参照。 + {|+lua| 機能つきでコンパイルされたときのみ有効} + +map({expr1}, {expr2}) *map()* + {expr1}はリスト|List|または辞書|Dictionary|。 + {expr1}の各要素を、{expr2}を評価した結果で置き換える。 + {expr2}は文字列|string|または関数参照|Funcref|でなければならな + い。 + + {expr2}が文字列の場合、{expr2}の内部では|v:val|が現在の要素の + 値を保持している。辞書の場合は|v:key|が現在の要素のキーを保持 + している。リストの場合は|v:key|が現在の要素のインデックスを保 + 持している。 + 例: > + :call map(mylist, '"> " . v:val . " <"') +< これは "mylist" の各要素の前に "> " をつけ、後に " <" をつける。 + Note {expr2}は式を表す文字列である。バックスラッシュを二重に + しなくても済むように|literal-string|を使うとよいだろう。ただし + その場合はシングルクォートを二重にしなければならない。 + + {expr2}が|Funcref|の場合は、2つの引数で呼び出される: + 1. 現在の要素のキーまたはインデックス。 + 2. 現在の要素の値。 + 関数は、その要素の新しい値を返さなければならない。それぞれの値 + を "key-value" に置き換える例: > + func KeyValue(key, val) + return a:key . '-' . a:val + endfunc + call map(myDict, function('KeyValue')) +< |lambda| を使えばより短く書ける: > + call map(myDict, {key, val -> key . '-' . val}) +< "val" を使わない場合は省略できる: > + call map(myDict, {key -> 'item: ' . key}) +< + この操作はその場で(in-place)行われる。リストや辞書を変更したく + ない場合は最初にコピーを作ること: > + :let tlist = map(copy(mylist), ' v:val . "\t"') + +< {expr1}のリストまたは辞書に式を適用した結果を返す。{expr2}を + 評価している最中にエラーが発生した場合は、{expr1}内のそれ以降 + の要素の処理は行われない。{expr2}が関数参照の場合、関数が + "abort" フラグつきで定義されていない限り、関数内のエラーは無視 + される。 + + +maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* + {dict}が省略されたかゼロのとき: モード{mode}におけるキーマップ + {name}のrhsを返す。結果の文字列内の特殊文字は、":map" コマンド + でリスト表示した時のように変換される。 + + {name}というキーマップが存在しない場合、空文字列が返される。 + + {name}には ":map" コマンドで使用可能な、特殊なキー名が指定でき + る。 + + {mode}には次の文字が使用可能: + "n" ノーマル + "v" ビジュアル (選択含む) + "o" オペレータ待機 (Operator-pending) + "i" 挿入 + "c" コマンドライン + "s" 選択 + "x" ビジュアル + "l" langmap |language-mapping| + "" ノーマル、ビジュアル、及びオペレータ待機 + {mode}が省略された場合、"" が使用される。 + + {abbr}が指定され、|TRUE|の場合はマッピングでなく短縮入力を対象 + とする。 + + {dict} に|TRUE|が指定されたときはマッピングのすべての情報を含 + んだ辞書が返る: + "lhs" マッピングの {lhs} + "rhs" マッピングの {rhs} (入力されたまま) + "silent" |:map-silent| マッピングなら 1。そうでなければ0。 + "noremap" マッピングの {rhs} が再マップ可能なら 1。 + "expr" 式マッピング (|:map-|) なら 1。 + "buffer" バッファローカルマッピング (|:map-local|) なら1。 + "mode" マッピングが定義されているモード。上述のモードに + 加え、次の文字が使用される: + " " ノーマル、ビジュアル、オペレータ待機 + "!" 挿入、コマンドラインモード (|mapmode-ic|) + "sid" マッピングで使用されるスクリプトローカルID + (||)。 + "nowait" 他の長いマッピングを待たない。(|:map-|)。 + + まずカレントバッファにローカルなマッピングを探し、次のグローバ + ルマッピングを探す。 + この関数を使うと、あるキーに対して既にマップがされているとき、 + その動作を行いつつ、再マップすることができる。概要: > + exe 'nnoremap ==' . maparg('', 'n') + +mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* + モード{mode}におけるキーマップ{name}が存在するかチェックする。 + {name}に指定できる特殊文字は|maparg()|を参照。 + {abbr}が指定され、|TRUE|の場合はマッピングでなく短縮入力を対象 + とする。 + マッピングが{name}で始まるとき、またはマッピングが{name}のはじ + めに等しいときマッチすると見なされる。 + + マッチするか "a" "ab" "abc" ~ + mapcheck("a") yes yes yes + mapcheck("abc") yes yes yes + mapcheck("ax") yes no no + mapcheck("b") no no no + + maparg()との違いは、mapcheck()は{name}にマッチするマップを見つ + けるが、maparg()はぴったり{name}に一致するマッピングのみを見つ + ける。 + {name}にマッチするキーマップが存在しない時には、空文字列が返さ + れる。結果が一つならばマップされたrhsが返される。複数見つかっ + た場合には、それらのうちどれか一つのrhsが返される。 + まずカレントバッファにローカルなマッピングを探し、次のグローバ + ルマッピングを探す。 + この関数はマッピングが曖昧にならないかチェックするために使うこ + とができる。例: > + :if mapcheck("_vv") == "" + : map _vv :set guifont=7x13 + :endif +< これは、"_vv" というマッピングが "_v" とか "_vvv" といったマッ + ピングと衝突しないように事前にチェックしている。 + +match({expr}, {pat}[, {start}[, {count}]]) *match()* + {expr}がリストの場合は、{pat}にマッチする最初の要素のインデッ + クスを返す。各要素は文字列として扱われる。リストと辞書はechoし + たときと同じように文字列表現に変換される。 + それ以外の場合は、{expr}は文字列として扱われる。{expr}の中で + {pat}にマッチするインデックス(バイト単位のオフセット)を表す数 + 値を返す。 + 最初の文字またはリストの最初の要素にマッチしたときは0を返す。 + マッチがないときは-1を返す。 + サブマッチを取得するには |matchlist()| を参照。 + 例: > + :echo match("testing", "ing") " 結果は 4 + :echo match([1, 'x'], '\a') " 結果は 1 +< {pat}の扱われ方については|string-match|を参照。 + *strpbrk()* + strpbrk()に相当する関数はVimに存在しない。しかし同じことを次の + ようにしてできる: > + :let sepidx = match(line, '[.,;: \t]') +< *strcasestr()* + strcasestr()に相当する関数はVimに存在しない。しかし正規表現に + "\c" をつければ大文字・小文字の違いを無視できる: > + :let idx = match(haystack, '\cneedle') +< + {start}が指定されたときは、文字列のバイトインデックス{start}の + 位置、またはリストの{start}の要素から検索を始める。 + その場合も戻り値は最初の文字/要素から数えたインデックスである + ことに注意。例: > + :echo match("testing", "ing", 2) +< の結果は "4"。 > + :echo match("testing", "ing", 4) +< の結果は "4"。 > + :echo match("testing", "t", 2) +< の結果は "3"。 + 文字列の場合、{start} > 0のときは、その文字列が{start}バイト後 + から始まるかのように扱われる。そのため、"^" は{start}の位置に + マッチする。ただし{count}が指定されたときは、{start}より前にお + けるマッチを無視しているかのように振る舞う(これは後方互換性を + 保つのを少々複雑にしている)。 + 文字列の場合、{start} < 0のときは{start}に0をセットする。リス + トの場合は、末尾からインデックスを数えるという意味になる。 + {start}が範囲外の場合(文字列で{start} > strlen({expr})となった + 場合、リストで{start} > len({expr})となった場合)は-1を返す。 + + {count}が指定されたときは{count}番目のマッチ位置を返す。文字列 + でマッチが見つかったとき、次のマッチングは1文字先から行われる。 + よって次の例は1を返す: > + echo match("testing", "..", 0, 2) +< リストの場合は次の要素から検索を続ける。 + Note {count}を指定すると、{start}の扱い方が変わってしまう。 + 前の段落を参照。 + + 受け付ける正規表現については|pattern|を参照。 + オプション 'ignorecase' により、大文字・小文字を区別するかどう + かを設定できる。'smartcase' は適用されない。マッチングは常に + 'magic' をオン、'cpoptions' を空にした状態で行われる。 + + *matchadd()* *E798* *E799* *E801* +matchadd({group}, {pattern}[, {priority}[, {id}[, {dict}]]]) + カレントウィンドウで強調表示するパターンを定義する。このパター + ンのことを「マッチ」と呼ぶ。構文グループ {group}で強調する。戻 + り値は、マッチを識別する ID である。|matchdelete()|でこの ID + を指定してマッチを削除することができる。 + パターンは大文字小文字を区別し、magic (|/magic|) として解釈さ + れる ({pattern} の中で明示的に変更しない限り)。オプションの + 'magic'、'smartcase'、'ignorecase' は使用されない。 + Concealは特別であり、マッチを隠す作用がある。 + + 省略可能な引数 {priority} はマッチの優先度を指定する。優先度が + 高いマッチは、より低いマッチの強調を上書きする。優先度は整数で + 指定する(負の数も可能)。{priority} が指定されない場合は既定の + 優先度 10 となる。'hlsearch' の優先度はゼロで、したがってゼロ + より大きい優先度のマッチはすべてそれを上書きする。構文ハイライ + ト('syntax' を参照)は独立したメカニズムであり、優先度がいくつ + であろうとマッチは構文ハイライトより優先する。 + + {id} は特定のマッチ ID を返すことを要求する。指定された ID が + すでに使われていたら、エラーメッセージが表示され、そのマッチは + 登録されない。ID は正の整数を指定する(ゼロは除く)。ID 1, 2, 3 + は |:match|, |:2match|, |:3match| 用に予約されている。{id} が + 指定されないか -1 のときは、|matchadd()| が自動的に空いている + ID を取得する。 + + 省略可能な引数 {dict} はより一層カスタマイズ可能な値を許す。 + 現在、これは|hl-Conceal|でハイライトされたマッチをconceal文字で + 表示されるのを明示するために使われる。 + この辞書は下記のメンバを持つことができる: + + conceal マッチ(|hl-Conceal|のためだけにハイライトさ + れたマッチ、|:syn-cchar|を参照)の代わりに + 表示する特別な文字 + + コマンド |:match| と異なり、マッチの個数に上限はない。 + + 例: > + :highlight MyGroup ctermbg=green guibg=green + :let m = matchadd("MyGroup", "TODO") +< このパターンを削除するには: > + :call matchdelete(m) + +< |matchadd()| と |:match| で定義したマッチのリストは + |getmatches()| で取得できる。全てのマッチを削除するのは + |clearmatches()| 一発でできる。 + + *matchaddpos()* +matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) + |matchadd()| と同じだが、パターンを指定するのではなく、位置の + リスト {pos} を指定する。このコマンドは正規表現を扱う必要もな + く、画面更新のためにバッファ行の境界を設定するため、 + |matchadd()| よりも速い。これは、例えば括弧の対応を強調表示す + るような、マッチの追加と削除を高速に実行したい状況を想定してい + る。 + + リスト {pos} は以下のいずれかの値を要素として持つことができる: + - 数値。指定した行全体が強調表示される。最初の行の行番号は 1 + である。 + - 数値を 1 つ持ったリスト。例 [23]。指定した行全体が強調表示さ + れる。 + - 数値を 2 つ持ったリスト。例 [23, 11]。最初の数値は行番号、2 + 番目の数値は列番号である (最初の列は 1 である。値は |col()| + の戻り値と同じようにバイト単位である)。指定した位置の文字が + 強調表示される。 + - 数値を 3 つ持ったリスト。例 [23, 11, 3]。数値 2 つの場合と同 + じだが、3 つ目に強調表示する文字の長さ (バイト単位) を指定す + る。 + + 指定できる位置は最大で 8 個である。 + + 例: > + :highlight MyGroup ctermbg=green guibg=green + :let m = matchaddpos("MyGroup", [[23, 24], 34]) +< パターンの削除: > + :call matchdelete(m) + +< |matchaddpos()| で追加されたマッチは |getmatches()| で取得する + 際には "pos1"、"pos2"、... という項目を持つ。それぞれの値は + {pos} で指定された値である。 + これらのマッチは |setmatches()| で設定することはできない。ただ + し、|clearmatches()| で削除することはできる。 + +matcharg({nr}) *matcharg()* + |:match|、|:2match|、|:3match|によって設定されているマッチパター + ンの情報を返す。{nr}が1のときは|:match|の情報、2のときは + |:2match|の情報、3のときは|:3match|の情報を返す。 + 戻り値は次の2個の要素を持つリストである: + 引数で指定したハイライトグループ名 + 引数で指定した検索パターン + {nr}が1、2、3のどれでもないときは空リストを返す。 + マッチパターンがセットされていないときは['', '']を返す。 + |:match| を保存し、復元するのに便利である。 + |:match| を使った強調は 3 個までに限られている。 + |matchadd()| にはこの制限はない。 + +matchdelete({id}) *matchdelete()* *E802* *E803* + |matchadd()| または |:match| で定義したマッチの中で ID が {id} + であるものを削除する。成功したときは 0、失敗したときは + -1 を返す。|matchadd()| の例を参照。すべてのマッチを削除するの + は |clearmatches()| 一発でできる。 + +matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* + |match()|と同じだが、返されるのはマッチした部分文字列の終了後の + インデックスである。例: > + :echo matchend("testing", "ing") +< 結果は "7"。 + *strspn()* *strcspn()* + Vimにはstrspn()やstrcspn()に相当する関数はないが、matchend()を + 使えば同じことができる: > + :let span = matchend(line, '[a-zA-Z]') + :let span = matchend(line, '[^a-zA-Z]') +< ただしマッチがないときには-1を返すところが異なる。 + + {start}は|match()|の場合と同じ意味を持つ。 > + :echo matchend("testing", "ing", 2) +< 結果は "7"。 > + :echo matchend("testing", "ing", 5) +< 結果は "-1"。 + {expr}がリストの場合、戻り値は |match()| と等しくなる。 + +matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* + |match()| と同じだがリストを返す。リストの最初の要素は、 + matchstr()が返すのと同じマッチした文字列。それ以降の要素は + |:substitute|における "\1"、"\2" のようなサブマッチである。\1 + から\9までの間で、指定されなかったものは空文字列となる。例: > + echo matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)') +< 結果は['acd', 'a', '', 'c', 'd', '', '', '', '', '']となる。 + マッチしなかったときは空リストを返す。 + +matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* + |match()| と同じだが、マッチした文字列を返す。例: > + :echo matchstr("testing", "ing") +< 結果は "ing"。 + マッチしなかったときは "" を返す。 + {start}の意味は |match()| の場合と同じ。 > + :echo matchstr("testing", "ing", 2) +< 結果は "ing"。 > + :echo matchstr("testing", "ing", 5) +< 結果は ""。 + {expr}がリストのときはマッチした要素を返す。 + その要素の型は変換されないため、必ずしも文字列であるとは限らな + い。 + +matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()* + |matchstr()| と同じだがマッチした文字列とマッチした開始位置と + 終了位置を返す。例: > + :echo matchstrpos("testing", "ing") +< 結果は ["ing", 4, 7] である。 + マッチが無い場合は ["", -1, -1] が返る。 + {start} が指定されている場合は |match()| と同じ意味になる。 > + :echo matchstrpos("testing", "ing", 2) +< 結果は ["ing", 4, 7] である。 > + :echo matchstrpos("testing", "ing", 5) +< 結果は ["", -1, -1] である。 + {expr} が |List| の場合、マッチしたアイテム、{pat} でマッチし + た最初のインデックス、マッチの開始位置と終了位置が返る。 > + :echo matchstrpos([1, '__x'], '\a') +< 結果は ["x", 1, 2, 3] である。 + 型は変更されない。必ずしも文字列である必要はない。 + + *max()* +max({expr}) {expr}の全要素の値の最大値を返す。 + {expr}はリストか辞書である。辞書の場合、辞書に含まれるすべての + 値の最大値を返す。 + {expr}がリストでも辞書でもなかったり、要素のどれかが数値に変換 + できない場合はエラーとなる。 + 空のリストまたは辞書の場合は0を返す。 + + *min()* +min({expr}) {expr}の全要素の値の最小値を返す。 + {expr}はリストか辞書である。辞書の場合、辞書に含まれるすべての + 値の最小値を返す。 + {expr}がリストでも辞書でもなかったり、要素のどれかが数値に変換 + できない場合はエラーとなる。 + 空のリストまたは辞書の場合は0を返す。 + + *mkdir()* *E739* +mkdir({name} [, {path} [, {prot}]]) + ディレクトリ{name}を作成する。 + {path}が "p" のときは必要に応じて途中のディレクトリも作成され + る。そうでないときは "" にすること。 + {prot}は作成するディレクトリの保護ビット。デフォルトは0755 + (rwxr-xr-x: 所有者は読み書き可能、他の人は読み込み可能)。 + 他の人が読み込めないようにするには0700とすること。{prot} は + {name} の最後の部分にのみ適用される。なので、/tmp/foo/bar + を作成すると /tmp/foo は 0755 で作成される。 + 例: > + :call mkdir($HOME . "/tmp/foo/bar", "p", 0700) +< |sandbox|の中ではこの関数は使用できない。 + システムによっては利用できない場合がある。これを確認するには次 + のようにする: > + :if exists("*mkdir") +< + *mode()* +mode([expr]) 現在のモードを示す文字列を返す。 + [expr] に 0 でない数値か空でない文字列(|non-zero-arg|) + を指定した場合、フルモードが返される。それ以外の場合は + 最初の一文字だけが返される。 + + n ノーマル + no オペレータ待機 + v 文字単位ビジュアル + V 行単位ビジュアル + CTRL-V 矩形ビジュアル + s 文字単位選択 + S 行単位選択 + CTRL-S 矩形選択 + i 挿入 + ic 挿入モード補完 |compl-generic| + ix 挿入モード |i_CTRL-X| 補完 + R 置換 |R| + Rc 置換モード補完 |compl-generic| + Rv 仮想置換 |gR| + Rx 置換モード |i_CTRL-X| 補完 + c コマンドライン編集 + cv Vim Ex モード |gQ| + ce ノーマル Ex モード |Q| + r Hit-enter プロンプト + rm -- more -- プロンプト + r? ある種の |:confirm| 問い合わせ + ! シェルまたは外部コマンド実行中 + これらはオプション 'statusline' の中や、|remote_expr()| といっ + しょに使うと便利である。他のほとんどの場所では "c" または "n" + しか返さない。 + |visualmode()| も参照。 + +mzeval({expr}) *mzeval()* + MzScheme の式 {expr} を評価してその結果を Vim の変数に変換した + 結果を返す。 + 数値と文字列はそのまま返る。 + ペア (リストと不適切なリスト (improper list) を含む) とベクタ + は Vim のリスト (|Lists|) に変換される。 + ハッシュテーブルは Vim の辞書 (|Dictionary|) に変換され、その + キーは文字列に変換される。 + その他のすべての型は display 関数を使って文字列に変換される。 + 例: > + :mz (define l (list 1 2 3)) + :mz (define h (make-hash)) (hash-set! h "list" l) + :echo mzeval("l") + :echo mzeval("h") +< + {|+mzscheme| 機能を有効にしてコンパイルしたときのみ有効} + +nextnonblank({lnum}) *nextnonblank()* + {lnum}行以降({lnum}行を含む)の最初の非空行の行番号を返す。 + 例: > + if getline(nextnonblank(1)) =~ "Java" +< {lnum}が無効なときや、それ以降に非空行がないときは0を返す。 + |prevnonblank()|も参照。 + +nr2char({expr}[, {utf8}]) *nr2char()* + コード{expr}で表される1文字からなる文字列を返す。例: > + nr2char(64) "@"を返す + nr2char(32) " "を返す +< {utf8} を省略、またはゼロを指定すると、現在の 'encoding' が適 + 用される。"utf-8" の場合の例: > + nr2char(300) 短音記号つきのIを返す +< {utf8} に 1 を指定すると、常に utf-8 文字が返る。 + Note Vim内部では、ファイル中のNUL文字を改行文字(0x0A)に変換し + て保持している。そのため、nr2char(10)とすればNUL文字を指定でき + る。nr2char(0)は真のNUL文字(文字列の終端)となるので、空文字列 + を返す。 + +or({expr}, {expr}) *or()* + 二つの引数のビット論理和。引数は数値に変換される。リスト、辞 + 書、浮動小数点数を指定するとエラーになる。 + 例: > + :let bits = or(bits, 0x80) + + +pathshorten({expr}) *pathshorten()* + パス{expr}におけるディレクトリ名を短縮して返す。拡張子、ファイ + ル名はそのまま保たれる。パスのその他の構成要素は1文字に縮めら + れる。1文字目の '~' と '.' はそのまま保たれる。例: > + :echo pathshorten('~/.vim/autoload/myfile.vim') +< ~/.v/a/myfile.vim ~ + パスが実際に存在するかどうかは関係ない。 + +perleval({expr}) *perleval()* + Perl の式 {expr} をスカラーコンテキストで評価して、結果をVimの + データ形式にして返す。 + もし値が変換できない場合、Perlにおける文字列として返される。 + Note: もし配列かハッシュが必要ならば、{expr}ではそれらへの参照 + を返す必要がある。 + 例: > + :echo perleval('[1 .. 4]') +< [1, 2, 3, 4] + {|+perl| 機能付きでコンパイルされたときのみ利用可能} + +pow({x}, {y}) *pow()* + {x} の {y} 乗を |Float| で返す。{x} と {y} は |Float| または + |Number| に評価されなければならない。 + 例: > + :echo pow(3, 3) +< 27.0 > + :echo pow(2, 16) +< 65536.0 > + :echo pow(32, 0.20) +< 2.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + +prevnonblank({lnum}) *prevnonblank()* + {lnum}行以前({lnum}行を含む)の最初の非空行の行番号を返す。 + 例: > + let ind = indent(prevnonblank(v:lnum - 1)) +< {lnum}が無効なときや、それ以降に非空行がないときは0を返す。 + |nextnonblank()|も参照。 + + +printf({fmt}, {expr1} ...) *printf()* + {fmt}にしたがって組み立てた文字列を返す。{fmt}中の "%" 変換指 + 示子は、対応する引数の値で置き換えられる。例: > + printf("%4d: E%d %.30s", lnum, errno, msg) +< 結果は次のような形になる: + " 99: E42 asdfasdfasdfasdfasdfasdfasdfas" ~ + + よく使われる変換指示子は次の通り: + %s 文字列 + %6S 6表示幅で右揃えした文字列 + %6s 6バイトで右揃えした文字列 + %.9s 9バイトに切り詰めた文字列 + %c 1バイト + %d 10進数値 + %5d スペースで埋めて5文字にした10進数値 + %x 16進数値 + %04x 0で埋めて少なくとも4文字にした16進数値 + %X 16進数値(大文字) + %o 8進数値 + %08b 最低8文字の0埋めされた2進数 + %f 浮動小数点数。12.23, inf, -inf, nan + %F 浮動小数点数。12.23, INF, -INF, NAN + %e 浮動小数点数。1.23e3, inf, -inf, nan + %E 浮動小数点数。1.23E3, INF, -INF, NAN + %g 浮動小数点数。値によって %f または %e となる + %G 浮動小数点数。値によって %F または %E となる + %% 文字 % そのもの + + 変換指示子は '%' で始まり、変換文字で終わる。それ以外の全ての + 文字はそのままになる。 + + "%" は変換指示子の開始を意味する。以下の順序で引数を指定できる: + + % [flags] [field-width] [.precision] type + + フラグ + 0個以上の以下のフラグを指定できる + + # 値を「代替形式」に変換する。変換指示子c, d, sに + 対してはこのオプションは効果を持たない。変換指示 + 子oに対しては数値の精度を上げ、出力文字列の最初 + の文字が0になる。(明示的な精度0で値0が表示される + ときを除く) + 変換指示子bとBに対しては、値が0でない場合、文字 + 列 "0b" (変換子Bの場合は "0B")を前につける。 + 変換指示子xとXに対しては、値が0でない場合、文字 + 列 "0x" (変換子Xの場合は "0X")を前につける。 + + 0 (zero) ゼロパディングする。全ての変換に対し、変換された + 値の左側を空白でなく0で埋める。数値変換(d, b, B, + o, x, X)に対して精度が指定されている場合はフラグ + 0は無視される。 + + - 負のフィールド幅を示す。変換値がフィールド境界に + 左揃えされる。変換値の左に空白や0がつくのではな + く、変換値の右に空白がつく。 + -と0を両方指定した場合は-が有効になる。 + + ' ' (space) 空白。符号付き変換(d)で作成される正の数値の前 + に空白が残る。 + + + +文字。符号付き変換で作成される数値の前に常に符 + 号を付ける。+と' '(space)を両方指定した場合は+が + 有効になる。 + + フィールド幅 + 10進数文字列(省略可)。最低フィールド幅を指定する。変換 + 値のバイト数がこのフィールド幅より少ない場合、左に空白 + がついて(左揃えフラグを指定した場合は右に空白がついて) + フィールドの幅に合わせられる。 + + .精度 + ピリオド '.' の次に数字文字列がつづく形式の精度(省略 + 可)。数字文字列を省略した場合、精度は0になる。d, o, x, + X変換における最低桁数を指定する。また、s変換における最 + 大バイト数を指定する。 + 浮動小数点数の場合は小数点以下の桁数。 + + 型 + 変換の型を指定する1文字。下記を参照。 + + フィールド幅と精度には、数字文字列の代わりにアスタリスク '*' + を指定できる。その場合、対応する数値の引数がフィールド幅または + 精度となる。負のフィールド幅を指定すると、絶対値がフィールド幅 + となり、左揃えフラグがオンになる。負の精度を指定すると、完全に + 無視される。例: > + :echo printf("%d: %.*s", nr, width, line) +< この例は、テキスト "line" の長さを "width" バイトに制限する。 + + 変換指示子の意味は以下の通り: + + *printf-d* *printf-b* *printf-B* *printf-o* + *printf-x* *printf-X* + dbBoxX 数値の引数を符号付き10進数(d)、符号なし2進数(bまたは + B)、符号なし8進数(o)、符号なし16進数(xまたはX)の書式に + 変換する。xの場合は "abcdef" と小文字を使い、Xの場合は + "ABCDEF" と大文字を使う。 + 精度が指定されていれば出力する最小桁数を意味する。変換 + された値を出力するのにそれ以下しか必要としない場合は、 + 左側にゼロを加えて埋める。 + フィールド幅が存在しない場合や小さすぎる場合でも、数値 + の幅を切り詰めることは決してない。変換結果がフィールド + 幅より多くの桁を必要とする場合は、十分な幅に広げられる。 + モディファイア 'h' は引数が16ビット引数である事を示す。 + モディファイア 'l' は引数が32ビット引数をある事を示す。 + モディファイア 'L' は引数が64ビット引数をある事を示す。 + 一般的にモディファイアは便利ではない。引数から型が分か + る時には無視されてしまう。 + + i d のエイリアス + D ld のエイリアス + U lu のエイリアス + O lo のエイリアス + + *printf-c* + c 引数の数値を1バイトに変換し、結果の文字列を書き出す。 + + *printf-s* + s 引数の文字列を出力する。精度を指定した場合、その数値以 + 下のバイト数のみを書き出す。 + 引数が文字列型ではない場合、":echo" と同じ形式のテキス + トに自動的に変換される。 + *printf-S* + S 引数の文字列を出力する。精度を指定した場合、その数値以 + 下の表示幅のみを書き出す。|+multi_byte| 機能がない場合 + は 's' と同じ動作になる。 + + *printf-f* *E807* + f F Float の引数を 123.456 の形式の文字列に変換する。精度 + は小数点以下の桁数を指定する。精度が 0 のときは小数点 + 以下は省略される。精度を指定しないときは 6 桁となる。 + とてつもなく大きい数(範囲外またはゼロによる除算)のとき + は %f の場合 "inf" または "-inf" となる (%F の場合は + "INF" または "-INF")。"0.0 / 0.0" は %f の場合 "nan" + になる (%F の場合は "NAN")。 + 例: > + echo printf("%.2f", 12.115) +< 12.12 + 丸めはシステムのライブラリに依存する。心配なときは + |round()| を使うこと。 + + *printf-e* *printf-E* + e E Float の引数を 1.234e+03 という形式('E' のときは + 1.234E+03)の文字列に変換する。精度は 'f' の場合と同じ + く小数点以下の桁数を指定する。 + + *printf-g* *printf-G* + g G 0.001(を含む)から10000000.0(を除く)の間の場合は 'f' の + 形式で変換し、この間にない場合は 'g' は 'e'、'G' は 'E' + の形式によって変換する。精度が指定されないときは余分な + ゼロ(小数点の直後のゼロ以外)と '+' 記号は省かれる。よっ + て 10000000.0 は 1.0e7 になる。 + + *printf-%* + % 単一の '%' を書き出す。引数は変換しない。完全な変換指 + 定は "%%" となる。 + + 数値の引数を受け取る変換指示子には文字列を与えることもできる。 + 変換は自動的に行われる。 + 浮動小数点数または文字列の引数を受け取る変換指示子には、数値を + 与えることもできる。変換は自動的に行われる。 + それ以外の型の引数を与えるとエラーメッセージが表示される。 + + *E766* *E767* + {expr1}以降の引数の数と "%" 変換指示子の個数がちょうど一致しな + ければならない。そうでない場合はエラーとなる。引数は最大18個ま + で使える。 + + +pumvisible() *pumvisible()* + ポップアップメニューが表示されているときには非0を返す。表示さ + れていないときは0を返す。|ins-completion-menu|を参照。 + ポップアップメニューを消してしまうような操作を避けるために使わ + れる。 + + *E860* +py3eval({expr}) *py3eval()* + Python の式 {expr} を評価して、結果を Vim のデータ形式にして返 + す。 + 数値と文字列はそのまま返る (ただし文字列はコピーされ、Unicode + から 'encoding' に変換される)。 + リストは Vim の |List| 型に変換される。 + 辞書は Vim の |Dictionary| 型に変換される。辞書のキーは文字列 + に変換される。 + {|+python3| 機能付きでコンパイルされたときのみ利用可能} + + *E858* *E859* +pyeval({expr}) *pyeval()* + Python の式 {expr} を評価して、結果を Vim のデータ形式にして返 + す。 + 数値と文字列はそのまま返る (ただし文字列はコピーされる)。 + リストは Vim の |List| 型に変換される。 + 辞書は Vim の |Dictionary| 型に変換される。文字列ではない辞書 + のキーはエラーになる。 + {|+python| 機能付きでコンパイルされたときのみ利用可能} + +pyxeval({expr}) *pyxeval()* + Python の式 {expr} を評価して、結果を Vim のデータ形式にして返 + す。 + Python 2 または 3 を使用する。|python_x| と 'pyxversion' を参 + 照。 + |pyeval()|, |py3eval()| も参照。 + {|+python| または |+python3| 機能付きでコンパイルされたときの + み利用可能} + + *E726* *E727* +range({expr} [, {max} [, {stride}]]) *range()* + 以下のような数値のリスト|List|を返す。 + - {expr}のみを指定したときは: [0, 1, ..., {expr} - 1] + - {max}を指定したときは: [{expr}, {expr} + 1, ..., {max}] + - {stride}を指定したときは: [{expr}, {expr} + {stride}, ..., + {max}] ({max}を超えないように{expr}を{stride}ずつ増加させる) + 最大値が開始位置より1だけ前のときは空リストを返す。最大値が開 + 始位置より1以上前のときはエラーになる。 + 例: > + range(4) " [0, 1, 2, 3] + range(2, 4) " [2, 3, 4] + range(2, 9, 3) " [2, 5, 8] + range(2, -2, -1) " [2, 1, 0, -1, -2] + range(0) " [] + range(2, 0) " エラー! +< + *readfile()* +readfile({fname} [, {binary} [, {max}]]) + ファイル{fname}を読み込み、各行を要素とするリスト|List|を返す。 + 行はNL文字で終わるものとする。改行文字がCRであるMacintoshのファ + イルは単一の長い行となる(どこかにNLが現れない限り)。 + すべての NUL 文字は NL 文字に置換される。 + {binary}が "b" を含む場合、次のようにバイナリモードになる: + - 最後の行がNLで終わるときは、リストの末尾に余分な空文字列が追 + 加される。 + - CR文字を除去しない。 + バイナリモードでない場合: + - NLの前に現れるCR文字を除去する。 + - 最後の行がNLで終わるかどうかは関係ない。 + - 'encoding' がUnicodeのときは UTF-8 のバイトオーダーマークは + 取り除かれる。 + {max}を指定すると、読み込む行数の最大値となる。ファイルの最初 + の10行をチェックするときに役に立つ: > + :for line in readfile(fname, '', 10) + : if line =~ 'Date' | echo line | endif + :endfor +< {max}が負の場合は、ファイルの最後から-{max}行を読み込んで返す。 + ファイルが{max}行以下の場合は全行を返す。 + {max}が0の場合は空リストを返す。 + Note {max}を指定しない場合はファイル全体をメモリに読み込む。エ + ンコーディング判定も行わないことに注意。必要ならバッファに読み + 込むこと。 + ファイルを開けないときはエラーメッセージを表示し、空リストを返 + す。 + |writefile()|も参照。 + +reltime([{start} [, {end}]]) *reltime()* + 時刻値を表す値を返す。値の形式はシステムに依存する。この値を + |reltimestr()|に渡すと文字列に変換でき、|reltimefloat()|に渡す + と浮動小数点数に変換できる。 + 引数を指定しないと現在時刻を返す。 + 1個の引数を指定すると、その引数で指定された時刻からの経過時間 + を返す。 + 2個の引数を指定すると、{start}と{end}の間の経過時間を返す。 + {start}と{end}はreltime()で返される値でなければならない。 + {|+reltime| 機能付きでコンパイルされたときのみ利用可能} + +reltimefloat({time}) *reltimefloat()* + {time} の値を代わりに浮動小数点で返す。 + 例: > + let start = reltime() + call MyFunction() + let seconds = reltimefloat(reltime(start)) +< オーバーヘッドについては reltimestr() の note を参照。 + Also see |profiling|. + {|+reltime| 機能付きでコンパイルされたときのみ利用可能} + +reltimestr({time}) *reltimestr()* + 時刻値{time}を表現する文字列を返す。秒、ドット、マイクロ秒とい + う形式になる。例: > + let start = reltime() + call MyFunction() + echo reltimestr(reltime(start)) +< Note このコマンドにかかるオーバーヘッドがこの時間に加算される。 + 精度はシステムに依存する。 + 文字列をきれいに揃えるために、先頭にスペースが挿入される。この + スペースを取り除くにはsplit()を使えばよい。 > + echo split(reltimestr(reltime(start)))[0] +< |profiling|も参照。 + {|+reltime| 機能付きでコンパイルされたときのみ利用可能} + + *remote_expr()* *E449* +remote_expr({server}, {string} [, {idvar}]) + {string}を{server}に送信する。{string}は式と見なされ、評価した + 結果が返ってくる。 + 戻り値は文字列かリスト|List|でなければならない。リストの場合は + 要素を連結して文字列に変換される。要素間の区切りは改行文字とな + る(join(expr, "\n")と同様)。 + {idvar}には変数名を指定する。後でremote_read()で使われる + {serverid}がその変数に保存される。 + |clientserver|と|RemoteReply|も参照。 + |sandbox|の中ではこの関数は利用できない。 + {|+clientserver|機能付きでコンパイルされたときのみ利用可能} + Note: なんらかのエラーが発生した場合は、ローカルでエラーメッ + セージが表示され、戻り値は空文字列となる。 + 例: > + :echo remote_expr("gvim", "2+2") + :echo remote_expr("gvim1", "b:current_syntax") +< + +remote_foreground({server}) *remote_foreground()* + サーバー名{server}のVimをフォアグラウンドに移動させる。 + 次を実行するのと同様である: > + remote_expr({server}, "foreground()") +< + ただし、次の点が異なる: Win32では、OSが必ずしもサーバーが自分 + 自身をフォアグラウンドにすることを許可しないので、対応策として + クライアントが仕事を行う。 + Note: foreground()と違い、最小化されていたウィンドウを復元しな + い。 + |sandbox|の中ではこの関数は利用できない。 + {Win32, Athena, Motif, GTKのGUI版とWin32コンソール版でのみ利用 + 可能} + + +remote_peek({serverid} [, {retvar}]) *remote_peek()* + {serverid}から文字列を取得可能ならば正の数値を返す。変数 + {retvar}に返信文字列をコピーする。{retvar}は変数の名前を示す文 + 字列でなければならない。 + 取得できないならば0を返す。 + なんらかの異状のときは-1を返す。 + |clientserver|も参照。 + |sandbox|の中ではこの関数は利用できない。 + {|+clientserver|機能付きでコンパイルされたときのみ利用可能} + 例: > + :let repl = "" + :echo "PEEK: ".remote_peek(id, "repl").": ".repl + +remote_read({serverid}) *remote_read()* + {serverid}からの返信の中で最も古いものを取り出して返す。取り出 + した返信はキューから取り除かれる。キューに返信が入っていないと + きは、返信を取り出せるようになるまで待機する。 + |clientserver|も参照。 + |sandbox|の中ではこの関数は利用できない。 + {|+clientserver|機能付きでコンパイルされたときのみ利用可能} + 例: > + :echo remote_read(id) +< + *remote_send()* *E241* +remote_send({server}, {string} [, {idvar}]) + {string}を{server}に送信する。{string}はキー入力として解釈さ + れ、この関数の呼び出しは即座に戻ってくる。Vimサーバーにおいて、 + 受け取ったキー入力はマッピング展開されない。|:map| + {idvar}には変数名を指定する。後でremote_read()で使われる + {serverid}がその変数に保存される。 + |clientserver|と|RemoteReply|も参照。 + |sandbox|の中ではこの関数は利用できない。 + {|+clientserver|機能付きでコンパイルされたときのみ利用可能} + Note: なんらかのエラーが発生すると、サーバー側で報告され、表示 + が乱れてしまうかもしれない。 + 例: > + :echo remote_send("gvim", ":DropAndReply ".file, "serverid"). + \ remote_read(serverid) + + :autocmd NONE RemoteReply * + \ echo remote_read(expand("")) + :echo remote_send("gvim", ":sleep 10 | echo ". + \ 'server2client(expand(""), "HELLO")') +< +remove({list}, {idx} [, {end}]) *remove()* + {end}を指定しなかった場合: リスト{list}から{idx}位置の要素を削 + 除し、その要素を返す。 + {end}を指定した場合: {idx}から{end}まで(両端を含む)の要素を削 + 除し、それらの要素からなるリストを返す。{idx}と{end}が同じ要素 + を指す場合、1個の要素からなるリストが返る。{end}が{idx}より前 + になる場合、エラーとなる。 + {idx}と{end}として指定できる値については|list-index|を参照。 + 例: > + :echo "last item: " . remove(mylist, -1) + :call remove(mylist, 0, 9) +remove({dict}, {key}) + {dict}からキー{key}を持つ要素を削除する。例: > + :echo "removed " . remove(dict, "one") +< {dict}に{key}がない場合はエラーになる。 + + ファイルを削除するには|delete()|を使う。 + +rename({from}, {to}) *rename()* + ファイルの名前を{from}から{to}へ変える。ファイルシステムを越え + てファイルを移動するのにも使用できる。結果は数値で、成功すれば + 0、失敗すれば非ゼロになる。 + NOTE: ファイル {to} がすでに存在する場合、警告なしに上書きされ + る。 + |sandbox|の中ではこの関数は利用できない。 + +repeat({expr}, {count}) *repeat()* + {expr}を{count}回繰り返し、連結して返す。例: > + :let separator = repeat('-', 80) +< {count}が0または負のときは空文字列を返す。{expr}がリスト + |List|のときは{count}回連結した結果を返す。例: > + :let longlist = repeat(['a', 'b'], 3) +< 結果は['a', 'b', 'a', 'b', 'a', 'b']となる。 + + +resolve({filename}) *resolve()* *E655* + MS-Windowsでは{filename}がショートカット(.lnkファイル)ならばそ + の指す先を単純化した形式で返す。 + Unixではパス{filename}の中の全てのシンボリックリンクを解決し、 + 単純化して返す。循環リンクがある場合に備えて、シンボリックリン + クの解決は100回までに制限されている。 + その他のシステムでは{filename}を単純化して返す。 + 単純化の手順は|simplify()|と同じである。 + resolve()は(結果も相対パスであるならば)カレントディレクトリを + 表す先頭のパスコンポーネントと、末尾のパス区切り文字をそのまま + にする。 + + *reverse()* +reverse({list}) {list}の要素の順序をその場で(in-place)反転させる。{list}そのも + のを返す。 + リストを変更させないでおくには、最初にコピーを作る: > + :let revlist = reverse(copy(mylist)) + +round({expr}) *round()* + {expr} を最も近い整数に丸め、|Float| を返す。{expr} が二つの整 + 数の真ん中にある場合、大きい方(0 から遠い方)になる。 + {訳注: つまり四捨五入になる} + {expr} は |Float| または |Number| に評価されなければならない。 + 例: > + echo round(0.456) +< 0.0 > + echo round(4.5) +< 5.0 > + echo round(-4.5) +< -5.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + +screenattr(row, col) *screenattr()* + |screenchar()| と同様だが、属性を返す。これは他の位置の属性と + 比較するのに利用できるだけの適当な数値である。 + +screenchar(row, col) *screenchar()* + スクリーン上の位置 [row, col] の文字を数値で返す。これは全ての + スクリーン位置、ステータスライン、ウィンドウセパレータ、コマン + ドラインで機能する。左上の位置は行番号が1、列番号が1である。文 + 字は合成文字を除く。2バイトのエンコーディングでは最初のバイト + だけであるかもしれない。 + この関数は主にテスト用に使われる。 + row か col が範囲外である場合は -1 を返す。 + +screencol() *screencol()* + 現在のカーソルのスクリーン列を数値で返す。一番左の列番号は 1。 + この関数は主にテスト用。 + + Note: 常に現在のスクリーン列を返す。したがって、コマンドで使わ + れた場合 (例えば ":echo screencol()") は、コマンドライン内の列 + を返す (つまりコマンドが実行されたときその値は 1)。ファイル内 + でのカーソル位置を取得するには次のようなマップを使用する: > + nnoremap GG ":echom ".screencol()."\n" + nnoremap GG :echom screencol() +< +screenrow() *screenrow()* + 現在のカーソルのスクリーン行を数値で返す。一番上の行番号は 1。 + この関数は主にテスト用。 + 代用として |winline()| を使う事ができる。 + + Note: |screencol()| と同様の制約あり。 + +search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* + 正規表現パターン{pattern}を検索する。検索はカーソル位置から開 + 始する(検索位置を指定するには|cursor()|を使えばよい)。 + + マッチが見つかった場合はその行番号を返す。 + マッチがない場合は0を返し、カーソルは移動しない。エラーメッ + セージは表示されない。 + + {flags} は以下のフラグ文字からなる文字列 + 'b' 後方(上方)に検索する + 'c' カーソル位置のマッチを受け入れる + 'e' マッチの末尾へ移動する + 'n' カーソルを移動させない + 'p' 部分パターン(後述)のマッチの番号を返す + 's' 以前のカーソル位置をマーク ' に記録する + 'w' ファイルの末尾で循環する + 'W' ファイルの末尾で循環しない + 'z' 0桁目からではなく、カーソル位置の桁から検索を開始する + 'w' と 'W' の両方とも指定されない場合は 'wrapscan' が適用され + る。 + + フラグ 's' が指定された場合、カーソルが移動したときのみマーク' + が設定される。フラグ 's' は 'n' と組み合わせることはできない。 + + 'ignorecase', 'smartcase', 'magic' が適用される。 + + フラグ 'z' が指定されない場合、常に0列目から開始して検索する。 + そして、カーソルの前にあるマッチはスキップされる。 + 'cpo' 内に 'c' フラグが存在する場合、次の検索はそのマッチの後 + から始まる。 + 'cpo' 内に 'c' フラグが存在しない場合、次の検索は現在のカーソ + ル位置から1桁進んで始まる。 + + 引数{stopline}が指定されたときはこの行を検索した後で検索を停止 + する。これは検索する行を制限するために有用である。例: > + let match = search('(', 'b', line("w0")) + let end = search('END', '', line("w$")) +< {stopline}に0でない値が指定されたときは、暗黙にファイルの末尾 + で循環しなくなる。 + 0 の値は、引数を省略したときと同じになる。 + + {timeout} が指定された場合、そのミリ秒が経過したところで検索が + 停止する。つまり、{timeout} が 500 なら検索は 500 ミリ秒で停止 + する。 + この値は負であってはならない。0 の値は、引数を省略したときと同 + じになる。 + {|+reltime| 機能つきでコンパイルされたときのみ有効} + + *search()-sub-match* + フラグ 'p' を指定すると、戻り値は \(\) によるグループ化のうち + 最初にマッチしたものの番号プラス 1 となる。パターン全体はマッ + チしたがどのグループもマッチしなかったときは 1 を返す。 + 桁番号を取得するには|searchpos()|を使う。 + + フラグ 'n' が指定されていない場合、マッチ位置にカーソルが移動 + する。 + + 例 (引数リストの全ファイルにわたって検索して置換する): > + :let n = 1 + :while n <= argc() " arglist中の全ファイルに対してループ + : exe "argument " . n + : " ファイルの最後の文字から開始し、循環してファイルの + : " 最初から検索する + : normal G$ + : let flags = "w" + : while search("foo", flags) > 0 + : s/foo/bar/g + : let flags = "W" + : endwhile + : update " 修正されていればファイルを保存する + : let n = n + 1 + :endwhile +< + フラグの使い方の例: > + :echo search('\ + if searchdecl('myvar') == 0 + echo getline('.') + endif +< + *searchpair()* +searchpair({start}, {middle}, {end} [, {flags} [, {skip} + [, {stopline} [, {timeout}]]]]) + ネストしたstart・endのペアを検索する。これを使うと、"if" に対 + 応する "endif" を見つけることができる。それらの間にある他のif・ + endifのペアは無視される。 + 検索はカーソル位置から開始する。デフォルトでは下方に検索する。 + {flags}に 'b' が含まれていると上方に検索する。 + マッチが見つかると、その位置へカーソルを移動し、行番号を返す。 + マッチが見つからなかったときは0または-1を返し、カーソルは移動 + しない。エラーメッセージは表示されない。 + + {start}、{middle}、{end}は正規表現である。|pattern|を参照。こ + の正規表現に \( \) のペアを含めてはならない。\%( \) は含めても + よい。{middle}はネストしたstart・endペアの中にないときのみマッ + チする。典型的な使用例: > + searchpair('\', '\', '\') +< ここで{middle}を空にすると "else" をスキップするようになる。 + + {flags}には|search()|と同様に 'b', 'c', 'n', 's', 'w', 'W' が + 使える。それに加えて以下のフラグが利用できる。 + 'r' それ以上マッチが見つからなくなるまで繰り返す。つまり最 + も外側のペアを探す。'W' も自動的にオンになる。 + 'm' マッチ位置の行番号でなくマッチの個数を返す。'r' を使っ + ているときは > 1 となる。 + Note: ほとんど常に 'W' を使ってファイルの末尾で循環しないよう + にするのがよい考えである。 + + {start}、{middle}、{end}のマッチが見つかると、マッチの開始位置 + にカーソルを移動し、式{skip}を評価する。このマッチがコメントや + 文字列の内側にある場合など、無視したいものであれば式{skip}が + 非0を返すようにする。 + {skip}を省略した、または空のときはどのマッチも無視しない。 + {skip}を評価している最中にエラーが発生すると、検索は異常終了し + -1を返す。 + + {stopline} と {timeout} については|search()|を参照。 + + 'ignorecase' の値が適用される。'magic' の値は無視され、オンの + ときと同じ様に動作する。 + + 検索はカーソル位置から開始する。検索方向の次の文字における + {start}、{middle}、{end}のマッチが最初に見つかる。例: > + if 1 + if 2 + endif 2 + endif 1 +< カーソルが "if 2" の "i" の上にある状態から下方に検索を開始す + ると "endif 2" にマッチする。"if 2" の直前の文字の上から検索を + 開始すると "endif 1" にマッチする。これは、"if 2" が最初に見つ + かり、"if 2" から "endif 2" までがネストしたペアと見なされるた + めである。上方検索で、{end}が2文字以上であるときはパターンの最 + 後に "\zs" をつけるとよいかもしれない。するとカーソルがendの + マッチの内側にあるとき、対応するstartを見つけるようになる。 + + 例: Vim script の "endif" コマンドを見つけるには: > + + :echo searchpair('\', '\', '\', 'W', + \ 'getline(".") =~ "^\\s*\""') + +< これを使うには、マッチを見つけたい "if" の上、またはそれ以降に + カーソルを置くこと。Note バックスラッシュを二重にしなくてもよ + いようにシングルクォート文字列を使っている。式skipにより、コメ + ントだけの行を無視するようにしている。コマンドの後のコメントは + 無視していない。また、行の途中の "en" や "if" という単語にマッ + チしてしまう。 + もう1つの例: "}" に対応する "{" を検索する: > + + :echo searchpair('{', '', '}', 'bW') + +< これを使うには、マッチを見つけたい "}" の上、または前にカーソ + ルを置くこと。構文ハイライトにより文字列と見なされるマッチを無 + 視するには次のようにする: > + + :echo searchpair('{', '', '}', 'bW', + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"') +< + *searchpairpos()* +searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} + [, {stopline} [, {timeout}]]]]) + |searchpair()|と同様だが、マッチの行番号と桁番号からなるリスト + |List|を返す。このリストの最初の要素は行番号で、次の要素はマッ + チの桁位置のバイトインデックスである。マッチが見つからなかった + 場合は[0, 0]を返す。 > + + :let [lnum,col] = searchpairpos('{', '', '}', 'n') +< + より大規模で役に立つ例に関しては|match-parens|を参照。 + +searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()* + |search()|と同様だが、マッチの行番号と桁番号からなるリスト + |List|を返す。このリストの最初の要素は行番号で、次の要素はマッ + チの桁位置のバイトインデックスである。マッチが見つからなかった + 場合は[0, 0]を返す。 + 例: > + :let [lnum, col] = searchpos('mypattern', 'n') + +< フラグ 'p' を指定すると、戻り値にサブパターンのマッチ番号を示 + す要素が加わる|search()-sub-match|。例: > + :let [lnum, col, submatch] = searchpos('\(\l\)\|\(\u\)', 'np') +< この例において、"submatch" は小文字|/\l|が見つかったとき2とな + り、大文字|/\u|が見つかったとき3となる。 + +server2client({clientid}, {string}) *server2client()* + {clientid}に返信文字列を送る。最後に文字列を送った{clientid}は + expand("")で取得できる。 + {|+clientserver|機能付きでコンパイルしたときのみ利用可能} + Note: + このIDは次のコマンドを受け取る前に取得しなければならない。つま + り、受け取ったコマンドから戻る前で、入力を待つコマンドを呼ぶ前。 + |clientserver|も参照。 + 例: > + :echo server2client(expand(""), "HELLO") +< +serverlist() *serverlist()* + 利用可能なサーバー名のリストを返す。1行に1つの形式。 + サーバーが1つもないとき、または情報を取得できないときは空文字 + 列を返す。|clientserver|も参照。 + {|+clientserver|機能付きでコンパイルしたときのみ利用可能} + 例: > + :echo serverlist() +< +setbufvar({expr}, {varname}, {val}) *setbufvar()* + バッファ{expr}のオプションまたはローカル変数{varname}に{val}を + 代入する。 + グローバル・ウィンドウローカルオプションに対しても動作するが、 + グローバル・ウィンドウローカル変数に対しては動作しない。 + ウィンドウローカルオプションの場合、グローバルな値は変更されな + い。 + {expr}の解釈の仕方については|bufname()|を参照。 + Note 変数名には "b:" をつけてはならない。 + 例: > + :call setbufvar(1, "&mod", 1) + :call setbufvar("todo", "myvar", "foobar") +< サンドボックスの中ではこの関数は使用できない。 + +setcharsearch({dict}) *setcharsearch()* + 現在の文字検索の情報を{dict}に設定する。 + この辞書は下記のエントリを1以上持つ: + + char 続いて起こる|,|や|;|コマンドで使われる文字。 + 空文字列の場合、文字検索を解除する。 + forward 文字検索の方向。1は前方、0は後方。 + until 文字検索の種類。1は|t|もしくは|T|の文字検索、0は + |f|もしくは|F|の文字検索。 + + これはユーザーの文字検索のセーブ/リストアを使うことができる: > + :let prevsearch = getcharsearch() + :" ユーザーの検索に影響を与えるコマンドを実行する。 + :call setcharsearch(prevsearch) +< |getcharsearch()|も参照。 + +setcmdpos({pos}) *setcmdpos()* + コマンドラインの{pos}バイトの位置へカーソルを移動する。 + {pos}は1から始まる。 + 現在の位置を取得するには|getcmdpos()|を使う。 + コマンドラインを編集している最中のみ機能する。よって、 + |c_CTRL-\_e|、|c_CTRL-R_=|、|c_CTRL-R_CTRL-R|+ '=' と組み合 + わせて使うときだけ意味がある。|c_CTRL-\_e|と|c_CTRL-R_CTRL-R| + + '=' の場合、コマンドラインにその式をセットした後でカーソル + を移動する。|c_CTRL-R_=|の場合、式を評価した後、結果のテキスト + を挿入する前にカーソルを移動する。 + {pos}が大きすぎるときは行末にカーソルを移動する。{pos}が1より + 小さいときの結果は未定義である。 + 成功なら0、コマンドラインを編集しているとき以外には1を返す。 + +setfperm({fname}, {mode}) *setfperm()* *chmod* + {fname} のファイル許可属性を {mode} に設定する。 + {mode} は9文字の文字列でなければならない。形式は "rwxrwxrwx" + であり、それぞれはファイルの所有者権限、グループ権限、その他 + のユーザーを表す "rwx" というフラグのグループである。文字 "-" + は許可属性がオフであり、その他の文字はオンである。マルチバイト + 文字はサポートされない。 + + 例えば "rw-r-----" はそのユーザーの読み書き、グループでは読み + 取り専用、その他のユーザーはアクセス不可である。"xx-x-----" は + 同じ意味となる。 + + 成功するとゼロ以外を返し、失敗するとゼロを返す。 + + 許可属性の読み取りについては|getfperm()|を参照。 + + +setline({lnum}, {text}) *setline()* + カレントバッファの{lnum}行目を{text}にする。行を挿入したい場合 + は |append()| を使う。 + {lnum}は|getline()|のときと同じように解釈される。 + {lnum}が最後の行の次の行の場合、新規行として{text}を追加する。 + 成功したら0を返す。失敗したら(大抵{lnum}が無効な値のとき)1を返 + す。例: > + :call setline(5, strftime("%c")) +< {text}がリスト|List|の場合、{lnum}行目とそれ以降の行にリストの + 要素をセットする。例: > + :call setline(5, ['aaa', 'bbb', 'ccc']) +< 上の例は次と同値である: > + :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']] + : call setline(n, l) + :endfor +< Note: マーク '[ と '] はセットされない。 + +setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* + ウィンドウ{nr}のロケーションリストを作成・置き換え・追加する。 + {nr} にはウィンドウ番号または|window-ID|が使える。 + {nr}が0のときはカレントウィンドウを対象にする。 + + ロケーションリストウィンドウの場合、そこに表示しているロケー + ションリストが修正される。ウィンドウ番号{nr}が無効な場合、-1を + 返す。それ以外は|setqflist()|と同じ。 + |location-list| も参照。 + + オプショナル引数の辞書 {what} が提供される場合、{what} で指定 + されるアイテムのみが設定される。サポートされる {what} の一覧は + |setqflist()|を参照。 + +setmatches({list}) *setmatches()* + |getmatches()| で取得したマッチのリストを復元する。成功なら 0、 + 失敗なら -1 を返す。リストを復元するに先立って、現在のマッチは + すべて消去される。|getmatches()| の例を参照。 + + *setpos()* +setpos({expr}, {list}) + {expr}の位置を設定する。{expr}として有効な値は次の通り: + . カーソル位置 + 'x マーク x + + {list} は 4 個か 5 個の要素を持つリスト|List|である: + [bufnum, lnum, col, off] + [bufnum, lnum, col, off, curswant] + + "bufnum" はバッファ番号。0にするとカレントバッファを表す。大文 + 字のマークを設定するとき、"bufnum" はマーク位置として用いられ + る。それ以外のマークの場合、"bufnum" はマークを設定するバッファ + を指定する。関数|bufnr()|を使ってファイル名をバッファ番号に変 + 換することができる。 + カーソルと ' マークを設定する場合、バッファ番号は無視される。 + なぜならそれらはバッファではなくウィンドウに関連付けられている + からである。 + ジャンプリストは変更されない。 + + "lnum" と "col" はバッファ内の位置。桁番号は1から始まる。 + "lnum" を 0 にするとそのマークを削除する。"col" が 1 より小さ + いときは 1 が使われる。 + + 数値 "off" は 'virtualedit' がオンのときのみ使われ、その文字の + 開始位置からの画面上の桁のオフセットとなる。例えば、の中、 + または最後の文字より後に設定したいときに使う。 + + "curswant" はカーソル位置を設定するときのみ使われる。これは縦 + 方向移動の優先的列番号である。"curswant" を指定しなかった場合 + は優先値は設定されない。マークの位置を設定するときに + "curswant" を指定した場合はその値は使用されない。 + + Note: '< と '> の行番号を変更した場合は '< が '> の手前にくる + ように位置が交換される。 + + 位置をセットできたときは 0 を、そうでなければ -1 を返す。 + {expr} が無効なときはエラーメッセージが出る。 + + |getpos()| と |getcurpos()| も参照。 + + 縦方向移動の優先的列番号は復元されない。しかしカーソル位置を設 + 定するときにこの値を設定した場合は、|j| や |k| で移動すると以 + 前の列にジャンプようになるだろう。優先的列番号の設定については + |cursor()| も参照。|winrestview()| の "curswant" キーも参照。 + + +setqflist({list} [, {action}[, {what}]]) *setqflist()* + {list}の要素によりQuickFixリストを作成・置き換え・追加する。 + {list}の各要素は辞書であること。 + 辞書でない{list}の要素は無視される。各辞書は以下の要素を持つ: + + bufnr バッファ番号。有効なバッファ番号でなければなら + ない。 + filename ファイル名。"bufnr" がないとき、または無効であ + るときのみ使われる。 + lnum ファイル中の行番号 + pattern エラーの位置を特定するための検索パターン + col 桁番号 + vcol 0でない場合: "col" は表示上の桁 + 0の場合: "col" はバイトインデックス + nr エラー番号 + text エラーの説明 + type エラータイプを示す1文字。'E', 'W' など。 + + 辞書の要素 "col"、"vcol"、"nr"、"type"、"text" は省略可能であ + る。"lnum" か "pattern" のどちらか一方のみがエラー行を特定する + ために使われる。"filename" と "bufnr" の両方ともない場合、また + は "lnum" と "pattern" の両方ともない場合、その要素はエラー行 + として扱われない。"pattern" と "lnum" の両方があるときは + "pattern" が使われる。 + {list} に空のリストを指定すると QuickFix リストはクリアされ + る。 + このリストは|getqflist()|が返すものと正確に同じではないことに + 注意。 + + *E927* + {action}が 'a' ならば{list}の要素を既存のQuickFixリストに追加 + する。QuickFixリストがまだ存在しない場合は新規に作成される。 + + {action}が 'r' ならば{list}の要素で現在のQuickFixリストを置き + 換える。これはリストをクリアするのにも使える: > + :call setqflist([], 'r') +< + {action}が指定されないとき、または ' ' のときは新しい QuickFix + リストを作成する。 + + オプショナル引数の辞書 {what} が提供される場合、{what} で指定 + されるアイテムのみが設定される。最初の {list} は無視される。 + {what} では以下のアイテムを指定する事ができる: + nr quickfix スタックでのリスト番号 + title quickfix リストのタイトルテキスト + {what} 内でのサポートされていないキーは無視される。 + "nr" 番目のアイテムが提供されていない場合は現在の quickfix リ + ストが変更される。 + + 例: > + :call setqflist([], 'r', {'title': 'My search'}) + :call setqflist([], 'r', {'nr': 2, 'title': 'Errors'}) +< + 成功なら0、失敗なら-1を返す。 + + この関数は 'errorformat' の設定とは無関係にQuickFixリストを作 + るために使える。その最初のエラーへジャンプするには ":cc 1" な + どのコマンドを使う。 + + + *setreg()* +setreg({regname}, {value} [, {options}]) + レジスタ{regname}に{value}をセットする。 + {value} には |getreg()| の戻り値ならどんな値でも (リストでも) + 指定できる。 + {options}が "a" を含んでいるとき、または{regname}が大文字のと + きは、その値に追加する。 + {options}は以下のレジスタの種類指定を含んでもよい: + "c" または "v" |characterwise| モード + "l" または "V" |linewise| モード + "b" または "" |blockwise-visual| モード + "b" または "" の直後に数値を続けると、それが選択範囲の + 幅となる。これを指定しない場合、選択範囲の幅は一番長い行の文字 + 数となる(は1文字と数えられる)。 + + {options} にレジスタの設定が何も含まれていないときのデフォルト + 値は文字モードである。ただし、{value} が文字列で末尾が の + 場合や {value} がリストの場合は行モードになる。矩形モードは明 + 示的に指定しない限り選択されない。 + 成功なら0、失敗なら非0を返す。 + + *E883* + Note: 検索レジスタや式レジスタを設定するときは複数の要素を含ん + だリスト (|List|) を指定することはできない。空のリストは + 空文字列と同様に扱われる。 + + 例: > + :call setreg(v:register, @*) + :call setreg('*', @%, 'ac') + :call setreg('a', "1\n2\n3", 'b5') + +< 次の例は、この関数を使ってレジスタを退避・復元する例である + (note: |getreg()| の 3 番目の引数を使用せずにレジスタの内容を + 完全に復元することはできない。改行文字と Nul 文字がどちらも改 + 行文字として表現されてしまうため。|NL-used-for-Nul| 参照)。 + :let var_a = getreg('a', 1, 1) + :let var_amode = getregtype('a') + .... + :call setreg('a', var_a, var_amode) + +< 空文字列を追加すると、レジスタの種類を変更することができる: > + :call setreg('a', '', 'al') + +settabvar({tabnr}, {varname}, {val}) *settabvar()* + タブページ {tabnr} のタブローカル変数 {varname} を {val} に設 + 定する。 |t:var| + Note: 指定する変数名は "t:" を除いた名前。 + タブの番号は 1 から始まる。 + この関数はサンドボックス (|sandbox|) の中では使えない。 + +settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* + ウィンドウ{winnr}のオプションやローカル変数{varname}の値を + {val}にセットする。 + タブ番号は1から始まる。カレントタブページを対象とする場合は + |setwinvar()|を使う。 + {winnr} にはウィンドウ番号または|window-ID|が使える。 + {winnr}が0のときはカレントウィンドウが対象となる。 + グローバルオプションやバッファローカルオプションを設定すること + もできるが、グローバル変数やバッファローカル変数を設定すること + はできない。 + バッファローカルオプションを設定した場合、グローバル値は変更さ + れない。 + Note 変数名には "w:" をつけてはならない。 + 例: > + :call settabwinvar(1, 1, "&list", 0) + :call settabwinvar(3, 2, "myvar", "foobar") +< この関数は|sandbox|の中では使用できない。 + +setwinvar({nr}, {varname}, {val}) *setwinvar()* + |settabwinvar()|と同様。カレントタブページを対象とする。 + 例: > + :call setwinvar(1, "&list", 0) + :call setwinvar(2, "myvar", "foobar") + +sha256({string}) *sha256()* + {string}のSHA256チェックサムを64文字の16進文字列で返す。 + {|+cryptv| 機能つきでコンパイルされたときのみ有効} + +shellescape({string} [, {special}]) *shellescape()* + シェルコマンドの引数として利用できるように{string}をエスケープ + する。 + MS-WindowsとMS-DOSでは、'shellslash' が設定されていない場合、 + {string}をダブルクォートで囲み、{string}の中のダブルクォートを + 全て二重にする。 + そうでなければ、{string}をシングルクォートで囲み、"'" を + "'\''" で置き換える。 + {special} が指定され、0 でない数値または空でない文字列の場合 + (|non-zero-arg|)、"!", "%", "#", "" などの特殊なアイテ + ムの前にはバックスラッシュがつく。コマンド |:!| によってその + バックスラッシュは再び除かれる。 + 'shell' の値の末尾が "csh" である場合、{special} が + |non-zero-arg| ならば "!" の文字もエスケープされる。これは、 + csh と tcsh は シングルクォートの中であっても "!" を履歴置換と + 解釈するためである。 + 文字もエスケープされる。{special} が |non-zero-arg| であ + り 'shell' の末尾が "csh" である場合、これは2回エスケープされ + る。 + |:!| コマンドを使う場合の例: > + :exe '!dir ' . shellescape(expand(''), 1) +< これはカーソル下のファイルを dir コマンドで表示する。 + |system()| を使う場合の例: > + :call system("chmod +w -- " . shellescape(expand("%"))) +< |::S| も参照のこと。 + + +shiftwidth() *shiftwidth()* + 実際に使用される 'shiftwidth' の値を返す。'shiftwidth' がゼロ + 以外の場合はその値が返る。ゼロの場合は 'tabstop' の値が返る。 + この関数は2012年のパッチ 7.3.694 で導入されたので、現在では皆 + 使えるようになっているに違いない。 + + +simplify({filename}) *simplify()* + ファイル名を、意味を変えずにできるだけ簡略化する。MS-Windowsで + のショートカットやUnixでのシンボリックリンクは解決される。 + {filename}の最初のパスコンポーネントがカレントディレクトリを指 + す場合、結果にそのまま残される。末尾のパス区切り文字も取り除か + れない。 + 例: > + simplify("./dir/.././/file/") == "./file/" +< Note: "dir/.." の組み合わせは、"dir" が検索可能なディレクトリ + であるか、存在しないときのみ取り除かれる。Unixでは、"dir" が同 + じディレクトリ内にあるシンボリックリンクであるときも取り除かれ + る。パス名を簡略化する前に全てのシンボリックリンクを解決させる + には|resolve()|を使う。 + + +sin({expr}) *sin()* + {expr} の正弦(サイン)をラジアンで |Float| で返す。{expr} は + |Float| または |Number| に評価されなければならない。 + 例: > + :echo sin(100) +< -0.506366 > + :echo sin(-4.01) +< 0.763301 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +sinh({expr}) *sinh()* + {expr} の双曲線正弦 (ハイパボリックサイン) を返す。 + 値は [-inf, inf] の範囲の浮動小数点数 (|Float|)。 + {expr} は浮動小数点数 (|Float|) か数値 (|Number|) でなければな + らない。 + 例: > + :echo sinh(0.5) +< 0.521095 > + :echo sinh(-0.9) +< -1.026517 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +sort({list} [, {func} [, {dict}]]) *sort()* *E702* + {list}の要素をその場で(in-place)ソートする。{list}を返す。 + + リストを変更したくない場合は、最初にコピーを作っておくこと: > + :let sortedlist = sort(copy(mylist)) +< {func} が省略されたか空かゼロの場合は、各項目の文字列表現を + 使ってソートする。数値は文字列より後になり、リストは数値より後 + になる。カレントバッファのテキストをソートするには |:sort| を + 使う。 + + {func} が '1' か 'i' なら大文字小文字は区別されない。 + + {func} が 'n' ならすべての要素は数値順にソートされる (実装詳 + 細: 数値の読み込みには strtod() 関数が使われる。文字列、リス + ト、辞書、関数参照は 0 として扱われる)。 + + {func} が 'N' ならすべての要素は数値順にソートされる。これは + 'n' に似ているが、数値を含む文字列はその文字列が表す数値として + 扱われる。 + + {func} が 'f' ならすべての要素は数値順にソートされる。すべての + 値は数値か浮動小数点数でなければならない。 + + {func}に|Funcref|または関数名を指定すると、その関数を使って要 + 素を比較する。その関数は2つの要素を引数として受け取り、それら + が等しいときは0、1番目の引数を2番目より後にするなら1以上、1番 + 目の方を前にするなら-1以下を返す。 + + {dict} は "dict" 属性付きの関数と一緒に使う。値はローカル変数 + "self" として使われる。 |Dictionary-function| + + ソートは安定である。(数値または文字列として) 等価な要素は元の + 順序関係が保持される。例えば数値としてソートした場合、文字列は + 元の順番通りに隣り合って並ぶ。 + + |uniq()| も参照のこと。 + + 例: > + func MyCompare(i1, i2) + return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1 + endfunc + let sortedlist = sort(mylist, "MyCompare") +< この例の場合、より短く次のように書くことができる。ただしオーバー + フローは無視される: > + func MyCompare(i1, i2) + return a:i1 - a:i2 + endfunc +< + *soundfold()* +soundfold({word}) + {word} の soundfold 値を返す。カレントウィンドウの 'spelllang' + で設定された言語のうち、soundfold に対応している最初の言語が使 + 用される。'spell' がオンでなければならない。soundfold ができな + い場合は {word} がそのまま返される。 + この関数はスペル修正候補の作成に使える。Note この方法はとても + 遅くなる可能性がある。 + {訳注: phonetic algorithm の一種} + + *spellbadword()* +spellbadword([{sentence}]) + 引数なしの場合: カーソル下またはカーソル以降のスペルミスした単 + 語を返す。その単語の先頭へカーソルを移動する。カレント行にスペ + ルミスした単語が見つからない場合は空文字列を返し、カーソルは移 + 動しない。 + + 引数ありの場合: {sentence}の中のスペルミスしている最初の単語を + 返す。スペルミスしている単語がない場合は空文字列を返す。 + + 戻り値は、次の2個の要素を持つリスト: + - スペルミスした単語または空文字列 + - スペルミスの種類: + "bad" スペルミス + "rare" 頻度の低い単語 + "local" 他の地域でのみ有効な単語 + "caps" 大文字で始めるべき単語 + 例: > + echo spellbadword("the quik brown fox") +< ['quik', 'bad'] ~ + + カレントウィンドウに対するスペリング情報が適用される。オプショ + ン 'spell' がオンでなければならない。'spelllang' の値が使用さ + れる。 + + *spellsuggest()* +spellsuggest({word} [, {max} [, {capital}]]) + {word}の正しいスペルの候補のリストを返す。{max}を指定すると、 + 候補の数の最大値となる。{max}を指定しないと、25個までの候補を + 返す。 + + {capital}に0でない値を指定すると、先頭が大文字の候補だけを返す。 + これは 'spellcapcheck' とのマッチの後に使う。 + + {word}はスペルの間違った単語で、後に他のテキストが続いてもよい。 + これにより、分割された2つの単語を連結することができる。候補も + また続きのテキストを含んでいるので、これによって行を置き換える + ことができる。 + + {word}は正しい単語でもよい。すると似た単語が返ってくるだろう。 + {word}自身は候補に含まれないが、大文字化されたものが含まれてい + ることはある。 + + カレントウィンドウのスペリング情報が使われる。オプション + 'spell' がオンでなければならず、'spelllang' と 'spellsuggest' + の値が適用される。 + + +split({expr} [, {pattern} [, {keepempty}]]) *split()* + {expr}を分割して|List|にする。{pattern}を省略した場合、または + {pattern}が空文字列の場合は、{expr}を空白文字で区切った各文字 + 列が要素となる。 + {pattern}を指定すると、{pattern}がマッチする位置で文字列を分割 + する。マッチした文字列は削除される。'ignorecase' はここでは適 + 用されないので大文字小文字を無視するには \c を使う。 |/\c| + {keepempty}に非0を指定しない限り、最初または最後の要素が空文字 + 列ならばリストから取り除かれる。 + それ以外の空文字列は、{pattern}が1文字以上にマッチすれば、また + は{keepempty}が非0ならばそのままリストの要素となる。 + 例: > + :let words = split(getline('.'), '\W\+') +< 文字列を各文字に分割するには: > + :for c in split(mystring, '\zs') +< 区切り文字を削除せず、そのままにしておきたい場合は、'\zs' を + パターンの最後で使う: > + :echo split('abc:def:ghi', ':\zs') +< ['abc:', 'def:', 'ghi'] ~ + 最初の要素が空であるかもしれないテーブルを分割するには: > + :let items = split(line, ':', 1) +< これの逆を行う関数は|join()|である。 + + +sqrt({expr}) *sqrt()* + 浮動小数点数 {expr} の非負平方根を |Float| で返す。 + {expr} は |Float| または |Number| に評価されなければならない。 + {expr} が負の場合、結果は NaN (Not a Number) になる。 + 例: > + :echo sqrt(100) +< 10.0 > + :echo sqrt(-4.01) +< nan + "nan" はシステムのライブラリに依存するので、異なるかもしれな + い。 + {|+float| 機能つきでコンパイルされたときのみ有効} + + +str2float({expr}) *str2float()* + 文字列 {expr} を浮動小数点数に変換する。これは式の中で浮動小数 + 点数を使っているときと同じように働く (|floating-point-format| + を参照)。しかしこちらの方がゆるやかである。例えばこちらでは + "1e40" も許されるが、式の中では "1.0e+40" と書かなければならな + い。 + 数値の後ろにある文字列は黙って無視される。 + 小数点数はロケールの設定に関わらず常に '.' である。コンマを発 + 見すると、そこで数値は終わりになる。つまり "12,345.67" は 12.0 + に変換される。3桁ごとのコンマ区切りを取り除くには + |substitute()| が使える: > + let f = str2float(substitute(text, ',', '', 'g')) +< {|+float| 機能つきでコンパイルされたときのみ有効} + +str2nr({expr} [, {base}]) *str2nr()* + 文字列{expr}を数値に変換する。 + {base}は変換の底。2、8、10、16のいずれか。 + {base}を省略すると10となる。そのため、文字列の先頭に0があると + き、デフォルトの文字列・数値変換とは異なり、8進数とは解釈され + ない。 + {base}が16のとき、文字列の先頭の "0x" と "0X" は無視される。そ + れ以外の底の場合は0となる。同様に、 + {base}が8のとき、文字列の先頭の "0" は無視される。そして、 + {base}が2のとき、文字列の先頭の "0b" と "0B" は無視される。 + 数値の後のテキストは暗黙に無視される。 + +strchars({expr} [, {skipcc}]) *strchars()* + 結果は数値で、文字列 {expr} の文字の数を返す。 + {skipcc} を省略またはゼロを指定すると、合成文字は別々にカウン + トされる。 + {skipcc} に 1 を指定すると、合成文字は無視される。 + {訳注: 基底文字と結合文字をまとめて1としてカウントする} + |strlen()|, |strdisplaywidth()|, |strwidth()| も参照。 + + {skipcc}は7.4.755以降でのみ有効である。それ以前では、ラッパー + 関数を定義すればよい: > + if has("patch-7.4.755") + function s:strchars(str, skipcc) + return strchars(a:str, a:skipcc) + endfunction + else + function s:strchars(str, skipcc) + if a:skipcc + return strlen(substitute(a:str, ".", "x", "g")) + else + return strchars(a:str) + endif + endfunction + endif +< +strcharpart({src}, {start}[, {len}]) *strcharpart()* + |strpart()| と同様だがバイトのインデックスおよび長さではなく文 + 字のインデックスおよび長さを使用する。 + 文字インデックスが存在しない文字を指す場合、それは1文字である + として扱われる。例: > + strcharpart('abc', -1, 2) +< 結果は "a" である。 + +strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* + 結果は数値で、文字列 {expr} が {col} で始まる時のスクリーン上 + での表示セル幅を返す。 + {col} が省略されたときはゼロが使われる。{col} には計算を開始す + るスクリーン上の列の位置を指定する。これはタブ文字の幅の計算に + 影響する。 + 計算にはカレントウィンドウのオプションが使用される。'tabstop' + や 'display' のような表示を変更するようなオプションが影響す + る。 + {expr} に幅が曖昧 (Ambiguous) な東アジアの文字が含まれていると + きは、文字幅は 'ambiwidth' の設定に依存する。 + |strlen()|, |strwidth()|, |strchars()| も参照。 + + *strftime()* +strftime({format} [, {time}]) + 結果は文字列で、{format}に従って日付や時間がフォーマットされた + ものになる。{time}が与えられた場合にはそれを使うが、省略された + 場合には現在時刻を使用する。受け付け可能な文字列{format}は使用 + するシステムに依存するので、ポータブルとは言えない。フォーマッ + トについてはCの関数strftime()のマニュアルを参照。結果は最大80 + 文字に制限される。|localtime()|と|getftime()|も参照。 + ここで使われる言語はコマンド|:language|で変更できる。 + 例: > + :echo strftime("%c") Sun Apr 27 11:49:23 1997 + :echo strftime("%Y %b %d %X") 1997 Apr 27 11:53:25 + :echo strftime("%y%m%d %T") 970427 11:53:55 + :echo strftime("%H:%M") 11:55 + :echo strftime("%c", getftime("file.c")) + file.cの更新時刻を表示 +< この関数はどのシステムでも利用できるとは限らない。利用できるか + チェックするには次のようにする: > + :if exists("*strftime") + +strgetchar({str}, {index}) *strgetchar()* + {str} 内の {index} 番目の文字インデックスを得る。これは文字の + インデックスでありバイトのインデックスではない。合成文字は分割 + された文字として考慮される。 + |strcharpart()| と |strchars()| も参照。 + +stridx({haystack}, {needle} [, {start}]) *stridx()* + 結果は数値で、{heystack}の中で文字列{needle}が最初に現れる位置 + のバイトインデックスを表す。{start}を指定すると、インデックス + {start}の位置から検索を開始する。 + 2番目のマッチを探すには次のようにする: > + :let colon1 = stridx(line, ":") + :let colon2 = stridx(line, ":", colon1 + 1) +< 検索は大文字・小文字を区別する。 + 検索パターンについては|match()|を使う。 + {haystack}の中に{needle}がないときは-1を返す。 + |strridx()|も参照。 + 例: > + :echo stridx("An Example", "Example") 3 + :echo stridx("Starting point", "Start") 0 + :echo stridx("Starting point", "start") -1 +< *strstr()* *strchr()* + stridx()はCの関数strstr()と同じように動作する。{needle}が1文字 + のときはstrchr()と同じように動作する。 + + *string()* +string({expr}) {expr}を文字列に変換して返す。{expr}が数値、浮動小数点数、文字 + 列、それらの複合の場合は、この戻り値を|eval()|でパースして復元 + できる。 + {expr} 型 結果 ~ + 文字列 'string' (シングルクォートは二重化され + る) + 数値 123 + 浮動小数点数 123.123456 or 1.123456e8 + Funcref function('name') + リスト [item, item] + 辞書 {key: value, key: value} + リストや辞書に循環参照がある場合、それらは "[...]" や "{...}" + に置き換えられる。その結果に対して eval() を使用すると失敗す + る。 + |strtrans()|も参照。 + + *strlen()* +strlen({expr}) 結果は数値で、文字列{expr}のバイト単位での長さ。 + 引数が数値の場合は、まず文字列に変換される。 + それ以外の型の場合はエラーとなる。 + マルチバイト文字の数を数える場合は|strchars()|を使用する。 + |len()|, |strdisplaywidth()|, |strwidth()| も参照。 + +strpart({src}, {start}[, {len}]) *strpart()* + 結果は文字列で、{src}の{start}番目の文字から始まる、長さ{len} + の部分文字列。 + バイト数ではなく文字数で数えるには |strcharpart()| を用いる。 + 存在しない文字を含むように範囲を指定しても、エラーにはならな + い。単に文字が省略されるだけである。 + {len}を省略すると、{start}から{src}の末尾までの部分文字列を返 + す。 > + strpart("abcdefg", 3, 2) == "de" + strpart("abcdefg", -2, 4) == "ab" + strpart("abcdefg", 5, 4) == "fg" + strpart("abcdefg", 3) == "defg" +< Note: 文字列の最初の文字を指定するためには、{start}は0でなけれ + ばならない。カーソルのある位置から3文字を取得する例: > + strpart(getline("."), col(".") - 1, 3) +< +strridx({haystack}, {needle} [, {start}]) *strridx()* + 結果は数値で、{haystack}の中で文字列{needle}が最後に現れる位置 + のバイトインデックスとなる。 + {start}を指定すると、そのインデックス以降でのマッチは無視され + る。前のマッチより前にあるものを見つけるには次のようにする: > + :let lastcomma = strridx(line, ",") + :let comma2 = strridx(line, ",", lastcomma - 1) +< 検索は大文字・小文字を区別する。 + 検索パターンについては|match()|を使う。 + {haystack}の中に{needle}がないときは-1を返す。 + {needle}が空文字列のときは{haystack}の長さを返す。 + |stridx()|も参照。例: > + :echo strridx("an angry armadillo", "an") 3 +< *strrchr()* + {needle}が1文字の場合はCの関数strrchr()と同じように動作する。 + + *strtrans()* +strtrans({expr}) + 結果は文字列で、{expr}内の表示不可能な文字を|'isprint'|で指定 + される、表示可能な文字に変換したもの。ウィンドウに表示すること + ができるようになる。例: > + echo strtrans(@a) +< これはレジスタの中の改行を、改行として表示する代わりに "^@" と + 表示する。 + +strwidth({expr}) *strwidth()* + 結果は数値で、文字列 {expr} のスクリーン上での表示セル幅を返 + す。タブ文字の幅は 1 として数えられる (タブ文字の幅も考慮した + い場合は|strdisplaywidth()| を使うこと)。 + {expr} に幅が曖昧 (Ambiguous) な東アジアの文字が含まれていると + きは、文字幅は 'ambiwidth' の設定に依存する。 + |strlen()|, |strdisplaywidth()|, |strchars()| も参照。 + +submatch({nr}[, {list}]) *submatch()* *E935* + |:substitute| や substitute() 関数の中の式でのみ使われる。 + マッチしたテキストの{nr} 番目の部分マッチを返す。{nr}が0のとき + はマッチしたテキスト全体を返す。 + Note: 文字列中の NL 文字は複数行マッチにおける改行文字か、NUL + 文字のどちらかである。 + |sub-replace-expression| も参照。 + + {list} に非ゼロの値が指定されたときは submatch() は文字列のリ + ストを返す。|getline()| に 2 つの引数を指定したときの戻り値と + 同じである。テキスト中の NL 文字は NUL 文字を表す。 + |:substitute| で使われたときのみ複数要素のリストを返す。 + |substitute()| では、実際の改行はそこにはないので、リストは常 + に 0 または 1 つの要素である。 + + substitute() が再帰的に使用された場合、現在の(最も深い)サブ + マッチのみが取得できる。 + + 例: > + :s/\d\+/\=submatch(0) + 1/ +< この例は、行の中で最初の数値を検索し、それに1を加える。改行は + 改行文字として含まれる。 + + *substitute()* +substitute({expr}, {pat}, {sub}, {flags}) + 結果は文字列で、{expr}内で最初に{pat}にマッチした部分を{sub}に + 置換えたコピーになる。 + {flags} が "g" なら、{expr} 内の {pat} にマッチした部分をすべ + て置換する。そうしたくない場合は {flags} は "" にすべきである。 + + これはコマンド ":substitute" (一切のフラグ無し) のように働く。 + しかしマッチングは常にオプション 'magic' が設定され、オプショ + ン 'cpoptions' は空にして実行される(スクリプトをポータブルにす + るため)。'ignorecase' は適用される。'ignorecase' の設定に関わ + らず大文字小文字を区別するかしないか固定するには |/\c| か + |/\C| を使う。'smartcase' は適用されない。{pat}がどう扱われる + かについては|string-match|を参照。 + + また、{sub}内の "~" は前回の{sub}に置換されない。 + {sub}内の幾つかのコードには|sub-replace-special|の特殊な意味が + あることに注意。例えば、何かの文字列をリテラルの "\n" に置換え + るためには、"\\\\n" か '\\n' を使う必要がある。 + + {pat}が{expr}の何処にもマッチしなければ、{expr}が何の変更も受 + けずに返される。 + + 例: > + :let &path = substitute(&path, ",\\=[^,]*$", "", "") +< これはオプション 'path' の最後のコンポーネントを削除する。 > + :echo substitute("testing", ".*", "\\U\\0", "") +< 結果は "TESTING" となる。 + + {sub} が "\=" で開始している場合は、その後ろの文字列は式として + 解釈される。|sub-replace-expression| 参照。例: > + :echo substitute(s, '%\(\x\x\)', + \ '\=nr2char("0x" . submatch(1))', 'g') + +< {sub} が関数リファレンスの場合、1個のオプショナル引数と共にそ + の関数が呼び出される。例: > + :echo substitute(s, '%\(\x\x\)', SubNr, 'g') +< オプショナル引数はマッチ文字列全体と9個のサブマッチが含まれる + 以下の |submatch()| が返す様なリストである。例: > + :echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g') + +synID({lnum}, {col}, {trans}) *synID()* + 結果は数値で、現在のウィンドウ内での位置{lnum}と{col}の位置の + 構文ID。 + 構文IDは|synIDattr()|と|synIDtrans()|に渡すことで、テキストに + ついての構文情報を取得するのに使用できる。 + + 最左のカラムを指定するには{col}に1を、最初の行を指定するには + {line}に1を指定する。'synmaxcol' が適用され、長すぎる行では0が + 返ってくる。 + Note 挿入モードでカーソル位置を最後の文字より後ろにした場合、 + synID()は0を返す。 + + {trans}が|TRUE|ならば、透過属性のアイテムは省略され、実際に表 + 示されているアイテムが評価対象になる。これは実際に有効になって + いるカラーを知りたい時に役に立つ。{trans}が|FALSE|ならば、透過 + 属性のアイテムが返される。これはどの構文アイテムが有効になって + いるかを知りたい時に役に立つ(例:カッコの中とか)。 + 警告: この関数は非常に遅い。ファイルを順方向に走査する時にだけ + ベストなスピードが得られる。 + + 例(カーソルの下の構文アイテムの名前を表示する): > + :echo synIDattr(synID(line("."), col("."), 1), "name") +< + + *synIDattr()* +synIDattr({synID}, {what} [, {mode}]) + 結果は文字列で、{synID}の属性{what}の内容を示す。これは構文 + アイテムの情報を取得するのに使用できる。 + {mode}には取得したいモードの属性に応じて、"gui" か "cterm" か + "term" が指定できる。{mode}が省略されるか、無効な値が指定され + た場合、現在有効になっているハイライトモードが使用される (GUI、 + cterm、termのどれか)。 + ハイライトグループにリンクされた属性を取得するにはsynIDtrans() + を使用する。 + {what} 結果 + "name" 構文アイテムの名前 + "fg" 前景色(GUI:カラー名、cterm:文字列としてのカ + ラー番号、term空文字列) + "bg" 背景色("fg" 同様) + "font" フォント名 (GUI でのみ利用可) + |highlight-font| + "sp" 特殊な色 ("fg" 同様) |highlight-guisp| + "fg#" "fg" 同様だが、"#RRGGBB" のフォーマットで + "bg#" "bg" 同様だが、"#RRGGBB" のフォーマットで + "sp#" "sp" 同様だが、"#RRGGBB" のフォーマットで + "bold" 太字なら "1" + "italic" 斜体なら "1" + "reverse" 反転なら "1" + "inverse" 反転(原文inverse)なら "1" (reverseと等価) + "standout" 強調 (standout) なら "1" + "underline" 下線付きなら "1" + "undercurl" 波線付きなら "1" + + 例(カーソルの下の構文アイテムのカラーを表示する): > + :echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg") +< + *synIDtrans()* +synIDtrans({synID}) + 結果は数値で、{synID}を構文IDに変換したもの。キャラク + タをハイライト表示している構文グループのIDである。 + ":highlight link" によって与えられるハイライトのリンクはこれに + 従っている。 + +synconcealed({lnum}, {col}) *synconcealed()* + リストを返す。リストの 1 番目のアイテムは、{lnum} と {col} が + 指す位置の文字が Conceal 可能リージョン の中にあるなら 1、そう + でないなら 0。リストの 2 番目のアイテムは文字列で、最初のアイ + テムが 1 なら、代わりに表示される Conceal テキスト が入る (実 + 行時の 'conceallevel' の設定に依存)。リストの 3 番目のアイテム + は、どのシンタックスリージョンにマッチしたかを示すユニーク番 + 号。これは同じ置換文字を持つ二つのリージョンが連続していた場合 + にその区切りを識別できるようにするため。 + 使用例は $VIMRUNTIME/syntax/2html.vim を参照。 + + +synstack({lnum}, {col}) *synstack()* + カレントウィンドウの {lnum}, {col} の位置の構文アイテムのスタッ + クを |List| にして返す。このリストの要素は |synID()|が返すのと + 同じ種類の ID である。 + リストの最初の要素が一番外側の領域で、続く要素がその中に内包さ + れている。アイテム全体がハイライトされている、または最後の要素 + が transparent なアイテムである場合を除き、最後の要素が + |synID()| が返すものである。 + この関数は構文ファイルをデバッグするのに役に立つ。 + 例(カーソル下の構文スタックを表示する): > + for id in synstack(line("."), col(".")) + echo synIDattr(id, "name") + endfor +< {lnum} と {col} が不正な場所を指しているときは戻り値なし。行の + 最後の文字の一つ後ろと空行の一番目の列は有効な位置である。 + +system({expr} [, {input}]) *system()* *E677* + シェルコマンド {expr} の実行結果を文字列として得る。リストとし + て受け取るには |systemlist()| を参照。 + + {input} に文字列が指定された場合、その文字列はファイルに書き出 + され、コマンドの標準入力として渡される。この文字列はそのまま + (as-is) 書き出されるので、正しい改行文字を使うよう自分自身で気 + をつけなければならない。 + {input} にリスト (|List|) が指定された場合は、|writefile()| の + {binary} に "b" を指定したのと同様にファイルに書き出される (つ + まり、リストの各要素は改行文字で連結され、要素内の改行文字は + NUL 文字に変換される)。 + {input} が指定され、それが数値で既存のバッファとして有効な id + であるならば、そのバッファの内容が 1 行ずつファイルに書き出さ + れる。それぞれの行は NL で終端され、テキスト中の NL は NUL 文 + 字に置き換えられる。 + + パイプは使用されず、'shelltemp' オプションは使用されない。 + + |:silent| が前置されたときは、端末は cooked モードには設定され + ない。これはユーザー入力を必要としないコマンドを使用することを + 意味する。これは画面に不要な文字が表示されるのを防ぐ (|CTRL-L| + でそれをクリアする必要がなくなる)。 > + :silent let f = system('ls *.vim') +< + Note: コマンドの引数をエスケープするには、 |shellescape()|、 + |expand()| の |::S|、または |fnamemodify()| を使用する。{expr} + 内に改行文字があるとコマンドは失敗するだろう。'shellquote' や + 'shellxquote' 内にある文字も問題を起こすかもしれない。 + 対話的なコマンドを使用することはできない。 + + 戻り値は文字列。例: > + :let files = system("ls " . shellescape(expand('%:h'))) + :let files = system('ls ' . expand('%:h:S')) + +< システムに依存しないような戻り値にするために、シェルの出力を + フィルタリングし、マッキントッシュにおいてはに変換 + し、DOS系のシステムにおいてはに変換している。 + 文字列が NUL 文字で切れるのを防ぐため、すべての NUL 文字は SOH + (0x01) に置換される。 + + 実行されるコマンドはいくつかのオプションを適用して構成される: + 'shell' 'shellcmdflag' 'shellxquote' {expr} 'shellredir' {tmp} 'shellxquote' + ({tmp}は自動的に生成されるファイル名) + UnixとOS/2ではコマンドの連結ができるように{expr}の両側に波括弧 + が置かれる。 + + コマンドは「cooked」モードで実行される。そのためCTRL-Cでコマン + ドを中断できる(少なくともUnixでは)。 + + エラーコードは|v:shell_error|に格納される。 + この関数は|restricted-mode|では失敗する。 + + Note 上記のオプションに不正な値が入っていると、この関数の呼び + 出しが失敗する可能性がある。セキュリティエージェントアプリケー + ションを使っていると失敗することがあるとも報告されている。 + ":!cmd" とは違い、ファイルが変更されているかのチェックは行わな + い。 + 明示的にチェックさせるには|:checktime|を使う。 + +systemlist({expr} [, {input}]) *systemlist()* + |system()| と同じだが行のリスト (|List|) を返す。行は NL 文字 + で区切られ、NUL 文字は NL 文字に変換される。出力は + |readfile()| の {binary} 引数に "b" を指定したのと同様である。 + MS-Windows では末尾の CR 文字がつくかもしれないことに注意。 + + エラー時には空文字列が返る。 + + +tabpagebuflist([{arg}]) *tabpagebuflist()* + カレントタブページ内の各ウィンドウに表示されているバッファの番 + 号を要素とするリスト|List|を返す。{arg}は対象とするタブページ + の番号を指定する。省略したときはカレントタブページを対象とする。 + {arg}が無効なときは数値0を返す。 + 全タブページ中の全バッファのリストを得るには次のようにする: > + let buflist = [] + for i in range(tabpagenr('$')) + call extend(buflist, tabpagebuflist(i + 1)) + endfor +< 1つのバッファが複数のウィンドウに表示されている場合があること + に注意。 + + +tabpagenr([{arg}]) *tabpagenr()* + 結果は数値で、カレントタブページの番号。最初のタブページの番号 + は1となる。 + 省略可能な引数{arg}に指定できる値は "$" のみであり、最後のタブ + ページの番号(つまりタブページの個数)を返す。 + この番号はコマンド|:tab|で指定できるものと同じである。 + + +tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()* + |winnr()|と同様だが、タブページ{tabarg}を対象とする。 + {tabarg}は対象とするタブページの番号を指定する。 + {arg}は|winnr()|の場合と同じように扱われる。すなわち: + - 省略するとカレントウィンドウの番号を返す。これは、このタブ + ページに入るとき使われるウィンドウである。 + - "$" とするとウィンドウの個数を返す。 + - "#" とすると前のウィンドウ番号を返す。 + 役に立つ例: > + tabpagewinnr(1) " タブページ1のカレントウィンドウ + tabpagewinnr(4, '$') " タブページ4内のウィンドウの個数 +< {tabarg}が無効なときは0を返す。 + + *tagfiles()* +tagfiles() カレントバッファにおいて、タグを検索するときに使うファイルの名 + 前からなるリスト|List|を返す。オプション 'tags' を展開したもので + ある。 + + +taglist({expr}) *taglist()* + 正規表現{expr}にマッチするタグのリストを返す。そのリストの各要 + 素は辞書であり、少なくとも次の要素を持つ: + name タグの名前。 + filename タグの定義があるファイルの名前。カレン + トディレクトリからの相対パス、またはフ + ルパスである。 + cmd そのファイルの中でタグの位置を特定する + ために使うexコマンド。 + kind タグの種類。種類は言語に依存する。この + 要素は、Exuberant ctagsかhdrtagによっ + て生成されたタグファイルを使っていると + きのみ使用できる。 + static ファイル固有のタグ。より詳しくは + |static-tag|を参照。 + タグファイルの内容によってはこれ以上の要素が存在することもある。 + 例: アクセス、実装、継承、シグネチャ。これらのフィールドについ + ての情報はctagsのドキュメントを参照。Cのソースにおいては、 + フィールド "struct"、"class"、"enum" が現れることがある。これ + らは、タグを含んでいるものの名前を示す。 + + exコマンド "cmd" は検索パターンか、行番号か、行番号とバイト番 + 号のいずれかである。 + + マッチするタグがない場合は空リストを返す。 + + 完全一致するタグを取得するには、{expr}にアンカー '^' と '$' を + つけること。これは関数の動作を速くすることにもなる。タグ検索の + 正規表現についてより詳しいことは |tag-regexp|を参照。 + + Vimが使用するタグファイルについては |'tags'| を参照。様々な + ctagsによって生成されるタグファイルのフォーマットについては + |tags-file-format|を参照。 + +tan({expr}) *tan()* + {expr} の正接 (タンジェント) をラジアンで返す。 + 値は [-inf, inf] の範囲の浮動小数点数 (|Float|)。 + {expr} は浮動小数点数 (|Float|) か数値 (|Number|) でなければな + らない。 + 例: > + :echo tan(10) +< 0.648361 > + :echo tan(-4.01) +< -1.181502 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + +tanh({expr}) *tanh()* + {expr} の双曲線正接 (ハイパボリックタンジェント) を返す。 + 値は [-1, 1] の範囲の浮動小数点数 (|Float|)。 + {expr} は浮動小数点数 (|Float|) か数値 (|Number|) でなければな + らない。 + 例: > + :echo tanh(0.5) +< 0.462117 > + :echo tanh(-1) +< -0.761594 + {|+float| 機能を有効にしてコンパイルしたときのみ有効} + + + *tempname()* *temp-file-name* +tempname() + 結果は文字列で、存在しないファイルのファイル名を示す。これはテ + ンポラリファイルの名前として使用可能である。少なくとも連続26回 + の呼出しまでは違う名前を生成することが保証される。例: > + :let tmpfile = tempname() + :exe "redir > " . tmpfile +< Unix では、ファイルはプライベートなディレクトリに置かれる。 + |tempfile| + MS-Windowsでは、'shellslash' がオンのときか 'shellcmdflag' が + '-' で始まるときはスラッシュが使われる。 + + +test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()* + この関数はテストのために使われる: {id} のメモリ割り当てが行わ + れた際に {countdown} はデクリメントされ、それが0になれば + {repeat} 回のメモリの割り当ての失敗を発生させる。{repeat} が1 + 未満の場合は、失敗を1回のみ発生させる。 + +test_autochdir() *test_autochdir()* + Vimの起動が完了する前に 'autochdir' の効果を有効にするためのフ + ラグをセットする。 + +test_garbagecollect_now() *test_garbagecollect_now()* + garbagecollect() とほぼ同じであるが、この関数はガーベッジコレ + クトを直ちに実行する。この関数を実行する場合は、構造体が内部に + 存在しないようにするために直接呼び出す必要がある。また、この関 + 数を呼び出す前に |v:testing| を設定する必要がある。 + +test_ignore_error({expr}) *test_ignore_error()* + {expr} を含むすべてのエラーを無視する。代わりに通常メッセージ + が表示される。 + これは、テストにおいて、try/catch を用いてエラーを捕捉できない + (以降のコードをスキップするので)場合のみに使うことを意図してい + る。 + {expr} は文字通り用いられ、パターンとしてではない。 + 現在、これを元に戻す方法はない。 + +test_null_channel() *test_null_channel()* + null の Channel を返す。これはテストのみに使われる。 + {|+channel| 機能つきでコンパイルされたときのみ有効} + +test_null_dict() *test_null_dict()* + null の Dict を返す。これはテストのみに使われる。 + +test_null_job() *test_null_job()* + null の Job を返す。これはテストのみに使われる。 + {|+job| 機能つきでコンパイルされたときのみ有効} + +test_null_list() *test_null_list()* + null の List を返す。これはテストのみに使われる。 + +test_null_partial() *test_null_partial()* + null の Partial を返す。これはテストのみに使われる。 + +test_null_string() *test_null_string()* + null の String を返す。これはテストのみに使われる。 + +test_override({name}, {val}) *test_override()* + テストを実行できるようにするため、Vimの内部処理の特定の部分を + 置き換える。Vimをテストするためだけに使用すること! + 置き換えは、{val} が非 0 のときに有効化され、{val} が 0 のとき + に取り除かれる。 + 現在、name に使える値は: + + name {val} が非 0 のときの効果 ~ + redraw redrawing() 関数を無効化する + char_avail char_avail() 関数を無効化する + ALL すべての置き換えをクリアする ({val} は使われない) + +test_settime({expr}) *test_settime()* + Vim が内部的に用いる時間を設定する。現在は history のタイムス + タンプ、viminfo のタイムスタンプ、undo に使用されている。 + 1 を渡せば、Vim は、警告やエラーメッセージの後、スリープしなく + なる。 + {expr} は、数値として評価されなければならない。0 を渡せば、Vim + の内部時間は通常動作に戻る。 + + *timer_info()* +timer_info([{id}]) + タイマーに関する情報のリストを返す。 + {id} が指定された場合はそのタイマーに関する情報だけが返され + る。タイマー {id} が存在しない場合は空のリストが返される。 + {id} が省略された場合は全てのタイマーに関する情報が返される。 + + 各タイマーの情報は以下の項目を含んだ辞書で格納される: + "id" タイマーのID + "time" タイマーが開始してからの時間 + "remaining" タイマーが発火するまでの時間 + "repeat" 何回タイマーを発火させるかの回数; + -1 は無限を意味する + "callback" コールバック + "paused" タイマーが一時停止中なら 1、それ以外は 0 + + {|+timers| 機能を有効にしてコンパイルしたときのみ有効} + +timer_pause({timer}, {paused}) *timer_pause()* + タイマーを一時停止もしくは再開する。一時停止したタイマーは時間 + が経過してもコールバックを呼び出さない。タイマーの再開は十分 + に時間が経過しているなら、すぐさまコールバックが呼び出されるか + もしれない。 + + タイマーの停止は少しの間、コールバックが呼び出されるのを避ける + のに便利である。 + + {paused} が 0 以外の数値、もしくは空でない文字列で評価される + 場合にタイマーが停止し、それ以外は再開する。 + |non-zero-arg| を参照。 + + {|+timers| 機能を有効にしてコンパイルしたときのみ有効} + + *timer_start()* *timer* *timers* +timer_start({time}, {callback} [, {options}]) + タイマーを作成しその ID を返す。 + + {time} はミリ秒での待機時間。これはコールバックが呼び出される + までの最短の時間である。システムがビジーもしくは Vim が入力待 + ちでない場合、これは長くなる。 + + {callback} は呼び出す関数。関数の名前もしくは|Funcref|であって + も良い。引数にはタイマーIDの引数が1つだけ渡されて呼び出され + る。コールバックは Vim が入力待ちの場合だけ呼び出される。 + + {options} は辞書。以下がサポートされている: + "repeat" コールバックを呼び出す繰り返し回数。-1 は無限 + を意味する。指定されない場合はコールバックは一 + 度だけ呼び出される。 + + 例: > + func MyHandler(timer) + echo 'Handler called' + endfunc + let timer = timer_start(500, 'MyHandler', + \ {'repeat': 3}) +< これは MyHandler() を 500ms 間隔で3回呼び出す。 + + {|+timers| 機能を有効にしてコンパイルしたときのみ有効} + +timer_stop({timer}) *timer_stop()* + タイマーを停止する。タイマーのコールバックは以降呼び出されな + い。{timer} は timer_start() が返した ID である。よって数値で + なければならない。{timer} が存在しなかった場合でもエラーは発生 + しない。 + + {|+timers| 機能を有効にしてコンパイルしたときのみ有効} + +timer_stopall() *timer_stopall()* + 全てのタイマーを停止する。タイマーのコールバックは以降呼び出さ + れない。タイマーが不作法に振る舞う場合に便利である。タイマーが + 存在しなかった場合でもエラーは発生しない。 + + {|+timers| 機能を有効にしてコンパイルしたときのみ有効} + +tolower({expr}) *tolower()* + 引数の文字列の大文字を小文字に変換してできた文字列を返す(文字 + 列に|gu|を適用するのとちょうど同じ)。 + +toupper({expr}) *toupper()* + 引数の文字列の小文字を大文字に変換してできた文字列を返す(文字 + 列に|gU|を適用するのとちょうど同じ)。 + +tr({src}, {fromstr}, {tostr}) *tr()* + 文字列{src}の中で、{fromstr}に含まれる全ての文字を{tostr}の対 + 応する文字で置き換えた文字列を返す。つまり、{fromstr}の最初の + 文字が{tostr}の最初の文字に置き換えられる。2文字目以降も同様。 + Unixのコマンド "tr" とちょうど同じである。 + マルチバイト文字も正しく扱える。 + + 例: > + echo tr("hello there", "ht", "HT") +< 戻り値は "Hello THere" となる。 > + echo tr("", "<>", "{}") +< 戻り値は "{blob}" となる。 + +trunc({expr}) *trunc()* + {expr} をゼロ方向に切りつめた整数を |Float| で返す。 + {expr} は |Float| または |Number| に評価されなければならない。 + 例: > + echo trunc(1.456) +< 1.0 > + echo trunc(-5.456) +< -5.0 > + echo trunc(4.0) +< 4.0 + {|+float| 機能つきでコンパイルされたときのみ有効} + + *type()* +type({expr}) {expr}の型を示す数値を返す。 + マジックナンバーを使わずに、v:t_ 変数を使う方が良い。それぞれ + の値は以下の通り: + 数値: 0 |v:t_number| + 文字列: 1 |v:t_string| + Funcref: 2 |v:t_func| + リスト: 3 |v:t_list| + 辞書: 4 |v:t_dict| + 浮動小数点数: 5 |v:t_float| + 真偽値: 6 |v:t_bool| (v:false と v:true) + 特殊値: 7 |v:t_none| (v:null と v:none) + ジョブ: 8 |v:t_job| + チャンネル: 9 |v:t_channel| + 後方互換性のためには、次のような使い方ができる: > + :if type(myvar) == type(0) + :if type(myvar) == type("") + :if type(myvar) == type(function("tr")) + :if type(myvar) == type([]) + :if type(myvar) == type({}) + :if type(myvar) == type(0.0) + :if type(myvar) == type(v:false) + :if type(myvar) == type(v:none) +< v:t_ 変数が存在するかを判定するにはこれを使う: > + :if exists('v:t_number') + +undofile({name}) *undofile()* + {name} という名前のファイルの保存時に使用されるアンドゥファイ + ルの名前を返す。'undodir' オプションが使用され、存在するディレ + クトリが検索される。アンドゥファイルが存在するかどうかはチェッ + クされない。 + {name} は常に絶対パスに展開される (内部では絶対パスを使ってい + るため)。 + {name} が空の場合 undofile() は空文字列を返す。ファイル名のな + いバッファはアンドゥファイルを書かないからである。 + |:wundo| や |:rundo| と組み合わせて使うと便利だろう。 + +persistent_undo オプションを無効にしてコンパイルされた場合は + この関数は常に空文字列を返す。 + +undotree() *undotree()* + アンドゥツリーの現在の状態を辞書で返す。辞書の内容は次のとお + り: + "seq_last" 使用されたアンドゥシーケンス番号の最大値。 + "seq_cur" アンドゥツリーの現在のシーケンス番号。いくつか + の変更がアンドゥされた状態だと "seq_last" と違 + う値になる。 + "time_cur" 最後に |:earlier| 系のコマンドが使われた時間。 + 読みやすい形式に変換するには |strftime()| を使 + う。 + "save_last" 最後にファイルが保存された番号。保存がまだなら + ゼロになる。 + "save_cur" アンドゥツリー内の現在位置の番号。 + "synced" 最後のアンドゥブロックが同期されていれば非ゼ + ロ。これはユーザーからの入力を待機しているとき + に起こる。|undo-blocks| 参照。 + "entries" アンドゥブロックの情報を表す辞書のリスト。 + + "entries" リストの 1 番目にはもっとも古いアンドゥアイテムが + 入っている。リストの各アイテムは次のような情報を持った辞書であ + る: + "seq" アンドゥシーケンス番号。|:undolist| で表示され + るものと同じ。 + "time" 変更が起こった時間。読みやすい形式に変換するに + は |strftime()| を使う。 + "newhead" この項目は最後に追加されたアイテムにのみある。 + これは最後の変更を示し、次の変更を追加する場所 + を示す。 + "curhead" この項目は最後にアンドゥされたアイテムにのみあ + る。これはアンドゥツリーの現在位置を示し、次に + リドゥコマンドによって使われるブロックを示す。 + 最後に変更を加えてからアンドゥを一度も実行して + いないときはこの項目はどこにも現れない。 + "save" この項目はファイルが保存される前の最後のブロッ + クにのみある。番号は保存回数を示す。最初の保存 + は 1 で、最後のものは "save_last" と同じ。 + "alt" 切り替えエントリ。同じアンドゥブロックのリスト + が入れ子にされている。それぞれのアイテムはさら + に "alt" アイテムを持っていることがある。 + +uniq({list} [, {func} [, {dict}]]) *uniq()* *E882* + {list} 内の隣接する同じ値の要素の 2 個目以降をその場で + (in-place) 削除する。{list} を返す。リストを変更したくない場合 + は事前にコピーする: > + :let newlist = uniq(copy(mylist)) +< デフォルトの比較関数は各要素の文字列表現を使う。{func} と + {dict} については |sort()| 参照。 + +values({dict}) *values()* + {dict}の全ての値からなるリスト|List|を返す。このリストの順序は + 不定である。 + +virtcol({expr}) *virtcol()* + 結果は数値で、{expr}で与えられるファイルの位置の、スクリーン上 + での桁の位置を示す。返る値は、指定された位置にある文字の末尾が、 + スクリーン座標(の桁)でどこに存在するかである。(タブ文字) + が指定した位置にあった場合には、戻り値はそのタブの最後のカラム + (桁)位置になる。具体的に、'ts' が8に設定された状態で第1桁に + があった場合、戻り値は8になる。|conceal| は無視される。 + バイト位置については |col()| を使う。 + {expr}の解釈の仕方については|col()|を参照。 + 'virtualedit' がオンのときは[lnum, col, off]というリストを指定 + することもできる。"off" は文字の開始位置からのスクリーン座標で + のオフセットである。例えば、の中の位置や、行の最後の文字 + 以降の位置を示すために使う。"off" が省略された場合はゼロが使わ + れる。 + 現在のモードに対して仮想編集がオンのときは、行末を越えた位置が + 返ってくることもある。|'virtualedit'| + 可能な位置指定: + . カーソルの位置 + $ カーソル行の末尾(カーソル行に表示されている文字数 + +1となる) + 'x マークxの位置(マークが設定されていない場合、0が返 + る) + v ビジュアルモードでは: ビジュアル選択領域の開始行 + (カーソルがその端)。ビジュアルモード以外ではカーソ + ル位置を返す。すぐに更新される点が |'<| と違う。 + 現在のファイルに対して設定されているマークだけが使用可能なこと + に注意。 + 例: > + virtcol(".") "foo^Lbar" の "^L" の位置にカーソル、戻り値5 + virtcol("$") "foo^Lbar" に対し、戻り値9 + virtcol("'t") " there" の 'h' に 't を設定、戻り値6 +< 最初の桁は1となる。エラーの場合は0が返る。 + より高度な例(全ての行の長さの最大値を返す): > + echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) + +visualmode([expr]) *visualmode()* + 結果は文字列で、カレントバッファ内で最後に使われたビジュアル + モードを教えてくれる。初期状態では単に空文字列を返すだけだが、 + 一度でもビジュアルモードが使われた場合、その種類によって "v" + か "V" か "" (CTRL-Vの文字が1文字で) 返される。これは + それぞれ文字選択、行選択、矩形選択を意味している。 + 例: > + exe "normal " . visualmode() +< これは最後に使われたのと同じビジュアルモードに入る。また、スク + リプトの動作を、最後に使われたビジュアルモードに応じて変更した + い場合にも便利だろう。 + ビジュアルモードにいるときは |mode()| を使ってビジュアルモード + の種類を取得できる。(|:vmap| などの中などで) + {expr}に0以外の数値か空文字列以外の文字列を指定した場合は、ビ + ジュアルモードがクリアされ、以前の値を返す。|non-zero-arg| を + 参照。 + +wildmenumode() *wildmenumode()* + wildmenuが有効な場合は|TRUE|を返し、そうでなければ|FALSE|を返 + す。'wildmenu' と 'wildmode' を参照。 + マッピングの中で 'wildcharm' オプションを有効に扱うために使用 + できる。(|mapmode-c|マッピングの場合のみ意味をなす。) + + 例えば、wildmodeでと同じように動作するようにする + には: > + :cnoremap wildmenumode() ? "\\" : "\" +< + (Note 'wildcharm' オプションが適切に設定されている必要がある。) + + +win_findbuf({bufnr}) *win_findbuf()* + バッファ {bufnr} が含まれているウィンドウについて |window-ID| + のリストを返す。存在しない場合は空のリストになる。 + +win_getid([{win} [, {tab}]]) *win_getid()* + 特定のウィンドウに関する |window-ID|を得る。 + {win} が未指定の時は現在のウィンドウとなる。 + この {win} はウィンドウ番号である。トップウィンドウは番号 1 を + 持つ。 + {tab} が未指定の場合現在のタブが使用され、{tab} が番号で指定さ + れた場合はそのタブとなる。最初のタブ番号は 1 である。 + ウィンドウが見付からない場合には 0 を返す。 + +win_gotoid({expr}) *win_gotoid()* + {expr} の ID で示されるウィンドウへ移動する。これは現在のタブ + ページも移動する。 + 成功した場合は 1 を、ウィンドウが見付からない場合は 0 を返す。 + +win_id2tabwin({expr}) *win_id2tabwin()* + {expr} の ID で示されるタブ番号とウィンドウ番号のリストを返す: + [tabnr, winnr] + ウィンドウが見付からなかった場合は [0, 0] を返す。 + +win_id2win({expr}) *win_id2win()* + {expr} の ID で示されるウィンドウのウィンドウ番号を返す。 + 現在のタブページ内でそのウィンドウが見付からなかった場合は 0 + を返す。 + + *winbufnr()* +winbufnr({nr}) 結果は数値で、{nr}番目のウィンドウに関連付けられているバッファ + の番号。{nr} にはウィンドウ番号または|window-ID|が使える。 + {nr}が0の場合、現在のウィンドウに関連付けられているバッファの + 番号が返る。{nr}で存在しないウィンドウを指定した場合には-1が返 + る。 + 例: > + :echo "The file in the current window is " . bufname(winbufnr(0)) +< + *wincol()* +wincol() 結果は数値で、ウィンドウの中でカーソルがある位置の仮想桁番号を + 表す。これはウィンドウの左側から数えたスクリーン上の桁である。 + 一番左の桁は1となる。 + +winheight({nr}) *winheight()* + 結果は数値で、{nr}で示されるウィンドウの高さ(行数)を示す。 + {nr} にはウィンドウ番号または|window-ID|が使える。 + {nr}が0ならば、現在のウィンドウの高さが返る。{nr}というウィン + ドウが存在しない場合、-1が返る。存在しているウィンドウは、絶対 + に0かそれ以上の高さを持っている。 + 例: > + :echo "The current window has " . winheight(0) . " lines." +< + + *winline()* +winline() 結果は数値で、ウィンドウの最上行から数えた行番号を返す。ウィン + ドウでの最上行が1となる。 + カーソルが移動するとファイルの表示が更新され、それによってスク + ロールが引き起こされることがある。 + + *winnr()* +winnr([{arg}]) 結果は現在のウィンドウを示す数値。最上位のウィンドウは1であ + る。 + 省略可能な引数{arg}に "$" を設定すると、最後のウィンドウの番号 + が返る (つまりウィンドウの個数)。 > + let window_count = winnr('$') +< {arg}に "#" を設定すると、最後にアクセスしたウィンドウの番号を + 返す (|CTRL-W_p|で移動するウィンドウと同じ)。 + 以前のウィンドウがない場合、またはそれが他のタブページにある場 + 合は0を返す。 + この番号は|CTRL-W_w|と ":wincmd w" で使える。|:wincmd| + |tabpagewinnr()|と|win_getid()|も参照。 + + *winrestcmd()* +winrestcmd() 現在のウィンドウサイズを復元するための一連の|:resize|コマンド + を返す。これが返すコマンドは、ウィンドウを開閉せず、カレント + ウィンドウとカレントタブページが変更されていないときのみ正しく + 動作する。 + 例: > + :let cmd = winrestcmd() + :call MessWithWindowSizes() + :exe cmd +< + *winrestview()* +winrestview({dict}) + |winsaveview()|が返す辞書|Dictionary|を使ってカレントウィンド + ウの表示状態を復元する。 + Note: {dict} は |winsaveview()| の戻り値に含まれる値をすべて + 持っていなくても構わない。値がない場合はその設定は復元されな + い。次のようにできる: > + :call winrestview({'curswant': 4}) +< + これは curswant 値 (縦方向移動でカーソルの移動先として使われる + 列番号) を列番号 5 に設定する (はいそのとおり。5 です)。ほかの + 設定値は変更されない。これはカーソル位置を手動で設定したい場合 + に便利である。 + + この値を手動で変更した場合、結果は予測できない。 + ウィンドウサイズが変更されていると、結果は必ずしも元通りになら + ない。 + + *winsaveview()* +winsaveview() カレントウィンドウの表示状態を復元するための情報を持つ辞書 + |Dictionary|を返す。この表示状態を復元するには|winrestview()| + を使う。 + マッピング内でジャンプして、元の表示状態を戻したいときに使われ + る。 + 折り畳み情報は保存しない。オプション 'foldenable' によって一時 + 的に折り畳みをオフにし、移動中に折り畳みが開かれないようにする + こと。これは副作用があるかもしれない。 + 戻り値は以下のキーを持つ: + lnum カーソルの行番号 + col カーソルの桁番号 (Note: getpos() とは + 異なり最初の桁番号はゼロ) + coladd カーソル位置の桁オフセット。 + 'virtualedit' がオンのとき使われる。 + curswant 垂直移動するときの桁 + topline ウィンドウの最上行 + topfill 削除行。差分モードでのみ + leftcol 表示されている最初の桁 + skipcol スキップされている桁 + Note オプションの値は保存されない。 + + +winwidth({nr}) *winwidth()* + 結果は数値で、ウィンドウ{nr}の幅。 + {nr} にはウィンドウ番号または|window-ID|が使える。 + {nr}が0のときはカレントウィンドウの幅を返す。ウィンドウ{nr}が + 存在しないときは-1を返す。ウィンドウは必ず0以上の幅を持つ。 + 例: > + :echo "The current window has " . winwidth(0) . " columns." + :if winwidth(0) <= 50 + : exe "normal 50\|" + :endif +< 端末または画面サイズを取得するには、'columns' オプション参照。 + + +wordcount() *wordcount()* + この結果は現在のバッファのバイト/文字/単語統計情報の辞書である。 + これは|g_CTRL-G|が提供する情報と同じである。 + この値には下記が含まれる: + bytes バッファ内のバイト数 + chars バッファ内の文字数 + words バッファ内の単語数 + cursor_bytes カーソル位置より前のバイト数 + (ビジュアルモードでない) + cursor_chars カーソル位置より前の文字数 + (ビジュアルモードでない) + cursor_words カーソル位置より前の単語数 + (ビジュアルモードでない) + visual_bytes ビジュアル選択領域内のバイト数 + (ビジュアルモードのみ) + visual_chars ビジュアル選択領域内の文字数 + (ビジュアルモードのみ) + visual_words ビジュアル選択領域内の単語数 + (ビジュアルモードのみ) + + *writefile()* +writefile({list}, {fname} [, {flags}]) + |List| {list}をファイル{fname}に書き込む。リストの各要素は改行 + 文字(NL)で区切られる。各要素は文字列か数値でなければならない。 + {flags}が "b" を含むときはバイナリモードとなり、最後の要素の後 + にNLが追加されない。最後の要素が空であると、ファイルの最後の行 + がNLで終わるようになる。 + {flags}が "a" を含むときは追記モードとなり、ファイルに行が追記 + される。 > + :call writefile(["foo"], "event.log", "a") + :call writefile(["bar"], "event.log", "a") +> +< NL文字はNUL文字に置換される。 + CR文字を加えるには、{list}をwritefile()に渡す前に行わねばなら + ない。 + 既存のファイルは上書きされる(上書き可能ならば)。 + 書き込みが失敗したときは-1を返す。そうでなければ0を返す。ファ + イルを作成できないときや、書き込みが失敗したときはエラーメッ + セージが表示される。 + |readfile()|も参照。 + バイト単位でファイルをコピーするには次のようにする: > + :let fl = readfile("foo", "b") + :call writefile(fl, "foocopy", "b") + + +xor({expr}, {expr}) *xor()* + 二つの引数のビット排他的論理和。引数は数値に変換される。リス + ト、辞書、浮動小数点数を指定するとエラーになる。 + 例: > + :let bits = xor(bits, 0x80) +< + + *feature-list* +機能は大別して 4 つの系統に分けられる: +1. コンパイル時に|+feature-list|とした時にだけサポートされる機能。例: > + :if has("cindent") +2. ある状態の時にだけサポートされる機能。例: > + :if has("gui_running") +< *has-patch* +3. 適用済みパッチ。"patch123" はパッチ 123 が適用されていることを示す。Note: + この形式は Vim のバージョンをチェックしない。あなたは |v:version| を解析す + る必要がある。 + 例 (6.2.148 以降かどうかを確認する): > + :if v:version > 602 || v:version == 602 && has("patch148") +< Note: 148 が適用されていても、147 が抜けていることもありうるので注意。 + +4. 特定のバージョン以降であるか、またはバージョンが同じで特定のパッチが含まれ + ているかどうか。"patch-7.4.237" は、Vim のバージョンが 7.5 以降か、または + 7.4 でパッチ 237 を含んでいるかどうかを示す。 + Note: これはパッチ 7.4.237 以降でのみ機能する。それ以前では上述のように + v:version を確認する必要がある。例: > + :if has("patch-7.4.248") +< Note: 148 が適用されていても、147 が抜けていることもありうるので注意。 + +ヒント: Vim がファイル名(MS-Windows)でバックスラッシュをサポートしているかどうか +を調べるには `if exists('+shellslash')` を使用する。 + + +acl |ACL| をサポート +all_builtin_terms 全ての組込みターミナルを有効にしてコンパイル +amiga AMIGAバージョン +arabic アラビア語をサポート |Arabic| +arp ARPをサポート (Amiga) +autocmd オートコマンドをサポート |autocommand| +balloon_eval |balloon-eval| をサポート +balloon_multiline 複数行バルーンをサポート +beos BeOSバージョン +browse |:browse|をサポートし、browse()が動作する +browsefilter |browsefilter| をサポート +builtin_terms 幾つかの組込みターミナルが有効 +byte_offset 'statusline' において 'o' がサポートされる +cindent 'cindent' をサポート +clientserver リモート呼び出しをサポート |clientserver| +clipboard 'clipboard' をサポート +cmdline_compl |cmdline-completion| コマンドライン補完をサポート +cmdline_hist |cmdline-history| コマンドライン履歴をサポート +cmdline_info 'showcmd' と 'ruler' をサポート +comments |'comments'| をサポート +compatible Vi互換度を非常に高めてコンパイルされている +cryptv 暗号化をサポート |encryption| +cscope |cscope|をサポート +debug デバッグバージョンである +dialog_con コンソールダイアログのサポート +dialog_gui GUIダイアログのサポート +diff |vimdiff| と 'diff' のサポート +digraphs ダイグラフをサポート +directx DirectX と 'renderoptions' をサポート +dnd レジスタ "~ をサポート |quote_~| +ebcdic EBCDIC文字集合のマシン用 +emacs_tags Emacs式のタグファイルをサポート +eval 式評価をサポート。もちろん常に真。 +ex_extra 今は常に真 |+ex_extra| +extra_search |'incsearch'| と |'hlsearch'| をサポート +farsi |farsi|をサポート +file_in_path |gf|と||をサポート +filterpipe 'shelltemp' がオフのとき、シェルの読み込み・書き込み・ + フィルタコマンドにパイプを使う。 +find_in_path includeファイル内の検索をサポート |+find_in_path| +float 浮動小数点数 |Float| サポート +fname_case ファイル名の大文字小文字が区別される(Amiga,MS-DOS, + そしてWindowsでは区別されないので偽) +folding |folding| 折り畳みをサポート +footer GUIのフッターをサポート |gui-footer| +fork system()の代わりにfork()/exec()を用いている +gettext 翻訳メッセージをサポート |multi-lang| +gui GUIが有効である +gui_athena AthenaのGUIが有効である +gui_gnome Gnomeサポート(gui_gtkも定義される) +gui_gtk GTK+のGUIが有効である +gui_gtk2 GTK+ 2のGUIが有効である (gui_gtkも定義される) +gui_gtk3 GTK+ 3のGUIが有効である (gui_gtkも定義される) +gui_mac マッキントッシュのGUIが有効である +gui_motif MotifのGUIが有効である +gui_photon PhotonのGUIが有効である +gui_running VimがGUIモードで起動している、もしくは間もなくする +gui_win32 Win32のGUIが有効である +gui_win32s Win32sのGUIが有効である (Windows 3.1) +hangul_input ハングル入力サポート +iconv iconv()をサポート +insert_expand 挿入モード時にCTRL-Xの展開がサポートされる +jumplist |jumplist| をサポート +keymap 'keymap' をサポート +lambda |lambda| をサポート +langmap 'langmap' サポート +libcall |libcall()| をサポート +linebreak 'linebreak'、'breakat'、'showbreak'、'breakindent' を + サポート +lispindent lisp式のインデントをサポート +listcmds バッファリスト用のコマンド|:files|と引数リスト用のコマ + ンド|arglist|をサポート +localmap ローカルなマッピングと短縮入力をサポート|:map-local| +lua Lua インターフェイスをサポート |Lua| +mac すべてのマッキントッシュ版Vim +macunix darwinつきのOS X +osx darwinなしのOS X +menu |:menu|をサポート +mksession |:mksession|をサポート +modify_fname ファイル名変換子をサポート |filename-modifiers| +mouse マウスをサポート +mouse_dec DECのターミナルマウスをサポート +mouse_gpm gpmをサポート (Linuxのコンソールマウス) +mouse_netterm nettermのマウスをサポート +mouse_pterm qnx ptermのマウスをサポート +mouse_sysmouse sysmouse (*BSD コンソールマウス)をサポート +mouse_sgr sgrのマウスをサポート +mouse_urxvt urxvtのマウスをサポート +mouse_xterm xtermのマウスをサポート +mouseshape 'mouseshape' をサポート +multi_byte 'encoding' をサポート +multi_byte_encoding 'encoding' がマルチバイトエンコーディングになる +multi_byte_ime IMEによる入力をサポート +multi_lang 複数言語をサポート +mzscheme MzSchemeインターフェイスをサポート |mzscheme| +netbeans_enabled |netbeans|をサポートし、現在接続している +netbeans_intg |netbeans|をサポート +num64 64ビット数値をサポート |Number| +ole Win32にてOLEオートメーションをサポート +packages |packages|をサポート +path_extra 'path' と 'tags' の上方・下方検索をサポート +perl Perlインターフェイスをサポート +persistent_undo 永続アンドゥをサポート +postscript PostScriptファイルの印刷をサポート +printer |:hardcopy| をサポート +profile |:profile| をサポート +python Python 2.x インターフェイスをサポート |has-python| +python3 Python 3.x インターフェイスをサポート |has-python| +pythonx |python_x| インターフェイスをサポート |has-pythonx| +qnx QNXバージョン +quickfix |quickfix|をサポート +reltime |reltime()|をサポート +rightleft 'rightleft' をサポート +ruby Rubyインターフェイスをサポート +scrollbind 'scrollbind' をサポート +showcmd 'showcmd' をサポート +signs |:sign|をサポート +smartindent 'smartindent' をサポート +spell スペルチェックをサポート |spell| +startuptime |--startuptime| をサポート +statusline 'statusline', 'rulerformat' そして 'titlestring' と + 'iconstring' の特殊フォーマットをサポート +sun_workshop Sun |workshop|をサポート +syntax 構文ハイライトをサポート +syntax_items 現在のバッファに有効なシンタックスが設定されている +system fork()/exec()の代わりにsystem()が使用されている +tag_binary タグファイル内の二分探索 |tag-binary-search| +tag_old_static 旧式の静的tagsをサポート |tag-old-static| +tag_any_white タグファイル内の空白文字をサポート |tag-any-white| +tcl TCLインターフェイスをサポート +termguicolors 端末でのtrueカラーをサポート +terminfo termcapの代わりにterminfoをサポート +termresponse |t_RV|と|v:termresponse|をサポート +textobjects |text-objects|をサポート +tgetent tgetentをサポート。termcapかterminfoファイルが使用可能 +timers |timer_start()| をサポート +title ウィンドウタイトルをサポート |'title'| +toolbar |gui-toolbar|をサポート +ttyin 入力が端末 (tty) である +ttyout 出力が端末 (tty) である +unix UNIXバージョン +unnamedplus 'clipboard' に "unnamedplus" をサポート +user_commands ユーザー定義コマンドをサポート +vertsplit ウィンドウの垂直分割をサポート |:vsplit| +vim_starting Vimの初期化プロセス中は真となる。|startup| + *vim_starting* +viminfo viminfoをサポート +virtualedit オプション 'virtualedit' をサポート +visual ビジュアルモードをサポート +visualextra 拡張ビジュアルモードをサポート |blockwise-operators| +vms VMSバージョン +vreplace コマンド|gR|と|gr|をサポート +wildignore オプション 'wildignore' をサポート +wildmenu オプション 'wildmenu' を指定してコンパイル +win32 Win32バージョン(MS-Windows 95 以上の 32 or 64 ビット) +win32unix Win32バージョン。Unixファイルを使用 (Cygwin) +win64 Win64バージョン(MS-Windows 64 bit) +win95 Win32バージョン。MS-Windows 95/98/ME用。 +winaltkeys オプション 'winaltkeys' を指定してコンパイル +windows 複数ウィンドウをサポート +writebackup オプション 'writebackup' が起動時にonになる +xfontset X fontsetをサポート |xfontset| +xim XIMをサポート |xim| +xpm pixmap をサポート +xpm_w32 Win32 で pixmap をサポート(後方互換性のためのみ。 + 代わりに "xpm" を使用せよ。) +xsmp Xセッションマネージメントをサポート +xsmp_interact 対話的Xセッションマネージメントをサポート +xterm_clipboard xtermのクリップボードサポート +xterm_save xtermのスクリーンの保存復帰をサポート +x11 X11をサポート + + *string-match* +文字列内でのパターンマッチング + +|pattern|で説明されている正規表現パターンは通常、バッファ内の行に対してマッチ +を検索するために使われる。文字列内でマッチを見つけるために使うときも、ほとんど +は同じように動作する。違いは、文字列が1つの行であるかのように扱われる事である。 +文字列が文字 "\n" だけを含むとき、これは改行とはみなされない。この "\n" はパ +ターン内の "\n" や "." にマッチする。例: > + :let a = "aaaa\nxxxx" + :echo matchstr(a, "..\n..") + aa + xx + :echo matchstr(a, "a.x") + a + x + +"^" は文字列の最初の文字でだけマッチし、"$" は最後の文字でだけマッチすることに +注意。"\n" の前後にはマッチしない。 + +============================================================================== +5. 関数定義 *user-functions* + +ユーザーは自分で新しい関数を定義することができる。その関数は組込み関数とまった +く同じように呼び出せる。関数は一連のExコマンドを実行する。ノーマルモードコマン +ドはコマンド|:normal|によって実行できる。 + +関数名は組込み関数との混同を避ける為、大文字で始まらなければならない。他のスク +リプトで同じ関数名を使用してしまうことを避ける為に、露骨に短い名前は避けるべき +である。関数名を例えば "HTMLcolor()" のように、スクリプトの名前から始めるとい +うのは良い習慣である。 + +波括弧変数というものもある(|curly-braces-names|を参照)。また、オートロード +|autoload|機構を使うと、関数が呼ばれたときだけ定義することができる。 + + *local-function* +スクリプトローカルな関数の名前は "s:" で始めなければならない。スクリプトローカ +ルな関数は、そのスクリプトの中の関数から、またはそのスクリプト内で定義された +ユーザー定義コマンド、オートコマンドからしか呼ぶことができない。そのスクリプト +内で定義されたマッピングにより呼ぶこともできるが、スクリプトの外部でマッピング +が展開された場合は "s:" の代わりに || をつけなければならない。 +ローカル関数はスクリプトローカル関数だけである。バッファローカル関数やウィンド +ウローカル関数というものはない。 + + *:fu* *:function* *E128* *E129* *E123* +:fu[nction] 全ての関数と、その引数を表示する。 + +:fu[nction] {name} 関数{name}の定義を表示する。 + {name}は辞書|Dictionary|の要素の|Funcref|であってもよ + い: > + :function dict.init + +:fu[nction] /{pattern} {pattern}にマッチする名前の関数を表示する。"File" で終 + わる関数を全て表示する例: > + :function /File$ +< + *:function-verbose* +'verbose' が 0 でないとき、これらのコマンドで関数を表示すると、それがどこで定 +義されたかも表示する。例: > + + :verbose function SetFileTypeSH + function SetFileTypeSH(name) + Last set from /usr/share/vim/vim-7.0/filetype.vim +< +より詳しくは|:verbose-cmd|を参照。 + + *E124* *E125* *E853* *E884* +:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure] + {name}という名前で新しい関数を定義する。関数名はアル + ファベットと数字と '_' からなり、通常の関数はアルファ + ベットの大文字、スクリプトローカル関数は "s:" で始まら + なければならない。Note: "b:" や "g:" は使用できない + (7.4.260 からは関数名にコロンが含まれる場合は E884 エ + ラーが発生する。例 "foo:bar()"。このパッチ以前はエラー + にはならない)。 + + {name}は辞書|Dictionary|の要素の|Funcref|であってもよ + い: > + :function dict.init(arg) +< "dict" は既に定義されている辞書でなければならない。そ + の要素 "init" がまだ存在しないならば追加される。存在す + る場合は、既存の関数を上書きするためには [!] をつけな + ければならない。この値は番号つきの関数を指す|Funcref| + である。この関数は|Funcref|を通してのみ呼ぶことができ、 + そこへの参照がなくなると削除される。 + *E127* *E122* + この名前で定義される関数が既に定義済みで [!] が使用さ + れなかった場合、エラーとなる。[!] が使用されていれば、 + それまで存在していた関数は、速やかに新しいものへ置換え + られる。 + + 引数{arguments}については|function-argument|を参照。 + + *:func-range* *a:firstline* *a:lastline* + 引数[range]を追加した場合、関数は「範囲」を管理するこ + とができる。「範囲」は "a:firstline" と "a:lastline" + によって渡される。[range]がなかった場合、 + ":{range}call" が「範囲」を指定されて実行されると、1行 + 1行について、カーソルをその行の先頭に置いた状態で関数 + を呼び出すことになる。|function-range-example|を参照。 + 他の Ex コマンドと同様に、カーソルは選択範囲の最初の行 + に移動される。 + *:func-abort* + 引数 [abort] を追加すると、関数の実行中にエラーに遭遇 + し次第、即関数は中断される。 + *:func-dict* + 引数 [dict] を追加すると、この関数は辞書|Dictionary|の + 要素を通してしか呼べなくなる。そしてその辞書にローカル + 変数 "self" が定義される。|Dictionary-function|を参照。 + *:func-closure* *E932* + 引数 [closure] を追加すると、関数は外側のスコープの変 + 数と引数をアクセスできるようになる。これは一般的にク + ロージャと呼ばれる。以下の例では Bar() は Foo() のス + コープの "x" を使用している。それは Foo() から戻っても + 参照され続ける: > + :function! Foo() + : let x = 0 + : function! Bar() closure + : let x += 1 + : return x + : endfunction + : return funcref('Bar') + :endfunction + + :let F = Foo() + :echo F() +< 1 > + :echo F() +< 2 > + :echo F() +< 3 + + *function-search-undo* + 関数の実行によって、最後に使用されたサーチパターン、及 + びredoコマンドの "." の内容は変更されない。したがって、 + 関数内で|:nohlsearch| を行っても、関数から戻ると検索結 + 果のハイライトが元に戻ることになる。 + + *:endf* *:endfunction* *E126* *E193* +:endf[unction] 関数定義の終了。このコマンド1つで1行とすること。他のコ + マンドをいっしょに書いてはならない。 + + *:delf* *:delfunction* *E130* *E131* *E933* +:delf[unction] {name} 関数{name}を削除する。 + {name}は辞書|Dictionary|の要素の|Funcref|であってもよ + い: > + :delfunc dict.init +< この例は "dict" から要素 "init" を削除する。この関数へ + の参照がなくなると、関数は削除される。 + *:retu* *:return* *E133* +:retu[rn] [expr] 関数から戻る。"[expr]" が与えられた場合、それは評価さ + れ関数の戻り値として呼出し側に渡される。"[expr]" が与 + えられない場合、数値0が呼出し側に渡される。 + 関数内に実行されない命令があるかどうかはチェックされな + いことに留意すること。つまり、たとえ ":return" 命令の + 後に何か命令があったとしても、警告も何も与えられない。 + + |:try|と|:finally|の間で ":return" が実行された場合、 + ":finally" から対応する|:endtry|までのコマンドがまず実 + 行される。":try" がネストしている場合、それらの全てに + 対してこのプロセスが適用される。そして最も外側の + ":endtry" にて関数を抜ける。 + + *function-argument* *a:var* +引数は、与えられた名前によって定義される。関数のなかでは "a:name" ("a:" を引数 +に接頭)のようにして参照することができる。 + *a:0* *a:1* *a:000* *E740* *...* +引数はコンマで区切ることで、最大20まで与えることができる。最後の引数を "..." +にすることで、可変長の引数を使用できる。関数の中では "a:1" や "a:2" のようにし +て可変長の引数にアクセスできる。"a:0" は可変長引数が幾つあるかを示している (0 +であること、つまり引数がそれ以上ないこともある)。"a:000" は全引数を持つリスト +|List|を示している。Note "a:1" は "a:000[0]" と同じである。 + *E742* +a: のスコープとこの変数は固定されており、変更できない。 +しかしリスト|List|や辞書|Dictionary|のような複合型が使用された場合は、その内容 +を変更できる。よって関数にリスト|List|を渡し、そこに要素を追加させることができ +る。関数にリストや辞書を変更させたくない場合は|:lockvar|を使うこと。 + +"..." が使われていない時は、関数呼び出しの時の引数の数は名前付きの引数の数と一 +致していなければならない。"..." を使った時には引数の数は大きくなるだろう。 + +関数を引数無しで定義することも可能である。その時でも()は付けなければならない。 +関数の本体は、宣言の次の行から始まり、対応する|:endfunction|までになる。関数の +中で別の関数を定義することも可能である。 + + + *local-variables* +関数の中でローカル変数を使うこともできる。これらは関数から戻ると消滅する。 +グローバル変数にアクセスするためには "g:" を付ける必要がある。 + +例: > + :function Table(title, ...) + : echohl Title + : echo a:title + : echohl None + : echo a:0 . " items:" + : for s in a:000 + : echon ' ' . s + : endfor + :endfunction + +この関数は次のように呼ぶことができる: > + let lines = Table("Table", "line1", "line2") + let lines = Table("Empty Table") + +一つ以上の値を返したい場合には、リスト|List|を返すようにする: > + :function Compute(n1, n2) + : if a:n2 == 0 + : return ["fail", 0] + : endif + : return ["ok", a:n1 / a:n2] + :endfunction + +この関数は次のように呼ぶことができる: > + :let [success, div] = Compute(102, 6) + :if success == "ok" + : echo div + :endif +< + + *:cal* *:call* *E107* *E117* +:[range]cal[l] {name}([arguments]) + 関数を呼び出す。関数の名前と引数は|:function|によって指定され + るものである。引数は最大20まで使用可能。戻り値は破棄される。 + 「範囲」を受け付ける関数に「範囲」を指定しなかった場合、関数は + カーソルの現在位置について一度だけ呼び出される。 + 「範囲」を受け付けない関数に「範囲」を指定した場合、その範囲の + 一行ずつについて関数が呼び出される。その時カーソルは当該行の先 + 頭に設定される。カーソルは「範囲」の最下行の左端になる(恐らく + 最後の関数呼出しの結果、動いた先である)。引数は各呼出しについ + て繰り返し評価される。それは次の例で確かめることができる: + *function-range-example* > + :function Mynumber(arg) + : echo line(".") . " " . a:arg + :endfunction + :1,5call Mynumber(getline(".")) +< + "a:firstline" と "a:lastline" はとにかく定義されるので、「範 + 囲」の最初や最後で何か違った事をするのにも用いることができる。 + + 「範囲」自身を扱っている関数の例: > + + :function Cont() range + : execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ ' + :endfunction + :4,8call Cont() +< + この関数は「範囲」の最初の行を除いた全ての行の先頭に、継続のた + めの文字 "\" を挿入する。 + + この関数の戻り値からさらに間接参照が行われる場合、その参照先に + は範囲が渡されない。例: > + :4,8call GetDict().method() +< GetDict()には範囲が渡されるが、method()には渡されない。 + + *E132* +関数の再帰的な使用はオプション |'maxfuncdepth'| によって制限することができる。 + +自動的に読み込まれる関数 ~ + *autoload-functions* +たくさんの関数または巨大な関数を使うときは、それらが使用されたときだけ自動的に +定義されるようにすることができる。これには2つの方法がある: オートコマンドによ +る方法と、'runtimepath' 内の "autoload" ディレクトリによる方法である。 + + +オートコマンドを使う方法 ~ + +これはユーザーマニュアルのセクション|41.14|で説明されている。 + +オートコマンドは、長いVim scriptファイルのプラグインに対して有用である。自動コ +マンドを定義し、すぐに|:finish|でそのスクリプトを抜ける。こうするとVimの起動が +速くなる。その後オートコマンドにより|:finish|コマンドをスキップする変数を定義 +し、そのファイルが再び読み込まれる。 + +定義すべき関数名にマッチするパターンを指定してオートコマンドイベント +FuncUndefinedを使う。例: > + + :au FuncUndefined BufNet* source ~/vim/bufnetfuncs.vim + +ファイル "~/vim/bufnetfuncs.vim" は "BufNet" で始まる関数を定義しなければなら +ない。|FuncUndefined|も参照。 + + +オートロードスクリプトの使い方 ~ + *autoload* *E746* +これはユーザーマニュアルのセクション|41.15|で説明されている。 + +"autoload" ディレクトリのスクリプトを使う方法はより簡単である。しかし完全に正 +しいファイル名を使う必要がある。オートロードされる関数は次のような名前を持つ: > + + :call filename#funcname() + +このような関数が呼ばれ、それがまだ定義されていなかった場合、Vimは 'runtimepath' +内の "autoload" ディレクトリから "filename.vim" というスクリプトファイルを探 +す。例えば "~/.vim/autoload/filename.vim" のように。そしてこのファイルは次のよ +うな関数を定義していなければならない: > + + function filename#funcname() + echo "Done!" + endfunction + +このファイル名と関数の # の前の部分は完全に一致しなければならない。そして定義 +された関数は呼ばれた関数と完全に同じ名前でなければならない。 + +サブディレクトリを使うこともできる。関数名の中の # はパスのセパレータのように +解釈される。つまり、次の関数を呼ぶと: > + + :call foo#bar#func() + +Vimは 'runtimepath' からファイル "autoload/foo/bar.vim" を探す。 + +これはまだ定義されていない変数を参照するときにも使える: > + + :let l = foo#bar#lvar + +しかしこのオートロードスクリプトがすでに読み込まれている場合、未知の変数があっ +てもこのスクリプトは再読み込みされない。 + +この変数に値を代入するときは、何も特別なことはない。この方法は、オートロードス +クリプトが読み込まれる前に設定を渡すために使うことができる: > + + :let foo#bar#toggle = 1 + :call foo#bar#func() + +オートロードスクリプト内で定義されるはずの関数を呼んだがスクリプト内で関数が定 +義されなかった場合、その関数を呼ぶたびにそのスクリプトがsourceされる。そして毎 +回エラーメッセージが表示される。 + +また、2つのスクリプト間で、互いに自分が定義される前に相手を呼ぶような関数があ +ると、これは動作しない。 +トップレベルでオートロード機能を使うのは避けること。 + +Hint: たくさんのファイルからなるスクリプトを配布する場合には、|vimball|ユーティ +リティを使うとそれらをまとめることができる。ユーザーマニュアルの +|distribute-script|も参照。 + +============================================================================== +6. 波括弧変数 *curly-braces-names* + +変数を使用可能なほとんどの文脈では「波括弧」変数を使うことができる。これは有効 +な変数名であり、次のように、1個以上の式を波括弧{}で囲む: > + my_{adjective}_variable + +Vimはこれを見つけると、まず波括弧の中の式を評価し、その値をもとの位置に置きか +え、全体を変数名として再解釈する。よって上の例では、変数 "adjective" に +"noisy" が代入されていたとすると、この変数は "my_noisy_variable" となる。ある +いは、"adjective" に "quiet" が代入されていたとすれば "my_quiet_variable" とな +る。 + +これの応用の1つは、オプション値によって支配される変数の集合を作ることである。 +例えば次の文 > + echo my_{&background}_message + +は現在の 'background' の値に応じて "my_dark_message" か "my_light_message" の +中身を表示する。 + +波括弧を複数使うこともできる: > + echo my_{adverb}_{adjective}_message +ネストさせることもできる: > + echo my_{ad{end_of_word}}_message +ここで "end_of_word" は "verb" か "jective" のどちらかである。 + +しかし、波括弧の中の式を評価した結果が有効な変数名とならなければならない。 +つまり、次は無効である: > + :let foo='a + b' + :echo c{foo}d +というのは、展開の結果が "ca + bd" となるからで、これは有効な名前ではない。 + + *curly-braces-function-names* +同様の方法で評価した名前により関数を定義したり呼び出したりできる。 +例: > + :let func_end='whizz' + :call my_func_{func_end}(parameter) + +この例は関数 "my_func_whizz(parameter)" を呼びだす。 + +これらは機能しない: > + :let i = 3 + :let @{i} = '' " error + :echo @{i} " error + +============================================================================== +7. コマンド *expression-commands* + +:let {var-name} = {expr1} *:let* *E18* + 内部変数{var-name}に式{expr1}の結果をセットする。変数 + の型は{expr1}によって決定される。{var-name}という変数 + がまだ存在しない場合、新たに作成される。 + +:let {var-name}[{idx}] = {expr1} *E689* + リストの要素に式{expr1}の結果をセットする。{var-name} + はリストを参照し、{idx}はそのリストの有効なインデック + スでなければならない。ネストしたリストに対してはイン + デックスを繰り返すことができる。 + このコマンドはリストに要素を追加するためには使えない。 + 文字列の i バイト目をセットするためにも使えない。それ + には次のようにする: > + :let var = var[0:2] . 'X' . var[4:] +< + + *E711* *E719* +:let {var-name}[{idx1}:{idx2}] = {expr1} *E708* *E709* *E710* + リスト|List|の一部を式{expr}の値で置き換える。{expr}の + 値は正しい個数の要素を持つリストでなければならない。 + {idx1}を省略すると0となる。 + {idx2}を省略するとリストの末尾となる。 + 指定された範囲の一部がリストの末尾を越える場合、要素が + 追加される。 + + *:let+=* *:let-=* *:let.=* *E734* +:let {var} += {expr1} ":let {var} = {var} + {expr1}" と同様。 +:let {var} -= {expr1} ":let {var} = {var} - {expr1}" と同様。 +:let {var} .= {expr1} ":let {var} = {var} . {expr1}" と同様。 + {var}がセットされていないときや、{var}と{expr1}の型が + 演算子に合わないときは失敗する。 + + +:let ${env-name} = {expr1} *:let-environment* *:let-$* + 環境変数{env-name}に式{expr1}の結果をセットする。型は + 常に文字列。 +:let ${env-name} .= {expr1} + 環境変数{env-name}に{expr1}を付け加える。その環境変数 + が存在しないときは "=" と同様に働く。 + +:let @{reg-name} = {expr1} *:let-register* *:let-@* + 式{expr1}の結果をレジスタ{reg-name}に書きこむ。 + {reg-name}は単一の文字でかつ、書きこむことのできるレジ + スタでなければならない(|registers|を参照)。"@@" は名前 + 無しレジスタとして使用でき、"@/" はサーチパターンとし + て使用できる。 + {expr1}の結果がで終了していた場合、レジスタ + は行単位で設定され、そうでなければ文字単位で設定される。 + 次のコマンドにより最後に検索したパターンをクリアするこ + とができる: > + :let @/ = "" +< これは空文字列を検索するのとは異なる。空文字列を検索す + ると、いたるところでマッチする。 + +:let @{reg-name} .= {expr1} + レジスタ{reg-name}に{expr1}を付け加える。このレジスタ + が空のときは、そこに{expr1}をセットする。 + +:let &{option-name} = {expr1} *:let-option* *:let-&* + オプション{option-name}に式{expr}の値をセットする。文 + 字列や数値の値はそのオプションの型に変換される。 + ウィンドウやバッファについてローカルなオプションに対し + ては、その効果は|:set|コマンドを使ったときと同様で、ロー + カルな値とグローバルな値の両方が変更される。 + 例: > + :let &path = &path . ',/usr/local/include' +< これは、t_xx 形式の端末コードにも使える。ただし、英数 + 字の名前に限る。例: > + :let &t_k1 = "\[234;" +< コードが存在していなかったときは端末キーコードとして作 + 成され、エラーは発生しない。 + +:let &{option-name} .= {expr1} + 文字列のオプションの場合: その値に{expr}を付け加える。 + |:set+=|とは違い、コンマを挿入しない。 + +:let &{option-name} += {expr1} +:let &{option-name} -= {expr1} + 数値または切替のオプションの場合: {expr1}を足す・引く。 + +:let &l:{option-name} = {expr1} +:let &l:{option-name} .= {expr1} +:let &l:{option-name} += {expr1} +:let &l:{option-name} -= {expr1} + 上と同様だが、オプションのローカルな値だけをセットする + (ローカルな値があるならば)。|:setlocal|と同様に働く。 + +:let &g:{option-name} = {expr1} +:let &g:{option-name} .= {expr1} +:let &g:{option-name} += {expr1} +:let &g:{option-name} -= {expr1} + 上と同様だが、オプションのグローバルな値だけをセットす + る(グローバルな値があるならば)。|:setglobal|と同様に働 + く。 + +:let [{name1}, {name2}, ...] = {expr1} *:let-unpack* *E687* *E688* + {expr1}の値はリスト|List|でなければならない。そのリス + トの最初の要素が{name1}に代入され、2番目の要素が + {name2}に代入される。以下同様。 + nameの個数がリスト|List|の要素の個数に一致しなければな + らない。 + 前述のように各nameは ":let" コマンドの要素の1つになる + ことができる。 + 例: > + :let [s, item] = GetItem(s) +< 詳細: 最初に{expr1}が評価され、それから順番に代入が行 + われる。{name2}が{name1}に依存するかどうかは問題になる。 + 例: > + :let x = [0, 1] + :let i = 0 + :let [i, x[i]] = [1, 2] + :echo x +< この結果は[0, 2]となる。 + +:let [{name1}, {name2}, ...] .= {expr1} +:let [{name1}, {name2}, ...] += {expr1} +:let [{name1}, {name2}, ...] -= {expr1} + 上と同様だが、リスト|List|の各要素に対し連結・足し算・ + 引き算を行う。 + +:let [{name}, ..., ; {lastname}] = {expr1} + |:let-unpack|と同様だが、リスト|List|の要素数がnamesの + 数より多くてもよい。余った要素のリストが{lastname}に代 + 入される。要素の余りがないとき{lastname}は空リストにな + る。 + 例: > + :let [a, b; rest] = ["aval", "bval", 3, 4] +< +:let [{name}, ..., ; {lastname}] .= {expr1} +:let [{name}, ..., ; {lastname}] += {expr1} +:let [{name}, ..., ; {lastname}] -= {expr1} + 上と同様だが、リスト|List|の各要素に対して連結・足し算 + ・引き算を行う。 + + *E121* +:let {var-name} .. 変数{var-name}の値を一覧表示する。変数の名前を複数指定 + することができる。以下の特別な名前が認識される: *E738* + g: グローバル変数 + b: バッファローカル変数 + w: ウィンドウローカル変数 + t: タブページローカル変数 + s: スクリプトローカル変数 + l: 関数ローカル変数 + v: Vimの変数 + +:let 全変数の値を一覧表示する。値の前に変数の型が示される: + 文字列 + # 数値 + * Funcref + + +:unl[et][!] {name} ... *:unlet* *:unl* *E108* *E795* + 内部変数{name}を削除する。複数の変数名を指定すると、そ + れらが全て削除される。名前はリスト|List|や辞書 + |Dictionary|の要素でもよい。 + [!]をつけると存在しない変数に対するエラーメッセージを + 表示しない。 + リスト|List|から1個以上の要素を削除することができる: > + :unlet list[3] " 4番目の要素を削除 + :unlet list[3:] " 4番目から最後までの要素を + 削除 +< 辞書からは一度に1個の要素を削除することができる: > + :unlet dict['two'] + :unlet dict.two + グローバル変数とスクリプトローカル変数をクリーンアップ + するために特に便利である(これらはスクリプト終了時に検 + 出されない)。関数ローカルな関数は、その関数から抜ける + ときに自動的に削除される。 + +:lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv* + 内部変数{name}をロックする。ロックすると、それ以降変更 + ができなくなる(アンロックするまで)。 + ロックされた変数を削除することはできる: > + :lockvar v + :let v = 'asdf' " 失敗! + :unlet v +< *E741* *E940* + ロックされた変数を変更しようとするとエラーメッセージ + "E741: Value is locked: {name}" が表示される。 + もしも組み込み変数をロック・アンロックしようとすると、 + エラーメッセージ "E940: Cannot lock or unlock variable + {name}" が表示される。 + + [depth]はリスト|List|や辞書|Dictionary|をロックすると + きに意味がある。どれだけ深くロックするかを指定する: + 1 リストや辞書それ自身をロックする。要素 + を追加したり削除はできないが、要素の値 + を変えることはできる。 + 2 要素の値もロックする。その要素がリスト + や辞書である場合、その中の要素の追加や + 削除はできないが、値の変更はできる。 + 3 2と同様だが、リスト・辞書内のリスト・ + 辞書に対してもあてはまる。1レベル深い。 + [depth]の既定値は2であり、{name}がリストまたは辞書であ + る場合、その値は変更できない。 + *E743* + 深さを無限にするには[!]を使い、[depth]を省略する。しか + しループを捕捉するために深さの最大値は100に設定されて + いる。 + + Note 2つの変数が同じリスト|List|を参照している場合、片 + 方の変数をロックすると、もう一方の変数を介してアクセス + した場合もロックされている。 + 例: > + :let l = [0, 1, 2, 3] + :let cl = l + :lockvar l + :let cl[1] = 99 " 代入できない! +< + これを回避するにはリストのコピーを作るとよい。 + |deepcopy()|を参照。 + + +:unlo[ckvar][!] [depth] {name} ... *:unlockvar* *:unlo* + 内部変数{name}をアンロックする。|:lockvar|の逆を行う。 + + +:if {expr1} *:if* *:endif* *:en* *E171* *E579* *E580* +:en[dif] {expr1}が非ゼロと評価された場合に、対応する ":else" か + ":endif" までの命令を実行する。 + + バージョン4.5から5.0まで間のVimは、":if" と ":endif" + の間の全てのExコマンドは無視する。この2つのコマンドは + 将来の拡張性を、下位互換と同時に提供するためのものであ + る。ネスティング (入れ子) が可能である。":else" や + ":elseif" は無視され、"else" 部分は一切実行されないこ + とに注意。 + + あなたはこれを、旧バージョンとの互換性を保ったまま使用 + することができる: > + :if version >= 500 + : version-5-specific-commands + :endif +< しかしそれでも "endif" を見つけるために後続のコマンド + をパースする必要がある。古いVimで新しいコマンドを使う + と問題が起こることがある。例えば ":silent" が + ":substitute" コマンドと認識されるなど。その場合には、 + ":execute" を使うと問題を避けることができる: > + :if version >= 600 + : execute "silent 1,$delete" + :endif +< + NOTE: ":append" と ":insert" コマンドは ":if" と + ":endif" の間では正しく動かない。 + + *:else* *:el* *E581* *E583* +:el[se] 対応する ":if" ブロックが実行されなかった場合には、こ + れに対応する ":else" か ":endif" までのコマンドが実行 + される。 + + *:elseif* *:elsei* *E582* *E584* +:elsei[f] {expr1} ":else" ":if" の省略形。":endif" を付け加える (入れ子 + にする) 手間を省くことができる。 + +:wh[ile] {expr1} *:while* *:endwhile* *:wh* *:endw* + *E170* *E585* *E588* *E733* +:endw[hile] {expr1}が非ゼロとして評価される間、":while" と + ":endwhile" の間のコマンドを繰り返し実行する。 + ループの内側でエラーが生じた場合、endwhileの直後から実 + 行が再開される。 + 例: > + :let lnum = 1 + :while lnum <= line("$") + :call FixLine(lnum) + :let lnum = lnum + 1 + :endwhile +< + NOTE: ":append" や ":insert" コマンドは ":while" ループの内側 + では正しく動かない。 + +:for {var} in {list} *:for* *E690* *E732* +:endfo[r] *:endfo* *:endfor* + {list}の各要素に対し、":for" と ":endfor" の間のコマン + ドを繰り返す。変数{var}に各要素の値がセットされる。 + ループの内側のコマンドでエラーが検出されたときは + "endfor" の後から実行が継続される。 + ループの内側で{list}を変更するとどの要素が使われるかに + 影響を与える。それを望まない場合はコピーを作ること: > + :for item in copy(mylist) +< コピーを作らないと、Vimは現在の要素に対してコマンドを + 実行する前に、リストの次の要素への参照を保存する。その + ため副作用なしに現在の要素を削除することができる。それ + 以降の要素を変更すると、それが見つからなくなる。つまり + 以下の例は動作する(リストを空にする非効率な方法): > + for item in mylist + call remove(mylist, 0) + endfor +< Note リストを並べ替える(例えばsort()やreverse()で)と予 + 期しない結果になることがある。 + +:for [{var1}, {var2}, ...] in {listlist} +:endfo[r] + 上の ":for" と同様だが、{listlist}の各要素がリストでな + ければならない点が異なる。そのリストの各要素が{var1}, + {var2}などに代入される。例: > + :for [lnum, col] in [[1, 3], [2, 5], [3, 8]] + :echo getline(lnum)[col] + :endfor +< + *:continue* *:con* *E586* +:con[tinue] ":while" または ":for" ループの内側で使われたときは、 + そのループの開始位置まで戻る。 + ループの内側の|:try|と|:finally|の間で使われた場合、 + |:finally|から|:endtry|までの間のコマンドがまず実行さ + れる。ループの内側で ":try" がネストしている場合、全て + の ":try" に対してこのプロセスが適用される。最も外側の + ":endtry" の後ループの開始位置まで戻る。 + + *:break* *:brea* *E587* +:brea[k] ":while" または ":for" ループの内側で使われたときは、 + 対応する ":endwhile" または ":endfor" の後のコマンドま + でスキップする。 + ループの内側の|:try|と|:finally|の間で使われた場合、 + |:finally|から|:endtry|までの間のコマンドがまず実行さ + れる。ループの内側で ":try" がネストしている場合、全て + の ":try" に対してこのプロセスが適用される。最も外側の + ":endtry" の後ループの後までジャンプする。 + +:try *:try* *:endt* *:endtry* *E600* *E601* *E602* +:endt[ry] ":try" と ":endtry" の間のコマンド (":source" コマン + ド、関数呼び出し、オートコマンド実行を含めた全てのコマ + ンド実行) のエラー制御を変更する。 + + エラーや割り込みが検出された場合、後に|:finally|コマン + ドがあるならば、":finally" の後から実行が継続される。 + そうでなければ、または ":endtry" に達した後は次の動的 + に囲んでいる ":try" に対応する ":finally" などが探され + る。その後スクリプトは実行を停止する。(関数定義に引数 + "abort" がついているかどうかは関係ない) + 例: > + :try | edit too much | finally | echo "cleanup" | endtry + :echo "impossible" " 実行されない。上のコマンドにより + " スクリプトは停止する。 +< + さらに、(動的に) ":try" と ":endtry" の内側にあるエラー + や割り込みは例外に変換される。そしてそれは|:throw|コマ + ンドによって投げたときと同様に捕捉できる(|:catch|を参 + 照)。この場合はスクリプトの実行は停止しない。 + + 割り込み例外には "Vim:Interrupt" という値が使われる。 + Vimコマンドにおけるエラーは "Vim({command}):{errmsg}" + という形式の値に変換される。その他のエラーは + "Vim:{errmsg}" という形式のエラーに変換される。ここで + {command}はコマンドの完全な名前であり、{errmsg}はその + 例外が捕捉されなかった場合に表示されるメッセージで、常 + にエラー番号で始まる。 + 例: > + :try | sleep 100 | catch /^Vim:Interrupt$/ | endtry + :try | edit | catch /^Vim(edit):E\d\+/ | echo "error" | endtry +< + *:cat* *:catch* *E603* *E604* *E605* +:cat[ch] /{pattern}/ {pattern}にマッチする例外が発生し、より前の|:catch| + で捕捉されなかった場合、このコマンドから次の|:catch|, + |:finally|, |:endtry|までのコマンドが実行される。その + ような例外が発生しなかった場合、そのコマンドはスキップ + される。 + {pattern}が省略された場合は全てのエラーが捕捉される。 + 例: > + :catch /^Vim:Interrupt$/ " 割り込み (CTRL-C) を捕捉 + :catch /^Vim\%((\a\+)\)\=:E/ " 全Vimエラーを捕捉 + :catch /^Vim\%((\a\+)\)\=:/ " 例外と割り込みを捕捉 + :catch /^Vim(write):/ " :writeにおける全エラーを捕捉 + :catch /^Vim\%((\a\+)\)\=:E123/ " エラーE123を捕捉 + :catch /my-exception/ " ユーザー定義例外を捕捉 + :catch /.*/ " 全てを捕捉 + :catch " /.*/と同じ +< + {pattern}を囲むのに/以外の文字を使うことができる。ただ + しその文字は特別な意味(例: '|' や '"' など)を持ってい + てはならず、{pattern}の内側に現れてはならない。 + 例外の情報は |v:exception| で得られる。 + |throw-variables| も参照。 + NOTE: エラーメッセージの本文によって ":catch" すること + は確実ではない。メッセージはロケールによって異なるから + である。 + + *:fina* *:finally* *E606* *E607* +:fina[lly] |:try|と ":finally" の間を抜ける前に必ず、このコマンド + から対応する|:endtry|の間のコマンドが実行される。つま + り正常に進んだ場合、|:continue|, |:break|, |:finish|, + |:return|を使った場合、エラー・割り込み・例外が発生し + た場合(|:throw|を参照)のいずれの場合でも。 + + *:th* *:throw* *E608* +:th[row] {expr1} {expr1}を評価し、例外として投げる。|:try|と|:catch|の + 間で ":throw" が使われた場合、{expr1}にマッチする最初 + の|:catch|までのコマンドはスキップされる。そのような + ":catch" がない場合、または ":catch" と|:finally|の間 + で ":throw" が使われた場合、":finally" から|:endtry|ま + でのコマンドが実行される。":throw" が ":finally" の後 + で実行された場合、":endtry" までのコマンドはスキップさ + れる。 + ":endtry" において、動的に囲んでいる次の ":try" (これ + は関数呼び出しやスクリプトsourceも含めて探される) から + 対応する ":catch" までに対しこのプロセスが再び適用され + る。例外が捕捉されない場合、コマンドの処理は終了する。 + 例: > + :try | throw "oops" | catch /^oo/ | echo "caught" | endtry +< Note: エラーによって行のパースがスキップされ、"|" によ + るコマンド区切りが解釈されないような場合は "catch" は + 行を分けて書く必要がある。 + + *:ec* *:echo* +:ec[ho] {expr1} .. 各{expr1}をスペースで区切って表示する。最初の{expr1}の + 表示は、常に新しい行から始まる。 + |:comment|も参照。 + 改行が必要な場合 "\n" を使用する。カーソルを第1桁に + 持って行くには "\r" を使用する。 + 色強調を行うにはコマンド|:echohl|を使用する。 + コメント文を同じ行に続けることはできない。 + 例: > + :echo "the value of 'shell' is" &shell +< *:echo-redraw* + このコマンドの後、再描画を行うと表示したメッセージが消 + えてしまう。Vim は一連のコマンドが完了するまで再描画を + 後回しにするため、この現象は頻繁に発生する。例えば、 + ":echo" より前に実行したコマンドが後で再描画を引き起こ + し、メッセージが消えてしまうということがある(再描画は + しばしばユーザーが何か入力するまで後回しにされる)。こ + の問題を避けるには、|:redraw| を使って強制的に再描画す + ること。例: > + :new | redraw | echo "there is a new window" +< + + *:echon* +:echon {expr1} .. 改行を付けずに、{expr1}を表示する。|:comment|も参照。 + 色強調を行うにはコマンド|:echohl|を使用する。 + コメント文を同じ行に続けることはできない。 + 例: > + :echon "the value of 'shell' is " &shell +< + Vimコマンドの ":echo" と、外部のシェルコマンドである + ":!echo" との違いに注意: > + :!echo % --> filename +< ":!" の引数は展開される。|:_%|を参照。 > + :!echo "%" --> filename or "filename" +< 前の例のように働く。ダブルクォートが表示されるかどうか + は、使用している 'shell' に依存する。 > + :echo % --> 何も表示されない +< '%' は式として不当な文字である。 > + :echo "%" --> % +< 単に文字 '%' を表示する。 > + :echo expand("%") --> filename +< '%' を展開するために関数expand()を呼び出している。 + + *:echoh* *:echohl* +:echoh[l] {name} 次の |:echo|, |:echon|, |:echomsg| コマンドから、ハイ + ライトグループ{name}を適用する。|input()|のプロンプト + に対しても適用される。例: > + :echohl WarningMsg | echo "Don't panic!" | echohl None +< 使用した後にはグループを "None" に戻すことを忘れないよ + うに。さもないとそれ以降のechoの表示全てがハイライトさ + れてしまう。 + + *:echom* *:echomsg* +:echom[sg] {expr1} .. 式を本当のメッセージとして表示し、そのメッセージをメッ + セージ履歴|message-history|に保存する。 + |:echo|コマンド同様に、引数の間にスペースが挿入される。 + しかし印字不可能な文字は解釈されずに表示される。 + |:echo|とはかなり異なり、むしろ|:execute|に近い方法で + 解析がされる。なんらかを表示する前に、まず最初に全ての + 式が評価し、連結する。式を評価した値は数値か文字列でな + ければならない。辞書やリストはエラーとなる。 + 強調を行うには|:echohl|コマンドを使う。 + 例: > + :echomsg "It's a Zizzer Zazzer Zuzz, as you can plainly see." +< 画面を再描画したときメッセージが消去されてしまうのを避 + ける方法については|:echo-redraw|を参照。 + *:echoe* *:echoerr* +:echoe[rr] {expr1} .. 式をエラーメッセージとして表示し、そのメッセージを + メッセージ履歴|message-history|に保存する。スクリプト + や関数の中で使用されたときは行番号が付け加えられる。 + |:echo|コマンドと同様に引数の間にスペースが挿入される。 + try条件文の中で使用されたときは、このメッセージがエ + ラー例外として投げられる。(|try-echoerr|を参照) + 例: > + :echoerr "This script just failed!" +< + 単にメッセージを強調させたい場合には|:echohl|を使うこ + と。ビープを鳴らしたいときには次のようにする: > + :exe "normal \" +< + *:exe* *:execute* +:exe[cute] {expr1} .. {expr1}の評価結果の文字列をExコマンドとして実行する。 + 複数の引数は連結され、間にスペースが挿入される。余計な + スペースを入れたくない場合は "." オペレータを使って文 + 字列を連結すること。 + {expr1}は処理されたコマンドとして扱われ、コマンドライ + ン編集用のキーは認識されない。 + コメント文を同じ行に続けることはできない。 + 例: > + :execute "buffer" nextbuf + :execute "normal" count . "w" +< + ":execute" は '|' を受けつけないコマンドに、次のコマン + ドを続けて実行させるのにも使用できる。例: > + :execute '!ls' | echo "theend" +< {訳注: 普通の使い方では ":!ls" の後には '|' を使って、 + Exコマンドを続けることはできない} + また ":execute" は、Vim script 内でコマンド ":normal" + の引数に制御文字を書くことを避けるために役に立つ。 > + :execute "normal ixxx\" +< これで文字を表す。|expr-string|を参照。 + + ファイル名の中の特殊文字を正しくエスケープするように + 注意すること。Vim コマンドに与えるファイル名をエス + ケープするには |fnameescape()| を使う。|:!| コマンドに + 与えるときは |shellescape()| を使う。 + 例: > + :execute "e " . fnameescape(filename) + :execute "!ls " . shellescape(filename, 1) +< + Note: execute に渡す文字列はいかなるコマンドでも構わな + いが、"if" や "while"、"for" の開始や終了は常に機能す + るとは限らない。なぜならコマンドをスキップするときには + ":execute" は解釈されないので Vim はブロックの開始や終 + 了を認識することができない。"break" と "continue" も + ":execute" で実行すべきではない。 + 次の例は機能しない。":execute" は評価されず、Vim は + "while" を認識しないので、":endwhile" を見つけたときに + エラーが発生する: > + :if 0 + : execute 'while i > 5' + : echo "test" + : endwhile + :endif +< + 文字列の中に完全な "while" や "if" コマンドが含まれる + ことが求められる: > + :execute 'while i < 5 | echo i | let i = i + 1 | endwhile' +< + + *:exe-comment* + ":execute" や ":echo" そして ":echon" は、同一行に直接 + コメントを続けることはできない。何故ならそれらのコマン + ドにとって '"' は文字列の始まりに見えてしまうからであ + る。しかし '|' の後にコメントを書くことは可能である。 + 例: > + :echo "foo" | "this is a comment + +============================================================================== +8. 例外処理 *exception-handling* + +Vim script 言語は例外処理機構を備えている。この節では例外処理をどのように行 +うかについて説明する。 + +例外はエラー発生時や割り込み発生時にVimによって投げられる。それについては +|catch-errors|と|catch-interrupt|を参照。ユーザーはコマンド|:throw|によって明示 +的に例外を投げることができる。|throw-catch|を参照。 + + +TRY 条件文 *try-conditionals* + +例外を捕捉したり、例外を引き金として後始末のコードを実行することができる。try +条件文を使う事によってcatch節(これが例外を捕捉する)やfinally節(後始末のために +実行される)を指定する事ができる。 +try条件文はコマンド|:try|によって始まり、対応するコマンド|:endtry|によって終了 +する。その間でコマンド|:catch|によりcatch節を定めたり、コマンド|:finally|に +よってfinally節を定めることができる。catch節は1個もなかったり、複数個あっても +よい。しかしfinally節は1個までしか持てない。finally節の後にcatch節があってはな +らない。catch節とfinally節の前の部分はtryブロックと呼ばれる。 + + :try + : ... + : ... try ブロック + : ... + :catch /{pattern}/ + : ... + : ... catch 節 + : ... + :catch /{pattern}/ + : ... + : ... catch 節 + : ... + :finally + : ... + : ... finally 節 + : ... + :endtry + +try条件文により、コードから発生する例外を監視したり、適切な対応を取ることがで +きる。tryブロック内で発生した例外は捕捉される。tryブロックとcatch節内で発生し +た例外は捕捉され、後始末が行われる。 +tryブロックの実行中に例外が発生しなかった場合は、制御は (もしあれば) finally節 +に移動する。その実行後に、スクリプトは ":endtry" の後の行から実行を継続する。 +tryブロックの実行中に例外が発生した場合は、tryブロックの残りの行はスキップされ +る。例外はコマンド ":catch" の引数として指定された正規表現に照合される。最初に +マッチした ":catch" の後のcatch節が実行される。他のcatch節は実行されない。 +catch節は次に ":catch", ":finally", ":endtry" が現れたところで終了する (どれで +もよい)。 +":endtry" に達すると、スクリプトは次の行から通常通り実行が続けられる。 +発生した例外が、コマンド ":catch" で指定されたどの正規表現にもマッチしないとき、 +その例外はそのtry条件文で捕捉されず、どのcatch節も実行されない。finally節があ +るならば実行される。finally節の実行中は例外は後回しにされ、":endtry" のときに +実行される。そして ":endtry" の後のコマンドは実行されず、例外は他のどこかで捕 +捉される。|try-nesting|を参照。 +catch節の実行中に新たな例外が発生した場合は、そのcatch節の残りの行は実行されな +い。新しい例外は同じtry条件文のどの ":catch" コマンドの正規表現にも照合されず、 +どのcatch節も実行されない。しかしfinally節があるならばそこが実行され、その間そ +の例外は保留される。":endtry" の後のコマンドは実行されない。新しい例外は他のど +こかで捕捉される。|try-nesting|を参照。 +finally節の実行中に例外が発生した場合は、そのfinally節の残りの行は実行されない。 +tryブロックやそのcatch節のどこかで例外が発生してからそのfinally節が実行されて +いた場合は、元の(保留されていた)例外は破棄される。":endtry" の後のコマンドは実 +行されない。finally節で発生した例外は伝播し、他のどこかで捕捉される。 +|try-nesting|を参照。 + +完全なtry条件文を囲む ":while" ループ内で、tryブロックやcatch節において +":break" や ":continue" が実行されたときもfinally節が実行される。 +また、関数の中やsourceされたスクリプト中で、tryブロックやtry条件文のcatch節に +おいて ":return" や ":finish" が実行されたときもfinally節が実行される。finally +節の実行中は ":break", ":continue", ":return", ":finish" は保留され、":endtry" +に達したとき再開される。しかしこれらは、そのfinally節内で例外が発生したときは +破棄される。 +完全なtry条件節を囲む ":while" ループ内での ":break" や ":continue"、または +finally節内で ":return" や ":finish" に出会ったときは、finally節の残りはスキッ +プされ、通常通り ":break", "continue", ":return", "finish" が実行される。もし +そのfinally節の前に、tryブロックやcatch節内で例外が発生したり、":break", +":continue", ":return", ":finally" が行われていた場合は、それらの保留されてい +た例外やコマンドは破棄される。 + +例として |throw-catch| と |try-finally| を参照。 + + +try条件文のネスト *try-nesting* + +try条件文は任意にネストされられる。つまり、try条件文のtryブロック・catch節・ +finally節のなかに別の完全なtry条件文を書くことができる。内側のtry条件文がtryブ +ロックで発生した例外を捕捉しなかったときや、catch節・finally節で新たな例外が発 +生したときは、外側のtry条件文がそのルールにしたがって例外を捕捉する。内側の +try条件文が外側の条件文のtryブロックの中にある場合はcatch節が判定されるが、そ +うでない場合はfinally節のみが実行される。これはネストの仕方には関係ない。つま +り、内側のtry条件文が直接外側のtry条件文に含まれていてもよいし、外側がスクリプ +トをsourceしたり、内側のtry条件文を含む関数を呼び出していてもよい。 + +有効なtry条件文のどれも例外を捕捉しなかったときは、それらのfinally節が実行され +る。その後、スクリプトの実行は停止する。":throw" コマンドにより明示的に投げら +れた例外が捕捉されなかった場合は、エラーメッセージが表示される。Vimによって暗 +黙的に投げられたエラーや割り込み例外については、通常通りエラーメッセージや割り +込みメッセージが表示される。 + +例として |throw-catch| を参照。 + + +例外処理コードの検査 *except-examine* + +例外処理のコードはトリッキーになりがちである。何が起こっているか知りたいときは +スクリプトファイルをsourceするときに 'verbose' を13に設定するか、コマンド修飾 +子 ":13verbose" を使う。すると例外が発生・破棄・捕捉・完了したときには表示され +るようになる。冗長度のレベルを14以上にすると、finally節において保留されている +ものも表示されるようになる。この情報はデバッグモードでも表示される +(|debug-scripts|を参照)。 + + +例外の生成と捕捉 *throw-catch* + +任意の数値や文字列を例外として投げることができる。コマンド|:throw|を使い、投げ +られる値を引数に渡す: > + :throw 4711 + :throw "string" +< *throw-expression* +式を引数に指定することもできる。まずその式が評価され、その結果が投げられる: > + :throw 4705 + strlen("string") + :throw strpart("strings", 0, 6) + +":throw" コマンドの引数を評価している最中に例外が発生することもありうる。その +例外が捕捉されない限り、その式の評価は破棄される。 +よって、その ":throw" コマンドは例外を投げることができない。 + 例: > + + :function! Foo(arg) + : try + : throw a:arg + : catch /foo/ + : endtry + : return 1 + :endfunction + : + :function! Bar() + : echo "in Bar" + : return 4710 + :endfunction + : + :throw Foo("arrgh") + Bar() + +この例を実行すると "arrgh" が投げられ、Bar()が実行されないため "in Bar" は表示 +されない。しかし次のようにすると > + :throw Foo("foo") + Bar() +"in Bar" を表示し、4711を投げる。 + +式を引数として受け取る他のコマンドでも、式の評価中に捕捉されない例外が発生する +とコマンドが破棄される。そして例外はそのコマンドを呼び出した位置へ伝播する。 + 例: > + + :if Foo("arrgh") + : echo "then" + :else + : echo "else" + :endif + +この例で、"then" と "else" のどちらも表示されない。 + + *catch-order* +例外は、1個以上の|:catch|コマンドを持つtry条件文で捕捉することができる。これに +ついては|try-conditionals|を参照。各 ":catch" コマンドで捕捉される値は、引数に +て正規表現で指定できる。マッチする例外が捕捉されると、その後に続くcatch節が実 +行される。 + 例: > + + :function! Foo(value) + : try + : throw a:value + : catch /^\d\+$/ + : echo "Number thrown" + : catch /.*/ + : echo "String thrown" + : endtry + :endfunction + : + :call Foo(0x1267) + :call Foo('string') + +最初のFoo()の呼び出しは "Number thrown" を表示し、2番目の呼び出しは "String +thrown" を表示する。例外は、順番に ":catch" コマンドに照合される。最初にマッチ +したcatch節だけが実行される。そのため、より限定的な ":catch" を先に書くべきで +ある。次の順序で書くと無意味になってしまう: > + + : catch /.*/ + : echo "String thrown" + : catch /^\d\+$/ + : echo "Number thrown" + +最初の ":catch" は常にマッチするため、2番目のcatch節は決して実行されない。 + + *throw-variables* +一般的な正規表現により例外を捕捉した場合、その正確な値には変数|v:exception|に +よりアクセスできる: > + + : catch /^\d\+$/ + : echo "Number thrown. Value is" v:exception + +また、どこで例外が発生したかも知りたいだろう。これは|v:throwpoint|に保持されて +いる。Note "v:exception" と "v:throwpoint" は最も直近に捕捉された例外に対し、 +それが終了するまで有効である。 + 例: > + + :function! Caught() + : if v:exception != "" + : echo 'Caught "' . v:exception . '" in ' . v:throwpoint + : else + : echo 'Nothing caught' + : endif + :endfunction + : + :function! Foo() + : try + : try + : try + : throw 4711 + : finally + : call Caught() + : endtry + : catch /.*/ + : call Caught() + : throw "oops" + : endtry + : catch /.*/ + : call Caught() + : finally + : call Caught() + : endtry + :endfunction + : + :call Foo() + +上の例は次のように表示する > + + Nothing caught + Caught "4711" in function Foo, line 4 + Caught "oops" in function Foo, line 10 + Nothing caught + +実用的な例: 次のコマンド ":LineNumber" は、それが呼び出されたスクリプトや関数 +中の行番号を表示する: > + + :function! LineNumber() + : return substitute(v:throwpoint, '.*\D\(\d\+\).*', '\1', "") + :endfunction + :command! LineNumber try | throw "" | catch | echo LineNumber() | endtry +< + *try-nested* +try条件文によって捕捉されない例外はそれを囲むtry条件文によって捕捉することがで +きる: > + + :try + : try + : throw "foo" + : catch /foobar/ + : echo "foobar" + : finally + : echo "inner finally" + : endtry + :catch /foo/ + : echo "foo" + :endtry + +内側のtry条件文はこの例外を捕捉せず、finally節が実行されるだけである。そしてこ +の例外は外側のtry条件文で捕捉される。この例を実行すると "inner finally" と +"foo" が表示される。 + + *throw-from-catch* +例外を捕捉した後、新しい例外を投げて他のcatch節で捕捉させることができる: > + + :function! Foo() + : throw "foo" + :endfunction + : + :function! Bar() + : try + : call Foo() + : catch /foo/ + : echo "Caught foo, throw bar" + : throw "bar" + : endtry + :endfunction + : + :try + : call Bar() + :catch /.*/ + : echo "Caught" v:exception + :endtry + +これを実行すると "Caught foo, throw bar" と "Caught bar" が表示される。 + + *rethrow* +Vim script言語には本物のrethrowはないが、代わりに "v:exception" を使うことがで +きる: > + + :function! Bar() + : try + : call Foo() + : catch /.*/ + : echo "Rethrow" v:exception + : throw v:exception + : endtry + :endfunction +< *try-echoerr* +Note この方法はVimのエラーや割り込み例外を "rethrow" するためには使えない。Vim +の内部例外を偽装することはできないからである。それを行おうとするとエラー例外が +発生する。その状況を表す自分自身の例外を投げるべきである。独自のエラー例外値を +含むVimのエラー例外を発生させたい場合には、コマンド|:echoerr|を使うことができ +る: > + + :try + : try + : asdf + : catch /.*/ + : echoerr v:exception + : endtry + :catch /.*/ + : echo v:exception + :endtry + +このコードを実行すると次が表示される + + Vim(echoerr):Vim:E492: Not an editor command: asdf ~ + + +後始末処理 *try-finally* + +しばしばスクリプト中でグローバルな設定を変更し、最後に元の設定を復元することが +ある。しかしユーザーがCTRL-Cを押してスクリプトを中断すると、設定が一貫しない状 +態になってしまう。スクリプトの開発段階においても、エラーが発生したり、明示的に +例外を投げたが捕捉されなかった場合に、同じことが起こりうる。この問題は、try条 +件文を使ってfinally節で設定を復元することで解決できる。finally節は、通常の制御 +フロー・エラー時・明示的な ":throw" 時・割り込み時に実行されることが保証されて +いる。(Note try条件文の内側で発生したエラーと割り込みは例外に変換される。これ +らが捕捉されなかったときには、finally節の実行の後にスクリプトの実行が停止す +る。) +例: > + + :try + : let s:saved_ts = &ts + : set ts=17 + : + : " Do the hard work here. + : + :finally + : let &ts = s:saved_ts + : unlet s:saved_ts + :endtry + +関数やスクリプトの一部でグローバルな設定を変更し、その関数・スクリプトの失敗時・ +通常終了時に設定を復元する必要があるときは、必ず局所的にこの手法を使うべきであ +る。 + + *break-finally* +":continue", ":break", ":return", ":finish" などによってtryブロックやcatch節を +抜けるときも後始末処理が働く。 + 例: > + + :let first = 1 + :while 1 + : try + : if first + : echo "first" + : let first = 0 + : continue + : else + : throw "second" + : endif + : catch /.*/ + : echo v:exception + : break + : finally + : echo "cleanup" + : endtry + : echo "still in while" + :endwhile + :echo "end" + +上の例を実行すると "first", "cleanup", "second", "cleanup", "end" と表示される: +> + :function! Foo() + : try + : return 4711 + : finally + : echo "cleanup\n" + : endtry + : echo "Foo still active" + :endfunction + : + :echo Foo() "returned by Foo" + +上の例を実行すると "cleanup" と "4711 returned by Foo" が表示される。finally節 +に余計な ":return" を書く必要はない。(そうすると戻り値が上書きされてしまう) + + *except-from-finally* +finally節で ":continue", ":break", ":return", ":finish", ":throw" を使うことは +可能である。しかしそうするとtry条件文の後始末を破棄してしまうことになるので推 +奨されていない。しかし、当然、finally節の中で割り込みとエラー例外が発生するこ +とはありうる。 +finally節におけるエラーにより、割り込みが正しく動作しなくなる例: > + + :try + : try + : echo "Press CTRL-C for interrupt" + : while 1 + : endwhile + : finally + : unlet novar + : endtry + :catch /novar/ + :endtry + :echo "Script still running" + :sleep 1 + +失敗する可能性のあるコマンドをfinally節に書く必要があるときは、それらのコマン +ドにより発生するエラーを捕捉したり無視したりすることについて考えること。 +|catch-errors| と |ignore-errors| を参照。 + + +エラーを変更する *catch-errors* + +特定のエラーを捕捉するには、監視したいコードをtryブロックに入れ、そのエラー +メッセージに対するcatch節を加えるだけでよい。try条件節が存在すると全てのエラー +は例外に変換される。そのため、メッセージはまったく表示されず、|v:errmsg|は設定 +されない。":catch" コマンドに対する正しい正規表現を作るには、エラー例外のフォー +マットがどのようなものか知っていなければならない。 + エラー例外は次のフォーマットを持つ: > + + Vim({cmdname}):{errmsg} +または > + Vim:{errmsg} + +{cmdname}は失敗したコマンド名である。2番目の形式はコマンド名が不明のとき用いら +れる。{errmsg}は、そのエラーがtry条件文の外で発生したときに通常表示されるエラー +メッセージである。エラーメッセージは必ず大文字の "E" で始まり、その後に2,3桁の +エラー番号、コロン、スペースが続く。 + +例: + +次のコマンドを実行すると、 > + :unlet novar +通常次のエラーメッセージが表示される > + E108: No such variable: "novar" +これはtry条件文の中では例外に変換される > + Vim(unlet):E108: No such variable: "novar" + +次のコマンドを実行すると、 > + :dwim +通常次のエラーメッセージが表示される > + E492: Not an editor command: dwim +これはtry条件文の中では例外に変換される > + Vim:E492: Not an editor command: dwim + +":unlet" の全てのエラーを次によって捕捉できる > + :catch /^Vim(unlet):/ +また、全てのミススペルされたコマンドのエラーは次で捕捉できる > + :catch /^Vim:E492:/ + +複数のコマンドによって同一のエラーメッセージが表示される場合もある: > + :function nofunc +と > + :delfunction nofunc +は両方とも次のエラーメッセージを表示する。 > + E128: Function name must start with a capital: nofunc +これはtry条件節の中では例外に変換される。それぞれ > + Vim(function):E128: Function name must start with a capital: nofunc +または > + Vim(delfunction):E128: Function name must start with a capital: nofunc +となる。どのコマンドによって発生したかに関係なくこのエラーを捕捉するには、次の +正規表現を使う: > + :catch /^Vim(\a\+):E128:/ + +複数のエラーメッセージを表示するコマンドもある: > + :let x = novar +は次のエラーメッセージを表示する: > + E121: Undefined variable: novar + E15: Invalid expression: novar +最初のエラーメッセージのみが例外の値として使われる。それが最も限定的なメッセー +ジだからである(|except-several-errors|を参照)。これは次のようにして捕捉できる +> + :catch /^Vim(\a\+):E121:/ + +"nofunc" という名前に関係したエラー全てを捕捉するには > + :catch /\/ + +コマンド ":write" と ":read" による全てのVimエラーを捕捉するには > + :catch /^Vim(\(write\|read\)):E\d\+:/ + +全てのVimエラーを捕捉するには次の正規表現を使う > + :catch /^Vim\((\a\+)\)\=:E\d\+:/ +< + *catch-text* +NOTE: エラーメッセージの本文によって捕捉しようとしてはならない > + :catch /No such variable/ +こうすると英語の環境では動作するが、コマンド |:language|により他の言語を使って +いるユーザーの環境では動作しなくなる。しかし、コメントとしてメッセージテキスト +を引用することは役に立つ: > + :catch /^Vim(\a\+):E108:/ " No such variable + +エラーを無視する *ignore-errors* + +特定のコマンドで発生したエラーを捕捉すれば、エラーを無視することができる: > + + :try + : write + :catch + :endtry + +しかしこの単純な形は使わないよう強く推奨されている。なぜなら、これはあなたが望 +むより多くの例外を捕捉してしまうからである。":write" コマンドを使うと自動コマ +ンドが実行され、書き込みとは関係ないエラーが発生する可能性がある。例えば: > + + :au BufWritePre * unlet novar + +このようなエラーの中には、スクリプトの作者が責任を負わないものもある: つまり、 +スクリプトのユーザーがそのようなオートコマンドを定義している場合である。その +場合、上の例のようにすると、ユーザーからエラーを隠してしまうことになる。エラー +を無視するには、次のようにした方がよい > + + :try + : write + :catch /^Vim(write):/ + :endtry + +これは書き込みエラーだけを捕捉する。つまり、あなたが意図的に無視したいエラーだ +けである。 + +オートコマンドを発生させないような1つのコマンドに対しては、":silent!" を使えば +エラーを例外に変換すること自体を抑制させることができる: > + :silent! nunmap k +これはtry条件文が有効なときも機能する。 + + +割り込みを捕捉する *catch-interrupt* + +有効なtry条件文内では、割り込み(CTRL-C)は例外 "Vim:Interrupt" に変換される。こ +れを他の例外と同様に捕捉することができる。するとそのスクリプトは停止しない。 + 例: > + + :function! TASK1() + : sleep 10 + :endfunction + + :function! TASK2() + : sleep 20 + :endfunction + + :while 1 + : let command = input("Type a command: ") + : try + : if command == "" + : continue + : elseif command == "END" + : break + : elseif command == "TASK1" + : call TASK1() + : elseif command == "TASK2" + : call TASK2() + : else + : echo "\nIllegal command:" command + : continue + : endif + : catch /^Vim:Interrupt$/ + : echo "\nCommand interrupted" + : " 例外捕捉。次のプロンプトから継続する。 + : endtry + :endwhile + +ここでCTRL-Cを押すとタスクに割り込むことができる。その後スクリプトは新しいコマ +ンドを要求する。プロンプトでCTRL-Cを押すとスクリプトが終了する。 + +スクリプト中の特定の行でCTRL-Cが押されたとき何が起こるかをテストするにはデバッ +グモードを使い、その行の上で|>quit|や|>interrupt|コマンドを使う。 +|debug-scripts|を参照。 + + +全てを捕捉する *catch-all* + +次のコマンド > + + :catch /.*/ + :catch // + :catch + +は全てをエラー例外・割り込み例外・|:throw|コマンドにより明示的に投げられた例外 +の捕捉する。これは、スクリプトのトップレベルで、予期しないことを捕捉するために +役に立つ。 + 例: > + + :try + : + : " ここで難しいことをする + : + :catch /MyException/ + : + : " 既知の問題を制御する + : + :catch /^Vim:Interrupt$/ + : echo "Script interrupted" + :catch /.*/ + : echo "Internal error (" . v:exception . ")" + : echo " - occurred at " . v:throwpoint + :endtry + :" スクリプトの終わり + +Note: 全てを捕捉すると、期待していた以上のものを捕捉してしまうかもしれない。そ +れゆえ、":catch" コマンドの引数に正規表現を指定することにより、自分が本当に制 +御できる問題だけを捕捉することが強く推奨されている。 +全てを捕捉してしまうと、CTRL-C を押してスクリプトを中断することがほぼ不可能に +なってしまうことがある。その例: > + + :while 1 + : try + : sleep 1 + : catch + : endtry + :endwhile + + +例外とオートコマンド *except-autocmd* + +オートコマンドの実行中に例外を使うこともできる。例: > + + :autocmd User x try + :autocmd User x throw "Oops!" + :autocmd User x catch + :autocmd User x echo v:exception + :autocmd User x endtry + :autocmd User x throw "Arrgh!" + :autocmd User x echo "Should not be displayed" + : + :try + : doautocmd User x + :catch + : echo v:exception + :endtry + +上の例を実行すると "Oops!" と "Arrgh!" が表示される。 + + *except-autocmd-Pre* +いくつかのコマンドでは、それ自身が実行される前にオートコマンドが実行される。 +例外が発生し、それが一連のオートコマンドの中で捕捉されない場合、一連の自動コマ +ンドと、その引き金となったコマンドは破棄され、例外がそのコマンドを呼んだ位置へ +伝播する。 + 例: > + + :autocmd BufWritePre * throw "FAIL" + :autocmd BufWritePre * echo "Should not be displayed" + : + :try + : write + :catch + : echo "Caught:" v:exception "from" v:throwpoint + :endtry + +ここで ":write" コマンドは現在編集しているファイルを書き込まない ('modified' +を確認すればわかる)。BufWritePreのオートコマンドで発生した例外により、":write" +が破棄されたためである。そしてその例外は捕捉され、次を表示する: > + + Caught: FAIL from BufWrite Auto commands for "*" +< + *except-autocmd-Post* +いくつかのコマンドでは、それ自身が実行された後でオートコマンドが実行される。引 +き金となったコマンド自身が失敗して、それが有効なtry条件文の内側にあった場合、 +自動コマンドはスキップされ、エラー例外が発生する。その例外は、コマンドを呼んだ +位置で捕捉することができる。 + 例: > + + :autocmd BufWritePost * echo "File successfully written!" + : + :try + : write /i/m/p/o/s/s/i/b/l/e + :catch + : echo v:exception + :endtry + +この例は次を表示する: > + + Vim(write):E212: Can't open file for writing (/i/m/p/o/s/s/i/b/l/e) + +引き金となったコマンドが失敗したときでさえもオートコマンドを実行したいという場 +合は、catch節の中でそのイベントを引き起こすことできる。 + 例: > + + :autocmd BufWritePre * set noreadonly + :autocmd BufWritePost * set readonly + : + :try + : write /i/m/p/o/s/s/i/b/l/e + :catch + : doautocmd BufWritePost /i/m/p/o/s/s/i/b/l/e + :endtry +< +":silent!" を使うこともできる: > + + :let x = "ok" + :let v:errmsg = "" + :autocmd BufWritePost * if v:errmsg != "" + :autocmd BufWritePost * let x = "after fail" + :autocmd BufWritePost * endif + :try + : silent! write /i/m/p/o/s/s/i/b/l/e + :catch + :endtry + :echo x + +上の例は "after fail" を表示する。 + +引き金となったコマンドが失敗しなかった場合、オートコマンドから発生した例外は、 +元のコマンドを呼んだ位置から捕捉できる: > + + :autocmd BufWritePost * throw ":-(" + :autocmd BufWritePost * echo "Should not be displayed" + : + :try + : write + :catch + : echo v:exception + :endtry +< + *except-autocmd-Cmd* +いくつかのコマンドでは、通常の処理を一連のオートコマンドで置き換えることができ +る。そのコマンド列で発生した例外は元のコマンドの呼び出し位置で捕捉できる。 + 例: ":write" コマンドでは、例外が発生したとき、呼び出し側は実際にファイルが +書き込まれたのかどうかを知ることができない。これを教える必要があるときは、なん +らかの手段を使わねばならない。 > + + :if !exists("cnt") + : let cnt = 0 + : + : autocmd BufWriteCmd * if &modified + : autocmd BufWriteCmd * let cnt = cnt + 1 + : autocmd BufWriteCmd * if cnt % 3 == 2 + : autocmd BufWriteCmd * throw "BufWriteCmdError" + : autocmd BufWriteCmd * endif + : autocmd BufWriteCmd * write | set nomodified + : autocmd BufWriteCmd * if cnt % 3 == 0 + : autocmd BufWriteCmd * throw "BufWriteCmdError" + : autocmd BufWriteCmd * endif + : autocmd BufWriteCmd * echo "File successfully written!" + : autocmd BufWriteCmd * endif + :endif + : + :try + : write + :catch /^BufWriteCmdError$/ + : if &modified + : echo "Error on writing (file contents not changed)" + : else + : echo "Error after writing" + : endif + :catch /^Vim(write):/ + : echo "Error on writing" + :endtry + +バッファに変更を行った後でこのスクリプトを数回sourceすると、1回目は次のように +表示される > + File successfully written! +2回目は > + Error on writing (file contents not changed) +3回目は > + Error after writing +以下同様。 + + *except-autocmd-ill* +異なるイベントに対するオートコマンドにわたってtry条件文を展開することはできな +い。以下のコードは不正である: > + + :autocmd BufWritePre * try + : + :autocmd BufWritePost * catch + :autocmd BufWritePost * echo v:exception + :autocmd BufWritePost * endtry + : + :write + + +例外の階層と付加情報つき例外 *except-hier-param* + +プログラミング言語の中には例外クラスを階層化したり、例外クラスのオブジェクトに +付加的な情報を渡すことができるものがある。これと似たことをVimでもできる。 +階層構造を持った例外を投げるには、各部分をコロンで区切った完全なクラス名を投げ +ればよい。例えば、数学ライブラリ内でオーバーフローが発生したときに +"EXCEPT:MATHERR:OVERFLOW" を投げる。 +例外クラスに付加的な情報を与えたいときは、それを括弧の中に書く。例えば、 +"myfile" の書き込み中にエラーが発生したときに文字列 "EXCEPT:IO:WRITEERR(myfile)" +を投げる。 +":catch" コマンドにおいて適切な正規表現を使えば、階層の基底クラスや派生クラス +を捕捉できる。括弧の中の付加情報は、":substitute" コマンドを使って|v:exception| +から切り出すことができる。 +例: > + + :function! CheckRange(a, func) + : if a:a < 0 + : throw "EXCEPT:MATHERR:RANGE(" . a:func . ")" + : endif + :endfunction + : + :function! Add(a, b) + : call CheckRange(a:a, "Add") + : call CheckRange(a:b, "Add") + : let c = a:a + a:b + : if c < 0 + : throw "EXCEPT:MATHERR:OVERFLOW" + : endif + : return c + :endfunction + : + :function! Div(a, b) + : call CheckRange(a:a, "Div") + : call CheckRange(a:b, "Div") + : if (a:b == 0) + : throw "EXCEPT:MATHERR:ZERODIV" + : endif + : return a:a / a:b + :endfunction + : + :function! Write(file) + : try + : execute "write" fnameescape(a:file) + : catch /^Vim(write):/ + : throw "EXCEPT:IO(" . getcwd() . ", " . a:file . "):WRITEERR" + : endtry + :endfunction + : + :try + : + : " 計算やI/Oを行う + : + :catch /^EXCEPT:MATHERR:RANGE/ + : let function = substitute(v:exception, '.*(\(\a\+\)).*', '\1', "") + : echo "Range error in" function + : + :catch /^EXCEPT:MATHERR/ " catches OVERFLOW and ZERODIV + : echo "Math error" + : + :catch /^EXCEPT:IO/ + : let dir = substitute(v:exception, '.*(\(.\+\),\s*.\+).*', '\1', "") + : let file = substitute(v:exception, '.*(.\+,\s*\(.\+\)).*', '\1', "") + : if file !~ '^/' + : let file = dir . "/" . file + : endif + : echo 'I/O error for "' . file . '"' + : + :catch /^EXCEPT/ + : echo "Unspecified error" + : + :endtry + +エラー時やCTRL-Cを押したときにVim自身によって投げられる例外は平坦な階層になっ +ている: つまりこれらは全て "Vim" クラスに入っている。ユーザーは接頭辞 "Vim" を +つけた例外を投げることはできない。これらはVim用に予約されている。 +Vimのエラー例外は失敗したコマンドの名前(わかっているならば)という付加情報がつ +いている。|catch-errors|を参照。 + + +変わった特性 + *except-compat* +例外制御のコンセプトは、例外を引き起こしたコマンドは即座に異常終了し、制御が +finally節またはcatch節に移るという前提に基づいている。 + +Vim script言語では、エラーの後もスクリプトや関数が処理を続行する場合がある。 +"abort" フラグのない関数や、":silent!" をつけて実行されたコマンドでは、制御は +次の行、そして関数の外へ移り、制御フローは最外側の ":endwhile" や ":endif" の +次の行へ移る。一方、エラーは例外と同様に捕捉できるべきである (つまり、即座に異 +常終了することが要求される)。 + +この問題は、try条件文が有効なときだけエラーを例外に変換し、(":silent!" で抑制 +されていない限り)即座に異常終了することで解決される。(エラー)例外は有効なtry条 +件文でのみ捕捉可能であるため、これはなんら制約とはならない。エラーを捕捉せずに +即座に終了してほしいなら、単にcatch節を持たないtry条件文を使えばよい。(finally +節を指定すれば、終了の前に後始末処理を行うことができる) + +有効なtry条件文がないとき、即座の異常終了でなく、通常の異常終了と継続が行われ +る。これによってVim6.1以前用に書かれたスクリプトの互換性を保証している。 + +しかし、有効なtry条件文の中から、例外処理コマンドを使っていない既存のスクリプ +トをsourceする(またはその関数の1つを呼ぶ)と、エラー発生時に既存のスクリプトの +制御フローが変わるかもしれない。エラー発生時に即座に異常終了し、新しい方のスク +リプト内でエラーを捕捉できる。しかしsourceされたスクリプトが ":silent!" コマン +ドでエラーメッセージを抑制していた場合(それが適切なスクリプトなら|v:errmsg|を +見ることでエラーを確認している)、実行パスは変わらない。そのエラーは例外に変換 +されない(|:silent|を参照)。これが起こる残りのただ1つの原因は、エラーに関心を +払っていなく、エラーメッセージを表示させるスクリプトである。おそらく新しいスク +リプトからそのようなコードを使いたいとは思わないだろう。 + + *except-syntax-err* +例外処理コマンドにおける構文エラーは、それが属するtry条件文のどの ":catch" コ +マンドでも決して捕捉されない。しかしfinally節は実行される。 + 例: > + + :try + : try + : throw 4711 + : catch /\(/ + : echo "in catch with syntax error" + : catch + : echo "inner catch-all" + : finally + : echo "inner finally" + : endtry + :catch + : echo 'outer catch-all caught "' . v:exception . '"' + : finally + : echo "outer finally" + :endtry + +上の例を実行すると次が表示される: > + inner finally + outer catch-all caught "Vim(catch):E54: Unmatched \(" + outer finally +元の例外は破棄され、代わりにエラー例外が投げられる。 + +{訳注: throw 4711により例外が発生したが、その後の catch /\(/ に構文エラーがあ + るためエラー例外が発生し、最初の例外は破棄された。} + + *except-single-line* +コマンド ":try", ":catch", ":finally", ":endtry" は1行の中に書くことができる。 +しかし構文エラーがあったとき "catch" の行を認識するのが難しくなるので、避けた +方がよい。 + 例: > + :try | unlet! foo # | catch | endtry +この例は ":unlet!" の後に余計な文字があるためエラー例外を発生させる。そして +":catch" と ":endtry" が認識されないため、この例外は破棄され、"E488: Trailing +characters" のメッセージが表示される。 + + *except-several-errors* +1つのコマンドにより複数のエラーが発生した場合、普通は最初のエラーメッセージが +最も限定的であるため、それがエラー例外に変換される。 + 例: > + echo novar +は次を発生させる: > + E121: Undefined variable: novar + E15: Invalid expression: novar +try条件文の中のエラー例外の値は次になる: > + Vim(echo):E121: Undefined variable: novar +< *except-syntax-error* +しかし、同じコマンドにおいて通常のエラーの後に構文エラーが検出されたときは、構 +文エラーが例外として投げられる。 + 例: > + unlet novar # +これは次を発生させる: > + E108: No such variable: "novar" + E488: Trailing characters +try条件文の中のエラー例外の値は次になる: > + Vim(unlet):E488: Trailing characters +この理由は、構文エラーによってユーザーが予期していない実行パスになってしまうか +もしれないためである。例: > + try + try | unlet novar # | catch | echo v:exception | endtry + catch /.*/ + echo "outer catch:" v:exception + endtry +これは "outer catch: Vim(unlet):E488: Trailing characters" を表示し、次にエラー +メッセージ "E600: Missing :endtry" が表示される。|except-single-line|を参照。 + +============================================================================== +9. 例 *eval-examples* + +16進数で表示する ~ +> + :" 関数 Nr2Bin() は数値の2進文字列表現を返す。 + :func Nr2Bin(nr) + : let n = a:nr + : let r = "" + : while n + : let r = '01'[n % 2] . r + : let n = n / 2 + : endwhile + : return r + :endfunc + + :" 関数 String2Bin() は文字列中の各文字を2進文字列に変換して、ハイフン(-)で + :" 区切って返す。 + :func String2Bin(str) + : let out = '' + : for ix in range(strlen(a:str)) + : let out = out . '-' . Nr2Bin(char2nr(a:str[ix])) + : endfor + : return out[1:] + :endfunc + +使い方の例: > + :echo Nr2Bin(32) +結果: "100000" > + :echo String2Bin("32") +結果: "110011-110010" + + + +行をソート(並べ替え)する (by Robert Webb) ~ + +以下は、指定した比較関数を使って行をソートする例である。 > + + :func SortBuffer() + : let lines = getline(1, '$') + : call sort(lines, function("Strcmp")) + : call setline(1, lines) + :endfunction + +ワンライナーにすると次のようになる: > + :call setline(1, sort(getline(1, '$'), function("Strcmp"))) + +scanf() の代替 ~ + *sscanf* +Vimにはsscanf()に相当する関数が無い。行の一部を取り出す必要がある場合には、 +matchstr()やsubstitute()を使えば実現できる。以下の例は、"foobar.txt, 123, 45" +というような行から、ファイル名と行番号とカラム番号を取り出す方法を示している。 +> + :" 正規表現を設定 + :let mx='\(\f\+\),\s*\(\d\+\),\s*\(\d\+\)' + :" 正規表現全体にマッチする部分を取り出す + :let l = matchstr(line, mx) + :" マッチ結果から各要素を取り出す + :let file = substitute(l, mx, '\1', '') + :let lnum = substitute(l, mx, '\2', '') + :let col = substitute(l, mx, '\3', '') + +入力は変数 "line"、結果は "file" と "lnum" と "col" に格納される(このアイデア +はMichael Geddesによる)。 + + +辞書からscriptnamesを取り出す ~ + *scriptnames-dictionary* +コマンド|:scriptnames|により今までにsourceされた全てのスクリプトファイルのリス +トを取得することができる。これと等価な関数や変数は存在しない(めったに必要にな +らないからである)。そのような場合には次のコードが利用できる: > + " ":scriptnames" の出力を変数scriptnames_outputに入れる。 + let scriptnames_output = '' + redir => scriptnames_output + silent scriptnames + redir END + + " 出力を行のリストに分割し、各行をパースする。辞書 "scripts" に要素を追加 + " する。 + let scripts = {} + for line in split(scriptnames_output, "\n") + " 空行以外に対して実行 + if line =~ '\S' + " 行内の最初の番号を取得 + let nr = matchstr(line, '\d\+') + " ファイル名を取得。スクリプト番号" 123: "を削除。 + let name = substitute(line, '.\+:\s*', '', '') + " 辞書に要素を追加 + let scripts[nr] = name + endif + endfor + unlet scriptnames_output + +============================================================================== +10. +eval機能が無効 *no-eval-feature* + +コンパイル時に|+eval|機能が無効とされている場合、全ての式評価(eval)コマンドは +提供されない。その場合、Vim script が全ての種類のエラーを引き起こすことを避 +ける為、":if" と ":endif" は解釈される。":if" とそれに対応する ":endif" に挟ま +れた内容は無視される。":if" の後に続く引数も無視される。この ":if" コマンドは +ネスティングが可能である。しかし必ず行の先頭に書かれている必要がある。":else" +コマンドは認識されない。 + +|+eval|機能が存在しなかった場合、どのようにコマンドが実行を免れるかの例: > + + :if 1 + : echo "Expression evaluation is compiled in" + :else + : echo "You will _never_ see this message" + :endif + +============================================================================== +11. サンドボックス *eval-sandbox* *sandbox* *E48* + +オプション 'foldexpr', 'formatexpr', 'includeexpr', 'indentexpr', +'statusline', 'foldtext' はサンドボックスの中で評価される。これによって、悪質 +な副作用を持つ式からの保護がなされている。これによって、これらのオプションが +モードラインから設定された場合にある種の安全性がもたらされている。tagsファイル +からのコマンドが実行されたときとコマンドラインでのCTRL-R =に対してもサンドボッ +クスが使われる。 +コマンド|:sandbox|に対してもサンドボックスが使われる。 + +サンドボックス内では以下の事が禁止される: + - バッファの変更 + - マッピング、オートコマンド、関数、ユーザー定義コマンドの定義・変更 + - ある種のオプションの設定 (|option-summary|を参照) + - ある種のVim定義済変数(v:)の設定 (|v:var|を参照) *E794* + - シェルコマンドの実行 + - ファイルの読み書き + - 他のバッファへの移動・ファイルを開く + - Python, Perl等のコマンドの実行 +これは100%安全と保証するものではない。しかし、ある種の攻撃を防ぐ事はできるはず +である。 + + *:san* *:sandbox* +:san[dbox] {cmd} サンドボックス内で{cmd}を実行する。モードラインから設 + 定された可能性のあるオプションを評価するために使える。 + 例: 'foldexpr'. + + *sandbox-option* +いくつかのオプションは式を含んでいる。その式を評価するときはセキュリティ上の危 +険性を回避するためにサンドボックス内で行わねばならない。しかしサンドボックスに +は制限があるので、これはそのオプションが安全でない場所で設定されたときのみ行わ +れる。ここで「安全でない」とは次の場合をいう: +- カレントディレクトリの .vimrc や .exrc を source するとき +- サンドボックス内で実行している最中 +- モードラインから設定された値 + +Note サンドボックス内でオプションの値を退避し、それから復元した場合、そのオプ +ションはやはりサンドボックス内で設定されたものとマークされる。 + +============================================================================== +12. テキストロック *textlock* + +いくつか状況においては、バッファを変更する・他のウィンドウへジャンプするなど、 +Vimの現在の処理を混乱させたり破壊してしまうような動作は禁止される。これはVimが +実際に他の何かをしているときに起こることに対して当てはまる。例えば、 +'balloonexpr' の評価は、マウスカーソルがある位置に留まっているどんなときにでも +起こりうる。 + +テキストロックが有効になっているときは、以下の事が禁止される: + - バッファのテキスト変更 + - 他のバッファやウィンドウへの移動 + - 他のファイルを開く + - ウィンドウを閉じたりVimを終了したり + - その他 + +============================================================================== +13. テスト *testing* + +Vim はビルドした後、通常 "make test" を使ってテストできる。テストはディレクト +リ "src/testdir" にある。 + +時間の経過と共にいくつかのタイプのテストが追加された: + test33.in 最も古い、もう追加しない + test_something.in 古いスタイルのテスト + test_something.vim 新しいスタイルのテスト + + *new-style-testing* +新しいテストは新しいスタイルのテストで追加すべきである。これらは +|assert_equal()| などの関数を使用して、テストコマンドと期待される結果を1か所に +保持する。 + *old-style-testing* +場合によっては、古いスタイルのテストを使用する必要がある。例えば、|+eval| 機能 +なしでVimをテストするとき。 + +詳細は、src/testdir/README.txt ファイルを参照。 + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/farsi.jax b/plugins/vimdoc-ja/doc/farsi.jax new file mode 100644 index 0000000000..c0b9ea1512 --- /dev/null +++ b/plugins/vimdoc-ja/doc/farsi.jax @@ -0,0 +1,271 @@ +*farsi.txt* For Vim バージョン 8.0. Last change: 2015 Aug 29 + + + VIMリファレンスマニュアル by Mortaza Ghassab Shiran + +ペルシア語マッピングと右横書き *farsi* *Farsi* + +{Vi にはない機能です} + + *E27* +ペルシア語マッピングと右横書きを使うには、Vimをコンパイルするときに |+farsi| +を有効にする必要があります。 + +これらの機能は Mortaza G. Shiran によって作成されました。 + + +はじめに +-------- +右横書きのファイルでは、画面の右から左へ向かって文字が表示されます。そのような +ファイルはペルシア語のドキュメントを書いたり、ファックスを作成したり、ペルシア +語のメモ書きなどをするときにとても便利です。 + +コマンド、プロンプト、ヘルプファイルなどはペルシア語ではないため、ユーザーイン +ターフェイスは Vi 標準のインターフェイスと変わりません。 + + +特色 +----- +o 普通に Vim を使うように右横書きのファイルを編集できます。 + +o 右横書きウィンドウでファイルを表示したり編集したりします。書字方向はウィン + ドウ単位で設定できます。そのため、同じファイルを右横書きと左横書きの両方で + 同時に表示できます。 + +o 普通の Vim と互換性があります。ほとんどすべての機能は右横書きモードでも使え + ます。 (下記のバグを参照) + +o キーマップと逆挿入モード (|ins-reverse|) はコマンド 1 つで切り替えできま + す。 + +o 逆挿入モード (|ins-reverse|) から切り替わったときに、正常な位置にカーソルを + 移動します (それが可能な場合のみ)。 + +o ペルシア語モードでも、数字は左横書きで挿入されます。そして、数字以外の文字 + が入力されると、その文字は数字の左側に挿入されます。 + +o 特別な端末は必要ありません。右横書き機能はハードウェアにはまったく依存して + いません。必要なのはペルシア語フォントのみです。 + +o コマンドラインでも、ペルシア語キーマップを使って逆挿入モードで入力できます。 + +o 左横書きモードと右横書きモードは F8 キーで切り替えられます。 + +o ペルシア語の ISIR-3342 標準エンコーディングと Vim Farsi は F9 ファンクショ + ンキーで切り替えられます。これは、右横書きのテキストに対してのみ意味をなす + ので、右横書きモードでのみ利用できます。 + +ペルシア語フォント *farsi-fonts* +------------------ + +次のファイルは '$VIM/farsi/fonts' ディレクトリ以下にあります: + + + far-a01.pcf Linux や Unix システムの X Windows フォント + + far-a01.bf SunOS の X Windows フォント + + far-a01.f16 Linux や Unix システムのスクリーンフォント + + far-a01.fon Windows NT/95/98 の固定幅フォント + + far-a01.com DOS のスクリーンフォント + + +フォントのインストール +---------------------- + +o MS Windows (NT/95/98) にフォントをインストールする場合 + + 'コントロールパネル' から、'フォント' を選択します。'ファイル' メニューから + '新しいフォントのインストール...' を選択し、'far-a01.fon' を開きます。後は + インストールガイドに従ってください。 + NOTE: この方法でインストールできなかったという報告がいくつかありました。解 + 決方法は分かりません。 + +o X Window System にフォントをインストールする場合 (Unix/Linux) + + お使いのシステムに合わせて、far-a01.pcf.Z または far-a01.pcf.gz をインス + トールするディレクトリにコピーします。そのディレクトリに移動し、次のコマン + ドを実行します: + + > mkfontdir + > xset +fp path_name_of_farsi_fonts_directory + +o X Window System にフォントをインストールする場合 (SunOS) + + インストールするディレクトリに far-a01.bf をコピーします。そのディレクトリ + に移動し、次のコマンドを実行します: + + > fldfamily + > xset +fp path_name_of_fonts_directory + +o ASCII スクリーンフォントをインストールする場合 (Unix/Linux) + + Linux システムでは、far-01.f16 を /usr/lib/kbd/consolefonts にコピーし、 + "setfont far-a01.f16" と、フォント設定プログラムを実行します。他のシステム + (SCO Unix など) では、システム管理マニュアルのフォントインストールの項目を + 参照してください。 + +o ASCII スクリーンフォントをインストールする場合 (DOS) + + システム電源導入後、最初に Vim を起動する前に、フォントアップロードプログラ + ムの far-a01.com を実行して、ペルシア語フォントをアップロードします。 + + +使い方 +------ +Vim を起動する前に、ペルシア語モードが実行できるように環境を設定してください。 +ペルシア語フォントのインストールに加えて、いくつかのシステム環境では、キーコー +ドマッピング、ASCII スクリーンモードでのグラフィックカードのロード、IO ドライ +バの 8 ビット透過設定などを設定する必要があります。 + +o ペルシア語フォントを設定する + + + GUI では、'guifont' に far-a01 を設定します。Vim のコマンドラインで + ':set guifont=far-a01' と入力してください。 + + Vim を起動したときに自動的に設定されるようにするには、.vimrc ファイルに + ':set guifont=far-a01' と書き加えます。 + NT/95/98 プラットフォームでは .vimrc ではなく _vimrc です。 + + X Window System では、'-fn far-a01' オプションで Vim を起動することもで + きます。 + + + xterm で Vim を使う場合は、xterm をペルシア語フォントで起動します (例 + kterm -fn far-a01)。そして、kterm内で Vim を起動します。 + + + DOS で Vim を使う場合は、最初に Vim を起動する前に、フォントアップロード + プログラムの far-a01.com を実行して、ペルシア語フォントをアップロードし + ます。 + +o ペルシア語キーマップを有効にする + + ペルシア語キーマップを有効にするには、'altkeymap' または 'fkmap' を設定しま + す。それには、Vim のコマンドラインで ':set akm' または ':set fk' と入力して + ください。常にこの設定を使うには、':set akm' または ':set fk' を、.vimrc + ファイルに書き加えてください。NT/95/98 プラットフォームでは .vimrc ではな + く_vimrc です。 + + 初期設定では第 2 言語としてペルシア語キーマップが使われますが、これを切り替 + えるには、':set noakm' と入力して 'altkeymap' をオフに設定します。 + +o 右横書きのペルシア語モード + + 初期設定では、Vim は左横書きモードで起動します。ウィンドウの書字方向を変え + るには次の方法があります。 + + + -F オプションを使って Vim を起動する (例: vim -F ...)。 + + + F8 ファンクションキーを使って右横書きを左横書きを切り替える。 + + + 左横書きモードのときに、コマンドラインで 'set rl' と入力する ('rl' は + rightleft の省略形です)。 + + + 常に右横書きモードで Vim を起動するには、'set rl' を .vimrc ファイルに書 + き加えます。 + +エンコーディング +---------------- + +テキストのエンコーディングは ISIR-3342 を拡張したものです。Vim拡張ISIR-3342 +と 標準ISIR-3342 は、組み込み関数で変換できます。 + +文章の可搬性のため、どのプラットフォーム (UNIX、NT/95/98、MS DOS、...) でも同 +じエンコーディングが使われます。 + + +o キーボード + + + 挿入/置換モードでは、CTRL-_ でペルシア語 (akm) とラテン語を切り替えま + す。以下のように動作します。 + + + CTRL-_ で切り替えると、編集モードで入力したテキストの最後の位置へカーソ + ルが移動します。 + + + コマンドラインモードでは、CTRL-_ はペルシア語 (akm) とラテン語のキーマッ + プのみ切り替えます。ペルシア語のテキストは逆挿入モードで入力されます。 + + + F8 キーで左横書きと右横書きを切り替えられます。 + + + F9 キーで 標準ISIR-3342 と Vim拡張ISIR-3342 のエンコーディングを切り替 + えられます (右横書きモードでのみ機能します)。 + + + ペルシア語キーマップはイランの ISIRI-2901 標準がベースになっています。 + 次の表は、ペルシア語(akm) モードが設定されている場合のキーマップです: + + ------------------------------------- + ` 1 2 3 4 5 6 7 8 9 0 - = + ‍ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ ۰ - = + ------------------------------------- + ~ ! @ # $ % ^ & * ( ) _ + + ~ ! ٬ ٫ ﷼ ٪ × ، * ( ) ـ + + ------------------------------------- + q w e r t z u i o p [ ] + ض ص ث ق ف ظ ع ه خ ح ج چ + ------------------------------------- + Q W E R T Z U I O P { } + ْ ٌ ٍ ً ُ ك َ ّ ] [ { } + ------------------------------------- + a s d f g h j k l ; ' \ + ش س ی ب ل ا ت ن م ک گ \ + ------------------------------------- + A S D F G H J K L : " | + ؤ ئ ي إ أ آ ة » « : ؛ | + ------------------------------------- + < y x c v b n m , . / + < غ ط ز ر ذ د پ و . / + ------------------------------------- + > Y X C V B N M < > ? + > ِ ط ژ ر ‌ د ء < > ؟ + ------------------------------------- + +{訳注: 合成文字は表示のためにスペースと合成してあります。 + farsi->unicode変換がよくわからないので微妙に違うところがあると思います。 + http://www.farsiweb.info/table/2901-unicode.txt + http://www.farsiweb.info/table/3342.txt} + +Note: + ‌ はペルシア語の PSP を意味します (スペースなしの区切り) + + ‍ はペルシア語の PCN を意味します (ハムゼ(HANZE)属性のため) + +{訳注: PSP (pseudo space) + PCN (pseudo connection)} + +制限事項 +-------- + +o 挿入モードと置換モードで 'fkmap' (ペルシア語モード) がオンのとき、CTRL-B は + 使えません。 + +o ペルシア語とラテン語のキーマップを切り替えた場合、繰り返しバッファはリセッ + トされて空になります。つまり、同じモードにいる間だけ ('.' を使って) 最後の + 変更を繰り返せます。 + +o ペルシア語モードで数字を入力すると、繰り返しバッファはリセットされて空にな + ります。つまり、数字を入力した後は、 ('.' を使って) 最後の変更を繰り返せま + せん。 + +o 左横書きモードとペルシア語モードを使っているときは CTRL-R は使えません。 + +o 右横書きモードでは、'ラテン語' のパターンを検索できません。しかし、パターン + を逆向きに書けば検索できます。 + +o コマンドラインモードでは、数字を左横書きで入力することはできません。さら + に、使いやすくするために、キーマップのロジックは制限されています。 + +o X Window System 環境の端末エミュレータ xterm で Vim のペルシア語モードを使 + う場合、ANSI 互換の xterm を使う必要があります。これは、標準の xterm では、 + 文字番号が 128 より大きい文字は特別な意味を持ってしまうからです。 + + Note: X Window System 環境の GUI Vim では、ペルシア語モードはうまく機能しま + す。xterm などの他の端末エミュレータは必要ありません。 + + +バグ +----- +挿入モードか置換モードでペルシア語モードをオンにして、カーソルを移動するのと、 +文字を入力するのを何度か繰り返します。そしてアンドゥすると、カーソルを移動した +時点までしかアンドゥされません。しかし、何度もアンドゥすることで元のテキストま +で戻ることができます。現在行の変更をすべてアンドゥするために U を使うこともで +きます。 + +バグについては |rileft.txt| も参照してください。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/filetype.jax b/plugins/vimdoc-ja/doc/filetype.jax new file mode 100644 index 0000000000..de28a14deb --- /dev/null +++ b/plugins/vimdoc-ja/doc/filetype.jax @@ -0,0 +1,678 @@ +*filetype.txt* For Vim バージョン 8.0. Last change: 2017 Jan 04 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +ファイル形式 *filetype* *file-type* + +1. ファイル形式 |filetypes| +2. ファイル形式別プラグイン |filetype-plugins| +3. 標準で付属する形式別プラグインの解説 |ftplugin-docs| + +|autocmd.txt|も参照。 + +{Vi にはこれらのコマンドはない} + +============================================================================== +1. ファイル形式 *filetypes* *file-types* + +Vimは編集しているファイルの形式を検出することができる。これはファイル名をチェ +ックしたり、場合によってはファイル内に特定のテキストがあるかを調べることで実現 +されている。 + + *:filetype* *:filet* +ファイル形式の検出を有効化するには、vimrcファイルでこのコマンドを使用する: > + :filetype on +新しいファイルや既存のファイルを編集する際には必ず、Vimはファイルの形式を認識 +し 'filetype' オプションを設定しようと試みる。それが構文強調やオプションの設 +定、その他を行うために使われるFileTypeイベントのきっかけとなる。 + +NOTE: Vi互換とは全てのオプションがグローバルであることを意味するので、ファイル +形式識別と 'compatible' は同時に使うことはできない。既に 'compatible'を設定し +ている場合には、それを解除する必要がある。 + +詳細: ":filetype on" コマンドは次のファイルのうち1つをロードする。 + Amiga $VIMRUNTIME/filetype.vim + Mac $VIMRUNTIME:filetype.vim + MS-DOS $VIMRUNTIME\filetype.vim + RiscOS Vim:Filetype + Unix $VIMRUNTIME/filetype.vim + VMS $VIMRUNTIME/filetype.vim + このファイルはBufNewFileとBufReadイベントに対する自動実行コマンドを定 + 義するVim scriptファイルである。ファイル形式がファイル名から決定できな + い時には、ファイルの内容を検出するために$VIMRUNTIME/scripts.vimが使用 + される。 + GUIで使用しているとき、またはGUIを開始しようとしているときには、 + menu.vimも読み込まれる。これを避けるには |'go-M'| を参照。 + +独自のファイルタイプを追加するには、下の|new-filetype|を参照。あるファイルタイ +プについてのヘルプを検索するには、ファイルタイプ名の前に "ft-" をつけ、さらに +必要に応じて "-syntax", "-indent", "-plugin" をつける。例: > + :help ft-vim-indent + :help ft-vim-syntax + :help ft-man-plugin + +ファイル形式を自動的に検出できなかった場合や、間違った形式になってしまった場合 +には、'filetype' オプションを手動で設定するか、ファイルにモード行(modeline)を +追加する選択肢がある。例として、IDLファイルに設定するにはこのコマンドを使うか: +> + :set filetype=idl + +この|modeline|をファイルに追加する: + /* vim: set filetype=idl : */ ~ + + *:filetype-plugin-on* +ファイル形式別プラグインのロードを有効化するには: > + :filetype plugin on +まだファイル形式検出が有効になっていない時には、同時に有効化される。 +これは実際には 'runtimepath' にある "ftplugin.vim" をロードする。 +結果的にファイルが編集される時に対応するプラグインファイルがロードされる(ただ +し検出したファイル形式に合致するプラグインファイルがあった時のみ)。 +|filetype-plugin| + + *:filetype-plugin-off* +ファイル形式別プラグインを無効化するには: > + :filetype plugin off +ファイル形式の検出自体は無効にならない。しかしながらファイル形式の検出を無効に +した場合には、プラグインもロードされなくなる。 +これは実際には 'runtimepath' にある "ftplugof.vim" をロードする。 + + *:filetype-indent-on* +ファイル形式別インデントのロードを有効化するには: > + :filetype indent on +まだファイル形式検出が有効になっていない時には、同時に有効化される。 +これは実際には 'runtimepath' にある "indent.vim" をロードする。 +結果的にファイルが編集される時に対応するインデントファイルがロードされる(ただ +し検出したファイル形式に合致するインデントファイルがあった時のみ)。 +|filetype-plugin| + + *:filetype-indent-off* +ファイル形式別インデントを無効化するには: > + :filetype indent off +ファイル形式の検出自体は無効にならない。しかしながらファイル形式の検出を無効に +した場合には、インデントファイルもロードされなくなる。 +これは実際には 'runtimepath' にある "indoff.vim" をロードする。 +そうすると、これから開くファイルに対して自動インデントが無効になる。すでに開い +ているファイルに対しては何も変わらない。すでに開いているファイルに対して自動イ +ンデントを無効にするには 'autoindent', 'cindent', 'smartindent', 'indentexpr' +をオフにする。 + + *:filetype-off* +ファイル形式の検出を無効にするには、次のコマンドを使用する: > + :filetype off +これはプラグイン("plugin")とインデント("indent")のフラグを保持はするが、ファイ +ル形式は検出されなくなるので、次に ":filetype on" をするまではそれらは動作しな +くなる。 + + +概要: *:filetype-overview* + +コマンド 検出 プラグイン インデント ~ +:filetype on 有効 変化なし 変化なし +:filetype off 無効 変化なし 変化なし +:filetype plugin on 有効 有効 変化なし +:filetype plugin off 変化なし 無効 変化なし +:filetype indent on 有効 変化なし 有効 +:filetype indent off 変化なし 変化なし 無効 +:filetype plugin indent on 有効 有効 有効 +:filetype plugin indent off 変化なし 無効 無効 + +現在の状態を知るには次のようにタイプする: > + :filetype +このような出力が得られる: > + filetype detection:ON plugin:ON indent:OFF + +ファイル形式は構文強調にも利用される。":syntax on" コマンドが使用されると、ファ +イル形式検出もインストールされる。":syntax on" の後に ":filetype on" を実行す +る必要はない。 + +特定のファイル形式を無効にするには、自分のファイル形式ファイルに1行追加する。 +|remove-filetype|参照。 + + *filetype-detect* +再びファイル検出を有効化するには: > + :filetype detect +空のファイルから編集を始めて、ファイル形式を判定するのに充分なテキストをタイプ +してからコレを使用する。例えば、シェルスクリプトの中で "#!/bin/csh" を入力して +からということ。 + ファイル形式検出が無効になっていた時には、引数 "on" が指定された時のように、 +初めに有効化される。 + + *filetype-overrule* +同じ拡張子が2つのファイル形式で使用されている時には、Vimはファイルがどのような +種類であるかを推測する。これは常に動作するわけではない。ある拡張子に対してどの +ファイル形式を使うか明示的に指定するのに、幾つかのグローバル変数を使うことがで +きる: + + ファイル名 変数 ~ + *.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax| + *.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax| + *.asm g:asmsyntax |ft-asm-syntax| + *.prg g:filetype_prg + *.pl g:filetype_pl + *.inc g:filetype_inc + *.w g:filetype_w |ft-cweb-syntax| + *.i g:filetype_i |ft-progress-syntax| + *.p g:filetype_p |ft-pascal-syntax| + *.sh g:bash_is_sh |ft-sh-syntax| + *.tex g:tex_flavor |ft-tex-plugin| + + *filetype-ignore* +特定のファイルが検査されないようにするには、g:ft_ignore_pat 変数を使う。こ +の変数はデフォルトで次のように設定されている。 > + :let g:ft_ignroe_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$' +この設定は圧縮ファイルを検査しないようにしている。 + + *new-filetype* +使いたいファイル形式がVimに検出されない(存在しない)場合には、その形式を追加す +る4つの方法がある。どちらにせよファイル$VIMRUNTIME/filetype.vimは変更するべき +ではない。そのファイルは新しいVimをインストールする際に上書されるのだから。 + +A. デフォルトのファイルタイプの検査をくつがえす。 + この方法はファイルタイプごとにファイルを作ることで機能する。不便な点は + ファイルがたくさんになってしまうこと。便利な点は適切なディレクトリにファ + イルを置くだけで機能すること。 + *ftdetect* + 1. ユーザーランタイムディレクトリを作成する。通常は 'runtimepath' オプション + に記載される最初の項目を使えば良い。次にそのディレクトリに "ftdetect" と + いうディレクトリを作成する。UNIXを例に挙げる: > + :!mkdir ~/.vim + :!mkdir ~/.vim/ftdetect +< + 2. ファイル形式を検出する自動実行コマンドを含むファイルを作成する。 + 例: > + au BufRead,BufNewFile *.mine set filetype=mine +< Note "augroup" コマンドは要らない。そのファイルを読み込むときに既に定 + 義されている。パターンに "*" を使いファイルの内容から判断することもで + きる。 + そのファイルを例えば "mine.vim" という名前で先程の "ftdetect" ディレク + トリに保存する。UNIXを例に挙げる: > + :w ~/.vim/ftdetect/mine.vim +< + 3. 新しいファイル形式の検出を有効化するにはVimを再起動しなければならない。 + + "ftdetect" ディレクトリの中のファイルはデフォルトの検査のあとに使われるの + で、それ以前に決定したファイルタイプを変更することができる。しかしここで + |:setfiletype|を使えば、それ以前に決定したファイルタイプをそのままにしてお + くこともできる。 + +B. デフォルトのファイルタイプの検査の後にファイルタイプを決定する。 + + 上と同様。ただし、無条件に 'filetype' を設定する代わりに、':setfiletype' を + 使う。これはまだファイルタイプがまだ認識されていないときだけ 'filetype' を + 設定する。次に例を示す。 > + au BufRead,BufNewFile *.txt setfiletype text +< + すでに認識されたファイルタイプをコマンドから使うことができる。例えば、ファ + イルタイプが "pascal" だった時にファイルタイプを "mypascal" に設定するには: > + au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal + | endif + +C. ファイル形式が名前だけで検出できる場合。 + 1. ユーザーランタイムディレクトリを作成する。通常は 'runtimepath' オプション + に記載される最初の項目を使えば良い。UNIXを例に挙げる: > + :!mkdir ~/.vim +< + 2. ファイル形式を検出する自動実行コマンドを含むファイルを作成する。 + 例: > + " 独自の filetype ファイル + if exists("did_load_filetypes") + finish + endif + augroup filetypedetect + au! BufRead,BufNewFile *.mine setfiletype mine + au! BufRead,BufNewFile *.xyz setfiletype drawing + augroup END +< このファイルを "filetype.vim" としてユーザーランタイムディレクトリに保存 + する。UNIXを例にあげる: > + :w ~/.vim/filetype.vim +< + 3. 新しいファイル形式の検出を有効化するためにVimを再起動する。 + + 作成したfiletype.vimはデフォルトのFileType自動実行コマンドがインストールさ + れる前に読み込まれる。そのため新しく作成した自動実行コマンドが先に適合し、 + ":setfiletype" コマンドがこれ以後に他の自動実行コマンドにより 'filetype' が + 設定されないことを保証する。 + *new-filetype-scripts* +D. ファイル形式がファイルの内容を調べる事によってのみ検出可能な場合。 + + 1. ユーザーランタイムディレクトリを作成する。通常は 'runtimepath' オプション + に記載される最初の項目を使えば良い。UNIXを例に挙げる: > + :!mkdir ~/.vim +< + 2. ファイルの内容で形式を決定する Vim script を作成する。例: > + if did_filetype() " 既にファイル形式が決定している + finish " ..その時はこのチェックは行わない + endif + if getline(1) =~ '^#!.*\' + setfiletype mine + elseif getline(1) =~? '\' + setfiletype drawing + endif +< より多くの例については$VIMRUNTIME/scripts.vimを参照。 + このファイルを "scripts.vim" としてユーザーランタイムディレクトリに保存 + する。UNIXを例に挙げる: > + :w ~/.vim/scripts.vim +< + 3. これだけで検出は正しく動作し、Vimを再起動する必要は無い。 + + 新しく作成したscripts.vimはデフォルトのファイル形式チェックの前に読み込まれ + るので、$VIMRUNTIME/scripts.vimに書かれたデフォルトの判定規則を上書きするこ + とができる。 + + *remove-filetype* +ファイル形式が誤って検出されたならば、(上を参考に)それを補正するfiletype.vimか +scripts.vimをインストールする。'filetype' に存在しない形式の名前を設定すれば、 +それ以降の検出スクリプトで別の値が設定されてしまうのを避けることができる: > + :set filetype=ignored + +複数人で使用する環境を設定していて、個々のユーザーにはファイル形式を追加/削除 +させたくないならば、ランタイムディレクトリに置いて全ユーザーが共有するように +filetype.vimとscripts.vimを書く必要がある。そのスクリプトを置くディレクトリに +は 'runtimepath' の示すうちのどれか1つを選択する。'runtimepath' の中に設定を置 +きたいディレクトリが見あたらなければ、|system-vimrc|内で正しく追加する必要があ +る。既に設定されているデフォルトのディレクトリを変更しないように注意。 + + + *autocmd-osfiletypes* +NOTE: RISC OS サポートが削除されたため、このコードは現在無効化されている。将来 +これは 'filetype' オプションを使用することになるだろう。 + +ファイルと共に「形式」を記録できるオペレーティングシステム(OS)では、ファイルが +ある「形式」だった時にだけ実行される自動コマンドを設定することができる。 + +実際の「形式」チェックはVimをどのプラットフォームで使用しているかに依存する; +詳細は使用しているシステムの解説書を参照のこと。 + +OSによる「形式」を利用するには自動実行コマンドの検出パターンの場所に、次の例に +示すように折カッコで囲んだ検出させたい「形式」のリストを書く: > + + :au BufRead *.html,<&faf;HTML> runtime! syntax/html.vim + +これは以下に適合する: + +- ファイル名が ".html" で終了するあらゆるファイル +- 「形式」が "&faf" か "HTML" である全てのファイル。ただしここでいう「形式」と + はVimのバージョン(稼動しているOS)によって定義される。未知の形式は適合しない + とみなされる。 + +「形式」とパターンを同時に指定することもできる (そのような場合には、両方共マッ +チする必要がある): > + + :au BufRead <&fff>diff* + +これは「形式」が "&fff" で名前が "diff" で始まるファイルに適合する。 + + + *plugin-details* +"plugin" ディレクトリは 'runtimepath' オプションに示されているならば、どのディ +レクトリに置いても良い。そこに示された全てのディレクトリにあるプラグインが検索 +され読み込まれる。例えば、次のコマンドを実行すると: > + + set runtimepath + +次の内容が出力される: + + runtimepath=/etc/vim,~/.vim,/usr/local/share/vim/vim60 ~ + +この時Vimは以下に示すディレクトリとそれ以下にある全てのプラグインを読み込む: + + /etc/vim/plugin/ ~ + ~/.vim/plugin/ ~ + /usr/local/share/vim/vim60/plugin/ ~ + +最後の1つは$VIMRUNTIMEが展開されたものであることに注意。 + +プラグインが読み込まれていないらしい場合はどうすれば良いのか? Vim起動時に|-V| +引数を使用すれば何が起こっているか知ることができる: > + + vim -V2 + +多くのメッセージが表示されるが、プラグインの読み込みの前には特定の記述がなされ +る。それは次のように始まる: + + Searching for "plugin/**/*.vim" in ~ + +これを見ればVimがプラグインスクリプトをどこから探しているのかがわかる。 + +============================================================================== +2. ファイル形式別プラグイン *filetype-plugins* + +ファイル形式プラグインが有効になっていれば|:filetype-plugin-on|、プラグイン読 +込時にオプションが設定されキーマップが定義される。それらは全てバッファローカル +で、他のファイルに対しては決して作用しない。 + +ファイル形式により定義されるキーマップが自分で定義したキーマップの邪魔になるこ +ともあり得る。幾つかこれを回避する方法がある: +1. "maplocalleader" にキーマップの先頭に使用するキーシーケンスを設定する。例: > + :let maplocalleader = "," +< デフォルトのバックスラッシュ(\ 記号)に替えてコンマが全てのマップの始まりの + キーになる。||も参照。 + +2. 独自のマップを定義する。例: > + :map ,p MailQuote +< どのような機能が提供され、それにどのような文字列がキーマップされているの + か、プラグインファイルの説明をチェックする必要がある。 + 独自のキーマップはプラグインが読み込まれる (つまりその形式のファイルが読み + 込まれる) 前に定義する必要がある。そうすればプラグインはデフォルトキーマッ + ピングのインストールを行わない。 + +3. 特定のファイル形式についてキーマップを無効化するならば、そのファイル形式名 + を含むある変数を設定する。ファイル形式 "mail" のキーマップを無効にするには + 次のようにする: > + :let no_mail_maps = 1 + +4. ファイル形式による全てのキーマップを無効化するには次の変数を設定する: > + :let no_plugin_maps = 1 +< + + *ftplugin-overrule* +グローバルな($VIMRUNTIMEにある、システムが提供する)ファイル形式プラグインが +キッチリ望むように動作しない場合には、これを変更する方法が3通りある: + +1. 設定を追加する。 + 新しいファイル形式プラグインを作り、'runtimepath' の始めのほうに置く。一例 + として、UNIXではこのファイルを利用できる: > + vim ~/.vim/ftplugin/fortran.vim +< 追加したい設定やキーマップをこのファイルに記述する。グローバルプラグインは + これの後に読み込まれるので、ここで行った設定は上書される可能性がある。その + ような場合には以下の2つの方法のどちらかを利用する。 + +2. プラグインのコピーを作成し、そちらを変更する。 + 'runtimepath' の始めのほうにそのプラグインのコピーを置く。一例として、UNIX + ではこのように行う: > + cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim +< そうすればコピーしたファイルを好きなように変更できる。これは変数 + b:did_ftpluginが設定されていれば、グローバルプラグインは読み込まれない仕組 + みになっていることによる。 + この方法には、配布されるプラグインが改良された際に、再びコピーし同じように + 変更しなければならない、という短所がある。 + +3. グローバルプラグインの読み込み後に設定を上書きする。 + 'runtimepath' の最後に、新しいファイル形式プラグインを作成する。一例として、 + UNIXではこのファイルを利用できる: > + vim ~/.vim/after/ftplugin/fortran.vim +< このファイルの中では、変更したい設定だけを変更できる。 + +============================================================================== +3. 標準で付属する形式別プラグインの解説 *ftplugin-docs* + + +チェンジログ(CHANGELOG) *ft-changelog-plugin* + +{訳注: エントリ=日付ごとの区切り アイテム=日付内の項目} + +チェンジログファイルを簡単に扱うことを可能にする。いくつかの便利なコマンドや +マッピング、変数がある。 + +オプション: +'comments' フォーマットを崩さないように空に設定される。 +'textwidth' 標準的な値である78に設定される。 +'formatoptions' テキストを折り返すために 't' が加えられる。 + +コマンド: +NewChangelogEntry 適切にアイテムを追加する(以下参照)。 + +ローカルマッピング: +o 上と同様に適切にアイテムを追加する(以下参照)。 + +グローバルマッピング: + NOTE: グローバルマッピングはあらかじめ + ftplugin/changelog.vim を実行することで有効になる。 + 例えば > + runtime ftplugin/changelog.vim +< と |.vimrc| に書くようにして。 + {訳注: この例だと間違えてこのまま書いちゃいそう。} +o カレントディレクトリに "ChangeLog" というファイルがあ + れば開き、既に開かれていればバッファを切替える。そし + て上記のローカルマッピングoと同じように働 + く。 + +変数: +g:changelog_timeformat 非推奨。g:changelog_dateformatを使うこと。 +g:changelog_dateformat エントリに入れる日付(と時間)の書式。 + 使えるフォーマットは |strftime()| と同じ。 + デフォルトでは標準的に使われている "%Y-%m-%d" が設定 + されている。 +g:changelog_username ユーザーの名前とメールアドレス。 + デフォルトは環境変数とシステムファイルから推定され + る。まずカレントユーザーについての情報を得るために + /etc/passwd を探す。そこの最初の区切りにユーザーの実 + 名があることを期待している。次に環境変数の$NAMEを + チェックする。最後にアドレスを得るために`whoami`と + `hostname`を実行する。最終的に次のような値を決定す + る。 > + Full Name +< +g:changelog_new_date_format + エントリを作成するときの書式。 + 次の特別な文字が使える: + %% 一つの '%' が入る + %d 上記で定義した日付 + %u 上記で定義したユーザーの名前 + %p b:changelog_entry_prefix の結果 + %c 作成後のカーソルの位置 + デフォルトは "%d %u\n\n\t* %p%c\n\n"。これは次のよう + になる ( | はカーソルの位置を示している。しかし、行頭 + の | は行の始まりを表す) > + |2003-01-14 Full Name + | + | * prefix| +< +g:changelog_new_entry_format + アイテムを作成するときの書式。 + 次の特別な文字が使える: + %p b:changelog_entry_prefix の結果 + %c 作成後のカーソルの位置 + デフォルトは "\t*\c"。これは次のようになる > + | * prefix| +< +g:changelog_date_entry_search + 日付エントリを探すための検索パターン。 + g:changelog_new_date_formatと同じ特別な文字が使え + る。デフォルトは '^/\s*%d\_s*%u' で、次のような行 > + |2003-01-14 Full Name +< を見つける。 + +g:changelog_date_end_entry_search + 日付エントリの終端を探すための検索パターン。 + g:changelog_new_date_formatにおけるトークンと同じもの + が使用できる。デフォルトは '^\s*$' で、空白文字のみを + 含む行または完全な空行を検索する。 + +b:changelog_name *b:changelog_name* + チェンジログファイルの名前。 + 既定値は 'ChangeLog'。 + +b:changelog_path + カレントバッファに使うチェンジログのパス。 + 既定では空文字列で、カレントバッファと同じディレクトリ + から |b:changelog_name| という名前のファイルが検索され + る。それが見つからない場合は、カレントバッファの親 + ディレクトリを検索する。ファイルが見つかるか、それ以上 + 上がれなくなるまで、再帰的にこれが繰り返される。 + +b:changelog_entry_prefix + 新しいエントリのプリフィックスを生成するための関数の名 + 前を指定する。関数は引数を取らず、プリフィックスの文字 + 列を返す。関数は空文字を返しても構わない。 + デフォルトでは ChangeLog のパスとカレントバッファのパ + スの間の最短パスが使用される。 + 将来的には他の変数コンテキスト (例えば g:) でも指定で + きるようになる予定である。 + +チェンジログエントリは適切な位置に挿入される。現在の日付とユーザーを得た後 +に、その日付とユーザーのエントリをファイルから探し、見つかればその下にアイテ +ムを加える。なければ新しいエントリとアイテムをファイルの先頭に加える。 + + +フォートラン(FORTRAN) *ft-fortran-plugin* + +オプション: +'expandtab' .vimrcでfortran_have_tabsが指定されなければ、フォートラン標準 + に従ってタブ文字を避けるために有効にする。 +'textwidth' フォートラン標準に従って固定形式のソースでは72に、自由形式の + ソースでは80に設定される。 +'formatoptions' コードとコメントを分けて、長い行を保持するように設定される。 + これにより|gq|でコメントを整形できる。 +fortran_have_tabsについての議論とソース形式の判定法については +|ft-fortran-syntax|を参照。 + + +GIT COMMIT *ft-gitcommit-plugin* + +現在のコミットの差分をプレビューウィンドウに表示する :DiffGitCached というコマ +ンドが提供されている。このコマンドを実行すると、その引数をつけて "git diff +--cached" が実行される。 + + +メール(MAIL) *ft-mail-plugin* + +オプション: +'modeline' トロイの木馬の危険を避けるのと、「件名」に含まれる "Vim:" がエ + ラーメッセージの原因となる可能性を排除するために、モード行はオ + フになる。 +'textwidth' 72に設定する。e-mailでは良く推奨される値。 +'formatoptions' テキストを折返し、新しい行ではコメントリーダーを繰り返すように + 設定。引用記号の ">" が繰り返される。 + これにより|gq|で引用文を整形できる。 + +ローカルキーマップ: +q or \\MailQuote + ビジュアルモードでは選択されたテキストを、ノーマルモードではカーソルの + 位置からファイル末端までのテキストを引用する。これは全ての行に "> " が + 挿入されることを意味している。 + +MAN *ft-man-plugin* *:Man* *man.vim* + +マニュアルページを洗練された方法で表示する。ユーザーマニュアルの +|find-manpage|も参照のこと。 + +マニュアルページを読み込む前に ":Man" を利用するには、起動vimrcファイルでこの +スクリプトを読み込む必要がある: > + + runtime ftplugin/man.vim + +オプション: +'iskeyword' マニュアルページの名前の上でCTRL-]を使えるようにするために文字 + '.' が追加される。 + +コマンド: +Man {name} {name} についてのマニュアルページを表示する。 +Man {number} {name} + {number} セクションの {name} についてのマニュアルページを表示 + する。 + +グローバルキーマップ: +K カーソル下の単語についてのマニュアルページを表示する。 +ManPreGetPage 同上、マッピングを使うことを可能にする: > + nmap ManPreGetPage + +ローカルキーマップ: +CTRL-] カーソルの下の単語についてのマニュアルページへ移動する。 +CTRL-T 直前のマニュアルページへ戻る。 +q ":quit" と同じ + +水平の代わりに垂直分割を使用するには: > + let g:ft_man_open_mode = 'vert' +新しいタブを使うには: > + let g:ft_man_open_mode = 'tab' + +折畳を有効にするにはこの変数を使う: > + let g:ft_man_folding_enable = 1 +もしデフォルトの折畳が好みではないのなら、代わりに autocommand を使って望んだ +折畳スタイルを追加できる。例: > + autocmd FileType man setlocal foldmethod=indent foldenable + +'keywordprg' を設定して、|K| コマンドを Vim ウィンドウのマニュアルページにもで +きる: > + set keywordprg=:Man + + +MANPAGER *manpager.vim* + +:Man コマンドを使うと、Vim をマンページにできる(その構文はマンページをハイライ +ト表示し、CTRL-] でヒットしたリンク先のマンページをたどる)。 + +動作する環境: + + - Linux + - Mac OS + - FreeBSD + - Cygwin + - Win 10 under Bash + +未テスト: + + - Amiga OS + - BeOS + - OS/2 + +設定ファイル(.bashrc, .zshrc, ...)に bash, zsh, ksh, または dash を追加するには、 + + export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -" + +設定ファイルに (t)csh を追加するには、 + + setenv MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" + +設定ファイルに fish を追加するには、 + + set -x MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" + +もし man が Linux や Mac OS 上で最も一般的な実装である man-db のような $MAN_PN +環境変数を設定していれば、上の "env MAN_PN = 1" の部分は余計である。 + +PDF *ft-pdf-plugin* + +PDF ファイル内をジャンプするため、タグスタックをシミュレートする +という2つのマップが提供されている。次のものがタグとして扱われる: + +- "startxref" の後から xref テーブルまでのバイトオフセット +- トレイラー内の /Prev キーから前の xref テーブルへのバイトオフセット +- xref テーブル内の "0123456789 00000 n" という形式の行 +- PDF 内の任意の位置における "1 0 R" のようなオブジェクト参照 + +これらのマップは次のコマンドで無効化できる > + :let g:no_pdf_maps = 1 +< + +PYTHON *ft-python-plugin* *PEP8* + +デフォルトでは、PEP8 に従って以下のオプションが設定されている: > + + setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 + +この動作を無効にするには、あなたのvimrcに次の変数を設定する: > + + let g:python_recommended_style = 0 + + + +RPM SPEC *ft-spec-plugin* + +このプラグインに関する説明は非常に多いので、別のファイル |pi_spec.txt| に記述 +してある。 + +SQL *ft-sql* + +このプラグインについての解説は長くなるので、別のファイルに分割してある: +|ft_sql.txt| + + +TEX *ft-tex-plugin* *g:tex_flavor* + +*.tex ファイルの最初の行が次のような形なら > + %& +ファイルタイプは次のどれかになる: plaintex (プレーン TeX), context (ConTeXt), +tex (LaTeX)。そうでなければ context か tex かを決定するためにファイル内から +キーワードを検索する。もしキーワードが見つからなければ既定値として plaintex に +なる。この既定値は、変数 g:tex_flavor を定義すれば変更することができる。次のど +れかのようにする: > + let g:tex_flavor = "plain" + let g:tex_flavor = "context" + let g:tex_flavor = "latex" +現在のところこれ以外のフォーマットは識別されない。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/fold.jax b/plugins/vimdoc-ja/doc/fold.jax new file mode 100644 index 0000000000..7e1b8e9685 --- /dev/null +++ b/plugins/vimdoc-ja/doc/fold.jax @@ -0,0 +1,586 @@ +*fold.txt* For Vim バージョン 8.0. Last change: 2016 Jan 02 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +折畳(Folding) *Folding* *folding* *folds* + +ユーザーマニュアルの28章に折畳についての紹介がされている。|usr_28.txt| + +1. 折畳方法 |fold-methods| +2. 折畳コマンド |fold-commands| +3. 折畳オプション |fold-options| +4. 折畳の振舞 |fold-behavior| + +{Vi には折畳は無い} +{|+folding| 機能無しでコンパイルした場合には利用できない} + +============================================================================== +1. 折畳方法 *fold-methods* + +折畳を行う方法は 'foldmethod' オプションで設定できる。 + +'foldmethod' を "manual" 以外の値に設定すると、存在している折畳は全て削除され +新たな折畳が作成される。"manual" に切換えた時には既存の折畳は削除されない。こ +れを利用すればまず自動的に折畳を定義し、それから手動で変更することが可能であ +る。 + +折畳方法は6つの中から選択できる: + manual 手動で折畳を定義する + indent インデントの数を折畳のレベル(深さ)とする + expr 折畳を定義する式を指定する + syntax 構文強調により折畳を定義する + diff 変更されていないテキストを折畳対象とする + marker テキスト中の印で折畳を定義する + + +手動(MANUAL) *fold-manual* + +折畳領域を定義するためにコマンドを手動で利用する。これはテキスト中の折畳を行う +箇所をスクリプトにより解析するのに使うこともできる。 + +折畳のレベルは折畳の入れ子の深さとなる。ある行範囲の折畳レベルを増やすには、折 +畳がある同じ範囲に対して再び折畳を設定する。 + +手動折畳はファイルを放棄すると失われる。折畳を保存するには|:mkview|コマンドを +使用する。後に復元するには|:loadview|を使用する。 + + +インデント(INDENT) *fold-indent* + +折畳は各行のインデントにより自動的に定義される。 + +折畳レベルは各行のインデント量を、'shiftwidth' で割る(端数切捨て)ことで計算さ +れる。同じかより高い折畳レベルを持った一続きの範囲は1つの折畳を形成し、より高 +いレベルを持った範囲はその中で入れ子の折畳となる。 + +折畳の入れ子は 'foldnestmax' によって制限される。 + +ある行ではインデントを無視して直ぐ上か下の行のうち、低いほうの折畳レベルが使用 +される。無視されるのは完全な空行か、空白文字だけからなる行、および 'foldignore' +の文字で始まる行である。'foldignore' の文字の前に空白文字があっても無視される。 +Cではプリプロセッサー行を無視するために "#" を使用する。 + +他の方法で無視する行を定義するには、"expr" の方法を使用する。'foldexpr' の中 +で、ある行のインデントを取得するのに、関数|indent()|を使うことができる。 + + +式(EXPR) *fold-expr* + +折畳は "indent" 方式のように、折畳レベルによって自動的に定義される。'foldexpr' +オプションの値は、各行についてこの折畳レベルを計算するためにスクリプトとして実 +行される。例: +タブで始まる一連の行範囲を1つの折畳にまとめる: > + :set foldexpr=getline(v:lnum)[0]==\"\\t\" +折畳レベルを計算するのに Vim script の関数を呼び出す: > + :set foldexpr=MyFoldLevel(v:lnum) +空行で仕切られた「段落」を折畳とする: > + :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 +同じ事(「段落」を折畳に)をする別の表現: > + :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1 + +バックスラッシュ(日本では \ 記号)が ":set" の流儀で、通常とは異なるキャラクタ +(空白文字、バックスラッシュ、ダブルクォート、その他、詳細は|option-backslash| +参照)をエスケープしていることに注意。 + +式が評価される際の前提条件は以下の通り: +- その行について現在のバッファとウィンドウが常に存在している。 +- 変数 "v:lnum" には評価対象となる行番号が設定されている。 +- 式の結果(戻り値)は以下の形式で折畳レベルを示す: + 値 意味 ~ + 0 対象行は折畳に含まれない + 1, 2, .. 対象行はこのレベルの折畳に含まれる + -1 折畳レベルを未定義とし、対象行の直前か直後の行のうち低 + い方を、対象行のレベルとする。 + "=" 直前の行と同じレベルを使用する + "a1", "a2", .. 直前の行のレベルを+1, +2して、結果を現在の行に適用す + る。 + "s1", "s2", .. 直前の行のレベルを-1, -2して、結果を現在の行に適用す + る。 + "<1", "<2", .. 指定したレベルの折畳を対象行で終了する + ">1", ">2", .. 指定したレベルの折畳を対象行から開始する + +折畳は直前の行の折畳レベルより高い(低い)行から開始(終了)されるので、折畳の開始 +(終了)マーク ">1" ("<1") は明示的に指定する必要は無い。 + +式に副作用があってはならない。バッファ内のテキストや、カーソルの位置や、検索パ +ターン、オプションその他。どれひとつ変更してはならない。 +ただし、注意深く行えば、変更してもそれを復元しておけばよい。 + +式にエラーがあるか、結果が認識できない時には、何のエラーメッセージも表示せずに +折畳レベルは0に設定される。'debug' オプションに "msg" を設定すれば、エラーメッ +セージが表示されるようになるので、デバッグに利用できる。 + +NOTE: 各行について式評価が実行されるので、この折畳方式は非常に動作が遅くなる可 +能性がある! + +"=", "a", そして "s" は極力避けるようにする。なぜならVimはそれらが使われると、 +折畳レベルが定義された行が見つかるまで戻って、幾度も検索を行わなければならない +からだ。これは動作が遅くなることがある。 + +"a1" と "s1" の使用例: C 言語の複数行コメントを折りたたむ場合、"/*" を含む行で +は "a1" を返してその開始位置を、"*/" を含む行では "s1" を返してその終了位置を示 +す: > + if match(thisline, '/\*') >= 0 + return 'a1' + elseif match(thisline, '\*/') >= 0 + return 's1' + else + return '=' + endif +ただし、単一行コメント内、文字列リテラル内などではこれは正しく機能しない。 + +フォールドレベルを調べるには|foldlevel()|を使うのが便利である。レベルがわから +ないときは-1を返すことに注意すること。フォールドがその行で終わっているときには +行頭のレベルを返す。 + +折畳が適切に更新されない場合がある。その場合は |zx| か |zX| を使って強制的に更 +新すること。 + + +構文(SYNTAX) *fold-syntax* + +折畳が "fold" 引数を持つ構文要素によって定義される。 |:syn-fold| + +折畳レベルは入れ子によって定義される。入れ子の深さは 'foldnestmax' によって制 +限される。 + +シンタックスの同期の設定に注意すること。これが正しく設定されていないとフォール +ドが間違ったハイライトで表示される。これは特に複数行にマッチするシンタックスで +問題になる。そのようなときには次のような力技がある: > + :syn sync fromstart + + +差分(DIFF) *fold-diff* + +テキストの変更された箇所とその近辺以外が自動的に折畳として定義される。 + +この方法は現在のウィンドウに対して 'diff' オプションが設定されている時にだけ正 +しく働き、変更点が表示される。そうでない場合バッファ全体が1つの大きな折畳とな +る。 + +コンテキスト(の行数)を指定するのに 'diffopt' を使うことができる。これにより変 +更点の近辺の折畳に含まない行数を指定できる。下の例では8行表示するように設定し +ている: > + :set diffopt=filler,context:8 +省略した場合には6行が表示される。 + +'scrollbind' が設定されているとき、Vimは他のウィンドウと見た目が同じになるよう +にフォールドを開いた状態に保とうとする。 + +印(MARKER) *fold-marker* + +テキスト中の印により折畳の開始と終了地点を指定する。これにより明確に折畳を設定 +することができる。また誤った行を含むことなく、折畳を削除・設定できる。通常 +'foldtext' オプションは折畳の行に表示されるテキストとして、印の直前のテキスト +設定する。これにより折畳に名前を設定することが可能になる。 + +印には折畳レベルを含むことができ、また開始と終了で対になる文字を使うこともでき +る。必ずしも終了の印を加える必要はなく、また対がない印が無い場合の問題も避けら +れるので、レベルを含んだほうがより簡単である。例: > + /* グローバル変数 {{{1 */ + int varA, varB; + + /* 関数 {{{1 */ + /* funcA() {{{2 */ + void funcA() {} + + /* funcB() {{{2 */ + void funcB() {} + +折畳は印 "{{{" で開始する。印の後ろの番号は折畳レベルを示す。現在の折畳レベル +と異なるレベルが印によって与えられた時に何が起こるかは、そのレベルの差に依存す +る: +1. 同じ折畳レベルの印が与えられた時には、前の折畳は終了し同じレベルの新たな折 + 畳が開始する。 +2. 高い折畳レベルの印を見つけた時には、入れ子の折畳が開始する。 +3. 低い折畳レベルの印を見つけた時には、指定されたレベル以上の全部の折畳を終了 + し、指定されたレベルで新たな折畳が開始する。 + +番号は折畳レベルを示す。0を使うことはできない(レベル0の印は無視される)。特定の +レベルの折畳を終了させるため "}}}" 数字を付けて使うことができる。その印の直後 +の行の折畳レベルは示されたレベルよりも1つだけ低くなる。Vimは指定されたレベルに +マッチする印を検索はしないことに注意(計算に時間がかかりすぎてしまうので)。 +例: > + + {{{1 + ここからレベル1の折畳 + {{{3 + ここからレベル3の折畳 + }}}3 + ここからレベル2の折畳 + +折畳を定義するのに対になる "{{{" と "}}}" を使用することもできる。折畳レベルは +"{{{" 1つにつき1ずつ増加し、"}}}" 1つにつき1ずつ減少する。印同士の対応関係を維 +持するように気をつけること! 例: > + + {{{ + ここからレベル1の折畳 + {{{ + ここからレベル2の折畳 + }}} + ここからレベル1の折畳 + +番号付きの印と番号無しの印を混ぜて使用することもできる。大きな折畳には番号付き +の印を使用し、関数中の小さな折畳などには番号無しの印を使うと便利だろう。一例を +挙げれば、ファイルの "構造体定義" や "ローカル変数" それから "関数定義" のよう +な部分にはレベル1(番号付き)の折畳を使用する。そして一つ一つの定義や関数実装に +はレベル2の折畳を使用し、関数内部(例えばあるブロックなど)には番号無しの印を使 +用する。こうしておけば関数の中で折畳を分割するような変更を行う時に、印にレベル +を付け直す必要はなくなる。 + +印は 'foldmarker' オプションにより変更できる。Vimユーザー間でファイルを交換で +きるようにするためには、このオプションのデフォルトである "{{{,}}}" は変更しな +いことが推奨される。ファイルによってそれがどうしても必要な時(例えば別のエディ +タで作成した折畳を示す異なる印を含んでいる時や、ファイル内容の制約によりデフォ +ルトの印が問題を起こすため、それを使うことができない場合)にだけ変えるように。 + + *fold-create-marker* +印による折畳を作成するのに "zf" コマンドを使用することができる。Vimがユーザー +に代わって印を挿入する。Vimは 'foldmarker' で指定された開始の印と終了の印を追 +加する。印は行末に追加される。'commentstring' が空でなければそれが使用される。 +これは次のような時には正しく働かない: +- 既に番号付き折畳が含まれている。Vimはそれをどのように扱えば良いか知らない。 +- 番号付き折畳の近くで、それらの印が邪魔になる場合。 +- 行がコメントの中で、'commentstring' が空ではなく、かつ入れ子コメントを使用で + きない場合。例えばC言語: /* {{{ */ を既に存在するコメントを消さずにその中に + 追加するようなこと。コメントの直前か直後に印を設定するか、もしくは手動で印を + 追加する必要がある。 +一般的に、既に番号付き折畳が存在する場合には、Vimに印を作成させるのは良いアイ +デアではない。 + + *fold-delete-marker* +印による折畳を削除するのに "zd" コマンドを使用することができる。Vimがユーザー +に代わって印を削除する。Vimは 'foldmarker' で指定された開始の印と終了の印を検 +索する。印の周りにある 'commentstring' に適合するテキストは可能な限り削除され +る。 +これは次のような時には正しく働かない: +- ある行に印が1つ以上含まれていて、そのうち少なくとも1つがレベルを指定している + 場合。折畳を削除することで期待される効果どうりになるかどうかはチェックされる + ことなく、単に初めの折畳が1つ削除される。 +- 番号付き印で、複数の折畳を同時に開始したり終了するために使用されている場合。 + +============================================================================== +2. 折畳コマンド *fold-commands* *E490* + +全ての折畳コマンドは "z" で始まっている。ヒント: "z" は紙片を折った様子を横か +らみた姿に見える。 + + +折畳の作成と削除 ~ + *zf* *E350* +zf{motion} or +{Visual}zf 折畳を作成する操作。 + 'foldmethod' が "manual" か "marker" の時だけ動作する。 + "manual" の時には新しい折畳は閉じられる。 + 'foldenable' がセット(有効化)される。 + |fold-create-marker|も参照。 + + *zF* +zF [count]行を折畳として作成する。"zf" と同じように動作する。 + +:{range}fo[ld] *:fold* *:fo* + {range}で示された範囲を折畳にする。"zf" と同様に動作する。 + + *zd* *E351* +zd カーソルの位置にある折畳を1つ削除する。カーソルが折畳になって + いる行にある場合には、その折畳が削除される。入れ子になった折畳 + は1レベル分が削除される。ビジュアルモードでは選択された範囲の + 全ての折畳(partially)の1レベル分が削除される。 + 注意: これは期待したよりも余計に折畳を削除し易く、また手動折畳 + に対してはアンドゥもできないので注意が必要。 + 'foldmethod' が "manual" か "marker" の時だけ動作する。 + |fold-delete-marker|も参照。 + + *zD* +zD カーソルの位置の折畳を再帰的に削除する。ビジュアルモードでは、 + 選択された範囲内の入れ子も含め全ての折畳(partially)が削除され + る。 + 'foldmethod' が "manual" か "marker" の時だけ動作する。 + |fold-delete-marker|も参照。 + + *zE* *E352* +zE ウィンドウにある全ての折畳を削除する。 + 'foldmethod' が "manual" か "marker" の時だけ動作する。 + |fold-delete-marker|も参照。 + + +折畳を開く・閉じる ~ + +'foldminlines' よりも少ない行数の折畳は常に開いたように表示される。従って以下 +のコマンドは小さな折畳に関しては異なった働きを持つ。 + + *zo* +zo カーソルの下の折畳を一段階開く。カウントが与えられた場合には、 + 複数の深さの折畳が開かれる。ビジュアルモードでは、選択された範 + 囲にある全ての折畳が1レベル開かれる。 + + *zO* +zO カーソルの下の折畳を再帰的に全て開く。カーソルのある行を含まな + いフォールドは変更されない。 + ビジュアルモードでは、選択された範囲の全ての折畳が、部分的に選 + 択されていただけでも全て完全に開かれる。 + + *zc* +zc カーソルの下の折畳を一段階閉じる。カウントが与えられた場合に + は、複数の深さの折畳が閉じられる。ビジュアルモードでは、選択さ + れた範囲にある全ての折畳が1レベル閉じられる。 + 'foldenable' がセット(有効化)される。 + + *zC* +zC カーソルの下の折畳を再帰的に全て閉じる。カーソルのある行を含ま + ないフォールドは変更されない。 + ビジュアルモードでは、選択された範囲の全ての折畳が、部分的に選 + 択されていただけでも全て完全に閉じられる。'foldenable' がセッ + ト(有効化)される。 + + *za* +za 折畳が閉じていた場合: それを開く。折畳が入れ子になっている時に + は、"za" を何度も使う必要がある。カウントが与えられた場合には、 + 複数の閉じられた折畳が開かれる。 + 折畳が開いていた場合: それを閉じ 'foldenable' をセットする。繰 + り返し使っても閉じた折畳が開くだけだから、これは1レベル開くだ + けである。カウントが与えられた場合には、複数の折畳が閉じられる + (これは "za" を複数回繰り返した場合の動作と同じではない)。 + + *zA* +zA 折畳が閉じていた場合: 再帰的に開く。 + 折畳が開いていた場合: 再帰的に閉じ 'foldenable' をセットする。 + + *zv* +zv カーソル行を表示する: カーソルのある行がちょうど表示されるレベ + ルまで折畳を開く。 + + *zx* +zx 折畳を更新する: 手動で行った折畳の開閉操作をアンドゥする: + 'foldlevel' を再適用し、"zv" を行う: カーソル行を表示する。 + 折畳の計算を強制するのにも使える。これは 'foldexpr' を使ってい + てバッファが変更されたにも関わらず折畳が適切に更新されないよう + な場合に便利である。 + + *zX* +zX 手動で行った折畳の開閉操作をアンドゥする: 'foldlevel' を再適用 + する。 + 折畳の計算を強制するのにも使える (|zx| と同様)。 + + *zm* +zm 折畳をより閉じる: 'foldlevel' を |v:count1| 減少させる。 + 'foldlevel' が既に0ならば何も起こらない。 + 'foldenable' がセット(有効化)される。 + + *zM* +zM 全ての折畳を閉じる: 'foldlevel' に0を設定する。 + 'foldenable' がセット(有効化)される。 + + *zr* +zr 折畳をより開く: 'foldlevel' を |v:count1| 増加させる。 + + *zR* +zR 全ての折畳を開く: 'foldlevel' に最大の折畳レベルを設定する。 + + *:foldo* *:foldopen* +:{range}foldo[pen][!] + {range}の範囲の折畳を開く。[!]が付け加わると全ての折畳が開かれ + る。{range}範囲内の全てのテキストを見るのに役立つ。[!]が無い時 + は1レベル分の折畳が開かれる。 + + *:foldc* *:foldclose* +:{range}foldc[lose][!] + {range}の範囲の折畳を閉じる。[!]が付け加わると全ての折畳が閉じ + られる。{range}範囲内の全てのテキストを隠すのに役立つ。[!]が無 + い時は1レベル分の折畳が閉じられる。 + + *zn* +zn 折畳しない: 'foldenable' をリセットする。全ての折畳が開かれる。 + + *zN* +zN 折畳する: 'foldenable' をセットする。全ての折畳が 'foldenable' + がリセットされる以前と同様になる。 + + *zi* +zi 'foldenable' を反転する。 + + +折畳を超えて移動する ~ + *[z* +[z 現在の開いている折畳の先頭へ移動する。既に先頭にいるのならば、 + それを含む外側の折畳の先頭へ移動する。外側の折畳が無い場合は、 + コマンドは失敗する。 + カウントが与えられた場合には、[count]回繰り返される。 + + *]z* +]z 現在の開いている折畳の末尾へ移動する。既に末尾にいるのならば、 + それを含む外側の折畳の末尾へ移動する。外側の折畳が無い場合は、 + コマンドは失敗する。 + カウントが与えられた場合には、[count]回繰り返される。 + + *zj* +zj カーソルより下方の折畳へ移動する。閉じられた折畳が1つの折畳と + して数えられる。 + カウントが与えられた場合には、[count]回繰り返される。 + このコマンドは|operator|のように使うことができる。 + + *zk* +zk カーソルより上方の折畳へ移動する。閉じられた折畳が1つの折畳と + して数えられる。 + カウントが与えられた場合には、[count]回繰り返される。 + このコマンドは|operator|のように使うことができる。 + + +折畳に対してコマンドを実行する ~ + +:[range]foldd[oopen] {cmd} *:foldd* *:folddoopen* + 閉じた折畳の中以外の全ての行に対して{cmd}を実行する。[range]が + 与えられた時は、その範囲だけが対象となる。 + コマンドが各行に対して実行される時にはカーソルはその対象となる + 行に置かれている。 + これは ":global" コマンドのように動作する: まず閉じられた折畳 + に入っていない全ての行がマークされる。それからマークされた全て + の行に対して{cmd}が実行される。だから{cmd}が折畳に対して変更を + 加えても、コマンドの実行には影響が無い(もちろん行が消された時 + は除く)。 + 例: > + :folddoopen s/end/loop_end/ge +< "e" フラグには "end" がマッチしなかった時にエラーメッセージが + 表示させない効果がある。 + +:[range]folddoc[losed] {cmd} *:folddoc* *:folddoclosed* + 閉じた折畳の中にある全ての行に対して{cmd}を実行する。 + その他は ":folddoopen" と同じ。 + +============================================================================== +3. 折畳オプション *fold-options* + +色 *fold-colors* + +閉じられた折畳の色はFoldedグループによって設定される|hl-Folded|。折畳表示カラ +ムの色はFoldColumnグループによって設定される|hl-FoldColumn|。 +色の設定例: > + + :highlight Folded guibg=grey guifg=blue + :highlight FoldColumn guibg=darkgrey guifg=white + + +折畳レベル *fold-foldlevel* + +'foldlevel' は数を設定するオプションである: 大きな数を設定するとより多くの折畳 +が開かれる。 +'foldlevel' が0の時には、全ての折畳が閉じられる。 +'foldlevel' が正の時には、幾つかの折畳が閉じられる。 +'foldlevel' が非常に大きい時は、全ての折畳が開かれる。 +'foldlevel' は変更された時に適用される。その後に手動で折畳を開いたり閉じたりで +きる。 +値を増やした時には、新しいレベルの値以上の折畳が開かれる。手動で開かれていた折 +畳は閉じられない。 +値を減らした時には、新しいレベルの値以上の折畳が閉じられる。手動で閉じられてい +た折畳は開かれない。 + + +折畳テキスト *fold-foldtext* + +'foldtext' は式を指定する文字列オプションである。この式は閉じられた折畳を示す +テキストを得るために評価実行される。例: > + + :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g') + +これは折畳の最初の1行を、"/*" と "*/" を追加し "{{{" を削除して表示する。多め +のバックスラッシュ(\ 記号)はある文字が ":set" コマンドに解釈されてしまうのを避 +けるために使用されている。これは以下のように関数を定義するとより簡単になる: > + + :set foldtext=MyFoldText() + :function MyFoldText() + : let line = getline(v:foldstart) + : let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g') + : return v:folddashes . sub + :endfunction + +'foldtext' は|sandbox|環境下で実行評価される。現在のウィンドウはそのラインの属 +するウィンドウへ設定される。エラーは無視される。 + +省略値は|foldtext()|である。これはほとんどのタイプの折畳に対して妥当なテキスト +を返す。それが気に入らないのならば、独自の式を 'foldtext' に設定することができ +る。その式中では以下の特別なVim変数を使用することができる: + v:foldstart 折畳の先頭の行番号 + v:foldend 折畳の末尾の行番号 + v:folddashes 折畳レベルを表現したダッシュ(-)記号を含む文字列。 + v:foldlevel 折畳のレベル + +結果の文字列中のタブ文字は1つの空白文字に置き換えられ、表示不可能な文字は表示 +可能な文字に作り変えられる。 + +結果の文字列はウィンドウに合うように切り捨てられ、折り返されることはない。 +テキストの後ろに余白があれば、'fillchars' で指定された文字で充たされる。 + +":set" コマンドが解釈してしまう文字: 空白、バックスラッシュ (\ 記号) そしてダ +ブルクォートを使う場合にはバックスラッシュが必要である。 |option-backslash| + + +折畳表示カラム *fold-foldcolumn* + +'foldcolumn' は、ウィンドウの端に確保される折畳を示すカラムの幅を指定する数。0 +ならば、折畳表示カラムは確保されない。通常は4から5が一般的。使い物になる最小値 +は2であるが、1にしてもいくらかの情報を提供する。最大値は12。 + +折畳表示カラムには、開いた折畳の先頭に '-' が続いて '|' が表示される。このカラ +ムは開いた折畳が終了した位置で終了する。入れ子になった折畳では、それを含む折畳 +の1つ左側に表示される。 + +閉じた折畳は '+' で表示される。 + +全ての折畳を表示できないほど折畳表示カラムが狭いときには、入れ子のレベルが数字 +で表示される。 + +折畳表示カラムをクリックすることで、マウスにより折畳を開閉することができる: +- 閉じた折畳を開くにはその行の '+' をクリックする。 +- 開いた折畳を閉じるにはそれ以外の非空白文字をクリックする。 + + +その他のオプション + +'foldenable' 'fen': 無効に設定すると全ての折畳が開く。 +'foldexpr' 'fde': 式("expr')による折畳で使用される。 +'foldignore' 'fdi': インデントによる折畳で使用される。 +'foldmarker' 'fmr': 印による折畳で使用される印を定義する。 +'foldmethod' 'fdm': 現在の折畳方法の名称。 +'foldminlines' 'fml': 閉じた状態で表示されるべき折畳の、スクリーン上での最小 + 行数 +'foldnestmax' 'fdn': インデント及び構文折畳での最大入れ子数 +'foldopen' 'fdo': 閉じている折畳を開くコマンドの種類 +'foldclose' 'fcl': カーソルの下ではない折畳をいつ閉じるか。 + +============================================================================== +4. 折畳の振舞 *fold-behavior* + +カーソルを上下に移動させたりスクロールさせると、カーソルは一連の折畳行の先頭へ +移動する。カーソルが既に折畳の行にあれば、カーソルは次の折畳ではない行か、閉じ +られた折畳へ移動する。 + +折畳の行にカーソルがある時には、カーソルは常に先頭のカラムに表示される。ルー +ラーは実際のカーソルの位置を示すが、行が折畳の場合には、そこに実際に表示するこ +とはできない。 + +移動コマンドは一連の折畳を空行として扱う。例えば、"w" コマンドは一旦先頭のカラ +ムで停止する。 + +挿入モードでは、カーソルのある行は決して折畳にならない。このため何を入力してい +るかわからなくなることはない! + +オペレータを使用したときには、閉じた折畳は全体が含まれる。だから "dl" はカーソ +ルの下の閉じた折畳の全体を削除してしまう。 + +バッファの行に作用するExコマンドの作用範囲は、開始位置と終了位置ともに閉じられ +た折畳のそれらへ、それぞれ補正される。よって以下のコマンドを: > + :s/foo/bar/g +閉じた折畳へカーソルを合わせて実行すると、折畳内の全ての行にある "foo" が +"bar"へ置き換えられてしまう。 +これは|:folddoopen|と|:folddoclosed|に対してはあてはまらない。 + +(同一セッション中で)以前に編集したバッファに対しては、最後の折畳設定が再び使用 +される。手動折畳では以前に定義された折畳が復元される。全ての折畳方法で、手動で +開閉した折畳は復元される。同じウィンドウで同じバッファが編集される時は、以前の +編集時の値が使用される。そうでなければそのウィンドウで最後に編集されていたバッ +ファの値が使用される。 + +============================================================================== + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/ft_ada.jax b/plugins/vimdoc-ja/doc/ft_ada.jax new file mode 100644 index 0000000000..8e62cd1f7e --- /dev/null +++ b/plugins/vimdoc-ja/doc/ft_ada.jax @@ -0,0 +1,506 @@ +*ft_ada.txt* For Vim バージョン 8.0. Last change: 2010 Jul 20 + + + ADAファイルタイププラグイン リファレンスマニュアル~ + +ADA *ada.vim* + +1. 構文強調 |ft-ada-syntax| +2. ファイルタイププラグイン |ft-ada-plugin| +3. オムニ補完 |ft-ada-omni| + 3.1 "gnat xref" を使ったオムニ補完 |gnat-xref| + 3.2 "ctags" を使ったオムニ補完 |ada-ctags| +4. コンパイラへの対応 |ada-compiler| + 4.1 GNAT |compiler-gnat| + 4.2 Dec Ada |compiler-decada| +5. リファレンス |ada-reference| + 5.1 オプション |ft-ada-options| + 5.2 コマンド |ft-ada-commands| + 5.3 変数 |ft-ada-variables| + 5.4 定数 |ft-ada-constants| + 5.5 関数 |ft-ada-functions| +6. その他のプラグイン |ada-extra-plugins| + +============================================================================== +1. 構文強調 ~ + + *ft-ada-syntax* + +このモードはオブジェクト指向プログラムや型保護等の機能がサポートされた、Adaの +2005年版("Ada 2005")を想定して作られている。Ada 2005で追加されたキーワードを使 +用しているコード(そのようなコードは修正をすべき)は誤った強調色で表示してしまう +ものの、オリジナルのAda言語("Ada83", "Ada87", "Ada95")で書かれたコードも概ね取 +り扱うことができる。Adaについての詳細はhttp://www.adapower.com/を参照。 + +Adaモードは多くの状況をきれいに取り扱う。 + +例えば、"-5" のなかの "-" は数字の一部として認識するが、"A-5" という表記の中の +同じ文字は演算子として認識される。通常、他のコンパイルユニットを参照する +"with" や "use" 節は、Cにおける "#include" と同じ強調色で表示される。 +"Conditional" や "Repeat" グループを異なる強調色に設定すれば、"end if" と +"end loop" はそれぞれのグループの強調色で表示される。 + +これらにはコマンド "highlight" を使って異なる強調色を設定することができる。 +(例: ループの色を変えるには ":hi Repeat" に続けて強調色指定を続ける; 単純な端 +末上ではctermfg=Whiteと指定すると見やすいことが多い) + +Adaモードではユーザーが設定できるオプションがいくつか存在する。その完全なリス +トは|ft-ada-options|を参照。 + +それらを有効化するには、オプションに値を設定する。 +あるオプションを有効化する例: +> + let ada_standard_types = 1 +> +無効化するには ":unlet" を使用する。例: > + unlet ada_standard_types = 1 + +Adaファイルを読込む前に、コマンドラインで ":" とこれらのコマンドをキー入力する +ことで、設定することができる。ファイル "~/.vimrc" に、コロン (":") を除いて +"let" コマンドを追加すれば、これらのオプション設定を永続化することができる。 + +このモードは遅いコンピュータ(90MHz)上でも高速に動作するが、もしもパフォーマン +スが受け入れられないほど低いようならば、|g:ada_withuse_ordinary|を有効化する。 + +|g:ada_folding|がセットされていると、構文による折り畳み命令(|fold-syntax|)が追 +加される。 + +============================================================================== +2. ファイルタイププラグイン ~ + *ft-ada-indent* *ft-ada-plugin* + +Adaプラグインは以下のことに対応している: + + - オートインデント (|indent.txt|) + - 入力補完 (|i_CTRL-N|) + - ユーザー定義補完 (|i_CTRL-X_CTRL-U|) + - タグ検索 (|tagsrch.txt|) + - Quick Fix (|quickfix.txt|) + - バックスペース制御 (|'backspace'|) + - コメント制御 (|'comments'|, |'commentstring'|) + +Adaファイルが開かれたときだけこのプラグインはAdaモード機能を有効化し、メニュー +やポップアップメニューにAda関連の項目を追加する。 + +============================================================================== +3. オムニ補完 ~ + *ft-ada-omni* + +Adaオムニ補完(|i_CTRL-X_CTRL-O|)は、"gnat xref -v" または "exuberant Ctags" +(http://ctags.sourceforge.net) によって作られたtagsデータベースを利用する。補 +完関数は、tagsファイルがどちらのツールを使って作られたのかを自動的に判定する。 + +------------------------------------------------------------------------------ +3.1 "gnat xref" を使ったオムニ補完 ~ + *gnat-xref* + +GNAT XREFはコンパイラの内部情報(aliファイル)を使ってtagsファイルを生成する。こ +れは100%正しいというアドバンテージと、深くネストした解析のオプションを持つ。し +かしそのコードはコンパイルが通らねばならず、生成器はとても遅く、生成されたtags +ファイルは各項目に対して基本的なCtags情報しか持たない。これではVimの高度なコー +ドブラウザープラグインに対しては十分ではない。 + +NOTE: "gnat xref -v" はとてもトリッキーで診断情報をほとんど出力しない。もし何 + も表示されなかったら、たいていパラメーターが間違っている。 + いくつか重要なtips: + +1) 最初にコードをコンパイルし、"-aO" オプションを使って.aliファイルの位置を示 + さねばならない。 +2) "gnat xref -v ../Include/adacl.ads" はうまく動かないので、代わりに "gnat + xref -v -aI../Include adacl.ads" を使うこと。 +3) "gnat xref -v -aI../Include *.ad?" はうまく動かないので、代わりに "cd + ../Include" と "gnat xref -v *.ad?" を使うこと。 +4) プロジェクトマネージャー対応は完全に壊れている。"gnat xref -Padacl.gpr" と + 試してみるのもいけない。 +5) タグファイルがソートされているとVimは高速に検索できるので、"sort --unique + --ignore-case --output=tags tags" とすること。 +6) タグファイルがソートされていることを示すために、1行目に "!_TAG_FILE_SORTED + 2 %sort ui" と入れるのを忘れないこと。 + +------------------------------------------------------------------------------ +3.2 "ctags" を使ったオムニ補完~ + *ada-ctags* + +Exuberant Ctagsは内蔵の多言語コードパーサーを使う。このパーサーはとても高速で、 +大量の付加情報を生成する(それゆえ "Exuberant Ctags" という名前がつけられている)。 +また、コンパイルが通らないファイルに対しても実行できる。 + +Exuberant Ctagsを利用するVimのツールはたくさんある。 + +まず最初に、Ada対応のパッチを適用したExuberant Ctagsをインストールしなければな +らない。これはGNU Adaプロジェクトから入手できる。 +(http://gnuada.sourceforge.net). + +Exuberant CtagsのAdaパーサーはかなり新しく、完全な対応は期待しないこと。 + +============================================================================== +4. コンパイラへの対応 ~ + *ada-compiler* + +Adaモードは複数のAdaコンパイラに対応していて、Adaソースを開くとき、 +|g:ada_default_compiler|で設定されているコンパイラセットを自動的に読み込む。 +このコンパイラプラグインは、実際のコンパイラプラグインと、サポート関数・変数の +セットに分かれている。これによって、ユーザーの開発環境用に特殊化したコンパイラ +プラグインを作ることが容易になっている。 + +------------------------------------------------------------------------------ +4.1 GNAT ~ + *compiler-gnat* + +GNATは現在入手可能な唯一の(ビールとスピーチ両方の意味で)フリーなAdaコンパイラ +である。ライセンス条項に違いのある複数のバージョンが用意されている。 + +GNATコンパイラプラグインはを押すとコンパイルを行い、その後即座に結果を表示 +する。プロジェクトファイルを設定することができる: + > + > call g:gnat.Set_Project_File ('my_project.gpr') + +プロジェクトファイルを設定すると、GPSと同じようにVimのセッション +(|views-sessions|)も作成される。これは開いているファイル・ウィンドウ位置などを +プロジェクトごとに記憶しておく。 + + *gnat_members* +GNAT オブジェクト ~ + + *g:gnat.Make()* +g:gnat.Make() + |g:gnat.Make_Command|を呼び出し、結果を|quickfix| ウィンドウに + 表示する。 + + *g:gnat.Pretty()* +g:gnat.Pretty() + |g:gnat.Pretty_Program|を呼び出す。 + + *g:gnat.Find()* +g:gnat.Find() + |g:gnat.Find_Program|を呼び出す。 + + *g:gnat.Tags()* +g:gnat.Tags() + |g:gnat.Tags_Command|を呼び出す。 + + *g:gnat.Set_Project_File()* +g:gnat.Set_Project_File([{file}]) + gnatプロジェクトファイルを設定し、関連付けられたセッションを読 + み込む。そのとき開かれていたプロジェクトは閉じられ、セッション + が書き出される。ファイル名なしで呼び出したときは、プロジェクト + ファイルを選択するためのファイル選択ダイアログが開く。空文字列 + を指定して呼び出したときは、そのプロジェクトを閉じ、関連付けら + れたセッションを閉じる。 + + *g:gnat.Project_File* +g:gnat.Project_File 文字列 + 現在のプロジェクトファイル。 + + *g:gnat.Make_Command* +g:gnat.Make_Command 文字列 + |g:gnat.Make()|に使われる外部プログラム (|'makeprg'|)。 + + *g:gnat.Pretty_Program* +g:gnat.Pretty_Program 文字列 + |g:gnat.Pretty()|に使われる外部プログラム + + *g:gnat.Find_Program* +g:gnat.Find_Program 文字列 + |g:gnat.Find()|に使われる外部プログラム + + *g:gnat.Tags_Command* +g:gnat.Tags_Command 文字列 + |g:gnat.Tags()|に使われる外部プログラム + + *g:gnat.Error_Format* +g:gnat.Error_Format 文字列 + エラーフォーマット (|'errorformat'|) + +------------------------------------------------------------------------------ +4.2 Dec Ada ~ + *compiler-hpada* *compiler-decada* + *compiler-vaxada* *compiler-compaqada* + +Dec Ada (歴代の名前は VAX Ada, Dec Ada, Compaq Ada, HP Ada)は相当古いAda 83の +コンパイラである。対応は基本的なものである: で現在のユニットをコンパイルす +る。 + +Dec Adaは引数としてファイル名でなくパッケージ名が渡されることを期待する。コン +パイラプラグインは普通のファイル名の慣習に対応しており、ファイル名をユニット名 +に変換する。区切り文字として '-' と '__' の両方に対応している。 + + *decada_members* +DEC ADA オブジェクト ~ + + *g:decada.Make()* +g:decada.Make() 関数 + |g:decada.Make_Command|を呼び出し、結果を|quickfix|ウィンドウ + に表示する。 + + *g:decada.Unit_Name()* +g:decada.Unit_Name() 関数 + 現在のファイルのユニット名を取得する。 + + *g:decada.Make_Command* +g:decada.Make_Command 文字列 + |g:decada.Make()| に使われる外部プログラム (|'makeprg'|). + + *g:decada.Error_Format* +g:decada.Error_Format| 文字列 + エラーフォーマット (|'errorformat'|). + +============================================================================== +5. リファレンス ~ + *ada-reference* + +------------------------------------------------------------------------------ +5.1 オプション ~ + *ft-ada-options* + + *g:ada_standard_types* +g:ada_standard_types 切替 (存在するなら真) + パッケージStandard内の型を強調する(例: "Float") + + *g:ada_space_errors* + *g:ada_no_trail_space_error* + *g:ada_no_tab_space_error* + *g:ada_all_tab_usage* +g:ada_space_errors 切替 (存在するなら真) + 余計な空白文字をエラーとして強調する。 + g:ada_no_trail_space_error + - ただし行末のスペースを無視する。 + g:ada_no_tab_space_error + - ただしスペースの後のタブを無視する。 + g:ada_all_tab_usage + - 全てのタブを強調する。 + + *g:ada_line_errors* +g:ada_line_errors 切替 (存在するなら真) + 長すぎる行を強調する。Note: このオプションはCPUに多大な負荷が + かかる。 + + *g:ada_rainbow_color* +g:ada_rainbow_color 切替 (存在するなら真) + '(' と ')' にレインボーカラーを使う。rainbow_parenthesisを使わ + ないとこれは意味がない。 + + *g:ada_folding* +g:ada_folding 集合 ('sigpft') + Adaのソースに折り畳みを使う。 + 's': 読み込み時に構文折り畳みを有効化する。 + 'p': パッケージを折り畳む + 'f': 関数と手続きを折り畳む + 't': 型を折り畳む + 'c': 条件文を折り畳む + 'g': 読み込み時にgnat整形折り畳みを有効化する。 + 'i': 孤立した 'is' を上の行といっしょに折り畳む + 'b': 孤立した 'begin' を上の行といっしょに折り畳む + 'p': 孤立した 'private' を上の行といっしょに折り畳む + 'x': 孤立した 'exception' を上の行といっしょに折り + 畳む + 'i': 読み込み時にインデント折り畳みを有効化する。 + + Note: 構文折り畳みは初期段階(使用に耐えない)であり、インデント + かgnat整形折り畳みが勧められている。 + + gnat整形折り畳みを使うときは、次の設定が勧められている: + -cl3 -M79 -c2 -c3 -c4 -A1 -A2 -A3 -A4 -A5 + + インデント折り畳みを使うときは、次の設定が勧められている: + shiftwidth=3 softtabstop=3 + + *g:ada_abbrev* +g:ada_abbrev 切替 (存在するなら真) + いくつかの短縮入力を追加する。この機能は様々な補完方法によりい + くぶん取って代わられている。 + + *g:ada_withuse_ordinary* +g:ada_withuse_ordinary 切替 (存在するなら真) + "with" と "use" を通常のキーワードとして表示する(これらが他の + コンパイルユニットへの参照として使われた場合には、特別に通常の + 強調として表示する)。 + + *g:ada_begin_preproc* +g:ada_begin_preproc 切替 (存在するなら真) + 全てのbegin-likeなキーワードをCのプリプロセッサー命令の色で強 + 調する。 + + *g:ada_omni_with_keywords* +g:ada_omni_with_keywords + オムニ補完(|compl-omni|)にキーワード、プラグマ、属性を追加する。 + Note: いつでも補完して、それからユーザー定義補完 + (|i_CTRL-X_CTRL-U|)をすることができる。 + + *g:ada_extended_tagging* +g:ada_extended_tagging 列挙 ('jump', 'list') + 拡張タグ機能を使う。2つのオプションがある + 'jump': ジャンプするのにtjumpを使う + 'list': QuickFixリストにタグを追加する + 普通のタグ機能は関数や演算子のオーバーロードに対応していない。 + これらの機能がCになく、タグ機能はもともとC用に開発されたためで + ある。 + + *g:ada_extended_completion* +g:ada_extended_completion + 補完(|i_CTRL-N|)に拡張補完を使う。このモードでは + '.' が識別子の一部となり、'Object.Method' や 'Package.Procedure' + の全体が補完される。 + + *g:ada_gnat_extensions* +g:ada_gnat_extensions 切替 (存在するなら真) + GNATの拡張に対応する。 + + *g:ada_with_gnat_project_files* +g:ada_with_gnat_project_files 切替 (存在するなら真) + gnatプロジェクトファイルのキーワードと属性を追加する。 + + *g:ada_default_compiler* +g:ada_default_compiler 文字列 + デフォルトのコンパイラを設定する。現在対応しているのは 'gnat' + と 'decada' である。 + +「存在するなら真」の変数は、その変数が定義されているときは真で、定義されていな +いときは偽となる。その変数がどんな値であろうとも、違いはない。 + +------------------------------------------------------------------------------ +5.2 コマンド ~ + *ft-ada-commands* + +:AdaRainbow *:AdaRainbow* + '(' と ')' に対するレインボーカラーモード(|g:ada_rainbow_color|) + をトグルする。 + +:AdaLines *:AdaLines* + 行エラー表示(|g:ada_line_errors|)をトグルする。 + +:AdaSpaces *:AdaSpaces* + スペースエラー表示(|g:ada_space_errors|)をトグルする。 + +:AdaTagDir *:AdaTagDir* + 現在のファイルのディレクトリに対してtagsファイルを作成する。 + +:AdaTagFile *:AdaTagFile* + 現在のファイルに対してtagsファイルを作成する。 + +:AdaTypes *:AdaTypes* + 標準型(|g:ada_standard_types|)の色をトグルする。 + +:GnatFind *:GnatFind* + |g:gnat.Find()|を呼び出す。 + +:GnatPretty *:GnatPretty* + |g:gnat.Pretty()|を呼び出す。 + +:GnatTags *:GnatTags* + |g:gnat.Tags()|を呼び出す。 + +------------------------------------------------------------------------------ +5.3 変数 ~ + *ft-ada-variables* + + *g:gnat* +g:gnat オブジェクト + GNATコンパイラを管理するコントロールオブジェクト。このオブジェ + クトは最初にAdaのソースコードが読み込まれたときに、 + |g:ada_default_compiler|が 'gnat' に設定されているならば作成さ + れる。詳しくは|gnat_members|を参照。 + + *g:decada* +g:decada オブジェクト + Dec Adaコンパイラを管理するコントロールオブジェクト。このオブ + ジェクトは最初にAdaのソースコードが読み込まれたときに、 + |g:ada_default_compiler|が 'decada' に設定されているならば作成 + される。詳しくは|decada_members|を参照。 + +------------------------------------------------------------------------------ +5.4 定数 ~ + *ft-ada-constants* + +全ての定数はロックされている。詳しくは|:lockvar|を参照。 + + *g:ada#WordRegex* +g:ada#WordRegex 文字列 + Adaの単語を検索する正規表現。 + + *g:ada#DotWordRegex* +g:ada#DotWordRegex 文字列 + ドットで区切られるAdaの単語を検索する正規表現。 + + *g:ada#Comment* +g:ada#Comment 文字列 + Adaのコメントを検索する正規表現。 + + *g:ada#Keywords* +g:ada#Keywords 辞書のリスト + キーワード、属性などのリスト。オムニ補完で用いられる形式。詳し + くは|complete-items|を参照。 + + *g:ada#Ctags_Kinds* +g:ada#Ctags_Kinds リストの辞書 + CtagsがAdaのタグを生成する際の、要素の種類の辞書。 + +------------------------------------------------------------------------------ +5.5 関数 ~ + *ft-ada-functions* + +ada#Word([{line}, {col}]) *ada#Word()* + カーソル下(または指定の行・桁)のAda要素のフルネームを返す。必 + 要に応じてスペース・改行は取り除かれる。 + +ada#List_Tag([{line}, {col}]) *ada#Listtags()* + カーソル下(または指定の行・桁)のAda要素の全ての出現位置を + QuickFixウィンドウ内にリストする。 + +ada#Jump_Tag ({ident}, {mode}) *ada#Jump_Tag()* + カーソル下(または指定の行・桁)のAda要素の全ての出現位置を + タグジャンプリスト内にリストする。引数{mode}は + 'tjump'、'stjump' のどちらかとする。 + +ada#Create_Tags ({option}) *ada#Create_Tags()* + Ctagsを使ってtagsファイルを作成する。引数{option}が 'file' な + ら現在のファイル、'dir' なら現在のファイルのディレクトリ、また + はファイル名とする。 + +gnat#Insert_Tags_Header() *gnat#Insert_Tags_Header()* + GNAT XREFの出力に欠けているタグファイルヘッダー(!_TAG_)の情報 + を現在のファイルに追加する。 + +ada#Switch_Syntax_Option ({option}) *ada#Switch_Syntax_Option()* + 強調のオプションをオン・オフにする。Adaのメニューに使われる。 + + *gnat#New()* +gnat#New () + 新しくgnatオブジェクトを作成する。詳しくは|g:gnat|を参照。 + + +============================================================================== +6. その他のプラグイン ~ + *ada-extra-plugins* + +以下の外部プラグインをインストールしてもよい。これらはAdaの編集に役に立ち、 +Adaモードの機能を向上させてくれる: + +backup.vim + http://www.vim.org/scripts/script.php?script_id=1537 + 可能なかぎりたくさんのバックアップを取ってくれ、自分自身でやる必要がな + くなる。 + +rainbow_parenthsis.vim + http://www.vim.org/scripts/script.php?script_id=1561 + Adaは '(' と ')' しか使わないのでとても助かる。 + +nerd_comments.vim + http://www.vim.org/scripts/script.php?script_id=1218 + ほとんど全てのプログラミング言語に対応するコメント化・アンコメント化 + +matchit.vim + http://www.vim.org/scripts/script.php?script_id=39 + ほとんどの言語に対応する '%' でのジャンプ。通常の '%' は '{}' 形式の言 + 語に対してだけ役に立つ。Adaモードはこれに必要な検索パターンを設定する。 + +taglist.vim + http://www.vim.org/scripts/script.php?script_id=273 + ソースコードエクスプローラーサイドバー。Adaで利用可能にするパッチがあ + る。 + +GNU Adaプロジェクトが配布するVimは以上を全て含んでいる。 + +============================================================================== +vim: textwidth=78 nowrap tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab +vim: filetype=help diff --git a/plugins/vimdoc-ja/doc/ft_sql.jax b/plugins/vimdoc-ja/doc/ft_sql.jax new file mode 100644 index 0000000000..2c415b3c67 --- /dev/null +++ b/plugins/vimdoc-ja/doc/ft_sql.jax @@ -0,0 +1,752 @@ +*ft_sql.txt* For Vim バージョン 8.0. Last change: 2013 May 15 + +by David Fishburn + +これは SQL ファイルを編集するためのファイルタイププラグインです。 + +Structured Query Language (SQL) はリレーショナルデータベースと対話するための文 +を規定した規格です。Vim には SQL 内を移動、インデント、構文ハイライトする機能 +が備わっています。 + +1. 移動 |sql-navigation| + 1.1 Matchit |sql-matchit| + 1.2 オブジェクト単位の移動 |sql-object-motions| + 1.3 SQL 独自のオブジェクト単位移動 |sql-predefined-objects| + 1.4 マクロ |sql-macros| +2. SQL の方言 |sql-dialects| + 2.1 SQLSetType |SQLSetType| + 2.2 SQLGetType |SQLGetType| + 2.3 SQL 方言の既定値 |sql-type-default| +3. SQL 方言を追加する |sql-adding-dialects| +4. SQL オムニ補完 |sql-completion| + 4.1 static モード |sql-completion-static| + 4.2 dynamic モード |sql-completion-dynamic| + 4.3 SQL 補完のチュートリアル |sql-completion-tutorial| + 4.3.1 テーブル補完 |sql-completion-tables| + 4.3.2 カラム補完 |sql-completion-columns| + 4.3.3 プロシージャ補完 |sql-completion-procedures| + 4.3.4 ビュー補完 |sql-completion-views| + 4.4 補完のカスタマイズ |sql-completion-customization| + 4.5 SQL 関連のマップ |sql-completion-maps| + 4.6 他のファイルタイプのファイル内で使うには|sql-completion-filetypes| + +============================================================================== +1. 移動 *sql-navigation* + +SQL ファイルタイププラグインはファイル内の移動を支援するためのオプションを多数 +備えています。 + + +1.1 Matchit *sql-matchit* +----------- +matchit プラグイン(http://www.vim.org/scripts/script.php?script_id=39)はたくさ +んの機能を備えており、異なる言語に対応するためにカスタマイズすることができます。 +matchit プラグインはローカル変数 b:match_words を定義することで設定します。様 +々なキーワードの上で % キーを押すと、それに対応する位置へカーソルを移動します。 +例えばカーソルが "if" の上にあるとき % を押すと "else", "elseif", "end if" の +間を循環して移動します。 + +以下のキーワードがサポートされています: > + if + elseif | elsif + else [if] + end if + + [while condition] loop + leave + break + continue + exit + end loop + + for + leave + break + continue + exit + end loop + + do + statements + doend + + case + when + when + default + end case + + merge + when not matched + when matched + + create[ or replace] procedure|function|event + returns + + +1.2 オブジェクト単位で移動 *sql-object-motions* +----------------------- +Vim には既定でテキストオブジェクトを操作するキーがたくさん定義されています +|object-motions|。このファイルタイププラグインはこれらのキーの一部を SQL 用に +再定義します。 + +SQL ファイルを編集するとき、以下のノーマルモード|Normal|とビジュアルモード +|Visual|のマップが定義されます: > + ]] 次の 'begin' へ移動する + [[ 前の 'begin' へ移動する + ][ 次の 'end' へ移動する + [] 前の 'end' へ移動する + + +1.3 SQL 独自のオブジェクト単位移動 *sql-predefined-objects* +----------------------------- +ほとんどのリレーショナルデータベースはテーブル、インデックス、トリガー、ストア +ドプロシージャなど様々な標準的な機能を備えています。また、ベンダーごとに様々な +独自オブジェクトがあります。次のマップたちはこれらのオブジェクト間を移動するた +めに作られています。お使いのデータベースによってオブジェクトのリストを調整でき +るようでなればなりません。このファイルタイププラグインは標準オブジェクトのほと +んどと、多くの追加的なオブジェクトを定義しています。これを可能な限りフレキシブ +ルにするために、|vimrc| でオブジェクトのリストを上書きできるようになっています。 +次のようにします: > + let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' . + \ ',schema,service,publication,database,datatype,domain' . + \ ',index,subscription,synchronization,view,variable' + +上記のリストを対象として、以下のノーマルモード|Normal|とビジュアルモード +|Visual|のマップが定義されています: > + ]} 次の 'create <オブジェクト名>' へ移動する + [{ 前の 'create <オブジェクト名>' へ移動する + +繰り返し ]} を押すとこれらの create 文の間を循環して移動します: > + create table t1 ( + ... + ); + + create procedure p1 + begin + ... + end; + + create index i1 on t1 (c1); + +g:ftplugin_sql_objects の既定値は以下の通りです: > + let g:ftplugin_sql_objects = 'function,procedure,event,' . + \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' . + \ 'table,trigger' . + \ ',schema,service,publication,database,datatype,domain' . + \ ',index,subscription,synchronization,view,variable' + +上記の設定は以下の場合にも対応しています: > + create table t1 ( + ... + ); + create existing table t2 ( + ... + ); + create global temporary table t3 ( + ... + ); + +既定では CREATE 文だけを検索します。|vimrc| に以下を書くと、他の文も対象にする +ことができます: > + let g:ftplugin_sql_statements = 'create,alter' + +このファイルタイププラグインは以下の3種類のコメントを定義しています: > + 1. -- + 2. // + 3. /* + * + */ + +コメントを対象として、以下のノーマルモード|Normal|とビジュアルモード|Visual|で +のマップが定義されています: > + ]" 次のコメントの開始位置へ移動 + [" 前のコメントの終了位置へ移動 + + + +1.4 マクロ *sql-macros* +---------- +|'define'| に以下の正規表現を設定することにより、マクロ定義を見つけるための +Vim の機能に対応しています: > + \c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\> + +この正規表現は以下のようなコードに対応しています: > + CREATE VARIABLE myVar1 INTEGER; + + CREATE PROCEDURE sp_test( + IN myVar2 INTEGER, + OUT myVar3 CHAR(30), + INOUT myVar4 NUMERIC(20,0) + ) + BEGIN + DECLARE myVar5 INTEGER; + + SELECT c1, c2, c3 + INTO myVar2, myVar3, myVar4 + FROM T1 + WHERE c4 = myVar1; + END; + +以下の行の "myVar1" の上にカーソルを置いて、: > + WHERE c4 = myVar1; + ^ + +以下のキーのどれかを押してみてください: > + [d + [D + [CTRL-D + + +============================================================================== +2. SQL の方言 *sql-dialects* *sql-types* + *sybase* *TSQL* *Transact-SQL* + *sqlanywhere* + *oracle* *plsql* *sqlj* + *sqlserver* + *mysql* *postgresql* *psql* + *informix* + +すべてのリレーショナルデータベースは SQL に対応しています。SQL の一部分はベン +ダー間で移植可能です(例: CREATE TABLE, CREATE INDEX)が、ベンダー固有の拡張が大 +量にあります。Oracle は "CREATE OR REPLACE" 構文、CREATE TABLE 文でのカラム既 +定値の指定、プロシージャ言語(ストアドプロシージャとトリガー)を備えています。 + +標準の Vim ディストリビューションには Oracle の PL/SQL に基づいた構文ハイライ +トが付属しています。SQL インデントスクリプトは Oracle と SQL Anywhere 用に動作 +します。ファイルタイププラグインはすべてのベンダー用に動作し、ベンダー中立を保 +ちつつも拡張可能であるべきです。 + +現在様々なベンダーに対応しています。これは構文スクリプトを通して実現しています。 +残念なことに、複数の構文ルールを切り替えるには以下のどれかを作成しなければなり +ません: + 1. 新しいファイルタイプ + 2. 独自のオートコマンド + 3. コマンド手動実行 + +大多数の人は1つのベンダーのデータベース製品しか扱わないため、|vimrc| で既定値 +を設定しておくとよいでしょう。 + + +2.1 SQLSetType *sqlsettype* *SQLSetType* +-------------- +複数のデータベースを扱っている人々にとっては、バッファごとまたは任意のタイミン +グでベンダーのルール(インデント、構文)を切り替えられるとよいでしょう。 +ftplugin/sql.vim では次のコマンドが定義されています: > + SQLSetType + +このコマンドを引数なしで実行すると、インデントと構文スクリプトが既定値に戻りま +す。既定値は |sql-type-default| を参照してください。Vi 互換モードをオフにして +いると (|'compatible'|)、 キーで引数を補完できます。 + +コマンド名とスペースをタイプした後、引数を指定するために補完を利用できます。こ +のコマンドは source したい Vim scriptの名前を受け取ります。 +|cmdline-completion| 機能により、SQLSetType コマンドは |'runtimepath'| から +名前に 'sql' を含む Vim script を検索します。これは名前のスペルから推測を取り +出します。以下が例です: > + :SQLSetType + :SQLSetType sqloracle + :SQLSetType sqlanywhere + :SQLSetType sqlinformix + :SQLSetType mysql + +もっとも簡単な方法は、 を使ってまずコマンド名(SQLSetType)を補完し、スペー +スに続いてもう一度 を押すと利用可能な Vim script の名前のリストが表示さ +れます: > + :SQL + + +2.2 SQLGetType *sqlgettype* *SQLGetType* +-------------- +現在、どのSQL の方言が使われているかを調べるには、コマンド SQLGetType を使い +ます。ftplugin/sql.vim で次のコマンドが定義されています: > + SQLGetType + +このコマンドを使うと、以下のような文字列がエコー表示されます: > + Current SQL dialect in use:sqlanywhere + + +2.3 SQL 方言の既定値 *sql-type-default* +----------------------- +すでに述べたように、Vim の既定の構文ルールは Oracle (PL/SQL) に基づいています。 +これを上書きするには、次のうちどれかを |vimrc| に書きます: > + let g:sql_type_default = 'sqlanywhere' + let g:sql_type_default = 'sqlinformix' + let g:sql_type_default = 'mysql' + +次を |vimrc| に書くと: > + let g:sql_type_default = 'sqlinformix' + +次回 SQL ファイルを編集するときには以下のスクリプトが自動的に読み込まれます: > + ftplugin/sql.vim + syntax/sqlinformix.vim + indent/sql.vim +> +indent/sqlinformix.sql は読み込まれていないことに注意してください。Informix 用 +のインデントファイルは存在しないため、既定のインデントファイルが読み込まれてい +ます。 + + +============================================================================== +3. SQL 方言を追加する *sql-adding-dialects* + +Vim の標準ディストリビューションにスクリプトが含まれていない SQL 方言を扱うと +きは、対応するスクリプトが投稿されていないか http://www.vim.org をチェックして +みてください。もしなければ既存のスクリプトをコピーしてカスタマイズしましょう。 +詳しくは |filetype-plugins| を参照してください。 + +スクリプトを識別しやすくするために、ファイル名の先頭に "sql" という接頭辞をつ +けてください。例えば SQLite データベース用のカスタマイズを作りたい場合は、以下 +のファイルを作成します: > + Unix + ~/.vim/syntax/sqlite.vim + ~/.vim/indent/sqlite.vim + Windows + $VIM/vimfiles/syntax/sqlite.vim + $VIM/vimfiles/indent/sqlite.vim + +SQLSetType コマンドには変更を加える必要はありません。SQLSetType コマンドを実行 +すると自動的に新しい SQL ファイルが選ばれ、読み込まれます。 + + +============================================================================== +4. SQL オムニ補完 *sql-completion* + *omni-sql-completion* + +Vim 7 にはプラグイン開発者が任意の言語用のコード補完を作るためのインターフェイ +スと関数が備わっています。Vim 7 には SQL 言語用のコード補完が含まれています。 + +SQL 補完プラグインには static と dynamic という2つのモードがあります。static +モードは 現在の構文強調ルールから生成されたデータをもとにポップアップを表示し +ます。dynamic モードはデータベースから直接抽出したデータをもとにポップアップ +を表示します。このデータにはテーブルのリスト、カラムのリスト、プロシージャ名な +どが含まれます。 + +4.1 static モード *sql-completion-static* +--------------- +static ポップアップはファイルタイプが SQL のファイルを編集しているときに、使用 +中の構文ルールで定義された項目を含んで表示されます。プラグインは、表示される項 +目のリストを絞り込むための様々なマップを用意しています。 +既定の static マップは次の通りです: > + imap a :call sqlcomplete#Map('syntax') + imap k :call sqlcomplete#Map('sqlKeyword') + imap f :call sqlcomplete#Map('sqlFunction') + imap o :call sqlcomplete#Map('sqlOption') + imap T :call sqlcomplete#Map('sqlType') + imap s :call sqlcomplete#Map('sqlStatement') + +"" のキーは環境によっては動作しないかもしれません。そこで、以下の行を +|.vimrc| に書くことで "" を他のキーに変更できます: > + let g:ftplugin_sql_omni_key = '' +> + +static マップ(構文強調グループに基づいている)は以下の形式で定義されています: > + imap k :call sqlcomplete#Map('sqlKeyword') + imap k :call sqlcomplete#Map('sqlKeyword\w*') + +このコマンドは次のように分解できます: > + imap - 挿入モードでのマップを作成する + - このバッファに対してのみ + k - マップするキー + - コマンドを1個実行し、挿入モードに戻る + :call sqlcomplete#Map( - 他の補完プラグインと組み合わせて使えるようにする + ために、いくつかのな関数を実行します。 + どの項目を補完して欲しいかを SQL 補完プラグインに + 指示します。 + この場合は構文強調グループ 'sqlKeyword' の項目を + 表示するよう指定しています。 + 選択可能な構文強調グループ名のリストは、SQL ファ + イルを編集中に次のコマンドで表示できます。 + :syntax list + 'sqlKeyword' - 構文強調グループ sqlKeyword の項目を表示します。 + 'sqlKeyword\w*' - Vim 7.4 からは、正規表現を使って構文強調グループ + を選択できます。 + ) - :let コマンドを実行します。 + - 標準のオムニ補完のキーストロークを実行します。 + sqlcomplete#Map 関数の引数に 'sqlKeyword' を渡して + あるので、SQL 補完プラグインは構文強調グループ + sqlKeyword の項目をポップアップするようになってい + ます。プラグインは Vim が再起動するまでこの結果を + キャッシュします。構文のリストはsyntaxcomplete プ + ラグインを使って抽出されます。 + +'syntax' キーワードを使うのは特別な場合です。これは syntaxcomplete プラグイン +にすべての構文アイテムを抽出するよう指示します。そのためこれは Vim のどの SQL +構文ファイルに対しても有効です。これを書いている時点でこれは SQL 方言用の10 +個の構文ファイルを含んでいます(上の セクション3 |sql-dialects| を参照)。 + +構文ファイルから抽出される項目の例を以下に示します: > + 全部 + - 全構文強調グループの中身 + 文 + - Select, Insert, Update, Delete, Create, Alter, ... + 関数 + - Min, Max, Trim, Round, Date, ... + キーワード + - Index, Database, Having, Group, With + オプション + - Isolation_level, On_error, Qualify_owners, Fire_triggers, ... + 型 + - Integer, Char, Varchar, Date, DateTime, Timestamp, ... + + +4.2 dynamic モード *sql-completion-dynamic* +---------------- +dynamic モードではデータベースから直接抽出したデータを元にポップアップを表示 +します。dynamic 機能を有効にするためには dbext.vim をインストールしなければな +りません(http://vim.sourceforge.net/script.php?script_id=356)。 + +dynamic モードは SQL 補完プラグインのいくつかの機能から使われています。dbext +プラグインをインストールしたら dbext-tutorial の設定と使い方を読んでください。 +dbext を使うと SQL 補完プラグインがテーブル、プロシージャ、ビュー、カラムのリ +ストを表示できるようになります。 > + テーブルリスト + - 全スキーマ所有者の全テーブル + プロシージャリスト + - 全スキーマ所有者の全ストアドプロシージャ + ビューリスト + - 全スキーマ所有者の全ビュー + カラムリスト + - 選択したテーブル内のカラム + +これらのリストをポップアップを表示するには、挿入モードで以下のキーを使います +(ここで は CTRL キーを押しながら C キーを押すという意味です): + テーブルリスト - t + - (既定のマップはテーブルリスト) + ストアドプロシージャリスト - p + ビューリスト - v + カラムリスト - c + + ドリルイン/アウト - テーブルリストのポップアップウィンドウを表示中 + に を押すと現在選択されているテーブル + のカラムリストの表示に切り替わります。 + - カラムリストのポップアップウィンドウを表示中に + を押すとテーブルリスト表示に切り替わり + ます。 + - これを使えばテーブルリストとカラムリストの表示を + 素早く切り替えることができます。 + - のキーも |.vimrc| により変更で + きます > + let g:ftplugin_sql_omni_key_right = '' + let g:ftplugin_sql_omni_key_left = '' + +SQL 補完プラグインはポップアップウィンドウに表示されるリストをキャッシュしてお +きます。これによってリストの再表示がとても高速になります。データベースに新しい +テーブルやカラムが追加されたときはプラグインのキャッシュをクリアする必要が出て +くるかもしれません。キャッシュをクリアするための既定のマップは次の通りです: > + imap R :call sqlcomplete#Map('ResetCache') + + +4.3 SQL 補完のチュートリアル *sql-completion-tutorial* +---------------- + +このチュートリアルは SQL 補完プラグインの主な機能を一通り紹介することを意図し +て次のことが書かれています: > + a) プラグインに慣れる + b) 主な機能を紹介する + c) カスタマイズする方法を示す + d) 「ベストな使い方」をデモする(一番簡単な設定方法) + +まず、新規バッファを作成しましょう: > + :e tutorial.sql + + +static な機能 +--------------- +各種のリストを表示するには、単に挿入モードで次をタイプします: + s (SQL 文を表示する) +そしてリストの中を "select" まで下に移動していきます。探している項目をよく知っ +ている場合、例えばそれが "s" という文字で始まることを知っている場合は、その文 +字を続けてタイプできます。"se" とタイプしてから(引用符はタイプしません): + t +を押してみてください。 +"select" が選択されたところで を押すとその項目を確定します。次に + * fra (すべての構文アイテムを表示する) +とタイプしてみてください。"from" が候補に現れるでしょう。 + +ストアドプロシージャを書くときには型リストが便利です。型リストはそのデータベー +スがサポートしているすべての型を含んでいます。ただしこれはお使いの構文ファイル +に依存します。SQL Anywhere 構文ファイル(sqlanywhere.vim)は以下のような場合に対 +応しています : > + BEGIN + DECLARE customer_id T <-- リストから型を選ぶ + + +dynamic な機能 +---------------- +dynamic な機能を使うにはまず dbext.vim +(http://vim.sourceforge.net/script.php?script_id=356) をインストールしなければ +なりません。このプラグインにはチュートリアルが付属しています。SQL 補完プラグイ +ンの観点からすると、dbext の主な機能はデータベースへの接続です。dbext の接続プ +ロファイルは接続情報を定義するためのもっとも効果的なメカニズムです。一度接続が +確立されていれば、SQL 補完プラグインはポップアップを表示する際にバックグラウン +ドで dbext の機能を利用します。 + +dbext.vim を正しく設定したら、テストするためにコマンド :DBListTable を実行しま +す。テーブルのリストが表示されれば dbext.vim が正常に動作しています。表示され +ない場合は dbext.txt を読んで調べてください。 + +既に dbext のチュートリアルをやっていれば、t でテーブルのリストを表示でき +ることをご存知でしょう。dbext がテーブルリストを作成する間、少々時間がかかりま +す。リストが表示されたら を押してください。するとポップアップウィンドウ +と既に選択されたテーブル名の両方が消えます。 > + + 4.3.1 テーブル補完 *sql-completion-tables* + +t を押すと、dbext により接続したデータベース内のテーブルのリストが表示さ +れます。 +NOTE: SQL 補完ポップアップはすべてキーマップの前のプリフィックスに対応していま +す。プリフィックスを指定すると、ポップアップウィンドウの内容がその文字列で始ま +るものだけに制限されます。 > + + 4.3.2 カラム補完 *sql-completion-columns* + +SQL 補完プラグインは特定のテーブルのカラムのリストを表示することもできます。 +このカラム補完は c で起動できます。 + +NOTE: 以下の例ではポップアップウィンドウの表示中に でカラムリストを +表示しています。 + +カラム補完を使用している様子の例: + - もう一度 t を押すとテーブルのリストが表示されます。 + - 補完ウィンドウにリストが表示されているとき を押すとテーブル + のリストが消え、途中まで 入力されたテーブルに含まれるカラムのリスト表 + 示に切り替わります(すこし時間がかかります)。 + - を押すとカラムリストからテーブルリストに切り替わります。これに + よってテーブルリストとカラムリストをとても素早く切り替えられます。 + - 同じテーブルに対してもう一度 を押すと、今度はカラムリストが + キャッシュされているため時間がかからないことに気づくでしょう。キャッ + シュしているテーブルのスキーマが変更されたときは R を押します。す + るとSQL 補完のキャッシュがクリアされます。 + - NOTE: は補完ウィンドウがアクティブな状態で動作す + るよう設計されています。補完のポップアップウィンドウがアクティブでない + 場合はノーマルモードでの の動作になります。 + +SQL 文を動的に組み立てる方法を見ていきましょう。select 文にはカラムのリストが +必要です。SQL 補完プラグインを使ってカラムのリストを組み立てる方法は 2 通りあ +ります。 > + 一度に 1 カラムを挿入する方法: +< 1. SELECT を入力した後に t を押してテーブルリストを表示します。 + 2. リストからテーブルを選択します。 + 3. を押してカラムリストを表示します。 + 4. リストからカラムを選択してエンターを押します。 + 5. "," を入力して c を押します。通常、カラムリストを生成するには + カーソルをテーブル名の上に置かねばなりません。プラグインはその名前 + を使ってどのテーブルからカラム リストを抽出するか決定します。このス + テップではカーソルをテーブル名の上に置かずに c を押したため、 + 表示されるカラムリストは前に使ったテーブルが対象となります。そして + カラムを選択して続けます。 + 6. ステップ 5 を必要なだけ繰り返します。 > + テーブルの全カラムを挿入する方法: +< 1. SELECT と入力してから t を押すとテーブルのリストが表示されます。 + 2. カラムリストを表示したいテーブルにカーソルを合わせます。 + 3. を押してテーブルを選択します。 + 4. l を押してそのテーブル内の全カラムのコンマ区切りのリストを表示 + させます。 + 5. ステップ 3 で選んだテーブル名に基づいてプラグインは妥当なテーブルエ + イリアスを決定します。ここでそのエイリアスを受け入れるかどうかプロ + ンプトが表示されます。OK を押してください。 + 6. するとテーブル名が消え、代わりにそのテーブルのカラムリスト(各カラム + 名の前にエイリアスがつき、コンマ区切りになったもの)が挿入されます。 + 7. L を押すとステップ 3 と 4 を同時に実行できます。これは、リス + トの中で現在選ばれているテーブルで決定するためにマップの中に + を埋め込んでいます。 + +select 文を書くための特別な機能があります。次の文を書く場合を考えてください: +> + select * + from customer c, + contact cn, + department as dp, + employee e, + site_options so + where c. + +挿入モードで "customer" テーブルのエイリアスである最後の "c." を入力した後、 +c または を押してみてください。すると customer テーブルのカラ +ムのリストがポップアップ表示します。これは、select 文の開始位置を見て FROM 句 +で指定されたテーブルのリストを探しています。この場合は文字列 "customer c" +("c" は customer テーブルのエイリアス)が発見されます。省略可能なキーワード +"AS" にも対応しています。例: "customer AS c" > + + + 4.3.3 プロシージャ補完: *sql-completion-procedures* + +テーブルリストと同様に、p でデータベースに登録されているストアドプロシー +ジャのリストを表示できます。 > + + 4.3.4 ビュー補完: *sql-completion-views* + +テーブルリストと同様に、v でデータベースに登録されているビューのリストを +表示できます。 > + + +4.4 補完のカスタマイズ *sql-completion-customization* +---------------------------- + +|vimrc| でオプションをセットすることによって SQL 補完プラグインをカスタマイズ +できます: > + omni_sql_no_default_maps +< - 既定値: この変数は定義されていない + - この変数が定義されている場合はオムニ補完用のマップが作られません。よ + り詳しくは |sql-completion-maps| を参照。 +> + omni_sql_use_tbl_alias +< - 既定値: a + - この設定はコンマ区切りのカラムリストを生成するときに参照されます。 + 既定ではカラムリストを生成するマップは l です。カラムリストを + 生成するときに各カラムの前にエイリアスがつきます。例えば: + e.emp_id, e.emp_name。このオプションには 3 種類の値を設定できます: > + n - エイリアスを使わない + d - 既定のエイリアス(自動的に決定されたもの)を使う + a - エイリアス名を問い合わせる +< + エイリアスは以下の規則によって決定されます: + 1. テーブル名が '_' を含んでいれば、それを区切り文字に使います + : > + MY_TABLE_NAME --> MTN + my_table_name --> mtn + My_table_NAME --> MtN +< 2. テーブル名が '_' を含んでいないが大文字・小文字が混在してい + れば、それを区切り文字に使います: > + MyTableName --> MTN +< 3. テーブル名が '_' を含んでいなく、大文字・小文字も混在してい + なければテーブル名の最初の文字を使います: > + mytablename --> m + MYTABLENAME --> M + + omni_sql_ignorecase +< - 既定値: 'ignorecase' の現在値 + - 有効な値は 0 または 1。 + - 数文字を入力してから補完を開始すると、リストの要素がその文字列で始ま + るものだけにフィルタされます。このオプションが 0 の場合は、そのフィ + ルタが大文字・小文字を区別します。 > + + omni_sql_include_owner +< - 既定値: dbext.vim 3.00 がインストールされていなければ 0 + - 有効な値は 0 または 1。 + - テーブル、プロシージャ、ビューのリストを補完するとき、dbext.vim 3.00 + 以上を使っていればオブジェクトのリストにその所有者名がつきます。 + これらのオブジェクトを補完するとき omni_sql_include_owner が有効に + なっていればその所有者名も置き換えられます。 > + + omni_sql_precache_syntax_groups +< - 既定値: + ['syntax','sqlKeyword','sqlFunction','sqlOption','sqlType','sqlStatement'] + - sqlcomplete は他のプラグインと組み合わせて使うことができます。その方 + 法の概略は |sql-completion-filetypes| で説明されています。一時的に + ファイルタイプが SQL に変更されたとき、SQL 補完プラグインはこのオプ + ションで指定されたリスト内の構文グループをキャッシュします。 +> + +4.5 SQL 関連のマップ *sql-completion-maps* +------------ + +既定の SQL 関連のマップはこのドキュメントの他の節で詳しく説明しました。ここで +は簡潔な説明つきのマップのリストを示します。 + +static モードのマップ +----------- +以下は Vim の構文強調ルールを使って補完リストを作成するマップです。 > + a +< - SQL 構文アイテムを全て表示します。 > + k +< - 'sqlKeyword' と定義された構文アイテムを全て表示します。 > + f +< - 'sqlFunction' と定義された構文アイテムを全て表示します。 > + o +< - 'sqlOption' と定義された構文アイテムを全て表示します。 > + T +< - 'sqlType' と定義された構文アイテムを全て表示します。 > + s +< - 'sqlStatement' と定義された構文アイテムを全て表示します。 > + +dynamic モードのマップ +------------ +以下は dbext.vim プラグインを使用して補完リストを作成するマップです。 > + t +< - テーブルのリストを表示します。 > + p +< - プロシージャのリストを表示します。 > + v +< - ビューのリストを表示します。 > + c +< - 指定テーブルのカラムのリストを表示します。 > + l +< - 指定テーブルのカラムのリストをコンマ区切りで表示します。 > + L +< - 指定テーブルのカラムのリストをコンマ区切りで表示します。 + 補完ウィンドウがアクティブなときだけ使用できます。 > + +< - 現在補完リストでカーソルが指しているテーブルのカラムリストを表示しま + す。ほとんどの Unix システムでは を認識できないため、この + マップは Windows でのみ定義されます。同じ機能を Unix でも利用するに + は他のキーを選んで自分の vimrc で同じマップを定義してください。 > + +< - テーブルのリストを表示します。ほとんどの Unix システムでは + を認識できないため、このマップは Windows でのみ定義されます。同じ機 + 能を Unix でも利用するには他のキーを選んで自分の vimrc で同じマップ + を定義してください。 +> + R +< - キャッシュされた項目を全て削除し、項目のリストを再生成するよう強制し + ます。 + +マップのカスタマイズ +-------------------- +好みに応じてマップを作成できます。一般的に、これらのマップは構文強調グループを +定義します。 + +デフォルトで作成されるマップが好みでなかったり、そのキーがお使いのプラット +フォームでは動作しない場合、次の変数を |vimrc| で定義してください: > + let g:omni_sql_no_default_maps = 1 + +ftplugin/sql.vimを直接編集することはやめてください。このファイルを変更しても、 +将来アップデートしたときその変更は上書きされてしまいます。Vim は、ディストリ +ビューションに含まれているファイルを変更することなくカスタマイズを行うために +after というディレクトリ構造を備えています。マップをカスタマイズするには +after/ftplugin/sql.vim を作成します(|after-directory|を参照)。そしてその中で +ftplugin/sql.vim に書かれているのと同じマップを、好みのキーストロークに対して +定義します。 が選ばれたのは、それが Windows、*nix のどちらでも動作するか +らです。Windows では やALT キーを使うこともできます。 + + +4.6 他のファイルタイプのファイル内で使うには *sql-completion-filetypes* +------------------------------ + +SQL を他のファイルタイプのファイル内で使う機会はよくあります。例えば Perl, +Java, PHP, Javascript はどれもデータベースと対話できます。編集中の言語の補完機 +能に加えて SQL 補完も使いたいという状況はよくあります。 + +そんな場合は、以下のステップによって簡単に実現できます(Perlの例です): > + 1. :e test.pl + 2. :set filetype=sql + 3. :set ft=perl + +ステップ 1 +------ +Perl ファイルの編集を始めます。自動的にファイルタイプが "perl" になります。デ +フォルトで、ファイルタイプ・ファイルの ftplugin/perl.vim が読み込まれます。 +|ft-syntax-omni| に書かれているコマンドによって構文補完プラグインを使っている +場合は、オプション |'omnifunc'| が "syntax#Complete" にセットされます。 + を押すと Perl の構文アイテムを含むオムニポップアップが表示されます。 + +ステップ 2 +------ +手動でファイルタイプを 'sql' にセットすると、やはり対応するファイルタイプ・ +ファイルの ftplugin/sql.vim が読み込まれます。このファイルは、SQL 補完用に多数 +のバッファ固有のマップを定義します(|sql-completion-maps| を参照)。こうしてマッ +プが作成され、SQL 補完プラグインが初期化されます。全ての SQL 構文アイテムが準 +備的にキャッシュされます。SQL ファイルタイプ・スクリプトは2種類の補完プラグイ +ンを使おうとしていることを検出します。 で始まる SQL 用のマップが呼び出さ +れると、その実行中だけ |'omnifunc'| を切り替えます。そのため、 は (構 +文補完プラグインによる) Perl 用の補完のために使用し、 は SQL 補完機能のた +めに使用できます。 + +ステップ 3 +------ +ファイルタイプを Perl に戻すと、"perl" に関連する全ての構文要素が元通りになり +ます。 + + +vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/gui.jax b/plugins/vimdoc-ja/doc/gui.jax new file mode 100644 index 0000000000..dc7bb0a0c5 --- /dev/null +++ b/plugins/vimdoc-ja/doc/gui.jax @@ -0,0 +1,1037 @@ +*gui.txt* For Vim バージョン 8.0. Last change: 2014 Mar 08 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vimのグラフィカルユーザーインターフェイス *gui* *GUI* + +1. GUIの開始 |gui-start| +2. スクロールバー |gui-scrollbars| +3. マウス制御 |gui-mouse| +4. GUI選択の作成 |gui-selections| +5. メニュー |menus| +6. 付記 |gui-extras| +7. シェルコマンド |gui-shell| + +他のGUIドキュメント: +|gui_x11.txt| X11 GUIに特有の項目について。 +|gui_w32.txt| Win32 GUIに特有の項目について。 + +{Vi にはこれらのコマンドはない} + +============================================================================== +1. GUIの開始 *gui-start* *E229* *E233* + +まずはVimがGUIに対応したバージョンであるか確認する必要がある。それは ":version" +コマンドで調べることができる。その出力が "with xxx GUI" または "MS-Windows 32 +bit GUI version" を含んでいれば問題ない。ここで "xxx" は X11-Motif, +X11-Athena, Photon, GTK2, GTK3, などである。 + +どのようにGUIで起動するかは使用しているシステムに依存する。たいていはこのよう +にしてGUI版のVimを実行できる: + gvim [options] [files...] + +VimのX11バージョンはGUIとGUIでないモードの両方で実行することができる。 +|gui-x11-start| を参照。 + + *gui-init* *gvimrc* *.gvimrc* *_gvimrc* *$MYGVIMRC* +gvimrc は GUI 固有の初期化コマンドを書くためのファイルである。gvimrc は常に +ファイル |vimrc| の後に読み込まれる。環境変数 $MYGVIMRC があると、その値が +gvimrc の代わりに使われる。 + +GUIの初期化は次の順序で行われる: +- オプション 'term' が "builgin_gui" に設定され、端末の設定がGUI用の初期値に設 + 定される。|terminal-options| +- システムのメニューファイルがあればそれが読み込まれる。このファイルの名前は通 + 常 "$VIMRUNTIME/menu.vim" である。":version" でこれを確認できる。 + |$VIMRUNTIME|も参照。システムのメニューの読み込みを省略するには 'guioptions' + に 'M' を含める。 + *buffers-menu* *no_buffers_menu* + システムのメニューファイルはメニュー項目 "Buffers" (バッファ)の定義も含んで + いる。これを必要としないなら、ユーザーの.vimrc (.gvimrcではない!)で + "no_buffers_menu" を設定する: > + :let no_buffers_menu = 1 +< NOTE: 構文強調表示を有効にするとメニューファイルも読み込まれるため、メニュー + 項目Buffers(バッファ)を無効にするのは ":syntax on" の前にする。 + メニューに表示されるバッファの名前は35文字で切り詰められる。違う長さで切り詰 + めるなら、例えば50文字にするなら、次のようにする: > + :let bmenu_max_pathlen = 50 +- Vimを起動するときのコマンドライン引数に "-U {gvimrc}" が指定されると、 + {gvimrc}ファイルが初期化のために読み込まれ、以下の初期化処理は省略される。 + {gvimrc}が "NONE" の場合は、どの初期化ファイルも読み込まれない。 +- UnixとMS-Windowsでは、システムのgvimrcが存在するなら、それが読み込まれる。こ + のファイルの名前は通常 "$VIM/gvimrc" である。":version" でこれを確認できる。 + |$VIM|も参照。 +- 次のものを試して、最初に見つかったものが使用される: + - GVIMINIT環境変数が存在し空でないなら、それがExコマンドとして実行される。 + - ユーザーのgvimrcファイルが存在するなら、それが読み込まれる。このファイル + の名前は通常 "$HOME/.gvimrc" である。":version" でこれを確認できる。 + - Win32では、$HOMEが設定されていないときは、"$VIM\_gvimrc" が読み込まれる。 + - "_gvimrc" ファイルが見つからないときには、".gvimrc" も試される。逆のときも + 同様である。 + $MYGVIMRC が設定されていないならば、$MYGVIMRC に最初に見つかったファイルの名 + 前が代入される。 +- 'exrc' オプションが設定されていて(これは標準設定ではない)、./.gvimrcファイル + が存在し、それがシステム、あるいはユーザーのgvimrcファイルではないなら、それ + が読み込まれる。このファイルがユーザーの所有しているものでないなら、いくつか + のセキュリティ上の制限が適用される。".gvimrc" が見つからないときには、 + "_gvimrc" も試される。MacintoshとDOS/Win32では、"_gvimrc" が最初に試される。 + +NOTE: Vimを起動するときに、"-U" 引数を指定せずに "-u NONE" を指定するか、ある +いは "-U NONE" を指定して起動すると、最初のもの以外は全て実行されない。 + +これらは全て、ユーザーの.vimrcファイルを読み込む、というような、通常のVimの初 +期化の後に実行される。|initialization|を参照。 +しかし、GUIウィンドウは全ての初期化が実行された後に開かれる。 +GUIウィンドウを開いた直後にいくつかのコマンドを実行したいなら、オートコマンド +の|GUIEnter|イベントを使用する。例えば: > + :autocmd GUIEnter * winpos 100 50 + +カスタマイズしたメニュー(|:menu|を参照)をセットアップしたり、CUI版とは異なった +初期化をするために、gvimrcファイルを使用することができる。 + +ユーザーの個人的なGUI初期化ファイルを置くのに推奨される場所: + Unix $HOME/.gvimrc、$HOME/.vim/gvimrc + OS/2 $HOME/.gvimrc、$HOME/vimfiles/gvimrc、$VIM/.gvimrc + MS-DOSとWin32 $HOME/_gvimrc、$HOME/vimfiles/gvimrc、$VIM/_gvimrc + Amiga s:.gvimrc、home:.gvimrc、home:vimfiles:gvimrc、 + $VIM/.gvimrc + +個人的な初期化ファイルは上記の順に検索され、最初に見つかったものだけが読み込ま +れる。 + +GUI版のVimでだけ意味を持つオプションがある。'guicursor'、'guifont'、'guipty'、 +'guioptions' である。それらは他の全てのオプションと共に|options.txt|で説明され +ている。 + +GUIのMotifかAthenaバージョン(GTK+やWin32バージョンではない)を使用しているなら +ば、多くのXのリソースが有効である。|gui-resources|を参照。 + + +端末の設定をする以外に文字の色を設定する方法はハイライトを設定することである。 +ハイライトの "Normal" グループは背景色と前景色を設定するために用いられる。(ナ +イスな)例: > + + :highlight Normal guibg=grey90 + +"guibg" と "guifg" の設定は通常の背景と前景の設定よりも優先される。ハイライト +のNormalグループに対するその他の設定は使用されない。フォントを設定するには +'guifont' を使用する。 + +モード別にカーソルの色を設定するには、'guicursor' オプションを参照。 + +Vimは起動時に、スクリーンに合わせてウィンドウの位置を調整しようとする。これは +ウィンドウの一部が隠れてしまわないようにするためである。X Window Systemでは、 +これは少し憶測を必要とする。'guiheadroom' オプションでウィンドウタイトルとタス +クバーに用いられる高さを変更することができる。 + + *:winp* *:winpos* *E188* +:winp[os] + GUI vimウィンドウの左上隅の現在の位置をピクセルで表示する。全 + てのバージョンで機能する訳ではない。 + |getwinposx()| と |getwinposy()| も参照のこと。 + +:winp[os] {X} {Y} *E466* + 与えられた{X}と{Y}の座標にGUI vimウィンドウを移動する。座標は + ウィンドウの左上隅の位置をピクセル単位で指定する。全てのバー + ジョンで機能する訳ではない。(新しい)xtermで機能する + |xterm-color|。 + GUIウィンドウがまだ開いていないとき、この値はウィンドウが開か + れるまで保留される。位置はスクリーンに合うように調整される(可 + 能なら)。 + + *:win* *:winsize* *E465* +:win[size] {width} {height} + {width}(幅)と{height}(高さ)を指定してウィンドウの大きさを設定 + する。このコマンドは古いコマンド(Obsolete)なので、 + ":set lines=11 columns=22" を使用するようにすること。 + 期待したよりも高さが低くなるなら、'guiheadroom' オプションを確 + 認すること。 + +X Window Systemでは、これらのコマンドでVimのウィンドウの情報を得られる: > + :!xwininfo -id $WINDOWID + :!xprop -id $WINDOWID + :execute '!xwininfo -id ' . v:windowid + :execute '!xprop -id ' . v:windowid +< + *gui-IME* *iBus* +X で各国の文字を入力するためのインプットメソッドで XIM フレームワークに依るも +の、特に iBus は、gVim で使用すると不具合が起こることが知られている。スペース +を入力できなかったり、キーを押してからそれがアプリケーションに届くまで大きな遅 +延が発生したりする。 + +対処療法としては gvim の起動引数に |-f| を付けてフォークをしないようにすると症 +状は出なくなる。理由は不明だが。 +============================================================================== +2. スクロールバー *gui-scrollbars* + +垂直スクロールバーと水平スクロールバーがある。'guioptions' オプションでどれが +表示されるかを設定することができる。 + +このような外観になっている(設定が ":set guioptions=mlrb" のとき): + + +------------------------------+ ` + | ファイル 編集 ヘルプ | <- メニューバー(m) ` + +-+--------------------------+-+ ` + |^| |^| ` + |#| テキストエリア |#| ` + | | | | ` + |v|__________________________|v| ` + Vimウィンドウ間の -> |-+ File.c 5,2 +-| ` + 通常のステータス行 |^|""""""""""""""""""""""""""|^| ` + | | | | ` + | | 別のファイルバッファ | | ` + | | | | ` + |#| |#| ` + 左スクロールバー(l)-> |#| |#| <- 右 ` + |#| |#| スクロールバー(r) ` + | | | | ` + |v| |v| ` + +-+--------------------------+-+ ` + | |< #### >| | <- 下 ` + +-+--------------------------+-+ スクロールバー(b) ` + +スクロールバーやメニューバーは 'guioptions' から対応する文字を取り除くことで無 +効にできる。下スクロールバーは 'nowrap' が設定されているときだけ有用である。 + + +垂直スクロールバー *gui-vert-scroll* + +各Vimウィンドウはとなりにスクロールバーを持っていて、上下にスクロールしてその +バッファ内のテキストの表示を移動できる。スクロールバーのつまみのサイズはウィン +ドウに見えているバッファの割合を示している。スクロールバーがずっと下方にドラッ +グされると、ファイルの最後の行はウィンドウの最上部に表示される。 + +ウィンドウが(他のウィンドウの拡大によって)高さゼロに縮小されると、そのスク +ロールバーは表示されなくなる。それはウィンドウが復元されるときに再び表示され +る。 + +ウィンドウを縦分割しているとき、カレントウィンドウだけがスクロールバーを利用で +きる。そして、複数のウィンドウの真ん中のウィンドウを操作しているときは、スク +ロールバーは間のウィンドウを飛び越えて作用する。 +両側にスクロールバーがあるときに、複数のウィンドウの真ん中のカレントウィンドウ +が左半分に面していると、右側のスクロールバーは右端のウィンドウに影響する。左右 +が逆でも同様。 + + +水平スクロールバー *gui-horiz-scroll* + +(Vim GUIの最下段の)水平スクロールバーは、'wrap' オプションがオフのときに、テキ +ストを横にスクロールするために使用する。スクロールバーのつまみのサイズは、左右 +にスクロールして一番長い行のテキストを全て表示できるくらいである。必要に応じて +カーソルが移動するとき、カーソルは表示されている文字の上にとどまる +('virtualedit' が設定されていなければ)。 + +一番長い行を計算するのは多少の処理時間を必要とする。そしてそれは何かが変更され +るときに毎回行われる。その時間が多すぎるようだったり、他の行へのカーソルジャン +プを好まないなら、'guioptions' に 'h' を含めると、スクロールはカーソルのある行 +の長さに制限される。 + + *athena-intellimouse* +インテリマウスを持っていて、Xサーバーがホイールをサポートしているなら、gvimで +テキストを上下にスクロールするのにホイールを使うことができる。これはXFree86 +4.0以降のバージョンで機能する。古いバージョンでもパッチを当てれば利用可能にな +る。|scroll-mouse-wheel|を参照。 + +古いバージョンのXFree86ではXサーバーにパッチを当てなくてはならない。以下のペー +ジにはパッチとXサーバーのバイナリへのリンクに加えて、Linux上でインテリマウスを +使用することについて多少の情報がある(けれども必要とするものはないかもしれない): + http://www.inria.fr/koala/colas/mouse-wheel-scroll/ + +============================================================================== +3. マウス制御 *gui-mouse* + +マウスは、'mouse' オプションに適切なフラグが設定されている場合にだけ機能する。 +GUIに切り替わるときに、'mouse' がまだ設定されていなければ、'mouse' オプション +は自動的に "a" に設定され、|hit-enter|プロンプトを除いて全てのモードで有効にな +る。これを望まないならば、"gvimrc" ファイルで 'mouse' オプションを変更する。 + +関連する他のオプション: +'mousefocus' マウスポインタが乗っているウィンドウをカレントウィンドウにする + |gui-mouse-focus| +'mousemodel' マウスのボタンがどのような動作をするか +'mousehide' テキストを入力している間マウスポインタを隠す +'selectmode' 選択時に選択モードとビジュアルモードのどちらを使うか + +素早くこれらを設定するには ":behave" コマンドで行う。 + *:behave* *:be* +:be[have] {model} マウスと選択の動作を設定する。有効な引数は: + mswin MS-Windowsの動作 + xterm Xtermの動作 + + ":behave" を使用するとこれらのオプションが変更される: + option mswin xterm ~ + 'selectmode' "mouse,key" "" + 'mousemodel' "popup" "extend" + 'keymodel' "startsel,stopsel" "" + 'selection' "exclusive" "inclusive" + +$VIMRUNTIMEディレクトリの中に、MS-Windowsにあるようなcut/copy/paste機能のため +のキーマッピングを設定する|mswin.vim|と呼ばれるスクリプトがある。これは、 +CTRL-V、CTRL-X、CTRL-Cキーを用いるので、標準の操作と互換性がなくなってしまう。 +それでも構わないなら、このコマンドで使用する: > + :so $VIMRUNTIME/mswin.vim + +マウスのホイールでスクロールするには、|scroll-mouse-wheel|を参照。 + + +3.1 マウスによるカーソルの移動 *gui-mouse-move* + +カーソルを持って行きたいテキストバッファのどこかでマウスの左ボタンをクリックす +ると、カーソルはそこに行く! +動作するモード 'mouse'が以下を含んでいるとき ~ +ノーマルモード 'n' or 'a' +ビジュアルモード 'v' or 'a' +挿入モード 'i' or 'a' + +選択モードはビジュアルモードのように扱われる。 + +現在のカーソル位置からマウスで指示する位置までのテキストを削除するために 'd' +のようなオペレータと共にこれを使用してもよい。つまり、'd' を入力してからどこか +をマウスでクリックする。 + + *gui-mouse-focus* +'mousefocus' オプションを設定してキーボードフォーカスがマウスポインタに追従す +るようにできる。これはマウスポインタが乗っているウィンドウがアクティブウィンド +ウになることを意味する。警告: メニューをうまく利用できなくなる。メニューを使用 +したときに、そのメニューに設定されたコマンドは常に一番上のウィンドウに適用され +てしまうだろう。 + +('mouse' が 'c'、'a'、'A' のどれかを含んでいるなら)コマンドラインモードや検索 +モード中にマウスの左ボタンか右ボタンをクリックすることで、コマンドラインの行の +クリックした位置にカーソルを移動できる。 + +どのような状況でも、マウスの中ボタンをクリックして、現在の選択を貼り付けること +ができる。 + + +3.2 マウスによる選択 *gui-mouse-select* + +マウスを使って選択を開始できる。どのように使用するかは 'mousemodel' オプション +に依存する: +'mousemodel' が "extend" である: マウスの右ボタンを使用する。 +'mousemodel' が "popup" である: Shiftキーを押しながら、マウスの左ボタンを使用 +する。 + +選択を開始するときには、カーソルの位置からマウスで指示した位置までが選択され +る。すでに選択されている状態で選択の操作をすると、選択範囲が拡張される。 + +'selectmode' が "mouse" を含んでいるなら、選択モードが使用される。これは選択中 +に入力した文字で選択範囲が置き換えられることを意味する。 +|Select-mode|を参照。そうでなければ、ビジュアルモードが使用される。 + +ダブルクリックで単語の選択、トリプルクリックで行の選択、クワドルプルクリック +(4回クリック)で矩形ブロックを選択することができる。 + +どのように選択が用いられるかに関しては|gui-selections|を参照。 + + +3.3 マウスによる他のテキスト選択 *gui-mouse-modeless* + *modeless-selection* +次のときには異なる選択方法が使われる: +- コマンドラインモード +- コマンドラインウィンドウを使用中に他のウィンドウを指したとき +- |hit-enter|プロンプト +- 現在のモードが 'mouse' オプションで指定されていないときはいつでも +- GUIでCTRLキーとSHIFTキーを同時に押しているとき + +テキストが選択されていても、選択されていないかのように、あるいは、選択に関連し +たモードが存在しないかのように、Vimが通常の動作を継続するので、これはモードレ +ス選択と呼ばれる。Vimウィンドウの中のどんなテキストでも選択することができる。 +開始点でマウスの左ボタンを押すことでテキストを選択し、終点までドラッグして離 +す。選択を延長するには、'mousemodel' が "extend" のときにはマウスの右ボタンを +使用し、'mousemodel' が "popup" のときにはシフトキーを押しながらマウスの左ボタ +ンを使用する。 +選択したテキストが変更されると、選択は解除される。 + +コマンドラインでは CTRL-Y で選択範囲をクリップボードにコピーできる。挿入モード +中にコピーするには CTRL-O を使い CTRL-Y とする。'guioptions' に a か A が +含まれるとき (X11 では既定でそうなっている) は、選択範囲が自動的にレジスタ "* +にコピーされる。 + +マウス中ボタンでテキストを貼り付けられる。X11 以外のシステムでは CTRL-R + を +使えば貼り付けられる。 + + +3.4 ステータス行でのマウスの使用 *gui-mouse-status* + +Vimウィンドウの下のステータス行でマウスの左ボタンか右のボタンをクリックするこ +とでそのウィンドウがカレントウィンドウになる。これはボタンを放したときに起こる +(クリックとドラッグの操作を区別するため)。 + +左ボタンを使ってステータス行を上下にドラッグすると、ウィンドウのサイズを上下に +変更できる。この操作ではそのウィンドウはカレントウィンドウにならない。 + +ウィンドウの垂直の区切りも同様に機能する。クリックした区切りの左のウィンドウが +カレントウィンドウになる。左右にドラッグするとウィンドウの幅を変更できる。 + + +3.5 様々なマウスクリック *gui-mouse-various* + + マウスクリックで単語を前方検索する。'mousemodel' が + "popup" のときには、これは選択を開始するか、あるいは延 + 長する。 + マウスクリックで単語を後方検索する。 + マウスクリックでタグ名へジャンプする。 + 直前のタグジャンプの前の位置に戻る("CTRL-T" と同じ)。 + + +3.6 マウスマッピング *gui-mouse-mapping* + +修飾キー付きのマウスイベントをマッピングすることもできる。例えば: > + :map + :map + :map + :map <2-S-LeftMouse> <2-RightMouse> + :map <2-S-LeftDrag> <2-RightDrag> + :map <2-S-LeftRelease> <2-RightRelease> + :map <3-S-LeftMouse> <3-RightMouse> + :map <3-S-LeftDrag> <3-RightDrag> + :map <3-S-LeftRelease> <3-RightRelease> + :map <4-S-LeftMouse> <4-RightMouse> + :map <4-S-LeftDrag> <4-RightDrag> + :map <4-S-LeftRelease> <4-RightRelease> +これらのマッピングは、Motifアプリケーションの作法にしたがって、選択領域を拡張 +するために、マウスの右ボタンを使わずに、Shiftキーを押しながら左ボタンを押す方 +法を設定している。 + +修飾キーを使ったマウス操作のマッピングはモードレス選択では機能しない。 + + +3.7 ドラッグ&ドロップ *drag-n-drop* + +Vimウィンドウに1つ、あるいは複数のファイルをドラッグ&ドロップすることができ +る。ファイルは|:drop|コマンドを使ったときのように開かれる。 + +Shiftキーを同時に押していると、Vimはカレントディレクトリをドロップされた最初の +ファイルがあるディレクトリに変更する。Ctrlキーを同時に押していると、ファイルを +開くためにウィンドウを分割する。押してなければカレントバッファが変更されていな +いときだけファイルは開かれる。 + +ディレクトリをVimにドロップすることもできる。この操作はexplorerプラグインでそ +のディレクトリを開く(それが利用可能だと想定している。無理ならエラーが表示され +るだろう)。Shiftキーを同時に押していれば、ディレクトリを開かずに、カレントディ +レクトリをそのディレクトリに変更する。 + +コマンドラインを編集中なら、ドロップされたファイルやディレクトリの名前がカーソ +ル位置に挿入される。これはExコマンドでそれらの名前を使うのに便利である。特別な +文字(スペース、タブ、ダブルクォート、'|'、MS-Windows以外ではバックスラッシュ +も)はエスケープされる。 + +============================================================================== +4. GUI選択の作成 *gui-selections* + + *quotestar* +マウス(|gui-mouse-select|を参照)か、あるいはVimのビジュアルモード(|v|を参照)を +使用して、選択を作成できる。'guioptions' に 'a' が指定されているなら、いつ選択 +(ビジュアルモードや選択モード)が開始されるとしても、あるいは選択が変更されると +しても、Vimがウィンドウシステムの主要な選択の所有者になる(MS-Windowsで +は|gui-clipboard|が用いられる。X11では|x11-selection|が用いられる。ここの説明 +は両方に共通している)。 + + *clipboard* +選択を保存するための特別なレジスタがある。それは "* レジスタである。どのテキス +トが選択されているかという情報が(例えばマウスの左ボタンをクリックするなどして) +変更されるか、あるいは他のアプリケーションが選択されたテキストを貼り付けようと +しない限りここには何も書き出されない。使用されるときにはテキストは "* レジスタ +に書き出される。例えば、行を切り取って、それを現在の選択にして、クリップボード +にそれを書き出すためには次のようにする: > + + "*dd + +同様に、例えば、マウスの中ボタンをクリックするなどして、他のアプリケーションか +ら選択を貼り付けるときには、選択は始めに "* レジスタに書き出され、それから他の +レジスタと同じように挿入される。例えば、選択(クリップボードの内容)を貼り付ける +には: > + + "*p + +X11でこのレジスタを使うには、|x11-selection|も参照。これは深く関連した "+ レジ +スタについても説明している。 + +あるVimから他の独立したVimにテキストを貼り付けたいときには、選択のタイプ(文 +字、行あるいは矩形)もコピーされることに注意する。他のアプリケーションについて +は、タイプは常に文字である。|x11-cut-buffer|を介して得たテキストでも、その選択 +のタイプは常に失われる。 + +'clipboard' オプションに "unnamed" 文字列が含まれているときには、無名レジスタ +は "* レジスタと同じである。したがってコマンドの前に "* を付けずに選択をコピー +し貼り付けることができる。 + +============================================================================== +5. メニュー *menus* + +まずはユーザーマニュアルの|usr_42.txt|を御覧ください。 + +5.1 メニューの使用 *using-menus* + +基本的には、メニューは単にマッピングのように使用することができる。自分のメ +ニューを好きなだけたくさん定義することができる。 +長い間Vimユーザーはメニューを十分に使用してこなかった。しかし自分のメニューや +メニュー項目を追加することは大きな力を秘めている。ある一連のキー操作を覚えられ +ないようなときに最も便利である。 + +別の言語用にメニューを作成するには、|:menutrans|を参照。 + + *menu.vim* +標準のメニューは "$VIMRUNTIME/menu.vim" ファイルから読み込まれる。パスがどこを +指すかについては|$VIMRUNTIME|を参照。ユーザーは自分のメニューを設定することが +できる。その際に標準のメニューを利用するのはいい考えである。メニューに項目を追 +加したり、あるいは、標準のメニューが気に入らなければ、全てのメニューを取り除く +ことができる|:unmenu-all|。.vimrcファイル(.gvimrcファイルではない!)にこの行を +追加することで標準のメニューが読み込まれないようにすることもできる: > + :let did_install_default_menus = 1 +メニュー項目のSyntax(シンタックス)も無効にしたいなら: > + :let did_install_syntax_menu = 1 +メニュー項目のSyntax(シンタックス)は欲しいが、利用可能なシンタックスファイルの +一覧はいらないなら(これを読み込むのは多少の時間を必要とするので): > + :let skip_syntax_sel_menu = 1 +Syntax メニューの最初の項目{訳注:「対応形式をメニューに表示」}を使うと、利用可 +能な全てのファイルタイプをメニューに表示できる(読み込みに少し時間がかかるかも +しれない)。起動時に全てのファイルタイプが表示されているようにしたければ次の行 +を加える: > + :let do_syntax_sel_menu = 1 + +< + *console-menus* +このドキュメントはGUIの項目であるけれども、CUI版のVimでも実際にメニューを使用 +することができる。そのときには明示的に|menu.vim|を読み込まなければならないだろ +う。それは標準では設定されない。ほぼ実際のメニューシステムのようにメニューの項 +目にアクセスするために 'wildmenu' を設定して|:emenu|コマンドの使用時にコマンド +ライン補完を使用することができる。これをするには、.vimrcファイルに次のコマンド +を付加しておく: > + :source $VIMRUNTIME/menu.vim + :set wildmenu + :set cpo-=< + :set wcm= + :map :emenu +メニューを開始するにはを押す。そのときにはメニューのエントリを選択するため +にカーソルキーを使用することができる。それを実行するにはを入力する。 +キャンセルするにはを入力する。これはコンパイル時に|+menu|機能を有効にする +必要がある。 + + *tear-off-menus* +GTK+ 2 と Motif は切取りメニュー(Tear-offメニュー)をサポートする。これは少し変 +わったメニューで、ポップアップメニューが常に表示されるようなものである。メニュー +のウィンドウのサイズの変更が正確に機能しないなら、これはリソースに +"Vim*geometry" のように設定していることが原因かもしれない。もしそうなら代わり +に "Vim.geometry" を使用する。 + +GTK+ 3 では、GTK+ 3.4 から切取りメニューが非推奨となった。よって、GTK+ 3.4 以 +降とリンクされた gvim ではこの機能は無効化される。 + +Win32 GUIバージョンはMotifの切取りメニューをエミュレートする。Motifユーザーな +ら簡単に違いを確認できるだろうが、同じように便利に使えると思う。|:tearoff|コマ +ンドと|hidden-menus|を利用して、メインのメニューバーに項目を作らずに切取りメ +ニューを作ることができる。 + + +5.2 新しいメニューの作成 *creating-menus* + + *:me* *:menu* *:noreme* *:noremenu* + *:am* *:amenu* *:an* *:anoremenu* + *:nme* *:nmenu* *:nnoreme* *:nnoremenu* + *:ome* *:omenu* *:onoreme* *:onoremenu* + *:vme* *:vmenu* *:vnoreme* *:vnoremenu* + *:xme* *:xmenu* *:xnoreme* *:xnoremenu* + *:sme* *:smenu* *:snoreme* *:snoremenu* + *:ime* *:imenu* *:inoreme* *:inoremenu* + *:cme* *:cmenu* *:cnoreme* *:cnoremenu* + *E330* *E327* *E331* *E336* *E333* + *E328* *E329* *E337* *E792* +新しいメニュー項目を作るには、":menu" コマンドを使用する。これはほとんど ":map" +のコマンド群と同じだが最初の引数はメニュー項目の名前であり、'.' で区切ったメ +ニューとサブメニューのパスとして与えられる。例えば: > + + :menu File.Save :w + :inoremenu File.Save :w + :menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g + +この最後の1つはメニューバーに "Edit" という新しい項目を作る、そしてその上でマ +ウスのボタンを押すと "Big Changes" という項目を含んだメニューが表示されるだろ +う。"Big Changes" は "Delete All Spaces" という項目を含むサブメニューを持って +いて、その項目を選択すると操作が実行される。 + +メニュー名での特殊文字: + & この文字の次の文字はショートカットキーである。どのショートカッ + トキーも(サブ)メニューの中で1度だけしか使用されていないことを + 確認すること。メニュー名に "&" を入れるには "&&" とする。 + メニューの名前をそこで区切って以降を右詰めにする。実行する操作 + をそろえて表示するのに便利である。使いやすいように文字として + "" をそのまま書けばいいようになっている。本当のTab文字を + 使用するなら、その前にバックスラッシュを付けること! +例: > + + :amenu &File.&Open:e :browse e + +[文字通りタイプする] +(キーと同時に)ショートカットキーの "F" を押し、それから "O" を押すと、こ +のメニューを使用できる。Openの項目は "Open :e" のように表示される。":e" は +右詰めされ、"O" にはショートカットであることを示すために下線が引かれる。 + +":amenu" コマンドは全てのモードで使えるメニューの項目を1度に定義することができ +る。コマンドを正確に機能させるために、いくつかのモード用に自動的に文字が付加さ +れる: + モード 前に付加 後ろに付加 ~ + ノーマルモード なし なし + ビジュアルモード + 挿入モード + コマンドラインモード + オペレータ待機モード + +後ろに付加されるCTRL-\ CTRL-Gは 'insertmode' が設定されているときには挿入モー +ドに戻る。|CTRL-\_CTRL-G|を参照。 + +例: > + + :amenu File.Next :next^M + +は以下と同じである: > + + :nmenu File.Next :next^M + :vmenu File.Next ^C:next^M^\^G + :imenu File.Next ^\^O:next^M + :cmenu File.Next ^C:next^M^\^G + :omenu File.Next ^C:next^M^\^G + +注意: 挿入モードでは1つのノーマルモードのコマンドに対してだけ機能する。これは +CTRL-Oの仕様による。2つ以上のコマンドを使うには、":imenu" コマンドを使用する必 +要がある。どのモードでもテキストを挿入するために式レジスタ('=' レジスタ)を使用 +することができる: > + + :amenu Insert.foobar "='foobar'P + +Note: 'cpoptions' の中の '<' フラグと 'k' フラグが適用される(含まれていたとき +には、<>による特殊キーの書式や生のキーコードは認識されない)。 + +Note: コマンドラインモードでのはマッピングで使用されたときと同様に(入力を +キャンセルするのではなく)コマンドを実行する。これはVi互換である。コマンドライ +ンモードを終了するにはCTRL-Cを使用する。 +{訳注: |c_|を参照} + + *:menu-* *:menu-silent* +実行したコマンドをコマンドラインに表示しないようなメニューを定義するには、最初 +の引数に "" を加える。例: > + :menu Settings.Ignore\ case :set ic +これでこのメニューを使っても ":set ic" はコマンドラインに表示されない。それで +も実行したコマンドの出力は表示される。それを表示しないようにするには、 +":silent" を付けてコマンドを実行する: > + :menu Search.Header :exe ":silent normal /Header\r" +"" は "" や " + +スクリプト言語を永続的にインストールするには|mysyntaxfile-add|を参照。 + + +APACHE *apache.vim* *ft-apache-syntax* + +apacheの構文ファイルはApache HTTPサーバーのバージョンに基づいた構文ハイライト +を提供する(デフォルトでは1.3.x)。他のバージョン用の構文ハイライトを利用するに +は "apache_version" にApacheのバージョンを文字列としてセットする。例: > + + :let apache_version = "2.0" +< + + *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k* +アセンブリ言語 *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax* + *ft-masm-syntax* *ft-asm68k-syntax* *fasm.vim* + +"*.i" にマッチする名前のファイルのタイプはProgressかアセンブリである。自動検出 +が動作しない場合や、Progressを編集しないことが判っている場合には、起動設定ファ +イルvimrcに次のコマンドを書くことができる: > + :let filetype_i = "asm" +"asm" には使用するアセンブリ言語の種類を指定する。 + +同じ拡張子を使用しているアセンブリ言語はたくさんある。そのため、ユーザーは自分 +が使っている種類を選択するか、もしくはアセンブリファイルそのものにVimがそれ +と判断できるような行を追加しなければならない。現在は以下の構文ファイルが利用 +可能: + asm GNUアセンブラ(デフォルト) + asm68k モトローラ680x0アセンブラ + asmh8300 日立H-8300用GNUアセンブラ + ia64 インテルItanium 64 + fasm Flat アセンブラ (http://flatassembler.net) + masm マイクロソフトアセンブラ(たぶん80x86汎用) + nasm ネットワイドアセンブラ + tasm ターボアセンブラ(80x86,Pentium,MMXの命令コードを含む) + pic PICアセンブラ(現在はPIC16F84用) + +アセンブリファイルに次のような行を書き加えるのが一番柔軟である: > + asmsyntax=nasm +ここで、"nasm" は実際に使用するアセンブリ構文の名前に置き換えること。この記 +述はファイルの先頭 5 行以内に書いてなければならない。この文字列の前後に非空 +白文字があってはならない。Note asmsyntax=foo を指定するのはモードライン +(|modeline|) で ft=foo と設定するのと同じであり、設定がぶつかったときはモード +ラインの設定が先に処理される (特に、例えばモードラインで ft=asm と設定すると、 +asmsyntax があっても GNU 構文強調表示が使われることになる)。 + +構文の種類はバッファ変数b:asmsyntaxを設定することで常にそちらが優先される: > + :let b:asmsyntax = "nasm" + +自動にしろ手動にしろb:asmsyntaxが設定されていないときには、グローバル変数 +asmsyntaxが使用される。これによりデフォルトのアセンブリ言語を設定することがで +きる: > + :let asmsyntax = "nasm" + +最後の手段として、何も設定されていない場合には、"asm" 構文が使用される。 + + +ネットワイドアセンブラ(nasm.vim)の補助ハイライト ~ + +機能を有効化するには: > + :let {variable}=1|set syntax=nasm +無効化するには: > + :unlet {variable} |set syntax=nasm + +変数 ハイライト内容 ~ +nasm_loose_syntax 非オフィシャルな拡張構文をエラーとしない + (パーサー依存; 非推奨) +nasm_ctx_outside_macro マクロ外のコンテキストをエラーとしない +nasm_no_warn 潜在的に危険な構文をToDoとしてハイライトしない + + +ASPPERL and ASPVBS *ft-aspperl-syntax* *ft-aspvbs-syntax* + +*.aspと*.asaという名のファイルはどちらもPerlもしくはVisual Basicのスクリプトた +りえる。Vimにとってこれを判別するのは難しいので、グローバル変数を設定すること +でどちらを使用するのか宣言することができる。どちらでもPerlスクリプトを使用する +なら: > + :let g:filetype_asa = "aspperl" + :let g:filetype_asp = "aspperl" +Visual Basicを使用するなら次のように設定する: > + :let g:filetype_asa = "aspvbs" + :let g:filetype_asp = "aspvbs" + + +BAAN *baan.vim* *baan-syntax* + +baan.vim は リリース BaanIV から SSA ERP LN まで、3 GL と 4 GL プログラミング +両方に対応した構文を定義している。たくさんの標準的な定義/定数がサポートされて +いる。 + +次を |.vimrc| に書いておくと、ある種のコーディング標準違反を教えてくれる: > + let baan_code_stds=1 + +*baan-folding* + +以下の変数によって、様々なレベルで構文折り畳みを有効にできる (これらはユーザー +の |.vimrc| で設定すること)。ソースブロックと SQL についてより複雑な折り畳みを +行うと CPU に負荷がかかる。 + +折り畳みを有効にし、関数レベルで折り畳みをするにはこうする: > + let baan_fold=1 +次の設定を行うと、if, while, for ... のようなソースブロックレベルの折り畳みが +有効になる。キーワード begin/end の前のインデントが等しくなければならない (ス +ペースとタブは異なるとみなされる)。 > + let baan_fold_block=1 +次を設定すると SELECT, SELECTDO, SELECTEMPTY ... のような埋め込み SQL ブロック +の折り畳みが有効になる。キーワード begin/end の前のインデントが等しくなければ +ならない (スペースとタブは異なるとみなされる)。 > + let baan_fold_sql=1 +Note: ブロック折り畳みを有効にすると、小さな折り畳みがたくさんできるかもしれな +い。|.vimrc| でオプション 'foldminlines' と 'foldnestmax' を |:set| するか、 +.../after/syntax/baan.vim 内で |:setlocal| をする (|after-directory| を参照) +とよいかもしれない。例: > + set foldminlines=5 + set foldnestmax=6 + + +BASIC *basic.vim* *vb.vim* *ft-basic-syntax* *ft-vb-syntax* + +Visual Basicも「通常の」BASICも、どちらも拡張子には ".bas" が使用される。どち +らが使用されているか判別するのに、Vimはファイルの先頭5行以内に "VB_Name" とい +う文字列が存在するかどうかを検査する。存在しなければ、ファイル形式は "basic" +となり、そうでなければ "vb" となる。拡張子が ".frm" のファイルは常にVisual +Basicとして扱われる。 + + +C *c.vim* *ft-c-syntax* + +Cには幾つかの補助的なハイライト方法がある。それらを有効化するには対応した変数 +に値を設定する。例: > + :let c_comment_strings = 1 +これを無効化するには ":unlet" を使う。例: > + :unlet c_comment_strings + +変数 ハイライト内容 ~ +*c_gnu* GNU gcc固有の要素 +*c_comment_strings* コメント内の文字列と数値 +*c_space_errors* 行末の空白文字とタブ文字前のスペース文字 +*c_no_trail_space_error* ... 但し行末の空白文字は除外 +*c_no_tab_space_error* ... 但しタブ文字前のスペース文字は除外 +*c_no_bracket_error* []の中の{}をエラーとして表示しない +*c_no_curly_error* { と } が第1桁にあるときを除き、[] と () の内側の {} + をエラーとして表示しない。 + デフォルトでエラーとして表示される。欠落した ")" を見 + つけられないため。 +*c_curly_error* 対応する { がない } をハイライトする。これを有効にする + と、ファイルの先頭から同期が始まるため、遅くなる +*c_no_ansi* ANSI標準の型と定数をハイライトしない +*c_ansi_typedefs* ... 但し標準ANSI型はハイライトする +*c_ansi_constants* ... 但し標準ANSI定数はハイライトする +*c_no_utf* 文字列中の\uと\Uをハイライトしない +*c_syntax_for_h* ファイル *.h に C++ ではなく C の構文を適用し、objcpp + ではなく objc の構文を適用する。 +*c_no_if0* "#if 0" のブロックをコメントとしてハイライトしない +*c_no_cformat* 文字列中の "%" によるフォーマットをハイライトしない +*c_no_c99* C99の標準アイテムをハイライトしない +*c_no_c11* C11の標準アイテムをハイライトしない +*c_no_bsd* BSD 特有の型をハイライトしない + +'foldmethod' が "syntax" に設定されていると、/* */ のコメントと { } のブロック +が折り畳まれる。コメントを折り畳みたくなければこのようにする: > + :let c_no_comment_fold = 1 +"#if 0" のブロックも同様に折り畳まれる。折り畳みたくなければこのようにする: > + :let c_no_if0_fold = 1 + +上方向にスクロールしているときにハイライト表示がおかしくなり、それがで +再描画すると直るようなら、内部変数 "c_minlines" にもっと大きな値を設定すれば解 +決できるかもしれない: > + :let c_minlines = 100 +これにより構文判定のシンクロナイズ位置が表示開始行の100行手前に設定される。初 +期設定の値は50行(c_no_if0を使用した場合は15行)である。ただしこれには、大きな値 +を設定すると再描画が遅くなるという短所がある。 + +"#if 0" / "#endif" のブロックをコメントとしてハイライトしている場合には、 +"#if 0" がウィンドウのトップから "c_minlines" 以内にある時にしか正しく動作しな +いことに注意する。長い "#if 0" のブロックを使用した場合には、それは正しくハイ +ライトされない。 + +コメント内で追加要素にマッチを行うには、クラスタcCommentGroupを使用する。 +例: > + :au Syntax c call MyCadd() + :function MyCadd() + : syn keyword cMyItem contained Ni + : syn cluster cCommentGroup add=cMyItem + : hi link cMyItem Title + :endfun + +ANSIの定数はグループ "cConstant" でハイライトされる。これには "NULL", "SIG_IGN" +やその他のものが含まれる。しかしANSI標準でないもの、例えば "TRUE" は含まれな +い。もしもこれが紛らわしいならば、cConstant用のハイライトを削除する: > + :hi link cConstant NONE + +文法上エラーではないはずの '{' と '}' がエラーとしてハイライトされてしまう場合 +には、cErrInParen及びcErrInBracketのハイライトをリセットする。 + +Cファイルで折り畳みをするには、以下の行を 'runtimepath' 中の "after" ディレク +トリ内のファイルに加えるとよい。Unixなら~/.vim/after/syntax/c.vimに加えるとよ +いだろう: > + syn sync fromstart + set foldmethod=syntax + +CH *ch.vim* *ft-ch-syntax* + +C/C++ インタープリター。Ch は C に似た構文ハイライトを持ち、C の構文ファイルに +基づいている。C で利用できる設定については |c.vim| を参照。 + +変数を設定すれば、*.h ファイルに対して C, C++ でなく Ch の構文を使うようにする +ことができる: > + :let ch_syntax_for_h = 1 + + +CHILL *chill.vim* *ft-chill-syntax* + +Chillの構文ハイライトはCに似ている。設定に関しては|c.vim|を参照。それに加えて +次のものがある: + +chill_space_errors c_space_errors と同様 +chill_comment_string c_comment_strings と同様 +chill_minlines c_minlines と同様 + + +CHANGELOG *changelog.vim* *ft-changelog-syntax* + +ChangeLogでは行頭のスペースのハイライトできる。これをオフにしたいなら、次の行 +を .vimrc に加える: > + let g:changelog_spacing_errors = 0 +これは次にchangelogファイルを編集するときから有効になる。バッファごとに設定す +るには "b:changelog_spacing_errors" を使う(構文ファイルを読み込む前に設定する +こと)。 + +例えばスペースをエラーとするかどうかなどのハイライト方法を変えることができる: > + :hi link ChangelogError Error +ハイライトをやめるには: > + :hi link ChangelogError NONE +これは即座に有効になる。 + + +CLOJURE *ft-clojure-syntax* + +デフォルト構文グループは、変数 *g:clojure_syntax_keywords* や +*b:clojure_syntax_keywords* を用いて追加できる。値には構文グループの名前をキー +とし、値にカスタム識別子の|List|を持つ|Dictionary|を指定する: +> + let g:clojure_syntax_keywords = { + \ 'clojureMacro': ["defproject", "defcustom"], + \ 'clojureFunc': ["string/join", "string/replace"] + \ } +< +有効な構文グループについては、Clojure 構文スクリプトを参照。 + +バッファ変数(|buffer-variable|) *b:clojure_syntax_without_core_keywords* がセッ +トされると、言語定数と特定のフォームにのみマッチする。 + +*g:clojure_fold* を設定するとシンタックスエンジンに基づいた Clojure コードの折 +り畳みが有効化される。複数行に渡るリスト、ベクタ、マップなどを標準の Vim を +使って折り畳みできる |fold-commands|。 + +このオプションは rainbow-parentheses プラグインのような、角カッコの構文範囲を +変更するようなスクリプトを使っているときは機能しない。 + +このオプションは初期設定でオフになっている。 +> + " 初期設定 + let g:clojure_fold = 0 +< + +COBOL *cobol.vim* *ft-cobol-syntax* + +既存のCOBOLコードに要求されるハイライト方法と、新規に開発されるコードに要求さ +れるそれには違いがある。この違いはコードのおかれている状況(保守 vs 開発)やその +他の要素によって決定する。既存コードのハイライトを行うには .vimrc に次の行を加 +える: > + :let cobol_legacy_code=1 +これを再び無効にするには次のようにする: > + :unlet cobol_legacy_code + + +COLD FUSION *coldfusion.vim* *ft-coldfusion-syntax* + +ColdFusionには独自版のHTMLコメントが存在する。ColdFusionのコメントハイライトを +有効化するには、次の行を起動設定ファイルに加える: > + + :let html_wrong_comments=1 + +ColdFusionの構文ファイルはHTML用構文ファイルに基づいている。 + + +CPP *cpp.vim* *ft-cpp-syntax* + +大部分は |ft-c-syntax| と同じ。 + +変数 強調表示 ~ +cpp_no_cpp11 C++11 標準のアイテムを強調表示しない +cpp_no_cpp14 C++14 標準のアイテムを強調表示しない + + +CSH *csh.vim* *ft-csh-syntax* + +これは "csh" という名前のシェルに対応している。システムによっては実際に使われ +ているのがtcshである場合もあることに注意。 + +ファイルがcshかtcshかを判定するのは難しいことがよく知られている。いくつかのシ +ステムでは/bin/cshを/bin/tcshにシンボリックリンクしていることが、この判別をほ +ぼ不可能にしている。Vimが間違った判定をする場合には変数 "filetype_csh" を設定 +することができる。cshを使うには: *g:filetype_csh* +> + :let g:filetype_csh = "csh" + +tcshを使うには: > + + :let g:filetype_csh = "tcsh" + +拡張子がtcshであるか標準的なtcshファイル名(.tcshrc, tcsh.tcshrc, tcsh.login)を +持つスクリプトはすべてtcshファイル形式とされる。他のtcsh/cshスクリプトは、 +"filetype_csh" 変数が存在しない限り、すべてtcshとみなされる。変数 +"filetype_csh" が存在するならファイル形式はその値にセットされる。 + + +CYNLIB *cynlib.vim* *ft-cynlib-syntax* + +Cynlibファイルは、ハードウェアのモデリングとシミュレーションを行うCynlibクラス +ライブラリを使用したC++ファイルである。通常Cynlibのファイルは.ccや.cppという拡 +張子を持つので、CynlibではないC++ファイルと区別するのは非常に困難である。だか +ら.ccファイルをCynlibでハイライトする際には、ファイル.vimrcに次の行を加える: +> + + :let cynlib_cyntax_for_cc=1 + +cppファイルについても同様(この拡張子は通常Windowsだけで使用される) > + + :let cynlib_cyntax_for_cpp=1 + +これらを再び無効にするには次のコマンドを使用する: > + + :unlet cynlib_cyntax_for_cc + :unlet cynlib_cyntax_for_cpp +< + +CWEB *cweb.vim* *ft-cweb-syntax* + +"*.w" にマッチする名前のファイルのタイプはProgressかCWEBである。自動検出が動作 +しない場合や、Progressを編集しないことが判っている場合には、起動設定ファイル +vimrcに次のコマンドを書くとよい: > + :let filetype_w = "cweb" + + +DESKTOP *desktop.vim* *ft-desktop-syntax* + +この構文ファイルの本来の目的は、freedesktop.org 標準の .desktop と .directory +を構文ハイライトすることである: +http://standards.freedesktop.org/desktop-entry-spec/latest/ +しかし実際にはこの標準を完全に実装したものはほとんどない。なのでこれは全ての +iniファイルをハイライトする。ただし次をvimrcファイルに書くことによって厳格に標 +準に準拠したハイライトをさせることもできる: > + :let enforce_freedesktop_standard = 1 + + +DIFF *diff.vim* + +diff 構文ハイライトは、通常ローカライズされた {訳注:英語以外の} diff ヘッダも +検出する。ファイルにとても長い行が含まれる場合、この機能は低速になる。ローカラ +イズヘッダへの対応を無効化するには: > + + :let diff_translations = 0 + +|diff-slow|も参照。 + + +DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* + +dircolorsユーティリティ用のハイライト定義には、Slackware GNU/Linuxディストリ +ビューション版のdircolorsに対応するためのオプションがある。このオプションはほ +とんどのバージョンでは無視されるいくつかのキーワードを付け加える。しかし +Slackwareシステムではdircolorsはこれらのキーワードを認め、処理に用いる。 +Slackwareキーワードを有効化するには次を起動設定ファイルに付け加えればよい: > + let dircolors_is_slackware = 1 + + +DOCBOOK *docbk.vim* *ft-docbk-syntax* *docbook* +DOCBOOK XML *docbkxml.vim* *ft-docbkxml-syntax* +DOCBOOK SGML *docbksgml.vim* *ft-docbksgml-syntax* + +DocBookファイルには2つの種類: SGMLとXMLがある。どちらのタイプを使用するのかを +指定するには変数 "b:docbk_type" をセットする。Vimがそのタイプを認識できた場合 +にはこれを自動的に行う。認識できなかった場合にはデフォルトはXMLになる。 +これを手動で設定するには: > + :let docbk_type = "sgml" +または: > + :let docbk_type = "xml" +これは構文ファイルを読み込む前に行う必要がある。しかし構文ファイルの読み込みは +込み入っている。より単純な方法はファイル形式を "docbkxml" または "docbksgml" +にセットすることである: > + :set filetype=docbksgml +または: > + :set filetype=docbkxml + +DocBook のバージョンを指定できる: > + :let docbk_ver = 3 +設定しない場合は 4 が使われる。 + + +DOSバッチファイル *dosbatch.vim* *ft-dosbatch-syntax* + +DOSバッチファイルのハイライトにはオプションが1つある。このオプションにより +Windows 2000で導入されたコマンドインタープリターの新しい拡張機能がサポートされ、 +変数dosbatch_cmdextversionによりその有効/無効が制御される。Windows NTでは値1を +設定し、Windows 2000では2を設定するのが良い。次のようにすれば使用するバージョン +を選択できる: > + + :let dosbatch_cmdextversion = 1 + +変数が定義されていない際のデフォルトはWindows 2000をサポートする2となる。 + +2番目のオプションは、*.btm ファイルを "dosbatch" (MS-DOS バッチファイル) タイ +プか "btm" (4DOS バッチファイル) タイプのどちらと判定するかを指定する。デフォ +ルトでは後者が使われる。前者を使うには、次のようにする: > + + :let g:dosbatch_syntax_for_btm = 1 + +この変数が定義されていない、または0であると btm の構文が使われる。 + +DOXYGEN *doxygen.vim* *doxygen-syntax* + +Doxygen は JavaDoc に似た特殊なフォーマットからコードのドキュメントを生成する。 +この構文スクリプトは c, cpp, idl, php のファイルに対して Doxygen のハイライ +トを追加する。また、Java に対しても使える。 + +Doxygen のフォーマットを有効にするにはいくつかの方法がある。手動、またはモード +ラインでそのファイルの syntax に '.doxygen' を追加する。例: > + :set syntax=c.doxygen +または > + // vim:syntax=c.doxygen + +C, C++, C#, IDL, PHP のファイルに対しては、グローバルまたはバッファローカルな +変数 load_doxygen_syntax を設定すれば自動的にこれが行われる。次の行を .vimrc +に加える。 > + :let g:load_doxygen_syntax=1 + +構文ハイライトに影響を与える変数がいくつかある。また、これらは標準でないハイラ +イトオプションに関係している。 + +変数 既定値 効果 ~ +g:doxygen_enhanced_color +g:doxygen_enhanced_colour 0 Doxygen コメントに対して標準でないハイ + ライトを行う。 + +doxygen_my_rendering 0 HTML の太字、斜体、html_my_rendering + に対する下線の描画を無効にする。 + +doxygen_javadoc_autobrief 1 0にすると JavaDoc の autobrief に対す + るハイライトを無効にする。 + +doxygen_end_punctuation '[.]' brief の終わりを示す句読点にマッチする + 正規表現。 + +また、次のハイライトグループを設定すると便利である。 + +ハイライト 効果 ~ +doxygenErrorComment code, verbatim, dot セクション中で句読点が抜け + ている終了コメントの色 +doxygenLinkError \link セクションで \endlink が抜けているときの + 終了コメントの色。 + + +DTD *dtd.vim* *ft-dtd-syntax* + +初期状態ではDTD構文ハイライトは大/小文字を区別する。区別しないようにするには、 +起動設定ファイルに次の行を書き足す: > + + :let dtd_ignore_case=1 + +DTD構文ファイルでは未知のタグをエラーとしてハイライトする。これが煩わしいなら +ば、構文ファイルdtd.vimが読込まれる前に: > + + :let dtd_no_tag_errors=1 + +と設定することで無効化することができる。定義部内のパラメーターのエンティティ名 +はハイライトグループ 'Type'、句読点と '%' は 'Comment' を使用してハイライトさ +れる。パラメーターエンティティの実体はハイライトグループ 'Constant' を、区切り +文字の%と;はハイライトグループ 'Type' を使用してハイライトされる。以下を設定す +るとこれを無効化できる: > + + :let dtd_no_param_entities=1 + +XML内の埋め込みDTDをハイライト表示するために、DTDの構文ファイルはxml.vimからも +参照される。 + + +EIFFEL *eiffel.vim* *ft-eiffel-syntax* + +Eiffelは大小文字の区別をしないけれども、スタイルガイドラインが示すように、構文 +ハイライトではそれらが区別される。これにより大小文字が違えば違うクラス名として +ハイライト表示することが可能になっている。大小文字の違いを無視してハイライトを +行うならば、起動設定ファイルに次の行を書き足す: > + + :let eiffel_ignore_case=1 + +これを行ってもコメント内のクラス名とTODOの印には大小文字の区別がなされる。 + +逆に、もっと厳密に検査するには、次の行のいずれかを書き足す: > + + :let eiffel_strict=1 + :let eiffel_pedantic=1 + +eiffel_strictを設定すると "Current", "Void", "Result", "Precursor" そして +"NONE" の5つの既定単語について、不正な大小文字の使用を捕捉し、機能やクラス名と +してそれらが使用されれば警告を与えるようになる。 + +eiffel_pedanticを設定すると、Eiffelのスタイルガイドラインを相当に厳格に強制す +る。(キーワードを大文字で書く時代遅れの方法と同様に、大小文字を任意にミックス +したようなものが捕捉される) + +"Current", "Void", "Result" そして "Precursor" の小文字版を使用するには、大小 +文字を区別するハイライト方法を無効化する代わりに: > + + :let eiffel_lower_case_predef=1 + +という方法を使うことができる。 + +ISEが提案し、実験的に幾つかのコンパイラでは取り扱うことのできる、新しい生成構 +文は次のコマンドで使用できるようになる: > + + :let eiffel_ise=1 + +最後に幾つかのベンダーは16進数定数値をサポートしている。それを取り扱うには: > + + :let eiffel_hex_constants=1 + +この行を起動設定ファイルに書き足す。 + + +EUPHORIA *euphoria3.vim* *euphoria4.vim* *ft-euphoria-syntax* + +Euphoria には二つの構文強調表示ファイルがある。一つは Euphoria バージョン +3.1.1 用で、初期設定ではこれが使われる。もう一つは Euphoria 4.0.5 以降用であ +る。 + +Euphoria バージョン 3.1.1 (http://www.rapideuphoria.com/) は DOS プラット +フォームのアプリケーションの開発にまだ必要とされている。Euphoria バージョン 4 +(http://www.openeuphoria.org/) はそれをサポートしていない。 + +以下の拡張子のファイルは自動的に Euphoria ファイルタイプとして認識される: + + *.e, *.eu, *.ew, *.ex, *.exu, *.exw + *.E, *.EU, *.EW, *.EX, *.EXU, *.EXW + +Euphoria の構文強調ファイルを選択するには (*.e や *.E 拡張子のファイルが自動的 +に Euphoria ファイルタイプとして認識された場合でも)、次の行を設定ファイルに加 +える: > + + :let filetype_euphoria="euphoria3" + + または + + :let filetype_euphoria="euphoria4" + + +ERLANG *erlang.vim* *ft-erlang-syntax* + +Erlang は Ericsson が開発した関数型プログラミング言語である。次の拡張子のファ +イルが Erlang ファイルとして認識される: erl, hrl, yaws + +組み込み関数 (BIFs: built-in functions) は初期設定で強調表示される。それを無効 +化するには vimrc で次のように設定する: > + + :let g:erlang_highlight_bifs = 0 + +いくつかの特殊アトムを強調表示するには、vimrc で次のように設定する: > + + :let g:erlang_highlight_special_atoms = 1 + + +FLEXWIKI *flexwiki.vim* *ft-flexwiki-syntax* + + +FlexWiki は http://www.flexwiki.com で入手できる ASP.NET ベースの wiki パッ +ケージである。 +NOTE: このサイトは現在機能していない。Wikipedia によると 2009 年に開発がストッ +プした。 + +FlexWiki の構文のほとんどの一般的な要素に対して構文ハイライトができる。 +FlexWiki のtplugin スクリプトはバッファローカルなオプションを設定し、FlexWiki +ページの編集をより便利にする。FlexWiki は改行を新しい段落の開始とみなすので、 +このftplugin は 'tw' を0に設定し (行の長さを制限しない)、'wrap' をオンにし (長 +い行を水平スクロールさせるのでなく、折り返す)、'linebreak' をオンにする (画面 +上の最後の文字でなく 'breakat' の文字で折り返す)、などを行う。また、デフォルト +では無効にされているキーマップも含んでいる。 + +"j"、"k"、カーソルキーで表示行単位で移動するようにするキーマップを有効にするに +は次を .vimrc に追加する: > + :let flexwiki_maps = 1 + + +FORM *form.vim* *ft-form-syntax* + +FORMファイルの構文要素に使用するカラースキームには、Conditional, Number, +Statement, Comment, PreProc, Type, そしてStringが、次の文献で定義される言語仕 +様に沿って行われる。 +文献: 'Symbolic Manipulation with FORM' by J.A.M. Vermaseren, CAN, + Netherlands, 1991. + +初期設定の色に変更を加えるには、次の構文グループを再定義すれば良い: + + - formConditional + - formNumber + - formStatement + - formHeaderStatement + - formComment + - formPreProc + - formDirective + - formType + - formString + +構文ファイルform.vimではFORMプリプロセッサーコマンドとディレクティブをそれぞれ、 +デフォルトでは同じ構文グループにしていることに注意。 + +FORM用の既定の拡張カラーモードではヘッダー命令とFORMプログラム本体での命令を区 +別できるような色設定が利用可能である。拡張カラーモードを使用可能にするには、 +ファイルvimrcに次の設定を書き足す: > + + :let form_enhanced_color=1 + +拡張モードを使うことは、gvimで暗いディスプレイを使用した場合にも利点がある。命 +令文は黄色ではなく明るい黄色で表示され、条件文は視認性のため明るい青で表示され +る。 + + +FORTRAN *fortran.vim* *ft-fortran-syntax* + +デフォルトのハイライトと方言 ~ +初期設定では Fortran 2008 に適したハイライトが行われる。Fortran 2008 は以前の +バージョン (Fortran 2003, 95, 90, 77) のほぼ上位互換であるため、この初期設定は +ほとんどのユーザーにとって適しているだろう。 + +Fortranソースコードの形式 ~ +Fortran のソースコードには固定形式と自由形式が有る。形式が誤って設定されている +と構文ハイライトが正しくされないことに注意。 + +新規にFortranのファイルを作成する場合には、構文ファイルは固定形式であると仮定 +する。常に自由形式を使う場合には > + :let fortran_free_source=1 +これを .vimrc でコマンド :syntax を実行する前に行う必要がある。常に固定形式を +使うには > + :let fortran_fixed_source=1 +これも.vimrcでコマンド:syntaxを実行する前に行う必要がある。 + +ソースコードの形式もしくは標準的な方法ではないがファイルの拡張子に依存する場 +合、もっとも簡単な方法は ftplugin の中で fortran_free_source を設定する。 +ftplugin ファイルのより詳細な情報は |ftplugin| を参照。 +Note あなたの .vimrc ファイルで "filetype plugin indent on" コマンドを "syntax +on" よりも前に実行した場合にのみ動作する事に注意する。 + +既存の Fortran ファイルを編集する時には、変数 fortran_free_source が設定されて +いれば構文ファイルは自由形式のソースであると仮定し、変数 +fortran_fixed_source が設定されていれば固定形式のソースであると仮定する。ど +ちらも設定されていない場合は、ifort, gfortran Cray, NAG, PathScale コンパイ +ラ(.f, .for, 固定形式の .f77, .f90, .f95, .f03, 自由形式の .f08)の共通的な拡 +張子の変換を試みてどのソースが使われているのかを判定する。それでもうまく行かな +い場合はファイルの先頭250行の行頭5カラムを調べて、その形式が固定形式なのか自 +由形式なのかの判定を試みる。自由形式のコードの兆候が見られない場合には、固 +定形式であると見なされる。このアルゴリズムはほとんどのケースにおいて有効に機 +能する。しかしいくつかのケース、例えば先頭500行以上が行コメントで占められてい +るようなファイルでは、構文ファイルが固定形式の fortran のコードであると誤った +判断をしてしまうかもしれない。そのような場合には、ファイルの先頭 500行 の行頭5 +桁のどこかに、コメント以外の命令文を追加し、ファイルの保存 (:w) そして再読込 +(:e!) を行う。 + +Fortranファイル内のタブ文字 ~ +標準のFortranではタブ文字は認識されない。固定桁位置での境界を必要とする固定形 +式のFortranソースコードでタブ文字を使用するのは良いアイデアではない。従ってタ +ブ文字はエラーとしてハイライトされる。しかしながらプログラマによってはタブ文字 +を使用することを望む場合があるだろう。Fortranファイルにタブ文字が含まれている +場合には、変数fortran_have_tabsをコマンド :syntax が実行される前に > + :let fortran_have_tabs=1 +このように.vimrcで設定すれば良い。タブ文字を使う場合には残念ながら、構文ファイ +ルによって不正な余白を検出することができなくなる。 + +Fortranファイルの構文による折り畳み ~ +foldmethod=syntaxを使用したいならば、まず変数fortran_foldを > + :let fortran_fold=1 +このようなコマンドで設定しなければならない。これにより構文ファイルはプログラム +単位の領域、プログラム命令文で始まるメインプログラム、サブルーチン、関数、サブ +プログラム、ブロックデータサブプログラム、そしてモジュールといったプログラム単 +位の領域で折り畳みを定義する。同時に変数fortran_fold_conditionalsを > + :let fortran_fold_conditionals=1 +このように設定すると、doループ、ifブロック、そしてselect-case構造の領域が折り +畳まれる。さらに変数fortran_fold_multilinecommentsも > + :let fortran_fold_multilinecomments=1 +このように設定すれば、3行以上にわたって続くコメントの領域が折り畳まれる。大き +なファイルに対してこのように構文による折り畳みを使用すると、非常に遅くなること +に注意。 + +fortran_foldを設定し、fortran_fold_conditionalsか +fortran_fold_multilinecomments(どちらか片方でも両方でも)を設定した場合には、 +foldmethod=syntaxを設定してある時に、Vimはファイルを折り畳む。2つのプログラム +単位の間にあるコメントや空行は折り畳まれない。なぜならそれらは構文によって定義 +されるプログラム単位に属していないからである。 + +より正確なFortranの構文 ~ +変数fortran_more_preciseを > + :let fortran_more_precise=1 +このようなコマンドで設定した場合には、構文ハイライトがより正確になるが動作は遅 +くなる。とりわけ、do、goto、そして算術if命令文に使用される命令ラベルが、do、if、 +selectもしくはforall構造の終端で使用される名前として認識されるようになる。 + +非標準のFortran方言 ~ +構文ファイルは 2 つの Fortran 方言 (f08 と F) をサポートしている。ほとんどの人 +はデフォルトのハイライト (f08) で用が足りるだろう。2008 標準で削除または廃止予 +定となったいくつかの古い構造は todo アイテムとしてハイライトされる。 + +F を使うなら、方言を適切に設定することで、F から除外された他の古い機能は todo +アイテムとしてハイライトされ、そして自由形式のソースコードが仮定される。 + +方言を設定する方法はいくつかある。もしあなたの fortran ファイルがすべて同じ方 +言なら、グローバル変数の fortran_dialect を .vimrc の syntax on より前で設定す +ればよい。値は大文字と小文字が区別される。fortran_dialect に設定できる値は +"f08" か "F" である。fortran_dialect に無効な値を設定した場合は無視される。 + +方言がファイルの拡張子に依存して決定される場合には、ftplugin ファイル内でバッ +ファローカル変数を設定するのが最良の手段である。ftplugin ファイル付いての詳細 +な情報は |ftplugin|を参照。例えば、.f90 という拡張子のすべてのファイルが F サ +ブセットで書かれているなら、ftplugin ファイルには次のようなコードが含まれるだ +ろう > + let s:extfname = expand("%:e") + if s:extfname ==? "f90" + let b:fortran_dialect="F" + else + unlet! b:fortran_dialect + endif +これは.vimrcで "syntax on" より前に "filetype plugin indent on" が書かれていな +いと機能しないことに注意。 + +拡張子によって方言を一意に決定できない場合にはもっと良い制御方法が必要になる。 +各ファイルの先頭 3 行以内にコメントで "fortran_dialect=xx" (xx は F or f8) と +いう命令を書けば方言の設定を上書することができる。 +例えば、古い .f ファイルは古い方言で書かれているが、新しい .f ファイルは F +コードで書きたいような場合、後者を F ファイルとして認識させるには、そのファイ +ルの先頭 3 行以内に Fortran のコメントとして次のように書く > + ! fortran_dialect=F + +この構文ファイルの以前のバージョンでは fortran_dialect の値として "f77", +"f90", "f95", "elf" が設定できた。これらの値が設定されているときは "f08" とし +て扱われる。"elf" を設定していた人は "F" を試してみるといいかもしれない。 + +syntax/fortran.vim スクリプトにはヒントとなるコメントが含まれている。行をコメ +ントアウトしたりコメントを外したりすることで、(a) 非標準またはベンダー固有構文 +の認識を有効化したり、(b) 2008 標準で削除または廃止予定となった機能を todo ア +イテムとしてハイライトしないようにしたりできる。 + +制限事項 ~ +丸カッコチェックは、閉じカッコの不足については捕捉できない。ホレリス定数は認識 +されない。幾つかのキーワードはFortran90の予約語ではないので誤ってハイライトさ +れる。 + +Fortranに関するその他の情報は|ft-fortran-indent|や|ft-fortran-plugin|を参照。 + +FVWM CONFIGURATION FILES *fvwm.vim* *ft-fvwm-syntax* + +*fvwmrc*または*fvwm2rc*というパターンにマッチしないFvwm設定ファイルを認識させ +るには、ファイルmyfiletypefile.vimであなたのシステムに合ったパターンを設定しな +ければならない。具体的には、変数 "b:fvwm_version" にFvwmのメジャーバージョンを +指定し、オプション 'filetype' にfvwmを設定する。 + +例えば、/etc/X11/fvwm2/配下の全てのファイルをFvwm2の設定ファイルと認識させるに +は次のようにする: > + + :au! BufNewFile,BufRead /etc/X11/fvwm2/* let b:fvwm_version = 2 | + \ set filetype=fvwm + +全ての有効な色の名前をVimにハイライトさせるには、システムの色データベース +(rgb.txt)の位置を知らせる必要がある。これには変数 "rgb_file" にその場所を設定 +する。色データベースが/usr/X11/lib/X11/にあるとすれば: > + + :let rgb_file = "/usr/X11/lib/X11/rgb.txt" + +このような内容をファイル.vimrcに追加する。 + + +GSP *gsp.vim* *ft-gsp-syntax* + +GSPページのデフォルトカラーは|html.vim|にて定義され、Javaコード(Javaタグ内部や +インラインのバッククォート内)のカラーは|java.vim|にて定義される。インライン +Javaコードをハイライトするために、|html.vim|で定義される以下のHTMLグループは、 +再定義されている: + + htmlString + htmlValue + htmlEndTag + htmlTag + htmlTagN + +書かれた大抵の場所のインラインJavaコードは適切にハイライトされるが、幾つかの特 +殊なケースではそうはならない。他のHTMLグループ内にインラインJavaコードを書いて +それが正しくハイライトされない場合には、必要な行を|html.vim|からコピーして +gspJavaをconstains節に加えれば、正しくハイライトされるようになる。 + +インラインJavaを示すバッククォートは、目立ちやすくするためにhtmlErrorグループ +でハイライトされる。 + + +GROFF *groff.vim* *ft-groff-syntax* + +groff構文ファイルは|nroff.vim|のラッパーであり、使用例と設定例についてはそこの +下に書かれている注意を参照。このラッパーの目的は、モードラインか個人用のファイ +ル定義ファイル(|filetype.txt|参照)からファイル形式をセットすることにより、 +groff構文拡張を設定することである。 + + +HASKELL *haskell.vim* *lhaskell.vim* *ft-haskell-syntax* + +Haskell構文ファイルは、プレーンHaskellコードとliterate Haskellコード両方を +サポートしている。後者はBirdスタイルとTeXスタイル両方に対応している。Haskell用 +の構文ハイライトはCプリプロセッサー命令もハイライトできる。 + +区切り文字もハイライトさせるには(明るい背景色を使っているなら便利)、次を.vimrc +に書き足す: > + :let hs_highlight_delimiters = 1 +TrueとFalseを通常の識別子と区別してキーワードとして扱うにはこれを書き足す: > + :let hs_highlight_boolean = 1 +プリミティブ型の名前をキーワードして扱うには: > + :let hs_highlight_types = 1 +比較的一般的な型の名前をキーワードとして扱うには: > + :let hs_highlight_more_types = 1 +デバッグ関数の名前をハイライトさせるには、これを.vimrcに書き足す: > + :let hs_highlight_debug = 1 + +Haskell用の構文ハイライトはCプリプロセッサー命令もハイライトし、#で始まるが命 +令として有効でない行をエラーとして警告する。Haskellの演算子の構文は#で始まるこ +ともあるため、これらが干渉する。これらをエラーでなく演算子としてハイライトした +いなら、次を.vimrcに書く: > + :let hs_allow_hash_operator = 1 + +literate Haskellコード用の構文ハイライトはファイルがTeXマークアップを含んでい +るかどうか、それに応じてTeX要素をハイライトするかどうかを自動的に推測しようと +する。.vimrcに次のような行を書くと、これをグローバルに上書きすることができる > + :let lhs_markup = none +と書くとまったくハイライトしなくする。または > + :let lhs_markup = tex +と書くと常にTeXマークアップをハイライトするように強制する。より柔軟に、この変 +数のバッファローカル版を使うこともできる。例. > + :let b:lhs_markup = tex +と書くと特定のバッファにTeXハイライトさせるようにする。これはそのバッファに構 +文ハイライトを有効化するかファイルを読み込む前に設定しなければならない。 + + +HTML *html.vim* *ft-html-syntax* + +HTMLファイルのタグ用の構文ファイルは以下のように動作する。 + +開きタグの<>は、閉じタグのとは異なった色でハイライトされる。これは意図的に +そうしてある! 開きタグにはハイライト 'Function' が使用され、閉じタグにはハイラ +イト 'Type' が使用される(あなたの環境でこれらがどう定義されているかについては +syntax.vimを参照すること)。 + +既知のタグ名はC命令文と同じようにハイライトされる。未知のタグ名は間違いを見分 +けやすくするために、<>やと同じようにハイライトされる。 + +引数(もしくは属性)名にも同じことが言える。既知の属性名と未知の属性名には異なる +ハイライトがなされる。 + +幾つかのHTMLタグは表示する文字種を変更するために使用される。以下のタグは構文 +ファイルhtml.vimによって認識され、その内容は通常の文字種とは異なる文字種で表示 +される: (のエイリアスとして使われ、 +はのエイリアス)、

-

、、そして<A>、ただしhrefが含まれ +ていてリンクとして使われている(例<A href="somefile.html">)場合。 + +それらのテキストの文字種を変更するには、以下の構文グループを再定義する必要があ +る: + + - htmlBold + - htmlBoldUnderline + - htmlBoldUnderlineItalic + - htmlUnderline + - htmlUnderlineItalic + - htmlItalic + - htmlTitle タイトル用 + - htmlH1 - htmlH6 見出し用 + +この再定義が機能するためには最後の2つを除くすべてを再定義しなければならない。 +最後の2つ、htmlTitleとhtmlH[1-6]は任意である。そして次の変数をvimrcで設定しな +ければならない(初期化の際に読み込まれるファイルの順序のせい)。 > + :let html_my_rendering=1 + +この例については以下からmysyntax.vimをダウンロードすること。 +http://www.fleiner.com/vim/download.html + +次の行をvimrcに加えればこの描画を無効にできる: > + :let html_no_rendering=1 + +HTMLコメントはむしろ特別で(詳細はHTMLリファレンスドキュメントを参照)、すべての +エラーをハイライトする。しかしその間違ったスタイル(<!--で始まり-->で終わる)を +使いたいならこれを定義する > + :let html_wrong_comments=1 + +HTMLドキュメント中に埋め込まれたJavaScriptやVisual Basicについては、文は +'Special' でハイライトされ、コメントや文字列などは標準のプログラミング言語と同 +じように色づけされる。現在のところサポートされているのはJavaScriptとVisual +Basicだけであり、他のスクリプト言語はまだ加えられていない。 + +カスケードスタイルシート(CSS)の埋め込みとインラインもハイライトされる。 + +htmlプロセッサー言語は複数ある。html.vimはインクルードしやすいように簡素に書か +れている。html.vimをインクルードするには以下の2行をその言語用の構文ファイルに +書き足すこと(この例はasp.vimからとった): + + runtime! syntax/html.vim + syn cluster htmlPreproc add=asp + +そしてプリプロセッサー言語を含むすべての領域をクラスタhtmlPreprocに加えればよい。 + + +HTML/OS (by Aestiva) *htmlos.vim* *ft-htmlos-syntax* + +HTML/OS用のカラースキームは以下のように機能する: + +デフォルトでは関数名と変数名は同じである。これは、Vimは関数と識別子に異なる色 +を指定しないためである。これを変えるには(関数名を違う色にしたいならこうすると +よい)次の行を~/.vimrcに書き加える: > + :hi Function term=underline cterm=bold ctermfg=LightGray + +もちろん好みに応じてctermfgは違う色にしてよい。 + +HTML/OSに関するもう1つの問題は、ファイルがHTML/OSコーディングであることを示す +特別なファイル形式が存在しないことである。そのため、ファイルを開いた後に次のよ +うにしてHTML/OS構文をオンにしなければならない: > + :set syntax=htmlos + +HTML/OSコードのブロックの開始と終了を示す文字は、それぞれ<<または[[, +>>または]]のどちらであってもよい。 + + +IA64 *ia64.vim* *intel-itanium* *ft-ia64-syntax* + +Intel Itanium 64アセンブリ言語用のハイライト。このファイル形式を認識させる方法 +については|asm.vim|を参照。 + +*.incファイルをIA64と認識させるには次を.vimrcに書き足す: > + :let g:filetype_inc = "ia64" + + +INFORM *inform.vim* *ft-inform-syntax* + +Inform構文ハイライトはInform Libraryによって提供されるシンボルを含んでいる。ほ +とんどのプログラムがそれを利用しているためである。Libraryのシンボルをハイライ +トさせたくないなら、次をvim初期化ファイルに加える: > + :let inform_highlight_simple=1 + +デフォルトではInformプログラムはZ-machineターゲットと仮定され、Z-machineアセン +ブリ言語シンボルが適切にハイライトされる。もしプログラムがGlulx/Glk環境をター +ゲットとしたものなら、次を初期化ファイルに加える: > + :let inform_highlight_glulx=1 + +こうすると代わりにGlulxオペコードをハイライトし、glk()をシステム関数としてハイ +ライトする。 + +Informコンパイラはある古いキーワードをエラーとみなす。普通、これらのキーワード +はエラーとしてハイライトされる。これをエラーとしてハイライトするのをやめるには、 +次を初期化ファイルに加える: > + :let inform_suppress_obsolete=1 + +デフォルトではハイライトされる言語機能はコンパイラのバージョン6.30とライブラリ +のバージョン6.11に従う。これより古いInform開発環境を使っているなら、次の行を初 +期化ファイルに加えるとよいかもしれない: > + :let inform_highlight_old=1 + +IDL *idl.vim* *idl-syntax* + +IDL (Interface Definition Language) ファイルは RPC 呼び出しを定義するために使 +われる。Microsoft の世界では COM インターフェイスと呼び出しの定義にも使われる。 + +IDL の構造は単純であるため、ヒューリスティックな方法でなく、完全に文法にのっとっ +たアプローチができる。その結果は巨大でいくぶん冗長であるが、一応は機能するよう +である。 + +idl ファイルには Microsoft 拡張がある。それらのうちいくつかは +idl_no_ms_extensions を定義すると無効になる。 + +より複雑な拡張は idl_no_extensions を定義すると無効になる。 + +変数 効果 ~ + +idl_no_ms_extensions Microsoft 独自の拡張の一部を無効にする +idl_no_extensions 複雑な拡張を無効にする +idlsyntax_showerror IDL エラーを表示する (少々うるさいがとても助け + になる) +idlsyntax_showerror_soft エラーに対してデフォルトでよりソフトな色を使う + + +JAVA *java.vim* *ft-java-syntax* + +java.vim構文ハイライトファイルはいくつかのオプションを提供している: + +Java 1.0.2では丸括弧の内側に波括弧が入ることは絶対になかったため、これはエラー +と判断された。Java1.1以降では(無名クラスとともに)これが可能になったため、エ +ラーと判断されなくなった。もし以前のようにしたいなら、vimの初期化ファイルに次 +の行を加えること: > + :let java_mark_braces_in_parens_as_errors=1 + +java.lang.*中の全ての識別子は常に全てのクラスから見える。これらをハイライトす +るには > + :let java_highlight_java_lang_ids=1 +とする。 + +http://www.fleiner.com/vim/download.html にあるスクリプトjavaid.vimをダウンロー +ドすれば、ほとんどのJava標準パッケージの識別子をハイライトすることもできる。 +java.ioなど特定のパッケージの識別子だけをハイライトしたいならばこうする: > + :let java_highlight_java_io=1 +対応している全パッケージのリストはjavaid.vimを参照のこと。 + +関数を認識する方法はJavaコードの書き方に依存するため、関数名はハイライトされな +い。構文ファイルは関数をハイライトする方法を2つ備えている: + +関数宣言が常にタブ、スペース8個、スペース2個のいずれかでインデントされているな +ら > + :let java_highlight_functions="indent" +とするとよいかもしれない。 +しかし、関数とクラスの命名(大文字・小文字についての)に関するJavaガイドラインに +したがっているなら > + :let java_highlight_functions="style" +とすること。 +もしどちらのオプションもだめで、それでも関数宣言をハイライトしたいなら、 +java.vim中の定義を変更するか、もとのjava.vimに関数をハイライトするコードを加え +て自分用のjava.vimを作るかして独自の定義を作るしかない。 + +Java 1.1では、System.out.println()とSystem.err.println()はデバッグのためだけに +使われるものだった。そのためデバッグ用の文を区別してハイライトすることができる。 +それには次の定義を初期化ファイルに加える: > + :let java_highlight_debug=1 +するとデバッグ用の文が 'Special' の文字としてハイライトされるだろう。これらを +別の色でハイライトさせるには、以下のグループに対して新しいハイライトを定義する +こと: + Debug, DebugSpecial, DebugString, DebugBoolean, DebugType +これらはそれぞれ、文、デバッグ文字列に使われる特別な文字、文字列、ブール型定 +数、型(this, super)に使われる。私はこれらの文に異なる背景色をつけることにして +いる。 + +JavadocはJavaプログラム中から特別なコメントを抜き出してHTMLページを作成するプ +ログラムである。標準の設定ではこれらのHTMLコードをHTMLファイル(|html.vim|を参 +照)と同様にハイライトする。さらにこのコードの中にjavascriptとCSSを書くこともで +きる(後述)。しかし4つの違いがある: + 1. タイトル(その後にホワイトスペースが続く最初の '.' まで、または最初の '@' + までのすべての文字)は異なる色でハイライトされる(この色を変更するには + CommentTitleを変えること)。 + 2. テキストは 'Comment' としてハイライトされる。 + 3. HTMLコメントは 'Special' としてハイライトされる。 + 4. 特別なJavadocタグ(@see, @param, ...)はSpecialとして、(@see, @param, + @exceptionなどの)引数はFunctionとしてハイライトされる。 +この機能をオフにするには初期化ファイルに次の行を加えること: > + :let java_ignore_javadoc=1 + +以上のjavadocコメントを使う場合、javascript、visual basicスクリプト、埋め込み +CSS(スタイルシート)のハイライトをすることもできる。これは実際にjavascriptや埋 +め込みCSSを含むjavadocコメントがあるときだけ意味がある。これらを有効化するため +のオプションは次の通り > + :let java_javascript=1 + :let java_css=1 + :let java_vb=1 + +ネストした丸括弧に異なる色をつけるには、javaParen、javaParen1、javaParen2に異 +なる色を定義する。例えば > + :hi link javaParen Comment +あるいは > + :hi javaParen ctermfg=blue guifg=#0000ff + +上方向にスクロールしていてハイライトがおかしくなった場合(CTRL-Lで再描画すると +直る)、内部変数 "java_minlines" を大きくしてみるとよい: > + :let java_minlines = 50 +こうすると表示行の50行前から構文シンクロナイズが始まるようになる。デフォルト値 +は10である。大きな値にすることの不利点は、再描画が遅くなることである。 + + +LACE *lace.vim* *ft-lace-syntax* + +Lace (Language for Assembly of Classes in Eiffel)は大文字・小文字を無視する。 +しかしスタイルガイドラインはそうでない。大文字・小文字を区別してハイライトさせ +るには、vim変数 'lace_case_insensitive' を初期化ファイル中で定義すればよい: > + :let lace_case_insensitive=1 + + +LEX *lex.vim* *ft-lex-syntax* + +"^%%$" セクションデリミタが、その後にどんなセクションが続くかの手がかりを与え +ないため、Lexはブルートフォースなシンクロナイズを行う。それゆえ(巨大なlexファ +イルなどで)同期の問題が起こる場合には: > + :syn sync minlines=300 +の値を変更するとよいかもしれない。 + + +LIFELINES *lifelines.vim* *ft-lifelines-syntax* + +廃止された関数をエラーとしてハイライトしたい場合は .vimrc で次のように設定する +こと: > + + :let g:lifelines_deprecated = 1 +< +LISP *lisp.vim* *ft-lisp-syntax* + +lisp の構文ハイライトには2つのオプションがある: > + + g:lisp_instring : この変数が存在すると "(...)" 形式の文字列が、その中 + 身が lisp であるかのようにハイライトされる。AutoLisp + 用に便利である。 + g:lisp_rainbow : この変数が存在し、0以外であると段階の異なる括弧に + 対して異なるハイライトがつくようになる。 +< +オプション g:lisp_rainbow は括弧とバッククォートされた括弧に対して10段階の異な +る色をつける。色づけ段階の多さのため、rainbow モード自身が ctermfg とguifg を +使ってハイライトを指定する (rainbow モードでない場合はそうではない)。それゆえ、 +ハイライトグループを使う普通のカラースキームの影響を受けない。実際にどうハイラ +イトされるかはdark/bright の設定 (|'bg'| を参照) による。 + + +LITE *lite.vim* *ft-lite-syntax* + +lite構文ハイライトには2つのオプションがある。 + +文字列中でSQL構文ハイライトを行ってほしいならこうする: > + + :let lite_sql_query = 1 + +シンクロナイズの最小行数はデフォルトで100になっている。他の値に変えたいなら +"lite_minlines" をセットすればよい。例: > + + :let lite_minlines = 200 + + +LPC *lpc.vim* *ft-lpc-syntax* + +LPCはシンプルでメモリ効率的な言語、Lars Pensj| Cの略である。LPCのファイル名は +通常*.cである。これらのファイルをLPCと認識するとCプログラムのみを書くユーザーの +迷惑になる。LPC構文を使用したいなら、.vimrcでこの変数をセットすること: > + + :let lpc_syntax_for_c = 1 + +これでも適切に動作しないCまたはLPCのファイルに対してはモードラインを使うこと。 +LPCファイルには: + + // vim:set ft=lpc: + +LPCと認識されてしまうCファイルには: + + // vim:set ft=c: + +変数をセットしたくないなら全てのLPCファイルでモードラインを使うこと。 + +LPCには複数の実装がある。我々はもっとも広く使われているものをサポートしたいと +思っている。デフォルトのLPC文法はMudOSシリーズ用である。MudOS v22以前を使って +いるなら、次をセットすることによりsensible モディファイヤをオフにし、v22以降の +新しいefunを無効にするとよい。MudOSの最新版を使っているときはこの変数をセット +しないこと: > + + :let lpc_pre_v22 = 1 + +LPCのLpMud 3.2シリーズには: > + + :let lpc_compat_32 = 1 + +LPCのLPC4シリーズには: > + + :let lpc_use_lpc4_syntax = 1 + +LPCのuLPCシリーズには: +uLPCはPike用に開発されている。なのでPike構文を代わりに使い、ソースファイルの名 +前を.pikeとすること。 + + +LUA *lua.vim* *ft-lua-syntax* + +Lua 構文ファイルはバージョン 4.0, 5.0, 5.1, 5.2 に対して使える (5.2 がデフォル +ト) グローバル変数 lua_version と lua_subversion を設定することでバージョンを +指定することができる。例えば、Lua 5.1 の構文ハイライトを有効にするには次のよう +に変数を設定する: + + :let lua_version = 5 + :let lua_subversion = 1 + + +MAIL *mail.vim* *ft-mail.vim* + +Vimはemailの標準的な要素(ヘッダー、シグネチャ、引用文、URL / emailアドレス)の +全てをハイライトする。標準的な慣習に従い、シグネチャは、"--" とそれに続く任意 +個の空白、そして改行のみからなる行で始まる。 + +Vimは ']', '}', '|', '>' で始まる行または '>' が続く単語を引用文とみなす。引用 +文中のヘッダーとシグネチャについては、テキストが '>' (1個のスペースが続いても +よい)で引用された場合のみハイライトする。 + +デフォルトではmail.vimは先頭表示行の100行前までの構文をシンクロナイズさせる。 +遅いマシンを使っていて、一般的に短いヘッダーのemailを扱っているなら、これをよ +り小さい値に変えることができる: > + + :let mail_minlines = 30 + + +MAKE *make.vim* *ft-make-syntax* + +Makefileではエラーを見つけやすくするためにコマンドがハイライトされる。しかし、 +これは色が多すぎるかもしれない。この機能をオフにするにはこうする: > + + :let make_no_commands = 1 + + +MAPLE *maple.vim* *ft-maple-syntax* + +Waterloo Maple IncによるMaple Vは記号代数をサポートしている。その言語はユーザー +によって選択的にロードされる関数のパッケージをたくさんサポートしている。Maple +V release 4で供給される標準的なパッケージセットの関数がユーザーの判断によって +強調される。ユーザーは.vimrcに以下を書くと、全てのパッケージ関数がハイライトさ +れる: > + + :let mvpkg_all= 1 + +あるいは以下の表から任意のサブセット変数/パッケージを選んで.vimrcファイル中で +その変数を1にセットしてもよい($VIMRUNTIME/syntax/syntax.vimを読み込む前に行う +必要がある)。 + + Maple V パッケージ関数選択肢の表 > + mv_DEtools mv_genfunc mv_networks mv_process + mv_Galois mv_geometry mv_numapprox mv_simplex + mv_GaussInt mv_grobner mv_numtheory mv_stats + mv_LREtools mv_group mv_orthopoly mv_student + mv_combinat mv_inttrans mv_padic mv_sumtools + mv_combstruct mv_liesymm mv_plots mv_tensor + mv_difforms mv_linalg mv_plottools mv_totorder + mv_finance mv_logic mv_powseries + + +MATHEMATICA *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax* + +次を .vimrc に書いておかないかぎり、空の *.m ファイルは自動的に Matlab のファ +イルであるとみなされる: > + + let filetype_m = "mma" + + +MOO *moo.vim* *ft-moo-syntax* + +式の中でCスタイルのコメントを使っていて、それがハイライトを乱している場合は、C +スタイル用の拡張マッチ(これは遅い!)を使うことができる: > + + :let moo_extended_cstyle_comments = 1 + +文字列中の代名詞置換パターンのハイライトを無効化させるには: > + + :let moo_no_pronoun_sub = 1 + +正規表現演算子 '%l' のハイライトと文字列中の '%(' と '%)' のマッチを無効化させ +るには: > + + :let moo_no_regexp = 1 + +対応していないダブルクォートを認識してエラーとしてハイライトすることができる: > + + :let moo_unmatched_quotes = 1 + +組み込みプロパティ(.name, .location, .programmerなど)をハイライトするには: > + + :let moo_builtin_properties = 1 + +未知の組み込み関数を認識してエラーとしてハイライトすることができる。このオプショ +ンを使うなら、mooKnownBuiltinFunctionグループに自分自身の拡張を加えること。こ +のオプションを有効化するには: > + + :let moo_unknown_builtin_functions = 1 + +既知の組み込み関数のリストにsprintf()を加える例: > + + :syn keyword mooKnownBuiltinFunction sprintf contained + + +MSQL *msql.vim* *ft-msql-syntax* + +msql構文ハイライトには2つのオプションがある。 + +文字列中でSQL構文ハイライトをさせるにはこうする: > + + :let msql_sql_query = 1 + +シンクロナイズは、minlinesはデフォルトで100になっている。この値を変えるには、 +"msql_minlines" の望む値にすればよい。例: > + + :let msql_minlines = 200 + + +NCF *ncf.vim* *ft-ncf-syntax* + +NCF構文ハイライトには1つのオプションがある。 + +ncf.vimによって認識されない文をエラーとしてハイライトさせるにはこうする: > + + :let ncf_highlight_unknowns = 1 + +これらをエラーとしてハイライトさせたくない場合は、この変数をセットしないでおく。 + + +NROFF *nroff.vim* *ft-nroff-syntax* + +nroff構文ファイルはそのままでAT&T n/troffに対応している。構文ファイルに含まれ +ているGNU groff拡張機能を使うには、それを有効化する必要がある。 + +例えば、LinuxとBSDディストリビューションは、デフォルトではテキスト処理パッケー +ジとしてgroffを使う。groff用の拡張構文ハイライト機能を有効化するには、次のオプ +ションを初期化ファイルに加える: > + + :let b:nroff_is_groff = 1 + +groffは、Solarisでまだ使われているかもしれない古いAT&T n/troffとは異なる。 +groffのマクロとリクエスト名は2文字以上の長さであってもよく、言語プリミティブに +拡張がされている。例えば、AT&T troffではリクエスト\(yrを使い、2桁の数で年にア +クセスする。groffでは互換性のために同じリクエストを使うこともできるし、または +groffネイティブの構文,\[yr]を使うこともできる。さらに、\[year]として4桁の年を +直接使うこともできる。マクロリクエストは2文字以上の長さであってもよい。例え +ば、GNU mmはverbatim環境を作るのに ".VERBON" と ".VERBOFF" というリクエストを +受けつける。 + +g/troffによって得られる最良の整形された出力を得るには、スペースと句読点に関す +るいくつかの単純なルールに従うべきである。 + +1. 行の末尾に空のスペースを置かないこと + +2. 文末のピリオド、エクスクラメーションマークなどの後にはちょうど1個のスペース + を置くこと。 + +3. 後述の理由により、全てのピリオドの後に改行(carriage return)を置くとよい。 + +これらの妙なtipsの理由は、g/n/troffが改行に、これらのルールに従わないとすぐに +混乱してしまうアルゴリズムを使っているためである。 + + +troffはTeXと違い、段落ごとでなく行ごとにテキストを書き込む。さらに、glueや +stretchの概念を持たず、入力に水平、垂直の空白があると全てそのまま出力される。 + +それゆえ、最終的なドキュメントで意図する以上の空白を文と文の間にはさまないよう +に注意すること。この理由のため、全ての句読点記号の後すぐに改行を入れるという習 +慣がある。最終的に処理された出力が「一様な」テキストになってほしければ、入力の +テキストで正しくスペースを置いておく必要がある。行末の空白と句読点の後の2個以 +上の空白をエラーとしてハイライトしたいならこうする: > + + :let nroff_space_errors = 1 + +正しい活字組みと干渉するかもしれないが、余分な空白や他のエラーを検出するもう1 +つの方法は、設定ファイル中で構文グループ "nroffDefinition" と "nroffDefSpecial" +に目立つハイライト定義を定義することである。例: > + + hi def nroffDefinition term=italic cterm=italic gui=reverse + hi def nroffDefSpecial term=italic,bold cterm=italic,bold + \ gui=reverse,bold + +ソースファイル中のプリプロセッサーのエントリをセクションマーカーと同じくらい容 +易に表示させたいなら、.vimrc中で次のオプションを有効化する: > + + let b:preprocs_as_sections = 1 + +同様に、構文ファイルはmsパッケージ中の拡張段落マクロ(.XP)用の余分な段落マーカー +も含んでいる。 + +最後に、構文ファイル|groff.vim|が存在する。これはデフォルトでfile basisとグ +ローバルの両方でgroff構文ハイライトすることができる。 + + +OCAML *ocaml.vim* *ft-ocaml-syntax* + +OCaml構文ファイルは以下の拡張子を持つファイルに対応している: .ml, .mli, .mll +.mly。以下の変数をセットすると、標準的OCaml構文からcamlp4プリプロセッサーでサ +ポートされている修正構文に切り替えることができる: > + + :let ocaml_revised = 1 + +以下の変数をセットすると "end" をエラーとしてハイライトするのをやめることがで +きる。これはVimがシンクロナイズできないほど長い構造を含むソースのとき便利であ +る: > + + :let ocaml_noend_error = 1 + + +PAPP *papp.vim* *ft-papp-syntax* + +PApp構文ファイルは.pappファイルと、その小さな拡張、トップレベルのファイル +フォーマットとしてxmlを用いたperl/xml/html/その他の混合である.pxml, .pxslファ +イルを扱う。デフォルトでは、phtmlやpxmlセクションの内側の全ては埋め込みプリプ +ロセッサーコマンドつきの文字列として扱われる。次の変数を初期化ファイルで設定す +るとphtmlセクションの内側のhtmlコードを構文ハイライトしようとする: > + + :let papp_include_html=1 + +しかしこれは比較的遅く、実用的に編集するにはカラフルすぎる。 + +構文ファイルpapp.vimの最新版は、通常以下で得られる。 +http://papp.plan9.de + + +PASCAL *pascal.vim* *ft-pascal-syntax* + +"*.p" にマッチするファイルのタイプはProgressかPascalである。自動判別が機能しな +いなら、またはProgressファイルを一切編集しないとわかっているなら、これをvimrc +ファイルに書くといい: > + + :let filetype_p = "pascal" + +Pascal構文ファイルはTurbo Pascal, Free Pascal CompilerとGNU Pascal Compiler +で提供される拡張に対応するための拡張が施されてきた。Delphiのキーワードもサポー +トされている。デフォルトではTurbo Pascal 7.0の機能が有効化されている。標準的な +Pascalのキーワードだけを使いたいなら、次の行を初期化ファイルに加えること: > + + :let pascal_traditional=1 + +Delphi固有の構文(1行コメント、キーワード等)を有効化したいなら: > + + :let pascal_delphi=1 + + +オプションpascal_symbol_operatorは、+, *などのような演算子記号をOperatorの色を +使って表示するどうかを制御する。演算子記号を色づけするには、次の行を初期化ファ +イルに加えること: > + + :let pascal_symbol_operator=1 + +いくつかの関数はデフォルトでハイライトされる。これをオフにするには: > + + :let pascal_no_functions=1 + +さらに、いくつかのコンパイラ用に個別の変数がある。pascal_delphi, pascal_gpc, +pascal_fpcがある。デフォルトの拡張はTurbo Pascalに合うようになっている。 > + + :let pascal_gpc=1 + +または > + + :let pascal_fpc=1 + +文字列が1行で定義されるものとするなら、変数pascal_one_line_string variableを定 +義するとよい。 > + + :let pascal_one_line_string=1 + +タブ文字が好きでないなら、変数pascal_no_tabsをセットするとよい。するとタブがエ +ラーとしてハイライトされる。 > + + :let pascal_no_tabs=1 + + +PERL *perl.vim* *ft-perl-syntax* + +perl用の構文ハイライトにはたくさんのオプションがある。 + +インライン POD 強調表示は初期設定で有効化される。Perl ファイル内に埋め込まれた +POD を強調表示して複雑にしたくない場合は、'perl_include_pod' オプションを 0 に +設定する: > + + :let perl_include_pod = 0 + +パースの複雑さを軽減するために (そしてパフォーマンスを上げるために)、変数名と +内容のパースにおける2つの要素をオフにすることができる。 > + +変数名と関数名中のパッケージ参照 ('$PkgName::VarName' 中の 'PkgName::' のよう +な) を他の名前と区別しないようにするには次のようにする: > + + :let perl_no_scope_in_variables = 1 + +(Vim 6.x では違う方法だった: "perl_want_scope_in_variables" を設定するとこの機 +能が有効になった) + +'@{${"foo"}}' のように複雑なものをパースさせたくないなら次のようにする: > + + :let perl_no_extended_vars = 1 + +(Vim 6.x では違う方法だった: "perl_extended_vars" を設定するとこの機能が有効に +なった) + +文字列の色づけは変更できる。デフォルトでは文字列とqq friendsは第1行と同じよう +にハイライトされる。変数perl_string_as_statementをセットすると第2行のようにハ +イライトされる。 + + "hello world!"; qq|hello world|; + ^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^N (unlet perl_string_as_statement) + S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^SN (let perl_string_as_statement) + +(^ = perlString, S = perlStatement, N = None at all) + +シンクロナイズには3つのオプションがある。最初の2つは、シンクロナイズのトリガー +の一部をオフにするもので、ハイライトが適切に機能しないときのみ必要になる。スク +ロール中に突然スクリーン全体の色がすっかり変わってしまったらこれらのうち1つを +オフにしてみること。その誤りを引き起こした行を特定できるなら、それを知らせてく +ださい。 + +1つのトリガーは "^\s*sub\s*" に関するもので、もう1つはほぼ "^[$@%]" に関するも +のである。 > + + :let perl_no_sync_on_sub + :let perl_no_sync_on_global_var + +以下のようにして、どこから構文ハイライトを始めるかの最大距離を設定できる: > + + :let perl_sync_dist = 100 + +perlで折りたたみを使いたいならperl_foldをセットすること: > + + :let perl_fold = 1 + +if 文などでも同様にブロックを折り畳みたければ、次のように設定する: > + + :let perl_fold_blocks = 1 + +初期設定では 'perl_fold' が設定されていればサブルーチンの折り畳みは有効化され +る。無効化したい場合は 'perl_nofold_subs' を設定する: > + + :let perl_nofold_subs = 1 + +初期設定では無名サブルーチンは折り畳まれない。折り畳みを有効化するには +'perl_fold_anonymous_subs' を設定する: > + + :let perl_fold_anonymous_subs = 1 + +初期設定では 'perl_fold' が設定されていればパッケージは折り畳まれる。無効化し +たい場合は 'perl_nofold_packages' を設定する: > + + :let perl_nofold_packages = 1 + +PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax* + +[note: これは以前は "php3" と呼ばれていた。しかし現在はphp4もサポートしている +ので "php" と名前が変更された] + +php用の構文ハイライトには以下のオプションがある。 + +文字列中でSQL構文ハイライトを行いたいなら: > + + let php_sql_query = 1 + +Baselibメソッドのハイライトを行いたいなら: > + + let php_baselib = 1 + +文字列中でHTML構文ハイライトを行いたいなら: > + + let php_htmlInStrings = 1 + +古いカラースタイルを使いたいなら: > + + let php_oldStyle = 1 + +ASPスタイルのショートタグを有効化したいなら: > + + let php_asp_tags = 1 + +ショートタグを無効化したいなら: > + + let php_noShortTags = 1 + +] や ) の対応エラーをハイライトしたいなら: > + + let php_parent_error_close = 1 + +対応する閉じ括弧がない開き括弧 ( や [ が存在する場合、php終了タグをスキップさ +せたいなら: > + + let php_parent_error_open = 1 + +クラスや関数の折り畳みを有効化するには: > + + let php_folding = 1 + +シンクロナイズ方法を選ぶには: > + + let php_sync_method = x + +x = -1 で検索によるシンクロナイズ(デフォルト) +x > 0 少なくともx行上までシンクロナイズ +x = 0 最初からシンクロナイズ + + +PLAINTEX *plaintex.vim* *ft-plaintex-syntax* + +TeX とは組版言語であり、plaintex は「素の」TeX に対して使われるファイルタイプ +である。*.tex ファイルを決して素の TeX と認識してほしくないならば +|ft-tex-plugin| を参照。 + +この構文ファイルは次のオプションを持つ > + + let g:plaintex_delimiters = 1 + +角括弧 "[]" と波括弧 "{}" をハイライトさせるには上の変数を設定する。 + +PPWIZARD *ppwiz.vim* *ft-ppwiz-syntax* + +PPWizardはHTMLとOS/2 INFファイル用のプリプロセッサーである。 + +構文ファイルは以下のオプションを持つ: + +- ppwiz_highlight_defs : PPWizardの定義についてのハイライトモードを決める。 + とりうる値は + + ppwiz_highlight_defs = 1 : #define 文においてその内容の色を保つ(例. PPWizard + マクロと変数) + + ppwiz_highlight_defs = 2 : 行継続記号を除き、#defineと#evaluate文が単一の色 + で表示される。 + + ppwiz_highlight_defsのデフォルトは1である。 + +- ppwiz_with_html : この値が1(デフォルト)なら、HTMLコードをハイライトする。0な + らHTMLコードを通常のテキストのように扱う。 + + +PHTML *phtml.vim* *ft-phtml-syntax* + +phtml用の構文ハイライトには2つのオプションがある。 + +文字列中でSQL構文ハイライトをさせたいならこうする: > + + :let phtml_sql_query = 1 + +シンクロナイズについては、minlinesのデフォルトは100になっている。他の値にした +いなら "phtml_minlines" を望む値にセットすればよい。例: > + + :let phtml_minlines = 200 + + +POSTSCRIPT *postscr.vim* *ft-postscr-syntax* + +PostScript用の構文ハイライトにはいくつかのオプションがある。 + +まず、どのバージョンのPostScript言語をハイライトするかである。現在のところ、言 +語の3つのバージョン、あるいはレベルが定義されている。レベル1はオリジナルの基本 +バージョンで、レベル2のリリース以前のすべての拡張を含んでいる。レベル2はもっと +も一般的なバージョンで、レベル3リリース以前のすべての拡張を含んでいる。レベル3 +は現在のところサポートされている中でもっともレベルが高い。次のように変数 +postscr_levelを定義することによって、PostScript言語のどのレベルをハイライトす +るか選ぶことができる: > + + :let postscr_level=2 + +この変数が定義されていないときはデフォルトの2(レベル2)になる。これが現在のとこ +ろもっとも普及しているためである。 + +すべてのPSインタープリターがその言語レベルのすべての言語機能をサポートしている +わけではないことに注意。とくに、PSファイルの先頭の%!PS-Adobe-3.0は現在の +PostScriptがレベル3であることを示すわけではない! + +以下のように変数postscr_displayを定義すると、Display PostScriptの言語機能もハ +イライトさせることができる: > + + :let postscr_display=1 + +以下のように変数postscr_ghostscriptを定義すると、Ghostscript固有の言語機能もハ +イライトさせることができる: > + + :let postscr_ghostscript=1 + +PostScriptはたくさんの定義済み要素を持つ巨大な言語である。これらの要素すべてを +ハイライトすると便利であるが、そうすると遅いマシンではVimの動作が遅くなってし +まう。マシンフレンドリーにするために、デフォルトではフォント名と文字エンコーディ +ングはハイライトされない、これらをハイライトさせるには、以下の変数のどちらか +または両方をセットすること: > + + :let postscr_fonts=1 + :let postscr_encodings=1 + +and、or、notのハイライトについて、スタイル上のオプションが存在する。PostScript +では、これらの演算子の機能はオペランドの型に依存する。オペランドが両方ブール型 +なら論理演算子となり、両方整数型なら2項演算子となる。2項演算子と論理演算子を区 +別してハイライトすることができるので、どちらにしてもこれらはハイライトされなけ +ればならない。デフォルトではどちらも論理演算子としてハイライトされる。変数 +postscr_andornot_binaryを定義すると、どちらも2項演算子としてハイライトされる: > + + :let postscr_andornot_binary=1 +< + + *ptcap.vim* *ft-printcap-syntax* +PRINTCAP + TERMCAP *ft-ptcap-syntax* *ft-termcap-syntax* + +この構文ファイルはprintcapとtermcapデータベースに適用される。 + +*printcap*または*termcap*というパターンにマッチしないprintcap/termcapファイル +を認識させるためには、ファイル|myfiletypefile|において、あなたのシステムに合っ +たパターンを追加しなければならない。これらのパターンには、変数 "b:ptcap_type" +を "print" か "term" のどちらかにセットしなければならない。するとオプション +'filetype' の値がptcapになる。 + +例えば、/etc/termcaps/以下の全てのファイルをtermcapファイルと識別させるように +するには次を書き加える: > + + :au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" | + \ set filetype=ptcap + +上方向にスクロールしているときハイライトがおかしくなり、それがCTRL-Lで再描画す +ると直るようなら、変数 "ptcap_minlines" の値を大きくしてみるとよい: > + + :let ptcap_minlines = 50 + +(デフォルトは20行) + + +PROGRESS *progress.vim* *ft-progress-syntax* + +"*.w" にマッチするファイルのタイプはProgressかCWEBである。自動判別がうまく機能 +しないなら、またはcwebファイルを一切編集しないとわかっているなら、次をvimrcに +加えるとよい: > + :let filetype_w = "progress" +同じことが "*.i" (アセンブリでもありうる)と "*.p" (Pascalでもありうる)にもいえ +る。アセンブリとPascalを使わないとわかっているならこれを使うこと: > + :let filetype_i = "progress" + :let filetype_p = "progress" + + + +PYTHON *python.vim* *ft-python-syntax* + +Python構文ハイライトをコントロールするオプションは 6 つある。 + +数字のハイライト: > + :let python_no_number_highlight = 1 + +組み込み関数のハイライト: > + :let python_no_builtin_highlight = 1 + +標準例外のハイライト: > + :let python_no_exception_highlight = 1 + +doctest とその中のコードのハイライト: > + :let python_no_doctest_highlight = 1 +または > + :let python_no_doctest_code_highlight = 1 +(最初のオプションは二番目のオプションも含む)。 + +行末の空白と、スペースとタブの混在のハイライト: > + :let python_space_error_highlight = 1 + +全てのハイライトを有効化させるには (最後に挙げたオプションを有効化し、他のオプ +ションを無効化するのと同じ): > + :let python_highlight_all = 1 + +Note: 変数が定義されているかどうかが意味を持つ。値は関係ない。設定値は 1 以外 + でも構わない。 + + +QUAKE *quake.vim* *ft-quake-syntax* + +Quake構文定義はQuakeエンジンのどれかに基づくほとんど全てのFPS(First Person +Shooter)用に対応するはずである。しかし3つのゲーム(Quake, Quake 2, Quake 3 +Arena)間でコマンド名が少々異なる。そのため、3つのグローバル変数により、どのコ +マンドが有効であるか指定できるようになっている。3つの変数には次のような効果が +ある: + +Quakeでのみ利用可能なコマンドをハイライトするように設定: > + :let quake_is_quake1 = 1 + +Quake 2でのみ利用可能なコマンドをハイライトするように設定: > + :let quake_is_quake2 = 1 + +Quake 3 Arenaでのみ利用可能なコマンドをハイライトするように設定: > + :let quake_is_quake3 = 1 + +これら3つのコマンドを自由に組み合わせることができる。しかしゲームで利用できな +いコマンドもハイライトしてしまうかもしれない。 + + +READLINE *readline.vim* *ft-readline-syntax* + +readlineライブラリは主としてBASHシェルで使われ、BASHはかなりの数のコマンドとオ +プションを追加している。これらの項目を同様にハイライトするには次を|vimrc|に加 +えるか、readline構文ファイルを読み込む前にこれをタイプすればよい: > + let readline_has_bash = 1 + +こうするとBASH(バージョン2.05a以降。一部それ以前)が追加するコマンドもハイライ +トするようになる。 + + +RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* + +コードブロックで有効にしたい構文定義を定義できる。 > + let rst_syntax_code_list = ['vim', 'lisp', ...] +< + +REXX *rexx.vim* *ft-rexx-syntax* + +上方向にスクロールしているときにハイライトがおかしくなり、それがCTRL-Lで再描画 +すると直るようなら、変数 "rexx_minlines" の値を大きくしてみるとよい: > + :let rexx_minlines = 50 +こうすると構文シンクロナイズが画面最上行の50行前から始まるようになる。値を大き +くすることの欠点は、再描画が遅くなることである。 + +Vim は ".r" ファイルのタイプを推測しようとする。(コメント行から) タイプを特定 +できなかった場合、デフォルトは "r" である。デフォルトを rexx にするには次の行 +を .vimrc に追加すること: *g:filetype_r* +> + :let g:filetype_r = "r" + + +RUBY *ruby.vim* *ft-ruby-syntax* + + Ruby: 演算子のハイライト |ruby_operators| + Ruby: ホワイトスペース エラー |ruby_space_errors| + Ruby: 折り畳み |ruby_fold| |ruby_foldable_groups| + Ruby: 負荷の高い処理の削減 |ruby_no_expensive| |ruby_minlines| + Ruby: スペルチェック |ruby_spellcheck_strings| + + *ruby_operators* + Ruby: 演算子のハイライト ~ + +"ruby_operators" を定義すると、演算子をハイライトできる: > + + :let ruby_operators = 1 +< + *ruby_space_errors* + Ruby: ホワイトスペース エラー ~ + +"ruby_space_errors" を定義すると、ホワイトスペースのエラーをハイライトできる: > + + :let ruby_space_errors = 1 +< +これは、行末のホワイトスペースとスペース文字に続くタブ文字をエラーとしてハイラ +イトする。"ruby_no_trail_space_error" と "ruby_no_tab_space_error" の定義によ +り、行末のホワイトスペースやスペース文字直後のタブ文字を無視するよう個別に制御 +できる。 + + *ruby_fold* *ruby_foldable_groups* + Ruby: 折り畳み ~ + +"ruby_fold" を定義すると、折り畳みを有効化できる: > + + :let ruby_fold = 1 +< +これは、'foldmethod' の値として "syntax" を現在のバッファまたはウィンドウに限 +定で設定し、Ruby ファイルの編集時に、構文に基づく折り畳みを有効にする。 + +デフォルトの折り畳みはある程度、精密である。すなわち、"if", "do", "%w[]" など +の小さな構文ユニットは、対応する折り畳みレベルを構成する。 + +"ruby_foldable_groups" をセットすることで、折り畳み可能なグループを制限できる: > + + :let ruby_foldable_groups = 'if case %' +< +値は、キーワードのリストをスペース文字区切りで指定: + + キーワード 意味 ~ + ---------- ------------------------------------- ~ + ALL 大部分のブロック構文 (デフォルト) + NONE なし + if "if" or "unless" ブロック + def "def" ブロック + class "class" ブロック + module "module" ブロック + do "do" ブロック + begin "begin" ブロック + case "case" ブロック + for "for", "while", "until" ループ + { 波カッコ ブロック、またはハッシュ リテラル + [ 配列リテラル + % "%" 記法によるリテラル。 例: %w(STRING), %!STRING! + / 正規表現 + string 文字列とシェルコマンドの出力 (', ", ` でくくられた) + : シンボル + # 複数行コメント + << ヒアドキュメント + __END__ "__END__" ディレクティブ以降のソースコード + + *ruby_no_expensive* + Ruby: 負荷の高い処理の削減 ~ + +デフォルトではキーワード "end" はそれに対応するブロック開始文にしたがって色づ +けされる。この機能は便利だが、コストがかかる。再描画が遅くなったら(または色機 +能の貧弱なターミナルを使っているなら)変数 "ruby_no_expensive" を定義することに +よってこの機能をオフにできる: > + + :let ruby_no_expensive = 1 +< +この場合すべての制御キーワードに同じ色が使われる。 + + *ruby_minlines* + +この機能を有効化したいが、上にスクロールしているときにハイライトがおかしくなり、 +それがCTRL-Lで再描画すると直るようなら、変数 "ruby_minlines" を50以上の値にセッ +トしてみるとよい: > + + :let ruby_minlines = 100 +< +理想的には、ファイル中の最も行数の多いクラスやモジュールをカバーできるほどの十 +分な行数を値として設定するべき。 + + *ruby_spellcheck_strings* + Ruby: スペルチェック ~ + +"ruby_spellcheck_strings" を定義すると、Ruby シンタックスはスペルチェックを行 +う: > + + :let ruby_spellcheck_strings = 1 +< + +SCHEME *scheme.vim* *ft-scheme-syntax* + +デフォルトでは R5RS のキーワードだけをハイライトし、正しくインデントする。 + +変数 b:is_mzscheme または g:is_mzscheme が定義されていると、MzScheme 固有の設 +定が使われる。 + +また、scheme.vim は Chicken Scheme->C コンパイラのキーワードにも対応している。 +それを有効にするには b:is_chicken または g:is_chicken を定義する。 + + +SDL *sdl.vim* *ft-sdl-syntax* + +SDL用のハイライトにはいくつかのキーワードが抜けているかもしれない。しかしSDLに +はたくさんのキーワードがあるので、すべてに対応することはほとんど不可能である。 + +新しい標準SDL-2000ではすべての識別子の大文字・小文字が区別される(以前はそうで +はなかった)。また、すべてのキーワードが全部大文字または全部小文字であってもよ +い。構文ハイライトにこれを反映させるには次の変数をセットすればよい: > + :let sdl_2000=1 + +これはたくさんの新しいキーワードもセットする。古いキーワードを無効にするには +(これはよい考えである)こうする: > + :let SDL_no_96=1 + +インデントもおそらく不完全であるが、今のところ私はこれでとても満足している。 + + +SED *sed.vim* *ft-sed-syntax* + +タブをハイライトして通常の空白と区別しやすくするには、次の行をvimrcに書いて +"highlight_sedtabs" を定義する(TODOと同じ構文グループが使われる) > + + :let highlight_sedtabs = 1 + +(タブのハイライトは、検索パターン、置換テキスト、アドレス、 +Append/Change/Insertコマンドに含まれるテキストいずれかの中のタブにだけ適用され +る)。このオプションを有効化するなら、タブ幅を1文字にするとよい。そうすると文字 +列中のタブの数を数えやすくなる。 + +バグ: + + 変換コマンド(y)は置換コマンドとまったく同様に扱われる。つまり、この構文ファ + イルにおいては、変換は置換と同じフラグを受け取ると判断される。これは間違いで + ある(変換は一切フラグを受け取らない)。これに関係したコマンドは非常に複雑な処 + 理を要求するため(95パターン、もっともらしいパターンデリミタごとに1つ)、私は + このバグを容認している。 + + +SGML *sgml.vim* *ft-sgml-syntax* + +SGMLファイル中のタグをハイライトする方法は以下のように動作する。 + +開きタグ<>と閉じタグ</>は異なる色がつけられる。これは意図されたものである。開 +きタグには 'Function' の色が使われ、閉じタグには 'Type' の色が使われる(これら +がどう定義されているかを確かめたいならsyntax.vimを見ること)。 + +登録されているタグ名はCの文と同じ方法で色づけされる。エラーを見つけやすくする +ため、登録されていないタグ名は色づけされない。 + +引数名(や属性名)も同様である。登録されている属性名は登録されていない属性名と異 +なる色がつけられる。 + +いくつかのSGMLタグはテキストの外見を変更するのに使われる。以下のタグは構文ファ +イルsgml.vimによって認識され、通常のテキストの表示法を変更する: + <varname> <emphasis> <command> <function> <literal> <replaceable> <ulink> + <link>。 + +そのテキストの表示法を変えたいなら以下の構文グループを再定義しなければならない: + - sgmlBold + - sgmlBoldItalic + - sgmlUnderline + - sgmlItalic + - sgmlLink リンク用 + +この再定義を機能させるにはこれらすべてを再定義し、以下の変数をvimrc中で定義し +なければならない(初期化の際にファイルが読み込まれる順序のため) > + let sgml_my_rendering=1 + +この表示法を無効にしたければ次の行をvimrcに加える: > + let sgml_no_rendering=1 + +(Claudio Fleiner <claudio@fleiner.com>によるhtml.vimのヘルプテキストから一部借 +用した) + + + *ft-posix-synax* *ft-dash-syntax* +SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax* + +これは、古い UNIX (Bourne) sh と bash や dash、POSIX、Korn シェルのような新し +い UNIX シェルの構文ハイライトをカバーする。 + +Vimは様々なファイル名がどのタイプであるかを指定することによって、どのシェルが +使われているかを決定しようとする: > + + ksh : .kshrc* *.ksh + bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash +< +これらのうちどれにも当てはまらなければ、ファイルの第一行によって判断される(例. +/bin/sh /bin/ksh /bin/bash を探す)。第一行でシェルを指定されていれば、そのシェ +ルが使用される。しかしいくつかのファイル(例. .profile)はシェルファイルであるこ +とはわかっていても、どのタイプか明らかではない。さらに、多くのシステムでshは +"bash" (Linux, Windows+cygwin) や "ksh" (Posix) へのシンボリックリンクになって +いる。 + +以下の変数のどれかを.vimrcで定義することにより、デフォルトを設定すること +ができる: + + ksh: > + let g:is_kornshell = 1 +< posix: (これは g:is_kornshell に1を設定することとほぼ同じ) > + let g:is_posix = 1 +< bash: > + let g:is_bash = 1 +< sh: (デフォルト) Bourne shell > + let g:is_sh = 1 + +< (dash 使用者は posix を使用するべき) + +"#! ..." という行がなく、かつユーザーが上の方法でデフォルトの sh.vim の構文を +設定していない場合、sh.vim は Bourne シェルの構文であると仮定する。エラーレポー +トで RFC や市場浸透統計を引用する必要はありません。ただただ、デフォルトでシス +テムに使用されるバージョンのシェルを選択し、それに対応する "let..." をあなたの +.vimrc に導入してください。 + +syntax/sh.vim は構文ベースの折り畳みを数種類用意している: > + let g:sh_fold_enabled= 0 (デフォルト。構文折り畳みなし) + let g:sh_fold_enabled= 1 (関数の折り畳みを有効化) + let g:sh_fold_enabled= 2 (ヒアドキュメントの折り畳みを有効化) + let g:sh_fold_enabled= 4 (if/do/for の折り畳みを有効化) +> +様々な構文要素(例: ヒアドキュメントと関数の中身)がsyntaxメソッドによって折り畳 +み可能になる(|:syn-fold|)。これらのうち複数を組み合わせることもできる: > + + let g:sh_fold_enabled= 3 (関数とヒアドキュメントの折畳を有効化) + +上方向にスクロールしているときにハイライトがおかしくなり、それがCTRL-Lで再描画 +すると直るようなら、変数 "sh_minlines" の値を大きくしてみるとよい。例: > + + let sh_minlines = 500 + +こうすると構文シンクロナイズが画面最上行の500行前から始まるようになる。デフォ +ルトの値は200である。大きい値を設定することの欠点は、動作が遅くなるかもしれな +いことである。 + +シンクロナイズさせるものがあまりないときは表示がとても遅くなるかもしれない。こ +れを減らすために、変数 "sh_maxlines" をセットすることができる。例: > + + let sh_maxlines = 100 +< +デフォルトはsh_minlinesの2倍の値が使われる。表示を高速化するにはこれをもっと小 +さい値にすること。欠点はハイライト間違いが出るかもしれないことである。 + +syntax/sh.vim は特定のプログラムをエラーとして表示しようとする。通常は、余分な +']', 'done', 'fi' などがこれに当たる。もしもこのエラーの扱いがあなたの目的で問 +題を起こす場合は、.vimrc に以下を書くことでエラーの強調表示を抑制できる: > + + let g:sh_no_error= 1 +< + + *sh-embed* *sh-awk* + Sh: 埋め込み言語 + +sh に言語を埋め込みたい場合。Lorance Stinson が awk を埋め込む例を出してくれた +のでそれを載せる。以下のファイルを $HOME/.vim/after/syntax/sh/awkembed.vim +に置くこと: > + + " AWK Embedding: + " ============== + " Shamelessly ripped from aspperl.vim by Aaron Hope. + if exists("b:current_syntax") + unlet b:current_syntax + endif + syn include @AWKScript syntax/awk.vim + syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@<!'+ skip=+\\'+ end=+'+ contains=@AWKScript contained + syn region AWKScriptEmbedded matchgroup=AWKCommand start=+\<awk\>+ skip=+\\$+ end=+[=\\]\@<!'+me=e-1 contains=@shIdList,@shExprList2 nextgroup=AWKScriptCode + syn cluster shCommandSubList add=AWKScriptEmbedded + hi def link AWKCommand Type +< +この例では次のようなシングルクォートで囲まれた awk コードが awk 言語として強調 +表示されるようになる: > + awk '...awk code here...' +これは他の言語にも応用できる。 + + +SPEEDUP *spup.vim* *ft-spup-syntax* +(AspenTech plant simulator) + +Speedup構文ファイルにはいくつかのオプションがある: + +- strict_subsections : この変数が定義されていると、セクションとサブセクション + 用のキーワードだけが文としてハイライトされ、他のキーワードにはされなくなる + (OPERATIONセクションのWITHINと同様)。 + +- highlight_types : この変数が定義されていると、温度や圧力のようなストリーム + 型が単純な識別子でなくTypeとしてハイライトされる。Includedは通常DECLAREセク + ション中に現れる型である; ユーザーが自分用の型を定義しているならそれらを構文 + ファイルに含めなければならない。 + +- oneline_comments : この値は1から3までの間になり、#スタイルのコメントのハイラ + イトを決定する。 + + oneline_comments = 1 : 偶数個の#の後にも通常のSpeedupコードが現れることを許す + + oneline_comments = 2 : 2番目の#で始まるコードをエラーとして表示する。これが + デフォルトの設定である。 + + oneline_comments = 3 : 1個以上の#を含む行全体をエラーとしてハイライトする。 + +変数のPRESETにより、OPERATIONセクションはとても大きくなりがちであり、そのため +シンクロナイズが追いつかなくなるかもしれない。あなたのコンピュータが十分速いな +ら構文ファイルの最後近くでminlinesとmaxlinesの値を大きくするとよいかもしれない。 + + +SQL *sql.vim* *ft-sql-syntax* + *sqlinformix.vim* *ft-sqlinformix-syntax* + *sqlanywhere.vim* *ft-sqlanywhere-syntax* + +SQLにはANSI標準があるのだが、ほとんどのデータベースエンジンは独自の拡張を追加 +している。現在のところ、VimはOracleとInformixのSQL方言をサポートしている。 +デフォルトではVimは "*.sql" のファイルをOracle SQLであると判断する。 + +現在のところ、Vimは構文スクリプトによって、様々なベンダーのSQLに対応している。 +デフォルト設定をOracleから他の対応しているSQLに変更することができる。また、 +バッファごとに使うSQLの方言を変えることも簡単にできる。 + +より詳しい説明は|ft_sql.txt|を参照。 + + +TCSH *tcsh.vim* *ft-tcsh-syntax* + +これは "tcsh" という名前のシェルをカバーしている。これはcshのスーパーセットで +ある。ファイル形式がどのように判定されるかは|csh.vim|を参照。 + +tcshはシェル変数 backslash_quote をセットしていない限り文字列中に \" が現れる +ことを許さない。Vimにバックスラッシュクォート構文が存在しないと判断させたいな +ら、次の行を.vimrcに加えること: > + + :let tcsh_backslash_quote = 0 + +上方向にスクロールしているときにハイライトがおかしくなり、それがCTRL-Lで再描画 +すると直るようなら、変数 tcsh_minlines の値を大きくしてみるとよい: > + + :let tcsh_minlines = 1000 + +こうすると構文シンクロナイズが画面最上行の1000行前から始まるようになる。 +tcsh_minlines に "fromstart" をセットすると、ファイルの先頭からシンクロナイズ +が行われるようになる。tcsh_minlines の既定値は 100。大きな値にすることの欠点は、 +再描画が遅くなることである。 + + +TEX *tex.vim* *ft-tex-syntax* *latex-syntax* + + Tex 目次~ + Tex: 構文折り畳みをするには |tex-folding| + Tex: スペルチェックを行いたくない場合 |g:tex_nospell| + Tex: コメントの中ではスペルチェックを行いたくない場合 |tex-nospell| + Tex: Verbatim ゾーンをスペルチェックするには |tex-verb| + Tex: コメントや MathZone の区切り |tex-runon| + Tex: 構文ハイライトが遅いならば |tex-slow| + Tex: もっとコマンドをハイライトさせるには |tex-morecommands| + Tex: エラーのハイライトが行き過ぎならば |tex-error| + Tex: 新しいMathグループが必要ならば |tex-math| + Tex: 新しいスタイルを始めるには |tex-style| + Tex: Conceal モードを活用する |tex-conceal| + Tex: Conceal モードの選択 |g:tex_conceal| + Tex: iskeyword を制御する |g:tex_isk| + Tex: 下付き記号と上付き記号を制御する |tex-supersub| + + *tex-folding* *g:tex_fold_enabled* + Tex: 構文折り畳みをするには ~ + +<syntax/tex.vim>のバージョン28以降では、構文による部分、章、節、小節などの折り +畳みに対応している。それを有効にするには次の行を<.vimrc>に書き、 > + let g:tex_fold_enabled=1 +:set fdm=syntaxとする。後者をLaTeXファイルの末尾にモードラインとして書いておく +といいかもしれない: > + % vim: fdm=syntax +これによってシステムが遅くなり過ぎる場合は次のリンクを参照すること > + https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7 +< + *g:tex_nospell* + Tex: スペルチェックを行いたくない場合~ + +LaTeX 文章でどこにもスペルチェックを行わせたくない場合は、 > + let g:tex_nospell=1 +を .vimrc に書けばよい。ただ単にコメント内だけでスペルチェックを抑制したい場合 +は、|g:tex_comment_nospell| を参照せよ。 + + *tex-nospell* *g:tex_comment_nospell* + Tex: コメントの中ではスペルチェックを行いたくない場合 ~ + +LaTeX ファイルのコメントの中にソースコードのようなものを含めることがあるので、 +コメントの中ではスペルチェックを無効にしたいという人もいる。そのようにするには +次の行を .vimrc に加える: > + let g:tex_comment_nospell= 1 +LaTeX 文章中のどこででもスペルチェックを抑制したい場合は、|g:tex_nospell| を参 +照せよ。 + + *tex-verb* *g:tex_verbspell* + Tex: Verbatim ゾーンをスペルチェックするには~ + +たいてい verbatim リージョンはソースコードのようなものを書くのに使われる。 +ソースコードをスペルチェックしたいと思うことはほとんどないだろう。とはいえ、も +し verbatim ゾーンの内容をスペルチェックしたいときは <.vimrc> で次のように設定 +すること: > + let g:tex_verbspell= 1 +< + *tex-runon* *tex-stopzone* + Tex: コメントや MathZone の区切り ~ + +<syntax/tex.vim>の構文ハイライトはTeX, LaTeX, AmsTeXをサポートしている。normal, +texZone, texMathZoneの3つの主な区間・範囲がサポートされている。これらの区間を +適切に区切るようかなりの努力がされたが、$..$と$$..$$で線引きされる区間は開始・ +終了のパターンとまったく同じにシンクロナイズさせることはできない。その結果、特 +別な "TeX comment" が提供されている > + %stopzone +このコメントがあると、ここで強制的にtexZoneまたはtexMathZoneのハイライトを終わ +らせる。 + + *tex-slow* *tex-sync* + Tex: 構文ハイライトが遅いならば ~ + +遅いコンピュータを使っているなら、これらの値を減らすとよいかもしれない > + :syn sync maxlines=200 + :syn sync minlines=50 +(特に後者を)。速いコンピュータを使っているならこれらの値を増やしてもよい。これ +らは第一にシンクロナイズ(つまり、画面最上行のテキストがどのグループに入るか)に +影響を与える。 + +構文による折り畳みによって遅くなる場合もある。回避方法については +|tex-folding| を参照のこと。 + + *g:tex_fast* + +最後に、もし構文強調表示がまだ遅い場合は、.vimrc で次のように設定するとよい > + + :let g:tex_fast= "" + +g:tex_fast 変数を設定すると、構文強調表示でリージョンや同期が定義されなくな +る。それによって構文強調表示が速くなる。ただし、豊富な強調表示、構文ベースの折 +り畳み、構文ベースのエラーチェックはできなくなる。 + +特定の構文のみを有効化することもできる。次の一覧の中から有効化したい構文強調表 +示を選ぶことができる: > + + b : ボールド、イタリックを許可 + c : texComment を許可 + m : texMatcher を許可 (例: {...} と [...]) + M : texMath を許可 + p : 部 (parts)、章 (chapter)、節 (section) などを許可 + r : texRefZone を許可 (nocite, bibliography, label, pageref, eqref) + s : superscript/subscript リージョンを許可 + S : texStyle を許可 + v : verbatim を許可 + V : texNewEnv と texNewCmd を許可 +< +例えば、let g:tex_fast= "M" は 数学関連の強調表示を有効化する。他のリージョン +ベースの構文強調表示は有効化されない。 +(|g:tex_conceal| と |tex-supersub| も参照) + + *tex-morecommands* *tex-package* + Tex: もっとコマンドをハイライトさせるには ~ + +LaTeXはプログラミング言語であり、特殊化されたLaTeXのコマンド、構文、フォントが +つまったパッケージがたくさんある。そのようなパッケージを使っている人は、標準の +syntax/tex.vimにそのパッケージを対応させてほしいと思うだろう。しかしそれは明ら +かに非現実的である。そこで、|mysyntaxfile-add|で使われているテクニックを使っ +て、syntax/tex.vimで提供されているハイライトを拡張・修正してみてください。拡張 +(典型的には $HOME/after/syntax/tex/[pkgname].vim に置いて使う) を書いたら、そ +れを http://vim.sf.net/ にアップロードすることを検討してみてください。 + + *tex-error* *g:tex_no_error* + Tex: エラーのハイライトが行き過ぎならば ~ + +<tex.vim>は様々な種類のレキシカルエラーチェックをサポートしている。すなわち、 +エラーチェックはとても便利だが、実際にはエラーでない箇所もエラーと示すかもしれ +ない。それが嫌なら、次の行を<.vimrc>に置くとよい: > + let g:tex_no_error=1 +すると<syntax/tex.vim>によるすべてのエラーチェックが行われなくなる。 + + *tex-math* + Tex: 新しいMathグループが必要ならば ~ + +新しいmathグループをLaTeXに含めるには、以下のコードがその例となるだろう: > + + call TexNewMathZone(sfx,mathzone,starform) +新しいmathグループに一意な接尾辞をつけたいと思うだろう(現在のところ、AからLま +でとVからZまでは<syntax/tex.vim>自身によって取得されている)。 +例として、<syntax/tex.vim>でeqnarrayがどのように設定されているかを見てみよ +う: > + call TexNewMathZone("D","eqnarray",1) +"mathzone" をあなたが作ったmathグループの名前に変える必要がある。 +また、それが呼ばれるようにするために.vim/after/syntax/tex.vimに書くこと。 +変数 "starform" が真ならば、あなたが作ったmathグループがアスタリスクつきの形を +もつことを意味する(例. eqnarray*)。 + +LOCALMATHをあなたが決めた新しいmathグループに書き換える必要がある。そしてこれ +を.vim/after/syntax/tex.vimに加えること。 + + *tex-style* *b:tex_stylish* + Tex: 新しいスタイルを始めるには ~ + +*.texファイルで "\makeatletter" を使う人がいるかもしれないので、コマンド中で +"@" が使えるようになっている。しかし*.texファイルは次の拡張子: sty cls clo dtx +ltx を持たないので @ をエラーと判断してハイライトする。これを解決するにはこう +する: > + + :let b:tex_stylish = 1 + :set ft=tex + +"let g:tex_stylish=1" を<.vimrc>に書くと<syntax/tex.vim>は常にこのような @ の +使用法を受け入れるようになる。 + + *tex-cchar* *tex-cole* *tex-conceal* + Tex: Conceal モードを活用する ~ + +'conceallevel' が 2 に設定され、エンコーディングとして utf-8 が使われていると +き、さまざまな文字シーケンスがそれに対応した utf-8 グリフとして表示される。対 +応している文字としてはアクセント付き文字、Math ゾーンの中のギリシャ文字、Math +ゾーンの中の上付き記号と下付き記号などがある。すべての上付き記号と下付き記号を +表示できるわけではない。utf-8 がサポートしている範囲でのみ利用可能である。実際 +のところ、サポートされている下付き記号は少ししかない。 + +使用例としては、ウィンドウを垂直分割して (|CTRL-W_v| 参照)、一つのウィンドウは +|'conceallevel'| を 0 に設定してもう一方は 2 に設定し、両方で |'scrollbind'| +を設定するような使い方がある。 + + *g:tex_conceal* + Tex: Conceal モードの選択 ~ + +g:tex_conceal を <.vimrc> で設定することで Conceal モードの表示を変更できる。 +初期設定では、g:tex_conceal には "admgs" が設定されており、これによって次の文 +字セットが Conceal 表示される: > + + a = アクセント/合字 (accents/ligatures) + b = 太字と斜体 (bold and italic) + d = 区切り記号 (delimiters) + m = 数学記号 (math symbols) + g = ギリシャ文字 (Greek) + s = 上付き記号/下付き記号 (superscripts/subscripts) +< +これらの文字を設定から外すことで、それに関連した文字が Conceal 表示されなくな +る。 + + *g:tex_isk* *g:tex_stylish* + Tex: iskeyword を制御する ~ + +通常、LaTeX キーワードは 0-9、a-z、A-z、192-255 のみがサポートされる。Latex +キーワードはアンダースコアをサポートしない (*.sty ファイルを除く)。構文強調表 +示スクリプトは次の手順でそれを判断する: + + * g:tex_stylish が存在して値が 1 なら + ファイルは "sty" ファイルとして扱われる。"_" はキーワードの一 + 部として認識される。 + (g:tex_isk に左右されない) + * または、ファイル名の末尾は sty, cls, clo, dtx, ltx なら + ファイルは "sty" ファイルとして扱われる。"_" はキーワードの一 + 部として認識される。 + (g:tex_isk に左右されない) + + * g:tex_isk が存在するなら、'iskeyword' のローカル値として使用される。 + * 存在しない場合、'iskeyword' のローカル値として 48-57,a-z,A-Z,192-255 + が設定される。 + + *tex-supersub* *g:tex_superscripts* *g:tex_subscripts* + Tex: 下付き記号と上付き記号を制御する + + Conceal による文字の代替表示を有効にするには |tex-conceal| を参照。 + + |g:tex_conceal| を設定することでアクセント、太字/斜体、数学記号、ギリ + シャ文字、上付き記号/下付き記号のどれを Conceal 表示するかを選択でき + る。 + + どの上付き記号/下付き記号を構文に基づいて Conceal 表示 (|:syn-cchar| + 参照) するかを制御できる。すべてのフォントがすべての文字をサポートして + いるわけではないので、Conceal 表示する文字を変更できるようになってい + る。初期設定では次のように設定されている: > + + let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" + let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" +< + 例えば、私は Luxi Mono Bold を使っているが、これは "hklmnpst" に対する + 下付き記号をサポートしていない。そこで私は > + let g:tex_subscripts= "[0-9aeijoruvx,+-/().]" +< この設定を ~/.vim/ftplugin/tex/tex.vim に書いて、utf-8 の謎グリフが表 + 示されないようにしている。 + + +TF *tf.vim* *ft-tf-syntax* + +tfの構文ハイライトには1つのオプションがある。 + +シンクロナイズについて、minlinesのデフォルトは100になっている。この値を変える +には、"tf_minlines" に望みの値をセットする。例: > + + :let tf_minlines = your choice +< +VIM *vim.vim* *ft-vim-syntax* + *g:vimsyn_minlines* *g:vimsyn_maxlines* +正確な構文ハイライトと画面更新速度はトレードオフの問題である。正確さを向上させ +るには、変数 g:vimsyn_minlines の値を大きくすればよい。g:vimsyn_maxlines も画 +面更新頻度を高めるのに使える(これについては|:syn-sync|を参照)。 > + g:vimsyn_minlines : シンクロナイズの最小行数を指定する + g:vimsyn_maxlines : シンクロナイズの最大行数を指定する +< + (g:vim_minlines と g:vim_maxlines はこれらのオプションの以前の名前であ + る) + + *g:vimsyn_embed* +g:vimsyn_embed オプションは、どの外部スクリプト言語の埋め込みに対応するかを指 +定する。 > + + g:vimsyn_embed == 0 : どのスクリプトの埋め込みも対応しない + g:vimsyn_embed =~ 'l' : 埋め込み lua をサポート + g:vimsyn_embed =~ 'm' : 埋め込み mzscheme をサポート + g:vimsyn_embed =~ 'p' : 埋め込み perl をサポート + g:vimsyn_embed =~ 'P' : 埋め込み python をサポート + g:vimsyn_embed =~ 'r' : 埋め込み ruby をサポート + g:vimsyn_embed =~ 't' : 埋め込み tcl をサポート +< +初期設定では、g:vimsyn_embed には Vim がサポートしている言語が設定される。複数 +の埋め込み言語をサポートするには、それぞれの文字を組み合わせて設定する。例、 +g:vimsyn_embed = "mp" なら mzscheme と perl がサポートされる。 + *g:vimsyn_folding* + +syntax/vim.vim によって折り畳みが可能である: > + + g:vimsyn_folding == 0 または変数が存在しない: 構文ベースの折り畳みはしない + g:vimsyn_folding =~ 'a' : augroups + g:vimsyn_folding =~ 'f' : 関数を折り畳む + g:vimsyn_folding =~ 'l' : lua スクリプトを折り畳む + g:vimsyn_folding =~ 'm' : mzscheme スクリプトを折り畳む + g:vimsyn_folding =~ 'p' : perl スクリプトを折り畳む + g:vimsyn_folding =~ 'P' : python スクリプトを折り畳む + g:vimsyn_folding =~ 'r' : ruby スクリプトを折り畳む + g:vimsyn_folding =~ 't' : tcl スクリプトを折り畳む +< + *g:vimsyn_noerror* +syntax/vim.vimによるエラーのハイライトは必ずしも正しいとは限らない。Vim script +は正しくハイライトするのが難しい言語である。エラーのハイライトをやめるには次 +を|vimrc|に書けばよい: > + + let g:vimsyn_noerror = 1 +< + + +XF86CONFIG *xf86conf.vim* *ft-xf86conf-syntax* + +XF86Configファイルの構文はXFree86 v3.xとv4.xで異なっている。両方のバージョンが +サポートされている。自動的に判定がされるが、完全からはほど遠い。手動でバージョ +ンを設定する必要があるかもしれない。使用しているXFree86に応じて、.vimrc中で変 +数xf86conf_xfree86_versionを3または4にセットすること。例: > + :let xf86conf_xfree86_version=3 +複数のバージョンが混在しているときには +変数b:xf86conf_xfree86_versionをセットすること。 + +Note オプション名の中のスペースとアンダースコアはハイライトされない。オプショ +ン名をハイライトさせるには "__s yn con gr_e_e_n" でなく "SyncOnGreen" と書くこ +と。 + + +XML *xml.vim* *ft-xml-syntax* + +Xml名前空間がデフォルトでハイライトされる。次のグローバル変数をセットするとそ +れが無効化される: > + + :let g:xml_namespace_transparent=1 +< + *xml-folding* +xml構文ファイルを使うと、開始タグと終了タグの間を折りたたむ|folding|ことができ +る(|:syn-fold|を参照)。これをオンにするには > + + :let g:xml_syntax_folding = 1 + :set foldmethod=syntax + +とする。 +構文による折り畳みは、構文ハイライトを著しく遅くする可能性がある。特に巨大なファ +イルではそうである。 + + +X Pixmaps (XPM) *xpm.vim* *ft-xpm-syntax* + +xpm.vimは編集中のXPMファイルの内容から、動的に構文要素を生成する。そのため、色 +設定文字列などを変更したときは ":set syn=xpm" などとしてxpm.vimを読み直さなけ +ればならない。 + +色つきのピクセルをコピーするには "yl" で "pixel" をヤンクし、どこかで "P" とし +てそれを挿入する。 + +マウスで図を描くには、次のようにしてみるとよい: > + :function! GetPixel() + : let c = getline(".")[col(".") - 1] + : echo c + : exe "noremap <LeftMouse> <LeftMouse>r".c + : exe "noremap <LeftDrag> <LeftMouse>r".c + :endfunction + :noremap <RightMouse> <LeftMouse>:call GetPixel()<CR> + :set guicursor=n:hor20 " to see the color beneath the cursor +これを行うと、右ボタンがピペットになり、左ボタンがペンになる。これは1ピクセル +につき1文字だけとなっているXPMファイルでうまく機能する。ピクセル文字列の外をク +リックしてはならない。これを自由に改良してください。 + +セルサイズが正方形のフォントを使うと見栄えがよくなる。Xの場合の例: > + :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-* + + +YAML *yaml.vim* *ft-yaml-syntax* + + *g:yaml_schema* *b:yaml_schema* +YAML スキーマとはタグのコンビネーションと、特定されないタグを解決する為のメカ +ニズムである。ユーザーにとってはこれはプレーンなスカラーのコンテンツに依存して +その簡素なスカラー(実際は文字列もしくはそれ以外の何か)をそれぞれ異なる値として +扱う YAML パーサーを意味しているかもしれない: null, boolean, floating-point, +integer. `g:yaml_schema` オプションは特別にハイライトさせるスキーマの値を特定 +する為のオプション。サポートしているスキーマは + +Schema Description ~ +failsafe 追加されるハイライトはない。 +json JSON スタイルの number や boolean, null をサポートする。 +core number や boolean、null をよりサポートする。 +pyyaml timestamp のハイライトをサポートをコアスキーマに追加するが、 + number がどの様に認識されるか、boolean 型として認識する為に多 + くの値が追加されたという点で幾らか違いがある。 + +デフォルトのスキーマは `core`。 + +実際にはスキーマは、プレーンなスカラーに限定されるものではない、これが YAML 仕 +様の定義に存在する唯一の違いであり、唯一異なるシンタックスが定義されているとい +う点を注意しておく。 + + +ZSH *zsh.vim* *ft-zsh-syntax* + +この zsh のための構文スクリプトは、構文に基づく折り畳みを可能にする: > + + :let g:zsh_fold_enable = 1 + +============================================================================== +5. 構文を定義する *:syn-define* *E410* + +構文アイテムには3つのタイプがある。 + +1. キーワード (Keyword) + これはオプション 'iskeyword' で定義されるキーワード文字だけからなる。他の構 + 文要素を含むことはできない。完全な単語(マッチの前後にキーワード文字が存在し + ない)にのみマッチする。キーワード "if" は "if(a=b)" にはマッチする + が、"ifdef x" にはマッチしない。"(" はキーワード文字でなく、"d" はキーワー + ド文字だから。 + +2. マッチ (Match) + 単一の正規表現パターンにマッチする。 + +3. リージョン (Region) + 正規表現パターン "start" のマッチ位置から始まり、正規表現パターン "end" の + マッチ位置で終わる。その間にどんなテキストがあってもよい。正規表現パターン + "skip" を使うとパターン "end" にマッチするのを避けることができる。 + +複数の構文アイテムを1つの構文グループに入れることができる。構文グループにはハ +イライト属性を与えることができる。例えば、"/* .. */" のコメントを定義する要素 +と "// .." のコメントを定義する要素を作り、両方を "Comment" グループに入れる。 +そして "Comment" を青のボールドフォントで表示するように指定すると、両方のタイ +プのコメントに対して同じハイライトがされるようになる。1つの構文要素に対し1つの +構文グループを作ってもよいし、すべての要素を1つのグループに入れてもよい。これ +はハイライト属性をどう指定したいかによる。各要素をそれ自身のグループに入れると +すると、たくさんのグループに対して色を指定しなければならなくなる。 + +構文グループとハイライトグループは似ているが異なることに注意。ハイライトグルー +プに対してはハイライト属性を与えることになる。それらの属性が同名の構文グループ +に対して適用される。 + +同じ箇所に対して複数のアイテムがマッチした場合には、最後に定義されたものが有効 +になる。よって同じテキストにマッチする要素を使って、以前に定義された構文アイテ +ムを上書きすることができる。大文字・小文字の違いも含めてマッチするキーワードが +ある場合は、そうでないものより優先される。 + + +優先順位 *:syn-priority* + +複数の構文アイテムがマッチするときは、以下のルールが適用される: + +1. 複数のマッチまたはリージョンアイテムが同じ場所で始まるときは、後に定義され + たものが優先される。 +2. マッチとリージョンよりキーワードが優先される。 +3. より前の位置から始まる要素が優先される。 + + +大文字・小文字の区別 *:syn-case* *E390* + +:sy[ntax] case [match | ignore] + これ以降の ":syntax" コマンドが大文字・小文字を区別するかどうかを定義 + する。"match" を使うと区別し、"ignore" を使うと区別しなくなる。これ以 + 前の要素には影響せず、次の ":syntax case" コマンドまでのすべての要素に + 影響する。 + +:sy[ntax] case + "syntax case match" または "syntax case ignore" (翻訳される)を表示す + る。 + +スペルチェック *:syn-spell* + +:sy[ntax] spell [toplevel | notoplevel | default] + 構文アイテムに入っていないテキストに対して、どこでスペルチェック + を行うかを定義する: + + toplevel: テキストのスペルチェックを行う。 + notoplevel: テキストのスペルチェックを行わない。 + default: クラスタ@Spellがあるときスペルチェックを行わない。 + + 構文アイテムに入っているテキストはクラスタ@Spellと@NoSpellを使う + |spell-syntax|。クラスタ@Spellと@NoSpellがないときは、スペルチェックは + "default" と "toplevel" に対して行われる。 + + スペルチェックを有効化するにはオプション 'spell' をオンにしなければな + らない。 + +:sy[ntax] spell + "syntax spell toplevel", "syntax spell notoplevel" または + "syntax spell default" (翻訳される)を表示する。 + + +SYNTAX ISKEYWORD SETTING *:syn-iskeyword* + +:sy[ntax] iskeyword [clear | {option}] + キーワード文字を定義する。'iskeyword' オプションに似ているがシン + タックスハイライトのみに適用される。 + + clear: シンタックス固有の iskeyword の設定を無効にし、 + バッファローカルの 'iskeyword' 設定を有効にする。 + {option} シンタックスの 'iskeyword' オプション値を設定する。 + + Example: > + :syntax iskeyword @,48-57,192-255,$,_ +< + これは全てのアルファベットと数字、アクセント付き文字、および "_" と + "$" をシンタック固有の iskeyword オプションに設定する。 + + 引数を指定しない場合は現在の値を表示する。 + + このオプションを設定するとシンタックスパターン内での |/\k| のマッチや + |:syn-keyword| が新しいマッチをチェックする際のデリミタに影響する。 + + シンタックスファイルを書く際はこのコマンドを使って言語固有の文法に対す + る正しい値を設定し 'iskeyword' を変更しない事が推奨されている。 + +キーワードの定義 *:syn-keyword* + +:sy[ntax] keyword {group-name} [{options}] {keyword} .. [{options}] + + キーワードを定義する。 + + {group-name} "Comment" のような構文グループ名。 + [{options}] 後述の|:syn-arguments|を参照。 + {keyword} .. このグループに含めるキーワードのリスト。 + + 例: > + :syntax keyword Type int long char +< + {options}は行のどこに置いてもよい。それらは与えられたキーワード全てに + 適用される。オプションがキーワードの後にあっても同じ。以下の例はまった + く同じ意味になる: > + :syntax keyword Type contained int long char + :syntax keyword Type int long contained char + :syntax keyword Type int long char contained +< *E789* *E890* + Vimのexコマンドのようにキーワードに短縮形があるとき、省略可能な部分を + [] でくくることによって受け入れるキーワードをいっぺんに定義することが + できる: > + :syntax keyword vimCommand ab[breviate] n[ext] +< + キーワードは、その文字全てがオプション 'iskeyword' に含まれていないと + 認識されないことに注意。1文字でも含まれていないものがあると、そのキー + ワードは認識されない。 + マルチバイト文字を使うこともできる。マルチバイト文字は 'iskeyword' に + 含まれている必要はない。 + シンタックス特有の iskeyword 設定については|:syn-iskeyword|を参照。 + + キーワードは常にマッチやリージョンより優先される。キーワードは一要素以 + 上マッチしたとき使われる。キーワードは入れ子にならなく、それ以外のもの + を含むこともできない。 + + オプション名と同じ単語は、それがその位置で利用できないものであったとし + ても、キーワードとして定義することはできない。マッチで代用すること。 + + キーワードの長さは最大80文字である。 + + containmentが異なれば、同じキーワードを複数回定義することができる。例 + えば、まずキーワードをcontainedでなく定義して1つのハイライトグループを + 設定し、次にcontainedとして定義して別のハイライトグループを設定するこ + とができる。例: > + :syn keyword vimCommand tag + :syn keyword vimSetting contained tag +< 構文要素の外側に "tag" があったときはハイライトグループ "vimCommand" + が適用される。"vimSetting" を含む構文要素の中に "tag" があったとき + は "vimSetting" グループが適用される。 + + +マッチの定義 *:syn-match* + +:sy[ntax] match {group-name} [{options}] + [excludenl] + [keepend] + {pattern} + [{options}] + + マッチを定義する。 + + {group-name} "Comment" のような構文グループ名。 + [{options}] 後述の|:syn-arguments|を参照。 + [excludenl] 行末の "$" を含んでいるパターンに対して、行末 + 以降までマッチやリージョンを拡張しないようにす + る。パターンの前に置かなければならない。 + |:syn-excludenl| + keepend 内包されたマッチが終了パターンを越えないように + する。|:syn-keepend|を参照。 + {pattern} マッチを定義する検索パターン。 + 後述の|:syn-pattern|を参照。 + パターンは複数行にもマッチする。よって検索を開 + 始する場所によってマッチが変わってくる可能性が + ある。シンクロナイズが関係してくることに注意。 + + 例 (文字定数にマッチする): > + :syntax match Character /'.'/hs=s+1,he=e-1 +< + +リージョンの定義 *:syn-region* *:syn-start* *:syn-skip* *:syn-end* + *E398* *E399* + +:sy[ntax] region {group-name} [{options}] + [matchgroup={group-name}] + [keepend] + [extend] + [excludenl] + start={start_pattern} .. + [skip={skip_pattern}] + end={end_pattern} .. + [{options}] + + リージョンを定義する。複数行にわたってもよい。 + + {group-name} "Comment" のような構文グループ名。 + [{options}] 後述の|:syn-arguments|を参照。 + [matchgroup={group-name}] 以下の開始パターンと終了パターンのマッチに + のみ使われる構文グループ。マッチの開始パターン + と終了パターンには使われない。開始パターンと終 + 了パターン用に異なるグループを使わないようにリ + セットするにはNONEを使う。 + |:syn-matchgroup|を参照。 + keepend 内包されたマッチが終了パターンを越えないように + する。|:syn-keepend|を参照。 + extend このリージョンを含むアイテムの "keepend" を上 + 書きする。|:syn-extend|を参照。 + excludenl 行末の "$" を含んでいるパターンに対して、行末 + 以降までマッチやアイテムを拡張しないようにす + る。終了パターンに対してのみ使い道がある。適用 + するパターンの前に置かねばならない。 + |:syn-excludenl| + start={start_pattern} リージョンの開始を定義する検索パターン。後述の + |:syn-pattern|を参照。 + skip={skip_pattern} その中ではリージョンの終了を探さないテキストを + 定義する検索パターン。|:syn-pattern|を参照。 + end={end_pattern} リージョンの終了を定義する検索パターン。 + 後述の|:syn-pattern|を参照。 + + 例: > + :syntax region String start=+"+ skip=+\\"+ end=+"+ +< + start/skip/endパターンとオプションはどんな順序で書いてもよい。skip + パターンは0個か1個許される。startとendパターンは1個以上なければならな + い。つまりskipパターンは省略できるが、少なくとも1つのstartとendパター + ンを書かなければならない。等号記号の前後にはホワイトスペースがあっても + よい(たいていはホワイトスペースがないほうが見やすいが)。 + + 2個以上のstartパターンが与えられたときは、それらの1つがマッチすれば十 + 分である。つまりstartパターンらの間にはOR関係があることになる。最後に + マッチしたものが使われる。endパターンについても同じである。 + + endパターンの検索はstartパターンの直後から行われる。これはendパターン + のマッチとstartパターンは決して重ならないことを意味する。 + + skipとendパターンは改行をまたいでマッチしてもよい。しかしパターンの検 + 索はどの行からも始まりうるので、望みどおりにならないこともある。 + skipパターンは次の行のendパターンのマッチを回避しない。問題を避けるに + は単一行のパターンを使うこと。 + + Note: リージョンの開始は、startパターンのマッチによってのみ決まる。 + endパターンの照合のチェックはされない。次のは機能しない: > + :syn region First start="(" end=":" + :syn region Second start="(" end=";" +< Secondは常にFirstより前にマッチする(最後に定義されたパターンが優先さ + れる)。こうすると、その前に ':' があるかどうかに関わらず、Secondのリー + ジョンが次の ';' まで続く。マッチを使うとうまくいく: > + :syn match First "(\_.\{-}:" + :syn match Second "(\_.\{-};" +< このパターンは "\_." によって任意の文字と改行にマッチし、"\{-}" によっ + て繰り返しにマッチする(最小限の個数の繰り返し)。 + + *:syn-keepend* + デフォルトでは内包されたマッチはendパターンのマッチを隠す。これはネス + ト用に便利である。例えば、"{" で始まり "}" で終わるリージョンがもう1つ + のリージョンを含むことができる。"}" に出会うと内包されたリージョンが終 + わり、外側のリージョンは終了しない: + { 外側の "{}" リージョンの開始 + { 内包された "{}" リージョンの開始 + } 内包された "{}" リージョンの終了 + } 外側の "{}" リージョンの終了 + この挙動が望みでないなら、引数 "keepend" をつければ、外側のリージョン + のendパターンのマッチによって内包されたアイテムも終了させることができ + る。そうすると同一リージョンのネストが不可能になるが、内包されたアイテ + ムでendパターンをスキップさせることなく、endパターンの一部をハイライト + することができる。例: > + :syn match vimComment +"[^"]\+$+ + :syn region vimCommand start="set" end="$" contains=vimComment keepend +< "keepend" によってvimCommandが常に行末で終わるようにしている。たとえ内 + 包されたvimCommentが<EOL>とのマッチを含んでいてもそのようになる。 + + "keepend" が使われないときは、内包されたマッチの後でendパターンのマッ + チが検索される。"keepend" が含まれているときは最初にendパターンにマッ + チしたところで終了し、内包されたマッチもすべてそこで終了になる。 + + *:syn-extend* + 引数 "extend" を使うと "keepend" の挙動が変わる。"keepend" 付きのアイ + テム中に "extend" 付きのアイテムが内包されていると、"keepend" が無視さ + れ、外側のリージョンが拡張される。これによっていくつかのアイテムに対し + て例外的にリージョンを拡張させるようにできる。例: > + + :syn region htmlRef start=+<a>+ end=+</a>+ keepend contains=htmlItem,htmlScript + :syn match htmlItem +<[^>]*>+ contained + :syn region htmlScript start=+<script+ end=+</script[^>]*>+ contained extend + +< + この例では、htmlItemの位置でhtmlRefが終了する。htmlItemは<>要素をハイ + ライトするためだけに使われる。htmlScriptアイテムはhtmlRefアイテムを拡 + 張する。 + + もう1つの例: > + :syn region xmlFold start="<a>" end="</a>" fold transparent keepend extend +< "</a>" を別の色でハイライトしたいときなどのために、"keepend" つきでリー + ジョンを定義し、内包するアイテムによって終端が変更されないようにしてい + る。ただしxmlFoldがネストしたとき(それ自身を含んだとき)、"extend" が適 + 用され、内側の "</a>" はそのリージョン自身だけを終了させ、それを含んで + いるリージョンは終了しない。 + + *:syn-excludenl* + マッチ用のパターンやリージョンの終了パターンが行末にマッチさせるために + '$' を含んでいると、それを含むリージョンアイテムが次の行まで継続するよ + うになる。例えば、"\\$" (行末のバックスラッシュ)とのマッチを使うと、通 + 常は行末で終了するはずのリージョンを継続させることができる。これはデ + フォルトの挙動である。これが望みどおりでないなら、これをされる2つの方 + 法がある: + 1. 外側のアイテムに "keepend" を使う。こうすると含んでいるアイテム全て + に対して拡張しないようにする。含んでいるアイテム全てが外側のアイテム + を拡張してはならないときに使える。 + 2. 内側のアイテムに "excludenl" を使う。こうするとそのマッチに対して、 + それを含んでいるマッチやリージョンを拡張しないようにする。これはい + くつかのアイテムだけが外側のアイテムを拡張してはならないときに使え + る。"excludenl" はそれを適用するパターンの前に置かねばならない。 + + *:syn-matchgroup* + "matchgroup" は、リージョンの本体とその開始・終了パターンに対して異な + るハイライトをしたいときに使える。例: > + :syntax region String matchgroup=Quote start=+"+ skip=+\\"+ end=+"+ +< こうすると引用符を "Quote" グループでハイライトし、その間にあるテキス + トを "String" グループでハイライトすることができる。"matchgroup" はそ + れが従うすべての開始・終了パターンに対して使われる。matchgroupを使わな + いように戻すには "matchgroup=NONE" を使う。 + + 開始・終了パターンが "matchgroup" でハイライトされるとき、そのリージョ + ンに含まれているアイテムは無視される。これによって含まれているアイテム + が開始・終了パターンにマッチするのを避けることができる。"transparent" + を使っている場合、これは "matchgroup" でハイライトされる開始・終了パ + ターンのマッチ部分には適用されない。 + + 次の例は、3段階の括弧を異なる色でハイライトする例である: > + :sy region par1 matchgroup=par1 start=/(/ end=/)/ contains=par2 + :sy region par2 matchgroup=par2 start=/(/ end=/)/ contains=par3 contained + :sy region par3 matchgroup=par3 start=/(/ end=/)/ contains=par1 contained + :hi par1 ctermfg=red guifg=red + :hi par2 ctermfg=blue guifg=blue + :hi par3 ctermfg=darkgreen guifg=darkgreen +< + *E849* +構文グループの最大数は 19999 である。 + +============================================================================== +6. :syntaxの引数 *:syn-arguments* + +構文アイテムを定義する :syntax コマンドにはたくさんの引数がある。 +ここでは共通のものを説明する。引数はどんな順序でもよく、パターンと混ざっていて +もよい。 + +全てのコマンドが全ての引数を受けいれるわけではない。次の表はどの引数がどのコマ +ンドに対して利用可能かを示している: + *E395* + contains oneline fold display extend concealends~ +:syntax keyword - - - - - - +:syntax match yes - yes yes yes - +:syntax region yes yes yes yes yes yes + +以下の引数は3つのコマンド全てに対して使える: + conceal + cchar + contained + containedin + nextgroup + transparent + skipwhite + skipnl + skipempty + +conceal *conceal* *:syn-conceal* +{訳注: conceal = 隠す、秘密にする} + +"conceal" 引数が指定されると、そのアイテムは Conceal 可能になる。アイテムが実 +際に Conceal 表示されるかどうかは 'conceallevel' オプションの設定に依存する。 +現在行のアイテムを Conceal 表示するかどうかは 'concealcursor' オプションで制御 +できる (行の編集を妨げないようにするため)。 +もう一つの方法として|matchadd()|を用いても、テキストを隠すことができる。 + +concealends *:syn-concealends* + +"concealends" 引数が指定されると、リージョンの開始部分と終了部分が Conceal 可 +能になる (リージョンの中身はならない)。アイテムが実際に Conceal 表示されるかど +うかは 'conceallevel' の設定に依存する。"matchgroup" で別のハイライトを設定す +ることでリージョンの終了部分だけを別に Conceal 表示するということもできる。 + +cchar *:syn-cchar* + *E844* +"cchar" 引数はアイテムが Conceal 表示されたときに実際に画面に表示される文字を +定義する ("cchar" は conceal 引数が指定されたときのみ意味を持つ)。 +"cchar" が指定されていない場合はデフォルトの Conceal 文字として 'listchars' オ +プションが使われる。Tab 文字のようなコントロール文字は使用できない。例: > + :syntax match Entity "&" conceal cchar=& +ハイライトについては |hl-Conceal| を参照のこと。 + +contained *:syn-contained* + +引数 "contained" が与えられると、そのアイテムはトップレベルでは認識されず、他 +のマッチの "contains" フィールドで指定されたときのみ認識される。例: > + :syntax keyword Todo TODO contained + :syntax match Comment "//.*" contains=Todo + + +display *:syn-display* + +引数 "display" が与えられると、そのアイテムは検出されたハイライトが表示されな +い時にはスキップされる。こうすることで、表示されるべきテキストの構文状態だけを +検索するときにはこのアイテムはスキップされ、ハイライトが高速になる。 + +通常は、以下の条件に合うときマッチとリージョンに "display" を使うとよい: +- アイテムが行末を越えて継続しない。Cの例: "/*" コメント用のリージョンは + "display" を含んではならない。なぜなら次の行に継続するからである。 +- アイテムが、行を越えて継続したり、そのコンテナを次行まで継続させる効果を持つ + 子アイテムを含んでいない。 +- それを含むどんなアイテムのサイズも変更しない。Cの例: プリプロセッサーマッチ + 中の "\\$" とのマッチは "display" を含んではならない。なぜならこれによってプ + リプロセッサーマッチが短くなるかもしれないからである。 +- 他のアイテムがマッチすることを許さず、そうでなければマッチせず、加えてマッチ + 自体が非常に長くなるようなアイテム。 + Cの例: "//" コメント用のマッチは "display" を使ってはならない。なぜならその + コメントの内側の "/*" がマッチするかも知れず、そうなると行末をまたぐコメント + が始まるからである。 + +例としてC言語では次のとき "display" が使える: +- 数字とのマッチ +- ラベルとのマッチ + + +transparent *:syn-transparent* + +引数 "transparent" が与えられると、そのアイテムはそれ自身ではハイライトされず、 +それを含むアイテムのハイライトを引き継ぐ。これはハイライトはせず、テキストの一 +部をスキップするためだけに使われる構文アイテムに対して有効である。 + +transparentなアイテム自身に引数 "contains" が与えられていない場合、それを含む +アイテムから引数 "contains=" も受け継がれる。望まないアイテムが含まれるのを避 +けるには "contains=NONE" とすること。文字列中の単語をハイライトするが、"vim" +だけは例外とする例: > + :syn match myString /'[^']*'/ contains=myWord,myVim + :syn match myWord /\<[a-z]*\>/ contained + :syn match myVim /\<vim\>/ transparent contained contains=NONE + :hi link myString String + :hi link myWord Comment +"myVimが "myWord" の後に来ているので、"myVim" が優先される(同じ位置で複数のア +イテムにマッチした場合、最後に定義されたものが前のものを上書きする)。 +"transparent" により、"myVim" にマッチしたテキストは "myString" と同じハイライ +トになる。しかし "myVim" は何も含まない。もし "contains=NONE" を取り除くと、 +"myVim" は "myString" から引数containsを受け継いで "myWord" を含むようになり、 +テキスト "vim" はConstantとしてハイライトされる。これは、内包されたマッチは同 +じ位置でそれ自身の内側でマッチしないためこうなる。つまり、ここではマッチ +"myVim" は、マッチ "myWord" を上書きしない。 + +色づけされたテキストは、内包されたアイテムの層のようにみなすことができる。内包 +されたアイテムは内包しているアイテムより上にあり、そのため内包されたアイテムを +見ることができる。内包されたアイテムがtransparentな場合、それを透過して見るこ +とができ、よってそれを含んでいるアイテムが見える。図にすると: + + ここから見る + + | | | | | | + V V V V V V + + xxxx yyy さらに内包されたアイテム達 + .................... 内包されたアイテム (transparent) + ============================= 最初のアイテム (最も外側のアイテム) + +'x', 'y', '=' はハイライトされた構文アイテムを表す。'.' はtransparentなグルー +プを表している。 + +このとき次のように見える: + + =======xxxx=======yyy======== + +つまりtransparentな "...." は透過して見える。 + + +oneline *:syn-oneline* + +引数 "oneline" をつけると、そのリージョンは行をまたがないという意味になる。つ +まり、現在行の中で完全にマッチしなければならない。しかし、そのリージョンが行を +またぐアイテムを内包している場合は次の行に継続する。内包されたアイテムによって +行継続パターンを認識することができる。しかしその場合でも "end" パターンは最初 +の行内でマッチしなければならない。そうでないとリージョンは開始すらしない。 + +startパターンが行末にマッチする "\n" を含んでいるときは、startパターンの終了位 +置と同じ行にendパターンがなければならない。endパターンも行末を含んでもよい。つ +まり引数 "oneline" は、startパターンの終了位置とendパターンの開始位置が同一行 +にあることを意味する。改行にマッチするskipパターンを使ってもこの規則を変えるこ +とはできない。 + +fold *:syn-fold* + +引数 "fold" はこのアイテムに対して折り畳みレベルを1増加させる。例: > + :syn region myFold start="{" end="}" transparent fold + :syn sync fromstart + :set foldmethod=syntax +これは{}ブロックごとに1つの折り畳みを作らせる。 + +折り畳みはそのアイテムの開始位置から始まり、アイテムの終了位置で終わる。開始位 +置と終了位置が同一行にある場合、折り畳みは作られない。 +オプション 'foldnestmax' によって構文折り畳みのネストを制限できる。 +{|+folding|機能なしでコンパイルされた場合は利用できない} + + + *:syn-contains* *E405* *E406* *E407* *E408* *E409* +contains={group-name},.. + +引数 "contains" の後には構文グループ名のリストを続ける。"contains" で指定され +たグループは、そのアイテムの内側で始まることを許可される(内包されるグループに +よっては、外側のアイテムの終端が拡張されることもある)。これを使うと、マッチと +リージョンが再帰的にネストできるようになる。引数 "contains" がまったく指定され +ない場合は、そのアイテムはどんなグループも内包しない。ここで使うグループ名は、 +必ずしも以前に定義していなくてもよい。 + +contains=ALL + containsリストが "ALL" だけのとき、全てのグループがこのアイテ + ムの内側で許可される。 + +contains=ALLBUT,{group-name},.. + + containsリストの最初の要素が "ALLBUT" のとき、{group-name}で列 + 挙したグループを除く全てのグループがこのアイテムの内側で許可さ + れる。例: > + :syntax region Block start="{" end="}" ... contains=ALLBUT,Function + +contains=TOP + containsリストの最初の要素が "TOP" のとき、引数 "contained" を + 持たないグループ全てが許可される。 +contains=TOP,{group-name},.. + "TOP" と同様だが、{group-name}に列挙したグループは除かれる。 + +contains=CONTAINED + containsリストの最初の要素が "CONTAINED" のとき、引数 + "contained" を持つグループ全てが許可される。 +contains=CONTAINED,{group-name},.. + "CONTAINED" と同様だが、{group-name}に列挙したグループは除かれ + る。 + + +"contains" リスト内の{group-name}はパターンであってもよい。そのパターンにマッ +チするグループ名全てが含まれる("ALLBUT" が使われたときはそれが除かれる)。パター +ンはホワイトスペースや ',' を含んではならない。例: > + ... contains=Comment.*,Keyw[0-3] +パターンの照合はそのsyntaxコマンドが実行されたときに行われる。それ以降に定義さ +れたグループは照合されない。また、現在のsyntaxコマンドが新しいグループを定義し +ている場合、そのグループは照合されない。ファイル内にsyntaxコマンドを書く場合、 +定義されていないグループを当てにすることはできないことに注意。これは、そのファ +イルは以前に読み込まれているかもしれず、":syn clear" はグループ名を削除しない +ためである。 + +内包されたグループはリージョンのstartとendパターン内にもマッチする。これが望み +の挙動でないなら、引数 "matchgroup" を使うとよい|:syn-matchgroup|。オフセット +"ms=" と "me=" によって内包されたアイテムがマッチする領域を変更することができ +る。これはハイライトされる範囲も制限することに注意。 + + +containedin={group-name}... *:syn-containedin* + +引数 "containedin" の後には構文グループ名のリストを続ける。するとこのアイテム +がそれらのグループの内側で始まることが許可される。これは外側のアイテムが引数 +"contains=" でこのアイテムを指定したのと同じように動作する。 + +{group-name}...の指定の仕方は前述の "contains" と同様である。 + +これは構文アイテムを後から追加するときに便利である。既に定義されているアイテム +の定義を変更することなく、その内側にアイテムを含めることができる。例えば、Cの +構文を読み込んだ後で、Cコメント中の単語をハイライトしたいときは: > + :syn keyword myword HELP containedin=cComment contained +このアイテムがトップレベルではマッチしないように "contained" を使っている。 + +"containedin" の照合は、このアイテムが現れる場所に追加される。引数 "contains" +も通常通り追加される。注意: キーワードは他のアイテムを含むことができないため、 +"containedin" の先にキーワードを指定することは無意味である。 + + +nextgroup={group-name},.. *:syn-nextgroup* + +引数 "nextgroup" の後には構文グループ名のリストをコンマ区切りで続ける +("contains" と同様。パターンを使うこともできる)。 + +引数 "nextgroup" が与えられると、マッチやリージョンの終了位置の後ろで、指定さ +れた構文グループにマッチする部分が探される。どのグループもマッチしなければ、ハ +イライトは通常通り続けられる。マッチが見つかった場合はそのグループが使われる。 +現在のグループの引数 "contains" でそのグループが指定されていなくてもそうなる。 +つまり、これは指定されたグループの優先度を最大にすることと同じである。例: > + :syntax match ccFoobar "Foo.\{-}Bar" contains=ccFoo + :syntax match ccFoo "Foo" contained nextgroup=ccFiller + :syntax region ccFiller start="." matchgroup=ccBar end="Bar" contained + +これは "Foo" の後に "Bar" が現れたときのみ、"Foo" と "Bar" に異なるハイライト +をする。以下のテキストにおいて、"f" と書いたところはccFooでハイライトされ、 +"bbb" と書いたところはccBarでハイライトされる。 > + + Foo asdfasd Bar asdf Foo asdf Bar asdf + fff bbb fff bbb + +".\{-}" を使い、次のBarまでのスキップが最小になるようにしている。もし ".*" を +使うと、最初の "Foo" と最後の "Bar" がccFooBarのマッチ部分に含まれるため、 +"Bar" と "Foo" の間の "asdf" が "ccFoobar" グループとしてハイライトされてしま +う(|pattern|を参照)。 + + +skipwhite *:syn-skipwhite* +skipnl *:syn-skipnl* +skipempty *:syn-skipempty* + +これら3個の引数は "nextgroup" と組み合わせたときのみ意味を持つ。これらを指定す +ると、次のグループがマッチする前に、以下のテキストがあってもよくなる。 + skipwhite スペースとタブ文字をスキップする + skipnl 行末をスキップする + skipempty 空行をスキップする(自動的に "skipnl" も含むことになる) + +例えば "skilwhite" を指定した場合、次のどのグループもホワイトスペースにマッチ +しないならば、ホワイトスペースをスキップする。 + +"skipnl" を指定すると、nextgroupの照合が次の行からも探される。これは現在のアイ +テムが行末で終わったときのみ有効である。"skipnl" を指定しない場合、nextgroupは +同一行のそのアイテム以降から照合される。 + +次のグループまでスキップされたテキストの中では他のグループの照合は無視される。 +次のグループの照合が見つからなかったとき、再び他のグループの照合が検索される。 +つまり、次のグループの照合と、ホワイトスペースと<EOL>のスキップは他のアイテム +より優先される。 + +例: > + :syn match ifstart "\<if.*" nextgroup=ifline skipwhite skipempty + :syn match ifline "[^ \t].*" nextgroup=ifline skipwhite skipempty contained + :syn match ifline "endif" contained +Note マッチ "[^ \t].*" はホワイトスペース以外の全てのテキストにマッチする。よっ +て "endif" にもマッチする。そのためマッチ "endif" を最後に置き、最優先にしてい +る。 +Note この例はネストした "if" には機能しないことに注意。ネストに対応するには引 +数 "contains" を指定する必要がある(この例では簡単のため省略した)。 + +暗黙 CONCEAL (IMPLICIT CONCEAL) *:syn-conceal-implicit* + +:sy[ntax] conceal [on|off] + これ以降の ":syntax" コマンドでキーワード、マッチ、リージョンを定義し + たときに "conceal" フラグをセットするかどうかを定義する。":syn conceal + on" を実行した後で ":syn keyword"、":syn match"、":syn region" を実行 + すると、暗黙的に "conceal" フラグがセットされる。":syn conceal off" を + 実行することで通常の状態、つまり "conceal" フラグを明示的に設定しなけ + ればならない状態に戻る。 + +:sy[ntax] conceal + "syntax conceal on" または "syntax conceal off" (翻訳される)を表示す + る。 + +============================================================================== +7. syntaxのパターン *:syn-pattern* *E401* *E402* + +syntaxコマンドでは、パターンの前後を同じ文字で囲まなければならない。これは +":s" コマンドと同様である。もっともよく使われるのはダブルクォートである。しか +しパターンがダブルクォートを含んでいる場合は、そのパターンが含んでいない他の文 +字を使ったほうがよい。例: > + :syntax region Comment start="/\*" end="\*/" + :syntax region String start=+"+ end=+"+ skip=+\\"+ + +パターンの説明については|pattern|を参照。構文パターンは常に 'magic' オプション +がセットされているのと同じように解釈される(実際の 'magic' オプションの値とは無 +関係)。また、'cpoptions' に 'l' フラグが含まれていない場合と同じように解釈され +る。これは構文ファイルの可搬性を高め、'compatible' と 'magic' の設定と無関係に +するためである。 + +"[a-z]*" など空文字列にマッチするパターンは避けること。これは全ての位置にマッ +チするため、ハイライトがとても遅くなる。 + + *:syn-pattern-offset* +パターンに文字数のオフセットを指定することができる。これによってハイライトされ +る部分を変更したり、マッチやリージョンに含まれるテキスト領域(これは他のアイテ +ムを照合するときにだけ関係する)を変更することができる。どちらもマッチしたパター +ンに相対的である。skipパターンに対して文字数のオフセットを指定すると、endパター +ンの検索が始まる位置を決めることができる。 + +オフセットは "{what}={offset}" の形で指定する。 +{what}は次の7個の文字列のどれかである: + +ms Match Start マッチしたテキストの開始位置のオフセット +me Match End マッチしたテキストの終了位置のオフセット +hs Highlight Start ハイライトが始まる位置のオフセット +he Highlight End ハイライトが終わる位置のオフセット +rs Region Start リージョンの本体が始まる位置のオフセット +re Region End リージョンが終わる位置のオフセット +lc Leading Context パターンの "leading context" を過ぎた後のオフセット + +{offset}は次のうちのどれか: + +s パターンのマッチ部分の先頭 +s+{nr} パターンのマッチ部分の先頭から右へ{nr}文字目 +s-{nr} パターンのマッチ部分の先頭から左へ{nr}文字目 +e パターンのマッチ部分の末尾 +e+{nr} パターンのマッチ部分の末尾から右へ{nr}文字目 +e-{nr} パターンのマッチ部分の末尾から左へ{nr}文字目 +{nr} ("lc" 専用): 右へ{nr}文字目からマッチを開始する + +例: "ms=s+1", "hs=e-2", "lc=3". + +どのパターンの後にどのオフセットを指定してもよいが、それが意味を持たない場合も +ある。次の表はどのオフセットが実際に有効かを示している: + + ms me hs he rs re lc ~ +match item yes yes yes yes - - yes +region item start yes - yes - yes - yes +region item skip - yes - - - - yes +region item end - yes - yes - yes yes + +複数のオフセットの間に ',' を入れて連結することができる。例: > + :syn match String /"[^"]*"/hs=s+1,he=e-1 +< + some "string" text + ^^^^^^ ここがハイライトされる + +Notes: +- パターンとオフセットの間にホワイトスペースを挟んではならない。 +- ハイライトされる領域がマッチしたテキストの外側にはみ出してはならない。 +- endパターンに対する負のオフセットは機能しない場合がある。これはハイライトが + 既に終わっているべきとき、endパターンは検出されない可能性があるからである。 +- Vim 7.2 以前では、オフセットは文字単位でなくバイト単位であった。それではマル + チバイト文字ではうまく機能しないので、7.2 から変更された。 +- マッチの開始位置が、パターンがマッチした位置と別の行になってはならない。つま + り "a\nb"ms=e というのは正常に機能しない。ハイライトの開始位置は別の行にあっ + てもかまわない。"a\nb"hs=e というのは正常に機能する。 + +例(コメントにマッチするが /* と */ はハイライトしない): > + :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1 +< + /* this is a comment */ + ^^^^^^^^^^^^^^^^^^^ ここがハイライトされる + +より複雑な例: > + :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1 +< + abcfoostringbarabc + mmmmmmmmmmm マッチ部分 + sssrrreee start/region/endとしてハイライトされる部分 + ("Foo", "Exa", "Bar") + +Leading context *:syn-lc* *:syn-leading* *:syn-context* + +Note: これは古い機能であり、以前のバージョンとの後方互換性のためだけに残されて +いる。現在はパターン中の|/\@<=|コンストラクトを使うことが推奨されている。 + +"lc" オフセットはリーディングコンテキストを指定する。これはパターンの一部にな +ければならないが、マッチ部分の一部とは見なされないものである。"lc=n" のオフセッ +トを使うとパターンの照合を試みる前にn桁戻るようになる。リーディングコンテキス +ト内に他のパターンにマッチしている文字が現れてもよい。これはマッチの前方にあっ +てはならない「エスケープ」文字を指定する場合などに使える: > + + :syn match ZNoBackslash "[^\\]z"ms=s+1 + :syn match WNoBackslash "[^\\]w"lc=1 + :syn match Underline "_\+" +< + ___zzzz ___wwww + ^^^ ^^^ Underlineにマッチする + ^ ^ ZNoBackslashにマッチする + ^^^^ WNoBackslashにマッチする + +"ms" を指定しないと自動的に "lc" と同じ値にセットされる。 + + +複数行にわたるパターン *:syn-multi-line* + +パターンが "\n" を含むと改行にマッチするようになる。たいていの場合これは期待通 +りに動作するが、少しだけ例外がある。 + +startパターンにオフセットをつけるとき、マッチ部分の開始位置が次の行の先頭で +あってはならない。ハイライトは次の行で始まってもよい。"\zs" を使うときも、マッ +チ部分の開始位置が他の行になってはならない。 + +skipパターンも "\n" を含んでよい。ただし次の行の最初の文字がskipパターンにマッ +チしていても、そこからendパターンの検索が続けられる。これは、再描画は領域内の +どの行でも始まることができ、skipパターンが前の行から始まったかどうかはチェック +されないからである。例えば、skipパターンが "a\nb" で、endパターンが "b" のと +き、次のテキストの2行目でendパターンがマッチする。 > + x x a + b x x +つまり、skipパターンは "\n" 以降の文字にはマッチしないことになる。 + + +外部マッチ *:syn-ext-match* + +リージョンのパターンでは特別に以下の正規表現が使える: + + */\z(* */\z(\)* *E50* *E52* *E879* + \z(\) 一部を「external」としてマークする。これをつけると他のパターン + からアクセスできるようになる。現在はリージョンのstartパターン + 内でのみ使用可能。 + + */\z1* */\z2* */\z3* */\z4* */\z5* + \z1 ... \z9 */\z6* */\z7* */\z8* */\z9* *E66* *E67* + startパターンにマッチしたテキスト中からマークしておいた部分を + 参照する。 + +リージョンのstartとendパターンで正規表現の一部を共有したい場合がある。 +一般的な例としてはPerlやUnixシェルのヒアドキュメントがある。これは特別な正規表 +現アイテム "\z" を使えば達成できる。これは正規表現の一部を "external" として +マークしておく。するとその部分を他のパターンから参照できるようになる。例えば、 +ヒアドキュメントは次のようにすればよい: > + :syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$" + +このように、\zは2つの役割を果たす。startパターンにおいては正規表現の一部 +"\(\I\i*\)" をexternalとしてマークする。endパターンでは\z1によってstartパターン +中の最初のマークされた部分への外部参照とする。外部参照はskipパターン中でも使え +る: > + :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1" + +通常のマークとexternalなマークはまったく独立であり、別々に番号が振られる。例え +ば、文字列 "aabb" に対してパターン "\z(..\)\(..\)" を適用すると、\1は "bb" を +参照し、\z1は "aa" を参照するようになる。externalなマークをした部分は、通常の +マークと違って、同一パターン内で後方参照することはできない。ある部分に対して通 +常のマーク、externalなマーク両方をつけたい場合は、"\(\z(...\)\)" のようにネス +トさせればよい。 + +一行内でマッチした部分しか参照できないことに注意。複数行にわたってマッチした部 +分は参照できない。 + +============================================================================== +8. クラスタ *:syn-cluster* *E400* + +:sy[ntax] cluster {cluster-name} [contains={group-name}..] + [add={group-name}..] + [remove={group-name}..] + +このコマンドを使うと、複数の構文グループを1つの名前のもとにまとめることができ +る。このまとまりのことをクラスタと呼ぶ。 + + contains={group-name}.. + クラスタに含まれるグループを指定する。 + add={group-name}.. + 指定したグループをクラスタに加える。 + remove={group-name}.. + 指定したグループをクラスタからとり除く。 + +定義したクラスタはcontains=..やcontainedin=..、nextgroup=..、add=..、remove=.. +などの文脈で使うことができる。そのとき、クラスタ名の頭に "@" をつける。クラス +タを定義する前にそのクラスタ名を使用してもよい。 + +例: > + :syntax match Thing "# [^#]\+ #" contains=@ThingMembers + :syntax cluster ThingMembers contains=ThingMember1,ThingMember2 + +この例からわかるように、クラスタに対する変更はさかのぼって効果がある。クラスタ +の定義は直前になってチェックされる。例: > + :syntax keyword A aaa + :syntax keyword B bbb + :syntax cluster AandB contains=A + :syntax match Stuff "( aaa bbb )" contains=@AandB + :syntax cluster AandB add=B " これによって2つのキーワードがStuff内で + マッチするようになる + +これはクラスタのネスト度にも関係がある: > + :syntax keyword A aaa + :syntax keyword B bbb + :syntax cluster SmallGroup contains=B + :syntax cluster BigGroup contains=A,@SmallGroup + :syntax match Stuff "( aaa bbb )" contains=@BigGroup + :syntax cluster BigGroup remove=B " BはBigGroup内にないので無意味 + :syntax cluster SmallGroup remove=B " Stuff内でbbbがマッチしなくなる +< + *E848* +クラスタの最大数は 9767 である。 + +============================================================================== +9. 構文ファイルのインクルード *:syn-include* *E397* + +構文ファイルの中で、関係する構文ファイルをインクルードしたい場合がある。 +これには、構文ファイルの関係に応じて2種類の方法がある: + + - インクルードされるファイル内のトップレベルのアイテムをそのままトップ + レベルとしたい場合は、単に|:runtime|コマンドを使えばよい: > + + " In cpp.vim: + :runtime! syntax/c.vim + :unlet b:current_syntax + +< - インクルードされるファイル内のトップレベルのアイテムをリージョンに内 + 包させるには、":syntax include" コマンドを使うとよい: > + +:sy[ntax] include [@{grouplist-name}] {file-name} + + インクルードされるファイル中で宣言された構文アイテム全てに + "contained" フラグがつけられる。さらにグループのリストを指定すると、 + インクルードされるファイル中のトップレベルの構文アイテム全てに対して + そのリストがつけられる。 > + + " In perl.vim: + :syntax include @Pod <sfile>:p:h/pod.vim + :syntax region perlPOD start="^=head" end="^=cut" contains=@Pod +< + {file-name}が絶対パスである場合("/", "c:", "$VAR", "<sfile>" のどれ + かで始まる場合)そのファイルが読み込まれる(sourceされる)。相対パスの + 場合(例: "syntax/pod.vim")、そのファイルが 'runtimepath' 中から探さ + れる。マッチしたファイル全てが読み込まれる。相対パスを使用することが + 推奨される。そうすればユーザーが ":syn include" を書き換えることなく、 + インクルードされるファイルを改変して別の場所に置けるからである。 + + *E847* +インクルードの最大数は 999 である。 + +============================================================================== +10. 表示のシンクロナイズ *:syn-sync* *E403* *E404* + +ドキュメント中のどの位置からでも再描画を開始できると望ましい。これを実現するに +は、再描画を開始する位置における構文の状態を知る必要がある。 + +:sy[ntax] sync [ccomment [group-name] | minlines={N} | ...] + +シンクロナイズには4つのやり方がある: +1. 常にファイルの最初からパースする。 + |:syn-sync-first| +2. Cスタイルのコメントに基づく。VimはCコメントの仕様を理解し、現在行がコメント + の内側から始まっているか外側から始まっているかを判定することができる。 + |:syn-sync-second| +3. 一定行さかのぼり、そこからパースを開始する。 + |:syn-sync-third| +4. テキストをさかのぼり、シンクロナイズを始める目印の正規表現を検索する。 + |:syn-sync-fourth| + + *:syn-sync-maxlines* *:syn-sync-minlines* +最後の3つの方法に関して、さかのぼる行数は "minlines" と "maxlines" で制限され +る。 + +引数 "minlines={N}" が指定されると、常に少なくともその行数さかのぼってパースが +開始される。パースする行数が少なすぎて正しくハイライトできないかもしれないと +き、またはシンクロナイズを使うのが不可能であるとき、この引数を使うとよい。 + +引数 "maxlines={N}" が指定されると、コメントや正規表現を検索するためにさかのぼ +る行数が最大N行になる。これは遅いマシンを使っていて、シンクロナイズする行数が +少ないとわかっているときに便利である。例: > + :syntax sync maxlines=500 ccomment +< + *:syn-sync-linebreaks* +複数行にマッチする正規表現を使っているとき、ある行に変更を施すと、前の行でマッ +チしていた正規表現がマッチしなくなってしまうことがある。この場合、変更を施した +位置より上からシンクロナイズを行わなければならない。その行数を引数 "linebreaks" +で指定する。例えば、正規表現が改行を1個含んでいる場合はこのようにする: > + :syntax sync linebreaks=1 +こうすると、常に変更が施された行の少なくとも1行前から再描画が開始される。 +"linebreaks" のデフォルト値は0。通常 "minlines" の値は "linebreaks" の値より大 +きい。 + +第一の方法: *:syn-sync-first* +> + :syntax sync fromstart + +ファイルの最初からパースする。この方法を使うと構文ハイライトが正確になるが、大 +きいファイルに対しては遅くなる。Vimは以前にパースしたテキストをキャッシュして +おく。そのため、遅くなるのはファイルを最初にパースするときだけである。しかし、 +変更を施すと、それ以降の一部をパースし直さなければならなくなる(最悪の場合はファ +イルの最後まで)。 + +"fromstart" を使うことは "minlines" を非常に大きな値にすることと同じ効果を持 +つ。 + + +第二の方法: *:syn-sync-second* *:syn-sync-ccomment* + +第二の方法を使うには、単に引数 "ccomment" をつければよい。 +例: > + :syntax sync ccomment + +画面最上行がCスタイルコメントの内側にあると判断される場合、グループ名が +"Comment" のリージョン構文アイテムが使われる。この方法を使うには "Comment" と +いうグループ名のリージョンがなければならないことに注意。他のグループ名を指定す +ることもできる。例: > + :syntax sync ccomment javaComment +こうすると、検出されたCコメントのリージョンに対して "syn region javaComment" +で指定されたアイテムのうち最後のものが使われる。ここで指定するリージョンの +startパターンが "\/*"、endパターンが "*\/" となっていないと適切に機能しない。 + +引数 "maxlines" を使うと検索の行数を制限できる。引数 "minlines" を使うと少なく +ともその行数だけさかのぼって開始させることができる(例:2,3行だけを受け取るコン +ストラクトがある場合。ただしその場合シンクロナイズするのが困難) + +Note: "*/" を含む文字列で行をまたぐものがあると、Cコメントによるシンクロナイズ +は適切に機能しない。行をまたいで文字列を書くのは悪いプログラミング習慣である +(多くのコンパイラが警告を出す)。また、コメント中に "*/" が現れる機会はまれなの +で、この制限は注意するほどのものではない。 + + +第三の方法: *:syn-sync-third* + +第三の方法を使うには引数 "minlines={N}" を加えればよい。この方法を指定すると、 +{N}行前からパースを開始する。これは{N}行余分にパースされることを意味する。その +ためこの方法は少し遅くなる。 +例: > + :syntax sync minlines=50 + +"lines" は "minlines" と同じ意味である(古いバージョンで使われている)。 + +第四の方法: *:syn-sync-fourth* + +第四の方法は、シンクロナイズパターンと呼ばれる特定のリージョンの末尾でシンクロ +ナイズするものである。行をまたげるのはリージョンだけなので、リージョンの末尾に +出会ったら、どの構文アイテムの中にいるのかを知ることができる。再描画が始まる行 +のすぐ上から検索を開始し、ファイルの上方に向かって検索する。 + +これはシンクロナイズしない構文アイテムとちょうど同じように機能する。内包された +マッチ、nextgroupなどを使うことができる。ただし少しだけ違いがある。 +- キーワードを使うことはできない。 +- "sync" キーワード付きの構文アイテムは、完全に別の構文アイテムのグループを形 + 成する。シンクロナイズするグループとしないグループを混ぜることはできない。 +- 照合はバッファ内で1行ごとに逆向きに行われる(前向きではない)。 +- 行継続パターンをつけることができる。これを使うと、あたかも1行であるかのよう + に検索する一連の行を指定することができる。これは、指定したアイテムとの照合が + 継続パターンを含む一連の行の最初から始まることを意味する。 +- "nextgroup" や "contains" は1行(または継続された一連の行)内でだけ有効。 +- リージョンは同一行(または継続された一連の行)内で開始・終了しなければならな + い。そうでないと行末(または継続された一連の行)内で終わるものとされる。 +- シンクロナイズパターンとのマッチが見つかると、その行(または継続された一連の + 行)の残りから再びマッチが探される。最後のマッチが使われる。 + これはリージョンの開始と終了が同一行内にあるとき使われる + (例: /* this */のようなCコメントでは、最後の "*/" が使われる)。 + +シンクロナイズパターンとのマッチは2通りの使い方がある。 +1. 再描画を始める場所(シンクロナイズパターンの検索が始まる場所でもある)から強 + 調のためのパースを始める。そこで有効であると期待される構文グループを指定し + なければならない。行をまたぐリージョンが他のリージョンを含んではならない場 + 合にこれはうまく機能する。 +2. ハイライトのためのパースはマッチの直後から継続される。マッチの直後に現れる + と期待される構文グループを指定しなければならない。 + これは前の方法がうまくいかないときに使われる。より多くのテキストをパースす + る必要があるため、とても遅い。 +両方のタイプを同時に使うこともできる。 + +シンクロナイズパターンだけでなく、他のマッチとリージョンを指定して望まないマッ +チが見つかるのを避けることができる。 + +[シンクロナイズパターンが別々に与えられる理由は、シンクロナイズポイントの検索 +はたいていの場合、ハイライトするところを判別するよりずっと単純だからである。パ +ターンの数が減るとそれだけ速くなる。] + + *syn-sync-grouphere* *E393* *E394* + :syntax sync match {sync-group-name} grouphere {group-name} "pattern" .. + + シンクロナイズ用に使うマッチを定義する。{group-name}はマッチのすぐ後に + 続く構文グループの名前である。ハイライトのためのテキストのパースはマッ + チの直後から始まる。この{group-name}がついたリージョンが存在しなければ + ならない。最初に定義されたリージョンが使われる。マッチの後に構文グルー + プが続かない場合は "NONE" を使う。 + + *syn-sync-groupthere* + :syntax sync match {sync-group-name} groupthere {group-name} "pattern" .. + + "grouphere" と同様。ただし{group-name}はシンクロナイズポイントの検索が + 始まる行の行頭で使われる構文グループの名前である。マッチとシンクロナイ + ズパターンの検索が始まる位置との間のテキストは構文ハイライトを変えては + ならない。例えばCにおいて "/*" と "*/" を後方検索することができる。 + "/*" が先に見つかったら、今はコメントの内側にいるとわかる。なので + "groupthere" は "cComment" となる。"*/" が先に見つかったら今はコメント + の中ではないとわかる。なので "groupthere" は "NONE" となる。(実際は、 + 文字列の中に "/*" と "*/" があるかもしれないので、もう少し込み入ってい + る。これは読者の練習問題としておく...)。 + + :syntax sync match .. + :syntax sync region .. + + 引数 "groupthere" なしの場合。シンクロナイズポイントの検索の際にスキッ + プされるリージョンやマッチを定義する。 + + *syn-sync-linecont* + :syntax sync linecont {pattern} + + {pattern}とのマッチが次の行にも継続されるとみなされる。つまりシンクロ + ナイズポイントの検索の際、行は連結されているものと見なされる。 + +引数 "maxlines={N}" が同時に与えられると、マッチを検索する行がN行に制限される。 +これは遅いマシンを使っていて、シンクロナイズするものが少ないとわかっているとき +に便利。例: > + :syntax sync maxlines=100 + +全てのシンクロナイズの設定をクリアするには: > + :syntax sync clear + +あるシンクロナイズパターンをクリアするには: > + :syntax sync clear {sync-group-name} .. + +============================================================================== +11. 構文アイテムのリストを表示する *:syntax* *:sy* *:syn* *:syn-list* + +次のコマンドは全ての構文アイテムのリストを表示する: > + + :sy[ntax] [list] + +ある構文グループに属する構文アイテムを表示するには: > + + :sy[ntax] list {group-name} + +あるクラスタに属する構文グループを表示するには: *E392* > + + :sy[ntax] list @{cluster-name} + +":syntax" コマンドに対する他の引数については上を参照。 + +":syntax" コマンドは ":sy" とも略記できる。しかし ":syn" の方が見栄えがよいた +め、普通はこちらが使われる。 + +============================================================================== +12. ハイライトコマンド *:highlight* *:hi* *E28* *E411* *E415* + +ハイライトグループには3つのタイプがある: +- 特定の構文言語用のもの。名前がその言語の名前で始まる。このタイプのほとんど + は属性を持たず、2番目のタイプのグループにリンクされる。 +- 全ての構文言語に対して使われるもの。 +- 'highlight' オプションに使われるもの。 + *hitest.vim* +現在有効な全てのグループを知るにはこのコマンドを使う: > + :so $VIMRUNTIME/syntax/hitest.vim +このコマンドは新しいウィンドウを開き、そこに全てのハイライトグループ名を、それ +自身の色を使って表示する。 + + *:colo* *:colorscheme* *E185* +:colo[rscheme] 現在のカラースキームの名前を表示する。 + 基本的には次のコマンドと同じである > + :echo g:colors_name +< g:colors_name が定義されていない場合は "default" と表 + 示される。|+eval| 機能付きでコンパイルされていない場合 + は "unknown" と表示される。 + +:colo[rscheme] {name} カラースキーム{name}を読み込む。これは 'runtimepath' + の中から "colors/{name}.vim" というファイルを検索する。 + 最初に見つかったものが読み込まれる。 + 同様に、'packpath' 内の全てのプラグインを検索し、それ + ぞれについて "start" 内、"opt" 内の順で検索する。 + + 再帰的な読み込みはされない。つまりカラースキームスクリ + プト中で ":colorscheme" を使うことはできない。 + + カラースキームをカスタマイズするには異なる名前を使い、 + 例えば "~/.vim/colors/mine.vim"、`:runtime`を用いてオ + リジナルのカラースキームを読み込む: > + runtime colors/evening.vim + hi Statement ctermfg=Blue guifg=Blue + +< カラースキームが読み込まれた後、自動コマンドイベント + |ColorScheme|が発生する。カラースキームファイルを書く + ための情報については次を参照: > + :edit $VIMRUNTIME/colors/README.txt + +:hi[ghlight] 属性がセットされたハイライトグループを全て表示する。 + +:hi[ghlight] {group-name} + 1つのハイライトグループを表示する。 + +:hi[ghlight] clear 全てのハイライトをデフォルトに戻す。ユーザーによって加 + えられたグループに対するハイライトが全て消去される。 + 現在の 'background' の値によってデフォルトの色が決まる。 + +:hi[ghlight] clear {group-name} +:hi[ghlight] {group-name} NONE + 1つのハイライトグループに対するハイライトを無効にする。 + デフォルトの色に戻すわけではない。 + +:hi[ghlight] [default] {group-name} {key}={arg} .. + ハイライトグループを追加する、または既存のグループに対 + する強調を変更する。 + 引数{key}={arg}については|highlight-args|を参照。 + オプショナルな引数[default]については + |:highlight-default|を参照。 + +通常、ハイライトグループは起動時に一度だけ追加される。そこでハイライトのデフォ +ルト値をセットする。その後、ハイライトコマンドを使うことによってデフォルトでな +い値に変えることができる。値 "NONE" を使うとその値をオフにしたりデフォルト値に +戻したりできる。 + +色を変える簡単な方法は|:colorscheme|コマンドを使うことである。すると、次のよう +な ":highlight" コマンドが書かれたファイルが読み込まれる: > + + :hi Comment gui=bold + +このファイルに含まれない設定は変更されないままである。指定されたフィールドだけ +が更新され、それ以前の設定とマージされる。なのでその結果は次のコマンド1つを実 +行するのと同じである: > + :hi Comment term=bold ctermfg=Cyan guifg=#80a0ff gui=bold +< + *:highlight-verbose* +'verbose' を0でない値にしてハイライトグループの一覧を表示すると、最後に設定さ +れた場所も表示される。例: > + :verbose hi Comment +< Comment xxx term=bold ctermfg=4 guifg=Blue ~ + Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim ~ + +":hi clear" が実行されると、このコマンドを実行したスクリプトがデフォルト値とし +て言及される。より詳しくは|:verbose-cmd|を参照。 + + *highlight-args* *E416* *E417* *E423* +ハイライトに関して、ターミナルは3種類に分類される: +term 通常のターミナル(vt100, xterm) +cterm カラーターミナル(MS-DOS console, color-xterm。これらはtermcapエントリ + "Co" をもつ) +gui GUI + +ハイライトはこれらのタイプごとに指定できる。そうすることによって、同じ構文ファ +イルを全てのターミナルに対して使用でき、ターミナルごとに最善のハイライトを利用 +できるようになっている。 + +1. highlightコマンドの引数(通常のターミナル用) + + *bold* *underline* *undercurl* + *inverse* *italic* *standout* +term={attr-list} *attr-list* *highlight-term* *E418* + attr-listはコンマ区切りのリスト(スペースは入れない)で、要素は以下の通 + り(順序はどうでもよい): + bold + underline + undercurl 必ずしも使用できるとは限らない + reverse + inverse reverseと同じ + italic + standout + NONE 属性を使用しない(属性をリセットするために使う) + + この引数で "bold" を指定してもよいし、太文字のフォントを指定してもよ + い。どちらも表示は同じになる。 + "undercurl" は波線のこと。"undercurl" が使用できないときは "underline" + が使われる。一般的には "undercurl" はGUIでのみ使用できる。その色は + |highlight-guisp|で設定できる。 + +start={term-list} *highlight-start* *E422* +stop={term-list} *term-list* *highlight-stop* + これらのターミナルコードのリストを使ってターミナルについての標準的でな + い属性を得ることができる。 + + 引数 "start" でエスケープシーケンスを指定すると、ハイライトするテキス + トの前にそれが書き込まれる。そのテキストをハイライトする際にターミナル + に送りたいものをなんでも指定できる。引数 "stop" でエスケープシーケンス + を指定すると、強調されるテキストの後にそれが書き込まれる。"start" で + 行ったことを "stop" で元に戻すべきである。そうしないとスクリーンがご + ちゃごちゃになってしまうだろう。 + + {term-list}は2つの形を持つ: + + 1. エスケープシーケンス付きの文字列。 + これは "t_" で始まるものと空文字列を除く任意の文字列である。"<Esc>" + や "<Space>" のような<>記法が利用できる。例: + start=<Esc>[27h;<Esc>[<Space>r; + + 2. ターミナルコードのリスト。 + ターミナルコードは "t_xx" の形を持つ。"xx" はtermcapエントリ名であ + る。ターミナルコードはコンマで区切る。ホワイトスペースは使えない。 + 例: + start=t_C1,t_BL + 対応するターミナルコードが存在しなければならない。 + +2. highlightコマンドの引数(カラーターミナル用) + +cterm={attr-list} *highlight-cterm* + {attr-list}の説明は上を参照|attr-list|。 + 色を使う場合、引数 "cterm" は "term" と異なる結果になる。例えば、通常 + のターミナルではコメントにアンダーラインを引き、カラーターミナルではコ + メントを青色で表示することができる。 + Note:DOSコンソールなど多くのターミナルでは色づけの際にこれらの属性を混 + 在させることはできない。"cterm=" か "ctermfg=" が "ctermbg=" のどれか + 1つだけを使うこと。 + +ctermfg={color-nr} *highlight-ctermfg* *E421* +ctermbg={color-nr} *highlight-ctermbg* + 引数{color-nr}で色番号を指定する。色番号の範囲は0からtermcapエントリ + "Co" の値 - 1 までである。 + この色番号で実際に表示される色はターミナルの種類とその設定に依存する。 + "cterm" の設定によって色が変わる場合もある。例えば、あるシステムでは + "cterm=bold ctermfg=3" でそのまま3番の色を表示し、他のシステムでは異な + る色を表示することがある。 + + xtermにおいてはこれはユーザーのリソースに依存し、やや予測ができない。 + デフォルトについてはxtermのドキュメントを参照のこと。カラーxterm用の色 + は .Xdefaults ファイルで変更することができる。このため、ユーザーごとに + 表示される色が異なるかもしれない。カラーxtermについては|xterm-color|を + 参照。 + + コンソールウィンドウ内のMSDOS標準色は固定されている。そのため、これら + の色を名前に使っている。一方、X11の色名の意味は固定されている。そこで + ハイライトの設定に可搬性を持たせるため、X11の色設定が使われている(複雑 + であるが)。以下の色名を、色番号の代わりに使うことができる: + + *cterm-colors* + NR-16 NR-8 COLOR NAME ~ + 0 0 Black + 1 4 DarkBlue + 2 2 DarkGreen + 3 6 DarkCyan + 4 1 DarkRed + 5 5 DarkMagenta + 6 3 Brown, DarkYellow + 7 7 LightGray, LightGrey, Gray, Grey + 8 0* DarkGray, DarkGrey + 9 4* Blue, LightBlue + 10 2* Green, LightGreen + 11 6* Cyan, LightCyan + 12 1* Red, LightRed + 13 5* Magenta, LightMagenta + 14 3* Yellow, LightYellow + 15 7* White + + "NR-16" の下の番号は16色ターミナル('t_Co' が16以上のもの)用である。 + "NR-8" の下の番号は8色ターミナル('t_Co' が16未満のもの)用である。 + '*' はctermfgにbold属性がセットされることを意味している。"linux" + など多くの8色ターミナルでは明るい色になる。ただし背景色には適用さ + れない。'*' がないものはbold属性なしになる。他の方法でbold属性をつ + けたいなら引数 "cterm=" を "ctermfg=" や "ctermbg=" の後に書くこ + と。または色名の代わりに番号を使うこと。 + + 色名の大文字・小文字は無視される。 + 16色ansiスタイルターミナル(xtermを含む)ではNR-8の列の番号が使われ + ることに注意。ここで '*' は 'add 8' という意味になる。つまりBlueが + 12に、DarkGrayが8になる。 + + カラーターミナルによっては、色名を使うと間違った色で表示される場合 + もあることに注意。 + + 色をなしにするのに "NONE" も使える。 + + *:hi-normal-cterm* + Normalグループに対して "ctermfg" や "ctermbg" を設定すると、これらはハ + イライトされないテキストに対する色になる。 + 例: > + :highlight Normal ctermfg=grey ctermbg=darkblue +< Normalグループに対して "ctermbg" を設定すると、オプション 'background' + が自動的に調整される。これによって 'background' に依存するハイライトグ + ループが変更される。そのため、まずNormalに対する色を設定し、それから他 + の色を設定するべきである。 + カラースキーム使用時に 'background' を変更するとカラースキームが再読み + 込みされる。そしてNormalを含む全ての色がリセットされる。これが嫌なら最 + 初に変数 "g:colors_name" を削除すること。 + + Normalグループの "ctermfg" や "ctermbg" を変更した場合、Vim終了時にそ + の色をリセットする必要がある。これはtermcapエントリ "op" |t_op|を使っ + てなされる。リセットがうまくいかない場合は.vimrc中で 't_op' を設定して + みること。 + *E419* *E420* + Vimが通常の文字色と背景色を知っている場合、色名として "fg" と "bg" を + 使用できる。これはNormalグループの色とMS-DOSコンソールの色を設定しない + と使えない。例えば反転表示をするには: > + :highlight Visual ctermfg=bg ctermbg=fg +< このコマンドを実行した時点で有効な色が使われることに注意。この後で + Normalグループを変更しても "fg" と "bg" は調整されない。 + + +3. highlightコマンドの引数(GUI用) + +gui={attr-list} *highlight-gui* + これらはGUIモードで使われる属性を設定する。 + 説明は|attr-list|を参照。 + ここで "bold" を設定しても太字のフォントを使ってもよい。どちらも同じ効 + 果を持つ。 + "Normal" グループに対する属性は無視される。 + +font={font-name} *highlight-font* + font-nameはVimを実行しているシステム上で使われるフォント名である。X11 + ではこれは複雑な名前になる。例えば: > + font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1 +< + フォント名 "NONE" を使うとデフォルトのフォントに戻る。 + "Normal" グループに対してフォントを設定すると、これがデフォルトフォン + トになる(オプション 'guifont' が変更されるまでは; 最後に設定したものが + 使われる)。 + 以下のものはMotifとAthena上でのみ動作し、他のGUI上では利用できない: + "Menu" グループに対してフォントを設定すると、メニューが変更される。 + "Tooltip" グループに対してフォントを設定すると、ツールチップが変更され + る。 + Menu用とTooltip用を除く全てのフォントのサイズがデフォルトフォントのサ + イズと同じでなければならない。そうでないと再描画の際に問題が発生する。 + 名前にスペースや特殊文字を含むフォントを使う場合、名前をシングルクォー + トでくくる。このためシングルクォートを名前に含めることはできない。 + 例: > + :hi comment font='Monospace 10' + + +guifg={color-name} *highlight-guifg* +guibg={color-name} *highlight-guibg* +guisp={color-name} *highlight-guisp* + guifgは文字色、guibgは背景色、guispは波線の色を指定する。これらはGUIで + 使用される。 + いくつか特別な名前がある: + NONE no color (透明) + bg 通常の背景色を使う + background 通常の背景色を使う + fg 通常の文字色を使う + foreground 通常の文字色を使う + 名前にスペースや特殊文字を含む色を使う場合、名前をシングルクォートでく + くる。このためシングルクォートを名前に含めることはできない。 + 例: > + :hi comment guifg='salmon pink' +< + *gui-colors* + 推奨されている色名 (これらはほとんどのシステムで利用可能である) + Red LightRed DarkRed + Green LightGreen DarkGreen SeaGreen + Blue LightBlue DarkBlue SlateBlue + Cyan LightCyan DarkCyan + Magenta LightMagenta DarkMagenta + Yellow LightYellow Brown DarkYellow + Gray LightGray DarkGray + Black White + Orange Purple Violet + + Win32 GUIバージョンでは他にもシステムカラーが利用できる。 + |win32-colors|を参照。 + + RGB値によって色を指定することもできる。 + フォーマットは "#rrggbb"、ここで + "rr" Red値 + "gg" Green値 + "bb" Blue値 + これらの値は16進であり、範囲は "00" から "ff"。例: > + :highlight Comment guifg=#11f0c3 guibg=#ff00ff +< + *highlight-groups* *highlight-default* +以下はデフォルトのハイライトグループである。これらのグループはデフォルトでオプ +ション 'highlight' によって使われる。ただしハイライトは 'background' の値に依 +存することに注意。":highlight" コマンドで現在の設定を知ることができる。 + *hl-ColorColumn* +ColorColumn 'colorcolumn' で設定された列の表示に使われる + *hl-Conceal* +Conceal Conceal されたテキストの代わりに表示される代替文字の表示に使わ + れる ('conceallevel' 参照) + *hl-Cursor* +Cursor カーソル下の文字 + *hl-CursorIM* +CursorIM Cursorと同じだが、IMEモードにいるとき使われる|CursorIM|。 + *hl-CursorColumn* +CursorColumn 'cursorcolumn' がオンになっているときのカーソルがある画面上の桁 + *hl-CursorLine* +CursorLine 'cursorline' がオンになっているときのカーソルがある画面上の行 + *hl-Directory* +Directory ディレクトリ名(とリストにある特別な名前) + *hl-DiffAdd* +DiffAdd 差分モード: 追加された行 |diff.txt| + *hl-DiffChange* +DiffChange 差分モード: 変更された行 |diff.txt| + *hl-DiffDelete* +DiffDelete 差分モード: 削除された行 |diff.txt| + *hl-DiffText* +DiffText 差分モード: 変更された行中の変更されたテキスト |diff.txt| + *hl-EndOfBuffer* +EndOfBuffer バッファ中で最終行以降の領域を埋めるための行 (~)。 + 標準では、|hl-NonText|のようにハイライトされる。 + *hl-ErrorMsg* +ErrorMsg コマンドラインに現れるエラーメッセージ + *hl-VertSplit* +VertSplit 垂直分割したウィンドウの区切りとなる桁 + *hl-Folded* +Folded 閉じた折り畳みの行 + *hl-FoldColumn* +FoldColumn 'foldcolumn' + *hl-SignColumn* +SignColumn 目印|signs|が表示される行。 + *hl-IncSearch* +IncSearch 'incsearch' のハイライト; ":s///c" で置換されたテキストにも使 + われる。 + *hl-LineNr* +LineNr ":number" と ":#" コマンドの行番号。'number' オプションか + 'relativenumber' オプションが設定されているときにはその表示に + も使われる。 + *hl-CursorLineNr* +CursorLineNr LineNr と同じだが 'cursorline' か 'relativenumber' が設定され + ているときに現在行に使われる。 + *hl-MatchParen* +MatchParen カーソル下の文字、または直後の文字が括弧であるとき、その文字と + 対応する括弧に使われる。|pi_paren.txt| + *hl-ModeMsg* +ModeMsg 'showmode' のメッセージ (例. "-- INSERT --") + *hl-MoreMsg* +MoreMsg |more-prompt| + *hl-NonText* +NonText ウィンドウの端の '@' と 'showbreak' で設定された文字など、実際 + のテキストには存在しない文字(例. 全角文字が行末に収まらないと + き ">" が表示される)。 + *hl-Normal* +Normal 通常のテキスト + *hl-Pmenu* +Pmenu ポップアップメニュー: 通常の項目。 + *hl-PmenuSel* +PmenuSel ポップアップメニュー: 選択されている項目。 + *hl-PmenuSbar* +PmenuSbar ポップアップメニュー: スクロールバー。 + *hl-PmenuThumb* +PmenuThumb ポップアップメニュー: スクロールバーのつまみ部分。 + *hl-Question* +Question ヒットエンタープロンプト|hit-enter|とyes/noクエスチョン + *hl-Search* +Search 最後に検索した語のハイライト('hlsearch')を参照。 + quickfixウィンドウ内の現在行のハイライトや、それに類するものに + 使われる。 + *hl-SpecialKey* +SpecialKey ":map" でリストされるメタキーと特別なキー。テキスト中の + unprintableな文字を表示するのにも使われる。 + 一般に: 実際とは異なる文字で表示されるテキスト + *hl-SpellBad* +SpellBad スペルチェッカに認識されない単語。|spell| + これは他のハイライトと同時に組み合わせられる。 + *hl-SpellCap* +SpellCap 大文字で始まるべき単語。 |spell| + これは他のハイライトと同時に組み合わせられる。 + *hl-SpellLocal* +SpellLocal スペルチェッカによって他の地域で使われると判断される単語。 + |spell|これは他のハイライトと同時に組み合わせられる。 + *hl-SpellRare* +SpellRare スペルチェッカによってまず使わないと判断される単語。|spell| + これは他のハイライトと同時に組み合わせられる。 + *hl-StatusLine* +StatusLine カレントウィンドウのステータスライン + *hl-StatusLineNC* +StatusLineNC 非カレントウィンドウのステータスライン。 + Note: これが "StatusLine" に等しい場合、カレントウィンドウのス + テータスラインに "^^^" が使われる。 + *hl-TabLine* +TabLine タブページの行の、アクティブでないタブページのラベル + *hl-TabLineFill* +TabLineFill タブページの行の、ラベルがない部分 + *hl-TabLineSel* +TabLineSel タブページの行の、アクティブなタブページのラベル + *hl-Title* +Title ":set all"、":autocmd" などによる出力のタイトル。 + *hl-Visual* +Visual ビジュアルモード選択 + *hl-VisualNOS* +VisualNOS vimが "Not Owning the Selection" のときのビジュアルモード選択。 + これをサポートしているのはX11GUI|gui-x11|と|xterm-clipboard|の + み。 + *hl-WarningMsg* +WarningMsg 警告メッセージ + *hl-WildMenu* +WildMenu 'wildmenu' 補完における現在の候補 + + *hl-User1* *hl-User1..9* *hl-User9* +'statusline' 構文によってステータスラインとルーラー('rulerformat' によって)中 +で9個のハイライトが使えるようになっている。その名前はUser1からUser9である。 + +GUI使用時には、これらのグループを使ってメニューやスクロールバー、ツールチップ +の色を設定することができる。これらにデフォルト値はない。これはWin32では利用で +きない。ここではhighlightの引数のうちfont, guibg, guifgの3つだけが効果を持つ。 + + *hl-Menu* +Menu メニューのフォント、文字、背景。ツールバーにも使われる。 + 使用可能なhighlightの引数: font, guibg, guifg. + + NOTE: MotifとAthenaでは 'guifontset' が空かどうかに関わらず、 + 常に引数fontで実際のフォントセットを指定する。そしてそれが現在 + の|:language|に結び付けられる。 + + *hl-Scrollbar* +Scrollbar メインウィンドウのスクロールバーの文字と背景。 + 使用可能なhighlightの引数: guibg, guifg. + + *hl-Tooltip* +Tooltip ツールチップのフォント、文字、背景。 + 使用可能なhighlightの引数: font, guibg, guifg. + + NOTE: MotifとAthenaでは 'guifontset' が空かどうかに関わらず、 + 常に引数fontで実際のフォントセットを指定する。そしてそれが現在 + の|:language|に結び付けられる。 + +============================================================================== +13. グループのリンク *:hi-link* *:highlight-link* *E412* *E413* + +複数の構文グループに対して同じハイライトを適用させるには、両方のグループから一 +つの強調グループにリンクを作り、リンク先に対して色属性を与えると簡単である。 + +リンクを作るには: + + :hi[ghlight][!] [default] link {from-group} {to-group} + +リンクを削除するには: + + :hi[ghlight][!] [default] link {from-group} NONE + +Notes: *E414* +- {from-group}か{to-group}のどちらかが存在しない場合、リンクは作成されない。こ + の場合エラーメッセージは表示されない。 +- リンクされたグループに対して ":highlight" を使うと、即座にリンクが削除される。 +- 既に{from-group}にハイライト設定がされている場合、'!' をつけないとリンクは作 + 成されない。sourceされたファイル中の ":highlight link" コマンドに関して、エ + ラーメッセージは表示されない。そのため既に設定を持つグループに対するリンクが + スキップされる。 + + *:hi-default* *:highlight-default* +引数[default]によってグループに対するデフォルトのハイライトを設定することがで +きる。そのグループに対して既にハイライトが指定されている場合、このコマンドは無 +視される。既にリンクが存在する場合も同様。 + +[default] は、そのハイライト設定をあとから上書きさせるために使われる。例えば +C 構文ファイルは次の行を含んでいる: > + :highlight default link cComment Comment +この設定を変更し、C コメントに対して Question のハイライトをつけたい場合、次の +行を .vimrc に加える: > + :highlight link cComment Question +"default" をつけないと、.vimrc より C 構文ファイルの方があとに読み込まれるた +め、.vimrc の設定を上書きしてしまう。 + +============================================================================== +14. 構文の消去 *:syn-clear* *E391* + +カレントバッファに対する構文設定を消去したいときはこのコマンドを使う: > + :syntax clear + +このコマンドは、構文ハイライトをオフにしたいときや他の構文を適用したいときに使 +う。通常、これを構文ファイル内で行う必要はない。なぜなら、構文ファイルを読み込 +む自動コマンドによって構文がクリアされる。 +また、このコマンドは変数 "b:current_syntax" を削除する。このコマンドの実行後に +はすべての構文がなくなるからである。 + +全てのバッファに対して構文ハイライトを無効にしたいときは、構文ファイルを読み込 +む自動コマンドを削除する必要がある: > + :syntax off + +このコマンドが実際に行うことは次のコマンドを実行するのと同じである: > + :source $VIMRUNTIME/syntax/nosyntax.vim +詳細は "nosyntax.vim" を参照。これが正常に機能するためには$VIMRUNTIMEが正しく +設定されている必要がある。|$VIMRUNTIME|を参照。 + +カレントバッファに対する特定の構文グループを消去するには: > + :syntax clear {group-name} .. +これは{group-name}に対する全てのパターンとキーワードを消去する。 + +カレントバッファに対する特定の構文グループリストを消去するには: > + :syntax clear @{grouplist-name} .. +これは{grouplist-name}の中身を空リストにセットする。 + + *:syntax-reset* *:syn-reset* +色を変えたため、色がごちゃごちゃになってしまったときは、次のコマンドを使うとデ +フォルトに戻る: > + + :syntax reset + +少々正しくない名前だが、どんなシンタックス項目もリセットせず、ただハイライトの +みに影響する。 + +これはオプション 'highlight' に対する色は変更しない。 + +ユーザーのvimrcファイル中で設定した構文色もVimのデフォルト値に戻ることに注意。 +カラースキームを使っている場合、カラースキームによって定義された色は失われるこ +とに注意。 + +このコマンドが実際に行うことは次と同じ: > + + let g:syntax_cmd = "reset" + runtime! syntax/syncolor.vim + +ここでオプション 'runtimepath' が使われていることに注意。 + + *syncolor* +構文ハイライトに別の色を使うには、色を設定する Vim script を作ればよい。その +ファイルを 'runtimepath' 中 ('runtimepath' は $VIMRUNTIME を含む) のディレクト +リに置くと、その設定がデフォルトの色設定を上書きする。こうして ":syntax reset" +コマンドを実行すると、それらの色が有効になる。 + +Unixでは~/.vim/after/syntax/syncolor.vimファイルを使うとよい。例: > + + if &background == "light" + highlight comment ctermfg=darkgreen guifg=darkgreen + else + highlight comment ctermfg=green guifg=green + endif + +カラースキームを使用すると、ユーザー定義の色が使われるのか、それともカラースキー +ムで定義された色が使われるのかわからなくなる場合がある。これはカラースキーム +ファイルに依存する。|:colorscheme|を参照。 + + *E679* +このsyncolor.vimが "syntax on" を実行しないこと、また、オプション 'background' +を設定したりコマンド "colorscheme" を実行しないように注意すること。もしこれら +を実行すると無限ループに陥ってしまう。 + + *syntax_cmd* +syntax/syncolor.vimファイルが読み込まれると、変数 "syntax_cmd" に次の3つの値の +どれかがセットされる: + "on" ":syntax on" コマンド。ハイライト色が上書きされるがリンクはそ + のまま。 + "enable" ":syntax enable" コマンド。まだハイライトが定義されていないグ + ループに対して色を定義するだけ。":syntax default" を使うこと。 + "reset" ":syntax reset" コマンドまたはカラースキームを読み込む。全ての + 色を定義する。 + "skip" 色を定義しない。'runtimepath' で前にあるsyncolor.vimファイルが + 既にデフォルト設定をセットしているとき、そのデフォルト設定をス + キップするために使われる。 + +============================================================================== +15. 関数名などのハイライト *tag-highlight* + +ファイル中の全てのタグ(関数名など)をハイライトするには、次のマッピングを使うと +よい。 + + <F11> -- tags.vimファイルを生成し、タグをハイライトする。 + <F12> -- 既存のtags.vimファイルをもとにハイライトする。 +> + :map <F11> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12> + :map <F12> :so tags.vim<CR> + +WARNING: tagsファイルが大きくなるほどこの操作は遅くなり、消費するメモリ量も多 +くなる。 + +typedef、union、structだけをハイライトすることもできる。そのためにはExuberant +ctags (http://ctags.sf.netで入手可能)が必要である。 + +以下をあなたのMakefileに加える: + +# 型用のハイライトファイルを作成する。Exuberant ctagsとawkが必要 +types: types.vim +types.vim: *.[ch] + ctags --c-kinds=gstu -o- *.[ch] |\ + awk 'BEGIN{printf("syntax keyword Type\t")}\ + {printf("%s ", $$1)}END{print ""}' > $@ + +そして以下を.vimrcに加える: > + + " load the types.vim highlighting file, if it exists + autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim' + autocmd BufRead,BufNewFile *.[ch] if filereadable(fname) + autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname + autocmd BufRead,BufNewFile *.[ch] endif + +============================================================================== +16. ウィンドウローカル構文 *:ownsyntax* + +通常は同じバッファを表示するすべてのウィンドウは同じ構文設定を共有する。しかし +ながら、特定のウィンドウだけ別の構文設定を使用することも可能である。例えば一つ +のウィンドウで LaTeX のソースを普通に表示して、別のウィンドウで異なる表示をす +る (文字を隠したり太字や斜字体で表示したりする) ことが可能である。その場合は +'scrollbind' オプションを使うと便利である。 + +同じバッファを表示しているウィンドウが複数あって、現在のウィンドウの構文だけを +"foo" に設定するには次のようにする: > + :ownsyntax foo +< *w:current_syntax* +"w:current_syntax" 変数が "foo" に設定される。"b:current_syntax" 変数の値は変 +更されない。"b:current_syntax" は構文ファイルによって変更されるが、 +"b:current_syntax" を一時的に保存・復元することで値が変わらないようになってい +る。構文ファイルによって設定された値が "w:current_syntax" に代入される。 +Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options. + +ウィンドウの独自構文が定義されると、同じバッファの他のウィンドウで実行された構 +文コマンド (:syntax clear を含む) が影響しなくなる。逆に、そのウィンドウで実行 +された構文コマンドも他のウィンドウには影響しなくなる。 + +独自構文を持ったウィンドウは他のバッファを読み込むかファイルを再読み込みするこ +とで通常の動作に戻る。 +ウィンドウを分割したときは、新しいウィンドウは元々の構文を使う。 + +============================================================================== +17. カラー対応xterm *xterm-color* *color-xterm* + +ほとんどのカラー対応xtermは8色しか持たない。デフォルト設定で色がつかない場合は +以下を.vimrcに加えれば正常に色がつくはずである: > + :if &term =~ "xterm" + : if has("terminfo") + : set t_Co=8 + : set t_Sf=<Esc>[3%p1%dm + : set t_Sb=<Esc>[4%p1%dm + : else + : set t_Co=8 + : set t_Sf=<Esc>[3%dm + : set t_Sb=<Esc>[4%dm + : endif + :endif +< [<Esc>はエスケープ文字そのもの。CTRL-V <Esc>とタイプして入力する] + +最初の "if" を自分のターミナル名にマッチするように変更する必要があるかもしれな +い。例: "xterm" でなく "dtterm"。 + +Note: これらの設定は ":syntax on" の前に行うこと。そうでないと色がおかしくなっ +てしまう。 + *xiterm* *rxvt* +上の設定はxitermとrxvtでも動作するように注意されている。しかしrxvtで16色を使う +場合にはterminfoを設定しなければならない: > + :set t_AB=<Esc>[%?%p1%{8}%<%t25;%p1%{40}%+%e5;%p1%{32}%+%;%dm + :set t_AF=<Esc>[%?%p1%{8}%<%t22;%p1%{30}%+%e1;%p1%{22}%+%;%dm +< + *colortest.vim* +色設定をテストするためのファイルがVimディストリビューションに入っている。これ +を使うには次のコマンドを実行する: > + :runtime syntax/colortest.vim + +xtermのあるバージョン(とlinuxコンソールのようなターミナル)は、たとえ色数が8に +定義されていても、より明るい文字色を出力することができる。そのため 't_Co' が8 +のとき、Vimは明るい文字色に対して "cterm=bold" 属性をセットする。 + + *xfree-xterm* +16色以上を使うにはxtermの最新バージョンを入手すること(XFree86 3.3以降に含まれ +ているはずである)。また、以下の場所でも最新バージョンを入手できる: > + http://invisible-island.net/xterm/xterm.html +次にそれをconfigureするよい方法を示す。これは88色を使い、termcap-query機能を有 +効化する。これによってVimがxtermに何色をサポートしているか問い合わせることがで +きるようになる > + ./configure --disable-bold-color --enable-88-color --enable-tcap-query +もし8色しか使えなかったらxtermのコンパイル設定を確認すること。 +(このxtermをUTF-8エンコーディングで使う場合には|UTF8-xterm|も参照)。 + +以下を.vimrcに加えるとこのxtermで動くはずである(16色用): > + :if has("terminfo") + : set t_Co=16 + : set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm + : set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm + :else + : set t_Co=16 + : set t_Sf=<Esc>[3%dm + : set t_Sb=<Esc>[4%dm + :endif +< [<Esc>はエスケープ文字そのもの。CTRL-V <Esc>とタイプして入力する] + +|+terminfo|なしではVimはこれらの設定を認識し、自動的にctermの8色と上の設定を +"<Esc>[9%dm" と "<Esc>[10%dm" に変換する。16色以上も自動的に変換される。 + +以下の設定が256色用にうまくいくと報告されている: > + + :set t_AB=<Esc>[48;5;%dm + :set t_AF=<Esc>[38;5;%dm + +または単にTERM環境変数を "xterm-color" または "xterm-16color" にセットし、うま +くいくか試してみるとよい。 + +以下のX resourcesを(~/.Xdefaultsファイルで)使いたいかもしれない: + XTerm*color0: #000000 + XTerm*color1: #c00000 + XTerm*color2: #008000 + XTerm*color3: #808000 + XTerm*color4: #0000c0 + XTerm*color5: #c000c0 + XTerm*color6: #008080 + XTerm*color7: #c0c0c0 + XTerm*color8: #808080 + XTerm*color9: #ff6060 + XTerm*color10: #00ff00 + XTerm*color11: #ffff00 + XTerm*color12: #8080ff + XTerm*color13: #ff40ff + XTerm*color14: #00ffff + XTerm*color15: #ffffff + Xterm*cursorColor: Black + +[Note: cursorColorにはバグがある。カーソルの色が最後に描画されたテキストの色に +なってしまうというものである。これはxtermの新しいバージョンを使うと解決する +が、まだ全ての人がそれを使っているわけではない。] + +これらを即座に更新するには.XdefaultsファイルをXオプションデータベースマネー +ジャーに再読み込みさせる(.Xdefaultsを変更したときはこれを行う必要がある): > + xrdb -merge ~/.Xdefaults +< + *xterm-blink* *xterm-blinking-cursor* +xtermでカーソルを点滅させるにはtools/blink.cを見ること。またはThomas Dickeyの +xtermのパッチレベル107以上を使い(入手場所は上を参照)、以下のリソースを設定す +る。 + XTerm*cursorBlink: on + XTerm*cursorOnTime: 400 + XTerm*cursorOffTime: 250 + XTerm*cursorColor: White + + *hpterm-color* +次の設定はhptermで(大体)うまく機能する。文字色は8色だけサポートしている: > + :if has("terminfo") + : set t_Co=8 + : set t_Sf=<Esc>[&v%p1%dS + : set t_Sb=<Esc>[&v7S + :else + : set t_Co=8 + : set t_Sf=<Esc>[&v%dS + : set t_Sb=<Esc>[&v7S + :endif +< [<Esc>はエスケープ文字そのもの。CTRL-V <Esc>とタイプして入力する] + + *Eterm* *enlightened-terminal* +次の設定がEnlightenedターミナルエミュレータまたはEtermで機能すると報告されてい +る。また、明るい色を表示するのにbold属性を使うxtermライクターミナル全てで機能 +すると思われる。必要なら前述のように ":if" をつけること。 > + :set t_Co=16 + :set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m + :set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m +< + *TTpro-telnet* +次の設定がTTpro telnet用にうまくいく。Tera Term ProはMS-Windows用のフリーウェ +ア/オープンソースプログラムである。 > + set t_Co=16 + set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{32}%+5;%;%dm + set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm +また、TTproのSetup→Window→Full Colorが有効になっていることと、 +Setup→Font→Enable Boldが無効になっていることを確認すること。 +(この情報はJohn Love-Jensen <eljay@Adobe.COM>によって提供された) + + +============================================================================== +18. シンタックスが遅い時には *:syntime* + +この章はシンタックスファイルを作る人向けである。 + +もしあなたの作ったシンタックスにより再描画が遅くなってしまったら、ここに書いた +方法でそれを速くできるかもしれない。|folding| や 'relativenumber' といった機能 +を有効化すると、それらが干渉して遅くなる場合もある。 + +Note: |+profile| 機能付きでコンパイルされた時のみ利用可能である。 +"huge" 機能付きでVimをビルドする必要があるかもしれない。 + +時間のかかっているシンタックスパターンを発見するために、以下の様な手順で概要を +得られる: > + + :syntime on + [ CTRL-L で最低でも一度は再描画を実行する ] + :syntime report + +これにより利用されたシンタックスパターンが、マッチにかかった時間の多い順にソー +トして表示される。 + +:syntime on シンタックスにかかる時間の測定を開始する。測定をするに + はシンタックスパターンのマッチに多少のオーバーヘッドが + 発生する。 + +:syntime off シンタックスの計測を終了する。 + +:syntime clear 全部のカウンタを 0 にし、計測をやり直す。 + +:syntime report 現在のウィンドウで ":syntime on" してから使用されたシ + ンタックス要素を表示する。出力される内容をちゃんと読む + には幅の広いディスプレイを使ったほうが良い。 + + リストは総時間(TOTAL)でソートされている。 + リストには以下のカラムからなる: + TOTAL パターンのマッチにかかった総時間 + COUNT パターンが使われた回数 + MATCH パターンが実際にマッチした回数 + SLOWEST マッチ1回あたりの最長時間 + AVERAGE マッチ1回あたりの平均時間 + NAME シンタックス要素の名前。Note 一意な名 + 前ではないことに注意。 + PATTERN 使用されたパターン + +パターンマッチングは多くの可能性を試さなければならないときに遅くなる。パターン +にできる限り多くのリテラルテキストを含むことで、パターンが無駄にマッチする可能 +性を減らすよう試してみると良い。 + +"\@<=" や "\@<!" 要素を使用する時は、マッチする最大サイズを指定すると現在以降 +の行の全部の位置でパターンを試すことを避けられる。 +たとえば要素のマッチするものがリテラルテキストならば、そのテキストのサイズをバ +イト数で指定すると良い。 + +"<\@<=span" "<span" 中の "span" にマッチする。これは "<" があるかどうか多 + くの場所でマッチを試みる。(ゆえに遅くなりやすい) +"<\@1<=span" 同じものにマッチするが、"span" の前の1バイトだけをチェックす + る。 + + + vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/tabpage.jax b/plugins/vimdoc-ja/doc/tabpage.jax new file mode 100644 index 0000000000..e4698ac670 --- /dev/null +++ b/plugins/vimdoc-ja/doc/tabpage.jax @@ -0,0 +1,470 @@ +*tabpage.txt* For Vim バージョン 8.0. Last change: 2016 Oct 20 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +タブページの使い方 *tab-page* *tabpage* + +タブページを使うために追加されたコマンドについて説明します。複数のタブページを +開いていると違う働きをするコマンドについても説明します。 + +1. はじめに |tab-page-intro| +2. コマンド |tab-page-commands| +3. その他 |tab-page-other| +4. 'tabline' の設定 |setting-tabline| +5. 'guitablabel' の設定 |setting-guitablabel| + +{Vi にはこれらのコマンドはありません} +{|+windows| が有効な場合のみ利用できます} + +============================================================================== +1. はじめに *tab-page-intro* + +タブページは複数のウィンドウを持てます。タブページを使うと、作業別のウィンドウ +の集合を簡単に切り替えることができます。 + +通常、Vim ウィンドウの最上部にタブページを表すラベルの一覧が表示されます。その +ラベルをマウスでクリックすると、そのタブページにジャンプできます。他の方法でも +タブページを移動できます。 + +ほとんどのコマンドは作業中のタブページ内だけで動作します。|CTRL-W| コマンド +や、|:tab| を前置しない |:windo|、|:all|、|:ball| なども同様です。カレントタブ +ページ以外にも作用するコマンドについては以下で説明しています。 + +タブページを使うと、一時的なバッファを使用するときに、作業中のウィンドウレイア +ウトを変更しなくてすみます。新しいタブページを開いて、何か作業をし、そのタブ +ページを閉じる、という具合です。 + +============================================================================== +2. コマンド *tab-page-commands* + +タブページを開くには: + +Vim を "vim -p filename ..." と起動すると、それぞれのファイルごとに (最大 +'tabpagemax' までの) タブページを開けます。|-p| 参照。 + +CUI の Vim でタブページラインをダブルクリックすると新しいタブページが作成され +ます。新しいタブページはクリックした場所の左に作成されます。最初のクリックが他 +のタブページの選択になってしまうときは、スクリーンが余計に更新されます。 + +この機能は Win32 と Motif の GUI でも使えます。ただし、ラベルの右をクリックし +た場合のみです。 + +GUI でタブページラインを右クリックするとメニューが表示されます。|tabline-menu| + +関連する自動コマンドについては、|tabnew-autocmd| を参照してください。 + +:[count]tabe[dit] *:tabe* *:tabedit* *:tabnew* +:[count]tabnew + カレントタブページの後ろに空のウィンドウを持った新しいタブペー + ジを作成します。[count] が与えられる場合、新しいタブページは + [count] 番目のタブページの後ろに作成され、[count] が省略さ + れる場合はカレントタブページの後ろに作成されます。 > + :tabnew " カレントタブページの後ろに新規タブ + " ページを作成 + :.tabnew " 同上 + :+tabnew " 右のタブページの後ろに新規タブページ + " を作成 + " 注: tabnew よりも1つ右側に作られる + :-tabnew " カレントタブページの前に新規タブ + " ページを作成 + :0tabnew " 新規タブページを左端に作成 + :$tabnew " 新規タブページを右端に作成 +< +:[count]tabe[dit] [++opt] [+cmd] {file} +:[count]tabnew [++opt] [+cmd] {file} + {file} を新しいタブページで開きます。|:edit| と同じです。 + [count] については上記 |:tabnew| 参照。 + +:[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind* + 'path' 内の {file} を新しいタブページで開きます。|:find| と同 + じです。[count] については上記 |:tabnew| 参照。 + {|+file_in_path| が有効な場合のみ利用できます} + +:[count]tab {cmd} *:tab* + {cmd} を実行します。そのコマンドが新しいウィンドウを作成すると + きは、その代わりに新しいタブページを作成します。|:diffsplit|と + |:diffpatch|, |:execute|, |:normal| に対しては機能しません。 + [count] を指定すると、現在のタブページから見て [count] 番目の + タブページの後ろに作成されます。 + 例: > + :tab split " 現在のバッファを新規タブで開く + :tab help gt " "gt" に対するヘルプを新規タブで開く + :.tab help gt " 同上 + :+tab help " 次のタブページのその次に help のタブ + " ページを開く + :-tab help " 現在のタブの前に help のタブを開く + :0tab help " 最初のタブページの前に help のタブページ + " を開く + :$tab help " 最後のタブページの次に help のタブページ + " を開く +< +CTRL-W gf カーソル下のファイル名のファイルを新しいタブページで開きます。 + |CTRL-W_gf| を参照してください。 + +CTRL-W gF カーソル下のファイル名のファイルを新しいタブページで開きます。 + そして、ファイル名の後ろに指定された行番号にジャンプします。 + |CTRL-W_gF| を参照してください。 + +タブページを閉じるには: + +複数のタブページを開いているときは、タブページ内の最後のウィンドウを閉じると、 +そのタブページが閉じられます。 + +タブページラインが表示されているときは、右上に表示されている "X" をマウスでク +リックすると、カレントタブページが閉じます。|'tabline'| を設定しているときは、 +他の何かが表示されているかもしれません。 + + *:tabc* *:tabclose* +:tabc[lose][!] カレントタブページを閉じます。 + このコマンドは次のときに失敗します: + - タブページが一つしかないとき。 *E784* + - 'hidden' がオフのときに [!] を使わず、バッファに変更があり、 + そのバッファを表示しているウィンドウが他にない場合。 + バッファの変更はファイルに保存されませんが、失われることもあり + ません。このコマンドは安全なコマンドです。 > + :tabclose " カレントタブページを閉じる +< +:{count}tabc[lose][!] +:tabc[lose][!] {count} + {count} 番目のタブページを閉じます。`:tabclose` と同じ理由で失 + 敗することがあります。 > + :-tabclose " カレントタブページの前のタブページを + " 閉じる + :+tabclose " カレントタブページの次のタブページを + " 閉じる + :1tabclose " 左端のタブページを閉じる + :$tabclose " 右端のタブページを閉じる + :tabclose -2 " 2つ前のタブページを閉じる + :tabclose + " 次のタブページを閉じる + :tabclose 3 " 3番目のタブページを閉じる + :tabclose $ " 右端のタブページを閉じる +< + *:tabo* *:tabonly* +:tabo[nly][!] カレントタブページ以外のすべてのタブページを閉じます。 + オプション 'hidden' がオンのとき、閉じたウィンドウのバッファは + すべて隠しバッファになります。 + 'hidden' がオフ、'autowrite' がオンのときは、変更のあるバッ + ファはファイルに保存されます。そうでないときは、変更のあるバッ + ファを表示しているウィンドウは閉じません。[!] を指定した場合 + は、変更のあるバッファは隠しバッファになります。変更のあるバッ + ファは絶対に破棄されないので、変更を失うことはありません。 > + :tabonly " カレントタブページ以外のすべてのタブ + " ページを閉じる +< +:{count}tabo[nly][!] + {count} のタブページ以外のすべてのタブページを閉じます。 > + :.tabonly " 上に同じ + :-tabonly " カレントタブページの前のタブページ以外を + " 全て閉じる + :+tabonly " カレントタブページの次のタブページ以外を + " 全て閉じる + :1tabonly " 最初のタブページ以外を全て閉じる + :$tabonly " 最後のタブページ以外を全て閉じる + :tabonly - " カレントタブページの前のタブページ以外を + " 全て閉じる + :tabonly +2 " カレントタブページの2つ次のタブページ + " 以外を全て閉じる + :tabonly 1 " 最初のタブページ以外を全て閉じる + :tabonly $ " 最後のタブページ以外を全て閉じる +< + +タブページを切り替えるには: + +タブページラインが表示されているときは、タブページラベルをマウスでクリックする +と、そのタブページに移動できます。ラベルが表示されていない場所をクリックする +と、次のタブページに移動できます。 |'tabline'| + +:tabn[ext] *:tabn* *:tabnext* *gt* +<C-PageDown> *CTRL-<PageDown>* *<C-PageDown>* +gt *i_CTRL-<PageDown>* *i_<C-PageDown>* + 次のタブページに移動します。次のタブページがない場合は、最初の + タブページに移動します。 + +:{count}tabn[ext] +:tabn[ext] {count} + {count} 番目のタブページに移動します。最初のタブページの番号は + 1 です。 > + :-tabnext " 前のタブページに移動する + :+tabnext " 次のタブページに移動する + :+2tabnext " 2つ次のタブページに移動する + :1tabnext " 最初のタブページに移動する + :$tabnext " 最後のタブページに移動する + :tabnext $ " 同上 + :tabnext - " 前のタブページに移動する + :tabnext -1 " 同上 + :tabnext + " 次のタブページに移動する + :tabnext +1 " 同上 + +{count}<C-PageDown> +{count}gt {count} 番目のタブページに移動します。最初のタブページの番号は + 1 です。 + + +:tabp[revious] *:tabp* *:tabprevious* *gT* *:tabN* +:tabN[ext] *:tabNext* *CTRL-<PageUp>* +<C-PageUp> *<C-PageUp>* *i_CTRL-<PageUp>* *i_<C-PageUp>* +gT 前のタブページに移動します。前のタブページがない場合は、最後の + タブページに移動します。 + +:tabp[revious] {count} +:tabN[ext] {count} +{count}<C-PageUp> +{count}gT {count} の数だけ前のタブページに移動します。前のタブページがな + い場合は最後のタブページに移動します。 + +:tabr[ewind] *:tabfir* *:tabfirst* *:tabr* *:tabrewind* +:tabfir[st] 最初のタブページに移動します。 + + *:tabl* *:tablast* +:tabl[ast] 最後のタブページに移動します。 + + +その他のコマンド: + *:tabs* +:tabs タブページと、含まれているウィンドウの一覧を表示します。 + ">" と表示されるのはカレントウィンドウです。 + "+" と表示されるのは変更のあるバッファです。 + 例: + タブページ1 ~ + + tabpage.txt ~ + ex_docmd.c ~ + タブページ2 ~ + > main.c ~ + + +タブページを並べ替えるには: + +:tabm[ove] [N] *:tabm* *:tabmove* +:[N]tabm[ove] + カレントタブページを N 番目のタブページの後ろに移動します。カ + レントタブページを一番目のタブページにするにはゼロを指定します。 + N を省略すると最後に移動します。 > + :.tabmove " 何もしない + :-tabmove " タブページを左に移動 + :+tabmove " タブページを右に移動 + :0tabmove " タブページを左端に移動 + :tabmove 0 " 同上 + :tabmove " タブページを右端に移動 + :$tabmove " 同上 + :tabmove $ " 同上 +< +:tabm[ove] +[N] +:tabm[ove] -[N] + カレントタブページを N 個右 (+ の場合) または左 (- の場合) に + 移動します。 > + :tabmove - " タブページを左に移動 + :tabmove -1 " 同上 + :tabmove + " タブページを右に移動 + :tabmove +1 " 同上 +< + +Note :Ntabmove を使うことでタブを N 番目のタブの後ろに移動することができること +と、:+Ntabmove を使って N 個後ろに移動できることに注意してください。この場合に ++N が何を意味するかについては、|[range]| を参照してください。 + + +タブページごとにコマンドを実行するには: + + *:tabd* *:tabdo* +:[range]tabd[o] {cmd} + タブページごと、または [range] が与えられた場合はその範囲のタ + ブページのみにコマンドを実行します。これは次のような動作をしま + す: > + :tabfirst + :{cmd} + :tabnext + :{cmd} + etc. +< このコマンドは各タブページのカレントウィンドウで実行されます。 + いずれかのタブページでエラーが起きたときは、その場で実行を中断 + します。 + 最後のタブページ (またはエラーが起きたタブページ) がカレントタ + ブページになります。 + {cmd} は '|' を使って複数のコマンドを繋げることができます。 + {cmd} はタブページを開いたり閉じたり並べ替えたりしてはいけませ + ん。 + {Vi にはありません} + {|+listcmds| が有効な場合のみ利用できます} + |:windo|、|:argdo|、|:bufdo|、|:cdo|、|:ldo|、|:cfdo|、|:lfdo| + も参照してください。 + +============================================================================== +3. その他 *tab-page-other* + + *tabline-menu* +GUI のタブページラインにはポップアップメニューがあります。右クリックで次のメ +ニューが表示されます: + Close マウスポインタの下のタブページを閉じます。マウスがラベ + ルの上にないときは、カレントタブページを閉じます。 + New Tab タブページを新規バッファで開きます。マウスポインタの左 + 側に作成されます。 + Open Tab... "New Tab" と同じですが、ファイル選択ダイアログを使っ + て選択したファイルを新しいタブページで開きます。 + +差分モードはタブページ単位で機能します。一つのタブページ内でファイル間の差分を +表示できます。そして、他のタブページでは他のファイルとの差分を表示することがで +きます。 + +タブページローカル変数は "t:" で始まります。|tabpage-variable| + +現在、タブページローカルなオプションは 'cmdheight' だけです。 + + *tabnew-autocmd* +オートコマンドイベントの TabLeave と TabEnter を使って、タブページを切り替える +ときにコマンドを実行できます。イベントが起きる正確な順番は何をしたかによって変 +わります。新しいタブページを作成したときは、例えば、編集中のバッファを新しい +ウィンドウで開き、それからそのウィンドウで別のバッファを開いたときと同じような +動きをします。つまり、":tabnew" では次の順番でイベントが実行されます: + WinLeave カレントウィンドウから離れる + TabLeave カレントタブページから離れる + WinEnter 新しいタブページのウィンドウに入る + TabEnter 新しいタブページに入る + BufLeave カレントバッファから離れる + BufEnter 新しい空のバッファに入る + +タブページを切り替えたときは次の順番です: + BufLeave + WinLeave + TabLeave + TabEnter + WinEnter + BufEnter + +============================================================================== +4. 'tabline' の設定 *setting-tabline* + +オプション 'tabline' を設定してタブページラベルの表示方法を指定できます。これ +は CUI の タブページラインで使います。 + +オプション 'showtabline' を設定してタブページラインを表示するかどうかを指定で +きます。表示しない、タブページが複数あるときだけ表示する、常に表示する、から選 +べます。 + +タブページラインの強調表示には TabLine、TabLineSel、TabLineFill が使われます。 +|hl-TabLine| |hl-TabLineSel| |hl-TabLineFill| + +変更されているウィンドウを含むタブページには "+" が表示されます。タブページ内 +のウィンドウの個数も表示されます。よって "3+" という表示は3個のウィンドウを含 +む、そのうちの1つが変更されているバッファを含むということを意味します。 + +オプション 'tabline' を使って、タブページラベルを好みの表示に設定できます。こ +れはあまり簡単ではないので、サンプルを用意してあります。 + +基本的には 'statusline' を参照してください。同じアイテムが 'tabline' で使用で +きます。加えて、|tabpagebuflist()|、|tabpagenr()|、|tabpagewinnr()| という関数 +も使えます。 + +タブページラベルの数は変化するので、オプションには式を使う必要があります。次の +ように設定します: > + :set tabline=%!MyTabLine() + +では、関数 MyTabLine() を定義して、すべてのタブページラベルを表示するようにし +ます。タブページラベル全体の作成と、個々のタブページラベルの作成、という二つの +段階に分けると簡単です。 > + + function MyTabLine() + let s = '' + for i in range(tabpagenr('$')) + " 強調表示グループの選択 + if i + 1 == tabpagenr() + let s .= '%#TabLineSel#' + else + let s .= '%#TabLine#' + endif + + " タブページ番号の設定 (マウスクリック用) + let s .= '%' . (i + 1) . 'T' + + " ラベルは MyTabLabel() で作成する + let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' + endfor + + " 最後のタブページの後は TabLineFill で埋め、タブページ番号をリセッ + " トする + let s .= '%#TabLineFill#%T' + + " カレントタブページを閉じるボタンのラベルを右添えで作成 + if tabpagenr('$') > 1 + let s .= '%=%#TabLine#%999Xclose' + endif + + return s + endfunction + +関数 MyTabLabel() は個々のタブページラベルを得るために呼ばれます。 > + + function MyTabLabel(n) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + return bufname(buflist[winnr - 1]) + endfunction + +このサンプルは単純なものです。生成されるのは未設定時のタブページラインとほぼ同 +じですが、変更のあるバッファに + が付けたり、名前を切り詰めたりはしません。十 +分な表示領域がない場合など、なんらかのうまい方法でラベルの幅を減らしたいでしょ +う。利用できる表示領域はオプション 'columns' を確認してください。 + +============================================================================== +5. 'guitablabel' の設定 *setting-guitablabel* + +GUI のタブページラインが表示されているとき、'guitablabel' を設定してタブページ +ラベルの表示方法を指定できます。'tabline' とは違い、一度にタブページライン全体 +を指定するのではなく、個々のラベルを得るために 'guitablabel' が使われます。 + +'guitabtooltip' という良く似たオプションがあります。これはラベルのツールチップ +を表示するために使われます。ツールチップはマウスポインタがラベルの上に乗ってい +るときだけ表示されるので、普通は、長い文字を表示します。いくつかのシステムだけ +サポートされています。 + +書式についてはオプション 'statusline' を参照してください。 + +"%N" はカレントタブページ番号になります。このオプションを評価するときに、 +|v:lnum| にも同じ番号が設定されます。ファイル名を参照するアイテムにはタブペー +ジのカレントウィンドウのものが使われます。 + +Note: このオプションでは強調表示は使えません。%T と %X は無視されます。 + +簡単な例として、次のものはタブページ番号とバッファ名をラベルに表示します: > + :set guitablabel=%N\ %f + +次の例は 'guitablabel' の標準設定の動作と似た動作をします。タブページのウィン +ドウ数と、変更のあるバッファがあるときには '+' を表示します: > + + function GuiTabLabel() + let label = '' + let bufnrlist = tabpagebuflist(v:lnum) + + " このタブページに変更のあるバッファがるときには '+' を追加する + for bufnr in bufnrlist + if getbufvar(bufnr, "&modified") + let label = '+' + break + endif + endfor + + " ウィンドウが複数あるときにはその数を追加する + let wincount = tabpagewinnr(v:lnum, '$') + if wincount > 1 + let label .= wincount + endif + if label != '' + let label .= ' ' + endif + + " バッファ名を追加する + return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) + endfunction + + set guitablabel=%{GuiTabLabel()} + +Note: この関数はオプションを設定する前に定義しておく必要があります。そうしない +と、関数未定義のエラーが表示されてしまいます。 + +標準のラベルを使いたい場合は、空文字列を返してください。 + +あるタブページに固有の何かを表示したいときは、タブページローカル変数 |t:var| +が便利です。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/tags b/plugins/vimdoc-ja/doc/tags new file mode 100644 index 0000000000..1d1df2a581 --- /dev/null +++ b/plugins/vimdoc-ja/doc/tags @@ -0,0 +1,9184 @@ +! ../../plugins/vimdoc-ja/doc/change.jax /*!* +!! ../../plugins/vimdoc-ja/doc/change.jax /*!!* +# ../../plugins/vimdoc-ja/doc/pattern.jax /*#* +$ ../../plugins/vimdoc-ja/doc/motion.jax /*$* +$HOME ../../plugins/vimdoc-ja/doc/options.jax /*$HOME* +$MYGVIMRC ../../plugins/vimdoc-ja/doc/gui.jax /*$MYGVIMRC* +$MYVIMRC ../../plugins/vimdoc-ja/doc/starting.jax /*$MYVIMRC* +$VIM ../../plugins/vimdoc-ja/doc/starting.jax /*$VIM* +$VIMRUNTIME ../../plugins/vimdoc-ja/doc/starting.jax /*$VIMRUNTIME* +$VIM_POSIX ../../plugins/vimdoc-ja/doc/vi_diff.jax /*$VIM_POSIX* +% ../../plugins/vimdoc-ja/doc/motion.jax /*%* +%:. ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:.* +%:8 ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:8* +%:S ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:S* +%:e ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:e* +%:gs ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:gs* +%:h ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:h* +%:p ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:p* +%:r ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:r* +%:s ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:s* +%:t ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:t* +%:~ ../../plugins/vimdoc-ja/doc/cmdline.jax /*%:~* +& ../../plugins/vimdoc-ja/doc/change.jax /*&* +' ../../plugins/vimdoc-ja/doc/motion.jax /*'* +'' ../../plugins/vimdoc-ja/doc/motion.jax /*''* +'( ../../plugins/vimdoc-ja/doc/motion.jax /*'(* +') ../../plugins/vimdoc-ja/doc/motion.jax /*')* +'. ../../plugins/vimdoc-ja/doc/motion.jax /*'.* +'0 ../../plugins/vimdoc-ja/doc/motion.jax /*'0* +'< ../../plugins/vimdoc-ja/doc/motion.jax /*'<* +'> ../../plugins/vimdoc-ja/doc/motion.jax /*'>* +'A ../../plugins/vimdoc-ja/doc/motion.jax /*'A* +'[ ../../plugins/vimdoc-ja/doc/motion.jax /*'[* +'] ../../plugins/vimdoc-ja/doc/motion.jax /*']* +'^ ../../plugins/vimdoc-ja/doc/motion.jax /*'^* +'a ../../plugins/vimdoc-ja/doc/motion.jax /*'a* +'acd' ../../plugins/vimdoc-ja/doc/options.jax /*'acd'* +'ai' ../../plugins/vimdoc-ja/doc/options.jax /*'ai'* +'akm' ../../plugins/vimdoc-ja/doc/options.jax /*'akm'* +'al' ../../plugins/vimdoc-ja/doc/options.jax /*'al'* +'aleph' ../../plugins/vimdoc-ja/doc/options.jax /*'aleph'* +'allowrevins' ../../plugins/vimdoc-ja/doc/options.jax /*'allowrevins'* +'altkeymap' ../../plugins/vimdoc-ja/doc/options.jax /*'altkeymap'* +'ambiwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'ambiwidth'* +'ambw' ../../plugins/vimdoc-ja/doc/options.jax /*'ambw'* +'anti' ../../plugins/vimdoc-ja/doc/options.jax /*'anti'* +'antialias' ../../plugins/vimdoc-ja/doc/options.jax /*'antialias'* +'ap' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'ap'* +'ar' ../../plugins/vimdoc-ja/doc/options.jax /*'ar'* +'arab' ../../plugins/vimdoc-ja/doc/options.jax /*'arab'* +'arabic' ../../plugins/vimdoc-ja/doc/options.jax /*'arabic'* +'arabicshape' ../../plugins/vimdoc-ja/doc/options.jax /*'arabicshape'* +'ari' ../../plugins/vimdoc-ja/doc/options.jax /*'ari'* +'arshape' ../../plugins/vimdoc-ja/doc/options.jax /*'arshape'* +'autochdir' ../../plugins/vimdoc-ja/doc/options.jax /*'autochdir'* +'autoindent' ../../plugins/vimdoc-ja/doc/options.jax /*'autoindent'* +'autoprint' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'autoprint'* +'autoread' ../../plugins/vimdoc-ja/doc/options.jax /*'autoread'* +'autowrite' ../../plugins/vimdoc-ja/doc/options.jax /*'autowrite'* +'autowriteall' ../../plugins/vimdoc-ja/doc/options.jax /*'autowriteall'* +'aw' ../../plugins/vimdoc-ja/doc/options.jax /*'aw'* +'awa' ../../plugins/vimdoc-ja/doc/options.jax /*'awa'* +'background' ../../plugins/vimdoc-ja/doc/options.jax /*'background'* +'backspace' ../../plugins/vimdoc-ja/doc/options.jax /*'backspace'* +'backup' ../../plugins/vimdoc-ja/doc/options.jax /*'backup'* +'backupcopy' ../../plugins/vimdoc-ja/doc/options.jax /*'backupcopy'* +'backupdir' ../../plugins/vimdoc-ja/doc/options.jax /*'backupdir'* +'backupext' ../../plugins/vimdoc-ja/doc/options.jax /*'backupext'* +'backupskip' ../../plugins/vimdoc-ja/doc/options.jax /*'backupskip'* +'balloondelay' ../../plugins/vimdoc-ja/doc/options.jax /*'balloondelay'* +'ballooneval' ../../plugins/vimdoc-ja/doc/options.jax /*'ballooneval'* +'balloonexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'balloonexpr'* +'bdir' ../../plugins/vimdoc-ja/doc/options.jax /*'bdir'* +'bdlay' ../../plugins/vimdoc-ja/doc/options.jax /*'bdlay'* +'beautify' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'beautify'* +'belloff' ../../plugins/vimdoc-ja/doc/options.jax /*'belloff'* +'beval' ../../plugins/vimdoc-ja/doc/options.jax /*'beval'* +'bex' ../../plugins/vimdoc-ja/doc/options.jax /*'bex'* +'bexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'bexpr'* +'bf' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'bf'* +'bg' ../../plugins/vimdoc-ja/doc/options.jax /*'bg'* +'bh' ../../plugins/vimdoc-ja/doc/options.jax /*'bh'* +'bin' ../../plugins/vimdoc-ja/doc/options.jax /*'bin'* +'binary' ../../plugins/vimdoc-ja/doc/options.jax /*'binary'* +'biosk' ../../plugins/vimdoc-ja/doc/options.jax /*'biosk'* +'bioskey' ../../plugins/vimdoc-ja/doc/options.jax /*'bioskey'* +'bk' ../../plugins/vimdoc-ja/doc/options.jax /*'bk'* +'bkc' ../../plugins/vimdoc-ja/doc/options.jax /*'bkc'* +'bl' ../../plugins/vimdoc-ja/doc/options.jax /*'bl'* +'bo' ../../plugins/vimdoc-ja/doc/options.jax /*'bo'* +'bomb' ../../plugins/vimdoc-ja/doc/options.jax /*'bomb'* +'breakat' ../../plugins/vimdoc-ja/doc/options.jax /*'breakat'* +'breakindent' ../../plugins/vimdoc-ja/doc/options.jax /*'breakindent'* +'breakindentopt' ../../plugins/vimdoc-ja/doc/options.jax /*'breakindentopt'* +'bri' ../../plugins/vimdoc-ja/doc/options.jax /*'bri'* +'briopt' ../../plugins/vimdoc-ja/doc/options.jax /*'briopt'* +'brk' ../../plugins/vimdoc-ja/doc/options.jax /*'brk'* +'browsedir' ../../plugins/vimdoc-ja/doc/options.jax /*'browsedir'* +'bs' ../../plugins/vimdoc-ja/doc/options.jax /*'bs'* +'bsdir' ../../plugins/vimdoc-ja/doc/options.jax /*'bsdir'* +'bsk' ../../plugins/vimdoc-ja/doc/options.jax /*'bsk'* +'bt' ../../plugins/vimdoc-ja/doc/options.jax /*'bt'* +'bufhidden' ../../plugins/vimdoc-ja/doc/options.jax /*'bufhidden'* +'buflisted' ../../plugins/vimdoc-ja/doc/options.jax /*'buflisted'* +'buftype' ../../plugins/vimdoc-ja/doc/options.jax /*'buftype'* +'casemap' ../../plugins/vimdoc-ja/doc/options.jax /*'casemap'* +'cb' ../../plugins/vimdoc-ja/doc/options.jax /*'cb'* +'cc' ../../plugins/vimdoc-ja/doc/options.jax /*'cc'* +'ccv' ../../plugins/vimdoc-ja/doc/options.jax /*'ccv'* +'cd' ../../plugins/vimdoc-ja/doc/options.jax /*'cd'* +'cdpath' ../../plugins/vimdoc-ja/doc/options.jax /*'cdpath'* +'cedit' ../../plugins/vimdoc-ja/doc/options.jax /*'cedit'* +'cf' ../../plugins/vimdoc-ja/doc/options.jax /*'cf'* +'cfu' ../../plugins/vimdoc-ja/doc/options.jax /*'cfu'* +'ch' ../../plugins/vimdoc-ja/doc/options.jax /*'ch'* +'character' ../../plugins/vimdoc-ja/doc/intro.jax /*'character'* +'charconvert' ../../plugins/vimdoc-ja/doc/options.jax /*'charconvert'* +'ci' ../../plugins/vimdoc-ja/doc/options.jax /*'ci'* +'cin' ../../plugins/vimdoc-ja/doc/options.jax /*'cin'* +'cindent' ../../plugins/vimdoc-ja/doc/options.jax /*'cindent'* +'cink' ../../plugins/vimdoc-ja/doc/options.jax /*'cink'* +'cinkeys' ../../plugins/vimdoc-ja/doc/options.jax /*'cinkeys'* +'cino' ../../plugins/vimdoc-ja/doc/options.jax /*'cino'* +'cinoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'cinoptions'* +'cinw' ../../plugins/vimdoc-ja/doc/options.jax /*'cinw'* +'cinwords' ../../plugins/vimdoc-ja/doc/options.jax /*'cinwords'* +'clipboard' ../../plugins/vimdoc-ja/doc/options.jax /*'clipboard'* +'cm' ../../plugins/vimdoc-ja/doc/options.jax /*'cm'* +'cmdheight' ../../plugins/vimdoc-ja/doc/options.jax /*'cmdheight'* +'cmdwinheight' ../../plugins/vimdoc-ja/doc/options.jax /*'cmdwinheight'* +'cmp' ../../plugins/vimdoc-ja/doc/options.jax /*'cmp'* +'cms' ../../plugins/vimdoc-ja/doc/options.jax /*'cms'* +'co' ../../plugins/vimdoc-ja/doc/options.jax /*'co'* +'cocu' ../../plugins/vimdoc-ja/doc/options.jax /*'cocu'* +'cole' ../../plugins/vimdoc-ja/doc/options.jax /*'cole'* +'colorcolumn' ../../plugins/vimdoc-ja/doc/options.jax /*'colorcolumn'* +'columns' ../../plugins/vimdoc-ja/doc/options.jax /*'columns'* +'com' ../../plugins/vimdoc-ja/doc/options.jax /*'com'* +'comments' ../../plugins/vimdoc-ja/doc/options.jax /*'comments'* +'commentstring' ../../plugins/vimdoc-ja/doc/options.jax /*'commentstring'* +'compatible' ../../plugins/vimdoc-ja/doc/options.jax /*'compatible'* +'complete' ../../plugins/vimdoc-ja/doc/options.jax /*'complete'* +'completefunc' ../../plugins/vimdoc-ja/doc/options.jax /*'completefunc'* +'completeopt' ../../plugins/vimdoc-ja/doc/options.jax /*'completeopt'* +'concealcursor' ../../plugins/vimdoc-ja/doc/options.jax /*'concealcursor'* +'conceallevel' ../../plugins/vimdoc-ja/doc/options.jax /*'conceallevel'* +'confirm' ../../plugins/vimdoc-ja/doc/options.jax /*'confirm'* +'consk' ../../plugins/vimdoc-ja/doc/options.jax /*'consk'* +'conskey' ../../plugins/vimdoc-ja/doc/options.jax /*'conskey'* +'copyindent' ../../plugins/vimdoc-ja/doc/options.jax /*'copyindent'* +'cot' ../../plugins/vimdoc-ja/doc/options.jax /*'cot'* +'cp' ../../plugins/vimdoc-ja/doc/options.jax /*'cp'* +'cpo' ../../plugins/vimdoc-ja/doc/options.jax /*'cpo'* +'cpoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'cpoptions'* +'cpt' ../../plugins/vimdoc-ja/doc/options.jax /*'cpt'* +'crb' ../../plugins/vimdoc-ja/doc/options.jax /*'crb'* +'cryptmethod' ../../plugins/vimdoc-ja/doc/options.jax /*'cryptmethod'* +'cscopepathcomp' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopepathcomp'* +'cscopeprg' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopeprg'* +'cscopequickfix' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopequickfix'* +'cscoperelative' ../../plugins/vimdoc-ja/doc/options.jax /*'cscoperelative'* +'cscopetag' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopetag'* +'cscopetagorder' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopetagorder'* +'cscopeverbose' ../../plugins/vimdoc-ja/doc/options.jax /*'cscopeverbose'* +'cspc' ../../plugins/vimdoc-ja/doc/options.jax /*'cspc'* +'csprg' ../../plugins/vimdoc-ja/doc/options.jax /*'csprg'* +'csqf' ../../plugins/vimdoc-ja/doc/options.jax /*'csqf'* +'csre' ../../plugins/vimdoc-ja/doc/options.jax /*'csre'* +'cst' ../../plugins/vimdoc-ja/doc/options.jax /*'cst'* +'csto' ../../plugins/vimdoc-ja/doc/options.jax /*'csto'* +'csverb' ../../plugins/vimdoc-ja/doc/options.jax /*'csverb'* +'cuc' ../../plugins/vimdoc-ja/doc/options.jax /*'cuc'* +'cul' ../../plugins/vimdoc-ja/doc/options.jax /*'cul'* +'cursorbind' ../../plugins/vimdoc-ja/doc/options.jax /*'cursorbind'* +'cursorcolumn' ../../plugins/vimdoc-ja/doc/options.jax /*'cursorcolumn'* +'cursorline' ../../plugins/vimdoc-ja/doc/options.jax /*'cursorline'* +'cwh' ../../plugins/vimdoc-ja/doc/options.jax /*'cwh'* +'debug' ../../plugins/vimdoc-ja/doc/options.jax /*'debug'* +'deco' ../../plugins/vimdoc-ja/doc/options.jax /*'deco'* +'def' ../../plugins/vimdoc-ja/doc/options.jax /*'def'* +'define' ../../plugins/vimdoc-ja/doc/options.jax /*'define'* +'delcombine' ../../plugins/vimdoc-ja/doc/options.jax /*'delcombine'* +'dex' ../../plugins/vimdoc-ja/doc/options.jax /*'dex'* +'dg' ../../plugins/vimdoc-ja/doc/options.jax /*'dg'* +'dict' ../../plugins/vimdoc-ja/doc/options.jax /*'dict'* +'dictionary' ../../plugins/vimdoc-ja/doc/options.jax /*'dictionary'* +'diff' ../../plugins/vimdoc-ja/doc/options.jax /*'diff'* +'diffexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'diffexpr'* +'diffopt' ../../plugins/vimdoc-ja/doc/options.jax /*'diffopt'* +'digraph' ../../plugins/vimdoc-ja/doc/options.jax /*'digraph'* +'dip' ../../plugins/vimdoc-ja/doc/options.jax /*'dip'* +'dir' ../../plugins/vimdoc-ja/doc/options.jax /*'dir'* +'directory' ../../plugins/vimdoc-ja/doc/options.jax /*'directory'* +'display' ../../plugins/vimdoc-ja/doc/options.jax /*'display'* +'dy' ../../plugins/vimdoc-ja/doc/options.jax /*'dy'* +'ea' ../../plugins/vimdoc-ja/doc/options.jax /*'ea'* +'ead' ../../plugins/vimdoc-ja/doc/options.jax /*'ead'* +'eadirection' ../../plugins/vimdoc-ja/doc/options.jax /*'eadirection'* +'eb' ../../plugins/vimdoc-ja/doc/options.jax /*'eb'* +'ed' ../../plugins/vimdoc-ja/doc/options.jax /*'ed'* +'edcompatible' ../../plugins/vimdoc-ja/doc/options.jax /*'edcompatible'* +'ef' ../../plugins/vimdoc-ja/doc/options.jax /*'ef'* +'efm' ../../plugins/vimdoc-ja/doc/options.jax /*'efm'* +'ei' ../../plugins/vimdoc-ja/doc/options.jax /*'ei'* +'ek' ../../plugins/vimdoc-ja/doc/options.jax /*'ek'* +'emo' ../../plugins/vimdoc-ja/doc/options.jax /*'emo'* +'emoji' ../../plugins/vimdoc-ja/doc/options.jax /*'emoji'* +'enc' ../../plugins/vimdoc-ja/doc/options.jax /*'enc'* +'encoding' ../../plugins/vimdoc-ja/doc/options.jax /*'encoding'* +'endofline' ../../plugins/vimdoc-ja/doc/options.jax /*'endofline'* +'eol' ../../plugins/vimdoc-ja/doc/options.jax /*'eol'* +'ep' ../../plugins/vimdoc-ja/doc/options.jax /*'ep'* +'equalalways' ../../plugins/vimdoc-ja/doc/options.jax /*'equalalways'* +'equalprg' ../../plugins/vimdoc-ja/doc/options.jax /*'equalprg'* +'errorbells' ../../plugins/vimdoc-ja/doc/options.jax /*'errorbells'* +'errorfile' ../../plugins/vimdoc-ja/doc/options.jax /*'errorfile'* +'errorformat' ../../plugins/vimdoc-ja/doc/options.jax /*'errorformat'* +'esckeys' ../../plugins/vimdoc-ja/doc/options.jax /*'esckeys'* +'et' ../../plugins/vimdoc-ja/doc/options.jax /*'et'* +'eventignore' ../../plugins/vimdoc-ja/doc/options.jax /*'eventignore'* +'ex' ../../plugins/vimdoc-ja/doc/options.jax /*'ex'* +'expandtab' ../../plugins/vimdoc-ja/doc/options.jax /*'expandtab'* +'exrc' ../../plugins/vimdoc-ja/doc/options.jax /*'exrc'* +'fcl' ../../plugins/vimdoc-ja/doc/options.jax /*'fcl'* +'fcs' ../../plugins/vimdoc-ja/doc/options.jax /*'fcs'* +'fdc' ../../plugins/vimdoc-ja/doc/options.jax /*'fdc'* +'fde' ../../plugins/vimdoc-ja/doc/options.jax /*'fde'* +'fdi' ../../plugins/vimdoc-ja/doc/options.jax /*'fdi'* +'fdl' ../../plugins/vimdoc-ja/doc/options.jax /*'fdl'* +'fdls' ../../plugins/vimdoc-ja/doc/options.jax /*'fdls'* +'fdm' ../../plugins/vimdoc-ja/doc/options.jax /*'fdm'* +'fdn' ../../plugins/vimdoc-ja/doc/options.jax /*'fdn'* +'fdo' ../../plugins/vimdoc-ja/doc/options.jax /*'fdo'* +'fdt' ../../plugins/vimdoc-ja/doc/options.jax /*'fdt'* +'fe' ../../plugins/vimdoc-ja/doc/options.jax /*'fe'* +'fen' ../../plugins/vimdoc-ja/doc/options.jax /*'fen'* +'fenc' ../../plugins/vimdoc-ja/doc/options.jax /*'fenc'* +'fencs' ../../plugins/vimdoc-ja/doc/options.jax /*'fencs'* +'fex' ../../plugins/vimdoc-ja/doc/options.jax /*'fex'* +'ff' ../../plugins/vimdoc-ja/doc/options.jax /*'ff'* +'ffs' ../../plugins/vimdoc-ja/doc/options.jax /*'ffs'* +'fic' ../../plugins/vimdoc-ja/doc/options.jax /*'fic'* +'fileencoding' ../../plugins/vimdoc-ja/doc/options.jax /*'fileencoding'* +'fileencodings' ../../plugins/vimdoc-ja/doc/options.jax /*'fileencodings'* +'fileformat' ../../plugins/vimdoc-ja/doc/options.jax /*'fileformat'* +'fileformats' ../../plugins/vimdoc-ja/doc/options.jax /*'fileformats'* +'fileignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'fileignorecase'* +'filetype' ../../plugins/vimdoc-ja/doc/options.jax /*'filetype'* +'fillchars' ../../plugins/vimdoc-ja/doc/options.jax /*'fillchars'* +'fixendofline' ../../plugins/vimdoc-ja/doc/options.jax /*'fixendofline'* +'fixeol' ../../plugins/vimdoc-ja/doc/options.jax /*'fixeol'* +'fk' ../../plugins/vimdoc-ja/doc/options.jax /*'fk'* +'fkmap' ../../plugins/vimdoc-ja/doc/options.jax /*'fkmap'* +'fl' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'fl'* +'flash' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'flash'* +'flp' ../../plugins/vimdoc-ja/doc/options.jax /*'flp'* +'fml' ../../plugins/vimdoc-ja/doc/options.jax /*'fml'* +'fmr' ../../plugins/vimdoc-ja/doc/options.jax /*'fmr'* +'fo' ../../plugins/vimdoc-ja/doc/options.jax /*'fo'* +'foldclose' ../../plugins/vimdoc-ja/doc/options.jax /*'foldclose'* +'foldcolumn' ../../plugins/vimdoc-ja/doc/options.jax /*'foldcolumn'* +'foldenable' ../../plugins/vimdoc-ja/doc/options.jax /*'foldenable'* +'foldexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'foldexpr'* +'foldignore' ../../plugins/vimdoc-ja/doc/options.jax /*'foldignore'* +'foldlevel' ../../plugins/vimdoc-ja/doc/options.jax /*'foldlevel'* +'foldlevelstart' ../../plugins/vimdoc-ja/doc/options.jax /*'foldlevelstart'* +'foldmarker' ../../plugins/vimdoc-ja/doc/options.jax /*'foldmarker'* +'foldmethod' ../../plugins/vimdoc-ja/doc/options.jax /*'foldmethod'* +'foldminlines' ../../plugins/vimdoc-ja/doc/options.jax /*'foldminlines'* +'foldnestmax' ../../plugins/vimdoc-ja/doc/options.jax /*'foldnestmax'* +'foldopen' ../../plugins/vimdoc-ja/doc/options.jax /*'foldopen'* +'foldtext' ../../plugins/vimdoc-ja/doc/options.jax /*'foldtext'* +'formatexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'formatexpr'* +'formatlistpat' ../../plugins/vimdoc-ja/doc/options.jax /*'formatlistpat'* +'formatoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'formatoptions'* +'formatprg' ../../plugins/vimdoc-ja/doc/options.jax /*'formatprg'* +'fp' ../../plugins/vimdoc-ja/doc/options.jax /*'fp'* +'fs' ../../plugins/vimdoc-ja/doc/options.jax /*'fs'* +'fsync' ../../plugins/vimdoc-ja/doc/options.jax /*'fsync'* +'ft' ../../plugins/vimdoc-ja/doc/options.jax /*'ft'* +'gcr' ../../plugins/vimdoc-ja/doc/options.jax /*'gcr'* +'gd' ../../plugins/vimdoc-ja/doc/options.jax /*'gd'* +'gdefault' ../../plugins/vimdoc-ja/doc/options.jax /*'gdefault'* +'gfm' ../../plugins/vimdoc-ja/doc/options.jax /*'gfm'* +'gfn' ../../plugins/vimdoc-ja/doc/options.jax /*'gfn'* +'gfs' ../../plugins/vimdoc-ja/doc/options.jax /*'gfs'* +'gfw' ../../plugins/vimdoc-ja/doc/options.jax /*'gfw'* +'ghr' ../../plugins/vimdoc-ja/doc/options.jax /*'ghr'* +'go' ../../plugins/vimdoc-ja/doc/options.jax /*'go'* +'go-A' ../../plugins/vimdoc-ja/doc/options.jax /*'go-A'* +'go-F' ../../plugins/vimdoc-ja/doc/options.jax /*'go-F'* +'go-L' ../../plugins/vimdoc-ja/doc/options.jax /*'go-L'* +'go-M' ../../plugins/vimdoc-ja/doc/options.jax /*'go-M'* +'go-P' ../../plugins/vimdoc-ja/doc/options.jax /*'go-P'* +'go-R' ../../plugins/vimdoc-ja/doc/options.jax /*'go-R'* +'go-T' ../../plugins/vimdoc-ja/doc/options.jax /*'go-T'* +'go-a' ../../plugins/vimdoc-ja/doc/options.jax /*'go-a'* +'go-b' ../../plugins/vimdoc-ja/doc/options.jax /*'go-b'* +'go-c' ../../plugins/vimdoc-ja/doc/options.jax /*'go-c'* +'go-e' ../../plugins/vimdoc-ja/doc/options.jax /*'go-e'* +'go-f' ../../plugins/vimdoc-ja/doc/options.jax /*'go-f'* +'go-g' ../../plugins/vimdoc-ja/doc/options.jax /*'go-g'* +'go-h' ../../plugins/vimdoc-ja/doc/options.jax /*'go-h'* +'go-i' ../../plugins/vimdoc-ja/doc/options.jax /*'go-i'* +'go-l' ../../plugins/vimdoc-ja/doc/options.jax /*'go-l'* +'go-m' ../../plugins/vimdoc-ja/doc/options.jax /*'go-m'* +'go-p' ../../plugins/vimdoc-ja/doc/options.jax /*'go-p'* +'go-r' ../../plugins/vimdoc-ja/doc/options.jax /*'go-r'* +'go-t' ../../plugins/vimdoc-ja/doc/options.jax /*'go-t'* +'go-v' ../../plugins/vimdoc-ja/doc/options.jax /*'go-v'* +'gp' ../../plugins/vimdoc-ja/doc/options.jax /*'gp'* +'gr' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'gr'* +'graphic' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'graphic'* +'grepformat' ../../plugins/vimdoc-ja/doc/options.jax /*'grepformat'* +'grepprg' ../../plugins/vimdoc-ja/doc/options.jax /*'grepprg'* +'gtl' ../../plugins/vimdoc-ja/doc/options.jax /*'gtl'* +'gtt' ../../plugins/vimdoc-ja/doc/options.jax /*'gtt'* +'guicursor' ../../plugins/vimdoc-ja/doc/options.jax /*'guicursor'* +'guifont' ../../plugins/vimdoc-ja/doc/options.jax /*'guifont'* +'guifontset' ../../plugins/vimdoc-ja/doc/options.jax /*'guifontset'* +'guifontwide' ../../plugins/vimdoc-ja/doc/options.jax /*'guifontwide'* +'guiheadroom' ../../plugins/vimdoc-ja/doc/options.jax /*'guiheadroom'* +'guioptions' ../../plugins/vimdoc-ja/doc/options.jax /*'guioptions'* +'guipty' ../../plugins/vimdoc-ja/doc/options.jax /*'guipty'* +'guitablabel' ../../plugins/vimdoc-ja/doc/options.jax /*'guitablabel'* +'guitabtooltip' ../../plugins/vimdoc-ja/doc/options.jax /*'guitabtooltip'* +'hardtabs' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'hardtabs'* +'helpfile' ../../plugins/vimdoc-ja/doc/options.jax /*'helpfile'* +'helpheight' ../../plugins/vimdoc-ja/doc/options.jax /*'helpheight'* +'helplang' ../../plugins/vimdoc-ja/doc/options.jax /*'helplang'* +'hf' ../../plugins/vimdoc-ja/doc/options.jax /*'hf'* +'hh' ../../plugins/vimdoc-ja/doc/options.jax /*'hh'* +'hi' ../../plugins/vimdoc-ja/doc/options.jax /*'hi'* +'hid' ../../plugins/vimdoc-ja/doc/options.jax /*'hid'* +'hidden' ../../plugins/vimdoc-ja/doc/options.jax /*'hidden'* +'highlight' ../../plugins/vimdoc-ja/doc/options.jax /*'highlight'* +'history' ../../plugins/vimdoc-ja/doc/options.jax /*'history'* +'hk' ../../plugins/vimdoc-ja/doc/options.jax /*'hk'* +'hkmap' ../../plugins/vimdoc-ja/doc/options.jax /*'hkmap'* +'hkmapp' ../../plugins/vimdoc-ja/doc/options.jax /*'hkmapp'* +'hkp' ../../plugins/vimdoc-ja/doc/options.jax /*'hkp'* +'hl' ../../plugins/vimdoc-ja/doc/options.jax /*'hl'* +'hlg' ../../plugins/vimdoc-ja/doc/options.jax /*'hlg'* +'hls' ../../plugins/vimdoc-ja/doc/options.jax /*'hls'* +'hlsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'hlsearch'* +'ht' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'ht'* +'ic' ../../plugins/vimdoc-ja/doc/options.jax /*'ic'* +'icon' ../../plugins/vimdoc-ja/doc/options.jax /*'icon'* +'iconstring' ../../plugins/vimdoc-ja/doc/options.jax /*'iconstring'* +'ignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'ignorecase'* +'im' ../../plugins/vimdoc-ja/doc/options.jax /*'im'* +'imactivatefunc' ../../plugins/vimdoc-ja/doc/options.jax /*'imactivatefunc'* +'imactivatekey' ../../plugins/vimdoc-ja/doc/options.jax /*'imactivatekey'* +'imaf' ../../plugins/vimdoc-ja/doc/options.jax /*'imaf'* +'imak' ../../plugins/vimdoc-ja/doc/options.jax /*'imak'* +'imc' ../../plugins/vimdoc-ja/doc/options.jax /*'imc'* +'imcmdline' ../../plugins/vimdoc-ja/doc/options.jax /*'imcmdline'* +'imd' ../../plugins/vimdoc-ja/doc/options.jax /*'imd'* +'imdisable' ../../plugins/vimdoc-ja/doc/options.jax /*'imdisable'* +'imi' ../../plugins/vimdoc-ja/doc/options.jax /*'imi'* +'iminsert' ../../plugins/vimdoc-ja/doc/options.jax /*'iminsert'* +'ims' ../../plugins/vimdoc-ja/doc/options.jax /*'ims'* +'imsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'imsearch'* +'imsf' ../../plugins/vimdoc-ja/doc/options.jax /*'imsf'* +'imstatusfunc' ../../plugins/vimdoc-ja/doc/options.jax /*'imstatusfunc'* +'inc' ../../plugins/vimdoc-ja/doc/options.jax /*'inc'* +'include' ../../plugins/vimdoc-ja/doc/options.jax /*'include'* +'includeexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'includeexpr'* +'incsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'incsearch'* +'inde' ../../plugins/vimdoc-ja/doc/options.jax /*'inde'* +'indentexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'indentexpr'* +'indentkeys' ../../plugins/vimdoc-ja/doc/options.jax /*'indentkeys'* +'indk' ../../plugins/vimdoc-ja/doc/options.jax /*'indk'* +'inex' ../../plugins/vimdoc-ja/doc/options.jax /*'inex'* +'inf' ../../plugins/vimdoc-ja/doc/options.jax /*'inf'* +'infercase' ../../plugins/vimdoc-ja/doc/options.jax /*'infercase'* +'insertmode' ../../plugins/vimdoc-ja/doc/options.jax /*'insertmode'* +'is' ../../plugins/vimdoc-ja/doc/options.jax /*'is'* +'isf' ../../plugins/vimdoc-ja/doc/options.jax /*'isf'* +'isfname' ../../plugins/vimdoc-ja/doc/options.jax /*'isfname'* +'isi' ../../plugins/vimdoc-ja/doc/options.jax /*'isi'* +'isident' ../../plugins/vimdoc-ja/doc/options.jax /*'isident'* +'isk' ../../plugins/vimdoc-ja/doc/options.jax /*'isk'* +'iskeyword' ../../plugins/vimdoc-ja/doc/options.jax /*'iskeyword'* +'isp' ../../plugins/vimdoc-ja/doc/options.jax /*'isp'* +'isprint' ../../plugins/vimdoc-ja/doc/options.jax /*'isprint'* +'joinspaces' ../../plugins/vimdoc-ja/doc/options.jax /*'joinspaces'* +'js' ../../plugins/vimdoc-ja/doc/options.jax /*'js'* +'key' ../../plugins/vimdoc-ja/doc/options.jax /*'key'* +'keymap' ../../plugins/vimdoc-ja/doc/options.jax /*'keymap'* +'keymodel' ../../plugins/vimdoc-ja/doc/options.jax /*'keymodel'* +'keywordprg' ../../plugins/vimdoc-ja/doc/options.jax /*'keywordprg'* +'km' ../../plugins/vimdoc-ja/doc/options.jax /*'km'* +'kmp' ../../plugins/vimdoc-ja/doc/options.jax /*'kmp'* +'kp' ../../plugins/vimdoc-ja/doc/options.jax /*'kp'* +'langmap' ../../plugins/vimdoc-ja/doc/options.jax /*'langmap'* +'langmenu' ../../plugins/vimdoc-ja/doc/options.jax /*'langmenu'* +'langnoremap' ../../plugins/vimdoc-ja/doc/options.jax /*'langnoremap'* +'langremap' ../../plugins/vimdoc-ja/doc/options.jax /*'langremap'* +'laststatus' ../../plugins/vimdoc-ja/doc/options.jax /*'laststatus'* +'lazyredraw' ../../plugins/vimdoc-ja/doc/options.jax /*'lazyredraw'* +'lbr' ../../plugins/vimdoc-ja/doc/options.jax /*'lbr'* +'lcs' ../../plugins/vimdoc-ja/doc/options.jax /*'lcs'* +'linebreak' ../../plugins/vimdoc-ja/doc/options.jax /*'linebreak'* +'lines' ../../plugins/vimdoc-ja/doc/options.jax /*'lines'* +'linespace' ../../plugins/vimdoc-ja/doc/options.jax /*'linespace'* +'lisp' ../../plugins/vimdoc-ja/doc/options.jax /*'lisp'* +'lispwords' ../../plugins/vimdoc-ja/doc/options.jax /*'lispwords'* +'list' ../../plugins/vimdoc-ja/doc/options.jax /*'list'* +'listchars' ../../plugins/vimdoc-ja/doc/options.jax /*'listchars'* +'lm' ../../plugins/vimdoc-ja/doc/options.jax /*'lm'* +'lmap' ../../plugins/vimdoc-ja/doc/options.jax /*'lmap'* +'lnr' ../../plugins/vimdoc-ja/doc/options.jax /*'lnr'* +'loadplugins' ../../plugins/vimdoc-ja/doc/options.jax /*'loadplugins'* +'lpl' ../../plugins/vimdoc-ja/doc/options.jax /*'lpl'* +'lrm' ../../plugins/vimdoc-ja/doc/options.jax /*'lrm'* +'ls' ../../plugins/vimdoc-ja/doc/options.jax /*'ls'* +'lsp' ../../plugins/vimdoc-ja/doc/options.jax /*'lsp'* +'luadll' ../../plugins/vimdoc-ja/doc/options.jax /*'luadll'* +'lw' ../../plugins/vimdoc-ja/doc/options.jax /*'lw'* +'lz' ../../plugins/vimdoc-ja/doc/options.jax /*'lz'* +'ma' ../../plugins/vimdoc-ja/doc/options.jax /*'ma'* +'macatsui' ../../plugins/vimdoc-ja/doc/options.jax /*'macatsui'* +'magic' ../../plugins/vimdoc-ja/doc/options.jax /*'magic'* +'makeef' ../../plugins/vimdoc-ja/doc/options.jax /*'makeef'* +'makeprg' ../../plugins/vimdoc-ja/doc/options.jax /*'makeprg'* +'mat' ../../plugins/vimdoc-ja/doc/options.jax /*'mat'* +'matchpairs' ../../plugins/vimdoc-ja/doc/options.jax /*'matchpairs'* +'matchtime' ../../plugins/vimdoc-ja/doc/options.jax /*'matchtime'* +'maxcombine' ../../plugins/vimdoc-ja/doc/options.jax /*'maxcombine'* +'maxfuncdepth' ../../plugins/vimdoc-ja/doc/options.jax /*'maxfuncdepth'* +'maxmapdepth' ../../plugins/vimdoc-ja/doc/options.jax /*'maxmapdepth'* +'maxmem' ../../plugins/vimdoc-ja/doc/options.jax /*'maxmem'* +'maxmempattern' ../../plugins/vimdoc-ja/doc/options.jax /*'maxmempattern'* +'maxmemtot' ../../plugins/vimdoc-ja/doc/options.jax /*'maxmemtot'* +'mco' ../../plugins/vimdoc-ja/doc/options.jax /*'mco'* +'mef' ../../plugins/vimdoc-ja/doc/options.jax /*'mef'* +'menuitems' ../../plugins/vimdoc-ja/doc/options.jax /*'menuitems'* +'mesg' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'mesg'* +'mfd' ../../plugins/vimdoc-ja/doc/options.jax /*'mfd'* +'mh' ../../plugins/vimdoc-ja/doc/options.jax /*'mh'* +'mis' ../../plugins/vimdoc-ja/doc/options.jax /*'mis'* +'mkspellmem' ../../plugins/vimdoc-ja/doc/options.jax /*'mkspellmem'* +'ml' ../../plugins/vimdoc-ja/doc/options.jax /*'ml'* +'mls' ../../plugins/vimdoc-ja/doc/options.jax /*'mls'* +'mm' ../../plugins/vimdoc-ja/doc/options.jax /*'mm'* +'mmd' ../../plugins/vimdoc-ja/doc/options.jax /*'mmd'* +'mmp' ../../plugins/vimdoc-ja/doc/options.jax /*'mmp'* +'mmt' ../../plugins/vimdoc-ja/doc/options.jax /*'mmt'* +'mod' ../../plugins/vimdoc-ja/doc/options.jax /*'mod'* +'modeline' ../../plugins/vimdoc-ja/doc/options.jax /*'modeline'* +'modelines' ../../plugins/vimdoc-ja/doc/options.jax /*'modelines'* +'modifiable' ../../plugins/vimdoc-ja/doc/options.jax /*'modifiable'* +'modified' ../../plugins/vimdoc-ja/doc/options.jax /*'modified'* +'more' ../../plugins/vimdoc-ja/doc/options.jax /*'more'* +'mouse' ../../plugins/vimdoc-ja/doc/options.jax /*'mouse'* +'mousef' ../../plugins/vimdoc-ja/doc/options.jax /*'mousef'* +'mousefocus' ../../plugins/vimdoc-ja/doc/options.jax /*'mousefocus'* +'mousehide' ../../plugins/vimdoc-ja/doc/options.jax /*'mousehide'* +'mousem' ../../plugins/vimdoc-ja/doc/options.jax /*'mousem'* +'mousemodel' ../../plugins/vimdoc-ja/doc/options.jax /*'mousemodel'* +'mouses' ../../plugins/vimdoc-ja/doc/options.jax /*'mouses'* +'mouseshape' ../../plugins/vimdoc-ja/doc/options.jax /*'mouseshape'* +'mouset' ../../plugins/vimdoc-ja/doc/options.jax /*'mouset'* +'mousetime' ../../plugins/vimdoc-ja/doc/options.jax /*'mousetime'* +'mp' ../../plugins/vimdoc-ja/doc/options.jax /*'mp'* +'mps' ../../plugins/vimdoc-ja/doc/options.jax /*'mps'* +'msm' ../../plugins/vimdoc-ja/doc/options.jax /*'msm'* +'mzq' ../../plugins/vimdoc-ja/doc/options.jax /*'mzq'* +'mzquantum' ../../plugins/vimdoc-ja/doc/options.jax /*'mzquantum'* +'nf' ../../plugins/vimdoc-ja/doc/options.jax /*'nf'* +'noacd' ../../plugins/vimdoc-ja/doc/options.jax /*'noacd'* +'noai' ../../plugins/vimdoc-ja/doc/options.jax /*'noai'* +'noakm' ../../plugins/vimdoc-ja/doc/options.jax /*'noakm'* +'noallowrevins' ../../plugins/vimdoc-ja/doc/options.jax /*'noallowrevins'* +'noaltkeymap' ../../plugins/vimdoc-ja/doc/options.jax /*'noaltkeymap'* +'noanti' ../../plugins/vimdoc-ja/doc/options.jax /*'noanti'* +'noantialias' ../../plugins/vimdoc-ja/doc/options.jax /*'noantialias'* +'noar' ../../plugins/vimdoc-ja/doc/options.jax /*'noar'* +'noarab' ../../plugins/vimdoc-ja/doc/options.jax /*'noarab'* +'noarabic' ../../plugins/vimdoc-ja/doc/options.jax /*'noarabic'* +'noarabicshape' ../../plugins/vimdoc-ja/doc/options.jax /*'noarabicshape'* +'noari' ../../plugins/vimdoc-ja/doc/options.jax /*'noari'* +'noarshape' ../../plugins/vimdoc-ja/doc/options.jax /*'noarshape'* +'noautochdir' ../../plugins/vimdoc-ja/doc/options.jax /*'noautochdir'* +'noautoindent' ../../plugins/vimdoc-ja/doc/options.jax /*'noautoindent'* +'noautoread' ../../plugins/vimdoc-ja/doc/options.jax /*'noautoread'* +'noautowrite' ../../plugins/vimdoc-ja/doc/options.jax /*'noautowrite'* +'noautowriteall' ../../plugins/vimdoc-ja/doc/options.jax /*'noautowriteall'* +'noaw' ../../plugins/vimdoc-ja/doc/options.jax /*'noaw'* +'noawa' ../../plugins/vimdoc-ja/doc/options.jax /*'noawa'* +'nobackup' ../../plugins/vimdoc-ja/doc/options.jax /*'nobackup'* +'noballooneval' ../../plugins/vimdoc-ja/doc/options.jax /*'noballooneval'* +'nobeval' ../../plugins/vimdoc-ja/doc/options.jax /*'nobeval'* +'nobin' ../../plugins/vimdoc-ja/doc/options.jax /*'nobin'* +'nobinary' ../../plugins/vimdoc-ja/doc/options.jax /*'nobinary'* +'nobiosk' ../../plugins/vimdoc-ja/doc/options.jax /*'nobiosk'* +'nobioskey' ../../plugins/vimdoc-ja/doc/options.jax /*'nobioskey'* +'nobk' ../../plugins/vimdoc-ja/doc/options.jax /*'nobk'* +'nobl' ../../plugins/vimdoc-ja/doc/options.jax /*'nobl'* +'nobomb' ../../plugins/vimdoc-ja/doc/options.jax /*'nobomb'* +'nobreakindent' ../../plugins/vimdoc-ja/doc/options.jax /*'nobreakindent'* +'nobri' ../../plugins/vimdoc-ja/doc/options.jax /*'nobri'* +'nobuflisted' ../../plugins/vimdoc-ja/doc/options.jax /*'nobuflisted'* +'nocf' ../../plugins/vimdoc-ja/doc/options.jax /*'nocf'* +'noci' ../../plugins/vimdoc-ja/doc/options.jax /*'noci'* +'nocin' ../../plugins/vimdoc-ja/doc/options.jax /*'nocin'* +'nocindent' ../../plugins/vimdoc-ja/doc/options.jax /*'nocindent'* +'nocompatible' ../../plugins/vimdoc-ja/doc/options.jax /*'nocompatible'* +'noconfirm' ../../plugins/vimdoc-ja/doc/options.jax /*'noconfirm'* +'noconsk' ../../plugins/vimdoc-ja/doc/options.jax /*'noconsk'* +'noconskey' ../../plugins/vimdoc-ja/doc/options.jax /*'noconskey'* +'nocopyindent' ../../plugins/vimdoc-ja/doc/options.jax /*'nocopyindent'* +'nocp' ../../plugins/vimdoc-ja/doc/options.jax /*'nocp'* +'nocrb' ../../plugins/vimdoc-ja/doc/options.jax /*'nocrb'* +'nocscoperelative' ../../plugins/vimdoc-ja/doc/options.jax /*'nocscoperelative'* +'nocscopetag' ../../plugins/vimdoc-ja/doc/options.jax /*'nocscopetag'* +'nocscopeverbose' ../../plugins/vimdoc-ja/doc/options.jax /*'nocscopeverbose'* +'nocsre' ../../plugins/vimdoc-ja/doc/options.jax /*'nocsre'* +'nocst' ../../plugins/vimdoc-ja/doc/options.jax /*'nocst'* +'nocsverb' ../../plugins/vimdoc-ja/doc/options.jax /*'nocsverb'* +'nocuc' ../../plugins/vimdoc-ja/doc/options.jax /*'nocuc'* +'nocul' ../../plugins/vimdoc-ja/doc/options.jax /*'nocul'* +'nocursorbind' ../../plugins/vimdoc-ja/doc/options.jax /*'nocursorbind'* +'nocursorcolumn' ../../plugins/vimdoc-ja/doc/options.jax /*'nocursorcolumn'* +'nocursorline' ../../plugins/vimdoc-ja/doc/options.jax /*'nocursorline'* +'nodeco' ../../plugins/vimdoc-ja/doc/options.jax /*'nodeco'* +'nodelcombine' ../../plugins/vimdoc-ja/doc/options.jax /*'nodelcombine'* +'nodg' ../../plugins/vimdoc-ja/doc/options.jax /*'nodg'* +'nodiff' ../../plugins/vimdoc-ja/doc/options.jax /*'nodiff'* +'nodigraph' ../../plugins/vimdoc-ja/doc/options.jax /*'nodigraph'* +'noea' ../../plugins/vimdoc-ja/doc/options.jax /*'noea'* +'noeb' ../../plugins/vimdoc-ja/doc/options.jax /*'noeb'* +'noed' ../../plugins/vimdoc-ja/doc/options.jax /*'noed'* +'noedcompatible' ../../plugins/vimdoc-ja/doc/options.jax /*'noedcompatible'* +'noek' ../../plugins/vimdoc-ja/doc/options.jax /*'noek'* +'noemo' ../../plugins/vimdoc-ja/doc/options.jax /*'noemo'* +'noemoji' ../../plugins/vimdoc-ja/doc/options.jax /*'noemoji'* +'noendofline' ../../plugins/vimdoc-ja/doc/options.jax /*'noendofline'* +'noeol' ../../plugins/vimdoc-ja/doc/options.jax /*'noeol'* +'noequalalways' ../../plugins/vimdoc-ja/doc/options.jax /*'noequalalways'* +'noerrorbells' ../../plugins/vimdoc-ja/doc/options.jax /*'noerrorbells'* +'noesckeys' ../../plugins/vimdoc-ja/doc/options.jax /*'noesckeys'* +'noet' ../../plugins/vimdoc-ja/doc/options.jax /*'noet'* +'noex' ../../plugins/vimdoc-ja/doc/options.jax /*'noex'* +'noexpandtab' ../../plugins/vimdoc-ja/doc/options.jax /*'noexpandtab'* +'noexrc' ../../plugins/vimdoc-ja/doc/options.jax /*'noexrc'* +'nofen' ../../plugins/vimdoc-ja/doc/options.jax /*'nofen'* +'nofic' ../../plugins/vimdoc-ja/doc/options.jax /*'nofic'* +'nofileignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'nofileignorecase'* +'nofixendofline' ../../plugins/vimdoc-ja/doc/options.jax /*'nofixendofline'* +'nofixeol' ../../plugins/vimdoc-ja/doc/options.jax /*'nofixeol'* +'nofk' ../../plugins/vimdoc-ja/doc/options.jax /*'nofk'* +'nofkmap' ../../plugins/vimdoc-ja/doc/options.jax /*'nofkmap'* +'nofoldenable' ../../plugins/vimdoc-ja/doc/options.jax /*'nofoldenable'* +'nofs' ../../plugins/vimdoc-ja/doc/options.jax /*'nofs'* +'nofsync' ../../plugins/vimdoc-ja/doc/options.jax /*'nofsync'* +'nogd' ../../plugins/vimdoc-ja/doc/options.jax /*'nogd'* +'nogdefault' ../../plugins/vimdoc-ja/doc/options.jax /*'nogdefault'* +'noguipty' ../../plugins/vimdoc-ja/doc/options.jax /*'noguipty'* +'nohid' ../../plugins/vimdoc-ja/doc/options.jax /*'nohid'* +'nohidden' ../../plugins/vimdoc-ja/doc/options.jax /*'nohidden'* +'nohk' ../../plugins/vimdoc-ja/doc/options.jax /*'nohk'* +'nohkmap' ../../plugins/vimdoc-ja/doc/options.jax /*'nohkmap'* +'nohkmapp' ../../plugins/vimdoc-ja/doc/options.jax /*'nohkmapp'* +'nohkp' ../../plugins/vimdoc-ja/doc/options.jax /*'nohkp'* +'nohls' ../../plugins/vimdoc-ja/doc/options.jax /*'nohls'* +'nohlsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'nohlsearch'* +'noic' ../../plugins/vimdoc-ja/doc/options.jax /*'noic'* +'noicon' ../../plugins/vimdoc-ja/doc/options.jax /*'noicon'* +'noignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'noignorecase'* +'noim' ../../plugins/vimdoc-ja/doc/options.jax /*'noim'* +'noimc' ../../plugins/vimdoc-ja/doc/options.jax /*'noimc'* +'noimcmdline' ../../plugins/vimdoc-ja/doc/options.jax /*'noimcmdline'* +'noimd' ../../plugins/vimdoc-ja/doc/options.jax /*'noimd'* +'noimdisable' ../../plugins/vimdoc-ja/doc/options.jax /*'noimdisable'* +'noincsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'noincsearch'* +'noinf' ../../plugins/vimdoc-ja/doc/options.jax /*'noinf'* +'noinfercase' ../../plugins/vimdoc-ja/doc/options.jax /*'noinfercase'* +'noinsertmode' ../../plugins/vimdoc-ja/doc/options.jax /*'noinsertmode'* +'nois' ../../plugins/vimdoc-ja/doc/options.jax /*'nois'* +'nojoinspaces' ../../plugins/vimdoc-ja/doc/options.jax /*'nojoinspaces'* +'nojs' ../../plugins/vimdoc-ja/doc/options.jax /*'nojs'* +'nolangnoremap' ../../plugins/vimdoc-ja/doc/options.jax /*'nolangnoremap'* +'nolangremap' ../../plugins/vimdoc-ja/doc/options.jax /*'nolangremap'* +'nolazyredraw' ../../plugins/vimdoc-ja/doc/options.jax /*'nolazyredraw'* +'nolbr' ../../plugins/vimdoc-ja/doc/options.jax /*'nolbr'* +'nolinebreak' ../../plugins/vimdoc-ja/doc/options.jax /*'nolinebreak'* +'nolisp' ../../plugins/vimdoc-ja/doc/options.jax /*'nolisp'* +'nolist' ../../plugins/vimdoc-ja/doc/options.jax /*'nolist'* +'nolnr' ../../plugins/vimdoc-ja/doc/options.jax /*'nolnr'* +'noloadplugins' ../../plugins/vimdoc-ja/doc/options.jax /*'noloadplugins'* +'nolpl' ../../plugins/vimdoc-ja/doc/options.jax /*'nolpl'* +'nolrm' ../../plugins/vimdoc-ja/doc/options.jax /*'nolrm'* +'nolz' ../../plugins/vimdoc-ja/doc/options.jax /*'nolz'* +'noma' ../../plugins/vimdoc-ja/doc/options.jax /*'noma'* +'nomacatsui' ../../plugins/vimdoc-ja/doc/options.jax /*'nomacatsui'* +'nomagic' ../../plugins/vimdoc-ja/doc/options.jax /*'nomagic'* +'nomh' ../../plugins/vimdoc-ja/doc/options.jax /*'nomh'* +'noml' ../../plugins/vimdoc-ja/doc/options.jax /*'noml'* +'nomod' ../../plugins/vimdoc-ja/doc/options.jax /*'nomod'* +'nomodeline' ../../plugins/vimdoc-ja/doc/options.jax /*'nomodeline'* +'nomodifiable' ../../plugins/vimdoc-ja/doc/options.jax /*'nomodifiable'* +'nomodified' ../../plugins/vimdoc-ja/doc/options.jax /*'nomodified'* +'nomore' ../../plugins/vimdoc-ja/doc/options.jax /*'nomore'* +'nomousef' ../../plugins/vimdoc-ja/doc/options.jax /*'nomousef'* +'nomousefocus' ../../plugins/vimdoc-ja/doc/options.jax /*'nomousefocus'* +'nomousehide' ../../plugins/vimdoc-ja/doc/options.jax /*'nomousehide'* +'nonu' ../../plugins/vimdoc-ja/doc/options.jax /*'nonu'* +'nonumber' ../../plugins/vimdoc-ja/doc/options.jax /*'nonumber'* +'noodev' ../../plugins/vimdoc-ja/doc/options.jax /*'noodev'* +'noopendevice' ../../plugins/vimdoc-ja/doc/options.jax /*'noopendevice'* +'nopaste' ../../plugins/vimdoc-ja/doc/options.jax /*'nopaste'* +'nopi' ../../plugins/vimdoc-ja/doc/options.jax /*'nopi'* +'nopreserveindent' ../../plugins/vimdoc-ja/doc/options.jax /*'nopreserveindent'* +'nopreviewwindow' ../../plugins/vimdoc-ja/doc/options.jax /*'nopreviewwindow'* +'noprompt' ../../plugins/vimdoc-ja/doc/options.jax /*'noprompt'* +'nopvw' ../../plugins/vimdoc-ja/doc/options.jax /*'nopvw'* +'noreadonly' ../../plugins/vimdoc-ja/doc/options.jax /*'noreadonly'* +'norelativenumber' ../../plugins/vimdoc-ja/doc/options.jax /*'norelativenumber'* +'noremap' ../../plugins/vimdoc-ja/doc/options.jax /*'noremap'* +'norestorescreen' ../../plugins/vimdoc-ja/doc/options.jax /*'norestorescreen'* +'norevins' ../../plugins/vimdoc-ja/doc/options.jax /*'norevins'* +'nori' ../../plugins/vimdoc-ja/doc/options.jax /*'nori'* +'norightleft' ../../plugins/vimdoc-ja/doc/options.jax /*'norightleft'* +'norl' ../../plugins/vimdoc-ja/doc/options.jax /*'norl'* +'nornu' ../../plugins/vimdoc-ja/doc/options.jax /*'nornu'* +'noro' ../../plugins/vimdoc-ja/doc/options.jax /*'noro'* +'nors' ../../plugins/vimdoc-ja/doc/options.jax /*'nors'* +'noru' ../../plugins/vimdoc-ja/doc/options.jax /*'noru'* +'noruler' ../../plugins/vimdoc-ja/doc/options.jax /*'noruler'* +'nosb' ../../plugins/vimdoc-ja/doc/options.jax /*'nosb'* +'nosc' ../../plugins/vimdoc-ja/doc/options.jax /*'nosc'* +'noscb' ../../plugins/vimdoc-ja/doc/options.jax /*'noscb'* +'noscrollbind' ../../plugins/vimdoc-ja/doc/options.jax /*'noscrollbind'* +'noscs' ../../plugins/vimdoc-ja/doc/options.jax /*'noscs'* +'nosecure' ../../plugins/vimdoc-ja/doc/options.jax /*'nosecure'* +'nosft' ../../plugins/vimdoc-ja/doc/options.jax /*'nosft'* +'noshellslash' ../../plugins/vimdoc-ja/doc/options.jax /*'noshellslash'* +'noshelltemp' ../../plugins/vimdoc-ja/doc/options.jax /*'noshelltemp'* +'noshiftround' ../../plugins/vimdoc-ja/doc/options.jax /*'noshiftround'* +'noshortname' ../../plugins/vimdoc-ja/doc/options.jax /*'noshortname'* +'noshowcmd' ../../plugins/vimdoc-ja/doc/options.jax /*'noshowcmd'* +'noshowfulltag' ../../plugins/vimdoc-ja/doc/options.jax /*'noshowfulltag'* +'noshowmatch' ../../plugins/vimdoc-ja/doc/options.jax /*'noshowmatch'* +'noshowmode' ../../plugins/vimdoc-ja/doc/options.jax /*'noshowmode'* +'nosi' ../../plugins/vimdoc-ja/doc/options.jax /*'nosi'* +'nosm' ../../plugins/vimdoc-ja/doc/options.jax /*'nosm'* +'nosmartcase' ../../plugins/vimdoc-ja/doc/options.jax /*'nosmartcase'* +'nosmartindent' ../../plugins/vimdoc-ja/doc/options.jax /*'nosmartindent'* +'nosmarttab' ../../plugins/vimdoc-ja/doc/options.jax /*'nosmarttab'* +'nosmd' ../../plugins/vimdoc-ja/doc/options.jax /*'nosmd'* +'nosn' ../../plugins/vimdoc-ja/doc/options.jax /*'nosn'* +'nosol' ../../plugins/vimdoc-ja/doc/options.jax /*'nosol'* +'nospell' ../../plugins/vimdoc-ja/doc/options.jax /*'nospell'* +'nosplitbelow' ../../plugins/vimdoc-ja/doc/options.jax /*'nosplitbelow'* +'nosplitright' ../../plugins/vimdoc-ja/doc/options.jax /*'nosplitright'* +'nospr' ../../plugins/vimdoc-ja/doc/options.jax /*'nospr'* +'nosr' ../../plugins/vimdoc-ja/doc/options.jax /*'nosr'* +'nossl' ../../plugins/vimdoc-ja/doc/options.jax /*'nossl'* +'nosta' ../../plugins/vimdoc-ja/doc/options.jax /*'nosta'* +'nostartofline' ../../plugins/vimdoc-ja/doc/options.jax /*'nostartofline'* +'nostmp' ../../plugins/vimdoc-ja/doc/options.jax /*'nostmp'* +'noswapfile' ../../plugins/vimdoc-ja/doc/options.jax /*'noswapfile'* +'noswf' ../../plugins/vimdoc-ja/doc/options.jax /*'noswf'* +'nota' ../../plugins/vimdoc-ja/doc/options.jax /*'nota'* +'notagbsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'notagbsearch'* +'notagrelative' ../../plugins/vimdoc-ja/doc/options.jax /*'notagrelative'* +'notagstack' ../../plugins/vimdoc-ja/doc/options.jax /*'notagstack'* +'notbi' ../../plugins/vimdoc-ja/doc/options.jax /*'notbi'* +'notbidi' ../../plugins/vimdoc-ja/doc/options.jax /*'notbidi'* +'notbs' ../../plugins/vimdoc-ja/doc/options.jax /*'notbs'* +'notermbidi' ../../plugins/vimdoc-ja/doc/options.jax /*'notermbidi'* +'noterse' ../../plugins/vimdoc-ja/doc/options.jax /*'noterse'* +'notextauto' ../../plugins/vimdoc-ja/doc/options.jax /*'notextauto'* +'notextmode' ../../plugins/vimdoc-ja/doc/options.jax /*'notextmode'* +'notf' ../../plugins/vimdoc-ja/doc/options.jax /*'notf'* +'notgst' ../../plugins/vimdoc-ja/doc/options.jax /*'notgst'* +'notildeop' ../../plugins/vimdoc-ja/doc/options.jax /*'notildeop'* +'notimeout' ../../plugins/vimdoc-ja/doc/options.jax /*'notimeout'* +'notitle' ../../plugins/vimdoc-ja/doc/options.jax /*'notitle'* +'noto' ../../plugins/vimdoc-ja/doc/options.jax /*'noto'* +'notop' ../../plugins/vimdoc-ja/doc/options.jax /*'notop'* +'notr' ../../plugins/vimdoc-ja/doc/options.jax /*'notr'* +'nottimeout' ../../plugins/vimdoc-ja/doc/options.jax /*'nottimeout'* +'nottybuiltin' ../../plugins/vimdoc-ja/doc/options.jax /*'nottybuiltin'* +'nottyfast' ../../plugins/vimdoc-ja/doc/options.jax /*'nottyfast'* +'notx' ../../plugins/vimdoc-ja/doc/options.jax /*'notx'* +'noudf' ../../plugins/vimdoc-ja/doc/options.jax /*'noudf'* +'noundofile' ../../plugins/vimdoc-ja/doc/options.jax /*'noundofile'* +'novb' ../../plugins/vimdoc-ja/doc/options.jax /*'novb'* +'novice' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'novice'* +'novisualbell' ../../plugins/vimdoc-ja/doc/options.jax /*'novisualbell'* +'nowa' ../../plugins/vimdoc-ja/doc/options.jax /*'nowa'* +'nowarn' ../../plugins/vimdoc-ja/doc/options.jax /*'nowarn'* +'nowb' ../../plugins/vimdoc-ja/doc/options.jax /*'nowb'* +'noweirdinvert' ../../plugins/vimdoc-ja/doc/options.jax /*'noweirdinvert'* +'nowfh' ../../plugins/vimdoc-ja/doc/options.jax /*'nowfh'* +'nowfw' ../../plugins/vimdoc-ja/doc/options.jax /*'nowfw'* +'nowic' ../../plugins/vimdoc-ja/doc/options.jax /*'nowic'* +'nowildignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'nowildignorecase'* +'nowildmenu' ../../plugins/vimdoc-ja/doc/options.jax /*'nowildmenu'* +'nowinfixheight' ../../plugins/vimdoc-ja/doc/options.jax /*'nowinfixheight'* +'nowinfixwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'nowinfixwidth'* +'nowiv' ../../plugins/vimdoc-ja/doc/options.jax /*'nowiv'* +'nowmnu' ../../plugins/vimdoc-ja/doc/options.jax /*'nowmnu'* +'nowrap' ../../plugins/vimdoc-ja/doc/options.jax /*'nowrap'* +'nowrapscan' ../../plugins/vimdoc-ja/doc/options.jax /*'nowrapscan'* +'nowrite' ../../plugins/vimdoc-ja/doc/options.jax /*'nowrite'* +'nowriteany' ../../plugins/vimdoc-ja/doc/options.jax /*'nowriteany'* +'nowritebackup' ../../plugins/vimdoc-ja/doc/options.jax /*'nowritebackup'* +'nows' ../../plugins/vimdoc-ja/doc/options.jax /*'nows'* +'nrformats' ../../plugins/vimdoc-ja/doc/options.jax /*'nrformats'* +'nu' ../../plugins/vimdoc-ja/doc/options.jax /*'nu'* +'number' ../../plugins/vimdoc-ja/doc/options.jax /*'number'* +'numberwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'numberwidth'* +'nuw' ../../plugins/vimdoc-ja/doc/options.jax /*'nuw'* +'odev' ../../plugins/vimdoc-ja/doc/options.jax /*'odev'* +'oft' ../../plugins/vimdoc-ja/doc/options.jax /*'oft'* +'ofu' ../../plugins/vimdoc-ja/doc/options.jax /*'ofu'* +'omnifunc' ../../plugins/vimdoc-ja/doc/options.jax /*'omnifunc'* +'op' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'op'* +'open' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'open'* +'opendevice' ../../plugins/vimdoc-ja/doc/options.jax /*'opendevice'* +'operatorfunc' ../../plugins/vimdoc-ja/doc/options.jax /*'operatorfunc'* +'opfunc' ../../plugins/vimdoc-ja/doc/options.jax /*'opfunc'* +'optimize' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'optimize'* +'option' ../../plugins/vimdoc-ja/doc/intro.jax /*'option'* +'osfiletype' ../../plugins/vimdoc-ja/doc/options.jax /*'osfiletype'* +'pa' ../../plugins/vimdoc-ja/doc/options.jax /*'pa'* +'packpath' ../../plugins/vimdoc-ja/doc/options.jax /*'packpath'* +'para' ../../plugins/vimdoc-ja/doc/options.jax /*'para'* +'paragraphs' ../../plugins/vimdoc-ja/doc/options.jax /*'paragraphs'* +'paste' ../../plugins/vimdoc-ja/doc/options.jax /*'paste'* +'pastetoggle' ../../plugins/vimdoc-ja/doc/options.jax /*'pastetoggle'* +'patchexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'patchexpr'* +'patchmode' ../../plugins/vimdoc-ja/doc/options.jax /*'patchmode'* +'path' ../../plugins/vimdoc-ja/doc/options.jax /*'path'* +'pdev' ../../plugins/vimdoc-ja/doc/options.jax /*'pdev'* +'penc' ../../plugins/vimdoc-ja/doc/options.jax /*'penc'* +'perldll' ../../plugins/vimdoc-ja/doc/options.jax /*'perldll'* +'pex' ../../plugins/vimdoc-ja/doc/options.jax /*'pex'* +'pexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'pexpr'* +'pfn' ../../plugins/vimdoc-ja/doc/options.jax /*'pfn'* +'ph' ../../plugins/vimdoc-ja/doc/options.jax /*'ph'* +'pheader' ../../plugins/vimdoc-ja/doc/options.jax /*'pheader'* +'pi' ../../plugins/vimdoc-ja/doc/options.jax /*'pi'* +'pm' ../../plugins/vimdoc-ja/doc/options.jax /*'pm'* +'pmbcs' ../../plugins/vimdoc-ja/doc/options.jax /*'pmbcs'* +'pmbfn' ../../plugins/vimdoc-ja/doc/options.jax /*'pmbfn'* +'popt' ../../plugins/vimdoc-ja/doc/options.jax /*'popt'* +'pp' ../../plugins/vimdoc-ja/doc/options.jax /*'pp'* +'preserveindent' ../../plugins/vimdoc-ja/doc/options.jax /*'preserveindent'* +'previewheight' ../../plugins/vimdoc-ja/doc/options.jax /*'previewheight'* +'previewwindow' ../../plugins/vimdoc-ja/doc/options.jax /*'previewwindow'* +'printdevice' ../../plugins/vimdoc-ja/doc/options.jax /*'printdevice'* +'printencoding' ../../plugins/vimdoc-ja/doc/options.jax /*'printencoding'* +'printexpr' ../../plugins/vimdoc-ja/doc/options.jax /*'printexpr'* +'printfont' ../../plugins/vimdoc-ja/doc/options.jax /*'printfont'* +'printheader' ../../plugins/vimdoc-ja/doc/options.jax /*'printheader'* +'printmbcharset' ../../plugins/vimdoc-ja/doc/options.jax /*'printmbcharset'* +'printmbfont' ../../plugins/vimdoc-ja/doc/options.jax /*'printmbfont'* +'printoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'printoptions'* +'prompt' ../../plugins/vimdoc-ja/doc/options.jax /*'prompt'* +'pt' ../../plugins/vimdoc-ja/doc/options.jax /*'pt'* +'pumheight' ../../plugins/vimdoc-ja/doc/options.jax /*'pumheight'* +'pvh' ../../plugins/vimdoc-ja/doc/options.jax /*'pvh'* +'pvw' ../../plugins/vimdoc-ja/doc/options.jax /*'pvw'* +'pythondll' ../../plugins/vimdoc-ja/doc/options.jax /*'pythondll'* +'pythonthreedll' ../../plugins/vimdoc-ja/doc/options.jax /*'pythonthreedll'* +'qe' ../../plugins/vimdoc-ja/doc/options.jax /*'qe'* +'quote ../../plugins/vimdoc-ja/doc/motion.jax /*'quote* +'quoteescape' ../../plugins/vimdoc-ja/doc/options.jax /*'quoteescape'* +'rdt' ../../plugins/vimdoc-ja/doc/options.jax /*'rdt'* +'re' ../../plugins/vimdoc-ja/doc/options.jax /*'re'* +'readonly' ../../plugins/vimdoc-ja/doc/options.jax /*'readonly'* +'redraw' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'redraw'* +'redrawtime' ../../plugins/vimdoc-ja/doc/options.jax /*'redrawtime'* +'regexpengine' ../../plugins/vimdoc-ja/doc/options.jax /*'regexpengine'* +'relativenumber' ../../plugins/vimdoc-ja/doc/options.jax /*'relativenumber'* +'remap' ../../plugins/vimdoc-ja/doc/options.jax /*'remap'* +'renderoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'renderoptions'* +'report' ../../plugins/vimdoc-ja/doc/options.jax /*'report'* +'restorescreen' ../../plugins/vimdoc-ja/doc/options.jax /*'restorescreen'* +'revins' ../../plugins/vimdoc-ja/doc/options.jax /*'revins'* +'ri' ../../plugins/vimdoc-ja/doc/options.jax /*'ri'* +'rightleft' ../../plugins/vimdoc-ja/doc/options.jax /*'rightleft'* +'rightleftcmd' ../../plugins/vimdoc-ja/doc/options.jax /*'rightleftcmd'* +'rl' ../../plugins/vimdoc-ja/doc/options.jax /*'rl'* +'rlc' ../../plugins/vimdoc-ja/doc/options.jax /*'rlc'* +'rnu' ../../plugins/vimdoc-ja/doc/options.jax /*'rnu'* +'ro' ../../plugins/vimdoc-ja/doc/options.jax /*'ro'* +'rop' ../../plugins/vimdoc-ja/doc/options.jax /*'rop'* +'rs' ../../plugins/vimdoc-ja/doc/options.jax /*'rs'* +'rtp' ../../plugins/vimdoc-ja/doc/options.jax /*'rtp'* +'ru' ../../plugins/vimdoc-ja/doc/options.jax /*'ru'* +'rubydll' ../../plugins/vimdoc-ja/doc/options.jax /*'rubydll'* +'ruf' ../../plugins/vimdoc-ja/doc/options.jax /*'ruf'* +'ruler' ../../plugins/vimdoc-ja/doc/options.jax /*'ruler'* +'rulerformat' ../../plugins/vimdoc-ja/doc/options.jax /*'rulerformat'* +'runtimepath' ../../plugins/vimdoc-ja/doc/options.jax /*'runtimepath'* +'sb' ../../plugins/vimdoc-ja/doc/options.jax /*'sb'* +'sbo' ../../plugins/vimdoc-ja/doc/options.jax /*'sbo'* +'sbr' ../../plugins/vimdoc-ja/doc/options.jax /*'sbr'* +'sc' ../../plugins/vimdoc-ja/doc/options.jax /*'sc'* +'scb' ../../plugins/vimdoc-ja/doc/options.jax /*'scb'* +'scl' ../../plugins/vimdoc-ja/doc/options.jax /*'scl'* +'scr' ../../plugins/vimdoc-ja/doc/options.jax /*'scr'* +'scroll' ../../plugins/vimdoc-ja/doc/options.jax /*'scroll'* +'scrollbind' ../../plugins/vimdoc-ja/doc/options.jax /*'scrollbind'* +'scrolljump' ../../plugins/vimdoc-ja/doc/options.jax /*'scrolljump'* +'scrolloff' ../../plugins/vimdoc-ja/doc/options.jax /*'scrolloff'* +'scrollopt' ../../plugins/vimdoc-ja/doc/options.jax /*'scrollopt'* +'scs' ../../plugins/vimdoc-ja/doc/options.jax /*'scs'* +'sect' ../../plugins/vimdoc-ja/doc/options.jax /*'sect'* +'sections' ../../plugins/vimdoc-ja/doc/options.jax /*'sections'* +'secure' ../../plugins/vimdoc-ja/doc/options.jax /*'secure'* +'sel' ../../plugins/vimdoc-ja/doc/options.jax /*'sel'* +'selection' ../../plugins/vimdoc-ja/doc/options.jax /*'selection'* +'selectmode' ../../plugins/vimdoc-ja/doc/options.jax /*'selectmode'* +'sessionoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'sessionoptions'* +'sft' ../../plugins/vimdoc-ja/doc/options.jax /*'sft'* +'sh' ../../plugins/vimdoc-ja/doc/options.jax /*'sh'* +'shcf' ../../plugins/vimdoc-ja/doc/options.jax /*'shcf'* +'shell' ../../plugins/vimdoc-ja/doc/options.jax /*'shell'* +'shellcmdflag' ../../plugins/vimdoc-ja/doc/options.jax /*'shellcmdflag'* +'shellpipe' ../../plugins/vimdoc-ja/doc/options.jax /*'shellpipe'* +'shellquote' ../../plugins/vimdoc-ja/doc/options.jax /*'shellquote'* +'shellredir' ../../plugins/vimdoc-ja/doc/options.jax /*'shellredir'* +'shellslash' ../../plugins/vimdoc-ja/doc/options.jax /*'shellslash'* +'shelltemp' ../../plugins/vimdoc-ja/doc/options.jax /*'shelltemp'* +'shelltype' ../../plugins/vimdoc-ja/doc/options.jax /*'shelltype'* +'shellxescape' ../../plugins/vimdoc-ja/doc/options.jax /*'shellxescape'* +'shellxquote' ../../plugins/vimdoc-ja/doc/options.jax /*'shellxquote'* +'shiftround' ../../plugins/vimdoc-ja/doc/options.jax /*'shiftround'* +'shiftwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'shiftwidth'* +'shm' ../../plugins/vimdoc-ja/doc/options.jax /*'shm'* +'shortmess' ../../plugins/vimdoc-ja/doc/options.jax /*'shortmess'* +'shortname' ../../plugins/vimdoc-ja/doc/options.jax /*'shortname'* +'showbreak' ../../plugins/vimdoc-ja/doc/options.jax /*'showbreak'* +'showcmd' ../../plugins/vimdoc-ja/doc/options.jax /*'showcmd'* +'showfulltag' ../../plugins/vimdoc-ja/doc/options.jax /*'showfulltag'* +'showmatch' ../../plugins/vimdoc-ja/doc/options.jax /*'showmatch'* +'showmode' ../../plugins/vimdoc-ja/doc/options.jax /*'showmode'* +'showtabline' ../../plugins/vimdoc-ja/doc/options.jax /*'showtabline'* +'shq' ../../plugins/vimdoc-ja/doc/options.jax /*'shq'* +'si' ../../plugins/vimdoc-ja/doc/options.jax /*'si'* +'sidescroll' ../../plugins/vimdoc-ja/doc/options.jax /*'sidescroll'* +'sidescrolloff' ../../plugins/vimdoc-ja/doc/options.jax /*'sidescrolloff'* +'signcolumn' ../../plugins/vimdoc-ja/doc/options.jax /*'signcolumn'* +'siso' ../../plugins/vimdoc-ja/doc/options.jax /*'siso'* +'sj' ../../plugins/vimdoc-ja/doc/options.jax /*'sj'* +'slm' ../../plugins/vimdoc-ja/doc/options.jax /*'slm'* +'slow' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'slow'* +'slowopen' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'slowopen'* +'sm' ../../plugins/vimdoc-ja/doc/options.jax /*'sm'* +'smartcase' ../../plugins/vimdoc-ja/doc/options.jax /*'smartcase'* +'smartindent' ../../plugins/vimdoc-ja/doc/options.jax /*'smartindent'* +'smarttab' ../../plugins/vimdoc-ja/doc/options.jax /*'smarttab'* +'smc' ../../plugins/vimdoc-ja/doc/options.jax /*'smc'* +'smd' ../../plugins/vimdoc-ja/doc/options.jax /*'smd'* +'sn' ../../plugins/vimdoc-ja/doc/options.jax /*'sn'* +'so' ../../plugins/vimdoc-ja/doc/options.jax /*'so'* +'softtabstop' ../../plugins/vimdoc-ja/doc/options.jax /*'softtabstop'* +'sol' ../../plugins/vimdoc-ja/doc/options.jax /*'sol'* +'sourceany' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'sourceany'* +'sp' ../../plugins/vimdoc-ja/doc/options.jax /*'sp'* +'spc' ../../plugins/vimdoc-ja/doc/options.jax /*'spc'* +'spell' ../../plugins/vimdoc-ja/doc/options.jax /*'spell'* +'spellcapcheck' ../../plugins/vimdoc-ja/doc/options.jax /*'spellcapcheck'* +'spellfile' ../../plugins/vimdoc-ja/doc/options.jax /*'spellfile'* +'spelllang' ../../plugins/vimdoc-ja/doc/options.jax /*'spelllang'* +'spellsuggest' ../../plugins/vimdoc-ja/doc/options.jax /*'spellsuggest'* +'spf' ../../plugins/vimdoc-ja/doc/options.jax /*'spf'* +'spl' ../../plugins/vimdoc-ja/doc/options.jax /*'spl'* +'splitbelow' ../../plugins/vimdoc-ja/doc/options.jax /*'splitbelow'* +'splitright' ../../plugins/vimdoc-ja/doc/options.jax /*'splitright'* +'spr' ../../plugins/vimdoc-ja/doc/options.jax /*'spr'* +'sps' ../../plugins/vimdoc-ja/doc/options.jax /*'sps'* +'sr' ../../plugins/vimdoc-ja/doc/options.jax /*'sr'* +'srr' ../../plugins/vimdoc-ja/doc/options.jax /*'srr'* +'ss' ../../plugins/vimdoc-ja/doc/options.jax /*'ss'* +'ssl' ../../plugins/vimdoc-ja/doc/options.jax /*'ssl'* +'ssop' ../../plugins/vimdoc-ja/doc/options.jax /*'ssop'* +'st' ../../plugins/vimdoc-ja/doc/options.jax /*'st'* +'sta' ../../plugins/vimdoc-ja/doc/options.jax /*'sta'* +'stal' ../../plugins/vimdoc-ja/doc/options.jax /*'stal'* +'startofline' ../../plugins/vimdoc-ja/doc/options.jax /*'startofline'* +'statusline' ../../plugins/vimdoc-ja/doc/options.jax /*'statusline'* +'stl' ../../plugins/vimdoc-ja/doc/options.jax /*'stl'* +'stmp' ../../plugins/vimdoc-ja/doc/options.jax /*'stmp'* +'sts' ../../plugins/vimdoc-ja/doc/options.jax /*'sts'* +'su' ../../plugins/vimdoc-ja/doc/options.jax /*'su'* +'sua' ../../plugins/vimdoc-ja/doc/options.jax /*'sua'* +'suffixes' ../../plugins/vimdoc-ja/doc/options.jax /*'suffixes'* +'suffixesadd' ../../plugins/vimdoc-ja/doc/options.jax /*'suffixesadd'* +'sw' ../../plugins/vimdoc-ja/doc/options.jax /*'sw'* +'swapfile' ../../plugins/vimdoc-ja/doc/options.jax /*'swapfile'* +'swapsync' ../../plugins/vimdoc-ja/doc/options.jax /*'swapsync'* +'swb' ../../plugins/vimdoc-ja/doc/options.jax /*'swb'* +'swf' ../../plugins/vimdoc-ja/doc/options.jax /*'swf'* +'switchbuf' ../../plugins/vimdoc-ja/doc/options.jax /*'switchbuf'* +'sws' ../../plugins/vimdoc-ja/doc/options.jax /*'sws'* +'sxe' ../../plugins/vimdoc-ja/doc/options.jax /*'sxe'* +'sxq' ../../plugins/vimdoc-ja/doc/options.jax /*'sxq'* +'syn' ../../plugins/vimdoc-ja/doc/options.jax /*'syn'* +'synmaxcol' ../../plugins/vimdoc-ja/doc/options.jax /*'synmaxcol'* +'syntax' ../../plugins/vimdoc-ja/doc/options.jax /*'syntax'* +'t_#2' ../../plugins/vimdoc-ja/doc/term.jax /*'t_#2'* +'t_#4' ../../plugins/vimdoc-ja/doc/term.jax /*'t_#4'* +'t_%1' ../../plugins/vimdoc-ja/doc/term.jax /*'t_%1'* +'t_%i' ../../plugins/vimdoc-ja/doc/term.jax /*'t_%i'* +'t_&8' ../../plugins/vimdoc-ja/doc/term.jax /*'t_&8'* +'t_8b' ../../plugins/vimdoc-ja/doc/term.jax /*'t_8b'* +'t_8f' ../../plugins/vimdoc-ja/doc/term.jax /*'t_8f'* +'t_@7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_@7'* +'t_AB' ../../plugins/vimdoc-ja/doc/term.jax /*'t_AB'* +'t_AF' ../../plugins/vimdoc-ja/doc/term.jax /*'t_AF'* +'t_AL' ../../plugins/vimdoc-ja/doc/term.jax /*'t_AL'* +'t_CS' ../../plugins/vimdoc-ja/doc/term.jax /*'t_CS'* +'t_CV' ../../plugins/vimdoc-ja/doc/term.jax /*'t_CV'* +'t_Ce' ../../plugins/vimdoc-ja/doc/term.jax /*'t_Ce'* +'t_Co' ../../plugins/vimdoc-ja/doc/term.jax /*'t_Co'* +'t_Cs' ../../plugins/vimdoc-ja/doc/term.jax /*'t_Cs'* +'t_DL' ../../plugins/vimdoc-ja/doc/term.jax /*'t_DL'* +'t_EI' ../../plugins/vimdoc-ja/doc/term.jax /*'t_EI'* +'t_F1' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F1'* +'t_F2' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F2'* +'t_F3' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F3'* +'t_F4' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F4'* +'t_F5' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F5'* +'t_F6' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F6'* +'t_F7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F7'* +'t_F8' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F8'* +'t_F9' ../../plugins/vimdoc-ja/doc/term.jax /*'t_F9'* +'t_IE' ../../plugins/vimdoc-ja/doc/term.jax /*'t_IE'* +'t_IS' ../../plugins/vimdoc-ja/doc/term.jax /*'t_IS'* +'t_K1' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K1'* +'t_K3' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K3'* +'t_K4' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K4'* +'t_K5' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K5'* +'t_K6' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K6'* +'t_K7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K7'* +'t_K8' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K8'* +'t_K9' ../../plugins/vimdoc-ja/doc/term.jax /*'t_K9'* +'t_KA' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KA'* +'t_KB' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KB'* +'t_KC' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KC'* +'t_KD' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KD'* +'t_KE' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KE'* +'t_KF' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KF'* +'t_KG' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KG'* +'t_KH' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KH'* +'t_KI' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KI'* +'t_KJ' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KJ'* +'t_KK' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KK'* +'t_KL' ../../plugins/vimdoc-ja/doc/term.jax /*'t_KL'* +'t_RB' ../../plugins/vimdoc-ja/doc/term.jax /*'t_RB'* +'t_RI' ../../plugins/vimdoc-ja/doc/term.jax /*'t_RI'* +'t_RV' ../../plugins/vimdoc-ja/doc/term.jax /*'t_RV'* +'t_SI' ../../plugins/vimdoc-ja/doc/term.jax /*'t_SI'* +'t_SR' ../../plugins/vimdoc-ja/doc/term.jax /*'t_SR'* +'t_Sb' ../../plugins/vimdoc-ja/doc/term.jax /*'t_Sb'* +'t_Sf' ../../plugins/vimdoc-ja/doc/term.jax /*'t_Sf'* +'t_WP' ../../plugins/vimdoc-ja/doc/term.jax /*'t_WP'* +'t_WS' ../../plugins/vimdoc-ja/doc/term.jax /*'t_WS'* +'t_ZH' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ZH'* +'t_ZR' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ZR'* +'t_al' ../../plugins/vimdoc-ja/doc/term.jax /*'t_al'* +'t_bc' ../../plugins/vimdoc-ja/doc/term.jax /*'t_bc'* +'t_cd' ../../plugins/vimdoc-ja/doc/term.jax /*'t_cd'* +'t_ce' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ce'* +'t_cl' ../../plugins/vimdoc-ja/doc/term.jax /*'t_cl'* +'t_cm' ../../plugins/vimdoc-ja/doc/term.jax /*'t_cm'* +'t_cs' ../../plugins/vimdoc-ja/doc/term.jax /*'t_cs'* +'t_da' ../../plugins/vimdoc-ja/doc/term.jax /*'t_da'* +'t_db' ../../plugins/vimdoc-ja/doc/term.jax /*'t_db'* +'t_dl' ../../plugins/vimdoc-ja/doc/term.jax /*'t_dl'* +'t_fs' ../../plugins/vimdoc-ja/doc/term.jax /*'t_fs'* +'t_k1' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k1'* +'t_k2' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k2'* +'t_k3' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k3'* +'t_k4' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k4'* +'t_k5' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k5'* +'t_k6' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k6'* +'t_k7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k7'* +'t_k8' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k8'* +'t_k9' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k9'* +'t_k;' ../../plugins/vimdoc-ja/doc/term.jax /*'t_k;'* +'t_kB' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kB'* +'t_kD' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kD'* +'t_kI' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kI'* +'t_kN' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kN'* +'t_kP' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kP'* +'t_kb' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kb'* +'t_kd' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kd'* +'t_ke' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ke'* +'t_kh' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kh'* +'t_kl' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kl'* +'t_kr' ../../plugins/vimdoc-ja/doc/term.jax /*'t_kr'* +'t_ks' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ks'* +'t_ku' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ku'* +'t_le' ../../plugins/vimdoc-ja/doc/term.jax /*'t_le'* +'t_mb' ../../plugins/vimdoc-ja/doc/term.jax /*'t_mb'* +'t_md' ../../plugins/vimdoc-ja/doc/term.jax /*'t_md'* +'t_me' ../../plugins/vimdoc-ja/doc/term.jax /*'t_me'* +'t_mr' ../../plugins/vimdoc-ja/doc/term.jax /*'t_mr'* +'t_ms' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ms'* +'t_nd' ../../plugins/vimdoc-ja/doc/term.jax /*'t_nd'* +'t_op' ../../plugins/vimdoc-ja/doc/term.jax /*'t_op'* +'t_se' ../../plugins/vimdoc-ja/doc/term.jax /*'t_se'* +'t_so' ../../plugins/vimdoc-ja/doc/term.jax /*'t_so'* +'t_sr' ../../plugins/vimdoc-ja/doc/term.jax /*'t_sr'* +'t_star7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_star7'* +'t_te' ../../plugins/vimdoc-ja/doc/term.jax /*'t_te'* +'t_ti' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ti'* +'t_ts' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ts'* +'t_u7' ../../plugins/vimdoc-ja/doc/term.jax /*'t_u7'* +'t_ue' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ue'* +'t_us' ../../plugins/vimdoc-ja/doc/term.jax /*'t_us'* +'t_ut' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ut'* +'t_vb' ../../plugins/vimdoc-ja/doc/term.jax /*'t_vb'* +'t_ve' ../../plugins/vimdoc-ja/doc/term.jax /*'t_ve'* +'t_vi' ../../plugins/vimdoc-ja/doc/term.jax /*'t_vi'* +'t_vs' ../../plugins/vimdoc-ja/doc/term.jax /*'t_vs'* +'t_xn' ../../plugins/vimdoc-ja/doc/term.jax /*'t_xn'* +'t_xs' ../../plugins/vimdoc-ja/doc/term.jax /*'t_xs'* +'ta' ../../plugins/vimdoc-ja/doc/options.jax /*'ta'* +'tabline' ../../plugins/vimdoc-ja/doc/options.jax /*'tabline'* +'tabpagemax' ../../plugins/vimdoc-ja/doc/options.jax /*'tabpagemax'* +'tabstop' ../../plugins/vimdoc-ja/doc/options.jax /*'tabstop'* +'tag' ../../plugins/vimdoc-ja/doc/options.jax /*'tag'* +'tagbsearch' ../../plugins/vimdoc-ja/doc/options.jax /*'tagbsearch'* +'tagcase' ../../plugins/vimdoc-ja/doc/options.jax /*'tagcase'* +'taglength' ../../plugins/vimdoc-ja/doc/options.jax /*'taglength'* +'tagrelative' ../../plugins/vimdoc-ja/doc/options.jax /*'tagrelative'* +'tags' ../../plugins/vimdoc-ja/doc/options.jax /*'tags'* +'tagstack' ../../plugins/vimdoc-ja/doc/options.jax /*'tagstack'* +'tal' ../../plugins/vimdoc-ja/doc/options.jax /*'tal'* +'tb' ../../plugins/vimdoc-ja/doc/options.jax /*'tb'* +'tbi' ../../plugins/vimdoc-ja/doc/options.jax /*'tbi'* +'tbidi' ../../plugins/vimdoc-ja/doc/options.jax /*'tbidi'* +'tbis' ../../plugins/vimdoc-ja/doc/options.jax /*'tbis'* +'tbs' ../../plugins/vimdoc-ja/doc/options.jax /*'tbs'* +'tc' ../../plugins/vimdoc-ja/doc/options.jax /*'tc'* +'tcldll' ../../plugins/vimdoc-ja/doc/options.jax /*'tcldll'* +'tenc' ../../plugins/vimdoc-ja/doc/options.jax /*'tenc'* +'term' ../../plugins/vimdoc-ja/doc/options.jax /*'term'* +'termbidi' ../../plugins/vimdoc-ja/doc/options.jax /*'termbidi'* +'termencoding' ../../plugins/vimdoc-ja/doc/options.jax /*'termencoding'* +'termguicolors' ../../plugins/vimdoc-ja/doc/options.jax /*'termguicolors'* +'terse' ../../plugins/vimdoc-ja/doc/options.jax /*'terse'* +'textauto' ../../plugins/vimdoc-ja/doc/options.jax /*'textauto'* +'textmode' ../../plugins/vimdoc-ja/doc/options.jax /*'textmode'* +'textwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'textwidth'* +'tf' ../../plugins/vimdoc-ja/doc/options.jax /*'tf'* +'tgc' ../../plugins/vimdoc-ja/doc/options.jax /*'tgc'* +'tgst' ../../plugins/vimdoc-ja/doc/options.jax /*'tgst'* +'thesaurus' ../../plugins/vimdoc-ja/doc/options.jax /*'thesaurus'* +'tildeop' ../../plugins/vimdoc-ja/doc/options.jax /*'tildeop'* +'timeout' ../../plugins/vimdoc-ja/doc/options.jax /*'timeout'* +'timeoutlen' ../../plugins/vimdoc-ja/doc/options.jax /*'timeoutlen'* +'title' ../../plugins/vimdoc-ja/doc/options.jax /*'title'* +'titlelen' ../../plugins/vimdoc-ja/doc/options.jax /*'titlelen'* +'titleold' ../../plugins/vimdoc-ja/doc/options.jax /*'titleold'* +'titlestring' ../../plugins/vimdoc-ja/doc/options.jax /*'titlestring'* +'tl' ../../plugins/vimdoc-ja/doc/options.jax /*'tl'* +'tm' ../../plugins/vimdoc-ja/doc/options.jax /*'tm'* +'to' ../../plugins/vimdoc-ja/doc/options.jax /*'to'* +'toolbar' ../../plugins/vimdoc-ja/doc/options.jax /*'toolbar'* +'toolbariconsize' ../../plugins/vimdoc-ja/doc/options.jax /*'toolbariconsize'* +'top' ../../plugins/vimdoc-ja/doc/options.jax /*'top'* +'tpm' ../../plugins/vimdoc-ja/doc/options.jax /*'tpm'* +'tr' ../../plugins/vimdoc-ja/doc/options.jax /*'tr'* +'ts' ../../plugins/vimdoc-ja/doc/options.jax /*'ts'* +'tsl' ../../plugins/vimdoc-ja/doc/options.jax /*'tsl'* +'tsr' ../../plugins/vimdoc-ja/doc/options.jax /*'tsr'* +'ttimeout' ../../plugins/vimdoc-ja/doc/options.jax /*'ttimeout'* +'ttimeoutlen' ../../plugins/vimdoc-ja/doc/options.jax /*'ttimeoutlen'* +'ttm' ../../plugins/vimdoc-ja/doc/options.jax /*'ttm'* +'tty' ../../plugins/vimdoc-ja/doc/options.jax /*'tty'* +'ttybuiltin' ../../plugins/vimdoc-ja/doc/options.jax /*'ttybuiltin'* +'ttyfast' ../../plugins/vimdoc-ja/doc/options.jax /*'ttyfast'* +'ttym' ../../plugins/vimdoc-ja/doc/options.jax /*'ttym'* +'ttymouse' ../../plugins/vimdoc-ja/doc/options.jax /*'ttymouse'* +'ttyscroll' ../../plugins/vimdoc-ja/doc/options.jax /*'ttyscroll'* +'ttytype' ../../plugins/vimdoc-ja/doc/options.jax /*'ttytype'* +'tw' ../../plugins/vimdoc-ja/doc/options.jax /*'tw'* +'tx' ../../plugins/vimdoc-ja/doc/options.jax /*'tx'* +'uc' ../../plugins/vimdoc-ja/doc/options.jax /*'uc'* +'udf' ../../plugins/vimdoc-ja/doc/options.jax /*'udf'* +'udir' ../../plugins/vimdoc-ja/doc/options.jax /*'udir'* +'ul' ../../plugins/vimdoc-ja/doc/options.jax /*'ul'* +'undodir' ../../plugins/vimdoc-ja/doc/options.jax /*'undodir'* +'undofile' ../../plugins/vimdoc-ja/doc/options.jax /*'undofile'* +'undolevels' ../../plugins/vimdoc-ja/doc/options.jax /*'undolevels'* +'undoreload' ../../plugins/vimdoc-ja/doc/options.jax /*'undoreload'* +'updatecount' ../../plugins/vimdoc-ja/doc/options.jax /*'updatecount'* +'updatetime' ../../plugins/vimdoc-ja/doc/options.jax /*'updatetime'* +'ur' ../../plugins/vimdoc-ja/doc/options.jax /*'ur'* +'ut' ../../plugins/vimdoc-ja/doc/options.jax /*'ut'* +'vb' ../../plugins/vimdoc-ja/doc/options.jax /*'vb'* +'vbs' ../../plugins/vimdoc-ja/doc/options.jax /*'vbs'* +'vdir' ../../plugins/vimdoc-ja/doc/options.jax /*'vdir'* +'ve' ../../plugins/vimdoc-ja/doc/options.jax /*'ve'* +'verbose' ../../plugins/vimdoc-ja/doc/options.jax /*'verbose'* +'verbosefile' ../../plugins/vimdoc-ja/doc/options.jax /*'verbosefile'* +'vfile' ../../plugins/vimdoc-ja/doc/options.jax /*'vfile'* +'vi' ../../plugins/vimdoc-ja/doc/options.jax /*'vi'* +'viewdir' ../../plugins/vimdoc-ja/doc/options.jax /*'viewdir'* +'viewoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'viewoptions'* +'viminfo' ../../plugins/vimdoc-ja/doc/options.jax /*'viminfo'* +'virtualedit' ../../plugins/vimdoc-ja/doc/options.jax /*'virtualedit'* +'visualbell' ../../plugins/vimdoc-ja/doc/options.jax /*'visualbell'* +'vop' ../../plugins/vimdoc-ja/doc/options.jax /*'vop'* +'w1200' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'w1200'* +'w300' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'w300'* +'w9600' ../../plugins/vimdoc-ja/doc/vi_diff.jax /*'w9600'* +'wa' ../../plugins/vimdoc-ja/doc/options.jax /*'wa'* +'wak' ../../plugins/vimdoc-ja/doc/options.jax /*'wak'* +'warn' ../../plugins/vimdoc-ja/doc/options.jax /*'warn'* +'wb' ../../plugins/vimdoc-ja/doc/options.jax /*'wb'* +'wc' ../../plugins/vimdoc-ja/doc/options.jax /*'wc'* +'wcm' ../../plugins/vimdoc-ja/doc/options.jax /*'wcm'* +'wd' ../../plugins/vimdoc-ja/doc/options.jax /*'wd'* +'weirdinvert' ../../plugins/vimdoc-ja/doc/options.jax /*'weirdinvert'* +'wfh' ../../plugins/vimdoc-ja/doc/options.jax /*'wfh'* +'wfw' ../../plugins/vimdoc-ja/doc/options.jax /*'wfw'* +'wh' ../../plugins/vimdoc-ja/doc/options.jax /*'wh'* +'whichwrap' ../../plugins/vimdoc-ja/doc/options.jax /*'whichwrap'* +'wi' ../../plugins/vimdoc-ja/doc/options.jax /*'wi'* +'wic' ../../plugins/vimdoc-ja/doc/options.jax /*'wic'* +'wig' ../../plugins/vimdoc-ja/doc/options.jax /*'wig'* +'wildchar' ../../plugins/vimdoc-ja/doc/options.jax /*'wildchar'* +'wildcharm' ../../plugins/vimdoc-ja/doc/options.jax /*'wildcharm'* +'wildignore' ../../plugins/vimdoc-ja/doc/options.jax /*'wildignore'* +'wildignorecase' ../../plugins/vimdoc-ja/doc/options.jax /*'wildignorecase'* +'wildmenu' ../../plugins/vimdoc-ja/doc/options.jax /*'wildmenu'* +'wildmode' ../../plugins/vimdoc-ja/doc/options.jax /*'wildmode'* +'wildoptions' ../../plugins/vimdoc-ja/doc/options.jax /*'wildoptions'* +'wim' ../../plugins/vimdoc-ja/doc/options.jax /*'wim'* +'winaltkeys' ../../plugins/vimdoc-ja/doc/options.jax /*'winaltkeys'* +'window' ../../plugins/vimdoc-ja/doc/options.jax /*'window'* +'winfixheight' ../../plugins/vimdoc-ja/doc/options.jax /*'winfixheight'* +'winfixwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'winfixwidth'* +'winheight' ../../plugins/vimdoc-ja/doc/options.jax /*'winheight'* +'winminheight' ../../plugins/vimdoc-ja/doc/options.jax /*'winminheight'* +'winminwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'winminwidth'* +'winwidth' ../../plugins/vimdoc-ja/doc/options.jax /*'winwidth'* +'wiv' ../../plugins/vimdoc-ja/doc/options.jax /*'wiv'* +'wiw' ../../plugins/vimdoc-ja/doc/options.jax /*'wiw'* +'wm' ../../plugins/vimdoc-ja/doc/options.jax /*'wm'* +'wmh' ../../plugins/vimdoc-ja/doc/options.jax /*'wmh'* +'wmnu' ../../plugins/vimdoc-ja/doc/options.jax /*'wmnu'* +'wmw' ../../plugins/vimdoc-ja/doc/options.jax /*'wmw'* +'wop' ../../plugins/vimdoc-ja/doc/options.jax /*'wop'* +'wrap' ../../plugins/vimdoc-ja/doc/options.jax /*'wrap'* +'wrapmargin' ../../plugins/vimdoc-ja/doc/options.jax /*'wrapmargin'* +'wrapscan' ../../plugins/vimdoc-ja/doc/options.jax /*'wrapscan'* +'write' ../../plugins/vimdoc-ja/doc/options.jax /*'write'* +'writeany' ../../plugins/vimdoc-ja/doc/options.jax /*'writeany'* +'writebackup' ../../plugins/vimdoc-ja/doc/options.jax /*'writebackup'* +'writedelay' ../../plugins/vimdoc-ja/doc/options.jax /*'writedelay'* +'ws' ../../plugins/vimdoc-ja/doc/options.jax /*'ws'* +'ww' ../../plugins/vimdoc-ja/doc/options.jax /*'ww'* +'{ ../../plugins/vimdoc-ja/doc/motion.jax /*'{* +'} ../../plugins/vimdoc-ja/doc/motion.jax /*'}* +( ../../plugins/vimdoc-ja/doc/motion.jax /*(* +) ../../plugins/vimdoc-ja/doc/motion.jax /*)* ++ ../../plugins/vimdoc-ja/doc/motion.jax /*+* +++bad ../../plugins/vimdoc-ja/doc/editing.jax /*++bad* +++bin ../../plugins/vimdoc-ja/doc/editing.jax /*++bin* +++builtin_terms ../../plugins/vimdoc-ja/doc/various.jax /*++builtin_terms* +++edit ../../plugins/vimdoc-ja/doc/editing.jax /*++edit* +++enc ../../plugins/vimdoc-ja/doc/editing.jax /*++enc* +++ff ../../plugins/vimdoc-ja/doc/editing.jax /*++ff* +++nobin ../../plugins/vimdoc-ja/doc/editing.jax /*++nobin* +++opt ../../plugins/vimdoc-ja/doc/editing.jax /*++opt* ++ARP ../../plugins/vimdoc-ja/doc/various.jax /*+ARP* ++GUI_Athena ../../plugins/vimdoc-ja/doc/various.jax /*+GUI_Athena* ++GUI_GTK ../../plugins/vimdoc-ja/doc/various.jax /*+GUI_GTK* ++GUI_Motif ../../plugins/vimdoc-ja/doc/various.jax /*+GUI_Motif* ++GUI_Photon ../../plugins/vimdoc-ja/doc/various.jax /*+GUI_Photon* ++GUI_neXtaw ../../plugins/vimdoc-ja/doc/various.jax /*+GUI_neXtaw* ++X11 ../../plugins/vimdoc-ja/doc/various.jax /*+X11* ++acl ../../plugins/vimdoc-ja/doc/various.jax /*+acl* ++arabic ../../plugins/vimdoc-ja/doc/various.jax /*+arabic* ++autocmd ../../plugins/vimdoc-ja/doc/various.jax /*+autocmd* ++balloon_eval ../../plugins/vimdoc-ja/doc/various.jax /*+balloon_eval* ++browse ../../plugins/vimdoc-ja/doc/various.jax /*+browse* ++builtin_terms ../../plugins/vimdoc-ja/doc/various.jax /*+builtin_terms* ++byte_offset ../../plugins/vimdoc-ja/doc/various.jax /*+byte_offset* ++channel ../../plugins/vimdoc-ja/doc/various.jax /*+channel* ++cindent ../../plugins/vimdoc-ja/doc/various.jax /*+cindent* ++clientserver ../../plugins/vimdoc-ja/doc/various.jax /*+clientserver* ++clipboard ../../plugins/vimdoc-ja/doc/various.jax /*+clipboard* ++cmd ../../plugins/vimdoc-ja/doc/editing.jax /*+cmd* ++cmdline_compl ../../plugins/vimdoc-ja/doc/various.jax /*+cmdline_compl* ++cmdline_hist ../../plugins/vimdoc-ja/doc/various.jax /*+cmdline_hist* ++cmdline_info ../../plugins/vimdoc-ja/doc/various.jax /*+cmdline_info* ++comments ../../plugins/vimdoc-ja/doc/various.jax /*+comments* ++conceal ../../plugins/vimdoc-ja/doc/various.jax /*+conceal* ++cryptv ../../plugins/vimdoc-ja/doc/various.jax /*+cryptv* ++cscope ../../plugins/vimdoc-ja/doc/various.jax /*+cscope* ++cursorbind ../../plugins/vimdoc-ja/doc/various.jax /*+cursorbind* ++cursorshape ../../plugins/vimdoc-ja/doc/various.jax /*+cursorshape* ++debug ../../plugins/vimdoc-ja/doc/various.jax /*+debug* ++dialog_con ../../plugins/vimdoc-ja/doc/various.jax /*+dialog_con* ++dialog_con_gui ../../plugins/vimdoc-ja/doc/various.jax /*+dialog_con_gui* ++dialog_gui ../../plugins/vimdoc-ja/doc/various.jax /*+dialog_gui* ++diff ../../plugins/vimdoc-ja/doc/various.jax /*+diff* ++digraphs ../../plugins/vimdoc-ja/doc/various.jax /*+digraphs* ++directx ../../plugins/vimdoc-ja/doc/various.jax /*+directx* ++dnd ../../plugins/vimdoc-ja/doc/various.jax /*+dnd* ++emacs_tags ../../plugins/vimdoc-ja/doc/various.jax /*+emacs_tags* ++eval ../../plugins/vimdoc-ja/doc/various.jax /*+eval* ++ex_extra ../../plugins/vimdoc-ja/doc/various.jax /*+ex_extra* ++extra_search ../../plugins/vimdoc-ja/doc/various.jax /*+extra_search* ++farsi ../../plugins/vimdoc-ja/doc/various.jax /*+farsi* ++feature-list ../../plugins/vimdoc-ja/doc/various.jax /*+feature-list* ++file_in_path ../../plugins/vimdoc-ja/doc/various.jax /*+file_in_path* ++find_in_path ../../plugins/vimdoc-ja/doc/various.jax /*+find_in_path* ++float ../../plugins/vimdoc-ja/doc/various.jax /*+float* ++folding ../../plugins/vimdoc-ja/doc/various.jax /*+folding* ++footer ../../plugins/vimdoc-ja/doc/various.jax /*+footer* ++fork ../../plugins/vimdoc-ja/doc/various.jax /*+fork* ++gettext ../../plugins/vimdoc-ja/doc/various.jax /*+gettext* ++hangul_input ../../plugins/vimdoc-ja/doc/various.jax /*+hangul_input* ++iconv ../../plugins/vimdoc-ja/doc/various.jax /*+iconv* ++iconv/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+iconv\/dyn* ++insert_expand ../../plugins/vimdoc-ja/doc/various.jax /*+insert_expand* ++job ../../plugins/vimdoc-ja/doc/various.jax /*+job* ++jumplist ../../plugins/vimdoc-ja/doc/various.jax /*+jumplist* ++keymap ../../plugins/vimdoc-ja/doc/various.jax /*+keymap* ++lambda ../../plugins/vimdoc-ja/doc/various.jax /*+lambda* ++langmap ../../plugins/vimdoc-ja/doc/various.jax /*+langmap* ++libcall ../../plugins/vimdoc-ja/doc/various.jax /*+libcall* ++linebreak ../../plugins/vimdoc-ja/doc/various.jax /*+linebreak* ++lispindent ../../plugins/vimdoc-ja/doc/various.jax /*+lispindent* ++listcmds ../../plugins/vimdoc-ja/doc/various.jax /*+listcmds* ++localmap ../../plugins/vimdoc-ja/doc/various.jax /*+localmap* ++lua ../../plugins/vimdoc-ja/doc/various.jax /*+lua* ++lua/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+lua\/dyn* ++menu ../../plugins/vimdoc-ja/doc/various.jax /*+menu* ++mksession ../../plugins/vimdoc-ja/doc/various.jax /*+mksession* ++modify_fname ../../plugins/vimdoc-ja/doc/various.jax /*+modify_fname* ++mouse ../../plugins/vimdoc-ja/doc/various.jax /*+mouse* ++mouse_dec ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_dec* ++mouse_gpm ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_gpm* ++mouse_jsbterm ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_jsbterm* ++mouse_netterm ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_netterm* ++mouse_pterm ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_pterm* ++mouse_sgr ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_sgr* ++mouse_sysmouse ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_sysmouse* ++mouse_urxvt ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_urxvt* ++mouse_xterm ../../plugins/vimdoc-ja/doc/various.jax /*+mouse_xterm* ++mouseshape ../../plugins/vimdoc-ja/doc/various.jax /*+mouseshape* ++multi_byte ../../plugins/vimdoc-ja/doc/various.jax /*+multi_byte* ++multi_byte_ime ../../plugins/vimdoc-ja/doc/various.jax /*+multi_byte_ime* ++multi_lang ../../plugins/vimdoc-ja/doc/various.jax /*+multi_lang* ++mzscheme ../../plugins/vimdoc-ja/doc/various.jax /*+mzscheme* ++mzscheme/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+mzscheme\/dyn* ++netbeans_intg ../../plugins/vimdoc-ja/doc/various.jax /*+netbeans_intg* ++num64 ../../plugins/vimdoc-ja/doc/various.jax /*+num64* ++ole ../../plugins/vimdoc-ja/doc/various.jax /*+ole* ++packages ../../plugins/vimdoc-ja/doc/various.jax /*+packages* ++path_extra ../../plugins/vimdoc-ja/doc/various.jax /*+path_extra* ++perl ../../plugins/vimdoc-ja/doc/various.jax /*+perl* ++perl/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+perl\/dyn* ++persistent_undo ../../plugins/vimdoc-ja/doc/various.jax /*+persistent_undo* ++postscript ../../plugins/vimdoc-ja/doc/various.jax /*+postscript* ++printer ../../plugins/vimdoc-ja/doc/various.jax /*+printer* ++profile ../../plugins/vimdoc-ja/doc/various.jax /*+profile* ++python ../../plugins/vimdoc-ja/doc/various.jax /*+python* ++python/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+python\/dyn* ++python3 ../../plugins/vimdoc-ja/doc/various.jax /*+python3* ++python3/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+python3\/dyn* ++quickfix ../../plugins/vimdoc-ja/doc/various.jax /*+quickfix* ++reltime ../../plugins/vimdoc-ja/doc/various.jax /*+reltime* ++rightleft ../../plugins/vimdoc-ja/doc/various.jax /*+rightleft* ++ruby ../../plugins/vimdoc-ja/doc/various.jax /*+ruby* ++ruby/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+ruby\/dyn* ++scrollbind ../../plugins/vimdoc-ja/doc/various.jax /*+scrollbind* ++signs ../../plugins/vimdoc-ja/doc/various.jax /*+signs* ++smartindent ../../plugins/vimdoc-ja/doc/various.jax /*+smartindent* ++startuptime ../../plugins/vimdoc-ja/doc/various.jax /*+startuptime* ++statusline ../../plugins/vimdoc-ja/doc/various.jax /*+statusline* ++sun_workshop ../../plugins/vimdoc-ja/doc/various.jax /*+sun_workshop* ++syntax ../../plugins/vimdoc-ja/doc/various.jax /*+syntax* ++system() ../../plugins/vimdoc-ja/doc/various.jax /*+system()* ++tag_any_white ../../plugins/vimdoc-ja/doc/various.jax /*+tag_any_white* ++tag_binary ../../plugins/vimdoc-ja/doc/various.jax /*+tag_binary* ++tag_old_static ../../plugins/vimdoc-ja/doc/various.jax /*+tag_old_static* ++tcl ../../plugins/vimdoc-ja/doc/various.jax /*+tcl* ++tcl/dyn ../../plugins/vimdoc-ja/doc/various.jax /*+tcl\/dyn* ++termguicolors ../../plugins/vimdoc-ja/doc/various.jax /*+termguicolors* ++terminfo ../../plugins/vimdoc-ja/doc/various.jax /*+terminfo* ++termresponse ../../plugins/vimdoc-ja/doc/various.jax /*+termresponse* ++textobjects ../../plugins/vimdoc-ja/doc/various.jax /*+textobjects* ++tgetent ../../plugins/vimdoc-ja/doc/various.jax /*+tgetent* ++timers ../../plugins/vimdoc-ja/doc/various.jax /*+timers* ++title ../../plugins/vimdoc-ja/doc/various.jax /*+title* ++toolbar ../../plugins/vimdoc-ja/doc/various.jax /*+toolbar* ++user_commands ../../plugins/vimdoc-ja/doc/various.jax /*+user_commands* ++vertsplit ../../plugins/vimdoc-ja/doc/various.jax /*+vertsplit* ++viminfo ../../plugins/vimdoc-ja/doc/various.jax /*+viminfo* ++virtualedit ../../plugins/vimdoc-ja/doc/various.jax /*+virtualedit* ++visual ../../plugins/vimdoc-ja/doc/various.jax /*+visual* ++visualextra ../../plugins/vimdoc-ja/doc/various.jax /*+visualextra* ++vreplace ../../plugins/vimdoc-ja/doc/various.jax /*+vreplace* ++wildignore ../../plugins/vimdoc-ja/doc/various.jax /*+wildignore* ++wildmenu ../../plugins/vimdoc-ja/doc/various.jax /*+wildmenu* ++windows ../../plugins/vimdoc-ja/doc/various.jax /*+windows* ++writebackup ../../plugins/vimdoc-ja/doc/various.jax /*+writebackup* ++xfontset ../../plugins/vimdoc-ja/doc/various.jax /*+xfontset* ++xim ../../plugins/vimdoc-ja/doc/various.jax /*+xim* ++xpm ../../plugins/vimdoc-ja/doc/various.jax /*+xpm* ++xpm_w32 ../../plugins/vimdoc-ja/doc/various.jax /*+xpm_w32* ++xsmp ../../plugins/vimdoc-ja/doc/various.jax /*+xsmp* ++xsmp_interact ../../plugins/vimdoc-ja/doc/various.jax /*+xsmp_interact* ++xterm_clipboard ../../plugins/vimdoc-ja/doc/various.jax /*+xterm_clipboard* ++xterm_save ../../plugins/vimdoc-ja/doc/various.jax /*+xterm_save* +, ../../plugins/vimdoc-ja/doc/motion.jax /*,* +- ../../plugins/vimdoc-ja/doc/motion.jax /*-* +-+ ../../plugins/vimdoc-ja/doc/starting.jax /*-+* +-+/ ../../plugins/vimdoc-ja/doc/starting.jax /*-+\/* +-+c ../../plugins/vimdoc-ja/doc/starting.jax /*-+c* +-+reverse ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-+reverse* +-+rv ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-+rv* +-- ../../plugins/vimdoc-ja/doc/starting.jax /*--* +--- ../../plugins/vimdoc-ja/doc/starting.jax /*---* +--cmd ../../plugins/vimdoc-ja/doc/starting.jax /*--cmd* +--echo-wid ../../plugins/vimdoc-ja/doc/starting.jax /*--echo-wid* +--help ../../plugins/vimdoc-ja/doc/starting.jax /*--help* +--literal ../../plugins/vimdoc-ja/doc/starting.jax /*--literal* +--nofork ../../plugins/vimdoc-ja/doc/starting.jax /*--nofork* +--noplugin ../../plugins/vimdoc-ja/doc/starting.jax /*--noplugin* +--not-a-term ../../plugins/vimdoc-ja/doc/starting.jax /*--not-a-term* +--remote ../../plugins/vimdoc-ja/doc/remote.jax /*--remote* +--remote-expr ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-expr* +--remote-send ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-send* +--remote-silent ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-silent* +--remote-tab ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-tab* +--remote-tab-silent ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-tab-silent* +--remote-tab-wait ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-tab-wait* +--remote-tab-wait-silent ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-tab-wait-silent* +--remote-wait ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-wait* +--remote-wait-silent ../../plugins/vimdoc-ja/doc/remote.jax /*--remote-wait-silent* +--role ../../plugins/vimdoc-ja/doc/starting.jax /*--role* +--serverlist ../../plugins/vimdoc-ja/doc/remote.jax /*--serverlist* +--servername ../../plugins/vimdoc-ja/doc/remote.jax /*--servername* +--socketid ../../plugins/vimdoc-ja/doc/starting.jax /*--socketid* +--startuptime ../../plugins/vimdoc-ja/doc/starting.jax /*--startuptime* +--ttyfail ../../plugins/vimdoc-ja/doc/starting.jax /*--ttyfail* +--version ../../plugins/vimdoc-ja/doc/starting.jax /*--version* +--windowid ../../plugins/vimdoc-ja/doc/starting.jax /*--windowid* +-A ../../plugins/vimdoc-ja/doc/starting.jax /*-A* +-C ../../plugins/vimdoc-ja/doc/starting.jax /*-C* +-D ../../plugins/vimdoc-ja/doc/starting.jax /*-D* +-E ../../plugins/vimdoc-ja/doc/starting.jax /*-E* +-F ../../plugins/vimdoc-ja/doc/starting.jax /*-F* +-H ../../plugins/vimdoc-ja/doc/starting.jax /*-H* +-L ../../plugins/vimdoc-ja/doc/starting.jax /*-L* +-M ../../plugins/vimdoc-ja/doc/starting.jax /*-M* +-N ../../plugins/vimdoc-ja/doc/starting.jax /*-N* +-O ../../plugins/vimdoc-ja/doc/starting.jax /*-O* +-P ../../plugins/vimdoc-ja/doc/starting.jax /*-P* +-R ../../plugins/vimdoc-ja/doc/starting.jax /*-R* +-S ../../plugins/vimdoc-ja/doc/starting.jax /*-S* +-T ../../plugins/vimdoc-ja/doc/starting.jax /*-T* +-U ../../plugins/vimdoc-ja/doc/starting.jax /*-U* +-V ../../plugins/vimdoc-ja/doc/starting.jax /*-V* +-W ../../plugins/vimdoc-ja/doc/starting.jax /*-W* +-X ../../plugins/vimdoc-ja/doc/starting.jax /*-X* +-Z ../../plugins/vimdoc-ja/doc/starting.jax /*-Z* +-b ../../plugins/vimdoc-ja/doc/starting.jax /*-b* +-background ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-background* +-bg ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-bg* +-boldfont ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-boldfont* +-borderwidth ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-borderwidth* +-bw ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-bw* +-c ../../plugins/vimdoc-ja/doc/starting.jax /*-c* +-d ../../plugins/vimdoc-ja/doc/starting.jax /*-d* +-dev ../../plugins/vimdoc-ja/doc/starting.jax /*-dev* +-display ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-display* +-e ../../plugins/vimdoc-ja/doc/starting.jax /*-e* +-f ../../plugins/vimdoc-ja/doc/starting.jax /*-f* +-fg ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-fg* +-file ../../plugins/vimdoc-ja/doc/starting.jax /*-file* +-fn ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-fn* +-font ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-font* +-foreground ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-foreground* +-g ../../plugins/vimdoc-ja/doc/starting.jax /*-g* +-geom ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-geom* +-geometry ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-geometry* +-geometry-example ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-geometry-example* +-gui ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-gui* +-h ../../plugins/vimdoc-ja/doc/starting.jax /*-h* +-i ../../plugins/vimdoc-ja/doc/starting.jax /*-i* +-iconic ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-iconic* +-italicfont ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-italicfont* +-l ../../plugins/vimdoc-ja/doc/starting.jax /*-l* +-m ../../plugins/vimdoc-ja/doc/starting.jax /*-m* +-menufont ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-menufont* +-menufontset ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-menufontset* +-menuheight ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-menuheight* +-mf ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-mf* +-mh ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-mh* +-n ../../plugins/vimdoc-ja/doc/starting.jax /*-n* +-nb ../../plugins/vimdoc-ja/doc/starting.jax /*-nb* +-o ../../plugins/vimdoc-ja/doc/starting.jax /*-o* +-p ../../plugins/vimdoc-ja/doc/starting.jax /*-p* +-q ../../plugins/vimdoc-ja/doc/starting.jax /*-q* +-qf ../../plugins/vimdoc-ja/doc/starting.jax /*-qf* +-r ../../plugins/vimdoc-ja/doc/starting.jax /*-r* +-register ../../plugins/vimdoc-ja/doc/if_ole.jax /*-register* +-reverse ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-reverse* +-rv ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-rv* +-s ../../plugins/vimdoc-ja/doc/starting.jax /*-s* +-s-ex ../../plugins/vimdoc-ja/doc/starting.jax /*-s-ex* +-scrollbarwidth ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-scrollbarwidth* +-silent ../../plugins/vimdoc-ja/doc/if_ole.jax /*-silent* +-sw ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-sw* +-t ../../plugins/vimdoc-ja/doc/starting.jax /*-t* +-tag ../../plugins/vimdoc-ja/doc/starting.jax /*-tag* +-u ../../plugins/vimdoc-ja/doc/starting.jax /*-u* +-ul ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-ul* +-unregister ../../plugins/vimdoc-ja/doc/if_ole.jax /*-unregister* +-v ../../plugins/vimdoc-ja/doc/starting.jax /*-v* +-vim ../../plugins/vimdoc-ja/doc/starting.jax /*-vim* +-w ../../plugins/vimdoc-ja/doc/starting.jax /*-w* +-w_nr ../../plugins/vimdoc-ja/doc/starting.jax /*-w_nr* +-x ../../plugins/vimdoc-ja/doc/starting.jax /*-x* +-xrm ../../plugins/vimdoc-ja/doc/gui_x11.jax /*-xrm* +-y ../../plugins/vimdoc-ja/doc/starting.jax /*-y* +. ../../plugins/vimdoc-ja/doc/repeat.jax /*.* +... ../../plugins/vimdoc-ja/doc/eval.jax /*...* +.Xdefaults ../../plugins/vimdoc-ja/doc/gui_x11.jax /*.Xdefaults* +.aff ../../plugins/vimdoc-ja/doc/spell.jax /*.aff* +.dic ../../plugins/vimdoc-ja/doc/spell.jax /*.dic* +.exrc ../../plugins/vimdoc-ja/doc/starting.jax /*.exrc* +.gvimrc ../../plugins/vimdoc-ja/doc/gui.jax /*.gvimrc* +.netrwbook ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*.netrwbook* +.netrwhist ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*.netrwhist* +.vimrc ../../plugins/vimdoc-ja/doc/starting.jax /*.vimrc* +/ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/* +/$ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/$* +/. ../../plugins/vimdoc-ja/doc/pattern.jax /*\/.* +//; ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\/;* +/<CR> ../../plugins/vimdoc-ja/doc/pattern.jax /*\/<CR>* +/[[. ../../plugins/vimdoc-ja/doc/pattern.jax /*\/[[.* +/[[= ../../plugins/vimdoc-ja/doc/pattern.jax /*\/[[=* +/[\n] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/[\\n]* +/[] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/[]* +/\ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\* +/\$ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\$* +/\%# ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%#* +/\%#= ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%#=* +/\%$ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%$* +/\%'m ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%'m* +/\%( ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%(* +/\%(\) ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%(\\)* +/\%<'m ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%<'m* +/\%<c ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%<c* +/\%<l ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%<l* +/\%<v ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%<v* +/\%>'m ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%>'m* +/\%>c ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%>c* +/\%>l ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%>l* +/\%>v ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%>v* +/\%C ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%C* +/\%U ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%U* +/\%V ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%V* +/\%[] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%[]* +/\%^ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%^* +/\%c ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%c* +/\%d ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%d* +/\%l ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%l* +/\%o ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%o* +/\%u ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%u* +/\%v ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%v* +/\%x ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\%x* +/\& ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\&* +/\( ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\(* +/\(\) ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\(\\)* +/\) ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\)* +/\+ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\+* +/\. ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\.* +/\1 ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\1* +/\2 ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\2* +/\3 ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\3* +/\9 ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\9* +/\< ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\<* +/\= ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\=* +/\> ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\>* +/\? ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\?* +/\@! ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\@!* +/\@<! ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\@<!* +/\@<= ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\@<=* +/\@= ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\@=* +/\@> ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\@>* +/\A ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\A* +/\C ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\C* +/\D ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\D* +/\F ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\F* +/\H ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\H* +/\I ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\I* +/\K ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\K* +/\L ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\L* +/\M ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\M* +/\O ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\O* +/\P ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\P* +/\S ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\S* +/\U ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\U* +/\V ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\V* +/\W ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\W* +/\X ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\X* +/\Z ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\Z* +/\[] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\[]* +/\\ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\\\* +/\] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\]* +/\^ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\^* +/\_ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_* +/\_$ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_$* +/\_. ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_.* +/\_A ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_A* +/\_D ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_D* +/\_F ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_F* +/\_H ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_H* +/\_I ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_I* +/\_K ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_K* +/\_L ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_L* +/\_O ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_O* +/\_P ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_P* +/\_S ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_S* +/\_U ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_U* +/\_W ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_W* +/\_X ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_X* +/\_[] ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_[]* +/\_^ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_^* +/\_a ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_a* +/\_d ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_d* +/\_f ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_f* +/\_h ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_h* +/\_i ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_i* +/\_k ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_k* +/\_l ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_l* +/\_o ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_o* +/\_p ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_p* +/\_s ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_s* +/\_u ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_u* +/\_w ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_w* +/\_x ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\_x* +/\a ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\a* +/\b ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\b* +/\bar ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\bar* +/\c ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\c* +/\d ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\d* +/\e ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\e* +/\f ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\f* +/\h ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\h* +/\i ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\i* +/\k ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\k* +/\l ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\l* +/\m ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\m* +/\n ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\n* +/\o ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\o* +/\p ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\p* +/\r ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\r* +/\s ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\s* +/\star ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\star* +/\t ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\t* +/\u ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\u* +/\v ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\v* +/\w ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\w* +/\x ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\x* +/\z( ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z(* +/\z(\) ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z(\\)* +/\z1 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z1* +/\z2 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z2* +/\z3 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z3* +/\z4 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z4* +/\z5 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z5* +/\z6 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z6* +/\z7 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z7* +/\z8 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z8* +/\z9 ../../plugins/vimdoc-ja/doc/syntax.jax /*\/\\z9* +/\ze ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\ze* +/\zs ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\zs* +/\{ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\{* +/\{- ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\{-* +/\~ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/\\~* +/^ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/^* +/_CTRL-G ../../plugins/vimdoc-ja/doc/cmdline.jax /*\/_CTRL-G* +/_CTRL-L ../../plugins/vimdoc-ja/doc/cmdline.jax /*\/_CTRL-L* +/_CTRL-T ../../plugins/vimdoc-ja/doc/cmdline.jax /*\/_CTRL-T* +/atom ../../plugins/vimdoc-ja/doc/pattern.jax /*\/atom* +/bar ../../plugins/vimdoc-ja/doc/pattern.jax /*\/bar* +/branch ../../plugins/vimdoc-ja/doc/pattern.jax /*\/branch* +/character-classes ../../plugins/vimdoc-ja/doc/pattern.jax /*\/character-classes* +/collection ../../plugins/vimdoc-ja/doc/pattern.jax /*\/collection* +/concat ../../plugins/vimdoc-ja/doc/pattern.jax /*\/concat* +/dyn ../../plugins/vimdoc-ja/doc/various.jax /*\/dyn* +/ignorecase ../../plugins/vimdoc-ja/doc/pattern.jax /*\/ignorecase* +/magic ../../plugins/vimdoc-ja/doc/pattern.jax /*\/magic* +/multi ../../plugins/vimdoc-ja/doc/pattern.jax /*\/multi* +/ordinary-atom ../../plugins/vimdoc-ja/doc/pattern.jax /*\/ordinary-atom* +/pattern ../../plugins/vimdoc-ja/doc/pattern.jax /*\/pattern* +/piece ../../plugins/vimdoc-ja/doc/pattern.jax /*\/piece* +/star ../../plugins/vimdoc-ja/doc/pattern.jax /*\/star* +/zero-width ../../plugins/vimdoc-ja/doc/pattern.jax /*\/zero-width* +/~ ../../plugins/vimdoc-ja/doc/pattern.jax /*\/~* +0 ../../plugins/vimdoc-ja/doc/motion.jax /*0* +01.1 ../../plugins/vimdoc-ja/doc/usr_01.jax /*01.1* +01.2 ../../plugins/vimdoc-ja/doc/usr_01.jax /*01.2* +01.3 ../../plugins/vimdoc-ja/doc/usr_01.jax /*01.3* +01.4 ../../plugins/vimdoc-ja/doc/usr_01.jax /*01.4* +02.1 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.1* +02.2 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.2* +02.3 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.3* +02.4 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.4* +02.5 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.5* +02.6 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.6* +02.7 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.7* +02.8 ../../plugins/vimdoc-ja/doc/usr_02.jax /*02.8* +03.1 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.1* +03.10 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.10* +03.2 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.2* +03.3 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.3* +03.4 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.4* +03.5 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.5* +03.6 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.6* +03.7 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.7* +03.8 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.8* +03.9 ../../plugins/vimdoc-ja/doc/usr_03.jax /*03.9* +04.1 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.1* +04.10 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.10* +04.2 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.2* +04.3 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.3* +04.4 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.4* +04.5 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.5* +04.6 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.6* +04.7 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.7* +04.8 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.8* +04.9 ../../plugins/vimdoc-ja/doc/usr_04.jax /*04.9* +05.1 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.1* +05.2 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.2* +05.3 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.3* +05.4 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.4* +05.5 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.5* +05.6 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.6* +05.7 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.7* +05.8 ../../plugins/vimdoc-ja/doc/usr_05.jax /*05.8* +06.1 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.1* +06.2 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.2* +06.3 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.3* +06.4 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.4* +06.5 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.5* +06.6 ../../plugins/vimdoc-ja/doc/usr_06.jax /*06.6* +07.1 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.1* +07.2 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.2* +07.3 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.3* +07.4 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.4* +07.5 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.5* +07.6 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.6* +07.7 ../../plugins/vimdoc-ja/doc/usr_07.jax /*07.7* +08.1 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.1* +08.2 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.2* +08.3 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.3* +08.4 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.4* +08.5 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.5* +08.6 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.6* +08.7 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.7* +08.8 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.8* +08.9 ../../plugins/vimdoc-ja/doc/usr_08.jax /*08.9* +09.1 ../../plugins/vimdoc-ja/doc/usr_09.jax /*09.1* +09.2 ../../plugins/vimdoc-ja/doc/usr_09.jax /*09.2* +09.3 ../../plugins/vimdoc-ja/doc/usr_09.jax /*09.3* +09.4 ../../plugins/vimdoc-ja/doc/usr_09.jax /*09.4* +10.1 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.1* +10.2 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.2* +10.3 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.3* +10.4 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.4* +10.5 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.5* +10.6 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.6* +10.7 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.7* +10.8 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.8* +10.9 ../../plugins/vimdoc-ja/doc/usr_10.jax /*10.9* +11.1 ../../plugins/vimdoc-ja/doc/usr_11.jax /*11.1* +11.2 ../../plugins/vimdoc-ja/doc/usr_11.jax /*11.2* +11.3 ../../plugins/vimdoc-ja/doc/usr_11.jax /*11.3* +11.4 ../../plugins/vimdoc-ja/doc/usr_11.jax /*11.4* +12.1 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.1* +12.2 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.2* +12.3 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.3* +12.4 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.4* +12.5 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.5* +12.6 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.6* +12.7 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.7* +12.8 ../../plugins/vimdoc-ja/doc/usr_12.jax /*12.8* +1gD ../../plugins/vimdoc-ja/doc/pattern.jax /*1gD* +1gd ../../plugins/vimdoc-ja/doc/pattern.jax /*1gd* +20.1 ../../plugins/vimdoc-ja/doc/usr_20.jax /*20.1* +20.2 ../../plugins/vimdoc-ja/doc/usr_20.jax /*20.2* +20.3 ../../plugins/vimdoc-ja/doc/usr_20.jax /*20.3* +20.4 ../../plugins/vimdoc-ja/doc/usr_20.jax /*20.4* +20.5 ../../plugins/vimdoc-ja/doc/usr_20.jax /*20.5* +21.1 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.1* +21.2 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.2* +21.3 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.3* +21.4 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.4* +21.5 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.5* +21.6 ../../plugins/vimdoc-ja/doc/usr_21.jax /*21.6* +22.1 ../../plugins/vimdoc-ja/doc/usr_22.jax /*22.1* +22.2 ../../plugins/vimdoc-ja/doc/usr_22.jax /*22.2* +22.3 ../../plugins/vimdoc-ja/doc/usr_22.jax /*22.3* +22.4 ../../plugins/vimdoc-ja/doc/usr_22.jax /*22.4* +23.1 ../../plugins/vimdoc-ja/doc/usr_23.jax /*23.1* +23.2 ../../plugins/vimdoc-ja/doc/usr_23.jax /*23.2* +23.3 ../../plugins/vimdoc-ja/doc/usr_23.jax /*23.3* +23.4 ../../plugins/vimdoc-ja/doc/usr_23.jax /*23.4* +23.5 ../../plugins/vimdoc-ja/doc/usr_23.jax /*23.5* +24.1 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.1* +24.10 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.10* +24.2 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.2* +24.3 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.3* +24.4 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.4* +24.5 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.5* +24.6 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.6* +24.7 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.7* +24.8 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.8* +24.9 ../../plugins/vimdoc-ja/doc/usr_24.jax /*24.9* +25.1 ../../plugins/vimdoc-ja/doc/usr_25.jax /*25.1* +25.2 ../../plugins/vimdoc-ja/doc/usr_25.jax /*25.2* +25.3 ../../plugins/vimdoc-ja/doc/usr_25.jax /*25.3* +25.4 ../../plugins/vimdoc-ja/doc/usr_25.jax /*25.4* +25.5 ../../plugins/vimdoc-ja/doc/usr_25.jax /*25.5* +26.1 ../../plugins/vimdoc-ja/doc/usr_26.jax /*26.1* +26.2 ../../plugins/vimdoc-ja/doc/usr_26.jax /*26.2* +26.3 ../../plugins/vimdoc-ja/doc/usr_26.jax /*26.3* +26.4 ../../plugins/vimdoc-ja/doc/usr_26.jax /*26.4* +27.1 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.1* +27.2 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.2* +27.3 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.3* +27.4 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.4* +27.5 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.5* +27.6 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.6* +27.7 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.7* +27.8 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.8* +27.9 ../../plugins/vimdoc-ja/doc/usr_27.jax /*27.9* +28.1 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.1* +28.10 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.10* +28.2 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.2* +28.3 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.3* +28.4 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.4* +28.5 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.5* +28.6 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.6* +28.7 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.7* +28.8 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.8* +28.9 ../../plugins/vimdoc-ja/doc/usr_28.jax /*28.9* +29.1 ../../plugins/vimdoc-ja/doc/usr_29.jax /*29.1* +29.2 ../../plugins/vimdoc-ja/doc/usr_29.jax /*29.2* +29.3 ../../plugins/vimdoc-ja/doc/usr_29.jax /*29.3* +29.4 ../../plugins/vimdoc-ja/doc/usr_29.jax /*29.4* +29.5 ../../plugins/vimdoc-ja/doc/usr_29.jax /*29.5* +2html.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*2html.vim* +30.1 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.1* +30.2 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.2* +30.3 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.3* +30.4 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.4* +30.5 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.5* +30.6 ../../plugins/vimdoc-ja/doc/usr_30.jax /*30.6* +31.1 ../../plugins/vimdoc-ja/doc/usr_31.jax /*31.1* +31.2 ../../plugins/vimdoc-ja/doc/usr_31.jax /*31.2* +31.3 ../../plugins/vimdoc-ja/doc/usr_31.jax /*31.3* +31.4 ../../plugins/vimdoc-ja/doc/usr_31.jax /*31.4* +31.5 ../../plugins/vimdoc-ja/doc/usr_31.jax /*31.5* +32.1 ../../plugins/vimdoc-ja/doc/usr_32.jax /*32.1* +32.2 ../../plugins/vimdoc-ja/doc/usr_32.jax /*32.2* +32.3 ../../plugins/vimdoc-ja/doc/usr_32.jax /*32.3* +32.4 ../../plugins/vimdoc-ja/doc/usr_32.jax /*32.4* +40.1 ../../plugins/vimdoc-ja/doc/usr_40.jax /*40.1* +40.2 ../../plugins/vimdoc-ja/doc/usr_40.jax /*40.2* +40.3 ../../plugins/vimdoc-ja/doc/usr_40.jax /*40.3* +41.1 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.1* +41.10 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.10* +41.11 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.11* +41.12 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.12* +41.13 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.13* +41.14 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.14* +41.15 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.15* +41.16 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.16* +41.2 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.2* +41.3 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.3* +41.4 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.4* +41.5 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.5* +41.6 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.6* +41.7 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.7* +41.8 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.8* +41.9 ../../plugins/vimdoc-ja/doc/usr_41.jax /*41.9* +42 ../../plugins/vimdoc-ja/doc/usr_42.jax /*42* +42.1 ../../plugins/vimdoc-ja/doc/usr_42.jax /*42.1* +42.2 ../../plugins/vimdoc-ja/doc/usr_42.jax /*42.2* +42.3 ../../plugins/vimdoc-ja/doc/usr_42.jax /*42.3* +42.4 ../../plugins/vimdoc-ja/doc/usr_42.jax /*42.4* +43.1 ../../plugins/vimdoc-ja/doc/usr_43.jax /*43.1* +43.2 ../../plugins/vimdoc-ja/doc/usr_43.jax /*43.2* +44.1 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.1* +44.10 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.10* +44.11 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.11* +44.12 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.12* +44.2 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.2* +44.3 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.3* +44.4 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.4* +44.5 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.5* +44.6 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.6* +44.7 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.7* +44.8 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.8* +44.9 ../../plugins/vimdoc-ja/doc/usr_44.jax /*44.9* +45.1 ../../plugins/vimdoc-ja/doc/usr_45.jax /*45.1* +45.2 ../../plugins/vimdoc-ja/doc/usr_45.jax /*45.2* +45.3 ../../plugins/vimdoc-ja/doc/usr_45.jax /*45.3* +45.4 ../../plugins/vimdoc-ja/doc/usr_45.jax /*45.4* +45.5 ../../plugins/vimdoc-ja/doc/usr_45.jax /*45.5* +8g8 ../../plugins/vimdoc-ja/doc/various.jax /*8g8* +90.1 ../../plugins/vimdoc-ja/doc/usr_90.jax /*90.1* +90.2 ../../plugins/vimdoc-ja/doc/usr_90.jax /*90.2* +90.3 ../../plugins/vimdoc-ja/doc/usr_90.jax /*90.3* +90.4 ../../plugins/vimdoc-ja/doc/usr_90.jax /*90.4* +90.5 ../../plugins/vimdoc-ja/doc/usr_90.jax /*90.5* +: ../../plugins/vimdoc-ja/doc/cmdline.jax /*:* +:! ../../plugins/vimdoc-ja/doc/various.jax /*:!* +:!! ../../plugins/vimdoc-ja/doc/various.jax /*:!!* +:!cmd ../../plugins/vimdoc-ja/doc/various.jax /*:!cmd* +:!start ../../plugins/vimdoc-ja/doc/os_win32.jax /*:!start* +:# ../../plugins/vimdoc-ja/doc/various.jax /*:#* +:#! ../../plugins/vimdoc-ja/doc/various.jax /*:#!* +:$ ../../plugins/vimdoc-ja/doc/cmdline.jax /*:$* +:% ../../plugins/vimdoc-ja/doc/cmdline.jax /*:%* +:& ../../plugins/vimdoc-ja/doc/change.jax /*:&* +:&& ../../plugins/vimdoc-ja/doc/change.jax /*:&&* +:' ../../plugins/vimdoc-ja/doc/cmdline.jax /*:'* +:, ../../plugins/vimdoc-ja/doc/cmdline.jax /*:,* +:. ../../plugins/vimdoc-ja/doc/cmdline.jax /*:.* +:/ ../../plugins/vimdoc-ja/doc/cmdline.jax /*:\/* +:0file ../../plugins/vimdoc-ja/doc/editing.jax /*:0file* +:2match ../../plugins/vimdoc-ja/doc/pattern.jax /*:2match* +:3match ../../plugins/vimdoc-ja/doc/pattern.jax /*:3match* +::. ../../plugins/vimdoc-ja/doc/cmdline.jax /*::.* +::8 ../../plugins/vimdoc-ja/doc/cmdline.jax /*::8* +::S ../../plugins/vimdoc-ja/doc/cmdline.jax /*::S* +::e ../../plugins/vimdoc-ja/doc/cmdline.jax /*::e* +::gs ../../plugins/vimdoc-ja/doc/cmdline.jax /*::gs* +::h ../../plugins/vimdoc-ja/doc/cmdline.jax /*::h* +::p ../../plugins/vimdoc-ja/doc/cmdline.jax /*::p* +::r ../../plugins/vimdoc-ja/doc/cmdline.jax /*::r* +::s ../../plugins/vimdoc-ja/doc/cmdline.jax /*::s* +::t ../../plugins/vimdoc-ja/doc/cmdline.jax /*::t* +::~ ../../plugins/vimdoc-ja/doc/cmdline.jax /*::~* +:; ../../plugins/vimdoc-ja/doc/cmdline.jax /*:;* +:< ../../plugins/vimdoc-ja/doc/change.jax /*:<* +:<abuf> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<abuf>* +:<afile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<afile>* +:<amatch> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<amatch>* +:<cWORD> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<cWORD>* +:<cfile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<cfile>* +:<cword> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<cword>* +:<sfile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*:<sfile>* +:= ../../plugins/vimdoc-ja/doc/various.jax /*:=* +:> ../../plugins/vimdoc-ja/doc/change.jax /*:>* +:? ../../plugins/vimdoc-ja/doc/cmdline.jax /*:?* +:@ ../../plugins/vimdoc-ja/doc/repeat.jax /*:@* +:@: ../../plugins/vimdoc-ja/doc/repeat.jax /*:@:* +:@@ ../../plugins/vimdoc-ja/doc/repeat.jax /*:@@* +:AdaLines ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaLines* +:AdaRainbow ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaRainbow* +:AdaSpaces ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaSpaces* +:AdaTagDir ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaTagDir* +:AdaTagFile ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaTagFile* +:AdaTypes ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:AdaTypes* +:CompilerSet ../../plugins/vimdoc-ja/doc/usr_41.jax /*:CompilerSet* +:DiffOrig ../../plugins/vimdoc-ja/doc/diff.jax /*:DiffOrig* +:DoMatchParen ../../plugins/vimdoc-ja/doc/pi_paren.jax /*:DoMatchParen* +:Explore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Explore* +:GLVS ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*:GLVS* +:GetLatestVimScripts_dat ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*:GetLatestVimScripts_dat* +:GnatFind ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:GnatFind* +:GnatPretty ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:GnatPretty* +:GnatTags ../../plugins/vimdoc-ja/doc/ft_ada.jax /*:GnatTags* +:Hexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Hexplore* +:LP ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*:LP* +:LPE ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*:LPE* +:LPF ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*:LPF* +:Lexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Lexplore* +:LogiPat ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*:LogiPat* +:Man ../../plugins/vimdoc-ja/doc/filetype.jax /*:Man* +:MkVimball ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*:MkVimball* +:N ../../plugins/vimdoc-ja/doc/editing.jax /*:N* +:NetrwClean ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:NetrwClean* +:Nexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nexplore* +:Next ../../plugins/vimdoc-ja/doc/editing.jax /*:Next* +:NoMatchParen ../../plugins/vimdoc-ja/doc/pi_paren.jax /*:NoMatchParen* +:Nr ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nr* +:Nread ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nread* +:Ns ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Ns* +:Nsource ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nsource* +:Ntree ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Ntree* +:Nw ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nw* +:Nwrite ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Nwrite* +:P ../../plugins/vimdoc-ja/doc/various.jax /*:P* +:Pexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Pexplore* +:Print ../../plugins/vimdoc-ja/doc/various.jax /*:Print* +:Rexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Rexplore* +:RmVimball ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*:RmVimball* +:Sexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Sexplore* +:TOhtml ../../plugins/vimdoc-ja/doc/syntax.jax /*:TOhtml* +:TarDiff ../../plugins/vimdoc-ja/doc/pi_tar.jax /*:TarDiff* +:Texplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Texplore* +:UseVimball ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*:UseVimball* +:Vexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*:Vexplore* +:VimballList ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*:VimballList* +:Vimuntar ../../plugins/vimdoc-ja/doc/pi_tar.jax /*:Vimuntar* +:X ../../plugins/vimdoc-ja/doc/editing.jax /*:X* +:XMLent ../../plugins/vimdoc-ja/doc/insert.jax /*:XMLent* +:XMLns ../../plugins/vimdoc-ja/doc/insert.jax /*:XMLns* +:[range] ../../plugins/vimdoc-ja/doc/motion.jax /*:[range]* +:\bar ../../plugins/vimdoc-ja/doc/cmdline.jax /*:\\bar* +:_! ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_!* +:_# ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_#* +:_## ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_##* +:_#0 ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_#0* +:_#< ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_#<* +:_#n ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_#n* +:_% ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_%* +:_%: ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_%:* +:_%< ../../plugins/vimdoc-ja/doc/cmdline.jax /*:_%<* +:a ../../plugins/vimdoc-ja/doc/insert.jax /*:a* +:ab ../../plugins/vimdoc-ja/doc/map.jax /*:ab* +:abbreviate ../../plugins/vimdoc-ja/doc/map.jax /*:abbreviate* +:abbreviate-<buffer> ../../plugins/vimdoc-ja/doc/map.jax /*:abbreviate-<buffer>* +:abbreviate-local ../../plugins/vimdoc-ja/doc/map.jax /*:abbreviate-local* +:abbreviate-verbose ../../plugins/vimdoc-ja/doc/map.jax /*:abbreviate-verbose* +:abc ../../plugins/vimdoc-ja/doc/map.jax /*:abc* +:abclear ../../plugins/vimdoc-ja/doc/map.jax /*:abclear* +:abo ../../plugins/vimdoc-ja/doc/windows.jax /*:abo* +:aboveleft ../../plugins/vimdoc-ja/doc/windows.jax /*:aboveleft* +:al ../../plugins/vimdoc-ja/doc/windows.jax /*:al* +:all ../../plugins/vimdoc-ja/doc/windows.jax /*:all* +:am ../../plugins/vimdoc-ja/doc/gui.jax /*:am* +:amenu ../../plugins/vimdoc-ja/doc/gui.jax /*:amenu* +:an ../../plugins/vimdoc-ja/doc/gui.jax /*:an* +:anoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:anoremenu* +:append ../../plugins/vimdoc-ja/doc/insert.jax /*:append* +:ar ../../plugins/vimdoc-ja/doc/editing.jax /*:ar* +:arga ../../plugins/vimdoc-ja/doc/editing.jax /*:arga* +:argadd ../../plugins/vimdoc-ja/doc/editing.jax /*:argadd* +:argd ../../plugins/vimdoc-ja/doc/editing.jax /*:argd* +:argdelete ../../plugins/vimdoc-ja/doc/editing.jax /*:argdelete* +:argdo ../../plugins/vimdoc-ja/doc/editing.jax /*:argdo* +:arge ../../plugins/vimdoc-ja/doc/editing.jax /*:arge* +:argedit ../../plugins/vimdoc-ja/doc/editing.jax /*:argedit* +:argglobal ../../plugins/vimdoc-ja/doc/editing.jax /*:argglobal* +:arglocal ../../plugins/vimdoc-ja/doc/editing.jax /*:arglocal* +:args ../../plugins/vimdoc-ja/doc/editing.jax /*:args* +:args_f ../../plugins/vimdoc-ja/doc/editing.jax /*:args_f* +:args_f! ../../plugins/vimdoc-ja/doc/editing.jax /*:args_f!* +:argu ../../plugins/vimdoc-ja/doc/editing.jax /*:argu* +:argument ../../plugins/vimdoc-ja/doc/editing.jax /*:argument* +:as ../../plugins/vimdoc-ja/doc/various.jax /*:as* +:ascii ../../plugins/vimdoc-ja/doc/various.jax /*:ascii* +:au ../../plugins/vimdoc-ja/doc/autocmd.jax /*:au* +:aug ../../plugins/vimdoc-ja/doc/autocmd.jax /*:aug* +:augroup ../../plugins/vimdoc-ja/doc/autocmd.jax /*:augroup* +:augroup-delete ../../plugins/vimdoc-ja/doc/autocmd.jax /*:augroup-delete* +:aun ../../plugins/vimdoc-ja/doc/gui.jax /*:aun* +:aunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:aunmenu* +:autocmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*:autocmd* +:autocmd-verbose ../../plugins/vimdoc-ja/doc/autocmd.jax /*:autocmd-verbose* +:b ../../plugins/vimdoc-ja/doc/windows.jax /*:b* +:bN ../../plugins/vimdoc-ja/doc/windows.jax /*:bN* +:bNext ../../plugins/vimdoc-ja/doc/windows.jax /*:bNext* +:ba ../../plugins/vimdoc-ja/doc/windows.jax /*:ba* +:bad ../../plugins/vimdoc-ja/doc/windows.jax /*:bad* +:badd ../../plugins/vimdoc-ja/doc/windows.jax /*:badd* +:ball ../../plugins/vimdoc-ja/doc/windows.jax /*:ball* +:bar ../../plugins/vimdoc-ja/doc/cmdline.jax /*:bar* +:bd ../../plugins/vimdoc-ja/doc/windows.jax /*:bd* +:bdel ../../plugins/vimdoc-ja/doc/windows.jax /*:bdel* +:bdelete ../../plugins/vimdoc-ja/doc/windows.jax /*:bdelete* +:be ../../plugins/vimdoc-ja/doc/gui.jax /*:be* +:behave ../../plugins/vimdoc-ja/doc/gui.jax /*:behave* +:bel ../../plugins/vimdoc-ja/doc/windows.jax /*:bel* +:belowright ../../plugins/vimdoc-ja/doc/windows.jax /*:belowright* +:bf ../../plugins/vimdoc-ja/doc/windows.jax /*:bf* +:bfirst ../../plugins/vimdoc-ja/doc/windows.jax /*:bfirst* +:bl ../../plugins/vimdoc-ja/doc/windows.jax /*:bl* +:blast ../../plugins/vimdoc-ja/doc/windows.jax /*:blast* +:bm ../../plugins/vimdoc-ja/doc/windows.jax /*:bm* +:bmodified ../../plugins/vimdoc-ja/doc/windows.jax /*:bmodified* +:bn ../../plugins/vimdoc-ja/doc/windows.jax /*:bn* +:bnext ../../plugins/vimdoc-ja/doc/windows.jax /*:bnext* +:bo ../../plugins/vimdoc-ja/doc/windows.jax /*:bo* +:botright ../../plugins/vimdoc-ja/doc/windows.jax /*:botright* +:bp ../../plugins/vimdoc-ja/doc/windows.jax /*:bp* +:bprevious ../../plugins/vimdoc-ja/doc/windows.jax /*:bprevious* +:br ../../plugins/vimdoc-ja/doc/windows.jax /*:br* +:brea ../../plugins/vimdoc-ja/doc/eval.jax /*:brea* +:break ../../plugins/vimdoc-ja/doc/eval.jax /*:break* +:breaka ../../plugins/vimdoc-ja/doc/repeat.jax /*:breaka* +:breakadd ../../plugins/vimdoc-ja/doc/repeat.jax /*:breakadd* +:breakd ../../plugins/vimdoc-ja/doc/repeat.jax /*:breakd* +:breakdel ../../plugins/vimdoc-ja/doc/repeat.jax /*:breakdel* +:breakl ../../plugins/vimdoc-ja/doc/repeat.jax /*:breakl* +:breaklist ../../plugins/vimdoc-ja/doc/repeat.jax /*:breaklist* +:brewind ../../plugins/vimdoc-ja/doc/windows.jax /*:brewind* +:bro ../../plugins/vimdoc-ja/doc/editing.jax /*:bro* +:browse ../../plugins/vimdoc-ja/doc/editing.jax /*:browse* +:browse-set ../../plugins/vimdoc-ja/doc/options.jax /*:browse-set* +:bu ../../plugins/vimdoc-ja/doc/windows.jax /*:bu* +:buf ../../plugins/vimdoc-ja/doc/windows.jax /*:buf* +:bufdo ../../plugins/vimdoc-ja/doc/windows.jax /*:bufdo* +:buffer ../../plugins/vimdoc-ja/doc/windows.jax /*:buffer* +:buffer-! ../../plugins/vimdoc-ja/doc/windows.jax /*:buffer-!* +:buffers ../../plugins/vimdoc-ja/doc/windows.jax /*:buffers* +:bun ../../plugins/vimdoc-ja/doc/windows.jax /*:bun* +:bunload ../../plugins/vimdoc-ja/doc/windows.jax /*:bunload* +:bw ../../plugins/vimdoc-ja/doc/windows.jax /*:bw* +:bwipe ../../plugins/vimdoc-ja/doc/windows.jax /*:bwipe* +:bwipeout ../../plugins/vimdoc-ja/doc/windows.jax /*:bwipeout* +:c ../../plugins/vimdoc-ja/doc/change.jax /*:c* +:cN ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cN* +:cNext ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cNext* +:cNf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cNf* +:cNfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cNfile* +:ca ../../plugins/vimdoc-ja/doc/map.jax /*:ca* +:cabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:cabbrev* +:cabc ../../plugins/vimdoc-ja/doc/map.jax /*:cabc* +:cabclear ../../plugins/vimdoc-ja/doc/map.jax /*:cabclear* +:cad ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cad* +:caddbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:caddbuffer* +:cadde ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cadde* +:caddexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:caddexpr* +:caddf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:caddf* +:caddfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:caddfile* +:cal ../../plugins/vimdoc-ja/doc/eval.jax /*:cal* +:call ../../plugins/vimdoc-ja/doc/eval.jax /*:call* +:cat ../../plugins/vimdoc-ja/doc/eval.jax /*:cat* +:catch ../../plugins/vimdoc-ja/doc/eval.jax /*:catch* +:cb ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cb* +:cbo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cbo* +:cbottom ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cbottom* +:cbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cbuffer* +:cc ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cc* +:ccl ../../plugins/vimdoc-ja/doc/quickfix.jax /*:ccl* +:cclose ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cclose* +:cd ../../plugins/vimdoc-ja/doc/editing.jax /*:cd* +:cd- ../../plugins/vimdoc-ja/doc/editing.jax /*:cd-* +:cdo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cdo* +:ce ../../plugins/vimdoc-ja/doc/change.jax /*:ce* +:center ../../plugins/vimdoc-ja/doc/change.jax /*:center* +:cex ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cex* +:cexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cexpr* +:cf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cf* +:cfdo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cfdo* +:cfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cfile* +:cfir ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cfir* +:cfirst ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cfirst* +:cg ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cg* +:cgetb ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cgetb* +:cgetbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cgetbuffer* +:cgete ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cgete* +:cgetexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cgetexpr* +:cgetfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cgetfile* +:ch ../../plugins/vimdoc-ja/doc/change.jax /*:ch* +:change ../../plugins/vimdoc-ja/doc/change.jax /*:change* +:changes ../../plugins/vimdoc-ja/doc/motion.jax /*:changes* +:chd ../../plugins/vimdoc-ja/doc/editing.jax /*:chd* +:chdir ../../plugins/vimdoc-ja/doc/editing.jax /*:chdir* +:che ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:che* +:checkpath ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:checkpath* +:checkt ../../plugins/vimdoc-ja/doc/editing.jax /*:checkt* +:checktime ../../plugins/vimdoc-ja/doc/editing.jax /*:checktime* +:chi ../../plugins/vimdoc-ja/doc/quickfix.jax /*:chi* +:chistory ../../plugins/vimdoc-ja/doc/quickfix.jax /*:chistory* +:cl ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cl* +:cla ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cla* +:clast ../../plugins/vimdoc-ja/doc/quickfix.jax /*:clast* +:cle ../../plugins/vimdoc-ja/doc/motion.jax /*:cle* +:clearjumps ../../plugins/vimdoc-ja/doc/motion.jax /*:clearjumps* +:clist ../../plugins/vimdoc-ja/doc/quickfix.jax /*:clist* +:clo ../../plugins/vimdoc-ja/doc/windows.jax /*:clo* +:close ../../plugins/vimdoc-ja/doc/windows.jax /*:close* +:cm ../../plugins/vimdoc-ja/doc/map.jax /*:cm* +:cmap ../../plugins/vimdoc-ja/doc/map.jax /*:cmap* +:cmap_l ../../plugins/vimdoc-ja/doc/map.jax /*:cmap_l* +:cmapc ../../plugins/vimdoc-ja/doc/map.jax /*:cmapc* +:cmapclear ../../plugins/vimdoc-ja/doc/map.jax /*:cmapclear* +:cme ../../plugins/vimdoc-ja/doc/gui.jax /*:cme* +:cmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:cmenu* +:cn ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cn* +:cnew ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cnew* +:cnewer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cnewer* +:cnext ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cnext* +:cnf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cnf* +:cnfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cnfile* +:cno ../../plugins/vimdoc-ja/doc/map.jax /*:cno* +:cnorea ../../plugins/vimdoc-ja/doc/map.jax /*:cnorea* +:cnoreabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:cnoreabbrev* +:cnoremap ../../plugins/vimdoc-ja/doc/map.jax /*:cnoremap* +:cnoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:cnoreme* +:cnoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:cnoremenu* +:co ../../plugins/vimdoc-ja/doc/change.jax /*:co* +:col ../../plugins/vimdoc-ja/doc/quickfix.jax /*:col* +:colder ../../plugins/vimdoc-ja/doc/quickfix.jax /*:colder* +:colo ../../plugins/vimdoc-ja/doc/syntax.jax /*:colo* +:colorscheme ../../plugins/vimdoc-ja/doc/syntax.jax /*:colorscheme* +:com ../../plugins/vimdoc-ja/doc/map.jax /*:com* +:comc ../../plugins/vimdoc-ja/doc/map.jax /*:comc* +:comclear ../../plugins/vimdoc-ja/doc/map.jax /*:comclear* +:command ../../plugins/vimdoc-ja/doc/map.jax /*:command* +:command-addr ../../plugins/vimdoc-ja/doc/map.jax /*:command-addr* +:command-bang ../../plugins/vimdoc-ja/doc/map.jax /*:command-bang* +:command-bar ../../plugins/vimdoc-ja/doc/map.jax /*:command-bar* +:command-buffer ../../plugins/vimdoc-ja/doc/map.jax /*:command-buffer* +:command-complete ../../plugins/vimdoc-ja/doc/map.jax /*:command-complete* +:command-completion ../../plugins/vimdoc-ja/doc/map.jax /*:command-completion* +:command-completion-custom ../../plugins/vimdoc-ja/doc/map.jax /*:command-completion-custom* +:command-completion-customlist ../../plugins/vimdoc-ja/doc/map.jax /*:command-completion-customlist* +:command-count ../../plugins/vimdoc-ja/doc/map.jax /*:command-count* +:command-nargs ../../plugins/vimdoc-ja/doc/map.jax /*:command-nargs* +:command-range ../../plugins/vimdoc-ja/doc/map.jax /*:command-range* +:command-register ../../plugins/vimdoc-ja/doc/map.jax /*:command-register* +:command-verbose ../../plugins/vimdoc-ja/doc/map.jax /*:command-verbose* +:comment ../../plugins/vimdoc-ja/doc/cmdline.jax /*:comment* +:comp ../../plugins/vimdoc-ja/doc/quickfix.jax /*:comp* +:compiler ../../plugins/vimdoc-ja/doc/quickfix.jax /*:compiler* +:con ../../plugins/vimdoc-ja/doc/eval.jax /*:con* +:conf ../../plugins/vimdoc-ja/doc/editing.jax /*:conf* +:confirm ../../plugins/vimdoc-ja/doc/editing.jax /*:confirm* +:continue ../../plugins/vimdoc-ja/doc/eval.jax /*:continue* +:cope ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cope* +:copen ../../plugins/vimdoc-ja/doc/quickfix.jax /*:copen* +:copy ../../plugins/vimdoc-ja/doc/change.jax /*:copy* +:cp ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cp* +:cpf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cpf* +:cpfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cpfile* +:cprevious ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cprevious* +:cq ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cq* +:cquit ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cquit* +:cr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cr* +:crewind ../../plugins/vimdoc-ja/doc/quickfix.jax /*:crewind* +:cs ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:cs* +:cscope ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:cscope* +:cstag ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:cstag* +:cu ../../plugins/vimdoc-ja/doc/map.jax /*:cu* +:cuna ../../plugins/vimdoc-ja/doc/map.jax /*:cuna* +:cunabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:cunabbrev* +:cunmap ../../plugins/vimdoc-ja/doc/map.jax /*:cunmap* +:cunme ../../plugins/vimdoc-ja/doc/gui.jax /*:cunme* +:cunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:cunmenu* +:cw ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cw* +:cwindow ../../plugins/vimdoc-ja/doc/quickfix.jax /*:cwindow* +:d ../../plugins/vimdoc-ja/doc/change.jax /*:d* +:de ../../plugins/vimdoc-ja/doc/change.jax /*:de* +:debug ../../plugins/vimdoc-ja/doc/repeat.jax /*:debug* +:debug-name ../../plugins/vimdoc-ja/doc/repeat.jax /*:debug-name* +:debugg ../../plugins/vimdoc-ja/doc/repeat.jax /*:debugg* +:debuggreedy ../../plugins/vimdoc-ja/doc/repeat.jax /*:debuggreedy* +:del ../../plugins/vimdoc-ja/doc/change.jax /*:del* +:delc ../../plugins/vimdoc-ja/doc/map.jax /*:delc* +:delcommand ../../plugins/vimdoc-ja/doc/map.jax /*:delcommand* +:delete ../../plugins/vimdoc-ja/doc/change.jax /*:delete* +:delf ../../plugins/vimdoc-ja/doc/eval.jax /*:delf* +:delfunction ../../plugins/vimdoc-ja/doc/eval.jax /*:delfunction* +:delm ../../plugins/vimdoc-ja/doc/motion.jax /*:delm* +:delmarks ../../plugins/vimdoc-ja/doc/motion.jax /*:delmarks* +:di ../../plugins/vimdoc-ja/doc/change.jax /*:di* +:dif ../../plugins/vimdoc-ja/doc/diff.jax /*:dif* +:diffg ../../plugins/vimdoc-ja/doc/diff.jax /*:diffg* +:diffget ../../plugins/vimdoc-ja/doc/diff.jax /*:diffget* +:diffo ../../plugins/vimdoc-ja/doc/diff.jax /*:diffo* +:diffoff ../../plugins/vimdoc-ja/doc/diff.jax /*:diffoff* +:diffp ../../plugins/vimdoc-ja/doc/diff.jax /*:diffp* +:diffpatch ../../plugins/vimdoc-ja/doc/diff.jax /*:diffpatch* +:diffpu ../../plugins/vimdoc-ja/doc/diff.jax /*:diffpu* +:diffput ../../plugins/vimdoc-ja/doc/diff.jax /*:diffput* +:diffs ../../plugins/vimdoc-ja/doc/diff.jax /*:diffs* +:diffsplit ../../plugins/vimdoc-ja/doc/diff.jax /*:diffsplit* +:difft ../../plugins/vimdoc-ja/doc/diff.jax /*:difft* +:diffthis ../../plugins/vimdoc-ja/doc/diff.jax /*:diffthis* +:diffupdate ../../plugins/vimdoc-ja/doc/diff.jax /*:diffupdate* +:dig ../../plugins/vimdoc-ja/doc/digraph.jax /*:dig* +:digraphs ../../plugins/vimdoc-ja/doc/digraph.jax /*:digraphs* +:display ../../plugins/vimdoc-ja/doc/change.jax /*:display* +:dj ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dj* +:djump ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:djump* +:dl ../../plugins/vimdoc-ja/doc/change.jax /*:dl* +:dli ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dli* +:dlist ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dlist* +:do ../../plugins/vimdoc-ja/doc/autocmd.jax /*:do* +:doau ../../plugins/vimdoc-ja/doc/autocmd.jax /*:doau* +:doautoa ../../plugins/vimdoc-ja/doc/autocmd.jax /*:doautoa* +:doautoall ../../plugins/vimdoc-ja/doc/autocmd.jax /*:doautoall* +:doautocmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*:doautocmd* +:dp ../../plugins/vimdoc-ja/doc/change.jax /*:dp* +:dr ../../plugins/vimdoc-ja/doc/windows.jax /*:dr* +:drop ../../plugins/vimdoc-ja/doc/windows.jax /*:drop* +:ds ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ds* +:dsearch ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dsearch* +:dsp ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dsp* +:dsplit ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:dsplit* +:e ../../plugins/vimdoc-ja/doc/editing.jax /*:e* +:ea ../../plugins/vimdoc-ja/doc/undo.jax /*:ea* +:earlier ../../plugins/vimdoc-ja/doc/undo.jax /*:earlier* +:ec ../../plugins/vimdoc-ja/doc/eval.jax /*:ec* +:echo ../../plugins/vimdoc-ja/doc/eval.jax /*:echo* +:echo-redraw ../../plugins/vimdoc-ja/doc/eval.jax /*:echo-redraw* +:echoe ../../plugins/vimdoc-ja/doc/eval.jax /*:echoe* +:echoerr ../../plugins/vimdoc-ja/doc/eval.jax /*:echoerr* +:echoh ../../plugins/vimdoc-ja/doc/eval.jax /*:echoh* +:echohl ../../plugins/vimdoc-ja/doc/eval.jax /*:echohl* +:echom ../../plugins/vimdoc-ja/doc/eval.jax /*:echom* +:echomsg ../../plugins/vimdoc-ja/doc/eval.jax /*:echomsg* +:echon ../../plugins/vimdoc-ja/doc/eval.jax /*:echon* +:edit ../../plugins/vimdoc-ja/doc/editing.jax /*:edit* +:edit! ../../plugins/vimdoc-ja/doc/editing.jax /*:edit!* +:edit!_f ../../plugins/vimdoc-ja/doc/editing.jax /*:edit!_f* +:edit_f ../../plugins/vimdoc-ja/doc/editing.jax /*:edit_f* +:el ../../plugins/vimdoc-ja/doc/eval.jax /*:el* +:else ../../plugins/vimdoc-ja/doc/eval.jax /*:else* +:elsei ../../plugins/vimdoc-ja/doc/eval.jax /*:elsei* +:elseif ../../plugins/vimdoc-ja/doc/eval.jax /*:elseif* +:em ../../plugins/vimdoc-ja/doc/gui.jax /*:em* +:emenu ../../plugins/vimdoc-ja/doc/gui.jax /*:emenu* +:en ../../plugins/vimdoc-ja/doc/eval.jax /*:en* +:endf ../../plugins/vimdoc-ja/doc/eval.jax /*:endf* +:endfo ../../plugins/vimdoc-ja/doc/eval.jax /*:endfo* +:endfor ../../plugins/vimdoc-ja/doc/eval.jax /*:endfor* +:endfunction ../../plugins/vimdoc-ja/doc/eval.jax /*:endfunction* +:endif ../../plugins/vimdoc-ja/doc/eval.jax /*:endif* +:endt ../../plugins/vimdoc-ja/doc/eval.jax /*:endt* +:endtry ../../plugins/vimdoc-ja/doc/eval.jax /*:endtry* +:endw ../../plugins/vimdoc-ja/doc/eval.jax /*:endw* +:endwhile ../../plugins/vimdoc-ja/doc/eval.jax /*:endwhile* +:ene ../../plugins/vimdoc-ja/doc/editing.jax /*:ene* +:ene! ../../plugins/vimdoc-ja/doc/editing.jax /*:ene!* +:enew ../../plugins/vimdoc-ja/doc/editing.jax /*:enew* +:enew! ../../plugins/vimdoc-ja/doc/editing.jax /*:enew!* +:ex ../../plugins/vimdoc-ja/doc/editing.jax /*:ex* +:exe ../../plugins/vimdoc-ja/doc/eval.jax /*:exe* +:exe-comment ../../plugins/vimdoc-ja/doc/eval.jax /*:exe-comment* +:execute ../../plugins/vimdoc-ja/doc/eval.jax /*:execute* +:exi ../../plugins/vimdoc-ja/doc/editing.jax /*:exi* +:exit ../../plugins/vimdoc-ja/doc/editing.jax /*:exit* +:exu ../../plugins/vimdoc-ja/doc/helphelp.jax /*:exu* +:exusage ../../plugins/vimdoc-ja/doc/helphelp.jax /*:exusage* +:f ../../plugins/vimdoc-ja/doc/editing.jax /*:f* +:fi ../../plugins/vimdoc-ja/doc/editing.jax /*:fi* +:file ../../plugins/vimdoc-ja/doc/editing.jax /*:file* +:file_f ../../plugins/vimdoc-ja/doc/editing.jax /*:file_f* +:filename ../../plugins/vimdoc-ja/doc/editing.jax /*:filename* +:files ../../plugins/vimdoc-ja/doc/windows.jax /*:files* +:filet ../../plugins/vimdoc-ja/doc/filetype.jax /*:filet* +:filetype ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype* +:filetype-indent-off ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-indent-off* +:filetype-indent-on ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-indent-on* +:filetype-off ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-off* +:filetype-overview ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-overview* +:filetype-plugin-off ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-plugin-off* +:filetype-plugin-on ../../plugins/vimdoc-ja/doc/filetype.jax /*:filetype-plugin-on* +:filt ../../plugins/vimdoc-ja/doc/various.jax /*:filt* +:filter ../../plugins/vimdoc-ja/doc/various.jax /*:filter* +:fin ../../plugins/vimdoc-ja/doc/editing.jax /*:fin* +:fina ../../plugins/vimdoc-ja/doc/eval.jax /*:fina* +:finally ../../plugins/vimdoc-ja/doc/eval.jax /*:finally* +:find ../../plugins/vimdoc-ja/doc/editing.jax /*:find* +:fini ../../plugins/vimdoc-ja/doc/repeat.jax /*:fini* +:finish ../../plugins/vimdoc-ja/doc/repeat.jax /*:finish* +:fir ../../plugins/vimdoc-ja/doc/editing.jax /*:fir* +:first ../../plugins/vimdoc-ja/doc/editing.jax /*:first* +:fix ../../plugins/vimdoc-ja/doc/options.jax /*:fix* +:fixdel ../../plugins/vimdoc-ja/doc/options.jax /*:fixdel* +:fo ../../plugins/vimdoc-ja/doc/fold.jax /*:fo* +:fold ../../plugins/vimdoc-ja/doc/fold.jax /*:fold* +:foldc ../../plugins/vimdoc-ja/doc/fold.jax /*:foldc* +:foldclose ../../plugins/vimdoc-ja/doc/fold.jax /*:foldclose* +:foldd ../../plugins/vimdoc-ja/doc/fold.jax /*:foldd* +:folddoc ../../plugins/vimdoc-ja/doc/fold.jax /*:folddoc* +:folddoclosed ../../plugins/vimdoc-ja/doc/fold.jax /*:folddoclosed* +:folddoopen ../../plugins/vimdoc-ja/doc/fold.jax /*:folddoopen* +:foldo ../../plugins/vimdoc-ja/doc/fold.jax /*:foldo* +:foldopen ../../plugins/vimdoc-ja/doc/fold.jax /*:foldopen* +:for ../../plugins/vimdoc-ja/doc/eval.jax /*:for* +:fu ../../plugins/vimdoc-ja/doc/eval.jax /*:fu* +:func-abort ../../plugins/vimdoc-ja/doc/eval.jax /*:func-abort* +:func-closure ../../plugins/vimdoc-ja/doc/eval.jax /*:func-closure* +:func-dict ../../plugins/vimdoc-ja/doc/eval.jax /*:func-dict* +:func-range ../../plugins/vimdoc-ja/doc/eval.jax /*:func-range* +:function ../../plugins/vimdoc-ja/doc/eval.jax /*:function* +:function-verbose ../../plugins/vimdoc-ja/doc/eval.jax /*:function-verbose* +:g ../../plugins/vimdoc-ja/doc/repeat.jax /*:g* +:global ../../plugins/vimdoc-ja/doc/repeat.jax /*:global* +:go ../../plugins/vimdoc-ja/doc/motion.jax /*:go* +:goto ../../plugins/vimdoc-ja/doc/motion.jax /*:goto* +:gr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:gr* +:grep ../../plugins/vimdoc-ja/doc/quickfix.jax /*:grep* +:grepa ../../plugins/vimdoc-ja/doc/quickfix.jax /*:grepa* +:grepadd ../../plugins/vimdoc-ja/doc/quickfix.jax /*:grepadd* +:gu ../../plugins/vimdoc-ja/doc/gui_x11.jax /*:gu* +:gui ../../plugins/vimdoc-ja/doc/gui_x11.jax /*:gui* +:gv ../../plugins/vimdoc-ja/doc/gui_x11.jax /*:gv* +:gvim ../../plugins/vimdoc-ja/doc/gui_x11.jax /*:gvim* +:h ../../plugins/vimdoc-ja/doc/helphelp.jax /*:h* +:ha ../../plugins/vimdoc-ja/doc/print.jax /*:ha* +:hardcopy ../../plugins/vimdoc-ja/doc/print.jax /*:hardcopy* +:help ../../plugins/vimdoc-ja/doc/helphelp.jax /*:help* +:helpc ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpc* +:helpclose ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpclose* +:helpf ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpf* +:helpfind ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpfind* +:helpg ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpg* +:helpgrep ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpgrep* +:helpt ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helpt* +:helptags ../../plugins/vimdoc-ja/doc/helphelp.jax /*:helptags* +:hi ../../plugins/vimdoc-ja/doc/syntax.jax /*:hi* +:hi-default ../../plugins/vimdoc-ja/doc/syntax.jax /*:hi-default* +:hi-link ../../plugins/vimdoc-ja/doc/syntax.jax /*:hi-link* +:hi-normal ../../plugins/vimdoc-ja/doc/syntax.jax /*:hi-normal* +:hi-normal-cterm ../../plugins/vimdoc-ja/doc/syntax.jax /*:hi-normal-cterm* +:hide ../../plugins/vimdoc-ja/doc/windows.jax /*:hide* +:highlight ../../plugins/vimdoc-ja/doc/syntax.jax /*:highlight* +:highlight-default ../../plugins/vimdoc-ja/doc/syntax.jax /*:highlight-default* +:highlight-link ../../plugins/vimdoc-ja/doc/syntax.jax /*:highlight-link* +:highlight-normal ../../plugins/vimdoc-ja/doc/syntax.jax /*:highlight-normal* +:highlight-verbose ../../plugins/vimdoc-ja/doc/syntax.jax /*:highlight-verbose* +:his ../../plugins/vimdoc-ja/doc/cmdline.jax /*:his* +:history ../../plugins/vimdoc-ja/doc/cmdline.jax /*:history* +:history-indexing ../../plugins/vimdoc-ja/doc/cmdline.jax /*:history-indexing* +:i ../../plugins/vimdoc-ja/doc/insert.jax /*:i* +:ia ../../plugins/vimdoc-ja/doc/map.jax /*:ia* +:iabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:iabbrev* +:iabc ../../plugins/vimdoc-ja/doc/map.jax /*:iabc* +:iabclear ../../plugins/vimdoc-ja/doc/map.jax /*:iabclear* +:if ../../plugins/vimdoc-ja/doc/eval.jax /*:if* +:ij ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ij* +:ijump ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ijump* +:il ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:il* +:ilist ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ilist* +:im ../../plugins/vimdoc-ja/doc/map.jax /*:im* +:imap ../../plugins/vimdoc-ja/doc/map.jax /*:imap* +:imap_l ../../plugins/vimdoc-ja/doc/map.jax /*:imap_l* +:imapc ../../plugins/vimdoc-ja/doc/map.jax /*:imapc* +:imapclear ../../plugins/vimdoc-ja/doc/map.jax /*:imapclear* +:ime ../../plugins/vimdoc-ja/doc/gui.jax /*:ime* +:imenu ../../plugins/vimdoc-ja/doc/gui.jax /*:imenu* +:in ../../plugins/vimdoc-ja/doc/insert.jax /*:in* +:index ../../plugins/vimdoc-ja/doc/index.jax /*:index* +:ino ../../plugins/vimdoc-ja/doc/map.jax /*:ino* +:inorea ../../plugins/vimdoc-ja/doc/map.jax /*:inorea* +:inoreabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:inoreabbrev* +:inoremap ../../plugins/vimdoc-ja/doc/map.jax /*:inoremap* +:inoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:inoreme* +:inoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:inoremenu* +:insert ../../plugins/vimdoc-ja/doc/insert.jax /*:insert* +:intro ../../plugins/vimdoc-ja/doc/starting.jax /*:intro* +:is ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:is* +:isearch ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:isearch* +:isp ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:isp* +:isplit ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:isplit* +:iu ../../plugins/vimdoc-ja/doc/map.jax /*:iu* +:iuna ../../plugins/vimdoc-ja/doc/map.jax /*:iuna* +:iunabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:iunabbrev* +:iunmap ../../plugins/vimdoc-ja/doc/map.jax /*:iunmap* +:iunme ../../plugins/vimdoc-ja/doc/gui.jax /*:iunme* +:iunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:iunmenu* +:j ../../plugins/vimdoc-ja/doc/change.jax /*:j* +:join ../../plugins/vimdoc-ja/doc/change.jax /*:join* +:ju ../../plugins/vimdoc-ja/doc/motion.jax /*:ju* +:jumps ../../plugins/vimdoc-ja/doc/motion.jax /*:jumps* +:k ../../plugins/vimdoc-ja/doc/motion.jax /*:k* +:kee ../../plugins/vimdoc-ja/doc/motion.jax /*:kee* +:keepa ../../plugins/vimdoc-ja/doc/editing.jax /*:keepa* +:keepalt ../../plugins/vimdoc-ja/doc/editing.jax /*:keepalt* +:keepj ../../plugins/vimdoc-ja/doc/motion.jax /*:keepj* +:keepjumps ../../plugins/vimdoc-ja/doc/motion.jax /*:keepjumps* +:keepmarks ../../plugins/vimdoc-ja/doc/motion.jax /*:keepmarks* +:keepp ../../plugins/vimdoc-ja/doc/cmdline.jax /*:keepp* +:keeppatterns ../../plugins/vimdoc-ja/doc/cmdline.jax /*:keeppatterns* +:l ../../plugins/vimdoc-ja/doc/various.jax /*:l* +:lN ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lN* +:lNext ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lNext* +:lNf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lNf* +:lNfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lNfile* +:la ../../plugins/vimdoc-ja/doc/editing.jax /*:la* +:lad ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lad* +:laddb ../../plugins/vimdoc-ja/doc/quickfix.jax /*:laddb* +:laddbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:laddbuffer* +:laddexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:laddexpr* +:laddf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:laddf* +:laddfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:laddfile* +:lan ../../plugins/vimdoc-ja/doc/mlang.jax /*:lan* +:lang ../../plugins/vimdoc-ja/doc/mlang.jax /*:lang* +:language ../../plugins/vimdoc-ja/doc/mlang.jax /*:language* +:last ../../plugins/vimdoc-ja/doc/editing.jax /*:last* +:lat ../../plugins/vimdoc-ja/doc/undo.jax /*:lat* +:later ../../plugins/vimdoc-ja/doc/undo.jax /*:later* +:lb ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lb* +:lbo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lbo* +:lbottom ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lbottom* +:lbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lbuffer* +:lc ../../plugins/vimdoc-ja/doc/editing.jax /*:lc* +:lcd ../../plugins/vimdoc-ja/doc/editing.jax /*:lcd* +:lch ../../plugins/vimdoc-ja/doc/editing.jax /*:lch* +:lchdir ../../plugins/vimdoc-ja/doc/editing.jax /*:lchdir* +:lcl ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lcl* +:lclose ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lclose* +:lcs ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:lcs* +:lcscope ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:lcscope* +:ldo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:ldo* +:le ../../plugins/vimdoc-ja/doc/change.jax /*:le* +:left ../../plugins/vimdoc-ja/doc/change.jax /*:left* +:lefta ../../plugins/vimdoc-ja/doc/windows.jax /*:lefta* +:leftabove ../../plugins/vimdoc-ja/doc/windows.jax /*:leftabove* +:let ../../plugins/vimdoc-ja/doc/eval.jax /*:let* +:let+= ../../plugins/vimdoc-ja/doc/eval.jax /*:let+=* +:let-$ ../../plugins/vimdoc-ja/doc/eval.jax /*:let-$* +:let-& ../../plugins/vimdoc-ja/doc/eval.jax /*:let-&* +:let-= ../../plugins/vimdoc-ja/doc/eval.jax /*:let-=* +:let-@ ../../plugins/vimdoc-ja/doc/eval.jax /*:let-@* +:let-environment ../../plugins/vimdoc-ja/doc/eval.jax /*:let-environment* +:let-option ../../plugins/vimdoc-ja/doc/eval.jax /*:let-option* +:let-register ../../plugins/vimdoc-ja/doc/eval.jax /*:let-register* +:let-unpack ../../plugins/vimdoc-ja/doc/eval.jax /*:let-unpack* +:let.= ../../plugins/vimdoc-ja/doc/eval.jax /*:let.=* +:lex ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lex* +:lexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lexpr* +:lf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lf* +:lfdo ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lfdo* +:lfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lfile* +:lfir ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lfir* +:lfirst ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lfirst* +:lg ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lg* +:lgetb ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgetb* +:lgetbuffer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgetbuffer* +:lgete ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgete* +:lgetexpr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgetexpr* +:lgetfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgetfile* +:lgr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgr* +:lgrep ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgrep* +:lgrepa ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgrepa* +:lgrepadd ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lgrepadd* +:lh ../../plugins/vimdoc-ja/doc/helphelp.jax /*:lh* +:lhelpgrep ../../plugins/vimdoc-ja/doc/helphelp.jax /*:lhelpgrep* +:lhi ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lhi* +:lhistory ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lhistory* +:list ../../plugins/vimdoc-ja/doc/various.jax /*:list* +:ll ../../plugins/vimdoc-ja/doc/quickfix.jax /*:ll* +:lla ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lla* +:llast ../../plugins/vimdoc-ja/doc/quickfix.jax /*:llast* +:lli ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lli* +:llist ../../plugins/vimdoc-ja/doc/quickfix.jax /*:llist* +:lm ../../plugins/vimdoc-ja/doc/map.jax /*:lm* +:lmak ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lmak* +:lmake ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lmake* +:lmap ../../plugins/vimdoc-ja/doc/map.jax /*:lmap* +:lmap_l ../../plugins/vimdoc-ja/doc/map.jax /*:lmap_l* +:lmapc ../../plugins/vimdoc-ja/doc/map.jax /*:lmapc* +:lmapclear ../../plugins/vimdoc-ja/doc/map.jax /*:lmapclear* +:ln ../../plugins/vimdoc-ja/doc/map.jax /*:ln* +:lne ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lne* +:lnew ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lnew* +:lnewer ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lnewer* +:lnext ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lnext* +:lnf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lnf* +:lnfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lnfile* +:lnoremap ../../plugins/vimdoc-ja/doc/map.jax /*:lnoremap* +:lo ../../plugins/vimdoc-ja/doc/starting.jax /*:lo* +:loadk ../../plugins/vimdoc-ja/doc/mbyte.jax /*:loadk* +:loadkeymap ../../plugins/vimdoc-ja/doc/mbyte.jax /*:loadkeymap* +:loadview ../../plugins/vimdoc-ja/doc/starting.jax /*:loadview* +:loc ../../plugins/vimdoc-ja/doc/motion.jax /*:loc* +:lockmarks ../../plugins/vimdoc-ja/doc/motion.jax /*:lockmarks* +:lockv ../../plugins/vimdoc-ja/doc/eval.jax /*:lockv* +:lockvar ../../plugins/vimdoc-ja/doc/eval.jax /*:lockvar* +:lol ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lol* +:lolder ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lolder* +:lop ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lop* +:lopen ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lopen* +:lp ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lp* +:lpf ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lpf* +:lpfile ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lpfile* +:lprevious ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lprevious* +:lr ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lr* +:lrewind ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lrewind* +:ls ../../plugins/vimdoc-ja/doc/windows.jax /*:ls* +:lt ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:lt* +:ltag ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ltag* +:lu ../../plugins/vimdoc-ja/doc/map.jax /*:lu* +:lua ../../plugins/vimdoc-ja/doc/if_lua.jax /*:lua* +:luado ../../plugins/vimdoc-ja/doc/if_lua.jax /*:luado* +:luafile ../../plugins/vimdoc-ja/doc/if_lua.jax /*:luafile* +:lunmap ../../plugins/vimdoc-ja/doc/map.jax /*:lunmap* +:lv ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lv* +:lvimgrep ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lvimgrep* +:lvimgrepa ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lvimgrepa* +:lvimgrepadd ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lvimgrepadd* +:lw ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lw* +:lwindow ../../plugins/vimdoc-ja/doc/quickfix.jax /*:lwindow* +:m ../../plugins/vimdoc-ja/doc/change.jax /*:m* +:ma ../../plugins/vimdoc-ja/doc/motion.jax /*:ma* +:mak ../../plugins/vimdoc-ja/doc/quickfix.jax /*:mak* +:make ../../plugins/vimdoc-ja/doc/quickfix.jax /*:make* +:make_makeprg ../../plugins/vimdoc-ja/doc/quickfix.jax /*:make_makeprg* +:map ../../plugins/vimdoc-ja/doc/map.jax /*:map* +:map! ../../plugins/vimdoc-ja/doc/map.jax /*:map!* +:map-<buffer> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<buffer>* +:map-<expr> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<expr>* +:map-<nowait> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<nowait>* +:map-<script> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<script>* +:map-<silent> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<silent>* +:map-<special> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<special>* +:map-<unique> ../../plugins/vimdoc-ja/doc/map.jax /*:map-<unique>* +:map-alt-keys ../../plugins/vimdoc-ja/doc/map.jax /*:map-alt-keys* +:map-arguments ../../plugins/vimdoc-ja/doc/map.jax /*:map-arguments* +:map-commands ../../plugins/vimdoc-ja/doc/map.jax /*:map-commands* +:map-expression ../../plugins/vimdoc-ja/doc/map.jax /*:map-expression* +:map-local ../../plugins/vimdoc-ja/doc/map.jax /*:map-local* +:map-modes ../../plugins/vimdoc-ja/doc/map.jax /*:map-modes* +:map-nowait ../../plugins/vimdoc-ja/doc/map.jax /*:map-nowait* +:map-operator ../../plugins/vimdoc-ja/doc/map.jax /*:map-operator* +:map-script ../../plugins/vimdoc-ja/doc/map.jax /*:map-script* +:map-silent ../../plugins/vimdoc-ja/doc/map.jax /*:map-silent* +:map-special ../../plugins/vimdoc-ja/doc/map.jax /*:map-special* +:map-special-chars ../../plugins/vimdoc-ja/doc/map.jax /*:map-special-chars* +:map-special-keys ../../plugins/vimdoc-ja/doc/map.jax /*:map-special-keys* +:map-undo ../../plugins/vimdoc-ja/doc/map.jax /*:map-undo* +:map-verbose ../../plugins/vimdoc-ja/doc/map.jax /*:map-verbose* +:map_l ../../plugins/vimdoc-ja/doc/map.jax /*:map_l* +:map_l! ../../plugins/vimdoc-ja/doc/map.jax /*:map_l!* +:mapc ../../plugins/vimdoc-ja/doc/map.jax /*:mapc* +:mapc! ../../plugins/vimdoc-ja/doc/map.jax /*:mapc!* +:mapclear ../../plugins/vimdoc-ja/doc/map.jax /*:mapclear* +:mapclear! ../../plugins/vimdoc-ja/doc/map.jax /*:mapclear!* +:mark ../../plugins/vimdoc-ja/doc/motion.jax /*:mark* +:marks ../../plugins/vimdoc-ja/doc/motion.jax /*:marks* +:mat ../../plugins/vimdoc-ja/doc/pattern.jax /*:mat* +:match ../../plugins/vimdoc-ja/doc/pattern.jax /*:match* +:me ../../plugins/vimdoc-ja/doc/gui.jax /*:me* +:menu ../../plugins/vimdoc-ja/doc/gui.jax /*:menu* +:menu-<script> ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-<script>* +:menu-<silent> ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-<silent>* +:menu-<special> ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-<special>* +:menu-disable ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-disable* +:menu-enable ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-enable* +:menu-script ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-script* +:menu-silent ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-silent* +:menu-special ../../plugins/vimdoc-ja/doc/gui.jax /*:menu-special* +:menut ../../plugins/vimdoc-ja/doc/mlang.jax /*:menut* +:menutrans ../../plugins/vimdoc-ja/doc/mlang.jax /*:menutrans* +:menutranslate ../../plugins/vimdoc-ja/doc/mlang.jax /*:menutranslate* +:mes ../../plugins/vimdoc-ja/doc/message.jax /*:mes* +:messages ../../plugins/vimdoc-ja/doc/message.jax /*:messages* +:mk ../../plugins/vimdoc-ja/doc/starting.jax /*:mk* +:mkexrc ../../plugins/vimdoc-ja/doc/starting.jax /*:mkexrc* +:mks ../../plugins/vimdoc-ja/doc/starting.jax /*:mks* +:mksession ../../plugins/vimdoc-ja/doc/starting.jax /*:mksession* +:mksp ../../plugins/vimdoc-ja/doc/spell.jax /*:mksp* +:mkspell ../../plugins/vimdoc-ja/doc/spell.jax /*:mkspell* +:mkv ../../plugins/vimdoc-ja/doc/starting.jax /*:mkv* +:mkvie ../../plugins/vimdoc-ja/doc/starting.jax /*:mkvie* +:mkview ../../plugins/vimdoc-ja/doc/starting.jax /*:mkview* +:mkvimrc ../../plugins/vimdoc-ja/doc/starting.jax /*:mkvimrc* +:mo ../../plugins/vimdoc-ja/doc/change.jax /*:mo* +:mod ../../plugins/vimdoc-ja/doc/term.jax /*:mod* +:mode ../../plugins/vimdoc-ja/doc/term.jax /*:mode* +:move ../../plugins/vimdoc-ja/doc/change.jax /*:move* +:mz ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*:mz* +:mzf ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*:mzf* +:mzfile ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*:mzfile* +:mzscheme ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*:mzscheme* +:n ../../plugins/vimdoc-ja/doc/editing.jax /*:n* +:nbclose ../../plugins/vimdoc-ja/doc/netbeans.jax /*:nbclose* +:nbkey ../../plugins/vimdoc-ja/doc/netbeans.jax /*:nbkey* +:nbstart ../../plugins/vimdoc-ja/doc/netbeans.jax /*:nbstart* +:ne ../../plugins/vimdoc-ja/doc/editing.jax /*:ne* +:new ../../plugins/vimdoc-ja/doc/windows.jax /*:new* +:next ../../plugins/vimdoc-ja/doc/editing.jax /*:next* +:next_f ../../plugins/vimdoc-ja/doc/editing.jax /*:next_f* +:nm ../../plugins/vimdoc-ja/doc/map.jax /*:nm* +:nmap ../../plugins/vimdoc-ja/doc/map.jax /*:nmap* +:nmap_l ../../plugins/vimdoc-ja/doc/map.jax /*:nmap_l* +:nmapc ../../plugins/vimdoc-ja/doc/map.jax /*:nmapc* +:nmapclear ../../plugins/vimdoc-ja/doc/map.jax /*:nmapclear* +:nme ../../plugins/vimdoc-ja/doc/gui.jax /*:nme* +:nmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:nmenu* +:nn ../../plugins/vimdoc-ja/doc/map.jax /*:nn* +:nnoremap ../../plugins/vimdoc-ja/doc/map.jax /*:nnoremap* +:nnoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:nnoreme* +:nnoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:nnoremenu* +:no ../../plugins/vimdoc-ja/doc/map.jax /*:no* +:no! ../../plugins/vimdoc-ja/doc/map.jax /*:no!* +:noa ../../plugins/vimdoc-ja/doc/autocmd.jax /*:noa* +:noautocmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*:noautocmd* +:noh ../../plugins/vimdoc-ja/doc/pattern.jax /*:noh* +:nohlsearch ../../plugins/vimdoc-ja/doc/pattern.jax /*:nohlsearch* +:nor ../../plugins/vimdoc-ja/doc/map.jax /*:nor* +:nore ../../plugins/vimdoc-ja/doc/map.jax /*:nore* +:norea ../../plugins/vimdoc-ja/doc/map.jax /*:norea* +:noreabbrev ../../plugins/vimdoc-ja/doc/map.jax /*:noreabbrev* +:norem ../../plugins/vimdoc-ja/doc/map.jax /*:norem* +:noremap ../../plugins/vimdoc-ja/doc/map.jax /*:noremap* +:noremap! ../../plugins/vimdoc-ja/doc/map.jax /*:noremap!* +:noreme ../../plugins/vimdoc-ja/doc/gui.jax /*:noreme* +:noremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:noremenu* +:norm ../../plugins/vimdoc-ja/doc/various.jax /*:norm* +:normal ../../plugins/vimdoc-ja/doc/various.jax /*:normal* +:normal-range ../../plugins/vimdoc-ja/doc/various.jax /*:normal-range* +:nos ../../plugins/vimdoc-ja/doc/recover.jax /*:nos* +:noswapfile ../../plugins/vimdoc-ja/doc/recover.jax /*:noswapfile* +:nu ../../plugins/vimdoc-ja/doc/various.jax /*:nu* +:number ../../plugins/vimdoc-ja/doc/various.jax /*:number* +:nun ../../plugins/vimdoc-ja/doc/map.jax /*:nun* +:nunmap ../../plugins/vimdoc-ja/doc/map.jax /*:nunmap* +:nunme ../../plugins/vimdoc-ja/doc/gui.jax /*:nunme* +:nunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:nunmenu* +:o ../../plugins/vimdoc-ja/doc/vi_diff.jax /*:o* +:ol ../../plugins/vimdoc-ja/doc/starting.jax /*:ol* +:oldfiles ../../plugins/vimdoc-ja/doc/starting.jax /*:oldfiles* +:om ../../plugins/vimdoc-ja/doc/map.jax /*:om* +:omap ../../plugins/vimdoc-ja/doc/map.jax /*:omap* +:omap_l ../../plugins/vimdoc-ja/doc/map.jax /*:omap_l* +:omapc ../../plugins/vimdoc-ja/doc/map.jax /*:omapc* +:omapclear ../../plugins/vimdoc-ja/doc/map.jax /*:omapclear* +:ome ../../plugins/vimdoc-ja/doc/gui.jax /*:ome* +:omenu ../../plugins/vimdoc-ja/doc/gui.jax /*:omenu* +:on ../../plugins/vimdoc-ja/doc/windows.jax /*:on* +:only ../../plugins/vimdoc-ja/doc/windows.jax /*:only* +:ono ../../plugins/vimdoc-ja/doc/map.jax /*:ono* +:onoremap ../../plugins/vimdoc-ja/doc/map.jax /*:onoremap* +:onoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:onoreme* +:onoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:onoremenu* +:op ../../plugins/vimdoc-ja/doc/vi_diff.jax /*:op* +:open ../../plugins/vimdoc-ja/doc/vi_diff.jax /*:open* +:opt ../../plugins/vimdoc-ja/doc/options.jax /*:opt* +:options ../../plugins/vimdoc-ja/doc/options.jax /*:options* +:ou ../../plugins/vimdoc-ja/doc/map.jax /*:ou* +:ounmap ../../plugins/vimdoc-ja/doc/map.jax /*:ounmap* +:ounme ../../plugins/vimdoc-ja/doc/gui.jax /*:ounme* +:ounmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:ounmenu* +:ownsyntax ../../plugins/vimdoc-ja/doc/syntax.jax /*:ownsyntax* +:p ../../plugins/vimdoc-ja/doc/various.jax /*:p* +:pa ../../plugins/vimdoc-ja/doc/repeat.jax /*:pa* +:packadd ../../plugins/vimdoc-ja/doc/repeat.jax /*:packadd* +:packl ../../plugins/vimdoc-ja/doc/repeat.jax /*:packl* +:packloadall ../../plugins/vimdoc-ja/doc/repeat.jax /*:packloadall* +:pc ../../plugins/vimdoc-ja/doc/windows.jax /*:pc* +:pclose ../../plugins/vimdoc-ja/doc/windows.jax /*:pclose* +:pe ../../plugins/vimdoc-ja/doc/if_perl.jax /*:pe* +:ped ../../plugins/vimdoc-ja/doc/windows.jax /*:ped* +:pedit ../../plugins/vimdoc-ja/doc/windows.jax /*:pedit* +:perl ../../plugins/vimdoc-ja/doc/if_perl.jax /*:perl* +:perld ../../plugins/vimdoc-ja/doc/if_perl.jax /*:perld* +:perldo ../../plugins/vimdoc-ja/doc/if_perl.jax /*:perldo* +:po ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:po* +:pop ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:pop* +:popu ../../plugins/vimdoc-ja/doc/gui.jax /*:popu* +:popup ../../plugins/vimdoc-ja/doc/gui.jax /*:popup* +:pp ../../plugins/vimdoc-ja/doc/windows.jax /*:pp* +:ppop ../../plugins/vimdoc-ja/doc/windows.jax /*:ppop* +:pr ../../plugins/vimdoc-ja/doc/various.jax /*:pr* +:pre ../../plugins/vimdoc-ja/doc/recover.jax /*:pre* +:preserve ../../plugins/vimdoc-ja/doc/recover.jax /*:preserve* +:prev ../../plugins/vimdoc-ja/doc/editing.jax /*:prev* +:previous ../../plugins/vimdoc-ja/doc/editing.jax /*:previous* +:print ../../plugins/vimdoc-ja/doc/various.jax /*:print* +:pro ../../plugins/vimdoc-ja/doc/change.jax /*:pro* +:prof ../../plugins/vimdoc-ja/doc/repeat.jax /*:prof* +:profd ../../plugins/vimdoc-ja/doc/repeat.jax /*:profd* +:profdel ../../plugins/vimdoc-ja/doc/repeat.jax /*:profdel* +:profile ../../plugins/vimdoc-ja/doc/repeat.jax /*:profile* +:promptfind ../../plugins/vimdoc-ja/doc/change.jax /*:promptfind* +:promptr ../../plugins/vimdoc-ja/doc/change.jax /*:promptr* +:promptrepl ../../plugins/vimdoc-ja/doc/change.jax /*:promptrepl* +:ps ../../plugins/vimdoc-ja/doc/windows.jax /*:ps* +:psearch ../../plugins/vimdoc-ja/doc/windows.jax /*:psearch* +:ptN ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptN* +:ptNext ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptNext* +:pta ../../plugins/vimdoc-ja/doc/windows.jax /*:pta* +:ptag ../../plugins/vimdoc-ja/doc/windows.jax /*:ptag* +:ptf ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptf* +:ptfirst ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptfirst* +:ptj ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptj* +:ptjump ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptjump* +:ptl ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptl* +:ptlast ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptlast* +:ptn ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptn* +:ptnext ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptnext* +:ptp ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptp* +:ptprevious ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptprevious* +:ptr ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptr* +:ptrewind ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptrewind* +:pts ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:pts* +:ptselect ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ptselect* +:pu ../../plugins/vimdoc-ja/doc/change.jax /*:pu* +:put ../../plugins/vimdoc-ja/doc/change.jax /*:put* +:pw ../../plugins/vimdoc-ja/doc/editing.jax /*:pw* +:pwd ../../plugins/vimdoc-ja/doc/editing.jax /*:pwd* +:py ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:py* +:py3 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:py3* +:py3do ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:py3do* +:py3file ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:py3file* +:pydo ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:pydo* +:pyf ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:pyf* +:pyfile ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:pyfile* +:python ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:python* +:python3 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*:python3* +:q ../../plugins/vimdoc-ja/doc/editing.jax /*:q* +:qa ../../plugins/vimdoc-ja/doc/editing.jax /*:qa* +:qall ../../plugins/vimdoc-ja/doc/editing.jax /*:qall* +:quit ../../plugins/vimdoc-ja/doc/editing.jax /*:quit* +:quita ../../plugins/vimdoc-ja/doc/editing.jax /*:quita* +:quitall ../../plugins/vimdoc-ja/doc/editing.jax /*:quitall* +:quote ../../plugins/vimdoc-ja/doc/cmdline.jax /*:quote* +:r ../../plugins/vimdoc-ja/doc/insert.jax /*:r* +:r! ../../plugins/vimdoc-ja/doc/insert.jax /*:r!* +:range ../../plugins/vimdoc-ja/doc/cmdline.jax /*:range* +:range! ../../plugins/vimdoc-ja/doc/change.jax /*:range!* +:re ../../plugins/vimdoc-ja/doc/insert.jax /*:re* +:read ../../plugins/vimdoc-ja/doc/insert.jax /*:read* +:read! ../../plugins/vimdoc-ja/doc/insert.jax /*:read!* +:rec ../../plugins/vimdoc-ja/doc/recover.jax /*:rec* +:recover ../../plugins/vimdoc-ja/doc/recover.jax /*:recover* +:recover-crypt ../../plugins/vimdoc-ja/doc/recover.jax /*:recover-crypt* +:red ../../plugins/vimdoc-ja/doc/undo.jax /*:red* +:redi ../../plugins/vimdoc-ja/doc/various.jax /*:redi* +:redir ../../plugins/vimdoc-ja/doc/various.jax /*:redir* +:redo ../../plugins/vimdoc-ja/doc/undo.jax /*:redo* +:redr ../../plugins/vimdoc-ja/doc/various.jax /*:redr* +:redraw ../../plugins/vimdoc-ja/doc/various.jax /*:redraw* +:redraws ../../plugins/vimdoc-ja/doc/various.jax /*:redraws* +:redrawstatus ../../plugins/vimdoc-ja/doc/various.jax /*:redrawstatus* +:reg ../../plugins/vimdoc-ja/doc/change.jax /*:reg* +:registers ../../plugins/vimdoc-ja/doc/change.jax /*:registers* +:res ../../plugins/vimdoc-ja/doc/windows.jax /*:res* +:resize ../../plugins/vimdoc-ja/doc/windows.jax /*:resize* +:ret ../../plugins/vimdoc-ja/doc/change.jax /*:ret* +:retab ../../plugins/vimdoc-ja/doc/change.jax /*:retab* +:retab! ../../plugins/vimdoc-ja/doc/change.jax /*:retab!* +:retu ../../plugins/vimdoc-ja/doc/eval.jax /*:retu* +:return ../../plugins/vimdoc-ja/doc/eval.jax /*:return* +:rew ../../plugins/vimdoc-ja/doc/editing.jax /*:rew* +:rewind ../../plugins/vimdoc-ja/doc/editing.jax /*:rewind* +:ri ../../plugins/vimdoc-ja/doc/change.jax /*:ri* +:right ../../plugins/vimdoc-ja/doc/change.jax /*:right* +:rightb ../../plugins/vimdoc-ja/doc/windows.jax /*:rightb* +:rightbelow ../../plugins/vimdoc-ja/doc/windows.jax /*:rightbelow* +:ru ../../plugins/vimdoc-ja/doc/repeat.jax /*:ru* +:rub ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:rub* +:ruby ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:ruby* +:rubyd ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:rubyd* +:rubydo ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:rubydo* +:rubyf ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:rubyf* +:rubyfile ../../plugins/vimdoc-ja/doc/if_ruby.jax /*:rubyfile* +:rundo ../../plugins/vimdoc-ja/doc/undo.jax /*:rundo* +:runtime ../../plugins/vimdoc-ja/doc/repeat.jax /*:runtime* +:rv ../../plugins/vimdoc-ja/doc/starting.jax /*:rv* +:rviminfo ../../plugins/vimdoc-ja/doc/starting.jax /*:rviminfo* +:s ../../plugins/vimdoc-ja/doc/change.jax /*:s* +:s% ../../plugins/vimdoc-ja/doc/change.jax /*:s%* +:sI ../../plugins/vimdoc-ja/doc/change.jax /*:sI* +:sIc ../../plugins/vimdoc-ja/doc/change.jax /*:sIc* +:sIe ../../plugins/vimdoc-ja/doc/change.jax /*:sIe* +:sIg ../../plugins/vimdoc-ja/doc/change.jax /*:sIg* +:sIl ../../plugins/vimdoc-ja/doc/change.jax /*:sIl* +:sIn ../../plugins/vimdoc-ja/doc/change.jax /*:sIn* +:sIp ../../plugins/vimdoc-ja/doc/change.jax /*:sIp* +:sIr ../../plugins/vimdoc-ja/doc/change.jax /*:sIr* +:sN ../../plugins/vimdoc-ja/doc/windows.jax /*:sN* +:sNext ../../plugins/vimdoc-ja/doc/windows.jax /*:sNext* +:s\= ../../plugins/vimdoc-ja/doc/change.jax /*:s\\=* +:s_c ../../plugins/vimdoc-ja/doc/change.jax /*:s_c* +:s_flags ../../plugins/vimdoc-ja/doc/change.jax /*:s_flags* +:sa ../../plugins/vimdoc-ja/doc/windows.jax /*:sa* +:sal ../../plugins/vimdoc-ja/doc/windows.jax /*:sal* +:sall ../../plugins/vimdoc-ja/doc/windows.jax /*:sall* +:san ../../plugins/vimdoc-ja/doc/eval.jax /*:san* +:sandbox ../../plugins/vimdoc-ja/doc/eval.jax /*:sandbox* +:sargument ../../plugins/vimdoc-ja/doc/windows.jax /*:sargument* +:sav ../../plugins/vimdoc-ja/doc/editing.jax /*:sav* +:saveas ../../plugins/vimdoc-ja/doc/editing.jax /*:saveas* +:sb ../../plugins/vimdoc-ja/doc/windows.jax /*:sb* +:sbN ../../plugins/vimdoc-ja/doc/windows.jax /*:sbN* +:sbNext ../../plugins/vimdoc-ja/doc/windows.jax /*:sbNext* +:sba ../../plugins/vimdoc-ja/doc/windows.jax /*:sba* +:sball ../../plugins/vimdoc-ja/doc/windows.jax /*:sball* +:sbf ../../plugins/vimdoc-ja/doc/windows.jax /*:sbf* +:sbfirst ../../plugins/vimdoc-ja/doc/windows.jax /*:sbfirst* +:sbl ../../plugins/vimdoc-ja/doc/windows.jax /*:sbl* +:sblast ../../plugins/vimdoc-ja/doc/windows.jax /*:sblast* +:sbm ../../plugins/vimdoc-ja/doc/windows.jax /*:sbm* +:sbmodified ../../plugins/vimdoc-ja/doc/windows.jax /*:sbmodified* +:sbn ../../plugins/vimdoc-ja/doc/windows.jax /*:sbn* +:sbnext ../../plugins/vimdoc-ja/doc/windows.jax /*:sbnext* +:sbp ../../plugins/vimdoc-ja/doc/windows.jax /*:sbp* +:sbprevious ../../plugins/vimdoc-ja/doc/windows.jax /*:sbprevious* +:sbr ../../plugins/vimdoc-ja/doc/windows.jax /*:sbr* +:sbrewind ../../plugins/vimdoc-ja/doc/windows.jax /*:sbrewind* +:sbuffer ../../plugins/vimdoc-ja/doc/windows.jax /*:sbuffer* +:sc ../../plugins/vimdoc-ja/doc/change.jax /*:sc* +:scI ../../plugins/vimdoc-ja/doc/change.jax /*:scI* +:sce ../../plugins/vimdoc-ja/doc/change.jax /*:sce* +:scg ../../plugins/vimdoc-ja/doc/change.jax /*:scg* +:sci ../../plugins/vimdoc-ja/doc/change.jax /*:sci* +:scl ../../plugins/vimdoc-ja/doc/change.jax /*:scl* +:scp ../../plugins/vimdoc-ja/doc/change.jax /*:scp* +:scr ../../plugins/vimdoc-ja/doc/repeat.jax /*:scr* +:scripte ../../plugins/vimdoc-ja/doc/repeat.jax /*:scripte* +:scriptencoding ../../plugins/vimdoc-ja/doc/repeat.jax /*:scriptencoding* +:scriptnames ../../plugins/vimdoc-ja/doc/repeat.jax /*:scriptnames* +:scs ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:scs* +:scscope ../../plugins/vimdoc-ja/doc/if_cscop.jax /*:scscope* +:se ../../plugins/vimdoc-ja/doc/options.jax /*:se* +:search-args ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:search-args* +:set ../../plugins/vimdoc-ja/doc/options.jax /*:set* +:set+= ../../plugins/vimdoc-ja/doc/options.jax /*:set+=* +:set-! ../../plugins/vimdoc-ja/doc/options.jax /*:set-!* +:set-& ../../plugins/vimdoc-ja/doc/options.jax /*:set-&* +:set-&vi ../../plugins/vimdoc-ja/doc/options.jax /*:set-&vi* +:set-&vim ../../plugins/vimdoc-ja/doc/options.jax /*:set-&vim* +:set-= ../../plugins/vimdoc-ja/doc/options.jax /*:set-=* +:set-args ../../plugins/vimdoc-ja/doc/options.jax /*:set-args* +:set-browse ../../plugins/vimdoc-ja/doc/options.jax /*:set-browse* +:set-default ../../plugins/vimdoc-ja/doc/options.jax /*:set-default* +:set-inv ../../plugins/vimdoc-ja/doc/options.jax /*:set-inv* +:set-termcap ../../plugins/vimdoc-ja/doc/options.jax /*:set-termcap* +:set-verbose ../../plugins/vimdoc-ja/doc/options.jax /*:set-verbose* +:set^= ../../plugins/vimdoc-ja/doc/options.jax /*:set^=* +:set_env ../../plugins/vimdoc-ja/doc/options.jax /*:set_env* +:setf ../../plugins/vimdoc-ja/doc/options.jax /*:setf* +:setfiletype ../../plugins/vimdoc-ja/doc/options.jax /*:setfiletype* +:setg ../../plugins/vimdoc-ja/doc/options.jax /*:setg* +:setglobal ../../plugins/vimdoc-ja/doc/options.jax /*:setglobal* +:setl ../../plugins/vimdoc-ja/doc/options.jax /*:setl* +:setlocal ../../plugins/vimdoc-ja/doc/options.jax /*:setlocal* +:sf ../../plugins/vimdoc-ja/doc/windows.jax /*:sf* +:sfind ../../plugins/vimdoc-ja/doc/windows.jax /*:sfind* +:sfir ../../plugins/vimdoc-ja/doc/windows.jax /*:sfir* +:sfirst ../../plugins/vimdoc-ja/doc/windows.jax /*:sfirst* +:sg ../../plugins/vimdoc-ja/doc/change.jax /*:sg* +:sgI ../../plugins/vimdoc-ja/doc/change.jax /*:sgI* +:sgc ../../plugins/vimdoc-ja/doc/change.jax /*:sgc* +:sge ../../plugins/vimdoc-ja/doc/change.jax /*:sge* +:sgi ../../plugins/vimdoc-ja/doc/change.jax /*:sgi* +:sgl ../../plugins/vimdoc-ja/doc/change.jax /*:sgl* +:sgn ../../plugins/vimdoc-ja/doc/change.jax /*:sgn* +:sgp ../../plugins/vimdoc-ja/doc/change.jax /*:sgp* +:sgr ../../plugins/vimdoc-ja/doc/change.jax /*:sgr* +:sh ../../plugins/vimdoc-ja/doc/various.jax /*:sh* +:shell ../../plugins/vimdoc-ja/doc/various.jax /*:shell* +:si ../../plugins/vimdoc-ja/doc/change.jax /*:si* +:sic ../../plugins/vimdoc-ja/doc/change.jax /*:sic* +:sie ../../plugins/vimdoc-ja/doc/change.jax /*:sie* +:sig ../../plugins/vimdoc-ja/doc/sign.jax /*:sig* +:sign ../../plugins/vimdoc-ja/doc/sign.jax /*:sign* +:sign-define ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-define* +:sign-fname ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-fname* +:sign-jump ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-jump* +:sign-list ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-list* +:sign-place ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-place* +:sign-place-list ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-place-list* +:sign-undefine ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-undefine* +:sign-unplace ../../plugins/vimdoc-ja/doc/sign.jax /*:sign-unplace* +:sil ../../plugins/vimdoc-ja/doc/various.jax /*:sil* +:silent ../../plugins/vimdoc-ja/doc/various.jax /*:silent* +:silent! ../../plugins/vimdoc-ja/doc/various.jax /*:silent!* +:sim ../../plugins/vimdoc-ja/doc/gui_w32.jax /*:sim* +:simalt ../../plugins/vimdoc-ja/doc/gui_w32.jax /*:simalt* +:sin ../../plugins/vimdoc-ja/doc/change.jax /*:sin* +:sip ../../plugins/vimdoc-ja/doc/change.jax /*:sip* +:sir ../../plugins/vimdoc-ja/doc/change.jax /*:sir* +:sl ../../plugins/vimdoc-ja/doc/various.jax /*:sl* +:sla ../../plugins/vimdoc-ja/doc/windows.jax /*:sla* +:slast ../../plugins/vimdoc-ja/doc/windows.jax /*:slast* +:sleep ../../plugins/vimdoc-ja/doc/various.jax /*:sleep* +:sm ../../plugins/vimdoc-ja/doc/change.jax /*:sm* +:smagic ../../plugins/vimdoc-ja/doc/change.jax /*:smagic* +:smap ../../plugins/vimdoc-ja/doc/map.jax /*:smap* +:smap_l ../../plugins/vimdoc-ja/doc/map.jax /*:smap_l* +:smapc ../../plugins/vimdoc-ja/doc/map.jax /*:smapc* +:smapclear ../../plugins/vimdoc-ja/doc/map.jax /*:smapclear* +:sme ../../plugins/vimdoc-ja/doc/gui.jax /*:sme* +:smenu ../../plugins/vimdoc-ja/doc/gui.jax /*:smenu* +:smile ../../plugins/vimdoc-ja/doc/index.jax /*:smile* +:sn ../../plugins/vimdoc-ja/doc/windows.jax /*:sn* +:snext ../../plugins/vimdoc-ja/doc/windows.jax /*:snext* +:sno ../../plugins/vimdoc-ja/doc/change.jax /*:sno* +:snomagic ../../plugins/vimdoc-ja/doc/change.jax /*:snomagic* +:snor ../../plugins/vimdoc-ja/doc/map.jax /*:snor* +:snoremap ../../plugins/vimdoc-ja/doc/map.jax /*:snoremap* +:snoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:snoreme* +:snoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:snoremenu* +:so ../../plugins/vimdoc-ja/doc/repeat.jax /*:so* +:sor ../../plugins/vimdoc-ja/doc/change.jax /*:sor* +:sort ../../plugins/vimdoc-ja/doc/change.jax /*:sort* +:source ../../plugins/vimdoc-ja/doc/repeat.jax /*:source* +:source_crnl ../../plugins/vimdoc-ja/doc/repeat.jax /*:source_crnl* +:sp ../../plugins/vimdoc-ja/doc/windows.jax /*:sp* +:spe ../../plugins/vimdoc-ja/doc/spell.jax /*:spe* +:spelld ../../plugins/vimdoc-ja/doc/spell.jax /*:spelld* +:spelldump ../../plugins/vimdoc-ja/doc/spell.jax /*:spelldump* +:spellgood ../../plugins/vimdoc-ja/doc/spell.jax /*:spellgood* +:spelli ../../plugins/vimdoc-ja/doc/spell.jax /*:spelli* +:spellinfo ../../plugins/vimdoc-ja/doc/spell.jax /*:spellinfo* +:spellr ../../plugins/vimdoc-ja/doc/spell.jax /*:spellr* +:spellrepall ../../plugins/vimdoc-ja/doc/spell.jax /*:spellrepall* +:spellu ../../plugins/vimdoc-ja/doc/spell.jax /*:spellu* +:spellundo ../../plugins/vimdoc-ja/doc/spell.jax /*:spellundo* +:spellw ../../plugins/vimdoc-ja/doc/spell.jax /*:spellw* +:spellwrong ../../plugins/vimdoc-ja/doc/spell.jax /*:spellwrong* +:split ../../plugins/vimdoc-ja/doc/windows.jax /*:split* +:split_f ../../plugins/vimdoc-ja/doc/windows.jax /*:split_f* +:spr ../../plugins/vimdoc-ja/doc/windows.jax /*:spr* +:sprevious ../../plugins/vimdoc-ja/doc/windows.jax /*:sprevious* +:sr ../../plugins/vimdoc-ja/doc/change.jax /*:sr* +:srI ../../plugins/vimdoc-ja/doc/change.jax /*:srI* +:src ../../plugins/vimdoc-ja/doc/change.jax /*:src* +:sre ../../plugins/vimdoc-ja/doc/windows.jax /*:sre* +:srewind ../../plugins/vimdoc-ja/doc/windows.jax /*:srewind* +:srg ../../plugins/vimdoc-ja/doc/change.jax /*:srg* +:sri ../../plugins/vimdoc-ja/doc/change.jax /*:sri* +:srl ../../plugins/vimdoc-ja/doc/change.jax /*:srl* +:srn ../../plugins/vimdoc-ja/doc/change.jax /*:srn* +:srp ../../plugins/vimdoc-ja/doc/change.jax /*:srp* +:st ../../plugins/vimdoc-ja/doc/starting.jax /*:st* +:sta ../../plugins/vimdoc-ja/doc/windows.jax /*:sta* +:stag ../../plugins/vimdoc-ja/doc/windows.jax /*:stag* +:star ../../plugins/vimdoc-ja/doc/repeat.jax /*:star* +:start ../../plugins/vimdoc-ja/doc/insert.jax /*:start* +:startgreplace ../../plugins/vimdoc-ja/doc/insert.jax /*:startgreplace* +:startinsert ../../plugins/vimdoc-ja/doc/insert.jax /*:startinsert* +:startreplace ../../plugins/vimdoc-ja/doc/insert.jax /*:startreplace* +:stj ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:stj* +:stjump ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:stjump* +:stop ../../plugins/vimdoc-ja/doc/starting.jax /*:stop* +:stopi ../../plugins/vimdoc-ja/doc/insert.jax /*:stopi* +:stopinsert ../../plugins/vimdoc-ja/doc/insert.jax /*:stopinsert* +:sts ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:sts* +:stselect ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:stselect* +:su ../../plugins/vimdoc-ja/doc/change.jax /*:su* +:substitute ../../plugins/vimdoc-ja/doc/change.jax /*:substitute* +:sun ../../plugins/vimdoc-ja/doc/windows.jax /*:sun* +:sunhide ../../plugins/vimdoc-ja/doc/windows.jax /*:sunhide* +:sunm ../../plugins/vimdoc-ja/doc/map.jax /*:sunm* +:sunmap ../../plugins/vimdoc-ja/doc/map.jax /*:sunmap* +:sunme ../../plugins/vimdoc-ja/doc/gui.jax /*:sunme* +:sunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:sunmenu* +:sus ../../plugins/vimdoc-ja/doc/starting.jax /*:sus* +:suspend ../../plugins/vimdoc-ja/doc/starting.jax /*:suspend* +:sv ../../plugins/vimdoc-ja/doc/windows.jax /*:sv* +:sview ../../plugins/vimdoc-ja/doc/windows.jax /*:sview* +:sw ../../plugins/vimdoc-ja/doc/recover.jax /*:sw* +:swapname ../../plugins/vimdoc-ja/doc/recover.jax /*:swapname* +:sy ../../plugins/vimdoc-ja/doc/syntax.jax /*:sy* +:syn ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn* +:syn-arguments ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-arguments* +:syn-case ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-case* +:syn-cchar ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-cchar* +:syn-clear ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-clear* +:syn-cluster ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-cluster* +:syn-conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-conceal* +:syn-conceal-implicit ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-conceal-implicit* +:syn-concealends ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-concealends* +:syn-contained ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-contained* +:syn-containedin ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-containedin* +:syn-contains ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-contains* +:syn-context ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-context* +:syn-default-override ../../plugins/vimdoc-ja/doc/usr_06.jax /*:syn-default-override* +:syn-define ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-define* +:syn-display ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-display* +:syn-enable ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-enable* +:syn-end ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-end* +:syn-excludenl ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-excludenl* +:syn-ext-match ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-ext-match* +:syn-extend ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-extend* +:syn-file-remarks ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-file-remarks* +:syn-files ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-files* +:syn-fold ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-fold* +:syn-include ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-include* +:syn-iskeyword ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-iskeyword* +:syn-keepend ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-keepend* +:syn-keyword ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-keyword* +:syn-lc ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-lc* +:syn-leading ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-leading* +:syn-list ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-list* +:syn-manual ../../plugins/vimdoc-ja/doc/usr_06.jax /*:syn-manual* +:syn-match ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-match* +:syn-matchgroup ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-matchgroup* +:syn-multi-line ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-multi-line* +:syn-nextgroup ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-nextgroup* +:syn-off ../../plugins/vimdoc-ja/doc/usr_06.jax /*:syn-off* +:syn-on ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-on* +:syn-oneline ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-oneline* +:syn-pattern ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-pattern* +:syn-pattern-offset ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-pattern-offset* +:syn-priority ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-priority* +:syn-qstart ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-qstart* +:syn-region ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-region* +:syn-reset ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-reset* +:syn-skip ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-skip* +:syn-skipempty ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-skipempty* +:syn-skipnl ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-skipnl* +:syn-skipwhite ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-skipwhite* +:syn-spell ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-spell* +:syn-start ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-start* +:syn-sync ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync* +:syn-sync-ccomment ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-ccomment* +:syn-sync-first ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-first* +:syn-sync-fourth ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-fourth* +:syn-sync-linebreaks ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-linebreaks* +:syn-sync-maxlines ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-maxlines* +:syn-sync-minlines ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-minlines* +:syn-sync-second ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-second* +:syn-sync-third ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-sync-third* +:syn-transparent ../../plugins/vimdoc-ja/doc/syntax.jax /*:syn-transparent* +:sync ../../plugins/vimdoc-ja/doc/scroll.jax /*:sync* +:syncbind ../../plugins/vimdoc-ja/doc/scroll.jax /*:syncbind* +:syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*:syntax* +:syntax-enable ../../plugins/vimdoc-ja/doc/syntax.jax /*:syntax-enable* +:syntax-on ../../plugins/vimdoc-ja/doc/syntax.jax /*:syntax-on* +:syntax-reset ../../plugins/vimdoc-ja/doc/syntax.jax /*:syntax-reset* +:syntime ../../plugins/vimdoc-ja/doc/syntax.jax /*:syntime* +:t ../../plugins/vimdoc-ja/doc/change.jax /*:t* +:tN ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tN* +:tNext ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tNext* +:ta ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ta* +:tab ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tab* +:tabN ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabN* +:tabNext ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabNext* +:tabc ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabc* +:tabclose ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabclose* +:tabd ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabd* +:tabdo ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabdo* +:tabe ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabe* +:tabedit ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabedit* +:tabf ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabf* +:tabfind ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabfind* +:tabfir ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabfir* +:tabfirst ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabfirst* +:tabl ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabl* +:tablast ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tablast* +:tabm ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabm* +:tabmove ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabmove* +:tabn ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabn* +:tabnew ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabnew* +:tabnext ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabnext* +:tabo ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabo* +:tabonly ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabonly* +:tabp ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabp* +:tabprevious ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabprevious* +:tabr ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabr* +:tabrewind ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabrewind* +:tabs ../../plugins/vimdoc-ja/doc/tabpage.jax /*:tabs* +:tag ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tag* +:tags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tags* +:tc ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tc* +:tcl ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tcl* +:tcld ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tcld* +:tcldo ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tcldo* +:tclf ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tclf* +:tclfile ../../plugins/vimdoc-ja/doc/if_tcl.jax /*:tclfile* +:te ../../plugins/vimdoc-ja/doc/gui_w32.jax /*:te* +:tearoff ../../plugins/vimdoc-ja/doc/gui_w32.jax /*:tearoff* +:tf ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tf* +:tfirst ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tfirst* +:th ../../plugins/vimdoc-ja/doc/eval.jax /*:th* +:throw ../../plugins/vimdoc-ja/doc/eval.jax /*:throw* +:tj ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tj* +:tjump ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tjump* +:tl ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tl* +:tlast ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tlast* +:tm ../../plugins/vimdoc-ja/doc/gui.jax /*:tm* +:tmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:tmenu* +:tn ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tn* +:tnext ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tnext* +:topleft ../../plugins/vimdoc-ja/doc/windows.jax /*:topleft* +:tp ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tp* +:tprevious ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tprevious* +:tr ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tr* +:trewind ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:trewind* +:try ../../plugins/vimdoc-ja/doc/eval.jax /*:try* +:ts ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:ts* +:tselect ../../plugins/vimdoc-ja/doc/tagsrch.jax /*:tselect* +:tu ../../plugins/vimdoc-ja/doc/gui.jax /*:tu* +:tunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:tunmenu* +:u ../../plugins/vimdoc-ja/doc/undo.jax /*:u* +:un ../../plugins/vimdoc-ja/doc/undo.jax /*:un* +:una ../../plugins/vimdoc-ja/doc/map.jax /*:una* +:unabbreviate ../../plugins/vimdoc-ja/doc/map.jax /*:unabbreviate* +:undo ../../plugins/vimdoc-ja/doc/undo.jax /*:undo* +:undoj ../../plugins/vimdoc-ja/doc/undo.jax /*:undoj* +:undojoin ../../plugins/vimdoc-ja/doc/undo.jax /*:undojoin* +:undol ../../plugins/vimdoc-ja/doc/undo.jax /*:undol* +:undolist ../../plugins/vimdoc-ja/doc/undo.jax /*:undolist* +:unh ../../plugins/vimdoc-ja/doc/windows.jax /*:unh* +:unhide ../../plugins/vimdoc-ja/doc/windows.jax /*:unhide* +:unl ../../plugins/vimdoc-ja/doc/eval.jax /*:unl* +:unlet ../../plugins/vimdoc-ja/doc/eval.jax /*:unlet* +:unlo ../../plugins/vimdoc-ja/doc/eval.jax /*:unlo* +:unlockvar ../../plugins/vimdoc-ja/doc/eval.jax /*:unlockvar* +:unm ../../plugins/vimdoc-ja/doc/map.jax /*:unm* +:unm! ../../plugins/vimdoc-ja/doc/map.jax /*:unm!* +:unmap ../../plugins/vimdoc-ja/doc/map.jax /*:unmap* +:unmap! ../../plugins/vimdoc-ja/doc/map.jax /*:unmap!* +:unme ../../plugins/vimdoc-ja/doc/gui.jax /*:unme* +:unmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:unmenu* +:unmenu-all ../../plugins/vimdoc-ja/doc/gui.jax /*:unmenu-all* +:uns ../../plugins/vimdoc-ja/doc/various.jax /*:uns* +:unsilent ../../plugins/vimdoc-ja/doc/various.jax /*:unsilent* +:up ../../plugins/vimdoc-ja/doc/editing.jax /*:up* +:update ../../plugins/vimdoc-ja/doc/editing.jax /*:update* +:v ../../plugins/vimdoc-ja/doc/repeat.jax /*:v* +:ve ../../plugins/vimdoc-ja/doc/various.jax /*:ve* +:verb ../../plugins/vimdoc-ja/doc/various.jax /*:verb* +:verbose ../../plugins/vimdoc-ja/doc/various.jax /*:verbose* +:verbose-cmd ../../plugins/vimdoc-ja/doc/various.jax /*:verbose-cmd* +:version ../../plugins/vimdoc-ja/doc/various.jax /*:version* +:vert ../../plugins/vimdoc-ja/doc/windows.jax /*:vert* +:vertical ../../plugins/vimdoc-ja/doc/windows.jax /*:vertical* +:vertical-resize ../../plugins/vimdoc-ja/doc/windows.jax /*:vertical-resize* +:vglobal ../../plugins/vimdoc-ja/doc/repeat.jax /*:vglobal* +:vi ../../plugins/vimdoc-ja/doc/editing.jax /*:vi* +:vie ../../plugins/vimdoc-ja/doc/editing.jax /*:vie* +:view ../../plugins/vimdoc-ja/doc/editing.jax /*:view* +:vim ../../plugins/vimdoc-ja/doc/quickfix.jax /*:vim* +:vimgrep ../../plugins/vimdoc-ja/doc/quickfix.jax /*:vimgrep* +:vimgrepa ../../plugins/vimdoc-ja/doc/quickfix.jax /*:vimgrepa* +:vimgrepadd ../../plugins/vimdoc-ja/doc/quickfix.jax /*:vimgrepadd* +:visual ../../plugins/vimdoc-ja/doc/editing.jax /*:visual* +:visual_example ../../plugins/vimdoc-ja/doc/visual.jax /*:visual_example* +:viu ../../plugins/vimdoc-ja/doc/helphelp.jax /*:viu* +:viusage ../../plugins/vimdoc-ja/doc/helphelp.jax /*:viusage* +:vm ../../plugins/vimdoc-ja/doc/map.jax /*:vm* +:vmap ../../plugins/vimdoc-ja/doc/map.jax /*:vmap* +:vmap_l ../../plugins/vimdoc-ja/doc/map.jax /*:vmap_l* +:vmapc ../../plugins/vimdoc-ja/doc/map.jax /*:vmapc* +:vmapclear ../../plugins/vimdoc-ja/doc/map.jax /*:vmapclear* +:vme ../../plugins/vimdoc-ja/doc/gui.jax /*:vme* +:vmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:vmenu* +:vn ../../plugins/vimdoc-ja/doc/map.jax /*:vn* +:vne ../../plugins/vimdoc-ja/doc/windows.jax /*:vne* +:vnew ../../plugins/vimdoc-ja/doc/windows.jax /*:vnew* +:vnoremap ../../plugins/vimdoc-ja/doc/map.jax /*:vnoremap* +:vnoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:vnoreme* +:vnoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:vnoremenu* +:vs ../../plugins/vimdoc-ja/doc/windows.jax /*:vs* +:vsplit ../../plugins/vimdoc-ja/doc/windows.jax /*:vsplit* +:vu ../../plugins/vimdoc-ja/doc/map.jax /*:vu* +:vunmap ../../plugins/vimdoc-ja/doc/map.jax /*:vunmap* +:vunme ../../plugins/vimdoc-ja/doc/gui.jax /*:vunme* +:vunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:vunmenu* +:w ../../plugins/vimdoc-ja/doc/editing.jax /*:w* +:w! ../../plugins/vimdoc-ja/doc/editing.jax /*:w!* +:wN ../../plugins/vimdoc-ja/doc/editing.jax /*:wN* +:wNext ../../plugins/vimdoc-ja/doc/editing.jax /*:wNext* +:w_a ../../plugins/vimdoc-ja/doc/editing.jax /*:w_a* +:w_c ../../plugins/vimdoc-ja/doc/editing.jax /*:w_c* +:w_f ../../plugins/vimdoc-ja/doc/editing.jax /*:w_f* +:wa ../../plugins/vimdoc-ja/doc/editing.jax /*:wa* +:wall ../../plugins/vimdoc-ja/doc/editing.jax /*:wall* +:wh ../../plugins/vimdoc-ja/doc/eval.jax /*:wh* +:while ../../plugins/vimdoc-ja/doc/eval.jax /*:while* +:win ../../plugins/vimdoc-ja/doc/gui.jax /*:win* +:winc ../../plugins/vimdoc-ja/doc/windows.jax /*:winc* +:wincmd ../../plugins/vimdoc-ja/doc/windows.jax /*:wincmd* +:windo ../../plugins/vimdoc-ja/doc/windows.jax /*:windo* +:winp ../../plugins/vimdoc-ja/doc/gui.jax /*:winp* +:winpos ../../plugins/vimdoc-ja/doc/gui.jax /*:winpos* +:winsize ../../plugins/vimdoc-ja/doc/gui.jax /*:winsize* +:wn ../../plugins/vimdoc-ja/doc/editing.jax /*:wn* +:wnext ../../plugins/vimdoc-ja/doc/editing.jax /*:wnext* +:wp ../../plugins/vimdoc-ja/doc/editing.jax /*:wp* +:wprevious ../../plugins/vimdoc-ja/doc/editing.jax /*:wprevious* +:wq ../../plugins/vimdoc-ja/doc/editing.jax /*:wq* +:wqa ../../plugins/vimdoc-ja/doc/editing.jax /*:wqa* +:wqall ../../plugins/vimdoc-ja/doc/editing.jax /*:wqall* +:write ../../plugins/vimdoc-ja/doc/editing.jax /*:write* +:write_a ../../plugins/vimdoc-ja/doc/editing.jax /*:write_a* +:write_c ../../plugins/vimdoc-ja/doc/editing.jax /*:write_c* +:write_f ../../plugins/vimdoc-ja/doc/editing.jax /*:write_f* +:ws ../../plugins/vimdoc-ja/doc/workshop.jax /*:ws* +:wsverb ../../plugins/vimdoc-ja/doc/workshop.jax /*:wsverb* +:wundo ../../plugins/vimdoc-ja/doc/undo.jax /*:wundo* +:wv ../../plugins/vimdoc-ja/doc/starting.jax /*:wv* +:wviminfo ../../plugins/vimdoc-ja/doc/starting.jax /*:wviminfo* +:x ../../plugins/vimdoc-ja/doc/editing.jax /*:x* +:xa ../../plugins/vimdoc-ja/doc/editing.jax /*:xa* +:xall ../../plugins/vimdoc-ja/doc/editing.jax /*:xall* +:xit ../../plugins/vimdoc-ja/doc/editing.jax /*:xit* +:xm ../../plugins/vimdoc-ja/doc/map.jax /*:xm* +:xmap ../../plugins/vimdoc-ja/doc/map.jax /*:xmap* +:xmap_l ../../plugins/vimdoc-ja/doc/map.jax /*:xmap_l* +:xmapc ../../plugins/vimdoc-ja/doc/map.jax /*:xmapc* +:xmapclear ../../plugins/vimdoc-ja/doc/map.jax /*:xmapclear* +:xme ../../plugins/vimdoc-ja/doc/gui.jax /*:xme* +:xmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:xmenu* +:xn ../../plugins/vimdoc-ja/doc/map.jax /*:xn* +:xnoremap ../../plugins/vimdoc-ja/doc/map.jax /*:xnoremap* +:xnoreme ../../plugins/vimdoc-ja/doc/gui.jax /*:xnoreme* +:xnoremenu ../../plugins/vimdoc-ja/doc/gui.jax /*:xnoremenu* +:xu ../../plugins/vimdoc-ja/doc/map.jax /*:xu* +:xunmap ../../plugins/vimdoc-ja/doc/map.jax /*:xunmap* +:xunme ../../plugins/vimdoc-ja/doc/gui.jax /*:xunme* +:xunmenu ../../plugins/vimdoc-ja/doc/gui.jax /*:xunmenu* +:y ../../plugins/vimdoc-ja/doc/change.jax /*:y* +:yank ../../plugins/vimdoc-ja/doc/change.jax /*:yank* +:z ../../plugins/vimdoc-ja/doc/various.jax /*:z* +:z# ../../plugins/vimdoc-ja/doc/various.jax /*:z#* +:~ ../../plugins/vimdoc-ja/doc/change.jax /*:~* +; ../../plugins/vimdoc-ja/doc/motion.jax /*;* +< ../../plugins/vimdoc-ja/doc/change.jax /*<* +<2-LeftMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<2-LeftMouse>* +<3-LeftMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<3-LeftMouse>* +<4-LeftMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<4-LeftMouse>* +<< ../../plugins/vimdoc-ja/doc/change.jax /*<<* +<> ../../plugins/vimdoc-ja/doc/intro.jax /*<>* +<A- ../../plugins/vimdoc-ja/doc/intro.jax /*<A-* +<A-LeftMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<A-LeftMouse>* +<A-RightMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<A-RightMouse>* +<BS> ../../plugins/vimdoc-ja/doc/motion.jax /*<BS>* +<Bar> ../../plugins/vimdoc-ja/doc/intro.jax /*<Bar>* +<Bslash> ../../plugins/vimdoc-ja/doc/intro.jax /*<Bslash>* +<C- ../../plugins/vimdoc-ja/doc/intro.jax /*<C-* +<C-Del> ../../plugins/vimdoc-ja/doc/os_dos.jax /*<C-Del>* +<C-End> ../../plugins/vimdoc-ja/doc/motion.jax /*<C-End>* +<C-Home> ../../plugins/vimdoc-ja/doc/motion.jax /*<C-Home>* +<C-Insert> ../../plugins/vimdoc-ja/doc/os_dos.jax /*<C-Insert>* +<C-Left> ../../plugins/vimdoc-ja/doc/motion.jax /*<C-Left>* +<C-LeftMouse> ../../plugins/vimdoc-ja/doc/tagsrch.jax /*<C-LeftMouse>* +<C-PageDown> ../../plugins/vimdoc-ja/doc/tabpage.jax /*<C-PageDown>* +<C-PageUp> ../../plugins/vimdoc-ja/doc/tabpage.jax /*<C-PageUp>* +<C-Right> ../../plugins/vimdoc-ja/doc/motion.jax /*<C-Right>* +<C-RightMouse> ../../plugins/vimdoc-ja/doc/tagsrch.jax /*<C-RightMouse>* +<C-ScrollWheelDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<C-ScrollWheelDown>* +<C-ScrollWheelLeft> ../../plugins/vimdoc-ja/doc/scroll.jax /*<C-ScrollWheelLeft>* +<C-ScrollWheelRight> ../../plugins/vimdoc-ja/doc/scroll.jax /*<C-ScrollWheelRight>* +<C-ScrollWheelUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<C-ScrollWheelUp>* +<CR> ../../plugins/vimdoc-ja/doc/motion.jax /*<CR>* +<CSI> ../../plugins/vimdoc-ja/doc/intro.jax /*<CSI>* +<Char-> ../../plugins/vimdoc-ja/doc/map.jax /*<Char->* +<Char> ../../plugins/vimdoc-ja/doc/map.jax /*<Char>* +<CursorHold> ../../plugins/vimdoc-ja/doc/autocmd.jax /*<CursorHold>* +<D- ../../plugins/vimdoc-ja/doc/intro.jax /*<D-* +<Del> ../../plugins/vimdoc-ja/doc/change.jax /*<Del>* +<Down> ../../plugins/vimdoc-ja/doc/motion.jax /*<Down>* +<Drop> ../../plugins/vimdoc-ja/doc/change.jax /*<Drop>* +<EOL> ../../plugins/vimdoc-ja/doc/intro.jax /*<EOL>* +<End> ../../plugins/vimdoc-ja/doc/motion.jax /*<End>* +<Enter> ../../plugins/vimdoc-ja/doc/intro.jax /*<Enter>* +<Esc> ../../plugins/vimdoc-ja/doc/intro.jax /*<Esc>* +<F10> ../../plugins/vimdoc-ja/doc/term.jax /*<F10>* +<F11> ../../plugins/vimdoc-ja/doc/term.jax /*<F11>* +<F12> ../../plugins/vimdoc-ja/doc/term.jax /*<F12>* +<F13> ../../plugins/vimdoc-ja/doc/term.jax /*<F13>* +<F14> ../../plugins/vimdoc-ja/doc/term.jax /*<F14>* +<F15> ../../plugins/vimdoc-ja/doc/term.jax /*<F15>* +<F16> ../../plugins/vimdoc-ja/doc/term.jax /*<F16>* +<F17> ../../plugins/vimdoc-ja/doc/term.jax /*<F17>* +<F18> ../../plugins/vimdoc-ja/doc/term.jax /*<F18>* +<F19> ../../plugins/vimdoc-ja/doc/term.jax /*<F19>* +<F1> ../../plugins/vimdoc-ja/doc/helphelp.jax /*<F1>* +<F2> ../../plugins/vimdoc-ja/doc/term.jax /*<F2>* +<F3> ../../plugins/vimdoc-ja/doc/term.jax /*<F3>* +<F4> ../../plugins/vimdoc-ja/doc/term.jax /*<F4>* +<F5> ../../plugins/vimdoc-ja/doc/term.jax /*<F5>* +<F6> ../../plugins/vimdoc-ja/doc/term.jax /*<F6>* +<F7> ../../plugins/vimdoc-ja/doc/term.jax /*<F7>* +<F8> ../../plugins/vimdoc-ja/doc/term.jax /*<F8>* +<F9> ../../plugins/vimdoc-ja/doc/term.jax /*<F9>* +<Help> ../../plugins/vimdoc-ja/doc/helphelp.jax /*<Help>* +<Home> ../../plugins/vimdoc-ja/doc/motion.jax /*<Home>* +<Insert> ../../plugins/vimdoc-ja/doc/insert.jax /*<Insert>* +<Leader> ../../plugins/vimdoc-ja/doc/map.jax /*<Leader>* +<Left> ../../plugins/vimdoc-ja/doc/motion.jax /*<Left>* +<LeftDrag> ../../plugins/vimdoc-ja/doc/term.jax /*<LeftDrag>* +<LeftMouse> ../../plugins/vimdoc-ja/doc/visual.jax /*<LeftMouse>* +<LeftRelease> ../../plugins/vimdoc-ja/doc/visual.jax /*<LeftRelease>* +<LocalLeader> ../../plugins/vimdoc-ja/doc/map.jax /*<LocalLeader>* +<M- ../../plugins/vimdoc-ja/doc/intro.jax /*<M-* +<MiddleDrag> ../../plugins/vimdoc-ja/doc/term.jax /*<MiddleDrag>* +<MiddleMouse> ../../plugins/vimdoc-ja/doc/change.jax /*<MiddleMouse>* +<MiddleRelease> ../../plugins/vimdoc-ja/doc/term.jax /*<MiddleRelease>* +<Mouse> ../../plugins/vimdoc-ja/doc/term.jax /*<Mouse>* +<MouseDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<MouseDown>* +<MouseUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<MouseUp>* +<NL> ../../plugins/vimdoc-ja/doc/motion.jax /*<NL>* +<Nop> ../../plugins/vimdoc-ja/doc/map.jax /*<Nop>* +<Nul> ../../plugins/vimdoc-ja/doc/intro.jax /*<Nul>* +<PageDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<PageDown>* +<PageUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<PageUp>* +<Plug> ../../plugins/vimdoc-ja/doc/map.jax /*<Plug>* +<Return> ../../plugins/vimdoc-ja/doc/intro.jax /*<Return>* +<Right> ../../plugins/vimdoc-ja/doc/motion.jax /*<Right>* +<RightDrag> ../../plugins/vimdoc-ja/doc/term.jax /*<RightDrag>* +<RightMouse> ../../plugins/vimdoc-ja/doc/visual.jax /*<RightMouse>* +<RightRelease> ../../plugins/vimdoc-ja/doc/term.jax /*<RightRelease>* +<S- ../../plugins/vimdoc-ja/doc/intro.jax /*<S-* +<S-Del> ../../plugins/vimdoc-ja/doc/os_dos.jax /*<S-Del>* +<S-Down> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-Down>* +<S-End> ../../plugins/vimdoc-ja/doc/term.jax /*<S-End>* +<S-F10> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F10>* +<S-F11> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F11>* +<S-F12> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F12>* +<S-F1> ../../plugins/vimdoc-ja/doc/intro.jax /*<S-F1>* +<S-F2> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F2>* +<S-F3> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F3>* +<S-F4> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F4>* +<S-F5> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F5>* +<S-F6> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F6>* +<S-F7> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F7>* +<S-F8> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F8>* +<S-F9> ../../plugins/vimdoc-ja/doc/term.jax /*<S-F9>* +<S-Home> ../../plugins/vimdoc-ja/doc/term.jax /*<S-Home>* +<S-Insert> ../../plugins/vimdoc-ja/doc/os_dos.jax /*<S-Insert>* +<S-Left> ../../plugins/vimdoc-ja/doc/motion.jax /*<S-Left>* +<S-LeftMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<S-LeftMouse>* +<S-Right> ../../plugins/vimdoc-ja/doc/motion.jax /*<S-Right>* +<S-RightMouse> ../../plugins/vimdoc-ja/doc/term.jax /*<S-RightMouse>* +<S-ScrollWheelDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-ScrollWheelDown>* +<S-ScrollWheelLeft> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-ScrollWheelLeft>* +<S-ScrollWheelRight> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-ScrollWheelRight>* +<S-ScrollWheelUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-ScrollWheelUp>* +<S-Tab> ../../plugins/vimdoc-ja/doc/term.jax /*<S-Tab>* +<S-Up> ../../plugins/vimdoc-ja/doc/scroll.jax /*<S-Up>* +<S-xF1> ../../plugins/vimdoc-ja/doc/term.jax /*<S-xF1>* +<S-xF2> ../../plugins/vimdoc-ja/doc/term.jax /*<S-xF2>* +<S-xF3> ../../plugins/vimdoc-ja/doc/term.jax /*<S-xF3>* +<S-xF4> ../../plugins/vimdoc-ja/doc/term.jax /*<S-xF4>* +<SID> ../../plugins/vimdoc-ja/doc/map.jax /*<SID>* +<SNR> ../../plugins/vimdoc-ja/doc/map.jax /*<SNR>* +<ScrollWheelDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<ScrollWheelDown>* +<ScrollWheelLeft> ../../plugins/vimdoc-ja/doc/scroll.jax /*<ScrollWheelLeft>* +<ScrollWheelRight> ../../plugins/vimdoc-ja/doc/scroll.jax /*<ScrollWheelRight>* +<ScrollWheelUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<ScrollWheelUp>* +<Space> ../../plugins/vimdoc-ja/doc/motion.jax /*<Space>* +<Tab> ../../plugins/vimdoc-ja/doc/motion.jax /*<Tab>* +<Undo> ../../plugins/vimdoc-ja/doc/undo.jax /*<Undo>* +<Up> ../../plugins/vimdoc-ja/doc/motion.jax /*<Up>* +<abuf> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<abuf>* +<afile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<afile>* +<amatch> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<amatch>* +<args> ../../plugins/vimdoc-ja/doc/map.jax /*<args>* +<bang> ../../plugins/vimdoc-ja/doc/map.jax /*<bang>* +<buffer=N> ../../plugins/vimdoc-ja/doc/autocmd.jax /*<buffer=N>* +<buffer=abuf> ../../plugins/vimdoc-ja/doc/autocmd.jax /*<buffer=abuf>* +<cfile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<cfile>* +<character> ../../plugins/vimdoc-ja/doc/intro.jax /*<character>* +<count> ../../plugins/vimdoc-ja/doc/map.jax /*<count>* +<f-args> ../../plugins/vimdoc-ja/doc/map.jax /*<f-args>* +<k0> ../../plugins/vimdoc-ja/doc/term.jax /*<k0>* +<k1> ../../plugins/vimdoc-ja/doc/term.jax /*<k1>* +<k2> ../../plugins/vimdoc-ja/doc/term.jax /*<k2>* +<k3> ../../plugins/vimdoc-ja/doc/term.jax /*<k3>* +<k4> ../../plugins/vimdoc-ja/doc/term.jax /*<k4>* +<k5> ../../plugins/vimdoc-ja/doc/term.jax /*<k5>* +<k6> ../../plugins/vimdoc-ja/doc/term.jax /*<k6>* +<k7> ../../plugins/vimdoc-ja/doc/term.jax /*<k7>* +<k8> ../../plugins/vimdoc-ja/doc/term.jax /*<k8>* +<k9> ../../plugins/vimdoc-ja/doc/term.jax /*<k9>* +<kDivide> ../../plugins/vimdoc-ja/doc/term.jax /*<kDivide>* +<kEnd> ../../plugins/vimdoc-ja/doc/motion.jax /*<kEnd>* +<kEnter> ../../plugins/vimdoc-ja/doc/term.jax /*<kEnter>* +<kHome> ../../plugins/vimdoc-ja/doc/motion.jax /*<kHome>* +<kMinus> ../../plugins/vimdoc-ja/doc/term.jax /*<kMinus>* +<kMultiply> ../../plugins/vimdoc-ja/doc/term.jax /*<kMultiply>* +<kPageDown> ../../plugins/vimdoc-ja/doc/scroll.jax /*<kPageDown>* +<kPageUp> ../../plugins/vimdoc-ja/doc/scroll.jax /*<kPageUp>* +<kPlus> ../../plugins/vimdoc-ja/doc/term.jax /*<kPlus>* +<kPoint> ../../plugins/vimdoc-ja/doc/term.jax /*<kPoint>* +<line1> ../../plugins/vimdoc-ja/doc/map.jax /*<line1>* +<line2> ../../plugins/vimdoc-ja/doc/map.jax /*<line2>* +<lt> ../../plugins/vimdoc-ja/doc/intro.jax /*<lt>* +<mods> ../../plugins/vimdoc-ja/doc/map.jax /*<mods>* +<nomodeline> ../../plugins/vimdoc-ja/doc/autocmd.jax /*<nomodeline>* +<q-args> ../../plugins/vimdoc-ja/doc/map.jax /*<q-args>* +<reg> ../../plugins/vimdoc-ja/doc/map.jax /*<reg>* +<register> ../../plugins/vimdoc-ja/doc/map.jax /*<register>* +<sfile> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<sfile>* +<slnum> ../../plugins/vimdoc-ja/doc/cmdline.jax /*<slnum>* +<xCSI> ../../plugins/vimdoc-ja/doc/intro.jax /*<xCSI>* +<xDown> ../../plugins/vimdoc-ja/doc/term.jax /*<xDown>* +<xEnd> ../../plugins/vimdoc-ja/doc/term.jax /*<xEnd>* +<xEnd>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xEnd>-xterm* +<xF1> ../../plugins/vimdoc-ja/doc/term.jax /*<xF1>* +<xF1>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xF1>-xterm* +<xF2> ../../plugins/vimdoc-ja/doc/term.jax /*<xF2>* +<xF2>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xF2>-xterm* +<xF3> ../../plugins/vimdoc-ja/doc/term.jax /*<xF3>* +<xF3>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xF3>-xterm* +<xF4> ../../plugins/vimdoc-ja/doc/term.jax /*<xF4>* +<xF4>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xF4>-xterm* +<xHome> ../../plugins/vimdoc-ja/doc/term.jax /*<xHome>* +<xHome>-xterm ../../plugins/vimdoc-ja/doc/term.jax /*<xHome>-xterm* +<xLeft> ../../plugins/vimdoc-ja/doc/term.jax /*<xLeft>* +<xRight> ../../plugins/vimdoc-ja/doc/term.jax /*<xRight>* +<xUp> ../../plugins/vimdoc-ja/doc/term.jax /*<xUp>* += ../../plugins/vimdoc-ja/doc/change.jax /*=* +== ../../plugins/vimdoc-ja/doc/change.jax /*==* +> ../../plugins/vimdoc-ja/doc/change.jax /*>* +>> ../../plugins/vimdoc-ja/doc/change.jax /*>>* +>backtrace ../../plugins/vimdoc-ja/doc/repeat.jax /*>backtrace* +>bt ../../plugins/vimdoc-ja/doc/repeat.jax /*>bt* +>cont ../../plugins/vimdoc-ja/doc/repeat.jax /*>cont* +>down ../../plugins/vimdoc-ja/doc/repeat.jax /*>down* +>finish ../../plugins/vimdoc-ja/doc/repeat.jax /*>finish* +>frame ../../plugins/vimdoc-ja/doc/repeat.jax /*>frame* +>interrupt ../../plugins/vimdoc-ja/doc/repeat.jax /*>interrupt* +>next ../../plugins/vimdoc-ja/doc/repeat.jax /*>next* +>quit ../../plugins/vimdoc-ja/doc/repeat.jax /*>quit* +>step ../../plugins/vimdoc-ja/doc/repeat.jax /*>step* +>up ../../plugins/vimdoc-ja/doc/repeat.jax /*>up* +>where ../../plugins/vimdoc-ja/doc/repeat.jax /*>where* +? ../../plugins/vimdoc-ja/doc/pattern.jax /*?* +?<CR> ../../plugins/vimdoc-ja/doc/pattern.jax /*?<CR>* +@ ../../plugins/vimdoc-ja/doc/repeat.jax /*@* +@/ ../../plugins/vimdoc-ja/doc/change.jax /*@\/* +@: ../../plugins/vimdoc-ja/doc/repeat.jax /*@:* +@= ../../plugins/vimdoc-ja/doc/change.jax /*@=* +@@ ../../plugins/vimdoc-ja/doc/repeat.jax /*@@* +@r ../../plugins/vimdoc-ja/doc/eval.jax /*@r* +A ../../plugins/vimdoc-ja/doc/insert.jax /*A* +ACL ../../plugins/vimdoc-ja/doc/editing.jax /*ACL* +ATTENTION ../../plugins/vimdoc-ja/doc/usr_11.jax /*ATTENTION* +Abbreviations ../../plugins/vimdoc-ja/doc/map.jax /*Abbreviations* +Aleph ../../plugins/vimdoc-ja/doc/options.jax /*Aleph* +Amiga ../../plugins/vimdoc-ja/doc/os_amiga.jax /*Amiga* +Arabic ../../plugins/vimdoc-ja/doc/arabic.jax /*Arabic* +Atari ../../plugins/vimdoc-ja/doc/os_mint.jax /*Atari* +Athena ../../plugins/vimdoc-ja/doc/gui_x11.jax /*Athena* +B ../../plugins/vimdoc-ja/doc/motion.jax /*B* +BeBox ../../plugins/vimdoc-ja/doc/os_beos.jax /*BeBox* +BeOS ../../plugins/vimdoc-ja/doc/os_beos.jax /*BeOS* +Bram ../../plugins/vimdoc-ja/doc/intro.jax /*Bram* +BufAdd ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufAdd* +BufCreate ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufCreate* +BufDelete ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufDelete* +BufEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufEnter* +BufFilePost ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufFilePost* +BufFilePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufFilePre* +BufHidden ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufHidden* +BufLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufLeave* +BufNew ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufNew* +BufNewFile ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufNewFile* +BufRead ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufRead* +BufReadCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufReadCmd* +BufReadPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufReadPost* +BufReadPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufReadPre* +BufUnload ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufUnload* +BufWinEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWinEnter* +BufWinLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWinLeave* +BufWipeout ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWipeout* +BufWrite ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWrite* +BufWriteCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWriteCmd* +BufWritePost ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWritePost* +BufWritePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*BufWritePre* +C ../../plugins/vimdoc-ja/doc/change.jax /*C* +C-editing ../../plugins/vimdoc-ja/doc/tips.jax /*C-editing* +C-indenting ../../plugins/vimdoc-ja/doc/indent.jax /*C-indenting* +COMSPEC ../../plugins/vimdoc-ja/doc/starting.jax /*COMSPEC* +CR-used-for-NL ../../plugins/vimdoc-ja/doc/pattern.jax /*CR-used-for-NL* +CTRL-6 ../../plugins/vimdoc-ja/doc/editing.jax /*CTRL-6* +CTRL-<PageDown> ../../plugins/vimdoc-ja/doc/tabpage.jax /*CTRL-<PageDown>* +CTRL-<PageUp> ../../plugins/vimdoc-ja/doc/tabpage.jax /*CTRL-<PageUp>* +CTRL-A ../../plugins/vimdoc-ja/doc/change.jax /*CTRL-A* +CTRL-B ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-B* +CTRL-C ../../plugins/vimdoc-ja/doc/pattern.jax /*CTRL-C* +CTRL-D ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-D* +CTRL-E ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-E* +CTRL-F ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-F* +CTRL-G ../../plugins/vimdoc-ja/doc/editing.jax /*CTRL-G* +CTRL-H ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-H* +CTRL-I ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-I* +CTRL-J ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-J* +CTRL-L ../../plugins/vimdoc-ja/doc/various.jax /*CTRL-L* +CTRL-M ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-M* +CTRL-N ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-N* +CTRL-O ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-O* +CTRL-P ../../plugins/vimdoc-ja/doc/motion.jax /*CTRL-P* +CTRL-Q ../../plugins/vimdoc-ja/doc/gui_w32.jax /*CTRL-Q* +CTRL-R ../../plugins/vimdoc-ja/doc/undo.jax /*CTRL-R* +CTRL-T ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-T* +CTRL-U ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-U* +CTRL-V ../../plugins/vimdoc-ja/doc/visual.jax /*CTRL-V* +CTRL-V-alternative ../../plugins/vimdoc-ja/doc/gui_w32.jax /*CTRL-V-alternative* +CTRL-W ../../plugins/vimdoc-ja/doc/index.jax /*CTRL-W* +CTRL-W_+ ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_+* +CTRL-W_- ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_-* +CTRL-W_< ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<* +CTRL-W_<BS> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<BS>* +CTRL-W_<CR> ../../plugins/vimdoc-ja/doc/quickfix.jax /*CTRL-W_<CR>* +CTRL-W_<Down> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<Down>* +CTRL-W_<Enter> ../../plugins/vimdoc-ja/doc/quickfix.jax /*CTRL-W_<Enter>* +CTRL-W_<Left> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<Left>* +CTRL-W_<Right> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<Right>* +CTRL-W_<Up> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_<Up>* +CTRL-W_= ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_=* +CTRL-W_> ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_>* +CTRL-W_CTRL-B ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-B* +CTRL-W_CTRL-C ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-C* +CTRL-W_CTRL-D ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-W_CTRL-D* +CTRL-W_CTRL-F ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-F* +CTRL-W_CTRL-H ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-H* +CTRL-W_CTRL-I ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-W_CTRL-I* +CTRL-W_CTRL-J ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-J* +CTRL-W_CTRL-K ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-K* +CTRL-W_CTRL-L ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-L* +CTRL-W_CTRL-N ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-N* +CTRL-W_CTRL-O ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-O* +CTRL-W_CTRL-P ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-P* +CTRL-W_CTRL-Q ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-Q* +CTRL-W_CTRL-R ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-R* +CTRL-W_CTRL-S ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-S* +CTRL-W_CTRL-T ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-T* +CTRL-W_CTRL-V ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-V* +CTRL-W_CTRL-W ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-W* +CTRL-W_CTRL-X ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-X* +CTRL-W_CTRL-Z ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-Z* +CTRL-W_CTRL-] ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-]* +CTRL-W_CTRL-^ ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-^* +CTRL-W_CTRL-_ ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_CTRL-_* +CTRL-W_F ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_F* +CTRL-W_H ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_H* +CTRL-W_J ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_J* +CTRL-W_K ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_K* +CTRL-W_L ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_L* +CTRL-W_P ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_P* +CTRL-W_R ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_R* +CTRL-W_S ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_S* +CTRL-W_T ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_T* +CTRL-W_W ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_W* +CTRL-W_] ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_]* +CTRL-W_^ ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_^* +CTRL-W__ ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W__* +CTRL-W_b ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_b* +CTRL-W_bar ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_bar* +CTRL-W_c ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_c* +CTRL-W_d ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-W_d* +CTRL-W_f ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_f* +CTRL-W_gF ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_gF* +CTRL-W_g] ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_g]* +CTRL-W_g_CTRL-] ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_g_CTRL-]* +CTRL-W_gf ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_gf* +CTRL-W_g} ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_g}* +CTRL-W_h ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_h* +CTRL-W_i ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-W_i* +CTRL-W_j ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_j* +CTRL-W_k ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_k* +CTRL-W_l ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_l* +CTRL-W_n ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_n* +CTRL-W_o ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_o* +CTRL-W_p ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_p* +CTRL-W_q ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_q* +CTRL-W_r ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_r* +CTRL-W_s ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_s* +CTRL-W_t ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_t* +CTRL-W_v ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_v* +CTRL-W_w ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_w* +CTRL-W_x ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_x* +CTRL-W_z ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_z* +CTRL-W_} ../../plugins/vimdoc-ja/doc/windows.jax /*CTRL-W_}* +CTRL-X ../../plugins/vimdoc-ja/doc/change.jax /*CTRL-X* +CTRL-Y ../../plugins/vimdoc-ja/doc/scroll.jax /*CTRL-Y* +CTRL-Z ../../plugins/vimdoc-ja/doc/starting.jax /*CTRL-Z* +CTRL-\_CTRL-G ../../plugins/vimdoc-ja/doc/intro.jax /*CTRL-\\_CTRL-G* +CTRL-\_CTRL-N ../../plugins/vimdoc-ja/doc/intro.jax /*CTRL-\\_CTRL-N* +CTRL-] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*CTRL-]* +CTRL-^ ../../plugins/vimdoc-ja/doc/editing.jax /*CTRL-^* +CTRL-{char} ../../plugins/vimdoc-ja/doc/intro.jax /*CTRL-{char}* +Channel ../../plugins/vimdoc-ja/doc/eval.jax /*Channel* +Channels ../../plugins/vimdoc-ja/doc/eval.jax /*Channels* +Chinese ../../plugins/vimdoc-ja/doc/mbyte.jax /*Chinese* +Cmd-event ../../plugins/vimdoc-ja/doc/autocmd.jax /*Cmd-event* +CmdUndefined ../../plugins/vimdoc-ja/doc/autocmd.jax /*CmdUndefined* +Cmdline ../../plugins/vimdoc-ja/doc/cmdline.jax /*Cmdline* +Cmdline-mode ../../plugins/vimdoc-ja/doc/cmdline.jax /*Cmdline-mode* +CmdwinEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*CmdwinEnter* +CmdwinLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*CmdwinLeave* +ColorScheme ../../plugins/vimdoc-ja/doc/autocmd.jax /*ColorScheme* +Command-line ../../plugins/vimdoc-ja/doc/cmdline.jax /*Command-line* +Command-line-mode ../../plugins/vimdoc-ja/doc/cmdline.jax /*Command-line-mode* +CompleteDone ../../plugins/vimdoc-ja/doc/autocmd.jax /*CompleteDone* +Contents ../../plugins/vimdoc-ja/doc/quickref.jax /*Contents* +Cscope ../../plugins/vimdoc-ja/doc/if_cscop.jax /*Cscope* +CursorHold ../../plugins/vimdoc-ja/doc/autocmd.jax /*CursorHold* +CursorHold-example ../../plugins/vimdoc-ja/doc/windows.jax /*CursorHold-example* +CursorHoldI ../../plugins/vimdoc-ja/doc/autocmd.jax /*CursorHoldI* +CursorIM ../../plugins/vimdoc-ja/doc/mbyte.jax /*CursorIM* +CursorMoved ../../plugins/vimdoc-ja/doc/autocmd.jax /*CursorMoved* +CursorMovedI ../../plugins/vimdoc-ja/doc/autocmd.jax /*CursorMovedI* +D ../../plugins/vimdoc-ja/doc/change.jax /*D* +DOS ../../plugins/vimdoc-ja/doc/os_dos.jax /*DOS* +DOS-format ../../plugins/vimdoc-ja/doc/editing.jax /*DOS-format* +DOS-format-write ../../plugins/vimdoc-ja/doc/editing.jax /*DOS-format-write* +Dictionaries ../../plugins/vimdoc-ja/doc/eval.jax /*Dictionaries* +Dictionary ../../plugins/vimdoc-ja/doc/eval.jax /*Dictionary* +Dictionary-function ../../plugins/vimdoc-ja/doc/eval.jax /*Dictionary-function* +Digraphs ../../plugins/vimdoc-ja/doc/digraph.jax /*Digraphs* +E ../../plugins/vimdoc-ja/doc/motion.jax /*E* +E10 ../../plugins/vimdoc-ja/doc/message.jax /*E10* +E100 ../../plugins/vimdoc-ja/doc/diff.jax /*E100* +E101 ../../plugins/vimdoc-ja/doc/diff.jax /*E101* +E102 ../../plugins/vimdoc-ja/doc/diff.jax /*E102* +E103 ../../plugins/vimdoc-ja/doc/diff.jax /*E103* +E104 ../../plugins/vimdoc-ja/doc/digraph.jax /*E104* +E105 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E105* +E107 ../../plugins/vimdoc-ja/doc/eval.jax /*E107* +E108 ../../plugins/vimdoc-ja/doc/eval.jax /*E108* +E109 ../../plugins/vimdoc-ja/doc/eval.jax /*E109* +E11 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E11* +E110 ../../plugins/vimdoc-ja/doc/eval.jax /*E110* +E111 ../../plugins/vimdoc-ja/doc/eval.jax /*E111* +E112 ../../plugins/vimdoc-ja/doc/eval.jax /*E112* +E113 ../../plugins/vimdoc-ja/doc/eval.jax /*E113* +E114 ../../plugins/vimdoc-ja/doc/eval.jax /*E114* +E115 ../../plugins/vimdoc-ja/doc/eval.jax /*E115* +E116 ../../plugins/vimdoc-ja/doc/eval.jax /*E116* +E117 ../../plugins/vimdoc-ja/doc/eval.jax /*E117* +E118 ../../plugins/vimdoc-ja/doc/eval.jax /*E118* +E119 ../../plugins/vimdoc-ja/doc/eval.jax /*E119* +E12 ../../plugins/vimdoc-ja/doc/message.jax /*E12* +E120 ../../plugins/vimdoc-ja/doc/eval.jax /*E120* +E121 ../../plugins/vimdoc-ja/doc/eval.jax /*E121* +E122 ../../plugins/vimdoc-ja/doc/eval.jax /*E122* +E123 ../../plugins/vimdoc-ja/doc/eval.jax /*E123* +E124 ../../plugins/vimdoc-ja/doc/eval.jax /*E124* +E125 ../../plugins/vimdoc-ja/doc/eval.jax /*E125* +E126 ../../plugins/vimdoc-ja/doc/eval.jax /*E126* +E127 ../../plugins/vimdoc-ja/doc/eval.jax /*E127* +E128 ../../plugins/vimdoc-ja/doc/eval.jax /*E128* +E129 ../../plugins/vimdoc-ja/doc/eval.jax /*E129* +E13 ../../plugins/vimdoc-ja/doc/message.jax /*E13* +E130 ../../plugins/vimdoc-ja/doc/eval.jax /*E130* +E131 ../../plugins/vimdoc-ja/doc/eval.jax /*E131* +E132 ../../plugins/vimdoc-ja/doc/eval.jax /*E132* +E133 ../../plugins/vimdoc-ja/doc/eval.jax /*E133* +E134 ../../plugins/vimdoc-ja/doc/change.jax /*E134* +E135 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E135* +E136 ../../plugins/vimdoc-ja/doc/starting.jax /*E136* +E137 ../../plugins/vimdoc-ja/doc/starting.jax /*E137* +E138 ../../plugins/vimdoc-ja/doc/starting.jax /*E138* +E139 ../../plugins/vimdoc-ja/doc/message.jax /*E139* +E14 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E14* +E140 ../../plugins/vimdoc-ja/doc/message.jax /*E140* +E141 ../../plugins/vimdoc-ja/doc/message.jax /*E141* +E142 ../../plugins/vimdoc-ja/doc/message.jax /*E142* +E143 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E143* +E144 ../../plugins/vimdoc-ja/doc/various.jax /*E144* +E145 ../../plugins/vimdoc-ja/doc/starting.jax /*E145* +E146 ../../plugins/vimdoc-ja/doc/change.jax /*E146* +E147 ../../plugins/vimdoc-ja/doc/repeat.jax /*E147* +E148 ../../plugins/vimdoc-ja/doc/repeat.jax /*E148* +E149 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E149* +E15 ../../plugins/vimdoc-ja/doc/eval.jax /*E15* +E150 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E150* +E151 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E151* +E152 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E152* +E153 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E153* +E154 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E154* +E155 ../../plugins/vimdoc-ja/doc/sign.jax /*E155* +E156 ../../plugins/vimdoc-ja/doc/sign.jax /*E156* +E157 ../../plugins/vimdoc-ja/doc/sign.jax /*E157* +E158 ../../plugins/vimdoc-ja/doc/sign.jax /*E158* +E159 ../../plugins/vimdoc-ja/doc/sign.jax /*E159* +E16 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E16* +E160 ../../plugins/vimdoc-ja/doc/sign.jax /*E160* +E161 ../../plugins/vimdoc-ja/doc/repeat.jax /*E161* +E162 ../../plugins/vimdoc-ja/doc/message.jax /*E162* +E163 ../../plugins/vimdoc-ja/doc/editing.jax /*E163* +E164 ../../plugins/vimdoc-ja/doc/editing.jax /*E164* +E165 ../../plugins/vimdoc-ja/doc/editing.jax /*E165* +E166 ../../plugins/vimdoc-ja/doc/message.jax /*E166* +E167 ../../plugins/vimdoc-ja/doc/repeat.jax /*E167* +E168 ../../plugins/vimdoc-ja/doc/repeat.jax /*E168* +E169 ../../plugins/vimdoc-ja/doc/message.jax /*E169* +E17 ../../plugins/vimdoc-ja/doc/message.jax /*E17* +E170 ../../plugins/vimdoc-ja/doc/eval.jax /*E170* +E171 ../../plugins/vimdoc-ja/doc/eval.jax /*E171* +E172 ../../plugins/vimdoc-ja/doc/message.jax /*E172* +E173 ../../plugins/vimdoc-ja/doc/message.jax /*E173* +E174 ../../plugins/vimdoc-ja/doc/map.jax /*E174* +E175 ../../plugins/vimdoc-ja/doc/map.jax /*E175* +E176 ../../plugins/vimdoc-ja/doc/map.jax /*E176* +E177 ../../plugins/vimdoc-ja/doc/map.jax /*E177* +E178 ../../plugins/vimdoc-ja/doc/map.jax /*E178* +E179 ../../plugins/vimdoc-ja/doc/map.jax /*E179* +E18 ../../plugins/vimdoc-ja/doc/eval.jax /*E18* +E180 ../../plugins/vimdoc-ja/doc/map.jax /*E180* +E181 ../../plugins/vimdoc-ja/doc/map.jax /*E181* +E182 ../../plugins/vimdoc-ja/doc/map.jax /*E182* +E183 ../../plugins/vimdoc-ja/doc/map.jax /*E183* +E184 ../../plugins/vimdoc-ja/doc/map.jax /*E184* +E185 ../../plugins/vimdoc-ja/doc/syntax.jax /*E185* +E186 ../../plugins/vimdoc-ja/doc/editing.jax /*E186* +E187 ../../plugins/vimdoc-ja/doc/editing.jax /*E187* +E188 ../../plugins/vimdoc-ja/doc/gui.jax /*E188* +E189 ../../plugins/vimdoc-ja/doc/message.jax /*E189* +E19 ../../plugins/vimdoc-ja/doc/message.jax /*E19* +E190 ../../plugins/vimdoc-ja/doc/message.jax /*E190* +E191 ../../plugins/vimdoc-ja/doc/motion.jax /*E191* +E192 ../../plugins/vimdoc-ja/doc/message.jax /*E192* +E193 ../../plugins/vimdoc-ja/doc/eval.jax /*E193* +E194 ../../plugins/vimdoc-ja/doc/message.jax /*E194* +E195 ../../plugins/vimdoc-ja/doc/starting.jax /*E195* +E196 ../../plugins/vimdoc-ja/doc/various.jax /*E196* +E197 ../../plugins/vimdoc-ja/doc/mlang.jax /*E197* +E198 ../../plugins/vimdoc-ja/doc/options.jax /*E198* +E199 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E199* +E20 ../../plugins/vimdoc-ja/doc/motion.jax /*E20* +E200 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E200* +E201 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E201* +E202 ../../plugins/vimdoc-ja/doc/options.jax /*E202* +E203 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E203* +E204 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E204* +E205 ../../plugins/vimdoc-ja/doc/options.jax /*E205* +E206 ../../plugins/vimdoc-ja/doc/options.jax /*E206* +E207 ../../plugins/vimdoc-ja/doc/editing.jax /*E207* +E208 ../../plugins/vimdoc-ja/doc/message.jax /*E208* +E209 ../../plugins/vimdoc-ja/doc/message.jax /*E209* +E21 ../../plugins/vimdoc-ja/doc/options.jax /*E21* +E210 ../../plugins/vimdoc-ja/doc/message.jax /*E210* +E211 ../../plugins/vimdoc-ja/doc/message.jax /*E211* +E212 ../../plugins/vimdoc-ja/doc/message.jax /*E212* +E213 ../../plugins/vimdoc-ja/doc/options.jax /*E213* +E214 ../../plugins/vimdoc-ja/doc/options.jax /*E214* +E215 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E215* +E216 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E216* +E217 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E217* +E218 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E218* +E219 ../../plugins/vimdoc-ja/doc/message.jax /*E219* +E22 ../../plugins/vimdoc-ja/doc/message.jax /*E22* +E220 ../../plugins/vimdoc-ja/doc/message.jax /*E220* +E222 ../../plugins/vimdoc-ja/doc/message.jax /*E222* +E223 ../../plugins/vimdoc-ja/doc/options.jax /*E223* +E224 ../../plugins/vimdoc-ja/doc/map.jax /*E224* +E225 ../../plugins/vimdoc-ja/doc/map.jax /*E225* +E226 ../../plugins/vimdoc-ja/doc/map.jax /*E226* +E227 ../../plugins/vimdoc-ja/doc/map.jax /*E227* +E228 ../../plugins/vimdoc-ja/doc/message.jax /*E228* +E229 ../../plugins/vimdoc-ja/doc/gui.jax /*E229* +E23 ../../plugins/vimdoc-ja/doc/message.jax /*E23* +E230 ../../plugins/vimdoc-ja/doc/starting.jax /*E230* +E231 ../../plugins/vimdoc-ja/doc/options.jax /*E231* +E232 ../../plugins/vimdoc-ja/doc/message.jax /*E232* +E233 ../../plugins/vimdoc-ja/doc/gui.jax /*E233* +E234 ../../plugins/vimdoc-ja/doc/options.jax /*E234* +E235 ../../plugins/vimdoc-ja/doc/options.jax /*E235* +E236 ../../plugins/vimdoc-ja/doc/options.jax /*E236* +E237 ../../plugins/vimdoc-ja/doc/print.jax /*E237* +E238 ../../plugins/vimdoc-ja/doc/print.jax /*E238* +E239 ../../plugins/vimdoc-ja/doc/sign.jax /*E239* +E24 ../../plugins/vimdoc-ja/doc/message.jax /*E24* +E240 ../../plugins/vimdoc-ja/doc/remote.jax /*E240* +E241 ../../plugins/vimdoc-ja/doc/eval.jax /*E241* +E243 ../../plugins/vimdoc-ja/doc/if_ole.jax /*E243* +E244 ../../plugins/vimdoc-ja/doc/options.jax /*E244* +E245 ../../plugins/vimdoc-ja/doc/options.jax /*E245* +E246 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E246* +E247 ../../plugins/vimdoc-ja/doc/remote.jax /*E247* +E248 ../../plugins/vimdoc-ja/doc/remote.jax /*E248* +E25 ../../plugins/vimdoc-ja/doc/message.jax /*E25* +E250 ../../plugins/vimdoc-ja/doc/options.jax /*E250* +E251 ../../plugins/vimdoc-ja/doc/remote.jax /*E251* +E252 ../../plugins/vimdoc-ja/doc/options.jax /*E252* +E253 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E253* +E254 ../../plugins/vimdoc-ja/doc/message.jax /*E254* +E255 ../../plugins/vimdoc-ja/doc/sign.jax /*E255* +E256 ../../plugins/vimdoc-ja/doc/message.jax /*E256* +E257 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E257* +E258 ../../plugins/vimdoc-ja/doc/remote.jax /*E258* +E259 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E259* +E26 ../../plugins/vimdoc-ja/doc/rileft.jax /*E26* +E261 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E261* +E262 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E262* +E263 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E263* +E264 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E264* +E265 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E265* +E266 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E266* +E267 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E267* +E268 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E268* +E269 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E269* +E27 ../../plugins/vimdoc-ja/doc/farsi.jax /*E27* +E270 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E270* +E271 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E271* +E272 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E272* +E273 ../../plugins/vimdoc-ja/doc/if_ruby.jax /*E273* +E277 ../../plugins/vimdoc-ja/doc/remote.jax /*E277* +E28 ../../plugins/vimdoc-ja/doc/syntax.jax /*E28* +E280 ../../plugins/vimdoc-ja/doc/if_tcl.jax /*E280* +E282 ../../plugins/vimdoc-ja/doc/starting.jax /*E282* +E283 ../../plugins/vimdoc-ja/doc/motion.jax /*E283* +E284 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E284* +E285 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E285* +E286 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E286* +E287 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E287* +E288 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E288* +E289 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E289* +E29 ../../plugins/vimdoc-ja/doc/change.jax /*E29* +E293 ../../plugins/vimdoc-ja/doc/message.jax /*E293* +E294 ../../plugins/vimdoc-ja/doc/message.jax /*E294* +E295 ../../plugins/vimdoc-ja/doc/message.jax /*E295* +E296 ../../plugins/vimdoc-ja/doc/message.jax /*E296* +E297 ../../plugins/vimdoc-ja/doc/message.jax /*E297* +E298 ../../plugins/vimdoc-ja/doc/message.jax /*E298* +E299 ../../plugins/vimdoc-ja/doc/if_perl.jax /*E299* +E30 ../../plugins/vimdoc-ja/doc/change.jax /*E30* +E300 ../../plugins/vimdoc-ja/doc/message.jax /*E300* +E301 ../../plugins/vimdoc-ja/doc/message.jax /*E301* +E302 ../../plugins/vimdoc-ja/doc/message.jax /*E302* +E303 ../../plugins/vimdoc-ja/doc/message.jax /*E303* +E304 ../../plugins/vimdoc-ja/doc/message.jax /*E304* +E305 ../../plugins/vimdoc-ja/doc/recover.jax /*E305* +E306 ../../plugins/vimdoc-ja/doc/recover.jax /*E306* +E307 ../../plugins/vimdoc-ja/doc/recover.jax /*E307* +E308 ../../plugins/vimdoc-ja/doc/recover.jax /*E308* +E309 ../../plugins/vimdoc-ja/doc/recover.jax /*E309* +E31 ../../plugins/vimdoc-ja/doc/message.jax /*E31* +E310 ../../plugins/vimdoc-ja/doc/recover.jax /*E310* +E311 ../../plugins/vimdoc-ja/doc/recover.jax /*E311* +E312 ../../plugins/vimdoc-ja/doc/recover.jax /*E312* +E313 ../../plugins/vimdoc-ja/doc/recover.jax /*E313* +E314 ../../plugins/vimdoc-ja/doc/recover.jax /*E314* +E315 ../../plugins/vimdoc-ja/doc/message.jax /*E315* +E316 ../../plugins/vimdoc-ja/doc/message.jax /*E316* +E317 ../../plugins/vimdoc-ja/doc/message.jax /*E317* +E318 ../../plugins/vimdoc-ja/doc/message.jax /*E318* +E319 ../../plugins/vimdoc-ja/doc/message.jax /*E319* +E32 ../../plugins/vimdoc-ja/doc/message.jax /*E32* +E320 ../../plugins/vimdoc-ja/doc/message.jax /*E320* +E321 ../../plugins/vimdoc-ja/doc/editing.jax /*E321* +E322 ../../plugins/vimdoc-ja/doc/message.jax /*E322* +E323 ../../plugins/vimdoc-ja/doc/message.jax /*E323* +E324 ../../plugins/vimdoc-ja/doc/print.jax /*E324* +E325 ../../plugins/vimdoc-ja/doc/usr_11.jax /*E325* +E326 ../../plugins/vimdoc-ja/doc/recover.jax /*E326* +E327 ../../plugins/vimdoc-ja/doc/gui.jax /*E327* +E328 ../../plugins/vimdoc-ja/doc/gui.jax /*E328* +E329 ../../plugins/vimdoc-ja/doc/gui.jax /*E329* +E33 ../../plugins/vimdoc-ja/doc/message.jax /*E33* +E330 ../../plugins/vimdoc-ja/doc/gui.jax /*E330* +E331 ../../plugins/vimdoc-ja/doc/gui.jax /*E331* +E332 ../../plugins/vimdoc-ja/doc/gui.jax /*E332* +E333 ../../plugins/vimdoc-ja/doc/gui.jax /*E333* +E334 ../../plugins/vimdoc-ja/doc/gui.jax /*E334* +E335 ../../plugins/vimdoc-ja/doc/gui.jax /*E335* +E336 ../../plugins/vimdoc-ja/doc/gui.jax /*E336* +E337 ../../plugins/vimdoc-ja/doc/gui.jax /*E337* +E338 ../../plugins/vimdoc-ja/doc/editing.jax /*E338* +E339 ../../plugins/vimdoc-ja/doc/message.jax /*E339* +E34 ../../plugins/vimdoc-ja/doc/various.jax /*E34* +E340 ../../plugins/vimdoc-ja/doc/vi_diff.jax /*E340* +E341 ../../plugins/vimdoc-ja/doc/message.jax /*E341* +E342 ../../plugins/vimdoc-ja/doc/message.jax /*E342* +E343 ../../plugins/vimdoc-ja/doc/options.jax /*E343* +E344 ../../plugins/vimdoc-ja/doc/options.jax /*E344* +E345 ../../plugins/vimdoc-ja/doc/options.jax /*E345* +E346 ../../plugins/vimdoc-ja/doc/options.jax /*E346* +E347 ../../plugins/vimdoc-ja/doc/options.jax /*E347* +E348 ../../plugins/vimdoc-ja/doc/pattern.jax /*E348* +E349 ../../plugins/vimdoc-ja/doc/pattern.jax /*E349* +E35 ../../plugins/vimdoc-ja/doc/message.jax /*E35* +E350 ../../plugins/vimdoc-ja/doc/fold.jax /*E350* +E351 ../../plugins/vimdoc-ja/doc/fold.jax /*E351* +E352 ../../plugins/vimdoc-ja/doc/fold.jax /*E352* +E353 ../../plugins/vimdoc-ja/doc/change.jax /*E353* +E354 ../../plugins/vimdoc-ja/doc/change.jax /*E354* +E355 ../../plugins/vimdoc-ja/doc/options.jax /*E355* +E356 ../../plugins/vimdoc-ja/doc/message.jax /*E356* +E357 ../../plugins/vimdoc-ja/doc/options.jax /*E357* +E358 ../../plugins/vimdoc-ja/doc/options.jax /*E358* +E359 ../../plugins/vimdoc-ja/doc/term.jax /*E359* +E36 ../../plugins/vimdoc-ja/doc/windows.jax /*E36* +E360 ../../plugins/vimdoc-ja/doc/various.jax /*E360* +E363 ../../plugins/vimdoc-ja/doc/options.jax /*E363* +E364 ../../plugins/vimdoc-ja/doc/eval.jax /*E364* +E365 ../../plugins/vimdoc-ja/doc/print.jax /*E365* +E367 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E367* +E368 ../../plugins/vimdoc-ja/doc/eval.jax /*E368* +E369 ../../plugins/vimdoc-ja/doc/pattern.jax /*E369* +E37 ../../plugins/vimdoc-ja/doc/message.jax /*E37* +E370 ../../plugins/vimdoc-ja/doc/various.jax /*E370* +E371 ../../plugins/vimdoc-ja/doc/various.jax /*E371* +E372 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E372* +E373 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E373* +E374 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E374* +E375 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E375* +E376 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E376* +E377 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E377* +E378 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E378* +E379 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E379* +E38 ../../plugins/vimdoc-ja/doc/message.jax /*E38* +E380 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E380* +E381 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E381* +E382 ../../plugins/vimdoc-ja/doc/options.jax /*E382* +E383 ../../plugins/vimdoc-ja/doc/pattern.jax /*E383* +E384 ../../plugins/vimdoc-ja/doc/options.jax /*E384* +E385 ../../plugins/vimdoc-ja/doc/options.jax /*E385* +E386 ../../plugins/vimdoc-ja/doc/pattern.jax /*E386* +E387 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E387* +E388 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E388* +E389 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E389* +E39 ../../plugins/vimdoc-ja/doc/digraph.jax /*E39* +E390 ../../plugins/vimdoc-ja/doc/syntax.jax /*E390* +E391 ../../plugins/vimdoc-ja/doc/syntax.jax /*E391* +E392 ../../plugins/vimdoc-ja/doc/syntax.jax /*E392* +E393 ../../plugins/vimdoc-ja/doc/syntax.jax /*E393* +E394 ../../plugins/vimdoc-ja/doc/syntax.jax /*E394* +E395 ../../plugins/vimdoc-ja/doc/syntax.jax /*E395* +E397 ../../plugins/vimdoc-ja/doc/syntax.jax /*E397* +E398 ../../plugins/vimdoc-ja/doc/syntax.jax /*E398* +E399 ../../plugins/vimdoc-ja/doc/syntax.jax /*E399* +E40 ../../plugins/vimdoc-ja/doc/message.jax /*E40* +E400 ../../plugins/vimdoc-ja/doc/syntax.jax /*E400* +E401 ../../plugins/vimdoc-ja/doc/syntax.jax /*E401* +E402 ../../plugins/vimdoc-ja/doc/syntax.jax /*E402* +E403 ../../plugins/vimdoc-ja/doc/syntax.jax /*E403* +E404 ../../plugins/vimdoc-ja/doc/syntax.jax /*E404* +E405 ../../plugins/vimdoc-ja/doc/syntax.jax /*E405* +E406 ../../plugins/vimdoc-ja/doc/syntax.jax /*E406* +E407 ../../plugins/vimdoc-ja/doc/syntax.jax /*E407* +E408 ../../plugins/vimdoc-ja/doc/syntax.jax /*E408* +E409 ../../plugins/vimdoc-ja/doc/syntax.jax /*E409* +E41 ../../plugins/vimdoc-ja/doc/message.jax /*E41* +E410 ../../plugins/vimdoc-ja/doc/syntax.jax /*E410* +E411 ../../plugins/vimdoc-ja/doc/syntax.jax /*E411* +E412 ../../plugins/vimdoc-ja/doc/syntax.jax /*E412* +E413 ../../plugins/vimdoc-ja/doc/syntax.jax /*E413* +E414 ../../plugins/vimdoc-ja/doc/syntax.jax /*E414* +E415 ../../plugins/vimdoc-ja/doc/syntax.jax /*E415* +E416 ../../plugins/vimdoc-ja/doc/syntax.jax /*E416* +E417 ../../plugins/vimdoc-ja/doc/syntax.jax /*E417* +E418 ../../plugins/vimdoc-ja/doc/syntax.jax /*E418* +E419 ../../plugins/vimdoc-ja/doc/syntax.jax /*E419* +E42 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E42* +E420 ../../plugins/vimdoc-ja/doc/syntax.jax /*E420* +E421 ../../plugins/vimdoc-ja/doc/syntax.jax /*E421* +E422 ../../plugins/vimdoc-ja/doc/syntax.jax /*E422* +E423 ../../plugins/vimdoc-ja/doc/syntax.jax /*E423* +E424 ../../plugins/vimdoc-ja/doc/message.jax /*E424* +E425 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E425* +E426 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E426* +E427 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E427* +E428 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E428* +E429 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E429* +E43 ../../plugins/vimdoc-ja/doc/message.jax /*E43* +E430 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E430* +E431 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E431* +E432 ../../plugins/vimdoc-ja/doc/message.jax /*E432* +E433 ../../plugins/vimdoc-ja/doc/options.jax /*E433* +E434 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E434* +E435 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E435* +E436 ../../plugins/vimdoc-ja/doc/term.jax /*E436* +E437 ../../plugins/vimdoc-ja/doc/term.jax /*E437* +E438 ../../plugins/vimdoc-ja/doc/message.jax /*E438* +E439 ../../plugins/vimdoc-ja/doc/message.jax /*E439* +E44 ../../plugins/vimdoc-ja/doc/message.jax /*E44* +E440 ../../plugins/vimdoc-ja/doc/message.jax /*E440* +E441 ../../plugins/vimdoc-ja/doc/windows.jax /*E441* +E442 ../../plugins/vimdoc-ja/doc/windows.jax /*E442* +E443 ../../plugins/vimdoc-ja/doc/windows.jax /*E443* +E444 ../../plugins/vimdoc-ja/doc/windows.jax /*E444* +E445 ../../plugins/vimdoc-ja/doc/windows.jax /*E445* +E446 ../../plugins/vimdoc-ja/doc/editing.jax /*E446* +E447 ../../plugins/vimdoc-ja/doc/editing.jax /*E447* +E448 ../../plugins/vimdoc-ja/doc/various.jax /*E448* +E449 ../../plugins/vimdoc-ja/doc/eval.jax /*E449* +E45 ../../plugins/vimdoc-ja/doc/message.jax /*E45* +E455 ../../plugins/vimdoc-ja/doc/print.jax /*E455* +E456 ../../plugins/vimdoc-ja/doc/print.jax /*E456* +E457 ../../plugins/vimdoc-ja/doc/print.jax /*E457* +E458 ../../plugins/vimdoc-ja/doc/message.jax /*E458* +E459 ../../plugins/vimdoc-ja/doc/message.jax /*E459* +E46 ../../plugins/vimdoc-ja/doc/message.jax /*E46* +E460 ../../plugins/vimdoc-ja/doc/message.jax /*E460* +E461 ../../plugins/vimdoc-ja/doc/eval.jax /*E461* +E462 ../../plugins/vimdoc-ja/doc/editing.jax /*E462* +E463 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E463* +E464 ../../plugins/vimdoc-ja/doc/message.jax /*E464* +E465 ../../plugins/vimdoc-ja/doc/gui.jax /*E465* +E466 ../../plugins/vimdoc-ja/doc/gui.jax /*E466* +E467 ../../plugins/vimdoc-ja/doc/map.jax /*E467* +E468 ../../plugins/vimdoc-ja/doc/map.jax /*E468* +E469 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E469* +E47 ../../plugins/vimdoc-ja/doc/message.jax /*E47* +E470 ../../plugins/vimdoc-ja/doc/change.jax /*E470* +E471 ../../plugins/vimdoc-ja/doc/message.jax /*E471* +E472 ../../plugins/vimdoc-ja/doc/editing.jax /*E472* +E473 ../../plugins/vimdoc-ja/doc/message.jax /*E473* +E474 ../../plugins/vimdoc-ja/doc/message.jax /*E474* +E475 ../../plugins/vimdoc-ja/doc/message.jax /*E475* +E476 ../../plugins/vimdoc-ja/doc/pattern.jax /*E476* +E477 ../../plugins/vimdoc-ja/doc/message.jax /*E477* +E478 ../../plugins/vimdoc-ja/doc/message.jax /*E478* +E479 ../../plugins/vimdoc-ja/doc/editing.jax /*E479* +E48 ../../plugins/vimdoc-ja/doc/eval.jax /*E48* +E480 ../../plugins/vimdoc-ja/doc/editing.jax /*E480* +E481 ../../plugins/vimdoc-ja/doc/message.jax /*E481* +E482 ../../plugins/vimdoc-ja/doc/message.jax /*E482* +E483 ../../plugins/vimdoc-ja/doc/message.jax /*E483* +E484 ../../plugins/vimdoc-ja/doc/message.jax /*E484* +E485 ../../plugins/vimdoc-ja/doc/message.jax /*E485* +E486 ../../plugins/vimdoc-ja/doc/pattern.jax /*E486* +E487 ../../plugins/vimdoc-ja/doc/options.jax /*E487* +E488 ../../plugins/vimdoc-ja/doc/message.jax /*E488* +E49 ../../plugins/vimdoc-ja/doc/message.jax /*E49* +E490 ../../plugins/vimdoc-ja/doc/fold.jax /*E490* +E492 ../../plugins/vimdoc-ja/doc/message.jax /*E492* +E493 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E493* +E494 ../../plugins/vimdoc-ja/doc/editing.jax /*E494* +E495 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E495* +E496 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E496* +E497 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E497* +E498 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E498* +E499 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E499* +E50 ../../plugins/vimdoc-ja/doc/syntax.jax /*E50* +E500 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E500* +E501 ../../plugins/vimdoc-ja/doc/intro.jax /*E501* +E502 ../../plugins/vimdoc-ja/doc/editing.jax /*E502* +E503 ../../plugins/vimdoc-ja/doc/editing.jax /*E503* +E504 ../../plugins/vimdoc-ja/doc/editing.jax /*E504* +E505 ../../plugins/vimdoc-ja/doc/editing.jax /*E505* +E506 ../../plugins/vimdoc-ja/doc/editing.jax /*E506* +E507 ../../plugins/vimdoc-ja/doc/editing.jax /*E507* +E508 ../../plugins/vimdoc-ja/doc/editing.jax /*E508* +E509 ../../plugins/vimdoc-ja/doc/editing.jax /*E509* +E51 ../../plugins/vimdoc-ja/doc/pattern.jax /*E51* +E510 ../../plugins/vimdoc-ja/doc/editing.jax /*E510* +E511 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E511* +E512 ../../plugins/vimdoc-ja/doc/editing.jax /*E512* +E513 ../../plugins/vimdoc-ja/doc/options.jax /*E513* +E514 ../../plugins/vimdoc-ja/doc/editing.jax /*E514* +E515 ../../plugins/vimdoc-ja/doc/windows.jax /*E515* +E516 ../../plugins/vimdoc-ja/doc/windows.jax /*E516* +E517 ../../plugins/vimdoc-ja/doc/windows.jax /*E517* +E518 ../../plugins/vimdoc-ja/doc/options.jax /*E518* +E519 ../../plugins/vimdoc-ja/doc/options.jax /*E519* +E52 ../../plugins/vimdoc-ja/doc/syntax.jax /*E52* +E520 ../../plugins/vimdoc-ja/doc/options.jax /*E520* +E521 ../../plugins/vimdoc-ja/doc/options.jax /*E521* +E522 ../../plugins/vimdoc-ja/doc/options.jax /*E522* +E523 ../../plugins/vimdoc-ja/doc/options.jax /*E523* +E524 ../../plugins/vimdoc-ja/doc/options.jax /*E524* +E525 ../../plugins/vimdoc-ja/doc/options.jax /*E525* +E526 ../../plugins/vimdoc-ja/doc/options.jax /*E526* +E527 ../../plugins/vimdoc-ja/doc/options.jax /*E527* +E528 ../../plugins/vimdoc-ja/doc/options.jax /*E528* +E529 ../../plugins/vimdoc-ja/doc/options.jax /*E529* +E53 ../../plugins/vimdoc-ja/doc/pattern.jax /*E53* +E530 ../../plugins/vimdoc-ja/doc/options.jax /*E530* +E531 ../../plugins/vimdoc-ja/doc/options.jax /*E531* +E532 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E532* +E533 ../../plugins/vimdoc-ja/doc/options.jax /*E533* +E534 ../../plugins/vimdoc-ja/doc/options.jax /*E534* +E535 ../../plugins/vimdoc-ja/doc/options.jax /*E535* +E536 ../../plugins/vimdoc-ja/doc/options.jax /*E536* +E537 ../../plugins/vimdoc-ja/doc/options.jax /*E537* +E538 ../../plugins/vimdoc-ja/doc/options.jax /*E538* +E539 ../../plugins/vimdoc-ja/doc/options.jax /*E539* +E54 ../../plugins/vimdoc-ja/doc/pattern.jax /*E54* +E540 ../../plugins/vimdoc-ja/doc/options.jax /*E540* +E541 ../../plugins/vimdoc-ja/doc/options.jax /*E541* +E542 ../../plugins/vimdoc-ja/doc/options.jax /*E542* +E543 ../../plugins/vimdoc-ja/doc/options.jax /*E543* +E544 ../../plugins/vimdoc-ja/doc/options.jax /*E544* +E545 ../../plugins/vimdoc-ja/doc/options.jax /*E545* +E546 ../../plugins/vimdoc-ja/doc/options.jax /*E546* +E547 ../../plugins/vimdoc-ja/doc/options.jax /*E547* +E548 ../../plugins/vimdoc-ja/doc/options.jax /*E548* +E549 ../../plugins/vimdoc-ja/doc/options.jax /*E549* +E55 ../../plugins/vimdoc-ja/doc/pattern.jax /*E55* +E550 ../../plugins/vimdoc-ja/doc/options.jax /*E550* +E551 ../../plugins/vimdoc-ja/doc/options.jax /*E551* +E552 ../../plugins/vimdoc-ja/doc/options.jax /*E552* +E553 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E553* +E554 ../../plugins/vimdoc-ja/doc/pattern.jax /*E554* +E555 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E555* +E556 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E556* +E557 ../../plugins/vimdoc-ja/doc/term.jax /*E557* +E558 ../../plugins/vimdoc-ja/doc/term.jax /*E558* +E559 ../../plugins/vimdoc-ja/doc/term.jax /*E559* +E560 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E560* +E561 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E561* +E562 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E562* +E563 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E563* +E564 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E564* +E566 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E566* +E567 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E567* +E568 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E568* +E570 ../../plugins/vimdoc-ja/doc/message.jax /*E570* +E571 ../../plugins/vimdoc-ja/doc/if_tcl.jax /*E571* +E572 ../../plugins/vimdoc-ja/doc/if_tcl.jax /*E572* +E573 ../../plugins/vimdoc-ja/doc/remote.jax /*E573* +E574 ../../plugins/vimdoc-ja/doc/starting.jax /*E574* +E575 ../../plugins/vimdoc-ja/doc/starting.jax /*E575* +E576 ../../plugins/vimdoc-ja/doc/starting.jax /*E576* +E577 ../../plugins/vimdoc-ja/doc/starting.jax /*E577* +E579 ../../plugins/vimdoc-ja/doc/eval.jax /*E579* +E580 ../../plugins/vimdoc-ja/doc/eval.jax /*E580* +E581 ../../plugins/vimdoc-ja/doc/eval.jax /*E581* +E582 ../../plugins/vimdoc-ja/doc/eval.jax /*E582* +E583 ../../plugins/vimdoc-ja/doc/eval.jax /*E583* +E584 ../../plugins/vimdoc-ja/doc/eval.jax /*E584* +E585 ../../plugins/vimdoc-ja/doc/eval.jax /*E585* +E586 ../../plugins/vimdoc-ja/doc/eval.jax /*E586* +E587 ../../plugins/vimdoc-ja/doc/eval.jax /*E587* +E588 ../../plugins/vimdoc-ja/doc/eval.jax /*E588* +E589 ../../plugins/vimdoc-ja/doc/options.jax /*E589* +E59 ../../plugins/vimdoc-ja/doc/pattern.jax /*E59* +E590 ../../plugins/vimdoc-ja/doc/options.jax /*E590* +E591 ../../plugins/vimdoc-ja/doc/options.jax /*E591* +E592 ../../plugins/vimdoc-ja/doc/options.jax /*E592* +E593 ../../plugins/vimdoc-ja/doc/options.jax /*E593* +E594 ../../plugins/vimdoc-ja/doc/options.jax /*E594* +E595 ../../plugins/vimdoc-ja/doc/options.jax /*E595* +E596 ../../plugins/vimdoc-ja/doc/options.jax /*E596* +E597 ../../plugins/vimdoc-ja/doc/options.jax /*E597* +E598 ../../plugins/vimdoc-ja/doc/options.jax /*E598* +E599 ../../plugins/vimdoc-ja/doc/options.jax /*E599* +E60 ../../plugins/vimdoc-ja/doc/pattern.jax /*E60* +E600 ../../plugins/vimdoc-ja/doc/eval.jax /*E600* +E601 ../../plugins/vimdoc-ja/doc/eval.jax /*E601* +E602 ../../plugins/vimdoc-ja/doc/eval.jax /*E602* +E603 ../../plugins/vimdoc-ja/doc/eval.jax /*E603* +E604 ../../plugins/vimdoc-ja/doc/eval.jax /*E604* +E605 ../../plugins/vimdoc-ja/doc/eval.jax /*E605* +E606 ../../plugins/vimdoc-ja/doc/eval.jax /*E606* +E607 ../../plugins/vimdoc-ja/doc/eval.jax /*E607* +E608 ../../plugins/vimdoc-ja/doc/eval.jax /*E608* +E609 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E609* +E61 ../../plugins/vimdoc-ja/doc/pattern.jax /*E61* +E612 ../../plugins/vimdoc-ja/doc/sign.jax /*E612* +E613 ../../plugins/vimdoc-ja/doc/print.jax /*E613* +E614 ../../plugins/vimdoc-ja/doc/editing.jax /*E614* +E615 ../../plugins/vimdoc-ja/doc/editing.jax /*E615* +E616 ../../plugins/vimdoc-ja/doc/editing.jax /*E616* +E617 ../../plugins/vimdoc-ja/doc/options.jax /*E617* +E618 ../../plugins/vimdoc-ja/doc/print.jax /*E618* +E619 ../../plugins/vimdoc-ja/doc/print.jax /*E619* +E62 ../../plugins/vimdoc-ja/doc/pattern.jax /*E62* +E620 ../../plugins/vimdoc-ja/doc/print.jax /*E620* +E621 ../../plugins/vimdoc-ja/doc/print.jax /*E621* +E622 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E622* +E623 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E623* +E624 ../../plugins/vimdoc-ja/doc/print.jax /*E624* +E625 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E625* +E626 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*E626* +E627 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E627* +E628 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E628* +E629 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E629* +E63 ../../plugins/vimdoc-ja/doc/pattern.jax /*E63* +E630 ../../plugins/vimdoc-ja/doc/channel.jax /*E630* +E631 ../../plugins/vimdoc-ja/doc/channel.jax /*E631* +E632 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E632* +E633 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E633* +E634 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E634* +E635 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E635* +E636 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E636* +E637 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E637* +E638 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E638* +E639 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E639* +E64 ../../plugins/vimdoc-ja/doc/pattern.jax /*E64* +E640 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E640* +E641 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E641* +E642 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E642* +E643 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E643* +E644 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E644* +E645 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E645* +E646 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E646* +E647 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E647* +E648 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E648* +E649 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E649* +E65 ../../plugins/vimdoc-ja/doc/pattern.jax /*E65* +E650 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E650* +E651 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E651* +E652 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E652* +E655 ../../plugins/vimdoc-ja/doc/eval.jax /*E655* +E656 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E656* +E657 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E657* +E658 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E658* +E659 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E659* +E66 ../../plugins/vimdoc-ja/doc/syntax.jax /*E66* +E660 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E660* +E661 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E661* +E662 ../../plugins/vimdoc-ja/doc/motion.jax /*E662* +E663 ../../plugins/vimdoc-ja/doc/motion.jax /*E663* +E664 ../../plugins/vimdoc-ja/doc/motion.jax /*E664* +E665 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*E665* +E666 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E666* +E667 ../../plugins/vimdoc-ja/doc/editing.jax /*E667* +E668 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E668* +E669 ../../plugins/vimdoc-ja/doc/syntax.jax /*E669* +E67 ../../plugins/vimdoc-ja/doc/syntax.jax /*E67* +E670 ../../plugins/vimdoc-ja/doc/helphelp.jax /*E670* +E671 ../../plugins/vimdoc-ja/doc/starting.jax /*E671* +E672 ../../plugins/vimdoc-ja/doc/starting.jax /*E672* +E673 ../../plugins/vimdoc-ja/doc/print.jax /*E673* +E674 ../../plugins/vimdoc-ja/doc/print.jax /*E674* +E675 ../../plugins/vimdoc-ja/doc/print.jax /*E675* +E676 ../../plugins/vimdoc-ja/doc/options.jax /*E676* +E677 ../../plugins/vimdoc-ja/doc/eval.jax /*E677* +E678 ../../plugins/vimdoc-ja/doc/pattern.jax /*E678* +E679 ../../plugins/vimdoc-ja/doc/syntax.jax /*E679* +E68 ../../plugins/vimdoc-ja/doc/pattern.jax /*E68* +E680 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E680* +E681 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E681* +E682 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E682* +E683 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E683* +E684 ../../plugins/vimdoc-ja/doc/eval.jax /*E684* +E685 ../../plugins/vimdoc-ja/doc/message.jax /*E685* +E686 ../../plugins/vimdoc-ja/doc/eval.jax /*E686* +E687 ../../plugins/vimdoc-ja/doc/eval.jax /*E687* +E688 ../../plugins/vimdoc-ja/doc/eval.jax /*E688* +E689 ../../plugins/vimdoc-ja/doc/eval.jax /*E689* +E69 ../../plugins/vimdoc-ja/doc/pattern.jax /*E69* +E690 ../../plugins/vimdoc-ja/doc/eval.jax /*E690* +E691 ../../plugins/vimdoc-ja/doc/eval.jax /*E691* +E692 ../../plugins/vimdoc-ja/doc/eval.jax /*E692* +E694 ../../plugins/vimdoc-ja/doc/eval.jax /*E694* +E695 ../../plugins/vimdoc-ja/doc/eval.jax /*E695* +E696 ../../plugins/vimdoc-ja/doc/eval.jax /*E696* +E697 ../../plugins/vimdoc-ja/doc/eval.jax /*E697* +E698 ../../plugins/vimdoc-ja/doc/eval.jax /*E698* +E699 ../../plugins/vimdoc-ja/doc/eval.jax /*E699* +E70 ../../plugins/vimdoc-ja/doc/pattern.jax /*E70* +E700 ../../plugins/vimdoc-ja/doc/eval.jax /*E700* +E701 ../../plugins/vimdoc-ja/doc/eval.jax /*E701* +E702 ../../plugins/vimdoc-ja/doc/eval.jax /*E702* +E703 ../../plugins/vimdoc-ja/doc/eval.jax /*E703* +E704 ../../plugins/vimdoc-ja/doc/eval.jax /*E704* +E705 ../../plugins/vimdoc-ja/doc/eval.jax /*E705* +E707 ../../plugins/vimdoc-ja/doc/eval.jax /*E707* +E708 ../../plugins/vimdoc-ja/doc/eval.jax /*E708* +E709 ../../plugins/vimdoc-ja/doc/eval.jax /*E709* +E71 ../../plugins/vimdoc-ja/doc/pattern.jax /*E71* +E710 ../../plugins/vimdoc-ja/doc/eval.jax /*E710* +E711 ../../plugins/vimdoc-ja/doc/eval.jax /*E711* +E712 ../../plugins/vimdoc-ja/doc/eval.jax /*E712* +E713 ../../plugins/vimdoc-ja/doc/eval.jax /*E713* +E714 ../../plugins/vimdoc-ja/doc/eval.jax /*E714* +E715 ../../plugins/vimdoc-ja/doc/eval.jax /*E715* +E716 ../../plugins/vimdoc-ja/doc/eval.jax /*E716* +E717 ../../plugins/vimdoc-ja/doc/eval.jax /*E717* +E718 ../../plugins/vimdoc-ja/doc/eval.jax /*E718* +E719 ../../plugins/vimdoc-ja/doc/eval.jax /*E719* +E72 ../../plugins/vimdoc-ja/doc/message.jax /*E72* +E720 ../../plugins/vimdoc-ja/doc/eval.jax /*E720* +E721 ../../plugins/vimdoc-ja/doc/eval.jax /*E721* +E722 ../../plugins/vimdoc-ja/doc/eval.jax /*E722* +E723 ../../plugins/vimdoc-ja/doc/eval.jax /*E723* +E724 ../../plugins/vimdoc-ja/doc/eval.jax /*E724* +E725 ../../plugins/vimdoc-ja/doc/eval.jax /*E725* +E726 ../../plugins/vimdoc-ja/doc/eval.jax /*E726* +E727 ../../plugins/vimdoc-ja/doc/eval.jax /*E727* +E728 ../../plugins/vimdoc-ja/doc/eval.jax /*E728* +E729 ../../plugins/vimdoc-ja/doc/eval.jax /*E729* +E73 ../../plugins/vimdoc-ja/doc/tagsrch.jax /*E73* +E730 ../../plugins/vimdoc-ja/doc/eval.jax /*E730* +E731 ../../plugins/vimdoc-ja/doc/eval.jax /*E731* +E732 ../../plugins/vimdoc-ja/doc/eval.jax /*E732* +E733 ../../plugins/vimdoc-ja/doc/eval.jax /*E733* +E734 ../../plugins/vimdoc-ja/doc/eval.jax /*E734* +E735 ../../plugins/vimdoc-ja/doc/eval.jax /*E735* +E736 ../../plugins/vimdoc-ja/doc/eval.jax /*E736* +E737 ../../plugins/vimdoc-ja/doc/eval.jax /*E737* +E738 ../../plugins/vimdoc-ja/doc/eval.jax /*E738* +E739 ../../plugins/vimdoc-ja/doc/eval.jax /*E739* +E74 ../../plugins/vimdoc-ja/doc/message.jax /*E74* +E740 ../../plugins/vimdoc-ja/doc/eval.jax /*E740* +E741 ../../plugins/vimdoc-ja/doc/eval.jax /*E741* +E742 ../../plugins/vimdoc-ja/doc/eval.jax /*E742* +E743 ../../plugins/vimdoc-ja/doc/eval.jax /*E743* +E744 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E744* +E745 ../../plugins/vimdoc-ja/doc/eval.jax /*E745* +E746 ../../plugins/vimdoc-ja/doc/eval.jax /*E746* +E747 ../../plugins/vimdoc-ja/doc/editing.jax /*E747* +E748 ../../plugins/vimdoc-ja/doc/repeat.jax /*E748* +E749 ../../plugins/vimdoc-ja/doc/various.jax /*E749* +E75 ../../plugins/vimdoc-ja/doc/vi_diff.jax /*E75* +E750 ../../plugins/vimdoc-ja/doc/repeat.jax /*E750* +E751 ../../plugins/vimdoc-ja/doc/spell.jax /*E751* +E752 ../../plugins/vimdoc-ja/doc/spell.jax /*E752* +E753 ../../plugins/vimdoc-ja/doc/spell.jax /*E753* +E754 ../../plugins/vimdoc-ja/doc/spell.jax /*E754* +E755 ../../plugins/vimdoc-ja/doc/spell.jax /*E755* +E756 ../../plugins/vimdoc-ja/doc/spell.jax /*E756* +E757 ../../plugins/vimdoc-ja/doc/options.jax /*E757* +E758 ../../plugins/vimdoc-ja/doc/spell.jax /*E758* +E759 ../../plugins/vimdoc-ja/doc/spell.jax /*E759* +E76 ../../plugins/vimdoc-ja/doc/pattern.jax /*E76* +E760 ../../plugins/vimdoc-ja/doc/spell.jax /*E760* +E761 ../../plugins/vimdoc-ja/doc/spell.jax /*E761* +E762 ../../plugins/vimdoc-ja/doc/spell.jax /*E762* +E763 ../../plugins/vimdoc-ja/doc/spell.jax /*E763* +E764 ../../plugins/vimdoc-ja/doc/options.jax /*E764* +E765 ../../plugins/vimdoc-ja/doc/options.jax /*E765* +E766 ../../plugins/vimdoc-ja/doc/eval.jax /*E766* +E767 ../../plugins/vimdoc-ja/doc/eval.jax /*E767* +E768 ../../plugins/vimdoc-ja/doc/message.jax /*E768* +E769 ../../plugins/vimdoc-ja/doc/pattern.jax /*E769* +E77 ../../plugins/vimdoc-ja/doc/message.jax /*E77* +E770 ../../plugins/vimdoc-ja/doc/spell.jax /*E770* +E771 ../../plugins/vimdoc-ja/doc/spell.jax /*E771* +E772 ../../plugins/vimdoc-ja/doc/spell.jax /*E772* +E773 ../../plugins/vimdoc-ja/doc/recover.jax /*E773* +E774 ../../plugins/vimdoc-ja/doc/map.jax /*E774* +E775 ../../plugins/vimdoc-ja/doc/map.jax /*E775* +E776 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E776* +E777 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E777* +E778 ../../plugins/vimdoc-ja/doc/spell.jax /*E778* +E779 ../../plugins/vimdoc-ja/doc/spell.jax /*E779* +E78 ../../plugins/vimdoc-ja/doc/motion.jax /*E78* +E780 ../../plugins/vimdoc-ja/doc/spell.jax /*E780* +E781 ../../plugins/vimdoc-ja/doc/spell.jax /*E781* +E782 ../../plugins/vimdoc-ja/doc/spell.jax /*E782* +E783 ../../plugins/vimdoc-ja/doc/spell.jax /*E783* +E784 ../../plugins/vimdoc-ja/doc/tabpage.jax /*E784* +E785 ../../plugins/vimdoc-ja/doc/eval.jax /*E785* +E786 ../../plugins/vimdoc-ja/doc/eval.jax /*E786* +E787 ../../plugins/vimdoc-ja/doc/diff.jax /*E787* +E788 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E788* +E789 ../../plugins/vimdoc-ja/doc/syntax.jax /*E789* +E79 ../../plugins/vimdoc-ja/doc/message.jax /*E79* +E790 ../../plugins/vimdoc-ja/doc/undo.jax /*E790* +E791 ../../plugins/vimdoc-ja/doc/mbyte.jax /*E791* +E792 ../../plugins/vimdoc-ja/doc/gui.jax /*E792* +E793 ../../plugins/vimdoc-ja/doc/diff.jax /*E793* +E794 ../../plugins/vimdoc-ja/doc/eval.jax /*E794* +E795 ../../plugins/vimdoc-ja/doc/eval.jax /*E795* +E796 ../../plugins/vimdoc-ja/doc/editing.jax /*E796* +E797 ../../plugins/vimdoc-ja/doc/spell.jax /*E797* +E798 ../../plugins/vimdoc-ja/doc/eval.jax /*E798* +E799 ../../plugins/vimdoc-ja/doc/eval.jax /*E799* +E80 ../../plugins/vimdoc-ja/doc/message.jax /*E80* +E800 ../../plugins/vimdoc-ja/doc/arabic.jax /*E800* +E801 ../../plugins/vimdoc-ja/doc/eval.jax /*E801* +E802 ../../plugins/vimdoc-ja/doc/eval.jax /*E802* +E803 ../../plugins/vimdoc-ja/doc/eval.jax /*E803* +E804 ../../plugins/vimdoc-ja/doc/eval.jax /*E804* +E805 ../../plugins/vimdoc-ja/doc/eval.jax /*E805* +E806 ../../plugins/vimdoc-ja/doc/eval.jax /*E806* +E807 ../../plugins/vimdoc-ja/doc/eval.jax /*E807* +E808 ../../plugins/vimdoc-ja/doc/eval.jax /*E808* +E809 ../../plugins/vimdoc-ja/doc/cmdline.jax /*E809* +E81 ../../plugins/vimdoc-ja/doc/map.jax /*E81* +E810 ../../plugins/vimdoc-ja/doc/diff.jax /*E810* +E811 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E811* +E812 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E812* +E813 ../../plugins/vimdoc-ja/doc/editing.jax /*E813* +E814 ../../plugins/vimdoc-ja/doc/editing.jax /*E814* +E815 ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*E815* +E816 ../../plugins/vimdoc-ja/doc/diff.jax /*E816* +E817 ../../plugins/vimdoc-ja/doc/editing.jax /*E817* +E818 ../../plugins/vimdoc-ja/doc/editing.jax /*E818* +E819 ../../plugins/vimdoc-ja/doc/editing.jax /*E819* +E82 ../../plugins/vimdoc-ja/doc/message.jax /*E82* +E820 ../../plugins/vimdoc-ja/doc/editing.jax /*E820* +E821 ../../plugins/vimdoc-ja/doc/options.jax /*E821* +E822 ../../plugins/vimdoc-ja/doc/undo.jax /*E822* +E823 ../../plugins/vimdoc-ja/doc/undo.jax /*E823* +E824 ../../plugins/vimdoc-ja/doc/undo.jax /*E824* +E825 ../../plugins/vimdoc-ja/doc/undo.jax /*E825* +E826 ../../plugins/vimdoc-ja/doc/undo.jax /*E826* +E827 ../../plugins/vimdoc-ja/doc/undo.jax /*E827* +E828 ../../plugins/vimdoc-ja/doc/undo.jax /*E828* +E829 ../../plugins/vimdoc-ja/doc/undo.jax /*E829* +E83 ../../plugins/vimdoc-ja/doc/message.jax /*E83* +E830 ../../plugins/vimdoc-ja/doc/undo.jax /*E830* +E831 ../../plugins/vimdoc-ja/doc/editing.jax /*E831* +E832 ../../plugins/vimdoc-ja/doc/undo.jax /*E832* +E833 ../../plugins/vimdoc-ja/doc/editing.jax /*E833* +E834 ../../plugins/vimdoc-ja/doc/options.jax /*E834* +E835 ../../plugins/vimdoc-ja/doc/options.jax /*E835* +E836 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E836* +E837 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E837* +E838 ../../plugins/vimdoc-ja/doc/netbeans.jax /*E838* +E839 ../../plugins/vimdoc-ja/doc/insert.jax /*E839* +E84 ../../plugins/vimdoc-ja/doc/windows.jax /*E84* +E840 ../../plugins/vimdoc-ja/doc/insert.jax /*E840* +E841 ../../plugins/vimdoc-ja/doc/map.jax /*E841* +E843 ../../plugins/vimdoc-ja/doc/editing.jax /*E843* +E844 ../../plugins/vimdoc-ja/doc/syntax.jax /*E844* +E845 ../../plugins/vimdoc-ja/doc/spell.jax /*E845* +E846 ../../plugins/vimdoc-ja/doc/options.jax /*E846* +E847 ../../plugins/vimdoc-ja/doc/syntax.jax /*E847* +E848 ../../plugins/vimdoc-ja/doc/syntax.jax /*E848* +E849 ../../plugins/vimdoc-ja/doc/syntax.jax /*E849* +E85 ../../plugins/vimdoc-ja/doc/options.jax /*E85* +E850 ../../plugins/vimdoc-ja/doc/change.jax /*E850* +E851 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*E851* +E852 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*E852* +E853 ../../plugins/vimdoc-ja/doc/eval.jax /*E853* +E854 ../../plugins/vimdoc-ja/doc/options.jax /*E854* +E855 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E855* +E858 ../../plugins/vimdoc-ja/doc/eval.jax /*E858* +E859 ../../plugins/vimdoc-ja/doc/eval.jax /*E859* +E86 ../../plugins/vimdoc-ja/doc/windows.jax /*E86* +E860 ../../plugins/vimdoc-ja/doc/eval.jax /*E860* +E862 ../../plugins/vimdoc-ja/doc/eval.jax /*E862* +E864 ../../plugins/vimdoc-ja/doc/pattern.jax /*E864* +E865 ../../plugins/vimdoc-ja/doc/pattern.jax /*E865* +E866 ../../plugins/vimdoc-ja/doc/pattern.jax /*E866* +E867 ../../plugins/vimdoc-ja/doc/pattern.jax /*E867* +E868 ../../plugins/vimdoc-ja/doc/pattern.jax /*E868* +E869 ../../plugins/vimdoc-ja/doc/pattern.jax /*E869* +E87 ../../plugins/vimdoc-ja/doc/windows.jax /*E87* +E870 ../../plugins/vimdoc-ja/doc/pattern.jax /*E870* +E871 ../../plugins/vimdoc-ja/doc/pattern.jax /*E871* +E872 ../../plugins/vimdoc-ja/doc/pattern.jax /*E872* +E873 ../../plugins/vimdoc-ja/doc/pattern.jax /*E873* +E874 ../../plugins/vimdoc-ja/doc/pattern.jax /*E874* +E875 ../../plugins/vimdoc-ja/doc/pattern.jax /*E875* +E876 ../../plugins/vimdoc-ja/doc/pattern.jax /*E876* +E877 ../../plugins/vimdoc-ja/doc/pattern.jax /*E877* +E878 ../../plugins/vimdoc-ja/doc/pattern.jax /*E878* +E879 ../../plugins/vimdoc-ja/doc/syntax.jax /*E879* +E88 ../../plugins/vimdoc-ja/doc/windows.jax /*E88* +E880 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E880* +E881 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E881* +E882 ../../plugins/vimdoc-ja/doc/eval.jax /*E882* +E883 ../../plugins/vimdoc-ja/doc/eval.jax /*E883* +E884 ../../plugins/vimdoc-ja/doc/eval.jax /*E884* +E885 ../../plugins/vimdoc-ja/doc/sign.jax /*E885* +E886 ../../plugins/vimdoc-ja/doc/starting.jax /*E886* +E887 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*E887* +E888 ../../plugins/vimdoc-ja/doc/pattern.jax /*E888* +E89 ../../plugins/vimdoc-ja/doc/message.jax /*E89* +E890 ../../plugins/vimdoc-ja/doc/syntax.jax /*E890* +E891 ../../plugins/vimdoc-ja/doc/eval.jax /*E891* +E892 ../../plugins/vimdoc-ja/doc/eval.jax /*E892* +E893 ../../plugins/vimdoc-ja/doc/eval.jax /*E893* +E894 ../../plugins/vimdoc-ja/doc/eval.jax /*E894* +E895 ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*E895* +E898 ../../plugins/vimdoc-ja/doc/channel.jax /*E898* +E90 ../../plugins/vimdoc-ja/doc/message.jax /*E90* +E901 ../../plugins/vimdoc-ja/doc/channel.jax /*E901* +E902 ../../plugins/vimdoc-ja/doc/channel.jax /*E902* +E903 ../../plugins/vimdoc-ja/doc/channel.jax /*E903* +E904 ../../plugins/vimdoc-ja/doc/channel.jax /*E904* +E905 ../../plugins/vimdoc-ja/doc/channel.jax /*E905* +E906 ../../plugins/vimdoc-ja/doc/channel.jax /*E906* +E907 ../../plugins/vimdoc-ja/doc/eval.jax /*E907* +E908 ../../plugins/vimdoc-ja/doc/eval.jax /*E908* +E909 ../../plugins/vimdoc-ja/doc/eval.jax /*E909* +E91 ../../plugins/vimdoc-ja/doc/options.jax /*E91* +E910 ../../plugins/vimdoc-ja/doc/eval.jax /*E910* +E911 ../../plugins/vimdoc-ja/doc/eval.jax /*E911* +E913 ../../plugins/vimdoc-ja/doc/eval.jax /*E913* +E914 ../../plugins/vimdoc-ja/doc/eval.jax /*E914* +E915 ../../plugins/vimdoc-ja/doc/channel.jax /*E915* +E916 ../../plugins/vimdoc-ja/doc/eval.jax /*E916* +E917 ../../plugins/vimdoc-ja/doc/eval.jax /*E917* +E918 ../../plugins/vimdoc-ja/doc/channel.jax /*E918* +E919 ../../plugins/vimdoc-ja/doc/repeat.jax /*E919* +E92 ../../plugins/vimdoc-ja/doc/message.jax /*E92* +E920 ../../plugins/vimdoc-ja/doc/channel.jax /*E920* +E921 ../../plugins/vimdoc-ja/doc/channel.jax /*E921* +E922 ../../plugins/vimdoc-ja/doc/eval.jax /*E922* +E923 ../../plugins/vimdoc-ja/doc/eval.jax /*E923* +E924 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E924* +E925 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E925* +E926 ../../plugins/vimdoc-ja/doc/quickfix.jax /*E926* +E927 ../../plugins/vimdoc-ja/doc/eval.jax /*E927* +E929 ../../plugins/vimdoc-ja/doc/starting.jax /*E929* +E93 ../../plugins/vimdoc-ja/doc/windows.jax /*E93* +E930 ../../plugins/vimdoc-ja/doc/eval.jax /*E930* +E931 ../../plugins/vimdoc-ja/doc/message.jax /*E931* +E932 ../../plugins/vimdoc-ja/doc/eval.jax /*E932* +E933 ../../plugins/vimdoc-ja/doc/eval.jax /*E933* +E934 ../../plugins/vimdoc-ja/doc/sign.jax /*E934* +E935 ../../plugins/vimdoc-ja/doc/eval.jax /*E935* +E936 ../../plugins/vimdoc-ja/doc/autocmd.jax /*E936* +E94 ../../plugins/vimdoc-ja/doc/windows.jax /*E94* +E95 ../../plugins/vimdoc-ja/doc/message.jax /*E95* +E96 ../../plugins/vimdoc-ja/doc/diff.jax /*E96* +E97 ../../plugins/vimdoc-ja/doc/diff.jax /*E97* +E98 ../../plugins/vimdoc-ja/doc/diff.jax /*E98* +E99 ../../plugins/vimdoc-ja/doc/diff.jax /*E99* +EX ../../plugins/vimdoc-ja/doc/intro.jax /*EX* +EXINIT ../../plugins/vimdoc-ja/doc/starting.jax /*EXINIT* +Elvis ../../plugins/vimdoc-ja/doc/intro.jax /*Elvis* +EncodingChanged ../../plugins/vimdoc-ja/doc/autocmd.jax /*EncodingChanged* +Eterm ../../plugins/vimdoc-ja/doc/syntax.jax /*Eterm* +Ex ../../plugins/vimdoc-ja/doc/intro.jax /*Ex* +Ex-mode ../../plugins/vimdoc-ja/doc/intro.jax /*Ex-mode* +Exuberant_ctags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*Exuberant_ctags* +F ../../plugins/vimdoc-ja/doc/motion.jax /*F* +FALSE ../../plugins/vimdoc-ja/doc/eval.jax /*FALSE* +FAQ ../../plugins/vimdoc-ja/doc/intro.jax /*FAQ* +Farsi ../../plugins/vimdoc-ja/doc/farsi.jax /*Farsi* +FileAppendCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileAppendCmd* +FileAppendPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileAppendPost* +FileAppendPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileAppendPre* +FileChangedRO ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileChangedRO* +FileChangedShell ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileChangedShell* +FileChangedShellPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileChangedShellPost* +FileEncoding ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileEncoding* +FileReadCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileReadCmd* +FileReadPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileReadPost* +FileReadPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileReadPre* +FileType ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileType* +FileWriteCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileWriteCmd* +FileWritePost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileWritePost* +FileWritePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*FileWritePre* +FilterReadPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FilterReadPost* +FilterReadPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*FilterReadPre* +FilterWritePost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FilterWritePost* +FilterWritePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*FilterWritePre* +Float ../../plugins/vimdoc-ja/doc/eval.jax /*Float* +FocusGained ../../plugins/vimdoc-ja/doc/autocmd.jax /*FocusGained* +FocusLost ../../plugins/vimdoc-ja/doc/autocmd.jax /*FocusLost* +Folding ../../plugins/vimdoc-ja/doc/fold.jax /*Folding* +FuncUndefined ../../plugins/vimdoc-ja/doc/autocmd.jax /*FuncUndefined* +Funcref ../../plugins/vimdoc-ja/doc/eval.jax /*Funcref* +G ../../plugins/vimdoc-ja/doc/motion.jax /*G* +GNOME ../../plugins/vimdoc-ja/doc/gui_x11.jax /*GNOME* +GTK ../../plugins/vimdoc-ja/doc/gui_x11.jax /*GTK* +GTK+ ../../plugins/vimdoc-ja/doc/gui_x11.jax /*GTK+* +GTK3 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*GTK3* +GUI ../../plugins/vimdoc-ja/doc/gui.jax /*GUI* +GUI-X11 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*GUI-X11* +GUIEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*GUIEnter* +GUIFailed ../../plugins/vimdoc-ja/doc/autocmd.jax /*GUIFailed* +GetLatestVimScripts ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*GetLatestVimScripts* +GetLatestVimScripts-copyright ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*GetLatestVimScripts-copyright* +GetLatestVimScripts_dat ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*GetLatestVimScripts_dat* +Gnome ../../plugins/vimdoc-ja/doc/gui_x11.jax /*Gnome* +H ../../plugins/vimdoc-ja/doc/motion.jax /*H* +I ../../plugins/vimdoc-ja/doc/insert.jax /*I* +ICCF ../../plugins/vimdoc-ja/doc/uganda.jax /*ICCF* +IM-server ../../plugins/vimdoc-ja/doc/mbyte.jax /*IM-server* +IME ../../plugins/vimdoc-ja/doc/mbyte.jax /*IME* +Insert ../../plugins/vimdoc-ja/doc/insert.jax /*Insert* +Insert-mode ../../plugins/vimdoc-ja/doc/insert.jax /*Insert-mode* +InsertChange ../../plugins/vimdoc-ja/doc/autocmd.jax /*InsertChange* +InsertCharPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*InsertCharPre* +InsertEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*InsertEnter* +InsertLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*InsertLeave* +J ../../plugins/vimdoc-ja/doc/change.jax /*J* +Japanese ../../plugins/vimdoc-ja/doc/mbyte.jax /*Japanese* +Job ../../plugins/vimdoc-ja/doc/eval.jax /*Job* +Jobs ../../plugins/vimdoc-ja/doc/eval.jax /*Jobs* +K ../../plugins/vimdoc-ja/doc/various.jax /*K* +KDE ../../plugins/vimdoc-ja/doc/gui_x11.jax /*KDE* +KVim ../../plugins/vimdoc-ja/doc/gui_x11.jax /*KVim* +Kibaale ../../plugins/vimdoc-ja/doc/uganda.jax /*Kibaale* +Korean ../../plugins/vimdoc-ja/doc/mbyte.jax /*Korean* +L ../../plugins/vimdoc-ja/doc/motion.jax /*L* +Linux-backspace ../../plugins/vimdoc-ja/doc/options.jax /*Linux-backspace* +List ../../plugins/vimdoc-ja/doc/eval.jax /*List* +Lists ../../plugins/vimdoc-ja/doc/eval.jax /*Lists* +LogiPat() ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*LogiPat()* +LogiPat-flags ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*LogiPat-flags* +Lua ../../plugins/vimdoc-ja/doc/if_lua.jax /*Lua* +M ../../plugins/vimdoc-ja/doc/motion.jax /*M* +MDI ../../plugins/vimdoc-ja/doc/starting.jax /*MDI* +MS-DOS ../../plugins/vimdoc-ja/doc/os_msdos.jax /*MS-DOS* +MS-Windows ../../plugins/vimdoc-ja/doc/os_win32.jax /*MS-Windows* +MSDOS ../../plugins/vimdoc-ja/doc/os_msdos.jax /*MSDOS* +MSVisualStudio ../../plugins/vimdoc-ja/doc/if_ole.jax /*MSVisualStudio* +MVS ../../plugins/vimdoc-ja/doc/os_390.jax /*MVS* +Mac ../../plugins/vimdoc-ja/doc/os_mac.jax /*Mac* +Mac-format ../../plugins/vimdoc-ja/doc/editing.jax /*Mac-format* +Mac-format-write ../../plugins/vimdoc-ja/doc/editing.jax /*Mac-format-write* +Macintosh ../../plugins/vimdoc-ja/doc/os_mac.jax /*Macintosh* +Mark ../../plugins/vimdoc-ja/doc/motion.jax /*Mark* +MenuPopup ../../plugins/vimdoc-ja/doc/autocmd.jax /*MenuPopup* +MiNT ../../plugins/vimdoc-ja/doc/os_mint.jax /*MiNT* +Moolenaar ../../plugins/vimdoc-ja/doc/intro.jax /*Moolenaar* +MorphOS ../../plugins/vimdoc-ja/doc/os_amiga.jax /*MorphOS* +Motif ../../plugins/vimdoc-ja/doc/gui_x11.jax /*Motif* +Myspell ../../plugins/vimdoc-ja/doc/spell.jax /*Myspell* +MzScheme ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*MzScheme* +N ../../plugins/vimdoc-ja/doc/pattern.jax /*N* +N% ../../plugins/vimdoc-ja/doc/motion.jax /*N%* +N: ../../plugins/vimdoc-ja/doc/cmdline.jax /*N:* +N<Del> ../../plugins/vimdoc-ja/doc/various.jax /*N<Del>* +NFA ../../plugins/vimdoc-ja/doc/pattern.jax /*NFA* +NL-used-for-Nul ../../plugins/vimdoc-ja/doc/pattern.jax /*NL-used-for-Nul* +NetBSD-backspace ../../plugins/vimdoc-ja/doc/options.jax /*NetBSD-backspace* +NetUserPass() ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*NetUserPass()* +Normal ../../plugins/vimdoc-ja/doc/intro.jax /*Normal* +Normal-mode ../../plugins/vimdoc-ja/doc/intro.jax /*Normal-mode* +Number ../../plugins/vimdoc-ja/doc/eval.jax /*Number* +Nvi ../../plugins/vimdoc-ja/doc/intro.jax /*Nvi* +O ../../plugins/vimdoc-ja/doc/insert.jax /*O* +OS/2 ../../plugins/vimdoc-ja/doc/os_os2.jax /*OS\/2* +OS2 ../../plugins/vimdoc-ja/doc/os_os2.jax /*OS2* +OS390 ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390* +OS390-Motif ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-Motif* +OS390-PuTTY ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-PuTTY* +OS390-bugs ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-bugs* +OS390-has-ebcdic ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-has-ebcdic* +OS390-limitations ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-limitations* +OS390-open-source ../../plugins/vimdoc-ja/doc/os_390.jax /*OS390-open-source* +OffTheSpot ../../plugins/vimdoc-ja/doc/mbyte.jax /*OffTheSpot* +OnTheSpot ../../plugins/vimdoc-ja/doc/mbyte.jax /*OnTheSpot* +Operator-pending ../../plugins/vimdoc-ja/doc/intro.jax /*Operator-pending* +Operator-pending-mode ../../plugins/vimdoc-ja/doc/intro.jax /*Operator-pending-mode* +OptionSet ../../plugins/vimdoc-ja/doc/autocmd.jax /*OptionSet* +OverTheSpot ../../plugins/vimdoc-ja/doc/mbyte.jax /*OverTheSpot* +P ../../plugins/vimdoc-ja/doc/change.jax /*P* +PATHEXT ../../plugins/vimdoc-ja/doc/eval.jax /*PATHEXT* +PEP8 ../../plugins/vimdoc-ja/doc/filetype.jax /*PEP8* +PHP_BracesAtCodeLevel ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_BracesAtCodeLevel* +PHP_autoformatcomment ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_autoformatcomment* +PHP_default_indenting ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_default_indenting* +PHP_outdentSLComments ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_outdentSLComments* +PHP_outdentphpescape ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_outdentphpescape* +PHP_removeCRwhenUnix ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_removeCRwhenUnix* +PHP_vintage_case_default_indent ../../plugins/vimdoc-ja/doc/indent.jax /*PHP_vintage_case_default_indent* +Partial ../../plugins/vimdoc-ja/doc/eval.jax /*Partial* +Pattern ../../plugins/vimdoc-ja/doc/pattern.jax /*Pattern* +Perl ../../plugins/vimdoc-ja/doc/if_perl.jax /*Perl* +Posix ../../plugins/vimdoc-ja/doc/intro.jax /*Posix* +Python ../../plugins/vimdoc-ja/doc/if_pyth.jax /*Python* +Q ../../plugins/vimdoc-ja/doc/intro.jax /*Q* +QNX ../../plugins/vimdoc-ja/doc/os_qnx.jax /*QNX* +Q_ab ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ab* +Q_ac ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ac* +Q_ai ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ai* +Q_bu ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_bu* +Q_ce ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ce* +Q_ch ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ch* +Q_cm ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_cm* +Q_co ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_co* +Q_ct ../../plugins/vimdoc-ja/doc/help.jax /*Q_ct* +Q_de ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_de* +Q_di ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_di* +Q_ed ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ed* +Q_et ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_et* +Q_ex ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ex* +Q_fl ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_fl* +Q_fo ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_fo* +Q_gu ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_gu* +Q_in ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_in* +Q_km ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_km* +Q_lr ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_lr* +Q_ma ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ma* +Q_op ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_op* +Q_pa ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_pa* +Q_qf ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_qf* +Q_ra ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ra* +Q_re ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_re* +Q_sc ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_sc* +Q_si ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_si* +Q_ss ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ss* +Q_st ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_st* +Q_sy ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_sy* +Q_ta ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ta* +Q_tm ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_tm* +Q_to ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_to* +Q_ud ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ud* +Q_ur ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_ur* +Q_vc ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_vc* +Q_vi ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_vi* +Q_vm ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_vm* +Q_wi ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_wi* +Q_wq ../../plugins/vimdoc-ja/doc/quickref.jax /*Q_wq* +QuickFixCmdPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*QuickFixCmdPost* +QuickFixCmdPost-example ../../plugins/vimdoc-ja/doc/quickfix.jax /*QuickFixCmdPost-example* +QuickFixCmdPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*QuickFixCmdPre* +Quickfix ../../plugins/vimdoc-ja/doc/quickfix.jax /*Quickfix* +QuitPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*QuitPre* +R ../../plugins/vimdoc-ja/doc/change.jax /*R* +RISC-OS ../../plugins/vimdoc-ja/doc/os_risc.jax /*RISC-OS* +RISCOS ../../plugins/vimdoc-ja/doc/os_risc.jax /*RISCOS* +RemoteReply ../../plugins/vimdoc-ja/doc/autocmd.jax /*RemoteReply* +Replace ../../plugins/vimdoc-ja/doc/insert.jax /*Replace* +Replace-mode ../../plugins/vimdoc-ja/doc/insert.jax /*Replace-mode* +Root ../../plugins/vimdoc-ja/doc/mbyte.jax /*Root* +Ruby ../../plugins/vimdoc-ja/doc/if_ruby.jax /*Ruby* +Russian ../../plugins/vimdoc-ja/doc/russian.jax /*Russian* +S ../../plugins/vimdoc-ja/doc/change.jax /*S* +SHELL ../../plugins/vimdoc-ja/doc/starting.jax /*SHELL* +SQLGetType ../../plugins/vimdoc-ja/doc/ft_sql.jax /*SQLGetType* +SQLSetType ../../plugins/vimdoc-ja/doc/ft_sql.jax /*SQLSetType* +Select ../../plugins/vimdoc-ja/doc/visual.jax /*Select* +Select-mode ../../plugins/vimdoc-ja/doc/visual.jax /*Select-mode* +Select-mode-mapping ../../plugins/vimdoc-ja/doc/visual.jax /*Select-mode-mapping* +Session ../../plugins/vimdoc-ja/doc/starting.jax /*Session* +SessionLoad-variable ../../plugins/vimdoc-ja/doc/starting.jax /*SessionLoad-variable* +SessionLoadPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*SessionLoadPost* +ShellCmdPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*ShellCmdPost* +ShellFilterPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*ShellFilterPost* +SourceCmd ../../plugins/vimdoc-ja/doc/autocmd.jax /*SourceCmd* +SourcePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*SourcePre* +Special ../../plugins/vimdoc-ja/doc/eval.jax /*Special* +SpellFileMissing ../../plugins/vimdoc-ja/doc/autocmd.jax /*SpellFileMissing* +StdinReadPost ../../plugins/vimdoc-ja/doc/autocmd.jax /*StdinReadPost* +StdinReadPre ../../plugins/vimdoc-ja/doc/autocmd.jax /*StdinReadPre* +String ../../plugins/vimdoc-ja/doc/eval.jax /*String* +SwapExists ../../plugins/vimdoc-ja/doc/autocmd.jax /*SwapExists* +Syntax ../../plugins/vimdoc-ja/doc/autocmd.jax /*Syntax* +T ../../plugins/vimdoc-ja/doc/motion.jax /*T* +TCL ../../plugins/vimdoc-ja/doc/if_tcl.jax /*TCL* +TERM ../../plugins/vimdoc-ja/doc/starting.jax /*TERM* +TOhtml-encoding ../../plugins/vimdoc-ja/doc/syntax.jax /*TOhtml-encoding* +TOhtml-encoding-detect ../../plugins/vimdoc-ja/doc/syntax.jax /*TOhtml-encoding-detect* +TOhtml-performance ../../plugins/vimdoc-ja/doc/syntax.jax /*TOhtml-performance* +TOhtml-uncopyable-text ../../plugins/vimdoc-ja/doc/syntax.jax /*TOhtml-uncopyable-text* +TOhtml-wrap-text ../../plugins/vimdoc-ja/doc/syntax.jax /*TOhtml-wrap-text* +TRUE ../../plugins/vimdoc-ja/doc/eval.jax /*TRUE* +TSQL ../../plugins/vimdoc-ja/doc/ft_sql.jax /*TSQL* +TTpro-telnet ../../plugins/vimdoc-ja/doc/syntax.jax /*TTpro-telnet* +Tab ../../plugins/vimdoc-ja/doc/intro.jax /*Tab* +TabClosed ../../plugins/vimdoc-ja/doc/autocmd.jax /*TabClosed* +TabEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*TabEnter* +TabLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*TabLeave* +TabNew ../../plugins/vimdoc-ja/doc/autocmd.jax /*TabNew* +Tcl ../../plugins/vimdoc-ja/doc/if_tcl.jax /*Tcl* +TermChanged ../../plugins/vimdoc-ja/doc/autocmd.jax /*TermChanged* +TermResponse ../../plugins/vimdoc-ja/doc/autocmd.jax /*TermResponse* +TextChanged ../../plugins/vimdoc-ja/doc/autocmd.jax /*TextChanged* +TextChangedI ../../plugins/vimdoc-ja/doc/autocmd.jax /*TextChangedI* +Transact-SQL ../../plugins/vimdoc-ja/doc/ft_sql.jax /*Transact-SQL* +U ../../plugins/vimdoc-ja/doc/undo.jax /*U* +UTF-8 ../../plugins/vimdoc-ja/doc/mbyte.jax /*UTF-8* +UTF8-xterm ../../plugins/vimdoc-ja/doc/mbyte.jax /*UTF8-xterm* +Uganda ../../plugins/vimdoc-ja/doc/uganda.jax /*Uganda* +Unicode ../../plugins/vimdoc-ja/doc/mbyte.jax /*Unicode* +Unix ../../plugins/vimdoc-ja/doc/os_unix.jax /*Unix* +Unix-format ../../plugins/vimdoc-ja/doc/editing.jax /*Unix-format* +Unix-format-write ../../plugins/vimdoc-ja/doc/editing.jax /*Unix-format-write* +User ../../plugins/vimdoc-ja/doc/autocmd.jax /*User* +UserGettingBored ../../plugins/vimdoc-ja/doc/autocmd.jax /*UserGettingBored* +V ../../plugins/vimdoc-ja/doc/visual.jax /*V* +VIMINIT ../../plugins/vimdoc-ja/doc/starting.jax /*VIMINIT* +VMS ../../plugins/vimdoc-ja/doc/os_vms.jax /*VMS* +Vi ../../plugins/vimdoc-ja/doc/intro.jax /*Vi* +View ../../plugins/vimdoc-ja/doc/starting.jax /*View* +VimEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*VimEnter* +VimLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*VimLeave* +VimLeavePre ../../plugins/vimdoc-ja/doc/autocmd.jax /*VimLeavePre* +VimResized ../../plugins/vimdoc-ja/doc/autocmd.jax /*VimResized* +Vimball-copyright ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*Vimball-copyright* +Virtual-Replace-mode ../../plugins/vimdoc-ja/doc/insert.jax /*Virtual-Replace-mode* +VisVim ../../plugins/vimdoc-ja/doc/if_ole.jax /*VisVim* +Visual ../../plugins/vimdoc-ja/doc/visual.jax /*Visual* +Visual-mode ../../plugins/vimdoc-ja/doc/visual.jax /*Visual-mode* +W ../../plugins/vimdoc-ja/doc/motion.jax /*W* +W10 ../../plugins/vimdoc-ja/doc/message.jax /*W10* +W11 ../../plugins/vimdoc-ja/doc/message.jax /*W11* +W12 ../../plugins/vimdoc-ja/doc/message.jax /*W12* +W13 ../../plugins/vimdoc-ja/doc/message.jax /*W13* +W14 ../../plugins/vimdoc-ja/doc/message.jax /*W14* +W15 ../../plugins/vimdoc-ja/doc/repeat.jax /*W15* +W16 ../../plugins/vimdoc-ja/doc/message.jax /*W16* +W17 ../../plugins/vimdoc-ja/doc/arabic.jax /*W17* +W18 ../../plugins/vimdoc-ja/doc/syntax.jax /*W18* +W19 ../../plugins/vimdoc-ja/doc/autocmd.jax /*W19* +WORD ../../plugins/vimdoc-ja/doc/motion.jax /*WORD* +WWW ../../plugins/vimdoc-ja/doc/intro.jax /*WWW* +Win32 ../../plugins/vimdoc-ja/doc/os_win32.jax /*Win32* +WinEnter ../../plugins/vimdoc-ja/doc/autocmd.jax /*WinEnter* +WinLeave ../../plugins/vimdoc-ja/doc/autocmd.jax /*WinLeave* +WinNew ../../plugins/vimdoc-ja/doc/autocmd.jax /*WinNew* +X ../../plugins/vimdoc-ja/doc/change.jax /*X* +X11 ../../plugins/vimdoc-ja/doc/options.jax /*X11* +X11-icon ../../plugins/vimdoc-ja/doc/gui_x11.jax /*X11-icon* +X11_mouse_shapes ../../plugins/vimdoc-ja/doc/gui_x11.jax /*X11_mouse_shapes* +X1Drag ../../plugins/vimdoc-ja/doc/term.jax /*X1Drag* +X1Mouse ../../plugins/vimdoc-ja/doc/term.jax /*X1Mouse* +X1Release ../../plugins/vimdoc-ja/doc/term.jax /*X1Release* +X2Drag ../../plugins/vimdoc-ja/doc/term.jax /*X2Drag* +X2Mouse ../../plugins/vimdoc-ja/doc/term.jax /*X2Mouse* +X2Release ../../plugins/vimdoc-ja/doc/term.jax /*X2Release* +XIM ../../plugins/vimdoc-ja/doc/mbyte.jax /*XIM* +XLFD ../../plugins/vimdoc-ja/doc/mbyte.jax /*XLFD* +Y ../../plugins/vimdoc-ja/doc/change.jax /*Y* +Y2K ../../plugins/vimdoc-ja/doc/intro.jax /*Y2K* +ZQ ../../plugins/vimdoc-ja/doc/editing.jax /*ZQ* +ZZ ../../plugins/vimdoc-ja/doc/editing.jax /*ZZ* +[ ../../plugins/vimdoc-ja/doc/index.jax /*[* +[# ../../plugins/vimdoc-ja/doc/motion.jax /*[#* +[' ../../plugins/vimdoc-ja/doc/motion.jax /*['* +[( ../../plugins/vimdoc-ja/doc/motion.jax /*[(* +[++opt] ../../plugins/vimdoc-ja/doc/editing.jax /*[++opt]* +[+cmd] ../../plugins/vimdoc-ja/doc/editing.jax /*[+cmd]* +[..] ../../plugins/vimdoc-ja/doc/pattern.jax /*[..]* +[/ ../../plugins/vimdoc-ja/doc/motion.jax /*[\/* +[:alnum:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:alnum:]* +[:alpha:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:alpha:]* +[:backspace:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:backspace:]* +[:blank:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:blank:]* +[:cntrl:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:cntrl:]* +[:digit:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:digit:]* +[:escape:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:escape:]* +[:graph:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:graph:]* +[:lower:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:lower:]* +[:print:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:print:]* +[:punct:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:punct:]* +[:return:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:return:]* +[:space:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:space:]* +[:tab:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:tab:]* +[:upper:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:upper:]* +[:xdigit:] ../../plugins/vimdoc-ja/doc/pattern.jax /*[:xdigit:]* +[<MiddleMouse> ../../plugins/vimdoc-ja/doc/change.jax /*[<MiddleMouse>* +[==] ../../plugins/vimdoc-ja/doc/pattern.jax /*[==]* +[D ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[D* +[I ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[I* +[M ../../plugins/vimdoc-ja/doc/motion.jax /*[M* +[P ../../plugins/vimdoc-ja/doc/change.jax /*[P* +[S ../../plugins/vimdoc-ja/doc/spell.jax /*[S* +[[ ../../plugins/vimdoc-ja/doc/motion.jax /*[[* +[] ../../plugins/vimdoc-ja/doc/motion.jax /*[]* +[_CTRL-D ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[_CTRL-D* +[_CTRL-I ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[_CTRL-I* +[` ../../plugins/vimdoc-ja/doc/motion.jax /*[`* +[c ../../plugins/vimdoc-ja/doc/diff.jax /*[c* +[count] ../../plugins/vimdoc-ja/doc/intro.jax /*[count]* +[d ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[d* +[f ../../plugins/vimdoc-ja/doc/editing.jax /*[f* +[i ../../plugins/vimdoc-ja/doc/tagsrch.jax /*[i* +[m ../../plugins/vimdoc-ja/doc/motion.jax /*[m* +[p ../../plugins/vimdoc-ja/doc/change.jax /*[p* +[pattern] ../../plugins/vimdoc-ja/doc/pattern.jax /*[pattern]* +[quotex] ../../plugins/vimdoc-ja/doc/intro.jax /*[quotex]* +[range] ../../plugins/vimdoc-ja/doc/cmdline.jax /*[range]* +[s ../../plugins/vimdoc-ja/doc/spell.jax /*[s* +[star ../../plugins/vimdoc-ja/doc/motion.jax /*[star* +[z ../../plugins/vimdoc-ja/doc/fold.jax /*[z* +[{ ../../plugins/vimdoc-ja/doc/motion.jax /*[{* +\0 ../../plugins/vimdoc-ja/doc/change.jax /*\\0* +] ../../plugins/vimdoc-ja/doc/index.jax /*]* +]# ../../plugins/vimdoc-ja/doc/motion.jax /*]#* +]' ../../plugins/vimdoc-ja/doc/motion.jax /*]'* +]) ../../plugins/vimdoc-ja/doc/motion.jax /*])* +]/ ../../plugins/vimdoc-ja/doc/motion.jax /*]\/* +]<MiddleMouse> ../../plugins/vimdoc-ja/doc/change.jax /*]<MiddleMouse>* +]D ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]D* +]I ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]I* +]M ../../plugins/vimdoc-ja/doc/motion.jax /*]M* +]P ../../plugins/vimdoc-ja/doc/change.jax /*]P* +]S ../../plugins/vimdoc-ja/doc/spell.jax /*]S* +][ ../../plugins/vimdoc-ja/doc/motion.jax /*][* +]] ../../plugins/vimdoc-ja/doc/motion.jax /*]]* +]_CTRL-D ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]_CTRL-D* +]_CTRL-I ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]_CTRL-I* +]` ../../plugins/vimdoc-ja/doc/motion.jax /*]`* +]c ../../plugins/vimdoc-ja/doc/diff.jax /*]c* +]d ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]d* +]f ../../plugins/vimdoc-ja/doc/editing.jax /*]f* +]i ../../plugins/vimdoc-ja/doc/tagsrch.jax /*]i* +]m ../../plugins/vimdoc-ja/doc/motion.jax /*]m* +]p ../../plugins/vimdoc-ja/doc/change.jax /*]p* +]s ../../plugins/vimdoc-ja/doc/spell.jax /*]s* +]star ../../plugins/vimdoc-ja/doc/motion.jax /*]star* +]z ../../plugins/vimdoc-ja/doc/fold.jax /*]z* +]} ../../plugins/vimdoc-ja/doc/motion.jax /*]}* +^ ../../plugins/vimdoc-ja/doc/motion.jax /*^* +_ ../../plugins/vimdoc-ja/doc/motion.jax /*_* +_exrc ../../plugins/vimdoc-ja/doc/starting.jax /*_exrc* +_gvimrc ../../plugins/vimdoc-ja/doc/gui.jax /*_gvimrc* +_vimrc ../../plugins/vimdoc-ja/doc/starting.jax /*_vimrc* +` ../../plugins/vimdoc-ja/doc/motion.jax /*`* +`( ../../plugins/vimdoc-ja/doc/motion.jax /*`(* +`) ../../plugins/vimdoc-ja/doc/motion.jax /*`)* +`-expansion ../../plugins/vimdoc-ja/doc/editing.jax /*`-expansion* +`. ../../plugins/vimdoc-ja/doc/motion.jax /*`.* +`0 ../../plugins/vimdoc-ja/doc/motion.jax /*`0* +`< ../../plugins/vimdoc-ja/doc/motion.jax /*`<* +`= ../../plugins/vimdoc-ja/doc/editing.jax /*`=* +`> ../../plugins/vimdoc-ja/doc/motion.jax /*`>* +`A ../../plugins/vimdoc-ja/doc/motion.jax /*`A* +`[ ../../plugins/vimdoc-ja/doc/motion.jax /*`[* +`] ../../plugins/vimdoc-ja/doc/motion.jax /*`]* +`^ ../../plugins/vimdoc-ja/doc/motion.jax /*`^* +`` ../../plugins/vimdoc-ja/doc/motion.jax /*``* +`a ../../plugins/vimdoc-ja/doc/motion.jax /*`a* +`quote ../../plugins/vimdoc-ja/doc/motion.jax /*`quote* +`{ ../../plugins/vimdoc-ja/doc/motion.jax /*`{* +`} ../../plugins/vimdoc-ja/doc/motion.jax /*`}* +a ../../plugins/vimdoc-ja/doc/insert.jax /*a* +a' ../../plugins/vimdoc-ja/doc/motion.jax /*a'* +a( ../../plugins/vimdoc-ja/doc/motion.jax /*a(* +a) ../../plugins/vimdoc-ja/doc/motion.jax /*a)* +a4 ../../plugins/vimdoc-ja/doc/print.jax /*a4* +a:0 ../../plugins/vimdoc-ja/doc/eval.jax /*a:0* +a:000 ../../plugins/vimdoc-ja/doc/eval.jax /*a:000* +a:1 ../../plugins/vimdoc-ja/doc/eval.jax /*a:1* +a:firstline ../../plugins/vimdoc-ja/doc/eval.jax /*a:firstline* +a:lastline ../../plugins/vimdoc-ja/doc/eval.jax /*a:lastline* +a:var ../../plugins/vimdoc-ja/doc/eval.jax /*a:var* +a< ../../plugins/vimdoc-ja/doc/motion.jax /*a<* +a> ../../plugins/vimdoc-ja/doc/motion.jax /*a>* +aB ../../plugins/vimdoc-ja/doc/motion.jax /*aB* +aW ../../plugins/vimdoc-ja/doc/motion.jax /*aW* +a[ ../../plugins/vimdoc-ja/doc/motion.jax /*a[* +a] ../../plugins/vimdoc-ja/doc/motion.jax /*a]* +a` ../../plugins/vimdoc-ja/doc/motion.jax /*a`* +ab ../../plugins/vimdoc-ja/doc/motion.jax /*ab* +abandon ../../plugins/vimdoc-ja/doc/editing.jax /*abandon* +abbreviations ../../plugins/vimdoc-ja/doc/map.jax /*abbreviations* +abel.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*abel.vim* +abs() ../../plugins/vimdoc-ja/doc/eval.jax /*abs()* +acos() ../../plugins/vimdoc-ja/doc/eval.jax /*acos()* +active-buffer ../../plugins/vimdoc-ja/doc/windows.jax /*active-buffer* +ada#Create_Tags() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada#Create_Tags()* +ada#Jump_Tag() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada#Jump_Tag()* +ada#Listtags() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada#Listtags()* +ada#Switch_Syntax_Option() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada#Switch_Syntax_Option()* +ada#Word() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada#Word()* +ada-compiler ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada-compiler* +ada-ctags ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada-ctags* +ada-extra-plugins ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada-extra-plugins* +ada-reference ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada-reference* +ada.vim ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ada.vim* +add() ../../plugins/vimdoc-ja/doc/eval.jax /*add()* +add-filetype-plugin ../../plugins/vimdoc-ja/doc/usr_05.jax /*add-filetype-plugin* +add-global-plugin ../../plugins/vimdoc-ja/doc/usr_05.jax /*add-global-plugin* +add-local-help ../../plugins/vimdoc-ja/doc/usr_05.jax /*add-local-help* +add-option-flags ../../plugins/vimdoc-ja/doc/options.jax /*add-option-flags* +add-package ../../plugins/vimdoc-ja/doc/usr_05.jax /*add-package* +add-plugin ../../plugins/vimdoc-ja/doc/usr_05.jax /*add-plugin* +aff-dic-format ../../plugins/vimdoc-ja/doc/spell.jax /*aff-dic-format* +after-directory ../../plugins/vimdoc-ja/doc/options.jax /*after-directory* +aleph ../../plugins/vimdoc-ja/doc/options.jax /*aleph* +alt ../../plugins/vimdoc-ja/doc/intro.jax /*alt* +alt-input ../../plugins/vimdoc-ja/doc/debugger.jax /*alt-input* +alternate-file ../../plugins/vimdoc-ja/doc/editing.jax /*alternate-file* +amiga-window ../../plugins/vimdoc-ja/doc/starting.jax /*amiga-window* +and() ../../plugins/vimdoc-ja/doc/eval.jax /*and()* +anonymous-function ../../plugins/vimdoc-ja/doc/eval.jax /*anonymous-function* +ant.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ant.vim* +ap ../../plugins/vimdoc-ja/doc/motion.jax /*ap* +apache.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*apache.vim* +append() ../../plugins/vimdoc-ja/doc/eval.jax /*append()* +aquote ../../plugins/vimdoc-ja/doc/motion.jax /*aquote* +arabic.txt ../../plugins/vimdoc-ja/doc/arabic.jax /*arabic.txt* +arabicfonts ../../plugins/vimdoc-ja/doc/arabic.jax /*arabicfonts* +arabickeymap ../../plugins/vimdoc-ja/doc/arabic.jax /*arabickeymap* +arg-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*arg-functions* +argc() ../../plugins/vimdoc-ja/doc/eval.jax /*argc()* +argidx() ../../plugins/vimdoc-ja/doc/eval.jax /*argidx()* +arglist ../../plugins/vimdoc-ja/doc/editing.jax /*arglist* +arglist-position ../../plugins/vimdoc-ja/doc/editing.jax /*arglist-position* +arglist-quit ../../plugins/vimdoc-ja/doc/usr_07.jax /*arglist-quit* +arglistid() ../../plugins/vimdoc-ja/doc/eval.jax /*arglistid()* +argument-list ../../plugins/vimdoc-ja/doc/editing.jax /*argument-list* +argv() ../../plugins/vimdoc-ja/doc/eval.jax /*argv()* +as ../../plugins/vimdoc-ja/doc/motion.jax /*as* +asin() ../../plugins/vimdoc-ja/doc/eval.jax /*asin()* +asm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*asm.vim* +asm68k ../../plugins/vimdoc-ja/doc/syntax.jax /*asm68k* +asmh8300.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*asmh8300.vim* +assert_equal() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_equal()* +assert_exception() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_exception()* +assert_fails() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_fails()* +assert_false() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_false()* +assert_inrange() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_inrange()* +assert_match() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_match()* +assert_notequal() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_notequal()* +assert_notmatch() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_notmatch()* +assert_true() ../../plugins/vimdoc-ja/doc/eval.jax /*assert_true()* +at ../../plugins/vimdoc-ja/doc/motion.jax /*at* +atan() ../../plugins/vimdoc-ja/doc/eval.jax /*atan()* +atan2() ../../plugins/vimdoc-ja/doc/eval.jax /*atan2()* +athena-intellimouse ../../plugins/vimdoc-ja/doc/gui.jax /*athena-intellimouse* +attr-list ../../plugins/vimdoc-ja/doc/syntax.jax /*attr-list* +author ../../plugins/vimdoc-ja/doc/intro.jax /*author* +auto-format ../../plugins/vimdoc-ja/doc/change.jax /*auto-format* +auto-setting ../../plugins/vimdoc-ja/doc/options.jax /*auto-setting* +auto-shortname ../../plugins/vimdoc-ja/doc/editing.jax /*auto-shortname* +autocmd-<> ../../plugins/vimdoc-ja/doc/tips.jax /*autocmd-<>* +autocmd-buffer-local ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-buffer-local* +autocmd-buflocal ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-buflocal* +autocmd-changes ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-changes* +autocmd-define ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-define* +autocmd-disable ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-disable* +autocmd-events ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-events* +autocmd-events-abc ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-events-abc* +autocmd-execute ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-execute* +autocmd-groups ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-groups* +autocmd-intro ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-intro* +autocmd-list ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-list* +autocmd-nested ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-nested* +autocmd-osfiletypes ../../plugins/vimdoc-ja/doc/filetype.jax /*autocmd-osfiletypes* +autocmd-patterns ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-patterns* +autocmd-remove ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-remove* +autocmd-searchpat ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-searchpat* +autocmd-use ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd-use* +autocmd.txt ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocmd.txt* +autocommand ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocommand* +autocommand-events ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocommand-events* +autocommand-pattern ../../plugins/vimdoc-ja/doc/autocmd.jax /*autocommand-pattern* +autoformat ../../plugins/vimdoc-ja/doc/change.jax /*autoformat* +autoload ../../plugins/vimdoc-ja/doc/eval.jax /*autoload* +autoload-functions ../../plugins/vimdoc-ja/doc/eval.jax /*autoload-functions* +aw ../../plugins/vimdoc-ja/doc/motion.jax /*aw* +a{ ../../plugins/vimdoc-ja/doc/motion.jax /*a{* +a} ../../plugins/vimdoc-ja/doc/motion.jax /*a}* +b ../../plugins/vimdoc-ja/doc/motion.jax /*b* +b: ../../plugins/vimdoc-ja/doc/eval.jax /*b:* +b:changedtick ../../plugins/vimdoc-ja/doc/eval.jax /*b:changedtick* +b:changelog_name ../../plugins/vimdoc-ja/doc/filetype.jax /*b:changelog_name* +b:clojure_syntax_keywords ../../plugins/vimdoc-ja/doc/syntax.jax /*b:clojure_syntax_keywords* +b:clojure_syntax_without_core_keywords ../../plugins/vimdoc-ja/doc/syntax.jax /*b:clojure_syntax_without_core_keywords* +b:current_syntax-variable ../../plugins/vimdoc-ja/doc/syntax.jax /*b:current_syntax-variable* +b:netrw_lastfile ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*b:netrw_lastfile* +b:tex_stylish ../../plugins/vimdoc-ja/doc/syntax.jax /*b:tex_stylish* +b:var ../../plugins/vimdoc-ja/doc/eval.jax /*b:var* +b:yaml_schema ../../plugins/vimdoc-ja/doc/syntax.jax /*b:yaml_schema* +baan-folding ../../plugins/vimdoc-ja/doc/syntax.jax /*baan-folding* +baan-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*baan-syntax* +baan.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*baan.vim* +backslash ../../plugins/vimdoc-ja/doc/intro.jax /*backslash* +backspace ../../plugins/vimdoc-ja/doc/intro.jax /*backspace* +backspace-delete ../../plugins/vimdoc-ja/doc/version4.jax /*backspace-delete* +backtick-expansion ../../plugins/vimdoc-ja/doc/editing.jax /*backtick-expansion* +backup ../../plugins/vimdoc-ja/doc/editing.jax /*backup* +backup-changed ../../plugins/vimdoc-ja/doc/version4.jax /*backup-changed* +backup-extension ../../plugins/vimdoc-ja/doc/version4.jax /*backup-extension* +backup-table ../../plugins/vimdoc-ja/doc/editing.jax /*backup-table* +balloon-eval ../../plugins/vimdoc-ja/doc/debugger.jax /*balloon-eval* +bar ../../plugins/vimdoc-ja/doc/motion.jax /*bar* +bars ../../plugins/vimdoc-ja/doc/help.jax /*bars* +base_font_name_list ../../plugins/vimdoc-ja/doc/mbyte.jax /*base_font_name_list* +basic.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*basic.vim* +beep ../../plugins/vimdoc-ja/doc/options.jax /*beep* +beos-colors ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-colors* +beos-compiling ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-compiling* +beos-dragndrop ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-dragndrop* +beos-fonts ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-fonts* +beos-general ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-general* +beos-gui ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-gui* +beos-launch ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-launch* +beos-meta ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-meta* +beos-mouse ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-mouse* +beos-perl ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-perl* +beos-timeout ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-timeout* +beos-unicode ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-unicode* +beos-utf8 ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-utf8* +beos-vimdir ../../plugins/vimdoc-ja/doc/os_beos.jax /*beos-vimdir* +beval_bufnr-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_bufnr-variable* +beval_col-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_col-variable* +beval_lnum-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_lnum-variable* +beval_text-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_text-variable* +beval_winid-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_winid-variable* +beval_winnr-variable ../../plugins/vimdoc-ja/doc/eval.jax /*beval_winnr-variable* +binary-number ../../plugins/vimdoc-ja/doc/eval.jax /*binary-number* +bitwise-function ../../plugins/vimdoc-ja/doc/usr_41.jax /*bitwise-function* +blockwise-examples ../../plugins/vimdoc-ja/doc/visual.jax /*blockwise-examples* +blockwise-operators ../../plugins/vimdoc-ja/doc/visual.jax /*blockwise-operators* +blockwise-register ../../plugins/vimdoc-ja/doc/change.jax /*blockwise-register* +blockwise-visual ../../plugins/vimdoc-ja/doc/visual.jax /*blockwise-visual* +blowfish ../../plugins/vimdoc-ja/doc/options.jax /*blowfish* +blowfish2 ../../plugins/vimdoc-ja/doc/options.jax /*blowfish2* +bold ../../plugins/vimdoc-ja/doc/syntax.jax /*bold* +bom-bytes ../../plugins/vimdoc-ja/doc/mbyte.jax /*bom-bytes* +book ../../plugins/vimdoc-ja/doc/intro.jax /*book* +bookmark ../../plugins/vimdoc-ja/doc/usr_03.jax /*bookmark* +boolean ../../plugins/vimdoc-ja/doc/options.jax /*boolean* +break-finally ../../plugins/vimdoc-ja/doc/eval.jax /*break-finally* +browse() ../../plugins/vimdoc-ja/doc/eval.jax /*browse()* +browsedir() ../../plugins/vimdoc-ja/doc/eval.jax /*browsedir()* +browsefilter ../../plugins/vimdoc-ja/doc/editing.jax /*browsefilter* +bufexists() ../../plugins/vimdoc-ja/doc/eval.jax /*bufexists()* +buffer-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*buffer-functions* +buffer-hidden ../../plugins/vimdoc-ja/doc/windows.jax /*buffer-hidden* +buffer-list ../../plugins/vimdoc-ja/doc/windows.jax /*buffer-list* +buffer-variable ../../plugins/vimdoc-ja/doc/eval.jax /*buffer-variable* +buffer-write ../../plugins/vimdoc-ja/doc/editing.jax /*buffer-write* +buffer_exists() ../../plugins/vimdoc-ja/doc/eval.jax /*buffer_exists()* +buffer_name() ../../plugins/vimdoc-ja/doc/eval.jax /*buffer_name()* +buffer_number() ../../plugins/vimdoc-ja/doc/eval.jax /*buffer_number()* +buffers ../../plugins/vimdoc-ja/doc/windows.jax /*buffers* +buffers-menu ../../plugins/vimdoc-ja/doc/gui.jax /*buffers-menu* +buflisted() ../../plugins/vimdoc-ja/doc/eval.jax /*buflisted()* +bufloaded() ../../plugins/vimdoc-ja/doc/eval.jax /*bufloaded()* +bufname() ../../plugins/vimdoc-ja/doc/eval.jax /*bufname()* +bufnr() ../../plugins/vimdoc-ja/doc/eval.jax /*bufnr()* +bufwinid() ../../plugins/vimdoc-ja/doc/eval.jax /*bufwinid()* +bufwinnr() ../../plugins/vimdoc-ja/doc/eval.jax /*bufwinnr()* +bug-reports ../../plugins/vimdoc-ja/doc/intro.jax /*bug-reports* +bugreport.vim ../../plugins/vimdoc-ja/doc/intro.jax /*bugreport.vim* +bugs ../../plugins/vimdoc-ja/doc/intro.jax /*bugs* +builtin-terms ../../plugins/vimdoc-ja/doc/term.jax /*builtin-terms* +builtin-tools ../../plugins/vimdoc-ja/doc/gui.jax /*builtin-tools* +builtin_terms ../../plugins/vimdoc-ja/doc/term.jax /*builtin_terms* +byte-count ../../plugins/vimdoc-ja/doc/editing.jax /*byte-count* +byte2line() ../../plugins/vimdoc-ja/doc/eval.jax /*byte2line()* +byteidx() ../../plugins/vimdoc-ja/doc/eval.jax /*byteidx()* +byteidxcomp() ../../plugins/vimdoc-ja/doc/eval.jax /*byteidxcomp()* +bzip2 ../../plugins/vimdoc-ja/doc/pi_gzip.jax /*bzip2* +c ../../plugins/vimdoc-ja/doc/change.jax /*c* +c.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*c.vim* +cW ../../plugins/vimdoc-ja/doc/change.jax /*cW* +c_# ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_#* +c_## ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_##* +c_#< ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_#<* +c_#n ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_#n* +c_% ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_%* +c_<BS> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<BS>* +c_<C-Left> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-Left>* +c_<C-R> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>* +c_<C-R>_<C-A> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-A>* +c_<C-R>_<C-F> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-F>* +c_<C-R>_<C-O> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-O>* +c_<C-R>_<C-P> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-P>* +c_<C-R>_<C-R> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-R>* +c_<C-R>_<C-W> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-R>_<C-W>* +c_<C-Right> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<C-Right>* +c_<CR> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<CR>* +c_<Del> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Del>* +c_<Down> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Down>* +c_<End> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<End>* +c_<Esc> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Esc>* +c_<Home> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Home>* +c_<Insert> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Insert>* +c_<Left> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Left>* +c_<LeftMouse> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<LeftMouse>* +c_<MiddleMouse> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<MiddleMouse>* +c_<NL> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<NL>* +c_<PageDown> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<PageDown>* +c_<PageUp> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<PageUp>* +c_<Right> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Right>* +c_<S-Down> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<S-Down>* +c_<S-Left> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<S-Left>* +c_<S-Right> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<S-Right>* +c_<S-Tab> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<S-Tab>* +c_<S-Up> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<S-Up>* +c_<Tab> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Tab>* +c_<Up> ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_<Up>* +c_BS ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_BS* +c_CR ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CR* +c_CTRL-A ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-A* +c_CTRL-B ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-B* +c_CTRL-C ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-C* +c_CTRL-D ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-D* +c_CTRL-E ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-E* +c_CTRL-F ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-F* +c_CTRL-G ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-G* +c_CTRL-H ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-H* +c_CTRL-I ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-I* +c_CTRL-J ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-J* +c_CTRL-K ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-K* +c_CTRL-L ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-L* +c_CTRL-M ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-M* +c_CTRL-N ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-N* +c_CTRL-P ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-P* +c_CTRL-Q ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-Q* +c_CTRL-R ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R* +c_CTRL-R_= ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_=* +c_CTRL-R_CTRL-A ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-A* +c_CTRL-R_CTRL-F ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-F* +c_CTRL-R_CTRL-O ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-O* +c_CTRL-R_CTRL-P ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-P* +c_CTRL-R_CTRL-R ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-R* +c_CTRL-R_CTRL-W ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-R_CTRL-W* +c_CTRL-T ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-T* +c_CTRL-U ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-U* +c_CTRL-V ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-V* +c_CTRL-W ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-W* +c_CTRL-Y ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-Y* +c_CTRL-[ ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-[* +c_CTRL-\_CTRL-G ../../plugins/vimdoc-ja/doc/intro.jax /*c_CTRL-\\_CTRL-G* +c_CTRL-\_CTRL-N ../../plugins/vimdoc-ja/doc/intro.jax /*c_CTRL-\\_CTRL-N* +c_CTRL-\_e ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-\\_e* +c_CTRL-] ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-]* +c_CTRL-^ ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-^* +c_CTRL-_ ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_CTRL-_* +c_Del ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Del* +c_Down ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Down* +c_End ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_End* +c_Esc ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Esc* +c_Home ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Home* +c_Insert ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Insert* +c_Left ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Left* +c_Right ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Right* +c_Up ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_Up* +c_ansi_constants ../../plugins/vimdoc-ja/doc/syntax.jax /*c_ansi_constants* +c_ansi_typedefs ../../plugins/vimdoc-ja/doc/syntax.jax /*c_ansi_typedefs* +c_comment_strings ../../plugins/vimdoc-ja/doc/syntax.jax /*c_comment_strings* +c_curly_error ../../plugins/vimdoc-ja/doc/syntax.jax /*c_curly_error* +c_digraph ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_digraph* +c_gnu ../../plugins/vimdoc-ja/doc/syntax.jax /*c_gnu* +c_no_ansi ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_ansi* +c_no_bracket_error ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_bracket_error* +c_no_bsd ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_bsd* +c_no_c11 ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_c11* +c_no_c99 ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_c99* +c_no_cformat ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_cformat* +c_no_curly_error ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_curly_error* +c_no_if0 ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_if0* +c_no_tab_space_error ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_tab_space_error* +c_no_trail_space_error ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_trail_space_error* +c_no_utf ../../plugins/vimdoc-ja/doc/syntax.jax /*c_no_utf* +c_space_errors ../../plugins/vimdoc-ja/doc/syntax.jax /*c_space_errors* +c_syntax_for_h ../../plugins/vimdoc-ja/doc/syntax.jax /*c_syntax_for_h* +c_wildchar ../../plugins/vimdoc-ja/doc/cmdline.jax /*c_wildchar* +call() ../../plugins/vimdoc-ja/doc/eval.jax /*call()* +carriage-return ../../plugins/vimdoc-ja/doc/intro.jax /*carriage-return* +case ../../plugins/vimdoc-ja/doc/change.jax /*case* +catch-all ../../plugins/vimdoc-ja/doc/eval.jax /*catch-all* +catch-errors ../../plugins/vimdoc-ja/doc/eval.jax /*catch-errors* +catch-interrupt ../../plugins/vimdoc-ja/doc/eval.jax /*catch-interrupt* +catch-order ../../plugins/vimdoc-ja/doc/eval.jax /*catch-order* +catch-text ../../plugins/vimdoc-ja/doc/eval.jax /*catch-text* +cc ../../plugins/vimdoc-ja/doc/change.jax /*cc* +ceil() ../../plugins/vimdoc-ja/doc/eval.jax /*ceil()* +ch.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ch.vim* +ch_close() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_close()* +ch_close_in() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_close_in()* +ch_evalexpr() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_evalexpr()* +ch_evalraw() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_evalraw()* +ch_getbufnr() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_getbufnr()* +ch_getjob() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_getjob()* +ch_info() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_info()* +ch_log() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_log()* +ch_logfile() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_logfile()* +ch_open() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_open()* +ch_read() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_read()* +ch_readraw() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_readraw()* +ch_sendexpr() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_sendexpr()* +ch_sendraw() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_sendraw()* +ch_setoptions() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_setoptions()* +ch_status() ../../plugins/vimdoc-ja/doc/eval.jax /*ch_status()* +change-list-jumps ../../plugins/vimdoc-ja/doc/motion.jax /*change-list-jumps* +change-name ../../plugins/vimdoc-ja/doc/tips.jax /*change-name* +change-tabs ../../plugins/vimdoc-ja/doc/change.jax /*change-tabs* +change.txt ../../plugins/vimdoc-ja/doc/change.jax /*change.txt* +changelist ../../plugins/vimdoc-ja/doc/motion.jax /*changelist* +changelog.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*changelog.vim* +changenr() ../../plugins/vimdoc-ja/doc/eval.jax /*changenr()* +changetick ../../plugins/vimdoc-ja/doc/eval.jax /*changetick* +changing ../../plugins/vimdoc-ja/doc/change.jax /*changing* +channel ../../plugins/vimdoc-ja/doc/channel.jax /*channel* +channel-callback ../../plugins/vimdoc-ja/doc/channel.jax /*channel-callback* +channel-close ../../plugins/vimdoc-ja/doc/channel.jax /*channel-close* +channel-close-in ../../plugins/vimdoc-ja/doc/channel.jax /*channel-close-in* +channel-commands ../../plugins/vimdoc-ja/doc/channel.jax /*channel-commands* +channel-demo ../../plugins/vimdoc-ja/doc/channel.jax /*channel-demo* +channel-drop ../../plugins/vimdoc-ja/doc/channel.jax /*channel-drop* +channel-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*channel-functions* +channel-mode ../../plugins/vimdoc-ja/doc/channel.jax /*channel-mode* +channel-more ../../plugins/vimdoc-ja/doc/channel.jax /*channel-more* +channel-open ../../plugins/vimdoc-ja/doc/channel.jax /*channel-open* +channel-open-options ../../plugins/vimdoc-ja/doc/channel.jax /*channel-open-options* +channel-raw ../../plugins/vimdoc-ja/doc/channel.jax /*channel-raw* +channel-timeout ../../plugins/vimdoc-ja/doc/channel.jax /*channel-timeout* +channel-use ../../plugins/vimdoc-ja/doc/channel.jax /*channel-use* +channel.txt ../../plugins/vimdoc-ja/doc/channel.jax /*channel.txt* +char-variable ../../plugins/vimdoc-ja/doc/eval.jax /*char-variable* +char2nr() ../../plugins/vimdoc-ja/doc/eval.jax /*char2nr()* +characterwise ../../plugins/vimdoc-ja/doc/motion.jax /*characterwise* +characterwise-register ../../plugins/vimdoc-ja/doc/change.jax /*characterwise-register* +characterwise-visual ../../plugins/vimdoc-ja/doc/visual.jax /*characterwise-visual* +charconvert_from-variable ../../plugins/vimdoc-ja/doc/eval.jax /*charconvert_from-variable* +charconvert_to-variable ../../plugins/vimdoc-ja/doc/eval.jax /*charconvert_to-variable* +charity ../../plugins/vimdoc-ja/doc/uganda.jax /*charity* +charset ../../plugins/vimdoc-ja/doc/mbyte.jax /*charset* +charset-conversion ../../plugins/vimdoc-ja/doc/mbyte.jax /*charset-conversion* +chill.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*chill.vim* +chmod ../../plugins/vimdoc-ja/doc/eval.jax /*chmod* +cindent() ../../plugins/vimdoc-ja/doc/eval.jax /*cindent()* +cinkeys-format ../../plugins/vimdoc-ja/doc/indent.jax /*cinkeys-format* +cino-# ../../plugins/vimdoc-ja/doc/indent.jax /*cino-#* +cino-( ../../plugins/vimdoc-ja/doc/indent.jax /*cino-(* +cino-) ../../plugins/vimdoc-ja/doc/indent.jax /*cino-)* +cino-+ ../../plugins/vimdoc-ja/doc/indent.jax /*cino-+* +cino-/ ../../plugins/vimdoc-ja/doc/indent.jax /*cino-\/* +cino-: ../../plugins/vimdoc-ja/doc/indent.jax /*cino-:* +cino-= ../../plugins/vimdoc-ja/doc/indent.jax /*cino-=* +cino-> ../../plugins/vimdoc-ja/doc/indent.jax /*cino->* +cino-C ../../plugins/vimdoc-ja/doc/indent.jax /*cino-C* +cino-J ../../plugins/vimdoc-ja/doc/indent.jax /*cino-J* +cino-L ../../plugins/vimdoc-ja/doc/indent.jax /*cino-L* +cino-M ../../plugins/vimdoc-ja/doc/indent.jax /*cino-M* +cino-N ../../plugins/vimdoc-ja/doc/indent.jax /*cino-N* +cino-U ../../plugins/vimdoc-ja/doc/indent.jax /*cino-U* +cino-W ../../plugins/vimdoc-ja/doc/indent.jax /*cino-W* +cino-^ ../../plugins/vimdoc-ja/doc/indent.jax /*cino-^* +cino-b ../../plugins/vimdoc-ja/doc/indent.jax /*cino-b* +cino-c ../../plugins/vimdoc-ja/doc/indent.jax /*cino-c* +cino-e ../../plugins/vimdoc-ja/doc/indent.jax /*cino-e* +cino-f ../../plugins/vimdoc-ja/doc/indent.jax /*cino-f* +cino-g ../../plugins/vimdoc-ja/doc/indent.jax /*cino-g* +cino-h ../../plugins/vimdoc-ja/doc/indent.jax /*cino-h* +cino-i ../../plugins/vimdoc-ja/doc/indent.jax /*cino-i* +cino-j ../../plugins/vimdoc-ja/doc/indent.jax /*cino-j* +cino-k ../../plugins/vimdoc-ja/doc/indent.jax /*cino-k* +cino-l ../../plugins/vimdoc-ja/doc/indent.jax /*cino-l* +cino-m ../../plugins/vimdoc-ja/doc/indent.jax /*cino-m* +cino-n ../../plugins/vimdoc-ja/doc/indent.jax /*cino-n* +cino-p ../../plugins/vimdoc-ja/doc/indent.jax /*cino-p* +cino-star ../../plugins/vimdoc-ja/doc/indent.jax /*cino-star* +cino-t ../../plugins/vimdoc-ja/doc/indent.jax /*cino-t* +cino-u ../../plugins/vimdoc-ja/doc/indent.jax /*cino-u* +cino-w ../../plugins/vimdoc-ja/doc/indent.jax /*cino-w* +cino-{ ../../plugins/vimdoc-ja/doc/indent.jax /*cino-{* +cino-} ../../plugins/vimdoc-ja/doc/indent.jax /*cino-}* +cinoptions-values ../../plugins/vimdoc-ja/doc/indent.jax /*cinoptions-values* +clear-undo ../../plugins/vimdoc-ja/doc/undo.jax /*clear-undo* +clearmatches() ../../plugins/vimdoc-ja/doc/eval.jax /*clearmatches()* +client-server ../../plugins/vimdoc-ja/doc/remote.jax /*client-server* +clientserver ../../plugins/vimdoc-ja/doc/remote.jax /*clientserver* +clipboard ../../plugins/vimdoc-ja/doc/gui.jax /*clipboard* +clipboard-autoselect ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-autoselect* +clipboard-autoselectml ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-autoselectml* +clipboard-autoselectplus ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-autoselectplus* +clipboard-exclude ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-exclude* +clipboard-html ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-html* +clipboard-unnamed ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-unnamed* +clipboard-unnamedplus ../../plugins/vimdoc-ja/doc/options.jax /*clipboard-unnamedplus* +clojure-indent ../../plugins/vimdoc-ja/doc/indent.jax /*clojure-indent* +close_cb ../../plugins/vimdoc-ja/doc/channel.jax /*close_cb* +closure ../../plugins/vimdoc-ja/doc/eval.jax /*closure* +cmdarg-variable ../../plugins/vimdoc-ja/doc/eval.jax /*cmdarg-variable* +cmdbang-variable ../../plugins/vimdoc-ja/doc/eval.jax /*cmdbang-variable* +cmdline-arguments ../../plugins/vimdoc-ja/doc/vi_diff.jax /*cmdline-arguments* +cmdline-completion ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-completion* +cmdline-editing ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-editing* +cmdline-history ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-history* +cmdline-lines ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-lines* +cmdline-ranges ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-ranges* +cmdline-special ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-special* +cmdline-too-long ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-too-long* +cmdline-window ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline-window* +cmdline.txt ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdline.txt* +cmdwin ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdwin* +cmdwin-char ../../plugins/vimdoc-ja/doc/cmdline.jax /*cmdwin-char* +cobol.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*cobol.vim* +codeset ../../plugins/vimdoc-ja/doc/mbyte.jax /*codeset* +coding-style ../../plugins/vimdoc-ja/doc/develop.jax /*coding-style* +col() ../../plugins/vimdoc-ja/doc/eval.jax /*col()* +coldfusion.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*coldfusion.vim* +collapse ../../plugins/vimdoc-ja/doc/tips.jax /*collapse* +color-xterm ../../plugins/vimdoc-ja/doc/syntax.jax /*color-xterm* +coloring ../../plugins/vimdoc-ja/doc/syntax.jax /*coloring* +colortest.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*colortest.vim* +command-line-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*command-line-functions* +command-line-window ../../plugins/vimdoc-ja/doc/cmdline.jax /*command-line-window* +command-mode ../../plugins/vimdoc-ja/doc/intro.jax /*command-mode* +compatible-default ../../plugins/vimdoc-ja/doc/starting.jax /*compatible-default* +compiler-compaqada ../../plugins/vimdoc-ja/doc/ft_ada.jax /*compiler-compaqada* +compiler-decada ../../plugins/vimdoc-ja/doc/ft_ada.jax /*compiler-decada* +compiler-gcc ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-gcc* +compiler-gnat ../../plugins/vimdoc-ja/doc/ft_ada.jax /*compiler-gnat* +compiler-hpada ../../plugins/vimdoc-ja/doc/ft_ada.jax /*compiler-hpada* +compiler-manx ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-manx* +compiler-perl ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-perl* +compiler-pyunit ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-pyunit* +compiler-select ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-select* +compiler-tex ../../plugins/vimdoc-ja/doc/quickfix.jax /*compiler-tex* +compiler-vaxada ../../plugins/vimdoc-ja/doc/ft_ada.jax /*compiler-vaxada* +compl-current ../../plugins/vimdoc-ja/doc/insert.jax /*compl-current* +compl-define ../../plugins/vimdoc-ja/doc/insert.jax /*compl-define* +compl-dictionary ../../plugins/vimdoc-ja/doc/insert.jax /*compl-dictionary* +compl-filename ../../plugins/vimdoc-ja/doc/insert.jax /*compl-filename* +compl-function ../../plugins/vimdoc-ja/doc/insert.jax /*compl-function* +compl-generic ../../plugins/vimdoc-ja/doc/insert.jax /*compl-generic* +compl-keyword ../../plugins/vimdoc-ja/doc/insert.jax /*compl-keyword* +compl-omni ../../plugins/vimdoc-ja/doc/insert.jax /*compl-omni* +compl-omni-filetypes ../../plugins/vimdoc-ja/doc/insert.jax /*compl-omni-filetypes* +compl-spelling ../../plugins/vimdoc-ja/doc/insert.jax /*compl-spelling* +compl-tag ../../plugins/vimdoc-ja/doc/insert.jax /*compl-tag* +compl-vim ../../plugins/vimdoc-ja/doc/insert.jax /*compl-vim* +compl-whole-line ../../plugins/vimdoc-ja/doc/insert.jax /*compl-whole-line* +complete() ../../plugins/vimdoc-ja/doc/eval.jax /*complete()* +complete-functions ../../plugins/vimdoc-ja/doc/insert.jax /*complete-functions* +complete-items ../../plugins/vimdoc-ja/doc/insert.jax /*complete-items* +complete_CTRL-E ../../plugins/vimdoc-ja/doc/insert.jax /*complete_CTRL-E* +complete_CTRL-Y ../../plugins/vimdoc-ja/doc/insert.jax /*complete_CTRL-Y* +complete_add() ../../plugins/vimdoc-ja/doc/eval.jax /*complete_add()* +complete_check() ../../plugins/vimdoc-ja/doc/eval.jax /*complete_check()* +completed_item-variable ../../plugins/vimdoc-ja/doc/eval.jax /*completed_item-variable* +completion-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*completion-functions* +complex-change ../../plugins/vimdoc-ja/doc/change.jax /*complex-change* +complex-repeat ../../plugins/vimdoc-ja/doc/repeat.jax /*complex-repeat* +compress ../../plugins/vimdoc-ja/doc/pi_gzip.jax /*compress* +conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*conceal* +confirm() ../../plugins/vimdoc-ja/doc/eval.jax /*confirm()* +connection-refused ../../plugins/vimdoc-ja/doc/message.jax /*connection-refused* +console-menus ../../plugins/vimdoc-ja/doc/gui.jax /*console-menus* +control ../../plugins/vimdoc-ja/doc/intro.jax /*control* +conversion-server ../../plugins/vimdoc-ja/doc/mbyte.jax /*conversion-server* +convert-to-HTML ../../plugins/vimdoc-ja/doc/syntax.jax /*convert-to-HTML* +convert-to-XHTML ../../plugins/vimdoc-ja/doc/syntax.jax /*convert-to-XHTML* +convert-to-XML ../../plugins/vimdoc-ja/doc/syntax.jax /*convert-to-XML* +copy() ../../plugins/vimdoc-ja/doc/eval.jax /*copy()* +copy-diffs ../../plugins/vimdoc-ja/doc/diff.jax /*copy-diffs* +copy-move ../../plugins/vimdoc-ja/doc/change.jax /*copy-move* +copying ../../plugins/vimdoc-ja/doc/uganda.jax /*copying* +copyright ../../plugins/vimdoc-ja/doc/uganda.jax /*copyright* +cos() ../../plugins/vimdoc-ja/doc/eval.jax /*cos()* +cosh() ../../plugins/vimdoc-ja/doc/eval.jax /*cosh()* +count ../../plugins/vimdoc-ja/doc/intro.jax /*count* +count() ../../plugins/vimdoc-ja/doc/eval.jax /*count()* +count-bytes ../../plugins/vimdoc-ja/doc/tips.jax /*count-bytes* +count-items ../../plugins/vimdoc-ja/doc/tips.jax /*count-items* +count-variable ../../plugins/vimdoc-ja/doc/eval.jax /*count-variable* +count1-variable ../../plugins/vimdoc-ja/doc/eval.jax /*count1-variable* +cpo ../../plugins/vimdoc-ja/doc/options.jax /*cpo* +cpo-! ../../plugins/vimdoc-ja/doc/options.jax /*cpo-!* +cpo-# ../../plugins/vimdoc-ja/doc/options.jax /*cpo-#* +cpo-$ ../../plugins/vimdoc-ja/doc/options.jax /*cpo-$* +cpo-% ../../plugins/vimdoc-ja/doc/options.jax /*cpo-%* +cpo-& ../../plugins/vimdoc-ja/doc/options.jax /*cpo-&* +cpo-+ ../../plugins/vimdoc-ja/doc/options.jax /*cpo-+* +cpo-- ../../plugins/vimdoc-ja/doc/options.jax /*cpo--* +cpo-. ../../plugins/vimdoc-ja/doc/options.jax /*cpo-.* +cpo-/ ../../plugins/vimdoc-ja/doc/options.jax /*cpo-\/* +cpo-; ../../plugins/vimdoc-ja/doc/options.jax /*cpo-;* +cpo-< ../../plugins/vimdoc-ja/doc/options.jax /*cpo-<* +cpo-> ../../plugins/vimdoc-ja/doc/options.jax /*cpo->* +cpo-A ../../plugins/vimdoc-ja/doc/options.jax /*cpo-A* +cpo-B ../../plugins/vimdoc-ja/doc/options.jax /*cpo-B* +cpo-C ../../plugins/vimdoc-ja/doc/options.jax /*cpo-C* +cpo-D ../../plugins/vimdoc-ja/doc/options.jax /*cpo-D* +cpo-E ../../plugins/vimdoc-ja/doc/options.jax /*cpo-E* +cpo-F ../../plugins/vimdoc-ja/doc/options.jax /*cpo-F* +cpo-H ../../plugins/vimdoc-ja/doc/options.jax /*cpo-H* +cpo-I ../../plugins/vimdoc-ja/doc/options.jax /*cpo-I* +cpo-J ../../plugins/vimdoc-ja/doc/options.jax /*cpo-J* +cpo-K ../../plugins/vimdoc-ja/doc/options.jax /*cpo-K* +cpo-L ../../plugins/vimdoc-ja/doc/options.jax /*cpo-L* +cpo-M ../../plugins/vimdoc-ja/doc/options.jax /*cpo-M* +cpo-O ../../plugins/vimdoc-ja/doc/options.jax /*cpo-O* +cpo-P ../../plugins/vimdoc-ja/doc/options.jax /*cpo-P* +cpo-R ../../plugins/vimdoc-ja/doc/options.jax /*cpo-R* +cpo-S ../../plugins/vimdoc-ja/doc/options.jax /*cpo-S* +cpo-W ../../plugins/vimdoc-ja/doc/options.jax /*cpo-W* +cpo-X ../../plugins/vimdoc-ja/doc/options.jax /*cpo-X* +cpo-Z ../../plugins/vimdoc-ja/doc/options.jax /*cpo-Z* +cpo-\ ../../plugins/vimdoc-ja/doc/options.jax /*cpo-\\* +cpo-a ../../plugins/vimdoc-ja/doc/options.jax /*cpo-a* +cpo-b ../../plugins/vimdoc-ja/doc/options.jax /*cpo-b* +cpo-bar ../../plugins/vimdoc-ja/doc/options.jax /*cpo-bar* +cpo-c ../../plugins/vimdoc-ja/doc/options.jax /*cpo-c* +cpo-d ../../plugins/vimdoc-ja/doc/options.jax /*cpo-d* +cpo-e ../../plugins/vimdoc-ja/doc/options.jax /*cpo-e* +cpo-f ../../plugins/vimdoc-ja/doc/options.jax /*cpo-f* +cpo-g ../../plugins/vimdoc-ja/doc/options.jax /*cpo-g* +cpo-i ../../plugins/vimdoc-ja/doc/options.jax /*cpo-i* +cpo-j ../../plugins/vimdoc-ja/doc/options.jax /*cpo-j* +cpo-k ../../plugins/vimdoc-ja/doc/options.jax /*cpo-k* +cpo-l ../../plugins/vimdoc-ja/doc/options.jax /*cpo-l* +cpo-m ../../plugins/vimdoc-ja/doc/options.jax /*cpo-m* +cpo-n ../../plugins/vimdoc-ja/doc/options.jax /*cpo-n* +cpo-o ../../plugins/vimdoc-ja/doc/options.jax /*cpo-o* +cpo-p ../../plugins/vimdoc-ja/doc/options.jax /*cpo-p* +cpo-q ../../plugins/vimdoc-ja/doc/options.jax /*cpo-q* +cpo-r ../../plugins/vimdoc-ja/doc/options.jax /*cpo-r* +cpo-s ../../plugins/vimdoc-ja/doc/options.jax /*cpo-s* +cpo-star ../../plugins/vimdoc-ja/doc/options.jax /*cpo-star* +cpo-t ../../plugins/vimdoc-ja/doc/options.jax /*cpo-t* +cpo-u ../../plugins/vimdoc-ja/doc/options.jax /*cpo-u* +cpo-v ../../plugins/vimdoc-ja/doc/options.jax /*cpo-v* +cpo-w ../../plugins/vimdoc-ja/doc/options.jax /*cpo-w* +cpo-x ../../plugins/vimdoc-ja/doc/options.jax /*cpo-x* +cpo-y ../../plugins/vimdoc-ja/doc/options.jax /*cpo-y* +cpo-{ ../../plugins/vimdoc-ja/doc/options.jax /*cpo-{* +cpp.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*cpp.vim* +crash-recovery ../../plugins/vimdoc-ja/doc/recover.jax /*crash-recovery* +creating-menus ../../plugins/vimdoc-ja/doc/gui.jax /*creating-menus* +credits ../../plugins/vimdoc-ja/doc/intro.jax /*credits* +crontab ../../plugins/vimdoc-ja/doc/options.jax /*crontab* +cs-find ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cs-find* +cs7-problem ../../plugins/vimdoc-ja/doc/term.jax /*cs7-problem* +cscope ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope* +cscope-commands ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-commands* +cscope-find ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-find* +cscope-howtouse ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-howtouse* +cscope-info ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-info* +cscope-intro ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-intro* +cscope-limitations ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-limitations* +cscope-options ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-options* +cscope-suggestions ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-suggestions* +cscope-win32 ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscope-win32* +cscope_connection() ../../plugins/vimdoc-ja/doc/eval.jax /*cscope_connection()* +cscopepathcomp ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopepathcomp* +cscopeprg ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopeprg* +cscopequickfix ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopequickfix* +cscoperelative ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscoperelative* +cscopetag ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopetag* +cscopetagorder ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopetagorder* +cscopeverbose ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cscopeverbose* +csh.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*csh.vim* +cspc ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cspc* +csprg ../../plugins/vimdoc-ja/doc/if_cscop.jax /*csprg* +csqf ../../plugins/vimdoc-ja/doc/if_cscop.jax /*csqf* +csre ../../plugins/vimdoc-ja/doc/if_cscop.jax /*csre* +cst ../../plugins/vimdoc-ja/doc/if_cscop.jax /*cst* +csto ../../plugins/vimdoc-ja/doc/if_cscop.jax /*csto* +csverb ../../plugins/vimdoc-ja/doc/if_cscop.jax /*csverb* +ctags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*ctags* +cterm-colors ../../plugins/vimdoc-ja/doc/syntax.jax /*cterm-colors* +ctrl ../../plugins/vimdoc-ja/doc/intro.jax /*ctrl* +ctype-variable ../../plugins/vimdoc-ja/doc/eval.jax /*ctype-variable* +curly-braces-function-names ../../plugins/vimdoc-ja/doc/eval.jax /*curly-braces-function-names* +curly-braces-names ../../plugins/vimdoc-ja/doc/eval.jax /*curly-braces-names* +current-directory ../../plugins/vimdoc-ja/doc/editing.jax /*current-directory* +current-file ../../plugins/vimdoc-ja/doc/editing.jax /*current-file* +current_compiler ../../plugins/vimdoc-ja/doc/quickfix.jax /*current_compiler* +cursor() ../../plugins/vimdoc-ja/doc/eval.jax /*cursor()* +cursor-blinking ../../plugins/vimdoc-ja/doc/options.jax /*cursor-blinking* +cursor-down ../../plugins/vimdoc-ja/doc/intro.jax /*cursor-down* +cursor-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*cursor-functions* +cursor-left ../../plugins/vimdoc-ja/doc/intro.jax /*cursor-left* +cursor-motions ../../plugins/vimdoc-ja/doc/motion.jax /*cursor-motions* +cursor-position ../../plugins/vimdoc-ja/doc/pattern.jax /*cursor-position* +cursor-right ../../plugins/vimdoc-ja/doc/intro.jax /*cursor-right* +cursor-up ../../plugins/vimdoc-ja/doc/intro.jax /*cursor-up* +cursor_down ../../plugins/vimdoc-ja/doc/intro.jax /*cursor_down* +cursor_left ../../plugins/vimdoc-ja/doc/intro.jax /*cursor_left* +cursor_right ../../plugins/vimdoc-ja/doc/intro.jax /*cursor_right* +cursor_up ../../plugins/vimdoc-ja/doc/intro.jax /*cursor_up* +cw ../../plugins/vimdoc-ja/doc/change.jax /*cw* +cweb.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*cweb.vim* +cynlib.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*cynlib.vim* +d ../../plugins/vimdoc-ja/doc/change.jax /*d* +daB ../../plugins/vimdoc-ja/doc/motion.jax /*daB* +daW ../../plugins/vimdoc-ja/doc/motion.jax /*daW* +dab ../../plugins/vimdoc-ja/doc/motion.jax /*dab* +dap ../../plugins/vimdoc-ja/doc/motion.jax /*dap* +das ../../plugins/vimdoc-ja/doc/motion.jax /*das* +date-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*date-functions* +dav ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*dav* +davs ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*davs* +daw ../../plugins/vimdoc-ja/doc/motion.jax /*daw* +dd ../../plugins/vimdoc-ja/doc/change.jax /*dd* +debug-gcc ../../plugins/vimdoc-ja/doc/debug.jax /*debug-gcc* +debug-highlight ../../plugins/vimdoc-ja/doc/debugger.jax /*debug-highlight* +debug-leaks ../../plugins/vimdoc-ja/doc/debug.jax /*debug-leaks* +debug-minidump ../../plugins/vimdoc-ja/doc/debug.jax /*debug-minidump* +debug-mode ../../plugins/vimdoc-ja/doc/repeat.jax /*debug-mode* +debug-scripts ../../plugins/vimdoc-ja/doc/repeat.jax /*debug-scripts* +debug-signs ../../plugins/vimdoc-ja/doc/debugger.jax /*debug-signs* +debug-vim ../../plugins/vimdoc-ja/doc/debug.jax /*debug-vim* +debug-vs2005 ../../plugins/vimdoc-ja/doc/debug.jax /*debug-vs2005* +debug-win32 ../../plugins/vimdoc-ja/doc/debug.jax /*debug-win32* +debug-windbg ../../plugins/vimdoc-ja/doc/debug.jax /*debug-windbg* +debug.txt ../../plugins/vimdoc-ja/doc/debug.jax /*debug.txt* +debugger-compilation ../../plugins/vimdoc-ja/doc/debugger.jax /*debugger-compilation* +debugger-features ../../plugins/vimdoc-ja/doc/debugger.jax /*debugger-features* +debugger-integration ../../plugins/vimdoc-ja/doc/debugger.jax /*debugger-integration* +debugger-support ../../plugins/vimdoc-ja/doc/debugger.jax /*debugger-support* +debugger.txt ../../plugins/vimdoc-ja/doc/debugger.jax /*debugger.txt* +dec-mouse ../../plugins/vimdoc-ja/doc/options.jax /*dec-mouse* +decada_members ../../plugins/vimdoc-ja/doc/ft_ada.jax /*decada_members* +deepcopy() ../../plugins/vimdoc-ja/doc/eval.jax /*deepcopy()* +defaults.vim ../../plugins/vimdoc-ja/doc/starting.jax /*defaults.vim* +definition-search ../../plugins/vimdoc-ja/doc/tagsrch.jax /*definition-search* +definitions ../../plugins/vimdoc-ja/doc/intro.jax /*definitions* +delete() ../../plugins/vimdoc-ja/doc/eval.jax /*delete()* +delete-insert ../../plugins/vimdoc-ja/doc/change.jax /*delete-insert* +delete-menus ../../plugins/vimdoc-ja/doc/gui.jax /*delete-menus* +deleting ../../plugins/vimdoc-ja/doc/change.jax /*deleting* +demoserver.py ../../plugins/vimdoc-ja/doc/channel.jax /*demoserver.py* +design-assumptions ../../plugins/vimdoc-ja/doc/develop.jax /*design-assumptions* +design-compatible ../../plugins/vimdoc-ja/doc/develop.jax /*design-compatible* +design-decisions ../../plugins/vimdoc-ja/doc/develop.jax /*design-decisions* +design-documented ../../plugins/vimdoc-ja/doc/develop.jax /*design-documented* +design-flexible ../../plugins/vimdoc-ja/doc/develop.jax /*design-flexible* +design-goals ../../plugins/vimdoc-ja/doc/develop.jax /*design-goals* +design-improved ../../plugins/vimdoc-ja/doc/develop.jax /*design-improved* +design-maintain ../../plugins/vimdoc-ja/doc/develop.jax /*design-maintain* +design-multi-platform ../../plugins/vimdoc-ja/doc/develop.jax /*design-multi-platform* +design-not ../../plugins/vimdoc-ja/doc/develop.jax /*design-not* +design-speed-size ../../plugins/vimdoc-ja/doc/develop.jax /*design-speed-size* +desktop.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*desktop.vim* +develop-spell ../../plugins/vimdoc-ja/doc/develop.jax /*develop-spell* +develop-spell-suggestions ../../plugins/vimdoc-ja/doc/develop.jax /*develop-spell-suggestions* +develop.txt ../../plugins/vimdoc-ja/doc/develop.jax /*develop.txt* +development ../../plugins/vimdoc-ja/doc/develop.jax /*development* +dgn ../../plugins/vimdoc-ja/doc/motion.jax /*dgn* +dh ../../plugins/vimdoc-ja/doc/change.jax /*dh* +diB ../../plugins/vimdoc-ja/doc/motion.jax /*diB* +diW ../../plugins/vimdoc-ja/doc/motion.jax /*diW* +dialog ../../plugins/vimdoc-ja/doc/gui_w32.jax /*dialog* +dib ../../plugins/vimdoc-ja/doc/motion.jax /*dib* +dict ../../plugins/vimdoc-ja/doc/eval.jax /*dict* +dict-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*dict-functions* +dict-identity ../../plugins/vimdoc-ja/doc/eval.jax /*dict-identity* +dict-modification ../../plugins/vimdoc-ja/doc/eval.jax /*dict-modification* +did_filetype() ../../plugins/vimdoc-ja/doc/eval.jax /*did_filetype()* +diff ../../plugins/vimdoc-ja/doc/diff.jax /*diff* +diff-diffexpr ../../plugins/vimdoc-ja/doc/diff.jax /*diff-diffexpr* +diff-mode ../../plugins/vimdoc-ja/doc/diff.jax /*diff-mode* +diff-options ../../plugins/vimdoc-ja/doc/diff.jax /*diff-options* +diff-original-file ../../plugins/vimdoc-ja/doc/diff.jax /*diff-original-file* +diff-patchexpr ../../plugins/vimdoc-ja/doc/diff.jax /*diff-patchexpr* +diff-slow ../../plugins/vimdoc-ja/doc/diff.jax /*diff-slow* +diff.txt ../../plugins/vimdoc-ja/doc/diff.jax /*diff.txt* +diff.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*diff.vim* +diff_filler() ../../plugins/vimdoc-ja/doc/eval.jax /*diff_filler()* +diff_hlID() ../../plugins/vimdoc-ja/doc/eval.jax /*diff_hlID()* +diff_translations ../../plugins/vimdoc-ja/doc/diff.jax /*diff_translations* +digraph ../../plugins/vimdoc-ja/doc/digraph.jax /*digraph* +digraph-arg ../../plugins/vimdoc-ja/doc/change.jax /*digraph-arg* +digraph-encoding ../../plugins/vimdoc-ja/doc/digraph.jax /*digraph-encoding* +digraph-table ../../plugins/vimdoc-ja/doc/digraph.jax /*digraph-table* +digraph-table-mbyte ../../plugins/vimdoc-ja/doc/digraph.jax /*digraph-table-mbyte* +digraph.txt ../../plugins/vimdoc-ja/doc/digraph.jax /*digraph.txt* +digraphs ../../plugins/vimdoc-ja/doc/digraph.jax /*digraphs* +digraphs-default ../../plugins/vimdoc-ja/doc/digraph.jax /*digraphs-default* +digraphs-define ../../plugins/vimdoc-ja/doc/digraph.jax /*digraphs-define* +digraphs-use ../../plugins/vimdoc-ja/doc/digraph.jax /*digraphs-use* +dip ../../plugins/vimdoc-ja/doc/motion.jax /*dip* +dircolors.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*dircolors.vim* +dis ../../plugins/vimdoc-ja/doc/motion.jax /*dis* +disable-menus ../../plugins/vimdoc-ja/doc/gui.jax /*disable-menus* +discard ../../plugins/vimdoc-ja/doc/editing.jax /*discard* +distribute-script ../../plugins/vimdoc-ja/doc/usr_41.jax /*distribute-script* +distribution ../../plugins/vimdoc-ja/doc/intro.jax /*distribution* +diw ../../plugins/vimdoc-ja/doc/motion.jax /*diw* +dl ../../plugins/vimdoc-ja/doc/change.jax /*dl* +do ../../plugins/vimdoc-ja/doc/diff.jax /*do* +doc-file-list ../../plugins/vimdoc-ja/doc/help.jax /*doc-file-list* +docbk.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*docbk.vim* +docbksgml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*docbksgml.vim* +docbkxml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*docbkxml.vim* +docbook ../../plugins/vimdoc-ja/doc/syntax.jax /*docbook* +donate ../../plugins/vimdoc-ja/doc/uganda.jax /*donate* +dos ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos* +dos-:cd ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-:cd* +dos-CTRL-Break ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-CTRL-Break* +dos-backslash ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-backslash* +dos-colors ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-colors* +dos-file-formats ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-file-formats* +dos-locations ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-locations* +dos-shell ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-shell* +dos-standard-mappings ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-standard-mappings* +dos-temp-files ../../plugins/vimdoc-ja/doc/os_dos.jax /*dos-temp-files* +dosbatch.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*dosbatch.vim* +double-click ../../plugins/vimdoc-ja/doc/term.jax /*double-click* +download ../../plugins/vimdoc-ja/doc/intro.jax /*download* +doxygen-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*doxygen-syntax* +doxygen.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*doxygen.vim* +dp ../../plugins/vimdoc-ja/doc/diff.jax /*dp* +drag-n-drop ../../plugins/vimdoc-ja/doc/gui.jax /*drag-n-drop* +drag-n-drop-win32 ../../plugins/vimdoc-ja/doc/gui_w32.jax /*drag-n-drop-win32* +drag-status-line ../../plugins/vimdoc-ja/doc/term.jax /*drag-status-line* +dtd.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*dtd.vim* +dtd2vim ../../plugins/vimdoc-ja/doc/insert.jax /*dtd2vim* +dying-variable ../../plugins/vimdoc-ja/doc/eval.jax /*dying-variable* +e ../../plugins/vimdoc-ja/doc/motion.jax /*e* +easy ../../plugins/vimdoc-ja/doc/starting.jax /*easy* +edit-a-file ../../plugins/vimdoc-ja/doc/editing.jax /*edit-a-file* +edit-binary ../../plugins/vimdoc-ja/doc/editing.jax /*edit-binary* +edit-dialogs ../../plugins/vimdoc-ja/doc/editing.jax /*edit-dialogs* +edit-files ../../plugins/vimdoc-ja/doc/editing.jax /*edit-files* +edit-intro ../../plugins/vimdoc-ja/doc/editing.jax /*edit-intro* +edit-no-break ../../plugins/vimdoc-ja/doc/usr_25.jax /*edit-no-break* +edit-paragraph-join ../../plugins/vimdoc-ja/doc/usr_25.jax /*edit-paragraph-join* +editing.txt ../../plugins/vimdoc-ja/doc/editing.jax /*editing.txt* +efm-%> ../../plugins/vimdoc-ja/doc/quickfix.jax /*efm-%>* +efm-entries ../../plugins/vimdoc-ja/doc/quickfix.jax /*efm-entries* +efm-ignore ../../plugins/vimdoc-ja/doc/quickfix.jax /*efm-ignore* +eiffel.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*eiffel.vim* +emacs-keys ../../plugins/vimdoc-ja/doc/tips.jax /*emacs-keys* +emacs-tags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*emacs-tags* +emacs_tags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*emacs_tags* +empty() ../../plugins/vimdoc-ja/doc/eval.jax /*empty()* +encoding-names ../../plugins/vimdoc-ja/doc/mbyte.jax /*encoding-names* +encoding-table ../../plugins/vimdoc-ja/doc/mbyte.jax /*encoding-table* +encoding-values ../../plugins/vimdoc-ja/doc/mbyte.jax /*encoding-values* +encryption ../../plugins/vimdoc-ja/doc/editing.jax /*encryption* +end ../../plugins/vimdoc-ja/doc/intro.jax /*end* +end-of-file ../../plugins/vimdoc-ja/doc/pattern.jax /*end-of-file* +enlightened-terminal ../../plugins/vimdoc-ja/doc/syntax.jax /*enlightened-terminal* +erlang.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*erlang.vim* +err_buf ../../plugins/vimdoc-ja/doc/channel.jax /*err_buf* +err_cb ../../plugins/vimdoc-ja/doc/channel.jax /*err_cb* +err_mode ../../plugins/vimdoc-ja/doc/channel.jax /*err_mode* +err_modifiable ../../plugins/vimdoc-ja/doc/channel.jax /*err_modifiable* +err_msg ../../plugins/vimdoc-ja/doc/channel.jax /*err_msg* +err_name ../../plugins/vimdoc-ja/doc/channel.jax /*err_name* +err_timeout ../../plugins/vimdoc-ja/doc/channel.jax /*err_timeout* +errmsg-variable ../../plugins/vimdoc-ja/doc/eval.jax /*errmsg-variable* +error-file-format ../../plugins/vimdoc-ja/doc/quickfix.jax /*error-file-format* +error-messages ../../plugins/vimdoc-ja/doc/message.jax /*error-messages* +errorformat ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat* +errorformat-Jikes ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-Jikes* +errorformat-LaTeX ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-LaTeX* +errorformat-Perl ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-Perl* +errorformat-ant ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-ant* +errorformat-changed ../../plugins/vimdoc-ja/doc/version4.jax /*errorformat-changed* +errorformat-jade ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-jade* +errorformat-javac ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-javac* +errorformat-multi-line ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-multi-line* +errorformat-separate-filename ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformat-separate-filename* +errorformats ../../plugins/vimdoc-ja/doc/quickfix.jax /*errorformats* +errors ../../plugins/vimdoc-ja/doc/message.jax /*errors* +errors-variable ../../plugins/vimdoc-ja/doc/eval.jax /*errors-variable* +escape ../../plugins/vimdoc-ja/doc/intro.jax /*escape* +escape() ../../plugins/vimdoc-ja/doc/eval.jax /*escape()* +escape-bar ../../plugins/vimdoc-ja/doc/version4.jax /*escape-bar* +euphoria3.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*euphoria3.vim* +euphoria4.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*euphoria4.vim* +eval ../../plugins/vimdoc-ja/doc/eval.jax /*eval* +eval() ../../plugins/vimdoc-ja/doc/eval.jax /*eval()* +eval-examples ../../plugins/vimdoc-ja/doc/eval.jax /*eval-examples* +eval-sandbox ../../plugins/vimdoc-ja/doc/eval.jax /*eval-sandbox* +eval.txt ../../plugins/vimdoc-ja/doc/eval.jax /*eval.txt* +eventhandler() ../../plugins/vimdoc-ja/doc/eval.jax /*eventhandler()* +eview ../../plugins/vimdoc-ja/doc/starting.jax /*eview* +evim ../../plugins/vimdoc-ja/doc/starting.jax /*evim* +evim-keys ../../plugins/vimdoc-ja/doc/starting.jax /*evim-keys* +evim.vim ../../plugins/vimdoc-ja/doc/starting.jax /*evim.vim* +ex ../../plugins/vimdoc-ja/doc/starting.jax /*ex* +ex-cmd-index ../../plugins/vimdoc-ja/doc/index.jax /*ex-cmd-index* +ex-edit-index ../../plugins/vimdoc-ja/doc/index.jax /*ex-edit-index* +ex-flags ../../plugins/vimdoc-ja/doc/cmdline.jax /*ex-flags* +ex: ../../plugins/vimdoc-ja/doc/options.jax /*ex:* +except-autocmd ../../plugins/vimdoc-ja/doc/eval.jax /*except-autocmd* +except-autocmd-Cmd ../../plugins/vimdoc-ja/doc/eval.jax /*except-autocmd-Cmd* +except-autocmd-Post ../../plugins/vimdoc-ja/doc/eval.jax /*except-autocmd-Post* +except-autocmd-Pre ../../plugins/vimdoc-ja/doc/eval.jax /*except-autocmd-Pre* +except-autocmd-ill ../../plugins/vimdoc-ja/doc/eval.jax /*except-autocmd-ill* +except-compat ../../plugins/vimdoc-ja/doc/eval.jax /*except-compat* +except-examine ../../plugins/vimdoc-ja/doc/eval.jax /*except-examine* +except-from-finally ../../plugins/vimdoc-ja/doc/eval.jax /*except-from-finally* +except-hier-param ../../plugins/vimdoc-ja/doc/eval.jax /*except-hier-param* +except-several-errors ../../plugins/vimdoc-ja/doc/eval.jax /*except-several-errors* +except-single-line ../../plugins/vimdoc-ja/doc/eval.jax /*except-single-line* +except-syntax-err ../../plugins/vimdoc-ja/doc/eval.jax /*except-syntax-err* +except-syntax-error ../../plugins/vimdoc-ja/doc/eval.jax /*except-syntax-error* +exception-handling ../../plugins/vimdoc-ja/doc/eval.jax /*exception-handling* +exception-variable ../../plugins/vimdoc-ja/doc/eval.jax /*exception-variable* +exclusive ../../plugins/vimdoc-ja/doc/motion.jax /*exclusive* +exclusive-linewise ../../plugins/vimdoc-ja/doc/motion.jax /*exclusive-linewise* +executable() ../../plugins/vimdoc-ja/doc/eval.jax /*executable()* +execute() ../../plugins/vimdoc-ja/doc/eval.jax /*execute()* +execute-menus ../../plugins/vimdoc-ja/doc/gui.jax /*execute-menus* +exepath() ../../plugins/vimdoc-ja/doc/eval.jax /*exepath()* +exim ../../plugins/vimdoc-ja/doc/starting.jax /*exim* +exists() ../../plugins/vimdoc-ja/doc/eval.jax /*exists()* +exiting ../../plugins/vimdoc-ja/doc/starting.jax /*exiting* +exp() ../../plugins/vimdoc-ja/doc/eval.jax /*exp()* +expand() ../../plugins/vimdoc-ja/doc/eval.jax /*expand()* +expand-env ../../plugins/vimdoc-ja/doc/options.jax /*expand-env* +expand-environment-var ../../plugins/vimdoc-ja/doc/options.jax /*expand-environment-var* +expr ../../plugins/vimdoc-ja/doc/eval.jax /*expr* +expr-! ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!* +expr-!= ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!=* +expr-!=# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!=#* +expr-!=? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!=?* +expr-!~ ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!~* +expr-!~# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!~#* +expr-!~? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-!~?* +expr-% ../../plugins/vimdoc-ja/doc/eval.jax /*expr-%* +expr-&& ../../plugins/vimdoc-ja/doc/eval.jax /*expr-&&* +expr-' ../../plugins/vimdoc-ja/doc/eval.jax /*expr-'* +expr-+ ../../plugins/vimdoc-ja/doc/eval.jax /*expr-+* +expr-- ../../plugins/vimdoc-ja/doc/eval.jax /*expr--* +expr-. ../../plugins/vimdoc-ja/doc/eval.jax /*expr-.* +expr-/ ../../plugins/vimdoc-ja/doc/eval.jax /*expr-\/* +expr-< ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<* +expr-<# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<#* +expr-<= ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<=* +expr-<=# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<=#* +expr-<=? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<=?* +expr-<? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-<?* +expr-== ../../plugins/vimdoc-ja/doc/eval.jax /*expr-==* +expr-==# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-==#* +expr-==? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-==?* +expr-=~ ../../plugins/vimdoc-ja/doc/eval.jax /*expr-=~* +expr-=~# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-=~#* +expr-=~? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-=~?* +expr-> ../../plugins/vimdoc-ja/doc/eval.jax /*expr->* +expr-># ../../plugins/vimdoc-ja/doc/eval.jax /*expr->#* +expr->= ../../plugins/vimdoc-ja/doc/eval.jax /*expr->=* +expr->=# ../../plugins/vimdoc-ja/doc/eval.jax /*expr->=#* +expr->=? ../../plugins/vimdoc-ja/doc/eval.jax /*expr->=?* +expr->? ../../plugins/vimdoc-ja/doc/eval.jax /*expr->?* +expr-[:] ../../plugins/vimdoc-ja/doc/eval.jax /*expr-[:]* +expr-[] ../../plugins/vimdoc-ja/doc/eval.jax /*expr-[]* +expr-barbar ../../plugins/vimdoc-ja/doc/eval.jax /*expr-barbar* +expr-entry ../../plugins/vimdoc-ja/doc/eval.jax /*expr-entry* +expr-env ../../plugins/vimdoc-ja/doc/eval.jax /*expr-env* +expr-env-expand ../../plugins/vimdoc-ja/doc/eval.jax /*expr-env-expand* +expr-function ../../plugins/vimdoc-ja/doc/eval.jax /*expr-function* +expr-is ../../plugins/vimdoc-ja/doc/eval.jax /*expr-is* +expr-is# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-is#* +expr-is? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-is?* +expr-isnot ../../plugins/vimdoc-ja/doc/eval.jax /*expr-isnot* +expr-isnot# ../../plugins/vimdoc-ja/doc/eval.jax /*expr-isnot#* +expr-isnot? ../../plugins/vimdoc-ja/doc/eval.jax /*expr-isnot?* +expr-lambda ../../plugins/vimdoc-ja/doc/eval.jax /*expr-lambda* +expr-nesting ../../plugins/vimdoc-ja/doc/eval.jax /*expr-nesting* +expr-number ../../plugins/vimdoc-ja/doc/eval.jax /*expr-number* +expr-option ../../plugins/vimdoc-ja/doc/eval.jax /*expr-option* +expr-quote ../../plugins/vimdoc-ja/doc/eval.jax /*expr-quote* +expr-register ../../plugins/vimdoc-ja/doc/eval.jax /*expr-register* +expr-star ../../plugins/vimdoc-ja/doc/eval.jax /*expr-star* +expr-string ../../plugins/vimdoc-ja/doc/eval.jax /*expr-string* +expr-unary-+ ../../plugins/vimdoc-ja/doc/eval.jax /*expr-unary-+* +expr-unary-- ../../plugins/vimdoc-ja/doc/eval.jax /*expr-unary--* +expr-variable ../../plugins/vimdoc-ja/doc/eval.jax /*expr-variable* +expr1 ../../plugins/vimdoc-ja/doc/eval.jax /*expr1* +expr2 ../../plugins/vimdoc-ja/doc/eval.jax /*expr2* +expr3 ../../plugins/vimdoc-ja/doc/eval.jax /*expr3* +expr4 ../../plugins/vimdoc-ja/doc/eval.jax /*expr4* +expr5 ../../plugins/vimdoc-ja/doc/eval.jax /*expr5* +expr6 ../../plugins/vimdoc-ja/doc/eval.jax /*expr6* +expr7 ../../plugins/vimdoc-ja/doc/eval.jax /*expr7* +expr8 ../../plugins/vimdoc-ja/doc/eval.jax /*expr8* +expr9 ../../plugins/vimdoc-ja/doc/eval.jax /*expr9* +expression ../../plugins/vimdoc-ja/doc/eval.jax /*expression* +expression-commands ../../plugins/vimdoc-ja/doc/eval.jax /*expression-commands* +expression-syntax ../../plugins/vimdoc-ja/doc/eval.jax /*expression-syntax* +exrc ../../plugins/vimdoc-ja/doc/starting.jax /*exrc* +extend() ../../plugins/vimdoc-ja/doc/eval.jax /*extend()* +extension-removal ../../plugins/vimdoc-ja/doc/cmdline.jax /*extension-removal* +f ../../plugins/vimdoc-ja/doc/motion.jax /*f* +false-variable ../../plugins/vimdoc-ja/doc/eval.jax /*false-variable* +faq ../../plugins/vimdoc-ja/doc/intro.jax /*faq* +farsi ../../plugins/vimdoc-ja/doc/farsi.jax /*farsi* +farsi-fonts ../../plugins/vimdoc-ja/doc/farsi.jax /*farsi-fonts* +farsi.txt ../../plugins/vimdoc-ja/doc/farsi.jax /*farsi.txt* +fasm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*fasm.vim* +fcs_choice-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fcs_choice-variable* +fcs_reason-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fcs_reason-variable* +feature-list ../../plugins/vimdoc-ja/doc/eval.jax /*feature-list* +feedkeys() ../../plugins/vimdoc-ja/doc/eval.jax /*feedkeys()* +fetch ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*fetch* +file-formats ../../plugins/vimdoc-ja/doc/editing.jax /*file-formats* +file-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*file-functions* +file-pattern ../../plugins/vimdoc-ja/doc/autocmd.jax /*file-pattern* +file-read ../../plugins/vimdoc-ja/doc/insert.jax /*file-read* +file-searching ../../plugins/vimdoc-ja/doc/editing.jax /*file-searching* +file-type ../../plugins/vimdoc-ja/doc/filetype.jax /*file-type* +file-types ../../plugins/vimdoc-ja/doc/filetype.jax /*file-types* +file_readable() ../../plugins/vimdoc-ja/doc/eval.jax /*file_readable()* +filename-backslash ../../plugins/vimdoc-ja/doc/cmdline.jax /*filename-backslash* +filename-modifiers ../../plugins/vimdoc-ja/doc/cmdline.jax /*filename-modifiers* +filereadable() ../../plugins/vimdoc-ja/doc/eval.jax /*filereadable()* +filetype ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype* +filetype-detect ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype-detect* +filetype-ignore ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype-ignore* +filetype-overrule ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype-overrule* +filetype-plugin ../../plugins/vimdoc-ja/doc/usr_43.jax /*filetype-plugin* +filetype-plugins ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype-plugins* +filetype.txt ../../plugins/vimdoc-ja/doc/filetype.jax /*filetype.txt* +filetypes ../../plugins/vimdoc-ja/doc/filetype.jax /*filetypes* +filewritable() ../../plugins/vimdoc-ja/doc/eval.jax /*filewritable()* +filter ../../plugins/vimdoc-ja/doc/change.jax /*filter* +filter() ../../plugins/vimdoc-ja/doc/eval.jax /*filter()* +find-manpage ../../plugins/vimdoc-ja/doc/usr_12.jax /*find-manpage* +find-replace ../../plugins/vimdoc-ja/doc/usr_10.jax /*find-replace* +finddir() ../../plugins/vimdoc-ja/doc/eval.jax /*finddir()* +findfile() ../../plugins/vimdoc-ja/doc/eval.jax /*findfile()* +flexwiki.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*flexwiki.vim* +float-e ../../plugins/vimdoc-ja/doc/eval.jax /*float-e* +float-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*float-functions* +float-pi ../../plugins/vimdoc-ja/doc/eval.jax /*float-pi* +float2nr() ../../plugins/vimdoc-ja/doc/eval.jax /*float2nr()* +floating-point-format ../../plugins/vimdoc-ja/doc/eval.jax /*floating-point-format* +floating-point-precision ../../plugins/vimdoc-ja/doc/eval.jax /*floating-point-precision* +floor() ../../plugins/vimdoc-ja/doc/eval.jax /*floor()* +fmod() ../../plugins/vimdoc-ja/doc/eval.jax /*fmod()* +fname_diff-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fname_diff-variable* +fname_in-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fname_in-variable* +fname_new-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fname_new-variable* +fname_out-variable ../../plugins/vimdoc-ja/doc/eval.jax /*fname_out-variable* +fnameescape() ../../plugins/vimdoc-ja/doc/eval.jax /*fnameescape()* +fnamemodify() ../../plugins/vimdoc-ja/doc/eval.jax /*fnamemodify()* +fo-table ../../plugins/vimdoc-ja/doc/change.jax /*fo-table* +fold-behavior ../../plugins/vimdoc-ja/doc/fold.jax /*fold-behavior* +fold-colors ../../plugins/vimdoc-ja/doc/fold.jax /*fold-colors* +fold-commands ../../plugins/vimdoc-ja/doc/fold.jax /*fold-commands* +fold-create-marker ../../plugins/vimdoc-ja/doc/fold.jax /*fold-create-marker* +fold-delete-marker ../../plugins/vimdoc-ja/doc/fold.jax /*fold-delete-marker* +fold-diff ../../plugins/vimdoc-ja/doc/fold.jax /*fold-diff* +fold-expr ../../plugins/vimdoc-ja/doc/fold.jax /*fold-expr* +fold-foldcolumn ../../plugins/vimdoc-ja/doc/fold.jax /*fold-foldcolumn* +fold-foldlevel ../../plugins/vimdoc-ja/doc/fold.jax /*fold-foldlevel* +fold-foldtext ../../plugins/vimdoc-ja/doc/fold.jax /*fold-foldtext* +fold-indent ../../plugins/vimdoc-ja/doc/fold.jax /*fold-indent* +fold-manual ../../plugins/vimdoc-ja/doc/fold.jax /*fold-manual* +fold-marker ../../plugins/vimdoc-ja/doc/fold.jax /*fold-marker* +fold-methods ../../plugins/vimdoc-ja/doc/fold.jax /*fold-methods* +fold-options ../../plugins/vimdoc-ja/doc/fold.jax /*fold-options* +fold-syntax ../../plugins/vimdoc-ja/doc/fold.jax /*fold-syntax* +fold.txt ../../plugins/vimdoc-ja/doc/fold.jax /*fold.txt* +foldclosed() ../../plugins/vimdoc-ja/doc/eval.jax /*foldclosed()* +foldclosedend() ../../plugins/vimdoc-ja/doc/eval.jax /*foldclosedend()* +folddashes-variable ../../plugins/vimdoc-ja/doc/eval.jax /*folddashes-variable* +foldend-variable ../../plugins/vimdoc-ja/doc/eval.jax /*foldend-variable* +folding ../../plugins/vimdoc-ja/doc/fold.jax /*folding* +folding-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*folding-functions* +foldlevel() ../../plugins/vimdoc-ja/doc/eval.jax /*foldlevel()* +foldlevel-variable ../../plugins/vimdoc-ja/doc/eval.jax /*foldlevel-variable* +folds ../../plugins/vimdoc-ja/doc/fold.jax /*folds* +foldstart-variable ../../plugins/vimdoc-ja/doc/eval.jax /*foldstart-variable* +foldtext() ../../plugins/vimdoc-ja/doc/eval.jax /*foldtext()* +foldtextresult() ../../plugins/vimdoc-ja/doc/eval.jax /*foldtextresult()* +font-sizes ../../plugins/vimdoc-ja/doc/gui_x11.jax /*font-sizes* +fontset ../../plugins/vimdoc-ja/doc/mbyte.jax /*fontset* +foreground() ../../plugins/vimdoc-ja/doc/eval.jax /*foreground()* +fork ../../plugins/vimdoc-ja/doc/os_unix.jax /*fork* +form.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*form.vim* +format-bullet-list ../../plugins/vimdoc-ja/doc/tips.jax /*format-bullet-list* +format-comments ../../plugins/vimdoc-ja/doc/change.jax /*format-comments* +formatting ../../plugins/vimdoc-ja/doc/change.jax /*formatting* +formfeed ../../plugins/vimdoc-ja/doc/intro.jax /*formfeed* +fortran.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*fortran.vim* +friendship ../../plugins/vimdoc-ja/doc/intro.jax /*friendship* +frombook ../../plugins/vimdoc-ja/doc/usr_01.jax /*frombook* +ft-abel-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-abel-syntax* +ft-ada-commands ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-commands* +ft-ada-constants ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-constants* +ft-ada-functions ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-functions* +ft-ada-indent ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-indent* +ft-ada-omni ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-omni* +ft-ada-options ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-options* +ft-ada-plugin ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-plugin* +ft-ada-syntax ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-syntax* +ft-ada-variables ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft-ada-variables* +ft-ant-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ant-syntax* +ft-apache-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-apache-syntax* +ft-asm-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-asm-syntax* +ft-asm68k-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-asm68k-syntax* +ft-asmh8300-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-asmh8300-syntax* +ft-aspperl-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-aspperl-syntax* +ft-aspvbs-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-aspvbs-syntax* +ft-bash-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-bash-syntax* +ft-basic-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-basic-syntax* +ft-c-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-c-omni* +ft-c-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-c-syntax* +ft-ch-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ch-syntax* +ft-changelog-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-changelog-plugin* +ft-changelog-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-changelog-syntax* +ft-chill-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-chill-syntax* +ft-clojure-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-clojure-indent* +ft-clojure-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-clojure-syntax* +ft-cobol-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-cobol-syntax* +ft-coldfusion-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-coldfusion-syntax* +ft-cpp-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-cpp-syntax* +ft-csh-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-csh-syntax* +ft-css-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-css-omni* +ft-cweb-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-cweb-syntax* +ft-cynlib-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-cynlib-syntax* +ft-dash-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-dash-syntax* +ft-desktop-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-desktop-syntax* +ft-dircolors-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-dircolors-syntax* +ft-docbk-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-docbk-syntax* +ft-docbksgml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-docbksgml-syntax* +ft-docbkxml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-docbkxml-syntax* +ft-dosbatch-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-dosbatch-syntax* +ft-dtd-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-dtd-syntax* +ft-eiffel-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-eiffel-syntax* +ft-erlang-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-erlang-syntax* +ft-euphoria-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-euphoria-syntax* +ft-flexwiki-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-flexwiki-syntax* +ft-form-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-form-syntax* +ft-fortran-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-fortran-indent* +ft-fortran-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-fortran-plugin* +ft-fortran-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-fortran-syntax* +ft-fvwm-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-fvwm-syntax* +ft-gitcommit-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-gitcommit-plugin* +ft-groff-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-groff-syntax* +ft-gsp-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-gsp-syntax* +ft-haskell-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-haskell-syntax* +ft-html-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-html-indent* +ft-html-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-html-omni* +ft-html-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-html-syntax* +ft-htmlos-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-htmlos-syntax* +ft-ia64-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ia64-syntax* +ft-inform-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-inform-syntax* +ft-java-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-java-syntax* +ft-javascript-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-javascript-omni* +ft-ksh-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ksh-syntax* +ft-lace-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lace-syntax* +ft-lex-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lex-syntax* +ft-lifelines-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lifelines-syntax* +ft-lisp-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lisp-syntax* +ft-lite-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lite-syntax* +ft-lpc-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lpc-syntax* +ft-lua-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-lua-syntax* +ft-mail-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-mail-plugin* +ft-mail.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-mail.vim* +ft-make-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-make-syntax* +ft-man-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-man-plugin* +ft-maple-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-maple-syntax* +ft-masm-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-masm-syntax* +ft-mathematica-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-mathematica-syntax* +ft-mma-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-mma-syntax* +ft-moo-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-moo-syntax* +ft-msql-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-msql-syntax* +ft-nasm-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-nasm-syntax* +ft-ncf-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ncf-syntax* +ft-nroff-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-nroff-syntax* +ft-ocaml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ocaml-syntax* +ft-papp-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-papp-syntax* +ft-pascal-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-pascal-syntax* +ft-pdf-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-pdf-plugin* +ft-perl-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-perl-syntax* +ft-php-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-php-indent* +ft-php-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-php-omni* +ft-php-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-php-syntax* +ft-php3-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-php3-syntax* +ft-phtml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-phtml-syntax* +ft-plaintex-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-plaintex-syntax* +ft-posix-synax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-posix-synax* +ft-postscr-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-postscr-syntax* +ft-ppwiz-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ppwiz-syntax* +ft-printcap-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-printcap-syntax* +ft-progress-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-progress-syntax* +ft-ptcap-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ptcap-syntax* +ft-python-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-python-indent* +ft-python-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-python-plugin* +ft-python-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-python-syntax* +ft-quake-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-quake-syntax* +ft-r-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-r-indent* +ft-readline-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-readline-syntax* +ft-rexx-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-rexx-syntax* +ft-rst-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-rst-syntax* +ft-ruby-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-ruby-omni* +ft-ruby-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-ruby-syntax* +ft-scheme-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-scheme-syntax* +ft-sdl-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sdl-syntax* +ft-sed-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sed-syntax* +ft-sgml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sgml-syntax* +ft-sh-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-sh-indent* +ft-sh-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sh-syntax* +ft-spec-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-spec-plugin* +ft-spup-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-spup-syntax* +ft-sql ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-sql* +ft-sql-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-sql-omni* +ft-sql-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sql-syntax* +ft-sqlanywhere-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sqlanywhere-syntax* +ft-sqlinformix-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-sqlinformix-syntax* +ft-syntax-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-syntax-omni* +ft-tcsh-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-tcsh-syntax* +ft-termcap-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-termcap-syntax* +ft-tex-plugin ../../plugins/vimdoc-ja/doc/filetype.jax /*ft-tex-plugin* +ft-tex-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-tex-syntax* +ft-tf-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-tf-syntax* +ft-vb-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-vb-syntax* +ft-verilog-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-verilog-indent* +ft-vhdl-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-vhdl-indent* +ft-vim-indent ../../plugins/vimdoc-ja/doc/indent.jax /*ft-vim-indent* +ft-vim-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-vim-syntax* +ft-xf86conf-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-xf86conf-syntax* +ft-xhtml-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-xhtml-omni* +ft-xml-omni ../../plugins/vimdoc-ja/doc/insert.jax /*ft-xml-omni* +ft-xml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-xml-syntax* +ft-xpm-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-xpm-syntax* +ft-yaml-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-yaml-syntax* +ft-zsh-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*ft-zsh-syntax* +ft_ada.txt ../../plugins/vimdoc-ja/doc/ft_ada.jax /*ft_ada.txt* +ft_sql.txt ../../plugins/vimdoc-ja/doc/ft_sql.jax /*ft_sql.txt* +ftdetect ../../plugins/vimdoc-ja/doc/filetype.jax /*ftdetect* +ftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*ftp* +ftplugin ../../plugins/vimdoc-ja/doc/usr_41.jax /*ftplugin* +ftplugin-docs ../../plugins/vimdoc-ja/doc/filetype.jax /*ftplugin-docs* +ftplugin-name ../../plugins/vimdoc-ja/doc/usr_05.jax /*ftplugin-name* +ftplugin-overrule ../../plugins/vimdoc-ja/doc/filetype.jax /*ftplugin-overrule* +ftplugin-special ../../plugins/vimdoc-ja/doc/usr_41.jax /*ftplugin-special* +ftplugins ../../plugins/vimdoc-ja/doc/usr_05.jax /*ftplugins* +funcref() ../../plugins/vimdoc-ja/doc/eval.jax /*funcref()* +function() ../../plugins/vimdoc-ja/doc/eval.jax /*function()* +function-argument ../../plugins/vimdoc-ja/doc/eval.jax /*function-argument* +function-key ../../plugins/vimdoc-ja/doc/intro.jax /*function-key* +function-list ../../plugins/vimdoc-ja/doc/usr_41.jax /*function-list* +function-range-example ../../plugins/vimdoc-ja/doc/eval.jax /*function-range-example* +function-search-undo ../../plugins/vimdoc-ja/doc/eval.jax /*function-search-undo* +function_key ../../plugins/vimdoc-ja/doc/intro.jax /*function_key* +functions ../../plugins/vimdoc-ja/doc/eval.jax /*functions* +fvwm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*fvwm.vim* +g ../../plugins/vimdoc-ja/doc/index.jax /*g* +g# ../../plugins/vimdoc-ja/doc/pattern.jax /*g#* +g$ ../../plugins/vimdoc-ja/doc/motion.jax /*g$* +g& ../../plugins/vimdoc-ja/doc/change.jax /*g&* +g' ../../plugins/vimdoc-ja/doc/motion.jax /*g'* +g'a ../../plugins/vimdoc-ja/doc/motion.jax /*g'a* +g+ ../../plugins/vimdoc-ja/doc/undo.jax /*g+* +g, ../../plugins/vimdoc-ja/doc/motion.jax /*g,* +g- ../../plugins/vimdoc-ja/doc/undo.jax /*g-* +g0 ../../plugins/vimdoc-ja/doc/motion.jax /*g0* +g8 ../../plugins/vimdoc-ja/doc/various.jax /*g8* +g: ../../plugins/vimdoc-ja/doc/eval.jax /*g:* +g:NetrwTopLvlMenu ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:NetrwTopLvlMenu* +g:Netrw_UserMaps ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:Netrw_UserMaps* +g:Netrw_corehandler ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:Netrw_corehandler* +g:Netrw_funcref ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:Netrw_funcref* +g:actual_curbuf ../../plugins/vimdoc-ja/doc/options.jax /*g:actual_curbuf* +g:ada#Comment ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada#Comment* +g:ada#Ctags_Kinds ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada#Ctags_Kinds* +g:ada#DotWordRegex ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada#DotWordRegex* +g:ada#Keywords ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada#Keywords* +g:ada#WordRegex ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada#WordRegex* +g:ada_abbrev ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_abbrev* +g:ada_all_tab_usage ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_all_tab_usage* +g:ada_begin_preproc ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_begin_preproc* +g:ada_default_compiler ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_default_compiler* +g:ada_extended_completion ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_extended_completion* +g:ada_extended_tagging ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_extended_tagging* +g:ada_folding ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_folding* +g:ada_gnat_extensions ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_gnat_extensions* +g:ada_line_errors ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_line_errors* +g:ada_no_tab_space_error ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_no_tab_space_error* +g:ada_no_trail_space_error ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_no_trail_space_error* +g:ada_omni_with_keywords ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_omni_with_keywords* +g:ada_rainbow_color ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_rainbow_color* +g:ada_space_errors ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_space_errors* +g:ada_standard_types ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_standard_types* +g:ada_with_gnat_project_files ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_with_gnat_project_files* +g:ada_withuse_ordinary ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:ada_withuse_ordinary* +g:clojure_align_multiline_strings ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_align_multiline_strings* +g:clojure_align_subforms ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_align_subforms* +g:clojure_fuzzy_indent ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_fuzzy_indent* +g:clojure_fuzzy_indent_blacklist ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_fuzzy_indent_blacklist* +g:clojure_fuzzy_indent_patterns ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_fuzzy_indent_patterns* +g:clojure_maxlines ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_maxlines* +g:clojure_special_indent_words ../../plugins/vimdoc-ja/doc/indent.jax /*g:clojure_special_indent_words* +g:clojure_syntax_keywords ../../plugins/vimdoc-ja/doc/syntax.jax /*g:clojure_syntax_keywords* +g:colors_name ../../plugins/vimdoc-ja/doc/options.jax /*g:colors_name* +g:decada ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:decada* +g:decada.Error_Format ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:decada.Error_Format* +g:decada.Make() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:decada.Make()* +g:decada.Make_Command ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:decada.Make_Command* +g:decada.Unit_Name() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:decada.Unit_Name()* +g:filetype_csh ../../plugins/vimdoc-ja/doc/syntax.jax /*g:filetype_csh* +g:filetype_r ../../plugins/vimdoc-ja/doc/syntax.jax /*g:filetype_r* +g:gnat ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat* +g:gnat.Error_Format ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Error_Format* +g:gnat.Find() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Find()* +g:gnat.Find_Program ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Find_Program* +g:gnat.Make() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Make()* +g:gnat.Make_Command ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Make_Command* +g:gnat.Pretty() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Pretty()* +g:gnat.Pretty_Program ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Pretty_Program* +g:gnat.Project_File ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Project_File* +g:gnat.Set_Project_File() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Set_Project_File()* +g:gnat.Tags() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Tags()* +g:gnat.Tags_Command ../../plugins/vimdoc-ja/doc/ft_ada.jax /*g:gnat.Tags_Command* +g:html_charset_override ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_charset_override* +g:html_diff_one_file ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_diff_one_file* +g:html_dynamic_folds ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_dynamic_folds* +g:html_encoding_override ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_encoding_override* +g:html_end_line ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_end_line* +g:html_expand_tabs ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_expand_tabs* +g:html_font ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_font* +g:html_hover_unfold ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_hover_unfold* +g:html_id_expr ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_id_expr* +g:html_ignore_conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_ignore_conceal* +g:html_ignore_folding ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_ignore_folding* +g:html_line_ids ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_line_ids* +g:html_no_foldcolumn ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_no_foldcolumn* +g:html_no_invalid ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_no_invalid* +g:html_no_pre ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_no_pre* +g:html_no_progress ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_no_progress* +g:html_number_lines ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_number_lines* +g:html_pre_wrap ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_pre_wrap* +g:html_prevent_copy ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_prevent_copy* +g:html_start_line ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_start_line* +g:html_use_css ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_use_css* +g:html_use_encoding ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_use_encoding* +g:html_use_xhtml ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_use_xhtml* +g:html_whole_filler ../../plugins/vimdoc-ja/doc/syntax.jax /*g:html_whole_filler* +g:netrw_altfile ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_altfile* +g:netrw_alto ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_alto* +g:netrw_altv ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_altv* +g:netrw_banner ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_banner* +g:netrw_bannerbackslash ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_bannerbackslash* +g:netrw_browse_split ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_browse_split* +g:netrw_browsex_viewer ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_browsex_viewer* +g:netrw_bufsettings ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_bufsettings* +g:netrw_chgperm ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_chgperm* +g:netrw_chgwin ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_chgwin* +g:netrw_compress ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_compress* +g:netrw_ctags ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ctags* +g:netrw_cursor ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_cursor* +g:netrw_cygwin ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_cygwin* +g:netrw_dav_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_dav_cmd* +g:netrw_decompress ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_decompress* +g:netrw_dirhistmax ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_dirhistmax* +g:netrw_dynamic_maxfilenamelen ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_dynamic_maxfilenamelen* +g:netrw_errorlvl ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_errorlvl* +g:netrw_fastbrowse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_fastbrowse* +g:netrw_fetch_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_fetch_cmd* +g:netrw_ffkeep ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ffkeep* +g:netrw_file_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_file_cmd* +g:netrw_fname_escape ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_fname_escape* +g:netrw_ftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp* +g:netrw_ftp_browse_reject ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_browse_reject* +g:netrw_ftp_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_cmd* +g:netrw_ftp_list_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_list_cmd* +g:netrw_ftp_options ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_options* +g:netrw_ftp_sizelist_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_sizelist_cmd* +g:netrw_ftp_timelist_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftp_timelist_cmd* +g:netrw_ftpextracmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftpextracmd* +g:netrw_ftpmode ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ftpmode* +g:netrw_glob_escape ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_glob_escape* +g:netrw_gx ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_gx* +g:netrw_hide ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_hide* +g:netrw_home ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_home* +g:netrw_http_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_http_cmd* +g:netrw_http_put_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_http_put_cmd* +g:netrw_http_xcmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_http_xcmd* +g:netrw_ignorenetrc ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ignorenetrc* +g:netrw_keepdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_keepdir* +g:netrw_keepj ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_keepj* +g:netrw_list_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_list_cmd* +g:netrw_list_cmd_options ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_list_cmd_options* +g:netrw_list_hide ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_list_hide* +g:netrw_liststyle ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_liststyle* +g:netrw_localcopycmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_localcopycmd* +g:netrw_localcopydircmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_localcopydircmd* +g:netrw_localmkdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_localmkdir* +g:netrw_localmovecmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_localmovecmd* +g:netrw_localrmdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_localrmdir* +g:netrw_maxfilenamelen ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_maxfilenamelen* +g:netrw_menu ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_menu* +g:netrw_mkdir_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_mkdir_cmd* +g:netrw_mousemaps ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_mousemaps* +g:netrw_nobeval ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_nobeval* +g:netrw_nogx ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_nogx* +g:netrw_preview ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_preview* +g:netrw_rcp_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_rcp_cmd* +g:netrw_remote_mkdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_remote_mkdir* +g:netrw_retmap ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_retmap* +g:netrw_rm_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_rm_cmd* +g:netrw_rmdir_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_rmdir_cmd* +g:netrw_rmf_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_rmf_cmd* +g:netrw_rsync_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_rsync_cmd* +g:netrw_scp_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_scp_cmd* +g:netrw_scpport ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_scpport* +g:netrw_sepchr ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sepchr* +g:netrw_servername ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_servername* +g:netrw_sftp_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sftp_cmd* +g:netrw_silent ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_silent* +g:netrw_sizestyle ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sizestyle* +g:netrw_sort_by ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sort_by* +g:netrw_sort_direction ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sort_direction* +g:netrw_sort_options ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sort_options* +g:netrw_sort_sequence ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sort_sequence* +g:netrw_special_syntax ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_special_syntax* +g:netrw_ssh_browse_reject ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ssh_browse_reject* +g:netrw_ssh_cmd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_ssh_cmd* +g:netrw_sshport ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_sshport* +g:netrw_suppress_gx_mesg ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_suppress_gx_mesg* +g:netrw_timefmt ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_timefmt* +g:netrw_tmpfile_escape ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_tmpfile_escape* +g:netrw_uid ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_uid* +g:netrw_use_errorwindow ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_use_errorwindow* +g:netrw_use_noswf ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_use_noswf* +g:netrw_use_nt_rcp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_use_nt_rcp* +g:netrw_usetab ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_usetab* +g:netrw_win95ftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_win95ftp* +g:netrw_winsize ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_winsize* +g:netrw_wiw ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_wiw* +g:netrw_xstrlen ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*g:netrw_xstrlen* +g:syntax_on ../../plugins/vimdoc-ja/doc/syntax.jax /*g:syntax_on* +g:tar_browseoptions ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_browseoptions* +g:tar_cmd ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_cmd* +g:tar_copycmd ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_copycmd* +g:tar_extractcmd ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_extractcmd* +g:tar_nomax ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_nomax* +g:tar_readoptions ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_readoptions* +g:tar_secure ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_secure* +g:tar_writeoptions ../../plugins/vimdoc-ja/doc/pi_tar.jax /*g:tar_writeoptions* +g:tex_comment_nospell ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_comment_nospell* +g:tex_conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_conceal* +g:tex_fast ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_fast* +g:tex_flavor ../../plugins/vimdoc-ja/doc/filetype.jax /*g:tex_flavor* +g:tex_fold_enabled ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_fold_enabled* +g:tex_isk ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_isk* +g:tex_no_error ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_no_error* +g:tex_nospell ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_nospell* +g:tex_stylish ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_stylish* +g:tex_subscripts ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_subscripts* +g:tex_superscripts ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_superscripts* +g:tex_verbspell ../../plugins/vimdoc-ja/doc/syntax.jax /*g:tex_verbspell* +g:var ../../plugins/vimdoc-ja/doc/eval.jax /*g:var* +g:vimball_home ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*g:vimball_home* +g:vimball_mkdir ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*g:vimball_mkdir* +g:vimsyn_embed ../../plugins/vimdoc-ja/doc/syntax.jax /*g:vimsyn_embed* +g:vimsyn_folding ../../plugins/vimdoc-ja/doc/syntax.jax /*g:vimsyn_folding* +g:vimsyn_maxlines ../../plugins/vimdoc-ja/doc/syntax.jax /*g:vimsyn_maxlines* +g:vimsyn_minlines ../../plugins/vimdoc-ja/doc/syntax.jax /*g:vimsyn_minlines* +g:vimsyn_noerror ../../plugins/vimdoc-ja/doc/syntax.jax /*g:vimsyn_noerror* +g:yaml_schema ../../plugins/vimdoc-ja/doc/syntax.jax /*g:yaml_schema* +g:zipPlugin_ext ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zipPlugin_ext* +g:zip_extractcmd ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zip_extractcmd* +g:zip_nomax ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zip_nomax* +g:zip_shq ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zip_shq* +g:zip_unzipcmd ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zip_unzipcmd* +g:zip_zipcmd ../../plugins/vimdoc-ja/doc/pi_zip.jax /*g:zip_zipcmd* +g; ../../plugins/vimdoc-ja/doc/motion.jax /*g;* +g< ../../plugins/vimdoc-ja/doc/message.jax /*g<* +g<Down> ../../plugins/vimdoc-ja/doc/motion.jax /*g<Down>* +g<End> ../../plugins/vimdoc-ja/doc/motion.jax /*g<End>* +g<Home> ../../plugins/vimdoc-ja/doc/motion.jax /*g<Home>* +g<LeftMouse> ../../plugins/vimdoc-ja/doc/tagsrch.jax /*g<LeftMouse>* +g<RightMouse> ../../plugins/vimdoc-ja/doc/tagsrch.jax /*g<RightMouse>* +g<Up> ../../plugins/vimdoc-ja/doc/motion.jax /*g<Up>* +g? ../../plugins/vimdoc-ja/doc/change.jax /*g?* +g?? ../../plugins/vimdoc-ja/doc/change.jax /*g??* +g?g? ../../plugins/vimdoc-ja/doc/change.jax /*g?g?* +g@ ../../plugins/vimdoc-ja/doc/map.jax /*g@* +gD ../../plugins/vimdoc-ja/doc/pattern.jax /*gD* +gE ../../plugins/vimdoc-ja/doc/motion.jax /*gE* +gF ../../plugins/vimdoc-ja/doc/editing.jax /*gF* +gH ../../plugins/vimdoc-ja/doc/visual.jax /*gH* +gI ../../plugins/vimdoc-ja/doc/insert.jax /*gI* +gJ ../../plugins/vimdoc-ja/doc/change.jax /*gJ* +gN ../../plugins/vimdoc-ja/doc/visual.jax /*gN* +gP ../../plugins/vimdoc-ja/doc/change.jax /*gP* +gQ ../../plugins/vimdoc-ja/doc/intro.jax /*gQ* +gR ../../plugins/vimdoc-ja/doc/change.jax /*gR* +gT ../../plugins/vimdoc-ja/doc/tabpage.jax /*gT* +gU ../../plugins/vimdoc-ja/doc/change.jax /*gU* +gUU ../../plugins/vimdoc-ja/doc/change.jax /*gUU* +gUgU ../../plugins/vimdoc-ja/doc/change.jax /*gUgU* +gV ../../plugins/vimdoc-ja/doc/visual.jax /*gV* +g] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*g]* +g^ ../../plugins/vimdoc-ja/doc/motion.jax /*g^* +g_ ../../plugins/vimdoc-ja/doc/motion.jax /*g_* +g_CTRL-A ../../plugins/vimdoc-ja/doc/various.jax /*g_CTRL-A* +g_CTRL-G ../../plugins/vimdoc-ja/doc/editing.jax /*g_CTRL-G* +g_CTRL-H ../../plugins/vimdoc-ja/doc/visual.jax /*g_CTRL-H* +g_CTRL-] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*g_CTRL-]* +g` ../../plugins/vimdoc-ja/doc/motion.jax /*g`* +g`a ../../plugins/vimdoc-ja/doc/motion.jax /*g`a* +ga ../../plugins/vimdoc-ja/doc/various.jax /*ga* +garbagecollect() ../../plugins/vimdoc-ja/doc/eval.jax /*garbagecollect()* +gd ../../plugins/vimdoc-ja/doc/pattern.jax /*gd* +gdb ../../plugins/vimdoc-ja/doc/debug.jax /*gdb* +ge ../../plugins/vimdoc-ja/doc/motion.jax /*ge* +get() ../../plugins/vimdoc-ja/doc/eval.jax /*get()* +get-ms-debuggers ../../plugins/vimdoc-ja/doc/debug.jax /*get-ms-debuggers* +getbufinfo() ../../plugins/vimdoc-ja/doc/eval.jax /*getbufinfo()* +getbufline() ../../plugins/vimdoc-ja/doc/eval.jax /*getbufline()* +getbufvar() ../../plugins/vimdoc-ja/doc/eval.jax /*getbufvar()* +getchar() ../../plugins/vimdoc-ja/doc/eval.jax /*getchar()* +getcharmod() ../../plugins/vimdoc-ja/doc/eval.jax /*getcharmod()* +getcharsearch() ../../plugins/vimdoc-ja/doc/eval.jax /*getcharsearch()* +getcmdline() ../../plugins/vimdoc-ja/doc/eval.jax /*getcmdline()* +getcmdpos() ../../plugins/vimdoc-ja/doc/eval.jax /*getcmdpos()* +getcmdtype() ../../plugins/vimdoc-ja/doc/eval.jax /*getcmdtype()* +getcmdwintype() ../../plugins/vimdoc-ja/doc/eval.jax /*getcmdwintype()* +getcompletion() ../../plugins/vimdoc-ja/doc/eval.jax /*getcompletion()* +getcurpos() ../../plugins/vimdoc-ja/doc/eval.jax /*getcurpos()* +getcwd() ../../plugins/vimdoc-ja/doc/eval.jax /*getcwd()* +getfontname() ../../plugins/vimdoc-ja/doc/eval.jax /*getfontname()* +getfperm() ../../plugins/vimdoc-ja/doc/eval.jax /*getfperm()* +getfsize() ../../plugins/vimdoc-ja/doc/eval.jax /*getfsize()* +getftime() ../../plugins/vimdoc-ja/doc/eval.jax /*getftime()* +getftype() ../../plugins/vimdoc-ja/doc/eval.jax /*getftype()* +getlatestvimscripts-install ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getlatestvimscripts-install* +getline() ../../plugins/vimdoc-ja/doc/eval.jax /*getline()* +getloclist() ../../plugins/vimdoc-ja/doc/eval.jax /*getloclist()* +getmatches() ../../plugins/vimdoc-ja/doc/eval.jax /*getmatches()* +getpid() ../../plugins/vimdoc-ja/doc/eval.jax /*getpid()* +getpos() ../../plugins/vimdoc-ja/doc/eval.jax /*getpos()* +getqflist() ../../plugins/vimdoc-ja/doc/eval.jax /*getqflist()* +getreg() ../../plugins/vimdoc-ja/doc/eval.jax /*getreg()* +getregtype() ../../plugins/vimdoc-ja/doc/eval.jax /*getregtype()* +getscript ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript* +getscript-autoinstall ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript-autoinstall* +getscript-data ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript-data* +getscript-history ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript-history* +getscript-plugins ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript-plugins* +getscript-start ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*getscript-start* +gettabinfo() ../../plugins/vimdoc-ja/doc/eval.jax /*gettabinfo()* +gettabvar() ../../plugins/vimdoc-ja/doc/eval.jax /*gettabvar()* +gettabwinvar() ../../plugins/vimdoc-ja/doc/eval.jax /*gettabwinvar()* +getwininfo() ../../plugins/vimdoc-ja/doc/eval.jax /*getwininfo()* +getwinposx() ../../plugins/vimdoc-ja/doc/eval.jax /*getwinposx()* +getwinposy() ../../plugins/vimdoc-ja/doc/eval.jax /*getwinposy()* +getwinvar() ../../plugins/vimdoc-ja/doc/eval.jax /*getwinvar()* +gex ../../plugins/vimdoc-ja/doc/starting.jax /*gex* +gf ../../plugins/vimdoc-ja/doc/editing.jax /*gf* +gg ../../plugins/vimdoc-ja/doc/motion.jax /*gg* +gh ../../plugins/vimdoc-ja/doc/visual.jax /*gh* +gi ../../plugins/vimdoc-ja/doc/insert.jax /*gi* +gj ../../plugins/vimdoc-ja/doc/motion.jax /*gj* +gk ../../plugins/vimdoc-ja/doc/motion.jax /*gk* +glob() ../../plugins/vimdoc-ja/doc/eval.jax /*glob()* +glob2regpat() ../../plugins/vimdoc-ja/doc/eval.jax /*glob2regpat()* +global-ime ../../plugins/vimdoc-ja/doc/mbyte.jax /*global-ime* +global-local ../../plugins/vimdoc-ja/doc/options.jax /*global-local* +global-variable ../../plugins/vimdoc-ja/doc/eval.jax /*global-variable* +global_markfilelist ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*global_markfilelist* +globpath() ../../plugins/vimdoc-ja/doc/eval.jax /*globpath()* +glvs ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs* +glvs-alg ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-alg* +glvs-algorithm ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-algorithm* +glvs-autoinstall ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-autoinstall* +glvs-contents ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-contents* +glvs-copyright ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-copyright* +glvs-data ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-data* +glvs-dist-install ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-dist-install* +glvs-hist ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-hist* +glvs-install ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-install* +glvs-options ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-options* +glvs-plugins ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-plugins* +glvs-usage ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*glvs-usage* +gm ../../plugins/vimdoc-ja/doc/motion.jax /*gm* +gn ../../plugins/vimdoc-ja/doc/visual.jax /*gn* +gnat#Insert_Tags_Header() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*gnat#Insert_Tags_Header()* +gnat#New() ../../plugins/vimdoc-ja/doc/ft_ada.jax /*gnat#New()* +gnat-xref ../../plugins/vimdoc-ja/doc/ft_ada.jax /*gnat-xref* +gnat_members ../../plugins/vimdoc-ja/doc/ft_ada.jax /*gnat_members* +gnome-session ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gnome-session* +go ../../plugins/vimdoc-ja/doc/motion.jax /*go* +gp ../../plugins/vimdoc-ja/doc/change.jax /*gp* +gpm-mouse ../../plugins/vimdoc-ja/doc/term.jax /*gpm-mouse* +gq ../../plugins/vimdoc-ja/doc/change.jax /*gq* +gqap ../../plugins/vimdoc-ja/doc/change.jax /*gqap* +gqgq ../../plugins/vimdoc-ja/doc/change.jax /*gqgq* +gqq ../../plugins/vimdoc-ja/doc/change.jax /*gqq* +gr ../../plugins/vimdoc-ja/doc/change.jax /*gr* +graphic-option-gone ../../plugins/vimdoc-ja/doc/version4.jax /*graphic-option-gone* +greek ../../plugins/vimdoc-ja/doc/options.jax /*greek* +grep ../../plugins/vimdoc-ja/doc/quickfix.jax /*grep* +groff.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*groff.vim* +gross-national-happiness ../../plugins/vimdoc-ja/doc/intro.jax /*gross-national-happiness* +group-name ../../plugins/vimdoc-ja/doc/syntax.jax /*group-name* +gs ../../plugins/vimdoc-ja/doc/various.jax /*gs* +gsp.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*gsp.vim* +gstar ../../plugins/vimdoc-ja/doc/pattern.jax /*gstar* +gt ../../plugins/vimdoc-ja/doc/tabpage.jax /*gt* +gtk-tooltip-colors ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gtk-tooltip-colors* +gu ../../plugins/vimdoc-ja/doc/change.jax /*gu* +gugu ../../plugins/vimdoc-ja/doc/change.jax /*gugu* +gui ../../plugins/vimdoc-ja/doc/gui.jax /*gui* +gui-IME ../../plugins/vimdoc-ja/doc/gui.jax /*gui-IME* +gui-clipboard ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-clipboard* +gui-colors ../../plugins/vimdoc-ja/doc/syntax.jax /*gui-colors* +gui-extras ../../plugins/vimdoc-ja/doc/gui.jax /*gui-extras* +gui-footer ../../plugins/vimdoc-ja/doc/debugger.jax /*gui-footer* +gui-fork ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-fork* +gui-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*gui-functions* +gui-gnome ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-gnome* +gui-gnome-session ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-gnome-session* +gui-gtk ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-gtk* +gui-gtk-socketid ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-gtk-socketid* +gui-horiz-scroll ../../plugins/vimdoc-ja/doc/gui.jax /*gui-horiz-scroll* +gui-init ../../plugins/vimdoc-ja/doc/gui.jax /*gui-init* +gui-kde ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-kde* +gui-mouse ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse* +gui-mouse-focus ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-focus* +gui-mouse-mapping ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-mapping* +gui-mouse-modeless ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-modeless* +gui-mouse-move ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-move* +gui-mouse-select ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-select* +gui-mouse-status ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-status* +gui-mouse-various ../../plugins/vimdoc-ja/doc/gui.jax /*gui-mouse-various* +gui-pty ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-pty* +gui-pty-erase ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-pty-erase* +gui-resources ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-resources* +gui-scrollbars ../../plugins/vimdoc-ja/doc/gui.jax /*gui-scrollbars* +gui-selections ../../plugins/vimdoc-ja/doc/gui.jax /*gui-selections* +gui-shell ../../plugins/vimdoc-ja/doc/gui.jax /*gui-shell* +gui-shell-win32 ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-shell-win32* +gui-start ../../plugins/vimdoc-ja/doc/gui.jax /*gui-start* +gui-toolbar ../../plugins/vimdoc-ja/doc/gui.jax /*gui-toolbar* +gui-vert-scroll ../../plugins/vimdoc-ja/doc/gui.jax /*gui-vert-scroll* +gui-w32 ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32* +gui-w32-cmdargs ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-cmdargs* +gui-w32-dialogs ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-dialogs* +gui-w32-printing ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-printing* +gui-w32-start ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-start* +gui-w32-various ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-various* +gui-w32-windowid ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32-windowid* +gui-w32s ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-w32s* +gui-win32-maximized ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui-win32-maximized* +gui-x11 ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11* +gui-x11-athena ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-athena* +gui-x11-compiling ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-compiling* +gui-x11-gtk ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-gtk* +gui-x11-kde ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-kde* +gui-x11-misc ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-misc* +gui-x11-motif ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-motif* +gui-x11-neXtaw ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-neXtaw* +gui-x11-printing ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-printing* +gui-x11-start ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-start* +gui-x11-various ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui-x11-various* +gui.txt ../../plugins/vimdoc-ja/doc/gui.jax /*gui.txt* +gui_w32.txt ../../plugins/vimdoc-ja/doc/gui_w32.jax /*gui_w32.txt* +gui_x11.txt ../../plugins/vimdoc-ja/doc/gui_x11.jax /*gui_x11.txt* +guifontwide_gtk2 ../../plugins/vimdoc-ja/doc/options.jax /*guifontwide_gtk2* +guifontwide_win_mbyte ../../plugins/vimdoc-ja/doc/options.jax /*guifontwide_win_mbyte* +guioptions_a ../../plugins/vimdoc-ja/doc/options.jax /*guioptions_a* +guu ../../plugins/vimdoc-ja/doc/change.jax /*guu* +gv ../../plugins/vimdoc-ja/doc/visual.jax /*gv* +gview ../../plugins/vimdoc-ja/doc/starting.jax /*gview* +gvim ../../plugins/vimdoc-ja/doc/starting.jax /*gvim* +gvimdiff ../../plugins/vimdoc-ja/doc/diff.jax /*gvimdiff* +gvimrc ../../plugins/vimdoc-ja/doc/gui.jax /*gvimrc* +gw ../../plugins/vimdoc-ja/doc/change.jax /*gw* +gwgw ../../plugins/vimdoc-ja/doc/change.jax /*gwgw* +gww ../../plugins/vimdoc-ja/doc/change.jax /*gww* +gzip ../../plugins/vimdoc-ja/doc/pi_gzip.jax /*gzip* +gzip-autocmd ../../plugins/vimdoc-ja/doc/pi_gzip.jax /*gzip-autocmd* +gzip-example ../../plugins/vimdoc-ja/doc/autocmd.jax /*gzip-example* +gzip-helpfile ../../plugins/vimdoc-ja/doc/tips.jax /*gzip-helpfile* +g~ ../../plugins/vimdoc-ja/doc/change.jax /*g~* +g~g~ ../../plugins/vimdoc-ja/doc/change.jax /*g~g~* +g~~ ../../plugins/vimdoc-ja/doc/change.jax /*g~~* +h ../../plugins/vimdoc-ja/doc/motion.jax /*h* +hangul ../../plugins/vimdoc-ja/doc/hangulin.jax /*hangul* +hangulin.txt ../../plugins/vimdoc-ja/doc/hangulin.jax /*hangulin.txt* +has() ../../plugins/vimdoc-ja/doc/eval.jax /*has()* +has-patch ../../plugins/vimdoc-ja/doc/eval.jax /*has-patch* +has-python ../../plugins/vimdoc-ja/doc/if_pyth.jax /*has-python* +has_key() ../../plugins/vimdoc-ja/doc/eval.jax /*has_key()* +haskell.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*haskell.vim* +haslocaldir() ../../plugins/vimdoc-ja/doc/eval.jax /*haslocaldir()* +hasmapto() ../../plugins/vimdoc-ja/doc/eval.jax /*hasmapto()* +help ../../plugins/vimdoc-ja/doc/helphelp.jax /*help* +help-context ../../plugins/vimdoc-ja/doc/help.jax /*help-context* +help-summary ../../plugins/vimdoc-ja/doc/usr_02.jax /*help-summary* +help-tags tags 1 +help-translated ../../plugins/vimdoc-ja/doc/helphelp.jax /*help-translated* +help-writing ../../plugins/vimdoc-ja/doc/helphelp.jax /*help-writing* +help-xterm-window ../../plugins/vimdoc-ja/doc/helphelp.jax /*help-xterm-window* +help.txt ../../plugins/vimdoc-ja/doc/help.jax /*help.txt* +helpfile_name.txt ../../plugins/vimdoc-ja/doc/helphelp.jax /*helpfile_name.txt* +helphelp ../../plugins/vimdoc-ja/doc/helphelp.jax /*helphelp* +helphelp.txt ../../plugins/vimdoc-ja/doc/helphelp.jax /*helphelp.txt* +hex-editing ../../plugins/vimdoc-ja/doc/tips.jax /*hex-editing* +hex-number ../../plugins/vimdoc-ja/doc/eval.jax /*hex-number* +hidden-buffer ../../plugins/vimdoc-ja/doc/windows.jax /*hidden-buffer* +hidden-menus ../../plugins/vimdoc-ja/doc/gui.jax /*hidden-menus* +hidden-options ../../plugins/vimdoc-ja/doc/options.jax /*hidden-options* +hidden-quit ../../plugins/vimdoc-ja/doc/windows.jax /*hidden-quit* +highlight-args ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-args* +highlight-changed ../../plugins/vimdoc-ja/doc/version4.jax /*highlight-changed* +highlight-cterm ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-cterm* +highlight-ctermbg ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-ctermbg* +highlight-ctermfg ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-ctermfg* +highlight-default ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-default* +highlight-font ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-font* +highlight-groups ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-groups* +highlight-gui ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-gui* +highlight-guibg ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-guibg* +highlight-guifg ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-guifg* +highlight-guisp ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-guisp* +highlight-start ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-start* +highlight-stop ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-stop* +highlight-term ../../plugins/vimdoc-ja/doc/syntax.jax /*highlight-term* +highlightID() ../../plugins/vimdoc-ja/doc/eval.jax /*highlightID()* +highlight_exists() ../../plugins/vimdoc-ja/doc/eval.jax /*highlight_exists()* +highlighting-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*highlighting-functions* +hist-names ../../plugins/vimdoc-ja/doc/eval.jax /*hist-names* +histadd() ../../plugins/vimdoc-ja/doc/eval.jax /*histadd()* +histdel() ../../plugins/vimdoc-ja/doc/eval.jax /*histdel()* +histget() ../../plugins/vimdoc-ja/doc/eval.jax /*histget()* +histnr() ../../plugins/vimdoc-ja/doc/eval.jax /*histnr()* +history ../../plugins/vimdoc-ja/doc/cmdline.jax /*history* +history-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*history-functions* +hit-enter ../../plugins/vimdoc-ja/doc/message.jax /*hit-enter* +hit-enter-prompt ../../plugins/vimdoc-ja/doc/message.jax /*hit-enter-prompt* +hit-return ../../plugins/vimdoc-ja/doc/message.jax /*hit-return* +hitest.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*hitest.vim* +hjkl ../../plugins/vimdoc-ja/doc/usr_02.jax /*hjkl* +hl-ColorColumn ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-ColorColumn* +hl-Conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Conceal* +hl-Cursor ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Cursor* +hl-CursorColumn ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-CursorColumn* +hl-CursorIM ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-CursorIM* +hl-CursorLine ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-CursorLine* +hl-CursorLineNr ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-CursorLineNr* +hl-DiffAdd ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-DiffAdd* +hl-DiffChange ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-DiffChange* +hl-DiffDelete ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-DiffDelete* +hl-DiffText ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-DiffText* +hl-Directory ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Directory* +hl-EndOfBuffer ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-EndOfBuffer* +hl-ErrorMsg ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-ErrorMsg* +hl-FoldColumn ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-FoldColumn* +hl-Folded ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Folded* +hl-Ignore ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Ignore* +hl-IncSearch ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-IncSearch* +hl-LineNr ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-LineNr* +hl-MatchParen ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-MatchParen* +hl-Menu ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Menu* +hl-ModeMsg ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-ModeMsg* +hl-MoreMsg ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-MoreMsg* +hl-NonText ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-NonText* +hl-Normal ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Normal* +hl-Pmenu ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Pmenu* +hl-PmenuSbar ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-PmenuSbar* +hl-PmenuSel ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-PmenuSel* +hl-PmenuThumb ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-PmenuThumb* +hl-Question ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Question* +hl-Scrollbar ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Scrollbar* +hl-Search ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Search* +hl-SignColumn ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SignColumn* +hl-SpecialKey ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SpecialKey* +hl-SpellBad ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SpellBad* +hl-SpellCap ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SpellCap* +hl-SpellLocal ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SpellLocal* +hl-SpellRare ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-SpellRare* +hl-StatusLine ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-StatusLine* +hl-StatusLineNC ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-StatusLineNC* +hl-TabLine ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-TabLine* +hl-TabLineFill ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-TabLineFill* +hl-TabLineSel ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-TabLineSel* +hl-Title ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Title* +hl-Tooltip ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Tooltip* +hl-User1 ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-User1* +hl-User1..9 ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-User1..9* +hl-User9 ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-User9* +hl-VertSplit ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-VertSplit* +hl-Visual ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-Visual* +hl-VisualNOS ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-VisualNOS* +hl-WarningMsg ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-WarningMsg* +hl-WildMenu ../../plugins/vimdoc-ja/doc/syntax.jax /*hl-WildMenu* +hlID() ../../plugins/vimdoc-ja/doc/eval.jax /*hlID()* +hlexists() ../../plugins/vimdoc-ja/doc/eval.jax /*hlexists()* +hlsearch-variable ../../plugins/vimdoc-ja/doc/eval.jax /*hlsearch-variable* +holy-grail ../../plugins/vimdoc-ja/doc/index.jax /*holy-grail* +home ../../plugins/vimdoc-ja/doc/intro.jax /*home* +home-replace ../../plugins/vimdoc-ja/doc/editing.jax /*home-replace* +hostname() ../../plugins/vimdoc-ja/doc/eval.jax /*hostname()* +how-do-i ../../plugins/vimdoc-ja/doc/howto.jax /*how-do-i* +how-to ../../plugins/vimdoc-ja/doc/howto.jax /*how-to* +howdoi ../../plugins/vimdoc-ja/doc/howto.jax /*howdoi* +howto ../../plugins/vimdoc-ja/doc/howto.jax /*howto* +howto.txt ../../plugins/vimdoc-ja/doc/howto.jax /*howto.txt* +hpterm ../../plugins/vimdoc-ja/doc/term.jax /*hpterm* +hpterm-color ../../plugins/vimdoc-ja/doc/syntax.jax /*hpterm-color* +html-flavor ../../plugins/vimdoc-ja/doc/insert.jax /*html-flavor* +html-indent ../../plugins/vimdoc-ja/doc/indent.jax /*html-indent* +html-indenting ../../plugins/vimdoc-ja/doc/indent.jax /*html-indenting* +html.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*html.vim* +htmlos.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*htmlos.vim* +http ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*http* +i ../../plugins/vimdoc-ja/doc/insert.jax /*i* +i' ../../plugins/vimdoc-ja/doc/motion.jax /*i'* +i( ../../plugins/vimdoc-ja/doc/motion.jax /*i(* +i) ../../plugins/vimdoc-ja/doc/motion.jax /*i)* +i< ../../plugins/vimdoc-ja/doc/motion.jax /*i<* +i> ../../plugins/vimdoc-ja/doc/motion.jax /*i>* +iB ../../plugins/vimdoc-ja/doc/motion.jax /*iB* +iBus ../../plugins/vimdoc-ja/doc/gui.jax /*iBus* +iW ../../plugins/vimdoc-ja/doc/motion.jax /*iW* +i[ ../../plugins/vimdoc-ja/doc/motion.jax /*i[* +i] ../../plugins/vimdoc-ja/doc/motion.jax /*i]* +i_0_CTRL-D ../../plugins/vimdoc-ja/doc/insert.jax /*i_0_CTRL-D* +i_<BS> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<BS>* +i_<C-End> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<C-End>* +i_<C-Home> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<C-Home>* +i_<C-Left> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<C-Left>* +i_<C-PageDown> ../../plugins/vimdoc-ja/doc/tabpage.jax /*i_<C-PageDown>* +i_<C-PageUp> ../../plugins/vimdoc-ja/doc/tabpage.jax /*i_<C-PageUp>* +i_<C-Right> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<C-Right>* +i_<CR> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<CR>* +i_<Del> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Del>* +i_<Down> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Down>* +i_<End> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<End>* +i_<Esc> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Esc>* +i_<F1> ../../plugins/vimdoc-ja/doc/helphelp.jax /*i_<F1>* +i_<Help> ../../plugins/vimdoc-ja/doc/helphelp.jax /*i_<Help>* +i_<Home> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Home>* +i_<Insert> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Insert>* +i_<Left> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Left>* +i_<LeftMouse> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<LeftMouse>* +i_<NL> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<NL>* +i_<PageDown> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<PageDown>* +i_<PageUp> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<PageUp>* +i_<Right> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Right>* +i_<S-Down> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-Down>* +i_<S-Left> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-Left>* +i_<S-Right> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-Right>* +i_<S-ScrollWheelDown> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-ScrollWheelDown>* +i_<S-ScrollWheelLeft> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-ScrollWheelLeft>* +i_<S-ScrollWheelRight> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-ScrollWheelRight>* +i_<S-ScrollWheelUp> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-ScrollWheelUp>* +i_<S-Up> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<S-Up>* +i_<ScrollWheelDown> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<ScrollWheelDown>* +i_<ScrollWheelLeft> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<ScrollWheelLeft>* +i_<ScrollWheelRight> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<ScrollWheelRight>* +i_<ScrollWheelUp> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<ScrollWheelUp>* +i_<Tab> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Tab>* +i_<Up> ../../plugins/vimdoc-ja/doc/insert.jax /*i_<Up>* +i_BS ../../plugins/vimdoc-ja/doc/insert.jax /*i_BS* +i_CTRL-<PageDown> ../../plugins/vimdoc-ja/doc/tabpage.jax /*i_CTRL-<PageDown>* +i_CTRL-<PageUp> ../../plugins/vimdoc-ja/doc/tabpage.jax /*i_CTRL-<PageUp>* +i_CTRL-@ ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-@* +i_CTRL-A ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-A* +i_CTRL-C ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-C* +i_CTRL-D ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-D* +i_CTRL-E ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-E* +i_CTRL-F ../../plugins/vimdoc-ja/doc/indent.jax /*i_CTRL-F* +i_CTRL-G_<Down> ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_<Down>* +i_CTRL-G_<Up> ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_<Up>* +i_CTRL-G_CTRL-J ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_CTRL-J* +i_CTRL-G_CTRL-K ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_CTRL-K* +i_CTRL-G_U ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_U* +i_CTRL-G_j ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_j* +i_CTRL-G_k ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_k* +i_CTRL-G_u ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-G_u* +i_CTRL-H ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-H* +i_CTRL-I ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-I* +i_CTRL-J ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-J* +i_CTRL-K ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-K* +i_CTRL-L ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-L* +i_CTRL-M ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-M* +i_CTRL-N ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-N* +i_CTRL-O ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-O* +i_CTRL-P ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-P* +i_CTRL-Q ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-Q* +i_CTRL-R ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-R* +i_CTRL-R_= ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-R_=* +i_CTRL-R_CTRL-O ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-R_CTRL-O* +i_CTRL-R_CTRL-P ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-R_CTRL-P* +i_CTRL-R_CTRL-R ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-R_CTRL-R* +i_CTRL-T ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-T* +i_CTRL-U ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-U* +i_CTRL-V ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-V* +i_CTRL-V_digit ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-V_digit* +i_CTRL-W ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-W* +i_CTRL-X ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X* +i_CTRL-X_CTRL-D ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-D* +i_CTRL-X_CTRL-E ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-E* +i_CTRL-X_CTRL-F ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-F* +i_CTRL-X_CTRL-I ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-I* +i_CTRL-X_CTRL-K ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-K* +i_CTRL-X_CTRL-L ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-L* +i_CTRL-X_CTRL-N ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-N* +i_CTRL-X_CTRL-O ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-O* +i_CTRL-X_CTRL-P ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-P* +i_CTRL-X_CTRL-S ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-S* +i_CTRL-X_CTRL-T ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-T* +i_CTRL-X_CTRL-U ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-U* +i_CTRL-X_CTRL-V ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-V* +i_CTRL-X_CTRL-Y ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-Y* +i_CTRL-X_CTRL-] ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_CTRL-]* +i_CTRL-X_index ../../plugins/vimdoc-ja/doc/index.jax /*i_CTRL-X_index* +i_CTRL-X_s ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-X_s* +i_CTRL-Y ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-Y* +i_CTRL-Z ../../plugins/vimdoc-ja/doc/options.jax /*i_CTRL-Z* +i_CTRL-[ ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-[* +i_CTRL-\_CTRL-G ../../plugins/vimdoc-ja/doc/intro.jax /*i_CTRL-\\_CTRL-G* +i_CTRL-\_CTRL-N ../../plugins/vimdoc-ja/doc/intro.jax /*i_CTRL-\\_CTRL-N* +i_CTRL-\_CTRL-O ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-\\_CTRL-O* +i_CTRL-] ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-]* +i_CTRL-^ ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-^* +i_CTRL-_ ../../plugins/vimdoc-ja/doc/insert.jax /*i_CTRL-_* +i_DEL ../../plugins/vimdoc-ja/doc/insert.jax /*i_DEL* +i_Tab ../../plugins/vimdoc-ja/doc/insert.jax /*i_Tab* +i_^_CTRL-D ../../plugins/vimdoc-ja/doc/insert.jax /*i_^_CTRL-D* +i_backspacing ../../plugins/vimdoc-ja/doc/insert.jax /*i_backspacing* +i_digraph ../../plugins/vimdoc-ja/doc/digraph.jax /*i_digraph* +i_esc ../../plugins/vimdoc-ja/doc/intro.jax /*i_esc* +i` ../../plugins/vimdoc-ja/doc/motion.jax /*i`* +ia64.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ia64.vim* +ib ../../plugins/vimdoc-ja/doc/motion.jax /*ib* +iccf ../../plugins/vimdoc-ja/doc/uganda.jax /*iccf* +iccf-donations ../../plugins/vimdoc-ja/doc/uganda.jax /*iccf-donations* +icon-changed ../../plugins/vimdoc-ja/doc/version4.jax /*icon-changed* +iconise ../../plugins/vimdoc-ja/doc/starting.jax /*iconise* +iconize ../../plugins/vimdoc-ja/doc/starting.jax /*iconize* +iconv() ../../plugins/vimdoc-ja/doc/eval.jax /*iconv()* +iconv-dynamic ../../plugins/vimdoc-ja/doc/mbyte.jax /*iconv-dynamic* +ident-search ../../plugins/vimdoc-ja/doc/tips.jax /*ident-search* +idl-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*idl-syntax* +idl.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*idl.vim* +if_cscop.txt ../../plugins/vimdoc-ja/doc/if_cscop.jax /*if_cscop.txt* +if_lua.txt ../../plugins/vimdoc-ja/doc/if_lua.jax /*if_lua.txt* +if_mzsch.txt ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*if_mzsch.txt* +if_ole.txt ../../plugins/vimdoc-ja/doc/if_ole.jax /*if_ole.txt* +if_perl.txt ../../plugins/vimdoc-ja/doc/if_perl.jax /*if_perl.txt* +if_pyth.txt ../../plugins/vimdoc-ja/doc/if_pyth.jax /*if_pyth.txt* +if_ruby.txt ../../plugins/vimdoc-ja/doc/if_ruby.jax /*if_ruby.txt* +if_sniff.txt ../../plugins/vimdoc-ja/doc/if_sniff.jax /*if_sniff.txt* +if_tcl.txt ../../plugins/vimdoc-ja/doc/if_tcl.jax /*if_tcl.txt* +ignore-errors ../../plugins/vimdoc-ja/doc/eval.jax /*ignore-errors* +in_bot ../../plugins/vimdoc-ja/doc/channel.jax /*in_bot* +in_buf ../../plugins/vimdoc-ja/doc/channel.jax /*in_buf* +in_io-buffer ../../plugins/vimdoc-ja/doc/channel.jax /*in_io-buffer* +in_mode ../../plugins/vimdoc-ja/doc/channel.jax /*in_mode* +in_name ../../plugins/vimdoc-ja/doc/channel.jax /*in_name* +in_top ../../plugins/vimdoc-ja/doc/channel.jax /*in_top* +inactive-buffer ../../plugins/vimdoc-ja/doc/windows.jax /*inactive-buffer* +include-search ../../plugins/vimdoc-ja/doc/tagsrch.jax /*include-search* +inclusive ../../plugins/vimdoc-ja/doc/motion.jax /*inclusive* +indent() ../../plugins/vimdoc-ja/doc/eval.jax /*indent()* +indent-expression ../../plugins/vimdoc-ja/doc/indent.jax /*indent-expression* +indent.txt ../../plugins/vimdoc-ja/doc/indent.jax /*indent.txt* +indentkeys-format ../../plugins/vimdoc-ja/doc/indent.jax /*indentkeys-format* +index ../../plugins/vimdoc-ja/doc/index.jax /*index* +index() ../../plugins/vimdoc-ja/doc/eval.jax /*index()* +index.txt ../../plugins/vimdoc-ja/doc/index.jax /*index.txt* +info-message ../../plugins/vimdoc-ja/doc/starting.jax /*info-message* +inform.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*inform.vim* +informix ../../plugins/vimdoc-ja/doc/ft_sql.jax /*informix* +initialization ../../plugins/vimdoc-ja/doc/starting.jax /*initialization* +input() ../../plugins/vimdoc-ja/doc/eval.jax /*input()* +inputdialog() ../../plugins/vimdoc-ja/doc/eval.jax /*inputdialog()* +inputlist() ../../plugins/vimdoc-ja/doc/eval.jax /*inputlist()* +inputrestore() ../../plugins/vimdoc-ja/doc/eval.jax /*inputrestore()* +inputsave() ../../plugins/vimdoc-ja/doc/eval.jax /*inputsave()* +inputsecret() ../../plugins/vimdoc-ja/doc/eval.jax /*inputsecret()* +ins-completion ../../plugins/vimdoc-ja/doc/insert.jax /*ins-completion* +ins-completion-menu ../../plugins/vimdoc-ja/doc/insert.jax /*ins-completion-menu* +ins-expandtab ../../plugins/vimdoc-ja/doc/insert.jax /*ins-expandtab* +ins-reverse ../../plugins/vimdoc-ja/doc/rileft.jax /*ins-reverse* +ins-smarttab ../../plugins/vimdoc-ja/doc/insert.jax /*ins-smarttab* +ins-softtabstop ../../plugins/vimdoc-ja/doc/insert.jax /*ins-softtabstop* +ins-special-keys ../../plugins/vimdoc-ja/doc/insert.jax /*ins-special-keys* +ins-special-special ../../plugins/vimdoc-ja/doc/insert.jax /*ins-special-special* +ins-textwidth ../../plugins/vimdoc-ja/doc/insert.jax /*ins-textwidth* +insert ../../plugins/vimdoc-ja/doc/insert.jax /*insert* +insert() ../../plugins/vimdoc-ja/doc/eval.jax /*insert()* +insert-index ../../plugins/vimdoc-ja/doc/index.jax /*insert-index* +insert.txt ../../plugins/vimdoc-ja/doc/insert.jax /*insert.txt* +insert_expand ../../plugins/vimdoc-ja/doc/insert.jax /*insert_expand* +inserting ../../plugins/vimdoc-ja/doc/insert.jax /*inserting* +inserting-ex ../../plugins/vimdoc-ja/doc/insert.jax /*inserting-ex* +inserting-file ../../plugins/vimdoc-ja/doc/insert.jax /*inserting-file* +insertmode-variable ../../plugins/vimdoc-ja/doc/eval.jax /*insertmode-variable* +install ../../plugins/vimdoc-ja/doc/usr_90.jax /*install* +install-home ../../plugins/vimdoc-ja/doc/usr_90.jax /*install-home* +install-registry ../../plugins/vimdoc-ja/doc/gui_w32.jax /*install-registry* +intel-itanium ../../plugins/vimdoc-ja/doc/syntax.jax /*intel-itanium* +intellimouse-wheel-problems ../../plugins/vimdoc-ja/doc/gui_w32.jax /*intellimouse-wheel-problems* +interactive-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*interactive-functions* +internal-variables ../../plugins/vimdoc-ja/doc/eval.jax /*internal-variables* +internal-wordlist ../../plugins/vimdoc-ja/doc/spell.jax /*internal-wordlist* +internet ../../plugins/vimdoc-ja/doc/intro.jax /*internet* +intro ../../plugins/vimdoc-ja/doc/intro.jax /*intro* +intro.txt ../../plugins/vimdoc-ja/doc/intro.jax /*intro.txt* +inverse ../../plugins/vimdoc-ja/doc/syntax.jax /*inverse* +invert() ../../plugins/vimdoc-ja/doc/eval.jax /*invert()* +ip ../../plugins/vimdoc-ja/doc/motion.jax /*ip* +iquote ../../plugins/vimdoc-ja/doc/motion.jax /*iquote* +is ../../plugins/vimdoc-ja/doc/motion.jax /*is* +isdirectory() ../../plugins/vimdoc-ja/doc/eval.jax /*isdirectory()* +islocked() ../../plugins/vimdoc-ja/doc/eval.jax /*islocked()* +isnan() ../../plugins/vimdoc-ja/doc/eval.jax /*isnan()* +it ../../plugins/vimdoc-ja/doc/motion.jax /*it* +italic ../../plugins/vimdoc-ja/doc/syntax.jax /*italic* +items() ../../plugins/vimdoc-ja/doc/eval.jax /*items()* +iw ../../plugins/vimdoc-ja/doc/motion.jax /*iw* +i{ ../../plugins/vimdoc-ja/doc/motion.jax /*i{* +i} ../../plugins/vimdoc-ja/doc/motion.jax /*i}* +j ../../plugins/vimdoc-ja/doc/motion.jax /*j* +java-cinoptions ../../plugins/vimdoc-ja/doc/indent.jax /*java-cinoptions* +java-indenting ../../plugins/vimdoc-ja/doc/indent.jax /*java-indenting* +java.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*java.vim* +javascript-cinoptions ../../plugins/vimdoc-ja/doc/indent.jax /*javascript-cinoptions* +javascript-indenting ../../plugins/vimdoc-ja/doc/indent.jax /*javascript-indenting* +job ../../plugins/vimdoc-ja/doc/channel.jax /*job* +job-callback ../../plugins/vimdoc-ja/doc/channel.jax /*job-callback* +job-channel-overview ../../plugins/vimdoc-ja/doc/channel.jax /*job-channel-overview* +job-close_cb ../../plugins/vimdoc-ja/doc/channel.jax /*job-close_cb* +job-control ../../plugins/vimdoc-ja/doc/channel.jax /*job-control* +job-err_cb ../../plugins/vimdoc-ja/doc/channel.jax /*job-err_cb* +job-err_io ../../plugins/vimdoc-ja/doc/channel.jax /*job-err_io* +job-exit_cb ../../plugins/vimdoc-ja/doc/channel.jax /*job-exit_cb* +job-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*job-functions* +job-in_io ../../plugins/vimdoc-ja/doc/channel.jax /*job-in_io* +job-options ../../plugins/vimdoc-ja/doc/channel.jax /*job-options* +job-out_cb ../../plugins/vimdoc-ja/doc/channel.jax /*job-out_cb* +job-out_io ../../plugins/vimdoc-ja/doc/channel.jax /*job-out_io* +job-start ../../plugins/vimdoc-ja/doc/channel.jax /*job-start* +job-start-if-needed ../../plugins/vimdoc-ja/doc/channel.jax /*job-start-if-needed* +job-start-nochannel ../../plugins/vimdoc-ja/doc/channel.jax /*job-start-nochannel* +job-stoponexit ../../plugins/vimdoc-ja/doc/channel.jax /*job-stoponexit* +job-term ../../plugins/vimdoc-ja/doc/channel.jax /*job-term* +job-timeout ../../plugins/vimdoc-ja/doc/channel.jax /*job-timeout* +job_getchannel() ../../plugins/vimdoc-ja/doc/eval.jax /*job_getchannel()* +job_info() ../../plugins/vimdoc-ja/doc/eval.jax /*job_info()* +job_setoptions() ../../plugins/vimdoc-ja/doc/eval.jax /*job_setoptions()* +job_start() ../../plugins/vimdoc-ja/doc/eval.jax /*job_start()* +job_status() ../../plugins/vimdoc-ja/doc/eval.jax /*job_status()* +job_stop() ../../plugins/vimdoc-ja/doc/eval.jax /*job_stop()* +join() ../../plugins/vimdoc-ja/doc/eval.jax /*join()* +js_decode() ../../plugins/vimdoc-ja/doc/eval.jax /*js_decode()* +js_encode() ../../plugins/vimdoc-ja/doc/eval.jax /*js_encode()* +jsbterm-mouse ../../plugins/vimdoc-ja/doc/options.jax /*jsbterm-mouse* +json_decode() ../../plugins/vimdoc-ja/doc/eval.jax /*json_decode()* +json_encode() ../../plugins/vimdoc-ja/doc/eval.jax /*json_encode()* +jtags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*jtags* +jump-motions ../../plugins/vimdoc-ja/doc/motion.jax /*jump-motions* +jumplist ../../plugins/vimdoc-ja/doc/motion.jax /*jumplist* +jumpto-diffs ../../plugins/vimdoc-ja/doc/diff.jax /*jumpto-diffs* +k ../../plugins/vimdoc-ja/doc/motion.jax /*k* +kcc ../../plugins/vimdoc-ja/doc/uganda.jax /*kcc* +kde ../../plugins/vimdoc-ja/doc/gui_x11.jax /*kde* +key-codes ../../plugins/vimdoc-ja/doc/intro.jax /*key-codes* +key-codes-changed ../../plugins/vimdoc-ja/doc/version4.jax /*key-codes-changed* +key-mapping ../../plugins/vimdoc-ja/doc/map.jax /*key-mapping* +key-notation ../../plugins/vimdoc-ja/doc/intro.jax /*key-notation* +key-variable ../../plugins/vimdoc-ja/doc/eval.jax /*key-variable* +keycodes ../../plugins/vimdoc-ja/doc/intro.jax /*keycodes* +keymap-accents ../../plugins/vimdoc-ja/doc/mbyte.jax /*keymap-accents* +keymap-file-format ../../plugins/vimdoc-ja/doc/mbyte.jax /*keymap-file-format* +keymap-hebrew ../../plugins/vimdoc-ja/doc/mbyte.jax /*keymap-hebrew* +keypad-0 ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-0* +keypad-9 ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-9* +keypad-comma ../../plugins/vimdoc-ja/doc/term.jax /*keypad-comma* +keypad-divide ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-divide* +keypad-end ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-end* +keypad-enter ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-enter* +keypad-home ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-home* +keypad-minus ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-minus* +keypad-multiply ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-multiply* +keypad-page-down ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-page-down* +keypad-page-up ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-page-up* +keypad-plus ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-plus* +keypad-point ../../plugins/vimdoc-ja/doc/intro.jax /*keypad-point* +keys() ../../plugins/vimdoc-ja/doc/eval.jax /*keys()* +l ../../plugins/vimdoc-ja/doc/motion.jax /*l* +l: ../../plugins/vimdoc-ja/doc/eval.jax /*l:* +l:var ../../plugins/vimdoc-ja/doc/eval.jax /*l:var* +lCursor ../../plugins/vimdoc-ja/doc/mbyte.jax /*lCursor* +lace.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lace.vim* +lambda ../../plugins/vimdoc-ja/doc/eval.jax /*lambda* +lang-variable ../../plugins/vimdoc-ja/doc/eval.jax /*lang-variable* +language-mapping ../../plugins/vimdoc-ja/doc/map.jax /*language-mapping* +last-pattern ../../plugins/vimdoc-ja/doc/pattern.jax /*last-pattern* +last-position-jump ../../plugins/vimdoc-ja/doc/eval.jax /*last-position-jump* +last_buffer_nr() ../../plugins/vimdoc-ja/doc/eval.jax /*last_buffer_nr()* +latex-syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*latex-syntax* +lc_time-variable ../../plugins/vimdoc-ja/doc/eval.jax /*lc_time-variable* +lcs-conceal ../../plugins/vimdoc-ja/doc/options.jax /*lcs-conceal* +lcs-eol ../../plugins/vimdoc-ja/doc/options.jax /*lcs-eol* +lcs-extends ../../plugins/vimdoc-ja/doc/options.jax /*lcs-extends* +lcs-nbsp ../../plugins/vimdoc-ja/doc/options.jax /*lcs-nbsp* +lcs-precedes ../../plugins/vimdoc-ja/doc/options.jax /*lcs-precedes* +lcs-space ../../plugins/vimdoc-ja/doc/options.jax /*lcs-space* +lcs-tab ../../plugins/vimdoc-ja/doc/options.jax /*lcs-tab* +lcs-trail ../../plugins/vimdoc-ja/doc/options.jax /*lcs-trail* +left-right-motions ../../plugins/vimdoc-ja/doc/motion.jax /*left-right-motions* +len() ../../plugins/vimdoc-ja/doc/eval.jax /*len()* +less ../../plugins/vimdoc-ja/doc/various.jax /*less* +letter ../../plugins/vimdoc-ja/doc/print.jax /*letter* +lex.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lex.vim* +lhaskell.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lhaskell.vim* +libcall() ../../plugins/vimdoc-ja/doc/eval.jax /*libcall()* +libcallnr() ../../plugins/vimdoc-ja/doc/eval.jax /*libcallnr()* +license ../../plugins/vimdoc-ja/doc/uganda.jax /*license* +lid ../../plugins/vimdoc-ja/doc/quickfix.jax /*lid* +lifelines.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lifelines.vim* +limits ../../plugins/vimdoc-ja/doc/vi_diff.jax /*limits* +line() ../../plugins/vimdoc-ja/doc/eval.jax /*line()* +line-continuation ../../plugins/vimdoc-ja/doc/repeat.jax /*line-continuation* +line2byte() ../../plugins/vimdoc-ja/doc/eval.jax /*line2byte()* +linefeed ../../plugins/vimdoc-ja/doc/intro.jax /*linefeed* +linewise ../../plugins/vimdoc-ja/doc/motion.jax /*linewise* +linewise-register ../../plugins/vimdoc-ja/doc/change.jax /*linewise-register* +linewise-visual ../../plugins/vimdoc-ja/doc/visual.jax /*linewise-visual* +lisp.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lisp.vim* +lispindent() ../../plugins/vimdoc-ja/doc/eval.jax /*lispindent()* +list ../../plugins/vimdoc-ja/doc/eval.jax /*list* +list-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*list-functions* +list-identity ../../plugins/vimdoc-ja/doc/eval.jax /*list-identity* +list-index ../../plugins/vimdoc-ja/doc/eval.jax /*list-index* +list-modification ../../plugins/vimdoc-ja/doc/eval.jax /*list-modification* +list-repeat ../../plugins/vimdoc-ja/doc/windows.jax /*list-repeat* +lite.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lite.vim* +literal-string ../../plugins/vimdoc-ja/doc/eval.jax /*literal-string* +lnum-variable ../../plugins/vimdoc-ja/doc/eval.jax /*lnum-variable* +load-plugins ../../plugins/vimdoc-ja/doc/starting.jax /*load-plugins* +load-vim-script ../../plugins/vimdoc-ja/doc/repeat.jax /*load-vim-script* +local-additions ../../plugins/vimdoc-ja/doc/help.jax /*local-additions* +local-function ../../plugins/vimdoc-ja/doc/eval.jax /*local-function* +local-options ../../plugins/vimdoc-ja/doc/options.jax /*local-options* +local-variable ../../plugins/vimdoc-ja/doc/eval.jax /*local-variable* +local-variables ../../plugins/vimdoc-ja/doc/eval.jax /*local-variables* +local_markfilelist ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*local_markfilelist* +locale ../../plugins/vimdoc-ja/doc/mbyte.jax /*locale* +locale-name ../../plugins/vimdoc-ja/doc/mbyte.jax /*locale-name* +localtime() ../../plugins/vimdoc-ja/doc/eval.jax /*localtime()* +location-list ../../plugins/vimdoc-ja/doc/quickfix.jax /*location-list* +location-list-window ../../plugins/vimdoc-ja/doc/quickfix.jax /*location-list-window* +log() ../../plugins/vimdoc-ja/doc/eval.jax /*log()* +log10() ../../plugins/vimdoc-ja/doc/eval.jax /*log10()* +logiPat ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat* +logiPat-arg ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-arg* +logiPat-caveat ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-caveat* +logiPat-contents ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-contents* +logiPat-copyright ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-copyright* +logiPat-examples ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-examples* +logiPat-history ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-history* +logiPat-input ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-input* +logiPat-man ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-man* +logiPat-manual ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-manual* +logiPat-operators ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-operators* +logiPat-pattern ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat-pattern* +logiPat.txt ../../plugins/vimdoc-ja/doc/pi_logipat.jax /*logiPat.txt* +love ../../plugins/vimdoc-ja/doc/intro.jax /*love* +lowercase ../../plugins/vimdoc-ja/doc/change.jax /*lowercase* +lpc.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lpc.vim* +lua ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua* +lua-buffer ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-buffer* +lua-commands ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-commands* +lua-dict ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-dict* +lua-dynamic ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-dynamic* +lua-eval ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-eval* +lua-funcref ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-funcref* +lua-list ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-list* +lua-luaeval ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-luaeval* +lua-vim ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-vim* +lua-window ../../plugins/vimdoc-ja/doc/if_lua.jax /*lua-window* +lua.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*lua.vim* +luaeval() ../../plugins/vimdoc-ja/doc/eval.jax /*luaeval()* +m ../../plugins/vimdoc-ja/doc/motion.jax /*m* +m' ../../plugins/vimdoc-ja/doc/motion.jax /*m'* +m< ../../plugins/vimdoc-ja/doc/motion.jax /*m<* +m> ../../plugins/vimdoc-ja/doc/motion.jax /*m>* +m[ ../../plugins/vimdoc-ja/doc/motion.jax /*m[* +m] ../../plugins/vimdoc-ja/doc/motion.jax /*m]* +m` ../../plugins/vimdoc-ja/doc/motion.jax /*m`* +mac ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac* +mac-bug ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-bug* +mac-compile ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-compile* +mac-faq ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-faq* +mac-filename ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-filename* +mac-lack ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-lack* +mac-vimfile ../../plugins/vimdoc-ja/doc/os_mac.jax /*mac-vimfile* +macintosh ../../plugins/vimdoc-ja/doc/os_mac.jax /*macintosh* +macro ../../plugins/vimdoc-ja/doc/map.jax /*macro* +mail-list ../../plugins/vimdoc-ja/doc/intro.jax /*mail-list* +mail.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*mail.vim* +maillist ../../plugins/vimdoc-ja/doc/intro.jax /*maillist* +maillist-archive ../../plugins/vimdoc-ja/doc/intro.jax /*maillist-archive* +make.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*make.vim* +man.vim ../../plugins/vimdoc-ja/doc/filetype.jax /*man.vim* +manpager.vim ../../plugins/vimdoc-ja/doc/filetype.jax /*manpager.vim* +manual-copyright ../../plugins/vimdoc-ja/doc/usr_01.jax /*manual-copyright* +map() ../../plugins/vimdoc-ja/doc/eval.jax /*map()* +map-<SID> ../../plugins/vimdoc-ja/doc/map.jax /*map-<SID>* +map-CTRL-C ../../plugins/vimdoc-ja/doc/map.jax /*map-CTRL-C* +map-ambiguous ../../plugins/vimdoc-ja/doc/map.jax /*map-ambiguous* +map-backslash ../../plugins/vimdoc-ja/doc/map.jax /*map-backslash* +map-backtick ../../plugins/vimdoc-ja/doc/tips.jax /*map-backtick* +map-bar ../../plugins/vimdoc-ja/doc/map.jax /*map-bar* +map-comments ../../plugins/vimdoc-ja/doc/map.jax /*map-comments* +map-empty-rhs ../../plugins/vimdoc-ja/doc/map.jax /*map-empty-rhs* +map-error ../../plugins/vimdoc-ja/doc/map.jax /*map-error* +map-examples ../../plugins/vimdoc-ja/doc/map.jax /*map-examples* +map-keys-fails ../../plugins/vimdoc-ja/doc/map.jax /*map-keys-fails* +map-listing ../../plugins/vimdoc-ja/doc/map.jax /*map-listing* +map-modes ../../plugins/vimdoc-ja/doc/map.jax /*map-modes* +map-multibyte ../../plugins/vimdoc-ja/doc/map.jax /*map-multibyte* +map-overview ../../plugins/vimdoc-ja/doc/map.jax /*map-overview* +map-precedence ../../plugins/vimdoc-ja/doc/map.jax /*map-precedence* +map-return ../../plugins/vimdoc-ja/doc/map.jax /*map-return* +map-self-destroy ../../plugins/vimdoc-ja/doc/tips.jax /*map-self-destroy* +map-space_in_lhs ../../plugins/vimdoc-ja/doc/map.jax /*map-space_in_lhs* +map-space_in_rhs ../../plugins/vimdoc-ja/doc/map.jax /*map-space_in_rhs* +map-typing ../../plugins/vimdoc-ja/doc/map.jax /*map-typing* +map-which-keys ../../plugins/vimdoc-ja/doc/map.jax /*map-which-keys* +map.txt ../../plugins/vimdoc-ja/doc/map.jax /*map.txt* +map_CTRL-C ../../plugins/vimdoc-ja/doc/map.jax /*map_CTRL-C* +map_backslash ../../plugins/vimdoc-ja/doc/map.jax /*map_backslash* +map_bar ../../plugins/vimdoc-ja/doc/map.jax /*map_bar* +map_empty_rhs ../../plugins/vimdoc-ja/doc/map.jax /*map_empty_rhs* +map_return ../../plugins/vimdoc-ja/doc/map.jax /*map_return* +map_space_in_lhs ../../plugins/vimdoc-ja/doc/map.jax /*map_space_in_lhs* +map_space_in_rhs ../../plugins/vimdoc-ja/doc/map.jax /*map_space_in_rhs* +maparg() ../../plugins/vimdoc-ja/doc/eval.jax /*maparg()* +mapcheck() ../../plugins/vimdoc-ja/doc/eval.jax /*mapcheck()* +maple.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*maple.vim* +mapleader ../../plugins/vimdoc-ja/doc/map.jax /*mapleader* +maplocalleader ../../plugins/vimdoc-ja/doc/map.jax /*maplocalleader* +mapmode-c ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-c* +mapmode-i ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-i* +mapmode-ic ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-ic* +mapmode-l ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-l* +mapmode-n ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-n* +mapmode-nvo ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-nvo* +mapmode-o ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-o* +mapmode-s ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-s* +mapmode-v ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-v* +mapmode-x ../../plugins/vimdoc-ja/doc/map.jax /*mapmode-x* +mapping ../../plugins/vimdoc-ja/doc/map.jax /*mapping* +mapping-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*mapping-functions* +mark ../../plugins/vimdoc-ja/doc/motion.jax /*mark* +mark-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*mark-functions* +mark-motions ../../plugins/vimdoc-ja/doc/motion.jax /*mark-motions* +markfilelist ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*markfilelist* +masm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*masm.vim* +match() ../../plugins/vimdoc-ja/doc/eval.jax /*match()* +match-highlight ../../plugins/vimdoc-ja/doc/pattern.jax /*match-highlight* +match-parens ../../plugins/vimdoc-ja/doc/tips.jax /*match-parens* +matchadd() ../../plugins/vimdoc-ja/doc/eval.jax /*matchadd()* +matchaddpos() ../../plugins/vimdoc-ja/doc/eval.jax /*matchaddpos()* +matcharg() ../../plugins/vimdoc-ja/doc/eval.jax /*matcharg()* +matchdelete() ../../plugins/vimdoc-ja/doc/eval.jax /*matchdelete()* +matchend() ../../plugins/vimdoc-ja/doc/eval.jax /*matchend()* +matchit-install ../../plugins/vimdoc-ja/doc/usr_05.jax /*matchit-install* +matchlist() ../../plugins/vimdoc-ja/doc/eval.jax /*matchlist()* +matchparen ../../plugins/vimdoc-ja/doc/pi_paren.jax /*matchparen* +matchstr() ../../plugins/vimdoc-ja/doc/eval.jax /*matchstr()* +matchstrpos() ../../plugins/vimdoc-ja/doc/eval.jax /*matchstrpos()* +max() ../../plugins/vimdoc-ja/doc/eval.jax /*max()* +mbyte-IME ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-IME* +mbyte-XIM ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-XIM* +mbyte-combining ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-combining* +mbyte-composing ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-composing* +mbyte-conversion ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-conversion* +mbyte-encoding ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-encoding* +mbyte-first ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-first* +mbyte-fonts-MSwin ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-fonts-MSwin* +mbyte-fonts-X11 ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-fonts-X11* +mbyte-keymap ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-keymap* +mbyte-locale ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-locale* +mbyte-options ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-options* +mbyte-terminal ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-terminal* +mbyte-utf8 ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte-utf8* +mbyte.txt ../../plugins/vimdoc-ja/doc/mbyte.jax /*mbyte.txt* +menu-examples ../../plugins/vimdoc-ja/doc/gui.jax /*menu-examples* +menu-priority ../../plugins/vimdoc-ja/doc/gui.jax /*menu-priority* +menu-separator ../../plugins/vimdoc-ja/doc/gui.jax /*menu-separator* +menu.vim ../../plugins/vimdoc-ja/doc/gui.jax /*menu.vim* +menus ../../plugins/vimdoc-ja/doc/gui.jax /*menus* +merge ../../plugins/vimdoc-ja/doc/diff.jax /*merge* +message-history ../../plugins/vimdoc-ja/doc/message.jax /*message-history* +message.txt ../../plugins/vimdoc-ja/doc/message.jax /*message.txt* +messages ../../plugins/vimdoc-ja/doc/message.jax /*messages* +meta ../../plugins/vimdoc-ja/doc/intro.jax /*meta* +min() ../../plugins/vimdoc-ja/doc/eval.jax /*min()* +missing-options ../../plugins/vimdoc-ja/doc/vi_diff.jax /*missing-options* +mkdir() ../../plugins/vimdoc-ja/doc/eval.jax /*mkdir()* +mlang.txt ../../plugins/vimdoc-ja/doc/mlang.jax /*mlang.txt* +mma.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*mma.vim* +mode() ../../plugins/vimdoc-ja/doc/eval.jax /*mode()* +mode-Ex ../../plugins/vimdoc-ja/doc/intro.jax /*mode-Ex* +mode-cmdline ../../plugins/vimdoc-ja/doc/cmdline.jax /*mode-cmdline* +mode-ins-repl ../../plugins/vimdoc-ja/doc/insert.jax /*mode-ins-repl* +mode-replace ../../plugins/vimdoc-ja/doc/insert.jax /*mode-replace* +mode-switching ../../plugins/vimdoc-ja/doc/intro.jax /*mode-switching* +modeless-selection ../../plugins/vimdoc-ja/doc/gui.jax /*modeless-selection* +modeline ../../plugins/vimdoc-ja/doc/options.jax /*modeline* +modeline-local ../../plugins/vimdoc-ja/doc/options.jax /*modeline-local* +modeline-version ../../plugins/vimdoc-ja/doc/options.jax /*modeline-version* +moo.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*moo.vim* +more-prompt ../../plugins/vimdoc-ja/doc/message.jax /*more-prompt* +more-variables ../../plugins/vimdoc-ja/doc/eval.jax /*more-variables* +motion.txt ../../plugins/vimdoc-ja/doc/motion.jax /*motion.txt* +mouse-mode-table ../../plugins/vimdoc-ja/doc/term.jax /*mouse-mode-table* +mouse-overview ../../plugins/vimdoc-ja/doc/term.jax /*mouse-overview* +mouse-swap-buttons ../../plugins/vimdoc-ja/doc/term.jax /*mouse-swap-buttons* +mouse-using ../../plugins/vimdoc-ja/doc/term.jax /*mouse-using* +mouse_col-variable ../../plugins/vimdoc-ja/doc/eval.jax /*mouse_col-variable* +mouse_lnum-variable ../../plugins/vimdoc-ja/doc/eval.jax /*mouse_lnum-variable* +mouse_win-variable ../../plugins/vimdoc-ja/doc/eval.jax /*mouse_win-variable* +mouse_winid-variable ../../plugins/vimdoc-ja/doc/eval.jax /*mouse_winid-variable* +movement ../../plugins/vimdoc-ja/doc/intro.jax /*movement* +ms-dos ../../plugins/vimdoc-ja/doc/os_msdos.jax /*ms-dos* +msdos ../../plugins/vimdoc-ja/doc/os_msdos.jax /*msdos* +msdos-mode ../../plugins/vimdoc-ja/doc/gui_w32.jax /*msdos-mode* +msql.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*msql.vim* +mswin.vim ../../plugins/vimdoc-ja/doc/gui_w32.jax /*mswin.vim* +multi-byte ../../plugins/vimdoc-ja/doc/mbyte.jax /*multi-byte* +multi-lang ../../plugins/vimdoc-ja/doc/mlang.jax /*multi-lang* +multi-repeat ../../plugins/vimdoc-ja/doc/repeat.jax /*multi-repeat* +multibyte ../../plugins/vimdoc-ja/doc/mbyte.jax /*multibyte* +multibyte-ime ../../plugins/vimdoc-ja/doc/mbyte.jax /*multibyte-ime* +multibyte-input ../../plugins/vimdoc-ja/doc/mbyte.jax /*multibyte-input* +multilang ../../plugins/vimdoc-ja/doc/mlang.jax /*multilang* +multilang-menus ../../plugins/vimdoc-ja/doc/mlang.jax /*multilang-menus* +multilang-messages ../../plugins/vimdoc-ja/doc/mlang.jax /*multilang-messages* +multilang-scripts ../../plugins/vimdoc-ja/doc/mlang.jax /*multilang-scripts* +myfiletypefile ../../plugins/vimdoc-ja/doc/syntax.jax /*myfiletypefile* +myscriptsfile ../../plugins/vimdoc-ja/doc/syntax.jax /*myscriptsfile* +mysql ../../plugins/vimdoc-ja/doc/ft_sql.jax /*mysql* +mysyntaxfile ../../plugins/vimdoc-ja/doc/syntax.jax /*mysyntaxfile* +mysyntaxfile-add ../../plugins/vimdoc-ja/doc/syntax.jax /*mysyntaxfile-add* +mysyntaxfile-replace ../../plugins/vimdoc-ja/doc/syntax.jax /*mysyntaxfile-replace* +mzeval() ../../plugins/vimdoc-ja/doc/eval.jax /*mzeval()* +mzscheme ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme* +mzscheme-buffer ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-buffer* +mzscheme-commands ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-commands* +mzscheme-dynamic ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-dynamic* +mzscheme-examples ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-examples* +mzscheme-funcref ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-funcref* +mzscheme-mzeval ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-mzeval* +mzscheme-sandbox ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-sandbox* +mzscheme-setup ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-setup* +mzscheme-threads ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-threads* +mzscheme-vim ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-vim* +mzscheme-vimext ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-vimext* +mzscheme-window ../../plugins/vimdoc-ja/doc/if_mzsch.jax /*mzscheme-window* +n ../../plugins/vimdoc-ja/doc/pattern.jax /*n* +nasm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*nasm.vim* +navigation ../../plugins/vimdoc-ja/doc/motion.jax /*navigation* +nb-commands ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-commands* +nb-events ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-events* +nb-functions ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-functions* +nb-messages ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-messages* +nb-protocol_errors ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-protocol_errors* +nb-special ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-special* +nb-terms ../../plugins/vimdoc-ja/doc/netbeans.jax /*nb-terms* +ncf.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ncf.vim* +netbeans ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans* +netbeans-commands ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-commands* +netbeans-configure ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-configure* +netbeans-debugging ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-debugging* +netbeans-download ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-download* +netbeans-integration ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-integration* +netbeans-intro ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-intro* +netbeans-keybindings ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-keybindings* +netbeans-messages ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-messages* +netbeans-parameters ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-parameters* +netbeans-preparation ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-preparation* +netbeans-problems ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-problems* +netbeans-protocol ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-protocol* +netbeans-run ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-run* +netbeans-setup ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-setup* +netbeans-support ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans-support* +netbeans.txt ../../plugins/vimdoc-ja/doc/netbeans.jax /*netbeans.txt* +netreadfixup ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netreadfixup* +netrw-% ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-%* +netrw-- ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw--* +netrw-:Explore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Explore* +netrw-:Hexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Hexplore* +netrw-:Lexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Lexplore* +netrw-:MF ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:MF* +netrw-:MT ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:MT* +netrw-:NetrwC ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:NetrwC* +netrw-:NetrwMB ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:NetrwMB* +netrw-:Rexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Rexplore* +netrw-:Sexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Sexplore* +netrw-:Texplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Texplore* +netrw-:Vexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-:Vexplore* +netrw-C ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-C* +netrw-D ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-D* +netrw-I ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-I* +netrw-O ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-O* +netrw-P ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P* +netrw-P18 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P18* +netrw-P19 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P19* +netrw-P20 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P20* +netrw-P21 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P21* +netrw-P22 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-P22* +netrw-R ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-R* +netrw-S ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-S* +netrw-Tb ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-Tb* +netrw-Th ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-Th* +netrw-U ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-U* +netrw-X ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-X* +netrw-a ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-a* +netrw-activate ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-activate* +netrw-bookmark ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-bookmark* +netrw-bookmarks ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-bookmarks* +netrw-browse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browse* +netrw-browse-cmds ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browse-cmds* +netrw-browse-maps ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browse-maps* +netrw-browser ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browser* +netrw-browser-options ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browser-options* +netrw-browser-settings ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browser-settings* +netrw-browser-var ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browser-var* +netrw-browsing ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-browsing* +netrw-c ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-c* +netrw-c-tab ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-c-tab* +netrw-cadaver ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-cadaver* +netrw-chgup ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-chgup* +netrw-clean ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-clean* +netrw-contents ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-contents* +netrw-copyright ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-copyright* +netrw-cr ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-cr* +netrw-createfile ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-createfile* +netrw-credits ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-credits* +netrw-ctrl-h ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ctrl-h* +netrw-ctrl-l ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ctrl-l* +netrw-ctrl-r ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ctrl-r* +netrw-ctrl_l ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ctrl_l* +netrw-curdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-curdir* +netrw-d ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-d* +netrw-debug ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-debug* +netrw-del ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-del* +netrw-delete ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-delete* +netrw-dir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-dir* +netrw-dirlist ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-dirlist* +netrw-downdir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-downdir* +netrw-edithide ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-edithide* +netrw-editwindow ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-editwindow* +netrw-enter ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-enter* +netrw-ex ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ex* +netrw-explore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-explore* +netrw-explore-cmds ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-explore-cmds* +netrw-externapp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-externapp* +netrw-file ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-file* +netrw-filigree ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-filigree* +netrw-fixup ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-fixup* +netrw-ftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ftp* +netrw-ftype ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ftype* +netrw-gb ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gb* +netrw-gd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gd* +netrw-getftype ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-getftype* +netrw-gf ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gf* +netrw-gh ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gh* +netrw-gitignore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gitignore* +netrw-gn ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gn* +netrw-gp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gp* +netrw-grep ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-grep* +netrw-gx ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-gx* +netrw-handler ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-handler* +netrw-help ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-help* +netrw-hexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-hexplore* +netrw-hide ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-hide* +netrw-hiding ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-hiding* +netrw-history ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-history* +netrw-horiz ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-horiz* +netrw-i ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-i* +netrw-incompatible ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-incompatible* +netrw-internal-variables ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-internal-variables* +netrw-intro-browse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-intro-browse* +netrw-leftmouse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-leftmouse* +netrw-lexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-lexplore* +netrw-list ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-list* +netrw-listbookmark ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-listbookmark* +netrw-listhack ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-listhack* +netrw-login ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-login* +netrw-mA ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mA* +netrw-mB ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mB* +netrw-mF ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mF* +netrw-mT ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mT* +netrw-mX ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mX* +netrw-ma ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ma* +netrw-mb ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mb* +netrw-mc ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mc* +netrw-md ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-md* +netrw-me ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-me* +netrw-mf ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mf* +netrw-mg ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mg* +netrw-mh ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mh* +netrw-middlemouse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-middlemouse* +netrw-ml_get ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ml_get* +netrw-mm ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mm* +netrw-mouse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mouse* +netrw-move ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-move* +netrw-mp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mp* +netrw-mr ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mr* +netrw-ms ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ms* +netrw-mt ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mt* +netrw-mu ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mu* +netrw-mv ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mv* +netrw-mx ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mx* +netrw-mz ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-mz* +netrw-netrc ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-netrc* +netrw-newfile ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-newfile* +netrw-nexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-nexplore* +netrw-noload ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-noload* +netrw-nread ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-nread* +netrw-ntree ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ntree* +netrw-nwrite ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-nwrite* +netrw-o ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-o* +netrw-obtain ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-obtain* +netrw-options ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-options* +netrw-p ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p* +netrw-p1 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p1* +netrw-p10 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p10* +netrw-p11 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p11* +netrw-p12 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p12* +netrw-p13 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p13* +netrw-p14 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p14* +netrw-p15 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p15* +netrw-p16 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p16* +netrw-p17 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p17* +netrw-p2 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p2* +netrw-p3 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p3* +netrw-p4 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p4* +netrw-p5 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p5* +netrw-p6 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p6* +netrw-p7 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p7* +netrw-p8 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p8* +netrw-p9 ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-p9* +netrw-passwd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-passwd* +netrw-password ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-password* +netrw-path ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-path* +netrw-pexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-pexplore* +netrw-preview ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-preview* +netrw-problems ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-problems* +netrw-protocol ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-protocol* +netrw-prvwin ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-prvwin* +netrw-pscp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-pscp* +netrw-psftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-psftp* +netrw-putty ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-putty* +netrw-qF ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-qF* +netrw-qL ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-qL* +netrw-qb ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-qb* +netrw-qf ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-qf* +netrw-quickcom ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-quickcom* +netrw-quickcoms ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-quickcoms* +netrw-quickhelp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-quickhelp* +netrw-quickmap ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-quickmap* +netrw-quickmaps ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-quickmaps* +netrw-r ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-r* +netrw-read ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-read* +netrw-ref ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ref* +netrw-refresh ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-refresh* +netrw-rename ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-rename* +netrw-reverse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-reverse* +netrw-rexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-rexplore* +netrw-rightmouse ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-rightmouse* +netrw-s ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-s* +netrw-s-cr ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-s-cr* +netrw-settings ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-settings* +netrw-settings-window ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-settings-window* +netrw-sexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-sexplore* +netrw-sort ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-sort* +netrw-sort-sequence ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-sort-sequence* +netrw-sortsequence ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-sortsequence* +netrw-source ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-source* +netrw-ssh-hack ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-ssh-hack* +netrw-star ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-star* +netrw-starpat ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-starpat* +netrw-starstar ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-starstar* +netrw-starstarpat ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-starstarpat* +netrw-start ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-start* +netrw-t ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-t* +netrw-texplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-texplore* +netrw-todo ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-todo* +netrw-trailingslash ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-trailingslash* +netrw-transparent ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-transparent* +netrw-u ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-u* +netrw-updir ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-updir* +netrw-urls ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-urls* +netrw-usermaps ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-usermaps* +netrw-userpass ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-userpass* +netrw-v ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-v* +netrw-var ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-var* +netrw-variables ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-variables* +netrw-vexplore ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-vexplore* +netrw-windows-netrc ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-windows-netrc* +netrw-windows-s ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-windows-s* +netrw-write ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-write* +netrw-x ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-x* +netrw-xfer ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw-xfer* +netrw.vim ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw.vim* +netrw_filehandler ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*netrw_filehandler* +netterm-mouse ../../plugins/vimdoc-ja/doc/options.jax /*netterm-mouse* +network ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*network* +new-filetype ../../plugins/vimdoc-ja/doc/filetype.jax /*new-filetype* +new-filetype-scripts ../../plugins/vimdoc-ja/doc/filetype.jax /*new-filetype-scripts* +new-style-testing ../../plugins/vimdoc-ja/doc/eval.jax /*new-style-testing* +news ../../plugins/vimdoc-ja/doc/intro.jax /*news* +nextnonblank() ../../plugins/vimdoc-ja/doc/eval.jax /*nextnonblank()* +no-eval-feature ../../plugins/vimdoc-ja/doc/eval.jax /*no-eval-feature* +no-type-checking ../../plugins/vimdoc-ja/doc/eval.jax /*no-type-checking* +no_buffers_menu ../../plugins/vimdoc-ja/doc/gui.jax /*no_buffers_menu* +non-greedy ../../plugins/vimdoc-ja/doc/pattern.jax /*non-greedy* +non-zero-arg ../../plugins/vimdoc-ja/doc/eval.jax /*non-zero-arg* +none-variable ../../plugins/vimdoc-ja/doc/eval.jax /*none-variable* +normal-index ../../plugins/vimdoc-ja/doc/index.jax /*normal-index* +not-compatible ../../plugins/vimdoc-ja/doc/usr_01.jax /*not-compatible* +not-edited ../../plugins/vimdoc-ja/doc/editing.jax /*not-edited* +notation ../../plugins/vimdoc-ja/doc/intro.jax /*notation* +notepad ../../plugins/vimdoc-ja/doc/gui_w32.jax /*notepad* +nr2char() ../../plugins/vimdoc-ja/doc/eval.jax /*nr2char()* +nroff.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*nroff.vim* +null-variable ../../plugins/vimdoc-ja/doc/eval.jax /*null-variable* +number_relativenumber ../../plugins/vimdoc-ja/doc/options.jax /*number_relativenumber* +numbered-function ../../plugins/vimdoc-ja/doc/eval.jax /*numbered-function* +o ../../plugins/vimdoc-ja/doc/insert.jax /*o* +o_CTRL-V ../../plugins/vimdoc-ja/doc/motion.jax /*o_CTRL-V* +o_V ../../plugins/vimdoc-ja/doc/motion.jax /*o_V* +o_v ../../plugins/vimdoc-ja/doc/motion.jax /*o_v* +object-motions ../../plugins/vimdoc-ja/doc/motion.jax /*object-motions* +object-select ../../plugins/vimdoc-ja/doc/motion.jax /*object-select* +objects ../../plugins/vimdoc-ja/doc/index.jax /*objects* +obtaining-exted ../../plugins/vimdoc-ja/doc/netbeans.jax /*obtaining-exted* +ocaml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ocaml.vim* +octal ../../plugins/vimdoc-ja/doc/eval.jax /*octal* +octal-nrformats ../../plugins/vimdoc-ja/doc/options.jax /*octal-nrformats* +octal-number ../../plugins/vimdoc-ja/doc/eval.jax /*octal-number* +old-style-testing ../../plugins/vimdoc-ja/doc/eval.jax /*old-style-testing* +oldfiles-variable ../../plugins/vimdoc-ja/doc/eval.jax /*oldfiles-variable* +ole-activation ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-activation* +ole-eval ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-eval* +ole-gethwnd ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-gethwnd* +ole-interface ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-interface* +ole-methods ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-methods* +ole-normal ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-normal* +ole-registration ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-registration* +ole-sendkeys ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-sendkeys* +ole-setforeground ../../plugins/vimdoc-ja/doc/if_ole.jax /*ole-setforeground* +omap-info ../../plugins/vimdoc-ja/doc/map.jax /*omap-info* +omni-sql-completion ../../plugins/vimdoc-ja/doc/ft_sql.jax /*omni-sql-completion* +online-help ../../plugins/vimdoc-ja/doc/helphelp.jax /*online-help* +opening-window ../../plugins/vimdoc-ja/doc/windows.jax /*opening-window* +operator ../../plugins/vimdoc-ja/doc/motion.jax /*operator* +operator-variable ../../plugins/vimdoc-ja/doc/eval.jax /*operator-variable* +option-backslash ../../plugins/vimdoc-ja/doc/options.jax /*option-backslash* +option-list ../../plugins/vimdoc-ja/doc/quickref.jax /*option-list* +option-summary ../../plugins/vimdoc-ja/doc/options.jax /*option-summary* +option-window ../../plugins/vimdoc-ja/doc/options.jax /*option-window* +options ../../plugins/vimdoc-ja/doc/options.jax /*options* +options.txt ../../plugins/vimdoc-ja/doc/options.jax /*options.txt* +optwin ../../plugins/vimdoc-ja/doc/options.jax /*optwin* +or() ../../plugins/vimdoc-ja/doc/eval.jax /*or()* +oracle ../../plugins/vimdoc-ja/doc/ft_sql.jax /*oracle* +os2 ../../plugins/vimdoc-ja/doc/os_os2.jax /*os2* +os390 ../../plugins/vimdoc-ja/doc/os_390.jax /*os390* +os_390.txt ../../plugins/vimdoc-ja/doc/os_390.jax /*os_390.txt* +os_amiga.txt ../../plugins/vimdoc-ja/doc/os_amiga.jax /*os_amiga.txt* +os_beos.txt ../../plugins/vimdoc-ja/doc/os_beos.jax /*os_beos.txt* +os_dos.txt ../../plugins/vimdoc-ja/doc/os_dos.jax /*os_dos.txt* +os_mac.txt ../../plugins/vimdoc-ja/doc/os_mac.jax /*os_mac.txt* +os_mint.txt ../../plugins/vimdoc-ja/doc/os_mint.jax /*os_mint.txt* +os_msdos.txt ../../plugins/vimdoc-ja/doc/os_msdos.jax /*os_msdos.txt* +os_os2.txt ../../plugins/vimdoc-ja/doc/os_os2.jax /*os_os2.txt* +os_qnx.txt ../../plugins/vimdoc-ja/doc/os_qnx.jax /*os_qnx.txt* +os_risc.txt ../../plugins/vimdoc-ja/doc/os_risc.jax /*os_risc.txt* +os_unix.txt ../../plugins/vimdoc-ja/doc/os_unix.jax /*os_unix.txt* +os_vms.txt ../../plugins/vimdoc-ja/doc/os_vms.jax /*os_vms.txt* +os_win32.txt ../../plugins/vimdoc-ja/doc/os_win32.jax /*os_win32.txt* +other-features ../../plugins/vimdoc-ja/doc/vi_diff.jax /*other-features* +out_buf ../../plugins/vimdoc-ja/doc/channel.jax /*out_buf* +out_cb ../../plugins/vimdoc-ja/doc/channel.jax /*out_cb* +out_io-buffer ../../plugins/vimdoc-ja/doc/channel.jax /*out_io-buffer* +out_mode ../../plugins/vimdoc-ja/doc/channel.jax /*out_mode* +out_modifiable ../../plugins/vimdoc-ja/doc/channel.jax /*out_modifiable* +out_msg ../../plugins/vimdoc-ja/doc/channel.jax /*out_msg* +out_name ../../plugins/vimdoc-ja/doc/channel.jax /*out_name* +out_timeout ../../plugins/vimdoc-ja/doc/channel.jax /*out_timeout* +p ../../plugins/vimdoc-ja/doc/change.jax /*p* +pack-add ../../plugins/vimdoc-ja/doc/repeat.jax /*pack-add* +package-create ../../plugins/vimdoc-ja/doc/repeat.jax /*package-create* +packages ../../plugins/vimdoc-ja/doc/repeat.jax /*packages* +packload-two-steps ../../plugins/vimdoc-ja/doc/repeat.jax /*packload-two-steps* +page-down ../../plugins/vimdoc-ja/doc/intro.jax /*page-down* +page-up ../../plugins/vimdoc-ja/doc/intro.jax /*page-up* +page_down ../../plugins/vimdoc-ja/doc/intro.jax /*page_down* +page_up ../../plugins/vimdoc-ja/doc/intro.jax /*page_up* +pager ../../plugins/vimdoc-ja/doc/message.jax /*pager* +papp.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*papp.vim* +paragraph ../../plugins/vimdoc-ja/doc/motion.jax /*paragraph* +pascal.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*pascal.vim* +pathshorten() ../../plugins/vimdoc-ja/doc/eval.jax /*pathshorten()* +pattern ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern* +pattern-atoms ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern-atoms* +pattern-multi-byte ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern-multi-byte* +pattern-multi-items ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern-multi-items* +pattern-overview ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern-overview* +pattern-searches ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern-searches* +pattern.txt ../../plugins/vimdoc-ja/doc/pattern.jax /*pattern.txt* +patterns-composing ../../plugins/vimdoc-ja/doc/pattern.jax /*patterns-composing* +pdev-option ../../plugins/vimdoc-ja/doc/print.jax /*pdev-option* +peace ../../plugins/vimdoc-ja/doc/intro.jax /*peace* +penc-option ../../plugins/vimdoc-ja/doc/print.jax /*penc-option* +perl ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl* +perl-Append ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Append* +perl-Buffer ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Buffer* +perl-Buffers ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Buffers* +perl-Count ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Count* +perl-Delete ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Delete* +perl-DoCommand ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-DoCommand* +perl-Eval ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Eval* +perl-Get ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Get* +perl-GetCursor ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-GetCursor* +perl-Msg ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Msg* +perl-Name ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Name* +perl-Number ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Number* +perl-Set ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Set* +perl-SetHeight ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-SetHeight* +perl-SetOption ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-SetOption* +perl-Windows ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-Windows* +perl-compiling ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-compiling* +perl-dynamic ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-dynamic* +perl-editing ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-editing* +perl-overview ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-overview* +perl-patterns ../../plugins/vimdoc-ja/doc/pattern.jax /*perl-patterns* +perl-using ../../plugins/vimdoc-ja/doc/if_perl.jax /*perl-using* +perl.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*perl.vim* +perleval() ../../plugins/vimdoc-ja/doc/eval.jax /*perleval()* +persistent-undo ../../plugins/vimdoc-ja/doc/undo.jax /*persistent-undo* +pexpr-option ../../plugins/vimdoc-ja/doc/print.jax /*pexpr-option* +pfn-option ../../plugins/vimdoc-ja/doc/print.jax /*pfn-option* +pheader-option ../../plugins/vimdoc-ja/doc/print.jax /*pheader-option* +photon-fonts ../../plugins/vimdoc-ja/doc/os_qnx.jax /*photon-fonts* +photon-gui ../../plugins/vimdoc-ja/doc/os_qnx.jax /*photon-gui* +php-comment ../../plugins/vimdoc-ja/doc/indent.jax /*php-comment* +php-indent ../../plugins/vimdoc-ja/doc/indent.jax /*php-indent* +php-indenting ../../plugins/vimdoc-ja/doc/indent.jax /*php-indenting* +php.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*php.vim* +php3.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*php3.vim* +phtml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*phtml.vim* +pi_getscript.txt ../../plugins/vimdoc-ja/doc/pi_getscript.jax /*pi_getscript.txt* +pi_gzip.txt ../../plugins/vimdoc-ja/doc/pi_gzip.jax /*pi_gzip.txt* +pi_netrw.txt ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*pi_netrw.txt* +pi_paren.txt ../../plugins/vimdoc-ja/doc/pi_paren.jax /*pi_paren.txt* +pi_spec.txt ../../plugins/vimdoc-ja/doc/pi_spec.jax /*pi_spec.txt* +pi_tar.txt ../../plugins/vimdoc-ja/doc/pi_tar.jax /*pi_tar.txt* +pi_vimball.txt ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*pi_vimball.txt* +pi_zip.txt ../../plugins/vimdoc-ja/doc/pi_zip.jax /*pi_zip.txt* +pkzip ../../plugins/vimdoc-ja/doc/options.jax /*pkzip* +plaintex.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*plaintex.vim* +plsql ../../plugins/vimdoc-ja/doc/ft_sql.jax /*plsql* +plugin ../../plugins/vimdoc-ja/doc/usr_05.jax /*plugin* +plugin-details ../../plugins/vimdoc-ja/doc/filetype.jax /*plugin-details* +plugin-filetype ../../plugins/vimdoc-ja/doc/usr_41.jax /*plugin-filetype* +plugin-special ../../plugins/vimdoc-ja/doc/usr_41.jax /*plugin-special* +pmbcs-option ../../plugins/vimdoc-ja/doc/print.jax /*pmbcs-option* +pmbfn-option ../../plugins/vimdoc-ja/doc/print.jax /*pmbfn-option* +popt-option ../../plugins/vimdoc-ja/doc/print.jax /*popt-option* +popup-menu ../../plugins/vimdoc-ja/doc/gui.jax /*popup-menu* +popupmenu-completion ../../plugins/vimdoc-ja/doc/insert.jax /*popupmenu-completion* +popupmenu-keys ../../plugins/vimdoc-ja/doc/insert.jax /*popupmenu-keys* +posix ../../plugins/vimdoc-ja/doc/vi_diff.jax /*posix* +posix-compliance ../../plugins/vimdoc-ja/doc/vi_diff.jax /*posix-compliance* +posix-screen-size ../../plugins/vimdoc-ja/doc/vi_diff.jax /*posix-screen-size* +postgresql ../../plugins/vimdoc-ja/doc/ft_sql.jax /*postgresql* +postscr.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*postscr.vim* +postscript-cjk-printing ../../plugins/vimdoc-ja/doc/print.jax /*postscript-cjk-printing* +postscript-print-encoding ../../plugins/vimdoc-ja/doc/print.jax /*postscript-print-encoding* +postscript-print-trouble ../../plugins/vimdoc-ja/doc/print.jax /*postscript-print-trouble* +postscript-print-util ../../plugins/vimdoc-ja/doc/print.jax /*postscript-print-util* +postscript-printing ../../plugins/vimdoc-ja/doc/print.jax /*postscript-printing* +pow() ../../plugins/vimdoc-ja/doc/eval.jax /*pow()* +ppwiz.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ppwiz.vim* +press-enter ../../plugins/vimdoc-ja/doc/message.jax /*press-enter* +press-return ../../plugins/vimdoc-ja/doc/message.jax /*press-return* +prevcount-variable ../../plugins/vimdoc-ja/doc/eval.jax /*prevcount-variable* +preview-window ../../plugins/vimdoc-ja/doc/windows.jax /*preview-window* +prevnonblank() ../../plugins/vimdoc-ja/doc/eval.jax /*prevnonblank()* +print-intro ../../plugins/vimdoc-ja/doc/print.jax /*print-intro* +print-options ../../plugins/vimdoc-ja/doc/print.jax /*print-options* +print.txt ../../plugins/vimdoc-ja/doc/print.jax /*print.txt* +printf() ../../plugins/vimdoc-ja/doc/eval.jax /*printf()* +printf-% ../../plugins/vimdoc-ja/doc/eval.jax /*printf-%* +printf-B ../../plugins/vimdoc-ja/doc/eval.jax /*printf-B* +printf-E ../../plugins/vimdoc-ja/doc/eval.jax /*printf-E* +printf-G ../../plugins/vimdoc-ja/doc/eval.jax /*printf-G* +printf-S ../../plugins/vimdoc-ja/doc/eval.jax /*printf-S* +printf-X ../../plugins/vimdoc-ja/doc/eval.jax /*printf-X* +printf-b ../../plugins/vimdoc-ja/doc/eval.jax /*printf-b* +printf-c ../../plugins/vimdoc-ja/doc/eval.jax /*printf-c* +printf-d ../../plugins/vimdoc-ja/doc/eval.jax /*printf-d* +printf-e ../../plugins/vimdoc-ja/doc/eval.jax /*printf-e* +printf-f ../../plugins/vimdoc-ja/doc/eval.jax /*printf-f* +printf-g ../../plugins/vimdoc-ja/doc/eval.jax /*printf-g* +printf-o ../../plugins/vimdoc-ja/doc/eval.jax /*printf-o* +printf-s ../../plugins/vimdoc-ja/doc/eval.jax /*printf-s* +printf-x ../../plugins/vimdoc-ja/doc/eval.jax /*printf-x* +printing ../../plugins/vimdoc-ja/doc/print.jax /*printing* +printing-formfeed ../../plugins/vimdoc-ja/doc/print.jax /*printing-formfeed* +profile ../../plugins/vimdoc-ja/doc/repeat.jax /*profile* +profiling ../../plugins/vimdoc-ja/doc/repeat.jax /*profiling* +profiling-variable ../../plugins/vimdoc-ja/doc/eval.jax /*profiling-variable* +progname-variable ../../plugins/vimdoc-ja/doc/eval.jax /*progname-variable* +progpath-variable ../../plugins/vimdoc-ja/doc/eval.jax /*progpath-variable* +progress.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*progress.vim* +pronounce ../../plugins/vimdoc-ja/doc/intro.jax /*pronounce* +psql ../../plugins/vimdoc-ja/doc/ft_sql.jax /*psql* +ptcap.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ptcap.vim* +pterm-mouse ../../plugins/vimdoc-ja/doc/options.jax /*pterm-mouse* +pumvisible() ../../plugins/vimdoc-ja/doc/eval.jax /*pumvisible()* +put ../../plugins/vimdoc-ja/doc/change.jax /*put* +put-Visual-mode ../../plugins/vimdoc-ja/doc/change.jax /*put-Visual-mode* +py3eval() ../../plugins/vimdoc-ja/doc/eval.jax /*py3eval()* +pyeval() ../../plugins/vimdoc-ja/doc/eval.jax /*pyeval()* +python ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python* +python-.locked ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-.locked* +python-2-and-3 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-2-and-3* +python-Dictionary ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-Dictionary* +python-Function ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-Function* +python-List ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-List* +python-VIM_SPECIAL_PATH ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-VIM_SPECIAL_PATH* +python-_get_paths ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-_get_paths* +python-bindeval ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-bindeval* +python-bindeval-objects ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-bindeval-objects* +python-buffer ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-buffer* +python-buffers ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-buffers* +python-chdir ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-chdir* +python-command ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-command* +python-commands ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-commands* +python-current ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-current* +python-dynamic ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-dynamic* +python-error ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-error* +python-eval ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-eval* +python-examples ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-examples* +python-fchdir ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-fchdir* +python-find_module ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-find_module* +python-foreach_rtp ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-foreach_rtp* +python-input ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-input* +python-options ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-options* +python-output ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-output* +python-path_hook ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-path_hook* +python-pyeval ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-pyeval* +python-range ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-range* +python-special-path ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-special-path* +python-strwidth ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-strwidth* +python-tabpage ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-tabpage* +python-tabpages ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-tabpages* +python-vars ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-vars* +python-vim ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-vim* +python-vvars ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-vvars* +python-window ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-window* +python-windows ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python-windows* +python.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*python.vim* +python2-directory ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python2-directory* +python3 ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python3* +python3-directory ../../plugins/vimdoc-ja/doc/if_pyth.jax /*python3-directory* +pythonx-directory ../../plugins/vimdoc-ja/doc/if_pyth.jax /*pythonx-directory* +q ../../plugins/vimdoc-ja/doc/repeat.jax /*q* +q/ ../../plugins/vimdoc-ja/doc/cmdline.jax /*q\/* +q: ../../plugins/vimdoc-ja/doc/cmdline.jax /*q:* +q? ../../plugins/vimdoc-ja/doc/cmdline.jax /*q?* +qnx ../../plugins/vimdoc-ja/doc/os_qnx.jax /*qnx* +qnx-compiling ../../plugins/vimdoc-ja/doc/os_qnx.jax /*qnx-compiling* +qnx-general ../../plugins/vimdoc-ja/doc/os_qnx.jax /*qnx-general* +qnx-terminal ../../plugins/vimdoc-ja/doc/os_qnx.jax /*qnx-terminal* +quake.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*quake.vim* +quickfix ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix* +quickfix-directory-stack ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-directory-stack* +quickfix-error-lists ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-error-lists* +quickfix-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*quickfix-functions* +quickfix-gcc ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-gcc* +quickfix-manx ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-manx* +quickfix-perl ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-perl* +quickfix-valid ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-valid* +quickfix-window ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix-window* +quickfix.txt ../../plugins/vimdoc-ja/doc/quickfix.jax /*quickfix.txt* +quickref ../../plugins/vimdoc-ja/doc/quickref.jax /*quickref* +quickref.txt ../../plugins/vimdoc-ja/doc/quickref.jax /*quickref.txt* +quote ../../plugins/vimdoc-ja/doc/change.jax /*quote* +quote# ../../plugins/vimdoc-ja/doc/change.jax /*quote#* +quote% ../../plugins/vimdoc-ja/doc/change.jax /*quote%* +quote+ ../../plugins/vimdoc-ja/doc/gui_x11.jax /*quote+* +quote- ../../plugins/vimdoc-ja/doc/change.jax /*quote-* +quote. ../../plugins/vimdoc-ja/doc/change.jax /*quote.* +quote/ ../../plugins/vimdoc-ja/doc/change.jax /*quote\/* +quote0 ../../plugins/vimdoc-ja/doc/change.jax /*quote0* +quote1 ../../plugins/vimdoc-ja/doc/change.jax /*quote1* +quote2 ../../plugins/vimdoc-ja/doc/change.jax /*quote2* +quote3 ../../plugins/vimdoc-ja/doc/change.jax /*quote3* +quote4 ../../plugins/vimdoc-ja/doc/change.jax /*quote4* +quote9 ../../plugins/vimdoc-ja/doc/change.jax /*quote9* +quote: ../../plugins/vimdoc-ja/doc/change.jax /*quote:* +quote= ../../plugins/vimdoc-ja/doc/change.jax /*quote=* +quote_ ../../plugins/vimdoc-ja/doc/change.jax /*quote_* +quote_# ../../plugins/vimdoc-ja/doc/change.jax /*quote_#* +quote_% ../../plugins/vimdoc-ja/doc/change.jax /*quote_%* +quote_- ../../plugins/vimdoc-ja/doc/change.jax /*quote_-* +quote_. ../../plugins/vimdoc-ja/doc/change.jax /*quote_.* +quote_/ ../../plugins/vimdoc-ja/doc/change.jax /*quote_\/* +quote_: ../../plugins/vimdoc-ja/doc/change.jax /*quote_:* +quote_= ../../plugins/vimdoc-ja/doc/change.jax /*quote_=* +quote_alpha ../../plugins/vimdoc-ja/doc/change.jax /*quote_alpha* +quote_number ../../plugins/vimdoc-ja/doc/change.jax /*quote_number* +quote_quote ../../plugins/vimdoc-ja/doc/change.jax /*quote_quote* +quote_~ ../../plugins/vimdoc-ja/doc/change.jax /*quote_~* +quotea ../../plugins/vimdoc-ja/doc/change.jax /*quotea* +quotecommandquote ../../plugins/vimdoc-ja/doc/intro.jax /*quotecommandquote* +quoteplus ../../plugins/vimdoc-ja/doc/gui_x11.jax /*quoteplus* +quotequote ../../plugins/vimdoc-ja/doc/change.jax /*quotequote* +quotes ../../plugins/vimdoc-ja/doc/quotes.jax /*quotes* +quotes.txt ../../plugins/vimdoc-ja/doc/quotes.jax /*quotes.txt* +quotestar ../../plugins/vimdoc-ja/doc/gui.jax /*quotestar* +quote~ ../../plugins/vimdoc-ja/doc/change.jax /*quote~* +r ../../plugins/vimdoc-ja/doc/change.jax /*r* +range() ../../plugins/vimdoc-ja/doc/eval.jax /*range()* +raw-terminal-mode ../../plugins/vimdoc-ja/doc/term.jax /*raw-terminal-mode* +rcp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*rcp* +read-in-close-cb ../../plugins/vimdoc-ja/doc/channel.jax /*read-in-close-cb* +read-messages ../../plugins/vimdoc-ja/doc/insert.jax /*read-messages* +read-only-share ../../plugins/vimdoc-ja/doc/editing.jax /*read-only-share* +readfile() ../../plugins/vimdoc-ja/doc/eval.jax /*readfile()* +readline.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*readline.vim* +recording ../../plugins/vimdoc-ja/doc/repeat.jax /*recording* +recover.txt ../../plugins/vimdoc-ja/doc/recover.jax /*recover.txt* +recovery ../../plugins/vimdoc-ja/doc/recover.jax /*recovery* +recursive_mapping ../../plugins/vimdoc-ja/doc/map.jax /*recursive_mapping* +redo ../../plugins/vimdoc-ja/doc/undo.jax /*redo* +redo-register ../../plugins/vimdoc-ja/doc/undo.jax /*redo-register* +ref ../../plugins/vimdoc-ja/doc/intro.jax /*ref* +reference ../../plugins/vimdoc-ja/doc/intro.jax /*reference* +reference_toc ../../plugins/vimdoc-ja/doc/help.jax /*reference_toc* +regexp ../../plugins/vimdoc-ja/doc/pattern.jax /*regexp* +register ../../plugins/vimdoc-ja/doc/sponsor.jax /*register* +register-faq ../../plugins/vimdoc-ja/doc/sponsor.jax /*register-faq* +register-variable ../../plugins/vimdoc-ja/doc/eval.jax /*register-variable* +registers ../../plugins/vimdoc-ja/doc/change.jax /*registers* +regular-expression ../../plugins/vimdoc-ja/doc/pattern.jax /*regular-expression* +reload ../../plugins/vimdoc-ja/doc/editing.jax /*reload* +reltime() ../../plugins/vimdoc-ja/doc/eval.jax /*reltime()* +reltimefloat() ../../plugins/vimdoc-ja/doc/eval.jax /*reltimefloat()* +reltimestr() ../../plugins/vimdoc-ja/doc/eval.jax /*reltimestr()* +remote.txt ../../plugins/vimdoc-ja/doc/remote.jax /*remote.txt* +remote_expr() ../../plugins/vimdoc-ja/doc/eval.jax /*remote_expr()* +remote_foreground() ../../plugins/vimdoc-ja/doc/eval.jax /*remote_foreground()* +remote_peek() ../../plugins/vimdoc-ja/doc/eval.jax /*remote_peek()* +remote_read() ../../plugins/vimdoc-ja/doc/eval.jax /*remote_read()* +remote_send() ../../plugins/vimdoc-ja/doc/eval.jax /*remote_send()* +remove() ../../plugins/vimdoc-ja/doc/eval.jax /*remove()* +remove-filetype ../../plugins/vimdoc-ja/doc/filetype.jax /*remove-filetype* +remove-option-flags ../../plugins/vimdoc-ja/doc/options.jax /*remove-option-flags* +rename() ../../plugins/vimdoc-ja/doc/eval.jax /*rename()* +rename-files ../../plugins/vimdoc-ja/doc/tips.jax /*rename-files* +repeat() ../../plugins/vimdoc-ja/doc/eval.jax /*repeat()* +repeat.txt ../../plugins/vimdoc-ja/doc/repeat.jax /*repeat.txt* +repeating ../../plugins/vimdoc-ja/doc/repeat.jax /*repeating* +replacing ../../plugins/vimdoc-ja/doc/change.jax /*replacing* +replacing-ex ../../plugins/vimdoc-ja/doc/insert.jax /*replacing-ex* +reselect-Visual ../../plugins/vimdoc-ja/doc/visual.jax /*reselect-Visual* +resolve() ../../plugins/vimdoc-ja/doc/eval.jax /*resolve()* +restore-cursor ../../plugins/vimdoc-ja/doc/usr_05.jax /*restore-cursor* +restore-position ../../plugins/vimdoc-ja/doc/tips.jax /*restore-position* +restricted-mode ../../plugins/vimdoc-ja/doc/starting.jax /*restricted-mode* +retab-example ../../plugins/vimdoc-ja/doc/change.jax /*retab-example* +rethrow ../../plugins/vimdoc-ja/doc/eval.jax /*rethrow* +reverse() ../../plugins/vimdoc-ja/doc/eval.jax /*reverse()* +rexx.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*rexx.vim* +rgb.txt ../../plugins/vimdoc-ja/doc/gui_w32.jax /*rgb.txt* +rgview ../../plugins/vimdoc-ja/doc/starting.jax /*rgview* +rgvim ../../plugins/vimdoc-ja/doc/starting.jax /*rgvim* +right-justify ../../plugins/vimdoc-ja/doc/change.jax /*right-justify* +rileft ../../plugins/vimdoc-ja/doc/rileft.jax /*rileft* +rileft.txt ../../plugins/vimdoc-ja/doc/rileft.jax /*rileft.txt* +riscos ../../plugins/vimdoc-ja/doc/os_risc.jax /*riscos* +rot13 ../../plugins/vimdoc-ja/doc/change.jax /*rot13* +round() ../../plugins/vimdoc-ja/doc/eval.jax /*round()* +rst.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*rst.vim* +rsync ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*rsync* +ruby ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby* +ruby-buffer ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-buffer* +ruby-command ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-command* +ruby-commands ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-commands* +ruby-dynamic ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-dynamic* +ruby-evaluate ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-evaluate* +ruby-globals ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-globals* +ruby-message ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-message* +ruby-set_option ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-set_option* +ruby-vim ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-vim* +ruby-window ../../plugins/vimdoc-ja/doc/if_ruby.jax /*ruby-window* +ruby.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby.vim* +ruby_fold ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_fold* +ruby_foldable_groups ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_foldable_groups* +ruby_minlines ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_minlines* +ruby_no_expensive ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_no_expensive* +ruby_operators ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_operators* +ruby_space_errors ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_space_errors* +ruby_spellcheck_strings ../../plugins/vimdoc-ja/doc/syntax.jax /*ruby_spellcheck_strings* +russian ../../plugins/vimdoc-ja/doc/russian.jax /*russian* +russian-intro ../../plugins/vimdoc-ja/doc/russian.jax /*russian-intro* +russian-issues ../../plugins/vimdoc-ja/doc/russian.jax /*russian-issues* +russian-keymap ../../plugins/vimdoc-ja/doc/russian.jax /*russian-keymap* +russian-l18n ../../plugins/vimdoc-ja/doc/russian.jax /*russian-l18n* +russian.txt ../../plugins/vimdoc-ja/doc/russian.jax /*russian.txt* +rview ../../plugins/vimdoc-ja/doc/starting.jax /*rview* +rvim ../../plugins/vimdoc-ja/doc/starting.jax /*rvim* +rxvt ../../plugins/vimdoc-ja/doc/syntax.jax /*rxvt* +s ../../plugins/vimdoc-ja/doc/change.jax /*s* +s/\& ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\&* +s/\0 ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\0* +s/\1 ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\1* +s/\2 ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\2* +s/\3 ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\3* +s/\9 ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\9* +s/\<CR> ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\<CR>* +s/\= ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\=* +s/\E ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\E* +s/\L ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\L* +s/\U ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\U* +s/\\ ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\\\* +s/\b ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\b* +s/\e ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\e* +s/\l ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\l* +s/\n ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\n* +s/\r ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\r* +s/\t ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\t* +s/\u ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\u* +s/\~ ../../plugins/vimdoc-ja/doc/change.jax /*s\/\\~* +s:netrw_passwd ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*s:netrw_passwd* +s:var ../../plugins/vimdoc-ja/doc/eval.jax /*s:var* +s<CR> ../../plugins/vimdoc-ja/doc/change.jax /*s<CR>* +sandbox ../../plugins/vimdoc-ja/doc/eval.jax /*sandbox* +sandbox-option ../../plugins/vimdoc-ja/doc/eval.jax /*sandbox-option* +save-file ../../plugins/vimdoc-ja/doc/editing.jax /*save-file* +save-settings ../../plugins/vimdoc-ja/doc/starting.jax /*save-settings* +scheme.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*scheme.vim* +scp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*scp* +screenattr() ../../plugins/vimdoc-ja/doc/eval.jax /*screenattr()* +screenchar() ../../plugins/vimdoc-ja/doc/eval.jax /*screenchar()* +screencol() ../../plugins/vimdoc-ja/doc/eval.jax /*screencol()* +screenrow() ../../plugins/vimdoc-ja/doc/eval.jax /*screenrow()* +script ../../plugins/vimdoc-ja/doc/usr_41.jax /*script* +script-here ../../plugins/vimdoc-ja/doc/if_perl.jax /*script-here* +script-local ../../plugins/vimdoc-ja/doc/map.jax /*script-local* +script-variable ../../plugins/vimdoc-ja/doc/eval.jax /*script-variable* +scriptnames-dictionary ../../plugins/vimdoc-ja/doc/eval.jax /*scriptnames-dictionary* +scriptout-changed ../../plugins/vimdoc-ja/doc/version4.jax /*scriptout-changed* +scroll-binding ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-binding* +scroll-cursor ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-cursor* +scroll-down ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-down* +scroll-horizontal ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-horizontal* +scroll-insert ../../plugins/vimdoc-ja/doc/tips.jax /*scroll-insert* +scroll-mouse-wheel ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-mouse-wheel* +scroll-region ../../plugins/vimdoc-ja/doc/term.jax /*scroll-region* +scroll-smooth ../../plugins/vimdoc-ja/doc/tips.jax /*scroll-smooth* +scroll-up ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll-up* +scroll.txt ../../plugins/vimdoc-ja/doc/scroll.jax /*scroll.txt* +scrollbind-quickadj ../../plugins/vimdoc-ja/doc/scroll.jax /*scrollbind-quickadj* +scrollbind-relative ../../plugins/vimdoc-ja/doc/scroll.jax /*scrollbind-relative* +scrolling ../../plugins/vimdoc-ja/doc/scroll.jax /*scrolling* +scrollstart-variable ../../plugins/vimdoc-ja/doc/eval.jax /*scrollstart-variable* +sdl.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sdl.vim* +search() ../../plugins/vimdoc-ja/doc/eval.jax /*search()* +search()-sub-match ../../plugins/vimdoc-ja/doc/eval.jax /*search()-sub-match* +search-commands ../../plugins/vimdoc-ja/doc/pattern.jax /*search-commands* +search-offset ../../plugins/vimdoc-ja/doc/pattern.jax /*search-offset* +search-pattern ../../plugins/vimdoc-ja/doc/pattern.jax /*search-pattern* +search-range ../../plugins/vimdoc-ja/doc/pattern.jax /*search-range* +search-replace ../../plugins/vimdoc-ja/doc/change.jax /*search-replace* +searchdecl() ../../plugins/vimdoc-ja/doc/eval.jax /*searchdecl()* +searchforward-variable ../../plugins/vimdoc-ja/doc/eval.jax /*searchforward-variable* +searchpair() ../../plugins/vimdoc-ja/doc/eval.jax /*searchpair()* +searchpairpos() ../../plugins/vimdoc-ja/doc/eval.jax /*searchpairpos()* +searchpos() ../../plugins/vimdoc-ja/doc/eval.jax /*searchpos()* +section ../../plugins/vimdoc-ja/doc/motion.jax /*section* +sed.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sed.vim* +self ../../plugins/vimdoc-ja/doc/eval.jax /*self* +send-money ../../plugins/vimdoc-ja/doc/sponsor.jax /*send-money* +send-to-menu ../../plugins/vimdoc-ja/doc/gui_w32.jax /*send-to-menu* +sendto ../../plugins/vimdoc-ja/doc/gui_w32.jax /*sendto* +sentence ../../plugins/vimdoc-ja/doc/motion.jax /*sentence* +server-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*server-functions* +server2client() ../../plugins/vimdoc-ja/doc/eval.jax /*server2client()* +serverlist() ../../plugins/vimdoc-ja/doc/eval.jax /*serverlist()* +servername-variable ../../plugins/vimdoc-ja/doc/eval.jax /*servername-variable* +session-file ../../plugins/vimdoc-ja/doc/starting.jax /*session-file* +set-option ../../plugins/vimdoc-ja/doc/options.jax /*set-option* +set-spc-auto ../../plugins/vimdoc-ja/doc/spell.jax /*set-spc-auto* +setbufvar() ../../plugins/vimdoc-ja/doc/eval.jax /*setbufvar()* +setcharsearch() ../../plugins/vimdoc-ja/doc/eval.jax /*setcharsearch()* +setcmdpos() ../../plugins/vimdoc-ja/doc/eval.jax /*setcmdpos()* +setfperm() ../../plugins/vimdoc-ja/doc/eval.jax /*setfperm()* +setline() ../../plugins/vimdoc-ja/doc/eval.jax /*setline()* +setloclist() ../../plugins/vimdoc-ja/doc/eval.jax /*setloclist()* +setmatches() ../../plugins/vimdoc-ja/doc/eval.jax /*setmatches()* +setpos() ../../plugins/vimdoc-ja/doc/eval.jax /*setpos()* +setqflist() ../../plugins/vimdoc-ja/doc/eval.jax /*setqflist()* +setreg() ../../plugins/vimdoc-ja/doc/eval.jax /*setreg()* +settabvar() ../../plugins/vimdoc-ja/doc/eval.jax /*settabvar()* +settabwinvar() ../../plugins/vimdoc-ja/doc/eval.jax /*settabwinvar()* +setting-guifont ../../plugins/vimdoc-ja/doc/gui.jax /*setting-guifont* +setting-guitablabel ../../plugins/vimdoc-ja/doc/tabpage.jax /*setting-guitablabel* +setting-tabline ../../plugins/vimdoc-ja/doc/tabpage.jax /*setting-tabline* +setuid ../../plugins/vimdoc-ja/doc/change.jax /*setuid* +setwinvar() ../../plugins/vimdoc-ja/doc/eval.jax /*setwinvar()* +sftp ../../plugins/vimdoc-ja/doc/pi_netrw.jax /*sftp* +sgml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sgml.vim* +sgr-mouse ../../plugins/vimdoc-ja/doc/options.jax /*sgr-mouse* +sh-awk ../../plugins/vimdoc-ja/doc/syntax.jax /*sh-awk* +sh-embed ../../plugins/vimdoc-ja/doc/syntax.jax /*sh-embed* +sh.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sh.vim* +sha256() ../../plugins/vimdoc-ja/doc/eval.jax /*sha256()* +shell-window ../../plugins/vimdoc-ja/doc/tips.jax /*shell-window* +shell_error-variable ../../plugins/vimdoc-ja/doc/eval.jax /*shell_error-variable* +shellescape() ../../plugins/vimdoc-ja/doc/eval.jax /*shellescape()* +shift ../../plugins/vimdoc-ja/doc/intro.jax /*shift* +shift-left-right ../../plugins/vimdoc-ja/doc/change.jax /*shift-left-right* +shiftwidth() ../../plugins/vimdoc-ja/doc/eval.jax /*shiftwidth()* +short-name-changed ../../plugins/vimdoc-ja/doc/version4.jax /*short-name-changed* +showing-menus ../../plugins/vimdoc-ja/doc/gui.jax /*showing-menus* +sign-commands ../../plugins/vimdoc-ja/doc/sign.jax /*sign-commands* +sign-intro ../../plugins/vimdoc-ja/doc/sign.jax /*sign-intro* +sign-support ../../plugins/vimdoc-ja/doc/sign.jax /*sign-support* +sign.txt ../../plugins/vimdoc-ja/doc/sign.jax /*sign.txt* +signs ../../plugins/vimdoc-ja/doc/sign.jax /*signs* +simple-change ../../plugins/vimdoc-ja/doc/change.jax /*simple-change* +simplify() ../../plugins/vimdoc-ja/doc/eval.jax /*simplify()* +simulated-command ../../plugins/vimdoc-ja/doc/vi_diff.jax /*simulated-command* +sin() ../../plugins/vimdoc-ja/doc/eval.jax /*sin()* +single-repeat ../../plugins/vimdoc-ja/doc/repeat.jax /*single-repeat* +sinh() ../../plugins/vimdoc-ja/doc/eval.jax /*sinh()* +skeleton ../../plugins/vimdoc-ja/doc/autocmd.jax /*skeleton* +skip_defaults_vim ../../plugins/vimdoc-ja/doc/starting.jax /*skip_defaults_vim* +slice ../../plugins/vimdoc-ja/doc/eval.jax /*slice* +slow-fast-terminal ../../plugins/vimdoc-ja/doc/term.jax /*slow-fast-terminal* +slow-start ../../plugins/vimdoc-ja/doc/starting.jax /*slow-start* +slow-terminal ../../plugins/vimdoc-ja/doc/term.jax /*slow-terminal* +socket-interface ../../plugins/vimdoc-ja/doc/channel.jax /*socket-interface* +sort() ../../plugins/vimdoc-ja/doc/eval.jax /*sort()* +sorting ../../plugins/vimdoc-ja/doc/change.jax /*sorting* +soundfold() ../../plugins/vimdoc-ja/doc/eval.jax /*soundfold()* +space ../../plugins/vimdoc-ja/doc/intro.jax /*space* +spec-customizing ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec-customizing* +spec-how-to-use-it ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec-how-to-use-it* +spec-setting-a-map ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec-setting-a-map* +spec_chglog_format ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec_chglog_format* +spec_chglog_prepend ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec_chglog_prepend* +spec_chglog_release_info ../../plugins/vimdoc-ja/doc/pi_spec.jax /*spec_chglog_release_info* +special-buffers ../../plugins/vimdoc-ja/doc/windows.jax /*special-buffers* +speed-up ../../plugins/vimdoc-ja/doc/tips.jax /*speed-up* +spell ../../plugins/vimdoc-ja/doc/spell.jax /*spell* +spell-ACCENT ../../plugins/vimdoc-ja/doc/spell.jax /*spell-ACCENT* +spell-AUTHOR ../../plugins/vimdoc-ja/doc/spell.jax /*spell-AUTHOR* +spell-BAD ../../plugins/vimdoc-ja/doc/spell.jax /*spell-BAD* +spell-BREAK ../../plugins/vimdoc-ja/doc/spell.jax /*spell-BREAK* +spell-CHECKCOMPOUNDCASE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CHECKCOMPOUNDCASE* +spell-CHECKCOMPOUNDDUP ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CHECKCOMPOUNDDUP* +spell-CHECKCOMPOUNDPATTERN ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CHECKCOMPOUNDPATTERN* +spell-CHECKCOMPOUNDREP ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CHECKCOMPOUNDREP* +spell-CHECKCOMPOUNDTRIPLE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CHECKCOMPOUNDTRIPLE* +spell-CIRCUMFIX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-CIRCUMFIX* +spell-COMMON ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMMON* +spell-COMPLEXPREFIXES ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPLEXPREFIXES* +spell-COMPOUND ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUND* +spell-COMPOUNDBEGIN ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDBEGIN* +spell-COMPOUNDEND ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDEND* +spell-COMPOUNDFIRST ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDFIRST* +spell-COMPOUNDFLAG ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDFLAG* +spell-COMPOUNDFORBIDFLAG ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDFORBIDFLAG* +spell-COMPOUNDMIDDLE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDMIDDLE* +spell-COMPOUNDMIN ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDMIN* +spell-COMPOUNDPERMITFLAG ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDPERMITFLAG* +spell-COMPOUNDROOT ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDROOT* +spell-COMPOUNDRULE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDRULE* +spell-COMPOUNDRULES ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDRULES* +spell-COMPOUNDSYLLABLE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDSYLLABLE* +spell-COMPOUNDSYLMAX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDSYLMAX* +spell-COMPOUNDWORDMAX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COMPOUNDWORDMAX* +spell-COPYRIGHT ../../plugins/vimdoc-ja/doc/spell.jax /*spell-COPYRIGHT* +spell-EMAIL ../../plugins/vimdoc-ja/doc/spell.jax /*spell-EMAIL* +spell-FLAG ../../plugins/vimdoc-ja/doc/spell.jax /*spell-FLAG* +spell-FOL ../../plugins/vimdoc-ja/doc/spell.jax /*spell-FOL* +spell-FORBIDDENWORD ../../plugins/vimdoc-ja/doc/spell.jax /*spell-FORBIDDENWORD* +spell-HOME ../../plugins/vimdoc-ja/doc/spell.jax /*spell-HOME* +spell-IGNOREEXTRA ../../plugins/vimdoc-ja/doc/spell.jax /*spell-IGNOREEXTRA* +spell-KEEPCASE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-KEEPCASE* +spell-KEY ../../plugins/vimdoc-ja/doc/spell.jax /*spell-KEY* +spell-LANG ../../plugins/vimdoc-ja/doc/spell.jax /*spell-LANG* +spell-LEMMA_PRESENT ../../plugins/vimdoc-ja/doc/spell.jax /*spell-LEMMA_PRESENT* +spell-LOW ../../plugins/vimdoc-ja/doc/spell.jax /*spell-LOW* +spell-MAP ../../plugins/vimdoc-ja/doc/spell.jax /*spell-MAP* +spell-MAXNGRAMSUGS ../../plugins/vimdoc-ja/doc/spell.jax /*spell-MAXNGRAMSUGS* +spell-NAME ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NAME* +spell-NEEDAFFIX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NEEDAFFIX* +spell-NEEDCOMPOUND ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NEEDCOMPOUND* +spell-NOBREAK ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NOBREAK* +spell-NOCOMPOUNDSUGS ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NOCOMPOUNDSUGS* +spell-NOSPLITSUGS ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NOSPLITSUGS* +spell-NOSUGFILE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NOSUGFILE* +spell-NOSUGGEST ../../plugins/vimdoc-ja/doc/spell.jax /*spell-NOSUGGEST* +spell-ONLYINCOMPOUND ../../plugins/vimdoc-ja/doc/spell.jax /*spell-ONLYINCOMPOUND* +spell-PFX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-PFX* +spell-PFXPOSTPONE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-PFXPOSTPONE* +spell-PSEUDOROOT ../../plugins/vimdoc-ja/doc/spell.jax /*spell-PSEUDOROOT* +spell-RARE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-RARE* +spell-REP ../../plugins/vimdoc-ja/doc/spell.jax /*spell-REP* +spell-SAL ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SAL* +spell-SET ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SET* +spell-SFX ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SFX* +spell-SLASH ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SLASH* +spell-SOFOFROM ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SOFOFROM* +spell-SOFOTO ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SOFOTO* +spell-SUGSWITHDOTS ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SUGSWITHDOTS* +spell-SYLLABLE ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SYLLABLE* +spell-SYLLABLENUM ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SYLLABLENUM* +spell-SpellFileMissing ../../plugins/vimdoc-ja/doc/spell.jax /*spell-SpellFileMissing* +spell-TRY ../../plugins/vimdoc-ja/doc/spell.jax /*spell-TRY* +spell-UPP ../../plugins/vimdoc-ja/doc/spell.jax /*spell-UPP* +spell-VERSION ../../plugins/vimdoc-ja/doc/spell.jax /*spell-VERSION* +spell-WORDCHARS ../../plugins/vimdoc-ja/doc/spell.jax /*spell-WORDCHARS* +spell-aff-format ../../plugins/vimdoc-ja/doc/spell.jax /*spell-aff-format* +spell-affix-chars ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-chars* +spell-affix-comment ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-comment* +spell-affix-flags ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-flags* +spell-affix-mbyte ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-mbyte* +spell-affix-not-supported ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-not-supported* +spell-affix-vim ../../plugins/vimdoc-ja/doc/spell.jax /*spell-affix-vim* +spell-cjk ../../plugins/vimdoc-ja/doc/spell.jax /*spell-cjk* +spell-compound ../../plugins/vimdoc-ja/doc/spell.jax /*spell-compound* +spell-dic-format ../../plugins/vimdoc-ja/doc/spell.jax /*spell-dic-format* +spell-double-scoring ../../plugins/vimdoc-ja/doc/spell.jax /*spell-double-scoring* +spell-file-format ../../plugins/vimdoc-ja/doc/spell.jax /*spell-file-format* +spell-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*spell-functions* +spell-german ../../plugins/vimdoc-ja/doc/spell.jax /*spell-german* +spell-load ../../plugins/vimdoc-ja/doc/spell.jax /*spell-load* +spell-midword ../../plugins/vimdoc-ja/doc/spell.jax /*spell-midword* +spell-mkspell ../../plugins/vimdoc-ja/doc/spell.jax /*spell-mkspell* +spell-quickstart ../../plugins/vimdoc-ja/doc/spell.jax /*spell-quickstart* +spell-remarks ../../plugins/vimdoc-ja/doc/spell.jax /*spell-remarks* +spell-russian ../../plugins/vimdoc-ja/doc/spell.jax /*spell-russian* +spell-sug-file ../../plugins/vimdoc-ja/doc/spell.jax /*spell-sug-file* +spell-syntax ../../plugins/vimdoc-ja/doc/spell.jax /*spell-syntax* +spell-wordlist-format ../../plugins/vimdoc-ja/doc/spell.jax /*spell-wordlist-format* +spell-yiddish ../../plugins/vimdoc-ja/doc/spell.jax /*spell-yiddish* +spell.txt ../../plugins/vimdoc-ja/doc/spell.jax /*spell.txt* +spellbadword() ../../plugins/vimdoc-ja/doc/eval.jax /*spellbadword()* +spellfile-cleanup ../../plugins/vimdoc-ja/doc/spell.jax /*spellfile-cleanup* +spellfile.vim ../../plugins/vimdoc-ja/doc/spell.jax /*spellfile.vim* +spellsuggest() ../../plugins/vimdoc-ja/doc/eval.jax /*spellsuggest()* +split() ../../plugins/vimdoc-ja/doc/eval.jax /*split()* +splitfind ../../plugins/vimdoc-ja/doc/windows.jax /*splitfind* +splitview ../../plugins/vimdoc-ja/doc/windows.jax /*splitview* +sponsor ../../plugins/vimdoc-ja/doc/sponsor.jax /*sponsor* +sponsor-faq ../../plugins/vimdoc-ja/doc/sponsor.jax /*sponsor-faq* +sponsor.txt ../../plugins/vimdoc-ja/doc/sponsor.jax /*sponsor.txt* +spoon ../../plugins/vimdoc-ja/doc/os_unix.jax /*spoon* +spup.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*spup.vim* +sql-adding-dialects ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-adding-dialects* +sql-completion ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion* +sql-completion-columns ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-columns* +sql-completion-customization ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-customization* +sql-completion-dynamic ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-dynamic* +sql-completion-filetypes ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-filetypes* +sql-completion-maps ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-maps* +sql-completion-procedures ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-procedures* +sql-completion-static ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-static* +sql-completion-tables ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-tables* +sql-completion-tutorial ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-tutorial* +sql-completion-views ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-completion-views* +sql-dialects ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-dialects* +sql-macros ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-macros* +sql-matchit ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-matchit* +sql-navigation ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-navigation* +sql-object-motions ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-object-motions* +sql-predefined-objects ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-predefined-objects* +sql-type-default ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-type-default* +sql-types ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sql-types* +sql.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sql.vim* +sqlanywhere ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sqlanywhere* +sqlanywhere.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sqlanywhere.vim* +sqlgettype ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sqlgettype* +sqlinformix.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*sqlinformix.vim* +sqlj ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sqlj* +sqlserver ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sqlserver* +sqlsettype ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sqlsettype* +sqrt() ../../plugins/vimdoc-ja/doc/eval.jax /*sqrt()* +sscanf ../../plugins/vimdoc-ja/doc/eval.jax /*sscanf* +standard-plugin ../../plugins/vimdoc-ja/doc/usr_05.jax /*standard-plugin* +standard-plugin-list ../../plugins/vimdoc-ja/doc/help.jax /*standard-plugin-list* +standout ../../plugins/vimdoc-ja/doc/syntax.jax /*standout* +star ../../plugins/vimdoc-ja/doc/pattern.jax /*star* +starstar ../../plugins/vimdoc-ja/doc/editing.jax /*starstar* +starstar-wildcard ../../plugins/vimdoc-ja/doc/editing.jax /*starstar-wildcard* +start-of-file ../../plugins/vimdoc-ja/doc/pattern.jax /*start-of-file* +starting ../../plugins/vimdoc-ja/doc/starting.jax /*starting* +starting-amiga ../../plugins/vimdoc-ja/doc/starting.jax /*starting-amiga* +starting.txt ../../plugins/vimdoc-ja/doc/starting.jax /*starting.txt* +startup ../../plugins/vimdoc-ja/doc/starting.jax /*startup* +startup-options ../../plugins/vimdoc-ja/doc/starting.jax /*startup-options* +startup-terminal ../../plugins/vimdoc-ja/doc/term.jax /*startup-terminal* +static-tag ../../plugins/vimdoc-ja/doc/tagsrch.jax /*static-tag* +status-line ../../plugins/vimdoc-ja/doc/windows.jax /*status-line* +statusmsg-variable ../../plugins/vimdoc-ja/doc/eval.jax /*statusmsg-variable* +str2float() ../../plugins/vimdoc-ja/doc/eval.jax /*str2float()* +str2nr() ../../plugins/vimdoc-ja/doc/eval.jax /*str2nr()* +strcasestr() ../../plugins/vimdoc-ja/doc/eval.jax /*strcasestr()* +strcharpart() ../../plugins/vimdoc-ja/doc/eval.jax /*strcharpart()* +strchars() ../../plugins/vimdoc-ja/doc/eval.jax /*strchars()* +strchr() ../../plugins/vimdoc-ja/doc/eval.jax /*strchr()* +strcspn() ../../plugins/vimdoc-ja/doc/eval.jax /*strcspn()* +strdisplaywidth() ../../plugins/vimdoc-ja/doc/eval.jax /*strdisplaywidth()* +strftime() ../../plugins/vimdoc-ja/doc/eval.jax /*strftime()* +strgetchar() ../../plugins/vimdoc-ja/doc/eval.jax /*strgetchar()* +stridx() ../../plugins/vimdoc-ja/doc/eval.jax /*stridx()* +string ../../plugins/vimdoc-ja/doc/eval.jax /*string* +string() ../../plugins/vimdoc-ja/doc/eval.jax /*string()* +string-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*string-functions* +string-match ../../plugins/vimdoc-ja/doc/eval.jax /*string-match* +strlen() ../../plugins/vimdoc-ja/doc/eval.jax /*strlen()* +strpart() ../../plugins/vimdoc-ja/doc/eval.jax /*strpart()* +strpbrk() ../../plugins/vimdoc-ja/doc/eval.jax /*strpbrk()* +strrchr() ../../plugins/vimdoc-ja/doc/eval.jax /*strrchr()* +strridx() ../../plugins/vimdoc-ja/doc/eval.jax /*strridx()* +strspn() ../../plugins/vimdoc-ja/doc/eval.jax /*strspn()* +strstr() ../../plugins/vimdoc-ja/doc/eval.jax /*strstr()* +strtrans() ../../plugins/vimdoc-ja/doc/eval.jax /*strtrans()* +strwidth() ../../plugins/vimdoc-ja/doc/eval.jax /*strwidth()* +style-changes ../../plugins/vimdoc-ja/doc/develop.jax /*style-changes* +style-compiler ../../plugins/vimdoc-ja/doc/develop.jax /*style-compiler* +style-examples ../../plugins/vimdoc-ja/doc/develop.jax /*style-examples* +style-functions ../../plugins/vimdoc-ja/doc/develop.jax /*style-functions* +style-names ../../plugins/vimdoc-ja/doc/develop.jax /*style-names* +style-spaces ../../plugins/vimdoc-ja/doc/develop.jax /*style-spaces* +style-various ../../plugins/vimdoc-ja/doc/develop.jax /*style-various* +sub-menu-priority ../../plugins/vimdoc-ja/doc/gui.jax /*sub-menu-priority* +sub-replace-\= ../../plugins/vimdoc-ja/doc/change.jax /*sub-replace-\\=* +sub-replace-expression ../../plugins/vimdoc-ja/doc/change.jax /*sub-replace-expression* +sub-replace-special ../../plugins/vimdoc-ja/doc/change.jax /*sub-replace-special* +sublist ../../plugins/vimdoc-ja/doc/eval.jax /*sublist* +submatch() ../../plugins/vimdoc-ja/doc/eval.jax /*submatch()* +subscribe-maillist ../../plugins/vimdoc-ja/doc/intro.jax /*subscribe-maillist* +subscript ../../plugins/vimdoc-ja/doc/eval.jax /*subscript* +substitute() ../../plugins/vimdoc-ja/doc/eval.jax /*substitute()* +suffixes ../../plugins/vimdoc-ja/doc/cmdline.jax /*suffixes* +suspend ../../plugins/vimdoc-ja/doc/starting.jax /*suspend* +swap-exists-choices ../../plugins/vimdoc-ja/doc/usr_11.jax /*swap-exists-choices* +swap-file ../../plugins/vimdoc-ja/doc/recover.jax /*swap-file* +swapchoice-variable ../../plugins/vimdoc-ja/doc/eval.jax /*swapchoice-variable* +swapcommand-variable ../../plugins/vimdoc-ja/doc/eval.jax /*swapcommand-variable* +swapfile-changed ../../plugins/vimdoc-ja/doc/version4.jax /*swapfile-changed* +swapname-variable ../../plugins/vimdoc-ja/doc/eval.jax /*swapname-variable* +sybase ../../plugins/vimdoc-ja/doc/ft_sql.jax /*sybase* +syn-sync-grouphere ../../plugins/vimdoc-ja/doc/syntax.jax /*syn-sync-grouphere* +syn-sync-groupthere ../../plugins/vimdoc-ja/doc/syntax.jax /*syn-sync-groupthere* +syn-sync-linecont ../../plugins/vimdoc-ja/doc/syntax.jax /*syn-sync-linecont* +synID() ../../plugins/vimdoc-ja/doc/eval.jax /*synID()* +synIDattr() ../../plugins/vimdoc-ja/doc/eval.jax /*synIDattr()* +synIDtrans() ../../plugins/vimdoc-ja/doc/eval.jax /*synIDtrans()* +syncbind ../../plugins/vimdoc-ja/doc/scroll.jax /*syncbind* +syncolor ../../plugins/vimdoc-ja/doc/syntax.jax /*syncolor* +synconcealed() ../../plugins/vimdoc-ja/doc/eval.jax /*synconcealed()* +synload-1 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-1* +synload-2 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-2* +synload-3 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-3* +synload-4 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-4* +synload-5 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-5* +synload-6 ../../plugins/vimdoc-ja/doc/syntax.jax /*synload-6* +synstack() ../../plugins/vimdoc-ja/doc/eval.jax /*synstack()* +syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*syntax* +syntax-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*syntax-functions* +syntax-highlighting ../../plugins/vimdoc-ja/doc/syntax.jax /*syntax-highlighting* +syntax-loading ../../plugins/vimdoc-ja/doc/syntax.jax /*syntax-loading* +syntax-printing ../../plugins/vimdoc-ja/doc/usr_06.jax /*syntax-printing* +syntax.txt ../../plugins/vimdoc-ja/doc/syntax.jax /*syntax.txt* +syntax_cmd ../../plugins/vimdoc-ja/doc/syntax.jax /*syntax_cmd* +sys-file-list ../../plugins/vimdoc-ja/doc/help.jax /*sys-file-list* +sysmouse ../../plugins/vimdoc-ja/doc/term.jax /*sysmouse* +system() ../../plugins/vimdoc-ja/doc/eval.jax /*system()* +system-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*system-functions* +system-vimrc ../../plugins/vimdoc-ja/doc/starting.jax /*system-vimrc* +systemlist() ../../plugins/vimdoc-ja/doc/eval.jax /*systemlist()* +s~ ../../plugins/vimdoc-ja/doc/change.jax /*s~* +t ../../plugins/vimdoc-ja/doc/motion.jax /*t* +t: ../../plugins/vimdoc-ja/doc/eval.jax /*t:* +t:var ../../plugins/vimdoc-ja/doc/eval.jax /*t:var* +t_#2 ../../plugins/vimdoc-ja/doc/term.jax /*t_#2* +t_#4 ../../plugins/vimdoc-ja/doc/term.jax /*t_#4* +t_%1 ../../plugins/vimdoc-ja/doc/term.jax /*t_%1* +t_%i ../../plugins/vimdoc-ja/doc/term.jax /*t_%i* +t_&8 ../../plugins/vimdoc-ja/doc/term.jax /*t_&8* +t_8b ../../plugins/vimdoc-ja/doc/term.jax /*t_8b* +t_8f ../../plugins/vimdoc-ja/doc/term.jax /*t_8f* +t_@7 ../../plugins/vimdoc-ja/doc/term.jax /*t_@7* +t_AB ../../plugins/vimdoc-ja/doc/term.jax /*t_AB* +t_AF ../../plugins/vimdoc-ja/doc/term.jax /*t_AF* +t_AL ../../plugins/vimdoc-ja/doc/term.jax /*t_AL* +t_CS ../../plugins/vimdoc-ja/doc/term.jax /*t_CS* +t_CV ../../plugins/vimdoc-ja/doc/term.jax /*t_CV* +t_Ce ../../plugins/vimdoc-ja/doc/term.jax /*t_Ce* +t_Co ../../plugins/vimdoc-ja/doc/term.jax /*t_Co* +t_Cs ../../plugins/vimdoc-ja/doc/term.jax /*t_Cs* +t_DL ../../plugins/vimdoc-ja/doc/term.jax /*t_DL* +t_EI ../../plugins/vimdoc-ja/doc/term.jax /*t_EI* +t_F1 ../../plugins/vimdoc-ja/doc/term.jax /*t_F1* +t_F2 ../../plugins/vimdoc-ja/doc/term.jax /*t_F2* +t_F3 ../../plugins/vimdoc-ja/doc/term.jax /*t_F3* +t_F4 ../../plugins/vimdoc-ja/doc/term.jax /*t_F4* +t_F5 ../../plugins/vimdoc-ja/doc/term.jax /*t_F5* +t_F6 ../../plugins/vimdoc-ja/doc/term.jax /*t_F6* +t_F7 ../../plugins/vimdoc-ja/doc/term.jax /*t_F7* +t_F8 ../../plugins/vimdoc-ja/doc/term.jax /*t_F8* +t_F9 ../../plugins/vimdoc-ja/doc/term.jax /*t_F9* +t_IE ../../plugins/vimdoc-ja/doc/term.jax /*t_IE* +t_IS ../../plugins/vimdoc-ja/doc/term.jax /*t_IS* +t_K1 ../../plugins/vimdoc-ja/doc/term.jax /*t_K1* +t_K3 ../../plugins/vimdoc-ja/doc/term.jax /*t_K3* +t_K4 ../../plugins/vimdoc-ja/doc/term.jax /*t_K4* +t_K5 ../../plugins/vimdoc-ja/doc/term.jax /*t_K5* +t_K6 ../../plugins/vimdoc-ja/doc/term.jax /*t_K6* +t_K7 ../../plugins/vimdoc-ja/doc/term.jax /*t_K7* +t_K8 ../../plugins/vimdoc-ja/doc/term.jax /*t_K8* +t_K9 ../../plugins/vimdoc-ja/doc/term.jax /*t_K9* +t_KA ../../plugins/vimdoc-ja/doc/term.jax /*t_KA* +t_KB ../../plugins/vimdoc-ja/doc/term.jax /*t_KB* +t_KC ../../plugins/vimdoc-ja/doc/term.jax /*t_KC* +t_KD ../../plugins/vimdoc-ja/doc/term.jax /*t_KD* +t_KE ../../plugins/vimdoc-ja/doc/term.jax /*t_KE* +t_KF ../../plugins/vimdoc-ja/doc/term.jax /*t_KF* +t_KG ../../plugins/vimdoc-ja/doc/term.jax /*t_KG* +t_KH ../../plugins/vimdoc-ja/doc/term.jax /*t_KH* +t_KI ../../plugins/vimdoc-ja/doc/term.jax /*t_KI* +t_KJ ../../plugins/vimdoc-ja/doc/term.jax /*t_KJ* +t_KK ../../plugins/vimdoc-ja/doc/term.jax /*t_KK* +t_KL ../../plugins/vimdoc-ja/doc/term.jax /*t_KL* +t_RB ../../plugins/vimdoc-ja/doc/term.jax /*t_RB* +t_RI ../../plugins/vimdoc-ja/doc/term.jax /*t_RI* +t_RV ../../plugins/vimdoc-ja/doc/term.jax /*t_RV* +t_SI ../../plugins/vimdoc-ja/doc/term.jax /*t_SI* +t_SR ../../plugins/vimdoc-ja/doc/term.jax /*t_SR* +t_Sb ../../plugins/vimdoc-ja/doc/term.jax /*t_Sb* +t_Sf ../../plugins/vimdoc-ja/doc/term.jax /*t_Sf* +t_WP ../../plugins/vimdoc-ja/doc/term.jax /*t_WP* +t_WS ../../plugins/vimdoc-ja/doc/term.jax /*t_WS* +t_ZH ../../plugins/vimdoc-ja/doc/term.jax /*t_ZH* +t_ZR ../../plugins/vimdoc-ja/doc/term.jax /*t_ZR* +t_al ../../plugins/vimdoc-ja/doc/term.jax /*t_al* +t_bc ../../plugins/vimdoc-ja/doc/term.jax /*t_bc* +t_bool-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_bool-variable* +t_cd ../../plugins/vimdoc-ja/doc/term.jax /*t_cd* +t_cdl ../../plugins/vimdoc-ja/doc/version4.jax /*t_cdl* +t_ce ../../plugins/vimdoc-ja/doc/term.jax /*t_ce* +t_channel-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_channel-variable* +t_ci ../../plugins/vimdoc-ja/doc/version4.jax /*t_ci* +t_cil ../../plugins/vimdoc-ja/doc/version4.jax /*t_cil* +t_cl ../../plugins/vimdoc-ja/doc/term.jax /*t_cl* +t_cm ../../plugins/vimdoc-ja/doc/term.jax /*t_cm* +t_cri ../../plugins/vimdoc-ja/doc/version4.jax /*t_cri* +t_cs ../../plugins/vimdoc-ja/doc/term.jax /*t_cs* +t_csc ../../plugins/vimdoc-ja/doc/version4.jax /*t_csc* +t_cv ../../plugins/vimdoc-ja/doc/version4.jax /*t_cv* +t_cvv ../../plugins/vimdoc-ja/doc/version4.jax /*t_cvv* +t_da ../../plugins/vimdoc-ja/doc/term.jax /*t_da* +t_db ../../plugins/vimdoc-ja/doc/term.jax /*t_db* +t_dict-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_dict-variable* +t_dl ../../plugins/vimdoc-ja/doc/term.jax /*t_dl* +t_ed ../../plugins/vimdoc-ja/doc/version4.jax /*t_ed* +t_el ../../plugins/vimdoc-ja/doc/version4.jax /*t_el* +t_f1 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f1* +t_f10 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f10* +t_f2 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f2* +t_f3 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f3* +t_f4 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f4* +t_f5 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f5* +t_f6 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f6* +t_f7 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f7* +t_f8 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f8* +t_f9 ../../plugins/vimdoc-ja/doc/version4.jax /*t_f9* +t_float-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_float-variable* +t_fs ../../plugins/vimdoc-ja/doc/term.jax /*t_fs* +t_func-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_func-variable* +t_help ../../plugins/vimdoc-ja/doc/version4.jax /*t_help* +t_il ../../plugins/vimdoc-ja/doc/version4.jax /*t_il* +t_job-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_job-variable* +t_k1 ../../plugins/vimdoc-ja/doc/term.jax /*t_k1* +t_k2 ../../plugins/vimdoc-ja/doc/term.jax /*t_k2* +t_k3 ../../plugins/vimdoc-ja/doc/term.jax /*t_k3* +t_k4 ../../plugins/vimdoc-ja/doc/term.jax /*t_k4* +t_k5 ../../plugins/vimdoc-ja/doc/term.jax /*t_k5* +t_k6 ../../plugins/vimdoc-ja/doc/term.jax /*t_k6* +t_k7 ../../plugins/vimdoc-ja/doc/term.jax /*t_k7* +t_k8 ../../plugins/vimdoc-ja/doc/term.jax /*t_k8* +t_k9 ../../plugins/vimdoc-ja/doc/term.jax /*t_k9* +t_k; ../../plugins/vimdoc-ja/doc/term.jax /*t_k;* +t_kB ../../plugins/vimdoc-ja/doc/term.jax /*t_kB* +t_kD ../../plugins/vimdoc-ja/doc/term.jax /*t_kD* +t_kI ../../plugins/vimdoc-ja/doc/term.jax /*t_kI* +t_kN ../../plugins/vimdoc-ja/doc/term.jax /*t_kN* +t_kP ../../plugins/vimdoc-ja/doc/term.jax /*t_kP* +t_kb ../../plugins/vimdoc-ja/doc/term.jax /*t_kb* +t_kd ../../plugins/vimdoc-ja/doc/term.jax /*t_kd* +t_ke ../../plugins/vimdoc-ja/doc/term.jax /*t_ke* +t_kh ../../plugins/vimdoc-ja/doc/term.jax /*t_kh* +t_kl ../../plugins/vimdoc-ja/doc/term.jax /*t_kl* +t_kr ../../plugins/vimdoc-ja/doc/term.jax /*t_kr* +t_ks ../../plugins/vimdoc-ja/doc/term.jax /*t_ks* +t_ku ../../plugins/vimdoc-ja/doc/term.jax /*t_ku* +t_le ../../plugins/vimdoc-ja/doc/term.jax /*t_le* +t_list-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_list-variable* +t_mb ../../plugins/vimdoc-ja/doc/term.jax /*t_mb* +t_md ../../plugins/vimdoc-ja/doc/term.jax /*t_md* +t_me ../../plugins/vimdoc-ja/doc/term.jax /*t_me* +t_mr ../../plugins/vimdoc-ja/doc/term.jax /*t_mr* +t_ms ../../plugins/vimdoc-ja/doc/term.jax /*t_ms* +t_nd ../../plugins/vimdoc-ja/doc/term.jax /*t_nd* +t_none-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_none-variable* +t_number-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_number-variable* +t_op ../../plugins/vimdoc-ja/doc/term.jax /*t_op* +t_se ../../plugins/vimdoc-ja/doc/term.jax /*t_se* +t_sf1 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf1* +t_sf10 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf10* +t_sf2 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf2* +t_sf3 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf3* +t_sf4 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf4* +t_sf5 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf5* +t_sf6 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf6* +t_sf7 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf7* +t_sf8 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf8* +t_sf9 ../../plugins/vimdoc-ja/doc/version4.jax /*t_sf9* +t_skd ../../plugins/vimdoc-ja/doc/version4.jax /*t_skd* +t_skl ../../plugins/vimdoc-ja/doc/version4.jax /*t_skl* +t_skr ../../plugins/vimdoc-ja/doc/version4.jax /*t_skr* +t_sku ../../plugins/vimdoc-ja/doc/version4.jax /*t_sku* +t_so ../../plugins/vimdoc-ja/doc/term.jax /*t_so* +t_sr ../../plugins/vimdoc-ja/doc/term.jax /*t_sr* +t_star7 ../../plugins/vimdoc-ja/doc/term.jax /*t_star7* +t_string-variable ../../plugins/vimdoc-ja/doc/eval.jax /*t_string-variable* +t_tb ../../plugins/vimdoc-ja/doc/version4.jax /*t_tb* +t_te ../../plugins/vimdoc-ja/doc/term.jax /*t_te* +t_ti ../../plugins/vimdoc-ja/doc/term.jax /*t_ti* +t_tp ../../plugins/vimdoc-ja/doc/version4.jax /*t_tp* +t_ts ../../plugins/vimdoc-ja/doc/term.jax /*t_ts* +t_ts_old ../../plugins/vimdoc-ja/doc/version4.jax /*t_ts_old* +t_u7 ../../plugins/vimdoc-ja/doc/term.jax /*t_u7* +t_ue ../../plugins/vimdoc-ja/doc/term.jax /*t_ue* +t_undo ../../plugins/vimdoc-ja/doc/version4.jax /*t_undo* +t_us ../../plugins/vimdoc-ja/doc/term.jax /*t_us* +t_ut ../../plugins/vimdoc-ja/doc/term.jax /*t_ut* +t_vb ../../plugins/vimdoc-ja/doc/term.jax /*t_vb* +t_ve ../../plugins/vimdoc-ja/doc/term.jax /*t_ve* +t_vi ../../plugins/vimdoc-ja/doc/term.jax /*t_vi* +t_vs ../../plugins/vimdoc-ja/doc/term.jax /*t_vs* +t_xn ../../plugins/vimdoc-ja/doc/term.jax /*t_xn* +t_xs ../../plugins/vimdoc-ja/doc/term.jax /*t_xs* +tab ../../plugins/vimdoc-ja/doc/intro.jax /*tab* +tab-page ../../plugins/vimdoc-ja/doc/tabpage.jax /*tab-page* +tab-page-commands ../../plugins/vimdoc-ja/doc/tabpage.jax /*tab-page-commands* +tab-page-intro ../../plugins/vimdoc-ja/doc/tabpage.jax /*tab-page-intro* +tab-page-other ../../plugins/vimdoc-ja/doc/tabpage.jax /*tab-page-other* +tabline-menu ../../plugins/vimdoc-ja/doc/tabpage.jax /*tabline-menu* +tabpage ../../plugins/vimdoc-ja/doc/tabpage.jax /*tabpage* +tabpage-variable ../../plugins/vimdoc-ja/doc/eval.jax /*tabpage-variable* +tabpage.txt ../../plugins/vimdoc-ja/doc/tabpage.jax /*tabpage.txt* +tabpagebuflist() ../../plugins/vimdoc-ja/doc/eval.jax /*tabpagebuflist()* +tabpagenr() ../../plugins/vimdoc-ja/doc/eval.jax /*tabpagenr()* +tabpagewinnr() ../../plugins/vimdoc-ja/doc/eval.jax /*tabpagewinnr()* +tag ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag* +tag-! ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-!* +tag-any-white ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-any-white* +tag-binary-search ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-binary-search* +tag-blocks ../../plugins/vimdoc-ja/doc/motion.jax /*tag-blocks* +tag-commands ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-commands* +tag-details ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-details* +tag-highlight ../../plugins/vimdoc-ja/doc/syntax.jax /*tag-highlight* +tag-matchlist ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-matchlist* +tag-old-static ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-old-static* +tag-preview ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-preview* +tag-priority ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-priority* +tag-regexp ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-regexp* +tag-search ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-search* +tag-security ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-security* +tag-skip-file ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-skip-file* +tag-stack ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tag-stack* +tagfiles() ../../plugins/vimdoc-ja/doc/eval.jax /*tagfiles()* +taglist() ../../plugins/vimdoc-ja/doc/eval.jax /*taglist()* +tags ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tags* +tags-and-searches ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tags-and-searches* +tags-file-format ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tags-file-format* +tags-option ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tags-option* +tagsrch.txt ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tagsrch.txt* +tagstack ../../plugins/vimdoc-ja/doc/tagsrch.jax /*tagstack* +tan() ../../plugins/vimdoc-ja/doc/eval.jax /*tan()* +tanh() ../../plugins/vimdoc-ja/doc/eval.jax /*tanh()* +tar ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar* +tar-contents ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-contents* +tar-copyright ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-copyright* +tar-history ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-history* +tar-manual ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-manual* +tar-options ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-options* +tar-usage ../../plugins/vimdoc-ja/doc/pi_tar.jax /*tar-usage* +tcl ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl* +tcl-beep ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-beep* +tcl-buffer ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer* +tcl-buffer-append ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-append* +tcl-buffer-cmds ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-cmds* +tcl-buffer-command ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-command* +tcl-buffer-count ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-count* +tcl-buffer-delcmd ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-delcmd* +tcl-buffer-delete ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-delete* +tcl-buffer-expr ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-expr* +tcl-buffer-get ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-get* +tcl-buffer-insert ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-insert* +tcl-buffer-last ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-last* +tcl-buffer-mark ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-mark* +tcl-buffer-option ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-option* +tcl-buffer-set ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-set* +tcl-buffer-windows ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-buffer-windows* +tcl-bugs ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-bugs* +tcl-command ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-command* +tcl-commands ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-commands* +tcl-dynamic ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-dynamic* +tcl-ex-commands ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-ex-commands* +tcl-examples ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-examples* +tcl-expr ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-expr* +tcl-linenumbers ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-linenumbers* +tcl-misc ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-misc* +tcl-option ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-option* +tcl-output ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-output* +tcl-var-current ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-var-current* +tcl-var-lbase ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-var-lbase* +tcl-var-line ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-var-line* +tcl-var-lnum ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-var-lnum* +tcl-var-range ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-var-range* +tcl-variables ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-variables* +tcl-window ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window* +tcl-window-buffer ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-buffer* +tcl-window-cmds ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-cmds* +tcl-window-command ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-command* +tcl-window-cursor ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-cursor* +tcl-window-delcmd ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-delcmd* +tcl-window-expr ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-expr* +tcl-window-height ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-height* +tcl-window-option ../../plugins/vimdoc-ja/doc/if_tcl.jax /*tcl-window-option* +tcsh-style ../../plugins/vimdoc-ja/doc/cmdline.jax /*tcsh-style* +tcsh.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*tcsh.vim* +tear-off-menus ../../plugins/vimdoc-ja/doc/gui.jax /*tear-off-menus* +telnet-CTRL-] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*telnet-CTRL-]* +temp-file-name ../../plugins/vimdoc-ja/doc/eval.jax /*temp-file-name* +tempfile ../../plugins/vimdoc-ja/doc/change.jax /*tempfile* +template ../../plugins/vimdoc-ja/doc/autocmd.jax /*template* +tempname() ../../plugins/vimdoc-ja/doc/eval.jax /*tempname()* +term-dependent-settings ../../plugins/vimdoc-ja/doc/term.jax /*term-dependent-settings* +term-list ../../plugins/vimdoc-ja/doc/syntax.jax /*term-list* +term.txt ../../plugins/vimdoc-ja/doc/term.jax /*term.txt* +termcap ../../plugins/vimdoc-ja/doc/term.jax /*termcap* +termcap-changed ../../plugins/vimdoc-ja/doc/version4.jax /*termcap-changed* +termcap-colors ../../plugins/vimdoc-ja/doc/term.jax /*termcap-colors* +termcap-cursor-color ../../plugins/vimdoc-ja/doc/term.jax /*termcap-cursor-color* +termcap-cursor-shape ../../plugins/vimdoc-ja/doc/term.jax /*termcap-cursor-shape* +termcap-options ../../plugins/vimdoc-ja/doc/term.jax /*termcap-options* +termcap-title ../../plugins/vimdoc-ja/doc/term.jax /*termcap-title* +terminal-colors ../../plugins/vimdoc-ja/doc/os_unix.jax /*terminal-colors* +terminal-info ../../plugins/vimdoc-ja/doc/term.jax /*terminal-info* +terminal-options ../../plugins/vimdoc-ja/doc/term.jax /*terminal-options* +terminfo ../../plugins/vimdoc-ja/doc/term.jax /*terminfo* +termresponse-variable ../../plugins/vimdoc-ja/doc/eval.jax /*termresponse-variable* +test-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*test-functions* +test_alloc_fail() ../../plugins/vimdoc-ja/doc/eval.jax /*test_alloc_fail()* +test_autochdir() ../../plugins/vimdoc-ja/doc/eval.jax /*test_autochdir()* +test_disable_char_avail() ../../plugins/vimdoc-ja/doc/eval.jax /*test_disable_char_avail()* +test_garbagecollect_now() ../../plugins/vimdoc-ja/doc/eval.jax /*test_garbagecollect_now()* +test_null_channel() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_channel()* +test_null_dict() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_dict()* +test_null_job() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_job()* +test_null_list() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_list()* +test_null_partial() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_partial()* +test_null_string() ../../plugins/vimdoc-ja/doc/eval.jax /*test_null_string()* +test_settime() ../../plugins/vimdoc-ja/doc/eval.jax /*test_settime()* +testing ../../plugins/vimdoc-ja/doc/eval.jax /*testing* +testing-variable ../../plugins/vimdoc-ja/doc/eval.jax /*testing-variable* +tex-cchar ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-cchar* +tex-cole ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-cole* +tex-conceal ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-conceal* +tex-error ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-error* +tex-folding ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-folding* +tex-math ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-math* +tex-morecommands ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-morecommands* +tex-nospell ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-nospell* +tex-package ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-package* +tex-runon ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-runon* +tex-slow ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-slow* +tex-stopzone ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-stopzone* +tex-style ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-style* +tex-supersub ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-supersub* +tex-sync ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-sync* +tex-verb ../../plugins/vimdoc-ja/doc/syntax.jax /*tex-verb* +tex.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*tex.vim* +text-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*text-functions* +text-objects ../../plugins/vimdoc-ja/doc/motion.jax /*text-objects* +textlock ../../plugins/vimdoc-ja/doc/eval.jax /*textlock* +tf.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*tf.vim* +this_session-variable ../../plugins/vimdoc-ja/doc/eval.jax /*this_session-variable* +throw-catch ../../plugins/vimdoc-ja/doc/eval.jax /*throw-catch* +throw-expression ../../plugins/vimdoc-ja/doc/eval.jax /*throw-expression* +throw-from-catch ../../plugins/vimdoc-ja/doc/eval.jax /*throw-from-catch* +throw-variables ../../plugins/vimdoc-ja/doc/eval.jax /*throw-variables* +throwpoint-variable ../../plugins/vimdoc-ja/doc/eval.jax /*throwpoint-variable* +time-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*time-functions* +timer ../../plugins/vimdoc-ja/doc/eval.jax /*timer* +timer-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*timer-functions* +timer_info() ../../plugins/vimdoc-ja/doc/eval.jax /*timer_info()* +timer_pause() ../../plugins/vimdoc-ja/doc/eval.jax /*timer_pause()* +timer_start() ../../plugins/vimdoc-ja/doc/eval.jax /*timer_start()* +timer_stop() ../../plugins/vimdoc-ja/doc/eval.jax /*timer_stop()* +timer_stopall() ../../plugins/vimdoc-ja/doc/eval.jax /*timer_stopall()* +timers ../../plugins/vimdoc-ja/doc/eval.jax /*timers* +timestamp ../../plugins/vimdoc-ja/doc/editing.jax /*timestamp* +timestamps ../../plugins/vimdoc-ja/doc/editing.jax /*timestamps* +tips ../../plugins/vimdoc-ja/doc/tips.jax /*tips* +tips.txt ../../plugins/vimdoc-ja/doc/tips.jax /*tips.txt* +toggle ../../plugins/vimdoc-ja/doc/options.jax /*toggle* +toggle-revins ../../plugins/vimdoc-ja/doc/version4.jax /*toggle-revins* +tolower() ../../plugins/vimdoc-ja/doc/eval.jax /*tolower()* +toolbar-icon ../../plugins/vimdoc-ja/doc/gui.jax /*toolbar-icon* +toupper() ../../plugins/vimdoc-ja/doc/eval.jax /*toupper()* +tr() ../../plugins/vimdoc-ja/doc/eval.jax /*tr()* +trojan-horse ../../plugins/vimdoc-ja/doc/starting.jax /*trojan-horse* +true-variable ../../plugins/vimdoc-ja/doc/eval.jax /*true-variable* +trunc() ../../plugins/vimdoc-ja/doc/eval.jax /*trunc()* +try-conditionals ../../plugins/vimdoc-ja/doc/eval.jax /*try-conditionals* +try-echoerr ../../plugins/vimdoc-ja/doc/eval.jax /*try-echoerr* +try-finally ../../plugins/vimdoc-ja/doc/eval.jax /*try-finally* +try-nested ../../plugins/vimdoc-ja/doc/eval.jax /*try-nested* +try-nesting ../../plugins/vimdoc-ja/doc/eval.jax /*try-nesting* +tutor ../../plugins/vimdoc-ja/doc/usr_01.jax /*tutor* +two-engines ../../plugins/vimdoc-ja/doc/pattern.jax /*two-engines* +type() ../../plugins/vimdoc-ja/doc/eval.jax /*type()* +type-mistakes ../../plugins/vimdoc-ja/doc/tips.jax /*type-mistakes* +typecorr-settings ../../plugins/vimdoc-ja/doc/usr_41.jax /*typecorr-settings* +typecorr.txt ../../plugins/vimdoc-ja/doc/usr_41.jax /*typecorr.txt* +u ../../plugins/vimdoc-ja/doc/undo.jax /*u* +uganda ../../plugins/vimdoc-ja/doc/uganda.jax /*uganda* +uganda.txt ../../plugins/vimdoc-ja/doc/uganda.jax /*uganda.txt* +undercurl ../../plugins/vimdoc-ja/doc/syntax.jax /*undercurl* +underline ../../plugins/vimdoc-ja/doc/syntax.jax /*underline* +undo ../../plugins/vimdoc-ja/doc/undo.jax /*undo* +undo-blocks ../../plugins/vimdoc-ja/doc/undo.jax /*undo-blocks* +undo-branches ../../plugins/vimdoc-ja/doc/undo.jax /*undo-branches* +undo-commands ../../plugins/vimdoc-ja/doc/undo.jax /*undo-commands* +undo-persistence ../../plugins/vimdoc-ja/doc/undo.jax /*undo-persistence* +undo-redo ../../plugins/vimdoc-ja/doc/undo.jax /*undo-redo* +undo-remarks ../../plugins/vimdoc-ja/doc/undo.jax /*undo-remarks* +undo-tree ../../plugins/vimdoc-ja/doc/undo.jax /*undo-tree* +undo-two-ways ../../plugins/vimdoc-ja/doc/undo.jax /*undo-two-ways* +undo.txt ../../plugins/vimdoc-ja/doc/undo.jax /*undo.txt* +undo_ftplugin ../../plugins/vimdoc-ja/doc/usr_41.jax /*undo_ftplugin* +undo_indent ../../plugins/vimdoc-ja/doc/usr_41.jax /*undo_indent* +undofile() ../../plugins/vimdoc-ja/doc/eval.jax /*undofile()* +undotree() ../../plugins/vimdoc-ja/doc/eval.jax /*undotree()* +unicode ../../plugins/vimdoc-ja/doc/mbyte.jax /*unicode* +uniq() ../../plugins/vimdoc-ja/doc/eval.jax /*uniq()* +unix ../../plugins/vimdoc-ja/doc/os_unix.jax /*unix* +unlisted-buffer ../../plugins/vimdoc-ja/doc/windows.jax /*unlisted-buffer* +up-down-motions ../../plugins/vimdoc-ja/doc/motion.jax /*up-down-motions* +uppercase ../../plugins/vimdoc-ja/doc/change.jax /*uppercase* +urxvt-mouse ../../plugins/vimdoc-ja/doc/options.jax /*urxvt-mouse* +use-cpo-save ../../plugins/vimdoc-ja/doc/usr_41.jax /*use-cpo-save* +use-visual-cmds ../../plugins/vimdoc-ja/doc/version4.jax /*use-visual-cmds* +useful-mappings ../../plugins/vimdoc-ja/doc/tips.jax /*useful-mappings* +usenet ../../plugins/vimdoc-ja/doc/intro.jax /*usenet* +user-cmd-ambiguous ../../plugins/vimdoc-ja/doc/map.jax /*user-cmd-ambiguous* +user-commands ../../plugins/vimdoc-ja/doc/map.jax /*user-commands* +user-functions ../../plugins/vimdoc-ja/doc/eval.jax /*user-functions* +user-manual ../../plugins/vimdoc-ja/doc/usr_toc.jax /*user-manual* +using-<Plug> ../../plugins/vimdoc-ja/doc/usr_41.jax /*using-<Plug>* +using-menus ../../plugins/vimdoc-ja/doc/gui.jax /*using-menus* +using-scripts ../../plugins/vimdoc-ja/doc/repeat.jax /*using-scripts* +using-xxd ../../plugins/vimdoc-ja/doc/tips.jax /*using-xxd* +using_CTRL-V ../../plugins/vimdoc-ja/doc/map.jax /*using_CTRL-V* +usr_01.txt ../../plugins/vimdoc-ja/doc/usr_01.jax /*usr_01.txt* +usr_02.txt ../../plugins/vimdoc-ja/doc/usr_02.jax /*usr_02.txt* +usr_03.txt ../../plugins/vimdoc-ja/doc/usr_03.jax /*usr_03.txt* +usr_04.txt ../../plugins/vimdoc-ja/doc/usr_04.jax /*usr_04.txt* +usr_05.txt ../../plugins/vimdoc-ja/doc/usr_05.jax /*usr_05.txt* +usr_06.txt ../../plugins/vimdoc-ja/doc/usr_06.jax /*usr_06.txt* +usr_07.txt ../../plugins/vimdoc-ja/doc/usr_07.jax /*usr_07.txt* +usr_08.txt ../../plugins/vimdoc-ja/doc/usr_08.jax /*usr_08.txt* +usr_09.txt ../../plugins/vimdoc-ja/doc/usr_09.jax /*usr_09.txt* +usr_10.txt ../../plugins/vimdoc-ja/doc/usr_10.jax /*usr_10.txt* +usr_11.txt ../../plugins/vimdoc-ja/doc/usr_11.jax /*usr_11.txt* +usr_12.txt ../../plugins/vimdoc-ja/doc/usr_12.jax /*usr_12.txt* +usr_20.txt ../../plugins/vimdoc-ja/doc/usr_20.jax /*usr_20.txt* +usr_21.txt ../../plugins/vimdoc-ja/doc/usr_21.jax /*usr_21.txt* +usr_22.txt ../../plugins/vimdoc-ja/doc/usr_22.jax /*usr_22.txt* +usr_23.txt ../../plugins/vimdoc-ja/doc/usr_23.jax /*usr_23.txt* +usr_24.txt ../../plugins/vimdoc-ja/doc/usr_24.jax /*usr_24.txt* +usr_25.txt ../../plugins/vimdoc-ja/doc/usr_25.jax /*usr_25.txt* +usr_26.txt ../../plugins/vimdoc-ja/doc/usr_26.jax /*usr_26.txt* +usr_27.txt ../../plugins/vimdoc-ja/doc/usr_27.jax /*usr_27.txt* +usr_28.txt ../../plugins/vimdoc-ja/doc/usr_28.jax /*usr_28.txt* +usr_29.txt ../../plugins/vimdoc-ja/doc/usr_29.jax /*usr_29.txt* +usr_30.txt ../../plugins/vimdoc-ja/doc/usr_30.jax /*usr_30.txt* +usr_31.txt ../../plugins/vimdoc-ja/doc/usr_31.jax /*usr_31.txt* +usr_32.txt ../../plugins/vimdoc-ja/doc/usr_32.jax /*usr_32.txt* +usr_40.txt ../../plugins/vimdoc-ja/doc/usr_40.jax /*usr_40.txt* +usr_41.txt ../../plugins/vimdoc-ja/doc/usr_41.jax /*usr_41.txt* +usr_42.txt ../../plugins/vimdoc-ja/doc/usr_42.jax /*usr_42.txt* +usr_43.txt ../../plugins/vimdoc-ja/doc/usr_43.jax /*usr_43.txt* +usr_44.txt ../../plugins/vimdoc-ja/doc/usr_44.jax /*usr_44.txt* +usr_45.txt ../../plugins/vimdoc-ja/doc/usr_45.jax /*usr_45.txt* +usr_90.txt ../../plugins/vimdoc-ja/doc/usr_90.jax /*usr_90.txt* +usr_toc.txt ../../plugins/vimdoc-ja/doc/usr_toc.jax /*usr_toc.txt* +utf-8 ../../plugins/vimdoc-ja/doc/mbyte.jax /*utf-8* +utf-8-char-arg ../../plugins/vimdoc-ja/doc/mbyte.jax /*utf-8-char-arg* +utf-8-in-xwindows ../../plugins/vimdoc-ja/doc/mbyte.jax /*utf-8-in-xwindows* +utf-8-typing ../../plugins/vimdoc-ja/doc/mbyte.jax /*utf-8-typing* +utf8 ../../plugins/vimdoc-ja/doc/mbyte.jax /*utf8* +v ../../plugins/vimdoc-ja/doc/visual.jax /*v* +v: ../../plugins/vimdoc-ja/doc/eval.jax /*v:* +v:beval_bufnr ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_bufnr* +v:beval_col ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_col* +v:beval_lnum ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_lnum* +v:beval_text ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_text* +v:beval_winid ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_winid* +v:beval_winnr ../../plugins/vimdoc-ja/doc/eval.jax /*v:beval_winnr* +v:char ../../plugins/vimdoc-ja/doc/eval.jax /*v:char* +v:charconvert_from ../../plugins/vimdoc-ja/doc/eval.jax /*v:charconvert_from* +v:charconvert_to ../../plugins/vimdoc-ja/doc/eval.jax /*v:charconvert_to* +v:cmdarg ../../plugins/vimdoc-ja/doc/eval.jax /*v:cmdarg* +v:cmdbang ../../plugins/vimdoc-ja/doc/eval.jax /*v:cmdbang* +v:completed_item ../../plugins/vimdoc-ja/doc/eval.jax /*v:completed_item* +v:count ../../plugins/vimdoc-ja/doc/eval.jax /*v:count* +v:count1 ../../plugins/vimdoc-ja/doc/eval.jax /*v:count1* +v:ctype ../../plugins/vimdoc-ja/doc/eval.jax /*v:ctype* +v:dying ../../plugins/vimdoc-ja/doc/eval.jax /*v:dying* +v:errmsg ../../plugins/vimdoc-ja/doc/eval.jax /*v:errmsg* +v:errors ../../plugins/vimdoc-ja/doc/eval.jax /*v:errors* +v:exception ../../plugins/vimdoc-ja/doc/eval.jax /*v:exception* +v:false ../../plugins/vimdoc-ja/doc/eval.jax /*v:false* +v:fcs_choice ../../plugins/vimdoc-ja/doc/eval.jax /*v:fcs_choice* +v:fcs_reason ../../plugins/vimdoc-ja/doc/eval.jax /*v:fcs_reason* +v:fname_diff ../../plugins/vimdoc-ja/doc/eval.jax /*v:fname_diff* +v:fname_in ../../plugins/vimdoc-ja/doc/eval.jax /*v:fname_in* +v:fname_new ../../plugins/vimdoc-ja/doc/eval.jax /*v:fname_new* +v:fname_out ../../plugins/vimdoc-ja/doc/eval.jax /*v:fname_out* +v:folddashes ../../plugins/vimdoc-ja/doc/eval.jax /*v:folddashes* +v:foldend ../../plugins/vimdoc-ja/doc/eval.jax /*v:foldend* +v:foldlevel ../../plugins/vimdoc-ja/doc/eval.jax /*v:foldlevel* +v:foldstart ../../plugins/vimdoc-ja/doc/eval.jax /*v:foldstart* +v:hlsearch ../../plugins/vimdoc-ja/doc/eval.jax /*v:hlsearch* +v:insertmode ../../plugins/vimdoc-ja/doc/eval.jax /*v:insertmode* +v:key ../../plugins/vimdoc-ja/doc/eval.jax /*v:key* +v:lang ../../plugins/vimdoc-ja/doc/eval.jax /*v:lang* +v:lc_time ../../plugins/vimdoc-ja/doc/eval.jax /*v:lc_time* +v:lnum ../../plugins/vimdoc-ja/doc/eval.jax /*v:lnum* +v:mouse_col ../../plugins/vimdoc-ja/doc/eval.jax /*v:mouse_col* +v:mouse_lnum ../../plugins/vimdoc-ja/doc/eval.jax /*v:mouse_lnum* +v:mouse_win ../../plugins/vimdoc-ja/doc/eval.jax /*v:mouse_win* +v:mouse_winid ../../plugins/vimdoc-ja/doc/eval.jax /*v:mouse_winid* +v:none ../../plugins/vimdoc-ja/doc/eval.jax /*v:none* +v:null ../../plugins/vimdoc-ja/doc/eval.jax /*v:null* +v:oldfiles ../../plugins/vimdoc-ja/doc/eval.jax /*v:oldfiles* +v:operator ../../plugins/vimdoc-ja/doc/eval.jax /*v:operator* +v:option_new ../../plugins/vimdoc-ja/doc/eval.jax /*v:option_new* +v:option_old ../../plugins/vimdoc-ja/doc/eval.jax /*v:option_old* +v:option_type ../../plugins/vimdoc-ja/doc/eval.jax /*v:option_type* +v:prevcount ../../plugins/vimdoc-ja/doc/eval.jax /*v:prevcount* +v:profiling ../../plugins/vimdoc-ja/doc/eval.jax /*v:profiling* +v:progname ../../plugins/vimdoc-ja/doc/eval.jax /*v:progname* +v:progpath ../../plugins/vimdoc-ja/doc/eval.jax /*v:progpath* +v:register ../../plugins/vimdoc-ja/doc/eval.jax /*v:register* +v:scrollstart ../../plugins/vimdoc-ja/doc/eval.jax /*v:scrollstart* +v:searchforward ../../plugins/vimdoc-ja/doc/eval.jax /*v:searchforward* +v:servername ../../plugins/vimdoc-ja/doc/eval.jax /*v:servername* +v:shell_error ../../plugins/vimdoc-ja/doc/eval.jax /*v:shell_error* +v:statusmsg ../../plugins/vimdoc-ja/doc/eval.jax /*v:statusmsg* +v:swapchoice ../../plugins/vimdoc-ja/doc/eval.jax /*v:swapchoice* +v:swapcommand ../../plugins/vimdoc-ja/doc/eval.jax /*v:swapcommand* +v:swapname ../../plugins/vimdoc-ja/doc/eval.jax /*v:swapname* +v:t_TYPE ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_TYPE* +v:t_bool ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_bool* +v:t_channel ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_channel* +v:t_dict ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_dict* +v:t_float ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_float* +v:t_func ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_func* +v:t_job ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_job* +v:t_list ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_list* +v:t_none ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_none* +v:t_number ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_number* +v:t_string ../../plugins/vimdoc-ja/doc/eval.jax /*v:t_string* +v:termresponse ../../plugins/vimdoc-ja/doc/eval.jax /*v:termresponse* +v:testing ../../plugins/vimdoc-ja/doc/eval.jax /*v:testing* +v:this_session ../../plugins/vimdoc-ja/doc/eval.jax /*v:this_session* +v:throwpoint ../../plugins/vimdoc-ja/doc/eval.jax /*v:throwpoint* +v:true ../../plugins/vimdoc-ja/doc/eval.jax /*v:true* +v:val ../../plugins/vimdoc-ja/doc/eval.jax /*v:val* +v:var ../../plugins/vimdoc-ja/doc/eval.jax /*v:var* +v:version ../../plugins/vimdoc-ja/doc/eval.jax /*v:version* +v:vim_did_enter ../../plugins/vimdoc-ja/doc/eval.jax /*v:vim_did_enter* +v:warningmsg ../../plugins/vimdoc-ja/doc/eval.jax /*v:warningmsg* +v:windowid ../../plugins/vimdoc-ja/doc/eval.jax /*v:windowid* +v_! ../../plugins/vimdoc-ja/doc/change.jax /*v_!* +v_$ ../../plugins/vimdoc-ja/doc/visual.jax /*v_$* +v_: ../../plugins/vimdoc-ja/doc/cmdline.jax /*v_:* +v_< ../../plugins/vimdoc-ja/doc/change.jax /*v_<* +v_<BS> ../../plugins/vimdoc-ja/doc/change.jax /*v_<BS>* +v_<Del> ../../plugins/vimdoc-ja/doc/change.jax /*v_<Del>* +v_<Esc> ../../plugins/vimdoc-ja/doc/visual.jax /*v_<Esc>* +v_= ../../plugins/vimdoc-ja/doc/change.jax /*v_=* +v_> ../../plugins/vimdoc-ja/doc/change.jax /*v_>* +v_C ../../plugins/vimdoc-ja/doc/change.jax /*v_C* +v_CTRL-A ../../plugins/vimdoc-ja/doc/change.jax /*v_CTRL-A* +v_CTRL-C ../../plugins/vimdoc-ja/doc/visual.jax /*v_CTRL-C* +v_CTRL-G ../../plugins/vimdoc-ja/doc/visual.jax /*v_CTRL-G* +v_CTRL-H ../../plugins/vimdoc-ja/doc/change.jax /*v_CTRL-H* +v_CTRL-O ../../plugins/vimdoc-ja/doc/visual.jax /*v_CTRL-O* +v_CTRL-V ../../plugins/vimdoc-ja/doc/visual.jax /*v_CTRL-V* +v_CTRL-X ../../plugins/vimdoc-ja/doc/change.jax /*v_CTRL-X* +v_CTRL-Z ../../plugins/vimdoc-ja/doc/starting.jax /*v_CTRL-Z* +v_CTRL-\_CTRL-G ../../plugins/vimdoc-ja/doc/intro.jax /*v_CTRL-\\_CTRL-G* +v_CTRL-\_CTRL-N ../../plugins/vimdoc-ja/doc/intro.jax /*v_CTRL-\\_CTRL-N* +v_CTRL-] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*v_CTRL-]* +v_D ../../plugins/vimdoc-ja/doc/change.jax /*v_D* +v_J ../../plugins/vimdoc-ja/doc/change.jax /*v_J* +v_K ../../plugins/vimdoc-ja/doc/various.jax /*v_K* +v_O ../../plugins/vimdoc-ja/doc/visual.jax /*v_O* +v_P ../../plugins/vimdoc-ja/doc/change.jax /*v_P* +v_R ../../plugins/vimdoc-ja/doc/change.jax /*v_R* +v_S ../../plugins/vimdoc-ja/doc/change.jax /*v_S* +v_U ../../plugins/vimdoc-ja/doc/change.jax /*v_U* +v_V ../../plugins/vimdoc-ja/doc/visual.jax /*v_V* +v_X ../../plugins/vimdoc-ja/doc/change.jax /*v_X* +v_Y ../../plugins/vimdoc-ja/doc/change.jax /*v_Y* +v_a ../../plugins/vimdoc-ja/doc/motion.jax /*v_a* +v_a' ../../plugins/vimdoc-ja/doc/motion.jax /*v_a'* +v_a( ../../plugins/vimdoc-ja/doc/motion.jax /*v_a(* +v_a) ../../plugins/vimdoc-ja/doc/motion.jax /*v_a)* +v_a< ../../plugins/vimdoc-ja/doc/motion.jax /*v_a<* +v_a> ../../plugins/vimdoc-ja/doc/motion.jax /*v_a>* +v_aB ../../plugins/vimdoc-ja/doc/motion.jax /*v_aB* +v_aW ../../plugins/vimdoc-ja/doc/motion.jax /*v_aW* +v_a[ ../../plugins/vimdoc-ja/doc/motion.jax /*v_a[* +v_a] ../../plugins/vimdoc-ja/doc/motion.jax /*v_a]* +v_a` ../../plugins/vimdoc-ja/doc/motion.jax /*v_a`* +v_ab ../../plugins/vimdoc-ja/doc/motion.jax /*v_ab* +v_ap ../../plugins/vimdoc-ja/doc/motion.jax /*v_ap* +v_aquote ../../plugins/vimdoc-ja/doc/motion.jax /*v_aquote* +v_as ../../plugins/vimdoc-ja/doc/motion.jax /*v_as* +v_at ../../plugins/vimdoc-ja/doc/motion.jax /*v_at* +v_aw ../../plugins/vimdoc-ja/doc/motion.jax /*v_aw* +v_a{ ../../plugins/vimdoc-ja/doc/motion.jax /*v_a{* +v_a} ../../plugins/vimdoc-ja/doc/motion.jax /*v_a}* +v_b_< ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_<* +v_b_<_example ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_<_example* +v_b_> ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_>* +v_b_>_example ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_>_example* +v_b_A ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_A* +v_b_A_example ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_A_example* +v_b_C ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_C* +v_b_D ../../plugins/vimdoc-ja/doc/change.jax /*v_b_D* +v_b_I ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_I* +v_b_I_example ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_I_example* +v_b_c ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_c* +v_b_r ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_r* +v_b_r_example ../../plugins/vimdoc-ja/doc/visual.jax /*v_b_r_example* +v_c ../../plugins/vimdoc-ja/doc/change.jax /*v_c* +v_d ../../plugins/vimdoc-ja/doc/change.jax /*v_d* +v_g? ../../plugins/vimdoc-ja/doc/change.jax /*v_g?* +v_gF ../../plugins/vimdoc-ja/doc/editing.jax /*v_gF* +v_gJ ../../plugins/vimdoc-ja/doc/change.jax /*v_gJ* +v_gN ../../plugins/vimdoc-ja/doc/visual.jax /*v_gN* +v_gV ../../plugins/vimdoc-ja/doc/visual.jax /*v_gV* +v_g] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*v_g]* +v_g_CTRL-A ../../plugins/vimdoc-ja/doc/change.jax /*v_g_CTRL-A* +v_g_CTRL-G ../../plugins/vimdoc-ja/doc/editing.jax /*v_g_CTRL-G* +v_g_CTRL-X ../../plugins/vimdoc-ja/doc/change.jax /*v_g_CTRL-X* +v_g_CTRL-] ../../plugins/vimdoc-ja/doc/tagsrch.jax /*v_g_CTRL-]* +v_gf ../../plugins/vimdoc-ja/doc/editing.jax /*v_gf* +v_gn ../../plugins/vimdoc-ja/doc/visual.jax /*v_gn* +v_gq ../../plugins/vimdoc-ja/doc/change.jax /*v_gq* +v_gv ../../plugins/vimdoc-ja/doc/visual.jax /*v_gv* +v_gw ../../plugins/vimdoc-ja/doc/change.jax /*v_gw* +v_i ../../plugins/vimdoc-ja/doc/motion.jax /*v_i* +v_i' ../../plugins/vimdoc-ja/doc/motion.jax /*v_i'* +v_i( ../../plugins/vimdoc-ja/doc/motion.jax /*v_i(* +v_i) ../../plugins/vimdoc-ja/doc/motion.jax /*v_i)* +v_i< ../../plugins/vimdoc-ja/doc/motion.jax /*v_i<* +v_i> ../../plugins/vimdoc-ja/doc/motion.jax /*v_i>* +v_iB ../../plugins/vimdoc-ja/doc/motion.jax /*v_iB* +v_iW ../../plugins/vimdoc-ja/doc/motion.jax /*v_iW* +v_i[ ../../plugins/vimdoc-ja/doc/motion.jax /*v_i[* +v_i] ../../plugins/vimdoc-ja/doc/motion.jax /*v_i]* +v_i` ../../plugins/vimdoc-ja/doc/motion.jax /*v_i`* +v_ib ../../plugins/vimdoc-ja/doc/motion.jax /*v_ib* +v_ip ../../plugins/vimdoc-ja/doc/motion.jax /*v_ip* +v_iquote ../../plugins/vimdoc-ja/doc/motion.jax /*v_iquote* +v_is ../../plugins/vimdoc-ja/doc/motion.jax /*v_is* +v_it ../../plugins/vimdoc-ja/doc/motion.jax /*v_it* +v_iw ../../plugins/vimdoc-ja/doc/motion.jax /*v_iw* +v_i{ ../../plugins/vimdoc-ja/doc/motion.jax /*v_i{* +v_i} ../../plugins/vimdoc-ja/doc/motion.jax /*v_i}* +v_o ../../plugins/vimdoc-ja/doc/visual.jax /*v_o* +v_p ../../plugins/vimdoc-ja/doc/change.jax /*v_p* +v_r ../../plugins/vimdoc-ja/doc/change.jax /*v_r* +v_s ../../plugins/vimdoc-ja/doc/change.jax /*v_s* +v_u ../../plugins/vimdoc-ja/doc/change.jax /*v_u* +v_v ../../plugins/vimdoc-ja/doc/visual.jax /*v_v* +v_x ../../plugins/vimdoc-ja/doc/change.jax /*v_x* +v_y ../../plugins/vimdoc-ja/doc/change.jax /*v_y* +v_~ ../../plugins/vimdoc-ja/doc/change.jax /*v_~* +vab ../../plugins/vimdoc-ja/doc/motion.jax /*vab* +val-variable ../../plugins/vimdoc-ja/doc/eval.jax /*val-variable* +valgrind ../../plugins/vimdoc-ja/doc/debug.jax /*valgrind* +values() ../../plugins/vimdoc-ja/doc/eval.jax /*values()* +var-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*var-functions* +variables ../../plugins/vimdoc-ja/doc/eval.jax /*variables* +various ../../plugins/vimdoc-ja/doc/various.jax /*various* +various-cmds ../../plugins/vimdoc-ja/doc/various.jax /*various-cmds* +various-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*various-functions* +various-motions ../../plugins/vimdoc-ja/doc/motion.jax /*various-motions* +various.txt ../../plugins/vimdoc-ja/doc/various.jax /*various.txt* +vb.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*vb.vim* +vba ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vba* +verbose ../../plugins/vimdoc-ja/doc/starting.jax /*verbose* +version-variable ../../plugins/vimdoc-ja/doc/eval.jax /*version-variable* +version4.txt ../../plugins/vimdoc-ja/doc/version4.jax /*version4.txt* +vi ../../plugins/vimdoc-ja/doc/intro.jax /*vi* +vi-differences ../../plugins/vimdoc-ja/doc/vi_diff.jax /*vi-differences* +vi: ../../plugins/vimdoc-ja/doc/options.jax /*vi:* +vi_diff.txt ../../plugins/vimdoc-ja/doc/vi_diff.jax /*vi_diff.txt* +vib ../../plugins/vimdoc-ja/doc/motion.jax /*vib* +view ../../plugins/vimdoc-ja/doc/starting.jax /*view* +view-diffs ../../plugins/vimdoc-ja/doc/diff.jax /*view-diffs* +view-file ../../plugins/vimdoc-ja/doc/starting.jax /*view-file* +views-sessions ../../plugins/vimdoc-ja/doc/starting.jax /*views-sessions* +vim-additions ../../plugins/vimdoc-ja/doc/vi_diff.jax /*vim-additions* +vim-announce ../../plugins/vimdoc-ja/doc/intro.jax /*vim-announce* +vim-arguments ../../plugins/vimdoc-ja/doc/starting.jax /*vim-arguments* +vim-default-editor ../../plugins/vimdoc-ja/doc/gui_w32.jax /*vim-default-editor* +vim-dev ../../plugins/vimdoc-ja/doc/intro.jax /*vim-dev* +vim-mac ../../plugins/vimdoc-ja/doc/intro.jax /*vim-mac* +vim-modes ../../plugins/vimdoc-ja/doc/intro.jax /*vim-modes* +vim-modes-intro ../../plugins/vimdoc-ja/doc/intro.jax /*vim-modes-intro* +vim-multibyte ../../plugins/vimdoc-ja/doc/intro.jax /*vim-multibyte* +vim-script-intro ../../plugins/vimdoc-ja/doc/usr_41.jax /*vim-script-intro* +vim-variable ../../plugins/vimdoc-ja/doc/eval.jax /*vim-variable* +vim.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*vim.vim* +vim: ../../plugins/vimdoc-ja/doc/options.jax /*vim:* +vim_did_enter-variable ../../plugins/vimdoc-ja/doc/eval.jax /*vim_did_enter-variable* +vim_starting ../../plugins/vimdoc-ja/doc/eval.jax /*vim_starting* +vimball ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball* +vimball-contents ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-contents* +vimball-extract ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-extract* +vimball-history ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-history* +vimball-intro ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-intro* +vimball-manual ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-manual* +vimball-windows ../../plugins/vimdoc-ja/doc/pi_vimball.jax /*vimball-windows* +vimdev ../../plugins/vimdoc-ja/doc/intro.jax /*vimdev* +vimdiff ../../plugins/vimdoc-ja/doc/diff.jax /*vimdiff* +vimfiles ../../plugins/vimdoc-ja/doc/options.jax /*vimfiles* +viminfo ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo* +viminfo-! ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-!* +viminfo-% ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-%* +viminfo-' ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-'* +viminfo-/ ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-\/* +viminfo-: ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-:* +viminfo-< ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-<* +viminfo-@ ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-@* +viminfo-c ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-c* +viminfo-encoding ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-encoding* +viminfo-errors ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-errors* +viminfo-f ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-f* +viminfo-file ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-file* +viminfo-file-marks ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-file-marks* +viminfo-file-name ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-file-name* +viminfo-h ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-h* +viminfo-n ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-n* +viminfo-quote ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-quote* +viminfo-r ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-r* +viminfo-read ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-read* +viminfo-read-write ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-read-write* +viminfo-s ../../plugins/vimdoc-ja/doc/options.jax /*viminfo-s* +viminfo-timestamp ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-timestamp* +viminfo-write ../../plugins/vimdoc-ja/doc/starting.jax /*viminfo-write* +vimrc ../../plugins/vimdoc-ja/doc/starting.jax /*vimrc* +vimrc-filetype ../../plugins/vimdoc-ja/doc/usr_05.jax /*vimrc-filetype* +vimrc-intro ../../plugins/vimdoc-ja/doc/usr_05.jax /*vimrc-intro* +vimrc-option-example ../../plugins/vimdoc-ja/doc/starting.jax /*vimrc-option-example* +vimrc_example.vim ../../plugins/vimdoc-ja/doc/usr_05.jax /*vimrc_example.vim* +vimtutor ../../plugins/vimdoc-ja/doc/usr_01.jax /*vimtutor* +virtcol() ../../plugins/vimdoc-ja/doc/eval.jax /*virtcol()* +visual-block ../../plugins/vimdoc-ja/doc/visual.jax /*visual-block* +visual-change ../../plugins/vimdoc-ja/doc/visual.jax /*visual-change* +visual-examples ../../plugins/vimdoc-ja/doc/visual.jax /*visual-examples* +visual-index ../../plugins/vimdoc-ja/doc/index.jax /*visual-index* +visual-mode ../../plugins/vimdoc-ja/doc/visual.jax /*visual-mode* +visual-operators ../../plugins/vimdoc-ja/doc/visual.jax /*visual-operators* +visual-repeat ../../plugins/vimdoc-ja/doc/visual.jax /*visual-repeat* +visual-search ../../plugins/vimdoc-ja/doc/visual.jax /*visual-search* +visual-start ../../plugins/vimdoc-ja/doc/visual.jax /*visual-start* +visual-use ../../plugins/vimdoc-ja/doc/visual.jax /*visual-use* +visual.txt ../../plugins/vimdoc-ja/doc/visual.jax /*visual.txt* +visualmode() ../../plugins/vimdoc-ja/doc/eval.jax /*visualmode()* +vms ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms* +vms-authors ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-authors* +vms-changes ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-changes* +vms-compiling ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-compiling* +vms-deploy ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-deploy* +vms-download ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-download* +vms-gui ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-gui* +vms-notes ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-notes* +vms-problems ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-problems* +vms-started ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-started* +vms-usage ../../plugins/vimdoc-ja/doc/os_vms.jax /*vms-usage* +vote-for-features ../../plugins/vimdoc-ja/doc/sponsor.jax /*vote-for-features* +votes-counted ../../plugins/vimdoc-ja/doc/sponsor.jax /*votes-counted* +vreplace-mode ../../plugins/vimdoc-ja/doc/insert.jax /*vreplace-mode* +vt100-cursor-keys ../../plugins/vimdoc-ja/doc/term.jax /*vt100-cursor-keys* +vt100-function-keys ../../plugins/vimdoc-ja/doc/term.jax /*vt100-function-keys* +w ../../plugins/vimdoc-ja/doc/motion.jax /*w* +w32-clientserver ../../plugins/vimdoc-ja/doc/remote.jax /*w32-clientserver* +w32-xpm-support ../../plugins/vimdoc-ja/doc/gui_w32.jax /*w32-xpm-support* +w: ../../plugins/vimdoc-ja/doc/eval.jax /*w:* +w:current_syntax ../../plugins/vimdoc-ja/doc/syntax.jax /*w:current_syntax* +w:quickfix_title ../../plugins/vimdoc-ja/doc/quickfix.jax /*w:quickfix_title* +w:var ../../plugins/vimdoc-ja/doc/eval.jax /*w:var* +waittime ../../plugins/vimdoc-ja/doc/channel.jax /*waittime* +warningmsg-variable ../../plugins/vimdoc-ja/doc/eval.jax /*warningmsg-variable* +white-space ../../plugins/vimdoc-ja/doc/pattern.jax /*white-space* +whitespace ../../plugins/vimdoc-ja/doc/pattern.jax /*whitespace* +wildcard ../../plugins/vimdoc-ja/doc/editing.jax /*wildcard* +wildcards ../../plugins/vimdoc-ja/doc/editing.jax /*wildcards* +wildmenumode() ../../plugins/vimdoc-ja/doc/eval.jax /*wildmenumode()* +win32 ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32* +win32-!start ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-!start* +win32-PATH ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-PATH* +win32-colors ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-colors* +win32-compiling ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-compiling* +win32-curdir ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-curdir* +win32-faq ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-faq* +win32-gettext ../../plugins/vimdoc-ja/doc/mlang.jax /*win32-gettext* +win32-gui ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-gui* +win32-hidden-menus ../../plugins/vimdoc-ja/doc/gui.jax /*win32-hidden-menus* +win32-mouse ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-mouse* +win32-open-with-menu ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-open-with-menu* +win32-popup-menu ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-popup-menu* +win32-problems ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-problems* +win32-quotes ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-quotes* +win32-restore ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-restore* +win32-startup ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-startup* +win32-term ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-term* +win32-vimrun ../../plugins/vimdoc-ja/doc/gui_w32.jax /*win32-vimrun* +win32-win3.1 ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32-win3.1* +win32s ../../plugins/vimdoc-ja/doc/os_win32.jax /*win32s* +win_findbuf() ../../plugins/vimdoc-ja/doc/eval.jax /*win_findbuf()* +win_getid() ../../plugins/vimdoc-ja/doc/eval.jax /*win_getid()* +win_gotoid() ../../plugins/vimdoc-ja/doc/eval.jax /*win_gotoid()* +win_id2tabwin() ../../plugins/vimdoc-ja/doc/eval.jax /*win_id2tabwin()* +win_id2win() ../../plugins/vimdoc-ja/doc/eval.jax /*win_id2win()* +winbufnr() ../../plugins/vimdoc-ja/doc/eval.jax /*winbufnr()* +wincol() ../../plugins/vimdoc-ja/doc/eval.jax /*wincol()* +window ../../plugins/vimdoc-ja/doc/windows.jax /*window* +window-ID ../../plugins/vimdoc-ja/doc/windows.jax /*window-ID* +window-contents ../../plugins/vimdoc-ja/doc/intro.jax /*window-contents* +window-exit ../../plugins/vimdoc-ja/doc/editing.jax /*window-exit* +window-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*window-functions* +window-move-cursor ../../plugins/vimdoc-ja/doc/windows.jax /*window-move-cursor* +window-moving ../../plugins/vimdoc-ja/doc/windows.jax /*window-moving* +window-resize ../../plugins/vimdoc-ja/doc/windows.jax /*window-resize* +window-size ../../plugins/vimdoc-ja/doc/term.jax /*window-size* +window-size-functions ../../plugins/vimdoc-ja/doc/usr_41.jax /*window-size-functions* +window-tag ../../plugins/vimdoc-ja/doc/windows.jax /*window-tag* +window-variable ../../plugins/vimdoc-ja/doc/eval.jax /*window-variable* +windowid ../../plugins/vimdoc-ja/doc/windows.jax /*windowid* +windowid-variable ../../plugins/vimdoc-ja/doc/eval.jax /*windowid-variable* +windows ../../plugins/vimdoc-ja/doc/windows.jax /*windows* +windows-3.1 ../../plugins/vimdoc-ja/doc/os_win32.jax /*windows-3.1* +windows-icon ../../plugins/vimdoc-ja/doc/os_win32.jax /*windows-icon* +windows-intro ../../plugins/vimdoc-ja/doc/windows.jax /*windows-intro* +windows-starting ../../plugins/vimdoc-ja/doc/windows.jax /*windows-starting* +windows.txt ../../plugins/vimdoc-ja/doc/windows.jax /*windows.txt* +windows95 ../../plugins/vimdoc-ja/doc/os_win32.jax /*windows95* +winheight() ../../plugins/vimdoc-ja/doc/eval.jax /*winheight()* +winid ../../plugins/vimdoc-ja/doc/windows.jax /*winid* +winline() ../../plugins/vimdoc-ja/doc/eval.jax /*winline()* +winnr() ../../plugins/vimdoc-ja/doc/eval.jax /*winnr()* +winrestcmd() ../../plugins/vimdoc-ja/doc/eval.jax /*winrestcmd()* +winrestview() ../../plugins/vimdoc-ja/doc/eval.jax /*winrestview()* +winsaveview() ../../plugins/vimdoc-ja/doc/eval.jax /*winsaveview()* +winwidth() ../../plugins/vimdoc-ja/doc/eval.jax /*winwidth()* +word ../../plugins/vimdoc-ja/doc/motion.jax /*word* +word-count ../../plugins/vimdoc-ja/doc/editing.jax /*word-count* +word-motions ../../plugins/vimdoc-ja/doc/motion.jax /*word-motions* +wordcount() ../../plugins/vimdoc-ja/doc/eval.jax /*wordcount()* +workbench ../../plugins/vimdoc-ja/doc/starting.jax /*workbench* +workshop ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop* +workshop-commands ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-commands* +workshop-compiling ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-compiling* +workshop-configure ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-configure* +workshop-intro ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-intro* +workshop-support ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-support* +workshop-xpm ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop-xpm* +workshop.txt ../../plugins/vimdoc-ja/doc/workshop.jax /*workshop.txt* +wrap-off ../../plugins/vimdoc-ja/doc/intro.jax /*wrap-off* +write-compiler-plugin ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-compiler-plugin* +write-device ../../plugins/vimdoc-ja/doc/editing.jax /*write-device* +write-fail ../../plugins/vimdoc-ja/doc/editing.jax /*write-fail* +write-filetype-plugin ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-filetype-plugin* +write-library-script ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-library-script* +write-local-help ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-local-help* +write-permissions ../../plugins/vimdoc-ja/doc/editing.jax /*write-permissions* +write-plugin ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-plugin* +write-plugin-quickload ../../plugins/vimdoc-ja/doc/usr_41.jax /*write-plugin-quickload* +write-quit ../../plugins/vimdoc-ja/doc/editing.jax /*write-quit* +write-readonly ../../plugins/vimdoc-ja/doc/editing.jax /*write-readonly* +writefile() ../../plugins/vimdoc-ja/doc/eval.jax /*writefile()* +writing ../../plugins/vimdoc-ja/doc/editing.jax /*writing* +www ../../plugins/vimdoc-ja/doc/intro.jax /*www* +x ../../plugins/vimdoc-ja/doc/change.jax /*x* +x-input-method ../../plugins/vimdoc-ja/doc/mbyte.jax /*x-input-method* +x11-clientserver ../../plugins/vimdoc-ja/doc/remote.jax /*x11-clientserver* +x11-cut-buffer ../../plugins/vimdoc-ja/doc/gui_x11.jax /*x11-cut-buffer* +x11-selection ../../plugins/vimdoc-ja/doc/gui_x11.jax /*x11-selection* +xf86conf.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*xf86conf.vim* +xfontset ../../plugins/vimdoc-ja/doc/mbyte.jax /*xfontset* +xfree-xterm ../../plugins/vimdoc-ja/doc/syntax.jax /*xfree-xterm* +xim ../../plugins/vimdoc-ja/doc/mbyte.jax /*xim* +xim-input-style ../../plugins/vimdoc-ja/doc/mbyte.jax /*xim-input-style* +xiterm ../../plugins/vimdoc-ja/doc/syntax.jax /*xiterm* +xml-folding ../../plugins/vimdoc-ja/doc/syntax.jax /*xml-folding* +xml-omni-datafile ../../plugins/vimdoc-ja/doc/insert.jax /*xml-omni-datafile* +xml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*xml.vim* +xor() ../../plugins/vimdoc-ja/doc/eval.jax /*xor()* +xpm.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*xpm.vim* +xterm-8-bit ../../plugins/vimdoc-ja/doc/term.jax /*xterm-8-bit* +xterm-8bit ../../plugins/vimdoc-ja/doc/term.jax /*xterm-8bit* +xterm-blink ../../plugins/vimdoc-ja/doc/syntax.jax /*xterm-blink* +xterm-blinking-cursor ../../plugins/vimdoc-ja/doc/syntax.jax /*xterm-blinking-cursor* +xterm-clipboard ../../plugins/vimdoc-ja/doc/term.jax /*xterm-clipboard* +xterm-codes ../../plugins/vimdoc-ja/doc/term.jax /*xterm-codes* +xterm-color ../../plugins/vimdoc-ja/doc/syntax.jax /*xterm-color* +xterm-command-server ../../plugins/vimdoc-ja/doc/term.jax /*xterm-command-server* +xterm-copy-paste ../../plugins/vimdoc-ja/doc/term.jax /*xterm-copy-paste* +xterm-cursor-keys ../../plugins/vimdoc-ja/doc/term.jax /*xterm-cursor-keys* +xterm-end-home-keys ../../plugins/vimdoc-ja/doc/term.jax /*xterm-end-home-keys* +xterm-function-keys ../../plugins/vimdoc-ja/doc/term.jax /*xterm-function-keys* +xterm-modifier-keys ../../plugins/vimdoc-ja/doc/term.jax /*xterm-modifier-keys* +xterm-mouse ../../plugins/vimdoc-ja/doc/options.jax /*xterm-mouse* +xterm-mouse-wheel ../../plugins/vimdoc-ja/doc/scroll.jax /*xterm-mouse-wheel* +xterm-resize ../../plugins/vimdoc-ja/doc/term.jax /*xterm-resize* +xterm-save-screen ../../plugins/vimdoc-ja/doc/tips.jax /*xterm-save-screen* +xterm-screens ../../plugins/vimdoc-ja/doc/tips.jax /*xterm-screens* +xterm-scroll-region ../../plugins/vimdoc-ja/doc/term.jax /*xterm-scroll-region* +xterm-shifted-keys ../../plugins/vimdoc-ja/doc/term.jax /*xterm-shifted-keys* +xterm-true-color ../../plugins/vimdoc-ja/doc/term.jax /*xterm-true-color* +y ../../plugins/vimdoc-ja/doc/change.jax /*y* +yaml.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*yaml.vim* +yank ../../plugins/vimdoc-ja/doc/change.jax /*yank* +ye-option-gone ../../plugins/vimdoc-ja/doc/version4.jax /*ye-option-gone* +year-2000 ../../plugins/vimdoc-ja/doc/intro.jax /*year-2000* +your-runtime-dir ../../plugins/vimdoc-ja/doc/usr_43.jax /*your-runtime-dir* +yy ../../plugins/vimdoc-ja/doc/change.jax /*yy* +z ../../plugins/vimdoc-ja/doc/index.jax /*z* +z+ ../../plugins/vimdoc-ja/doc/scroll.jax /*z+* +z- ../../plugins/vimdoc-ja/doc/scroll.jax /*z-* +z. ../../plugins/vimdoc-ja/doc/scroll.jax /*z.* +z/OS ../../plugins/vimdoc-ja/doc/os_390.jax /*z\/OS* +z<CR> ../../plugins/vimdoc-ja/doc/scroll.jax /*z<CR>* +z<Left> ../../plugins/vimdoc-ja/doc/scroll.jax /*z<Left>* +z<Right> ../../plugins/vimdoc-ja/doc/scroll.jax /*z<Right>* +z= ../../plugins/vimdoc-ja/doc/spell.jax /*z=* +zA ../../plugins/vimdoc-ja/doc/fold.jax /*zA* +zC ../../plugins/vimdoc-ja/doc/fold.jax /*zC* +zD ../../plugins/vimdoc-ja/doc/fold.jax /*zD* +zE ../../plugins/vimdoc-ja/doc/fold.jax /*zE* +zF ../../plugins/vimdoc-ja/doc/fold.jax /*zF* +zG ../../plugins/vimdoc-ja/doc/spell.jax /*zG* +zH ../../plugins/vimdoc-ja/doc/scroll.jax /*zH* +zL ../../plugins/vimdoc-ja/doc/scroll.jax /*zL* +zM ../../plugins/vimdoc-ja/doc/fold.jax /*zM* +zN ../../plugins/vimdoc-ja/doc/fold.jax /*zN* +zN<CR> ../../plugins/vimdoc-ja/doc/scroll.jax /*zN<CR>* +zO ../../plugins/vimdoc-ja/doc/fold.jax /*zO* +zOS ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS* +zOS-Bugs ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-Bugs* +zOS-Motif ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-Motif* +zOS-PuTTY ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-PuTTY* +zOS-has-ebcdic ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-has-ebcdic* +zOS-limitations ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-limitations* +zOS-open-source ../../plugins/vimdoc-ja/doc/os_390.jax /*zOS-open-source* +zR ../../plugins/vimdoc-ja/doc/fold.jax /*zR* +zW ../../plugins/vimdoc-ja/doc/spell.jax /*zW* +zX ../../plugins/vimdoc-ja/doc/fold.jax /*zX* +z^ ../../plugins/vimdoc-ja/doc/scroll.jax /*z^* +za ../../plugins/vimdoc-ja/doc/fold.jax /*za* +zb ../../plugins/vimdoc-ja/doc/scroll.jax /*zb* +zc ../../plugins/vimdoc-ja/doc/fold.jax /*zc* +zd ../../plugins/vimdoc-ja/doc/fold.jax /*zd* +ze ../../plugins/vimdoc-ja/doc/scroll.jax /*ze* +zf ../../plugins/vimdoc-ja/doc/fold.jax /*zf* +zg ../../plugins/vimdoc-ja/doc/spell.jax /*zg* +zh ../../plugins/vimdoc-ja/doc/scroll.jax /*zh* +zi ../../plugins/vimdoc-ja/doc/fold.jax /*zi* +zip ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip* +zip-contents ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-contents* +zip-copyright ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-copyright* +zip-extension ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-extension* +zip-history ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-history* +zip-manual ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-manual* +zip-usage ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-usage* +zip-x ../../plugins/vimdoc-ja/doc/pi_zip.jax /*zip-x* +zj ../../plugins/vimdoc-ja/doc/fold.jax /*zj* +zk ../../plugins/vimdoc-ja/doc/fold.jax /*zk* +zl ../../plugins/vimdoc-ja/doc/scroll.jax /*zl* +zm ../../plugins/vimdoc-ja/doc/fold.jax /*zm* +zn ../../plugins/vimdoc-ja/doc/fold.jax /*zn* +zo ../../plugins/vimdoc-ja/doc/fold.jax /*zo* +zr ../../plugins/vimdoc-ja/doc/fold.jax /*zr* +zs ../../plugins/vimdoc-ja/doc/scroll.jax /*zs* +zsh.vim ../../plugins/vimdoc-ja/doc/syntax.jax /*zsh.vim* +zt ../../plugins/vimdoc-ja/doc/scroll.jax /*zt* +zuG ../../plugins/vimdoc-ja/doc/spell.jax /*zuG* +zuW ../../plugins/vimdoc-ja/doc/spell.jax /*zuW* +zug ../../plugins/vimdoc-ja/doc/spell.jax /*zug* +zuw ../../plugins/vimdoc-ja/doc/spell.jax /*zuw* +zv ../../plugins/vimdoc-ja/doc/fold.jax /*zv* +zw ../../plugins/vimdoc-ja/doc/spell.jax /*zw* +zx ../../plugins/vimdoc-ja/doc/fold.jax /*zx* +zz ../../plugins/vimdoc-ja/doc/scroll.jax /*zz* +{ ../../plugins/vimdoc-ja/doc/motion.jax /*{* +{Visual} ../../plugins/vimdoc-ja/doc/intro.jax /*{Visual}* +{address} ../../plugins/vimdoc-ja/doc/cmdline.jax /*{address}* +{arglist} ../../plugins/vimdoc-ja/doc/editing.jax /*{arglist}* +{char1-char2} ../../plugins/vimdoc-ja/doc/intro.jax /*{char1-char2}* +{event} ../../plugins/vimdoc-ja/doc/autocmd.jax /*{event}* +{file} ../../plugins/vimdoc-ja/doc/editing.jax /*{file}* +{group-name} ../../plugins/vimdoc-ja/doc/syntax.jax /*{group-name}* +{lhs} ../../plugins/vimdoc-ja/doc/map.jax /*{lhs}* +{motion} ../../plugins/vimdoc-ja/doc/intro.jax /*{motion}* +{move-around} ../../plugins/vimdoc-ja/doc/visual.jax /*{move-around}* +{offset} ../../plugins/vimdoc-ja/doc/pattern.jax /*{offset}* +{pat} ../../plugins/vimdoc-ja/doc/autocmd.jax /*{pat}* +{rhs} ../../plugins/vimdoc-ja/doc/map.jax /*{rhs}* +{subject} ../../plugins/vimdoc-ja/doc/helphelp.jax /*{subject}* +{} ../../plugins/vimdoc-ja/doc/intro.jax /*{}* +} ../../plugins/vimdoc-ja/doc/motion.jax /*}* +~ ../../plugins/vimdoc-ja/doc/change.jax /*~* diff --git a/plugins/vimdoc-ja/doc/tags-ja b/plugins/vimdoc-ja/doc/tags-ja new file mode 100644 index 0000000000..e2dc8c3ea5 --- /dev/null +++ b/plugins/vimdoc-ja/doc/tags-ja @@ -0,0 +1,9243 @@ +!_TAG_FILE_ENCODING utf-8 // +! change.jax /*!* +!! change.jax /*!!* +# pattern.jax /*#* +$ motion.jax /*$* +$HOME options.jax /*$HOME* +$MYGVIMRC gui.jax /*$MYGVIMRC* +$MYVIMRC starting.jax /*$MYVIMRC* +$VIM starting.jax /*$VIM* +$VIMRUNTIME starting.jax /*$VIMRUNTIME* +$VIM_POSIX vi_diff.jax /*$VIM_POSIX* +% motion.jax /*%* +%:. cmdline.jax /*%:.* +%:8 cmdline.jax /*%:8* +%:S cmdline.jax /*%:S* +%:e cmdline.jax /*%:e* +%:gs cmdline.jax /*%:gs* +%:h cmdline.jax /*%:h* +%:p cmdline.jax /*%:p* +%:r cmdline.jax /*%:r* +%:s cmdline.jax /*%:s* +%:t cmdline.jax /*%:t* +%:~ cmdline.jax /*%:~* +& change.jax /*&* +' motion.jax /*'* +'' motion.jax /*''* +'( motion.jax /*'(* +') motion.jax /*')* +'. motion.jax /*'.* +'0 motion.jax /*'0* +'< motion.jax /*'<* +'> motion.jax /*'>* +'A motion.jax /*'A* +'[ motion.jax /*'[* +'] motion.jax /*']* +'^ motion.jax /*'^* +'a motion.jax /*'a* +'acd' options.jax /*'acd'* +'ai' options.jax /*'ai'* +'akm' options.jax /*'akm'* +'al' options.jax /*'al'* +'aleph' options.jax /*'aleph'* +'allowrevins' options.jax /*'allowrevins'* +'altkeymap' options.jax /*'altkeymap'* +'ambiwidth' options.jax /*'ambiwidth'* +'ambw' options.jax /*'ambw'* +'anti' options.jax /*'anti'* +'antialias' options.jax /*'antialias'* +'ap' vi_diff.jax /*'ap'* +'ar' options.jax /*'ar'* +'arab' options.jax /*'arab'* +'arabic' options.jax /*'arabic'* +'arabicshape' options.jax /*'arabicshape'* +'ari' options.jax /*'ari'* +'arshape' options.jax /*'arshape'* +'autochdir' options.jax /*'autochdir'* +'autoindent' options.jax /*'autoindent'* +'autoprint' vi_diff.jax /*'autoprint'* +'autoread' options.jax /*'autoread'* +'autowrite' options.jax /*'autowrite'* +'autowriteall' options.jax /*'autowriteall'* +'aw' options.jax /*'aw'* +'awa' options.jax /*'awa'* +'background' options.jax /*'background'* +'backspace' options.jax /*'backspace'* +'backup' options.jax /*'backup'* +'backupcopy' options.jax /*'backupcopy'* +'backupdir' options.jax /*'backupdir'* +'backupext' options.jax /*'backupext'* +'backupskip' options.jax /*'backupskip'* +'balloondelay' options.jax /*'balloondelay'* +'ballooneval' options.jax /*'ballooneval'* +'balloonexpr' options.jax /*'balloonexpr'* +'bdir' options.jax /*'bdir'* +'bdlay' options.jax /*'bdlay'* +'beautify' vi_diff.jax /*'beautify'* +'belloff' options.jax /*'belloff'* +'beval' options.jax /*'beval'* +'bex' options.jax /*'bex'* +'bexpr' options.jax /*'bexpr'* +'bf' vi_diff.jax /*'bf'* +'bg' options.jax /*'bg'* +'bh' options.jax /*'bh'* +'bin' options.jax /*'bin'* +'binary' options.jax /*'binary'* +'biosk' options.jax /*'biosk'* +'bioskey' options.jax /*'bioskey'* +'bk' options.jax /*'bk'* +'bkc' options.jax /*'bkc'* +'bl' options.jax /*'bl'* +'bo' options.jax /*'bo'* +'bomb' options.jax /*'bomb'* +'breakat' options.jax /*'breakat'* +'breakindent' options.jax /*'breakindent'* +'breakindentopt' options.jax /*'breakindentopt'* +'bri' options.jax /*'bri'* +'briopt' options.jax /*'briopt'* +'brk' options.jax /*'brk'* +'browsedir' options.jax /*'browsedir'* +'bs' options.jax /*'bs'* +'bsdir' options.jax /*'bsdir'* +'bsk' options.jax /*'bsk'* +'bt' options.jax /*'bt'* +'bufhidden' options.jax /*'bufhidden'* +'buflisted' options.jax /*'buflisted'* +'buftype' options.jax /*'buftype'* +'casemap' options.jax /*'casemap'* +'cb' options.jax /*'cb'* +'cc' options.jax /*'cc'* +'ccv' options.jax /*'ccv'* +'cd' options.jax /*'cd'* +'cdpath' options.jax /*'cdpath'* +'cedit' options.jax /*'cedit'* +'cf' options.jax /*'cf'* +'cfu' options.jax /*'cfu'* +'ch' options.jax /*'ch'* +'character' intro.jax /*'character'* +'charconvert' options.jax /*'charconvert'* +'ci' options.jax /*'ci'* +'cin' options.jax /*'cin'* +'cindent' options.jax /*'cindent'* +'cink' options.jax /*'cink'* +'cinkeys' options.jax /*'cinkeys'* +'cino' options.jax /*'cino'* +'cinoptions' options.jax /*'cinoptions'* +'cinw' options.jax /*'cinw'* +'cinwords' options.jax /*'cinwords'* +'clipboard' options.jax /*'clipboard'* +'cm' options.jax /*'cm'* +'cmdheight' options.jax /*'cmdheight'* +'cmdwinheight' options.jax /*'cmdwinheight'* +'cmp' options.jax /*'cmp'* +'cms' options.jax /*'cms'* +'co' options.jax /*'co'* +'cocu' options.jax /*'cocu'* +'cole' options.jax /*'cole'* +'colorcolumn' options.jax /*'colorcolumn'* +'columns' options.jax /*'columns'* +'com' options.jax /*'com'* +'comments' options.jax /*'comments'* +'commentstring' options.jax /*'commentstring'* +'compatible' options.jax /*'compatible'* +'complete' options.jax /*'complete'* +'completefunc' options.jax /*'completefunc'* +'completeopt' options.jax /*'completeopt'* +'concealcursor' options.jax /*'concealcursor'* +'conceallevel' options.jax /*'conceallevel'* +'confirm' options.jax /*'confirm'* +'consk' options.jax /*'consk'* +'conskey' options.jax /*'conskey'* +'copyindent' options.jax /*'copyindent'* +'cot' options.jax /*'cot'* +'cp' options.jax /*'cp'* +'cpo' options.jax /*'cpo'* +'cpoptions' options.jax /*'cpoptions'* +'cpt' options.jax /*'cpt'* +'crb' options.jax /*'crb'* +'cryptmethod' options.jax /*'cryptmethod'* +'cscopepathcomp' options.jax /*'cscopepathcomp'* +'cscopeprg' options.jax /*'cscopeprg'* +'cscopequickfix' options.jax /*'cscopequickfix'* +'cscoperelative' options.jax /*'cscoperelative'* +'cscopetag' options.jax /*'cscopetag'* +'cscopetagorder' options.jax /*'cscopetagorder'* +'cscopeverbose' options.jax /*'cscopeverbose'* +'cspc' options.jax /*'cspc'* +'csprg' options.jax /*'csprg'* +'csqf' options.jax /*'csqf'* +'csre' options.jax /*'csre'* +'cst' options.jax /*'cst'* +'csto' options.jax /*'csto'* +'csverb' options.jax /*'csverb'* +'cuc' options.jax /*'cuc'* +'cul' options.jax /*'cul'* +'cursorbind' options.jax /*'cursorbind'* +'cursorcolumn' options.jax /*'cursorcolumn'* +'cursorline' options.jax /*'cursorline'* +'cwh' options.jax /*'cwh'* +'debug' options.jax /*'debug'* +'deco' options.jax /*'deco'* +'def' options.jax /*'def'* +'define' options.jax /*'define'* +'delcombine' options.jax /*'delcombine'* +'dex' options.jax /*'dex'* +'dg' options.jax /*'dg'* +'dict' options.jax /*'dict'* +'dictionary' options.jax /*'dictionary'* +'diff' options.jax /*'diff'* +'diffexpr' options.jax /*'diffexpr'* +'diffopt' options.jax /*'diffopt'* +'digraph' options.jax /*'digraph'* +'dip' options.jax /*'dip'* +'dir' options.jax /*'dir'* +'directory' options.jax /*'directory'* +'display' options.jax /*'display'* +'dy' options.jax /*'dy'* +'ea' options.jax /*'ea'* +'ead' options.jax /*'ead'* +'eadirection' options.jax /*'eadirection'* +'eb' options.jax /*'eb'* +'ed' options.jax /*'ed'* +'edcompatible' options.jax /*'edcompatible'* +'ef' options.jax /*'ef'* +'efm' options.jax /*'efm'* +'ei' options.jax /*'ei'* +'ek' options.jax /*'ek'* +'emo' options.jax /*'emo'* +'emoji' options.jax /*'emoji'* +'enc' options.jax /*'enc'* +'encoding' options.jax /*'encoding'* +'endofline' options.jax /*'endofline'* +'eol' options.jax /*'eol'* +'ep' options.jax /*'ep'* +'equalalways' options.jax /*'equalalways'* +'equalprg' options.jax /*'equalprg'* +'errorbells' options.jax /*'errorbells'* +'errorfile' options.jax /*'errorfile'* +'errorformat' options.jax /*'errorformat'* +'esckeys' options.jax /*'esckeys'* +'et' options.jax /*'et'* +'eventignore' options.jax /*'eventignore'* +'ex' options.jax /*'ex'* +'expandtab' options.jax /*'expandtab'* +'exrc' options.jax /*'exrc'* +'fcl' options.jax /*'fcl'* +'fcs' options.jax /*'fcs'* +'fdc' options.jax /*'fdc'* +'fde' options.jax /*'fde'* +'fdi' options.jax /*'fdi'* +'fdl' options.jax /*'fdl'* +'fdls' options.jax /*'fdls'* +'fdm' options.jax /*'fdm'* +'fdn' options.jax /*'fdn'* +'fdo' options.jax /*'fdo'* +'fdt' options.jax /*'fdt'* +'fe' options.jax /*'fe'* +'fen' options.jax /*'fen'* +'fenc' options.jax /*'fenc'* +'fencs' options.jax /*'fencs'* +'fex' options.jax /*'fex'* +'ff' options.jax /*'ff'* +'ffs' options.jax /*'ffs'* +'fic' options.jax /*'fic'* +'fileencoding' options.jax /*'fileencoding'* +'fileencodings' options.jax /*'fileencodings'* +'fileformat' options.jax /*'fileformat'* +'fileformats' options.jax /*'fileformats'* +'fileignorecase' options.jax /*'fileignorecase'* +'filetype' options.jax /*'filetype'* +'fillchars' options.jax /*'fillchars'* +'fixendofline' options.jax /*'fixendofline'* +'fixeol' options.jax /*'fixeol'* +'fk' options.jax /*'fk'* +'fkmap' options.jax /*'fkmap'* +'fl' vi_diff.jax /*'fl'* +'flash' vi_diff.jax /*'flash'* +'flp' options.jax /*'flp'* +'fml' options.jax /*'fml'* +'fmr' options.jax /*'fmr'* +'fo' options.jax /*'fo'* +'foldclose' options.jax /*'foldclose'* +'foldcolumn' options.jax /*'foldcolumn'* +'foldenable' options.jax /*'foldenable'* +'foldexpr' options.jax /*'foldexpr'* +'foldignore' options.jax /*'foldignore'* +'foldlevel' options.jax /*'foldlevel'* +'foldlevelstart' options.jax /*'foldlevelstart'* +'foldmarker' options.jax /*'foldmarker'* +'foldmethod' options.jax /*'foldmethod'* +'foldminlines' options.jax /*'foldminlines'* +'foldnestmax' options.jax /*'foldnestmax'* +'foldopen' options.jax /*'foldopen'* +'foldtext' options.jax /*'foldtext'* +'formatexpr' options.jax /*'formatexpr'* +'formatlistpat' options.jax /*'formatlistpat'* +'formatoptions' options.jax /*'formatoptions'* +'formatprg' options.jax /*'formatprg'* +'fp' options.jax /*'fp'* +'fs' options.jax /*'fs'* +'fsync' options.jax /*'fsync'* +'ft' options.jax /*'ft'* +'gcr' options.jax /*'gcr'* +'gd' options.jax /*'gd'* +'gdefault' options.jax /*'gdefault'* +'gfm' options.jax /*'gfm'* +'gfn' options.jax /*'gfn'* +'gfs' options.jax /*'gfs'* +'gfw' options.jax /*'gfw'* +'ghr' options.jax /*'ghr'* +'go' options.jax /*'go'* +'go-A' options.jax /*'go-A'* +'go-F' options.jax /*'go-F'* +'go-L' options.jax /*'go-L'* +'go-M' options.jax /*'go-M'* +'go-P' options.jax /*'go-P'* +'go-R' options.jax /*'go-R'* +'go-T' options.jax /*'go-T'* +'go-a' options.jax /*'go-a'* +'go-b' options.jax /*'go-b'* +'go-c' options.jax /*'go-c'* +'go-e' options.jax /*'go-e'* +'go-f' options.jax /*'go-f'* +'go-g' options.jax /*'go-g'* +'go-h' options.jax /*'go-h'* +'go-i' options.jax /*'go-i'* +'go-l' options.jax /*'go-l'* +'go-m' options.jax /*'go-m'* +'go-p' options.jax /*'go-p'* +'go-r' options.jax /*'go-r'* +'go-t' options.jax /*'go-t'* +'go-v' options.jax /*'go-v'* +'gp' options.jax /*'gp'* +'gr' vi_diff.jax /*'gr'* +'graphic' vi_diff.jax /*'graphic'* +'grepformat' options.jax /*'grepformat'* +'grepprg' options.jax /*'grepprg'* +'gtl' options.jax /*'gtl'* +'gtt' options.jax /*'gtt'* +'guicursor' options.jax /*'guicursor'* +'guifont' options.jax /*'guifont'* +'guifontset' options.jax /*'guifontset'* +'guifontwide' options.jax /*'guifontwide'* +'guiheadroom' options.jax /*'guiheadroom'* +'guioptions' options.jax /*'guioptions'* +'guipty' options.jax /*'guipty'* +'guitablabel' options.jax /*'guitablabel'* +'guitabtooltip' options.jax /*'guitabtooltip'* +'hardtabs' vi_diff.jax /*'hardtabs'* +'helpfile' options.jax /*'helpfile'* +'helpheight' options.jax /*'helpheight'* +'helplang' options.jax /*'helplang'* +'hf' options.jax /*'hf'* +'hh' options.jax /*'hh'* +'hi' options.jax /*'hi'* +'hid' options.jax /*'hid'* +'hidden' options.jax /*'hidden'* +'highlight' options.jax /*'highlight'* +'history' options.jax /*'history'* +'hk' options.jax /*'hk'* +'hkmap' options.jax /*'hkmap'* +'hkmapp' options.jax /*'hkmapp'* +'hkp' options.jax /*'hkp'* +'hl' options.jax /*'hl'* +'hlg' options.jax /*'hlg'* +'hls' options.jax /*'hls'* +'hlsearch' options.jax /*'hlsearch'* +'ht' vi_diff.jax /*'ht'* +'ic' options.jax /*'ic'* +'icon' options.jax /*'icon'* +'iconstring' options.jax /*'iconstring'* +'ignorecase' options.jax /*'ignorecase'* +'im' options.jax /*'im'* +'imactivatefunc' options.jax /*'imactivatefunc'* +'imactivatekey' options.jax /*'imactivatekey'* +'imaf' options.jax /*'imaf'* +'imak' options.jax /*'imak'* +'imc' options.jax /*'imc'* +'imcmdline' options.jax /*'imcmdline'* +'imd' options.jax /*'imd'* +'imdisable' options.jax /*'imdisable'* +'imi' options.jax /*'imi'* +'iminsert' options.jax /*'iminsert'* +'ims' options.jax /*'ims'* +'imsearch' options.jax /*'imsearch'* +'imsf' options.jax /*'imsf'* +'imstatusfunc' options.jax /*'imstatusfunc'* +'inc' options.jax /*'inc'* +'include' options.jax /*'include'* +'includeexpr' options.jax /*'includeexpr'* +'incsearch' options.jax /*'incsearch'* +'inde' options.jax /*'inde'* +'indentexpr' options.jax /*'indentexpr'* +'indentkeys' options.jax /*'indentkeys'* +'indk' options.jax /*'indk'* +'inex' options.jax /*'inex'* +'inf' options.jax /*'inf'* +'infercase' options.jax /*'infercase'* +'insertmode' options.jax /*'insertmode'* +'is' options.jax /*'is'* +'isf' options.jax /*'isf'* +'isfname' options.jax /*'isfname'* +'isi' options.jax /*'isi'* +'isident' options.jax /*'isident'* +'isk' options.jax /*'isk'* +'iskeyword' options.jax /*'iskeyword'* +'isp' options.jax /*'isp'* +'isprint' options.jax /*'isprint'* +'joinspaces' options.jax /*'joinspaces'* +'js' options.jax /*'js'* +'key' options.jax /*'key'* +'keymap' options.jax /*'keymap'* +'keymodel' options.jax /*'keymodel'* +'keywordprg' options.jax /*'keywordprg'* +'km' options.jax /*'km'* +'kmp' options.jax /*'kmp'* +'kp' options.jax /*'kp'* +'langmap' options.jax /*'langmap'* +'langmenu' options.jax /*'langmenu'* +'langnoremap' options.jax /*'langnoremap'* +'langremap' options.jax /*'langremap'* +'laststatus' options.jax /*'laststatus'* +'lazyredraw' options.jax /*'lazyredraw'* +'lbr' options.jax /*'lbr'* +'lcs' options.jax /*'lcs'* +'linebreak' options.jax /*'linebreak'* +'lines' options.jax /*'lines'* +'linespace' options.jax /*'linespace'* +'lisp' options.jax /*'lisp'* +'lispwords' options.jax /*'lispwords'* +'list' options.jax /*'list'* +'listchars' options.jax /*'listchars'* +'lm' options.jax /*'lm'* +'lmap' options.jax /*'lmap'* +'lnr' options.jax /*'lnr'* +'loadplugins' options.jax /*'loadplugins'* +'lpl' options.jax /*'lpl'* +'lrm' options.jax /*'lrm'* +'ls' options.jax /*'ls'* +'lsp' options.jax /*'lsp'* +'luadll' options.jax /*'luadll'* +'lw' options.jax /*'lw'* +'lz' options.jax /*'lz'* +'ma' options.jax /*'ma'* +'macatsui' options.jax /*'macatsui'* +'magic' options.jax /*'magic'* +'makeef' options.jax /*'makeef'* +'makeencoding' options.jax /*'makeencoding'* +'makeprg' options.jax /*'makeprg'* +'mat' options.jax /*'mat'* +'matchpairs' options.jax /*'matchpairs'* +'matchtime' options.jax /*'matchtime'* +'maxcombine' options.jax /*'maxcombine'* +'maxfuncdepth' options.jax /*'maxfuncdepth'* +'maxmapdepth' options.jax /*'maxmapdepth'* +'maxmem' options.jax /*'maxmem'* +'maxmempattern' options.jax /*'maxmempattern'* +'maxmemtot' options.jax /*'maxmemtot'* +'mco' options.jax /*'mco'* +'mef' options.jax /*'mef'* +'menc' options.jax /*'menc'* +'menuitems' options.jax /*'menuitems'* +'mesg' vi_diff.jax /*'mesg'* +'mfd' options.jax /*'mfd'* +'mh' options.jax /*'mh'* +'mis' options.jax /*'mis'* +'mkspellmem' options.jax /*'mkspellmem'* +'ml' options.jax /*'ml'* +'mls' options.jax /*'mls'* +'mm' options.jax /*'mm'* +'mmd' options.jax /*'mmd'* +'mmp' options.jax /*'mmp'* +'mmt' options.jax /*'mmt'* +'mod' options.jax /*'mod'* +'modeline' options.jax /*'modeline'* +'modelines' options.jax /*'modelines'* +'modifiable' options.jax /*'modifiable'* +'modified' options.jax /*'modified'* +'more' options.jax /*'more'* +'mouse' options.jax /*'mouse'* +'mousef' options.jax /*'mousef'* +'mousefocus' options.jax /*'mousefocus'* +'mousehide' options.jax /*'mousehide'* +'mousem' options.jax /*'mousem'* +'mousemodel' options.jax /*'mousemodel'* +'mouses' options.jax /*'mouses'* +'mouseshape' options.jax /*'mouseshape'* +'mouset' options.jax /*'mouset'* +'mousetime' options.jax /*'mousetime'* +'mp' options.jax /*'mp'* +'mps' options.jax /*'mps'* +'msm' options.jax /*'msm'* +'mzq' options.jax /*'mzq'* +'mzquantum' options.jax /*'mzquantum'* +'nf' options.jax /*'nf'* +'noacd' options.jax /*'noacd'* +'noai' options.jax /*'noai'* +'noakm' options.jax /*'noakm'* +'noallowrevins' options.jax /*'noallowrevins'* +'noaltkeymap' options.jax /*'noaltkeymap'* +'noanti' options.jax /*'noanti'* +'noantialias' options.jax /*'noantialias'* +'noar' options.jax /*'noar'* +'noarab' options.jax /*'noarab'* +'noarabic' options.jax /*'noarabic'* +'noarabicshape' options.jax /*'noarabicshape'* +'noari' options.jax /*'noari'* +'noarshape' options.jax /*'noarshape'* +'noautochdir' options.jax /*'noautochdir'* +'noautoindent' options.jax /*'noautoindent'* +'noautoread' options.jax /*'noautoread'* +'noautowrite' options.jax /*'noautowrite'* +'noautowriteall' options.jax /*'noautowriteall'* +'noaw' options.jax /*'noaw'* +'noawa' options.jax /*'noawa'* +'nobackup' options.jax /*'nobackup'* +'noballooneval' options.jax /*'noballooneval'* +'nobeval' options.jax /*'nobeval'* +'nobin' options.jax /*'nobin'* +'nobinary' options.jax /*'nobinary'* +'nobiosk' options.jax /*'nobiosk'* +'nobioskey' options.jax /*'nobioskey'* +'nobk' options.jax /*'nobk'* +'nobl' options.jax /*'nobl'* +'nobomb' options.jax /*'nobomb'* +'nobreakindent' options.jax /*'nobreakindent'* +'nobri' options.jax /*'nobri'* +'nobuflisted' options.jax /*'nobuflisted'* +'nocf' options.jax /*'nocf'* +'noci' options.jax /*'noci'* +'nocin' options.jax /*'nocin'* +'nocindent' options.jax /*'nocindent'* +'nocompatible' options.jax /*'nocompatible'* +'noconfirm' options.jax /*'noconfirm'* +'noconsk' options.jax /*'noconsk'* +'noconskey' options.jax /*'noconskey'* +'nocopyindent' options.jax /*'nocopyindent'* +'nocp' options.jax /*'nocp'* +'nocrb' options.jax /*'nocrb'* +'nocscoperelative' options.jax /*'nocscoperelative'* +'nocscopetag' options.jax /*'nocscopetag'* +'nocscopeverbose' options.jax /*'nocscopeverbose'* +'nocsre' options.jax /*'nocsre'* +'nocst' options.jax /*'nocst'* +'nocsverb' options.jax /*'nocsverb'* +'nocuc' options.jax /*'nocuc'* +'nocul' options.jax /*'nocul'* +'nocursorbind' options.jax /*'nocursorbind'* +'nocursorcolumn' options.jax /*'nocursorcolumn'* +'nocursorline' options.jax /*'nocursorline'* +'nodeco' options.jax /*'nodeco'* +'nodelcombine' options.jax /*'nodelcombine'* +'nodg' options.jax /*'nodg'* +'nodiff' options.jax /*'nodiff'* +'nodigraph' options.jax /*'nodigraph'* +'noea' options.jax /*'noea'* +'noeb' options.jax /*'noeb'* +'noed' options.jax /*'noed'* +'noedcompatible' options.jax /*'noedcompatible'* +'noek' options.jax /*'noek'* +'noemo' options.jax /*'noemo'* +'noemoji' options.jax /*'noemoji'* +'noendofline' options.jax /*'noendofline'* +'noeol' options.jax /*'noeol'* +'noequalalways' options.jax /*'noequalalways'* +'noerrorbells' options.jax /*'noerrorbells'* +'noesckeys' options.jax /*'noesckeys'* +'noet' options.jax /*'noet'* +'noex' options.jax /*'noex'* +'noexpandtab' options.jax /*'noexpandtab'* +'noexrc' options.jax /*'noexrc'* +'nofen' options.jax /*'nofen'* +'nofic' options.jax /*'nofic'* +'nofileignorecase' options.jax /*'nofileignorecase'* +'nofixendofline' options.jax /*'nofixendofline'* +'nofixeol' options.jax /*'nofixeol'* +'nofk' options.jax /*'nofk'* +'nofkmap' options.jax /*'nofkmap'* +'nofoldenable' options.jax /*'nofoldenable'* +'nofs' options.jax /*'nofs'* +'nofsync' options.jax /*'nofsync'* +'nogd' options.jax /*'nogd'* +'nogdefault' options.jax /*'nogdefault'* +'noguipty' options.jax /*'noguipty'* +'nohid' options.jax /*'nohid'* +'nohidden' options.jax /*'nohidden'* +'nohk' options.jax /*'nohk'* +'nohkmap' options.jax /*'nohkmap'* +'nohkmapp' options.jax /*'nohkmapp'* +'nohkp' options.jax /*'nohkp'* +'nohls' options.jax /*'nohls'* +'nohlsearch' options.jax /*'nohlsearch'* +'noic' options.jax /*'noic'* +'noicon' options.jax /*'noicon'* +'noignorecase' options.jax /*'noignorecase'* +'noim' options.jax /*'noim'* +'noimc' options.jax /*'noimc'* +'noimcmdline' options.jax /*'noimcmdline'* +'noimd' options.jax /*'noimd'* +'noimdisable' options.jax /*'noimdisable'* +'noincsearch' options.jax /*'noincsearch'* +'noinf' options.jax /*'noinf'* +'noinfercase' options.jax /*'noinfercase'* +'noinsertmode' options.jax /*'noinsertmode'* +'nois' options.jax /*'nois'* +'nojoinspaces' options.jax /*'nojoinspaces'* +'nojs' options.jax /*'nojs'* +'nolangnoremap' options.jax /*'nolangnoremap'* +'nolangremap' options.jax /*'nolangremap'* +'nolazyredraw' options.jax /*'nolazyredraw'* +'nolbr' options.jax /*'nolbr'* +'nolinebreak' options.jax /*'nolinebreak'* +'nolisp' options.jax /*'nolisp'* +'nolist' options.jax /*'nolist'* +'nolnr' options.jax /*'nolnr'* +'noloadplugins' options.jax /*'noloadplugins'* +'nolpl' options.jax /*'nolpl'* +'nolrm' options.jax /*'nolrm'* +'nolz' options.jax /*'nolz'* +'noma' options.jax /*'noma'* +'nomacatsui' options.jax /*'nomacatsui'* +'nomagic' options.jax /*'nomagic'* +'nomh' options.jax /*'nomh'* +'noml' options.jax /*'noml'* +'nomod' options.jax /*'nomod'* +'nomodeline' options.jax /*'nomodeline'* +'nomodifiable' options.jax /*'nomodifiable'* +'nomodified' options.jax /*'nomodified'* +'nomore' options.jax /*'nomore'* +'nomousef' options.jax /*'nomousef'* +'nomousefocus' options.jax /*'nomousefocus'* +'nomousehide' options.jax /*'nomousehide'* +'nonu' options.jax /*'nonu'* +'nonumber' options.jax /*'nonumber'* +'noodev' options.jax /*'noodev'* +'noopendevice' options.jax /*'noopendevice'* +'nopaste' options.jax /*'nopaste'* +'nopi' options.jax /*'nopi'* +'nopreserveindent' options.jax /*'nopreserveindent'* +'nopreviewwindow' options.jax /*'nopreviewwindow'* +'noprompt' options.jax /*'noprompt'* +'nopvw' options.jax /*'nopvw'* +'noreadonly' options.jax /*'noreadonly'* +'norelativenumber' options.jax /*'norelativenumber'* +'noremap' options.jax /*'noremap'* +'norestorescreen' options.jax /*'norestorescreen'* +'norevins' options.jax /*'norevins'* +'nori' options.jax /*'nori'* +'norightleft' options.jax /*'norightleft'* +'norl' options.jax /*'norl'* +'nornu' options.jax /*'nornu'* +'noro' options.jax /*'noro'* +'nors' options.jax /*'nors'* +'noru' options.jax /*'noru'* +'noruler' options.jax /*'noruler'* +'nosb' options.jax /*'nosb'* +'nosc' options.jax /*'nosc'* +'noscb' options.jax /*'noscb'* +'noscrollbind' options.jax /*'noscrollbind'* +'noscs' options.jax /*'noscs'* +'nosecure' options.jax /*'nosecure'* +'nosft' options.jax /*'nosft'* +'noshellslash' options.jax /*'noshellslash'* +'noshelltemp' options.jax /*'noshelltemp'* +'noshiftround' options.jax /*'noshiftround'* +'noshortname' options.jax /*'noshortname'* +'noshowcmd' options.jax /*'noshowcmd'* +'noshowfulltag' options.jax /*'noshowfulltag'* +'noshowmatch' options.jax /*'noshowmatch'* +'noshowmode' options.jax /*'noshowmode'* +'nosi' options.jax /*'nosi'* +'nosm' options.jax /*'nosm'* +'nosmartcase' options.jax /*'nosmartcase'* +'nosmartindent' options.jax /*'nosmartindent'* +'nosmarttab' options.jax /*'nosmarttab'* +'nosmd' options.jax /*'nosmd'* +'nosn' options.jax /*'nosn'* +'nosol' options.jax /*'nosol'* +'nospell' options.jax /*'nospell'* +'nosplitbelow' options.jax /*'nosplitbelow'* +'nosplitright' options.jax /*'nosplitright'* +'nospr' options.jax /*'nospr'* +'nosr' options.jax /*'nosr'* +'nossl' options.jax /*'nossl'* +'nosta' options.jax /*'nosta'* +'nostartofline' options.jax /*'nostartofline'* +'nostmp' options.jax /*'nostmp'* +'noswapfile' options.jax /*'noswapfile'* +'noswf' options.jax /*'noswf'* +'nota' options.jax /*'nota'* +'notagbsearch' options.jax /*'notagbsearch'* +'notagrelative' options.jax /*'notagrelative'* +'notagstack' options.jax /*'notagstack'* +'notbi' options.jax /*'notbi'* +'notbidi' options.jax /*'notbidi'* +'notbs' options.jax /*'notbs'* +'notermbidi' options.jax /*'notermbidi'* +'noterse' options.jax /*'noterse'* +'notextauto' options.jax /*'notextauto'* +'notextmode' options.jax /*'notextmode'* +'notf' options.jax /*'notf'* +'notgst' options.jax /*'notgst'* +'notildeop' options.jax /*'notildeop'* +'notimeout' options.jax /*'notimeout'* +'notitle' options.jax /*'notitle'* +'noto' options.jax /*'noto'* +'notop' options.jax /*'notop'* +'notr' options.jax /*'notr'* +'nottimeout' options.jax /*'nottimeout'* +'nottybuiltin' options.jax /*'nottybuiltin'* +'nottyfast' options.jax /*'nottyfast'* +'notx' options.jax /*'notx'* +'noudf' options.jax /*'noudf'* +'noundofile' options.jax /*'noundofile'* +'novb' options.jax /*'novb'* +'novice' vi_diff.jax /*'novice'* +'novisualbell' options.jax /*'novisualbell'* +'nowa' options.jax /*'nowa'* +'nowarn' options.jax /*'nowarn'* +'nowb' options.jax /*'nowb'* +'noweirdinvert' options.jax /*'noweirdinvert'* +'nowfh' options.jax /*'nowfh'* +'nowfw' options.jax /*'nowfw'* +'nowic' options.jax /*'nowic'* +'nowildignorecase' options.jax /*'nowildignorecase'* +'nowildmenu' options.jax /*'nowildmenu'* +'nowinfixheight' options.jax /*'nowinfixheight'* +'nowinfixwidth' options.jax /*'nowinfixwidth'* +'nowiv' options.jax /*'nowiv'* +'nowmnu' options.jax /*'nowmnu'* +'nowrap' options.jax /*'nowrap'* +'nowrapscan' options.jax /*'nowrapscan'* +'nowrite' options.jax /*'nowrite'* +'nowriteany' options.jax /*'nowriteany'* +'nowritebackup' options.jax /*'nowritebackup'* +'nows' options.jax /*'nows'* +'nrformats' options.jax /*'nrformats'* +'nu' options.jax /*'nu'* +'number' options.jax /*'number'* +'numberwidth' options.jax /*'numberwidth'* +'nuw' options.jax /*'nuw'* +'odev' options.jax /*'odev'* +'oft' options.jax /*'oft'* +'ofu' options.jax /*'ofu'* +'omnifunc' options.jax /*'omnifunc'* +'op' vi_diff.jax /*'op'* +'open' vi_diff.jax /*'open'* +'opendevice' options.jax /*'opendevice'* +'operatorfunc' options.jax /*'operatorfunc'* +'opfunc' options.jax /*'opfunc'* +'optimize' vi_diff.jax /*'optimize'* +'option' intro.jax /*'option'* +'osfiletype' options.jax /*'osfiletype'* +'pa' options.jax /*'pa'* +'packpath' options.jax /*'packpath'* +'para' options.jax /*'para'* +'paragraphs' options.jax /*'paragraphs'* +'paste' options.jax /*'paste'* +'pastetoggle' options.jax /*'pastetoggle'* +'patchexpr' options.jax /*'patchexpr'* +'patchmode' options.jax /*'patchmode'* +'path' options.jax /*'path'* +'pdev' options.jax /*'pdev'* +'penc' options.jax /*'penc'* +'perldll' options.jax /*'perldll'* +'pex' options.jax /*'pex'* +'pexpr' options.jax /*'pexpr'* +'pfn' options.jax /*'pfn'* +'ph' options.jax /*'ph'* +'pheader' options.jax /*'pheader'* +'pi' options.jax /*'pi'* +'pm' options.jax /*'pm'* +'pmbcs' options.jax /*'pmbcs'* +'pmbfn' options.jax /*'pmbfn'* +'popt' options.jax /*'popt'* +'pp' options.jax /*'pp'* +'preserveindent' options.jax /*'preserveindent'* +'previewheight' options.jax /*'previewheight'* +'previewwindow' options.jax /*'previewwindow'* +'printdevice' options.jax /*'printdevice'* +'printencoding' options.jax /*'printencoding'* +'printexpr' options.jax /*'printexpr'* +'printfont' options.jax /*'printfont'* +'printheader' options.jax /*'printheader'* +'printmbcharset' options.jax /*'printmbcharset'* +'printmbfont' options.jax /*'printmbfont'* +'printoptions' options.jax /*'printoptions'* +'prompt' options.jax /*'prompt'* +'pt' options.jax /*'pt'* +'pumheight' options.jax /*'pumheight'* +'pvh' options.jax /*'pvh'* +'pvw' options.jax /*'pvw'* +'pythondll' options.jax /*'pythondll'* +'pythonthreedll' options.jax /*'pythonthreedll'* +'pyx' options.jax /*'pyx'* +'pyxversion' options.jax /*'pyxversion'* +'qe' options.jax /*'qe'* +'quote motion.jax /*'quote* +'quoteescape' options.jax /*'quoteescape'* +'rdt' options.jax /*'rdt'* +'re' options.jax /*'re'* +'readonly' options.jax /*'readonly'* +'redraw' vi_diff.jax /*'redraw'* +'redrawtime' options.jax /*'redrawtime'* +'regexpengine' options.jax /*'regexpengine'* +'relativenumber' options.jax /*'relativenumber'* +'remap' options.jax /*'remap'* +'renderoptions' options.jax /*'renderoptions'* +'report' options.jax /*'report'* +'restorescreen' options.jax /*'restorescreen'* +'revins' options.jax /*'revins'* +'ri' options.jax /*'ri'* +'rightleft' options.jax /*'rightleft'* +'rightleftcmd' options.jax /*'rightleftcmd'* +'rl' options.jax /*'rl'* +'rlc' options.jax /*'rlc'* +'rnu' options.jax /*'rnu'* +'ro' options.jax /*'ro'* +'rop' options.jax /*'rop'* +'rs' options.jax /*'rs'* +'rtp' options.jax /*'rtp'* +'ru' options.jax /*'ru'* +'rubydll' options.jax /*'rubydll'* +'ruf' options.jax /*'ruf'* +'ruler' options.jax /*'ruler'* +'rulerformat' options.jax /*'rulerformat'* +'runtimepath' options.jax /*'runtimepath'* +'sb' options.jax /*'sb'* +'sbo' options.jax /*'sbo'* +'sbr' options.jax /*'sbr'* +'sc' options.jax /*'sc'* +'scb' options.jax /*'scb'* +'scl' options.jax /*'scl'* +'scr' options.jax /*'scr'* +'scroll' options.jax /*'scroll'* +'scrollbind' options.jax /*'scrollbind'* +'scrolljump' options.jax /*'scrolljump'* +'scrolloff' options.jax /*'scrolloff'* +'scrollopt' options.jax /*'scrollopt'* +'scs' options.jax /*'scs'* +'sect' options.jax /*'sect'* +'sections' options.jax /*'sections'* +'secure' options.jax /*'secure'* +'sel' options.jax /*'sel'* +'selection' options.jax /*'selection'* +'selectmode' options.jax /*'selectmode'* +'sessionoptions' options.jax /*'sessionoptions'* +'sft' options.jax /*'sft'* +'sh' options.jax /*'sh'* +'shcf' options.jax /*'shcf'* +'shell' options.jax /*'shell'* +'shellcmdflag' options.jax /*'shellcmdflag'* +'shellpipe' options.jax /*'shellpipe'* +'shellquote' options.jax /*'shellquote'* +'shellredir' options.jax /*'shellredir'* +'shellslash' options.jax /*'shellslash'* +'shelltemp' options.jax /*'shelltemp'* +'shelltype' options.jax /*'shelltype'* +'shellxescape' options.jax /*'shellxescape'* +'shellxquote' options.jax /*'shellxquote'* +'shiftround' options.jax /*'shiftround'* +'shiftwidth' options.jax /*'shiftwidth'* +'shm' options.jax /*'shm'* +'shortmess' options.jax /*'shortmess'* +'shortname' options.jax /*'shortname'* +'showbreak' options.jax /*'showbreak'* +'showcmd' options.jax /*'showcmd'* +'showfulltag' options.jax /*'showfulltag'* +'showmatch' options.jax /*'showmatch'* +'showmode' options.jax /*'showmode'* +'showtabline' options.jax /*'showtabline'* +'shq' options.jax /*'shq'* +'si' options.jax /*'si'* +'sidescroll' options.jax /*'sidescroll'* +'sidescrolloff' options.jax /*'sidescrolloff'* +'signcolumn' options.jax /*'signcolumn'* +'siso' options.jax /*'siso'* +'sj' options.jax /*'sj'* +'slm' options.jax /*'slm'* +'slow' vi_diff.jax /*'slow'* +'slowopen' vi_diff.jax /*'slowopen'* +'sm' options.jax /*'sm'* +'smartcase' options.jax /*'smartcase'* +'smartindent' options.jax /*'smartindent'* +'smarttab' options.jax /*'smarttab'* +'smc' options.jax /*'smc'* +'smd' options.jax /*'smd'* +'sn' options.jax /*'sn'* +'so' options.jax /*'so'* +'softtabstop' options.jax /*'softtabstop'* +'sol' options.jax /*'sol'* +'sourceany' vi_diff.jax /*'sourceany'* +'sp' options.jax /*'sp'* +'spc' options.jax /*'spc'* +'spell' options.jax /*'spell'* +'spellcapcheck' options.jax /*'spellcapcheck'* +'spellfile' options.jax /*'spellfile'* +'spelllang' options.jax /*'spelllang'* +'spellsuggest' options.jax /*'spellsuggest'* +'spf' options.jax /*'spf'* +'spl' options.jax /*'spl'* +'splitbelow' options.jax /*'splitbelow'* +'splitright' options.jax /*'splitright'* +'spr' options.jax /*'spr'* +'sps' options.jax /*'sps'* +'sr' options.jax /*'sr'* +'srr' options.jax /*'srr'* +'ss' options.jax /*'ss'* +'ssl' options.jax /*'ssl'* +'ssop' options.jax /*'ssop'* +'st' options.jax /*'st'* +'sta' options.jax /*'sta'* +'stal' options.jax /*'stal'* +'startofline' options.jax /*'startofline'* +'statusline' options.jax /*'statusline'* +'stl' options.jax /*'stl'* +'stmp' options.jax /*'stmp'* +'sts' options.jax /*'sts'* +'su' options.jax /*'su'* +'sua' options.jax /*'sua'* +'suffixes' options.jax /*'suffixes'* +'suffixesadd' options.jax /*'suffixesadd'* +'sw' options.jax /*'sw'* +'swapfile' options.jax /*'swapfile'* +'swapsync' options.jax /*'swapsync'* +'swb' options.jax /*'swb'* +'swf' options.jax /*'swf'* +'switchbuf' options.jax /*'switchbuf'* +'sws' options.jax /*'sws'* +'sxe' options.jax /*'sxe'* +'sxq' options.jax /*'sxq'* +'syn' options.jax /*'syn'* +'synmaxcol' options.jax /*'synmaxcol'* +'syntax' options.jax /*'syntax'* +'t_#2' term.jax /*'t_#2'* +'t_#4' term.jax /*'t_#4'* +'t_%1' term.jax /*'t_%1'* +'t_%i' term.jax /*'t_%i'* +'t_&8' term.jax /*'t_&8'* +'t_8b' term.jax /*'t_8b'* +'t_8f' term.jax /*'t_8f'* +'t_@7' term.jax /*'t_@7'* +'t_AB' term.jax /*'t_AB'* +'t_AF' term.jax /*'t_AF'* +'t_AL' term.jax /*'t_AL'* +'t_BD' term.jax /*'t_BD'* +'t_BE' term.jax /*'t_BE'* +'t_CS' term.jax /*'t_CS'* +'t_CV' term.jax /*'t_CV'* +'t_Ce' term.jax /*'t_Ce'* +'t_Co' term.jax /*'t_Co'* +'t_Cs' term.jax /*'t_Cs'* +'t_DL' term.jax /*'t_DL'* +'t_EI' term.jax /*'t_EI'* +'t_F1' term.jax /*'t_F1'* +'t_F2' term.jax /*'t_F2'* +'t_F3' term.jax /*'t_F3'* +'t_F4' term.jax /*'t_F4'* +'t_F5' term.jax /*'t_F5'* +'t_F6' term.jax /*'t_F6'* +'t_F7' term.jax /*'t_F7'* +'t_F8' term.jax /*'t_F8'* +'t_F9' term.jax /*'t_F9'* +'t_IE' term.jax /*'t_IE'* +'t_IS' term.jax /*'t_IS'* +'t_K1' term.jax /*'t_K1'* +'t_K3' term.jax /*'t_K3'* +'t_K4' term.jax /*'t_K4'* +'t_K5' term.jax /*'t_K5'* +'t_K6' term.jax /*'t_K6'* +'t_K7' term.jax /*'t_K7'* +'t_K8' term.jax /*'t_K8'* +'t_K9' term.jax /*'t_K9'* +'t_KA' term.jax /*'t_KA'* +'t_KB' term.jax /*'t_KB'* +'t_KC' term.jax /*'t_KC'* +'t_KD' term.jax /*'t_KD'* +'t_KE' term.jax /*'t_KE'* +'t_KF' term.jax /*'t_KF'* +'t_KG' term.jax /*'t_KG'* +'t_KH' term.jax /*'t_KH'* +'t_KI' term.jax /*'t_KI'* +'t_KJ' term.jax /*'t_KJ'* +'t_KK' term.jax /*'t_KK'* +'t_KL' term.jax /*'t_KL'* +'t_PE' term.jax /*'t_PE'* +'t_PS' term.jax /*'t_PS'* +'t_RB' term.jax /*'t_RB'* +'t_RI' term.jax /*'t_RI'* +'t_RV' term.jax /*'t_RV'* +'t_SI' term.jax /*'t_SI'* +'t_SR' term.jax /*'t_SR'* +'t_Sb' term.jax /*'t_Sb'* +'t_Sf' term.jax /*'t_Sf'* +'t_WP' term.jax /*'t_WP'* +'t_WS' term.jax /*'t_WS'* +'t_ZH' term.jax /*'t_ZH'* +'t_ZR' term.jax /*'t_ZR'* +'t_al' term.jax /*'t_al'* +'t_bc' term.jax /*'t_bc'* +'t_cd' term.jax /*'t_cd'* +'t_ce' term.jax /*'t_ce'* +'t_cl' term.jax /*'t_cl'* +'t_cm' term.jax /*'t_cm'* +'t_cs' term.jax /*'t_cs'* +'t_da' term.jax /*'t_da'* +'t_db' term.jax /*'t_db'* +'t_dl' term.jax /*'t_dl'* +'t_fs' term.jax /*'t_fs'* +'t_k1' term.jax /*'t_k1'* +'t_k2' term.jax /*'t_k2'* +'t_k3' term.jax /*'t_k3'* +'t_k4' term.jax /*'t_k4'* +'t_k5' term.jax /*'t_k5'* +'t_k6' term.jax /*'t_k6'* +'t_k7' term.jax /*'t_k7'* +'t_k8' term.jax /*'t_k8'* +'t_k9' term.jax /*'t_k9'* +'t_k;' term.jax /*'t_k;'* +'t_kB' term.jax /*'t_kB'* +'t_kD' term.jax /*'t_kD'* +'t_kI' term.jax /*'t_kI'* +'t_kN' term.jax /*'t_kN'* +'t_kP' term.jax /*'t_kP'* +'t_kb' term.jax /*'t_kb'* +'t_kd' term.jax /*'t_kd'* +'t_ke' term.jax /*'t_ke'* +'t_kh' term.jax /*'t_kh'* +'t_kl' term.jax /*'t_kl'* +'t_kr' term.jax /*'t_kr'* +'t_ks' term.jax /*'t_ks'* +'t_ku' term.jax /*'t_ku'* +'t_le' term.jax /*'t_le'* +'t_mb' term.jax /*'t_mb'* +'t_md' term.jax /*'t_md'* +'t_me' term.jax /*'t_me'* +'t_mr' term.jax /*'t_mr'* +'t_ms' term.jax /*'t_ms'* +'t_nd' term.jax /*'t_nd'* +'t_op' term.jax /*'t_op'* +'t_se' term.jax /*'t_se'* +'t_so' term.jax /*'t_so'* +'t_sr' term.jax /*'t_sr'* +'t_star7' term.jax /*'t_star7'* +'t_te' term.jax /*'t_te'* +'t_ti' term.jax /*'t_ti'* +'t_ts' term.jax /*'t_ts'* +'t_u7' term.jax /*'t_u7'* +'t_ue' term.jax /*'t_ue'* +'t_us' term.jax /*'t_us'* +'t_ut' term.jax /*'t_ut'* +'t_vb' term.jax /*'t_vb'* +'t_ve' term.jax /*'t_ve'* +'t_vi' term.jax /*'t_vi'* +'t_vs' term.jax /*'t_vs'* +'t_xn' term.jax /*'t_xn'* +'t_xs' term.jax /*'t_xs'* +'ta' options.jax /*'ta'* +'tabline' options.jax /*'tabline'* +'tabpagemax' options.jax /*'tabpagemax'* +'tabstop' options.jax /*'tabstop'* +'tag' options.jax /*'tag'* +'tagbsearch' options.jax /*'tagbsearch'* +'tagcase' options.jax /*'tagcase'* +'taglength' options.jax /*'taglength'* +'tagrelative' options.jax /*'tagrelative'* +'tags' options.jax /*'tags'* +'tagstack' options.jax /*'tagstack'* +'tal' options.jax /*'tal'* +'tb' options.jax /*'tb'* +'tbi' options.jax /*'tbi'* +'tbidi' options.jax /*'tbidi'* +'tbis' options.jax /*'tbis'* +'tbs' options.jax /*'tbs'* +'tc' options.jax /*'tc'* +'tcldll' options.jax /*'tcldll'* +'tenc' options.jax /*'tenc'* +'term' options.jax /*'term'* +'termbidi' options.jax /*'termbidi'* +'termencoding' options.jax /*'termencoding'* +'termguicolors' options.jax /*'termguicolors'* +'terse' options.jax /*'terse'* +'textauto' options.jax /*'textauto'* +'textmode' options.jax /*'textmode'* +'textwidth' options.jax /*'textwidth'* +'tf' options.jax /*'tf'* +'tgc' options.jax /*'tgc'* +'tgst' options.jax /*'tgst'* +'thesaurus' options.jax /*'thesaurus'* +'tildeop' options.jax /*'tildeop'* +'timeout' options.jax /*'timeout'* +'timeoutlen' options.jax /*'timeoutlen'* +'title' options.jax /*'title'* +'titlelen' options.jax /*'titlelen'* +'titleold' options.jax /*'titleold'* +'titlestring' options.jax /*'titlestring'* +'tl' options.jax /*'tl'* +'tm' options.jax /*'tm'* +'to' options.jax /*'to'* +'toolbar' options.jax /*'toolbar'* +'toolbariconsize' options.jax /*'toolbariconsize'* +'top' options.jax /*'top'* +'tpm' options.jax /*'tpm'* +'tr' options.jax /*'tr'* +'ts' options.jax /*'ts'* +'tsl' options.jax /*'tsl'* +'tsr' options.jax /*'tsr'* +'ttimeout' options.jax /*'ttimeout'* +'ttimeoutlen' options.jax /*'ttimeoutlen'* +'ttm' options.jax /*'ttm'* +'tty' options.jax /*'tty'* +'ttybuiltin' options.jax /*'ttybuiltin'* +'ttyfast' options.jax /*'ttyfast'* +'ttym' options.jax /*'ttym'* +'ttymouse' options.jax /*'ttymouse'* +'ttyscroll' options.jax /*'ttyscroll'* +'ttytype' options.jax /*'ttytype'* +'tw' options.jax /*'tw'* +'tx' options.jax /*'tx'* +'uc' options.jax /*'uc'* +'udf' options.jax /*'udf'* +'udir' options.jax /*'udir'* +'ul' options.jax /*'ul'* +'undodir' options.jax /*'undodir'* +'undofile' options.jax /*'undofile'* +'undolevels' options.jax /*'undolevels'* +'undoreload' options.jax /*'undoreload'* +'updatecount' options.jax /*'updatecount'* +'updatetime' options.jax /*'updatetime'* +'ur' options.jax /*'ur'* +'ut' options.jax /*'ut'* +'vb' options.jax /*'vb'* +'vbs' options.jax /*'vbs'* +'vdir' options.jax /*'vdir'* +'ve' options.jax /*'ve'* +'verbose' options.jax /*'verbose'* +'verbosefile' options.jax /*'verbosefile'* +'vfile' options.jax /*'vfile'* +'vi' options.jax /*'vi'* +'viewdir' options.jax /*'viewdir'* +'viewoptions' options.jax /*'viewoptions'* +'viminfo' options.jax /*'viminfo'* +'virtualedit' options.jax /*'virtualedit'* +'visualbell' options.jax /*'visualbell'* +'vop' options.jax /*'vop'* +'w1200' vi_diff.jax /*'w1200'* +'w300' vi_diff.jax /*'w300'* +'w9600' vi_diff.jax /*'w9600'* +'wa' options.jax /*'wa'* +'wak' options.jax /*'wak'* +'warn' options.jax /*'warn'* +'wb' options.jax /*'wb'* +'wc' options.jax /*'wc'* +'wcm' options.jax /*'wcm'* +'wd' options.jax /*'wd'* +'weirdinvert' options.jax /*'weirdinvert'* +'wfh' options.jax /*'wfh'* +'wfw' options.jax /*'wfw'* +'wh' options.jax /*'wh'* +'whichwrap' options.jax /*'whichwrap'* +'wi' options.jax /*'wi'* +'wic' options.jax /*'wic'* +'wig' options.jax /*'wig'* +'wildchar' options.jax /*'wildchar'* +'wildcharm' options.jax /*'wildcharm'* +'wildignore' options.jax /*'wildignore'* +'wildignorecase' options.jax /*'wildignorecase'* +'wildmenu' options.jax /*'wildmenu'* +'wildmode' options.jax /*'wildmode'* +'wildoptions' options.jax /*'wildoptions'* +'wim' options.jax /*'wim'* +'winaltkeys' options.jax /*'winaltkeys'* +'window' options.jax /*'window'* +'winfixheight' options.jax /*'winfixheight'* +'winfixwidth' options.jax /*'winfixwidth'* +'winheight' options.jax /*'winheight'* +'winminheight' options.jax /*'winminheight'* +'winminwidth' options.jax /*'winminwidth'* +'winwidth' options.jax /*'winwidth'* +'wiv' options.jax /*'wiv'* +'wiw' options.jax /*'wiw'* +'wm' options.jax /*'wm'* +'wmh' options.jax /*'wmh'* +'wmnu' options.jax /*'wmnu'* +'wmw' options.jax /*'wmw'* +'wop' options.jax /*'wop'* +'wrap' options.jax /*'wrap'* +'wrapmargin' options.jax /*'wrapmargin'* +'wrapscan' options.jax /*'wrapscan'* +'write' options.jax /*'write'* +'writeany' options.jax /*'writeany'* +'writebackup' options.jax /*'writebackup'* +'writedelay' options.jax /*'writedelay'* +'ws' options.jax /*'ws'* +'ww' options.jax /*'ww'* +'{ motion.jax /*'{* +'} motion.jax /*'}* +( motion.jax /*(* +) motion.jax /*)* ++ motion.jax /*+* +++bad editing.jax /*++bad* +++bin editing.jax /*++bin* +++builtin_terms various.jax /*++builtin_terms* +++edit editing.jax /*++edit* +++enc editing.jax /*++enc* +++ff editing.jax /*++ff* +++nobin editing.jax /*++nobin* +++opt editing.jax /*++opt* ++ARP various.jax /*+ARP* ++GUI_Athena various.jax /*+GUI_Athena* ++GUI_GTK various.jax /*+GUI_GTK* ++GUI_Motif various.jax /*+GUI_Motif* ++GUI_Photon various.jax /*+GUI_Photon* ++GUI_neXtaw various.jax /*+GUI_neXtaw* ++X11 various.jax /*+X11* ++acl various.jax /*+acl* ++arabic various.jax /*+arabic* ++autocmd various.jax /*+autocmd* ++balloon_eval various.jax /*+balloon_eval* ++browse various.jax /*+browse* ++builtin_terms various.jax /*+builtin_terms* ++byte_offset various.jax /*+byte_offset* ++channel various.jax /*+channel* ++cindent various.jax /*+cindent* ++clientserver various.jax /*+clientserver* ++clipboard various.jax /*+clipboard* ++cmd editing.jax /*+cmd* ++cmdline_compl various.jax /*+cmdline_compl* ++cmdline_hist various.jax /*+cmdline_hist* ++cmdline_info various.jax /*+cmdline_info* ++comments various.jax /*+comments* ++conceal various.jax /*+conceal* ++cryptv various.jax /*+cryptv* ++cscope various.jax /*+cscope* ++cursorbind various.jax /*+cursorbind* ++cursorshape various.jax /*+cursorshape* ++debug various.jax /*+debug* ++dialog_con various.jax /*+dialog_con* ++dialog_con_gui various.jax /*+dialog_con_gui* ++dialog_gui various.jax /*+dialog_gui* ++diff various.jax /*+diff* ++digraphs various.jax /*+digraphs* ++directx various.jax /*+directx* ++dnd various.jax /*+dnd* ++emacs_tags various.jax /*+emacs_tags* ++eval various.jax /*+eval* ++ex_extra various.jax /*+ex_extra* ++extra_search various.jax /*+extra_search* ++farsi various.jax /*+farsi* ++feature-list various.jax /*+feature-list* ++file_in_path various.jax /*+file_in_path* ++find_in_path various.jax /*+find_in_path* ++float various.jax /*+float* ++folding various.jax /*+folding* ++footer various.jax /*+footer* ++fork various.jax /*+fork* ++gettext various.jax /*+gettext* ++hangul_input various.jax /*+hangul_input* ++iconv various.jax /*+iconv* ++iconv/dyn various.jax /*+iconv\/dyn* ++insert_expand various.jax /*+insert_expand* ++job various.jax /*+job* ++jumplist various.jax /*+jumplist* ++keymap various.jax /*+keymap* ++lambda various.jax /*+lambda* ++langmap various.jax /*+langmap* ++libcall various.jax /*+libcall* ++linebreak various.jax /*+linebreak* ++lispindent various.jax /*+lispindent* ++listcmds various.jax /*+listcmds* ++localmap various.jax /*+localmap* ++lua various.jax /*+lua* ++lua/dyn various.jax /*+lua\/dyn* ++menu various.jax /*+menu* ++mksession various.jax /*+mksession* ++modify_fname various.jax /*+modify_fname* ++mouse various.jax /*+mouse* ++mouse_dec various.jax /*+mouse_dec* ++mouse_gpm various.jax /*+mouse_gpm* ++mouse_jsbterm various.jax /*+mouse_jsbterm* ++mouse_netterm various.jax /*+mouse_netterm* ++mouse_pterm various.jax /*+mouse_pterm* ++mouse_sgr various.jax /*+mouse_sgr* ++mouse_sysmouse various.jax /*+mouse_sysmouse* ++mouse_urxvt various.jax /*+mouse_urxvt* ++mouse_xterm various.jax /*+mouse_xterm* ++mouseshape various.jax /*+mouseshape* ++multi_byte various.jax /*+multi_byte* ++multi_byte_ime various.jax /*+multi_byte_ime* ++multi_lang various.jax /*+multi_lang* ++mzscheme various.jax /*+mzscheme* ++mzscheme/dyn various.jax /*+mzscheme\/dyn* ++netbeans_intg various.jax /*+netbeans_intg* ++num64 various.jax /*+num64* ++ole various.jax /*+ole* ++packages various.jax /*+packages* ++path_extra various.jax /*+path_extra* ++perl various.jax /*+perl* ++perl/dyn various.jax /*+perl\/dyn* ++persistent_undo various.jax /*+persistent_undo* ++postscript various.jax /*+postscript* ++printer various.jax /*+printer* ++profile various.jax /*+profile* ++python various.jax /*+python* ++python/dyn various.jax /*+python\/dyn* ++python3 various.jax /*+python3* ++python3/dyn various.jax /*+python3\/dyn* ++quickfix various.jax /*+quickfix* ++reltime various.jax /*+reltime* ++rightleft various.jax /*+rightleft* ++ruby various.jax /*+ruby* ++ruby/dyn various.jax /*+ruby\/dyn* ++scrollbind various.jax /*+scrollbind* ++signs various.jax /*+signs* ++smartindent various.jax /*+smartindent* ++startuptime various.jax /*+startuptime* ++statusline various.jax /*+statusline* ++sun_workshop various.jax /*+sun_workshop* ++syntax various.jax /*+syntax* ++system() various.jax /*+system()* ++tag_any_white various.jax /*+tag_any_white* ++tag_binary various.jax /*+tag_binary* ++tag_old_static various.jax /*+tag_old_static* ++tcl various.jax /*+tcl* ++tcl/dyn various.jax /*+tcl\/dyn* ++termguicolors various.jax /*+termguicolors* ++terminfo various.jax /*+terminfo* ++termresponse various.jax /*+termresponse* ++textobjects various.jax /*+textobjects* ++tgetent various.jax /*+tgetent* ++timers various.jax /*+timers* ++title various.jax /*+title* ++toolbar various.jax /*+toolbar* ++user_commands various.jax /*+user_commands* ++vertsplit various.jax /*+vertsplit* ++viminfo various.jax /*+viminfo* ++virtualedit various.jax /*+virtualedit* ++visual various.jax /*+visual* ++visualextra various.jax /*+visualextra* ++vreplace various.jax /*+vreplace* ++wildignore various.jax /*+wildignore* ++wildmenu various.jax /*+wildmenu* ++windows various.jax /*+windows* ++writebackup various.jax /*+writebackup* ++xfontset various.jax /*+xfontset* ++xim various.jax /*+xim* ++xpm various.jax /*+xpm* ++xpm_w32 various.jax /*+xpm_w32* ++xsmp various.jax /*+xsmp* ++xsmp_interact various.jax /*+xsmp_interact* ++xterm_clipboard various.jax /*+xterm_clipboard* ++xterm_save various.jax /*+xterm_save* +, motion.jax /*,* +- motion.jax /*-* +-+ starting.jax /*-+* +-+/ starting.jax /*-+\/* +-+c starting.jax /*-+c* +-+reverse gui_x11.jax /*-+reverse* +-+rv gui_x11.jax /*-+rv* +-- starting.jax /*--* +--- starting.jax /*---* +--cmd starting.jax /*--cmd* +--echo-wid starting.jax /*--echo-wid* +--help starting.jax /*--help* +--literal starting.jax /*--literal* +--nofork starting.jax /*--nofork* +--noplugin starting.jax /*--noplugin* +--not-a-term starting.jax /*--not-a-term* +--remote remote.jax /*--remote* +--remote-expr remote.jax /*--remote-expr* +--remote-send remote.jax /*--remote-send* +--remote-silent remote.jax /*--remote-silent* +--remote-tab remote.jax /*--remote-tab* +--remote-tab-silent remote.jax /*--remote-tab-silent* +--remote-tab-wait remote.jax /*--remote-tab-wait* +--remote-tab-wait-silent remote.jax /*--remote-tab-wait-silent* +--remote-wait remote.jax /*--remote-wait* +--remote-wait-silent remote.jax /*--remote-wait-silent* +--role starting.jax /*--role* +--serverlist remote.jax /*--serverlist* +--servername remote.jax /*--servername* +--socketid starting.jax /*--socketid* +--startuptime starting.jax /*--startuptime* +--ttyfail starting.jax /*--ttyfail* +--version starting.jax /*--version* +--windowid starting.jax /*--windowid* +-A starting.jax /*-A* +-C starting.jax /*-C* +-D starting.jax /*-D* +-E starting.jax /*-E* +-F starting.jax /*-F* +-H starting.jax /*-H* +-L starting.jax /*-L* +-M starting.jax /*-M* +-N starting.jax /*-N* +-O starting.jax /*-O* +-P starting.jax /*-P* +-R starting.jax /*-R* +-S starting.jax /*-S* +-T starting.jax /*-T* +-U starting.jax /*-U* +-V starting.jax /*-V* +-W starting.jax /*-W* +-X starting.jax /*-X* +-Z starting.jax /*-Z* +-b starting.jax /*-b* +-background gui_x11.jax /*-background* +-bg gui_x11.jax /*-bg* +-boldfont gui_x11.jax /*-boldfont* +-borderwidth gui_x11.jax /*-borderwidth* +-bw gui_x11.jax /*-bw* +-c starting.jax /*-c* +-d starting.jax /*-d* +-dev starting.jax /*-dev* +-display gui_x11.jax /*-display* +-e starting.jax /*-e* +-f starting.jax /*-f* +-fg gui_x11.jax /*-fg* +-file starting.jax /*-file* +-fn gui_x11.jax /*-fn* +-font gui_x11.jax /*-font* +-foreground gui_x11.jax /*-foreground* +-g starting.jax /*-g* +-geom gui_x11.jax /*-geom* +-geometry gui_x11.jax /*-geometry* +-geometry-example gui_x11.jax /*-geometry-example* +-gui gui_x11.jax /*-gui* +-h starting.jax /*-h* +-i starting.jax /*-i* +-iconic gui_x11.jax /*-iconic* +-italicfont gui_x11.jax /*-italicfont* +-l starting.jax /*-l* +-m starting.jax /*-m* +-menufont gui_x11.jax /*-menufont* +-menufontset gui_x11.jax /*-menufontset* +-menuheight gui_x11.jax /*-menuheight* +-mf gui_x11.jax /*-mf* +-mh gui_x11.jax /*-mh* +-n starting.jax /*-n* +-nb starting.jax /*-nb* +-o starting.jax /*-o* +-p starting.jax /*-p* +-q starting.jax /*-q* +-qf starting.jax /*-qf* +-r starting.jax /*-r* +-register if_ole.jax /*-register* +-reverse gui_x11.jax /*-reverse* +-rv gui_x11.jax /*-rv* +-s starting.jax /*-s* +-s-ex starting.jax /*-s-ex* +-scrollbarwidth gui_x11.jax /*-scrollbarwidth* +-silent if_ole.jax /*-silent* +-sw gui_x11.jax /*-sw* +-t starting.jax /*-t* +-tag starting.jax /*-tag* +-u starting.jax /*-u* +-ul gui_x11.jax /*-ul* +-unregister if_ole.jax /*-unregister* +-v starting.jax /*-v* +-vim starting.jax /*-vim* +-w starting.jax /*-w* +-w_nr starting.jax /*-w_nr* +-x starting.jax /*-x* +-xrm gui_x11.jax /*-xrm* +-y starting.jax /*-y* +. repeat.jax /*.* +... eval.jax /*...* +.Xdefaults gui_x11.jax /*.Xdefaults* +.aff spell.jax /*.aff* +.dic spell.jax /*.dic* +.exrc starting.jax /*.exrc* +.gvimrc gui.jax /*.gvimrc* +.netrwbook pi_netrw.jax /*.netrwbook* +.netrwhist pi_netrw.jax /*.netrwhist* +.vimrc starting.jax /*.vimrc* +/ pattern.jax /*\/* +/$ pattern.jax /*\/$* +/. pattern.jax /*\/.* +//; pattern.jax /*\/\/;* +/<CR> pattern.jax /*\/<CR>* +/[[. pattern.jax /*\/[[.* +/[[= pattern.jax /*\/[[=* +/[\n] pattern.jax /*\/[\\n]* +/[] pattern.jax /*\/[]* +/\ pattern.jax /*\/\\* +/\$ pattern.jax /*\/\\$* +/\%# pattern.jax /*\/\\%#* +/\%#= pattern.jax /*\/\\%#=* +/\%$ pattern.jax /*\/\\%$* +/\%'m pattern.jax /*\/\\%'m* +/\%( pattern.jax /*\/\\%(* +/\%(\) pattern.jax /*\/\\%(\\)* +/\%<'m pattern.jax /*\/\\%<'m* +/\%<c pattern.jax /*\/\\%<c* +/\%<l pattern.jax /*\/\\%<l* +/\%<v pattern.jax /*\/\\%<v* +/\%>'m pattern.jax /*\/\\%>'m* +/\%>c pattern.jax /*\/\\%>c* +/\%>l pattern.jax /*\/\\%>l* +/\%>v pattern.jax /*\/\\%>v* +/\%C pattern.jax /*\/\\%C* +/\%U pattern.jax /*\/\\%U* +/\%V pattern.jax /*\/\\%V* +/\%[] pattern.jax /*\/\\%[]* +/\%^ pattern.jax /*\/\\%^* +/\%c pattern.jax /*\/\\%c* +/\%d pattern.jax /*\/\\%d* +/\%l pattern.jax /*\/\\%l* +/\%o pattern.jax /*\/\\%o* +/\%u pattern.jax /*\/\\%u* +/\%v pattern.jax /*\/\\%v* +/\%x pattern.jax /*\/\\%x* +/\& pattern.jax /*\/\\&* +/\( pattern.jax /*\/\\(* +/\(\) pattern.jax /*\/\\(\\)* +/\) pattern.jax /*\/\\)* +/\+ pattern.jax /*\/\\+* +/\. pattern.jax /*\/\\.* +/\1 pattern.jax /*\/\\1* +/\2 pattern.jax /*\/\\2* +/\3 pattern.jax /*\/\\3* +/\9 pattern.jax /*\/\\9* +/\< pattern.jax /*\/\\<* +/\= pattern.jax /*\/\\=* +/\> pattern.jax /*\/\\>* +/\? pattern.jax /*\/\\?* +/\@! pattern.jax /*\/\\@!* +/\@<! pattern.jax /*\/\\@<!* +/\@<= pattern.jax /*\/\\@<=* +/\@= pattern.jax /*\/\\@=* +/\@> pattern.jax /*\/\\@>* +/\A pattern.jax /*\/\\A* +/\C pattern.jax /*\/\\C* +/\D pattern.jax /*\/\\D* +/\F pattern.jax /*\/\\F* +/\H pattern.jax /*\/\\H* +/\I pattern.jax /*\/\\I* +/\K pattern.jax /*\/\\K* +/\L pattern.jax /*\/\\L* +/\M pattern.jax /*\/\\M* +/\O pattern.jax /*\/\\O* +/\P pattern.jax /*\/\\P* +/\S pattern.jax /*\/\\S* +/\U pattern.jax /*\/\\U* +/\V pattern.jax /*\/\\V* +/\W pattern.jax /*\/\\W* +/\X pattern.jax /*\/\\X* +/\Z pattern.jax /*\/\\Z* +/\[] pattern.jax /*\/\\[]* +/\\ pattern.jax /*\/\\\\* +/\] pattern.jax /*\/\\]* +/\^ pattern.jax /*\/\\^* +/\_ pattern.jax /*\/\\_* +/\_$ pattern.jax /*\/\\_$* +/\_. pattern.jax /*\/\\_.* +/\_A pattern.jax /*\/\\_A* +/\_D pattern.jax /*\/\\_D* +/\_F pattern.jax /*\/\\_F* +/\_H pattern.jax /*\/\\_H* +/\_I pattern.jax /*\/\\_I* +/\_K pattern.jax /*\/\\_K* +/\_L pattern.jax /*\/\\_L* +/\_O pattern.jax /*\/\\_O* +/\_P pattern.jax /*\/\\_P* +/\_S pattern.jax /*\/\\_S* +/\_U pattern.jax /*\/\\_U* +/\_W pattern.jax /*\/\\_W* +/\_X pattern.jax /*\/\\_X* +/\_[] pattern.jax /*\/\\_[]* +/\_^ pattern.jax /*\/\\_^* +/\_a pattern.jax /*\/\\_a* +/\_d pattern.jax /*\/\\_d* +/\_f pattern.jax /*\/\\_f* +/\_h pattern.jax /*\/\\_h* +/\_i pattern.jax /*\/\\_i* +/\_k pattern.jax /*\/\\_k* +/\_l pattern.jax /*\/\\_l* +/\_o pattern.jax /*\/\\_o* +/\_p pattern.jax /*\/\\_p* +/\_s pattern.jax /*\/\\_s* +/\_u pattern.jax /*\/\\_u* +/\_w pattern.jax /*\/\\_w* +/\_x pattern.jax /*\/\\_x* +/\a pattern.jax /*\/\\a* +/\b pattern.jax /*\/\\b* +/\bar pattern.jax /*\/\\bar* +/\c pattern.jax /*\/\\c* +/\d pattern.jax /*\/\\d* +/\e pattern.jax /*\/\\e* +/\f pattern.jax /*\/\\f* +/\h pattern.jax /*\/\\h* +/\i pattern.jax /*\/\\i* +/\k pattern.jax /*\/\\k* +/\l pattern.jax /*\/\\l* +/\m pattern.jax /*\/\\m* +/\n pattern.jax /*\/\\n* +/\o pattern.jax /*\/\\o* +/\p pattern.jax /*\/\\p* +/\r pattern.jax /*\/\\r* +/\s pattern.jax /*\/\\s* +/\star pattern.jax /*\/\\star* +/\t pattern.jax /*\/\\t* +/\u pattern.jax /*\/\\u* +/\v pattern.jax /*\/\\v* +/\w pattern.jax /*\/\\w* +/\x pattern.jax /*\/\\x* +/\z( syntax.jax /*\/\\z(* +/\z(\) syntax.jax /*\/\\z(\\)* +/\z1 syntax.jax /*\/\\z1* +/\z2 syntax.jax /*\/\\z2* +/\z3 syntax.jax /*\/\\z3* +/\z4 syntax.jax /*\/\\z4* +/\z5 syntax.jax /*\/\\z5* +/\z6 syntax.jax /*\/\\z6* +/\z7 syntax.jax /*\/\\z7* +/\z8 syntax.jax /*\/\\z8* +/\z9 syntax.jax /*\/\\z9* +/\ze pattern.jax /*\/\\ze* +/\zs pattern.jax /*\/\\zs* +/\{ pattern.jax /*\/\\{* +/\{- pattern.jax /*\/\\{-* +/\~ pattern.jax /*\/\\~* +/^ pattern.jax /*\/^* +/_CTRL-G cmdline.jax /*\/_CTRL-G* +/_CTRL-L cmdline.jax /*\/_CTRL-L* +/_CTRL-T cmdline.jax /*\/_CTRL-T* +/atom pattern.jax /*\/atom* +/bar pattern.jax /*\/bar* +/branch pattern.jax /*\/branch* +/character-classes pattern.jax /*\/character-classes* +/collection pattern.jax /*\/collection* +/concat pattern.jax /*\/concat* +/dyn various.jax /*\/dyn* +/ignorecase pattern.jax /*\/ignorecase* +/magic pattern.jax /*\/magic* +/multi pattern.jax /*\/multi* +/ordinary-atom pattern.jax /*\/ordinary-atom* +/pattern pattern.jax /*\/pattern* +/piece pattern.jax /*\/piece* +/star pattern.jax /*\/star* +/zero-width pattern.jax /*\/zero-width* +/~ pattern.jax /*\/~* +0 motion.jax /*0* +01.1 usr_01.jax /*01.1* +01.2 usr_01.jax /*01.2* +01.3 usr_01.jax /*01.3* +01.4 usr_01.jax /*01.4* +02.1 usr_02.jax /*02.1* +02.2 usr_02.jax /*02.2* +02.3 usr_02.jax /*02.3* +02.4 usr_02.jax /*02.4* +02.5 usr_02.jax /*02.5* +02.6 usr_02.jax /*02.6* +02.7 usr_02.jax /*02.7* +02.8 usr_02.jax /*02.8* +03.1 usr_03.jax /*03.1* +03.10 usr_03.jax /*03.10* +03.2 usr_03.jax /*03.2* +03.3 usr_03.jax /*03.3* +03.4 usr_03.jax /*03.4* +03.5 usr_03.jax /*03.5* +03.6 usr_03.jax /*03.6* +03.7 usr_03.jax /*03.7* +03.8 usr_03.jax /*03.8* +03.9 usr_03.jax /*03.9* +04.1 usr_04.jax /*04.1* +04.10 usr_04.jax /*04.10* +04.2 usr_04.jax /*04.2* +04.3 usr_04.jax /*04.3* +04.4 usr_04.jax /*04.4* +04.5 usr_04.jax /*04.5* +04.6 usr_04.jax /*04.6* +04.7 usr_04.jax /*04.7* +04.8 usr_04.jax /*04.8* +04.9 usr_04.jax /*04.9* +05.1 usr_05.jax /*05.1* +05.2 usr_05.jax /*05.2* +05.3 usr_05.jax /*05.3* +05.4 usr_05.jax /*05.4* +05.5 usr_05.jax /*05.5* +05.6 usr_05.jax /*05.6* +05.7 usr_05.jax /*05.7* +05.8 usr_05.jax /*05.8* +06.1 usr_06.jax /*06.1* +06.2 usr_06.jax /*06.2* +06.3 usr_06.jax /*06.3* +06.4 usr_06.jax /*06.4* +06.5 usr_06.jax /*06.5* +06.6 usr_06.jax /*06.6* +07.1 usr_07.jax /*07.1* +07.2 usr_07.jax /*07.2* +07.3 usr_07.jax /*07.3* +07.4 usr_07.jax /*07.4* +07.5 usr_07.jax /*07.5* +07.6 usr_07.jax /*07.6* +07.7 usr_07.jax /*07.7* +08.1 usr_08.jax /*08.1* +08.2 usr_08.jax /*08.2* +08.3 usr_08.jax /*08.3* +08.4 usr_08.jax /*08.4* +08.5 usr_08.jax /*08.5* +08.6 usr_08.jax /*08.6* +08.7 usr_08.jax /*08.7* +08.8 usr_08.jax /*08.8* +08.9 usr_08.jax /*08.9* +09.1 usr_09.jax /*09.1* +09.2 usr_09.jax /*09.2* +09.3 usr_09.jax /*09.3* +09.4 usr_09.jax /*09.4* +10.1 usr_10.jax /*10.1* +10.2 usr_10.jax /*10.2* +10.3 usr_10.jax /*10.3* +10.4 usr_10.jax /*10.4* +10.5 usr_10.jax /*10.5* +10.6 usr_10.jax /*10.6* +10.7 usr_10.jax /*10.7* +10.8 usr_10.jax /*10.8* +10.9 usr_10.jax /*10.9* +11.1 usr_11.jax /*11.1* +11.2 usr_11.jax /*11.2* +11.3 usr_11.jax /*11.3* +11.4 usr_11.jax /*11.4* +12.1 usr_12.jax /*12.1* +12.2 usr_12.jax /*12.2* +12.3 usr_12.jax /*12.3* +12.4 usr_12.jax /*12.4* +12.5 usr_12.jax /*12.5* +12.6 usr_12.jax /*12.6* +12.7 usr_12.jax /*12.7* +12.8 usr_12.jax /*12.8* +1gD pattern.jax /*1gD* +1gd pattern.jax /*1gd* +20.1 usr_20.jax /*20.1* +20.2 usr_20.jax /*20.2* +20.3 usr_20.jax /*20.3* +20.4 usr_20.jax /*20.4* +20.5 usr_20.jax /*20.5* +21.1 usr_21.jax /*21.1* +21.2 usr_21.jax /*21.2* +21.3 usr_21.jax /*21.3* +21.4 usr_21.jax /*21.4* +21.5 usr_21.jax /*21.5* +21.6 usr_21.jax /*21.6* +22.1 usr_22.jax /*22.1* +22.2 usr_22.jax /*22.2* +22.3 usr_22.jax /*22.3* +22.4 usr_22.jax /*22.4* +23.1 usr_23.jax /*23.1* +23.2 usr_23.jax /*23.2* +23.3 usr_23.jax /*23.3* +23.4 usr_23.jax /*23.4* +23.5 usr_23.jax /*23.5* +24.1 usr_24.jax /*24.1* +24.10 usr_24.jax /*24.10* +24.2 usr_24.jax /*24.2* +24.3 usr_24.jax /*24.3* +24.4 usr_24.jax /*24.4* +24.5 usr_24.jax /*24.5* +24.6 usr_24.jax /*24.6* +24.7 usr_24.jax /*24.7* +24.8 usr_24.jax /*24.8* +24.9 usr_24.jax /*24.9* +25.1 usr_25.jax /*25.1* +25.2 usr_25.jax /*25.2* +25.3 usr_25.jax /*25.3* +25.4 usr_25.jax /*25.4* +25.5 usr_25.jax /*25.5* +26.1 usr_26.jax /*26.1* +26.2 usr_26.jax /*26.2* +26.3 usr_26.jax /*26.3* +26.4 usr_26.jax /*26.4* +27.1 usr_27.jax /*27.1* +27.2 usr_27.jax /*27.2* +27.3 usr_27.jax /*27.3* +27.4 usr_27.jax /*27.4* +27.5 usr_27.jax /*27.5* +27.6 usr_27.jax /*27.6* +27.7 usr_27.jax /*27.7* +27.8 usr_27.jax /*27.8* +27.9 usr_27.jax /*27.9* +28.1 usr_28.jax /*28.1* +28.10 usr_28.jax /*28.10* +28.2 usr_28.jax /*28.2* +28.3 usr_28.jax /*28.3* +28.4 usr_28.jax /*28.4* +28.5 usr_28.jax /*28.5* +28.6 usr_28.jax /*28.6* +28.7 usr_28.jax /*28.7* +28.8 usr_28.jax /*28.8* +28.9 usr_28.jax /*28.9* +29.1 usr_29.jax /*29.1* +29.2 usr_29.jax /*29.2* +29.3 usr_29.jax /*29.3* +29.4 usr_29.jax /*29.4* +29.5 usr_29.jax /*29.5* +2html.vim syntax.jax /*2html.vim* +30.1 usr_30.jax /*30.1* +30.2 usr_30.jax /*30.2* +30.3 usr_30.jax /*30.3* +30.4 usr_30.jax /*30.4* +30.5 usr_30.jax /*30.5* +30.6 usr_30.jax /*30.6* +31.1 usr_31.jax /*31.1* +31.2 usr_31.jax /*31.2* +31.3 usr_31.jax /*31.3* +31.4 usr_31.jax /*31.4* +31.5 usr_31.jax /*31.5* +32.1 usr_32.jax /*32.1* +32.2 usr_32.jax /*32.2* +32.3 usr_32.jax /*32.3* +32.4 usr_32.jax /*32.4* +40.1 usr_40.jax /*40.1* +40.2 usr_40.jax /*40.2* +40.3 usr_40.jax /*40.3* +41.1 usr_41.jax /*41.1* +41.10 usr_41.jax /*41.10* +41.11 usr_41.jax /*41.11* +41.12 usr_41.jax /*41.12* +41.13 usr_41.jax /*41.13* +41.14 usr_41.jax /*41.14* +41.15 usr_41.jax /*41.15* +41.16 usr_41.jax /*41.16* +41.2 usr_41.jax /*41.2* +41.3 usr_41.jax /*41.3* +41.4 usr_41.jax /*41.4* +41.5 usr_41.jax /*41.5* +41.6 usr_41.jax /*41.6* +41.7 usr_41.jax /*41.7* +41.8 usr_41.jax /*41.8* +41.9 usr_41.jax /*41.9* +42 usr_42.jax /*42* +42.1 usr_42.jax /*42.1* +42.2 usr_42.jax /*42.2* +42.3 usr_42.jax /*42.3* +42.4 usr_42.jax /*42.4* +43.1 usr_43.jax /*43.1* +43.2 usr_43.jax /*43.2* +44.1 usr_44.jax /*44.1* +44.10 usr_44.jax /*44.10* +44.11 usr_44.jax /*44.11* +44.12 usr_44.jax /*44.12* +44.2 usr_44.jax /*44.2* +44.3 usr_44.jax /*44.3* +44.4 usr_44.jax /*44.4* +44.5 usr_44.jax /*44.5* +44.6 usr_44.jax /*44.6* +44.7 usr_44.jax /*44.7* +44.8 usr_44.jax /*44.8* +44.9 usr_44.jax /*44.9* +45.1 usr_45.jax /*45.1* +45.2 usr_45.jax /*45.2* +45.3 usr_45.jax /*45.3* +45.4 usr_45.jax /*45.4* +45.5 usr_45.jax /*45.5* +8g8 various.jax /*8g8* +90.1 usr_90.jax /*90.1* +90.2 usr_90.jax /*90.2* +90.3 usr_90.jax /*90.3* +90.4 usr_90.jax /*90.4* +90.5 usr_90.jax /*90.5* +: cmdline.jax /*:* +:! various.jax /*:!* +:!! various.jax /*:!!* +:!cmd various.jax /*:!cmd* +:!start os_win32.jax /*:!start* +:# various.jax /*:#* +:#! various.jax /*:#!* +:$ cmdline.jax /*:$* +:% cmdline.jax /*:%* +:& change.jax /*:&* +:&& change.jax /*:&&* +:' cmdline.jax /*:'* +:, cmdline.jax /*:,* +:. cmdline.jax /*:.* +:/ cmdline.jax /*:\/* +:0file editing.jax /*:0file* +:2match pattern.jax /*:2match* +:3match pattern.jax /*:3match* +::. cmdline.jax /*::.* +::8 cmdline.jax /*::8* +::S cmdline.jax /*::S* +::e cmdline.jax /*::e* +::gs cmdline.jax /*::gs* +::h cmdline.jax /*::h* +::p cmdline.jax /*::p* +::r cmdline.jax /*::r* +::s cmdline.jax /*::s* +::t cmdline.jax /*::t* +::~ cmdline.jax /*::~* +:; cmdline.jax /*:;* +:< change.jax /*:<* +:<abuf> cmdline.jax /*:<abuf>* +:<afile> cmdline.jax /*:<afile>* +:<amatch> cmdline.jax /*:<amatch>* +:<cWORD> cmdline.jax /*:<cWORD>* +:<cfile> cmdline.jax /*:<cfile>* +:<cword> cmdline.jax /*:<cword>* +:<sfile> cmdline.jax /*:<sfile>* +:= various.jax /*:=* +:> change.jax /*:>* +:? cmdline.jax /*:?* +:@ repeat.jax /*:@* +:@: repeat.jax /*:@:* +:@@ repeat.jax /*:@@* +:AdaLines ft_ada.jax /*:AdaLines* +:AdaRainbow ft_ada.jax /*:AdaRainbow* +:AdaSpaces ft_ada.jax /*:AdaSpaces* +:AdaTagDir ft_ada.jax /*:AdaTagDir* +:AdaTagFile ft_ada.jax /*:AdaTagFile* +:AdaTypes ft_ada.jax /*:AdaTypes* +:CompilerSet usr_41.jax /*:CompilerSet* +:DiffOrig diff.jax /*:DiffOrig* +:DoMatchParen pi_paren.jax /*:DoMatchParen* +:Explore pi_netrw.jax /*:Explore* +:GLVS pi_getscript.jax /*:GLVS* +:GetLatestVimScripts_dat pi_getscript.jax /*:GetLatestVimScripts_dat* +:GnatFind ft_ada.jax /*:GnatFind* +:GnatPretty ft_ada.jax /*:GnatPretty* +:GnatTags ft_ada.jax /*:GnatTags* +:Hexplore pi_netrw.jax /*:Hexplore* +:LP pi_logipat.jax /*:LP* +:LPE pi_logipat.jax /*:LPE* +:LPF pi_logipat.jax /*:LPF* +:Lexplore pi_netrw.jax /*:Lexplore* +:LogiPat pi_logipat.jax /*:LogiPat* +:Man filetype.jax /*:Man* +:MkVimball pi_vimball.jax /*:MkVimball* +:N editing.jax /*:N* +:NetrwClean pi_netrw.jax /*:NetrwClean* +:Nexplore pi_netrw.jax /*:Nexplore* +:Next editing.jax /*:Next* +:NoMatchParen pi_paren.jax /*:NoMatchParen* +:Nr pi_netrw.jax /*:Nr* +:Nread pi_netrw.jax /*:Nread* +:Ns pi_netrw.jax /*:Ns* +:Nsource pi_netrw.jax /*:Nsource* +:Ntree pi_netrw.jax /*:Ntree* +:Nw pi_netrw.jax /*:Nw* +:Nwrite pi_netrw.jax /*:Nwrite* +:P various.jax /*:P* +:Pexplore pi_netrw.jax /*:Pexplore* +:Print various.jax /*:Print* +:Rexplore pi_netrw.jax /*:Rexplore* +:RmVimball pi_vimball.jax /*:RmVimball* +:Sexplore pi_netrw.jax /*:Sexplore* +:TOhtml syntax.jax /*:TOhtml* +:TarDiff pi_tar.jax /*:TarDiff* +:Texplore pi_netrw.jax /*:Texplore* +:UseVimball pi_vimball.jax /*:UseVimball* +:Vexplore pi_netrw.jax /*:Vexplore* +:VimballList pi_vimball.jax /*:VimballList* +:Vimuntar pi_tar.jax /*:Vimuntar* +:X editing.jax /*:X* +:XMLent insert.jax /*:XMLent* +:XMLns insert.jax /*:XMLns* +:[range] motion.jax /*:[range]* +:\bar cmdline.jax /*:\\bar* +:_! cmdline.jax /*:_!* +:_# cmdline.jax /*:_#* +:_## cmdline.jax /*:_##* +:_#0 cmdline.jax /*:_#0* +:_#< cmdline.jax /*:_#<* +:_#n cmdline.jax /*:_#n* +:_% cmdline.jax /*:_%* +:_%: cmdline.jax /*:_%:* +:_%< cmdline.jax /*:_%<* +:a insert.jax /*:a* +:ab map.jax /*:ab* +:abbreviate map.jax /*:abbreviate* +:abbreviate-<buffer> map.jax /*:abbreviate-<buffer>* +:abbreviate-local map.jax /*:abbreviate-local* +:abbreviate-verbose map.jax /*:abbreviate-verbose* +:abc map.jax /*:abc* +:abclear map.jax /*:abclear* +:abo windows.jax /*:abo* +:aboveleft windows.jax /*:aboveleft* +:al windows.jax /*:al* +:all windows.jax /*:all* +:am gui.jax /*:am* +:amenu gui.jax /*:amenu* +:an gui.jax /*:an* +:anoremenu gui.jax /*:anoremenu* +:append insert.jax /*:append* +:ar editing.jax /*:ar* +:arga editing.jax /*:arga* +:argadd editing.jax /*:argadd* +:argd editing.jax /*:argd* +:argdelete editing.jax /*:argdelete* +:argdo editing.jax /*:argdo* +:arge editing.jax /*:arge* +:argedit editing.jax /*:argedit* +:argglobal editing.jax /*:argglobal* +:arglocal editing.jax /*:arglocal* +:args editing.jax /*:args* +:args_f editing.jax /*:args_f* +:args_f! editing.jax /*:args_f!* +:argu editing.jax /*:argu* +:argument editing.jax /*:argument* +:as various.jax /*:as* +:ascii various.jax /*:ascii* +:au autocmd.jax /*:au* +:aug autocmd.jax /*:aug* +:augroup autocmd.jax /*:augroup* +:augroup-delete autocmd.jax /*:augroup-delete* +:aun gui.jax /*:aun* +:aunmenu gui.jax /*:aunmenu* +:autocmd autocmd.jax /*:autocmd* +:autocmd-verbose autocmd.jax /*:autocmd-verbose* +:b windows.jax /*:b* +:bN windows.jax /*:bN* +:bNext windows.jax /*:bNext* +:ba windows.jax /*:ba* +:bad windows.jax /*:bad* +:badd windows.jax /*:badd* +:ball windows.jax /*:ball* +:bar cmdline.jax /*:bar* +:bd windows.jax /*:bd* +:bdel windows.jax /*:bdel* +:bdelete windows.jax /*:bdelete* +:be gui.jax /*:be* +:behave gui.jax /*:behave* +:bel windows.jax /*:bel* +:belowright windows.jax /*:belowright* +:bf windows.jax /*:bf* +:bfirst windows.jax /*:bfirst* +:bl windows.jax /*:bl* +:blast windows.jax /*:blast* +:bm windows.jax /*:bm* +:bmodified windows.jax /*:bmodified* +:bn windows.jax /*:bn* +:bnext windows.jax /*:bnext* +:bo windows.jax /*:bo* +:botright windows.jax /*:botright* +:bp windows.jax /*:bp* +:bprevious windows.jax /*:bprevious* +:br windows.jax /*:br* +:brea eval.jax /*:brea* +:break eval.jax /*:break* +:breaka repeat.jax /*:breaka* +:breakadd repeat.jax /*:breakadd* +:breakd repeat.jax /*:breakd* +:breakdel repeat.jax /*:breakdel* +:breakl repeat.jax /*:breakl* +:breaklist repeat.jax /*:breaklist* +:brewind windows.jax /*:brewind* +:bro editing.jax /*:bro* +:browse editing.jax /*:browse* +:browse-set options.jax /*:browse-set* +:bu windows.jax /*:bu* +:buf windows.jax /*:buf* +:bufdo windows.jax /*:bufdo* +:buffer windows.jax /*:buffer* +:buffer-! windows.jax /*:buffer-!* +:buffers windows.jax /*:buffers* +:bun windows.jax /*:bun* +:bunload windows.jax /*:bunload* +:bw windows.jax /*:bw* +:bwipe windows.jax /*:bwipe* +:bwipeout windows.jax /*:bwipeout* +:c change.jax /*:c* +:cN quickfix.jax /*:cN* +:cNext quickfix.jax /*:cNext* +:cNf quickfix.jax /*:cNf* +:cNfile quickfix.jax /*:cNfile* +:ca map.jax /*:ca* +:cabbrev map.jax /*:cabbrev* +:cabc map.jax /*:cabc* +:cabclear map.jax /*:cabclear* +:cad quickfix.jax /*:cad* +:caddbuffer quickfix.jax /*:caddbuffer* +:cadde quickfix.jax /*:cadde* +:caddexpr quickfix.jax /*:caddexpr* +:caddf quickfix.jax /*:caddf* +:caddfile quickfix.jax /*:caddfile* +:cal eval.jax /*:cal* +:call eval.jax /*:call* +:cat eval.jax /*:cat* +:catch eval.jax /*:catch* +:cb quickfix.jax /*:cb* +:cbo quickfix.jax /*:cbo* +:cbottom quickfix.jax /*:cbottom* +:cbuffer quickfix.jax /*:cbuffer* +:cc quickfix.jax /*:cc* +:ccl quickfix.jax /*:ccl* +:cclose quickfix.jax /*:cclose* +:cd editing.jax /*:cd* +:cd- editing.jax /*:cd-* +:cdo quickfix.jax /*:cdo* +:ce change.jax /*:ce* +:center change.jax /*:center* +:cex quickfix.jax /*:cex* +:cexpr quickfix.jax /*:cexpr* +:cf quickfix.jax /*:cf* +:cfdo quickfix.jax /*:cfdo* +:cfile quickfix.jax /*:cfile* +:cfir quickfix.jax /*:cfir* +:cfirst quickfix.jax /*:cfirst* +:cg quickfix.jax /*:cg* +:cgetb quickfix.jax /*:cgetb* +:cgetbuffer quickfix.jax /*:cgetbuffer* +:cgete quickfix.jax /*:cgete* +:cgetexpr quickfix.jax /*:cgetexpr* +:cgetfile quickfix.jax /*:cgetfile* +:ch change.jax /*:ch* +:change change.jax /*:change* +:changes motion.jax /*:changes* +:chd editing.jax /*:chd* +:chdir editing.jax /*:chdir* +:che tagsrch.jax /*:che* +:checkpath tagsrch.jax /*:checkpath* +:checkt editing.jax /*:checkt* +:checktime editing.jax /*:checktime* +:chi quickfix.jax /*:chi* +:chistory quickfix.jax /*:chistory* +:cl quickfix.jax /*:cl* +:cla quickfix.jax /*:cla* +:clast quickfix.jax /*:clast* +:cle motion.jax /*:cle* +:clearjumps motion.jax /*:clearjumps* +:clist quickfix.jax /*:clist* +:clo windows.jax /*:clo* +:close windows.jax /*:close* +:cm map.jax /*:cm* +:cmap map.jax /*:cmap* +:cmap_l map.jax /*:cmap_l* +:cmapc map.jax /*:cmapc* +:cmapclear map.jax /*:cmapclear* +:cme gui.jax /*:cme* +:cmenu gui.jax /*:cmenu* +:cn quickfix.jax /*:cn* +:cnew quickfix.jax /*:cnew* +:cnewer quickfix.jax /*:cnewer* +:cnext quickfix.jax /*:cnext* +:cnf quickfix.jax /*:cnf* +:cnfile quickfix.jax /*:cnfile* +:cno map.jax /*:cno* +:cnorea map.jax /*:cnorea* +:cnoreabbrev map.jax /*:cnoreabbrev* +:cnoremap map.jax /*:cnoremap* +:cnoreme gui.jax /*:cnoreme* +:cnoremenu gui.jax /*:cnoremenu* +:co change.jax /*:co* +:col quickfix.jax /*:col* +:colder quickfix.jax /*:colder* +:colo syntax.jax /*:colo* +:colorscheme syntax.jax /*:colorscheme* +:com map.jax /*:com* +:comc map.jax /*:comc* +:comclear map.jax /*:comclear* +:command map.jax /*:command* +:command-addr map.jax /*:command-addr* +:command-bang map.jax /*:command-bang* +:command-bar map.jax /*:command-bar* +:command-buffer map.jax /*:command-buffer* +:command-complete map.jax /*:command-complete* +:command-completion map.jax /*:command-completion* +:command-completion-custom map.jax /*:command-completion-custom* +:command-completion-customlist map.jax /*:command-completion-customlist* +:command-count map.jax /*:command-count* +:command-nargs map.jax /*:command-nargs* +:command-range map.jax /*:command-range* +:command-register map.jax /*:command-register* +:command-verbose map.jax /*:command-verbose* +:comment cmdline.jax /*:comment* +:comp quickfix.jax /*:comp* +:compiler quickfix.jax /*:compiler* +:con eval.jax /*:con* +:conf editing.jax /*:conf* +:confirm editing.jax /*:confirm* +:continue eval.jax /*:continue* +:cope quickfix.jax /*:cope* +:copen quickfix.jax /*:copen* +:copy change.jax /*:copy* +:cp quickfix.jax /*:cp* +:cpf quickfix.jax /*:cpf* +:cpfile quickfix.jax /*:cpfile* +:cprevious quickfix.jax /*:cprevious* +:cq quickfix.jax /*:cq* +:cquit quickfix.jax /*:cquit* +:cr quickfix.jax /*:cr* +:crewind quickfix.jax /*:crewind* +:cs if_cscop.jax /*:cs* +:cscope if_cscop.jax /*:cscope* +:cstag if_cscop.jax /*:cstag* +:cu map.jax /*:cu* +:cuna map.jax /*:cuna* +:cunabbrev map.jax /*:cunabbrev* +:cunmap map.jax /*:cunmap* +:cunme gui.jax /*:cunme* +:cunmenu gui.jax /*:cunmenu* +:cw quickfix.jax /*:cw* +:cwindow quickfix.jax /*:cwindow* +:d change.jax /*:d* +:de change.jax /*:de* +:debug repeat.jax /*:debug* +:debug-name repeat.jax /*:debug-name* +:debugg repeat.jax /*:debugg* +:debuggreedy repeat.jax /*:debuggreedy* +:del change.jax /*:del* +:delc map.jax /*:delc* +:delcommand map.jax /*:delcommand* +:delete change.jax /*:delete* +:delf eval.jax /*:delf* +:delfunction eval.jax /*:delfunction* +:delm motion.jax /*:delm* +:delmarks motion.jax /*:delmarks* +:di change.jax /*:di* +:dif diff.jax /*:dif* +:diffg diff.jax /*:diffg* +:diffget diff.jax /*:diffget* +:diffo diff.jax /*:diffo* +:diffoff diff.jax /*:diffoff* +:diffp diff.jax /*:diffp* +:diffpatch diff.jax /*:diffpatch* +:diffpu diff.jax /*:diffpu* +:diffput diff.jax /*:diffput* +:diffs diff.jax /*:diffs* +:diffsplit diff.jax /*:diffsplit* +:difft diff.jax /*:difft* +:diffthis diff.jax /*:diffthis* +:diffupdate diff.jax /*:diffupdate* +:dig digraph.jax /*:dig* +:digraphs digraph.jax /*:digraphs* +:display change.jax /*:display* +:dj tagsrch.jax /*:dj* +:djump tagsrch.jax /*:djump* +:dl change.jax /*:dl* +:dli tagsrch.jax /*:dli* +:dlist tagsrch.jax /*:dlist* +:do autocmd.jax /*:do* +:doau autocmd.jax /*:doau* +:doautoa autocmd.jax /*:doautoa* +:doautoall autocmd.jax /*:doautoall* +:doautocmd autocmd.jax /*:doautocmd* +:dp change.jax /*:dp* +:dr windows.jax /*:dr* +:drop windows.jax /*:drop* +:ds tagsrch.jax /*:ds* +:dsearch tagsrch.jax /*:dsearch* +:dsp tagsrch.jax /*:dsp* +:dsplit tagsrch.jax /*:dsplit* +:e editing.jax /*:e* +:ea undo.jax /*:ea* +:earlier undo.jax /*:earlier* +:ec eval.jax /*:ec* +:echo eval.jax /*:echo* +:echo-redraw eval.jax /*:echo-redraw* +:echoe eval.jax /*:echoe* +:echoerr eval.jax /*:echoerr* +:echoh eval.jax /*:echoh* +:echohl eval.jax /*:echohl* +:echom eval.jax /*:echom* +:echomsg eval.jax /*:echomsg* +:echon eval.jax /*:echon* +:edit editing.jax /*:edit* +:edit! editing.jax /*:edit!* +:edit!_f editing.jax /*:edit!_f* +:edit_f editing.jax /*:edit_f* +:el eval.jax /*:el* +:else eval.jax /*:else* +:elsei eval.jax /*:elsei* +:elseif eval.jax /*:elseif* +:em gui.jax /*:em* +:emenu gui.jax /*:emenu* +:en eval.jax /*:en* +:endf eval.jax /*:endf* +:endfo eval.jax /*:endfo* +:endfor eval.jax /*:endfor* +:endfunction eval.jax /*:endfunction* +:endif eval.jax /*:endif* +:endt eval.jax /*:endt* +:endtry eval.jax /*:endtry* +:endw eval.jax /*:endw* +:endwhile eval.jax /*:endwhile* +:ene editing.jax /*:ene* +:ene! editing.jax /*:ene!* +:enew editing.jax /*:enew* +:enew! editing.jax /*:enew!* +:ex editing.jax /*:ex* +:exe eval.jax /*:exe* +:exe-comment eval.jax /*:exe-comment* +:execute eval.jax /*:execute* +:exi editing.jax /*:exi* +:exit editing.jax /*:exit* +:exu helphelp.jax /*:exu* +:exusage helphelp.jax /*:exusage* +:f editing.jax /*:f* +:fi editing.jax /*:fi* +:file editing.jax /*:file* +:file_f editing.jax /*:file_f* +:filename editing.jax /*:filename* +:files windows.jax /*:files* +:filet filetype.jax /*:filet* +:filetype filetype.jax /*:filetype* +:filetype-indent-off filetype.jax /*:filetype-indent-off* +:filetype-indent-on filetype.jax /*:filetype-indent-on* +:filetype-off filetype.jax /*:filetype-off* +:filetype-overview filetype.jax /*:filetype-overview* +:filetype-plugin-off filetype.jax /*:filetype-plugin-off* +:filetype-plugin-on filetype.jax /*:filetype-plugin-on* +:filt various.jax /*:filt* +:filter various.jax /*:filter* +:fin editing.jax /*:fin* +:fina eval.jax /*:fina* +:finally eval.jax /*:finally* +:find editing.jax /*:find* +:fini repeat.jax /*:fini* +:finish repeat.jax /*:finish* +:fir editing.jax /*:fir* +:first editing.jax /*:first* +:fix options.jax /*:fix* +:fixdel options.jax /*:fixdel* +:fo fold.jax /*:fo* +:fold fold.jax /*:fold* +:foldc fold.jax /*:foldc* +:foldclose fold.jax /*:foldclose* +:foldd fold.jax /*:foldd* +:folddoc fold.jax /*:folddoc* +:folddoclosed fold.jax /*:folddoclosed* +:folddoopen fold.jax /*:folddoopen* +:foldo fold.jax /*:foldo* +:foldopen fold.jax /*:foldopen* +:for eval.jax /*:for* +:fu eval.jax /*:fu* +:func-abort eval.jax /*:func-abort* +:func-closure eval.jax /*:func-closure* +:func-dict eval.jax /*:func-dict* +:func-range eval.jax /*:func-range* +:function eval.jax /*:function* +:function-verbose eval.jax /*:function-verbose* +:g repeat.jax /*:g* +:global repeat.jax /*:global* +:go motion.jax /*:go* +:goto motion.jax /*:goto* +:gr quickfix.jax /*:gr* +:grep quickfix.jax /*:grep* +:grepa quickfix.jax /*:grepa* +:grepadd quickfix.jax /*:grepadd* +:gu gui_x11.jax /*:gu* +:gui gui_x11.jax /*:gui* +:gv gui_x11.jax /*:gv* +:gvim gui_x11.jax /*:gvim* +:h helphelp.jax /*:h* +:ha print.jax /*:ha* +:hardcopy print.jax /*:hardcopy* +:help helphelp.jax /*:help* +:helpc helphelp.jax /*:helpc* +:helpclose helphelp.jax /*:helpclose* +:helpf helphelp.jax /*:helpf* +:helpfind helphelp.jax /*:helpfind* +:helpg helphelp.jax /*:helpg* +:helpgrep helphelp.jax /*:helpgrep* +:helpt helphelp.jax /*:helpt* +:helptags helphelp.jax /*:helptags* +:hi syntax.jax /*:hi* +:hi-default syntax.jax /*:hi-default* +:hi-link syntax.jax /*:hi-link* +:hi-normal syntax.jax /*:hi-normal* +:hi-normal-cterm syntax.jax /*:hi-normal-cterm* +:hide windows.jax /*:hide* +:highlight syntax.jax /*:highlight* +:highlight-default syntax.jax /*:highlight-default* +:highlight-link syntax.jax /*:highlight-link* +:highlight-normal syntax.jax /*:highlight-normal* +:highlight-verbose syntax.jax /*:highlight-verbose* +:his cmdline.jax /*:his* +:history cmdline.jax /*:history* +:history-indexing cmdline.jax /*:history-indexing* +:i insert.jax /*:i* +:ia map.jax /*:ia* +:iabbrev map.jax /*:iabbrev* +:iabc map.jax /*:iabc* +:iabclear map.jax /*:iabclear* +:if eval.jax /*:if* +:ij tagsrch.jax /*:ij* +:ijump tagsrch.jax /*:ijump* +:il tagsrch.jax /*:il* +:ilist tagsrch.jax /*:ilist* +:im map.jax /*:im* +:imap map.jax /*:imap* +:imap_l map.jax /*:imap_l* +:imapc map.jax /*:imapc* +:imapclear map.jax /*:imapclear* +:ime gui.jax /*:ime* +:imenu gui.jax /*:imenu* +:in insert.jax /*:in* +:index index.jax /*:index* +:ino map.jax /*:ino* +:inorea map.jax /*:inorea* +:inoreabbrev map.jax /*:inoreabbrev* +:inoremap map.jax /*:inoremap* +:inoreme gui.jax /*:inoreme* +:inoremenu gui.jax /*:inoremenu* +:insert insert.jax /*:insert* +:intro starting.jax /*:intro* +:is tagsrch.jax /*:is* +:isearch tagsrch.jax /*:isearch* +:isp tagsrch.jax /*:isp* +:isplit tagsrch.jax /*:isplit* +:iu map.jax /*:iu* +:iuna map.jax /*:iuna* +:iunabbrev map.jax /*:iunabbrev* +:iunmap map.jax /*:iunmap* +:iunme gui.jax /*:iunme* +:iunmenu gui.jax /*:iunmenu* +:j change.jax /*:j* +:join change.jax /*:join* +:ju motion.jax /*:ju* +:jumps motion.jax /*:jumps* +:k motion.jax /*:k* +:kee motion.jax /*:kee* +:keepa editing.jax /*:keepa* +:keepalt editing.jax /*:keepalt* +:keepj motion.jax /*:keepj* +:keepjumps motion.jax /*:keepjumps* +:keepmarks motion.jax /*:keepmarks* +:keepp cmdline.jax /*:keepp* +:keeppatterns cmdline.jax /*:keeppatterns* +:l various.jax /*:l* +:lN quickfix.jax /*:lN* +:lNext quickfix.jax /*:lNext* +:lNf quickfix.jax /*:lNf* +:lNfile quickfix.jax /*:lNfile* +:la editing.jax /*:la* +:lad quickfix.jax /*:lad* +:laddb quickfix.jax /*:laddb* +:laddbuffer quickfix.jax /*:laddbuffer* +:laddexpr quickfix.jax /*:laddexpr* +:laddf quickfix.jax /*:laddf* +:laddfile quickfix.jax /*:laddfile* +:lan mlang.jax /*:lan* +:lang mlang.jax /*:lang* +:language mlang.jax /*:language* +:last editing.jax /*:last* +:lat undo.jax /*:lat* +:later undo.jax /*:later* +:lb quickfix.jax /*:lb* +:lbo quickfix.jax /*:lbo* +:lbottom quickfix.jax /*:lbottom* +:lbuffer quickfix.jax /*:lbuffer* +:lc editing.jax /*:lc* +:lcd editing.jax /*:lcd* +:lch editing.jax /*:lch* +:lchdir editing.jax /*:lchdir* +:lcl quickfix.jax /*:lcl* +:lclose quickfix.jax /*:lclose* +:lcs if_cscop.jax /*:lcs* +:lcscope if_cscop.jax /*:lcscope* +:ldo quickfix.jax /*:ldo* +:le change.jax /*:le* +:left change.jax /*:left* +:lefta windows.jax /*:lefta* +:leftabove windows.jax /*:leftabove* +:let eval.jax /*:let* +:let+= eval.jax /*:let+=* +:let-$ eval.jax /*:let-$* +:let-& eval.jax /*:let-&* +:let-= eval.jax /*:let-=* +:let-@ eval.jax /*:let-@* +:let-environment eval.jax /*:let-environment* +:let-option eval.jax /*:let-option* +:let-register eval.jax /*:let-register* +:let-unpack eval.jax /*:let-unpack* +:let.= eval.jax /*:let.=* +:lex quickfix.jax /*:lex* +:lexpr quickfix.jax /*:lexpr* +:lf quickfix.jax /*:lf* +:lfdo quickfix.jax /*:lfdo* +:lfile quickfix.jax /*:lfile* +:lfir quickfix.jax /*:lfir* +:lfirst quickfix.jax /*:lfirst* +:lg quickfix.jax /*:lg* +:lgetb quickfix.jax /*:lgetb* +:lgetbuffer quickfix.jax /*:lgetbuffer* +:lgete quickfix.jax /*:lgete* +:lgetexpr quickfix.jax /*:lgetexpr* +:lgetfile quickfix.jax /*:lgetfile* +:lgr quickfix.jax /*:lgr* +:lgrep quickfix.jax /*:lgrep* +:lgrepa quickfix.jax /*:lgrepa* +:lgrepadd quickfix.jax /*:lgrepadd* +:lh helphelp.jax /*:lh* +:lhelpgrep helphelp.jax /*:lhelpgrep* +:lhi quickfix.jax /*:lhi* +:lhistory quickfix.jax /*:lhistory* +:list various.jax /*:list* +:ll quickfix.jax /*:ll* +:lla quickfix.jax /*:lla* +:llast quickfix.jax /*:llast* +:lli quickfix.jax /*:lli* +:llist quickfix.jax /*:llist* +:lm map.jax /*:lm* +:lmak quickfix.jax /*:lmak* +:lmake quickfix.jax /*:lmake* +:lmap map.jax /*:lmap* +:lmap_l map.jax /*:lmap_l* +:lmapc map.jax /*:lmapc* +:lmapclear map.jax /*:lmapclear* +:ln map.jax /*:ln* +:lne quickfix.jax /*:lne* +:lnew quickfix.jax /*:lnew* +:lnewer quickfix.jax /*:lnewer* +:lnext quickfix.jax /*:lnext* +:lnf quickfix.jax /*:lnf* +:lnfile quickfix.jax /*:lnfile* +:lnoremap map.jax /*:lnoremap* +:lo starting.jax /*:lo* +:loadk mbyte.jax /*:loadk* +:loadkeymap mbyte.jax /*:loadkeymap* +:loadview starting.jax /*:loadview* +:loc motion.jax /*:loc* +:lockmarks motion.jax /*:lockmarks* +:lockv eval.jax /*:lockv* +:lockvar eval.jax /*:lockvar* +:lol quickfix.jax /*:lol* +:lolder quickfix.jax /*:lolder* +:lop quickfix.jax /*:lop* +:lopen quickfix.jax /*:lopen* +:lp quickfix.jax /*:lp* +:lpf quickfix.jax /*:lpf* +:lpfile quickfix.jax /*:lpfile* +:lprevious quickfix.jax /*:lprevious* +:lr quickfix.jax /*:lr* +:lrewind quickfix.jax /*:lrewind* +:ls windows.jax /*:ls* +:lt tagsrch.jax /*:lt* +:ltag tagsrch.jax /*:ltag* +:lu map.jax /*:lu* +:lua if_lua.jax /*:lua* +:luado if_lua.jax /*:luado* +:luafile if_lua.jax /*:luafile* +:lunmap map.jax /*:lunmap* +:lv quickfix.jax /*:lv* +:lvimgrep quickfix.jax /*:lvimgrep* +:lvimgrepa quickfix.jax /*:lvimgrepa* +:lvimgrepadd quickfix.jax /*:lvimgrepadd* +:lw quickfix.jax /*:lw* +:lwindow quickfix.jax /*:lwindow* +:m change.jax /*:m* +:ma motion.jax /*:ma* +:mak quickfix.jax /*:mak* +:make quickfix.jax /*:make* +:make_makeprg quickfix.jax /*:make_makeprg* +:map map.jax /*:map* +:map! map.jax /*:map!* +:map-<buffer> map.jax /*:map-<buffer>* +:map-<expr> map.jax /*:map-<expr>* +:map-<nowait> map.jax /*:map-<nowait>* +:map-<script> map.jax /*:map-<script>* +:map-<silent> map.jax /*:map-<silent>* +:map-<special> map.jax /*:map-<special>* +:map-<unique> map.jax /*:map-<unique>* +:map-alt-keys map.jax /*:map-alt-keys* +:map-arguments map.jax /*:map-arguments* +:map-commands map.jax /*:map-commands* +:map-expression map.jax /*:map-expression* +:map-local map.jax /*:map-local* +:map-modes map.jax /*:map-modes* +:map-nowait map.jax /*:map-nowait* +:map-operator map.jax /*:map-operator* +:map-script map.jax /*:map-script* +:map-silent map.jax /*:map-silent* +:map-special map.jax /*:map-special* +:map-special-chars map.jax /*:map-special-chars* +:map-special-keys map.jax /*:map-special-keys* +:map-undo map.jax /*:map-undo* +:map-verbose map.jax /*:map-verbose* +:map_l map.jax /*:map_l* +:map_l! map.jax /*:map_l!* +:mapc map.jax /*:mapc* +:mapc! map.jax /*:mapc!* +:mapclear map.jax /*:mapclear* +:mapclear! map.jax /*:mapclear!* +:mark motion.jax /*:mark* +:marks motion.jax /*:marks* +:mat pattern.jax /*:mat* +:match pattern.jax /*:match* +:me gui.jax /*:me* +:menu gui.jax /*:menu* +:menu-<script> gui.jax /*:menu-<script>* +:menu-<silent> gui.jax /*:menu-<silent>* +:menu-<special> gui.jax /*:menu-<special>* +:menu-disable gui.jax /*:menu-disable* +:menu-enable gui.jax /*:menu-enable* +:menu-script gui.jax /*:menu-script* +:menu-silent gui.jax /*:menu-silent* +:menu-special gui.jax /*:menu-special* +:menut mlang.jax /*:menut* +:menutrans mlang.jax /*:menutrans* +:menutranslate mlang.jax /*:menutranslate* +:mes message.jax /*:mes* +:messages message.jax /*:messages* +:mk starting.jax /*:mk* +:mkexrc starting.jax /*:mkexrc* +:mks starting.jax /*:mks* +:mksession starting.jax /*:mksession* +:mksp spell.jax /*:mksp* +:mkspell spell.jax /*:mkspell* +:mkv starting.jax /*:mkv* +:mkvie starting.jax /*:mkvie* +:mkview starting.jax /*:mkview* +:mkvimrc starting.jax /*:mkvimrc* +:mo change.jax /*:mo* +:mod term.jax /*:mod* +:mode term.jax /*:mode* +:move change.jax /*:move* +:mz if_mzsch.jax /*:mz* +:mzf if_mzsch.jax /*:mzf* +:mzfile if_mzsch.jax /*:mzfile* +:mzscheme if_mzsch.jax /*:mzscheme* +:n editing.jax /*:n* +:nbclose netbeans.jax /*:nbclose* +:nbkey netbeans.jax /*:nbkey* +:nbstart netbeans.jax /*:nbstart* +:ne editing.jax /*:ne* +:new windows.jax /*:new* +:next editing.jax /*:next* +:next_f editing.jax /*:next_f* +:nm map.jax /*:nm* +:nmap map.jax /*:nmap* +:nmap_l map.jax /*:nmap_l* +:nmapc map.jax /*:nmapc* +:nmapclear map.jax /*:nmapclear* +:nme gui.jax /*:nme* +:nmenu gui.jax /*:nmenu* +:nn map.jax /*:nn* +:nnoremap map.jax /*:nnoremap* +:nnoreme gui.jax /*:nnoreme* +:nnoremenu gui.jax /*:nnoremenu* +:no map.jax /*:no* +:no! map.jax /*:no!* +:noa autocmd.jax /*:noa* +:noautocmd autocmd.jax /*:noautocmd* +:noh pattern.jax /*:noh* +:nohlsearch pattern.jax /*:nohlsearch* +:nor map.jax /*:nor* +:nore map.jax /*:nore* +:norea map.jax /*:norea* +:noreabbrev map.jax /*:noreabbrev* +:norem map.jax /*:norem* +:noremap map.jax /*:noremap* +:noremap! map.jax /*:noremap!* +:noreme gui.jax /*:noreme* +:noremenu gui.jax /*:noremenu* +:norm various.jax /*:norm* +:normal various.jax /*:normal* +:normal-range various.jax /*:normal-range* +:nos recover.jax /*:nos* +:noswapfile recover.jax /*:noswapfile* +:nu various.jax /*:nu* +:number various.jax /*:number* +:nun map.jax /*:nun* +:nunmap map.jax /*:nunmap* +:nunme gui.jax /*:nunme* +:nunmenu gui.jax /*:nunmenu* +:o vi_diff.jax /*:o* +:ol starting.jax /*:ol* +:oldfiles starting.jax /*:oldfiles* +:om map.jax /*:om* +:omap map.jax /*:omap* +:omap_l map.jax /*:omap_l* +:omapc map.jax /*:omapc* +:omapclear map.jax /*:omapclear* +:ome gui.jax /*:ome* +:omenu gui.jax /*:omenu* +:on windows.jax /*:on* +:only windows.jax /*:only* +:ono map.jax /*:ono* +:onoremap map.jax /*:onoremap* +:onoreme gui.jax /*:onoreme* +:onoremenu gui.jax /*:onoremenu* +:op vi_diff.jax /*:op* +:open vi_diff.jax /*:open* +:opt options.jax /*:opt* +:options options.jax /*:options* +:ou map.jax /*:ou* +:ounmap map.jax /*:ounmap* +:ounme gui.jax /*:ounme* +:ounmenu gui.jax /*:ounmenu* +:ownsyntax syntax.jax /*:ownsyntax* +:p various.jax /*:p* +:pa repeat.jax /*:pa* +:packadd repeat.jax /*:packadd* +:packl repeat.jax /*:packl* +:packloadall repeat.jax /*:packloadall* +:pc windows.jax /*:pc* +:pclose windows.jax /*:pclose* +:pe if_perl.jax /*:pe* +:ped windows.jax /*:ped* +:pedit windows.jax /*:pedit* +:perl if_perl.jax /*:perl* +:perld if_perl.jax /*:perld* +:perldo if_perl.jax /*:perldo* +:po tagsrch.jax /*:po* +:pop tagsrch.jax /*:pop* +:popu gui.jax /*:popu* +:popup gui.jax /*:popup* +:pp windows.jax /*:pp* +:ppop windows.jax /*:ppop* +:pr various.jax /*:pr* +:pre recover.jax /*:pre* +:preserve recover.jax /*:preserve* +:prev editing.jax /*:prev* +:previous editing.jax /*:previous* +:print various.jax /*:print* +:pro change.jax /*:pro* +:prof repeat.jax /*:prof* +:profd repeat.jax /*:profd* +:profdel repeat.jax /*:profdel* +:profile repeat.jax /*:profile* +:promptfind change.jax /*:promptfind* +:promptr change.jax /*:promptr* +:promptrepl change.jax /*:promptrepl* +:ps windows.jax /*:ps* +:psearch windows.jax /*:psearch* +:ptN tagsrch.jax /*:ptN* +:ptNext tagsrch.jax /*:ptNext* +:pta windows.jax /*:pta* +:ptag windows.jax /*:ptag* +:ptf tagsrch.jax /*:ptf* +:ptfirst tagsrch.jax /*:ptfirst* +:ptj tagsrch.jax /*:ptj* +:ptjump tagsrch.jax /*:ptjump* +:ptl tagsrch.jax /*:ptl* +:ptlast tagsrch.jax /*:ptlast* +:ptn tagsrch.jax /*:ptn* +:ptnext tagsrch.jax /*:ptnext* +:ptp tagsrch.jax /*:ptp* +:ptprevious tagsrch.jax /*:ptprevious* +:ptr tagsrch.jax /*:ptr* +:ptrewind tagsrch.jax /*:ptrewind* +:pts tagsrch.jax /*:pts* +:ptselect tagsrch.jax /*:ptselect* +:pu change.jax /*:pu* +:put change.jax /*:put* +:pw editing.jax /*:pw* +:pwd editing.jax /*:pwd* +:py if_pyth.jax /*:py* +:py3 if_pyth.jax /*:py3* +:py3do if_pyth.jax /*:py3do* +:py3file if_pyth.jax /*:py3file* +:pydo if_pyth.jax /*:pydo* +:pyf if_pyth.jax /*:pyf* +:pyfile if_pyth.jax /*:pyfile* +:python if_pyth.jax /*:python* +:python3 if_pyth.jax /*:python3* +:pythonx if_pyth.jax /*:pythonx* +:pyx if_pyth.jax /*:pyx* +:pyxdo if_pyth.jax /*:pyxdo* +:pyxfile if_pyth.jax /*:pyxfile* +:q editing.jax /*:q* +:qa editing.jax /*:qa* +:qall editing.jax /*:qall* +:quit editing.jax /*:quit* +:quita editing.jax /*:quita* +:quitall editing.jax /*:quitall* +:quote cmdline.jax /*:quote* +:r insert.jax /*:r* +:r! insert.jax /*:r!* +:range cmdline.jax /*:range* +:range! change.jax /*:range!* +:re insert.jax /*:re* +:read insert.jax /*:read* +:read! insert.jax /*:read!* +:rec recover.jax /*:rec* +:recover recover.jax /*:recover* +:recover-crypt recover.jax /*:recover-crypt* +:red undo.jax /*:red* +:redi various.jax /*:redi* +:redir various.jax /*:redir* +:redo undo.jax /*:redo* +:redr various.jax /*:redr* +:redraw various.jax /*:redraw* +:redraws various.jax /*:redraws* +:redrawstatus various.jax /*:redrawstatus* +:reg change.jax /*:reg* +:registers change.jax /*:registers* +:res windows.jax /*:res* +:resize windows.jax /*:resize* +:ret change.jax /*:ret* +:retab change.jax /*:retab* +:retab! change.jax /*:retab!* +:retu eval.jax /*:retu* +:return eval.jax /*:return* +:rew editing.jax /*:rew* +:rewind editing.jax /*:rewind* +:ri change.jax /*:ri* +:right change.jax /*:right* +:rightb windows.jax /*:rightb* +:rightbelow windows.jax /*:rightbelow* +:ru repeat.jax /*:ru* +:rub if_ruby.jax /*:rub* +:ruby if_ruby.jax /*:ruby* +:rubyd if_ruby.jax /*:rubyd* +:rubydo if_ruby.jax /*:rubydo* +:rubyf if_ruby.jax /*:rubyf* +:rubyfile if_ruby.jax /*:rubyfile* +:rundo undo.jax /*:rundo* +:runtime repeat.jax /*:runtime* +:rv starting.jax /*:rv* +:rviminfo starting.jax /*:rviminfo* +:s change.jax /*:s* +:s% change.jax /*:s%* +:sI change.jax /*:sI* +:sIc change.jax /*:sIc* +:sIe change.jax /*:sIe* +:sIg change.jax /*:sIg* +:sIl change.jax /*:sIl* +:sIn change.jax /*:sIn* +:sIp change.jax /*:sIp* +:sIr change.jax /*:sIr* +:sN windows.jax /*:sN* +:sNext windows.jax /*:sNext* +:s\= change.jax /*:s\\=* +:s_c change.jax /*:s_c* +:s_flags change.jax /*:s_flags* +:sa windows.jax /*:sa* +:sal windows.jax /*:sal* +:sall windows.jax /*:sall* +:san eval.jax /*:san* +:sandbox eval.jax /*:sandbox* +:sargument windows.jax /*:sargument* +:sav editing.jax /*:sav* +:saveas editing.jax /*:saveas* +:sb windows.jax /*:sb* +:sbN windows.jax /*:sbN* +:sbNext windows.jax /*:sbNext* +:sba windows.jax /*:sba* +:sball windows.jax /*:sball* +:sbf windows.jax /*:sbf* +:sbfirst windows.jax /*:sbfirst* +:sbl windows.jax /*:sbl* +:sblast windows.jax /*:sblast* +:sbm windows.jax /*:sbm* +:sbmodified windows.jax /*:sbmodified* +:sbn windows.jax /*:sbn* +:sbnext windows.jax /*:sbnext* +:sbp windows.jax /*:sbp* +:sbprevious windows.jax /*:sbprevious* +:sbr windows.jax /*:sbr* +:sbrewind windows.jax /*:sbrewind* +:sbuffer windows.jax /*:sbuffer* +:sc change.jax /*:sc* +:scI change.jax /*:scI* +:sce change.jax /*:sce* +:scg change.jax /*:scg* +:sci change.jax /*:sci* +:scl change.jax /*:scl* +:scp change.jax /*:scp* +:scr repeat.jax /*:scr* +:scripte repeat.jax /*:scripte* +:scriptencoding repeat.jax /*:scriptencoding* +:scriptnames repeat.jax /*:scriptnames* +:scs if_cscop.jax /*:scs* +:scscope if_cscop.jax /*:scscope* +:se options.jax /*:se* +:search-args tagsrch.jax /*:search-args* +:set options.jax /*:set* +:set+= options.jax /*:set+=* +:set-! options.jax /*:set-!* +:set-& options.jax /*:set-&* +:set-&vi options.jax /*:set-&vi* +:set-&vim options.jax /*:set-&vim* +:set-= options.jax /*:set-=* +:set-args options.jax /*:set-args* +:set-browse options.jax /*:set-browse* +:set-default options.jax /*:set-default* +:set-inv options.jax /*:set-inv* +:set-termcap options.jax /*:set-termcap* +:set-verbose options.jax /*:set-verbose* +:set^= options.jax /*:set^=* +:set_env options.jax /*:set_env* +:setf options.jax /*:setf* +:setfiletype options.jax /*:setfiletype* +:setg options.jax /*:setg* +:setglobal options.jax /*:setglobal* +:setl options.jax /*:setl* +:setlocal options.jax /*:setlocal* +:sf windows.jax /*:sf* +:sfind windows.jax /*:sfind* +:sfir windows.jax /*:sfir* +:sfirst windows.jax /*:sfirst* +:sg change.jax /*:sg* +:sgI change.jax /*:sgI* +:sgc change.jax /*:sgc* +:sge change.jax /*:sge* +:sgi change.jax /*:sgi* +:sgl change.jax /*:sgl* +:sgn change.jax /*:sgn* +:sgp change.jax /*:sgp* +:sgr change.jax /*:sgr* +:sh various.jax /*:sh* +:shell various.jax /*:shell* +:si change.jax /*:si* +:sic change.jax /*:sic* +:sie change.jax /*:sie* +:sig sign.jax /*:sig* +:sign sign.jax /*:sign* +:sign-define sign.jax /*:sign-define* +:sign-fname sign.jax /*:sign-fname* +:sign-jump sign.jax /*:sign-jump* +:sign-list sign.jax /*:sign-list* +:sign-place sign.jax /*:sign-place* +:sign-place-list sign.jax /*:sign-place-list* +:sign-undefine sign.jax /*:sign-undefine* +:sign-unplace sign.jax /*:sign-unplace* +:sil various.jax /*:sil* +:silent various.jax /*:silent* +:silent! various.jax /*:silent!* +:sim gui_w32.jax /*:sim* +:simalt gui_w32.jax /*:simalt* +:sin change.jax /*:sin* +:sip change.jax /*:sip* +:sir change.jax /*:sir* +:sl various.jax /*:sl* +:sla windows.jax /*:sla* +:slast windows.jax /*:slast* +:sleep various.jax /*:sleep* +:sm change.jax /*:sm* +:smagic change.jax /*:smagic* +:smap map.jax /*:smap* +:smap_l map.jax /*:smap_l* +:smapc map.jax /*:smapc* +:smapclear map.jax /*:smapclear* +:sme gui.jax /*:sme* +:smenu gui.jax /*:smenu* +:smile index.jax /*:smile* +:sn windows.jax /*:sn* +:snext windows.jax /*:snext* +:sno change.jax /*:sno* +:snomagic change.jax /*:snomagic* +:snor map.jax /*:snor* +:snoremap map.jax /*:snoremap* +:snoreme gui.jax /*:snoreme* +:snoremenu gui.jax /*:snoremenu* +:so repeat.jax /*:so* +:sor change.jax /*:sor* +:sort change.jax /*:sort* +:source repeat.jax /*:source* +:source_crnl repeat.jax /*:source_crnl* +:sp windows.jax /*:sp* +:spe spell.jax /*:spe* +:spelld spell.jax /*:spelld* +:spelldump spell.jax /*:spelldump* +:spellgood spell.jax /*:spellgood* +:spelli spell.jax /*:spelli* +:spellinfo spell.jax /*:spellinfo* +:spellr spell.jax /*:spellr* +:spellrepall spell.jax /*:spellrepall* +:spellu spell.jax /*:spellu* +:spellundo spell.jax /*:spellundo* +:spellw spell.jax /*:spellw* +:spellwrong spell.jax /*:spellwrong* +:split windows.jax /*:split* +:split_f windows.jax /*:split_f* +:spr windows.jax /*:spr* +:sprevious windows.jax /*:sprevious* +:sr change.jax /*:sr* +:srI change.jax /*:srI* +:src change.jax /*:src* +:sre windows.jax /*:sre* +:srewind windows.jax /*:srewind* +:srg change.jax /*:srg* +:sri change.jax /*:sri* +:srl change.jax /*:srl* +:srn change.jax /*:srn* +:srp change.jax /*:srp* +:st starting.jax /*:st* +:sta windows.jax /*:sta* +:stag windows.jax /*:stag* +:star repeat.jax /*:star* +:start insert.jax /*:start* +:startgreplace insert.jax /*:startgreplace* +:startinsert insert.jax /*:startinsert* +:startreplace insert.jax /*:startreplace* +:stj tagsrch.jax /*:stj* +:stjump tagsrch.jax /*:stjump* +:stop starting.jax /*:stop* +:stopi insert.jax /*:stopi* +:stopinsert insert.jax /*:stopinsert* +:sts tagsrch.jax /*:sts* +:stselect tagsrch.jax /*:stselect* +:su change.jax /*:su* +:substitute change.jax /*:substitute* +:sun windows.jax /*:sun* +:sunhide windows.jax /*:sunhide* +:sunm map.jax /*:sunm* +:sunmap map.jax /*:sunmap* +:sunme gui.jax /*:sunme* +:sunmenu gui.jax /*:sunmenu* +:sus starting.jax /*:sus* +:suspend starting.jax /*:suspend* +:sv windows.jax /*:sv* +:sview windows.jax /*:sview* +:sw recover.jax /*:sw* +:swapname recover.jax /*:swapname* +:sy syntax.jax /*:sy* +:syn syntax.jax /*:syn* +:syn-arguments syntax.jax /*:syn-arguments* +:syn-case syntax.jax /*:syn-case* +:syn-cchar syntax.jax /*:syn-cchar* +:syn-clear syntax.jax /*:syn-clear* +:syn-cluster syntax.jax /*:syn-cluster* +:syn-conceal syntax.jax /*:syn-conceal* +:syn-conceal-implicit syntax.jax /*:syn-conceal-implicit* +:syn-concealends syntax.jax /*:syn-concealends* +:syn-contained syntax.jax /*:syn-contained* +:syn-containedin syntax.jax /*:syn-containedin* +:syn-contains syntax.jax /*:syn-contains* +:syn-context syntax.jax /*:syn-context* +:syn-default-override usr_06.jax /*:syn-default-override* +:syn-define syntax.jax /*:syn-define* +:syn-display syntax.jax /*:syn-display* +:syn-enable syntax.jax /*:syn-enable* +:syn-end syntax.jax /*:syn-end* +:syn-excludenl syntax.jax /*:syn-excludenl* +:syn-ext-match syntax.jax /*:syn-ext-match* +:syn-extend syntax.jax /*:syn-extend* +:syn-file-remarks syntax.jax /*:syn-file-remarks* +:syn-files syntax.jax /*:syn-files* +:syn-fold syntax.jax /*:syn-fold* +:syn-include syntax.jax /*:syn-include* +:syn-iskeyword syntax.jax /*:syn-iskeyword* +:syn-keepend syntax.jax /*:syn-keepend* +:syn-keyword syntax.jax /*:syn-keyword* +:syn-lc syntax.jax /*:syn-lc* +:syn-leading syntax.jax /*:syn-leading* +:syn-list syntax.jax /*:syn-list* +:syn-manual usr_06.jax /*:syn-manual* +:syn-match syntax.jax /*:syn-match* +:syn-matchgroup syntax.jax /*:syn-matchgroup* +:syn-multi-line syntax.jax /*:syn-multi-line* +:syn-nextgroup syntax.jax /*:syn-nextgroup* +:syn-off usr_06.jax /*:syn-off* +:syn-on syntax.jax /*:syn-on* +:syn-oneline syntax.jax /*:syn-oneline* +:syn-pattern syntax.jax /*:syn-pattern* +:syn-pattern-offset syntax.jax /*:syn-pattern-offset* +:syn-priority syntax.jax /*:syn-priority* +:syn-qstart syntax.jax /*:syn-qstart* +:syn-region syntax.jax /*:syn-region* +:syn-reset syntax.jax /*:syn-reset* +:syn-skip syntax.jax /*:syn-skip* +:syn-skipempty syntax.jax /*:syn-skipempty* +:syn-skipnl syntax.jax /*:syn-skipnl* +:syn-skipwhite syntax.jax /*:syn-skipwhite* +:syn-spell syntax.jax /*:syn-spell* +:syn-start syntax.jax /*:syn-start* +:syn-sync syntax.jax /*:syn-sync* +:syn-sync-ccomment syntax.jax /*:syn-sync-ccomment* +:syn-sync-first syntax.jax /*:syn-sync-first* +:syn-sync-fourth syntax.jax /*:syn-sync-fourth* +:syn-sync-linebreaks syntax.jax /*:syn-sync-linebreaks* +:syn-sync-maxlines syntax.jax /*:syn-sync-maxlines* +:syn-sync-minlines syntax.jax /*:syn-sync-minlines* +:syn-sync-second syntax.jax /*:syn-sync-second* +:syn-sync-third syntax.jax /*:syn-sync-third* +:syn-transparent syntax.jax /*:syn-transparent* +:sync scroll.jax /*:sync* +:syncbind scroll.jax /*:syncbind* +:syntax syntax.jax /*:syntax* +:syntax-enable syntax.jax /*:syntax-enable* +:syntax-on syntax.jax /*:syntax-on* +:syntax-reset syntax.jax /*:syntax-reset* +:syntime syntax.jax /*:syntime* +:t change.jax /*:t* +:tN tagsrch.jax /*:tN* +:tNext tagsrch.jax /*:tNext* +:ta tagsrch.jax /*:ta* +:tab tabpage.jax /*:tab* +:tabN tabpage.jax /*:tabN* +:tabNext tabpage.jax /*:tabNext* +:tabc tabpage.jax /*:tabc* +:tabclose tabpage.jax /*:tabclose* +:tabd tabpage.jax /*:tabd* +:tabdo tabpage.jax /*:tabdo* +:tabe tabpage.jax /*:tabe* +:tabedit tabpage.jax /*:tabedit* +:tabf tabpage.jax /*:tabf* +:tabfind tabpage.jax /*:tabfind* +:tabfir tabpage.jax /*:tabfir* +:tabfirst tabpage.jax /*:tabfirst* +:tabl tabpage.jax /*:tabl* +:tablast tabpage.jax /*:tablast* +:tabm tabpage.jax /*:tabm* +:tabmove tabpage.jax /*:tabmove* +:tabn tabpage.jax /*:tabn* +:tabnew tabpage.jax /*:tabnew* +:tabnext tabpage.jax /*:tabnext* +:tabo tabpage.jax /*:tabo* +:tabonly tabpage.jax /*:tabonly* +:tabp tabpage.jax /*:tabp* +:tabprevious tabpage.jax /*:tabprevious* +:tabr tabpage.jax /*:tabr* +:tabrewind tabpage.jax /*:tabrewind* +:tabs tabpage.jax /*:tabs* +:tag tagsrch.jax /*:tag* +:tags tagsrch.jax /*:tags* +:tc if_tcl.jax /*:tc* +:tcl if_tcl.jax /*:tcl* +:tcld if_tcl.jax /*:tcld* +:tcldo if_tcl.jax /*:tcldo* +:tclf if_tcl.jax /*:tclf* +:tclfile if_tcl.jax /*:tclfile* +:te gui_w32.jax /*:te* +:tearoff gui_w32.jax /*:tearoff* +:tf tagsrch.jax /*:tf* +:tfirst tagsrch.jax /*:tfirst* +:th eval.jax /*:th* +:throw eval.jax /*:throw* +:tj tagsrch.jax /*:tj* +:tjump tagsrch.jax /*:tjump* +:tl tagsrch.jax /*:tl* +:tlast tagsrch.jax /*:tlast* +:tm gui.jax /*:tm* +:tmenu gui.jax /*:tmenu* +:tn tagsrch.jax /*:tn* +:tnext tagsrch.jax /*:tnext* +:topleft windows.jax /*:topleft* +:tp tagsrch.jax /*:tp* +:tprevious tagsrch.jax /*:tprevious* +:tr tagsrch.jax /*:tr* +:trewind tagsrch.jax /*:trewind* +:try eval.jax /*:try* +:ts tagsrch.jax /*:ts* +:tselect tagsrch.jax /*:tselect* +:tu gui.jax /*:tu* +:tunmenu gui.jax /*:tunmenu* +:u undo.jax /*:u* +:un undo.jax /*:un* +:una map.jax /*:una* +:unabbreviate map.jax /*:unabbreviate* +:undo undo.jax /*:undo* +:undoj undo.jax /*:undoj* +:undojoin undo.jax /*:undojoin* +:undol undo.jax /*:undol* +:undolist undo.jax /*:undolist* +:unh windows.jax /*:unh* +:unhide windows.jax /*:unhide* +:unl eval.jax /*:unl* +:unlet eval.jax /*:unlet* +:unlo eval.jax /*:unlo* +:unlockvar eval.jax /*:unlockvar* +:unm map.jax /*:unm* +:unm! map.jax /*:unm!* +:unmap map.jax /*:unmap* +:unmap! map.jax /*:unmap!* +:unme gui.jax /*:unme* +:unmenu gui.jax /*:unmenu* +:unmenu-all gui.jax /*:unmenu-all* +:uns various.jax /*:uns* +:unsilent various.jax /*:unsilent* +:up editing.jax /*:up* +:update editing.jax /*:update* +:v repeat.jax /*:v* +:ve various.jax /*:ve* +:verb various.jax /*:verb* +:verbose various.jax /*:verbose* +:verbose-cmd various.jax /*:verbose-cmd* +:version various.jax /*:version* +:vert windows.jax /*:vert* +:vertical windows.jax /*:vertical* +:vertical-resize windows.jax /*:vertical-resize* +:vglobal repeat.jax /*:vglobal* +:vi editing.jax /*:vi* +:vie editing.jax /*:vie* +:view editing.jax /*:view* +:vim quickfix.jax /*:vim* +:vimgrep quickfix.jax /*:vimgrep* +:vimgrepa quickfix.jax /*:vimgrepa* +:vimgrepadd quickfix.jax /*:vimgrepadd* +:visual editing.jax /*:visual* +:visual_example visual.jax /*:visual_example* +:viu helphelp.jax /*:viu* +:viusage helphelp.jax /*:viusage* +:vm map.jax /*:vm* +:vmap map.jax /*:vmap* +:vmap_l map.jax /*:vmap_l* +:vmapc map.jax /*:vmapc* +:vmapclear map.jax /*:vmapclear* +:vme gui.jax /*:vme* +:vmenu gui.jax /*:vmenu* +:vn map.jax /*:vn* +:vne windows.jax /*:vne* +:vnew windows.jax /*:vnew* +:vnoremap map.jax /*:vnoremap* +:vnoreme gui.jax /*:vnoreme* +:vnoremenu gui.jax /*:vnoremenu* +:vs windows.jax /*:vs* +:vsplit windows.jax /*:vsplit* +:vu map.jax /*:vu* +:vunmap map.jax /*:vunmap* +:vunme gui.jax /*:vunme* +:vunmenu gui.jax /*:vunmenu* +:w editing.jax /*:w* +:w! editing.jax /*:w!* +:wN editing.jax /*:wN* +:wNext editing.jax /*:wNext* +:w_a editing.jax /*:w_a* +:w_c editing.jax /*:w_c* +:w_f editing.jax /*:w_f* +:wa editing.jax /*:wa* +:wall editing.jax /*:wall* +:wh eval.jax /*:wh* +:while eval.jax /*:while* +:win gui.jax /*:win* +:winc windows.jax /*:winc* +:wincmd windows.jax /*:wincmd* +:windo windows.jax /*:windo* +:winp gui.jax /*:winp* +:winpos gui.jax /*:winpos* +:winsize gui.jax /*:winsize* +:wn editing.jax /*:wn* +:wnext editing.jax /*:wnext* +:wp editing.jax /*:wp* +:wprevious editing.jax /*:wprevious* +:wq editing.jax /*:wq* +:wqa editing.jax /*:wqa* +:wqall editing.jax /*:wqall* +:write editing.jax /*:write* +:write_a editing.jax /*:write_a* +:write_c editing.jax /*:write_c* +:write_f editing.jax /*:write_f* +:ws workshop.jax /*:ws* +:wsverb workshop.jax /*:wsverb* +:wundo undo.jax /*:wundo* +:wv starting.jax /*:wv* +:wviminfo starting.jax /*:wviminfo* +:x editing.jax /*:x* +:xa editing.jax /*:xa* +:xall editing.jax /*:xall* +:xit editing.jax /*:xit* +:xm map.jax /*:xm* +:xmap map.jax /*:xmap* +:xmap_l map.jax /*:xmap_l* +:xmapc map.jax /*:xmapc* +:xmapclear map.jax /*:xmapclear* +:xme gui.jax /*:xme* +:xmenu gui.jax /*:xmenu* +:xn map.jax /*:xn* +:xnoremap map.jax /*:xnoremap* +:xnoreme gui.jax /*:xnoreme* +:xnoremenu gui.jax /*:xnoremenu* +:xu map.jax /*:xu* +:xunmap map.jax /*:xunmap* +:xunme gui.jax /*:xunme* +:xunmenu gui.jax /*:xunmenu* +:y change.jax /*:y* +:yank change.jax /*:yank* +:z various.jax /*:z* +:z# various.jax /*:z#* +:~ change.jax /*:~* +; motion.jax /*;* +< change.jax /*<* +<2-LeftMouse> term.jax /*<2-LeftMouse>* +<3-LeftMouse> term.jax /*<3-LeftMouse>* +<4-LeftMouse> term.jax /*<4-LeftMouse>* +<< change.jax /*<<* +<> intro.jax /*<>* +<A- intro.jax /*<A-* +<A-LeftMouse> term.jax /*<A-LeftMouse>* +<A-RightMouse> term.jax /*<A-RightMouse>* +<BS> motion.jax /*<BS>* +<Bar> intro.jax /*<Bar>* +<Bslash> intro.jax /*<Bslash>* +<C- intro.jax /*<C-* +<C-Del> os_dos.jax /*<C-Del>* +<C-End> motion.jax /*<C-End>* +<C-Home> motion.jax /*<C-Home>* +<C-Insert> os_dos.jax /*<C-Insert>* +<C-Left> motion.jax /*<C-Left>* +<C-LeftMouse> tagsrch.jax /*<C-LeftMouse>* +<C-PageDown> tabpage.jax /*<C-PageDown>* +<C-PageUp> tabpage.jax /*<C-PageUp>* +<C-Right> motion.jax /*<C-Right>* +<C-RightMouse> tagsrch.jax /*<C-RightMouse>* +<C-ScrollWheelDown> scroll.jax /*<C-ScrollWheelDown>* +<C-ScrollWheelLeft> scroll.jax /*<C-ScrollWheelLeft>* +<C-ScrollWheelRight> scroll.jax /*<C-ScrollWheelRight>* +<C-ScrollWheelUp> scroll.jax /*<C-ScrollWheelUp>* +<CR> motion.jax /*<CR>* +<CSI> intro.jax /*<CSI>* +<Char-> map.jax /*<Char->* +<Char> map.jax /*<Char>* +<CursorHold> autocmd.jax /*<CursorHold>* +<D- intro.jax /*<D-* +<Del> change.jax /*<Del>* +<Down> motion.jax /*<Down>* +<Drop> change.jax /*<Drop>* +<EOL> intro.jax /*<EOL>* +<End> motion.jax /*<End>* +<Enter> intro.jax /*<Enter>* +<Esc> intro.jax /*<Esc>* +<F10> term.jax /*<F10>* +<F11> term.jax /*<F11>* +<F12> term.jax /*<F12>* +<F13> term.jax /*<F13>* +<F14> term.jax /*<F14>* +<F15> term.jax /*<F15>* +<F16> term.jax /*<F16>* +<F17> term.jax /*<F17>* +<F18> term.jax /*<F18>* +<F19> term.jax /*<F19>* +<F1> helphelp.jax /*<F1>* +<F2> term.jax /*<F2>* +<F3> term.jax /*<F3>* +<F4> term.jax /*<F4>* +<F5> term.jax /*<F5>* +<F6> term.jax /*<F6>* +<F7> term.jax /*<F7>* +<F8> term.jax /*<F8>* +<F9> term.jax /*<F9>* +<Help> helphelp.jax /*<Help>* +<Home> motion.jax /*<Home>* +<Insert> insert.jax /*<Insert>* +<Leader> map.jax /*<Leader>* +<Left> motion.jax /*<Left>* +<LeftDrag> term.jax /*<LeftDrag>* +<LeftMouse> visual.jax /*<LeftMouse>* +<LeftRelease> visual.jax /*<LeftRelease>* +<LocalLeader> map.jax /*<LocalLeader>* +<M- intro.jax /*<M-* +<MiddleDrag> term.jax /*<MiddleDrag>* +<MiddleMouse> change.jax /*<MiddleMouse>* +<MiddleRelease> term.jax /*<MiddleRelease>* +<Mouse> term.jax /*<Mouse>* +<MouseDown> scroll.jax /*<MouseDown>* +<MouseUp> scroll.jax /*<MouseUp>* +<NL> motion.jax /*<NL>* +<Nop> map.jax /*<Nop>* +<Nul> intro.jax /*<Nul>* +<PageDown> scroll.jax /*<PageDown>* +<PageUp> scroll.jax /*<PageUp>* +<Plug> map.jax /*<Plug>* +<Return> intro.jax /*<Return>* +<Right> motion.jax /*<Right>* +<RightDrag> term.jax /*<RightDrag>* +<RightMouse> visual.jax /*<RightMouse>* +<RightRelease> term.jax /*<RightRelease>* +<S- intro.jax /*<S-* +<S-Del> os_dos.jax /*<S-Del>* +<S-Down> scroll.jax /*<S-Down>* +<S-End> term.jax /*<S-End>* +<S-F10> term.jax /*<S-F10>* +<S-F11> term.jax /*<S-F11>* +<S-F12> term.jax /*<S-F12>* +<S-F1> intro.jax /*<S-F1>* +<S-F2> term.jax /*<S-F2>* +<S-F3> term.jax /*<S-F3>* +<S-F4> term.jax /*<S-F4>* +<S-F5> term.jax /*<S-F5>* +<S-F6> term.jax /*<S-F6>* +<S-F7> term.jax /*<S-F7>* +<S-F8> term.jax /*<S-F8>* +<S-F9> term.jax /*<S-F9>* +<S-Home> term.jax /*<S-Home>* +<S-Insert> os_dos.jax /*<S-Insert>* +<S-Left> motion.jax /*<S-Left>* +<S-LeftMouse> term.jax /*<S-LeftMouse>* +<S-Right> motion.jax /*<S-Right>* +<S-RightMouse> term.jax /*<S-RightMouse>* +<S-ScrollWheelDown> scroll.jax /*<S-ScrollWheelDown>* +<S-ScrollWheelLeft> scroll.jax /*<S-ScrollWheelLeft>* +<S-ScrollWheelRight> scroll.jax /*<S-ScrollWheelRight>* +<S-ScrollWheelUp> scroll.jax /*<S-ScrollWheelUp>* +<S-Tab> term.jax /*<S-Tab>* +<S-Up> scroll.jax /*<S-Up>* +<S-xF1> term.jax /*<S-xF1>* +<S-xF2> term.jax /*<S-xF2>* +<S-xF3> term.jax /*<S-xF3>* +<S-xF4> term.jax /*<S-xF4>* +<SID> map.jax /*<SID>* +<SNR> map.jax /*<SNR>* +<ScrollWheelDown> scroll.jax /*<ScrollWheelDown>* +<ScrollWheelLeft> scroll.jax /*<ScrollWheelLeft>* +<ScrollWheelRight> scroll.jax /*<ScrollWheelRight>* +<ScrollWheelUp> scroll.jax /*<ScrollWheelUp>* +<Space> motion.jax /*<Space>* +<Tab> motion.jax /*<Tab>* +<Undo> undo.jax /*<Undo>* +<Up> motion.jax /*<Up>* +<abuf> cmdline.jax /*<abuf>* +<afile> cmdline.jax /*<afile>* +<amatch> cmdline.jax /*<amatch>* +<args> map.jax /*<args>* +<bang> map.jax /*<bang>* +<buffer=N> autocmd.jax /*<buffer=N>* +<buffer=abuf> autocmd.jax /*<buffer=abuf>* +<cfile> cmdline.jax /*<cfile>* +<character> intro.jax /*<character>* +<count> map.jax /*<count>* +<f-args> map.jax /*<f-args>* +<k0> term.jax /*<k0>* +<k1> term.jax /*<k1>* +<k2> term.jax /*<k2>* +<k3> term.jax /*<k3>* +<k4> term.jax /*<k4>* +<k5> term.jax /*<k5>* +<k6> term.jax /*<k6>* +<k7> term.jax /*<k7>* +<k8> term.jax /*<k8>* +<k9> term.jax /*<k9>* +<kDivide> term.jax /*<kDivide>* +<kEnd> motion.jax /*<kEnd>* +<kEnter> term.jax /*<kEnter>* +<kHome> motion.jax /*<kHome>* +<kMinus> term.jax /*<kMinus>* +<kMultiply> term.jax /*<kMultiply>* +<kPageDown> scroll.jax /*<kPageDown>* +<kPageUp> scroll.jax /*<kPageUp>* +<kPlus> term.jax /*<kPlus>* +<kPoint> term.jax /*<kPoint>* +<line1> map.jax /*<line1>* +<line2> map.jax /*<line2>* +<lt> intro.jax /*<lt>* +<mods> map.jax /*<mods>* +<nomodeline> autocmd.jax /*<nomodeline>* +<q-args> map.jax /*<q-args>* +<reg> map.jax /*<reg>* +<register> map.jax /*<register>* +<sfile> cmdline.jax /*<sfile>* +<slnum> cmdline.jax /*<slnum>* +<xCSI> intro.jax /*<xCSI>* +<xDown> term.jax /*<xDown>* +<xEnd> term.jax /*<xEnd>* +<xEnd>-xterm term.jax /*<xEnd>-xterm* +<xF1> term.jax /*<xF1>* +<xF1>-xterm term.jax /*<xF1>-xterm* +<xF2> term.jax /*<xF2>* +<xF2>-xterm term.jax /*<xF2>-xterm* +<xF3> term.jax /*<xF3>* +<xF3>-xterm term.jax /*<xF3>-xterm* +<xF4> term.jax /*<xF4>* +<xF4>-xterm term.jax /*<xF4>-xterm* +<xHome> term.jax /*<xHome>* +<xHome>-xterm term.jax /*<xHome>-xterm* +<xLeft> term.jax /*<xLeft>* +<xRight> term.jax /*<xRight>* +<xUp> term.jax /*<xUp>* += change.jax /*=* +== change.jax /*==* +> change.jax /*>* +>> change.jax /*>>* +>backtrace repeat.jax /*>backtrace* +>bt repeat.jax /*>bt* +>cont repeat.jax /*>cont* +>down repeat.jax /*>down* +>finish repeat.jax /*>finish* +>frame repeat.jax /*>frame* +>interrupt repeat.jax /*>interrupt* +>next repeat.jax /*>next* +>quit repeat.jax /*>quit* +>step repeat.jax /*>step* +>up repeat.jax /*>up* +>where repeat.jax /*>where* +? pattern.jax /*?* +?<CR> pattern.jax /*?<CR>* +@ repeat.jax /*@* +@/ change.jax /*@\/* +@: repeat.jax /*@:* +@= change.jax /*@=* +@@ repeat.jax /*@@* +@r eval.jax /*@r* +A insert.jax /*A* +ACL editing.jax /*ACL* +ATTENTION usr_11.jax /*ATTENTION* +Abbreviations map.jax /*Abbreviations* +Aleph options.jax /*Aleph* +Amiga os_amiga.jax /*Amiga* +Arabic arabic.jax /*Arabic* +Atari os_mint.jax /*Atari* +Athena gui_x11.jax /*Athena* +B motion.jax /*B* +BeBox os_beos.jax /*BeBox* +BeOS os_beos.jax /*BeOS* +Bram intro.jax /*Bram* +BufAdd autocmd.jax /*BufAdd* +BufCreate autocmd.jax /*BufCreate* +BufDelete autocmd.jax /*BufDelete* +BufEnter autocmd.jax /*BufEnter* +BufFilePost autocmd.jax /*BufFilePost* +BufFilePre autocmd.jax /*BufFilePre* +BufHidden autocmd.jax /*BufHidden* +BufLeave autocmd.jax /*BufLeave* +BufNew autocmd.jax /*BufNew* +BufNewFile autocmd.jax /*BufNewFile* +BufRead autocmd.jax /*BufRead* +BufReadCmd autocmd.jax /*BufReadCmd* +BufReadPost autocmd.jax /*BufReadPost* +BufReadPre autocmd.jax /*BufReadPre* +BufUnload autocmd.jax /*BufUnload* +BufWinEnter autocmd.jax /*BufWinEnter* +BufWinLeave autocmd.jax /*BufWinLeave* +BufWipeout autocmd.jax /*BufWipeout* +BufWrite autocmd.jax /*BufWrite* +BufWriteCmd autocmd.jax /*BufWriteCmd* +BufWritePost autocmd.jax /*BufWritePost* +BufWritePre autocmd.jax /*BufWritePre* +C change.jax /*C* +C-editing tips.jax /*C-editing* +C-indenting indent.jax /*C-indenting* +COMSPEC starting.jax /*COMSPEC* +CR-used-for-NL pattern.jax /*CR-used-for-NL* +CTRL-6 editing.jax /*CTRL-6* +CTRL-<PageDown> tabpage.jax /*CTRL-<PageDown>* +CTRL-<PageUp> tabpage.jax /*CTRL-<PageUp>* +CTRL-A change.jax /*CTRL-A* +CTRL-B scroll.jax /*CTRL-B* +CTRL-C pattern.jax /*CTRL-C* +CTRL-D scroll.jax /*CTRL-D* +CTRL-E scroll.jax /*CTRL-E* +CTRL-F scroll.jax /*CTRL-F* +CTRL-G editing.jax /*CTRL-G* +CTRL-H motion.jax /*CTRL-H* +CTRL-I motion.jax /*CTRL-I* +CTRL-J motion.jax /*CTRL-J* +CTRL-L various.jax /*CTRL-L* +CTRL-M motion.jax /*CTRL-M* +CTRL-N motion.jax /*CTRL-N* +CTRL-O motion.jax /*CTRL-O* +CTRL-P motion.jax /*CTRL-P* +CTRL-Q gui_w32.jax /*CTRL-Q* +CTRL-R undo.jax /*CTRL-R* +CTRL-T tagsrch.jax /*CTRL-T* +CTRL-U scroll.jax /*CTRL-U* +CTRL-V visual.jax /*CTRL-V* +CTRL-V-alternative gui_w32.jax /*CTRL-V-alternative* +CTRL-W index.jax /*CTRL-W* +CTRL-W_+ windows.jax /*CTRL-W_+* +CTRL-W_- windows.jax /*CTRL-W_-* +CTRL-W_< windows.jax /*CTRL-W_<* +CTRL-W_<BS> windows.jax /*CTRL-W_<BS>* +CTRL-W_<CR> quickfix.jax /*CTRL-W_<CR>* +CTRL-W_<Down> windows.jax /*CTRL-W_<Down>* +CTRL-W_<Enter> quickfix.jax /*CTRL-W_<Enter>* +CTRL-W_<Left> windows.jax /*CTRL-W_<Left>* +CTRL-W_<Right> windows.jax /*CTRL-W_<Right>* +CTRL-W_<Up> windows.jax /*CTRL-W_<Up>* +CTRL-W_= windows.jax /*CTRL-W_=* +CTRL-W_> windows.jax /*CTRL-W_>* +CTRL-W_CTRL-B windows.jax /*CTRL-W_CTRL-B* +CTRL-W_CTRL-C windows.jax /*CTRL-W_CTRL-C* +CTRL-W_CTRL-D tagsrch.jax /*CTRL-W_CTRL-D* +CTRL-W_CTRL-F windows.jax /*CTRL-W_CTRL-F* +CTRL-W_CTRL-H windows.jax /*CTRL-W_CTRL-H* +CTRL-W_CTRL-I tagsrch.jax /*CTRL-W_CTRL-I* +CTRL-W_CTRL-J windows.jax /*CTRL-W_CTRL-J* +CTRL-W_CTRL-K windows.jax /*CTRL-W_CTRL-K* +CTRL-W_CTRL-L windows.jax /*CTRL-W_CTRL-L* +CTRL-W_CTRL-N windows.jax /*CTRL-W_CTRL-N* +CTRL-W_CTRL-O windows.jax /*CTRL-W_CTRL-O* +CTRL-W_CTRL-P windows.jax /*CTRL-W_CTRL-P* +CTRL-W_CTRL-Q windows.jax /*CTRL-W_CTRL-Q* +CTRL-W_CTRL-R windows.jax /*CTRL-W_CTRL-R* +CTRL-W_CTRL-S windows.jax /*CTRL-W_CTRL-S* +CTRL-W_CTRL-T windows.jax /*CTRL-W_CTRL-T* +CTRL-W_CTRL-V windows.jax /*CTRL-W_CTRL-V* +CTRL-W_CTRL-W windows.jax /*CTRL-W_CTRL-W* +CTRL-W_CTRL-X windows.jax /*CTRL-W_CTRL-X* +CTRL-W_CTRL-Z windows.jax /*CTRL-W_CTRL-Z* +CTRL-W_CTRL-] windows.jax /*CTRL-W_CTRL-]* +CTRL-W_CTRL-^ windows.jax /*CTRL-W_CTRL-^* +CTRL-W_CTRL-_ windows.jax /*CTRL-W_CTRL-_* +CTRL-W_F windows.jax /*CTRL-W_F* +CTRL-W_H windows.jax /*CTRL-W_H* +CTRL-W_J windows.jax /*CTRL-W_J* +CTRL-W_K windows.jax /*CTRL-W_K* +CTRL-W_L windows.jax /*CTRL-W_L* +CTRL-W_P windows.jax /*CTRL-W_P* +CTRL-W_R windows.jax /*CTRL-W_R* +CTRL-W_S windows.jax /*CTRL-W_S* +CTRL-W_T windows.jax /*CTRL-W_T* +CTRL-W_W windows.jax /*CTRL-W_W* +CTRL-W_] windows.jax /*CTRL-W_]* +CTRL-W_^ windows.jax /*CTRL-W_^* +CTRL-W__ windows.jax /*CTRL-W__* +CTRL-W_b windows.jax /*CTRL-W_b* +CTRL-W_bar windows.jax /*CTRL-W_bar* +CTRL-W_c windows.jax /*CTRL-W_c* +CTRL-W_d tagsrch.jax /*CTRL-W_d* +CTRL-W_f windows.jax /*CTRL-W_f* +CTRL-W_gF windows.jax /*CTRL-W_gF* +CTRL-W_g] windows.jax /*CTRL-W_g]* +CTRL-W_g_CTRL-] windows.jax /*CTRL-W_g_CTRL-]* +CTRL-W_gf windows.jax /*CTRL-W_gf* +CTRL-W_g} windows.jax /*CTRL-W_g}* +CTRL-W_h windows.jax /*CTRL-W_h* +CTRL-W_i tagsrch.jax /*CTRL-W_i* +CTRL-W_j windows.jax /*CTRL-W_j* +CTRL-W_k windows.jax /*CTRL-W_k* +CTRL-W_l windows.jax /*CTRL-W_l* +CTRL-W_n windows.jax /*CTRL-W_n* +CTRL-W_o windows.jax /*CTRL-W_o* +CTRL-W_p windows.jax /*CTRL-W_p* +CTRL-W_q windows.jax /*CTRL-W_q* +CTRL-W_r windows.jax /*CTRL-W_r* +CTRL-W_s windows.jax /*CTRL-W_s* +CTRL-W_t windows.jax /*CTRL-W_t* +CTRL-W_v windows.jax /*CTRL-W_v* +CTRL-W_w windows.jax /*CTRL-W_w* +CTRL-W_x windows.jax /*CTRL-W_x* +CTRL-W_z windows.jax /*CTRL-W_z* +CTRL-W_} windows.jax /*CTRL-W_}* +CTRL-X change.jax /*CTRL-X* +CTRL-Y scroll.jax /*CTRL-Y* +CTRL-Z starting.jax /*CTRL-Z* +CTRL-\_CTRL-G intro.jax /*CTRL-\\_CTRL-G* +CTRL-\_CTRL-N intro.jax /*CTRL-\\_CTRL-N* +CTRL-] tagsrch.jax /*CTRL-]* +CTRL-^ editing.jax /*CTRL-^* +CTRL-{char} intro.jax /*CTRL-{char}* +Channel eval.jax /*Channel* +Channels eval.jax /*Channels* +Chinese mbyte.jax /*Chinese* +Cmd-event autocmd.jax /*Cmd-event* +CmdUndefined autocmd.jax /*CmdUndefined* +Cmdline cmdline.jax /*Cmdline* +Cmdline-mode cmdline.jax /*Cmdline-mode* +CmdwinEnter autocmd.jax /*CmdwinEnter* +CmdwinLeave autocmd.jax /*CmdwinLeave* +ColorScheme autocmd.jax /*ColorScheme* +Command-line cmdline.jax /*Command-line* +Command-line-mode cmdline.jax /*Command-line-mode* +CompleteDone autocmd.jax /*CompleteDone* +Contents quickref.jax /*Contents* +Cscope if_cscop.jax /*Cscope* +CursorHold autocmd.jax /*CursorHold* +CursorHold-example windows.jax /*CursorHold-example* +CursorHoldI autocmd.jax /*CursorHoldI* +CursorIM mbyte.jax /*CursorIM* +CursorMoved autocmd.jax /*CursorMoved* +CursorMovedI autocmd.jax /*CursorMovedI* +D change.jax /*D* +DOS os_dos.jax /*DOS* +DOS-format editing.jax /*DOS-format* +DOS-format-write editing.jax /*DOS-format-write* +Dictionaries eval.jax /*Dictionaries* +Dictionary eval.jax /*Dictionary* +Dictionary-function eval.jax /*Dictionary-function* +Digraphs digraph.jax /*Digraphs* +E motion.jax /*E* +E10 message.jax /*E10* +E100 diff.jax /*E100* +E101 diff.jax /*E101* +E102 diff.jax /*E102* +E103 diff.jax /*E103* +E104 digraph.jax /*E104* +E105 mbyte.jax /*E105* +E107 eval.jax /*E107* +E108 eval.jax /*E108* +E109 eval.jax /*E109* +E11 cmdline.jax /*E11* +E110 eval.jax /*E110* +E111 eval.jax /*E111* +E112 eval.jax /*E112* +E113 eval.jax /*E113* +E114 eval.jax /*E114* +E115 eval.jax /*E115* +E116 eval.jax /*E116* +E117 eval.jax /*E117* +E118 eval.jax /*E118* +E119 eval.jax /*E119* +E12 message.jax /*E12* +E120 eval.jax /*E120* +E121 eval.jax /*E121* +E122 eval.jax /*E122* +E123 eval.jax /*E123* +E124 eval.jax /*E124* +E125 eval.jax /*E125* +E126 eval.jax /*E126* +E127 eval.jax /*E127* +E128 eval.jax /*E128* +E129 eval.jax /*E129* +E13 message.jax /*E13* +E130 eval.jax /*E130* +E131 eval.jax /*E131* +E132 eval.jax /*E132* +E133 eval.jax /*E133* +E134 change.jax /*E134* +E135 autocmd.jax /*E135* +E136 starting.jax /*E136* +E137 starting.jax /*E137* +E138 starting.jax /*E138* +E139 message.jax /*E139* +E14 cmdline.jax /*E14* +E140 message.jax /*E140* +E141 message.jax /*E141* +E142 message.jax /*E142* +E143 autocmd.jax /*E143* +E144 various.jax /*E144* +E145 starting.jax /*E145* +E146 change.jax /*E146* +E147 repeat.jax /*E147* +E148 repeat.jax /*E148* +E149 helphelp.jax /*E149* +E15 eval.jax /*E15* +E150 helphelp.jax /*E150* +E151 helphelp.jax /*E151* +E152 helphelp.jax /*E152* +E153 helphelp.jax /*E153* +E154 helphelp.jax /*E154* +E155 sign.jax /*E155* +E156 sign.jax /*E156* +E157 sign.jax /*E157* +E158 sign.jax /*E158* +E159 sign.jax /*E159* +E16 cmdline.jax /*E16* +E160 sign.jax /*E160* +E161 repeat.jax /*E161* +E162 message.jax /*E162* +E163 editing.jax /*E163* +E164 editing.jax /*E164* +E165 editing.jax /*E165* +E166 message.jax /*E166* +E167 repeat.jax /*E167* +E168 repeat.jax /*E168* +E169 message.jax /*E169* +E17 message.jax /*E17* +E170 eval.jax /*E170* +E171 eval.jax /*E171* +E172 message.jax /*E172* +E173 message.jax /*E173* +E174 map.jax /*E174* +E175 map.jax /*E175* +E176 map.jax /*E176* +E177 map.jax /*E177* +E178 map.jax /*E178* +E179 map.jax /*E179* +E18 eval.jax /*E18* +E180 map.jax /*E180* +E181 map.jax /*E181* +E182 map.jax /*E182* +E183 map.jax /*E183* +E184 map.jax /*E184* +E185 syntax.jax /*E185* +E186 editing.jax /*E186* +E187 editing.jax /*E187* +E188 gui.jax /*E188* +E189 message.jax /*E189* +E19 message.jax /*E19* +E190 message.jax /*E190* +E191 motion.jax /*E191* +E192 message.jax /*E192* +E193 eval.jax /*E193* +E194 message.jax /*E194* +E195 starting.jax /*E195* +E196 various.jax /*E196* +E197 mlang.jax /*E197* +E198 options.jax /*E198* +E199 cmdline.jax /*E199* +E20 motion.jax /*E20* +E200 autocmd.jax /*E200* +E201 autocmd.jax /*E201* +E202 options.jax /*E202* +E203 autocmd.jax /*E203* +E204 autocmd.jax /*E204* +E205 options.jax /*E205* +E206 options.jax /*E206* +E207 editing.jax /*E207* +E208 message.jax /*E208* +E209 message.jax /*E209* +E21 options.jax /*E21* +E210 message.jax /*E210* +E211 message.jax /*E211* +E212 message.jax /*E212* +E213 options.jax /*E213* +E214 options.jax /*E214* +E215 autocmd.jax /*E215* +E216 autocmd.jax /*E216* +E217 autocmd.jax /*E217* +E218 autocmd.jax /*E218* +E219 message.jax /*E219* +E22 message.jax /*E22* +E220 message.jax /*E220* +E222 message.jax /*E222* +E223 options.jax /*E223* +E224 map.jax /*E224* +E225 map.jax /*E225* +E226 map.jax /*E226* +E227 map.jax /*E227* +E228 message.jax /*E228* +E229 gui.jax /*E229* +E23 message.jax /*E23* +E230 starting.jax /*E230* +E231 options.jax /*E231* +E232 message.jax /*E232* +E233 gui.jax /*E233* +E234 options.jax /*E234* +E235 options.jax /*E235* +E236 options.jax /*E236* +E237 print.jax /*E237* +E238 print.jax /*E238* +E239 sign.jax /*E239* +E24 message.jax /*E24* +E240 remote.jax /*E240* +E241 eval.jax /*E241* +E243 if_ole.jax /*E243* +E244 options.jax /*E244* +E245 options.jax /*E245* +E246 autocmd.jax /*E246* +E247 remote.jax /*E247* +E248 remote.jax /*E248* +E25 message.jax /*E25* +E250 options.jax /*E250* +E251 remote.jax /*E251* +E252 options.jax /*E252* +E253 mbyte.jax /*E253* +E254 message.jax /*E254* +E255 sign.jax /*E255* +E256 message.jax /*E256* +E257 if_cscop.jax /*E257* +E258 remote.jax /*E258* +E259 if_cscop.jax /*E259* +E26 rileft.jax /*E26* +E261 if_cscop.jax /*E261* +E262 if_cscop.jax /*E262* +E263 if_pyth.jax /*E263* +E264 if_pyth.jax /*E264* +E265 if_ruby.jax /*E265* +E266 if_ruby.jax /*E266* +E267 if_ruby.jax /*E267* +E268 if_ruby.jax /*E268* +E269 if_ruby.jax /*E269* +E27 farsi.jax /*E27* +E270 if_ruby.jax /*E270* +E271 if_ruby.jax /*E271* +E272 if_ruby.jax /*E272* +E273 if_ruby.jax /*E273* +E277 remote.jax /*E277* +E28 syntax.jax /*E28* +E280 if_tcl.jax /*E280* +E282 starting.jax /*E282* +E283 motion.jax /*E283* +E284 mbyte.jax /*E284* +E285 mbyte.jax /*E285* +E286 mbyte.jax /*E286* +E287 mbyte.jax /*E287* +E288 mbyte.jax /*E288* +E289 mbyte.jax /*E289* +E29 change.jax /*E29* +E293 message.jax /*E293* +E294 message.jax /*E294* +E295 message.jax /*E295* +E296 message.jax /*E296* +E297 message.jax /*E297* +E298 message.jax /*E298* +E299 if_perl.jax /*E299* +E30 change.jax /*E30* +E300 message.jax /*E300* +E301 message.jax /*E301* +E302 message.jax /*E302* +E303 message.jax /*E303* +E304 message.jax /*E304* +E305 recover.jax /*E305* +E306 recover.jax /*E306* +E307 recover.jax /*E307* +E308 recover.jax /*E308* +E309 recover.jax /*E309* +E31 message.jax /*E31* +E310 recover.jax /*E310* +E311 recover.jax /*E311* +E312 recover.jax /*E312* +E313 recover.jax /*E313* +E314 recover.jax /*E314* +E315 message.jax /*E315* +E316 message.jax /*E316* +E317 message.jax /*E317* +E318 message.jax /*E318* +E319 message.jax /*E319* +E32 message.jax /*E32* +E320 message.jax /*E320* +E321 editing.jax /*E321* +E322 message.jax /*E322* +E323 message.jax /*E323* +E324 print.jax /*E324* +E325 usr_11.jax /*E325* +E326 recover.jax /*E326* +E327 gui.jax /*E327* +E328 gui.jax /*E328* +E329 gui.jax /*E329* +E33 message.jax /*E33* +E330 gui.jax /*E330* +E331 gui.jax /*E331* +E332 gui.jax /*E332* +E333 gui.jax /*E333* +E334 gui.jax /*E334* +E335 gui.jax /*E335* +E336 gui.jax /*E336* +E337 gui.jax /*E337* +E338 editing.jax /*E338* +E339 message.jax /*E339* +E34 various.jax /*E34* +E340 vi_diff.jax /*E340* +E341 message.jax /*E341* +E342 message.jax /*E342* +E343 options.jax /*E343* +E344 options.jax /*E344* +E345 options.jax /*E345* +E346 options.jax /*E346* +E347 options.jax /*E347* +E348 pattern.jax /*E348* +E349 pattern.jax /*E349* +E35 message.jax /*E35* +E350 fold.jax /*E350* +E351 fold.jax /*E351* +E352 fold.jax /*E352* +E353 change.jax /*E353* +E354 change.jax /*E354* +E355 options.jax /*E355* +E356 message.jax /*E356* +E357 options.jax /*E357* +E358 options.jax /*E358* +E359 term.jax /*E359* +E36 windows.jax /*E36* +E360 various.jax /*E360* +E363 options.jax /*E363* +E364 eval.jax /*E364* +E365 print.jax /*E365* +E367 autocmd.jax /*E367* +E368 eval.jax /*E368* +E369 pattern.jax /*E369* +E37 message.jax /*E37* +E370 various.jax /*E370* +E371 various.jax /*E371* +E372 quickfix.jax /*E372* +E373 quickfix.jax /*E373* +E374 quickfix.jax /*E374* +E375 quickfix.jax /*E375* +E376 quickfix.jax /*E376* +E377 quickfix.jax /*E377* +E378 quickfix.jax /*E378* +E379 quickfix.jax /*E379* +E38 message.jax /*E38* +E380 quickfix.jax /*E380* +E381 quickfix.jax /*E381* +E382 options.jax /*E382* +E383 pattern.jax /*E383* +E384 options.jax /*E384* +E385 options.jax /*E385* +E386 pattern.jax /*E386* +E387 tagsrch.jax /*E387* +E388 tagsrch.jax /*E388* +E389 tagsrch.jax /*E389* +E39 digraph.jax /*E39* +E390 syntax.jax /*E390* +E391 syntax.jax /*E391* +E392 syntax.jax /*E392* +E393 syntax.jax /*E393* +E394 syntax.jax /*E394* +E395 syntax.jax /*E395* +E397 syntax.jax /*E397* +E398 syntax.jax /*E398* +E399 syntax.jax /*E399* +E40 message.jax /*E40* +E400 syntax.jax /*E400* +E401 syntax.jax /*E401* +E402 syntax.jax /*E402* +E403 syntax.jax /*E403* +E404 syntax.jax /*E404* +E405 syntax.jax /*E405* +E406 syntax.jax /*E406* +E407 syntax.jax /*E407* +E408 syntax.jax /*E408* +E409 syntax.jax /*E409* +E41 message.jax /*E41* +E410 syntax.jax /*E410* +E411 syntax.jax /*E411* +E412 syntax.jax /*E412* +E413 syntax.jax /*E413* +E414 syntax.jax /*E414* +E415 syntax.jax /*E415* +E416 syntax.jax /*E416* +E417 syntax.jax /*E417* +E418 syntax.jax /*E418* +E419 syntax.jax /*E419* +E42 quickfix.jax /*E42* +E420 syntax.jax /*E420* +E421 syntax.jax /*E421* +E422 syntax.jax /*E422* +E423 syntax.jax /*E423* +E424 message.jax /*E424* +E425 tagsrch.jax /*E425* +E426 tagsrch.jax /*E426* +E427 tagsrch.jax /*E427* +E428 tagsrch.jax /*E428* +E429 tagsrch.jax /*E429* +E43 message.jax /*E43* +E430 tagsrch.jax /*E430* +E431 tagsrch.jax /*E431* +E432 message.jax /*E432* +E433 options.jax /*E433* +E434 tagsrch.jax /*E434* +E435 tagsrch.jax /*E435* +E436 term.jax /*E436* +E437 term.jax /*E437* +E438 message.jax /*E438* +E439 message.jax /*E439* +E44 message.jax /*E44* +E440 message.jax /*E440* +E441 windows.jax /*E441* +E442 windows.jax /*E442* +E443 windows.jax /*E443* +E444 windows.jax /*E444* +E445 windows.jax /*E445* +E446 editing.jax /*E446* +E447 editing.jax /*E447* +E448 various.jax /*E448* +E449 eval.jax /*E449* +E45 message.jax /*E45* +E455 print.jax /*E455* +E456 print.jax /*E456* +E457 print.jax /*E457* +E458 message.jax /*E458* +E459 message.jax /*E459* +E46 message.jax /*E46* +E460 message.jax /*E460* +E461 eval.jax /*E461* +E462 editing.jax /*E462* +E463 netbeans.jax /*E463* +E464 message.jax /*E464* +E465 gui.jax /*E465* +E466 gui.jax /*E466* +E467 map.jax /*E467* +E468 map.jax /*E468* +E469 if_cscop.jax /*E469* +E47 message.jax /*E47* +E470 change.jax /*E470* +E471 message.jax /*E471* +E472 editing.jax /*E472* +E473 message.jax /*E473* +E474 message.jax /*E474* +E475 message.jax /*E475* +E476 pattern.jax /*E476* +E477 message.jax /*E477* +E478 message.jax /*E478* +E479 editing.jax /*E479* +E48 eval.jax /*E48* +E480 editing.jax /*E480* +E481 message.jax /*E481* +E482 message.jax /*E482* +E483 message.jax /*E483* +E484 message.jax /*E484* +E485 message.jax /*E485* +E486 pattern.jax /*E486* +E487 options.jax /*E487* +E488 message.jax /*E488* +E49 message.jax /*E49* +E490 fold.jax /*E490* +E492 message.jax /*E492* +E493 cmdline.jax /*E493* +E494 editing.jax /*E494* +E495 cmdline.jax /*E495* +E496 cmdline.jax /*E496* +E497 cmdline.jax /*E497* +E498 cmdline.jax /*E498* +E499 cmdline.jax /*E499* +E50 syntax.jax /*E50* +E500 cmdline.jax /*E500* +E501 intro.jax /*E501* +E502 editing.jax /*E502* +E503 editing.jax /*E503* +E504 editing.jax /*E504* +E505 editing.jax /*E505* +E506 editing.jax /*E506* +E507 editing.jax /*E507* +E508 editing.jax /*E508* +E509 editing.jax /*E509* +E51 pattern.jax /*E51* +E510 editing.jax /*E510* +E511 netbeans.jax /*E511* +E512 editing.jax /*E512* +E513 options.jax /*E513* +E514 editing.jax /*E514* +E515 windows.jax /*E515* +E516 windows.jax /*E516* +E517 windows.jax /*E517* +E518 options.jax /*E518* +E519 options.jax /*E519* +E52 syntax.jax /*E52* +E520 options.jax /*E520* +E521 options.jax /*E521* +E522 options.jax /*E522* +E523 options.jax /*E523* +E524 options.jax /*E524* +E525 options.jax /*E525* +E526 options.jax /*E526* +E527 options.jax /*E527* +E528 options.jax /*E528* +E529 options.jax /*E529* +E53 pattern.jax /*E53* +E530 options.jax /*E530* +E531 options.jax /*E531* +E532 netbeans.jax /*E532* +E533 options.jax /*E533* +E534 options.jax /*E534* +E535 options.jax /*E535* +E536 options.jax /*E536* +E537 options.jax /*E537* +E538 options.jax /*E538* +E539 options.jax /*E539* +E54 pattern.jax /*E54* +E540 options.jax /*E540* +E541 options.jax /*E541* +E542 options.jax /*E542* +E543 options.jax /*E543* +E544 options.jax /*E544* +E545 options.jax /*E545* +E546 options.jax /*E546* +E547 options.jax /*E547* +E548 options.jax /*E548* +E549 options.jax /*E549* +E55 pattern.jax /*E55* +E550 options.jax /*E550* +E551 options.jax /*E551* +E552 options.jax /*E552* +E553 quickfix.jax /*E553* +E554 pattern.jax /*E554* +E555 tagsrch.jax /*E555* +E556 tagsrch.jax /*E556* +E557 term.jax /*E557* +E558 term.jax /*E558* +E559 term.jax /*E559* +E560 if_cscop.jax /*E560* +E561 if_cscop.jax /*E561* +E562 if_cscop.jax /*E562* +E563 if_cscop.jax /*E563* +E564 if_cscop.jax /*E564* +E566 if_cscop.jax /*E566* +E567 if_cscop.jax /*E567* +E568 if_cscop.jax /*E568* +E570 message.jax /*E570* +E571 if_tcl.jax /*E571* +E572 if_tcl.jax /*E572* +E573 remote.jax /*E573* +E574 starting.jax /*E574* +E575 starting.jax /*E575* +E576 starting.jax /*E576* +E577 starting.jax /*E577* +E579 eval.jax /*E579* +E580 eval.jax /*E580* +E581 eval.jax /*E581* +E582 eval.jax /*E582* +E583 eval.jax /*E583* +E584 eval.jax /*E584* +E585 eval.jax /*E585* +E586 eval.jax /*E586* +E587 eval.jax /*E587* +E588 eval.jax /*E588* +E589 options.jax /*E589* +E59 pattern.jax /*E59* +E590 options.jax /*E590* +E591 options.jax /*E591* +E592 options.jax /*E592* +E593 options.jax /*E593* +E594 options.jax /*E594* +E595 options.jax /*E595* +E596 options.jax /*E596* +E597 options.jax /*E597* +E598 options.jax /*E598* +E599 options.jax /*E599* +E60 pattern.jax /*E60* +E600 eval.jax /*E600* +E601 eval.jax /*E601* +E602 eval.jax /*E602* +E603 eval.jax /*E603* +E604 eval.jax /*E604* +E605 eval.jax /*E605* +E606 eval.jax /*E606* +E607 eval.jax /*E607* +E608 eval.jax /*E608* +E609 if_cscop.jax /*E609* +E61 pattern.jax /*E61* +E612 sign.jax /*E612* +E613 print.jax /*E613* +E614 editing.jax /*E614* +E615 editing.jax /*E615* +E616 editing.jax /*E616* +E617 options.jax /*E617* +E618 print.jax /*E618* +E619 print.jax /*E619* +E62 pattern.jax /*E62* +E620 print.jax /*E620* +E621 print.jax /*E621* +E622 if_cscop.jax /*E622* +E623 if_cscop.jax /*E623* +E624 print.jax /*E624* +E625 if_cscop.jax /*E625* +E626 if_cscop.jax /*E626* +E627 netbeans.jax /*E627* +E628 netbeans.jax /*E628* +E629 netbeans.jax /*E629* +E63 pattern.jax /*E63* +E630 channel.jax /*E630* +E631 channel.jax /*E631* +E632 netbeans.jax /*E632* +E633 netbeans.jax /*E633* +E634 netbeans.jax /*E634* +E635 netbeans.jax /*E635* +E636 netbeans.jax /*E636* +E637 netbeans.jax /*E637* +E638 netbeans.jax /*E638* +E639 netbeans.jax /*E639* +E64 pattern.jax /*E64* +E640 netbeans.jax /*E640* +E641 netbeans.jax /*E641* +E642 netbeans.jax /*E642* +E643 netbeans.jax /*E643* +E644 netbeans.jax /*E644* +E645 netbeans.jax /*E645* +E646 netbeans.jax /*E646* +E647 netbeans.jax /*E647* +E648 netbeans.jax /*E648* +E649 netbeans.jax /*E649* +E65 pattern.jax /*E65* +E650 netbeans.jax /*E650* +E651 netbeans.jax /*E651* +E652 netbeans.jax /*E652* +E655 eval.jax /*E655* +E656 netbeans.jax /*E656* +E657 netbeans.jax /*E657* +E658 netbeans.jax /*E658* +E659 if_pyth.jax /*E659* +E66 syntax.jax /*E66* +E660 netbeans.jax /*E660* +E661 helphelp.jax /*E661* +E662 motion.jax /*E662* +E663 motion.jax /*E663* +E664 motion.jax /*E664* +E665 gui_x11.jax /*E665* +E666 quickfix.jax /*E666* +E667 editing.jax /*E667* +E668 netbeans.jax /*E668* +E669 syntax.jax /*E669* +E67 syntax.jax /*E67* +E670 helphelp.jax /*E670* +E671 starting.jax /*E671* +E672 starting.jax /*E672* +E673 print.jax /*E673* +E674 print.jax /*E674* +E675 print.jax /*E675* +E676 options.jax /*E676* +E677 eval.jax /*E677* +E678 pattern.jax /*E678* +E679 syntax.jax /*E679* +E68 pattern.jax /*E68* +E680 autocmd.jax /*E680* +E681 quickfix.jax /*E681* +E682 quickfix.jax /*E682* +E683 quickfix.jax /*E683* +E684 eval.jax /*E684* +E685 message.jax /*E685* +E686 eval.jax /*E686* +E687 eval.jax /*E687* +E688 eval.jax /*E688* +E689 eval.jax /*E689* +E69 pattern.jax /*E69* +E690 eval.jax /*E690* +E691 eval.jax /*E691* +E692 eval.jax /*E692* +E694 eval.jax /*E694* +E695 eval.jax /*E695* +E696 eval.jax /*E696* +E697 eval.jax /*E697* +E698 eval.jax /*E698* +E699 eval.jax /*E699* +E70 pattern.jax /*E70* +E700 eval.jax /*E700* +E701 eval.jax /*E701* +E702 eval.jax /*E702* +E703 eval.jax /*E703* +E704 eval.jax /*E704* +E705 eval.jax /*E705* +E707 eval.jax /*E707* +E708 eval.jax /*E708* +E709 eval.jax /*E709* +E71 pattern.jax /*E71* +E710 eval.jax /*E710* +E711 eval.jax /*E711* +E712 eval.jax /*E712* +E713 eval.jax /*E713* +E714 eval.jax /*E714* +E715 eval.jax /*E715* +E716 eval.jax /*E716* +E717 eval.jax /*E717* +E718 eval.jax /*E718* +E719 eval.jax /*E719* +E72 message.jax /*E72* +E720 eval.jax /*E720* +E721 eval.jax /*E721* +E722 eval.jax /*E722* +E723 eval.jax /*E723* +E724 eval.jax /*E724* +E725 eval.jax /*E725* +E726 eval.jax /*E726* +E727 eval.jax /*E727* +E728 eval.jax /*E728* +E729 eval.jax /*E729* +E73 tagsrch.jax /*E73* +E730 eval.jax /*E730* +E731 eval.jax /*E731* +E732 eval.jax /*E732* +E733 eval.jax /*E733* +E734 eval.jax /*E734* +E735 eval.jax /*E735* +E736 eval.jax /*E736* +E737 eval.jax /*E737* +E738 eval.jax /*E738* +E739 eval.jax /*E739* +E74 message.jax /*E74* +E740 eval.jax /*E740* +E741 eval.jax /*E741* +E742 eval.jax /*E742* +E743 eval.jax /*E743* +E744 netbeans.jax /*E744* +E745 eval.jax /*E745* +E746 eval.jax /*E746* +E747 editing.jax /*E747* +E748 repeat.jax /*E748* +E749 various.jax /*E749* +E75 vi_diff.jax /*E75* +E750 repeat.jax /*E750* +E751 spell.jax /*E751* +E752 spell.jax /*E752* +E753 spell.jax /*E753* +E754 spell.jax /*E754* +E755 spell.jax /*E755* +E756 spell.jax /*E756* +E757 options.jax /*E757* +E758 spell.jax /*E758* +E759 spell.jax /*E759* +E76 pattern.jax /*E76* +E760 spell.jax /*E760* +E761 spell.jax /*E761* +E762 spell.jax /*E762* +E763 spell.jax /*E763* +E764 options.jax /*E764* +E765 options.jax /*E765* +E766 eval.jax /*E766* +E767 eval.jax /*E767* +E768 message.jax /*E768* +E769 pattern.jax /*E769* +E77 message.jax /*E77* +E770 spell.jax /*E770* +E771 spell.jax /*E771* +E772 spell.jax /*E772* +E773 recover.jax /*E773* +E774 map.jax /*E774* +E775 map.jax /*E775* +E776 quickfix.jax /*E776* +E777 quickfix.jax /*E777* +E778 spell.jax /*E778* +E779 spell.jax /*E779* +E78 motion.jax /*E78* +E780 spell.jax /*E780* +E781 spell.jax /*E781* +E782 spell.jax /*E782* +E783 spell.jax /*E783* +E784 tabpage.jax /*E784* +E785 eval.jax /*E785* +E786 eval.jax /*E786* +E787 diff.jax /*E787* +E788 autocmd.jax /*E788* +E789 syntax.jax /*E789* +E79 message.jax /*E79* +E790 undo.jax /*E790* +E791 mbyte.jax /*E791* +E792 gui.jax /*E792* +E793 diff.jax /*E793* +E794 eval.jax /*E794* +E795 eval.jax /*E795* +E796 editing.jax /*E796* +E797 spell.jax /*E797* +E798 eval.jax /*E798* +E799 eval.jax /*E799* +E80 message.jax /*E80* +E800 arabic.jax /*E800* +E801 eval.jax /*E801* +E802 eval.jax /*E802* +E803 eval.jax /*E803* +E804 eval.jax /*E804* +E805 eval.jax /*E805* +E806 eval.jax /*E806* +E807 eval.jax /*E807* +E808 eval.jax /*E808* +E809 cmdline.jax /*E809* +E81 map.jax /*E81* +E810 diff.jax /*E810* +E811 autocmd.jax /*E811* +E812 autocmd.jax /*E812* +E813 editing.jax /*E813* +E814 editing.jax /*E814* +E815 if_mzsch.jax /*E815* +E816 diff.jax /*E816* +E817 editing.jax /*E817* +E818 editing.jax /*E818* +E819 editing.jax /*E819* +E82 message.jax /*E82* +E820 editing.jax /*E820* +E821 options.jax /*E821* +E822 undo.jax /*E822* +E823 undo.jax /*E823* +E824 undo.jax /*E824* +E825 undo.jax /*E825* +E826 undo.jax /*E826* +E827 undo.jax /*E827* +E828 undo.jax /*E828* +E829 undo.jax /*E829* +E83 message.jax /*E83* +E830 undo.jax /*E830* +E831 editing.jax /*E831* +E832 undo.jax /*E832* +E833 editing.jax /*E833* +E834 options.jax /*E834* +E835 options.jax /*E835* +E836 if_pyth.jax /*E836* +E837 if_pyth.jax /*E837* +E838 netbeans.jax /*E838* +E839 insert.jax /*E839* +E84 windows.jax /*E84* +E840 insert.jax /*E840* +E841 map.jax /*E841* +E842 cmdline.jax /*E842* +E843 editing.jax /*E843* +E844 syntax.jax /*E844* +E845 spell.jax /*E845* +E846 options.jax /*E846* +E847 syntax.jax /*E847* +E848 syntax.jax /*E848* +E849 syntax.jax /*E849* +E85 options.jax /*E85* +E850 change.jax /*E850* +E851 gui_x11.jax /*E851* +E852 gui_x11.jax /*E852* +E853 eval.jax /*E853* +E854 options.jax /*E854* +E855 autocmd.jax /*E855* +E858 eval.jax /*E858* +E859 eval.jax /*E859* +E86 windows.jax /*E86* +E860 eval.jax /*E860* +E862 eval.jax /*E862* +E864 pattern.jax /*E864* +E865 pattern.jax /*E865* +E866 pattern.jax /*E866* +E867 pattern.jax /*E867* +E868 pattern.jax /*E868* +E869 pattern.jax /*E869* +E87 windows.jax /*E87* +E870 pattern.jax /*E870* +E871 pattern.jax /*E871* +E872 pattern.jax /*E872* +E873 pattern.jax /*E873* +E874 pattern.jax /*E874* +E875 pattern.jax /*E875* +E876 pattern.jax /*E876* +E877 pattern.jax /*E877* +E878 pattern.jax /*E878* +E879 syntax.jax /*E879* +E88 windows.jax /*E88* +E880 if_pyth.jax /*E880* +E881 autocmd.jax /*E881* +E882 eval.jax /*E882* +E883 eval.jax /*E883* +E884 eval.jax /*E884* +E885 sign.jax /*E885* +E886 starting.jax /*E886* +E887 if_pyth.jax /*E887* +E888 pattern.jax /*E888* +E89 message.jax /*E89* +E890 syntax.jax /*E890* +E891 eval.jax /*E891* +E892 eval.jax /*E892* +E893 eval.jax /*E893* +E894 eval.jax /*E894* +E895 if_mzsch.jax /*E895* +E898 channel.jax /*E898* +E90 message.jax /*E90* +E901 channel.jax /*E901* +E902 channel.jax /*E902* +E903 channel.jax /*E903* +E904 channel.jax /*E904* +E905 channel.jax /*E905* +E906 channel.jax /*E906* +E907 eval.jax /*E907* +E908 eval.jax /*E908* +E909 eval.jax /*E909* +E91 options.jax /*E91* +E910 eval.jax /*E910* +E911 eval.jax /*E911* +E913 eval.jax /*E913* +E914 eval.jax /*E914* +E915 channel.jax /*E915* +E916 eval.jax /*E916* +E917 eval.jax /*E917* +E918 channel.jax /*E918* +E919 repeat.jax /*E919* +E92 message.jax /*E92* +E920 channel.jax /*E920* +E921 channel.jax /*E921* +E922 eval.jax /*E922* +E923 eval.jax /*E923* +E924 quickfix.jax /*E924* +E925 quickfix.jax /*E925* +E926 quickfix.jax /*E926* +E927 eval.jax /*E927* +E929 starting.jax /*E929* +E93 windows.jax /*E93* +E930 eval.jax /*E930* +E931 message.jax /*E931* +E932 eval.jax /*E932* +E933 eval.jax /*E933* +E934 sign.jax /*E934* +E935 eval.jax /*E935* +E936 autocmd.jax /*E936* +E937 autocmd.jax /*E937* +E938 eval.jax /*E938* +E939 change.jax /*E939* +E94 windows.jax /*E94* +E940 eval.jax /*E940* +E95 message.jax /*E95* +E96 diff.jax /*E96* +E97 diff.jax /*E97* +E98 diff.jax /*E98* +E99 diff.jax /*E99* +EX intro.jax /*EX* +EXINIT starting.jax /*EXINIT* +Elvis intro.jax /*Elvis* +EncodingChanged autocmd.jax /*EncodingChanged* +Eterm syntax.jax /*Eterm* +Ex intro.jax /*Ex* +Ex-mode intro.jax /*Ex-mode* +Exuberant_ctags tagsrch.jax /*Exuberant_ctags* +F motion.jax /*F* +FALSE eval.jax /*FALSE* +FAQ intro.jax /*FAQ* +Farsi farsi.jax /*Farsi* +FileAppendCmd autocmd.jax /*FileAppendCmd* +FileAppendPost autocmd.jax /*FileAppendPost* +FileAppendPre autocmd.jax /*FileAppendPre* +FileChangedRO autocmd.jax /*FileChangedRO* +FileChangedShell autocmd.jax /*FileChangedShell* +FileChangedShellPost autocmd.jax /*FileChangedShellPost* +FileEncoding autocmd.jax /*FileEncoding* +FileReadCmd autocmd.jax /*FileReadCmd* +FileReadPost autocmd.jax /*FileReadPost* +FileReadPre autocmd.jax /*FileReadPre* +FileType autocmd.jax /*FileType* +FileWriteCmd autocmd.jax /*FileWriteCmd* +FileWritePost autocmd.jax /*FileWritePost* +FileWritePre autocmd.jax /*FileWritePre* +FilterReadPost autocmd.jax /*FilterReadPost* +FilterReadPre autocmd.jax /*FilterReadPre* +FilterWritePost autocmd.jax /*FilterWritePost* +FilterWritePre autocmd.jax /*FilterWritePre* +Float eval.jax /*Float* +FocusGained autocmd.jax /*FocusGained* +FocusLost autocmd.jax /*FocusLost* +Folding fold.jax /*Folding* +FuncUndefined autocmd.jax /*FuncUndefined* +Funcref eval.jax /*Funcref* +G motion.jax /*G* +GNOME gui_x11.jax /*GNOME* +GTK gui_x11.jax /*GTK* +GTK+ gui_x11.jax /*GTK+* +GTK3 gui_x11.jax /*GTK3* +GUI gui.jax /*GUI* +GUI-X11 gui_x11.jax /*GUI-X11* +GUIEnter autocmd.jax /*GUIEnter* +GUIFailed autocmd.jax /*GUIFailed* +GetLatestVimScripts pi_getscript.jax /*GetLatestVimScripts* +GetLatestVimScripts-copyright pi_getscript.jax /*GetLatestVimScripts-copyright* +GetLatestVimScripts_dat pi_getscript.jax /*GetLatestVimScripts_dat* +Gnome gui_x11.jax /*Gnome* +H motion.jax /*H* +I insert.jax /*I* +ICCF uganda.jax /*ICCF* +IM-server mbyte.jax /*IM-server* +IME mbyte.jax /*IME* +Insert insert.jax /*Insert* +Insert-mode insert.jax /*Insert-mode* +InsertChange autocmd.jax /*InsertChange* +InsertCharPre autocmd.jax /*InsertCharPre* +InsertEnter autocmd.jax /*InsertEnter* +InsertLeave autocmd.jax /*InsertLeave* +J change.jax /*J* +Japanese mbyte.jax /*Japanese* +Job eval.jax /*Job* +Jobs eval.jax /*Jobs* +K various.jax /*K* +KDE gui_x11.jax /*KDE* +KVim gui_x11.jax /*KVim* +Kibaale uganda.jax /*Kibaale* +Korean mbyte.jax /*Korean* +L motion.jax /*L* +Linux-backspace options.jax /*Linux-backspace* +List eval.jax /*List* +Lists eval.jax /*Lists* +LogiPat() pi_logipat.jax /*LogiPat()* +LogiPat-flags pi_logipat.jax /*LogiPat-flags* +Lua if_lua.jax /*Lua* +M motion.jax /*M* +MDI starting.jax /*MDI* +MS-DOS os_msdos.jax /*MS-DOS* +MS-Windows os_win32.jax /*MS-Windows* +MSDOS os_msdos.jax /*MSDOS* +MSVisualStudio if_ole.jax /*MSVisualStudio* +MVS os_390.jax /*MVS* +Mac os_mac.jax /*Mac* +Mac-format editing.jax /*Mac-format* +Mac-format-write editing.jax /*Mac-format-write* +Macintosh os_mac.jax /*Macintosh* +Mark motion.jax /*Mark* +MenuPopup autocmd.jax /*MenuPopup* +MiNT os_mint.jax /*MiNT* +Moolenaar intro.jax /*Moolenaar* +MorphOS os_amiga.jax /*MorphOS* +Motif gui_x11.jax /*Motif* +Myspell spell.jax /*Myspell* +MzScheme if_mzsch.jax /*MzScheme* +N pattern.jax /*N* +N% motion.jax /*N%* +N: cmdline.jax /*N:* +N<Del> various.jax /*N<Del>* +NFA pattern.jax /*NFA* +NL-used-for-Nul pattern.jax /*NL-used-for-Nul* +NetBSD-backspace options.jax /*NetBSD-backspace* +NetUserPass() pi_netrw.jax /*NetUserPass()* +Normal intro.jax /*Normal* +Normal-mode intro.jax /*Normal-mode* +Number eval.jax /*Number* +Nvi intro.jax /*Nvi* +O insert.jax /*O* +OS/2 os_os2.jax /*OS\/2* +OS2 os_os2.jax /*OS2* +OS390 os_390.jax /*OS390* +OS390-Motif os_390.jax /*OS390-Motif* +OS390-PuTTY os_390.jax /*OS390-PuTTY* +OS390-bugs os_390.jax /*OS390-bugs* +OS390-has-ebcdic os_390.jax /*OS390-has-ebcdic* +OS390-limitations os_390.jax /*OS390-limitations* +OS390-open-source os_390.jax /*OS390-open-source* +OffTheSpot mbyte.jax /*OffTheSpot* +OnTheSpot mbyte.jax /*OnTheSpot* +Operator-pending intro.jax /*Operator-pending* +Operator-pending-mode intro.jax /*Operator-pending-mode* +OptionSet autocmd.jax /*OptionSet* +OverTheSpot mbyte.jax /*OverTheSpot* +P change.jax /*P* +PATHEXT eval.jax /*PATHEXT* +PEP8 filetype.jax /*PEP8* +PHP_BracesAtCodeLevel indent.jax /*PHP_BracesAtCodeLevel* +PHP_autoformatcomment indent.jax /*PHP_autoformatcomment* +PHP_default_indenting indent.jax /*PHP_default_indenting* +PHP_outdentSLComments indent.jax /*PHP_outdentSLComments* +PHP_outdentphpescape indent.jax /*PHP_outdentphpescape* +PHP_removeCRwhenUnix indent.jax /*PHP_removeCRwhenUnix* +PHP_vintage_case_default_indent indent.jax /*PHP_vintage_case_default_indent* +Partial eval.jax /*Partial* +Pattern pattern.jax /*Pattern* +Perl if_perl.jax /*Perl* +Posix intro.jax /*Posix* +Python if_pyth.jax /*Python* +Q intro.jax /*Q* +QNX os_qnx.jax /*QNX* +Q_ab quickref.jax /*Q_ab* +Q_ac quickref.jax /*Q_ac* +Q_ai quickref.jax /*Q_ai* +Q_bu quickref.jax /*Q_bu* +Q_ce quickref.jax /*Q_ce* +Q_ch quickref.jax /*Q_ch* +Q_cm quickref.jax /*Q_cm* +Q_co quickref.jax /*Q_co* +Q_ct help.jax /*Q_ct* +Q_de quickref.jax /*Q_de* +Q_di quickref.jax /*Q_di* +Q_ed quickref.jax /*Q_ed* +Q_et quickref.jax /*Q_et* +Q_ex quickref.jax /*Q_ex* +Q_fl quickref.jax /*Q_fl* +Q_fo quickref.jax /*Q_fo* +Q_gu quickref.jax /*Q_gu* +Q_in quickref.jax /*Q_in* +Q_km quickref.jax /*Q_km* +Q_lr quickref.jax /*Q_lr* +Q_ma quickref.jax /*Q_ma* +Q_op quickref.jax /*Q_op* +Q_pa quickref.jax /*Q_pa* +Q_qf quickref.jax /*Q_qf* +Q_ra quickref.jax /*Q_ra* +Q_re quickref.jax /*Q_re* +Q_sc quickref.jax /*Q_sc* +Q_si quickref.jax /*Q_si* +Q_ss quickref.jax /*Q_ss* +Q_st quickref.jax /*Q_st* +Q_sy quickref.jax /*Q_sy* +Q_ta quickref.jax /*Q_ta* +Q_tm quickref.jax /*Q_tm* +Q_to quickref.jax /*Q_to* +Q_ud quickref.jax /*Q_ud* +Q_ur quickref.jax /*Q_ur* +Q_vc quickref.jax /*Q_vc* +Q_vi quickref.jax /*Q_vi* +Q_vm quickref.jax /*Q_vm* +Q_wi quickref.jax /*Q_wi* +Q_wq quickref.jax /*Q_wq* +QuickFixCmdPost autocmd.jax /*QuickFixCmdPost* +QuickFixCmdPost-example quickfix.jax /*QuickFixCmdPost-example* +QuickFixCmdPre autocmd.jax /*QuickFixCmdPre* +Quickfix quickfix.jax /*Quickfix* +QuitPre autocmd.jax /*QuitPre* +R change.jax /*R* +RISC-OS os_risc.jax /*RISC-OS* +RISCOS os_risc.jax /*RISCOS* +RemoteReply autocmd.jax /*RemoteReply* +Replace insert.jax /*Replace* +Replace-mode insert.jax /*Replace-mode* +Root mbyte.jax /*Root* +Ruby if_ruby.jax /*Ruby* +Russian russian.jax /*Russian* +S change.jax /*S* +SHELL starting.jax /*SHELL* +SQLGetType ft_sql.jax /*SQLGetType* +SQLSetType ft_sql.jax /*SQLSetType* +Select visual.jax /*Select* +Select-mode visual.jax /*Select-mode* +Select-mode-mapping visual.jax /*Select-mode-mapping* +Session starting.jax /*Session* +SessionLoad-variable starting.jax /*SessionLoad-variable* +SessionLoadPost autocmd.jax /*SessionLoadPost* +ShellCmdPost autocmd.jax /*ShellCmdPost* +ShellFilterPost autocmd.jax /*ShellFilterPost* +SourceCmd autocmd.jax /*SourceCmd* +SourcePre autocmd.jax /*SourcePre* +Special eval.jax /*Special* +SpellFileMissing autocmd.jax /*SpellFileMissing* +StdinReadPost autocmd.jax /*StdinReadPost* +StdinReadPre autocmd.jax /*StdinReadPre* +String eval.jax /*String* +SwapExists autocmd.jax /*SwapExists* +Syntax autocmd.jax /*Syntax* +T motion.jax /*T* +TCL if_tcl.jax /*TCL* +TERM starting.jax /*TERM* +TOhtml-encoding syntax.jax /*TOhtml-encoding* +TOhtml-encoding-detect syntax.jax /*TOhtml-encoding-detect* +TOhtml-performance syntax.jax /*TOhtml-performance* +TOhtml-uncopyable-text syntax.jax /*TOhtml-uncopyable-text* +TOhtml-wrap-text syntax.jax /*TOhtml-wrap-text* +TRUE eval.jax /*TRUE* +TSQL ft_sql.jax /*TSQL* +TTpro-telnet syntax.jax /*TTpro-telnet* +Tab intro.jax /*Tab* +TabClosed autocmd.jax /*TabClosed* +TabEnter autocmd.jax /*TabEnter* +TabLeave autocmd.jax /*TabLeave* +TabNew autocmd.jax /*TabNew* +Tcl if_tcl.jax /*Tcl* +TermChanged autocmd.jax /*TermChanged* +TermResponse autocmd.jax /*TermResponse* +TextChanged autocmd.jax /*TextChanged* +TextChangedI autocmd.jax /*TextChangedI* +Transact-SQL ft_sql.jax /*Transact-SQL* +U undo.jax /*U* +UTF-8 mbyte.jax /*UTF-8* +UTF8-xterm mbyte.jax /*UTF8-xterm* +Uganda uganda.jax /*Uganda* +Unicode mbyte.jax /*Unicode* +Unix os_unix.jax /*Unix* +Unix-format editing.jax /*Unix-format* +Unix-format-write editing.jax /*Unix-format-write* +User autocmd.jax /*User* +UserGettingBored autocmd.jax /*UserGettingBored* +V visual.jax /*V* +VIMINIT starting.jax /*VIMINIT* +VMS os_vms.jax /*VMS* +Vi intro.jax /*Vi* +View starting.jax /*View* +VimEnter autocmd.jax /*VimEnter* +VimLeave autocmd.jax /*VimLeave* +VimLeavePre autocmd.jax /*VimLeavePre* +VimResized autocmd.jax /*VimResized* +Vimball-copyright pi_vimball.jax /*Vimball-copyright* +Virtual-Replace-mode insert.jax /*Virtual-Replace-mode* +VisVim if_ole.jax /*VisVim* +Visual visual.jax /*Visual* +Visual-mode visual.jax /*Visual-mode* +W motion.jax /*W* +W10 message.jax /*W10* +W11 message.jax /*W11* +W12 message.jax /*W12* +W13 message.jax /*W13* +W14 message.jax /*W14* +W15 repeat.jax /*W15* +W16 message.jax /*W16* +W17 arabic.jax /*W17* +W18 syntax.jax /*W18* +W19 autocmd.jax /*W19* +W20 if_pyth.jax /*W20* +W21 if_pyth.jax /*W21* +WORD motion.jax /*WORD* +WWW intro.jax /*WWW* +Win32 os_win32.jax /*Win32* +WinEnter autocmd.jax /*WinEnter* +WinLeave autocmd.jax /*WinLeave* +WinNew autocmd.jax /*WinNew* +X change.jax /*X* +X11 options.jax /*X11* +X11-icon gui_x11.jax /*X11-icon* +X11_mouse_shapes gui_x11.jax /*X11_mouse_shapes* +X1Drag term.jax /*X1Drag* +X1Mouse term.jax /*X1Mouse* +X1Release term.jax /*X1Release* +X2Drag term.jax /*X2Drag* +X2Mouse term.jax /*X2Mouse* +X2Release term.jax /*X2Release* +XIM mbyte.jax /*XIM* +XLFD mbyte.jax /*XLFD* +Y change.jax /*Y* +Y2K intro.jax /*Y2K* +ZQ editing.jax /*ZQ* +ZZ editing.jax /*ZZ* +[ index.jax /*[* +[# motion.jax /*[#* +[' motion.jax /*['* +[( motion.jax /*[(* +[++opt] editing.jax /*[++opt]* +[+cmd] editing.jax /*[+cmd]* +[..] pattern.jax /*[..]* +[/ motion.jax /*[\/* +[:alnum:] pattern.jax /*[:alnum:]* +[:alpha:] pattern.jax /*[:alpha:]* +[:backspace:] pattern.jax /*[:backspace:]* +[:blank:] pattern.jax /*[:blank:]* +[:cntrl:] pattern.jax /*[:cntrl:]* +[:digit:] pattern.jax /*[:digit:]* +[:escape:] pattern.jax /*[:escape:]* +[:graph:] pattern.jax /*[:graph:]* +[:lower:] pattern.jax /*[:lower:]* +[:print:] pattern.jax /*[:print:]* +[:punct:] pattern.jax /*[:punct:]* +[:return:] pattern.jax /*[:return:]* +[:space:] pattern.jax /*[:space:]* +[:tab:] pattern.jax /*[:tab:]* +[:upper:] pattern.jax /*[:upper:]* +[:xdigit:] pattern.jax /*[:xdigit:]* +[<MiddleMouse> change.jax /*[<MiddleMouse>* +[==] pattern.jax /*[==]* +[D tagsrch.jax /*[D* +[I tagsrch.jax /*[I* +[M motion.jax /*[M* +[P change.jax /*[P* +[S spell.jax /*[S* +[[ motion.jax /*[[* +[] motion.jax /*[]* +[_CTRL-D tagsrch.jax /*[_CTRL-D* +[_CTRL-I tagsrch.jax /*[_CTRL-I* +[` motion.jax /*[`* +[c diff.jax /*[c* +[count] intro.jax /*[count]* +[d tagsrch.jax /*[d* +[f editing.jax /*[f* +[i tagsrch.jax /*[i* +[m motion.jax /*[m* +[p change.jax /*[p* +[pattern] pattern.jax /*[pattern]* +[quotex] intro.jax /*[quotex]* +[range] cmdline.jax /*[range]* +[s spell.jax /*[s* +[star motion.jax /*[star* +[z fold.jax /*[z* +[{ motion.jax /*[{* +\0 change.jax /*\\0* +] index.jax /*]* +]# motion.jax /*]#* +]' motion.jax /*]'* +]) motion.jax /*])* +]/ motion.jax /*]\/* +]<MiddleMouse> change.jax /*]<MiddleMouse>* +]D tagsrch.jax /*]D* +]I tagsrch.jax /*]I* +]M motion.jax /*]M* +]P change.jax /*]P* +]S spell.jax /*]S* +][ motion.jax /*][* +]] motion.jax /*]]* +]_CTRL-D tagsrch.jax /*]_CTRL-D* +]_CTRL-I tagsrch.jax /*]_CTRL-I* +]` motion.jax /*]`* +]c diff.jax /*]c* +]d tagsrch.jax /*]d* +]f editing.jax /*]f* +]i tagsrch.jax /*]i* +]m motion.jax /*]m* +]p change.jax /*]p* +]s spell.jax /*]s* +]star motion.jax /*]star* +]z fold.jax /*]z* +]} motion.jax /*]}* +^ motion.jax /*^* +_ motion.jax /*_* +_exrc starting.jax /*_exrc* +_gvimrc gui.jax /*_gvimrc* +_vimrc starting.jax /*_vimrc* +` motion.jax /*`* +`( motion.jax /*`(* +`) motion.jax /*`)* +`-expansion editing.jax /*`-expansion* +`. motion.jax /*`.* +`0 motion.jax /*`0* +`< motion.jax /*`<* +`= editing.jax /*`=* +`> motion.jax /*`>* +`A motion.jax /*`A* +`[ motion.jax /*`[* +`] motion.jax /*`]* +`^ motion.jax /*`^* +`` motion.jax /*``* +`a motion.jax /*`a* +`quote motion.jax /*`quote* +`{ motion.jax /*`{* +`} motion.jax /*`}* +a insert.jax /*a* +a' motion.jax /*a'* +a( motion.jax /*a(* +a) motion.jax /*a)* +a4 print.jax /*a4* +a:0 eval.jax /*a:0* +a:000 eval.jax /*a:000* +a:1 eval.jax /*a:1* +a:firstline eval.jax /*a:firstline* +a:lastline eval.jax /*a:lastline* +a:var eval.jax /*a:var* +a< motion.jax /*a<* +a> motion.jax /*a>* +aB motion.jax /*aB* +aW motion.jax /*aW* +a[ motion.jax /*a[* +a] motion.jax /*a]* +a` motion.jax /*a`* +ab motion.jax /*ab* +abandon editing.jax /*abandon* +abbreviations map.jax /*abbreviations* +abel.vim syntax.jax /*abel.vim* +abs() eval.jax /*abs()* +acos() eval.jax /*acos()* +active-buffer windows.jax /*active-buffer* +ada#Create_Tags() ft_ada.jax /*ada#Create_Tags()* +ada#Jump_Tag() ft_ada.jax /*ada#Jump_Tag()* +ada#Listtags() ft_ada.jax /*ada#Listtags()* +ada#Switch_Syntax_Option() ft_ada.jax /*ada#Switch_Syntax_Option()* +ada#Word() ft_ada.jax /*ada#Word()* +ada-compiler ft_ada.jax /*ada-compiler* +ada-ctags ft_ada.jax /*ada-ctags* +ada-extra-plugins ft_ada.jax /*ada-extra-plugins* +ada-reference ft_ada.jax /*ada-reference* +ada.vim ft_ada.jax /*ada.vim* +add() eval.jax /*add()* +add-filetype-plugin usr_05.jax /*add-filetype-plugin* +add-global-plugin usr_05.jax /*add-global-plugin* +add-local-help usr_05.jax /*add-local-help* +add-option-flags options.jax /*add-option-flags* +add-package usr_05.jax /*add-package* +add-plugin usr_05.jax /*add-plugin* +aff-dic-format spell.jax /*aff-dic-format* +after-directory options.jax /*after-directory* +aleph options.jax /*aleph* +alt intro.jax /*alt* +alt-input debugger.jax /*alt-input* +alternate-file editing.jax /*alternate-file* +amiga-window starting.jax /*amiga-window* +and() eval.jax /*and()* +anonymous-function eval.jax /*anonymous-function* +ant.vim syntax.jax /*ant.vim* +ap motion.jax /*ap* +apache.vim syntax.jax /*apache.vim* +append() eval.jax /*append()* +aquote motion.jax /*aquote* +arabic.txt arabic.jax /*arabic.txt* +arabicfonts arabic.jax /*arabicfonts* +arabickeymap arabic.jax /*arabickeymap* +arg-functions usr_41.jax /*arg-functions* +argc() eval.jax /*argc()* +argidx() eval.jax /*argidx()* +arglist editing.jax /*arglist* +arglist-position editing.jax /*arglist-position* +arglist-quit usr_07.jax /*arglist-quit* +arglistid() eval.jax /*arglistid()* +argument-list editing.jax /*argument-list* +argv() eval.jax /*argv()* +as motion.jax /*as* +asin() eval.jax /*asin()* +asm.vim syntax.jax /*asm.vim* +asm68k syntax.jax /*asm68k* +asmh8300.vim syntax.jax /*asmh8300.vim* +assert_equal() eval.jax /*assert_equal()* +assert_exception() eval.jax /*assert_exception()* +assert_fails() eval.jax /*assert_fails()* +assert_false() eval.jax /*assert_false()* +assert_inrange() eval.jax /*assert_inrange()* +assert_match() eval.jax /*assert_match()* +assert_notequal() eval.jax /*assert_notequal()* +assert_notmatch() eval.jax /*assert_notmatch()* +assert_true() eval.jax /*assert_true()* +at motion.jax /*at* +atan() eval.jax /*atan()* +atan2() eval.jax /*atan2()* +athena-intellimouse gui.jax /*athena-intellimouse* +attr-list syntax.jax /*attr-list* +author intro.jax /*author* +auto-format change.jax /*auto-format* +auto-setting options.jax /*auto-setting* +auto-shortname editing.jax /*auto-shortname* +autocmd-<> tips.jax /*autocmd-<>* +autocmd-buffer-local autocmd.jax /*autocmd-buffer-local* +autocmd-buflocal autocmd.jax /*autocmd-buflocal* +autocmd-changes autocmd.jax /*autocmd-changes* +autocmd-define autocmd.jax /*autocmd-define* +autocmd-disable autocmd.jax /*autocmd-disable* +autocmd-events autocmd.jax /*autocmd-events* +autocmd-events-abc autocmd.jax /*autocmd-events-abc* +autocmd-execute autocmd.jax /*autocmd-execute* +autocmd-groups autocmd.jax /*autocmd-groups* +autocmd-intro autocmd.jax /*autocmd-intro* +autocmd-list autocmd.jax /*autocmd-list* +autocmd-nested autocmd.jax /*autocmd-nested* +autocmd-osfiletypes filetype.jax /*autocmd-osfiletypes* +autocmd-patterns autocmd.jax /*autocmd-patterns* +autocmd-remove autocmd.jax /*autocmd-remove* +autocmd-searchpat autocmd.jax /*autocmd-searchpat* +autocmd-use autocmd.jax /*autocmd-use* +autocmd.txt autocmd.jax /*autocmd.txt* +autocommand autocmd.jax /*autocommand* +autocommand-events autocmd.jax /*autocommand-events* +autocommand-pattern autocmd.jax /*autocommand-pattern* +autoformat change.jax /*autoformat* +autoload eval.jax /*autoload* +autoload-functions eval.jax /*autoload-functions* +aw motion.jax /*aw* +a{ motion.jax /*a{* +a} motion.jax /*a}* +b motion.jax /*b* +b: eval.jax /*b:* +b:changedtick eval.jax /*b:changedtick* +b:changelog_name filetype.jax /*b:changelog_name* +b:clojure_syntax_keywords syntax.jax /*b:clojure_syntax_keywords* +b:clojure_syntax_without_core_keywords syntax.jax /*b:clojure_syntax_without_core_keywords* +b:current_syntax-variable syntax.jax /*b:current_syntax-variable* +b:netrw_lastfile pi_netrw.jax /*b:netrw_lastfile* +b:tex_stylish syntax.jax /*b:tex_stylish* +b:var eval.jax /*b:var* +b:yaml_schema syntax.jax /*b:yaml_schema* +baan-folding syntax.jax /*baan-folding* +baan-syntax syntax.jax /*baan-syntax* +baan.vim syntax.jax /*baan.vim* +backslash intro.jax /*backslash* +backspace intro.jax /*backspace* +backspace-delete version4.jax /*backspace-delete* +backtick-expansion editing.jax /*backtick-expansion* +backup editing.jax /*backup* +backup-changed version4.jax /*backup-changed* +backup-extension version4.jax /*backup-extension* +backup-table editing.jax /*backup-table* +balloon-eval debugger.jax /*balloon-eval* +balloon_show() eval.jax /*balloon_show()* +bar motion.jax /*bar* +bars help.jax /*bars* +base_font_name_list mbyte.jax /*base_font_name_list* +basic.vim syntax.jax /*basic.vim* +beep options.jax /*beep* +beos-colors os_beos.jax /*beos-colors* +beos-compiling os_beos.jax /*beos-compiling* +beos-dragndrop os_beos.jax /*beos-dragndrop* +beos-fonts os_beos.jax /*beos-fonts* +beos-general os_beos.jax /*beos-general* +beos-gui os_beos.jax /*beos-gui* +beos-launch os_beos.jax /*beos-launch* +beos-meta os_beos.jax /*beos-meta* +beos-mouse os_beos.jax /*beos-mouse* +beos-perl os_beos.jax /*beos-perl* +beos-timeout os_beos.jax /*beos-timeout* +beos-unicode os_beos.jax /*beos-unicode* +beos-utf8 os_beos.jax /*beos-utf8* +beos-vimdir os_beos.jax /*beos-vimdir* +beval_bufnr-variable eval.jax /*beval_bufnr-variable* +beval_col-variable eval.jax /*beval_col-variable* +beval_lnum-variable eval.jax /*beval_lnum-variable* +beval_text-variable eval.jax /*beval_text-variable* +beval_winid-variable eval.jax /*beval_winid-variable* +beval_winnr-variable eval.jax /*beval_winnr-variable* +binary-number eval.jax /*binary-number* +bitwise-function usr_41.jax /*bitwise-function* +blockwise-examples visual.jax /*blockwise-examples* +blockwise-operators visual.jax /*blockwise-operators* +blockwise-register change.jax /*blockwise-register* +blockwise-visual visual.jax /*blockwise-visual* +blowfish options.jax /*blowfish* +blowfish2 options.jax /*blowfish2* +bold syntax.jax /*bold* +bom-bytes mbyte.jax /*bom-bytes* +book intro.jax /*book* +bookmark usr_03.jax /*bookmark* +boolean options.jax /*boolean* +break-finally eval.jax /*break-finally* +browse() eval.jax /*browse()* +browsedir() eval.jax /*browsedir()* +browsefilter editing.jax /*browsefilter* +bufexists() eval.jax /*bufexists()* +buffer-functions usr_41.jax /*buffer-functions* +buffer-hidden windows.jax /*buffer-hidden* +buffer-list windows.jax /*buffer-list* +buffer-variable eval.jax /*buffer-variable* +buffer-write editing.jax /*buffer-write* +buffer_exists() eval.jax /*buffer_exists()* +buffer_name() eval.jax /*buffer_name()* +buffer_number() eval.jax /*buffer_number()* +buffers windows.jax /*buffers* +buffers-menu gui.jax /*buffers-menu* +buflisted() eval.jax /*buflisted()* +bufloaded() eval.jax /*bufloaded()* +bufname() eval.jax /*bufname()* +bufnr() eval.jax /*bufnr()* +bufwinid() eval.jax /*bufwinid()* +bufwinnr() eval.jax /*bufwinnr()* +bug-fixes-8 version8.jax /*bug-fixes-8* +bug-reports intro.jax /*bug-reports* +bugreport.vim intro.jax /*bugreport.vim* +bugs intro.jax /*bugs* +builtin-terms term.jax /*builtin-terms* +builtin-tools gui.jax /*builtin-tools* +builtin_terms term.jax /*builtin_terms* +byte-count editing.jax /*byte-count* +byte2line() eval.jax /*byte2line()* +byteidx() eval.jax /*byteidx()* +byteidxcomp() eval.jax /*byteidxcomp()* +bzip2 pi_gzip.jax /*bzip2* +c change.jax /*c* +c.vim syntax.jax /*c.vim* +cW change.jax /*cW* +c_# cmdline.jax /*c_#* +c_## cmdline.jax /*c_##* +c_#< cmdline.jax /*c_#<* +c_#n cmdline.jax /*c_#n* +c_% cmdline.jax /*c_%* +c_<BS> cmdline.jax /*c_<BS>* +c_<C-Left> cmdline.jax /*c_<C-Left>* +c_<C-R> cmdline.jax /*c_<C-R>* +c_<C-R>_<C-A> cmdline.jax /*c_<C-R>_<C-A>* +c_<C-R>_<C-F> cmdline.jax /*c_<C-R>_<C-F>* +c_<C-R>_<C-O> cmdline.jax /*c_<C-R>_<C-O>* +c_<C-R>_<C-P> cmdline.jax /*c_<C-R>_<C-P>* +c_<C-R>_<C-R> cmdline.jax /*c_<C-R>_<C-R>* +c_<C-R>_<C-W> cmdline.jax /*c_<C-R>_<C-W>* +c_<C-Right> cmdline.jax /*c_<C-Right>* +c_<CR> cmdline.jax /*c_<CR>* +c_<Del> cmdline.jax /*c_<Del>* +c_<Down> cmdline.jax /*c_<Down>* +c_<End> cmdline.jax /*c_<End>* +c_<Esc> cmdline.jax /*c_<Esc>* +c_<Home> cmdline.jax /*c_<Home>* +c_<Insert> cmdline.jax /*c_<Insert>* +c_<Left> cmdline.jax /*c_<Left>* +c_<LeftMouse> cmdline.jax /*c_<LeftMouse>* +c_<MiddleMouse> cmdline.jax /*c_<MiddleMouse>* +c_<NL> cmdline.jax /*c_<NL>* +c_<PageDown> cmdline.jax /*c_<PageDown>* +c_<PageUp> cmdline.jax /*c_<PageUp>* +c_<Right> cmdline.jax /*c_<Right>* +c_<S-Down> cmdline.jax /*c_<S-Down>* +c_<S-Left> cmdline.jax /*c_<S-Left>* +c_<S-Right> cmdline.jax /*c_<S-Right>* +c_<S-Tab> cmdline.jax /*c_<S-Tab>* +c_<S-Up> cmdline.jax /*c_<S-Up>* +c_<Tab> cmdline.jax /*c_<Tab>* +c_<Up> cmdline.jax /*c_<Up>* +c_BS cmdline.jax /*c_BS* +c_CR cmdline.jax /*c_CR* +c_CTRL-A cmdline.jax /*c_CTRL-A* +c_CTRL-B cmdline.jax /*c_CTRL-B* +c_CTRL-C cmdline.jax /*c_CTRL-C* +c_CTRL-D cmdline.jax /*c_CTRL-D* +c_CTRL-E cmdline.jax /*c_CTRL-E* +c_CTRL-F cmdline.jax /*c_CTRL-F* +c_CTRL-G cmdline.jax /*c_CTRL-G* +c_CTRL-H cmdline.jax /*c_CTRL-H* +c_CTRL-I cmdline.jax /*c_CTRL-I* +c_CTRL-J cmdline.jax /*c_CTRL-J* +c_CTRL-K cmdline.jax /*c_CTRL-K* +c_CTRL-L cmdline.jax /*c_CTRL-L* +c_CTRL-M cmdline.jax /*c_CTRL-M* +c_CTRL-N cmdline.jax /*c_CTRL-N* +c_CTRL-P cmdline.jax /*c_CTRL-P* +c_CTRL-Q cmdline.jax /*c_CTRL-Q* +c_CTRL-R cmdline.jax /*c_CTRL-R* +c_CTRL-R_= cmdline.jax /*c_CTRL-R_=* +c_CTRL-R_CTRL-A cmdline.jax /*c_CTRL-R_CTRL-A* +c_CTRL-R_CTRL-F cmdline.jax /*c_CTRL-R_CTRL-F* +c_CTRL-R_CTRL-O cmdline.jax /*c_CTRL-R_CTRL-O* +c_CTRL-R_CTRL-P cmdline.jax /*c_CTRL-R_CTRL-P* +c_CTRL-R_CTRL-R cmdline.jax /*c_CTRL-R_CTRL-R* +c_CTRL-R_CTRL-W cmdline.jax /*c_CTRL-R_CTRL-W* +c_CTRL-T cmdline.jax /*c_CTRL-T* +c_CTRL-U cmdline.jax /*c_CTRL-U* +c_CTRL-V cmdline.jax /*c_CTRL-V* +c_CTRL-W cmdline.jax /*c_CTRL-W* +c_CTRL-Y cmdline.jax /*c_CTRL-Y* +c_CTRL-[ cmdline.jax /*c_CTRL-[* +c_CTRL-\_CTRL-G intro.jax /*c_CTRL-\\_CTRL-G* +c_CTRL-\_CTRL-N intro.jax /*c_CTRL-\\_CTRL-N* +c_CTRL-\_e cmdline.jax /*c_CTRL-\\_e* +c_CTRL-] cmdline.jax /*c_CTRL-]* +c_CTRL-^ cmdline.jax /*c_CTRL-^* +c_CTRL-_ cmdline.jax /*c_CTRL-_* +c_Del cmdline.jax /*c_Del* +c_Down cmdline.jax /*c_Down* +c_End cmdline.jax /*c_End* +c_Esc cmdline.jax /*c_Esc* +c_Home cmdline.jax /*c_Home* +c_Insert cmdline.jax /*c_Insert* +c_Left cmdline.jax /*c_Left* +c_Right cmdline.jax /*c_Right* +c_Up cmdline.jax /*c_Up* +c_ansi_constants syntax.jax /*c_ansi_constants* +c_ansi_typedefs syntax.jax /*c_ansi_typedefs* +c_comment_strings syntax.jax /*c_comment_strings* +c_curly_error syntax.jax /*c_curly_error* +c_digraph cmdline.jax /*c_digraph* +c_gnu syntax.jax /*c_gnu* +c_no_ansi syntax.jax /*c_no_ansi* +c_no_bracket_error syntax.jax /*c_no_bracket_error* +c_no_bsd syntax.jax /*c_no_bsd* +c_no_c11 syntax.jax /*c_no_c11* +c_no_c99 syntax.jax /*c_no_c99* +c_no_cformat syntax.jax /*c_no_cformat* +c_no_curly_error syntax.jax /*c_no_curly_error* +c_no_if0 syntax.jax /*c_no_if0* +c_no_tab_space_error syntax.jax /*c_no_tab_space_error* +c_no_trail_space_error syntax.jax /*c_no_trail_space_error* +c_no_utf syntax.jax /*c_no_utf* +c_space_errors syntax.jax /*c_space_errors* +c_syntax_for_h syntax.jax /*c_syntax_for_h* +c_wildchar cmdline.jax /*c_wildchar* +call() eval.jax /*call()* +carriage-return intro.jax /*carriage-return* +case change.jax /*case* +catch-all eval.jax /*catch-all* +catch-errors eval.jax /*catch-errors* +catch-interrupt eval.jax /*catch-interrupt* +catch-order eval.jax /*catch-order* +catch-text eval.jax /*catch-text* +cc change.jax /*cc* +ceil() eval.jax /*ceil()* +ch.vim syntax.jax /*ch.vim* +ch_canread() eval.jax /*ch_canread()* +ch_close() eval.jax /*ch_close()* +ch_close_in() eval.jax /*ch_close_in()* +ch_evalexpr() eval.jax /*ch_evalexpr()* +ch_evalraw() eval.jax /*ch_evalraw()* +ch_getbufnr() eval.jax /*ch_getbufnr()* +ch_getjob() eval.jax /*ch_getjob()* +ch_info() eval.jax /*ch_info()* +ch_log() eval.jax /*ch_log()* +ch_logfile() eval.jax /*ch_logfile()* +ch_open() eval.jax /*ch_open()* +ch_read() eval.jax /*ch_read()* +ch_readraw() eval.jax /*ch_readraw()* +ch_sendexpr() eval.jax /*ch_sendexpr()* +ch_sendraw() eval.jax /*ch_sendraw()* +ch_setoptions() eval.jax /*ch_setoptions()* +ch_status() eval.jax /*ch_status()* +change-list-jumps motion.jax /*change-list-jumps* +change-name tips.jax /*change-name* +change-tabs change.jax /*change-tabs* +change.txt change.jax /*change.txt* +changelist motion.jax /*changelist* +changelog.vim syntax.jax /*changelog.vim* +changenr() eval.jax /*changenr()* +changetick eval.jax /*changetick* +changing change.jax /*changing* +channel channel.jax /*channel* +channel-callback channel.jax /*channel-callback* +channel-close channel.jax /*channel-close* +channel-close-in channel.jax /*channel-close-in* +channel-commands channel.jax /*channel-commands* +channel-demo channel.jax /*channel-demo* +channel-drop channel.jax /*channel-drop* +channel-functions usr_41.jax /*channel-functions* +channel-mode channel.jax /*channel-mode* +channel-more channel.jax /*channel-more* +channel-open channel.jax /*channel-open* +channel-open-options channel.jax /*channel-open-options* +channel-raw channel.jax /*channel-raw* +channel-timeout channel.jax /*channel-timeout* +channel-use channel.jax /*channel-use* +channel.txt channel.jax /*channel.txt* +char-variable eval.jax /*char-variable* +char2nr() eval.jax /*char2nr()* +characterwise motion.jax /*characterwise* +characterwise-register change.jax /*characterwise-register* +characterwise-visual visual.jax /*characterwise-visual* +charconvert_from-variable eval.jax /*charconvert_from-variable* +charconvert_to-variable eval.jax /*charconvert_to-variable* +charity uganda.jax /*charity* +charset mbyte.jax /*charset* +charset-conversion mbyte.jax /*charset-conversion* +chill.vim syntax.jax /*chill.vim* +chmod eval.jax /*chmod* +cindent() eval.jax /*cindent()* +cinkeys-format indent.jax /*cinkeys-format* +cino-# indent.jax /*cino-#* +cino-( indent.jax /*cino-(* +cino-) indent.jax /*cino-)* +cino-+ indent.jax /*cino-+* +cino-/ indent.jax /*cino-\/* +cino-: indent.jax /*cino-:* +cino-= indent.jax /*cino-=* +cino-> indent.jax /*cino->* +cino-C indent.jax /*cino-C* +cino-E indent.jax /*cino-E* +cino-J indent.jax /*cino-J* +cino-L indent.jax /*cino-L* +cino-M indent.jax /*cino-M* +cino-N indent.jax /*cino-N* +cino-U indent.jax /*cino-U* +cino-W indent.jax /*cino-W* +cino-^ indent.jax /*cino-^* +cino-b indent.jax /*cino-b* +cino-c indent.jax /*cino-c* +cino-e indent.jax /*cino-e* +cino-f indent.jax /*cino-f* +cino-g indent.jax /*cino-g* +cino-h indent.jax /*cino-h* +cino-i indent.jax /*cino-i* +cino-j indent.jax /*cino-j* +cino-k indent.jax /*cino-k* +cino-l indent.jax /*cino-l* +cino-m indent.jax /*cino-m* +cino-n indent.jax /*cino-n* +cino-p indent.jax /*cino-p* +cino-star indent.jax /*cino-star* +cino-t indent.jax /*cino-t* +cino-u indent.jax /*cino-u* +cino-w indent.jax /*cino-w* +cino-{ indent.jax /*cino-{* +cino-} indent.jax /*cino-}* +cinoptions-values indent.jax /*cinoptions-values* +clear-undo undo.jax /*clear-undo* +clearmatches() eval.jax /*clearmatches()* +client-server remote.jax /*client-server* +clientserver remote.jax /*clientserver* +clipboard gui.jax /*clipboard* +clipboard-autoselect options.jax /*clipboard-autoselect* +clipboard-autoselectml options.jax /*clipboard-autoselectml* +clipboard-autoselectplus options.jax /*clipboard-autoselectplus* +clipboard-exclude options.jax /*clipboard-exclude* +clipboard-html options.jax /*clipboard-html* +clipboard-unnamed options.jax /*clipboard-unnamed* +clipboard-unnamedplus options.jax /*clipboard-unnamedplus* +clojure-indent indent.jax /*clojure-indent* +close_cb channel.jax /*close_cb* +closure eval.jax /*closure* +cmdarg-variable eval.jax /*cmdarg-variable* +cmdbang-variable eval.jax /*cmdbang-variable* +cmdline-arguments vi_diff.jax /*cmdline-arguments* +cmdline-completion cmdline.jax /*cmdline-completion* +cmdline-editing cmdline.jax /*cmdline-editing* +cmdline-history cmdline.jax /*cmdline-history* +cmdline-lines cmdline.jax /*cmdline-lines* +cmdline-ranges cmdline.jax /*cmdline-ranges* +cmdline-special cmdline.jax /*cmdline-special* +cmdline-too-long cmdline.jax /*cmdline-too-long* +cmdline-window cmdline.jax /*cmdline-window* +cmdline.txt cmdline.jax /*cmdline.txt* +cmdwin cmdline.jax /*cmdwin* +cmdwin-char cmdline.jax /*cmdwin-char* +cobol.vim syntax.jax /*cobol.vim* +codeset mbyte.jax /*codeset* +coding-style develop.jax /*coding-style* +col() eval.jax /*col()* +coldfusion.vim syntax.jax /*coldfusion.vim* +collapse tips.jax /*collapse* +color-xterm syntax.jax /*color-xterm* +coloring syntax.jax /*coloring* +colortest.vim syntax.jax /*colortest.vim* +command-line-functions usr_41.jax /*command-line-functions* +command-line-window cmdline.jax /*command-line-window* +command-mode intro.jax /*command-mode* +compatible-default starting.jax /*compatible-default* +compile-changes-8 version8.jax /*compile-changes-8* +compiler-compaqada ft_ada.jax /*compiler-compaqada* +compiler-decada ft_ada.jax /*compiler-decada* +compiler-gcc quickfix.jax /*compiler-gcc* +compiler-gnat ft_ada.jax /*compiler-gnat* +compiler-hpada ft_ada.jax /*compiler-hpada* +compiler-manx quickfix.jax /*compiler-manx* +compiler-perl quickfix.jax /*compiler-perl* +compiler-pyunit quickfix.jax /*compiler-pyunit* +compiler-select quickfix.jax /*compiler-select* +compiler-tex quickfix.jax /*compiler-tex* +compiler-vaxada ft_ada.jax /*compiler-vaxada* +compl-current insert.jax /*compl-current* +compl-define insert.jax /*compl-define* +compl-dictionary insert.jax /*compl-dictionary* +compl-filename insert.jax /*compl-filename* +compl-function insert.jax /*compl-function* +compl-generic insert.jax /*compl-generic* +compl-keyword insert.jax /*compl-keyword* +compl-omni insert.jax /*compl-omni* +compl-omni-filetypes insert.jax /*compl-omni-filetypes* +compl-spelling insert.jax /*compl-spelling* +compl-tag insert.jax /*compl-tag* +compl-vim insert.jax /*compl-vim* +compl-whole-line insert.jax /*compl-whole-line* +complete() eval.jax /*complete()* +complete-functions insert.jax /*complete-functions* +complete-items insert.jax /*complete-items* +complete_CTRL-E insert.jax /*complete_CTRL-E* +complete_CTRL-Y insert.jax /*complete_CTRL-Y* +complete_add() eval.jax /*complete_add()* +complete_check() eval.jax /*complete_check()* +completed_item-variable eval.jax /*completed_item-variable* +completion-functions usr_41.jax /*completion-functions* +complex-change change.jax /*complex-change* +complex-repeat repeat.jax /*complex-repeat* +compress pi_gzip.jax /*compress* +conceal syntax.jax /*conceal* +confirm() eval.jax /*confirm()* +connection-refused message.jax /*connection-refused* +console-menus gui.jax /*console-menus* +control intro.jax /*control* +conversion-server mbyte.jax /*conversion-server* +convert-to-HTML syntax.jax /*convert-to-HTML* +convert-to-XHTML syntax.jax /*convert-to-XHTML* +convert-to-XML syntax.jax /*convert-to-XML* +copy() eval.jax /*copy()* +copy-diffs diff.jax /*copy-diffs* +copy-move change.jax /*copy-move* +copying uganda.jax /*copying* +copyright uganda.jax /*copyright* +cos() eval.jax /*cos()* +cosh() eval.jax /*cosh()* +count intro.jax /*count* +count() eval.jax /*count()* +count-bytes tips.jax /*count-bytes* +count-items tips.jax /*count-items* +count-variable eval.jax /*count-variable* +count1-variable eval.jax /*count1-variable* +cpo options.jax /*cpo* +cpo-! options.jax /*cpo-!* +cpo-# options.jax /*cpo-#* +cpo-$ options.jax /*cpo-$* +cpo-% options.jax /*cpo-%* +cpo-& options.jax /*cpo-&* +cpo-+ options.jax /*cpo-+* +cpo-- options.jax /*cpo--* +cpo-. options.jax /*cpo-.* +cpo-/ options.jax /*cpo-\/* +cpo-; options.jax /*cpo-;* +cpo-< options.jax /*cpo-<* +cpo-> options.jax /*cpo->* +cpo-A options.jax /*cpo-A* +cpo-B options.jax /*cpo-B* +cpo-C options.jax /*cpo-C* +cpo-D options.jax /*cpo-D* +cpo-E options.jax /*cpo-E* +cpo-F options.jax /*cpo-F* +cpo-H options.jax /*cpo-H* +cpo-I options.jax /*cpo-I* +cpo-J options.jax /*cpo-J* +cpo-K options.jax /*cpo-K* +cpo-L options.jax /*cpo-L* +cpo-M options.jax /*cpo-M* +cpo-O options.jax /*cpo-O* +cpo-P options.jax /*cpo-P* +cpo-R options.jax /*cpo-R* +cpo-S options.jax /*cpo-S* +cpo-W options.jax /*cpo-W* +cpo-X options.jax /*cpo-X* +cpo-Z options.jax /*cpo-Z* +cpo-\ options.jax /*cpo-\\* +cpo-a options.jax /*cpo-a* +cpo-b options.jax /*cpo-b* +cpo-bar options.jax /*cpo-bar* +cpo-c options.jax /*cpo-c* +cpo-d options.jax /*cpo-d* +cpo-e options.jax /*cpo-e* +cpo-f options.jax /*cpo-f* +cpo-g options.jax /*cpo-g* +cpo-i options.jax /*cpo-i* +cpo-j options.jax /*cpo-j* +cpo-k options.jax /*cpo-k* +cpo-l options.jax /*cpo-l* +cpo-m options.jax /*cpo-m* +cpo-n options.jax /*cpo-n* +cpo-o options.jax /*cpo-o* +cpo-p options.jax /*cpo-p* +cpo-q options.jax /*cpo-q* +cpo-r options.jax /*cpo-r* +cpo-s options.jax /*cpo-s* +cpo-star options.jax /*cpo-star* +cpo-t options.jax /*cpo-t* +cpo-u options.jax /*cpo-u* +cpo-v options.jax /*cpo-v* +cpo-w options.jax /*cpo-w* +cpo-x options.jax /*cpo-x* +cpo-y options.jax /*cpo-y* +cpo-{ options.jax /*cpo-{* +cpp.vim syntax.jax /*cpp.vim* +crash-recovery recover.jax /*crash-recovery* +creating-menus gui.jax /*creating-menus* +credits intro.jax /*credits* +crontab options.jax /*crontab* +cs-find if_cscop.jax /*cs-find* +cs7-problem term.jax /*cs7-problem* +cscope if_cscop.jax /*cscope* +cscope-commands if_cscop.jax /*cscope-commands* +cscope-find if_cscop.jax /*cscope-find* +cscope-howtouse if_cscop.jax /*cscope-howtouse* +cscope-info if_cscop.jax /*cscope-info* +cscope-intro if_cscop.jax /*cscope-intro* +cscope-limitations if_cscop.jax /*cscope-limitations* +cscope-options if_cscop.jax /*cscope-options* +cscope-suggestions if_cscop.jax /*cscope-suggestions* +cscope-win32 if_cscop.jax /*cscope-win32* +cscope_connection() eval.jax /*cscope_connection()* +cscopepathcomp if_cscop.jax /*cscopepathcomp* +cscopeprg if_cscop.jax /*cscopeprg* +cscopequickfix if_cscop.jax /*cscopequickfix* +cscoperelative if_cscop.jax /*cscoperelative* +cscopetag if_cscop.jax /*cscopetag* +cscopetagorder if_cscop.jax /*cscopetagorder* +cscopeverbose if_cscop.jax /*cscopeverbose* +csh.vim syntax.jax /*csh.vim* +cspc if_cscop.jax /*cspc* +csprg if_cscop.jax /*csprg* +csqf if_cscop.jax /*csqf* +csre if_cscop.jax /*csre* +cst if_cscop.jax /*cst* +csto if_cscop.jax /*csto* +csverb if_cscop.jax /*csverb* +ctags tagsrch.jax /*ctags* +cterm-colors syntax.jax /*cterm-colors* +ctrl intro.jax /*ctrl* +ctype-variable eval.jax /*ctype-variable* +curly-braces-function-names eval.jax /*curly-braces-function-names* +curly-braces-names eval.jax /*curly-braces-names* +current-directory editing.jax /*current-directory* +current-file editing.jax /*current-file* +current_compiler quickfix.jax /*current_compiler* +cursor() eval.jax /*cursor()* +cursor-blinking options.jax /*cursor-blinking* +cursor-down intro.jax /*cursor-down* +cursor-functions usr_41.jax /*cursor-functions* +cursor-left intro.jax /*cursor-left* +cursor-motions motion.jax /*cursor-motions* +cursor-position pattern.jax /*cursor-position* +cursor-right intro.jax /*cursor-right* +cursor-up intro.jax /*cursor-up* +cursor_down intro.jax /*cursor_down* +cursor_left intro.jax /*cursor_left* +cursor_right intro.jax /*cursor_right* +cursor_up intro.jax /*cursor_up* +cw change.jax /*cw* +cweb.vim syntax.jax /*cweb.vim* +cynlib.vim syntax.jax /*cynlib.vim* +d change.jax /*d* +daB motion.jax /*daB* +daW motion.jax /*daW* +dab motion.jax /*dab* +dap motion.jax /*dap* +das motion.jax /*das* +date-functions usr_41.jax /*date-functions* +dav pi_netrw.jax /*dav* +davs pi_netrw.jax /*davs* +daw motion.jax /*daw* +dd change.jax /*dd* +debug-gcc debug.jax /*debug-gcc* +debug-highlight debugger.jax /*debug-highlight* +debug-leaks debug.jax /*debug-leaks* +debug-minidump debug.jax /*debug-minidump* +debug-mode repeat.jax /*debug-mode* +debug-scripts repeat.jax /*debug-scripts* +debug-signs debugger.jax /*debug-signs* +debug-vim debug.jax /*debug-vim* +debug-vs2005 debug.jax /*debug-vs2005* +debug-win32 debug.jax /*debug-win32* +debug-windbg debug.jax /*debug-windbg* +debug.txt debug.jax /*debug.txt* +debugger-compilation debugger.jax /*debugger-compilation* +debugger-features debugger.jax /*debugger-features* +debugger-integration debugger.jax /*debugger-integration* +debugger-support debugger.jax /*debugger-support* +debugger.txt debugger.jax /*debugger.txt* +dec-mouse options.jax /*dec-mouse* +decada_members ft_ada.jax /*decada_members* +deepcopy() eval.jax /*deepcopy()* +defaults.vim starting.jax /*defaults.vim* +definition-search tagsrch.jax /*definition-search* +definitions intro.jax /*definitions* +delete() eval.jax /*delete()* +delete-insert change.jax /*delete-insert* +delete-menus gui.jax /*delete-menus* +deleting change.jax /*deleting* +demoserver.py channel.jax /*demoserver.py* +design-assumptions develop.jax /*design-assumptions* +design-compatible develop.jax /*design-compatible* +design-decisions develop.jax /*design-decisions* +design-documented develop.jax /*design-documented* +design-flexible develop.jax /*design-flexible* +design-goals develop.jax /*design-goals* +design-improved develop.jax /*design-improved* +design-maintain develop.jax /*design-maintain* +design-multi-platform develop.jax /*design-multi-platform* +design-not develop.jax /*design-not* +design-speed-size develop.jax /*design-speed-size* +desktop.vim syntax.jax /*desktop.vim* +develop-spell develop.jax /*develop-spell* +develop-spell-suggestions develop.jax /*develop-spell-suggestions* +develop.txt develop.jax /*develop.txt* +development develop.jax /*development* +dgn motion.jax /*dgn* +dh change.jax /*dh* +diB motion.jax /*diB* +diW motion.jax /*diW* +dialog gui_w32.jax /*dialog* +dib motion.jax /*dib* +dict eval.jax /*dict* +dict-functions usr_41.jax /*dict-functions* +dict-identity eval.jax /*dict-identity* +dict-modification eval.jax /*dict-modification* +did_filetype() eval.jax /*did_filetype()* +diff diff.jax /*diff* +diff-diffexpr diff.jax /*diff-diffexpr* +diff-mode diff.jax /*diff-mode* +diff-options diff.jax /*diff-options* +diff-original-file diff.jax /*diff-original-file* +diff-patchexpr diff.jax /*diff-patchexpr* +diff-slow diff.jax /*diff-slow* +diff.txt diff.jax /*diff.txt* +diff.vim syntax.jax /*diff.vim* +diff_filler() eval.jax /*diff_filler()* +diff_hlID() eval.jax /*diff_hlID()* +diff_translations diff.jax /*diff_translations* +digraph digraph.jax /*digraph* +digraph-arg change.jax /*digraph-arg* +digraph-encoding digraph.jax /*digraph-encoding* +digraph-table digraph.jax /*digraph-table* +digraph-table-mbyte digraph.jax /*digraph-table-mbyte* +digraph.txt digraph.jax /*digraph.txt* +digraphs digraph.jax /*digraphs* +digraphs-default digraph.jax /*digraphs-default* +digraphs-define digraph.jax /*digraphs-define* +digraphs-use digraph.jax /*digraphs-use* +dip motion.jax /*dip* +dircolors.vim syntax.jax /*dircolors.vim* +dis motion.jax /*dis* +disable-menus gui.jax /*disable-menus* +discard editing.jax /*discard* +distribute-script usr_41.jax /*distribute-script* +distribution intro.jax /*distribution* +diw motion.jax /*diw* +dl change.jax /*dl* +do diff.jax /*do* +doc-file-list help.jax /*doc-file-list* +docbk.vim syntax.jax /*docbk.vim* +docbksgml.vim syntax.jax /*docbksgml.vim* +docbkxml.vim syntax.jax /*docbkxml.vim* +docbook syntax.jax /*docbook* +donate uganda.jax /*donate* +dos os_dos.jax /*dos* +dos-:cd os_dos.jax /*dos-:cd* +dos-CTRL-Break os_dos.jax /*dos-CTRL-Break* +dos-backslash os_dos.jax /*dos-backslash* +dos-colors os_dos.jax /*dos-colors* +dos-file-formats os_dos.jax /*dos-file-formats* +dos-locations os_dos.jax /*dos-locations* +dos-shell os_dos.jax /*dos-shell* +dos-standard-mappings os_dos.jax /*dos-standard-mappings* +dos-temp-files os_dos.jax /*dos-temp-files* +dosbatch.vim syntax.jax /*dosbatch.vim* +double-click term.jax /*double-click* +download intro.jax /*download* +doxygen-syntax syntax.jax /*doxygen-syntax* +doxygen.vim syntax.jax /*doxygen.vim* +dp diff.jax /*dp* +drag-n-drop gui.jax /*drag-n-drop* +drag-n-drop-win32 gui_w32.jax /*drag-n-drop-win32* +drag-status-line term.jax /*drag-status-line* +dtd.vim syntax.jax /*dtd.vim* +dtd2vim insert.jax /*dtd2vim* +dying-variable eval.jax /*dying-variable* +e motion.jax /*e* +easy starting.jax /*easy* +edit-a-file editing.jax /*edit-a-file* +edit-binary editing.jax /*edit-binary* +edit-dialogs editing.jax /*edit-dialogs* +edit-files editing.jax /*edit-files* +edit-intro editing.jax /*edit-intro* +edit-no-break usr_25.jax /*edit-no-break* +edit-paragraph-join usr_25.jax /*edit-paragraph-join* +editing.txt editing.jax /*editing.txt* +efm-%> quickfix.jax /*efm-%>* +efm-entries quickfix.jax /*efm-entries* +efm-ignore quickfix.jax /*efm-ignore* +eiffel.vim syntax.jax /*eiffel.vim* +emacs-keys tips.jax /*emacs-keys* +emacs-tags tagsrch.jax /*emacs-tags* +emacs_tags tagsrch.jax /*emacs_tags* +empty() eval.jax /*empty()* +encoding-names mbyte.jax /*encoding-names* +encoding-table mbyte.jax /*encoding-table* +encoding-values mbyte.jax /*encoding-values* +encryption editing.jax /*encryption* +end intro.jax /*end* +end-of-file pattern.jax /*end-of-file* +enlightened-terminal syntax.jax /*enlightened-terminal* +erlang.vim syntax.jax /*erlang.vim* +err_buf channel.jax /*err_buf* +err_cb channel.jax /*err_cb* +err_mode channel.jax /*err_mode* +err_modifiable channel.jax /*err_modifiable* +err_msg channel.jax /*err_msg* +err_name channel.jax /*err_name* +err_timeout channel.jax /*err_timeout* +errmsg-variable eval.jax /*errmsg-variable* +error-file-format quickfix.jax /*error-file-format* +error-messages message.jax /*error-messages* +errorformat quickfix.jax /*errorformat* +errorformat-Jikes quickfix.jax /*errorformat-Jikes* +errorformat-LaTeX quickfix.jax /*errorformat-LaTeX* +errorformat-Perl quickfix.jax /*errorformat-Perl* +errorformat-ant quickfix.jax /*errorformat-ant* +errorformat-changed version4.jax /*errorformat-changed* +errorformat-jade quickfix.jax /*errorformat-jade* +errorformat-javac quickfix.jax /*errorformat-javac* +errorformat-multi-line quickfix.jax /*errorformat-multi-line* +errorformat-separate-filename quickfix.jax /*errorformat-separate-filename* +errorformats quickfix.jax /*errorformats* +errors message.jax /*errors* +errors-variable eval.jax /*errors-variable* +escape intro.jax /*escape* +escape() eval.jax /*escape()* +escape-bar version4.jax /*escape-bar* +euphoria3.vim syntax.jax /*euphoria3.vim* +euphoria4.vim syntax.jax /*euphoria4.vim* +eval eval.jax /*eval* +eval() eval.jax /*eval()* +eval-examples eval.jax /*eval-examples* +eval-sandbox eval.jax /*eval-sandbox* +eval.txt eval.jax /*eval.txt* +eventhandler() eval.jax /*eventhandler()* +eview starting.jax /*eview* +evim starting.jax /*evim* +evim-keys starting.jax /*evim-keys* +evim.vim starting.jax /*evim.vim* +ex starting.jax /*ex* +ex-cmd-index index.jax /*ex-cmd-index* +ex-edit-index index.jax /*ex-edit-index* +ex-flags cmdline.jax /*ex-flags* +ex: options.jax /*ex:* +except-autocmd eval.jax /*except-autocmd* +except-autocmd-Cmd eval.jax /*except-autocmd-Cmd* +except-autocmd-Post eval.jax /*except-autocmd-Post* +except-autocmd-Pre eval.jax /*except-autocmd-Pre* +except-autocmd-ill eval.jax /*except-autocmd-ill* +except-compat eval.jax /*except-compat* +except-examine eval.jax /*except-examine* +except-from-finally eval.jax /*except-from-finally* +except-hier-param eval.jax /*except-hier-param* +except-several-errors eval.jax /*except-several-errors* +except-single-line eval.jax /*except-single-line* +except-syntax-err eval.jax /*except-syntax-err* +except-syntax-error eval.jax /*except-syntax-error* +exception-handling eval.jax /*exception-handling* +exception-variable eval.jax /*exception-variable* +exclusive motion.jax /*exclusive* +exclusive-linewise motion.jax /*exclusive-linewise* +executable() eval.jax /*executable()* +execute() eval.jax /*execute()* +execute-menus gui.jax /*execute-menus* +exepath() eval.jax /*exepath()* +exim starting.jax /*exim* +exists() eval.jax /*exists()* +exiting starting.jax /*exiting* +exp() eval.jax /*exp()* +expand() eval.jax /*expand()* +expand-env options.jax /*expand-env* +expand-environment-var options.jax /*expand-environment-var* +expr eval.jax /*expr* +expr-! eval.jax /*expr-!* +expr-!= eval.jax /*expr-!=* +expr-!=# eval.jax /*expr-!=#* +expr-!=? eval.jax /*expr-!=?* +expr-!~ eval.jax /*expr-!~* +expr-!~# eval.jax /*expr-!~#* +expr-!~? eval.jax /*expr-!~?* +expr-% eval.jax /*expr-%* +expr-&& eval.jax /*expr-&&* +expr-' eval.jax /*expr-'* +expr-+ eval.jax /*expr-+* +expr-- eval.jax /*expr--* +expr-. eval.jax /*expr-.* +expr-/ eval.jax /*expr-\/* +expr-< eval.jax /*expr-<* +expr-<# eval.jax /*expr-<#* +expr-<= eval.jax /*expr-<=* +expr-<=# eval.jax /*expr-<=#* +expr-<=? eval.jax /*expr-<=?* +expr-<? eval.jax /*expr-<?* +expr-== eval.jax /*expr-==* +expr-==# eval.jax /*expr-==#* +expr-==? eval.jax /*expr-==?* +expr-=~ eval.jax /*expr-=~* +expr-=~# eval.jax /*expr-=~#* +expr-=~? eval.jax /*expr-=~?* +expr-> eval.jax /*expr->* +expr-># eval.jax /*expr->#* +expr->= eval.jax /*expr->=* +expr->=# eval.jax /*expr->=#* +expr->=? eval.jax /*expr->=?* +expr->? eval.jax /*expr->?* +expr-[:] eval.jax /*expr-[:]* +expr-[] eval.jax /*expr-[]* +expr-barbar eval.jax /*expr-barbar* +expr-entry eval.jax /*expr-entry* +expr-env eval.jax /*expr-env* +expr-env-expand eval.jax /*expr-env-expand* +expr-function eval.jax /*expr-function* +expr-is eval.jax /*expr-is* +expr-is# eval.jax /*expr-is#* +expr-is? eval.jax /*expr-is?* +expr-isnot eval.jax /*expr-isnot* +expr-isnot# eval.jax /*expr-isnot#* +expr-isnot? eval.jax /*expr-isnot?* +expr-lambda eval.jax /*expr-lambda* +expr-nesting eval.jax /*expr-nesting* +expr-number eval.jax /*expr-number* +expr-option eval.jax /*expr-option* +expr-quote eval.jax /*expr-quote* +expr-register eval.jax /*expr-register* +expr-star eval.jax /*expr-star* +expr-string eval.jax /*expr-string* +expr-unary-+ eval.jax /*expr-unary-+* +expr-unary-- eval.jax /*expr-unary--* +expr-variable eval.jax /*expr-variable* +expr1 eval.jax /*expr1* +expr2 eval.jax /*expr2* +expr3 eval.jax /*expr3* +expr4 eval.jax /*expr4* +expr5 eval.jax /*expr5* +expr6 eval.jax /*expr6* +expr7 eval.jax /*expr7* +expr8 eval.jax /*expr8* +expr9 eval.jax /*expr9* +expression eval.jax /*expression* +expression-commands eval.jax /*expression-commands* +expression-syntax eval.jax /*expression-syntax* +exrc starting.jax /*exrc* +extend() eval.jax /*extend()* +extension-removal cmdline.jax /*extension-removal* +f motion.jax /*f* +false-variable eval.jax /*false-variable* +faq intro.jax /*faq* +farsi farsi.jax /*farsi* +farsi-fonts farsi.jax /*farsi-fonts* +farsi.txt farsi.jax /*farsi.txt* +fasm.vim syntax.jax /*fasm.vim* +fcs_choice-variable eval.jax /*fcs_choice-variable* +fcs_reason-variable eval.jax /*fcs_reason-variable* +feature-list eval.jax /*feature-list* +feedkeys() eval.jax /*feedkeys()* +fetch pi_netrw.jax /*fetch* +file-formats editing.jax /*file-formats* +file-functions usr_41.jax /*file-functions* +file-pattern autocmd.jax /*file-pattern* +file-read insert.jax /*file-read* +file-searching editing.jax /*file-searching* +file-type filetype.jax /*file-type* +file-types filetype.jax /*file-types* +file_readable() eval.jax /*file_readable()* +filename-backslash cmdline.jax /*filename-backslash* +filename-modifiers cmdline.jax /*filename-modifiers* +filereadable() eval.jax /*filereadable()* +filetype filetype.jax /*filetype* +filetype-detect filetype.jax /*filetype-detect* +filetype-ignore filetype.jax /*filetype-ignore* +filetype-overrule filetype.jax /*filetype-overrule* +filetype-plugin usr_43.jax /*filetype-plugin* +filetype-plugins filetype.jax /*filetype-plugins* +filetype.txt filetype.jax /*filetype.txt* +filetypes filetype.jax /*filetypes* +filewritable() eval.jax /*filewritable()* +filter change.jax /*filter* +filter() eval.jax /*filter()* +find-manpage usr_12.jax /*find-manpage* +find-replace usr_10.jax /*find-replace* +finddir() eval.jax /*finddir()* +findfile() eval.jax /*findfile()* +flexwiki.vim syntax.jax /*flexwiki.vim* +float-e eval.jax /*float-e* +float-functions usr_41.jax /*float-functions* +float-pi eval.jax /*float-pi* +float2nr() eval.jax /*float2nr()* +floating-point-format eval.jax /*floating-point-format* +floating-point-precision eval.jax /*floating-point-precision* +floor() eval.jax /*floor()* +fmod() eval.jax /*fmod()* +fname_diff-variable eval.jax /*fname_diff-variable* +fname_in-variable eval.jax /*fname_in-variable* +fname_new-variable eval.jax /*fname_new-variable* +fname_out-variable eval.jax /*fname_out-variable* +fnameescape() eval.jax /*fnameescape()* +fnamemodify() eval.jax /*fnamemodify()* +fo-table change.jax /*fo-table* +fold-behavior fold.jax /*fold-behavior* +fold-colors fold.jax /*fold-colors* +fold-commands fold.jax /*fold-commands* +fold-create-marker fold.jax /*fold-create-marker* +fold-delete-marker fold.jax /*fold-delete-marker* +fold-diff fold.jax /*fold-diff* +fold-expr fold.jax /*fold-expr* +fold-foldcolumn fold.jax /*fold-foldcolumn* +fold-foldlevel fold.jax /*fold-foldlevel* +fold-foldtext fold.jax /*fold-foldtext* +fold-indent fold.jax /*fold-indent* +fold-manual fold.jax /*fold-manual* +fold-marker fold.jax /*fold-marker* +fold-methods fold.jax /*fold-methods* +fold-options fold.jax /*fold-options* +fold-syntax fold.jax /*fold-syntax* +fold.txt fold.jax /*fold.txt* +foldclosed() eval.jax /*foldclosed()* +foldclosedend() eval.jax /*foldclosedend()* +folddashes-variable eval.jax /*folddashes-variable* +foldend-variable eval.jax /*foldend-variable* +folding fold.jax /*folding* +folding-functions usr_41.jax /*folding-functions* +foldlevel() eval.jax /*foldlevel()* +foldlevel-variable eval.jax /*foldlevel-variable* +folds fold.jax /*folds* +foldstart-variable eval.jax /*foldstart-variable* +foldtext() eval.jax /*foldtext()* +foldtextresult() eval.jax /*foldtextresult()* +font-sizes gui_x11.jax /*font-sizes* +fontset mbyte.jax /*fontset* +foreground() eval.jax /*foreground()* +fork os_unix.jax /*fork* +form.vim syntax.jax /*form.vim* +format-bullet-list tips.jax /*format-bullet-list* +format-comments change.jax /*format-comments* +formatting change.jax /*formatting* +formfeed intro.jax /*formfeed* +fortran.vim syntax.jax /*fortran.vim* +friendship intro.jax /*friendship* +frombook usr_01.jax /*frombook* +ft-abel-syntax syntax.jax /*ft-abel-syntax* +ft-ada-commands ft_ada.jax /*ft-ada-commands* +ft-ada-constants ft_ada.jax /*ft-ada-constants* +ft-ada-functions ft_ada.jax /*ft-ada-functions* +ft-ada-indent ft_ada.jax /*ft-ada-indent* +ft-ada-omni ft_ada.jax /*ft-ada-omni* +ft-ada-options ft_ada.jax /*ft-ada-options* +ft-ada-plugin ft_ada.jax /*ft-ada-plugin* +ft-ada-syntax ft_ada.jax /*ft-ada-syntax* +ft-ada-variables ft_ada.jax /*ft-ada-variables* +ft-ant-syntax syntax.jax /*ft-ant-syntax* +ft-apache-syntax syntax.jax /*ft-apache-syntax* +ft-asm-syntax syntax.jax /*ft-asm-syntax* +ft-asm68k-syntax syntax.jax /*ft-asm68k-syntax* +ft-asmh8300-syntax syntax.jax /*ft-asmh8300-syntax* +ft-aspperl-syntax syntax.jax /*ft-aspperl-syntax* +ft-aspvbs-syntax syntax.jax /*ft-aspvbs-syntax* +ft-bash-syntax syntax.jax /*ft-bash-syntax* +ft-basic-syntax syntax.jax /*ft-basic-syntax* +ft-c-omni insert.jax /*ft-c-omni* +ft-c-syntax syntax.jax /*ft-c-syntax* +ft-ch-syntax syntax.jax /*ft-ch-syntax* +ft-changelog-plugin filetype.jax /*ft-changelog-plugin* +ft-changelog-syntax syntax.jax /*ft-changelog-syntax* +ft-chill-syntax syntax.jax /*ft-chill-syntax* +ft-clojure-indent indent.jax /*ft-clojure-indent* +ft-clojure-syntax syntax.jax /*ft-clojure-syntax* +ft-cobol-syntax syntax.jax /*ft-cobol-syntax* +ft-coldfusion-syntax syntax.jax /*ft-coldfusion-syntax* +ft-cpp-syntax syntax.jax /*ft-cpp-syntax* +ft-csh-syntax syntax.jax /*ft-csh-syntax* +ft-css-omni insert.jax /*ft-css-omni* +ft-cweb-syntax syntax.jax /*ft-cweb-syntax* +ft-cynlib-syntax syntax.jax /*ft-cynlib-syntax* +ft-dash-syntax syntax.jax /*ft-dash-syntax* +ft-desktop-syntax syntax.jax /*ft-desktop-syntax* +ft-dircolors-syntax syntax.jax /*ft-dircolors-syntax* +ft-docbk-syntax syntax.jax /*ft-docbk-syntax* +ft-docbksgml-syntax syntax.jax /*ft-docbksgml-syntax* +ft-docbkxml-syntax syntax.jax /*ft-docbkxml-syntax* +ft-dosbatch-syntax syntax.jax /*ft-dosbatch-syntax* +ft-dtd-syntax syntax.jax /*ft-dtd-syntax* +ft-eiffel-syntax syntax.jax /*ft-eiffel-syntax* +ft-erlang-syntax syntax.jax /*ft-erlang-syntax* +ft-euphoria-syntax syntax.jax /*ft-euphoria-syntax* +ft-flexwiki-syntax syntax.jax /*ft-flexwiki-syntax* +ft-form-syntax syntax.jax /*ft-form-syntax* +ft-fortran-indent indent.jax /*ft-fortran-indent* +ft-fortran-plugin filetype.jax /*ft-fortran-plugin* +ft-fortran-syntax syntax.jax /*ft-fortran-syntax* +ft-fvwm-syntax syntax.jax /*ft-fvwm-syntax* +ft-gitcommit-plugin filetype.jax /*ft-gitcommit-plugin* +ft-groff-syntax syntax.jax /*ft-groff-syntax* +ft-gsp-syntax syntax.jax /*ft-gsp-syntax* +ft-haskell-syntax syntax.jax /*ft-haskell-syntax* +ft-html-indent indent.jax /*ft-html-indent* +ft-html-omni insert.jax /*ft-html-omni* +ft-html-syntax syntax.jax /*ft-html-syntax* +ft-htmlos-syntax syntax.jax /*ft-htmlos-syntax* +ft-ia64-syntax syntax.jax /*ft-ia64-syntax* +ft-inform-syntax syntax.jax /*ft-inform-syntax* +ft-java-syntax syntax.jax /*ft-java-syntax* +ft-javascript-omni insert.jax /*ft-javascript-omni* +ft-ksh-syntax syntax.jax /*ft-ksh-syntax* +ft-lace-syntax syntax.jax /*ft-lace-syntax* +ft-lex-syntax syntax.jax /*ft-lex-syntax* +ft-lifelines-syntax syntax.jax /*ft-lifelines-syntax* +ft-lisp-syntax syntax.jax /*ft-lisp-syntax* +ft-lite-syntax syntax.jax /*ft-lite-syntax* +ft-lpc-syntax syntax.jax /*ft-lpc-syntax* +ft-lua-syntax syntax.jax /*ft-lua-syntax* +ft-mail-plugin filetype.jax /*ft-mail-plugin* +ft-mail.vim syntax.jax /*ft-mail.vim* +ft-make-syntax syntax.jax /*ft-make-syntax* +ft-man-plugin filetype.jax /*ft-man-plugin* +ft-maple-syntax syntax.jax /*ft-maple-syntax* +ft-masm-syntax syntax.jax /*ft-masm-syntax* +ft-mathematica-syntax syntax.jax /*ft-mathematica-syntax* +ft-mma-syntax syntax.jax /*ft-mma-syntax* +ft-moo-syntax syntax.jax /*ft-moo-syntax* +ft-msql-syntax syntax.jax /*ft-msql-syntax* +ft-nasm-syntax syntax.jax /*ft-nasm-syntax* +ft-ncf-syntax syntax.jax /*ft-ncf-syntax* +ft-nroff-syntax syntax.jax /*ft-nroff-syntax* +ft-ocaml-syntax syntax.jax /*ft-ocaml-syntax* +ft-papp-syntax syntax.jax /*ft-papp-syntax* +ft-pascal-syntax syntax.jax /*ft-pascal-syntax* +ft-pdf-plugin filetype.jax /*ft-pdf-plugin* +ft-perl-syntax syntax.jax /*ft-perl-syntax* +ft-php-indent indent.jax /*ft-php-indent* +ft-php-omni insert.jax /*ft-php-omni* +ft-php-syntax syntax.jax /*ft-php-syntax* +ft-php3-syntax syntax.jax /*ft-php3-syntax* +ft-phtml-syntax syntax.jax /*ft-phtml-syntax* +ft-plaintex-syntax syntax.jax /*ft-plaintex-syntax* +ft-posix-synax syntax.jax /*ft-posix-synax* +ft-postscr-syntax syntax.jax /*ft-postscr-syntax* +ft-ppwiz-syntax syntax.jax /*ft-ppwiz-syntax* +ft-printcap-syntax syntax.jax /*ft-printcap-syntax* +ft-progress-syntax syntax.jax /*ft-progress-syntax* +ft-ptcap-syntax syntax.jax /*ft-ptcap-syntax* +ft-python-indent indent.jax /*ft-python-indent* +ft-python-plugin filetype.jax /*ft-python-plugin* +ft-python-syntax syntax.jax /*ft-python-syntax* +ft-quake-syntax syntax.jax /*ft-quake-syntax* +ft-r-indent indent.jax /*ft-r-indent* +ft-readline-syntax syntax.jax /*ft-readline-syntax* +ft-rexx-syntax syntax.jax /*ft-rexx-syntax* +ft-rst-syntax syntax.jax /*ft-rst-syntax* +ft-ruby-omni insert.jax /*ft-ruby-omni* +ft-ruby-syntax syntax.jax /*ft-ruby-syntax* +ft-scheme-syntax syntax.jax /*ft-scheme-syntax* +ft-sdl-syntax syntax.jax /*ft-sdl-syntax* +ft-sed-syntax syntax.jax /*ft-sed-syntax* +ft-sgml-syntax syntax.jax /*ft-sgml-syntax* +ft-sh-indent indent.jax /*ft-sh-indent* +ft-sh-syntax syntax.jax /*ft-sh-syntax* +ft-spec-plugin filetype.jax /*ft-spec-plugin* +ft-spup-syntax syntax.jax /*ft-spup-syntax* +ft-sql filetype.jax /*ft-sql* +ft-sql-omni insert.jax /*ft-sql-omni* +ft-sql-syntax syntax.jax /*ft-sql-syntax* +ft-sqlanywhere-syntax syntax.jax /*ft-sqlanywhere-syntax* +ft-sqlinformix-syntax syntax.jax /*ft-sqlinformix-syntax* +ft-syntax-omni insert.jax /*ft-syntax-omni* +ft-tcsh-syntax syntax.jax /*ft-tcsh-syntax* +ft-termcap-syntax syntax.jax /*ft-termcap-syntax* +ft-tex-plugin filetype.jax /*ft-tex-plugin* +ft-tex-syntax syntax.jax /*ft-tex-syntax* +ft-tf-syntax syntax.jax /*ft-tf-syntax* +ft-vb-syntax syntax.jax /*ft-vb-syntax* +ft-verilog-indent indent.jax /*ft-verilog-indent* +ft-vhdl-indent indent.jax /*ft-vhdl-indent* +ft-vim-indent indent.jax /*ft-vim-indent* +ft-vim-syntax syntax.jax /*ft-vim-syntax* +ft-xf86conf-syntax syntax.jax /*ft-xf86conf-syntax* +ft-xhtml-omni insert.jax /*ft-xhtml-omni* +ft-xml-omni insert.jax /*ft-xml-omni* +ft-xml-syntax syntax.jax /*ft-xml-syntax* +ft-xpm-syntax syntax.jax /*ft-xpm-syntax* +ft-yaml-syntax syntax.jax /*ft-yaml-syntax* +ft-zsh-syntax syntax.jax /*ft-zsh-syntax* +ft_ada.txt ft_ada.jax /*ft_ada.txt* +ft_sql.txt ft_sql.jax /*ft_sql.txt* +ftdetect filetype.jax /*ftdetect* +ftp pi_netrw.jax /*ftp* +ftplugin usr_41.jax /*ftplugin* +ftplugin-docs filetype.jax /*ftplugin-docs* +ftplugin-name usr_05.jax /*ftplugin-name* +ftplugin-overrule filetype.jax /*ftplugin-overrule* +ftplugin-special usr_41.jax /*ftplugin-special* +ftplugins usr_05.jax /*ftplugins* +funcref() eval.jax /*funcref()* +function() eval.jax /*function()* +function-argument eval.jax /*function-argument* +function-key intro.jax /*function-key* +function-list usr_41.jax /*function-list* +function-range-example eval.jax /*function-range-example* +function-search-undo eval.jax /*function-search-undo* +function_key intro.jax /*function_key* +functions eval.jax /*functions* +fvwm.vim syntax.jax /*fvwm.vim* +g index.jax /*g* +g# pattern.jax /*g#* +g$ motion.jax /*g$* +g& change.jax /*g&* +g' motion.jax /*g'* +g'a motion.jax /*g'a* +g+ undo.jax /*g+* +g, motion.jax /*g,* +g- undo.jax /*g-* +g0 motion.jax /*g0* +g8 various.jax /*g8* +g: eval.jax /*g:* +g:NetrwTopLvlMenu pi_netrw.jax /*g:NetrwTopLvlMenu* +g:Netrw_UserMaps pi_netrw.jax /*g:Netrw_UserMaps* +g:Netrw_corehandler pi_netrw.jax /*g:Netrw_corehandler* +g:Netrw_funcref pi_netrw.jax /*g:Netrw_funcref* +g:actual_curbuf options.jax /*g:actual_curbuf* +g:ada#Comment ft_ada.jax /*g:ada#Comment* +g:ada#Ctags_Kinds ft_ada.jax /*g:ada#Ctags_Kinds* +g:ada#DotWordRegex ft_ada.jax /*g:ada#DotWordRegex* +g:ada#Keywords ft_ada.jax /*g:ada#Keywords* +g:ada#WordRegex ft_ada.jax /*g:ada#WordRegex* +g:ada_abbrev ft_ada.jax /*g:ada_abbrev* +g:ada_all_tab_usage ft_ada.jax /*g:ada_all_tab_usage* +g:ada_begin_preproc ft_ada.jax /*g:ada_begin_preproc* +g:ada_default_compiler ft_ada.jax /*g:ada_default_compiler* +g:ada_extended_completion ft_ada.jax /*g:ada_extended_completion* +g:ada_extended_tagging ft_ada.jax /*g:ada_extended_tagging* +g:ada_folding ft_ada.jax /*g:ada_folding* +g:ada_gnat_extensions ft_ada.jax /*g:ada_gnat_extensions* +g:ada_line_errors ft_ada.jax /*g:ada_line_errors* +g:ada_no_tab_space_error ft_ada.jax /*g:ada_no_tab_space_error* +g:ada_no_trail_space_error ft_ada.jax /*g:ada_no_trail_space_error* +g:ada_omni_with_keywords ft_ada.jax /*g:ada_omni_with_keywords* +g:ada_rainbow_color ft_ada.jax /*g:ada_rainbow_color* +g:ada_space_errors ft_ada.jax /*g:ada_space_errors* +g:ada_standard_types ft_ada.jax /*g:ada_standard_types* +g:ada_with_gnat_project_files ft_ada.jax /*g:ada_with_gnat_project_files* +g:ada_withuse_ordinary ft_ada.jax /*g:ada_withuse_ordinary* +g:clojure_align_multiline_strings indent.jax /*g:clojure_align_multiline_strings* +g:clojure_align_subforms indent.jax /*g:clojure_align_subforms* +g:clojure_fold syntax.jax /*g:clojure_fold* +g:clojure_fuzzy_indent indent.jax /*g:clojure_fuzzy_indent* +g:clojure_fuzzy_indent_blacklist indent.jax /*g:clojure_fuzzy_indent_blacklist* +g:clojure_fuzzy_indent_patterns indent.jax /*g:clojure_fuzzy_indent_patterns* +g:clojure_maxlines indent.jax /*g:clojure_maxlines* +g:clojure_special_indent_words indent.jax /*g:clojure_special_indent_words* +g:clojure_syntax_keywords syntax.jax /*g:clojure_syntax_keywords* +g:colors_name options.jax /*g:colors_name* +g:decada ft_ada.jax /*g:decada* +g:decada.Error_Format ft_ada.jax /*g:decada.Error_Format* +g:decada.Make() ft_ada.jax /*g:decada.Make()* +g:decada.Make_Command ft_ada.jax /*g:decada.Make_Command* +g:decada.Unit_Name() ft_ada.jax /*g:decada.Unit_Name()* +g:filetype_csh syntax.jax /*g:filetype_csh* +g:filetype_r syntax.jax /*g:filetype_r* +g:gnat ft_ada.jax /*g:gnat* +g:gnat.Error_Format ft_ada.jax /*g:gnat.Error_Format* +g:gnat.Find() ft_ada.jax /*g:gnat.Find()* +g:gnat.Find_Program ft_ada.jax /*g:gnat.Find_Program* +g:gnat.Make() ft_ada.jax /*g:gnat.Make()* +g:gnat.Make_Command ft_ada.jax /*g:gnat.Make_Command* +g:gnat.Pretty() ft_ada.jax /*g:gnat.Pretty()* +g:gnat.Pretty_Program ft_ada.jax /*g:gnat.Pretty_Program* +g:gnat.Project_File ft_ada.jax /*g:gnat.Project_File* +g:gnat.Set_Project_File() ft_ada.jax /*g:gnat.Set_Project_File()* +g:gnat.Tags() ft_ada.jax /*g:gnat.Tags()* +g:gnat.Tags_Command ft_ada.jax /*g:gnat.Tags_Command* +g:html_charset_override syntax.jax /*g:html_charset_override* +g:html_diff_one_file syntax.jax /*g:html_diff_one_file* +g:html_dynamic_folds syntax.jax /*g:html_dynamic_folds* +g:html_encoding_override syntax.jax /*g:html_encoding_override* +g:html_end_line syntax.jax /*g:html_end_line* +g:html_expand_tabs syntax.jax /*g:html_expand_tabs* +g:html_font syntax.jax /*g:html_font* +g:html_hover_unfold syntax.jax /*g:html_hover_unfold* +g:html_id_expr syntax.jax /*g:html_id_expr* +g:html_ignore_conceal syntax.jax /*g:html_ignore_conceal* +g:html_ignore_folding syntax.jax /*g:html_ignore_folding* +g:html_line_ids syntax.jax /*g:html_line_ids* +g:html_no_foldcolumn syntax.jax /*g:html_no_foldcolumn* +g:html_no_invalid syntax.jax /*g:html_no_invalid* +g:html_no_pre syntax.jax /*g:html_no_pre* +g:html_no_progress syntax.jax /*g:html_no_progress* +g:html_number_lines syntax.jax /*g:html_number_lines* +g:html_pre_wrap syntax.jax /*g:html_pre_wrap* +g:html_prevent_copy syntax.jax /*g:html_prevent_copy* +g:html_start_line syntax.jax /*g:html_start_line* +g:html_use_css syntax.jax /*g:html_use_css* +g:html_use_encoding syntax.jax /*g:html_use_encoding* +g:html_use_xhtml syntax.jax /*g:html_use_xhtml* +g:html_whole_filler syntax.jax /*g:html_whole_filler* +g:netrw_altfile pi_netrw.jax /*g:netrw_altfile* +g:netrw_alto pi_netrw.jax /*g:netrw_alto* +g:netrw_altv pi_netrw.jax /*g:netrw_altv* +g:netrw_banner pi_netrw.jax /*g:netrw_banner* +g:netrw_bannerbackslash pi_netrw.jax /*g:netrw_bannerbackslash* +g:netrw_browse_split pi_netrw.jax /*g:netrw_browse_split* +g:netrw_browsex_viewer pi_netrw.jax /*g:netrw_browsex_viewer* +g:netrw_bufsettings pi_netrw.jax /*g:netrw_bufsettings* +g:netrw_chgperm pi_netrw.jax /*g:netrw_chgperm* +g:netrw_chgwin pi_netrw.jax /*g:netrw_chgwin* +g:netrw_compress pi_netrw.jax /*g:netrw_compress* +g:netrw_ctags pi_netrw.jax /*g:netrw_ctags* +g:netrw_cursor pi_netrw.jax /*g:netrw_cursor* +g:netrw_cygwin pi_netrw.jax /*g:netrw_cygwin* +g:netrw_dav_cmd pi_netrw.jax /*g:netrw_dav_cmd* +g:netrw_decompress pi_netrw.jax /*g:netrw_decompress* +g:netrw_dirhistmax pi_netrw.jax /*g:netrw_dirhistmax* +g:netrw_dynamic_maxfilenamelen pi_netrw.jax /*g:netrw_dynamic_maxfilenamelen* +g:netrw_errorlvl pi_netrw.jax /*g:netrw_errorlvl* +g:netrw_fastbrowse pi_netrw.jax /*g:netrw_fastbrowse* +g:netrw_fetch_cmd pi_netrw.jax /*g:netrw_fetch_cmd* +g:netrw_ffkeep pi_netrw.jax /*g:netrw_ffkeep* +g:netrw_file_cmd pi_netrw.jax /*g:netrw_file_cmd* +g:netrw_fname_escape pi_netrw.jax /*g:netrw_fname_escape* +g:netrw_ftp pi_netrw.jax /*g:netrw_ftp* +g:netrw_ftp_browse_reject pi_netrw.jax /*g:netrw_ftp_browse_reject* +g:netrw_ftp_cmd pi_netrw.jax /*g:netrw_ftp_cmd* +g:netrw_ftp_list_cmd pi_netrw.jax /*g:netrw_ftp_list_cmd* +g:netrw_ftp_options pi_netrw.jax /*g:netrw_ftp_options* +g:netrw_ftp_sizelist_cmd pi_netrw.jax /*g:netrw_ftp_sizelist_cmd* +g:netrw_ftp_timelist_cmd pi_netrw.jax /*g:netrw_ftp_timelist_cmd* +g:netrw_ftpextracmd pi_netrw.jax /*g:netrw_ftpextracmd* +g:netrw_ftpmode pi_netrw.jax /*g:netrw_ftpmode* +g:netrw_glob_escape pi_netrw.jax /*g:netrw_glob_escape* +g:netrw_gx pi_netrw.jax /*g:netrw_gx* +g:netrw_hide pi_netrw.jax /*g:netrw_hide* +g:netrw_home pi_netrw.jax /*g:netrw_home* +g:netrw_http_cmd pi_netrw.jax /*g:netrw_http_cmd* +g:netrw_http_put_cmd pi_netrw.jax /*g:netrw_http_put_cmd* +g:netrw_http_xcmd pi_netrw.jax /*g:netrw_http_xcmd* +g:netrw_ignorenetrc pi_netrw.jax /*g:netrw_ignorenetrc* +g:netrw_keepdir pi_netrw.jax /*g:netrw_keepdir* +g:netrw_keepj pi_netrw.jax /*g:netrw_keepj* +g:netrw_list_cmd pi_netrw.jax /*g:netrw_list_cmd* +g:netrw_list_cmd_options pi_netrw.jax /*g:netrw_list_cmd_options* +g:netrw_list_hide pi_netrw.jax /*g:netrw_list_hide* +g:netrw_liststyle pi_netrw.jax /*g:netrw_liststyle* +g:netrw_localcopycmd pi_netrw.jax /*g:netrw_localcopycmd* +g:netrw_localcopydircmd pi_netrw.jax /*g:netrw_localcopydircmd* +g:netrw_localmkdir pi_netrw.jax /*g:netrw_localmkdir* +g:netrw_localmovecmd pi_netrw.jax /*g:netrw_localmovecmd* +g:netrw_localrmdir pi_netrw.jax /*g:netrw_localrmdir* +g:netrw_maxfilenamelen pi_netrw.jax /*g:netrw_maxfilenamelen* +g:netrw_menu pi_netrw.jax /*g:netrw_menu* +g:netrw_mkdir_cmd pi_netrw.jax /*g:netrw_mkdir_cmd* +g:netrw_mousemaps pi_netrw.jax /*g:netrw_mousemaps* +g:netrw_nobeval pi_netrw.jax /*g:netrw_nobeval* +g:netrw_nogx pi_netrw.jax /*g:netrw_nogx* +g:netrw_preview pi_netrw.jax /*g:netrw_preview* +g:netrw_rcp_cmd pi_netrw.jax /*g:netrw_rcp_cmd* +g:netrw_remote_mkdir pi_netrw.jax /*g:netrw_remote_mkdir* +g:netrw_retmap pi_netrw.jax /*g:netrw_retmap* +g:netrw_rm_cmd pi_netrw.jax /*g:netrw_rm_cmd* +g:netrw_rmdir_cmd pi_netrw.jax /*g:netrw_rmdir_cmd* +g:netrw_rmf_cmd pi_netrw.jax /*g:netrw_rmf_cmd* +g:netrw_rsync_cmd pi_netrw.jax /*g:netrw_rsync_cmd* +g:netrw_scp_cmd pi_netrw.jax /*g:netrw_scp_cmd* +g:netrw_scpport pi_netrw.jax /*g:netrw_scpport* +g:netrw_sepchr pi_netrw.jax /*g:netrw_sepchr* +g:netrw_servername pi_netrw.jax /*g:netrw_servername* +g:netrw_sftp_cmd pi_netrw.jax /*g:netrw_sftp_cmd* +g:netrw_silent pi_netrw.jax /*g:netrw_silent* +g:netrw_sizestyle pi_netrw.jax /*g:netrw_sizestyle* +g:netrw_sort_by pi_netrw.jax /*g:netrw_sort_by* +g:netrw_sort_direction pi_netrw.jax /*g:netrw_sort_direction* +g:netrw_sort_options pi_netrw.jax /*g:netrw_sort_options* +g:netrw_sort_sequence pi_netrw.jax /*g:netrw_sort_sequence* +g:netrw_special_syntax pi_netrw.jax /*g:netrw_special_syntax* +g:netrw_ssh_browse_reject pi_netrw.jax /*g:netrw_ssh_browse_reject* +g:netrw_ssh_cmd pi_netrw.jax /*g:netrw_ssh_cmd* +g:netrw_sshport pi_netrw.jax /*g:netrw_sshport* +g:netrw_suppress_gx_mesg pi_netrw.jax /*g:netrw_suppress_gx_mesg* +g:netrw_timefmt pi_netrw.jax /*g:netrw_timefmt* +g:netrw_tmpfile_escape pi_netrw.jax /*g:netrw_tmpfile_escape* +g:netrw_uid pi_netrw.jax /*g:netrw_uid* +g:netrw_use_errorwindow pi_netrw.jax /*g:netrw_use_errorwindow* +g:netrw_use_noswf pi_netrw.jax /*g:netrw_use_noswf* +g:netrw_use_nt_rcp pi_netrw.jax /*g:netrw_use_nt_rcp* +g:netrw_usetab pi_netrw.jax /*g:netrw_usetab* +g:netrw_win95ftp pi_netrw.jax /*g:netrw_win95ftp* +g:netrw_winsize pi_netrw.jax /*g:netrw_winsize* +g:netrw_wiw pi_netrw.jax /*g:netrw_wiw* +g:netrw_xstrlen pi_netrw.jax /*g:netrw_xstrlen* +g:syntax_on syntax.jax /*g:syntax_on* +g:tar_browseoptions pi_tar.jax /*g:tar_browseoptions* +g:tar_cmd pi_tar.jax /*g:tar_cmd* +g:tar_copycmd pi_tar.jax /*g:tar_copycmd* +g:tar_extractcmd pi_tar.jax /*g:tar_extractcmd* +g:tar_nomax pi_tar.jax /*g:tar_nomax* +g:tar_readoptions pi_tar.jax /*g:tar_readoptions* +g:tar_secure pi_tar.jax /*g:tar_secure* +g:tar_writeoptions pi_tar.jax /*g:tar_writeoptions* +g:tex_comment_nospell syntax.jax /*g:tex_comment_nospell* +g:tex_conceal syntax.jax /*g:tex_conceal* +g:tex_fast syntax.jax /*g:tex_fast* +g:tex_flavor filetype.jax /*g:tex_flavor* +g:tex_fold_enabled syntax.jax /*g:tex_fold_enabled* +g:tex_isk syntax.jax /*g:tex_isk* +g:tex_no_error syntax.jax /*g:tex_no_error* +g:tex_nospell syntax.jax /*g:tex_nospell* +g:tex_stylish syntax.jax /*g:tex_stylish* +g:tex_subscripts syntax.jax /*g:tex_subscripts* +g:tex_superscripts syntax.jax /*g:tex_superscripts* +g:tex_verbspell syntax.jax /*g:tex_verbspell* +g:var eval.jax /*g:var* +g:vimball_home pi_vimball.jax /*g:vimball_home* +g:vimball_mkdir pi_vimball.jax /*g:vimball_mkdir* +g:vimsyn_embed syntax.jax /*g:vimsyn_embed* +g:vimsyn_folding syntax.jax /*g:vimsyn_folding* +g:vimsyn_maxlines syntax.jax /*g:vimsyn_maxlines* +g:vimsyn_minlines syntax.jax /*g:vimsyn_minlines* +g:vimsyn_noerror syntax.jax /*g:vimsyn_noerror* +g:yaml_schema syntax.jax /*g:yaml_schema* +g:zipPlugin_ext pi_zip.jax /*g:zipPlugin_ext* +g:zip_extractcmd pi_zip.jax /*g:zip_extractcmd* +g:zip_nomax pi_zip.jax /*g:zip_nomax* +g:zip_shq pi_zip.jax /*g:zip_shq* +g:zip_unzipcmd pi_zip.jax /*g:zip_unzipcmd* +g:zip_zipcmd pi_zip.jax /*g:zip_zipcmd* +g; motion.jax /*g;* +g< message.jax /*g<* +g<Down> motion.jax /*g<Down>* +g<End> motion.jax /*g<End>* +g<Home> motion.jax /*g<Home>* +g<LeftMouse> tagsrch.jax /*g<LeftMouse>* +g<RightMouse> tagsrch.jax /*g<RightMouse>* +g<Up> motion.jax /*g<Up>* +g? change.jax /*g?* +g?? change.jax /*g??* +g?g? change.jax /*g?g?* +g@ map.jax /*g@* +gD pattern.jax /*gD* +gE motion.jax /*gE* +gF editing.jax /*gF* +gH visual.jax /*gH* +gI insert.jax /*gI* +gJ change.jax /*gJ* +gN visual.jax /*gN* +gP change.jax /*gP* +gQ intro.jax /*gQ* +gR change.jax /*gR* +gT tabpage.jax /*gT* +gU change.jax /*gU* +gUU change.jax /*gUU* +gUgU change.jax /*gUgU* +gV visual.jax /*gV* +g] tagsrch.jax /*g]* +g^ motion.jax /*g^* +g_ motion.jax /*g_* +g_CTRL-A various.jax /*g_CTRL-A* +g_CTRL-G editing.jax /*g_CTRL-G* +g_CTRL-H visual.jax /*g_CTRL-H* +g_CTRL-] tagsrch.jax /*g_CTRL-]* +g` motion.jax /*g`* +g`a motion.jax /*g`a* +ga various.jax /*ga* +garbagecollect() eval.jax /*garbagecollect()* +gd pattern.jax /*gd* +gdb debug.jax /*gdb* +ge motion.jax /*ge* +get() eval.jax /*get()* +get-ms-debuggers debug.jax /*get-ms-debuggers* +getbufinfo() eval.jax /*getbufinfo()* +getbufline() eval.jax /*getbufline()* +getbufvar() eval.jax /*getbufvar()* +getchar() eval.jax /*getchar()* +getcharmod() eval.jax /*getcharmod()* +getcharsearch() eval.jax /*getcharsearch()* +getcmdline() eval.jax /*getcmdline()* +getcmdpos() eval.jax /*getcmdpos()* +getcmdtype() eval.jax /*getcmdtype()* +getcmdwintype() eval.jax /*getcmdwintype()* +getcompletion() eval.jax /*getcompletion()* +getcurpos() eval.jax /*getcurpos()* +getcwd() eval.jax /*getcwd()* +getfontname() eval.jax /*getfontname()* +getfperm() eval.jax /*getfperm()* +getfsize() eval.jax /*getfsize()* +getftime() eval.jax /*getftime()* +getftype() eval.jax /*getftype()* +getlatestvimscripts-install pi_getscript.jax /*getlatestvimscripts-install* +getline() eval.jax /*getline()* +getloclist() eval.jax /*getloclist()* +getmatches() eval.jax /*getmatches()* +getpid() eval.jax /*getpid()* +getpos() eval.jax /*getpos()* +getqflist() eval.jax /*getqflist()* +getreg() eval.jax /*getreg()* +getregtype() eval.jax /*getregtype()* +getscript pi_getscript.jax /*getscript* +getscript-autoinstall pi_getscript.jax /*getscript-autoinstall* +getscript-data pi_getscript.jax /*getscript-data* +getscript-history pi_getscript.jax /*getscript-history* +getscript-plugins pi_getscript.jax /*getscript-plugins* +getscript-start pi_getscript.jax /*getscript-start* +gettabinfo() eval.jax /*gettabinfo()* +gettabvar() eval.jax /*gettabvar()* +gettabwinvar() eval.jax /*gettabwinvar()* +getwininfo() eval.jax /*getwininfo()* +getwinposx() eval.jax /*getwinposx()* +getwinposy() eval.jax /*getwinposy()* +getwinvar() eval.jax /*getwinvar()* +gex starting.jax /*gex* +gf editing.jax /*gf* +gg motion.jax /*gg* +gh visual.jax /*gh* +gi insert.jax /*gi* +gj motion.jax /*gj* +gk motion.jax /*gk* +glob() eval.jax /*glob()* +glob2regpat() eval.jax /*glob2regpat()* +global-ime mbyte.jax /*global-ime* +global-local options.jax /*global-local* +global-variable eval.jax /*global-variable* +global_markfilelist pi_netrw.jax /*global_markfilelist* +globpath() eval.jax /*globpath()* +glvs pi_getscript.jax /*glvs* +glvs-alg pi_getscript.jax /*glvs-alg* +glvs-algorithm pi_getscript.jax /*glvs-algorithm* +glvs-autoinstall pi_getscript.jax /*glvs-autoinstall* +glvs-contents pi_getscript.jax /*glvs-contents* +glvs-copyright pi_getscript.jax /*glvs-copyright* +glvs-data pi_getscript.jax /*glvs-data* +glvs-dist-install pi_getscript.jax /*glvs-dist-install* +glvs-hist pi_getscript.jax /*glvs-hist* +glvs-install pi_getscript.jax /*glvs-install* +glvs-options pi_getscript.jax /*glvs-options* +glvs-plugins pi_getscript.jax /*glvs-plugins* +glvs-usage pi_getscript.jax /*glvs-usage* +gm motion.jax /*gm* +gn visual.jax /*gn* +gnat#Insert_Tags_Header() ft_ada.jax /*gnat#Insert_Tags_Header()* +gnat#New() ft_ada.jax /*gnat#New()* +gnat-xref ft_ada.jax /*gnat-xref* +gnat_members ft_ada.jax /*gnat_members* +gnome-session gui_x11.jax /*gnome-session* +go motion.jax /*go* +gp change.jax /*gp* +gpm-mouse term.jax /*gpm-mouse* +gq change.jax /*gq* +gqap change.jax /*gqap* +gqgq change.jax /*gqgq* +gqq change.jax /*gqq* +gr change.jax /*gr* +graphic-option-gone version4.jax /*graphic-option-gone* +greek options.jax /*greek* +grep quickfix.jax /*grep* +groff.vim syntax.jax /*groff.vim* +gross-national-happiness intro.jax /*gross-national-happiness* +group-name syntax.jax /*group-name* +gs various.jax /*gs* +gsp.vim syntax.jax /*gsp.vim* +gstar pattern.jax /*gstar* +gt tabpage.jax /*gt* +gtk-tooltip-colors gui_x11.jax /*gtk-tooltip-colors* +gu change.jax /*gu* +gugu change.jax /*gugu* +gui gui.jax /*gui* +gui-IME gui.jax /*gui-IME* +gui-clipboard gui_w32.jax /*gui-clipboard* +gui-colors syntax.jax /*gui-colors* +gui-extras gui.jax /*gui-extras* +gui-footer debugger.jax /*gui-footer* +gui-fork gui_x11.jax /*gui-fork* +gui-functions usr_41.jax /*gui-functions* +gui-gnome gui_x11.jax /*gui-gnome* +gui-gnome-session gui_x11.jax /*gui-gnome-session* +gui-gtk gui_x11.jax /*gui-gtk* +gui-gtk-socketid gui_x11.jax /*gui-gtk-socketid* +gui-horiz-scroll gui.jax /*gui-horiz-scroll* +gui-init gui.jax /*gui-init* +gui-kde gui_x11.jax /*gui-kde* +gui-mouse gui.jax /*gui-mouse* +gui-mouse-focus gui.jax /*gui-mouse-focus* +gui-mouse-mapping gui.jax /*gui-mouse-mapping* +gui-mouse-modeless gui.jax /*gui-mouse-modeless* +gui-mouse-move gui.jax /*gui-mouse-move* +gui-mouse-select gui.jax /*gui-mouse-select* +gui-mouse-status gui.jax /*gui-mouse-status* +gui-mouse-various gui.jax /*gui-mouse-various* +gui-pty gui_x11.jax /*gui-pty* +gui-pty-erase gui_x11.jax /*gui-pty-erase* +gui-resources gui_x11.jax /*gui-resources* +gui-scrollbars gui.jax /*gui-scrollbars* +gui-selections gui.jax /*gui-selections* +gui-shell gui.jax /*gui-shell* +gui-shell-win32 gui_w32.jax /*gui-shell-win32* +gui-start gui.jax /*gui-start* +gui-toolbar gui.jax /*gui-toolbar* +gui-vert-scroll gui.jax /*gui-vert-scroll* +gui-w32 gui_w32.jax /*gui-w32* +gui-w32-cmdargs gui_w32.jax /*gui-w32-cmdargs* +gui-w32-dialogs gui_w32.jax /*gui-w32-dialogs* +gui-w32-printing gui_w32.jax /*gui-w32-printing* +gui-w32-start gui_w32.jax /*gui-w32-start* +gui-w32-various gui_w32.jax /*gui-w32-various* +gui-w32-windowid gui_w32.jax /*gui-w32-windowid* +gui-w32s os_win32.jax /*gui-w32s* +gui-win32-maximized gui_w32.jax /*gui-win32-maximized* +gui-x11 gui_x11.jax /*gui-x11* +gui-x11-athena gui_x11.jax /*gui-x11-athena* +gui-x11-compiling gui_x11.jax /*gui-x11-compiling* +gui-x11-gtk gui_x11.jax /*gui-x11-gtk* +gui-x11-kde gui_x11.jax /*gui-x11-kde* +gui-x11-misc gui_x11.jax /*gui-x11-misc* +gui-x11-motif gui_x11.jax /*gui-x11-motif* +gui-x11-neXtaw gui_x11.jax /*gui-x11-neXtaw* +gui-x11-printing gui_x11.jax /*gui-x11-printing* +gui-x11-start gui_x11.jax /*gui-x11-start* +gui-x11-various gui_x11.jax /*gui-x11-various* +gui.txt gui.jax /*gui.txt* +gui_w32.txt gui_w32.jax /*gui_w32.txt* +gui_x11.txt gui_x11.jax /*gui_x11.txt* +guifontwide_gtk options.jax /*guifontwide_gtk* +guifontwide_win_mbyte options.jax /*guifontwide_win_mbyte* +guioptions_a options.jax /*guioptions_a* +guu change.jax /*guu* +gv visual.jax /*gv* +gview starting.jax /*gview* +gvim starting.jax /*gvim* +gvimdiff diff.jax /*gvimdiff* +gvimrc gui.jax /*gvimrc* +gw change.jax /*gw* +gwgw change.jax /*gwgw* +gww change.jax /*gww* +gzip pi_gzip.jax /*gzip* +gzip-autocmd pi_gzip.jax /*gzip-autocmd* +gzip-example autocmd.jax /*gzip-example* +gzip-helpfile tips.jax /*gzip-helpfile* +g~ change.jax /*g~* +g~g~ change.jax /*g~g~* +g~~ change.jax /*g~~* +h motion.jax /*h* +hangul hangulin.jax /*hangul* +hangulin.txt hangulin.jax /*hangulin.txt* +has() eval.jax /*has()* +has-patch eval.jax /*has-patch* +has-python if_pyth.jax /*has-python* +has-pythonx if_pyth.jax /*has-pythonx* +has_key() eval.jax /*has_key()* +haskell.vim syntax.jax /*haskell.vim* +haslocaldir() eval.jax /*haslocaldir()* +hasmapto() eval.jax /*hasmapto()* +help helphelp.jax /*help* +help-context help.jax /*help-context* +help-summary usr_02.jax /*help-summary* +help-translated helphelp.jax /*help-translated* +help-writing helphelp.jax /*help-writing* +help-xterm-window helphelp.jax /*help-xterm-window* +help.txt help.jax /*help.txt* +helpfile_name.txt helphelp.jax /*helpfile_name.txt* +helphelp helphelp.jax /*helphelp* +helphelp.txt helphelp.jax /*helphelp.txt* +hex-editing tips.jax /*hex-editing* +hex-number eval.jax /*hex-number* +hidden-buffer windows.jax /*hidden-buffer* +hidden-menus gui.jax /*hidden-menus* +hidden-options options.jax /*hidden-options* +hidden-quit windows.jax /*hidden-quit* +highlight-args syntax.jax /*highlight-args* +highlight-changed version4.jax /*highlight-changed* +highlight-cterm syntax.jax /*highlight-cterm* +highlight-ctermbg syntax.jax /*highlight-ctermbg* +highlight-ctermfg syntax.jax /*highlight-ctermfg* +highlight-default syntax.jax /*highlight-default* +highlight-font syntax.jax /*highlight-font* +highlight-groups syntax.jax /*highlight-groups* +highlight-gui syntax.jax /*highlight-gui* +highlight-guibg syntax.jax /*highlight-guibg* +highlight-guifg syntax.jax /*highlight-guifg* +highlight-guisp syntax.jax /*highlight-guisp* +highlight-start syntax.jax /*highlight-start* +highlight-stop syntax.jax /*highlight-stop* +highlight-term syntax.jax /*highlight-term* +highlightID() eval.jax /*highlightID()* +highlight_exists() eval.jax /*highlight_exists()* +highlighting-functions usr_41.jax /*highlighting-functions* +hist-names eval.jax /*hist-names* +histadd() eval.jax /*histadd()* +histdel() eval.jax /*histdel()* +histget() eval.jax /*histget()* +histnr() eval.jax /*histnr()* +history cmdline.jax /*history* +history-functions usr_41.jax /*history-functions* +hit-enter message.jax /*hit-enter* +hit-enter-prompt message.jax /*hit-enter-prompt* +hit-return message.jax /*hit-return* +hitest.vim syntax.jax /*hitest.vim* +hjkl usr_02.jax /*hjkl* +hl-ColorColumn syntax.jax /*hl-ColorColumn* +hl-Conceal syntax.jax /*hl-Conceal* +hl-Cursor syntax.jax /*hl-Cursor* +hl-CursorColumn syntax.jax /*hl-CursorColumn* +hl-CursorIM syntax.jax /*hl-CursorIM* +hl-CursorLine syntax.jax /*hl-CursorLine* +hl-CursorLineNr syntax.jax /*hl-CursorLineNr* +hl-DiffAdd syntax.jax /*hl-DiffAdd* +hl-DiffChange syntax.jax /*hl-DiffChange* +hl-DiffDelete syntax.jax /*hl-DiffDelete* +hl-DiffText syntax.jax /*hl-DiffText* +hl-Directory syntax.jax /*hl-Directory* +hl-EndOfBuffer syntax.jax /*hl-EndOfBuffer* +hl-ErrorMsg syntax.jax /*hl-ErrorMsg* +hl-FoldColumn syntax.jax /*hl-FoldColumn* +hl-Folded syntax.jax /*hl-Folded* +hl-Ignore syntax.jax /*hl-Ignore* +hl-IncSearch syntax.jax /*hl-IncSearch* +hl-LineNr syntax.jax /*hl-LineNr* +hl-MatchParen syntax.jax /*hl-MatchParen* +hl-Menu syntax.jax /*hl-Menu* +hl-ModeMsg syntax.jax /*hl-ModeMsg* +hl-MoreMsg syntax.jax /*hl-MoreMsg* +hl-NonText syntax.jax /*hl-NonText* +hl-Normal syntax.jax /*hl-Normal* +hl-Pmenu syntax.jax /*hl-Pmenu* +hl-PmenuSbar syntax.jax /*hl-PmenuSbar* +hl-PmenuSel syntax.jax /*hl-PmenuSel* +hl-PmenuThumb syntax.jax /*hl-PmenuThumb* +hl-Question syntax.jax /*hl-Question* +hl-Scrollbar syntax.jax /*hl-Scrollbar* +hl-Search syntax.jax /*hl-Search* +hl-SignColumn syntax.jax /*hl-SignColumn* +hl-SpecialKey syntax.jax /*hl-SpecialKey* +hl-SpellBad syntax.jax /*hl-SpellBad* +hl-SpellCap syntax.jax /*hl-SpellCap* +hl-SpellLocal syntax.jax /*hl-SpellLocal* +hl-SpellRare syntax.jax /*hl-SpellRare* +hl-StatusLine syntax.jax /*hl-StatusLine* +hl-StatusLineNC syntax.jax /*hl-StatusLineNC* +hl-TabLine syntax.jax /*hl-TabLine* +hl-TabLineFill syntax.jax /*hl-TabLineFill* +hl-TabLineSel syntax.jax /*hl-TabLineSel* +hl-Title syntax.jax /*hl-Title* +hl-Tooltip syntax.jax /*hl-Tooltip* +hl-User1 syntax.jax /*hl-User1* +hl-User1..9 syntax.jax /*hl-User1..9* +hl-User9 syntax.jax /*hl-User9* +hl-VertSplit syntax.jax /*hl-VertSplit* +hl-Visual syntax.jax /*hl-Visual* +hl-VisualNOS syntax.jax /*hl-VisualNOS* +hl-WarningMsg syntax.jax /*hl-WarningMsg* +hl-WildMenu syntax.jax /*hl-WildMenu* +hlID() eval.jax /*hlID()* +hlexists() eval.jax /*hlexists()* +hlsearch-variable eval.jax /*hlsearch-variable* +holy-grail index.jax /*holy-grail* +home intro.jax /*home* +home-replace editing.jax /*home-replace* +hostname() eval.jax /*hostname()* +how-do-i howto.jax /*how-do-i* +how-to howto.jax /*how-to* +howdoi howto.jax /*howdoi* +howto howto.jax /*howto* +howto.txt howto.jax /*howto.txt* +hpterm term.jax /*hpterm* +hpterm-color syntax.jax /*hpterm-color* +html-flavor insert.jax /*html-flavor* +html-indent indent.jax /*html-indent* +html-indenting indent.jax /*html-indenting* +html.vim syntax.jax /*html.vim* +htmlos.vim syntax.jax /*htmlos.vim* +http pi_netrw.jax /*http* +i insert.jax /*i* +i' motion.jax /*i'* +i( motion.jax /*i(* +i) motion.jax /*i)* +i< motion.jax /*i<* +i> motion.jax /*i>* +iB motion.jax /*iB* +iBus gui.jax /*iBus* +iW motion.jax /*iW* +i[ motion.jax /*i[* +i] motion.jax /*i]* +i_0_CTRL-D insert.jax /*i_0_CTRL-D* +i_<BS> insert.jax /*i_<BS>* +i_<C-End> insert.jax /*i_<C-End>* +i_<C-Home> insert.jax /*i_<C-Home>* +i_<C-Left> insert.jax /*i_<C-Left>* +i_<C-PageDown> tabpage.jax /*i_<C-PageDown>* +i_<C-PageUp> tabpage.jax /*i_<C-PageUp>* +i_<C-Right> insert.jax /*i_<C-Right>* +i_<CR> insert.jax /*i_<CR>* +i_<Del> insert.jax /*i_<Del>* +i_<Down> insert.jax /*i_<Down>* +i_<End> insert.jax /*i_<End>* +i_<Esc> insert.jax /*i_<Esc>* +i_<F1> helphelp.jax /*i_<F1>* +i_<Help> helphelp.jax /*i_<Help>* +i_<Home> insert.jax /*i_<Home>* +i_<Insert> insert.jax /*i_<Insert>* +i_<Left> insert.jax /*i_<Left>* +i_<LeftMouse> insert.jax /*i_<LeftMouse>* +i_<NL> insert.jax /*i_<NL>* +i_<PageDown> insert.jax /*i_<PageDown>* +i_<PageUp> insert.jax /*i_<PageUp>* +i_<Right> insert.jax /*i_<Right>* +i_<S-Down> insert.jax /*i_<S-Down>* +i_<S-Left> insert.jax /*i_<S-Left>* +i_<S-Right> insert.jax /*i_<S-Right>* +i_<S-ScrollWheelDown> insert.jax /*i_<S-ScrollWheelDown>* +i_<S-ScrollWheelLeft> insert.jax /*i_<S-ScrollWheelLeft>* +i_<S-ScrollWheelRight> insert.jax /*i_<S-ScrollWheelRight>* +i_<S-ScrollWheelUp> insert.jax /*i_<S-ScrollWheelUp>* +i_<S-Up> insert.jax /*i_<S-Up>* +i_<ScrollWheelDown> insert.jax /*i_<ScrollWheelDown>* +i_<ScrollWheelLeft> insert.jax /*i_<ScrollWheelLeft>* +i_<ScrollWheelRight> insert.jax /*i_<ScrollWheelRight>* +i_<ScrollWheelUp> insert.jax /*i_<ScrollWheelUp>* +i_<Tab> insert.jax /*i_<Tab>* +i_<Up> insert.jax /*i_<Up>* +i_BS insert.jax /*i_BS* +i_CTRL-<PageDown> tabpage.jax /*i_CTRL-<PageDown>* +i_CTRL-<PageUp> tabpage.jax /*i_CTRL-<PageUp>* +i_CTRL-@ insert.jax /*i_CTRL-@* +i_CTRL-A insert.jax /*i_CTRL-A* +i_CTRL-C insert.jax /*i_CTRL-C* +i_CTRL-D insert.jax /*i_CTRL-D* +i_CTRL-E insert.jax /*i_CTRL-E* +i_CTRL-F indent.jax /*i_CTRL-F* +i_CTRL-G_<Down> insert.jax /*i_CTRL-G_<Down>* +i_CTRL-G_<Up> insert.jax /*i_CTRL-G_<Up>* +i_CTRL-G_CTRL-J insert.jax /*i_CTRL-G_CTRL-J* +i_CTRL-G_CTRL-K insert.jax /*i_CTRL-G_CTRL-K* +i_CTRL-G_U insert.jax /*i_CTRL-G_U* +i_CTRL-G_j insert.jax /*i_CTRL-G_j* +i_CTRL-G_k insert.jax /*i_CTRL-G_k* +i_CTRL-G_u insert.jax /*i_CTRL-G_u* +i_CTRL-H insert.jax /*i_CTRL-H* +i_CTRL-I insert.jax /*i_CTRL-I* +i_CTRL-J insert.jax /*i_CTRL-J* +i_CTRL-K insert.jax /*i_CTRL-K* +i_CTRL-L insert.jax /*i_CTRL-L* +i_CTRL-M insert.jax /*i_CTRL-M* +i_CTRL-N insert.jax /*i_CTRL-N* +i_CTRL-O insert.jax /*i_CTRL-O* +i_CTRL-P insert.jax /*i_CTRL-P* +i_CTRL-Q insert.jax /*i_CTRL-Q* +i_CTRL-R insert.jax /*i_CTRL-R* +i_CTRL-R_= insert.jax /*i_CTRL-R_=* +i_CTRL-R_CTRL-O insert.jax /*i_CTRL-R_CTRL-O* +i_CTRL-R_CTRL-P insert.jax /*i_CTRL-R_CTRL-P* +i_CTRL-R_CTRL-R insert.jax /*i_CTRL-R_CTRL-R* +i_CTRL-T insert.jax /*i_CTRL-T* +i_CTRL-U insert.jax /*i_CTRL-U* +i_CTRL-V insert.jax /*i_CTRL-V* +i_CTRL-V_digit insert.jax /*i_CTRL-V_digit* +i_CTRL-W insert.jax /*i_CTRL-W* +i_CTRL-X insert.jax /*i_CTRL-X* +i_CTRL-X_CTRL-D insert.jax /*i_CTRL-X_CTRL-D* +i_CTRL-X_CTRL-E insert.jax /*i_CTRL-X_CTRL-E* +i_CTRL-X_CTRL-F insert.jax /*i_CTRL-X_CTRL-F* +i_CTRL-X_CTRL-I insert.jax /*i_CTRL-X_CTRL-I* +i_CTRL-X_CTRL-K insert.jax /*i_CTRL-X_CTRL-K* +i_CTRL-X_CTRL-L insert.jax /*i_CTRL-X_CTRL-L* +i_CTRL-X_CTRL-N insert.jax /*i_CTRL-X_CTRL-N* +i_CTRL-X_CTRL-O insert.jax /*i_CTRL-X_CTRL-O* +i_CTRL-X_CTRL-P insert.jax /*i_CTRL-X_CTRL-P* +i_CTRL-X_CTRL-S insert.jax /*i_CTRL-X_CTRL-S* +i_CTRL-X_CTRL-T insert.jax /*i_CTRL-X_CTRL-T* +i_CTRL-X_CTRL-U insert.jax /*i_CTRL-X_CTRL-U* +i_CTRL-X_CTRL-V insert.jax /*i_CTRL-X_CTRL-V* +i_CTRL-X_CTRL-Y insert.jax /*i_CTRL-X_CTRL-Y* +i_CTRL-X_CTRL-] insert.jax /*i_CTRL-X_CTRL-]* +i_CTRL-X_index index.jax /*i_CTRL-X_index* +i_CTRL-X_s insert.jax /*i_CTRL-X_s* +i_CTRL-Y insert.jax /*i_CTRL-Y* +i_CTRL-Z options.jax /*i_CTRL-Z* +i_CTRL-[ insert.jax /*i_CTRL-[* +i_CTRL-\_CTRL-G intro.jax /*i_CTRL-\\_CTRL-G* +i_CTRL-\_CTRL-N intro.jax /*i_CTRL-\\_CTRL-N* +i_CTRL-\_CTRL-O insert.jax /*i_CTRL-\\_CTRL-O* +i_CTRL-] insert.jax /*i_CTRL-]* +i_CTRL-^ insert.jax /*i_CTRL-^* +i_CTRL-_ insert.jax /*i_CTRL-_* +i_DEL insert.jax /*i_DEL* +i_Tab insert.jax /*i_Tab* +i_^_CTRL-D insert.jax /*i_^_CTRL-D* +i_backspacing insert.jax /*i_backspacing* +i_digraph digraph.jax /*i_digraph* +i_esc intro.jax /*i_esc* +i` motion.jax /*i`* +ia64.vim syntax.jax /*ia64.vim* +ib motion.jax /*ib* +iccf uganda.jax /*iccf* +iccf-donations uganda.jax /*iccf-donations* +icon-changed version4.jax /*icon-changed* +iconise starting.jax /*iconise* +iconize starting.jax /*iconize* +iconv() eval.jax /*iconv()* +iconv-dynamic mbyte.jax /*iconv-dynamic* +ident-search tips.jax /*ident-search* +idl-syntax syntax.jax /*idl-syntax* +idl.vim syntax.jax /*idl.vim* +if_cscop.txt if_cscop.jax /*if_cscop.txt* +if_lua.txt if_lua.jax /*if_lua.txt* +if_mzsch.txt if_mzsch.jax /*if_mzsch.txt* +if_ole.txt if_ole.jax /*if_ole.txt* +if_perl.txt if_perl.jax /*if_perl.txt* +if_pyth.txt if_pyth.jax /*if_pyth.txt* +if_ruby.txt if_ruby.jax /*if_ruby.txt* +if_sniff.txt if_sniff.jax /*if_sniff.txt* +if_tcl.txt if_tcl.jax /*if_tcl.txt* +ignore-errors eval.jax /*ignore-errors* +improvements-8 version8.jax /*improvements-8* +in_bot channel.jax /*in_bot* +in_buf channel.jax /*in_buf* +in_io-buffer channel.jax /*in_io-buffer* +in_mode channel.jax /*in_mode* +in_name channel.jax /*in_name* +in_top channel.jax /*in_top* +inactive-buffer windows.jax /*inactive-buffer* +include-search tagsrch.jax /*include-search* +inclusive motion.jax /*inclusive* +incompatible-8 version8.jax /*incompatible-8* +indent() eval.jax /*indent()* +indent-expression indent.jax /*indent-expression* +indent.txt indent.jax /*indent.txt* +indentkeys-format indent.jax /*indentkeys-format* +index index.jax /*index* +index() eval.jax /*index()* +index.txt index.jax /*index.txt* +info-message starting.jax /*info-message* +inform.vim syntax.jax /*inform.vim* +informix ft_sql.jax /*informix* +initialization starting.jax /*initialization* +input() eval.jax /*input()* +inputdialog() eval.jax /*inputdialog()* +inputlist() eval.jax /*inputlist()* +inputrestore() eval.jax /*inputrestore()* +inputsave() eval.jax /*inputsave()* +inputsecret() eval.jax /*inputsecret()* +ins-completion insert.jax /*ins-completion* +ins-completion-menu insert.jax /*ins-completion-menu* +ins-expandtab insert.jax /*ins-expandtab* +ins-reverse rileft.jax /*ins-reverse* +ins-smarttab insert.jax /*ins-smarttab* +ins-softtabstop insert.jax /*ins-softtabstop* +ins-special-keys insert.jax /*ins-special-keys* +ins-special-special insert.jax /*ins-special-special* +ins-textwidth insert.jax /*ins-textwidth* +insert insert.jax /*insert* +insert() eval.jax /*insert()* +insert-index index.jax /*insert-index* +insert.txt insert.jax /*insert.txt* +insert_expand insert.jax /*insert_expand* +inserting insert.jax /*inserting* +inserting-ex insert.jax /*inserting-ex* +inserting-file insert.jax /*inserting-file* +insertmode-variable eval.jax /*insertmode-variable* +install usr_90.jax /*install* +install-home usr_90.jax /*install-home* +install-registry gui_w32.jax /*install-registry* +intel-itanium syntax.jax /*intel-itanium* +intellimouse-wheel-problems gui_w32.jax /*intellimouse-wheel-problems* +interactive-functions usr_41.jax /*interactive-functions* +internal-variables eval.jax /*internal-variables* +internal-wordlist spell.jax /*internal-wordlist* +internet intro.jax /*internet* +intro intro.jax /*intro* +intro.txt intro.jax /*intro.txt* +inverse syntax.jax /*inverse* +invert() eval.jax /*invert()* +ip motion.jax /*ip* +iquote motion.jax /*iquote* +is motion.jax /*is* +isdirectory() eval.jax /*isdirectory()* +islocked() eval.jax /*islocked()* +isnan() eval.jax /*isnan()* +it motion.jax /*it* +italic syntax.jax /*italic* +items() eval.jax /*items()* +iw motion.jax /*iw* +i{ motion.jax /*i{* +i} motion.jax /*i}* +j motion.jax /*j* +java-cinoptions indent.jax /*java-cinoptions* +java-indenting indent.jax /*java-indenting* +java.vim syntax.jax /*java.vim* +javascript-cinoptions indent.jax /*javascript-cinoptions* +javascript-indenting indent.jax /*javascript-indenting* +job channel.jax /*job* +job-callback channel.jax /*job-callback* +job-channel-overview channel.jax /*job-channel-overview* +job-close_cb channel.jax /*job-close_cb* +job-control channel.jax /*job-control* +job-drop channel.jax /*job-drop* +job-err_cb channel.jax /*job-err_cb* +job-err_io channel.jax /*job-err_io* +job-exit_cb channel.jax /*job-exit_cb* +job-functions usr_41.jax /*job-functions* +job-in_io channel.jax /*job-in_io* +job-options channel.jax /*job-options* +job-out_cb channel.jax /*job-out_cb* +job-out_io channel.jax /*job-out_io* +job-start channel.jax /*job-start* +job-start-if-needed channel.jax /*job-start-if-needed* +job-start-nochannel channel.jax /*job-start-nochannel* +job-stoponexit channel.jax /*job-stoponexit* +job-term channel.jax /*job-term* +job-timeout channel.jax /*job-timeout* +job_getchannel() eval.jax /*job_getchannel()* +job_info() eval.jax /*job_info()* +job_setoptions() eval.jax /*job_setoptions()* +job_start() eval.jax /*job_start()* +job_status() eval.jax /*job_status()* +job_stop() eval.jax /*job_stop()* +join() eval.jax /*join()* +js_decode() eval.jax /*js_decode()* +js_encode() eval.jax /*js_encode()* +jsbterm-mouse options.jax /*jsbterm-mouse* +json_decode() eval.jax /*json_decode()* +json_encode() eval.jax /*json_encode()* +jtags tagsrch.jax /*jtags* +jump-motions motion.jax /*jump-motions* +jumplist motion.jax /*jumplist* +jumpto-diffs diff.jax /*jumpto-diffs* +k motion.jax /*k* +kcc uganda.jax /*kcc* +kde gui_x11.jax /*kde* +key-codes intro.jax /*key-codes* +key-codes-changed version4.jax /*key-codes-changed* +key-mapping map.jax /*key-mapping* +key-notation intro.jax /*key-notation* +key-variable eval.jax /*key-variable* +keycodes intro.jax /*keycodes* +keymap-accents mbyte.jax /*keymap-accents* +keymap-file-format mbyte.jax /*keymap-file-format* +keymap-hebrew mbyte.jax /*keymap-hebrew* +keypad-0 intro.jax /*keypad-0* +keypad-9 intro.jax /*keypad-9* +keypad-comma term.jax /*keypad-comma* +keypad-divide intro.jax /*keypad-divide* +keypad-end intro.jax /*keypad-end* +keypad-enter intro.jax /*keypad-enter* +keypad-home intro.jax /*keypad-home* +keypad-minus intro.jax /*keypad-minus* +keypad-multiply intro.jax /*keypad-multiply* +keypad-page-down intro.jax /*keypad-page-down* +keypad-page-up intro.jax /*keypad-page-up* +keypad-plus intro.jax /*keypad-plus* +keypad-point intro.jax /*keypad-point* +keys() eval.jax /*keys()* +l motion.jax /*l* +l: eval.jax /*l:* +l:var eval.jax /*l:var* +lCursor mbyte.jax /*lCursor* +lace.vim syntax.jax /*lace.vim* +lambda eval.jax /*lambda* +lang-variable eval.jax /*lang-variable* +language-mapping map.jax /*language-mapping* +last-pattern pattern.jax /*last-pattern* +last-position-jump eval.jax /*last-position-jump* +last_buffer_nr() eval.jax /*last_buffer_nr()* +latex-syntax syntax.jax /*latex-syntax* +lc_time-variable eval.jax /*lc_time-variable* +lcs-conceal options.jax /*lcs-conceal* +lcs-eol options.jax /*lcs-eol* +lcs-extends options.jax /*lcs-extends* +lcs-nbsp options.jax /*lcs-nbsp* +lcs-precedes options.jax /*lcs-precedes* +lcs-space options.jax /*lcs-space* +lcs-tab options.jax /*lcs-tab* +lcs-trail options.jax /*lcs-trail* +left-right-motions motion.jax /*left-right-motions* +len() eval.jax /*len()* +less various.jax /*less* +letter print.jax /*letter* +lex.vim syntax.jax /*lex.vim* +lhaskell.vim syntax.jax /*lhaskell.vim* +libcall() eval.jax /*libcall()* +libcallnr() eval.jax /*libcallnr()* +license uganda.jax /*license* +lid quickfix.jax /*lid* +lifelines.vim syntax.jax /*lifelines.vim* +limits vi_diff.jax /*limits* +line() eval.jax /*line()* +line-continuation repeat.jax /*line-continuation* +line2byte() eval.jax /*line2byte()* +linefeed intro.jax /*linefeed* +linewise motion.jax /*linewise* +linewise-register change.jax /*linewise-register* +linewise-visual visual.jax /*linewise-visual* +lisp.vim syntax.jax /*lisp.vim* +lispindent() eval.jax /*lispindent()* +list eval.jax /*list* +list-functions usr_41.jax /*list-functions* +list-identity eval.jax /*list-identity* +list-index eval.jax /*list-index* +list-modification eval.jax /*list-modification* +list-repeat windows.jax /*list-repeat* +lite.vim syntax.jax /*lite.vim* +literal-string eval.jax /*literal-string* +lnum-variable eval.jax /*lnum-variable* +load-plugins starting.jax /*load-plugins* +load-vim-script repeat.jax /*load-vim-script* +local-additions help.jax /*local-additions* +local-function eval.jax /*local-function* +local-options options.jax /*local-options* +local-variable eval.jax /*local-variable* +local-variables eval.jax /*local-variables* +local_markfilelist pi_netrw.jax /*local_markfilelist* +locale mbyte.jax /*locale* +locale-name mbyte.jax /*locale-name* +localtime() eval.jax /*localtime()* +location-list quickfix.jax /*location-list* +location-list-window quickfix.jax /*location-list-window* +log() eval.jax /*log()* +log10() eval.jax /*log10()* +logiPat pi_logipat.jax /*logiPat* +logiPat-arg pi_logipat.jax /*logiPat-arg* +logiPat-caveat pi_logipat.jax /*logiPat-caveat* +logiPat-contents pi_logipat.jax /*logiPat-contents* +logiPat-copyright pi_logipat.jax /*logiPat-copyright* +logiPat-examples pi_logipat.jax /*logiPat-examples* +logiPat-history pi_logipat.jax /*logiPat-history* +logiPat-input pi_logipat.jax /*logiPat-input* +logiPat-man pi_logipat.jax /*logiPat-man* +logiPat-manual pi_logipat.jax /*logiPat-manual* +logiPat-operators pi_logipat.jax /*logiPat-operators* +logiPat-pattern pi_logipat.jax /*logiPat-pattern* +love intro.jax /*love* +lowercase change.jax /*lowercase* +lpc.vim syntax.jax /*lpc.vim* +lua if_lua.jax /*lua* +lua-buffer if_lua.jax /*lua-buffer* +lua-commands if_lua.jax /*lua-commands* +lua-dict if_lua.jax /*lua-dict* +lua-dynamic if_lua.jax /*lua-dynamic* +lua-eval if_lua.jax /*lua-eval* +lua-funcref if_lua.jax /*lua-funcref* +lua-list if_lua.jax /*lua-list* +lua-luaeval if_lua.jax /*lua-luaeval* +lua-vim if_lua.jax /*lua-vim* +lua-window if_lua.jax /*lua-window* +lua.vim syntax.jax /*lua.vim* +luaeval() eval.jax /*luaeval()* +m motion.jax /*m* +m' motion.jax /*m'* +m< motion.jax /*m<* +m> motion.jax /*m>* +m[ motion.jax /*m[* +m] motion.jax /*m]* +m` motion.jax /*m`* +mac os_mac.jax /*mac* +mac-bug os_mac.jax /*mac-bug* +mac-compile os_mac.jax /*mac-compile* +mac-faq os_mac.jax /*mac-faq* +mac-filename os_mac.jax /*mac-filename* +mac-lack os_mac.jax /*mac-lack* +mac-vimfile os_mac.jax /*mac-vimfile* +macintosh os_mac.jax /*macintosh* +macro map.jax /*macro* +mail-list intro.jax /*mail-list* +mail.vim syntax.jax /*mail.vim* +maillist intro.jax /*maillist* +maillist-archive intro.jax /*maillist-archive* +make.vim syntax.jax /*make.vim* +man.vim filetype.jax /*man.vim* +manpager.vim filetype.jax /*manpager.vim* +manual-copyright usr_01.jax /*manual-copyright* +map() eval.jax /*map()* +map-<SID> map.jax /*map-<SID>* +map-CTRL-C map.jax /*map-CTRL-C* +map-ambiguous map.jax /*map-ambiguous* +map-backslash map.jax /*map-backslash* +map-backtick tips.jax /*map-backtick* +map-bar map.jax /*map-bar* +map-comments map.jax /*map-comments* +map-empty-rhs map.jax /*map-empty-rhs* +map-error map.jax /*map-error* +map-examples map.jax /*map-examples* +map-keys-fails map.jax /*map-keys-fails* +map-listing map.jax /*map-listing* +map-modes map.jax /*map-modes* +map-multibyte map.jax /*map-multibyte* +map-overview map.jax /*map-overview* +map-precedence map.jax /*map-precedence* +map-return map.jax /*map-return* +map-self-destroy tips.jax /*map-self-destroy* +map-space_in_lhs map.jax /*map-space_in_lhs* +map-space_in_rhs map.jax /*map-space_in_rhs* +map-typing map.jax /*map-typing* +map-which-keys map.jax /*map-which-keys* +map.txt map.jax /*map.txt* +map_CTRL-C map.jax /*map_CTRL-C* +map_backslash map.jax /*map_backslash* +map_bar map.jax /*map_bar* +map_empty_rhs map.jax /*map_empty_rhs* +map_return map.jax /*map_return* +map_space_in_lhs map.jax /*map_space_in_lhs* +map_space_in_rhs map.jax /*map_space_in_rhs* +maparg() eval.jax /*maparg()* +mapcheck() eval.jax /*mapcheck()* +maple.vim syntax.jax /*maple.vim* +mapleader map.jax /*mapleader* +maplocalleader map.jax /*maplocalleader* +mapmode-c map.jax /*mapmode-c* +mapmode-i map.jax /*mapmode-i* +mapmode-ic map.jax /*mapmode-ic* +mapmode-l map.jax /*mapmode-l* +mapmode-n map.jax /*mapmode-n* +mapmode-nvo map.jax /*mapmode-nvo* +mapmode-o map.jax /*mapmode-o* +mapmode-s map.jax /*mapmode-s* +mapmode-v map.jax /*mapmode-v* +mapmode-x map.jax /*mapmode-x* +mapping map.jax /*mapping* +mapping-functions usr_41.jax /*mapping-functions* +mark motion.jax /*mark* +mark-functions usr_41.jax /*mark-functions* +mark-motions motion.jax /*mark-motions* +markfilelist pi_netrw.jax /*markfilelist* +masm.vim syntax.jax /*masm.vim* +match() eval.jax /*match()* +match-highlight pattern.jax /*match-highlight* +match-parens tips.jax /*match-parens* +matchadd() eval.jax /*matchadd()* +matchaddpos() eval.jax /*matchaddpos()* +matcharg() eval.jax /*matcharg()* +matchdelete() eval.jax /*matchdelete()* +matchend() eval.jax /*matchend()* +matchit-install usr_05.jax /*matchit-install* +matchlist() eval.jax /*matchlist()* +matchparen pi_paren.jax /*matchparen* +matchstr() eval.jax /*matchstr()* +matchstrpos() eval.jax /*matchstrpos()* +max() eval.jax /*max()* +mbyte-IME mbyte.jax /*mbyte-IME* +mbyte-XIM mbyte.jax /*mbyte-XIM* +mbyte-combining mbyte.jax /*mbyte-combining* +mbyte-composing mbyte.jax /*mbyte-composing* +mbyte-conversion mbyte.jax /*mbyte-conversion* +mbyte-encoding mbyte.jax /*mbyte-encoding* +mbyte-first mbyte.jax /*mbyte-first* +mbyte-fonts-MSwin mbyte.jax /*mbyte-fonts-MSwin* +mbyte-fonts-X11 mbyte.jax /*mbyte-fonts-X11* +mbyte-keymap mbyte.jax /*mbyte-keymap* +mbyte-locale mbyte.jax /*mbyte-locale* +mbyte-options mbyte.jax /*mbyte-options* +mbyte-terminal mbyte.jax /*mbyte-terminal* +mbyte-utf8 mbyte.jax /*mbyte-utf8* +mbyte.txt mbyte.jax /*mbyte.txt* +menu-examples gui.jax /*menu-examples* +menu-priority gui.jax /*menu-priority* +menu-separator gui.jax /*menu-separator* +menu.vim gui.jax /*menu.vim* +menus gui.jax /*menus* +merge diff.jax /*merge* +message-history message.jax /*message-history* +message.txt message.jax /*message.txt* +messages message.jax /*messages* +meta intro.jax /*meta* +min() eval.jax /*min()* +missing-options vi_diff.jax /*missing-options* +mkdir() eval.jax /*mkdir()* +mlang.txt mlang.jax /*mlang.txt* +mma.vim syntax.jax /*mma.vim* +mode() eval.jax /*mode()* +mode-Ex intro.jax /*mode-Ex* +mode-cmdline cmdline.jax /*mode-cmdline* +mode-ins-repl insert.jax /*mode-ins-repl* +mode-replace insert.jax /*mode-replace* +mode-switching intro.jax /*mode-switching* +modeless-selection gui.jax /*modeless-selection* +modeline options.jax /*modeline* +modeline-local options.jax /*modeline-local* +modeline-version options.jax /*modeline-version* +moo.vim syntax.jax /*moo.vim* +more-prompt message.jax /*more-prompt* +more-variables eval.jax /*more-variables* +motion.txt motion.jax /*motion.txt* +mouse-mode-table term.jax /*mouse-mode-table* +mouse-overview term.jax /*mouse-overview* +mouse-swap-buttons term.jax /*mouse-swap-buttons* +mouse-using term.jax /*mouse-using* +mouse_col-variable eval.jax /*mouse_col-variable* +mouse_lnum-variable eval.jax /*mouse_lnum-variable* +mouse_win-variable eval.jax /*mouse_win-variable* +mouse_winid-variable eval.jax /*mouse_winid-variable* +movement intro.jax /*movement* +ms-dos os_msdos.jax /*ms-dos* +msdos os_msdos.jax /*msdos* +msql.vim syntax.jax /*msql.vim* +mswin.vim gui_w32.jax /*mswin.vim* +multi-byte mbyte.jax /*multi-byte* +multi-lang mlang.jax /*multi-lang* +multi-repeat repeat.jax /*multi-repeat* +multibyte mbyte.jax /*multibyte* +multibyte-ime mbyte.jax /*multibyte-ime* +multibyte-input mbyte.jax /*multibyte-input* +multilang mlang.jax /*multilang* +multilang-menus mlang.jax /*multilang-menus* +multilang-messages mlang.jax /*multilang-messages* +multilang-scripts mlang.jax /*multilang-scripts* +myfiletypefile syntax.jax /*myfiletypefile* +myscriptsfile syntax.jax /*myscriptsfile* +mysql ft_sql.jax /*mysql* +mysyntaxfile syntax.jax /*mysyntaxfile* +mysyntaxfile-add syntax.jax /*mysyntaxfile-add* +mysyntaxfile-replace syntax.jax /*mysyntaxfile-replace* +mzeval() eval.jax /*mzeval()* +mzscheme if_mzsch.jax /*mzscheme* +mzscheme-buffer if_mzsch.jax /*mzscheme-buffer* +mzscheme-commands if_mzsch.jax /*mzscheme-commands* +mzscheme-dynamic if_mzsch.jax /*mzscheme-dynamic* +mzscheme-examples if_mzsch.jax /*mzscheme-examples* +mzscheme-funcref if_mzsch.jax /*mzscheme-funcref* +mzscheme-mzeval if_mzsch.jax /*mzscheme-mzeval* +mzscheme-sandbox if_mzsch.jax /*mzscheme-sandbox* +mzscheme-setup if_mzsch.jax /*mzscheme-setup* +mzscheme-threads if_mzsch.jax /*mzscheme-threads* +mzscheme-vim if_mzsch.jax /*mzscheme-vim* +mzscheme-vimext if_mzsch.jax /*mzscheme-vimext* +mzscheme-window if_mzsch.jax /*mzscheme-window* +n pattern.jax /*n* +nasm.vim syntax.jax /*nasm.vim* +navigation motion.jax /*navigation* +nb-commands netbeans.jax /*nb-commands* +nb-events netbeans.jax /*nb-events* +nb-functions netbeans.jax /*nb-functions* +nb-messages netbeans.jax /*nb-messages* +nb-protocol_errors netbeans.jax /*nb-protocol_errors* +nb-special netbeans.jax /*nb-special* +nb-terms netbeans.jax /*nb-terms* +ncf.vim syntax.jax /*ncf.vim* +netbeans netbeans.jax /*netbeans* +netbeans-commands netbeans.jax /*netbeans-commands* +netbeans-configure netbeans.jax /*netbeans-configure* +netbeans-debugging netbeans.jax /*netbeans-debugging* +netbeans-download netbeans.jax /*netbeans-download* +netbeans-integration netbeans.jax /*netbeans-integration* +netbeans-intro netbeans.jax /*netbeans-intro* +netbeans-keybindings netbeans.jax /*netbeans-keybindings* +netbeans-messages netbeans.jax /*netbeans-messages* +netbeans-parameters netbeans.jax /*netbeans-parameters* +netbeans-preparation netbeans.jax /*netbeans-preparation* +netbeans-problems netbeans.jax /*netbeans-problems* +netbeans-protocol netbeans.jax /*netbeans-protocol* +netbeans-run netbeans.jax /*netbeans-run* +netbeans-setup netbeans.jax /*netbeans-setup* +netbeans-support netbeans.jax /*netbeans-support* +netbeans.txt netbeans.jax /*netbeans.txt* +netreadfixup pi_netrw.jax /*netreadfixup* +netrw pi_netrw.jax /*netrw* +netrw-% pi_netrw.jax /*netrw-%* +netrw-- pi_netrw.jax /*netrw--* +netrw-:Explore pi_netrw.jax /*netrw-:Explore* +netrw-:Hexplore pi_netrw.jax /*netrw-:Hexplore* +netrw-:Lexplore pi_netrw.jax /*netrw-:Lexplore* +netrw-:MF pi_netrw.jax /*netrw-:MF* +netrw-:MT pi_netrw.jax /*netrw-:MT* +netrw-:NetrwC pi_netrw.jax /*netrw-:NetrwC* +netrw-:NetrwMB pi_netrw.jax /*netrw-:NetrwMB* +netrw-:Rexplore pi_netrw.jax /*netrw-:Rexplore* +netrw-:Sexplore pi_netrw.jax /*netrw-:Sexplore* +netrw-:Texplore pi_netrw.jax /*netrw-:Texplore* +netrw-:Vexplore pi_netrw.jax /*netrw-:Vexplore* +netrw-C pi_netrw.jax /*netrw-C* +netrw-D pi_netrw.jax /*netrw-D* +netrw-I pi_netrw.jax /*netrw-I* +netrw-O pi_netrw.jax /*netrw-O* +netrw-P pi_netrw.jax /*netrw-P* +netrw-P18 pi_netrw.jax /*netrw-P18* +netrw-P19 pi_netrw.jax /*netrw-P19* +netrw-P20 pi_netrw.jax /*netrw-P20* +netrw-P21 pi_netrw.jax /*netrw-P21* +netrw-P22 pi_netrw.jax /*netrw-P22* +netrw-R pi_netrw.jax /*netrw-R* +netrw-S pi_netrw.jax /*netrw-S* +netrw-Tb pi_netrw.jax /*netrw-Tb* +netrw-Th pi_netrw.jax /*netrw-Th* +netrw-U pi_netrw.jax /*netrw-U* +netrw-X pi_netrw.jax /*netrw-X* +netrw-a pi_netrw.jax /*netrw-a* +netrw-activate pi_netrw.jax /*netrw-activate* +netrw-bookmark pi_netrw.jax /*netrw-bookmark* +netrw-bookmarks pi_netrw.jax /*netrw-bookmarks* +netrw-browse pi_netrw.jax /*netrw-browse* +netrw-browse-cmds pi_netrw.jax /*netrw-browse-cmds* +netrw-browse-maps pi_netrw.jax /*netrw-browse-maps* +netrw-browser pi_netrw.jax /*netrw-browser* +netrw-browser-options pi_netrw.jax /*netrw-browser-options* +netrw-browser-settings pi_netrw.jax /*netrw-browser-settings* +netrw-browser-var pi_netrw.jax /*netrw-browser-var* +netrw-browsing pi_netrw.jax /*netrw-browsing* +netrw-c pi_netrw.jax /*netrw-c* +netrw-c-tab pi_netrw.jax /*netrw-c-tab* +netrw-cadaver pi_netrw.jax /*netrw-cadaver* +netrw-chgup pi_netrw.jax /*netrw-chgup* +netrw-clean pi_netrw.jax /*netrw-clean* +netrw-contents pi_netrw.jax /*netrw-contents* +netrw-copyright pi_netrw.jax /*netrw-copyright* +netrw-cr pi_netrw.jax /*netrw-cr* +netrw-createfile pi_netrw.jax /*netrw-createfile* +netrw-credits pi_netrw.jax /*netrw-credits* +netrw-ctrl-h pi_netrw.jax /*netrw-ctrl-h* +netrw-ctrl-l pi_netrw.jax /*netrw-ctrl-l* +netrw-ctrl-r pi_netrw.jax /*netrw-ctrl-r* +netrw-ctrl_l pi_netrw.jax /*netrw-ctrl_l* +netrw-curdir pi_netrw.jax /*netrw-curdir* +netrw-d pi_netrw.jax /*netrw-d* +netrw-debug pi_netrw.jax /*netrw-debug* +netrw-del pi_netrw.jax /*netrw-del* +netrw-delete pi_netrw.jax /*netrw-delete* +netrw-dir pi_netrw.jax /*netrw-dir* +netrw-dirlist pi_netrw.jax /*netrw-dirlist* +netrw-downdir pi_netrw.jax /*netrw-downdir* +netrw-edithide pi_netrw.jax /*netrw-edithide* +netrw-editwindow pi_netrw.jax /*netrw-editwindow* +netrw-enter pi_netrw.jax /*netrw-enter* +netrw-ex pi_netrw.jax /*netrw-ex* +netrw-explore pi_netrw.jax /*netrw-explore* +netrw-explore-cmds pi_netrw.jax /*netrw-explore-cmds* +netrw-externapp pi_netrw.jax /*netrw-externapp* +netrw-file pi_netrw.jax /*netrw-file* +netrw-filigree pi_netrw.jax /*netrw-filigree* +netrw-fixup pi_netrw.jax /*netrw-fixup* +netrw-ftp pi_netrw.jax /*netrw-ftp* +netrw-ftype pi_netrw.jax /*netrw-ftype* +netrw-gb pi_netrw.jax /*netrw-gb* +netrw-gd pi_netrw.jax /*netrw-gd* +netrw-getftype pi_netrw.jax /*netrw-getftype* +netrw-gf pi_netrw.jax /*netrw-gf* +netrw-gh pi_netrw.jax /*netrw-gh* +netrw-gitignore pi_netrw.jax /*netrw-gitignore* +netrw-gn pi_netrw.jax /*netrw-gn* +netrw-gp pi_netrw.jax /*netrw-gp* +netrw-grep pi_netrw.jax /*netrw-grep* +netrw-gx pi_netrw.jax /*netrw-gx* +netrw-handler pi_netrw.jax /*netrw-handler* +netrw-help pi_netrw.jax /*netrw-help* +netrw-hexplore pi_netrw.jax /*netrw-hexplore* +netrw-hide pi_netrw.jax /*netrw-hide* +netrw-hiding pi_netrw.jax /*netrw-hiding* +netrw-history pi_netrw.jax /*netrw-history* +netrw-horiz pi_netrw.jax /*netrw-horiz* +netrw-i pi_netrw.jax /*netrw-i* +netrw-incompatible pi_netrw.jax /*netrw-incompatible* +netrw-internal-variables pi_netrw.jax /*netrw-internal-variables* +netrw-intro-browse pi_netrw.jax /*netrw-intro-browse* +netrw-leftmouse pi_netrw.jax /*netrw-leftmouse* +netrw-lexplore pi_netrw.jax /*netrw-lexplore* +netrw-list pi_netrw.jax /*netrw-list* +netrw-listbookmark pi_netrw.jax /*netrw-listbookmark* +netrw-listhack pi_netrw.jax /*netrw-listhack* +netrw-login pi_netrw.jax /*netrw-login* +netrw-mA pi_netrw.jax /*netrw-mA* +netrw-mB pi_netrw.jax /*netrw-mB* +netrw-mF pi_netrw.jax /*netrw-mF* +netrw-mT pi_netrw.jax /*netrw-mT* +netrw-mX pi_netrw.jax /*netrw-mX* +netrw-ma pi_netrw.jax /*netrw-ma* +netrw-mb pi_netrw.jax /*netrw-mb* +netrw-mc pi_netrw.jax /*netrw-mc* +netrw-md pi_netrw.jax /*netrw-md* +netrw-me pi_netrw.jax /*netrw-me* +netrw-mf pi_netrw.jax /*netrw-mf* +netrw-mg pi_netrw.jax /*netrw-mg* +netrw-mh pi_netrw.jax /*netrw-mh* +netrw-middlemouse pi_netrw.jax /*netrw-middlemouse* +netrw-ml_get pi_netrw.jax /*netrw-ml_get* +netrw-mm pi_netrw.jax /*netrw-mm* +netrw-mouse pi_netrw.jax /*netrw-mouse* +netrw-move pi_netrw.jax /*netrw-move* +netrw-mp pi_netrw.jax /*netrw-mp* +netrw-mr pi_netrw.jax /*netrw-mr* +netrw-ms pi_netrw.jax /*netrw-ms* +netrw-mt pi_netrw.jax /*netrw-mt* +netrw-mu pi_netrw.jax /*netrw-mu* +netrw-mv pi_netrw.jax /*netrw-mv* +netrw-mx pi_netrw.jax /*netrw-mx* +netrw-mz pi_netrw.jax /*netrw-mz* +netrw-netrc pi_netrw.jax /*netrw-netrc* +netrw-newfile pi_netrw.jax /*netrw-newfile* +netrw-nexplore pi_netrw.jax /*netrw-nexplore* +netrw-noload pi_netrw.jax /*netrw-noload* +netrw-nread pi_netrw.jax /*netrw-nread* +netrw-ntree pi_netrw.jax /*netrw-ntree* +netrw-nwrite pi_netrw.jax /*netrw-nwrite* +netrw-o pi_netrw.jax /*netrw-o* +netrw-obtain pi_netrw.jax /*netrw-obtain* +netrw-options pi_netrw.jax /*netrw-options* +netrw-p pi_netrw.jax /*netrw-p* +netrw-p1 pi_netrw.jax /*netrw-p1* +netrw-p10 pi_netrw.jax /*netrw-p10* +netrw-p11 pi_netrw.jax /*netrw-p11* +netrw-p12 pi_netrw.jax /*netrw-p12* +netrw-p13 pi_netrw.jax /*netrw-p13* +netrw-p14 pi_netrw.jax /*netrw-p14* +netrw-p15 pi_netrw.jax /*netrw-p15* +netrw-p16 pi_netrw.jax /*netrw-p16* +netrw-p17 pi_netrw.jax /*netrw-p17* +netrw-p2 pi_netrw.jax /*netrw-p2* +netrw-p3 pi_netrw.jax /*netrw-p3* +netrw-p4 pi_netrw.jax /*netrw-p4* +netrw-p5 pi_netrw.jax /*netrw-p5* +netrw-p6 pi_netrw.jax /*netrw-p6* +netrw-p7 pi_netrw.jax /*netrw-p7* +netrw-p8 pi_netrw.jax /*netrw-p8* +netrw-p9 pi_netrw.jax /*netrw-p9* +netrw-passwd pi_netrw.jax /*netrw-passwd* +netrw-password pi_netrw.jax /*netrw-password* +netrw-path pi_netrw.jax /*netrw-path* +netrw-pexplore pi_netrw.jax /*netrw-pexplore* +netrw-preview pi_netrw.jax /*netrw-preview* +netrw-problems pi_netrw.jax /*netrw-problems* +netrw-protocol pi_netrw.jax /*netrw-protocol* +netrw-prvwin pi_netrw.jax /*netrw-prvwin* +netrw-pscp pi_netrw.jax /*netrw-pscp* +netrw-psftp pi_netrw.jax /*netrw-psftp* +netrw-putty pi_netrw.jax /*netrw-putty* +netrw-qF pi_netrw.jax /*netrw-qF* +netrw-qL pi_netrw.jax /*netrw-qL* +netrw-qb pi_netrw.jax /*netrw-qb* +netrw-qf pi_netrw.jax /*netrw-qf* +netrw-quickcom pi_netrw.jax /*netrw-quickcom* +netrw-quickcoms pi_netrw.jax /*netrw-quickcoms* +netrw-quickhelp pi_netrw.jax /*netrw-quickhelp* +netrw-quickmap pi_netrw.jax /*netrw-quickmap* +netrw-quickmaps pi_netrw.jax /*netrw-quickmaps* +netrw-r pi_netrw.jax /*netrw-r* +netrw-read pi_netrw.jax /*netrw-read* +netrw-ref pi_netrw.jax /*netrw-ref* +netrw-refresh pi_netrw.jax /*netrw-refresh* +netrw-rename pi_netrw.jax /*netrw-rename* +netrw-reverse pi_netrw.jax /*netrw-reverse* +netrw-rexplore pi_netrw.jax /*netrw-rexplore* +netrw-rightmouse pi_netrw.jax /*netrw-rightmouse* +netrw-s pi_netrw.jax /*netrw-s* +netrw-s-cr pi_netrw.jax /*netrw-s-cr* +netrw-settings pi_netrw.jax /*netrw-settings* +netrw-settings-window pi_netrw.jax /*netrw-settings-window* +netrw-sexplore pi_netrw.jax /*netrw-sexplore* +netrw-sort pi_netrw.jax /*netrw-sort* +netrw-sort-sequence pi_netrw.jax /*netrw-sort-sequence* +netrw-sortsequence pi_netrw.jax /*netrw-sortsequence* +netrw-source pi_netrw.jax /*netrw-source* +netrw-ssh-hack pi_netrw.jax /*netrw-ssh-hack* +netrw-star pi_netrw.jax /*netrw-star* +netrw-starpat pi_netrw.jax /*netrw-starpat* +netrw-starstar pi_netrw.jax /*netrw-starstar* +netrw-starstarpat pi_netrw.jax /*netrw-starstarpat* +netrw-start pi_netrw.jax /*netrw-start* +netrw-t pi_netrw.jax /*netrw-t* +netrw-texplore pi_netrw.jax /*netrw-texplore* +netrw-todo pi_netrw.jax /*netrw-todo* +netrw-trailingslash pi_netrw.jax /*netrw-trailingslash* +netrw-transparent pi_netrw.jax /*netrw-transparent* +netrw-u pi_netrw.jax /*netrw-u* +netrw-updir pi_netrw.jax /*netrw-updir* +netrw-urls pi_netrw.jax /*netrw-urls* +netrw-usermaps pi_netrw.jax /*netrw-usermaps* +netrw-userpass pi_netrw.jax /*netrw-userpass* +netrw-v pi_netrw.jax /*netrw-v* +netrw-var pi_netrw.jax /*netrw-var* +netrw-variables pi_netrw.jax /*netrw-variables* +netrw-vexplore pi_netrw.jax /*netrw-vexplore* +netrw-windows-netrc pi_netrw.jax /*netrw-windows-netrc* +netrw-windows-s pi_netrw.jax /*netrw-windows-s* +netrw-write pi_netrw.jax /*netrw-write* +netrw-x pi_netrw.jax /*netrw-x* +netrw-xfer pi_netrw.jax /*netrw-xfer* +netrw.vim pi_netrw.jax /*netrw.vim* +netrw_filehandler pi_netrw.jax /*netrw_filehandler* +netterm-mouse options.jax /*netterm-mouse* +network pi_netrw.jax /*network* +new-8 version8.jax /*new-8* +new-filetype filetype.jax /*new-filetype* +new-filetype-scripts filetype.jax /*new-filetype-scripts* +new-items-8 version8.jax /*new-items-8* +new-style-testing eval.jax /*new-style-testing* +new-vim-script-8 version8.jax /*new-vim-script-8* +news intro.jax /*news* +nextnonblank() eval.jax /*nextnonblank()* +no-eval-feature eval.jax /*no-eval-feature* +no-type-checking eval.jax /*no-type-checking* +no_buffers_menu gui.jax /*no_buffers_menu* +non-greedy pattern.jax /*non-greedy* +non-zero-arg eval.jax /*non-zero-arg* +none-variable eval.jax /*none-variable* +normal-index index.jax /*normal-index* +not-compatible usr_01.jax /*not-compatible* +not-edited editing.jax /*not-edited* +notation intro.jax /*notation* +notepad gui_w32.jax /*notepad* +nr2char() eval.jax /*nr2char()* +nroff.vim syntax.jax /*nroff.vim* +null-variable eval.jax /*null-variable* +number_relativenumber options.jax /*number_relativenumber* +numbered-function eval.jax /*numbered-function* +o insert.jax /*o* +o_CTRL-V motion.jax /*o_CTRL-V* +o_V motion.jax /*o_V* +o_v motion.jax /*o_v* +object-motions motion.jax /*object-motions* +object-select motion.jax /*object-select* +objects index.jax /*objects* +obtaining-exted netbeans.jax /*obtaining-exted* +ocaml.vim syntax.jax /*ocaml.vim* +octal eval.jax /*octal* +octal-nrformats options.jax /*octal-nrformats* +octal-number eval.jax /*octal-number* +old-style-testing eval.jax /*old-style-testing* +oldfiles-variable eval.jax /*oldfiles-variable* +ole-activation if_ole.jax /*ole-activation* +ole-eval if_ole.jax /*ole-eval* +ole-gethwnd if_ole.jax /*ole-gethwnd* +ole-interface if_ole.jax /*ole-interface* +ole-methods if_ole.jax /*ole-methods* +ole-normal if_ole.jax /*ole-normal* +ole-registration if_ole.jax /*ole-registration* +ole-sendkeys if_ole.jax /*ole-sendkeys* +ole-setforeground if_ole.jax /*ole-setforeground* +omap-info map.jax /*omap-info* +omni-sql-completion ft_sql.jax /*omni-sql-completion* +online-help helphelp.jax /*online-help* +opening-window windows.jax /*opening-window* +operator motion.jax /*operator* +operator-variable eval.jax /*operator-variable* +option-backslash options.jax /*option-backslash* +option-list quickref.jax /*option-list* +option-summary options.jax /*option-summary* +option-window options.jax /*option-window* +options options.jax /*options* +options.txt options.jax /*options.txt* +optwin options.jax /*optwin* +or() eval.jax /*or()* +oracle ft_sql.jax /*oracle* +os2 os_os2.jax /*os2* +os390 os_390.jax /*os390* +os_390.txt os_390.jax /*os_390.txt* +os_amiga.txt os_amiga.jax /*os_amiga.txt* +os_beos.txt os_beos.jax /*os_beos.txt* +os_dos.txt os_dos.jax /*os_dos.txt* +os_mac.txt os_mac.jax /*os_mac.txt* +os_mint.txt os_mint.jax /*os_mint.txt* +os_msdos.txt os_msdos.jax /*os_msdos.txt* +os_os2.txt os_os2.jax /*os_os2.txt* +os_qnx.txt os_qnx.jax /*os_qnx.txt* +os_risc.txt os_risc.jax /*os_risc.txt* +os_unix.txt os_unix.jax /*os_unix.txt* +os_vms.txt os_vms.jax /*os_vms.txt* +os_win32.txt os_win32.jax /*os_win32.txt* +other-features vi_diff.jax /*other-features* +out_buf channel.jax /*out_buf* +out_cb channel.jax /*out_cb* +out_io-buffer channel.jax /*out_io-buffer* +out_mode channel.jax /*out_mode* +out_modifiable channel.jax /*out_modifiable* +out_msg channel.jax /*out_msg* +out_name channel.jax /*out_name* +out_timeout channel.jax /*out_timeout* +p change.jax /*p* +pack-add repeat.jax /*pack-add* +package-create repeat.jax /*package-create* +packages repeat.jax /*packages* +packload-two-steps repeat.jax /*packload-two-steps* +page-down intro.jax /*page-down* +page-up intro.jax /*page-up* +page_down intro.jax /*page_down* +page_up intro.jax /*page_up* +pager message.jax /*pager* +papp.vim syntax.jax /*papp.vim* +paragraph motion.jax /*paragraph* +pascal.vim syntax.jax /*pascal.vim* +patches-8 version8.jax /*patches-8* +pathshorten() eval.jax /*pathshorten()* +pattern pattern.jax /*pattern* +pattern-atoms pattern.jax /*pattern-atoms* +pattern-multi-byte pattern.jax /*pattern-multi-byte* +pattern-multi-items pattern.jax /*pattern-multi-items* +pattern-overview pattern.jax /*pattern-overview* +pattern-searches pattern.jax /*pattern-searches* +pattern.txt pattern.jax /*pattern.txt* +patterns-composing pattern.jax /*patterns-composing* +pdev-option print.jax /*pdev-option* +peace intro.jax /*peace* +penc-option print.jax /*penc-option* +perl if_perl.jax /*perl* +perl-Append if_perl.jax /*perl-Append* +perl-Buffer if_perl.jax /*perl-Buffer* +perl-Buffers if_perl.jax /*perl-Buffers* +perl-Count if_perl.jax /*perl-Count* +perl-Delete if_perl.jax /*perl-Delete* +perl-DoCommand if_perl.jax /*perl-DoCommand* +perl-Eval if_perl.jax /*perl-Eval* +perl-Get if_perl.jax /*perl-Get* +perl-GetCursor if_perl.jax /*perl-GetCursor* +perl-Msg if_perl.jax /*perl-Msg* +perl-Name if_perl.jax /*perl-Name* +perl-Number if_perl.jax /*perl-Number* +perl-Set if_perl.jax /*perl-Set* +perl-SetHeight if_perl.jax /*perl-SetHeight* +perl-SetOption if_perl.jax /*perl-SetOption* +perl-Windows if_perl.jax /*perl-Windows* +perl-compiling if_perl.jax /*perl-compiling* +perl-dynamic if_perl.jax /*perl-dynamic* +perl-editing if_perl.jax /*perl-editing* +perl-overview if_perl.jax /*perl-overview* +perl-patterns pattern.jax /*perl-patterns* +perl-using if_perl.jax /*perl-using* +perl.vim syntax.jax /*perl.vim* +perleval() eval.jax /*perleval()* +persistent-undo undo.jax /*persistent-undo* +pexpr-option print.jax /*pexpr-option* +pfn-option print.jax /*pfn-option* +pheader-option print.jax /*pheader-option* +photon-fonts os_qnx.jax /*photon-fonts* +photon-gui os_qnx.jax /*photon-gui* +php-comment indent.jax /*php-comment* +php-indent indent.jax /*php-indent* +php-indenting indent.jax /*php-indenting* +php.vim syntax.jax /*php.vim* +php3.vim syntax.jax /*php3.vim* +phtml.vim syntax.jax /*phtml.vim* +pi_getscript.txt pi_getscript.jax /*pi_getscript.txt* +pi_gzip.txt pi_gzip.jax /*pi_gzip.txt* +pi_logipat.txt pi_logipat.jax /*pi_logipat.txt* +pi_netrw.txt pi_netrw.jax /*pi_netrw.txt* +pi_paren.txt pi_paren.jax /*pi_paren.txt* +pi_spec.txt pi_spec.jax /*pi_spec.txt* +pi_tar.txt pi_tar.jax /*pi_tar.txt* +pi_vimball.txt pi_vimball.jax /*pi_vimball.txt* +pi_zip.txt pi_zip.jax /*pi_zip.txt* +pkzip options.jax /*pkzip* +plaintex.vim syntax.jax /*plaintex.vim* +plsql ft_sql.jax /*plsql* +plugin usr_05.jax /*plugin* +plugin-details filetype.jax /*plugin-details* +plugin-filetype usr_41.jax /*plugin-filetype* +plugin-special usr_41.jax /*plugin-special* +pmbcs-option print.jax /*pmbcs-option* +pmbfn-option print.jax /*pmbfn-option* +popt-option print.jax /*popt-option* +popup-menu gui.jax /*popup-menu* +popupmenu-completion insert.jax /*popupmenu-completion* +popupmenu-keys insert.jax /*popupmenu-keys* +posix vi_diff.jax /*posix* +posix-compliance vi_diff.jax /*posix-compliance* +posix-screen-size vi_diff.jax /*posix-screen-size* +postgresql ft_sql.jax /*postgresql* +postscr.vim syntax.jax /*postscr.vim* +postscript-cjk-printing print.jax /*postscript-cjk-printing* +postscript-print-encoding print.jax /*postscript-print-encoding* +postscript-print-trouble print.jax /*postscript-print-trouble* +postscript-print-util print.jax /*postscript-print-util* +postscript-printing print.jax /*postscript-printing* +pow() eval.jax /*pow()* +ppwiz.vim syntax.jax /*ppwiz.vim* +press-enter message.jax /*press-enter* +press-return message.jax /*press-return* +prevcount-variable eval.jax /*prevcount-variable* +preview-window windows.jax /*preview-window* +prevnonblank() eval.jax /*prevnonblank()* +print-intro print.jax /*print-intro* +print-options print.jax /*print-options* +print.txt print.jax /*print.txt* +printf() eval.jax /*printf()* +printf-% eval.jax /*printf-%* +printf-B eval.jax /*printf-B* +printf-E eval.jax /*printf-E* +printf-G eval.jax /*printf-G* +printf-S eval.jax /*printf-S* +printf-X eval.jax /*printf-X* +printf-b eval.jax /*printf-b* +printf-c eval.jax /*printf-c* +printf-d eval.jax /*printf-d* +printf-e eval.jax /*printf-e* +printf-f eval.jax /*printf-f* +printf-g eval.jax /*printf-g* +printf-o eval.jax /*printf-o* +printf-s eval.jax /*printf-s* +printf-x eval.jax /*printf-x* +printing print.jax /*printing* +printing-formfeed print.jax /*printing-formfeed* +profile repeat.jax /*profile* +profiling repeat.jax /*profiling* +profiling-variable eval.jax /*profiling-variable* +progname-variable eval.jax /*progname-variable* +progpath-variable eval.jax /*progpath-variable* +progress.vim syntax.jax /*progress.vim* +pronounce intro.jax /*pronounce* +psql ft_sql.jax /*psql* +ptcap.vim syntax.jax /*ptcap.vim* +pterm-mouse options.jax /*pterm-mouse* +pumvisible() eval.jax /*pumvisible()* +put change.jax /*put* +put-Visual-mode change.jax /*put-Visual-mode* +py3eval() eval.jax /*py3eval()* +pyeval() eval.jax /*pyeval()* +python if_pyth.jax /*python* +python-.locked if_pyth.jax /*python-.locked* +python-2-and-3 if_pyth.jax /*python-2-and-3* +python-Dictionary if_pyth.jax /*python-Dictionary* +python-Function if_pyth.jax /*python-Function* +python-List if_pyth.jax /*python-List* +python-VIM_SPECIAL_PATH if_pyth.jax /*python-VIM_SPECIAL_PATH* +python-_get_paths if_pyth.jax /*python-_get_paths* +python-bindeval if_pyth.jax /*python-bindeval* +python-bindeval-objects if_pyth.jax /*python-bindeval-objects* +python-buffer if_pyth.jax /*python-buffer* +python-buffers if_pyth.jax /*python-buffers* +python-building if_pyth.jax /*python-building* +python-chdir if_pyth.jax /*python-chdir* +python-command if_pyth.jax /*python-command* +python-commands if_pyth.jax /*python-commands* +python-current if_pyth.jax /*python-current* +python-dynamic if_pyth.jax /*python-dynamic* +python-error if_pyth.jax /*python-error* +python-eval if_pyth.jax /*python-eval* +python-examples if_pyth.jax /*python-examples* +python-fchdir if_pyth.jax /*python-fchdir* +python-find_module if_pyth.jax /*python-find_module* +python-foreach_rtp if_pyth.jax /*python-foreach_rtp* +python-input if_pyth.jax /*python-input* +python-options if_pyth.jax /*python-options* +python-output if_pyth.jax /*python-output* +python-path_hook if_pyth.jax /*python-path_hook* +python-pyeval if_pyth.jax /*python-pyeval* +python-range if_pyth.jax /*python-range* +python-special-path if_pyth.jax /*python-special-path* +python-strwidth if_pyth.jax /*python-strwidth* +python-tabpage if_pyth.jax /*python-tabpage* +python-tabpages if_pyth.jax /*python-tabpages* +python-vars if_pyth.jax /*python-vars* +python-vim if_pyth.jax /*python-vim* +python-vvars if_pyth.jax /*python-vvars* +python-window if_pyth.jax /*python-window* +python-windows if_pyth.jax /*python-windows* +python.vim syntax.jax /*python.vim* +python2-directory if_pyth.jax /*python2-directory* +python3 if_pyth.jax /*python3* +python3-directory if_pyth.jax /*python3-directory* +python_x if_pyth.jax /*python_x* +python_x-special-comments if_pyth.jax /*python_x-special-comments* +pythonx if_pyth.jax /*pythonx* +pythonx-directory if_pyth.jax /*pythonx-directory* +pyxeval() eval.jax /*pyxeval()* +q repeat.jax /*q* +q/ cmdline.jax /*q\/* +q: cmdline.jax /*q:* +q? cmdline.jax /*q?* +qnx os_qnx.jax /*qnx* +qnx-compiling os_qnx.jax /*qnx-compiling* +qnx-general os_qnx.jax /*qnx-general* +qnx-terminal os_qnx.jax /*qnx-terminal* +quake.vim syntax.jax /*quake.vim* +quickfix quickfix.jax /*quickfix* +quickfix-directory-stack quickfix.jax /*quickfix-directory-stack* +quickfix-error-lists quickfix.jax /*quickfix-error-lists* +quickfix-functions usr_41.jax /*quickfix-functions* +quickfix-gcc quickfix.jax /*quickfix-gcc* +quickfix-manx quickfix.jax /*quickfix-manx* +quickfix-perl quickfix.jax /*quickfix-perl* +quickfix-valid quickfix.jax /*quickfix-valid* +quickfix-window quickfix.jax /*quickfix-window* +quickfix.txt quickfix.jax /*quickfix.txt* +quickref quickref.jax /*quickref* +quickref.txt quickref.jax /*quickref.txt* +quote change.jax /*quote* +quote# change.jax /*quote#* +quote% change.jax /*quote%* +quote+ gui_x11.jax /*quote+* +quote- change.jax /*quote-* +quote. change.jax /*quote.* +quote/ change.jax /*quote\/* +quote0 change.jax /*quote0* +quote1 change.jax /*quote1* +quote2 change.jax /*quote2* +quote3 change.jax /*quote3* +quote4 change.jax /*quote4* +quote9 change.jax /*quote9* +quote: change.jax /*quote:* +quote= change.jax /*quote=* +quote_ change.jax /*quote_* +quote_# change.jax /*quote_#* +quote_% change.jax /*quote_%* +quote_- change.jax /*quote_-* +quote_. change.jax /*quote_.* +quote_/ change.jax /*quote_\/* +quote_: change.jax /*quote_:* +quote_= change.jax /*quote_=* +quote_alpha change.jax /*quote_alpha* +quote_number change.jax /*quote_number* +quote_quote change.jax /*quote_quote* +quote_~ change.jax /*quote_~* +quotea change.jax /*quotea* +quotecommandquote intro.jax /*quotecommandquote* +quoteplus gui_x11.jax /*quoteplus* +quotequote change.jax /*quotequote* +quotes quotes.jax /*quotes* +quotes.txt quotes.jax /*quotes.txt* +quotestar gui.jax /*quotestar* +quote~ change.jax /*quote~* +r change.jax /*r* +range() eval.jax /*range()* +raw-terminal-mode term.jax /*raw-terminal-mode* +rcp pi_netrw.jax /*rcp* +read-in-close-cb channel.jax /*read-in-close-cb* +read-messages insert.jax /*read-messages* +read-only-share editing.jax /*read-only-share* +readfile() eval.jax /*readfile()* +readline.vim syntax.jax /*readline.vim* +recording repeat.jax /*recording* +recover.txt recover.jax /*recover.txt* +recovery recover.jax /*recovery* +recursive_mapping map.jax /*recursive_mapping* +redo undo.jax /*redo* +redo-register undo.jax /*redo-register* +ref intro.jax /*ref* +reference intro.jax /*reference* +reference_toc help.jax /*reference_toc* +regexp pattern.jax /*regexp* +register sponsor.jax /*register* +register-faq sponsor.jax /*register-faq* +register-variable eval.jax /*register-variable* +registers change.jax /*registers* +regular-expression pattern.jax /*regular-expression* +reload editing.jax /*reload* +reltime() eval.jax /*reltime()* +reltimefloat() eval.jax /*reltimefloat()* +reltimestr() eval.jax /*reltimestr()* +remote.txt remote.jax /*remote.txt* +remote_expr() eval.jax /*remote_expr()* +remote_foreground() eval.jax /*remote_foreground()* +remote_peek() eval.jax /*remote_peek()* +remote_read() eval.jax /*remote_read()* +remote_send() eval.jax /*remote_send()* +remove() eval.jax /*remove()* +remove-filetype filetype.jax /*remove-filetype* +remove-option-flags options.jax /*remove-option-flags* +rename() eval.jax /*rename()* +rename-files tips.jax /*rename-files* +repeat() eval.jax /*repeat()* +repeat.txt repeat.jax /*repeat.txt* +repeating repeat.jax /*repeating* +replacing change.jax /*replacing* +replacing-ex insert.jax /*replacing-ex* +reselect-Visual visual.jax /*reselect-Visual* +resolve() eval.jax /*resolve()* +restore-cursor usr_05.jax /*restore-cursor* +restore-position tips.jax /*restore-position* +restricted-mode starting.jax /*restricted-mode* +retab-example change.jax /*retab-example* +rethrow eval.jax /*rethrow* +reverse() eval.jax /*reverse()* +rexx.vim syntax.jax /*rexx.vim* +rgb.txt gui_w32.jax /*rgb.txt* +rgview starting.jax /*rgview* +rgvim starting.jax /*rgvim* +right-justify change.jax /*right-justify* +rileft rileft.jax /*rileft* +rileft.txt rileft.jax /*rileft.txt* +riscos os_risc.jax /*riscos* +rot13 change.jax /*rot13* +round() eval.jax /*round()* +rst.vim syntax.jax /*rst.vim* +rsync pi_netrw.jax /*rsync* +ruby if_ruby.jax /*ruby* +ruby-buffer if_ruby.jax /*ruby-buffer* +ruby-command if_ruby.jax /*ruby-command* +ruby-commands if_ruby.jax /*ruby-commands* +ruby-dynamic if_ruby.jax /*ruby-dynamic* +ruby-evaluate if_ruby.jax /*ruby-evaluate* +ruby-globals if_ruby.jax /*ruby-globals* +ruby-message if_ruby.jax /*ruby-message* +ruby-set_option if_ruby.jax /*ruby-set_option* +ruby-vim if_ruby.jax /*ruby-vim* +ruby-window if_ruby.jax /*ruby-window* +ruby.vim syntax.jax /*ruby.vim* +ruby_fold syntax.jax /*ruby_fold* +ruby_foldable_groups syntax.jax /*ruby_foldable_groups* +ruby_minlines syntax.jax /*ruby_minlines* +ruby_no_expensive syntax.jax /*ruby_no_expensive* +ruby_operators syntax.jax /*ruby_operators* +ruby_space_errors syntax.jax /*ruby_space_errors* +ruby_spellcheck_strings syntax.jax /*ruby_spellcheck_strings* +russian russian.jax /*russian* +russian-intro russian.jax /*russian-intro* +russian-issues russian.jax /*russian-issues* +russian-keymap russian.jax /*russian-keymap* +russian-l18n russian.jax /*russian-l18n* +russian.txt russian.jax /*russian.txt* +rview starting.jax /*rview* +rvim starting.jax /*rvim* +rxvt syntax.jax /*rxvt* +s change.jax /*s* +s/\& change.jax /*s\/\\&* +s/\0 change.jax /*s\/\\0* +s/\1 change.jax /*s\/\\1* +s/\2 change.jax /*s\/\\2* +s/\3 change.jax /*s\/\\3* +s/\9 change.jax /*s\/\\9* +s/\<CR> change.jax /*s\/\\<CR>* +s/\= change.jax /*s\/\\=* +s/\E change.jax /*s\/\\E* +s/\L change.jax /*s\/\\L* +s/\U change.jax /*s\/\\U* +s/\\ change.jax /*s\/\\\\* +s/\b change.jax /*s\/\\b* +s/\e change.jax /*s\/\\e* +s/\l change.jax /*s\/\\l* +s/\n change.jax /*s\/\\n* +s/\r change.jax /*s\/\\r* +s/\t change.jax /*s\/\\t* +s/\u change.jax /*s\/\\u* +s/\~ change.jax /*s\/\\~* +s:netrw_passwd pi_netrw.jax /*s:netrw_passwd* +s:var eval.jax /*s:var* +s<CR> change.jax /*s<CR>* +sandbox eval.jax /*sandbox* +sandbox-option eval.jax /*sandbox-option* +save-file editing.jax /*save-file* +save-settings starting.jax /*save-settings* +scheme.vim syntax.jax /*scheme.vim* +scp pi_netrw.jax /*scp* +screenattr() eval.jax /*screenattr()* +screenchar() eval.jax /*screenchar()* +screencol() eval.jax /*screencol()* +screenrow() eval.jax /*screenrow()* +script usr_41.jax /*script* +script-here if_perl.jax /*script-here* +script-local map.jax /*script-local* +script-variable eval.jax /*script-variable* +scriptnames-dictionary eval.jax /*scriptnames-dictionary* +scriptout-changed version4.jax /*scriptout-changed* +scroll-binding scroll.jax /*scroll-binding* +scroll-cursor scroll.jax /*scroll-cursor* +scroll-down scroll.jax /*scroll-down* +scroll-horizontal scroll.jax /*scroll-horizontal* +scroll-insert tips.jax /*scroll-insert* +scroll-mouse-wheel scroll.jax /*scroll-mouse-wheel* +scroll-region term.jax /*scroll-region* +scroll-smooth tips.jax /*scroll-smooth* +scroll-up scroll.jax /*scroll-up* +scroll.txt scroll.jax /*scroll.txt* +scrollbind-quickadj scroll.jax /*scrollbind-quickadj* +scrollbind-relative scroll.jax /*scrollbind-relative* +scrolling scroll.jax /*scrolling* +scrollstart-variable eval.jax /*scrollstart-variable* +sdl.vim syntax.jax /*sdl.vim* +search() eval.jax /*search()* +search()-sub-match eval.jax /*search()-sub-match* +search-commands pattern.jax /*search-commands* +search-offset pattern.jax /*search-offset* +search-pattern pattern.jax /*search-pattern* +search-range pattern.jax /*search-range* +search-replace change.jax /*search-replace* +searchdecl() eval.jax /*searchdecl()* +searchforward-variable eval.jax /*searchforward-variable* +searchpair() eval.jax /*searchpair()* +searchpairpos() eval.jax /*searchpairpos()* +searchpos() eval.jax /*searchpos()* +section motion.jax /*section* +sed.vim syntax.jax /*sed.vim* +self eval.jax /*self* +send-money sponsor.jax /*send-money* +send-to-menu gui_w32.jax /*send-to-menu* +sendto gui_w32.jax /*sendto* +sentence motion.jax /*sentence* +server-functions usr_41.jax /*server-functions* +server2client() eval.jax /*server2client()* +serverlist() eval.jax /*serverlist()* +servername-variable eval.jax /*servername-variable* +session-file starting.jax /*session-file* +set-option options.jax /*set-option* +set-spc-auto spell.jax /*set-spc-auto* +setbufvar() eval.jax /*setbufvar()* +setcharsearch() eval.jax /*setcharsearch()* +setcmdpos() eval.jax /*setcmdpos()* +setfperm() eval.jax /*setfperm()* +setline() eval.jax /*setline()* +setloclist() eval.jax /*setloclist()* +setmatches() eval.jax /*setmatches()* +setpos() eval.jax /*setpos()* +setqflist() eval.jax /*setqflist()* +setreg() eval.jax /*setreg()* +settabvar() eval.jax /*settabvar()* +settabwinvar() eval.jax /*settabwinvar()* +setting-guifont gui.jax /*setting-guifont* +setting-guitablabel tabpage.jax /*setting-guitablabel* +setting-tabline tabpage.jax /*setting-tabline* +setuid change.jax /*setuid* +setwinvar() eval.jax /*setwinvar()* +sftp pi_netrw.jax /*sftp* +sgml.vim syntax.jax /*sgml.vim* +sgr-mouse options.jax /*sgr-mouse* +sh-awk syntax.jax /*sh-awk* +sh-embed syntax.jax /*sh-embed* +sh.vim syntax.jax /*sh.vim* +sha256() eval.jax /*sha256()* +shell-window tips.jax /*shell-window* +shell_error-variable eval.jax /*shell_error-variable* +shellescape() eval.jax /*shellescape()* +shift intro.jax /*shift* +shift-left-right change.jax /*shift-left-right* +shiftwidth() eval.jax /*shiftwidth()* +short-name-changed version4.jax /*short-name-changed* +showing-menus gui.jax /*showing-menus* +sign-commands sign.jax /*sign-commands* +sign-intro sign.jax /*sign-intro* +sign-support sign.jax /*sign-support* +sign.txt sign.jax /*sign.txt* +signs sign.jax /*signs* +simple-change change.jax /*simple-change* +simplify() eval.jax /*simplify()* +simulated-command vi_diff.jax /*simulated-command* +sin() eval.jax /*sin()* +single-repeat repeat.jax /*single-repeat* +sinh() eval.jax /*sinh()* +skeleton autocmd.jax /*skeleton* +skip_defaults_vim starting.jax /*skip_defaults_vim* +slice eval.jax /*slice* +slow-fast-terminal term.jax /*slow-fast-terminal* +slow-start starting.jax /*slow-start* +slow-terminal term.jax /*slow-terminal* +socket-interface channel.jax /*socket-interface* +sort() eval.jax /*sort()* +sorting change.jax /*sorting* +soundfold() eval.jax /*soundfold()* +space intro.jax /*space* +spec-customizing pi_spec.jax /*spec-customizing* +spec-how-to-use-it pi_spec.jax /*spec-how-to-use-it* +spec-setting-a-map pi_spec.jax /*spec-setting-a-map* +spec_chglog_format pi_spec.jax /*spec_chglog_format* +spec_chglog_prepend pi_spec.jax /*spec_chglog_prepend* +spec_chglog_release_info pi_spec.jax /*spec_chglog_release_info* +special-buffers windows.jax /*special-buffers* +speed-up tips.jax /*speed-up* +spell spell.jax /*spell* +spell-ACCENT spell.jax /*spell-ACCENT* +spell-AUTHOR spell.jax /*spell-AUTHOR* +spell-BAD spell.jax /*spell-BAD* +spell-BREAK spell.jax /*spell-BREAK* +spell-CHECKCOMPOUNDCASE spell.jax /*spell-CHECKCOMPOUNDCASE* +spell-CHECKCOMPOUNDDUP spell.jax /*spell-CHECKCOMPOUNDDUP* +spell-CHECKCOMPOUNDPATTERN spell.jax /*spell-CHECKCOMPOUNDPATTERN* +spell-CHECKCOMPOUNDREP spell.jax /*spell-CHECKCOMPOUNDREP* +spell-CHECKCOMPOUNDTRIPLE spell.jax /*spell-CHECKCOMPOUNDTRIPLE* +spell-CIRCUMFIX spell.jax /*spell-CIRCUMFIX* +spell-COMMON spell.jax /*spell-COMMON* +spell-COMPLEXPREFIXES spell.jax /*spell-COMPLEXPREFIXES* +spell-COMPOUND spell.jax /*spell-COMPOUND* +spell-COMPOUNDBEGIN spell.jax /*spell-COMPOUNDBEGIN* +spell-COMPOUNDEND spell.jax /*spell-COMPOUNDEND* +spell-COMPOUNDFIRST spell.jax /*spell-COMPOUNDFIRST* +spell-COMPOUNDFLAG spell.jax /*spell-COMPOUNDFLAG* +spell-COMPOUNDFORBIDFLAG spell.jax /*spell-COMPOUNDFORBIDFLAG* +spell-COMPOUNDMIDDLE spell.jax /*spell-COMPOUNDMIDDLE* +spell-COMPOUNDMIN spell.jax /*spell-COMPOUNDMIN* +spell-COMPOUNDPERMITFLAG spell.jax /*spell-COMPOUNDPERMITFLAG* +spell-COMPOUNDROOT spell.jax /*spell-COMPOUNDROOT* +spell-COMPOUNDRULE spell.jax /*spell-COMPOUNDRULE* +spell-COMPOUNDRULES spell.jax /*spell-COMPOUNDRULES* +spell-COMPOUNDSYLLABLE spell.jax /*spell-COMPOUNDSYLLABLE* +spell-COMPOUNDSYLMAX spell.jax /*spell-COMPOUNDSYLMAX* +spell-COMPOUNDWORDMAX spell.jax /*spell-COMPOUNDWORDMAX* +spell-COPYRIGHT spell.jax /*spell-COPYRIGHT* +spell-EMAIL spell.jax /*spell-EMAIL* +spell-FLAG spell.jax /*spell-FLAG* +spell-FOL spell.jax /*spell-FOL* +spell-FORBIDDENWORD spell.jax /*spell-FORBIDDENWORD* +spell-HOME spell.jax /*spell-HOME* +spell-IGNOREEXTRA spell.jax /*spell-IGNOREEXTRA* +spell-KEEPCASE spell.jax /*spell-KEEPCASE* +spell-KEY spell.jax /*spell-KEY* +spell-LANG spell.jax /*spell-LANG* +spell-LEMMA_PRESENT spell.jax /*spell-LEMMA_PRESENT* +spell-LOW spell.jax /*spell-LOW* +spell-MAP spell.jax /*spell-MAP* +spell-MAXNGRAMSUGS spell.jax /*spell-MAXNGRAMSUGS* +spell-NAME spell.jax /*spell-NAME* +spell-NEEDAFFIX spell.jax /*spell-NEEDAFFIX* +spell-NEEDCOMPOUND spell.jax /*spell-NEEDCOMPOUND* +spell-NOBREAK spell.jax /*spell-NOBREAK* +spell-NOCOMPOUNDSUGS spell.jax /*spell-NOCOMPOUNDSUGS* +spell-NOSPLITSUGS spell.jax /*spell-NOSPLITSUGS* +spell-NOSUGFILE spell.jax /*spell-NOSUGFILE* +spell-NOSUGGEST spell.jax /*spell-NOSUGGEST* +spell-ONLYINCOMPOUND spell.jax /*spell-ONLYINCOMPOUND* +spell-PFX spell.jax /*spell-PFX* +spell-PFXPOSTPONE spell.jax /*spell-PFXPOSTPONE* +spell-PSEUDOROOT spell.jax /*spell-PSEUDOROOT* +spell-RARE spell.jax /*spell-RARE* +spell-REP spell.jax /*spell-REP* +spell-SAL spell.jax /*spell-SAL* +spell-SET spell.jax /*spell-SET* +spell-SFX spell.jax /*spell-SFX* +spell-SLASH spell.jax /*spell-SLASH* +spell-SOFOFROM spell.jax /*spell-SOFOFROM* +spell-SOFOTO spell.jax /*spell-SOFOTO* +spell-SUGSWITHDOTS spell.jax /*spell-SUGSWITHDOTS* +spell-SYLLABLE spell.jax /*spell-SYLLABLE* +spell-SYLLABLENUM spell.jax /*spell-SYLLABLENUM* +spell-SpellFileMissing spell.jax /*spell-SpellFileMissing* +spell-TRY spell.jax /*spell-TRY* +spell-UPP spell.jax /*spell-UPP* +spell-VERSION spell.jax /*spell-VERSION* +spell-WORDCHARS spell.jax /*spell-WORDCHARS* +spell-aff-format spell.jax /*spell-aff-format* +spell-affix-chars spell.jax /*spell-affix-chars* +spell-affix-comment spell.jax /*spell-affix-comment* +spell-affix-flags spell.jax /*spell-affix-flags* +spell-affix-mbyte spell.jax /*spell-affix-mbyte* +spell-affix-not-supported spell.jax /*spell-affix-not-supported* +spell-affix-vim spell.jax /*spell-affix-vim* +spell-cjk spell.jax /*spell-cjk* +spell-compound spell.jax /*spell-compound* +spell-dic-format spell.jax /*spell-dic-format* +spell-double-scoring spell.jax /*spell-double-scoring* +spell-file-format spell.jax /*spell-file-format* +spell-functions usr_41.jax /*spell-functions* +spell-german spell.jax /*spell-german* +spell-load spell.jax /*spell-load* +spell-midword spell.jax /*spell-midword* +spell-mkspell spell.jax /*spell-mkspell* +spell-quickstart spell.jax /*spell-quickstart* +spell-remarks spell.jax /*spell-remarks* +spell-russian spell.jax /*spell-russian* +spell-sug-file spell.jax /*spell-sug-file* +spell-syntax spell.jax /*spell-syntax* +spell-wordlist-format spell.jax /*spell-wordlist-format* +spell-yiddish spell.jax /*spell-yiddish* +spell.txt spell.jax /*spell.txt* +spellbadword() eval.jax /*spellbadword()* +spellfile-cleanup spell.jax /*spellfile-cleanup* +spellfile.vim spell.jax /*spellfile.vim* +spellsuggest() eval.jax /*spellsuggest()* +split() eval.jax /*split()* +splitfind windows.jax /*splitfind* +splitview windows.jax /*splitview* +sponsor sponsor.jax /*sponsor* +sponsor-faq sponsor.jax /*sponsor-faq* +sponsor.txt sponsor.jax /*sponsor.txt* +spoon os_unix.jax /*spoon* +spup.vim syntax.jax /*spup.vim* +sql-adding-dialects ft_sql.jax /*sql-adding-dialects* +sql-completion ft_sql.jax /*sql-completion* +sql-completion-columns ft_sql.jax /*sql-completion-columns* +sql-completion-customization ft_sql.jax /*sql-completion-customization* +sql-completion-dynamic ft_sql.jax /*sql-completion-dynamic* +sql-completion-filetypes ft_sql.jax /*sql-completion-filetypes* +sql-completion-maps ft_sql.jax /*sql-completion-maps* +sql-completion-procedures ft_sql.jax /*sql-completion-procedures* +sql-completion-static ft_sql.jax /*sql-completion-static* +sql-completion-tables ft_sql.jax /*sql-completion-tables* +sql-completion-tutorial ft_sql.jax /*sql-completion-tutorial* +sql-completion-views ft_sql.jax /*sql-completion-views* +sql-dialects ft_sql.jax /*sql-dialects* +sql-macros ft_sql.jax /*sql-macros* +sql-matchit ft_sql.jax /*sql-matchit* +sql-navigation ft_sql.jax /*sql-navigation* +sql-object-motions ft_sql.jax /*sql-object-motions* +sql-predefined-objects ft_sql.jax /*sql-predefined-objects* +sql-type-default ft_sql.jax /*sql-type-default* +sql-types ft_sql.jax /*sql-types* +sql.vim syntax.jax /*sql.vim* +sqlanywhere ft_sql.jax /*sqlanywhere* +sqlanywhere.vim syntax.jax /*sqlanywhere.vim* +sqlgettype ft_sql.jax /*sqlgettype* +sqlinformix.vim syntax.jax /*sqlinformix.vim* +sqlj ft_sql.jax /*sqlj* +sqlserver ft_sql.jax /*sqlserver* +sqlsettype ft_sql.jax /*sqlsettype* +sqrt() eval.jax /*sqrt()* +sscanf eval.jax /*sscanf* +standard-plugin usr_05.jax /*standard-plugin* +standard-plugin-list help.jax /*standard-plugin-list* +standout syntax.jax /*standout* +star pattern.jax /*star* +starstar editing.jax /*starstar* +starstar-wildcard editing.jax /*starstar-wildcard* +start-of-file pattern.jax /*start-of-file* +starting starting.jax /*starting* +starting-amiga starting.jax /*starting-amiga* +starting.txt starting.jax /*starting.txt* +startup starting.jax /*startup* +startup-options starting.jax /*startup-options* +startup-terminal term.jax /*startup-terminal* +static-tag tagsrch.jax /*static-tag* +status-line windows.jax /*status-line* +statusmsg-variable eval.jax /*statusmsg-variable* +str2float() eval.jax /*str2float()* +str2nr() eval.jax /*str2nr()* +strcasestr() eval.jax /*strcasestr()* +strcharpart() eval.jax /*strcharpart()* +strchars() eval.jax /*strchars()* +strchr() eval.jax /*strchr()* +strcspn() eval.jax /*strcspn()* +strdisplaywidth() eval.jax /*strdisplaywidth()* +strftime() eval.jax /*strftime()* +strgetchar() eval.jax /*strgetchar()* +stridx() eval.jax /*stridx()* +string eval.jax /*string* +string() eval.jax /*string()* +string-functions usr_41.jax /*string-functions* +string-match eval.jax /*string-match* +strlen() eval.jax /*strlen()* +strpart() eval.jax /*strpart()* +strpbrk() eval.jax /*strpbrk()* +strrchr() eval.jax /*strrchr()* +strridx() eval.jax /*strridx()* +strspn() eval.jax /*strspn()* +strstr() eval.jax /*strstr()* +strtrans() eval.jax /*strtrans()* +strwidth() eval.jax /*strwidth()* +style-changes develop.jax /*style-changes* +style-compiler develop.jax /*style-compiler* +style-examples develop.jax /*style-examples* +style-functions develop.jax /*style-functions* +style-names develop.jax /*style-names* +style-spaces develop.jax /*style-spaces* +style-various develop.jax /*style-various* +sub-menu-priority gui.jax /*sub-menu-priority* +sub-replace-\= change.jax /*sub-replace-\\=* +sub-replace-expression change.jax /*sub-replace-expression* +sub-replace-special change.jax /*sub-replace-special* +sublist eval.jax /*sublist* +submatch() eval.jax /*submatch()* +subscribe-maillist intro.jax /*subscribe-maillist* +subscript eval.jax /*subscript* +substitute() eval.jax /*substitute()* +suffixes cmdline.jax /*suffixes* +suspend starting.jax /*suspend* +swap-exists-choices usr_11.jax /*swap-exists-choices* +swap-file recover.jax /*swap-file* +swapchoice-variable eval.jax /*swapchoice-variable* +swapcommand-variable eval.jax /*swapcommand-variable* +swapfile-changed version4.jax /*swapfile-changed* +swapname-variable eval.jax /*swapname-variable* +sybase ft_sql.jax /*sybase* +syn-sync-grouphere syntax.jax /*syn-sync-grouphere* +syn-sync-groupthere syntax.jax /*syn-sync-groupthere* +syn-sync-linecont syntax.jax /*syn-sync-linecont* +synID() eval.jax /*synID()* +synIDattr() eval.jax /*synIDattr()* +synIDtrans() eval.jax /*synIDtrans()* +syncbind scroll.jax /*syncbind* +syncolor syntax.jax /*syncolor* +synconcealed() eval.jax /*synconcealed()* +synload-1 syntax.jax /*synload-1* +synload-2 syntax.jax /*synload-2* +synload-3 syntax.jax /*synload-3* +synload-4 syntax.jax /*synload-4* +synload-5 syntax.jax /*synload-5* +synload-6 syntax.jax /*synload-6* +synstack() eval.jax /*synstack()* +syntax syntax.jax /*syntax* +syntax-functions usr_41.jax /*syntax-functions* +syntax-highlighting syntax.jax /*syntax-highlighting* +syntax-loading syntax.jax /*syntax-loading* +syntax-printing usr_06.jax /*syntax-printing* +syntax.txt syntax.jax /*syntax.txt* +syntax_cmd syntax.jax /*syntax_cmd* +sys-file-list help.jax /*sys-file-list* +sysmouse term.jax /*sysmouse* +system() eval.jax /*system()* +system-functions usr_41.jax /*system-functions* +system-vimrc starting.jax /*system-vimrc* +systemlist() eval.jax /*systemlist()* +s~ change.jax /*s~* +t motion.jax /*t* +t: eval.jax /*t:* +t:var eval.jax /*t:var* +t_#2 term.jax /*t_#2* +t_#4 term.jax /*t_#4* +t_%1 term.jax /*t_%1* +t_%i term.jax /*t_%i* +t_&8 term.jax /*t_&8* +t_8b term.jax /*t_8b* +t_8f term.jax /*t_8f* +t_@7 term.jax /*t_@7* +t_AB term.jax /*t_AB* +t_AF term.jax /*t_AF* +t_AL term.jax /*t_AL* +t_BD term.jax /*t_BD* +t_BE term.jax /*t_BE* +t_CS term.jax /*t_CS* +t_CV term.jax /*t_CV* +t_Ce term.jax /*t_Ce* +t_Co term.jax /*t_Co* +t_Cs term.jax /*t_Cs* +t_DL term.jax /*t_DL* +t_EI term.jax /*t_EI* +t_F1 term.jax /*t_F1* +t_F2 term.jax /*t_F2* +t_F3 term.jax /*t_F3* +t_F4 term.jax /*t_F4* +t_F5 term.jax /*t_F5* +t_F6 term.jax /*t_F6* +t_F7 term.jax /*t_F7* +t_F8 term.jax /*t_F8* +t_F9 term.jax /*t_F9* +t_IE term.jax /*t_IE* +t_IS term.jax /*t_IS* +t_K1 term.jax /*t_K1* +t_K3 term.jax /*t_K3* +t_K4 term.jax /*t_K4* +t_K5 term.jax /*t_K5* +t_K6 term.jax /*t_K6* +t_K7 term.jax /*t_K7* +t_K8 term.jax /*t_K8* +t_K9 term.jax /*t_K9* +t_KA term.jax /*t_KA* +t_KB term.jax /*t_KB* +t_KC term.jax /*t_KC* +t_KD term.jax /*t_KD* +t_KE term.jax /*t_KE* +t_KF term.jax /*t_KF* +t_KG term.jax /*t_KG* +t_KH term.jax /*t_KH* +t_KI term.jax /*t_KI* +t_KJ term.jax /*t_KJ* +t_KK term.jax /*t_KK* +t_KL term.jax /*t_KL* +t_PE term.jax /*t_PE* +t_PS term.jax /*t_PS* +t_RB term.jax /*t_RB* +t_RI term.jax /*t_RI* +t_RV term.jax /*t_RV* +t_SI term.jax /*t_SI* +t_SR term.jax /*t_SR* +t_Sb term.jax /*t_Sb* +t_Sf term.jax /*t_Sf* +t_WP term.jax /*t_WP* +t_WS term.jax /*t_WS* +t_ZH term.jax /*t_ZH* +t_ZR term.jax /*t_ZR* +t_al term.jax /*t_al* +t_bc term.jax /*t_bc* +t_bool-variable eval.jax /*t_bool-variable* +t_cd term.jax /*t_cd* +t_cdl version4.jax /*t_cdl* +t_ce term.jax /*t_ce* +t_channel-variable eval.jax /*t_channel-variable* +t_ci version4.jax /*t_ci* +t_cil version4.jax /*t_cil* +t_cl term.jax /*t_cl* +t_cm term.jax /*t_cm* +t_cri version4.jax /*t_cri* +t_cs term.jax /*t_cs* +t_csc version4.jax /*t_csc* +t_cv version4.jax /*t_cv* +t_cvv version4.jax /*t_cvv* +t_da term.jax /*t_da* +t_db term.jax /*t_db* +t_dict-variable eval.jax /*t_dict-variable* +t_dl term.jax /*t_dl* +t_ed version4.jax /*t_ed* +t_el version4.jax /*t_el* +t_f1 version4.jax /*t_f1* +t_f10 version4.jax /*t_f10* +t_f2 version4.jax /*t_f2* +t_f3 version4.jax /*t_f3* +t_f4 version4.jax /*t_f4* +t_f5 version4.jax /*t_f5* +t_f6 version4.jax /*t_f6* +t_f7 version4.jax /*t_f7* +t_f8 version4.jax /*t_f8* +t_f9 version4.jax /*t_f9* +t_float-variable eval.jax /*t_float-variable* +t_fs term.jax /*t_fs* +t_func-variable eval.jax /*t_func-variable* +t_help version4.jax /*t_help* +t_il version4.jax /*t_il* +t_job-variable eval.jax /*t_job-variable* +t_k1 term.jax /*t_k1* +t_k2 term.jax /*t_k2* +t_k3 term.jax /*t_k3* +t_k4 term.jax /*t_k4* +t_k5 term.jax /*t_k5* +t_k6 term.jax /*t_k6* +t_k7 term.jax /*t_k7* +t_k8 term.jax /*t_k8* +t_k9 term.jax /*t_k9* +t_k; term.jax /*t_k;* +t_kB term.jax /*t_kB* +t_kD term.jax /*t_kD* +t_kI term.jax /*t_kI* +t_kN term.jax /*t_kN* +t_kP term.jax /*t_kP* +t_kb term.jax /*t_kb* +t_kd term.jax /*t_kd* +t_ke term.jax /*t_ke* +t_kh term.jax /*t_kh* +t_kl term.jax /*t_kl* +t_kr term.jax /*t_kr* +t_ks term.jax /*t_ks* +t_ku term.jax /*t_ku* +t_le term.jax /*t_le* +t_list-variable eval.jax /*t_list-variable* +t_mb term.jax /*t_mb* +t_md term.jax /*t_md* +t_me term.jax /*t_me* +t_mr term.jax /*t_mr* +t_ms term.jax /*t_ms* +t_nd term.jax /*t_nd* +t_none-variable eval.jax /*t_none-variable* +t_number-variable eval.jax /*t_number-variable* +t_op term.jax /*t_op* +t_se term.jax /*t_se* +t_sf1 version4.jax /*t_sf1* +t_sf10 version4.jax /*t_sf10* +t_sf2 version4.jax /*t_sf2* +t_sf3 version4.jax /*t_sf3* +t_sf4 version4.jax /*t_sf4* +t_sf5 version4.jax /*t_sf5* +t_sf6 version4.jax /*t_sf6* +t_sf7 version4.jax /*t_sf7* +t_sf8 version4.jax /*t_sf8* +t_sf9 version4.jax /*t_sf9* +t_skd version4.jax /*t_skd* +t_skl version4.jax /*t_skl* +t_skr version4.jax /*t_skr* +t_sku version4.jax /*t_sku* +t_so term.jax /*t_so* +t_sr term.jax /*t_sr* +t_star7 term.jax /*t_star7* +t_string-variable eval.jax /*t_string-variable* +t_tb version4.jax /*t_tb* +t_te term.jax /*t_te* +t_ti term.jax /*t_ti* +t_tp version4.jax /*t_tp* +t_ts term.jax /*t_ts* +t_ts_old version4.jax /*t_ts_old* +t_u7 term.jax /*t_u7* +t_ue term.jax /*t_ue* +t_undo version4.jax /*t_undo* +t_us term.jax /*t_us* +t_ut term.jax /*t_ut* +t_vb term.jax /*t_vb* +t_ve term.jax /*t_ve* +t_vi term.jax /*t_vi* +t_vs term.jax /*t_vs* +t_xn term.jax /*t_xn* +t_xs term.jax /*t_xs* +tab intro.jax /*tab* +tab-page tabpage.jax /*tab-page* +tab-page-commands tabpage.jax /*tab-page-commands* +tab-page-intro tabpage.jax /*tab-page-intro* +tab-page-other tabpage.jax /*tab-page-other* +tabline-menu tabpage.jax /*tabline-menu* +tabnew-autocmd tabpage.jax /*tabnew-autocmd* +tabpage tabpage.jax /*tabpage* +tabpage-variable eval.jax /*tabpage-variable* +tabpage.txt tabpage.jax /*tabpage.txt* +tabpagebuflist() eval.jax /*tabpagebuflist()* +tabpagenr() eval.jax /*tabpagenr()* +tabpagewinnr() eval.jax /*tabpagewinnr()* +tag tagsrch.jax /*tag* +tag-! tagsrch.jax /*tag-!* +tag-any-white tagsrch.jax /*tag-any-white* +tag-binary-search tagsrch.jax /*tag-binary-search* +tag-blocks motion.jax /*tag-blocks* +tag-commands tagsrch.jax /*tag-commands* +tag-details tagsrch.jax /*tag-details* +tag-highlight syntax.jax /*tag-highlight* +tag-matchlist tagsrch.jax /*tag-matchlist* +tag-old-static tagsrch.jax /*tag-old-static* +tag-preview tagsrch.jax /*tag-preview* +tag-priority tagsrch.jax /*tag-priority* +tag-regexp tagsrch.jax /*tag-regexp* +tag-search tagsrch.jax /*tag-search* +tag-security tagsrch.jax /*tag-security* +tag-skip-file tagsrch.jax /*tag-skip-file* +tag-stack tagsrch.jax /*tag-stack* +tagfiles() eval.jax /*tagfiles()* +taglist() eval.jax /*taglist()* +tags tagsrch.jax /*tags* +tags-and-searches tagsrch.jax /*tags-and-searches* +tags-file-format tagsrch.jax /*tags-file-format* +tags-option tagsrch.jax /*tags-option* +tagsrch.txt tagsrch.jax /*tagsrch.txt* +tagstack tagsrch.jax /*tagstack* +tan() eval.jax /*tan()* +tanh() eval.jax /*tanh()* +tar pi_tar.jax /*tar* +tar-contents pi_tar.jax /*tar-contents* +tar-copyright pi_tar.jax /*tar-copyright* +tar-history pi_tar.jax /*tar-history* +tar-manual pi_tar.jax /*tar-manual* +tar-options pi_tar.jax /*tar-options* +tar-usage pi_tar.jax /*tar-usage* +tcl if_tcl.jax /*tcl* +tcl-beep if_tcl.jax /*tcl-beep* +tcl-buffer if_tcl.jax /*tcl-buffer* +tcl-buffer-append if_tcl.jax /*tcl-buffer-append* +tcl-buffer-cmds if_tcl.jax /*tcl-buffer-cmds* +tcl-buffer-command if_tcl.jax /*tcl-buffer-command* +tcl-buffer-count if_tcl.jax /*tcl-buffer-count* +tcl-buffer-delcmd if_tcl.jax /*tcl-buffer-delcmd* +tcl-buffer-delete if_tcl.jax /*tcl-buffer-delete* +tcl-buffer-expr if_tcl.jax /*tcl-buffer-expr* +tcl-buffer-get if_tcl.jax /*tcl-buffer-get* +tcl-buffer-insert if_tcl.jax /*tcl-buffer-insert* +tcl-buffer-last if_tcl.jax /*tcl-buffer-last* +tcl-buffer-mark if_tcl.jax /*tcl-buffer-mark* +tcl-buffer-option if_tcl.jax /*tcl-buffer-option* +tcl-buffer-set if_tcl.jax /*tcl-buffer-set* +tcl-buffer-windows if_tcl.jax /*tcl-buffer-windows* +tcl-bugs if_tcl.jax /*tcl-bugs* +tcl-command if_tcl.jax /*tcl-command* +tcl-commands if_tcl.jax /*tcl-commands* +tcl-dynamic if_tcl.jax /*tcl-dynamic* +tcl-ex-commands if_tcl.jax /*tcl-ex-commands* +tcl-examples if_tcl.jax /*tcl-examples* +tcl-expr if_tcl.jax /*tcl-expr* +tcl-linenumbers if_tcl.jax /*tcl-linenumbers* +tcl-misc if_tcl.jax /*tcl-misc* +tcl-option if_tcl.jax /*tcl-option* +tcl-output if_tcl.jax /*tcl-output* +tcl-var-current if_tcl.jax /*tcl-var-current* +tcl-var-lbase if_tcl.jax /*tcl-var-lbase* +tcl-var-line if_tcl.jax /*tcl-var-line* +tcl-var-lnum if_tcl.jax /*tcl-var-lnum* +tcl-var-range if_tcl.jax /*tcl-var-range* +tcl-variables if_tcl.jax /*tcl-variables* +tcl-window if_tcl.jax /*tcl-window* +tcl-window-buffer if_tcl.jax /*tcl-window-buffer* +tcl-window-cmds if_tcl.jax /*tcl-window-cmds* +tcl-window-command if_tcl.jax /*tcl-window-command* +tcl-window-cursor if_tcl.jax /*tcl-window-cursor* +tcl-window-delcmd if_tcl.jax /*tcl-window-delcmd* +tcl-window-expr if_tcl.jax /*tcl-window-expr* +tcl-window-height if_tcl.jax /*tcl-window-height* +tcl-window-option if_tcl.jax /*tcl-window-option* +tcsh-style cmdline.jax /*tcsh-style* +tcsh.vim syntax.jax /*tcsh.vim* +tear-off-menus gui.jax /*tear-off-menus* +telnet-CTRL-] tagsrch.jax /*telnet-CTRL-]* +temp-file-name eval.jax /*temp-file-name* +tempfile change.jax /*tempfile* +template autocmd.jax /*template* +tempname() eval.jax /*tempname()* +term-dependent-settings term.jax /*term-dependent-settings* +term-list syntax.jax /*term-list* +term.txt term.jax /*term.txt* +termcap term.jax /*termcap* +termcap-changed version4.jax /*termcap-changed* +termcap-colors term.jax /*termcap-colors* +termcap-cursor-color term.jax /*termcap-cursor-color* +termcap-cursor-shape term.jax /*termcap-cursor-shape* +termcap-options term.jax /*termcap-options* +termcap-title term.jax /*termcap-title* +terminal-colors os_unix.jax /*terminal-colors* +terminal-info term.jax /*terminal-info* +terminal-key-codes term.jax /*terminal-key-codes* +terminal-options term.jax /*terminal-options* +terminal-output-codes term.jax /*terminal-output-codes* +terminfo term.jax /*terminfo* +termresponse-variable eval.jax /*termresponse-variable* +test-functions usr_41.jax /*test-functions* +test_alloc_fail() eval.jax /*test_alloc_fail()* +test_autochdir() eval.jax /*test_autochdir()* +test_garbagecollect_now() eval.jax /*test_garbagecollect_now()* +test_ignore_error() eval.jax /*test_ignore_error()* +test_null_channel() eval.jax /*test_null_channel()* +test_null_dict() eval.jax /*test_null_dict()* +test_null_job() eval.jax /*test_null_job()* +test_null_list() eval.jax /*test_null_list()* +test_null_partial() eval.jax /*test_null_partial()* +test_null_string() eval.jax /*test_null_string()* +test_override() eval.jax /*test_override()* +test_settime() eval.jax /*test_settime()* +testing eval.jax /*testing* +testing-variable eval.jax /*testing-variable* +tex-cchar syntax.jax /*tex-cchar* +tex-cole syntax.jax /*tex-cole* +tex-conceal syntax.jax /*tex-conceal* +tex-error syntax.jax /*tex-error* +tex-folding syntax.jax /*tex-folding* +tex-math syntax.jax /*tex-math* +tex-morecommands syntax.jax /*tex-morecommands* +tex-nospell syntax.jax /*tex-nospell* +tex-package syntax.jax /*tex-package* +tex-runon syntax.jax /*tex-runon* +tex-slow syntax.jax /*tex-slow* +tex-stopzone syntax.jax /*tex-stopzone* +tex-style syntax.jax /*tex-style* +tex-supersub syntax.jax /*tex-supersub* +tex-sync syntax.jax /*tex-sync* +tex-verb syntax.jax /*tex-verb* +tex.vim syntax.jax /*tex.vim* +text-functions usr_41.jax /*text-functions* +text-objects motion.jax /*text-objects* +textlock eval.jax /*textlock* +tf.vim syntax.jax /*tf.vim* +this_session-variable eval.jax /*this_session-variable* +throw-catch eval.jax /*throw-catch* +throw-expression eval.jax /*throw-expression* +throw-from-catch eval.jax /*throw-from-catch* +throw-variables eval.jax /*throw-variables* +throwpoint-variable eval.jax /*throwpoint-variable* +time-functions usr_41.jax /*time-functions* +timer eval.jax /*timer* +timer-functions usr_41.jax /*timer-functions* +timer_info() eval.jax /*timer_info()* +timer_pause() eval.jax /*timer_pause()* +timer_start() eval.jax /*timer_start()* +timer_stop() eval.jax /*timer_stop()* +timer_stopall() eval.jax /*timer_stopall()* +timers eval.jax /*timers* +timestamp editing.jax /*timestamp* +timestamps editing.jax /*timestamps* +tips tips.jax /*tips* +tips.txt tips.jax /*tips.txt* +toggle options.jax /*toggle* +toggle-revins version4.jax /*toggle-revins* +tolower() eval.jax /*tolower()* +toolbar-icon gui.jax /*toolbar-icon* +toupper() eval.jax /*toupper()* +tr() eval.jax /*tr()* +trojan-horse starting.jax /*trojan-horse* +true-variable eval.jax /*true-variable* +trunc() eval.jax /*trunc()* +try-conditionals eval.jax /*try-conditionals* +try-echoerr eval.jax /*try-echoerr* +try-finally eval.jax /*try-finally* +try-nested eval.jax /*try-nested* +try-nesting eval.jax /*try-nesting* +tutor usr_01.jax /*tutor* +two-engines pattern.jax /*two-engines* +type() eval.jax /*type()* +type-mistakes tips.jax /*type-mistakes* +typecorr-settings usr_41.jax /*typecorr-settings* +typecorr.txt usr_41.jax /*typecorr.txt* +u undo.jax /*u* +uganda uganda.jax /*uganda* +uganda.txt uganda.jax /*uganda.txt* +undercurl syntax.jax /*undercurl* +underline syntax.jax /*underline* +undo undo.jax /*undo* +undo-blocks undo.jax /*undo-blocks* +undo-branches undo.jax /*undo-branches* +undo-commands undo.jax /*undo-commands* +undo-persistence undo.jax /*undo-persistence* +undo-redo undo.jax /*undo-redo* +undo-remarks undo.jax /*undo-remarks* +undo-tree undo.jax /*undo-tree* +undo-two-ways undo.jax /*undo-two-ways* +undo.txt undo.jax /*undo.txt* +undo_ftplugin usr_41.jax /*undo_ftplugin* +undo_indent usr_41.jax /*undo_indent* +undofile() eval.jax /*undofile()* +undotree() eval.jax /*undotree()* +unicode mbyte.jax /*unicode* +uniq() eval.jax /*uniq()* +unix os_unix.jax /*unix* +unlisted-buffer windows.jax /*unlisted-buffer* +up-down-motions motion.jax /*up-down-motions* +uppercase change.jax /*uppercase* +urxvt-mouse options.jax /*urxvt-mouse* +use-cpo-save usr_41.jax /*use-cpo-save* +use-visual-cmds version4.jax /*use-visual-cmds* +useful-mappings tips.jax /*useful-mappings* +usenet intro.jax /*usenet* +user-cmd-ambiguous map.jax /*user-cmd-ambiguous* +user-commands map.jax /*user-commands* +user-functions eval.jax /*user-functions* +user-manual usr_toc.jax /*user-manual* +using-<Plug> usr_41.jax /*using-<Plug>* +using-menus gui.jax /*using-menus* +using-scripts repeat.jax /*using-scripts* +using-xxd tips.jax /*using-xxd* +using_CTRL-V map.jax /*using_CTRL-V* +usr_01.txt usr_01.jax /*usr_01.txt* +usr_02.txt usr_02.jax /*usr_02.txt* +usr_03.txt usr_03.jax /*usr_03.txt* +usr_04.txt usr_04.jax /*usr_04.txt* +usr_05.txt usr_05.jax /*usr_05.txt* +usr_06.txt usr_06.jax /*usr_06.txt* +usr_07.txt usr_07.jax /*usr_07.txt* +usr_08.txt usr_08.jax /*usr_08.txt* +usr_09.txt usr_09.jax /*usr_09.txt* +usr_10.txt usr_10.jax /*usr_10.txt* +usr_11.txt usr_11.jax /*usr_11.txt* +usr_12.txt usr_12.jax /*usr_12.txt* +usr_20.txt usr_20.jax /*usr_20.txt* +usr_21.txt usr_21.jax /*usr_21.txt* +usr_22.txt usr_22.jax /*usr_22.txt* +usr_23.txt usr_23.jax /*usr_23.txt* +usr_24.txt usr_24.jax /*usr_24.txt* +usr_25.txt usr_25.jax /*usr_25.txt* +usr_26.txt usr_26.jax /*usr_26.txt* +usr_27.txt usr_27.jax /*usr_27.txt* +usr_28.txt usr_28.jax /*usr_28.txt* +usr_29.txt usr_29.jax /*usr_29.txt* +usr_30.txt usr_30.jax /*usr_30.txt* +usr_31.txt usr_31.jax /*usr_31.txt* +usr_32.txt usr_32.jax /*usr_32.txt* +usr_40.txt usr_40.jax /*usr_40.txt* +usr_41.txt usr_41.jax /*usr_41.txt* +usr_42.txt usr_42.jax /*usr_42.txt* +usr_43.txt usr_43.jax /*usr_43.txt* +usr_44.txt usr_44.jax /*usr_44.txt* +usr_45.txt usr_45.jax /*usr_45.txt* +usr_90.txt usr_90.jax /*usr_90.txt* +usr_toc.txt usr_toc.jax /*usr_toc.txt* +utf-8 mbyte.jax /*utf-8* +utf-8-char-arg mbyte.jax /*utf-8-char-arg* +utf-8-in-xwindows mbyte.jax /*utf-8-in-xwindows* +utf-8-typing mbyte.jax /*utf-8-typing* +utf8 mbyte.jax /*utf8* +v visual.jax /*v* +v: eval.jax /*v:* +v:beval_bufnr eval.jax /*v:beval_bufnr* +v:beval_col eval.jax /*v:beval_col* +v:beval_lnum eval.jax /*v:beval_lnum* +v:beval_text eval.jax /*v:beval_text* +v:beval_winid eval.jax /*v:beval_winid* +v:beval_winnr eval.jax /*v:beval_winnr* +v:char eval.jax /*v:char* +v:charconvert_from eval.jax /*v:charconvert_from* +v:charconvert_to eval.jax /*v:charconvert_to* +v:cmdarg eval.jax /*v:cmdarg* +v:cmdbang eval.jax /*v:cmdbang* +v:completed_item eval.jax /*v:completed_item* +v:count eval.jax /*v:count* +v:count1 eval.jax /*v:count1* +v:ctype eval.jax /*v:ctype* +v:dying eval.jax /*v:dying* +v:errmsg eval.jax /*v:errmsg* +v:errors eval.jax /*v:errors* +v:exception eval.jax /*v:exception* +v:false eval.jax /*v:false* +v:fcs_choice eval.jax /*v:fcs_choice* +v:fcs_reason eval.jax /*v:fcs_reason* +v:fname_diff eval.jax /*v:fname_diff* +v:fname_in eval.jax /*v:fname_in* +v:fname_new eval.jax /*v:fname_new* +v:fname_out eval.jax /*v:fname_out* +v:folddashes eval.jax /*v:folddashes* +v:foldend eval.jax /*v:foldend* +v:foldlevel eval.jax /*v:foldlevel* +v:foldstart eval.jax /*v:foldstart* +v:hlsearch eval.jax /*v:hlsearch* +v:insertmode eval.jax /*v:insertmode* +v:key eval.jax /*v:key* +v:lang eval.jax /*v:lang* +v:lc_time eval.jax /*v:lc_time* +v:lnum eval.jax /*v:lnum* +v:mouse_col eval.jax /*v:mouse_col* +v:mouse_lnum eval.jax /*v:mouse_lnum* +v:mouse_win eval.jax /*v:mouse_win* +v:mouse_winid eval.jax /*v:mouse_winid* +v:none eval.jax /*v:none* +v:null eval.jax /*v:null* +v:oldfiles eval.jax /*v:oldfiles* +v:operator eval.jax /*v:operator* +v:option_new eval.jax /*v:option_new* +v:option_old eval.jax /*v:option_old* +v:option_type eval.jax /*v:option_type* +v:prevcount eval.jax /*v:prevcount* +v:profiling eval.jax /*v:profiling* +v:progname eval.jax /*v:progname* +v:progpath eval.jax /*v:progpath* +v:register eval.jax /*v:register* +v:scrollstart eval.jax /*v:scrollstart* +v:searchforward eval.jax /*v:searchforward* +v:servername eval.jax /*v:servername* +v:shell_error eval.jax /*v:shell_error* +v:statusmsg eval.jax /*v:statusmsg* +v:swapchoice eval.jax /*v:swapchoice* +v:swapcommand eval.jax /*v:swapcommand* +v:swapname eval.jax /*v:swapname* +v:t_TYPE eval.jax /*v:t_TYPE* +v:t_bool eval.jax /*v:t_bool* +v:t_channel eval.jax /*v:t_channel* +v:t_dict eval.jax /*v:t_dict* +v:t_float eval.jax /*v:t_float* +v:t_func eval.jax /*v:t_func* +v:t_job eval.jax /*v:t_job* +v:t_list eval.jax /*v:t_list* +v:t_none eval.jax /*v:t_none* +v:t_number eval.jax /*v:t_number* +v:t_string eval.jax /*v:t_string* +v:termresponse eval.jax /*v:termresponse* +v:testing eval.jax /*v:testing* +v:this_session eval.jax /*v:this_session* +v:throwpoint eval.jax /*v:throwpoint* +v:true eval.jax /*v:true* +v:val eval.jax /*v:val* +v:var eval.jax /*v:var* +v:version eval.jax /*v:version* +v:vim_did_enter eval.jax /*v:vim_did_enter* +v:warningmsg eval.jax /*v:warningmsg* +v:windowid eval.jax /*v:windowid* +v_! change.jax /*v_!* +v_$ visual.jax /*v_$* +v_: cmdline.jax /*v_:* +v_< change.jax /*v_<* +v_<BS> change.jax /*v_<BS>* +v_<Del> change.jax /*v_<Del>* +v_<Esc> visual.jax /*v_<Esc>* +v_= change.jax /*v_=* +v_> change.jax /*v_>* +v_C change.jax /*v_C* +v_CTRL-A change.jax /*v_CTRL-A* +v_CTRL-C visual.jax /*v_CTRL-C* +v_CTRL-G visual.jax /*v_CTRL-G* +v_CTRL-H change.jax /*v_CTRL-H* +v_CTRL-O visual.jax /*v_CTRL-O* +v_CTRL-V visual.jax /*v_CTRL-V* +v_CTRL-X change.jax /*v_CTRL-X* +v_CTRL-Z starting.jax /*v_CTRL-Z* +v_CTRL-\_CTRL-G intro.jax /*v_CTRL-\\_CTRL-G* +v_CTRL-\_CTRL-N intro.jax /*v_CTRL-\\_CTRL-N* +v_CTRL-] tagsrch.jax /*v_CTRL-]* +v_D change.jax /*v_D* +v_J change.jax /*v_J* +v_K various.jax /*v_K* +v_O visual.jax /*v_O* +v_P change.jax /*v_P* +v_R change.jax /*v_R* +v_S change.jax /*v_S* +v_U change.jax /*v_U* +v_V visual.jax /*v_V* +v_X change.jax /*v_X* +v_Y change.jax /*v_Y* +v_a motion.jax /*v_a* +v_a' motion.jax /*v_a'* +v_a( motion.jax /*v_a(* +v_a) motion.jax /*v_a)* +v_a< motion.jax /*v_a<* +v_a> motion.jax /*v_a>* +v_aB motion.jax /*v_aB* +v_aW motion.jax /*v_aW* +v_a[ motion.jax /*v_a[* +v_a] motion.jax /*v_a]* +v_a` motion.jax /*v_a`* +v_ab motion.jax /*v_ab* +v_ap motion.jax /*v_ap* +v_aquote motion.jax /*v_aquote* +v_as motion.jax /*v_as* +v_at motion.jax /*v_at* +v_aw motion.jax /*v_aw* +v_a{ motion.jax /*v_a{* +v_a} motion.jax /*v_a}* +v_b_< visual.jax /*v_b_<* +v_b_<_example visual.jax /*v_b_<_example* +v_b_> visual.jax /*v_b_>* +v_b_>_example visual.jax /*v_b_>_example* +v_b_A visual.jax /*v_b_A* +v_b_A_example visual.jax /*v_b_A_example* +v_b_C visual.jax /*v_b_C* +v_b_D change.jax /*v_b_D* +v_b_I visual.jax /*v_b_I* +v_b_I_example visual.jax /*v_b_I_example* +v_b_c visual.jax /*v_b_c* +v_b_r visual.jax /*v_b_r* +v_b_r_example visual.jax /*v_b_r_example* +v_c change.jax /*v_c* +v_d change.jax /*v_d* +v_g? change.jax /*v_g?* +v_gF editing.jax /*v_gF* +v_gJ change.jax /*v_gJ* +v_gN visual.jax /*v_gN* +v_gV visual.jax /*v_gV* +v_g] tagsrch.jax /*v_g]* +v_g_CTRL-A change.jax /*v_g_CTRL-A* +v_g_CTRL-G editing.jax /*v_g_CTRL-G* +v_g_CTRL-X change.jax /*v_g_CTRL-X* +v_g_CTRL-] tagsrch.jax /*v_g_CTRL-]* +v_gf editing.jax /*v_gf* +v_gn visual.jax /*v_gn* +v_gq change.jax /*v_gq* +v_gv visual.jax /*v_gv* +v_gw change.jax /*v_gw* +v_i motion.jax /*v_i* +v_i' motion.jax /*v_i'* +v_i( motion.jax /*v_i(* +v_i) motion.jax /*v_i)* +v_i< motion.jax /*v_i<* +v_i> motion.jax /*v_i>* +v_iB motion.jax /*v_iB* +v_iW motion.jax /*v_iW* +v_i[ motion.jax /*v_i[* +v_i] motion.jax /*v_i]* +v_i` motion.jax /*v_i`* +v_ib motion.jax /*v_ib* +v_ip motion.jax /*v_ip* +v_iquote motion.jax /*v_iquote* +v_is motion.jax /*v_is* +v_it motion.jax /*v_it* +v_iw motion.jax /*v_iw* +v_i{ motion.jax /*v_i{* +v_i} motion.jax /*v_i}* +v_o visual.jax /*v_o* +v_p change.jax /*v_p* +v_r change.jax /*v_r* +v_s change.jax /*v_s* +v_u change.jax /*v_u* +v_v visual.jax /*v_v* +v_x change.jax /*v_x* +v_y change.jax /*v_y* +v_~ change.jax /*v_~* +vab motion.jax /*vab* +val-variable eval.jax /*val-variable* +valgrind debug.jax /*valgrind* +values() eval.jax /*values()* +var-functions usr_41.jax /*var-functions* +variables eval.jax /*variables* +various various.jax /*various* +various-cmds various.jax /*various-cmds* +various-functions usr_41.jax /*various-functions* +various-motions motion.jax /*various-motions* +various.txt various.jax /*various.txt* +vb.vim syntax.jax /*vb.vim* +vba pi_vimball.jax /*vba* +verbose starting.jax /*verbose* +version-8.0 version8.jax /*version-8.0* +version-variable eval.jax /*version-variable* +version4.txt version4.jax /*version4.txt* +version8.0 version8.jax /*version8.0* +version8.txt version8.jax /*version8.txt* +vi intro.jax /*vi* +vi-differences vi_diff.jax /*vi-differences* +vi: options.jax /*vi:* +vi_diff.txt vi_diff.jax /*vi_diff.txt* +vib motion.jax /*vib* +view starting.jax /*view* +view-diffs diff.jax /*view-diffs* +view-file starting.jax /*view-file* +views-sessions starting.jax /*views-sessions* +vim-8 version8.jax /*vim-8* +vim-additions vi_diff.jax /*vim-additions* +vim-announce intro.jax /*vim-announce* +vim-arguments starting.jax /*vim-arguments* +vim-default-editor gui_w32.jax /*vim-default-editor* +vim-dev intro.jax /*vim-dev* +vim-mac intro.jax /*vim-mac* +vim-modes intro.jax /*vim-modes* +vim-modes-intro intro.jax /*vim-modes-intro* +vim-script-intro usr_41.jax /*vim-script-intro* +vim-use intro.jax /*vim-use* +vim-variable eval.jax /*vim-variable* +vim.vim syntax.jax /*vim.vim* +vim8 version8.jax /*vim8* +vim: options.jax /*vim:* +vim_announce intro.jax /*vim_announce* +vim_dev intro.jax /*vim_dev* +vim_did_enter-variable eval.jax /*vim_did_enter-variable* +vim_mac intro.jax /*vim_mac* +vim_starting eval.jax /*vim_starting* +vim_use intro.jax /*vim_use* +vimball pi_vimball.jax /*vimball* +vimball-contents pi_vimball.jax /*vimball-contents* +vimball-extract pi_vimball.jax /*vimball-extract* +vimball-history pi_vimball.jax /*vimball-history* +vimball-intro pi_vimball.jax /*vimball-intro* +vimball-manual pi_vimball.jax /*vimball-manual* +vimball-windows pi_vimball.jax /*vimball-windows* +vimdev intro.jax /*vimdev* +vimdiff diff.jax /*vimdiff* +vimfiles options.jax /*vimfiles* +viminfo starting.jax /*viminfo* +viminfo-! options.jax /*viminfo-!* +viminfo-% options.jax /*viminfo-%* +viminfo-' options.jax /*viminfo-'* +viminfo-/ options.jax /*viminfo-\/* +viminfo-: options.jax /*viminfo-:* +viminfo-< options.jax /*viminfo-<* +viminfo-@ options.jax /*viminfo-@* +viminfo-c options.jax /*viminfo-c* +viminfo-encoding starting.jax /*viminfo-encoding* +viminfo-errors starting.jax /*viminfo-errors* +viminfo-f options.jax /*viminfo-f* +viminfo-file starting.jax /*viminfo-file* +viminfo-file-marks starting.jax /*viminfo-file-marks* +viminfo-file-name starting.jax /*viminfo-file-name* +viminfo-h options.jax /*viminfo-h* +viminfo-n options.jax /*viminfo-n* +viminfo-quote options.jax /*viminfo-quote* +viminfo-r options.jax /*viminfo-r* +viminfo-read starting.jax /*viminfo-read* +viminfo-read-write starting.jax /*viminfo-read-write* +viminfo-s options.jax /*viminfo-s* +viminfo-timestamp starting.jax /*viminfo-timestamp* +viminfo-write starting.jax /*viminfo-write* +vimrc starting.jax /*vimrc* +vimrc-filetype usr_05.jax /*vimrc-filetype* +vimrc-intro usr_05.jax /*vimrc-intro* +vimrc-option-example starting.jax /*vimrc-option-example* +vimrc_example.vim usr_05.jax /*vimrc_example.vim* +vimtutor usr_01.jax /*vimtutor* +virtcol() eval.jax /*virtcol()* +visual-block visual.jax /*visual-block* +visual-change visual.jax /*visual-change* +visual-examples visual.jax /*visual-examples* +visual-index index.jax /*visual-index* +visual-mode visual.jax /*visual-mode* +visual-operators visual.jax /*visual-operators* +visual-repeat visual.jax /*visual-repeat* +visual-search visual.jax /*visual-search* +visual-start visual.jax /*visual-start* +visual-use visual.jax /*visual-use* +visual.txt visual.jax /*visual.txt* +visualmode() eval.jax /*visualmode()* +vms os_vms.jax /*vms* +vms-authors os_vms.jax /*vms-authors* +vms-changes os_vms.jax /*vms-changes* +vms-compiling os_vms.jax /*vms-compiling* +vms-deploy os_vms.jax /*vms-deploy* +vms-download os_vms.jax /*vms-download* +vms-gui os_vms.jax /*vms-gui* +vms-notes os_vms.jax /*vms-notes* +vms-problems os_vms.jax /*vms-problems* +vms-started os_vms.jax /*vms-started* +vms-usage os_vms.jax /*vms-usage* +vote-for-features sponsor.jax /*vote-for-features* +votes-counted sponsor.jax /*votes-counted* +vreplace-mode insert.jax /*vreplace-mode* +vt100-cursor-keys term.jax /*vt100-cursor-keys* +vt100-function-keys term.jax /*vt100-function-keys* +w motion.jax /*w* +w32-clientserver remote.jax /*w32-clientserver* +w32-xpm-support gui_w32.jax /*w32-xpm-support* +w: eval.jax /*w:* +w:current_syntax syntax.jax /*w:current_syntax* +w:quickfix_title quickfix.jax /*w:quickfix_title* +w:var eval.jax /*w:var* +waittime channel.jax /*waittime* +warningmsg-variable eval.jax /*warningmsg-variable* +white-space pattern.jax /*white-space* +whitespace pattern.jax /*whitespace* +wildcard editing.jax /*wildcard* +wildcards editing.jax /*wildcards* +wildmenumode() eval.jax /*wildmenumode()* +win32 os_win32.jax /*win32* +win32-!start gui_w32.jax /*win32-!start* +win32-PATH os_win32.jax /*win32-PATH* +win32-colors gui_w32.jax /*win32-colors* +win32-compiling os_win32.jax /*win32-compiling* +win32-curdir os_win32.jax /*win32-curdir* +win32-faq os_win32.jax /*win32-faq* +win32-gettext mlang.jax /*win32-gettext* +win32-gui gui_w32.jax /*win32-gui* +win32-hidden-menus gui.jax /*win32-hidden-menus* +win32-mouse os_win32.jax /*win32-mouse* +win32-open-with-menu gui_w32.jax /*win32-open-with-menu* +win32-popup-menu gui_w32.jax /*win32-popup-menu* +win32-problems os_win32.jax /*win32-problems* +win32-quotes os_win32.jax /*win32-quotes* +win32-restore os_win32.jax /*win32-restore* +win32-startup os_win32.jax /*win32-startup* +win32-term os_win32.jax /*win32-term* +win32-vimrun gui_w32.jax /*win32-vimrun* +win32-win3.1 os_win32.jax /*win32-win3.1* +win32-win95 os_win32.jax /*win32-win95* +win32s os_win32.jax /*win32s* +win_findbuf() eval.jax /*win_findbuf()* +win_getid() eval.jax /*win_getid()* +win_gotoid() eval.jax /*win_gotoid()* +win_id2tabwin() eval.jax /*win_id2tabwin()* +win_id2win() eval.jax /*win_id2win()* +winbufnr() eval.jax /*winbufnr()* +wincol() eval.jax /*wincol()* +window windows.jax /*window* +window-ID windows.jax /*window-ID* +window-contents intro.jax /*window-contents* +window-exit editing.jax /*window-exit* +window-functions usr_41.jax /*window-functions* +window-move-cursor windows.jax /*window-move-cursor* +window-moving windows.jax /*window-moving* +window-resize windows.jax /*window-resize* +window-size term.jax /*window-size* +window-size-functions usr_41.jax /*window-size-functions* +window-tag windows.jax /*window-tag* +window-variable eval.jax /*window-variable* +windowid windows.jax /*windowid* +windowid-variable eval.jax /*windowid-variable* +windows windows.jax /*windows* +windows-3.1 os_win32.jax /*windows-3.1* +windows-icon os_win32.jax /*windows-icon* +windows-intro windows.jax /*windows-intro* +windows-starting windows.jax /*windows-starting* +windows.txt windows.jax /*windows.txt* +windows95 os_win32.jax /*windows95* +windows98 os_win32.jax /*windows98* +windowsme os_win32.jax /*windowsme* +winheight() eval.jax /*winheight()* +winid windows.jax /*winid* +winline() eval.jax /*winline()* +winnr() eval.jax /*winnr()* +winrestcmd() eval.jax /*winrestcmd()* +winrestview() eval.jax /*winrestview()* +winsaveview() eval.jax /*winsaveview()* +winwidth() eval.jax /*winwidth()* +word motion.jax /*word* +word-count editing.jax /*word-count* +word-motions motion.jax /*word-motions* +wordcount() eval.jax /*wordcount()* +workbench starting.jax /*workbench* +workshop workshop.jax /*workshop* +workshop-commands workshop.jax /*workshop-commands* +workshop-compiling workshop.jax /*workshop-compiling* +workshop-configure workshop.jax /*workshop-configure* +workshop-intro workshop.jax /*workshop-intro* +workshop-support workshop.jax /*workshop-support* +workshop-xpm workshop.jax /*workshop-xpm* +workshop.txt workshop.jax /*workshop.txt* +wrap-off intro.jax /*wrap-off* +write-compiler-plugin usr_41.jax /*write-compiler-plugin* +write-device editing.jax /*write-device* +write-fail editing.jax /*write-fail* +write-filetype-plugin usr_41.jax /*write-filetype-plugin* +write-library-script usr_41.jax /*write-library-script* +write-local-help usr_41.jax /*write-local-help* +write-permissions editing.jax /*write-permissions* +write-plugin usr_41.jax /*write-plugin* +write-plugin-quickload usr_41.jax /*write-plugin-quickload* +write-quit editing.jax /*write-quit* +write-readonly editing.jax /*write-readonly* +writefile() eval.jax /*writefile()* +writing editing.jax /*writing* +www intro.jax /*www* +x change.jax /*x* +x-input-method mbyte.jax /*x-input-method* +x11-clientserver remote.jax /*x11-clientserver* +x11-cut-buffer gui_x11.jax /*x11-cut-buffer* +x11-selection gui_x11.jax /*x11-selection* +xf86conf.vim syntax.jax /*xf86conf.vim* +xfontset mbyte.jax /*xfontset* +xfree-xterm syntax.jax /*xfree-xterm* +xim mbyte.jax /*xim* +xim-input-style mbyte.jax /*xim-input-style* +xiterm syntax.jax /*xiterm* +xml-folding syntax.jax /*xml-folding* +xml-omni-datafile insert.jax /*xml-omni-datafile* +xml.vim syntax.jax /*xml.vim* +xor() eval.jax /*xor()* +xpm.vim syntax.jax /*xpm.vim* +xterm-8-bit term.jax /*xterm-8-bit* +xterm-8bit term.jax /*xterm-8bit* +xterm-blink syntax.jax /*xterm-blink* +xterm-blinking-cursor syntax.jax /*xterm-blinking-cursor* +xterm-bracketed-paste term.jax /*xterm-bracketed-paste* +xterm-clipboard term.jax /*xterm-clipboard* +xterm-codes term.jax /*xterm-codes* +xterm-color syntax.jax /*xterm-color* +xterm-command-server term.jax /*xterm-command-server* +xterm-copy-paste term.jax /*xterm-copy-paste* +xterm-cursor-keys term.jax /*xterm-cursor-keys* +xterm-end-home-keys term.jax /*xterm-end-home-keys* +xterm-function-keys term.jax /*xterm-function-keys* +xterm-modifier-keys term.jax /*xterm-modifier-keys* +xterm-mouse options.jax /*xterm-mouse* +xterm-mouse-wheel scroll.jax /*xterm-mouse-wheel* +xterm-resize term.jax /*xterm-resize* +xterm-save-screen tips.jax /*xterm-save-screen* +xterm-screens tips.jax /*xterm-screens* +xterm-scroll-region term.jax /*xterm-scroll-region* +xterm-shifted-keys term.jax /*xterm-shifted-keys* +xterm-true-color term.jax /*xterm-true-color* +y change.jax /*y* +yaml.vim syntax.jax /*yaml.vim* +yank change.jax /*yank* +ye-option-gone version4.jax /*ye-option-gone* +year-2000 intro.jax /*year-2000* +your-runtime-dir usr_43.jax /*your-runtime-dir* +yy change.jax /*yy* +z index.jax /*z* +z+ scroll.jax /*z+* +z- scroll.jax /*z-* +z. scroll.jax /*z.* +z/OS os_390.jax /*z\/OS* +z<CR> scroll.jax /*z<CR>* +z<Left> scroll.jax /*z<Left>* +z<Right> scroll.jax /*z<Right>* +z= spell.jax /*z=* +zA fold.jax /*zA* +zC fold.jax /*zC* +zD fold.jax /*zD* +zE fold.jax /*zE* +zF fold.jax /*zF* +zG spell.jax /*zG* +zH scroll.jax /*zH* +zL scroll.jax /*zL* +zM fold.jax /*zM* +zN fold.jax /*zN* +zN<CR> scroll.jax /*zN<CR>* +zO fold.jax /*zO* +zOS os_390.jax /*zOS* +zOS-Bugs os_390.jax /*zOS-Bugs* +zOS-Motif os_390.jax /*zOS-Motif* +zOS-PuTTY os_390.jax /*zOS-PuTTY* +zOS-has-ebcdic os_390.jax /*zOS-has-ebcdic* +zOS-limitations os_390.jax /*zOS-limitations* +zOS-open-source os_390.jax /*zOS-open-source* +zR fold.jax /*zR* +zW spell.jax /*zW* +zX fold.jax /*zX* +z^ scroll.jax /*z^* +za fold.jax /*za* +zb scroll.jax /*zb* +zc fold.jax /*zc* +zd fold.jax /*zd* +ze scroll.jax /*ze* +zf fold.jax /*zf* +zg spell.jax /*zg* +zh scroll.jax /*zh* +zi fold.jax /*zi* +zip pi_zip.jax /*zip* +zip-contents pi_zip.jax /*zip-contents* +zip-copyright pi_zip.jax /*zip-copyright* +zip-extension pi_zip.jax /*zip-extension* +zip-history pi_zip.jax /*zip-history* +zip-manual pi_zip.jax /*zip-manual* +zip-usage pi_zip.jax /*zip-usage* +zip-x pi_zip.jax /*zip-x* +zj fold.jax /*zj* +zk fold.jax /*zk* +zl scroll.jax /*zl* +zm fold.jax /*zm* +zn fold.jax /*zn* +zo fold.jax /*zo* +zr fold.jax /*zr* +zs scroll.jax /*zs* +zsh.vim syntax.jax /*zsh.vim* +zt scroll.jax /*zt* +zuG spell.jax /*zuG* +zuW spell.jax /*zuW* +zug spell.jax /*zug* +zuw spell.jax /*zuw* +zv fold.jax /*zv* +zw spell.jax /*zw* +zx fold.jax /*zx* +zz scroll.jax /*zz* +{ motion.jax /*{* +{Visual} intro.jax /*{Visual}* +{address} cmdline.jax /*{address}* +{arglist} editing.jax /*{arglist}* +{char1-char2} intro.jax /*{char1-char2}* +{event} autocmd.jax /*{event}* +{file} editing.jax /*{file}* +{group-name} syntax.jax /*{group-name}* +{lhs} map.jax /*{lhs}* +{motion} intro.jax /*{motion}* +{move-around} visual.jax /*{move-around}* +{offset} pattern.jax /*{offset}* +{pat} autocmd.jax /*{pat}* +{rhs} map.jax /*{rhs}* +{subject} helphelp.jax /*{subject}* +{} intro.jax /*{}* +} motion.jax /*}* +~ change.jax /*~* diff --git a/plugins/vimdoc-ja/doc/tagsrch.jax b/plugins/vimdoc-ja/doc/tagsrch.jax new file mode 100644 index 0000000000..76d4ad1b7f --- /dev/null +++ b/plugins/vimdoc-ja/doc/tagsrch.jax @@ -0,0 +1,839 @@ +*tagsrch.txt* For Vim バージョン 8.0. Last change: 2016 Sep 20 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +タグと特別な検索 *tags-and-searches* + +初めにユーザーマニュアルのセクション|29.1|を参照すること。 + +1. タグへのジャンプ |tag-commands| +2. タグスタック |tag-stack| +3. タグマッチリスト |tag-matchlist| +4. タグの詳細 |tag-details| +5. タグファイルの書式 |tags-file-format| +6. インクルードファイルの検索 |include-search| + +============================================================================== +1. タグへのジャンプ *tag-commands* + + *tag* *tags* +タグとは "tags" ファイルに現われる識別子である。タグはラベルのようなものであ +り、そこにジャンプすることができる。例えば: Cのプログラムではそれぞれの関数名 +をタグとして使うことができる。タグ機能を使う前には、ctagsのようなプログラムに +よって "tags" ファイルを生成しなければならない。 + +":tag" コマンドはカーソルをタグ上に移動する。CTRL-]コマンドはカーソルの下にあ +るキーワードをタグとして使用する。もしカーソルがキーワード上になければ、カーソ +ル位置から右側で最初に現れるキーワードを使用する。 + +":tag" コマンドはCプログラムでよく機能する。もし関数呼び出しを見つけた時にその +関数が何をするのか疑問に思ったら、カーソルを関数名の上に置いてCTRL-]を叩けばよ +い。これで関数定義に導いてもらえるだろう。簡単に戻る方法はCTRL-Tコマンドを使う +ことである。後述するタグスタックについても読むとよい。 + + *:ta* *:tag* *E426* *E429* +:[count]ta[g][!] {ident} + tagsファイル内の情報を用いて、{ident}の定義へジャンプ + する。{ident}はタグスタックに積まれる。[!]については + |tag-!|を参照。 + {ident}は正規表現を使用できる。|tag-regexp|を参照。 + {ident}に対してマッチするタグが複数ある場合、[count]番 + 目のタグへジャンプする。[count]が指定されないときは最 + 初のタグへジャンプする。他のマッチするタグへジャンプす + るには|tag-matchlist|を参照。 + +g<LeftMouse> *g<LeftMouse>* +<C-LeftMouse> *<C-LeftMouse>* *CTRL-]* +CTRL-] カーソルの下のキーワードを定義している場所にジャンプす + る。":tag {ident}" と同様であるが、{ident}はカーソルの + 下、もしくは次に現われるキーワードである。 + {ident}に対してマッチするタグが複数ある場合、[count]番 + 目のタグへジャンプする。[count]が指定されないときは最 + 初のタグへジャンプする。他のマッチするタグへジャンプす + るには|tag-matchlist|を参照。 + {Vi: identifier after the cursor} + + *v_CTRL-]* +{Visual}CTRL-] ":tag {ident}" と同様であるが、{ident}はハイライトされ + ているテキストである。{Vi にはない} + + *telnet-CTRL-]* +CTRL-]はtelnetの標準エスケープキーである。タグにジャンプしようとCTRL-]を打つと、 +代わりにtelnetのプロンプトが立ち上がるだろう。telnetのたいていのバージョンは、 +標準エスケープキーを変更、もしくは使用不可能にできる。telnetのマニュアルを参照 +すること。エスケープキーを使用不可能にするには 'telnet -E {ホスト名}'、エスケー +プ文字を他の文字にするには 'telnet -e {エスケープ文字} {ホスト名}' を使用する。 +もし可能ならtelnetの代わりにsshを使うことで、この問題を回避できる。 + + *tag-priority* +タグのマッチが複数ある場合、以下の優先度が使われる: +1. "FSC" カレントファイル内の全一致するstaticタグ。 +2. "F C" カレントファイル内の全一致するglobalタグ。 +3. "F " 別のファイル内の全一致するglobalタグ。 +4. "FS " 別のファイル内の全一致するstaticタグ。 +5. " SC" カレントファイル内の大文字、小文字を無視した一致をするstaticタグ。 +6. " C" カレントファイル内の大文字、小文字を無視した一致をするglobalタグ。 +7. " " 別のファイル内の大文字、小文字を無視した一致をするglobalタグ。 +8. " S " 別のファイル内の大文字、小文字を無視した一致をするstaticタグ。 + +カレントファイルが変わっても、優先度のリストはほとんどの場合変化しないので注意 +すること。これは ":tnext" を使うときの混乱を避けるためである。優先度のリストは +":tag {ident}" を使ったときに変化する。 + +以下の場合は ":tag " で大文字小文字を無視した検索は行われません: +- 'ignorecase' オプションがオフで 'tagcase' が "followic" の時 +- 'tagcase' が "match" である +- 'tagcase' が "smart" でパターンに大文字が含まれる時 +- 'tagcase' が "followscs" で 'smartcase' オプションがオンで、パターンに大文字 + が含まれる時 + +以下の場合は大文字小文字を無視した検索が行われます: +- パターンが使用される時 ("/" で始まる) +- ":tselect" の時 +- 'tagcase' が "followic" で 'ignorecase' がオフの時 +- 'tagcase' が "match" の時 +- 'tagcase' が "followscs" で 'smartcase' オプションがオフの時 + +Note 大文字小文字を無視したタグ検索はタグファイル内での二分探索を無効にし速度 +の低下を引き起こします。これは大文字小文字を保持したままタグファイルを並び替え +る事で回避できます。'tagbsearch' オプションの説明を参照 + +============================================================================== +2. タグスタック *tag-stack* *tagstack* *E425* + +タグスタック上にはジャンプ先のタグと、どこから来たのかという情報が記憶される。 +タグは 'tagstack' オプションが設定されているときにだけ積まれる。 + +g<RightMouse> *g<RightMouse>* +<C-RightMouse> *<C-RightMouse>* *CTRL-T* +CTRL-T タグスタック中の[count]分だけ古いエントリにジャンプす + る(デフォルトは1)。 {Vi にはない} + + *:po* *:pop* *E555* *E556* +:[count]po[p][!] タグスタック中の[count]分だけ古いエントリにジャンプす + る(デフォルトは1)。 + [!]については|tag-!|を参照。 {Vi にはない} + +:[count]ta[g][!] タグスタック中の[count]分だけ新しいエントリにジャンプ + する(デフォルトは1)。 + [!]については|tag-!|を参照。 {Vi にはない} + + *:tags* +:tags タグスタックの内容を表示する。現在のエントリは '>' で + マークされる。 {Vi にはない} + +":tags" の出力は以下のようになる: + + # TO tag FROM line in file/text + 1 1 main 1 harddisk2:text/vim/test + > 2 2 FuncA 58 i = FuncA(10); + 3 1 FuncC 357 harddisk2:text/vim/src/amiga.c + +このリストはジャンプ先のタグとジャンプ前のカーソル位置を表示する。上から順に古 +いタグが並び、一番下が最も新しいタグである。 + +'>' は現在のエントリを指している。これは次の ":tag" コマンドで使われるタグであ +る。CTRL-Tと ":pop" コマンドは1つ上のタグを使う。 + +"TO" の列にはマッチリスト中の現在のマッチ数を表示する。これは ":pop" や ":tag" +を使っても変化しないので注意すること。 + +行番号とファイル名は、タグコマンドを実行する前にいた位置に戻ることができるよう +に記憶される。行番号は行の削除や挿入が行われた時にも正しく維持される。ただし、 +別のプログラム(例えば、Vimの別インスタンス)で編集した場合を除く。 + +ジャンプ前の位置がカレントファイル内であれば、"file/text" の列にその行が表示さ +れる。インデントは取り除かれ、長い行はウィンドウに収まるように切り詰められる。 + +前に使ったタグにジャンプするコマンドはいくつかある。例えば: + + ":pop" or CTRL-T ひとつ前に使われたタグにジャンプする。 + {count}CTRL-T {count}分だけ前のタグにジャンプする。 + ":tag" 現在のエントリより新しいタグにジャンプする。 + ":0tag" 最後に使われたタグにジャンプする。 + +これらの最も明白な利用方法は、プログラムの関数呼び出しをあちこち拾い読みすると +きである。次のような呼び出し図を考える: + + main ---> FuncA ---> FuncC + ---> FuncB + +(解説: mainはFuncAとFuncBを呼び出し、FuncAはFuncCを呼び出す)。 +FuncAの呼び出し部分の上でCTRL-]を使うことによって、mainからFuncAに行くことがで +きる。同様にCTRL-]を使ってFuncCへ行くことができる。mainに戻るにはCTRL-Tを2回 +使う。そこでCTRL-]を使ってFuncBに行くことができる。 + +":ta {ident}" やCTRL-]コマンドは、タグスタック上の現在の位置にタグを追加する。 +もしスタックが満たされていた場合(スタックは20エントリまで保持できる)、最も古い +エントリが削除され、古いものから順にひとつずつ上に移動する(インデックス番号は1 +ずつ減る)。もし最後に使われたエントリが一番下になかった場合、最後に使われたエ +ントリより下にあるものは削除される。つまり古いタグ経路は失われる。上のパラグラ +フの説明を実行したあとのタグスタックは次のような状態になる: + + # TO tag FROM line in file/text + 1 1 main 1 harddisk2:text/vim/test + 2 1 FuncB 59 harddisk2:text/vim/src/main.c + + *E73* +タグスタックを使おうとしたとき、タグスタックに何も入っていないとエラーが表示さ +れる。 + +============================================================================== +3. タグマッチリスト *tag-matchlist* *E427* *E428* + +以下のコマンドは複数のタグがマッチしたときに、タグの間を移動するために使うこと +ができる。これらのコマンドはタグスタックを変更せず、同じエントリを保つことに注 +意すること。 + + *:ts* *:tselect* +:ts[elect][!] [ident] タグファイルの情報を用いて、[ident]にマッチするタグをリ + スト表示する。 + [ident]を省略した場合、タグスタック上の最後のタグが使 + われる。 + 最初の列に '>' があるものはリスト中の現在の位置を指し + 示している(それがあるならば)。 + [ident]は正規表現を取り得る。|tag-regexp|を参照。 + リストに使われているプロパティは|tag-priority|を参照。 + {Vi にはない} + 出力例: + +> + nr pri kind tag file + 1 F f mch_delay os_amiga.c + mch_delay(msec, ignoreinput) + > 2 F f mch_delay os_msdos.c + mch_delay(msec, ignoreinput) + 3 F f mch_delay os_unix.c + mch_delay(msec, ignoreinput) + Enter nr of choice (<CR> to abort): +< + "pri" については|tag-priority|を参照。この例は現在の + ファイルに依存しているため、":tselect xxx" を使ったと + きには違う結果が得られることに注意すること。 + "kind" はタグファイルからタグの種類が得られる場合のみ、 + その情報を示す。 + "info" はタグファイルから得られる情報が表示される。こ + の情報はタグファイルを生成したプログラムに依存する。 + リストが長い場合には|more-prompt|が表示される。もしす + でに使いたいタグを見つけているのなら、'q' のあとに + "nr" の番号を入力すればよい。 + + *:sts* *:stselect* +:sts[elect][!] [ident] ":tselect[!] [ident]" を実行し、ウィンドウを分割して + 選択されたtagを表示する。{Vi にはない} + + *g]* +g] CTRL-]と動作は似ているが、":tag" の代わりに ":tselect" + を用いる。{Vi にはない} + + *v_g]* +{Visual}g] "g]" と同じ。ただし、選択されたテキストが検索に使われ + る。{Vi にはない} + *:tj* *:tjump* +:tj[ump][!] [ident] ":tselect" と動作は似ているが、適合するtagが1つだけの + ときには直接移動する。{Vi にはない} + + *:stj* *:stjump* +:stj[ump][!] [ident] ":tjump[!] [ident]" を実行し、ウィンドウを分割して選択 + されたtagを表示する。{Vi にはない} + + *g_CTRL-]* +g CTRL-] CTRL-]と動作は似ているが、":tag" の代わりに ":tjump" + を用いる。{Vi にはない} + + *v_g_CTRL-]* +{Visual}g CTRL-] "g CTRL-]" と同じ。ただし、選択されたテキストが検索に + 使われる。 + *:tn* *:tnext* +:[count]tn[ext][!] 適合するtagのうち、[count]番目のtagに移動する。(省略時 + は1。)[!]に関しては|tag-!|を参照。{Vi にはない} + + *:tp* *:tprevious* +:[count]tp[revious][!] 適合するtagのうち、[count]分だけ前のtagに移動する。( + 省略時は1。)[!]に関しては|tag-!|を参照。{Vi にはない} + + *:tN* *:tNext* +:[count]tN[ext][!] ":tprevious" と同様。{Vi にはない} + + *:tr* *:trewind* +:[count]tr[ewind][!] 適合したtagのうち最初のtagに移動する。もし[count]が与 + えられていたら、[count]番目のtagに移動する。[!]につい + ては|tag-!|を参照。{Vi にはない} + + *:tf* *:tfirst* +:[count]tf[irst][!] ":trewind" と同じ。{Vi にはない} + *:tl* *:tlast* +:tl[ast][!] 適合したtagのうち最後のtagに移動する。[!]に関しては + |tag-!|を参照。{Vi にはない} + + *:lt* *:ltag* +:lt[ag][!] [ident] タグ[ident]にジャンプし、マッチするタグ全てをカレント + ウィンドウの新しいロケーションリストに追加する。 + [ident]は正規表現でもよい(|tag-regexp|を参照)。[ident] + が指定されないときはタグスタックにある最後のタグ名が使 + われる。タグにマッチする行を特定するための検索パターン + には、特別な文字を全てエスケープするために "\V" がつけ + られる(very nomagic)。マッチするタグを保持するロケー + ションリストはタグスタックとは独立している。[!]につい + ては|tag-!|を参照。{Vi にはない} + +他にメッセージがないとき、Vimは今までに移動したtagとtagの数を表示する: > + tag 1 of 3 or more +" or more" は、Vimがまだすべてのtagファイルを検索していないことを示すために用 +いられる。":tnext" を数回用いるか、":tlast" を使用したとき、さらにtagが見つけ +られるだろう。 + +他のメッセージがあったときや、現在の場所を知りたいときには次のコマンドで再び +表示することができる。(最後に行った移動と同じtagに移動する。): > + :0tn +< + *tag-skip-file* +マッチしたタグに対するファイルが見つからなかった場合、スキップされて次にマッチ +するタグが使われる。Vimはファイルがないことを通知する。もしリストの終端に達し +ていたならば、エラーメッセージが与えられる。 + + *tag-preview* +タグマッチリストはプレビューウィンドウ内でも使用できる。そのコマンドは上記のも +のに似ているが、先頭に "p" がつく。 +{|+quickfix|が無効なときは利用できない} + + *:pts* *:ptselect* +:pts[elect][!] [ident] ":tselect[!] [ident]" を実行し、"Preview" ウィンドウに + 新しいタグを表示する。詳細は|:ptag|を参照すること。 + {Vi にはない} + + *:ptj* *:ptjump* +:ptj[ump][!] [ident] ":tjump[!] [ident]" を実行し、"Preview" ウィンドウに新 + しいタグを表示する。詳細は|:ptag|を参照すること。 + {Vi にはない} + + *:ptn* *:ptnext* +:[count]ptn[ext][!] プレビューウィンドウで ":tnext" を実行する。|:ptag|を + 参照すること。{Vi にはない} + + *:ptp* *:ptprevious* +:[count]ptp[revious][!] プレビューウィンドウで ":tprevious" を実行する。 + |:ptag|を参照すること。{Vi にはない} + + *:ptN* *:ptNext* +:[count]ptN[ext][!] ":ptprevious" と同じ。{Vi にはない} + + *:ptr* *:ptrewind* +:[count]ptr[ewind][!] プレビューウィンドウで ":trewind" を実行する。|:ptag| + を参照すること。{Vi にはない} + + *:ptf* *:ptfirst* +:[count]ptf[irst][!] ":ptrewind" と同じ。{Vi にはない} + + *:ptl* *:ptlast* +:ptl[ast][!] プレビューウィンドウで ":tlast" を実行する。|:ptag|を + 参照すること。{Vi にはない} + +============================================================================== +4. タグの詳細 *tag-details* + + *static-tag* +staticタグは特別なファイルのために定義されたタグである。Cプログラムではstatic +関数が当てはまる。 + +Viはタグにジャンプするときに現在の検索パターンを設定する。これはタグにジャンプ +したあとの "n" コマンドは、その前の検索パターンと同じ検索を行わないということ +である。Vimではこのようなバグとも考えられることはしない。検索履歴にある検索パ +ターンで検索できる。もし古いViの振る舞いを望むならば、'cpoptions' に 't' を設 +定する。 + + *tag-binary-search* +Vimは希望のタグをすばやく見つけるために、タグファイル内で二分探索を行う +(|+tag_binary|がコンパイル時に有効になっていれば)。しかしこれはタグファイルが +ASCIIコードでソートされている場合にのみ機能する。したがって、もし適合しないも +のが見つかった場合は、その他の方法として線形探索が行われる。もし線形探索のみを +利用したいならば、'tagbsearch' オプションをリセットすればよい。そうでなければ: +タグファイルをソートすること! + +検索が明確な名前をもったタグでない場合は二分探索は利用できないことに注意するこ +と。これは大文字小文字を無視した検索や固定文字列で始まらない正規表現による検索 +で発生する。そのときはタグ検索はかなり遅くなるだろう。先人はタグファイルを大文 +字と小文字を区別せずにソートすることで回避できた。詳細は 'tagbsearch' を参照の +こと。 + + *tag-regexp* +":tag" と ":tselect" コマンドは引数に正規表現を受け付ける。使用できる特殊文字 +については|pattern|を参照すること。引数が '/' で始まる場合はパターンとして使わ +れる。もし引数が '/' で始まらなければ、完全なタグ名の文字列として扱われる。 +例: > + :tag main +< 最も優先度の高い "main" というタグにジャンプする。 > + :tag /^get +< 最も優先度の高い "get" で始まるタグにジャンプする。 > + :tag /norm +< "norm" を含むすべてのタグを列挙する。これは "id_norm" というタグも含ま + れる。 +もし引数と全く同じタグと、正規表現によってマッチしたタグがあった場合、引数と同 +じタグが優先される。例えば、":tag /open" は "open_file" や "file_open" よりも +前に "open" にマッチする。 +正規表現を使うときは大文字・小文字は区別されない。大文字・小文字を区別したいな +ら正規表現の中で "\C" を使うこと。 + + *tag-!* +もしタグが現在のファイル上にあるならば、いつも機能するだろう。そうでなければ、 +実行結果は現在のファイルが変更されているか、コマンドに!がつけられているか、 +'autowrite' オプションが設定されているかに依存する: + +タグが現在の autowrite ~ + ファイル内 変更あり ! オプション 動作 ~ +----------------------------------------------------------------------------- + yes x x x タグに行く + no no x x 対象ファイルを読み込み、タグに行く + no yes yes x 現在のファイルを捨て、対象ファイルを読み込ん + でタグに行く + no yes no on 現在のファイルを保存し、対象ファイルを読み込 + んでタグに行く + no yes no off 失敗する +----------------------------------------------------------------------------- + +- タグが現在のファイル上にある場合は、コマンドはいつも機能する。 +- タグが他のファイル上にあり、現在のファイルが変更されていないならば、対象とな + るファイルがバッファに読み込まれる。 +- タグが他のファイル上にあり、現在のファイルが変更されていて、かつ!がコマンド + につけられている場合には、現在のファイルに対する変更は失われ、対象となるファ + イルがバッファに読み込まれる。 +- タグが他のファイル上にあり、現在のファイルが変更されていて、かつ 'autowrite' + オプションが設定されている場合には、現在のファイルは保存され、対象となるファ + イルがバッファに読み込まれる。 +- タグが他のファイル上にあり、現在のファイルが変更されていて、かつ 'autowrite' + オプションが設定されていない場合には、コマンドは失敗する。変更を保存したいな + らば ":w" コマンドを使用し、そのあとで ":tag" を引数なしで実行する。これはタ + グがスタック上に残っているためにうまく機能する。変更を失ってもよいのならば、 + ":tag!" コマンドを使用できる。 + + *tag-security* +Vimはセキュリティの都合上、いくつかのコマンドを禁止していることに注意すること。 +これはちょうど現在のディレクトリにあるexrc/vimrcファイルに 'secure' オプション +が使われているのと同じように機能する。|trojan-horse|と|sandbox|を参照すること。 +{tagaddress}がバッファを変更したとき、次のようなエラーメッセージが表示される: + "WARNING: tag command changed a buffer!!!" +将来のバージョンではバッファを変更することは不可能になるだろう。これらはすべて +セキュリティの理由である: 誰かが気づかれないように実行される厄介なコマンドをタ +グファイルに隠しているかもしれない。例えば: > + :$d|/tag-function-name/ +{Vi ではこのセキュリティ予防は提供されない}. + +Viでは ":tag" コマンドによってタグを検索すると、最新の検索パターンを上書きする。 +Vimでは 'cpoptions' に 't' フラグが設定されていなければ、前の検索パターンは引 +き続き記憶される。検索パターンはいつも検索履歴にあるので、もし検索に失敗したら +そこを修正するとよい。 + + *emacs-tags* *emacs_tags* *E430* +Emacsスタイルのタグファイルは、Vimのコンパイル時に|+emacs_tags|機能を有効にし +た場合にのみ使用できる。すまないが、Emacsタグファイルについての説明はここでは +しない。それは下位互換のためにのみ提供している :-)。 + +Emacs タグファイルの行は非常に長くなることがある。Vim は行の約510バイトまでし +か扱わない。行が無視されたかどうかは 'verbose' を5以上にしていればわかる。 + + *tags-option* +'tags' オプションはファイル名のリストで構成される。これらのファイルからタグが +検索される。デフォルトの "tags" ファイルよりも、異なるtagsファイルがよく使われ +るだろう。共通のtagsファイルにもよくアクセスするだろう。 + +以下のようなときは、リストの次のファイルを使わない: +- 現在のバッファに対するstaticタグが見つかった場合。 +- globalタグが見つかった場合。 +これは大文字小文字が無視されるかどうかにも依存します。大文字小文字は以下の場合 +に無視されます: +- 'tagcase' が "followic" で 'ignorecase' が設定されている +- 'tagcase' が "ignore" である +- 'tagcase' が "smart" でパターンに小文字だけが含まれている +- 'tagcase' が "followscs" で 'smartcase' が設定されておりパターンに小文字のみ + が含まれている +大文字小文字が無視されず、タグファイルが大文字小文字を除外したマッチのみとなる +場合、続くタグファイルは大文字小文字をマッチして検索されます。大文字小文字を +マッチしてタグファイルが見つからない場合、大文字小文字を除外してマッチした最初 +の結果が使用されます。もし大文字小文字が無視されグローバルのタグでマッチした、 +もしくは大文字小文字を除外してマッチした場合、タグファイルの検索は行われず見 +付かったそのファイルが使用されます。 + +タグファイル名が "./" で始まるとき、'.' は現在のファイルのパスで置き換えられ +る。これにより、現在のファイルがあるディレクトリのtagsファイルを使用することが +できる(たとえ現在のディレクトリがどこであろうと)。"./" を使用する概念は、どの +タグファイルを最初に検索するかを決定することである: 現在のディレクトリにするか +("tags,./tags")、現在のファイルがあるディレクトリにするか("./tags,tags")であ +る。 + +例: > + :set tags=./tags,tags,/home/user/commontags + +この例では、現在のファイルがあるディレクトリの "tags" ファイルがまず検索され +る。次に現在のディレクトリにある "tags" ファイルが検索される。もしまだ見つから +なければ、"/home/user/commontags" が検索される。 + +これは 'cpoptions' に 'd' フラグを含めることでVi互換のようにすることができる。 +"./tags" は現在のファイルがあるディレクトリのtagsファイルではなく、現在のディ +レクトリのtagsファイルを意味するようになる。 + +コンマの代わりにスペースを使用してもよい。文字列オプションに含めるためにはスペー +スの前にバックスラッシュが必要となる: > + :set tags=tags\ /home/user/commontags + +ファイル名にスペースを含めるにはバックスラッシュを3つ並べる。コンマをファイル +名に使用する場合にはバックスラッシュを2つ並べる。例えば: > + :set tags=tag\\\ file,/home/user/common\\,tags + +"tag file" と "/home/user/common,tags" というファイルが指定できる。'tags' オプ +ションは "tag\ file,/home/user/common\,tags" という値を持つだろう。 + +'tagrelative' オプションをオンにし(デフォルト)、他のディレクトリでタグファイル +を使用すると、タグファイル内に記述されたファイル名はタグファイルがあるディレク +トリを基準として相対パスになる。 + +============================================================================== +5. タグファイルの書式 *tags-file-format* *E431* + + *ctags* *jtags* +tagsファイルは "ctags" のような外部コマンドによって生成される。それはそれぞれ +の関数へのタグを含んでいる。"ctags" のあるバージョンでは "#defined" マクロや +typedef、enumなどに対してもタグを作ることができる。 + +tagsファイルを生成するプログラム: +ctags ほとんどのUnixシステムにある。C言語のみ対応し、基本的な + 機能を提供する。 + *Exuberant_ctags* +exuberant ctags これはとてもよいものだ。C言語、C++、Java、Fortran、 + Eiffel、そしてその他に対応している。多くの項目にタグを + 生成することができる。 + http://ctags.sourceforge.net を参照。 +etags Emacsに連携する。多言語に対応している。 +JTags Java 用、Java で書かれている。 + http://www.fleiner.com/jtags/で入手できる。 +ptags.py Python 用、Python で書かれている。 + PythonのソースディレクトリTools/scripts/ptags.pyにある。 +ptags Perl 用、Perl で書かれている。これはここで見つかる。 + http://www.eleves.ens.fr:8080/home/nthiery/Tags/ +gnatxref Ada用。http://www.gnuada.org/ を参照。 + gnatxrefはgnatパッケージの一部である。 + +tagsファイルは次の3つの形式のどれかで構成されなければならない: + +1. {tagname} {TAB} {tagfile} {TAB} {tagaddress} +2. {tagfile}:{tagname} {TAB} {tagfile} {TAB} {tagaddress} +3. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} .. + +最初の形式は通常のタグで、Viで完全に互換性がある。伝統的なctagsによってのみ作 +られる形式である。これはしばしばグローバルな関数や他のファイルを参照する場合に +使用される。 + +タグファイルの行は<LF>または<CR><LF>で終わる。Macintoshでは<CR>も機能する。 +<CR>と<NL>は行内に決して現れない。 + + *tag-old-static* +2番目の形式はstaticタグにのみ使用できる。現在では廃れており、3番目の形式に置 +き換えられている。これはElvis 1.xとVim、それといくつかのバージョンのctagsによっ +てのみサポートされている。staticタグはローカル関数によく用いられ、{tagfile}内 +のみ参照する。staticタグでは2つの{tagfile}は正確に一致していなければならない +ことに注意すること。staticタグがどのように使われるかについては|tags-option|を +参照すること。 + +3番目の形式は新しい。各行の末尾にある任意的なフィールドに追加の情報を含む。こ +れは以前のViとも互換性がある。新しいバージョンのctagsにのみサポートされている +(Exuberant ctagsとか)。 + +{tagname} 識別子。普通は関数名であるが、どんな識別子でも構わない。<Tab> + を含めることはできない。 +{TAB} 1文字の<Tab>。 Note: 以前のバージョンではここでどんな空白文字 + も許可していた。これは{tagfile}内にスペースを使うことを断念し + たためである。コンパイル時に|+tag_any_white|機能を付加すれば再 + び使えるようになる。 *tag-any-white* +{tagfile} {tagname}の定義を含むファイル名。絶対パスでも相対パスでも構わ + ない。環境変数やワイルドカードを含んでもよい(ワイルドカードの + 使用方法はあいまいだが)。<Tab>を含むことはできない。 +{tagaddress} カーソルをタグ上に移動するExコマンド。制限(|tag-security|を参 + 照)はあるが、どんなExコマンドでも使用可能である。 + Posixでは主に使われる行番号と検索コマンドのみ許可する。 +{term} ;" セミコロンとダブルクォートの2文字。これはViによってコメント + とみなされ、続く文字列は無視される。以前のViとの互換性を保つた + めにある。これは続くフィールドを無視する。 +{field} .. 任意のフィールドのリスト。各フィールドは次の書式を持つ: + + <Tab>{fieldname}:{value} + + {fieldname}はフィールドの識別子であり、アルファベットのみ使用 + 可能である[a-zA-Z]。 + {value}は任意の文字列であるが、<Tab>は使用できない。 + 以下の特殊文字が使用できる: + "\t" は<Tab>を表す + "\r" は<CR>を表す + "\n" は<NL>を表す + "\\" は\を表す + + ':' を持たないフィールドがある。これはタグの一種である。 + "kind:" を先頭につけたものとして扱われる。 + kindsについては、それを提供するctagsのドキュメントを参照。 + + 現在Vimが認識できるその他のフィールドは "file:" (値はなし)だけ + である。これはstaticタグに使われる。 + +tagsファイルの先頭行には、 + !_TAG_ +で始まる行を含めることができる。 +これらは極稀な "!" で始まるタグを除けば先頭行にソートされる。Vimは2つのタグを +認識する。1つはファイルがソートされているかどうかを示す行で、この行が見つかっ +た場合には、Vimはtagsファイルに対して二分探索を使用する: + !_TAG_FILE_SORTED<TAB>1<TAB>{anything} ~ + +大文字小文字を無視する設定の時、線形探索を避けるためにタグファイルは大文字小文 +字を区別せずにソートされることがある。 ('ignorecase' がセットされかつ +'tagcase' が "followic" の時、または 'tagcase' が "ignore" の時に大文字小文字は +無視される。) 詳細は 'tagbsearch' を参照のこと。 +その時、値として '2' が使われる: + !_TAG_FILE_SORTED<TAB>2<TAB>{anything} ~ + +Vimが認識するもう1つのタグはタグファイルのエンコーディングを指定するものであ +る。これは|+multi_byte|が有効なときだけ利用できる: + !_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything} ~ +ここで "utf-8" はタグのエンコーディングである。Vimはタグを検索するときに検索す +るタグを 'encoding' からタグファイルのエンコーディングに変換する。そして、タグ +をリストするときに元に戻す。変換が失敗したときは元のままのタグが使われる。 + + *tag-search* +コマンドはどんなExコマンドでも使用可能であるが、検索コマンドがよく使われるであ +ろう。 +例: + tag1 file1 /^main(argc, argv)/ ~ + tag2 file2 108 ~ + +コマンドは常に 'magic' がセットされない状態で実行される。検索パターンで使用で +きる特殊文字は "^" (行頭) と "$" (<EOL>) だけである。|pattern|を参照すること。 +検索文字列中のバックスラッシュの前にはバックスラッシュをつけなければならないこ +とに注意すること。これは以前のViと互換性がある。 + + *E434* *E435* +もしコマンドが普通の検索コマンド ("/" か "?" で始まり、終わる) であるならば、 +いくつかの特別な扱いをされる: +- 検索はファイルの1行目から開始する。 + 検索方向は "/" で前方、"?" で後方となる。 + 'wrapscan' は問題にならず、いつもファイル全体を検索することに注意。(Vi は + 'wrapscan' を使用するため、それが原因でタグが見つからないこともある。) {Vi は + 別のファイルの2行目から検索を開始する。'wrapscan' を設定しないときには、別 + のファイルの1行目にあるタグは見つけられない} +- 検索が失敗した場合は、大文字小文字を無視してもう一度検索する。それも失敗した + 場合には次の検索が行われる: + "^tagname[ \t]*(" + (タグの先頭に '^'、末尾に "[ \t]*(" が追加される)。関数名の検索の場合には、 + これはカラム0の位置にある関数名を見つけるだろう。関数の引数がtagsファイルを + 作成したときから変更になったときなどに役立つだろう。この検索でも見つからない + 場合にはさらに次の検索が行われる: + "^[#a-zA-Z_].*\<tagname[ \t]*(" + この意味は: '#' もしくは識別子で始まり、空白文字と '(' が続くタグを含む行で + ある。これは型が先頭にあるマクロ名や関数名を見つけるだろう。{Vi には拡張検索 + はない} + +============================================================================== +6. インクルードファイルの検索 *include-search* *definition-search* + *E387* *E388* *E389* + +これらのコマンドは対象となる文字列を現在のファイルと、遭遇するすべてのインクルー +ドファイルを再帰的に探す。これは変数や関数、マクロの定義を探すのに利用できる。 +現在のバッファに対してだけ検索をしたいのならば、|pattern-searches|に列挙されて +いるコマンドを使うとよい。 + +これらのコマンドは、コンパイル時に|+find_in_path|機能を使用不可にした場合には +利用できない。 + +他のファイルをインクルードする行に遭遇すると、現在のバッファを続けて検索する前 +にインクルードファイルを検索する。インクルードファイルによってインクルードされ +るファイルも同様に検索される。インクルードファイルが見つからなかった場合は黙っ +て無視する。見つからなかったファイルを知りたいときは|:checkpath|コマンドを使う。 +たぶん 'path' オプションが正しく設定されていないのだろう。Note: インクルード +ファイルはファイルが検索され、そのファイルを編集中のバッファが存在しても対象に +ならない。バッファにある行は、現在のファイルにのみ適用される。 + +検索文字列は任意のキーワードや定義されたマクロが指定できる。キーワードの場合は +マッチするものを見つける。定義されたマクロの場合は 'define' オプションにマッチ +する行だけが見つけられる。デフォルトはCプログラム用の "^#\s*define" である。他 +の言語の場合はおそらく変更したいだろう。C++用の例は 'define' を参照。その文字 +列に改行を含めることはできない。一行内にマッチするものだけが見つかる。 + +定義されたマクロが見つかった場合、行末がバックスラッシュのときは次の行も表示す +る。 + +"[" で始まるコマンドは現在のファイルの先頭から検索を開始する。"]" で始まるコマ +ンドは現在のカーソル位置から検索を開始する。 + +'include' オプションは他のファイルをインクルードする行を定義する。デフォルトは +Cプログラム用の "\^#\s*include" である。Note: VimはCの構文を認識しない。もし +'include' オプションにマッチする行が "#ifdef/#endif" の間やコメント行であって +も、とにかく検索される。'isfname' オプションはマッチパターンに続くファイル名を +認識するために使用される。 + +'path' オプションは絶対パスを持たないインクルードファイルを探すためのディレク +トリを指定する。 + +'comments' オプションは単一行を表示するコマンド、もしくは行にジャンプするコマ +ンドで使用される。これはコメントの開始パターンを定義する。それらの行は [!] を +使用しない限り検索において無視される。ひとつの例外: 行が "^# *define" というパ +ターンにマッチしたとき、コメントであるとはみなされない。 + +もしマッチしたリストを表示して、その中からジャンプ先を選択したいならば、マッピ +ングが利用できる。例: > + + :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR> +< + *[i* +[i カーソルの下にあるキーワードを含む1行を表示する。検索 + はファイルの先頭から開始する。コメントとみなせる行は無 + 視される('comments' オプションを参照すること)。数字が + 与えられた場合は、先頭から指定した個数目にマッチした行 + を表示する。この場合はコメント行は無視されない。 + {Vi にはない} + + *]i* +]i "[i" と同様だが、検索が現在のカーソル位置から開始され + る。{Vi にはない} + + *:is* *:isearch* +:[range]is[earch][!] [count] [/]pattern[/] + "[i" や "]i" と同様だが、[range]で指定された範囲から検 + 索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + + *[I* +[I カーソルの下にあるキーワードを含む行をすべて表示する。 + 結果にはファイル名と行番号が表示される。検索はファイル + の先頭から開始される。{Vi にはない} + + *]I* +]I "[I" と同様だが、検索が現在のカーソル位置から開始され + る。{Vi にはない} + + *:il* *:ilist* +:[range]il[ist][!] [/]pattern[/] + "[I" や "]I" と同様だが、[range]で指定された範囲から検 + 索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + + *[_CTRL-I* +[ CTRL-I カーソルの下にあるキーワードを含む最初の1行にジャンプ + する。検索はファイルの先頭から開始する。コメントとみな + せる行は無視される ('comments' オプションを参照するこ + と)。数字が与えられた場合は、先頭から指定した個数目に + マッチした行にジャンプする。この場合はコメント行は無視 + されない。{Vi にはない} + + *]_CTRL-I* +] CTRL-I "[ CTRL-I" と同様だが、検索が現在のカーソル位置から開 + 始される。{Vi にはない} + + *:ij* *:ijump* +:[range]ij[ump][!] [count] [/]pattern[/] + "[ CTRL-I" や "] CTRL-I" と同様だが、[range]で指定され + た範囲から検索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + +CTRL-W CTRL-I *CTRL-W_CTRL-I* *CTRL-W_i* +CTRL-W i 新しいウィンドウを開き、カーソルの下にあったキーワード + を含む最初の1行に移動する。検索はファイルの先頭から開 + 始する。コメントとみなせる行は無視される('comments' オ + プションを参照すること)。数字が与えられた場合は、先頭 + から指定した個数目にマッチした行にジャンプする。この場 + 合はコメント行は無視されない。{Vi にはない} + + *:isp* *:isplit* +:[range]isp[lit][!] [count] [/]pattern[/] + "CTRL-W i" や "CTRL-W i" と同様だが、[range]で指定され + た範囲から検索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + + *[d* +[d カーソルの下にあるマクロを含む最初のマクロ定義を表示す + る。検索はファイルの先頭から開始する。数字が与えられた + 場合は、先頭から指定した個数目にマッチした行を表示する。 + {Vi にはない} + + *]d* +]d "[d" と同様だが、検索が現在のカーソル位置から開始され + る。{Vi にはない} + + *:ds* *:dsearch* +:[range]ds[earch][!] [count] [/]string[/] + "[d" や "]d" と同様だが、[range]で指定された範囲から検 + 索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + + *[D* +[D カーソルの下にあるマクロを含むすべてのマクロ定義を表示 + する。結果にはファイル名と行番号が表示される。検索はファ + イルの先頭から開始される。{Vi にはない} + + *]D* +]D "[D" と同様だが、検索が現在のカーソル位置から開始され + る。{Vi にはない} + + *:dli* *:dlist* +:[range]dli[st][!] [/]string[/] + `[D` や `]D` と同様だが、[range]で指定された範囲から検 + 索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + Note: `:dl` は `:dlist` ではなく、`:delete` に "l" レ + ジスタを指定したものとして機能する。 + + *[_CTRL-D* +[ CTRL-D カーソルの下にあるキーワードを含む最初のマクロ定義にジャ + ンプする。検索はファイルの先頭から開始する。数字が与え + られた場合は、先頭から指定した個数目にマッチした行にジャ + ンプする。 {Vi にはない} + + *]_CTRL-D* +] CTRL-D "[ CTRL-D" と同様だが、検索が現在のカーソル位置から開 + 始される。{Vi にはない} + + *:dj* *:djump* +:[range]dj[ump][!] [count] [/]string[/] + "[ CTRL-D" や "] CTRL-D" と同様だが、[range]で指定され + た範囲から検索する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + +CTRL-W CTRL-D *CTRL-W_CTRL-D* *CTRL-W_d* +CTRL-W d 新しいウィンドウを開き、カーソルの下にあったキーワード + を含む最初のマクロ定義に移動する。検索はファイルの先頭 + から開始する。数字が与えられた場合は、先頭から指定した + 個数目にマッチした行にジャンプする。 {Vi にはない} + + *:dsp* *:dsplit* +:[range]dsp[lit][!] [count] [/]string[/] + "CTRL-W d" と同様だが、[range]で指定された範囲から検索 + する(デフォルト: ファイル全体)。 + [/]と[!]については|:search-args|を参照。{Vi にはない} + + *:che* *:checkpath* +:che[ckpath] ファイルが見つからないすべてのインクルードファイル名を + リスト表示する。 + {Vi にはない} + +:che[ckpath]! すべてのインクルードファイル名をリスト表示する。 + {Vi にはない} + + *:search-args* +上記コマンドに共通の引数: +[!] 使用した場合は、コメントとみなせる行に対しても検索をする。使用しな + かった場合は 'comments' によってコメントとみなされる行やCコメント + ("//" の後ろか /* */ の間)にあるものは無視される。コメントとみなされた + 行が、途中からコメントでなくなるようなときは見逃すかもしれないことに注 + 意。 + また、コメント行であっても、('comments' によって)認識されないでとにか + くマッチするかもしれない。例: > + /* comment + foobar */ +< "foobar" に対する検索はマッチする。これは行がコメントとして認識されな + いためである(たとえ構文強調表示が認識したとしても)。 + Note: マクロ定義はたいていコメントと誤認されることはないので、 + ":dlist"や ":dsearch"、":djump" に[!]を使用することは大差がない。 +[/] パターンは '/' で囲むことができる。'/' なしの場合、"\<pattern\>" とい + うパターンを使うことによって、完全な語だけがマッチする。2つ目の '/' の + 後にだけ、'|' を使うことによって次のコマンドを追加できる。例: > + :isearch /string/ | echo "the last one" +< ":djump", ":dsplit", ":dlist", ":dsearch" コマンドではパターンは検索パ + ターンとしてではなく文字通りに使われる。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/term.jax b/plugins/vimdoc-ja/doc/term.jax new file mode 100644 index 0000000000..3b5c8453c0 --- /dev/null +++ b/plugins/vimdoc-ja/doc/term.jax @@ -0,0 +1,934 @@ +*term.txt* For Vim バージョン 8.0. Last change: 2017 Feb 02 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +端末情報 *terminal-info* + +Vim はユーザーが使っている端末の情報にもとづいて、ユーザーがどのキーを押したか +を認識します。この情報が正しくないと、スクリーンは乱れ、キーが認識されなくなっ +てしまいます。スクリーンに対する操作は、キーコードのシーケンスを出力することで +実現されています。特殊なキーを押すとコードのシーケンスが出力されます。これらの +シーケンスは端末オプションに保存されています。|terminal-options|を参照。 + +NOTE: |GUI| で実行しているときは、このドキュメントのほとんどの事柄は関係ありま +せん。 + +1. 起動 |startup-terminal| +2. 端末オプション |terminal-options| +3. ウィンドウサイズ |window-size| +4. 端末の速度 |slow-fast-terminal| +5. マウスの使用 |mouse-using| + +============================================================================== +1. 起動 *startup-terminal* + +Vim の起動時はデフォルトの端末タイプ向けの設定になっています。これは Amiga で +は標準の CLI ウィンドウ、MS-DOS では PC の端末、Unix では ANSI 端末です。 +他に 2, 3 の端末が常に使用可能です。後述の |builtin-terms| を参照。 + +Vim の引数 '-T' により端末名を指定することができます。これが指定されない場合、 +環境変数 TERM から端末名を取得しようとします。 + + *termcap* *terminfo* *E557* *E558* *E559* +Unix では terminfo データベースや termcap ファイルが使われます。全てのドキュメ +ントを通して、これのことを "termcap" と呼びます。コンパイル時に、configure に +より terminfo と termcap を使うかどうかが自動的に決定されます。":version" の出 +力に |+terminfo| が含まれていれば terminfo を使用しています。|xterm-screens|も +参照。 + +Unix 以外のシステムでは、TERMCAP を定義してコンパイルしたときのみ termcap を使 +用できます。 + + *builtin-terms* *builtin_terms* +どの組み込み端末が利用できるかは、feature.h で定義されているマクロに依存します。 +これらはコンパイル時に設定しなければなりません: + define ":version" の出力 組み込まれる端末 ~ +NO_BUILTIN_TCAPS -builtin_terms なし +SOME_BUILTIN_TCAPS +builtin_terms 一般的なもの (デフォルト) +ALL_BUILTIN_TCAPS ++builtin_terms 全て使用可能 + +利用可能な組み込み端末のリストを見るには ":set term=xxx" とします(GUI でないと +きのみ)。|+builtin_terms|も参照。 + +termcap のコードが組み込まれているときは、termcap ファイルと組み込みの +termpcap から、使われている端末用のキーシーケンスを取得しようとします。使われ +ている端末のエントリがあるならば、その両方が使われます。どちらが先に使われるか +はオプション 'ttybuiltin' に依存します。 + +'ttybuiltin' on 1: 組み込み termcap 2: 外部 termcap +'ttybuiltin' off 1: 外部 termcap 2: 組み込み termcap + +ある端末オプションが片方にないときは、もう一方から取得します。ある端末オプショ +ンが両方にあるときは、先に見つかった方が使われます。 + +どの外部 termcap ファイルが使われるかはシステムによって異なり、環境変数 +"TERMCAP" と "TERMPATH" に依存します。"man tgetent" を参照してください。 + +端末によって設定を切り替える *term-dependent-settings* + +端末名によってオプションやマッピングを切り替えるには .vimrc で行うのがベスト +です。例: > + + if &term == "xterm" + ... xterm 用のマッピングと設定 ... + elseif &term =~ "vt10." + ... vt100, vt102 用のマッピングと設定 ... + endif +< + *raw-terminal-mode* +通常の編集に入るとき、端末は raw モードになります。このとき、't_ti' と 't_ks' +で定義されるシーケンスが端末に送信されます。これらのシーケンスにより、端末は +termcap のコードが有効になり、カーソルキーとファンクションキーが使えるようにな +ります。Vim が終了するとき、端末を起動前のモードに戻します。このとき 't_te' と +'t_ke' で定義されるシーケンスが端末に送信されます。Amiga では、外部プログラム +を起動するコマンド(例: "!!")を実行するとき、一時的に端末が通常モードになります。 +そのため、print キーを押してスクリーンへの出力を止めることができます。<BS> を +押すと出力が再開します。 + + *xterm-bracketed-paste* +'t_BE' がオンの場合、raw モードに入るときに 't_BE' が端末に送信され、raw モー +ドを抜けるときに 't_BD' が送信されます。その際、端末はペーストされたテキストの +前に 't_PS' を置き、ペーストされたテキストの後に 't_PE' を置くことが想定されま +す。これにより、Vim はタイプされた文字とペーストされたテキストを分離することが +できます。ペーストされたテキストはマウスの中ボタンを使ったときと同様に扱われ、 +文字通り挿入され、コマンドとしては扱われません。 + +カーソルが最初の桁にある時は、ペーストされたテキストはその前に挿入されます。そ +うでなければ、ペーストされたテキストはカーソルの位置の後に追加されます。これは +最初の桁の後にペーストすることはできないことを意味します。残念ながら Vim には +マウスポイントがどこにあったかを知らせる方法はありません。 + +いくつかの状況では、Vim は bracketed paste を認識せず、生のテキストが取得され +る場合があることに注意してください。別のいくつかの状況では Vim はペーストされ +た最初の文字のみを取得し、残りは切り捨てられます。例: "r" コマンドを使った場 +合。bracketed paste で何か問題がある場合、.vimrc に以下を書くことで無効化する +ことができます: > + set t_BE= +もし Vim の実行中にこれを実行した場合、bracketed paste を無効化するため 't_BD' +が端末に送信されます。 + + *cs7-problem* +Note: Vim を起動した後で端末の設定を変えると、設定が一貫しない状態になるかもし +れません。Solaris 2.5 で "stty cs8 parenb" が "stty cs7 parenb" に復元されてし +まうという報告が上がっています。代わりに "stty cs8 -parenb -istrip" を使ってく +ださい。これは正しく復元されます。 + +'t_ks' を送った後では、カーソルキーが termcap で定義されているのとは異なるコー +ドを送るという意味で、ある種の termcap エントリは正しくありません。この問題を +避けるには 't_ks' (と 't_ke')を空文字列にします。これは初期化の最中に行わねば +なりません(|initialization| を参照)。そうでないと手遅れです。 + +いくつかの termcap エントリは、最上位ビットが常にオフになっていると仮定してい +ます。例: Amiga のカーソル↑エントリは例えば ":ku=\E[A:" です。しかし実際には +"\233A" が送られます。これは、シリアル回線上で使っているときなど、最上位ビット +がオフならば正しく動作します。カーソルキーが使えない場合はこのエントリを +":ku=\233A:" にしてみてください。 + +":ku=\E[A:" というエントリをもつ termcap エントリがあります。しかし実際には +"\233A" が送られます。出力において "\E[" と "\233" はしばしば同値であり、入力 +においてはそうでありません。この問題を解決するには、termcap エントリを変更する +か、:set コマンドでキーコードを変更するしかありません。 + +多くのカーソルキーのコードは <Esc> から始まります。Vim はこれが 1 つの <Esc> +キーを押下したものか、カーソルキーのシーケンスのはじまりかを判定しなければなり +ません。そのため、次の文字が届くのを待ちます。1 秒以内に次のキーが届かない場合 +は <Esc> が押されたとみなします。非常に遅いシステムではこれが誤判定され、カー +ソルキーが使えなくなることがあります。この問題に出会った場合は 'timeout' をオ +フにしてください。Vim は <Esc> の後に届く文字を待ちます。1 つの <Esc> を入力す +るには 2 回押さなければなりません。'esckeys' をオフにすると、挿入モードでのこ +の問題を解決できます。しかし挿入モードでカーソルキーとファンクションキーが使え +なくなってしまいます。 + +Amiga でウィンドウリサイズを認識するには、端末名が "amiga" か "builtin_amiga" +でなければなりません。 + +ある種の端末ではカーソルキーに混乱を招きやすいコードを割り当てています。 +televideo 925 はその一例です。televideo 925 はカーソル左キーで CTRL-H を送りま +す。そのためバックスペースとカーソル左を区別することは不可能です。この問題のた +め CTRL-H は常にカーソル左と認識されます。 + + *vt100-cursor-keys* *xterm-cursor-keys* +vt100 や xterm などの端末ではカーソルキーを押すと <Esc>OA や <Esc>OB などが送 +られます。不運なことに、これらは「挿入を終了し、上に新規行を作成して 'A' や +'B' を挿入する」という挿入モードでのコマンドでもあります。 +このコマンドを実行するのでなく、カーソルキーのシーケンスが入力されたのだと誤認 +識してしまうかもしれません。これを防ぎ、意図通りの動作をさせるには次の設定を使 +います: > + :set notimeout " マッピングについてタイムアウトしない + :set ttimeout " 端末のキーコードについてタイムアウトする + :set timeoutlen=100 " 100 ミリ秒後にタイムアウトする +この設定をすると、キーコードが 100 ミリ秒以内に送られた場合のみカーソルキーと +認識されます。ユーザーが普通に入力するときはそんなに速くないので、たとえまった +く同じキーコードのシーケンスを送信しても、個々のコマンドと認識されます。 + + *vt100-function-keys* *xterm-function-keys* +xterm は vt100 互換モードと非互換モードの両方のモードで F1 から F4 のファンク +ションキーを送信できます。Vim は xterm がどちらのコードを送信するかわからない +ので、両方のタイプのキーを認識するようになっています。<Home> と <End> について +も同様です。 + 通常 vt100 ~ + <F1> t_k1 <Esc>[11~ <xF1> <Esc>OP *<xF1>-xterm* + <F2> t_k2 <Esc>[12~ <xF2> <Esc>OQ *<xF2>-xterm* + <F3> t_k3 <Esc>[13~ <xF3> <Esc>OR *<xF3>-xterm* + <F4> t_k4 <Esc>[14~ <xF4> <Esc>OS *<xF4>-xterm* + <Home> t_kh <Esc>[7~ <xHome> <Esc>OH *<xHome>-xterm* + <End> t_@7 <Esc>[4~ <xEnd> <Esc>OF *<xEnd>-xterm* + +Vim が起動したときに <xF1> が <F1>へ、<xF2> が <F2> へマッピングされます。これ +により、デフォルトではどちらのコードも同じ動作になります。<xF2> へのマッピング +を作ると、デフォルトのマッピングが上書きされます。そして <F2> と <xF2> に別の +動作をさせることができます。 + + *xterm-shifted-keys* +新しいバージョンの xterm はシフトキーとファンクションキー、特殊キーの組み合わ +せをサポートしています。Vim はこれらのほとんどを認識します。":set termcap" に +よりどれがサポートされているか、そのコードは何かを調べることができます。大抵の +場合、これらは termcap には入っていません。builtin_xterm の termcap でのみサ +ポートされています。 + + *xterm-modifier-keys* +新しいバージョンの xterm は Alt と Ctrl キーとほとんどのファンクションキーの組 +み合わせをサポートしています。全てのキーに対する Alt、Ctrl、Shift の組み合わせ +全てを termcap に追加しなくてもいいように、termcap エントリの最後に ";*X" とい +う特殊なシーケンスを追加することができます。この "X" はどんな文字でもよく、'~' +がよく使われます。";*" は省略可能な修飾キー引数を意味します。";2" は +Shift、";3" は Alt、";5" はCtrl、";9" は Meta (Alt と異なる場合)。これらを組み +合わせることができます。例: > + :set <F8>=^[[19;*~ + :set <Home>=^[[1;*H +これらのコードのもう1つの特殊な性質は、他のコードで上書きできないことです。 +xterm から直接得られたコードが |t_RV| それらを上書きするのを避けるためです。 + + *xterm-scroll-region* +Sun などのプラットフォームのデフォルトの xterm 用の termcap エントリには領域の +スクロール用のエントリが入っていません。/etc/termcap の xterm エントリに +":cs=\E[%i%d;%dr:" を追加すれば全てうまく動作するでしょう。 + + *xterm-end-home-keys* +いくつかのシステム(少なくとも FreeBSD と XFree86 3.1.2)では、<End> と <Home> +キーが送信するキーに <NUL> 文字が含まれています。これらのキーが適切なキーコー +ドを送信するようにするために、次の行を ~/.Xdefaults に追加してください: + +*VT100.Translations: #override \n\ + <Key>Home: string("0x1b") string("[7~") \n\ + <Key>End: string("0x1b") string("[8~") + + *xterm-8bit* *xterm-8-bit* +xterm は 8 ビットエスケープシーケンスを使うモードで動作させることができます。 +このモードでは <Esc>[ の代わりに CSI コードが使われます。この利点は、挿入モー +ドで <Esc> が即座に認識されることです。なぜなら、特殊キーの開始と紛らわしくな +いためです。 +組み込みの termcap エントリでは、オプション 'term' のどこかに "8bit" が含まれ +ていないか確認されます。含まれていると、termcap エントリ、マウス等に 8 ビット +文字が使われます。シェルにおいて $TERM を "xterm-8bit" に設定しておくと、Vim +はそれに気づいて自動的に 8 ビットの設定を使うようになります。 +Vim がシーケンス |t_RV| (バージョン要求)への応答を受け取ったとき、それが CSI +で始まっていれば、その端末は 8 ビットモードであると認識し、全てのキーシーケン +スを 8 ビット版に変換します。 + +============================================================================== +2. 端末オプション *terminal-options* *termcap-options* *E436* + +端末オプションは普通のオプションとまったく同じように設定できます。しかし端末オ +プションは ":set all" コマンドでは表示されないので、代わりに ":set termcap" を +使ってください。 + +termcap コードに対応するオプションを設定することによって、そのシーケンスを変更 +することができます。例: > + :set t_ce=^V^[[K (CTRL-V, <Esc>, [, K) + +{Vi: 端末オプションは存在しない。Vi を終了し、termcap エントリを編集して再起動 +しなければならない} + +端末オプションの一覧を後で載せます。対応する termcap のコードと、それに対応す +るオプション名の最後の2文字が等しくなっています。絶対に必要な termcap コードは +カーソルを移動させる 't_cm' の1つだけです。 + +オプション 't_da', 't_db', 't_ms', 't_xs', 't_xn' は termcap におけるフラグに +対応しています。termcap にこれらのフラグが存在すると、対応するオプションに "y" +が設定されます。空でない文字列を設定するとオンになり、空文字列を設定するとオフ +になります。't_CS' もこれと同様ですが、termcap フラグではありません。 + +出力コード *terminal-output-codes* + option 意味 ~ + + t_AB 背景色を設定 (ANSI) *t_AB* *'t_AB'* + t_AF 文字色を設定 (ANSI) *t_AF* *'t_AF'* + t_AL 指定数の空行を追加する *t_AL* *'t_AL'* + t_al 空行を追加する *t_al* *'t_al'* + t_bc バックスペース文字 *t_bc* *'t_bc'* + t_cd スクリーンの最後までクリア *t_cd* *'t_cd'* + t_ce 行末までクリア *t_ce* *'t_ce'* + t_cl 画面をクリア *t_cl* *'t_cl'* + t_cm カーソル移動 (必須!) *E437* *t_cm* *'t_cm'* + t_Co 色数 *t_Co* *'t_Co'* + *t_CS* *'t_CS'* + t_CS 空でなければスクロール範囲に対する相対アドレスでカーソルを移動 + t_cs スクロール範囲を定義 *t_cs* *'t_cs'* + t_CV 縦スクロール範囲を定義 *t_CV* *'t_CV'* + t_da 空でない場合は上の行からスクロールダウンする *t_da* *'t_da'* + t_db 空でない場合は下の行からスクロールアップする *t_db* *'t_db'* + t_DL 複数行を削除 *t_DL* *'t_DL'* + t_dl 行を削除 *t_dl* *'t_dl'* + t_fs ウィンドウタイトルの終端を設定(ステータスラインから) *t_fs* *'t_fs'* + t_ke キーパッド使用終了 *t_ke* *'t_ke'* + t_ks キーパッド使用開始 *t_ks* *'t_ks'* + t_le カーソルを1文字分左へ移動 *t_le* *'t_le'* + t_mb 点滅モード *t_mb* *'t_mb'* + t_md 太字モード *t_md* *'t_md'* + t_me 通常モード (t_mr, t_mb, t_md, 色設定を解除) *t_me* *'t_me'* + t_mr 反転モード *t_mr* *'t_mr'* + *t_ms* *'t_ms'* + t_ms 空でない場合は強調・反転モードでカーソルを移動できる + t_nd 非破壊スペース{訳注: カーソルを1文字分右に移動} *t_nd* *'t_nd'* + t_op 元の色のペアに戻す *t_op* *'t_op'* + t_RI カーソルを指定数右へ移動 *t_RI* *'t_RI'* + t_Sb 背景色を設定 *t_Sb* *'t_Sb'* + t_Sf 文字色を設定 *t_Sf* *'t_Sf'* + t_se 強調終了 *t_se* *'t_se'* + t_so 強調モード *t_so* *'t_so'* + t_sr 逆スクロール *t_sr* *'t_sr'* + t_te "termcap" モードから抜ける *t_te* *'t_te'* + t_ti 端末を "termcap" モードにする *t_ti* *'t_ti'* + t_ts (ステータスラインに)ウィンドウタイトル設定開始 *t_ts* *'t_ts'* + t_ue 下線終了 *t_ue* *'t_ue'* + t_us 下線モード *t_us* *'t_us'* + t_Ce 下波線終了 *t_Ce* *'t_Ce'* + t_Cs 下波線モード *t_Cs* *'t_Cs'* + t_ut 現在の背景色を使ってクリア *t_ut* *'t_ut'* + t_vb ビジュアルベル *t_vb* *'t_vb'* + t_ve カーソル表示 *t_ve* *'t_ve'* + t_vi カーソル非表示 *t_vi* *'t_vi'* + t_vs カーソル強調表示 *t_vs* *'t_vs'* + *t_xs* *'t_xs'* + t_xs 空でない場合は強調が上書きによって消されない(hpterm) + *t_xn* *'t_xn'* + t_xn 空ではない場合、画面の右端のセルに書いた文字はスクロールを + 発生させない + t_ZH 斜体モード *t_ZH* *'t_ZH'* + t_ZR 斜体終了 *t_ZR* *'t_ZR'* + +Vim 独自のもの (標準的なコードはないもの): + t_IS アイコンテキスト設定開始 *t_IS* *'t_IS'* + t_IE アイコンテキスト設定終了 *t_IE* *'t_IE'* + t_WP ウィンドウ位置 (Y, X) をピクセルで指定 *t_WP* *'t_WP'* + t_WS ウィンドウサイズ (height, width) を文字数で指定 *t_WS* *'t_WS'* + t_SI 挿入モード開始 (バー型のカーソル) *t_SI* *'t_SI'* + t_SR 置換モードの開始 (下線型のカーソル) *t_SR* *'t_SR'* + t_EI 挿入または置換モード終了(ブロック型カーソル) *t_EI* *'t_EI'* + |termcap-cursor-shape| + t_RV 端末バージョン文字列を要求 (xterm 用) *t_RV* *'t_RV'* + |xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes| + t_u7 カーソル位置を要求 (xterm 用) *t_u7* *'t_u7'* + |'ambiwidth'| 参照 + t_RB 端末の背景色を要求 *t_RB* *'t_RB'* + t_8f 前景色を設定する (R, G, B) *t_8f* *'t_8f'* + |xterm-true-color| + t_8b 背景色を設定する (R, G, B) *t_8b* *'t_8b'* + |xterm-true-color| + t_BE bracketed paste モードを有効化する *t_BE* *'t_BE'* + |xterm-bracketed-paste| + t_BD bracketed paste モードを無効化する *t_BD* *'t_BD'* + |xterm-bracketed-paste| + +キーコード *terminal-key-codes* +Note: 可能なかぎり <> 形式を使ってください。 + + オプション名 意味 ~ + + t_ku <Up> カーソル上 *t_ku* *'t_ku'* + t_kd <Down> カーソル下 *t_kd* *'t_kd'* + t_kr <Right> カーソル右 *t_kr* *'t_kr'* + t_kl <Left> カーソル左 *t_kl* *'t_kl'* + <xUp> カーソル上の代替 *<xUp>* + <xDown> カーソル下の代替 *<xDown>* + <xRight> カーソル右の代替 *<xRight>* + <xLeft> カーソル左の代替 *<xLeft>* + <S-Up> シフト+カーソル上 + <S-Down> シフト+カーソル下 + t_%i <S-Right> シフト+カーソル右 *t_%i* *'t_%i'* + t_#4 <S-Left> シフト+カーソル左 *t_#4* *'t_#4'* + t_k1 <F1> F1 *t_k1* *'t_k1'* + <xF1> もう1つの F1 *<xF1>* + t_k2 <F2> F2 *<F2>* *t_k2* *'t_k2'* + <xF2> もう1つのF2 *<xF2>* + t_k3 <F3> F3 *<F3>* *t_k3* *'t_k3'* + <xF3> もう1つのF3 *<xF3>* + t_k4 <F4> F4 *<F4>* *t_k4* *'t_k4'* + <xF4> もう1つのF4 *<xF4>* + t_k5 <F5> F5 *<F5>* *t_k5* *'t_k5'* + t_k6 <F6> F6 *<F6>* *t_k6* *'t_k6'* + t_k7 <F7> F7 *<F7>* *t_k7* *'t_k7'* + t_k8 <F8> F8 *<F8>* *t_k8* *'t_k8'* + t_k9 <F9> F9 *<F9>* *t_k9* *'t_k9'* + t_k; <F10> F10 *<F10>* *t_k;* *'t_k;'* + t_F1 <F11> F11 *<F11>* *t_F1* *'t_F1'* + t_F2 <F12> F12 *<F12>* *t_F2* *'t_F2'* + t_F3 <F13> F13 *<F13>* *t_F3* *'t_F3'* + t_F4 <F14> F14 *<F14>* *t_F4* *'t_F4'* + t_F5 <F15> F15 *<F15>* *t_F5* *'t_F5'* + t_F6 <F16> F16 *<F16>* *t_F6* *'t_F6'* + t_F7 <F17> F17 *<F17>* *t_F7* *'t_F7'* + t_F8 <F18> F18 *<F18>* *t_F8* *'t_F8'* + t_F9 <F19> F19 *<F19>* *t_F9* *'t_F9'* + <S-F1> シフト+F1 + <S-xF1> もう1つの<S-F1> *<S-xF1>* + <S-F2> シフト+F2 *<S-F2>* + <S-xF2> もう1つの<S-F2> *<S-xF2>* + <S-F3> シフト+F3 *<S-F3>* + <S-xF3> もう1つの<S-F3> *<S-xF3>* + <S-F4> シフト+F4 *<S-F4>* + <S-xF4> もう1つの<S-F4> *<S-xF4>* + <S-F5> シフト+F5 *<S-F5>* + <S-F6> シフト+F6 *<S-F6>* + <S-F7> シフト+F7 *<S-F7>* + <S-F8> シフト+F8 *<S-F8>* + <S-F9> シフト+F9 *<S-F9>* + <S-F10> シフト+F10 *<S-F10>* + <S-F11> シフト+F11 *<S-F11>* + <S-F12> シフト+F12 *<S-F12>* + t_%1 <Help> ヘルプキー *t_%1* *'t_%1'* + t_&8 <Undo> アンドゥキー *t_&8* *'t_&8'* + t_kI <Insert> インサートキー *t_kI* *'t_kI'* + t_kD <Del> デリートキー *t_kD* *'t_kD'* + t_kb <BS> バックスペースキー *t_kb* *'t_kb'* + t_kB <S-Tab> バックタブ(シフト+タブ) *<S-Tab>* *t_kB* *'t_kB'* + t_kh <Home> ホームキー *t_kh* *'t_kh'* + t_#2 <S-Home> シフト+ホームキー *<S-Home>* *t_#2* *'t_#2'* + <xHome> もう1つのホームキー *<xHome>* + t_@7 <End> エンドキー *t_@7* *'t_@7'* + t_*7 <S-End> シフト+エンドキー *<S-End>* *t_star7* *'t_star7'* + <xEnd> もう1つのエンドキー *<xEnd>* + t_kP <PageUp> ページアップキー *t_kP* *'t_kP'* + t_kN <PageDown> ページダウンキー *t_kN* *'t_kN'* + t_K1 <kHome> キーパッドホームキー *t_K1* *'t_K1'* + t_K4 <kEnd> キーパッドエンドキー *t_K4* *'t_K4'* + t_K3 <kPageUp> キーパッドページアップキー *t_K3* *'t_K3'* + t_K5 <kPageDown> キーパッドページダウンキー *t_K5* *'t_K5'* + t_K6 <kPlus> キーパッドプラスキー *<kPlus>* *t_K6* *'t_K6'* + t_K7 <kMinus> キーパッドマイナスキー *<kMinus>* *t_K7* *'t_K7'* + t_K8 <kDivide> キーパッド / *<kDivide>* *t_K8* *'t_K8'* + t_K9 <kMultiply> キーパッド * *<kMultiply>* *t_K9* *'t_K9'* + t_KA <kEnter> キーパッドエンターキー *<kEnter>* *t_KA* *'t_KA'* + t_KB <kPoint> キーパッド . *<kPoint>* *t_KB* *'t_KB'* + t_KC <k0> キーパッド 0 *<k0>* *t_KC* *'t_KC'* + t_KD <k1> キーパッド 1 *<k1>* *t_KD* *'t_KD'* + t_KE <k2> キーパッド 2 *<k2>* *t_KE* *'t_KE'* + t_KF <k3> キーパッド 3 *<k3>* *t_KF* *'t_KF'* + t_KG <k4> キーパッド 4 *<k4>* *t_KG* *'t_KG'* + t_KH <k5> キーパッド 5 *<k5>* *t_KH* *'t_KH'* + t_KI <k6> キーパッド 6 *<k6>* *t_KI* *'t_KI'* + t_KJ <k7> キーパッド 7 *<k7>* *t_KJ* *'t_KJ'* + t_KK <k8> キーパッド 8 *<k8>* *t_KK* *'t_KK'* + t_KL <k9> キーパッド 9 *<k9>* *t_KL* *'t_KL'* + <Mouse> マウスコードの先頭部分 *<Mouse>* + t_PS bracketed paste の開始 |xterm-bracketed-paste| *t_PS* *'t_PS'* + t_PE bracketed paste の終了 |xterm-bracketed-paste| *t_PE* *'t_PE'* + +Note t_so と t_mrについて: termcap に "so" エントリがない場合は "mr" が使われ +ます。逆に "mr" がない場合は "so" が使われます。"se" と "me" も同じ関係にあり +ます。お使いの端末が反転と強調の両方をサポートしているならば、これらは別々の +モードとして表示されます。これらの片方しかサポートしていない場合は、どちらも同 +じように表示されます。 + + *keypad-comma* +キーパッドのキーは、何かにマップされていないときは通常のキーと等価です。ただ 1 +つだけ例外があります。小数点キーがあるべき場所にコンマキーがあるキーパッドの場 +合でも Vim では小数点として認識されます。これを修正するには次のマッピングを使っ +てください: > + :noremap <kPoint> , + :noremap! <kPoint> , +< *xterm-codes* +キーコードを取得するトリックがあります。これは現在のところ xterm でだけ動作し +ます。|t_RV| が定義されていて、xterm のパッチレベルが 141 以上であることを示す +返信を受け取った場合、Vim は特別なエスケープシーケンスを使って xterm から直接 +キーコードを要求します。その返信を使って様々な t_ のコードを調整します。これに +よって xterm がモード (8-bit, VT102, VT220 など) によって異なるコードを出力す +るという問題に対応することができます。そのため、<xF1> のようなコードは必要なく +なります。 +Note: これは起動時にのみ行われます。Vim が起動した後で xterm のオプションが変 +更された場合は、これらのエスケープシーケンスはそれ以降、認識されなくなる可能性 +があります。 + + *xterm-true-color* +Vimは端末がサポートするならば、トゥルーカラーを使うこと (|highlight-guifg| 及 +び |highlight-guibg| を流用する) をサポートします。これを機能させるには +'termguicolors' オプションをセットする必要があります。 +トゥルーカラーをサポートする端末の一覧については +https://gist.github.com/XVilka/8346728 を参照してください。 + +場合によっては 'termguicolors' を設定するだけでは不十分で、|t_8f| と |t_8b| オ +プションを明示的に設定しなければならないことがあります。これらのオプションのデ +フォルトはそれぞれ "^[[38;2;%lu;%lu;%lum" と "^[[48;2;%lu;%lu;%lum" で、 +`$TERM` が `xterm` の時にだけ設定されます。幾つかの端末は同じシーケンスを受け +付けますが、全てのセミコロンをコロンで置き換える必要があります (実際にはコチラ +のほうが互換性の高い方法ですが、広くはサポートされていません): > + let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum" + let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum" + +これらのオプションは printf 用の文字列を含んでおり、|printf()| (実際には `l` +modifier ゆえに C 言語のものと同等) により t_ オプションの値と、赤、青、緑を表 +現する 0 から 255 の 3 つの符号なし長整数の値が組み合わせれます。 + + *xterm-resize* +xterm でのウィンドウサイズ変更はリソース allowWindowOps が有効なときのみ動作し +ます。システムや xterm のバージョンによっては、セキュリティ上の問題になるとの +考えにより、既定では無効になっていることがあります。それが本当に問題になるかど +うかは明らかではありません。 + +既定値を上書きするには、次の行を ~/.Xdefaults または ~/.Xresources に書きま +す: +> + XTerm*allowWindowOps: true + +そして "xrdb -merge .Xresources" を実行し、この設定を有効化します。コンテキス +トメニュー(CTRL キーを押しながらマウス右ボタン)でこの値を確認できます。 +allow-window-pos にチェックが入っているはずです。 + + *termcap-colors* +色についての Note: 't_Co' は利用できる色の数を示します。この値が 0 でなければ +'t_AB' と 't_AF' の値を使って色を設定します。これらのうちどれかが存在しない場 +合は 't_Sb' と 't_Sf' が使われます。色をデフォルトに戻すのには 't_me' が使われ +ます。 + + *termcap-cursor-shape* *termcap-cursor-color* +Vimが挿入モードに入るときにはエスケープシーケンス 't_SI' が送られます。置換モ +ードに入るときにはエスケープシーケンス 't_SR' が設定されていれば送られます。設 +定されていない場合には 't_SI' が送られます。挿入モード及び置換モードを抜けると +きには 't_EI' が送られます。これらは挿入や置換モードにおいてカーソルの形や色を +変えるのに利用できます。またこれらは標準的な termcap/terminfo エントリではない +ので、自分で設定する必要があります。 + +以下は xterm でカーソルの色を変える例です: > + if &term =~ "xterm" + let &t_SI = "\<Esc>]12;purple\x7" + let &t_SR = "\<Esc>]12;red\x7" + let &t_EI = "\<Esc>]12;blue\x7" + endif +NOTE: Vim を終了するとき、ノーマルモードでのカーソル設定がそのまま残ります。 +Vim を起動する前のカーソル設定は復元されません。 +{|+cursorshape| つきでコンパイルしたときのみ利用可能} + + *termcap-title* +文字列を送ってタイトルを変更できる端末の場合は 't_ts' と 't_fs' を使ってウィン +ドウタイトルを変更できます。これらがタイトル文字列の前後に送られます。同様に +'t_IS' と 't_IE' を使ってアイコンテキストが設定されます。これらの termcap エン +トリは Vim 独自の拡張であり、外部の termcap からこれらを取得することはできませ +ん。しかし組み込みの termcap に xterm と iris-ansi 用のエントリが含まれており、 +これらを自分で設定する必要はありません。 + *hpterm* +もしも反転などの強調が正常に機能しない場合は、't_xs' を空でない文字列に設定し +てみてください。すると 't_ce' コードを使って行から強調を取り除くようになります。 +"hpterm" に対してはこれが必要です。'weirdinvert' を設定すると 't_xs' を空でな +い値にするのと同じ効果があります。 + + *scroll-region* +端末が領域スクロールをサポートしているのに 'cs' エントリを含まない termcap が +あります。例えば Sun の xterm がそうです。この場合は builtin_xterm を使うか、 +t_cs を自分で定義します。例: > + :set t_cs=^V^[[%i%d;%dr +^V は CTRL-V、^[ は <Esc> を表します。 + +t_CV (領域縦スクロール) は標準的な termcap コードではありません。Vim はこれを +GUI モードで内部的に使っています。しかし、領域縦スクロールに対応している端末が +あるなら、その端末でもこれを定義することができます。2つの引数は、スクロールを +制限する領域の左右の桁を表します。t_cs が行の上端と下端を定義するのと同じです。 +t_CV を定義すると垂直分割したウィンドウのスクロールがとても速くなります。t_da +または t_db を設定したときは t_CV を設定しないでください(スクロールするときテ +キストが消去されなくなります)。 + +残念ながら、領域スクロールを使用しているとき、カーソルの位置がどう変わるかを +termcap から推測することは不可能です。スクリーンの始点から相対的またはスクロー +ルさせる領域の始点から相対的になります。ほとんどの端末では前者となります。よく +知られた例外は MS-DOS コンソール(pcterm)です。カーソル位置がスクロールさせる領 +域の始点から相対的となる場合は 't_CS' オプションになんらかの文字列を設定しなけ +ればなりません。そうでなければ空文字列となります。'term' が "pcterm" のときは +デフォルトで "yes" になります。 + +xterm ユーザーへの注意: 通常、Shift + カーソルキーは使用できません。xmodmap コ + マンドと Vim でマッピングを使えば、これらを使用できるようになります。 + + 以下のコマンドを xterm の中で実行します: + xmodmap -e "keysym Up = Up F13" + xmodmap -e "keysym Down = Down F16" + xmodmap -e "keysym Left = Left F18" + xmodmap -e "keysym Right = Right F19" + + そして次のマッピングを Vim の中で実行します: + :map <t_F3> <S-Up> + :map! <t_F3> <S-Up> + :map <t_F6> <S-Down> + :map! <t_F6> <S-Down> + :map <t_F8> <S-Left> + :map! <t_F8> <S-Left> + :map <t_F9> <S-Right> + :map! <t_F9> <S-Right> + +Shift+カーソル上キーに対して <S-Up> 以外のコマンドを割り当てることもできます。 +Note: 左側にキーがある Sun のキーボードを使っている人を助けるために、以下の +キーは使われません。 +F14 (アンドゥキーと混乱するため) +F15 (ウィンドウを全面に移動するキーであるため) +F17 (ウィンドウを閉じるキーであるため) +他のシステムではこれらも使用できるでしょう。 + +============================================================================== +3. ウィンドウサイズ *window-size* + +[これは Vim 自身のウィンドウのサイズのことです。":split" コマンドで分割できる +ウィンドウのことではありません。] + +Amiga 上では端末名が "amiga" または "builtin_amiga" であればアミーガ固有のウィ +ンドウリサイズ処理が有効になります。Unix ではウィンドウサイズを取得するために +3 種類の方法が試行されます: + +- ioctl 呼び出し (システムによって TIOCGSIZE か TIOCGWINSZ のどちらか) +- 環境変数 "LINES" と "COLUMNS" +- termcap エントリ "li" と "co" + +これら全てが失敗した場合はデフォルトの 24 行 80 桁とみなされます。ウィンドウ +サイズ変更のシグナルを受け取るとそのサイズに再設定されます。ウィンドウサイズが +正しくない場合は、オプション 'lines' と 'columns' で正しい値を設定することがで +きます。 + +スクリーンサイズを設定するには次のコマンドを使います: + + *:mod* *:mode* *E359* +:mod[e] [mode] + +引数が指定されない場合はスクリーンサイズを検出し、スクリーンを再描画します。 +MS-DOS ではスクリーンモードを切り替えることが可能です。[mode] は以下のうちのど +れか1つです。 + "bw40" 40 桁 白黒 + "c40" 40 桁 カラー + "bw80" 80 桁 白黒 + "c80" 80 桁 カラー (ほとんどの場合はこれ) + "mono" 80 桁 モノクロ + "c4350" 43 or 50 行 EGA/VGA モード + number モード番号。ビデオカードに依存 + +============================================================================== +4. 端末の速度 *slow-fast-terminal* + *slow-terminal* + +高速な端末を使用している場合はオプション 'ruler' をオンにするとよいでしょう。 +するとステータスラインにカーソル位置が表示されます。水平スクロールをオンにして +いる('wrap' をオフ)にしているなら 'sidescroll' を小さい値にするとよいでしょう。 + +遅い端末を使用している場合はオプション 'showcmd' をオフにするとよいでしょう。 +するとコマンド文字列がステータスラインに表示されなくなります。端末のスクロール +が非常に遅いなら、'scrolljump' を5ぐらいにしてください。("j" などで)カーソルが +スクリーンから出たとき、一度に5行スクロールするようになります。もう1つの方法は、 +"z{height}<CR>" でスクリーンの中で Vim が使う行数を減らすことです。 + +端末から文字が届く間隔が1秒以上になる場合は 'timeout' と 'ttimeout' を設定しな +おすとよいでしょう。オプションの章を参照してください |options|。 + +お使いの端末が領域のスクロールをサポートしていないが、行の挿入・削除コマンドを +サポートしている場合、複数のウィンドウを開いた状態でスクロールすると、行が上下 +するかもしれません。これが好ましくない場合は 'ttyfast' をオンにしてください。 +するとウィンドウをスクロールするのでなく再描画するようになります。 + +お使いの端末におけるスクロールが非常に遅いが再描画は遅くないという場合は、 +'ttyscroll' を 3 などの小さな値にしてください。すると、3 行より多くスクロール +する場合はスクロールでなく画面を再描画するようになります。 + +低速なカラー端末をお使いの場合は、次のコマンドを実行してください: > + hi NonText cterm=NONE ctermfg=NONE +すると、異なる属性を持つスペースを送信しないようになります。ほとんどの端末では +どちらにせよそれは目に見えません。 + +低速なシリアル回線上で Vim を使っている場合は、"screen" プログラム上で Vim を +実行するとよいかもしれません。screen は端末の入出力をほんの少し最適化します。 + +termcap オプションをテストする際、何が起こっているかを見たいならば 'writedelay' +をオンにするとよいかもしれません。これがゼロでない場合、一度に1つの文字が端末 +に送られます(MS-DOS では機能しません)。そうすると画面の更新がとても遅くなり、 +何が起こっているかが見えるようになります。 + +============================================================================== +5. マウスの使用 *mouse-using* + +この節では端末や端末エミュレータ上でマウスを使う方法を説明します。GUI のウィン +ドウでマウスを使う方法については |gui-mouse| で説明されています。マウスホイー +ルでスクロールする方法については |scroll-mouse-wheel| を参照してください。 + +次のコマンドでマウスを有効にしてください: > + :set mouse=a +これを行わないと、Vim はどのモード('mouse' を参照)でもマウスを認識できません。 + +現時点では Unix の xterm、|sysmouse| つきの *BSD コンソール、Linux コンソール +(GPM マウスにも対応 |gpm-mouse|)、MS-DOS、Windows コンソールにおいてマウスがサ +ポートされています。 +マウスクリックによってカーソル位置の設定、領域の選択、ペーストを行えます。 + +'mouse' オプションに以下の文字を含めることにより、どの状況でマウスを有効にする +かを設定します: + n ノーマルモード + v ビジュアルモード + i 挿入モード + c コマンドラインモード + h ヘルプファイルを閲覧しているときの上記の4モード全て + a 上記の4モード全て + r |hit-enter| プロンプトが出ているとき + +'mouse' の既定値は空で、マウスは無効になっています。普通は次のようにしてマウス +を有効にします: > + :set mouse=a +これは 'mouse' の値を "nvich" にすることと同値です。 +特定のモードでだけマウスを使いたい場合や、2つの質問のために使いたい場合は、こ +れらの文字を組み合わせます。 +例: > + :set mouse=nv +上の例はノーマルモードとビジュアルモードでのみマウスを有効にします。 > + :set mouse=h +上の例はヘルプファイルでのみマウスを有効にします ("g<LeftMouse>" でタグジャン +プができるようになります) + +マウスで選択を開始した場合、ビジュアルモードと選択モードのどちらになるかは +'selectmode' に "mouse" が含まれているかどうかによります。 + +xterm において、現在有効になっているモードが 'mouse' オプションに含まれている +ときマウスをクリックすると、それは Vim によって処理されます。Shift や Ctrl +キーを押しながらクリックすると xterm に伝わります。現在有効なモードが 'mouse' +に含まれていない場合、すべてのクリックは xterm に伝わります。 + + *xterm-clipboard* +Athena と Motif の GUI 版では、端末の中で動作しているときも、X サーバーとの接 +続があれば(DISPLAY がセットされていれば)、コピーとペーストが GUI 版と同様に動 +作します。そうでないときは真ん中ボタンクリックで無名レジスタが挿入されます。こ +の場合、テキストをコピー&ペーストする方法は次の通りです: + +ビジュアルモードでマウスを使ってコピー&ペーストする方法('mouse' がセットされ +ていなければなりません。上記参照): +1. コピーしたいテキストの最初の文字の上で左ボタンを押して最後の文字の上までマ + ウスポインタを動かし、ボタンを離します。するとビジュアルモードが開始し、選 + 択したテキストが強調されます。 +2. "y" を押して選択したテキストを無名レジスタにヤンクします。 +3. ペーストしたい位置で左ボタンをクリックします。 +4. 真ん中ボタンをクリックします。 + +ショートカット: ペーストしたい位置が選択したテキストと同時に画面に見えている場 +合は、ペーストしたい位置で真ん中ボタンをクリックすることにより、2, 3, 4 のス +テップを一度に行えます: + +Note: コマンドライン引数 |-X| が指定されていると Vim は X サーバーに接続せず、 +X のクリップボード(セレクション)へのコピー&ペーストは機能しません。Shift キー +を押しながらクリックすることにより、xterm に選択を行わせることができます。 + + *xterm-command-server* +X サーバーのクリップボードを利用できるときは、コマンドライン引数 --servername +を指定すると |x11-clientserver| で説明されているコマンドサーバーが有効になりま +す。 + + *xterm-copy-paste* +NOTE: 古い xterm では95桁目または223桁目を越えてカーソルを移動できない場合があ +ります。これは xterm の問題であり、Vim の問題ではありません。新しい xterm を入 +手してください |color-xterm|。また |'ttymouse'| を参照してください。 + +xterm でコピー&ペーストする方法('mouse' に現在のモードが含まれていないとき): +1. テキストの最初の文字の上で左ボタンを押し、最後の文字までマウスポインタを動 + かしてからボタンを離します。 +2. 普通の Vim のコマンドを使ってカーソルをペーストしたい位置まで動かします。 +3. "a" を押して挿入モードを開始します。 +4. 真ん中ボタンを押します。 +5. ESC を押して挿入モードを抜けます。 +('mouse' に含まれているモードにいる場合も、Shift キーを押しながらマウスを操作 +することによりどの操作も同じようにできます) + +Note: ペーストするときに8ビット目が失われてしまう(特殊文字が他の文字に変換され +てしまう)ときは、Vim を起動する前にシェルで "stty cs8 -istrip -parenb" としな +ければならないかもしれません。 + +xterm では Shift と Ctrl キーを押しながらマウスを使うことはできません。CTRL 修 +飾子を必要とするマウスコマンドは、マウス操作の前に "g" を押すことでシミュレー +トできます: + "g<LeftMouse>" は "<C-LeftMouse> (クリックした位置のタグへジャンプ) + "g<RightMouse>" は "<C-RightMouse> ("CTRL-T") + + *mouse-mode-table* *mouse-overview* +以下は、'mousemodel' が "extend" の場合のマウスボタンの機能の概略です: + +ノーマルモード: +イベント カーソル 選択範囲 ウィンドウ 動作 ~ + 移動 切替 ~ +<LeftMouse> yes end yes +<C-LeftMouse> yes end yes "CTRL-]" (2) +<S-LeftMouse> yes no change yes "*" (2) *<S-LeftMouse>* +<LeftDrag> yes start or extend (1) no *<LeftDrag>* +<LeftRelease> yes start or extend (1) no +<MiddleMouse> yes if not active no put +<MiddleMouse> yes if active no yank and put +<RightMouse> yes start or extend yes +<A-RightMouse> yes start or extend blockw. yes *<A-RightMouse>* +<S-RightMouse> yes no change yes "#" (2) *<S-RightMouse>* +<C-RightMouse> no no change no "CTRL-T" +<RightDrag> yes extend no *<RightDrag>* +<RightRelease> yes extend no *<RightRelease>* + +挿入/置換モード: +イベント カーソル 選択範囲 ウィンドウ 動作 ~ + 移動 切替 ~ +<LeftMouse> yes (cannot be active) yes +<C-LeftMouse> yes (cannot be active) yes "CTRL-O^]" (2) +<S-LeftMouse> yes (cannot be active) yes "CTRL-O*" (2) +<LeftDrag> yes start or extend (1) no like CTRL-O (1) +<LeftRelease> yes start or extend (1) no like CTRL-O (1) +<MiddleMouse> no (cannot be active) no put register +<RightMouse> yes start or extend yes like CTRL-O +<A-RightMouse> yes start or extend blockw. yes +<S-RightMouse> yes (cannot be active) yes "CTRL-O#" (2) +<C-RightMouse> no (cannot be active) no "CTRL-O CTRL-T" + +ヘルプウィンドウ: +イベント 位置 選択 変更 動作 ~ + カーソル ウィンドウ ~ +<2-LeftMouse> yes (cannot be active) no "^]" (jump to help tag) + +'mousemodel' が "popup" の場合は次のように異なります: + +ノーマルモード: +イベント カーソル 選択範囲 ウィンドウ 動作 ~ + 移動 切替 ~ +<S-LeftMouse> yes start or extend (1) no +<A-LeftMouse> yes start or extend blockw. no *<A-LeftMouse>* +<RightMouse> no popup menu no + +挿入/置換モード: +イベント カーソル 選択範囲 ウィンドウ 動作 ~ + 移動 切替 ~ +<S-LeftMouse> yes start or extend (1) no like CTRL-O (1) +<A-LeftMouse> yes start or extend blockw. no +<RightMouse> no popup menu no + +(1) 押してからマウスポインタが移動したときのみ +(2) 同一バッファでクリックしたときのみ + +左ボタンをクリックするとカーソルが移動します。他のウィンドウ内でクリックすると +そのウィンドウがアクティブになります。コマンドラインを編集中はコマンドライン内 +でカーソルが移動します。挿入モードでクリックしたときは挿入モードのままです。 +'scrolloff' がセットされている場合は、ウィンドウの境界から 'scrolloff' 行数内 +の範囲にカーソルが移動し、テキストがスクロールします。 + +選択は、左ボタンを押すと始まり、カーソルを移動してボタンを離すことで行います。 +ボタンを離すまでは選択が見えるようにならない場合もあります。GUI, MS-DOS, WIN32 +などいくつかのバージョンでのみドラッグが即座に表示されます。'scrolloff' がゼロ +でない場合、ウィンドウの最初/最後の行で1文字以上動かすとテキストがスクロールす +る可能性があることに注意してください。 + +ノーマルモード、ビジュアルモード、選択モードで右ボタンをクリックすると選択範囲 +が拡大します。ただし、'mousemodel' が "popup" のときは、Shift キーを押したまま +で左ボタンをクリックします。他のバッファを開いているウィンドウの中をクリックす +るとビジュアルモードと選択モードは中止されます。 + +ノーマルモード、ビジュアルモード、選択モードで Alt キーを押したまま右ボタンを +クリックすると、選択範囲が矩形になります。ただし、'mousemodel' が "popup" のと +きは、Alt キーを押しながら左ボタンをクリックします。Alt キーを押しているときは +マウスイベントをウィンドウマネージャーが処理(ウィンドウ移動など)してしまうシス +テムでは機能しないことに注意してください。 + + *double-click* +MS-DOS、Win32、xterm (関数 gettimeofday() が使用できるとき)において、GUI が有 +効なときはダブル、トリプル、クアドラプルクリックが使用できます。テキストを選択 +しているときさらにクリックすると選択範囲が拡大します: + クリック 選択範囲 ~ + ダブル 単語または % でのマッチ *<2-LeftMouse>* + トリプル 行 *<3-LeftMouse>* + クアドラプル 矩形範囲 *<4-LeftMouse>* +例外: ヘルプウィンドウでダブルクリックすると、その下にある単語のヘルプへジャン +プします。 +単語の上でダブルクリックするとその単語を選択します。単語を構成する文字は +'iskeyword' によって決まります。対応する文字がある文字の上でダブルクリックする +とそのマッチまでを選択します("v%" と同様)。そのマッチが #if/#else/#endif であ +る場合、選択は行単位になります。 +MS-DOS と xterm ではダブルクリックの間隔は 'mousetime' で設定できます。他のシ +ステムでは、この間隔は Vim の外部で設定されています。 +例: ダブルクリックでカーソル下のタグへジャンプする > + :map <2-LeftMouse> :exe "tag ". expand("<cword>")<CR> + +ダブルクリックによるドラッグ(押す、離す、押してドラッグ)をすると単語全体が選択 +されるようになります。これはボタンが離されるまで続き、ボタンを離すと文字単位に +戻ります。 + + *gpm-mouse* +GPM マウスは |+mouse_gpm| 機能を有効にしてコンパイルしたときのみサポートされま +す。GPM マウスドライバ(Linux コンソール)はクアドラプルクリックに対応していませ +ん。 + +挿入モードで選択を開始すると、一時的にノーマルモードへ移行します。ビジュアル +モードまたは選択モードが終了すると挿入モードへ戻ります。挿入モードにおける +CTRL-O と同様です。'selectmode' オプションが "mouse" を含んでいると選択モード +になります。 + + *sysmouse* +sysmouse は、コンパイル時に |+mouse_sysmouse| 機能が有効化されている場合のみサ +ポートされます。sysmouse ドライバ(*BSD コンソール)はキーボード修飾子には対応し +ていません。 + + *drag-status-line* +ウィンドウを複数に分割しているとき、マウスでステータスラインをドラッグすると +ウィンドウのサイズを変更できます。マウスをステータスライン上へ持っていき、左ボ +タンを押し、ステータスラインを望みの位置まで動かしてボタンを離します。単にス +テータスラインをクリックすると、カーソルを動かさずにそのウィンドウをカレントに +します。ステータスラインのドラッグは、ウィンドウを選択して位置やサイズが変わる +と混乱を招きがちです。しかしこれは確かに動作します(試してみてください)。 + + *<MiddleRelease>* *<MiddleDrag>* +マウスクリックイベントもマップすることができます。マウスクリックに対するコード +は次の通りです: + コード マウスボタン 通常の動作 ~ + <LeftMouse> 左ボタン押下 カーソル位置設定 + <LeftDrag> 左ボタンを押しながら移動 選択範囲を拡張 + <LeftRelease> 左ボタン放す 選択を終了 + <MiddleMouse> 中央ボタン押下 カーソル位置にテキストを貼り付け + <MiddleDrag> 中央ボタンを押しながら移動 - + <MiddleRelease> 中央ボタン放す - + <RightMouse> 右ボタン押下 選択を拡張 + <RightDrag> 右ボタンを押しながら移動 選択を拡張 + <RightRelease> 右ボタン放す 選択を終了 + <X1Mouse> X1 ボタン押下 - *X1Mouse* + <X1Drag> X1 ボタンを押しながら移動 - *X1Drag* + <X1Release> X1 ボタン放す - *X1Release* + <X2Mouse> X2 ボタン押下 - *X2Mouse* + <X2Drag> X2 ボタンを押しながら移動 - *X2Drag* + <X2Release> X2 ボタン放す - *X2Release* + +X1 ボタンと X2 ボタンは、ある種のマウスについている4番目、5番目のボタンのこと +です。'Microsoft Explorer' マウスの場合、これらのボタンは右親指の位置について +います。現在のところ、X1 と X2 は Win32 と X11 環境でのみ機能します。 + +例: > + :noremap <MiddleMouse> <LeftMouse><MiddleMouse> +マウス中央ボタンをクリックしたとき、クリックした位置に貼り付けます(通常はカー +ソル位置に貼り付けます)。 > + + :noremap <LeftRelease> <LeftRelease>y +ビジュアルモードで選択範囲を即座にヤンクします。 + +Note 再帰マッピングにならないように "map" でなく "noremap" を使っています。 +> + :map <X1Mouse> <C-O> + :map <X2Mouse> <C-I> +X1 と X2 ボタンでジャンプリストの前後に移動するようにマップします。 +|CTRL-O| と |CTRL-I| を参照。 + + *mouse-swap-buttons* +左右のマウスボタンの意味を交換するには次のようにします: > + :noremap <LeftMouse> <RightMouse> + :noremap <LeftDrag> <RightDrag> + :noremap <LeftRelease> <RightRelease> + :noremap <RightMouse> <LeftMouse> + :noremap <RightDrag> <LeftDrag> + :noremap <RightRelease> <LeftRelease> + :noremap g<LeftMouse> <C-RightMouse> + :noremap g<RightMouse> <C-LeftMouse> + :noremap! <LeftMouse> <RightMouse> + :noremap! <LeftDrag> <RightDrag> + :noremap! <LeftRelease> <RightRelease> + :noremap! <RightMouse> <LeftMouse> + :noremap! <RightDrag> <LeftDrag> + :noremap! <RightRelease> <LeftRelease> +< + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/tips.jax b/plugins/vimdoc-ja/doc/tips.jax new file mode 100644 index 0000000000..f9c6ba9052 --- /dev/null +++ b/plugins/vimdoc-ja/doc/tips.jax @@ -0,0 +1,541 @@ +*tips.txt* For Vim バージョン 8.0. Last change: 2009 Nov 07 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vim を使うときのヒントとアイデア *tips* + +これは、多くのユーザーにとって便利だろうと思うことの一部です。wiki には +もっと多くの tips があります。http://www.vim.org + +ユーザーマニュアルも参照してください。ユーザーマニュアルにはたくさんのtipsが含 +まれています|usr_toc.txt|。 + +C のプログラムを編集する |C-editing| +識別子が使われている場所を検索する |ident-search| +xterm でのスクリーンの切り替え |xterm-screens| +挿入モードでスクロールさせる |scroll-insert| +スムーズにスクロールさせる |scroll-smooth| +ありがちなタイプミスを修正する |type-mistakes| +単語や行の数を数える |count-items| +カーソルの位置を戻す |restore-position| +ファイルをリネームする |rename-files| +複数ファイル中の名前を置換する |change-name| +外部コマンドの実行速度を速くする |speed-up| +便利なマッピング |useful-mappings| +ヘルプファイルを圧縮する |gzip-helpfile| +ウィンドウでシェルコマンドを実行する |shell-window| +バイナリ編集 |hex-editing| +オートコマンドで <> 表記を使う |autocmd-<>| +対応する括弧を強調する |match-parens| + +============================================================================== +C のプログラムを編集する *C-editing* + +Vim には C のプログラムファイルを編集するのを手助けする機能がたくさんあります。 +詳細をジャンプして確認できるようにタグつきで機能のあらましを紹介しましょう。 + +|usr_29.txt| ユーザーマニュアルの「プログラム内の移動」 +|usr_30.txt| ユーザーマニュアルの「プログラムの編集」 +|C-indenting| テキストをタイプ中、自動的に行をインデントします。 +|=| 数行をインデントし直します。 +|format-comments| コメントを自動的にフォーマットします。 + +|:checkpath| 再帰的にインクルードされるファイルをすべて表示します。 +|[i| カーソルの下にある単語と同じものを現在のファイルとイン + クルードされるファイルから探します。 +|[_CTRL-I| "[i" でマッチした場所にジャンプします。 +|[I| カーソルの下にある単語と同じものを現在のファイルとイン + クルードされるファイルから探し出しその行のリストを表示 + します。 + +|[d| カーソルの下の単語の定義を現在のファイルとインクルード + されるファイルから探します +|CTRL-]| カーソルの下のタグにジャンプします。(例、関数の定義) +|CTRL-T| CTRL-]コマンドの前に戻ります。 +|:tselect| マッチしたタグのリストから一つ選びます。 + +|gd| カーソルの下のローカル変数の宣言にジャンプする。 +|gD| カーソルの下のグローバル変数の宣言にジャンプする。 + +|gf| カーソルの下のファイル名にジャンプする。 + +|%| 対応する(),{},[],/* */, #if, #else, #endifに移動する。 +|[/| 前のコメントが始まる場所に移動する。 +|]/| 次のコメントが終わる場所に移動する。 +|[#| 前の閉じられていない #if, #ifdef, #else に移動する。 +|]#| 次の閉じられていない #else, #endif に移動する。 +|[(| 前の閉じられていない '(' に移動する。 +|])| 次の閉じられていない ')' に移動する。 +|[{| 前の閉じられていない '{' に移動する。 +|]}| 次の閉じられていない '}' に移動する。 + +|v_ab| 「ブロック("[("から"])"まで)」を括弧を含めて選択する。 +|v_ib| 「ブロック("[("から"])"まで)の内部」を選択する。 +|v_aB| 「ブロック("[{"から"]}"まで)」を括弧を含めて選択する。 +|v_iB| 「ブロック("[{"から"]}"まで)の内部」を選択する。 + +============================================================================== +識別子が使われている場所を検索する *ident-search* + +|tags|が関数や変数の定義された場所へのジャンプに使えることはすでにわかりました +が、ときどき関数や変数が使われている場所にジャンプしたいことがあります。これ +は二つの方法で実現することができます: +1. |:grep|を使う方法。この方法はほとんどの Unix システムでうまく動作しますが遅 + いですし(全てのファイルを読むため)、一つのディレクトリの中だけしか検索でき + ません。 +2. ID ユーティリティを使う方法。この方法は速いですし複数のディレクトリを検索で + きます。この方法は位置を記憶するためにデータベースを使用します。いくつかの + プログラムを新たに入れる必要があります。そして、データベースを最新に保つこ + とが要求されます。 + +GNU id-tools と Vim を連動させる。 + +必要なもの: +- The GNU id-toolsがインストールされていること(IDを生成するにはmkidが必要でマ + クロを使うのにlidが必要です)。 +- 現在のディレクトリに "ID" と呼ばれる識別子データベースファイルがあること。 + シェルコマンド "mkid file1 file2 .." で作成可能です。 + +次の行を .vimrc に追加してください。 > + map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR> + map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR> + + function! ID_search() + let g:word = expand("<cword>") + let x = system("lid --key=none ". g:word) + let x = substitute(x, "\n", " ", "g") + execute "next " . x + endfun + +これを使うには、単語上にカーソルを置いて、"_u" とタイプすればvimは単語を含んだ +ファイルを読みこみます。同じファイルで次に単語が出てくるところを検索するには +"n" をタイプします。"_n" で次のファイルに行きます。 + +この方法は id-utils-3.2 を使って動作を確認しました (id-utlis-3.2 は id-tools +アーカイブの名前です。近くの gnu-ftp-mirror から入手してください。) + +[このアイデアはAndreas Kutscheraさんから頂いたものです] + +============================================================================== +xterm でのスクリーンの切り替え *xterm-screens* *xterm-save-screen* + +(comp.editors で質問に答えて Juergen Weigert 氏が投稿したもの) + +:> もう一つの質問は vim を終了させた後にスクリーンがそのまま残っている +:> ことに関してです。例えばいままで見ていた(編集していた)内容がスクリ +:> ーンに残っていますよね。そして前に行った ls などのコマンドの出力が +:> 消えてしまうのです(例えばスクロールバッファからなくなってしまう)。 +:> vim や他の vi 風のエディタでもどうにかして前の画面を復元する方法が +:> あるとは思うのですが、どのようにすれば実現できるのかわかりません。 +:> 教えていただけると嬉しいです。それでは。 +: +:どなたか詳しい方が答えて下さると思います。vim も vi も xterm の設定を +:みて同じことをそれぞれやっていると思うのですが。 + +これらは必ずしも同じ動作をするとは限りません、というのはこれは termcap と +terminfo の問題であるかもしれないからです。個々のタイプのターミナルの属性を記 +述するデータベースには termcap と terminfoという二つのデータベースがあるという +ことを知っておいてください。エントリが異なっていて、かつ質問にあったプログラム +のどれかが termcap を使っていて他のものが terminfo を使っていた場合、違う動作 +をすることになりえます。 +(|+terminfo| も参照してください) + +この問題の場合、^[[?47h と ^[[?47l というコントロールシーケンスが答えになりま +す。これらはxtermのメインスクリーンバッファともう一方のバッファを切り替えるの +に用いられます。簡単に動作させてみるには次のコマンドを打ってみてください、 > + echo -n "^[[?47h"; vim ... ; echo -n "^[[?47l" +あなたが望む動作はこれかもしれません。 (ここで ^[ は ESC キャラクターを意味し +ます。このあとデータベースではこの記号の代わりに \E を使っていることがわかるで +しょう) + +起動時に vim は termcap の ti 変数 (terminfo の場合: smcup) の値を echo し、終 +了時には te 変数 (terminfo の場合: rmcup) の値をターミナルに echo します。とい +うわけで、これらの二つの変数が上記のコントロールシーケンスを設定する正しい場所 +です。 + +xterm の termcap エントリ (/etc/termcap にあります) と xterm の terminfo エン +トリ (infocmp -C xterm として入手します) とを比べてみてください。双方に次のよ +うなエントリが含まれている必要があります。 > + :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h: + +追伸: もしなんらかの違いを見つけた場合、だれかが(システム管理者かな?) termcap + と terminfo データベースを継続的にチェックするようにした方がよいです。 + +注1: feature.h で定義される FEAT_XTERM_SAVE をつけて Vim を再コンパイルすると +内蔵の xterm は上記の "te" と "ti" エントリを含むようになります。 + +注2: スクリーンのスイッチを行わないようにし、termcap の変更も行いたくない場合 +次の行を .vimrc に加えてください。 > + :set t_ti= t_te= + +============================================================================== +挿入モードでスクロールを行う *scroll-insert* + +挿入モードでスクリーンの外の部分を見たい場合、CTRL-X CTRL-E と CTRL-X CTRL-Y +を使うことでスクリーンをスクロールさせることができます。 + |i_CTRL-X_CTRL-E| + +これを簡単に行うには次のマッピングをすることができます: > + :inoremap <C-E> <C-X><C-E> + :inoremap <C-Y> <C-X><C-Y> +(文字通り入力するには、'<' フラグが 'cpoptions' にないことを確認してください) +しかしこれを行うとカーソルの上/下の行のテキストをコピーする機能が使えなくなり +ます。 +|i_CTRL-E|. + +カーソルの周りの前後を常に見渡せるように 'scrolloff' オプションの値を大きい値 +に設定するのもよいです。'scrolloff' の値がウィンドウの高さの半分以上に設定さ +れているとカーソルが常にスクリーンの中央にあることになりテキストはカーソルの +上下移動にあわせてスクロールすることになります。 + +============================================================================== +スムーズにスクロールさせる *scroll-smooth* + +もう少しスムーズにスクロールさせたい場合、次のマッピングを使うこともできます: +> + :map <C-U> <C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y> + :map <C-D> <C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E> + +(文字通り入力するには、'<' フラグが 'cpoptions' にないことを確認してください) + +============================================================================== +ありがちなタイプミスを修正する *type-mistakes* + +しょっちゅう間違ってタイプする単語がいくつかあれば、短縮入力を修正するのに利用 +しましょう。例えば: > + :ab teh the + :ab fro for + +============================================================================== +単語や行などの数を数える *count-items* + +カレントバッファの中になんらかのパターンがどのくらいの回数現れるのかを数えるに +は、substituteコマンドを使い、実際に置換するのを避けるためにフラグ 'n' をつけ +ます。報告される数がそのアイテムの数です。例: > + + :%s/./&/gn 文字 + :%s/\i\+/&/gn 単語 + :%s/^//n 行 + :%s/the/&/gn "the" (どこかしら) + :%s/\<the\>/&/gn "the" (単語一致) + +'hlsearch' をリセットするか、":nohlsearch" をしたくなるかもしれません。 +マッチが1個もないときにエラーになってほしくなければフラグ 'e' をつけます。 + +別の方法としては、ビジュアルモードで|v_g_CTRL-G|を使います。 + +複数のファイルから検索したければ|:vimgrep|を使います。 + + *count-bytes* +バイト数を数えるにはこれを使ってください。 + + 文字列を選択してください(ブロック選択も使えます) + "y" でコピーしてください + そして、strlen()を使います > + :echo strlen(@") +改行は1バイトとして数えられます。 + +============================================================================== +カーソルの位置を戻す *restore-position* + +ときにはファイルのどこかに変更を加えて、テキストをスクロールすることなくカーソ +ルを元の位置に戻すようなマッピングを書きたくなることがあります。ファイルに書い +た日付を変更する例をあげます: > + :map <F2> msHmtgg/Last [cC]hange:\s*/e+1<CR>"_D"=strftime("%Y %b %d")<CR>p'tzt`s + +位置を記憶する: + ms 's' マークにカーソルの位置を記録します + H ウィンドウに表示された最初の行に移動します + mt その行を 't' マークに記録します + +位置を元に戻す: + 't 先程のウィンドウに表示された最初の行に移動します + zt その行がウィンドウの最初に表示されるようにスクロールします + `s 最初の位置に戻ります + +より高度なことについては |winsaveview()| と |winrestview()| を参照してくださ +い。 + +============================================================================== +ファイルをリネームする *rename-files* + +例えば以下のようなファイルを含むディレクトリがあるとします(ディレクトリはラン +ダムに選び出したものです :-): + +buffer.c +charset.c +digraph.c +... + +そして *.c を *.bla にリネームしたい場合次のようなコマンドを実行します: > + + $ vim + :r !ls *.c + :%s/\(.*\).c/mv & \1.bla + :w !sh + :q! + +============================================================================== +複数ファイル中の名前を置換する *change-name* + +スクリプトファイルを使って複数ファイル中の名前を置換する例です: + + 以下のように置換コマンドと :update コマンドを含む "subs.vim" というファ + イルを作成します: > + :%s/Jones/Smith/g + :%s/Allen/Peter/g + :update +< + Vim で置換したい全ファイルを開き、各引数に対してこのスクリプトを実行 + します: > + + vim *.let + argdo source subs.vim + +|:argdo| も参照。 + +============================================================================== +外部コマンドの実行をスピードアップする *speed-up* + +いくつかの状況では外部コマンドの実行速度が非常に遅くなる場合があります。これは +Unix でのワイルドカード展開が行われた場合もそうです。いくつかのスピードアップ +する方法を紹介しましょう。 + +もし .cshrc (もしくは他のファイル、使っているシェルによります)が非常に長いなら +ばそれを対話的に使う部分とそうでない用途(セカンダリーシェルとよく呼ばれます)の +部分にわけるべきです。Vim から ":!ls" のようなコマンドを実行する場合、対話的に +行う必要はありませんよね(例えば、プロンプトを出させたり)。次の行の後にそれらを +おくようにしてください。 > + + if ($?prompt == 0) then + exit 0 + endif + +もう一つの方法は 'shell' オプションに "-f" フラグをつける方法です、例えば: > + + :set shell=csh\ -f + +(オプションの中にスペースを含めるにはバックスラッシュが必要です) +こうすると csh が .cshrc ファイルを読み込まないようにすることができます。しか +しこうすることでなんらかが動作しない場合もあるかもしれません。 + +============================================================================== +便利なマッピング *useful-mappings* + +ここでいくつか好んで使われるマッピングを紹介します。 + + *map-backtick* > + :map ' ` +シングル引用符の動作をバック引用符の動作のようにします。カーソルをマークがある +行の最初の非空白文字に移動させるのではなく、マークがある桁位置に移動させます。 + + *emacs-keys* +コマンドラインでのキーバインドを Emacs スタイルにします: > + " 行頭へ移動 + :cnoremap <C-A> <Home> + " 一文字戻る + :cnoremap <C-B> <Left> + " カーソルの下の文字を削除 + :cnoremap <C-D> <Del> + " 行末へ移動 + :cnoremap <C-E> <End> + " 一文字進む + :cnoremap <C-F> <Right> + " コマンドライン履歴を一つ進む + :cnoremap <C-N> <Down> + " コマンドライン履歴を一つ戻る + :cnoremap <C-P> <Up> + " 前の単語へ移動 + :cnoremap <Esc><C-B> <S-Left> + " 次の単語へ移動 + :cnoremap <Esc><C-F> <S-Right> + +NOTE: これを利用するには 'cpoptions' から '<' フラグを外しておく必要がありま +す。|<>| + + *format-bullet-list* +このマッピングはブレットリストのフォーマットを整えるものです。それぞれのリスト +のエントリの前後に空行がある必要があります。式が使われているのはマッピングを部 +分的に解説するコメントを入れるためです。 > + + :let m = ":map _f :set ai<CR>" " 'autoindent' をセット + :let m = m . "{O<Esc>" " アイテムの上に空行を挿入 + :let m = m . "}{)^W" " ブレットの後のテキストに移動 + :let m = m . "i <CR> <Esc>" " インデントの為のスペースを挿入 + :let m = m . "gq}" " ブレットの後のテキストを整形 + :let m = m . "{dd" " 空行を削除 + :let m = m . "5lDJ" " ブレットの後にテキストを置く + :execute m |" マッピングを決定する + +(<> 表記法 |<>|。これらは文字どおりにタイプするということに注意してください。 +^W は "^" "W" で CTRL-W ではありません。'cpoptions' に '<' がなければ Vim にコ +ピー/ペーストすることができますよ。) + +最後のコメントは |" で始まっていることに注意してください、これは ":execute" コ +マンドが直接のコメントを受け付けないからです。 + +また 'textwidth' を 0 以外の値にしておく必要があります。例えば: > + set tw=70 + +最初の行からインデントすることになりますが次のようなマッピングでも同じことがで +きます (Note: このマッピングは多くのスペースを含む長い一つの行です): > + :map _f :set ai<CR>}{a <Esc>WWmmkD`mi<CR><Esc>kkddpJgq}'mJO<Esc>j +< + *collapse* +これら2つのマッピングは空行(;b)もしくは空白文字のみからなる行(;n)の連続を1行に +します。 > + :map ;b GoZ<Esc>:g/^$/.,/./-j<CR>Gdd + :map ;n GoZ<Esc>:g/^[ <Tab>]*$/.,/[^ <Tab>]/-j<CR>Gdd + +============================================================================== +ヘルプファイルを圧縮する *gzip-helpfile* + +ディスクスペースに空きがあまりない人はヘルプファイルを圧縮することができます。 +圧縮した後でもヘルプファイルを閲覧することはできます。ヘルプファイルへのアクセ +スは少し遅くなります。また "gzip" プログラムが必要です。 + +(1) すべてのヘルプファイルを圧縮するには: "gzip doc/*.txt" + +(2) "doc/tags" を編集して ".txt" を ".txt.gz" にします。 > + :%s=\(\t.*\.txt\)\t=\1.gz\t= + +(3) 次の行を vimrc に追加します: > + set helpfile={dirname}/help.txt/gz + +{dirname}はヘルプファイルのある場所です。|gzip|プラグインがファイルの解凍をし +ます。それともし圧縮された "doc" ディレクトリと同じ場所に他のVim ファイルがな +い場合、$VIMRUNTIME が他の Vim ファイルがある場所になるようにしておかなければ +なりません。|$VIMRUNTIME|も参照してください。 + +============================================================================== +ウィンドウでシェルコマンドを実行する *shell-window* + +Vim の中のウィンドウでシェルを起動できるかという質問がいままでに何度かありまし +た。答えは、できないです。もしこれを実装しようとすればかなり多くのコードを加え +なければなりません、これが実装しない理由です。つまるところ、Vim はエディタなの +です、エディタとしてではない作業を実行するようには考えられていません。しかしな +がら、同じようなことを実行するには "splitvt" プログラムを使って端末のスクリー +ンもしくはウィンドウの表示を分割することができます。このプログラムはたぶんどこ +かの ftp サーバーで見つけることができると思います。このプログラムに詳しいのは +Sam Lantinga <slouken@cs.ucdavis.edu> です。もう一つの方法は "window" コマンド +を利用する方法で、このコマンドは BSD Unix システムにあります。このコマンドは複 +数のウィンドウをオーバーラップさせることができます。それか "screen" プログラム +を使うかです。これは www.uni-erlangen.de で見つけることができ、このプログラム +でウィンドウの積み重ねをすることができます。 + +============================================================================== +バイナリ編集 *hex-editing* *using-xxd* + +ユーザーマニュアルの|23.4|を参照してください。 + +もしそのファイルがバイナリファイル特有の拡張子(exe、binなど)をしているときは、 +あなたの<.vimrc>に次のオートコマンドを加えることで、変換の過程を自動化しておく +こともできます。"*.bin" をあなたの編集したいファイルの拡張子の、コンマで区切ら +れたリストに変えてください: > + + " vim -b : edit binary using xxd-format! + augroup Binary + au! + au BufReadPre *.bin let &bin=1 + au BufReadPost *.bin if &bin | %!xxd + au BufReadPost *.bin set ft=xxd | endif + au BufWritePre *.bin if &bin | %!xxd -r + au BufWritePre *.bin endif + au BufWritePost *.bin if &bin | %!xxd + au BufWritePost *.bin set nomod | endif + augroup END + +============================================================================== +オートコマンドで <> 表記を使う *autocmd-<>* + +<> 表記は :autocmd の引数として使っても正しく解釈されません。特殊な文字を入力 +するのを避けるには、<> 表記をするための自己破壊的なマッピング行ってそれからオー +トコマンドの中でそのマッピングを呼び出すことで実現することもできます。例: + + *map-self-destroy* > + " この方法はファイル名を自動的にメニューリストに追加するものです。 + " 自己破壊的なマッピングを使っています! + " 1. ファイル名に含まれる 'dots' を \. に変更するためにバッファの一つの行を使 + " います。 + " 2. それをレジスタ '"' に格納します。 + " 3. その名前をバッファメニューリストに追加します。 + " 警告: この方法にはいくらか副作用があります。現在のレジスタの内容を上書きし + " たり "i" コマンドへのマッピングをすべて削除してしまったりします。 + " + autocmd BufNewFile,BufReadPre * nmap i :nunmap i<CR>O<C-R>%<Esc>:.g/\./s/\./\\./g<CR>0"9y$u:menu Buffers.<C-R>9 :buffer <C-R>%<C-V><CR><CR> + autocmd BufNewFile,BufReadPre * normal i + +もう一つのよりよい方法は ":execute" コマンドを使う方法です。文字列の中ではバッ +クスラッシュを前置することで <> 表記が使えます。それまであったバックスラッシュ +は \\ という風に2回重ねるのを忘れないでください。また '"' の前にもバックスラッ +シュを前置しなければなりません。 +> + autocmd BufNewFile,BufReadPre * exe "normal O\<C-R>%\<Esc>:.g/\\./s/\\./\\\\./g\<CR>0\"9y$u:menu Buffers.\<C-R>9 :buffer \<C-R>%\<C-V>\<CR>\<CR>" + +実際のバッファメニューではユーザー定義関数を使うべきですが(|:function|を参照)、 +そうすると<>表記は使いませんので、ここでの例としてそれを使うのは不適切です。 + +============================================================================== +対応する括弧を強調する *match-parens* + +この例はいくつかの高度なトリックを紹介しています。 +- 自動コマンドイベント|CursorMoved|の使い方 +- |searchpairpos()|を使って対応する括弧を見つける方法 +- |synID()|を使ってカーソルが文字列やコメントの中にあるかを判定する方法 +- |:match|を使って何かを強調する方法 +- |pattern|を使ってファイルの特定の位置にマッチさせる方法 + +これはスクリプトローカル変数を使っているので、Vim script ファイル中に書かなけ +ればなりません。カーソルが文字列やコメントの中にないならば、文字列やコメントは +スキップして検索します。構文強調が有効になっている必要があります。 + +これより若干高度なバージョンがプラグイン|matchparen|の中で使われています。 +> + let s:paren_hl_on = 0 + function s:Highlight_Matching_Paren() + if s:paren_hl_on + match none + let s:paren_hl_on = 0 + endif + + let c_lnum = line('.') + let c_col = col('.') + + let c = getline(c_lnum)[c_col - 1] + let plist = split(&matchpairs, ':\|,') + let i = index(plist, c) + if i < 0 + return + endif + if i % 2 == 0 + let s_flags = 'nW' + let c2 = plist[i + 1] + else + let s_flags = 'nbW' + let c2 = c + let c = plist[i - 1] + endif + if c == '[' + let c = '\[' + let c2 = '\]' + endif + let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . + \ '=~? "string\\|comment"' + execute 'if' s_skip '| let s_skip = 0 | endif' + + let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip) + + if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$') + exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col . + \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' + let s:paren_hl_on = 1 + endif + endfunction + + autocmd CursorMoved,CursorMovedI * call s:Highlight_Matching_Paren() + autocmd InsertEnter * match none +< + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/uganda.jax b/plugins/vimdoc-ja/doc/uganda.jax new file mode 100644 index 0000000000..4508b95761 --- /dev/null +++ b/plugins/vimdoc-ja/doc/uganda.jax @@ -0,0 +1,359 @@ +*uganda.txt* For Vim バージョン 8.0. Last change: 2013 Jul 06 + + + VIMリファレンスマニュアル by Bram Moolenaar + + + *uganda* *Uganda* *copying* *copyright* *license* +要約 + *iccf* *ICCF* +Vim はチャリティウェアです。好きなだけコピーして使うことができますが、ウガンダ +の孤児院への寄付を推奨しています。下記の |kcc| を参照するか、ICCFのウェブサイ +トを訪れてください。URLは以下のとおりです。 + + http://iccf-holland.org/ + http://www.vim.org/iccf/ + http://www.iccf.nl/ + +Vimの開発のスポンサーになることもできます。スポンサーは機能要望に投票できま +す。|sponsor|をご覧ください。集めたお金はウガンダへ送金されます。 + +Vimのドキュメントには Open Publication License が適用されています。 +|manual-copyright|をご覧ください。 + +=== begin of license === + +VIM LICENSE + +I) There are no restrictions on distributing unmodified copies of Vim except + that they must include this license text. You can also distribute + unmodified parts of Vim, likewise unrestricted except that they must + include this license text. You are also allowed to include executables + that you made from the unmodified Vim sources, plus your own usage + examples and Vim scripts. + +II) It is allowed to distribute a modified (or extended) version of Vim, + including executables and/or source code, when the following four + conditions are met: + 1) This license text must be included unmodified. + 2) The modified Vim must be distributed in one of the following five ways: + a) If you make changes to Vim yourself, you must clearly describe in + the distribution how to contact you. When the maintainer asks you + (in any way) for a copy of the modified Vim you distributed, you + must make your changes, including source code, available to the + maintainer without fee. The maintainer reserves the right to + include your changes in the official version of Vim. What the + maintainer will do with your changes and under what license they + will be distributed is negotiable. If there has been no negotiation + then this license, or a later version, also applies to your changes. + The current maintainer is Bram Moolenaar <Bram@vim.org>. If this + changes it will be announced in appropriate places (most likely + vim.sf.net, www.vim.org and/or comp.editors). When it is completely + impossible to contact the maintainer, the obligation to send him + your changes ceases. Once the maintainer has confirmed that he has + received your changes they will not have to be sent again. + b) If you have received a modified Vim that was distributed as + mentioned under a) you are allowed to further distribute it + unmodified, as mentioned at I). If you make additional changes the + text under a) applies to those changes. + c) Provide all the changes, including source code, with every copy of + the modified Vim you distribute. This may be done in the form of a + context diff. You can choose what license to use for new code you + add. The changes and their license must not restrict others from + making their own changes to the official version of Vim. + d) When you have a modified Vim which includes changes as mentioned + under c), you can distribute it without the source code for the + changes if the following three conditions are met: + - The license that applies to the changes permits you to distribute + the changes to the Vim maintainer without fee or restriction, and + permits the Vim maintainer to include the changes in the official + version of Vim without fee or restriction. + - You keep the changes for at least three years after last + distributing the corresponding modified Vim. When the maintainer + or someone who you distributed the modified Vim to asks you (in + any way) for the changes within this period, you must make them + available to him. + - You clearly describe in the distribution how to contact you. This + contact information must remain valid for at least three years + after last distributing the corresponding modified Vim, or as long + as possible. + e) When the GNU General Public License (GPL) applies to the changes, + you can distribute the modified Vim under the GNU GPL version 2 or + any later version. + 3) A message must be added, at least in the output of the ":version" + command and in the intro screen, such that the user of the modified Vim + is able to see that it was modified. When distributing as mentioned + under 2)e) adding the message is only required for as far as this does + not conflict with the license used for the changes. + 4) The contact information as required under 2)a) and 2)d) must not be + removed or changed, except that the person himself can make + corrections. + +III) If you distribute a modified version of Vim, you are encouraged to use + the Vim license for your changes and make them available to the + maintainer, including the source code. The preferred way to do this is + by e-mail or by uploading the files to a server and e-mailing the URL. + If the number of changes is small (e.g., a modified Makefile) e-mailing a + context diff will do. The e-mail address to be used is + <maintainer@vim.org> + +IV) It is not allowed to remove this license from the distribution of the Vim + sources, parts of it or from a modified version. You may use this + license for previous Vim releases instead of the license that they came + with, at your option. + +=== end of license === + +=== ライセンス日本語訳 ここから === + +{訳注: この日本語訳は参考のために示すものであり、法的効力を持ちません。 + 必ず上記の原文を参照してください。} + +VIM ライセンス + +I) Vim のコピーを変更せずに配布することは、このライセンス文を含めなければな + らないこと以外に制限されません。また、変更を加えていない Vim の一部分だ + けを配布することも同様に、このライセンス文を含めなければならないこと以外 + に制限されません。配布物には、変更を加えていない Vim のソースから作成し + た実行可能ファイルや、あなた独自の説明書や Vim script を含めることもできま + す。 + +II) 以下の 4 つの条件を満たす場合に限り、Vim に変更 (または拡張) を加えた物 + を、実行可能ファイルやソースコードも含めて配布することが認められています: + 1) このライセンス文を変更せずに配布物に含めること。 + 2) 変更された Vim は以下の 5 つの方法のどれかで配布しなければならない。 + a) Vim に独自の変更を加えた場合、配布物にあなたの連絡先を明確に示して + ください。メンテナーがあなたが配布した変更された Vim のコピーについ + て (何かを) 尋ねたときに、あなたが加えた変更を、ソースコードも含め + て、無償で、メンテナーが利用できるようにしなければなりません。メン + テナーは公式なバージョンの Vim にあなたの変更を取り込むための権利を + 保有します。メンテナーがあなたの変更をどのようにし、どういったライ + センスで配布するかを交渉することができます。交渉が行われなければ、 + このライセンス、もしくはこれの新しいバージョンのライセンスがあなた + の変更に適用されます。現在のメンテナーは + Bram Moolenaar <Bram@vim.org> です。これが変更されるときは適切な場 + 所で告知されます(おそらく vim.sf.net や www.vim.org そして + comp.editors)。もし本当にメンテナーと連絡が取れない場合には、あなた + の変更を提出する義務はありません。一旦、メンテナーがあなたの変更を + 受け取ったことを確認できたなら、再度提出する必要はありません。 + b) a) に基づいて配布された変更された Vim を受け取った場合、それを変更 + することなしに、I) に基づいて再配布できます。さらなる変更を加えた + 場合、その変更には a) が適用されます。 + c) 変更された Vim の配布物全てに、ソースコードも含めて、全ての変更点を + 提供してください。これは context diff の形式で行うことができます。 + あなたは、あなたが加えた新しいコードに対してどのライセンスを適用す + るか選択できます。その変更とライセンスは、公式なバージョンの Vim + に取り込むことで、他のものを制限してはいけません。 + d) c) に基づいて配布された変更された Vim があるとき、次の条件を満たす + 場合に限り、そのソースコードを含めずに配布することができます: + - その変更に適用されているライセンスが、その変更を無償で制限なしに + Vim のメンテナーに提供することを認め、そして、Vim のメンテナーが + その変更を公式なバージョンの Vim に取り込むことを無償で制限なしに + 認めている。 + - その変更された Vim の変更点を、最後に配布したときから少なくとも + 3 年は保持してください。その期間内に、メンテナーや誰かがその変更 + について (何かを) 尋ねた場合、彼らがその変更を利用できるようにし + なければなりません。 + - その配布物にあなたの連絡先を明確に示してください。その連絡方法は、 + その変更された Vim に相当する配布物が最後に提供されてから、少なく + とも 3 年、そして可能な限り長く、有効でなければなりません。 + e) その変更に GNU General Public License (GPL) が適用されている場合、 + GNU GPL バージョン 2、またはそれより新しいバージョンに基づいて、その + 変更された Vim を配布することができます。 + 3) その変更された Vim を利用しているユーザーが、それが変更されていると確 + 認できるように、少なくとも、":version" コマンドや起動時の挨拶メッセー + ジに、変更されている旨を表示しなければなりません。その配布物が 2)e) + によるものである場合、そのライセンスが変更前のものと矛盾していない、 + という旨のメッセージだけが必要です。 + 4) 2)a) と 2)d) により要求されている連絡方法を、その本人が訂正する以外 + に、変更したり削除してはいけません。 + +III) 変更された Vim を配布する場合、あなたの変更に Vim のライセンスを使い、 + その変更を、ソースコードも含めて、メンテナーが利用できるようにすることが + 奨励されています。そのためには電子メールで送るか、サーバーにアップロード + してその URL を電子メールで知らせるのが望ましいです。少しの変更なら (例え + ば Makefile の変更など) context diff を電子メールで送るのがいいでしょう。 + 電子メールの送り先は <maintainer@vim.org> です。 + +IV) Vim のソースや、その一部、または変更された Vim、の配布物からこのライセン + スを削除することは認められていません。望むなら、以前の Vim リリースに、 + その時点のライセンスではなく、このライセンスを適用することができます。 + +=== ライセンス日本語訳 ここまで === + +Note: + +- Vim に満足していただけたのなら、このファイルをさらに読み進め、ウガンダの貧し + い子供たちへの援助を検討してください。 + +- Vimの開発に協力したいとお考えなら、スポンサーになることを検討してください + |sponsor|。集めたお金はウガンダへ送金されます。 + +- Richard Stallman によれば Vim のライセンスは GNU GPL 互換です。彼がそれを確 + 認してから多少の変更が加えられましたが、違いはないでしょう。 + +- Vimに GNU GPL のライブラリをリンクした場合、配布形態が GNU GPL に制限されま + す。あなたがVimに何の変更も加えていなくてもです。 + +- 一度でも GNU GPL を含む変更を加えた場合、それ以降の変更は GNU GPL 互換のライ + センスを使わなければいけません。 + +- Vimに改良を加えたバージョンを配布するときは、configureの引数に + "--with-modified-by" を指定するかMODIFIED_BYを定義して、あなたの名前を連絡先 + に含めることができます。 + +============================================================================== +Kibaale Children's Centre *kcc* *Kibaale* *charity* + +Kibaale Children's Centre (KCC) はウガンダの南部にある小さな町 Kibaale にあり +ます。ウガンダは東アフリカのタンザニアの近くに位置しています。その地域はRakai +地区として知られています。人口の大部分は農民で、貧乏ではありますが食料は十分に +あります。しかしこの地域は世界のほかの場所よりも AIDS で苦しんでいます。AIDS +はここから始まったという人もいます。ウガンダ人の 10-30% がHIV に感染していると +推定されています。両親が死んでしまうので孤児がたくさんいます。この地域では人口 +350,000 人のうちの 60,000 人の子供が親をどちらか、または両方をなくしており、そ +の数は増え続けています。 + +子供たちは多くの援助を必要としています。KCC は食料、医療、教育を彼らに提供する +ために懸命に働いています。食料と医療は彼らの健康を保つために、そして教育は彼ら +の将来を手助けするためです。KCC はキリスト教の教えに基づいて活動していますが、 +子供たちの宗教に関わらず援助が行われています。 + +この地域の問題を解決する鍵は教育です。過去数年にわたる Idi Amin 大統領の時代と +それに続く市民戦争により、教育は軽視されてきました。今は政府が再び安定しました +し、子供と親は自分自身の健康をどうやって保つか、そしてどうすれば感染を避けられ +るかを学ぶ必要があります。病気にかかっている人々や空腹を抱えている人々への援助 +もなされていますが、第一の目標は人々を病気から遠ざけることであり、そして体によ +い食料を育てる方法を彼らに教えることです。 + +ほとんどの孤児は拡大家族の中で生活しています。叔父や姉が彼らの世話をしていま +す。このような家庭は大家族でありながら収入は少ないので、子供が体によい食料を得 +られるのは希です。まして衣類、医療、学校に通うことなどは無理なのです。このよう +な貧しい子供たちを助けるために資金援助制度が設けられました。子供は経済的に養子 +になるのです。KCC は、月に数ドルのお金で、子供たちに必要なもの、健康や学校に通 +うことなどを手配します。また KCC はその他にも、子供とその世話をしている家族が +必要とするものの面倒を見ています。 + +子供を直接援助するほかに、子供が育つ環境を改善する必要があります。KCC は学校の +教育方法が改善されるよう援助を行っています。センターには実地教育をする学校 +(demonstration school) があり、教師を指導しています。保健に従事する人の育成も +されており、衛生教育も行われています。そして、各家庭が適切なトイレを作れるよう +に支援しています。私はセメントの厚い板を作る現場を設立する手伝いをしました。そ +の板はよいトイレを作るのに使われ、そしてコスト以下の値段で売られています。 + +プロジェクトには小さな診療所があり、子供たちとその家族が医療を受けられるように +しています。そして必要があれば病院へ移ることを申し出ます。病気の予防プログラム +が実行されており、伝染病 (風疹とコレラは悩みの種です) が発生した場合は援助が行 +われます。 + + *donate* +私は1994年の夏から1995年の夏までの丸1年間をボランティアとしてセンターで過ごし +ました。センターを拡大するための手助けを行い、そして飲料水の改善を行う地区と衛 +生設備の改善を行う地区で働いていました。そして KCC が提供している援助が本当に +役に立っていることを学んできました。オランダへ戻ったとき、KCC のサポートを続け +たいと思いました。それを実行するために私は基金を設立し、そしてスポンサーシップ・ +プログラムを組織化しました。次のどれかが可能かどうか検討してみてください: + +1. 1人の小学生のスポンサーになる: 月に17ユーロ(か、もっと) +2. 1人の中学生のスポンサーになる: 月に25ユーロ(か、もっと) +3. 診療所のスポンサーになる: 月もしくは4半期ごとにいくらでも +4. 1度に限定した寄付(A one-time donation) + +他の組織に比べると子供のスポンサーシップの料金はかなり低いです。これはお金が直 +接センターに届くようになっているからです。5%以下しか運営には使われていません。 +それが可能なのはこの組織が小さく、そしてボランティアで運営されているからです。 +子供のスポンサーになるのなら、少なくとも1年は続ける心構えを持ってください。 + +しかしお金が適切に使われていることを信用できるでしょうか? まず、私は Vim の作 +者として個人的に信用されています。そして私はセンターで働いている人々を信用して +いますし、彼らを個人的に知ってもいます。さらには、このセンターはかつては World +Vision と Save the Children Fund によって共同運営・監督され、今は Pacific +Academy Outreach Society の監督下にあります。センターは約 1 年に 1 回は視察を +受けて進行をチェックしてもらっています (自費で)。私自身 1993 年から何度も視察 +をしています。ICCF のウェブサイトに視察レポートがあります。 + +もし他に質問がありましたら、私にメールを送ってください: <Bram@vim.org> + +センターの住所: + Kibaale Children's Centre + p.o. box 1658 + Masaka, Uganda, East Africa + +送金: *iccf-donations* + +最新の情報はICCFのウェブサイトをご覧ください。ICCFのURLは|iccf|をご覧ください。 + +アメリカ: 下記で説明する方法が使えます。 + 残念ながら、Nehemiah Group Outreach Society (NGOS) に小切手を + 送る方法はもう使えません。 + 国税庁 (IRS) の税領収書を得られる他の方法を今探しています。 + 子供のスポンサーになるにはカナダの KCF (下記参照) に連絡して + ください。銀行の手数料を節約するため、アメリカの小切手を彼らに + 送ることができます。 + +カナダ: カナダのSurreyにあるKibaale Children's Fund(KCF)に連絡してくだ + さい。彼らはKibaaleの子供たちのために、カナダのスポンサーを世 + 話しています。KCF が集めたお金は100%、ウガンダのプロジェクトに + 送金されます。1度に限定した寄付の場合は、そこに直接送ることが + できます。Vimによってどのくらい寄付されているか知りたいので、 + よろしければ、送金したことを私に知らせてください。スポンサー + シップについては KCF に尋ねてください。 + Kibaale Children's Fund c/o Pacific Academy + 10238-168 Street + Surrey, B.C. V4N 1Z4International Child Care Fund + Phone: 604-581-5353 + Kibaale Children's Fund (KCF) に寄付をすると、税領収書を受け取 + れるので、確定申告で提出できます。 + +オランダ: Lisse の "Stichting ICCF Holland" の口座に振り替えてください。 + オランダ在住の方は税金が控除されます。 + Postbank, nr. 4548774 + IBAN: NL95 INGB 0004 5487 74 + +ドイツ: 寄付により、確定申告で税金が控除されます。 + 最新の情報は ICCF のウェブサイトを御覧下さい: + http://iccf-holland.org/germany.html + +世界: 郵便為替を使ってください。ほとんどの国で、たいていは郵便局か + ら送れます。この名前を使ってください (これは私のパスポートの + ものです): "Abraham Moolenaar"。可能なら通貨はユーロにしてく + ださい。 + +ヨーロッパ: 可能なら銀行振り込みを使ってください。あなたの銀行はそのための + 方法を用意しているはずです。swift codeとIBAN numberは下記の"そ + の他"の項を参照してください。 + 他の方法も使えると思います。スポンサーシップについてはお問い合 + わせください。 + +クレジットカード: クレジットカードでの送金には PayPal が使えます。これはイン + ターネットでの決算で最も広く使われているシステムです。これは本 + 当に簡単です。詳細はこのリンク先を見てください: + https://www.paypal.com/en_US/mrb/pal=XAC62PML3GF8Q + 送金のための e-mail アドレスは: + Bram@iccf-holland.org + 400 ユーロ (500ドル) より大きな送金は、小切手で送るようにして + ください。 + +その他: 可能であれば次のうちのどれかの口座に振り替えてください: + Postbank, account 4548774 + Swift code: INGB NL 2A + IBAN: NL95 INGB 0004 5487 74 + under the name "stichting ICCF Holland", Lisse + これがうまく行かなければ: + Rabobank Lisse, account 3765.05.117 + Swift code: RABO NL 2U + under the name "Bram Moolenaar", Lisse + それ以外は、ユーロか US ドルの小切手を下記の住所に送ってくださ + い。最小の金額は 70 ドルです(私が利用している銀行はそれ以下の + 海外からの小切手は受け付けないのです、ごめんなさい)。 + + +小切手の送り先: + Bram Moolenaar + Finsterruetihof 1 + 8134 Adliswil + Switzerland + +この住所は当分先まで使えると思います。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/undo.jax b/plugins/vimdoc-ja/doc/undo.jax new file mode 100644 index 0000000000..bc83cd2441 --- /dev/null +++ b/plugins/vimdoc-ja/doc/undo.jax @@ -0,0 +1,408 @@ +*undo.txt* For Vim バージョン 8.0. Last change: 2014 May 24 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +undo と redo *undo-redo* + +基本的なことは |02.5| で説明されています。 + +1. undo と redo のコマンド |undo-commands| +2. Undo の二つの方式 |undo-two-ways| +3. Undo ブロック |undo-blocks| +4. Undo ブランチ |undo-branches| +5. Undo の永続化 |undo-persistence| +6. 備考 |undo-remarks| + +============================================================================== +1. undo と redo のコマンド *undo-commands* + +<Undo> or *undo* *<Undo>* *u* +u [count] 個の変更を元に戻す。 {Vi は 1 レベルだけ} + + *:u* *:un* *:undo* +:u[ndo] 一つの変更を元に戻す。 {Vi は 1 レベルだけ} + + *E830* +:u[ndo] {N} 変更番号 {N} の直後にジャンプする。{N} の意味について + は |undo-branches| を参照。 {Vi にはない} + + *CTRL-R* +CTRL-R undo された変更を [count] 個やり直す (redoする)。 + {Vi ではこのキーはスクリーンの再描画} + + *:red* *:redo* *redo* +:red[o] undo された変更を一つやり直す。 {Vi: redo はない} + + *U* +U 最近変更された行の、一つの行の中でのすべての最近の変更 + を元に戻す。|U| 自体も変更としてカウントされます。つま + り |U| によってその前の |U| を元に戻すことができます。 + {Vi では行から移動すると使えない} + +変更は記録されます。上記の undo コマンドや redo コマンドを使うと、それぞれの変 +更が加えられる前のテキストに戻したり、変更を元に戻した後でその変更を再び加える +ことができます。 + +"U" コマンドは他のコマンドと同様に undo/redo の対象となります。つまり、"u" コ +マンドで "U" コマンドを undo したり、'CTRL-R' コマンドでそれを redo したりでき +ます。"U" と "u" と 'CTRL-R' を混ぜて使うと、"U" コマンドが直前の "U" コマンド +以前の状態を復元することに気づくでしょう。この動作はわかりにくいかもしれません +が、練習して慣れてください。 +"U" コマンドはバッファを変更有りの状態にします。つまり、"U" コマンドで変更が加 +えられる前のテキストに戻しても、それは変更有りの状態として認識されます。"u" を +使って変更無しの状態まで undo してください。 + +============================================================================== +2. undo の二つの方式 *undo-two-ways* + +undo コマンドと redo コマンドの動作は 'cpoptions' の 'u' フラグに依存していま +す。Vim 方式 ('u' がない場合) と Vi 互換方式 ('u' がある場合) があります。Vim +方式では "uu" は二つの変更を undo します。Vi 互換方式では "uu" は何もしません +(undo を undo する)。 + +'u' がない場合。Vim 方式: +undo コマンドで過去に戻れます。そして、redo コマンドで再び先に進むことができま +す。undo コマンドを実行した後で新しい変更を加えると、redo はできなくなります。 + +'u' がある場合。Vi 互換方式: +undo コマンドは直前の変更と undo コマンドを undo します。redo コマンドは直前の +undo コマンドを繰り返します。変更コマンドが繰り返されるわけではないので、そう +したい場合は "." を使ってください。 + +例 Vim 方式 Vi 互換方式 ~ +"uu" 2回 undo 変更なし +"u CTRL-R" 変更なし 2回 undo + +理由: Nvi では CTRL-R の代わりに "." コマンドを使います。あいにくこれは + Vi 互換ではありません。例えば、"dwdwu." は Vi では二つの単語が削除 + されますが、Nvi では何も変更されません。 + +============================================================================== +3. Undo ブロック *undo-blocks* + +undo コマンドは普通は一つのコマンドを undo します。そのコマンドがいくつの変更 +を加えるかは関係ありません。この undo 可能な変更の組が undo ブロックです。例え +ば、キーの入力によって関数が呼ばれた場合、その関数内のすべてのコマンドは一緒に +undo されます。 + +関数やスクリプトを作るとき、undo 可能な変更を新しく追加するのではなく、その変 +更を直前の変更につなげたい場合は、次のコマンドを使ってください: + + *:undoj* *:undojoin* *E790* +:undoj[oin] 以降の変更を直前の undo ブロックにつなげる。 + 警告: 注意して使ってください。ユーザーが適切に変更を + undo するのを妨げてしまうかもしれません。undo や redo + の後でこのコマンドを使わないでください。 + {Vi にはない} + +これは特に変更の途中でプロンプトを表示するような場合に便利です。例えば関数の中 +で |getchar()| を呼び出すなど。変更をつなげてしかるべき関連性のある変更がそこ +にあることがわかっている場合に使ってください。 + +このコマンドは単独では機能しません。なぜなら、次のキー入力によって再び新しい変 +更が開始されるからです。しかし例えば次のように使うことはできます: > + + :undojoin | delete + +この後で "u" コマンドを実行すると delete コマンドとその直前の変更が undo され +ます。 + +反対の動作、つまり変更を二つの undo ブロックに分けるには、挿入モードでCTRL-G u +を使います。挿入コマンドを部分ごと (例えば文単位) に undo できるようにしたい場 +合に便利です。 |i_CTRL-G_u| +'undolevels' の値を設定したときも undo は区切られます。新しい値と古い値が同じ +でもそうなります。 + +============================================================================== +4. Undo ブランチ *undo-branches* *undo-tree* + +ここまでは一線上の undo/redo について説明してきました。しかし、それを枝分かれ +させることもできます。枝分かれは、変更を undo してから新しい変更を加えることで +起こります。undo された変更は枝 (ブランチ) になります。以下のコマンドで枝に移 +動できます。 + +ユーザーマニュアルに説明があります: |usr_32.txt|. + + *:undol* *:undolist* +:undol[ist] 変更木 (tree) の、葉 (leaf) を一覧表示する。例: + number changes when saved ~ + 88 88 2010/01/04 14:25:53 + 108 107 08/07 12:47:51 + 136 46 13:33:01 7 + 166 164 3 seconds ago + + "number" 列は変更番号です。この番号は連続的に増えてい + き、undo 可能な変更の識別番号として使えます。 |:undo| + 参照。 + "changes" 列は木のルートから葉までの変更の数です。 + "when" 列は変更が加えられた日付と時刻です。日時の表記 + は 4 種類あります: + N seconds ago 秒前 + HH:MM:SS 時:分:秒 + MM/DD HH:MM:SS 月/日 時:分:秒 + YYYY/MM/DD HH:MM:SS 年/月/日 時:分:秒 + "saved" 列は変更がディスクに保存されたかどうか、そして + それがどの書き込みだったかを示します。この番号は + |:later| コマンドと |:earlier| コマンドで使用できま + す。 + 詳細を取得するには |undotree()| 関数を使います。 + + *g-* +g- 古いテキスト状態に移動する。カウント指定で繰り返し回数 + を指定できます。 {Vi にはない} + *:ea* *:earlier* +:earlier {count} {count} 回前の古いテキスト状態に移動する。 +:earlier {N}s {N} 秒前の古いテキスト状態に移動する。 +:earlier {N}m {N} 分前の古いテキスト状態に移動する。 +:earlier {N}h {N} 時間前の古いテキスト状態に移動する。 +:earlier {N}d {N} 日前の古いテキスト状態に移動する。 + +:earlier {N}f {N} 回前のファイルを保存したときのテキスト状態に移動す + る。 + 最後の保存から何か変更が加えられていたとき、":earlier + 1f" は保存時の状態に移動します。変更がない場合は一つ前 + の保存時の状態に移動します。 + 最初にファイルを保存した直後か、ファイルをまだ保存して + いないときは、":earlier 1f" は最初の変更の前に移動しま + す。 + + *g+* +g+ 新しいテキスト状態に移動する。カウント指定で繰り返し回 + 数を指定できます。 {Vi にはない} + *:lat* *:later* +:later {count} {count} 回後の新しいテキスト状態に移動する。 +:later {N}s {N} 秒後の新しいテキスト状態に移動する。 +:later {N}m {N} 分後の新しいテキスト状態に移動する。 +:later {N}h {N} 時間後の新しいテキスト状態に移動する。 +:later {N}d {N} 日後の新しいテキスト状態に移動する。 + +:later {N}f {N} 回後のファイルを保存したときのテキスト状態に移動す + る。 + 最後に保存した状態にいるときは、":later 1f" は一番新し + いテキスト状態に移動します。 + + +Note: テキスト状態は、'undolevels' により undo 情報がクリアされると、到達不可 +能になります。 + +時間を移動すると一度に複数の変更が現れることもあります。これは undo ツリーを移 +動して新しい変更を加えたときに起こります。 + +例 + +次のテキストがあります: + one two three ~ + +"x" を 3 回押して最初の単語を削除します: + ne two three ~ + e two three ~ + two three ~ + +"u" を 3 回押してそれを undo します: + e two three ~ + ne two three ~ + one two three ~ + +"x" を 3 回押して二番目の単語を削除します: + one wo three ~ + one o three ~ + one three ~ + +"g-" を 3 回押してそれを undo します: + one o three ~ + one wo three ~ + two three ~ + +最初の undo ブランチ ("one" を削除した後) に戻りました。さらに "g-" を押してい +くと元のテキストに戻ります: + e two three ~ + ne two three ~ + one two three ~ + +":later 1h" を実行すると最後の変更にジャンプします: + one three ~ + +":earlier 1h" を実行すると最初に戻ります: + one two three ~ + + +Note: "u" と CTRL-R では "g-" と "g+" のようにすべてのテキスト状態に移動するこ +とはできません。 + +============================================================================== +5. Undo の永続化 (Undo persistence) *undo-persistence* *persistent-undo* + +バッファがアンロードされるとき、通常はバッファの undo ツリーは廃棄されます。 +'undofile' オプションを設定することで、ファイルを書き込んだときに自動的に undo +履歴が保存され、後でファイルを開いたときに undo 履歴が復元されます。 + +'undofile' オプションはファイルを書き込んだ後、BufWritePost 自動コマンドの前に +参照されます。undo 情報の保存をファイルごとに制御したい場合は BufWritePre 自動 +コマンドを使います: > + au BufWritePre /tmp/* setlocal noundofile + +undo ツリーは undo ファイルとして分けて保存されます。undo ファイルは編集ファイ +ルごとに作られます。保存場所の決定にはファイルシステムのパスをそのまま使用した +簡単な方法が使われます。Vim は編集ファイルと undo ファイルの同期がとれているか +どうかを確認し (ファイルの中身のハッシュ値で判断)、undo ファイルが書き込まれた +後で編集ファイルが変更されていたときは、データの損失を防ぐため、undo ファイル +を無視します。開いているファイルと undo ファイルの所有者が違うときも undo ファ +イルは無視されます。ただし、undo ファイルの所有者が現在のユーザーである時を除 +きます。ファイルを開いたときにこの事についてのメッセージを表示させるには +'verbose' を設定してください。 + +通常、undo ファイルは編集ファイルと同じディレクトリに保存されます。この動作は +'undodir' オプションで変更できます。 + +ファイルが暗号化されているときは、undo ファイル内のテキストも暗号化されます。 +ファイルと同じ暗号化メソッドとキーが使用されます。 |encryption| + +":wundo" と ":rundo" を使うことで undo 履歴の保存と復元を手動で実行することも +できます。 + *:wundo* *:rundo* +:wundo[!] {file} + undo 履歴を {file} に保存する。 + {file} が存在し、それが undo ファイルでないなら (ファイル先頭 + のマジックナンバーが違うなら)、コマンドは失敗します。それでも + 保存したい場合は ! を付けてください。 + {file} が存在し、それが undo ファイルなら上書きされます。undo + 履歴がない場合は何も書き込まれません。 + 実装詳細: 上書きは、最初にそのファイルを削除して、同じ名前の + ファイルを新しく作成することで実行されます。そのため、書き込み + 制限のかかったディレクトリ内の undo ファイルは上書きできませ + ん。 + {Vi にはない} + +:rundo {file} {file} から undo 履歴を読み込む。 + {Vi にはない} + +自動コマンドを使うことで undo ファイルの名前を明示的に指定することができます。 +例: > + + au BufReadPost * call ReadUndo() + au BufWritePost * call WriteUndo() + func ReadUndo() + if filereadable(expand('%:h'). '/UNDO/' . expand('%:t')) + rundo %:h/UNDO/%:t + endif + endfunc + func WriteUndo() + let dirname = expand('%:h') . '/UNDO' + if !isdirectory(dirname) + call mkdir(dirname) + endif + wundo %:h/UNDO/%:t + endfunc + +これを使うときは 'undofile' をオフにしておく必要があります。そうしないと二つの +undo ファイルが作成されてしまいます。 + +|undofile()| 関数を使うと、Vim が使用する undo ファイルの名前を取得できます。 + +Note: 'undofile' が設定された状態でファイルを読み書きするとき、ほとんどのエ +ラーは表示されません ('verbose' が設定されていなければ)。:wundo と :rundo を使 +うときはより多くのエラーメッセージが表示されます。例えばファイルが読めない、書 +き込めないとき。 + +Note: Vim は undo ファイルを削除しません。自分で削除する必要があります。 + +undo ファイルの読み込みが失敗する原因はいくつかあります: +*E822* パーミッションの設定によりファイルを開けない。 +*E823* ファイル先頭のマジックナンバーが違う。普通はそのファイルが undo ファイ + ルでないことを意味します。 +*E824* undo ファイルのバージョン番号が、それが Vim の新しいバージョンで書き込 + まれたことを示している。新しいバージョンで開く必要があります。undo + ファイルの情報を維持したいならそのバッファを保存してはいけません。 +"ファイルが変更されています。undo 情報を使用できません" +("File contents changed, cannot use undo info") + ファイルのテキストが undo ファイルを保存したときから変わっています。テ + キストが壊れてしまうため、その undo ファイルは使用できません。これは + 'encoding' の設定が undo ファイル保存時と違う場合にも起こります。 +*E825* undo ファイルの中身が不正なので使用できません。 +*E826* undo ファイルが暗号化されていて、復号に失敗しました。 +*E827* undo ファイルが暗号化されていて、使用中の Vim が暗号化をサポートしてい + ません。他の Vim でファイルを開いてください。 +*E832* undo ファイルが暗号化されていて、'key' が設定されておらず、テキスト + ファイルは暗号化されていません。これはテキストファイルが暗号化を使用し + て保存された後で、暗号化を使用しないで上書きされた場合に起こります。 + おそらく undo ファイルを削除する必要があります。 +"undo ファイルを読み込めません。所有者が違います" +("Not reading undo file, owner differs") + undo ファイルの所有者とテキストファイルの所有者が違います。安全のため + undo ファイルは使用されません。 + +undo ファイルの書き込みは次のような理由で失敗することがあります: +*E828* 書き込みのためのファイルを作成できません。おそらくディレクトリの書き込 + み権限がありません。 +"'undodir' で指定されたディレクトリに undo ファイルを保存できません" +("Cannot write undo file in any directory in 'undodir'") + 'undodir' で指定されたディレクトリの中に使用可能なものがありません。 +"undo ファイルを上書きしません。読み込み不可です" +("Will not overwrite with undo file, cannot read") + undo ファイルと同じ名前のファイルが存在し、それが読み込みできない状態 + になっています。そのファイルを削除するか名前を変更する必要があります。 +"上書きしません。undo ファイルではありません" +("Will not overwrite, this is not an undo file") + undo ファイルと同じ名前のファイルが存在し、そのファイルの先頭に正しい + マジックナンバーがありません。そのファイルを削除するか名前を変更する必 + 要があります。 +"undo ファイルの書き込みをスキップします。undo がありません" +("Skipping undo file write, noting to undo") + 保存する undo 情報がありません。何も変更されていないか 'undolevels' が + マイナス値です。 +*E829* undo ファイルの保存中にエラーが発生しました。もう一度試してみてくださ + い。 + +============================================================================== +6. 備考 *undo-remarks* + +記録される変更の数は 'undolevels' オプションで設定できます。ゼロに設定すると、 +Vi 互換方式の動作になります。マイナスの値に設定すると undo は使用できなくなり +ます。メモリが足りない場合に設定してください。 + + *clear-undo* +'undolevels' を -1 に設定しても、undo 情報はすぐにはクリアされません。次の変更 +が加えられたときにクリアされます。強制的に undo 情報をクリアしたいときは次のコ +マンドを使ってください: > + :let old_undolevels = &undolevels + :set undolevels=-1 + :exe "normal a \<BS>\<Esc>" + :let &undolevels = old_undolevels + :unlet old_undolevels + +バッファのマーク ('a から 'z) はテキストと同様に記録、復元されます。 +{Vi とは少し動作が違います} + +すべての変更を undo したとき、バッファは変更ありとはみなされません。その状態か +らは ":q" (":q!" ではなく) で Vim を終了できます {Vi にはない}。Note: これはい +つファイルを保存したかに関係します。":w" の後で "u" を実行すると、保存したとき +から見てバッファは変更された状態なので、バッファは変更ありと認識されます。 + +マニュアル設定の折り畳み (|folding|) を使っているとき、折り畳みは記録も復元も +されません。変更が折り畳みの中だけで行われた場合のみ (折り畳みの最初と最後の行 +が変わらないので) 折り畳みは維持されます。 + +番号レジスタを使って削除を元に戻すこともできます。テキストを削除すると、それは +"1 レジスタに記録されます。元々 "1 にあったものは "2 にシフトされ、他の番号レ +ジスタも同様にシフトされます。"9 レジスタの内容は失われます。そして、プットコ +マンド '"1P' を使って削除されたテキストを元に戻すことができます。(削除やコピー +の操作をした後ならテキストは無名レジスタに入っているので 'P' や 'p' でも元に戻 +せます)。三回前に削除されたテキストなら '"3P' で戻せます。 + + *redo-register* +数回に分けて削除されたテキストを戻したい場合は、"." コマンドの特殊な機能が役に +立ちます。"." コマンドは使用されたレジスタの番号を増加させます。例えば、""1P" +を実行した後で "." を押すと '"2P' が実行されます。さらに "." を押していくとす +べての番号レジスタが挿入されます。 + +例: 'dd....' でテキストを削除したら '"1P....' で元に戻せる。 + +削除されたテキストがどのレジスタに記録されているかわからないときは :display コ +マンドで確認できます。あるいは、'"1P' を実行してみて、もしそれが違うものなら +'u.' を実行します。'u.' は最初にプットされたテキストを削除し、二番目のレジスタ +を使ってプットコマンドを実行します。目的のものが出るまで 'u.' を繰り返してくだ +さい。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_01.jax b/plugins/vimdoc-ja/doc/usr_01.jax new file mode 100644 index 0000000000..f7205240e1 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_01.jax @@ -0,0 +1,192 @@ +*usr_01.txt* For Vim バージョン 8.0. Last change: 2010 Nov 03 + + VIM USER MANUAL - by Bram Moolenaar + + マニュアルについて + + +この章では、Vim のマニュアルを紹介します。著作権についてもお読み下さい。 + +|01.1| 2つのマニュアル +|01.2| Vim の準備 +|01.3| チュートリアル +|01.4| 著作権 (copyright) + +次章: |usr_02.txt| 初めての Vim +目次: |usr_toc.txt| + +============================================================================== +*01.1* 2つのマニュアル + +Vim のマニュアルは2部構成になっています。 + +1. ユーザーマニュアル + 簡単なものから複雑なものまで、具体的な例を使って説明しています。本のよう + に最初から順を追って読んでください。 + +2. リファレンスマニュアル + Vim がどのように動作するかを詳しく説明しています。 + +マニュアルの表記方法については |notation| をご覧ください。 + + +他のトピックへのジャンプ +------------------------ +2つのマニュアルにはハイパーリンクが張ってあります。編集手順の説明とコマンドや +オプションの詳しい説明とを素早く行き来できます。次のコマンドを使ってください。 + + CTRL-] : カーソル位置の項目にジャンプする。 + CTRL-O : ジャンプ先から戻る。 + +リンクは |bars| のように縦線 (vertical bar) で囲まれています。縦線は隠れている +か非表示になっているかもしれません (下記参照)。オプション名は 'number' のよう +にアポストロフィで、コマンドは ":write" のように引用符で囲まれています。普通の +単語もリンクとして使えます。試しに、カーソルを CTRL-] の上に動かして CTRL-] を +押してみてください。 + +":help" コマンドでヘルプの目次を表示できます。|help.txt|をご覧ください。 + +縦線とスターは通常は |conceal| 機能によって隠されています。さらに、|hl-Ignore| +が使用され、背景色と同じ色が設定されています。次のコマンドでそれらを表示するこ +とができます: > + :set conceallevel=0 + :hi link HelpBar Normal + :hi link HelpStar Normal + +============================================================================== +*01.2* Vim の準備 + +マニュアルの大部分は Vim が正しくインストールされていることを前提にしていま +す。まだインストールしていなかったり、うまく動いていない (ファイルが見つからな +い、GUI でメニューが出ないなどの) 場合は、インストールの章 |usr_90.txt| を読ん +でください。 + *not-compatible* +このマニュアルでは「vi互換スイッチ('compatible')」がオフになっていることを前提 +にしています。ほとんどのコマンドは互換スイッチの影響を受けませんが、例えば、複 +数回アンドゥなどの機能を使うときは設定が重要になります。正しく設定されているこ +とを確実にするには、サンプル設定ファイルをコピーするのが簡単です。Vim の中から +コピーを実行するなら、サンプル設定ファイルの場所を探す必要はありません。コピー +の方法はシステムによって違います: + +Unix: > + :!cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc +MS-DOS, MS-Windows, OS/2: > + :!copy $VIMRUNTIME/vimrc_example.vim $VIM/_vimrc +Amiga: > + :!copy $VIMRUNTIME/vimrc_example.vim $VIM/.vimrc + +vimrc ファイルが既にある場合はコピーする必要はないかもしれません。 + +Vim を起動すると、オプション 'compatible' はオフになっているはずです。次のコマ +ンドで現在の設定を確認できます: > + + :set compatible? + +"nocompatible" と表示されればオフになっています。"compatible" と表示された場合 +は正しく設定されていません。オプションがオンになっている理由を確認してくださ +い。もしかしたら、先程保存した設定ファイルが読み込まれていないのかもしれませ +ん。次のコマンドで確認してください: > + + :scriptnames + +ファイルが一覧に無い場合は、vimrc ファイルの名前と場所を確認してください。一覧 +に入っている場合は、他のファイルによって 'compatible' がオンに設定されているは +ずです。 + +詳しくは|vimrc|と|compatible-default|をご覧ください。 + + Note: + このマニュアルはVimを普通に使うための説明書です。実は evim(=easy vim) + という別の Vim があります。これも Vim なのですが、メモ帳 のように + 「クリック & 入力」方式であったり、常に挿入モードであったり、普通の + Vim とはかなり雰囲気が違います。このユーザーマニュアルでは evim につい + て説明していません。操作方法は使えばわかるはずです。 + 詳しいことは |evim-keys| をご覧ください。 + +============================================================================== +*01.3* チュートリアル *tutor* *vimtutor* + +テキストを読むだけではなく (退屈だし!) チュートリアルを使って Vim の初歩を学ぶ +ことができます。vimtutor は 30 分の演習コースです。実際に操作しながら Vim の最 +低限の操作方法を習得できます。 + +Unix では、Vim が適切にインストールしてあれば、シェルから起動できます: > + + vimtutor + +MS-Windows では、スタートメニューの Program/Vim から起動できます。あるいは、 +$VIMRUNTIME ディレクトリにある vimtutor.bat を実行してください。 + +演習ファイルのコピーが作られるので、テキストを編集してもオリジナルの演習ファイ +ルを壊してしまう心配はありません。 +チュートリアルはいくつかの言語に翻訳されています。翻訳されたチュートリアルを使 +うには、二文字の言語コードを指定します。日本語の場合は次のようにします: > + + vimtutor ja + +Unix で GUI 版の Vim を使いたい場合は、"gvimtutor" か "vimtutor -g" を実行して +ください。 + +OpenVMS では、VMS プロンプトから次のようにして起動できます。 > + + @VIM:vimtutor + +上の例と同じようにオプションで二文字の言語コードを指定できます。 + + +Unix 以外のシステムでは、多少の作業が必要です。 + +1. 演習用ファイルをコピーします。これは Vim を使ってコピーできます (Vim はファ + イルの場所を知っている): +> + vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' +< +"TUTORCOPY" というファイルがカレントディレクトリに作成されます。翻訳された演習 +ファイルを使うには、二文字の言語コードを指定します。日本語の場合は次のようにし +ます: +> + vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor.ja' -c 'w! TUTORCOPY' -c 'q' +< +2. コピーしたファイルを Vim で開きます: +> + vim -u NONE -c "set nocp" TUTORCOPY +< +指定している引数によって Vim がイイ感じで起動されます。 + +3. 練習が終わったら、コピーしたファイルを削除します: +> + del TUTORCOPY +< +============================================================================== +*01.4* 著作権 (Copyright) *manual-copyright* + +Vim のユーザーマニュアルとリファレンスマニュアルの著作権は以下の通りです。 + Copyright (c) 1988-2003 by Bram Moolenaar +Open Publication License, v1.0 以降の条件に従って配布することができます。ライ +センスの最新バージョンは次の場所から入手できます: + http://www.opencontent.org/openpub/ + +マニュアルに貢献する人は上記の著作権通達に同意しなければなりません。 + + *frombook* +ユーザーマニュアルの一部は "Vi IMproved - VIM" から取られたものです。 + "Vi IMproved - Vim" Steve Oualline著 + (出版:New Riders Publishing, ISBN: 0735710015) +この本には Open Publication License が適用されています。必要な部分のみコピー +し、変更を加えています (図を削除したり、Vim 6.0 以降のために更新したり、間違い +を訂正したり)。|frombook|タグが省略されていたとしても、この本からコピーしたこ +とを否定するものではありません。 + +この本を OPL で出版してくださった Steve Oualline 氏と New Riders に深く感謝し +ます。ユーザーマニュアルの執筆においてとても助けられました。文章を提供しても +らっただけでなく、スタイルや文体も参考にさせていただきました。 + +このマニュアルの販売で収益を上げた方は、利益の一部を寄付してくださるようお願い +します。ウガンダのエイズ患者を助けてあげてください。詳しくは|iccf|をご覧くださ +い。 + +============================================================================== + +次章: |usr_02.txt| 初めての Vim + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_02.jax b/plugins/vimdoc-ja/doc/usr_02.jax new file mode 100644 index 0000000000..770a990d9a --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_02.jax @@ -0,0 +1,692 @@ +*usr_02.txt* For Vim バージョン 8.0. Last change: 2017 Mar 14 + + VIM USER MANUAL - by Bram Moolenaar + + 初めての Vim + + +この章では、Vim を使ってファイルを編集するための最低限のことを説明します。操作 +が下手でも遅くても、とにかく編集できるようになりましょう。この章に出てくるコマ +ンドはこれからの基礎になるものなので、少し時間をとって練習してください。 + +|02.1| Vim の起動方法 +|02.2| 文字の挿入 +|02.3| カーソル移動 +|02.4| 文字の削除 +|02.5| undo (取り消し) と redo (やり直し) +|02.6| 他の編集コマンド +|02.7| Vim の終了 +|02.8| ヘルプの引き方 + +次章: |usr_03.txt| カーソルの移動 +前章: |usr_01.txt| マニュアルについて +目次: |usr_toc.txt| + +============================================================================== +*02.1* Vim の起動方法 + +Vim を起動するには次のコマンドを入力します。 > + + gvim file.txt + +UNIXならコマンドプロンプトから実行できます。Microsoft Windows環境では、MS-DOS +プロンプトを開いて、入力してください。 +Vim が起動して file.txt という名前のファイルの編集が開始されます。これは新しい +ファイルなので、ウィンドウは空になっています。次のような画面が表示されます: + + +---------------------------------------+ + |# | + |~ | + |~ | + |~ | + |~ | + |"file.txt" [New file] | + +---------------------------------------+ + ("#" はカーソルの位置です) + +チルダ (~) の行は、ファイルにその行がないことを示しています。ファイルの末尾よ +り後ろを表示する場合にチルダが表示されます。画面の下の方に、編集中のファイル名 +は "file.txt" で、それが新しいファイルであることが表示されています。このメッ +セージの表示は一時的なもので、他のメッセージが表示されると消えてしまいます。 + + +VIM コマンド +------------ + +gvim は編集用のウィンドウを新しく作ります。次のコマンドを使った場合は: > + + vim file.txt + +コマンドウィンドウの中で編集できます。つまり、xterm の中で実行すれば、Vim は +xterm ウィンドウを使います。Microsoft Windows の MS-DOS プロンプトを使っている +場合も、そのウィンドウの中で編集できます。gvim でも vim でもテキストは同じよう +に表示されますが、gvimにはメニューバーなどの追加機能があります。詳しくは後で述 +べます。 + +============================================================================== +*02.2* 文字の挿入 + +Vim はモード型エディタです。モードによって挙動が変わります。一番よく使うモード +は「ノーマルモード」と「挿入モード」です。ノーマルモードでは、入力した文字は +コマンドとして扱われます。挿入モードでは、入力した文字はそのまま挿入されます。 +Vim を起動した直後はノーマルモードになっています。挿入モードに入るには、"i" コ +マンドを入力します (i は Insert の意)。これで、文章を入力できるようになります。 +入力した文章はファイルに挿入されます。入力を間違えても心配する必要はありませ +ん。後から修正できます。プログラマのリメリック(詩の一種)を入力して見ましょう。 +次のように入力します: > + + iA very intelligent turtle + Found programming UNIX a hurdle + +"turtle" を入力した後で <Enter> キーを押して改行します。最後に <Esc> キーを押 +して挿入モードを終了し、ノーマルモードに戻ります。このとき、Vim ウィンドウには +次のような二行が表示されています。 + + +---------------------------------------+ + |A very intelligent turtle | + |Found programming UNIX a hurdle | + |~ | + |~ | + | | + +---------------------------------------+ + + +今は何モード? +------------- + +現在のモードを確認できるようにするには、次のコマンドを入力してください。 > + + :set showmode + +":" (コロン記号) を入力すると、カーソルがウィンドウの最下段に移動します。ここ +はコロンコマンド (":" で始まるコマンド) を入力する場所です。<Enter> キーを押す +とコマンドが実行されます (コロンで始まるコマンドは全てこの方法を使います)。 +さて、"i" コマンドを入力すると、ウィンドウの最下段に "-- 挿入 --" という表示が +現れます。これは、あなたが挿入モードにいることを示しています。 + + + +---------------------------------------+ + |A very intelligent turtle | + |Found programming UNIX a hurdle | + |~ | + |~ | + |-- 挿入 -- | + +---------------------------------------+ + +<Esc> を押すとノーマルモードに戻り、最下段は空白になります。 + + +トラブルを避ける +---------------- + +Vim を使い始めたときはモードを混同しがちです。現在のモードを忘れてしまったり、 +知らないうちに間違ってモードを変更してしまったりすることがあります。どのモード +にいる場合でも <Esc> を押せばノーマルモードに戻れます。<Esc> を二回押さなけれ +ばならないときもあります。ノーマルモードで <Esc> を押すとビープ音が鳴るので、 +その場合は既にノーマルモードにいるということです。 + +============================================================================== +*02.3* カーソル移動 + +ノーマルモードでは、次のキーを使って移動できます: + + h 左 *hjkl* + j 下 + k 上 + l 右 + +最初はでたらめなコマンドに思えるかもしれません。"l" キーで 右 (right) に移動す +るなんておかしいですね。しかしこれには合理的な理由があります。エディタで最もよ +く使うのはカーソル移動であり、これらのキーは右手のホームポジションにあるので +す。つまり、(特に 10 本の指を使ってタイプする人が) 最も速く打てる場所にコマン +ドが配置されています。 + + Note: + カーソルは矢印キーでも移動できます。しかし、ホームポジションから手を離 + さなければならないので、編集速度は落ちてしまいます。一時間に数百回も移 + 動することを考えると、結構な時間が消費されることになります。 + また、矢印キーが無いキーボードや、矢印キーの配置場所がおかしいキーボー + ドもあります。hjkl の使い方を知っていれば、そのような場合でも安心です。 + +コマンドを覚えるには、"h" は左にあって、"l" は右にあって、"j" は下を指してい +る、とでも覚えてください。図で示します: > + + k + h l + j + +移動コマンドを覚える一番の方法は使ってみることです。"i" コマンドを使って適当な +テキストを入力し、hjkl キーを使って動き回り、いろんな場所に文字を挿入してみて +ください。<Esc> キーを押してノーマルモードに戻るのを忘れずに。|vimtutor| を使っ +て練習してみるのもいいでしょう。 + +日本のユーザーへ、Hiroshi Iwataniさんは次のような提案をしています。 + + Komsomolsk + ^ + | + Huan Ho <--- ---> Los Angeles + (Yellow river) | + v + Java (ジャワ島。プログラミング言語のあれではない) + +============================================================================== +*02.4* 文字の削除 + +文字を削除したい場合は、文字の上にカーソルを移動して "x" を押します。(これはタ +イプライタを使っていた古い時代に、消したい文字の上に "xxxxxx" と印字していたの +と同じ感覚です)。例えば、例文の一行目にカーソルを移動して、xxxxxxx (xを7つ) 打 +ち、"A very " を消してみましょう。その結果は次のようになります: + + +---------------------------------------+ + |intelligent turtle | + |Found programming UNIX a hurdle | + |~ | + |~ | + | | + +---------------------------------------+ + +さて、新しいテキストを挿入してみましょう。例えば次のように入力します: > + + iA young <Esc> + +"i" で挿入を開始し、"A young " を入力しています。最後に <Esc> キーを押して挿入 +モードを抜けます。結果は次のようになります。 + + +---------------------------------------+ + |A young intelligent turtle | + |Found programming UNIX a hurdle | + |~ | + |~ | + | | + +---------------------------------------+ + + +行削除 +------ + +行全体を消すには "dd" コマンドを使います。行が消された場所は、それ以降の行を上 +げることで詰められます。 + + +---------------------------------------+ + |Found programming UNIX a hurdle | + |~ | + |~ | + |~ | + | | + +---------------------------------------+ + + +改行を取る +---------- + +Vim では複数の行を一行にまとめることができます。これは行と行の間にある改行文字 +を削除するのと同じです。それには "J" コマンドを使います。 +例えば、次の二行があるとします: + + A young intelligent ~ + turtle ~ + +最初の行にカーソルを動かし "J" を押すと次のようになります: + + A young intelligent turtle ~ + +============================================================================== +*02.5* undo (取り消し) と redo (やり直し) + +間違ってテキストを削除してしまった場合、同じ内容を入力し直すこともできますが、 +もっと簡単な方法があります。"u" コマンドで直前の編集結果を undo (取り消し) +できます。例えば、"dd" コマンドで削除した行を、"u" コマンドで元に戻せます。 +もう一つ例を示します。カーソルを一行目の A に移動して: + + A young intelligent turtle ~ + +xxxxxxx とタイプし、"A young" を削除します。結果は次のようになります: + + intelligent turtle ~ + +"u" で直前の削除が取り消されます。最後に削除されたのは g なので、その文字が復 +活します。 + + g intelligent turtle ~ + +もう一度 "u" を実行すると、さらに一つ前に削除された文字が復活します: + + ng intelligent turtle ~ + +次の "u" コマンドでは u が復活し、次々と元に戻すことができます: + + ung intelligent turtle ~ + oung intelligent turtle ~ + young intelligent turtle ~ + young intelligent turtle ~ + A young intelligent turtle ~ + + Note: + "u" を二回押したときに、最初の状態に戻ってしまった場合は、Vi 互換モー + ドが設定されています。|not-compatible| を参照して正しく設定してくださ + い。 + このマニュアルでは「Vim方式」の使い方を前提にしています。古き良き時代 + の Vi 方式を使いたい場合は、細かい部分でマニュアルの説明と違うことがあ + るので注意してください。 + + +redo (やり直し) +--------------- + +undo し過ぎてしまった場合は、CTRL-R (redo) を押すことで、直前のコマンドを +取り消せます。つまり、undo を undo します。実際に二回 CTRL-R を押してみましょ +う。"A "の二文字が消えます。 + + young intelligent turtle ~ + +undo コマンドには特別なバージョン、"U" (行 undo) コマンドがあります。行 undo +コマンドは直前に編集した行のすべての変更を取り消します。このコマンドは、二回実 +行すると、直前の "U" が取り消されます。 + + A very intelligent turtle ~ + xxxx "very" を削除 + + A intelligent turtle ~ + xxxxxx "turtle" を削除 + + A intelligent ~ + "U" で行全体を元に戻す + A very intelligent turtle ~ + "u" で "U" を undo + A intelligent ~ + +"u" が undo で、CTRL-R が redo であるのに対し、"U" コマンドはそれ自身が変更コ +マンドです。ちょっとわかりにくいかも知れませんが心配はいりません。"u" と +CTRL-R があればどんな場合でも大丈夫だ、ってことです。詳細は |32.2| にあります。 + +============================================================================== +*02.6* 他の編集コマンド + +Vim には文章を編集するための数多くのコマンドがあります。下記、または|Q_in|を参 +照してください。ここでは頻繁に使うものだけを述べます。 + + +追記 (APPENDING) +---------------- + +"i" コマンドはカーソルの前に文字列を挿入しますが、行末に文字を追加したいときは +はどうすればいいでしょうか? それにはカーソルの後ろに文を挿入できないといけませ +ん。"a" (append) コマンドで追記できます。 +例えば、次の行を + + and that's not saying much for the turtle. ~ +このように変更したいとします + and that's not saying much for the turtle!!! ~ + +まずカーソルを行末のピリオドの上に動かし、"x" でピリオドを消します。この時カー +ソルは行末の turtle の "e" の上にあります。ここで、次のコマンドを入力します。 +> + a!!!<Esc> + +これで turtle の後ろに三つの "!" 記号が追加されます: + + and that's not saying much for the turtle!!! ~ + + +新しい行を開く +-------------- + +"o" コマンドを使うと、カーソルの下に新しい空の行が作成され、挿入モードに入りま +す。そのため、そのまま新しい行の文章を入力できます。 +以下のような二行があり、カーソルが一行目のどこかにあるとします: + + A very intelligent turtle ~ + Found programming UNIX a hurdle ~ + +"o" コマンドを実行し、テキストを入力すると: > + + oThat liked using Vim<Esc> + +次のような結果になります: + + A very intelligent turtle ~ + That liked using Vim ~ + Found programming UNIX a hurdle ~ + +"O" コマンド (大文字) を使うと、カーソルの上に空行を作成できます。 + + +カウンタを使う +-------------- + +例えば、9 行上に移動したい場合、"kkkkkkkkk" とタイプすることもできますが、"9k" +コマンドでも同様に移動できます。実はほとんどのコマンドには回数を指定できます。 +例えば上記の例では、"a!!!<Esc>" で三つの "!" 記号を追加しましたが、これは +"3a!<Esc>" と入力することもできます。最初の 3 はコマンドを三回実行することを指 +定しています。同様に、三文字削除したい場合は "3x" を使います。カウントは必ず対 +象となるコマンドの前に指定してください。 + +============================================================================== +*02.7* Vim の終了 + +Vim を終了するには "ZZ" コマンドを使います。ファイルが保存され、Vim が終了しま +す。 + + Note: + 他の多くのエディタと違い、Vim は自動的にバックアップを作成しません。 + "ZZ" と打つとファイルが上書きされるため、元に戻す方法はありません。バッ + クアップファイルを作成するように設定することもできます。|07.4|を参照し + てください。 + + +変更を破棄する +-------------- + +ファイルを編集した後で、元の方が良かったと気づくことがあると思います。心配はい +りません。「全部投げ捨てて終了する」コマンドがあります。 > + + :q! + +コマンドを確定するには <Enter> キーが必要ですよ。お忘れなく。 + +詳細を説明すると、このコマンドは三つの部分から成っています。":" はコマンドライ +ンモードの開始、"q" コマンドはエディタを終了するコマンド、"!" はオーバーライド +修飾詞です。 +変更を破棄するにはオーバーライド修飾詞が必要です。単に ":q" を実行した場合、エ +ラーメッセージが表示され、コマンドは実行されません: + + E37: 最後の変更が保存されていません (! で変更を破棄) ~ + +オーバーライドを指定することで、「バカげたことをしてるように見えるのはわかって +る。でもボクは大人だし、本当にそうしたいんだ」と Vim に告げているわけです。 + +Vim を終了したくない場合は、":e!" コマンドでオリジナルのファイルを再読み込みで +きます。 + +============================================================================== +*02.8* ヘルプの引き方 + +知りたいことは何でも Vim のヘルプで調べることができます。どんどん調べてくださ +い! + +何かを知りたいときには、たいていはグーグルを使うよりもヘルプを使って探すほうが +簡単です。なぜならヘルプの題目は一定のスタイルガイドに沿っているからです。 + +さらに、ヘルプはあなたが使っているVimの特定のバージョンに即しているという利点 +があります。後で追加されたコマンドのヘルプは表示されません。それらはあなたの環 +境では動かないでしょう。 + +次のコマンドでヘルプの総合案内が表示されます: > + + :help + +ヘルプは <F1> ファンクションキーでも表示できます。キーボードに <Help> キーがあ +る場合はそれも使えます。 +":help" に引数を指定しなかった場合は総合案内が表示されます。Vim の作者はとても +賢い (いや、すごい怠け者かも) ので、ヘルプウィンドウには普通の編集ウィンドウが +使われています。ヘルプウィンドウの中ではすべてのノーマルモードコマンドが使えま +す。したがって、h, j, k, l で 上下左右に移動できます。 +ヘルプウィンドウは、エディタを終了するのと同じコマンド ("ZZ") で閉じることがで +きます。この場合は、ヘルプウィンドウが閉じるだけで、Vim は終了しません。 + +ヘルプを読むと、縦棒 "|" で囲まれた文字に気づくと思います (例: |help|)。それは +ハイパーリンクです。その場所にカーソルを置いて、CTRL-] (タグジャンプ) を押す +と、そのヘルプにジャンプできます。(理由は省きますが、Vim ではハイパーリンクの +ことをタグと呼びます。CTRL-] はカーソル下の単語をタグとみなして、その場所にジャ +ンプします。) +ジャンプした後は CTRL-T (タグをポップする) で元の場所に戻れます。CTRL-O (古い +場所へのジャンプ) でも元に場所に戻れます。 + +ヘルプ画面の最上部に*help.txt*という表記があります。"*" で囲まれた名前はヘルプ +システムのタグ (ハイパーリンクの飛び先) を定義するために使われています。 +タグの使い方の詳細は |29.1| を参照してください。 + +特定のヘルプ項目を見るには次のコマンドを使います: > + + :help {subject} + +例えば "x" コマンドのヘルプを見るには次のようにします: > + + :help x + +文字の削除方法を調べるには次のようにします: > + + :help deleting + +Vim のコマンド一覧を見たい場合は次のようにします: > + + :help index + +コントロール文字コマンド (例えば CTRL-A) のヘルプを見るには、"CTRL-" に続けて +その文字を指定します: > + + :help CTRL-A + +Vim にはいろんなモードがあります。特に指定がなければノーマルモードコマンドのヘ +ルプが表示されます。例えば、次のコマンドでノーマルモードの CTRL-H コマンドのヘ +ルプが表示されます: > + + :help CTRL-H + +他のモードを指定するにはプリフィックスを付けてください。例えば、挿入モードのヘ +ルプを見たいときには、"i_" を付けます。CTRL-H の場合なら次のようになります: > + + :help i_CTRL-H + +Vim を起動するときにはコマンドライン引数を指定できます。引数は先頭が "-" で始 +まります。例えば、"-t" 引数の意味を調べるには次のコマンドを使います: > + + :help -t + +Vim にはオプションがたくさんあり、それを設定することでカスタマイズができます。 +オプションのヘルプを見るには、アポストロフィでそれを囲ってください。例えば、 +'number' オプションの意味を調べるには次のコマンドを使います: > + + :help 'number' + +モードのプリフィックス一覧は |help-summary| を参照してください。 + +特殊キー不等号で囲んで表記します。例えば、挿入モードの上矢印キーのヘルプを見る +には次のコマンドを使います: > + + :help i_<Up> + +例えば次のようなエラーメッセージが表示された場合: + + E37: 最後の変更が保存されていません (! で変更を破棄) ~ + +行頭のエラーIDを使えばヘルプを検索できます: > + + :help E37 + + +概要: *help-summary* > + +1) トピックをタイプした後、あり得るトピック全てを表示させるには + Ctrl-D を使います。もしくはタブで補完します: > + :help some<Tab> +< help の使い方に関するより詳しい情報については: > + :help helphelp + +2) バーで囲まれた関連ヘルプへのリンクを辿ってみて下さい。ヘルプの詳細から + ユーザー視点のコマンド説明で、あまり詳しすぎないユーザードキュメントへ移動 + できます。例えば: > + :help pattern.txt +< を見るとイントロダクション部分にユーザーガイドのトピック |03.9| や + |usr_27.txt| があるのが分かります。 + +3) オプションは単一のアポストロフィで囲まれます。list オプションに関するヘル + プへ行くには: > + :help 'list' +< もし特定のオプションを探していないのであれば、以下でも可能です: > + :help options.txt +< 正規表現を使って記載された全てのオプションを検索し textwidth 等のヘルプの + ページを見つけ出します。 + 特定のオプションには特有のネームスペースが付きます。例: > + :help cpo-<letter> +< は設定 'cpoptions' のフラグに対応します。<letter> は個別のフラグに置き換えて + 下さい。例: > + :help cpo-; +< さらに guioption のフラグであれば: > + :help go-<letter> + +4) ノーマルモードのコマンドにはプリフィックスはありません。"gt" コマンドのヘル + プへ行くには: > + :help gt + +5) 挿入モードのコマンドは i_ で始まります。単語の削除に関するヘルプであれば: > + :help i_CTRL-W + +6) ビジュアルモードのコマンドは v_ で始まります。ビジュアル領域のもう片方へ + ジャンプする方法のヘルプであれば: > + :help v_o + +7) コマンドラインの編集や引数は c_ で始まります。引数の % の使用方法の + ヘルプであれば: > + :help c_% + +8) Exコマンドは常に ":" で始まります。よって :s コマンドのヘルプに + 移動するには: > + :help :s + +9) デバッグに関するコマンドは ">" で始まります。 + デバッグコマンドの "cont" のヘルプに移動するには: > + :help >cont + +10) キーの組み合わせは通常、使用できるモードを表す1文字から始まります。 + 例えば: > + :help i_CTRL-X +< は挿入モードでそれぞれ異なるものを補完するCtrl-X 系コマンドに移動します。 + Note いくつかのキーは常に同様に記載されています。 + 例えばコントロールキーは常に CTRL と記載されます。 + ノーマルモードのコマンドはプリフィックスを持たず、項目は :h CTRL-<char> + により参照可能です。例えば > + :help CTRL-W +< に対して > + :help c_CTRL-R +< はコマンドラインに入ったときの CTRL-R が行うことを説明しています。また > + :help v_Ctrl-A +< はビジュアルモードでの数値のインクリメントを説明し > + :help g_CTRL-A +< は g<C-A> コマンドについて述べています (これには "g" を押して <Ctrl-A> + を押す必要があります)。 + +11) 正規表現の項目は常に / で始まります。 + よってVimの正規表現の "\+" 量指定子のヘルプに移動するには: > + :help /\+ +< もし正規表現の全てに関して知りたいのなら、以下を参照してください: > + :help pattern.txt + +12) レジスタは常に "quote" で始まります。特殊なレジスタ ":" について調べるので + あれば: > + :help quote: + +13) Vim script は以下を参照。 > + :help eval.txt +< Vim script のいくつかの側面については :h expr-X ("X" は1文字) に + 記載されています。例えば > + :help expr-! +< は Vim script の "!" (否定)演算子の説明の項目に移動します。 + さらに重要なのが > + :help function-list +< にはすべての関数の簡潔な説明が記載されています。 + ヘルプ項目の Vim script の関数はすべて "()" を含みます。よって: > + :help append() +< は現在のバッファのテキストを append する方法ではなく + append 関数についての説明に移動します。 + {訳注: |:append| ではなく |append()| に移動するという意味だと思われます。} + +14) マッピングについては :h |map.txt| で述べられています。 > + :help mapmode-i +< |:imap| コマンドについて調べるなら上記を使用してください。 + またマッピング固有のある項目を調べるには :map-topic + {訳注: "topic" は項目名} も使用できます。例えば: > + :help :map-local +< はバッファローカルなマッピングに関する項目です。または > + :help map-bar +< は '|' がどのようにマッピングで処理されるかに関する項目です。 + +15) コマンド定義は :h command-topic で記載されます。カスタムコマンドの '!' 引 + 数については > + :help command-bar +< で見つける事ができます。 + +16) ウィンドウの制御コマンドは常に CTRL-W で始まります。:h CTRL-W_文字 で該当 + のヘルプが見つかります。例えば: > + :help CTRL-W_p +< で一つ前のウィンドウへの移動のヘルプにアクセスできます。また自分のペースで + ウィンドウ操作コマンド群を眺めたいならば > + :help windows.txt +< でアクセスできます。 + +17) 全てのヘルプ (とインストールしたプラグイン) のページを検索するには + |:helpgrep| を使用してください。使用法については |:helpgrep| を参照してください。 + 項目を検索するには {訳注: "topic" は項目名}: > + :helpgrep topic +< これにより最初にマッチした項目に移動します。次の項目に移動するには: > + :cnext +< 全てのマッチした項目は以下のコマンドで開くことできる QuickFix ウィンドウで + 参照可能です: > + :copen +< 好きな項目に移動し、Enter を押すとそのヘルプにジャンプすることができます。 + +18) ユーザーマニュアルは初心者にとってより親しみやすい項目について + 説明しています。(おそらくあなたの想像通り) |usr_toc.txt| でその目次を + 見つけることができます: > + :help usr_toc.txt +< 興味を持った項目を探すようにざっと眺めてみてください。 + "ダイグラフ (Digraph)" と "特殊な文字を入力する" の項目は24章です。 + そのページに移動するには: > + :help usr_24.txt +< また特定の章に直接アクセスしたければ、このように章番号でもアクセス + 可能です: > + :help 10.1 +< 上記で |usr_10.txt| の10.1章に移動し、マクロの記録の解説が見れます。 + +19) ハイライトグループは常に hl- から始まります。例えば > + :help hl-WarningMsg +< には WarningMsg ハイライトグループについて書かれています。 + +20) 構文ハイライトは :syn-トピック という形式になっています。例えば > + :help :syn-conceal +< には :syn コマンドの Conceal 引数について書かれています。 + +21) QuickFix コマンドは大体 :c から始まり、ロケーションリストコマンドは大体 :l + から始まります。 + +22) Autocommand イベントはそれらの名前で見つける事ができます: > + :help BufWinLeave +< 全てのイベントを見るには: > + :help autocommand-events + +23) コマンドラインスイッチは常に "-" から始まります。Vim のコマンドスイッチ -f + に関するヘルプであれば: > + :help -f + +24) オプションの機能は常に "+" から始まります。conceal 機能の使い方について調 + べるのであれば: > + :help +conceal + +25) ファイルタイプ特有の機能が含まれるドキュメントは通常 + ft-<filetype>-<functionality> に存在します。よってCのシンタックスファイル + とそこで提供されているオプションについては以下に記載されます。 > + :help ft-c-syntax +< オムニ補完に関するセクションは > + :help ft-php-omni +< で、ファイルタイププラグインに関しては > + :help ft-tex-plugin +< で提供されている事があります。 > + +26) エラーと警告のコードはhelpで直接引くことができます。よって > + :help E297 +< はスワップエラーメッセージの説明に移動し、また > + :help W10 +< は "Changing a readonly file" の警告について述べます。 + しかし時々エラーコードの説明が存在しない場合がありますが、 + どちらかといえば大抵それを引き起こしたVimのコマンドの方に記載されている + でしょう。よって: > + :help E128 +< は |:function| コマンドに飛びます。 + + +============================================================================== + +次章: |usr_03.txt| カーソルの移動 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_03.jax b/plugins/vimdoc-ja/doc/usr_03.jax new file mode 100644 index 0000000000..5f57aae079 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_03.jax @@ -0,0 +1,646 @@ +*usr_03.txt* For Vim バージョン 8.0. Last change: 2016 Jan 05 + + VIM USER MANUAL - by Bram Moolenaar + + カーソルの移動 + + +文を入力したり削除したりするには、カーソルを目的の場所に動かさなくてはなりませ +ん。Vim にはカーソル移動のためのコマンドがたくさんあります。本章では、その中で +も重要なコマンドの使い方を述べます。コマンドの一覧は |Q_lr| を参照してくださ +い。 + +|03.1| 単語ごとの移動 +|03.2| 行頭、行末への移動 +|03.3| 文字への移動 +|03.4| カッコの対応 +|03.5| 特定の行への移動 +|03.6| 現在の場所を表示 +|03.7| スクロール +|03.8| 簡単な検索 +|03.9| 簡単なパターン検索 +|03.10| マークの使用 + +次章: |usr_04.txt| 簡単な編集 +前章: |usr_02.txt| 初めての Vim +目次: |usr_toc.txt| + +============================================================================== +*03.1* 単語ごとの移動 + +カーソルを 1 単語先に進めるには、"w" コマンドを使います。他の Vim コマンドもそ +うですが、複数の単語を一気に進めるために数値 (カウンタ) による回数指定ができま +す。例えば、"3w" では 3 単語進みます。図で示すと次のようになります。 + + This is a line with example text ~ + --->-->->-----------------> + w w w 3w + +"w" で次の単語の先頭に移動します。既にカーソルが単語の先頭にある場合は、その次 +の単語の先頭に移動します。 +逆に "b" コマンドで直前の単語の先頭に戻ります。 + + This is a line with example text ~ + <----<--<-<---------<--- + b b b 2b b + +"e" コマンドで次の単語の末尾に移動します。"ge" で直前の単語の末尾に移動します。 + + This is a line with example text ~ + <- <--- -----> ----> + ge ge e e + +カーソルが行末の単語にある場合、"w" コマンドは次の行の最初の単語に進みます。こ +れを使うと "l" よりもずっと速く文章の中を動けます。"b" は "w" の逆方向に同じ +ルールで動きます。 + +単語は "." や "-"、")" といったアルファベット以外の文字で区切られます。Vimが何 +を単語とみなすかは、'iskeyword' オプションの設定で変更できます。ヘルプで直接試 +したい場合は正しく動作させる為に以下の様に 'iskeyword' をリセットする必要があ +ります: > + :set iskeyword& +空白を区切りとした単語(WORD)を移動することもできます。これは普段意識する単語 +(word)とは若干違うため、大文字を使っています。WORD単位で動くコマンドは全部大 +文字です。図で示すと次の通りです。 + + ge b w e + <- <- ---> ---> + This is-a line, with special/separated/words (and some more). ~ + <----- <----- --------------------> -----> + gE B W E + +小文字と大文字のコマンドを両方使うと、文章中をより素早く動けるようになります。 + +============================================================================== +*03.2* 行頭、行末への移動 + +"$" コマンドでカーソルを行末に移動します。キーボードに<End>キーがあれば、それも +同じ意味で使えます。 + +"^" コマンドでカーソルを行頭から最初の非空白文字に移動します。"0" (数字のゼロ) +コマンドは行頭に移動します。<Home>キーも同じです。図で示しましょう。 + + ^ + <------------ + .....This is a line with example text ~ + <----------------- ---------------> + 0 $ + +("....." は空白文字があることを示します) + +"$" コマンドでも他の移動コマンドのようにカウンタの指定ができます。行末への移動 +を何度やっても意味がありませんので、"$" コマンドでのカウンタは他の行の行末への +移動の意味になります。例えば、"1$" は "$" と同じで現在行の行末への移動ですが、 +"2$" は次の行末への移動、"3$" は 2 行下の行末への移動、となります。 +"0" コマンドは回数指定できません。これは、"0" 自身が回数指定の一部になってしま +うからです。"^" に回数指定をした場合は単に無視されます。 + +============================================================================== +*03.3* 文字への移動 + +特に便利な移動コマンドはいくつかありますが、一文字検索コマンドもその一つです。 +コマンド "fx" はその行にある文字 x を前方検索します。(f は Find の意味です)。 +例えば、次の文の先頭にカーソルがあり、human の h に移動したいとします。"fh" +コマンドを実行すると、'h' の上にカーソルが進みます。 + + To err is human. To really foul up you need a computer. ~ + ---------->---------------> + fh fy + +続いて、"fy" コマンドで really の y まで移動できます。 +これもカウンタ指定ができます。例えば次の文の foul の l に進むには "3fl" です。 + + To err is human. To really foul up you need a computer. ~ + ---------------------> + 3fl + +"F" コマンドで左向きに検索できます。 + + To err is human. To really foul up you need a computer. ~ + <--------------------- + Fh + +"tx" コマンドは "fx" コマンドに似た動きをしますが、検索した文字の上ではなく、 +その直前で止まります。(tはToの意味です) +このコマンドの逆方向版は "Tx" です。 + + To err is human. To really foul up you need a computer. ~ + <------------ -------------> + Th tn + +この 4 つのコマンドは ";" コマンドで繰り返せます。反対方向に繰り返すには "," +コマンドです。このコマンドは、カーソルが他の行に移動することはありません。文が +次行に続いていても移動しません。 + +検索をしようとして、コマンドを打ち間違うこともあるでしょう。例えば、逆方向検索 +のつもりで ("F" と打つべきところを) "f" と打ってしまったとしましょう。コマンド +の実行を取り止めるには<Esc>を押します。"f<Esc>" は<Esc>を探すのではなく、コマ +ンドをキャンセルします。Note:<Esc>は検索に限らず、ほとんどのコマンドをキャンセ +ルするのに使えます。 + +============================================================================== +*03.4* カッコの対応 + +プログラムを書いていると、入れ子になった () を書くことがよくあります。そのよう +な場合には、"%" コマンドがとても便利です。このコマンドを使うと対応するカッコに +移動できます。カーソルが "(" の上なら対応する ")" に、")" の上なら対応する "(" +に移動できます。 + + % + <-----> + if (a == (b * c) / d) ~ + <----------------> + % + +このコマンドは [] や {} のペアでも機能します。(これは 'matchpairs' オプション +で定義できます) + +カーソルがカッコの上にない場合、"%" はまず前方検索をしてカッコを探します。上記 +の例文で行頭にカーソルがあった場合、"%" は前方検索をして "(" を見つけ、それか +ら、対応するカッコ ")" に移動します。 + + if (a == (b * c) / d) ~ + ---+----------------> + % + +============================================================================== +*03.5* 特定の行への移動 + +CやC++のプログラマであれば、次のようなパターンのエラーメッセージはおなじみで +しょう。 + + prog.c:33: j undeclared (first use in this function) ~ + +何か33行目に修正しないといけない点がありそうです。では、どうやって33行目に移動 +しましょうか? "9999k" などとしてファイルの先頭まで移動してから、"32j" で32行 +下に移動するやり方もあります。確かに目的は達しますが、あまりいい方法とは思えま +せん。そこで "G" というコマンドを使います。このコマンドにカウンタを指定すると、 +その行にジャンプできます。例えば、"33G" とすれば、33行目にジャンプできます。 +(実はコンパイラのエラーリストを使ってもっと簡単に移動する方法もあります。 +|usr_30.txt| の ":make" コマンドをご覧ください。) +カウンタを指定しなかった場合はファイルの最終行にジャンプします。ファイルの先頭 +にジャンプするには "gg" を使います。"1G" でも同じですが、ちょっと打ちにくいで +すから。 + + | first line of a file ^ + | text text text text | + | text text text text | gg + 7G | text text text text | + | text text text text + | text text text text + V text text text text | + text text text text | G + text text text text | + last line of a file V + +特定行に移動するもう一つの方法はカウンタ付きの "%" コマンドです。例えば、"50%" +でファイルの真ん中に移動できます。"90%" ならファイルのほぼ最後(90%の場所) に移 +動します。 + +以上述べたのは、画面上に見えているかどうかに関係なくファイルの特定行に移動した +い場合のコマンドでした。では画面上に見えている行に移動したい場合はどうしましょ +うか?そういう時に使える 3 つのコマンドを下図に示します。 + + +---------------------------+ + H --> | text sample text | + | sample text | + | text sample text | + | sample text | + M --> | text sample text | + | sample text | + | text sample text | + | sample text | + L --> | text sample text | + +---------------------------+ + +("H" はHome、"M" はMiddle、"L" はLastの意味です) + +============================================================================== +*03.6* 現在の場所を表示 + +ファイル中の現在の場所を知るには、次の 3 つの方法があります。 + +1. CTRL-Gコマンド。次のようなメッセージが表示されます。('ruler' オプション + がオフの場合) + + "usr_03.txt" line 233 of 650 --35%-- col 45-52 ~ + + 編集中のファイル名、カーソルのある行番号、全体の行数、ファイル全体を + 通してのパーセント、カーソル桁位置、を表示します。 + 場合によっては、カーソル桁位置が 2 つに分けて表示されます。例えば、 + "col 2-9" の場合、カーソルは 2 文字目にあります。2 文字のうち、1 文字がタ + ブ文字で、8 文字分で表示されているため、画面上では 9 桁目にある、というこ + とです。 + +2. 'number' オプションを設定する。行頭に行番号が表示されるようになります: > + + :set number +< + オプションをオフに戻すには: > + + :set nonumber +< + 'number' は論理値オプションなので、オプション名の先頭に "no" をつければオ + フにできます。論理値オプションにはオンかオフの 2 つの状態しかありません。 + Vimには多数のオプションがあります。論理値オプションの他に、数値オプション + と文字列オプションがあります。それらのオプションの設定方法はそのうち説明し + ます。 + +3. 'ruler' オプションを設定する。現在のカーソル位置が、Vimウィンドウの右下隅 + に表示されるようになります: > + + :set ruler +< +'ruler' は表示に場所を取らないので、画面を広く使えます。 + +============================================================================== +*03.7* スクロール + +CTRL-U コマンドで画面の半分だけ下にスクロールします。窓を通してテキストを見て +いて、その窓を高さの半分だけ上に動かす、と考えてください。窓が上に動き、さっき +より上の位置のテキストが表示されます。どっちが上でどっちが下かわかりにくいかと +思いますが、気にすることはありません。みんな同じように悩むことですから。 +CTRL-Dコマンドは窓を半分だけ下げます。つまりテキストが画面の半分だけ上にスク +ロールすることになります。 + + +----------------+ + | some text | + | some text | + | some text | + +---------------+ | some text | + | some text | CTRL-U --> | | + | | | 123456 | + | 123456 | +----------------+ + | 7890 | + | | +----------------+ + | example | CTRL-D --> | 7890 | + +---------------+ | | + | example | + | example | + | example | + | example | + +----------------+ + +1 行だけスクロールするにはCTRL-E(スクロールアップ)とCTRL-Y (スクロールダウン) +を使います。(MS-Windows互換のキーマップをお使いの場合、CTRL-Yはスクロールでは +なく、redo コマンドとなります) + +1 画面分スクロールするにはCTRL-Fを使います(2行は重複します)。逆方向へのスク +ロールはCTRL-Bコマンドを使います。CTRL-FはForward、CTRL-BはBackward、ですから +覚えやすいでしょう。 + +"j" で何行も下に移動して、カーソルが画面の最下段にあるとします。カーソル前後の +行を表示したい場合は "zz" コマンドを使います。 + + +------------------+ +------------------+ + | some text | | some text | + | some text | | some text | + | some text | | some text | + | some text | zz --> | line with cursor | + | some text | | some text | + | some text | | some text | + | line with cursor | | some text | + +------------------+ +------------------+ + +"zt" コマンドでカーソル行を画面の 1 行目として表示できます。"zb" コマンドなら +画面の最下段です。これ以外にもいくつかスクロールコマンドがあります。|Q_sc|を参 +照してください。カーソル近辺の数行を常に表示させたい場合は、'scrolloff' オプ +ションを使ってください。 + +============================================================================== +*03.8* 簡単な検索 + +文字列を検索するには "/string" コマンドを使います。例えば、"include" という単 +語を探したいのであれば、次のように使います。 > + + /include + +"/" を押すと、コマンドラインモードのときのように、カーソルがVimウィンドウの最 +下段に移動します。そこで検索したい単語を入力します。入力した文字を訂正するに +は、バックスペースキー (左矢印 または <BS>) を使います。必要に応じて<Left>や +<Right>の矢印キーを使ってください。 +<Enter>を押すとコマンドが実行されます。 + + Note: + 文字のうち、 .*[]^%/\?~$ には特別な意味があります。検索時にこれらを + 使う場合はその文字の直前に \ を置いてください。これは後(|03.9|の + 最後)で述べます。 + +同じ文字列をもう一度探したい場合には "n" コマンドを使います。今のカーソル位置 +の後ろにある#includeを探すには次のコマンドを使います。 > + + /#include + +次に "n" を数回押すと、順々に #include にジャンプします。移動したい場所が何個 +目かわかっているなら、カウンタも使えます。例えば、"3n" なら 3 つ目の #include +を探します。"/" にはカウンタを指定できません。 + +"?" コマンドは "/" と同じですが、逆方向に検索します。 > + + ?word + +"N" コマンドは直前の検索とは反対の方向に検索を繰り返します。"/" の後で "N" を +使うと後方検索になり、"?" の後で "N" を使うと前方検索になります。 + + +大文字/小文字の無視 +------------------- + +普通は探したい文字列の大文字/小文字を正確に指定しなければなりません。大文字と +小文字を区別したくないのであれば、'ignorecase' オプションを設定します。 > + + :set ignorecase + +これで、"word" を検索すると、"Word" も "WORD" もヒットします。大文字/小文字を +区別するように戻すのは次のコマンドです。 > + + :set noignorecase + + +ヒストリ(履歴) +-------------- + +次のような3つの検索を行ったとします。 > + + /one + /two + /three + +さて、"/" だけを入力し、まだ <Enter> を押さないでください。<Up> (上矢印キー) +を押すと、コマンド行に /three と表示されます。ここで <Enter> を押すと、 +"three" が検索されます。<Enter>を押さずに<Up>を押すとコマンド行には "/two" と +表示されます。さらに<Up>を押すと "/one" となります。 +同じように<Down>キーを使って逆方向に検索ヒストリを移動できます。 + +以前に使ったパターンを覚えていて、それをまた使いたい場合には、そのパターンの先 +頭文字を入力してから <Up> を押してください。上の例で言えば、"/o<Up>" と入力す +ると、コマンドラインに "/one" と表示されます。 + +":" で始まるコマンドにもヒストリがあります。以前のコマンドを呼び出して、再実行 +できます。検索用ヒストリと ":" コマンドヒストリは分かれています。 + + +文章中の単語の検索 +------------------ + +"TheLongFunctionName" という単語が文章中にあり、次に現れる場所を探したいと +します。もちろん、"/TheLongFunctionName" として検索もできますが、たくさんの打 +鍵が必要です。それに、打ち間違えてしまうとうまく検索できません。 +もっと簡単な方法があります。探したい単語の上にカーソルを置いて、"*" コマンドを +使うのです。カーソル位置の単語が抜き出され、それが検索文字列として使われます。 +"#" コマンドは同じことを逆方向に実行します。このコマンドもカウンタが指定でき +ます。例えば、"3*" はカーソル位置の単語が 3 回目に現われる場所を探します。 + + +単語全体を一致させる検索 +------------------------ + +"/the" と検索を行うと、"there" などもヒットします。"the" で終わる単語だけを探 +したい場合には次のようにします。 > + + /the\> + +"\>" というのは特別なマーカーで、単語がここで終わっている時だけヒットします。 +同じように "\<" は単語の始まりにだけヒットします。つまり、"the" という単語だけ +を探したい場合は、次のようにします。 > + + /\<the\> + +これだと、"there" とか "soothe" にはヒットしません。なお、"*" と "#" コマンド +は上の「単語の先頭」と「単語の末尾」マーカーを使って、完全に一致する単語だけ +を探します。(単語の一部として検索したい時は "g*" と "g#" コマンドを使います) + + +検索結果の強調表示 +------------------ + +プログラムの編集中に、"nr" という変数を見つけ、その変数がどこで使われているか +を知りたいとします。"nr" の上にカーソルを移動して、"*" と "n" コマンドで片っ端 +から探すのもいいですが、他にも方法があります。次のコマンドを入力してください。 > + + :set hlsearch + +"nr" を検索すると、ヒットした全てのパターンが強調表示されます。これなら余計な +コマンド入力が必要ないので、変数の使用箇所を確認したいときには便利です。 +このオプションは次のコマンドでオフにできます。 > + + :set nohlsearch + +さて上のやり方では、検索を行うたびに、いちいちオプションの切替えが必要になりま +す。単に強調表示を止めるだけなら、次のコマンドを使ってください。 > + + :nohlsearch + +これならオプションはオフになりません。強調表示だけを取り消せます。次に検索コマ +ンドを実行すると、再び強調表示されます。"n" や "N" を使ったときも同様です。 + + +検索のチューニング +------------------ + +検索の挙動を変更するオプションがいくつかあります。重要なのは次のものです: > + + :set incsearch + +これはいわゆるインクリメンタルサーチです。検索したい文字を入力している間にも +ヒットする文字列を探して画面に表示してくれます。これはヒットするパターンがある +かどうかのチェックに使えます。<Enter>を押すと実際にその場所にカーソルがジャン +プします。 +> + :set nowrapscan + +ファイルの末尾まで進んだら(後方検索の場合はファイルの先頭まで戻ったら)検索を停 +止します。'wrapscan' オプションの初期設定はオンです。オンの場合は、ファイルの +末尾まで進んだら先頭に戻って検索を続けます。 + + +ところで... +----------- + +これまでに出てきたオプションを毎回設定したい場合は、スタートアップファイルにそ +のコマンドを書いてください。 +|not-compatible|の説明のとおりにファイルを編集するか、次のコマンドを入力して、 +ファイルがどこにあるか確認してください。 > + + :scriptnames + +ファイルを編集するには、例えば次のようにします。 > + + :edit ~/.vimrc + +そして、オプションを設定するためにVim上で実行したのと同じコマンドを書き加えま +す。例えば、次のようにします。 > + + Go:set hlsearch<Esc> + +"G" でファイルの末尾まで移動し、"o" で新しい行を挿入して ":set" コマンドを書く +ための空行を作っています。挿入モードの終了は<Esc>です。そして、ファイルを保存 +しましょう。 > + + ZZ + +次にVimを起動すると、'hlsearch' オプションが最初からオンになっています。 + +============================================================================== +*03.9* 簡単なパターン検索 + +Vimでは、検索に正規表現(regular expressions)を使います。 +正規表現というのは検索パターンを指定するための、極めてパワフルでシンプルな方法 +です。残念ながら、これの実力を発揮させるには少々苦労していただくことになりま +す。というのも、正規表現はちょっとばかりトリッキーなんです。 +ここでは本当に基本的なものだけを述べます。パターン検索とコマンドについては +27章|usr_27.txt|でもっと詳しく説明します。完全な説明は|pattern|にあります。 + + +行頭と行末 +---------- + +"^" は行頭を示します。英語(ASCII)キーボードでは 6 のキーに、日本語(JIS)キーボー +ドでは 0 のキーの 2 つ右側に刻印してあります。 +例えば、"include" というパターンは 行のどこかに include という単語を含んでいれ +ば、ヒットします。一方、"^include" は行頭にある include にだけマッチします。 +"$" は同様に行末にヒットします。ですから、パターン "was$" は、行末が was で終 +わっている場合だけヒットします。 + +下の例では、"the" にマッチする箇所を "xxx" で示しています。 + + the solder holding one of the chips melted and the ~ + xxx xxx xxx + +"/the$" の場合は次のようになります。 + + the solder holding one of the chips melted and the ~ + xxx + +"/^the" の場合はこうです。 + + the solder holding one of the chips melted and the ~ + xxx + +"/^the$" という指定もできます。この指定だと、"the" という単語だけの行にヒット +します。なお空白文字も意味を持ちます。ですから、"the " のように行末に空白文 +字を含んでいた場合は、"/the$" のパターンではヒットしません。 + + +任意の 1 文字 +------------- + +"." はあらゆる文字にヒットします。例えば、"c.m" は最初が "c" で始まり、2 文字 +目は何でも良くて、3 文字目が "m" であるパターンにヒットします。例を示します。 + + We use a computer that became the cummin winter. ~ + xxx xxx xxx + + +特殊文字 +-------- + +例えば "." という文字自体を探す時は、上で述べたような特殊な意味を "\" 文字を +使って無効にします。 +"ter." というパターンで検索をすると、次の "xxx" の箇所でヒットします。 + + We use a computer that became the cummin winter. ~ + xxxx xxxx + +これを "ter\." で検索すると、上図の 2 つ目だけがヒットします。 + +============================================================================== +*03.10* マークの使用 + +"G" コマンドでジャンプすると、その直前のカーソル位置が記録されます。これをマー +クと呼びます。元の場所に戻るには、次のコマンドを使います。 > + + `` + +この ` は backtick とか open single-quote と呼ばれる(日本では「バッククォート」 +が多いでしょうか)ものです。 +このコマンドを 2 回実行すると、元の場所に戻ります。これは ` コマンドもジャンプ +コマンドなので、実行前の場所が記録されるためです。 + +通常、現在行以外にカーソルが動くようなコマンドを実行した場合、それをジャンプ +と呼びます。"/" や "n" もジャンプの一種です(ジャンプ先がどれだけ離れているかは +関係ありません)。逆に、文字検索である "fx" や "tx"、単語移動である "w" や "e" +はジャンプではありません。 +"j" や "k" はカウンタを指定すればカーソルをはるか彼方に移動できますが、これも +ジャンプ扱いではありません。 + +``コマンドは 2 個所の間を交互にジャンプします。CTRL-Oコマンドはより古いマーク +(O は Older の意味です)にジャンプします。CTRL-Iはより新しいマーク("I" キーは +"O" キーのすぐ左隣りです)にジャンプします。次のコマンドを例にしましょう。 > + + 33G + /^The + CTRL-O + +まず33行目にジャンプします。次に "The" で始まる行を探します。ここでCTRL-Oを使 +うと、33行目に戻ります。もう一度CTRL-Oを使うと、最初の場所に戻ります。そして、 +CTRL-Iを使うと33行目にジャンプし、さらにCTRL-Iを使うと行頭が "The" で始まる行 +にジャンプします。 + + | example text ^ | + 33G | example text | CTRL-O | CTRL-I + | example text | | + V line 33 text ^ V + | example text | | + /^The | example text | CTRL-O | CTRL-I + V There you are | V + example text + + Note: + CTRL-Iは<Tab>キーと同じです。 + +":jumps" コマンドで今までにジャンプした場所の一覧を表示できます。最後に使った +エントリには ">" 記号がついています。 + + +名前付きマーク *bookmark* +-------------- + +文章中にマークを付けることができます。"ma" コマンドで現在のカーソル位置をマー +ク a に記録します。文章には 26 個 (aからzまで) のマークを付けられます。マーク +はVim が記録している位置情報です。画面に何かが表示されるわけではありません。 +マークへの移動は `{mark} コマンドを使います。{mark}はマーク文字のことです。 +マーク a に移動するには次のようにします。 +> + `a +< +'{mark}(アポストロフィ + マーク名)コマンドで{mark}を設定してある行の行頭に移動 +できます。`{mark}の場合は{mark}を設定した桁位置に移動します。 + +マーク機能はファイル中の関連している 2 箇所で作業をする場合に便利です。例えば、 +ファイルの最後の方を編集している時に、ファイルの最初の方の内容を確認する必要が +生じた場合を考えてみましょう。 +まずファイルの最初の方に移動して、マーク s (startのつもり) を付けます。 > + + ms + +次に編集したい場所に移動して、マーク e (endのつもり) を付けます。 > + + me + +これで自由に行き来ができます。ファイルの先頭に移動したい時は、次のコマンドで +ジャンプできます。 > + + 's + +ここで、'' を使って戻ることもできますし、'e を使って末尾のマークまでジャンプす +ることもできます。 +先頭にマーク s を、末尾にマーク e を使いましたが、その名前に特別な意味はありま +せん。単に覚えやすいから使っただけです。 + +次のコマンドは設定してあるマークの一覧を表示します。 > + + :marks + +この一覧には次のような特殊なマークも表示されます。 + + ' ジャンプする直前のカーソル位置 + " 直前にファイルを編集した時のカーソル位置 + [ 直前の変更の開始位置 + ] 直前の変更の終了位置 + +============================================================================== + +次章: |usr_04.txt| 簡単な編集 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_04.jax b/plugins/vimdoc-ja/doc/usr_04.jax new file mode 100644 index 0000000000..3d4f62fb98 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_04.jax @@ -0,0 +1,506 @@ +*usr_04.txt* For Vim バージョン 8.0. Last change: 2014 Aug 29 + + VIM USER MANUAL - by Bram Moolenaar + + 簡単な編集 + + +本章では、テキストの修正方法や他の場所への移動方法をいくつか説明します。テキス +トを変更するための三つの基本操作方法 (オペレータとモーション、ビジュアルモー +ド、テキストオブジェクト) についても説明します。 + +|04.1| オペレータとモーション +|04.2| テキストの変更 +|04.3| 変更の繰り返し +|04.4| ビジュアルモード +|04.5| テキストの移動 +|04.6| テキストのコピー +|04.7| クリップボード +|04.8| テキストオブジェクト +|04.9| 置換モード +|04.10| 終わりに + +次章: |usr_05.txt| 設定の変更 +前章: |usr_03.txt| カーソルの移動 +目次: |usr_toc.txt| + +============================================================================== +*04.1* オペレータとモーション + +二章で学んだように、"x" は 1 文字削除するコマンドです。カウンタを使って、"4x" +とすれば 4 文字削除されます。 +"dw" コマンドで単語を削除できます。"w" が単語単位で移動するコマンドであること +を思い出してください。"d" コマンドにモーション (移動) コマンドを続けることで、 +現在の場所から、モーションコマンドで移動した場所までを削除できます。 +例えば、"4w" コマンドはカーソルを 4 単語分、動かします。ということは、"d4w" は +4 つの単語を削除するコマンドなわけです。 + + To err is human. To really foul up you need a computer. ~ + ------------------> + d4w + + To err is human. you need a computer. ~ + +モーションコマンドでカーソルが移動した場所までが削除されます。移動先の単語の先 +頭文字が削除されないのは、そのほうが便利だからです。しかし、"e" コマンドで単語 +の末尾まで移動した場合は、末尾の文字も削除したほうが便利ですよね: + + To err is human. you need a computer. ~ + --------> + d2e + + To err is human. a computer. ~ + +カーソル下の文字が範囲に含まれるかどうかは、移動に使ったコマンドによって異なり +ます。リファレンスマニュアルでは、移動先の文字が含まれないことを "exclusive" +(排他的)、含まれることを "inclusive" (包括的) と呼んでいます。 + +"$" コマンドで行末まで移動できます。"d$" コマンドならカーソル位置から行末まで +が削除されます。これは包括的モーションなので行末の文字は削除処理の対象となりま +す。 + + To err is human. a computer. ~ + ------------> + d$ + + To err is human ~ + +オペレータとモーションを組み合わせるときは、最初にオペレータコマンドを入力しま +す。例えば、"d" は削除オペレータです。次に "4l" や "w" といったモーションコマ +ンドを入力します。この方法ならテキストのどんな範囲でも操作できます。 + +============================================================================== +*04.2* テキストの変更 + +"c" は「変更」オペレータです。"d" オペレータと同じように使えますが、挿入モード +に入る点が違います。例えば、"cw" は単語を変更します。正確に言うと、単語を削除 +してから挿入モードに入ります。 + + To err is human ~ + -------> + c2wbe<Esc> + + To be human ~ + +"c2wbe<Esc>" は次の部分から成ります: + + c 変更オペレータ + 2w 2 単語進む (単語が削除され、挿入モードに入る) + be この文字列を挿入する + <Esc> ノーマルモードに戻る + +勘のいい人なら、ちょっと変だと感じるかも知れません。"human" の前の空白が削除さ +れていないのです。"どんな問題に関しても単純で、明解で、間違った答えがある" と +いう格言があります。この "cw" コマンドを使った例がまさにそれです。"c" オペレー +タは "d" オペレータと全く同じように使えますが、"cw" はその例外なのです。実際に +はこれは "ce" と同じく、単語末までを変更します。ですから、単語の後ろの空白は含 +まれないのです。これはかつての Vi までさかのぼる例外です。多くの人々がこれを +使っているので、Vim でも不本意ながら残してあるのです。 + + +その他の変更コマンド +-------------------- + +"dd" で行が削除できるのと同じように、"cc" で行全体を変更できます。ただし、イン +デント(行頭の空白類)は残されます。 + +"d$" で行末まで削除できるのと同じように、"c$" で行末まで変更できます。この機能 +は "d$" で行末まで削除してから "a" で挿入モードに入り、文を追加するのと同じで +す。 + + +ショートカット +-------------- + +いくつかのオペレータとモーションの組合せは頻繁に使われるため、1 文字コマンドと +して用意されています。 + + x は dl (カーソル下の文字を削除) + X は dh (カーソルの左側の文字を削除) + D は d$ (行末まで削除) + C は c$ (行末まで変更) + s は cl (1文字変更) + S は cc (1行変更) + + +カウンタの使い方 +---------------- + +"3dw" も "d3w" も 3 つの単語を削除するコマンドです。細かいことが気になる方のた +めに補足しておくと、最初の例(3dw)は 1 単語削除を 3 回実行し、2 つ目の例(d3w)は +3 単語の削除を 1 度だけ実行します。2 つの違いは区別できません。カウンタを 2 個 +所で指定することもできます。例えば、"3d2w" は 2 単語の削除を 3 回繰り返し、結 +果として 6 単語が削除されます。 + + +1 文字の置き換え +---------------- + +"r" コマンドはオペレータではありません。文字が入力されるまで待機し、入力された +文字で、カーソル下の文字を置き換えます。"cl" や "s" でも同じ事ができますが、 +"r" の場合は最後に <Esc> を押す必要がありません。 + + there is somerhing grong here ~ + rT rt rw + + There is something wrong here ~ + +"r" にカウンタを指定すると、指定した数の文字がすべて、同じ文字に置き換えられま +す。 + + There is something wrong here ~ + 5rx + + There is something xxxxx here ~ + +文字を改行に置き換えたい場合は "r<Enter>" を使います。1 文字削除され、改行が挿 +入されます。ただし、改行に対してカウンタは適用されません。削除する文字にのみ適 +用されます。"4r<Enter>" は 4 文字削除し、1 つの改行を挿入します。 + +============================================================================== +*04.3* 変更の繰り返し + +"." コマンドはもっともシンプルでパワフルなコマンドの一つです。これは直前の変更 +コマンドを繰り返します。例えば、HTMLファイルの編集中に、全ての<B>タグを削除す +るとしましょう。カーソルを最初の "<" に移動し、"df>" コマンドで<B>を削除しま +す。次に</B>の "<" を探し、それを削除するのに "." コマンドを使います。"." コマ +ンドは直前の変更コマンド(この場合なら "df>")を実行します。他のタグの削除したけ +れば、カーソルを "<" の上に置いて、"." を打てばよいのです。 + + To <B>generate</B> a table of <B>contents ~ + f< 最初の < を検索 ---> + df> > まで削除 --> + f< 次の < を検索 ---------> + . df> を繰り返し ---> + f< 次の < を検索 -------------> + . df> を繰り返し --> + +"." コマンドではすべての変更を繰り返すことができますが、"u" (undo)、CTRL-R +(redo)、先頭が ":" のコマンド、は繰り返せません。 + +例2: 文中に何度も出てくる単語 "four" を "five" に変更したいとします。次の手順 + で変更できます。 + + /four<Enter> 最初の "four" を探す。 + cwfive<Esc> その単語を "five" に変更する。 + n 次の "four" を探す + . 直前の "five" への変更を繰り返す。 + n 次の "four" を探す + . 直前の変更を繰り返す。 + 以下繰り返し。 + +============================================================================== +*04.4* ビジュアルモード + +単純なものならオペレータ-モーション方式で簡単に変更できますが、変更する範囲に +適したコマンドを選択するのが難しいこともあります。そんなときはビジュアルモード +を使ってください。 + +ビジュアルモードに入るには "v" を押します。そしてカーソルを動かして変更したい +領域を選択します。選択中はその領域が強調表示されます。最後にオペレータコマンド +を入力します。 +例えば、単語の途中から次の単語の途中までを削除するには、次のようにします。 + + This is an examination sample of visual mode ~ + ----------> + velllld + + This is an example of visual mode ~ + +この方法なら、"l" を何回押せば目的の場所まで移動できるか? などと考える必要が +全くありません。削除する範囲を確認してから "d" を押すことができます。 + +選択した範囲を変更したくなくなった場合は <Esc> キーを押してください。ビジュア +ルモードが終了し、何も変更されません。 + + +行選択 +------ + +行全体を選択するには "V" コマンドでビジュアルモードを開始します。行全体が選択 +されます。左右に移動しても選択範囲は変更されません。上下に移動すると、選択範囲 +が行単位で拡張されます。 +例えば、"Vjj" で 3 行を選択してみましょう。 + + +------------------------+ + | text more text | + >> | more text more text | | + 選択された行 >> | text text text | | Vjj + >> | text more | V + | more text more | + +------------------------+ + + +ブロック選択 +------------ + +四角いブロック (矩形、くけい) の範囲を変更したい場合は CTRL-V でビジュアルモー +ドを開始します。このモードは表を編集するような場合に非常に便利です。 + + name Q1 Q2 Q3 + pierre 123 455 234 + john 0 90 39 + steve 392 63 334 + +例えば、中央の Q2 の列を削除するには、カーソルを "Q2" の "Q" に移動します。 +CTRL-V を押し、矩形ビジュアルモードに入ります。次にカーソルを "3j" で 3 行下に +動かし、"w" を押して 1 単語分右に移動します。この状態では、最後の列の先頭が範 +囲に含まれているので、"h" でそれをはずします。"d" を押すと、選択範囲が削除され +ます。 + + +反対側に移動 +------------ + +ビジュアルモードで選択中に、選択範囲の反対側(始点)にカーソルを動かしたいとき +は、"o" を押します (o は "other end" の意味です)。カーソルは始点に動き、始点 +を自由に変更できるようになります。もう一度 "o" を押すと、元の終点側に戻ります。 + +矩形選択のときは 4 隅が存在します。"o" は始点と終点を斜めに動くだけです。同じ +行の反対側に移動するには "O" を使ってください。 + +Note: ビジュアルモードの "o" と "O" はノーマルモードのコマンドとはまったく違う +動作なので注意してください。ノーマルモードではカーソル行の上や下に空行を作る機 +能です。 + +============================================================================== +*04.5* テキストの移動 + +"d" や "x" などのコマンドで何かを削除すると、そのテキストは記録されます。"p" +コマンドを使うと、そのテキストをペースト (貼り付け。Vimではこれをプットと呼び +ます) できます。 +どのように動くかを見てみましょう。まず、削除したい行にカーソルを移動し、"dd" +コマンドでその行を削除します。次に、プットしたい場所にカーソルを動かして "p" +を押します。先ほど削除した行がカーソルの下に挿入されます。 + + 最初 削除後 プット後 + a line a line a line + line 2 dd line 3 p line 3 + line 3 line 2 + +行全体を削除したので、"p" コマンドにより行が挿入されました。行の一部 (単語な +ど) を削除した場合は、"p" コマンドはカーソルの直後にそれがプットされます。 + + Some more boring try text to out commands. ~ + ----> + dw + + Some more boring text to out commands. ~ + -------> + welp + + Some more boring text to try out commands. ~ + + + +その他のプット +-------------- + +"P" コマンドは "p" と同じですが、カーソルの前にプットします。直前に "dd" コマ +ンドで行を削除したなら、カーソルの上にその行がプットされます。"dw" で単語を削 +除した場合は、カーソルの直前にプットされます。 + +プットは何回でも好きなだけ繰り返せます。同じ文が毎回使われます。 + +"p" も "P" もカウンタを指定できます。指定しただけ、プット処理が繰り返されます。 +例えば、"dd" の後に "3p" を実行すると、削除した行のコピーが 3 つプットされま +す。 + + +2文字の入れ換え +--------------- + +入力しているときに、指が頭を追い越してしまうことがしばしばあります。その結果、 +"the" を "teh" とタイポ (打ち間違い) したりすることがあります。Vim ではこの種 +の間違いを簡単に修正できます。カーソルを "teh" の "e" の上に置いて、"xp" と打 +てばよいのです。"x" で "e" の文字を削除してレジスタに入れ、"p" で ("h" の上に +ある) カーソル の後ろにレジスタ内容をプットするのです。 + + teh th the ~ + x p + +============================================================================== +*04.6* テキストのコピー + +テキストを別の場所にコピーするには、それを削除して、"u" で削除を取り消し、他の +場所で "p" を使いプットすることもできますが、ヤンク (yank) を使えばもっと簡単 +です。"y" オペレータで文字列をレジスタにコピーできます。その文字列は "p" コマ +ンドでプットできます。 +コピーのことを Vim ではヤンクと呼びます。文字 "c" は既に変更オペレータのために +使われていたので "y" を使うことになったわけですが、"y" キーを覚えやすくするた +めにコピー操作をヤンク (yank) と読んでいます。 + +"y" はオペレータなので、"yw" とすれば単語をヤンクできます。カウンタも当然指定 +できます。2 単語をヤンクするには、"y2w" とします。例を示しましょう。 + + let sqr = LongVariable * ~ + --------------> + y2w + + let sqr = LongVariable * ~ + p + + let sqr = LongVariable * LongVariable ~ + +"yw" は単語の後の空白まで含まれるので注意してください。それが嫌なら、"ye" を +使ってください。 + +"yy" コマンドは "dd" が行削除するのと同様に、行全体をヤンクします。ただ、"D" +が行末まで削除するのに対して、"Y" は "yy" と同じ動きになります。この点は気をつ +けてください。行末までヤンクしたい時には "y$" を使ってください。 + + a text line yy a text line a text line + line 2 line 2 p line 2 + last line last line a text line + last line + +============================================================================== +*04.7* クリップボード + +GUI版の Vim (gvim) を使っている場合は、[編集] メニューに [コピー] コマンドがあ +ります。ビジュアルモードで文字列を選択してから、メニューの [編集]-[コピー] を +使ってください。選択文字列がクリップボードにコピーされるので、それを他のプログ +ラムにペーストできます。もちろん Vim 自身でも使えます。 + +他のアプリケーションでクリップボードに文字列をコピーすれば、Vim の [編集]-[貼 +り付け] メニューでそれをペーストできます。これはノーマルモードでも挿入モードで +も機能します。ビジュアルモードでは、選択文字列がペーストされた文字列に置換され +ます。 + +メニューの [編集]-[切り取り] はクリップボードにプットする前に文字列が削除され +ます。[コピー]、[切り取り]、[貼り付け] の 3 つはポップアップメニューでも使えま +す (ポップアップメニューが利用可能な場合のみ)。ツールバーが利用可能なら、そこ +にも同じ項目があるはずです。 + +GUI を使っていない場合やメニューを使いたくない場合は他の方法を使うしかありませ +ん。普通の "y" や "p" コマンドを使う前に "* (ダブルクォート + アスタリスク)を +指定するのです。行を丸ごとクリップボードにコピーするには次のようにします: > + + "*yy + +クリップボードからプットするにはこうします: > + + "*p + +この機能はクリップボードをサポートした Vim でのみ動きます。クリップボードにつ +いての詳細は|09.3|章 と |clipboard|をご覧ください。 + +============================================================================== +*04.8* テキストオブジェクト + +単語の真ん中にカーソルがある場合、その単語を削除するには "dw" を実行する前に +カーソルを単語の先頭に戻す必要があります。"daw" を使うともっと簡単です。 + + this is some example text. ~ + daw + + this is some text. ~ + +"daw" の "d" は削除オペレータです。"aw" はテキストオブジェクトです。"aw" は "A +Word" の意味です。つまり "daw" は "Delete A Word" という意味になります。正確に +は、単語の後の空白も削除されます (単語が行末にある場合は、行末までのすべての空 +白が削除されます)。 + +テキストオブジェクトは基本操作方法の一つです。オペレータ-モーション方式とビジュ +アルモードは既に述べました。そこにオペレータ + テキストオブジェクト方式が加わ +ります。 +これはオペレータ-モーション方式と非常に似ていますが、オペレータ-モーション方式 +では移動コマンドの前と後のカーソル位置がオペレータの範囲となっていたのに対し、 +テキストオブジェクトではオブジェクト全体を対象とします。オブジェクトのどこに +カーソルがあっても構いません。 + +文全体を変更するのは "cis" です。次の文を使いましょう: + + Hello there. This ~ + is an example. Just ~ + some text. ~ + +2 行目の先頭、"is an" の上に移動し、"cis" を実行してください: + + Hello there. Just ~ + some text. ~ + +カーソルは 1 行目の空白の間にあります。ここで新たな文 "Another line." を入力し +ます: + + Hello there. Another line. Just ~ + some text. ~ + +"cis" は変更オペレータの "c" とテキストオブジェクトの "is" から成ります。"is" +は "Inner Sentence" の意味です。"as" (a sentence) オブジェクトというのもありま +す。"as" は文の後の空白を含みますが、"is" は含みません。文を削除するときに、前 +後の空白も同時に消したい場合は "das" を使います。文を修正するため、空白を残し +ておきたい場合は "cis" を使えばよいでしょう。 + +テキストオブジェクトはビジュアルモードでも使えます。テキストオブジェクトを選択 +範囲に含めることができます。テキストオブジェクトを指定してもビジュアルモードは +終了しないので、何度でもテキストオブジェクトを使えます。例えば、"v" でビジュア +ルモードを開始して、"as" で文を選択した後に、"as" を繰り返してたくさんの文を追 +加できます。最後にオペレータを使って、選択した文を対象として、何らかの処理を行 +います。 + +テキストオブジェクトの機能一覧は |text-objects| を参照してください。 + +============================================================================== +*04.9* 置換モード + +"R" コマンドを使うと置換モードに入ります。このモードでは、入力した文字が、カー +ソル下の文字を置き換えます。このモードは <Esc> を押すまで続きます。 +例えば、"text" の 1 つ目の "t" で置換モードを開始したとします: + + This is text. ~ + Rinteresting.<Esc> + + This is interesting. ~ + +末尾の 5 文字が 12 文字の他の文字に置き換えられています。"R" コマンドは置換す +る文字がなくなると自動的に行末をずらします。次の行へ移動したりはしません。 + +<Insert> キーで挿入モードと置換モードを切り換えることができます。 + +<BS> キーで修正をしようとすると、元の文字が復元されます。直前に打った文字を +undo するような働きをします。 + +============================================================================== +*04.10* 終わりに + +オペレータ、移動コマンド、テキストオブジェクトを組み合せると、とてつもない数 +のコンビネーションを生み出すことができます。N 個のオペレータと M 個の移動コマ +ンドを組み合わせれば N * M 個のコマンドが作れるのです! + +オペレータの一覧は |operator| を参照してください。 + +テキストの一部を削除するには数多くの方法があります。ほんの一部ですが、よく使 +うものを挙げておきましょう。 + +x カーソル位置の文字を削除 ("dl" と同じ) +X カーソル位置の直前の文字を削除 ("dh" と同じ) +D カーソル位置から行末までを削除 ("d$" と同じ) +dw カーソル位置から次の単語の先頭までを削除 +db カーソル位置から直前の単語の先頭までを削除 +diw カーソル位置の単語を削除 (文の後の空白は除く) +daw カーソル位置の単語を削除 (文の後の空白を含む) +dG ファイルの末尾まで削除 +dgg ファイルの先頭まで削除 + +"d" の代わりに "c" を使うと削除ではなく、変更コマンドになります。"y" にすれ +ばヤンクコマンドです。他のオペレータも同様です。 + + +他の章では特に説明されない雑多な変更コマンドをいくつか挙げておきます: + + ~ カーソル位置の大文字/小文字を変更し、カーソルを次に進めます。 + これは('tildeop' がオフの場合は)オペレータではありません。つま + りモーションコマンドと組み合わせることができません。ビジュアル + モードで使うと選択範囲のテキスト全体が変更されます。 + + I (大文字の "i" です) カーソルを行の最初の非空白文字に移動して + 挿入モードを開始します。 + + A 行末にカーソルを動かして、挿入モードを開始します。 + +============================================================================== + +次章: |usr_05.txt| 設定の変更 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_05.jax b/plugins/vimdoc-ja/doc/usr_05.jax new file mode 100644 index 0000000000..dcec003894 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_05.jax @@ -0,0 +1,674 @@ +*usr_05.txt* For Vim バージョン 8.0. Last change: 2016 Mar 28 + + VIM USER MANUAL - by Bram Moolenaar + + 設定の変更 + + +あなたの望みどおりに Vim をチューニングできます。本章では、好みの設定で Vim を +起動する方法を説明します。Vim にプラグインを追加して機能拡張したり、自分でマク +ロを定義する方法も説明します。 + +|05.1| vimrc ファイル +|05.2| 見本 vimrc ファイルの解説 +|05.3| 簡単なマップ +|05.4| パッケージの追加 +|05.5| プラグインの追加 +|05.6| ヘルプファイルの追加 +|05.7| オプションウィンドウ +|05.8| よく使うオプション + +次章: |usr_06.txt| 構文強調表示 +前章: |usr_04.txt| 簡単な編集 +目次: |usr_toc.txt| + +============================================================================== +*05.1* vimrc ファイル *vimrc-intro* + +よく使うコマンドを入力するのが面倒に感じたことがあるでしょう。好みのオプション +やマップを設定した状態で Vim を起動するには、vimrc というファイルに設定を書い +てください。そのファイルに書いたコマンドは、Vim が起動するときに実行されます。 + +すでに vimrc ファイルがある場合 (例えばシステム管理者が設置した場合など) は、 +次のコマンドでそのファイルを開くことができます: > + + :edit $MYVIMRC + +vimrc ファイルがまだない場合は |vimrc| を参照して vimrc ファイルを作成する場所 +を確認してください。":version" コマンドで表示される "ユーザー vimrc" の表示を +見て確認することもできます。 + +Unix と Macintosh ではこのファイルを使ってください。 + + ~/.vimrc ~ + +MS-DOS と MS-Windows では次のどちらかです。 + + $HOME/_vimrc ~ + $VIM/_vimrc ~ + +vimrc ファイルには、コロン (:) を押してから入力するコマンドなら、どのコマンド +でも書くことができます。一番わかりやすいのはオプション設定です。例えば、毎回 +'incsearch' オプションをオンに設定したい場合は、vimrc ファイルに次の一行を加え +ます。 > + + set incsearch + +この新しい行を有効にするには、Vim を終了し、再起動する必要があります。再起動し +ないで設定を反映する方法は後で説明します。 + +この章では、ごく基本的な項目だけを説明します。Vim script のより詳しい情報につ +いては |usr_41.txt| を参照してください。 + +============================================================================== +*05.2* 見本 vimrc ファイルの解説 *vimrc_example.vim* + +第一章では、Vim の配布物に付属の見本 vimrc ファイルを使って、非互換モード +(|not-compatible|参照) で Vim を起動する方法を説明しました。見本 vimrc ファイ +ルは次のディレクトリにあります: + + $VIMRUNTIME/vimrc_example.vim ~ + +この節では、このファイルで使われているコマンドを説明します。自分用の設定をする +ときの参考にしてください。しかし、全てを説明するわけではないので、詳しいことは +":help" コマンドで調べてください。 + +> + set nocompatible + +第一章で述べたように、このマニュアルでは「Vim」について説明しているので、Vi と +は完全に互換性がない部分があります。ここに書かれたように動作させるには、 +'compatible' オプションをオフに設定する、すなわち 'nocompatible' にする必要が +あります。 + +> + set backspace=indent,eol,start +< +挿入モードで <BS> を使って削除できる文字を指定しています。コンマで区切られた三 +つの部分はそれぞれ次の文字の削除を許可しています。 + indent 行頭の空白 + eol 改行 + start 挿入モード開始位置より手前の文字 +> + + set autoindent + +新しい行を作成したときに、直前の行と同じだけインデントされるようになります。つ +まり、新しい行の行頭に直前の行と同じだけの空白が挿入されます。例えば、挿入モー +ドで <Enter> キーを押したときや、"o" コマンドで新しい行を作成したときに機能し +ます。 +> + + if has("vms") + set nobackup + else + set backup + endif + +ファイルを上書きしたときに、バックアップファイルを削除しないように指定していま +す。ただし VMS システムでは OS が古いバージョンを保持してくれるので、オフにし +ています。バックアップファイルのファイル名はオリジナルの名前に "~" を加えたも +のになります。|07.4|を参照してください。 +> + + set history=50 + +コマンドを50個分、検索パターンを50個分、ヒストリ(履歴)として残します。記録の容 +量を増減したいときはこの値を変更してください。 +> + + set ruler + +現在のカーソル位置(行、桁)を Vim ウィンドウの右下に常に表示します。 + +> + set showcmd + +入力途中の (まだ実行していない) コマンドを Vim ウィンドウの右下 (rulerの左側) +に表示します。例えば、"2f" と入力したとき、Vim は検索文字の入力を待っていて、 +画面の右下には "2f" と表示されます。次に "w" と入力すると、"2fw" というコマン +ドが完成するので、それが実行され、画面の "2f" という表示も消去されます。 + + +-------------------------------------------------+ + |text in the Vim window | + |~ | + |~ | + |-- VISUAL -- 2f 43,8 17% | + +-------------------------------------------------+ + ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^ + 'showmode' 'showcmd' 'ruler' + +> + set incsearch + +検索パターンを入力中に、入力途中のパターンにマッチする文字列を表示します。 + +> + map Q gq + +キーマップを定義しています。詳しくは次の節で述べます。ここでは、"gq" オペレー +タのフォーマット機能を "Q" コマンドとして定義しています。"Q" の動作が Vim 4.0 +以前と同じになります。実際の "Q" は EX モードへの移行コマンドですが、おそらく +必要ないでしょう。 + +> + vnoremap _g y:exe "grep /" . escape(@", '\\/') . "/ *.c *.h"<CR> + +このマップは、選択されたテキストをヤンクして、それを C ファイルの中から検索し +ます。これは複雑なマップです。マップを使ってとても難しいことができるということ +が分かってもらえたと思います。とはいっても、実際にコマンドを手入力するのと同じ +ように一連のコマンドを実行しているに過ぎません。 + +> + if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch + endif + +カラー表示が使えるかどうかを確認し、構文強調表示を有効にしています。さらに、 +'hlsearch' オプションをオンにして、検索にマッチした箇所が強調表示されるように +しています。特定の条件のときだけオプションを設定したい場合は "if" コマンドが便 +利です。詳しくは、|usr_41.txt|を参照してください。 + + *vimrc-filetype* > + filetype plugin indent on + +三つの便利な機能を有効にしています: +1. ファイルタイプの検出 + ファイルを開いたときに、そのファイルの種類を特定します。例えば、"main.c" を + 開いた場合は、拡張子の ".c" を見てファイルタイプは "c" だと判断します。ファ + イルの一行目が "#!/bin/sh" で始まっていた場合は、ファイルタイプは "sh" だと + 判断します。 + 検出されたファイルタイプは構文強調と次の 2 つの項目で使われます。 + |filetypes|参照。 + +2. ファイルタイププラグインを使う + ファイルを開いたときに、ファイルタイプに応じたオプションが設定されます。例 + えば、"c" ファイルの場合なら自動的にインデントしてくれる 'cindent' オプショ + ンは欠かせないでしょう。こういった、一般的に便利な設定がファイルタイププラ + グインの中に入っています。自分でプラグインを追加することもできます。 + |write-filetype-plugin|参照。 + +3. インデントファイルを使う + プログラミング言語のインデントはほとんど自動的に計算できます。Vim にはファ + イルタイプに応じたインデントルールが数多く用意されています。 + |:filetype-indent-on| と 'indentexpr' 参照。 + +> + autocmd FileType text setlocal textwidth=78 + +行が長くなりすぎないように78文字で分割するように指定しています。このルールはテ +キストファイルにだけ適用されます。この記述には二つの要素があります。"autocmd +FileType text" はオートコマンド定義です。この場合、ファイルタイプが "text" に +設定されたときに、指定したコマンドが自動的に実行されます。"setlocal +textwidth=78" はそのファイルの 'textwidth' オプションを 78 に設定しています。 + + *restore-cursor* > + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + +オートコマンドをもう一つ。ファイルを読み込んだ直後に実行されるオートコマンドを +定義しています。後ろのごちゃごちゃした部分は「'" マークが定義されているかどう +かをチェックし、定義があればそこにジャンプする」という意味です。コマンドを複数 +行に分けて書くために、行頭に "\" を書いています。行がやたらと長くなるのを防ぐ +ためです。|line-continuation|参照。"\" は Vim script 内でのみ使えます。コマン +ドラインで入力するときは使えません。 + +============================================================================== +*05.3* 簡単なマップ + +マップを使うと、複数のコマンドを 1 つのキー繰作にまとめることができます。例え +ば、ある単語を {} で囲みたいとします。つまり、"amount" を "{amount}" にしたい +わけです。:map コマンドを使って、その操作を <F5> キーに割り当てることができま +す。次のように書きます。 > + + :map <F5> i{<Esc>ea}<Esc> +< + Note: + このコマンドを入力するときの注意点。 + <F5> は見たままの 4 文字の文字列として入力してください。<Esc> も同じで + す。<Esc> キーを押すのではなく、5 文字の文字列として入力してください。 + このマニュアルを読むときはその違いに注意してください ! + +この定義を分解してみましょう。 + <F5> ファンクションキーのF5です。このキーを押すと、定義してあるコマ + ンドが実行されます。 + + i{<Esc> "{" 文字を挿入し、<Esc> キーで挿入モードから抜けます。 + + e 単語の末尾に移動します。 + + a}<Esc> "}" 文字を追加します。 + +この ":map" コマンドを実行した後は、カーソルを単語の先頭に動かして F5 キーを押 +すだけで単語の両側に {} を追加できます。 + +この例では、コマンドは 1 キーでしたが、どの文字列でも割り当てることができます。 +ただし、Vim のコマンドと同じ文字列を割り当てると、元のコマンドが使えなくなるの +で、それは避けた方が無難です。 +複数キーを組み合わせるときには、バックスラッシュ(日本語環境では円記号)がよく使 +われます。マップをたくさん定義したい場合は、複数文字を使ってください。例えば、 +単語を () で囲むには "\p" で、単語を {} で囲むには "\c" で、といったことができ +ます。 > + + :map \p i(<Esc>ea)<Esc> + :map \c i{<Esc>ea}<Esc> + +"\" と "p" はくっつけてください。そうすれば Vim は 2 文字のマップだと認識でき +ます。 + +引数なしの ":map" コマンドで現在のマップ定義の一覧を表示できます。表示された +マップは、少なくともノーマルモードで使えます。より詳しくは|40.1|章を参照してく +ださい。 + +============================================================================== +*05.4* パッケージの追加 *add-package* *matchit-install* + +パッケージとはVimに追加するファイルの集合です。パッケージには、任意のタイミン +グで読み込めるるものと、起動時に自動的に読み込まれるものの2種類があります。 + +Vim は、数個の任意に読み込めるパッケージと一緒に配布されています。例えば +matchit プラグインです。このプラグインは "%" コマンドを、HTMLタグやVim script +の if/else/endif やその他のものにマッチするようにします。とても便利なのですが +後方互換性はありません。それがデフォルトでは無効にされている理由です。 + +matchit プラグインを使い始めるには、以下の行をあなたの vimrc ファイルに追加し +てください: > + packadd! matchit + +たったこれだけです。あとは Vim を再起動するだけで、このプラグインについてのヘ +ルプを見つけられます: > + :help matchit + +これが動作するのは `:packadd` でプラグインを読み込む際に、パッケージのディレク +トリを'runtimepath' に追加するためです。それによりヘルプファイルを見つけられる +ようになります。 + +パッケージはインターネットの様々な場所から入手できるでしょう。通常それらは圧縮 +アーカイブかレポジトリの形態を採用しているでしょう。アーカイブであれば以下のよ +うなステップでインストールできます: + 1. パッケージディレクトリを作成する: > + mkdir -p ~/.vim/pack/fancy +< "fancy" はあなたの好きな名前に変更できます。パッケージを表すのに良 + いものを使いましょう。 + 2. そのディレクトリにアーカイブを解凍しましょう。以下はアーカイブ内の + トップディレクトリは "start" であると仮定しています: > + cd ~/.vim/pack/fancy + unzip /tmp/fancy.zip +< アーカイブ展開後のレイアウトが、以下のようなパスになっていなけれ + ば、適宜修正してください: + ~/.vim/pack/fancy/start/fancytext/plugin/fancy.vim ~ + ここの "fancytext" はパッケージ名なので、実際には別の名前になるで + しょう。 + +パッケージについてのより詳しい情報は次の項目を参照してください: |packages| + +============================================================================== +*05.5* プラグインの追加 *add-plugin* *plugin* + +プラグインを追加することで機能拡張できます。プラグインといっても、Vimが起動さ +れたときに自動的に読み込まれるだけの、ただの Vim script ファイルです。ファイル +をプラグインディレクトリにコピーするだけで簡単にプラグインを追加できます。 +{|+eval|が有効な場合のみ利用できます} + +2 種類のプラグインがあります。 + + グローバルプラグイン 全種類のファイルで使われるプラグイン + ファイルタイププラグイン 特定タイプのファイルでのみ使われるプラグイン + +まず、グローバルプラグインについて説明し、次にファイルタイププラグインの説明 +|add-filetype-plugin|をします。 + + +グローバルプラグイン *standard-plugin* +-------------------- + +Vim を起動すると、自動的にいくつものグローバルプラグインがロードされます。特に +何もしなくて大丈夫です。グローバルプラグインは、ほとんどの人が欲しいと思うだろ +う機能を提供しています。それらの機能は Vim の中にコンパイルして組み込まれてい +るのではなく、Vim script として実装されています。ヘルプの目次にプラグインの一 +覧があります|standard-plugin-list|。|load-plugins|も参照してください。 + + *add-global-plugin* +グローバルプラグインを追加すると、いつでもその機能を使えるようになります。 +グローバルプラグインを追加するのは簡単です。 +1. プラグインを入手する +2. 正しいディレクトリにコピーする + + +グローバルプラグインを入手する +------------------------------ + +プラグインはどこにありますか? +- Vim の配布物にいくつか含まれています。$VIMRUNTIME/macros ディレクトリをご覧 + ください +- インターネットからダウンロードする。たくさんのプラグインが + http://www.vim.org にあります。 +- Vim のメーリングリスト|maillist|に投稿されることもあります。 +- あなたが自作することもできます。プラグインの書き方|write-plugin|をどうぞ。 + +いくつかのプラグインは vimball アーカイブで配布されています。|vimball|参照。 +いくつかのプラグインは自動更新可能です。|getscript|参照。 + + +グローバルプラグインを使う +-------------------------- + +まず、プラグイン自身のドキュメントを読んで、動作条件を確認してください。 +次にそれをプラグインディレクトリにコピーします。 + + system plugin directory ~ + Unix ~/.vim/plugin/ + PC や OS/2 $HOME/vimfiles/plugin or $VIM/vimfiles/plugin + Amiga s:vimfiles/plugin + Macintosh $VIM:vimfiles:plugin + Mac OS X ~/.vim/plugin/ + RISC-OS Choices:vimfiles.plugin + +Unixの場合の例 (プラグインディレクトリがまだない場合) > + + mkdir ~/.vim + mkdir ~/.vim/plugin + cp /tmp/yourplugin.vim ~/.vim/plugin + +これだけです。もうこのプラグインで定義されたコマンドが使えます。 + +plugin/ ディレクトリ以下にファイルを置く代わりに、それらのファイルを plugin/ +ディレクトリ以下のサブディレクトリに置くこともできます。例えば、Perl 用のプラ +グインを "~/.vim/plugin/perl/*.vim" に置いたりできます。 + + +ファイルタイププラグイン *add-filetype-plugin* *ftplugins* +------------------------ + +Vim の配布パッケージにはたくさんのファイルタイププラグインが入っています。 +次のコマンドで利用開始できます。 > + + :filetype plugin on + +これだけです。|vimrc-filetype|も参照してください。 + +使いたいファイルタイププラグインがない場合や、標準より良いものを見つけた場合 +は、追加することもできます。ファイルタイププラグインの追加は次の手順で行いま +す: +1. プラグインを入手する +2. 正しいディレクトリにコピーする + + +ファイルタイププラグインを入手する +---------------------------------- + +ファイルタイププラグインもグローバルプラグインと同じ方法で入手できます。プラグ +インの種類が記載されているのでそれを見て、そのプラグインがグローバルプラグイン +かファイルタイププラグインか確認してください。$VIMRUNTIME/macros に入っている +のはグローバルプラグインです。$VIMRUNTIME/ftplugin に入っているのはファイルタ +イププラグインです。 + + +ファイルタイププラグインを使う *ftplugin-name* +------------------------------ + +ファイルタイププラグインは正しいディレクトリにコピーするだけで追加できます。 +ディレクトリの場所はグローバルプラグインと同じですが、ディレクトリ名の最後の部 +分が "ftplugin" となります。例えば "stuff" ファイルタイプ用のプラグインを Unix +システムに入れるとしましょう。入手したファイルを次のコマンドで ftplugin ディレ +クトリに移します: > + + mv thefile ~/.vim/ftplugin/stuff.vim + +そのファイルがすでにある場合は、既存のプラグインと追加しようとしているプラグイ +ンを同時に使っても問題ないかどうか確認してください。問題がなければ別の名前に変 +えましょう: > + + mv thefile ~/.vim/ftplugin/stuff_too.vim + +アンダースコアはファイルタイプの名前とそれ以外を区切るのに使います。アンダース +コア以降はどんな文字列でも構いません。しかし、"otherstuff.vim" といった名前に +した場合はうまく動きません。そのファイルは "otherstuff" というファイルタイプの +ときにだけロードされます。 + +MS-DOS では長いファイル名が使えません。プラグインを追加するときに、ファイルタ +イプ名が 6 文字以上だと問題が生じます。そういうときはさらにディレクトリを掘っ +てください: > + + mkdir $VIM/vimfiles/ftplugin/fortran + copy thefile $VIM/vimfiles/ftplugin/fortran/too.vim + +ファイルタイププラグインの名前付けルールは次の通りです: > + + ftplugin/<filetype>.vim + ftplugin/<filetype>_<name>.vim + ftplugin/<filetype>/<name>.vim + +"<name>" の部分はどんな文字列でも構いません。 +以下は Unix での "stuff" ファイルタイプの例です: > + + ~/.vim/ftplugin/stuff.vim + ~/.vim/ftplugin/stuff_def.vim + ~/.vim/ftplugin/stuff/header.vim +< +<filetype> の部分はプラグインの対象になっているファイルタイプ名です。同じファ +イルタイプのファイルだけがそのプラグインを使います。<name> の部分は無視されま +す。一つのファイルタイプに複数のプラグインを登録する場合に使ってください。 +Note: ファイルの拡張子は必ず ".vim" にしてください。 + + +詳しくは以下を参照してください: +|filetype-plugins| ファイルタイププラグインについてのドキュメントと、マッ + プで問題が発生した場合の対処方法。 +|load-plugins| 起動時にロードされるグローバルプラグイン。 +|ftplugin-overrule| 標準のファイルタイププラグインの設定を上書きする。 +|write-plugin| プラグインスクリプトの書き方。 +|plugin-details| プラグインの使い方やプラグインが動かない場合について + の詳細な情報。 +|new-filetype| 新しいファイルタイプを追加するには。 + +============================================================================== +*05.6* ヘルプファイルの追加 *add-local-help* + +運が良ければ、プラグインにはヘルプファイルが添付されています。ここでは、ヘルプ +ファイルのインストール方法を説明します。インストールしておけば新しいプラグイン +のヘルプを簡単に調べることができます。 +"doit.vim" プラグインを例にやってみましょう。このプラグインにはヘルプ +"doit.txt" が付属しています。最初にプラグイン本体を適切なディレクトリにコ +ピーしましょう。(ディレクトリがすでにある場合は、"mkdir" コマンドを省 +略してください。) > + + :!mkdir ~/.vim + :!mkdir ~/.vim/plugin + :!cp /tmp/doit.vim ~/.vim/plugin + +"cp" は Unix のコマンドです。MS-DOS では "copy" を使ってください。 + +次に 'runtimepath' のいずれかのディレクトリに "doc" ディレクトリを作ります。 > + + :!mkdir ~/.vim/doc + +"doc" ディレクトリにヘルプファイルをコピーします。 > + + :!cp /tmp/doit.txt ~/.vim/doc + +続いて、新しいヘルプファイルの項目にジャンプできるように仕掛けをします。 +|:helptags|コマンドを使ってタグファイルを生成してください。 > + + :helptags ~/.vim/doc + +さて、これで次のコマンドが使えます。 > + + :help doit + +これは上で追加したヘルプファイルの中から "doit" のヘルプを探すコマンドです。次 +のコマンドでローカルヘルプの目次を見ることができます。 > + + :help local-additions + +ここには、インストールしたローカルヘルプのタイトルが自動的に追加されます。ここ +を見れば、どんなローカルヘルプが追加されているかわかります。ここからタグジャン +プもできます。 + +ローカルヘルプファイルの書き方については|write-local-help|を参照してください。 + +============================================================================== +*05.7* オプションウィンドウ + +何かのオプションを探しているなら、ヘルプファイル |options| から見つけることが +できるでしょう。もう一つ、次のコマンドを使う方法もあります: > + + :options + +新しいウィンドウが開き、一行解説付きのオプションの一覧が表示されます。オプショ +ンは種類別にグループ化されています。カーソルを目次の上に動かして <Enter> を押 +すとそこにジャンプできます。もう一度 <Enter> を押すか、CTRL-O を押すと戻れま +す。 + +その場でオプションの値を設定できます。例えば、"displaying text" グループに移動 +し、カーソルを次の行まで持っていきます: + + set wrap nowrap ~ + +ここで <Enter> を押すと、表示が次のようになります: + + set nowrap wrap ~ + +このオプションはオフになりました。 + +この行の上には 'wrap' オプションの簡単な説明があります。説明のところにカーソル +を動かして、<Enter> を押すと、'wrap' オプションのヘルプにジャンプできます。 + +数値や文字列を引数に取るオプションの場合、値を編集できます。修正後に<Enter> +キーを押すとそれが新しい値として設定されます。例えば、カーソルを次の行まで +('wrap' の少し上に) 動かしてください。 + + set so=0 ~ + +"$" コマンドでカーソルを "0" の上に動かし、"r5" で値を 5 に変更します。<Enter> +を押すと、その値が設定されます。カーソルを動かしてみると、画面の端までカーソル +が達する前にスクロールが始まることに気づくと思います。これは 'scrolloff' オプ +ションのしわざです。ウィンドウの端からのオフセットを設定し、スクロールが開始す +る位置を指定しています。 + +============================================================================== +*05.8* よく使うオプション + +Vim には本当に大量のオプションがあります。ほとんどのオプションは使う機会がない +と思います。ここでは一部のよく使うものだけを説明します。これらのオプションには +より詳しいヘルプがあることをお忘れなく。ヘルプを見るには、":help" に続けてアポ +ストロフィで囲んだオプション名を指定してください: > + + :help 'wrap' + +オプションの値がおかしくなってしまったら、初期設定に戻すことができます。初期設 +定に戻すのにはアンパサンド(&)を使います: > + + :set iskeyword& + + +行の折り曲げの禁止 +------------------ + +長い行は、文の全体が見えるように、画面の右端で折り曲げて表示されます。しかし +ウィンドウの右にはみ出した方が良い場合もあります。その場合は、左右にスクロール +して長い行を表示することになります。次のコマンドで折り曲げしないようになりま +す: > + + :set nowrap + +表示されていない領域にカーソルを動かすと自動的にスクロールされます。10 文字ず +つスクロールするには、次のようにします: > + + :set sidescroll=10 + +これはファイルの内容には影響しません。表示方法を変更するだけです。 + + +折り返して移動するコマンド +-------------------------- + +ほとんどの移動コマンドは行頭と行末で移動を停止します。'whichwrap' オプションで +それを変更できます。次の例では、'whichwrap' を初期設定に設定しています: > + + :set whichwrap=b,s + +ここでは、<BS> キーで行頭から 1 つ上の行の行末へ動くことを許可しています。ま +た、<Space> キーで行末から次の行の行頭への移動することを許可しています。 + +カーソルキーの <Left> と <Right> もこのコマンドで折り返しを許可できます: > + + :set whichwrap=b,s,<,> + +この指定はノーマルモードでのみ有効です。挿入モードでも <Left> と <Right> を許 +可するには次のように指定します: > + + :set whichwrap=b,s,<,>,[,] + +他にもいくつかフラグがあります。詳しくは 'whichwrap' を参照してください。 + + +TAB を表示する +-------------- + +ファイル中に Tab 文字があっても、それを視認することはできません。Tab 文字が表 +示されるようにしましょう: > + + :set list + +Tab 文字が ^I と表示されます。行末には $ と表示され、通常なら気づかないよう +な、行末の空白もよくわかるようになります。 +これの欠点はファイルに Tab 文字がたくさんあると見づらくなる点です。カラー端末 +か GUI を使っている場合は、空白と Tab 文字を別の文字に置き換えて強調表示するこ +とができます。'listchars' オプションを使ってください: > + + :set listchars=tab:>-,trail:- + +Tab 文字は全て ">---" と表示され、行末の空白は "-" と表示されます。この方が +ずっとイイと思いませんか? + + +キーワード +---------- + +'iskeyword' オプションは単語に使える文字を定義しています: > + + :set iskeyword +< iskeyword=@,48-57,_,192-255 ~ + +"@" は「すべてのアルファベット」を表しています。"48-57" は ASCII コード の 48 +から 57 までの文字、つまり "0" から "9" までの数字を表しています。"192-255" は +印字可能なラテン文字です。 +例えば、"upper-case" を1つの単語と扱って欲しい場合は、"-" をキーワードに追加 +します。次のように設定してください: > + + :set iskeyword+=- + :set iskeyword +< iskeyword=@,48-57,_,192-255,- ~ + +新しい設定をみると、"-" の直前に "," が自動的に追加されています。 +キーワードから文字を削除するには "-=" を使います。アンダースコアを削除するには +次のようにします: > + + :set iskeyword-=_ + :set iskeyword +< iskeyword=@,48-57,192-255,- ~ + +"_" を削除すると "," も自動的に削除されました。 + + +メッセージ行 +------------ + +初期設定では、最下段の一行がメッセージの表示に使われます。メッセージが長いとき +は、メッセージを切り詰めて一部だけ表示するか、メッセージをスクロールして表示 +し、最後に <Enter> を押してもらうかのどちらかです。 +メッセージの表示に使う行数は 'cmdheight' オプションで設定できます: > + + :set cmdheight=3 + +編集画面が狭くなってしまうので、ほどほどの値を設定してください。 + +============================================================================== + +次章: |usr_06.txt| 構文強調表示 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_06.jax b/plugins/vimdoc-ja/doc/usr_06.jax new file mode 100644 index 0000000000..ebbdcad488 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_06.jax @@ -0,0 +1,277 @@ +*usr_06.txt* For Vim バージョン 8.0. Last change: 2009 Oct 28 + + VIM USER MANUAL - by Bram Moolenaar + + 構文強調表示 + + +白黒だけのテキストは退屈です。カラー表示すればファイルも生き生き見えてきます。 +これは単に見た目が良いだけではなく、作業のスピードアップにもつながります。意味 +のある文字列は違う色で表示しましょう。そして、画面と同じ色で印刷しましょう。 + +|06.1| 構文強調表示を有効にする +|06.2| 色が付かない?変な色になる? +|06.3| 色を変える +|06.4| カラーを使う?使わない? +|06.5| カラー印刷 +|06.6| 詳しい情報 + +次章: |usr_07.txt| 複数のファイルを開く +前章: |usr_05.txt| 設定の変更 +目次: |usr_toc.txt| + +============================================================================== +*06.1* 構文強調表示を有効にする + +次の簡単なコマンドで全てが始まります。 > + + :syntax enable + +これで、カラー表示になるはずです。ファイルタイプが自動的に特定され、適切な構文 +強調がロードされます。すると、コメントは青、キーワードは茶色、文字列は赤、と +いった具合にカラー表示になります。ファイルが見やすくなりましたね。しばらくする +と、白黒のテキストがあなたの足を引っ張っていたことに気づくでしょう。 + +常に構文強調表示を使いたい場合は、":syntax enable" コマンドを|vimrc|ファイルに +追加してください。 + +カラー端末のときだけ使いたい場合は、次のコマンドを|vimrc|ファイルに追加してく +ださい。 > + if &t_Co > 1 + syntax enable + endif + +GUI バージョンのときだけ使いたい場合は、":syntax enable" を |gvimrc| ファイル +に追加してください。 + +============================================================================== +*06.2* 色が付かない?変な色になる? + +カラー表示がうまくいかない理由はいろいろあります: + +- カラー端末じゃない。 + Vim は、太字やイタリック、下線も使えます。でもそれだけではあまりカッコ + 良くはできません。カラー対応の端末を入手するのがいいでしょう。 + Unixなら、XFree86プロジェクト(|xfree-xterm|)のxtermがお勧めです。 + +- カラー端末であることを Vim が認識できない。 + $TERM の設定が正しいかどうかを確認してください。例えば、カラー対応の + xterm なら次のように設定します: > + + setenv TERM xterm-color +< + シェルによってはこうかもしれません: > + + TERM=xterm-color; export TERM + +< 端末名と実際に使っている端末名は同じでないといけません。それでも + うまく動かない場合は、|xterm-color|を参照してください。この文書には + Vim をカラー表示にする方法がいくつか書いてあります。(xtermに限った文書 + ではありません) + +- ファイルタイプが識別できなかった。 + いくら Vim でも古今東西のファイルタイプをすべて知っているわけではあり + ません。ファイルがどの言語で書かれているかを特定するのが困難な場合もあ + ります。このコマンドを使ってみてください。 > + + :set filetype +< + この結果が "filetype=" ならば、ファイルタイプが認識できなかったという + ことです。手動でファイルタイプを指定することもできます。 > + + :set filetype=fortran + +< どんなタイプが使えるかは、$VIMRUNTIME/syntax のディレクトリを見て + ください。GUI なら、[シンタックス]メニューも使えます。 + ファイルタイプの設定はモード行(|modeline|)でもできます。モード行で指定 + すれば、そのファイルを開いたときにカラー表示が必ず設定されます。例え + ば、Makefile なら次のように書きます。(ファイルの最初か最後に近い場所に + 書いてください): > + + # vim: syntax=make + +< あなたはファイルタイプの判定方法を知っているかもしれませんね。ほとんど + のファイルは拡張子を見ればファイルタイプがわかります。 + ファイルタイプを検出して設定する方法については|new-filetype|を参照して + ください。 + +- ファイルタイプ用の構文定義がない。 + 似ているファイルタイプを手動で設定して使ってみてください。それでも不満 + な場合は、自分で構文定義ファイルを書くこともできます。詳しくは + |mysyntaxfile|を参照してください。 + + +色がおかしい場合: + +- 色付きの文字が非常に読みづらい + Vim は使われている背景色を推測します。黒 (もしくは同様の暗色) なら、明 + るい色で文字を表示します。白 (もしくは同様の明るい色) なら、暗い色で文 + 字を表示します。Vim の予想がはずれると、文字は読みづらくなります。 + これは 'background' オプションを設定することで解決できます。暗い背景色 + を使っている場合は、次のように設定してください: > + + :set background=dark + +< 明るい背景色なら次のように設定してください: > + + :set background=light + +< このコマンドは ":syntax enable" より *前* に実行してください。色が設 + 定された後では意味がありません。後から 'background' を設定した場合は、 + ":syntax reset" を実行すると、標準色に戻すことができます。 + +- 上に向ってスクロールしたときに色が間違っている + 構文解析は、ファイル全体を読んでるわけではありません。画面に表示されて + いるところから、解析は始まります。これだと時間を大幅に節約できるのです + が、時には色を間違ってしまいます。直すには単に CTRL-L を押してくださ + い。あるいは、少し多めに上スクロールしてから戻ると直ります。 + 根本的に解決するには、|:syn-sync|を参照してください。一部の構文ファイ + ルは、ずっと上の方まで戻って解析をしています。詳しくは個々の構文定義 + ファイルのヘルプを参照してください。例えば、TeX 用の定義ファイル + |tex.vim|がそれを行っています。 + +============================================================================== +*06.3* 色を変える *:syn-default-override* + +標準色が好みでなければ、他の色テーマを使うことができます。GUI ならメニューの +[編集]-[色テーマ] が使えます。コマンドで指定することもできます: > + + :colorscheme evening + +"evening" というのは色テーマの名前です。色テーマは他にもたくさんあります。ディ +レクトリ $VIMRUNTIME/colors をご覧ください。 + +好みの色テーマを見つけたら、":colorscheme" コマンドを|vimrc|ファイルに追加して +ください。 + +自分で色テーマを作ることもできます。その手順は次の通りです。 + +1. 作りたいテーマに近い色テーマを選び、それを自分の Vim ディレクトリにコピーし + ます。Unix なら次のとおりです: > + + !mkdir ~/.vim/colors + !cp $VIMRUNTIME/colors/morning.vim ~/.vim/colors/mine.vim +< + $VIMRUNTIME は Vim が設定する環境変数なので、このコマンドは Vim から実行し + てください。 + +2. 色テーマファイルを編集します。この一覧が役に立つでしょう: + + term 白黒端末での属性 + cterm カラー端末での属性 + ctermfg カラー端末での文字色 + ctermbg カラー端末での背景色 + gui GUI での属性 + guifg GUI での文字色 + guibg GUI での背景色 + + 例えば、コメントを緑にするにはこのようにします。 > + + :highlight Comment ctermfg=green guifg=green +< + "cterm" と "gui" の属性には、"bold" と "underline" が指定できます。両方を指 + 定したい場合は、"bold,underline" のように指定します。詳しくは|:highlight|を + 参照してください。 + +3. 作った色テーマが使われるように設定します。この行を|vimrc|に追加してくださ + い: > + + colorscheme mine + +次のコマンドで、よく使われる色の組み合わせを表示して、見栄えを確認できます: > + + :runtime syntax/colortest.vim + +いろんな色の組み合せが表示されます。どれが読みやすくて見た目が良いかチェックし +てください。 + +============================================================================== +*06.4* カラーを使う?使わない? + +テキストをカラーで表示するには、たくさんの計算が必要です。表示が遅すぎると感じ +たときは、構文強調表示を一時的に止めてみてください: > + + :syntax clear + +他のファイル (又は同じファイル) を開くと、再びカラー表示されます。 + + *:syn-off* +構文強調表示を完全に無効にするには、このようにします: > + + :syntax off + +これで、構文強調表示が無効になり、すべてのバッファが白黒表示になります。 + + *:syn-manual* +特定のファイルだけ構文強調表示するには、このようにします: > + + :syntax manual + +構文強調表示は有効になりますが、ファイルを開いても、自動的にはカラー表示になり +ません。'syntax' オプションを設定すると、カレントバッファがカラー表示になりま +す: > + + :set syntax=ON +< +============================================================================== +*06.5* カラー印刷 *syntax-printing* + +MS-Windows では、次のコマンドでファイルを印刷できます: > + + :hardcopy + +通常の印刷ダイアログが表示されるので、プリンタを選択し、設定してください。カ +ラープリンタを使っている場合は、画面に表示されているのと同じように印刷されま +す。ただし、背景色を暗い色にしている場合は、白い紙に適した色に変更されます。 + +印刷方法を変更するには、以下のオプションを設定してください: + 'printdevice' + 'printheader' + 'printfont' + 'printoptions' + +一部の範囲だけ印刷するには、ビジュアルモードで印刷したい範囲を選択し、印刷コマ +ンドを実行してください: > + + v100j:hardcopy + +"v" でビジュアルモードを開始して、"100j" で 100 行下まで移動すると、その範囲が +選択されます。":hardcopy" で選択範囲が印刷されます。もちろん、ビジュアルモード +では他のコマンドを使って移動することもできます。 + +PostScript プリンタを使っている場合は Unix でも同様に印刷できます。PostScript +を印刷できない場合は多少の手間がかかります。テキストを HTML に変換してから Web +ブラウザーで印刷してください。 + +現在のファイルを HTML に変換するには次のコマンドを使います: > + + :TOhtml + +動かない場合は次のコマンドを試してください: > + + :source $VIMRUNTIME/syntax/2html.vim + +カリカリと音を立て処理が開始します。巨大なファイルの変換にはしばらく時間がかか +ります。しばらくすると別ウィンドウに HTMLコードが表示されるので、どこかに保存 +してください (後で削除するファイルなので、適当な場所に保存してください): +> + :write main.c.html + +このファイルをお好みのブラウザーで開いて印刷してください。うまくいけば、Vim の +画面での表示と全く同じものが印刷されます。詳しくは|2html.vim|を参照してくださ +い。全てが終わったら、HTMLファイルは削除してしまいましょう。 + +印刷する代わりに、HTML ファイルを Web サーバーに置いて、他の人にカラー付きの文 +書として提供することもできます。 + +============================================================================== +*06.6* 詳しい情報 + +|usr_44.txt| 構文定義の自作 +|syntax| 全ての詳細 + +============================================================================== + +次章: |usr_07.txt| 複数のファイルを開く + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_07.jax b/plugins/vimdoc-ja/doc/usr_07.jax new file mode 100644 index 0000000000..61dce16d4d --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_07.jax @@ -0,0 +1,481 @@ +*usr_07.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + VIM USER MANUAL - by Bram Moolenaar + + 複数のファイルを開く + + +どんなにファイルが多くても心配はいりません。Vim を複数起動することなしに、それ +らのファイルを編集できます。作業するファイルのリストを定義して、他のファイルに +ジャンプしたりテキストをコピーしたりできます。 + +|07.1| 他のファイルを開く +|07.2| ファイルのリスト +|07.3| 他のファイルにジャンプする +|07.4| バックアップファイル +|07.5| 他のファイルにテキストをコピーする +|07.6| 読み込み専用モード +|07.7| ファイル名の変更 + +次章: |usr_08.txt| ウィンドウの分割 +前章: |usr_06.txt| 構文強調表示 +目次: |usr_toc.txt| + +============================================================================== +*07.1* 他のファイルを開く + +いままでは、ファイルを開くごとに Vim を起動しなければなりませんでしたが、もっ +と簡単な方法があります。次のコマンドを使ってください: > + + :edit foo.txt + +ファイル名は "foo.txt" に限らず何でも使えます。Vim は現在のファイルを閉じて、 +指定されたファイルを開きます。ファイルの変更が保存されていない場合は、エラー +メッセージが表示され、新しいファイルは開かれません。 + + E37: 最後の変更が保存されていません (! で変更を破棄) ~ + + Note: + エラーメッセージの先頭には エラーID が表示されます。エラーの意味や原因 + がわからない場合は、この ID をヘルプで引いてください。上記エラーの場合 + は、このようにします: > + + :help E37 + +このエラーを回避するには、次のコマンドでファイルを保存してください: > + + :write + +あるいは、変更を破棄して新しいファイルを開くこともできます。(!) 文字を使ってく +ださい: > + + :edit! foo.txt + +ファイルの変更を保存せずに他のファイルを開きたい場合は、ファイルを隠す方法もあ +ります: > + + :hide edit foo.txt + +ファイルの変更はまだ破棄されませんが、ファイルは画面外に隠れてしまいます。詳し +くは|22.4|バッファリスト で説明します。 + +============================================================================== +*07.2* ファイルのリスト + +Vim を起動するときに、複数のファイルを指定することができます。例: > + + vim one.c two.c three.c + +このコマンドは Vim を起動し、三つのファイルを開くように指示しています。Vim は +一つ目のファイル (one.c) だけを表示します。そのファイルの編集が終わり、次のファ +イル (two.c) を編集したい場合はこのコマンドを使います: > + + :next + +ファイルの変更が保存されていない場合は、エラーメッセージが表示され、":next" コ +マンドは中断されます。前節で述べた ":edit" の場合と同じです。変更を破棄するに +は次のコマンドを使います。 > + + :next! + +しかしほとんどの場合、変更を保存してから次のファイルを開くと思います。それには +専用のコマンドが用意されています。 > + + :wnext + +これは次の二つのコマンドを使うのと同じ結果となります。 > + + :write + :next + + +私はドコにいるの? +------------------ + +今編集しているのが引数リスト中のどのファイルなのかは、ウィンドウタイトルを見れ +ばわかります。そこに "(2 of 3)" のような表示があります。この場合は全部で三つの +ファイルがあり、今は二つ目を編集しているという意味です。 +次のコマンドでファイルの一覧を表示できます: > + + :args + +これは "arguments" の省略形です。結果は次のように表示されます。 + + one.c [two.c] three.c ~ + +Vim を起動したときに指定したファイルが表示されます。編集中のファイル (ここでは +"two.c") は [] 記号で囲んで表示されます。 + + +他のファイルへの移動 +-------------------- + +これはファイルを一つ戻るコマンドです。 > + + :previous + +":next" コマンドと同じ動作ですが、移動する方向が違います。このコマンドにも、 +ファイル保存してから移動する専用のコマンドがあります。 > + + :wprevious + +一覧の最後のファイルに移動するには次のコマンドを使います。 > + + :last + +最初のファイルに戻るには次のコマンドです。 > + + :first + +":wlast" とか ":wfirst" みたいなコマンドはありません。 + +":next" と ":previous" にはカウンタを指定できます。例えば、二つ先のファイルに +進むにはこのようにします。 > + + :2next + + +自動保存 +-------- + +いろんなファイルを編集して回るときには、":write" で保存するのを忘れないでくだ +さい。変更を保存せずに移動しようとすると、エラーメッセージが表示されます。移動 +するときはいつでも変更を保存したいと思った場合は、次のように設定してください。 +変更が自動的に保存されるようになります。 > + + :set autowrite + +保存して欲しくないファイルを編集するときは、機能をオフに設定してください。 > + + :set noautowrite + + +他のファイルリストで編集する +---------------------------- + +Vim を再起動しなくても、ファイルリストを変更できます。例えば、他の三つのファイ +ルを編集するには次のようにします。 > + + :args five.c six.c seven.h + +シェルと同じようにワイルドカードを使うこともできます。 > + + :args *.txt + +リストの最初のファイルがまず開かれます。ここでも、現在のファイルの変更をまだ保 +存していない場合は、ファイルを保存するか、":args!" (! が付いています) を使って +変更を破棄する必要があります。 + + +最後のファイルまで編集した? +---------------------------- + *arglist-quit* +ファイルリストが使われると、Vim は、すべてのファイルが編集対象だと判断します。 +間違って Vim を終了してしまうことがないように、すべてのファイルをまだ開いてい +ないのに終了しようとした場合は、エラーメッセージが表示されます: + + E173: 編集すべきファイルがあと 46 個あります。 ~ + +本当に終了してよければ、もう一度終了コマンドを実行してください。今度は終了でき +ます (間に他のコマンドを挟まないでください)。 + +============================================================================== +*07.3* 他のファイルにジャンプする + +CTRL-^ を使うと二つのファイル間を素早く移動できます(日本語キーボードなら ^ は +'-' キーの右側 (「へ」キー) にあります)。例: > + + :args one.c two.c three.c + +上を実行すると "one.c" が開きます。 > + + :next + +これで、"two.c" になりました。ここで CTRL-^ を使うと "one.c" に戻ります。もう +一度 CTRL-^ を押すと "two.c" に戻ります。さらに CTRL-^ を使うと "one.c" になり +ます。さて、ここで次のコマンドを実行します。 > + + :next + +すると、"three.c" になります。CTRL-^ コマンドはファイルリスト中での現在地を変 +更しません。":next" や ":previous" のようなコマンドだけが現在地を変更します。 + +直前に編集していたファイルのことをオルタネートファイル (alternate file) と言い +ます。Vim の起動直後はオルタネートファイルがまだ無いため CTRL-^ は動作しませ +ん。 + + +定義済マーク +------------ + +他のファイルにジャンプすると、二つの定義済マークが使えるようになります。これは +非常に便利です。 > + + `" + +このコマンドを実行すると、以前にファイルを開いていたときにいた場所にカーソルが +移動します。もう一つは、最後に変更を加えた場所に設定されたマークです。 > + + `. + +例えば、"one.txt" を編集しているとします。ファイルの真ん中あたりで "x" を使っ +て文字を削除しました。そして、"G" を使って最後の行に移動し、":w" でファイルを +保存します。他のファイルをいくつか編集してから、":edit one.txt" で "one.txt" +に戻ってきました。ここで、`" を実行すると、ファイルの最後の行にカーソルが移動 +します。`. を実行すると、文字を削除した場所に移動します。ファイル内をいろいろ +と移動した後でも、`" と `. は同じ場所を覚えています。少なくとも、他の変更を加 +えたり、別のファイルに移動したりするまでは。 + + +ファイルマーク +-------------- + +4 章 (|04.1|) では "mx" でマークを付け、"`x" でその場所にジャンプする方法を説明 +しました。そのマークはファイルの中だけで使えます。別のファイルを開いて、それに +同じマークを付けても、マークはそのファイルに固有のものとなります。つまり各ファ +イルはそれぞれのマークを持っていて、ファイル内に閉じているということです。いま +までは、マークに小文字を使ってきましたが、大文字のマークも使えます。 +大文字のマークはグローバルで、どのファイルからでも使えます。例えば "foo.txt" +というファイルを開き、"50%" コマンドでファイルの真ん中にジャンプして、その場所 +に F というマークを付けたとします: > + + 50%mF + +次に "bar.txt" を開き、最終行にマーク B を付けます: > + + GmB + +さて、ここで "'F" コマンドを使うと、いきなり foo.txt の真ん中にジャンプできま +す。さらに、他のファイルを開いてから "'B" を入力すると、bar.txt の行末に移動で +きます。 + +他の場所を設定するまで、ファイルマークは同じ場所を記憶しています。そのため、一 +度マークを付ければ、何時間も編集を行ってからでもそのマークに戻って来ることがで +きます。 +マークの文字とマークを付けた場所が連想できるような単純なルールを決めておくとよ +いでしょう。例えば、ヘッダーファイルは H、makeファイルは M、C 言語のソースには +C といった具合です。 + +マークが置いてある場所を確認するには、":marks" コマンドにそのマークを指定して +ください。 > + + :marks M + +マークを複数指定しても構いません。 > + + :marks MCP + +マークを使わなくても、CTRL-O と CTRL-I を使えば、古い場所と新しい場所の間を +ジャンプできることをお忘れなく。 + +============================================================================== +*07.4* バックアップファイル + +初期設定ではバックアップファイルは作成されません。バックアップファイルが必要な +ら、次のコマンドを実行してください: > + + :set backup + +バックアップファイルの名前は、ファイル名の後ろに ~ を加えた名前になります。 +例えば、ファイル名が data.txt なら、バックアップファイルは data.txt~ です。 + ~ 以外の文字を使いたい場合は、次のように設定してください: > + + :set backupext=.bak + +これで、バックアップファイルの名前が data.txt.bak になります。 +もう一つのオプション 'backupdir' についても説明しましょう。これはバックアップ +ファイルを保存するディレクトリを指定するオプションです。初期設定ではバックアッ +プは元ファイルと同じディレクトリに保存されます。たいていの場合はこれで問題ない +はずです。 + + Note: + 'writebackup' がオンの場合、'backup' がオフでもバックアップファイルは + 作成されますが、ファイルの保存が成功すると、そのバックアップファイルは + すぐに削除されます。これは、ファイルを保存できなかったときに、オリジナ + ルファイルが失われないようにするための機能です。(失敗の原因は、例え + ば、ディスクがいっぱいになったというのが一番ありがちな理由です。雷にや + られるというのも可能性は低いですがありうることです)。 + + +オリジナルファイルを残す +------------------------ + +ソースファイルを編集していると、変更を加える前のファイルを残しておきたいときが +あります。しかし、バックアップファイルはファイルを保存するたびに上書きされるの +で、直前のバックアップしか残らず、最初のファイルはなくなってしまいます。 +オリジナルのファイルを残しておきたい場合は、'patchmode' オプションを設定してく +ださい。バックアップファイルを最初に作成するときに使う拡張子を指定します。次の +ように設定してください: > + + :set patchmode=.orig + +例えば、はじめて data.txt を開いたときに、変更を加え、保存しようとすると、変更 +前のファイルが "data.txt.orig" という名前でコピーされます。 +その後、ファイルを変更しても、既に "data.txt.orig" があるので、上書きはされま +せん。この場合もバックアップファイルは "data.txt~" (もしくは 'backupext' で指 +定した名前) で作成されます。 +'patchmode' が空のまま (初期設定) だと、オリジナルファイルは残りません。 + +============================================================================== +*07.5* 他のファイルにテキストをコピーする + +ここではファイルから別のファイルにテキストをコピーする方法を説明します。簡単な +例で始めましょう。コピーしたいテキストを含んでいるファイルを開きます。テキスト +の先頭にカーソルを移動して "v" を押すとビジュアルモードが開始します。テキスト +の末尾までカーソルを移動して "y" を押します。これでテキストがヤンク (コピー) +されました。 + +例えば、上の段落をコピーするには、次のようにします。 > + + :edit thisfile + /ここでは + vjjjj$y + +次に、このテキストをプット (ペースト) したいファイルを開きます。テキストをプッ +トしたい場所にカーソルを動かし、"p" コマンドでプットします。 > + :edit otherfile + /どこか + p + +当然ながら、テキストのヤンクには他にもいろんなコマンドが使えます。例えば、"V" +でビジュアルモードを開始すると行単位で選択できますし、CTRL-V で矩形選択もでき +ます。"Y" で一行をヤンクしたり、"yaw" で単語をヤンク (yank-a-word) するなど、 +いろいろできます。 +"p" コマンドはカーソルの後にテキストをプットします。カーソルの前にプットするに +は "P" を使います。Vim はヤンクしたときの選択単位 (行選択や矩形選択) を覚えて +いて、同じ単位でプットします。 + + +レジスタを使う +-------------- + +あるファイルから別のファイルに数箇所のテキストをコピーしたいとき、何度も何度も +ファイルを切り換えると時間がかかります。テキストをレジスタにコピーして手間を省 +きましょう。 +レジスタとは、Vim がテキストを保持する場所です。ここでは a から z までの名前が +付いたレジスタを使います (レジスタは他にもあります)。では、テキストをレジスタ +f (fはfirstのつもり) にヤンクしてみましょう。 > + + "fyas + +"yas" コマンドで文をヤンクしています。"f はテキストをレジスタ f に入れるための +指定です。この指定はヤンクコマンドの直前に指定します。 +さらに三行をレジスタ l (lはlineのつもり) にヤンクしてみましょう。 > + + "l3Y + +カウンタ (回数指定) は "l の直前に指定することもできます。テキストのブロック +(矩形選択) をレジスタ b (bはblockのつもり) にヤンクする場合は次のようにしま +す。 > + + CTRL-Vjjww"by + +レジスタ指定 "b を "y" コマンドの直前で指定している点に注意してください。これ +は重要なことです。これを "w" コマンドより前に置いてしまうとうまく動きません。 +さて、f、l、b の三つのレジスタにテキストをヤンクできました。他のファイルを開い +て、テキストを挿入したい場所にカーソルを移動し、レジスタの内容をプットしましょ +う。 > + + "fp + +ヤンクの場合と同じく、レジスタ指定 "f は "p" コマンドより前に指定します。 +どのレジスタからプットしても構いません。他のテキストをヤンクし直さない限り、レ +ジスタの内容は変わらないので、同じレジスタを何度でも好きなだけプットできます。 + +テキストを削除するときにも、レジスタを指定できます。テキストを何ヶ所かに移動す +るときなどに使ってください。例えば、単語を削除 (delete-a-word) してその内容を +レジスタ w に入れるには次のようにします。 > + + "wdaw + +何度も言うようですが、レジスタ指定は削除コマンド "d" の前に置いてください。 + + +ファイルに追記する +------------------ + +文章を一つのファイルにまとめたい場合は、次のコマンドを使います。 > + + :write >> logfile + +カレントファイルの内容が "logfile" の末尾に追記されます。テキストをコピーして、 +"logfile" を開き、テキストをプットするより簡単です。作業を 2 手節約できます。 +ただし、ファイルの末尾への追加しかできません。 +ファイルの一部だけ追記したい場合は、ビジュアルモードでテキストを選択してから +":write" を実行してください。テキストを選択する方法は他にもありますが、10 章で +説明します。 + +============================================================================== +*07.6* 読み込み専用モード + +ファイルを変更する気はなく、ただファイルの内容を見たいだけのときがあります。普 +通に開くと、うっかり ":w" を実行して元のファイルを上書きしてしまう危険がありま +す。そういうときは、読み込み専用モードでファイルを開いてください。 +Vim を読み込み専用モードで起動するには、次のコマンドを使います。 > + + vim -R file + +Unix なら、次のコマンドも同じ意味になります。 > + + view file + +"file" が読み込み専用モードで開きます。":w" をしようとしても、エラーメッセージ +が表示され保存はされません。 +ファイルに変更を加えようとすると、次のような警告が表示されます。 + + W10: 警告:読込専用ファイルを変更します ~ + +警告は出ますが、変更は可能です。これは、例えばファイルを読みやすくフォーマット +したりするためです。 +読み込み専用モードであることを忘れて、ファイルを修正してしまったようなときは、 +write コマンドに ! を付けて強制保存してください。 + +完全にファイルの変更を禁止したい場合は、次のようにしてください。 > + + vim -M file + +これで、内容を変更しようとしてもエラーになります。例えば、ヘルプファイルはこの +モードで表示されています。変更しようとすると、次のエラーメッセージが表示されま +す。 + + E21: 'modifiable'がオフなので、変更できません ~ + +-M 引数を使えば Vim を閲覧モードに設定できますが、これは自主規制みたいなもの +で、次のコマンドを使えば制限はなくなってしまいます。 > + + :set modifiable + :set write + +============================================================================== +*07.7* ファイル名の変更 + +新しいファイルを作成するときに、目的に近いファイルがあるなら、それを利用するの +が効率的です。例えば、ファイルを移動するプログラムを作りたいとしましょう。ファ +イルをコピーするプログラムがすでにあるので、それを流用することにしました。 > + + :edit copy.c + +新しいプログラムに必要ない部分は削除してしまいましょう。次に、このファイルを新 +しい名前で保存する必要があります。そのためのコマンドが ":saveas" です。 > + + :saveas move.c + +指定した名前でファイルが保存され、そのファイルが開かれます。そのため、次に +":write" したときは "move.c" に保存されます。"copy.c" は変更されません。ファイ +ルを保存せずに、ファイルの名前だけ変更したい場合は、次のコマンドを使います。 > + + :file move.c + +そのファイル (move.c) は、実際のファイルではないので、"開いていない" (not +edited) 扱いになります。ファイルを保存しようとすると、次のメッセージが表示され +ることがあります。 + + E13: ファイルが存在します (! を追加で上書) ~ + +これは、実際のファイルを間違って上書きしてしまわないようにするためです。 + +============================================================================== + +次章: |usr_08.txt| ウィンドウの分割 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_08.jax b/plugins/vimdoc-ja/doc/usr_08.jax new file mode 100644 index 0000000000..64bd2fbd3c --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_08.jax @@ -0,0 +1,598 @@ +*usr_08.txt* For Vim バージョン 8.0. Last change: 2014 Jul 06 + + VIM USER MANUAL - by Bram Moolenaar + + ウィンドウの分割 + + +関係のない2つの違ったファイルを表示したい。1つのファイルの2個所を同時に +見たい。2つのファイルを横に並べて差分を見てみたい。 +ウィンドウ分割を使えばどれもできてしまいます。 + +|08.1| ウィンドウの分割 +|08.2| ウィンドウを分割してファイルを開く +|08.3| ウィンドウのサイズ +|08.4| 縦分割 +|08.5| ウィンドウの移動 +|08.6| 全ウィンドウを対象とするコマンド +|08.7| vimdiff で差分を表示する +|08.8| その他 +|08.9| タブページ + +次章: |usr_09.txt| GUI を使う +前章: |usr_07.txt| 複数のファイルを開く +目次: |usr_toc.txt| + +============================================================================== +*08.1* ウィンドウの分割 + +新しいウィンドウを開く一番簡単なコマンドはこれです。 > + + :split + +画面が上下2つのウィンドウに分割されます。カーソルは上側のウィンドウに置かれま +す。 + + +----------------------------------+ + |/* file one.c */ | + |~ | + |~ | + |one.c=============================| + |/* file one.c */ | + |~ | + |one.c=============================| + | | + +----------------------------------+ + +2つのウィンドウに同じファイルが表示されています。"====" のラインはステータス +行です。各ウィンドウの一番下にあってそのウィンドウの情報を表示します。(実際に +はステータス行は反転表示になります) +各ウィンドウには同じファイルの違う場所を表示できます。例えば、上側のウィンド +ウにはプログラムの変数宣言部を表示し、下の方にはその変数を使っている箇所を +表示させる、といったことができます。 + +CTRL-W w コマンドでウィンドウ間をジャンプできます。上側のウィンドウにカーソル +がある時に CTRL-W w を押すとその下のウィンドウにジャンプします。一番下のウィン +ドウにカーソルがある時は一番上のウィンドウに戻ります。(CTRL-W CTRL-W も同じ動 +作をするので、CTRL キーを離すのがちょっと遅れても大丈夫です) + + +ウィンドウを閉じる +------------------ + +ウィンドウを閉じるのは次のコマンドです。 > + + :close + +":quit" や "ZZ" のようなファイルを閉じるコマンドでもウィンドウを閉じることがで +きますが、":close" を使えば、最後のウィンドウを閉じて Vim を終了してしまうよう +な間違いを防げます。 + + +他ウィンドウを全部閉じる +------------------------ + +ウィンドウをたくさん開いたときに、どれか1つのウィンドウに集中したいと思った場 +合は、次のコマンドが便利です。 > + + :only + +カーソルのあるウィンドウを残して全てのウィンドウが閉じます。他のウィンドウに保 +存されていない変更がある場合には、エラーメッセージが表示され、そのウィンドウは +閉じません。 + +============================================================================== +*08.2* ウィンドウを分割してファイルを開く + +次のコマンドを実行すると、2つ目のウィンドウが開き、指定されたファイルの編集が +開始されます。 > + + :split two.c + +例えば、one.c を編集していたなら、結果は次のようになります。 + + +----------------------------------+ + |/* file two.c */ | + |~ | + |~ | + |two.c=============================| + |/* file one.c */ | + |~ | + |one.c=============================| + | | + +----------------------------------+ + +新しいウィンドウに新規ファイルを開くには、次のコマンドを使います。 > + + :new + +":split" や ":new" コマンドを使って好きなだけウィンドウを作成できます。 + +============================================================================== +*08.3* ウィンドウのサイズ + +":split" コマンドは数値を引数として取れます。その値は新しいウィンドウの高さと +なります。例えば、次のコマンドは3行分の高さのウィンドウを作成し、alpha.c を開 +きます。 > + + :3split alpha.c + +ウィンドウのサイズを変更する方法はいくつかあります。マウスが使えれば話は簡単で +す。ウィンドウを分割しているステータス行にマウスを動かし、上下にドラッグしてく +ださい。 + +ウィンドウを大きくするには次のようにします: > + + CTRL-W + + +小さくするには次のようにします: > + + CTRL-W - + +どちらのコマンドも数値を引数として取り、その行数分、ウィンドウサイズを増減しま +す。つまり、"4 CTRL-W +" ならウィンドウが4行分大きくなります。 + +ウィンドウの高さを明示的に指定するには次のコマンドを使います: > + + {height}CTRL-W _ + +{height} に数値を指定し、CTRL-W と _ (アンダースコア) を入力します。 +ウィンドウを最大まで大きくするには、CTRL-W _ コマンドを数値指定なしで実行して +ください。 + + +マウスを使う + +Vim では様々なことをキーボードから極めて素早く操作できますが、残念ながら、ウィ +ンドウサイズを変更するのは少し面倒です。この場合、マウスを使う方が簡単です。マ +ウスポインタをステータス行に合せてから左ボタンを押してドラッグしてください。ス +テータス行が動き、片方のウィンドウが大きくなり、もう片方は小さくなります。 + + +オプション + +'winheight' オプションにはウィンドウの最小の高さ (それ以上は小さくならない) の +希望値を、'winminheight' には最小の高さの強制値を設定できます。 +同様に、'winwidth' オプションにはウィンドウの最小の幅の希望値を、'winminwidth' +には最小の幅の強制値を設定できます。 +'equalalways' オプションが設定されていると、ウィンドウを閉じたり開いたりするた +びに、全てのウィンドウのサイズが同じになります。 + +============================================================================== +*08.4* 縦分割 + +":split" コマンドは現在のウィンドウの上側に新しいウィンドウを作ります。ウィン +ドウを左側に作るには、次のコマンドを使います: > + + :vsplit + +あるいは、 > + :vsplit two.c + +実行後は次のようになります。 + + +--------------------------------------+ + |/* file two.c */ |/* file one.c */ | + |~ |~ | + |~ |~ | + |~ |~ | + |two.c===============one.c=============| + | | + +--------------------------------------+ + +中央の縦棒 (|) は実際には反転表示されます。これは縦セパレータと呼ばれ、これに +よって左右のウィンドウが区切られます。 + +ウィンドウを縦分割して新しい空ファイルを作成する ":vnew" コマンドもあります。 +次のコマンドでも同じことができます: > + + :vertical new + +":vertical" コマンドは、ウィンドウを分割する他のコマンドにも適用できます。これ +を指定すると、ウィンドウは横ではなく、縦に分割されるようになります。(ウィンド +ウを分割しないコマンドの場合は何も変わりません) + + +他のウィンドウへの移動 + +横でも縦でも好きなようにウィンドウを分割できるので、自在にウィンドウを配置でき +ます。他のウィンドウへ移動するには次のコマンドを使います。 + + CTRL-W h 左側のウィンドウに移動 + CTRL-W j 下側のウィンドウに移動 + CTRL-W k 上側のウィンドウに移動 + CTRL-W l 右側のウィンドウに移動 + + CTRL-W t 一番上のウィンドウに移動 + CTRL-W b 一番下のウィンドウに移動 + +カーソル移動と同じ文字を使っていることに注目してください。もちろん、矢印キーも +使うことができます。 +他のウィンドウへ移動するためのコマンドは他にもあります: |Q_wi| + +============================================================================== +*08.5* ウィンドウの移動 + +ウィンドウを分割したが、配置が好ましくなかった場合、ウィンドウをどこか別の場所 +に動かしたいと思うしょう。例えば、次のように三つのウィンドウがあるとします: + + +----------------------------------+ + |/* file two.c */ | + |~ | + |~ | + |two.c=============================| + |/* file three.c */ | + |~ | + |~ | + |three.c===========================| + |/* file one.c */ | + |~ | + |one.c=============================| + | | + +----------------------------------+ + +明らかに一番下のウィンドウが一番上にくるべきです。一番下のウィンドウに移動して +(CTRL-W w を使用)、次のコマンドを入力してください: > + + CTRL-W K + +ここでは大文字の K を使います。これを実行すると、ウィンドウが一番上に移動しま +す。上への移動に K が使われていることに注目してください。 +縦分割しているときに CTRL-W K を使うと、ウィンドウが一番上に移動し、Vim ウィン +ドウと同じ幅になります。例えば、次のようなレイアウトになっているとします。 + + +-------------------------------------------+ + |/* two.c */ |/* three.c */ |/* one.c */ | + |~ |~ |~ | + |~ |~ |~ | + |~ |~ |~ | + |~ |~ |~ | + |~ |~ |~ | + |two.c=========three.c=========one.c========| + | | + +-------------------------------------------+ + +中央のウィンドウ (three.c) で CTRL-W K を実行すると、次のような結果になります: + + +-------------------------------------------+ + |/* three.c */ | + |~ | + |~ | + |three.c====================================| + |/* two.c */ |/* one.c */ | + |~ |~ | + |two.c==================one.c===============| + | | + +-------------------------------------------+ + +他に同じようなコマンドが3つあります。(説明する必要はありませんね) + + CTRL-W H ウィンドウを左端に移動 + CTRL-W J ウィンドウを下端に移動 + CTRL-W L ウィンドウを右端に移動 + +============================================================================== +*08.6* 全ウィンドウを対象とするコマンド + +Vim を終了しようと思ったときに、複数のウィンドウが開いていた場合、ウィンドウを +一つずつ閉じていけば Vim を終了できますが、次のコマンドを使えばもっと速く終了 +できます。: > + + :qall + +これは "quit all" (すべて閉じる) という意味です。まだ保存していないファイルが +ある場合は、Vim は終了しません。保存していないファイルを表示しているウィンドウ +にカーソルが自動的に移動するので、":write" で保存するか ":quit!" で変更を破棄 +するかしてください。 + +未保存のファイルを全て保存するには、次のコマンドを使ってください: > + + :wall + +これは "write all" (すべて保存) という意味です。とはいっても、実際に保存される +のは変更のあったファイルだけです。変更していないファイルを上書きしても意味がな +いことを Vim はわかってますから。 +":qall" と ":wall" を組み合わせた "write and quit all" (すべて保存して終了) コ +マンドもあります: > + + :wqall + +このコマンドは、変更されたファイルをすべて保存して Vim を終了します。 +最後に、次のコマンドは、すべての変更を破棄して Vim を終了するコマンドです: > + + :qall! + +このコマンドはアンドゥできないので、使う時には慎重に! + + +引数で指定したすべてのファイルをウィンドウで開く + +それぞれのファイルごとにウィンドウを開くには、起動パラメーターに "-o" を指定 +します。 +> + vim -o one.txt two.txt three.txt + +結果はこうなります。 + + +-------------------------------+ + |file one.txt | + |~ | + |one.txt========================| + |file two.txt | + |~ | + |two.txt========================| + |file three.txt | + |~ | + |three.txt======================| + | | + +-------------------------------+ + +起動パラメーター "-O" を使えば、ウィンドウが縦分割になります。 +Vim が既に起動している場合、":all" コマンドを使うと引数リストの各ファイルごと +にウィンドウを開くことができます。":vertical all" だと縦分割になります。 + +============================================================================== +*08.7* vimdiff で差分を表示する + +特別な方法で Vim を起動すると、二つのファイルの差分を表示することができます。 +例えば、"main.c" というファイルを開き、どこかの行に文字を挿入したとします。そ +して、オプション 'backup' を有効にしてファイルを保存しました。バックアップファ +イル "main.c~" には変更前のファイルが保存されています。 +シェルで (vim上ではありません) 次のコマンドを入力します: > + + vimdiff main.c~ main.c + +2つのウィンドウを左右に並べた状態で Vim が起動します。画面には先ほど文字を挿 +入した行とその前後の数行が表示されています。 + + VV VV + +-----------------------------------------+ + |+ +--123 lines: /* a|+ +--123 lines: /* a| <- 折り畳み + | text | text | + | text | text | + | text | text | + | text | changed text | <- 変更された行 + | text | text | + | text | ------------------| <- 削除された行 + | text | text | + | text | text | + | text | text | + |+ +--432 lines: text|+ +--432 lines: text| <- 折り畳み + | ~ | ~ | + | ~ | ~ | + |main.c~==============main.c==============| + | | + +-----------------------------------------+ + +(上の図は強調表示されてないので、ちゃんと見たければ、vimdiff コマンドを実行し +てみてください) + +変更のない行は一行に折り畳まれて表示されます。これを閉じた折り畳みと呼びます。 +上の図では "<- 折り畳み" とある行がそうです。最初の折り畳みは 123 行を折り畳ん +でいます。それらの行は両方のファイルで一致しています。 +"<- 変更された行" とある行は強調表示されていて、挿入した文字列が別の色で表示さ +れています。強調表示されているので、どこが違うのかが一目でわかります。 +削除された行は main.c のウィンドウにあるように "---" と表示されます。上の図の、 +"<- 削除された行" とある行を見てください。実際には、そこに文字はありません。そ +の行は、main.c を別のウィンドウと同じ行数で表示するために使われています。 + + +折り畳み表示列 + +各ウィンドウの左側に色の違う列があります。上の図では "VV" で示されています。そ +の列の、閉じた折り畳みのある行に、"+" 記号が表示されています。マウスポインタを +その "+" 記号に合わせて、左ボタンをクリックしてください。折り畳みが開き、折り +畳まれていたテキストが表示されます。 +開いた折り畳みは "-" 記号で表示されます。"-" 記号をクリックすると折り畳みは閉 +じます。 +当り前ですが、これはマウスが利用できる場合のみ機能します。キーボードの場合は +"zo" で折り畳みを開いたり、"zc" で閉じたりできます。 + + +Vim の中で差分を取る + +Vim の中から差分モードを開始する方法もあります。"main.c" を開いて、ウィンドウ +を分割し差分を表示するには、次のようにします: > + + :edit main.c + :vertical diffsplit main.c~ + +":vertical" コマンドはウィンドウを縦分割するために使用します。使わなかった場合 +は横分割になります。 + +パッチ、または diff ファイルがある場合は、3つめの方法で差分モードを開始できま +す。最初に、パッチを適用するファイルを開き、次に、Vim にパッチファイルの名前を +教えてやります: > + + :edit main.c + :vertical diffpatch main.c.diff + +警告: パッチファイルは、開いているファイル用のパッチが1つだけ含まれているもの +でなければなりません。そうでない場合は、大量のエラーメッセージが表示されたり、 +予期せずに、他のファイルにパッチが適用されてしまう場合があります。 +パッチ処理は Vim 内部の、ファイルのコピーに対して実行されます。ハードディスク +上のファイルは (それを上書きしない限り) 変更されません。 + + +同期スクロール + +ファイル間の差分がたくさんある場合、通常どおりスクロールすればそれらを表示でき +ます。もう一方のウィンドウも同じ場所を表示するように自動的にスクロールされるの +で、簡単に差分を並べて表示できます。 +同期スクロールを無効にするには、次のコマンドを使います: > + + :set noscrollbind + + +変更された場所にジャンプする + +折り畳みを無効にしている場合、変更された場所を見つけるのは簡単ではありません。 +次のコマンドを使うと、前方の変更にジャンプできます: > + + ]c + +逆方向にジャンプするには次のコマンドを使います: > + + [c + +回数指定を使えば、さらに遠くまでジャンプできます。 + + +変更を取り除く + +ウィンドウからウィンドウへテキストを移動できます。これによって、差分が増えたり +減ったりします。強調表示は自動的に更新されません。更新するには次のコマンドを使 +います: > + + :diffupdate + +差分を取り除くには、強調表示された範囲のテキストをもう一方のウィンドウに移動し +ます。上述の "main.c" と "main.c~" の例を使って説明します。左ウィンドウに移動 +して、もう一方のウィンドウでは削除されている行に移動します。そして、次のコマン +ドを入力します: > + + dp + +カレントウィンドウのテキストがもう一方のウィンドウにプットされ、変更がなくなり +ます。"dp" は "diff put" の意味です。 +別の方法でも同じことができます。右のウィンドウに移動して、"changed" が挿入され +た行に移動します。そして、次のコマンドを入力します: > + + do + +もう一方のファイルからテキストがコピーされ、変更はなくなります。これで変更がな +くなってしまったので、すべてのテキストが折り畳まれて表示されます。"do" は +"diff obtain" の意味です。意味的には "dg" の方が良いのですが、それはすでに他で +使われています ("dgg" でカーソル位置から最初の行まで削除されます)。 + +差分モードの詳細は |vimdiff| をご覧ください。 + +============================================================================== +*08.8* その他 + +'laststatus' オプションを使うと、最後のウィンドウにステータスラインを表示する +かどうかを設定できます: + + 0 表示しない + 1 分割ウィンドウがある時だけ表示 (初期設定) + 2 常に表示 + +ほとんどの、ファイルを開くコマンドには、ウィンドウを分割するバージョンが存在し +ます。 +Ex コマンドの場合、先頭に "s" が付いています。例えば、":tag" はタグジャンプで +すが、":stag" はウィンドウを分割してからタグジャンプします。 +ノーマルモードコマンドの場合、CTRL-W を前置します。例えば、CTRL-^ はオルタネー +トファイルへのジャンプですが、CTRL-W CTRL-^ はウィンドウを分割してからオルタネー +トファイルを開きます。 + +'splitbelow' オプションを設定すると、カレントウィンドウの下に新しいウィンドウ +が作られるようになります。'splitright' オプションを設定すると、縦分割したとき +に、カレントウィンドウの右に新しいウィンドウが作られるようになります。 + +ウィンドウを分割するときに、次の修飾コマンドを使うと、ウィンドウの位置を指定で +きます: + + :leftabove {cmd} カレントウィンドウの左、または上 + :aboveleft {cmd} 同上 + :rightbelow {cmd} カレントウィンドウの右、または下 + :belowright {cmd} 同上 + :topleft {cmd} 上、または左の端 + :botright {cmd} 下、または右の端 + + +============================================================================== +*08.9* タブページ + +ウィンドウは重ねることができないので、画面がすぐにいっぱいになってしまいます。 +それを解決するために、タブページ、というものが用意されています。 + +"thisfile" というファイルを開いているとしましょう。新しいタブページを作成する +ために次のコマンドを実行します: > + + :tabedit thatfile + +"thatfile" が開かれ、Vim ウィンドウ全体を占める大きさのウィンドウに表示されま +す。そして、上部にバーが表示され、ファイル名が2つ表示されているのが確認できる +と思います: + + +----------------------------------+ + | thisfile | /thatfile/ __________X| (thatfile は太字) + |/* thatfile */ | + |that | + |that | + |~ | + |~ | + |~ | + | | + +----------------------------------+ + +これは2つのタブページがある状態です。1つ目のタブページには "thisfile" を開いて +いるウィンドウが、2つ目のタブページには "thatfile" を開いているウィンドウが入 +っています。これは、紙が2枚重なっていて、それぞれの紙にファイル名が書かれたラ +ベルが付いているようなものです。 + +マウスを使って "thisfile" をクリックしてみましょう。次のようになります。 + + +----------------------------------+ + | /thisfile/ | thatfile __________X| (thisfile は太字) + |/* thisfile */ | + |this | + |this | + |~ | + |~ | + |~ | + | | + +----------------------------------+ + +上部のラベルをクリックすると、タブページを切替えることができます。マウスがな +い、あるいは使いたくない場合には、"gt" コマンドでも切替えられます。"gt" は +Goto Tab の略です。 + +次のコマンドを実行し、タブページをもう一つ作成してみましょう: > + + :tab split + +ウィンドウを1つもったタブページが作成され、そのウィンドウには、さっきまで開い +ていたのと同じバッファが表示されています: + + +-------------------------------------+ + | thisfile | /thisfile/ | thatfile __X| (thisfile は太字) + |/* thisfile */ | + |this | + |this | + |~ | + |~ | + |~ | + | | + +-------------------------------------+ + +":tab" コマンドは、ウィンドウを開く Ex コマンドと組み合わせて使います。そうす +ると、ウィンドウは新しいタブページで開かれます。もう一つ例をあげます: > + + :tab help gt + +このコマンドを実行すると、"gt" についてのヘルプが新しいタブページで開きます。 + +タブページの操作には、他にも次のようなものがあります: + +- 上部バーの最後のラベルより右 (ラベルのないとこ) をマウスでクリック + "gt" と同じように、次のタブページを選択します。 + +- 上部右端の "X" をクリック + 現在のタブページを閉じます。ただし、そのタブページ内に未保存の変更があ + る場合は閉じません。 + +- 上部バーをダブルクリック + 新しいタブページを作成します。 + +- "tabonly" コマンド + 現在のタブページ以外を閉じます。ただし、それらのタブページ内に未保存の + 変更がある場合は閉じません。 + +タブページについての詳細は |tab-page| を参照してください。 + +============================================================================== + +次章: |usr_09.txt| GUI を使う + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_09.jax b/plugins/vimdoc-ja/doc/usr_09.jax new file mode 100644 index 0000000000..86bd30b5f8 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_09.jax @@ -0,0 +1,293 @@ +*usr_09.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + VIM USER MANUAL - by Bram Moolenaar + + GUI を使う + + +Vim は普通の端末で動作します。GVim はそれより少しだけ多機能です。GUI ではメ +ニュー、ツールバー、スクロールバーなどが利用できます。本章では GUI が提供する +それらの機能を説明します。 + +|09.1| GUI の部品 +|09.2| マウスを使う +|09.3| クリップボード +|09.4| 選択モード + +次章: |usr_10.txt| 大規模な編集 +前章: |usr_08.txt| ウィンドウの分割 +目次: |usr_toc.txt| + +============================================================================== +*09.1* GUI の部品 + +おそらく、gVim を起動するためのアイコンがデスクトップにあるはずです。ない場合 +は、次のコマンドのどちらかで起動できます: > + + gvim file.txt + vim -g file.txt + +GUI 版の Vim がインストールされていない場合は起動できません。まず最初に GUI 版 +の Vim をインストールしてください。 +起動すると、ウィンドウが開き、そこに "file.txt" が表示されます。ウィンドウの外 +見は Vim のバージョンによって違うかもしれませんが、だいたい次のような画面が表 +示されるはずです (この図は ASCII で正しく表示されます)。 + + +----------------------------------------------------+ + | file.txt + (~/dir) - VIM X | <- ウィンドウ + +----------------------------------------------------+ タイトル + | File Edit Tools Syntax Buffers Window Help | <- メニューバー + +----------------------------------------------------+ + | aaa bbb ccc ddd eee fff ggg hhh iii jjj | <- ツールバー + | aaa bbb ccc ddd eee fff ggg hhh iii jjj | + +----------------------------------------------------+ + | file text | ^ | + | ~ | # | + | ~ | # | <- スクロール + | ~ | # | バー + | ~ | # | + | ~ | # | + | | V | + +----------------------------------------------------+ + +一番大きな領域にはファイルのテキストが表示されています。その部分は端末での表示 +と同じです。色やフォントは違うかもしれません。 + + +ウィンドウタイトル +------------------ + +最上部はウィンドウタイトルです。この部分はウィンドウシステム (Windows や X の +ウィンドウマネージャーなど) によって描画されます。Vim はカレントファイルの名前 +をタイトルに設定します。ファイル名が先頭に表示され、それから、記号、カッコで囲 +まれたディレクトリ名が表示されます。記号には次の意味があります。 + + - ファイルは変更不可。(例: ヘルプファイル) + + ファイルは変更された。 + = ファイルは読み込み専用。 + =+ ファイルは読み込み専用だが、変更された。 + +何も表示されていなければ、変更されていない通常のファイルです。 + + +メニューバー +------------ + +メニューの使い方はわかりますよね? 一般的な項目に加え、Vim 特有の項目が少しあ +ります。メニューをざっと眺めてどんなものがあるか確認してください。この章に関連 +したサブメニューが [編集]-[全体設定] にあります。次のような項目です: + + ツールバー表示切替 ツールバーの表示のon/off + スクロールバー(下)表示切替 スクロールバー(下)の表示のon/off + スクロールバー(左)表示切替 スクロールバー(左)の表示のon/off + スクロールバー(右)表示切替 スクロールバー(右)の表示のon/off + +ほとんどのシステムではメニューの切り離しができます。メニューの最上部にある点線 +のような項目を選択すると、メニューが別ウィンドウで表示されます。明示的に閉じる +まで、ウィンドウは開いたままです。 + + +ツールバー +---------- + +ツールバーには、よく使われる機能がアイコンの形で格納されています。アイコンを見 +ればその機能を連想できると思います。マウスをアイコンの上に動かしてクリックせず +に一秒ほど待つと、機能の説明がツールチップで表示されます。 + +メニューの [編集]-[全体設定]-[ツールバー表示切換] を使うとツールバーを非表示に +できます。ツールバーを全く使わないのであれば、次のコマンドを vimrc に書いてく +ださい: > + + :set guioptions-=T + +これは 'guioptions' オプションから "T" フラグを取り除くコマンドです。GUI の他の +部品もこのオプションを使って、表示/非表示を指定できます。詳しくはオプションの +ヘルプを参照してください。 + + +スクロールバー +-------------- + +初期設定では右側にスクロールバーが表示されます。動作は一般的なアプリケーション +と同じです。ウィンドウを分割するとウィンドウごとにスクロールバーが作られます。 +メニューの [編集]-[全体設定]-[スクロールバー(下)表示切換] を使うと横スクロール +バーを表示できます。差分モードのときや 'wrap' オプションをオフにしているときに +便利です。(詳しくは後で説明します) + +ウィンドウを垂直分割していて、右側のウィンドウにだけスクロールバーが付いている +場合は、左側のウィンドウにカーソルを移動すれば、スクロールバーはそのウィンドウ +に作用するようになります。 +垂直分割をよく使うなら、左側にもスクロールバーを付けるといいかもしれません。メ +ニューから選択するか、'guioptions' を設定してください: > + + :set guioptions+=l + +これは 'guioptions' に 'l' フラグを追加しています。 + +============================================================================== +*09.2* マウスを使う + +標準は素晴らしい。Microsoft Windows では、マウスを使った標準的な操作方法でテキ +ストを選択できます。X ウィンドウシステムにもマウスの操作方法の標準があります。 +残念ながら、この二つの標準は別物です。 +幸運なことに Vim はカスタマイズできます。マウスの振る舞いを X ウィンドウシステ +ム方式か Microsoft Windows 方式のどちらかに変更できます。次のコマンドでマウス +の振る舞いを X ウィンドウシステム方式に設定できます: > + + :behave xterm + +次のコマンドでマウスの振る舞いを Microsoft Windows 方式に設定できます: > + + :behave mswin + +UNIX での初期設定は xterm です。Microsoft Windows での初期設定はインストール時 +に選択できます。二つの振る舞いの詳細については|:behave|をご覧ください。ここで +は概要だけ説明します。 + + +XTERM 方式のマウスの振る舞い + +左クリック カーソル移動 +左ドラッグ ビジュアルモードでテキストを選択 +中クリック クリップボードからテキストを貼り付け +右クリック マウスポインタで指した場所まで選択範囲を拡張 + + +MSWIN 方式のマウスの振る舞い + +左クリック カーソル移動 +左ドラッグ 選択モードでテキストを選択 (|09.4| 参照) +シフトキー + 左クリック マウスポインタで指した場所まで選択範囲を拡張 +中クリック クリップボードからテキストを貼り付け +右クリック ポップアップメニューを表示 + + +マウスの動作はさらに細かく設定できます。マウスの動作を変更したい場合は、以下の +オプションを確認してください。 + + 'mouse' Vim のどのモードでマウスを使うのか + 'mousemodel' クリックしたときの動作 + 'mousetime' ダブルクリックのクリック間隔 + 'mousehide' 入力している間、マウスを隠す + 'selectmode' マウスで選択したときにビジュアルモードとセレク + トモードのどちらを開始するか + +============================================================================== +*09.3* クリップボード + +|04.7| ではクリップボードの基本的な使い方を説明しました。ここでは X-windows で +の必須事項を説明します。X-windows にはプログラム間でテキストを交換するための空 +間が二つあります。MS-Windows にはそういうのはありません。 + +X-Windows にはカレントセレクション ("current selection") があります。これは選 +択中のテキストのことです。Vim において、それはビジュアル選択している範囲のこと +です (初期設定の場合)。選択しているテキストは特に何もしなくても他のアプリケー +ションにペーストできます。 +例えば、この文章のどこかを適当にマウスで選択したとします。Vim は自動的にビジュ +アルモードに切り替わり、選択したテキストが強調表示されます。ここで、別の gVim +を引数なしで起動し、空のウィンドウを開きます。中央ボタンをクリックすると、選択 +したテキストが挿入されます。 + +カレントセレクションは他のテキストを選択するまで有効です。他の gVim にペースト +した後、そのウィンドウのテキストを選択すると、直前に別の gVim で選択していたテ +キストの表示が変わるのが確認できると思います。その選択範囲はもうカレントセレク +ションではないのです。 + +テキストの選択はマウスでなくても構いません。ビジュアルモードのコマンドをキーボー +ドで入力しても同じことになります。 + + +真のクリップボード +------------------ + +さて、テキストを交換するためのもう一つの空間を説明します。今までの説明との混同 +を避けるために、ここでは真のクリップボード ("real clipboard") と呼びます。普通 +はカレントセレクションと真のクリップボードはどちらもクリップボードと呼ばれます +が、慣れてください。 +真のクリップボードにテキストをプットするために、動作中の gVim で適当なテキスト +を選択し、メニューの [編集]-[コピー] コマンドを実行してください。これで、テキ +ストが真のクリップボードにコピーされました。クリップボードの内容は専用のアプリ +ケーション (例えば KDE の klipper) がなければ見ることはできません。 +次に、別の gVim に移り、カーソルを適当なところに移動し、メニューの [編集]-[貼 +り付け] コマンドを実行します。真のクリップボードからテキストが挿入されます。 + + +両方を使う +---------- + +カレントセレクションと真のクリップボードを両方使うのは少し複雑ですが、でもこれ +はとても便利なのです。例を挙げましょう。 +gVim でテキストファイルを開いて以下の操作を実行してください: > + +- 単語をビジュアルモードで選択する。 +- [編集]-[コピー] メニューを実行して単語をクリップボードに入れる。 +- ビジュアルモードで別の単語を選択する。 +- [編集]-[貼り付け] メニューを実行する。選択している単語がクリップボードにあ + る単語で置き換えられます。 +- マウスポインタを他のところに動かして中央ボタンを押す。直前にクリップボード + のテキストで上書きされた単語がその場所に挿入されます。 + +カレントセレクションと真のクリップボードは気をつけて使いさえすれば、非常に役立 +つテクニックになります。 + + +キーボードを使う +---------------- + +マウスが嫌いなあなたでも、二つのレジスタを使って、カレントセレクションと真のク +リップボードにアクセスできます。カレントセレクションには "* レジスタでアクセス +します。 +テキストをカレントセレクションにするにはビジュアルモードを使います。例えば、 +"V" を押せば行全体を選択できます。 +次のコマンドでカレントセレクションのテキストをカーソルの直前に挿入できます: > + + "*P + +大文字の "P" であることに注意してください。小文字の "p" だとカーソルの直後に +プットされます。 + +真のクリップボードには "+ レジスタでアクセスします。例えば、カーソル位置から行 +末までを真のクリップボードにコピーするには、次のようにします: > + + "+y$ + +"y" はヤンク、つまり Vim のコピーコマンドのことでしたね。 +次のコマンドで真のクリップボードのテキストをカーソルの直前に挿入できます: > + + "+P + +カレントセレクションの場合とコマンドは同じですが、スター (*) ではなくプラス +(+) レジスタを使っています。 + +============================================================================== +*09.4* 選択モード + +これは X Window よりも MS-Windows でよく利用される機能です。しかし、どちらの環 +境でも利用できます。ビジュアルモードについては既に知っていますね。選択モードは +ビジュアルモードに似ています。選択モードもテキストを選択するための機能です。違 +いは、文字を入力すると、選択されていたテキストが削除され、入力した文字に置き換 +わることです。 + +選択モードを使うには、最初にそれを有効にする必要があります。(MS-Windows では、 +既に有効になっていると思いますが、これを実行しても問題ありません): > + + :set selectmode+=mouse + +設定したら、マウスを使ってテキストを選択してみてください。ビジュアルモードのよ +うにテキストが強調表示されます。そして、文字を入力してください。選択されていた +テキストが削除され、入力した文字に置き換わります。挿入モードに入るので、続けて +文字を入力することができます。 + +普通に文字を入力すると選択中のテキストが削除されてしまうので、通常の移動コマン +ドの "hjkl" や "w" などは使えません。代わりに、シフト + 特殊キーの組み合わせを +使ってください。<S-Left> (シフト + 左矢印キー) でカーソルが左に移動します。ビ +ジュアルモードと同じように選択範囲が変化します。他の矢印キーも同様に使えます。 +<S-End> と <S-Home> も使えます。 + +選択モードの動作は 'selectmode' オプションで変更できます。 + +============================================================================== + +次章: |usr_10.txt| 大規模な編集 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_10.jax b/plugins/vimdoc-ja/doc/usr_10.jax new file mode 100644 index 0000000000..6b1c50bd4d --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_10.jax @@ -0,0 +1,804 @@ +*usr_10.txt* For Vim バージョン 8.0. Last change: 2006 Nov 05 + + VIM USER MANUAL - by Bram Moolenaar + + 大規模な編集 + + +四章では、小さな変更を加える方法について説明しました。この章では、同じ操作を再 +実行する方法や、広範囲のテキストを変更する方法を説明します。ビジュアルモードで +は選択範囲にさまざまな処理を実行できます。外部プログラムを使えばとても複雑な処 +理もできます。 + +|10.1| 操作の記録と再実行 +|10.2| 置換 +|10.3| コマンドの範囲指定 +|10.4| global コマンド +|10.5| 矩形選択 +|10.6| ファイルの一部の保存と読み込み +|10.7| テキストの整形 +|10.8| 大文字/小文字の変換 +|10.9| 外部プログラムを使う + +次章: |usr_11.txt| クラッシュからの復帰 +前章: |usr_09.txt| GUI を使う +目次: |usr_toc.txt| + +============================================================================== +*10.1* 操作の記録と再実行 + +"." コマンドを使えば直前の変更を繰り返せますが、複数のコマンドを組み合わせた、 +もっと複雑な操作を繰り返すにはどうすればいいでしょうか。それには記録コマンドを +使います。次の手順で記録できます: + +1. "q{register}" コマンドを実行する。指定したレジスタ {register} へのキー入力 + の記録が開始されます。レジスタ名は a から z のいずれかです。 +2. コマンドを入力して編集する。 +3. q を押して記録を終了する (レジスタの指定は必要ない)。 + +記録したマクロは "@{register}" コマンドで実行できます。 + +このコマンドの使い方を練習してみましょう。次のようなファイル名の一覧がありま +す: + + stdio.h ~ + fcntl.h ~ + unistd.h ~ + stdlib.h ~ + +これを次のように変更します: + + #include "stdio.h" ~ + #include "fcntl.h" ~ + #include "unistd.h" ~ + #include "stdlib.h" ~ + +まず、一行目の行頭に移動してください。そして次のコマンドを実行します。 + + qa レジスタ a へのマクロの記録を開始。 + ^ 行頭に移動。 + i#include "<Esc> 行頭に #include " を挿入。 + $ 行末に移動。 + a"<Esc> 行末に引用符 (") を追加。 + j 次の行に移動。 + q マクロの記録を終了。 + +さて、一回分の作業はこれで終わりました。"@a" コマンドを使って変更を繰り返して +みてください。 +"@a" コマンドには繰り返し回数を指定できます。三回繰り返すには、次のようにしま +す: > + + 3@a + + +移動と実行 +---------- + +変更したい行がいろんな場所に分散している場合は、それぞれの場所に移動してから +"@a" コマンドを使います。一度でも再実行すると、次からは "@@" で同じマクロを再 +実行できます。"@@" の方が少しだけ入力が簡単です。例えば、"@b" でレジスタ b を +実行すると、次に "@@" を実行したときはレジスタ b が使われます。 +マクロの実行と "." にはいくつか違いがあります。まず第一に、"." は一つの変更し +か繰り返せません。上述の例のように、"@a" では複数の変更やカーソルの移動も繰り +返せます。第二に、"." は直前の変更しか繰り返せません。レジスタを実行する方法な +ら、他の変更を加えた後でも、"@a" を使って、記録されたコマンドを繰り返せます。 +最後に、レジスタは 26 個あります。つまり、26 個のコマンド操作を記録しておける +のです。 + + +レジスタを使う +-------------- + +記録に用いるレジスタはヤンクや削除で使っているのと同じものです。そのため、レジ +スタを操作して、記録されたコマンドと他のコマンドを合成することができます。 +レジスタ n にいくつかのコマンドが記録されているとします。ところが、"@n" で実行 +してみると、ミスがあることに気づきました。最初から記録をやり直すこともできます +が、また何か間違えてしまうかもしれません。代わりに、次のようなテクニックを使っ +てみましょう。 + + G ファイルの最後にジャンプ。 + o<Esc> 空行を作成。 + "np レジスタ n の内容をプット。記録されたコマンド + がテキストとして表示されます。 + {edits} 間違っている部分を修正。普通にテキストを編集す + るのと同じです。 + 0 行頭に移動。 + "ny$ 修正したコマンドをレジスタ n にヤンク + dd 不要になった最終行を削除 + +さて、"@n" で正しいコマンドが実行されるようになりました。(記録されたコマンドに +改行が含まれている場合は、上記の最後の二項目はその全内容が含まれるようにしてく +ださい) + + +レジスタに追記 +-------------- + +これまで、レジスタ名には小文字を使ってきました。レジスタに追記するには大文字を +使います。 +単語を変更するためのコマンドがレジスタ c に記録されているとします。これは正し +く動作するのですが、変更すべき次の単語を検索する処理を追加したくなりました。次 +のようにすればできます: > + + qC/word<Enter>q + +レジスタ c に追記するために "qC" で記録を開始しています。レジスタ名を大文字で +書くと、同じレジスタに追記するという意味になるのです。 + +これは記録コマンドだけでなく、ヤンクや削除コマンドでも同じです。例えば、いくつ +かの行をレジスタ a に集めたいとします。最初の行を次のコマンドでヤンクしましょ +う: > + + "aY + +次の行に移動し、このように入力します: > + + "AY + +これを全ての行で実行します。レジスタ a にはヤンクした順にすべての行が保存され +ます。 + +============================================================================== +*10.2* 置換 *find-replace* + +":substitute" コマンドを使うと、指定した範囲内の文字列を置換できます。コマンド +の書式は次のとおりです: > + + :[range]substitute/from/to/[flags] + +このコマンドは [range] で指定された行範囲の中の文字列 "from" を文字列 "to" に +置換します。例えば、次のコマンドを実行すると、すべての行の "Professor" が +"Teacher" に置換されます: > + + :%substitute/Professor/Teacher/ +< + Note: + ":substitute" の綴りを完全に入力するような人はまずいません。普通は短縮 + 形の ":s" が使われます。以降ではこの短縮形を使います。 + +コマンドの前の "%" はファイル全体を意味する範囲指定です。範囲指定がない場合は、 +現在行のみ置換されます。範囲指定については次の節で述べます |10.3|。 + +初期設定では、各行の最初に見つかったものだけが変更されます。例えば、上のコマン +ドを実行すると、次の行は: + + Professor Smith criticized Professor Johnson today. ~ + +このように変更されます: + + Teacher Smith criticized Professor Johnson today. ~ + +すべてを置換するには g (global) フラグを指定してください: > + + :%s/Professor/Teacher/g + +これを実行すると、先程の行は次のようになります。 + + Teacher Smith criticized Teacher Johnson today. ~ + +フラグは他にもあります。p (print=出力) フラグを指定すると、最後に変更された行 +が表示されます。c (confirm=確認) フラグを指定すると、一つ一つ確認しながら置換 +できます。次のようにして使います: > + + :%s/Professor/Teacher/c + +"Professor" が現れる最初の場所が検索され、置換される予定のテキストが表示されま +す。そして、次のようなプロンプトが表示されます: > + + Teacher に置換しますか? (y/n/a/q/l/^E/^Y) + +ここでは次のいずれかの返答が必要です。 + + y Yes; 置換する。 + n No; 置換せずにスキップ。 + a All; 置換する。以降すべて確認なしで置換する。 + q Quit; 置換を終了する。 + l Last; 置換をしてから終了する。 + CTRL-E 画面を一行上にスクロールする。 + CTRL-Y 画面を一行下にスクロールする。 + + +置換コマンドの "from" の部分は実際にはパターン (正規表現) です。これは検索コマ +ンドで使うのと同じものです。例えば、次のコマンドでは、行頭に現れる "the" のみ +が置換されます: > + + :s/^the/these/ + +"from" や "to" にスラッシュ (/) を含めるには、バックスラッシュ (\) を前置する +必要がありますが、スラッシュの代わりに他の文字を使えばその必要はありません。例 +えばプラス (+) など: > + + :s+one/two+one or two+ + +============================================================================== +*10.3* コマンドの範囲指定 + +":substitute" などの : コマンドは、実行する範囲を指定できます。これを範囲指定 +(range) と呼びます。 +範囲指定の基本形式は {number},{number} です。例: > + + :1,5s/this/that/g + +1 行目から 5 行目まで置換コマンドが実行されます。5 行目も範囲に入ります。範囲 +指定はコマンドの前に指定してください。 + +特定の一行だけ指定するには、数字を一つだけ指定します: > + + :54s/President/Fool/ + +一部のコマンドは範囲指定を省略するとファイル全体を処理します。そのようなコマン +ドで現在行だけを処理するには "." を使います。例えば、":write" コマンドの範囲指 +定を省略するとファイル全体が保存されますが、現在行だけを保存するには、次のよう +にします: > + + :.write otherfile + +一行目の行番号は 1 です。最終行は "$" で指定できます。例えば、現在行から最終行 +までの範囲で置換をするには、次のようにします: > + + :.,$s/yes/no/ + +先程使った "%" は "1,$"、つまり一行目から最終行までと同じことです。 + + +パターンを使った範囲指定 +------------------------ + +例えば、本のどこかの章を編集していて、その章で使われている "grey" を全て +"gray" に置換したいとします。ただし、その章だけを置換、つまり次章は変更したく +ありません。章は行頭が "Chapter" で始まる行で区切られています。次のコマンドで +それができます: > + + :?^Chapter?,/^Chapter/s=grey=gray=g + +パターン検索が二回使われています。最初の "?^Chapter?" では現在行から上に向かっ +て検索しています。この ?pattern? という範囲の書き方は後方検索をするために使い +ます。同様に、"/^Chapter/" で前方検索を行い、次章の先頭を検索しています。 +上の例では、説明をわかりやすくするために、置換コマンドの区切りに "=" を使って +います。スラッシュでも他の文字でも動作に違いはありません。 + + +加算と減算 +---------- + +実は上のコマンドには少しだけ間違いがあります。次章のタイトルに "grey" が含まれ +ていると、それも置換されてしまいます。それが期待どおりの動作ならいいのですが、 +そうでなければ? その場合はオフセットを指定すればよいのです。 +パターンを検索し、その一行上の行を使うには、次のようにします: > + + /Chapter/-1 + +数字は 1 でなくても構いません。ヒットした行の 2 行下を指定するなら、次のように +します: > + + /Chapter/+2 + +オフセットは他の範囲指定にも使えます。例えば: > + + :.+3,$-5 + +これは、現在行の 3 行下から、最終行の 5 行上までの範囲を指定しています。 + + +マークを使う +------------ + +行番号を直接指定する代わりに、マークを使うこともできます。 +マークの使い方は三章で説明しました。例えば、範囲指定したい領域の先頭を "mt" で +マークし、領域の末尾を "mb" でマークします。すると、マークを使って次のように範 +囲指定をすることができます (マークのある行は範囲に含まれます): > + + :'t,'b + + +ビジュアルモードと範囲指定 +-------------------------- + +ビジュアルモードでテキストを選択し、":" を押してコマンドラインモードに入ると、 +次のような表示になります: > + + :'<,'> + +この状態でコマンドを入力すると、そのコマンドはビジュアル選択した範囲に対して適 +用されます。 + + Note: + 行の一部だけビジュアルモードで選択した場合や、CTRL-V で矩形選択した場 + 合でも、コマンドは行全体に適用されます。これは将来、変更されるかも知れ + ません。 + +実は、'< と '> はマークです。ビジュアル選択の始点と終点を示しています。このマー +クは、次にビジュアル選択するまで同じ場所を指しています。そのため、"'<" コマン +ドでその場所にジャンプすることもできます。マークと他の範囲指定方法を組み合わせ +ることもできます: > + + :'>,$ + +これは、選択範囲の終点からファイルの末尾までを範囲指定しています。 + + +行数指定 +-------- + +変更したい行数が分かっているなら、その数を入力してから ":" を押してください。 +例えば、"5:" と入力すると、次のような表示になります: > + + :.,.+4 + +続けて、使いたいコマンドを入力してください。これは、"." (現在行) から ".+4" (4 +行下) が範囲指定されています。つまり範囲は 5 行ということです。 + +============================================================================== +*10.4* global コマンド + +":global" コマンドは Vim の中でも最も強力な機能の一つです。パターンにヒットす +る行を検索し、その行で、任意のコマンドを実行できます。コマンドの書式は次のとお +りです: > + + :[range]global/{pattern}/{command} + +":substitute" コマンドに似ていますが、文字列が置換されるのではなく、{command} +コマンドが実行されます。 + + Note: + ":global" で実行できるのは ":" で始まるコマンドだけです。ノーマルモー + ドコマンドはそのままでは使えません。|:normal|コマンドを使ってください。 + +例えば、C++ スタイルのコメント内の "foobar" を "barfoo" に置換したいとします。 +コメントは "//" で開始されています。次のコマンドを使いましょう: > + + :g+//+s/foobar/barfoo/g + +最初の ":g" は ":global" の短縮形です。":substitute" を ":s" と縮めるのと同じ +です。次に "+" 記号で囲まれたパターンがあります。今回はスラッシュを含んだパター +ンを検索するので、セパレータに "+" を使っています。その後に、"foobar" を +"barfoo" に置換するコマンドが続きます。 +範囲指定を省略した場合、global コマンドはファイル全体に適用されます。そのため、 +上の例では範囲指定をしていません。この点は、":substitute" が、範囲指定を省略す +ると現在行だけ処理するのと異なっています。 +このコマンドは完璧ではありません。"//" が行の途中にあった場合もヒットしてしま +うので、行頭から "//" までの文字も置換されてしまいます。 + +":substitute" と同じく、どんなパターンでも使えます。もっと複雑なパターンを覚え +たら使ってみてください。 + +============================================================================== +*10.5* 矩形選択 + +CTRL-V を使うと、テキストの矩形部分を選択することができます。ここでは、矩形選 +択でのみ使える特殊なコマンドを説明します。 + +矩形選択では、"$" コマンドに特殊な意味があります。"$" で移動した直後は、選択範 +囲のすべての行で、選択範囲が行末まで拡張されます。現在行より長い行も行末まで選 +択されます。この選択効果は、左右の移動をすると失われてしまいます。つまり、"j" +なら効果は残りますが、"h" では元に戻ってしまいます。 + + +テキストの挿入 +-------------- + +"I{string}<Esc>" コマンドを使うと、各行の、矩形選択した左側に {string} を挿入 +できます。例えば、CTRL-V を押して矩形選択を開始し、カーソルを動かして選択範囲 +を設定します。次に I を押して挿入モードに入り、テキストを挿入します。このとき、 +挿入したテキストは最初の行にだけ表示されます。 +<Esc> を押して挿入モードを抜けると、テキストが魔法のように選択範囲の残りの行に +挿入されます。例: + + include one ~ + include two ~ + include three ~ + include four ~ + +カーソルを "one" の "o" に移動し CTRL-V を押します。"3j" で、"four" まで移動し +ます。これで 4 行が矩形選択されました。そして、次のコマンドを入力します: > + + Imain.<Esc> + +結果は次のようになります: + + include main.one ~ + include main.two ~ + include main.three ~ + include main.four ~ + +選択範囲の途中に短い行があって、その行の文字が選択範囲に入ってなかった場合は、 +その行には何も挿入されません。例えば、以下のテキストで、一行目と三行目の +"long" を矩形選択します。二行目は短いので何も選択されていません: + + This is a long line ~ + short ~ + Any other long line ~ + + ^^^^ 選択範囲 + +そして、"Ivery <Esc>" を入力すると、次のようになります: + + This is a very long line ~ + short ~ + Any other very long line ~ + +短い行には何も挿入されません。 + +改行を含むテキストを挿入した場合、"I" は通常の挿入コマンドと同じ動作をします。 +つまり、最初の行にだけテキストが挿入されます。 + +"A" コマンドも同様の動作をします。ただし、テキストは右側に挿入されます。そし +て、短い行にもテキストが挿入されます。"I" と使い分ければ、短い行にテキストを挿 +入するかどうかを選択することができます。 +"A" には特別な場合が一つあります。矩形選択時に "$" を使って各行の行末まで選択 +範囲を拡張した場合、"A" を使うと各行の行末にテキストが追加されます。 +上と同じ例を使って、今度は "$A XXX<Esc>" と入力すると、結果は次のようになりま +す: + + This is a long line XXX ~ + short XXX ~ + Any other long line XXX ~ + +"$" を使わなければこの効果は出せません。Vim は "$" が使われたかどうかを記憶し +ています。カーソルを一番長い行の行末に移動し、見た目の選択範囲を同じにしても、 +同じ結果にはなりません。 + + +テキストの変更 +-------------- + +矩形選択で "c" コマンドを使うと、選択範囲が削除され、挿入モードに入ります。入 +力された文字列は選択されていた各行に挿入されます。 +上と同じ例を使って、"long" を選択しているときに今度は "c_LONG_<Esc>" と入力す +ると、結果は次のようになります: + + This is a _LONG_ line ~ + short ~ + Any other _LONG_ line ~ + +"I" コマンドの場合と同じく、短い行は無視されます。また、新しい文字列には改行は +入力できません。 + +"C" コマンドの場合は、ブロックの左端から行末までが削除されます。そして、挿入 +モードに入り、文字列を入力できるようになります。その文字列は各行の行末に追加さ +れます。 +また同じ例ですが、今度は "Cnew text<Esc>" と入力すると、結果は次のようになりま +す。 + + This is a new text ~ + short ~ + Any other new text ~ + +注意すべきは、"long" という単語だけが選択されていても、これを実行すると、行末 +まで全部消えてしまう点です。つまり、選択範囲の左端の位置だけが意味を持ちます。 +繰り返しですが、文字が選択されていない短い行はここでも無視されます。 + +その他に、矩形選択内の文字列を変更するコマンドには次のようなものがあります。 + + ~ 大文字/小文字切換え (a -> A and A -> a) + U 大文字化する (a -> A and A -> A) + u 小文字化する (a -> a and A -> a) + + +一つの文字で埋める +------------------ + +選択範囲全体を一つの文字で埋めるには "r" コマンドを使います。またまた、上で用 +いた例ですが、今度は "long" を選択した上で "rx" と入力します: + + This is a xxxx line ~ + short ~ + Any other xxxx line ~ + + + Note: + 行末を越えて矩形選択したい場合は、25 章の 'virtualedit' の説明を参照し + てください。 + + +シフト +------ + +">" コマンドを使うと、選択されたテキストを右側にシフトできます。間は空白で埋め +られます。シフトの開始位置は矩形選択の左端です。 +また同じ例を使って、今度は ">" を実行すると次のようになります: + + This is a long line ~ + short ~ + Any other long line ~ + +シフトされる桁数は 'shiftwidth' オプションで設定します。これを 4 に変更するに +は次のようにします: > + + :set shiftwidth=4 + +"<" コマンドを使うと、選択範囲の左側にある空白を一つのシフト分だけ削除できま +す。このコマンドは選択範囲の左側にある空白の量によって制限されます。つまり、空 +白がシフト量より少ない場合は、可能な範囲だけ空白が削除されます。 + + +行の結合 +-------- + +"J" コマンドを使うと、選択範囲の行を一行に連結できます。つまり改行が削除されま +す。正確には、改行、行頭の空白、行末の空白、が一つの空白で置換されます +('joinspaces' オプションで動作を変更できます)。 +さて、また同じ例を使って、今度は "J" を実行します: + + This is a long line short Any other long line ~ + +"J" コマンドは矩形選択以外でも使えます。"v" や "V" で選択した場合も全く同じ動 +作をします。 + +空白を変更したくない場合は、"gJ" コマンドを使ってください。 + +============================================================================== +*10.6* ファイルの一部の保存と読み込み + +メールを書いているとき、他のファイルを取り込みたいことがあるかもしれません。そ +れには ":read {filename}" コマンドを使います。指定したファイルの内容が現在行の +下にプットされます。 +次の文章でやってみましょう。 + + Hi John, ~ + Here is the diff that fixes the bug: ~ + Bye, Pierre. ~ + +カーソルを二行目に移動し、次のコマンドを入力します: > + + :read patch + +"patch" という名前のファイルが挿入され、次のようになります: + + Hi John, ~ + Here is the diff that fixes the bug: ~ + 2c2 ~ + < for (i = 0; i <= length; ++i) ~ + --- ~ + > for (i = 0; i < length; ++i) ~ + Bye, Pierre. ~ + +":read" コマンドに範囲指定すると、指定されたファイルが範囲指定された行の下に +プットされます。例えば、":$r patch" なら、"patch" の内容がファイルの末尾に追加 +されます。 +ファイルの先頭に読み込むにはどうすればいいでしょうか。それには、行番号 0 を指 +定します。そのような行は実際にはないので、他のコマンドに指定するとエラーになる +かもしれませんが、このコマンドでは指定できます: > + + :0read patch + +"patch" の内容がファイルの先頭にプットされます。 + + +ファイルの一部だけ保存 +---------------------- + +ファイルの一部だけ保存するには、":write" コマンドを使います。範囲指定を省略す +るとファイル全体が保存されますが、範囲指定すると、指定した範囲の行だけが保存さ +れます: > + + :.,$write tempo + +このコマンドで、現在行から最終行までが "tempo" に保存されます。ファイルが既に +存在している場合はエラーメッセージが表示されるので、間違ってファイルを上書きす +る心配はありません。ファイルを上書きしたい場合は、! を付けてください: > + + :.,$write! tempo + +注意: ! は ":write" コマンドの直後に指定してください。間に空白を入れると、フィ +ルタコマンドになってしまいます。フィルタコマンドについては後で説明します。 + + +ファイルに追記する +------------------ + +この章の最初の節で、複数の行をレジスタに集める方法を説明しました。同じように、 +複数の行をファイルに集めることができます。まず、次のコマンドで最初の行を保存し +てください: > + + :.write collection + +次に、二行目として保存したい行に移動し、次のように入力します: > + + :.write >>collection + +新規ファイルとして保存するのではなく、">>" を使って、ファイルの末尾に追記する +ことを指示しています。あとは必要なだけこの操作を繰り返してください。 + +============================================================================== +*10.7* テキストの整形 + +文章を入力しているとき、行が画面内に収まるように自動的に改行してくれたら便利で +すよね。そうするには、'textwidth' オプションを設定します: > + + :set textwidth=72 + +vimrc ファイルの見本 (|vimrc_example.vim|) で、テキストファイルが開かれたとき +にこのオプションが設定されるようにしていたのを覚えているでしょうか。したがっ +て、vimrc ファイルの見本をそのまま使っているなら、オプションは既に設定されてい +ます。現在の 'textwidth' の設定を確認するには、次のようにします: > + + :set textwidth + +これで、行が 72 文字より長くなった行が改行されるようになりました。ただし、行の +途中からテキストを挿入したときや、単語削除をしたときは、行が 72 文字よりも長く +なったり短くなったりします。既存の文章が自動的に再整形されたりはしません。 +現在の段落を整形するには、次のコマンドを使います: > + + gqap + +これは "gq" というオペレータで始まるコマンドです。次に "ap" というテキストオブ +ジェクトが指定されています。これは "a paragraph" (一つの段落) という意味です。 +段落は、空行で区切られたテキストです。 + + Note: + 空行 (改行文字だけの行) と空白行 (空白文字だけの行) は違います。段落の + 区切りは「空行」だけです。見た目では気づきにくいので注意! + +"ap" 以外のテキストオブジェクトや、移動コマンドも指定できます。段落が正しく分 +割されているなら、次のコマンドでファイル全体を整形できます: > + + gggqG + +これは、"gg" で一行目に移動し、"gq" で整形オペレータを指定、"G" でファイル末尾 +までジャンプしています。 + +段落の区切りが明確でない場合は、手動で行を選択して整形してください。整形したい +範囲の最初の行に移動し、"gqj" コマンドを使います。現在行と次の行が整形されま +す。現在行が短い場合は、次の行の単語が現在行に移動します。現在行が長い場合は、 +現在行の単語が次の行に移動します。カーソルは次の行に移動しているので、"." でコ +マンドを再実行できます。あとは必要なだけ繰り返してください。 + +============================================================================== +*10.8* 大文字/小文字の変換 + +"section header" という小文字のテキストがあります。これを、"section" だけ大文 +字にするには、"gU" オペレータを使います。カーソルを先頭に移動して、コマンドを +実行してください: > + + gUw +< section header ----> SECTION header + +"gu" オペレータで小文字に変換できます: > + + guw +< SECTION header ----> section header + +"g~" を使うと、大文字と小文字を切り替えることができます。今説明したのは全てオ +ペレータなので、移動コマンドやテキストオブジェクトやビジュアルモードと組み合わ +せることができます。 +オペレータを行に適用するには、オペレータを二回繰り返してください。例えば、"d" +は削除オペレータなので、"dd" で一行削除になります。同じように、"gugu" で行全体 +が小文字になります。もっと短く、"guu" でも構いません。"gUgU" は "gUU"、"g~g~" +は "g~~" と短縮できます。例: > + + g~~ +< Some GIRLS have Fun ----> sOME girls HAVE fUN ~ + +============================================================================== +*10.9* 外部プログラムを使う + +Vim には強力なコマンドがたくさんあるので何でもできますが、外部プログラムを使っ +た方がもっときれいで高速に処理できる場合もあります。 +"!{motion}{program}" コマンドを使うと、ファイルの一部を、外部プログラムでフィ +ルタすることができます。つまり、{program} で指定したプログラムが実行され、 +{motion} で指定した範囲のテキストがプログラムに入力され、指定された範囲のテキ +ストがプログラムの出力で置き換えられます。 +UNIX のフィルタに馴染のない方にはわかりにくいと思うので、例を交えて説明します。 +sort コマンドはファイルの中身をソート (並べ替え) するコマンドです。次のコマン +ドを実行すると、ソートされていない input.txt の中身が整列され、output.txt に保 +存されます。(この例は UNIX でも Microsoft Windows でも動作します) > + + sort <input.txt >output.txt + +さて、同じことを Vim でやってみましょう。1 行目から 5 行目までをソートしてみま +す。カーソルを一行目に移動して、次のコマンドを実行します: > + + !5G + +"!" はフィルタを実行するためのコマンドです。次に、移動コマンドを実行し、フィル +タに渡す範囲を指定しています。"5G" は 5 行目に移動するコマンドなので、1 行目 +(現在行) から 5 行目までがフィルタの範囲として指定されます。 +カーソルが画面の一番下に移動し、! プロンプトが表示されるので、フィルタプログラ +ムの名前を入力してください。この場合なら "sort" ですね。したがって、コマンドは +全部で次のようになります。 > + + !5Gsort<Enter> + +コマンドを実行すると、最初の五行が sort プログラムで処理され、元のテキストが、 +プログラムの出力で置き換えられます。 + + line 55 line 11 + line 33 line 22 + line 11 --> line 33 + line 22 line 44 + line 44 line 55 + last line last line + +"!!" コマンドを使うと、現在行をフィルタできます。Unix では "date" コマンドで現 +在の日時を出力できるので、"!!date<Enter>" で現在行を "date" の出力で置き換える +ことができます。これはファイルに日付を挿入するのに便利です。 + + +うまく動作しない場合 +-------------------- + +シェルを起動し、テキストを入力し、出力を取り込むためには、シェルが正しく実行で +きるように設定されている必要があります。フィルタ処理に問題がある場合は、以下の +オプションを確認してください。 + + 'shell' 外部プログラムを実行するために使われるプログラムの指定 + 'shellcmdflag' シェルにコマンドを渡すための引数指定 + 'shellquote' コマンドを囲むためのクォート文字 + 'shellxquote' コマンドとリダイレクトを囲むためのクォート文字 + 'shelltype' シェルの種類 (Amiga専用) + 'shellslash' ファイル名のバックスラッシュをスラッシュにする + (MS-Windows 系専用) + 'shellredir' コマンドの出力をファイルに保存するために指定する文字列 + +Unix では、設定する必要はほとんどありません。なぜなら、おそらく sh 系か csh 系 +のシェルが使われているからです。Vim は 'shell' に "csh" という文字列が含まれて +いるかどうかでシェルの種類を判断し、関連したオプションを自動的に設定します。 +しかし、MS-Windows ではいろんなシェルがあるので、フィルタを動作させるためには、 +オプションを設定する必要があるかもしれません。詳しくはオプションのヘルプを参照 +してください。 + + +コマンドの出力を読み込む +------------------------ + +カレントディレクトリの内容を読み込むには、次のようにします。 + +Unix系: > + :read !ls +MS-Windows系: > + :read !dir + +"ls" や "dir" コマンドの出力が取り込まれ、カーソルの下に挿入されます。これは +ファイルの読み込みに似ていますが、"!" を使ってコマンドを指定している点が違いま +す。 +コマンドに引数を指定することもできます。出力をプットする場所を指定することもで +きます: +> + :0read !date -u + +これはファイルの先頭に現在の日付と時間を UTC 形式で挿入します ("-u" 引数が使え +る date コマンドが必要ですよ。当たり前ですが...)。Note: "!!date" が現在行を置 +き換えるのに対して、":read !date" は行を挿入するという点が違います。 + + +コマンドにテキストを入力する +---------------------------- + +Unix の "wc" コマンドは単語を数えることができます。編集中のファイル内の単語を +数えるには、次のようにします: > + + :write !wc + +これは上述の write コマンドと似ていますが、"!" を使って外部プログラムを指定し +ている点が違います。テキストがコマンドの標準入力に渡され、次のような結果が表示 +されます: + + 4 47 249 ~ + +"wc" コマンドは冗長なメッセージを出力しません。この出力は、行数が 4、単語数が +47、文字数が 249 であることを示しています。 + +次のような間違いに気をつけてください: > + + :write! wc + +これはカレントディレクトリの "wc" というファイルに強制上書きするコマンドです。 +空白は重要ですよ! + + +画面の再描画 +------------ + +外部プログラムがエラーを起こした場合、画面がめちゃくちゃになってしまうことがあ +ります。Vim は必要だと思われる最小限の領域だけを再描画しますが、他のプログラム +の出力内容を完全に把握することはできません。次のコマンドで画面を再描画できま +す: > + + CTRL-L + +============================================================================== + +次章: |usr_11.txt| クラッシュからの復帰 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_11.jax b/plugins/vimdoc-ja/doc/usr_11.jax new file mode 100644 index 0000000000..c892828b6e --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_11.jax @@ -0,0 +1,321 @@ +*usr_11.txt* For Vim バージョン 8.0. Last change: 2010 Jul 20 + + VIM USER MANUAL - by Bram Moolenaar + + クラッシュからの復帰 + + +マシンがクラッシュした? しかも何時間もかけて編集していたところだった? 慌てな +いで! 作業を復元するための情報がハードディスクに記録されています。この章で +は、作業の復元方法や、スワップファイルの扱いについて説明します。 + +|11.1| リカバリの基本 +|11.2| スワップファイルはどこにある? +|11.3| クラッシュした? +|11.4| さらなる情報 + +次章: |usr_12.txt| 便利な小技 +前章: |usr_10.txt| 大規模な編集 +目次: |usr_toc.txt| + +============================================================================== +*11.1* リカバリの基本 + +ほとんどの場合、編集していたファイルの名前さえ覚えていれば (そしてハードディス +クが正しく動いていれば) ファイルのリカバリはとても簡単です。Vim を起動するとき +に、ファイル名に "-r" 引数を付けるだけです: > + + vim -r help.txt + +スワップファイル (編集中の文書を保持するのに使われる) が読み込まれ、編集してい +たファイルのかけらが読み込まれます。変更がリカバリされると次のようなメッセージ +が表示されます (もちろん、ファイル名は違うでしょう): + + Using swap file ".help.txt.swp" ~ + Original file "~/vim/runtime/doc/help.txt" ~ + Recovery completed. You should check if everything is OK. ~ + (You might want to write out this file under another name ~ + and run diff with the original file to check for changes) ~ + You may want to delete the .swp file now. ~ + +日本語: + スワップファイル ".help.txt.swp" を使用中 ~ + 原本ファイル "~/vim/runtime/doc/help.txt" ~ + リカバリが終了しました. 全てが正しいかチェックしてください. ~ + (変更をチェックするために, このファイルを別の名前で保存した上で ~ + 原本ファイルとの diff を実行すると良いでしょう) ~ + それから.swpファイルを削除してください ~ + +念のため、ファイルを違う名前で保存しましょう: > + + :write help.txt.recovered + +原本ファイルと比較して、正しく復元できたどうかを確認してください。それには +vimdiff (|08.7|) が便利です。例: > + + :write help.txt.recovered + :edit # + :diffsp help.txt + +復元したファイルが、原本ファイル (クラッシュする前に保存してあったファイル) の +内容を含んでいることを確認し、失われた行がないかどうかも確認してください (Vim +がリカバリに失敗することもあるので)。 +リカバリ時に警告メッセージが表示された場合は、それを注意深く読んでください。ま +あ、そんなことは滅多にありませんが。 + +リカバリ後のテキストがファイル内のテキストと同じ場合は次のようなメッセージが表 +示されます: + + Using swap file ".help.txt.swp" ~ + Original file "~/vim/runtime/doc/help.txt" ~ + Recovery completed. Buffer contents equals file contents. ~ + You may want to delete the .swp file now. ~ + +日本語: + スワップファイル ".help.txt.swp" を使用中 ~ + 原本ファイル "~/vim/runtime/doc/help.txt" ~ + リカバリが終了しました. バッファの内容とファイルの内容は同じです. ~ + それから.swpファイルを削除してください ~ + +これが起こるのは既にファイルをリカバリしていたか、何か変更したあとでファイルを +保存していた場合などです。この場合は安全にスワップファイルを削除できます。 + +普通は、クラッシュ直前の変更はリカバリできません。スワップファイルは、四秒間入 +力がなかったときや、約 200 文字入力されるごとに、ディスクに書き出されます。こ +の動作は 'updatetime' と 'updatecount' で設定できます。ですから、変更を保存す +る間もなしにシステムがダウンすると、最後に書き出した後の変更は失われてしまうの +です。 + +名前のないファイルを編集していた場合は、引数に空文字列を与えてください: > + + vim -r "" + +これは正しいディレクトリで実行してください。ディレクトリが違うとスワップファイ +ルを検出できません。 + +============================================================================== +*11.2* スワップファイルはどこにある? + +スワップファイルはいろんな場所に保存できます。通常は原本ファイルと同じディレク +トリに保存されます。スワップファイルを見つけるには、ファイルのあるディレクトリ +に移動して、次のコマンドを使います: > + + vim -r + +検出されたスワップファイルの一覧が表示されます。カレントディレクトリのファイル +のスワップファイルが別ディレクトリにある場合はそれも表示されます。ディレクトリ +ツリーを再帰的に処理したりはしません。 +出力は次のようなものです: + + スワップファイルが複数見つかりました: ~ + 現在のディレクトリ: ~ + 1. .main.c.swp ~ + 所有者: mool 日付: Tue May 29 21:00:25 2001 ~ + ファイル名: ~mool/vim/vim6/src/main.c ~ + 変更状態: あり ~ + ユーザー名: mool ホスト名: masaka.moolenaar.net ~ + プロセスID: 12525 ~ + ディレクトリ ~/tmp: ~ + -- なし -- ~ + ディレクトリ /var/tmp: ~ + -- なし -- ~ + ディレクトリ /tmp: ~ + -- なし -- ~ + +リカバリを実行したとき、スワップファイルが複数見つかった場合は、スワップファイ +ルの一覧が表示されるので、使いたいスワップファイルを番号で選択してください。日 +付を見て慎重に選択してください。 +どれを指定したらよいかわからない場合は、一つずつ試して中身を確認してください。 + + +スワップファイルを直接指定する +------------------------------ + +使いたいスワップファイルがわかっている場合は、スワップファイルの名前を指定すれ +ばリカバリすることができます。原本ファイルの名前はスワップファイルから取得され +ます。 + +例: > + vim -r .help.txt.swo + +これはスワップファイルが本来の場所以外にあるときも便利です。 +Vim は *.s[uvw][a-z] のパターンにマッチするファイルをスワップファイルとして認 +識します。 + +うまく動作しない場合は、Vim が表示したファイル名を見て、それにしたがってファイ +ル名を変更してください。'directory' オプションを確認し、スワップファイルが保存 +される場所も確認してください。 + + Note: + スワップファイルには、'dir' オプションに指定されたディレクトリ内の、 + "filename.sw?" というパターンにマッチしたファイルが使われます。ワイル + ドカードの展開ができなかった (例えば 'shell' オプションが無効であった) + 場合は、"filname.swp" というファイルが検索されます。それも失敗した場合 + は、スワップファイルを直接指定してリカバリするしかありません。 + +============================================================================== +*11.3* クラッシュした? *ATTENTION* *E325* + +Vim には、うっかりミスを防止するための仕組みがあります。ファイルを開こうとした +ときに、次のようなメッセージが表示されることがあります: + + E325:注意 ~ + 次の名前でスワップファイルを見つけました ".main.c.swp" ~ + 所有者: mool 日付: Tue May 29 21:09:28 2001 ~ + ファイル名: ~mool/vim/vim6/src/main.c ~ + 変更状態: なし ~ + ユーザー名: mool ホスト名: masaka.moolenaar.net ~ + プロセスID: 12559 (まだ実行中) ~ + 次のファイルを開いている最中 "main.c" ~ + 日付: Tue May 29 19:46:12 2001 ~ + + (1) 別のプログラムが同じファイルを編集しているかもしれません. ~ + この場合には, 変更をした際に最終的に, 同じファイルの異なる ~ + 2つのインスタンスができてしまうことに注意してください. ~ + 終了するか, 注意しながら続けます. ~ + + (2) このファイルの編集セッションがクラッシュした. ~ + この場合には ":recover" か "vim -r main.c" ~ + を使用して変更をリカバーします(":help recover" を参照). ~ + 既にこれを行ったのならば, スワップファイル ".main.c.swp" ~ + を消せばこのメッセージを回避できます. ~ + +ファイルを開くとき、スワップファイルが既に存在するかどうかがチェックされます。 +既に存在しているなら、何かがおかしくなっているのです。原因は次の二つの内のどち +らかでしょう。 + +1. 別のセッションが同じファイルを編集している。上記メッセージの "プロセスID" + の行に注目してください。次のようになっていますね: + + プロセスID: 12559 (まだ実行中) ~ + + "(まだ実行中)" というのは、このファイルを編集しているプロセスが、同じマシン + 上で実行されていることを示しています。この情報は Unix 以外のシステムでは表 + 示されないかもしれません。ネットワーク越しにファイルを編集している場合も、 + この情報は表示されません。なぜなら、そのプロセスは他のコンピュータで実行さ + れているからです。そのような場合は、自分で状況を判断してください。 + 別の Vim が同じファイルを編集している場合、そのまま編集を続けると同じファイ + ルの二つのバージョンができてしまいます。後から書き込まれたファイルがもう一 + 方のファイルを上書きしてしまうので、変更内容が失われることになります。この + ような場合は、そのまま Vim を終了したほうがいいでしょう。 + +2. Vim またはマシンがクラッシュしたのでスワップファイルが残っている。メッセー + ジの日付を確認してください。スワップファイルの日付が開こうとしたファイルよ + りも新しく、メッセージに次の行が含まれている場合: + + 変更状態: あり ~ + + この場合、クラッシュしたセッションが存在し、リカバリすべき内容が含まれてい + る可能性があります。 + ファイルの日付がスワップファイルの日付よりも新しい場合、クラッシュした後に + 何らかの変更が加えられた可能性があります (おそらく、リカバリした後に、スワッ + プファイルを消し忘れたのではないですか?)。もしくは、スワップファイルが更新 + されてからクラッシュするまでの間にファイルが保存されたのかもしれません (そ + れならラッキーです。古いスワップファイルは必要ありません)。そういう場合は、 + 次のような警告が表示されます: + + スワップファイルよりも新しいです! ~ + + +読めないスワップファイル +------------------------ + +ときどき、スワップファイルの名前の下に、次の行が表示されることがあります + + [読込めません] ~ + +これには良い状態と悪い状態があります。 + +以前のセッションがファイルに変更を加えることなくクラッシュした場合は良い状態で +す。その場合、ゼロバイトのスワップファイルが作成されているはずです。それを削除 +して作業を続けてください。 + +スワップファイルの読み込み権限があなたにない場合は少し悪い状態です。ファイルを +読み込み専用で開くか、Vim を終了するかしてください。マルチユーザーシステムで、 +あなたが違う名前でログインしていたときに変更を加えていたのだとしたら、その名前 +でログインしなおせば "読み込みエラー" を直せるかもしれません。あるいは、その +ファイルを最後に変更した (している) 人を探して話し合う必要があるかもしれませ +ん。 + +スワップファイルを保存しているディスクが物理的に故障している場合はとても悪い状 +態です。幸いにも、そんなことはほとんど起こりません。(可能なら) まず、ファイル +を読み込み専用で開き、変更がどの程度失われたか確認してください。あなたがその +ファイルの責任者なら、変更をやり直す覚悟を決めましょう。 + + +どうしますか? *swap-exists-choices* +-------------- + +ダイアログがサポートされている場合、次の五つの選択肢が表示されます: + + スワップファイル ".main.c.swp" が既にあります! ~ + 読込専用で開く([O]), とにかく編集する((E)), 復活させる((R)), ~ + 削除する((D)), 終了する((Q)), 中止する((A)): ~ + +"O" ファイルを読み込み専用で開く。リカバリが必要なくて、ただファイルを表示した + い場合に選択してください。他の誰かがファイルを編集しているときに、ファイル + の内容を変更したいのではなく、確認だけしたい場合にも使えます。 + +"E" ファイルを普通に編集する。注意!他の Vim がそのファイルを編集中の場合、そ + のファイルの二つのバージョンができてしまいます。そうなる前に Vim は警告を + 発しますが、後で残念なことにならないように、最初から安全な選択をしましょ + う。 + +"R" スワップファイルを使ってファイルを復元する。復元すべき内容がスワップファイ + ルに含まれていることがわかっている場合に使ってください。 + +"Q" 終了する。ファイル編集を取り止めます。他の Vim が同じファイルを編集してい + る場合に使ってください。 + Vim を起動中なら、Vim が終了します。複数のファイルを開こうとしていた場合、 + Vim が終了するのは、それが最初のファイルだった場合のみです。":edit" コマン + ドで開こうとしていた場合は、ファイルを開かずに、直前のファイルに戻ります。 + +"A" 停止する。「終了する」に似ていますが、コマンドも即座に停止します。例えば、 + 複数のファイルを開くようなスクリプトを実行したときに、スクリプトを即座に停 + 止させることができます。 + +"D" スワップファイルを削除する。スワップファイルが不要なことがはっきりしている + 場合に使ってください。例えば、スワップファイルが変更を何も含んでいない場合 + や、ファイル本体の日付がスワップファイルより新しい場合に使います。 + Unixでは、スワップファイルを生成したプロセスがまだ実行中の場合、この選択肢 + は表示されません。 + +ダイアログが表示されない (ダイアログをサポートしていない Vim を使っている) 場 +合は、手動で復元作業を実行してください。ファイルを復元するには、次のコマンドを +使います: > + + :recover + + +スワップファイルの存在を常に検出できるとは限りません。例えば、他のセッションが +別のディレクトリにスワップファイルを保存している場合や、他のマシンのファイルを +編集しているためにファイルのパスが違っている場合などです。ですから、警告が表示 +されないからといって安心しないでください。 + +スワップファイルの警告を表示したくない場合は、'shortmess' オプションに "A" フ +ラグを追加してください。しかし特別な理由がなければ設定を変更する必要はないで +しょう。 + +暗号化時のスワップファイルの扱いについては |:recover-crypt| を参照してくださ +い。 + +============================================================================== +*11.4* さらなる情報 + +|swap-file| スワップファイルの名前と作成される場所の説明。 +|:preserve| スワップファイルを手動でディスクに書き込む。 +|:swapname| カレントファイル用のスワップファイルの名前を表示する。 +'updatecount' キーストロークの数。指定された数だけキーが入力されると、スワッ + プファイルがディスクに書き込まれる。 +'updatetime' タイムアウト値。指定された時間内に入力がなかったら、スワップ + ファイルがディスクに書き込まれる。 +'swapsync' スワップファイルを書き込んだときにディスクを同期するかどうか。 +'directory' スワップファイルが保存されるディレクトリの一覧。 +'maxmem' テキストをスワップファイルに保存せずに扱えるメモリの上限。 +'maxmemtot' 同上。ただし、全ファイルの合計値。 + +============================================================================== + +目次: |usr_12.txt| 便利な小技 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_12.jax b/plugins/vimdoc-ja/doc/usr_12.jax new file mode 100644 index 0000000000..71cae9cdda --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_12.jax @@ -0,0 +1,359 @@ +*usr_12.txt* For Vim バージョン 8.0. Last change: 2007 May 11 + + VIM USER MANUAL - by Bram Moolenaar + + 便利な小技 + + +コマンドを組み合わせれば、ほとんど何でもこなすことができます。この章では、便利 +なコマンドの組み合わせをいくつか紹介します。今までに紹介したコマンドを主に使い +ますが、まだ紹介していないコマンドも少し登場します。 + +|12.1| 単語を置換する +|12.2| "Last, First" を "First Last" に変更する +|12.3| リストをソートする +|12.4| 行を逆順に並べ替える +|12.5| 単語を数える +|12.6| マニュアルを引く +|12.7| 空白を取り除く +|12.8| 単語が使われている場所を検索する + +次章: |usr_20.txt| コマンドラインを素早く入力する +前章: |usr_11.txt| クラッシュからの復帰 +目次: |usr_toc.txt| + +============================================================================== +*12.1* 単語を置換する + +置換コマンドを使うと、文章中に現れる単語を別の単語に置換することができます: > + + :%s/four/4/g + +"%" はすべての行を処理するための範囲指定です。末尾の "g" は、行のすべての単語 +を置換するための指定です。 + +上記のコマンドは正しく動作しません。例えば、"thirtyfour" という単語がファイル +に含まれていた場合、"thirty4" に置換されてしまいます。これを防ぐには、"\<" を +使って単語の先頭にヒットさせます: > + + :%s/\<four/4/g + +これでもまだ、"fourteen" のような単語が間違って置換されてしまいます。"\>" を +使って単語の末尾にヒットさせましょう: > + + :%s/\<four\>/4/g + +プログラムを書いているなら、コメントの中にある "four" だけを置換したい場合もあ +るでしょう。コメントの中かどうかを区別するのは難しいので、置換コマンドに "c" +フラグを指定して、確認しながら置換してください: > + + + :%s/\<four\>/4/gc + + +複数のファイル内で置換する +-------------------------- + +複数のファイル内で置換したい場合を考えます。ファイルを1つずつ開いて、その都度 +コマンドを入力することもできますが、操作の記録と再実行を使えば、はるかに素早く +置換できます。 +拡張子が ".cpp" の C++ ファイルが入ったディレクトリがあるとします。"GetResp" +という関数を "GetAnswer" に置換してみましょう。 + + vim *.cpp Vim を起動して、すべての C++ ファイルを引数リ + ストに加える。Vim が起動すると、最初のファイル + が表示されます。 + qq レジスタ "q" に記録を開始する。 + :%s/\<GetResp\>/GetAnswer/g + 最初のファイルで置換コマンドを実行する。 + :wnext ファイルを保存し、次のファイルに移動する。 + q 記録を終了する。 + @q レジスタ "q" を実行する。置換コマンドと + ":wnext" が再実行されます。エラーメッセージが + 表示されたりしないか確認してください。 + 999@q レジスタ "q" を繰り返し実行し、残りのファイル + をすべて処理します。 + +最後のファイルを処理したとき、もうそれ以上ファイルがないので、":wnext" コマン +ドがエラーメッセージを表示します。それにより、実行が中断され、すべてが完了しま +す。 + + Note: + 記録されたコマンドの実行中にエラーが発生すると、実行は中断されます。 + ですから、エラーが出ないように注意して操作を記録してください。 + +まだ問題が1つ残っています。もしも、"GetResp" を含んでいないファイルがあった場 +合、置換コマンドがエラーを発生し、そこで処理が停止してしまいます。それを避ける +には、置換コマンドに "e" フラグを指定してください: > + + :%s/\<GetResp\>/GetAnswer/ge + +"e" フラグは、パターンが見つからなくてもエラーを発生させないための指定です。 + +============================================================================== +*12.2* "Last, First" を "First Last" に変更する + +次のような形式で名前の一覧があるとします: + + Doe, John ~ + Smith, Peter ~ + +これを次のように変更したいとします: + + John Doe ~ + Peter Smith ~ + +これはたった1つのコマンドでできてしまいます: > + + :%s/\([^,]*\), \(.*\)/\2 \1/ + +1つずつ説明しましょう。これが置換コマンドであることはわかりますよね。"%" はす +べての行を示す範囲指定です。つまり、ファイルのすべての行で置換が実行されます。 +置換コマンドには "/from/to/" という形式で引数を指定します。スラッシュ (/) は +"from" パターンと "to" 文字列の区切りです。"from" パターンは次のようになってい +ます: + \([^,]*\), \(.*\) ~ + + 1つ目の \( \) で囲まれた部分は "Last" です \( \) + コンマ (,) 以外の文字が [^,] + 何文字でもマッチする * + ", " という文字にそのままマッチ , + 2つ目の \( \) で囲まれた部分は "First" です \( \) + どんな文字でも . + 何文字でもマッチする * + +"to" の部分には "\2" と "\1" が指定されています。これは後方参照というものです。 +"\( \)" で囲まれた部分にマッチしたテキストを参照しています。"\2" は2つ目の +"\( \)" で囲まれた部分にマッチしたテキスト ("First" name) を参照しています。 +"\1" は1つ目の "\( \)" ("Last" name) を参照しています。 +置換コマンドの "to" 部分には最大で 9 個の後方参照を指定できます。"\0" はパター +ンがマッチしたテキスト全体になります。置換コマンドには他にもいくつか特殊なアイ +テムがあります。|sub-replace-special| を参照してください。 + +============================================================================== +*12.3* リストをソートする + +Makefile ではよく、ファイルのリストが使われます。例: + + OBJS = \ ~ + version.o \ ~ + pch.o \ ~ + getopt.o \ ~ + util.o \ ~ + getopt1.o \ ~ + inp.o \ ~ + patch.o \ ~ + backup.o ~ + +このリストをソートするには、外部コマンドの sort を使ってテキストをフィルタリン +グします: > + + /^OBJS + j + :.,/^$/-1!sort + +リストの先頭 (行頭が "OBJS" で始まる行) に移動してから、一行下に移動、その行か +ら次の空行までの範囲をフィルタに通しています。ビジュアルモードで範囲を選択して +から "!sort" を実行する方法でも構いません。その方が入力は簡単です。行がたくさ +んある場合は少し面倒かもしれませんが。 +結果は、次のようになります: + + OBJS = \ ~ + backup.o ~ + getopt.o \ ~ + getopt1.o \ ~ + inp.o \ ~ + patch.o \ ~ + pch.o \ ~ + util.o \ ~ + version.o \ ~ + + +各行の末尾に行結合のためのバックスラッシュ (\) が使われている点に注意して下さ +い。並べ替えたために、これが壊れてしまいました。"backup.o" はリストの最後にあっ +たので行末にバックスラッシュが付いていませんでしたが、並べ替えによって別の場所 +に移動したため、バックスラッシュが必要になったのです。 +一番簡単な解決方法は "A \<Esc>" でバックスラッシュを追加することです。最後の行 +にあるバックスラッシュは次の行を空白行にしておけば削除しなくても問題ありませ +ん。これで同じ問題は二度と起きないでしょう。 + +============================================================================== +*12.4* 行を逆順に並べ替える + +|:global| コマンドと |:move| コマンドを組み合せて、全ての行を 1 行目の上に移動 +することで、行を逆順に並べ替えたファイルを作ることができます。コマンドは次の通 +りです: > + + :global/^/m 0 + +短縮して書くこともできます: > + + :g/^/m 0 + +"^" という正規表現は行の先頭に (それが空行であっても) マッチします。|:move| コ +マンドはマッチした行を 0 行目 (実際には存在しない仮想的な行) の下に移動します。 +つまり、マッチした行がファイルの先頭行になります。|:global| コマンドは行番号が +変更されても処理を継続できます。そして、マッチしたすべての行が、順番にファイル +の先頭に移動していきます。 + +ある一定の範囲だけ並べ替えることもできます。まず、並べ替えたい範囲の一行上に移 +動し、"mt" でマークします。そして、範囲の末尾に移動し、次のように入力します: > + + :'t+1,.g/^/m 't + +============================================================================== +*12.5* 単語を数える + +ときには、単語数に制限のある文章を書かなければならない場合もあるでしょう。Vim +には単語を数えるための機能があります。 +ファイル全体の単語数を数えるには、次のコマンドを使います: > + + g CTRL-G + +"g" の後の空白は入力しないでください。この空白はコマンドを読み易く表記するため +のものです。 +次のような結果が出力されます: + + 列 1 / 0; 行 141 / 157; 単語 748 / 774; バイト 4489 / 4976 ~ + +これを見れば、何番目の単語 (748) にカーソルがあり、ファイル全体でいくつの単語 +(774) があるのかがわかります。 + +ファイルの一部の文章についてのみ単語を数えたい場合は、テキストの先頭に移動して +"g CTRL-G" を入力し、テキストの末尾に移動して "g CTRL-G" をもう一度入力し、そ +して、表示された単語の位置を引き算して単語数を求めます…これは頭の体操にはなり +ますが簡単な方法とは言えませんね。ビジュアルモードを使えば、テキストを選択して +から "g CTRL-G" を入力するだけです。次のような結果が表示されます: + + 選択 5 / 293 行; 70 / 1884 単語; 359 / 10928 バイト ~ + +単語や行などを数える他の方法については |count-items| を参照してください。 + +============================================================================== +*12.6* マニュアルを引く *find-manpage* + +シェルスクリプトや C プログラムを書いているときに、コマンドや関数のマニュアル +を引きたいことがあると思います (Unix での話です)。まずは簡単な方法でやってみま +しょう。ヘルプを引きたい単語の上にカーソルを移動して、次のコマンドを入力しま +す: > + + K + +単語を引数として "man" プログラムが実行され、マニュアルが見つかった場合は、そ +れが表示されます。テキストをスクロール表示するために、標準設定のページャ (おそ +らく "more" プログラム) が使われます。マニュアルを最後まで表示したら、<Enter> +を押して Vim に戻ってください。 + +この方法の欠点は編集中のテキストとマニュアルを同時に表示できないことです。しか +し、Vim ウィンドウの中にマニュアルを表示する方法もあります。最初に、man ファイ +ルタイププラグインをロードしてください: > + + :runtime! ftplugin/man.vim + +このコマンドを vimrc ファイルに書いておけばいつでも使えるようになります。さて、 +":Man" コマンドが使えるようになりました。新しいウィンドウにマニュアルを表示で +きます: +> + :Man csh + +カラー表示されたテキストをスクロールして表示することができます。これで、調べた +い説明を見つけることができますね。CTRL-W w を使えば、元のウィンドウにジャンプ +できます。 +特定のセクションのマニュアルを表示したいときは、セクション番号を指定してくださ +い。例えば、セクション 3 にある "echo" を調べるなら、次のようにします: > + + :Man 3 echo + +マニュアルの中で "word(1)" のような形式で示されている他のマニュアルにジャンプ +するには CTRL-] を押してください。":Man" コマンドが続けて使われた場合は、同じ +ウィンドウが使用されます。 + +カーソル下の単語のマニュアルを表示するには、次のコマンドを使います: > + + \K + +(自分で <Leader> を再定義している場合は、"\" ではなく、それを使ってください) +例えば、次の行を編集中に "strstr()" の戻り値を知りたくなったら: + + if ( strstr (input, "aap") == ) ~ + +"strstr" の上にカーソルを移動し、"\K" と入力してください。ウィンドウが開いて +strstr() のマニュアルが表示されます。 + +============================================================================== +*12.7* 空白を取り除く + +行末の空白は無用であり、浪費であり、見苦しいものであると考える人々がいます。す +べての行末から空白を取り除くには、次のコマンドを使います: > + + :%s/\s\+$// + +"%" を使ってすべての行を範囲指定しています。":substitute" コマンドに指定されて +いるパターンは "\s\+$" です。これは、空白文字 (\s) が一文字以上続き (\+)、行末 +($) で終わる文字列にマッチします。このようなパターンの書き方は |usr_27.txt| で +説明されています。"to" の部分は空 ("//") になっています。空文字列で置き換える、 +つまり、マッチした空白を削除するという意味になります。 + +もう1つの浪費パターンとして、tab の直前にスペースが使われている場合があります。 +たいていは、そのスペースを削除しても見た目の空白の量は変わりませんが、いつも大 +丈夫というわけではありません。ですから、手作業で削除するのがベストです。次の検 +索コマンドを使ってください: > + + / + +何も見えないかもしれませんが、Tab 文字の直前にスペースがあります。つまりこれは +"/<Space><Tab>" です。検索したら、"x" コマンドを使ってスペースを削除し、見た目 +の変化がないことを確認してください。変化があった場合は、tab 文字を挿入して調整 +しましょう。"n" を押して次の場所を検索します。マッチするものがなくなるまで同じ +操作を繰り返してください。 + +============================================================================== +*12.8* 単語が使われている場所を検索する + +UNIX を使っているなら、Vim と grep コマンドを組み合わせれば、指定した単語が含 +まれているすべてのファイルを開くことができます。これは、プログラムを書いている +ときに、特定の変数が使われているファイルを表示または編集したい場合にとても便利 +です。 +例えば、"frame_counter" という単語が含まれているすべての C 言語ファイルを開く +には、次のようにします: > + + vim `grep -l frame_counter *.c` + +このコマンドを詳しく見てみましょう。"grep" コマンドは、指定されたファイルの中 +から単語を検索します。"-l" 引数が指定されているので、単語が含まれているファイ +ルの名前だけが表示されます。マッチした行は表示されません。検索される単語は +"frame_counter" です。単語の指定には正規表現が使えます。(Note: grep で使える正 +規表現は Vim の正規表現と完全に同じではありません。) +コマンドはバッククォート (`) で囲まれています。これは、コマンドを実行し、その +出力を、コマンドラインに入力されたものとして扱うように UNIX シェルに指示してい +ます。つまり、grep コマンドが実行され、出力されたファイルの一覧が Vim の引数に +渡されます。Vim が起動した後は、":next" や ":first" などのコマンドでそれらの +ファイルを切り替えられます。 + + +単語が使われている行を検索する +------------------------------ + +上述のコマンドは単語が含まれているファイルを見つけるだけなので、単語が使われて +いる行は自分で検索する必要がありました。 +Vim には、指定された文字列を複数のファイルの中から検索するための組み込みコマン +ドがあります。例えば、"error_string" という文字列をすべての C 言語ファイルの中 +から検索するには、次のコマンドを使います: > + + :grep error_string *.c + +指定されたファイル (*.c) の中から、"error_string" という文字列が検索されます。 +コマンドを実行すると、文字列が含まれている最初のファイルが開き、検索にヒットし +た最初の行にカーソルが移動します。文字列が現れる次の場所 (同じファイルとは限り +ません) に移動するには、":cnext" コマンドを使います。一つ前に戻るには ":cprev" +コマンドを使います。":clist" コマンドを使うと、検索結果の一覧と現在位置が表示 +されます。 +":grep" コマンドの実行には、外部プログラムの grep (Unix) または findstr +(Windows) が使われます。使われるプログラムは 'grepprg' オプションで変更できま +す。 + +============================================================================== + +次章: |usr_20.txt| コマンドラインを素早く入力する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_20.jax b/plugins/vimdoc-ja/doc/usr_20.jax new file mode 100644 index 0000000000..95a6e1bec4 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_20.jax @@ -0,0 +1,387 @@ +*usr_20.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + VIM USER MANUAL - by Bram Moolenaar + + コマンドラインを素早く入力する + + +Vim にはコマンド入力を簡単にするための一般的な機能が備わっています。コロン (:) +コマンドでは短縮入力、編集、履歴、文脈依存の補完機能が利用できます。 + +|20.1| コマンドライン編集 +|20.2| コマンドライン短縮入力 +|20.3| コマンドライン補完 +|20.4| コマンドライン履歴 +|20.5| コマンドラインウィンドウ + +次章: |usr_21.txt| 中断と再開 +前章: |usr_12.txt| 便利な小技 +目次: |usr_toc.txt| + +============================================================================== +*20.1* コマンドライン編集 + +コロン (:) コマンドや検索コマンド (/ or ?) を使うとき、カーソルは画面の一番下 +に表示されます。そこにコマンドや検索パターンを入力するわけです。その場所を「コ +マンドライン」と呼びます。 + +コマンドラインの編集で最もわかりやすいのは <BS> でしょう。カーソルの直前の文字 +を削除できます。他の位置にある文字を削除したい場合は、矢印キーでカーソルを動か +してから <BS> を押してください。 +例えば、次のように入力して: > + + :s/col/pig/ +< +<Enter> を押す前になって、"col" が "cow" の入力ミスであることに気づきました。 +これを修正するには、左矢印キー (<Left>) を 5 回押して "col" の直後にカーソルを +動かしてから、<BS> と "w" を入力します: > + + :s/cow/pig/ + +修正したら、その場で <Enter> を押しましょう。コマンドを実行するためにカーソル +を行末まで動かす必要はありません。 + +コマンドラインでのカーソル移動には次のキーがよく使われます: + + <Left> 1 文字左 + <Right> 1 文字右 + <S-Left> or <C-Left> 1 単語左 + <S-Right> or <C-Right> 1 単語右 + CTRL-B or <Home> 行頭 + CTRL-E or <End> 行末 + + Note: + <S-Left> (シフトキーを押したまま左矢印キーを押す) と <C-Left> (コント + ロールキーを押したまま左矢印キーを押す) が機能しないキーボードもありま + す。その他のシフトキーとコントロールキーの組み合せも同様に、機能しない + ことがあります。 + +カーソルはマウスでも動かせます。 + + +削除 +----- + +上述のとおり、<BS> でカーソルの直前の文字を削除できます。単語を削除するには +CTRL-W を使います。 + + /the fine pig ~ + + CTRL-W + + /the fine ~ + +CTRL-U ですべてのテキストを削除できます。コマンドを最初から入力し直したいとき +に使ってください。 + + +上書き +------ + +<Insert> キーを押すと、挿入と上書きが切り替わります。次のテキストを使って説明 +します: + + /the fine pig ~ + +<S-Left> を 2 回押して (<S-Left> が機能しない場合は <Left> を 8 回押して) +"fine" の先頭にカーソルを動かします。<Insert> を押して上書きに切り替え、 +"great" と入力します: + + /the greatpig ~ + +おっと、スペースが消えてしまいました。ここで <BS> を押すと "t" が削除されてし +まいます (置換モードとは違いますね)。<Insert> を押して、上書きから挿入に切り替 +え、スペースを入力します: + + /the great pig ~ + + +キャンセル +---------- + +: または / コマンドを入力した後で、そのコマンドの実行をキャンセルしたくなった +場合は、CTRL-C または <Esc> を押してください。 + + Note: + <Esc> キーはどこでも使える「脱出」キーですが、残念なことに、古き良き + Vi では、コマンドラインで <Esc> を押すと、コマンドが実行されてしまいま + す。これはおそらくバグなので、Vim では <Esc> でコマンドをキャンセルで + きるようになっています。ただし、'cpoptions' を設定して Vi 互換の動作に + 変更することもできます。また、マップが適用されたときは (それが Vi 用に + 書かれたものであってもなくても) <Esc> は Vi 互換の動作をします。CTRL-C + を使えば設定に関係なくキャンセルできます。 + +コマンドラインの先頭にカーソルがあるときに <BS> キーを押すとコマンドをキャンセ +ルできます。これは行頭にある ":" や "/" を削除するような感覚です。 + +============================================================================== +*20.2* コマンドライン短縮入力 + +とても長い名前の ":" コマンドがいくつかあります。":substitute" が ":s" と短縮 +できることは既に説明しましたが、これは何も特別なことではありません。すべての +":" コマンドが短縮できます。 + +コマンドはどこまで短縮できるでしょうか。アルファベットは 26 文字ですが、コマン +ドはそれよりたくさんあります。例えば、":set" の先頭は ":s" ですが、":s" では +":set" を実行できません。":set" の短縮形は ":se" です。 +二つのコマンドが同じ名前に短縮できたとしても、最短の名前を使えるのは一つのコマ +ンドだけです。その決定方法に明確なルールはないので、個別に覚えるしかありませ +ん。コマンドの最短の名前はヘルプファイルに記述されています。例: > + + :s[ubstitute] + +これは ":substitute" の短縮形が ":s" であることを示しています。それ以降の文字 +は任意です。":su" でも ":sub" でも動作します。 + +ユーザーマニュアルではコマンドの長い名前と短い名前の両方が使われますが、読み難 +い短縮形は使われません。例えば、":function" は ":fu" と短縮できますが、これだ +と大半の人が何の略なのか理解できないので ":fun" が使われます。(Vim に ":funny" +コマンドはありませんが、もしあれば、":fun" でも混乱を招きますよね。) + +Vim script を書くときはコマンドの長い名前を使うことをお勧めします。そうしてお +けば、後で変更しようと思ったときに読むのが楽です。しかし、":w" (":write") +や ":r" (":read") のような頻繁に使われるコマンドなら短縮形を使っても構わないで +しょう。 +特にややこしいのは ":end" で、これは ":endif"、":endwhile" あるいは +":endfunction" を表しているのかもしれません。そのため、常に長い名前を使うよう +にしましょう。 + + +オプションの短い名前 +-------------------- + +ユーザーマニュアルではオプションの長い名前が使われますが、ほとんどのオプション +には短い名前があります。":" コマンドと違い、オプションの短い名前は一つしかあり +ません。例えば、'autoindent' の短い名前は 'ai' なので、次の二つのコマンドは同 +じ動作をします: > + + :set autoindent + :set ai + +オプションの長い名前と短い名前の一覧は |option-list| を参照してください。 + +============================================================================== +*20.3* コマンドライン補完 + +コマンドライン補完はこれだけでも Vi から Vim に乗り換えるに値する程の機能です。 +一度使ってしまったら、手放せなくなるでしょう。 + +次のようなファイルを含むディレクトリがあるとします: + + info.txt + intro.txt + bodyofthepaper.txt + +bodyofthepaper.txt を開くには次のコマンドを使います: > + + :edit bodyofthepaper.txt + +いかにも打ち間違えそうです。もっと簡単にやりましょう: > + + :edit b<Tab> + +どちらも結果は同じになります。どういうことでしょうか。<Tab> キーによってカーソ +ル直前の単語 (この場合なら "b") が補完されたのです。ディレクトリが検索され、 +"b" で始まるファイルが一つだけ見つかり、それはあなたが探しているファイルに違い +ないので、その名前が補完されました。 + +さて、次はこのように入力してみます: > + + :edit i<Tab> + +ビープ音が鳴り、次のように表示されます: > + + :edit info.txt + +ビープ音は複数のファイルが見つかったことを示しています。まずは (アルファベット +順で) 最初のファイルが表示されます。もう一度 <Tab> を押すと、次のようになりま +す: > + + :edit intro.txt + +つまり、最初の <Tab> で、探しているファイルが出てこなかったら、もう一度 <Tab> +を押せばよいのです。ファイルがたくさんあるなら、一つずつ表示していきましょう。 +最後の補完候補を表示しているときに <Tab> を押すと、最初の状態に戻ります: > + + :edit i + +また最初から補完候補を表示できます。つまり、補完候補は循環表示されます。CTRL-P +を使うと、逆方向に移動できます: + + <------------------- <Tab> -------------------------+ + | + <Tab> --> <Tab> --> + :edit i :edit info.txt :edit intro.txt + <-- CTRL-P <-- CTRL-P + | + +---------------------- CTRL-P ------------------------> + + +文脈 +----- + +":edit i" ではなく、":set i" と入力してから <Tab> を押すと、次のようになりま +す: > + + :set icon + +どうして ":set info.txt" にならないのでしょうか。それは、Vim が文脈を認識して +いるからです。補完される単語の種類は入力されたコマンドに依存します。":set" コ +マンドに指定するのはファイル名ではなくオプション名であることを Vim は知ってい +るのです。 +上述の例と同様、<Tab> を入力すれば補完候補が一つずつ順番に表示されます。たいて +いは、いくつかの文字を入力してから補完した方が素早く補完できます: > + + :set isk<Tab> + +次のような結果になります: > + + :set iskeyword + +さて、"=" を入力してから <Tab> を押してみましょう: > + + :set iskeyword=@,48-57,_,192-255 + +オプションの現在の設定が挿入されるので、それを編集することができます。 +<Tab> で補完されるのはその場所に入力すべき内容です。どのように動作するかは自分 +で試してみてください。期待したような結果にならないこともあると思いますが、それ +は、Vim がその文脈を認識できなかったか、その文脈における補完が実装されていない +かのどちらかです。その場合は <Tab> 文字が挿入されます (画面上では ^I と表示さ +れます)。 + + +補完候補一覧 +------------ + +補完候補がたくさんあるとき、その一覧を確認することができます。それには CTRL-D +を使います。例えば、次のコマンドを入力してから CTRL-D を押してみます: > + + :set is + +次のような結果になります: > + + :set is + incsearch isfname isident iskeyword isprint + :set is + +補完候補の一覧が表示され、また元の入力に戻ります。この一覧に期待した項目がある +かどうか確認してください。ない場合は、<BS> でテキストを削除し、入力し直してく +ださい。補完候補がたくさんある場合は、さらにいくつかの文字を入力してから <Tab> +を押して補完してください。 +注意深い方なら、候補一覧にある "incsearch" が "is" で始まっていないことに気づ +いたと思います。"is" は "incsearch" の短縮形です。ほとんどのオプションには短い +名前と長い名前がありますが、Vim は賢いので、オプションの短い名前を見て、長い名 +前に展開してくれます。 + + +さらに他にも +------------ + +CTRL-L コマンドを使うと、共通したところまで補完できます。例えば、"info.txt" と +"info_backup.txt" というファイルがあって、":edit i" と入力してから CTRL-L を押 +すと、":edit info" になります。 + +'wildmode' オプションで補完の動作を変更できます。 +'wildmenu' オプションを設定すると補完候補をメニューのように表示できます。 +'suffixes' オプションに優先度の低いファイルを指定しておくと、それらのファイル +は補完候補の末尾に現れます。 +'wildignore' オプションには補完候補として表示して欲しくないファイルを指定しま +す。 + +コマンドライン補完についての詳細は |cmdline-completion| を参照してください。 + +============================================================================== +*20.4* コマンドライン履歴 + +履歴については三章で簡単に説明しました。簡単に言えば、<Up> キーで以前に入力し +た古いコマンドラインを呼び出すことができる機能です。<Down> で新しい方のコマン +ドに戻れます。 + +履歴には四種類あります。ここでは ":" コマンドと検索コマンド ("/" or "?") の履 +歴を説明します。"/" と "?" はどちらも検索コマンドなので、同じ履歴を共有します。 +他には、式入力と input() 関数の履歴があります。|cmdline-history| + +例えば、":set" コマンドを実行した後で、他のコマンドを 10 個実行し、再び ":set" +コマンドを実行したいとします。":" を押してから <Up> を 10 回押せばできますが、 +もっと簡単な方法があります: > + + :se<Up> + +以前使った "se" で始まるコマンドに戻ります。これなら探していた ":set" コマンド +に効率良くたどり着けるでしょう。少なくとも、何度も何度も <Up> を押す必要はあり +ません (入力したすべてのコマンドが ":set" コマンドでもない限り)。 + +<Up> キーを押すと、入力されたテキストと履歴のコマンドラインが比較され、マッチ +した履歴だけが使われます。 +探していた履歴が見つからなかった場合は、<Down> で元に戻ってから正しく入力し直 +すか、CTRL-U を押して最初からやり直してください。 + +履歴をすべて見るには次のコマンドを使います: > + + :history + +":" コマンドの履歴が表示されます。検索コマンドの履歴を表示するには、次のコマン +ドを使います: > + + :history / +< +<Up> の代わりに CTRL-P を使うこともできますが、CTRL-P の前に入力されていたテキ +ストは無視されます。同様に、<Down> の代わりに CTRL-N を使うこともできます。 +CTRL-P は previous (前)、CTRL-N は next (次) という意味です。 + +============================================================================== +*20.5* コマンドラインウィンドウ + +コマンドラインでの文字入力は挿入モードでの文字入力とは違います。テキストを編集 +するための多くのコマンドが使えません。通常のコマンドライン入力ではそれほど問題 +になりませんが、複雑なコマンドを入力しなければならないときもあるでしょう。その +ようなときは、コマンドラインウィンドウが便利です。 + +次のコマンドでコマンドラインウィンドウを開いてください: > + + q: + +画面の下の方に (小さな) ウィンドウが作成されます。ウィンドウにはコマンドライン +履歴が表示され、最終行には空行があります: + + +-------------------------------------+ + |other window | + |~ | + |file.txt=============================| + |:e c | + |:e config.h.in | + |:set path=.,/usr/include,, | + |:set iskeyword=@,48-57,_,192-255 | + |:set is | + |:q | + |: | + |command-line=========================| + | | + +-------------------------------------+ + +ウィンドウを開いた後はノーマルモードになっています。"hjkl" キーで移動できます。 +例えば、"5k" を入力し、":e config.h.in" の行に移動します。"$h" で "in" の "i" +に移動し "cwout" と入力します。行が次のように変更されました: + + :e config.h.out ~ + +<Enter> を押すとこのコマンドが実行され、コマンドラインウィンドウが閉じます。 +<Enter> コマンドで現在行が実行されます。挿入モードでもノーマルモードでも同じ動 +作です。 +コマンドラインウィンドウでの編集は失われます。つまり、コマンドライン履歴は変更 +されません。ただし、実行したコマンドは、通常どおり、履歴に追加されます。 + +コマンドラインウィンドウは、実行したいコマンドに似たコマンドを履歴の一覧から探 +し、それをちょっと変更して再実行するような場合に便利です。コマンドラインウィン +ドウでは検索コマンドも使えます。 +上の例の場合なら、"?config" という検索コマンドを実行すれば、以前に実行した +"config" を含んでいるコマンドを探せます。これは少し不思議ですね。コマンドライ +ンを使ってコマンドラインウィンドウの中を検索しているのですから。しかし、検索コ +マンドを入力するための新たなコマンドラインウィンドウを作成することはできませ +ん。コマンドラインウィンドウは常に一つだけです。 + +============================================================================== + +次章: |usr_21.txt| 中断と再開 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_21.jax b/plugins/vimdoc-ja/doc/usr_21.jax new file mode 100644 index 0000000000..c1a87702f6 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_21.jax @@ -0,0 +1,491 @@ +*usr_21.txt* For Vim バージョン 8.0. Last change: 2012 Nov 02 + + VIM USER MANUAL - by Bram Moolenaar + + 中断と再開 + + +この章では、Vim と他のプログラムを並行して使う方法を説明します。Vim の中から外 +部プログラムを実行したり、Vim を一次的に中断することでそれを実現できます。さら +に、作業状態を記録しておいて、後から復元する方法も説明します。 + +|21.1| サスペンドとレジューム +|21.2| シェルコマンドの実行 +|21.3| viminfo に情報を記録する +|21.4| セッション +|21.5| ビュー +|21.6| モードライン + +次章: |usr_22.txt| ファイルを探す +前章: |usr_20.txt| コマンドラインを素早く入力する +目次: |usr_toc.txt| + +============================================================================== +*21.1* サスペンドとレジューム + +他の Unix プログラムと同様に、Vim も CTRL-Z でサスペンドできます。CTRL-Z を押 +すと Vim が停止し、実行元のシェルに制御が戻ります。そこで好きなだけ他のコマン +ドを実行できます。Vim に戻るには "fg" コマンドを使います。 > + + CTRL-Z + {任意のシェルコマンドを実行} + fg + +サスペンドする前とまったく同じ状態に戻ることができます。 +CTRL-Z を押しても反応がなかった場合は ":suspend" コマンドを使ってください。 +Vim をフォアグラウンドに戻すのを忘れないでください。戻さなかった場合は編集作業 +が失われてしまいます。 + +この機能は Unix でのみサポートされています。他のシステムでは新しいシェルが起動 +されるでしょう。シェルのコマンドが使えることに違いはありませんが、しかしそれは +Vim を実行したシェルではなく、新しいシェルです。 +GUI で実行しているときは実行元のシェルに戻ることはできません。CTRL-Z を押すと +Vim ウィンドウが最小化されます。 + +============================================================================== +*21.2* シェルコマンドの実行 + +一つのシェルコマンドを実行するには ":!{command}" を使います。例えば、ディレク +トリのファイル一覧を見るには次のようにします: > + + :!ls (Unix 環境) + :!dir (MS-DOS/MS-Windows 環境) + +外部プログラムが実行されます。コマンドの実行が終わると <Enter> キーの入力を促 +すプロンプトが表示されるので、コマンドの出力を確認してから通常画面に戻ってくだ +さい。 +"!" は他のコマンドで外部プログラムを指定するときにも使われます。次のコマンドで +指定できます: + + :!{program} {program} を実行する + :r !{program} {program} を実行し、その出力を読み込む + :w !{program} {program} を実行し、標準入力にテキストを書き込む + :[range]!{program} {program} を実行し、テキストをフィルタリングする + +"!{program}" に範囲指定をするとまったく違う動作になるので注意してください。範 +囲指定がなければ単純にプログラムが実行されるだけですが、範囲指定があると、その +範囲のテキストがプログラムでフィルタ処理されます。 + +この方法で外部プログラムを何度でも実行できますが、続けてたくさん実行したい場合 +はシェルを起動した方がいいでしょう。次のコマンドで新しいシェルを起動できます: +> + :shell + +CTRL-Z で Vim をサスペンドしたときの動作に似ていますが、新しいシェルが起動され +るという点が違います。 + +GUI を使っている場合は、シェルの入出力に Vim ウィンドウが使われます。Vim は端 +末エミュレータではないので、端末の機能を完全に再現することはできません。うまく +動作しない場合は、'guipty' オプションを設定してみてください。それでも動作しな +い場合は、新しい端末を作成し、そこでシェルを実行してください。例えば、次のよう +にします: > + + :!xterm& + +============================================================================== +*21.3* viminfo に情報を記録する + +テキストを保持しているレジスタ、いろんな場所に設定されたマーク、慎重に書き上げ +たコマンドが記録されたコマンドライン履歴などは、Vim を終了するとすべて失われて +しまいます。ただし、それらを復元することは可能です! + +viminfo ファイルには以下の情報を記録できます: + + コマンドライン履歴と検索履歴 + レジスタ + マーク + バッファリスト + グローバル変数 + +Vim を終了すると、これらの情報が viminfo ファイルに保存されます。次に Vim を起 +動すると、viminfo ファイルが読み込まれ、状態が復元されます。 + +'viminfo' オプションの初期設定では、あまり多くの情報は記録されません。たくさん +の情報を記録したい場合は、次のコマンドで設定してください: > + + :set viminfo=string + +"string" の部分に、記録したい情報を指定します。設定の書式は、オプション文字と +引数の組み合わせをコンマ (,) で区切ったリストです。 +'viminfo' の設定方法を順番に見ていきましょう。まず、' オプションを設定してみま +す。' オプションには、マーク (a-z) を記録するファイルの数を指定できます。適当 +な数 (例えば 1000) を設定しましょう。コマンドは次のようになります: > + + :set viminfo='1000 + +f オプションには、グローバルマーク (A-Z と 0-9) を記録するかどうかを指定できま +す。引数が 0 なら何も記録されません。f オプションを指定しない、あるいは引数に +1 を指定すると、マークが保存されます。このオプションを指定すると、コマンドは次 +のようになります: > + + :set viminfo='1000,f1 +< +< オプションには、レジスタの行数制限を指定できます。初期設定ではすべての行が記 +録されます。引数が 0 なら何も記録されません。何千行もの (起動を遅くする以外に +使い道のない) テキストを viminfo ファイルに記録したくはないので、500 行に制限 +してみます: > + + :set viminfo='1000,f1,<500 +< +他にも次のようなオプションがあります: + : 記録するコマンドライン履歴の数 + @ 記録する入力行履歴の数 + / 記録する検索履歴の数 + r 指定されたリムーバブルメディア上のファイルのマークを記録しない + (複数指定可) + ! 名前がすべて大文字のグローバル変数を記録する + h 起動直後に 'hlsearch' による強調表示をしない + % バッファリスト (Vim をファイル引数なしで起動したときのみ復元さ + れます) + c テキストを 'encoding' で変換する + n viminfo ファイルの名前 (このオプションは末尾に指定する必要があ + ります) + +詳細は 'viminfo' と |viminfo-file| を参照してください。 + +Vim を複数起動した場合は、最後に終了した Vim の状態が記録されます。それより前 +に終了した Vim が記録した情報は失われます。記録できるのは一つの状態だけです。 + + +前回の場所に戻る +---------------- + +ファイルの編集中に終業時間が来てしまいました。明日から休暇です。Vim を終了し、 +家路につきましょう。仕事の事はすべて忘れて休暇を楽しんでください。数週間後、仕 +事に戻ったら、Vim を立ち上げて、こう入力します: > +> + '0 + +すると、最後に編集していた場所に戻れます。これで仕事が続けられますね。 +Vim を終了するたびにマークが設定されます。最新のマークは '0 です。マークは '0 +から '1 へ、'1 から '2 へ、しだいにずれていき、'9 まで記録されます。 +'0 から '9 までのマークがどこを指しているのかは |:marks| コマンドで確認できま +す。 + + +最近開いたファイルに戻る +------------------------ + +最近開いたファイルを再び開きたい場合はすこし面倒です (前回の Vim 終了時に開い +ていたファイルではなくてまさに最近開いたファイルのこと)。次のコマンドでファイ +ルの一覧を表示できます: > + + :oldfiles +< 1: ~/.viminfo ~ + 2: ~/text/resume.txt ~ + 3: /tmp/draft ~ + +二番目のファイル ("2:" の行) を開きたい場合は次のように入力します: > + + :e #<2 + +":e" 以外にも、ファイル名を引数に取るコマンドならどれを使っても構いません。 +"#<2" という表記は "%" (カレントファイル) や "#" (オルタネートファイル) と同じ +要領で使用できます。例えば次のようにすると、三番目のファイルを分割ウィンドウで +開くことができます: > + + :split #<3 + +単にファイルを開きたい場合には #<123 という指定は少し面倒かもしれませんね。 +もっと簡単な方法があります: > + + :browse oldfiles +< 1: ~/.viminfo ~ + 2: ~/text/resume.txt ~ + 3: /tmp/draft ~ + -- More -- + +|:oldfiles| と同じようにファイル一覧が表示されます。"resume.txt" を開きたい場 +合にはまず "q" を押して表示を止めます。プロンプトが表示されるので: + + Type number and <Enter> (empty cancels): ~ + +"2" を入力して <Enter> を押し、二番目のファイルを開きます。 + +詳細は |:oldfiles|、|v:oldfiles|、|c_#<| を参照してください。 + + +他の Vim に情報を移動する +------------------------- + +":wviminfo" コマンドと ":rviminfo" コマンドを使うと、Vim の実行中でも viminfo +ファイルの保存と復元ができます。例えば、他の Vim からレジスタの内容をコピーす +ることができます。片方の Vim で次のようにして保存し: > + + :wviminfo! ~/tmp/viminfo + +もう一方の Vim でそれを読み込みます: > + + :rviminfo! ~/tmp/viminfo + +言うまでもなく、"w" は "write"、"r" は "read" の意味です。 +既存のファイルに上書きするときは、":wviminfo" に ! を付けてください。! を指定 +しなかった場合は、現在の情報と既存のファイルの情報がマージされます。 +":rviminfo" に ! を付けると、ファイルのすべての情報が使われます。つまり、現在 +の情報が上書きされます。! を指定しなかった場合は、まだ設定されていない情報だけ +が使われます。 +これらのコマンドを使えば、状態を保存しておいて後で再利用することもできます。例 +えば、viminfo 専用のディレクトリに状態を保存しておき、目的ごとに使い分けること +も可能です。 + +============================================================================== +*21.4* セッション + +作業が終わらない内に一日が終わってしまった場合、その日の作業を中断し、次の日に +同じ状態で作業を再開できたら便利ですよね。編集セッションを保存しておけば、作業 +状態を復元することができます。 +セッションには、作業状態に関するすべての情報が保存されます。例えば、ファイルリ +スト、ウィンドウレイアウト、グローバル変数、オプションの設定などです。(正確に +は、下記で説明されている 'sessionoptions' に指定された項目が保存されます。) +次のコマンドでセッションファイルを作成できます: > + + :mksession vimbook.vim + +セッションを復元するには、次のコマンドを使います: > + + :source vimbook.vim + +Vim の起動と同時にセッションを再開するには、次のようにして Vim を起動します: > + + vim -S vimbook.vim + +Vim が起動し、指定したファイルが読み込まれます。'S' はセッション (Session) の +意味です (実際には、-S には Vim script ならなんでも指定できるので、"source" を +意味しているとも言えます)。 + +以前に開いていたウィンドウが、同じ場所、同じ大きさで作成されます。マップやオプ +ションの設定も復元されます。 +復元される情報は 'sessionoptions' オプションで設定できます。初期設定は +"blank,buffers,curdir,folds,help,options,winsize" です。 + + blank 空のウィンドウ + buffers すべてのバッファ (ウィンドウに表示されていないバッファ + も含む) + curdir カレントディレクトリ + folds 折り畳み (手動で設定したものも含む) + help ヘルプウィンドウ + options すべてのオプションとマップ + winsize ウィンドウの大きさ + +好きなように設定してください。例えば、Vim ウィンドウの大きさも復元したい場合 +は、次のようにします: > + + :set sessionoptions+=resize + + +こっちにもセッション、あっちにもセッション +------------------------------------------ + +セッションは、複数のプロジェクトで仕事をするときなどに使われます。 +例えば、"~/.vim" にセッションファイルを保存するとします。そして、"secret" プロ +ジェクトで作業している最中に、"boring" プロジェクトで作業する必要がでてきまし +た: > + + :wall + :mksession! ~/.vim/secret.vim + :source ~/.vim/boring.vim + +最初に、":wall" ですべてのファイルを保存します。次に、現在のセッションを +":mksession!" で保存します。以前のセッション情報が上書きされました。後で +secret セッションをロードすると今現在の状態から作業を再開できます。最後に、 +"boring" セッションをロードします。 + +ヘルプを開いたり、ウィンドウを分割したり閉じたりして、ウィンドウレイアウトが乱 +れてしまった場合、セッションをロードし直せば元に戻せます: > + + :source ~/.vim/boring.vim + +毎回新しいセッションを保存するか、あるいは最初に保存したセッションを使い続ける +かは自由に選択できます。 +セッションには他の使い方もあります。例えば、好みのウィンドウレイアウトをセッ +ションに保存しておけば、いつでも好きなときにそのレイアウトに戻ることができま +す。 +例えば、このようなレイアウトは使いやすいでしょう: + + +----------------------------------------+ + | VIM - main help file | + | | + |Move around: Use the cursor keys, or "h| + |help.txt================================| + |explorer | | + |dir |~ | + |dir |~ | + |file |~ | + |file |~ | + |file |~ | + |file |~ | + |~/=========|[No File]===================| + | | + +----------------------------------------+ + +ヘルプウィンドウが上部に表示され、いつでも参照できます。左端の縦長のウィンドウ +はファイルエクスプローラーという Vim のプラグインです。ディレクトリのファイル +一覧を表示し、その中からファイルを選択して開くことができます。詳しくは次章で説 +明します。 +このようなウィンドウを作るには、Vim を起動してから次のコマンドを実行します: > + + :help + CTRL-W w + :vertical split ~/ + +ウィンドウの大きさを調節し、セッションを保存してください: > +> + :mksession ~/.vim/mine.vim + +これで、同じレイアウトで Vim を起動できます: > + + vim -S ~/.vim/mine.vim + +Hint: エクスプローラーでファイルを選択し、空のウィンドウでファイルを開くには、 +ファイル名の場所にカーソルを移動して "O" を押します。マウスのダブルクリックで +も同じ動作になります。 + + +UNIX と MS-WINDOWS +------------------ + +MS-Windows と Unix を両方使わなければならない人もいるでしょう。そのような人は、 +'sessionoptions' に "slash" と "unix" を追加した方がいいかもしれません。その設 +定で保存されたセッションファイルはどちらのシステムでも使えます。次のコマンドを +vimrc ファイルに追加してください: > + + :set sessionoptions+=unix,slash + +セッションファイルが Unix 形式で保存されるようになります。MS-Windows の Vim は +Unix 形式のセッションファイルを読み書きできますが、Unix の Vim は MS-Windows +形式のセッションファイルを読み込むことができません。同様に、MS-Windows の Vim +は / で区切られたファイル名を処理できますが、Unix の Vim は \ を処理できませ +ん。 + + +セッション と viminfo +--------------------- + +セッションファイルにはたくさんの情報が保存されますが、マークやレジスタ、コマン +ドライン履歴などは保存されません。それらの情報を保存するには viminfo を使って +ください。 +セッションと viminfo は分けて使うことが多いと思います。他のセッションに切り換 +えてもコマンドライン履歴をそのまま残すことができますし、テキストをレジスタにヤ +ンクし、他のセッションでペーストするということもできます。 +セッションと viminfo を同時に使いたい場合は、自分で保存してください。例: > + + :mksession! ~/.vim/secret.vim + :wviminfo! ~/.vim/secret.viminfo + +復元するには次のようにします: > + + :source ~/.vim/secret.vim + :rviminfo! ~/.vim/secret.viminfo + +============================================================================== +*21.5* ビュー + +セッションは Vim 全体の表示設定を扱います。一つのウィンドウに関する設定だけ保 +存したい場合は、ビューを使います。 +ビューは、ファイルごとに表示設定を変更したい場合に使います。例えば、'number' +を設定して行番号を表示し、いくつかの折り畳みを定義した場合に、その情報を保存し +て、後で復元することができます。実際のところ、セッションには、各ウィンドウの +ビューが保存されているのです。 +ビューの使い方は二つあります。一つは、ビューファイルの名前を Vim に決めさせる +方法です。保存したビューは、同じ名前のファイルを開いているときに復元できます。 +カレントウィンドウのビューを保存するには、次のコマンドを使います: > + + :mkview + +ビューを保存する場所は自動的に決定されます。後で同じファイルを開いたときに、次 +のコマンドでビューを復元できます: > + + :loadview + +簡単ですね。 +さて、同じファイルを違う設定で表示してみましょう。'number' オプションをオフに +設定、あるいは折り畳みをすべて開き、ウィンドウの表示を変更してみます。そして、 +次のコマンドでビューを保存します: > + + :mkview 1 + +当然、次のようにして復元します: > + + :loadview 1 + +これで、":loadview" と ":loadview 1" を使って、同じファイルの二つのビューを切 +り替えられるようになりました。 +ファイル一つにつき、番号なしのビューと、1 から 9 までの 9 個のビュー、合わせて +10 個のビューが使えます。 + + +名前付きのビュー +---------------- + +ビューのもう一つの使用方法は、指定したファイルにビューを保存する方法です。この +方法なら、他のファイルを開いていてもビューを復元できます。ビューを復元すると、 +ビューに関連付けられたファイルが開くので、編集するファイルを素早く切り替える方 +法としても使えます。 +例えば、カレントファイルのビューを保存するには、次のようにします: > + + :mkview ~/.vim/main.vim + +次のコマンドで復元できます: > + + :source ~/.vim/main.vim + +============================================================================== +*21.6* モードライン + +ファイル固有の設定を、ファイルを開くたびに設定しても構いませんが、何度も何度も +同じコマンドを入力するのはうんざりですよね。セッションやビューでは同じ設定を他 +人と共有できません。 +そのような場合にはモードラインを使います。モードラインとは、ファイル固有の設定 +をファイル内に記述するための仕組みです。 +例えば、C 言語ファイルのインデントをスペース 4 個分に設定したい場合に使います。 +それには 'shiftwidth' オプションを 4 に設定する必要があるので、モードラインは +次のようになります: + + /* vim:set shiftwidth=4: */ ~ + +この行を、ファイルの先頭または末尾から五行以内のどこかに書いてください。その +ファイルを開くと 'shiftwidth' が自動的に設定されます。他のファイルを開くと、初 +期設定の 8 に戻ります。 +モードラインをファイルヘッダーに書くのが適当な場合はファイルの先頭にモードライ +ンを書きます。テキストファイルなど、モードラインがその内容を邪魔してしまうよう +な場合は末尾に書きます。 + +'modelines' オプションでモードラインの有効範囲を設定できます。ファイルの先頭ま +たは末尾からの行数で指定してください。例えば、10 行にしたい場合は次のように設 +定します: > + + :set modelines=10 + +モードライン機能を無効にするには 'modeline' オプションをオフに設定します。Unix +の root や MS-Windows の Administrator として作業する場合や、信用できないファ +イルを開く場合に設定してください: > + + :set nomodeline + +モードラインは次の書式で書きます: + + any-text vim:set {option}={value} ... : any-text ~ + +モードラインの前後、"any-text" の部分はどんな文字列でも構いません。例えば上述 +の例のように、/* と */ で囲んでコメントにすることができます。 +Vim は " vim:" という部分を見てモードラインを認識します。直前に空白のある +"vim"、または行頭の "vim" だけが認識されます。つまり、例えば "gvim:" は機能し +ません。 +二つのコロン (:) の間には ":set" コマンドを記述します。これは通常の ":set" コ +マンドと同じです。ただし、コロンの前にバックスラッシュ (\) を置く必要がありま +す (バックスラッシュがない場合はそれがモードラインの終端だと認識されます)。 + +例: + + // vim:set textwidth=72 dir=c\:\tmp: use c:\tmp here ~ + +最初のコロンにはバックスラッシュが前置されているので、それは ":set" コマンドの +一部です。二つ目のコロン以降は無視されるので、説明を書くことができます。 + +詳細は |modeline| を参照してください。 + +============================================================================== + +次章: |usr_22.txt| ファイルを探す + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_22.jax b/plugins/vimdoc-ja/doc/usr_22.jax new file mode 100644 index 0000000000..b0f824da4e --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_22.jax @@ -0,0 +1,396 @@ +*usr_22.txt* For Vim バージョン 8.0. Last change: 2016 Dec 13 + + VIM USER MANUAL - by Bram Moolenaar + + ファイルを探す + + +ファイルはどこにでもありますが、どうやって目的のファイルを見つければいいので +しょうか。Vim ではさまざまな方法でディレクトリツリーをブラウズできます。ファイ +ルにジャンプするコマンドもあります。開いたことのあるファイルは後から参照できま +す。 + +|22.1| ファイルブラウザー +|22.2| カレントディレクトリ +|22.3| ファイルを探す +|22.4| バッファリスト + +次章: |usr_23.txt| 特殊なファイルを編集する +前章: |usr_21.txt| 中断と再開 +目次: |usr_toc.txt| + +============================================================================== +*22.1* ファイルブラウザー + +ディレクトリを編集するためのプラグインがあります。試してみましょう: > + + :edit . + +自動コマンドと Vim script の魔法により、ディレクトリの内容がウィンドウに表 +示されます。例えばこんな具合です: + +" ============================================================================ ~ +" Netrw Directory Listing (netrw v109) ~ +" Sorted by name ~ +" Sort sequence: [\/]$,\.h$,\.c$,\.cpp$,*,\.info$,\.swp$,\.o$\.obj$,\.bak$ ~ +" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec ~ +" ============================================================================ ~ +../ ~ +./ ~ +check/ ~ +Makefile ~ +autocmd.txt ~ +change.txt ~ +eval.txt~ ~ +filetype.txt~ ~ +help.txt.info ~ + +次の項目が表示されます: + +1. ブラウジングツールの名前とバージョン番号 +2. 表示しているディレクトリ +3. ソート方法 (name、time、sizeなど) +4. 名前のソート方法 (最初はディレクトリで、続いて *.h、*.c、などなど) +5. ヘルプの表示方法 (<F1>キーを使ってください)。利用可能なコマンド抜粋。 +6. ファイル一覧。"../" は親ディレクトリを示す。 + +構文強調表示が有効な場合は各項目が別々の色で表示され、視認性が上がります。 + +一覧の中はノーマルモードコマンドで移動できます。ファイル名の上にカーソルを動か +して <Enter> を押すとファイルが開きます。もう一度 ":edit ." と入力すればエクス +プローラーに戻れます。CTRL-O で戻ることもできます。 + +ディレクトリ名の上にカーソルを動かして <Enter> を押すと、ファイルブラウザーが +そのディレクトリに移動し、新たなファイル一覧が表示されます。"../" ディレクトリ +の上で <Enter> を押すと上の階層に移動できます。あるいは、"../" までカーソルを +移動しなくても、"-" を押すだけで上の階層に移動できます。 + +<F1> を押すと netrw ファイルブラウザーのヘルプが表示されます。表示は次のような +ものです: > + + 9. Directory Browsing netrw-browse netrw-dir netrw-list netrw-help + + MAPS netrw-maps + <F1>.............ヘルプ.....................................|netrw-help| + <cr>.............ブラウジング...............................|netrw-cr| + <del>............ファイル/ディレクトリを削除................|netrw-delete| + -................親ディレクトリに移動.......................|netrw--| + a................ファイル/ディレクトリを隠す................|netrw-a| + mb...............ディレクトリをブックマークする.............|netrw-mb| + gb...............ブックマークしたディレクトリに移動.........|netrw-gb| + c................表示ディレクトリをカレントディレクトリに...|netrw-c| + d................ディレクトリ作成...........................|netrw-d| + D................ファイル/ディレクトリを削除................|netrw-D| + <c-h>............ファイル/ディレクトリ隠し設定編集..........|netrw-ctrl-h| + i................表示スタイル変更...........................|netrw-i| + <c-l>............最新情報に更新.............................|netrw-ctrl-l| + o................水平分割してファイルを開く.................|netrw-o| + p................プレビューウィンドウを使う.................|netrw-p| + P................プレビューウィンドウで開く.................|netrw-p| + q................ブックマークと履歴を表示する...............|netrw-qb| + r................ソート順序を逆にする.......................|netrw-r| +< (etc) + +<F1> キーを押すと netrw プラグインのヘルプに飛びます。これは通常のヘルプページ +です。|CTRL-]| でタグジャンプして |CTRL-O| で戻ることができます。 + +ファイルを選択してファイルを開きます: (カーソルをファイル名の上に移動してから) + + <enter> カレントウィンドウでファイルを開く |netrw-cr| + o ウィンドウを水平分割してファイルを表示する |netrw-o| + v ウィンドウを垂直分割してファイルを表示する |netrw-v| + p |preview-window| を使う |netrw-p| + P 直前のウィンドウで開く |netrw-P| + t 新しいタブページで開く |netrw-t| + +ノーマルモードでは次のコマンドを使ってブラウザーの表示をコントロールできます: + + i 表示スタイルを変更する (thin, long, wide, tree)。 + long ではファイルのサイズと日付が表示されます。 + s ファイルのソート方法を切り替える。名前、更新時間、サイ + ズでソート可。 + r ソート順序を逆にする。 + +次のようなコマンドもあります: + + c 表示しているディレクトリをカレントディレクトリにする。 + (|g:netrw_keepdir| で動作を変更できます) + R カーソルの下のファイル/ディレクトリの名前を変更する。 + 表示されるプロンプトに新しい名前を入力してください。 + D カーソルの下のファイル/ディレクトリを削除する。確認ダ + イアログが表示されます。 + mb gb ブックマークを設定/ブックマークに移動 + + +次のような Ex コマンドもあります (他にもあります): + + :Explore [directory] カレントディレクトリ、または指定したディレクト + リをブラウズする。 + :NetrwSettings netrw の現在の設定一覧。ヘルプリンク付き。 + +netrw ブラウザーの機能はローカルマシンに限定されません。次のように url を使う +こともできます: (末尾の / は重要) + + :Explore ftp://somehost/path/to/dir/ + :e scp://somehost/path/to/dir/ + +詳細は |netrw-browse| を参照してください。 + +============================================================================== +*22.2* カレントディレクトリ + +シェルと同じように Vim にもカレントディレクトリという概念があります。例えば、 +ホームディレクトリにいるときに "VeryLongFileName" ディレクトリにあるファイルを +開きたい場合、そのまま実行することもできますが: > + + :edit VeryLongFileName/file1.txt + :edit VeryLongFileName/file2.txt + :edit VeryLongFileName/file3.txt + +次のようにすれば、入力が簡単です: > + + :cd VeryLongFileName + :edit file1.txt + :edit file2.txt + :edit file3.txt + +":cd" コマンドでカレントディレクトリを変更できます。現在のカレントディレクトリ +を確認するには ":pwd" コマンドを使います: > + + :pwd + /home/Bram/VeryLongFileName + +直前のカレントディレクトリは記録されているので ":cd -" で元の場所に戻れます。 +例: > + + :pwd + /home/Bram/VeryLongFileName + :cd /etc + :pwd + /etc + :cd - + :pwd + /home/Bram/VeryLongFileName + :cd - + :pwd + /etc + + +ウィンドウローカルディレクトリ +------------------------------ + +ウィンドウを分割した直後、二つのウィンドウは同じカレントディレクトリを使ってい +ます。カレントディレクトリはウィンドウ毎に設定できるので、新しいウィンドウだけ +カレントディレクトリを変更して別の場所で作業できます。これを、ローカルディレク +トリといいます。 > + + :pwd + /home/Bram/VeryLongFileName + :split + :lcd /etc + :pwd + /etc + CTRL-W w + :pwd + /home/Bram/VeryLongFileName + +":lcd" コマンドを使うまでは、すべてのウィンドウが共通のカレントディレクトリを +使っています。一つのウィンドウで ":cd" コマンドを実行すると、他のウィンドウの +カレントディレクトリも変更されます。 +":lcd" を使ってカレントディレクトリを変更したウィンドウは、固有のカレントディ +レクトリを持ちます。固有のカレントディレクトリは、他のウィンドウで ":cd" また +は ":lcd" を使っても変更されません。 +固有のカレントディレクトリを持っているウィンドウで ":cd" コマンドを使うと、再 +び共通のカレントディレクトリを使うようになります。 + +============================================================================== +*22.3* ファイルを探す + +C 言語のファイルを編集していて、次のような行があったとします: + + #include "inits.h" ~ + +"inits.h" を開いて内容を確認したい場合は、カーソルをファイル名の上に動かして、 +次のように入力します: > + + gf + +ファイルが検索され、開かれます。 +ファイルがカレントディレクトリにない場合は 'path' オプションが使われます。この +オプションはディレクトリ名のリストです。指定されたディレクトリからファイルが検 +索されます。 +例えば、"c:/prog/include" にインクルードファイルがある場合は次のコマンドでディ +レクトリを追加できます: > + + :set path+=c:/prog/include + +ディレクトリを絶対パスで指定した場合は、どこで作業していても同じディレクトリが +参照されます。開いているファイル以下のサブディレクトリにインクルードファイルが +ある場合は相対パスを指定してください。相対パスの先頭はドットです: > + + :set path+=./proto + +この場合、ファイルが保存されているディレクトリの "proto" ディレクトリからファ +イルが検索されます。つまり、"inits.h" の上で "gf" を使うと、同じディレクトリの +"inits.h" が検索された後に、"proto/inits.h" が検索されます。 +"./" を付けなかった場合、つまり "proto" と指定した場合は、カレントディレクトリ +の "proto" ディレクトリが検索されます。ファイルのディレクトリとカレントディレ +クトリは意味が異なるので注意してください。 + +ディレクトリの指定方法は他にもあります。'path' オプションのヘルプを参照してく +ださい。 +'isfname' オプションには、ファイル名として使える文字、あるいは使えない文字を設 +定できます (例えば上の例では " 文字がファイル名に含まれてませんね)。 + +ファイルの名前がわかっている場合は、その名前がファイル内で使われていなくても、 +検索することができます: > + + :find inits.h + +'path' オプションを使ってファイルが検索されます。'path' が使われる以外は +":edit" コマンドと同じです。 + +検索したファイルを新しいウィンドウで開くには、"gf" ":find" ではなく "CTRL-W f" +":sfind" を使います。 + + +Vim を起動して 'path' の中からファイルを開くには、次の方法が便利です: > + + vim "+find stdio.h" + +'path' 内の "stdio.h" が検索されます。引数はクォート (") で囲む必要があります +|-+c|。 + +============================================================================== +*22.4* バッファリスト + +Vim では編集中のファイルのことをバッファといいます。バッファはファイルのコピー +です。編集を終えて保存したときに、バッファの内容がファイルに書き込まれます。 +バッファにはファイルのテキストの他に、マークやオプション設定などのファイルに関 +連した情報も記録されます。 + + +隠れバッファ (HIDDEN BUFFERS) +------------ + +例えば、one.txt を編集しているときに two.txt を編集したくなったとします。 +one.txt は変更されているので ":edit two.txt" は使えません。しかも、あなたはま +だ one.txt を保存したくはありません。次のコマンドで解決できます: > + + :hide edit two.txt + +"one.txt" というバッファは画面から消えます。しかしバッファの内容が失われるわけ +ではありません。未保存のテキストはまだ残っています。このようなバッファを隠れ +バッファといいます。 +":hide" コマンドの引数はコマンドです。指定されたコマンドは、'hidden' オプショ +ンがオンに設定されているかのように動作します。もちろん、自分で 'hidden' オプ +ションを設定しても構いません。バッファが破棄されたとき、'hidden' がオンなら、 +そのバッファは隠れバッファになります。 +隠れバッファを使ったときは、すべてのバッファが保存されたのを確認してから Vim +を終了してください。 + + +休眠バッファ (INACTIVE BUFFERS) +------------ + +バッファを閉じてもいくつかの情報は失われずに残ります。バッファリストに入ってい +るバッファの内、画面に表示されず、隠れバッファでもないバッファのことを休眠バッ +ファといいます: + + アクティブバッファ ウィンドウに表示されている。テキストはメモリの中。 + 隠れバッファ 表示されていない。テキストはメモリの中。 + 休眠バッファ 表示されていない。テキストは保持されていない。 + +休眠バッファにはファイル名やマークなどの情報が保存されています。ファイル名が保 +存されているので、編集したことのあるファイルを確認し、それを再び開くことができ +ます。 + + +バッファリストの表示 +-------------------- + +次のコマンドでバッファリストを表示できます: > + + :buffers + +次のコマンドも同じです。コマンドの名前と機能が連想しずらいかもしれませんが、入 +力は簡単です: > + + :ls + +コマンドの出力例: + + 1 #h "help.txt" line 62 ~ + 2 %a + "usr_21.txt" line 1 ~ + 3 "usr_toc.txt" line 1 ~ + +行頭の数字はバッファ番号です。バッファを開くときに名前の代わりにバッファ番号を +指定することもできます。下記参照。 +バッファ番号に続いてフラグ、ファイル名、最後にカーソルが位置していた行番号、が +表示されます。 +フラグ部分には以下の文字が (左から右へ) 表示されます。 + + u 非列挙バッファ (|unlisted-buffer|)。 + % カレントバッファ。 + # オルタネートバッファ。 + a テキストを持っている。表示されている。 + h テキストを持っている。隠れバッファ。 + = 読み込み専用。 + - 変更不可 ('modifiable' オプションがオフ)。 + + 変更あり。 + + +バッファを開く +-------------- + +バッファ番号を指定してバッファを開くことができます。ファイル名を入力する必要は +ありません: > + + :buffer 2 + +しかし、バッファ番号を知るためにはバッファリストを表示しなければなりません。名 +前の一部分だけを指定して開くこともできます: > + + :buffer help + +指定された名前に近いバッファが検索され、名前が一致したバッファが一つだけなら、 +そのバッファが使われます。この例なら "help.txt" など。 +バッファを新しいウィンドウで開くには、次のコマンドを使います: > + + :sbuffer 3 + +もちろん名前も指定できます。 + + +バッファリストを使う +-------------------- + +次のコマンドでバッファリストの中を移動できます: + + :bnext 次のバッファを開く + :bprevious 前のバッファを開く + :bfirst 最初のバッファを開く + :blast 最後のバッファを開く + +次のコマンドでバッファリストからバッファを削除できます: > + + :bdelete 3 + +もちろん名前も指定できます。 +アクティブバッファ (ウィンドウに表示されているバッファ) を削除すると、表示して +いたウィンドウも閉じます。カレントバッファを削除するば、カレントウィンドウが閉 +じます。ウィンドウが一つしかなかった場合は、他のバッファに切り替わります。何も +ないを開くことはできません! + + Note: + ":bdelete" でバッファを削除してもバッファの情報は失われません。バッ + ファが "unlisted" 状態になり、":buffers" コマンドで表示されなくなるだ + けです。":buffers!" コマンドを使えば unlisted バッファも表示されます + (そう、Vim は不可能を可能にするのです)。バッファの情報を完全に消去する + には ":bwipe" を使ってください。'buflisted' オプション参照。 + +============================================================================== + +次章: |usr_23.txt| 特殊なファイルを編集する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_23.jax b/plugins/vimdoc-ja/doc/usr_23.jax new file mode 100644 index 0000000000..c51c6aeb40 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_23.jax @@ -0,0 +1,336 @@ +*usr_23.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + VIM USER MANUAL - by Bram Moolenaar + + 特殊なファイルを編集する + + +この章では特殊なファイルの編集について説明します。圧縮ファイルや暗号化された +ファイルを編集できます。多少不便ですが、バイナリファイルも編集できます。イン +ターネット越しにファイルアクセスする方法も説明します。 + +|23.1| DOS、Mac、Unix形式のファイル +|23.2| インターネット上のファイル +|23.3| 暗号化 +|23.4| バイナリファイル +|23.5| 圧縮ファイル + +次章: |usr_24.txt| 効率的な入力 +前章: |usr_22.txt| ファイルを探す +目次: |usr_toc.txt| + +============================================================================== +*23.1* DOS、Mac、Unix形式のファイル + +その昔、旧いテレタイプマシンは改行のために二つの文字を使っていました。一つ目の +文字 (キャリッジリターン。<CR>) でキャリッジを初期位置に戻し、二つ目の文字 (ラ +インフィード。<LF>) で用紙を送っていたのです。 +コンピュータが登場した頃は記憶装置がとても高価だったので、改行のために二文字も +使う必要はないと考える人たちがいました。UNIX の人々は <LF> だけを使って改行す +ることに決めました。Apple の人々は <CR> を標準としました。MS-DOS (と Microsoft +Windows) の人々は <CR><LF> を使い続けました。 +このような事情により、異なるシステム間でファイルを交換するときには改行文字の非 +互換が問題になります。Vim はファイル形式を自動的に認識し、それを適切に処理する +ことができます。 +'fileformats' オプションを設定して使用するファイル形式を指定してください。例え +ば、最初に Unix 形式を試し、次に MS-DOS 形式を試すには、次のように設定します: +> + :set fileformats=unix,dos + +ファイルを開いたときのメッセージにファイル形式が表示されることがあります。シス +テム標準のファイル形式だった場合は表示されません。例えば、Unix で Unix 形式の +ファイルを編集するときに注意は必要ないでしょう。しかし、DOS 形式のファイルな +ら注意が必要です。次のようなメッセージが表示されます: + + "/tmp/test" [dos] 3L, 71C ~ + +Mac 形式なら "[mac]" と表示されます。 +ファイル形式は 'fileformat' オプションに設定されます。現在のファイル形式を確認 +するには、次のコマンドを使います: > + + :set fileformat? + +Vim では次の3つの名前が使われます: + + unix <LF> + dos <CR><LF> + mac <CR> + + +Mac 形式を使う +-------------- + +Unix では <LF> が改行文字です。行の途中に <CR> 文字がくることは普通はありませ +ん。ただし、Vi (と Vim) のスクリプトでは <CR> 文字が使われることがあります。 +Macintosh では <CR> が改行文字なので、行の途中に <LF> 文字を使うことができま +す。 +つまり、<CR> と <LF> を両方含んでいるファイルは、ファイル形式を 100% 確実に判 +別することはできません。 +そのため、Unix では Mac 形式の改行はチェックされません。おそらく、Unix で Mac +形式のファイルを編集することはあまりないでしょう。どうしても Mac 形式のファイ +ルを使いたい場合は 'fileformats' オプションに "mac" を追加してください。 > + + :set fileformats+=mac + +これで、Mac 形式の改行が認識されるようになります。ただし、正しく認識できないこ +とがあるので注意してください。 + + +ファイル形式を指定する +---------------------- + +古き良き Vi で MS-DOS 形式のファイルを開くと、すべての行末に ^M が付きます。 +(^M = <CR>)。Vim では改行が自動認識されるので、そのようなことにはなりません。 +敢えて昔の動作を再現したい場合は、ファイル形式を指定してください: > + + :edit ++ff=unix file.txt + +"++" に続いてオプション名を指定することで、コマンドの設定を変更できます。 +'fileformat' なら "++ff" です。もちろん "++ff=mac" または "++ff=dos" と設定す +ることもできます。 +この方法ではすべてのオプションを設定できません。現在のところ "++ff" と "++enc" +だけが実装されています。"++fileformat" や "++encoding" のようにフルネームでも +指定できます。 + + +ファイル形式の変換 +------------------ + +'fileformat' オプションを使ってファイル形式を変換できます。例えば、README.TXT +を MS-DOS 形式から UNIX 形式に変換してみます。まず、MS-DOS 形式のファイルを開 +きます: > + + vim README.TXT + +ファイル形式は自動的に認識されます。では、ファイル形式を変換しましょう: > + + :set fileformat=unix + :write + +ファイルは Unix 形式で保存されます。 + +============================================================================== +*23.2* インターネット上のファイル + +誰かがあなたにメールを出しました。メールには URL が書いてあります。例: + + そのことならここに情報があったよ。 ~ + ftp://ftp.vim.org/pub/vim/README ~ + +他のプログラムを使ってファイルをダウンロードし、それを Vim で開いても構いませ +んが、もっと簡単な方法があります。カーソルを URL の上に移動して次のコマンドを +入力してください。 > + + gf + +運が良ければ、ダウンロード用のプログラムが実行され、ダウンロードされたファイル +が開かれます。新しいウィンドウで開きたい場合は "CTRL-W f" を使ってください。 +ダウンロードが失敗してエラーメッセージが表示された場合は、次のような原因が考え +られます。 + - URL が間違っている。 + - アクセス権限がない。 + - ネットワークがダウンしている。 + - その他。 +残念ながら、エラーの原因を把握するのは非常に困難です。エラーが起きた場合は手作 +業でファイルをダウンロードしてください。 + +インターネット経由のファイルアクセスは netrw プラグインによって実行されます。 +現在、以下の形式の URL が認識可能です。 + + ftp:// ftp を使う + rcp:// rcp を使う + scp:// scp を使う + http:// wget を使う (読込専用) + +Vim 自身は通信機能を持っていません。インターネットアクセスは外部プログラムを +使って実行されます。"ftp" と "rcp" はほとんどの Unix システムで利用できるはず +です。"scp" と "wget" は別途インストールする必要があるかもしれません。 + +":edit" や ":split" などのコマンドでファイルを開くときにも URL を指定できます。 +もちろん保存もできます (http:// は不可)。 + +パスワードの指定方法など、詳細は|netrw|を参照してください。 + +============================================================================== +*23.3* 暗号化 + +情報を秘密にしたいことがあると思います。例えば、生徒と共有のコンピュータを使っ +てテストを作成している場合、賢い生徒にテスト問題を盗み見られてしまうようでは困 +ります。Vim の暗号化機能を使って情報を保護しましょう。 +ファイルを暗号化するには、Vim の起動引数に "-x" を指定します。例: > + + vim -x exam.txt + +プロンプトが表示されるので、ファイルを暗号化または複号するための鍵を入力してく +ださい: + + 暗号化用のキーを入力してください: ~ + +慎重に秘密鍵を入力してください。入力した文字は表示されません。代わりにスター +(*) が表示されます。入力ミスがあると大変なので、念のため、もう一度同じ鍵を入力 +してください: + + もう一度同じキーを入力してください: ~ + +ファイルの編集方法は通常のファイルと同じです。秘密にしたいことを書き込んでくだ +さい。ファイルを保存すると、暗号化されて保存されます。 +次にそのファイルを Vim で開くと、鍵を入力するためのプロンプトが表示されます。 +既に暗号化されたファイルを開くときは "-x" 引数を指定する必要はありません。通常 +の ":edit" コマンドで開くこともできます。暗号化ファイルにはマジック文字列が埋 +め込まれているので、Vim は暗号化ファイルを認識できます。 +他のプログラムで暗号化ファイルを開くと、ゴミが表示されます。たとえ Vim で開い +たとしても、不正な鍵を使った場合は、やはりゴミが表示されます。鍵が正しいかどう +かを判断する機能は Vim にはありません (暗号をより強固なものにするため)。 + + +暗号化と解除 +------------ + +ファイルの暗号化を解除するには、'key' オプションに空文字を設定します: > + + :set key= + +空に設定してからファイルを保存すると、暗号化されずに保存されます。 +'key' オプションに鍵を設定すれば暗号化を有効にできますが、それは安全ではありま +せん。パスワードがコマンドラインに表示されるので、肩越しに盗み見られてしまいま +す。 +安全に暗号化を有効にするには、":X" コマンドを使ってください。"-x" 引数を使った +ときと同じプロンプトが表示されます: > + + :X + 暗号化用のキーを入力してください: ****** + もう一度同じキーを入力してください: ****** + + +暗号化の限界 +------------ + +Vim の暗号アルゴリズムは脆弱です。いたずら小僧を撃退するには十分ですが、暗号エ +キスパートのハックには耐えられません。さらに、スワップファイルが暗号化されない +ことにも注意が必要です。ファイルを編集している間、スーパーユーザー権限さえあれ +ば誰でも平文のスワップファイルを読むことができます。 +スワップファイルを使わないというのも一つの手です。起動引数に "-n" を指定すれ +ば、スワップファイルは作成されなくなります (代わりにメモリが使われます)。例え +ば、暗号化した "file.txt" をスワップファイル無しで開くには、次のコマンドを使い +ます: > + + vim -x -n file.txt + +既にファイルを編集中なら、次のコマンドでスワップファイルを無効にできます: > + + :setlocal noswapfile + +スワップファイルが無いということは、リカバリできないということです。普段よりま +めにファイルを保存し、クラッシュによるリスクを抑えましょう。 + +メモリ上のファイルは暗号化されていません。権限さえあれば誰でもエディタのメモリ +を調べてファイルの内容を知ることができます。 +viminfo ファイルを使っている場合、レジスタの中身が平文で保存されることにも注意 +が必要です。 +本気でファイルを秘密にしたいなら、ネットワークから切り離したマシンで作業し、強 +力な暗号化ツールを使い、そのマシンを使わないときは金庫に入れておきましょう。 + +============================================================================== +*23.4* バイナリファイル + +Vim はバイナリファイルを編集できます。専用ツールではないので若干の制限はありま +すが、ファイルを読み込み、編集し、保存できます。 +Vim の便利な (そして今は邪魔な) 機能を無効にするために、"-b" 引数を付けて Vim +を起動してください: > + + vim -b datafile + +'binary' オプションがオンになります。これにより、余計な機能が無効になります。 +例えば、'textwidth' が 0 に設定され、自動整形が無効になります。そして、ファイ +ルは Unix 形式で読み込まれます。 + +バイナリモードを使うと、例えば実行ファイルのメッセージを変更できます。ただし、 +文字を挿入したり削除したりするとプログラムが動かなくなってしまうので注意してく +ださい。"R" コマンドの置換モードを使いましょう。 + +バイナリファイルには非印字可能文字がたくさんあります。これを 16 進数で表示する +には、次のように設定してください: > + + :set display=uhex + +あるいは、調べたい文字にカーソルを移動して "ga" コマンドを使います。例えば、 +<Esc> の上で "ga" を実行すると、次のように表示されます: + + <^[> 27, Hex 1b, Octal 033 ~ + +ファイルに含まれている改行コードが少ない場合、'wrap' オプションをオフにすると +全体をざっくり眺めることができます: > + + :set nowrap + + +バイト位置 +---------- + +次のコマンドで現在のカーソル位置をバイト単位で表示できます: > + + g CTRL-G + +冗長なメッセージが表示されます: + + 列 9-16 / 9-16; 行 277 / 330; 単語 1806 / 2058; バイト 10580 / 12206 ~ + +末尾の数字に注目してください。カーソルの位置とファイルの大きさがバイト単位で表 +示されています。'fileformat' の設定による改行の種類もちゃんと考慮されています。 +指定したバイト位置に移動するには "go" コマンドを使います。例えば、2345 バイト +目に移動するには、次のようにします: > + + 2345go + + +XXDを使う +--------- + +本物のバイナリエディタは、テキスト表示と 16 進表示の二通りの方法でファイルを表 +示します。"xxd" を使ってファイルを変換すれば Vim でも同じように表示できます。 +"xxd" は Vim に付属しています。 +まず、ファイルをバイナリモードで開いてください: > + + vim -b datafile + +そして、xxd を使って16進数ダンプ形式に変換します: > + + :%!xxd + +テキストは次のように変換されます: + + 0000000: 1f8b 0808 39d7 173b 0203 7474 002b 4e49 ....9..;..tt.+NI ~ + 0000010: 4b2c 8660 eb9c ecac c462 eb94 345e 2e30 K,.`.....b..4^.0 ~ + 0000020: 373b 2731 0b22 0ca6 c1a2 d669 1035 39d9 7;'1.".....i.59. ~ + +あとは、好きなようにテキストを編集してください。普通のテキストを編集するのと同 +じです。16 進数部分を変更しても、テキスト部分は更新されません。逆も同様です。 +編集が済んだら変換し、テキストに戻します: > + + :%!xxd -r + +16 進数部分への変更だけが反映されます。右側のテキスト部分への変更は無視されま +す。 + +詳細は xxd のマニュアルを参照してください。 + +============================================================================== +*23.5* 圧縮ファイル + +これは簡単です。圧縮ファイルを編集するのに特別な操作は必要ありません。ただファ +イルを開くだけです。"gzip" プラグインが展開の面倒をみてくれます。ファイルを保 +存すれば勝手に圧縮してくれます。 +現在、以下の圧縮形式がサポートされています: + + .Z compress + .gz gzip + .bz2 bzip2 + +実際の圧縮と展開には上記のプログラムが使われます。無い場合は別途インストールし +てください。 + +============================================================================== + +次章: |usr_24.txt| 素早く入力する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_24.jax b/plugins/vimdoc-ja/doc/usr_24.jax new file mode 100644 index 0000000000..3d06a4a11d --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_24.jax @@ -0,0 +1,596 @@ +*usr_24.txt* For Vim バージョン 8.0. Last change: 2006 Jul 23 + + VIM USER MANUAL - by Bram Moolenaar + + 素早く入力する + + +テキストを入力するときに、キーストロークを減らしたり入力ミスを防いだりする方法 +がいくつかあります。補完機能を使えば以前に入力した単語を繰り返し入力できます。 +長い単語を短縮形で入力することもできます。キーボードに無い文字を入力する方法も +あります。 + +|24.1| 修正する +|24.2| 対応する括弧を表示する +|24.3| 補完 +|24.4| 挿入を繰り返す +|24.5| 隣の行からコピーする +|24.6| レジスタを挿入する +|24.7| 短縮形 +|24.8| 特殊な文字を入力する +|24.9| ダイグラフ (Digraph) +|24.10| ノーマルモードコマンド + +次章: |usr_25.txt| テキストの整形 +前章: |usr_23.txt| 特殊なファイルを編集する +目次: |usr_toc.txt| + +============================================================================== +*24.1* 修正する + +<BS> キーは既に説明しましたね。<BS> はカーソル直前の文字を削除します。<Del> +キーはカーソルの下(後)の文字を削除します。 +直前の単語をまるごと削除したい場合は CTRL-W を使います: + + The horse had fallen to the sky ~ + CTRL-W + The horse had fallen to the ~ + +行全体を削除して行頭から入力しなおしたい場合は CTRL-U を使います。カーソルより +後ろの文字とインデントは削除されません。最初の非空白文字からカーソルまでのテキ +ストだけが削除されます。例えば、カーソルが "fallen" の "f" にある場合、CTRL-U +を押すと次のようになります: + + The horse had fallen to the ~ + CTRL-U + fallen to the ~ + +何個か前の単語だけを修正したい場合はカーソルを動かす必要があります。例えば、次 +のように入力してから: + + The horse had follen to the ground ~ + +途中にある "follen" を "fallen" に修正してみます。カーソルが末尾にある場合、次 +のように入力すれば修正できます: > + + <Esc>4blraA + +< 挿入モードを抜ける <Esc> + 4 単語戻る 4b + 最初の "o" に移動する l + "a" に置換する ra + 行末に移動して挿入モードを再開 A + +他の方法もあります: > + + <C-Left><C-Left><C-Left><C-Left><Right><Del>a<End> + +< 4 単語戻る。 <C-Left><C-Left><C-Left><C-Left> + 最初の "o" に移動する <Right> + "o" を削除する <Del> + "a" を挿入する a + 行末に移動する <End> + +挿入モードの中で特殊キーを使って移動しています。これは普通のモードレスエディタ +の操作と似ています。操作方法は覚えやすいかもしれませんが少し面倒です (カーソル +キーを押すには手をホームポジションから離さなければならないし、<End> キーを押す +にはキーボードに視線を移さなければならない)。 +特殊キーは挿入モードの中で使えるのでマップを書くときに重宝します。マップの中で +使う分には入力が面倒になることもありません。 +挿入モードでは次の特殊キーが使えます: + + <C-Home> ファイルの先頭に移動 + <PageUp> 1 画面分、逆スクロール + <Home> 行頭へ移動 + <S-Left> 1 単語左へ移動 + <C-Left> 1 単語左へ移動 + <S-Right> 1 単語右へ移動 + <C-Right> 1 単語右へ移動 + <End> 行末へ移動 + <PageDown> 1 画面分、スクロール + <C-End> ファイルの末尾に移動 + +使えるキーは他にもあります。|ins-special-special| 参照。 + +============================================================================== +*24.2* 対応する括弧を表示する + +")" を入力したときに、対応する "(" の場所を確認できたら便利ですよね。次のコマ +ンドでそのように設定できます: > + + :set showmatch + +例えば "(example)" と入力したとき、")" を入力した瞬間に、対応する括弧にカーソ +ルが移動します。カーソルは 0.5 秒くらいその場所に留まり、再び元の場所に帰って +きます。 +対応する括弧が見つからなかった場合はビープ音が鳴ります。そのときは、( を入力し +忘れてないか、) を入力し過ぎてないか、確認しましょう。 +この機能は、[] や {} の組み合わせにも対応しています。カーソルが移動していると +きに、戻ってくるまで次の入力を待つ必要はありません。次の文字を入力した瞬間に +カーソルは元に戻るので、すぐに入力を再開できます。 +カーソルが移動先で待機する時間は 'matchtime' オプションで設定できます。例えば、 +1.5 秒待機するには次のように設定します: > + + :set matchtime=15 + +時間は 1/10 秒単位で指定してください。 + +============================================================================== +*24.3* 補完 + +テキストの中から単語を検索して補完することができます。単語の出だしを入力して +CTRL-P を押すと、残りの部分が入力されます。 +例えば、C プログラムを書いていて、次のように入力したいとします: + + total = ch_array[0] + ch_array[1] + ch_array[2]; ~ + +まず、次のように入力してください: + + total = ch_array[0] + ch_ ~ + +ここで、CTRL-P コマンドを使って単語を補完します。カーソル直前の文字列にマッチ +する単語が検索されます。この場合なら、"ch_" にマッチする単語、つまり +"ch_array" がヒットします。したがって、CTRL-P を押すと次のようになります: + + total = ch_array[0] + ch_array ~ + +続けて入力し、次のようになりました (末尾に空白があります): + + total = ch_array[0] + ch_array[1] + ~ + +さて、ここで CTRL-P を押すと再びカーソル直前の文字列が補完されます。今回は文字 +が無いので、最初に見つかった単語、つまり "ch_array" が補完されます。もう一度 +CTRL-P を押すと、さらに次の候補が補完されます。この場合は "total" です。もう一 +度 CTRL-P を押せばさらに次の候補が補完されます。次の単語が見つからなかった場合 +は元の文字列に戻ります。この例では空文字列です。四度目に CTRL-P を押すと再び最 +初の "ch_array" が補完されます。 + +前方検索する場合は CTRL-N を使います。検索はファイル終端を超えて処理されるの +で、CTRL-N と CTRL-P は順番が違うだけで、同じ単語が検索されます。Hint: CTRL-N +は Next-match (次の候補)、CTRL-P は Previous-match (前の候補) です。 + +単語の補完では、様々な場所から単語を検索できます。初期設定では、次の場所が検索 +されます: + + 1. カレントファイル + 2. 他のウィンドウのファイル + 3. ロードされたファイル (隠しバッファ) + 4. ロードされてないファイル (休眠バッファ) + 5. タグファイル + 6. カレントファイルが #include しているファイル + + +オプション +---------- + +検索場所の順番は 'complete' オプションで設定できます。 + +検索には 'ignorecase' オプションが使われます。このオプションがオンのときは、大 +文字と小文字は区別されません。 + +'infercase' は補完用の特別なオプションです。大文字と小文字を区別しない +('ignorecase' がオンに設定されている) ときでも、自分で入力した文字の種類をその +まま使えます。つまり、"For" と入力して "fortunately" がマッチしたとき、結果は +"Fortunately" になります。 + + +補完タイプの指定 +---------------- + +補完したい単語の種類がわかっている場合は、次のコマンドで補完の種類を指定できま +す: + + CTRL-X CTRL-F ファイル名 + CTRL-X CTRL-L 行全体 + CTRL-X CTRL-D マクロ定義 (インクルードファイルの中も探す) + CTRL-X CTRL-I カレントファイルとインクルードファイル + CTRL-X CTRL-K 辞書 + CTRL-X CTRL-T 同義語辞書 (シソーラス) + CTRL-X CTRL-] タグ + CTRL-X CTRL-V Vim のコマンドライン + +補完を実行した後は、CTRL-N で次の候補、CTRL-P で前の候補を検索できます。 +各コマンドの詳細は |ins-completion| を参照してください。 + + +ファイル名の補完 +----------------- + +例として CTRL-X CTRL-F を使って説明します。これはファイル名を補完するコマンド +です。カレントディレクトリのファイルが検索され、カーソル直前の文字列にマッチす +るファイル名が補完されます。 +例えば、カレントディレクトリに次のファイルがあるとします: + + main.c sub_count.c sub_done.c sub_exit.c + +挿入モードに入って次のように入力します: + + The exit code is in the file sub ~ + +そして、CTRL-X CTRL-F を入力します。カレントディレクトリから "sub" にマッチす +るファイルが検索されます。最初にマッチするのは sub_count.c です。このファイル +は求めているファイルではありませんでした。CTRL-N を押して次の候補を検索しましょ +う。次に sub_done.c がマッチします。もう一度 CTRL-N を押すと sub_exit.c がマッ +チします。結果: + + The exit code is in the file sub_exit.c ~ + +ファイル名の先頭を / (Unix) や C:\ (MS-Windows) で開始すれば、ファイルシステム +全体からファイルを検索できます。例えば、"/u" と入力してから CTRL-X CTRL-F と入 +力すると "/usr" がヒットします (Unix の場合): + + the file is found in /usr/ ~ + +もう一度 CTRL-N を押すと "/u" に戻ってしまいます。"/usr/" を確定してからさらに +深い階層へ進みたい場合は再び CTRL-X CTRL-F を使います: + + the file is found in /usr/X11R6/ ~ + +もちろん、ファイル構成が違えば結果は異なるでしょう。検索結果はアルファベット順 +にソートされます。 + + +ソースコードの補完 + +ソースコードは書式が決まっているので、より賢い補完を実装することができます。 +Vim ではそれをオムニ補完 (Omni completion) と呼びます。某エディタではインテリ +センスと呼ばれていますが、それは商標です。 + +オムニ補完のキーは CTRL-X CTRL-O です。O は Omni の頭文字なので覚えやすいでしょ +う。C 言語のソースを使って説明します: + + { ~ + struct foo *p; ~ + p-> ~ + +カーソルは "p->" の後ろにあります。CTRL-X CTRL-O を押すと、"struct foo" のメン +バが候補として表示されます。これは CTRL-P の補完とはまったく違います。CTRL-P +ではあらゆる単語が候補になりますが、オムニ補完は "struct foo" のメンバだけが補 +完されます。 + +オムニ補完を使うには設定が必要です。最低でもファイルタイププラグインを有効にし +ておく必要があります。vimrc に以下の行を書き加えてください: > + filetype plugin on +または: > + filetype plugin indent on + +C 言語の場合はタグファイルを作成して 'tags' オプションを設定する必要がありま +す。|ft-c-omni| を参照してください。他のファイルタイプでも似たような設定が必要 +になります。|compl-omni-filetypes| を参照してください。オムニ補完は特定のファ +イルタイプでしか利用できません。'omnifunc' オプションを確認し、オムニ補完が利 +用できるかどうか確認してください。 + +============================================================================== +*24.4* 挿入を繰り返す + +CTRL-A を押すと、前回の挿入モードで入力したテキストを挿入できます。 +例えば、次のようなファイルがあったとします: + + "file.h" ~ + /* Main program begins */ ~ + +一行目の行頭に "#include " を挿入します: + + #include "file.h" ~ + /* Main program begins */ ~ + +"j^" コマンドで次の行の行頭に移動し、再び "#include " を挿入してみます。次のよ +うに入力しましょう: > + + i CTRL-A + +結果は次のようになります: + + #include "file.h" ~ + #include /* Main program begins */ ~ + +CTRL-A は前回に入力したテキストを挿入するコマンドなので、"#include " が挿入さ +れました。続けて "main.h"<Enter> と入力し、行を完成させましょう: + + #include "file.h" ~ + #include "main.h" ~ + /* Main program begins */ ~ + +CTRL-@ コマンドは CTRL-A と同じことを実行してから挿入モードを抜けます。まった +く同じ挿入を繰り返したいときに使います。 + +============================================================================== +*24.5* 隣の行からコピーする + +CTRL-Y コマンドを使うと、カーソルの上の文字を挿入できます。一つ上の行を複製し +たい場合に便利です。例えば、次のような C 言語のコードがあるとして: + + b_array[i]->s_next = a_array[i]->s_next; ~ + +"s_next" を "s_prev" に変えただけの同じ行を入力してみます。新しい行を開いて +CTRL-Y を 14 回押して、"next" の "n" の直前まで進みます: + + b_array[i]->s_next = a_array[i]->s_next; ~ + b_array[i]->s_ ~ + +そして "prev" と入力します: + + b_array[i]->s_next = a_array[i]->s_next; ~ + b_array[i]->s_prev ~ + +続けて、次の "next" まで CTRL-Y を押します。 + + b_array[i]->s_next = a_array[i]->s_next; ~ + b_array[i]->s_prev = a_array[i]->s_ ~ + +"prev;" と入力すれば、行が完成です。 + +CTRL-Y と似たコマンドに CTRL-E があります。これはカーソルの下の文字を挿入する +コマンドです。 + +============================================================================== +*24.6* レジスタを挿入する + +CTRL-R {register} コマンドを使うと、レジスタの内容を挿入できます。長い単語を入 +力するのが簡単になります。例えば、次の行を入力したいとします。 + + r = VeryLongFunction(a) + VeryLongFunction(b) + VeryLongFunction(c) ~ + +関数名は別のファイルで定義されています。そのファイルを開いてカーソルを関数名の +先頭に移動し、次のコマンドでレジスタ v にヤンクします: > + + "vyiw + +"v はレジスタの指定、"yiw" は yank-inner-word (単語をヤンクする) です。さて、 +元のファイルに戻り、挿入モードを開始して次のように入力します: + + r = ~ + +ここで、CTRL-R v を押して関数の名前を挿入します: + + r = VeryLongFunction ~ + +続けて関数の引数などを入力し、関数名を入力するときになったら再び CTRL-R v を使 +います。 +同じことは補完を使ってもできますが、同じ文字で始まる単語がたくさんある場合には +レジスタが便利です。 + +レジスタの中に <BS> などの特殊な文字が含まれている場合、その文字は、実際にキー +ボードから入力されたのと同じように処理されます。それが望みの動作ではない場合 +(例えば、<BS> をテキストとして挿入したい場合) は CTRL-R CTRL-R {register} を +使ってください。 + +============================================================================== +*24.7* 短縮形 (Abbreviations) + +短縮形とは長い単語を置き換える短い単語のことです。例えば、"ad" は +"advertisement" の短縮形です。Vim では、入力した短縮形を自動的に展開することが +できます。 +"ad" を "advertisement" の短縮形として登録するには、次のコマンドを使います: > + + :iabbrev ad advertisement + +これで、"ad" と入力すると、完全形の "advertisement" がテキストに挿入されます。 +短縮形の置き換えは、スペースなどの、単語の一部として認識されない文字を入力した +ときに実行されます: + + 入力した文字 画面上での見え方 + I saw the a I saw the a ~ + I saw the ad I saw the ad ~ + I saw the ad<Space> I saw the advertisement<Space> ~ + +"ad" と入力しただけでは展開されません。これは例えば "add" のような単語も入力で +きるようにするためです。単語の境界が確定してから短縮形の展開が適用されます。 + + +複数の単語の短縮形 +------------------ + +複数の単語に展開される短縮形を定義できます。例えば、"JB" を "Jack Benny" の短 +縮形として登録するには、次のコマンドを使います: > + + :iabbrev JB Jack Benny + +プログラムを書くとき、私は少し変った短縮形を使っています: > + + :iabbrev #b /**************************************** + :iabbrev #e <Space>****************************************/ + +これはコメントブロックを作成するときに使います。コメントを開始するときに #b で +最初の行を描き、コメントを書いてから、#e で末尾の行を描きます。#e の展開形がス +ペースで始まっています。別の言い方をすれば、最初の二文字がスペースとスターに +なっています。通常、短縮形と展開形の間の空白は無視されるので、スペースを入れた +い場合は <, S, p, a, c, e, > という 7 文字の特殊な表記を使います。 + + Note: + ":iabbrev" は入力するのが長くて大変なので、":iab" でも構いません。 + これは短縮コマンドの短縮形です! + + +入力ミスを直す +-------------- + +入力ミスの癖ってありますよね。例えば、"the" と入力するはずが "teh" になってし +まったり。短縮形を使って修正しましょう: > + + :abbreviate teh the + +このような短縮形のリストを作成し、入力ミスの癖を見つけたら追加しましょう。 + + +短縮形を一覧表示する +-------------------- + +":abbreviate" コマンドで短縮形の一覧を表示できます: > + + :abbreviate + i #e ****************************************/ + i #b /**************************************** + i JB Jack Benny + i ad advertisement + ! teh the + +行頭の "i" は挿入モードの意味です。その短縮形は挿入モードの中だけで有効です。 +他にも、次のような文字が表示されます: + + c コマンドラインモード :cabbrev + ! 挿入モードとコマンドラインモード :abbreviate + +コマンドラインモードで短縮形が役に立つことはあまりないので、"iabbrev" コマンド +を主に使うことになるでしょう。"iabbrev" なら、次のようなコマンドで "ad" が展開 +される心配はありません: > + + :edit ad + + +短縮形の削除 +------------ + +短縮形を取り除くには ":unabbreviate" コマンドを使います。次のような短縮形が登 +録されているなら: > + + :abbreviate @f fresh + +次のコマンドで削除できます: > + + :unabbreviate @f + +このコマンドを入力すると @f が "fresh" に展開されてしまいますが、心配はいりま +せん。コマンドは正しく処理されます (ただし、"fresh" という別の短縮形が定義され +ている場合は期待した動作になりません。まぁそんなことはほとんどないはずですが)。 +すべての短縮形を削除するには次のコマンドを使います: > + + :abclear + +":unabbreviate" と ":abclear" にも、挿入モード用 (":iunabbreviate" と +":iabclear") とコマンドライン用 (":cunabbreviate" と ":cabclear") があります。 + + +短縮形の再マップ +---------------- + +短縮形を定義するときに注意すべき点がもう一つあります。展開された文字列がマップ +されないようにしなくてはなりません。例をあげましょう: > + + :abbreviate @a adder + :imap dd disk-door + +"@a" を入力すると "adisk-doorer" になってしまいます。これは意図した動作ではな +いはずです。これを避けるには、":noreabbrev" コマンドを使います。":abbreviate" +と機能は同じですが、展開結果にマップが適用されません: > + + :noreabbrev @a adder + +これで、展開結果がマップされなくなります。 + +============================================================================== +*24.8* 特殊な文字を入力する + +CTRL-V コマンドを使うと、その次に入力した文字をそのまま挿入できます。つまり、 +文字の特殊効果が無視されます。例えば、このように入力すると: > + + CTRL-V <Esc> +< +エスケープ文字が挿入されます。挿入モードは終了しません。(CTRL-V の後ろの空白は +見やすくするためのものなので、実際には入力しないでください) + + Note: + MS-Windows では CTRL-V はテキストのペーストに使われています。CTRL-V の + 代わりに CTRL-Q を使ってください。Unixでは逆に一部の端末で CTRL-Q に特 + 別な意味があるので使えないかもしれません。 + +また、CTRL-V {digits} コマンドを使うと、文字コードを 10 進数で指定して、その文 +字を入力できます。例えば、文字コード 127 は <Del> 文字 (<Del> *キー*と同じとは +限りません) です。<Del> を挿入するには次のように入力します: > + + CTRL-V 127 + +同じやりかたで文字コード 255 までの文字を入力できます。文字コードが 2 桁以下の +場合は、数字以外の文字を入力してコマンドを確定してください。 +数字以外の文字を入力したくない場合は、数値が 3 桁になるように 1 つか 2 つの +"0" を数値の前に付けてください。 +次のコマンドはいずれも <Tab> と "." を挿入します: + + CTRL-V 9. + CTRL-V 09. + CTRL-V 009. + +文字コードは 16 進数でも指定できます。その場合は CTRL-V の直後に "x" を指定し +ます: > + + CTRL-V x7f + +この場合もコード 255 (CTRL-V xff) までの文字が入力できます。"o" で 8 進数の数 +値を指定することもできます。他にも "u" と "U" でそれぞれ 16 ビットと 32 ビット +の文字コード (例えば Unicode の文字) を指定できます: > + + CTRL-V o123 + CTRL-V u1234 + CTRL-V U12345678 + +============================================================================== +*24.9* ダイグラフ (Digraph) + +例えば、コピーライト文字 (©) など、キーボードに無い文字がいくつかあります。そ +のような文字を Vim で入力するにはダイグラフを使います。つまり、二文字で一文字 +を表現します。例えば、コピーライト文字 (©) を入力するには、次のようにします: > + + CTRL-K Co + +使用できるダイグラフの一覧を表示するには、次のコマンドを使います: > + + :digraphs + +一部抜粋: + + AC ~_ 159 NS | 160 !I ¡ 161 Ct ¢ 162 Pd £ 163 Cu ¤ 164 Ye ¥ 165 ~ + BB ¦ 166 SE § 167 ': ¨ 168 Co © 169 -a ª 170 << « 171 NO ¬ 172 ~ + -- ­ 173 Rg ® 174 'm ¯ 175 DG ° 176 +- ± 177 2S ² 178 3S ³ 179 ~ + +これを見れば、例えば CTRL-K Pd でポンド記号 (£) が入力できることがわかります。 +文字番号は 163 (10進数) です。 +Pd は Pound (ポンド) の略です。ほとんどのダイグラフには、生成される文字が連想 +しやすい文字が割り当てられています。法則は表を見ればだいたいわかると思います。 +ダイグラフの一文字目と二文字目は逆の順番で入力しても構いません。ただし、その組 +み合わせが他のダイグラフで使われていない場合に限ります。すなわち、CTRL-K dP も +ポンド記号になります。"dP" という組み合わせが他に使われていないので、"Pd" のダ +イグラフが使われるのです。 + + Note: + ダイグラフはユーザーが使っている (と Vim が認識している) 文字セットに + 依存します。MS-DOS の文字セットと MS-Windows の文字セットは違います。 + ":digraphs" を使って、利用可能なダイグラフを確認してください。 + +自分でダイグラフを定義することもできます。例: > + + :digraph a" ä + +CTRL-K a" を入力すると ä になります。文字コードを 10 進数で指定することもでき +ます。次のコマンドは上記のコマンドと同じです: > + + :digraph a" 228 + +ダイグラフについての詳細は |digraphs| を参照してください。 +他にも、キーマップを使って特殊な文字を入力することもできます。詳しくは |45.5| +参照。 + +============================================================================== +*24.10* ノーマルモードコマンド + +挿入モードで使えるコマンドはそれほど多くありませんが、ノーマルモードにはたくさ +んのコマンドがあります。それらのコマンドを使うには <Esc> で挿入モードを抜けて、 +ノーマルモードコマンドを実行し、"i" または "a" で挿入モードに戻ってこなければ +なりません。 +もっと簡単な方法があります。CTRL-O {command} を使えばノーマルモードコマンドを +挿入モードの中で実行できます。例えば、次のコマンドでカーソル位置から行末まで削 +除できます: > + + CTRL-O D + +この方法で実行できるのは一つのコマンドだけです。ただし、レジスタやカウントの指 +定はできます。もう少し複雑な例: > + + CTRL-O "g3dw + +三つの単語を削除してレジスタ g に格納します。 + +============================================================================== + +次章: |usr_25.txt| テキストの整形 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_25.jax b/plugins/vimdoc-ja/doc/usr_25.jax new file mode 100644 index 0000000000..5845e6351f --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_25.jax @@ -0,0 +1,570 @@ +*usr_25.txt* For Vim バージョン 8.0. Last change: 2016 Mar 28 + + VIM USER MANUAL - by Bram Moolenaar + + テキストの整形 + + +文章を一行に一文ずつ書くようなことはほとんどありません。この章では、テキストが +画面に収まるように整形する方法などを説明します。 +一行段落や表を編集するための便利な機能もあります。 + +|25.1| 行を改行する +|25.2| テキストの位置揃え +|25.3| インデントとタブ +|25.4| 長い行の扱い +|25.5| 表の編集 + +次章: |usr_26.txt| 繰り返し +前章: |usr_24.txt| 素早く入力する +目次: |usr_toc.txt| + +============================================================================== +*25.1* 行を改行する + +文章を快適に編集するための機能がいくつかあります。初期設定では行は自動的に改行 +されません。つまり自分で <Enter> を押す必要があります。プログラムを書くときは +その方が便利ですが、ドキュメントを書くときは少し不便です。文章が 70 桁の幅に収 +まるように自分で整形するのは大変でしょう。 +'textwidth' オプションを設定すると、行が自動的に改行されるようになります。例え +ば、30 桁の幅で文章を書きたい場合は次のように設定します: > + + :set textwidth=30 + +そして、テキストを入力します (上の数字はルーラーです): + + 1 2 3 + 12345678901234567890123456789012345 + I taught programming for a whi ~ + +次に "l" を入力すると一行が 30 桁の制限を超えるので、自動的に改行が挿入されま +す。その結果、次のようになります: + + 1 2 3 + 12345678901234567890123456789012345 + I taught programming for a ~ + whil ~ + +そのまま続けて文章の残りを入力しましょう: + + 1 2 3 + 12345678901234567890123456789012345 + I taught programming for a ~ + while. One time, I was stopped ~ + by the Fort Worth police, ~ + because my homework was too ~ + hard. True story. ~ + +自分で改行する必要はありません。改行は自動的に挿入されます。 + + Note: + 'wrap' オプションを使うと長い行を改行して表示できますが、実際に改行文 + 字が挿入されるわけではありません。 + + +再整形 +------ + +Vim はワードプロセッサーではありません。ワードプロセッサーなら、段落の最初の +方で文字を削除すると、改行の位置が調整されますが、Vim は違います。つまり、一 +行目の "programming" を削除すると、単にその行が短くなるだけです: + + 1 2 3 + 12345678901234567890123456789012345 + I taught for a ~ + while. One time, I was stopped ~ + by the Fort Worth police, ~ + because my homework was too ~ + hard. True story. ~ + +これはよくありません。"gq" オペレータを使って段落を整形しましょう。 +まず、ビジュアルモードを使ってやってみます。一行目に移動して次のように入力しま +す: > + + v4jgq + +"v" はビジュアルモードの開始、"4j" で段落の最後まで移動し、"gq" オペレータを実 +行します。結果: + + 1 2 3 + 12345678901234567890123456789012345 + I taught for a while. One ~ + time, I was stopped by the ~ + Fort Worth police, because my ~ + homework was too hard. True ~ + story. ~ + +Note: 特定の書式に従った文章なら自動的に整形することもできます。 +|auto-format| 参照。 + +"gp" はオペレータなので、ビジュアルモード、カーソルモーション、テキストオブジェ +クト、の三つの方法で適用範囲を選択できます。 +上記の例は "gq4j" とすることもできます。これはコマンドは短くなりますが、行数を +数えないといけません。"}" というモーションコマンドを使えばもっと簡単です。これ +は段落の末尾に移動するコマンドです。"gq}" でカーソル位置から段落の末尾までが整 +形されます。 +テキストオブジェクトを使うともっと簡単にできます: > + + gqap + +"ap" は "a-paragraph" という意味です。(空行区切りの) 一つの段落が整形されます。 +カーソル位置より前の部分も範囲に入ります。 +段落が空行で区切られているなら、次のコマンドでファイル全体を整形できます: > + + gggqG + +"gg" でファイル先頭に移動し、"gqG" でファイル末尾まで整形します。 +警告: 段落が適切に区切られていない場合、それらの文章は一つにつながってしまいま +す。スペースや Tab 文字だけの行があったりするのはよくあるミスです。それは空白 +行です。空行ではありません。 + +整形できるのは単純なプレーンテキストだけではありません。整形の設定については +|fo-table| を参照してください。ピリオドの後ろに挿入されるスペースの数を変更す +るには 'joinspaces' を参照してください。 +外部プログラムを使って整形することもできます。Vim の組み込みコマンドで正しく整 +形できないようなテキストを編集するのに便利です。'formatprg' オプション参照。 + +============================================================================== +*25.2* テキストの位置揃え + +テキストを中央揃えするには、次のコマンドを使います: > + + :{range}center [width] + +{range} は通常のコマンドライン範囲指定です。 [width] には中央揃えに使う行の幅 +を指定できます。 [width] を指定しなかった場合は 'textwidth' の設定が使われま +す。('textwidth' が 0 なら 80 が使われます) +例: > + + :1,5center 40 + +次のような結果になります: + + I taught for a while. One ~ + time, I was stopped by the ~ + Fort Worth police, because my ~ + homework was too hard. True ~ + story. ~ + + +右端揃え +-------- + +同様に、右端揃えするには ":right" コマンドを使います: > + + :1,5right 37 + +結果: + + I taught for a while. One ~ + time, I was stopped by the ~ + Fort Worth police, because my ~ + homework was too hard. True ~ + story. ~ + +左端揃え +-------- + +次のコマンドで左端揃えできます: > + + :{range}left [margin] + +":center" や ":right" と違い、":left" の引数に指定する値は行の幅ではありませ +ん。左マージンを指定します。省略した場合は、文章は左端にぴったり寄せられます +(マージンに 0 を指定したのと同じ)。5 を指定した場合は 5 つのスペースでインデン +トされます。例えば、次のように使います: > + + :1left 5 + :2,5left + +次のような結果になります: + + I taught for a while. One ~ + time, I was stopped by the ~ + Fort Worth police, because my ~ + homework was too hard. True ~ + story. ~ + + +両端揃え +-------- + +両端揃えするための組み込みコマンドはありません。しかし、そのためのマクロパッ +ケージが用意されています。パッケージを使うには、次のコマンドを実行します: > + + :packadd justify + +または次の行を |vimrc| に加えてください: > + + packadd! justify + +新しいビジュアルモードコマンド "_j" が定義されます。ビジュアルモードで範囲選択 +して "_j" を実行すればテキストを両端揃えできます。 +詳しい説明はスクリプトファイルを参照してください。この名前の上で "gf" を使えば +ファイルを開けます: $VIMRUNTIME/pack/dist/opt/justify/plugin/justify.vim + +外部コマンドを使って整形することもできます。例: > + + :%!fmt + +============================================================================== +*25.3* インデントとタブ + +テキストをインデントすればその部分を目立たせることができます。例えばこのマニュ +アルでは、例文を示すときに 8 個のスペースまたは Tab 文字でインデントしていま +す。通常なら行頭で Tab キーを押せばインデントできます。例: + + the first line ~ + the second line ~ + +Tab キーを押してテキストを挿入、<Enter>、また Tab キーを押してテキストを挿入し +ます。 +'autoindent' オプションを設定すると、自動的にインデントできます: > + + :set autoindent + +新しい行を開始すると、直前の行と同じだけのインデントが挿入されます。上の例な +ら、<Enter> を押した後の Tab キーが必要なくなります。 + + +インデントを増やす +------------------ + +行のインデント量を増やすには ">" オペレータを使います。現在行のインデントを増 +やしたい場合は ">>" を使うと簡単です。 +インデントの増加量は 'shiftwidth' オプションで設定できます。初期設定は 8 です。 +例えば、">>" でスペース 4 つ分のインデントを増やしたい場合は次のように設定しま +す: > + + :set shiftwidth=4 + +上記例文の二行目で ">>" を使うと、次のようになります: + + the first line ~ + the second line ~ + +"4>>" は四つの行のインデントを増やすコマンドです。 + + +タブストップ +------------ + +インデントを 4 桁にしたい場合は 'shiftwidth' を 4 に設定します。しかしそれだけ +では、<Tab> を押したときのインデントの量はスペース 8 個分のままです。これを変 +更するには 'softtabstop' オプションを設定します: > + + :set softtabstop=4 + +これで、<Tab> キーがスペース 4 個分のインデントになります。既に 4 つスペースで +インデントされている場合は <Tab> 文字に置き換えられます (7 バイト節約)。(Tab +文字を使いたくない場合は 'expandtab' を設定してください。) + + Note: + 'tabstop' オプションを 4 に設定することもできますが、その設定で編集し + たファイルを 'tabstop' の初期設定 (8) で見ると見た目が崩れてしまいま + す。他のプログラムで印刷する場合もインデントが崩れてしまうかもしれませ + ん。したがって、'tabstop' は常に 8 のままにしておきましょう。それが標 + 準的な値です。 + + +TAB幅を変更する +--------------- + +tabstop が 3 で書かれたファイルを (tabstop が 8 の) Vim で開くと表示が崩れてし +まいます。'tabstop' を 3 に設定すれば表示を直すことができますが、ファイルを開 +くたびに設定を変更しなければなりません。 +ファイルの tabstop 幅を変更することができます。インデントが正しく表示されるよ +うに 'tabstop' を設定してから ":retab" コマンドを使います: > + + :set tabstop=3 + :retab 8 + +":retab" コマンドを使って 'tabstop' を 8 に変更しています。ただし、テキストの +見た目は変更されません。空白部分が Tab 文字とスペースに置き換えられます。その +状態でファイルを保存すれば、次からは設定を変更しなくてもインデントが正しく表示 +されます。 +警告: プログラムに対して ":retab" を使った場合、文字列定数の中の空白記号が変更 +されてしまうかもしれません。文字列定数の中では Tab 文字ではなく "\t" を使うよ +うにしましょう。 + +============================================================================== +*25.4* 長い行の扱い + +ウィンドウの幅に収まりきらないようなファイルを編集することがあると思います。そ +の場合、すべての行が画面に収まるように折り返して表示されます。 +'wrap' オプションをオフにすると、すべての行が一行で表示されます。長い行の画面 +に収まりきらない部分は表示されません。 +表示されていない部分にカーソルを動かすと、テキストがスクロールされ、その部分が +表示されます。ウィンドウの枠を右に動かすような感じです。 +初期設定では、GUI の水平スクロールバーは表示されません。表示したい場合は次のコ +マンドを使います: > + + :set guioptions+=b + +Vim ウィンドウの下部に水平スクロールバーが表示されます。 + +スクロールバーが使えない、または使いたくない場合は、次のコマンドでテキストをス +クロールしてください。カーソルは同じ位置にとどまりますが、画面外に出てしまうと +きは画面内に移動されます。 + + zh 右にスクロール + 4zh 右に 4 文字分スクロール + zH 右にウィンドウの半分だけスクロール + ze カーソル位置が右端になるように右スクロール + zl 左にスクロール + 4zl 左に 4 文字分スクロール + zL 左にウィンドウの半分だけスクロール + zs カーソル位置が左端になるように左スクロール + +例を使って説明します。カーソルは "which" の "w" にあります。上部の "current +window" はウィンドウに表示されている範囲を示しています。コマンド実行後の表示範 +囲を "window" で示します。 + + |<-- current window -->| + some long text, part of which is visible in the window ~ + ze |<-- window -->| + zH |<-- window -->| + 4zh |<-- window -->| + zh |<-- window -->| + zl |<-- window -->| + 4zl |<-- window -->| + zL |<-- window -->| + zs |<-- window -->| + + +折り返し無しの場合の移動 +------------------------ + +'wrap' がオフで、テキストが水平スクロールされているとき、次のコマンドで画面の +表示範囲を基準にして移動できます。ウィンドウの左右のテキストは無視されます。こ +れらのコマンドはテキストをスクロールしません: + + g0 行の右端に移動 + g^ 行の右端の最初の非空白文字に移動 + gm 行の中央に移動 + g$ 行の左端に移動 + + |<-- window -->| + some long text, part of which is visible ~ + g0 g^ gm g$ + + +禁則処理 *edit-no-break* +-------- + +他のプログラムで使うテキストを編集する場合、一つの段落を改行無しで書かなければ +ならないことがあります。'nowrap' を使うと編集中の文全体を表示することができま +せん。'wrap' をオンにすると単語の途中で行が折り返されて読み難くなってしまいま +す。 +そのような場合は 'linebreak' オプションを使ってください。適切な場所で行が折り +返されるようになります。ファイルの内容は変更されません。 +'linebreak' がオフの状態では次のように表示されますが: + + +---------------------------------+ + |letter generation program for a b| + |ank. They wanted to send out a s| + |pecial, personalized letter to th| + |eir richest 1000 customers. Unfo| + |rtunately for the programmer, he | + +---------------------------------+ + +'linebreak' を設定すると: > + + :set linebreak + +次のように表示されます: + + +---------------------------------+ + |letter generation program for a | + |bank. They wanted to send out a | + |special, personalized letter to | + |their richest 1000 customers. | + |Unfortunately for the programmer,| + +---------------------------------+ + +関連オプション: + 'breakat' 折り返し可能な文字を指定する。 + 'showbreak' 折り返された行の先頭に表示される文字。 + 'textwidth' 0 に設定して段落が改行されないようにしてください。 + + +表示行単位の移動 +---------------- + +"j" と "k" で上下の行に移動できますが、長い行の上で使うと、一度に複数の表示行 +を移動することになります。 +画面上で一行だけ移動したい場合は "gj" と "gk" を使ってください。行が折り返され +ていないときは "j" と "k" と同じ動作をします。折り返されているときは、画面上の +一行だけ移動します。 +次のようなマップを定義しておくと便利かもしれません: > + + :map <Up> gk + :map <Down> gj + + +段落を一行につなげる *edit-paragraph-join* +-------------------- + +MS-Word のようなプログラムにテキストをコピーするとき、段落は一行につながってい +なければなりません。段落が空行で区切られているなら、次のコマンドでそれぞれの段 +落を一行につなげることができます: > + + :g/./,/^$/join + +すこし複雑ですね。分解して説明します: + + :g/./ 一文字以上の文字を含んでいる行を探す":global"コマンド + ,/^$/ 現在行(非空行)から空行までの範囲を指定 + join 指定された範囲の行を ":join" コマンドで一行につなげる + +30 桁で改行された次のようなテキストが: + + +----------------------------------+ + |A letter generation program | + |for a bank. They wanted to | + |send out a special, | + |personalized letter. | + | | + |To their richest 1000 | + |customers. Unfortunately for | + |the programmer, | + +----------------------------------+ + +二行にまとめられます: + + +----------------------------------+ + |A letter generation program for a | + |bank. They wanted to send out a s| + |pecial, personalized letter. | + |To their richest 1000 customers. | + |Unfortunately for the programmer, | + +----------------------------------+ + +Note: スペースや Tab 文字を含んでいる空白行 (空行ではない) で段落が区切られて +いる場合、上記のコマンドは機能しません。次のコマンドは空白行でも機能します: > + + :g/\S/,/^\s*$/join + +最後の段落を処理するには、ファイル末尾に空行または空白行が必要です。 + +============================================================================== +*25.5* 表の編集 + +次のような 4 列の表を編集していて: + + nice table test 1 test 2 test 3 ~ + input A 0.534 ~ + input B 0.913 ~ + +4 列目に数字を入力したいと思いました。2 行目に移動して "A" を使い、いくつかス +ペースとテキストを入力すればできます。 +このような編集のための特別なオプションがあります: > + + set virtualedit=all + +これを設定すると、文字が無い場所にもカーソルを移動できるようになります。これを +"virtual space" (仮想空白) と呼びます。この方法を使えば簡単に表を編集できます。 +検索を実行して 4 列目のヘッダーに移動します: > + + /test 3 + +"j" を押すとカーソルが適切な場所に移動するので、そのまま "input A" の値を入力 +できます。"0.693" と入力します: + + nice table test 1 test 2 test 3 ~ + input A 0.534 0.693 ~ + input B 0.913 ~ + +テキストが無かった部分は空白で埋められます。"Bj" コマンドを使って次の行に移動 +しましょう。"B" で単語の先頭に移動し、"j" で次のフィールドに移動します。 + + Note: + 画面上のどの場所にでもカーソルを移動できます。行末を超えて移動すること + もできます。文字を挿入しない限り、スペースは挿入されません。 + + +列のコピー +---------- + +4 列目をコピーして "test 1" 列の前に追加します。次の手順でできます: +1. カーソルを列の左上隅に移動する。例: "/test 3"。 +2. CTRL-V を押して矩形選択開始。 +3. "2j" で二行下に移動。カーソルは仮想空白の上 ("input B" 行の "test 3" 列) +4. 右に移動して列全体を選択。列を区切るためのスペースも選択する。例えば "9l" + で移動する。 +5. "y" で選択範囲をヤンク。 +6. カーソルを "text 1" に移動。この場所に新しい列を挿入する。 +7. "P" を押す。 + +結果は次のようになります: + + nice table test 3 test 1 test 2 test 3 ~ + input A 0.693 0.534 0.693 ~ + input B 0.913 ~ + +"test 1" 列全体が右側に押し出されます。"test 3" 列のテキストが無い行も同様に移 +動していますね。 + +次のコマンドでカーソル移動を通常に戻せます: > + + :set virtualedit= + + +バーチャル置換モード +-------------------- + +'virtualedit' の不便なところは感覚が狂ってしまうところです。カーソルを動かして +いるときに、カーソルが Tab 文字の上にあるのか、行末を越えた位置にあるのか、認 +識することができません。そこで「バーチャル置換モード」を使います。 +例えば、表の中で Tab 文字が使われているとします。その Tab 文字の上で "rx" を +使ってみます: + + inp 0.693 0.534 0.693 ~ + + | + rx | + V + + inpx0.693 0.534 0.693 ~ + +レイアウトが崩れてしまいました。こうならないように、"gr" コマンドを使います: + + inp 0.693 0.534 0.693 ~ + + | + grx | + V + + inpx 0.693 0.534 0.693 ~ + +"gr" コマンドで置換すると、置換した結果がスクリーン上で同じ幅になるように調整 +されます。足りない分はスペースか Tab 文字で埋められます。つまり上の例は、Tab +文字が "x" で置換され、残りの部分を埋めるように空白が追加されたのです。例では +Tab 文字が挿入されてます。 +複数の文字を置き換えたい場合は "R" コマンドの置換モード (|04.9|参照) を使いま +すが、それだとレイアウトが崩れて意図しない文字が置換されてしまいます: + + inp 0 0.534 0.693 ~ + + | + R0.786 | + V + + inp 0.78634 0.693 ~ + +"gR" コマンドのバーチャル置換モードを使いましょう。これならレイアウトは崩れま +せん: + + inp 0 0.534 0.693 ~ + + | + gR0.786 | + V + + inp 0.786 0.534 0.693 ~ + +============================================================================== + +次章: |usr_26.txt| 繰り返し + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_26.jax b/plugins/vimdoc-ja/doc/usr_26.jax new file mode 100644 index 0000000000..318e08b602 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_26.jax @@ -0,0 +1,215 @@ +*usr_26.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + VIM USER MANUAL - by Bram Moolenaar + + 繰り返し + + +ほとんどの編集作業は手順が決まっています。同じ変更を繰り返したいと思うことはよ +くあります。この章では、変更を繰り返すための便利な方法をいくつか説明します。 + +|26.1| ビジュアルモードを使って繰り返す +|26.2| 加算と減算 +|26.3| 複数のファイルを変更する +|26.4| シェルスクリプトから Vim を使う + +次章: |usr_27.txt| 検索コマンドと正規表現 +前章: |usr_25.txt| テキストの整形 +目次: |usr_toc.txt| + +============================================================================== +*26.1* ビジュアルモードを使って繰り返す + +ビジュアルモードを使えば好きな範囲のテキストを変更できるのでとても便利です。選 +択範囲は強調表示されるので、変更される範囲が正しいかどうか確認できます。しか +し、何度も範囲選択するのは少し面倒です。"gv" コマンドを使えば同じ範囲を再選択 +できます。同じ範囲に対して別の変更を加えることができます。 +例えば、"2001" を "2002" に変更し、"2000" を "2001" に変更してみます: + + The financial results for 2001 are better ~ + than for 2000. The income increased by 50%, ~ + even though 2001 had more rain than 2000. ~ + 2000 2001 ~ + income 45,403 66,234 ~ + +まず "2001" を "2002" に変更します。ビジュアルモードでテキストを選択し、次のコ +マンドを実行します: > + + :s/2001/2002/g + +次に "gv" で同じ範囲を再選択します。カーソルの位置は気にしなくて大丈夫です。そ +して、":s/2000/2001/g" で二回目の変更を加えます。 +同じ方法で何度でも変更を繰り返せます。 + +============================================================================== +*26.2* 加算と減算 + +ある数字を変更し、それと同じ数だけ他の数字を変更したいような場合があります。例 +えば上の例ではすべての年に 1 を加えました。変更したいすべての年に対して置換コ +マンドを実行しなくても、CTRL-A を使って同じことができます。 +上記例文から、年を検索します: > + + /19[0-9][0-9]\|20[0-9][0-9]<Enter> + +そして CTRL-A を押すと、年が一つ増えます: + + The financial results for 2002 are better ~ + than for 2000. The income increased by 50%, ~ + even though 2001 had more rain than 2000. ~ + 2000 2001 ~ + income 45,403 66,234 ~ + +"n" で次の年を検索し、"." を押して CTRL-A を繰り返します ("." を押す方が簡単で +すよね)。"n" と "." を繰り返し、全ての年を更新します。 +ヒント: 'hlsearch' オプションを設定して検索にヒットした場所を確認できるように +すると、先の方まで見通せるので作業がはかどります。 + +加算する量を増やしたい場合は CTRL-A の前に数値を指定します。例えば、次のテキス +トで: + + 1. item four ~ + 2. item five ~ + 3. item six ~ + +カーソルを "1." のところに動かして次のように入力します: > + + 3 CTRL-A + +"1." が "4." に変わります。"." を使って同じ変更を繰り返せます。 + +もう一つ例を示します: + + 006 foo bar ~ + 007 foo bar ~ + +これらの数字に対して CTRL-A を使うと次のようになります: + + 007 foo bar ~ + 010 foo bar ~ + +7 + 1 = 10? これは、"007" の先頭が 0 で始まっているため、8進数と認識されてし +まったのです。この表記方法は C 言語などで使われています。先頭が 0 で始まってい +る数字を8進数として扱いたくない場合は、次のように設定してください: > + + :set nrformats-=octal + +CTRL-X コマンドを使うと同じ方法で減算できます。 + +============================================================================== +*26.3* 複数のファイルを変更する + +あるプログラムに "x_cnt" という変数があり、それを "x_counter" に変更したい場合 +を考えます。変数は複数の C ファイルで使われているので、すべてのファイルを変更 +しなければなりません。その方法を説明します。 +関連ファイルを引数リストに加えます: > + + :args *.c + +すべての C ファイルが検索され、一つ目のファイルが開きます。これで、すべてのファ +イルに対して置換コマンドを実行できます: > + + :argdo %s/\<x_cnt\>/x_counter/ge | update + +":argdo" コマンドの引数にはコマンドを指定できます。指定されたコマンドは引数リ +スト内のすべてのファイルに対して実行されます。 +"%s" はファイル全体を置換するコマンドです。"\<x_cnt\>" で "x_cnt" を検索してい +ます。"\<" と "\>" を使って単語全体がマッチするようにしています。つまり +"px_cnt" や "x_cnt2" は置換されません。 +置換コマンドに指定された "g" フラグは、一つの行で複数の "x_cnt" が見つかった場 +合に、すべての "x_cnt" を置換するための指定です。"e" フラグは "x_cnt" が見つか +らなかった場合でもエラーメッセージを表示しないための指定です。エラーが起こると +その場で ":argdo" が止まってしまいます。 +"|" はコマンドの区切りです。"update" コマンドを使って、変更があったときだけ +ファイルを保存しています。置換する "x_cnt" が見つからなければ保存は実行されま +せん。 + +他にも、すべてのウィンドウに対してコマンドを実行する ":windo" コマンド、すべて +のバッファに対してコマンドを実行する ":bufdo" コマンドがあります。バッファリス +トにはあなたの予想以上にファイルが入っているかもしれないので注意してください。 +":buffers" コマンド (or ":ls") で確認できます。 + +============================================================================== +*26.4* シェルスクリプトから Vim を使う + +例えば、たくさんのファイルがあって、"-person-" を "Jones" に置換して印刷する必 +要があるとします。どのように実行すればいいでしょう。すべてを手作業で実行するの +も一つの方法ですが、シェルスクリプトを書いて済ます方法もあります。 +スクリーンエディタとして Vim を使うとき、ノーマルモードコマンドを使えば簡単に +処理できます。しかし、バッチ処理したい場合は、ノーマルモードコマンドでは分かり +難くなってしまいますし、コマンドファイルにコメントも書けません。代わりに Ex +モードを使います。Ex モードのコマンドはバッチファイルを書くのに適しています。 +("EX コマンド" はコマンドライン (:) コマンドの別名です) +必要となる Ex コマンドは次のとおりです: > + + %s/-person-/Jones/g + write tempfile + quit + +これらのコマンドを "change.vim" に保存します。そして、Vim をバッチモードで起動 +します: > + + for file in *.txt; do + vim -e -s $file < change.vim + lpr -r tempfile + done + +for-done ループは間にある行を繰り返し実行するためのシェル構文です。繰り返すた +びに $file 変数に異なるファイル名が設定されます。 +二行目では、Vim を Ex モード (-e 引数) で起動して $file を開き、"change.vim" +からコマンドを読み込んでいます。-s 引数を指定して Vim をサイレントモードにして +いるので、":" プロンプトやその他のプロンプトは表示されません。 +"lpr -r tempfile" コマンドで出力結果の "tempfile" を印刷し、そのファイルを削除 +しています ("-r" 引数が削除指示)。 + + +標準入力からの読み込み +---------------------- + +Vim は標準入力からテキストを読み込めます。標準入力からはコマンドを読み込むのが +普通なので、そうでないことを Vim に伝えなくてはなりません。ファイルを指定する +場所に "-" 引数を指定してください。例: > + + ls | vim - + +"ls" コマンドの出力結果を、ファイルに保存せずに直接編集できます。 +標準入力からテキストを読み込む場合でも、"-S" 引数を使えば、スクリプトを読み込 +ませることができます。 > + + producer | vim -S change.vim - + + +ノーマルモードスクリプト +------------------------ + +ノーマルモードコマンドをスクリプトの中で使いたい場合は、次のようにすればできま +す: > + + vim -s script file.txt ... +< + Note: + "-s" 引数は "-e" の有無で違う意味になります。この例の場合は、"script" + をノーマルモードコマンドとして実行するという意味になります。"-e" といっ + しょに指定された場合はサイレントモードの指定になり、"-s" にファイルを + 指定することはできません。 + +"script" の中のコマンドは、実際に入力したのと同じように実行されます。改行は +<Enter> として解釈されるので注意してください。次の行へ移動するノーマルモードコ +マンドとして実行されます。 +スクリプトを作る方法はスクリプトファイルを開いてコマンドを入力するだけですが、 +コマンドの結果を自分で想像しなければならないので、少し難しい作業になります。 +実際に編集をしてみて、その操作手順を記録する方法もあります。次のコマンドを使い +ます: > + + vim -w script file.txt ... + +入力したすべてのキーが "script" に保存されます。多少のミスがあってもそのまま操 +作を続けて、後からスクリプトを編集できます。 +"-w" 引数は既存のスクリプトに追記します。したがって、スクリプトの記録を少しず +つ進めることができます。スクリプトをスクラッチから作成したい場合は "-W" 引数を +使ってください。既存のファイルが上書きされます。 + +============================================================================== + +次章: |usr_27.txt| 検索コマンドと正規表現 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_27.jax b/plugins/vimdoc-ja/doc/usr_27.jax new file mode 100644 index 0000000000..dce800e7e5 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_27.jax @@ -0,0 +1,559 @@ +*usr_27.txt* For Vim バージョン 8.0. Last change: 2010 Mar 28 + + VIM USER MANUAL - by Bram Moolenaar + + 検索コマンドと正規表現 + + +3 章で検索パターンについて簡単に説明しました |03.9|。Vim ではもっと複雑な検索 +もできます。この章では、よく使われる検索パターンについて説明します。詳細な仕様 +については |pattern| を参照してください。 + +|27.1| 大文字と小文字を区別しない +|27.2| ファイルの端で折り返す +|27.3| オフセット +|27.4| 繰り返しマッチ +|27.5| 選択肢 +|27.6| 文字範囲 +|27.7| 文字クラス +|27.8| 改行記号にマッチ +|27.9| 例 + +次章: |usr_28.txt| 折り畳み +前章: |usr_26.txt| 繰り返し +目次: |usr_toc.txt| + +============================================================================== +*27.1* 大文字と小文字を区別しない + +初期設定では大文字と小文字は区別されます。つまり "include" と "INCLUDE" と +"Include" は三つの別々の単語として扱われ、検索してもどれか一つにしかマッチしま +せん。 +'ignorecase' オプションをオンにしてみましょう: > + + :set ignorecase + +"include" を検索すると、"Include" にも "INCLUDE" にも "InClUDe" にもマッチしま +す。('hlsearch' オプションをオンにするとパターンにマッチした箇所を簡単に確認で +きます。) +次のコマンドでオプションをオフにできます: > + + :set noignorecase + +しかしまだ設定は変更せずに、そのまま "INCLUDE" を検索してみます。"include" を +検索したときとまったく同じテキストがマッチします。次に 'smartcase' オプション +をオンに設定してみます: > + + :set ignorecase smartcase + +パターンに大文字が含まれているときに限り、大文字と小文字が区別されるようになり +ます。これは、大文字を入力するのは大文字と小文字を区別したいときだけだろうとい +う考えに基づいています。スマートでしょ! +この二つのオプションを設定すると次のようにマッチします: + + パターン マッチ ~ + word word, Word, WORD, WoRd, etc. + Word Word + WORD WORD + WoRd WoRd + + +パターンの中で指定する +---------------------- + +ある特定のパターンの中でだけ大文字と小文字の区別を無視したい場合は、パターンに +"\c" をつけます。大文字と小文字を区別したいときは "\C" を使います。"\c" と +"\C" の指定は 'ignorecase' と 'smartcase' の設定よりも優先されます。 + + パターン マッチ ~ + \Cword word + \CWord Word + \cword word, Word, WORD, WoRd, etc. + \cWord word, Word, WORD, WoRd, etc. + +"\c" と "\C" の大きな利点はそれがパターンに埋め込まれていることです。検索履歴 +からパターンを再利用したときなどに、同じ検索結果を期待できます。'ignorecase' +や 'smartcase' の設定は影響しません。 + + Note: + 検索パターンでの "\" の扱いは 'magic' オプションに依存します。この章で + は 'magic' がオンに設定されていることを前提にしています。それが標準設 + 定であり推奨設定です。'magic' を変更してしまうと今まで使えていた検索パ + ターンが使えなくなってしまうかもしれません。 + + Note: + 検索がなかなか終わらない場合は CTRL-C (Unix) または CTRL-Break (MS-DOS + と MS-Windows) で処理を中断できます。 + +============================================================================== +*27.2* ファイルの端で折り返す + +前方検索を実行すると現在のカーソル位置から処理が開始し、指定された文字列が検索 +されます。そしてファイルの末尾まで検索が進みます。ファイルの末尾まで検索しても +文字列が見つからない場合は、ファイルの先頭からカーソル位置に向かって検索が継続 +します。 +"n" コマンドを使って順々に検索を進めている場合もそのうち最初にヒットした場所に +戻ってきます。これに気がつかないと永遠に検索を続けることになってしまいます! +そのようなことがないように、次のようなメッセージが表示されます: + + 下まで検索したので上に戻ります ~ + +"?" コマンドを使って逆方向に検索している場合は次のメッセージが表示されます: + + 上まで検索したので下に戻ります ~ + +それでも気づかないことがあるかもしれません。'ruler' オプションをオンにすると確 +認しやすくなります: > + + :set ruler + +ウィンドウの右下隅 (ステータスラインがあるときはその中) にカーソルの位置が表示 +されます。次のような表示です: + + 101,29 84% ~ + +最初の数字はカーソルの行番号です。検索を開始した行番号を覚えておいて、検索が一 +周してないか確認しましょう。 + + +折り返さない +------------ + +検索を折り返さないようにするには次のコマンドを使います: > + + :set nowrapscan + +検索がファイルの末尾に達するとエラーメッセージが表示されます: + + E385: 下まで検索しましたが該当箇所はありません: forever ~ + +すべての箇所を検索したい場合は "gg" でファイルの先頭に移動してからこのメッセー +ジが表示されるまで検索を繰り返してください。 +"?" を使って逆方向に検索した場合は次のメッセージが表示されます: + + E384: 上まで検索しましたが該当箇所はありません: forever ~ + +============================================================================== +*27.3* オフセット + +通常、検索コマンドを実行すると、パターンにヒットした場所の先頭にカーソルが移動 +します。オフセットを指定することで別の場所に移動することができます。前方検索コ +マンドの "/" の場合、パターンの後ろに "/" とオフセット値を指定します: > + + /default/2 + +"default" というパターンが検索され、見つかった場所から二行下の行頭にカーソルが +移動します。例えばこのコマンドで今読んでいる段落を検索すると、一行目に +"default" が見つかるので、カーソルはその二行下 (つまりこの行) に移動することに +なります。 + +オフセットに数値を指定すると、マッチした行から指定した行数だけ移動した行の行頭 +にカーソルが移動します。オフセット値には負の数も指定できます。正の数ならカーソ +ルが下に移動し、負の数なら上に移動します。 + + +文字オフセット +-------------- + +"e" はマッチした文字列の末尾を示すオフセットです。マッチした文字列の末尾にカー +ソルが移動します。次のように使います: > + + /const/e + +"const" の "t" にカーソルが移動します。 +オフセットに数値を足すと、その場所からさらにカーソルを進めることができます。 +次のコマンドではマッチした文字列の後ろにカーソルが移動します: > + + /const/e+1 + +正の数ならカーソルが右に動き、負の数なら左に動きます。例: > + + /const/e-1 + +"const" の "s" にカーソルが移動します。 + +オフセットに "b" を指定すると、マッチした文字列の先頭に移動できます。これはオ +フセット指定無しの動作と同じなので単体では使い道はありません。数値を足したり引 +いたりしたい場合に使います。指定した数だけカーソルを前後に移動できます。例: > + + /const/b+2 + +マッチした文字列の先頭から二文字右にカーソルが移動します。つまり "n" の上です。 + + +繰り返し +-------- + +直前に使った検索パターンを、別のオフセットを使って再検索したい場合は、パターン +指定を省略します: > + + /that + //e + +これは次の指定と同じです: > + + /that/e + +同じオフセットを使って再検索したい場合は: > + + / + +"n" と同じ動作になります。オフセット指定を無効にして再検索したい場合は次のよう +にします: > + + // + + +後方検索 +-------- + +"?" コマンドでも同じようにオフセットを指定できますが、パターンとオフセットを区 +切るのは "/" ではなく "?" になります: > + + ?const?e-2 + +"b" と "e" の意味は同じです。"?" を使う場合でも方向は逆になりません。 + + +検索開始位置 +------------ + +検索は通常、現在のカーソル位置から開始します。オフセットを指定するとうまくいか +ないときがあります。例: > + + /const/-2 + +"const" を検索してその二行上に移動します。"n" を使って再検索すると、その場所か +ら検索を開始して同じ場所の "const" がヒットします。そして、再びオフセットが適 +用されて元の場所に戻ってきます。まったく移動できません。 +次の行に "const" があった場合はもっとおかしなことになります。検索を実行すると +次の行がヒットして、その二行上にカーソルが移動するので、カーソルが逆方向に移動 +してしまうのです。 + +文字オフセットを使った場合はそうなりません。オフセット指定の分だけ検索開始位置 +がずれるので、同じものが再びヒットすることはありません。 + +============================================================================== +*27.4* 繰り返しマッチ + +ある文字を任意の数だけマッチさせたい場合は "*" を使います: > + + /a* + +これは "a" でも "aa" でも "aaa" でもマッチします。0 回というのも任意の数に含ま +れるので "" (空文字列) もマッチします。 +"*" は直前の文字に対してだけ適用されます。"ab*" なら "a"、"ab"、"abb"、"abbb" +などがマッチします。単語を繰り返したい場合は、その単語をグループにまとめなけれ +ばなりません。"\(" と "\)" で単語を囲んでください。次のように使います: > + + /\(ab\)* + +"ab"、"abab"、"ababab"、"" などにマッチします。 + +空文字列にマッチさせたくない場合は "\+" を使います。直前の文字が一つ以上あると +きだけマッチするようになります: > + + /ab\+ + +"ab"、"abb"、"abbb" などにマッチします。"b" が後ろに付いていない "a" にはマッ +チしません。 + +0 または 1 つの文字にマッチさせたい場合は "\=" を使います。例: > + + /folders\= + +"folder" と "folders" がマッチします。 + + +回数指定 +-------- + +特定の数だけ文字をマッチさせるには "\{n,m}" を使います。"n" と "m" に数字を指 +定します。直前の文字が "n" から "m" の数だけ連続している場合にマッチします。 +例: > + + /ab\{3,5} + +"abbb"、"abbbb"、"abbbbb" にマッチします。 +"n" を省略した場合は 0 が使われます。"m" が省略された場合は繰り返し回数は無制 +限になります。",m" を省略した場合は、正確に "n" 回の繰り返しにマッチします。 +例: + + pattern match count ~ + \{,4} 0, 1, 2, 3 or 4 + \{3,} 3, 4, 5, etc. + \{0,1} 0 or 1 (\= と同じ) + \{0,} 0 以上 (* と同じ) + \{1,} 1 以上 (\+ と同じ) + \{3} 3 + + +最短一致 +-------- + +今まで説明した繰り返し指定は、可能な限りたくさんの文字列にマッチしようとしま +す。できるだけ少ない回数だけマッチさせるには "\{-n,m}" を使います。動作は +"\{n,m}" とほとんど同じですが、最短一致が使われます。 +例: > + + /ab\{-1,3} + +"abbbb" の中の "ab" だけがマッチします。一つの "b" にマッチするだけで条件を満 +たすので、二つ目以降の "b" には絶対にマッチしません。後ろに他のパターンが続い +ているなら最小回数以上の文字にもマッチします。 +"n" と "m" を省略した場合も同じルールが適用されます。両方の数字を省略して +"\{-}" とすることもできます。これは直前の文字が 0 回以上繰り返されている場合に +最小の数だけマッチします。単体で使った場合は常に 0 回にマッチします。他のパター +ンと組み合わせて使うと便利です。例: > + + /a.\{-}b + +"axbxb" の中の "axb" にマッチします。次のパターンを使った場合は: > + + /a.*b + +".*" は可能な限り多くの文字にマッチするので "axbxb" 全体がマッチします。 + +============================================================================== +*27.5* 選択肢 + +パターンの中で "or" (または) を指定するには "\|" を使います。例: > + + /foo\|bar + +"foo" と "bar" のどちらかがマッチします。複数の選択肢を指定できます: > + + /one\|two\|three + +"one"、"two"、"three" のどれかにマッチします。 +複数回マッチさせるには、全体を "\(" と "\)" で囲みます: > + + /\(foo\|bar\)\+ + +"foo"、"foobar"、"foofoo"、"barfoobar" などにマッチします。 +もう一つの例: > + + /end\(if\|while\|for\) + +"endif"、"endwhile"、"endfor" にマッチします。 + +"\&" も似たような条件指定です。指定された選択肢がすべて同じ場所でマッチします。 +マッチ結果としては最後の選択肢が使われます。例: > + + /forever\&... + +"forever" の "for" にマッチします。"fortuin" にはマッチしません。 + +============================================================================== +*27.6* 文字範囲 + +"a"、"b"、"c" のどれかにマッチさせるには "/a\|b\|c" が使えます。しかし "a" か +ら "z" までの文字をマッチさせようとするとパターンが長くなってしまいます。簡単 +な方法があります: > + + /[a-z] + +[] は一つの文字にマッチします。マッチさせたい文字を [] の中に指定します。次の +ようにして文字を一つずつ指定することもできます: > + + /[0123456789abcdef] + +指定された文字の中から一つがマッチします。文字が連続している場合は文字範囲を指 +定できます。例えば "0-3" は "0123" という意味です。"w-z" は "wxyz" という意味 +になります。上記の例は次のように短くできます: > + + /[0-9a-f] + +文字 "-" 自体をマッチさせたい場合は [] の中の一番最初か最後に書いてください。 +[] の中では以下の特殊文字が使えます (これらは [] の中でなくても使えます): + + \e <Esc> + \t <Tab> + \r <CR> + \b <BS> + +[] の中では他にも特殊な指定方法が使えます。詳細は |/[]| を参照してください。 + + +文字範囲の補集合 +---------------- + +マッチして欲しくない文字を指定したい場合は、文字範囲の先頭に "^" を指定します。 +すると、指定した文字以外の文字がマッチするようになります。例: > + + /"[^"]*" +< + " ダブルクォート + [^"] ダブルクォート以外の文字が + * 可能な限りたくさん + " ダブルクォート + +"foo" や "3!x" がマッチします (ダブルクォートもマッチに含まれる)。 + + +定義済み文字範囲 +---------------- + +一般的な文字範囲はあらかじめ定義されています。 +例: > + + /\a + +アルファベット文字が検索されます。これは "/[a-zA-Z]" と同じです。他にも次のよ +うなものがあります: + + item matches equivalent ~ + \d 数字 [0-9] + \D 数字以外 [^0-9] + \x 16進数の数字 [0-9a-fA-F] + \X 16進数の数字以外 [^0-9a-fA-F] + \s 空白文字 [ ] (<Tab>か<Space>) + \S 空白文字以外 [^ ] (<Tab>か<Space>以外) + \l 小文字アルファベット [a-z] + \L 小文字アルファベット以外 [^a-z] + \u 大文字アルファベット [A-Z] + \U 大文字アルファベット以外 [^A-Z] + + Note: + 定義済み文字範囲は普通の文字範囲よりも処理が高速です。 + これらのアイテムは [] の中では指定できません。つまり "[\d\l]" と書いた + としても数字と小文字にはマッチしません。"\(\d\|\l\)" を使ってください。 + +定義済み文字範囲の一覧は |/\s| を参照してください。 + +============================================================================== +*27.7* 文字クラス + +文字範囲は特定の文字のセットにマッチします。文字クラスも似たようなものですが、 +検索パターンを変更せずに文字のセットを変更できるという違いがあります。 +例えば、次のパターンを検索します: > + + /\f\+ + +"\f" はファイル名に使える文字を表します。つまりこのパターンはファイル名として +使える文字列にマッチします。 +どの文字がファイル名として使えるかはシステムによって異なります。MS-Windows で +は "\" が使えますが Unix では使えません。これは 'isfname' オプションで指定され +ています。Unix の初期設定: > + + :set isfname + isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,= + +他のシステムでは初期設定が変わります。ファイル名にマッチさせたいときに "\f" を +使えば、そのパターンはいろいろなシステムで使えます。 + + Note: + Unix では空白などのどんな文字でもファイル名に使えます。'isfname' にそ + れらの文字を設定するのは理論的には正しいことです。しかしその場合、テキ + ストの中からファイル名を切り出すのが困難になってしまいます。したがっ + て、'isfname' の初期設定にはすべての文字は含まれていません。 + +次のような文字クラスがあります: + + item matches option ~ + \i 識別子に使える文字 'isident' + \I \iから数字を抜いたもの + \k キーワードとなる文字 'iskeyword' + \K \kから数字を抜いたもの + \p 印字可能文字 'isprint' + \P \pから数字を抜いたもの + \f ファイル名に使える文字 'isfname' + \F \fから数字を抜いたもの + +============================================================================== +*27.8* 改行記号にマッチ + +改行を含んだパターンを検索することができます。改行の位置は明示的に指定する必要 +があります。今までに説明したパターンアイテムはどれも改行にマッチしません。 +改行の場所を指定するには "\n" を使います: > + + /the\nword + +行末が "the" で終わり、次の行の行頭が "word" になっている行がマッチします。 +"the word" にもマッチさせたい場合は、スペースと改行の両方をマッチさせる必要が +あります。それには "\_s" を使います: > + + /the\_sword + +間に空白をいくつでも挟めるようにするには: > + + /the\_s\+word + +これは、行末が "the " で終わり、次の行の行頭が " word" で始まっているよう +な場所にもマッチします。 + +"\s" は空白にマッチします。"\_s" は空白と改行にマッチします。 +同様に、"\a" はアルファベットにマッチし、"\_a" はアルファベットと改行にマッチ +します。他の文字クラスや文字範囲も同様に、"_" を付けることによって改行にもマッ +チするようになります。 + +他の多くのパターンアイテムも "\_" を付けることによって改行にマッチさせることが +できます。例えば、"\_." は改行を含めたすべての文字にマッチします。 + + Note: + "\_.*" はファイル末尾までのすべての文字がマッチします。検索コマンドの + 動作が遅くなるかもしれないので注意してください。 + +"\_[]" を使うと文字範囲にも改行を追加できます: > + + /"\_[^"]*" + +ダブルクォートで囲まれたテキストが検索されます。間には改行も含むことができま +す。 + +============================================================================== +*27.9* 例 + +便利そうな検索パターンをいくつか説明します。今までに説明したパターンをどのよう +に使えばいいかを示します。 + + +カリフォルニア州のナンバープレートを探す +---------------------------------------- + +"1MGU103" という番号を検索してみます。これは一つの数字、三つの大文字アルファ +ベット、三つの数字、から成っています。そのままパターンに置き換えてみます: > + + /\d\u\u\u\d\d\d + +同じものが並んでいる部分は回数指定に置き換えることができます: > + + /\d\u\{3}\d\{3} + +[] 指定を使うこともできます: > + + /[0-9][A-Z]\{3}[0-9]\{3} + +あなたならどれを使いますか? どれでも覚えやすいものを使ってください。簡単に覚え +られる方法を使う方がそうでないものを頑張って覚えるよりずっと効率がよくなりま +す。最後の例は他より長くて実行速度も遅いので、どれでも覚えられるという場合は選 +択肢から外してください。 + + +識別子を見つける +---------------- + +C 言語 (などのほとんどの言語) では、識別子は英文字で始まってその後に英数字が続 +きます。アンダースコアも使えるかもしれません。次のパターンでそのような文字を検 +索できます: > + + /\<\h\w*\> + +"\<" と "\>" は単語全体をマッチさせるための指定です。"\h" は "[A-Za-z_]" と同 +じ意味で、"\w" は "[0-9A-Za-z_]" と同じ意味になります。 + + Note: + "\<" と "\>" の動作は 'iskeyword' オプションに依存します。例えば "-" + が含まれている場合、上記パターンは "ident-" にマッチしません。次のパ + ターンを使ってください: > + + /\w\@<!\h\w*\w\@! +< + 識別子の前後の文字が "\w" にマッチしないかどうかをチェックしています。 + |/\@<!| と |/\@!| 参照。 + +============================================================================== + +次章: |usr_28.txt| 折り畳み + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_28.jax b/plugins/vimdoc-ja/doc/usr_28.jax new file mode 100644 index 0000000000..9bcc5e99b3 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_28.jax @@ -0,0 +1,423 @@ +*usr_28.txt* For Vim バージョン 8.0. Last change: 2008 Jun 14 + + VIM USER MANUAL - by Bram Moolenaar + + 折り畳み + + +構造化されたテキストはいくつかのセクションから構成され、セクションはさらにサブ +セクションに分かれています。折り畳みを使うとセクションを一行で表示できます。折 +り畳まれた行にはセクションの概要が表示されます。この章では折り畳みの使い方を説 +明します。 + +|28.1| 折り畳みとは +|28.2| 手動で折り畳む +|28.3| 折り畳みを使って作業する +|28.4| 折り畳みの保存と復元 +|28.5| インデントで折り畳む +|28.6| マーカーで折り畳む +|28.7| 構文で折り畳む +|28.8| スクリプトで折り畳む +|28.9| 変更のない行を折り畳む +|28.10| どれを使えばいいの? + +次章: |usr_29.txt| プログラムの中を移動する +前章: |usr_27.txt| 検索コマンドと正規表現 +目次: |usr_toc.txt| + +============================================================================== +*28.1* 折り畳みとは + +折り畳みとは、バッファ中の複数の行を画面上で一行に表示するための機能です。紙を +折り畳んで短くするような感じです。 + + +------------------------+ + | line 1 | + | line 2 | + | line 3 | + |_______________________ | + \ \ + \________________________\ + / folded lines / + /________________________/ + | line 12 | + | line 13 | + | line 14 | + +------------------------+ + +バッファ内のテキストが消えるわけではありません。折り畳みが影響するのは画面の表 +示だけです。 + +折り畳みを使うと文章構成を把握するのが簡単になります。折り畳まれたセクションは +一行で表示され、その行にはセクションの概要が表示されます。 + +============================================================================== +*28.2* 手動で折り畳む + +実際に試してみましょう。どこかの段落にカーソルを動かして次のように入力します: +> + zfap + +段落が、ハイライトされた一行に置き換わります。それが折り畳みです。|zf| はオペ +レータです。|ap| はテキストオブジェクトによる範囲指定です。|zf| はどのカーソル +移動コマンドとも組み合わせることができます。カーソルが移動した範囲が折り畳みの +対象になります。|zf| はビジュアルモードでも使えます。 + +再びテキストを表示するには、次のコマンドで折り畳みを開きます: > + + zo + +次のコマンドで折り畳みを閉じることができます: > + + zc + +折り畳み関連のコマンドはすべて "z" で始まります。この文字は、紙を折り畳んで横 +から見た図に見えますよね。"z" の後ろにはコマンドが連想しやすいような文字が割り +当てられています。 + + zf 折り畳む (Fold) + zo 折り畳みを開く (Open) + zc 折り畳みを閉じる (Close) + +折り畳みは入れ子にできます。折り畳まれた行を含んだ範囲をさらに折り畳むことがで +きます。例えば、このセクションの段落をそれぞれ折り畳み、そして、この章のセク +ション全体を折り畳むということができます。実際に試してください。折り畳みを開い +たとき、その中にある折り畳みは、閉じたときと同じ開閉状態のままになっています。 + +いくつかの折り畳みを作ったときに、すべての折り畳みを開きたくなった場合、それぞ +れの折り畳みを "zo" で開いていくこともできますが、次のコマンドでもっと簡単にで +きます: > + + zr + +折り畳みが減少 (Reduce) します。その逆は "zm" です: > + + zm + +折り畳みが増加 (More) します。"zr" と "zm" は入れ子になった折り畳みを一階層ず +つ開閉できます。 + +入れ子になった折り畳みをいっぺんに開きたい場合は次のコマンドを使います: > + + zR + +すべての折り畳みが開くまで、折り畳みが減少 (Reduce) します。すべての折り畳みを +閉じるには: > + + zM + +折り畳みが次々と (More and More) 閉じます。 + +|zn| コマンドで折り畳みを無効にできます。無効になった折り畳みは |zN| で元に戻 +ります。|zi| で無効と有効を交互に切り替えられます。次のように使うと便利です: +- ファイルの構造を確認するために折り畳みを作成する +- 作業したい場所に移動する +- |zi| で折り畳みを無効にして編集作業をする +- |zi| で折り畳みを有効にして別の場所に移動する + +手作業で折り畳みを作成するための詳しい説明はリファレンスマニュアルを参照してく +ださい: |fold-manual| + +============================================================================== +*28.3* 折り畳みを使って作業する + +折り畳みが閉じているとき、"j" や "k" などのコマンドでその上を移動できます。閉 +じた折り畳みは一行の空行のように扱われます。つまり折り畳まれたテキストの上を素 +早く移動できます。 + +折り畳まれたテキストは、それが一つの行であるかのように、ヤンクしたり削除したり +できます。これは例えばプログラムの関数を並べ替えたりするときに便利です。まず +'foldmethod' を正しく設定し、それぞれの関数が適切に折り畳まれるようにします。 +そして、"dd" で関数を削除し、カーソルを移動して、"p" でプットします。関数の一 +部が折り畳みからはみ出している場合はビジュアルモードを使います: +- 移動させたい範囲の最初の行に移動 +- "V" でビジュアルモードを開始 +- 移動させたい範囲の最後の行に移動 +- "d" で選択範囲を削除 +- カーソルを移動して、"p" でテキストをプットする + +折り畳みを設定した場所 (つまり |zo| コマンドが機能する場所) を覚えておくのは大 +変です。次のコマンドで折り畳みの場所を確認できます: > + + :set foldcolumn=4 + +ウィンドウの左側に折り畳みの場所が表示されます。閉じた折り畳みは "+" で表示さ +れます。開いた折り畳みは、一行目が "-" で表示され、それ以降は "|" で表示されま +す。 + +マウスで "+" の部分をクリックすると折り畳みが開きます。"-" や "|" の部分をク +リックすると折り畳みが閉じます。 + +現在行の折り畳みをすべて開くには |zO| を使います。 +現在行の折り畳みをすべて閉じるには |zC| を使います。 +現在行の折り畳みを削除するには |zd| を使います。 +現在行の折り畳みをすべて削除するには |zD| を使います。 + +挿入モードでは現在行の折り畳みは絶対に閉じません。入力した文字は必ず表示されま +す。 + +カーソルをジャンプさせたり左右に動かしたりしたとき、折り畳みは自動的に開きま +す。例えば "0" コマンドを使うと現在行の折り畳みが開きます ('foldopen' に "hor" +が含まれている場合のみ。初期設定では含まれています)。どのコマンドを使うと折り +畳みが開くかは 'foldopen' オプションで設定できます。カーソルが乗っている行の折 +り畳みを常に開いておきたい場合は次のように設定します: > + + :set foldopen=all + +警告: 閉じた折り畳みの上に移動することはできなくなります。この設定を一時的に使 +い、元に戻したくなったら次のようにします: > + + :set foldopen& + +折り畳みを自動的に閉じたい場合は次のようにします: > + + :set foldclose=all + +カーソルが乗っていないすべての折り畳みに 'foldlevel' が適用されます。このよう +な動作は好き嫌いがあるので実際に試してみてください。折り畳みを増加させたい場合 +は |zm| を、減少させたい場合は |zr| を使ってください。 + +折り畳みはウィンドウローカルな設定です。同じファイルを二つのウィンドウで表示し +て、片方では折り畳みを使い、もう片方では普通に表示するということができます。あ +るいは、片方ですべての折り畳みを閉じ、もう片方ですべての折り畳みを開くこともで +きます。 + +============================================================================== +*28.4* 折り畳みの保存と復元 + +ファイルを破棄すると折り畳みの情報は失われてしまいます。後で同じファイルを開い +たとき、折り畳みの開閉状態は初期状態に戻っています。手動で作成した折り畳みは失 +われます。折り畳みを保存するには |:mkview| コマンドを使います: > + + :mkview + +ファイルの表示に関する設定が保存されます。保存される情報の種類は 'viewoptions' +オプションで設定できます。 +後で同じファイルを開いたときに保存したビューを復元できます: > + + :loadview + +一つのファイルにつき 10 個までのビューを保存できます。例えば、現在の設定を 3 +番に保存して 2 番の設定をロードするには次のようにします: > + + :mkview 3 + :loadview 2 + +Note: 行を挿入したり削除したりすると保存していたビューが使えなくなるかもしれま +せん。ビューの保存場所は 'viewdir' オプションで決まります。必要な場合は自分で +ビューを削除してください。 + +============================================================================== +*28.5* インデントで折り畳む + +|zf| を使って折り畳みを定義するのは大変です。テキストが階層的にインデントされ +ている場合は、それを使って折り畳むことができます。インデントの深さにしたがって +折り畳みが作成され、大きくインデントされた部分は折り畳みが入れ子になります。こ +の方法は多くのプログラミング言語で使うことができます。 + +'foldmethod' オプションを次のように設定してください: > + + :set foldmethod=indent + +|zm| や |zr| を使って折り畳みを増減できるようになりました。以下の例文を使うと +簡単に確認できます: + +この行はインデントされていない + この行は一段インデントされている + この行は二段インデントされている + この行は二段インデントされている + この行は一段インデントされている +この行はインデントされていない + この行は一段インデントされている + この行は一段インデントされている + +Note: インデントの量と折り畳みの深さの対応は 'shiftwidth' オプションで決まりま +す。'shiftwidth' の幅を単位としてインデントが深くなると折り畳みが深くなります。 +これを折り畳みレベルと呼びます。 + +|zr| や |zm| コマンドを使ったとき、実際には 'foldlevel' の値を増減させているの +です。自分で設定することもできます: > + + :set foldlevel=3 + +'shiftwidth' の幅を単位として、インデントが三段より深い階層の折り畳みが閉じま +す。設定した値より深い階層の折り畳みが閉じる仕組みです。'foldlevel' を 0 に設 +定するとすべての折り畳みが閉じます。|zM| を使うと 'foldlevel' が 0 に設定され +ます。|zR| を使うと 'foldlevel' がファイル内の最も深い折り畳みレベルに設定され +ます。 + +つまり、折り畳みを開閉する方法は二つあります +(A) 折り畳みレベルを設定する方法。 + この方法は、テキストを "ズームアウト" して文章の構成を眺め、カーソルを動か + し、テキストに "ズームイン" するような使い方ができます。 + +(B) |zo| や |zc| を使って個々の折り畳みを開閉する方法。 + 他の折り畳みは閉じたままで、必要な折り畳みだけを開くことができます。 + +二つの方法を組み合わせることもできます。|zm| で全体的に折り畳みを閉じてから +|zo| で特定の折り畳みだけを開く。あるいは、|zR| ですべての折り畳みを開いてから +|zc| で特定の折り畳みを閉じるなど。 + +'foldmethod' が "indent" に設定されている場合は手動で折り畳みを定義できません。 +インデントと折り畳みレベルの関係を保つためです。 + +インデントによる折り畳みの詳しい説明はリファレンスマニュアルを参照してくださ +い: |fold-indent| + +============================================================================== +*28.6* マーカーで折り畳む + +テキストにマーカーを書いて、折り畳みの始点と終点を指定できます。この方法を使う +と折り畳みの範囲を明示的に指定できます。ただし、テキストに変更を加える必要があ +ります。 + +次のように設定してください: > + + :set foldmethod=marker + +C 言語を使った例文: + + /* foobar () {{{ */ + int foobar() + { + /* return a value {{{ */ + return 42; + /* }}} */ + } + /* }}} */ + +マーカーの直前に書かれたテキストが折り畳まれた行に表示されるので、折り畳まれた +テキストがどのような内容なのかを知ることができます。 + +テキストを移動したときなどにマーカーの対応がずれてしまうと面倒です。番号付き +マーカーを使うと手間が省けます。例: + + /* global variables {{{1 */ + int varA, varB; + + /* functions {{{1 */ + /* funcA() {{{2 */ + void funcA() {} + + /* funcB() {{{2 */ + void funcB() {} + /* }}}1 */ + +番号付きマーカーを書いた場所から指定レベルの折り畳みが開始します。指定レベルよ +り高いレベルの折り畳みをその場所で区切るという効果もあります。番号付きマーカー +は開始マーカーを指定するだけで折り畳みを定義できます。折り畳みを明示的に止めた +い場合は終了マーカーを設定する必要があります。 + +マーカーによる折り畳みの詳しい説明はリファレンスマニュアルを参照してください: +|fold-marker| + +============================================================================== +*28.7* 構文で折り畳む + +ファイルを表示するとき、ファイルの種類に応じた構文ファイルが使われます。構文 +ファイルにはファイルをカラー表示するための定義が書かれています。例えばこのヘル +プファイルは "help" 構文ファイルを使ってカラー表示されています (カラー端末を +使っているなら)。 +構文ファイルで構文を定義するときに "fold" 属性を指定して折り畳み領域を定義する +ことができます。構文ファイルを書くのは大変ですが、一度作ってしまえば、後は自動 +的に折り畳みが作成されるようになります。 +自分で構文ファイルを作成することはほとんどないと思うので、詳しい説明は省きま +す。折り畳みを開いたり閉じたりする方法は他と変わりません。ファイルを開くと自動 +的に折り畳みが作成されます。 + +構文による折り畳みの詳しい説明はリファレンスマニュアルを参照してください: +|fold-syntax| + +============================================================================== +*28.8* スクリプトで折り畳む + +これはインデントによる折り畳みと似ていますが、インデントではなくユーザーが定義 +した関数を使って折り畳みレベルを計算します。テキストの内容から折り畳みレベルを +判断するようなことができます。例えば、メールでは引用したテキストの前に ">" を +付けます。それを折り畳むには次のようにします: > + + :set foldmethod=expr + :set foldexpr=strlen(substitute(substitute(getline(v:lnum),'\\s','',\"g\"),'[^>].*','','')) + +次のようなテキストが折り畳まれます。試してみてください: + +> 相手が書いた文章 +> 相手が書いた文章 +> > 相手が引用した私の文章 +> > 相手が引用した私の文章 + +上記の 'foldexpr' の設定を説明します (呼び出しの深い順番): + getline(v:lnum) 現在行を取得 + substitute(...,'\\s','','g') 行から空白を削除 + substitute(...,'[^>].*','','') 先頭の '>' 以降を全て削除 + strlen(...) 文字の長さ('>' の数)を数える + +Note: ":set" コマンドでは、空白とダブルクォートとバックスラッシュのすべてに対 +してバックスラッシュを前置する必要があります。よくわからないときは: > + + :set foldexpr + +このコマンドで実際に設定された値を確認してください。複雑な式を書いていてそれを +修正したい場合は、コマンドライン補完を使ってください: > + + :set foldexpr=<Tab> +< +<Tab> は実際の Tab キーです。現在の設定値が入力されるので、それを編集できます。 + +複雑な式を使いたい場合はその処理を関数にして、'foldexpr' からはその関数を呼ぶ +ように設定してください。 + +スクリプトにより折り畳みの詳しい説明はリファレンスマニュアルを参照してください: +|fold-expr| + +============================================================================== +*28.9* 変更のない行を折り畳む + +'diff' オプションと合わせて使うと便利です。|vimdiff| コマンドを使ったときもこ +の設定が適用されます。例: > + + :setlocal diff foldmethod=diff scrollbind nowrap foldlevel=1 + +同じファイルの別バージョンを表示しているすべてのウィンドウでこの設定を実行して +ください。同じ部分は折り畳まれ、違いのある行だけが表示されるようになります。 + +詳細は |fold-diff| 参照。 + +============================================================================== +*28.10* どれを使えばいいの? + +いろんな方法があるのでどれを使えばいいか悩んでしまいますね。残念ながら完璧な答 +えはありません。いくつかヒントを示します。 + +編集したい言語の構文ファイルが折り畳みに対応している場合は、それを使うのがおそ +らくベストです。あるいは自分で書いてみるのもいいかもしれません。構文ファイルの +作成には検索パターンの詳しい知識が必要です。簡単な仕事ではありませんが、それが +動作するようになれば、手動で折り畳みを定義する必要がなくなります。 + +テキストのフォーマットが不定な場合は手動で折り畳みを定義してください。 +|:mkview| を使えば折り畳みを保存したり復元したりできます。 + +マーカーを使う方法はファイルにマーカーを書き込む必要があります。他の人とファイ +ルを共有したり、社内のコーディング規約に従う必要がある場合は使えないかもしれま +せん。 +マーカーの利点は折り畳みを明示的に設置できることです。折り畳みをカット&ペース +トしたときに前後の不要な行が変更されたりしません。折り畳まれた行に表示されるコ +メントを指定することもできます。 + +インデントによる折り畳みはたいていのファイルで機能しますが、うまく機能しない場 +合もあります。他の方法が使えない場合に使ってください。しかしアウトラインを表示 +する方法としては非常に便利です。'shiftwidth' の幅ずつインデントを付けて折り畳 +みレベルを指定します。 + +スクリプトを使った方法はほとんどの構造化されたテキストを折り畳むことができま +す。設定方法もシンプルです。折り畳みの開始と終了を認識するのが容易な場合は特に +簡単です。 +この方法で折り畳みを定義したときに思ったとおりの折り畳みが作成されなかった場合 +は "manual" に切り替えてみてください。設定を変更しても折り畳みは削除されないの +で、そのまま手動で折り畳みを削除したり追加したりできます。 + +============================================================================== + +次章: |usr_29.txt| プログラムの中を移動する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_29.jax b/plugins/vimdoc-ja/doc/usr_29.jax new file mode 100644 index 0000000000..dcc1b690a1 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_29.jax @@ -0,0 +1,614 @@ +*usr_29.txt* For Vim バージョン 8.0. Last change: 2016 Feb 27 + + VIM USER MANUAL - by Bram Moolenaar + + プログラムの中を移動する + + +Vim の作者はプログラマです。当然、プログラムを書くための機能が Vim にはたくさ +んあります。この章では、識別子が定義された場所、あるいは使われている場所にジャ +ンプしたり、その定義を別のウィンドウでプレビューしたりする方法を説明します。プ +ログラミング関連の機能は次章でも説明します。 + +|29.1| タグを使う +|29.2| プレビューウィンドウ +|29.3| プログラムの中を移動する +|29.4| グローバル識別子を検索する +|29.5| ローカル識別子を検索する + +次章: |usr_30.txt| プログラムの編集 +前章: |usr_28.txt| 折り畳み +目次: |usr_toc.txt| + +============================================================================== +*29.1* タグを使う + +タグとは、識別子が定義された場所のことです。例えば C や C++ の関数定義がそうで +す。タグの一覧はタグファイルに保存されます。Vim はタグファイルに対応しており、 +タグ、つまり識別子の定義場所に直接ジャンプできます。 +カレントディレクトリのすべての C ファイルからタグを生成するには、次のコマンド +を使います: > + + ctags *.c + +"ctags" は Vim に付属してません。ほとんどの Unix システムには最初からインス +トールされています。持っていない場合は Exuberant ctags を使ってください: + + http://ctags.sf.net ~ + +Vim のコマンドラインから次のコマンドを実行すると関数定義にジャンプできます: > + + :tag startlist + +"startlist" 関数が検索されます。他のファイルで定義されていても検索可能です。 +CTRL-] コマンドを使うとカーソルの下の単語をタグとみなしてジャンプできます。こ +れは複雑な C コードの探索を簡単にしてくれます。例えば、"write_block" 関数の中 +で "write_line" の呼び出しを見つけたとき、その関数の動作を知りたかったら、 +"write_line" にカーソルを合わせて CTRL-] を押せば、その関数の定義にジャンプで +きます。 +"write_line" の中で "write_char" が呼ばれていたら、その関数の動作も調べる必要 +があります。"write_char" にカーソルを合わせて CTRL-] を押しましょう。これ +で "write_char" の定義に移動できました。 + + +-------------------------------------+ + |void write_block(char **s; int cnt) | + |{ | + | int i; | + | for (i = 0; i < cnt; ++i) | + | write_line(s[i]); | + |} | | + +-----------|-------------------------+ + | + CTRL-] | + | +----------------------------+ + +--> |void write_line(char *s) | + |{ | + | while (*s != 0) | + | write_char(*s++); | + |} | | + +--------|-------------------+ + | + CTRL-] | + | +------------------------------------+ + +--> |void write_char(char c) | + |{ | + | putchar((int)(unsigned char)c); | + |} | + +------------------------------------+ + +":tags" コマンドで移動経路を確認できます: + + :tags + # TO tag FROM line in file/text ~ + 1 1 write_line 8 write_block.c ~ + 2 1 write_char 7 write_line.c ~ + > ~ + +では元の場所に戻りましょう。CTRL-T で直前のタグに戻れます。上の例であれば、 +"write_line" 関数の中の "write_char" の呼び出しに戻ることになります。 +このコマンドはカウント指定を付けてジャンプする回数を指定できます。前方にジャン +プして、そして戻ってくることができましたね。もう一度前方に移動してみましょう。 +次のコマンドでタグリストの前方に移動できます: > + + :tag + +コマンドの前にカウント指定を付けてジャンプする回数を指定できます。例えば +":3tag" のように使います。CTRL-T も同様に回数指定できます。 +このように、CTRL-] をで呼び出しをたどり、CTRL-T でさかのぼることができます。 +":tags" コマンドで現在地を確認できます。 + + +ウィンドウを分割する +-------------------- + +":tag" コマンドはカレントウィンドウを使ってジャンプ先のファイルを表示します。 +しかし現在の関数とジャンプ先の関数を同時に表示したいこともあると思います。 +":split" コマンドでウィンドウを分割してから ":tag" コマンドを使うという方法も +ありますが、専用の短縮コマンドが用意されています: > + + :stag tagname + +カーソルの下の単語にタグジャンプするときにウィンドウを分割したい場合は次のコマ +ンドを使います: > + + CTRL-W ] + +カウント指定を付けて新しいウィンドウの高さを指定できます。 + + +複数のタグファイルを使う +------------------------ + +ファイルが複数のディレクトリに分れている場合、ディレクトリ毎にタグファイルを作 +ることもできますが、その方法だとタグファイルと同じディレクトリのファイルにしか +ジャンプできません。 +タグファイルが複数ある場合は 'tags' オプションを設定して、関連するすべてのタグ +ファイルが検索されるようにしてください。例: > + + :set tags=./tags,./../tags,./*/tags + +カレントファイルと同じディレクトリ、その一つ上のディレクトリ、すべてのサブディ +レクトリからタグファイルが検索されます。 +これでかなり多くのタグファイルが使えるようになりましたが、まだ十分ではないかも +しれません。例えば "~/proj/src" を編集しているときに "~/proj/sub/tags" を見つ +けることができません。そのような場合はディレクトリツリー全体を検索するように設 +定します。例: > + + :set tags=~/proj/**/tags + + +タグファイルを一つだけ使う +-------------------------- + +たくさんの場所からタグファイルを検索しているときは、ハードディスクがガリガリと +音を立てるのが聞こえると思います。これは効率が良くありません。そんなときは少し +時間を掛けて一つの巨大なタグファイルを生成するのがベストです。寝ている間にでも +やってしまうといいでしょう。 +それには上述した Exuberant ctags が必要です。このプログラムにはディレクトリツ +リー全体を検索するためのオプションがあります: > + + cd ~/proj + ctags -R . + +Exuberant ctags のいいところは、いろんなファイルタイプを認識してくれるところで +す。C や C++ だけでなく Effiel や Vim script も処理できます。詳しくは ctagsの +ドキュメントを参照してください。 +これで、巨大なタグファイルを一つだけ指定するだけでよくなりました: > + + :set tags=~/proj/tags + + +定義の重複 +---------- + +同じ名前の関数が何度も定義されている場合、あるいは複数のクラスで同名のメソッド +が定義されている場合、":tag" コマンドは最初に見つかったタグにジャンプします。 +カレントファイル内にタグがある場合はそれが優先されます。 +タグが重複している場合は次のコマンドで別のタグにジャンプできます: > + + :tnext + +もう一度実行するとさらに別のタグにジャンプできます。タグがたくさんある場合は次 +のコマンドでタグを選択できます: > + + :tselect tagname + +このような選択画面が表示されます: + + # pri kind tag file ~ + 1 F f mch_init os_amiga.c ~ + mch_init() ~ + 2 F f mch_init os_mac.c ~ + mch_init() ~ + 3 F f mch_init os_msdos.c ~ + mch_init(void) ~ + 4 F f mch_init os_riscos.c ~ + mch_init() ~ + Enter nr of choice (<CR> to abort): ~ + +(行頭の) 番号を入力してジャンプしたい場所を選択してください。他の列にはタグの +場所を示すヒントが表示されます。 + +次のコマンドで他の重複タグに移動できます: + + :tfirst 最初のタグに移動 + :[count]tprevious [count]個 前のタグに移動 + :[count]tnext [count]個 次のタグに移動 + :tlast 最後のタグに移動 + +[count] を省略すると 1 が使われます。 + + +タグ名の推測 +------------ + +コマンドライン補完を使うと長いタグ名の入力が簡単になります。最初の数文字を入力 +してから <Tab> キーを押してください: > + + :tag write_<Tab> + +最初にマッチしたタグが補完されます。それが意図したタグでない場合は、目的のタグ +が見つかるまで <Tab> キーを押してください。 +関数名の一部しか知らない場合や、同じ文字で始まるタグ (後半だけが違っている) が +たくさんある場合は、パターンを使ってタグを検索できます。 +例えば、名前に "block" が含まれているタグにジャンプする場合は、まず次のように +入力します: > + + :tag /block + +そして、コマンドライン補完を使います。<Tab> キーを押してください。"block" を含 +むタグが検索され、最初にマッチしたタグが使われます。 +タグ名の前に "/" を付けると、続くタグ名はそのまま使われず、パターンとして解釈 +されます。検索パターンと同じ機能がすべて使えます。例えば、"write_" で始まるタ +グを選択したい場合は次のようにします: > + + :tselect /^write_ + +最初の "^" はタグ名が "write_" で始まることを示しています。"^" がない場合はタ +グ名の途中にもマッチしてしまいます。同様に、"$" を最後に付けるとタグ名の末尾に +マッチするようになります。 + + +タグブラウザー +------------ + +CTRL-] を使うとカーソルの下にある識別子の定義にジャンプできますが、これを利用 +すると、識別子の一覧を目次として使うことができます。例を示します。まず識別子の +一覧を作ります (Exuberant ctags が必要です) > + + ctags --c-types=f -f functions *.c + +そして Vim をファイル指定なしで起動し、作成したファイルを縦分割ウィンドウで開 +きます: > + + vim + :vsplit functions + +ウィンドウにはすべての関数の一覧が表示されています。関数以外の名前も含まれてい +るかもしれませんが、それは無視してください。":setlocal ts=99" を実行して表示を +見やすくします。 +このウィンドウで、次のマップを定義します: > + + :nnoremap <buffer> <CR> 0ye<C-W>w:tag <C-R>"<CR> + +表示したい関数の行に移動して <Enter> を押すと、カーソルが他のウィンドウに移動 +して、選択した関数にジャンプします。 + + +関連項目 +-------- + +タグ名の大文字と小文字を無視する場合には、'tagcase' を "ignore" に設定する +か、'tagcase' を "followic" のまま変更せず 'ignorecase' をオンに設定してくださ +い。 + +'tagbsearch' オプションにはタグファイルがソートされているかどうかを設定しま +す。初期設定ではソート済みに設定されています。これはタグの検索を高速に実行でき +ますが、ソートされていないタグファイルを扱えなくなります。 + +'taglength' オプションはタグの識別に使う文字数を指定するのに使います。 + +cscope はフリーのプログラムです。識別子の定義場所を探すだけでなく、それが使わ +れている場所も検索できます。|cscope| 参照。 + +============================================================================== +*29.2* プレビューウィンドウ + +コードの中で関数を呼び出すときには、その引数を正確に把握する必要があります。引 +数の意味は関数の定義を見ればわかります。タグの仕組みを使えば簡単に確認できます +が、できれば別のウィンドウに定義を表示したいところです。それにはプレビューウィ +ンドウを使います。 +次のようにすると "write_char" 関数をプレビューウィンドウで表示できます: > + + :ptag write_char + +ウィンドウが開いて "write_char" タグにジャンプします。カーソルの位置は動かない +ので CTRL-W コマンドを使って戻る必要はありません。 +テキストの中に関数名がある場合は、次のコマンドでその定義をプレビューウィンドウ +で表示できます: > + + CTRL-W } + +カーソルの下にある単語の定義場所を自動的に表示してくれるスクリプトもあります。 +|CursorHold-example|参照。 + +プレビューウィンドウを閉じるには次のコマンドを使います: > + + :pclose + +プレビューウィンドウでファイルを開きたい場合は ":pedit" を使います。例えばヘッ +ダーファイルを表示するような場合に便利です: > + + :pedit defs.h + +最後に ":psearch" コマンドを紹介します。カレントファイルおよびインクルードされ +ているファイルから単語を検索して、ヒットした場所をプレビューウィンドウで表示で +きます。これは例えば、ライブラリ関数を使っていて、それ用のタグファイルを作って +いないときに使います。例: > + + :psearch popen + +"stdio.h" がプレビューウィンドウで開き、popen() 関数のプロトタイプが表示されま +す: + + FILE *popen __P((const char *, const char *)); ~ + +プレビューウィンドウの高さは 'previewheight' オプションで設定できます (最初に +開いたときに使われる)。 + +============================================================================== +*29.3* プログラムの中を移動する + +プログラムには構造があるので、構文を認識することが可能です。その情報を利用して +移動するコマンドが用意されています。 +例えば C のプログラムには次のような構文がよく現れます: + + #ifdef USE_POPEN ~ + fd = popen("ls", "r") ~ + #else ~ + fd = fopen("tmp", "w") ~ + #endif ~ + +もっと長いかもしれませんし、入れ子になっていることもあります。"#ifdef" に移動 +して % を押すと "#else" にジャンプできます。もう一度 % を押すと "#endif" に +ジャンプします。さらに % を押すと "#ifdef" に戻ります。 +構文が入れ子になっている場合は、正しく対応しているものが検索されます。これは +"#endif" の書き忘れがないかどうか確認するのに便利です。 +"#if" と "#endif" の間にカーソルがあるとき、次のコマンドで開始位置にジャンプで +きます: > + + [# + +"#if" や "#ifdef" の中にいない場合は警告音が鳴ります。前方の "#else" または +"#endif" に移動するには次のコマンドを使います: > + + ]# + +これらのコマンドは、途中にある "#if" - "#endif" ブロックをスキップします。 +例: + + #if defined(HAS_INC_H) ~ + a = a + inc(); ~ + # ifdef USE_THEME ~ + a += 3; ~ + # endif ~ + set_width(a); ~ + +カーソルが最後の行にあるとき、"[#" で最初の行に移動できます。途中の "#ifdef" - +"#endif" ブロックはスキップされます。 + + +コードブロック内の移動 +---------------------- + +C のコードブロックは {} で囲まれています。ブロックはかなり大きい場合もありま +す。アウターブロック (最も外側のブロック) の開始位置に移動するには "[[" コマン +ドを使います。"][" でブロックの末尾に移動できます。このコマンドは行頭の "{" と +"}" をブロックの区切りとして認識します。 +"[{" コマンドで現在のブロックの開始位置に移動できます。同じレベルの {} ペアは +スキップされます。"]}" で末尾に移動できます。 +つまりこのような動作です: + + function(int a) + +-> { + | if (a) + | +-> { + [[ | | for (;;) --+ + | | +-> { | + | [{ | | foo(32); | --+ + | | [{ | if (bar(a)) --+ | ]} | + +-- | +-- break; | ]} | | + | } <-+ | | ][ + +-- foobar(a) | | + } <-+ | + } <-+ + +C++ や Java では、最も外側の {} ブロックはクラスです。その次のレベルの {} はメ +ソッドです。クラスの中で "[m" を使うと、前のメソッドの開始位置に移動できます。 +"]m" で次のメソッドの開始位置に移動できます。 + +"[]" で前の関数の末尾に移動、"]]" で次の関数の開始位置に移動できます。行頭が +"}" で始まる行が関数の末尾として認識されます。 + + int func1(void) + { + return 1; + +----------> } + | + [] | int func2(void) + | +-> { + | [[ | if (flag) + start +-- +-- return flag; + | ][ | return 2; + | +-> } + ]] | + | int func3(void) + +----------> { + return 3; + } + +()、{}、[] などの対括弧に移動する場合は "%" も使えることを忘れないでください。 +括弧の間に複数の行がはさまっていても機能します。 + + +カッコ内の移動 +-------------- + +"[(" と "])" は "[{" と "]}" と機能は同じです。ただし、{} のペアではなく () の +ペアに対して動作します。 +> + [( +< <-------------------------------- + <------- + if (a == b && (c == d || (e > f)) && x > y) ~ + --------------> + --------------------------------> > + ]) + +コメント内の移動 +---------------- + +コメントの開始位置に戻るには "[/" コマンドを使います。コメントの終了位置に移動 +するには "]/" を使います。これは /* - */ 形式のコメントのみ対応しています。 + + +-> +-> /* + | [/ | * A comment about --+ + [/ | +-- * wonderful life. | ]/ + | */ <-+ + | + +-- foo = bar * 3; --+ + | ]/ + /* a short comment */ <-+ + +============================================================================== +*29.4* グローバル識別子を検索する + +C プログラムを編集していて、変数の型が "int" なのか "unsigned" なのか分からな +かったら、"[I" コマンドで簡単に確認できます。 +例えば、"column" という単語の上でコマンドを実行すると: > + + [I + +マッチした行が一覧表示されます。カレントファイルとインクルードファイル (さらに +その中でインクルードされているファイル) が検索されます。検索結果は次のように表 +示されます: + + structs.h ~ + 1: 29 unsigned column; /* column number */ ~ + +インクルードファイルも検索されるという点が、タグやプレビューウィンドウを使った +検索よりも便利です。たいていは正しい定義場所が見つかります。タグファイルが更新 +されていなくても、インクルードファイル用のタグファイルがなくても機能します。 +ただし、"[I" が動作するためには少し条件があります。ファイルのインクルードを認 +識するために、'include' オプションが正しく設定されていなければなりません。初期 +設定は C と C++ 用に設定されているので、他の言語では設定を変更する必要がありま +す。 + + +インクルードファイルの場所 +-------------------------- + +インクルードファイルは 'path' オプションに設定された場所から検索されます。設定 +に含まれていないディレクトリがあると、いくつかのインクルードファイルは検出でき +ないかもしれません。次のコマンドで検出できないファイルを確認できます: > + + :checkpath + +検出できなかったインクルードファイルの一覧が表示されます。インクルードファイル +の中のインクルードも検査されます。次のような結果が表示されます: + + --- Included files not found in path --- ~ + <io.h> ~ + vim.h --> ~ + <functions.h> ~ + <clib/exec_protos.h> ~ + +カレントファイルでインクルードしている "io.h" が見つかっていません。"vim.h" は +見つかったので ":checkpath" はさらにそのファイルのインクルードも検査しました。 +そして、"functions.h" と "clib/exec_protos.h" が見つかりませんでした。 + + Note: + Vim はコンパイラではないので、"#ifdef" ステートメントを認識しません。 + つまり、"#if NEVER" で囲まれている "#include" ステートメントもすべて検 + 査されます。 + +この問題を修正するには 'path' オプションにディレクトリを追加します。Makefileを +見れば必要なディレクトリがわかると思います。"-I/usr/local/X11" のように、"-I" +が使われている行を調べてください。次のコマンドでディレクトリを追加できます: > + + :set path+=/usr/local/X11 + +サブディレクトリがたくさんある場合はワイルドカード "*" が使えます。例: > + + :set path+=/usr/*/include + +これで "/usr/local/include/" や "/usr/X11/include/" などが検索対象になります。 + +ディレクトリツリーのあちこちにインクルードファイルがあるようなプロジェクトでは +"**" が便利です。すべてのサブディレクトリを検索できます。例: > + + :set path+=/projects/invent/**/include + +例えば次のようなディレクトリからファイルが検索されます: + + /projects/invent/include ~ + /projects/invent/main/include ~ + /projects/invent/main/os/include ~ + etc. + +設定方法は他にもあります。'path' オプションの説明を確認してください。 +実際に検出されたインクルードファイルを確認したい場合は次のコマンドを使います: +> + :checkpath! + +インクルードされているファイルの (長大な) 一覧が表示されます。出力を短くするた +め、同じファイルを見つけた場合は "(Already listed)" とだけ表示し、その中のイン +クルードファイルは表示しません。 + + +定義場所にジャンプする +---------------------- + +"[I" はマッチした行だけを一覧表示します。その周辺を見たい場合は、次のコマンド +で最初のマッチにジャンプします: > + + [<Tab> +< +<Tab> と CTRL-I は同じなので "[ CTRL-I" でも構いません。 + +"[I" で表示される一覧には番号が付いています。最初の項目以外の場所にジャンプし +てい場合は番号を指定してください: > + + 3[<Tab> + +三番目のマッチにジャンプします。CTRL-O で元の場所に戻れることをお忘れなく。 + + +関連コマンド +------------ + + [i 最初のマッチだけ表示 + ]I カーソルより後ろのマッチを一覧表示 + ]i カーソルより後ろの最初のマッチだけ表示 + + +定義済識別子の検索 +------------------ + +"[I" コマンドはすべての識別子を検索します。"#define" で定義されたマクロだけを +検索するには次のコマンドを使います: > + + [D + +このコマンドもインクルードファイルが検索対象になります。検索される行の書式は +'define' オプションで指定します。C と C++ 以外の言語では設定を変更する必要があ +ります。 +次のような "[D" に関連したコマンドがあります: + + [d 最初のマッチだけ表示 + ]D カーソルより後ろのマッチを一覧表示 + ]d カーソルより後ろの最初のマッチだけ表示 + +============================================================================== +*29.5* ローカル識別子を検索する + +"[I" コマンドはインクルードファイルの中も検索します。カーソルの下の単語が最初 +に現れる場所を、カレントファイルの中だけ検索し、その場所にジャンプするには、次 +のコマンドを使います: > + + gD + +ヒント: Goto Definition (定義に移動)。このコマンドはローカル(C 用語で "static") +に定義された変数や関数を検索するのに便利です。例 (カーソルは "counter" の上): + + +-> static int counter = 0; + | + | int get_counter(void) + gD | { + | ++counter; + +-- return counter; + } + +さらに検索範囲を狭めて、現在の関数の中だけ検索したい場合は次のコマンドを使いま +す: > + + gd + +現在の関数の開始位置から最初に単語が使われている場所が検索されます。実際に、行 +頭が "{" で始まる行を後方検索して、その上の空行まで戻り、そこから識別子を前方 +検索しています。例 (カーソルは "idx" の上): + + int find_entry(char *name) + { + +-> int idx; + | + gd | for (idx = 0; idx < table_len; ++idx) + | if (strcmp(table[idx].name, name) == 0) + +-- return idx; + } + +============================================================================== + +次章: |usr_30.txt| プログラムの編集 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_30.jax b/plugins/vimdoc-ja/doc/usr_30.jax new file mode 100644 index 0000000000..98d5e5a8c7 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_30.jax @@ -0,0 +1,632 @@ +*usr_30.txt* For Vim バージョン 8.0. Last change: 2007 Nov 10 + + VIM USER MANUAL - by Bram Moolenaar + + プログラムの編集 + + +プログラミングに役立つ機能が Vim にはたくさんあります。プログラムをコンパイル +してエラーが出た行にジャンプしたり、言語に合わせて自動的にインデントしたり、コ +メントを整形したりできます。 + +|30.1| コンパイル +|30.2| C 言語系インデント +|30.3| インデント設定の自動化 +|30.4| その他のインデント +|30.5| タブとスペース +|30.6| コメントの整形 + +次章: |usr_31.txt| GUI を活用する +前章: |usr_29.txt| プログラムの中を移動する +目次: |usr_toc.txt| + +============================================================================== +*30.1* コンパイル + +Vim にはクイックフィックス (quickfix) 機能があります。これは、Vim の中でプログ +ラムをコンパイルして、エラーになった場所に移動し、エラーを修正するための機能で +す。そうして、正常にコンパイルできるまでコンパイルとエラー修正を繰り返します。 + +次のコマンドは "make" を実行し、その出力を読み込みます (引数はそのまま渡されま +す): > + + :make {arguments} + +エラーが発生するとそれが認識され、最初のエラーにカーソルが移動します。 +":make" の使い方を実際に見てみましょう。(典型的な :make セッションはもっと多く +のエラーあるいは少しのゴミを出力しますが) ":make" を実行すると次のような出力が +画面に表示されます: + + :!make | &tee /tmp/vim215953.err ~ + gcc -g -Wall -o prog main.c sub.c ~ + main.c: In function 'main': ~ + main.c:6: too many arguments to function 'do_sub' ~ + main.c: At top level: ~ + main.c:10: parse error before '}' ~ + make: *** [prog] Error 1 ~ + + 2 returned ~ + "main.c" 11L, 111C ~ + (3 of 6): too many arguments to function 'do_sub' ~ + Hit ENTER or type command to continue ~ + +"main.c" の中でエラーが発生していることが確認できると思います。<Enter> を押す +と "main.c" ファイルが開き、6 行目 (最初のエラー) にカーソルが移動します。自分 +でファイルを開く必要はありません。Vim はエラーメッセージを認識できます。 + + +---------------------------------------------------+ + |int main() | + |{ | + | int i=3; | + cursor -> | do_sub("foo"); | + | ++i; | + | return (0); | + |} | + |} | + | ~ | + |(3 of 12): too many arguments to function 'do_sub' | + +---------------------------------------------------+ + +このコマンドで次のエラーに移動できます: > + + :cnext + +カーソルが 10 行目に移動します。ファイルの最終行に余分な '}' がありますね。長 +すぎるエラーメッセージは省略して表示されます。全部を表示するには次のコマンドを +使います: > + + :cc + +すべてのエラーメッセージを表示するには ":clist" コマンドを使います。次のような +出力が表示されます: > + + :clist +< 3 main.c: 6:too many arguments to function 'do_sub' ~ + 5 main.c: 10:parse error before '}' ~ + +ファイル名と行番号が認識された行だけが表示されますが、それは、重要なのはそのよ +うな行だけで、他の行は無駄なメッセージであると判断されるからです。しかし時に +は、認識されなかった行が重要な情報を含んでいることもあります。例えばリンカが未 +解決の関数をエラー表示した場合などです。すべてのメッセージを表示するにはコマン +ドに "!" を付けます: > + + :clist! +< 1 gcc -g -Wall -o prog main.c sub.c ~ + 2 main.c: In function 'main': ~ + 3 main.c:6: too many arguments to function 'do_sub' ~ + 4 main.c: At top level: ~ + 5 main.c:10: parse error before '}' ~ + 6 make: *** [prog] Error 1 ~ + +現在のエラーは強調表示されます。前のエラーに戻るには次のコマンドを使います: > + + :cprevious + +エラーリストを移動するコマンドは他にもあります: + + :cfirst 最初のエラー + :clast 最後のエラー + :cc 3 3つ目のエラー + + +他のコンパイラを使う +-------------------- + +":make" コマンドが実際に実行するプログラムは 'makeprg' オプションで設定しま +す。通常は "make" に設定されていますが、例えば Visual C++ を使う場合は "nmake" +に設定する必要があります: > + + :set makeprg=nmake + +オプションにはプログラムの引数も含めることができます。特殊文字はバックスラッ +シュでエスケープしてください。例: > + + :set makeprg=nmake\ -f\ project.mak + +プログラムの設定には特殊なキーワードが使えます。文字 % はカレントファイルの名 +前に展開されます。例えば次のように設定すると: > + + :set makeprg=make\ %:S + +main.c を編集しているときに ":make" を実行すると次のコマンドが実行されます: > + + make main.c + +これ自体はそれほど便利ではありませんが、すこし変更して :r (root) 修飾子を使う +とどうでしょう: > + + :set makeprg=make\ %:r:S.o + +これで、実行されるコマンドは次のようになります: > + + make main.o + +修飾子については |filename-modifiers| を参照してください。 + + +古いエラーリスト +---------------- + +例えば ":make" を実行したときに、一つのファイルで警告メッセージが出て、他の +ファイルではエラーが出たとします。エラーを修正し、本当に直ったかどうかを確認す +るためにもう一度 ":make" を実行しました。さて、ここで先程の警告メッセージを確 +認しようとしても、エラーリストには警告メッセージありません。なぜなら、警告メッ +セージを出したファイルは再コンパイルされなかったからです。次のコマンドで古いエ +ラーリストに戻ることができます: > + + :colder + +":clist" と ":cc {nr}" を使って、警告が発生した場所にジャンプしましょう。 +次のコマンドで新しいエラーリストに戻れます: > + + :cnewer + +全部で 10 個までのエラーリストを保持しておくことができます。 + + +他のコンパイラを使う +-------------------- + +コンパイラが出力するエラーメッセージの書式を調べ、'errorformat' オプションを設 +定する必要があります。このオプションの構文は非常に複雑ですが、どのようなコンパ +イラにも対応できます。詳しい説明は |errorformat| を参照してください。 + +複数のコンパイラを使うとき、コンパイラを変更するたびに 'makeprg' や +'errorformat' を設定するのは面倒ですよね。簡単な方法が用意されています。例え +ば、Microsoft Visual C++ なら次のように設定します: > + + :compiler msvc + +"msvc" 用のスクリプトが検索され、適切なオプションが設定されます。 +自分で設定スクリプトを書くこともできます。|write-compiler-plugin| 参照。 + + +出力のリダイレクト +------------------ + +":make" コマンドは、実行したプログラムの出力をエラーファイルにリダイレクトしま +す。その動作はいろいろな要因に依存しています (例えば 'shell' オプション)。 +":make" コマンドがプログラムの出力を拾えていないようなら、'makeef' オプション +と 'shellpipe' オプションを確認してみてください。'shellquote' オプションと +'shellxquote' オプションも関係あるかもしれません。 + +どうしても ":make" コマンドのリダイレクトが機能しない場合は、シェルからコンパ +イルを実行して、その出力をファイルにリダイレクトしてください。そして、次のコマ +ンドでそのファイルを読み込みます: > + + :cfile {filename} + +":make" コマンドと同様にエラーにジャンプできます。 + +============================================================================== +*30.2* C 言語系インデント + +プログラムを適切にインデントするとコードが読みやすくなります。Vim の機能を使え +ばインデントするのは簡単です。C 言語、あるいは C++ や Java などの C スタイルの +プログラムなら 'cindent' オプションをオンに設定してください。C 言語のインデン +トは組み込みで用意されていて、複雑な構文でも適切にインデントできます。インデン +トに使うスペースの数は 'shiftwidth' オプションで設定します。スペース 4 個くら +いが適切でしょうか。次のコマンドで設定できます: > + + :set cindent shiftwidth=4 + +このオプションを設定すると、例えば "if (x)" と入力したときに、次の行が自動的に +インデントされます。 + + if (flag) + インデントが増える ---> do_the_work(); + インデントが減る <-- if (other_flag) { + インデントが増える ---> do_file(); + インデントそのまま do_some_more(); + インデントが減る <-- } + +波カッコ ({}) の中でテキストを入力すると、最初の行でインデントが増え、最後の行 +でインデントが減ります。インデントが減るのは '}' を押したタイミングです (入力 +を予測することはできないので)。 + +自動インデントには、コーディングのミスを早く発見できるという副作用があります。 +例えば、関数の最後で } を入力したときに、インデントが本来よりも多くなったとし +たら、どこかで } を入力し忘れています。"%" コマンドを使って、最後に入力した } +と対になっている { を探しましょう。 +同様に、) や ; を忘れると、次の行のインデントが増えます。もし予想よりもインデ +ントが多くなってしまった場合は直前の行を確認してください。 + +書式が汚いコードを編集するとき、あるいは編集によってインデントが崩れてしまった +場合、コードを再インデントする必要があります。それには "=" オペレータを使いま +す。最も単純なのは次の使い方です: > + + == + +現在行がインデントされます。他のオペレータと同様、使い方は三通りあります。ビ +ジュアルモードで "=" を使うと、選択範囲の行がインデントされます。テキストオブ +ジェクトで便利なのは "a{" です。これは現在のブロックを選択します。つまり、次の +コマンドでコードのブロックをインデントできます: > + + =a{ + +コードが根本的に汚い場合は、次のコマンドでファイル全体を再インデントできます: +> + gg=G + +ただし、手作業で丁寧にインデントされたファイルに対してこれを実行してはいけませ +ん。自動インデントは良い仕事をしてくれますが、場合によってはそのルールを破る必 +要もあるからです。 + + +インデントスタイルの設定 +------------------------ + +インデントスタイルは人によってさまざまです。初期設定では 90% のプログラマが満 +足するようなスタイルに設定されています。しかし、世の中にはいろいろなスタイルが +あるので、必要なら、'cinoptions' を設定することで、インデントスタイルをカスタ +マイズできます。 +'cinoptions' の初期設定は空です。その場合はデフォルトのスタイルが使われます。 +このオプションに値を追加していくことでスタイルを変更できます。例えば、波カッコ +の位置を次のようにしたい場合は: + + if (flag) ~ + { ~ + i = 8; ~ + j = 0; ~ + } ~ + +次のコマンドを使います: > + + :set cinoptions+={2 + +設定できる項目はたくさんあります。|cinoptions-values| 参照。 + +============================================================================== +*30.3* インデント設定の自動化 + +C ファイルを開くたびに 'cindent' オプションを設定するのは面倒ですよね。インデ +ントの設定は自動化できます: > + + :filetype indent on + +実際には、C ファイルに対して 'cindent' をオンにする以外の機能も有効になりま +す。まず最初に、ファイルタイプの認識が有効になります。認識機能は構文強調表示で +使われているものと同じです。 +ファイルタイプが認識されると、そのファイルタイプ用のインデントファイルが検索さ +れます。Vim にはさまざまな言語に対応したインデントファイルが付属しています。イ +ンデントファイルが読み込まれ、自動インデントのための設定が行われます。 + +インデント設定の自動化は次のコマンドでオフにできます: > + + :filetype indent off + +特定のファイルタイプだけインデントを無効にしたい場合は、次のような一行だけの +ファイルを作成してください: > + + :let b:did_indent = 1 + +これを、決められた名前で保存します: + + {directory}/indent/{filetype}.vim + +{filetype} は "cpp" や "java" といったファイルタイプの名前です。次のコマンドで +Vim が使っている名前を確認できます: > + + :set filetype + +例えばこのヘルプファイルなら次のように表示されます: + + filetype=help ~ + +したがって、{filetype} には "help" が入ります。 +{directory} はランタイムディレクトリです。次のコマンドの出力を調べてください: +> + set runtimepath + +ここでは先頭のパスを使います。つまり、出力が次のようなら: + + runtimepath=~/.vim,/usr/local/share/vim/vim60/runtime,~/.vim/after ~ + +{directory} には "~/.vim" が入ります。したがって、ファイル名は次のようになりま +す: + + ~/.vim/indent/help.vim ~ + +インデントをオフにするのではなく、自分のインデントファイルを作成したい場合は、 +|indent-expression| を参照してください。 + +============================================================================== +*30.4* その他のインデント + +最もシンプルな自動インデントは 'autoindent' オプションを使う方法です。これは直 +前の行と同じインデントを使います。'smartindent' はもう少しスマートです。これは +インデントファイルが用意されていないような場合に使います。'smartindent' は +'cindent' より低機能ですが、'autoindent' よりは高機能です。 +'smartindent' をオンにすると、{ でインデントが一つ増え、} で減ります。さらに、 +'cinwords' オプションに設定された単語が現れた場合もインデントが増えます。# で +始まる行は特別扱いされ、一切インデントされません。つまり、プリプロセッサーディ +レクティブの行はインデントされません。その次の行は通常通りインデントされます。 + + +インデントの訂正 +---------------- + +'autoindent' や 'smartindent' を設定すると、直前の行と同じインデントを使うこと +ができますが、自分でインデントを ('shiftwidth' の幅ずつ) 増やしたり減らしたり +する必要も多々あります。それには挿入モードで CTRL-D と CTRL-T を使うと簡単で +す。例えば、次のようなシェルスクリプトを入力してみましょう: + + if test -n a; then ~ + echo a ~ + echo "-------" ~ + fi ~ + +まず、次のオプションを設定します: > + + :set autoindent shiftwidth=3 + +一行目を入力し、<Enter> を押して二行目を開始します: + + if test -n a; then ~ + echo ~ + +二行目にはインデントが必要ですね。CTRL-T を押します: + + if test -n a; then ~ + echo ~ + +挿入モードの CTRL-T コマンドは、'shiftwidth' の幅だけインデントを増やします。 +カーソルの位置は関係ありません。 +二行目を入力し、<Enter> を押して三行目を開始します。三行目のインデントは問題あ +りません。<Enter> を押して最後の行を入力します。テキストは次のようになりまし +た: + + if test -n a; then ~ + echo a ~ + echo "-------" ~ + fi ~ + +最後の行の余分なインデントを削除するには CTRL-D 押します。これは 'shiftwidth' +の幅だけインデントを減らします。カーソルの位置は関係ありません。 +ノーマルモードでは ">>" コマンドと "<<" コマンドで同様の操作ができます。">" と +"<" はオペレータなので、他のオペレータと同様に、インデントを変更する範囲を三通 +りの方法で指定できます。次の組み合わせが特に便利です: > + + >i{ + +現在のブロックのインデントが増えます。変更されるのは {} の中だけで、{ と } 自 +体の行は変更されません。">a{" なら {} も含まれます。次の例では、カーソルは +"printf" の上にあります: + + original text after ">i{" after ">a{" + + if (flag) if (flag) if (flag) ~ + { { { ~ + printf("yes"); printf("yes"); printf("yes"); ~ + flag = 0; flag = 0; flag = 0; ~ + } } } ~ + +============================================================================== +*30.5* タブとスペース + +'tabstop' の初期設定は 8 です。変更することはできますが、それはトラブルの元に +なります。他のプログラムはあなたが使用しているタブ幅を知ることができません。そ +のようなプログラムでは、恐らくタブの幅は 8 であると仮定されているので、テキス +トが崩れて表示されてしまいます。また、ほとんどのプリンタはタブ幅を 8 で固定し +ています。したがって、'tabstop' を変更するのはお勧めしません。(他のタブ幅設定 +で書かれたテキストを修正したい場合は |25.3| を参照してください。) +プログラムをインデントする場合、8 桁単位でインデントするとすぐに画面が埋まって +しまいます。しかしスペースが一つだけではインデントが目立ちません。多くのプログ +ラマは (折衷して) 4 桁を好んで使います。 +<Tab> の幅は 8 桁で、インデントを 4 桁にしたいということは、<Tab> 文字を使って +インデントすることはできないということです。そのようなインデントには二つの方法 +があります: + +1. <Tab> とスペースを混在させる。<Tab> は 1 つでスペース 8 個分の幅になるので + ファイルサイズの節約になります。スペース 8 個より <Tab> の方が入力も削除も + 簡単です。 + +2. スペースだけを使う。違うタブ幅を使う他のプログラムでもトラブルが起きませ + ん。 + +Vim はどちらの方法もサポートしています。 + + +タブとスペースを混在させる +-------------------------- + +タブとスペースを混在させる場合は特別な設定は必要ありません。初期設定でうまくい +きます。 +'softtabstop' オプションを設定すると編集が少し楽になります。このオプションが設 +定されると、タブ幅が 'softtabstop' の値に設定されたかのように、<Tab> キーが動 +作します。しかし実際にはタブとスペースが混在して使われます。 +次のコマンドを実行すると、<Tab> キーでカーソルが 4 桁ごとに進むようになります: +> + :set softtabstop=4 + +行頭で <Tab> を押すと、スペースが 4 個挿入されます。次に <Tab> を押すと、最初 +のスペース 4 個が削除されて <Tab> 文字が挿入されます (つまりカーソルは 8 列 +目)。このように、スペースは可能な限り <Tab> 文字で置き換えられます。 +バックスペースはその反対の動作になります。<BS> を押すと、'softtabstop' の幅だ +け削除されます。可能な限り <Tab> が使われ、余りはスペースになります。 +次の図は、<Tab> をいくつか入力してから <BS> を使ったときの様子を示しています。 +"." はスペースで "------->" は <Tab> です。 + + 入力 結果 ~ + <Tab> .... + <Tab><Tab> -------> + <Tab><Tab><Tab> ------->.... + <Tab><Tab><Tab><BS> -------> + <Tab><Tab><Tab><BS><BS> .... + +同様の動作は 'smarttab' オプションを使っても実現できます。このオプションを設定 +した場合、インデントの入力のために <Tab> を押すと 'shiftwidth' の幅が使われ、 +何かの文字より後ろでは実際の <Tab> 文字が使われます。ただし、<BS> の動作は +'softtabstop' のときと同様にはなりません。 + + +スペースだけを使う +------------------ + +Tab 文字を一切使いたくない場合は 'expandtab' オプションを設定してください: > + + :set expandtab + +このオプションをオンにすると、<Tab> キーでスペースが入力されるようになります。 +つまり、<Tab> 文字と同じ量のスペースが挿入され、<Tab> 文字は使われません。 +バックスペースキーはスペースを一つずつ削除するので、<Tab> を押した後でそれを削 +除するには <BS> を 8 回押さなければなりません。インデントの削除は CTRL-D を使 +うと簡単です。 + + +タブをスペースに変換する (あるいはその逆) +----------------------------------------- + +'expandtab' を設定しても、それ以前に入力されたタブ文字は影響を受けません。つま +り、文章中のタブ文字はタブ文字のままです。タブ文字をスペースに変換したい場合 +は、":retab" コマンドを使ってください。次のように使います: > + + :set expandtab + :%retab + +すべてのインデントがスペースに変換されます。ただし、何かの文字より後ろにある +(インデント以外の) タブ文字はそのままです。それらのタブ文字も変換したい場合は +コマンドに ! を付けます: > + + :%retab! + +これは少し注意が必要です。なぜなら、文字列の中のタブ文字も変換されてしまうから +です。文字列の中でタブ文字が使われているかどうかは、次の検索パターンで確認でき +ます: > + + /"[^"\t]*\t[^"]*" + +文字列の中でタブ文字を使うのはお勧めしません。トラブルを避けるためにも "\t" を +使ってください。 + +同様に、スペースをタブ文字に変換できます: > + + :set noexpandtab + :%retab! + +============================================================================== +*30.6* コメントの整形 + +Vim のすばらしいところはコメントを解釈できるところです。コメントの整形を指示す +るだけで適切に処理してくれます。 +例えば、次のようなコメントがあるとします: + + /* ~ + * This is a test ~ + * of the text formatting. ~ + */ ~ + +最初の行に移動して次のコマンドを実行すると、コメントを整形できます: > + + gq]/ + +"gq" はテキスト整形のためのオペレータです。"]/" はコメントの末尾に移動するコマ +ンドです。次のような結果になります: + + /* ~ + * This is a test of the text formatting. ~ + */ ~ + +各行の行頭が適切に処理されていますね。 +ビジュアルモードでテキストを選択してから "gq" を使う方法でも構いません。 + +新しい行を追加したい場合は、真ん中の行に移動して "o" を押します。次のような結 +果になります: + + /* ~ + * This is a test of the text formatting. ~ + * ~ + */ ~ + +行頭のスペースと * は自動的に挿入されるので、そのままコメントを入力することが +できます。テキストが 'textwidth' より長くなると自動的に改行されます。そのとき +も、行頭の * は自動的に挿入されます: + + /* ~ + * This is a test of the text formatting. ~ + * Typing a lot of text here will make Vim ~ + * break ~ + */ ~ + +この機能を使うには 'formatoptions' の設定が必要です: + + r 挿入モードで <Enter> を押したときに * を挿入する + o ノーマルモードで "o" または "O" を使ったときに * を挿入する + c コメントを 'textwidth' の幅で改行する + +詳しくは |fo-table| 参照。 + + +コメントの定義 +-------------- + +コメントの書式は 'comments' オプションで設定します。一行コメントと三部コメント +(開始、中間、終端からなるコメント) は分けて処理されます。 +ほとんどの一行コメントは特定の文字で始まります。C++ は //、メイクファイルは #、 +Vim は " です。例えば、C++ のコメントなら次のように設定します: > + + :set comments=:// + +コロンはフラグとコメント文字の区切りです。'comments' の設定は次のような形式で +指定します: + + {flags}:{text} + +この例のように、{flags} は空でも構いません。 +複数のアイテムを指定するときはコンマで区切ります。アイテムを複数指定できるの +で、同じファイルの中でいろんな種類のコメントを使うことができます。例えばメール +を返信するときに、相手のメッセージに ">" や "!" を付けて引用する場合は、次のよ +うに設定します: > + + :set comments=n:>,n:! + +二つのアイテムが設定されました。一つは ">" で開始するコメント、もう一つは "!" +で開始するコメントです。"n" フラグが使われているので、コメントを入れ子にできま +す。つまり、">" で開始する行は、">" の後ろに他のコメントを含んでいても構いませ +ん。この設定により、次のようなメッセージを整形することができます: + + > ! Did you see that site? ~ + > ! It looks really great. ~ + > I don't like it. The ~ + > colors are terrible. ~ + What is the URL of that ~ + site? ~ + +'textwidth' の設定を変更して (例えば 80 にして)、テキストを整形してみましょ +う。ビジュアルモードでテキストを選択してから "gq" を押します: + + > ! Did you see that site? It looks really great. ~ + > I don't like it. The colors are terrible. ~ + What is the URL of that site? ~ + +違う種類のコメントテキストは混ざっていませんね。 +二行目の "I" は一行目の末尾に入れることも可能ですが、しかし、一行目は "> !" で +始まり、二行目は ">" で始まっているため、それらのコメントは別のものであると判 +断されます。 + + +三部コメント (A THREE PART COMMENT) +------------ + +C のコメントは "/*" で始まり、中間には "*" が付き、"*/" で終わります。このよう +なコメントは次のように設定します: > + + :set comments=s1:/*,mb:*,ex:*/ + +開始部分は "s1:/*" です。"s" は三部コメントの開始を示します。フラグとコメント +文字 "/*" をコロンで区切っています。フラグには "1" が指定されていますが、これ +により中間部分がスペース一個分、字下げされます。 +中間部分は "mb:*" です。"m" は三部コメントの中間を示します。"b" フラグは、コメ +ント文字の後ろに空白が必要であることを示します。これを指定しないと、"*pointer" +などもコメントとして認識されてしまいます。 +終端部分は "ex:*/" です。"e" は三部コメントの終端を示します。"x" は特殊なフラ +グです。中間の * が自動的に挿入された直後に "/" を押すと、余計なスペースが削除 +されます。 + +詳細は |format-comments| を参照してください。 + +============================================================================== + +次章: |usr_31.txt| GUI を活用する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_31.jax b/plugins/vimdoc-ja/doc/usr_31.jax new file mode 100644 index 0000000000..316003f0e3 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_31.jax @@ -0,0 +1,264 @@ +*usr_31.txt* For Vim バージョン 8.0. Last change: 2007 May 08 + + VIM USER MANUAL - by Bram Moolenaar + + GUI を活用する + + +Vim は端末でも動作しますが、GUI 版の Vim にはさらに追加機能があります。ファイ +ルブラウザーを使ってファイルを選択したり、操作を確認するためのダイアログを表示 +したり、キーボードショートカットを使ってメニューにアクセスしたりできます。 + +|31.1| ファイルブラウザー +|31.2| 操作確認 +|31.3| メニューのショートカット +|31.4| Vim ウィンドウの位置とサイズ +|31.5| その他 + +次章: |usr_32.txt| undo ツリー +前章: |usr_30.txt| プログラムの編集 +目次: |usr_toc.txt| + +============================================================================== +*31.1* ファイルブラウザー + +[ファイル]/[開く...] メニューを実行するとファイルブラウザーが表示されます。ファ +イルブラウザーを使えば簡単にファイルを探すことができます。しかし例えば、[ウィ +ンドウを分割して開く] などのメニューは用意されていません。[ウィンドウ]/[分割] +を実行してから [ファイル]/[開く...] を実行することもできますが、面倒ですよね。 +他のコマンドと同様、ファイルブラウザーもコマンド入力で開くことができます。例え +ば、split コマンドに "browse" を付けることで、ファイルブラウザーを使うことがで +きます: > + + :browse split + +選択したファイルが ":split" コマンドで開かれます。キャンセルボタンを押した場合 +は何も実行されず、ウィンドウも分割されません。引数にファイルを指定すると、ファ +イルブラウザーの初期ディレクトリとして使われます。例: > + + :browse split /etc + +"/etc" ディレクトリでファイルブラウザーが開きます。 + +":browse" コマンドはファイルを開くためのコマンドと組み合わせて使います。 +ディレクトリを指定しなかった場合は、適切なディレクトリが選択されます。初期設定 +では、最後に使ったディレクトリが使われます。例えば、":browse split" で +"/usr/local/share" のファイルを開いた場合、次に ":browse" を使ったときは +"/usr/local/share" が使われます。 +この動作は 'browsedir' オプションで変更できます。次の値を設定できます: + + last 最後に使ったディレクトリ (初期設定) + buffer カレントバッファと同じディレクトリ + current カレントディレクトリ + +例えば、カレントディレクトリが "/usr" で、"/usr/local/share/readme" を開いてい +るとき、次のコマンドを実行すると: > + + :set browsedir=buffer + :browse edit + +"/usr/local/share" でブラウザーが開きます。次のように設定すると: > + + :set browsedir=current + :browse edit + +"/usr" で開きます。 + + Note: + 大抵のファイルブラウザーではキーボードが使えるので、マウスを使わなくて + も操作できます。操作方法はシステム依存なのでここでは説明しません。Vim + は (可能な限り) 標準のブラウザーを使用します。システムのドキュメントに + キーボードショートカットの説明が載っているはずです。 + +GUI を使っていない場合でも、ファイルエクスプローラーを使えばファイルブラウザー +と同じようにファイルを選択できます。ただし、":browse" コマンドは使えません。 +|netrw-browse| 参照。 + +============================================================================== +*31.2* 操作確認 + +ファイルが上書きされたり変更が失われたりするような操作は、間違って実行してしま +わないように保護されています。何かがマズいことになりそうなときは「本当にその操 +作を実行したい場合は ! を付けてください」というようなエラーメッセージが表示さ +れます。 +同じコマンドを再度入力したくない場合は、ダイアログを使うと便利です。"OK" か +"Cancel" を選ぶだけで動作を指示できます。 +例えば、ファイルを開いて変更を加えてから、次のコマンドで別のファイルを開きま +す: > + + :confirm edit foo.txt + +すると、次のようなダイアログが表示されます: + + +-----------------------------------+ + | | + | ? Save changes to "bar.txt"? | + | | + | YES NO CANCEL | + +-----------------------------------+ + +ファイルを保存したい場合は "YES" を選択します。変更を破棄したい場合は "NO" を +選択します。戻って状態を確認したい場合は "CANCEL" を選択します。"CANCEL" を選 +択すると元のファイルに戻れます。変更は失われません。 + +":browse" と同様、":confirm" もファイルを開くためのコマンドと組み合わせること +ができます。同時に使うこともできます: > + + :confirm browse edit + +カレントバッファが未保存ならダイアログが表示されます。そして、ファイルブラウ +ザーが表示され、ファイルを選択できます。 + + Note: + ダイアログはキーボードで操作できます。一般的には、<TAB> キーと矢印キー + で選択を変更し、<Enter> で決定します。操作方法はシステムにより異なりま + す。 + +":conform" コマンドは CUI 版の Vim でも使えます。ダイアログの代わりに Vim ウィ +ンドウの下部にメッセージが表示されるので、キーを押して操作を選択してください。 +> + :confirm edit main.c +< Save changes to "Untitled"? ~ + [Y]es, (N)o, (C)ancel: ~ + +どれか一つのキーを押すと選択できます。コマンドラインでの入力とは違い、<Enter> +を押す必要はありません。 + +============================================================================== +*31.3* メニューのショートカット + +キーボードを使えばすべてのコマンドを実行できます。メニューは (複雑な) コマンド +を簡単に使うための手段を提供しますが、キーボードから手を離してマウスを使わなけ +ればなりません。 +メニューはキーボードでも選択できます。キーボードが使えるかどうかはシステム依存 +ですが、大抵は大丈夫です。メニューを選択するには、メニューの下線付きの文字と +<Alt> キーを組み合わせて使います。例えば、<A-w> (<Alt>とw) で [ウィンドウ] メ +ニューが表示されます。 +[ウィンドウ] メニューの "分割(p)" アイテムは p に下線が付いているので、<Alt> +キーを押したまま p を押せば選択できます。 + +<Alt> キーでメニューを表示した後は、カーソルキーを使ってメニューを選択できま +す。サブメニューは <Right> で開いて <Left> で閉じることができます。閉じるのは +<Esc> でも可能です。<Enter> でメニューを実行します。 + +<Alt> キーはメニュー選択とキーマップの両方で使われるので操作が衝突します。 +<Alt> キーの動作は 'winaltkeys' オプションで設定できます。 +初期設定は "menu" です。メニューのショートカットと同じキーはマップできません +が、他のキーはマップすることができます。 +設定を "no" にすると、<Alt> キーを使ってメニューを選択できなくなります。メ +ニューを選択するにはマウスを使う必要がありますが、すべての <Alt> キーをマップ +できます。 +設定を "yes" にすると、<Alt> キーはメニューのために使われます。いくつかの +<Alt> キー操作はメニュー選択以外の動作になることもあります。 + +============================================================================== +*31.4* Vim ウィンドウの位置とサイズ + +次のコマンドでスクリーン上の Vim ウィンドウの位置を確認できます: > + + :winpos + +このコマンドは GUI でのみ機能します。次のような出力が表示されます: + + Window position: X 272, Y 103 ~ + +位置は画面のピクセル単位です。数値を指定して Vim ウィンドウを移動することもで +きます。例えば、左に 100 ピクセル移動するには次のようにします: > + + :winpos 172 103 +< + Note: + 指定した位置と実際に移動した位置が少しずれることがあります。これはウィ + ンドウの枠があるからです。ウィンドウマネージャーがずれを引き起こします。 + +このコマンドを起動スクリプトに書けば好きな位置でウィンドウを開くことができま +す。 + +Vim ウィンドウのサイズは文字数で計算されるので、実際の幅はフォントの大きさに依 +存します。次のコマンドで現在のサイズを確認できます: > + + :set lines columns + +サイズを変更するには 'lines' と 'columns' を設定します: > + + :set lines=50 + :set columns=80 + +CUI 端末でもサイズを取得することができますが、ほとんどの端末ではサイズを変更で +きません。 + +X-Windows 版の gvim では、ウィンドウの位置とサイズを起動引数で指定できます: > + + gvim -geometry {width}x{height}+{x_offset}+{y_offset} + +{width} と {height} は文字数です。{x_offset} と {y_offset} はピクセル数です。 +例: > + + gvim -geometry 80x25+100+300 + +============================================================================== +*31.5* その他 + +gvim はメールの編集にも使えます。そのためには、メーラーを設定して、gvim をエ +ディタとして選択する必要があります。しかしそれだけではうまくいきません。gvim +がまだ実行中にも関わらず、メーラーは、gvim が編集を終えたものと判断してしまい +ます。 +gvim が起動するとき、gvim はシェルから分離されます。これは、端末から gvim を起 +動したときに、gvim と端末を平行して使うことができるので便利です。gvim が終了す +るまで待機させたい場合は分離をしないようにする必要があります。それには "-f" 引 +数を使います: > + + gvim -f file.txt + +"-f" は "foreground" (操作中) の意味です。Vim を終了するまでシェルがブロックさ +れます。 + + +GUI の遅延スタート +------------------ + +Unix では gvim を vim として起動することができます。これはシェルの中だけで作業 +を完結したい場合に便利です。ファイルの編集中に GUI を使いたくなったら、次のコ +マンドで GUI を開始できます: > + + :gui + +GUI ウィンドウが開いて端末が開放されるので、同じ端末で他の作業を開始できます。 +"-f" 引数を指定するとフォアグラウンドで GUI を開始できます。":gui -f" のように +指定します。 + + +gvim の起動ファイル +------------------- + +gvim を起動すると、gvimrc ファイルが読み込まれます。これは Vim を起動したとき +に使われる vimrc ファイルのようなものです。gvimrc には、GUI を開始したときだけ +使いたい設定やコマンドを記述します。例えば、'lines' オプションを設定してウィン +ドウのサイズを変更できます: > + + :set lines=55 + +端末ではウィンドウサイズは固定なのでこの設定は必要ありません (サイズの変更をサ +ポートしている xterm もありますが)。 +gvimrc は vimrc と同じ場所から検索されます。通常、Unix では "~/.gvimrc"、 +MS-Windows では "$VIM/_gvimrc" が使われます。 +$MYGVIMRC 環境変数に、読み込まれたファイルの名前が設定されるので、次のコマンド +でそのファイルを開くことができます (ファイルが存在するなら): > + + :edit $MYGVIMRC + +何らかの理由で通常の gvimrc を使いたくない場合は、"-U" 引数で他のファイルを指 +定できます: > + + gvim -U thisrc ... + +いつもと違う設定で gvim を起動できます。例えばフォントのサイズを変更するなど。 +gvimrc を読み込みたくない場合は次のようにします: > + + gvim -U NONE ... + +============================================================================== + +次章: |usr_32.txt| undo ツリー + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_32.jax b/plugins/vimdoc-ja/doc/usr_32.jax new file mode 100644 index 0000000000..3cb5b533a3 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_32.jax @@ -0,0 +1,182 @@ +*usr_32.txt* For Vim バージョン 8.0. Last change: 2010 Jul 20 + + VIM USER MANUAL - by Bram Moolenaar + + undo ツリー + + +Vim にはマルチレベルの undo 機能があります。変更を undo してから新しい変更を加 +えると、undo ツリーに枝が作成されます。このテキストでは、枝を移動する方法を説 +明します。 + +|32.1| ファイル保存時への undo +|32.2| 変更の番号付け +|32.3| ツリーを飛び回る +|32.4| タイムトラベル + +次章: |usr_40.txt| 新しいコマンドを作る +前章: |usr_31.txt| GUI の活用 +目次: |usr_toc.txt| + +============================================================================== +*32.1* ファイル保存時への undo + +いくつかの変更を加えた後で、やっぱり最後にファイルを保存したときの状態に戻りた +いなと思うようなことがときどきあります。そんなときは次のコマンドを使います: > + + :earlier 1f + +"f" は "file" を意味します。 + +このコマンドを繰り返し実行してさらに過去に戻ることができます。あるいは、1 より +大きなカウント指定をすればもっと素早く過去に戻れます。 + +戻り過ぎてしまったときは次のコマンドで進むことができます: > + + :later 1f + +Note: このコマンドは時間を基準にして移動します。これは undo した後で何か変更を +加えていた場合に重要になってきます。それについては次の節で説明します。 + +Note: ここではテキストの保存の話をしています。undo 情報のファイルへの保存につ +いては |undo-persistence| を参照してください。 + +============================================================================== +*32.2* 変更の番号付け + +セクション |02.5| では一本道の undo/redo について説明しましたが、実は、 +undo/redo は分岐することができます。変更を undo してから新しい変更を加えると、 +新しい変更が undo ツリーの枝になります。 + +"one" というテキストから始めましょう。最初に " too" を追加します。次に too の +一つ目の 'o' を 'w' に変更します。これで、二つの変更 (番号 1、2) と、テキスト +の三つの状態ができました。 + + one ~ + | + change 1 + | + one too ~ + | + change 2 + | + one two ~ + +一つだけ変更を undo して "one too" の状態に戻り、"one" を "me" に変更します。 +すると、undo ツリーに枝が作成されます。 + + one ~ + | + change 1 + | + one too ~ + / \ + change 2 change 3 + | | + one two me too ~ + +この状態で |u| コマンドを使って undo してみてください。二回 undo すると "one" +に戻ります。|CTRL-R| で redo すると "one too" になります。もう一度 |CTRL-R| を +実行すると "me too" になります。このように、undo/redo を実行すると、最後に使わ +れた枝を上下に移動できます。 + +重要なのは変更が作成される順番です。undo ツリーにおいては、undo と redo は変更 +とはみなされません。それぞれの変更の後にはテキストの新しい状態があります。 + +Note: 変更にだけ番号が付きます。上図のツリーに示されている "テキスト" の部分に +は番号が付きません。テキストは、その上の変更番号によって参照されます。ただし、 +ツリーを上に移動したときなどは、下の変更番号によって参照されます (どの変更が +undo されたかわかるように)。 +{訳注: 例えば上図の "one too" から undo/redo したときのメッセージ: + undo したとき: 1 change; before #1 <- 下の番号が使われる + redo したとき: 1 change; after #3} + +============================================================================== +*32.3* ツリーを飛び回る + +さて、"one two" の状態を得るにはどうすればいいでしょうか。次のコマンドを使いま +す: > + + :undo 2 + +テキストが "one two" (change 2 の下) になります。|:undo| コマンドを使うと、指 +定した変更の下にジャンプできます。 + +新しい変更を加えてみましょう。"one" を "not" に変更します: + + one ~ + | + change 1 + | + one too ~ + / \ + change 2 change 3 + | | + one two me too ~ + | + change 4 + | + not two ~ + +何か考えが変わって "me too" に戻りたくなった場合は、|g-| コマンドを使います。 +このコマンドは時間を基準にして戻ります。ツリーを上下に移動するのではなく、直前 +の変更に移動します。 + +|g-| を繰り返し実行すると、テキストは次のように変化します: + me too ~ + one two ~ + one too ~ + one ~ + +|g+| を使えば時間を進めることができます: + one ~ + one too ~ + one two ~ + me too ~ + not two ~ + +ジャンプしたい変更番号が分かっているときには |:undo| が便利です。番号がよく分 +からないときには |g-| と |g+| が便利です。 + +|g-| と |g+| にカウント指定を付けると実行回数を指定できます。 + +============================================================================== +*32.4* タイムトラベル + +しばらくテキストを編集すると、ツリーは大きく成長します。そのとき、数分前のテキ +ストに戻りたいと思うことがあるかもしれません。 + +undo ツリーにどのような枝があるかを確認するには次のコマンドを使います: > + + :undolist +< number changes time ~ + 3 2 16 seconds ago + 4 3 5 seconds ago + +枝に付いている葉の数と、変更された時間が表示されます。今、change 4 の下 ("not +two") にいるとして、10 秒前に戻るには次のようにします: > + + :earlier 10s + +指定した時間だけ戻り、ツリーの特定の位置へ移動できます。|:earlier| コマンドの +引数は "m" で分、"h" で時間、"d" で日を指定することもできます。すべての変更を +元に戻したい場合は大きな値を指定してください: > + + :earlier 100d + +時間を進めるには |:later| コマンドを使います: > + + :later 1m + +|:earlier| と同様に、"s"、"m"、"h" で単位を指定します。 + +undo 情報の詳細を見たい、触りたい、という場合は |undotree()| 関数を使ってくだ +さい。関数が何を返すかは次のコマンドで確認できます: > + + :echo undotree() + +============================================================================== + +次章: |usr_40.txt| 新しいコマンドを作る + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_40.jax b/plugins/vimdoc-ja/doc/usr_40.jax new file mode 100644 index 0000000000..e78444bfaa --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_40.jax @@ -0,0 +1,658 @@ +*usr_40.txt* For Vim バージョン 8.0. Last change: 2013 Aug 05 + + VIM USER MANUAL - by Bram Moolenaar + + 新しいコマンドを作る + + +Vim は拡張可能なエディタです。よく使う操作を一つにまとめて新しいコマンドを作成 +したり、既存のコマンドを再定義したりできます。自動コマンドを使うと、コマンドを +自動的に実行できます。 + +|40.1| キーマッピング +|40.2| コマンドラインコマンドを定義する +|40.3| 自動コマンド + +次章: |usr_41.txt| Vim script 書法 +前章: |usr_32.txt| undo ツリー +目次: |usr_toc.txt| + +============================================================================== +*40.1* キーマッピング + +|05.3| で簡単なマップを説明しました。マップの原理は、キー操作を他のキー操作に +変換するというものです。単純ですが強力な仕組みです。 +典型的な使い方は、一つのキーを複数のキーにマップする方法です。ファンクション +キー (<F1>以外) には機能が割り当てられていないので、それらのキーを使うとよいで +しょう。例: > + + :map <F2> GoDate: <Esc>:read !date<CR>kJ + +このマップでは三つのモードが使われています。"G" で最後の行にジャンプし、"o" で +新しい行を開いて挿入モードを開始、"Date: " というテキストを入力してから <Esc> +で挿入モードを抜けます。 +特殊キーを <> で囲んで表記していますが、これは括弧表記というものです。特殊キー +を押すのではなく、見たまま文字どおり入力してください。この表記を使ったマップは +読むのが簡単で、そのままコピー&ペーストして使うことができます。 +さて、":" でコマンドラインモードに入ります。":read !date" コマンドは、"date" +コマンドの出力を読み込んで、現在行の下に追加します。<CR> は ":read" コマンドを +実行するために必要です。 +この時点で、テキストは次のようになっています: + + Date: ~ + Fri Jun 15 12:54:34 CEST 2001 ~ + +最後に、"kJ" で上に移動してから二つの行を一行につなげます。 +マップするキーを選ぶときは |map-which-keys| を参考にしてください。 + + +マップとモード +-------------- + +":map" コマンドはノーマルモードのキーマップを定義します。同様に、他のモードの +マップを定義することもできます。例えば ":imap" で挿入モードのマップを定義でき +ます。次のマップは、カーソルの下に日付を挿入します: > + + :imap <F2> <CR>Date: <Esc>:read !date<CR>kJ + +多少の違いはありますが、ノーマルモードで <F2> にマップしたものと同じです。この +マップを定義してもノーマルモードの <F2> は消えません。このように、同じキーを +モード別にマップすることができます。 +このマップは挿入モードの中で開始しますが、実行後はノーマルモードになってしまい +ます。挿入モードを継続したい場合はマップの最後に "a" を追加してください。 + +マップコマンドはモード別に用意されています: + + :map ノーマルモード、ビジュアルモード、オペレータ待機モード + :vmap ビジュアルモード + :nmap ノーマルモード + :omap オペレータ待機モード + :map! 挿入モード、コマンドライン + :imap 挿入モード + :cmap コマンドライン + +オペレータ待機モードとは、"d" や "y" などのオペレータを入力した後、モーション +コマンドやテキストオブジェクトの入力を待機している状態のことです。例えば "dw" +の "w" はオペレータ待機モードでの入力です。 + +例えば、d<F7> コマンドで C プログラムのブロック ({}で囲まれたテキスト) を削除 +できるように、あるいは、y<F7> でブロックをヤンクできるようにしたい場合は、<F7> +をマップしてプログラムブロックを選択できるようにする必要があります。次のように +します: > + + :omap <F7> a{ + +オペレータ待機モードで <F7> を押すと "a{" によってブロックが選択されます。この +マップは、{ が押しにくい位置にあるキーボードでは便利です。 + + +マップの一覧を表示する +---------------------- + +定義されたマップの一覧を確認したい場合は、":map" コマンドを引数なしで実行しま +す。モード別のマップコマンドを使うこともできます。次のような一覧が表示されま +す: + + _g :call MyGrep(1)<CR> ~ + v <F2> :s/^/> /<CR>:noh<CR>`` ~ + n <F2> :.,$s/^/> /<CR>:noh<CR>`` ~ + <xHome> <Home> + <xEnd> <End> + + +最初の列は、マップが機能するモードを示しています。"n" はノーマルモード、"i" は +挿入モード、などなど。":map" で定義されたマップには空白が使われます。空白の場 +合はノーマルモードとビジュアルモードで使えます。 +この一覧を見れば、<> 表記で書いた特殊キーが正しく認識されているかを確認できま +す (カラー表示がサポートされている場合に限る)。例えば、<Esc> が色付きで表示さ +れていれば、それはエスケープ文字です。他のテキストと同じ色で表示されている場合 +は、それは "<Esc>" という 5 文字の文字列です。 + + +再マップ +-------- + +マップは他のマップを含むことができます。例えば、上述の <F2> のマップは次のよう +に短くできます: > + + :map <F2> G<F3> + :imap <F2> <Esc><F3> + :map <F3> oDate: <Esc>:read !date<CR>kJ + +ノーマルモードの <F2> は、最後の行に移動して <F3> を押すようにマップされていま +す。挿入モードの <F2> は、<Esc> で挿入モードを停止して <F3> を押すようにマップ +されています。そして、<F3> には目的の機能がマップされています。 + +例えば、Ex モードはほとんど使わないので "Q" をテキスト整形コマンドとして使える +ようにしたい (昔の Vim はそういう動作でした) 場合は、次のようなマップを定義し +ます: > + + :map Q gq + +しかし、Ex モードが使いたくなることもあるかもしれません。"gQ" を Q にマップし +て、EX モードが使えるようにしましょう: > + + :map gQ Q + +この状態で "gQ" を入力すると "Q" にマップされます。ここまではいいですね。とこ +ろが、さらに "Q" が "gq" にマップされてしまいます。つまり、"gQ" は "gq" に変換 +されるので Ex モードを使うことはできないのです。 +再マップされないようにするには、":noremap" コマンドを使います: > + + :noremap gQ Q + +これで、マップされた "Q" に対して他のマップが適用されなくなります。同じような +コマンドがモード別に用意されています: + + :noremap ノーマルモード、ビジュアルモード、オペレータ待機モード + :vnoremap ビジュアルモード + :nnoremap ノーマルモード + :onoremap オペレータ待機モード + :noremap! 挿入モード、コマンドライン + :inoremap 挿入モード + :cnoremap コマンドライン + + +再帰マップ +---------- + +マップが自分自身を含んでいる場合、そのマップは永遠に動き続けます。これを利用す +れば、コマンドを無限に繰り返すことができます。 +例えば、いくつかのファイルがあって、すべてのファイルは一行目にバージョン番号が +書かれているとします。"vim *.txt" でそれらのファイルを開くと、一つ目のファイル +が開いた状態になります。次のマップを定義します: > + + :map ,, :s/5.1/5.2/<CR>:wnext<CR>,, + +そして、",," を入力してマップを実行します。このマップは一行目の "5.1" を "5.2" +に変更し、":wnext" で上書き保存してから次のファイルを開きます。マップの最後は +",," になっているので同じマップが再び適用され、置換と保存が実行されます。 +このマップは、何かエラーが発生するまで止まりません。このマップの場合、置換コマ +ンドの実行で "5.1" が見つからなかった場合にエラーが発生します。その場合は、 +"5.1" を挿入してから再びマップを実行します。最後のファイルに到達すると、 +":wnext" が失敗してマップが停止します。 +マップの途中でエラーが発生した場合は、そのマップの残りの部分は無視されます。 +マップは CTRL-C で中断できます (MS-WindowsではCTRL-Break)。 + + +マップを削除する +---------------- + +マップを削除するには ":unmap" コマンドを使います。このコマンドにも、モード別の +ものが用意されています: + + :unmap ノーマルモード、ビジュアルモード、オペレータ待機モード + :vunmap ビジュアルモード + :nunmap ノーマルモード + :ounmap オペレータ待機モード + :unmap! 挿入モード、コマンドライン + :iunmap 挿入モード + :cunmap コマンドライン + +例えば、ビジュアルモードを除き、ノーマルモードとオペレータ待機モードだけでマッ +プを定義したいような場合は次のトリックが使えます。最初に三つのモードでマップを +定義し、ビジュアルモードのマップだけを削除します: > + + :map <C-A> /---><CR> + :vunmap <C-A> + +"<C-A>" は CTRL-A キーとして解釈されます。 + +すべてのマップを削除するには |:mapclear| コマンドを使います。他のコマンドと同 +様に、これにもモード別のコマンドが用意されています。マップの削除はアンドゥでき +ないので注意してください。 + + +特殊文字 +-------- + +":map" コマンドの後ろには他のコマンドを続けて書くことができます。その場合は | +文字でコマンドを区切ります。そのため、マップの中では | 文字が使えません。この +文字を使いたい場合は <Bar> (5文字) を使ってください。例: > + + :map <F8> :write <Bar> !checkin %:S<CR> + +同じ問題は ":unmap" コマンドにもあります。":unmap" の場合はさらに末尾のスペー +スにも注意しなければなりません。以下の二つのコマンドは動作が違います: > + + :unmap a | unmap b + :unmap a| unmap b + +一つ目のコマンドは "a " (スペース付き) のマップを削除します。 + +マップの中でスペースを使いたい場合は <Space> (7文字) を使ってください: > + + :map <Space> W + +このマップはスペースキーを押すと、次の単語 (空白区切り) に移動します。 + +マップコマンドの末尾にはコメントを付けられません。なぜなら、" 文字はマップの一 +部として処理されてしまうからです。代わりに |" を使ってください。これは、新しい +空のコマンドを開始して、そのコマンドにコメントをつけます。例: > + + :map <Space> W| " 次の単語に移動するのにスペースバーを使う + + +マップと短縮入力 +---------------- + +挿入モードのマップは短縮入力とよく似ています。引数は同じ方法で処理されます。主 +な違いは実行されるタイミングです。短縮入力は単語の後で単語以外の文字を入力した +ときに実行されます。マップはマップ文字列の最後の文字を入力したときに実行されま +す。 +違いは他にもあります。短縮入力では入力した文字がすぐに挿入されます。短縮入力が +実行されると元の文字が削除されて指定された文字列に置換されます。マップされた文 +字を入力したときは最後の文字を入力してマップが実行されるまで何も挿入されませ +ん。'showcmd' オプションがオンに設定されている場合は、入力途中の文字がウィンド +ウ下部に表示されます。 +マップがあいまいな場合は少し違う動作になります。例えば、次の二つのマップがある +とき: > + + :imap aa foo + :imap aaa bar + +"aa" と入力した時点では、一つ目のマップを適用すべきか、それとも二つ目のマップ +を使うべきか、判断できません。その場合は、他の文字が入力されるまで待機状態にな +ります。"a" を入力すると二つ目のマップが適用されて "bar" が挿入されます。他の +文字、例えばスペース、を入力すると一つ目のマップが適用されて "foo" が挿入さ +れ、さらにスペースが挿入されます。 + + +さらに... +--------- + +<script> キーワードを使うと、スクリプトローカルなマップを定義できます。 +|:map-<script>| 参照。 + +<buffer> キーワードを使うと、バッファローカルなマップを定義できます。 +|:map-<buffer>| 参照。 + +<unique> キーワードを使うと、定義しようとしたマップがすでに定義されていた場合 +にコマンドが失敗します。このキーワードを使わない場合は、古いマップが上書き定義 +されます。|:map-<unique>| 参照。 + +何もしないキーを定義したい場合は <Nop> (5文字) を使います。次のコマンドは、 +<F7> キーが何もしないように設定しています: > + + :map <F7> <Nop>| map! <F7> <Nop> +< +<Nop> の後に空白を入れないでください。 + +============================================================================== +*40.2* コマンドラインコマンドを定義する + +Vim では新しいコマンドを定義することができます。定義したコマンドはコマンドライ +ンモードの他のコマンドと同じように使えます。 +コマンドを定義するには ":command" コマンドを使います: > + + :command DeleteFirst 1delete + +":DeleteFirst" コマンドを実行すると、":1delete" が実行され、最初の行が削除され +ます。 + + Note: + ユーザー定義コマンドの名前は必ず大文字で開始する必要があります。":X"、 + ":Next"、":Print" を使うことはできません。アンダースコア ("_") も使え + ません。数字は使えますがお勧めしません。 + +ユーザー定義コマンドの一覧を見るには、次のコマンドを実行します: > + + :command + +組み込みコマンドと同じように、ユーザー定義コマンドも省略できます。他のコマンド +と区別するのに十分な長さの文字を入力するだけでコマンドを実行できます。コマンド +ライン補完を使って完全な名前を得ることもできます。 + + +引数の数 +-------- + +ユーザー定義コマンドは引数を取ることができます。引数の数は -nargs オプションで +指定する必要があります。例えば、上述の :DeleteFirst コマンドは引数を取らないの +で、次のように定義できます: > + + :command -nargs=0 DeleteFirst 1delete + +指定が無ければ 0 が使われるので、わざわざ "-nargs=0" を指定する必要はありませ +ん。-nargs には次の値を指定できます: + + -nargs=0 引数なし + -nargs=1 引数 1 個 + -nargs=* いくつでも + -nargs=? 引数なし、もしくは 1 個 + -nargs=+ 引数 1 個以上 + + +引数の使い方 +------------ + +コマンド定義の中では、<args> キーワードを使って引数を表します。例: > + + :command -nargs=+ Say :echo "<args>" + +次のコマンドを実行すると: > + + :Say Hello World + +"Hello World" と表示されます。引数に引用符 (") が使われると、これはうまく動き +ません。例: > + + :Say he said "hello" + +特殊な文字が含まれているときにそれを適切にエスケープして文字列として使えるよう +にするには "<q-args>" を使います: > + + :command -nargs=+ Say :echo <q-args> + +上記の ":Say" コマンドを実行すると、次のコマンドが実行されます: > + + :echo "he said \"hello\"" +< +<f-args> キーワードを使うと、引数が関数呼び出しに適した形に展開されます。例: > + + :command -nargs=* DoIt :call AFunction(<f-args>) + :DoIt a b c + +次のコマンドが実行されます: > + + :call AFunction("a", "b", "c") + + +範囲指定 +-------- + +いくつかのコマンドは範囲指定を受け付けますが、そのようなコマンドを定義したい場 +合は -range オプションを使います。このオプションには次の値を指定できます: + + -range 範囲指定を許可。省略時は現在行が選択される。 + -range=% 範囲指定を許可。省略時はファイル全体が選択される。 + -range={count} 範囲指定を許可。範囲指定の最後の数値だけを使う。省略時 + は {count} が使われる。 + +範囲指定を使う場合は、<line1> キーワードと <line2> キーワードを使って範囲の最 +初と最後の行を取得できます。例えば、次のコマンドは、指定された範囲のテキストを +"save_file" に保存するコマンドを定義しています: > + + :command -range=% SaveIt :<line1>,<line2>write! save_file + + +他のオプション +-------------- + +使用できるオプションやキーワードは他にもあります: + + -count={number} カウント指定を受け付ける。省略時は {number}。 + カウント指定は <count> キーワードで取得できま + す。 + -bang ! の指定を受け付ける。! が使われた場合は + <bang> キーワードが ! に置き換わります。 + -register レジスタの指定を受け付ける。(省略時は無名レジ + スタ。) + 指定されたレジスタは <reg> (または <register>) + で取得できます。 + -complete={type} コマンドライン補完の種類を指定する。使用できる + 補完の種類は |:command-completion| を参照。 + -bar コマンドの後ろに | を使って他のコマンド (ある + いはコメント) を続けて書くことを許可する。 + -buffer カレントバッファでのみ使用できるコマンドを定義 + する。 + +最後に <lt> キーワードを説明します。これは文字 "<" を意味します。<> 表記をエス +ケープして、特殊な意味を消すために使います。 + + +再定義と削除 +------------ + +同じ名前のコマンドを再定義したい場合は ! を使います: > + + :command -nargs=+ Say :echo "<args>" + :command! -nargs=+ Say :echo <q-args> + +コマンドを削除したい場合は ":delcommand" を使います。削除したいコマンドの名前 +を引数に指定してください。例: > + + :delcommand SaveIt + +次のコマンドですべてのユーザー定義コマンドを削除できます: > + + :comclear + +コマンドの削除はアンドゥできないので注意してください。 + +ユーザー定義コマンドについての詳細はリファレンスマニュアルを参照してください。 +|user-commands|。 + +============================================================================== +*40.3* 自動コマンド + +自動コマンドとは、さまざまなイベントに応じて自動的に実行されるコマンドのことで +す。ファイルを読み書きしたり、バッファを切り替えたりしたときに実行されます。例 +えば、|gzip|プラグインは、圧縮ファイルを開くために自動コマンドを使っています。 +自動コマンドは非常に強力です。適切に使えばいろんな手間を省くことができます。し +かし、不適切な使い方をすればさまざまなトラブルの原因になります。 + +例えば、ファイルを保存するときに、保存した日付をファイル末尾に書き込んでみま +しょう。まず、次の関数を定義します: > + + :function DateInsert() + : $delete + : read !date + :endfunction + +バッファをファイルに保存する直前にこの関数を実行したいわけです。次のコマンドで +設定します: > + + :autocmd BufWritePre * call DateInsert() + +"BufWritePre" は自動コマンドが実行されるイベントです。このイベントはバッファを +ファイルに保存する直前に発行されます。"*" の部分はファイル名にマッチするパター +ンです。"*" はすべてのファイルにマッチします。 +この自動コマンドが設定された状態で ":write" を実行すると、ファイル名にマッチし +たすべての BufWritePre 自動コマンドが実行されてから、ファイルが保存されます。 +:autocmd の正式な書式は次のとおりです: > + + :autocmd [group] {events} {file_pattern} [nested] {command} + +[group] は省略可能です。コマンドを管理したり呼び出したりしたい場合に使います +(後述)。{events} はコマンドを実行するイベントのリストです (コンマ区切り)。 +{file_pattern} はファイル名です。ワイルドカードが使えます。例えば、"*.txt" な +ら ".txt" で終わるファイルに対してコマンドが実行されます。 [nested] は省略可能 +です。自動コマンドを再帰的に呼び出したい場合に指定します (下記参照)。そして、 +実行したいコマンドを {command} に指定します。 + + +イベント +-------- + +BufReadPost は最も便利なイベントの一つです。これは新しいファイルを開いたときに +発行されます。普通はオプションを設定したりするのに使われます。例えば、"*.gsm" +というファイルを GNU アセンブリ言語のファイルとして扱いたい場合は、次のように +設定します: > + + :autocmd BufReadPost *.gsm set filetype=asm + +ファイルの種類が検出されて、'filetype' オプションが設定されると、Filetype イベ +ントが発行されます。このイベントはファイルの種類に応じて何かを実行したい場合に +使います。例えば、テキストファイルを開いたときに短縮入力の定義を読み込むには次 +のようにします: > + + :autocmd Filetype text source ~/.vim/abbrevs.vim + +新しいファイルを作成したときにスケルトンを挿入することもできます: > + + :autocmd BufNewFile *.[ch] 0read ~/skeletons/skel.c + +イベントの一覧は |autocmd-events| を参照してください。 + + +パターン +-------- + +{file_pattern} 引数には複数のパターンをコンマ区切りで指定できます。例えば、 +"*.c,*.h" なら、末尾が ".c" と ".h" のファイルにマッチします。 +パターンには一般的なワイルドカードが使えます。次のようなものがよく使われます: + + * 何かの文字が何文字でも + ? 何かの文字が 1 つ + [abc] a か b か c + . ドット + a{b,c} ab か ac + +パターンにスラッシュ (/) が含まれている場合は、ディレクトリ名と比較されます。 +スラッシュが含まれていない場合は、ファイル名のみが使われます。例えば、 +"/home/biep/readme.txt" には "*.txt" がマッチします。"/home/biep/*" も同様に +マッチします。しかし、"home/foo/*.txt" はマッチしません。 +スラッシュが含まれているときは、ファイルの絶対パス ("/home/biep/readme.txt") +と相対パス (例えば "biep/readme.txt") の両方が比較されます。 + + Note: + MS-Windows のように、ディレクトリの区切りにバックスラッシュを使うよう + なシステムでもスラッシュを使ってパターンを指定することができます。 + バックスラッシュはエスケープする必要があるので、スラッシュを使ったほう + が簡単です。自動コマンドの移植性もあがります。 + + +自動コマンドを削除する +---------------------- + +自動コマンドの削除には、定義と同じコマンドを使います。ただし、削除するときは ! +を使い、{command} は指定しません。例: > + + :autocmd! FileWritePre * + +"FileWritePre" イベントの、"*" パターンを使っている自動コマンドがすべて削除さ +れます。 + + +一覧表示する +------------ + +定義されている自動コマンドの一覧を見るには次のようにします: > + + :autocmd + +とても長い出力が表示されます。ファイルタイプの認識が有効になっている場合は特に +長くなります。一部のコマンドだけを表示したい場合は、グループ、イベント、パター +ンのどれかを指定してください。例えば、次のコマンドで BufNewFile に設定された自 +動コマンドを表示できます: > + + :autocmd BufNewFile + +"*.c" に対する自動コマンドを表示したい場合は次のようにします: > + + :autocmd * *.c + +イベントに "*" を指定すると、すべてのイベントが表示されます。cprograms グルー +プの自動コマンドを表示したい場合は次のようにします: > + + :autocmd cprograms + + +グループ +-------- + +自動コマンドを定義するとき、{group} を指定することで、関連した自動コマンドをグ +ループ化できます。例えば、特定のグループの自動コマンドをまとめて削除したりでき +ます。 +自動コマンドをグループ化するには、":augroup" コマンドを使います。例えば、C 言 +語用の自動コマンドを定義してみましょう: > + + :augroup cprograms + : autocmd BufReadPost *.c,*.h :set sw=4 sts=4 + : autocmd BufReadPost *.cpp :set sw=3 sts=3 + :augroup END + +次のように書くこともできます: > + + :autocmd cprograms BufReadPost *.c,*.h :set sw=4 sts=4 + :autocmd cprograms BufReadPost *.cpp :set sw=3 sts=3 + +"cprograms" グループのすべての自動コマンドを削除するには、次のようにします: > + + :autocmd! cprograms + + +ネスト +------ + +通常は、自動コマンドの中で実行されたコマンドによってイベントが発行されることは +ありません。例えば、FileChangedShell イベントの中でファイルを読み込んでも、シ +ンタックスを設定するための自動コマンドは実行されません。イベントを発行させたい +場合は "nested" 引数を指定してください: > + + :autocmd FileChangedShell * nested edit + + +自動コマンドを実行する +---------------------- + +擬似的にイベントを発行して、自動コマンドを実行することができます。自動コマンド +の中から他の自動コマンドを実行するような場合に便利です。例: > + + :autocmd BufReadPost *.new execute "doautocmd BufReadPost " . expand("<afile>:r") + +新しいファイルが開かれたときに実行される自動コマンドを定義しています。ファイル +名の末尾が ".new" になっているものが対象です。":execute" コマンドは、引数を評 +価した結果をコマンドとして実行します。例えば、"tryout.c.new" を開くと、次のコ +マンドが実行されます: > + + :doautocmd BufReadPost tryout.c + +expand() 関数に指定された "<afile>" が自動コマンドで使われたファイル名に展開さ +れ、":r" によって、そのルート部分 {訳注: .newを除いた部分} が使われます。 + +":doautocmd" はカレントバッファの上で実行されます。":doautoall" コマンドは、 +":doautocmd" と同じ操作をすべてのバッファに対して実行します。 + + +ノーマルモードコマンドを使う +---------------------------- + +自動コマンドで使用できるのはコマンドラインコマンドです。ノーマルモードコマンド +を使いたい場合は ":normal" コマンドを使ってください。例: > + + :autocmd BufReadPost *.log normal G + +*.log ファイルを開くと、ファイル末尾にカーソルがジャンプします。 +":normal" コマンドは少し複雑です。指定するコマンドは完結していなければなりませ +ん。例えば、"i" で挿入モードに入ったら、<Esc> でモードを抜ける必要があります。 +"/" で検索する場合は、<CR> で検索を実行する必要があります。 +":normal" コマンドはすべてのテキストを引数として解釈するので、| を使って他のコ +マンドを続けて書くことはできません。それが必要な場合は ":execute" コマンドの中 +で ":normal" コマンドを実行してください。":execute" を使うと、特殊文字を指定す +るのが簡単になります。例: > + + :autocmd BufReadPost *.chg execute "normal ONew entry:\<Esc>" | + \ 1read !date + +長いコマンドを見やすくするために、バックスラッシュを使って複数行に分けていま +す。この方法はスクリプトファイルの中だけで使えます (コマンドラインで入力すると +きは使えません)。 + +自動コマンドの中で複雑なことを実行すると、必然的にカーソルの位置が変わってしま +います。それを元に戻す方法については |restore-position| を参照してください。 + + +イベントの無効化 +---------------- + +自動コマンドを実行して欲しくないときは、'eventignore' オプションに無視したいイ +ベントを設定してください。例えば、次のように設定すると、他のウィンドウに移動し +たときのイベントが無視されます: > + + :set eventignore=WinEnter,WinLeave + +すべてのイベントを無視するには、次のように設定します: > + + :set eventignore=all + +通常の状態に戻すには、'eventignore' を空に設定します: > + + :set eventignore= + +============================================================================== + +次章: |usr_41.txt| Vim script 書法 + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_41.jax b/plugins/vimdoc-ja/doc/usr_41.jax new file mode 100644 index 0000000000..8db18b4442 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_41.jax @@ -0,0 +1,2546 @@ +*usr_41.txt* For Vim バージョン 8.0. Last change: 2017 Mar 09 + + VIM USER MANUAL - by Bram Moolenaar + + Vim script 書法 + + +Vim script 言語は vimrc ファイルや構文ファイルなど、さまざまな目的に使われま +す。この章では Vim script の書き方を説明します。説明することがたくさんあるので +大きな章になってます。 + +|41.1| はじめに +|41.2| 変数 +|41.3| 式 +|41.4| 条件式 +|41.5| 式を実行する +|41.6| 関数を使う +|41.7| 関数を定義する +|41.8| リストと辞書 +|41.9| 例外 +|41.10| 注意事項 +|41.11| プラグインを書く +|41.12| ファイルタイププラグインを書く +|41.13| コンパイラプラグインを書く +|41.14| プラグインを書く (高速ロード版) +|41.15| ライブラリスクリプトを書く +|41.16| Vim script を配布する + +次章: |usr_42.txt| 新しいメニューを追加する +前章: |usr_40.txt| 新しいコマンドを作る +目次: |usr_toc.txt| + +============================================================================== +*41.1* はじめに *vim-script-intro* *script* + +誰もが最初に触れる Vim script は vimrc ファイルです。Vim が起動するときに読 +み込まれ、書かれているコマンドが実行されます。それにより好きなように設定を変更 +できます。vimrc の中ではすべてのコロンコマンドが使えます (":" で始まるコマンド +のこと。Ex コマンドやコマンドラインコマンドと呼ばれることもある)。 +シンタックスファイルも Vim script です。シンタックスファイルは、ファイルタ +イプ別にオプションを設定するファイルの一種です。複雑なマクロ定義を別ファイルに +分けて保存しておくこともできます。このように、いろいろな使用方法が考えられま +す。 + +簡単な例から始めましょう: > + + :let i = 1 + :while i < 5 + : echo "count is" i + : let i += 1 + :endwhile +< + Note: + 実際には ":" を書く必要はありません。":" が必要なのはコマンドラインで + 入力するときだけです。Vim script ファイルを書くときは省略できます。 + このヘルプでは、コロンコマンドであることを強調し、ノーマルモードと区別 + するためにコロンを表記しています。 + Note: + 例文をヤンクして :@" コマンドで実際に実行できます。 + +出力は次のようになります: + + count is 1 ~ + count is 2 ~ + count is 3 ~ + count is 4 ~ + +一行目では ":let" コマンドで変数に値を代入しています。書式は次のとおりです: > + + :let {変数名} = {式} + +例では、変数名が "i"、式が 1 です。 +":while" コマンドでループを開始します。書式は次のとおりです: > + + :while {条件式} + : {ステートメント} + :endwhile + +条件式が真である間、ステートメントが実行されます。例では、条件式は "i < 5" で +す。これは、i が 5 より小さい場合に真になります。 + Note: + 何かのミスで while ループが止まらなかった場合は、CTRL-C を押せば中断で + きます (MS-Windows では CTRL-Break)。 + +":echo" コマンドは引数を出力します。例では、"count is" という文字列と、変数 i +の値を出力しています。i が 1 なら、次のように表示されます: + + count is 1 ~ + +":let i += 1" は ":let i = i + 1" と同じ意味です。変数 i に 1 を加算し、新しい +値を同じ変数に代入します。 + +上述の例は、実際にはもっと簡潔に書くことができます: > + + :for i in range(1, 4) + : echo "count is" i + :endfor + +|:for| と |range()| の説明はもっと先です。すぐに知りたい人はリンク先にジャンプ +してください。 + + +三種類の数値 +------------ + +数値は10進数、16進数、8進数のいずれかで表記します。16進数は "0x" か "0X" で開 +始します。例えば "0x1f" は10進数の 31 です。8進数は "0" で開始します。例えば +"017" は10進数の 15 です。注意: 10進数で書くときは先頭に "0" を付けないでくだ +さい。8進数として扱われてしまいます。 +":echo" コマンドは常に10進数で出力します。例: > + + :echo 0x7f 036 +< 127 30 ~ + +数値にマイナス記号を付けると負数になります。8進数や16進数も負数にできます。マ +イナス記号は減算記号としても使われます。次の例を上の例と比べてみてください: > + + :echo 0x7f -036 +< 97 ~ + +式の途中にある空白は無視されますが、可読性を高めるために、適切に空白で区切るこ +とをお勧めします。例えば上記の数値が負数であると勘違いしてしまわないように、マ +イナス記号と数値の間に空白をいれましょう: > + + :echo 0x7f - 036 + +============================================================================== +*41.2* 変数 + +変数名にはアルファベット、数字、アンダースコアが使えます。変数名を数字で開始す +ることはできません。次のような変数名が使えます: + + counter + _aap3 + very_long_variable_name_with_underscores + FuncLength + LENGTH + +"foo+var" や "6var" のような名前は使えません。 +例に挙げた変数はグローバル変数です。定義されている変数の一覧を見るのは次のコマ +ンドを使います: > + + :let + +グローバル変数はどこでも使えます。そのため、あるスクリプトファイルで "count" +という変数を使ったとき、その変数は他のスクリプトでも使われている可能性がありま +す。これは混乱を招きますし、トラブルの元です。それを避けるには "s:" を付けてス +クリプトローカル変数を使います。例えば、次のように使います: > + + :let s:count = 1 + :while s:count < 5 + : source other.vim + : let s:count += 1 + :endwhile + +"s:count" はスクリプトローカル変数なので、他のスクリプトファイルによって変更さ +れる心配はありません。他のスクリプトファイルで "s:count" 変数が使われていたと +しても、それは別の変数です。スクリプトローカル変数についての詳細は +|script-variable| を参照してください。 + +変数の種類は他にもあります。|internal-variables| 参照。次の変数がよく使われま +す: + + b:name バッファローカル変数 + w:name ウィンドウローカル変数 + g:name グローバル変数 (関数内では g: 必須) + v:name Vim が定義する変数 + + +変数の削除 +---------- + +変数はメモリを消費します。":let" コマンドの出力にも表示されます。変数を削除す +るには ":unlet" コマンドを使います。例: > + + :unlet s:count + +スクリプトローカル変数の "s:count" が削除され、使用されていたメモリが開放され +ます。変数が存在しない場合でもエラーを起こしたくない場合は ! を付けてください: +> + :unlet! s:count + +スクリプトの実行が終了したとき、ローカル変数は自動的には削除されません。次に同 +じスクリプトを実行したときにその変数を使うことができます。例: > + + :if !exists("s:call_count") + : let s:call_count = 0 + :endif + :let s:call_count = s:call_count + 1 + :echo "called" s:call_count "times" + +"exists()" 関数は変数が定義されているかどうかをチェックします。引数に調べたい +変数の名前を指定します。変数自体を指定するのではありません。例えば: > + + :if !exists(s:call_count) + +これは、s:call_count の値を変数名として exists() 関数を呼び出しているので、意 +味が違ってしまいます。 +感嘆符 (! 記号) は値を反転します。値が真なら偽になり、偽なら真になります。この +記号は "not" と読むことができます。つまり、"if !exists()" は "if not exists()" +と読むことができます。 +Vim では、0 以外の値はすべて真です。0 は偽です。 + Note: + 数値が必要なところで文字列を使ったとき、文字列は自動的に数値に変換され + ます。文字列の先頭が数字ではなかった場合は 0 に変換されます。つまり: > + :if "true" +< "true" は 0 に変換されるので偽になります。 + + +文字列変数と定数 +---------------- + +ここまでは変数の値に数値だけを使っていましたが、文字列を使うこともできます。 +Vim は数値と文字列を基本型としてサポートしています。変数は動的に型付けされま +す。型は ":let" コマンドで変数に値を代入するたびに変化します。詳しくは|41.8| +を参照してください。 +変数に文字列を代入するには文字列定数を使う必要があります。文字列定数には二つの +種類があります。一つはダブルクォート文字列です: > + + :let name = "peter" + :echo name +< peter ~ + +文字列の中でダブルクォートを使いたい場合は、バックスラッシュを前置してくださ +い: > + + :let name = "\"peter\"" + :echo name +< "peter" ~ + +バックスラッシュを使いたくない場合はシングルクォート文字列を使ってください: > + + :let name = '"peter"' + :echo name +< "peter" ~ + +シングルクォート文字列の中ではすべての文字がそのまま使われます。ただし、シング +ルクォートだけは特別で、一つのシングルクォートを表すためには二つのシングル +クォートを書く必要があります。バックスラッシュはそのまま使われるので、特殊文字 +は使えません。 +ダブルクォート文字列の中では特殊文字が使えます。次のようなものがあります: + + \t <Tab> + \n <NL>, 改行 + \r <CR>, <Enter> + \e <Esc> + \b <BS>, バックスペース + \" " + \\ \, バックスラッシュ + \<Esc> <Esc> + \<C-W> CTRL-W + +最後の二つはただの一例です。"\<name>" 形式で "name" という特殊キーを使うことが +できます。 +文字列で使える特殊表記については |expr-quote| を参照してください。 + +============================================================================== +*41.3* 式 + +Vim の式は高機能でシンプルです。式の定義については |expression-syntax| を参照 +してください。ここでは基本的なことだけを説明します。 +数値と文字列と変数はそれ自体が式です。つまり、式が必要なところでは数値でも文字 +列でも変数でも使えます。他にも次のようなものが使えます: + + $NAME 環境変数 + &name オプション + @r レジスタ + +例: > + + :echo "The value of 'tabstop' is" &ts + :echo "Your home directory is" $HOME + :if @a > 5 + +&name 形式を使うと、オプションを保存し、別の値に設定し、何かを実行して、オプ +ションを元に戻す、というようなことができます。例: > + + :let save_ic = &ic + :set noic + :/The Start/,$delete + :let &ic = save_ic + +'ignorecase' オプションをオフにしてから "The Start" パターンを検索しています。 +しかし設定は変更されません。(パターンに "\C" を加える方法でも同じことができま +す。|/\C| 参照。) + + +数値計算 +-------- + +基本的な要素を組み合わせると面白くなってきます。まずは数値計算です: + + a + b 加算 + a - b 減算 + a * b 乗算 + a / b 除算 + a % b 剰余演算(余りを得る) + +演算子の優先順位は一般的な規則と同じです: > + + :echo 10 + 5 * 2 +< 20 ~ + +カッコを使って優先順位を変更できます: > + + :echo (10 + 5) * 2 +< 30 ~ + +文字列は "." で連結できます: > + + :echo "foo" . "bar" +< foobar ~ + +":echo" コマンドに複数の引数を指定すると、スペースで区切られて表示されます。こ +れらの例では一つの式しか使われていないので、スペースは挿入されていません。 + +C 言語と同じ条件演算子も使えます: + + a ? b : c + +"a" が真なら "b" が使われ、そうでなければ "c" が使われます。例: > + + :let i = 4 + :echo i > 5 ? "i is big" : "i is small" +< i is small ~ + +被演算子の部分は優先的に評価されるので、次のように見なすことができます: + + (a) ? (b) : (c) + +============================================================================== +*41.4* 条件式 + +":if" コマンドは条件が真の場合に ":endif" までのステートメントを実行します。書 +式は次のとおり: + + :if {condition} + {statements} + :endif + +{condition} を評価した結果が真 (0以外) であれば、{statements} の内容が実行され +ます。{statements} は正しく記述されている必要があります。不正な記述があると +":endif" までたどり着けません。 +":else" を使うこともできます。書式は次のとおり: + + :if {condition} + {statements} + :else + {statements} + :endif + +二つ目の {statements} は条件が偽の場合にだけ実行されます。 +":elseif" を使うこともできます: + + :if {condition} + {statements} + :elseif {condition} + {statements} + :endif + +これは ":else" に続けて "if" 文を使うのと同じ動作ですが、余計な ":endif" を使 +わなくて済みます。 +vimrc ファイルで便利に使える例を示しましょう。'term' オプションの値を調べ、そ +の値に応じて処理を分けます: > + + :if &term == "xterm" + : " xterm 用の設定 + :elseif &term == "vt100" + : " vt100 端末用の設定 + :else + : " その他の端末用の設定 + :endif + + +論理演算子 +---------- + +今までの説明で既に論理演算子を使いました。次の演算子がよく使われます: + + a == b 等しい + a != b 等しくない + a > b より大きい + a >= b より大きいか等しい + a < b より小さい + a <= b より小さいか等しい + +条件が成立するなら 1、そうでなければ 0 が返ります。例: > + + :if v:version >= 700 + : echo "おめでとう" + :else + : echo "古いバージョンを使っています。更新してね!" + :endif + +"v:version" は Vim によって定義されている変数で、Vim のバージョンが入っていま +す。バージョン 6.0 なら 600、バージョン 6.1 なら 601 です。これは複数のバー +ジョンに対応するスクリプトを書くときに便利です。|v:version| + +論理演算子は数値でも文字列でも扱えます。文字列どうしを比較するときは数学的な差 +が比較されます。文字のバイト値を比較するので、一部の言語では正しい結果にならな +いかもしれません。 +文字列と数値を比較するときは、文字列を数値に変換します。文字列が数字ではなかっ +たときは 0 になるので注意してください。例: > + + :if 0 == "one" + : echo "yes" + :endif + +これは "yes" と表示されます。"one" は数字ではないので 0 に変換されるのです。 + +文字列にはさらに二つの論理演算子があります: + + a =~ b パターンにマッチする + a !~ b パターンにマッチしない + +左辺の "a" は文字列として扱われます。右辺の "b" は検索パターンとして扱われま +す。例: > + + :if str =~ " " + : echo "str にはスペースが含まれている" + :endif + :if str !~ '\.$' + : echo "str の末尾はピリオドではない" + :endif + +パターンを指定するのにシングルクォート文字列を使うのがコツです。ダブルクォート +文字列ではバックスラッシュを二重に書く必要があり、そして、検索パターンではバッ +クスラッシュをよく使うので、バックスラッシュだらけになってしまいます。 + +文字列を比較するときは 'ignorecase' オプションが使われます。大文字小文字の区別 +を明示的に指定したい場合は比較演算子に "#" (区別する) または "?" (区別しない) +をつけます。大文字小文字を区別せずに等しいかどうかを比較したい場合は "==?" を +使います。"!~#" ならパターンにマッチしないことを、大文字と小文字を区別して確認 +できます。演算子の一覧は |expr-==| を参照してください。 + + +他のループコマンド +------------------ + +":while" コマンドは既に説明しました。":while" ループの中では二つのステートメン +トが使えます: + + :continue ループの先頭にジャンプしてループを継続する。 + :break ":endwhile" までジャンプしてループを脱ける。 + +例: > + + :while counter < 40 + : call do_something() + : if skip_flag + : continue + : endif + : if finished_flag + : break + : endif + : sleep 50m + :endwhile + +":sleep" コマンドは Vim を一定時間停止します。"50m" は 50 ミリ秒です。 +":sleep 4" なら 4 秒間スリープします。 + +":for" コマンドを使ってループすることもできます。|41.8|を参照。 + +============================================================================== +*41.5* 式を実行する + +今まではコマンドを直接書いてきました。":execute" コマンドを使うと、式の評価結 +果をコマンドとして実行できます。これによってコマンドを動的に生成することができ +ます。 +例えば、変数に格納された文字列を使ってタグジャンプするには次のようにします: > + + :execute "tag " . tag_name + +文字列 "tag " と変数 "tag_name" の値を "." で連結しています。仮に "tag_name" +の値が "get_cmd" だった場合、次のコマンドが実行されることになります: > + + :tag get_cmd + +":execute" コマンドはコロンコマンドのみ実行できます。":normal" コマンドでノー +マルモードコマンドを実行できますが、このコマンドの引数は文字がそのまま使われ、 +式としては評価されません。例: > + + :normal gg=G + +このコマンドは一行目にジャンプしてから "=" オペレータですべての行を整形しま +す。 +":normal" コマンドで式の値を使いたい場合は ":execute" と組み合わせてください。 +例: > + + :execute "normal " . normal_commands + +変数 "normal_commands" にはノーマルモードコマンドを入れておく必要があります。 +":normal" には完結したコマンドを指定するようにしてください。引数が最後まで実行 +された段階でコマンドは中断されます。例えば、挿入モードを開始した場合は挿入モー +ドを終了しなくてはなりません。次のコマンドは正しく動作します: > + + :execute "normal Inew text \<Esc>" + +これは現在行に "new text" を挿入します。特殊キー "\<ESC>" を使っていることに注 +目してください。これによりスクリプトの中で本物の <Esc> 文字を使わないですみま +す。 + +文字列を実行するのではなく、その式の値を得たい場合は、eval() 関数を使います: > + + :let optname = "path" + :let optval = eval('&' . optname) + +文字 "&" と "path" を連結しているので eval() の引数は "&path" になります。戻り +値は 'path' オプションの値です。 +次のようにすることもできます: > + :exe 'let optval = &' . optname + +============================================================================== +*41.6* 関数を使う + +たくさんの関数があらかじめ定義され、豊富な機能が提供されています。このセクショ +ンの説明にもいくつか登場します。関数の一覧は |functions| を参照してください。 + +関数は ":call" コマンドで呼び出します。引数はカッコで囲み、それぞれをコンマで +区切ります。例: > + + :call search("Date: ", "W") + +これは "Date: " と "W" を引数にして search() 関数を呼び出しています。search() +関数は一つ目の引数を検索パターンとして使い、二つ目の引数をフラグとして使いま +す。"W" フラグを指定するとファイル末尾で検索が終了します (折り返さない)。 + +関数は式の中で使うこともできます。例: > + + :let line = getline(".") + :let repl = substitute(line, '\a', "*", "g") + :call setline(".", repl) + +getline() 関数はカレントバッファから行を取得する関数です。引数には行番号を指定 +します。この例では "." ですが、これはカーソルのある行を示します。 +substitute() 関数は ":substitute" コマンドとほぼ同じです。最初の引数は置換対象 +の文字列、二つ目の引数はパターン、三つ目は置き換え文字列、最後はフラグです。 +setline() 関数は行の内容を置き換えます。最初の引数は行番号、二つ目の引数は置き +換える文字列です。この例では、substitute() の結果で現在行を置き換えています。 +上記の三行のコマンドは次のコマンドと同じことをしています: > + + :substitute/\a/*/g + +substitute() コマンドの前後にいろいろな処理を入れたりすると、もっと面白いこと +ができるようになります。 + + +関数一覧 *function-list* +-------- + +たくさんの関数があります。ここでは機能別に分類して紹介します。アルファベット順 +の一覧は |functions| を参照してください。関数の名前の上で CTRL-] を押すと、詳 +細な説明にジャンプできます。 + +文字列繰作: *string-functions* + nr2char() ASCII値から文字を得る + char2nr() 文字のASCII値を得る + str2nr() 文字列を数値に変換する + str2float() 文字列を浮動小数点数に変換する + printf() 書式付き文字列を整形する + escape() 文字列の特定の文字を '\' でエスケープ + shellescape() シェルコマンドで使えるように文字列をエスケープ + fnameescape() Vim コマンド用にファイル名をエスケープ + tr() ある文字の集合から別の文字の集合へ置換する + strtrans() 文字列を印字可能な状態とする + tolower() 文字列を小文字にする + toupper() 文字列を大文字にする + match() 文字列の中でパターンにマッチした位置 + matchend() 文字列の中でパターンにマッチした末尾の位置 + matchstr() 文字列の中でパターンにマッチした文字列 + matchstrpos() 文字列の中でパターンにマッチした文字列と位置 + matchlist() matchstr()と同様だが、部分マッチも返す + stridx() 文字列の中で部分文字列が見つかった最初の位置 + strridx() 文字列の中で部分文字列が見つかった最後の位置 + strlen() 文字列のバイト単位での長さ + strchars() 文字列の文字単位での長さ + strwidth() 表示された文字列のサイズ + strdisplaywidth() 表示された文字列のサイズ、タブを扱う + substitute() パターンにマッチする文字列を置換 + submatch() ":s" と substitute() の中で部分マッチを得る + strpart() 文字列の一部分を得る(バイト数指定) + strcharpart() 文字のインデックスで指定された部分文字列を得る + strgetchar() 文字のインデックスで指定された文字コードを得る + expand() 特殊キーワードを展開する + iconv() テキストのエンコーディングを変換する + byteidx() 文字列中の文字のバイトインデックス + byteidxcomp() byteidx() と同様だが合成文字を数に入れる + repeat() 文字列を複数回繰り返す + eval() 文字列を式として評価する + execute() Ex コマンドを実行し出力を得る + +リスト操作: *list-functions* + get() 要素を取得。存在しないインデックスでもエラーを + 出さない + len() リスト中の要素の個数 + empty() リストが空であるか判定する + insert() リストの任意の位置に要素を挿入する + add() リストに要素を追加する + extend() リストにリストを連結する + remove() リストから1個以上の要素を取り除く + copy() リストの浅いコピーを作成する + deepcopy() リストの完全なコピーを作成する + filter() リストから選択された要素を取り除く + map() リストの各要素を変換する + sort() リストをソートする + reverse() リストの並び順を反転させる + uniq() 隣接して繰り返される要素のコピーを削除する + split() 文字列を分割し、リストにする + join() リストの要素を連結し、文字列にする + range() 数列リストを返す + string() リストの文字列表現 + call() リストを引数として関数を呼ぶ + index() リスト中の要素のインデックス + max() リスト中の最大値 + min() リスト中の最小値 + count() ある要素がリスト中に出現する回数を返す + repeat() リストを複数回繰り返す + +辞書操作: *dict-functions* + get() 辞書の要素を返す。存在しないキーでもエラーを出 + さない + len() 辞書の要素の個数 + has_key() あるキーが辞書に含まれているか判定する + empty() 辞書が空であるか判定する + remove() 辞書から要素を取り除く + extend() ある辞書の要素をすべて別の辞書に追加する + filter() 辞書から選択された要素を取り除く + map() 辞書の各要素を変換する + keys() 辞書の全キーのリストを取得する + values() 辞書の全値のリストを取得する + items() 辞書の全キー・値のペアを取得する + copy() 辞書の浅いコピーを作成する + deepcopy() 辞書の完全なコピーを作成する + string() 辞書の文字列表現 + max() 辞書中の最大値 + min() 辞書中の最小値 + count() ある値が出現する回数を返す + +浮動小数点数の計算: *float-functions* + float2nr() Float を Number に変換 + abs() 絶対値 (Numberも処理可能) + round() 丸め + ceil() 切り上げ + floor() 切り下げ + trunc() 小数点以下切り捨て + fmod() 除法の余り + exp() 指数 + log() 自然対数 (eを底とする対数) + log10() 10 を底とする対数 + pow() x の y 乗 + sqrt() 平方根 + sin() 正弦 (サイン) + cos() 余弦 (コサイン) + tan() 正接 (タンジェント) + asin() 逆正弦 (アークサイン) + acos() 逆余弦 (アークコサイン) + atan() 逆正接 (アークタンジェント) + atan2() 逆正接 (アークタンジェント) + sinh() 双曲線正弦 (ハイパボリックサイン) + cosh() 双曲線余弦 (ハイパボリックコサイン) + tanh() 双曲線正接 (ハイパボリックタンジェント) + isnan() 数値でないかどうかのチェック + +その他の計算: *bitwise-function* + and() ビットごとの論理積 + invert() ビットごとの否定 + or() ビットごとの論理和 + xor() ビットごとの排他的論理和 + sha256() SHA-256 ハッシュ + +変数: *var-functions* + type() 変数の型 + islocked() 変数がロックされているか判定する + funcref() 関数参照へのFuncrefを取得する + function() 関数名からFuncrefを取得する + getbufvar() 指定バッファの変数値を得る + setbufvar() 指定バッファに変数を設定する + getwinvar() 指定ウィンドウの変数値を得る + gettabvar() 指定タブページから変数値を得る + gettabwinvar() 指定ウィンドウ・タブページから変数値を取得する + setwinvar() 指定ウィンドウに変数を設定する + settabvar() 指定タブページに変数を設定する + settabwinvar() 指定ウィンドウ・タブページに変数を設定する + garbagecollect() 解放可能なメモリを解放する + +カーソルとマークの位置: *cursor-functions* *mark-functions* + col() カーソルやマークの列番号を取得する + virtcol() カーソルやマークの画面上の列番号を得る + line() カーソルやマークの行番号を取得する + wincol() カーソルのウィンドウでの列番号 + winline() カーソルのウィンドウでの行番号 + cursor() カーソルを指定した位置に移動させる + screencol() カーソルのスクリーン列を取得する + screenrow() カーソルのスクリーン行を取得する + getcurpos() カーソルの位置を取得する + getpos() カーソルやマークなどの位置を取得する + setpos() カーソルやマークなどの位置を設定する + byte2line() 指定のバイト位置の行番号を取得する + line2byte() 指定の行のバイト位置を取得する + diff_filler() ある行より上の詰め行の数を取得する + screenattr() スクリーン列/行の属性を取得する + screenchar() スクリーン列/行の文字コードを取得する + +カレントバッファで動作するもの: *text-functions* + getline() バッファから行を得る + setline() バッファの行を置き換える + append() 行または行のリストをバッファに追加する + indent() 行のインデントを得る + cindent() C 言語におけるインデントを得る + lispindent() Lisp 言語におけるインデントを得る + nextnonblank() 次の非空行を探す + prevnonblank() 前の非空行を探す + search() パターンにマッチする場所を探す + searchpos() パターンにマッチする場所を探す + searchpair() start/skip/end の対を探す + searchpairpos() start/skip/end の対を探す + searchdecl() 名前が宣言されている場所を探す + getcharsearch() 文字検索情報を返す + setcharsearch() 文字検索情報を設定する + + *system-functions* *file-functions* +システム関数とファイル繰作: + glob() ワイルドカードを展開する + globpath() 複数のディレクトリを対象にワイルドカードを展開 + glob2regpat() glob パターンを正規表現に変換する + findfile() 複数のディレクトリからファイルを探す + finddir() 複数のディレクトリからディレクトリを探す + resolve() ショートカットのリンク先を得る + fnamemodify() ファイル名を修飾する + pathshorten() パス中のディレクトリ名を短くする + simplify() パスの意味を変えずに簡略化する + executable() 実行形式ファイルかどうかをチェックする + exepath() 実行ファイルのフルパスを得る + filereadable() ファイルが読み込み可能かどうかをチェックする + filewritable() ファイルが書き込み可能かどうかをチェックする + getfperm() ファイルのパーミッションを得る + setfperm() ファイルのパーミッションを設定する + getftype() ファイルの種類を得る + isdirectory() ディレクトリの存在をチェックする + getfsize() ファイルのサイズを得る + getcwd() カレントディレクトリを得る + haslocaldir() カレントウィンドウが |:lcd| を使用したかどうか + をチェックする + tempname() 一時ファイルの名前を得る + mkdir() ディレクトリを作成する + delete() ファイルを削除する + rename() ファイルの名前を変更する + system() シェルコマンドを実行し、その結果を文字列で得る + systemlist() シェルコマンドを実行し、その結果をリストで得る + hostname() システムの名称を得る + readfile() ファイルを読み込み、行のリストを得る + writefile() 行のリストをファイルに書き込む + +日付と時刻: *date-functions* *time-functions* + getftime() ファイルの最終更新日時を得る + localtime() 現在時刻を秒単位で得る + strftime() 時刻を文字列に変換する + reltime() 現在時刻または経過時間を正確に取得する + reltimestr() reltime()の結果を文字列に変換する + reltimefloat() reltime()の結果を浮動小数点に変換する + + *buffer-functions* *window-functions* *arg-functions* +バッファ、ウィンドウ、引数リスト: + argc() 引数リストの大きさ + argidx() 引数リスト中の現在の位置 + arglistid() 引数リストのIDを得る + argv() 引数リストの中身を得る + bufexists() バッファの存在をチェックする + buflisted() バッファが存在し、リストされているかどうか + bufloaded() バッファが存在し、ロードされているかどうか + bufname() バッファの名前を得る + bufnr() バッファの番号を得る + tabpagebuflist() タブページ中のバッファのリストを返す + tabpagenr() タブページの番号を取得する + tabpagewinnr() タブページを対象にwinnr()と同様 + winnr() カレントウィンドウの番号を得る + bufwinid() バッファのウィンドウIDを得る + bufwinnr() バッファのウィンドウ番号を得る + winbufnr() ウィンドウのバッファ番号を得る + getbufline() バッファの行のリストを得る + win_findbuf() バッファが含まれるウィンドウを探す + win_getid() ウィンドウのウィンドウIDを得る + win_gotoid() IDで指定されたウィンドウへ移動する + win_id2tabwin() IDで指定されたタブとウィンドウの番号を得る + win_id2win() IDで指定されたウィンドウの番号を得る + getbufinfo() バッファの情報一覧を得る + gettabinfo() タブページの情報一覧を得る + getwininfo() ウィンドウの情報一覧を得る + +コマンドライン: *command-line-functions* + getcmdline() 現在のコマンドラインを取得 + getcmdpos() コマンドラインにおけるカーソル位置を取得 + setcmdpos() コマンドラインにおけるカーソル位置を設定 + getcmdtype() 現在のコマンドラインの種類を返す + getcmdwintype() 現在のコマンドラインウィンドウの種類を返す + getcompletion() マッチするコマンド補完リストを返す + +Quickfixとロケーションリスト: *quickfix-functions* + getqflist() quickfixエラーのリスト + setqflist() quickfixを変更する + getloclist() ロケーションリストの項目のリスト + setloclist() ロケーションリストを変更する + +挿入モード補完: *completion-functions* + complete() 補完候補を設定する + complete_add() 補完候補を追加する + complete_check() 補完処理を終えるべきかどうかをチェックする + pumvisible() ポップアップメニューが表示されているかチェック + +折り畳み: *folding-functions* + foldclosed() 行が折り畳まれているかどうかをチェックする + foldclosedend() foldclosed()と同様。折り畳み末尾の行番号を返す + foldlevel() 行の折り畳みレベルを得る + foldtext() 閉じた折り畳みを代替表示するテキストを生成 + foldtextresult() 閉じた折り畳みを代替表示するテキストを得る + +シンタックスハイライト: *syntax-functions* *highlighting-functions* + clearmatches() |matchadd()|と|:match|コマンドで定義されたマッ + チをクリアする + getmatches() |matchadd()|と|:match|コマンドで定義されたすべ + てのマッチを得る + hlexists() ハイライトグループの存在をチェック + hlID() ハイライトグループのIDを得る + synID() 指定位置のシンタックスIDを得る + synIDattr() シンタックスIDから指定の属性を得る + synIDtrans() 変換したシンタックスIDを得る + synstack() 指定位置のシンタックスIDのリストを得る + synconcealed() conceal の情報を得る + diff_hlID() 差分モードの指定位置のシンタックスIDを得る + matchadd() 強調表示するパターンを定義する + matchaddpos() 強調表示する位置のリストを定義する + matcharg() |:match|の引数の情報を得る + matchdelete() |matchadd()|と|:match|コマンドで定義されたマッ + チを削除する + setmatches() |getmatches()|で得たマッチを使って復元する + +スペリング: *spell-functions* + spellbadword() カーソル位置以降のスペルミスを探す + spellsuggest() スペル訂正の候補を返す + soundfold() 単語の同音等値(sound-a-like equivalent)を返す + +履歴: *history-functions* + histadd() 履歴に項目を追加 + histdel() 履歴から項目を削除 + histget() 履歴の項目を得る + histnr() 履歴リストの最大インデックスを得る + +対話インターフェイス: *interactive-functions* + browse() ファイル選択ダイアログを開く + browsedir() ディレクトリ選択ダイアログを開く + confirm() ユーザーに選択をさせる + getchar() ユーザーが入力した文字を得る + getcharmod() 最後に入力した文字の修飾子(modifier)を得る + feedkeys() 先行入力キューに文字を入れる + input() ユーザーが入力した行を得る + inputlist() ユーザーにリストから項目を選択させる + inputsecret() ユーザーが入力した行を得る。ただし表示はしない + inputdialog() ダイアログを使ってユーザーが入力した行を得る + inputsave() 先行入力キューを保存して空にする + inputrestore() inputsave()で保存した状態に戻す + +GUI: *gui-functions* + getfontname() 現在使われているフォントの名前を取得 + getwinposx() GUIのVimウィンドウのX座標 + getwinposy() GUIのVimウィンドウのY座標 + balloon_show() バルーンの内容を設定する + +Vimサーバー: *server-functions* + serverlist() サーバー名のリストを返す + remote_send() Vimサーバーにコマンド文字を送る + remote_expr() Vimサーバーで式を評価する + server2client() Vimサーバーのクライアントに応答を返す + remote_peek() Vimサーバーから返信があったかどうかをチェック + remote_read() Vimサーバーからの返信を読む + foreground() Vimのウィンドウを前面に持ってくる + remote_foreground() Vimサーバーのウィンドウを前面に持ってくる + +ウィンドウサイズと位置: *window-size-functions* + winheight() ウィンドウの高さを取得 + winwidth() ウィンドウの幅を取得 + winrestcmd() ウィンドウサイズを復元するコマンドを返す + winsaveview() カレントウィンドウのビューを取得 + winrestview() カレントウィンドウのビューを復元 + +マッピング: *mapping-functions* + hasmapto() マップの存在をチェック + mapcheck() マッチするマップの存在をチェック + maparg() マップのrhs(展開結果)を得る + wildmenumode() wildmodeが有効かどうかをチェック + +テスト用: *test-functions* + assert_equal() 2つの式が等しい事をテストする + assert_notequal() 2つの式が等しくない事をテストする + assert_inrange() 式が範囲内にある事をテストする + assert_match() 値がパターンにマッチする事をテストする + assert_notmatch() 値がパターンにマッチしない事をテストする + assert_false() 式がfalseかどうかテストする + assert_true() 式がtrueかどうかテストする + assert_exception() コマンドが例外を投げる事をテストする + assert_fails() 関数呼び出しが失敗する事をテストする + test_alloc_fail() メモリの確保を失敗させる + test_autochdir() 起動中に 'autochdir' を有効にする + test_override() Vimの内部処理を置き換えてテストする + test_garbagecollect_now() 直ちにメモリを解放する + test_ignore_error() 特定のエラーメッセージを無視する + test_null_channel() null のチャンネルを返す + test_null_dict() null の辞書を返す + test_null_job() null の Job を返す + test_null_list() null のリストを返す + test_null_partial() null の部分適用を返す + test_null_string() null の文字列を返す + test_settime() Vimが内部的に用いる時間を設定する + +プロセス間通信: *channel-functions* + ch_canread() 何か読むものがあるかチェックする + ch_open() チャンネルを開く + ch_close() チャンネルを閉じる + ch_close_in() チャンネルの入力パートを閉じる + ch_read() チャンネルからメッセージを読み取る + ch_readraw() チャンネルからrawメッセージを読み取る + ch_sendexpr() チャンネルにJSONメッセージを送る + ch_sendraw() チャンネルにrawメッセージを送る + ch_evalexpr() チャンネル経由で式を評価する + ch_evalraw() チャンネル経由で raw 文字列を評価する + ch_status() チャンネルの状態を取得する + ch_getbufnr() チャンネルのバッファ番号を取得する + ch_getjob() チャンネルが割り当てられている Job を取得する + ch_info() チャンネルの情報を取得する + ch_log() チャンネルのログファイルにメッセージを出力する + ch_logfile() チャンネルのログファイルを設定する + ch_setoptions() チャンネルのオプションを設定する + json_encode() 式をJSONの文字列にエンコードする + json_decode() JSONの文字列をVimの型にデコードする + js_encode() 式をJSONの文字列にエンコードする + js_decode() JSONの文字列をVimの型にデコードする + +Jobs: *job-functions* + job_start() Job を開始する + job_stop() Job を停止する + job_status() Job のステータスを取得する + job_getchannel() Job が使用する channel を取得する + job_info() Job の情報を取得する + job_setoptions() Job のオプションを設定する + +Timers: *timer-functions* + timer_start() タイマーを作る + timer_pause() タイマーを一時停止もしくは再開する + timer_stop() タイマーを止める + timer_stopall() 全てのタイマーを止める + timer_info() タイマーの情報を得る + +その他: *various-functions* + mode() 現在の編集モードを得る + visualmode() 最後に使われたビジュアルモードの種類 + exists() 変数、関数の存在をチェック + has() 機能がサポートされているかをチェック + changenr() 最近の変更番号を返す + cscope_connection() cscope接続をチェック + did_filetype() FileTypeオートコマンドが使用されたかどうか + eventhandler() イベントハンドラによって起動されたかどうか + getpid() Vim のプロセスIDを得る + + libcall() 外部ライブラリの関数を呼ぶ + libcallnr() 同上、数値を返す + + undofile() アンドゥファイルの名前を得る + undotree() アンドゥツリーの状態を返す + + getreg() レジスタの値を得る + getregtype() レジスタのタイプを得る + setreg() レジスタの値を設定する + + shiftwidth() 'shiftwidth' の実際の値 + + wordcount() バッファ内のバイト数/単語数/文字数などを得る + + taglist() マッチするタグのリストを取得 + tagfiles() タグファイルのリストを取得 + + luaeval() |Lua|の式を評価する + mzeval() |MzScheme| の式を評価する + perleval() |Perl|の式を評価する (|+perl|) + py3eval() |Python|の式を評価する (|+python3|) + pyeval() |Python|の式を評価する (|+python|) + pyxeval() |python_x| の式を評価する + +============================================================================== +*41.7* 関数を定義する + +自分で関数を定義することができます。基本的な関数定義は次のとおり: > + + :function {name}({var1}, {var2}, ...) + : {body} + :endfunction +< + Note: + 関数名は大文字で開始する必要があります。 + +小さな関数を定義してみましょう。二つの数値のうち小さい方を返す関数を作ります。 +関数は次のような行で始まります: > + + :function Min(num1, num2) + +関数の名前が "Min" であり、二つの引数 ("num1" と "num2") を取る、ということを +表しています。 +最初にしなければならないのは、どちらの数値が小さいかをチェックすることです: > + + : if a:num1 < a:num2 + +"a:" は特殊なプリフィックスで、この変数が関数の引数であることを示します。小さい +方の値を変数 "smaller" に代入しましょう: > + + : if a:num1 < a:num2 + : let smaller = a:num1 + : else + : let smaller = a:num2 + : endif + +変数 "smaller" はローカル変数です。関数の中で使われた変数はローカル変数になり +ます。ただし、"g:"、"a:"、"s:" などのプリフィックスを付けた場合は別です。 + + Note: + 関数の内からグローバル変数にアクセスするには "g:" を付ける必要がありま + す。つまり、関数内では "g:today" はグローバル変数 "today" を示し、 + "today" ならそれとは別の変数、すなわちローカル変数になります。 + +":return" ステートメントを使って、小さい方の値を呼び出し元に返しましょう。そし +て、関数を閉じます: > + + : return smaller + :endfunction + +関数定義の全体は次のようになります: > + + :function Min(num1, num2) + : if a:num1 < a:num2 + : let smaller = a:num1 + : else + : let smaller = a:num2 + : endif + : return smaller + :endfunction + +関数を短く書きたい場合は、次のようにもできます: > + + :function Min(num1, num2) + : if a:num1 < a:num2 + : return a:num1 + : endif + : return a:num2 + :endfunction + +ユーザー定義関数は組み込み関数とまったく同じ方法で呼び出すことができます。違う +のは名前だけです。Min 関数は次のように使用できます: > + + :echo Min(5, 8) + +関数が実行され、関数の中身が Vim によって解釈されます。未定義の変数や関数を使 +うなどの間違いがあったときは、エラーメッセージが表示されます。関数定義の時点で +はそれらのエラーは検出されません。 + +関数が ":endfunction" まで実行されたとき、あるいは引数無しで ":return" を使っ +たときは 0 が返ります。 + +既存の関数を再定義したい場合は ":function" コマンドに "!" を付けてください: > + + :function! Min(num1, num2, num3) + + +範囲指定を使う +-------------- + +":call" コマンドは行範囲を受け取ることができます。範囲指定の使用方法は二つあり +ます。関数を定義するときに "range" キーワードを使った場合は、関数自身が範囲指 +定を処理します。 +関数には "a:firstline" と "a:lastline" という二つの変数が暗黙的に渡されます。 +この二つの変数には範囲指定された行番号が代入されています。例: > + + :function Count_words() range + : let lnum = a:firstline + : let n = 0 + : while lnum <= a:lastline + : let n = n + len(split(getline(lnum))) + : let lnum = lnum + 1 + : endwhile + : echo "found " . n . " words" + :endfunction + +この関数は次のように呼び出すことができます: > + + :10,30call Count_words() + +関数が一度だけ実行され、単語の数が表示されます。 +関数を定義するときに "range" キーワードを使わなかった場合は、指定された範囲の +それぞれの行に対して関数が呼ばれます (カーソルはその行の上)。例: > + + :function Number() + : echo "line " . line(".") . " contains: " . getline(".") + :endfunction + +次のように実行すると: > + + :10,15call Number() + +関数は 6 回実行されます。 + + +可変長引数 +---------- + +可変個の引数を取る関数を定義できます。例えば、次の関数は、必ず 1 つの引数 +(start) を取り、最大で 20 個までの引数を取ることができます: > + + :function Show(start, ...) + +変数 "a:1" に 1 つ目のオプション引数が代入されます。2 つ目が "a:2" で、3 つ目 +が "a:3" です。"a:0" にはオプション引数の数が入ります。 +例: > + + :function Show(start, ...) + : echohl Title + : echo "start is " . a:start + : echohl None + : let index = 1 + : while index <= a:0 + : echon " Arg " . index . " is " . a:{index} + : let index = index + 1 + : endwhile + : echo "" + :endfunction + +この関数は ":echohl" を使って ":echo" の出力に色を付けています。":echohl None" +で色付けをやめます。":echon" コマンドは ":echo" と同じ機能ですが、改行を出力し +ません。 + +変数 a:000 を使うこともできます。これは "..." 引数がすべて入ったリストです。 +|a:000|を参照。 + + +関数の一覧 +---------- + +":function" コマンドでユーザー定義関数の一覧を表示できます: > + + :function +< function Show(start, ...) ~ + function GetVimIndent() ~ + function SetSyn(name) ~ + +関数の中身を見たいときは関数名を指定してください: > + + :function SetSyn +< 1 if &syntax == '' ~ + 2 let &syntax = a:name ~ + 3 endif ~ + endfunction ~ + + +デバッグ +-------- + +エラーメッセージが表示されたとき、あるいはデバッグ中に、行番号が表示されると便 +利です。デバッグモードについては |debug-scripts| を参照してください。 +'verbose' オプションに 12 以上の値を設定すると、すべての関数呼び出しが表示され +ます。15 以上にすると、実行されたすべての行が表示されます。 + + +関数の削除 +---------- + +例えば Show() 関数を削除するのは次のようにします: > + + :delfunction Show + +関数が存在しない場合はエラーになります。 + + +関数への参照 +------------ + +変数に関数を代入できると便利なことがあります。それには function() 関数を使いま +す。function() は関数の名前を受け取り、関数への参照を返します: > + + :let result = 0 " or 1 + :function! Right() + : return 'Right!' + :endfunc + :function! Wrong() + : return 'Wrong!' + :endfunc + : + :if result == 1 + : let Afunc = function('Right') + :else + : let Afunc = function('Wrong') + :endif + :echo call(Afunc, []) +< Wrong! ~ + +Note 関数への参照を保持する変数の名前は大文字で始めなければなりません。そうで +ないと組み込み関数の名前と紛らわしくなります。 +変数が参照している関数を呼び出すには call() 関数を使います。call() 関数の最初 +の引数は関数への参照で、2 番目の引数は引数のリストです。 + +関数への参照は、次節で説明される辞書と組み合わせたときもっとも役に立ちます。 + +============================================================================== +*41.8* リストと辞書 + +ここまでは基本型(文字列と数値)を扱ってきました。Vim は二つの複合型、リストと辞 +書もサポートしています。 + +リストとは、要素を順番に並べたものです。要素はどのような型でも構いません。数値 +のリスト、リストのリスト、あるいは複数の型が混在したリストでも作れます。例え +ば、3 個の文字列からなるリストを作るには次のようにします: > + + :let alist = ['aap', 'mies', 'noot'] + +リストの要素は角括弧で囲み、コンマで区切ります。空のリストを作るには次のように +します: > + + :let alist = [] + +関数add()を使うとリストに要素を追加することができます: > + + :let alist = [] + :call add(alist, 'foo') + :call add(alist, 'bar') + :echo alist +< ['foo', 'bar'] ~ + +リストの連結には + を使います: > + + :echo alist + ['foo', 'bar'] +< ['foo', 'bar', 'foo', 'bar'] ~ + +直接リストを拡張するには次のようにします: > + + :let alist = ['one'] + :call extend(alist, ['two', 'three']) + :echo alist +< ['one', 'two', 'three'] ~ + +add()とは効果が異なることに注意してください: > + + :let alist = ['one'] + :call add(alist, ['two', 'three']) + :echo alist +< ['one', ['two', 'three']] ~ + +add()の第二引数は1つの要素として追加されます。 + + +FOR ループ +---------- + +リストを使ってできる素晴らしいことの1つが、リストに対する繰り返しです: > + + :let alist = ['one', 'two', 'three'] + :for n in alist + : echo n + :endfor +< one ~ + two ~ + three ~ + +上の例は、リスト "alist" の各要素に対して、その値を変数 "n" に代入しながらルー +プを行います。forループの書式は次の通りです: > + + :for {varname} in {listexpression} + : {commands} + :endfor + +ある回数だけループするには、その長さのリストを使います。関数range()を使うと、 +そのようなリストを作成できます: > + + :for a in range(3) + : echo a + :endfor +< 0 ~ + 1 ~ + 2 ~ + +range()が生成するリストの最初の要素は0であることに注意してください。そのため、 +最後の要素はリストの長さより1小さい値になります。 +最大値、ステップ幅を指定することもでき、逆方向に進むこともできます: > + + :for a in range(8, 4, -2) + : echo a + :endfor +< 8 ~ + 6 ~ + 4 ~ + +より有用な例として、バッファ中の行に対するループ: > + + :for line in getline(1, 20) + : if line =~ "Date: " + : echo matchstr(line, 'Date: \zs.*') + : endif + :endfor + +1行目から20行目(両端を含む)を調べ、そこに含まれる日付を全て表示しています。 + + +辞書 +----- + +辞書はキーと値のペアを保持します。キーを指定することで高速に値を検索できます。 +辞書は波括弧で作ります: > + + :let uk2nl = {'one': 'een', 'two': 'twee', 'three': 'drie'} + +そして角括弧の中にキーを書くことで単語を検索します: > + + :echo uk2nl['two'] +< twee ~ + +辞書の定義の書式は次の通りです: > + + {<key> : <value>, ...} + +空の辞書とは、どんなキーも持たない辞書のことです: > + + {} + +辞書にはいろいろな使い道があります。辞書を扱う関数もたくさんあります。例えば、 +キーのリストを取得してそれに対してループするには次のようにします: > + + :for key in keys(uk2nl) + : echo key + :endfor +< three ~ + one ~ + two ~ + +キーはソートされていません。特定の順序に並べるにはリストをソートします: > + + :for key in sort(keys(uk2nl)) + : echo key + :endfor +< one ~ + three ~ + two ~ + +要素が定義された順序を得ることはできません。そのような目的にはリストを使ってく +ださい。リストは順序を保って要素を保持します。 + + +辞書の関数 +---------- + +辞書の要素は角括弧でインデックスを指定して取得します: > + + :echo uk2nl['one'] +< een ~ + +記号を使わない方法もあります: > + + :echo uk2nl.one +< een ~ + +この方法はキーがアルファベット、数字、アンダースコアなどの ASCII 文字だけで構 +成されている場合に使えます。この方法で値を代入することもできます: > + + :let uk2nl.four = 'vier' + :echo uk2nl +< {'three': 'drie', 'four': 'vier', 'one': 'een', 'two': 'twee'} ~ + +関数の定義と辞書への代入を同時に記述することができます: > + + :function uk2nl.translate(line) dict + : return join(map(split(a:line), 'get(self, v:val, "???")')) + :endfunction + +これを実行してみましょう: > + + :echo uk2nl.translate('three two five one') +< drie twee ??? een ~ + +":function" の行の末尾に "dict" と書かれています。これは、その関数が辞書から使 +われることを示します。ローカル変数 "self" がその辞書を指すようになります。 +次に、複雑なreturnコマンドを分解してみましょう: > + + split(a:line) + +関数split()は文字列を空白文字で区切り、リストにして返します。そのため、この例 +での戻り値は次のようになります: > + + :echo split('three two five one') +< ['three', 'two', 'five', 'one'] ~ + +このリストがmap()関数の第一引数になります。map()はリストの各要素を "v:val" に +代入した状態で第二引数を評価します。これによりforループより短いコードが書けま +す。このコードは: > + + :let alist = map(split(a:line), 'get(self, v:val, "???")') + +次のコードと同じです: > + + :let alist = split(a:line) + :for idx in range(len(alist)) + : let alist[idx] = get(self, alist[idx], "???") + :endfor + +関数get()はそのキーが辞書に入っているかをチェックします。入っていればその値を +返します。入っていなければデフォルト値(この例では '???')を返します。キーが入っ +ていなくてもエラーを起こしたくないような場合に便利です。 + +関数join()はsplit()の逆の処理をします。つまり単語のリストをスペースでつなげま +す。 +split()、map()、join() を組み合わせると、単語からなる行を簡潔に処理することが +できます。 + + +オブジェクト指向プログラミング +------------------------------ + +辞書には値と関数を入れることができるので、辞書をオブジェクトとして使うことがで +きます。 +上述の例ではオランダ語から英語に翻訳するために辞書を使いました。同じことが他の +言語でもできると面白いかもしれませんね。まず翻訳関数を持ったオブジェクト (つま +り辞書) を作ります。翻訳する単語はまだ定義しません: > + + :let transdict = {} + :function transdict.translate(line) dict + : return join(map(split(a:line), 'get(self.words, v:val, "???")')) + :endfunction + +単語を翻訳するのに 'self.words' を使う点が上述の例と少し違います。しかし、 +self.words はまだありません。よって、これは抽象クラスと呼ぶことができます。 + +オランダ語を翻訳するオブジェクトをインスタンス化してみましょう: > + + :let uk2nl = copy(transdict) + :let uk2nl.words = {'one': 'een', 'two': 'twee', 'three': 'drie'} + :echo uk2nl.translate('three one') +< drie een ~ + +さらにドイツ語の翻訳機を作ります: > + + :let uk2de = copy(transdict) + :let uk2de.words = {'one': 'eins', 'two': 'zwei', 'three': 'drei'} + :echo uk2de.translate('three one') +< drei eins ~ + +copy() 関数を使って "transdict" 辞書をコピーし、そのコピーに対して単語を追加し +ています。元の辞書はもちろん変更されません。 + +さらに一歩進んで、適切な言語を選択できるようにしてみます: > + + :if $LANG =~ "de" + : let trans = uk2de + :else + : let trans = uk2nl + :endif + :echo trans.translate('one two three') +< een twee drie ~ + +"trans" は2つのオブジェクト(辞書)のうちどちらか1つを参照します。コピーは作られ +ていません。リストと辞書の同一性についてのより詳しい情報は|list-identity|と +|dict-identity|にあります。 + +未対応の言語を使う場合は、translate() 関数を上書きして何もしないようにするとい +いかもしれません: > + + :let uk2uk = copy(transdict) + :function! uk2uk.translate(line) + : return a:line + :endfunction + :echo uk2uk.translate('three one wladiwostok') +< three one wladiwostok ~ + +! を使って既に存在している関数への参照を上書きしています。続いて、未対応の言語 +に対して "uk2uk" を使うように変更します: > + + :if $LANG =~ "de" + : let trans = uk2de + :elseif $LANG =~ "nl" + : let trans = uk2nl + :else + : let trans = uk2uk + :endif + :echo trans.translate('one two three') +< one two three ~ + +さらなる情報については|List|と|Dictionaries|を参照してください。 + +============================================================================== +*41.9* 例外 + +まずは例題を見てください: > + + :try + : read ~/templates/pascal.tmpl + :catch /E484:/ + : echo "パスカル用のテンプレートファイルは見つかりませんでした。" + :endtry + +":read" コマンドはファイルがなければ失敗します。そのエラーをキャッチして、エ +ラーメッセージの代わりにより親切なメッセージを表示しています。 + +":try" と ":endtry" の間で起きたエラーは例外に変わります。例外は文字列です。エ +ラーが例外に変わったとき、文字列にはエラーメッセージが含まれます。また、全ての +エラーメッセージは番号を持っています。例題では "E484:" を含んだエラーをキャッ +チしています。この番号は変わらないことが保証されています (テキストは翻訳される +などして変わるかもしれません)。 + +":read" コマンドが他のエラーを起こした場合、"E484:" というパターンはマッチしな +いでしょう。したがって、その例外はキャッチされず、通常のエラーメッセージが表示 +されます。 + +次のように書くこともできます: > + + :try + : read ~/templates/pascal.tmpl + :catch + : echo "パスカル用のテンプレートファイルは見つかりませんでした。" + :endtry + +全ての例外がキャッチされます。しかしこれでは "E21: Cannot make changes, +'modifiable' is off" のような有効なエラーに気づくことができません。 + +":finally" という便利なコマンドもあります: > + + :let tmp = tempname() + :try + : exe ".,$write " . tmp + : exe "!filter " . tmp + : .,$delete + : exe "$read " . tmp + :finally + : call delete(tmp) + :endtry + +カーソル行からファイル末尾までを "filter" コマンド (ファイル名を引数に取るコマ +ンド) でフィルタ処理しています。":try" と ":finally" の間で問題が起きても、 +ユーザーが CTRL-C を押して操作をキャンセルしても、"call delete(tmp)" は必ず呼 +ばれます。一時ファイルが残ってしまう心配はありません。 + +例外についてさらに詳しい情報はリファレンスマニュアルの|exception-handling|を +参照してください。 + +============================================================================== +*41.10* 注意事項 + +Vim script において注意すべきことの概要を簡単に説明します。他の場所にも同じよ +うな説明はありますが、手頃なチェックリストに使えるでしょう。 + +改行記号はシステムによって異なります。Unix では <NL> 文字が使われますが、 +MS-DOS、Windows、OS/2 などでは <CR><LF> が使われます。末尾が <CR> になってい +るマップを使うときは注意してください。|:source_crnl| 参照。 + + +空白 +----- + +空の行はあっても構いません。無視されます。 + +行頭の空白 (スペースとTAB) は常に無視されます。引数と引数の間には空白がいくつ +あっても構いません (例えば下記の "set" と "cpoptions" の間)。空白は一つのス +ペースにまとめられ、セパレータの役目をします。最後の文字より後ろにある空白文字 +は状況によって無視されたりされなかったりします。下記参照。 + +":set" コマンドで "=" 記号を使うとき: > + + :set cpoptions =aABceFst + +"=" の直前にある空白は無視されます。しかし、"=" の後ろに空白をはさむことはでき +ません。 + +オプション値に空白を含めるときは、バックスラッシュ ("\") でエスケープする必要 +があります: > + + :set tags=my\ nice\ file + +次のように書くと: > + + :set tags=my nice file + +これはエラーになります。このコマンドは次のように解釈されてしまいます: > + + :set tags=my + :set nice + :set file + + +コメント +-------- + +コメントは " (ダブルクォート) 記号で開始します。行末までのすべての文字がコメン +トとして解釈され、無視されます。ただし、コメントを書くことができないコマンドも +あります (以下に例を示します)。コメントは行のどこからでも開始できます。 + +コメントとして簡単な注釈を付けたとします。例: > + + :abbrev dev development " shorthand + :map <F3> o#include " insert include + :execute cmd " do it + :!ls *.c " list C files + +短縮形 'dev' は 'development " shorthand' に展開されます。<F3> には +'o#....' から '" insert include' までの全部がマップされます。"execute" コマン +ドはエラーを起こします。"!" コマンドはすべての文字をシェルに渡すので、" 記号が +閉じられていないことでエラーが起こります。 +":map"、":abbreviate"、":execute"、"!" などのコマンドはその後ろにコメントを書 +くことができません (そのようなコマンドは他にもあります)。ただし、無理やりコメ +ントを書く方法もあります: > + + :abbrev dev development|" shorthand + :map <F3> o#include|" insert include + :execute cmd |" do it + +'|' 文字でコマンドを区切り、次のコマンドを書くことができます。この例では二つ目 +のコマンドはコメントのみです。"!" の場合は |:execute| と '|' を使わなければな +りません: > + :exe '!ls *.c' |" list C files + +":map" と ":abbreviate" の場合は '|' の前に空白を置かないように注意してくださ +い。これらのコマンドは行末か '|' までのすべての文字を使います。そのため、意図 +せずに末尾に空白を入れてしまうかもしれません: > + + :map <F4> o#include + +vimrc を編集するときに 'list' オプションをオンに設定しておくと、この問題が発見 +しやすくなります。 + +Unix では特別なコメント書式を使って Vim script を実行形式にすることができま +す: > + #!/usr/bin/env vim -S + echo "this is a Vim script" + quit + +"#" コマンドは行を行番号付きで表示しますが、'!' をつけると何もしなくなります。 +よってファイルを実行するためのシェルコマンドを記述することができます。 +|:#!| |-S| + + +落とし穴 +-------- + +次の例には大きな問題があります: > + + :map ,ab o#include + :unmap ,ab + +この unmap コマンドはうまく動きません。なぜなら ",ab " を unmap しようとしてい +るからです。そのようなマップは存在しません。エラーが表示されますが、スペースは +目に見えないので、エラーの原因を見つけるのは困難です。 + +":unmap" コマンドの後にコメントを書いた場合も同様です: > + + :unmap ,ab " comment + +コメントは無視されますが、Vim は ',ab ' を unmap しようとします。次のよう +に書いてください: > + + :unmap ,ab| " comment + + +ビューの復元 +------------ + +何らかの変更を加えてから、カーソルのあった場所に戻りたい時があります。そのとき +に、画面に表示されていた行範囲も復元されるとすてきです。 +次の例は、現在行をヤンクしてファイルの先頭にプットし、ビューを復元します: > + + map ,p ma"aYHmbgg"aP`bzt`a + +これは次のことをしています: > + ma"aYHmbgg"aP`bzt`a +< ma 現在のカーソル位置にマーク a を設定 + "aY 現在行をレジスタ a にヤンク + Hmb ウィンドウの一行目に移動してマーク b を設定 + gg ファイルの一行目に移動 + "aP ヤンクした行をその上にプット + `b ウィンドウの一行目に戻る + zt ウィンドウの表示範囲を以前と同じにする + `a 保存しておいたカーソル位置に移動 + + +パッケージング +-------------- + +関数の名前が他の人の関数とかぶらないように、次の方法を使ってください: +- ユニークな文字列を名前の前に付ける。私はよく略語を使います。例えば、オプショ + ンウィンドウ (option window) のための関数なら "OW_" などです。 +- 関数を一つのファイルにまとめて、関数がロードされているかどうかを示すグローバ + ル変数を設定する。ファイルが二回目に読み込まれたとき、最初にそれらの関数をア + ンロードする。 +例: > + + " This is the XXX package + + if exists("XXX_loaded") + delfun XXX_one + delfun XXX_two + endif + + function XXX_one(a) + ... body of function ... + endfun + + function XXX_two(b) + ... body of function ... + endfun + + let XXX_loaded = 1 + +============================================================================== +*41.11* プラグインを書く *write-plugin* + +Vim script を書いて、それを多くの人に使ってもらうことができます。そのようなス +クリプトはプラグインと呼ばれます。Vim ユーザーはあなたのスクリプトをプラグイン +ディレクトリにコピーするだけで、すぐにその機能を使うことができます。 +|add-plugin| 参照。 + +プラグインには二種類あります: + + グローバルプラグイン : すべてのファイルで共通 + ファイルタイププラグイン : ファイルの種類別 + +この節ではグローバルプラグインについて説明します。ほとんどの説明はファイルタイ +ププラグインに対してもあてはまります。ファイルタイププラグイン特有の説明は次節 +にあります |write-filetype-plugin|。 + + +名前 +----- + +最初にプラグインの名前を決めなければなりません。プラグインが提供する機能が名前 +から分かるようにしてください。また、他の人が作ったプラグインと名前がかぶらない +ようにしてください。古い Windows システムでの問題を避けるため、名前は 8 文字以 +内にしてください。 + +例えばタイプミス (type mistake) を修正 (correct) するためのスクリプトなら +"typecorr.vim" という名前を付けたりします。ここではこれを例題として使います。 + +プラグインが誰でも使えるようにするため、いくつかのガイドラインに従ってくださ +い。ガイドラインは段階的に説明していきます。例題プラグインの完全なソースは最後 +に示します。 + + +ボディ +------ + +まずはプラグインの本体部分を見てみましょう。行番号は実際の番号です: > + + 14 iabbrev teh the + 15 iabbrev otehr other + 16 iabbrev wnat want + 17 iabbrev synchronisation + 18 \ synchronization + 19 let s:count = 4 + +もちろん、実際のスクリプトはもっと巨大です。 + +行番号は説明のために追加したものです。プラグインを書くときは行番号を付けないで +ください。 + + +ヘッダー +------ + +新しい単語を追加していくと、プラグインには複数のバージョンが存在することになり +ます。ファイルを配布したとき、それを使った人は、誰がこの素晴らしいプラグインを +書いたのかを知りたいと思うでしょうし、感想を伝えたいと思うかもしれません。 +というわけで、次のようなヘッダーをプラグインに書いてください: > + + 1 " Vim global plugin for correcting typing mistakes + 2 " Last Change: 2000 Oct 15 + 3 " Maintainer: Bram Moolenaar <Bram@vim.org> + +著作権とライセンスについて: プラグインがとても便利で、そして再配布を制限するほ +どのものでない場合は、パブリックドメインか Vim ライセンス (|license|) の適用を +検討してみてください。次の短い宣言をプラグインの先頭付近に書いておくだけで十分 +です: > + + 4 " License: This file is placed in the public domain. + + +行連結、副作用の回避 *use-cpo-save* +-------------------- + +上の例の 18 行目では行連結 (|line-continuation|) が使われています。ユーザーの +環境で 'compatible' オプションがオンに設定されていると、この行でエラーが発生し +ます。'compatible' オプションの設定には副作用があるので、勝手に設定をオフにす +ることはできません。問題を避けるには、一時的に 'cpoptions' の値を Vim の初期値 +に設定し、後で元に戻します。そうすれば、行連結を使うことができ、スクリプトはほ +とんどの環境で動作するようになります。設定の変更は次のようにします: > + + 11 let s:save_cpo = &cpo + 12 set cpo&vim + .. + 42 let &cpo = s:save_cpo + 43 unlet s:save_cpo + +最初に 'cpoptions' の値を s:save_cpo 変数に保存します。プラグインの最後でオプ +ションの値を元に戻します。 + +スクリプトローカル変数 (|s:var|) を使っていることに注目してください。グローバ +ル変数は他の場所で使われている可能性があります。スクリプトの中だけで使う場合は +スクリプトローカル変数を使ってください。 + + +ロードしない +------------ + +ユーザーが常にプラグインをロードしたいと思うとは限りません。また、システム管理 +者がシステムのプラグインディレクトリにプラグインを入れたが、ユーザーは自分で入 +れたプラグインを使いたいということもあります。したがって、指定したプラグインだ +けを無効にできる必要があります。次のようにします: > + + 6 if exists("g:loaded_typecorr") + 7 finish + 8 endif + 9 let g:loaded_typecorr = 1 + +これはスクリプトの二重ロードを避ける効果もあります。スクリプトを二重にロードす +ると、関数の再定義エラーが発生したり、自動コマンドが二重に追加されることでトラ +ブルが起きたりします。 + +変数の名前は "loaded_" で始めてプラグインのファイル名をそのまま付けるようにし +てください。"g:" を付けることで関数の中で変数を使用したときに発生するミスを防 +いでいます (関数の中では "g:" を付けない変数はローカル変数になります)。 + +"finish" を使ってファイルの残りの部分の読み込みを停止しています。この方法は +ファイル全体を if-endif で囲むよりも速いです。 + + +マップ +------ + +さて、プラグインをもっと魅力あるものに仕上げましょう。マップを追加して、カーソ +ルの下の単語に対する修正を追加できるようにします。単純にキーを選んでマップを設 +定することもできますが、そのキーは既にユーザーが使っているかもしれません。マッ +プに使用するキーをユーザーが選択できるようにするには、<Leader> を使います: > + + 22 map <unique> <Leader>a <Plug>TypecorrAdd + +"<Plug>TypecorrAdd" は目的の動作をします。詳しくは後で説明します。 + +使用したいキーを "mapleader" 変数に設定することで、マップの最初のキーを設定で +きます。例えば、次のように設定すると: > + + let mapleader = "_" + +マップは "_a" と定義されます。変数が設定されていない場合は初期設定 (バックス +ラッシュ) が使われます。つまり "\a" というマップが定義されます。 + +Note: 上記のコマンドでは <unique> が使われています。これは、同じマップが既に定 +義されていた場合にエラーを表示します。|:map-<unique>| + +マップするキーをユーザーが自分で定義できるようにするには、次のようにします: > + + 21 if !hasmapto('<Plug>TypecorrAdd') + 22 map <unique> <Leader>a <Plug>TypecorrAdd + 23 endif + +"<Plug>TypecorrAdd" に対するマップが既にあるかどうかを調べ、無い場合のみ +"<Leader>a" にマップを定義します。ユーザーは自分の vimrc ファイルの中でマップ +を定義することができます: > + + map ,c <Plug>TypecorrAdd + +すると、マップのキーとして ",c" が使われます。"_a" や "\a" は使われません。 + + +ピース +------ + +スクリプトが大きくなると、それを部品ごとに分けたくなります。それには関数やマッ +プを使います。しかし、そうすると関数やマップが他のスクリプトのものと衝突する可 +能性があります。例えば、Add() という関数を追加したとき、他のスクリプトでも同じ +名前の関数が定義されているかもしれません。そのような場合は、名前の前に "s:" を +付けて、スクリプトの中だけで使える関数を定義します。 + +新しい修正を追加するための関数を定義します: > + + 30 function s:Add(from, correct) + 31 let to = input("type the correction for " . a:from . ": ") + 32 exe ":iabbrev " . a:from . " " . to + .. + 36 endfunction + +s:Add() 関数は同じスクリプトの中から呼び出すことができます。他のスクリプトが +s:Add() を定義していた場合、それはそのスクリプトにローカルであり、関数が定義さ +れたスクリプトの中からのみ呼び出すことができます。さらにグローバルの Add() 関 +数 ("s:" 無し) を定義することもでき、それはまた別の関数になります。 + +マップ定義では <SID> が使えます。これは、現在のスクリプトを識別するためのスク +リプト ID を生成します。私たちの入力修正プラグインでは <SID> を次のように使い +ます: > + + 24 noremap <unique> <script> <Plug>TypecorrAdd <SID>Add + .. + 28 noremap <SID>Add :call <SID>Add(expand("<cword>"), 1)<CR> + +ユーザーが "\a" と入力すると、次の手順でキー入力が呼び出されます: > + + \a -> <Plug>TypecorrAdd -> <SID>Add -> :call <SID>Add() + +他のスクリプトで <SID>Add をマップすると、別のスクリプト ID が使われ、別のマッ +プが生成されます。 + +Note: s:Add() ではなく <SID>Add() と書いていることに注意してください。マップは +スクリプトの外側でユーザーが入力するものだからです。<SID> はスクリプト ID に変 +換され、どのスクリプトの Add() 関数を呼べばいいのかわかるようになっています。 + +これは少し複雑ですが、複数のプラグインを同時に使用するためには必要なことです。 +基本的なルールとしては、マップの中では <SID>Add() を使い、他の場所 (スクリプト +の中、自動コマンド、ユーザー定義コマンド) では s:Add() を使います。 + +マップと同じ方法で、メニューを追加することもできます: > + + 26 noremenu <script> Plugin.Add\ Correction <SID>Add + +プラグインのメニューを追加する場合は "Plugin" メニューの下に登録することが推奨 +されています。この例ではメニューが一つだけですが、複数のメニューを追加する場合 +は、サブメニューの使用が推奨されています。例えば、"Plugin.CVS" 以下に +"Plugin.CVS.checkin" や "Plugin.CVS.checkout" などの CVS の操作を登録します。 + +Note: 28 行目では ":noremap" を使って、他のマップでトラブルが起きないようにし +ています。例えば、誰かが ":call" をマップしているかもしれないからです。24 行目 +でも ":noremap" を使っていますが、ここでは "<SID>Add" を再マップして欲しいの +で、"<script>" を使っています。これを使うとスクリプトローカルなマップだけが再 +マップされます |:map-<script>|。26 行目でも ":noremenu" で同様のことをしていま +す |:menu-<script>|。 + + +<SID> と <Plug> *using-<Plug>* +--------------- + +<SID> と <Plug> は、入力したキーに対するマップと、他のマップの中だけで使われる +マップが干渉しないようにするために使われます。<SID> と <Plug> の違いに注意して +ください: + +<Plug> これはスクリプトの外側からも見えます。ユーザーが自分でプラグインの機能 + をマップできるようにするような場合に使います。<Plug> は特殊なコード + で、キーボードから入力されることはありません。 + キー列が他のプラグインとかぶらないように、<Plug> スクリプト名 マップ + 名、という形式で使ってください。 + 我々の例では、スクリプト名が "Typecorr"、マップ名が "Add" なので、 + "<Plug>TypecorrAdd" というキー列になります。スクリプト名とマップ名の最 + 初の文字だけを大文字にして、どこがマップ名なのかわかるようにします。 + +<SID> これはスクリプト ID (スクリプト固有の識別子) です。 + Vim は内部で <SID> を "<SNR>123_" に変換します ("123" の部分はいろいろ + な数字が入ります)。つまり、関数 "<SID>Add()" は、あるスクリプトでは + "<SNR>11_Add()" という名前になり、別のスクリプトでは "<SNR>22_Add()" + になります。これは ":function" コマンドで関数一覧を表示すると確認する + ことができます。<SID> の変換はマップの中でも同様におこなわれるので、 + マップの中からスクリプトローカル関数を呼び出すことができます。 + + +ユーザー定義コマンド +------------------ + +修正を追加するためのユーザー定義コマンドを追加します: > + + 38 if !exists(":Correct") + 39 command -nargs=1 Correct :call s:Add(<q-args>, 0) + 40 endif + +ユーザー定義コマンドは、同じ名前のコマンドがまだない場合のみ定義できます。既に +定義されている場合はエラーになります。":command!" を使ってユーザー定義関数を上 +書きするのは良いアイデアとは言えません。ユーザーは、自分が定義したコマンドがな +ぜ動かないのか不思議に思うでしょう。|:command| + + +スクリプト変数 +-------------- + +先頭に "s:" が付いた変数はスクリプト変数です。これはスクリプトの中だけで使えま +す。スクリプトの外からは見えません。同じ名前の変数を複数のスクリプトで使ってし +まうようなトラブルを避けることができます。Vim が実行されている間、変数は保持さ +れます。そして、同じスクリプトが再読み込みされると、再び同じ変数が使われます。 +|s:var| + +スクリプト変数は、同じスクリプトの中で定義された関数、自動コマンド、ユーザー定 +義コマンドでも使えます。我々の例に、修正の数を数えるための数行のコードを追加し +ます: > + + 19 let s:count = 4 + .. + 30 function s:Add(from, correct) + .. + 34 let s:count = s:count + 1 + 35 echo s:count . " corrections now" + 36 endfunction + +最初に s:count はスクリプトの中で 4 で初期化されます。その後、s:Add() 関数が呼 +び出されると、s:count が増加します。関数がどこから呼ばれたかに関わらず、関数が +定義されたスクリプトのローカル変数が使われます。 + + +まとめ +------ + +例題の完成形は以下のようになります: > + + 1 " Vim global plugin for correcting typing mistakes + 2 " Last Change: 2000 Oct 15 + 3 " Maintainer: Bram Moolenaar <Bram@vim.org> + 4 " License: This file is placed in the public domain. + 5 + 6 if exists("g:loaded_typecorr") + 7 finish + 8 endif + 9 let g:loaded_typecorr = 1 + 10 + 11 let s:save_cpo = &cpo + 12 set cpo&vim + 13 + 14 iabbrev teh the + 15 iabbrev otehr other + 16 iabbrev wnat want + 17 iabbrev synchronisation + 18 \ synchronization + 19 let s:count = 4 + 20 + 21 if !hasmapto('<Plug>TypecorrAdd') + 22 map <unique> <Leader>a <Plug>TypecorrAdd + 23 endif + 24 noremap <unique> <script> <Plug>TypecorrAdd <SID>Add + 25 + 26 noremenu <script> Plugin.Add\ Correction <SID>Add + 27 + 28 noremap <SID>Add :call <SID>Add(expand("<cword>"), 1)<CR> + 29 + 30 function s:Add(from, correct) + 31 let to = input("type the correction for " . a:from . ": ") + 32 exe ":iabbrev " . a:from . " " . to + 33 if a:correct | exe "normal viws\<C-R>\" \b\e" | endif + 34 let s:count = s:count + 1 + 35 echo s:count . " corrections now" + 36 endfunction + 37 + 38 if !exists(":Correct") + 39 command -nargs=1 Correct :call s:Add(<q-args>, 0) + 40 endif + 41 + 42 let &cpo = s:save_cpo + 43 unlet s:save_cpo + +33 行目は説明がまだでした。これは、新しい修正をカーソルの下の単語に適用しま +す。|:normal| コマンドを使って新しい略語を適用しています。Note: マップと略語は +その場で展開されます。":noremap" で定義されたマップから関数が呼び出されたとし +ても動作は同じです。 + +'fileformat' オプションを "unix" に設定することが推奨されています。そうすれ +ば、Vim script はどこでも動作します。'fileformat' が "dos" に設定されたスクリ +プトは Unix では動作しません。|:source_crnl| も参照。設定が正しいことを確実に +するため、ファイルを保存する前に次のコマンドを実行してください: > + + :set fileformat=unix + + +ドキュメント *write-local-help* +------------ + +プラグインのドキュメントを書くのは良いアイデアです。ユーザーが動作を変更できる +ような場合には特に重要です。|add-local-help| ではどのようにしてドキュメントが +インストールされるか説明されています。 + +プラグインヘルプファイルの例を示します ("typecorr.txt"): > + + 1 *typecorr.txt* Plugin for correcting typing mistakes + 2 + 3 If you make typing mistakes, this plugin will have them corrected + 4 automatically. + 5 + 6 There are currently only a few corrections. Add your own if you like. + 7 + 8 Mappings: + 9 <Leader>a or <Plug>TypecorrAdd + 10 Add a correction for the word under the cursor. + 11 + 12 Commands: + 13 :Correct {word} + 14 Add a correction for {word}. + 15 + 16 *typecorr-settings* + 17 This plugin doesn't have any settings. + +書式に気をつけなければならないのは一行目だけです。一行目はコピーされ、help.txt +の "LOCAL ADDITIONS:" の項に埋め込まれます |local-additions|。最初の "*" は一 +行目の一桁目に書いてください。ヘルプを追加したら ":help" を実行して項目が追加 +されたことを確認してください。 + +ヘルプの中で ** で文字を囲むとタグを追加することができます。ただし、既存のヘル +プタグと同じものを使わないでください。"typecorr-settings" のように、プラグイン +の名前を使ってタグを作るといいかもしれません。 + +ヘルプの他の部分を参照するときは || で囲みます。そうすれば、ユーザーは簡単にヘ +ルプの関連した部分を参照することができます。 + + +ファイルタイプの認識 *plugin-filetype* +-------------------- + +ファイルタイプが Vim によって認識されない場合は、別ファイルにファイルタイプを +認識するためにコードを作成する必要があります。通常は、自動コマンドを使って、 +ファイル名がパターンにマッチしたときにファイルタイプを設定します。例: > + + au BufNewFile,BufRead *.foo set filetype=foofoo + +この一行を 'runtimepath' の最初のディレクトリの "ftdetect/foofoo.vim" に書き +込みます。例えば、Unix なら "~/.vim/ftdetect/foofoo.vim" などです。ファイルタ +イプとスクリプトファイルの名前を同じにする決まりになっています。 + +必要ならより複雑な処理をすることもできます。例えば、ファイルの中身を見て言語を +判定したりできます。|new-filetype| も参照。 + + +要約 *plugin-special* +----- + +プラグインで使用する特有事項の要約を示します: + +s:name スクリプトローカル変数。 + +<SID> スクリプトID。マップや関数をスクリプトローカルにする + のに使う。 + +hasmapto() スクリプトが提供している機能に対して、ユーザーが既に + マップを定義したかどうかをチェックする関数。 + +<Leader> "mapleader" の値。ユーザーがその変数にキーを設定するこ + とで、プラグインのマップの開始キーを指定できる。 + +:map <unique> マップが既に定義されているなら警告を発する。 + +:noremap <script> スクリプトローカルマップだけを使う。グローバルマップは + 使わない。 + +exists(":Cmd") ユーザー定義コマンドが既にあるかどうかをチェックする。 + +============================================================================== +*41.12* ファイルタイププラグインを書く *write-filetype-plugin* *ftplugin* + +ファイルタイププラグインはグローバルプラグインと似ていますが、カレントバッファ +のマップやオプションだけを設定します。ファイルタイププラグインの使用方法につい +ては |add-filetype-plugin| を参照してください。 + +先に |41.10| 節のグローバルプラグインの項を読んでください。そこで説明されてい +ることはすべてファイルタイププラグインにもあてはまります。この節ではファイルタ +イププラグイン特有の事項だけを説明します。ファイルタイププラグインはカレント +バッファに対してのみ機能するということが最も大切です。 + + +無効化 +------ + +ファイルタイププラグインを書いて多くの人に使ってもらおうとするなら、プラグイン +を無効化できるようにしておく必要があります。プラグインの先頭に次のような記述を +追加してください: > + + " このバッファに対してまだ実行されていない場合のみ処理を実行する + if exists("b:did_ftplugin") + finish + endif + let b:did_ftplugin = 1 + +これは同じプラグインが同じバッファで二重にロードされるのを防ぐためにも必要です +(":edit" コマンドを引数なしで実行したときに発生します)。 + +ユーザーは、次の一行だけを書いたファイルタイププラグインを作成することで、標準 +プラグインのロードを無効化できます: > + + let b:did_ftplugin = 1 + +ただし、そのファイルを保存したファイルタイププラグインディレクトリが、 +'runtimepath' の中で $VIMRUNTIME よりも前にある必要があります。 + +標準プラグインを使いつつ、その設定を一つだけ変更したいという場合は、スクリプト +の中で設定を変更することができます: > + + setlocal textwidth=70 + +このファイルを "after" ディレクトリに保存すると、(例えば filetype=vim なら) 標 +準配布の "vim.vim" が読み込まれた後に、保存したファイルが読み込まれるようにな +ります |after-directory|。Unix ならファイルのパスは +"~/.vim/after/ftplugin/vim.vim" です。Note: 標準プラグインは "b:did_ftplugin" +を設定しますが、ここではそれを無視しています。 + + +オプション +---------- + +ファイルタイププラグインでは、カレントバッファの設定だけを変更するため、次のコ +マンドを使ってオプションを設定してください: > + + :setlocal + +そして、バッファローカルなオプションだけを設定してください (どのオプションがそ +うなのかはヘルプで確認してください)。|:setlocal| コマンドでグローバルオプショ +ンやウィンドウローカルオプションを設定すると、たくさんのバッファの設定が変更さ +れます。ファイルタイププラグインはそのような動作をすべきではありません。 + +オプションの値がフラグや設定項目のリストなら、"+=" や "-=" を使うことで既存の +設定を維持することができます。ユーザーがそのオプションの設定を変更している可能 +性もあるので注意してください。最初に初期設定に戻してから設定を変更するといいか +もしれません。例: > + + :setlocal formatoptions& formatoptions+=ro + + +マップ +------ + +カレントバッファの中だけで機能するマップを作るには次のコマンドを使います: > + + :map <buffer> + +上述したように、マップは二段階に分けて作る必要があります。ファイルタイププラグ +インで機能を定義する例を示します: > + + if !hasmapto('<Plug>JavaImport') + map <buffer> <unique> <LocalLeader>i <Plug>JavaImport + endif + noremap <buffer> <unique> <Plug>JavaImport oimport ""<Left><Esc> + +|hasmapto()| を使って、ユーザーが既に <Plug>JavaImport に対してマップを定義し +ているかどうかを調べます。未定義ならファイルタイププラグインの標準のマップを定 +義します。マップは <LocalLeader> で開始します。そうすることで、ファイルタイプ +プラグインのマップを開始するキーをユーザーが選択できます。初期設定はバックス +ラッシュです。 +"<unique>" を使って、マップが既に存在したとき、あるいは既存のマップと重複した +ときにエラーメッセージが表示されるようにします。 +|:noremap| を使って、ユーザーが定義した他のマップの影響を受けないようにしま +す。":noremap <script>" を使うと、スクリプトの中で定義した <SID> で始まるマッ +プだけが再マップされます。 + +ユーザーがファイルタイププラグインのマップを無効化できる仕組みを提供しなければ +なりません。例えば、"mail" ファイルタイプのプラグインなら次のようにします: > + + " マップを追加する。ユーザーが望まない場合は追加しない。 + if !exists("no_plugin_maps") && !exists("no_mail_maps") + " "> " を挿入して引用する + if !hasmapto('<Plug>MailQuote') + vmap <buffer> <LocalLeader>q <Plug>MailQuote + nmap <buffer> <LocalLeader>q <Plug>MailQuote + endif + vnoremap <buffer> <Plug>MailQuote :s/^/> /<CR> + nnoremap <buffer> <Plug>MailQuote :.,$s/^/> /<CR> + endif + +ここでは二つのグローバル変数が使われています: + no_plugin_maps すべてのファイルタイププラグインのマップを無効化 + no_mail_maps 特定のファイルタイププラグインのマップを無効化 + + +ユーザー定義コマンド +-------------------- + +ファイルタイプ用のユーザー定義コマンドを追加して、それを一つのバッファの中だけ +で使えるようにするには、|:command| の引数に "-buffer" を指定します。例: > + + :command -buffer Make make %:r.s + + +変数 +----- + +ファイルタイププラグインは対応するすべてのバッファに対して実行されます。スクリ +プトローカル変数 |s:var| はすべての実行で共有されます。バッファごとの変数を使 +いたい場合はバッファローカル変数 |b:var| を使ってください。 + + +関数 +----- + +関数は一度だけ定義すれば十分です。しかし、ファイルタイププラグインは対応する +ファイルが開かれるたびに読み込まれます。次のようにすると関数が一度だけ定義され +るようになります: > + + :if !exists("*s:Func") + : function s:Func(arg) + : ... + : endfunction + :endif +< + +アンドゥ *undo_indent* *undo_ftplugin* +-------- + +ユーザーが ":setfiletype xyz" としたとき、それ以前のファイルタイプの効果は無効 +になるべきです。b:undo_ftplugin 変数にコマンドを設定し、ファイルタイププラグイ +ンの設定をアンドゥするようにしてください。例: > + + let b:undo_ftplugin = "setlocal fo< com< tw< commentstring<" + \ . "| unlet b:match_ignorecase b:match_words b:match_skip" + +":setlocal" でオプション名の後に "<" を付けると、そのオプションをグローバルな +値でリセットします。オプションをリセットするにはこの方法が一番です。 + +このように行継続を使うには 'cpoptions' から "C" フラグを取り除く必要がありま +す。上述の |use-cpo-save| を参照してください。 + +インデントスクリプトの効果をアンドゥする為には、それに応じた b:undo_indent 変 +数を設定すべきです。 + + +ファイル名 +---------- + +ファイルタイププラグインのファイル名にはファイルタイプ名が含まれていなければな +りません |ftplugin-name|。次の三つのうちのどれかにしてください: + + .../ftplugin/stuff.vim + .../ftplugin/stuff_foo.vim + .../ftplugin/stuff/bar.vim + +"stuff" はファイルタイプ名、"foo" と "bar" は任意の名前です。 + + +要約 *ftplugin-special* +----- + +ファイルタイププラグインの特有事項を要約します: + +<LocalLeader> "maplocalleader" の値。ユーザーがその変数にキーを設定 + することで、ファイルタイププラグインのマップの開始キー + を指定できる。 + +:map <buffer> バッファローカルなマップを定義する。 + +:noremap <script> 同スクリプトで定義している <SID> で始まるマップだけを + 再マップする。 + +:setlocal カレントバッファのオプションのみ設定する。 + +:command -buffer バッファローカルなユーザー定義コマンドを定義する。 + +exists("*s:Func") 関数が定義済かどうかをチェックする。 + +プラグイン全般に関する事項は |plugin-special| を参照してください。 + +============================================================================== +*41.13* コンパイラプラグインを書く *write-compiler-plugin* + +コンパイラプラグインは特定のコンパイラを使うためのオプションを設定します。ユー +ザーは |:compiler| コマンドでその設定を読み込むことができます。設定されるオプ +ションは主に 'errorformat' と 'makeprg' です。 + +百聞は一見に如かず。次のコマンドですべての標準コンパイラプラグインを開くことが +できます: > + + :next $VIMRUNTIME/compiler/*.vim + +|:next| を使って次のプラグインファイルに移動してください。 + +これらのファイルには二つの特有事項があります。一つは、標準ファイルに対して設定 +を追加したり上書きしたりできる仕組みです。標準ファイルの先頭は次のようになって +います: > + + :if exists("current_compiler") + : finish + :endif + :let current_compiler = "mine" + +コンパイラファイルを書いて、それを個人用のランタイムディレクトリ (例えば Unix +なら ~/.vim/compiler) に置いたとき、"current_compiler" 変数を設定することで標 +準ファイルの設定をスキップすることができます。 + *:CompilerSet* +二つ目は、":compiler!" が使われたときは ":set" を使い、":compiler" が使われた +ときは ":setlocal" を使う仕組みです。Vim はそのために ":CompilerSet" という +ユーザーコマンドを定義します。古い Vim はそれを定義しないので、プラグインの中 +で定義してください。例: > + + if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> + endif + CompilerSet errorformat& " use the dfault 'errorformat' + CompilerSet makeprg=nmake + +コンパイラプラグインを書いて、それを Vim の配布物に含めたり、システムのランタ +イムディレクトリに入れたりする場合は、上記の方法を使ってください。 +"current_compiler" がユーザープラグインで設定された場合は何も実行しないように +します。 + +コンパイラプラグインを書いて標準プラグインの設定を上書きする場合は +"current_compiler" をチェックしないようにします。そのプラグインは最後に読み込 +まれないといけないので、'runtimepath' の最後にあるディレクトリに置きます。例え +ば、Unix なら ~/.vim/after/compiler などです。 + +============================================================================== +*41.14* プラグインを書く (高速ロード版) *write-plugin-quickload* + +プラグインが成長し、とても大きくなることがあります。すると、起動速度は遅くなっ +てきます。例えそのプラグインをたまにしか使わないとしても遅くなります。そういう +ときはクイックロードプラグインの出番です。 + +基本的なアイデアはプラグインを二回に分けて読み込むということです。一回目はユー +ザー定義コマンドやマップを定義して機能を提供します。二回目は機能を実装する関数 +を定義します。 + +スクリプトを二回読み込むことがクイックロードだというと驚かれるかもしれません。 +この手法の意味は、一回目は高速に読み込み、スクリプトの重い部分は二回目に後回し +にするということです。二回目の読み込みは、ユーザーが実際にその機能を使用したと +きに発生します。あなたがその機能を常に使うなら、これは逆に遅くなってしまいま +す。 + +Note Vim 7 以降では代わりの方法があります。|41.15| で説明されている |autoload| +機能を使う方法です。 + +次に例を示します: > + + " クイックロードのデモ用のグローバルプラグイン + " Last Change: 2005 Feb 25 + " Maintainer: Bram Moolenaar <Bram@vim.org> + " License: This file is placed in the public domain. + + if !exists("s:did_load") + command -nargs=* BNRead call BufNetRead(<f-args>) + map <F19> :call BufNetWrite('something')<CR> + + let s:did_load = 1 + exe 'au FuncUndefined BufNet* source ' . expand('<sfile>') + finish + endif + + function BufNetRead(...) + echo 'BufNetRead(' . string(a:000) . ')' + " read 機能をここに書く + endfunction + + function BufNetWrite(...) + echo 'BufNetWrite(' . string(a:000) . ')' + " write 機能をここに書く + endfunction + +このスクリプトが最初に読み込まれたとき、"s:did_load" は設定されていません。 +"if" と "endif" の間のコマンドが実行されます。|:finish| コマンドによって終了 +し、スクリプトの残りの部分は実行されません。 + +二回目に読み込まれたときは "s:did_load" が存在するので、"endif" 以降のコマンド +が実行されます。この部分では (長くなる可能性のある) BufNetRead() 関数と +BufNetWrite() 関数を定義します。 + +このスクリプトをプラグインディレクトリに置くと、Vim の起動時に実行されます。処 +理の流れは次のようになります: + +1. 起動時にスクリプトが読み込まれる。"BNRead" コマンドが定義され、<F19> キーに + マップが設定される。自動コマンドの |FuncUndefined| が定義される。":finish" + コマンドによってスクリプトが終了する。 + +2. ユーザーが BNRead コマンド実行する、または <F19> キーを押す。BufNetRead() + 関数か BufNetWrite() 関数が呼び出される。 + +3. Vim はその関数を見つけることができず、自動コマンドの |FuncUndefined| イベン + トを発行する。関数名が "BufNet*" というパターンにマッチするので、"source + fname" コマンドが実行される。"fname" はスクリプトの名前になります。スクリプ + トがどこに保存されていても、"<sfile>" が展開されてファイル名になります + (|expand()|参照)。 + +4. スクリプトが再び読み込まれる。"s:did_load" 変数が存在するので関数が定義され + る。 + +遅延ロードされる関数の名前が |FuncUndefined| 自動コマンドのパターンにマッチし +ていることに注意してください。他のプラグインがこのパターンにマッチする関数を定 +義しているとうまく動きません。 + +============================================================================== +*41.15* ライブラリスクリプトを書く *write-library-script* + +いろいろな場所で同じ機能が必要になることがあります。コードが二、三行以上になる +場合は、それを一つのスクリプトに入れて、他のスクリプトから使えるようにしたくな +ると思います。そのようなスクリプトをライブラリスクリプトと呼びます。 + +自分でライブラリスクリプトを読み込むことは可能ですが、同じスクリプトを二重に読 +み込まないようにする必要があります。それには |exists()| 関数を使います。例: > + + if !exists('*MyLibFunction') + runtime library/mylibscript.vim + endif + call MyLibFunction(arg) + +'runtimepath' に設定されたディレクトリの中の "library/mylibscript.vim" の中で +MyLibFunction() が定義されている必要があります。 + +これをより簡単にするために、Vim には autoload という仕組みがあります。同じこと +を次のように書くことができます: > + + call mylib#myfunction(arg) + +この方がずっと簡単でしょう? Vim は関数の名前を見て、それが未定義なら、 +'runtimepath' の中から "autoload/mylib.vim" を探します。そのスクリプトは関数 +"mylib#myfunction()" を定義していなければなりません。 + +mylib.vim には他の関数も入れられます。ライブラリスクリプトの中では自由に関数を +作ることができます。ただし、関数名の '#' より前の部分はスクリプトの名前と同じ +にする必要があります。そうしないと Vim はどのスクリプトを読み込めばいいのかわ +かりません。 + +ライブラリスクリプトをたくさん書く場合は、サブディレクトリを使うといいかもしれ +ません。例: > + + call netlib#ftp#read('somefile') + +Unix では、このライブラリスクリプトは次のような場所に置かれます: > + + ~/.vim/autoload/netlib/ftp.vim + +関数は次のように定義します: > + + function netlib#ftp#read(fname) + " ftp を使ってファイルを読み込む + endfunction + +関数定義と関数呼び出しではまったく同じ名前が使われます。最後の '#' より前の部 +分がサブディレクトリとスクリプトの名前に対応しています。 + +同じ方法で変数を扱うこともできます: > + + let weekdays = dutch#weekdays + +これによって "autoload/dutch.vim" が読み込まれます。そのスクリプトには例えば次 +のようなコードが書かれています: > + + let dutch#weekdays = ['zondag', 'maandag', 'dinsdag', 'woensdag', + \ 'donderdag', 'vrijdag', 'zaterdag'] + +より詳しくは |autoload| を参照してください。 + +============================================================================== +*41.16* Vim script を配布する *distribute-script* + +Vim ユーザーは Vim のウェブサイト http://www.vim.org でスクリプトを探します。 +便利なスクリプトを作ったら、ぜひ共有しましょう! + +Vim script はどのシステムでも使えます。tar や gzip コマンドは存在しないことが +あります。ファイルをまとめたり圧縮したりするには "zip" ユーティリティが推奨さ +れています。 + +可搬性を最大限に高めるには、Vim 自身を使ってスクリプトをパッケージ化します。そ +れには Vimball ユーティリティを使います。|vimball| を参照。 + +自動更新するための行を書いておくと便利です。|glvs-plugins| を参照。 + +============================================================================== + +次章: |usr_42.txt| 新しいメニューを追加する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_42.jax b/plugins/vimdoc-ja/doc/usr_42.jax new file mode 100644 index 0000000000..350a5146b5 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_42.jax @@ -0,0 +1,374 @@ +*usr_42.txt* For Vim バージョン 8.0. Last change: 2008 May 05 + + VIM USER MANUAL - by Bram Moolenaar + + 新しいメニューを追加する + + +Vim の柔軟性については既にご存知だと思います。それは GUI のメニューにおいても +同じです。自分でメニューを追加して、コマンドの実行を簡単にすることができます。 +この章はマウスをよく使うユーザー向けです。 + +|42.1| はじめに +|42.2| メニューコマンド +|42.3| その他いろいろ +|42.4| ツールバーとポップアップメニュー + +次章: |usr_43.txt| ファイルタイプを使う +前章: |usr_41.txt| Vim script 書法 +目次: |usr_toc.txt| + +============================================================================== +*42.1* はじめに + +Vim のメニューは "$VIMRUNTIME/menu.vim" で定義されています。自分のメニューを作 +りたい場合は、そのファイルにざっと目を通してみてください。 +メニューを定義するには ":menu" コマンドを使います。基本的な書式は次のとおり: > + + :menu {menu-item} {keys} + +{menu-item} にはメニューの場所を指定します。例えば {menu-item} が "File.Save" +なら、"File" メニューの下の "Save" 項目を示します。ドットで名前を区切ります。 +例: > + + :menu File.Save :update<CR> + +":update" コマンドは、ファイルが変更されていればそれを保存するコマンドです。 +階層を深くすることもできます。"Edit.Settings.Shiftwidth" なら、"Edit" メニュー +の下の "Settings" サブメニューの下の "Shiftwidth" 項目を示します。さらに深くす +ることもできます。メニューが深くなりすぎるとマウスをたくさん動かさなければなら +なくなるので注意してください。 +":menu" コマンドは ":map" コマンドとよく似ています。パラーメーターの左側でコマ +ンドの実行方法を指定し、右側で実行されるコマンドを指定します。{keys} は文字列 +で、それが実際に入力されたかのように使われます。つまり、挿入モードでは {keys} +の文字列がそのまま挿入されます。 + + +キーボードアクセラレータ +------------------------ + +アンパサンド文字 (&) はアクセラレータを示すために使われます。例えば、Alt-F で +"File" を選択し、そして S で "Save" を選択できます。 ('winaltkeys' オプション +の設定によって無効になっている可能性もあります)。その場合、{menu-item} は +"&File.&Save" のようになります。アクセラレータ文字は下線付きで表示されます +それぞれのキーは各メニューの中で一度だけしか使わないようにしてください。そうし +ないと、どちらが実行されるのかわからなくなります。これについて Vim は警告は発 +しません。 + + +並び順 +------ + +"File.Save" メニューの実際の定義は次のようになっています: > + + :menu 10.340 &File.&Save<Tab>:w :confirm w<CR> + +10.340 という数値は順位番号です。これはメニュー項目の位置を決定するために使わ +れます。最初の番号 (10) はメニューバーにおける位置を示します。数字が小さいほど +左側に配置され、大きいほど右側に配置されます。 +標準メニューでは次の順位番号が使われています: + + 日本語環境 + 10 20 40 50 60 70 9999 + +-----------------------------------------------------------------+ + | ファイル 編集 ツール シンタックス バッファ ウィンドウ ヘルプ | + +-----------------------------------------------------------------+ + + 英語環境 + 10 20 40 50 60 70 9999 + +------------------------------------------------------------+ + | File Edit Tools Syntax Buffers Window Help | + +------------------------------------------------------------+ + +ヘルプメニューには大きな番号が与えられ、右端に表示されるようになっています。 +二番目の数字 (340) はプルダウンメニューにおける位置を示します。数字が小さいほ +ど上に配置され、大きいほど下に配置されます。ファイルメニューの順位番号を以下に +示します: + + 日本語環境 英語環境 + +-------------------+ +-----------------+ + 10.310 |開く... | |Open... | + 10.320 |分割して開く... | |Split-Open... | + 10.325 |新規作成 | |New | + 10.330 |閉じる | |Close | + 10.335 |------------------ | |---------------- | + 10.340 |保存 | |Save | + 10.350 |名前を付けて保存...| |Save As... | + 10.400 |------------------ | |---------------- | + 10.410 |差分表示... | |Split Diff with | + 10.420 |パッチ結果を表示...| |Split Patched By | + 10.500 |------------------ | |---------------- | + 10.510 |印刷 | |Print | + 10.600 |------------------ | |---------------- | + 10.610 |保存して終了 | |Save-Exit | + 10.620 |終了 | |Exit | + +-------------------+ +-----------------+ + +それぞれの番号の間には少し余裕があるので、必要なら、そこにメニューを追加するこ +とができます (ただし、標準メニューに手を加えるより、新しいメニューを追加したほ +うがよいでしょう)。 +サブメニューを作るときは、さらに ".number" を追加することができます。つまり、 +{menu-item} のそれぞれの名前が順位番号を持ちます。 + + +特殊文字 +-------- + +例では、{menu-item} に "&File.&Save<Tab>:w" が指定されていました。これは重要な +ポイントです。{menu-item} は一つの単語でなければなりません。ドット、スペース、 +タブなどを使いたい場合は <> 表記 (<Space>や<Tab>など) を使うか、バックスラッ +シュ (\) でエスケープする必要があります。 > + + :menu 10.305 &File.&Do\ It\.\.\. :exit<CR> + +これは、メニュー項目の名前が "Do It..." (空白が含まれてます)、実行されるコマン +ドは ":exit<CR>" になります。 + +メニューの名前は <Tab> 文字を使って、名前の部分とヒント情報の部分を区切ること +ができます。<Tab> より後ろの部分は右寄せされて表示されます。File.Save では +"&File.&Save<Tab>:w" という名前が使われていました。これは "File.Save" という名 +前と ":w" というヒント情報です。 + + +セパレータ +---------- + +セパレータは、関連した項目をグループ化するのに使います。これは例えば "-sep-" +のように名前の最初と最後に "-" を付けることで定義できます。複数のセパレータを +使う場合はそれぞれ別の名前を付けてください。名前自体に意味はありません。 +セパレータに設定されたコマンドが実行されることはありませんが、その定義は必要で +す。":" を書いておいてください。例: > + + :amenu 20.510 Edit.-sep3- : + +============================================================================== +*42.2* メニューコマンド + +メニューはモード別に定義できます。メニュー項目は対応するモードでのみ使えます。 +":map" コマンドのバリエーションと同じようなものです: + + :menu ノーマルモード、ビジュアルモード、オペレータ待機モード + :nmenu ノーマルモード + :vmenu ビジュアルモード + :omenu オペレータ待機モード + :menu! 挿入モード、コマンドライン + :imenu 挿入モード + :cmenu コマンドラインモード + :amenu すべてのモード + +メニュー項目が再マップされないようにするには、":noremenu"、":nnoremenu"、 +":anoremenu" などを使います。 + + +:amenu の使い方 +--------------- + +":amenu" コマンドは少し特殊です。{keys} に指定した文字列はノーマルモードで実行 +するものとして扱われます。ビジュアルモードや挿入モードでメニューが使われた場合 +は、実行の前にノーマルモードに戻らなければならないので、CTRL-C や CTRL-O が挿 +入されます。例えば、次のコマンドを使うと: > +> + :amenu 90.100 Mine.Find\ Word * + +メニューのコマンドは次のように定義されます: + + ノーマルモード: * + ビジュアルモード: CTRL-C * + オペレータ待機モード: CTRL-C * + 挿入モード: CTRL-O * + コマンドラインモード: CTRL-C * + +コマンドラインモードでは、入力途中のコマンドが CTRL-C によって破棄されます。ビ +ジュアルモードとオペレータ待機モードでは、CTRL-C によってモードが停止します。 +挿入モードでは、CTRL-O を使ってコマンドを実行してから挿入モードに戻ります。 +CTRL-O は一つのコマンドに対してのみ機能します。複数のコマンドを実行したい場合 +は、それらを関数に入れて、その関数を呼んでください。例: > + + :amenu Mine.Next\ File :call <SID>NextFile()<CR> + :function <SID>NextFile() + : next + : 1/^Code + :endfunction + +このメニュー項目は、":next" で引数リストの次のファイルに移動し、"Code" で始ま +る行を検索します。 +関数名の前にある <SID> はスクリプトIDです。関数がスクリプトの中に限定されるよ +うになります。複数のスクリプトファイルで関数の名前が重複してしまう問題を避ける +ことができます。|<SID>| 参照。 + + +サイレントメニュー +------------------ + +メニューは {keys} を実際に入力したかのように実行されます。":" コマンドであれば +コマンドラインにエコーされたコマンドが表示されます。そのコマンドが長ければ、 +hit-Enter プロンプトが表示されます。そんなのはうっとうしいですよね。 +これはメニューをサイレントにすることで解決できます。それには <silent> 引数を指 +定します。例えば、上の例の NextFile() を呼び出してみます。メニューを実行する +と、コマンドラインには次のような表示がでます: + + :call <SNR>34_NextFile() ~ + +このような表示をなくすには、最初の引数として "<silent>" を指定します: > + + :amenu <silent> Mine.Next\ File :call <SID>NextFile()<CR> + +"<silent>" の使いすぎに注意してください。コマンドが短いならそれは必要ありませ +ん。誰かのためにメニューを作る場合、実行されたコマンドが表示されるようになって +いれば、マウスを使わない場合はどのように入力すればいいかのヒントになります。 + + +メニューの一覧 +-------------- + +{keys} を指定せずに menu コマンドを使うと、定義されたメニューの一覧を表示でき +ます。{menu-item} やその一部を指定することで、特定の項目だけを表示できます。 +例: > + + :amenu + +すべてのメニューが表示されます。とっても長い一覧が表示されます。メニューの名前 +を指定して短い一覧を表示したほうがいいでしょう: > + + :amenu Edit + :amenu 編集(E) + +すべてのモードの "Edit" メニューの項目だけが表示されます。挿入モードのメニュー +項目を一つだけ表示するには次のようにします: > + + :imenu Edit.Undo + :imenu 編集(E).取り消す(U) + +名前は正しく指定する必要があります。大文字と小文字は区別されます。ただし、アク +セラレータ指定のための '&' は省略できます。<Tab> と、その後に続く文字列も同様 +に省略できます。 + + +メニューの削除 +-------------- + +メニューを削除するには一覧表示と同じようなコマンドを使います。ただし、"menu" +ではなく "unmenu" を使います。":menu" は ":unmenu" になり、":nmenu" は +":nunmenu" になります。挿入モードの "Tools.Make" を削除するには次のようにしま +す: > + + :iunmenu Tools.Make + :iunmenu ツール(T).メイク(M) + +メニューの名前を指定すると、その中の項目もすべて削除されます。例: > + + :aunmenu Syntax + :aunmenu シンタックス(S) + +シンタックスメニューとその中の項目がすべて削除されます。 + +============================================================================== +*42.3* その他いろいろ + +'guioptions' のフラグを設定することでメニューの表示を変更できます。初期設定で +は以下の "M" 以外のすべてのフラグが設定されています。フラグは次のようなコマン +ドで外すことができます: > + + :set guioptions-=m +< + m 外すとメニューバーが非表示になります。 + + M 追加すると標準メニューがロードされなくなります。 + + g 外すと非アクティブなメニュー項目は灰色表示にはならず非 + 表示になります。(そうならないシステムもあります。) + + t 外すとティアオフ機能が無効になります。 + +メニューの一番上に表示される点線はセパレータではありません。その項目を選択する +と、メニューは "ティアオフ(切り離し)"、つまり別ウィンドウで表示されます。これ +をティアオフメニューと呼びます。同じメニュー項目を頻繁に使う場合に便利です。 + +メニュー項目の翻訳については |:menutrans| を参照してください。 + +メニューはマウスで選択するものなので、":browse" コマンドを使って、ファイルを選 +択できるようにすると便利です。また、":confirm" を使って、エラーメッセージの代 +わりにダイアログを表示するのもいいでしょう (例えばカレントバッファに変更がある +状態で何かをする場合など)。この二つのコマンドは同時に使用できます: > + + :amenu File.Open :browse confirm edit<CR> + +":browse" を使うと、開くファイルを選択するためのファイルブラウザーが表示されま +す。":confirm" を使うと、カレントバッファに変更があった場合にポップアップダイ +アログが表示され、それを保存するか、破棄するか、コマンドをキャンセルするかを選 +択できます。 +confirm() 関数や inputdialog() 関数を使ってもっと複雑な処理をすることもできま +す。標準メニューにいくつか例があります。 + +============================================================================== +*42.4* ツールバーとポップアップメニュー + +特殊なメニューが二つあります。ToolBar (ツールバー) と PopUp (ポップアップ) で +す。これらの名前で始まるメニュー項目はメニューバーに表示されません。 + + +ツールバー +---------- + +ツールバーは 'guioptions' オプションに "T" フラグが含まれている場合のみ表示さ +れます。 +ツールバーではテキストの代わりにアイコンが表示されます。例えば、"ToolBar.New" +という {menu-item} はツールバーの "New" アイコンとして表示されます。 +Vim には 28 個のアイコンが組み込まれています。その一覧は |builtin-tools| にあ +ります。ほとんどのアイコンは標準ツールバーで使われています。それらの項目の動作 +は変更可能です (標準メニューの初期化後に変更できます)。 +標準アイコン以外の画像を使ったり、新しい項目を追加することもできます。例えば、 +次のコマンドで新しい項目を追加できます: > + + :tmenu ToolBar.Compile Compile the current file + :amenu ToolBar.Compile :!cc %:S -o %:r:S<CR> + +アイコンは別途作成する必要があります。MS-Windows では "Compile.bmp" という名前 +の bitmap 形式の画像を使います。Unix では "Compile.xpm" という名前の XPM 形式 +の画像を使います。サイズは 18x18 ドットにしてください。MS-Windows では他のサイ +ズでも構いませんが、きれいには表示されません。 +画像は、'runtimepath' の "bitmaps" ディレクトリに入れてください。例えば、Unix +なら "~/.vim/bitmaps/Compile.xpm" などです。 + +ツールバーの各項目にはツールチップを設定できます。ツールチップとは、機能を説明 +するための短いテキストです。例えば "ファイルを開く" といったものです。項目の上 +にマウスポインタを置いてしばらく待つと表示されます。画像だけではどのような機能 +かわからない場合に便利です。 +例: > + + :tmenu ToolBar.Make Run make in the current directory +< + Note: + 大文字/小文字に注意してください。"Toolbar" と "toolbar" はどちらも + "ToolBar" とは区別されます。 + +ツールチップを削除するには |:tunmenu| コマンドを使います。 + +'toolbar' オプションを設定すると、画像の代わりに文字列を表示したり、文字列と画 +像の両方を表示したりできます。テキストの表示は場所を取るので、ほとんどの人は画 +像だけを表示しています。 + + +ポップアップメニュー +-------------------- + +ポップアップメニューはマウスポインタのある場所に表示されるメニューです。 +MS-Windows ではマウスの右クリックで表示し、左クリックで項目を選択します。Unix +では右ボタンを押したままにして使います。 +ポップアップメニューは 'mousemodel' が "popup" か "popup_setpos" のどちらかに +設定されている場合にだけ表示されます。両者の違いは、"popup_setpos" ならマウス +ポインタの場所にカーソルが移動するという点です。選択中のテキストをクリックした +場合はその選択範囲は変更されずにそのまま使われます。テキストの選択中に他の場所 +をクリックした場合は選択が解除されます。 +ポップアップメニューはモード別になっています。普通のメニューのように、他のモー +ドの項目が灰色表示されるということはありません。 + +生命、宇宙、その他もろもろの答えは? *42* +この問の真意を知っていた唯一の人物、ダグラス・アダムズは残念ながら他界しまし +た。それで死の答えはなんなんだろう... + +============================================================================== + +次章: |usr_43.txt| ファイルタイプを使う + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_43.jax b/plugins/vimdoc-ja/doc/usr_43.jax new file mode 100644 index 0000000000..999ab546ae --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_43.jax @@ -0,0 +1,177 @@ +*usr_43.txt* For Vim バージョン 8.0. Last change: 2015 Oct 23 + + VIM USER MANUAL - by Bram Moolenaar + + ファイルタイプを使う + + +C プログラムやシェルスクリプトなどの特定の種類のファイルを編集するときに、よく +使うオプション設定やマップがあると思います。それを毎回手作業で設定するのは面倒 +ですよね。この章ではそれを自動化する方法を説明します。 + +|43.1| ファイルタイププラグイン +|43.2| ファイルタイプを追加する + +次章: |usr_44.txt| 構文ファイルを作成する +前章: |usr_42.txt| 新しいメニューを追加する +目次: |usr_toc.txt| + +============================================================================== +*43.1* ファイルタイププラグイン *filetype-plugin* + +ファイルタイププラグインの使用方法については既に |add-filetype-plugin| で説明 +しました。しかし、標準では最小限の設定しかされないので、それだけでは物足りない +と思います。例えば C ファイルを開いたときに、'softtabstop' オプションを 4 に設 +定したり、三行コメントを挿入するためのマップを定義したりすると便利かもしれませ +ん。2 ステップで設定できます。 + + *your-runtime-dir* +1. 自分のランタイムディレクトリを作成する。Unix なら普通は "~/.vim" です。その + ディレクトリの中に "ftplugin" ディレクトリを作成します: > + + mkdir ~/.vim + mkdir ~/.vim/ftplugin +< + Unix 以外のシステムでは、'runtimepath' オプションを見て、"ftplugin" ディレ + クトリが検索される場所を確認してください: > + + set runtimepath + +< 普通は最初のディレクトリ (最初のコンマの前) を使います。初期設定以外のディ + レクトリを使いたい場合は、|vimrc| ファイルの中で 'runtimepath' オプションを + 設定してディレクトリを追加してください。 + +2. "~/.vim/ftplugin/c.vim" を作成して設定を書きます: > + + setlocal softtabstop=4 + noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc> + let b:undo_ftplugin = "setl softtabstop< | unmap <buffer> <LocalLeader>c" + +そして、C ファイルを開いてみてください。'softtabstop' オプションが 4 に設定さ +れていますね。しかし、他のファイルを開くと初期設定の 0 にリセットされます。そ +れは ":setlocal" コマンドが使われているからです。このコマンドはバッファの +'softtabstop' オプションだけを設定します。他のバッファを開くと、開いたバッファ +用の設定が使用されます。新しいバッファの設定には、初期設定、または最後に +":set" コマンドで設定された値が使われます。 + +同様に、"\c" マップも他のバッファを開くと見えなくなります。":map <buffer>" コ +マンドを使うと、カレントバッファの中だけで使えるマップを作成できます。これは +":map!" や ":vmap" などの他のマップコマンドでも同様です。マップの中の +|<LocalLeader>| は "maplocalleader" 変数の値で置き換えられます。 + +b:undo_ftplugin を設定する行はファイルタイプを別の値に設定されていたときのため +に用います。このケースではあなたが望む方法でundoしたいでしょう。 +b:undo_ftplugin 変数はコマンドとして実行されます。そのため中の文字は、バック +スラッシュのように特別な意味を持つものがあるので、気をつけてください。 + +ファイルタイププラグインの例はこのディレクトリで探すことができます: > + + $VIMRUNTIME/ftplugin/ + +ファイルタイププラグインの作成方法の詳細は |write-plugin| を参照してください。 + +============================================================================== +*43.2* ファイルタイプを追加する + +Vim がファイルタイプを認識しない場合は、設定を追加してください。まず自分用のラ +ンタイムディレクトリを用意する必要があります。上述の |your-runtime-dir| を参照 +してください。 + +"filetype.vim" というファイルを作成してファイルタイプ用の自動コマンドを設定し +ます。(自動コマンドは |40.3| で説明されています。) 例: > + + augroup filetypedetect + au BufNewFile,BufRead *.xyz setf xyz + augroup END + +ファイル名が ".xyz" で終わるすべてのファイルが "xyz" ファイルタイプとして認識 +されるようになります。":augroup" コマンドを使って自動コマンドを +"filetypedetect" グループに置いています。こうすることで、ファイルタイプを認識 +するための自動コマンドを ":filetype off" で削除できるようになります。"setf" コ +マンドは 'filetype' を指定されたタイプに設定します。ただし、設定済みの場合は変 +更しません。これによってファイルタイプが二重に設定されないようになっています。 + +ファイル名にマッチするパターンはいろいろなものが使えます。ディレクトリ名を含め +ることもできます。|autocmd-patterns| 参照。例えば、"/usr/share/scripts" にある +ファイルが拡張子に関係なくすべて "ruby" ファイルであるなら、次のような設定を追 +加します: > + + augroup filetypedetect + au BufNewFile,BufRead *.xyz setf xyz + au BufNewFile,BufRead /usr/share/scripts/* setf ruby + augroup END + +しかし、/usr/share/scripts/README.txt を開いたとき、それは ruby ファイルではあ +りえませんよね。"*" で終わるパターンの問題は、多くのファイルにマッチしすぎてし +まうことです。この問題を避けるには、'runtimepath' の最後に指定されたディレクト +リに "filetype.vim" を置きます。例えば Unix なら "~/.vim/after/filetype.vim" +などです。 +では、~/.vim/filetype.vim にテキストファイルの検出を設定します: > + + augroup filetypedetect + au BufNewFile,BufRead *.txt setf text + augroup END + +このファイルは 'runtimepath' の最初に見つかります。そして、最後に見つかるファ +イル "~/.vim/after/filetype.vim" の中で次の設定をします: > + + augroup filetypedetect + au BufNewFile,BufRead /usr/share/scripts/* setf ruby + augroup END + +処理の流れは次のようになります。Vim は 'runtimepath' の各ディレクトリから +"filetype.vim" を探します。最初に "~/.vim/filetype.vim" が見つかります。*.txt +を処理する自動コマンドがここで定義されます。次に Vim は $VIMRUNTIME にある +filetype.vim を見つけます ($VIMRUNTIME は 'runtimepath' の中程にあります)。最 +後に ~/.vim/after/filetype.vim が見つかり、/usr/share/scripts の ruby ファイル +を認識するための自動コマンドが追加されます。 +/usr/share/scripts/README.txt を開くと、定義された順番で自動コマンドがチェック +されます。*.txt というパターンがマッチするので、"setf text" が実行され、ファイ +ルタイプが "text" に設定されます。ruby 用のパターンもマッチするので、"setf +ruby" が実行されます。しかし、'filetype' は既に設定されているので何も起こりま +せん。 +/usr/share/scripts/foobar を開くと、同様に自動コマンドがチェックされます。ruby +のパターンだけがマッチするので、"setf ruby" が実行され、'filetype' が ruby に +設定されます。 + + +内容を見て判断する +------------------ + +ファイル名からはファイル種別を判断できなくても、内容で判断できる場合がありま +す。例えば、多くのスクリプトファイルは次のような行で始まります: + + #!/bin/xyz ~ + +このスクリプトを認識するには、"scripts.vim" というファイルをランタイムディレク +トリに作ります (filetype.vim と同じ場所です)。中身は次のようになります: > + + if did_filetype() + finish + endif + if getline(1) =~ '^#!.*[/\\]xyz\>' + setf xyz + endif + +最初に did_filetype() を使って、既にファイル名からファイルタイプが認識されてい +るかどうかを確認し、不要ならファイル内容のチェックを実行しないようにします。こ +れは、"setf" コマンドが意味をなさないときに、ファイルのチェックによって時間を +無駄に消費しないためです。 +scripts.vim は標準ファイルの filetype.vim で定義された自動コマンドによって読み +込まれます。そのため、次の順番でチェックが実行されます: + + 1. 'runtimepath' の $VIMRUNTIME の前にある filetype.vim + 2. $VIMRUNTIME/filetype.vim の前半部分 + 3. 'runtimepath' のすべての scripts.vim + 4. $VIMRUNTIME/filetype.vim の後半部分 + 5. 'runtimepath' の $VIMRUNTIME の後にある filetype.vim + +もっと複雑なことがしたい場合は、すべてのファイルにマッチする自動コマンドを追加 +して、スクリプトを読み込むなり関数を実行するなりしてファイルの内容をチェックし +てください。 + +============================================================================== + +次章: |usr_44.txt| 構文ファイルを作成する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_44.jax b/plugins/vimdoc-ja/doc/usr_44.jax new file mode 100644 index 0000000000..4b694e0f92 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_44.jax @@ -0,0 +1,712 @@ +*usr_44.txt* For Vim バージョン 8.0. Last change: 2008 Dec 28 + + VIM USER MANUAL - by Bram Moolenaar + + 構文ファイルを作成する + + +Vim は 200 種類以上ものファイルを強調表示できます。強調表示されないファイルを +見つけた場合は、本章を読んで、ファイルを強調表示する方法を調べてください。リ +ファレンスマニュアルの |:syn-define| も参照してください。 + +|44.1| 基本的な syntax コマンド +|44.2| キーワード +|44.3| マッチ +|44.4| リージョン +|44.5| 構文アイテムを入れ子にする +|44.6| グループの並び +|44.7| その他の引数 +|44.8| クラスタ +|44.9| 他の構文ファイルをインクルードする +|44.10| シンクロナイズ +|44.11| 構文ファイルをインストールする +|44.12| ポータブルな文法定義ファイル + +次章: |usr_45.txt| 言語を選択する +前章: |usr_43.txt| ファイルタイプを使う +目次: |usr_toc.txt| + +============================================================================== +*44.1* 基本的な syntax コマンド + +既存の構文ファイルを土台にすることで多くの時間を節約できます。望みのものに近い +言語の構文ファイルを $VIMRUNTIME/syntax から探してください。それらのファイルを +見れば、構文ファイルの基本的な構造がわかると思います。内容を理解するには本章を +読んでください。 + +基本的なことから説明します。構文定義を開始する前に、古い定義をクリアする必要が +あります: > + + :syntax clear + +最終的な構文ファイルではこのコマンドは必要ありませんが、いろいろと試したいとき +には便利です。 + +本章の説明はかなり簡略化されています。構文ファイルを書いて、それを他人に使って +もらう場合は、本章を最後まで読んで詳細を理解してください。 + + +定義された構文アイテムを一覧表示する +------------------------------------ + +現在定義されている構文アイテムを表示するには、次のコマンドを使います: > + + :syntax + +実際に定義されている構文アイテムを確認することができます。新しい構文ファイルを +作っていて、いろいろと試しているときに便利です。また、それぞれの構文アイテム +は、実際の表示と同じ色で表示されるので、何がどうなっているかも確認できます。 +特定の構文グループのアイテムを一覧表示するには次のようにします: > + + :syntax list {group-name} + +これはクラスタ (|44.8|参照) を一覧表示することもできます。その場合は名前に @ +を付けてください。 + + +大文字と小文字の区別 +-------------------- + +Pascal などの言語は大文字と小文字を区別しません。C などの言語は大文字と小文字 +を区別します。次のコマンドで区別するかしないかを指定できます: > + :syntax case match (大文字/小文字を区別する) + :syntax case ignore (大文字/小文字を区別しない) + +"match" を指定すると大文字と小文字は区別されます。その場合、"int" と "Int" と +"INT" はそれぞれ違うものになります。"ignore" を指定した場合は、"Procedure" と +"PROCEDURE" と "procedure" は同じ扱いになります。 +":syntax case" コマンドは構文ファイルのどこにでも書くことができ、それ移行の構 +文定義に作用します。ほとんどの場合、":syntax case" コマンドは構文ファイルに一 +つだけ書きますが、大文字と小文字を区別する要素と区別しない要素を両方もつような +特殊な言語の場合には、ファイルのいたるところで ":syntax case" コマンドを書くこ +ともできます。 + +============================================================================== +*44.2* キーワード + +最も基本的な構文要素はキーワードです。次のように定義します: > + + :syntax keyword {group} {keyword} ... + +{group} は構文グループの名前です。":highlight" コマンドを使うことで {group} に +色を割り当てることができます。{keyword} は実際のキーワードです。いくつか例を示 +します: > + + :syntax keyword xType int long char + :syntax keyword xStatement if then else endif + +"xType" と "xStatement" がグループ名です。習慣的に、グループ名の先頭にはファイ +ルタイプ名が付けられます。この例では x 言語 (そういう言語があるのではなく単に +eXample の x) の構文を定義しています。例えば "csh" スクリプト用の構文ファイル +なら "cshType" という名前になります。つまり、'filetype' の値と同じものを先頭に +付けます。 +この例では "int" と "long" と "char" が同じ方法で強調表示され、"if" と "then" +と "else" と "endif" が別の同じ方法で強調表示されます。次に、x グループ名と +Vim の標準名を関連付ける必要があります。次のようにします: > + + :highlight link xType Type + :highlight link xStatement Statement + +"xType" を "Type" で強調表示し、"xStatement" を "Statement" で強調表示します。 +標準名については |group-name| を参照してください。 + + +特殊なキーワード +---------------- + +キーワードとして使われる文字は 'iskeyword' オプションに指定されていなければな +りません。それ以外の文字を使った場合、その単語は決してマッチしません。Vim はそ +のことについて警告メッセージを出しません。 +例題の x 言語は '-' 文字をキーワードとして使えます。それは次のように設定しま +す: > + + :setlocal iskeyword+=- + :syntax keyword xStatement when-not + +":setlocal" コマンドを使って、カレントバッファだけ 'iskeyword' を変更していま +す。この設定によって "w" や "*" などのコマンドの動作も変更されます。動作を変更 +したくない場合は、キーワードではなくマッチを使ってください(次節で説明します)。 + +x 言語では短縮形も使えます。例えば、"next" は "n"、"ne"、"nex" に短縮できま +す。次のコマンドでそれを定義できます: > +> + :syntax keyword xStatement n[ext] + +これは "nextone" にはマッチしません。キーワードは常に単語全体にのみマッチしま +す。 + +============================================================================== +*44.3* マッチ + +もう少し複雑なものを定義してみましょう。普通の識別子にマッチさせるため、マッチ +構文アイテムを定義します。次の例は、すべての文字が小文字の単語にマッチします: +> + :syntax match xIdentifier /\<\l\+\>/ +< + Note: + キーワードは他の構文アイテムより優先されます。"if" や "then" などの + キーワード (上述の ":syntax keyword" コマンドで定義したもの) は、 + xIdentifier にもマッチしますが、キーワードとして扱われます。 + +最後の部分はパターンです。これは検索で使用するものと同じです。// を使ってパ +ターンを囲みます (":substitute" コマンドと同じ)。+ や " など、他の文字を使うこ +ともできます。 + +次はコメント用のマッチを定義してみます。x 言語では "#" から行末までがコメント +になります: > + + :syntax match xComment /#.*/ + +すべての検索パターンが使えるので、マッチを使うことで非常に複雑なものを強調表示 +できます。検索パターンについては |pattern| を参照してください。 + +============================================================================== +*44.4* リージョン + +例題の x 言語では、文字列をダブルクォートで囲みます。文字列を強調表示するため +にリージョン (領域) を定義します。それにはリージョンの開始 (ダブルクォート) と +リージョンの終了 (ダブルクォート) が必要です。定義は次のようになります: > + + :syntax region xString start=/"/ end=/"/ + +"start" と "end" に指定したパターンは、リージョンの開始と終了を探すために使用 +されます。しかし次のような文字列があったらどうなるでしょうか? + + "A string with a double quote (\") in it" ~ + +これはうまくいきません。文字列の途中のダブルクォートによってリージョンが終了し +てしまいます。文字列中のエスケープされたダブルクォートをスキップするように指定 +する必要があります。それには "skip" キーワードを使います: > + + :syntax region xString start=/"/ skip=/\\"/ end=/"/ + +検索パターンの中ではバックスラッシュが特殊な文字として使われるので、連続した二 +つのバックスラッシュが一つのバックスラッシュにマッチします。 + +マッチではなくリージョンを使うのはどんな場面でしょうか?主な違いは、マッチは一 +つのパターンであり、そのパターン全体がマッチするということです。リージョンは +"start" パターンがマッチするとすぐに開始されます。"end" パターンが見つかるかど +うかは関係ありません。つまり、構文アイテムが "end" パターンにマッチすることに +依存している場合はリージョンは使えません。それが大丈夫なら、リージョンを定義す +る方が簡単な場合が多々あります。また、次の節でも述べるように、構文アイテムを入 +れ子にする場合もリージョンが適しています。 + +============================================================================== +*44.5* 構文アイテムを入れ子にする + +次のようなコメントがあります: + + %Get input TODO: Skip white space ~ + +コメントを青色で強調表示し、その中の TODO を黄色の大きな字で強調表示してみま +しょう。それには、次のような構文グループを定義します: > + + :syntax keyword xTodo TODO contained + :syntax match xComment /%.*/ contains=xTodo + +一行目の "contained" 引数は、そのキーワードが他の構文アイテムの中にのみ出現す +ることを示しています。二行目の "contains=xTodo" は、その構文アイテムの中に +xTodo が出現することを示しています。結果、コメント全体は "xComment" にマッチし +て青色になり、その中の TODO は xTodo にマッチして黄色になります (xTodo に対す +る強調表示が設定してあるなら)。 + + +入れ子の再帰 +------------ + +x 言語では波カッコでコードブロックを表現します。コードブロックの中にはさらに別 +のコードブロックを入れることができます。これは次のように定義できます: > + + :syntax region xBlock start=/{/ end=/}/ contains=xBlock + +例えば、次のようなテキストがあった場合: + + while i < b { ~ + if a { ~ + b = c; ~ + } ~ + } ~ + +まず、一行目の { で一つ目の xBlock が開始します。二行目には別の { があります。 +そこは xBlock の中で、xBlock は自身を含むことができるので、二つ目の xBlock が +開始します。したがって、"b = c" の行は第二レベルの xBlock リージョンの中という +ことになります。次の行には } があり、これはリージョンの末尾を示すパターンに +マッチするので、これによって二つ目の xBlock が閉じます。この } は二つ目の +xBlock リージョンの中の文字なので、一つ目の xBlock リージョンからは隠されま +す。そして、最後の } によって一つ目の xBlock リージョンが閉じます。 + + +末尾をキープする +---------------- + +次の二つの構文アイテムを見てみましょう: > + + :syntax region xComment start=/%/ end=/$/ contained + :syntax region xPreProc start=/#/ end=/$/ contains=xComment + +% から行末までをコメントとして定義し、# から行末までをプリプロセッサー指令とし +て定義しています。プリプロセッサー行にはコメントを入れることができるので、プリ +プロセッサーの定義には "contains=xComment" 引数が指定されています。では、次の +ようなテキストで何が起こるか見てみましょう: + + #define X = Y % Comment text ~ + int foo = 1; ~ + +このテキストは、二行目も xPreProc として強調表示されます。プリプロセッサー指令 +は行末で終わるものであり、そのために "end=/$/" と指定しました。何が間違っていた +のでしょうか? +問題は内包されたコメントにあります。コメントは % で始まり、行末で終わります。 +コメントが終わるとプリプロセッサー構文に戻りますが、それは行末が処理された後な +ので、次の行も含まれてしまうのです。 +この問題を回避し、内包された構文が改行を消費しないようにするには、"keepend" 引 +数を使います。これで、行末への二重マッチに対応できます: > + + :syntax region xComment start=/%/ end=/$/ contained + :syntax region xPreProc start=/#/ end=/$/ contains=xComment keepend + + +複数アイテムの内包 +------------------ + +"contains=" 引数には「すべての構文アイテム」を指定することができます。例: > + + :syntax region xList start=/\[/ end=/\]/ contains=ALL + +xList にはすべての構文アイテムが内包されます。「すべて」は自分自身を含みます +が、同じ位置のものは除外されます (無限ループを避けるため)。 +一部のグループだけを除外するような指定もできます。つまり、指定したグループ以外 +のグループを内包できます: > + + :syntax region xList start=/\[/ end=/\]/ contains=ALLBUT,xString + +"TOP" を指定すると、"contained" 引数を持たないすべてのアイテムが対象になりま +す。"CONTAINED" を指定すると、"contained" 引数を持つアイテムだけが対象になりま +す。詳しくは |:syn-contains| を参照してください。 + +============================================================================== +*44.6* グループの並び + +x 言語には次のような形式のステートメントがあります: + + if (condition) then ~ + +この三つのアイテムを別々に強調表示します。ただし、"(condition)" と "then" は他 +の場所にも出現し、そこでは別の方法で強調表示されることもあります。次のように定 +義します: > + + :syntax match xIf /if/ nextgroup=xIfCondition skipwhite + :syntax match xIfCondition /([^)]*)/ contained nextgroup=xThen skipwhite + :syntax match xThen /then/ contained + +"nextgroup" 引数で、次に来るアイテムを指定します。これは (マッチするための) 必 +須条件にはなりません。指定されたアイテムが見つからなかった場合は何も起こりませ +ん。例えば、次のテキストの場合: + + if not (condition) then ~ + +"if" は xIf にマッチします。"not" は nextgroup に指定された xIfCondition に +マッチしません。したがって、"if" だけが強調表示されます。 + +"skipwhite" 引数を指定すると、次のアイテムとの間に空白 (スペースとタブ) をはさ +むことができます。同様に、"skipnl" を指定すれば、次のアイテムとの間に改行をは +さむことができ、"skipempty" を指定すれば、空行をはさむことができます。ただし、 +"skipnl" は空行をスキップしないので注意してください。改行の後で何かにマッチす +る必要があります。 + +============================================================================== +*44.7* その他の引数 + +MATCHGROUP +---------- + +リージョンは、リージョン全体が同じグループで強調表示されます。例えば、() で囲 +まれたテキストを xInside グループで強調表示するため、次のように定義します: > + + :syntax region xInside start=/(/ end=/)/ + +このときに、カッコだけを別の方法で強調表示することを考えます。複雑な方法を使っ +て定義することもできますが、"matchgroup" 引数を使う方法もあります。 +"matchgroup" を指定すると、リージョンの start と end の部分を別の強調グループ +で表示できます (この例では xParen): > + + :syntax region xInside matchgroup=xParen start=/(/ end=/)/ + +"matchgroup" 引数は、その引数より後ろに指定された start と end に対して適用さ +れます。上の例では start と end の両方が xParen で強調表示されます。end を +xParenEnd で強調表示する場合は次のようにします: > + + :syntax region xInside matchgroup=xParen start=/(/ + \ matchgroup=xParenEnd end=/)/ + +"matchgroup" を使うと、内包されたアイテムが start と end の部分にマッチしなく +なります。次の "transparent" の例題ではそれを利用しています。 + + +TRANSPARENT (透過) +------------------ + +例えば C 言語のファイルで、"while" の後の () と、"for" の後の () を別の方法で +強調表示してみます。両方とも () を入れ子にできて、それが外側の () と同じ方法で +強調表示されるようにします。() の強調表示は ) がマッチしたところでストップしま +す。それには、例えば次のようにします: > + + :syntax region cWhile matchgroup=cWhile start=/while\s*(/ end=/)/ + \ contains=cCondNest + :syntax region cFor matchgroup=cFor start=/for\s*(/ end=/)/ + \ contains=cCondNest + :syntax region cCondNest start=/(/ end=/)/ contained transparent + +cWhile と cFor には別の強調表示が使われます。cCondNest は両方に出現し、自身を +内包しているアイテムと同じ強調グループで強調表示されます。"transparent" 引数に +よってこのような動作になります。 +この例では、"matchgroup" 引数に自分自身のグループを指定しています。その理由 +は、matchgroup を使うことで、内包されたアイテムが start の部分にマッチしないと +いう副作用が発生するからです。それを利用して cCondNest グループが "while" や +"for" の直後の ( にマッチしないようにしています。もし直後の ( にマッチしてしま +うと、cCondNest は ) までのすべてのテキストにマッチしてしまい、その後ろから +リージョンが再開することになってしまいます。matchgroup を指定することで、 +cCondNest は start の後、つまり最初の ( より後でマッチするようになります。 + + +オフセット +---------- + +"if" の後ろにある ( と ) の間のテキストをリージョンとして定義します。ただし、 +"if" と () 自体はリージョンに含めたくありません。そのような場合はオフセットを +使います。例: > + + :syntax region xCond start=/if\s*(/ms=e+1 end=/)/me=s-1 + +start パターンには "ms=e+1" というオフセットが指定されています。"ms" は Match +Start という意味です。マッチの開始位置のオフセットを設定できます。通常は、パ +ターンがマッチした場所がマッチの開始位置になります。"e+1" はパターンがマッチし +たテキストの末尾からさらに一つ進んだ場所を示します。 +end パターンには "me=s-1" というオフセットが指定されています。"me" は Match +End という意味です。"s-1" はパターンにマッチしたテキストの先頭から一つ戻った場 +所を示します。例えば、次のテキストでは: + + if (foo == bar) ~ + +"foo == bar" の部分だけが xCond で強調表示されます。 + +オフセットの詳細については |:syn-pattern-offset| を参照してください。 + + +ONELINE +------- + +"oneline" 引数は、リージョンが複数行にまたがらないことを示します。例: > + + :syntax region xIfThen start=/if/ end=/then/ oneline + +これは "if" で始まって "then" で終わるリージョンを定義しています。ただし、 +"if" と "then" が同じ行にない場合はマッチしません。 + + Note: + "oneline" を使用した場合、end パターンが同じ行でマッチしない限り、リー + ジョンは開始されません。"oneline" がない場合は、end パターンがマッチす + る場所があるかどうかはチェックされません。その場合、たとえ end パター + ンにマッチする場所がなくても、リージョンは開始されます。 + + +行の継続と継続の回避 +-------------------- + +さて、少し複雑になってきました。次はプリプロセッサー行を定義してみます。プリプ +ロセッサー行は行頭の # で始まり、行末まで続きます。行末が \ で終っていた場合は、 +次の行まで継続します。それには、継続パターンにマッチする構文アイテムを内包する +ように指定します: > + + :syntax region xPreProc start=/^#/ end=/$/ contains=xLineContinue + :syntax match xLineContinue "\\$" contained + +通常は xPreProc は単一行にマッチしますが、内包された xLineContinue によって次 +の行まで継続するようになります。例えば、次のテキストは二行ともマッチします: + + #define SPAM spam spam spam \ ~ + bacon and spam ~ + +これは期待した動作ですね。あるいは、内包されたパターンに "excludenl" を指定す +ることによって、リージョンを単一行に収めることもできます。例えば、xPreProc の +中で、行末に "end" があったときに、それを強調表示したいような場合に使います。 +xPreProc が (xLineContinueのときのように) 次の行に継続しないようにするには、次 +のように "excludenl" を使います: > + + :syntax region xPreProc start=/^#/ end=/$/ + \ contains=xLineContinue,xPreProcEnd + :syntax match xPreProcEnd excludenl /end$/ contained + :syntax match xLineContinue "\\$" contained + +"excludenl" はパターン指定の前に置いてください。"xLineContinue" には +"excludenl" が指定されていないので、最初の例と同様、マッチすることによって +xPreProc リージョンが拡張されます。 + +============================================================================== +*44.8* クラスタ + +構文ファイルを書いてみると、実にたくさんの構文グループを作成するということに気 +づくと思います。必要なら、クラスタと呼ばれるものを定義して複数の構文グループを +ひとまとめにすることができます。 +例えば、for ループ、if 文、while ループ、関数、などを持った言語があります。そ +れぞれは数値や識別子など、同じ構文要素を含むことができます。それを次のように定 +義してみます: > + + :syntax match xFor /^for.*/ contains=xNumber,xIdent + :syntax match xIf /^if.*/ contains=xNumber,xIdent + :syntax match xWhile /^while.*/ contains=xNumber,xIdent + +同じ "contains=" を何度も書かなければなりません。内包されるアイテムを追加する +ときは、その変更を三回繰り返すことになります。クラスタを使って複数の構文グルー +プをひとまとめにすることで、このような指定が簡単になります。 +上の三つのグループが内包している二つのアイテムをクラスタとして定義するには、次 +のコマンドを使います: > + + :syntax cluster xState contains=xNumber,xIdent + +クラスタは他の構文アイテムの中で使われます。使い方は普通の構文アイテムと同じで +す。名前の先頭に @ を付けてください。例の三つの構文アイテムは次のように定義で +きます: > + + :syntax match xFor /^for.*/ contains=@xState + :syntax match xIf /^if.*/ contains=@xState + :syntax match xWhile /^while.*/ contains=@xState + +クラスタに構文グループを追加するには "add" 引数を使います: > + + :syntax cluster xState add=xString + +クラスタから構文グループを取り除くこともできます: > + + :syntax cluster xState remove=xNumber + +============================================================================== +*44.9* 他の構文ファイルをインクルードする + +C++ 言語の構文は C 言語のスーパーセットです。構文ファイルを二つも書くのは避け +たいので、次のコマンドを使って、C++ 構文ファイルの中で C 構文ファイルを読み込 +みます: > + + :runtime! syntax/c.vim + +":runtime!" コマンドは 'runtimepath' の中からすべての "syntax/c.vim" を探しま +す。そして、C ファイルを開いたときと同様に、C++ における C の部分の構文が定義 +されます。c.vim 構文ファイルを入れ替えていたり、拡張ファイルで構文アイテムを追 +加していたりする場合は、それらも読み込まれます。 +C の構文アイテムをロードしたら、C++ 特有の構文アイテムを定義します。例えば、C +にはないキーワードを定義します: > + + :syntax keyword cppStatement new delete this friend using + +コマンドの動作は普通の構文ファイルのときと同じです。 + +次に、Perl 言語を考えてみましょう。Perl スクリプトは二つの異なる部分で構成され +ます。一つは POD 形式のドキュメントセクション、もう一つは Perl で書かれたプロ +グラムです。POD セクションは "=head" で始まり "=cut" で終わります。 +POD 構文の定義を一つのファイルに書き、Perl 構文ファイルの中からそれを使いま +す。":syntax include" コマンドで構文ファイルを読み込むと、その中で定義されてい +る要素がクラスタに格納されます。Perl の場合、次のようなコマンドを使います: > + + :syntax include @Pod <sfile>:p:h/pod.vim + :syntax region perlPOD start=/^=head/ end=/^=cut/ contains=@Pod + +Perl ファイルの中で "=head" が見つかると perlPOD リージョンが開始します。 +perlPOD リージョンは @Pod クラスタを内包しています。リージョンの中では、 +pod.vim 構文ファイルで定義されたトップレベルの構文アイテムがマッチします。 +"=cut" が見つかるとリージョンは終了し、Perl ファイルの構文アイテムに戻ります。 +":syntax include" コマンドで読み込まれたファイル内の ":syntax clear" コマンド +は適切に無視されます。さらに、"contains=ALL" のような引数は同じファイルの構文 +アイテムだけが対象になります。呼び出し元の構文アイテムは対象になりません。 +"<sfile>:p:h/" の部分は、カレントファイル名 (<sfile>) をフルパス (:p) に展開 +し、その head (先端) (:h) を取り出しています。展開結果はファイルのディレクトリ +名になります。つまり、同じディレクトリの pod.vim がインクルードされます。 + +============================================================================== +*44.10* シンクロナイズ (構文解析の同期) + +例えばコンパイラなら話は簡単です。ファイルの先頭から開始して、順番に構文解析し +ていくだけです。しかし Vim では、ユーザーが編集している場所、つまりファイルの +途中から構文解析が開始されます。どのようにして適切な開始位置を決めているので +しょうか。 +秘密は ":syntax sync" コマンドにあります。このコマンドを使って、構文解析の開始 +位置を指定します。例えば、次のコマンドを使うと、C スタイルコメントの開始位置、 +あるいは終了位置が後方検索され、その場所から構文ハイライトが開始されます: > + + :syntax sync ccomment + +引数を指定して動作を調整できます。"minlines" 引数には、後方検索で戻る最小の行 +数を指定します。"maxlines" 引数には、検索される行数の上限を指定します。 +例えば、画面の一番上に表示されている行から、最低でも 10 行前まで調べるようにす +るには、次のようにします: > + + :syntax sync ccomment minlines=10 maxlines=500 + +最小の範囲内で見つからなかった場合は、適切な場所が見つかるまで、さらに戻って調 +べます。ただし、500 行以上は戻りません。 ("maxlines" を大きくすると処理速度が +遅くなります。小さ過ぎるとシンクロナイズに失敗してしまいます。) +シンクロナイズは、スキップ可能な構文アイテムを指定することで、少し高速になりま +す。テキストを実際に表示するときだけ必要な構文アイテムを定義するときに +"display" 引数を指定してください。 +デフォルトでは、検索されたコメントは Comment 構文グループで強調表示されます。 +他の方法で強調表示したい場合は、使用したい構文グループを指定してください: > + + :syntax sync ccomment xAltComment + +プログラミング言語が C スタイルコメントを持っていない場合は、他の方法でシンク +ロナイズします。最も簡単なのは、戻る行数を指定して、その場所から構文解析を試す +方法です。例えば、150 行前に戻って、そこから構文解析を開始するには、次のように +します: > + + :syntax sync minlines=150 + +"minlines" に大きな値を指定すると Vim の動作が遅くなります (特に上方にスクロー +ルする場合など)。 +検索対象になる構文グループを指定することもできます: > + + :syntax sync match {sync-group-name} + \ grouphere {group-name} {pattern} + +{group-name} という構文グループが {pattern} にマッチした場所のすぐ後から開始す +るということを定義します。{sync-group-name} はシンクロナイズ定義の名前です。例 +えば、sh スクリプトでは if 文を "if" で開始し、"fi" で閉じます: + + if [ --f file.txt ] ; then ~ + echo "File exists" ~ + fi ~ + +この構文に対して "grouphere" を定義すると、次のようになります: > + + :syntax sync match shIfSync grouphere shIf "\<if\>" + +"groupthere" 引数を使ってグループの終端を示すパターンを指定します。例えば、 +if/fi グループの終端は次のように定義できます: > + + :syntax sync match shIfSync groupthere NONE "\<fi\>" + +この例では、NONE を指定して、パターンにマッチした場所が特定のリージョンの中で +はないこと、つまりは if ブロックの中ではないことを指定しています。 + +"grouphere" 引数と "groupthere" 引数を指定しないで、マッチやリージョンを定義す +ることもできます。そのようなグループはシンクロナイズのときにスキップされます。 +例えば、次のように定義すると、{} で囲まれた範囲がスキップされます (他のシンク +ロナイズメソッドにマッチする場合でも): > + + :syntax sync match xSpecial /{.*}/ + +シンクロナイズの詳細はリファレンスマニュアルの|:syn-sync|を参照してください。 + +============================================================================== +*44.11* 構文ファイルをインストールする + +新しい構文ファイルを使用する準備ができたら、それを 'runtimepath' の "syntax" +ディレクトリにコピーしてください。Unix なら "~/.vim/syntax" です。 +構文ファイルの名前はファイルタイプ名に ".vim" を付けた名前にします。したがっ +て、x 言語ならファイルのフルパスは次のようになります: + + ~/.vim/syntax/x.vim ~ + +さらに、ファイルタイプが認識されるように設定する必要があります。|43.2| 参照。 + +構文ファイルがうまく動作したら、それを他の Vim ユーザーが利用できるようにして +あげるといいでしょう。まず次のセクションを読んで、構文ファイルが他の環境でも動 +作するようにしてください。そして、Vim のメンテナー <maintainer@vim.org> にメー +ルを送ってください。ファイルタイプの認識方法の説明もお願いします。よほどのこと +がない限り、Vim のバージョンアップに合わせて取り込まれます。 + + +既存の構文ファイルを拡張する +---------------------------- + +上記は、完全に新しい構文ファイルを作成する場合の説明です。既存の構文ファイルを +使っていて、それに足りない構文アイテムがあるような場合には、それとは別のファイ +ルを使って構文アイテムを追加することができます。ファイルを別にすることで、Vim +をバージョンアップしたときに変更が失われてしまうのを防止します。 +syntax コマンドを自分のファイルに書きます。できる限り既存の構文グループの名前 +を使ってください。例えば、C 構文ファイルに新しい変数タイプを追加するには、次の +ように書きます: > + + :syntax keyword cType off_t uint + +これを、元の構文ファイルと同じ名前で保存します。この場合なら "c.vim" です。そ +のファイルを 'runtimepath' の最後の方にあるディレクトリに置きます。そうするこ +とで、元の構文ファイルよりも後に読み込ませます。Unix なら次の場所に保存します: + + ~/.vim/after/syntax/c.vim ~ + +============================================================================== +*44.12* ポータブルな構文ファイル + +すべての Vim ユーザーが構文ファイルを共有できれば素晴らしいと思いませんか?そ +のためには、構文ファイルはいくつかのガイドラインに従っている必要があります。 + +ファイルの先頭にヘッダーを書いてください。構文ファイルの用途、メンテナー、最終 +更新日を書きます。詳細な変更履歴は必要ありません(ほとんどの人はそれを読みませ +ん)。 +例: > + + " Vim syntax file + " Language: C + " Maintainer: Bram Moolenaar <Bram@vim.org> + " Last Change: 2001 Jun 18 + " Remark: Included by the C++ syntax. + +他の構文ファイルと同じレイアウトを使ってください。既存の構文ファイルを参考にす +ると時間を節約できます。 + +構文ファイルには分かりやすい名前を付けます。小文字と数字だけを使ってください。 +名前は多くの場所で使うので長くなり過ぎないようにします (構文ファイルの名前 +("name.vim")、'filetype'、b:current_syntax、構文グループの接頭辞 (nameType、 +nameStatement、nameString、etc) などで使います)。 + +最初に "b:current_syntax" をチェックします。これが定義済みなら、他の構文ファイ +ルが 'runtimepath' の前の方でロードされたということです: > + + if exists("b:current_syntax") + finish + endif + +Vim 5.8 との互換性が必要なら次のようにします: > + + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + +ファイルの最後で "b:current_syntax" に構文の名前を設定します。ファイルをインク +ルードしている場合、そのファイルの中でも "b:current_syntax" が設定されるので注 +意してください。複数のファイルをインクルードする場合には、"b:current_syntax" +をリセットする必要があるかもしれません。 + +構文ファイルが Vim 5.x でも動作するようにするには、v:version をチェックする必 +要があります。実例は yacc.vim を参照してください。 + +ユーザー設定を変更しないでください。'tabstop' や 'expandtab' などの設定を変更 +してはいけません。そのような設定はファイルタイププラグインの仕事です。 + +マップや短縮入力を定義しないでください。'iskeyword' だけは、キーワードの識別に +どうしても必要なら、設定しても構いません。 + +ユーザーが好みの色を選択できるように、強調表示されるグループの名前に標準とは違 +う名前を付けます。そして、それらを標準の強調グループにリンクします。そうすれば +どのカラースキームでも適切に強調表示できます。標準以外の強調グループを使ってし +まうと、カラースキームによっては正しく強調表示されません。また、ユーザーの環境 +によって背景色が違ったり、色数が 8 色しかない場合もあるので覚えておいてくださ +い。 + +強調グループをリンクするには "hi def link" を使います。そうすることで、ユー +ザーはあなたの構文ファイルがロードされる前の段階で他の強調グループを選択できま +す。例: > + + hi def link nameString String + hi def link nameNumber Number + hi def link nameCommand Statement + ... etc ... + +シンクロナイズで使用しない構文アイテムには "display" 引数を付けてください。上 +方向へのスクロールや CTRL-L の動作が早くなります。 + +============================================================================== + +次章: |usr_45.txt| 言語を選択する + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_45.jax b/plugins/vimdoc-ja/doc/usr_45.jax new file mode 100644 index 0000000000..d506edf738 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_45.jax @@ -0,0 +1,413 @@ +*usr_45.txt* For Vim バージョン 8.0. Last change: 2008 Nov 15 + + VIM USER MANUAL - by Bram Moolenaar + + 言語を選択する + + +Vim のメッセージは言語を変更できます。本章では、言語を変更する方法を説明しま +す。様々な言語で書かれたファイルを取り扱う方法も説明します。 + +|45.1| メッセージの言語 +|45.2| メニューの言語 +|45.3| 他のエンコーディングを使う +|45.4| 異なるエンコーディングのファイルを編集する +|45.5| 言語のテキストを入力する + +次章: |usr_90.txt| Vim のインストール +前章: |usr_44.txt| 構文ファイルを作成する +目次: |usr_toc.txt| + +============================================================================== +*45.1* メッセージの言語 + +Vim を起動すると、あなたが使っている言語を知るために環境がチェックされます。ほ +とんどの場合、この処理はうまく動作します。そして、メッセージはあなたの言語で表 +示されます (それが利用可能なら)。現在の言語を確認するには、次のコマンドを使い +ます: > + + :language + +"C" と表示された場合は、デフォルト (英語) が使われています。 + + Note: + 異なる言語を扱えるのは、Vim のコンパイル時にその機能が有効にされた場合 + だけです。機能の有無は、":version" コマンドを実行し、"+gettext" と + "+multi_lang" の表示を確認してください。それが表示されていれば問題あり + ません。"-gettext" か "-multi_lang" と表示された場合は他の Vim を探し + てください。 + +異なる言語でメッセージを表示する方法はいくつかあります。どの方法を使うかはシス +テムによって違います。 +一つ目は、Vim を起動する前に使用したい言語を環境変数に設定する方法です。Unix +の場合の例: > + + env LANG=de_DE.ISO_8859-1 vim + +この方法は、指定した言語がシステムでサポートされている場合のみ使えます。この方 +法の利点は、GUI や何かのライブラリのメッセージも適切な言語で表示されることで +す。欠点は、Vim を起動する前に環境変数を設定しなければならないことです。Vim の +実行中に言語を変更したい場合は、二つ目の方法を使います: > + + :language fr_FR.ISO_8859-1 + +この方法では言語の名前をいくつか試すことになるかもしれません。システムでサポー +トされていない名前を使うとエラーメッセージが表示されます。翻訳されたメッセージ +が利用可能でない場合はエラーメッセージは表示されません。Vim は静かに英語を選択 +します。 +利用可能な言語の一覧を調べるには、その一覧が入っているディレクトリを探してくだ +さい。私のシステムでは "/usr/share/locale" にあります。"/usr/lib/locale" に +入っているシステムもあります。"setlocale" のマニュアルページにディレクトリの場 +所を示すヒントがあるかもしれません。 +言語の名前は正確に入力してください。大文字と小文字の違いは重要です。"-" と "_" +は間違えやすいので注意してください。 + +メッセージ、編集するテキスト、時間の書式など、それぞれに別の言語を設定できま +す。|:language| 参照。 + + +自分でメッセージを翻訳する +-------------------------- + +あなたの言語の翻訳メッセージが用意されていない場合、自分で翻訳することもできま +す。それには、Vim のソースコードと GNU gettext パッケージを入手してください。 +ソースを展開すると、src/po/README.txt に説明が入っています。 +翻訳作業はそれほど難しくありません。プログラマでなくても大丈夫です。しかし当然 +ですが、英語と翻訳先の言語を両方知っている必要はあります。 +納得のいく翻訳ができたら、それを他の人にも提供してもらえないでしょうか。 +vim-online (http://vim.sf.net) にアップロードするか、Vim のメンテナー +<maintainer@vim.org> にメールを送ってください。両方でも構いません。 + +============================================================================== +*45.2* メニューの言語 + +デフォルトのメニューは英語です。メニューが翻訳されていれば、あなたの国の言語で +表示することができます。メッセージと同様、環境が設定してあれば、自動的に適切な +言語が選択されます。そのために何かを設定する必要はありません。メニューが翻訳さ +れていれば動作します。 +例えば、ドイツに住んでいてドイツ語を使っているにも関わらず、"Datei" ではなく +"File" と表示したい場合、次のコマンドでメニューを英語に戻すことができます: > + + :set langmenu=none + +特定の言語を選択することもできます: > + + :set langmenu=nl_NL.ISO_8859-1 + +前述したように、"-" と "_" の違いは重要です。ただし、この場合は大文字と小文字 +の違いは無視されます。 +'langmenu' オプションはメニューがロードされる前に設定する必要があります。メ +ニューが定義された後では、単に 'langmenu' を設定しただけでは何も変更されませ +ん。ですから、'langmenu' は vimrc ファイルの中で設定してください。 +どうしても Vim の実行中にメニューの言語を変更したい場合は、次の手順を実行して +ください: > + + :source $VIMRUNTIME/delmenu.vim + :set langmenu=de_DE.ISO_8859-1 + :source $VIMRUNTIME/menu.vim + +ただし、ユーザーが自分で定義したメニューは失われてしまうので、それらを再定義す +る必要があります。 + + +自分でメニューを翻訳する +------------------------ + +利用可能な翻訳済みメニューは、次のディレクトリにあります: + + $VIMRUNTIME/lang ~ + +ファイルは menu_{language}.vim という名前になっています。使用したい言語がない +場合は自分で翻訳することもできます。最も簡単なのは、既存のファイルをコピーし +て、それを変更する方法です。 +まず、あなたの言語の名前を ":language" コマンドで確認してください。その名前を +使います。ただし、すべてを小文字にします。そして、ファイルを自分のランタイム +ディレクトリにコピーします ('runtimepath' の早めに見つかるように)。例えば、 +Unix なら次のようにします: > + + :!cp $VIMRUNTIME/lang/menu_ko_kr.euckr.vim ~/.vim/lang/menu_nl_be.iso_8859-1.vim + +"$VIMRUNTIME/lang/README.txt" には翻訳のヒントが書かれています。 + +============================================================================== +*45.3* 他のエンコーディングを使う + +ファイルを開くとき、そのファイルはユーザーの言語のエンコーディングで保存されて +いるものと推測されます。多くのヨーロッパ系言語では "latin1" が使われます。その +場合、1 バイトで 1 文字を表すので、合計 256 個の文字を扱えます。アジア系言語の +場合はそれでは足りません。それらの言語はダブルバイトエンコーディングを使って、 +1 万以上の文字を扱います。それでも、複数の言語を混在させるには十分ではありませ +ん。そういうときは Unicode の出番です。Unicode は一般的に使われている言語の文 +字をすべて網羅しています。Unicode は "他のすべてのエンコーディングに取って代わ +るスーパーエンコーディング" なのです。しかしまだ広くは普及していません。 +Vim はこのような三種類のエンコーディングをサポートしています。そして、多少の制 +限はありますが、使用している言語とは違う言語のテキストを扱うことができます。 +とはいえ、自分の言語のテキストだけを扱う場合は、Vim は何も設定しなくても適切に +動作します。以下の説明は、他の言語のテキストを編集したい場合にだけ必要です。 + + Note: + 他のエンコーディングを使うには、Vim のコンパイル時にその機能を有効にし + ておく必要があります。有効かどうかは、":version" コマンドの出力を見て + "+multi_byte" の表示を確認してください。表示されていれば有効です。 + "-multi_byte" と表示されている場合は他の Vim を探してください。 + + +GUI で Unicode を使う +--------------------- + +Unicode には他のエンコーディングと相互に変換しても情報が欠落しないという長所が +あります。Vim の内部で Unicode を使うように設定すれば、あらゆるエンコーディン +グのファイルを編集することができます。 +残念ながら、Unicode をサポートしているシステムはまだ限られています。言語のエン +コーディングが Unicode になっていることはまれです。その場合、Unicode の使用を +宣言し、非 Unicode システムと協調方法を設定する必要があります。 +まずは、(Unicode文字を表示可能な) GUI 版の Vim を設定します。次のようにします: +> + :set encoding=utf-8 + :set guifont=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 + +'encoding' オプションに使用したいエンコーディングを設定します。これは、バッ +ファ (編集中のファイル) のテキスト、レジスタ、Vim script ファイル、などに使わ +れます。'encoding' は Vim の内部エンコーディングであると言えます。 +この例では、設定しているフォントがシステムに存在することを前提にしています。例 +で使用されているのは X Window System のフォント名です。このフォントは Unicode +をサポートした拡張 xterm で使われるパッケージに入っています。フォントがない場 +合は、次の場所から入手できます: + + http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz ~ + +MS-Windows では、Unicode 文字を部分的に持っているフォントがいくつかあります。 +"Courier New" フォントを試してみてください。メニューの 編集/フォント設定 を使 +うと、利用可能な一覧からフォントを選択できます。使用できるのは等幅フォントのみ +です。例: > + + :set guifont=courier_new:h12 + +これがうまくいかない場合は、フォントパックを入手してください。Microsoft が場所 +を変更していなければ、次の場所にあります: + + http://www.microsoft.com/typography/fonts/default.aspx ~ + +さて、内部エンコーディングを Unicode にして、Unicode フォントでテキスト表示す +るように設定できました。しかし、入力される文字はまだ元の言語のエンコーディング +のままです。入力を Unicode に変換する必要があります。'termencoding' オプション +に入力のエンコーディングを設定します。次のように設定します: > + + :let &termencoding = &encoding + :set encoding=utf-8 + +'encoding' に utf-8 を設定する前に、元の値を 'termencoding' に代入しています。 +この設定が動作するかどうか、実際にあなたの環境で試してください。特に、アジア系 +言語の入力メソッドを使って Unicode のテキストを編集したい場合は、正しく動作す +る必要があります。 + + +Unicode 端末で Unicode を使う +----------------------------- + +Unicode をサポートしている端末がいくつかあります。XFree86 に付属の標準 xterm +もその一つです。ここではそれを使って説明します。 +まず何よりも、xterm が Unicode サポート付きでコンパイルされている必要がありま +す。|UTF8-xterm| を参照し、その確認方法と、必要ならコンパイル方法も確認してく +ださい。 +xterm に "-u8" 引数を付けて起動します。フォントを指定する必要もあるかもしれま +せん。例: > + + xterm -u8 -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 + +この端末の中で Vim を実行します。前述したように 'encoding' を "utf-8" に設定し +てください。設定は以上です。 + + +普通の端末で Unicode を使う +--------------------------- + +Unicode をサポートしていない端末で Unicode ファイルを取り扱うことができます。 +ただし、端末でサポートされていない文字は表示されません。テキストのレイアウトは +失われません: > + + :let &termencoding = &encoding + :set encoding=utf-8 + +これは GUI での設定と同じです。しかし作用は違います。Vim はテキストを表示する +ときに、端末に文字を送る前に、それを変換します。それによって、端末の文字化けを +防ぐことができます。 +これには、'termencoding' と 'encoding' の間での変換が可能である必要がありま +す。latin1 から Unicode への変換は Vim の内部で行われるので常に機能します。他 +の変換には |+iconv| 機能が必要です。 +実際に Unicode のテキストを編集してみてください。端末に表示できない文字は、ク +エスチョンマーク (あるいはアンダースコアや他の文字) として表示されます。クエス +チョンマークの上にカーソルを動かして次のコマンドを実行してください: > + + ga + +文字コード情報が表示されます。そこに実際に格納されている文字を知るヒントになり +ます。文字コードを Unicode の表から調べることもできます。時間さえあれば、実際 +にこの方法でファイルを見ることも可能です。 + + Note: + 'encoding' は Vim 内部のすべてのテキストで使われるので、設定を変更する + と 非ASCII のテキストは不正になってしまいます。レジスタの中身や + 'viminfo' ファイル (例えば記録された検索パターン) などで確認できます。 + 'encoding' は vimrc ファイルの中で設定し、それ以外では変更しないことが + 推奨されています。 + +============================================================================== +*45.4* 異なるエンコーディングのファイルを編集する + +Unicode を使うように設定された Vim で 16-bit Unicode のファイルを開く場合、実 +際には Vim の内部では utf-8 が使われているので、エンコーディングの変換が必要に +なります。文字セット (Unicode) とエンコーディング (utf-8 or 16-bit) は別ものな +のです。 +ファイルを開くとき、Vim はファイルのエンコーディングを判別しようとします。それ +には 'fileencodings' オプションが使われます。Unicode を使っているときは、その +初期設定は "ucs-bom,utf-8,latin1" です。この設定を使ってファイルのエンコーディ +ングがチェックされます: + + ucs-bom ファイルの先頭がバイトオーダーマーク (BOM) で開始する + 場合。Unicode の 16-bit、32-bit、utf-8 エンコーディン + グを判別できます。 + utf-8 utf-8 Unicode。utf-8 として不正なバイトがあった場合は + 拒否されます。 + latin1 古き良き 8-bit エンコーディング。常に有効です。 + +16-bit Unicode ファイルを開いたとき、BOM が付いていたなら、エンコーディングが +判別され、ファイルは utf-8 に変換されながら読み込まれます。'fileencoding' (末 +尾に s なし) には判別されたエンコーディングが設定されます。この場合は +"utf-16le" になります。"utf-16le" はリトルエンディアンの 16-bit Unicode を意味 +します。これは MS-Windows での一般的な形式です (例えばレジストリファイルな +ど)。 +ファイルを保存するとき、'fileencoding' と 'encoding' が比較され、それが違って +いた場合は、テキストが変換されます。 +'fileencoding' の値が空の場合は変換は実行されません。つまり、テキストは +'encoding' でエンコードするものと判断されます。 + +'fileencodings' の初期設定が良くない場合は、チェックさせたいエンコーディングを +自分で設定してください。設定の最初から順番に変換が試行されます。"latin1" を先 +頭に置くとうまく動作しません。それは "latin1" の変換が失敗することがないからで +す。例えば次の設定では、BOM がなく、utf-8 でもない場合に、Shift_JIS が使われま +す: > + + :set fileencodings=ucs-bom,utf-8,sjis + +エンコーディングの名前は |encoding-values| を参照してください。それ以外の名前 +も使えます。使用できる名前は変換ライブラリに依存します。 + + +エンコーディングを強制する +-------------------------- + +自動判別が機能しない場合は、エンコーディングを指定する必要があります。例: > + + :edit ++enc=koi8-r russian.txt + +"++enc" を使ってファイルのエンコーディングを指定します。ファイルは指定されたエ +ンコーディング (例ではロシア語) から 'encoding' に変換されます。'fileencoding' +は指定されたエンコーディングに設定されるので、保存するときには逆の変換が実行さ +れます。 +ファイルを保存するときにも同じ引数が使えます。すなわち Vim をコード変換ツール +として使うこともできます。例: > + + :write ++enc=utf-8 russian.txt +< + Note: + 変換によって一部の文字が失われることがあります。任意のエンコーディング + から Unicode に変換し、それを元に戻す場合は、不正な文字が入っていない + 限り、そのような問題はほとんどありません。多言語で書かれたファイルを + Unicode から他のエンコーディングに変換すると、情報が失われます。 + +============================================================================== +*45.5* 言語のテキストを入力する + +コンピューターのキーボードには 100 個ほどのキーしかありません。しかし、数千の +文字を持つ言語があり、Unicode には 10 万以上の文字があります。どのようにしてそ +れらの文字を入力するのでしょうか? +それほど多くの文字を必要としない場合はダイグラフが使えます。ダイグラフについて +は |24.9| で説明しました。 +キーボードのキー数よりはるかに多い文字を扱う場合はインプットメソッド (Input +Method, IM) を使います。インプットメソッドを使うには、目的の文字を入力するため +のキー操作を学ぶ必要があります。あなたがインプットメソッドを必要とするなら、そ +れはおそらくは最初からシステムに用意されています。Vim でも他のプログラムと同様 +にインプットメソッドを使うことができます。詳細は、X Window system なら +|mbyte-XIM| を、MS-Windows なら |mbyte-IME| を参照してください。 + + +キーマップ +---------- + +いくつかの言語は latin とは文字セットが異なるだけで、文字の数は同じような場合 +があります。その場合はキーを文字にマップすることができます。それにはキーマップ +を使います。 +例えば、ヘブライ語を使いたい場合は、次のようにしてキーマップをロードします: > + + :set keymap=hebrew + +キーマップファイルが検索されます。これは 'encoding' の設定に依存します。ファイ +ルが見つからなかった場合はエラーメッセージが表示されます。 + +さて、挿入モードでヘブライ語を入力できるようになりました。ただし、ノーマルモー +ドのときや、":" コマンドを入力するときは、自動的に英語に切り替わります。次のコ +マンドでヘブライ語と英語を切り替えることができます: > + + CTRL-^ + +これは挿入モードとコマンドラインモードでのみ機能します。ノーマルモードではまっ +たく別の機能です (オルタネートファイルにジャンプ)。 +キーマップの使用状態はモードメッセージに表示されます ('showmode' が設定されて +いるなら)。GUI ではカーソルの色が変わります。 +キーマップの使用状態は 'iminsert' と 'imsearch' を設定することでも変更できま +す。 + +次のコマンドでマップの一覧を表示できます: > + + :lmap + +利用可能なキーマップファイルの一覧は、GUI ならメニューの 編集/キーマップ で確 +認できます。あるいは次のコマンドで一覧を表示できます: > + + :echo globpath(&rtp, "keymap/*.vim") + + +自分でキーマップを作成する +-------------------------- + +自分でキーマップファイルを作成することができます。作成はそれほど難しくありませ +ん。目的の言語に近い既存のキーマップファイルを土台にしてください。そのファイル +を自分の "keymap" ディレクトリにコピーします。例えば、Unix なら "~/.vim/keymap" +などを使います。 +キーマップファイルの名前は次のような形式にします: + + keymap/{name}.vim ~ +もしくは + keymap/{name}_{encoding}.vim ~ + +{name} はキーマップの名前です。分かりやすい名前を付けます。既存のキーマップと +は違う名前にしてください (既存のキーマップファイルを置き換えるとき以外は)。 +{name} にはアンダースコアを含めることはできません。アンダースコアに続けてエン +コーディングを指定することができます。例: + + keymap/hebrew.vim ~ + keymap/hebrew_utf-8.vim ~ + +ファイルの内容については実物を見れば分かると思います。Vim に付属のキーマップを +見てください。詳細は |mbyte-keymap| を参照。 + + +最後の手段 +---------- + +すべての方法がダメだったとしても、CTRL-V を使えばあらゆる文字を入力できます: + + エンコード 入力方法 入力できる範囲 ~ + 8-bit CTRL-V 123 10進数の 0-255 + 8-bit CTRL-V x a1 16進数の 00-ff + 16-bit CTRL-V u 013b 16進数の 0000-ffff + 31-bit CTRL-V U 001303a4 16進数の 00000000-7fffffff + +入力するときはスペースは不要です。詳細は |i_CTRL-V_digit| を参照。 + +============================================================================== + +次章: |usr_90.txt| Vim のインストール + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_90.jax b/plugins/vimdoc-ja/doc/usr_90.jax new file mode 100644 index 0000000000..b802a9a564 --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_90.jax @@ -0,0 +1,497 @@ +*usr_90.txt* For Vim バージョン 8.0. Last change: 2008 Sep 10 + + VIM USER MANUAL - by Bram Moolenaar + + Vim のインストール + + *install* +Vim を使うにはまずインストールする必要があります。システムにも依りますが、とて +も簡単な作業です。本章では、若干のヒントと、新しいバージョンへのアップグレード +手順を説明します。 + +|90.1| Unix +|90.2| MS-Windows +|90.3| アップグレード +|90.4| よくある問題 +|90.5| アンインストール + +前章: |usr_45.txt| 言語を選択する +目次: |usr_toc.txt| + +============================================================================== +*90.1* Unix + +最初に、Vim をシステム全体で使うのか、自分一人で使うのかを決めてください。イン +ストール方法はほぼ同じですが、インストールするディレクトリが異なります。 +システムにインストールするときは、ベースディレクトリとして大抵は "/usr/local" +が使われます。ただし、これはシステムによって異なります。インストールされている +他のパッケージを参考にするなどして調べてください。 +自分一人で使う場合は、例えばホームディレクトリをベースディレクトリにします。 +ファイルはその下の "bin" や "shared/vim" などに置かれます。 + + +パッケージからインストール +-------------------------- + +Unix システムごとにコンパイル済みバイナリが用意されています。次のページにパッ +ケージへのリンクが一覧されています: + + http://www.vim.org/binaries.html ~ + +バイナリのメンテナンスはボランティアベースなので、古いままになっていることが +多々あります。自分でソースからコンパイルする方が無難です。自分でコンパイルする +ことによって組み込む機能をコントロールできるようにもなります。それが必要な場合 +はどのみちコンパイルが必要です。 + +Linux を使っている場合、"vi" はおそらく最小構成の Vim です。それには例えば構文 +強調表示などの機能はありません。そのディストリビューションから別の Vim パッ +ケージが配布されていないか、あるいは Web サイトで公開されていないか調べてみて +ください。 + + +ソースからインストール +---------------------- + +Vim をコンパイルしてインストールするには、次のものが必要です: + + - C コンパイラ (GCCが望ましい) + - GZIP プログラム (www.gnu.org から入手可能) + - Vim のソースとランタイムのアーカイブ + +Vim のアーカイブを入手するには、次のファイルを見てダウンロード速度が最も早いで +あろう近くのミラーを探してください: + + ftp://ftp.vim.org/pub/vim/MIRRORS ~ + +Vim のホームサイト ftp.vim.org で十分な速度が出るならそれでも構いません。 +"unix" ディレクトリにファイルが入っています。バージョン番号はファイル名に埋め +込まれています。特に事情がなければ最新のバージョンをダウンロードしてください。 +ファイルの入手方法は二通りあります。すべてのファイルが含まれた一つの大きなアー +カイブをダウンロードするか、フロッピーサイズの四つの小さなアーカイブをダウン +ロードします。例えば、バージョン 6.1 の大きなアーカイブは次の名前です: + + vim-6.1.tar.bz2 ~ + +このアーカイブの展開には "bzip2" が必要です。それがない場合は四つの小さなファ +イルをダウンロードしてください。それらは gzip で展開できます。Vim 6.1 なら次の +ような名前になっています: + + vim-6.1-src1.tar.gz ~ + vim-6.1-src2.tar.gz ~ + vim-6.1-rt1.tar.gz ~ + vim-6.1-rt2.tar.gz ~ + + +コンパイル +---------- + +まず作業用のディレクトリを作成します。例: > + + mkdir ~/vim + cd ~/vim + +この場所でアーカイブを展開します。大きなアーカイブを使う場合は、次のようにしま +す: > + + bzip2 -d -c path/vim-6.1.tar.bz2 | tar xf - + +"path" の部分は適当に変更してください。 > + + gzip -d path/vim-6.1-src1.tar.gz | tar xf - + gzip -d path/vim-6.1-src2.tar.gz | tar xf - + gzip -d path/vim-6.1-rt1.tar.gz | tar xf - + gzip -d path/vim-6.1-rt2.tar.gz | tar xf - + +欲しいのがデフォルトの機能だけで、環境が適切に設定されているのであれば、次のコ +マンドを実行するだけでコンパイルできます: > + + cd vim61/src + make + +make プログラムによって configure とコンパイルが実行されます。設定を変更してコ +ンパイルする方法については後で説明します。 +コンパイル中にエラーが発生した場合は、エラーメッセージをよく見てください。何が +悪かったのかを知るヒントが出ているはずです。可能ならそれを修正してください。も +しかしたら何かの機能を無効にする必要があるかもしれません。Makefile を見て自分 +のシステム特有のヒントがないか確認してください。 + + +テスト +------ + +コンパイルが正しくできたかどうか確認します: > + + make test + +Vim が期待した動作をするかどうかをテストスクリプトを使って検査します。Vim が何 +度も実行され、様々なテキストやメッセージが表示されます。最後に次のように表示さ +れたら検査は合格です: + + test results: ~ + ALL DONE ~ + +テストが失敗すると "TEST FAILURE" と表示されます。失敗メッセージが一つか二つ表 +示された場合は、Vim はとりあえず動作していますが完全ではありません。エラーメッ +セージがたくさん表示されたり、テストが最後まで完了しなかった場合は、何か問題が +あります。自分で解決するか、誰かに聞いてください。メーリングリストの過去ログ +(|maillist-archive|) に答えがあるかもしれません。どうしても解決できない場合は +Vim のメーリングリスト (|maillist|) で質問してみてください。 + + +インストール *install-home* +------------ + +ホームディレクトリにインストールする場合は、Makefile を開いて次の行を探してく +ださい: + + #prefix = $(HOME) ~ + +行頭の # を削除します。 +システムにインストールする場合は、適切なディレクトリが自動的に選択されます。自 +分でディレクトリを指定する方法は後述します。以下の作業は root で実行する必要が +あります。 + +次のコマンドで Vim をインストールします: > + + make install + +必要なファイルが適切な場所にコピーされます。Vim を起動してみて正しくインストー +ルできたかどうかを確認してください。二つの簡単なテストで、Vim がランタイムファ +イルを検出できているかどうかを確認します: > + + :help + :syntax enable + +うまく動作しない場合は、次のコマンドで、Vim がどこからランタイムファイルを探し +ているのか確認してください: > + + :echo $VIMRUNTIME + +また、Vim の起動時に "-V" 引数を付けることで、起動中に起きていることを見ること +ができます: > + + vim -V + +ユーザーマニュアルは Vim が適切に動作することを前提に書かれています。Vim のイ +ンストールが終ったら、|not-compatible| の説明に従って、Vim を適切に設定してく +ださい。 + + +機能を選択する +-------------- + +機能を選択する方法はいろいろあります。最も簡単なのは Makefile を編集する方法で +す。Makefile には多くの説明やサンプルが書かれています。大抵は行をコメントアウ +トすることで機能を有効/無効にできます。 +make とは別に "configure" を実行する方法もあります。オプションを個別に設定する +ことができます。ただし、オプションを正しく理解して、正確に指定する必要がありま +す。 +よく使われる引数を次に示します。これらは Makefile からでも有効にできます。 + + --prefix={directory} Vim をインストールするトップディレクトリ + --with-features=tiny 多くの機能を無効にしてコンパイル + --with-features=small 一部の機能を無効にしてコンパイル + --with-features=big 多くの機能を有効にしてコンパイル + --with-features=huge ほとんどの機能を有効にしてコンパイル + いつどの機能が有効になるのかは |+feature-list| + を参照してください。 + + --enable-perlinterp Perl インターフェイスを有効にする。同様に、 + ruby、python、tclなどもあります。 + + --disable-gui GUI インターフェイスをコンパイルしない。 + --without-x X-windows の機能をコンパイルしない。 + これら二つが指定された場合、Vim は X サーバー + に接続しません。起動が早くなります。 + +オプションの一覧を見るには次のようにします: > + + ./configure --help + +各機能の簡単な説明と、より詳しい情報へのリンクは |feature-list| にあります。 +冒険野郎な人は "feature.h" を開いてみてください。自分でソースコードを改造する +こともできますよ! + +============================================================================== +*90.2* MS-Windows + +Vim を Microsoft Windows にインストールする方法は二つあります。複数のアーカイ +ブを展開するか、インストーラ形式の大きなアーカイブを使います。最近のコンピュー +タを使っているほとんどのユーザーはインストーラを使います。複数のアーカイブを展 +開する方法には次のものが必要です: + + - Vim のバイナリが入ったアーカイブ + - Vim のランタイムアーカイブ + - zip ファイルを展開できるプログラム + +Vim のアーカイブを入手するには、次のファイルを見てダウンロード速度が最も早いで +あろう近くのミラーを探してください: + + ftp://ftp.vim.org/pub/vim/MIRRORS ~ + +Vim のホームサイト ftp.vim.org で十分な速度が出るならそれでも構いません。"pc" +ディレクトリにファイルが入っています。バージョン番号はファイル名に埋め込まれて +います。特に事情がなければ最新のバージョンをダウンロードしてください。ここでは +"61" (バージョン6.1) を使って説明します。 + + gvim61.exe インストーラ + +必要なのはこのファイルだけです。ファイルを実行し、表示される指示に従ってくださ +い。 + +アーカイブを自分で展開する方法の場合、使用するアーカイブを選択する必要がありま +す。次のものがあります: + + gvim61.zip 普通の MS-Windows GUI バージョン。 + gvim61ole.zip OLE サポート付きの MS-Windows GUI バージョン。 + メモリを食いますが、他の OLE アプリケーション + との通信をサポートしています。 + vim61w32.zip 32 ビット MS-Windows コンソールバージョン。 + Win NT/2000/XP コンソール用。Win 95/98 では適 + 切に動作しません。 + vim61d32.zip 32 ビット MS-DOS バージョン。 + Win 95/98 コンソール用。 + vim61d16.zip 16 ビット MS-DOS バージョン。 + 古いシステム用。ロングファイルネームはサポート + されてません。 + +必要なのはどれか一つだけです。GUI バージョンとコンソールバージョンを両方インス +トールすることもできます。いずれの場合でも、さらにランタイムファイルのアーカイ +ブをダウンロードする必要があります。 + + vim61rt.zip ランタイムファイルのアーカイブ + +zip 展開プログラムを使ってファイルを展開してください。例えば、"unzip" プログラ +ムを使う場合は次のようにします: > + + cd c:\ + unzip path\gvim61.zip + unzip path\vim61rt.zip + +この例では "c:\vim\vim61" にファイルが展開されます。既にどこかに vim という +ディレクトリがある場合は、その親ディレクトリで実行してください。 +"vim\vim61" に移動して、install プログラムを実行します: > + + install + +メッセージをよく読んでオプションを選択してください。最後に "do it" を選択する +と、それまでの選択に従ってインストールが実行されます。 +インストールプログラムはランタイムファイルを移動しません。それらは展開した場所 +にあるままです。 + +提供されているバイナリに、必要な機能が不足している場合は、自分で Vim をコンパ +イルしてみてください。ソースのアーカイブはバイナリと同じ場所にあります。対応す +る Makefile が用意されているコンパイラも必要です。Microsoft Visual C は使えま +すが高価です。Borland のコマンドラインコンパイラ 5.5 は無料で使えます。MingW +と Cygwin のコンパイラも無料です。詳しくは "src/INSTALLpc.txt" を見てください。 + +============================================================================== +*90.3* アップグレード + +既に Vim がインストールされているところに新たに Vim をインストールする方法を説 +明します。 + + +UNIX +----- + +"make install" を実行すると、ランタイムファイルはバージョンごとのディレクトリ +にコピーされます。つまり以前のバージョンは上書きされません。複数のバージョンを +同時に使うことができます。 +古いバージョンの "vim" 実行ファイルは上書きされます。古い実行ファイルが必要な +い場合は単に "make install" を実行してください。ランタイムファイルは手動で削除 +します。古いバージョンのランタイムディレクトリを削除するだけです。例: > + + rm -rf /usr/local/share/vim/vim58 + +普通はこのディレクトリ以下のファイルが変更されることはありません。しかし、例え +ば "filetype.vim" などを変更した場合は、削除する前にその変更を新バージョンの方 +にマージしてください。 + +新しいバージョンに切り替える前に試用期間を設けたい場合は、新しいバージョンを違 +う名前でインストールしてください。configure に引数を設定する必要があります。 +例: > + + ./configure --with-vim-name=vim6 + +"make install" を実行する前に "make -n install" を実行し、大事なファイルが上書 +きされないか確認してください。 +評価の結果、新しいバージョンに切り替えると決めたら、実行ファイルの名前を変更し +ます。例: > + + mv /usr/local/bin/vim6 /usr/local/bin/vim + + +MS-WINDOWS +---------- + +アップグレードは新しいバージョンをインストールするのとほぼ同じです。古いバー +ジョンと同じ場所にファイルを展開してください。新しいディレクトリ (例えば +"vim61") が作成され、その下に新しいバージョンがコピーされます。ランタイムファ +イル、vimrc、viminfo などはそのまま残ります。 +古いものをそのままにして新しいバージョンを実行したい場合は、多少の手作業が必要 +です。install プログラムを実行すると、古いバージョンのためのファイルがいくつか +上書きされてしまいます。新しいバイナリをフルパス指定で実行してください。正しい +バージョンのランタイムファイルが自動的に検出されます。ただし、$VIMRUNTIME 変数 +が定義されている場合はうまく機能しません。 +アップグレードが満足のいくものであったなら、旧バージョンのファイルを削除してく +ださい。|90.5| 参照。 + +============================================================================== +*90.4* よくある問題 + +Vim のインストール時に起こる問題と、その解決方法を説明します。インストールに関 +する質問にも答えます。 + + +Q: 私には root 権限がありません。Vim をインストールできますか? (Unix) + +次のような引数を付けて configure を実行してください。この例では $HOME/vim に +Vim がインストールされます: > + + ./configure --prefix=$HOME + +自分のディレクトリに Vim がコピーされます。エディタを実行するには $HOME/bin に +パスを通す必要があります。|install-home| も参照。 + + +Q: 私の画面では表示される色が正しくありません (Unix) + +端末の設定を確認してください。シェルの上で次のコマンドを使います: > + + echo $TERM + +表示された端末タイプが正しくない場合はそれを修正します。詳しくは |06.2| を参照 +してください。あるいは、gvim と呼ばれる GUI 版の Vim を使ってください。GUI な +ら端末を正しく設定する必要はありません。 + + +Q: Backspace キーと Delete キーが正しく動いていないようです + +キーが押されたときに送信されるコードが Backspace <BS> と Delete <Del> について +はとてもあいまいです。まず、$TERM の設定を確認してください。それが問題なけれ +ば、次の設定を試してください: > + + :set t_kb=^V<BS> + :set t_kD=^V<Del> + +一行目の ^V<BS> は CTRL-V を押してから Backspace キーを押します。二行目の +^V<Del> は CTRL-V を押してから Delete キーを押します。この二行を vimrc ファイ +ルに書いておくこともできます (|05.1|参照)。ただし、この方法は端末を変更すると +機能しなくなります。これ以外の解決方法は |:fixdel| を参照してください。 + + +Q: 私は RedHat Linux を使っています。システム付属の Vim は使えますか? + +RedHat にはデフォルトで最小構成の Vim がインストールされます。 +"Vim-enhanced-version.rpm" のような名前の RPM パッケージを探して、それをインス +トールしてください。 + + +Q: テキストを色付きで表示するには? プラグインを動かすには? + +サンプルの vimrc スクリプトを使ってください。説明は |not-compatible| にありま +す。 + +構文強調表示については第 6 章を参照してください: |usr_06.txt|。 + + +Q: 便利な vimrc ファイルの例はありますか? + +Web サイト (www.vim.org) に良い例がいくつかあります。 + + +Q: 便利な Vim プラグインはどこにありますか? + +Vim-online サイト (http://vim.sf.net) を参照してください。多くのユーザーが便利 +な Vim script やプラグインをアップロードしています。 + + +Q: 便利な Tips はどこにありますか? + +Vim-online サイト (http://vim.sf.net) を参照してください。Vim のユーザーから寄 +せられたヒントが集められています。メーリングリスト (|maillist-archive|) を検索 +するのもいいでしょう。 + +============================================================================== +*90.5* アンインストール + +Vim をアンインストールする機会はあまりないと思いますが、その方法を説明します。 + + +UNIX +----- + +Vim をパッケージからインストールした場合は、パッケージマネージャーを確認し、 +パッケージの除去方法を調べてください。 +ソースからインストールした場合は、次のコマンドでアンインストールできます: > + + make uninstall + +元のファイルを削除してしまった場合や、誰かが作ったアーカイブからインストールし +た場合は、この方法は使えません。手作業でファイルを削除してください。例えば +"/usr/local" にインストールした場合は以下のファイルを root 権限で削除します: > + + rm -rf /usr/local/share/vim/vim61 + rm /usr/local/bin/eview + rm /usr/local/bin/evim + rm /usr/local/bin/ex + rm /usr/local/bin/gview + rm /usr/local/bin/gvim + rm /usr/local/bin/gvim + rm /usr/local/bin/gvimdiff + rm /usr/local/bin/rgview + rm /usr/local/bin/rgvim + rm /usr/local/bin/rview + rm /usr/local/bin/rvim + rm /usr/local/bin/rvim + rm /usr/local/bin/view + rm /usr/local/bin/vim + rm /usr/local/bin/vimdiff + rm /usr/local/bin/vimtutor + rm /usr/local/bin/xxd + rm /usr/local/man/man1/eview.1 + rm /usr/local/man/man1/evim.1 + rm /usr/local/man/man1/ex.1 + rm /usr/local/man/man1/gview.1 + rm /usr/local/man/man1/gvim.1 + rm /usr/local/man/man1/gvimdiff.1 + rm /usr/local/man/man1/rgview.1 + rm /usr/local/man/man1/rgvim.1 + rm /usr/local/man/man1/rview.1 + rm /usr/local/man/man1/rvim.1 + rm /usr/local/man/man1/view.1 + rm /usr/local/man/man1/vim.1 + rm /usr/local/man/man1/vimdiff.1 + rm /usr/local/man/man1/vimtutor.1 + rm /usr/local/man/man1/xxd.1 + + +MS-WINDOWS +---------- + +インストーラを使ってインストールした場合は、Vim の実行ファイルと同じディレクト +リ (例: "c:\vim\vim61") にある "uninstall-gui" プログラムを実行してください。 +スタートメニューに登録した場合は、そこから起動しても構いません。それによって、 +ほとんどのファイルと、メニューと、デスクトップのショートカットが削除されます。 +いくつかのファイルは削除されずに残るかもしれませんが、それらを削除するには +Windows の再起動が必要です。 +"vim" ディレクトリをまるごと削除するという方法もあります。あなたが作成した +vimrc ファイルやランタイムファイルがそこに保存されている場合は慎重に実行してく +ださい。 + +zip アーカイブからインストールした場合は、"uninstal" プログラムを使ってくださ +い (Note:末尾の l 注意)。"install" プログラムと同じディレクトリにあります (例: +"c:\vim\vim61")。コントロールパネルの「アプリケーションの追加と削除」からも削 +除できます。 +ただし、これはレジストリの登録を削除するだけです。ファイルの削除は自分でやる必 +要があります。単に "vim\vim61" をまるごと削除します。そこにあなたが変更を加え +たファイルは保存されていないと思いますが、念のため確認してください。 +"vim" ディレクトリにあなたが作成した vimrc ファイルやランタイムファイルが入っ +ているなら、それらは残しておいた方がいいかもしれません。 + +============================================================================== + +目次: |usr_toc.txt| + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/usr_toc.jax b/plugins/vimdoc-ja/doc/usr_toc.jax new file mode 100644 index 0000000000..c42c1134ad --- /dev/null +++ b/plugins/vimdoc-ja/doc/usr_toc.jax @@ -0,0 +1,356 @@ +*usr_toc.txt* For Vim バージョン 8.0. Last change: 2016 Mar 25 + + VIM USER MANUAL - by Bram Moolenaar + + 目次 *user-manual* + +============================================================================== +大見出し一覧 ~ + +初級編 ~ +|usr_01.txt| マニュアルについて +|usr_02.txt| 初めての Vim +|usr_03.txt| カーソルの移動 +|usr_04.txt| 簡単な編集 +|usr_05.txt| 設定の変更 +|usr_06.txt| 構文強調表示 +|usr_07.txt| 複数のファイルを開く +|usr_08.txt| ウィンドウの分割 +|usr_09.txt| GUI を使う +|usr_10.txt| 大規模な編集 +|usr_11.txt| クラッシュからの復帰 +|usr_12.txt| 便利な小技 + +上級編 ~ +|usr_20.txt| コマンドラインを素早く入力する +|usr_21.txt| 中断と再開 +|usr_22.txt| ファイルを探す +|usr_23.txt| 特殊なファイルを編集する +|usr_24.txt| 素早く入力する +|usr_25.txt| テキストの整形 +|usr_26.txt| 繰り返し +|usr_27.txt| 検索コマンドと正規表現 +|usr_28.txt| 折り畳み +|usr_29.txt| プログラムの中を移動する +|usr_30.txt| プログラムの編集 +|usr_31.txt| GUI を活用する +|usr_32.txt| undo ツリー + +カスタマイズ ~ +|usr_40.txt| 新しいコマンドを作る +|usr_41.txt| Vim script 書法 +|usr_42.txt| 新しいメニューを追加する +|usr_43.txt| ファイルタイプを使う +|usr_44.txt| 構文ファイルを作成する +|usr_45.txt| 言語を選択する + +インストール ~ +|usr_90.txt| Vimのインストール + + +リファレンスマニュアル +|reference_toc| 全コマンドの詳細情報 + +シングルファイルで印刷に適した HTML 形式と PDF 形式のユーザーマニュアルが用意 +されています: + http://vimdoc.sf.net + +============================================================================== +初級編 ~ + +最初から順番に読んで基本的なコマンドを学びましょう。 + +|usr_01.txt| マニュアルについて + |01.1| 二つのマニュアル + |01.2| Vim の準備 + |01.3| チュートリアル + |01.4| 著作権 (copyright) + +|usr_02.txt| 初めての Vim + |02.1| Vim の起動方法 + |02.2| 文字の挿入 + |02.3| カーソル移動 + |02.4| 文字の削除 + |02.5| undo (取り消し) と redo (やり直し) + |02.6| 他の編集コマンド + |02.7| Vim の終了 + |02.8| ヘルプの引き方 + +|usr_03.txt| カーソルの移動 + |03.1| 単語ごとの移動 + |03.2| 行頭、行末への移動 + |03.3| 文字への移動 + |03.4| カッコの対応 + |03.5| 特定の行への移動 + |03.6| 現在の場所を表示 + |03.7| スクロール + |03.8| 簡単な検索 + |03.9| 簡単なパターン検索 + |03.10| マークの使用 + +|usr_04.txt| 簡単な編集 + |04.1| オペレータとモーション + |04.2| テキストの変更 + |04.3| 変更の繰り返し + |04.4| ビジュアルモード + |04.5| テキストの移動 + |04.6| テキストのコピー + |04.7| クリップボード + |04.8| テキストオブジェクト + |04.9| 置換モード + |04.10| 終わりに + +|usr_05.txt| 設定の変更 + |05.1| vimrc ファイル + |05.2| 見本 vimrc ファイルの解説 + |05.3| 簡単なマップ + |05.4| パッケージの追加 + |05.5| プラグインの追加 + |05.6| ヘルプファイルの追加 + |05.7| オプションウィンドウ + |05.8| よく使うオプション + +|usr_06.txt| 構文強調表示 + |06.1| 構文強調表示を有効にする + |06.2| 色がつかない?変な色になる? + |06.3| 色を変える + |06.4| カラーを使う?使わない? + |06.5| カラー印刷 + |06.6| 詳しい情報 + +|usr_07.txt| 複数のファイルを開く + |07.1| 他のファイルを開く + |07.2| ファイルのリスト + |07.3| 他のファイルにジャンプする + |07.4| バックアップファイル + |07.5| 他のファイルにテキストをコピーする + |07.6| 読み込み専用モード + |07.7| ファイル名の変更 + +|usr_08.txt| ウィンドウの分割 + |08.1| ウィンドウの分割 + |08.2| ウィンドウを分割してファイルを開く + |08.3| ウィンドウのサイズ + |08.4| 縦分割 + |08.5| ウィンドウの移動 + |08.6| 全ウィンドウに対するコマンド + |08.7| vimdiff で差分を表示する + |08.8| その他 + |08.9| タブページ + +|usr_09.txt| GUIを使う + |09.1| GUI の部品 + |09.2| マウスを使う + |09.3| クリップボード + |09.4| 選択モード + +|usr_10.txt| 大規模な編集 + |10.1| 操作の記録と再実行 + |10.2| 置換 + |10.3| コマンドの範囲指定 + |10.4| global コマンド + |10.5| 矩形選択 + |10.6| ファイルの一部の保存と読み込み + |10.7| テキストの整形 + |10.8| 大文字/小文字の変換 + |10.9| 外部プログラムを使う + +|usr_11.txt| クラッシュからの復帰 + |11.1| リカバリの基本 + |11.2| スワップファイルはどこにある? + |11.3| クラッシュした? + |11.4| さらなる情報 + +|usr_12.txt| 便利な小技 + |12.1| 単語を置換する + |12.2| "Last, First" を "First Last" に変更する + |12.3| リストをソートする + |12.4| 行を逆順に並べ替える + |12.5| 単語を数える + |12.6| マニュアルを引く + |12.7| 空白を取り除く + |12.8| 単語が使われている場所を検索する + +============================================================================== +上級編 ~ + +これらの項目は好きな順番で読んでも構いません。 + +|usr_20.txt| コマンドラインを素早く入力する + |20.1| コマンドライン編集 + |20.2| コマンドライン短縮入力 + |20.3| コマンドライン補完 + |20.4| コマンドライン履歴 + |20.5| コマンドラインウィンドウ + +|usr_21.txt| 中断と再開 + |21.1| サスペンドとレジューム + |21.2| シェルコマンドの実行 + |21.3| viminfo に情報を記録する + |21.4| セッション + |21.5| ビュー + |21.6| モードライン + +|usr_22.txt| ファイルを探す + |22.1| ファイルブラウザー + |22.2| カレントディレクトリ + |22.3| ファイルを探す + |22.4| バッファリスト + +|usr_23.txt| 特殊なファイルを編集する + |23.1| DOS、Mac、Unix形式のファイル + |23.2| インターネット上のファイル + |23.3| 暗号化 + |23.4| バイナリファイル + |23.5| 圧縮ファイル + +|usr_24.txt| 素早く入力する + |24.1| 修正する + |24.2| 対応する括弧を表示する + |24.3| 補完 + |24.4| 挿入を繰り返す + |24.5| 隣の行からコピーする + |24.6| レジスタを挿入する + |24.7| 短縮形 + |24.8| 特殊な文字を入力する + |24.9| ダイグラフ (Digraph) + |24.10| ノーマルモードコマンド + +|usr_25.txt| テキストの整形 + |25.1| 行を改行する + |25.2| テキストの位置揃え + |25.3| インデントとタブ + |25.4| 長い行の扱い + |25.5| 表の編集 + +|usr_26.txt| 繰り返し + |26.1| ビジュアルモードを使って繰り返す + |26.2| 加算と減算 + |26.3| 複数のファイルを変更する + |26.4| シェルスクリプトから Vim を使う + +|usr_27.txt| 検索コマンドと正規表現 + |27.1| 大文字と小文字を区別しない + |27.2| ファイルの端で折り返す + |27.3| オフセット + |27.4| 繰り返しマッチ + |27.5| 選択肢 + |27.6| 文字範囲 + |27.7| 文字クラス + |27.8| 改行記号にマッチ + |27.9| 例 + +|usr_28.txt| 折り畳み + |28.1| 折り畳みとは + |28.2| 手動で折り畳む + |28.3| 折り畳みを使って作業する + |28.4| 折り畳みの保存と復元 + |28.5| インデントで折り畳む + |28.6| マーカーで折り畳む + |28.7| 構文で折り畳む + |28.8| スクリプトで折り畳む + |28.9| 変更のない行を折り畳む + |28.10| どれを使えばいいの? + +|usr_29.txt| プログラムの中を移動する + |29.1| タグを使う + |29.2| プレビューウィンドウ + |29.3| プログラムの中を移動する + |29.4| グローバル識別子を検索する + |29.5| ローカル識別子を検索する + +|usr_30.txt| プログラムの編集 + |30.1| コンパイル + |30.2| C 言語系インデント + |30.3| インデント設定の自動化 + |30.4| その他のインデント + |30.5| タブとスペース + |30.6| コメントの整形 + +|usr_31.txt| GUI を活用する + |31.1| ファイルブラウザー + |31.2| 操作確認 + |31.3| メニューのショートカット + |31.4| Vim ウィンドウの位置とサイズ + |31.5| その他 + +|usr_32.txt| undo ツリー + |32.1| ファイル保存時への undo + |32.2| 変更の番号付け + |32.3| ツリーを飛び回る + |32.4| タイムトラベル + +============================================================================== +カスタマイズ ~ + +Vim の動作を好きなように変更できます。 + +|usr_40.txt| 新しいコマンドを作る + |40.1| キーマッピング + |40.2| コマンドラインコマンドを定義する + |40.3| 自動コマンド + +|usr_41.txt| Vim script 書法 + |41.1| はじめに + |41.2| 変数 + |41.3| 式 + |41.4| 条件式 + |41.5| 式を実行する + |41.6| 関数を使う + |41.7| 関数を定義する + |41.8| リストと辞書 + |41.9| 例外 + |41.10| 注意事項 + |41.11| プラグインを書く + |41.12| ファイルタイププラグインを書く + |41.13| コンパイラプラグインを書く + |41.14| プラグインを書く (高速ロード版) + |41.15| ライブラリスクリプトを書く + |41.16| Vim script を配布する + +|usr_42.txt| 新しいメニューの追加 + |42.1| はじめに + |42.2| メニューコマンド + |42.3| その他いろいろ + |42.4| ツールバーとポップアップメニュー + +|usr_43.txt| ファイルタイプを使う + |43.1| ファイルタイププラグイン + |43.2| ファイルタイプを追加する + +|usr_44.txt| 構文ファイルを作成する + |44.1| 基本的な syntax コマンド + |44.2| キーワード + |44.3| マッチ + |44.4| リージョン + |44.5| 構文アイテムを入れ子にする + |44.6| グループの並び + |44.7| その他の引数 + |44.8| クラスタ + |44.9| 他の構文ファイルをインクルードする + |44.10| シンクロナイズ + |44.11| 構文ファイルをインストールする + |44.12| ポータブルな文法定義ファイル + +|usr_45.txt| 言語を選択する + |45.1| メッセージの言語 + |45.2| メニューの言語 + |45.3| 他のエンコーディングを使う + |45.4| 異なるエンコーディングのファイルを編集する + |45.5| 言語のテキストを入力する + +============================================================================== +インストール ~ + +インストール方法を説明します。 + +|usr_90.txt| Vim のインストール + |90.1| Unix + |90.2| MS-Windows + |90.3| アップグレード + |90.4| よくある問題 + |90.5| アンインストール + +============================================================================== + +Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/various.jax b/plugins/vimdoc-ja/doc/various.jax new file mode 100644 index 0000000000..205c7f11bb --- /dev/null +++ b/plugins/vimdoc-ja/doc/various.jax @@ -0,0 +1,714 @@ +*various.txt* For Vim バージョン 8.0. Last change: 2016 Sep 06 + + + VIM リファレンスマニュアル by Bram Moolenaar + +様々なコマンド *various* + +1. 様々なコマンド |various-cmds| +2. less、more の代わりに Vim を使う |less| + +============================================================================== +1. 様々なコマンド *various-cmds* + + *CTRL-L* +CTRL-L 画面を消去して再描画します。すでに入力されているキーを + すべて処理してから再描画します。 + + *:redr* *:redraw* +:redr[aw][!] 画面をすぐに再描画します。! を付けたときは、画面を消去 + してから再描画します。 + スクリプトや関数を実行している途中で画面を更新するのに + 便利です。マップの実行中や、'lazyredraw' がオンに設定 + されているときでも更新できます。 + + *:redraws* *:redrawstatus* +:redraws[tatus][!] カレントウィンドウのステータスラインを再描画します。 + ! を付けたときは、すべてのステータスラインを再描画しま + す。 + 'statusline' に自動更新されない項目が含まれている場合 + に、ステータスラインを更新するのに便利です。 + + *N<Del>* +<Del> ノーマルモードで数値 (|count|) を入力しているときは、 + 数字の最後の桁を削除します。 + Note: 同じことをするのに <BS> を使いたい場合は、次の + マップを .vimrc に追加してください: > + :map CTRL-V <BS> CTRL-V <Del> +< <Del> が望みどおりに機能しない場合には|:fixdel|を参照。 +{訳注: "CTRL-V <BS>"はCTRL-Vを押してから<BS>を押す。} + +:as[cii] *ga* *:as* *:ascii* +ga カーソル位置の文字の文字コードを、10/16/8 進数で表示し + ます。カーソルが 'R' の上にあるときは次のように表示さ + れます: + <R> 82, Hex 52, Octal 122 ~ + ASCII 以外の文字がオプション 'isprint' に設定されてい + て、表示可能になっている場合には、特殊な表示形式もいっ + しょに表示されます。文字コードが 127 より大きいときに + は <M-x> という形式も表示されます。例: + <~A> <M-^A> 129, Hex 81, Octal 201 ~ + <p> <|~> <M-~> 254, Hex fe, Octal 376 ~ + (<p> には実際の特殊文字が表示されます。) + ファイル中の <Nul> 文字は内部的には <NL> として保存さ + れていますが、次のように表示されます: + <^@> 0, Hex 00, Octal 000 ~ + 合成文字も表示されます。'maxcombine' の設定は影響しま + せん。 + 覚え方: Get Ascii value (ASCIIコードを取得) + {Vi にはない} + + *g8* +g8 カーソル位置の文字のバイト列を 16 進数で表示します。エ + ンコーディングが |UTF-8| の場合のみ正しく機能します。 + 合成文字も表示されます。'maxcombine' の設定は影響しま + せん。 + 2 文字の合成文字が結合されている文字の表示例: + e0 b8 81 + e0 b8 b9 + e0 b9 89 ~ + {Vi にはない} {|+multi_byte| が有効な場合のみ利用でき + ます} + + *8g8* +8g8 カーソル以降の不正な UTF-8 バイト列を検索します。 + 次の二つの状況で機能します。 + 1. 'encoding' が 8-bit エンコーディングの場合。 + 2. 'encoding' が "utf-8" で、'fileencoding' が 8-bit + エンコーディングの場合。 + UTF-8 のファイルを開いたはずが、不正なバイト列が含まれ + ていて、別の 8-bit エンコーディングとして開かれてし + まった場合などに使ってください。 + 検索がファイル末尾に達しても、ファイル先頭に戻って検索 + を継続しません。 + Note: カーソルがすでに不正なバイト列の上にある場合は、 + カーソルは移動しません。 + {Vi にはない} {|+multi_byte| が有効な場合のみ利用でき + ます} + + *:p* *:pr* *:print* *E749* +:[range]p[rint] [flags] + 範囲 [range] の行を表示します (省略時は現在行を表示)。 + Note: テキストファイルを印刷する方法については + |:hardcopy| を参照してください。GUI を使用している場合 + は、メニューの File.Print から印刷できます。 + [flags] については |ex-flags| を参照してください。 + |:filter| コマンドを、パターンにマッチした行だけを表示 + するのに、使うことができる。 + +:[range]p[rint] {count} [flags] + [range] の開始行から {count} 行を表示します([range]を + 省略した場合は現在行から開始 |cmdline-ranges|)。 + [flags] については |ex-flags| を参照してください。 + + *:P* *:Print* +:[range]P[rint] [count] [flags] + :print と同じです。シフトキーを長く押し続けてしまう人 + のために追加されました。 + Note: ユーザーコマンドでこのコマンドを上書きできます。 + [flags] については |ex-flags| を参照してください。 + + *:l* *:list* +:[range]l[ist] [count] [flags] + :print と同じですが、表示できない文字は '^'を付けて表 + 示し、行末に $ を置きます。表示は 'listchars' オプショ + ンの設定で変更できます。 + [flags] については |ex-flags| を参照してください。 + + *:nu* *:number* +:[range]nu[mber] [count] [flags] + :print と同じですが、先頭に行番号を付加します。 + (オプション 'highlight' と 'numberwidth' も参照) + [flags] については |ex-flags| を参照してください。 + + *:#* +:[range]# [count] [flags] + :number と同じです。 + + *:#!* +:#!{anything} 無視されます。そのため、次のようにして Vim script を実 + 行することができます: > + #!vim -S + echo "this is a Vim script" + quit +< + *:z* *E144* +:{range}z[+-^.=]{count} {range}に指定した行の周辺を表示します。{range} を省略 + した場合は現在行の周辺を表示します。行の範囲をどれだけ + 表示するかは {count} に指定します。{count} を省略した + 場合、ウィンドウが一つだけなら 'scroll' オプションの + 2 倍の数が、そうでなければカレントウィンドウの高さから + 3 を引いた数が使われます。 + + {count} が指定された場合は 'window' オプションがその値 + に設定される。 + + :z は修飾マークを付加して使うこともできます。次の効果 + があります。 + + 記号 開始行 終了行 新しいカーソル位置 ~ + ---- ------ ------ ---------- + + 現在行 1画面先 1画面先 + - 1画面前 現在行 現在行 + ^ 2画面前 1画面前 1画面前 + . 半画面前 半画面先 半画面先 + = 半画面前 半画面先 現在行 + + マークを省略した場合は、"+" が使われます。マークが "=" + の場合は、現在行の周りにマイナス記号で作った線が表示さ + れます。 + +:{range}z#[+-^.=]{count} *:z#* + ":z" と同じですが、行番号も表示します。 + {Vi クローンによってはこの機能が使えないことがありま + す。引数が違う場合もあります} + + *:=* +:= [flags] 最終行の行番号を表示します。 + [flags] については |ex-flags| を参照してください。 + +:{range}= [flags] {range} で指定した範囲の最終行の行番号を表示します。た + とえば、次のコマンドは現在行の行番号を表示します。 + :.= + [flags] については |ex-flags| を参照してください。 + +:norm[al][!] {commands} *:norm* *:normal* + ノーマルモードコマンド {commands} を実行します。コマン + ドラインからノーマルモードのコマンドを実行できます。 + {commands} は、ノーマルモードで入力されたときと同じよ + うに実行されます。{commands} による変更は、一回のアン + ドゥで取り消されます。 + エラーが発生すると実行停止します。 + + [!] を付けた場合はマップは適用されません。 + 付けなかった場合、このコマンドが非再帰マップ + (|:noremap|) 内で使われたとしても、引数は再マップされ + ます。 + + {commands} は実行を完了する (ノーマルモードに戻る) 必 + 要があります。 + {commands} が完了しない場合は、最後のコマンドが<Esc> + や <C-C> で終了したのと同じように動作します。 + 挿入モードも必ず完了します (挿入モードを開始するには + |:startinsert| を参照)。":" コマンドも必ず完了します。 + "Q" や "gQ" を使って Ex モードを開始することはできませ + ん。 + + ":normal" の実行中は画面は更新されません。 + + {commands} の最初にスペースは置けません。そうしたい場 + 合はスペースの前にカウント指定の 1 (数字の 1) を置いて + ください。"1 " は 1 つのスペースになります。 + + {command} の実行ではオプション 'insertmode' は無視され + ます。 + + '|' は :normal コマンドの一部として処理されるので、こ + のコマンドの後に他のコマンドを続けて書けません。 + + :normal コマンドは 'maxmapdepth' の制限内で再帰的に呼 + び出すことができます。 + + |:execute| コマンドには Vim script の式を指定できるの + で、印字可能文字を使って制御文字を入力することもできま + す。 + + 例: > + :exe "normal \<c-w>\<c-w>" +< {Vi には、もちろんない} + +:{range}norm[al][!] {commands} *:normal-range* + {range} の各行に対してノーマルモードコマンド{commands} + を実行します。{commands} はカーソルが行頭にある状態で + 実行されます。その他は範囲指定の無い ":normal" コマン + ドと同じです。 + {Vi にはない} + + *:sh* *:shell* *E371* +:sh[ell] シェルを起動します。シェルを終了 ("exit"コマンドを実 + 行) すると Vim に戻ってきます。オプション 'shell' に設 + 定されているシェルコマンドを使います。 + *E360* + Note: Amiga では、コンパイラから QuickFix モードで Vim + が起動された場合には、コンパイラが標準入力を非対話型 + モードにしてしまうので使用できません。 + + *:!cmd* *:!* *E34* +:!{cmd} シェルで {cmd} を実行します。'shell' と 'shelltype'も + 参照。 + + {cmd} の中の '!' は以前使用した外部プログラムに置 + き換えられます ('cpoptions' も参照)。'!' の前にバック + スラッシュがある場合はバックスラッシュが削除され '!' + は置き換えられません。 + 例: ":!ls" を実行後の ":!echo !\! \\!" は "echo ls ! + \!" と解釈、実行されます。 + + {cmd} の中の '|' はシェルに渡されます。'|' を使って + Vim コマンドを続けて書くことはできません。(|:bar|参 + 照)。 + + {cmd} が "%" を含んでいたらそれは現在のファイル名に展 + 開されます。特殊文字はエスケープされないので、特殊文字 + の特殊な意味を打ち消すにはクォートを使います: > + :!ls "%" +< ファイル名が "$" を含んでいるならシングルクォートを使 + うといいでしょう (ただしシングルクォートは問題がある場 + 合もある): > + :!ls '%' +< 次の例は常に機能します。ただし長い: > + :exe "!ls " . shellescape(expand("%")) +< + {cmd} の終わりを示す改行文字 (newline) 以降の文字は、 + 次の ":" コマンドとして解釈されます。改行文字の前に + バックスラッシュがある場合は、バックスラッシュは削除さ + れ、改行文字は {cmd} の一部として解釈されます。改行文 + 字の前にバックスラッシュがいくつあっても、一つだけが削 + 除されます。 + + Unix ではシェルを非対話型モードで起動します。対話型 + モードで起動したい場合 (aliasを使いたい場合など) は、 + 'shellcmdflag' に "-ic" を設定してください。 + Win32の場合は|:!start|も参照。 + + 外部プログラムを実行した後で、開いているファイルのタイ + ムスタンプとサイズがチェックされます |timestamp|。 + + 外部プログラムはメッセージを出力するかもしれないので、 + 外部プログラムを実行した後にスクリーンが再描画されます。 + そのため、プログラムの出力を見逃してしまわないように、 + hit-enter プロンプトが表示されます。プロンプトを表示し + たくない場合は、次のようにします: > + :silent! !{cmd} +< これでスクリーンは再描画されません。外部プログラムが何 + かを出力した場合は CTRL-L や ":redraw!" で再描画できま + す。|shell-window|も参照。 + + *:!!* +:!! 最後の ":!{cmd}" を繰り返します。 + + *:ve* *:version* +:ve[rsion] エディタのバージョンを表示します。コンパイル時に + "__DATE__" が利用可能だった場合には、コンパイルされた + 日時も表示されます。利用不可だった場合は、リリースの最 + 終修正日時が表示されます。 + Vim の、どの機能が有効になっているかも表示されます。機 + 能名の前に '+' があれば、その機能は有効になっていま + す。'-' のときは無効になっています。 + 機能の有無を変えるには features.h を編集して、Vim をコ + ンパイルし直す必要があります。Vim script から機能の有 + 無を確認するには |has()| を使います。以下に、機能の概 + 要を示します。 + 行頭の文字はその機能が含まれる最小構成です: + T tiny + S small + N normal + B big + H huge + m 手動で組み込むか他の機能に依存 + (none) システム依存 + 例えば "N" と書いてあれば、その機能は + normal、big、huge バージョンの Vim に含まれます。 + + *+feature-list* + *+acl* |ACL| サポートを含む + *+ARP* Amiga のみ: ARP サポートを含む +B *+arabic* |Arabic|言語サポート +N *+autocmd* |:autocmd|, 自動コマンド実行 +m *+balloon_eval* |balloon-eval| サポート。GUI が有効で、Netbeans/Sun + Workshop (|+sun_workshop|) または |+eval| が有効な場合 + に利用できます。 +N *+browse* |:browse| コマンド +N *+builtin_terms* 幾つかの組み込み端末 |builtin-terms| +B *++builtin_terms* 全部の組み込み端末 |builtin-terms| +N *+byte_offset* 'statusline'の'o'フラグ、|go|、|:goto|をサポート +m *+channel* プロセス間通信 |channel| +N *+cindent* |'cindent'|, C言語インデント +N *+clientserver* UnixとWin32: リモート呼び出し |clientserver| + *+clipboard* |clipboard|サポート +N *+cmdline_compl* コマンドライン補完 |cmdline-completion| +N *+cmdline_hist* コマンドライン履歴 |cmdline-history| +N *+cmdline_info* |'showcmd'| と |'ruler'| +N *+comments* |'comments'| サポート +B *+conceal* "conceal" サポート。|conceal| |:syn-conceal| 他 参照。 +N *+cryptv* 暗号化サポート |encryption| +B *+cscope* |cscope| サポート +m *+cursorbind* |'cursorbind'| サポート +m *+cursorshape* |termcap-cursor-shape| サポート +m *+debug* Vim がデバッグ用にコンパイルされた +N *+dialog_gui* |:confirm| のGUIダイアログをサポート +N *+dialog_con* |:confirm| のコンソールダイアログをサポート +N *+dialog_con_gui* |:confirm| GUIとコンソールダイアログをサポート +N *+diff* |vimdiff|と'diff' +N *+digraphs* |digraphs| *E196* +m *+directx* Win32 GUI のみ: DirectX と |'renderoptions'| + *+dnd* "~レジスタ |quote_~|を使ったDnDのサポート +B *+emacs_tags* |emacs-tags| ファイル +N *+eval* 式評価 {訳注: Vim script} |eval.txt| +N *+ex_extra* 今は常にオン、かつてVimの拡張Exコマンドのためにあった +N *+extra_search* |'hlsearch'| と |'incsearch'| オプション +B *+farsi* |farsi| 言語 +N *+file_in_path* |gf|, |CTRL-W_f| と |<cfile>| +N *+find_in_path* include ファイル検索: |[I|、|:isearch|、 + |CTRL-W_CTRL-I|、|:checkpath|、その他 +N *+folding* |folding| + *+footer* |gui-footer| + *+fork* Unix のみ: |fork| シェルコマンド + *+float* 浮動小数点数サポート +N *+gettext* メッセージの翻訳 |multi-lang| + *+GUI_Athena* Unix のみ: Athena |GUI| + *+GUI_neXtaw* Unix のみ: neXtaw |GUI| + *+GUI_GTK* Unix のみ: GTK+ |GUI| + *+GUI_Motif* Unix のみ: Motif |GUI| + *+GUI_Photon* QNX のみ: Photon |GUI| +m *+hangul_input* ハングル入力サポート |hangul| + *+iconv* iconv() 関数が組み込まれている + *+iconv/dyn* |iconv-dynamic| |/dyn| と同じ +N *+insert_expand* |insert_expand| 挿入モード補完 +m *+job* job の開始と停止 |job| +N *+jumplist* |jumplist| +B *+keymap* |'keymap'| +N *+lambda* |lambda| と |closure| +B *+langmap* |'langmap'| +N *+libcall* |libcall()| +N *+linebreak* |'linebreak'|、|'breakat'| と |'showbreak'| +N *+lispindent* |'lisp'| +N *+listcmds* バッファリストや引数リストに対するVimコマンド + |buffer-hidden| |:argdelete| +N *+localmap* バッファローカルなマップのサポート |:map-local| +m *+lua* |Lua| インターフェイス +m *+lua/dyn* |Lua| インターフェイス |/dyn| +N *+menu* |:menu| +N *+mksession* |:mksession| +N *+modify_fname* |filename-modifiers| +N *+mouse* マウス操作 |mouse-using| +N *+mouseshape* |'mouseshape'| +B *+mouse_dec* Unix のみ: Dec端末マウス操作 |dec-mouse| +N *+mouse_gpm* Unix のみ: Linuxコンソールマウス操作 |gpm-mouse| +N *+mouse_jsbterm* JSB マウスサポート |jsbterm-mouse| +B *+mouse_netterm* Unix のみ: nettermマウス操作 |netterm-mouse| +N *+mouse_pterm* QNX のみ: ptermマウス操作 |qnx-terminal| +N *+mouse_sysmouse* Unix のみ: *BSD コンソールマウス操作 |sysmouse| +B *+mouse_sgr* Unix のみ: sgrマウス操作 |sgr-mouse| +N *+mouse_urxvt* Unix のみ: urxvtマウス操作 |urxvt-mouse| +N *+mouse_xterm* Unix のみ: xtermマウス操作 |xterm-mouse| +N *+multi_byte* 16ビット、32 ビット文字 |multibyte| + *+multi_byte_ime* Win32 IMEサポート +N *+multi_lang* 多言語サポート |multi-lang| +m *+mzscheme* Mzscheme インターフェイス |mzscheme| +m *+mzscheme/dyn* Mzscheme インターフェイス |mzscheme-dynamic| |/dyn| +m *+netbeans_intg* |netbeans| + *+num64* 64ビットの数値をサポート |Number| +m *+ole* Win32 GUI のみ: |ole-interface| +N *+packages* |packages| の読み込み +N *+path_extra* 'path'や'tags'での上下階の検索 +m *+perl* Perl インターフェイス |perl| +m *+perl/dyn* Perl インターフェイス |perl-dynamic| |/dyn| +N *+persistent_undo* 永続 undo |undo-persistence| + *+postscript* |:hardcopy| でPostScriptファイルの書き出し +N *+printer* |:hardcopy| コマンド +H *+profile* |:profile| コマンド +m *+python* Python 2 インターフェイス |python| +m *+python/dyn* Python 2 インターフェイス |python-dynamic| |/dyn| +m *+python3* Python 3 インターフェイス |python| +m *+python3/dyn* Python 3 インターフェイス |python-dynamic| |/dyn| +N *+quickfix* |:make| と |quickfix| コマンド +N *+reltime* |reltime()| 関数, 'hlsearch'/'incsearch' タイムアウト, + 'redrawtime' オプション +B *+rightleft* 右から左へタイプ |'rightleft'| +m *+ruby* Ruby インターフェイス |ruby| +m *+ruby/dyn* Ruby インターフェイス |ruby-dynamic| |/dyn| +N *+scrollbind* |'scrollbind'| +B *+signs* |:sign| +N *+smartindent* |'smartindent'| +N *+startuptime* |--startuptime| 引数 +N *+statusline* オプション'statusline'、'rulerformat'と、 + 'titlestring'と'iconstring'の特殊フォーマット +m *+sun_workshop* |workshop| +N *+syntax* 構文強調 |syntax| + *+system()* Unix のみ: |+fork|の反対 +T *+tag_binary* タグファイル内の高速(二分探索)検索 |tag-binary-search| +N *+tag_old_static* 静的タグの古い方法 |tag-old-static| +m *+tag_any_white* tagsファイル内で空白文字を許す |tag-any-white| +m *+tcl* Tcl インターフェイス |tcl| +m *+tcl/dyn* Tcl インターフェイス |tcl-dynamic| |/dyn| + *+terminfo* |terminfo|でtermcapを代替 +N *+termresponse* |t_RV| と |v:termresponse| のサポート +B *+termguicolors* xterm互換端末での 24 ビット色のサポート +N *+textobjects* |text-objects| 選択 + *+tgetent* 非Unix のみ: 外部termcapを使用可能 +N *+timers* |timer_start()| 関数 +N *+title* ウィンドウタイトルとアイコン設定 |'title'| |'icon'| +N *+toolbar* |gui-toolbar| +N *+user_commands* ユーザー定義コマンド |user-commands| +N *+viminfo* |'viminfo'| +N *+vertsplit* ウィンドウの垂直分割 |:vsplit| +N *+virtualedit* |'virtualedit'| +S *+visual* ビジュアルモード |Visual-mode| 7.4.200からは常に有効 +N *+visualextra* 拡張ビジュアルモードコマンド |blockwise-operators| +N *+vreplace* |gR|と|gr| +N *+wildignore* |'wildignore'| +N *+wildmenu* |'wildmenu'| +S *+windows* 複数ウィンドウ +m *+writebackup* |'writebackup'|がデフォルトで有効 +m *+xim* Xインプットメソッド |xim| + *+xfontset* Xフォントセットサポート |xfontset| + *+xpm* pixmap サポート +m *+xpm_w32* Win32 GUI のみ: pixmap サポート |w32-xpm-support| + *+xsmp* XSMP(X session management)サポート + *+xsmp_interact* 対話型XSMP(X session management)サポート +N *+xterm_clipboard* Unix のみ: xtermクリップボード操作 +m *+xterm_save* xtermのスクリーンを保存と復帰 |xterm-screens| +N *+X11* Unix のみ: ウィンドウタイトルを復帰可能 |X11| + + */dyn* *E370* *E448* + 機能が動的ライブラリを利用する場合には機能名に"/dyn" + が付加されます。 + +:ve[rsion] {nr} 現在は無視されます。これはかつて .vimrc の中でバージョ + ン番号をチェックするために使われていました。現在は + ":if" コマンドを使ってバージョン依存の振る舞いを記述で + きるので、削除されています。{Vi にはない} + + *:redi* *:redir* +:redi[r][!] > {file} コマンドの出力 (メッセージ) を {file} にリダイレクトし + ます。メッセージは、リダイレクトを終了するまで、ファイ + ルに出力されます。メッセージは画面にも表示されます。 + [!] を付けたときは、既存のファイルが上書きされます。 + [!] を省略した場合は、すでに {file} が存在していると、 + コマンドは失敗します。 + + ":redir" を同時に複数使用することはできません。 + ":redir" を実行すると、新しいリダイレクトを開始する前 + に、すでに実行されている他のリダイレクトは閉じられま + す。 + 再帰的に実行するには |execute()| を調べてください。 + + 実行中のコマンドやメッセージがスクリーンに表示されない + ようにするには、コマンドを関数の中に書き、その関数を + ":silent call Function()" と実行してください。 + このコマンドの代わりに、オプション 'verbosefile' を使 + うこともできます。":redir" と同時に使うこともできま + す。 + {Vi にはない} + +:redi[r] >> {file} メッセージを {file} にリダイレクトします。 + {file} が既に存在する場合は追記します。 {Vi にはない} + +:redi[r] @{a-zA-Z} +:redi[r] @{a-zA-Z}> メッセージをレジスタ {a-z} にリダイレクトします。レジ + スタ名が大文字 {A-Z} の場合は、そのレジスタに追記され + ます。レジスタ名の後ろの ">" は省略可能です。 + {Vi にはない} +:redi[r] @{a-z}>> メッセージをレジスタ {a-z} に追記します。{Vi にはない} + +:redi[r] @*> +:redi[r] @+> メッセージをセレクションまたはクリップボードにリダイレ + クトします。互換性のため、レジスタ名の後ろの ">" は省 + 略できます。|quotestar| と |quoteplus| を参照。 + {Vi にはない} +:redi[r] @*>> +:redi[r] @+>> メッセージをクリップボードに追記します。 + {Vi にはない} + +:redi[r] @"> メッセージを無名レジスタにリダイレクトします。互換性の + ため、レジスタ名の後ろの ">" は省略できます。 + {Vi にはない} +:redi[r] @">> メッセージを無名レジスタに追記します。{Vi にはない} + +:redi[r] => {var} メッセージを変数にリダイレクトします。変数が存在しない + 場合は、作成されます。変数がすでにある場合は、空文字列 + で初期化されます。 + リダイレクトが終了するまでは、変数は空のままです。 + 文字列変数のみ使えます。リダイレクトを開始した後で変数 + を変更したり、ロックしたり、変数タイプを変更したりする + と、それ以降のコマンドがメッセージを出力するときにエラー + が起こります。{Vi にはない} + コマンド1つの出力を取得するのには |execute()| 関数を使 + うことができます。 + +:redi[r] =>> {var} メッセージを変数に追記します。文字列変数のみ使えます。 + {Vi にはない} + +:redi[r] END メッセージのリダイレクトを終了します。 {Vi にはない} + + *:filt* *:filter* +:filt[er][!] {pat} {command} +:filt[er][!] /{pat}/ {command} + コマンドの出力を {pat} に一致する行に制限します。例と + して xml ファイルだけを一覧する場合には以下のようにし + ます: > + :filter /\.xml$/ oldfiles +< [!] を付けたときは、コマンドの出力を {pat} に一致しな + い行に制限します。 + + {pat} は Vim の検索パターンです。パターンを囲む "/" + は、{pat} 内に使われない限り、非ID文字 (|'isident'|) + で代用できます。パターンを囲む文字を省略した場合は、パ + ターンにバー文字 {訳注: "|"} を含むことはできなくなり + ます。 + + パターンは出力に部分一致でマッチするので、行全体に + マッチするパターンを指定する必要はありません。一部のコ + マンドだけがフィルタリングをサポートしているので、サ + ポートしているかどうかは実際に試してみてください。 + + 通常のメッセージだけがフィルタリングされ、エラー + メッセージはされません。 {訳注: 常に出力されます} + + *:sil* *:silent* *:silent!* +:sil[ent][!] {command} {command} を静かに実行します。メッセージは表示されず、 + メッセージ履歴にも残りません。 + [!] を付けた場合は、エラーが起きたときでもエラーメッ + セージは表示されず、コマンドやマップは中断されません。 + その場合でも |v:errmsg| はセットされます。 + [!] を付けない場合は、エラーメッセージは通常どおりに表 + 示されます。 + |:redir| によるリダイレクトは通常どおり機能します。 + |:silent| を使うとコマンドの出力をスクリーンに表示する + ことなくリダイレクトすることができます。例: > + :redir >/tmp/foobar + :silent g/Aap/p + :redir END +< ノーマルモードコマンドを静かに実行するには|:normal|コ + マンドを使用します。例えばメッセージを表示することなく + 文字列を検索するには: > + :silent exe "normal /path\<CR>" +< ":silent!" は失敗するかもしれないコマンドを実行すると + きには便利ですが、エラーが無視されてしまいます。例: > + :let v:errmsg = "" + :silent! /^begin + :if v:errmsg != "" + : ... パターンは見つかりませんでした +< ":silent" は hit-enter プロンプトも抑制します。外部プ + ログラムを実行したとき、その出力は表示されたままになっ + てしまいます。その場合は|CTRL-L|でスクリーンをきれいに + できます。 + ":silent menu ..." はコマンドをコマンドラインにエコー + しないメニューを定義できます。しかしメニューに割り当て + たコマンドのメッセージは表示されます。表示しないように + するにはそのコマンド自身に ":silent" を付けてください: + ":silent menu .... :silent command" + + *:uns* *:unsilent* +:uns[ilent] {command} {command} を静かでなく実行します。|:silent| コマンドが + 使用されているときのみ違いがでます。 + |:silent| が使われていてもメッセージを表示したいときに + 使用します。次の例では、|:silent| を使ってファイル読み + 込みに関するメッセージを抑制しつつ、|:unsilent| を使っ + て各ファイルの最初の行を表示できるようにしています: > + :silent argdo unsilent echo expand('%') . ": " . getline(1) +< + + *:verb* *:verbose* +:[count]verb[ose] {command} + 'verbose' に [count] を設定した状態で {command} を実行 + します。[count] を省略した場合は1が設定されます。 + ":0verbose" として 'verbose' をゼロにすることもできま + す。 + ":silent" と一緒に使用すると、メッセージは生成されます + が、表示はされません。 + ":silent" と ":verbose" を一緒に使用するとメッセージを + 生成して |v:statusmsg| を確認することができます。例: > + :let v:statusmsg = "" + :silent verbose runtime foobar.vim + :if v:statusmsg != "" + : " foobar.vim が見付からない + :endif +< コマンドを連続させた場合は、":verbose"は最初のコマンド + だけに適用されます: > + :4verbose set verbose | set verbose +< verbose=4 ~ + verbose=0 ~ + メッセージをログファイルに出力するには 'verbosefile' + を使ってください。 + + *:verbose-cmd* +Vim のオプション、マップ、短縮入力、ユーザー定義関数、ユーザー定義コマンド、強 +調グループ、オートコマンド、を表示するとき、'verbose' がゼロ以外だと、それが設 +定された場所も表示されます。手動で設定したときは "Last set" メッセージは表示さ +れません。関数、ユーザーコマンド、オートコマンド、を実行中に設定された場合に +は、そのコマンドを定義したスクリプトが表示されます。 +{|+eval| が有効な場合のみ利用できます} + + *K* +K カーソル位置のキーワードを調べるためのプログラムを実行 + します。プログラムの名前はオプション 'keywordprg' (kp) + で設定します (初期設定は "man")。キーワードはアルファ + ベット、数字、'iskeyword' に設定された文字から構成され + ます。 + カーソルの下、もしくは右側のキーワード使用されます。次 + のコマンドで同じことができます: > + :!{program} {keyword} +< Vim の tools ディレクトリにサンプルプログラムがありま + す。"ref" という簡易スペルチェックプログラムです。 + 特別なケース: + - 'keywordprg' が ":" で始まるならば、それは Vim の Ex + コマンドとして [count] を伴って実行されます。 + - 'keywordprg' が空の場合は、":help" コマンドが使われ + ます。検索しやすくするために 'iskeyword' に文字を追 + 加すると良いでしょう。 + - 'keywordprg' が "man" もしくは ":" で始まる場合 + は、"K" の前に入力されたカウントが "man" と + キーワードの間に挿入されます。例えば、"mkdir" に + カーソルがあって、"2K" を実行すると、結果はこのよう + になります: > + !man 2 mkdir +< - 'keywordprg' が "man -s" の場合は、"K" の前に入力さ + れたカウントは "-s" の後に挿入されます。カウントを省 + 略した場合は、"-s" は除去されます。 + {Vi にはない} + + *v_K* +{Visual}K "K" と同じですが、キーワードにはビジュアル選択されたテ + キストが使用されます。複数行を選択したときは機能しませ + ん。{Vi にはない} + +[N]gs *gs* *:sl* *:sleep* +:[N]sl[eep] [N] [m] [N] 秒間何もしません。[m] を付けると、[N] ミリ秒間ス + リープします。"gs" に指定する数値は常に秒単位です。省 + 略時は 1 秒間スリープします。 > + :sleep " 1 秒スリープ + :5sleep " 5 秒スリープ + :sleep 100m " 100 ミリ秒スリープ + 10gs " 10 秒スリープ +< CTRL-C で割り込むことができます(MS-DOSではCTRL-Break)。 + "gs" は "goto sleep" の略です。 + カーソルが表示可能な位置にある場合は、スリープしている + 間、カーソルはテキスト中に表示されます。 + {Vi にはない} + スリープ中に受信した netbeans メッセージは処理されま + す。{|+netbeans_intg| 機能つきでコンパイルされたときの + み利用可能} + + + *g_CTRL-A* +g CTRL-A MEM_PROFILING を define して Vim をコンパイルしたとき + み使えます (通常は使いません)。メモリ使用量の統計を表 + 示します。Vim をデバッグするときなどに使います。 + ビジュアルモード時のインクリメントは |v_g_CTRL-A| を参 + 照。 + +============================================================================== +2. less、more の代わりに Vim を使う *less* + +less や more ではファイルを構文強調表示できません。代わりに、Vim を使うことが +できます。それには、シェルスクリプト "$VIMRUNTIME/macros/less.sh" を使います。 + +このシェルスクリプトは Vim script "$VIMRUNTIME/macros/less.vim" を使って、 +less のコマンドをシミュレートするためのマップを設定します。less コマンド以外は +通常どおり、Vim のコマンドを使うことができます。 + +完璧に同じ動作ではありません。例えば、短いファイルを表示する場合でも、Vim はス +クリーンを占有します。しかし、ほとんどの場合は満足に機能します。それにとにか +く、構文強調表示することができます。 + +"h" キーを押すと使用できるコマンドのショートヘルプが表示されます。 + +もし less を使っていて異なるオプションを設定したい場合は vimrc に LessInitFunc +を定義します。例: > + + func LessInitFunc() + set nocursorcolumn nocursorline + endfunc +< + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/version4.jax b/plugins/vimdoc-ja/doc/version4.jax new file mode 100644 index 0000000000..e8ae1db3db --- /dev/null +++ b/plugins/vimdoc-ja/doc/version4.jax @@ -0,0 +1,367 @@ +*version4.txt* For Vim バージョン 8.0. Last change: 2006 Apr 24 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +このドキュメントは Vim 3.0 と Vim 4.0 との違いを一覧にしています。4.0 と述べて +いますが、これもまたバージョン 4.1, 4.2, などなどがあります。 + +Vim 3.0 からアップグレードしてきた人にはこのファイルは重要です。不測の問題を避 +けるために注意深く読んでおいてください。 + +'backup' オプションの初期値を変更 |backup-changed| +バックアップファイルの拡張子を変更 |backup-extension| +スワップファイルの構造を変更 |swapfile-changed| +"-w scriptout" 引数を変更 |scriptout-changed| +Backspace と Delete キーについて |backspace-delete| +| のエスケープの方法を変更 |escape-bar| +キーコードを変更 |key-codes-changed| +端末のオプションを変更 |termcap-changed| +'errorformat' オプションを変更 |errorformat-changed| +'graphic' オプションがなくなりました |graphic-option-gone| +'yankendofline' オプションがなくなりました |ye-option-gone| +'icon' と 'title' の初期値を変更 |icon-changed| +'highlight' オプションを変更 |highlight-changed| +'tildeop' と 'weirdinvert' の略記を変更 |short-name-changed| +"v", "V", "CTRL-V" をビジュアルモードで使う |use-visual-cmds| +挿入モードでの CTRL-B がなくなりました |toggle-revins| + + +'backup' オプションの初期値を変更 *backup-changed* +--------------------------------- + +'backup' オプションの初期値はいままではオンでした。この結果オリジナルのファイ +ルが上書きされた場合はバックアップファイルが常に作られることになっていました。 + +いまは 'backup' の初期値はオフになっています。ファイルへの書き込みが成功次第 +バックアップファイルは削除されます。バックアップファイルを取っておきたい場合は +'backup' オプションを vimrc でオンにしておいてください。この変更がなされた理由 +は多くの人がバックアップファイルが残ることに Vi-compatible ではない、と不満を +唱えたからです。 |'backup'| + + +バックアップファイルの拡張子を変更 *backup-extension* +---------------------------------- + +バックアップファイルの拡張子は今までは ".bak" でした。他のプログラムでもこの拡 +張子を使うものがあるのとユーザーでこの拡張子でファイルのコピーを作っておく人も +いるのでもうすこしあいまいな拡張子 "~" に変更されました。もう一つの利点はファ +イル名が短くなることで、ファイル名が短いことを要求されるようなシステムでは便利 +です。例えば、MS-DOSでは "longfile.c" と "longfile.h" のバックアップファイルは +どちらも "longfile.bak" になっていましたが、いまはこれらは "longfile.c~" と +"longfile.h~" になります。 + +もし ".bak" という拡張子の方がよいなら 'backupext' オプションで設定することが +できます。 > + :set bex=.bak |'backupext'| + + +スワップファイルの構造を変更 *swapfile-changed* +------------------------------ + +スワップファイルの内容はいくつかのパラメーターに関して拡張されました。Vim はユー +ザー名と編集されたファイルに関する情報を保持しています。これによって復元がより +簡単になり、またスワップファイルがどこで作成されたものかを知ることができるよう +になりました。現在はスワップファイルの最初の部分で異なるバイトオーダーか +sizeof(int) を持つマシンを区別することができます。そういった異なるマシン間でリ +カバーを行おうとすると、できないという旨のエラーメッセージが出ます。 + +この変更のため3.0と4.0との間のスワップファイルには互換性がありません。もし3.0 +のセッションでクラッシュしたスワップファイルがあるなら Vim 3.0 を使ってそのファ +イルをリカバーして下さい(4.0は使わないでください)。 |swap-file| + + +"-w scriptout" 引数を変更 *scriptout-changed* +------------------------- + +"vim -w scriptout" は今まではスクリプトアウトファイルに追加するのに使われてい +ました。これはあまり合理的とは言えなかったので新しいファイルを作成するように変 +更されました。ファイルが存在する場合は上書きされません(この方法で追加するのに +なれている人が今まであったファイルを破壊するのを防ぐためです。) +[後に再び削除された] |-w| + + +バックスペースとデリートキー *backspace-delete* +---------------------------- + +3.0ではデリートキーとバックスペースキーは挿入モードではどちらもバックスペース +のように機能していました。つまりカーソルの左側の文字を削除していました。4.0で +はデリートキーは新しい動作をするようになっています: コマンドラインでの動作がそ +うであるようにカーソルの下の文字を削除するのです。カーソルが行末の後に位置して +いて 'bs' オプションがセットされていると2つの行を連結します。 + |<Del>| |i_<Del>| + +3.0ではバックスペースキーは CTRL-H として定義されておりデリートキーは CTRL-? +と定義されていました。4.0ではバックスペースとデリートキーのキーコードは +termcap/termlib から読み込まれます。そして Unix では "stty erase" によって修 +正されます。このことは使っているキーボードによって削除するキーを決めている人に +とっては便利です。 + |<BS>| |i_<BS>| + +もしバックスペースとデリートキーの挿入モードでの動作が前の物がよければ次の行を +vimrc に加えてください。 + + inoremap ^? ^H + +また <BS> と <Del> キーの値を修正するのに次のものも必要かもしれません: + + set t_kb=^H + set t_kD=^? + +(^H を入力するには CTRL-V CTRL-H と入力し ^? を入力するには CTRL-V CTRL-? もし +くは <Del> と入力します。) + +もし t_kb の値が正しく t_kD の値が正しくなければ ":fixdel" コマンドを使ってく +ださい、t_kb の値によって t_kDをセットします。これは複数の異なるターミナルを +使っているときに便利です。 |:fixdel| + +^H が <BS> か <Del> のように認識されると、バックスペースのように使われます。 + + +| のエスケープの方法を変更 *escape-bar* +-------------------------- + +'cpoptions' に 'b' フラグがあると、バックスラッシュによってマッピングと略記の +中で '|' をエスケープするのにバックスラッシュを使うことはできません。CTRL-Vだ +けがエスケープさせることができ、これは Vi と同じ仕様です。もし Vi 互換モードで +Vim を使っていて "\|" をバーを含めるためにマッピングで使っている場合、"^V|"に +することが必要です。参照 |:bar| + + +キーコードを変更 *key-codes-changed* +---------------- + +キーコードの内部表現が大幅に変わりました。3.0 では1バイトコードは1つのキーを表 +すのに用いられました。このことは他の文字セットですでにこれらのコードを使ってい +た場合に問題が生じました。4.0 では3バイトコードが使われ一つの文字が混同されな +いようにしました。 |key-notation| + +もし vimrc のマッピングに1バイトコードを使っているなら4.0のコードに置き換える +必要があるでしょう。また3バイトコードを直接使う代わりに <> 表記を用いるべきで +す。下の表をご覧下さい。表には3.0のドキュメントで使われていた古い名前も載せら +れています。 + +<> の中のキーの名前はマッピングで直接使うことができます。つまりこれらの例をコ +ピー/ペーストするかその通りにタイプすることができるのです。<>表記はこの |<>| +で紹介されています。これを動作させるには 'B' と '<' フラグが 'cpoptions' の中 +にあってはいけません。|'cpoptions'| + +old name new name old code old MS-DOS code ~ + hex dec hex dec ~ +<ESC> <Esc> +<TAB> <Tab> +<LF> <NL> <NewLine> <LineFeed> +<SPACE> <Space> +<NUL> <Nul> +<BELL> <Bell> +<BS> <BS> <BackSpace> +<INSERT> <Insert> +<DEL> <Del> <Delete> +<HOME> <Home> +<END> <End> +<PAGE_UP> <PageUp> +<PAGE_DOWN> <PageDown> + +<C_UP> <Up> 0x80 128 0xb0 176 +<C_DOWN> <Down> 0x81 129 0xb1 177 +<C_LEFT> <Left> 0x82 130 0xb2 178 +<C_RIGHT> <Right> 0x83 131 0xb3 179 +<SC_UP> <S-Up> 0x84 132 0xb4 180 +<SC_DOWN> <S-Down> 0x85 133 0xb5 181 +<SC_LEFT> <S-Left> 0x86 134 0xb6 182 +<SC_RIGHT> <S-Right> 0x87 135 0xb7 183 + +<F1> <F1> 0x88 136 0xb8 184 +<F2> <F2> 0x89 137 0xb9 185 +<F3> <F3> 0x8a 138 0xba 186 +<F4> <F4> 0x8b 139 0xbb 187 +<F5> <F5> 0x8c 140 0xbc 188 +<F6> <F6> 0x8d 141 0xbd 189 +<F7> <F7> 0x8e 142 0xbe 190 +<F8> <F8> 0x8f 143 0xbf 191 +<F9> <F9> 0x90 144 0xc0 192 +<F10> <F10> 0x91 145 0xc1 193 + +<SF1> <S-F1> 0x92 146 0xc2 194 +<SF2> <S-F2> 0x93 147 0xc3 195 +<SF3> <S-F3> 0x94 148 0xc4 196 +<SF4> <S-F4> 0x95 149 0xc5 197 +<SF5> <S-F5> 0x96 150 0xc6 198 +<SF6> <S-F6> 0x97 151 0xc7 199 +<SF7> <S-F7> 0x98 152 0xc8 200 +<SF8> <S-F8> 0x99 153 0xc9 201 +<SF9> <S-F9> 0x9a 154 0xca 202 +<SF10> <S-F10> 0x9b 155 0xcb 203 + +<HELP> <Help> 0x9c 156 0xcc 204 +<UNDO> <Undo> 0x9d 157 0xcd 205 + + (not used) 0x9e 158 0xce 206 + (not used) 0x9f 159 0xcf 207 + + +端末のオプションを変更 *termcap-changed* +---------------------- + +端末のオプションの名前は、termcap でこれらのオプションに対応するエントリの名前 +に変更されました。すべての端末のオプションは t_xx という形式の名前を持ち、xx +が termcap でのエントリの名前です。termcap の設定を誤っているか不完全である場 +合か、ハイライトのオプションを他の値にセットしている場合でなければ普段はこれら +のオプションは使われません。 |terminal-options| + +いくつかのキーに関しては termcap のエントリに名前がないものがあるということに +注意してください。そう言う場合は <> 表記を代わりに使ってください、またその表記 +をする方がどっちにしろよいです。 + +"t_ti" が "t_mr" (出力を逆にする/元に戻す)に変わり、"t_ts" が "t_ti" (端末を初 +期化する)に変わっていることに注意してください。また "t_ti" を使うときは十分に +注意を払ってください。 + +old name new name meaning ~ +t_cdl t_DL 指定行数を削除 *t_cdl* +t_ci t_vi カーソルを見えなくする *t_ci* +t_cil t_AL 指定行数を挿入する *t_cil* +t_cm t_cm カーソルを移動 +t_cri t_RI カーソルを指定数右へ移動 *t_cri* +t_cv t_ve カーソルを見えるようにする *t_cv* +t_cvv t_vs カーソルを明確に見えるようにする *t_cvv* +t_dl t_dl 行を削除する +t_cs t_cs スクロールする範囲 +t_ed t_cl 画面をクリアする *t_ed* +t_el t_ce 行をクリアする *t_el* +t_il t_al 行を挿入する *t_il* + t_da スクリーンより上の描画が保存される + t_db スクリーンより下の描画が保存される +t_ke t_ke キーパッドモードから復帰 +t_ks t_ks キーパッドモードに移行 +t_ms t_ms 強調表示モードでカーソルの動きをセーブする +t_se t_se ノーマルモード(アンドゥ t_so) +t_so t_so シフトアウトモード(標準出力) +t_ti t_mr ハイライトを逆にする +t_tb t_md 太字モード *t_tb* +t_tp t_me ハイライト終わり *t_tp* +t_sr t_sr 逆にスクロールする +t_te t_te termcap モードから出る +t_ts t_ti termcap モードに移行 *t_ts_old* +t_vb t_vb ビジュアルベル +t_csc t_CS スクロール範囲相対カーソル移動モード *t_csc* + +t_ku t_ku <Up> 上矢印キー +t_kd t_kd <Down> 下矢印キー +t_kr t_kr <Right> 右矢印キー +t_kl t_kl <Left> 左矢印キー +t_sku <S-Up> シフト+上矢印キー *t_sku* +t_skd <S-Down> シフト+下矢印キー *t_skd* +t_skr t_%i <S-Right> シフト+右矢印キー *t_skr* +t_skl t_#4 <S-Left> シフト+左矢印キー *t_skl* +t_f1 t_k1 <F1> ファンクションキー1 *t_f1* +t_f2 t_k2 <F2> ファンクションキー2 *t_f2* +t_f3 t_k3 <F3> ファンクションキー3 *t_f3* +t_f4 t_k4 <F4> ファンクションキー4 *t_f4* +t_f5 t_k5 <F5> ファンクションキー5 *t_f5* +t_f6 t_k6 <F6> ファンクションキー6 *t_f6* +t_f7 t_k7 <F7> ファンクションキー7 *t_f7* +t_f8 t_k8 <F8> ファンクションキー8 *t_f8* +t_f9 t_k9 <F9> ファンクションキー9 *t_f9* +t_f10 t_k; <F10> ファンクションキー10 *t_f10* +t_sf1 <S-F1> シフト+ファンクションキー1 *t_sf1* +t_sf2 <S-F2> シフト+ファンクションキー2 *t_sf2* +t_sf3 <S-F3> シフト+ファンクションキー3 *t_sf3* +t_sf4 <S-F4> シフト+ファンクションキー4 *t_sf4* +t_sf5 <S-F5> シフト+ファンクションキー5 *t_sf5* +t_sf6 <S-F6> シフト+ファンクションキー6 *t_sf6* +t_sf7 <S-F7> シフト+ファンクションキー7 *t_sf7* +t_sf8 <S-F8> シフト+ファンクションキー8 *t_sf8* +t_sf9 <S-F9> シフト+ファンクションキー9 *t_sf9* +t_sf10 <S-F10> シフト+ファンクションキー10 *t_sf10* +t_help t_%1 <Help> ヘルプキー *t_help* +t_undo t_&8 <Undo> アンドゥキー *t_undo* + + +'errorformat' オプションを変更 *errorformat-changed* +------------------------------ + +'errorformat' がコンマで区切っていくつかのフォーマットで定義できるようになりま +した。初めにマッチしたフォーマットが使われます。初期値で多くの一般的なフォーマッ +トを認識できるように調整されました。 |errorformat| + +コンマを含むフォーマットがある場合バックスラッシュを前置する必要があります。こ +の時 :set コマンドが一つ取ってしまうのでバックスラッシュは二つ重ねてください。 + + +'graphic' オプションがなくなりました *graphic-option-gone* +------------------------------------ + +'graphic' オプションは <~> と 0xa0の文字をスクリーンに直接表示させるために使わ +れていました。いまは 'isprint' オプションがこの代わりになりますし、もっと強化さ +れています。初期の設定は同じで前に 'graphic' オプションを vimrc でセットしてい +る場合のみ気をつける必要があります。 |'isprint'| + + +'yankendofline' オプションがなくなりました *ye-option-gone* +------------------------------------------ + +'yankendofline' オプションがなくなりました。代わりに次のマッピングを使うことが +できます。 + :map Y y$ + + +'icon' と 'title' オプションの初期値を変更 *icon-changed* +------------------------------------------ + +"Thanks for flying Vim" のタイトルが残るのを避けるために、'title' オプションは +もとのタイトルを復元できる場合にのみ初期値でオンになるようになりました。 + |'title'| + +'icon' オプションの初期値は 'title' オプションのように元の値を復元できるかどう +かによるようになりました。もしアイコンのタイトルを変更するのが嫌であれば次の行 +をvimrc に加えてください。 |'icon'| + :set noicon + + +'highlight' オプションを変更 *highlight-changed* +---------------------------- + +'i' フラグは反転を意味するフラグではなく斜体のハイライトの意味になりました。今 +まで 'i' フラグが意味していた反転ハイライトには 'r' フラグが使われるようになり +ました。普通はこの変更による違いは気づかないかもしれません。というのはほとんど +の端末では斜体表示はサポートされていない上、斜体表示が使えないときは反転モード +が使われるからです。 |'highlight'| + +'highlight' オプションでセットされるアイテムのうち定義されていないアイテムは従 +来は反転モードで表示されていましたが、'highlight' でのそのアイテムのデフォルト +で設定されている値から引っ張ってきてそれが使われるようになりました。 + + +'tildeop' と 'weirdinvert' の略記名を変更 *short-name-changed* +----------------------------------------- + +'to' ('tildeop' の略記名) は 'top' に変更 |'tildeop'| +'wi' ('weirdinvert' の略記名) は 'wiv' に変更 |'weirdinvert'| + +これは Vi が 'wi' を 'window' の略記名に使っており 'to' を 'timeout' の略記名 +として使っているために変更されました。このことはこれらのオプションをセットしよ +うとした場合エラーメッセージはでないけれども動作が違ってくることになります。 + + +ビジュアルモードで "v", "V", "CTRL-V" を使う *use-visual-cmds* +-------------------------------------------- + +ビジュアルモードにおいては "v", "V", "CTRL-V" はビジュアルモードを終了させるの +に使われてきました。いまはビジュアルモードが一致するタイプにおいてのみ終了させ +るのに使われるようになりました。そうでない場合はビジュアルモードのタイプが変わ +ります。どんな状況でもビジュアルモードを何も行わずに終了させるにはESC キーを利 +用してください。 |v_V| + + +挿入モードでの CTRL-B を削除 *toggle-revins* +---------------------------------- + +いままでは CTRL-B は 'revins' オプションのオン/オフをトグルするのに使われてい +ました。このことは、この動作を知らないで誤ってCTRL-Bを押してしまった場合、どう +やってアンドゥしてよいか気づくのが困難でした。ほとんどの人はこの機能を使ってい +ないので初期値では使えないようにしました。もしこの機能を使いたいならばコンパイ +ルするときにRIGHTLEFT を feature.h で define してください。 |'revins'| + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/version8.jax b/plugins/vimdoc-ja/doc/version8.jax new file mode 100644 index 0000000000..4972b6656b --- /dev/null +++ b/plugins/vimdoc-ja/doc/version8.jax @@ -0,0 +1,14936 @@ +*version8.txt* For Vim バージョン 8.0. Last change: 2017 Mar 16 + + + VIMリファレンスマニュアル by Bram Moolenaar + + + *vim8* *vim-8* *version-8.0* *version8.0* +ようこそ Vim 8 へ! 多数のバグが修正され、いくつかの素敵な機能が追加されていま +す。このファイルは Vim 7.4 以降のすべての新規要素と既存の機能に対する変更に言 +及しています。Vim 7.4 までのパッチはここで見られます: |vim-7.4| + +あなたが使用している Vim のバージョンと機能に関する全ての情報を見るには以下の +コマンドを使用してください: > + :version + +新機能 |new-8| + Vim script の拡張 |new-vim-script-8| + さまざまな新要素 |new-items-8| + +非互換な変更 |incompatible-8| + +改善点 |improvements-8| + +コンパイル時の変更 |compile-changes-8| + +パッチ |patches-8| + + +Vi と Vim 8.0 の違いの概要については |vi_diff.txt| を参照してください。 +他のバージョンとの違いについては |version4.txt|, |version5.txt|, +|version6.txt|, |version7.txt| を参照してください。 + +============================================================================== +新機能 *new-8* + +初めに、より興味深い新機能の概要を示します。包括的な一覧は下にあります。 + + +非同期 I/O 対応、チャンネル ~ + +Vim はバックグラウンドで他のプロセスとメッセージをやり取りすることができるよう +になりました。これにより、サーバーに仕事をさせ、結果を Vim に送り返すことがで +きます。例として |channel-demo| を参照してください。これは Python サーバーと通 +信するやり方を示しています。 + +チャンネルと深く関わっているのが JSON 対応です。JSON は広くサポートされており、 +簡単にプロセス間通信に使うことができます。これにより、どんな言語でもサーバーを +書くことができます。これに使う関数は、|json_encode()| と |json_decode()| です。 + +これにより、任意の言語で書かれて、別のプロセスで動作する非常に複雑なプラグイン +を作ることができるようになります。 + + +ジョブ ~ + +Vim はジョブを開始し、それと通信し、そしてそれを停止することができるようになり +ました。これは補完や文法チェックなどのためのプロセスを走らせる際に非常に有用で +す。ジョブと通信するためにチャンネルが使われます。ジョブはまた、バッファやファ +イルから読んだり書いたりすることができます。|job_start()| を参照してください。 + + +タイマー ~ + +タイマーもまた非同期です。これは、1 回あるいは周期的に発火し、任意の仕事を行う +関数を呼ぶことができます。例えば: > + let tempTimer = timer_start(4000, 'CheckTemp') +これは 4 秒 (4000 ミリ秒) 後に CheckTemp() 関数を呼びます。|timer_start()| を +参照してください。 + + +部分適用 ~ + +Vim は既に Funcref、すなわち関数への参照を持っていました。部分適用も関数を参照 +しますが、それに加えて引数および/もしくは辞書と結びついています。これは特にチャ +ンネルやタイマーのコールバックに有用です。例えば、上のタイマーの例で、引数を関 +数に渡すには: > + let tempTimer = timer_start(4000, function('CheckTemp', ['out'])) +これは 4 秒後に CheckTemp('out') を呼び出します。 + + +ラムダとクロージャ ~ + +関数を作成する簡単な方法が追加されました: {args -> expr}。 |lambda| を参照して +ください。これは例えば `filter()` や `map()` のような関数に有用です。これらの +関数は関数引数も受け付けるようになりました。例: > + :call filter(mylist, {idx, val -> val > 20}) + +ラムダは、ラムダが定義されたスコープ内で定義されている変数を使用することができ +ます。これは通常、クロージャ (|closure|) と呼ばれます。 + +ユーザー定義関数も "closure" 引数を追加することでクロージャになることができま +す |:func-closure|。 + + +パッケージ ~ + +プラグインは成長を続け、今まで以上に多くのプラグインが使えるようになっていま +す。プラグインの集合を管理し続けることができるように、パッケージ対応が追加され +ました。これは、1 つまたは複数のプラグインを取得し、ディレクトリに格納し、そし +て更新状態を保てるようにするための便利な方法です。Vim はそれらを自動的にロード +したり、要求された時にロードします。|packages| を参照してください。 + + +新スタイルのテスト ~ + +これは、Vim 開発者のためのものです。今まで Vim のためのテストを書くのは簡単で +はありませんでした。Vim 8 は assert 関数とテストを実行するためのフレームワーク +を追加しました。これは、テストを書くことを大幅に単純化し、更新された状態が保た +れるようになります。また、テストのための関数もいくつか追加されています。 +|test-functions| を参照してください。 + + +ウィンドウ ID ~ + +以前は、ウィンドウはその番号でのみアクセスすることができました。そして、その番 +号はウィンドウを開いたり閉じたり移動するたびに変更されます。それぞれのウィンド +ウは一意な ID を持つようになり、ウィンドウを簡単に見つけることができます。 +|win_getid()| と |win_id2win()| を参照してください。 + + +Viminfo のタイムスタンプ利用 ~ + +以前は、viminfo に格納される情報はどんなものでも最後の Vim が書いたものでした。 +常に最新の要素が保持されるように、タイムスタンプが使用されるようになりました。 +|viminfo-timestamp| を参照してください。 + + +インデント付きの行折り返し ~ + +インデントの量を変更せずに行の折り返しを行えるように、'breakindent' オプション +が追加されました。 + + +Windows: DirectX 対応 ~ + +MS-Windows で DirectX (DirectWrite) 対応を有効化できるように、'renderoptions' +オプションが追加されました。 + + +GTK+ 3 対応 ~ + +GTK+ 3 GUI は、いくつかのめったに気づかない技術上の差分を除き、GTK+ 2 と同じよ +うに動作します。Configure は、GTK+ 2 と 3 が両方使用可能な場合、引き続き 2 を +選択します。どうやって代わりに GTK+ 3 を使うかは src/Makefile を参照してくださ +い。その他の詳細は |gui-x11-compiling| を参照してください。 + + +Vim script の拡張 *new-vim-script-8* +----------------- + +Vim script に以下の型が追加されました: + + |Special| |v:false|, |v:true|, |v:none| と |v:null| + |Channel| 非同期 I/O 用の他のプロセスとの接続 + |Job| プロセス制御 + +新しい型に対応するため、たくさんの関数とコマンドが追加されました。 + +いくつかのシステムでは Vim script で使用する数値が 64 bit になりました。これは +|+num64| 機能で確認できます。 + +新スタイルのテスト(|new-style-testing|)対応のため多数の要素が追加されました。 + +printf() は %s の引数として任意の型を受け付けるようになりました。引数は +string() と同じように文字列に変換されます。 + + +さまざまな新要素 *new-items-8* +---------------- + +ビジュアルモードコマンド: ~ + +|v_CTRL-A| CTRL-A 選択範囲の数値を一律に N ずつ増やす +|v_CTRL-X| CTRL-X 選択範囲の数値を一律に N ずつ減らす +|v_g_CTRL-A| g CTRL-A 選択範囲の数値を漸増的に N ずつ増やす +|v_g_CTRL-X| g CTRL-X 選択範囲の数値を漸減的に N ずつ減らす + + +挿入モードコマンド: ~ + +|i_CTRL-G_U| CTRL-G U 次のカーソル移動でアンドゥを分割しない + + +コマンドラインモードコマンド: ~ + +|/_CTRL-G| CTRL-G 'incsearch' がアクティブならば、次マッチへ移動 +|/_CTRL-T| CTRL-T 'incsearch' がアクティブならば、前マッチへ移動 + + +オプション: ~ + +'belloff' 指定した場合にベルを鳴らさない +'breakindent' 折り返された行でインデントを繰り返す +'breakindentopt' 'breakindent' のための設定 +'emoji' 絵文字を全角として扱う +'fixendofline' ファイル末尾に <EOL> を必ずつける +'langremap' マッピングされた文字に 'langmap' を適用する +'luadll' Lua 動的ライブラリの名前 +'packpath' パッケージのために使われるディレクトリのリスト +'perldll' Perl 動的ライブラリの名前 +'pythondll' Python 2 動的ライブラリの名前 +'pythonthreedll' Python 3 動的ライブラリの名前 +'renderoptions' Windows でのテキストレンダリングの設定 +'rubydll' Ruby 動的ライブラリの名前 +'signcolumn' 目印用の桁をどう表示するか +'tagcase' タグファイル内検索で大文字小文字の扱いを指定する +'tcldll' Tcl 動的ライブラリの名前 +'termguicolors' ターミナルで GUI カラーを使う + + +Ex コマンド: ~ + +|:cbottom| QuickFixウィンドウの最下へスクロールする +|:cdo| QuickFixリストの各項目に対してコマンドを実行する +|:cfdo| QuickFixリストの各ファイルに対してコマンドを実行する +|:chistory| エラーリストの一覧を表示する +|:clearjumps| ジャンプリストを削除する +|:filter| コマンドの出力をフィルターする +|:helpclose| ヘルプウィンドウを1つ閉じる +|:lbottom| ロケーションウィンドウの最下へスクロールする +|:ldo| ロケーションリストの各項目に対してコマンドを実行する +|:lfdo| ロケーションリストの各ファイルに対してコマンドを実行す + る +|:lhistory| ロケーションリストの一覧を表示する +|:noswapfile| スワップファイルを作らずにコマンドを実行する +|:packadd| 'packpath' からプラグインを追加する +|:packloadall| 'packpath' 下の全プラグインをロードする +|:smile| ユーザーを幸せにする + + +Ex コマンド修飾子: ~ + +|:keeppatterns| 検索パターン履歴を変更せずにコマンドを実行する +|<mods>| コマンド修飾子をユーザー定義コマンドに提供する + + +新規および拡張された関数: ~ + +|arglistid()| 引数リストのIDを得る +|assert_equal()| 2つの式が等しい事をテストする +|assert_exception()| コマンドが例外を投げる事をテストする +|assert_fails()| 関数呼び出しが失敗する事をテストする +|assert_false()| 式がfalseかどうかテストする +|assert_inrange()| 式が範囲内にある事をテストする +|assert_match()| 値がパターンにマッチする事をテストする +|assert_notequal()| 2つの式が等しくない事をテストする +|assert_notmatch()| 値がパターンにマッチしない事をテストする +|assert_true()| 式がtrueかどうかテストする +|bufwinid()| バッファのウィンドウIDを得る +|byteidxcomp()| byteidx() と同様だが合成文字を数に入れる +|ch_close()| チャンネルを閉じる +|ch_close_in()| チャンネルの入力パートを閉じる +|ch_evalexpr()| チャンネル経由で式を評価する +|ch_evalraw()| チャンネル経由で raw 文字列を評価する +|ch_getbufnr()| チャンネルのバッファ番号を取得する +|ch_getjob()| チャンネルが割り当てられている Job を取得する +|ch_info()| チャンネルの情報を取得する +|ch_log()| チャンネルのログファイルにメッセージを出力する +|ch_logfile()| チャンネルのログファイルを設定する +|ch_open()| チャンネルを開く +|ch_read()| チャンネルからメッセージを読み取る +|ch_readraw()| チャンネルからrawメッセージを読み取る +|ch_sendexpr()| チャンネルにJSONメッセージを送る +|ch_sendraw()| チャンネルにrawメッセージを送る +|ch_setoptions()| チャンネルのオプションを設定する +|ch_status()| チャンネルの状態を取得する +|execute()| Ex コマンドを実行し出力を得る +|exepath()| 実行ファイルのフルパスを得る +|funcref()| 関数 {name} への参照を返す +|getbufinfo()| バッファの情報一覧を得る +|getcharsearch()| 文字検索情報を返す +|getcmdwintype()| 現在のコマンドラインウィンドウの種類を返す +|getcompletion()| マッチするコマンド補完リストを返す +|getcurpos()| カーソルの位置を取得する +|gettabinfo()| タブページの情報一覧を得る +|getwininfo()| ウィンドウの情報一覧を得る +|glob2regpat()| glob パターンを正規表現に変換する +|isnan()| 数値でないかどうかのチェック +|job_getchannel()| Job が使用する channel を取得する +|job_info()| Job の情報を取得する +|job_setoptions()| Job のオプションを設定する +|job_start()| Job を開始する +|job_status()| Job のステータスを取得する +|job_stop()| Job を停止する +|js_decode()| JSONの文字列をVimの型にデコードする +|js_encode()| 式をJSONの文字列にエンコードする +|json_decode()| JSONの文字列をVimの型にデコードする +|json_encode()| 式をJSONの文字列にエンコードする +|matchaddpos()| 強調表示する位置のリストを定義する +|matchstrpos()| 文字列の中でパターンにマッチした文字列と位置 +|perleval()| Perlの式を評価する +|reltimefloat()| reltime()の結果を浮動小数点に変換する +|setcharsearch()| 文字検索情報を設定する +|setfperm()| ファイルのパーミッションを設定する +|strcharpart()| 文字のインデックスで指定された部分文字列を得る +|strgetchar()| 文字のインデックスで指定された文字コードを得る +|systemlist()| シェルコマンドを実行し、その結果をリストで得る +|test_alloc_fail()| メモリの確保を失敗させる +|test_autochdir()| 'autochdir' 機能をテストする +test_disable_char_avail() typeahead なしにテスト (のちに削除された) +|test_garbagecollect_now()| 直ちにメモリを解放する +|test_null_channel()| null のチャンネルを返す +|test_null_dict()| null の辞書を返す +|test_null_job()| null の Job を返す +|test_null_list()| null のリストを返す +|test_null_partial()| null の部分適用を返す +|test_null_string()| null の文字列を返す +|test_settime()| Vim が内部的に使用する時間を設定する +|timer_info()| タイマーの情報を得る +|timer_pause()| タイマーを一時停止もしくは再開する +|timer_start()| タイマーを作る +|timer_stop()| タイマーを止める +|timer_stopall()| 全てのタイマーを止める +|uniq()| 隣接して繰り返される要素のコピーを削除する +|win_findbuf()| バッファが含まれるウィンドウを探す +|win_getid()| ウィンドウのウィンドウIDを得る +|win_gotoid()| IDで指定されたウィンドウへ移動する +|win_id2tabwin()| IDで指定されたタブとウィンドウの番号を得る +|win_id2win()| IDで指定されたウィンドウの番号を得る +|wordcount()| バッファ内のバイト数/単語数/文字数などを得る + + +新しい Vim 変数: ~ + +|v:beval_winid| マウスポインタがあるウィンドウのウィンドウID +|v:completed_item| 最も最近補完された単語用の補完要素 +|v:errors| assert 関数によって見つかったエラー +|v:false| 数値0 +|v:hlsearch| 検索による強調表示がオンになっているかどうかを示す +|v:mouse_winid| |getchar()|でマウスクリックイベントが発生したときのウィ + ンドウ番号 +|v:none| 空の文字列、JSONで使われる +|v:null| 空の文字列、JSONで使われる +|v:option_new| オプションに設定された新しい値、|OptionSet| で使われる +|v:option_old| オプションの以前の値、|OptionSet| で使われる +|v:option_type| set コマンドのスコープ、|OptionSet| で使われる +|v:progpath| Vim を起動したときのコマンド +|v:t_bool| 真偽値型の値 +|v:t_channel| チャンネル型の値 +|v:t_dict| 辞書型の値 +|v:t_float| 浮動小数点数型の値 +|v:t_func| Funcref型の値 +|v:t_job| ジョブ型の値 +|v:t_list| リスト型の値 +|v:t_none| 特殊値型の値 +|v:t_number| 数値型の値 +|v:t_string| 文字列型の値 +|v:testing| `test_garbagecollect_now()` を使う前に設定する必要がある +|v:true| 数値1 +|v:vim_did_enter| VimEnter 自動コマンドが実行される直前にセットされる + + +新しい自動コマンドイベント: ~ + +|CmdUndefined| 呼び出そうとしたユーザー定義コマンドが定義されていな + かったとき +|OptionSet| オプションが設定された後 +|TabClosed| タブページを閉じた後 +|TabNew| 新しいタブページを作成した後 +|TextChanged| ノーマルモードでテキストが変更された後 +|TextChangedI| 挿入モードでテキストが変更された後 +|WinNew| 新しいウィンドウを作成した後 + + +新しいハイライトグループ: ~ + +EndOfBuffer バッファ中で最終行以降の領域を埋めるための行 (~)。 + |hl-EndOfBuffer| + + +検索パターンにおける新要素: ~ + +|/\%C| \%C すべての合成文字にマッチする + + +新しい Syntax/Indent/FTplugin ファイル: ~ + +AVR Assembler (Avra) syntax +Arduino syntax +Bazel syntax and indent and ftplugin +Dockerfile syntax and ftplugin +Eiffel ftplugin +Euphoria 3 and 4 syntax +Go syntax and indent and ftplugin +Godoc syntax +Groovy ftplugin +HGcommit ftplugin +Hog indent and ftplugin +Innovation Data Processing upstream.pt syntax +J syntax and indent and ftplugin +Jproperties ftplugin +Json syntax and indent and ftplugin +Kivy syntax +Less syntax and indent +Mix syntax +Motorola S-Record syntax +R ftplugin +ReStructuredText syntax and indent and ftplugin +Registry ftplugin +Rhelp indent and ftplugin +Rmd (markdown with R code chunks) syntax and indent +Rmd ftplugin +Rnoweb ftplugin +Rnoweb indent +Scala syntax and indent and ftplugin +SystemVerilog syntax and indent and ftplugin +Systemd syntax and indent and ftplugin +Teraterm (TTL) syntax and indent +Text ftplugin +Vroom syntax and indent and ftplugin + + +新しいキーマップ: ~ + +Armenian eastern and western +Russian jcukenwintype +Vietnamese telex and vni + +============================================================================== +非互換な変更 *incompatible-8* + +これらの変更は以前のリリースとは互換性がありません。もしもあなたが Vim 7.4 か +ら 8.0 に更新した際に問題が起きたなら、この一覧を確認してください。 + + +vimrc が無いときのより良い既定値 ~ + +vimrc ファイルが見つからないとき、新規ユーザーのためにより有用な既定値を設定す +るために |defaults.vim| がロードされます。これは 'nocompatible' の設定も含んで +います。そのため、Vim はもはや Vi 互換モードでは起動しません。もしそうしたい場 +合は、"set compatible" を行う .vimrc ファイルを作るか、"vim -C" で Vim を開始 +してください。 + + +対応の削除 ~ + +MS-DOS 対応は削除されました。それは、(Vim がメモリに収まらないため) しばらく動 +いていませんでした。削除によりコードが少しきれいになりました。 + +Windows 16 bit (Windows 95 とそれ以前) の対応は削除されました。 + +OS/2 の対応は削除されました。それはしばらく誰も使っていなかったため、おそらく +動いていませんでした。 + +SNiFF+ 対応は削除されました。 + + +小さな非互換点 ~ + +おそらく…… + +============================================================================== +改善点 *improvements-8* + +既存の blowfish 暗号化は想定よりも弱かったことが判明しました。それを修正するた +め、blowfish2 方式が追加されました。これは依然として最先端の暗号化ではないこと +に注意してください。しかし、たいていの用途には十分でしょう。'cryptmethod' を参 +照してください。 + + +============================================================================== +コンパイル時の変更 *compile-changes-8* + +Vim のリポジトリは、Google code が閉鎖されたため、Google code から github に移 +動しました。リポジトリは https://github.com/vim/vim にあります。 + +ANSI-C 関数宣言を使用するようになりました。最低でも C-89 互換のコンパイラが要 +求されます。 + +常に +visual 機能が含まれるようになりました。 + +============================================================================== +パッチ *patches-8* *bug-fixes-8* + +7.4.0 以降に取り込まれたパッチのリストです。これはすべての新機能を含んでいます +が、ランタイムファイルの変更 (シンタックス、インデント、ヘルプなど) は含んでい +ません。 + +Patch 7.4.001 +Problem: Character classes such as [a-z] do not react to 'ignorecase'. + Breaks man page highlighting. (Mario Grgic) +Solution: Add separate items for classes that react to 'ignorecase'. Clean + up logic handling character classes. Add more tests. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.002 +Problem: Pattern with two alternative look-behind matches does not match. + (Amadeus Demarzi) +Solution: When comparing PIMs also compare their state ID to see if they are + different. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.003 +Problem: Memory access error in Ruby syntax highlighting. (Christopher Chow) +Solution: Refresh stale pointer. (James McCoy) +Files: src/regexp_nfa.c + +Patch 7.4.004 +Problem: When closing a window fails ":bwipe" may hang. +Solution: Let win_close() return FAIL and break out of the loop. +Files: src/window.c, src/proto/window.pro, src/buffer.c + +Patch 7.4.005 +Problem: Using "vaB" while 'virtualedit' is set selects the wrong area. + (Dimitar Dimitrov) +Solution: Reset coladd when finding a match. +Files: src/search.c + +Patch 7.4.006 +Problem: mkdir("foo/bar/", "p") gives an error message. (David Barnett) +Solution: Remove the trailing slash. (lcd) +Files: src/eval.c + +Patch 7.4.007 +Problem: Creating a preview window on startup leaves the screen layout in a + messed up state. (Marius Gedminas) +Solution: Don't change firstwin. (Christian Brabandt) +Files: src/main.c + +Patch 7.4.008 +Problem: New regexp engine can't be interrupted. +Solution: Check for CTRL-C pressed. (Yasuhiro Matsumoto) +Files: src/regexp_nfa.c, src/regexp.c + +Patch 7.4.009 +Problem: When a file was not decrypted (yet), writing it may destroy the + contents. +Solution: Mark the file as readonly until decryption was done. (Christian + Brabandt) +Files: src/fileio.c + +Patch 7.4.010 (after 7.4.006) +Problem: Crash with invalid argument to mkdir(). +Solution: Check for empty string. (lcd47) +Files: src/eval.c + +Patch 7.4.011 +Problem: Cannot find out if "acl" and "xpm" features are supported. +Solution: Add "acl" and "xpm" to the list of features. (Ken Takata) +Files: src/eval.c, src/version.c + +Patch 7.4.012 +Problem: MS-Windows: resolving shortcut does not work properly with + multi-byte characters. +Solution: Use wide system functions. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.013 +Problem: MS-Windows: File name buffer too small for utf-8. +Solution: Use character count instead of byte count. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.014 +Problem: MS-Windows: check for writing to device does not work. +Solution: Fix #ifdefs. (Ken Takata) +Files: src/fileio.c + +Patch 7.4.015 +Problem: MS-Windows: Detecting node type does not work for multi-byte + characters. +Solution: Use wide character function when needed. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.016 +Problem: MS-Windows: File name case can be wrong. +Solution: Add fname_casew(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.017 +Problem: ":help !!" does not find the "!!" tag in the help file. (Ben + Fritz) +Solution: When reading the start of the tags file do parse lines that are + not header lines. +Files: src/tag.c + +Patch 7.4.018 +Problem: When completing item becomes unselected. (Shougo Matsu) +Solution: Revert patch 7.3.1269. +Files: src/edit.c + +Patch 7.4.019 +Problem: MS-Windows: File name completion doesn't work properly with + Chinese characters. (Yue Wu) +Solution: Take care of multi-byte characters when looking for the start of + the file name. (Ken Takata) +Files: src/edit.c + +Patch 7.4.020 +Problem: NFA engine matches too much with \@>. (John McGowan) +Solution: When a whole pattern match is found stop searching. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.021 +Problem: NFA regexp: Using \ze in one branch which doesn't match may cause + end of another branch to be wrong. (William Fugh) +Solution: Set end position if it wasn't set yet. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.022 +Problem: Deadlock while exiting, because of allocating memory. +Solution: Do not use gettext() in deathtrap(). (James McCoy) +Files: src/os_unix.c, src/misc1.c + +Patch 7.4.023 +Problem: Compiler warning on 64 bit windows. +Solution: Add type cast. (Mike Williams) +Files: src/edit.c + +Patch 7.4.024 +Problem: When root edits a file the undo file is owned by root while the + edited file may be owned by another user, which is not allowed. + (cac2s) +Solution: Accept an undo file owned by the current user. +Files: src/undo.c + +Patch 7.4.025 (after 7.4.019) +Problem: Reading before start of a string. +Solution: Do not call mb_ptr_back() at start of a string. (Dominique Pelle) +Files: src/edit.c + +Patch 7.4.026 +Problem: Clang warning for int shift overflow. +Solution: Use unsigned and cast back to int. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.027 (after 7.4.025) +Problem: Another valgrind error when using CTRL-X CTRL-F at the start of + the line. (Dominique Pelle) +Solution: Don't call mb_ptr_back() at the start of the line. Add a test. +Files: src/edit.c, src/testdir/test32.in + +Patch 7.4.028 +Problem: Equivalence classes are not working for multi-byte characters. +Solution: Copy the rules from the old to the new regexp engine. Add a test + to check both engines. +Files: src/regexp_nfa.c, src/testdir/test44.in, src/testdir/test99.in, + src/testdir/test99.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.029 +Problem: An error in a pattern is reported twice. +Solution: Remove the retry with the backtracking engine, it won't work. +Files: src/regexp.c + +Patch 7.4.030 +Problem: The -mno-cygwin argument is no longer supported by Cygwin. +Solution: Remove the arguments. (Steve Hall) +Files: src/GvimExt/Make_cyg.mak, src/Make_cyg.mak, src/xxd/Make_cyg.mak + +Patch 7.4.031 +Problem: ":diffoff!" resets options even when 'diff' is not set. (Charles + Cooper) +Solution: Only resets related options in a window where 'diff' is set. +Files: src/diff.c + +Patch 7.4.032 +Problem: NFA engine does not match the NUL character. (Jonathon Merz) +Solution: Use 0x0a instead of NUL. (Christian Brabandt) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.033 +Problem: When the terminal has only 20 lines test 92 and 93 overwrite the + input file. +Solution: Explicitly write test.out. Check that the terminal is large enough + to run the tests. (Hirohito Higashi) +Files: src/testdir/test92.in, src/testdir/test93.in, + src/testdir/test1.in, src/testdir/Makefile + +Patch 7.4.034 +Problem: Using "p" in Visual block mode only changes the first line. +Solution: Repeat the put in all text in the block. (Christian Brabandt) +Files: runtime/doc/change.txt, src/ops.c, src/normal.c, + src/testdir/test20.in, src/testdir/test20.ok + +Patch 7.4.035 +Problem: MS-Windows: The mouse pointer flickers when going from command + line mode to Normal mode. +Solution: Check for WM_NCMOUSEMOVE. (Ken Takata) +Files: src/gui_w48.c + +Patch 7.4.036 +Problem: NFA engine does not capture group correctly when using \@>. (ZyX) +Solution: Copy submatches before doing the recursive match. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.037 +Problem: Using "\ze" in a sub-pattern does not result in the end of the + match to be set. (Axel Bender) +Solution: Copy the end of match position when a recursive match was + successful. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.038 +Problem: Using "zw" and "zg" when 'spell' is off give a confusing error + message. (Gary Johnson) +Solution: Ignore the error when locating the word. Explicitly mention what + word was added. (Christian Brabandt) +Files: src/normal.c, src/spell.c + +Patch 7.4.039 +Problem: MS-Windows: MSVC10 and earlier can't handle symlinks to a + directory properly. +Solution: Add stat_symlink_aware() and wstat_symlink_aware(). (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c, src/os_win32.h + +Patch 7.4.040 +Problem: Valgrind error on exit when a script-local variable holds a + reference to the scope of another script. +Solution: First clear all variables, then free the scopes. (ZyX) +Files: src/eval.c + +Patch 7.4.041 (after 7.4.034) +Problem: Visual selection does not remain after being copied over. (Axel + Bender) +Solution: Move when VIsual_active is reset. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.042 +Problem: When using ":setlocal" for 'spell' and 'spelllang' then :spelldump + doesn't work. (Dimitar Dimitrov) +Solution: Copy the option variables to the new window used to show the dump. + (Christian Brabandt) +Files: src/spell.c + +Patch 7.4.043 +Problem: VMS can't handle long function names. +Solution: Shorten may_req_ambiguous_character_width. (Samuel Ferencik) +Files: src/main.c, src/term.c, src/proto/term.pro + + +Patch 7.4.044 (after 7.4.039) +Problem: Can't build with old MSVC. (Wang Shoulin) +Solution: Define OPEN_OH_ARGTYPE instead of using intptr_t directly. +Files: src/os_mswin.c + +Patch 7.4.045 +Problem: substitute() does not work properly when the pattern starts with + "\ze". +Solution: Detect an empty match. (Christian Brabandt) +Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.046 +Problem: Can't use Tcl 8.6. +Solution: Change how Tcl_FindExecutable is called. (Jan Nijtmans) +Files: src/if_tcl.c + +Patch 7.4.047 +Problem: When using input() in a function invoked by a mapping it doesn't + work. +Solution: Temporarily reset ex_normal_busy. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.048 +Problem: Recent clang version complains about -fno-strength-reduce. +Solution: Add a configure check for the clang version. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.049 +Problem: In Ex mode, when line numbers are enabled the substitute prompt is + wrong. +Solution: Adjust for the line number size. (Benoit Pierre) +Files: src/ex_cmds.c + +Patch 7.4.050 +Problem: "gn" selects too much for the pattern "\d" when there are two + lines with a single digit. (Ryan Carney) +Solution: Adjust the logic of is_one_char(). (Christian Brabandt) +Files: src/search.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.051 +Problem: Syntax highlighting a Yaml file causes a crash. (Blake Preston) +Solution: Copy the pim structure before calling addstate() to avoid it + becoming invalid when the state list is reallocated. +Files: src/regexp_nfa.c + +Patch 7.4.052 +Problem: With 'fo' set to "a2" inserting a space in the first column may + cause the cursor to jump to the previous line. +Solution: Handle the case when there is no comment leader properly. (Tor + Perkins) Also fix that cursor is in the wrong place when spaces + get replaced with a Tab. +Files: src/misc1.c, src/ops.c, src/testdir/test68.in, + src/testdir/test68.ok + +Patch 7.4.053 +Problem: Test75 has a wrong header. (ZyX) +Solution: Fix the text and remove leading ". +Files: src/testdir/test75.in + +Patch 7.4.054 +Problem: Reading past end of the 'stl' string. +Solution: Don't increment pointer when already at the NUL. (Christian + Brabandt) +Files: src/buffer.c + +Patch 7.4.055 +Problem: Mac: Where availability macros are defined depends on the system. +Solution: Add a configure check. (Felix Bünemann) +Files: src/config.h.in, src/configure.in, src/auto/configure, + src/os_mac.h + +Patch 7.4.056 +Problem: Mac: Compilation problem with OS X 10.9 Mavericks. +Solution: Include AvailabilityMacros.h when available. (Kazunobu Kuriyama) +Files: src/os_unix.c + +Patch 7.4.057 +Problem: byteidx() does not work for composing characters. +Solution: Add byteidxcomp(). +Files: src/eval.c, src/testdir/test69.in, src/testdir/test69.ok, + runtime/doc/eval.txt + +Patch 7.4.058 +Problem: Warnings on 64 bit Windows. +Solution: Add type casts. (Mike Williams) +Files: src/ops.c + +Patch 7.4.059 +Problem: set_last_cursor() may encounter w_buffer being NULL. (Matt + Mkaniaris) +Solution: Check for NULL. +Files: src/mark.c + +Patch 7.4.060 +Problem: Declaration has wrong return type for PyObject_SetAttrString(). +Solution: Use int instead of PyObject. (Andreas Schwab) +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.061 (after 7.4.055 and 7.4.056) +Problem: Availability macros configure check in wrong place. +Solution: Also check when not using Darwin. Remove version check. +Files: src/configure.in, src/auto/configure, src/os_unix.c + +Patch 7.4.062 (after 7.4.061) +Problem: Configure check for AvailabilityMacros.h is wrong. +Solution: Use AC_CHECK_HEADERS(). +Files: src/configure.in, src/auto/configure + +Patch 7.4.063 +Problem: Crash when using invalid key in Python dictionary. +Solution: Check for object to be NULL. Add tests. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.064 +Problem: When replacing a character in Visual block mode, entering a CR + does not cause a repeated line break. +Solution: Recognize the situation and repeat the line break. (Christian + Brabandt) +Files: src/normal.c, src/ops.c, src/testdir/test39.in, + src/testdir/test39.ok + +Patch 7.4.065 +Problem: When recording, the character typed at the hit-enter prompt is + recorded twice. (Urtica Dioica) +Solution: Avoid recording the character twice. (Christian Brabandt) +Files: src/message.c + +Patch 7.4.066 +Problem: MS-Windows: When there is a colon in the file name (sub-stream + feature) the swap file name is wrong. +Solution: Change the colon to "%". (Yasuhiro Matsumoto) +Files: src/fileio.c, src/memline.c, src/misc1.c, src/proto/misc1.pro + +Patch 7.4.067 +Problem: After inserting comment leader, CTRL-\ CTRL-O does move the + cursor. (Wiktor Ruben) +Solution: Avoid moving the cursor. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.068 +Problem: Cannot build Vim on Mac with non-Apple compilers. +Solution: Remove the -no-cpp-precomp flag. (Misty De Meo) +Files: src/configure.in, src/auto/configure, src/osdef.sh + +Patch 7.4.069 +Problem: Cannot right shift lines starting with #. +Solution: Allow the right shift when 'cino' contains #N with N > 0. + (Christian Brabandt) + Refactor parsing 'cino', store the values in the buffer. +Files: runtime/doc/indent.txt, src/buffer.c, src/edit.c, src/eval.c, + src/ex_getln.c, src/fold.c, src/misc1.c, src/ops.c, + src/proto/misc1.pro, src/proto/option.pro, src/structs.h, + src/option.c + +Patch 7.4.070 (after 7.4.069) +Problem: Can't compile with tiny features. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/buffer.c + +Patch 7.4.071 (after 7.4.069) +Problem: Passing limits around too often. +Solution: Use limits from buffer. +Files: src/edit.c, src/misc1.c, src/proto/misc1.pro + +Patch 7.4.072 +Problem: Crash when using Insert mode completion. +Solution: Avoid going past the end of pum_array. (idea by Francisco Lopes) +Files: src/popupmnu.c + +Patch 7.4.073 +Problem: Setting undolevels for one buffer changes undo in another. +Solution: Make 'undolevels' a global-local option. (Christian Brabandt) +Files: runtime/doc/options.txt, src/buffer.c, src/option.c, src/option.h + src/structs.h, src/undo.c + +Patch 7.4.074 +Problem: When undo'ing all changes and creating a new change the undo + structure is incorrect. (Christian Brabandt) +Solution: When deleting the branch starting at the old header, delete the + whole branch, not just the first entry. +Files: src/undo.c + +Patch 7.4.075 +Problem: Locally setting 'undolevels' is not tested. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test100.in, src/testdir/test100.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, src/Makefile + +Patch 7.4.076 +Problem: "cgn" does not wrap around the end of the file. (Dimitar Dimitrov) +Solution: Restore 'wrapscan' earlier. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.077 +Problem: DOS installer creates shortcut without a path, resulting in the + current directory to be C:\Windows\system32. +Solution: Use environment variables. +Files: src/dosinst.c + +Patch 7.4.078 +Problem: MSVC 2013 is not supported. +Solution: Recognize and support MSVC 2013. (Ed Brown) +Files: src/Make_mvc.mak + +Patch 7.4.079 +Problem: A script cannot detect whether 'hlsearch' highlighting is actually + displayed. +Solution: Add the "v:hlsearch" variable. (ZyX) +Files: src/eval.c, src/ex_docmd.c, + src/option.c, src/screen.c, src/search.c, src/tag.c, src/vim.h, + src/testdir/test101.in, src/testdir/test101.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.080 (after 7.4.079) +Problem: Missing documentation for v:hlsearch. +Solution: Include the right file in the patch. +Files: runtime/doc/eval.txt + +Patch 7.4.081 (after 7.4.078) +Problem: Wrong logic when ANALYZE is "yes". +Solution: Use or instead of and. (KF Leong) +Files: src/Make_mvc.mak + +Patch 7.4.082 +Problem: Using "gf" in a changed buffer suggests adding "!", which is not + possible. (Tim Chase) +Solution: Pass a flag to check_changed() whether adding ! make sense. +Files: src/vim.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/globals.h, + src/ex_cmds.c, src/ex_docmd.c + +Patch 7.4.083 +Problem: It's hard to avoid adding a used pattern to the search history. +Solution: Add the ":keeppatterns" modifier. (Christian Brabandt) +Files: runtime/doc/cmdline.txt, src/ex_cmds.h, src/ex_docmd.c, + src/ex_getln.c, src/structs.h + +Patch 7.4.084 +Problem: Python: interrupt not being properly discarded. (Yggdroot Chen) +Solution: Discard interrupt in VimTryEnd. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.085 +Problem: When inserting text in Visual block mode and moving the cursor the + wrong text gets repeated in other lines. +Solution: Use the '[ mark to find the start of the actually inserted text. + (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.086 +Problem: Skipping over an expression when not evaluating it does not work + properly for dict members. +Solution: Skip over unrecognized expression. (ZyX) +Files: src/eval.c, src/testdir/test34.in, src/testdir/test34.ok + +Patch 7.4.087 +Problem: Compiler warning on 64 bit Windows systems. +Solution: Fix type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.088 +Problem: When spell checking is enabled Asian characters are always marked + as error. +Solution: When 'spelllang' contains "cjk" do not mark Asian characters as + error. (Ken Takata) +Files: runtime/doc/options.txt, runtime/doc/spell.txt, src/mbyte.c, + src/option.c, src/spell.c, src/structs.h + +Patch 7.4.089 +Problem: When editing a file in a directory mounted through sshfs Vim + doesn't set the security context on a renamed file. +Solution: Add mch_copy_sec() to vim_rename(). (Peter Backes) +Files: src/fileio.c + +Patch 7.4.090 +Problem: Win32: When a directory name contains an exclamation mark, + completion doesn't complete the contents of the directory. +Solution: Escape the exclamation mark. (Jan Stocker) +Files: src/ex_getln.c, src/testdir/test102.in, src/testdir/test102.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.091 (after 7.4.089) +Problem: Missing semicolon. +Solution: Add the semicolon. +Files: src/fileio.c + +Patch 7.4.092 (after 7.4.088) +Problem: Can't build small version. +Solution: Add #ifdef where the b_cjk flag is used. (Ken Takata) +Files: src/spell.c + +Patch 7.4.093 +Problem: Configure can't use LuaJIT on ubuntu 12.04. +Solution: Adjust the configure regexp that locates the version number. + (Charles Strahan) +Files: src/configure.in, src/auto/configure + +Patch 7.4.094 +Problem: Configure may not find that -lint is needed for gettext(). +Solution: Check for gettext() with empty $LIBS. (Thomas De Schampheleire) +Files: src/configure.in, src/auto/configure + +Patch 7.4.095 (after 7.4.093) +Problem: Regexp for LuaJIT version doesn't work on BSD. +Solution: Use "*" instead of "\+" and "\?". (Ozaki Kiichi) +Files: src/configure.in, src/auto/configure + +Patch 7.4.096 +Problem: Can't change directory to an UNC path. +Solution: Use win32_getattrs() in mch_getperm(). (Christian Brabandt) +Files: src/os_win32.c + +Patch 7.4.097 (after 7.4.034) +Problem: Unexpected behavior change related to 'virtualedit'. (Ingo Karkat) +Solution: Update the valid cursor position. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.098 +Problem: When using ":'<,'>del" errors may be given for the visual line + numbers being out of range. +Solution: Reset Visual mode in ":del". (Lech Lorens) +Files: src/ex_docmd.c, src/testdir/test103.in, src/testdir/test103.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.099 +Problem: Append in blockwise Visual mode with "$" is wrong. +Solution: After "$" don't use the code that checks if the cursor was moved. + (Hirohito Higashi, Ken Takata) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.100 +Problem: NFA regexp doesn't handle backreference correctly. (Ryuichi + Hayashida, Urtica Dioica) +Solution: Always add NFA_SKIP, also when it already exists at the start + position. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.101 +Problem: Using \1 in pattern goes one line too far. (Bohr Shaw, John Little) +Solution: Only advance the match end for the matched characters in the last + line. +Files: src/regexp.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.102 +Problem: Crash when interrupting "z=". +Solution: Add safety check for word length. (Christian Brabandt, Dominique + Pelle) +Files: src/spell.c + +Patch 7.4.103 +Problem: Dos installer uses an old way to escape spaces in the diff + command. +Solution: Adjust the quoting to the new default shellxquote. (Ben Fritz) +Files: src/dosinst.c + +Patch 7.4.104 +Problem: ":help s/\_" reports an internal error. (John Beckett) +Solution: Check for NUL and invalid character classes. +Files: src/regexp_nfa.c + +Patch 7.4.105 +Problem: Completing a tag pattern may give an error for invalid pattern. +Solution: Suppress the error, just return no matches. +Files: src/tag.c + +Patch 7.4.106 +Problem: Can't build with Ruby using Cygwin. +Solution: Fix library name in makefile. (Steve Hall) +Files: src/Make_cyg.mak + +Patch 7.4.107 +Problem: Python: When vim.eval() encounters a Vim error, a try/catch in the + Python code doesn't catch it. (Yggdroot Chen) +Solution: Throw exceptions on errors in vim.eval(). (ZyX) +Files: src/ex_eval.c, src/if_py_both.h, src/proto/ex_eval.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.108 +Problem: "zG" and "zW" leave temp files around on MS-Windows. +Solution: Delete the temp files when exiting. (Ken Takata) +Files: src/memline.c, src/proto/spell.pro, src/spell.c + +Patch 7.4.109 +Problem: ColorScheme autocommand matches with the current buffer name. +Solution: Match with the colorscheme name. (Christian Brabandt) +Files: runtime/doc/autocmd.txt, src/fileio.c, src/syntax.c + +Patch 7.4.110 +Problem: "gUgn" cannot be repeated. (Dimitar Dimitrov) +Solution: Don't put "gn" in a different order in the redo buffer. Restore + 'wrapscan' when the pattern isn't found. (Christian Wellenbrock) +Files: src/normal.c, src/search.c, src/test53.in, src/test53.ok + +Patch 7.4.111 +Problem: Memory leak in Python OptionsAssItem. (Ken Takata) +Solution: Call Py_XDECREF() where needed. (ZyX) +Files: src/if_py_both.h + +Patch 7.4.112 +Problem: The defaults for 'directory' and 'backupdir' on MS-Windows do not + include a directory that exists. +Solution: Use $TEMP. +Files: src/os_dos.h + +Patch 7.4.113 +Problem: MSVC static analysis gives warnings. +Solution: Avoid the warnings and avoid possible bugs. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.114 +Problem: New GNU make outputs messages about changing directory in another + format. +Solution: Recognize the new format. +Files: src/option.h + +Patch 7.4.115 +Problem: When using Zsh expanding ~abc doesn't work when the result + contains a space. +Solution: Off-by-one error in detecting the NUL. (Pavol Juhas) +Files: src/os_unix.c + +Patch 7.4.116 +Problem: When a mapping starts with a space, the typed space does not show + up for 'showcmd'. +Solution: Show "<20>". (Brook Hong) +Files: src/normal.c + +Patch 7.4.117 +Problem: Can't build with Cygwin/MingW and Perl 5.18. +Solution: Add a linker argument for the Perl library. (Cesar Romani) + Adjust CFLAGS and LIB. (Cesar Romani) + Move including inline.h further down. (Ken Takata) +Files: src/Make_cyg.mak, src/Make_ming.mak, src/if_perl.xs + +Patch 7.4.118 +Problem: It's possible that redrawing the status lines causes + win_redr_custom() to be called recursively. +Solution: Protect against recursiveness. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 7.4.119 +Problem: Vim doesn't work well on OpenVMS. +Solution: Fix various problems. (Samuel Ferencik) +Files: src/os_unix.c, src/os_unix.h, src/os_vms.c + +Patch 7.4.120 (after 7.4.117) +Problem: Can't build with Perl 5.18 on Linux. (Lcd 47) +Solution: Add #ifdef. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.121 +Problem: Completion doesn't work for ":py3d" and ":py3f". (Bohr Shaw) +Solution: Skip over letters after ":py3". +Files: src/ex_docmd.c + +Patch 7.4.122 +Problem: Win32: When 'encoding' is set to "utf-8" and the active codepage + is cp932 then ":grep" and other commands don't work for multi-byte + characters. +Solution: (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.123 +Problem: Win32: Getting user name does not use wide function. +Solution: Use GetUserNameW() if possible. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.124 +Problem: Win32: Getting host name does not use wide function. +Solution: Use GetComputerNameW() if possible. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.125 +Problem: Win32: Dealing with messages may not work for multi-byte chars. +Solution: Use pDispatchMessage(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.126 +Problem: Compiler warnings for "const" and incompatible types. +Solution: Remove "const", add type cast. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.127 +Problem: Perl 5.18 on Unix doesn't work. +Solution: Move workaround to after including vim.h. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.128 +Problem: Perl 5.18 for MSVC doesn't work. +Solution: Add check in makefile and define __inline. (Ken Takata) +Files: src/Make_mvc.mak, src/if_perl.xs + +Patch 7.4.129 +Problem: getline(-1) returns zero. (mvxxc) +Solution: Return an empty string. +Files: src/eval.c + +Patch 7.4.130 +Problem: Relative line numbers mix up windows when using folds. +Solution: Use hasFoldingWin() instead of hasFolding(). (Lech Lorens) +Files: src/misc2.c + +Patch 7.4.131 +Problem: Syncbind causes E315 errors in some situations. (Liang Li) +Solution: Set and restore curbuf in ex_syncbind(). (Christian Brabandt) +Files: src/ex_docmd.c, src/testdir/test37.ok + +Patch 7.4.132 (after 7.4.122) +Problem: Win32: flags and inherit_handles arguments mixed up. +Solution: Swap the argument. (cs86661) +Files: src/os_win32.c + +Patch 7.4.133 +Problem: Clang warns for using NUL. +Solution: Change NUL to NULL. (Dominique Pelle) +Files: src/eval.c, src/misc2.c + +Patch 7.4.134 +Problem: Spurious space in MingW Makefile. +Solution: Remove the space. (Michael Soyka) +Files: src/Make_ming.mak + +Patch 7.4.135 +Problem: Missing dot in MingW test Makefile. +Solution: Add the dot. (Michael Soyka) +Files: src/testdir/Make_ming.mak + +Patch 7.4.136 (after 7.4.096) +Problem: MS-Windows: When saving a file with a UNC path the file becomes + read-only. +Solution: Don't mix up Win32 attributes and Unix attributes. (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.137 +Problem: Cannot use IME with Windows 8 console. +Solution: Change the user of ReadConsoleInput() and PeekConsoleInput(). + (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.138 (after 7.4.114) +Problem: Directory change messages are not recognized. +Solution: Fix using a character range literally. (Lech Lorens) +Files: src/option.h + +Patch 7.4.139 +Problem: Crash when using :cd in autocommand. (François Ingelrest) +Solution: Set w_localdir to NULL after freeing it. (Dominique Pelle) +Files: src/ex_docmd.c, src/window.c + +Patch 7.4.140 +Problem: Crash when wiping out buffer triggers autocommand that wipes out + only other buffer. +Solution: Do not delete the last buffer, make it empty. (Hirohito Higashi) +Files: src/buffer.c + +Patch 7.4.141 +Problem: Problems when building with Borland: st_mode is signed short; + can't build with Python; temp files not ignored by Mercurial; + building with DEBUG doesn't define _DEBUG. +Solution: Fix the problems. (Ken Takata) +Files: src/Make_bc5.mak, src/if_py_both.h, src/os_win32.c + +Patch 7.4.142 (after 7.4.137) +Problem: On MS-Windows 8 IME input doesn't work correctly. +Solution: Work around the problem. (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.143 +Problem: TextChangedI is not triggered. +Solution: Reverse check for "ready". (lilydjwg) +Files: src/edit.c + +Patch 7.4.144 +Problem: MingW also supports intptr_t for OPEN_OH_ARGTYPE. +Solution: Adjust #ifdef. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.145 +Problem: getregtype() does not return zero for unknown register. +Solution: Adjust documentation: return empty string for unknown register. + Check the register name to be valid. (Yukihiro Nakadaira) +Files: runtime/doc/eval.txt, src/ops.c + +Patch 7.4.146 +Problem: When starting Vim with "-u NONE" v:oldfiles is NULL. +Solution: Set v:oldfiles to an empty list. (Yasuhiro Matsumoto) +Files: src/main.c + +Patch 7.4.147 +Problem: Cursor moves to wrong position when using "gj" after "$" and + virtual editing is active. +Solution: Make "gj" behave differently when virtual editing is active. + (Hirohito Higashi) +Files: src/normal.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.148 +Problem: Cannot build with Cygwin and X11. +Solution: Include Xwindows.h instead of windows.h. (Lech Lorens) +Files: src/mbyte.c + +Patch 7.4.149 +Problem: Get E685 error when assigning a function to an autoload variable. + (Yukihiro Nakadaira) +Solution: Instead of having a global no_autoload variable, pass an autoload + flag down to where it is used. (ZyX) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok, + src/testdir/test60.in, src/testdir/test60.ok, + src/testdir/sautest/autoload/footest.vim + +Patch 7.4.150 +Problem: :keeppatterns is not respected for :s. +Solution: Check the keeppatterns flag. (Yasuhiro Matsumoto) +Files: src/search.c, src/testdir/test14.in, src/testdir/test14.ok + +Patch 7.4.151 +Problem: Python: slices with steps are not supported. +Solution: Support slices in Python vim.List. (ZyX) +Files: src/eval.c, src/if_py_both.h, src/if_python3.c, src/if_python.c, + src/proto/eval.pro, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.152 +Problem: Python: Cannot iterate over options. +Solution: Add options iterator. (ZyX) +Files: src/if_py_both.h, src/option.c, src/proto/option.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok, src/vim.h + +Patch 7.4.153 +Problem: Compiler warning for pointer type. +Solution: Add type cast. +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.154 (after 7.4.149) +Problem: Still a problem with auto-loading. +Solution: Pass no_autoload to deref_func_name(). (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.155 +Problem: ":keeppatterns /pat" does not keep search pattern offset. +Solution: Restore the offset after doing the search. +Files: src/search.c, src/testdir/test14.in, src/testdir/test14.ok + +Patch 7.4.156 +Problem: Test file missing from distribution. +Solution: Add new directory to file list. +Files: Filelist + +Patch 7.4.157 +Problem: Error number used twice. (Yukihiro Nakadaira) +Solution: Change the one not referred in the docs. +Files: src/undo.c + +Patch 7.4.158 (after 7.4.045) +Problem: Pattern containing \zs is not handled correctly by substitute(). +Solution: Change how an empty match is skipped. (Yukihiro Nakadaira) +Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.159 +Problem: Completion hangs when scanning the current buffer after doing + keywords. (Christian Brabandt) +Solution: Set the first match position when starting to scan the current + buffer. +Files: src/edit.c + +Patch 7.4.160 +Problem: Win32: Crash when executing external command. +Solution: Only close the handle when it was created. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.161 +Problem: Crash in Python exception handling. +Solution: Only use exception variables if did_throw is set. (ZyX) +Files: if_py_both.h + +Patch 7.4.162 +Problem: Running tests in shadow dir doesn't work. +Solution: Add testdir/sautest to the shadow target. (James McCoy) +Files: src/Makefile + +Patch 7.4.163 (after 7.4.142) +Problem: MS-Windows input doesn't work properly on Windows 7 and earlier. +Solution: Add a check for Windows 8. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.164 (after 7.4.163) +Problem: Problem with event handling on Windows 8. +Solution: Ignore duplicate WINDOW_BUFFER_SIZE_EVENTs. (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.165 +Problem: By default, after closing a buffer changes can't be undone. +Solution: In the example vimrc file set 'undofile'. +Files: runtime/vimrc_example.vim + +Patch 7.4.166 +Problem: Auto-loading a function for code that won't be executed. +Solution: Do not auto-load when evaluation is off. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.167 (after 7.4.149) +Problem: Fixes are not tested. +Solution: Add a test for not autoloading on assignment. (Yukihiro Nakadaira) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/sautest/autoload/Test104.vim, src/testdir/test104.in, + src/testdir/test104.ok + +Patch 7.4.168 +Problem: Can't compile with Ruby 2.1.0. +Solution: Add support for new GC. (Kohei Suzuki) +Files: src/if_ruby.c + +Patch 7.4.169 +Problem: ":sleep" puts cursor in the wrong column. (Liang Li) +Solution: Add the window offset. (Christian Brabandt) +Files: src/ex_docmd.c + +Patch 7.4.170 +Problem: Some help tags don't work with ":help". (Tim Chase) +Solution: Add exceptions. +Files: src/ex_cmds.c + +Patch 7.4.171 +Problem: Redo does not set v:count and v:count1. +Solution: Use a separate buffer for redo, so that we can set the counts when + performing redo. +Files: src/getchar.c, src/globals.h, src/normal.c, src/proto/getchar.pro, + src/structs.h + +Patch 7.4.172 +Problem: The blowfish code mentions output feedback, but the code is + actually doing cipher feedback. +Solution: Adjust names and comments. +Files: src/blowfish.c, src/fileio.c, src/proto/blowfish.pro, + src/memline.c + +Patch 7.4.173 +Problem: When using scrollbind the cursor can end up below the last line. + (mvxxc) +Solution: Reset w_botfill when scrolling up. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.174 +Problem: Compiler warnings for Python interface. (Tony Mechelynck) +Solution: Add type casts, initialize variable. +Files: src/if_py_both.h + +Patch 7.4.175 +Problem: When a wide library function fails, falling back to the non-wide + function may do the wrong thing. +Solution: Check the platform, when the wide function is supported don't fall + back to the non-wide function. (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.176 +Problem: Dictionary.update() throws an error when used without arguments. + Python programmers don't expect that. +Solution: Make Dictionary.update() without arguments do nothing. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.177 +Problem: Compiler warning for unused variable. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/move.c + +Patch 7.4.178 +Problem: The J command does not update '[ and '] marks. (William Gardner) +Solution: Set the marks. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.179 +Problem: Warning for type-punned pointer. (Tony Mechelynck) +Solution: Use intermediate variable. +Files: src/if_py_both.h + +Patch 7.4.180 (after 7.4.174) +Problem: Older Python versions don't support %ld. +Solution: Use %d instead. (ZyX) +Files: src/if_py_both.h + +Patch 7.4.181 +Problem: When using 'pastetoggle' the status lines are not updated. (Samuel + Ferencik, Jan Christoph Ebersbach) +Solution: Update the status lines. (Nobuhiro Takasaki) +Files: src/getchar.c + +Patch 7.4.182 +Problem: Building with mzscheme and racket does not work. (David Chimay) +Solution: Adjust autoconf. (Sergey Khorev) +Files: src/configure.in, src/auto/configure + +Patch 7.4.183 +Problem: MSVC Visual Studio update not supported. +Solution: Add version number. (Mike Williams) +Files: src/Make_mvc.mak + +Patch 7.4.184 +Problem: match() does not work properly with a {count} argument. +Solution: Compute the length once and update it. Quit the loop when at the + end. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.185 +Problem: Clang gives warnings. +Solution: Adjust how bigness is set. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.186 (after 7.4.085) +Problem: Insert in Visual mode sometimes gives incorrect results. + (Dominique Pelle) +Solution: Remember the original insert start position. (Christian Brabandt, + Dominique Pelle) +Files: src/edit.c, src/globals.h, src/ops.c, src/structs.h + +Patch 7.4.187 +Problem: Delete that crosses line break splits multi-byte character. +Solution: Advance a character instead of a byte. (Cade Foster) +Files: src/normal.c, src/testdir/test69.in, src/testdir/test69.ok + +Patch 7.4.188 +Problem: SIZEOF_LONG clashes with similar defines in header files. +Solution: Rename to a name starting with VIM_. Also for SIZEOF_INT. +Files: src/if_ruby.c, src/vim.h, src/configure.in, src/auto/configure, + src/config.h.in, src/fileio.c, src/if_python.c, src/message.c, + src/spell.c, src/feature.h, src/os_os2_cfg.h, src/os_vms_conf.h, + src/os_win16.h, src/structs.h + +Patch 7.4.189 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/eval.c + +Patch 7.4.190 +Problem: Compiler warning for using %lld for off_t. +Solution: Add type cast. +Files: src/fileio.c + +Patch 7.4.191 +Problem: Escaping a file name for shell commands can't be done without a + function. +Solution: Add the :S file name modifier. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test105.in, src/testdir/test105.ok, + runtime/doc/cmdline.txt, runtime/doc/eval.txt, + runtime/doc/map.txt, runtime/doc/options.txt, + runtime/doc/quickfix.txt, runtime/doc/usr_30.txt, + runtime/doc/usr_40.txt, runtime/doc/usr_42.txt, + runtime/doc/vi_diff.txt, src/eval.c, src/misc2.c, src/normal.c, + src/proto/misc2.pro + +Patch 7.4.192 +Problem: Memory leak when giving E853. +Solution: Free the argument. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.193 +Problem: Typos in messages. +Solution: "then" -> "than". (Dominique Pelle) +Files: src/if_py_both.h, src/spell.c + +Patch 7.4.194 +Problem: Can't build for Android. +Solution: Add #if condition. (Fredrik Fornwall) +Files: src/mbyte.c + +Patch 7.4.195 (after 7.4.193) +Problem: Python tests fail. +Solution: Change "then" to "than" in more places. (Dominique Pelle, Taro + Muraoka) +Files: src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.196 +Problem: Tests fail on Solaris 9 and 10. +Solution: Use "test -f" instead of "test -e". (Laurent Blume) +Files: src/testdir/Makefile + +Patch 7.4.197 +Problem: Various problems on VMS. +Solution: Fix several VMS problems. (Zoltan Arpadffy) +Files: runtime/doc/os_vms.txt, src/Make_vms.mms, src/fileio.c, + src/os_unix.c, src/os_unix.h, src/os_vms.c, src/os_vms_conf.h, + src/proto/os_vms.pro, src/testdir/Make_vms.mms, + src/testdir/test72.in, src/testdir/test77a.com, + src/testdir/test77a.in, src/testdir/test77a.ok src/undo.c + +Patch 7.4.198 +Problem: Can't build Vim with Perl when -Dusethreads is not specified for + building Perl, and building Vim with --enable-perlinterp=dynamic. +Solution: Adjust #ifdefs. (Yasuhiro Matsumoto) +Files: src/if_perl.xs + +Patch 7.4.199 +Problem: (issue 197) ]P doesn't paste over Visual selection. +Solution: Handle Visual mode specifically. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.200 +Problem: Too many #ifdefs in the code. +Solution: Enable FEAT_VISUAL always, await any complaints +Files: src/feature.h + +Patch 7.4.201 +Problem: 'lispwords' is a global option. +Solution: Make 'lispwords' global-local. (Sung Pae) +Files: runtime/doc/options.txt, runtime/optwin.vim, src/buffer.c, + src/misc1.c, src/option.c, src/option.h, src/structs.h, + src/testdir/test100.in, src/testdir/test100.ok + +Patch 7.4.202 +Problem: MS-Windows: non-ASCII font names don't work. +Solution: Convert between the current code page and 'encoding'. (Ken Takata) +Files: src/gui_w48.c, src/os_mswin.c, src/proto/winclip.pro, + src/winclip.c + +Patch 7.4.203 +Problem: Parsing 'errorformat' is not correct. +Solution: Reset "multiignore" at the start of a multi-line message. (Lcd) +Files: src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test106.in, + src/testdir/test106.ok + +Patch 7.4.204 +Problem: A mapping where the second byte is 0x80 doesn't work. +Solution: Unescape before checking for incomplete multi-byte char. (Nobuhiro + Takasaki) +Files: src/getchar.c, src/testdir/test75.in, src/testdir/test75.ok + +Patch 7.4.205 +Problem: ":mksession" writes command to move to second argument while it + does not exist. When it does exist the order might be wrong. +Solution: Use ":argadd" for each argument instead of using ":args" with a + list of names. (Nobuhiro Takasaki) +Files: src/ex_docmd.c + +Patch 7.4.206 +Problem: Compiler warnings on 64 bit Windows. +Solution: Add type casts. (Mike Williams) +Files: src/gui_w48.c, src/os_mswin.c + +Patch 7.4.207 +Problem: The cursor report sequence is sometimes not recognized and results + in entering replace mode. +Solution: Also check for the cursor report when not asked for. +Files: src/term.c + +Patch 7.4.208 +Problem: Mercurial picks up some files that are not distributed. +Solution: Add patterns to the ignore list. (Cade Forester) +Files: .hgignore + +Patch 7.4.209 +Problem: When repeating a filter command "%" and "#" are expanded. +Solution: Escape the command when storing for redo. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.210 +Problem: Visual block mode plus virtual edit doesn't work well with tabs. + (Liang Li) +Solution: Take coladd into account. (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.211 +Problem: ":lu" is an abbreviation for ":lua", but it should be ":lunmap". + (ZyX) +Solution: Move "lunmap" to above "lua". +Files: src/ex_cmds.h + +Patch 7.4.212 (after 7.4.200) +Problem: Now that the +visual feature is always enabled the #ifdefs for it + are not useful. +Solution: Remove the checks for FEAT_VISUAL. +Files: src/buffer.c, src/charset.c, src/edit.c, src/eval.c, + src/ex_cmds.c, src/ex_docmd.c, src/fold.c, src/getchar.c, + src/gui.c, src/gui_mac.c, src/gui_w48.c, src/main.c, src/mark.c, + src/menu.c, src/misc2.c, src/move.c, src/netbeans.c, src/normal.c, + src/ops.c, src/option.c, src/os_msdos.c, src/os_qnx.c, + src/quickfix.c, src/regexp.c, src/regexp_nfa.c, src/screen.c, + src/search.c, src/spell.c, src/syntax.c, src/term.c, src/ui.c, + src/undo.c, src/version.c, src/window.c, src/feature.h, + src/globals.h, src/option.h, src/os_win32.h, src/structs.h + +Patch 7.4.213 +Problem: It's not possible to open a new buffer without creating a swap + file. +Solution: Add the ":noswapfile" modifier. (Christian Brabandt) +Files: runtime/doc/recover.txt, src/ex_cmds.h, src/ex_docmd.c, + src/memline.c, src/structs.h + +Patch 7.4.214 +Problem: Compilation problems on HP_nonStop (Tandem). +Solution: Add #defines. (Joachim Schmitz) +Files: src/vim.h + +Patch 7.4.215 +Problem: Inconsistency: ":sp foo" does not reload "foo", unless "foo" is + the current buffer. (Liang Li) +Solution: Do not reload the current buffer on a split command. +Files: runtime/doc/windows.txt, src/ex_docmd.c + +Patch 7.4.216 +Problem: Compiler warnings. (Tony Mechelynck) +Solution: Initialize variables, add #ifdef. +Files: src/term.c, src/os_unix.h + +Patch 7.4.217 +Problem: When src/auto/configure was updated, "make clean" would run + configure pointlessly. +Solution: Do not run configure for "make clean" and "make distclean" when + the make program supports $MAKECMDGOALS. (Ken Takata) +Files: src/Makefile + +Patch 7.4.218 +Problem: It's not easy to remove duplicates from a list. +Solution: Add the uniq() function. (Lcd) +Files: runtime/doc/change.txt, runtime/doc/eval.txt, + runtime/doc/usr_41.txt, runtime/doc/version7.txt, src/eval.c, + src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.219 +Problem: When 'relativenumber' or 'cursorline' are set the window is + redrawn much to often. (Patrick Hemmer, Dominique Pelle) +Solution: Check the VALID_CROW flag instead of VALID_WROW. +Files: src/move.c + +Patch 7.4.220 +Problem: Test 105 does not work in a shadow dir. (James McCoy) +Solution: Omit "src/" from the checked path. +Files: src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.221 +Problem: Quickfix doesn't resize on ":copen 20". (issue 199) +Solution: Resize the window when requested. (Christian Brabandt) +Files: src/quickfix.c + +Patch 7.4.222 +Problem: The Ruby directory is constructed from parts. +Solution: Use 'rubyarchhdrdir' if it exists. (James McCoy) +Files: src/configure.in, src/auto/configure + +Patch 7.4.223 +Problem: Still using an older autoconf version. +Solution: Switch to autoconf 2.69. +Files: src/Makefile, src/configure.in, src/auto/configure + +Patch 7.4.224 +Problem: /usr/bin/grep on Solaris does not support -F. +Solution: Add configure check to find a good grep. (Danek Duvall) +Files: src/configure.in, src/auto/configure + +Patch 7.4.225 +Problem: Dynamic Ruby doesn't work on Solaris. +Solution: Always use the stubs. (Danek Duvall, Yukihiro Nakadaira) +Files: src/if_ruby.c + +Patch 7.4.226 (after 7.4.219) +Problem: Cursurline highlighting not redrawn when scrolling. (John + Marriott) +Solution: Check for required redraw in two places. +Files: src/move.c + +Patch 7.4.227 (after 7.4.225) +Problem: Can't build with Ruby 1.8. +Solution: Do include a check for the Ruby version. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.228 +Problem: Compiler warnings when building with Python 3.2. +Solution: Make type cast depend on Python version. (Ken Takata) +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.229 +Problem: Using ":let" for listing variables and the second one is a curly + braces expression may fail. +Solution: Check for an "=" in a better way. (ZyX) +Files: src/eval.c, src/testdir/test104.in, src/testdir/test104.ok + +Patch 7.4.230 +Problem: Error when using ":options". +Solution: Fix the entry for 'lispwords'. (Kenichi Ito) +Files: runtime/optwin.vim + +Patch 7.4.231 +Problem: An error in ":options" is not caught by the tests. +Solution: Add a test for ":options". Set $VIMRUNTIME for the tests so that + it uses the current runtime files instead of the installed ones. +Files: src/Makefile, src/testdir/Makefile, src/testdir/test_options.in, + src/testdir/test_options.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms + +Patch 7.4.232 +Problem: ":%s/\n//" uses a lot of memory. (Aidan Marlin) +Solution: Turn this into a join command. (Christian Brabandt) +Files: src/ex_cmds.c, src/ex_docmd.c, src/proto/ex_docmd.pro + +Patch 7.4.233 +Problem: Escaping special characters for using "%" with a shell command is + inconsistent, parentheses are escaped but spaces are not. +Solution: Only escape "!". (Gary Johnson) +Files: src/ex_docmd.c + +Patch 7.4.234 +Problem: Can't get the command that was used to start Vim. +Solution: Add v:progpath. (Viktor Kojouharov) +Files: runtime/doc/eval.txt, src/eval.c, src/main.c, src/vim.h + +Patch 7.4.235 +Problem: It is not easy to get the full path of a command. +Solution: Add the exepath() function. +Files: src/eval.c, src/misc1.c, src/os_amiga.c, src/os_msdos.c, + src/os_unix.c, src/os_vms.c, src/os_win32.c, + src/proto/os_amiga.pro, src/proto/os_msdos.pro, + src/proto/os_unix.pro, src/proto/os_win32.pro, + runtime/doc/eval.txt + +Patch 7.4.236 +Problem: It's not that easy to check the Vim patch version. +Solution: Make has("patch-7.4.123") work. (partly by Marc Weber) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test60.in, + src/testdir/test60.ok + +Patch 7.4.237 (after 7.4.236) +Problem: When some patches were not included has("patch-7.4.123") may return + true falsely. +Solution: Check for the specific patch number. +Files: runtime/doc/eval.txt, src/eval.c + +Patch 7.4.238 +Problem: Vim does not support the smack library. +Solution: Add smack support (Jose Bollo) +Files: src/config.h.in, src/configure.in, src/fileio.c, src/memfile.c, + src/os_unix.c, src/undo.c, src/auto/configure + +Patch 7.4.239 +Problem: ":e +" does not position cursor at end of the file. +Solution: Check for "+" being the last character (ZyX) +Files: src/ex_docmd.c + +Patch 7.4.240 +Problem: ":tjump" shows "\n" as "\\n". +Solution: Skip over "\" that escapes a backslash. (Gary Johnson) +Files: src/tag.c + +Patch 7.4.241 +Problem: The string returned by submatch() does not distinguish between a + NL from a line break and a NL that stands for a NUL character. +Solution: Add a second argument to return a list. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c, src/proto/regexp.pro, + src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok, + src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.242 +Problem: getreg() does not distinguish between a NL used for a line break + and a NL used for a NUL character. +Solution: Add another argument to return a list. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c src/ops.c, src/proto/ops.pro, + src/vim.h, src/Makefile, src/testdir/test_eval.in, + src/testdir/test_eval.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms + +Patch 7.4.243 +Problem: Cannot use setreg() to add text that includes a NUL. +Solution: Make setreg() accept a list. +Files: runtime/doc/eval.txt, src/eval.c, src/ops.c, src/proto/ops.pro, + src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.244 (after 7.4.238) +Problem: The smack feature causes stray error messages. +Solution: Remove the error messages. +Files: src/os_unix.c + +Patch 7.4.245 +Problem: Crash for "vim -u NONE -N -c '&&'". +Solution: Check for the pattern to be NULL. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.246 +Problem: Configure message for detecting smack are out of sequence. +Solution: Put the messages in the right place. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.247 +Problem: When passing input to system() there is no way to keep NUL and + NL characters separate. +Solution: Optionally use a list for the system() input. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c + +Patch 7.4.248 +Problem: Cannot distinguish between NL and NUL in output of system(). +Solution: Add systemlist(). (ZyX) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_cmds2.c, src/misc1.c, + src/proto/misc1.pro + +Patch 7.4.249 +Problem: Using setreg() with a list of numbers does not work. +Solution: Use a separate buffer for numbers. (ZyX) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.250 +Problem: Some test files missing from distribution. +Solution: Add pattern for newly added tests. +Files: Filelist + +Patch 7.4.251 +Problem: Crash when BufAdd autocommand wipes out the buffer. +Solution: Check for buffer to still be valid. Postpone freeing the buffer + structure. (Hirohito Higashi) +Files: src/buffer.c, src/ex_cmds.c, src/fileio.c, src/globals.h + +Patch 7.4.252 +Problem: Critical error in GTK, removing timer twice. +Solution: Clear the timer after removing it. (James McCoy) +Files: src/gui_gtk_x11.c + +Patch 7.4.253 +Problem: Crash when using cpp syntax file with pattern using external + match. (Havard Garnes) +Solution: Discard match when end column is before start column. +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.254 +Problem: Smack support detection is incomplete. +Solution: Check for attr/xattr.h and specific macro. +Files: src/configure.in, src/auto/configure + +Patch 7.4.255 +Problem: Configure check for smack doesn't work with all shells. (David + Larson) +Solution: Remove spaces in set command. +Files: src/configure.in, src/auto/configure + +Patch 7.4.256 (after 7.4.248) +Problem: Using systemlist() may cause a crash and does not handle NUL + characters properly. +Solution: Increase the reference count, allocate memory by length. (Yasuhiro + Matsumoto) +Files: src/eval.c + +Patch 7.4.257 +Problem: Compiler warning, possibly for mismatch in parameter name. +Solution: Rename the parameter in the declaration. +Files: src/ops.c + +Patch 7.4.258 +Problem: Configure fails if $CC contains options. +Solution: Remove quotes around $CC. (Paul Barker) +Files: src/configure.in, src/auto/configure + +Patch 7.4.259 +Problem: Warning for misplaced "const". +Solution: Move the "const". (Yukihiro Nakadaira) +Files: src/os_unix.c + +Patch 7.4.260 +Problem: It is possible to define a function with a colon in the name. It + is possible to define a function with a lower case character if a + "#" appears after the name. +Solution: Disallow using a colon other than with "s:". Ignore "#" after the + name. +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_eval.in, + src/testdir/test_eval.ok + +Patch 7.4.261 +Problem: When updating the window involves a regexp pattern, an interactive + substitute to replace a "\n" with a line break fails. (Ingo + Karkat) +Solution: Set reg_line_lbr in vim_regsub() and vim_regsub_multi(). +Files: src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok + +Patch 7.4.262 +Problem: Duplicate code in regexec(). +Solution: Add line_lbr flag to regexec_nl(). +Files: src/regexp.c, src/regexp_nfa.c, src/regexp.h + +Patch 7.4.263 +Problem: GCC 4.8 compiler warning for hiding a declaration (François Gannaz) +Solution: Remove the second declaration. +Files: src/eval.c + +Patch 7.4.264 (after 7.4.260) +Problem: Can't define a function starting with "g:". Can't assign a + funcref to a buffer-local variable. +Solution: Skip "g:" at the start of a function name. Don't check for colons + when assigning to a variable. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.265 (after 7.4.260) +Problem: Can't call a global function with "g:" in an expression. +Solution: Skip the "g:" when looking up the function. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.266 +Problem: Test 62 fails. +Solution: Set the language to C. (Christian Brabandt) +Files: src/testdir/test62.in + +Patch 7.4.267 (after 7.4.178) +Problem: The '[ mark is in the wrong position after "gq". (Ingo Karkat) +Solution: Add the setmark argument to do_join(). (Christian Brabandt) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_autoformat_join.in, + src/testdir/test_autoformat_join.ok, src/Makefile, src/edit.c, + src/ex_cmds.c, src/ex_docmd.c, src/normal.c, src/ops.c, + src/proto/ops.pro + +Patch 7.4.268 +Problem: Using exists() on a funcref for a script-local function does not + work. +Solution: Translate <SNR> to the special byte sequence. Add a test. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + src/testdir/test_eval_func.vim, Filelist + +Patch 7.4.269 +Problem: CTRL-U in Insert mode does not work after using a cursor key. + (Pine Wu) +Solution: Use the original insert start position. (Christian Brabandt) +Files: src/edit.c, src/testdir/test29.in, src/testdir/test29.ok + +Patch 7.4.270 +Problem: Comparing pointers instead of the string they point to. +Solution: Use strcmp(). (Ken Takata) +Files: src/gui_gtk_x11.c + +Patch 7.4.271 +Problem: Compiler warning on 64 bit windows. +Solution: Add type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.272 +Problem: Using just "$" does not cause an error message. +Solution: Check for empty environment variable name. (Christian Brabandt) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.273 +Problem: "make autoconf" and "make reconfig" may first run configure and + then remove the output. +Solution: Add these targets to the exceptions. (Ken Takata) +Files: src/Makefile + +Patch 7.4.274 +Problem: When doing ":update" just before running an external command that + changes the file, the timestamp may be unchanged and the file + is not reloaded. +Solution: Also check the file size. +Files: src/fileio.c + +Patch 7.4.275 +Problem: When changing the type of a sign that hasn't been placed there is + no error message. +Solution: Add an error message. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.276 +Problem: The fish shell is not supported. +Solution: Use begin/end instead of () for fish. (Andy Russell) +Files: src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro + +Patch 7.4.277 +Problem: Using ":sign unplace *" may leave the cursor in the wrong position + (Christian Brabandt) +Solution: Update the cursor position when removing all signs. +Files: src/buffer.c + +Patch 7.4.278 +Problem: list_remove() conflicts with function defined in Sun header file. +Solution: Rename the function. (Richard Palo) +Files: src/eval.c, src/if_lua.c, src/if_py_both.h, src/proto/eval.pro + +Patch 7.4.279 +Problem: globpath() returns a string, making it difficult to get a list of + matches. (Greg Novack) +Solution: Add an optional argument like with glob(). (Adnan Zafar) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_getln.c, src/misc1.c, + src/misc2.c, src/proto/ex_getln.pro, src/proto/misc2.pro, + src/testdir/test97.in, src/testdir/test97.ok + +Patch 7.4.280 +Problem: When using a session file the relative position of the cursor is + not restored if there is another tab. (Nobuhiro Takasaki) +Solution: Update w_wrow before calculating the fraction. +Files: src/window.c + +Patch 7.4.281 +Problem: When a session file has more than one tabpage and 'showtabline' is + one the positions may be slightly off. +Solution: Set 'showtabline' to two while positioning windows. +Files: src/ex_docmd.c + +Patch 7.4.282 (after 7.4.279) +Problem: Test 97 fails on Mac. +Solution: Do not ignore case in file names. (Jun Takimoto) +Files: src/testdir/test97.in + +Patch 7.4.283 (after 7.4.276) +Problem: Compiler warning about unused variable. (Charles Cooper) +Solution: Move the variable inside the #if block. +Files: src/ex_cmds.c + +Patch 7.4.284 +Problem: Setting 'langmap' in the modeline can cause trouble. E.g. mapping + ":" breaks many commands. (Jens-Wolfhard Schicke-Uffmann) +Solution: Disallow setting 'langmap' from the modeline. +Files: src/option.c + +Patch 7.4.285 +Problem: When 'relativenumber' is set and deleting lines or undoing that, + line numbers are not always updated. (Robert Arkwright) +Solution: (Christian Brabandt) +Files: src/misc1.c + +Patch 7.4.286 +Problem: Error messages are inconsistent. (ZyX) +Solution: Change "Lists" to "list". +Files: src/eval.c + +Patch 7.4.287 +Problem: Patches for .hgignore don't work, since the file is not in the + distribution. +Solution: Add .hgignore to the distribution. Will be effective with the + next version. +Files: Filelist + +Patch 7.4.288 +Problem: When 'spellfile' is set the screen is not redrawn. +Solution: Redraw when updating the spelling info. (Christian Brabandt) +Files: src/spell.c + +Patch 7.4.289 +Problem: Pattern with repeated backreference does not match with new regexp + engine. (Urtica Dioica) +Solution: Also check the end of a submatch when deciding to put a state in + the state list. +Files: src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c + +Patch 7.4.290 +Problem: A non-greedy match followed by a branch is too greedy. (Ingo + Karkat) +Solution: Add NFA_MATCH when it is already in the state list if the position + differs. +Files: src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c + +Patch 7.4.291 +Problem: Compiler warning for int to pointer of different size when DEBUG + is defined. +Solution: use smsg() instead of EMSG3(). +Files: src/regexp.c + +Patch 7.4.292 +Problem: Searching for "a" does not match accented "a" with new regexp + engine, does match with old engine. (David Bürgin) + "ca" does not match "ca" with accented "a" with either engine. +Solution: Change the old engine, check for following composing character + also for single-byte patterns. +Files: src/regexp.c, src/testdir/test95.in, src/testdir/test95.ok + +Patch 7.4.293 +Problem: It is not possible to ignore composing characters at a specific + point in a pattern. +Solution: Add the %C item. +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test95.in, + src/testdir/test95.ok, runtime/doc/pattern.txt + +Patch 7.4.294 (7.4.293) +Problem: Test files missing from patch. +Solution: Patch the test files. +Files: src/testdir/test95.in, src/testdir/test95.ok + +Patch 7.4.295 +Problem: Various typos, bad white space and unclear comments. +Solution: Fix typos. Improve white space. Update comments. +Files: src/testdir/test49.in, src/macros.h, src/screen.c, src/structs.h, + src/gui_gtk_x11.c, src/os_unix.c + +Patch 7.4.296 +Problem: Can't run tests on Solaris. +Solution: Change the way VIMRUNTIME is set. (Laurent Blume) +Files: src/testdir/Makefile + +Patch 7.4.297 +Problem: Memory leak from result of get_isolated_shell_name(). +Solution: Free the memory. (Dominique Pelle) +Files: src/ex_cmds.c, src/misc1.c + +Patch 7.4.298 +Problem: Can't have a funcref start with "t:". +Solution: Add "t" to the list of accepted names. (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.299 +Problem: When running configure twice DYNAMIC_PYTHON_DLL may become empty. +Solution: Use AC_CACHE_VAL. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.300 +Problem: The way config.cache is removed doesn't always work. +Solution: Always remove config.cache. (Ken Takata) +Files: src/Makefile + +Patch 7.4.301 (after 7.4.280) +Problem: Still a scrolling problem when loading a session file. +Solution: Fix off-by-one mistake. (Nobuhiro Takasaki) +Files: src/window.c + +Patch 7.4.302 +Problem: Signs placed with 'foldcolumn' set don't show up after filler + lines. +Solution: Take filler lines into account. (Olaf Dabrunz) +Files: src/screen.c + +Patch 7.4.303 +Problem: When using double-width characters the text displayed on the + command line is sometimes truncated. +Solution: Reset the string length. (Nobuhiro Takasaki) +Files: src/screen.c + +Patch 7.4.304 +Problem: Cannot always use Python with Vim. +Solution: Add the manifest to the executable. (Jacques Germishuys) +Files: src/Make_mvc.mak + +Patch 7.4.305 +Problem: Making 'ttymouse' empty after the xterm version was requested + causes problems. (Elijah Griffin) +Solution: Do not check for DEC mouse sequences when the xterm version was + requested. Also don't request the xterm version when DEC mouse + was enabled. +Files: src/term.c, src/os_unix.c, src/proto/term.pro, src/globals.h + +Patch 7.4.306 +Problem: getchar(0) does not return Esc. +Solution: Do not wait for an Esc sequence to be complete. (Yasuhiro + Matsumoto) +Files: src/eval.c, src/getchar.c + +Patch 7.4.307 (after 7.4.305) +Problem: Can't build without the +termresponse feature. +Solution: Add proper #ifdefs. +Files: src/os_unix.c, src/term.c + +Patch 7.4.308 +Problem: When using ":diffsplit" on an empty file the cursor is displayed + on the command line. +Solution: Limit the value of w_topfill. +Files: src/diff.c + +Patch 7.4.309 +Problem: When increasing the size of the lower window, the upper window + jumps back to the top. (Ron Aaron) +Solution: Change setting the topline. (Nobuhiro Takasaki) +Files: src/window.c + +Patch 7.4.310 +Problem: getpos()/setpos() don't include curswant. +Solution: Add a fifth number when getting/setting the cursor. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + runtime/doc/eval.txt + +Patch 7.4.311 +Problem: Can't use winrestview to only restore part of the view. +Solution: Handle missing items in the dict. (Christian Brabandt) +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.312 +Problem: Cannot figure out what argument list is being used for a window. +Solution: Add the arglistid() function. (Marcin Szamotulski) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/ex_docmd.c, src/globals.h, src/structs.h, src/main.c + +Patch 7.4.313 (after 7.4.310) +Problem: Changing the return value of getpos() causes an error. (Jie Zhu) +Solution: Revert getpos() and add getcurpos(). +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + runtime/doc/eval.txt + +Patch 7.4.314 +Problem: Completion messages can get in the way of a plugin. +Solution: Add 'c' flag to 'shortmess' option. (Shougo Matsu) +Files: runtime/doc/options.txt, src/edit.c, src/option.h, src/screen.c + +Patch 7.4.315 (after 7.4.309) +Problem: Fixes for computation of topline not tested. +Solution: Add test. (Hirohito Higashi) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test107.in, src/testdir/test107.ok + +Patch 7.4.316 +Problem: Warning from 64-bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/ex_getln.c + +Patch 7.4.317 +Problem: Crash when starting gvim. Issue 230. +Solution: Check for a pointer to be NULL. (Christian Brabandt) +Files: src/window.c + +Patch 7.4.318 +Problem: Check for whether a highlight group has settings ignores fg and bg + color settings. +Solution: Also check cterm and GUI color settings. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.319 +Problem: Crash when putting zero bytes on the clipboard. +Solution: Do not support the utf8_atom target when not using a Unicode + encoding. (Naofumi Honda) +Files: src/ui.c + +Patch 7.4.320 +Problem: Possible crash when an BufLeave autocommand deletes the buffer. +Solution: Check for the window pointer being valid. Postpone freeing the + window until autocommands are done. (Yasuhiro Matsumoto) +Files: src/buffer.c, src/fileio.c, src/globals.h, src/window.c + +Patch 7.4.321 +Problem: Can't build with strawberry perl 5.20 + mingw-w64-4.9.0. +Solution: Define save_strlen. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.322 +Problem: Using "msgfmt" is hard coded, cannot use "gmsgfmt". +Solution: Use the msgfmt command found by configure. (Danek Duvall) +Files: src/config.mk.in, src/po/Makefile + +Patch 7.4.323 +Problem: Substitute() with zero width pattern breaks multi-byte character. +Solution: Take multi-byte character size into account. (Yukihiro Nakadaira) +Files: src/eval.c src/testdir/test69.in, src/testdir/test69.ok + +Patch 7.4.324 +Problem: In Ex mode, cyrillic characters are not handled. (Stas Malavin) +Solution: Support multi-byte characters in Ex mode. (Yukihiro Nakadaira) +Files: src/ex_getln.c + +Patch 7.4.325 +Problem: When starting the gui and changing the window size the status line + may not be drawn correctly. +Solution: Catch new_win_height() being called recursively. (Christian + Brabandt) +Files: src/window.c + +Patch 7.4.326 +Problem: Can't build Tiny version. (Elimar Riesebieter) +Solution: Add #ifdef. +Files: src/window.c + +Patch 7.4.327 +Problem: When 'verbose' is set to display the return value of a function, + may get E724 repeatedly. +Solution: Do not give an error for verbose messages. Abort conversion to + string after an error. +Files: src/eval.c + +Patch 7.4.328 +Problem: Selection of inner block is inconsistent. +Solution: Skip indent not only for '}' but all parens. (Tom McDonald) +Files: src/search.c + +Patch 7.4.329 +Problem: When moving the cursor and then switching to another window the + previous window isn't scrolled. (Yukihiro Nakadaira) +Solution: Call update_topline() before leaving the window. (Christian + Brabandt) +Files: src/window.c + +Patch 7.4.330 +Problem: Using a regexp pattern to highlight a specific position can be + slow. +Solution: Add matchaddpos() to highlight specific positions efficiently. + (Alexey Radkov) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, + runtime/plugin/matchparen.vim, src/eval.c, src/ex_docmd.c, + src/proto/window.pro, src/screen.c, src/structs.h, + src/testdir/test63.in, src/testdir/test63.ok, src/window.c + +Patch 7.4.331 +Problem: Relative numbering not updated after a linewise yank. Issue 235. +Solution: Redraw after the yank. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.332 +Problem: GTK: When a sign icon doesn't fit exactly there can be ugly gaps. +Solution: Scale the sign to fit when the aspect ratio is not too far off. + (Christian Brabandt) +Files: src/gui_gtk_x11.c + +Patch 7.4.333 +Problem: Compiler warning for unused function. +Solution: Put the function inside the #ifdef. +Files: src/screen.c + +Patch 7.4.334 (after 7.4.330) +Problem: Uninitialized variables, causing some problems. +Solution: Initialize the variables. (Dominique Pelle) +Files: src/screen.c, src/window.c + +Patch 7.4.335 +Problem: No digraph for the new rouble sign. +Solution: Add the digraphs =R and =P. +Files: src/digraph.c, runtime/doc/digraph.txt + +Patch 7.4.336 +Problem: Setting 'history' to a big value causes out-of-memory errors. +Solution: Limit the value to 10000. (Hirohito Higashi) +Files: runtime/doc/options.txt, src/option.c + +Patch 7.4.337 +Problem: When there is an error preparing to edit the command line, the + command won't be executed. (Hirohito Higashi) +Solution: Reset did_emsg before editing. +Files: src/ex_getln.c + +Patch 7.4.338 +Problem: Cannot wrap lines taking indent into account. +Solution: Add the 'breakindent' option. (many authors, final improvements by + Christian Brabandt) +Files: runtime/doc/eval.txt, runtime/doc/options.txt, runtime/optwin.vim, + src/buffer.c, src/charset.c, src/edit.c, src/ex_getln.c, + src/getchar.c, src/misc1.c, src/misc2.c, src/ops.c, src/option.c, + src/option.h, src/proto/charset.pro, src/proto/misc1.pro, + src/proto/option.pro, src/screen.c, src/structs.h, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok, + src/ui.c, src/version.c + +Patch 7.4.339 +Problem: Local function is available globally. +Solution: Add "static". +Files: src/option.c, src/proto/option.pro + +Patch 7.4.340 +Problem: Error from sed about illegal bytes when installing Vim. +Solution: Prepend LC_ALL=C. (Itchyny) +Files: src/installman.sh + +Patch 7.4.341 +Problem: sort() doesn't handle numbers well. +Solution: Add an argument to specify sorting on numbers. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.342 +Problem: Clang gives warnings. +Solution: Add an else block. (Dominique Pelle) +Files: src/gui_beval.c + +Patch 7.4.343 +Problem: matchdelete() does not always update the right lines. +Solution: Fix off-by-one error. (Ozaki Kiichi) +Files: src/window.c + +Patch 7.4.344 +Problem: Unnecessary initializations and other things related to + matchaddpos(). +Solution: Code cleanup. (Alexey Radkov) +Files: runtime/doc/eval.txt, src/screen.c, src/window.c + +Patch 7.4.345 (after 7.4.338) +Problem: Indent is not updated when deleting indent. +Solution: Remember changedtick. +Files: src/misc1.c + +Patch 7.4.346 (after 7.4.338) +Problem: Indent is not updated when changing 'breakindentopt'. (itchyny) +Solution: Do not cache "brishift". (Christian Brabandt) +Files: src/misc1.c + +Patch 7.4.347 +Problem: test55 fails on some systems. +Solution: Remove the elements that all result in zero and can end up in an + arbitrary position. +Files: src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.348 +Problem: When using "J1" in 'cinoptions' a line below a continuation line + gets too much indent. +Solution: Fix parentheses in condition. +Files: src/misc1.c + +Patch 7.4.349 +Problem: When there are matches to highlight the whole window is redrawn, + which is slow. +Solution: Only redraw everything when lines were inserted or deleted. + Reset b_mod_xlines when needed. (Alexey Radkov) +Files: src/screen.c, src/window.c + +Patch 7.4.350 +Problem: Using C indenting for Javascript does not work well for a {} block + inside parentheses. +Solution: When looking for a matching paren ignore one that is before the + start of a {} block. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.351 +Problem: sort() is not stable. +Solution: When the items are identical, compare the pointers. +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.352 +Problem: With 'linebreak' a tab causes a missing line break. +Solution: Count a tab for what it's worth also for shorter lines. + (Christian Brabandt) +Files: src/charset.c + +Patch 7.4.353 +Problem: 'linebreak' doesn't work with the 'list' option. +Solution: Make it work. (Christian Brabandt) +Files: runtime/doc/options.txt, src/charset.c, src/screen.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_listlbr.in, src/testdir/test_listlbr.ok + +Patch 7.4.354 +Problem: Compiler warning. +Solution: Change NUL to NULL. (Ken Takata) +Files: src/screen.c + +Patch 7.4.355 +Problem: Several problems with Javascript indenting. +Solution: Improve Javascript indenting. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.356 +Problem: Mercurial does not ignore memfile_test. (Daniel Hahler) +Solution: Add memfile_test to ignored files, remove trailing spaces. +Files: .hgignore + +Patch 7.4.357 +Problem: After completion some characters are not redrawn. +Solution: Clear the command line unconditionally. (Jacob Niehus) +Files: src/edit.c + +Patch 7.4.358 (after 7.4.351) +Problem: Sort is not always stable. +Solution: Add an index instead of relying on the pointer to remain the same. + Idea by Jun Takimoto. +Files: src/eval.c + +Patch 7.4.359 +Problem: When 'ttymouse' is set to 'uxterm' the xterm version is not + requested. (Tomas Janousek) +Solution: Do not mark uxterm as a conflict mouse and add + resume_get_esc_sequence(). +Files: src/term.c, src/os_unix.c, src/proto/term.pro + +Patch 7.4.360 +Problem: In a regexp pattern a "$" followed by \v or \V is not seen as the + end-of-line. +Solution: Handle the situation. (Ozaki Kiichi) +Files: src/regexp.c + +Patch 7.4.361 +Problem: Lots of flickering when filling the preview window for 'omnifunc'. +Solution: Disable redrawing. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 7.4.362 +Problem: When matchaddpos() uses a length smaller than the number of bytes + in the (last) character the highlight continues until the end of + the line. +Solution: Change condition from equal to larger-or-equal. +Files: src/screen.c + +Patch 7.4.363 +Problem: In Windows console typing 0xCE does not work. +Solution: Convert 0xCE to K_NUL 3. (Nobuhiro Takasaki et al.) +Files: src/os_win32.c, src/term.c + +Patch 7.4.364 +Problem: When the viminfo file can't be renamed there is no error message. + (Vladimir Berezhnoy) +Solution: Check for the rename to fail. +Files: src/ex_cmds.c + +Patch 7.4.365 +Problem: Crash when using ":botright split" when there isn't much space. +Solution: Add a check for the minimum width/height. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.366 +Problem: Can't run the linebreak test on MS-Windows. +Solution: Fix the output file name. (Taro Muraoka) +Files: src/testdir/Make_dos.mak + +Patch 7.4.367 (after 7.4.357) +Problem: Other solution for redrawing after completion. +Solution: Schedule a window redraw instead of just clearing the command + line. (Jacob Niehus) +Files: src/edit.c + +Patch 7.4.368 +Problem: Restoring the window sizes after closing the command line window + doesn't work properly if there are nested splits. +Solution: Restore the sizes twice. (Hirohito Higashi) +Files: src/window.c + +Patch 7.4.369 +Problem: Using freed memory when exiting while compiled with EXITFREE. +Solution: Set curwin to NULL and check for that. (Dominique Pelle) +Files: src/buffer.c, src/window.c + +Patch 7.4.370 +Problem: Linebreak test fails when encoding is not utf-8. (Danek Duvall) +Solution: Split the test in a single byte one and a utf-8 one. (Christian + Brabandt) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_listlbr.in, src/testdir/test_listlbr.ok, + src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.371 +Problem: When 'linebreak' is set control characters are not correctly + displayed. (Kimmy Lindvall) +Solution: Set n_extra. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.372 +Problem: When 'winminheight' is zero there might not be one line for the + current window. +Solution: Change the size computations. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.373 +Problem: Compiler warning for unused argument and unused variable. +Solution: Add UNUSED. Move variable inside #ifdef. +Files: src/charset.c, src/window.c + +Patch 7.4.374 +Problem: Character after "fb" command not mapped if it might be a composing + character. +Solution: Don't disable mapping when looking for a composing character. + (Jacob Niehus) +Files: src/normal.c + +Patch 7.4.375 +Problem: Test 63 fails when run with GUI-only Vim. +Solution: Add guibg attributes. (suggested by Mike Soyka) +Files: src/testdir/test63.in + +Patch 7.4.376 (after 7.4.367) +Problem: Popup menu flickers too much. +Solution: Remove the forced redraw. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.377 +Problem: When 'equalalways' is set a split may report "no room" even though + there is plenty of room. +Solution: Compute the available room properly. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.378 +Problem: Title of quickfix list is not kept for setqflist(list, 'r'). +Solution: Keep the title. Add a test. (Lcd) +Files: src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_qf_title.in, + src/testdir/test_qf_title.ok + +Patch 7.4.379 +Problem: Accessing freed memory after using setqflist(list, 'r'). (Lcd) +Solution: Reset qf_index. +Files: src/quickfix.c + +Patch 7.4.380 +Problem: Loading python may cause Vim to exit. +Solution: Avoid loading the "site" module. (Taro Muraoka) +Files: src/if_python.c + +Patch 7.4.381 +Problem: Get u_undo error when backspacing in Insert mode deletes more than + one line break. (Ayberk Ozgur) +Solution: Also decrement Insstart.lnum. +Files: src/edit.c + +Patch 7.4.382 +Problem: Mapping characters may not work after typing Esc in Insert mode. +Solution: Fix the noremap flags for inserted characters. (Jacob Niehus) +Files: src/getchar.c + +Patch 7.4.383 +Problem: Bad interaction between preview window and omnifunc. +Solution: Avoid redrawing the status line. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 7.4.384 +Problem: Test 102 fails when compiled with small features. +Solution: Source small.vim. (Jacob Niehus) +Files: src/testdir/test102.in + +Patch 7.4.385 +Problem: When building with tiny or small features building the .mo files + fails. +Solution: In autoconf do not setup for building the .mo files when it would + fail. +Files: src/configure.in, src/auto/configure + +Patch 7.4.386 +Problem: When splitting a window the changelist position is wrong. +Solution: Copy the changelist position. (Jacob Niehus) +Files: src/window.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_changelist.in, + src/testdir/test_changelist.ok + +Patch 7.4.387 +Problem: "4gro" replaces one character then executes "ooo". (Urtica Dioica) +Solution: Write the ESC in the second stuff buffer. +Files: src/getchar.c, src/proto/getchar.pro, src/edit.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_insertcount.in, src/testdir/test_insertcount.ok + +Patch 7.4.388 +Problem: With 'linebreak' set and 'list' unset a Tab is not counted + properly. (Kent Sibilev) +Solution: Check the 'list' option. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.389 +Problem: Still sometimes Vim enters Replace mode when starting up. +Solution: Use a different solution in detecting the termresponse and + location response. (Hayaki Saito) +Files: src/globals.h, src/os_unix.c, src/term.c, src/proto/term.pro + +Patch 7.4.390 +Problem: Advancing pointer over end of a string. +Solution: Init quote character to -1 instead of zero. (Dominique Pelle) +Files: src/misc1.c + +Patch 7.4.391 +Problem: No 'cursorline' highlighting when the cursor is on a line with + diff highlighting. (Benjamin Fritz) +Solution: Combine the highlight attributes. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.392 +Problem: Not easy to detect type of command line window. +Solution: Add the getcmdwintype() function. (Jacob Niehus) +Files: src/eval.c + +Patch 7.4.393 +Problem: Text drawing on newer MS-Windows systems is suboptimal. Some + multi-byte characters are not displayed, even though the same font + in Notepad can display them. (Srinath Avadhanula) +Solution: Add the 'renderoptions' option to enable DirectX drawing. (Taro + Muraoka) +Files: runtime/doc/eval.txt, runtime/doc/options.txt, + runtime/doc/various.txt, src/Make_cyg.mak, src/Make_ming.mak, + src/Make_mvc.mak, src/eval.c, src/gui_dwrite.cpp, + src/gui_dwrite.h, src/gui_w32.c, src/gui_w48.c, src/option.c, + src/option.h, src/version.c, src/vim.h, src/proto/gui_w32.pro + +Patch 7.4.394 (after 7.4.393) +Problem: When using DirectX last italic character is incomplete. +Solution: Add one to the number of cells. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.395 (after 7.4.355) +Problem: C indent is wrong below an if with wrapped condition followed by + curly braces. (Trevor Powell) +Solution: Make a copy of tryposBrace. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.396 +Problem: When 'clipboard' is "unnamed", :g/pat/d is very slow. (Praful) +Solution: Only set the clipboard after the last delete. (Christian Brabandt) +Files: src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/globals.h, + src/ops.c, src/proto/ui.pro, src/ui.c + +Patch 7.4.397 +Problem: Matchparen only uses the topmost syntax item. +Solution: Go through the syntax stack to find items. (James McCoy) + Also use getcurpos() when possible. +Files: runtime/plugin/matchparen.vim + +Patch 7.4.398 (after 7.4.393) +Problem: Gcc error for the argument of InterlockedIncrement() and + InterlockedDecrement(). (Axel Bender) +Solution: Remove "unsigned" from the cRefCount_ declaration. +Files: src/gui_dwrite.cpp + +Patch 7.4.399 +Problem: Encryption implementation is messy. Blowfish encryption has a + weakness. +Solution: Refactor the encryption, store the state in an allocated struct + instead of using a save/restore mechanism. Introduce the + "blowfish2" method, which does not have the weakness and encrypts + the whole undo file. (largely by David Leadbeater) +Files: runtime/doc/editing.txt, runtime/doc/options.txt, src/Makefile, + src/blowfish.c, src/crypt.c, src/crypt_zip.c, src/ex_docmd.c, + src/fileio.c, src/globals.h, src/main.c, src/memline.c, + src/misc2.c, src/option.c, src/proto.h, src/proto/blowfish.pro, + src/proto/crypt.pro, src/proto/crypt_zip.pro, + src/proto/fileio.pro, src/proto/misc2.pro, src/structs.h, + src/undo.c, src/testdir/test71.in, src/testdir/test71.ok, + src/testdir/test71a.in, src/testdir/test72.in, + src/testdir/test72.ok + +Patch 7.4.400 +Problem: List of distributed files is incomplete. +Solution: Add recently added files. +Files: Filelist + +Patch 7.4.401 (after 7.4.399) +Problem: Can't build on MS-Windows. +Solution: Include the new files in all the Makefiles. +Files: src/Make_bc3.mak, src/Make_bc5.mak, src/Make_cyg.mak, + src/Make_dice.mak, src/Make_djg.mak, src/Make_ivc.mak, + src/Make_manx.mak, src/Make_ming.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_os2.mak, src/Make_sas.mak, + Make_vms.mms + +Patch 7.4.402 +Problem: Test 72 crashes under certain conditions. (Kazunobu Kuriyama) +Solution: Clear the whole bufinfo_T early. +Files: src/undo.c + +Patch 7.4.403 +Problem: Valgrind reports errors when running test 72. (Dominique Pelle) +Solution: Reset the local 'cryptmethod' option before storing the seed. + Set the seed in the memfile even when there is no block0 yet. +Files: src/fileio.c, src/option.c, src/memline.c + +Patch 7.4.404 +Problem: Windows 64 bit compiler warnings. +Solution: Add type casts. (Mike Williams) +Files: src/crypt.c, src/undo.c + +Patch 7.4.405 +Problem: Screen updating is slow when using matches. +Solution: Do not use the ">=" as in patch 7.4.362, check the lnum. +Files: src/screen.c, src/testdir/test63.in, src/testdir/test63.ok + +Patch 7.4.406 +Problem: Test 72 and 100 fail on MS-Windows. +Solution: Set fileformat to unix in the tests. (Taro Muraoka) +Files: src/testdir/test72.in, src/testdir/test100.in + +Patch 7.4.407 +Problem: Inserting text for Visual block mode, with cursor movement, + repeats the wrong text. (Aleksandar Ivanov) +Solution: Reset the update_Insstart_orig flag. (Christian Brabandt) +Files: src/edit.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.408 +Problem: Visual block insert breaks a multi-byte character. +Solution: Calculate the position properly. (Yasuhiro Matsumoto) +Files: src/ops.c, src/testdir/test_utf8.in, src/testdir/test_utf8.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.409 +Problem: Can't build with Perl on Fedora 20. +Solution: Find xsubpp in another directory. (Michael Henry) +Files: src/Makefile, src/config.mk.in, src/configure.in, + src/auto/configure + +Patch 7.4.410 +Problem: Fold does not open after search when there is a CmdwinLeave + autocommand. +Solution: Restore KeyTyped. (Jacob Niehus) +Files: src/ex_getln.c + +Patch 7.4.411 +Problem: "foo bar" sorts before "foo" with sort(). (John Little) +Solution: Avoid putting quotes around strings before comparing them. +Files: src/eval.c + +Patch 7.4.412 +Problem: Can't build on Windows XP with MSVC. +Solution: Add SUBSYSTEM_VER to the Makefile. (Yongwei Wu) +Files: src/Make_mvc.mak, src/INSTALLpc.txt + +Patch 7.4.413 +Problem: MS-Windows: Using US international keyboard layout, inserting dead + key by pressing space does not always work. Issue 250. +Solution: Let MS-Windows translate the message. (John Wellesz) +Files: src/gui_w48.c + +Patch 7.4.414 +Problem: Cannot define a command only when it's used. +Solution: Add the CmdUndefined autocommand event. (partly by Yasuhiro + Matsumoto) +Files: runtime/doc/autocmd.txt, src/ex_docmd.c, src/fileio.c, + src/proto/fileio.pro + +Patch 7.4.415 (after 7.4.414) +Problem: Cannot build. Warning for shadowed variable. (John Little) +Solution: Add missing change. Remove declaration. +Files: src/vim.h, src/ex_docmd.c + +Patch 7.4.416 +Problem: Problem with breakindent/showbreak and tabs. +Solution: Handle tabs differently. (Christian Brabandt) +Files: src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok, + src/charset.c + +Patch 7.4.417 +Problem: After splitting a window and setting 'breakindent' the default + minimum with is not respected. +Solution: Call briopt_check() when copying options to a new window. +Files: src/option.c, src/proto/option.pro, + src/testdir/test_breakindent.in + +Patch 7.4.418 +Problem: When leaving ":append" the cursor shape is like in Insert mode. + (Jacob Niehus) +Solution: Do not have State set to INSERT when calling getline(). +Files: src/ex_cmds.c + +Patch 7.4.419 +Problem: When part of a list is locked it's possible to make changes. +Solution: Check if any of the list items is locked before make a change. + (ZyX) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.420 +Problem: It's not obvious how to add a new test. +Solution: Add a README file. (Christian Brabandt) +Files: src/testdir/README.txt + +Patch 7.4.421 +Problem: Crash when searching for "\ze*". (Urtica Dioica) +Solution: Disallow a multi after \ze and \zs. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.422 +Problem: When using conceal with linebreak some text is not displayed + correctly. (Grüner Gimpel) +Solution: Check for conceal mode when using linebreak. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.423 +Problem: expand("$shell") does not work as documented. +Solution: Do not escape the $ when expanding environment variables. +Files: src/os_unix.c, src/misc1.c, src/vim.h + +Patch 7.4.424 +Problem: Get ml_get error when using Python to delete lines in a buffer + that is not in a window. issue 248. +Solution: Do not try adjusting the cursor for a different buffer. +Files: src/if_py_both.h + +Patch 7.4.425 +Problem: When 'showbreak' is used "gj" may move to the wrong position. + (Nazri Ramliy) +Solution: Adjust virtcol when 'showbreak' is set. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.426 +Problem: README File missing from list of files. +Solution: Update the list of files. +Files: Filelist + +Patch 7.4.427 +Problem: When an InsertCharPre autocommand executes system() typeahead may + be echoed and messes up the display. (Jacob Niehus) +Solution: Do not set cooked mode when invoked from ":silent". +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.428 +Problem: executable() may return a wrong result on MS-Windows. +Solution: Change the way SearchPath() is called. (Yasuhiro Matsumoto, Ken + Takata) +Files: src/os_win32.c + +Patch 7.4.429 +Problem: Build fails with fewer features. (Elimar Riesebieter) +Solution: Add #ifdef. +Files: src/normal.c + +Patch 7.4.430 +Problem: test_listlbr fails when compiled with normal features. +Solution: Check for the +conceal feature. +Files: src/testdir/test_listlbr.in + +Patch 7.4.431 +Problem: Compiler warning. +Solution: Add type cast. (Mike Williams) +Files: src/ex_docmd.c + +Patch 7.4.432 +Problem: When the startup code expands command line arguments, setting + 'encoding' will not properly convert the arguments. +Solution: Call get_cmd_argsW() early in main(). (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/main.c, src/os_mswin.c + +Patch 7.4.433 +Problem: Test 75 fails on MS-Windows. +Solution: Use ":normal" instead of feedkeys(). (Michael Soyka) +Files: src/testdir/test75.in + +Patch 7.4.434 +Problem: gettabvar() is not consistent with getwinvar() and getbufvar(). +Solution: Return a dict with all variables when the varname is empty. + (Yasuhiro Matsumoto) +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test91.in, + src/testdir/test91.ok + +Patch 7.4.435 +Problem: Line formatting behaves differently when 'linebreak' is set. + (mvxxc) +Solution: Disable 'linebreak' temporarily. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.436 +Problem: ml_get error for autocommand that moves the cursor of the current + window. +Solution: Check the cursor position after switching back to the current + buffer. (Christian Brabandt) +Files: src/fileio.c + +Patch 7.4.437 +Problem: New and old regexp engine are not consistent. +Solution: Also give an error for "\ze*" for the old regexp engine. +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.438 +Problem: Cached values for 'cino' not reset for ":set all&". +Solution: Call parse_cino(). (Yukihiro Nakadaira) +Files: src/option.c + +Patch 7.4.439 +Problem: Duplicate message in message history. Some quickfix messages + appear twice. (Gary Johnson) +Solution: Do not reset keep_msg too early. (Hirohito Higashi) +Files: src/main.c + +Patch 7.4.440 +Problem: Omni complete popup drawn incorrectly. +Solution: Call validate_cursor() instead of check_cursor(). (Hirohito + Higashi) +Files: src/edit.c + +Patch 7.4.441 +Problem: Endless loop and other problems when 'cedit' is set to CTRL-C. +Solution: Do not call ex_window() when ex_normal_busy or got_int was set. + (Yasuhiro Matsumoto) +Files: src/ex_getln.c + +Patch 7.4.442 (after 7.4.434) +Problem: Using uninitialized variable. +Solution: Pass the first window of the tabpage. +Files: src/eval.c + +Patch 7.4.443 +Problem: Error reported by ubsan when running test 72. +Solution: Add type cast to unsigned. (Dominique Pelle) +Files: src/undo.c + +Patch 7.4.444 +Problem: Reversed question mark not recognized as punctuation. (Issue 258) +Solution: Add the Supplemental Punctuation range. +Files: src/mbyte.c + +Patch 7.4.445 +Problem: Clipboard may be cleared on startup. +Solution: Set clip_did_set_selection to -1 during startup. (Christian + Brabandt) +Files: src/main.c, src/ui.c + +Patch 7.4.446 +Problem: In some situations, when setting up an environment to trigger an + autocommand, the environment is not properly restored. +Solution: Check the return value of switch_win() and call restore_win() + always. (Daniel Hahler) +Files: src/eval.c, src/misc2.c, src/window.c + +Patch 7.4.447 +Problem: Spell files from Hunspell may generate a lot of errors. +Solution: Add the IGNOREEXTRA flag. +Files: src/spell.c, runtime/doc/spell.txt + +Patch 7.4.448 +Problem: Using ETO_IGNORELANGUAGE causes problems. +Solution: Remove this flag. (Paul Moore) +Files: src/gui_w32.c + +Patch 7.4.449 +Problem: Can't easily close the help window. (Chris Gaal) +Solution: Add ":helpclose". (Christian Brabandt) +Files: runtime/doc/helphelp.txt, runtime/doc/index.txt, src/ex_cmds.c, + src/ex_cmds.h, src/proto/ex_cmds.pro + +Patch 7.4.450 +Problem: Not all commands that edit another buffer support the +cmd + argument. +Solution: Add the +cmd argument to relevant commands. (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/ex_cmds.h, src/ex_docmd.c + +Patch 7.4.451 +Problem: Calling system() with empty input gives an error for writing the + temp file. +Solution: Do not try writing if the string length is zero. (Olaf Dabrunz) +Files: src/eval.c + +Patch 7.4.452 +Problem: Can't build with tiny features. (Tony Mechelynck) +Solution: Use "return" instead of "break". +Files: src/ex_cmds.c + +Patch 7.4.453 +Problem: Still can't build with tiny features. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.454 +Problem: When using a Visual selection of multiple words and doing CTRL-W_] + it jumps to the tag matching the word under the cursor, not the + selected text. (Patrick hemmer) +Solution: Do not reset Visual mode. (idea by Christian Brabandt) +Files: src/window.c + +Patch 7.4.455 +Problem: Completion for :buf does not use 'wildignorecase'. (Akshay H) +Solution: Pass the 'wildignorecase' flag around. +Files: src/buffer.c + +Patch 7.4.456 +Problem: 'backupcopy' is global, cannot write only some files in a + different way. +Solution: Make 'backupcopy' global-local. (Christian Brabandt) +Files: runtime/doc/options.txt, src/buffer.c, src/fileio.c, src/option.c, + src/option.h, src/proto/option.pro, src/structs.h + +Patch 7.4.457 +Problem: Using getchar() in an expression mapping may result in + K_CURSORHOLD, which can't be recognized. +Solution: Add the <CursorHold> key. (Hirohito Higashi) +Files: src/misc2.c + +Patch 7.4.458 +Problem: Issue 252: Cursor moves in a zero-height window. +Solution: Check for zero height. (idea by Christian Brabandt) +Files: src/move.c + +Patch 7.4.459 +Problem: Can't change the icon after building Vim. +Solution: Load the icon from a file on startup. (Yasuhiro Matsumoto) +Files: src/gui_w32.c, src/os_mswin.c, src/os_win32.c, + src/proto/os_mswin.pro + +Patch 7.4.460 (after 7.4.454) +Problem: Can't build without the quickfix feature. (Erik Falor) +Solution: Add a #ifdef. +Files: src/window.c + +Patch 7.4.461 +Problem: MS-Windows: When collate is on the number of copies is too high. +Solution: Only set the collated/uncollated count when collate is on. + (Yasuhiro Matsumoto) +Files: src/os_mswin.c + +Patch 7.4.462 +Problem: Setting the local value of 'backupcopy' empty gives an error. + (Peter Mattern) +Solution: When using an empty value set the flags to zero. (Hirohito + Higashi) +Files: src/option.c + +Patch 7.4.463 +Problem: Test 86 and 87 may hang on MS-Windows. +Solution: Call inputrestore() after inputsave(). (Ken Takata) +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.464 (after 7.4.459) +Problem: Compiler warning. +Solution: Add type cast. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.465 (after 7.4.016) +Problem: Crash when expanding a very long string. +Solution: Use wcsncpy() instead of wcscpy(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.466 (after 7.4.460) +Problem: CTRL-W } does not open preview window. (Erik Falor) +Solution: Don't set g_do_tagpreview for CTRL-W }. +Files: src/window.c + +Patch 7.4.467 +Problem: 'linebreak' does not work well together with Visual mode. +Solution: Disable 'linebreak' while applying an operator. Fix the test. + (Christian Brabandt) +Files: src/normal.c, src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.468 +Problem: Issue 26: CTRL-C does not interrupt after it was mapped and then + unmapped. +Solution: Reset mapped_ctrl_c. (Christian Brabandt) +Files: src/getchar.c + +Patch 7.4.469 (after 7.4.467) +Problem: Can't build with MSVC. (Ken Takata) +Solution: Move the assignment after the declarations. +Files: src/normal.c + +Patch 7.4.470 +Problem: Test 11 and 100 do not work properly on Windows. +Solution: Avoid using feedkeys(). (Ken Takata) +Files: src/testdir/Make_dos.mak, src/testdir/test11.in, + src/testdir/test100.in + +Patch 7.4.471 +Problem: MS-Windows: When printer name contains multi-byte, the name is + displayed as ???. +Solution: Convert the printer name from the active codepage to 'encoding'. + (Yasuhiro Matsumoto) +Files: src/os_mswin.c + +Patch 7.4.472 +Problem: The "precedes" entry in 'listchar' will be drawn when 'showbreak' + is set and 'list' is not. +Solution: Only draw this character when 'list' is on. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.473 +Problem: Cursor movement is incorrect when there is a number/sign/fold + column and 'sbr' is displayed. +Solution: Adjust the column for 'sbr'. (Christian Brabandt) +Files: src/charset.c + +Patch 7.4.474 +Problem: AIX compiler can't handle // comment. Issue 265. +Solution: Remove that line. +Files: src/regexp_nfa.c + +Patch 7.4.475 +Problem: Can't compile on a system where Xutf8SetWMProperties() is not in + the X11 library. Issue 265. +Solution: Add a configure check. +Files: src/configure.in, src/auto/configure, src/config.h.in, + src/os_unix.c + +Patch 7.4.476 +Problem: MingW: compiling with "XPM=no" doesn't work. +Solution: Check for the "no" value. (KF Leong) Also for Cygwin. (Ken + Takata) +Files: src/Make_ming.mak, src/Make_cyg.mak + +Patch 7.4.477 +Problem: When using ":%diffput" and the other file is empty an extra empty + line remains. +Solution: Set the buf_empty flag. +Files: src/diff.c + +Patch 7.4.478 +Problem: Using byte length instead of character length for 'showbreak'. +Solution: Compute the character length. (Marco Hinz) +Files: src/charset.c + +Patch 7.4.479 +Problem: MS-Windows: The console title can be wrong. +Solution: Take the encoding into account. When restoring the title use the + right function. (Yasuhiro Matsumoto) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.480 (after 7.4.479) +Problem: MS-Windows: Can't build. +Solution: Remove goto, use a flag instead. +Files: src/os_win32.c + +Patch 7.4.481 (after 7.4.471) +Problem: Compiler warning on MS-Windows. +Solution: Add type casts. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.482 +Problem: When 'balloonexpr' results in a list, the text has a trailing + newline. (Lcd) +Solution: Remove one trailing newline. +Files: src/gui_beval.c + +Patch 7.4.483 +Problem: A 0x80 byte is not handled correctly in abbreviations. +Solution: Unescape special characters. Add a test. (Christian Brabandt) +Files: src/getchar.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.484 (after 7.4.483) +Problem: Compiler warning on MS-Windows. (Ken Takata) +Solution: Add type cast. +Files: src/getchar.c + +Patch 7.4.485 (after 7.4.484) +Problem: Abbreviations don't work. (Toothpik) +Solution: Move the length computation inside the for loop. Compare against + the unescaped key. +Files: src/getchar.c + +Patch 7.4.486 +Problem: Check for writing to a yank register is wrong. +Solution: Negate the check. (Zyx). Also clean up the #ifdefs. +Files: src/ex_docmd.c, src/ex_cmds.h + +Patch 7.4.487 +Problem: ":sign jump" may use another window even though the file is + already edited in the current window. +Solution: First check if the file is in the current window. (James McCoy) +Files: src/window.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_signs.in, + src/testdir/test_signs.ok + +Patch 7.4.488 +Problem: test_mapping fails for some people. +Solution: Set the 'encoding' option. (Ken Takata) +Files: src/testdir/test_mapping.in + +Patch 7.4.489 +Problem: Cursor movement still wrong when 'lbr' is set and there is a + number column. (Hirohito Higashi) +Solution: Add correction for number column. (Hiroyuki Takagi) +Files: src/charset.c + +Patch 7.4.490 +Problem: Cannot specify the buffer to use for "do" and "dp", making them + useless for three-way diff. +Solution: Use the count as the buffer number. (James McCoy) +Files: runtime/doc/diff.txt, src/diff.c, src/normal.c, src/proto/diff.pro + +Patch 7.4.491 +Problem: When winrestview() has a negative "topline" value there are + display errors. +Solution: Correct a negative value to 1. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.492 +Problem: In Insert mode, after inserting a newline that inserts a comment + leader, CTRL-O moves to the right. (ZyX) Issue 57. +Solution: Correct the condition for moving the cursor back to the NUL. + (Christian Brabandt) +Files: src/edit.c, src/testdir/test4.in, src/testdir/test4.ok + +Patch 7.4.493 +Problem: A TextChanged autocommand is triggered when saving a file. + (William Gardner) +Solution: Update last_changedtick after calling unchanged(). (Christian + Brabandt) +Files: src/fileio.c + +Patch 7.4.494 +Problem: Cursor shape is wrong after a CompleteDone autocommand. +Solution: Update the cursor and mouse shape after ":normal" restores the + state. (Jacob Niehus) +Files: src/ex_docmd.c + +Patch 7.4.495 +Problem: XPM isn't used correctly in the Cygwin Makefile. +Solution: Include the rules like in Make_ming.mak. (Ken Takata) +Files: src/Make_cyg.mak + +Patch 7.4.496 +Problem: Many lines are both in Make_cyg.mak and Make_ming.mak +Solution: Move the common parts to one file. (Ken Takata) +Files: src/INSTALLpc.txt, src/Make_cyg.mak, src/Make_cyg_ming.mak, + src/Make_ming.mak, src/Make_mvc.mak, Filelist + +Patch 7.4.497 +Problem: With some regexp patterns the NFA engine uses many states and + becomes very slow. To the user it looks like Vim freezes. +Solution: When the number of states reaches a limit fall back to the old + engine. (Christian Brabandt) +Files: runtime/doc/options.txt, src/Makefile, src/regexp.c, src/regexp.h, + src/regexp_nfa.c, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Makefile, src/testdir/samples/re.freeze.txt, + src/testdir/bench_re_freeze.in, src/testdir/bench_re_freeze.vim, + Filelist + +Patch 7.4.498 (after 7.4.497) +Problem: Typo in DOS makefile. +Solution: Change exists to exist. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.499 +Problem: substitute() can be slow with long strings. +Solution: Store a pointer to the end, instead of calling strlen() every + time. (Ozaki Kiichi) +Files: src/eval.c + +Patch 7.4.500 +Problem: Test 72 still fails once in a while. +Solution: Don't set 'fileformat' to unix, reset it. (Ken Takata) +Files: src/testdir/test72.in + +Patch 7.4.501 (after 7.4.497) +Problem: Typo in file pattern. +Solution: Insert a slash and remove a dot. +Files: Filelist + +Patch 7.4.502 +Problem: Language mapping also applies to mapped characters. +Solution: Add the 'langnoremap' option, when on 'langmap' does not apply to + mapped characters. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/vimrc_example.vim, src/macros.h, + src/option.c, src/option.h + +Patch 7.4.503 +Problem: Cannot append a list of lines to a file. +Solution: Add the append option to writefile(). (Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, src/Makefile, src/eval.c, + src/testdir/test_writefile.in, src/testdir/test_writefile.ok + +Patch 7.4.504 +Problem: Restriction of the MS-Windows installer that the path must end in + "Vim" prevents installing more than one version. +Solution: Remove the restriction. (Tim Lebedkov) +Files: nsis/gvim.nsi + +Patch 7.4.505 +Problem: On MS-Windows when 'encoding' is a double-byte encoding a file + name longer than MAX_PATH bytes but shorter than that in + characters causes problems. +Solution: Fail on file names longer than MAX_PATH bytes. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.506 +Problem: MS-Windows: Cannot open a file with 259 characters. +Solution: Fix off-by-one error. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.507 (after 7.4.496) +Problem: Building with MingW and Perl. +Solution: Remove quotes. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.508 +Problem: When generating ja.sjis.po the header is not correctly adjusted. +Solution: Check for the right header string. (Ken Takata) +Files: src/po/sjiscorr.c + +Patch 7.4.509 +Problem: Users are not aware their encryption is weak. +Solution: Give a warning when prompting for the key. +Files: src/crypt.c, src/ex_docmd.c, src/fileio.c, src/main.c, + src/proto/crypt.pro + +Patch 7.4.510 +Problem: "-fwrapv" argument breaks use of cproto. +Solution: Remove the alphabetic arguments in a drastic way. +Files: src/Makefile + +Patch 7.4.511 +Problem: Generating proto for if_ruby.c uses type not defined elsewhere. +Solution: Do not generate a prototype for + rb_gc_writebarrier_unprotect_promoted() +Files: src/if_ruby.c + +Patch 7.4.512 +Problem: Cannot generate prototypes for Win32 files and VMS. +Solution: Add typedefs and #ifdef +Files: src/os_win32.c, src/gui_w32.c, src/os_vms.c + +Patch 7.4.513 +Problem: Crash because reference count is wrong for list returned by + getreg(). +Solution: Increment the reference count. (Kimmy Lindvall) +Files: src/eval.c + +Patch 7.4.514 (after 7.4.492) +Problem: Memory access error. (Dominique Pelle) +Solution: Update tpos. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.515 +Problem: In a help buffer the global 'foldmethod' is used. (Paul Marshall) +Solution: Reset 'foldmethod' when starting to edit a help file. Move the + code to a separate function. +Files: src/ex_cmds.c + +Patch 7.4.516 +Problem: Completing a function name containing a # does not work. Issue + 253. +Solution: Recognize the # character. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.517 +Problem: With a wrapping line the cursor may not end up in the right place. + (Nazri Ramliy) +Solution: Adjust n_extra for a Tab that wraps. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.518 +Problem: Using status line height in width computations. +Solution: Use one instead. (Hirohito Higashi) +Files: src/window.c + +Patch 7.4.519 (after 7.4.497) +Problem: Crash when using syntax highlighting. +Solution: When regprog is freed and replaced, store the result. +Files: src/buffer.c, src/regexp.c, src/syntax.c, src/spell.c, + src/ex_cmds2.c, src/fileio.c, src/proto/fileio.pro, + src/proto/regexp.pro, src/os_unix.c + +Patch 7.4.520 +Problem: Sun PCK locale is not recognized. +Solution: Add PCK in the table. (Keiichi Oono) +Files: src/mbyte.c + +Patch 7.4.521 +Problem: When using "vep" a mark is moved to the next line. (Maxi Padulo, + Issue 283) +Solution: Decrement the line number. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.522 +Problem: Specifying wrong buffer size for GetLongPathName(). +Solution: Use the actual size. (Ken Takata) +Files: src/eval.c + +Patch 7.4.523 +Problem: When the X11 server is stopped and restarted, while Vim is kept in + the background, copy/paste no longer works. (Issue 203) +Solution: Setup the clipboard again. (Christian Brabandt) +Files: src/os_unix.c + +Patch 7.4.524 +Problem: When using ":ownsyntax" spell checking is messed up. (Issue 78) +Solution: Use the window-local option values. (Christian Brabandt) +Files: src/option.c, src/syntax.c + +Patch 7.4.525 +Problem: map() leaks memory when there is an error in the expression. +Solution: Call clear_tv(). (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.526 +Problem: matchstr() fails on long text. (Daniel Hahler) +Solution: Return NFA_TOO_EXPENSIVE from regexec_nl(). (Christian Brabandt) +Files: src/regexp.c + +Patch 7.4.527 +Problem: Still confusing regexp failure and NFA_TOO_EXPENSIVE. +Solution: NFA changes equivalent of 7.4.526. +Files: src/regexp_nfa.c + +Patch 7.4.528 +Problem: Crash when using matchadd() (Yasuhiro Matsumoto) +Solution: Copy the match regprog. +Files: src/screen.c + +Patch 7.4.529 +Problem: No test for what 7.4.517 fixes. +Solution: Adjust the tests for breakindent. (Christian Brabandt) +Files: src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok + +Patch 7.4.530 +Problem: Many commands take a count or range that is not using line + numbers. +Solution: For each command specify what kind of count it uses. For windows, + buffers and arguments have "$" and "." have a relevant meaning. + (Marcin Szamotulski) +Files: runtime/doc/editing.txt, runtime/doc/tabpage.txt, + runtime/doc/windows.txt, src/Makefile, src/ex_cmds.h, + src/ex_docmd.c, src/testdir/Make_amiga.mak + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_argument_count.in, + src/testdir/test_argument_count.ok, + src/testdir/test_close_count.in, src/testdir/test_close_count.ok, + src/window.c + +Patch 7.4.531 +Problem: Comments about parsing an Ex command are wrong. +Solution: Correct the step numbers. +Files: src/ex_docmd.c + +Patch 7.4.532 +Problem: When using 'incsearch' "2/pattern/e" highlights the first match. +Solution: Move the code to set extra_col inside the loop for count. (Ozaki + Kiichi) +Files: src/search.c + +Patch 7.4.533 +Problem: ":hardcopy" leaks memory in case of errors. +Solution: Free memory in all code paths. (Christian Brabandt) +Files: src/hardcopy.c + +Patch 7.4.534 +Problem: Warnings when compiling if_ruby.c. +Solution: Avoid the warnings. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.535 (after 7.4.530) +Problem: Can't build with tiny features. +Solution: Add #ifdefs and skip a test. +Files: src/ex_docmd.c, src/testdir/test_argument_count.in + +Patch 7.4.536 +Problem: Test 63 fails when using a black&white terminal. +Solution: Add attributes for a non-color terminal. (Christian Brabandt) +Files: src/testdir/test63.in + +Patch 7.4.537 +Problem: Value of v:hlsearch reflects an internal variable. +Solution: Make the value reflect whether search highlighting is actually + displayed. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/testdir/test101.in, + src/testdir/test101.ok, src/vim.h + +Patch 7.4.538 +Problem: Tests fail with small features plus Python. +Solution: Disallow weird combination of options. Do not set "fdm" when + folding is disabled. +Files: src/option.c, src/ex_cmds.c, src/configure.in, src/auto/configure, + src/feature.h + +Patch 7.4.539 (after 7.4.530) +Problem: Crash when computing buffer count. Problem with range for user + commands. Line range wrong in Visual area. +Solution: Avoid segfault in compute_buffer_local_count(). Check for + CMD_USER when checking type of range. (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/ex_docmd.c + +Patch 7.4.540 (after 7.4.539) +Problem: Cannot build with tiny and small features. (Taro Muraoka) +Solution: Add #ifdef around CMD_USER. +Files: src/ex_docmd.c + +Patch 7.4.541 +Problem: Crash when doing a range assign. +Solution: Check for NULL pointer. (Yukihiro Nakadaira) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.542 +Problem: Using a range for window and buffer commands has a few problems. + Cannot specify the type of range for a user command. +Solution: Add the -addr argument for user commands. Fix problems. (Marcin + Szamotulski) +Files: src/testdir/test_command_count.in, + src/testdir/test_command_count.ok src/testdir/Make_amiga.mak + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, runtime/doc/map.txt, src/Makefile, + src/ex_cmds.h, src/ex_docmd.c, src/ex_getln.c, + src/proto/ex_docmd.pro, src/vim.h, + +Patch 7.4.543 +Problem: Since patch 7.4.232 "1,3s/\n//" joins two lines instead of three. + (Eliseo Martínez) Issue 287 +Solution: Correct the line count. (Christian Brabandt) + Also set the last used search pattern. +Files: src/ex_cmds.c, src/search.c, src/proto/search.pro + +Patch 7.4.544 +Problem: Warnings for unused arguments when compiling with a combination of + features. +Solution: Add "UNUSED". +Files: src/if_cscope.c + +Patch 7.4.545 +Problem: Highlighting for multi-line matches is not correct. +Solution: Stop highlight at the end of the match. (Hirohito Higashi) +Files: src/screen.c + +Patch 7.4.546 +Problem: Repeated use of vim_snprintf() with a number. +Solution: Move these vim_snprintf() calls into a function. +Files: src/window.c + +Patch 7.4.547 +Problem: Using "vit" does not select a multi-byte character at the end + correctly. +Solution: Advance the cursor over the multi-byte character. (Christian + Brabandt) +Files: src/search.c + +Patch 7.4.548 +Problem: Compilation fails with native version of MinGW-w64, because + it doesn't have x86_64-w64-mingw32-windres.exe. +Solution: Use windres instead. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.549 +Problem: Function name not recognized correctly when inside a function. +Solution: Don't check for an alpha character. (Ozaki Kiichi) +Files: src/eval.c, src/testdir/test_nested_function.in, + src/testdir/test_nested_function.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.550 +Problem: curs_rows() function is always called with the second argument + false. +Solution: Remove the argument. (Christian Brabandt) + validate_botline_win() can then also be removed. +Files: src/move.c + +Patch 7.4.551 +Problem: "ygn" may yank too much. (Fritzophrenic) Issue 295. +Solution: Check the width of the next match. (Christian Brabandt) +Files: src/search.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.552 +Problem: Langmap applies to Insert mode expression mappings. +Solution: Check for Insert mode. (Daniel Hahler) +Files: src/getchar.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.553 +Problem: Various small issues. +Solution: Fix those issues. +Files: src/ex_cmds.h, src/gui.h, src/message.c, src/testdir/test39.in, + src/proto/eval.pro, src/proto/misc1.pro, src/proto/ops.pro, + src/proto/screen.pro, src/proto/window.pro. src/os_unix.c, + src/Make_vms.mms, src/proto/os_vms.pro, src/INSTALL + +Patch 7.4.554 +Problem: Missing part of patch 7.4.519. +Solution: Copy back regprog after calling vim_regexec. +Files: src/quickfix.c + +Patch 7.4.555 +Problem: test_close_count may fail for some combination of features. +Solution: Require normal features. +Files: src/testdir/test_close_count.in + +Patch 7.4.556 +Problem: Failed commands in Python interface not handled correctly. +Solution: Restore window and buffer on failure. +Files: src/if_py_both.h + +Patch 7.4.557 +Problem: One more small issue. +Solution: Update function proto. +Files: src/proto/window.pro + +Patch 7.4.558 +Problem: When the X server restarts Vim may get stuck. +Solution: Destroy the application context and create it again. (Issue 203) +Files: src/os_unix.c + +Patch 7.4.559 +Problem: Appending a block in the middle of a tab does not work correctly + when virtualedit is set. +Solution: Decrement spaces and count, don't reset them. (James McCoy) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.560 +Problem: Memory leak using :wviminfo. Issue 296. +Solution: Free memory when needed. (idea by Christian Brabandt) +Files: src/ops.c + +Patch 7.4.561 +Problem: Ex range handling is wrong for buffer-local user commands. +Solution: Check for CMD_USER_BUF. (Marcin Szamotulski) +Files: src/ex_docmd.c, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.562 +Problem: Segfault with wide screen and error in 'rulerformat'. (Ingo Karkat) +Solution: Check there is enough space. (Christian Brabandt) +Files: src/buffer.c, src/screen.c + +Patch 7.4.563 +Problem: No test for replacing on a tab in Virtual replace mode. +Solution: Add a test. (Elias Diem) +Files: src/testdir/test48.in, src/testdir/test48.ok + +Patch 7.4.564 +Problem: FEAT_OSFILETYPE is used even though it's never defined. +Solution: Remove the code. (Christian Brabandt) +Files: src/fileio.c + +Patch 7.4.565 +Problem: Ranges for arguments, buffers, tabs, etc. are not checked to be + valid but limited to the maximum. This can cause the wrong thing + to happen. +Solution: Give an error for an invalid value. (Marcin Szamotulski) + Use windows range for ":wincmd". +Files: src/ex_docmd.c, src/ex_cmds.h, src/testdir/test62.in, + src/testdir/test_argument_count.in, + src/testdir/test_argument_count.ok, + src/testdir/test_close_count.in, + src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.566 +Problem: :argdo, :bufdo, :windo and :tabdo don't take a range. +Solution: Support the range. (Marcin Szamotulski) +Files: runtime/doc/editing.txt, runtime/doc/tabpage.txt, + runtime/doc/windows.txt, src/ex_cmds.h, src/ex_cmds2.c, + src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.567 +Problem: Non-ascii vertical separator characters are always redrawn. +Solution: Compare only the one byte that's stored. (Thiago Padilha) +Files: src/screen.c + +Patch 7.4.568 +Problem: Giving an error for ":0wincmd w" is a problem for some plugins. +Solution: Allow the zero in the range. (Marcin Szamotulski) +Files: src/ex_docmd.c, src/testdir/test_command_count.ok + +Patch 7.4.569 (after 7.4.468) +Problem: Having CTRL-C interrupt or not does not check the mode of the + mapping. (Ingo Karkat) +Solution: Use a bitmask with the map mode. (Christian Brabandt) +Files: src/getchar.c, src/structs.h, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok, src/ui.c, src/globals.h + +Patch 7.4.570 +Problem: Building with dynamic library does not work for Ruby 2.2.0 +Solution: Change #ifdefs and #defines. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.571 (after 7.4.569) +Problem: Can't build with tiny features. (Ike Devolder) +Solution: Add #ifdef. +Files: src/getchar.c + +Patch 7.4.572 +Problem: Address type of :wincmd depends on the argument. +Solution: Check the argument. +Files: src/ex_docmd.c, src/window.c, src/proto/window.pro + +Patch 7.4.573 (after 7.4.569) +Problem: Mapping CTRL-C in Visual mode doesn't work. (Ingo Karkat) +Solution: Call get_real_state() instead of using State directly. +Files: src/ui.c, src/testdir/test_mapping.in, src/testdir/test_mapping.ok + +Patch 7.4.574 +Problem: No error for eval('$'). +Solution: Check for empty name. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.575 +Problem: Unicode character properties are outdated. +Solution: Update the tables with the latest version. +Files: src/mbyte.c + +Patch 7.4.576 +Problem: Redrawing problem with 'relativenumber' and 'linebreak'. +Solution: Temporarily reset 'linebreak' and restore it in more places. + (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.577 +Problem: Matching with a virtual column has a lot of overhead on very long + lines. (Issue 310) +Solution: Bail out early if there can't be a match. (Christian Brabandt) + Also check for CTRL-C at every position. +Files: src/regexp_nfa.c + +Patch 7.4.578 +Problem: Using getcurpos() after "$" in an empty line returns a negative + number. +Solution: Don't add one when this would overflow. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.579 +Problem: Wrong cursor positioning when 'linebreak' is set and lines wrap. +Solution: Fix it. (Christian Brabandt) +Files: src/charset.c, src/screen.c + +Patch 7.4.580 +Problem: ":52wincmd v" still gives an invalid range error. (Charles + Campbell) +Solution: Skip over white space. +Files: src/ex_docmd.c + +Patch 7.4.581 +Problem: Compiler warnings for uninitialized variables. (John Little) +Solution: Initialize the variables. +Files: src/ops.c + +Patch 7.4.582 (after 7.4.577) +Problem: Can't match "%>80v" properly. (Axel Bender) +Solution: Correctly handle ">". (Christian Brabandt) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.583 +Problem: With tiny features test 16 may fail. +Solution: Source small.vim. (Christian Brabandt) +Files: src/testdir/test16.in + +Patch 7.4.584 +Problem: With tiny features test_command_count may fail. +Solution: Source small.vim. (Christian Brabandt) +Files: src/testdir/test_command_count.in + +Patch 7.4.585 +Problem: Range for :bdelete does not work. (Ronald Schild) +Solution: Also allow unloaded buffers. +Files: src/ex_cmds.h, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.586 +Problem: Parallel building of the documentation html files is not reliable. +Solution: Remove a cyclic dependency. (Reiner Herrmann) +Files: runtime/doc/Makefile + +Patch 7.4.587 +Problem: Conceal does not work properly with 'linebreak'. (cs86661) +Solution: Save and restore boguscols. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.588 +Problem: ":0argedit foo" puts the new argument in the second place instead + of the first. +Solution: Adjust the range type. (Ingo Karkat) +Files: src/ex_cmds.h, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_argument_0count.in, + src/testdir/test_argument_0count.ok + +Patch 7.4.589 +Problem: In the MS-Windows console Vim can't handle greek characters when + encoding is utf-8. +Solution: Escape K_NUL. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.590 +Problem: Using ctrl_x_mode as if it contains flags. +Solution: Don't use AND with CTRL_X_OMNI. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.591 (after 7.4.587) +Problem: test_listlbr_utf8 fails when the conceal feature is not available. +Solution: Check for the conceal feature. (Kazunobu Kuriyama) +Files: src/testdir/test_listlbr_utf8.in + +Patch 7.4.592 +Problem: When doing ":e foobar" when already editing "foobar" and 'buftype' + is "nofile" the buffer is cleared. (Xavier de Gaye) +Solution: Do no clear the buffer. +Files: src/ex_cmds.c + +Patch 7.4.593 +Problem: Crash when searching for "x\{0,90000}". (Dominique Pelle) +Solution: Bail out from the NFA engine when the max limit is much higher + than the min limit. +Files: src/regexp_nfa.c, src/regexp.c, src/vim.h + +Patch 7.4.594 +Problem: Using a block delete while 'breakindent' is set does not work + properly. +Solution: Use "line" instead of "prev_pend" as the first argument to + lbr_chartabsize_adv(). (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_breakindent.in, + src/testdir/test_breakindent.ok + +Patch 7.4.595 +Problem: The test_command_count test fails when using Japanese. +Solution: Force the language to C. (Hirohito Higashi) +Files: src/testdir/test_command_count.in + +Patch 7.4.596 (after 7.4.592) +Problem: Tiny build doesn't compile. (Ike Devolder) +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.597 +Problem: Cannot change the result of systemlist(). +Solution: Initialize v_lock. (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.598 +Problem: ":tabdo windo echo 'hi'" causes "* register not to be changed. + (Salman Halim) +Solution: Change how clip_did_set_selection is used and add + clipboard_needs_update and global_change_count. (Christian + Brabandt) +Files: src/main.c, src/ui.c, src/testdir/test_eval.in, + src/testdir/test_eval.ok + +Patch 7.4.599 +Problem: Out-of-memory error. +Solution: Avoid trying to allocate a negative amount of memory, use size_t + instead of int. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.600 +Problem: Memory wasted in struct because of aligning. +Solution: Split pos in lnum and col. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.601 +Problem: It is not possible to have feedkeys() insert characters. +Solution: Add the 'i' flag. +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.602 +Problem: ":set" does not accept hex numbers as documented. +Solution: Use vim_str2nr(). (ZyX) +Files: src/option.c, runtime/doc/options.txt + +Patch 7.4.603 +Problem: 'foldcolumn' may be set such that it fills the whole window, not + leaving space for text. +Solution: Reduce the foldcolumn width when there is not sufficient room. + (idea by Christian Brabandt) +Files: src/screen.c + +Patch 7.4.604 +Problem: Running tests changes viminfo. +Solution: Disable viminfo. +Files: src/testdir/test_breakindent.in + +Patch 7.4.605 +Problem: The # register is not writable, it cannot be restored after + jumping around. +Solution: Make the # register writable. (Marcin Szamotulski) +Files: runtime/doc/change.txt, src/ops.c, src/buffer.c, src/globals.h + +Patch 7.4.606 +Problem: May crash when using a small window. +Solution: Avoid dividing by zero. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.607 (after 7.4.598) +Problem: Compiler warnings for unused variables. +Solution: Move them inside #ifdef. (Kazunobu Kuriyama) +Files: src/ui.c + +Patch 7.4.608 (after 7.4.598) +Problem: test_eval fails when the clipboard feature is missing. +Solution: Skip part of the test. Reduce the text used. +Files: src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.609 +Problem: For complicated list and dict use the garbage collector can run + out of stack space. +Solution: Use a stack of dicts and lists to be marked, thus making it + iterative instead of recursive. (Ben Fritz) +Files: src/eval.c, src/if_lua.c, src/if_py_both.h, src/if_python.c, + src/if_python3.c, src/proto/eval.pro, src/proto/if_lua.pro, + src/proto/if_python.pro, src/proto/if_python3.pro, src/structs.h + +Patch 7.4.610 +Problem: Some function headers may be missing from generated .pro files. +Solution: Add PROTO to the #ifdef. +Files: src/option.c, src/syntax.c + +Patch 7.4.611 (after 7.4.609) +Problem: Syntax error. +Solution: Change statement to return. +Files: src/if_python3.c + +Patch 7.4.612 +Problem: test_eval fails on Mac. +Solution: Use the * register instead of the + register. (Jun Takimoto) +Files: src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.613 +Problem: The NFA engine does not implement the 'redrawtime' time limit. +Solution: Implement the time limit. +Files: src/regexp_nfa.c + +Patch 7.4.614 +Problem: There is no test for what patch 7.4.601 fixes. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test_mapping.in, src/testdir/test_mapping.ok + +Patch 7.4.615 +Problem: Vim hangs when freeing a lot of objects. +Solution: Do not go back to the start of the list every time. (Yasuhiro + Matsumoto and Ariya Mizutani) +Files: src/eval.c + +Patch 7.4.616 +Problem: Cannot insert a tab in front of a block. +Solution: Correctly compute aop->start. (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.617 +Problem: Wrong ":argdo" range does not cause an error. +Solution: Reset "cmd" to NULL. (Marcin Szamotulski, Ingo Karkat) +Files: src/ex_docmd.c + +Patch 7.4.618 (after 7.4.609) +Problem: luaV_setref() is missing a return statement. (Ozaki Kiichi) +Solution: Put the return statement back. +Files: src/if_lua.c + +Patch 7.4.619 (after 7.4.618) +Problem: luaV_setref() not returning the correct value. +Solution: Return one. +Files: src/if_lua.c + +Patch 7.4.620 +Problem: Compiler warning for uninitialized variable. (Tony Mechelynck) +Solution: Initialize "did_free". (Ben Fritz) +Files: src/eval.c + +Patch 7.4.621 (after 7.4.619) +Problem: Returning 1 in the wrong function. (Raymond Ko) +Solution: Return 1 in the right function (hopefully). +Files: src/if_lua.c + +Patch 7.4.622 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/regexp_nfa.c + +Patch 7.4.623 +Problem: Crash with pattern: \(\)\{80000} (Dominique Pelle) +Solution: When the max limit is large fall back to the old engine. +Files: src/regexp_nfa.c + +Patch 7.4.624 +Problem: May leak memory or crash when vim_realloc() returns NULL. +Solution: Handle a NULL value properly. (Mike Williams) +Files: src/if_cscope.c, src/memline.c, src/misc1.c, src/netbeans.c + +Patch 7.4.625 +Problem: Possible NULL pointer dereference. +Solution: Check for NULL before using it. (Mike Williams) +Files: src/if_py_both.h + +Patch 7.4.626 +Problem: MSVC with W4 gives useless warnings. +Solution: Disable more warnings. (Mike Williams) +Files: src/vim.h + +Patch 7.4.627 +Problem: The last screen cell is not updated. +Solution: Respect the "tn" termcap feature. (Hayaki Saito) +Files: runtime/doc/term.txt, src/option.c, src/screen.c, src/term.c, + src/term.h + +Patch 7.4.628 +Problem: Compiler warning for variable might be clobbered by longjmp. +Solution: Add volatile. (Michael Jarvis) +Files: src/main.c + +Patch 7.4.629 +Problem: Coverity warning for Out-of-bounds read. +Solution: Increase MAXWLEN to 254. (Eliseo Martínez) +Files: src/spell.c + +Patch 7.4.630 +Problem: When using Insert mode completion combined with autocommands the + redo command may not work. +Solution: Do not save the redo buffer when executing autocommands. (Yasuhiro + Matsumoto) +Files: src/fileio.c + +Patch 7.4.631 +Problem: The default conceal character is documented to be a space but it's + initially a dash. (Christian Brabandt) +Solution: Make the initial value a space. +Files: src/globals.h + +Patch 7.4.632 (after 7.4.592) +Problem: 7.4.592 breaks the netrw plugin, because the autocommands are + skipped. +Solution: Roll back the change. +Files: src/ex_cmds.c + +Patch 7.4.633 +Problem: After 7.4.630 the problem persists. +Solution: Also skip redo when calling a user function. +Files: src/eval.c + +Patch 7.4.634 +Problem: Marks are not restored after redo + undo. +Solution: Fix the way marks are restored. (Olaf Dabrunz) +Files: src/undo.c, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_marks.in, src/testdir/test_marks.ok + +Patch 7.4.635 +Problem: If no NL or CR is found in the first block of a file then the + 'fileformat' may be set to "mac". (Issue 77) +Solution: Check if a CR was found. (eswald) +Files: src/fileio.c + +Patch 7.4.636 +Problem: A search with end offset gets stuck at end of file. (Gary Johnson) +Solution: When a search doesn't move the cursor repeat it with a higher + count. (Christian Brabandt) +Files: src/normal.c, src/testdir/test44.in, src/testdir/test44.ok + +Patch 7.4.637 +Problem: Incorrectly read the number of buffer for which an autocommand + should be registered. +Solution: Reverse check for "<buffer=abuf>". (Lech Lorens) +Files: src/fileio.c + +Patch 7.4.638 +Problem: Can't build with Lua 5.3 on Windows. +Solution: use luaL_optinteger() instead of LuaL_optlong(). (Ken Takata) +Files: src/if_lua.c + +Patch 7.4.639 +Problem: Combination of linebreak and conceal doesn't work well. +Solution: Fix the display problems. (Christian Brabandt) +Files: src/screen.c, src/testdir/test88.in, src/testdir/test88.ok, + src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.640 +Problem: After deleting characters in Insert mode such that lines are + joined undo does not work properly. (issue 324) +Solution: Use Insstart instead of Insstart_orig. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.641 +Problem: The tabline menu was using ":999tabnew" which is now invalid. +Solution: Use ":$tabnew" instead. (Florian Degner) +Files: src/normal.c + +Patch 7.4.642 +Problem: When using "gf" escaped spaces are not handled. +Solution: Recognize escaped spaces. +Files: src/vim.h, src/normal.h, src/window.c, src/misc2.c + +Patch 7.4.643 +Problem: Using the default file format for Mac files. (Issue 77) +Solution: Reset the try_mac counter in the right place. (Oswald) +Files: src/fileio.c, src/testdir/test30.in, src/testdir/test30.ok + +Patch 7.4.644 +Problem: Stratus VOS doesn't have sync(). +Solution: Use fflush(). (Karli Aurelia) +Files: src/memfile.c + +Patch 7.4.645 +Problem: When splitting the window in a BufAdd autocommand while still in + the first, empty buffer the window count is wrong. +Solution: Do not reset b_nwindows to zero and don't increment it. +Files: src/buffer.c, src/ex_cmds.c + +Patch 7.4.646 +Problem: ":bufdo" may start at a deleted buffer. +Solution: Find the first not deleted buffer. (Shane Harper) +Files: src/ex_cmds2.c, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.647 +Problem: After running the tests on MS-Windows many files differ from their + originals as they were checked out. +Solution: Use a temp directory for executing the tests. (Ken Takata, Taro + Muraoka) +Files: src/testdir/Make_dos.mak + +Patch 7.4.648 (after 7.4.647) +Problem: Tests broken on MS-Windows. +Solution: Delete wrong copy line. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.649 +Problem: Compiler complains about ignoring return value of fwrite(). + (Michael Jarvis) +Solution: Add (void). +Files: src/misc2.c + +Patch 7.4.650 +Problem: Configure check may fail because the dl library is not used. +Solution: Put "-ldl" in LIBS rather than LDFLAGS. (Ozaki Kiichi) +Files: src/configure.in, src/auto/configure + +Patch 7.4.651 (after 7.4.582) +Problem: Can't match "%>80v" properly for multi-byte characters. +Solution: Multiply the character number by the maximum number of bytes in a + character. (Yasuhiro Matsumoto) +Files: src/regexp_nfa.c + +Patch 7.4.652 +Problem: Xxd lacks a few features. +Solution: Use 8 characters for the file position. Add the -e and -o + arguments. (Vadim Vygonets) +Files: src/xxd/xxd.c, runtime/doc/xxd.1 + +Patch 7.4.653 +Problem: Insert mode completion with complete() may have CTRL-L work like + CTRL-P. +Solution: Handle completion with complete() differently. (Yasuhiro + Matsumoto, Christian Brabandt, Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.654 +Problem: glob() and globpath() cannot include links to non-existing files. + (Charles Campbell) +Solution: Add an argument to include all links with glob(). (James McCoy) + Also for globpath(). +Files: src/vim.h, src/eval.c, src/ex_getln.c + +Patch 7.4.655 +Problem: Text deleted by "dit" depends on indent of closing tag. + (Jan Parthey) +Solution: Do not adjust oap->end in do_pending_operator(). (Christian + Brabandt) +Files: src/normal.c, src/search.c, src/testdir/test53.in, + src/testdir/test53.ok + +Patch 7.4.656 (after 7.4.654) +Problem: Missing changes for glob() in one file. +Solution: Add the missing changes. +Files: src/misc1.c + +Patch 7.4.657 (after 7.4.656) +Problem: Compiler warnings for pointer mismatch. +Solution: Add a typecast. (John Marriott) +Files: src/misc1.c + +Patch 7.4.658 +Problem: 'formatexpr' is evaluated too often. +Solution: Only invoke it when beyond the 'textwidth' column, as it is + documented. (James McCoy) +Files: src/edit.c + +Patch 7.4.659 +Problem: When 'ruler' is set the preferred column is reset. (Issue 339) +Solution: Don't set curswant when redrawing the status lines. +Files: src/option.c + +Patch 7.4.660 +Problem: Using freed memory when g:colors_name is changed in the colors + script. (oni-link) +Solution: Make a copy of the variable value. +Files: src/syntax.c + +Patch 7.4.661 +Problem: Using "0 CTRL-D" in Insert mode may have CursorHoldI interfere. + (Gary Johnson) +Solution: Don't store K_CURSORHOLD as the last character. (Christian + Brabandt) +Files: src/edit.c + +Patch 7.4.662 +Problem: When 'M' is in the 'cpo' option then selecting a text object in + parentheses does not work correctly. +Solution: Keep 'M' in 'cpo' when finding a match. (Hirohito Higashi) +Files: src/search.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_textobjects.in, + src/testdir/test_textobjects.ok + +Patch 7.4.663 +Problem: When using netbeans a buffer is not found in another tab. +Solution: When 'switchbuf' is set to "usetab" then switch to another tab + when possible. (Xavier de Gaye) +Files: src/netbeans.c + +Patch 7.4.664 +Problem: When 'compatible' is reset 'numberwidth' is set to 4, but the + effect doesn't show until a change is made. +Solution: Check if 'numberwidth' changed. (Christian Brabandt) +Files: src/screen.c, src/structs.h + +Patch 7.4.665 +Problem: 'linebreak' does not work properly with multi-byte characters. +Solution: Compute the pointer offset with mb_head_off(). (Yasuhiro + Matsumoto) +Files: src/screen.c + +Patch 7.4.666 +Problem: There is a chance that Vim may lock up. +Solution: Handle timer events differently. (Aaron Burrow) +Files: src/os_unix.c + +Patch 7.4.667 +Problem: 'colorcolumn' isn't drawn in a closed fold while 'cursorcolumn' + is. (Carlos Pita) +Solution: Make it consistent. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.668 +Problem: Can't use a glob pattern as a regexp pattern. +Solution: Add glob2regpat(). (Christian Brabandt) +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.669 +Problem: When netbeans is active the sign column always shows up. +Solution: Only show the sign column once a sign has been added. (Xavier de + Gaye) +Files: src/buffer.c, src/edit.c, src/move.c, src/netbeans.c, + src/screen.c, src/structs.h + +Patch 7.4.670 +Problem: Using 'cindent' for Javascript is less than perfect. +Solution: Improve indenting of continuation lines. (Hirohito Higashi) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.671 (after 7.4.665) +Problem: Warning for shadowing a variable. +Solution: Rename off to mb_off. (Kazunobu Kuriyama) +Files: src/screen.c + +Patch 7.4.672 +Problem: When completing a shell command, directories in the current + directory are not listed. +Solution: When "." is not in $PATH also look in the current directory for + directories. +Files: src/ex_getln.c, src/vim.h, src/misc1.c, src/eval.c, + src/os_amiga.c, src/os_msdos.c, src/os_unix.c, src/os_vms.c, + src/proto/os_amiga.pro, src/proto/os_msdos.pro, + src/proto/os_unix.pro, src/proto/os_win32.pro + +Patch 7.4.673 +Problem: The first syntax entry gets sequence number zero, which doesn't + work. (Clinton McKay) +Solution: Start at number one. (Bjorn Linse) +Files: src/syntax.c + +Patch 7.4.674 (after 7.4.672) +Problem: Missing changes in one file. +Solution: Also change the win32 file. +Files: src/os_win32.c + +Patch 7.4.675 +Problem: When a FileReadPost autocommand moves the cursor inside a line it + gets moved back. +Solution: When checking whether an autocommand moved the cursor store the + column as well. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.676 +Problem: On Mac, when not using the default Python framework configure + doesn't do the right thing. +Solution: Use a linker search path. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.677 (after 7.4.676) +Problem: Configure fails when specifying a python-config-dir. (Lcd) +Solution: Check if PYTHONFRAMEWORKPREFIX is set. +Files: src/configure.in, src/auto/configure + +Patch 7.4.678 +Problem: When using --remote the directory may end up being wrong. +Solution: Use localdir() to find out what to do. (Xaizek) +Files: src/main.c + +Patch 7.4.679 +Problem: Color values greater than 255 cause problems on MS-Windows. +Solution: Truncate to 255 colors. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.680 +Problem: CTRL-W in Insert mode does not work well for multi-byte + characters. +Solution: Use mb_get_class(). (Yasuhiro Matsumoto) +Files: src/edit.c, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_erasebackword.in, + src/testdir/test_erasebackword.ok, + +Patch 7.4.681 +Problem: MS-Windows: When Vim is minimized the window height is computed + incorrectly. +Solution: When minimized use the previously computed size. (Ingo Karkat) +Files: src/gui_w32.c + +Patch 7.4.682 +Problem: The search highlighting and match highlighting replaces the + cursorline highlighting, this doesn't look good. +Solution: Combine the highlighting. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 7.4.683 +Problem: Typo in the vimtutor command. +Solution: Fix the typo. (Corey Farwell, github pull 349) +Files: vimtutor.com + +Patch 7.4.684 +Problem: When starting several Vim instances in diff mode, the temp files + used may not be unique. (Issue 353) +Solution: Add an argument to vim_tempname() to keep the file. +Files: src/diff.c, src/eval.c, src/ex_cmds.c, src/fileio.c, + src/hardcopy.c, src/proto/fileio.pro, src/if_cscope.c, + src/memline.c, src/misc1.c, src/os_unix.c, src/quickfix.c, + src/spell.c + +Patch 7.4.685 +Problem: When there are illegal utf-8 characters the old regexp engine may + go past the end of a string. +Solution: Only advance to the end of the string. (Dominique Pelle) +Files: src/regexp.c + +Patch 7.4.686 +Problem: "zr" and "zm" do not take a count. +Solution: Implement the count, restrict the fold level to the maximum + nesting depth. (Marcin Szamotulski) +Files: runtime/doc/fold.txt, src/normal.c + +Patch 7.4.687 +Problem: There is no way to use a different in Replace mode for a terminal. +Solution: Add t_SR. (Omar Sandoval) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/syntax/vim.vim, src/option.c, src/term.c, src/term.h + +Patch 7.4.688 +Problem: When "$" is in 'cpo' the popup menu isn't undrawn correctly. + (Issue 166) +Solution: When using the popup menu remove the "$". +Files: src/edit.c + +Patch 7.4.689 +Problem: On MS-Windows, when 'autochdir' is set, diff mode with files in + different directories does not work. (Axel Bender) +Solution: Remember the current directory and use it where needed. (Christian + Brabandt) +Files: src/main.c + +Patch 7.4.690 +Problem: Memory access errors when changing indent in Ex mode. Also missing + redraw when using CTRL-U. (Knil Ino) +Solution: Update pointers after calling ga_grow(). +Files: src/ex_getln.c + +Patch 7.4.691 (after 7.4.689) +Problem: Can't build with MzScheme. +Solution: Change "cwd" into the global variable "start_dir". +Files: src/main.c + +Patch 7.4.692 +Problem: Defining SOLARIS for no good reason. (Danek Duvall) +Solution: Remove it. +Files: src/os_unix.h + +Patch 7.4.693 +Problem: Session file is not correct when there are multiple tab pages. +Solution: Reset the current window number for each tab page. (Jacob Niehus) +Files: src/ex_docmd.c + +Patch 7.4.694 +Problem: Running tests changes the .viminfo file. +Solution: Disable viminfo in the text objects test. +Files: src/testdir/test_textobjects.in + +Patch 7.4.695 +Problem: Out-of-bounds read, detected by Coverity. +Solution: Remember the value of cmap for the first matching encoding. Reset + cmap to that value if first matching encoding is going to be used. + (Eliseo Martínez) +Files: src/hardcopy.c + +Patch 7.4.696 +Problem: Not freeing memory when encountering an error. +Solution: Free the stack before returning. (Eliseo Martínez) +Files: src/regexp_nfa.c + +Patch 7.4.697 +Problem: The filename used for ":profile" must be given literally. +Solution: Expand "~" and environment variables. (Marco Hinz) +Files: src/ex_cmds2.c + +Patch 7.4.698 +Problem: Various problems with locked and fixed lists and dictionaries. +Solution: Disallow changing locked items, fix a crash, add tests. (Olaf + Dabrunz) +Files: src/structs.h, src/eval.c, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.699 +Problem: E315 when trying to delete a fold. (Yutao Yuan) +Solution: Make sure the fold doesn't go beyond the last buffer line. + (Christian Brabandt) +Files: src/fold.c + +Patch 7.4.700 +Problem: Fold can't be opened after ":move". (Ein Brown) +Solution: Delete the folding information and update it afterwards. + (Christian Brabandt) +Files: src/ex_cmds.c, src/fold.c, src/testdir/test45.in, + src/testdir/test45.ok + +Patch 7.4.701 +Problem: Compiler warning for using uninitialized variable. (Yasuhiro + Matsumoto) +Solution: Initialize it. +Files: src/hardcopy.c + +Patch 7.4.702 +Problem: Joining an empty list does unnecessary work. +Solution: Let join() return early. (Marco Hinz) +Files: src/eval.c + +Patch 7.4.703 +Problem: Compiler warning for start_dir unused when building unittests. +Solution: Move start_dir inside the #ifdef. +Files: src/main.c + +Patch 7.4.704 +Problem: Searching for a character matches an illegal byte and causes + invalid memory access. (Dominique Pelle) +Solution: Do not match an invalid byte when search for a character in a + string. Fix equivalence classes using negative numbers, which + result in illegal bytes. +Files: src/misc2.c, src/regexp.c, src/testdir/test44.in + +Patch 7.4.705 +Problem: Can't build with Ruby 2.2. +Solution: Add #ifdefs to handle the incompatible change. (Andrei Olsen) +Files: src/if_ruby.c + +Patch 7.4.706 +Problem: Window drawn wrong when 'laststatus' is zero and there is a + command-line window. (Yclept Nemo) +Solution: Set the status height a bit later. (Christian Brabandt) +Files: src/window.c + +Patch 7.4.707 +Problem: Undo files can have their executable bit set. +Solution: Strip of the executable bit. (Mikael Berthe) +Files: src/undo.c + +Patch 7.4.708 +Problem: gettext() is called too often. +Solution: Do not call gettext() for messages until they are actually used. + (idea by Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.709 +Problem: ":tabmove" does not work as documented. +Solution: Make it work consistently. Update documentation and add tests. + (Hirohito Higashi) +Files: src/window.c, runtime/doc/tabpage.txt, src/ex_docmd.c, + src/testdir/test62.in, src/testdir/test62.ok + +Patch 7.4.710 +Problem: It is not possible to make spaces visible in list mode. +Solution: Add the "space" item to 'listchars'. (David Bürgin, issue 350) +Files: runtime/doc/options.txt, src/globals.h, src/message.h, + src/screen.c, src/testdir/test_listchars.in, + src/testdir/test_listchars.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.711 (after 7.4.710) +Problem: Missing change in one file. +Solution: Also change option.c +Files: src/option.c + +Patch 7.4.712 (after 7.4.710) +Problem: Missing change in another file. +Solution: Also change message.c +Files: src/message.c + +Patch 7.4.713 +Problem: Wrong condition for #ifdef. +Solution: Change USR_EXRC_FILE2 to USR_VIMRC_FILE2. (Mikael Fourrier) +Files: src/os_unix.h + +Patch 7.4.714 +Problem: Illegal memory access when there are illegal bytes. +Solution: Check the byte length of the character. (Dominique Pelle) +Files: src/regexp.c + +Patch 7.4.715 +Problem: Invalid memory access when there are illegal bytes. +Solution: Get the length from the text, not from the character. (Dominique + Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.716 +Problem: When using the 'c' flag of ":substitute" and selecting "a" or "l" + at the prompt the flags are not remembered for ":&&". (Ingo + Karkat) +Solution: Save the flag values and restore them. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.717 +Problem: ":let list += list" can change a locked list. +Solution: Check for the lock earlier. (Olaf Dabrunz) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.718 +Problem: Autocommands triggered by quickfix cannot get the current title + value. +Solution: Set w:quickfix_title earlier. (Yannick) + Also move the check for a title into the function. +Files: src/quickfix.c + +Patch 7.4.719 +Problem: Overflow when adding MAXCOL to a pointer. +Solution: Subtract pointers instead. (James McCoy) +Files: src/screen.c + +Patch 7.4.720 +Problem: Can't build with Visual Studio 2015. +Solution: Recognize the "version 14" numbers and omit /nodefaultlib when + appropriate. (Paul Moore) +Files: src/Make_mvc.mak + +Patch 7.4.721 +Problem: When 'list' is set Visual mode does not highlight anything in + empty lines. (mgaleski) +Solution: Check the value of lcs_eol in another place. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.722 +Problem: 0x202f is not recognized as a non-breaking space character. +Solution: Add 0x202f to the list. (Christian Brabandt) +Files: runtime/doc/options.txt, src/message.c, src/screen.c + +Patch 7.4.723 +Problem: For indenting, finding the C++ baseclass can be slow. +Solution: Cache the result. (Hirohito Higashi) +Files: src/misc1.c + +Patch 7.4.724 +Problem: Vim icon does not show in Windows context menu. (issue 249) +Solution: Load the icon in GvimExt. +Files: src/GvimExt/gvimext.cpp, src/GvimExt/gvimext.h + +Patch 7.4.725 +Problem: ":call setreg('"', [])" reports an internal error. +Solution: Make the register empty. (Yasuhiro Matsumoto) +Files: src/ops.c + +Patch 7.4.726 (after 7.4.724) +Problem: Cannot build GvimExt. +Solution: Set APPVER to 5.0. (KF Leong) +Files: src/GvimExt/Makefile + +Patch 7.4.727 (after 7.4.724) +Problem: Cannot build GvimExt with MingW. +Solution: Add -lgdi32. (KF Leong) +Files: src/GvimExt/Make_ming.mak + +Patch 7.4.728 +Problem: Can't build with some version of Visual Studio 2015. +Solution: Recognize another version 14 number. (Sinan) +Files: src/Make_mvc.mak + +Patch 7.4.729 (after 7.4.721) +Problem: Occasional crash with 'list' set. +Solution: Fix off-by-one error. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.730 +Problem: When setting the crypt key and using a swap file, text may be + encrypted twice or unencrypted text remains in the swap file. + (Issue 369) +Solution: Call ml_preserve() before re-encrypting. Set correct index for + next pointer block. +Files: src/memfile.c, src/memline.c, src/proto/memline.pro, src/option.c + +Patch 7.4.731 +Problem: The tab menu shows "Close tab" even when it doesn't work. +Solution: Don't show "Close tab" for the last tab. (John Marriott) +Files: src/gui_w48.c, src/gui_gtk_x11.c, src/gui_mac.c, src/gui_motif.c + +Patch 7.4.732 +Problem: The cursor line is not always updated for the "O" command. +Solution: Reset the VALID_CROW flag. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.733 +Problem: test_listchars breaks on MS-Windows. (Kenichi Ito) +Solution: Set fileformat to "unix". (Christian Brabandt) +Files: src/testdir/test_listchars.in + +Patch 7.4.734 +Problem: ml_get error when using "p" in a Visual selection in the last + line. +Solution: Change the behavior at the last line. (Yukihiro Nakadaira) +Files: src/normal.c, src/ops.c, src/testdir/test94.in, + src/testdir/test94.ok + +Patch 7.4.735 +Problem: Wrong argument for sizeof(). +Solution: Use a pointer argument. (Chris Hall) +Files: src/eval.c + +Patch 7.4.736 +Problem: Invalid memory access. +Solution: Avoid going over the end of a NUL terminated string. (Dominique + Pelle) +Files: src/regexp.c + +Patch 7.4.737 +Problem: On MS-Windows vimgrep over arglist doesn't work (Issue 361) +Solution: Only escape backslashes in ## expansion when it is not used as the + path separator. (James McCoy) +Files: src/ex_docmd.c + +Patch 7.4.738 (after 7.4.732) +Problem: Can't compile without the syntax highlighting feature. +Solution: Add #ifdef around use of w_p_cul. (Hirohito Higashi) +Files: src/normal.c, src/screen.c + +Patch 7.4.739 +Problem: In a string "\U" only takes 4 digits, while after CTRL-V U eight + digits can be used. +Solution: Make "\U" also take eight digits. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.740 +Problem: ":1quit" works like ":.quit". (Bohr Shaw) +Solution: Don't exit Vim when a range is specified. (Christian Brabandt) +Files: src/ex_docmd.c, src/testdir/test13.in, src/testdir/test13.ok + +Patch 7.4.741 +Problem: When using += with ":set" a trailing comma is not recognized. + (Issue 365) +Solution: Don't add a second comma. Add a test. (partly by Christian + Brabandt) +Files: src/option.c, src/testdir/test_set.in, src/testdir/test_set.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.742 +Problem: Cannot specify a vertical split when loading a buffer for a + quickfix command. +Solution: Add the "vsplit" value to 'switchbuf'. (Brook Hong) +Files: runtime/doc/options.txt, src/buffer.c, src/option.h + +Patch 7.4.743 +Problem: "p" in Visual mode causes an unexpected line split. +Solution: Advance the cursor first. (Yukihiro Nakadaira) +Files: src/ops.c, src/testdir/test94.in, src/testdir/test94.ok + +Patch 7.4.744 +Problem: No tests for Ruby and Perl. +Solution: Add minimal tests. (Ken Takata) +Files: src/testdir/test_perl.in, src/testdir/test_perl.ok, + src/testdir/test_ruby.in, src/testdir/test_ruby.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.745 +Problem: The entries added by matchaddpos() are returned by getmatches() + but can't be set with setmatches(). (Lcd) +Solution: Fix setmatches(). (Christian Brabandt) +Files: src/eval.c, src/testdir/test63.in, src/testdir/test63.ok + +Patch 7.4.746 +Problem: ":[count]tag" is not always working. (cs86661) +Solution: Set cur_match a bit later. (Hirohito Higashi) +Files: src/tag.c, + +Patch 7.4.747 +Problem: ":cnext" may jump to the wrong column when setting + 'virtualedit=all' (cs86661) +Solution: Reset the coladd field. (Hirohito Higashi) +Files: src/quickfix.c + +Patch 7.4.748 (after 7.4.745) +Problem: Buffer overflow. +Solution: Make the buffer larger. (Kazunobu Kuriyama) +Files: src/eval.c + +Patch 7.4.749 (after 7.4.741) +Problem: For some options two consecutive commas are OK. (Nikolai Pavlov) +Solution: Add the P_ONECOMMA flag. +Files: src/option.c + +Patch 7.4.750 +Problem: Cannot build with clang 3.5 on Cygwin with perl enabled. +Solution: Strip "-fdebug-prefix-map" in configure. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.751 +Problem: It is not obvious how to enable the address sanitizer. +Solution: Add commented-out flags in the Makefile. (Dominique Pelle) + Also add missing test targets. +Files: src/Makefile + +Patch 7.4.752 +Problem: Unicode 8.0 not supported. +Solution: Update tables for Unicode 8.0. Avoid E36 when running the script. + (James McCoy) +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.753 +Problem: Appending in Visual mode with 'linebreak' set does not work + properly. Also when 'selection' is "exclusive". (Ingo Karkat) +Solution: Recalculate virtual columns. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.754 +Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson) +Solution: Make it increment all numbers in the Visual area. (Christian + Brabandt) +Files: runtime/doc/change.txt, src/normal.c, src/ops.c, + src/proto/ops.pro, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.755 +Problem: It is not easy to count the number of characters. +Solution: Add the skipcc argument to strchars(). (Hirohito Higashi, Ken + Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_utf8.in, + src/testdir/test_utf8.ok + +Patch 7.4.756 +Problem: Can't use strawberry Perl 5.22 x64 on MS-Windows. +Solution: Add new defines and #if. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/if_perl.xs + +Patch 7.4.757 +Problem: Cannot detect the background color of a terminal. +Solution: Add T_RBG to request the background color if possible. (Lubomir + Rintel) +Files: src/main.c, src/term.c, src/term.h, src/proto/term.pro + +Patch 7.4.758 +Problem: When 'conceallevel' is 1 and quitting the command-line window with + CTRL-C the first character ':' is erased. +Solution: Reset 'conceallevel' in the command-line window. (Hirohito + Higashi) +Files: src/ex_getln.c + +Patch 7.4.759 +Problem: Building with Lua 5.3 doesn't work, symbols have changed. +Solution: Use the new names for the new version. (Felix Schnizlein) +Files: src/if_lua.c + +Patch 7.4.760 +Problem: Spelling mistakes are not displayed after ":syn spell". +Solution: Force a redraw after ":syn spell" command. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.761 (after 7.4.757) +Problem: The request-background termcode implementation is incomplete. +Solution: Add the missing pieces. +Files: src/option.c, src/term.c + +Patch 7.4.762 (after 7.4.757) +Problem: Comment for may_req_bg_color() is wrong. (Christ van Willegen) +Solution: Rewrite the comment. +Files: src/term.c + +Patch 7.4.763 (after 7.4.759) +Problem: Building with Lua 5.1 doesn't work. +Solution: Define lua_replace and lua_remove. (KF Leong) +Files: src/if_lua.c + +Patch 7.4.764 (after 7.4.754) +Problem: test_increment fails on MS-Windows. (Ken Takata) +Solution: Clear Visual mappings. (Taro Muraoka) +Files: src/testdir/test_increment.in + +Patch 7.4.765 (after 7.4.754) +Problem: CTRL-A and CTRL-X in Visual mode do not always work well. +Solution: Improvements for increment and decrement. (Christian Brabandt) +Files: src/normal.c, src/ops.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.766 (after 7.4.757) +Problem: Background color check does not work on Tera Term. +Solution: Also recognize ST as a termination character. (Hirohito Higashi) +Files: src/term.c + +Patch 7.4.767 +Problem: --remote-tab-silent can fail on MS-Windows. +Solution: Use single quotes to avoid problems with backslashes. (Idea by + Weiyong Mao) +Files: src/main.c + +Patch 7.4.768 +Problem: :diffoff only works properly once. +Solution: Also make :diffoff work when used a second time. (Olaf Dabrunz) +Files: src/diff.c + +Patch 7.4.769 (after 7.4 768) +Problem: Behavior of :diffoff is not tested. +Solution: Add a bit of testing. (Olaf Dabrunz) +Files: src/testdir/test47.in, src/testdir/test47.ok + +Patch 7.4.770 (after 7.4.766) +Problem: Background color response with transparency is not ignored. +Solution: Change the way escape sequences are recognized. (partly by + Hirohito Higashi) +Files: src/ascii.h, src/term.c + +Patch 7.4.771 +Problem: Search does not handle multi-byte character at the start position + correctly. +Solution: Take byte size of character into account. (Yukihiro Nakadaira) +Files: src/search.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_search_mbyte.in, + src/testdir/test_search_mbyte.ok + +Patch 7.4.772 +Problem: Racket 6.2 is not supported on MS-Windows. +Solution: Check for the "racket" subdirectory. (Weiyong Mao) +Files: src/Make_mvc.mak, src/if_mzsch.c + +Patch 7.4.773 +Problem: 'langmap' is used in command-line mode when checking for mappings. + Issue 376. +Solution: Do not use 'langmap' in command-line mode. (Larry Velazquez) +Files: src/getchar.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.774 +Problem: When using the CompleteDone autocommand event it's difficult to + get to the completed items. +Solution: Add the v:completed_items variable. (Shougo Matsu) +Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/edit.c, + src/eval.c, src/macros.h, src/proto/eval.pro, src/vim.h + +Patch 7.4.775 +Problem: It is not possible to avoid using the first item of completion. +Solution: Add the "noinsert" and "noselect" values to 'completeopt'. (Shougo + Matsu) +Files: runtime/doc/options.txt, src/edit.c, src/option.c + +Patch 7.4.776 +Problem: Equivalence class for 'd' does not work correctly. +Solution: Fix 0x1e0f and 0x1d0b. (Dominique Pelle) +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.777 +Problem: The README file doesn't look nice on github. +Solution: Add a markdown version of the README file. +Files: Filelist, README.md + +Patch 7.4.778 +Problem: Coverity warns for uninitialized variable. +Solution: Change condition of assignment. +Files: src/ops.c + +Patch 7.4.779 +Problem: Using CTRL-A in a line without a number moves the cursor. May + cause a crash when at the start of the line. (Urtica Dioica) +Solution: Do not move the cursor if no number was changed. +Files: src/ops.c + +Patch 7.4.780 +Problem: Compiler complains about uninitialized variable and clobbered + variables. +Solution: Add Initialization. Make variables static. +Files: src/ops.c, src/main.c + +Patch 7.4.781 +Problem: line2byte() returns one less when 'bin' and 'noeol' are set. +Solution: Only adjust the size for the last line. (Rob Wu) +Files: src/memline.c + +Patch 7.4.782 +Problem: Still a few problems with CTRL-A and CTRL-X in Visual mode. +Solution: Fix the reported problems. (Christian Brabandt) +Files: src/charset.c, src/eval.c, src/ex_cmds.c, src/ex_getln.c, + src/misc2.c, src/normal.c, src/ops.c, src/option.c, + src/proto/charset.pro, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.783 +Problem: copy_chars() and copy_spaces() are inefficient. +Solution: Use memset() instead. (Dominique Pelle) +Files: src/ex_getln.c, src/misc2.c, src/ops.c, src/proto/misc2.pro, + src/screen.c + +Patch 7.4.784 +Problem: Using both "noinsert" and "noselect" in 'completeopt' does not + work properly. +Solution: Change the ins_complete() calls. (Ozaki Kiichi) +Files: src/edit.c + +Patch 7.4.785 +Problem: On some systems automatically adding the missing EOL causes + problems. Setting 'binary' has too many side effects. +Solution: Add the 'fixeol' option, default on. (Pavel Samarkin) +Files: src/buffer.c, src/fileio.c, src/memline.c, src/netbeans.c, + src/ops.c, src/option.c, src/option.h, src/os_unix.c, + src/os_win32.c, src/structs.h, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_fixeol.in, + src/testdir/test_fixeol.ok, runtime/doc/options.txt, + runtime/optwin.vim + +Patch 7.4.786 +Problem: It is not possible for a plugin to adjust to a changed setting. +Solution: Add the OptionSet autocommand event. (Christian Brabandt) +Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/eval.c, + src/fileio.c, src/option.c, src/proto/eval.pro, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok, src/vim.h + +Patch 7.4.787 (after 7.4.786) +Problem: snprintf() isn't available everywhere. +Solution: Use vim_snprintf(). (Ken Takata) +Files: src/option.c + +Patch 7.4.788 (after 7.4.787) +Problem: Can't build without the crypt feature. (John Marriott) +Solution: Add #ifdef's. +Files: src/option.c + +Patch 7.4.789 (after 7.4.788) +Problem: Using freed memory and crash. (Dominique Pelle) +Solution: Correct use of pointers. (Hirohito Higashi) +Files: src/option.c + +Patch 7.4.790 (after 7.4.786) +Problem: Test fails when the autochdir feature is not available. Test + output contains the test script. +Solution: Check for the autochdir feature. (Kazunobu Kuriyama) Only write + the relevant test output. +Files: src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok + +Patch 7.4.791 +Problem: The buffer list can be very long. +Solution: Add an argument to ":ls" to specify the type of buffer to list. + (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/buffer.c, src/ex_cmds.h + +Patch 7.4.792 +Problem: Can only conceal text by defining syntax items. +Solution: Use matchadd() to define concealing. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c, + src/proto/window.pro, src/screen.c, src/structs.h, + src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_match_conceal.in, + src/testdir/test_match_conceal.ok, src/window.c + +Patch 7.4.793 +Problem: Can't specify when not to ring the bell. +Solution: Add the 'belloff' option. (Christian Brabandt) +Files: runtime/doc/options.txt, src/edit.c, src/ex_getln.c, + src/hangulin.c, src/if_lua.c, src/if_mzsch.c, src/if_tcl.c, + src/message.c, src/misc1.c, src/normal.c, src/option.c, + src/option.h, src/proto/misc1.pro, src/search.c, src/spell.c + +Patch 7.4.794 +Problem: Visual Studio 2015 is not recognized. +Solution: Add the version numbers to the makefile. (Taro Muraoka) +Files: src/Make_mvc.mak + +Patch 7.4.795 +Problem: The 'fixeol' option is not copied to a new window. +Solution: Copy the option value. (Yasuhiro Matsumoto) +Files: src/option.c + +Patch 7.4.796 +Problem: Warning from 64 bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.797 +Problem: Crash when using more lines for the command line than + 'maxcombine'. +Solution: Use the correct array index. Also, do not try redrawing when + exiting. And use screen_Columns instead of Columns. +Files: src/screen.c + +Patch 7.4.798 (after 7.4.753) +Problem: Repeating a change in Visual mode does not work as expected. + (Urtica Dioica) +Solution: Make redo in Visual mode work better. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.799 +Problem: Accessing memory before an allocated block. +Solution: Check for not going before the start of a pattern. (Dominique + Pelle) +Files: src/fileio.c + +Patch 7.4.800 +Problem: Using freed memory when triggering CmdUndefined autocommands. +Solution: Set pointer to NULL. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.801 (after 7.4.769) +Problem: Test for ":diffoff" doesn't catch all potential problems. +Solution: Add a :diffthis and a :diffoff command. (Olaf Dabrunz) +Files: src/testdir/test47.in + +Patch 7.4.802 +Problem: Using "A" in Visual mode while 'linebreak' is set is not tested. +Solution: Add a test for this, verifies the problem is fixed. (Ingo Karkat) +Files: src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.803 +Problem: C indent does not support C11 raw strings. (Mark Lodato) +Solution: Do not change indent inside the raw string. +Files: src/search.c, src/misc1.c, src/edit.c, src/ops.c, + src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.804 +Problem: Xxd doesn't have a license notice. +Solution: Add license as indicated by Juergen. +Files: src/xxd/xxd.c + +Patch 7.4.805 +Problem: The ruler shows "Bot" even when there are only filler lines + missing. (Gary Johnson) +Solution: Use "All" when the first line and one filler line are visible. +Files: src/buffer.c + +Patch 7.4.806 +Problem: CTRL-A in Visual mode doesn't work properly with "alpha" in + 'nrformats'. +Solution: Make it work. (Christian Brabandt) +Files: src/ops.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.807 (after 7.4.798) +Problem: After CTRL-V CTRL-A mode isn't updated. (Hirohito Higashi) +Solution: Clear the command line or update the displayed command. +Files: src/normal.c + +Patch 7.4.808 +Problem: On MS-Windows 8 IME input doesn't work correctly. +Solution: Read console input before calling MsgWaitForMultipleObjects(). + (vim-jp, Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.809 (after 7.4.802) +Problem: Test is duplicated. +Solution: Roll back 7.4.802. +Files: src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.810 +Problem: With a sequence of commands using buffers in diff mode E749 is + given. (itchyny) +Solution: Skip unloaded buffer. (Hirohito Higashi) +Files: src/diff.c + +Patch 7.4.811 +Problem: Invalid memory access when using "exe 'sc'". +Solution: Avoid going over the end of the string. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.812 +Problem: Gcc sanitizer complains about using a NULL pointer to memmove(). +Solution: Only call memmove when there is something to move. (Vittorio + Zecca) +Files: src/memline.c + +Patch 7.4.813 +Problem: It is not possible to save and restore character search state. +Solution: Add getcharsearch() and setcharsearch(). (James McCoy) +Files: runtime/doc/eval.txt, src/eval.c, src/proto/search.pro, + src/search.c, src/testdir/test_charsearch.in, + src/testdir/test_charsearch.ok, src/testdir/Makefile, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms + +Patch 7.4.814 +Problem: Illegal memory access with "sy match a fold". +Solution: Check for empty string. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.815 +Problem: Invalid memory access when doing ":call g:". +Solution: Check for an empty name. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.816 +Problem: Invalid memory access when doing ":fun X(". +Solution: Check for missing ')'. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.817 +Problem: Invalid memory access in file_pat_to_reg_pat(). +Solution: Use vim_isspace() instead of checking for a space only. (Dominique + Pelle) +Files: src/fileio.c + +Patch 7.4.818 +Problem: 'linebreak' breaks c% if the last Visual selection was block. + (Chris Morganiser, Issue 389) +Solution: Handle Visual block mode differently. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.819 +Problem: Beeping when running the tests. +Solution: Fix 41 beeps. (Roland Eggner) +Files: src/testdir/test17.in, src/testdir/test29.in, + src/testdir/test4.in, src/testdir/test61.in, + src/testdir/test82.in, src/testdir/test83.in, + src/testdir/test90.in, src/testdir/test95.in, + src/testdir/test_autoformat_join.in + +Patch 7.4.820 +Problem: Invalid memory access in file_pat_to_reg_pat. +Solution: Avoid looking before the start of a string. (Dominique Pelle) +Files: src/fileio.c + +Patch 7.4.821 +Problem: Coverity reports a few problems. +Solution: Avoid the warnings. (Christian Brabandt) +Files: src/ex_docmd.c, src/option.c, src/screen.c + +Patch 7.4.822 +Problem: More problems reported by coverity. +Solution: Avoid the warnings. (Christian Brabandt) +Files: src/os_unix.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_getln.c, src/fold.c, src/gui.c, src/gui_w16.c, + src/gui_w32.c, src/if_cscope.c, src/if_xcmdsrv.c, src/move.c, + src/normal.c, src/regexp.c, src/syntax.c, src/ui.c, src/window.c + +Patch 7.4.823 +Problem: Cursor moves after CTRL-A on alphabetic character. +Solution: (Hirohito Higashi, test by Christian Brabandt) +Files: src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/ops.c + +Patch 7.4.824 (after 7.4.813) +Problem: Can't compile without the multi-byte feature. (John Marriott) +Solution: Add #ifdef. +Files: src/eval.c + +Patch 7.4.825 +Problem: Invalid memory access for ":syn keyword x a[". +Solution: Do not skip over the NUL. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.826 +Problem: Compiler warnings and errors. +Solution: Make it build properly without the multi-byte feature. +Files: src/eval.c, src/search.c + +Patch 7.4.827 +Problem: Not all test targets are in the Makefile. +Solution: Add the missing targets. +Files: src/Makefile + +Patch 7.4.828 +Problem: Crash when using "syn keyword x c". (Dominique Pelle) +Solution: Initialize the keyword table. (Raymond Ko, PR 397) +Files: src/syntax.c + +Patch 7.4.829 +Problem: Crash when clicking in beval balloon. (Travis Lebsock) +Solution: Use PostMessage() instead of DestroyWindow(). (Raymond Ko, PR 298) +Files: src/gui_w32.c + +Patch 7.4.830 +Problem: Resetting 'encoding' when doing ":set all&" causes problems. + (Bjorn Linse) Display is not updated. +Solution: Do not reset 'encoding'. Do a full redraw. +Files: src/option.c + +Patch 7.4.831 +Problem: When expanding `=expr` on the command line and encountering an + error, the command is executed anyway. +Solution: Bail out when an error is detected. +Files: src/misc1.c + +Patch 7.4.832 +Problem: $HOME in `=$HOME . '/.vimrc'` is expanded too early. +Solution: Skip over `=expr` when expanding environment names. +Files: src/misc1.c + +Patch 7.4.833 +Problem: More side effects of ":set all&" are missing. (Björn Linse) +Solution: Call didset_options() and add didset_options2() to collect more + side effects to take care of. Still not everything... +Files: src/option.c + +Patch 7.4.834 +Problem: gettabvar() doesn't work after Vim start. (Szymon Wrozynski) +Solution: Handle first window in tab still being NULL. (Christian Brabandt) +Files: src/eval.c, src/testdir/test91.in, src/testdir/test91.ok + +Patch 7.4.835 +Problem: Comparing utf-8 sequences does not handle different byte sizes + correctly. +Solution: Get the byte size of each character. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.836 +Problem: Accessing uninitialized memory. +Solution: Add missing calls to init_tv(). (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.837 +Problem: Compiler warning with MSVC compiler when using +sniff. +Solution: Use Sleep() instead of _sleep(). (Tux) +Files: src/if_sniff.c + +Patch 7.4.838 (after 7.4.833) +Problem: Can't compile without the crypt feature. (John Marriott) +Solution: Add #ifdef. +Files: src/option.c + +Patch 7.4.839 +Problem: Compiler warning on 64-bit system. +Solution: Add cast to int. (Mike Williams) +Files: src/search.c + +Patch 7.4.840 (after 7.4.829) +Problem: Tooltip window stays open. +Solution: Send a WM_CLOSE message. (Jurgen Kramer) +Files: src/gui_w32.c + +Patch 7.4.841 +Problem: Can't compile without the multi-byte feature. (John Marriott) +Solution: Add more #ifdef's. +Files: src/option.c + +Patch 7.4.842 (after 7.4.840) +Problem: Sending too many messages to close the balloon. +Solution: Only send a WM_CLOSE message. (Jurgen Kramer) +Files: src/gui_w32.c + +Patch 7.4.843 (after 7.4.835) +Problem: Still possible to go beyond the end of a string. +Solution: Check for NUL also in second string. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.844 +Problem: When '#' is in 'isident' the is# comparator doesn't work. +Solution: Don't use vim_isIDc(). (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_comparators.in, + src/testdir/test_comparators.ok, src/testdir/Makefile, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms + +Patch 7.4.845 +Problem: Compiler warning for possible loss of data. +Solution: Add a type cast. (Erich Ritz) +Files: src/misc1.c + +Patch 7.4.846 +Problem: Some GitHub users don't know how to use issues. +Solution: Add a file that explains the basics of contributing. +Files: Filelist, CONTRIBUTING.md + +Patch 7.4.847 +Problem: "vi)d" may leave a character behind. +Solution: Skip over multi-byte character. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.848 +Problem: CTRL-A on hex number in Visual block mode is incorrect. +Solution: Account for the "0x". (Hirohito Higashi) +Files: src/charset.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.849 +Problem: Moving the cursor in Insert mode starts new undo sequence. +Solution: Add CTRL-G U to keep the undo sequence for the following cursor + movement command. (Christian Brabandt) +Files: runtime/doc/insert.txt, src/edit.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.850 (after 7.4.846) +Problem: <Esc> does not show up. +Solution: Use > and <. (Kazunobu Kuriyama) +Files: CONTRIBUTING.md + +Patch 7.4.851 +Problem: Saving and restoring the console buffer does not work properly. +Solution: Instead of ReadConsoleOutputA/WriteConsoleOutputA use + CreateConsoleScreenBuffer and SetConsoleActiveScreenBuffer. + (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.852 +Problem: On MS-Windows console Vim uses ANSI APIs for keyboard input and + console output, it cannot input/output Unicode characters. +Solution: Use Unicode APIs for console I/O. (Ken Takata, Yasuhiro Matsumoto) +Files: src/os_win32.c, src/ui.c, runtime/doc/options.txt + +Patch 7.4.853 +Problem: "zt" in diff mode does not always work properly. (Gary Johnson) +Solution: Don't count filler lines twice. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.854 (after 7.4.850) +Problem: Missing information about runtime files. +Solution: Add section about runtime files. (Christian Brabandt) +Files: CONTRIBUTING.md + +Patch 7.4.855 +Problem: GTK: font glitches for combining characters +Solution: Use pango_shape_full() instead of pango_shape(). (luchr, PR #393) +Files: src/gui_gtk_x11.c + +Patch 7.4.856 +Problem: "zt" still doesn't work well with filler lines. (Gary Johnson) +Solution: Check for filler lines above the cursor. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.857 +Problem: Dragging the current tab with the mouse doesn't work properly. +Solution: Take the current tabpage index into account. (Hirohito Higashi) +Files: src/normal.c + +Patch 7.4.858 +Problem: It's a bit clumsy to execute a command on a list of matches. +Solution: Add the ":ldo", ":lfdo", ":cdo" and ":cfdo" commands. (Yegappan + Lakshmanan) +Files: runtime/doc/cmdline.txt, runtime/doc/editing.txt, + runtime/doc/index.txt, runtime/doc/quickfix.txt, + runtime/doc/tabpage.txt, runtime/doc/windows.txt, src/ex_cmds.h, + src/ex_cmds2.c, src/ex_docmd.c, src/proto/quickfix.pro, + src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_cdo.in, + src/testdir/test_cdo.ok + +Patch 7.4.859 +Problem: Vim doesn't recognize all htmldjango files. +Solution: Recognize a comment. (Daniel Hahler, PR #410) +Files: runtime/filetype.vim + +Patch 7.4.860 +Problem: Filetype detection is outdated. +Solution: Include all recent and not-so-recent changes. +Files: runtime/filetype.vim + +Patch 7.4.861 (after 7.4.855) +Problem: pango_shape_full() is not always available. +Solution: Add a configure check. +Files: src/configure.in, src/auto/configure, src/config.h.in, + src/gui_gtk_x11.c + +Patch 7.4.862 (after 7.4.861) +Problem: Still problems with pango_shape_full() not available. +Solution: Change AC_TRY_COMPILE to AC_TRY_LINK. +Files: src/configure.in, src/auto/configure + +Patch 7.4.863 (after 7.4.856) +Problem: plines_nofill() used without the diff feature. +Solution: Define PLINES_NOFILL(). +Files: src/macros.h, src/move.c + +Patch 7.4.864 (after 7.4.858) +Problem: Tiny build fails. +Solution: Put qf_ items inside #ifdef. +Files: src/ex_docmd.c + +Patch 7.4.865 +Problem: Compiler warning for uninitialized variable. +Solution: Initialize. +Files: src/ex_cmds2.c + +Patch 7.4.866 +Problem: Crash when changing the 'tags' option from a remote command. + (Benjamin Fritz) +Solution: Instead of executing messages immediately, use a queue, like for + netbeans. (James Kolb) +Files: src/ex_docmd.c, src/getchar.c, src/gui_gtk_x11.c, src/gui_w48.c, + src/gui_x11.c, src/if_xcmdsrv.c, src/misc2.c, src/os_unix.c, + src/proto/if_xcmdsrv.pro, src/proto/misc2.pro, src/macros.h + +Patch 7.4.867 (after 7.4.866) +Problem: Can't build on MS-Windows. (Taro Muraoka) +Solution: Adjust #ifdef. +Files: src/misc2.c + +Patch 7.4.868 +Problem: 'smarttab' is also effective when 'paste' is enabled. (Alexander + Monakov) +Solution: Disable 'smarttab' when 'paste' is set. (Christian Brabandt) + Do the same for 'expandtab'. +Files: src/option.c, src/structs.h + +Patch 7.4.869 +Problem: MS-Windows: scrolling may cause text to disappear when using an + Intel GPU. +Solution: Call GetPixel(). (Yohei Endo) +Files: src/gui_w48.c + +Patch 7.4.870 +Problem: May get into an invalid state when using getchar() in an + expression mapping. +Solution: Anticipate mod_mask to change. (idea by Yukihiro Nakadaira) +Files: src/getchar.c + +Patch 7.4.871 +Problem: Vim leaks memory, when 'wildignore' filters out all matches. +Solution: Free the files array when it becomes empty. +Files: src/misc1.c + +Patch 7.4.872 +Problem: Not using CI services available. +Solution: Add configuration files for travis and appveyor. (Ken Takata, + vim-jp, PR #401) +Files: .travis.yml, appveyor.yml, Filelist + +Patch 7.4.873 (after 7.4.866) +Problem: Compiler warning for unused variable. (Tony Mechelynck) +Solution: Remove the variable. Also fix int vs long_u mixup. +Files: src/if_xcmdsrv.c + +Patch 7.4.874 +Problem: MS-Windows: When Vim runs inside another application, the size + isn't right. +Solution: When in child mode compute the size differently. (Agorgianitis + Loukas) +Files: src/gui_w48.c + +Patch 7.4.875 +Problem: Not obvious how to contribute. +Solution: Add a remark about CONTRIBUTING.md to README.md +Files: README.md + +Patch 7.4.876 +Problem: Windows7: when using vim.exe with msys or msys2, conhost.exe + (console window provider on Windows7) will freeze or crash. +Solution: Make original screen buffer active, before executing external + program. And when the program is finished, revert to vim's one. + (Taro Muraoka) +Files: src/os_win32.c + +Patch 7.4.877 (after 7.4.843) +Problem: ":find" sometimes fails. (Excanoe) +Solution: Compare current characters instead of previous ones. +Files: src/misc2.c + +Patch 7.4.878 +Problem: Coverity error for clearing only one byte of struct. +Solution: Clear the whole struct. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.879 +Problem: Can't see line numbers in nested function calls. +Solution: Add line number to the file name. (Alberto Fanjul) +Files: src/eval.c + +Patch 7.4.880 +Problem: No build and coverage status. +Solution: Add links to the README file. (Christian Brabandt) +Files: README.md + +Patch 7.4.881 (after 7.4.879) +Problem: Test 49 fails. +Solution: Add line number to check of call stack. +Files: src/testdir/test49.vim + +Patch 7.4.882 +Problem: When leaving the command line window with CTRL-C while a + completion menu is displayed the menu isn't removed. +Solution: Force a screen update. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.883 (after 7.4.818) +Problem: Block-mode replace works characterwise instead of blockwise after + column 147. (Issue #422) +Solution: Set Visual mode. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.884 +Problem: Travis also builds on a tag push. +Solution: Filter out tag pushes. (Kenichi Ito) +Files: .travis.yml + +Patch 7.4.885 +Problem: When doing an upwards search without wildcards the search fails if + the initial directory doesn't exist. +Solution: Fix the non-wildcard case. (Stefan Kempf) +Files: src/misc2.c + +Patch 7.4.886 (after 7.4.876) +Problem: Windows7: Switching screen buffer causes flicker when using + system(). +Solution: Instead of actually switching screen buffer, duplicate the handle. + (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.887 +Problem: Using uninitialized memory for regexp with back reference. + (Dominique Pelle) +Solution: Initialize end_lnum. +Files: src/regexp_nfa.c + +Patch 7.4.888 +Problem: The OptionSet autocommands are not triggered from setwinvar(). +Solution: Do not use switch_win() when not needed. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.889 +Problem: Triggering OptionSet from setwinvar() isn't tested. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok + +Patch 7.4.890 +Problem: Build failure when using dynamic python but not python3. +Solution: Adjust the #if to also include DYNAMIC_PYTHON3 and UNIX. +Files: src/if_python3.c + +Patch 7.4.891 +Problem: Indentation of array initializer is wrong. +Solution: Avoid that calling find_start_rawstring() changes the position + returned by find_start_comment(), add a test. (Hirohito Higashi) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.892 +Problem: On MS-Windows the iconv DLL may have a different name. +Solution: Also try libiconv2.dll and libiconv-2.dll. (Yasuhiro Matsumoto) +Files: src/mbyte.c + +Patch 7.4.893 +Problem: C indenting is wrong below a "case (foo):" because it is + recognized as a C++ base class construct. Issue #38. +Solution: Check for the case keyword. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.894 +Problem: vimrun.exe is picky about the number of spaces before -s. +Solution: Skip all spaces. (Cam Sinclair) +Files: src/vimrun.c + +Patch 7.4.895 +Problem: Custom command line completion does not work for a command + containing digits. +Solution: Skip over the digits. (suggested by Yasuhiro Matsumoto) +Files: src/ex_docmd.c + +Patch 7.4.896 +Problem: Editing a URL, which netrw should handle, doesn't work. +Solution: Avoid changing slashes to backslashes. (Yasuhiro Matsumoto) +Files: src/fileio.c, src/os_mswin.c + +Patch 7.4.897 +Problem: Freeze and crash when there is a sleep in a remote command. + (Karl Yngve Lervåg) +Solution: Remove a message from the queue before dealing with it. (James + Kolb) +Files: src/if_xcmdsrv.c + +Patch 7.4.898 +Problem: The 'fixendofline' option is set on with ":edit". +Solution: Don't set the option when clearing a buffer. (Yasuhiro Matsumoto) +Files: src/buffer.c + +Patch 7.4.899 +Problem: README file is not optimal. +Solution: Move buttons, update some text. (closes #460) +Files: README.txt, README.md + +Patch 7.4.900 (after 7.4.899) +Problem: README file can still be improved +Solution: Add a couple of links. (Christian Brabandt) +Files: README.md + +Patch 7.4.901 +Problem: When a BufLeave autocommand changes folding in a way it syncs + undo, undo can be corrupted. +Solution: Prevent undo sync. (Jacob Niehus) +Files: src/popupmnu.c + +Patch 7.4.902 +Problem: Problems with using the MS-Windows console. +Solution: Revert patches 7.4.851, 7.4.876 and 7.4.886 until we find a better + solution. (suggested by Ken Takata) +Files: src/os_win32.c + +Patch 7.4.903 +Problem: MS-Windows: When 'encoding' differs from the current code page, + expanding wildcards may cause illegal memory access. +Solution: Allocate a longer buffer. (Ken Takata) +Files: src/misc1.c + +Patch 7.4.904 +Problem: Vim does not provide .desktop files. +Solution: Include and install .desktop files. (James McCoy, closes #455) +Files: Filelist, runtime/vim.desktop, runtime/gvim.desktop, src/Makefile + +Patch 7.4.905 +Problem: Python interface can produce error "vim.message' object has no + attribute 'isatty'". +Solution: Add dummy isatty(), readable(), etc. (closes #464) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.906 +Problem: On MS-Windows the viminfo file is (always) given the hidden + attribute. (raulnac) +Solution: Check the hidden attribute in a different way. (Ken Takata) +Files: src/ex_cmds.c, src/os_win32.c, src/os_win32.pro + +Patch 7.4.907 +Problem: Libraries for dynamically loading interfaces can only be defined + at compile time. +Solution: Add options to specify the dll names. (Kazuki Sakamoto, + closes #452) +Files: runtime/doc/if_lua.txt, runtime/doc/if_perl.txt, + runtime/doc/if_pyth.txt, runtime/doc/if_ruby.txt, + runtime/doc/options.txt, src/if_lua.c, src/if_perl.xs, + src/if_python.c, src/if_python3.c, src/if_ruby.c, src/option.c, + src/option.h + +Patch 7.4.908 (after 7.4.907) +Problem: Build error with MingW compiler. (Cesar Romani) +Solution: Change #if into #ifdef. +Files: src/if_perl.xs + +Patch 7.4.909 (after 7.4.905) +Problem: "make install" fails. +Solution: Only try installing desktop files if the destination directory + exists. +Files: src/Makefile + +Patch 7.4.910 (after 7.4.905) +Problem: Compiler complains about type punned pointer. +Solution: Use another way to increment the ref count. +Files: src/if_py_both.h + +Patch 7.4.911 +Problem: t_Ce and t_Cs are documented but not supported. (Hirohito Higashi) +Solution: Define the options. +Files: src/option.c + +Patch 7.4.912 +Problem: Wrong indenting for C++ constructor. +Solution: Recognize ::. (Anhong) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.913 +Problem: No utf-8 support for the hangul input feature. +Solution: Add utf-8 support. (Namsh) +Files: src/gui.c, src/hangulin.c, src/proto/hangulin.pro, src/screen.c, + src/ui.c, runtime/doc/hangulin.txt, src/feature.h + +Patch 7.4.914 +Problem: New compiler warning: logical-not-parentheses +Solution: Silence the warning. +Files: src/term.c + +Patch 7.4.915 +Problem: When removing from 'path' and then adding, a comma may go missing. + (Malcolm Rowe) +Solution: Fix the check for P_ONECOMMA. (closes #471) +Files: src/option.c, src/testdir/test_options.in, + src/testdir/test_options.ok + +Patch 7.4.916 +Problem: When running out of memory while copying a dict memory may be + freed twice. (ZyX) +Solution: Do not call the garbage collector when running out of memory. +Files: src/misc2.c + +Patch 7.4.917 +Problem: Compiler warning for comparing signed and unsigned. +Solution: Add a type cast. +Files: src/hangulin.c + +Patch 7.4.918 +Problem: A digit in an option name has problems. +Solution: Rename 'python3dll' to 'pythonthreedll'. +Files: src/option.c, src/option.h, runtime/doc/options.txt + +Patch 7.4.919 +Problem: The dll options are not in the options window. +Solution: Add the dll options. And other fixes. +Files: runtime/optwin.vim + +Patch 7.4.920 +Problem: The rubydll option is not in the options window. +Solution: Add the rubydll option. +Files: runtime/optwin.vim + +Patch 7.4.921 (after 7.4.906) +Problem: Missing proto file update. (Randall W. Morris) +Solution: Add the missing line for mch_ishidden. +Files: src/proto/os_win32.pro + +Patch 7.4.922 +Problem: Leaking memory with ":helpt {dir-not-exists}". +Solution: Free dirname. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.923 +Problem: Prototypes not always generated. +Solution: Change #if to OR with PROTO. +Files: src/window.c + +Patch 7.4.924 +Problem: DEVELOPER_DIR gets reset by configure. +Solution: Do not reset DEVELOPER_DIR when there is no --with-developer-dir + argument. (Kazuki Sakamoto, closes #482) +Files: src/configure.in, src/auto/configure + +Patch 7.4.925 +Problem: User may yank or put using the register being recorded in. +Solution: Add the recording register in the message. (Christian Brabandt, + closes #470) +Files: runtime/doc/options.txt, runtime/doc/repeat.txt, src/ops.c, + src/option.h, src/screen.c + +Patch 7.4.926 +Problem: Completing the longest match doesn't work properly with multi-byte + characters. +Solution: When using multi-byte characters use another way to find the + longest match. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_utf8.in, src/testdir/test_utf8.ok + +Patch 7.4.927 +Problem: Ruby crashes when there is a runtime error. +Solution: Use ruby_options() instead of ruby_process_options(). (Damien) +Files: src/if_ruby.c + +Patch 7.4.928 +Problem: A clientserver message interrupts handling keys of a mapping. +Solution: Have mch_inchar() send control back to WaitForChar when it is + interrupted by server message. (James Kolb) +Files: src/os_unix.c + +Patch 7.4.929 +Problem: "gv" after paste selects one character less if 'selection' is + "exclusive". +Solution: Increment the end position. (Christian Brabandt) +Files: src/normal.c, src/testdir/test94.in, src/testdir/test94.ok + +Patch 7.4.930 +Problem: MS-Windows: Most users appear not to like the window border. +Solution: Remove WS_EX_CLIENTEDGE. (Ian Halliday) +Files: src/gui_w32.c + +Patch 7.4.931 (after 7.4.929) +Problem: Test 94 fails on some systems. +Solution: Set 'encoding' to utf-8. +Files: src/testdir/test94.in + +Patch 7.4.932 (after 7.4.926) +Problem: test_utf8 has confusing dummy command. +Solution: Use a real command instead of a colon. +Files: src/testdir/test_utf8.in + +Patch 7.4.933 (after 7.4.926) +Problem: Crash when using longest completion match. +Solution: Fix array index. +Files: src/ex_getln.c + +Patch 7.4.934 +Problem: Appveyor also builds on a tag push. +Solution: Add a skip_tags line. (Kenichi Ito, closes #489) +Files: appveyor.yml + +Patch 7.4.935 (after 7.4.932) +Problem: test_utf8 fails on MS-Windows when executed with gvim. +Solution: Use the insert flag on feedkeys() to put the string before the + ":" that was already read when checking for available chars. +Files: src/testdir/test_utf8.in + +Patch 7.4.936 +Problem: Crash when dragging with the mouse. +Solution: Add safety check for NULL pointer. Check mouse position for valid + value. (Hirohito Higashi) +Files: src/window.c, src/term.c + +Patch 7.4.937 +Problem: Segfault reading uninitialized memory. +Solution: Do not read match \z0, it does not exist. (Marius Gedminas, closes + #497) +Files: src/regexp_nfa.c + +Patch 7.4.938 +Problem: X11 and GTK have more mouse buttons than Vim supports. +Solution: Recognize more mouse buttons. (Benoit Pierre, closes #498) +Files: src/gui_gtk_x11.c, src/gui_x11.c + +Patch 7.4.939 +Problem: Memory leak when encountering a syntax error. +Solution: Free the memory. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.940 +Problem: vt52 terminal codes are not correct. +Solution: Move entries outside of #if. (Random) Adjustments based on + documented codes. +Files: src/term.c + +Patch 7.4.941 +Problem: There is no way to ignore case only for tag searches. +Solution: Add the 'tagcase' option. (Gary Johnson) +Files: runtime/doc/options.txt, runtime/doc/quickref.txt, + runtime/doc/tagsrch.txt, runtime/doc/usr_29.txt, + runtime/optwin.vim, src/Makefile, src/buffer.c, src/option.c, + src/option.h, src/structs.h, src/tag.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_tagcase.in, src/testdir/test_tagcase.ok + +Patch 7.4.942 (after 7.4.941) +Problem: test_tagcase breaks for small builds. +Solution: Bail out of the test early. (Hirohito Higashi) +Files: src/testdir/test_tagcase.in + +Patch 7.4.943 +Problem: Tests are not run. +Solution: Add test_writefile to makefiles. (Ken Takata) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.944 +Problem: Writing tests for Vim script is hard. +Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add + the v:errors variable. Add the runtest script. Add a first new + style test script. +Files: src/eval.c, src/vim.h, src/misc2.c, src/testdir/Makefile, + src/testdir/runtest.vim, src/testdir/test_assert.vim, + runtime/doc/eval.txt + +Patch 7.4.945 (after 7.4.944) +Problem: New style testing is incomplete. +Solution: Add the runtest script to the list of distributed files. + Add the new functions to the function overview. + Rename the functions to match Vim function style. + Move undolevels testing into a new style test script. +Files: Filelist, runtime/doc/usr_41.txt, runtime/doc/eval.txt, + src/testdir/test_assert.vim, src/testdir/Makefile, + src/testdir/test_undolevels.vim, src/testdir/test100.in, + src/testdir/test100.ok + +Patch 7.4.946 (after 7.4.945) +Problem: Missing changes in source file. +Solution: Include changes to the eval.c file. +Files: src/eval.c + +Patch 7.4.947 +Problem: Test_listchars fails with MingW. (Michael Soyka) +Solution: Add the test to the ones that need the fileformat fixed. + (Christian Brabandt) +Files: src/testdir/Make_ming.mak + +Patch 7.4.948 +Problem: Can't build when the insert_expand feature is disabled. +Solution: Add #ifdefs. (Dan Pasanen, closes #499) +Files: src/eval.c, src/fileio.c + +Patch 7.4.949 +Problem: When using 'colorcolumn' and there is a sign with a fullwidth + character the highlighting is wrong. (Andrew Stewart) +Solution: Only increment vcol when in the right state. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.950 +Problem: v:errors is not initialized. +Solution: Initialize it to an empty list. (Thinca) +Files: src/eval.c + +Patch 7.4.951 +Problem: Sorting number strings does not work as expected. (Luc Hermitte) +Solution: Add the "N" argument to sort() +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/testdir/test_sort.vim, src/testdir/Makefile + +Patch 7.4.952 +Problem: 'lispwords' is tested in the old way. +Solution: Make a new style test for 'lispwords'. +Files: src/testdir/test_alot.vim, src/testdir/test_lispwords.vim, + src/testdir/test100.in, src/testdir/test100.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.953 +Problem: When a test script navigates to another buffer the .res file is + created with the wrong name. +Solution: Use the "testname" for the .res file. (Damien) +Files: src/testdir/runtest.vim + +Patch 7.4.954 +Problem: When using Lua there may be a crash. (issue #468) +Solution: Avoid using an uninitialized tv. (Yukihiro Nakadaira) +Files: src/if_lua.c + +Patch 7.4.955 +Problem: Vim doesn't recognize .pl6 and .pod6 files. +Solution: Recognize them as perl6 and pod6. (Mike Eve, closes #511) +Files: runtime/filetype.vim + +Patch 7.4.956 +Problem: A few more file name extensions not recognized. +Solution: Add .asciidoc, .bzl, .gradle, etc. +Files: runtime/filetype.vim + +Patch 7.4.957 +Problem: Test_tagcase fails when using another language than English. +Solution: Set the messages language to C. (Kenichi Ito) +Files: src/testdir/test_tagcase.in + +Patch 7.4.958 +Problem: Vim checks if the directory "$TMPDIR" exists. +Solution: Do not check if the name starts with "$". +Files: src/fileio.c + +Patch 7.4.959 +Problem: When setting 'term' the clipboard ownership is lost. +Solution: Do not call clip_init(). (James McCoy) +Files: src/term.c + +Patch 7.4.960 +Problem: Detecting every version of nmake is clumsy. +Solution: Use a tiny C program to get the version of _MSC_VER. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 7.4.961 +Problem: Test107 fails in some circumstances. +Solution: When using "zt", "zb" and "z=" recompute the fraction. +Files: src/normal.c, src/window.c, src/proto/window.pro + +Patch 7.4.962 +Problem: Cannot run the tests with gvim. Cannot run individual new tests. +Solution: Add the -f flag. Add new test targets in Makefile. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.963 +Problem: test_listlbr_utf8 sometimes fails. +Solution: Don't use a literal multibyte character but <C-V>uXXXX. Do not + dump the screen highlighting. (Christian Brabandt, closes #518) +Files: src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.964 +Problem: Test 87 doesn't work in a shadow directory. +Solution: Handle the extra subdirectory. (James McCoy, closes #515) +Files: src/testdir/test87.in + +Patch 7.4.965 +Problem: On FreeBSD /dev/fd/ files are special. +Solution: Use is_dev_fd_file() also for FreeBSD. (Derek Schrock, closes #521) +Files: src/fileio.c + +Patch 7.4.966 +Problem: Configure doesn't work with a space in a path. +Solution: Put paths in quotes. (James McCoy, closes #525) +Files: src/configure.in, src/auto/configure + +Patch 7.4.967 +Problem: Cross compilation on MS-windows doesn't work well. +Solution: Tidy up cross compilation across architectures with Visual Studio. + (Mike Williams) +Files: src/Make_mvc.mak + +Patch 7.4.968 +Problem: test86 and test87 are flaky in Appveyor. +Solution: Reduce the count from 8 to 7. (suggested by ZyX) +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.969 +Problem: Compiler warnings on Windows x64 build. +Solution: Add type casts. (Mike Williams) +Files: src/option.c + +Patch 7.4.970 +Problem: Rare crash in getvcol(). (Timo Mihaljov) +Solution: Check for the buffer being NULL in init_preedit_start_col. + (Hirohito Higashi, Christian Brabandt) +Files: src/mbyte.c + +Patch 7.4.971 +Problem: The asin() function can't be used. +Solution: Sort the function table properly. (Watiko) +Files: src/eval.c + +Patch 7.4.972 +Problem: Memory leak when there is an error in setting an option. +Solution: Free the saved value (Christian Brabandt) +Files: src/option.c + +Patch 7.4.973 +Problem: When pasting on the command line line breaks result in literal + <CR> characters. This makes pasting a long file name difficult. +Solution: Skip the characters. +Files: src/ex_getln.c, src/ops.c + +Patch 7.4.974 +Problem: When using :diffsplit the cursor jumps to the first line. +Solution: Put the cursor on the line related to where the cursor was before + the split. +Files: src/diff.c + +Patch 7.4.975 +Problem: Using ":sort" on a very big file sometimes causes text to be + corrupted. (John Beckett) +Solution: Copy the line into a buffer before calling ml_append(). +Files: src/ex_cmds.c + +Patch 7.4.976 +Problem: When compiling Vim for MSYS2 (linked with msys-2.0.dll), the Win32 + clipboard is not enabled. +Solution: Recognize MSYS like CYGWIN. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.977 +Problem: 'linebreak' does not work properly when using "space" in + 'listchars'. +Solution: (Hirohito Higashi, Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.978 +Problem: test_cdo fails when using another language than English. +Solution: Set the language to C. (Dominique Pelle, Kenichi Ito) +Files: src/testdir/test_cdo.in + +Patch 7.4.979 +Problem: When changing the crypt key the blocks read from disk are not + decrypted. +Solution: Also call ml_decrypt_data() when mf_old_key is set. (Ken Takata) +Files: src/memfile.c + +Patch 7.4.980 +Problem: Tests for :cdo, :ldo, etc. are outdated. +Solution: Add new style tests for these commands. (Yegappan Lakshmanan) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_cdo.in, src/testdir/test_cdo.ok, + src/testdir/test_cdo.vim + +Patch 7.4.981 +Problem: An error in a test script goes unnoticed. +Solution: Source the test script inside try/catch. (Hirohito Higashi) +Files: src/testdir/runtest.vim + +Patch 7.4.982 +Problem: Keeping the list of tests updated is a hassle. +Solution: Move the list to a separate file, so that it only needs to be + updated in one place. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.983 +Problem: Executing one test after "make testclean" doesn't work. +Solution: Add a dependency on test1.out. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.984 +Problem: searchpos() always starts searching in the first column, which is + not what some people expect. (Brett Stahlman) +Solution: Add the 'z' flag: start at the specified column. +Files: src/vim.h, src/eval.c, src/search.c, + src/testdir/test_searchpos.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.985 +Problem: Can't build with Ruby 2.3.0. +Solution: Use the new TypedData_XXX macro family instead of Data_XXX. Use + TypedData. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.986 +Problem: Test49 doesn't work on MS-Windows. test70 is listed twice. +Solution: Move test49 to the group not used on Amiga and MS-Windows. + Remove test70 from SCRIPTS_WIN32. +Files: src/testdir/Make_all.mak, src/testdir/Make_dos.mak + +Patch 7.4.987 (after 7.4.985) +Problem: Can't build with Ruby 1.9.2. +Solution: Require Rub 2.0 for defining USE_TYPEDDATA. +Files: src/if_ruby.c + +Patch 7.4.988 (after 7.4.982) +Problem: Default test target is test49.out. +Solution: Add a build rule before including Make_all.mak. +Files: src/testdir/Make_dos.mak, src/testdir/Make_amiga.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.989 +Problem: Leaking memory when hash_add() fails. Coverity error 99126. +Solution: When hash_add() fails free the memory. +Files: src/eval.c + +Patch 7.4.990 +Problem: Test 86 fails on AppVeyor. +Solution: Do some registry magic. (Ken Takata) +Files: appveyor.yml + +Patch 7.4.991 +Problem: When running new style tests the output is not visible. +Solution: Add the testdir/messages file and show it. Update the list of + test names. +Files: src/Makefile, src/testdir/Makefile, src/testdir/runtest.vim + +Patch 7.4.992 +Problem: Makefiles for MS-Windows in src/po are outdated. +Solution: Make them work. (Ken Takata, Taro Muraoka) +Files: src/po/Make_cyg.mak, src/po/Make_ming.mak, src/po/Make_mvc.mak, + src/po/README_mingw.txt, src/po/README_mvc.txt + +Patch 7.4.993 +Problem: Test 87 is flaky on AppVeyor. +Solution: Reduce the minimum background thread count. +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.994 +Problem: New style tests are not run on MS-Windows. +Solution: Add the new style tests. +Files: src/testdir/Make_dos.mak + +Patch 7.4.995 +Problem: gdk_pixbuf_new_from_inline() is deprecated. +Solution: Generate auto/gui_gtk_gresources.c. (Kazunobu Kuriyama, + closes #507) +Files: src/Makefile, src/auto/configure, src/config.h.in, + src/config.mk.in, src/configure.in, src/gui_gtk.c, + src/gui_gtk_gresources.xml, src/gui_gtk_x11.c, + src/proto/gui_gtk_gresources.pro, + pixmaps/stock_vim_build_tags.png, pixmaps/stock_vim_find_help.png, + pixmaps/stock_vim_save_all.png, + pixmaps/stock_vim_session_load.png, + pixmaps/stock_vim_session_new.png, + pixmaps/stock_vim_session_save.png, pixmaps/stock_vim_shell.png, + pixmaps/stock_vim_window_maximize.png, + pixmaps/stock_vim_window_maximize_width.png, + pixmaps/stock_vim_window_minimize.png, + pixmaps/stock_vim_window_minimize_width.png, + pixmaps/stock_vim_window_split.png, + pixmaps/stock_vim_window_split_vertical.png + +Patch 7.4.996 +Problem: New GDK files and testdir/Make_all.mak missing from distribution. + PC build instructions are outdated. +Solution: Add the file to the list. Update PC build instructions. +Files: Filelist, Makefile + +Patch 7.4.997 +Problem: "make shadow" was sometimes broken. +Solution: Add a test for it. (James McCoy, closes #520) +Files: .travis.yml + +Patch 7.4.998 +Problem: Running tests in shadow directory fails. Test 49 fails. +Solution: Link more files for the shadow directory. Make test 49 ends up in + the right buffer. +Files: src/Makefile, src/testdir/test49.in + +Patch 7.4.999 +Problem: "make shadow" creates a broken link. (Tony Mechelynck) +Solution: Remove vimrc.unix from the list. +Files: src/Makefile + +Patch 7.4.1000 +Problem: Test 49 is slow and doesn't work on MS-Windows. +Solution: Start moving parts of test 49 to test_viml. +Files: src/Makefile, src/testdir/runtest.vim, src/testdir/test_viml.vim, + src/testdir/test49.vim, src/testdir/test49.ok + +Patch 7.4.1001 (after 7.4.1000) +Problem: test_viml isn't run. +Solution: Include change in makefile. +Files: src/testdir/Make_all.mak + +Patch 7.4.1002 +Problem: Cannot run an individual test on MS-Windows. +Solution: Move the rule to run test1 downwards. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1003 +Problem: Travis could check a few more things. +Solution: Run autoconf on one of the builds. (James McCoy, closes #510) + Also build with normal features. +Files: .travis.yml + +Patch 7.4.1004 +Problem: Using Makefile when auto/config.mk does not exist results in + warnings. +Solution: Use default values for essential variables. +Files: src/Makefile + +Patch 7.4.1005 +Problem: Vim users are not always happy. +Solution: Make them happy. +Files: src/ex_cmds.h, src/ex_cmds.c, src/proto/ex_cmds.pro + +Patch 7.4.1006 +Problem: The fix in patch 7.3.192 is not tested. +Solution: Add a test, one for each regexp engine. (Elias Diem) +Files: src/testdir/test44.in, src/testdir/test44.ok, + src/testdir/test99.in, src/testdir/test99.ok + +Patch 7.4.1007 +Problem: When a symbolic link points to a file in the root directory, the + swapfile is not correct. +Solution: Do not try getting the full name of a file in the root directory. + (Milly, closes #501) +Files: src/os_unix.c + +Patch 7.4.1008 +Problem: The OS/2 code pollutes the source while nobody uses it these days. +Solution: Drop the support for OS/2. +Files: src/feature.h, src/globals.h, src/macros.h, src/option.h, + src/os_unix.c, src/os_unix.h, src/proto/os_unix.pro, src/vim.h, + src/digraph.c, src/eval.c, src/ex_cmds.c, src/ex_docmd.c, + src/ex_getln.c, src/fileio.c, src/getchar.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/option.c, + src/term.c, src/ui.c, src/window.c, src/os_os2_cfg.h, + src/Make_os2.mak, src/testdir/Make_os2.mak, src/testdir/os2.vim, + src/INSTALL, runtime/doc/os_os2.txt + +Patch 7.4.1009 +Problem: There are still #ifdefs for ARCHIE. +Solution: Remove references to ARCHIE, the code was removed in Vim 5. +Files: src/ex_cmds.c, src/ex_docmd.c, src/fileio.c, src/main.c, + src/memline.c, src/option.c, src/term.c + +Patch 7.4.1010 +Problem: Some developers are unhappy while running tests. +Solution: Add a test and some color. +Files: src/ex_cmds.c, src/testdir/test_assert.vim + +Patch 7.4.1011 +Problem: Can't build with Strawberry Perl. +Solution: Include stdbool.h. (Ken Takata, closes #328) +Files: Filelist, src/Make_mvc.mak, src/if_perl_msvc/stdbool.h + +Patch 7.4.1012 +Problem: Vim overwrites the value of $PYTHONHOME. +Solution: Do not set $PYTHONHOME if it is already set. (Kazuki Sakamoto, + closes #500) +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1013 +Problem: The local value of 'errorformat' is not used for ":lexpr" and + ":cexpr". +Solution: Use the local value if it exists. (Christian Brabandt) Adjust the + help for this. +Files: runtime/doc/quickfix.txt, src/quickfix.c + +Patch 7.4.1014 +Problem: `fnamemodify('.', ':.')` returns an empty string in Cygwin. +Solution: Use CCP_RELATIVE in the call to cygwin_conv_path. (Jacob Niehus, + closes #505) +Files: src/os_unix.c + +Patch 7.4.1015 +Problem: The column is not restored properly when the matchparen plugin is + used in Insert mode and the cursor is after the end of the line. +Solution: Set the curswant flag. (Christian Brabandt). Also fix + highlighting the match of the character before the cursor. +Files: src/eval.c, runtime/plugin/matchparen.vim + +Patch 7.4.1016 +Problem: Still a few OS/2 pieces remain. +Solution: Delete more. +Files: Filelist, README_os2.txt, testdir/todos.vim, src/xxd/Make_os2.mak + +Patch 7.4.1017 +Problem: When there is a backslash in an option ":set -=" doesn't work. +Solution: Handle a backslash better. (Jacob Niehus) Add a new test, merge + in old test. +Files: src/testdir/test_cdo.vim, src/testdir/test_set.vim, + src/testdir/test_alot.vim, src/option.c, src/testdir/test_set.in, + src/testdir/test_set.ok, src/Makefile + +Patch 7.4.1018 (after 7.4.1017) +Problem: Failure running tests. +Solution: Add missing change to list of old style tests. +Files: src/testdir/Make_all.mak + +Patch 7.4.1019 +Problem: Directory listing of "src" is too long. +Solution: Rename the resources file to make it shorter. +Files: src/gui_gtk_gresources.xml, src/gui_gtk_res.xml, src/Makefile, + Filelist + +Patch 7.4.1020 +Problem: On MS-Windows there is no target to run tests with gvim. +Solution: Add the testgvim target. +Files: src/Make_mvc.mak + +Patch 7.4.1021 +Problem: Some makefiles are outdated. +Solution: Add a note to warn developers. +Files: src/Make_manx.mak, src/Make_bc3.mak, src/Make_bc5.mak, + src/Make_djg.mak, src/Make_w16.mak + +Patch 7.4.1022 +Problem: The README file contains some outdated information. +Solution: Update the information about supported systems. +Files: README.txt, README.md + +Patch 7.4.1023 +Problem: The distribution files for MS-Windows use CR-LF, which is + inconsistent with what one gets from github. +Solution: Use LF in the distribution files. +Files: Makefile + +Patch 7.4.1024 +Problem: Interfaces for MS-Windows are outdated. +Solution: Use Python 2.7.10, Python 3.4.4, Perl 5.22, TCL 8.6. +Files: src/bigvim.bat + +Patch 7.4.1025 +Problem: Version in installer needs to be updated manually. +Solution: Generate a file with the version number. (Guopeng Wen) +Files: Makefile, nsis/gvim.nsi, nsis/gvim_version.nsh + +Patch 7.4.1026 +Problem: When using MingW the tests do not clean up all files. E.g. test + 17 leaves Xdir1 behind. (Michael Soyka) +Solution: Also delete directories, like Make_dos.mak. Delete files after + directories to reduce warnings. +Files: src/testdir/Make_ming.mak, src/testdir/Make_dos.mak + +Patch 7.4.1027 +Problem: No support for binary numbers. +Solution: Add "bin" to 'nrformats'. (Jason Schulz) +Files: runtime/doc/change.txt, runtime/doc/eval.txt, + runtime/doc/version7.txt, src/charset.c, src/eval.c, + src/ex_cmds.c, src/ex_getln.c, src/misc2.c, src/ops.c, + src/option.c, src/proto/charset.pro, src/spell.c, + src/testdir/test57.in, src/testdir/test57.ok, + src/testdir/test58.in, src/testdir/test58.ok, + src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/vim.h + +Patch 7.4.1028 +Problem: Nsis version file missing from the distribution. +Solution: Add the file to the list. +Files: Filelist + +Patch 7.4.1029 (after 7.4.1027) +Problem: test_increment fails on systems with 32 bit long. +Solution: Only test with 32 bits. +Files: src/testdir/test_increment.in, src/testdir/test_increment.ok + +Patch 7.4.1030 +Problem: test49 is still slow. +Solution: Move more tests from old to new style. +Files: src/testdir/test_viml.vim, src/testdir/test49.vim, + src/testdir/test49.ok, src/testdir/runtest.vim + +Patch 7.4.1031 +Problem: Can't build with Python interface using MingW. +Solution: Update the Makefile. (Yasuhiro Matsumoto) +Files: src/INSTALLpc.txt, src/Make_cyg_ming.mak + +Patch 7.4.1032 +Problem: message from assert_false() does not look nice. +Solution: Handle missing sourcing_name. Use right number of spaces. (Watiko) + Don't use line number if it's zero. +Files: src/eval.c + +Patch 7.4.1033 +Problem: Memory use on MS-Windows is very conservative. +Solution: Use the global memory status to estimate amount of memory. + (Mike Williams) +Files: src/os_win32.c, src/os_win32.h, src/proto/os_win32.pro + +Patch 7.4.1034 +Problem: There is no test for the 'backspace' option behavior. +Solution: Add a test. (Hirohito Higashi) +Files: src/testdir/test_alot.vim, src/testdir/test_backspace_opt.vim + +Patch 7.4.1035 +Problem: An Ex range gets adjusted for folded lines even when the range is + not using line numbers. +Solution: Only adjust line numbers for folding. (Christian Brabandt) +Files: runtime/doc/fold.txt, src/ex_docmd.c + +Patch 7.4.1036 +Problem: Only terminals with up to 256 colors work properly. +Solution: Use the 256 color behavior for all terminals with 256 or more + colors. (Robert de Bath, closes #504) +Files: src/syntax.c + +Patch 7.4.1037 +Problem: Using "q!" when there is a modified hidden buffer does not unload + the current buffer, resulting in the need to abandon it again. +Solution: When using "q!" unload the current buffer when needed. (Yasuhiro + Matsumoto, Hirohito Higashi) +Files: src/testdir/test31.in, src/testdir/test31.ok, + runtime/doc/editing.txt, src/ex_cmds2.c, src/ex_docmd.c, + src/gui.c, src/gui_gtk_x11.c, src/os_unix.c, + src/proto/ex_cmds2.pro + +Patch 7.4.1038 +Problem: Still get a warning for a deprecated function with gdk-pixbuf + 2.31. +Solution: Change minimum minor version from 32 to 31. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1039 (after 7.4.1037) +Problem: Test 31 fails with small build. +Solution: Bail out for small build. (Hirohito Higashi) +Files: src/testdir/test31.in + +Patch 7.4.1040 +Problem: The tee command is not available on MS-Windows. +Solution: Adjust tee.c for MSVC and add a makefile. (Yasuhiro Matsumoto) +Files: src/tee/tee.c, src/tee/Make_mvc.mak, src/Make_mvc.mak + +Patch 7.4.1041 +Problem: Various small things. +Solution: Add file to list of distributed files. Adjust README. Fix typo. +Files: Filelist, src/testdir/README.txt, src/testdir/test_charsearch.in, + src/INSTALLmac.txt + +Patch 7.4.1042 +Problem: g-CTRL-G shows the word count, but there is no way to get the word + count in a script. +Solution: Add the wordcount() function. (Christian Brabandt) +Files: runtime/doc/editing.txt, runtime/doc/eval.txt, + runtime/doc/usr_41.txt, src/eval.c, src/normal.c, src/ops.c, + src/proto/ops.pro, src/testdir/test_wordcount.in, + src/testdir/test_wordcount.ok, src/testdir/Make_all.mak + +Patch 7.4.1043 +Problem: Another small thing. +Solution: Now really update the Mac install text. +Files: src/INSTALLmac.txt + +Patch 7.4.1044 (after 7.4.1042) +Problem: Can't build without the +eval feature. +Solution: Add #ifdef. +Files: src/ops.c + +Patch 7.4.1045 +Problem: Having shadow and coverage on the same build results in the source + files not being available in the coverage view. +Solution: Move using shadow to the normal build. +Files: .travis.yml + +Patch 7.4.1046 +Problem: No test coverage for menus. +Solution: Load the standard menus and check there is no error. +Files: testdir/test_menu.vim, testdir/test_alot.vim + +Patch 7.4.1047 (after patch 7.4.1042) +Problem: Tests fail on MS-Windows. +Solution: Set 'selection' to inclusive. +Files: src/testdir/test_wordcount.in + +Patch 7.4.1048 (after patch 7.4.1047) +Problem: Wordcount test still fail on MS-Windows. +Solution: Set 'fileformat' to "unix". +Files: src/testdir/test_wordcount.in + +Patch 7.4.1049 (after patch 7.4.1048) +Problem: Wordcount test still fails on MS-Windows. +Solution: Set 'fileformats' to "unix". +Files: src/testdir/test_wordcount.in + +Patch 7.4.1050 +Problem: Warning for unused var with tiny features. (Tony Mechelynck) +Solution: Add #ifdef. Use vim_snprintf(). Reduce number of statements. +Files: src/ops.c + +Patch 7.4.1051 +Problem: Segfault when unletting "count". +Solution: Check for readonly and locked first. (Dominique Pelle) + Add a test. +Files: src/eval.c, src/testdir/test_alot.vim, src/testdir/test_unlet.vim + +Patch 7.4.1052 +Problem: Illegal memory access with weird syntax command. (Dominique Pelle) +Solution: Check for column past end of line. +Files: src/syntax.c + +Patch 7.4.1053 +Problem: Insufficient testing for quickfix commands. +Solution: Add a new style quickfix test. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test_quickfix.vim + +Patch 7.4.1054 +Problem: Illegal memory access. +Solution: Check for missing pattern. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.1055 +Problem: Running "make newtests" in src/testdir has no output. +Solution: List the messages file when a test fails. (Christian Brabandt) + Update the list of tests. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.1056 +Problem: Don't know why finding spell suggestions is slow. +Solution: Add some code to gather profiling information. +Files: src/spell.c + +Patch 7.4.1057 +Problem: Typos in the :options window. +Solution: Fix the typos. (Dominique Pelle) +Files: runtime/optwin.vim + +Patch 7.4.1058 +Problem: It is not possible to test code that is only reached when memory + allocation fails. +Solution: Add the alloc_fail() function. Try it out with :vimgrep. +Files: runtime/doc/eval.txt, src/globals.h, src/eval.c, src/quickfix.c, + src/misc2.c, src/proto/misc2.pro, src/testdir/test_quickfix.vim + +Patch 7.4.1059 +Problem: Code will never be executed. +Solution: Remove the code. +Files: src/quickfix.c + +Patch 7.4.1060 +Problem: Instructions for writing tests are outdated. +Solution: Mention Make_all.mak. Add steps for new style tests. +Files: src/testdir/README.txt + +Patch 7.4.1061 +Problem: Compiler warning for ignoring return value of fwrite(). +Solution: Do use the return value. (idea: Charles Campbell) +Files: src/misc2.c, src/proto/misc2.pro + +Patch 7.4.1062 +Problem: Building with Ruby on MS-Windows requires a lot of arguments. +Solution: Make it simpler. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1063 +Problem: TCL_VER_LONG and DYNAMIC_TCL_VER are not set when building with + Cygwin and MingW. +Solution: Add TCL_VER_LONG and DYNAMIC_TCL_VER to the makefile. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1064 +Problem: When a spell file has single letter compounding creating + suggestions takes an awful long time. +Solution: Add the NOCOMPOUNDSUGS flag. +Files: runtime/doc/spell.txt, src/spell.c + +Patch 7.4.1065 +Problem: Cannot use the "dll" options on MS-Windows. +Solution: Support the options on all platforms. Use the built-in name as + the default, so that it's clear what Vim is looking for. +Files: src/if_python.c, src/if_python3.c, src/if_lua.c, src/if_perl.xs, + src/if_ruby.c, src/option.c, runtime/doc/options.txt, src/Makefile + +Patch 7.4.1066 (after 7.4.1065) +Problem: Build fails on MS-Windows. +Solution: Adjust the #ifdefs for "dll" options. +Files: src/option.h + +Patch 7.4.1067 (after 7.4.1065) +Problem: Can't build with MingW and Python on MS-Windows. +Solution: Move the build flags to CFLAGS. +Files: src/Make_cyg_ming.mak + +Patch 7.4.1068 +Problem: Wrong way to check for unletting internal variables. +Solution: Use a better way. (Olaf Dabrunz) +Files: src/testdir/test_unlet.c, src/eval.c + +Patch 7.4.1069 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/misc2.c + +Patch 7.4.1070 +Problem: The Tcl interface can't be loaded dynamically on Unix. +Solution: Make it possible to load it dynamically. (Ken Takata) +Files: runtime/doc/if_tcl.txt, runtime/doc/options.txt, + runtime/doc/quickref.txt, runtime/optwin.vim, src/Makefile, + src/config.h.in, src/configure.in, src/auto/configure, + src/if_tcl.c, src/option.c, src/option.h + +Patch 7.4.1071 +Problem: New style tests are executed in arbitrary order. +Solution: Sort the test function names. (Hirohito Higashi) + Fix the quickfix test that depended on the order. +Files: src/testdir/runtest.vim, src/testdir/test_quickfix.vim + +Patch 7.4.1072 +Problem: Increment test is old style. +Solution: Make the increment test a new style test. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/testdir/test_increment.vim + +Patch 7.4.1073 +Problem: Alloc_id depends on numbers, may use the same one twice. It's not + clear from the number what it's for. +Solution: Use an enum. Add a function to lookup the enum value from the + name. +Files: src/misc2.c, src/vim.h, src/alloc.h, src/globals.h, + src/testdir/runtest.vim, src/proto/misc2.pro, + src/testdir/test_quickfix.vim + +Patch 7.4.1074 +Problem: Warning from VC2015 compiler. +Solution: Add a type cast. (Mike Williams) +Files: src/gui_dwrite.cpp + +Patch 7.4.1075 +Problem: Crash when using an invalid command. +Solution: Fix generating the error message. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.1076 +Problem: CTRL-A does not work well in right-left mode. +Solution: Remove reversing the line, add a test. (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_increment.vim + +Patch 7.4.1077 +Problem: The build instructions for MS-Windows are incomplete. +Solution: Add explanations for how to build with various interfaces. (Ken + Takata) +Files: src/INSTALLpc.txt + +Patch 7.4.1078 +Problem: MSVC: "make clean" doesn't cleanup in the tee directory. +Solution: Add the commands to cleanup tee. (Erich Ritz) +Files: src/Make_mvc.mak + +Patch 7.4.1079 (after 7.4.1073) +Problem: New include file missing from distribution. Missing changes to + quickfix code. +Solution: Add alloc.h to the list of distributed files. Use the enum in + quickfix code. +Files: Filelist, src/quickfix.c + +Patch 7.4.1080 +Problem: VS2015 has a function HandleToLong() that is shadowed by the macro + that Vim defines. +Solution: Do not define HandleToLong() for MSVC version 1400 and later. + (Mike Williams) +Files: src/gui_w32.c + +Patch 7.4.1081 +Problem: No test for what previously caused a crash. +Solution: Add test for unletting errmsg. +Files: src/testdir/test_unlet.vim + +Patch 7.4.1082 +Problem: The Tcl interface is always skipping memory free on exit. +Solution: Only skip for dynamically loaded Tcl. +Files: src/if_tcl.c + +Patch 7.4.1083 +Problem: Building GvimExt with VS2015 may fail. +Solution: Adjust the makefile. (Mike Williams) +Files: src/GvimExt/Makefile + +Patch 7.4.1084 +Problem: Using "." to repeat CTRL-A in Visual mode increments the wrong + numbers. +Solution: Append right size to the redo buffer. (Ozaki Kiichi) +Files: src/normal.c, src/testdir/test_increment.vim + +Patch 7.4.1085 +Problem: The CTRL-A and CTRL-X commands do not update the '[ and '] marks. +Solution: (Yukihiro Nakadaira) +Files: src/ops.c, src/testdir/test_marks.in, src/testdir/test_marks.ok + +Patch 7.4.1086 +Problem: Crash with an extremely long buffer name. +Solution: Limit the return value of vim_snprintf(). (Dominique Pelle) +Files: src/buffer.c + +Patch 7.4.1087 +Problem: CTRL-A and CTRL-X do not work properly with blockwise visual + selection if there is a mix of Tab and spaces. +Solution: Add OP_NR_ADD and OP_NR_SUB. (Hirohito Higashi) +Files: src/testdir/test_increment.vim, src/normal.c, src/ops.c, + src/proto/ops.pro, src/vim.h + +Patch 7.4.1088 +Problem: Coverity warns for uninitialized variables. Only one is an actual + problem. +Solution: Move the conditions. Don't use endpos if handling an error. +Files: src/ops.c + +Patch 7.4.1089 +Problem: Repeating CTRL-A doesn't work. +Solution: Call prep_redo_cmd(). (Hirohito Higashi) +Files: src/normal.c, src/testdir/test_increment.vim + +Patch 7.4.1090 +Problem: No tests for :hardcopy and related options. +Solution: Add test_hardcopy. +Files: src/testdir/test_hardcopy.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.1091 +Problem: When making a change while need_wait_return is set there is a two + second delay. +Solution: Do not assume the ATTENTION prompt was given when need_wait_return + was set already. +Files: src/misc1.c + +Patch 7.4.1092 +Problem: It is not simple to test for an exception and give a proper error + message. +Solution: Add assert_exception(). +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.1093 +Problem: Typo in test goes unnoticed. +Solution: Fix the typo. Give error for wrong arguments to cursor(). + (partly by Hirohito Higashi) Add a test for cursor(). +Files: src/testdir/test_searchpos.vim, src/testdir/test_cursor_func.vim, + src/eval.c, src/testdir/test_alot.vim + +Patch 7.4.1094 +Problem: Test for :hardcopy fails on MS-Windows. +Solution: Check for the +postscript feature. +Files: src/testdir/test_hardcopy.vim + +Patch 7.4.1095 +Problem: Can't build GvimExt with SDK 7.1. +Solution: Support using setenv.bat instead of vcvars32.bat. (Ken Takata) +Files: src/Make_mvc.mak, src/GvimExt/Makefile + +Patch 7.4.1096 +Problem: Need several lines to verify a command produces an error. +Solution: Add assert_fails(). (suggested by Nikolai Pavlov) + Make the quickfix alloc test actually work. +Files: src/testdir/test_quickfix.vim, src/eval.c, runtime/doc/eval.txt, + src/misc2.c, src/alloc.h + +Patch 7.4.1097 +Problem: Looking up the alloc ID for tests fails. +Solution: Fix the line computation. Use assert_fails() for unlet test. +Files: src/testdir/runtest.vim, src/testdir/test_unlet.vim + +Patch 7.4.1098 +Problem: Still using old style C function declarations. +Solution: Always define __ARGS() to include types. Turn a few functions + into ANSI style to find out if this causes problems for anyone. +Files: src/vim.h, src/os_unix.h, src/eval.c, src/main.c + +Patch 7.4.1099 +Problem: It's not easy to know if Vim supports blowfish. (Smu Johnson) +Solution: Add has('crypt-blowfish') and has('crypt-blowfish2'). +Files: src/eval.c + +Patch 7.4.1100 +Problem: Cygwin makefiles are unused. +Solution: Remove them. +Files: src/GvimExt/Make_ming.mak, src/GvimExt/Make_cyg.mak, + src/xxd/Make_ming.mak, src/xxd/Make_cyg.mak + +Patch 7.4.1101 +Problem: With 'rightleft' and concealing the cursor may move to the wrong + position. +Solution: Compute the column differently when 'rightleft' is set. (Hirohito + Higashi) +Files: src/screen.c + +Patch 7.4.1102 +Problem: Debugger has no stack backtrace support. +Solution: Add "backtrace", "frame", "up" and "down" commands. (Alberto + Fanjul, closes #433) +Files: runtime/doc/repeat.txt, src/eval.c, src/ex_cmds2.c, src/globals.h, + src/testdir/Make_all.mak, src/testdir/test108.in, + src/testdir/test108.ok + +Patch 7.4.1103 (after 7.4.1100) +Problem: Removed file still in distribution. +Solution: Remove Make_cyg.mak from the list of files. +Files: Filelist + +Patch 7.4.1104 +Problem: Various problems building with MzScheme/Racket. +Solution: Make it work with new versions of Racket. (Yukihiro Nakadaira, Ken + Takata) +Files: runtime/doc/if_mzsch.txt, src/INSTALLpc.txt, + src/Make_cyg_ming.mak, src/Make_mvc.mak, src/auto/configure, + src/configure.in, src/if_mzsch.c + +Patch 7.4.1105 +Problem: When using slices there is a mixup of variable name and namespace. +Solution: Recognize variables that can't be a namespace. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.1106 +Problem: The nsis script can't be used from the appveyor build. +Solution: Add "ifndef" to allow for variables to be set from the command + line. Remove duplicate SetCompressor command. Support using other + gettext binaries. (Ken Takata) Update build instructions to use + libintl-8.dll. +Files: Makefile, nsis/gvim.nsi, src/os_win32.c, src/proto/os_win32.pro, + src/main.c, os_w32exe.c + +Patch 7.4.1107 +Problem: Vim can create a directory but not delete it. +Solution: Add an argument to delete() to make it possible to delete a + directory, also recursively. +Files: src/fileio.c, src/eval.c, src/proto/fileio.pro, + src/testdir/test_delete.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.1108 +Problem: Expanding "~" halfway a file name. +Solution: Handle the file name as one name. (Marco Hinz) Add a test. + Closes #564. +Files: src/testdir/test27.in, src/testdir/test27.ok, + src/testdir/test_expand.vim, src/testdir/test_alot.vim, + src/Makefile, src/misc2.c + +Patch 7.4.1109 (after 7.4.1107) +Problem: MS-Windows doesn't have rmdir(). +Solution: Add mch_rmdir(). +Files: src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1110 +Problem: Test 108 fails when language is French. +Solution: Force English messages. (Dominique Pelle) +Files: src/testdir/test108.in + +Patch 7.4.1111 +Problem: test_expand fails on MS-Windows. +Solution: Always use forward slashes. Remove references to test27. +Files: src/testdir/runtest.vim, src/testdir/test_expand.vim, + src/testdir/Make_dos.mak, src/testdir/Make_all.mak, + src/testdir/Make_amiga.mak, src/testdir/Make_ming.mak + +Patch 7.4.1112 +Problem: When using ":next" with an illegal file name no error is reported. +Solution: Give an error message. +Files: src/ex_cmds2.c + +Patch 7.4.1113 (after 7.4.1105) +Problem: Using {ns} in variable name does not work. (lilydjwg) +Solution: Fix recognizing colon. Add a test. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1114 (after 7.4.1107) +Problem: delete() does not work well with symbolic links. +Solution: Recognize symbolic links. +Files: src/eval.c, src/fileio.c, src/os_unix.c, src/proto/os_unix.pro, + src/testdir/test_delete.vim, runtime/doc/eval.txt + +Patch 7.4.1115 +Problem: MS-Windows: make clean in testdir doesn't clean everything. +Solution: Add command to delete X* directories. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1116 +Problem: delete(x, 'rf') does not delete files starting with a dot. +Solution: Also delete files starting with a dot. +Files: src/misc1.c, src/fileio.c, src/vim.h + +Patch 7.4.1117 (after 7.4.1116) +Problem: No longer get "." and ".." in directory list. +Solution: Do not skip "." and ".." unless EW_DODOT is set. +Files: src/mics1.c + +Patch 7.4.1118 +Problem: Tests hang in 24 line terminal. +Solution: Set the 'more' option off. +Files: src/testdir/runtest.vim + +Patch 7.4.1119 +Problem: argidx() has a wrong value after ":%argdelete". (Yegappan + Lakshmanan) +Solution: Correct the value of w_arg_idx. Add a test. +Files: src/ex_cmds2.c, src/testdir/test_arglist.vim, + src/testdir/Make_all.mak + +Patch 7.4.1120 +Problem: delete(x, 'rf') fails if a directory is empty. (Lcd) +Solution: Ignore not finding matches in an empty directory. +Files: src/fileio.c, src/misc1.c, src/vim.h, src/testdir/test_delete.vim + +Patch 7.4.1121 +Problem: test_expand leaves files behind. +Solution: Edit another file before deleting, otherwise the swap file + remains. +Files: src/testdir/test_expand.vim + +Patch 7.4.1122 +Problem: Test 92 and 93 fail when using gvim on a system with a non utf-8 + locale. +Solution: Avoid using .gvimrc by adding -U NONE. (Yukihiro Nakadaira) +Files: src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.1123 +Problem: Using ":argadd" when there are no arguments results in the second + argument to be the current one. (Yegappan Lakshmanan) +Solution: Correct the w_arg_idx value. +Files: src/ex_cmds2.c, src/testdir/test_arglist.vim + +Patch 7.4.1124 +Problem: MS-Windows: dead key behavior is not ideal. +Solution: Handle dead keys differently when not in Insert or Select mode. + (John Wellesz, closes #399) +Files: src/gui_w48.c + +Patch 7.4.1125 +Problem: There is no perleval(). +Solution: Add perleval(). (Damien) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/if_perl.xs, src/proto/if_perl.pro, src/testdir/Make_all.mak, + src/testdir/test_perl.vim + +Patch 7.4.1126 +Problem: Can only get the directory of the current window. +Solution: Add window and tab arguments to getcwd() and haslocaldir(). + (Thinca, Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_getcwd.in, src/testdir/test_getcwd.ok, + runtime/doc/eval.txt, patching file src/eval.c + +Patch 7.4.1127 +Problem: Both old and new style tests for Perl. +Solution: Merge the old tests with the new style tests. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_perl.in, + src/testdir/test_perl.ok, src/testdir/test_perl.vim + +Patch 7.4.1128 +Problem: MS-Windows: delete() does not recognize junctions. +Solution: Add mch_isrealdir() for MS-Windows. Update mch_is_symbolic_link(). + (Ken Takata) +Files: src/fileio.c, src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1129 +Problem: Python None value can't be converted to a Vim value. +Solution: Just use zero. (Damien) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok, + +Patch 7.4.1130 +Problem: Memory leak in :vimgrep. +Solution: Call FreeWild(). (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1131 +Problem: New lines in the viminfo file are dropped. +Solution: Copy lines starting with "|". Fix that when using :rviminfo in a + function global variables were restored as function-local + variables. +Files: src/eval.c, src/structs.h, src/ex_cmds.c, src/misc2.c, + src/proto/misc2.pro, src/testdir/test_viminfo.vim, + src/testdir/Make_all.mak, src/testdir/test74.in, + src/testdir/test74.ok + +Patch 7.4.1132 +Problem: Old style tests for the argument list. +Solution: Add more new style tests. (Yegappan Lakshmanan) +Files: src/testdir/test_arglist.vim, src/testdir/test_argument_0count.in, + src/testdir/test_argument_0count.ok, + src/testdir/test_argument_count.in, src/Makefile, + src/testdir/test_argument_count.ok, src/testdir/Make_all.mak + +Patch 7.4.1133 +Problem: Generated function prototypes still have __ARGS(). +Solution: Generate function prototypes without __ARGS(). +Files: src/Makefile, src/if_ruby.c, src/os_win32.c, + src/proto/blowfish.pro, src/proto/buffer.pro, + src/proto/charset.pro, src/proto/crypt.pro, + src/proto/crypt_zip.pro, src/proto/diff.pro, + src/proto/digraph.pro, src/proto/edit.pro, src/proto/eval.pro, + src/proto/ex_cmds2.pro, src/proto/ex_cmds.pro, + src/proto/ex_docmd.pro, src/proto/ex_eval.pro, + src/proto/ex_getln.pro, src/proto/fileio.pro, src/proto/fold.pro, + src/proto/getchar.pro, src/proto/gui_athena.pro, + src/proto/gui_beval.pro, src/proto/gui_gtk_gresources.pro, + src/proto/gui_gtk.pro, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_motif.pro, + src/proto/gui_photon.pro, src/proto/gui.pro, + src/proto/gui_w16.pro, src/proto/gui_w32.pro, + src/proto/gui_x11.pro, src/proto/gui_xmdlg.pro, + src/proto/hangulin.pro, src/proto/hardcopy.pro, + src/proto/hashtab.pro, src/proto/if_cscope.pro, + src/proto/if_lua.pro, src/proto/if_mzsch.pro, + src/proto/if_ole.pro, src/proto/if_perl.pro, + src/proto/if_perlsfio.pro, src/proto/if_python3.pro, + src/proto/if_python.pro, src/proto/if_ruby.pro, + src/proto/if_tcl.pro, src/proto/if_xcmdsrv.pro, + src/proto/main.pro, src/proto/mark.pro, src/proto/mbyte.pro, + src/proto/memfile.pro, src/proto/memline.pro, src/proto/menu.pro, + src/proto/message.pro, src/proto/misc1.pro, src/proto/misc2.pro, + src/proto/move.pro, src/proto/netbeans.pro, src/proto/normal.pro, + src/proto/ops.pro, src/proto/option.pro, src/proto/os_amiga.pro, + src/proto/os_beos.pro, src/proto/os_mac_conv.pro, + src/proto/os_msdos.pro, src/proto/os_mswin.pro, + src/proto/os_qnx.pro, src/proto/os_unix.pro, src/proto/os_vms.pro, + src/proto/os_win16.pro, src/proto/os_win32.pro, + src/proto/popupmnu.pro, src/proto/pty.pro, src/proto/quickfix.pro, + src/proto/regexp.pro, src/proto/screen.pro, src/proto/search.pro, + src/proto/sha256.pro, src/proto/spell.pro, src/proto/syntax.pro, + src/proto/tag.pro, src/proto/termlib.pro, src/proto/term.pro, + src/proto/ui.pro, src/proto/undo.pro, src/proto/version.pro, + src/proto/winclip.pro, src/proto/window.pro, + src/proto/workshop.pro + +Patch 7.4.1134 +Problem: The arglist test fails on MS-Windows. +Solution: Only check for failure of argedit on Unix. +Files: src/testdir/test_arglist.vim + +Patch 7.4.1135 +Problem: One more arglist test fails on MS-Windows. +Solution: Don't edit "Y" after editing "y". +Files: src/testdir/test_arglist.vim + +Patch 7.4.1136 +Problem: Wrong argument to assert_exception() causes a crash. (reported by + Coverity) +Solution: Check for NULL pointer. Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1137 +Problem: Illegal memory access when using :copen and :cclose. +Solution: Avoid that curbuf is invalid. (suggestion by Justin M. Keyes) + Add a test. +Files: src/window.c, src/testdir/test_quickfix.vim + +Patch 7.4.1138 +Problem: When running gvim in the foreground some icons are missing. + (Taylor Venable) +Solution: Move the call to gui_gtk_register_resource(). (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1139 +Problem: MS-Windows: getftype() returns "file" for symlink to directory. +Solution: Make it return "dir". (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.1140 +Problem: Recognizing <sid> does not work when the language is Turkish. + (Christian Brabandt) +Solution: Use MB_STNICMP() instead of STNICMP(). +Files: src/eval.c + +Patch 7.4.1141 +Problem: Using searchpair() with a skip expression that uses syntax + highlighting sometimes doesn't work. (David Fishburn) +Solution: Reset next_match_idx. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.1142 +Problem: Cannot define keyword characters for a syntax file. +Solution: Add the ":syn iskeyword" command. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/doc/syntax.txt, src/buffer.c, + src/option.c, src/structs.h, src/syntax.c, + src/testdir/Make_all.mak, src/testdir/test_syntax.vim + +Patch 7.4.1143 +Problem: Can't sort on floating point numbers. +Solution: Add the "f" flag to ":sort". (Alex Jakushev) Also add the "f" + flag to sort(). +Files: runtime/doc/change.txt, src/ex_cmds.c, src/testdir/test_sort.vim, + src/testdir/test57.in, src/testdir/test57.ok, src/eval.c + +Patch 7.4.1144 (after 7.4.1143) +Problem: Can't build on several systems. +Solution: Include float.h. (Christian Robinson, closes #570 #571) +Files: src/ex_cmds.c + +Patch 7.4.1145 +Problem: Default features are conservative. +Solution: Make the default feature set for most of today's systems "huge". +Files: src/feature.h, src/configure.in, src/auto/configure + +Patch 7.4.1146 +Problem: Can't build with Python 3 interface using MingW. +Solution: Update the Makefile. (Yasuhiro Matsumoto, Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1147 +Problem: Conflict for "chartab". (Kazunobu Kuriyama) +Solution: Rename the global one to something less obvious. Move it into + src/chartab.c. +Files: src/macros.h, src/globals.h, src/charset.c, src/main.c, + src/option.c, src/screen.c, src/vim.h + +Patch 7.4.1148 +Problem: Default for MingW and Cygwin is still "normal". +Solution: Use "huge" as default. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1149 (after 7.4.1013) +Problem: Using the local value of 'errorformat' causes more problems than + it solves. +Solution: Revert 7.4.1013. +Files: runtime/doc/quickfix.txt, src/quickfix.c + +Patch 7.4.1150 +Problem: 'langmap' applies to the first character typed in Select mode. + (David Watson) +Solution: Check for SELECTMODE. (Christian Brabandt, closes #572) + Add the 'x' flag to feedkeys(). +Files: src/getchar.c, src/normal.c, src/testdir/test_langmap.vim, + src/ex_docmd.c, src/proto/ex_docmd.pro, src/testdir/Make_all.mak, + runtime/doc/eval.txt + +Patch 7.4.1151 (after 7.4.1150) +Problem: Missing change to eval.c +Solution: Also change feedkeys(). +Files: src/eval.c + +Patch 7.4.1152 +Problem: Langmap test fails with normal build. +Solution: Check for +langmap feature. +Files: src/testdir/test_langmap.vim + +Patch 7.4.1153 +Problem: Autocommands triggered by quickfix cannot always get the current + title value. +Solution: Call qf_fill_buffer() later. (Christian Brabandt) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1154 +Problem: No support for JSON. +Solution: Add jsonencode() and jsondecode(). Also add v:false, v:true, + v:null and v:none. +Files: src/json.c, src/eval.c, src/proto.h, src/structs.h, src/vim.h, + src/if_lua.c, src/if_mzsch.c, src/if_ruby.c, src/if_py_both.h, + src/globals.h, src/Makefile, src/Make_bc3.mak, src/Make_bc5.mak, + src/Make_cyg_ming.mak, src/Make_dice.mak, src/Make_ivc.mak, + src/Make_manx.mak, src/Make_morph.mak, src/Make_mvc.mak, + src/Make_sas.mak, src/Make_vms.mms, src/proto/json.pro, + src/proto/eval.pro, src/testdir/test_json.vim, + src/testdir/test_alot.vim, Filelist, runtime/doc/eval.txt + +Patch 7.4.1155 +Problem: Build with normal features fails. +Solution: Always define dict_lookup(). +Files: src/eval.c + +Patch 7.4.1156 +Problem: Coverity warns for NULL pointer and ignoring return value. +Solution: Check for NULL pointer. When dict_add() returns FAIL free the item. +Files: src/json.c + +Patch 7.4.1157 +Problem: type() does not work for v:true, v:none, etc. +Solution: Add new type numbers. +Files: src/eval.c, src/testdir/test_json.vim, src/testdir/test_viml.vim + +Patch 7.4.1158 +Problem: Still using __ARGS(). +Solution: Remove __ARGS() from eval.c +Files: src/eval.c + +Patch 7.4.1159 +Problem: Automatically generated function prototypes use __ARGS. +Solution: Remove __ARGS from osdef.sh. +Files: src/osdef.sh, src/osdef1.h.in, src/osdef2.h.in + +Patch 7.4.1160 +Problem: No error for jsondecode('"'). +Solution: Give an error message for missing double quote. +Files: src/json.c + +Patch 7.4.1161 +Problem: ":argadd" without argument is supposed to add the current buffer + name to the arglist. +Solution: Make it work as documented. (Coot, closes #577) +Files: src/ex_cmds.h, src/ex_cmds2.c, src/testdir/test_arglist.vim + +Patch 7.4.1162 +Problem: Missing error number in MzScheme. (Dominique Pelle) +Solution: Add a proper error number. +Files: src/if_mzsch.c + +Patch 7.4.1163 +Problem: Expressions "0 + v:true" and "'' . v:true" cause an error. +Solution: Return something sensible when using a special variable as a + number or as a string. (suggested by Damien) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1164 +Problem: No tests for comparing special variables. Error in jsondecode() + not reported. test_json does not work with Japanese system. +Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error. +Files: src/json.c, src/testdir/test_viml.vim, src/testdir/test_json.vim + +Patch 7.4.1165 +Problem: When defining DYNAMIC_ICONV_DLL in the makefile, the build fails. +Solution: Add #ifdef's. (Taro Muraoka) Try the newer version first. +Files: src/mbyte.c, src/os_win32.c + +Patch 7.4.1166 +Problem: Can't encode a Funcref into JSON. jsonencode() doesn't handle the + same list or dict twice properly. (Nikolai Pavlov) +Solution: Give an error. Reset copyID when the list or dict is finished. +Files: src/json.c, src/proto/json.pro, src/testdir/test_json.vim + +Patch 7.4.1167 +Problem: No tests for "is" and "isnot" with the new variables. +Solution: Add tests. +Files: src/testdir/test_viml.vim + +Patch 7.4.1168 +Problem: This doesn't give the right result: eval(string(v:true)). (Nikolai + Pavlov) +Solution: Make the string "v:true" instead of "true". +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1169 +Problem: The socket I/O is intertwined with the netbeans code. +Solution: Start refactoring the netbeans communication to split off the + socket I/O. Add the +channel feature. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/proto/netbeans.pro, src/proto/gui_w32.pro, src/gui_w32.c, + src/eval.c, src/os_mswin.c, src/ui.c, src/macros.h, Makefile, + src/proto.h, src/feature.h, src/os_unix.c, src/vim.h, + src/configure.in, src/auto/configure, src/config.mk.in, + src/config.aap.in, src/config.h.in, src/Make_bc5.mak, + src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1170 (after 7.4.1169) +Problem: Missing changes in src/Makefile, Filelist. +Solution: Add the missing changes. +Files: Filelist, src/Makefile + +Patch 7.4.1171 +Problem: Makefile dependencies are outdated. +Solution: Run "make depend". Add GTK resource dependencies. +Files: src/Makefile + +Patch 7.4.1172 (after 7.4.1169) +Problem: Configure is overly positive. +Solution: Insert "test". +Files: src/configure.in, src/auto/configure + +Patch 7.4.1173 (after 7.4.1168) +Problem: No test for new behavior of v:true et al. +Solution: Add a test. +Files: src/testdir/test_viml.vim + +Patch 7.4.1174 +Problem: Netbeans contains dead code inside #ifndef INIT_SOCKETS. +Solution: Remove the dead code. +Files: src/netbeans.c + +Patch 7.4.1175 (after 7.4.1169) +Problem: Can't build with Mingw and Cygwin. +Solution: Remove extra "endif". (Christian J. Robinson) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1176 +Problem: Missing change to proto file. +Solution: Update the proto file. (Charles Cooper) +Files: src/proto/gui_w32.pro + +Patch 7.4.1177 +Problem: The +channel feature is not in :version output. (Tony Mechelynck) +Solution: Add the feature string. +Files: src/version.c + +Patch 7.4.1178 +Problem: empty() doesn't work for the new special variables. +Solution: Make empty() work. (Damien) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1179 +Problem: test_writefile and test_viml do not delete the tempfile. +Solution: Delete the tempfile. (Charles Cooper) Add DeleteTheScript(). +Files: src/testdir/test_writefile.in, src/testdir/test_viml.vim + +Patch 7.4.1180 +Problem: Crash with invalid argument to glob2regpat(). +Solution: Check for NULL. (Justin M. Keyes, closes #596) Add a test. +Files: src/eval.c, src/testdir/test_glob2regpat.vim, + src/testdir/test_alot.vim + +Patch 7.4.1181 +Problem: free_tv() can't handle special variables. (Damien) +Solution: Add the variable type. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1182 +Problem: Still socket code intertwined with netbeans. +Solution: Move code from netbeans.c to channel.c +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/proto/netbeans.pro, src/gui.c, src/gui_w48.c + +Patch 7.4.1183 (after 7.4.1182) +Problem: MS-Windows build is broken. +Solution: Remove init in wrong place. +Files: src/channel.c + +Patch 7.4.1184 (after 7.4.1182) +Problem: MS-Windows build is still broken. +Solution: Change nbsock to ch_fd. +Files: src/channel.c + +Patch 7.4.1185 +Problem: Can't build with TCL on some systems. +Solution: Rename the channel_ functions. +Files: src/if_tcl.c + +Patch 7.4.1186 +Problem: Error messages for security context are hard to translate. +Solution: Use one string with %s. (Ken Takata) +Files: src/os_unix.c + +Patch 7.4.1187 +Problem: MS-Windows channel code only supports one channel. Doesn't build + without netbeans support. +Solution: Get the channel index from the socket in the message. Closes #600. +Files: src/channel.c, src/netbeans.c, src/gui_w48.c, + src/proto/channel.pro, src/proto/netbeans.pro + +Patch 7.4.1188 +Problem: Using older JSON standard. +Solution: Update the link. Adjust the text a bit. +Files: src/json.c, runtime/doc/eval.txt + +Patch 7.4.1189 (after 7.4.1165) +Problem: Using another language on MS-Windows does not work. (Yongwei Wu) +Solution: Undo the change to try loading libintl-8.dll first. +Files: src/os_win32.c + +Patch 7.4.1190 +Problem: On OSX the default flag for dlopen() is different. +Solution: Add RTLD_LOCAL in the configure check. (sv99, closes #604) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1191 +Problem: The channel feature isn't working yet. +Solution: Add the connect(), disconnect(), sendexpr() and sendraw() + functions. Add initial documentation. Add a demo server. +Files: src/channel.c, src/eval.c, src/proto/channel.pro, + src/proto/eval.pro, runtime/doc/channel.txt, runtime/doc/eval.txt, + runtime/doc/Makefile, runtime/tools/demoserver.py + +Patch 7.4.1192 +Problem: Can't build with FEAT_EVAL but without FEAT_MBYTE. (John + Marriott) +Solution: Add #ifdef for FEAT_MBYTE. +Files: src/json.c + +Patch 7.4.1193 +Problem: Can't build the channel feature on MS-Windows. +Solution: Add #ifdef HAVE_POLL. +Files: src/channel.c + +Patch 7.4.1194 +Problem: Compiler warning for not using return value of fwrite(). +Solution: Return OK/FAIL. (Charles Campbell) +Files: src/channel.c, src/proto/channel.pro + +Patch 7.4.1195 +Problem: The channel feature does not work in the MS-Windows console. +Solution: Add win32 console support. (Yasuhiro Matsumoto) +Files: src/channel.c, src/gui_w32.c, src/os_mswin.c, src/os_win32.c, + src/proto/gui_w32.pro, src/proto/os_mswin.pro, src/vim.h + +Patch 7.4.1196 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/arabic.c, src/buffer.c, src/charset.c, src/crypt_zip.c, + src/diff.c, src/digraph.c, src/edit.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c + +Patch 7.4.1197 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/ex_eval.c, src/ex_getln.c, src/farsi.c, src/fileio.c, + src/fold.c, src/getchar.c, src/gui.c, src/gui_at_fs.c, + gui_at_sb.c, src/gui_athena.c, src/gui_beval.c, src/gui_motif.c, + src/gui_w32.c, src/gui_w48.c + +Patch 7.4.1198 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) + Also remove use of HAVE_STDARG_H. +Files: src/gui_x11.c, src/hangulin.c, src/hardcopy.c, src/hashtab.c, + src/if_cscope.c, src/if_python3.c, src/if_sniff.c, + src/if_xcmdsrv.c, src/main.c, src/mark.c, src/mbyte.c, + src/memfile.c, src/memfile_test.c, src/memline.c, src/menu.c, + src/message.c, src/misc1.c, src/misc2.c, src/move.c, + src/netbeans.c, src/normal.c + +Patch 7.4.1199 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/ops.c, src/option.c, src/os_amiga.c, src/os_mac_conv.c, + src/os_unix.c, src/os_vms.c, src/os_w32exe.c, src/popupmnu.c, + src/pty.c, src/quickfix.c, src/regexp.c, src/regexp_nfa.c, + src/screen.c, src/search.c, src/sha256.c, src/spell.c, + src/syntax.c, src/tag.c, src/term.c, src/termlib.c, src/ui.c, + src/undo.c, src/version.c, src/window.c + +Patch 7.4.1200 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/blowfish.c, src/ex_cmds2.c, src/ex_getln.c, src/fold.c, + src/gui_beval.c, src/gui_w32.c, src/os_unix.c, src/os_win16.c, + src/pty.c, src/regexp.c, src/syntax.c, src/xpm_w32.c, + src/ex_cmds.h, src/globals.h, src/gui_at_sb.h, src/gui_beval.h, + src/if_cscope.h, src/if_sniff.h, src/nbdebug.h, src/os_unix.h, + src/proto.h, src/structs.h, src/vim.h, src/xpm_w32.h, + src/if_perl.xs, src/proto/if_lua.pro, src/proto/pty.pro, + runtime/tools/xcmdsrv_client.c, + src/Makefile + +Patch 7.4.1201 +Problem: One more file still using __ARGS. +Solution: Remove __ARGS in the last file. (script by Hirohito Higashi) +Files: src/gui_at_sb.c + +Patch 7.4.1202 +Problem: Still one more file still using __ARGS. +Solution: Remove __ARGS in the last file. (script by Hirohito Higashi) + (closes #612) +Files: src/proto/os_mac_conv.pro, src/os_mac_conv.c, src/Makefile + +Patch 7.4.1203 +Problem: Still more files still using __ARGS. +Solution: Remove __ARGS in really the last files. +Files: src/proto/if_mzsch.pro, src/if_mzsch.c, src/vim.h, + src/proto/gui_gtk_gresources.pro, src/proto/gui_mac.pro, + src/proto/if_ole.pro, src/proto/os_qnx.pro, src/Makefile + +Patch 7.4.1204 +Problem: Latin1 characters cause encoding conversion. +Solution: Remove the characters. +Files: src/gui_motif.c + +Patch 7.4.1205 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/arabic.c, src/blowfish.c, src/buffer.c, src/channel.c, + src/charset.c, src/crypt.c, src/crypt_zip.c, src/diff.c, + src/digraph.c, src/edit.c, src/eval.c + +Patch 7.4.1206 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_eval.c, + src/ex_getln.c, src/farsi.c, src/fileio.c + +Patch 7.4.1207 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/fold.c, src/getchar.c, src/gui_at_fs.c, src/gui_athena.c, + src/gui_at_sb.c, src/gui_beval.c, src/gui.c, src/gui_gtk.c, + src/gui_gtk_x11.c, src/gui_mac.c, src/gui_motif.c + +Patch 7.4.1208 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/gui_photon.c, src/gui_w32.c, src/gui_w48.c, src/gui_x11.c, + src/hangulin.c, src/hardcopy.c, src/hashtab.c, src/if_cscope.c, + src/if_mzsch.c, src/if_perlsfio.c, src/if_python.c, + src/if_python3.c, src/if_ruby.c, src/if_sniff.c, src/if_tcl.c, + src/if_xcmdsrv.c, src/integration.c + +Patch 7.4.1209 (after 7.4.1207) +Problem: Can't build with Athena. (Elimar Riesebieter) +Solution: Fix function declarations. +Files: src/gui_athena.c, src/gui_x11.c, src/gui_at_sb.c, src/gui_at_fs.c + +Patch 7.4.1210 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/main.c, src/mark.c, src/mbyte.c, src/memfile.c, + src/memfile_test.c, src/memline.c, src/menu.c, src/message.c + +Patch 7.4.1211 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/misc1.c, src/misc2.c, src/move.c, src/netbeans.c, + src/normal.c, src/ops.c, src/option.c + +Patch 7.4.1212 (after 7.4.1207) +Problem: Can't build with Motif. +Solution: Fix function declaration.(Dominique Pelle) +Files: src/gui_motif.c + +Patch 7.4.1213 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/os_amiga.c, src/os_mac_conv.c, src/os_msdos.d, src/os_mswin.c, + src/os_qnx.c, src/os_unix.c, src/os_vms.c, src/os_win16.c, + src/os_win32.c, src/popupmnu.c, src/pty.c, src/quickfix.c, + src/regexp.c, src/regexp_nfa.c, src/screen.c + +Patch 7.4.1214 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/search.c, src/sha256.c, src/spell.c, src/syntax.c, src/tag.c, + src/term.c, src/termlib.c, src/ui.c, src/undo.c + +Patch 7.4.1215 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/version.c, src/winclip.c, src/window.c, src/workshop.c, + src/xpm_w32.c, runtime/doc/doctags.c, + runtime/tools/xcmdsrv_client.c, src/po/sjiscorr.c, src/xxd/xxd.c + +Patch 7.4.1216 +Problem: Still using HAVE_STDARG_H. +Solution: Assume it's always defined. +Files: src/eval.c, src/misc2.c, src/vim.h, src/proto.h, src/configure.in, + src/auto/configure, config.h.in, src/os_amiga.h, src/os_msdos.h, + src/os_vms_conf.h, src/os_win32.h + +Patch 7.4.1217 +Problem: Execution of command on channel doesn't work yet. +Solution: Implement the "ex" and "normal" commands. +Files: src/channel.c, src/proto/channel.pro, src/misc2.c, src/eval.c, + src/ex_docmd.c, src/proto/ex_docmd.pro, src/feature.h + +Patch 7.4.1218 +Problem: Missing change in configure. More changes for function style. +Solution: Avoid the typos. +Files: src/configure.in, src/config.h.in, runtime/tools/ccfilter.c, + src/os_msdos.c + +Patch 7.4.1219 +Problem: Build fails with +channel but without +float. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.1220 +Problem: Warnings for unused variables in tiny build. (Tony Mechelynck) +Solution: Move declarations inside #ifdef. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.1221 +Problem: Including netbeans and channel support in small and tiny builds. + Build fails with some interfaces. +Solution: Only include these features in small build and above. Let + configure fail if trying to enable an interface that won't build. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1222 +Problem: ":normal" command and others missing in tiny build. +Solution: Graduate FEAT_EX_EXTRA. +Files: src/feature.h, src/charset.c, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/getchar.c, + src/normal.c, src/ui.c, src/version.c, src/globals.h + +Patch 7.4.1223 +Problem: Crash when setting v:errors to a number. +Solution: Free the typval without assuming its type. (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1224 +Problem: Build problems with GTK on BSD. (Mike Williams) +Solution: Don't use "$<". Skip building gui_gtk_gresources.h when it doesn't + work. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1225 +Problem: Still a few old style function declarations. +Solution: Make them new style. (Hirohito Higashi) +Files: runtime/tools/blink.c, src/eval.c, src/ex_cmds2.c, src/ex_getln.c, + src/fileio.c, src/gui_w32.c, src/gui_x11.c, src/if_perl.xs, + src/os_unix.c, src/po/sjiscorr.c, src/pty.c + +Patch 7.4.1226 +Problem: GRESOURCE_HDR is unused. +Solution: Remove it. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure, src/config.mk.in + +Patch 7.4.1227 +Problem: Compiler warnings. +Solution: Add UNUSED. Add type cast. (Yegappan Lakshmanan) +Files: src/getchar.c, src/os_macosx.m + +Patch 7.4.1228 +Problem: copy() and deepcopy() fail with special variables. (Nikolai + Pavlov) +Solution: Make it work. Add a test. Closes #614. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1229 +Problem: "eval" and "expr" channel commands don't work yet. +Solution: Implement them. Update the error numbers. Also add "redraw". +Files: src/channel.c, src/eval.c, src/json.c, src/ex_docmd.c, + src/proto/channel.pro, src/proto/json.pro, src/proto/ex_docmd.pro, + runtime/doc/channel.txt + +Patch 7.4.1230 +Problem: Win32: opening a channel may hang. Not checking for messages + while waiting for characters. +Solution: Add a zero timeout. Call parse_queued_messages(). (Yasuhiro + Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1231 +Problem: JSON messages are not parsed properly. +Solution: Queue received messages. +Files: src/eval.c src/channel.c, src/json.c, src/proto/eval.pro, + src/proto/channel.pro, src/proto/json.pro, src/structs.h + +Patch 7.4.1232 +Problem: Compiler warnings when the Sniff feature is enabled. +Solution: Add UNUSED. +Files: src/gui_gtk_x11.c + +Patch 7.4.1233 +Problem: Channel command may cause a crash. +Solution: Check for NULL argument. (Damien) +Files: src/channel.c + +Patch 7.4.1234 +Problem: Demo server only runs with Python 2. +Solution: Make it run with Python 3 as well. (Ken Takata) +Files: runtime/tools/demoserver.py + +Patch 7.4.1235 (after 7.4.1231) +Problem: Missing change to eval.c. +Solution: Include that change. +Files: src/eval.c + +Patch 7.4.1236 +Problem: When "syntax manual" was used switching between buffers removes + the highlighting. +Solution: Set the syntax option without changing the value. (Anton + Lindqvist) +Files: runtime/syntax/manual.vim + +Patch 7.4.1237 +Problem: Can't translate message without adding a line break. +Solution: Join the two parts of the message. +Files: src/memline.c + +Patch 7.4.1238 +Problem: Can't handle two messages right after each other. +Solution: Find the end of the JSON. Read more when incomplete. Add a C + test for the JSON decoding. +Files: src/channel.c, src/json.c, src/proto/json.pro, src/eval.c, + src/Makefile, src/json_test.c, src/memfile_test.c, src/structs.h + +Patch 7.4.1239 +Problem: JSON message after the first one is dropped. +Solution: Put remainder of message back in the queue. +Files: src/channel.c + +Patch 7.4.1240 +Problem: Visual studio tools are noisy. +Solution: Suppress startup info. (Mike Williams) +Files: src/GvimExt/Makefile, src/Make_mvc.mak, src/tee/Make_mvc.mak + +Patch 7.4.1241 (after 7.4.1238) +Problem: Missing change in Makefile due to diff mismatch +Solution: Update the list of object files. +Files: src/Makefile + +Patch 7.4.1242 (after 7.4.1238) +Problem: json_test fails without the eval feature. +Solution: Add #ifdef. +Files: src/json_test.c + +Patch 7.4.1243 +Problem: Compiler warning for uninitialized variable. +Solution: Initialize it. (Elias Diem) +Files: src/json.c + +Patch 7.4.1244 +Problem: The channel functions don't sort together. +Solution: Use a common "ch_" prefix. +Files: src/eval.c, runtime/doc/eval.txt, runtime/tools/demoserver.py + +Patch 7.4.1245 +Problem: File missing from distribution. +Solution: Add json_test.c. +Files: Filelist + +Patch 7.4.1246 +Problem: The channel functionality isn't tested. +Solution: Add a test using a Python test server. +Files: src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel.py, + src/testdir/Make_all.mak + +Patch 7.4.1247 +Problem: The channel test doesn't run on MS-Windows. +Solution: Make it work on the MS-Windows console. (Ken Takata) +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1248 +Problem: Can't reliably stop the channel test server. Can't start the + server if the python file is not executable. +Solution: Use "pkill" instead of "killall". Run the python file as an + argument instead of as an executable. +Files: src/testdir/test_channel.vim + +Patch 7.4.1249 +Problem: Crash when the process a channel is connected to exits. +Solution: Use the file descriptor properly. Add a test. (Damien) + Also add a test for eval(). +Files: src/channel.c, src/testdir/test_channel.py, + src/testdir/test_channel.vim + +Patch 7.4.1250 +Problem: Running tests in shadow directory fails. +Solution: Also link testdir/*.py +Files: src/Makefile + +Patch 7.4.1251 +Problem: New test file missing from distribution. +Solution: Add src/testdir/*.py. +Files: Filelist + +Patch 7.4.1252 +Problem: The channel test server may receive two messages concatenated. +Solution: Split the messages. +Files: src/testdir/test_channel.py + +Patch 7.4.1253 +Problem: Python test server not displaying second of two commands. + Solaris doesn't have "pkill --full". +Solution: Also echo the second command. Use "pkill -f". +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1254 +Problem: Opening a second channel causes a crash. (Ken Takata) +Solution: Don't re-allocate the array with channels. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1255 +Problem: Crash for channel "eval" command without third argument. +Solution: Check for missing argument. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1256 +Problem: On Mac sys.exit(0) doesn't kill the test server. +Solution: Use self.server.shutdown(). (Jun Takimoto) +Files: src/testdir/test_channel.py + +Patch 7.4.1257 +Problem: Channel test fails in some configurations. +Solution: Add check for the +channel feature. +Files: src/testdir/test_channel.vim + +Patch 7.4.1258 +Problem: The channel test can fail if messages arrive later. +Solution: Add a short sleep. (Jun Takimoto) +Files: src/testdir/test_channel.vim + +Patch 7.4.1259 +Problem: No test for what patch 7.3.414 fixed. +Solution: Add a test. (Elias Diem) +Files: src/testdir/test_increment.vim + +Patch 7.4.1260 +Problem: The channel feature doesn't work on Win32 GUI. +Solution: Use WSAGetLastError(). (Ken Takata) +Files: src/channel.c, src/testdir/test_channel.vim, src/vim.h + +Patch 7.4.1261 +Problem: Pending channel messages are garbage collected. Leaking memory in + ch_sendexpr(). Leaking memory for a decoded JSON string. +Solution: Mark the message list as used. Free the encoded JSON. Don't save + the JSON string. +Files: src/eval.c, src/channel.c, src/json.c, src/proto/channel.pro + +Patch 7.4.1262 +Problem: The channel callback is not invoked. +Solution: Make a list of pending callbacks. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1263 +Problem: ch_open() hangs when the server isn't running. +Solution: Add a timeout. Use a dict to pass arguments. (Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, runtime/doc/channel.txt, src/channel.c, + src/eval.c, src/netbeans.c, src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1264 +Problem: Crash when receiving an empty array. +Solution: Check for array with wrong number of arguments. (Damien) +Files: src/channel.c, src/eval.c, src/testdir/test_channel.py, + src/testdir.test_channel.vim + +Patch 7.4.1265 +Problem: Not all channel commands are tested. +Solution: Add a test for "normal", "expr" and "redraw". +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1266 +Problem: A BufAdd autocommand may cause an ml_get error (Christian + Brabandt) +Solution: Increment RedrawingDisabled earlier. +Files: src/ex_cmds.c + +Patch 7.4.1267 +Problem: Easy to miss handling all types of variables. +Solution: Change the variable type into an enum. +Files: src/structs.h, src/eval.c + +Patch 7.4.1268 +Problem: Waittime is used as seconds instead of milliseconds. (Hirohito + Higashi) +Solution: Divide by 1000. +Files: src/channel.c + +Patch 7.4.1269 +Problem: Encoding {'key':v:none} to JSON doesn't give an error (Tyru) +Solution: Give an error. +Files: src/json.c, src/testdir/test_json.vim + +Patch 7.4.1270 +Problem: Warnings for missing values in switch. +Solution: Change switch to if-else or add values. +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.1271 +Problem: assert_false(v:false) reports an error. (Nikolai Pavlov) +Solution: Recognize v:true and v:false. (Closes #625) +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1272 (after 7.4.1270) +Problem: Using future enum value. +Solution: Remove it. +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1273 (after 7.4.1271) +Problem: assert_false(v:false) still fails. +Solution: Fix the typo. +Files: src/eval.c + +Patch 7.4.1274 +Problem: Cannot run a job. +Solution: Add job_start(), job_status() and job_stop(). Currently only works + for Unix. +Files: src/eval.c, src/structs.h, runtime/doc/eval.txt, src/os_unix.c, + src/proto/os_unix.pro, src/feature.h, src/version.c, + src/testdir/test_channel.vim + +Patch 7.4.1275 (after 7.4.1274) +Problem: Build fails on MS-Windows. +Solution: Fix wrong #ifdef. +Files: src/eval.c + +Patch 7.4.1276 +Problem: Warning for not using return value of fcntl(). +Solution: Explicitly ignore the return value. +Files: src/fileio.c, src/channel.c, src/memfile.c, src/memline.c + +Patch 7.4.1277 +Problem: Compiler can complain about missing enum value in switch with some + combination of features. +Solution: Remove #ifdefs around case statements. +Files: src/eval.c + +Patch 7.4.1278 +Problem: When jsonencode() fails it still returns something. +Solution: Return an empty string on failure. +Files: src/json.c, src/channel.c, src/testdir/test_json.vim, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1279 +Problem: jsonencode() is not producing strict JSON. +Solution: Add jsencode() and jsdecode(). Make jsonencode() and jsondecode() + strict. +Files: src/json.c, src/json_test.c, src/proto/json.pro, src/channel.c, + src/proto/channel.pro, src/eval.c, src/vim.h, src/structs.h, + runtime/doc/eval.txt, runtime/doc/channel.txt, + src/testdir/test_json.vim + +Patch 7.4.1280 +Problem: Missing case value. +Solution: Add VAR_JOB. +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1281 +Problem: No test for skipping over code that isn't evaluated. +Solution: Add a test with code that would fail when not skipped. +Files: src/testdir/test_viml.vim + +Patch 7.4.1282 +Problem: Crash when evaluating the pattern of ":catch" causes an error. + (Dominique Pelle) +Solution: Block error messages at this point. +Files: src/ex_eval.c + +Patch 7.4.1283 +Problem: The job feature isn't available on MS-Windows. +Solution: Add the job feature. Fix argument of job_stop(). (Yasuhiro + Matsumoto) +Files: src/eval.c, src/feature.h, src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1284 (after 7.4.1282) +Problem: Test 49 fails. +Solution: Check for a different error message. +Files: src/testdir/test49.vim + +Patch 7.4.1285 +Problem: Cannot measure elapsed time. +Solution: Add reltimefloat(). +Files: src/ex_cmds2.c, src/eval.c, src/proto/ex_cmds2.pro, + src/testdir/test_reltime.vim, src/testdir/test_alot.vim + +Patch 7.4.1286 +Problem: ch_open() with a timeout doesn't work correctly. +Solution: Change how select() is used. Don't give an error on timeout. + Add a test for ch_open() failing. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1287 (after 7.4.1286) +Problem: Channel test fails. +Solution: Use reltimefloat(). +Files: src/testdir/test_channel.vim + +Patch 7.4.1288 +Problem: ch_sendexpr() does not use JS encoding. +Solution: Use the encoding that fits the channel mode. Refuse using + ch_sendexpr() on a raw channel. +Files: src/channel.c, src/proto/channel.pro, src/eval.c + +Patch 7.4.1289 +Problem: Channel test fails on MS-Windows, connect() takes too long. +Solution: Adjust the test for MS-Windows using "waittime". +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1290 +Problem: Coverity complains about unnecessary check for NULL. +Solution: Remove the check. +Files: src/eval.c + +Patch 7.4.1291 +Problem: On MS-Windows the channel test server doesn't quit. +Solution: Use return instead of break. (Ken Takata) +Files: src/testdir/test_channel.py + +Patch 7.4.1292 +Problem: Some compilers complain about uninitialized variable, even though + all possible cases are handled. (Dominique Pelle) +Solution: Add a default initialization. +Files: src/eval.c + +Patch 7.4.1293 +Problem: Sometimes a channel may hang waiting for a message that was + already discarded. (Ken Takata) +Solution: Store the ID of the message blocking on in the channel. +Files: src/channel.c + +Patch 7.4.1294 +Problem: job_stop() only kills the started process. +Solution: Send the signal to the process group. (Olaf Dabrunz) +Files: src/os_unix.c + +Patch 7.4.1295 +Problem: string(job) doesn't work well on MS-Windows. +Solution: Use the process ID. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1296 +Problem: Cursor changes column with up motion when the matchparen plugin + saves and restores the cursor position. (Martin Kunev) +Solution: Make sure curswant is updated before invoking the autocommand. +Files: src/edit.c + +Patch 7.4.1297 +Problem: On Mac test_channel leaves python instances running. +Solution: Use a small waittime to make ch_open() work. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1298 +Problem: When the channel test fails in an unexpected way the server keeps + running. +Solution: Use try/catch. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1299 +Problem: When the server sends a message with ID zero the channel handler + is not invoked. (Christian J. Robinson) +Solution: Recognize zero value for the request ID. Add a test for invoking + the channel handler. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1300 +Problem: Cannot test CursorMovedI because there is typeahead. +Solution: Add disable_char_avail_for_testing(). +Files: src/eval.c, src/getchar.c, src/globals.h, + src/testdir/test_cursor_func.vim, src/testdir/README.txt + +Patch 7.4.1301 +Problem: Missing options in ch_open(). +Solution: Add s:chopt like in the other calls. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1302 +Problem: Typo in struct field name. (Ken Takata) +Solution: Rename jf_pi to jv_pi. +Files: src/eval.c, src/os_win32.c, src/structs.h + +Patch 7.4.1303 +Problem: A Funcref is not accepted as a callback. +Solution: Make a Funcref work. (Damien) +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1304 +Problem: Function names are difficult to read. +Solution: Rename jsonencode to json_encode, jsondecode to json_decode, + jsencode to js_encode and jsdecode to js_decode. +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_json.vim + +Patch 7.4.1305 +Problem: "\%1l^#.*" does not match on a line starting with "#". +Solution: Do not clear the start-of-line flag. (Christian Brabandt) +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test36.in, + src/testdir/test36.ok + +Patch 7.4.1306 +Problem: Job control doesn't work well on MS-Windows. +Solution: Various fixes. (Ken Takata, Ozaki Kiichi, Yukihiro Nakadaira, + Yasuhiro Matsumoto) +Files: src/Make_mvc.mak, src/eval.c, src/os_unix.c, src/os_win32.c, + src/proto/os_unix.pro, src/proto/os_win32.pro, src/structs.h + +Patch 7.4.1307 +Problem: Some channel tests fail on MS-Windows. +Solution: Disable the failing tests temporarily. +Files: src/testdir/test_channel.vim + +Patch 7.4.1308 (after 7.4.1307) +Problem: Typo in test. +Solution: Change endf to endif. +Files: src/testdir/test_channel.vim + +Patch 7.4.1309 +Problem: When a test fails not all relevant info is listed. +Solution: Add the errors to the messages. +Files: src/testdir/runtest.vim + +Patch 7.4.1310 +Problem: Jobs don't open a channel. +Solution: Create pipes and add them to the channel. Add ch_logfile(). + Only Unix for now. +Files: src/channel.c, src/eval.c, src/os_unix.c, src/structs.h, + src/gui_w48.c, src/proto/channel.pro, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py, runtime/doc/eval.txt + +Patch 7.4.1311 (after 7.4.1310) +Problem: sock_T is defined too late. +Solution: Move it up. +Files: src/vim.h + +Patch 7.4.1312 (after 7.4.1311) +Problem: sock_T is not defined without the +channel feature. +Solution: Always define it. +Files: src/vim.h + +Patch 7.4.1313 +Problem: MS-Windows: Using socket after it was closed causes an exception. +Solution: Don't give an error when handling WM_NETBEANS. Re-enable tests + for MS-Windows. +Files: src/gui_w48.c, src/testdir/test_channel.vim + +Patch 7.4.1314 +Problem: Warning for uninitialized variable. +Solution: Initialize it. (Dominique Pelle) +Files: src/channel.c + +Patch 7.4.1315 +Problem: Using a channel handle does not allow for freeing it when unused. +Solution: Add the Channel variable type. +Files: src/structs.h, src/channel.c, src/misc2.c, src/eval.c, + src/if_python.c, src/if_python3.c, src/json.c, src/gui_w48.c, + src/netbeans.c, src/proto/channel.pro, src/os_unix.c, + src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1316 +Problem: Can't build MS-Windows console version. (Tux) +Solution: Add #ifdefs. +Files: src/eval.c + +Patch 7.4.1317 +Problem: MS-Windows: channel test fails. +Solution: Temporarily disable Test_connect_waittime(). +Files: src/testdir/test_channel.vim + +Patch 7.4.1318 +Problem: Channel with pipes doesn't work in GUI. +Solution: Register input handlers for pipes. +Files: src/structs.h, src/feature.h, src/channel.c, src/eval.c, + src/os_unix.c, src/os_win32.c, src/gui_w48.c, src/proto/channel.pro + +Patch 7.4.1319 (after 7.4.1318) +Problem: Tests fail on MS-Windows and on Unix with GUI. +Solution: Fix unregistering. +Files: src/structs.h, src/channel.c, src/os_unix.c, src/os_win32.c, + src/proto/channel.pro + +Patch 7.4.1320 +Problem: Building with Cygwin or MingW with channel but without Netbeans + doesn't work. +Solution: Set NETBEANS to "no" when not used. +Files: src/Make_cyg_ming.mak + +Patch 7.4.1321 +Problem: Compiler complains about missing statement. +Solution: Add an empty statement. (Andrei Olsen) +Files: src/os_win32.c + +Patch 7.4.1322 +Problem: Crash when unletting the variable that holds the channel in a + callback function. (Christian Robinson) +Solution: Increase the reference count while invoking the callback. +Files: src/eval.c, src/channel.c, src/proto/eval.pro, + src/testdir/test_channel.vim + +Patch 7.4.1323 +Problem: Do not get warnings when building with MingW. +Solution: Remove the -w flag. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1324 +Problem: Channels with pipes don't work on MS-Windows. +Solution: Add pipe I/O support. (Yasuhiro Matsumoto) +Files: src/channel.c, src/os_win32.c, src/proto/channel.pro, + src/structs.h, src/vim.h, src/testdir/test_channel.vim + +Patch 7.4.1325 +Problem: Channel test fails on difference between Unix and DOS line endings. +Solution: Strip off CR. Make assert show difference better. +Files: src/eval.c, src/channel.c + +Patch 7.4.1326 +Problem: Build rules are bit too complicated. +Solution: Remove -lwsock32 from Netbeans, it's already added for the channel + feature that it depends on. (Tony Mechelynck) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1327 +Problem: Channel test doesn't work if Python executable is python.exe. +Solution: Find py.exe or python.exe. (Ken Takata) +Files: src/testdir/test_channel.vim + +Patch 7.4.1328 +Problem: Can't compile with +job but without +channel. (John Marriott) +Solution: Add more #ifdefs. +Files: src/os_unix.c + +Patch 7.4.1329 +Problem: Crash when using channel that failed to open. +Solution: Check for NULL. Update messages. (Yukihiro Nakadaira) +Files: src/channel.c, src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1330 +Problem: fd_read() has an unused argument. +Solution: Remove the timeout. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1331 +Problem: Crash when closing the channel in a callback. (Christian J. + Robinson) +Solution: Take the callback out of the list before invoking it. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1332 +Problem: Problem using Python3 when compiled with MingW. +Solution: Define PYTHON3_HOME as a wide character string. (Yasuhiro + Matsumoto) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1333 +Problem: Channel test fails on non-darwin builds. +Solution: Add the "osx" feature and test for that. (Kazunobu Kuriyama) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1334 +Problem: Many compiler warnings with MingW. +Solution: Add type casts. (Yasuhiro Matsumoto) +Files: src/channel.c, src/dosinst.h, src/eval.c, src/ex_cmds2.c, + src/ex_getln.c, src/fileio.c, src/if_cscope.c, src/if_perl.xs, + src/if_python.c, src/if_python3.c, src/if_ruby.c, src/main.c, + src/mbyte.c, src/misc1.c, src/option.c, src/os_mswin.c, + src/os_win32.c + +Patch 7.4.1335 +Problem: Can't build on MS-Windows with +job but without +channel. (Cesar + Romani) +Solution: Add #ifdefs. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1336 +Problem: Channel NL mode is not supported yet. +Solution: Add NL mode support to channels. +Files: src/channel.c, src/netbeans.c, src/structs.h, src/os_unix.d, + src/os_win32.c, src/proto/channel.pro, src/proto/os_unix.pro, + src/proto/os_win32.pro, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1337 (after 7.4.1336) +Problem: Part of the change is missing. +Solution: Add changes to eval.c +Files: src/eval.c + + +Patch 7.4.1338 (after 7.4.1336) +Problem: Another part of the change is missing. +Solution: Type os_unix.c right this time. +Files: src/os_unix.c + +Patch 7.4.1339 +Problem: Warnings when building the GUI with MingW. (Cesar Romani) +Solution: Add type casts. (Yasuhiro Matsumoto) +Files: src/edit.c, src/gui_w32.c, src/gui_w48.c, src/os_mswin.c, + src/os_win32.c + +Patch 7.4.1340 (after 7.4.1339) +Problem: Merge left extra #endif behind. +Solution: Remove the #endif +Files: src/os_win32.c + +Patch 7.4.1341 +Problem: It's difficult to add more arguments to ch_sendraw() and + ch_sendexpr(). +Solution: Make the third option a dictionary. +Files: src/eval.c, src/structs.h, src/channel.c, src/os_unix.c, + src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1342 +Problem: On Mac OS/X the waittime must be > 0 for connect to work. +Solution: Use select() in a different way. (partly by Kazunobu Kuriyama) + Always use a waittime of 1 or more. +Files: src/eval.c, src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1343 +Problem: Can't compile with +job but without +channel. (Andrei Olsen) +Solution: Move get_job_options up and adjust #ifdef. +Files: src/eval.c + +Patch 7.4.1344 +Problem: Can't compile Win32 GUI with tiny features. +Solution: Add #ifdef. (Christian Brabandt) +Files: src/gui_w32.c + +Patch 7.4.1345 +Problem: A few more compiler warnings. (Axel Bender) +Solution: Add type casts. +Files: src/gui_w32.c, src/gui_w48.c + +Patch 7.4.1346 +Problem: Compiler warnings in build with -O2. +Solution: Add initializations. +Files: src/eval.c + +Patch 7.4.1347 +Problem: When there is any error Vim will use a non-zero exit code. +Solution: When using ":silent!" do not set the exit code. (Yasuhiro + Matsumoto) +Files: src/message.c + +Patch 7.4.1348 +Problem: More compiler warnings. (John Marriott) +Solution: Add type casts, remove unused variable. +Files: src/gui_w32.c + +Patch 7.4.1349 +Problem: And some more MingW compiler warnings. (Cesar Romani) +Solution: Add type casts. +Files: src/if_mzsch.c + +Patch 7.4.1350 +Problem: When the test server fails to start Vim hangs. +Solution: Check that there is actually something to read from the tty fd. +Files: src/os_unix.c + +Patch 7.4.1351 +Problem: When the port isn't opened yet when ch_open() is called it may + fail instead of waiting for the specified time. +Solution: Loop when select() succeeds but when connect() failed. Also use + channel logging for jobs. Add ch_log(). +Files: src/channel.c, src/eval.c, src/netbeans.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1352 +Problem: The test script lists all functions before executing them. +Solution: Only list the function currently being executed. +Files: src/testdir/runtest.vim + +Patch 7.4.1353 +Problem: Test_connect_waittime is skipped for MS-Windows. +Solution: Add the test back, it works now. +Files: src/testdir/test_channel.vim + +Patch 7.4.1354 +Problem: MS-Windows: Mismatch between default compile options and what the + code expects. +Solution: Change the default WINVER from 0x0500 to 0x0501. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1355 +Problem: Win32 console and GUI handle channels differently. +Solution: Consolidate code between Win32 console and GUI. +Files: src/channel.c, src/eval.c, src/gui_w48.c, src/os_win32.c, + src/proto/channel.pro + +Patch 7.4.1356 +Problem: Job and channel options parsing is scattered. +Solution: Move all option value parsing to get_job_options(); +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1357 (after 7.4.1356) +Problem: Error for returning value from void function. +Solution: Don't do that. +Files: src/eval.c + +Patch 7.4.1358 +Problem: Compiler warning when not building with +crypt. +Solution: Add #ifdef. (John Marriott) +Files: src/undo.c + +Patch 7.4.1359 (after 7.4.1356) +Problem: Channel test ch_sendexpr() times out. +Solution: Increase the timeout +Files: src/testdir/test_channel.vim + +Patch 7.4.1360 +Problem: Can't remove a callback with ch_setoptions(). +Solution: When passing zero or an empty string remove the callback. +Files: src/channel.c, src/proto/channel.pro, src/testdir/test_channel.vim + +Patch 7.4.1361 +Problem: Channel test fails on Solaris. +Solution: Use the 1 msec waittime for all systems. +Files: src/channel.c + +Patch 7.4.1362 (after 7.4.1356) +Problem: Using uninitialized value. +Solution: Initialize jo_set. +Files: src/eval.c + +Patch 7.4.1363 +Problem: Compiler warnings with tiny build. +Solution: Add #ifdefs. +Files: src/gui_w48.c, src/gui_w32.c + +Patch 7.4.1364 +Problem: The Win 16 code is not maintained and unused. +Solution: Remove the Win 16 support. +Files: src/gui_w16.c, src/gui_w32.c, src/gui_w48.c, src/Make_w16.mak, + src/Makefile, src/Make_cyg_ming.mak, src/Make_mvc.mak, + src/proto/gui_w16.pro, src/proto/os_win16.pro, src/guiw16rc.h, + src/vim16.rc, src/vim16.def, src/tools16.bmp, src/eval.c, + src/gui.c, src/misc2.c, src/option.c, src/os_msdos.c, + src/os_mswin.c, src/os_win16.c, src/os_win16.h, src/version.c, + src/winclip.c, src/feature.h, src/proto.h, src/vim.h, Filelist + +Patch 7.4.1365 +Problem: Cannot execute a single test function. +Solution: Add an argument to filter the functions with. (Yasuhiro Matsumoto) +Files: src/testdir/runtest.vim + +Patch 7.4.1366 +Problem: Typo in test and resulting error in test result. +Solution: Fix the typo and correct the result. (James McCoy, closes #650) +Files: src/testdir/test_charsearch.in, src/testdir/test_charsearch.ok + +Patch 7.4.1367 +Problem: Compiler warning for unreachable code. +Solution: Remove a "break". (Danek Duvall) +Files: src/json.c + +Patch 7.4.1368 +Problem: One more Win16 file remains. +Solution: Delete it. +Files: src/proto/os_win16.pro + +Patch 7.4.1369 +Problem: Channels don't have a queue for stderr. +Solution: Have a queue for each part of the channel. +Files: src/channel.c, src/eval.c, src/structs.h, src/netbeans.c, + src/gui_w32.c, src/proto/channel.pro + +Patch 7.4.1370 +Problem: The Python test script may keep on running. +Solution: Join the threads. (Yasuhiro Matsumoto) +Files: src/testdir/test_channel.py + +Patch 7.4.1371 +Problem: X11 GUI callbacks don't specify the part of the channel. +Solution: Pass the fd instead of the channel ID. +Files: src/channel.c + +Patch 7.4.1372 +Problem: channel read implementation is incomplete. +Solution: Add ch_read() and options for ch_readraw(). +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1373 +Problem: Calling a Vim function over a channel requires turning the + arguments into a string. +Solution: Add the "call" command. (Damien) Also merge "expr" and "eval" + into one. +Files: src/channel.c, src/testdir/test_channel.py, + src/testdir/test_channel.vim + +Patch 7.4.1374 +Problem: Channel test hangs on MS-Windows. +Solution: Disable the ch_read() that is supposed to time out. +Files: src/testdir/test_channel.vim + +Patch 7.4.1375 +Problem: Still some Win16 code. +Solution: Remove FEAT_GUI_W16.(Hirohito Higashi) +Files: src/eval.c, src/ex_cmds.h, src/feature.h, src/gui.h, src/menu.c, + src/misc1.c, src/option.c, src/proto.h, src/structs.h, src/term.c, + src/vim.h, runtime/doc/gui_w16.txt + +Patch 7.4.1376 +Problem: ch_setoptions() cannot set all options. +Solution: Support more options. +Files: src/channel.c, src/eval.c, src/structs.h, runtime/doc/channel.txt, + src/testdir/test_channel.vim + +Patch 7.4.1377 +Problem: Test_connect_waittime() is flaky. +Solution: Ignore the "Connection reset by peer" error. +Files: src/testdir/test_channel.vim + +Patch 7.4.1378 +Problem: Can't change job settings after it started. +Solution: Add job_setoptions() with the "stoponexit" flag. +Files: src/eval.c, src/main.c, src/structs.h, src/proto/eval.pro, + src/testdir/test_channel.vim + +Patch 7.4.1379 +Problem: Channel test fails on Win32 console. +Solution: Don't sleep when timeout is zero. Call channel_wait() before + channel_read(). Channels are not polled during ":sleep". (Yukihiro + Nakadaira) +Files: src/channel.c, src/misc2.c, src/gui_w32.c, src/os_win32.c + +Patch 7.4.1380 +Problem: The job exit callback is not implemented. +Solution: Add the "exit-cb" option. +Files: src/structs.h, src/eval.c, src/channel.c, src/proto/eval.pro, + src/misc2.c, src/macros.h, src/testdir/test_channel.vim + +Patch 7.4.1381 (after 7.4.1380) +Problem: Exit value not available on MS-Windows. +Solution: Set the exit value. +Files: src/structs.h, src/os_win32.c + +Patch 7.4.1382 +Problem: Can't get the job of a channel. +Solution: Add ch_getjob(). +Files: src/eval.c, runtime/doc/channel.txt, runtime/doc/eval.txt + +Patch 7.4.1383 +Problem: GvimExt only loads the old libintl.dll. +Solution: Also try loading libint-8.dll. (Ken Takata, closes #608) +Files: src/GvimExt/gvimext.cpp, src/GvimExt/gvimext.h + +Patch 7.4.1384 +Problem: It is not easy to use a set of plugins and their dependencies. +Solution: Add packages, ":loadplugin", 'packpath'. +Files: src/main.c, src/ex_cmds2.c, src/option.c, src/option.h, + src/ex_cmds.h, src/eval.c, src/version.c, src/proto/ex_cmds2.pro, + runtime/doc/repeat.txt, runtime/doc/options.txt, + runtime/optwin.vim + +Patch 7.4.1385 +Problem: Compiler warning for using array. +Solution: Use the right member name. (Yegappan Lakshmanan) +Files: src/eval.c + +Patch 7.4.1386 +Problem: When the Job exit callback is invoked, the job may be freed too + soon. (Yasuhiro Matsumoto) +Solution: Increase refcount. +Files: src/eval.c + +Patch 7.4.1387 +Problem: Win16 docs still referenced. +Solution: Remove Win16 files from the docs Makefile. (Kenichi Ito) +Files: runtime/doc/Makefile + +Patch 7.4.1388 +Problem: Compiler warning. (Cesar Romani) +Solution: Initialize variable. +Files: src/ex_cmds2.c + +Patch 7.4.1389 +Problem: Incomplete function declaration. +Solution: Add "void". (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1390 +Problem: When building with GTK and glib-compile-resources cannot be found + building Vim fails. (Michael Gehring) +Solution: Make GLIB_COMPILE_RESOURCES empty instead of leaving it at "no". + (nuko8, closes #655) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1391 +Problem: Warning for uninitialized variable. +Solution: Set it to zero. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.1392 +Problem: Some tests fail for Win32 console version. +Solution: Move the tests to SCRIPTS_MORE2. Pass VIMRUNTIME. (Christian + Brabandt) +Files: src/testdir/Make_all.mak + +Patch 7.4.1393 +Problem: Starting a job hangs in the GUI. (Takuya Fujiwara) +Solution: Don't check if ch_job is NULL when checking for an error. + (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1394 +Problem: Can't sort inside a sort function. +Solution: Use a struct to store the sort parameters. (Jacob Niehus) +Files: src/eval.c, src/testdir/test_sort.vim + +Patch 7.4.1395 +Problem: Using DETACH in quotes is not compatible with the Netbeans + interface. (Xavier de Gaye) +Solution: Remove the quotes, only use them for JSON and JS mode. +Files: src/netbeans.c, src/channel.c + +Patch 7.4.1396 +Problem: Compiler warnings for conversions. +Solution: Add type cast. +Files: src/ex_cmds2.c + +Patch 7.4.1397 +Problem: Sort test fails on MS-Windows. +Solution: Correct the compare function. +Files: src/testdir/test_sort.vim + +Patch 7.4.1398 +Problem: The close-cb option is not implemented yet. +Solution: Implement close-cb. (Yasuhiro Matsumoto) +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1399 +Problem: The MS-DOS code does not build. +Solution: Remove the old MS-DOS code. +Files: Filelist, src/Make_bc3.mak, src/Make_bc5.mak, src/Make_djg.mak, + src/Makefile, src/blowfish.c, src/buffer.c, src/diff.c, + src/digraph.c, src/dosinst.h, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/feature.h, + src/fileio.c, src/getchar.c, src/globals.h, src/macros.h, + src/main.c, src/mbyte.c, src/memfile.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/option.c, + src/option.h, src/os_msdos.c, src/os_msdos.h, src/proto.h, + src/proto/os_msdos.pro, src/regexp.c, src/screen.c, src/structs.h, + src/syntax.c, src/term.c, src/undo.c, src/uninstal.c, + src/version.c, src/vim.h, src/window.c, src/xxd/Make_bc3.mak, + src/xxd/Make_djg.mak + + +Patch 7.4.1400 +Problem: Perl eval doesn't work properly on 64-bit big-endian machine. +Solution: Use 32 bit type for the key. (Danek Duvall) +Files: src/if_perl.xs + +Patch 7.4.1401 +Problem: Having 'autochdir' set during startup and using diff mode doesn't + work. (Axel Bender) +Solution: Don't use 'autochdir' while still starting up. (Christian + Brabandt) +Files: src/buffer.c + +Patch 7.4.1402 +Problem: GTK 3 is not supported. +Solution: Add GTK 3 support. (Kazunobu Kuriyama) +Files: runtime/doc/eval.txt, runtime/doc/gui.txt, + runtime/doc/gui_x11.txt, src/auto/configure, src/channel.c, + src/config.h.in, src/configure.in, src/eval.c, src/gui.h, + src/gui_beval.c, src/gui_beval.h, src/gui_gtk.c, src/gui_gtk_f.c, + src/gui_gtk_f.h, src/gui_gtk_x11.c, src/if_mzsch.c, src/mbyte.c, + src/netbeans.c, src/structs.h, src/version.c + +Patch 7.4.1403 +Problem: Can't build without the quickfix feature. +Solution: Add #ifdefs. Call ex_ni() for unimplemented commands. (Yegappan + Lakshmanan) +Files: src/ex_cmds2.c, src/popupmnu.c + +Patch 7.4.1404 +Problem: ch_read() doesn't time out on MS-Windows. +Solution: Instead of WM_NETBEANS use select(). (Yukihiro Nakadaira) +Files: src/channel.c, src/gui_w32.c, src/os_win32.c, src/structs.h, + src/testdir/test_channel.vim, src/vim.h + +Patch 7.4.1405 +Problem: Completion menu flickers. +Solution: Delay showing the popup menu. (Shougo Matsu, Justin M. Keyes, + closes #656) +Files: src/edit.c + +Patch 7.4.1406 +Problem: Leaking memory in cs_print_tags_priv(). +Solution: Free tbuf. (idea by Forrest Fleming) +Files: src/if_cscope.c + +Patch 7.4.1407 +Problem: json_encode() does not handle NaN and inf properly. (David + Barnett) +Solution: For JSON turn them into "null". For JS use "NaN" and "Infinity". + Add isnan(). +Files: src/eval.c, src/json.c, src/testdir/test_json.vim + +Patch 7.4.1408 +Problem: MS-Windows doesn't have isnan() and isinf(). +Solution: Use _isnan() and _isinf(). +Files: src/eval.c, src/json.c + +Patch 7.4.1409 (after 7.4.1402) +Problem: Configure includes GUI despite --disable-gui flag. +Solution: Add SKIP_GTK3. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1410 +Problem: Leaking memory in cscope interface. +Solution: Free memory when no tab is found. (Christian Brabandt) +Files: src/if_cscope.c + +Patch 7.4.1411 +Problem: Compiler warning for indent. (Ajit Thakkar) +Solution: Indent normally. +Files: src/ui.c + +Patch 7.4.1412 +Problem: Compiler warning for indent. (Dominique Pelle) +Solution: Fix the indent. +Files: src/farsi.c + +Patch 7.4.1413 +Problem: When calling ch_close() the close callback is invoked, even though + the docs say it isn't. (Christian J. Robinson) +Solution: Don't call the close callback. +Files: src/eval.c, src/channel.c, src/netbeans.c, src/proto/channel.pro + +Patch 7.4.1414 +Problem: Appveyor only builds one feature set. +Solution: Build a combination of features and GUI/console. (Christian + Brabandt) +Files: appveyor.yml, src/appveyor.bat + +Patch 7.4.1415 (after 7.4.1414) +Problem: Dropped the skip-tags setting. +Solution: Put it back. +Files: appveyor.yml + +Patch 7.4.1416 +Problem: Using "u_char" instead of "char_u", which doesn't work everywhere. + (Jörg Plate) +Solution: Use "char_u" always. +Files: src/integration.c, src/macros.h + +Patch 7.4.1417 (after 7.4.1414) +Problem: Missing appveyor.bat from the distribution. +Solution: Add it to the list of files. +Files: Filelist + +Patch 7.4.1418 +Problem: job_stop() on MS-Windows does not really stop the job. +Solution: Make the default to stop the job forcefully. (Ken Takata) + Make MS-Windows and Unix more similar. +Files: src/os_win32.c, src/os_unix.c, runtime/doc/eval.txt + +Patch 7.4.1419 +Problem: Tests slowed down because of the "not a terminal" warning. +Solution: Add the --not-a-term command line argument. +Files: src/main.c, src/testdir/Makefile, src/Make_all.mak, + src/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_vms.mms, + runtime/doc/starting.txt + +Patch 7.4.1420 (after 7.4.1419) +Problem: Missing makefile. +Solution: Type the path correctly. +Files: src/testdir/Make_all.mak + +Patch 7.4.1421 +Problem: May free a channel when a callback may need to be invoked. +Solution: Keep the channel when refcount is zero. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1422 +Problem: Error when reading fails uses wrong errno. Keeping channel open + after job stops results in test failing. +Solution: Move the error up. Add ch_job_killed. +Files: src/channel.c, src/eval.c, src/structs.h + +Patch 7.4.1423 +Problem: Channel test fails on MS-Windows. +Solution: Do not give an error message when reading fails, assume the other + end exited. +Files: src/channel.c + +Patch 7.4.1424 +Problem: Not using --not-a-term when running tests on MS-Windows. +Solution: Use NO_PLUGIN. (Christian Brabandt) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1425 +Problem: There are still references to MS-DOS support. +Solution: Remove most of the help txt and install instructions. (Ken Takata) +Files: src/INSTALLpc.txt, runtime/doc/os_msdos.txt, csdpmi4b.zip, + Filelist + +Patch 7.4.1426 +Problem: The "out-io" option for jobs is not implemented yet. +Solution: Implement the "buffer" value: append job output to a buffer. +Files: src/eval.c, src/channel.c, src/structs.h, src/netbeans.c, + runtime/doc/channel.txt + +Patch 7.4.1427 +Problem: Trailing comma in enums is not ANSI C. +Solution: Remove the trailing commas. +Files: src/alloc.h, src/gui_mac.c + +Patch 7.4.1428 +Problem: Compiler warning for non-virtual destructor. +Solution: Make it virtual. (Yasuhiro Matsumoto) +Files: src/gui_dwrite.cpp + +Patch 7.4.1429 +Problem: On MS-Windows, when not use renderoptions=type:directx, drawing + emoji will be broken. +Solution: Fix usage of unicodepdy. (Yasuhiro Matsumoto) +Files: src/gui_w32.c + +Patch 7.4.1430 +Problem: When encoding JSON, turning NaN and Infinity into null without + giving an error is not useful. +Solution: Pass NaN and Infinity on. If the receiver can't handle them it + will generate the error. +Files: src/json.c, src/testdir/test_json.vim, runtime/doc/eval.txt + +Patch 7.4.1431 +Problem: Including header files twice. +Solution: Remove the extra includes. +Files: src/if_cscope.h + +Patch 7.4.1432 +Problem: Typo in button text. +Solution: Fix the typo. (Dominique Pelle) +Files: src/gui_gtk.c + +Patch 7.4.1433 +Problem: The Sniff interface is no longer useful, the tool has not been + available for may years. +Solution: Delete the Sniff interface and related code. +Files: src/if_sniff.c, src/if_sniff.h, src/charset.c, src/edit.c, + src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, + src/gui_gtk_x11.c, src/gui_w32.c, src/gui_x11.c, src/normal.c, + src/os_unix.c, src/os_win32.c, src/term.c, src/ui.c, + src/version.c, src/ex_cmds.h, src/feature.h, src/keymap.h, + src/structs.h, src/vim.h, src/Make_mvc.mak, src/Make_vms.mms, + src/Makefile, src/configure.in, src/auto/configure, + src/config.h.in, src/config.mk.in, runtime/doc/if_sniff.txt, + src/config.aap.in, src/main.aap + +Patch 7.4.1434 +Problem: JSON encoding doesn't handle surrogate pair. +Solution: Improve multi-byte handling of JSON. (Yasuhiro Matsumoto) +Files: src/json.c, src/testdir/test_json.vim + +Patch 7.4.1435 +Problem: It is confusing that ch_sendexpr() and ch_sendraw() wait for a + response. +Solution: Add ch_evalexpr() and ch_evalraw(). +Files: src/eval.c, runtime/doc/channel.txt, runtime/doc/eval.txt, + src/testdir/test_channel.vim + +Patch 7.4.1436 (after 7.4.1433) +Problem: Sniff files still referenced in distribution. +Solution: Remove sniff files from distribution. +Files: Filelist + +Patch 7.4.1437 +Problem: Old system doesn't have isinf() and NAN. (Ben Fritz) +Solution: Adjust #ifdefs. Detect isnan() and isinf() functions with + configure. Use a replacement when missing. (Kazunobu Kuriyama) +Files: src/eval.c, src/json.c, src/macros.h, src/message.c, + src/config.h.in, src/configure.in, src/auto/configure + +Patch 7.4.1438 +Problem: Can't get buffer number of a channel. +Solution: Add ch_getbufnr(). +Files: src/eval.c, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt, runtime/doc/eval.txt + +Patch 7.4.1439 (after 7.4.1434) +Problem: Using uninitialized variable. +Solution: Initialize vc_type. +Files: src/json.c + +Patch 7.4.1440 (after 7.4.1437) +Problem: Can't build on Windows. +Solution: Change #ifdefs. Only define isnan when used. +Files: src/macros.h, src/eval.c, src/json.c + +Patch 7.4.1441 +Problem: Using empty name instead of no name for channel buffer. +Solution: Remove the empty name. +Files: src/channel.c + +Patch 7.4.1442 +Problem: MS-Windows: more compilation warnings for destructor. +Solution: Add "virtual". (Ken Takata) +Files: src/if_ole.cpp + +Patch 7.4.1443 +Problem: Can't build GTK3 with small features. +Solution: Use gtk_widget_get_window(). Fix typos. (Dominique Pelle) +Files: src/gui_gtk_x11.c + +Patch 7.4.1444 +Problem: Can't build with JSON but without multi-byte. +Solution: Fix pointer name. +Files: src/json.c + +Patch 7.4.1445 +Problem: Memory corruption when 'encoding' is not utf-8. +Solution: Convert decoded string later. +Files: src/json.c + +Patch 7.4.1446 +Problem: Crash when using json_decode(). +Solution: Terminate string with a NUL byte. +Files: src/json.c + +Patch 7.4.1447 +Problem: Memory leak when using ch_read(). (Dominique Pelle) + No log message when stopping a job and a few other situations. + Too many "Nothing to read" messages. Channels are not freed. +Solution: Free the listtv. Add more log messages. Remove "Nothing to read" + message. Remove the channel from the job when its refcount + becomes zero. +Files: src/eval.c, src/channel.c + +Patch 7.4.1448 +Problem: JSON tests fail if 'encoding' is not utf-8. +Solution: Force encoding to utf-8. +Files: src/testdir/test_json.vim + +Patch 7.4.1449 +Problem: Build fails with job feature but without channel feature. +Solution: Add #ifdef. +Files: src/eval.c + +Patch 7.4.1450 +Problem: Json encoding still fails when encoding is not utf-8. +Solution: Set 'encoding' before :scriptencoding. Run the json test + separately to avoid affecting other tests. +Files: src/testdir/test_json.vim, src/testdir/Make_all.mak, + src/testdir/test_alot.vim + +Patch 7.4.1451 +Problem: Vim hangs when a channel has a callback but isn't referenced. +Solution: Have channel_unref() only return TRUE when the channel was + actually freed. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1452 +Problem: When a callback adds a syntax item either the redraw doesn't + happen right away or in the GUI the cursor is in the wrong + position for a moment. (Jakson Alves de Aquino) +Solution: Redraw after the callback was invoked. +Files: src/channel.c + +Patch 7.4.1453 +Problem: Missing --not-a-term. +Solution: Add the argument. +Files: src/testdir/Make_amiga.mak + +Patch 7.4.1454 +Problem: The exit callback test is flaky. +Solution: Loop to wait for a short time up to a second. +Files: src/testdir/test_channel.vim + +Patch 7.4.1455 +Problem: JSON decoding test for surrogate pairs is in the wrong place. +Solution: Move the test lines. (Ken Takata) +Files: src/testdir/test_json.vim + +Patch 7.4.1456 +Problem: Test 87 fails with Python 3.5. +Solution: Work around difference. (Taro Muraoka) +Files: src/testdir/test87.in + +Patch 7.4.1457 +Problem: Opening a channel with select() is not done properly. +Solution: Also used read-fds. Use getsockopt() to check for errors. (Ozaki + Kiichi) +Files: src/channel.c + +Patch 7.4.1458 +Problem: When a JSON channel has a callback it may never be cleared. +Solution: Do not write "DETACH" into a JS or JSON channel. +Files: src/channel.c + +Patch 7.4.1459 (after 7.4.1457) +Problem: MS-Windows doesn't know socklen_t. +Solution: Use previous method for WIN32. +Files: src/channel.c + +Patch 7.4.1460 +Problem: Syntax error in rarely used code. +Solution: Fix the mch_rename() declaration. (Ken Takata) +Files: src/os_unix.c, src/proto/os_unix.pro + +Patch 7.4.1461 +Problem: When starting job on MS-Windows all parts of the command are put + in quotes. +Solution: Only use quotes when needed. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1462 +Problem: Two more rarely used functions with errors. +Solution: Add proper argument types. (Dominique Pelle) +Files: src/misc2.c, src/termlib.c + +Patch 7.4.1463 +Problem: Configure doesn't find isinf() and isnan() on some systems. +Solution: Use a configure check that includes math.h. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1464 +Problem: When the argument of sort() is zero or empty it fails. +Solution: Make zero work as documented. (suggested by Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_sort.vim + +Patch 7.4.1465 +Problem: Coverity reported possible use of NULL pointer when using buffer + output with JSON mode. +Solution: Make it actually possible to use JSON mode with a buffer. + Re-encode the JSON to append it to the buffer. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1466 +Problem: Coverity reports dead code. +Solution: Remove the two lines. +Files: src/channel.c + +Patch 7.4.1467 +Problem: Can't build without the float feature. +Solution: Add #ifdefs. (Nick Owens, closes #667) +Files: src/eval.c, src/json.c + +Patch 7.4.1468 +Problem: Sort test doesn't test with "1" argument. +Solution: Also test ignore-case sorting. (Yasuhiro Matsumoto) +Files: src/testdir/test_sort.vim + +Patch 7.4.1469 +Problem: Channel test sometimes fails, especially on OS/X. (Kazunobu + Kuriyama) +Solution: Change the && into ||, call getsockopt() in more situations. + (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.1470 +Problem: Coverity reports missing restore. +Solution: Move json_encode() call up. +Files: src/channel.c + +Patch 7.4.1471 +Problem: Missing out-of-memory check. And Coverity warning. +Solution: Bail out when msg is NULL. +Files: src/channel.c + +Patch 7.4.1472 +Problem: Coverity warning for not using return value. +Solution: Add "(void)". +Files: src/os_unix.c + +Patch 7.4.1473 +Problem: Can't build without the autocommand feature. +Solution: Add #ifdefs. (Yegappan Lakshmanan) +Files: src/edit.c, src/main.c, src/syntax.c + +Patch 7.4.1474 +Problem: Compiler warnings without the float feature. +Solution: Move #ifdefs. (John Marriott) +Files: src/eval.c + +Patch 7.4.1475 +Problem: When using hangulinput with utf-8 a CSI character is + misinterpreted. +Solution: Convert CSI to K_CSI. (SungHyun Nam) +Files: src/ui.c + +Patch 7.4.1476 +Problem: Function arguments marked as unused while they are not. +Solution: Remove UNUSED. (Yegappan Lakshmanan) +Files: src/diff.c, src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, + src/window.c + +Patch 7.4.1477 +Problem: Test_reltime is flaky, it depends on timing. +Solution: When it fails run it a second time. +Files: src/testdir/runtest.vim + +Patch 7.4.1478 +Problem: ":loadplugin" doesn't take care of ftdetect files. +Solution: Also load ftdetect scripts when appropriate. +Files: src/ex_cmds2.c + +Patch 7.4.1479 +Problem: No testfor ":loadplugin". +Solution: Add a test. Fix how option is being set. +Files: src/ex_cmds2.c, src/testdir/test_loadplugin.vim, + src/testdir/Make_all.mak + +Patch 7.4.1480 +Problem: Cannot add a pack directory without loading a plugin. +Solution: Add the :packadd command. +Files: src/ex_cmds.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + src/testdir/test_loadplugin.vim, runtime/doc/repeat.txt + +Patch 7.4.1481 +Problem: Can't build with small features. +Solution: Add #ifdef. +Files: src/ex_cmds2.c + +Patch 7.4.1482 +Problem: "timeout" option not supported on ch_eval*(). +Solution: Get and use the timeout option from the argument. +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1483 +Problem: A one-time callback is not used for a raw channel. +Solution: Use a one-time callback when it exists. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1484 +Problem: Channel "err-io" value "out" is not supported. +Solution: Connect stderr to stdout if wanted. +Files: src/os_unix.c, src/os_win32.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1485 +Problem: Job input from buffer is not implemented. +Solution: Implement it. Add "in-top" and "in-bot" options. +Files: src/structs.h, src/eval.c, src/channel.c, src/proto/channel.pro, + src/os_unix.c, src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1486 +Problem: ":loadplugin" is not optimal, some people find it confusing. +Solution: Only use ":packadd" with an optional "!". +Files: src/ex_cmds.h, src/ex_cmds2.c, src/testdir/test_loadplugin.vim, + src/testdir/test_packadd.vim, src/testdir/Make_all.mak, + runtime/doc/repeat.txt + +Patch 7.4.1487 +Problem: For WIN32 isinf() is defined as a macro. +Solution: Define it as an inline function. (ZyX) +Files: src/macros.h + +Patch 7.4.1488 (after 7.4.1475) +Problem: Not using key when result from hangul_string_convert() is NULL. +Solution: Fall back to not converted string. +Files: src/ui.c + +Patch 7.4.1489 (after 7.4.1487) +Problem: "inline" is not supported by old MSVC. +Solution: use "__inline". (Ken Takata) +Files: src/macros.h + +Patch 7.4.1490 +Problem: Compiler warning for unused function. +Solution: Add #ifdef. (Dominique Pelle) +Files: src/gui_gtk_x11.c + +Patch 7.4.1491 +Problem: Visual-block shift breaks multi-byte characters. +Solution: Compute column differently. (Yasuhiro Matsumoto) Add a test. +Files: src/ops.c, src/testdir/test_visual.vim, src/testdir/Make_all.mak + +Patch 7.4.1492 +Problem: No command line completion for ":packadd". +Solution: Implement completion. (Hirohito Higashi) +Files: src/ex_docmd.c, src/ex_getln.c, src/testdir/test_packadd.vim, + src/vim.h + +Patch 7.4.1493 +Problem: Wrong callback invoked for zero-id messages. +Solution: Don't use the first one-time callback when the sequence number + doesn't match. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1494 +Problem: clr_history() does not work properly. +Solution: Increment hisptr. Add a test. (Yegappan Lakshmanan) +Files: src/ex_getln.c, src/testdir/test_history.vim, + src/testdir/Make_all.mak + +Patch 7.4.1495 +Problem: Compiler warnings when building on Unix with the job feature but + without the channel feature. +Solution: Move #ifdefs. (Dominique Pelle) +Files: src/os_unix.c + +Patch 7.4.1496 +Problem: Crash when built with GUI but it's not active. (Dominique Pelle) +Solution: Check gui.in_use. +Files: src/channel.c + +Patch 7.4.1497 +Problem: Cursor drawing problem with GTK 3. +Solution: Handle blinking differently. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1498 +Problem: Error for locked item when using json_decode(). (Shougo Matsu) +Solution: Initialize v_lock. +Files: src/json.c + +Patch 7.4.1499 +Problem: No error message when :packadd does not find anything. +Solution: Add an error message. (Hirohito Higashi) +Files: runtime/doc/repeat.txt, src/ex_cmds.h, src/ex_cmds2.c, + src/globals.h, src/testdir/test_packadd.vim + +Patch 7.4.1500 +Problem: Should_free flag set to FALSE. +Solution: Set it to TRUE. (Neovim 4415) +Files: src/ex_eval.c + +Patch 7.4.1501 +Problem: Garbage collection with an open channel is not tested. +Solution: Call garbagecollect() in the test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1502 +Problem: Writing last-but-one line of buffer to a channel isn't implemented + yet. +Solution: Implement it. Fix leaving a swap file behind. +Files: src/channel.c, src/structs.h, src/memline.c, src/proto/channel.pro + +Patch 7.4.1503 +Problem: Crash when using ch_getjob(). (Damien) +Solution: Check for a NULL job. +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1504 (after 7.4.1502) +Problem: No test for reading last-but-one line. +Solution: Add a test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1505 +Problem: When channel log is enabled get too many "looking for messages" + log entries. +Solution: Only give the message after another message. +Files: src/channel.c + +Patch 7.4.1506 +Problem: Job cannot read from a file. +Solution: Implement reading from a file for Unix. +Files: src/eval.c, src/os_unix.c, src/os_win32.c, + src/testdir/test_channel.vim + +Patch 7.4.1507 +Problem: Crash when starting a job fails. +Solution: Check for the channel to be NULL. (idea by Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1508 +Problem: Can't build GvimExt with MingW. +Solution: Adjust the makefile. (Ben Fritz) +Files: src/GvimExt/Make_ming.mak + +Patch 7.4.1509 +Problem: Keeping both a variable for a job and the channel it refers to is + a hassle. +Solution: Allow passing the job where a channel is expected. (Damien) +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1510 +Problem: Channel test fails on AppVeyor. +Solution: Wait longer than 10 msec if needed. +Files: src/testdir/test_channel.vim + +Patch 7.4.1511 +Problem: Statusline highlighting is sometimes wrong. +Solution: Check for Highlight type. (Christian Brabandt) +Files: src/buffer.c + +Patch 7.4.1512 +Problem: Channel input from file not supported on MS-Windows. +Solution: Implement it. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1513 +Problem: "J" fails if there are not enough lines. (Christian Neukirchen) +Solution: Reduce the count, only fail on the last line. +Files: src/normal.c, src/testdir/test_join.vim, src/testdir/test_alot.vim + +Patch 7.4.1514 +Problem: Channel output to file not implemented yet. +Solution: Implement it for Unix. +Files: src/os_unix.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1515 +Problem: Channel test is a bit flaky. +Solution: Instead of a fixed sleep time wait until an expression evaluates + to true. +Files: src/testdir/test_channel.vim + +Patch 7.4.1516 +Problem: Cannot change file permissions. +Solution: Add setfperm(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/testdir/test_file_perm.vim + +Patch 7.4.1517 +Problem: Compiler warning with 64bit compiler. +Solution: Add typecast. (Mike Williams) +Files: src/channel.c + +Patch 7.4.1518 +Problem: Channel with disconnected in/out/err is not supported. +Solution: Implement it for Unix. +Files: src/eval.c, src/os_unix.c, src/structs.h, + src/testdir/test_channel.vim, src/testdir/test_channel_pipe.py + +Patch 7.4.1519 (after 7.4.1514) +Problem: Channel output to file not implemented for MS-Windows. +Solution: Implement it. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1520 +Problem: Channel test: Waiting for a file to appear doesn't work. +Solution: In waitFor() ignore errors. +Files: src/testdir/test_channel.vim + +Patch 7.4.1521 (after 7.4.1516) +Problem: File permission test fails on MS-Windows. +Solution: Expect a different permission. +Files: src/testdir/test_file_perm.vim + +Patch 7.4.1522 +Problem: Cannot write channel err to a buffer. +Solution: Implement it. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1523 +Problem: Writing channel to a file fails on MS-Windows. +Solution: Disable it for now. +Files: src/testdir/test_channel.vim + +Patch 7.4.1524 +Problem: Channel test fails on BSD. +Solution: Break out of the loop when connect() succeeds. (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.1525 +Problem: On a high resolution screen the toolbar icons are too small. +Solution: Add "huge" and "giant" to 'toolbariconsize'. (Brian Gix) +Files: src/gui_gtk_x11.c, src/option.h + +Patch 7.4.1526 +Problem: Writing to file and not connecting a channel doesn't work for + MS-Windows. +Solution: Make it work. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1527 +Problem: Channel test is flaky on MS-Windows. +Solution: Limit the select() timeout to 50 msec and try with a new socket if + it fails. +Files: src/channel.c + +Patch 7.4.1528 +Problem: Using "ever" for packages is confusing. +Solution: Use "start", as it's related to startup. +Files: src/ex_cmds2.c, runtime/doc/repeat.txt + +Patch 7.4.1529 +Problem: Specifying buffer number for channel not implemented yet. +Solution: Implement passing a buffer number. +Files: src/structs.h, src/channel.c, src/eval.c, + src/testdir/test_channel.vim + +Patch 7.4.1530 +Problem: MS-Windows job_start() closes wrong handle. +Solution: Close hThread on the process info. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.1531 +Problem: Compiler warning for uninitialized variable. (Dominique Pelle) +Solution: Always give the variable a value. +Files: src/channel.c + +Patch 7.4.1532 +Problem: MS-Windows channel leaks file descriptor. +Solution: Use CreateFile with the right options. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1533 +Problem: Using feedkeys() with an empty string disregards 'x' option. +Solution: Make 'x' work with an empty string. (Thinca) +Files: src/eval.c, src/testdir/test_alot.vim, + src/testdir/test_feedkeys.vim + +Patch 7.4.1534 +Problem: Compiler warning for shadowed variable. (Kazunobu Kuriyama) +Solution: Rename it. +Files: src/eval.c + +Patch 7.4.1535 +Problem: The feedkeys test has a one second delay. +Solution: Avoid need_wait_return() to delay. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.1536 +Problem: Cannot re-use a channel for another job. +Solution: Add the "channel" option to job_start(). +Files: src/channel.c, src/eval.c, src/structs.h, src/os_unix.c, + src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1537 +Problem: Too many feature flags for pipes, jobs and channels. +Solution: Only use FEAT_JOB_CHANNEL. +Files: src/structs.h, src/feature.h, src/configure.in, + src/auto/configure, src/config.h.in, src/channel.c, src/eval.c, + src/gui.c, src/main.c, src/memline.c, src/misc2.c, src/os_mswin.c, + src/os_unix.c, src/os_win32.c, src/ui.c, src/version.c, + src/macros.h, src/proto.h, src/vim.h, src/Make_cyg_ming.mak, + src/Make_bc5.mak, src/Make_mvc.mak + +Patch 7.4.1538 +Problem: Selection with the mouse does not work in command line mode. +Solution: Use cairo functions. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1539 +Problem: Too much code in eval.c. +Solution: Move job and channel code to channel.c. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/proto/eval.pro + +Patch 7.4.1540 +Problem: Channel test is a bit flaky. +Solution: Increase expected wait time. +Files: src/testdir/test_channel.vim + +Patch 7.4.1541 +Problem: Missing job_info(). +Solution: Implement it. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1542 +Problem: job_start() with a list is not tested. +Solution: Call job_start() with a list. +Files: src/testdir/test_channel.vim + +Patch 7.4.1543 +Problem: Channel log methods are not tested. +Solution: Log job activity and check it. +Files: src/testdir/test_channel.vim + +Patch 7.4.1544 +Problem: On Win32 escaping the command does not work properly. +Solution: Reset 'ssl' when escaping the command. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1545 +Problem: GTK3: horizontal cursor movement in Visual selection not good. +Solution: Make it work better. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1546 +Problem: Sticky type checking is more annoying than useful. +Solution: Remove the error for changing a variable type. +Files: src/eval.c, src/testdir/test_assign.vim, + src/testdir/test_alot.vim, runtime/doc/eval.txt + +Patch 7.4.1547 +Problem: Getting a cterm highlight attribute that is not set results in the + string "-1". +Solution: Return an empty string. (Taro Muraoka) +Files: src/syntax.c, src/testdir/test_alot.vim, + src/testdir/test_syn_attr.vim + +Patch 7.4.1548 (after 7.4.1546) +Problem: Two tests fail. +Solution: Adjust the expected error number. Remove check for type. +Files: src/testdir/test101.ok, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.1549 (after 7.4.1547) +Problem: Test for syntax attributes fails in Win32 GUI. +Solution: Use an existing font name. +Files: src/testdir/test_syn_attr.vim + +Patch 7.4.1550 +Problem: Cannot load packages early. +Solution: Add the ":packloadall" command. +Files: src/ex_cmds.h, src/ex_cmds2.c, src/main.c, + src/proto/ex_cmds2.pro, src/testdir/test_packadd.vim + +Patch 7.4.1551 +Problem: Cannot generate help tags in all doc directories. +Solution: Make ":helptags ALL" work. +Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/ex_cmds.c, src/vim.h + src/testdir/test_packadd.vim + +Patch 7.4.1552 +Problem: ":colorscheme" does not use 'packpath'. +Solution: Also use in "start" and "opt" directories in 'packpath'. +Files: src/ex_cmds2.c, src/gui.c, src/hardcopy.c, src/os_mswin.c, + src/spell.c, src/tag.c, src/if_py_both.h, src/vim.h, + src/digraph.c, src/eval.c, src/ex_docmd.c, src/main.c, + src/option.c, src/syntax.c, src/testdir/test_packadd.vim + +Patch 7.4.1553 +Problem: ":runtime" does not use 'packpath'. +Solution: Add "what" argument. +Files: src/ex_cmds2.c, src/vim.h, runtime/doc/repeat.txt, + src/testdir/test_packadd.vim + +Patch 7.4.1554 +Problem: Completion for :colorscheme does not use 'packpath'. +Solution: Make it work, add a test. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_packadd.vim + +Patch 7.4.1555 +Problem: List of test targets incomplete. +Solution: Add newly added tests. +Files: src/Makefile + +Patch 7.4.1556 +Problem: "make install" changes the help tags file, causing it to differ + from the repository. +Solution: Move it aside and restore it. +Files: src/Makefile + +Patch 7.4.1557 +Problem: Windows cannot be identified. +Solution: Add a unique window number to each window and functions to use it. +Files: src/structs.h, src/window.c, src/eval.c, src/proto/eval.pro, + src/proto/window.pro, src/testdir/test_window_id.vim, + src/testdir/Make_all.mak, runtime/doc/eval.txt + +Patch 7.4.1558 +Problem: It is not easy to find out what windows display a buffer. +Solution: Add win_findbuf(). +Files: src/eval.c, src/window.c, src/proto/window.pro, + src/testdir/test_window_id.vim, runtime/doc/eval.txt + +Patch 7.4.1559 +Problem: Passing cookie to a callback is clumsy. +Solution: Change function() to take arguments and return a partial. +Files: src/structs.h, src/channel.c, src/eval.c, src/if_python.c, + src/if_python3.c, src/if_py_both.h, src/json.c, + src/proto/eval.pro, src/testdir/test_partial.vim, + src/testdir/test_alot.vim, runtime/doc/eval.txt + +Patch 7.4.1560 +Problem: Dict options with a dash are more difficult to use. +Solution: Use an underscore, so that dict.err_io can be used. +Files: src/channel.c, src/structs.h, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.1561 (after 7.4.1559) +Problem: Missing update to proto file. +Solution: Change the proto file. +Files: src/proto/channel.pro + +Patch 7.4.1562 +Problem: ":helptags ALL" crashes. (Lcd) +Solution: Don't free twice. +Files: src/ex_cmds.c + +Patch 7.4.1563 +Problem: Partial test fails on windows. +Solution: Return 1 or -1 from compare function. +Files: src/testdir/test_partial.vim + +Patch 7.4.1564 +Problem: An empty list in function() causes an error. +Solution: Handle an empty list like there is no list of arguments. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1565 +Problem: Crash when assert_equal() runs into a NULL string. +Solution: Check for NULL. (Dominique) Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1566 +Problem: Compiler warning for shadowed variable. (Kazunobu Kuriyama) +Solution: Remove the inner one. +Files: src/eval.c + +Patch 7.4.1567 +Problem: Crash in assert_fails(). +Solution: Check for NULL. (Dominique Pelle) Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1568 +Problem: Using CTRL-] in help on option in parentheses doesn't work. +Solution: Skip the "(" in "('". (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.1569 +Problem: Using old style tests for quickfix. +Solution: Change them to new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test106.in, + src/testdir/test106.ok, src/testdir/test_qf_title.in, + src/testdir/test_qf_title.ok, src/testdir/test_quickfix.vim + +Patch 7.4.1570 +Problem: There is no way to avoid the message when editing a file. +Solution: Add the "F" flag to 'shortmess'. (Shougo Matsu, closes #686) +Files: runtime/doc/options.txt, src/buffer.c, src/ex_cmds.c, + src/option.h + +Patch 7.4.1571 +Problem: No test for ":help". +Solution: Add a test for what 7.4.1568 fixed. (Hirohito Higashi) +Files: src/testdir/test_alot.vim, src/testdir/test_help_tagjump.vim + +Patch 7.4.1572 +Problem: Setting 'compatible' in test influences following tests. +Solution: Turn 'compatible' off again. +Files: src/testdir/test_backspace_opt.vim + +Patch 7.4.1573 +Problem: Tests get stuck at the more prompt. +Solution: Move the backspace test out of test_alot. +Files: src/testdir/test_alot.vim, src/testdir/Make_all.mak + +Patch 7.4.1574 +Problem: ":undo 0" does not work. (Florent Fayolle) +Solution: Make it undo all the way. (closes #688) +Files: src/undo.c, src/testdir/test_undolevels.vim, + src/testdir/test_ex_undo.vim, src/testdir/test_alot.vim + +Patch 7.4.1575 +Problem: Using wrong size for struct. +Solution: Use the size for wide API. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.1576 +Problem: Write error of viminfo file is not handled properly. (Christian + Neukirchen) +Solution: Check the return value of fclose(). (closes #682) +Files: src/ex_cmds.c + +Patch 7.4.1577 +Problem: Cannot pass "dict.Myfunc" around as a partial. +Solution: Create a partial when expected. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1578 +Problem: There is no way to invoke a function later or periodically. +Solution: Add timer support. +Files: src/eval.c, src/ex_cmds2.c, src/screen.c, src/ex_docmd.c, + src/feature.h, src/gui.c, src/proto/eval.pro, + src/proto/ex_cmds2.pro, src/proto/screen.pro, src/structs.h, + src/version.c, src/testdir/test_alot.vim, + src/testdir/test_timers.vim, runtime/doc/eval.txt + +Patch 7.4.1579 (after 7.4.1578) +Problem: Missing changes in channel.c +Solution: Include the changes. +Files: src/channel.c + +Patch 7.4.1580 +Problem: Crash when using function reference. (Luchr) +Solution: Set initial refcount. (Ken Takata, closes #690) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1581 +Problem: Using ":call dict.func()" where the function is a partial does + not work. Using "dict.func()" where the function does not take a + Dictionary does not work. +Solution: Handle partial properly in ":call". (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_partial.vim, src/testdir/test55.ok + +Patch 7.4.1582 +Problem: Get E923 when using function(dict.func, [], dict). (Kent Sibilev) + Storing a function with a dict in a variable drops the dict if the + function is script-local. +Solution: Translate the function name. Use dict arg if present. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1583 +Problem: Warning for uninitialized variable. +Solution: Initialize it. (Dominique) +Files: src/ex_cmds2.c + +Patch 7.4.1584 +Problem: Timers don't work for Win32 console. +Solution: Add check_due_timer() in WaitForChar(). +Files: src/os_win32.c + +Patch 7.4.1585 +Problem: Partial is not recognized everywhere. +Solution: Check for partial in trans_function_name(). (Yasuhiro Matsumoto) + Add a test. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1586 +Problem: Nesting partials doesn't work. +Solution: Append arguments. (Ken Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1587 +Problem: Compiler warnings with 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/ex_cmds2.c + +Patch 7.4.1588 +Problem: Old style test for quickfix. +Solution: Turn test 96 into a new style test. +Files: src/testdir/Make_all.mak, src/testdir/test96.in, + src/testdir/test96.ok, src/testdir/test_quickfix.vim + +Patch 7.4.1589 +Problem: Combining dict and args with partial doesn't always work. +Solution: Use the arguments from the partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1590 +Problem: Warning for shadowed variable. (Christian Brabandt) +Solution: Move the variable into a local block. +Files: src/eval.c + +Patch 7.4.1591 +Problem: The quickfix title is truncated. +Solution: Save the command before it is truncated. (Anton Lindqvist) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1592 +Problem: Quickfix code using memory after being freed. (Dominique Pelle) +Solution: Detect that the window was closed. (Hirohito Higashi) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1593 +Problem: Using channel timeout instead of request timeout. (Coverity) +Solution: Remove the extra assignment. +Files: src/channel.c + +Patch 7.4.1594 +Problem: Timers don't work on Unix. +Solution: Add missing code. +Files: src/os_unix.c + +Patch 7.4.1595 +Problem: Not checking for failed open(). (Coverity) +Solution: Check file descriptor not being negative. +Files: src/os_unix.c + +Patch 7.4.1596 +Problem: Memory leak. (Coverity) +Solution: Free the pattern. +Files: src/ex_cmds2.c + +Patch 7.4.1597 +Problem: Memory leak when out of memory. (Coverity) +Solution: Free the name. +Files: src/eval.c + +Patch 7.4.1598 +Problem: When starting the GUI fails a swap file is left behind. (Joerg + Plate) +Solution: Preserve files before exiting. (closes #692) +Files: src/main.c, src/gui.c + +Patch 7.4.1599 +Problem: No link to Coverity. +Solution: Add Coverity badge in README. +Files: README.md + +Patch 7.4.1600 +Problem: libs directory is not useful. +Solution: Remove arp.library, it was only for very old Amiga versions. +Files: libs/arp.library, Filelist + +Patch 7.4.1601 +Problem: README files take a lot of space in the top directory. +Solution: Move most of them to "READMEdir". +Files: Filelist, Makefile, README.txt.info, README_ami.txt, + README_ami.txt.info, README_amibin.txt, README_amibin.txt.info, + README_amisrc.txt, README_amisrc.txt.info, README_bindos.txt, + README_dos.txt, README_extra.txt, README_mac.txt, README_ole.txt, + README_os2.txt, README_os390.txt, README_src.txt, + README_srcdos.txt, README_unix.txt, README_vms.txt, + README_w32s.txt, READMEdir/README.txt.info, + READMEdir/README_ami.txt, READMEdir/README_ami.txt.info, + READMEdir/README_amibin.txt, READMEdir/README_amibin.txt.info, + READMEdir/README_amisrc.txt, READMEdir/README_amisrc.txt.info, + READMEdir/README_bindos.txt, READMEdir/README_dos.txt, + READMEdir/README_extra.txt, READMEdir/README_mac.txt, + READMEdir/README_ole.txt, READMEdir/README_os2.txt, + READMEdir/README_os390.txt, READMEdir/README_src.txt, + READMEdir/README_srcdos.txt, READMEdir/README_unix.txt, + READMEdir/README_vms.txt, READMEdir/README_w32s.txt, + +Patch 7.4.1602 +Problem: Info files take space in the top directory. +Solution: Move them to "READMEdir". +Files: Filelist, src.info, Contents.info, runtime.info, vimdir.info, + Vim.info, Xxd.info, READMEdir/src.info, READMEdir/Contents.info, + READMEdir/runtime.info, READMEdir/vimdir.info, READMEdir/Vim.info, + READMEdir/Xxd.info + +Patch 7.4.1603 +Problem: Timer with an ":echo" command messes up display. +Solution: Redraw depending on the mode. (Hirohito Higashi) Avoid the more + prompt being used recursively. +Files: src/screen.c, src/message.c + +Patch 7.4.1604 +Problem: Although emoji characters are ambiguous width, best is to treat + them as full width. +Solution: Update the Unicode character tables. Add the 'emoji' options. + (Yasuhiro Matsumoto) +Files: runtime/doc/options.txt, runtime/optwin.vim, + runtime/tools/unicode.vim, src/mbyte.c, src/option.c, src/option.h + +Patch 7.4.1605 +Problem: Catching exception that won't be thrown. +Solution: Remove try/catch. +Files: src/testdir/test55.in + +Patch 7.4.1606 +Problem: Having type() handle a Funcref that is or isn't a partial + differently causes problems for existing scripts. +Solution: Make type() return the same value. (Thinca) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1607 +Problem: Comparing a function that exists on two dicts is not backwards + compatible. (Thinca) +Solution: Only compare the function, not what the partial adds. +Files: src/eval.c, src/testdir/test_alot.vim, src/testdir/test_expr.vim + +Patch 7.4.1608 +Problem: string() doesn't handle a partial. +Solution: Make a string from a partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1609 +Problem: Contents file is only for Amiga distro. +Solution: Move it to "READMEdir". Update some info. +Files: Filelist, Contents, READMEdir/Contents + +Patch 7.4.1610 +Problem: Compiler warnings for non-virtual destructor. +Solution: Mark the classes final. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/gui_dwrite.cpp, src/if_ole.cpp + +Patch 7.4.1611 +Problem: The versplit feature makes the code unnecessary complicated. +Solution: Remove FEAT_VERTSPLIT, always support vertical splits when + FEAT_WINDOWS is defined. +Files: src/buffer.c, src/charset.c, src/eval.c, src/ex_cmds.c, + src/ex_docmd.c, src/ex_getln.c, src/gui.c, src/if_lua.c, + src/if_mzsch.c, src/if_ruby.c, src/main.c, src/misc1.c, + src/misc2.c, src/move.c, src/normal.c, src/option.c, + src/quickfix.c, src/screen.c, src/syntax.c, src/term.c, src/ui.c, + src/window.c, src/globals.h, src/gui.h, src/if_py_both.h, + src/option.h, src/structs.h, src/term.h + src/feature.h, src/vim.h, src/version.c + +Patch 7.4.1612 (after 7.4.1611) +Problem: Can't build with small features. +Solution: Move code and #ifdefs. +Files: src/ex_getln.c + +Patch 7.4.1613 (after 7.4.1612) +Problem: Still can't build with small features. +Solution: Adjust #ifdefs. +Files: src/ex_getln.c + +Patch 7.4.1614 +Problem: Still quickfix test in old style. +Solution: Turn test 10 into a new style test. +Files: src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test10.in, + src/testdir/test10.ok, src/testdir/test_quickfix.vim, + src/testdir/test10a.in, src/testdir/test10a.ok + +Patch 7.4.1615 +Problem: Build fails with tiny features. +Solution: Adjust #ifdefs. +Files: src/normal.c, src/window.c + +Patch 7.4.1616 +Problem: Malformed channel request causes a hang. +Solution: Drop malformed message. (Damien) +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1617 +Problem: When a JSON message is split it isn't decoded. +Solution: Wait a short time for the rest of the message to arrive. +Files: src/channel.c, src/json.c, src/structs.h, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1618 +Problem: Starting job with output to buffer changes options in the current + buffer. +Solution: Set "curbuf" earlier. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1619 +Problem: When 'fileformats' is set in the vimrc it applies to new buffers + but not the initial buffer. +Solution: Set 'fileformat' when starting up. (Mike Williams) +Files: src/option.c + +Patch 7.4.1620 +Problem: Emoji characters are not considered as a kind of word character. +Solution: Give emoji characters a word class number. (Yasuhiro Matsumoto) +Files: src/mbyte.c + +Patch 7.4.1621 +Problem: Channel test doesn't work with Python 2.6. +Solution: Add number in formatting placeholder. (Wiredool) +Files: src/testdir/test_channel.py + +Patch 7.4.1622 +Problem: Channel demo doesn't work with Python 2.6. +Solution: Add number in formatting placeholder +Files: runtime/tools/demoserver.py + +Patch 7.4.1623 +Problem: All Channels share the message ID, it keeps getting bigger. +Solution: Use a message ID per channel. +Files: src/channel.c, src/proto/channel.pro, src/structs.h + +Patch 7.4.1624 +Problem: Can't get info about a channel. +Solution: Add ch_info(). +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1625 +Problem: Trying to close file descriptor that isn't open. +Solution: Check for negative number. +Files: src/os_unix.c + +Patch 7.4.1626 (after 7.4.1624) +Problem: Missing changes to structs. +Solution: Include the changes. +Files: src/structs.h + +Patch 7.4.1627 +Problem: Channel out_cb and err_cb are not tested. +Solution: Add a test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1628 +Problem: 64-bit Compiler warning. +Solution: Change type of variable. (Mike Williams) +Files: src/channel.c + +Patch 7.4.1629 +Problem: Handling emoji characters as full width has problems with + backwards compatibility. +Solution: Remove ambiguous and double width characters from the emoji table. + Use a separate table for the character class. + (partly by Yasuhiro Matsumoto) +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.1630 +Problem: Unicode table for double width is outdated. +Solution: Update to the latest Unicode standard. +Files: src/mbyte.c + +Patch 7.4.1631 +Problem: Compiler doesn't understand switch on all enum values. (Tony + Mechelynck) +Solution: Initialize variable. +Files: src/channel.c + +Patch 7.4.1632 +Problem: List of test targets is outdated. +Solution: Update to current list of test targets. +Files: src/Makefile + +Patch 7.4.1633 +Problem: If the help tags file was removed "make install" fails. (Tony + Mechelynck) +Solution: Only try moving the file if it exists. +Files: src/Makefile + +Patch 7.4.1634 +Problem: Vertical movement after CTRL-A ends up in the wrong column. + (Urtica Dioica) +Solution: Set curswant when appropriate. (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_increment.vim + +Patch 7.4.1635 +Problem: Channel test is a bit flaky. +Solution: Remove 'DETACH' if it's there. +Files: src/testdir/test_channel.vim + +Patch 7.4.1636 +Problem: When 'F' is in 'shortmess' the prompt for the encryption key isn't + displayed. (Toothpik) +Solution: Reset msg_silent. +Files: src/ex_getln.c + +Patch 7.4.1637 +Problem: Can't build with older MinGW compiler. +Solution: Change option from c++11 to gnu++11. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1638 +Problem: When binding a function to a dict the reference count is wrong. +Solution: Decrement dict reference count, only reference the function when + actually making a copy. (Ken Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1639 +Problem: Invoking garbage collection may cause a double free. +Solution: Don't free the dict in a partial when recursive is FALSE. +Files: src/eval.c + +Patch 7.4.1640 +Problem: Crash when an autocommand changes a quickfix list. (Dominique) +Solution: Check whether an entry is still valid. (Yegappan Lakshmanan, + Hirohito Higashi) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1641 +Problem: Using unterminated string. +Solution: Add NUL before calling vim_strsave_shellescape(). (James McCoy) +Files: src/eval.c, src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.1642 +Problem: Handling emoji characters as full width has problems with + backwards compatibility. +Solution: Only put characters in the 1f000 range in the emoji table. +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.1643 (after 7.4.1641) +Problem: Terminating file name has side effects. +Solution: Restore the character. (mostly by James McCoy, closes #713) +Files: src/eval.c, src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.1644 +Problem: Using string() on a partial that exists in the dictionary it binds + results in an error. (Nikolai Pavlov) +Solution: Make string() not fail on a recursively nested structure. (Ken + Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1645 +Problem: When a dict contains a partial it can't be redefined as a + function. (Nikolai Pavlov) +Solution: Remove the partial when overwriting with a function. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1646 +Problem: Using Python vim.bindeval() on a partial doesn't work. (Nikolai + Pavlov) +Solution: Add VAR_PARTIAL support in Python. +Files: src/if_py_both.h, src/testdir/test_partial.vim + +Patch 7.4.1647 +Problem: Using freed memory after setqflist() and ":caddbuffer". (Dominique) +Solution: Set qf_ptr when adding the first item to the quickfix list. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1648 +Problem: Compiler has a problem copying a string into di_key[]. (Yegappan + Lakshmanan) +Solution: Add dictitem16_T. +Files: src/structs.h, src/eval.c + +Patch 7.4.1649 +Problem: The matchit plugin needs to be copied to be used. +Solution: Put the matchit plugin in an optional package. +Files: Filelist, runtime/macros/matchit.vim, runtime/macros/matchit.txt, + runtime/macros/README.txt, src/Makefile, + runtime/pack/dist/opt/matchit/plugin/matchit.vim, + runtime/pack/dist/opt/matchit/doc/matchit.txt, + runtime/pack/dist/opt/matchit/doc/tags, + runtime/doc/usr_05.txt, runtime/doc/usr_toc.txt + +Patch 7.4.1650 +Problem: Quickfix test fails. +Solution: Accept any number of matches. +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1651 +Problem: Some dead (MSDOS) code remains. +Solution: Remove the unused lines. (Ken Takata) +Files: src/misc1.c + +Patch 7.4.1652 +Problem: Old style test for fnamemodify(). +Solution: Turn it into a new style test. +Files: src/testdir/test105.in, src/testdir/test105.ok, + src/testdir/test_fnamemodify.vim, src/testdir/test_alot.vim, + src/testdir/Make_all.mak + +Patch 7.4.1653 (after 7.4.1649) +Problem: Users who loaded matchit.vim manually have to change their + startup. (Gary Johnson) +Solution: Add a file in the old location that loads the package. +Files: runtime/macros/matchit.vim, Filelist + +Patch 7.4.1654 +Problem: Crash when using expand('%:S') in a buffer without a name. +Solution: Don't set a NUL. (James McCoy, closes #714) +Files: src/eval.c, src/testdir/test_fnamemodify.vim + +Patch 7.4.1655 +Problem: remote_expr() hangs. (Ramel) +Solution: Check for messages in the waiting loop. +Files: src/if_xcmdsrv.c + +Patch 7.4.1656 +Problem: Crash when using partial with a timer. +Solution: Increment partial reference count. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_timers.vim + +Patch 7.4.1657 +Problem: On Unix in a terminal: channel messages are not handled right away. + (Jackson Alves de Aquino) +Solution: Break the loop for timers when something was received. +Files: src/os_unix.c + +Patch 7.4.1658 +Problem: A plugin does not know when VimEnter autocommands were already + triggered. +Solution: Add the v:vim_did_enter variable. +Files: src/eval.c, src/main.c, src/vim.h, src/testdir/test_autocmd.vim, + src/testdir/test_alot.vim, runtime/doc/autocmd.txt, + runtime/doc/eval.txt + +Patch 7.4.1659 (after 7.4.1657) +Problem: Compiler warning for argument type. (Manuel Ortega) +Solution: Remove "&". +Files: src/os_unix.c + +Patch 7.4.1660 +Problem: has('patch-7.4.1') doesn't work. +Solution: Fix off-by-one error. (Thinca) +Files: src/eval.c, src/testdir/test_expr.vim, src/testdir/test60.in, + src/testdir/test60.ok + +Patch 7.4.1661 +Problem: No test for special characters in channel eval command. +Solution: Testing sending and receiving text with special characters. +Files: src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1662 +Problem: No test for an invalid Ex command on a channel. +Solution: Test handling an invalid command gracefully. Avoid getting an + error message, do write it to the channel log. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1663 +Problem: In tests it's often useful to check if a pattern matches. +Solution: Add assert_match(). +Files: src/eval.c, src/testdir/test_assert.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1664 +Problem: Crash in :cgetexpr. +Solution: Check for NULL pointer. (Dominique) Add a test. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1665 +Problem: Crash when calling job_start() with a NULL string. (Dominique) +Solution: Check for an invalid argument. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1666 +Problem: When reading JSON from a channel all readahead is used. +Solution: Use the fill function to reduce overhead. +Files: src/channel.c, src/json.c, src/structs.h + +Patch 7.4.1667 +Problem: Win32: waiting on a pipe with fixed sleep time. +Solution: Start with a short delay and increase it when looping. +Files: src/channel.c + +Patch 7.4.1668 +Problem: channel_get_all() does multiple allocations. +Solution: Compute the size and allocate once. +Files: src/channel.c + +Patch 7.4.1669 +Problem: When writing buffer lines to a pipe Vim may block. +Solution: Avoid blocking, write more lines later. +Files: src/channel.c, src/misc2.c, src/os_unix.c, src/structs.h, + src/vim.h, src/proto/channel.pro, src/testdir/test_channel.vim + +Patch 7.4.1670 +Problem: Completion doesn't work well for a variable containing "#". +Solution: Recognize the "#". (Watiko) +Files: src/eval.c + +Patch 7.4.1671 +Problem: When help exists in multiple languages, adding @ab while "ab" is + the default help language is unnecessary. +Solution: Leave out "@ab" when not needed. (Ken Takata) +Files: src/ex_getln.c + +Patch 7.4.1672 +Problem: The Dvorak support is a bit difficult to install. +Solution: Turn it into an optional package. +Files: runtime/macros/dvorak, runtime/macros/README.txt, + runtime/pack/dist/opt/dvorak/plugin/dvorak.vim, + runtime/pack/dist/opt/dvorak/dvorak/enable.vim, + runtime/pack/dist/opt/dvorak/dvorak/disable.vim + +Patch 7.4.1673 +Problem: The justify plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/justify.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/justify/plugin/justify.vim, Filelist + +Patch 7.4.1674 +Problem: The editexisting plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/editexisting.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/editexisting/plugin/editexisting.vim, + Filelist + +Patch 7.4.1675 +Problem: The swapmous plugin has to be copied or sourced to be used. +Solution: Turn it into the swapmouse package. +Files: runtime/macros/swapmous.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim, Filelist + +Patch 7.4.1676 +Problem: The shellmenu plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/shellmenu.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim, Filelist + +Patch 7.4.1677 +Problem: A reference to the removed file_select plugin remains. +Solution: Remove it. +Files: runtime/macros/README.txt + +Patch 7.4.1678 +Problem: Warning for unused argument. +Solution: Add UNUSED. (Dominique Pelle) +Files: src/if_mzsch.c + +Patch 7.4.1679 +Problem: Coverity: copying value of v_lock without initializing it. +Solution: Init v_lock in rettv_list_alloc() and rettv_dict_alloc(). +Files: src/eval.c + +Patch 7.4.1680 +Problem: Coverity warns for not checking name length (false positive). +Solution: Only copy the characters we know are there. +Files: src/channel.c + +Patch 7.4.1681 +Problem: Coverity warns for fixed size buffer length (false positive). +Solution: Add a check for the name length. +Files: src/eval.c + +Patch 7.4.1682 +Problem: Coverity: no check for NULL. +Solution: Add check for invalid argument to assert_match(). +Files: src/eval.c + +Patch 7.4.1683 +Problem: Generated .bat files do not support --nofork. +Solution: Add check for --nofork. Also add "setlocal". (Kevin Cantú, + closes #659) +Files: src/dosinst.c + +Patch 7.4.1684 +Problem: README text is slightly outdated. +Solution: Mention the READMEdir directory. +Files: README.md, README.txt + +Patch 7.4.1685 +Problem: There is no easy way to get all the information about a match. +Solution: Add matchstrpos(). (Ozaki Kiichi) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/testdir/test_alot.vim, src/testdir/test_matchstrpos.vim + +Patch 7.4.1686 +Problem: When running tests $HOME/.viminfo is written. (James McCoy) +Solution: Add 'nviminfo' to the 'viminfo' option. (closes #722) +Files: src/testdir/test_backspace_opt.vim, src/testdir/test_viminfo.vim, + src/testdir/runtest.vim. + +Patch 7.4.1687 +Problem: The channel close_cb option does not work. +Solution: Use jo_close_partial instead of jo_err_partial. (Damien) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1688 +Problem: MzScheme does not support partial. +Solution: Add minimal partial support. (Ken Takata) +Files: src/if_mzsch.c + +Patch 7.4.1689 +Problem: Ruby interface has inconsistent coding style. +Solution: Fix the coding style. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.1690 +Problem: Can't compile with the conceal feature but without multi-byte. +Solution: Adjust #ifdef. (Owen Leibman) +Files: src/eval.c, src/window.c + +Patch 7.4.1691 +Problem: When switching to a new buffer and an autocommand applies syntax + highlighting an ml_get error may occur. +Solution: Check "syn_buf" against the buffer in the window. (Alexander von + Buddenbrock, closes #676) +Files: src/syntax.c + +Patch 7.4.1692 +Problem: feedkeys('i', 'x') gets stuck, waits for a character to be typed. +Solution: Behave like ":normal". (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_feedkeys.vim + +Patch 7.4.1693 +Problem: Building the Perl interface gives compiler warnings. +Solution: Remove a pragma. Add noreturn attributes. (Damien) +Files: src/if_perl.xs + +Patch 7.4.1694 +Problem: Win32 gvim doesn't work with "dvorakj" input method. +Solution: Wait for QS_ALLINPUT instead of QS_ALLEVENTS. (Yukihiro Nakadaira) +Files: src/gui_w32.c + +Patch 7.4.1695 +Problem: ":syn reset" clears the effect ":syn iskeyword". (James McCoy) +Solution: Remove clearing the syntax keywords. +Files: src/syntax.c + +Patch 7.4.1696 +Problem: When using :stopinsert in a silent mapping the "INSERT" message + isn't cleared. (Coacher) +Solution: Always clear the message. (Christian Brabandt, closes #718) +Files: src/ex_docmd.c, src/proto/screen.pro, src/screen.c + +Patch 7.4.1697 +Problem: Display problems when the 'ambiwidth' and 'emoji' options are not + set properly or the terminal doesn't behave as expected. +Solution: After drawing an ambiguous width character always position the + cursor. +Files: src/mbyte.c, src/screen.c, src/proto/mbyte.pro + +Patch 7.4.1698 +Problem: Two tests fail when running tests with MinGW. (Michael Soyka) +Solution: Convert test_getcwd.ok test_wordcount.ok to unix fileformat. +Files: src/testdir/Make_ming.mak + +Patch 7.4.1699 +Problem: :packadd does not work the same when used early or late. +Solution: Always load plugins matching "plugin/**/*.vim". +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1700 +Problem: Equivalence classes are not properly tested. +Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman) +Files: src/regexp.c, src/testdir/Make_all.mak, + src/testdir/test_alot_latin.vim, src/testdir/test_alot_utf8.vim, + src/testdir/test_regexp_latin.vim, + src/testdir/test_regexp_utf8.vim + +Patch 7.4.1701 +Problem: Equivalence classes still tested in old style tests. +Solution: Remove the duplicate. +Files: src/testdir/test44.in, src/testdir/test44.ok, + src/testdir/test99.in, src/testdir/test99.ok + +Patch 7.4.1702 +Problem: Using freed memory when parsing 'printoptions' fails. +Solution: Save the old options and restore them in case of an error. + (Dominique) +Files: src/hardcopy.c, src/testdir/test_hardcopy.vim + +Patch 7.4.1703 +Problem: Can't assert for not equal and not matching. +Solution: Add assert_notmatch() and assert_notequal(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_assert.vim + +Patch 7.4.1704 +Problem: Using freed memory with "wincmd p". (Dominique Pelle) +Solution: Also clear "prevwin" in other tab pages. +Files: src/window.c + +Patch 7.4.1705 +Problem: The 'guifont' option does not allow for a quality setting. +Solution: Add the "q" item, supported on MS-Windows. (Yasuhiro Matsumoto) +Files: runtime/doc/options.txt, src/gui_w32.c, src/os_mswin.c, + src/proto/os_mswin.pro + +Patch 7.4.1706 +Problem: Old style function declaration breaks build. +Solution: Remove __ARGS(). +Files: src/proto/os_mswin.pro + +Patch 7.4.1707 +Problem: Cannot use empty dictionary key, even though it can be useful. +Solution: Allow using an empty dictionary key. +Files: src/hashtab.c, src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1708 +Problem: New regexp engine does not work properly with EBCDIC. +Solution: Define equivalence class characters. (Owen Leibman) +Files: src/regexp_nfa.c + +Patch 7.4.1709 +Problem: Mistake in #ifdef. +Solution: Change PROOF_QUALITY to DRAFT_QUALITY. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.1710 +Problem: Not all output of an external command is read. +Solution: Avoid timing out when the process has exited. (closes #681) +Files: src/os_unix.c + +Patch 7.4.1711 +Problem: When using try/catch in 'statusline' it is still considered an + error and the status line will be disabled. +Solution: Check did_emsg instead of called_emsg. (haya14busa, closes #729) +Files: src/screen.c, src/testdir/test_statusline.vim, + src/testdir/test_alot.vim + +Patch 7.4.1712 +Problem: For plugins in packages, plugin authors need to take care of all + dependencies. +Solution: When loading "start" packages and for :packloadall, first add all + directories to 'runtimepath' before sourcing plugins. +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1713 +Problem: GTK GUI doesn't work on Wayland. +Solution: Specify that only the X11 backend is allowed. (Simon McVittie) +Files: src/gui_gtk_x11.c + +Patch 7.4.1714 +Problem: Non-GUI specific settings in the gvimrc_example file. +Solution: Move some settings to the vimrc_example file. Remove setting + 'hlsearch' again. (suggested by Hirohito Higashi) +Files: runtime/vimrc_example.vim, runtime/gvimrc_example.vim + +Patch 7.4.1715 +Problem: Double free when a partial is in a cycle with a list or dict. + (Nikolai Pavlov) +Solution: Do not free a nested list or dict used by the partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1716 +Problem: 'autochdir' doesn't work for the first file. (Rob Hoelz) +Solution: Call DO_AUTOCHDIR after startup. (Christian Brabandt, closes #704) +Files: src/main.c + +Patch 7.4.1717 +Problem: Leaking memory when opening a channel fails. +Solution: Unreference partials in job options. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1718 +Problem: Coverity: not using return value of set_ref_in_item(). +Solution: Use the return value. +Files: src/eval.c + +Patch 7.4.1719 +Problem: Leaking memory when there is a cycle involving a job and a + partial. +Solution: Add a copyID to job and channel. Set references in items referred + by them. Go through all jobs and channels to find unreferenced + items. Also, decrement reference counts when garbage collecting. +Files: src/eval.c, src/channel.c, src/netbeans.c, src/globals.h, + src/ops.c, src/regexp.c, src/tag.c, src/proto/channel.pro, + src/proto/eval.pro, src/testdir/test_partial.vim, src/structs.h + +Patch 7.4.1720 +Problem: Tests fail without the job feature. +Solution: Skip tests when the job feature is not present. +Files: src/testdir/test_partial.vim + +Patch 7.4.1721 +Problem: The vimtbar files are unused. +Solution: Remove them. (Ken Takata) +Files: src/vimtbar.dll, src/vimtbar.h, src/vimtbar.lib, Filelist + +Patch 7.4.1722 +Problem: Crash when calling garbagecollect() after starting a job. +Solution: Set the copyID on job and channel. (Hirohito Higashi, Ozaki + Kiichi) +Files: src/eval.c + +Patch 7.4.1723 +Problem: When using try/catch in 'tabline' it is still considered an + error and the tabline will be disabled. +Solution: Check did_emsg instead of called_emsg. (haya14busa, closes #746) +Files: src/screen.c, src/testdir/test_tabline.vim, + src/testdir/test_alot.vim + +Patch 7.4.1724 (after 7.4.1723) +Problem: Tabline test fails in GUI. +Solution: Remove 'e' from 'guioptions'. +Files: src/testdir/test_tabline.vim + +Patch 7.4.1725 +Problem: Compiler errors for non-ANSI compilers. +Solution: Remove // comment. Remove comma at end of enum. (Michael Jarvis) +Files: src/eval.c + +Patch 7.4.1726 +Problem: ANSI compiler complains about string length. +Solution: Split long string in two parts. (Michael Jarvis) +Files: src/ex_cmds.c + +Patch 7.4.1727 +Problem: Cannot detect a crash in tests when caused by garbagecollect(). +Solution: Add garbagecollect_for_testing(). Do not free a job if is still + useful. +Files: src/channel.c, src/eval.c, src/getchar.c, src/main.c, src/vim.h, + src/proto/eval.pro, src/testdir/runtest.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1728 +Problem: The help for functions require a space after the "(". +Solution: Make CTRL-] on a function name ignore the arguments. (Hirohito + Higashi) +Files: src/ex_cmds.c, src/testdir/test_help_tagjump.vim, + runtime/doc/eval.txt + +Patch 7.4.1729 +Problem: The Perl interface cannot use 'print' operator for writing + directly in standard IO. +Solution: Add a minimal implementation of PerlIO Layer feature and try to + use it for STDOUT/STDERR. (Damien) +Files: src/if_perl.xs, src/testdir/test_perl.vim + +Patch 7.4.1730 +Problem: It is not easy to get a character out of a string. +Solution: Add strgetchar() and strcharpart(). +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1731 +Problem: Python: turns partial into simple funcref. +Solution: Use partials like partials. (Nikolai Pavlov, closes #734) +Files: runtime/doc/if_pyth.txt, src/eval.c, src/if_py_both.h, + src/if_python.c, src/if_python3.c, src/proto/eval.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.1732 +Problem: Folds may close when using autocomplete. (Anmol Sethi) +Solution: Increment/decrement disable_fold. (Christian Brabandt, closes + #643) +Files: src/edit.c, src/fold.c, src/globals.h + +Patch 7.4.1733 +Problem: "make install" doesn't know about cross-compiling. (Christian + Neukirchen) +Solution: Add CROSS_COMPILING. (closes #740) +Files: src/configure.in, src/auto/configure, src/config.mk.in, + src/Makefile + +Patch 7.4.1734 (after 7.4.1730) +Problem: Test fails when not using utf-8. +Solution: Split test in regular and utf-8 part. +Files: src/testdir/test_expr.vim, src/testdir/test_expr_utf8.vim, + src/testdir/test_alot_utf8.vim + +Patch 7.4.1735 +Problem: It is not possible to only see part of the message history. It is + not possible to clear messages. +Solution: Add a count to ":messages" and a clear argument. (Yasuhiro + Matsumoto) +Files: runtime/doc/message.txt, src/ex_cmds.h, src/message.c, + src/testdir/test_messages.vim, src/testdir/test_alot.vim + +Patch 7.4.1736 (after 7.4.1731) +Problem: Unused variable. +Solution: Remove it. (Yasuhiro Matsumoto) +Files: src/if_py_both.h + +Patch 7.4.1737 +Problem: Argument marked as unused is used. +Solution: Remove UNUSED. +Files: src/message.c + +Patch 7.4.1738 +Problem: Count for ":messages" depends on number of lines. +Solution: Add ADDR_OTHER address type. +Files: src/ex_cmds.h + +Patch 7.4.1739 +Problem: Messages test fails on MS-Windows. +Solution: Adjust the asserts. Skip the "messages maintainer" line if not + showing all messages. +Files: src/message.c, src/testdir/test_messages.vim + +Patch 7.4.1740 +Problem: syn-cchar defined with matchadd() does not appear if there are no + other syntax definitions which matches buffer text. +Solution: Check for startcol. (Ozaki Kiichi, haya14busa, closes #757) +Files: src/screen.c, src/testdir/Make_all.mak, + src/testdir/test_alot_utf8.vim, src/testdir/test_match_conceal.in, + src/testdir/test_match_conceal.ok, + src/testdir/test_matchadd_conceal.vim, + src/testdir/test_matchadd_conceal_utf8.vim, + src/testdir/test_undolevels.vim + +Patch 7.4.1741 +Problem: Not testing utf-8 characters. +Solution: Move the right asserts to the test_expr_utf8 test. +Files: src/testdir/test_expr.vim, src/testdir/test_expr_utf8.vim + +Patch 7.4.1742 +Problem: strgetchar() does not work correctly. +Solution: use mb_cptr2len(). Add a test. (Naruhiko Nishino) +Files: src/eval.c, src/testdir/test_expr_utf8.vim + +Patch 7.4.1743 +Problem: Clang warns for uninitialized variable. (Michael Jarvis) +Solution: Initialize it. +Files: src/if_py_both.h + +Patch 7.4.1744 +Problem: Python: Converting a sequence may leak memory. +Solution: Decrement a reference. (Nikolai Pavlov) +Files: src/if_py_both.h + +Patch 7.4.1745 +Problem: README file is not clear about where to get Vim. +Solution: Add links to github, releases and the Windows installer. + (Suggested by Christian Brabandt) +Files: README.md, README.txt + +Patch 7.4.1746 +Problem: Memory leak in Perl. +Solution: Decrement the reference count. Add a test. (Damien) +Files: src/if_perl.xs, src/testdir/test_perl.vim + +Patch 7.4.1747 +Problem: Coverity: missing check for NULL pointer. +Solution: Check for out of memory. +Files: src/if_py_both.h + +Patch 7.4.1748 +Problem: "gD" does not find match in first column of first line. (Gary + Johnson) +Solution: Accept match at the cursor. +Files: src/normal.c, src/testdir/test_goto.vim, src/testdir/test_alot.vim + +Patch 7.4.1749 +Problem: When using GTK 3.20 there are a few warnings. +Solution: Use new functions when available. (Kazunobu Kuriyama) +Files: src/gui_beval.c src/gui_gtk_x11.c + +Patch 7.4.1750 +Problem: When a buffer gets updated while in command line mode, the screen + may be messed up. +Solution: Postpone the redraw when the screen is scrolled. +Files: src/channel.c + +Patch 7.4.1751 +Problem: Crash when 'tagstack' is off. (Dominique Pelle) +Solution: Fix it. (Hirohito Higashi) +Files: src/tag.c, src/testdir/test_alot.vim, src/testdir/test_tagjump.vim + +Patch 7.4.1752 +Problem: When adding to the quickfix list the current position is reset. +Solution: Do not reset the position when not needed. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1753 +Problem: "noinsert" in 'completeopt' is sometimes ignored. +Solution: Set the variables when the 'completeopt' was set. (Ozaki Kiichi) +Files: src/edit.c, src/option.c, src/proto/edit.pro + +Patch 7.4.1754 +Problem: When 'filetype' was set and reloading a buffer which does not + cause it to be set, the syntax isn't loaded. (KillTheMule) +Solution: Remember whether the FileType event was fired and fire it if not. + (Anton Lindqvist, closes #747) +Files: src/fileio.c, src/testdir/test_syntax.vim + +Patch 7.4.1755 +Problem: When using getreg() on a non-existing register a NULL list is + returned. (Bjorn Linse) +Solution: Allocate an empty list. Add a test. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1756 +Problem: "dll" options are not expanded. +Solution: Expand environment variables. (Ozaki Kiichi) +Files: src/option.c, src/testdir/test_alot.vim, + src/testdir/test_expand_dllpath.vim + +Patch 7.4.1757 +Problem: When using complete() it may set 'modified' even though nothing + was inserted. +Solution: Use Down/Up instead of Next/Previous match. (Shougo Matsu, closes + #745) +Files: src/edit.c + +Patch 7.4.1758 +Problem: Triggering CursorHoldI when in CTRL-X mode causes problems. +Solution: Do not trigger CursorHoldI in CTRL-X mode. Add "!" flag to + feedkeys() (test with that didn't work though). +Files: src/edit.c, src/eval.c + +Patch 7.4.1759 +Problem: When using feedkeys() in a timer the inserted characters are not + used right away. +Solution: Break the wait loop when characters have been added to typebuf. + use this for testing CursorHoldI. +Files: src/gui.c, src/os_win32.c, src/os_unix.c, + src/testdir/test_autocmd.vim + +Patch 7.4.1760 (after 7.4.1759) +Problem: Compiler warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/os_win32.c + +Patch 7.4.1761 +Problem: Coverity complains about ignoring return value. +Solution: Add "(void)" to get rid of the warning. +Files: src/eval.c + +Patch 7.4.1762 +Problem: Coverity: useless assignments. +Solution: Remove them. +Files: src/search.c + +Patch 7.4.1763 +Problem: Coverity: useless assignment. +Solution: Add #if 0. +Files: src/spell.c + +Patch 7.4.1764 +Problem: C++ style comment. (Ken Takata) +Solution: Finish the work started here: don't call perror() when stderr + isn't working. +Files: src/os_unix.c + +Patch 7.4.1765 +Problem: Undo options are not together in the options window. +Solution: Put them together. (Gary Johnson) +Files: runtime/optwin.vim + +Patch 7.4.1766 +Problem: Building instructions for MS-Windows are outdated. +Solution: Mention setting SDK_INCLUDE_DIR. (Ben Franklin, closes #771) Move + outdated instructions further down. +Files: src/INSTALLpc.txt + +Patch 7.4.1767 +Problem: When installing Vim on a GTK system the icon cache is not updated. +Solution: Update the GTK icon cache when possible. (Kazunobu Kuriyama) +Files: src/Makefile, src/configure.in, src/config.mk.in, + src/auto/configure + +Patch 7.4.1768 +Problem: Arguments of setqflist() are not checked properly. +Solution: Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi, + closes #661) +Files: src/eval.c, src/testdir/test_quickfix.vim + +Patch 7.4.1769 +Problem: No "closed", "errors" and "encoding" attribute on Python output. +Solution: Add attributes and more tests. (Roland Puntaier, closes #622) +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.1770 +Problem: Cannot use true color in the terminal. +Solution: Add the 'guicolors' option. (Nikolai Pavlov) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/doc/various.txt, src/auto/configure, src/config.h.in, + src/configure.in, src/eval.c, src/globals.h, src/hardcopy.c, + src/option.c, src/option.h, src/proto/term.pro, src/screen.c, + src/structs.h, src/syntax.c, src/term.c, src/term.h, + src/version.c, src/vim.h + +Patch 7.4.1771 (after 7.4.1768) +Problem: Warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/eval.c + +Patch 7.4.1772 (after 7.4.1767) +Problem: Installation fails when $GTK_UPDATE_ICON_CACHE is empty. +Solution: Add quotes. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1773 (after 7.4.1770) +Problem: Compiler warnings. (Dominique Pelle) +Solution: Add UNUSED. Add type cast. Avoid a buffer overflow. +Files: src/syntax.c, src/term.c + +Patch 7.4.1774 (after 7.4.1770) +Problem: Cterm true color feature has warnings. +Solution: Add type casts. +Files: src/screen.c, src/syntax.c, src/term.c + +Patch 7.4.1775 +Problem: The rgb.txt file is not installed. +Solution: Install the file. (Christian Brabandt) +Files: src/Makefile + +Patch 7.4.1776 +Problem: Using wrong buffer length. +Solution: use the right name. (Kazunobu Kuriyama) +Files: src/term.c + +Patch 7.4.1777 +Problem: Newly added features can escape the sandbox. +Solution: Add checks for restricted and secure. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1778 +Problem: When using the term truecolor feature, the t_8f and t_8b termcap + options are not set by default. +Solution: Move the values to before BT_EXTRA_KEYS. (Christian Brabandt) +Files: src/term.c + +Patch 7.4.1779 +Problem: Using negative index in strcharpart(). (Yegappan Lakshmanan) +Solution: Assume single byte when using a negative index. +Files: src/eval.c + +Patch 7.4.1780 +Problem: Warnings reported by cppcheck. +Solution: Fix the warnings. (Dominique Pelle) +Files: src/ex_cmds2.c, src/json.c, src/misc1.c, src/ops.c, + src/regexp_nfa.c + +Patch 7.4.1781 +Problem: synIDattr() does not respect 'guicolors'. +Solution: Change the condition for the mode. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.1782 +Problem: strcharpart() does not work properly with some multi-byte + characters. +Solution: Use mb_cptr2len() instead of mb_char2len(). (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_expr_utf8.vim + +Patch 7.4.1783 +Problem: The old regexp engine doesn't handle character classes correctly. + (Manuel Ortega) +Solution: Use regmbc() instead of regc(). Add a test. +Files: src/regexp.c, src/testdir/test_regexp_utf8.vim + +Patch 7.4.1784 +Problem: The termtruecolor feature is enabled differently from many other + features. +Solution: Enable the termtruecolor feature for the big build, not through + configure. +Files: src/configure.in, src/config.h.in, src/auto/configure, + src/feature.h + +Patch 7.4.1785 (after 7.4.1783) +Problem: Regexp test fails on windows. +Solution: set 'isprint' to the right value for testing. +Files: src/testdir/test_regexp_utf8.vim + +Patch 7.4.1786 +Problem: Compiled-in colors do not match rgb.txt. +Solution: Use the rgb.txt colors. (Kazunobu Kuriyama) +Files: src/term.c + +Patch 7.4.1787 +Problem: When a job ends the close callback is invoked before other + callbacks. On Windows the close callback is not called. +Solution: First invoke out/err callbacks before the close callback. + Make the close callback work on Windows. +Files: src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel_pipe.py + +Patch 7.4.1788 +Problem: NSIS script is missing packages. +Solution: Add the missing directories. (Ken Takata) +Files: nsis/gvim.nsi + +Patch 7.4.1789 +Problem: Cannot use ch_read() in the close callback. +Solution: Do not discard the channel if there is readahead. Do not discard + readahead if there is a close callback. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1790 +Problem: Leading white space in a job command matters. (Andrew Stewart) +Solution: Skip leading white space. +Files: src/os_unix.c + +Patch 7.4.1791 +Problem: Channel could be garbage collected too early. +Solution: Don't free a channel or remove it from a job when it is still + useful. +Files: src/channel.c + +Patch 7.4.1792 +Problem: Color name decoding is implemented several times. +Solution: Move it to term.c. (Christian Brabandt) +Files: src/gui_mac.c, src/gui_photon.c, src/gui_w32.c, + src/proto/term.pro, src/term.c + +Patch 7.4.1793 +Problem: Some character classes may differ between systems. On OS/X the + regexp test fails. +Solution: Make this less dependent on the system. (idea by Kazunobu Kuriyama) +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.1794 (after 7.4.1792) +Problem: Can't build on MS-Windows. +Solution: Add missing declaration. +Files: src/gui_w32.c + +Patch 7.4.1795 +Problem: Compiler warning for redefining RGB. (John Marriott) +Solution: Rename it to TORGB. +Files: src/term.c + +Patch 7.4.1796 (after 7.4.1795) +Problem: Colors are wrong on MS-Windows. (Christian Robinson) +Solution: Use existing RGB macro if it exists. (Ken Takata) +Files: src/term.c + +Patch 7.4.1797 +Problem: Warning from Windows 64 bit compiler. +Solution: Change int to size_t. (Mike Williams) +Files: src/term.c + +Patch 7.4.1798 +Problem: Still compiler warning for unused return value. (Charles Campbell) +Solution: Assign to ignoredp. +Files: src/term.c + +Patch 7.4.1799 +Problem: 'guicolors' is a confusing option name. +Solution: Use 'termguicolors' instead. (Hirohito Higashi, Ken Takata) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/doc/various.txt, runtime/syntax/dircolors.vim, src/eval.c, + src/feature.h, src/globals.h, src/hardcopy.c, src/option.c, + src/option.h, src/proto/term.pro, src/screen.c, src/structs.h, + src/syntax.c, src/term.c, src/version.c, src/vim.h + +Patch 7.4.1800 (after 7.4.1799) +Problem: Unnecessary #ifdef. +Solution: Just use USE_24BIT. (Ken Takata) +Files: src/syntax.c + +Patch 7.4.1801 +Problem: Make uninstall leaves file behind. +Solution: Delete rgb.txt. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1802 +Problem: Quickfix doesn't handle long lines well, they are split. +Solution: Drop characters after a limit. (Anton Lindqvist) +Files: src/quickfix.c, src/testdir/test_quickfix.vim, + src/testdir/samples/quickfix.txt + +Patch 7.4.1803 +Problem: GTK3 doesn't handle menu separators properly. +Solution: Use gtk_separator_menu_item_new(). (Kazunobu Kuriyama) +Files: src/gui_gtk.c + +Patch 7.4.1804 +Problem: Can't use Vim as MANPAGER. +Solution: Add manpager.vim. (Enno Nagel, closes #491) +Files: runtime/doc/filetype.txt, runtime/plugin/manpager.vim + +Patch 7.4.1805 +Problem: Running tests in shadow dir fails. +Solution: Link the samples directory +Files: src/Makefile + +Patch 7.4.1806 +Problem: 'termguicolors' option missing from the options window. +Solution: Add the entry. +Files: runtime/optwin.vim + +Patch 7.4.1807 +Problem: Test_out_close_cb sometimes fails. +Solution: Always write DETACH to out, not err. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1808 (after 7.4.1806) +Problem: Using wrong feature name to check for 'termguicolors'. +Solution: Use the right feature name. (Ken Takata) +Files: runtime/optwin.vim + +Patch 7.4.1809 (after 7.4.1808) +Problem: Using wrong short option name for 'termguicolors'. +Solution: Use the option name. +Files: runtime/optwin.vim + +Patch 7.4.1810 +Problem: Sending DETACH after a channel was closed isn't useful. +Solution: Only add DETACH for a netbeans channel. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1811 +Problem: Netbeans channel gets garbage collected. +Solution: Set reference in nb_channel. +Files: src/eval.c, src/netbeans.c, src/proto/netbeans.pro + +Patch 7.4.1812 +Problem: Failure on startup with Athena and Motif. +Solution: Check for INVALCOLOR. (Kazunobu Kuriyama) +Files: src/syntax.c, src/vim.h + +Patch 7.4.1813 +Problem: Memory access error when running test_quickfix. +Solution: Allocate one more byte. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1814 +Problem: A channel may be garbage collected while it's still being used by + a job. (James McCoy) +Solution: Mark the channel as used if the job is still used. Do the same + for channels that are still used. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1815 +Problem: Compiler warnings for unused variables. (Ajit Thakkar) +Solution: Add a dummy initialization. (Yasuhiro Matsumoto) +Files: src/quickfix.c + +Patch 7.4.1816 +Problem: Looping over a null list throws an error. +Solution: Skip over the for loop. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1817 +Problem: The screen is not updated if a callback is invoked when closing a + channel. +Solution: Invoke redraw_after_callback(). +Files: src/channel.c + +Patch 7.4.1818 +Problem: Help completion adds @en to all matches except the first one. +Solution: Remove "break", go over all items. +Files: src/ex_getln.c + +Patch 7.4.1819 +Problem: Compiler warnings when sprintf() is a macro. +Solution: Don't interrupt sprintf() with an #ifdef. (Michael Jarvis, + closes #788) +Files: src/fileio.c, src/tag.c, src/term.c + +Patch 7.4.1820 +Problem: Removing language from help tags too often. +Solution: Only remove @en when not needed. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_help_tagjump.vim + +Patch 7.4.1821 (after 7.4.1820) +Problem: Test fails on MS-Windows. +Solution: Sort the completion results. +Files: src/testdir/test_help_tagjump.vim + +Patch 7.4.1822 +Problem: Redirecting stdout of a channel to "null" doesn't work. (Nicola) +Solution: Correct the file descriptor number. +Files: src/os_unix.c + +Patch 7.4.1823 +Problem: Warning from 64 bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/quickfix.c + +Patch 7.4.1824 +Problem: When a job is no longer referenced and does not have an exit + callback the process may hang around in defunct state. (Nicola) +Solution: Call job_status() if the job is running and won't get freed + because it might still be useful. +Files: src/channel.c + +Patch 7.4.1825 +Problem: When job writes to buffer nothing is written. (Nicola) +Solution: Do not discard a channel before writing is done. +Files: src/channel.c + +Patch 7.4.1826 +Problem: Callbacks are invoked when it's not safe. (Andrew Stewart) +Solution: When a channel is to be closed don't invoke callbacks right away, + wait for a safe moment. +Files: src/structs.h, src/channel.c + +Patch 7.4.1827 +Problem: No error when invoking a callback when it's not safe. +Solution: Add an error message. Avoid the error when freeing a channel. +Files: src/structs.h, src/channel.c + +Patch 7.4.1828 +Problem: May try to access buffer that's already freed. +Solution: When freeing a buffer remove it from any channel. +Files: src/buffer.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1829 (after 7.4.1828) +Problem: No message on channel log when buffer was freed. +Solution: Log a message. +Files: src/channel.c + +Patch 7.4.1830 +Problem: non-antialiased misnamed. +Solution: Use NONANTIALIASED and NONANTIALIASED_QUALITY. (Kim Brouer, + closes #793) +Files: src/os_mswin.c, runtime/doc/options.txt + +Patch 7.4.1831 +Problem: When timer_stop() is called with a string there is no proper error + message. +Solution: Require getting a number. (Bjorn Linse) +Files: src/eval.c + +Patch 7.4.1832 +Problem: Memory leak in debug commands. +Solution: Free memory before overwriting the pointer. (hint by Justin Keyes) +Files: src/ex_cmds2.c + +Patch 7.4.1833 +Problem: Cannot use an Ex command for 'keywordprg'. +Solution: Accept an Ex command. (Nelo-Thara Wallus) +Files: src/normal.c, runtime/doc/options.txt + +Patch 7.4.1834 +Problem: Possible crash when conceal is active. +Solution: Check for the screen to be valid when redrawing a line. +Files: src/screen.c + +Patch 7.4.1835 +Problem: When splitting and closing a window the status height changes. +Solution: Compute the frame height correctly. (Hirohito Higashi) +Files: src/window.c, src/testdir/test_alot.vim, + src/testdir/test_window_cmd.vim + +Patch 7.4.1836 +Problem: When using a partial on a dictionary it always gets bound to that + dictionary. +Solution: Make a difference between binding a function to a dictionary + explicitly or automatically. +Files: src/structs.h, src/eval.c, src/testdir/test_partial.vim, + runtime/doc/eval.txt + +Patch 7.4.1837 +Problem: The BufUnload event is triggered twice, when :bunload is used with + `bufhidden` set to `unload` or `delete`. +Solution: Do not trigger the event when ml_mfp is NULL. (Hirohito Higashi) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.1838 +Problem: Functions specifically for testing do not sort together. +Solution: Rename garbagecollect_for_testing() to test_garbagecollect_now(). + Add test_null_list(), test_null_dict(), etc. +Files: src/eval.c, src/testdir/test_expr.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1839 +Problem: Cannot get the items stored in a partial. +Solution: Support using get() on a partial. +Files: src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt + +Patch 7.4.1840 +Problem: When using packages an "after" directory cannot be used. +Solution: Add the "after" directory of the package to 'runtimepath' if it + exists. +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1841 +Problem: The code to reallocate the buffer used for quickfix is repeated. +Solution: Move the code to a function. (Yegappan Lakshmanan, closes #831) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1842 (after 7.4.1839) +Problem: get() works for Partial but not for Funcref. +Solution: Accept Funcref. Also return the function itself. (Nikolai Pavlov) +Files: src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt + +Patch 7.4.1843 +Problem: Tests involving Python are flaky. +Solution: Set the pt_auto field. Add tests. (Nikolai Pavlov) +Files: runtime/doc/if_pyth.txt, src/if_py_both.h, src/testdir/test86.in, + src/testdir/test86.ok, src/testdir/test87.in, + src/testdir/test87.ok + +Patch 7.4.1844 +Problem: Using old function name in comment. More functions should start + with test_. +Solution: Rename function in comment. (Hirohito Higashi) Rename + disable_char_avail_for_testing() to test_disable_char_avail(). + And alloc_fail() to test_alloc_fail(). +Files: src/eval.c, src/getchar.c, src/testdir/runtest.vim, + src/testdir/test_cursor_func.vim, src/testdir/test_quickfix.vim, + runtime/doc/eval.txt + +Patch 7.4.1845 +Problem: Mentioning NetBeans when reading from channel. (Ramel Eshed) +Solution: Make the text more generic. +Files: src/channel.c + +Patch 7.4.1846 +Problem: Ubsan detects a multiplication overflow. +Solution: Don't use orig_mouse_time when it's zero. (Dominique Pelle) +Files: src/term.c + +Patch 7.4.1847 +Problem: Getting an item from a NULL dict crashes. Setting a register to a + NULL list crashes. (Nikolai Pavlov, issue #768) Comparing a NULL + dict with a NULL dict fails. +Solution: Properly check for NULL. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1848 +Problem: Can't build with Strawberry Perl 5.24. +Solution: Define S_SvREFCNT_dec() if needed. (Damien, Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1849 +Problem: Still trying to read from channel that is going to be closed. + (Ramel Eshed) +Solution: Check if ch_to_be_closed is set. +Files: src/channel.c + +Patch 7.4.1850 +Problem: GUI freezes when using a job. (Shougo Matsu) +Solution: Unregister the channel when there is an input error. +Files: src/channel.c + +Patch 7.4.1851 +Problem: test_syn_attr fails when using the GUI. (Dominique Pelle) +Solution: Escape the font name properly. +Files: src/testdir/test_syn_attr.vim + +Patch 7.4.1852 +Problem: Unix: Cannot run all tests with the GUI. +Solution: Add the "testgui" target. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.1853 +Problem: Crash when job and channel are in the same dict while using + partials. (Luc Hermitte) +Solution: Do not decrement the channel reference count too early. +Files: src/channel.c + +Patch 7.4.1854 +Problem: When setting 'termguicolors' the Ignore highlighting doesn't work. + (Charles Campbell) +Solution: Handle the color names "fg" and "bg" when the GUI isn't running + and no colors are specified, fall back to black and white. +Files: src/syntax.c + +Patch 7.4.1855 +Problem: Valgrind reports memory leak for job that is not freed. +Solution: Free all jobs on exit. Add test for failing job. +Files: src/channel.c, src/misc2.c, src/proto/channel.pro, + src/testdir/test_partial.vim + +Patch 7.4.1856 (after 7.4.1855) +Problem: failing job test fails on MS-Windows. +Solution: Expect "fail" status instead of "dead". +Files: src/testdir/test_partial.vim + +Patch 7.4.1857 +Problem: When a channel appends to a buffer that is 'nomodifiable' there is + an error but appending is done anyway. +Solution: Add the 'modifiable' option. Refuse to write to a 'nomodifiable' + when the value is 1. +Files: src/structs.h, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.1858 +Problem: When a channel writes to a buffer it doesn't find a buffer by the + short name but re-uses it anyway. +Solution: Find buffer also by the short name. +Files: src/channel.c, src/buffer.c, src/vim.h + +Patch 7.4.1859 +Problem: Cannot use a function reference for "exit_cb". +Solution: Use get_callback(). (Yegappan Lakshmanan) +Files: src/channel.c, src/structs.h + +Patch 7.4.1860 +Problem: Using a partial for timer_start() may cause a crash. +Solution: Set the copyID in timer objects. (Ozaki Kiichi) +Files: src/testdir/test_timers.vim, src/eval.c, src/ex_cmds2.c, + src/proto/ex_cmds2.pro + +Patch 7.4.1861 +Problem: Compiler warnings with 64 bit compiler. +Solution: Change int to size_t. (Mike Williams) +Files: src/ex_cmds2.c + +Patch 7.4.1862 +Problem: string() with repeated argument does not give a result usable by + eval(). +Solution: Refactor echo_string and tv2string(), moving the common part to + echo_string_core(). (Ken Takata) +Files: src/eval.c, src/testdir/test_viml.vim, src/testdir/test86.ok, + src/testdir/test87.ok + +Patch 7.4.1863 +Problem: Compiler warnings on Win64. +Solution: Adjust types, add type casts. (Ken Takata) +Files: src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/version.c + +Patch 7.4.1864 +Problem: Python: encoding error with Python 2. +Solution: Use "getcwdu" instead of "getcwd". (Ken Takata) +Files: src/if_py_both.h + +Patch 7.4.1865 +Problem: Memory leaks in test49. (Dominique Pelle) +Solution: Use NULL instead of an empty string. +Files: src/eval.c + +Patch 7.4.1866 +Problem: Invalid memory access when exiting with EXITFREE defined. + (Dominique Pelle) +Solution: Set "really_exiting" and skip error messages. +Files: src/misc2.c, src/eval.c + +Patch 7.4.1867 +Problem: Memory leak in test_matchstrpos. +Solution: Free the string before overwriting. (Yegappan Lakshmanan) +Files: src/eval.c + +Patch 7.4.1868 +Problem: Setting really_exiting causes memory leaks to be reported. +Solution: Add the in_free_all_mem flag. +Files: src/globals.h, src/misc2.c, src/eval.c + +Patch 7.4.1869 +Problem: Can't build with old version of Perl. +Solution: Define PERLIO_FUNCS_DECL. (Tom G. Christensen) +Files: src/if_perl.xs + +Patch 7.4.1870 (after 7.4.1863) +Problem: One more Win64 compiler warning. +Solution: Change declared argument type. (Ken Takata) +Files: src/if_mzsch.c + +Patch 7.4.1871 +Problem: Appending to the quickfix list while the quickfix window is open + is very slow. +Solution: Do not delete all the lines, only append the new ones. Avoid + using a window while updating the list. (closes #841) +Files: src/quickfix.c + +Patch 7.4.1872 +Problem: Still build problem with old version of Perl. +Solution: Also define SvREFCNT_inc_void_NN if needed. (Tom G. Christensen) +Files: src/if_perl.xs + +Patch 7.4.1873 +Problem: When a callback adds a timer the GUI doesn't use it until later. + (Ramel Eshed) +Solution: Return early if a callback adds a timer. +Files: src/ex_cmds2.c, src/gui_gtk_x11.c, src/gui_w32.c, src/gui_x11.c, + src/globals.h + +Patch 7.4.1874 +Problem: Unused variable in Win32 code. +Solution: Remove it. (Mike Williams) +Files: src/gui_w32.c + +Patch 7.4.1875 +Problem: Comparing functions and partials doesn't work well. +Solution: Add tests. (Nikolai Pavlov) Compare the dict and arguments in the + partial. (closes #813) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1876 +Problem: Typing "k" at the hit-enter prompt has no effect. +Solution: Don't assume recursive use of the prompt if a character was typed. + (Hirohito Higashi) +Files: src/message.c + +Patch 7.4.1877 +Problem: No test for invoking "close_cb" when writing to a buffer. +Solution: Add using close_cb to a test case. +Files: src/testdir/test_channel.vim + +Patch 7.4.1878 +Problem: Whether a job has exited isn't detected until a character is + typed. After calling exit_cb the cursor is in the wrong place. +Solution: Don't wait forever for a character to be typed when there is a + pending job. Update the screen if needed after calling exit_cb. +Files: src/os_unix.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1879 (after 7.4.1877) +Problem: Channel test is flaky. +Solution: Wait for close_cb to be invoked. +Files: src/testdir/test_channel.vim + +Patch 7.4.1880 +Problem: MS-Windows console build defaults to not having +channel. +Solution: Include the channel feature if building with huge features. +Files: src/Make_mvc.mak + +Patch 7.4.1881 +Problem: Appending to a long quickfix list is slow. +Solution: Add qf_last. +Files: src/quickfix.c + +Patch 7.4.1882 +Problem: Check for line break at end of line wrong. (Dominique Pelle) +Solution: Correct the logic. +Files: src/quickfix.c + +Patch 7.4.1883 +Problem: Cppcheck found 2 incorrect printf formats. +Solution: Use %ld and %lx. (Dominique Pelle) +Files: src/VisVim/Commands.cpp, src/gui_mac.c + +Patch 7.4.1884 +Problem: Updating marks in a quickfix list is very slow when the list is + long. +Solution: Only update marks if the buffer has a quickfix entry. +Files: src/structs.h, src/quickfix.c + +Patch 7.4.1885 +Problem: MinGW console build defaults to not having +channel. +Solution: Include the channel feature if building with huge features. (Ken + Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1886 +Problem: When waiting for a character is interrupted by receiving channel + data and the first character of a mapping was typed, the mapping + times out. (Ramel Eshed) +Solution: When dealing with channel data don't return from mch_inchar(). +Files: src/getchar.c, src/proto/getchar.pro, src/os_unix.c + +Patch 7.4.1887 +Problem: When receiving channel data 'updatetime' is not respected. +Solution: Recompute the waiting time after being interrupted. +Files: src/os_unix.c + +Patch 7.4.1888 +Problem: Wrong computation of remaining wait time in RealWaitForChar() +Solution: Remember the original waiting time. +Files: src/os_unix.c + +Patch 7.4.1889 +Problem: When umask is set to 0177 Vim can't create temp files. (Lcd) +Solution: Also correct umask when using mkdtemp(). +Files: src/fileio.c + +Patch 7.4.1890 +Problem: GUI: When channel data is received the cursor blinking is + interrupted. (Ramel Eshed) +Solution: Don't update the cursor when it is blinking. +Files: src/screen.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, + src/gui_mac.c, src/proto/gui_mac.pro, src/gui_photon.c, + src/proto/gui_photon.pro, src/gui_w32.c, src/proto/gui_w32.pro, + src/gui_x11.c, src/proto/gui_x11.pro + +Patch 7.4.1891 +Problem: Channel reading very long lines is slow. +Solution: Collapse multiple buffers until a NL is found. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/structs.h + +Patch 7.4.1892 +Problem: balloon eval only gets the window number, not the ID. +Solution: Add v:beval_winid. +Files: src/eval.c, src/gui_beval.c, src/vim.h + +Patch 7.4.1893 +Problem: Cannot easily get the window ID for a buffer. +Solution: Add bufwinid(). +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.1894 +Problem: Cannot get the window ID for a mouse click. +Solution: Add v:mouse_winid. +Files: src/eval.c, src/vim.h, runtime/doc/eval.txt + +Patch 7.4.1895 +Problem: Cannot use a window ID where a window number is expected. +Solution: Add LOWEST_WIN_ID, so that the window ID can be used where a + number is expected. +Files: src/window.c, src/eval.c, src/vim.h, runtime/doc/eval.txt, + src/testdir/test_window_id.vim + +Patch 7.4.1896 +Problem: Invoking mark_adjust() when adding a new line below the last line + is pointless. +Solution: Skip calling mark_adjust() when appending below the last line. +Files: src/misc1.c, src/ops.c + +Patch 7.4.1897 +Problem: Various typos, long lines and style mistakes. +Solution: Fix the typos, wrap lines, improve style. +Files: src/buffer.c, src/ex_docmd.c, src/getchar.c, src/option.c, + src/main.aap, src/testdir/README.txt, + src/testdir/test_reltime.vim, src/testdir/test_tagjump.vim, + src/INSTALL, src/config.aap.in, src/if_mzsch.c + +Patch 7.4.1898 +Problem: User commands don't support modifiers. +Solution: Add the <mods> item. (Yegappan Lakshmanan, closes #829) +Files: runtime/doc/map.txt, src/ex_docmd.c, src/testdir/Make_all.mak, + src/testdir/test_usercommands.vim + +Patch 7.4.1899 +Problem: GTK 3: cursor blinking doesn't work well. +Solution: Instead of gui_gtk_window_clear() use gui_mch_clear_block(). + (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1900 +Problem: Using CTRL-] in the help on "{address}." doesn't work. +Solution: Recognize an item in {}. (Hirohito Higashi, closes #814) +Files: src/ex_cmds.c, src/testdir/test_help_tagjump.vim + +Patch 7.4.1901 +Problem: Win32: the "Disabled" menu items would appear enabled. +Solution: Use submenu_id if there is a parent. (Shane Harper, closes #834) +Files: src/gui_w32.c + +Patch 7.4.1902 +Problem: No test for collapsing buffers for a channel. Some text is lost. +Solution: Add a simple test. Set rq_buflen correctly. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1903 +Problem: When writing viminfo merging current history with history in + viminfo may drop recent history entries. +Solution: Add new format for viminfo lines, use it for history entries. Use + a timestamp for ordering the entries. Add test_settime(). + Add the viminfo version. Does not do merging on timestamp yet. +Files: src/eval.c, src/ex_getln.c, src/ex_cmds.c, src/structs.h, + src/globals.h, src/proto/ex_cmds.pro, src/proto/ex_getln.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.1904 (after 7.4.1903) +Problem: Build fails. +Solution: Add missing changes. +Files: src/vim.h + +Patch 7.4.1905 (after 7.4.1903) +Problem: Some compilers can't handle a double semicolon. +Solution: Remove one semicolon. +Files: src/ex_cmds.c + +Patch 7.4.1906 +Problem: Collapsing channel buffers and searching for NL does not work + properly. (Xavier de Gaye, Ramel Eshed) +Solution: Do not assume the buffer contains a NUL or not. Change NUL bytes + to NL to avoid the string is truncated. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro + +Patch 7.4.1907 +Problem: Warnings from 64 bit compiler. +Solution: Change type to size_t. (Mike Williams) +Files: src/ex_cmds.c + +Patch 7.4.1908 +Problem: Netbeans uses uninitialized pointer and freed memory. +Solution: Set "buffer" at the right place (hint by Ken Takata) +Files: src/netbeans.c + +Patch 7.4.1909 +Problem: Doubled semicolons. +Solution: Reduce to one. (Dominique Pelle) +Files: src/dosinst.c, src/fold.c, src/gui_gtk_x11.c, src/gui_w32.c, + src/main.c, src/misc2.c + +Patch 7.4.1910 +Problem: Tests using external command to delete directory. +Solution: Use delete(). +Files: src/testdir/test17.in, src/testdir/test73.in, + src/testdir/test_getcwd.in + +Patch 7.4.1911 +Problem: Recent history lines may be lost when exiting Vim. +Solution: Merge history using the timestamp. +Files: src/ex_getln.c, src/ex_cmds.c, src/vim.h, src/proto/ex_getln.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.1912 +Problem: No test for using setqflist() on an older quickfix list. +Solution: Add a couple of tests. +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1913 +Problem: When ":doautocmd" is used modelines are used even when no + autocommands were executed. (Daniel Hahler) +Solution: Skip processing modelines. (closes #854) +Files: src/fileio.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/fileio.pro + +Patch 7.4.1914 +Problem: Executing autocommands while using the signal stack has a high + chance of crashing Vim. +Solution: Don't invoke autocommands when on the signal stack. +Files: src/os_unix.c + +Patch 7.4.1915 +Problem: The effect of the PopupMenu autocommand isn't directly visible. +Solution: Call gui_update_menus() before displaying the popup menu. (Shane + Harper, closs #855) +Files: src/menu.c + +Patch 7.4.1916 (after 7.4.1906) +Problem: No proper test for what 7.4.1906 fixes. +Solution: Add a test for reading many lines. +Files: src/testdir/test_channel.vim + +Patch 7.4.1917 +Problem: History lines read from viminfo in different encoding than when + writing are not converted. +Solution: Convert the history lines. +Files: src/ex_cmds.c, src/testdir/test_viminfo.vim + +Patch 7.4.1918 +Problem: Not enough testing for parsing viminfo lines. +Solution: Add test with viminfo lines in bad syntax. Fix memory leak. +Files: src/ex_cmds.c, src/ex_getln.c, src/testdir/test_viminfo.vim + +Patch 7.4.1919 +Problem: Register contents is not merged when writing viminfo. +Solution: Use timestamps for register contents. +Files: src/ops.c, src/ex_getln.c, src/ex_cmds.c, src/proto/ex_cmds.pro, + src/proto/ex_getln.pro, src/proto/ops.pro, src/vim.h + +Patch 7.4.1920 (after 7.4.1919) +Problem: Missing test changes. +Solution: Update viminfo test. +Files: src/testdir/test_viminfo.vim + +Patch 7.4.1921 (after 7.4.1919) +Problem: vim_time() not included when needed. +Solution: Adjust #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.1922 +Problem: Ruby 2.4.0 unifies Fixnum and Bignum into Integer. +Solution: Use rb_cInteger. (Weiyong Mao) +Files: src/if_ruby.c + +Patch 7.4.1923 +Problem: Command line editing is not tested much. +Solution: Add tests for expanding the file name and 'wildmenu'. +Files: src/testdir/test_cmdline.vim, src/testdir/Make_all.mak + +Patch 7.4.1924 +Problem: Missing "void" for functions without argument. +Solution: Add "void". (Hirohito Higashi) +Files: src/channel.c, src/edit.c, src/ex_cmds2.c, src/ops.c, src/screen.c + +Patch 7.4.1925 +Problem: Viminfo does not merge file marks properly. +Solution: Use a timestamp. Add the :clearjumps command. +Files: src/mark.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/mark.pro, + src/structs.h, src/vim.h, src/ex_cmds.h, + src/testdir/test_viminfo.vim + +Patch 7.4.1926 +Problem: Possible crash with many history items. +Solution: Avoid the index going past the last item. +Files: src/ex_getln.c + +Patch 7.4.1927 +Problem: Compiler warning for signed/unsigned. +Solution: Add type cast. +Files: src/if_mzsch.c + +Patch 7.4.1928 +Problem: Overwriting pointer argument. +Solution: Assign to what it points to. (Dominique Pelle) +Files: src/fileio.c + +Patch 7.4.1929 +Problem: Inconsistent indenting and weird name. +Solution: Fix indent, make name all upper case. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.1930 +Problem: Can't build without +spell but with +quickfix. (Charles) +Solution: Add better #ifdef around ml_append_buf(). (closes #864) +Files: src/memline.c + +Patch 7.4.1931 +Problem: Using both old and new style file mark lines from viminfo. +Solution: Skip the old style lines if the viminfo file was written with a + Vim version that supports the new style. +Files: src/ex_cmds.c + +Patch 7.4.1932 +Problem: When writing viminfo the jumplist is not merged with the one in + the viminfo file. +Solution: Merge based on timestamp. +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 7.4.1933 +Problem: Compiler warning about uninitialized variable. (Yegappan) +Solution: Give it a dummy value. +Files: src/ex_getln.c + +Patch 7.4.1934 +Problem: New style tests not executed with MinGW compiler. +Solution: Add new style test support. (Yegappan Lakshmanan) +Files: src/testdir/Make_ming.mak + +Patch 7.4.1935 +Problem: When using the GUI search/replace a second match right after the + replacement is skipped. +Solution: Add the SEARCH_START flag. (Mleddy) +Files: src/gui.c + +Patch 7.4.1936 +Problem: Off-by-one error in bounds check. (Coverity) +Solution: Check register number properly. +Files: src/ops.c + +Patch 7.4.1937 +Problem: No test for directory stack in quickfix. +Solution: Add a test. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1938 +Problem: When writing viminfo numbered marks were duplicated. +Solution: Check for duplicates between current numbered marks and the ones + read from viminfo. +Files: src/mark.c + +Patch 7.4.1939 +Problem: Memory access error when reading viminfo. (Dominique Pelle) +Solution: Correct index in jumplist when at the end. +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 7.4.1940 +Problem: "gd" hangs in some situations. (Eric Biggers) +Solution: Remove the SEARCH_START flag when looping. Add a test. +Files: src/normal.c, src/testdir/test_goto.vim + +Patch 7.4.1941 +Problem: Not all quickfix tests are also done with the location lists. +Solution: Test more quickfix code. Use user commands instead of "exe". + (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1942 +Problem: Background is not drawn properly when 'termguicolors' is set. +Solution: Check cterm_normal_bg_color. (Jacob Niehus, closes #805) +Files: src/screen.c + +Patch 7.4.1943 +Problem: Coverity warns for unreachable code. +Solution: Remove the code that won't do anything. +Files: src/mark.c + +Patch 7.4.1944 +Problem: Win32: Cannot compile with XPM feature using VC2015 +Solution: Add XPM libraries compiled with VC2015, and enable to build + gvim.exe which supports XPM using VC2015. (Ken Takata) +Files: src/Make_mvc.mak, src/xpm/x64/lib-vc14/libXpm.lib, + src/xpm/x86/lib-vc14/libXpm.lib + +Patch 7.4.1945 +Problem: The Man plugin doesn't work that well. +Solution: Use "g:ft_man_open_mode" to be able open man pages in vert split + or separate tab. Set nomodifiable for buffer with man content. Add + a test. (Andrey Starodubtsev, closes #873) +Files: runtime/ftplugin/man.vim, src/testdir/test_man.vim, + src/testdir/Make_all.mak + +Patch 7.4.1946 (after 7.4.1944) +Problem: File list does not include new XPM libraries. +Solution: Add the file list entries. +Files: Filelist + +Patch 7.4.1947 +Problem: Viminfo continuation line with wrong length isn't skipped. (Marius + Gedminas) +Solution: Skip a line when encountering an error, but not two lines. +Files: src/ex_cmds.c + +Patch 7.4.1948 +Problem: Using Ctrl-A with double-byte encoding may result in garbled text. +Solution: Skip to the start of a character. (Hirohito Higashi) +Files: src/ops.c + +Patch 7.4.1949 +Problem: Minor problems with the quickfix code. +Solution: Fix the problems. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1950 +Problem: Quickfix long lines test not executed for buffer. +Solution: Call the function to test long lines. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1951 +Problem: Ruby test is old style. +Solution: Convert to a new style test. (Ken Takata) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_ruby.in, + src/testdir/test_ruby.ok, src/testdir/test_ruby.vim + +Patch 7.4.1952 +Problem: Cscope interface does not support finding assignments. +Solution: Add the "a" command. (ppettina, closes #882) +Files: runtime/doc/if_cscop.txt, src/if_cscope.c + +Patch 7.4.1953 +Problem: Not all parts of the quickfix code are tested. +Solution: Add more tests. (Yegappan Lakshmanan) +Files: src/testdir/samples/quickfix.txt, + src/testdir/test_quickfix.vim + +Patch 7.4.1954 (after 7.4.1948) +Problem: No test for what 7.4.1948 fixes. +Solution: Add a test. (Hirohito Higashi, closes #880) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_increment_dbcs.vim + +Patch 7.4.1955 +Problem: Using 32-bit Perl with 64-bit time_t causes memory corruption. + (Christian Brabandt) +Solution: Use time_T instead of time_t for global variables. (Ken Takata) +Files: src/ex_cmds.c, src/globals.h, src/misc2.c, src/proto/ex_cmds.pro, + src/proto/misc2.pro, src/structs.h, src/vim.h + +Patch 7.4.1956 +Problem: When using CTRL-W f and pressing "q" at the ATTENTION dialog the + newly opened window is not closed. +Solution: Close the window and go back to the original one. (Norio Takagi, + Hirohito Higashi) +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 7.4.1957 +Problem: Perl interface has obsolete workaround. +Solution: Remove the workaround added by 7.3.623. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1958 +Problem: Perl interface preprocessor statements not nicely indented. +Solution: Improve the indenting. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1959 +Problem: Crash when running test_channel.vim on Windows. +Solution: Check for NULL pointer result from FormatMessage(). (Christian + Brabandt) +Files: src/channel.c + +Patch 7.4.1960 +Problem: Unicode standard 9 was released. +Solution: Update the character property tables. (Christian Brabandt) +Files: src/mbyte.c + +Patch 7.4.1961 +Problem: When 'insertmode' is reset while doing completion the popup menu + remains even though Vim is in Normal mode. +Solution: Ignore stop_insert_mode when the popup menu is visible. Don't set + stop_insert_mode when 'insertmode' was already off. (Christian + Brabandt) +Files: src/edit.c, src/option.c, src/Makefile, src/testdir/test_alot.vim, + src/testdir/test_popup.vim + +Patch 7.4.1962 +Problem: Two test files for increment/decrement. +Solution: Move the old style test into the new style test. (Hirohito + Higashi, closes #881) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/main.aap, + src/testdir/test35.in, src/testdir/test35.ok, + src/testdir/test_increment.vim + +Patch 7.4.1963 +Problem: Running Win32 Vim in mintty does not work. +Solution: Detect mintty and give a helpful error message. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/iscygpty.c, + src/iscygpty.h, src/main.c, Filelist + +Patch 7.4.1964 +Problem: The quickfix init function is too big. +Solution: Factor out parsing 'errorformat' to a separate function. (Yegappan + Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1965 +Problem: When using a job in raw mode to append to a buffer garbage + characters are added. +Solution: Do not replace the trailing NUL with a NL. (Ozaki Kiichi) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1966 +Problem: Coverity reports a resource leak. +Solution: Close "fd" also when bailing out. +Files: src/quickfix.c + +Patch 7.4.1967 +Problem: Falling back from NFA to old regexp engine does not work properly. + (fritzophrenic) +Solution: Do not restore nfa_match. (Christian Brabandt, closes #867) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.1968 +Problem: Invalid memory access with "\<C-">. +Solution: Do not recognize this as a special character. (Dominique Pelle) +Files: src/misc2.c, src/testdir/test_expr.vim + +Patch 7.4.1969 +Problem: When the netbeans channel is closed consuming the buffer may cause + a crash. +Solution: Check for nb_channel not to be NULL. (Xavier de Gaye) +Files: src/netbeans.c + +Patch 7.4.1970 +Problem: Using ":insert" in an empty buffer sets the jump mark. (Ingo + Karkat) +Solution: Don't adjust marks when replacing the empty line in an empty + buffer. (closes #892) +Files: src/ex_cmds.c, src/testdir/test_jumps.vim, + src/testdir/test_alot.vim + +Patch 7.4.1971 +Problem: It is not easy to see unrecognized error lines below the current + error position. +Solution: Add ":clist +count". +Files: src/quickfix.c, runtime/doc/quickfix.txt + +Patch 7.4.1972 +Problem: On Solaris select() does not work as expected when there is + typeahead. +Solution: Add ICANON when sleeping. (Ozaki Kiichi) +Files: src/os_unix.c + +Patch 7.4.1973 +Problem: On MS-Windows the package directory may be added at the end + because of forward/backward slash differences. (Matthew + Desjardins) +Solution: Ignore slash differences. +Files: src/ex_cmds2.c + +Patch 7.4.1974 +Problem: GUI has a problem with some termcodes. +Solution: Handle negative numbers. (Kazunobu Kuriyama) +Files: src/gui.c + +Patch 7.4.1975 +Problem: On MS-Windows large files (> 2Gbyte) cause problems. +Solution: Use "off_T" instead of "off_t". Use "stat_T" instead of "struct + stat". Use 64 bit system functions if available. (Ken Takata) +Files: src/Makefile, src/buffer.c, src/diff.c, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/fileio.c, src/gui.c, src/gui_at_fs.c, + src/if_cscope.c, src/main.c, src/memfile.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/os_mswin.c, + src/os_win32.c, src/proto/fileio.pro, src/proto/memline.pro, + src/proto/os_mswin.pro, src/pty.c, src/quickfix.c, src/spell.c, + src/structs.h, src/tag.c, src/testdir/Make_all.mak, + src/testdir/test_largefile.vim, src/testdir/test_stat.vim, + src/undo.c, src/vim.h + +Patch 7.4.1976 +Problem: Number variables are not 64 bits while they could be. +Solution: Add the num64 feature. (Ken Takata, Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, runtime/doc/various.txt, + src/Make_cyg_ming.mak, src/Make_mvc.mak, src/charset.c, + src/eval.c, src/ex_cmds.c, src/ex_getln.c, src/feature.h, + src/fileio.c, src/fold.c, src/json.c, src/message.c, src/misc1.c, + src/misc2.c, src/ops.c, src/option.c, src/proto/charset.pro, + src/proto/eval.pro, src/quickfix.c, src/structs.h, + src/testdir/test_viml.vim, src/version.c + +Patch 7.4.1977 +Problem: With 64 bit changes don't need three calls to sprintf(). +Solution: Simplify the code, use vim_snprintf(). (Ken Takata) +Files: src/fileio.c + +Patch 7.4.1978 (after 7.4.1975) +Problem: Large file test does not delete its output. +Solution: Delete the output. Check size properly when possible. (Ken Takata) +Files: src/testdir/test_largefile.vim + +Patch 7.4.1979 (after 7.4.1976) +Problem: Getting value of binary option is wrong. (Kent Sibilev) +Solution: Fix type cast. Add a test. +Files: src/option.c, src/testdir/test_expr.vim + +Patch 7.4.1980 +Problem: 'errorformat' is parsed for every call to ":caddexpr". Can't add + to two location lists asynchronously. +Solution: Keep the previously parsed data when appropriate. (mostly by + Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1981 +Problem: No testing for Farsi code. +Solution: Add a minimal test. Clean up Farsi code. +Files: src/farsi.c, src/Makefile, src/charset.c, src/normal.c, + src/proto/main.pro, src/testdir/Make_all.mak, + src/testdir/test_farsi.vim + +Patch 7.4.1982 +Problem: Viminfo file contains duplicate change marks. +Solution: Drop duplicate marks. +Files: src/mark.c + +Patch 7.4.1983 +Problem: farsi.c and arabic.c are included in a strange way. +Solution: Build them like other files. +Files: src/main.c, src/farsi.c, src/arabic.c, src/proto.h, + src/proto/main.pro, src/proto/farsi.pro, src/proto/arabic.pro, + src/Makefile, src/Make_bc5.mak, src/Make_cyg_ming.mak, + src/Make_dice.mak, src/Make_ivc.mak, src/Make_manx.mak, + src/Make_morph.mak, src/Make_mvc.mak, src/Make_sas.mak, + Filelist + +Patch 7.4.1984 +Problem: Not all quickfix features are tested. +Solution: Add a few more tests. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1985 (after 7.4.1983) +Problem: Missing changes in VMS build file. +Solution: Use the right file name. +Files: src/Make_vms.mms + +Patch 7.4.1986 +Problem: Compiler warns for loss of data. +Solution: Use size_t instead of int. (Christian Brabandt) +Files: src/ex_cmds2.c + +Patch 7.4.1987 +Problem: When copying unrecognized lines for viminfo, end up with useless + continuation lines. +Solution: Skip continuation lines. +Files: src/ex_cmds.c + +Patch 7.4.1988 +Problem: When updating viminfo with file marks there is no time order. +Solution: Remember the time when a buffer was last used, store marks for + the most recently used buffers. +Files: src/buffer.c, src/structs.h, src/mark.c, src/main.c, + src/ex_cmds.c, src/proto/mark.pro, src/testdir/test_viminfo.vim + +Patch 7.4.1989 +Problem: filter() and map() only accept a string argument. +Solution: Implement using a Funcref argument (Yasuhiro Matsumoto, Ken + Takata) +Files: runtime/doc/eval.txt, src/Makefile, src/eval.c, + src/testdir/test_alot.vim, src/testdir/test_filter_map.vim, + src/testdir/test_partial.vim + +Patch 7.4.1990 (after 7.4.1952) +Problem: Cscope items are not sorted. +Solution: Put the new "a" command first. (Ken Takata) +Files: src/if_cscope.c + +Patch 7.4.1991 +Problem: glob() does not add a symbolic link when there are no wildcards. +Solution: Remove the call to mch_getperm(). +Files: src/misc1.c + +Patch 7.4.1992 +Problem: Values for true and false can be confusing. +Solution: Update the documentation. Add a test. Make v:true evaluate to + TRUE for a non-zero-arg. +Files: runtime/doc/eval.txt, src/eval.c, src/Makefile, + src/testdir/test_true_false.vim, src/testdir/test_alot.vim + +Patch 7.4.1993 +Problem: Not all TRUE and FALSE arguments are tested. +Solution: Add a few more tests. +Files: src/testdir/test_true_false.vim + +Patch 7.4.1994 (after 7.4.1993) +Problem: True-false test fails. +Solution: Filter the dict to only keep the value that matters. +Files: src/testdir/test_true_false.vim + +Patch 7.4.1995 +Problem: GUI: cursor drawn in wrong place if a timer callback causes a + screen update. (David Samvelyan) +Solution: Also redraw the cursor when it's blinking and on. +Files: src/gui_gtk_x11.c, src/gui_mac.c, src/gui_photon.c, src/gui_w32.c, + src/gui_x11.c, src/screen.c, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_photon.pro, + src/proto/gui_w32.pro, src/proto/gui_x11.pro + +Patch 7.4.1996 +Problem: Capturing the output of a command takes a few commands. +Solution: Add evalcmd(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/Makefile, src/testdir/test_evalcmd.vim + +Patch 7.4.1997 +Problem: Cannot easily scroll the quickfix window. +Solution: Add ":cbottom". +Files: src/ex_cmds.h, src/quickfix.c, src/proto/quickfix.pro, + src/ex_docmd.c, src/testdir/test_quickfix.vim, + runtime/doc/quickfix.txt + +Patch 7.4.1998 +Problem: When writing buffer lines to a job there is no NL to NUL + conversion. +Solution: Make it work symmetrical with writing lines from a job into a + buffer. +Files: src/channel.c, src/proto/channel.pro, src/netbeans.c + +Patch 7.4.1999 +Problem: evalcmd() doesn't work recursively. +Solution: Use redir_evalcmd instead of redir_vname. +Files: src/message.c, src/eval.c, src/globals.h, src/proto/eval.pro, + src/testdir/test_evalcmd.vim + +Patch 7.4.2000 (after 7.4.1999) +Problem: Evalcmd test fails. +Solution: Add missing piece. +Files: src/ex_docmd.c + +Patch 7.4.2001 (after 7.4.2000) +Problem: Tiny build fails. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/ex_docmd.c + +Patch 7.4.2002 +Problem: Crash when passing number to filter() or map(). +Solution: Convert to a string. (Ozaki Kiichi) +Files: src/eval.c, src/testdir/test_filter_map.vim + +Patch 7.4.2003 +Problem: Still cursor flickering when a callback updates the screen. (David + Samvelyan) +Solution: Put the cursor in the right position after updating the screen. +Files: src/screen.c + +Patch 7.4.2004 +Problem: GUI: cursor displayed in the wrong position. +Solution: Correct screen_cur_col and screen_cur_row. +Files: src/screen.c + +Patch 7.4.2005 +Problem: After using evalcmd() message output is in the wrong position. + (Christian Brabandt) +Solution: Reset msg_col. +Files: src/eval.c + +Patch 7.4.2006 +Problem: Crash when using tabnext in BufUnload autocmd. (Norio Takagi) +Solution: First check that the current buffer is the right one. (Hirohito + Higashi) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.2007 +Problem: Running the tests leaves a viminfo file behind. +Solution: Make the viminfo option empty. +Files: src/testdir/runtest.vim + +Patch 7.4.2008 +Problem: evalcmd() has a confusing name. +Solution: Rename to execute(). Make silent optional. Support a list of + commands. +Files: src/eval.c, src/ex_docmd.c, src/message.c, src/globals.h, + src/proto/eval.pro, src/Makefile, src/testdir/test_evalcmd.vim, + src/testdir/test_execute_func.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.2009 (after 7.4.2008) +Problem: Messages test fails. +Solution: Don't set redir_execute before returning. Add missing version + number. +Files: src/eval.c + +Patch 7.4.2010 +Problem: There is a :cbottom command but no :lbottom command. +Solution: Add :lbottom. (Yegappan Lakshmanan) +Files: runtime/doc/index.txt, runtime/doc/quickfix.txt, src/ex_cmds.h, + src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2011 +Problem: It is not easy to get a list of command arguments. +Solution: Add getcompletion(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c, + src/proto/ex_docmd.pro, src/testdir/test_cmdline.vim + +Patch 7.4.2012 (after 7.4.2011) +Problem: Test for getcompletion() does not pass on all systems. +Solution: Only test what is supported. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2013 +Problem: Using "noinsert" in 'completeopt' breaks redo. +Solution: Set compl_curr_match. (Shougo Matsu, closes #874) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2014 +Problem: Using "noinsert" in 'completeopt' does not insert match. +Solution: Set compl_enter_selects. (Shougo Matsu, closes #875) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2015 +Problem: When a file gets a name when writing it 'acd' is not effective. + (Dan Church) +Solution: Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes + #777, closes #803) Add test_autochdir() to enable 'acd' before + "starting" is reset. +Files: src/ex_cmds.c, src/buffer.c, src/eval.c, src/globals.h, + src/Makefile, src/testdir/test_autochdir.vim, + src/testdir/Make_all.mak + +Patch 7.4.2016 +Problem: Warning from MinGW about _WIN32_WINNT redefined. (John Marriott) +Solution: First undefine it. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2017 +Problem: When there are many errors adding them to the quickfix list takes + a long time. +Solution: Add BLN_NOOPT. Don't call buf_valid() in buf_copy_options(). + Remember the last file name used. When going through the buffer + list start from the end of the list. Only call buf_valid() when + autocommands were executed. +Files: src/buffer.c, src/option.c, src/quickfix.c, src/vim.h + +Patch 7.4.2018 +Problem: buf_valid() can be slow when there are many buffers. +Solution: Add bufref_valid(), only go through the buffer list when a buffer + was freed. +Files: src/structs.h, src/buffer.c, src/quickfix.c, src/proto/buffer.pro + +Patch 7.4.2019 +Problem: When ignoring case utf_fold() may consume a lot of time. +Solution: Optimize for ASCII. +Files: src/mbyte.c + +Patch 7.4.2020 +Problem: Can't build without +autocmd feature. +Solution: Adjust #ifdefs. +Files: src/buffer.c + +Patch 7.4.2021 +Problem: Still too many buf_valid() calls. +Solution: Make au_new_curbuf a bufref. Use bufref_valid() in more places. +Files: src/ex_cmds.c, src/buffer.c, src/globals.h + +Patch 7.4.2022 +Problem: Warnings from 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/eval.c + +Patch 7.4.2023 +Problem: buflist_findname_stat() may find a dummy buffer. +Solution: Set the BF_DUMMY flag after loading a dummy buffer. Start + finding buffers from the end of the list. +Files: src/quickfix.c, src/buffer.c + +Patch 7.4.2024 +Problem: More buf_valid() calls can be optimized. +Solution: Use bufref_valid() instead. +Files: src/buffer.c, src/ex_cmds.c, src/structs.h, src/channel.c, + src/diff.c, src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, + src/ex_getln.c, src/fileio.c, src/main.c, src/misc2.c, + src/netbeans.c, src/quickfix.c, src/spell.c, src/term.c, + src/if_py_both.h, src/window.c, src/proto/buffer.pro, + src/proto/window.pro + +Patch 7.4.2025 +Problem: The cursor blinking stops or is irregular when receiving date over + a channel and writing it in a buffer, and when updating the status + line. (Ramel Eshed) +Solution: Make it a bit better by flushing GUI output. Don't redraw the + cursor after updating the screen if the blink state is off. +Files: src/gui_gtk_x11.c, src/screen.c + +Patch 7.4.2026 +Problem: Reference counting for callbacks isn't right. +Solution: Add free_callback(). (Ken Takata) Fix reference count. +Files: src/channel.c, src/eval.c, src/ex_cmds2.c, src/proto/eval.pro + +Patch 7.4.2027 +Problem: Can't build with +eval but without +menu. +Solution: Add #ifdef. (John Marriott) +Files: src/eval.c + +Patch 7.4.2028 +Problem: cppcheck warns for using index before limits check. +Solution: Swap the expressions. (Dominique Pelle) +Files: src/mbyte.c + +Patch 7.4.2029 +Problem: printf() does not work with 64 bit numbers. +Solution: use the "L" length modifier. (Ken Takata) +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2030 +Problem: ARCH must be set properly when using MinGW. +Solution: Detect the default value of ARCH from the current compiler. (Ken + Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2031 +Problem: The list_lbr_utf8 test fails if ~/.vim/syntax/c.vim sets + 'textwidth' to a non-zero value. (Oyvind A. Holm) +Solution: Add a setup.vim file that sets 'runtimepath' and $HOME to a safe + value. (partly by Christian Brabandt, closes #912) +Files: src/testdir/setup.vim, src/testdir/amiga.vim, src/testdir/dos.vim, + src/testdir/unix.vim, src/testdir/vms.vim, src/testdir/runtest.vim + +Patch 7.4.2032 (after 7.4.2030) +Problem: Build fails with 64 bit MinGW. (Axel Bender) +Solution: Handle dash vs. underscore. (Ken Takata, Hirohito Higashi) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2033 +Problem: 'cscopequickfix' option does not accept new value "a". +Solution: Adjust list of command characters. (Ken Takata) +Files: src/option.h, src/Makefile, src/testdir/test_cscope.vim, + src/testdir/Make_all.mak + +Patch 7.4.2034 (after 7.4.2032) +Problem: Build fails with some version of MinGW. (illusorypan) +Solution: Recognize mingw32. (Ken Takata, closes #921) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2035 +Problem: On Solaris with ZFS the ACL may get removed. +Solution: Always restore the ACL for Solaris ZFS. (Danek Duvall) +Files: src/fileio.c + +Patch 7.4.2036 +Problem: Looking up a buffer by number is slow if there are many. +Solution: Use a hashtab. +Files: src/structs.h, src/buffer.c + +Patch 7.4.2037 (after 7.4.2036) +Problem: Small build fails. +Solution: Adjust #ifdefs. +Files: src/hashtab.c + +Patch 7.4.2038 (after 7.4.2036) +Problem: Small build still fails. +Solution: Adjust more #ifdefs. +Files: src/globals.h, src/buffer.c + +Patch 7.4.2039 +Problem: The Netbeans integration is not tested. +Solution: Add a first Netbeans test. +Files: src/testdir/test_netbeans.vim, src/testdir/test_netbeans.py, + src/testdir/Make_all.mak, src/Makefile, + src/testdir/test_channel.vim, src/testdir/shared.vim + +Patch 7.4.2040 +Problem: New files missing from distribution. +Solution: Add new test scripts. +Files: Filelist + +Patch 7.4.2041 +Problem: Netbeans file authentication not tested. +Solution: Add a test. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2042 +Problem: GTK: display updating is not done properly and can be slow. +Solution: Use gdk_display_flush() instead of gdk_display_sync(). Don't call + gdk_window_process_updates(). (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.2043 +Problem: setbuvfar() causes a screen redraw. +Solution: Only use aucmd_prepbuf() for options. +Files: src/eval.c + +Patch 7.4.2044 +Problem: filter() and map() either require a string or defining a function. +Solution: Support lambda, a short way to define a function that evaluates an + expression. (Yasuhiro Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_alot.vim, + src/Makefile, src/testdir/test_channel.vim, + src/testdir/test_lambda.vim + +Patch 7.4.2045 +Problem: Memory leak when using a function callback. +Solution: Don't save the function name when it's in the partial. +Files: src/channel.c + +Patch 7.4.2046 +Problem: The qf_init_ext() function is too big. +Solution: Refactor it. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.2047 +Problem: Compiler warning for initializing a struct. +Solution: Initialize in another way. (Anton Lindqvist) +Files: src/quickfix.c + +Patch 7.4.2048 +Problem: There is still code and help for unsupported systems. +Solution: Remove the code and text. (Hirohito Higashi) +Files: runtime/doc/eval.txt, runtime/lang/menu_sk_sk.vim, + runtime/menu.vim, runtime/optwin.vim, src/Make_bc5.mak, + src/ex_docmd.c, src/feature.h, src/fileio.c, src/globals.h, + src/main.c, src/memfile.c, src/memline.c, src/misc1.c, + src/misc2.c, src/option.c, src/option.h, src/os_unix.c, + src/os_unix.h, src/proto.h, src/term.c, src/undo.c, src/version.c, + src/vim.h, src/xxd/xxd.c + +Patch 7.4.2049 +Problem: There is no way to get a list of the error lists. +Solution: Add ":chistory" and ":lhistory". +Files: src/ex_cmds.h, src/quickfix.c, src/ex_docmd.c, src/message.c, + src/proto/quickfix.pro, src/testdir/test_quickfix.vim + +Patch 7.4.2050 +Problem: When using ":vimgrep" may end up with duplicate buffers. +Solution: When adding an error list entry pass the buffer number if possible. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2051 +Problem: No proper testing of trunc_string(). +Solution: Add a unittest for message.c. +Files: src/Makefile, src/message.c, src/message_test.c, src/main.c, + src/proto/main.pro, src/structs.h + +Patch 7.4.2052 +Problem: Coverage report is messed up by the unittests. +Solution: Add a separate test target for script tests. Use that when + collecting coverage information. +Files: src/Makefile + +Patch 7.4.2053 +Problem: Can't run scripttests in the top directory. +Solution: Add targets to the top Makefile. +Files: Makefile + +Patch 7.4.2054 (after 7.4.2048) +Problem: Wrong part of #ifdef removed. +Solution: Use the right part. (Hirohito Higashi) +Files: src/os_unix.c + +Patch 7.4.2055 +Problem: eval.c is too big +Solution: Move Dictionary functions to dict.c +Files: src/eval.c, src/dict.c, src/vim.h, src/globals.h, + src/proto/eval.pro, src/proto/dict.pro, src/Makefile, Filelist + +Patch 7.4.2056 (after 7.4.2055) +Problem: Build fails. +Solution: Add missing changes. +Files: src/proto.h + +Patch 7.4.2057 +Problem: eval.c is too big. +Solution: Move List functions to list.c +Files: src/eval.c, src/dict.c, src/list.c, src/proto.h, src/Makefile, + src/globals.h, src/proto/eval.pro, src/proto/list.pro, Filelist + +Patch 7.4.2058 +Problem: eval.c is too big. +Solution: Move user functions to userfunc.c +Files: src/userfunc.c, src/eval.c, src/vim.h, src/globals.h, + src/structs.h, src/proto.h, src/Makefile, src/proto/eval.pro, + src/proto/userfunc.pro, Filelist + +Patch 7.4.2059 +Problem: Non-Unix builds fail. +Solution: Update Makefiles for new files. +Files: src/Make_bc5.mak, src/Make_cyg_ming.mak, src/Make_dice.mak, + src/Make_ivc.mak, src/Make_manx.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2060 (after 7.4.2059) +Problem: Wrong file name. +Solution: Fix typo. +Files: src/Make_mvc.mak + +Patch 7.4.2061 +Problem: qf_init_ext() is too big. +Solution: Move code to qf_parse_line() (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2062 +Problem: Using dummy variable to compute struct member offset. +Solution: Use offsetof(). +Files: src/globals.h, src/macros.h, src/vim.h, src/spell.c + +Patch 7.4.2063 +Problem: eval.c is still too big. +Solution: Split off internal functions to evalfunc.c. +Files: src/eval.c, src/evalfunc.c, src/list.c, src/proto.h, + src/globals.h, src/vim.h, src/proto/eval.pro, + src/proto/evalfunc.pro, src/proto/list.pro, src/Makefile, Filelist, + src/Make_bc5.mak, src/Make_cyg_ming.mak, src/Make_dice.mak, + src/Make_ivc.mak, src/Make_manx.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2064 +Problem: Coverity warns for possible buffer overflow. +Solution: Use vim_strcat() instead of strcat(). +Files: src/quickfix.c + +Patch 7.4.2065 +Problem: Compiler warns for uninitialized variable. (John Marriott) +Solution: Set lnum to the right value. +Files: src/evalfunc.c + +Patch 7.4.2066 +Problem: getcompletion() not well tested. +Solution: Add more testing. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2067 +Problem: Compiler warning for char/char_u conversion. (Tony Mechelynck) + Inefficient code. +Solution: Use more lines to fill with spaces. (Nikolai Pavlov) Add type cast. +Files: src/quickfix.c + +Patch 7.4.2068 +Problem: Not all arguments of trunc_string() are tested. Memory access + error when running the message tests. +Solution: Add another test case. (Yegappan Lakshmanan) Make it easy to run + unittests with valgrind. Fix the access error. +Files: src/message.c, src/message_test.c, src/Makefile + +Patch 7.4.2069 +Problem: spell.c is too big. +Solution: Split it in spell file handling and spell checking. +Files: src/spell.c, src/spellfile.c, src/spell.h, src/Makefile, + src/proto/spell.pro, src/proto/spellfile.pro, src/proto.h + Filelist, src/Make_bc5.mak, src/Make_cyg_ming.mak, + src/Make_dice.mak, src/Make_ivc.mak, src/Make_manx.mak, + src/Make_morph.mak, src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2070 (after 7.4.2069) +Problem: Missing change to include file. +Solution: Include the spell header file. +Files: src/vim.h + +Patch 7.4.2071 +Problem: The return value of type() is difficult to use. +Solution: Define v:t_ constants. (Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/evalfunc.c, + src/testdir/test_channel.vim, src/testdir/test_viml.vim, src/vim.h + +Patch 7.4.2072 +Problem: substitute() does not support a Funcref argument. +Solution: Support a Funcref like it supports a string starting with "\=". +Files: src/evalfunc.c, src/regexp.c, src/eval.c, src/proto/eval.pro, + src/proto/regexp.pro, src/testdir/test_expr.vim + +Patch 7.4.2073 +Problem: rgb.txt is read for every color name. +Solution: Load rgb.txt once. (Christian Brabandt) Add a test. +Files: runtime/rgb.txt, src/term.c, src/testdir/test_syn_attr.vim + +Patch 7.4.2074 +Problem: One more place using a dummy variable. +Solution: Use offsetof(). (Ken Takata) +Files: src/userfunc.c + +Patch 7.4.2075 +Problem: No autocommand event to initialize a window or tab page. +Solution: Add WinNew and TabNew events. (partly by Felipe Morales) +Files: src/fileio.c, src/window.c, src/vim.h, + src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt + +Patch 7.4.2076 +Problem: Syntax error when dict has '>' key. +Solution: Check for endchar. (Ken Takata) +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2077 +Problem: Cannot update 'tabline' when a tab was closed. +Solution: Add the TabClosed autocmd event. (partly by Felipe Morales) +Files: src/fileio.c, src/window.c, src/vim.h, + src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt + +Patch 7.4.2078 +Problem: Running checks in po directory fails. +Solution: Add colors used in syntax.c to the builtin color table. +Files: src/term.c + +Patch 7.4.2079 +Problem: Netbeans test fails on non-Unix systems. +Solution: Only do the permission check on Unix systems. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2080 +Problem: When using PERROR() on some systems assert_fails() does not see + the error. +Solution: Make PERROR() always report the error. +Files: src/vim.h, src/message.c, src/proto/message.pro + +Patch 7.4.2081 +Problem: Line numbers in the error list are not always adjusted. +Solution: Set b_has_qf_entry properly. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/structs.h, src/testdir/test_quickfix.vim + +Patch 7.4.2082 +Problem: Not much test coverage for digraphs. +Solution: Add a new style digraph test. (Christian Brabandt) +Files: src/Makefile, src/testdir/test_alot.vim, + src/testdir/test_digraph.vim + +Patch 7.4.2083 +Problem: Coverity complains about not restoring a value. +Solution: Restore the value, although it's not really needed. Change return + to jump to cleanup, might leak memory. +Files: src/userfunc.c + +Patch 7.4.2084 +Problem: New digraph test makes testing hang. +Solution: Don't set "nocp". +Files: src/testdir/test_digraph.vim + +Patch 7.4.2085 +Problem: Digraph tests fails on some systems. +Solution: Run it separately and set 'encoding' early. +Files: src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/test_digraph.vim + +Patch 7.4.2086 +Problem: Using the system default encoding makes tests unpredictable. +Solution: Always use utf-8 or latin1 in the new style tests. Remove setting + encoding and scriptencoding where it is not needed. +Files: src/testdir/runtest.vim, src/testdir/test_channel.vim, + src/testdir/test_digraph.vim, src/testdir/test_expand_dllpath.vim, + src/testdir/test_expr_utf8.vim, src/testdir/test_json.vim, + src/testdir/test_matchadd_conceal_utf8.vim, + src/testdir/test_regexp_utf8.vim, src/testdir/test_visual.vim, + src/testdir/test_alot_utf8.vim, + +Patch 7.4.2087 +Problem: Digraph code test coverage is still low. +Solution: Add more tests. (Christian Brabandt) +Files: src/testdir/test_digraph.vim + +Patch 7.4.2088 (after 7.4.2087) +Problem: Keymap test fails with normal features. +Solution: Bail out if the keymap feature is not supported. +Files: src/testdir/test_digraph.vim + +Patch 7.4.2089 +Problem: Color handling of X11 GUIs is too complicated. +Solution: Simplify the code. Use RGBA where appropriate. (Kazunobu + Kuriyama) +Files: src/gui.h, src/gui_beval.c, src/gui_gtk_x11.c, src/netbeans.c + +Patch 7.4.2090 +Problem: Using submatch() in a lambda passed to substitute() is verbose. +Solution: Use a static list and pass it as an optional argument to the + function. Fix memory leak. +Files: src/structs.h, src/list.c, src/userfunc.c, src/channel.c, + src/eval.c, src/evalfunc.c, src/ex_cmds2.c, src/regexp.c, + src/proto/list.pro, src/proto/userfunc.pro, + src/testdir/test_expr.vim, runtime/doc/eval.txt + +Patch 7.4.2091 +Problem: Coverity reports a resource leak when out of memory. +Solution: Close the file before returning. +Files: src/term.c + +Patch 7.4.2092 +Problem: GTK 3 build fails with older GTK version. +Solution: Check the pango version. (Kazunobu Kuriyama) +Files: src/gui_beval.c + +Patch 7.4.2093 +Problem: Netbeans test fails once in a while. Leaving log file behind. +Solution: Add it to the list of flaky tests. Disable logfile. +Files: src/testdir/runtest.vim, src/testdir/test_channel.vim + +Patch 7.4.2094 +Problem: The color allocation in X11 is overly complicated. +Solution: Remove find_closest_color(), XAllocColor() already does this. + (Kazunobu Kuriyama) +Files: src/gui_x11.c + +Patch 7.4.2095 +Problem: Man test fails when run with the GUI. +Solution: Adjust for different behavior of GUI. Add assert_inrange(). +Files: src/eval.c, src/evalfunc.c, src/proto/eval.pro, + src/testdir/test_assert.vim, src/testdir/test_man.vim, + runtime/doc/eval.txt + +Patch 7.4.2096 +Problem: Lambda functions show up with completion. +Solution: Don't show lambda functions. (Ken Takata) +Files: src/userfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2097 +Problem: Warning from 64 bit compiler. +Solution: use size_t instead of int. (Mike Williams) +Files: src/message.c + +Patch 7.4.2098 +Problem: Text object tests are old style. +Solution: Turn them into new style tests. (James McCoy, closes #941) +Files: src/testdir/Make_all.mak, src/testdir/test_textobjects.in, + src/testdir/test_textobjects.ok, src/testdir/test_textobjects.vim, + src/Makefile + +Patch 7.4.2099 +Problem: When a keymap is active only "(lang)" is displayed. (Ilya + Dogolazky) +Solution: Show the keymap name. (Dmitri Vereshchagin, closes #933) +Files: src/buffer.c, src/proto/screen.pro, src/screen.c + +Patch 7.4.2100 +Problem: "cgn" and "dgn" do not work correctly with a single character + match and the replacement includes the searched pattern. (John + Beckett) +Solution: If the match is found in the wrong column try in the next column. + Turn the test into new style. (Christian Brabandt) +Files: src/search.c, src/testdir/Make_all.mak, src/Makefile, + src/testdir/test53.in, src/testdir/test53.ok, + src/testdir/test_gn.vim + +Patch 7.4.2101 +Problem: Looping over windows, buffers and tab pages is inconsistent. +Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan) +Files: src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c, + src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/fileio.c, + src/globals.h, src/gui.c, src/gui_mac.c, src/if_lua.c, + src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/if_tcl.c, + src/main.c, src/mark.c, src/memfile.c, src/memline.c, src/misc1.c, + src/move.c, src/netbeans.c, src/normal.c, src/option.c, + src/quickfix.c, src/screen.c, src/spell.c, src/term.c, + src/window.c, src/workshop.c + +Patch 7.4.2102 (after 7.4.2101) +Problem: Tiny build with GUI fails. +Solution: Revert one FOR_ALL_ change. +Files: src/gui.c + +Patch 7.4.2103 +Problem: Can't have "augroup END" right after ":au!". +Solution: Check for the bar character before the command argument. +Files: src/fileio.c, src/testdir/test_autocmd.vim, + runtime/doc/autocmd.txt + +Patch 7.4.2104 +Problem: Code duplication when unreferencing a function. +Solution: De-duplicate. +Files: src/userfunc.c + +Patch 7.4.2105 +Problem: Configure reports default features to be "normal" while it is + "huge". +Solution: Change the default text. Build with newer autoconf. +Files: src/configure.in, src/auto/configure + +Patch 7.4.2106 +Problem: Clang warns about missing field in initializer. +Solution: Define COMMA and use it. (Kazunobu Kuriyama) +Files: src/ex_cmds.c, src/globals.h, src/vim.h + +Patch 7.4.2107 (after 7.4.2106) +Problem: Misplaced equal sign. +Solution: Remove it. +Files: src/globals.h + +Patch 7.4.2108 +Problem: Netbeans test is flaky. +Solution: Wait for the cursor to be positioned. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2109 +Problem: Setting 'display' to "lastline" is a drastic change, while + omitting it results in lots of "@" lines. +Solution: Add "truncate" to show "@@@" for a truncated line. +Files: src/option.h, src/screen.c, runtime/doc/options.txt + +Patch 7.4.2110 +Problem: When there is an CmdUndefined autocmd then the error for a missing + command is E464 instead of E492. (Manuel Ortega) +Solution: Don't let the pointer be NULL. +Files: src/ex_docmd.c, src/testdir/test_usercommands.vim + +Patch 7.4.2111 +Problem: Defaults are very conservative. +Solution: Move settings from vimrc_example.vim to defaults.vim. Load + defaults.vim if no .vimrc was found. +Files: src/main.c, src/version.c, src/os_amiga.h, src/os_dos.h, + src/os_mac.h, src/os_unix.h, src/feature.h, src/Makefile, + runtime/vimrc_example.vim, runtime/defaults.vim, + runtime/evim.vim, Filelist, runtime/doc/starting.txt + +Patch 7.4.2112 +Problem: getcompletion(.., 'dir') returns a match with trailing "*" when + there are no matches. (Chdiza) +Solution: Return an empty list when there are no matches. Add a trailing + slash to directories. (Yegappan Lakshmanan) Add tests for no + matches. (closes #947) +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2113 +Problem: Test for undo is flaky. +Solution: Turn it into a new style test. Use test_settime() to avoid + flakyness. +Files: src/Makefile, src/undo.c, src/testdir/test61.in, + src/testdir/test61.ok, src/testdir/test_undo.vim, + src/testdir/test_undolevels.vim, src/testdir/Make_all.mak, + src/testdir/test_alot.vim + +Patch 7.4.2114 +Problem: Tiny build fails. +Solution: Always include vim_time(). +Files: src/ex_cmds.c + +Patch 7.4.2115 +Problem: Loading defaults.vim with -C argument. +Solution: Don't load the defaults script with -C argument. Test sourcing + the defaults script. Set 'display' to "truncate". +Files: src/main.c, src/Makefile, runtime/defaults.vim, + src/testdir/test_startup.vim, src/testdir/Make_all.mak + +Patch 7.4.2116 +Problem: The default vimrc for Windows is very conservative. +Solution: Use the defaults.vim in the Windows installer. +Files: src/dosinst.c + +Patch 7.4.2117 +Problem: Deleting an augroup that still has autocmds does not give a + warning. The next defined augroup takes its place. +Solution: Give a warning and prevent the index being used for another group + name. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2118 +Problem: Mac: can't build with tiny features. +Solution: Don't define FEAT_CLIPBOARD unconditionally. (Kazunobu Kuriyama) +Files: src/vim.h + +Patch 7.4.2119 +Problem: Closures are not supported. +Solution: Capture variables in lambdas from the outer scope. (Yasuhiro + Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_cmds2.c, src/globals.h, + src/proto/eval.pro, src/proto/userfunc.pro, + src/testdir/test_lambda.vim, src/userfunc.c + +Patch 7.4.2120 +Problem: User defined functions can't be a closure. +Solution: Add the "closure" argument. Allow using :unlet on a bound + variable. (Yasuhiro Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/testdir/test_lambda.vim, src/userfunc.c, + src/eval.c src/proto/userfunc.pro + +Patch 7.4.2121 +Problem: No easy way to check if lambda and closure are supported. +Solution: Add the +lambda feature. +Files: src/evalfunc.c, src/version.c, src/testdir/test_lambda.vim + +Patch 7.4.2122 (after 7.4.2118) +Problem: Mac: don't get +clipboard in huge build. +Solution: Move #define down below including feature.h +Files: src/vim.h + +Patch 7.4.2123 +Problem: No new style test for diff mode. +Solution: Add a test. Check that folds are in sync. +Files: src/Makefile, src/testdir/test_diffmode.vim, + src/testdir/Make_all.mak, src/testdir/test47.in, + src/testdir/test47.ok + +Patch 7.4.2124 +Problem: diffmode test leaves files behind, breaking another test. +Solution: Delete the files. +Files: src/testdir/test_diffmode.vim + +Patch 7.4.2125 +Problem: Compiler warning for loss of data. +Solution: Add a type cast. (Christian Brabandt) +Files: src/message.c + +Patch 7.4.2126 +Problem: No tests for :diffget and :diffput +Solution: Add tests. +Files: src/testdir/test_diffmode.vim + +Patch 7.4.2127 +Problem: The short form of ":noswapfile" is ":noswap" instead of ":nos". + (Kent Sibilev) +Solution: Only require three characters. Add a test for the short forms. +Files: src/ex_docmd.c, src/testdir/test_usercommands.vim + +Patch 7.4.2128 +Problem: Memory leak when saving for undo fails. +Solution: Free allocated memory. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.2129 +Problem: Memory leak when using timer_start(). (Dominique Pelle) +Solution: Don't copy the callback when using a partial. +Files: src/evalfunc.c + +Patch 7.4.2130 +Problem: Pending timers cause false memory leak reports. +Solution: Free all timers on exit. +Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/misc2.c + +Patch 7.4.2131 +Problem: More memory leaks when using partial, e.g. for "exit-cb". +Solution: Don't copy the callback when using a partial. +Files: src/channel.c + +Patch 7.4.2132 +Problem: test_partial has memory leaks reported. +Solution: Add a note about why this happens. +Files: src/testdir/test_partial.vim + +Patch 7.4.2133 (after 7.4.2128) +Problem: Can't build with tiny features. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.2134 +Problem: No error for using function() badly. +Solution: Check for passing wrong function name. (Ken Takata) +Files: src/eval.c, src/evalfunc.c, src/proto/userfunc.pro, + src/testdir/test_expr.vim, src/userfunc.c, src/vim.h + +Patch 7.4.2135 +Problem: Various tiny issues. +Solution: Update comments, white space, etc. +Files: src/diff.c, src/digraph.c, src/testdir/test80.in, + src/testdir/test_channel.vim, src/testdir/Makefile, + runtime/menu.vim, src/INSTALLpc.txt, src/xpm/README.txt + +Patch 7.4.2136 +Problem: Closure function fails. +Solution: Don't reset uf_scoped when it points to another funccal. +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2137 +Problem: Using function() with a name will find another function when it is + redefined. +Solution: Add funcref(). Refer to lambda using a partial. Fix several + reference counting issues. +Files: src/vim.h, src/structs.h, src/userfunc.c, src/eval.c, + src/evalfunc.c, src/channel.c, src/proto/eval.pro, + src/proto/userfunc.pro, src/if_mzsch.c, src/regexp.c, src/misc2.c, + src/if_py_both.h, src/testdir/test_expr.vim, runtime/doc/eval.txt + +Patch 7.4.2138 +Problem: Test 86 and 87 fail. +Solution: Call func_ref() also for regular functions. +Files: src/if_py_both.h + +Patch 7.4.2139 +Problem: :delfunction causes illegal memory access. +Solution: Correct logic when deciding to free a function. +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2140 +Problem: Tiny build fails. +Solution: Add dummy typedefs. +Files: src/structs.h + +Patch 7.4.2141 +Problem: Coverity reports bogus NULL check. +Solution: When checking for a variable in the funccal scope don't pass the + varname. +Files: src/userfunc.c, src/proto/userfunc.pro, src/eval.c + +Patch 7.4.2142 +Problem: Leaking memory when redefining a function. +Solution: Don't increment the function reference count when it's found by + name. Don't remove the wrong function from the hashtab. More + reference counting fixes. +Files: src/structs.h, src/userfunc.c + +Patch 7.4.2143 +Problem: A funccal is garbage collected while it can still be used. +Solution: Set copyID in all referenced functions. Do not list lambda + functions with ":function". +Files: src/userfunc.c, src/proto/userfunc.pro, src/eval.c, + src/testdir/test_lambda.vim + +Patch 7.4.2144 +Problem: On MS-Windows quickfix does not handle a line with 1023 bytes + ending in CR-LF properly. +Solution: Don't consider CR a line break. (Ken Takata) +Files: src/quickfix.c + +Patch 7.4.2145 +Problem: Win32: Using CreateThread/ExitThread is not safe. +Solution: Use _beginthreadex and return from the thread. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.2146 +Problem: Not enough testing for popup menu. CTRL-E does not always work + properly. +Solution: Add more tests. When using CTRL-E check if the popup menu is + visible. (Christian Brabandt) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2147 (after 7.4.2146) +Problem: test_alot fails. +Solution: Close window. +Files: src/testdir/test_popup.vim + +Patch 7.4.2148 +Problem: Not much testing for cscope. +Solution: Add a test that uses the cscope program. (Christian Brabandt) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2149 +Problem: If a test leaves a window open a following test may fail. +Solution: Always close extra windows after running a test. +Files: src/testdir/runtest.vim, src/testdir/test_popup.vim + +Patch 7.4.2150 +Problem: Warning with MinGW 64. (John Marriott) +Solution: Change return type. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.2151 +Problem: Quickfix test fails on MS-Windows. +Solution: Close the help window. (Christian Brabandt) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.2152 +Problem: No proper translation of messages with a count. +Solution: Use ngettext(). (Sergey Alyoshin) +Files: src/evalfunc.c, src/fold.c, src/os_win32.c, src/screen.c, src/vim.h + +Patch 7.4.2153 +Problem: GUI test isn't testing much. +Solution: Turn into a new style test. Execute a shell command. +Files: src/testdir/test_gui.vim, src/testdir/test16.in, + src/testdir/test16.ok, src/testdir/Make_all.mak, src/Makefile, + src/testdir/Make_vms.mms + +Patch 7.4.2154 +Problem: Test_communicate() fails sometimes. +Solution: Add it to the flaky tests. +Files: src/testdir/runtest.vim + +Patch 7.4.2155 +Problem: Quotes make GUI test fail on MS-Windows. +Solution: Remove quotes, strip white space. +Files: src/testdir/test_gui.vim + +Patch 7.4.2156 +Problem: Compiler warning. +Solution: Add type cast. (Ken Takata, Mike Williams) +Files: src/os_win32.c + +Patch 7.4.2157 +Problem: Test_job_start_fails() is expected to report memory leaks, making + it hard to see other leaks in test_partial. +Solution: Move Test_job_start_fails() to a separate test file. +Files: src/testdir/test_partial.vim, src/testdir/test_job_fails.vim, + src/Makefile, src/testdir/Make_all.mak + +Patch 7.4.2158 +Problem: Result of getcompletion('', 'cscope') depends on previous + completion. (Christian Brabandt) +Solution: Call set_context_in_cscope_cmd(). +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2159 +Problem: Insufficient testing for cscope. +Solution: Add more tests. (Dominique Pelle) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2160 +Problem: setmatches() mixes up values. (Nikolai Pavlov) +Solution: Save the string instead of reusing a shared buffer. +Files: src/dict.c, src/evalfunc.c, src/testdir/test_expr.vim, + +Patch 7.4.2161 (after 7.4.2160) +Problem: Expression test fails without conceal feature. +Solution: Only check "conceal" with the conceal feature. +Files: src/testdir/test_expr.vim + +Patch 7.4.2162 +Problem: Result of getcompletion('', 'sign') depends on previous + completion. +Solution: Call set_context_in_sign_cmd(). (Dominique Pelle) +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2163 +Problem: match() and related functions tested with old style test. +Solution: Convert to new style test. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test63.in, + src/testdir/test63.ok, src/testdir/test_alot.vim, + src/testdir/test_match.vim, src/testdir/test_matchstrpos.vim + +Patch 7.4.2164 +Problem: It is not possible to use plugins in an "after" directory to tune + the behavior of a package. +Solution: First load plugins from non-after directories, then packages and + finally plugins in after directories. + Reset 'loadplugins' before executing --cmd arguments. +Files: src/main.c, src/vim.h, src/ex_cmds2.c, src/testdir/Makefile, + src/testdir/shared.vim, src/testdir/test_startup.vim, + src/testdir/setup.vim, runtime/doc/starting.txt + +Patch 7.4.2165 (after 7.4.2164) +Problem: Startup test fails on MS-Windows. +Solution: Don't check output if RunVim() returns zero. +Files: src/testdir/test_startup.vim + +Patch 7.4.2166 (after 7.4.2164) +Problem: Small build can't run startup test. +Solution: Skip the test. +Files: src/testdir/test_startup.vim + +Patch 7.4.2167 (after 7.4.2164) +Problem: Small build can't run tests. +Solution: Don't try setting 'packpath'. +Files: src/testdir/setup.vim + +Patch 7.4.2168 +Problem: Not running the startup test on MS-Windows. +Solution: Write vimcmd. +Files: src/testdir/Make_ming.mak, src/testdir/Make_dos.mak + +Patch 7.4.2169 (after 7.4.2168) +Problem: Startup test gets stuck on MS-Windows. +Solution: Use double quotes. +Files: src/testdir/shared.vim, src/testdir/test_startup.vim + +Patch 7.4.2170 +Problem: Cannot get information about timers. +Solution: Add timer_info(). +Files: src/evalfunc.c, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + runtime/doc/eval.txt + +Patch 7.4.2171 (after 7.4.2170) +Problem: MS-Windows build fails. +Solution: Add QueryPerformanceCounter(). +Files: src/ex_cmds2.c + +Patch 7.4.2172 +Problem: No test for "vim --help". +Solution: Add a test. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2173 (after 7.4.2172) +Problem: Can't test help on MS-Windows. +Solution: Skip the test. +Files: src/testdir/test_startup.vim + +Patch 7.4.2174 +Problem: Adding duplicate flags to 'whichwrap' leaves commas behind. +Solution: Also remove the commas. (Naruhiko Nishino) +Files: src/Makefile, src/option.c, src/testdir/Make_all.mak, + src/testdir/test_alot.vim, src/testdir/test_options.in, + src/testdir/test_options.ok, src/testdir/test_options.vim + +Patch 7.4.2175 +Problem: Insufficient testing of cscope. +Solution: Add more tests. (Dominique Pelle) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2176 +Problem: #ifdefs in main() are complicated. +Solution: Always define vim_main2(). Move params to the file level. + (suggested by Ken Takata) +Files: src/main.c, src/structs.h, src/vim.h, src/if_mzsch.c, + src/proto/if_mzsch.pro + +Patch 7.4.2177 +Problem: No testing for -C and -N command line flags, file arguments, + startuptime. +Solution: Add tests. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2178 +Problem: No test for reading from stdin. +Solution: Add a test. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2179 (after 7.4.2178) +Problem: Reading from stdin test fails on MS-Windows. +Solution: Strip the extra space. +Files: src/testdir/test_startup.vim + +Patch 7.4.2180 +Problem: There is no easy way to stop all timers. There is no way to + temporary pause a timer. +Solution: Add timer_stopall() and timer_pause(). +Files: src/evalfunc.c, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + src/structs.h, src/testdir/test_timers.vim, + src/testdir/shared.vim, runtime/doc/eval.txt + +Patch 7.4.2181 +Problem: Compiler warning for unused variable. +Solution: Remove it. (Dominique Pelle) +Files: src/ex_cmds2.c + +Patch 7.4.2182 +Problem: Color Grey40 used in startup but not in the short list. +Solution: Add Grey40 to the builtin colors. +Files: src/term.c + +Patch 7.4.2183 +Problem: Sign tests are old style. +Solution: Turn them into new style tests. (Dominique Pelle) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_signs.in, + src/testdir/test_signs.ok, src/testdir/test_signs.vim, + +Patch 7.4.2184 +Problem: Tests that use RunVim() do not actually perform the test. +Solution: Use "return" instead of "call". (Ken Takata) +Files: src/testdir/shared.vim + +Patch 7.4.2185 +Problem: Test glob2regpat does not test much. +Solution: Add a few more test cases. (Dominique Pelle) +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2186 +Problem: Timers test is flaky. +Solution: Relax the sleep time check. +Files: src/testdir/test_timers.vim + +Patch 7.4.2187 (after 7.4.2185) +Problem: glob2regpat test fails on Windows. +Solution: Remove the checks that use backslashes. +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2188 (after 7.4.2146) +Problem: Completion does not work properly with some plugins. +Solution: Revert the part related to typing CTRL-E. (closes #972) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2189 +Problem: Cannot detect encoding in a fifo. +Solution: Extend the stdin way of detecting encoding to fifo. Add a test + for detecting encoding on stdin and fifo. (Ken Takata) +Files: src/buffer.c, src/fileio.c, src/Makefile, + src/testdir/Make_all.mak, src/testdir/test_startup_utf8.vim, + src/vim.h + +Patch 7.4.2190 +Problem: When startup test fails it's not easy to find out why. + GUI test fails with Gnome. +Solution: Add the help entry matches to a list an assert that. + Set $HOME for Gnome to create .gnome2 directory. +Files: src/testdir/test_startup.vim, src/testdir/test_gui.vim + +Patch 7.4.2191 +Problem: No automatic prototype for vim_main2(). +Solution: Move the #endif. (Ken Takata) +Files: src/main.c, src/vim.h, src/proto/main.pro + +Patch 7.4.2192 +Problem: Generating prototypes with Cygwin doesn't work well. +Solution: Change #ifdefs. (Ken Takata) +Files: src/gui.h, src/gui_w32.c, src/ops.c, src/proto/fileio.pro, + src/proto/message.pro, src/proto/normal.pro, src/proto/ops.pro, + src/vim.h + +Patch 7.4.2193 +Problem: With Gnome when the GUI can't start test_startup hangs. +Solution: Call gui_mch_early_init_check(). (Hirohito Higashi) +Files: src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro + +Patch 7.4.2194 +Problem: Sign tests don't cover enough. +Solution: Add more test cases. (Dominique Pelle) +Files: src/testdir/test_signs.vim + +Patch 7.4.2195 +Problem: MS-Windows: The vimrun program does not support Unicode. +Solution: Use GetCommandLineW(). Cleanup old #ifdefs. (Ken Takata) +Files: src/vimrun.c + +Patch 7.4.2196 +Problem: glob2regpat test doesn't test everything on MS-Windows. +Solution: Add patterns with backslash handling. +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2197 +Problem: All functions are freed on exit, which may hide leaks. +Solution: Only free named functions, not reference counted ones. +Files: src/userfunc.c + +Patch 7.4.2198 +Problem: Test alot sometimes fails under valgrind. (Dominique Pelle) +Solution: Avoid passing a callback with the wrong number of arguments. +Files: src/testdir/test_partial.vim + +Patch 7.4.2199 +Problem: In the GUI the cursor is hidden when redrawing any window, + causing flicker. +Solution: Only undraw the cursor when updating the window it's in. +Files: src/screen.c, src/gui.c, src/proto/gui.pro, src/gui_gtk_x11.c + +Patch 7.4.2200 +Problem: Cannot get all information about a quickfix list. +Solution: Add an optional argument to get/set loc/qf list(). (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/proto/quickfix.pro, + src/quickfix.c, src/tag.c, src/testdir/test_quickfix.vim + +Patch 7.4.2201 +Problem: The sign column disappears when the last sign is deleted. +Solution: Add the 'signcolumn' option. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/optwin.vim, src/edit.c, + src/move.c, src/option.c, src/option.h, src/proto/option.pro, + src/screen.c, src/structs.h, src/testdir/test_options.vim + +Patch 7.4.2202 +Problem: Build fails with small features. +Solution: Correct option initialization. +Files: src/option.c + +Patch 7.4.2203 +Problem: Test fails with normal features. +Solution: Check is signs are supported. +Files: src/testdir/test_options.vim + +Patch 7.4.2204 +Problem: It is not easy to get information about buffers, windows and + tabpages. +Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/dict.c, + src/evalfunc.c, src/option.c, src/proto/dict.pro, + src/proto/option.pro, src/proto/window.pro, + src/testdir/Make_all.mak, src/testdir/test_bufwintabinfo.vim, + src/window.c, src/Makefile + +Patch 7.4.2205 +Problem: 'wildignore' always applies to getcompletion(). +Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2206 +Problem: Warning for unused function. +Solution: Put the function inside #ifdef. (John Marriott) +Files: src/evalfunc.c + +Patch 7.4.2207 +Problem: The +xpm feature is not sorted properly in :version output. +Solution: Move it up. (Tony Mechelynck) +Files: src/version.c + +Patch 7.4.2208 +Problem: Test for mappings is old style. +Solution: Convert the test to new style. +Files: src/testdir/test_mapping.vim, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok, src/Makefile, + src/testdir/test_alot.vim, src/testdir/Make_all.mak + +Patch 7.4.2209 +Problem: Cannot map <M-">. (Stephen Riehm) +Solution: Solve the memory access problem in another way. (Dominique Pelle) + Allow for using <M-\"> in a string. +Files: src/eval.c, src/gui_mac.c, src/misc2.c, src/option.c, + src/proto/misc2.pro, src/syntax.c, src/term.c, + src/testdir/test_mapping.vim + +Patch 7.4.2210 +Problem: On OSX configure mixes up a Python framework and the Unix layout. +Solution: Make configure check properly. (Tim D. Smith, closes #980) +Files: src/configure.in, src/auto/configure + +Patch 7.4.2211 +Problem: Mouse support is not automatically enabled with simple term. +Solution: Recognize "st" and other names. (Manuel Schiller, closes #963) +Files: src/os_unix.c + +Patch 7.4.2212 +Problem: Mark " is not set when closing a window in another tab. (Guraga) +Solution: Check all tabs for the window to be valid. (based on patch by + Hirohito Higashi, closes #974) +Files: src/window.c, src/proto/window.pro, src/buffer.c, + src/testdir/test_viminfo.vim + +Patch 7.4.2213 +Problem: Cannot highlight the "~" lines at the end of a window differently. +Solution: Add the EndOfBuffer highlighting. (Marco Hinz, James McCoy) +Files: runtime/doc/options.txt, runtime/doc/syntax.txt, src/option.c, + src/screen.c, src/syntax.c, src/vim.h + +Patch 7.4.2214 +Problem: A font that uses ligatures messes up the screen display. +Solution: Put spaces between characters when building the glyph table. + (based on a patch from Manuel Schiller) +Files: src/gui_gtk_x11.c + +Patch 7.4.2215 +Problem: It's not easy to find out if a window is a quickfix or location + list window. +Solution: Add "loclist" and "quickfix" entries to the dict returned by + getwininfo(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2216 (after 7.4.2215) +Problem: Test fails without the +sign feature. +Solution: Only check for signcolumn with the +sign feature. +Files: src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2217 +Problem: When using matchaddpos() a character after the end of the line can + be highlighted. +Solution: Only highlight existing characters. (Hirohito Higashi) +Files: src/screen.c, src/structs.h, src/testdir/test_match.vim + +Patch 7.4.2218 +Problem: Can't build with +timers when +digraph is not included. +Solution: Change #ifdef for e_number_exp. (Damien) +Files: src/globals.h + +Patch 7.4.2219 +Problem: Recursive call to substitute gets stuck in sandbox. (Nikolai + Pavlov) +Solution: Handle the recursive call. (Christian Brabandt, closes #950) + Add a test. +Files: src/ex_cmds.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2220 +Problem: printf() gives an error when the argument for %s is not a string. + (Ozaki Kiichi) +Solution: Behave like invoking string() on the argument. (Ken Takata) +Files: runtime/doc/eval.txt, src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2221 +Problem: printf() does not support binary format. +Solution: Add %b and %B. (Ozaki Kiichi) +Files: runtime/doc/eval.txt, src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2222 +Problem: Sourcing a script where a character has 0x80 as a second byte does + not work. (Filipe L B Correia) +Solution: Turn 0x80 into K_SPECIAL KS_SPECIAL KE_FILLER. (Christian + Brabandt, closes #728) Add a test case. +Files: src/getchar.c, src/proto/getchar.pro, src/misc1.c, + src/testdir/test_regexp_utf8.vim + +Patch 7.4.2223 +Problem: Buffer overflow when using latin1 character with feedkeys(). +Solution: Check for an illegal character. Add a test. +Files: src/testdir/test_regexp_utf8.vim, src/testdir/test_source_utf8.vim, + src/testdir/test_alot_utf8.vim, src/Makefile, src/getchar.c, + src/macros.h, src/evalfunc.c, src/os_unix.c, src/os_win32.c, + src/spell.c, + +Patch 7.4.2224 +Problem: Compiler warnings with older compiler and 64 bit numbers. +Solution: Add "LL" to large values. (Mike Williams) +Files: src/eval.c, src/evalfunc.c + +Patch 7.4.2225 +Problem: Crash when placing a sign in a deleted buffer. +Solution: Check for missing buffer name. (Dominique Pelle). Add a test. +Files: src/ex_cmds.c, src/testdir/test_signs.vim + +Patch 7.4.2226 +Problem: The field names used by getbufinfo(), gettabinfo() and + getwininfo() are not consistent. +Solution: Use bufnr, winnr and tabnr. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2227 +Problem: Tab page tests are old style. +Solution: Change into new style tests. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test62.in, + src/testdir/test62.ok, src/testdir/test_alot.vim, + src/testdir/test_tabpage.vim + +Patch 7.4.2228 +Problem: Test files have inconsistent modelines. +Solution: Don't set 'tabstop' to 2, use 'sts' and 'sw'. +Files: src/testdir/README.txt, src/testdir/test_backspace_opt.vim, + src/testdir/test_digraph.vim, src/testdir/test_gn.vim + src/testdir/test_help_tagjump.vim, + src/testdir/test_increment_dbcs.vim, + src/testdir/test_increment.vim, src/testdir/test_match.vim, + src/testdir/test_tagjump.vim, src/testdir/test_window_cmd.vim, + src/testdir/test_regexp_latin.vim, src/testdir/test_timers.vim + +Patch 7.4.2229 +Problem: Startup test fails on Solaris. +Solution: Recognize a character device. (Danek Duvall) +Files: src/buffer.c, src/fileio.c, src/proto/fileio.pro, src/vim.h + +Patch 7.4.2230 +Problem: There is no equivalent of 'smartcase' for a tag search. +Solution: Add value "followscs" and "smart" to 'tagcase'. (Christian + Brabandt, closes #712) Turn tagcase test into new style. +Files: runtime/doc/options.txt, runtime/doc/tagsrch.txt, src/option.h, + src/tag.c, src/search.c, src/proto/search.pro, + src/testdir/test_tagcase.in, src/testdir/test_tagcase.ok, + src/testdir/test_tagcase.vim, src/Makefile, + src/testdir/Make_all.mak, src/testdir/test_alot.vim + +Patch 7.4.2231 +Problem: ":oldfiles" output is a very long list. +Solution: Add a pattern argument. (Coot, closes #575) +Files: runtime/doc/starting.txt, src/ex_cmds.h, src/eval.c, + src/ex_cmds.c, src/proto/eval.pro, src/proto/ex_cmds.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.2232 +Problem: The default ttimeoutlen is very long. +Solution: Use "100". (Hirohito Higashi) +Files: runtime/defaults.vim + +Patch 7.4.2233 +Problem: Crash when using funcref() with invalid name. (Dominique Pelle) +Solution: Check for NULL translated name. +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2234 +Problem: Can't build with +eval but without +quickfix. (John Marriott) +Solution: Move skip_vimgrep_pat() to separate #ifdef block. +Files: src/quickfix.c + +Patch 7.4.2235 +Problem: submatch() does not check for a valid argument. +Solution: Give an error if the argument is out of range. (Dominique Pelle) +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2236 +Problem: The 'langnoremap' option leads to double negatives. And it does + not work for the last character of a mapping. +Solution: Add 'langremap' with the opposite value. Keep 'langnoremap' for + backwards compatibility. Make it work for the last character of a + mapping. Make the test work. +Files: runtime/doc/options.txt, runtime/defaults.vim, src/option.c, + src/option.h, src/macros.h, src/testdir/test_mapping.vim + +Patch 7.4.2237 +Problem: Can't use "." and "$" with ":tab". +Solution: Support a range for ":tab". (Hirohito Higashi) +Files: runtime/doc/tabpage.txt, src/ex_docmd.c, + src/testdir/test_tabpage.vim + +Patch 7.4.2238 +Problem: With SGR mouse reporting (suckless terminal) the mouse release and + scroll up/down is confused. +Solution: Don't see a release as a scroll up/down. (Ralph Eastwood) +Files: src/term.c + +Patch 7.4.2239 +Problem: Warning for missing declaration of skip_vimgrep_pat(). (John + Marriott) +Solution: Move it to another file. +Files: src/quickfix.c, src/proto/quickfix.pro, src/ex_cmds.c, + src/proto/ex_cmds.pro + +Patch 7.4.2240 +Problem: Tests using the sleep time can be flaky. +Solution: Use reltime() if available. (Partly by Shane Harper) +Files: src/testdir/shared.vim, src/testdir/test_timers.vim + +Patch 7.4.2241 (after 7.4.2240) +Problem: Timer test sometimes fails. +Solution: Increase the maximum time for repeating timer. +Files: src/testdir/test_timers.vim + +Patch 7.4.2242 (after 7.4.2240) +Problem: Timer test sometimes fails. +Solution: Increase the maximum time for callback timer test. +Files: src/testdir/test_timers.vim + +Patch 7.4.2243 +Problem: Warning for assigning negative value to unsigned. (Danek Duvall) +Solution: Make cterm_normal_fg_gui_color and _bg_ guicolor_T, cast to long_u + only when an unsigned is needed. +Files: src/structs.h, src/globals.h, src/screen.c, src/term.c, + src/syntax.c, src/gui_gtk_x11.c, src/gui.c, src/gui_mac.c, + src/gui_photon.c, src/gui_w32.c, src/gui_x11.c, + src/proto/term.pro, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_photon.pro, + src/proto/gui_w32.pro, src/proto/gui_x11.pro + +Patch 7.4.2244 +Problem: Adding pattern to ":oldfiles" is not a generic solution. +Solution: Add the ":filter /pat/ cmd" command modifier. Only works for some + commands right now. +Files: src/structs.h, src/ex_docmd.c, src/ex_cmds.h, src/message.c, + src/proto/message.pro, runtime/doc/starting.txt, + runtime/doc/various.txt, src/testdir/test_viminfo.vim, + src/testdir/test_alot.vim, src/testdir/test_filter_cmd.vim, + src/Makefile + +Patch 7.4.2245 (after 7.4.2244) +Problem: Filter test fails. +Solution: Include missing changes. +Files: src/buffer.c + +Patch 7.4.2246 (after 7.4.2244) +Problem: Oldfiles test fails. +Solution: Include missing changes. +Files: src/ex_cmds.c + +Patch 7.4.2247 (after 7.4.2244) +Problem: Tiny build fails. (Tony Mechelynck) +Solution: Remove #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.2248 +Problem: When cancelling the :ptjump prompt a preview window is opened for + a following command. +Solution: Reset g_do_tagpreview. (Hirohito Higashi) Add a test. Avoid that + the test runner gets stuck in trying to close a window. +Files: src/tag.c, src/testdir/test_tagjump.vim, src/testdir/runtest.vim + +Patch 7.4.2249 +Problem: Missing colon in error message. +Solution: Add the colon. (Dominique Pelle) +Files: src/userfunc.c + +Patch 7.4.2250 +Problem: Some error messages cannot be translated. +Solution: Enclose them in _() and N_(). (Dominique Pelle) +Files: src/channel.c, src/evalfunc.c, src/ex_cmds.c, src/spell.c, + src/window.c + +Patch 7.4.2251 +Problem: In rare cases diffing 4 buffers is not enough. +Solution: Raise the limit to 8. (closes #1000) +Files: src/structs.h, runtime/doc/diff.txt + +Patch 7.4.2252 +Problem: Compiler warnings for signed/unsigned in expression. +Solution: Remove type cast. (Dominique Pelle) +Files: src/vim.h + +Patch 7.4.2253 +Problem: Check for Windows 3.1 will always return false. (Christian + Brabandt) +Solution: Remove the dead code. +Files: src/gui_w32.c, src/evalfunc.c, src/ex_cmds.c, src/option.c, + src/os_win32.c, src/version.c, src/proto/gui_w32.pro + +Patch 7.4.2254 +Problem: Compiler warnings in MzScheme code. +Solution: Add UNUSED. Remove unreachable code. +Files: src/if_mzsch.c + +Patch 7.4.2255 +Problem: The script that checks translations can't handle plurals. +Solution: Check for plural msgid and msgstr entries. Leave the cursor on + the first error. +Files: src/po/check.vim + +Patch 7.4.2256 +Problem: Coverity complains about null pointer check. +Solution: Remove wrong and superfluous error check. +Files: src/eval.c + +Patch 7.4.2257 +Problem: Coverity complains about not checking for NULL. +Solution: Check for out of memory. +Files: src/if_py_both.h + +Patch 7.4.2258 +Problem: Two JSON messages are sent without a separator. +Solution: Separate messages with a NL. (closes #1001) +Files: src/json.c, src/channel.c, src/vim.h, src/testdir/test_channel.py, + src/testdir/test_channel.vim, runtime/doc/channel.txt + +Patch 7.4.2259 +Problem: With 'incsearch' can only see the next match. +Solution: Make CTRL-N/CTRL-P move to the previous/next match. (Christian + Brabandt) +Files: runtime/doc/cmdline.txt, src/ex_getln.c, src/testdir/Make_all.mak, + src/testdir/test_search.vim, src/Makefile + +Patch 7.4.2260 (after 7.4.2258) +Problem: Channel test is flaky. +Solution: Add a newline to separate JSON messages. +Files: src/testdir/test_channel.vim + +Patch 7.4.2261 (after 7.4.2259) +Problem: Build fails with small features. +Solution: Move "else" inside the #ifdef. +Files: src/ex_getln.c + +Patch 7.4.2262 +Problem: Fail to read register content from viminfo if it is 438 characters + long. (John Chen) +Solution: Adjust the check for line wrapping. (closes #1010) +Files: src/testdir/test_viminfo.vim, src/ex_cmds.c + +Patch 7.4.2263 +Problem: :filter does not work for many commands. Can only get matching + messages. +Solution: Make :filter work for :command, :map, :list, :number and :print. + Make ":filter!" show non-matching lines. +Files: src/getchar.c, src/ex_cmds.c, src/ex_cmds.h, src/ex_docmd.c, + src/message.c, src/structs.h, src/testdir/test_filter_cmd.vim + +Patch 7.4.2264 +Problem: When adding entries to an empty quickfix list the title is reset. +Solution: Improve handling of the title. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim, src/quickfix.c + +Patch 7.4.2265 +Problem: printf() isn't tested much. +Solution: Add more tests for printf(). (Dominique Pelle) +Files: src/testdir/test_expr.vim + +Patch 7.4.2266 (after 7.4.2265) +Problem: printf() test fails on Windows. "-inf" is not used. +Solution: Check for Windows-specific values for "nan". Add sign to "inf" + when appropriate. +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2267 (after 7.4.2266) +Problem: Build fails on MS-Windows. +Solution: Add define to get isinf(). +Files: src/message.c + +Patch 7.4.2268 (after 7.4.2259) +Problem: Using CTRL-N and CTRL-P for incsearch shadows completion keys. +Solution: Use CTRL-T and CTRL-G instead. +Files: runtime/doc/cmdline.txt, src/ex_getln.c, + src/testdir/test_search.vim + +Patch 7.4.2269 +Problem: Using 'hlsearch' highlighting instead of matchpos if there is no + search match. +Solution: Pass NULL as last item to next_search_hl() when searching for + 'hlsearch' match. (Shane Harper, closes #1013) +Files: src/screen.c, src/testdir/test_match.vim. + +Patch 7.4.2270 +Problem: Insufficient testing for NUL bytes on a raw channel. +Solution: Add a test for writing and reading. +Files: src/testdir/test_channel.vim + +Patch 7.4.2271 +Problem: Netbeans test doesn't read settings from file. +Solution: Use "-Xnbauth". +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2272 +Problem: getbufinfo(), getwininfo() and gettabinfo() are inefficient. +Solution: Instead of making a copy of the variables dictionary, use a + reference. +Files: src/evalfunc.c + +Patch 7.4.2273 +Problem: getwininfo() and getbufinfo() are inefficient. +Solution: Do not make a copy of all window/buffer-local options. Make it + possible to get them with gettabwinvar() or getbufvar(). +Files: src/evalfunc.c, src/eval.c, src/testdir/test_bufwintabinfo.vim, + runtime/doc/eval.txt + +Patch 7.4.2274 +Problem: Command line completion on "find **/filename" drops sub-directory. +Solution: Handle this case separately. (Harm te Hennepe, closes #932, closes + #939) +Files: src/misc1.c, src/testdir/test_cmdline.vim + +Patch 7.4.2275 +Problem: ":diffoff!" does not remove filler lines. +Solution: Force a redraw and invalidate the cursor. (closes #1014) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 7.4.2276 +Problem: Command line test fails on Windows when run twice. +Solution: Wipe the buffer so that the directory can be deleted. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2277 +Problem: Memory leak in getbufinfo() when there is a sign. (Dominique + Pelle) +Solution: Remove extra vim_strsave(). +Files: src/evalfunc.c + +Patch 7.4.2278 +Problem: New users have no idea of the 'scrolloff' option. +Solution: Set 'scrolloff' in defaults.vim. +Files: runtime/defaults.vim + +Patch 7.4.2279 +Problem: Starting diff mode with the cursor in the last line might end up + only showing one closed fold. (John Beckett) +Solution: Scroll the window to show the same relative cursor position. +Files: src/diff.c, src/window.c, src/proto/window.pro + +Patch 7.4.2280 +Problem: printf() doesn't handle infinity float values correctly. +Solution: Add a table with possible infinity values. (Dominique Pelle) +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2281 +Problem: Timer test fails sometimes. +Solution: Reduce minimum time by 1 msec. +Files: src/testdir/test_timers.vim + +Patch 7.4.2282 +Problem: When a child process is very fast waiting 10 msec for it is + noticeable. (Ramel Eshed) +Solution: Start waiting for 1 msec and gradually increase. +Files: src/os_unix.c + +Patch 7.4.2283 +Problem: Part of ":oldfiles" command isn't cleared. (Lifepillar) +Solution: Clear the rest of the line. (closes 1018) +Files: src/ex_cmds.c + +Patch 7.4.2284 +Problem: Comment in scope header file is outdated. (KillTheMule) +Solution: Point to the help instead. (closes #1017) +Files: src/if_cscope.h + +Patch 7.4.2285 +Problem: Generated files are outdated. +Solution: Generate the files. Avoid errors when generating prototypes. +Files: src/if_mzsch.h, src/Makefile, src/option.h, src/os_mac_conv.c, + src/os_amiga.c, src/vim.h, src/structs.h, src/os_win32.c, + src/if_lua.c, src/proto/mbyte.pro + +Patch 7.4.2286 +Problem: The tee program isn't included. Makefile contains build + instructions that don't work. +Solution: Update the Filelist and build instructions. Remove build + instructions for DOS and old Windows. Add the tee program. +Files: Filelist, Makefile, nsis/gvim.nsi + +Patch 7.4.2287 +Problem: The callback passed to ch_sendraw() is not used. +Solution: Pass the read part, not the send part. (haya14busa, closes #1019) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.2288 +Problem: MS-Windows build instructions are clumsy. "dosbin" doesn't build. +Solution: Add rename.bat. Fix building "dosbin". +Files: Makefile, Filelist, rename.bat + +Patch 7.4.2289 +Problem: When installing and $DESTDIR is set the icons probably won't be + installed. +Solution: Create the icon directories if $DESTDIR is not empty. (Danek + Duvall) +Files: src/Makefile + +Patch 7.4.2290 +Problem: Compiler warning in tiny build. (Tony Mechelynck) +Solution: Add #ifdef around infinity_str(). +Files: src/message.c + +Patch 7.4.2291 +Problem: printf() handles floats wrong when there is a sign. +Solution: Fix placing the sign. Add tests. (Dominique Pelle) +Files: src/testdir/test_expr.vim, runtime/doc/eval.txt, src/message.c + +Patch 7.4.2292 (after 7.4.2291) +Problem: Not all systems understand %F in printf(). +Solution: Use %f. +Files: src/message.c + +Patch 7.4.2293 +Problem: Modelines in source code are inconsistent. +Solution: Use the same line in most files. Add 'noet'. (Naruhiko Nishino) +Files: src/alloc.h, src/arabic.c, src/arabic.h, src/ascii.h, + src/blowfish.c, src/buffer.c, src/channel.c, src/charset.c, + src/crypt.c, src/crypt_zip.c, src/dict.c, src/diff.c, + src/digraph.c, src/dosinst.c, src/dosinst.h, src/edit.c, + src/eval.c, src/evalfunc.c, src/ex_cmds.c, src/ex_cmds.h, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_eval.c, src/ex_getln.c, + src/farsi.c, src/farsi.h, src/feature.h, src/fileio.c, src/fold.c, + src/getchar.c, src/glbl_ime.cpp, src/glbl_ime.h, src/globals.h, + src/gui.c, src/gui.h, src/gui_at_fs.c, src/gui_at_sb.c, + src/gui_at_sb.h, src/gui_athena.c, src/gui_beval.c, + src/gui_beval.h, src/gui_gtk.c, src/gui_gtk_f.c, src/gui_gtk_f.h, + src/gui_gtk_vms.h, src/gui_gtk_x11.c, src/gui_mac.c, + src/gui_motif.c, src/gui_photon.c, src/gui_w32.c, src/gui_x11.c, + src/gui_x11_pm.h, src/gui_xmdlg.c, src/gui_xmebw.c, + src/gui_xmebw.h, src/gui_xmebwp.h, src/hangulin.c, src/hardcopy.c, + src/hashtab.c, src/if_cscope.c, src/if_cscope.h, src/if_mzsch.c, + src/if_mzsch.h, src/if_ole.cpp, src/if_perl.xs, src/if_perlsfio.c, + src/if_python3.c, src/if_ruby.c, src/if_tcl.c, src/if_xcmdsrv.c, + src/integration.c, src/integration.h, src/iscygpty.c, src/json.c, + src/json_test.c, src/keymap.h, src/list.c, src/macros.h, + src/main.c, src/mark.c, src/mbyte.c, src/memfile.c, + src/memfile_test.c, src/memline.c, src/menu.c, src/message.c, + src/message_test.c, src/misc1.c, src/misc2.c, src/move.c, + src/nbdebug.c, src/nbdebug.h, src/netbeans.c, src/normal.c, + src/ops.c, src/option.c, src/option.h, src/os_amiga.c, + src/os_amiga.h, src/os_beos.c, src/os_beos.h, src/os_dos.h, + src/os_mac.h, src/os_mac_conv.c, src/os_macosx.m, src/os_mint.h, + src/os_mswin.c, src/os_qnx.c, src/os_qnx.h, src/os_unix.c, + src/os_unix.h, src/os_unixx.h, src/os_vms.c, src/os_w32dll.c, + src/os_w32exe.c, src/os_win32.c, src/os_win32.h, src/popupmnu.c, + src/proto.h, src/pty.c, src/quickfix.c, src/regexp.c, + src/regexp.h, src/regexp_nfa.c, src/screen.c, src/search.c, + src/sha256.c, src/spell.c, src/spell.h, src/spellfile.c, + src/structs.h, src/syntax.c, src/tag.c, src/term.c, src/term.h, + src/termlib.c, src/ui.c, src/undo.c, src/uninstal.c, + src/userfunc.c, src/version.c, src/version.h, src/vim.h, + src/vim.rc, src/vimio.h, src/vimrun.c, src/winclip.c, + src/window.c, src/workshop.c, src/workshop.h, src/wsdebug.c, + src/wsdebug.h, src/xpm_w32.c + +Patch 7.4.2294 +Problem: Sign test fails on MS-Windows when using the distributed zip + archives. +Solution: Create dummy files instead of relying on files in the pixmaps + directory. +Files: src/testdir/test_signs.vim + +Patch 7.4.2295 (after 7.4.2293) +Problem: Cscope test fails. +Solution: Avoid checking for specific line and column numbers. +Files: src/testdir/test_cscope.vim + +Patch 7.4.2296 +Problem: No tests for :undolist and "U" command. +Solution: Add tests. (Dominique Pelle) +Files: src/testdir/test_undo.vim + +Patch 7.4.2297 +Problem: When starting a job that reads from a buffer and reaching the end, + the job hangs. +Solution: Close the pipe or socket when all lines were read. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.2298 +Problem: It is not possible to close the "in" part of a channel. +Solution: Add ch_close_in(). +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt, + runtime/doc/channel.txt + +Patch 7.4.2299 +Problem: QuickFixCmdPre and QuickFixCmdPost autocommands are not always + triggered. +Solution: Also trigger on ":cexpr", ":cbuffer", etc. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2300 +Problem: Get warning for deleting autocommand group when the autocommand + using the group is scheduled for deletion. (Pavol Juhas) +Solution: Check for deleted autocommand. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2301 +Problem: MS-Windows: some files remain after testing. +Solution: Close the channel output file. Wait for the file handle to be + closed before deleting the file. +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.2302 +Problem: Default interface versions for MS-Windows are outdated. +Solution: Use Active Perl 5.24, Python 3.5.2. Could only make it work with + Ruby 1.9.2. +Files: src/bigvim.bat, src/bigvim64.bat, src/Make_mvc.mak + +Patch 7.4.2303 +Problem: When using "is" the mode isn't always updated. +Solution: Redraw the command line. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.2304 +Problem: In a timer callback the timer itself can't be found or stopped. + (Thinca) +Solution: Do not remove the timer from the list, remember whether it was + freed. +Files: src/ex_cmds2.c, src/testdir/test_timers.vim + +Patch 7.4.2305 +Problem: Marks, writefile and nested function tests are old style. +Solution: Turn them into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test_marks.in, + src/testdir/test_marks.ok, src/testdir/test_marks.vim, + src/testdir/test_nested_function.in, + src/testdir/test_nested_function.ok, + src/testdir/test_nested_function.vim, + src/testdir/test_writefile.in, src/testdir/test_writefile.ok, + src/testdir/test_writefile.vim, src/Makefile + +Patch 7.4.2306 +Problem: Default value for 'langremap' is wrong. +Solution: Set the right value. (Jürgen Krämer) Add a test. +Files: src/option.c, src/testdir/test_mapping.vim + +Patch 7.4.2307 +Problem: Several tests are old style. +Solution: Turn them into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test102.in, + src/testdir/test102.ok, src/testdir/test46.in, + src/testdir/test46.ok, src/testdir/test81.in, + src/testdir/test81.ok, src/testdir/test_charsearch.in, + src/testdir/test_charsearch.ok, src/testdir/test_charsearch.vim, + src/testdir/test_fnameescape.vim, src/testdir/test_substitute.vim, + src/Makefile + +Patch 7.4.2308 (after 7.4.2307) +Problem: Old charsearch test still listed in Makefile. +Solution: Remove the line. +Files: src/testdir/Make_all.mak + +Patch 7.4.2309 +Problem: Crash when doing tabnext in a BufUnload autocmd. (Dominique Pelle) +Solution: When detecting that the tab page changed, don't just abort but + delete the window where w_buffer is NULL. +Files: src/window.c, src/testdir/test_tabpage.vim + +Patch 7.4.2310 (after 7.4.2304) +Problem: Accessing freed memory when a timer does not repeat. +Solution: Free after removing it. (Dominique Pelle) +Files: src/ex_cmds2.c + +Patch 7.4.2311 +Problem: Appveyor 64 bit build still using Python 3.4 +Solution: Switch to Python 3.5. (Ken Takata, closes #1032) +Files: appveyor.yml, src/appveyor.bat + +Patch 7.4.2312 +Problem: Crash when autocommand moves to another tab. (Dominique Pelle) +Solution: When navigating to another window halfway the :edit command go + back to the right window. +Files: src/buffer.c, src/ex_cmds.c, src/ex_getln.c, src/ex_docmd.c, + src/window.c, src/proto/ex_getln.pro, src/testdir/test_tabpage.vim + +Patch 7.4.2313 +Problem: Crash when deleting an augroup and listing an autocommand. + (Dominique Pelle) +Solution: Make sure deleted_augroup is valid. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2314 +Problem: No error when deleting an augroup while it's the current one. +Solution: Disallow deleting an augroup when it's the current one. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2315 +Problem: Insufficient testing for Normal mode commands. +Solution: Add a big test. (Christian Brabandt, closes #1029) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_normal.vim + +Patch 7.4.2316 +Problem: Channel sort test is flaky. +Solution: Add a check the output has been read. +Files: src/testdir/test_channel.vim + +Patch 7.4.2317 (after 7.4.2315) +Problem: Normal mode tests fail on MS-Windows. +Solution: Do some tests only on Unix. Set 'fileformat' to "unix". +Files: src/testdir/test_normal.vim + +Patch 7.4.2318 +Problem: When 'incsearch' is not set CTRL-T and CTRL-G are not inserted as + before. +Solution: Move #ifdef and don't use goto. +Files: src/ex_getln.c + +Patch 7.4.2319 +Problem: No way for a system wide vimrc to stop loading defaults.vim. + (Christian Hesse) +Solution: Bail out of defaults.vim if skip_defaults_vim was set. +Files: runtime/defaults.vim + +Patch 7.4.2320 +Problem: Redraw problem when using 'incsearch'. +Solution: Save the current view when deleting characters. (Christian + Brabandt) Fix that the '" mark is set in the wrong position. Don't + change the search start when using BS. +Files: src/ex_getln.c, src/normal.c, src/testdir/test_search.vim + +Patch 7.4.2321 +Problem: When a test is commented out we forget about it. +Solution: Let a test throw an exception with "Skipped" and list skipped test + functions. (Christian Brabandt) +Files: src/testdir/Makefile, src/testdir/runtest.vim, + src/testdir/test_popup.vim, src/testdir/README.txt + +Patch 7.4.2322 +Problem: Access memory beyond the end of the line. (Dominique Pelle) +Solution: Adjust the cursor column. +Files: src/move.c, src/testdir/test_normal.vim + +Patch 7.4.2323 +Problem: Using freed memory when using 'formatexpr'. (Dominique Pelle) +Solution: Make a copy of 'formatexpr' before evaluating it. +Files: src/ops.c, src/testdir/test_normal.vim + +Patch 7.4.2324 +Problem: Crash when editing a new buffer and BufUnload autocommand wipes + out the new buffer. (Norio Takagi) +Solution: Don't allow wiping out this buffer. (partly by Hirohito Higashi) + Move old style test13 into test_autocmd. Avoid ml_get error when + editing a file. +Files: src/structs.h, src/buffer.c, src/ex_cmds.c, src/ex_docmd.c, + src/window.c, src/testdir/test13.in, src/testdir/test13.ok, + src/testdir/test_autocmd.vim, src/testdir/Make_all.mak, + src/Makefile + +Patch 7.4.2325 (after 7.4.2324) +Problem: Tiny build fails. +Solution: Add #ifdef. +Files: src/buffer.c + +Patch 7.4.2326 +Problem: Illegal memory access when Visual selection starts in invalid + position. (Dominique Pelle) +Solution: Correct position when needed. +Files: src/normal.c, src/misc2.c, src/proto/misc2.pro + +Patch 7.4.2327 +Problem: Freeing a variable that is on the stack. +Solution: Don't free res_tv or err_tv. (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.2328 +Problem: Crash when BufWinLeave autocmd goes to another tab page. (Hirohito + Higashi) +Solution: Make close_buffer() go back to the right window. +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.2329 +Problem: Error for min() and max() contains %s. (Nikolai Pavlov) +Solution: Pass the function name. (closes #1040) +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2330 +Problem: Coverity complains about not checking curwin to be NULL. +Solution: Use firstwin to avoid the warning. +Files: src/buffer.c + +Patch 7.4.2331 +Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode + does not work after entering an expression on the command line. +Solution: Don't use "ccline" when not actually using a command line. (test + by Hirohito Higashi) +Files: src/edit.c, src/ex_getln.c, src/proto/ex_getln.pro, + src/testdir/test_popup.vim + +Patch 7.4.2332 +Problem: Crash when stop_timer() is called in a callback of a callback. + Vim hangs when the timer callback uses too much time. +Solution: Set tr_id to -1 when a timer is to be deleted. Don't keep calling + callbacks forever. (Ozaki Kiichi) +Files: src/evalfunc.c, src/ex_cmds2.c, src/structs.h, + src/proto/ex_cmds2.pro, src/testdir/test_timers.vim + +Patch 7.4.2333 +Problem: Outdated comments in test. +Solution: Cleanup normal mode test. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2334 +Problem: On MS-Windows test_getcwd leaves Xtopdir behind. +Solution: Set 'noswapfile'. (Michael Soyka) +Files: src/testdir/test_getcwd.in + +Patch 7.4.2335 +Problem: taglist() is slow. (Luc Hermitte) +Solution: Check for CTRL-C less often when doing a linear search. (closes + #1044) +Files: src/tag.c + +Patch 7.4.2336 +Problem: Running normal mode tests leave a couple of files behind. + (Yegappan Lakshmanan) +Solution: Delete the files. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2337 +Problem: taglist() is still slow. (Luc Hermitte) +Solution: Check for CTRL-C less often when finding duplicates. +Files: src/tag.c + +Patch 7.4.2338 +Problem: Can't build with small features. (John Marriott) +Solution: Nearly always define FEAT_TAG_BINS. +Files: src/feature.h, src/tag.c + +Patch 7.4.2339 +Problem: Tab page test fails when run as fake root. +Solution: Check 'buftype' instead of 'filetype'. (James McCoy, closes #1042) +Files: src/testdir/test_tabpage.vim + +Patch 7.4.2340 +Problem: MS-Windows: Building with Ruby uses old version. +Solution: Update to 2.2.X. Use clearer name for the API version. (Ken + Takata) +Files: Makefile, src/INSTALLpc.txt, src/Make_cyg_ming.mak, + src/Make_mvc.mak, src/bigvim.bat + +Patch 7.4.2341 +Problem: Tiny things. Test doesn't clean up properly. +Solution: Adjust comment and white space. Restore option value. +Files: src/ex_cmds.c, src/message.c, src/testdir/test_autocmd.vim + +Patch 7.4.2342 +Problem: Typo in MS-Windows build script. +Solution: change "w2" to "22". +Files: src/bigvim.bat + +Patch 7.4.2343 +Problem: Too many old style tests. +Solution: Turn several into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test101.in, + src/testdir/test101.ok, src/testdir/test18.in, + src/testdir/test18.ok, src/testdir/test2.in, src/testdir/test2.ok, + src/testdir/test21.in, src/testdir/test21.ok, + src/testdir/test6.in, src/testdir/test6.ok, + src/testdir/test_arglist.vim, src/testdir/test_charsearch.vim, + src/testdir/test_fnameescape.vim, src/testdir/test_gf.vim, + src/testdir/test_hlsearch.vim, src/testdir/test_smartindent.vim, + src/testdir/test_tagjump.vim, src/Makefile + +Patch 7.4.2344 +Problem: The "Reading from channel output..." message can be unwanted. + Appending to a buffer leaves an empty first line behind. +Solution: Add the "out_msg" and "err_msg" options. Writing the first line + overwrites the first, empty line. +Files: src/structs.h, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.2345 (after 7.4.2340) +Problem: For MinGW RUBY_API_VER_LONG isn't set correctly. Many default + version numbers are outdated. +Solution: Set RUBY_API_VER_LONG to RUBY_VER_LONG. Use latest stable releases + for defaults. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.2346 +Problem: Autocommand test fails when run directly, passes when run as part + of test_alot. +Solution: Add command to make the cursor move. Close a tab page. +Files: src/testdir/test_autocmd.vim + +Patch 7.4.2347 +Problem: Crash when closing a buffer while Visual mode is active. + (Dominique Pelle) +Solution: Adjust the position before computing the number of lines. + When closing the current buffer stop Visual mode. +Files: src/buffer.c, src/normal.c, src/testdir/test_normal.vim + +Patch 7.4.2348 +Problem: Crash on exit when EXITFREE is defined. (Dominique Pelle) +Solution: Don't access curwin when exiting. +Files: src/buffer.c + +Patch 7.4.2349 +Problem: Valgrind reports using uninitialized memory. (Dominique Pelle) +Solution: Check the length before checking for a NUL. +Files: src/message.c + +Patch 7.4.2350 +Problem: Test 86 and 87 fail with some version of Python. +Solution: Unify "can't" and "cannot". Unify quotes. +Files: src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.2351 +Problem: Netbeans test fails when run from unpacked MS-Windows sources. +Solution: Open README.txt instead of Makefile. +Files: src/testdir/test_netbeans.py, src/testdir/test_netbeans.vim + +Patch 7.4.2352 +Problem: Netbeans test fails in shadow directory. +Solution: Also copy README.txt to the shadow directory. +Files: src/Makefile + +Patch 7.4.2353 +Problem: Not enough test coverage for Normal mode commands. +Solution: Add more tests. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2354 +Problem: The example that explains nested backreferences does not work + properly with the new regexp engine. (Harm te Hennepe) +Solution: Also save the end position when adding a state. (closes #990) +Files: src/regexp_nfa.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2355 +Problem: Regexp fails to match when using "\>\)\?". (Ramel) +Solution: When a state is already in the list, but addstate_here() is used + and the existing state comes later, add the new state anyway. +Files: src/regexp_nfa.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2356 +Problem: Reading past end of line when using previous substitute pattern. + (Dominique Pelle) +Solution: Don't set "pat" only set "searchstr". +Files: src/search.c, src/testdir/test_search.vim + +Patch 7.4.2357 +Problem: Attempt to read history entry while not initialized. +Solution: Skip when the index is negative. +Files: src/ex_getln.c + +Patch 7.4.2358 +Problem: Compiler warnings with Solaris Studio when using GTK3. (Danek + Duvall) +Solution: Define FUNC2GENERIC depending on the system. (Kazunobu Kuriyama) +Files: src/gui.h, src/gui_beval.c, src/gui_gtk_f.c + +Patch 7.4.2359 +Problem: Memory leak in timer_start(). +Solution: Check the right field to be NULL. +Files: src/evalfunc.c, src/testdir/test_timers.vim + +Patch 7.4.2360 +Problem: Invalid memory access when formatting. (Dominique Pelle) +Solution: Make sure cursor line and column are associated. +Files: src/misc1.c + +Patch 7.4.2361 +Problem: Checking for last_timer_id to overflow is not reliable. (Ozaki + Kiichi) +Solution: Check for the number not going up. +Files: src/ex_cmds2.c + +Patch 7.4.2362 +Problem: Illegal memory access with ":1@". (Dominique Pelle) +Solution: Correct cursor column after setting the line number. Also avoid + calling end_visual_mode() when not in Visual mode. +Files: src/ex_docmd.c, src/buffer.c + +Patch 7.4.2363 +Problem: Superfluous function prototypes. +Solution: Remove them. +Files: src/regexp.c + +Patch 7.4.2364 +Problem: Sort test sometimes fails. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 7.4.2365 +Problem: Needless line break. Confusing directory name. +Solution: Remove line break. Prepend "../" to "tools". +Files: Makefile, src/normal.c + +Patch 7.4.2366 +Problem: MS-Windows gvim.exe does not have DirectX support. +Solution: Add the DIRECTX to the script. +Files: src/bigvim.bat + +Patch 7.4.2367 (after 7.4.2364) +Problem: Test runner misses a comma. +Solution: Add the comma. +Files: src/testdir/runtest.vim + +Patch 8.0.0001 +Problem: Intro screen still mentions version7. (Paul) +Solution: Change it to version8. +Files: src/version.c + +Patch 8.0.0002 +Problem: The netrw plugin does not work. +Solution: Make it accept version 8.0. +Files: runtime/autoload/netrw.vim + +Patch 8.0.0003 +Problem: getwinvar() returns wrong Value of boolean and number options, + especially non big endian systems. (James McCoy) +Solution: Cast the pointer to long or int. (closes #1060) +Files: src/option.c, src/testdir/test_bufwintabinfo.vim + +Patch 8.0.0004 +Problem: A string argument for function() that is not a function name + results in an error message with NULL. (Christian Brabandt) +Solution: Use the argument for the error message. +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 8.0.0005 +Problem: Netbeans test fails with Python 3. (Jonathonf) +Solution: Encode the string before sending it. (closes #1070) +Files: src/testdir/test_netbeans.py + +Patch 8.0.0006 +Problem: ":lb" is interpreted as ":lbottom" while the documentation says it + means ":lbuffer". +Solution: Adjust the order of the commands. (haya14busa, closes #1093) +Files: src/ex_cmds.h + +Patch 8.0.0007 +Problem: Vim 7.4 is still mentioned in a few places. +Solution: Update to Vim 8. (Uncle Bill, closes #1094) +Files: src/INSTALLpc.txt, src/vimtutor, uninstal.txt + +Patch 8.0.0008 +Problem: Popup complete test is disabled. +Solution: Enable the test and change the assert. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0009 +Problem: Unnecessary workaround for AppVeyor. +Solution: Revert patch 7.4.990. (Christian Brabandt) +Files: appveyor.yml + +Patch 8.0.0010 +Problem: Crash when editing file that starts with crypt header. (igor2x) +Solution: Check for length of text. (Christian Brabandt) Add a test. +Files: src/fileio.c, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0011 +Problem: On OSX Test_pipe_through_sort_all() sometimes fails. +Solution: Add the test to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0012 +Problem: Typos in comments. +Solution: Change "its" to "it's". (Matthew Brener, closes #1088) +Files: src/evalfunc.c, src/main.aap, src/nbdebug.c, src/netbeans.c, + src/quickfix.c, src/workshop.c, src/wsdebug.c + +Patch 8.0.0013 (after 8.0.0011) +Problem: Missing comma in list. +Solution: Add the comma. +Files: src/testdir/runtest.vim + +Patch 8.0.0014 +Problem: Crypt tests are old style. +Solution: Convert to new style. +Files: src/testdir/test71.in, src/testdir/test71.ok, + src/testdir/test71a.in, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0015 +Problem: Can't tell which part of a channel has "buffered" status. +Solution: Add an optional argument to ch_status(). Let ch_info() also + return "buffered" for out_status and err_status. +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 8.0.0016 (after 8.0.0015) +Problem: Build fails. +Solution: Include missing change. +Files: src/eval.c + +Patch 8.0.0017 +Problem: Cannot get the number of the current quickfix or location list. +Solution: Use the current list if "nr" in "what" is zero. (Yegappan + Lakshmanan) Remove debug command from test. +Files: src/quickfix.c, src/testdir/test_quickfix.vim, + runtime/doc/eval.txt + +Patch 8.0.0018 +Problem: When using ":sleep" channel input is not handled. +Solution: When there is a channel check for input also when not in raw mode. + Check every 100 msec. +Files: src/channel.c, src/proto/channel.pro, src/ui.c, src/proto/ui.pro, + src/ex_docmd.c, src/os_amiga.c, src/proto/os_amiga.pro, + src/os_unix.c, src/proto/os_unix.pro, src/os_win32.c, + src/proto/os_win32.pro + +Patch 8.0.0019 +Problem: Test_command_count is old style. +Solution: Turn it into a new style test. (Naruhiko Nishino) + Use more assert functions. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/test_autocmd.vim, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok, + src/testdir/test_command_count.vim + +Patch 8.0.0020 +Problem: The regexp engines are not reentrant. +Solution: Add regexec_T and save/restore the state when needed. +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test_expr.vim, + runtime/doc/eval.txt, runtime/doc/change.txt + +Patch 8.0.0021 +Problem: In the GUI when redrawing the cursor it may be on the second half + of a double byte character. +Solution: Correct the cursor column. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 8.0.0022 +Problem: If a channel in NL mode is missing the NL at the end the remaining + characters are dropped. +Solution: When the channel is closed use the remaining text. (Ozaki Kiichi) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 8.0.0023 +Problem: "gd" and "gD" may find a match in a comment or string. +Solution: Ignore matches in comments and strings. (Anton Lindqvist) +Files: src/normal.c, src/testdir/test_goto.vim + +Patch 8.0.0024 +Problem: When the netbeans channel closes, "DETACH" is put in the output + part. (Ozaki Kiichi) +Solution: Write "DETACH" in the socket part. +Files: src/channel.c, src/testdir/test_netbeans.vim + +Patch 8.0.0025 +Problem: Inconsistent use of spaces vs tabs in gd test. +Solution: Use tabs. (Anton Lindqvist) +Files: src/testdir/test_goto.vim + +Patch 8.0.0026 +Problem: Error format with %W, %C and %Z does not work. (Gerd Wachsmuth) +Solution: Skip code when qf_multiignore is set. (Lcd) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0027 +Problem: A channel is closed when reading on stderr or stdout fails, but + there may still be something to read on another part. +Solution: Turn ch_to_be_closed into a bitfield. (Ozaki Kiichi) +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 8.0.0028 +Problem: Superfluous semicolons. +Solution: Remove them. (Ozaki Kiichi) +Files: src/ex_cmds2.c + +Patch 8.0.0029 +Problem: Code for MS-Windows is complicated because of the exceptions for + old systems. +Solution: Drop support for MS-Windows older than Windows XP. (Ken Takata) +Files: runtime/doc/gui_w32.txt, runtime/doc/os_win32.txt, + runtime/doc/todo.txt, src/GvimExt/Makefile, src/Make_mvc.mak, + src/evalfunc.c, src/ex_cmds.c, src/ex_docmd.c, src/gui_w32.c, + src/if_cscope.c, src/misc1.c, src/misc2.c, src/option.c, + src/os_mswin.c, src/os_win32.c, src/os_win32.h, + src/proto/os_mswin.pro, src/proto/os_win32.pro, src/version.c + +Patch 8.0.0030 +Problem: Mouse mode is not automatically detected for tmux. +Solution: Check for 'term' to be "tmux". (Michael Henry) +Files: src/os_unix.c + +Patch 8.0.0031 +Problem: After ":bwipeout" 'fileformat' is not set to the right default. +Solution: Get the default from 'fileformats'. (Mike Williams) +Files: src/option.c, src/Makefile, src/testdir/test_fileformat.vim, + src/testdir/test_alot.vim + +Patch 8.0.0032 +Problem: Tests may change the input file when something goes wrong. +Solution: Avoid writing the input file. +Files: src/testdir/test51.in, src/testdir/test67.in, + src/testdir/test97.in, src/testdir/test_tabpage.vim + +Patch 8.0.0033 +Problem: Cannot use overlapping positions with matchaddpos(). +Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0034 +Problem: No completion for ":messages". +Solution: Complete "clear" argument. (Hirohito Higashi) +Files: src/ex_docmd.c, src/ex_getln.c, src/proto/ex_docmd.pro, + src/testdir/test_cmdline.vim, src/vim.h, + runtime/doc/eval.txt, runtime/doc/map.txt + +Patch 8.0.0035 (after 7.4.2013) +Problem: Order of matches for 'omnifunc' is messed up. (Danny Su) +Solution: Do not set compl_curr_match when called from complete_check(). + (closes #1168) +Files: src/edit.c, src/evalfunc.c, src/proto/edit.pro, src/search.c, + src/spell.c, src/tag.c, src/testdir/test76.in, + src/testdir/test76.ok, src/testdir/test_popup.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0036 +Problem: Detecting that a job has finished may take a while. +Solution: Check for a finished job more often (Ozaki Kiichi) +Files: src/channel.c, src/os_unix.c, src/os_win32.c, + src/proto/os_unix.pro, src/proto/os_win32.pro, + src/testdir/test_channel.vim + +Patch 8.0.0037 +Problem: Get E924 when switching tabs. () +Solution: Use win_valid_any_tab() instead of win_valid(). (Martin Vuille, + closes #1167, closes #1171) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0038 +Problem: OPEN_CHR_FILES not defined for FreeBSD using Debian userland + files. +Solution: Check for __FreeBSD_kernel__. (James McCoy, closes #1166) +Files: src/vim.h + +Patch 8.0.0039 +Problem: When Vim 8 reads an old viminfo and exits, the next time marks are + not read from viminfo. (Ned Batchelder) +Solution: Set a mark when it wasn't set before, even when the timestamp is + zero. (closes #1170) +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 8.0.0040 (after 8.0.0033) +Problem: Whole line highlighting with matchaddpos() does not work. +Solution: Check for zero length. (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0041 +Problem: When using Insert mode completion but not actually inserting + anything an undo item is still created. (Tommy Allen) +Solution: Do not call stop_arrow() when not inserting anything. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0042 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" change is not saved for undo. (Tommy Allen) +Solution: Call stop_arrow() before inserting for pressing Enter. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0043 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" with CTRL-N the change is not saved for undo. (Tommy + Allen) +Solution: Call stop_arrow() before inserting for any key. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0044 +Problem: In diff mode the cursor may end up below the last line, resulting + in an ml_get error. +Solution: Check the line to be valid. +Files: src/move.c, src/diff.c, src/proto/diff.pro, + src/testdir/test_diffmode.vim + +Patch 8.0.0045 +Problem: Calling job_stop() right after job_start() does not work. +Solution: Block signals while fork is still busy. (Ozaki Kiichi, closes + #1155) +Files: src/auto/configure, src/config.h.in, src/configure.in, + src/os_unix.c, src/testdir/test_channel.vim + +Patch 8.0.0046 +Problem: Using NUL instead of NULL. +Solution: Change to NULL. (Dominique Pelle) +Files: src/ex_cmds.c, src/json.c + +Patch 8.0.0047 +Problem: Crash when using the preview window from an unnamed buffer. + (lifepillar) +Solution: Do not clear the wrong buffer. (closes #1200) +Files: src/popupmnu.c + +Patch 8.0.0048 +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. (Yasuhiro Matsumoto, closes #1184) +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0049 +Problem: When a match ends in part of concealed text highlighting, it might + mess up concealing by resetting prev_syntax_id. +Solution: Do not reset prev_syntax_id and add a test to verify. (Christian + Brabandt, closes #1092) +Files: src/screen.c, src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0050 +Problem: An exiting job is detected with a large latency. +Solution: Check for pending job more often. (Ozaki Kiichi) Change the + double loop in mch_inchar() into one. +Files: src/channel.c, src/os_unix.c, src/testdir/shared.vim, + src/testdir/test_channel.vim + +Patch 8.0.0051 (after 8.0.0048) +Problem: New code for job_stop() breaks channel test on AppVeyor. +Solution: Revert the change. +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0052 (after 8.0.0049) +Problem: Conceal test passes even without the bug fix. +Solution: Add a redraw command. (Christian Brabandt) +Files: src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0053 (after 8.0.0047) +Problem: No test for what 8.0.0047 fixes. +Solution: Add a test. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0054 (after 8.0.0051) +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. Now only when there is no job object. + (Yasuhiro Matsumoto, closes #1203) +Files: src/os_win32.c + +Patch 8.0.0055 +Problem: Minor comment and style deficiencies. +Solution: Update comments and fix style. +Files: src/buffer.c, src/misc2.c, src/os_unix.c + +Patch 8.0.0056 +Problem: When setting 'filetype' there is no check for a valid name. +Solution: Only allow valid characters in 'filetype', 'syntax' and 'keymap'. +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0057 (after 8.0.0056) +Problem: Tests fail without the 'keymap' features. +Solution: Check for feature in test. +Files: src/testdir/test_options.vim + +Patch 8.0.0058 +Problem: Positioning of the popup menu is not good. +Solution: Position it better. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 8.0.0059 +Problem: Vim does not build on VMS systems. +Solution: Various changes for VMS. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h, src/Make_vms.mms, src/os_unix.c, + src/os_unix.h, src/os_vms.c, src/os_vms_conf.h, + src/proto/os_vms.pro, src/testdir/Make_vms.mms + +Patch 8.0.0060 +Problem: When using an Ex command for 'keywordprg' it is escaped as with a + shell command. (Romain Lafourcade) +Solution: Escape for an Ex command. (closes #1175) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0061 (after 8.0.0058) +Problem: Compiler warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/popupmnu.c + +Patch 8.0.0062 +Problem: No digraph for HORIZONTAL ELLIPSIS. +Solution: Use ",.". (Hans Ginzel, closes #1226) +Files: src/digraph.c, runtime/doc/digraph.txt + +Patch 8.0.0063 +Problem: Compiler warning for comparing with unsigned. (Zoltan Arpadffy) +Solution: Change <= to ==. +Files: src/undo.c + +Patch 8.0.0064 (after 8.0.0060) +Problem: Normal test fails on MS-Windows. +Solution: Don't try using an illegal file name. +Files: src/testdir/test_normal.vim + +Patch 8.0.0065 (after 8.0.0056) +Problem: Compiler warning for unused function in tiny build. (Tony + Mechelynck) +Solution: Add #ifdef. +Files: src/option.c + +Patch 8.0.0066 +Problem: when calling an operator function when 'linebreak' is set, it is + internally reset before calling the operator function. +Solution: Restore 'linebreak' before calling op_function(). (Christian + Brabandt) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0067 +Problem: VMS has a problem with infinity. +Solution: Avoid an overflow. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h + +Patch 8.0.0068 +Problem: Checking did_throw after executing autocommands is wrong. (Daniel + Hahler) +Solution: Call aborting() instead, and only when autocommands were executed. +Files: src/quickfix.c, src/if_cscope.c, src/testdir/test_quickfix.vim + +Patch 8.0.0069 +Problem: Compiler warning for self-comparison. +Solution: Define ONE_WINDOW and add #ifdef. +Files: src/globals.h, src/buffer.c, src/ex_docmd.c, src/move.c, + src/screen.c, src/quickfix.c, src/window.c + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/vi_diff.jax b/plugins/vimdoc-ja/doc/vi_diff.jax new file mode 100644 index 0000000000..e2b15bdf15 --- /dev/null +++ b/plugins/vimdoc-ja/doc/vi_diff.jax @@ -0,0 +1,1063 @@ +*vi_diff.txt* For Vim バージョン 8.0. Last change: 2016 Aug 16 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +Vim と Vi の違い *vi-differences* + +ヘルプファイルを通して Vim と Vi/Exの違いは波括弧の中で "{Vi にはない}" のよう +に示されています。このファイルは他のファイルで触れられていない部分のみを列挙し +ます。それと違いの概略を説明します。 + +Vim は大体において POSIX 1003.2-1 に従っています。知られている唯一の足りないコ +マンドは ":open" コマンドです。細かな違いはたぶんたくさんあります(Vimが間違っ +ているか、Posixの指標がはずれているかのどちらか)。 + +1. シミュレートされているコマンド |simulated-command| +2. なくなっているオプション |missing-options| +3. 制限 |limits| +4. もっとも興味深い機能追加 |vim-additions| +5. Vim の他の特徴 |other-features| +6. コマンドライン引数 |cmdline-arguments| +7. POSIX 準拠 |posix-compliance| + +============================================================================== +1. シミュレートされているコマンド *simulated-command* + +このコマンドは Vi にはありますが Vim ではシミュレートしているだけです。 + + *:o* *:op* *:open* +:[range]o[pen] |:visual|と同様。Exモードを終了します。 + {Vi: オープンモードで編集を開始する} + +:[range]o[pen] /pattern/ 上と同様で、さらに現在行の中で "pattern" に + マッチする桁へカーソルを移動します。 + +Vimにオープンモードはありません。まったく便利ではないからです。Viなら ":open" +でオープンモードを開始しますが、VimではExモードを抜けます。その結果、Viの場合 +と同じコマンドが実行できるようになります。ただ、1行だけを再描画するのでなく、 +画面全体を再描画する点が違います。 +============================================================================== +2. なくなっているオプション *missing-options* + +これらのオプションは Vi にはあって、Vim にはないものです。これらのオプションを +セットしてもエラーメッセージは出ませんが、設定した値は使われませんし表示もされ +ません。 + +autoprint (ap) 二者択一 (初期値 オン) *'autoprint'* *'ap'* +beautify (bf) 二者択一 (初期値 オフ) *'beautify'* *'bf'* +flash (fl) 二者択一 (初期値 ??) *'flash'* *'fl'* +graphic (gr) 二者択一 (初期値 オフ) *'graphic'* *'gr'* +hardtabs (ht) 数値 (初期値 8) *'hardtabs'* *'ht'* + ディスプレイ上で一つの <Tab> が移動するスペースの数 +mesg 二者択一 (初期値 オン) *'mesg'* +novice 二者択一 (初期値 オフ) *'novice'* +open 二者択一 (初期値 オン) *'open'* +optimize (op) 二者択一 (初期値 オフ) *'optimize'* *'op'* +redraw 二者択一 (初期値 オフ) *'redraw'* +slowopen (slow) 二者択一 (初期値 オフ) *'slowopen'* *'slow'* +sourceany 二者択一 (初期値 オフ) *'sourceany'* +w300 数値 (初期値 23) *'w300'* +w1200 数値 (初期値 23) *'w1200'* +w9600 数値 (初期値 23) *'w9600'* + +============================================================================== +3. 制限 *limits* + +Vim で編集できるファイルの制限はかなり少ないです。 {Vi: <Nul>文字を扱えず、ま +た 128をこえる文字を扱えません。行の長さにも制限がありますし、他にも多くの制限 +があります。} + + *E340* +行の最大の長さ 16ビット int を使っているマシン(Amiga と MS-DOS の + リアルモード)は 32767 文字、それ以外は 2147483647 + 文字。それより長い行は分割されます。 +最大行数 2147483647 行 +最大のファイルのサイズ long integer が32ビットである場合2147483647バイト(2 + ギガバイト)です。64ビットの長さであればもっと多くな + ります。またスワップファイル|swap-file|の為のディス + クの空き容量にも制限されます。 + *E75* +ファイルのパスの長さ Unix と Win32: 1024 文字、それ以外は 256 文字 + (もしくはシステムがサポートしている長さ分だけ) +展開されたオプションの文字列の長さ + Unix と Win32: 1024 文字、それ以外は 256 文字 +表示される最大の長さ Unix と Win32: 1024 文字、それ以外は 255 文字 +マッピングでの lhs の最大の長さ + 50 文字 +異なるハイライトの種類の数: 30000以上 +数値変数の範囲: -2147483648 から 2147483647 (64ビットシステムでは + もっと大きい場合があります) +タグファイルにおける一行の最大の長さ: 512 バイト + +アンドゥとレジスタの中のテキストに関する情報はメモリに保持されます。ですので、 +使用可能な(仮想)メモリの量を超えて(大きな)変更を行っている場合はアンドゥレベル +の数とレジスタに保持されうるテキストは制限されることになります。コマンドライン +履歴やクイックフィックスモードでのエラーメッセージなどの他のものもまたメモリに +保持されます。 + +メモリの使い方を制限する +-------------------------- + +'maxmem' ('mm') オプションは一つのバッファに使われるメモリの最大の量 (キロバイ +トで) を決めるのに使います。'maxmemtot' はすべてのバッファで使われるメモリの最 +大の量(キロバイトで)を決めるのに使います。Amiga と MS-DOS では 'maxmemtot' は +使えるメモリの量に依存して設定されます。 +これらは厳格な制限ではなく、いつテキストをスワップファイルに移動するかの目安で +す。もし Vim がファイルにスワップを行うのが嫌であれば 'maxmem' と 'maxmemtot' +の値をかなり大きい値に設定しておきます。そうするとスワップファイルはリカバリー +の時にのみ使われるようになります。もしどんなスワップファイルも欲しくなければ +'updatecount' を 0 に設定するか、Vim を起動するときに "-n" 引数をつけます。 + +============================================================================== +4. もっとも興味深い機能追加 *vim-additions* + +Vi との互換性 |'compatible'| + Vim には Vi の99%の機能が含まれますが、Vi のうちのいくつかはバグか少な + くとも改良が必要だと考えられるものがあります。しかしそれでもなお Vim + は可能な限り「本当の」 Vi のように振る舞うモードで起動します。Vim にも + う少しよい動作をして欲しい場合は 'compatible' オプションを解除してみて + ください。 + :set nocompatible + それか Vim を "-N" 引数つきで起動してください: + vim -N + もし .vimrc ファイルがあれば 'nocompatible' つきでVimが起動します。 + |startup| も見てください。'cpoptions' オプションはたくさんの特定のアイ + テムに関する Viと同一の動作をするかどうかのオン/オフを切り替えることが + できます。 + +様々なシステムのサポート + Vim は次のシステムで利用できます: + - すべての Unix システム (テストされたすべてのシステムで動作しますが + GUI と Perl インターフェイスはどこでも動作するわけではないかもしれま + せん)。 + - Amiga (500, 1000, 1200, 2000, 3000, 4000, ...). + - リアルモードの MS-DOS (他のドライバは必要ありません) + - プロテクトモードの Windows 3.1 と MS-DOS (DPMI ドライバが必要です) + - Windows 95 と Windows NT、ロングファイル名をサポート + - OS/2 (emx.dll が必要です) + - Atari MiNT + - VMS + - BeOS + - Macintosh + - Risc OS + - IBM OS/390 + Note: いくつかのシステムではリソース使用量を削減するために機能を無効に + する必要があります(特にMS-DOS)。いくつかの時代後れのシステムでは以前の + バージョンのVimを使わねばなりません。 + +多段永続化アンドゥ |undo| + 'u' は時をさかのぼり、'CTRL-R' は再び進めます。変更を覚えておく回数を + 'undolevels' オプションでセットしてください(初期値 1000)。'undolevels' + を0にセットすると Vi 互換のアンドゥになります。-1 にセットするとアン + ドゥできないようになります。 + あるバッファに対する変更をすべてアンドゥした場合は、バッファは何も変更 + されていないと見なされます。つまり <!> なしで :q で終了させることがで + きます。 + 変更をアンドゥしてその後新しい変更をすると、Vimのアンドゥツリーにブラ + ンチが作られます。これにより、テキストを永遠に失うという危険性なしにテ + キストをどの状態にでも戻すことができます。|undo-tree| + 'undofile' オプションがセットされた場合には、アンドゥ情報がファイルに + 保存されます。これはつまり、Vimを一旦終了し再起動して同じファイルの編 + 集をすれば、再起動前に行っていた変更もアンドゥできる、ということです。 + +グラフィカルユーザーインターフェイス(GUI) |gui| + GUI (メニュー、マウス、スクロールバー、などなど)のサポートが含められま + した。独自のメニューを定義することもできます。CTRL/SHIFT/ALT とキーの + 組み合わではなく特殊なキーとマウスの組み合わせというよりよい方法がサ + ポートされます。さまざまなプラットフォーム、X11 (Motif と Athena イン + ターフェイス)、Win32 (Windows95 か、より最新のもの), BeOS, Amiga, + Macintoshでサポートされています。 + +複数のウィンドウとバッファ |windows.txt| + Vim ではスクリーンをいくつかのウィンドウに分けてそれぞれの中で異なる + バッファを編集したり同じバッファを別の場所で編集したりできます。バッ + ファはウィンドウに表示されていなくともロードして(変更を加えて)おくこと + もできます。これは隠れたバッファと呼ばれます。この機能のために多くのコ + マンドやオプションが追加されています。 + Vimはタブページを使うこともできます。各タブページは1個以上のウィンドウ + を含みます。タブラベルを表示する行を使ってこれらのタブを素早く切替える + ことができます。|tab-page| + +構文ハイライト |:syntax| + Vim ではキーワードやパターンやその他のものをハイライトすることができま + す。これは ":syntax" コマンドで定義し、ほとんどの言語やファイルのタイ + プに対してハイライトをつけることができます。C、C++、Java、Pascal、 + Makefiles、シェルスクリプト、などなどの多くの一般的な言語のうちのほと + んどのためのハイライト定義ファイルはすでに含まれています。ハイライトに + 使われる色は普通の端末で定義することができ、色端末と GUI では + |:highlight| コマンドで定義できます。色を変更するのに便利な方法は + |:colorscheme|コマンドを使うことです。 + ハイライトされたテキストをHTMLにエクスポートすることができます + |convert-to-HTML|。ハイライトできる他の要素は、検索文字列のマッチ部分 + |'hlsearch'|、対応する括弧 |matchparen|、カーソル行とカーソル桁 + |'cursorline'| |'cursorcolumn'|です。 + +スペルチェック |spell| + オプション 'spell' がセットされていると、スペリングの間違いがハイライ + トされます。現在のところ約50の言語がサポートされています。言語はオプ + ション 'spelllang' で選択できます。ソースコード中ではコメントと文字列 + だけがスペルチェックされます。 + +折畳み |folding| + 複数行の範囲を一行の「折畳まれた」行として表示することができます。これ + によりファイルを一望することができ、テキストブロック間を素早く移動する + ことが可能になります。折畳みの設定は手動、ファイルのシンタックス、イン + デント等々で設定することができます。 + +差分モード |diff| + ファイルの2つのバージョンの差分をハイライトして表示することができます。 + テキストの一致する部分は折り畳みされます。コマンドを使って片方のバー + ジョンのテキストをもう一方へ移動することができます。 + +プラグイン |add-plugin| + プラグインファイルを正しいディレクトリにただ置くだけで機能追加ができま + す。これは他人が書いた Vim script を使い始める簡単な方法です。プラグイ + ンは全ての種類のファイルについて設定することもできますし、ある1つのファ + イルタイプについて設定することも可能です。 + パッケージ機能はこれをさらに簡単にします。 |packages| + +非同期通信とタイマー |channel| |job| |timer| + Vim はバックグラウンドで他のプロセスとメッセージを交換できます。これに + より、何か仕事をさせ結果を Vim に送り返すようなサーバーを実現可能にし + ます。 |channel| + Vim はジョブを開始させ、それと通信し、停止させられます。 |job| + タイマーは、何かしらの仕事をする関数を、一定時間経過後に1回だけ、もし + くは繰り返し実行することができます。 |timer| + +一連のコマンドを繰り返す |q| + "q{c}" で名前付きレジスタ{c}にタイプする文字の記録を始めます。後に続く + "q" は記録を終了します。そしてレジスタにあるコマンドは "@{c}" コマンド + で実行することができます。これは複雑な動作を繰り返すときに非常に便利で + す。 + +柔軟な挿入モード |ins-special-special| + ファイルを動き回るのに矢印キーを挿入モードで使うことができます。このこ + とはアンドゥとリドゥを考えると挿入モードが二つに分かれることになりま + す。 + + CTRL-O は一つのノーマルモードのコマンドを実行するのに使うことができま + す。これはつまり <Esc> キーを打ってコマンドを打ってからそれから |a| を + 打ったのとほとんど同じことです。 + +ビジュアルモード |Visual-mode| + ビジュアルモードは、初めにいくつかのテキストを選択してからそれに対して + コマンドを実行するのに使うことができます。これは初めにオペレータコマン + ドを与えてからそのオペレータを施すテキストの最後まで移動するコマンドを + 実行するもう一つの(簡単な)方法です。 + |v| と |V| はビジュアルモードを開始します。|v| は文字ごとに選択し |V| + は行ごとに選択します。カーソルを動かしてビジュアル部分を広げ、その部分 + はスクリーン上でハイライトされます。"o" を打つことでビジュアルなテキス + ト部分の反対側の端が動かされることになります。ビジュアルなテキスト部分 + には次のオペレータを施すことができます: + d 削除 + c 変更 + y ヤンク + > or < インデントを挿入/削除 + ! 外部プログラムを使ってフィルターを施す + = インデントを通してフィルターを施す + : ビジュアルな行に対して |:| コマンドを始める + gq 'textwidth' 桁位置にテキストを整形する + J 行を連結する + ~ 大文字小文字を入れ換える + u 小文字にする + U 大文字にする + +ブロックオペレータ |visual-block| + 長方形のテキストがビジュアルモードを使って選択することができます。 + CTRL-V でビジュアルモードを開始します。選択されたブロックは "d" で削除 + したり 'y' でヤンクしたり大文字小文字を "~"、"u"、"U" で変えることがで + きます。削除もしくはヤンクされたブロックは "p" か "P" コマンドでテキス + トに挿入することができます。 + +ヘルプシステム |:help| + ヘルプはウィンドウの中に表示されます。検索したりするテキストの中を移動 + する普通のコマンドはそのまま使えます。タグも複数のヘルプファイルの間を + 移動するのに使え、ハイパーテキストのリンクをクリックするような感覚で + す。|:help| コマンドは引数を取りますので検索したい情報に素早くジャンプ + できます。<F1> を押して素早くヘルプシステムにアクセスすることもできま + す。ヘルプファイルのインデックスファイルは 'helpfile' オプションで設定 + することができます。 + +コマンドライン編集/履歴 |cmdline-editing| + カーソルキーを使うことでコマンドラインのどの場所からでも挿入を行ったり + 削除を行ったりすることができます。右/左矢印キーは前/後に一つの文字移動 + するのに使うことができ、Shift キーを押しながら右/左矢印キーを押すと前/ + 後に一つの単語移動することができます。CTRL-B/CTRL-E はコマンドラインの + 初め/終わりに移動するのに使うことができます。 + |cmdline-history| + コマンドラインは記録されます。上/下矢印キーを使うことで前のコマンドラ + インを呼び出すことができます。'history' オプションで覚えておく行数を設 + 定することができます。検索パターンのコマンド履歴はまた別に分かれていま + す。 + +コマンドライン補完 |cmdline-completion| + コマンドライン(スクリーンの一番下で)でなんらかの作業をしているときに + <Tab> キーを押すと補完を行うことができます。 + what example ~ + - コマンド :e<Tab> + - タグ :ta scr<Tab> + - オプション :set sc<Tab> + - オプションの値 :set hf=<Tab> + - ファイル名 :e ve<Tab> + - その他 + + 複数マッチしたものがある場合は、CTRL-N (次)と CTRL-P (前)でマッチした + ものの間を移動することができます。<Tab> は CTRL-N のように振る舞います + が、マッチしたものの最後で押すと最初にマッチしたものに戻ります。 + + 'wildchar' オプションでコマンドライン補完に利用する文字を設定できま + す。デフォルトは<Tab>です。複数の補完候補がある不完全な状態でCTRL-Dを + タイプすることで、全ての補完候補を表示することができます。CTRL-Aではす + べての候補を入力することができます。CTRL-Lでは候補内で、一致する最長部 + 分までを入力します。 + +挿入モードでの補完 |ins-completion| + 挿入モードで CTRL-N と CTRL-P を使うことでどこかに現れる単語を補完する + ことができます。 |i_CTRL-N| + CTRL-X を使うことでもう一つのモードに入ることができます。どの補完を行 + うことができるかというと: + |i_CTRL-X_CTRL-F| ファイル名 + |i_CTRL-X_CTRL-K| 辞書 'dictionary' ファイルにある単語 + |i_CTRL-X_CTRL-T| 類語辞典 'thesaurus' ファイルにある単語 + |i_CTRL-X_CTRL-I| インクルードされるファイルにある単語 + |i_CTRL-X_CTRL-L| すべての行 + |i_CTRL-X_CTRL-]| タグファイルにある単語 + |i_CTRL-X_CTRL-D| マクロ定義 + |i_CTRL-X_CTRL-O| オムニ補完: ファイルタイプなどに特化した + 賢い補完 + +長い行のサポート |'wrap'| |'linebreak'| + 'wrap' オプションがオフであれば、長い行は折り返されずに行の一部分だけが + 表示されます。カーソルが表示されていない部分に移動するとスクリーンも横 + にスクロールします。横にスクロールする桁数の最小の値を 'sidescroll' オ + プションで設定することができます。|zh| と |zl| コマンドは横スクロールに + 使うことができます。あるいは、'linebreak' オプションがセットされている + 場合は長い行は単語の間で切られます。こうすることで段落を一つの行にして + 編集することが容易になります(例: 後で編集中のテキストを DTP プログラム + に持っていく場合)。カーソルを上下するには |gk| と |gj| コマンドを使って + ください。 + +テキストの整形 |formatting| + 'textwidth' オプションを設定することで行の長さを自動的に制限することが + できます。このオプションはあまり便利ではなかった Vi での 'wrapmargin' + オプションを補助するものです。|gq| オペレータはテキストの一部分を整形 + するのに使うことができます(例えば、|gqap| は現在の段落を整形します)。 + テキストの位置に関するコマンドは |:center|, |:left|, |:right| です。 + +拡張正規表現 |pattern| + 様々なテキスト要素にマッチさせるための、多くの拡張正規表現の要素があり + ます。たとえば "\n" は改行にマッチします。 + "x\{2,4}" は、"x" が2個から4個続くテキストにマッチします。 + "\s" は空白文字にマッチします。 + +ディレクトリ、リモート、アーカイブの閲覧 |netrw| + Vimはファイルシステムをブラウズすることができます。単にディレクトリを + 編集します{訳注: :e {directory} とする}。そのリスト中を普通のコマンド + を使って移動し、<Enter>を押すとカーソル下のディレクトリやファイルに移 + ります。 + これはftp, http, sshなど越しのリモートファイルにも機能します。 + zipとtarのアーカイブもブラウズすることができます。|tar| |zip| + +編集-コンパイル-編集 をスピードアップする |quickfix| + |:make| コマンドを使うことでコンパイルしてから初めのエラーにジャンプす + ることができます。コンパイラのエラーメッセージが書かれたファイルを解析 + できます。最初のエラーにジャンプします。 + + エラーファイルのそれぞれの行はファイルの名前、行番号、エラーメッセージ + という風に調べられます。'errorformat' オプションは多くのコンパイラから + の出力を扱うことができるように scanf のような形式の文字列のリストを指 + 定することができます。 + + |:cn| コマンドは次のエラーにジャンプするのに使うことができます。|:cl| + コマンドはすべてのエラーメッセージをリストします。他のコマンドも使うこ + とができます。'makeef' オプションはエラーメッセージが含まれるファイル + の名前を指定します。'makeprg' オプションは |:make| コマンドで実行する + プログラムの名前を指定します。'shellpipe' オプションはコンパイラからの + 出力をエラーファイルに書き込むときに使われる文字列を指定します。 + +複数のファイルから検索する |:vimgrep| + 複数のファイルからパターンを検索することができます。この機能はVimの高 + 度な正規表現パターンを使い、すべてのシステム上で機能し、圧縮されたファ + イルも検索できます。 + +C プログラムのインデントを改善 |'cindent'| + 'cindent' オプションがオンの時はそれぞれのインデントは自動的に調整され + ます。C の文法はだいたい解釈されますし、さまざまなスタイルでのインデン + トは 'cinoptions' で設定することができます。インデントをするきっかけと + なるキーワードは 'cinkeys' で指定することができます。 + + コメントも自動的に整形することができ、'comments' オプションでどの文字 + がコメントをスタートさせ終了させるのかを指定することができます。この機 + 能は C のコードでもっともよく動作しますがメール(行の最初の ">")や他の + タイプのテキストでもうまく動作します。|=| オペレータで行を再インデント + することもできます。 + + 他にも多くの言語に対して自動インデントをするためのインデントプラグイン + が提供されています。|30.3| + +インクルードされるファイルの中から単語を探す |include-search| + |[i| コマンドはカーソルの下の単語をインクルードされるファイルの中から + 検索することができます。'include' オプションをセットすることでファイル + をインクルードするコマンドのパターンを記述することができます(デフォル + トでは C のプログラムで検索できるように設定してあります)。 + |[I| コマンドはマッチしたすべてをリストし、|[_CTRL-I| コマンドはマッチ + した場所にジャンプするコマンドです。 + |[d|, |[D|, |[_CTRL-D| も同様ですが、'define' オプションで指定されるパ + ターンにマッチする行にのみします + +自動コマンド |autocommand| + ファイルを読み込んだり書き込んだり別のバッファにジャンプしたりなどする + 時に、ファイル名によって自動的にコマンドを実行することができます。これ + は C のプログラムを書いたり、ドキュメントを書いたり、普通のテキストを + 書いたりなどする時にオプションをセットしたりそれら特有のマッピングをし + たりするときに便利です。これを利用することで圧縮されたファイルを編集す + ることもできるようになります。 + +コマンドと表現 |expression| + 強力なスクリプト言語を形成するようにいくつかコマンドが追加されました。 + |:if| 条件によって実行します。例えば $TERM の値によってオプ + ションを変更したりできます。 + |:while| コマンドを繰り返します。 + |:for| リストをわたるループ。 + |:echo| 式の結果を表示します + |:let| 値を内部変数やオプションなどに割り当てます。 + 変数の型は数値、文字列、リスト、辞書。 + |:execute| 式からなるコマンドを実行します。 + |:try| 例外を捕捉します。 + などなど。|eval|を参照。 + デバッグとプロファイリングがサポートされています。|debug-scripts| + |profile| + もしこれで十分でないなら、|Python|, |Ruby|, |Tcl|, |Lua|, |Perl|, + |MzScheme| のインターフェイスが提供されています。 + +Viminfo |viminfo-file| + コマンドライン履歴やマークやレジスタの内容を起動時に読み込まれるファイ + ルに保存しておくことができます。Vim を終了させた後、再び Vim を起動し + たときでも検索コマンドを繰り返したりコマンドラインを繰り返したりできま + す。|'0| を使って最後に編集していた場所にジャンプすることもまた可能で + す。'viminfo' オプションで .viminfo ファイルに保存されるアイテムを選択 + することができます。初期値はオフです。 + +印刷 |printing| + コマンド|:hardcopy|はテキストをプリンタに送信します。構文強調も含まれ + ます。 + +マウスサポート |mouse-using| + マウスは GUI バージョンと Unix、sysmouse がある BSD、gpm がある Linux、 + MS-DOS、Win32 上の xterm でサポートされています。カーソルの場所を変え + たりビジュアル領域を選択したりレジスタの内容を貼り付けたりするのに使う + ことができます。 + +キーの名前の使い方 |<>| |key-notation| + 特殊なキーはすべて <Up>、<End> などなどのような書き方ができるようにな + りました。この名前はマッピングでも使うことができますしそれらを編集する + のが容易になります。 + +バイナリファイルを編集する |edit-binary| + Vim はバイナリファイルを編集することができます。実行形式のファイルを + 壊すことなくいくつかの文字を変更することができます。Vim は NUL 文字を + 削除しません(内部では <NL> と表されています)。 + |-b| バイナリファイルの編集を始める時のコマンドライン引数 + |'binary'| |-b| によってセットされるオプションで、ファイルの最後の + 行に <EOL> を付加するのをやめさせます + +多言語のサポート |multi-lang| + ダブルバイトやマルチバイトエンコーディングのファイルを編集できます。 + フォントを切り替えずに多言語を同時に編集可能なUTF-8をサポートしていま + す。 |UTF-8| + メッセージやメニューが多くの言語に翻訳されています。 + +行を越えるカーソル移動 + オプション 'virtualedit' がセットされていると、テキストがない場所を含 + め、画面全体どこでもカーソルを移動させることができます。これは表や図を + 容易に編集できて便利です。 + +============================================================================== +5. その他の Vim の機能 *other-features* + +その他の優れた機能をランダムに集めてみました。 + + +Vim が "-s scriptfile" 付きで起動された場合、"scriptfile" から読み込まれる文字 +は実際あなたがそれをタイプしたように扱われます。もしエディタが終了する前にスク +リプトファイルの終わりに到達した場合は、さらにコンソールから文字を読み込みま +す。 + +"-w" オプションはタイプした文字をすべてスクリプトファイルに記録するのに使うこ +とができます。このファイルは後で別のファイルでその編集を繰り返したり、スクリプ +トファイルに修正を加えてから繰り返しを実行したりするのに使うことができます。 + +"-o" オプションはそれに続く引数の数だけウィンドウを開きます。"-o4" は4つのウィ +ンドウを開きます。 + +Viはフルスクリーンで動作するためにいくつかのtermcapのエントリが必要でした。Vim +が必要とするのは "cm" エントリ(cursor motion)だけです。 + + +コマンドモードで: + +'showcmd' オプションがセットされていると、スクリーンの最後の行にコマンドの文字 +列が表示されます。これらはコマンドが終了した後に削除されます。 + +'ruler' オプションがセットされているとスクリーンの最後の行に現在のカーソルの位 +置が表示されます。 + +"U" は最後に変更した行から離れた後でも、また "u" を実行した後でも動作します。 + +8bit 目がセットされている文字は表示されます。その文字が 'isprint' オプションに +含まれていなければ、'~' と 0xa0 の間の文字は "~?"、"~@"、"~A"、などなどのよう +に表示されます。 + +"][" は C の関数の次の終わりに移動します(一桁目が '}' の行)。 +"[]" は C の関数の前の終わりに移動します(一桁目が '}' の行)。 + +"]f"、"[f" と "gf" はカーソルの下のファイル名の編集を開始します。CTRL-W f は +カーソルの下のファイル名の編集をウィンドウを分割してそこで開始します。 + +"*" はカーソルの下の識別子を前方に検索し、"#" は後方に検索します。 +"K" はカーソルの下の識別子を引数として 'keywordprg' オプションに定義されている +プログラムを呼び出します。 + +'%' は前に数を前置することでそのファイルのパーセント数の場所にジャンプします。 +数を前置しない場合はくくられているテキストの中では対応する括弧に移動します。 + +CTRL-] コマンドでは、カーソルは識別子の真ん中にあります。 + +使ったタグは覚えておかれます。タグスタックと共に使用されるコマンドは CTRL-T と +":pop" と ":tag" です。":tags" はタグスタックの内容をリスト表示します。 + +'tags' オプションはタグファイル名のリストを設定することができます。ですので複 +数のタグファイルを使うことができます。ファイル名が '.' で始まる場合は '.' はそ +のファイルのパスに展開されます。こうすることで編集しているファイルがあるディレ +クトリと同じディレクトリのタグファイルを使うことができるようになります + +前に編集されたファイルは代替ファイルリストに覚えておかれます。CTRL-^ に数を前 +置することでこのリストのインデックスの番号のファイルにジャンプできます。 +":files" コマンドで開いたファイルの一覧を見ることができます。 +"#<N>" はリスト内の<N>番目のファイルの名前で置換されます。 +"#<" は現在のファイル名から拡張子を取り除いたもので置換されます。 + +検索パターンも強化されました。<NL> 文字を検索パターンや ":s" コマンドの文字列 +の一部に使うことができます。Vi では単にコマンドの終了と見なされます。 + +検索ではマッチした最後にカーソルをおくこともできますし、オフセット文字を使って +検索することもできます。 + +"~"、":next"、":Next"、"n"、"N" にカウントを前置することができるようになりまし +た。 + +'autowrite' オプションがセットされている場合でも ":next!" コマンドはファイルを +書き込みません。Vi ではファイルは上書きされましたが、これはバグだと思われます。 +というのもそういう動作は期待されませんし ":rewind!" コマンドでは書き込まれない +からです。 + +Vi では置換モードで <CR> を打ち込んだときに文字を削除するのは 'ai' がセットさ +れている場合のみでした(しかし <Esc> キーが押されるまでは表示されませんでし +た)。Vim は常に文字を削除します(またすぐに表示します)。 + +:wnext コマンドが追加されました。":write" コマンドを実行して ":next" コマンド +を実行するのと同じです。 + +":w!" コマンドは上書き禁止されているファイルでも常に書き込みます。Vi では +":!chmod+w %:S" してから ":set noro" としなければなりませんでした。 + +'tildeop' がセットされていると "~" はオペレータとして動作します(移動コマンドを +後に続けます)。 + +"J" (連結)コマンドを実行するときにピリオドの後でスペースを挿入するのを一つだけ +にするように 'joinspaces' オプションを再セットすることができます(Vi では2つの +スペースが挿入されます)。 + +"cw" はいくつかの文字で構成されるホワイトスペースを変更できます(Vi では "cw" +はスペースを一つだけ変更するのに "dw" はすべてのホワイトスペースを削除するとい +う紛らわしい仕様でした)。 + +"o" と "O" は回数を前置することができます(Vi は表示の一部分を削除します)。 + +Ex コマンドの後につけるフラグはサポートされていません(予定もありません)。 + +UNIX システム以外では ":cd" コマンドはホームディレクトリに移動するのではなく +(ホームディレクトリはないです)、現在のディレクトリを表示します。":pwd" はすべ +てのシステムで現在のディレクトリを表示します。 + +":cd" コマンドの後でもファイル名(引数リストや開いたファイル)は元のファイルを指 +します。Viではファイルに変更があると ":cd" できません。そうでなければファイル +名の解釈が変わってしまうからです。 + +":source!" コマンドはファイルから Vi コマンドを読み込みます。 + +":mkexrc" コマンドは現在の変更されているオプションとマッピングを ".exrc" ファ +イルに書き出すコマンドです。":mkvimrc" は ".vimrc" ファイルに書き出します。 + +マッピングで「最後が再帰的であるかどうか」のチェックはされません。つまり次のよ +うなマッピングもできます。 +":map! foo ^]foo". + +マッピングが数字で始まる場合は、Vi ではそのカウントが失われてしまっていました +(例: ":map g 4G" というマッピングを使っていると "7g" は4行目に移動してしまいま +した)。これは Vi のバグだと考えられます。Vim では多くの人が期待する動作である +ようにカウントを連結します(この例の場合は "74G" になります。 + +:put! コマンドは現在の行の上にレジスタの内容を挿入します。 + +Vi での "p" と "P" コマンドは挿入されるテキストが一行より短い場合は "." で繰り +返すことができませんでした。Vim では常に繰り返すことができます。 + +":noremap" コマンドは再マップされないマップを作るのに使うことができます。これ +は2つのキーの意味を交換するのに使うと便利です。":cmap", ":cunmap", ":cnoremap" +はコマンドライン編集でのみ動作するマッピングです。":imap", ":iunmap", +":inoremap" は挿入モードのみで動作するマッピングを定義できます。同様なコマンド +は短縮入力にもあります: ":noreabbrev", ":iabbrev", ":cabbrev", ":iunabbrev", +":cunabbrev", ":inoreabbrev", ":cnoreabbrev" + +Vi では ":map foo bar" は前の ":map bug foo" というマッピングを削除していまし +た。これはバグと思われますので Vim ではその仕様は含まれません。":unmap! foo" +は "map! bug foo" というマッピングを削除します。なぜならそうでなければマッピン +グを外すのが非常に困難になるからです(これは Vi と同じ動作です)。 + +':' レジスタは最後のコマンドラインを含んでいます。 +'%' レジスタは現在のファイル名を含んでいます。 +'.' レジスタは最後に挿入されたテキストを含んでいます。 + +":dis" コマンドはヤンクレジスタの内容を表示します。 + +CTRL-O/CTRL-I は古い/新しい場所に移動するのに使うことができます。これらの移動 +する場所は '' コマンドで移動する場所と同じですが他のファイルの中でもありえます。 +":jumps" コマンドは古い場所をリストします。 + +'shiftround' オプションがセットされていると ">" と "<" コマンドでは +'shiftwidth' の倍数になるようにインデントは調整されます。 + +'scrolljump' オプションはスクリーンからカーソルが出たときにスクロールする最小 +の行数を設定することができます。もしスクロールが遅い場合はこれをセットしてくだ +さい。 + +'scrolloff' オプションでカーソルの上や下に保持しておく最小の行数を設定できます。 +これを設定しておくとカーソルの前後を見渡せるようになります。かなり大きい数字に +セットしておけばカーソル行は常にウィンドウの中央に来ることになります。 + +大文字のマークはファイルを越えてジャンプするのに使うことができます。":marks" +コマンドは現在セットされているすべてのマークをリストします。"']" と "`]" は前 +に操作を行った場所の最後か、テキストを挿入したかプットした場所の最後に移動しま +す。"'[" と "`[" は初めに移動します。 + +'shelltype' オプションは Amiga 上で使われるシェルのタイプを反映させるのに使う +ことができます。 + +'highlight' オプションはいくつかのコマンドで使われるハイライトモードを設定する +ことができます。 + +CTRL-A (加算) と CTRL-X (減算) コマンドが新たに追加されました。カウントを前置 +することもでき(初期値 1)、カーソルの下もしくは後の数字をその値の分加算/減算す +るのに使うことができます。数は10進数、8進数(0で始まります)、16進数(0xで始まり +ます)でもよいです。マクロを使うときに非常に便利です。 + +:set コマンドでは "inv" を前置することで二者択一のオプションは逆の意味にするこ +とができます。 + +Vi と Vim の両方で ":substitute" コマンドで CTRL-M を使うことで改行を挿入する +ことができます。Vi ではこのためにテキストに実際の CTRL-M を挿入することができ +なかったのですが、Vim では CTRL-V を前に挿入してから実際の CTRL-M をおくことが +できます。 + + +挿入モードで: + +'revins' オプションがセットされていると挿入は逆方向に向かってなされます。これ +はヘブライ語を入力するためです。普通の文字を挿入するときはカーソルは逆方向にな +りませんしテキストは右方向に動きます。バックスペース、CTRL-W、CTRL-U もまた逆 +方向に動作します。置換モードではなんら影響しません。コンパイル時にのみ有効にす +ることができます。 + +オートインデントを削除するのにバックスペースキーをちょうど CTRL-D のように使う +ことができます。 + +'backspace' (bs) オプションが "eol" を含んでいると改行をこえてバックスペースし +たり CTRL-U したり CTRL-W することができます。'backspace' が "start" を含んで +いると挿入の初めをこえてバックスペースすることができます。 + +'paste' オプションがセットされているといくつかのオプションが解除され挿入モード +でのマッピングと短縮入力が使用不可になります。こうすることでウィンドウシステム +でテキストを貼り付けるときに不測の結果が生じるのを避けることができます。 +'paste' オプションが解除されればオプションの前の値が復元されます。 + +CTRL-T/CTRL-D はカーソルがどこの桁位置にあっても常に現在の行のインデントを挿 +入/削除します。 + +CTRL-@ (前に挿入したテキストを挿入する)は常に動作します(Vi: 初めの文字としてを +打ち込んだときにのみ)。 + +CTRL-A は CTRL-@ のように動作しますが挿入モードから抜けません。 + +CTRL-R {0-9a-z..} はレジスタの内容を挿入するのに使うことができます。 + +'smartindent' オプションがセットされていると、C プログラムはもっとうまく自動イ +ンデントされます。'cindent' オプションをセットしているとさらにうまくインデント +されます。 + +CTRL-Y と CTRL-E は現在のカーソルの上/下の文字をコピーするのに使うことができま +す。 + +CTRL-V を打った後に3桁の8進数を打つことができ、このバイトの値がテキストに一文 +字として挿入されます。キーボードからは打ち込めない内部の文字を使うときに便利で +す。 + +'expandtab' (et) がセットされていると <Tab> は適切な数のスペースに展開されま +す。 + +ウィンドウは常にバッファの内容を反映します(Vi ではテキストを変更したりそのほ +かいくつかの場合では行われませんでした)。 + +Vim が DIGRAPHS を定義してコンパイルされていればダイグラフがサポートされます。 +普通のダイグラフのセットが含まれるようになり、":digraph" コマンドで見ることが +できます。":digraph {char1}{char2} {number}" でさらに追加することもできます。 +"CTRL-K {char1} {char2}" とするか "{char1} BS {char2}" ('digraph' オプションが +セットされている場合のみ) とすることでダイグラフを入力できます。 + +挿入をカウントを前置して行う場合、例 "10atest <Esc>"、Vi は初めの挿入に対して +のみ wrapmargin を扱うことができましたが、Vim ではすべてに対して扱います。 + +"i" か "a" コマンドでのカウント前置はすべてのテキストに対して利用できます。Vi +では一つの行に対してのみカウントを前置できました。"3iabc<NL>def<Esc>" は +"abcabcabc<NL>def" が Vi の動作で、"abc<NL>defabc<NL>defabc<NL>def" が Vim で +の動作です。 + + +コマンドラインモードで: + +<Esc> はコマンドラインを実行せずに抜けます。Vi ではコマンドラインを実行します +が、これはほとんどの人が予測する動作とは違いました(<Esc> を打つことで常にコマ +ンドモードに戻るべきでしょう)。いくつかの曖昧なマクロでの問題を避けるため、マ +クロでの <Esc> はコマンドを実行します。もし <Esc> で Vi のようにコマンドを実行 +したい場合は次のように修正できます。 + ":cmap ^V<Esc> ^V<CR>" + +一般: + +'ttimeout' オプションは 'timeout' オプションに似ていますが、カーソルかファンク +ションキーに対してのみ働きます。'timeoutlen' オプションは待つ時間をミリ秒単位 +で指定することができます。'esckeys' オプションがセットされていない場合、<Esc> +キーで始まるカーソルとファンクションキーは挿入モードでは解釈されません。 + +端末文字列がそれぞれオプションとしてあります。termcap がサポートされていなかっ +たり独自の文字列に変更したい場合に利用することができます。 + +'fileformat' オプションは <EOL> を選択して設定するのに使います: "dos" +<CR><NL>, "unix" <NL>, "mac" <CR>。 +'fileformats' オプションが空でない場合、Vim は <EOL> のタイプを自動的に判断し +ようとします。'fileformat' オプションはそれに従ってセットされます。 + +ジョブコントロールを持たないシステム(古い Unix システムと Unix 以外のシステム) +ではCTRL-Z、":stop"、":suspend" コマンドは新しいシェルを起動します。 + +出力のための対話的なウィンドウなしで Vim が Amiga 上で起動された場合、ウィンド +ウが開かれます(そうして :sh コマンドは動作します)。|-d| 引数で編集する装置を指定 +することができます(例: "-d con:20/20/600/150")。 + +'columns' と 'lines' オプションはディスプレイの幅と高さを指定するのに使うこと +ができます。 + +ファイルの最初と最後の数行はオプションをセットするために読み込まれます。 +'modelines' オプションがどれだけの数の行を読み込もうとするかを決めることができ +ます(初期値は5です)。モードラインでどんな Ex コマンドも実行できる(重大なセキュ +リティ問題です)バージョンの Vi がありますがそれとは違うということに注意してく +ださい。 |trojan-horse| + +'insertmode' オプションがセットされていると(例えば .exrc で) Vim は挿入モード +で起動します。<Esc> キーを押すと元に戻ります。 + +アンドゥの情報はメモリに保持されます。使用可能なメモリの量でアンドゥの回数とア +ンドゥ可能なサイズが制限されます。このことは MS-DOS では問題になるかもしれませ +ん。Amiga ではほとんど問題にならないですし、Unix と Win32 では大体において決し +て問題になることはないです。 + +'backup' か 'writebackup' オプションがセットされていると: ファイルを上書きする +前にバックアップファイル(.bak)が作られます。"backup" オプションがセットされて +いるとバックアップファイルは残されたままになります。 + +Vim は変更されたファイルの一部分やメモリに入りきらないものを保持するためにファ +イルの最後が ".swp" であるファイルを作成します。このファイルはクラッシュした編 +集セッションを "vim -r file" として復元するのに使われます。'updatecount' オプ +ションを 0 にするか Vim を "-n" オプションをつけて起動するとスワップファイルを +使うのをやめさせることができます。.swp ファイルをどこか別の場所に作成させたい +場合は 'directory' オプションを設定してください。 + +Vim は8.3形式のファイルシステムでも正しく動作することができます。また Amiga 上 +での汚い DOS もしくは 雑種の DOS ファイルシステムでも使うことができますし、8.3 +形式のファイルシステムを搭載したどんな Unix でも動作します。|'shortname'| もご +覧下さい。 + +エラーメッセージは少なくとも1秒は表示されます(Vi ではエラーメッセージは上書き +されます) + +|hit-enter| プロンプトが出た場合でもどんなキーでも打つことができます。<CR>、 +<NL>、<Space> 以外の文字はコマンド(の最初)として解釈されます(Vi では ':' で始 +まるコマンドしか受け付けませんでした)。 + +番号付きレジスタと名前なしレジスタの内容はファイルが変更されたときに覚えておか +れます。 + +"No lines in buffer" メッセージはマッピングが拒否された理由で表示される、エラー +メッセージではなく普通のメッセージです。 + +Amiga の AUX: デバイスをサポートしています。 + +============================================================================== +6. コマンドライン引数 *cmdline-arguments* + +異なるバージョンの Vi では異なるコマンドライン引数があります。これはちょっと紛 +らわしいですので便宜のためにこの章では違いの概略を説明します。 + +5つの種類の Vi がここでは考慮されます: + Elvis Elvis version 2.1b + Nvi Nvi version 1.79 + Posix Posix 1003.2 + Vi Vi version 3.7 (Sun 4.1.x) + Vile Vile version 7.4 (不完全) + Vim Vim version 5.2 + +Vim だけがファイル名の後でもオプションを受け付けます。 + ++{command} Elvis, Nvi, Posix, Vi, Vim: "-c {command}" と同じです。 + +- Nvi, Posix, Vi: Ex をバッチモードで起動します + Vim: 標準入力からファイルを読み込みます(バッチモードを使うには + -s を利用してください)。 + +-- Vim: オプションの終わりです。この後はファイル名のみ書くことが + できます。 + +--cmd {command} Vim: vimrcファイルを読み込む前に{command}を実行します + +--echo-wid Vim: GTK+がウィンドウのIDを標準出力に書き出します。 + +--help Vim: ヘルプメッセージを表示して終了します。 + +--literal Vim: ファイル名のワイルドカードを処理しません + +--nofork Vim: |-f|と同じです + +--noplugin[s] Vim: プラグインの読み込みをしません + +--remote Vim: 他のVimサーバーでそのファイルの編集をします + +--remote-expr {expr} Vim: 他のVimサーバーで{expr}を評価します + +--remote-send {keys} Vim: Vimサーバーに{Keys}を送って終了します + +--remote-silent {file} Vim: 可能なら他のVimサーバーでファイルの編集をします + +--remote-wait Vim: 他のVimサーバーでファイルの編集をして、それが終わるまで待 + 機します + +--remote-wait-silent Vim: --remote-waitと同じですが、それが不可能な場合でも + エラーをだしません。 + +--role {role} Vim: GTK+ 2: メインウィンドウのroleを設定します + +--serverlist Vim: Vimサーバーのリストを出力して終了します + +--servername {name} Vim: Vimサーバーの名前を指定します + +--socketid {id} Vim: Vimを起動するGTKウィンドウのsocket + +--windowid {id} Vim: Vimを起動するWin32のウィンドウID + +--version Vim: バージョンメッセージを表示して終了します。 + +-? Vile: 簡単な使い方を表示して終了します。 + +-a Elvis: 指定されたファイル名をそれぞれ一つのウィンドウに読み込 + みます(Vim では -o を使ってください)。 + +-A Vim: アラビア語モードで起動します(その機能が組み込まれているな + ら) + +-b {blksize} Elvis: ファイルのセッションに {blksize} のブロックサイズを使い + ます。 +-b Vim: 'binary' モードをセットします。 + +-C Vim: Vi 互換モードで起動します。 + +-c {command} Elvis, Nvi, Posix, Vim: ファイルを編集バッファにロードした後 + {command} を Ex コマンドとして走らせます。 + Vim: 10個まで "-c" 引数をとることができます。 + +-d {device} Vim: I/O に {device} を使います(Amiga のみ)。{|+diff|の機能を + 外してコンパイルされたときのみ} +-d Vim: 'diff'を設定して起動します|vimdiff| + +-dev {device} Vim: I/O に {device} を使います(Amiga のみ) + +-D Vim: デバッグモード + +-e Elvis, Nvi, Vim: あたかも "ex" が起動されたように Ex モードで + 起動します。 + +-E Vim: "exim"のように、より良いExモードで起動します|gQ| + +-f Vim: GUI をフォアグラウンドジョブとして起動します(Amiga: 新た + にウィンドウを開きません)。 +-f {session} Elvis: {session} をセッションファイルとして使います。 + +-F Vim: ペルシアモードで起動します(Farsi 付きでコンパイルされてい + る場合)。 + Nvi: 編集を開始するときにファイルのすべてを読み込まず素早く起 + 動します。 + +-G {gui} Elvis: {gui} をユーザーインターフェイスとして使います。 + +-g Vim: GUI で起動します。 +-g N Vile: N 行目から編集を開始します。 + +-h Vim: ヘルプメッセージを表示します。 + Vile: ヘルプファイルを編集します。 + +-H Vim: ヘブライモードで起動します(ヘブライオプションをつけてコン + パイルされている場合)。 + +-i Elvis: それぞれのウィンドウを挿入モードで起動します。 +-i {viminfo} Vim: {viminfo} を Viminfo ファイルとして使います。 + +-L Vim: "-r" と同じです(またいくつかのバージョンの Vi でもそうで + す)。 + +-l Nvi, Vi, Vim: 'lisp' と 'showmatch' オプションをセットします。 + +-m Vim: 変更を書き込むことを禁止し、'write' オプションを解除しま + す。 + +-M Vim: 変更を加えることを禁止し、'write' オプションと + 'modifiable' オプションを解除します。 + +-N Vim: 互換モードではないモードで起動します。 + +-n Vim: スワップファイルを使いません。 + +-nb[args] Vim: NetBeansへの接続を開きます + +-O[N] Vim: -oと同じですが、ウィンドウを縦分割します + +-o[N] Vim: [N]個のウィンドウを開きます。もしくは各ファイルに1個ずつ + ウィンドウを開きます。 + +-p[N] Vim: [N]個のタブページを開きます。もしくは各ファイルに1個ずつ + タブページを開きます。 + +-P {parent-title} Win32 Vim: 親となるアプリケーションの内側でVimを開きます + +-q {name} Vim: {name} をクイックフィックスエラーファイルとして使います。 +-q{name} Vim: 同上。 + +-R Elvis, Nvi, Posix, Vile, Vim: 'readonly' オプションをセットし + ます。 + +-r Elvis, Nvi, Posix, Vi, Vim: 復元モード + +-S Nvi: 'secure' オプションをセットします。 +-S {script} Vim: 起動後にスクリプトを実行します。 + +-s Nvi, Posix, Vim: Exモードでは "-"(サイレントモード)と同じです。 + Elvis: 'safer' オプションをセットします。 +-s {scriptin} Vim: {scriptin} からスクリプトを読み込みます; Ex モードでない + ときにのみ有効です。 +-s {pattern} Vile: {pattern} を検索します。 + +-t {tag} Elvis, Nvi, Posix, Vi, Vim: {tag} を含むファイルを編集します。 +-t{tag} Vim: 同上。 + +-T {term} Vim: {term} に端末名をセットします。 + +-u {vimrc} Vim: {vimrc} ファイルを初期化ファイルとして読み込みます。 + +-U {gvimrc} Vim: {gvimrc} ファイルを GUI 初期化ファイルとして読み込みます。 + +-v Nvi, Posix, Vi, Vim: ノーマルモードで起動します(Vi ではビジュ + アルモードを意味していました)。 + Vile: 閲覧モードで起動し、変更は不可です。 + +-V Elvis, Vim: 冗長なモードで起動します。 +-V{nr} Vim: 特定レベルの冗長なモードで起動します。 + +-w {size} Elvis, Posix, Nvi, Vi, Vim:'window'の値を{size}にセットします。 +-w{size} Nvi, Vi: "-w {size}" と同じです。 +-w {name} Vim: スクリプトファイル{name}に書き込みます(non-digit で起動し + なければなりません)。 + +-W {name} Vim: スクリプトファイル{name}に追加します。 + +-x Vi, Vim: 暗号鍵の入力を尋ねさせます。|encryption|もご覧下さい。 + +-X Vim: Xサーバーに接続しません。 + +-y Vim: |evim|のように簡単モードで起動します。 + +-Z Vim: 制限モード + +@{cmdfile} Vile: {cmdfile} を初期化ファイルに使います。 + +============================================================================== +7. POSIX 準拠 *posix* *posix-compliance* + +2005年、Vimの互換性をチェックするためにPOSIXテストを行いました。テストのほとん +どはパスしました。Vi互換モードで実行したときでもPOSIX準拠でない点が2,3ありまし +た。 + *$VIM_POSIX* +Vim起動時にオプション 'cpoptions' にPOSIXフラグを含めるには、環境変数 +$VIM_POSIX を設定してください。そうするとVimができるだけPOSIXに従うようになり +ます。これは Vi互換であることとは少し違います。 + +以下はVimがPOSIX仕様に従わない点とその理由です: + + *posix-screen-size* + Vimは端末からより確かな方法でサイズが得られると、環境変数 $COLUMNS と + $LINES を無視します。'cpoptions' にフラグ 'l' を加えると $COLUMNS と + $LINES が他の方法で得られたサイズを上書きするようになります。 + + オリジナルのViではコマンド "{" と "}" は "{" で止まりませんが、POSIXは + 止まるように指定しています。POSIX流を望むなら 'cpoptions' にフラグ '{' + を加えてください。 + + コマンド "D", "o", "O" がカウントを受け付けます。繰り返されたときもで + す。カウントを無視するようにしたければ 'cpoptions' にフラグ '#' を加え + てください。 + + 'cpoptions' にフラグ '.' が入っていると、バッファが変更されているとき + コマンド ":cd" が失敗します。 + + ViにはATTENTIONメッセージはありません。ATTENTIONメッセージを出さなくす + るには 'shortmess' にフラグ "A" を加えてください。 + +POSIXテストの実行についての注意: +- viテスト33はときどき未知の理由のために失敗します +- viテスト250が失敗します。新しいバージョンで挙動が変更されるでしょう。 + http://www.opengroup.org/austin/mailarchives/ag-review/msg01710.html + (今はリンク切れ。現在の場所はおそらくここ: + https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-review-l&id=1711) +- viテスト310が失敗します。エラーが起きたとき終了コードが非ゼロになる? +- exテスト24が失敗します。テストが間違っているためです。SUSv2とSUSv3の間に変更 + されました。 +- exテスト47, 48, 49, 72, 73が失敗します。サイレントモードでは.exrcは読み込ま + れず、$EXINITが使われないためです。 +- exテスト76, 78が失敗します。printfの代わりにechoが使われるためです(修正され + ました)。Also: problem with \s not changed to space. +- exテスト355が失敗します。"30z" のときに 'window' が使われないためです。 +- exテスト368が失敗します。サイレントモードでシェルコマンドがエコーされないた + めです。 +- exテスト394が失敗します。コマンド "=" の出力がサイレントモードで見えないため + です。 +- exテスト411が失敗します。テストファイルが迷子の ':' を含んで正しくないためで + す。 +- exテスト475, 476が失敗します。サイレントモードでリプリント出力が見えないため + です。 +- exテスト480, 481が失敗します。tagsファイルがタブでなくスペースを含んでいるた + めです。 +- exテスト502が失敗します。サイレントモードで .exrc が読まれないためです。 +- exテスト509が失敗します。サイレントモードで .exrc が読まれないためです。ま + た、終了コードが2でなく1になるためです。 +- exテスト534が失敗します。サイレントモードで .exrc が読まれないためです。 + + +vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/visual.jax b/plugins/vimdoc-ja/doc/visual.jax new file mode 100644 index 0000000000..9c9caf8e80 --- /dev/null +++ b/plugins/vimdoc-ja/doc/visual.jax @@ -0,0 +1,524 @@ +*visual.txt* For Vim バージョン 8.0. Last change: 2014 Mar 23 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +ビジュアルモード *Visual* *Visual-mode* *visual-mode* + +ビジュアルモードは利用者にとってテキストの部分を選択する柔軟で簡単な方法であ +る。矩形(くけい)範囲のテキスト(ブロック)を選択する唯一の方法でもある。 + +ユーザーマニュアルの|04.4|で簡単に説明されている。 + +1. ビジュアルモードを使う |visual-use| +2. ビジュアルモードの開始と終了 |visual-start| +3. ビジュアル領域の変更 |visual-change| +4. ビジュアル領域での操作 |visual-operators| +5. 矩形範囲の操作 |blockwise-operators| +6. 繰り返し |visual-repeat| +7. 使用例 |visual-examples| +8. 選択モード |Select-mode| + +{Vi にはビジュアルモードは無く、"visual" という名前はExモードとは区別するため +に、ノーマルモードを指して使われている} +{Vim 7.4.200 からは |+visual| 機能は常に含まれる} + +============================================================================== +1. ビジュアルモードを使う *visual-use* + +ビジュアルモードを使うには3つの部分から構成される: +1. 選択したいテキストの開始位置を "v"、"V" またはCTRL-Vでマークする。 + カーソルの下の文字が開始位置として使用される。 +2. 選択したいテキストの終了位置に移動する。 + ビジュアルモードの開始位置からカーソルの下の文字を含むテキストが強調され + る。 +3. 操作キー(オペレータ)を押す。 + 強調された文字が操作対象になる。 + +ビジュアルモードでの強調表示の仕方を設定するのに、'highlight' オプションを使用 +することができる。 +文字のない場所を選択するには 'virtualedit' を設定する。 + +強調されたテキストにはカーソルの下の文字も含まれる。 +けれども、'selection' オプションが "exclusive" に設定されていて、カーソルが +Visualエリアの後にあるとき、カーソルの下の文字は含まれない。 + +"v" では開始位置より前と、終了位置より後のテキストは強調されない。しかし全ての +大文字とアルファベット以外のキーによる操作は、"~" と "U" を除いて、表示に関係 +なく行単位で働く。下記の操作一覧を参照。 + + *visual-block* +CTRL-V(矩形ビジュアルモード)は開始位置からカーソルの位置まで、テキストを矩形に +強調する。しかし、幾つかの操作(下記のリストを参照)はそれとは関係無く行単位で適 +用される。「変更」と「置き換え」の操作は強調されたテキストを削除し、選択範囲の +左上より挿入を開始する。 + +============================================================================== +2. ビジュアルモードの開始と終了 *visual-start* + + *v* *characterwise-visual* +[count]v 文字単位のビジュアルモードを開始する。 + [count] を指定すると、最後に実行したビジュアル操作の文 + 字数または行数が選択される。ただし、選択位置は現在の + カーソル位置であり、[count] を掛けた値が選択される。 + 最後のビジュアル操作が矩形選択なら、幅と高さが [count] + 倍される。 + 最後に実行したビジュアル操作がない場合は、[count] 文字 + が選択される。つまり、カーソルを右に [count] 文字動か + した範囲が選択される。 + 'selection' が "exclusive" でない場合は 1 文字少なくな + る。 + + *V* *linewise-visual* +[count]V 行単位のビジュアルモードを開始する。 + [count] を指定すると、最後のビジュアル操作と同じモード + で同じ行数を選択する。ただし、現在の位置で選択を開始 + し、行数に [count] を掛ける。最後に実行したビジュアル + 操作がない場合は、[count] 行数が選択される。 + + *CTRL-V* *blockwise-visual* +[count]CTRL-V 矩形ビジュアルモードを開始する。Note: Windowsでは + CTRL-Vはテキストの貼り付けにマップされることがあり、そ + の際にはビジュアルモードを開始できない。 + |CTRL-V-alternative|を参照。 + [count] を指定した場合は、上記の `v` と同様。 + +ビジュアルモードの最中に <Esc> を使用したり、マウスの右ボタンをクリックしたり、 +または他のバッファに移動するコマンドを使用した場合には、強調は停止しテキストに +は何の操作も行われない。文字単位のビジュアルモード中に "v" を叩いた時や、矩形 +ビジュアルモード時の "CTRL-V"、行単位のビジュアルモードでの "V" も同様である。 +CTRL-Z を押すと強調は停止し、エディタが一時停止するか新しいシェルが開始される +|CTRL-Z|。 + + タイプ後の新モード: *v_v* *v_CTRL-V* *v_V* +旧モード "v" "CTRL-V" "V" ~ + +ノーマル ビジュアル 矩形ビジュアル 行ビジュアル +ビジュアル ノーマル 矩形ビジュアル 行ビジュアル +矩形ビジュアル ビジュアル ノーマル 行ビジュアル +行ビジュアル ビジュアル 矩形ビジュアル ノーマル + + *gv* *v_gv* *reselect-Visual* +gv 最後に使用したのと同じ範囲のビジュアルモードを開始す + る。ビジュアルモードで使用すると、現在の選択領域と以前 + のものとが交換される。 + ビジュアルモードで "p" や "P" を実行した後にこれを使う + と、プットしたテキストが選択される。 + + *gn* *v_gn* +gn 最後に使われた検索パターンを前方検索し (`n` のように)、 + マッチしたものを選択してビジュアルモードを開始する。 + カーソルがマッチの上にあるときは、それをビジュアル選択 + する。 + オペレータ待ちのときは、マッチに対してオペレータを実行 + する。例: "dgn" は次のマッチを削除する。 + すでにビジュアルモードなら、次のマッチの末尾まで選択範 + 囲を拡大する。 + + *gN* *v_gN* +gN |gn| と同じだが、後方検索する (`N` のように)。 + + *<LeftMouse>* +<LeftMouse> 現在のカーソル位置を設定する。ビジュアルモードが活動中 + の場合は停止する。オプション 'mouse' が 'n' もしくは + 'a' を含むときだけ働く。指定した位置がスクリーンの下端 + から 'so' 行以内の時にはテキストがスクロールアップす + る。指定した位置がスクリーンの上端から 'so' 行以内の時 + にはテキストがスクロールダウンする。 + + *<RightMouse>* +<RightMouse> ビジュアルモードが活動していないのならば開始する。カー + ソルの位置からクリックした位置までのテキストが強調され + る。ビジュアルモードが既に活動しているならば、開始位置 + か終了位置のどちらか近いほうがクリックした位置になる。 + オプション 'mouse' が 'n' もしくは 'a' を含むときだけ + 働く。 + + Note: 'mousemodel' が "popup" の時には<RightMouse>の代 + わりに<S-LeftMouse>を使用する。 + + *<LeftRelease>* +<LeftRelease> <LeftMouse>と同じ位置でなければ、これは<LeftMouse>のよ + うに働く。古いxtermでは実行されているディスプレイ(環境 + 変数DISPLAYもしくは-display引数による)へのアクセスが無 + い限り、xterm上ではボタンが離されるまで選択領域を見る + ことはできない。'mouse' オプションが 'n' もしくは 'a' + を含むときだけ働く。 + +ビジュアルモードが活動していない時に "v"、"V" もしくは CTRL-V が数字 (カウント) +の後に使用されると、以前の強調領域の大きさが開始位置から使用される。その時カー +ソルは強調領域の終了位置へ移動し通常の操作を行うことができる。領域の形式 (文 +字、行、矩形) は過去のものが使用される。 +- 行ビジュアルモード: 行数がカウント倍される。 +- 矩形ビジュアルモード: 行数とカラム数がカウント倍される。 +- 1行内の通常ビジュアルモード: 文字数がカウント倍される。 +- 複数行にまたがる通常ビジュアルモード: 行数がカウント倍され、最終行だけは前回 + の強調領域の最終行と同じ文字数が使用される。 +テキストの開始位置はカーソルの位置となる。強調テキストを拡張するための最後のコ +マンドとして "$" コマンドが使用された場合、領域は最長の行の最右端のカラムまで +拡張される。 + +前回の時と全く同じ領域を強調したいときには、"gv" を使用できる |gv| |v_gv|。 + + *v_<Esc>* +<Esc> ビジュアルモード時: ビジュアルモードを停止する。 + + *v_CTRL-C* +CTRL-C ビジュアルモード時: ビジュアルモードを停止する。挿入 + モードがぶら下がっている時には (モードメッセージが + "-- (insert) VISUAL --" となる)、そちらも終了する。 + +============================================================================== +3. ビジュアル領域の変更 *visual-change* + + *v_o* +o 強調されたテキストのもう一方の端へ移動する: 現在のカー + ソルの位置が強調されたテキストの開始地点になり、カーソ + ルは強調されたテキストのもう一方の端に移動する。強調さ + れた領域は同じままに保たれる。 + + *v_O* +O 強調されたテキストのもう一方の端へ移動する: これは "o" + に近い動作だが、矩形ビジュアルモードではカーソルが同じ + 行内のもう一方のコーナーに移動する。移動した先のキャラ + クタが画面上で1つ以上の文字幅を占有している場合(例えば + <Tab>文字)、強調される範囲は変更・拡張される。 + + *v_$* +矩形ビジュアルモード時に "$" コマンドを使用すると、選択されるテキストの右終端 +は選択されているラインのうち一番長いものによって決定される。この状態は水平方向 +への移動コマンドを使うことで終了する。 + +ブロックの終端へ移動するために色々なコマンドを使うことができるが、Exコマンド、 +変更を加えるコマンド、もしくはファイルを放棄するコマンドは使用できない。次の文 +字で開始するコマンド ".", "&", CTRL-^, "Z", CTRL-], CTRL-T, CTRL-R, CTRL-I, +CTRL-O を使用するとブザー音が発生し、ビジュアルモードが継続される。 + +同じバッファを表示している別のウィンドウに切り替えるとき、そのウィンドウのカー +ソル位置はVisual選択に合わせて調整される。これは特にVisual選択の開始位置や終了 +位置を確認するのに便利である。選択範囲を変更するのに<RightMouse>が使える。 +('mousemodel' が "popup" に設定されているときは<S-LeftMouse>)。 + +============================================================================== +4. ビジュアル領域での操作 *visual-operators* + +施すことのできる操作: + ~ 大/小文字の切替 |v_~| + d 削除 |v_d| + c 変更 (4) |v_c| + y ヤンク |v_y| + > 右シフト (4) |v_>| + < 左シフト (4) |v_<| + ! 外部コマンドによるフィルタ (1) |v_!| + = 'equalprg' オプションで指定されたフィルタ (1) |v_=| + gq 'textwidth' の長さによる行の整形 (1) |v_gq| + +使用できるオブジェクト: + aw (空白文字を含む) 1語 {訳注: |word|} |v_aw| + iw 1語 {訳注: |word|} |v_iw| + aW (空白文字を含む) 1語 {訳注: |WORD|} |v_aW| + iW 1語 {訳注: |WORD|} |v_iW| + as (空白文字を含む) 1文 |v_as| + is 1文 |v_is| + ap (空白文字を含む) 1段落 |v_ap| + ip 1段落 |v_ip| + ab (丸括弧文字を含む) ()のブロック |v_ab| + ib ()のブロックの中身 |v_ib| + aB (波括弧文字を含む) {}のブロック |v_aB| + iB {}のブロックの中身 |v_iB| + at (タグ自身を含む) <tag> </tag> ブロック |v_at| + it <tag> </tag> ブロックの中身 |v_it| + a< (大小記号文字を含む) <>のブロック |v_a<| + i< <>のブロックの中身 |v_i<| + a[ (角括弧文字を含む) []のブロック |v_a[| + i] []のブロックの中身 |v_i[| + a" (クォートを含む) ダブルクォート文字列 |v_aquote| + i" ダブルクォート文字列の中身 |v_iquote| + a' (クォートを含む) シングルクォート文字列 |v_a'| + i' シングルクォート文字列の中身 |v_i'| + a` (backtick を含む) backtick 文字列 |v_a`| + i` backtick 文字列の中身 |v_i`| + +加えて、以下のコマンドが使用可能: + : 強調された行にExコマンドを適用 (1) |v_:| + r 変更 (4) |v_r| + s 変更 |v_s| + C 変更 (2)(4) |v_C| + S 変更 (2) |v_S| + R 変更 (2) |v_R| + x 削除 |v_x| + D 削除 (3) |v_D| + X 削除 (2) |v_X| + Y ヤンク (2) |v_Y| + p 貼り付け |v_p| + J 連結 (1) |v_J| + U 大文字化 |v_U| + u 小文字化 |v_u| + ^] タグ検索 |v_CTRL-]| + I ブロック挿入 |v_b_I| + A ブロック追加 |v_b_A| + +(1): 常に全部の行、|:visual_example|を参照。 +(2): CTRL-Vを使ってないときは全部の行。 +(3): CTRL-Vを使ってないときは全部の行、CTRL-Vを使っているときは行の最後までを + 削除。 +(4): CTRL-Vを使っているときにはブロックにのみ作用。 + +ビジュアルモードでは特別なキー割り当てを行うために ":vmap" コマンドを使うこと +ができることに注意。例えば、"/" をビジュアル領域を拡張するのではなくて、選択し +たテキストによる検索を行わせたい場合には: > + :vmap / y/<C-R>"<CR> +(<>表記 |<>| の中身は、これを入力する時には文字通り入力すれば良い; ただし +'cpoptions' から 'B' と '<' のフラグを外しておく必要がある) + +""" コマンドを使用してレジスタ名を指定したい場合には、操作キーを入力する前にタ +イプする: "v{move-around}"xd"。 + +コマンドの回数を指定したい場合には、操作キーを入力する前にタイプする: +"v{move-around}3>" (行を3単位、右へインデントする)。 + + *{move-around}* +{move-around}は一連の移動コマンドのシーケンス。1つの移動コマンドを意味する +{motion}とは異なるので注意。 + +ビジュアル領域に対して操作を行うもう1つの方法は、パターンにアイテム|/\%V|を含 +めることがある。例えば、ビジュアル領域内のすべての '('を 'X' に置換するには: > + + :'<,'>s/\%V(/#/g + +Note "'<,'>" はビジュアルモードで ":" を押すと自動的に挿入される。 + +============================================================================== +5. 矩形範囲の操作 *blockwise-operators* + +{|+visualextra|機能を無効にしてコンパイルした場合には利用できない} + +参考: 'virtualedit' オプションを設定して、行末を越えた選択や、Tab文字の(表示上 +の)途中での選択ができる。 + +矩形ビジュアル挿入 *v_b_I* +矩形選択中に、I{文字列}<ESC> を行うとブロック内の全ての行のブロック先頭にその +文字列が挿入され、行の長さはその分拡張される。選択ブロックの左側のカラムより短 +い行は変更されない。タブは見た目のカラムを保つように分解される。 +|v_b_I_example|を参照。 + +矩形ビジュアル追加 *v_b_A* +矩形選択中に、A{文字列}<ESC> を行うとブロック内の全ての行のブロック末尾にその +文字列が挿入される。ブロックの右端が真っ直ぐでない時には、行の長さの違いによっ +て異なる動作がある。 + +1. ブロックが <C-v>$ で作成された場合 + このケースでは各行の最後に文字列が追加される。 +2. ブロックが <C-v>{move-around}で作成された場合。 + このケースではブロック内の各行のブロック末尾に文字列が追加され、行長が拡張 + される。さらにブロックの末尾を揃えるために空白文字が挿入される。 +|v_b_A_example|を参照。 +Note: "I" と "A" は変更によって行が拡張されるときに違う動作をする。これはわざ +とそうなっていて、あなたがしたいようにできる。 + +矩形ビジュアル変更 *v_b_c* +矩形選択されたテキストの全てが同じテキスト文字列によって置き換えられる。"c" を +押した時には選択されたテキストが消去された後に挿入モードに入る。テキスト(改行 +を除く)を入力できる。<Esc>を叩くと、選択されていた行全てに同じ文字列が入力され +る。 + +矩形ビジュアル変更 (大文字) *v_b_C* +小文字の "c" と同様だが、選択領域が各行の末尾まで拡張される。 + + *v_b_<* +矩形ビジュアルシフト *v_b_>* +ブロックが 'shiftwidth' によりシフトされる。ブロックの右端には拠らない。ブロッ +クの左端がどのポイントから右シフトを適用するかを決定し、'ts' と 'et' に従い最 +適なタブ文字が埋め込まれる(パディング)。ブロックの左端が何処まで左シフトするか +を決定する。 +|v_b_>_example|を参照。 +|v_b_<_example|を参照。 + +矩形ビジュアル置換 *v_b_r* +強調された領域の全ての画面上の文字が同じ文字で置き換えられ、タブ文字は画面上の +レイアウトを保持するために仮想的な空白文字に置き換えられる。 +|v_b_r_example|を参照。 + + +============================================================================== +6. 繰り返し *visual-repeat* + +ビジュアルモードの操作を繰り返して行う時には、最後の時と同じ量のテキストに対し +て操作が適用されている: +- 行ビジュアルモード: 同じ行数 +- 矩形ビジュアルモード: 同じ行数とカラム数 +- 1行内の通常ビジュアルモード: 同じ文字数 +- 複数行にまたがる通常ビジュアルモード: 同じ行数で、最終行だけは前回の時の最 + 終行と同じ文字数。 +テキストの開始位置は現在の位置となる。最後のコマンドとして強調されたテキストを +拡張するために "$" が使用された場合には、繰り返されるコマンドへは一番長い行の +右端のカラムが適用される。 + + +============================================================================== +7. 使用例 *visual-examples* + + *:visual_example* +現在 ":" コマンドは行全体に対して働くだけである。行の一部を選択して、":!date" +のような何かを行っても1行全体が置換わってしまう。行の一部だけを置き換えたい場 +合には何かマッピングのようなものを作らなければならないだろう。将来のリリースで +は ":" は部分的に動作するようになるだろう。 + +ここに1つ、選択されたテキストを "date" の出力に置き換える例がある: > + :vmap _a <Esc>`>a<CR><Esc>`<i<CR><Esc>!!date<CR>kJJ + +(<>表記 |<>| の中身は、これを入力する時には文字通り入力すれば良い; ただし +'cpoptions' から 'B' と '<' のフラグを外しておく必要がある) + +これが何をしているかというと: +<Esc> ビジュアルモードを終了する +`> 選択領域の最後に移動する +a<CR><Esc> 選択領域の直後に改行を挿入する +`< 選択領域の先頭に移動する +i<CR><Esc> 選択領域の直前に改行を挿入する +!!date<CR> 選択されたテキストをdateでフィルタリングする +kJJ 分割した行を連結して1つにする + + *visual-search* +選択したテキストを検索に使用することを可能にするマッピングのアイデアがここにあ +る: > + :vmap X y/<C-R>"<CR> + +(<>表記 |<>| の中身は、これを入力する時には文字通り入力すれば良い; ただし +'cpoptions' から 'B' と '<' のフラグを外しておく必要がある) + +特別なキャラクタ('.' や '*' のようなもの)が問題を引き起こすことに注意。 + +矩形ビジュアルモードの例 *blockwise-examples* +以下のテキストを使って、矩形モードのコマンドの使用法と結果を示していく。どの +ケースでも、初めカーソルはテストテキストの最初の行の先頭の 'a' の上にあるもの +とする。 +以下、modelineの設定は ":ts=8:sw=4:" であることを仮定している。 + +次のように設定しておくと理解の助けになるだろう。 +:set hls +/<TAB> +<TAB>と書かれている場所は本物のタブに読み替える。これが操作を可視化してくれ +る。 + +テストテキストは: + +abcdefghijklmnopqrstuvwxyz +abc defghijklmnopqrstuvwxyz +abcdef ghi jklmnopqrstuvwxyz +abcdefghijklmnopqrstuvwxyz + +1. fo<C-v>3jISTRING<ESC> *v_b_I_example* + +abcdefghijklmnSTRINGopqrstuvwxyz +abc STRING defghijklmnopqrstuvwxyz +abcdef ghi STRING jklmnopqrstuvwxyz +abcdefghijklmnSTRINGopqrstuvwxyz + +2. fo<C-v>3j$ASTRING<ESC> *v_b_A_example* + +abcdefghijklmnopqrstuvwxyzSTRING +abc defghijklmnopqrstuvwxyzSTRING +abcdef ghi jklmnopqrstuvwxyzSTRING +abcdefghijklmnopqrstuvwxyzSTRING + +3. fo<C-v>3j3l<.. *v_b_<_example* + +abcdefghijklmnopqrstuvwxyz +abc defghijklmnopqrstuvwxyz +abcdef ghi jklmnopqrstuvwxyz +abcdefghijklmnopqrstuvwxyz + +4. fo<C-v>3j>.. *v_b_>_example* + +abcdefghijklmn opqrstuvwxyz +abc defghijklmnopqrstuvwxyz +abcdef ghi jklmnopqrstuvwxyz +abcdefghijklmn opqrstuvwxyz + +5. fo<C-v>5l3jrX *v_b_r_example* + +abcdefghijklmnXXXXXXuvwxyz +abc XXXXXXhijklmnopqrstuvwxyz +abcdef ghi XXXXXX jklmnopqrstuvwxyz +abcdefghijklmnXXXXXXuvwxyz + +============================================================================== +8. 選択モード *Select* *Select-mode* + +選択モードはビジュアルモードに似ているように見えるが、受け付けるコマンドが少し +異なる。これはMicrosoft Windowsの選択モードに似ている。オプション 'showmode' +が設定されている時には、"-- SELECT --" が最下の行に表示される。 + +選択モードに入るには: +- 'selectmode' が "mouse" を含んだ状態で、マウスを使って領域を選択する。 + 'mouse' が現在のモードのフラグを含んでなければならない。 +- 'selectmode' が "key" を含んだ状態で、シフトキーを押しながら表示できない移動 + コマンドを使用する。例えば: <S-Left>や<S-End>。'keymodel' が "startsel" を含 + んでいる必要もある。 +- 'selectmode' が "cmd" を含んだ状態で "v", "V" もしくはCTRL-Vを使用する。 +- ノーマルモードで "gh", "gH" もしくは "g_CTRL-H" コマンドを使用する。 +- ビジュアルモードでCTRL-Gを押す。 *v_CTRL-G* + +選択モードのコマンド: +- 表示可能な文字、及び<NL>と<CR>は選択領域を削除し、Vimは入力モードに移行す + る。タイプした文字は挿入される。 +- シフトキーを押しながらの表示不可能な移動コマンド、は選択領域を拡張する。 + 'keymodel' は "startsel" を含まねばならない。 +- シフトキーを押さずに表示不可能な移動コマンドを使用すると、選択モードを終了す + る。'keymodel' は "stopsel" を含まねばならない。 +- ESCは選択モードを終了する。 +- CTRL-Oでビジュアルモードに切り替え1つだけコマンドを実行する。 *v_CTRL-O* +- CTRL-Gでビジュアルモードに切り替える。 + +それ以外では、入力された文字はビジュアルモードと同様に扱われる。 + +選択モードで操作が行われると、行選択の時には、選択された行が操作対象になるが、 +文字選択の時のように扱われる。例えば、行全体を削除した時には、後でその内容を行 +の中間に貼り付けることができる。 + + +選択モード時のマッピングとメニュー *Select-mode-mapping* + +コマンド|:vmap|や|:vmenu|で定義したマッピングとメニューはビジュアルモードと選 +択モードの両方で働く。選択モードでは、それらのマッピングやメニューが実行される +直前に自動的にビジュアルモードに切り替わるので、ビジュアルモードと同じ動作が行 +われる。ビジュアルモードと選択モードで別々にマッピングを定義するときは|:xmap| +や|:smap|を使うこと。 + +ユーザーは印字可能な文字を押すと選択された領域が置換されることを期待している。 +そのため、選択モードで印字可能な文字にマップするのは避けること。または |:map| +と|:vmap|のあとで |:sunmap| をして選択モードに対するマップを削除すること。 + +マッピング及びメニューが終了した後には、選択領域が削除されるか、他のバッファに +切り替わるか、ウィンドウのレイアウトが変更されない限り、選択領域が再び有効にな +り選択モードになる。 + +文字が入力されたとき、選択領域が削除されて挿入モードに入り、その文字に対し挿入 +モードのマッピングが適用される。これは、選択モードで入力された文字に挿入モード +のマッピングが適用されることを意味するため、おそらく混乱を招くだろう。そのうえ +言語マッピングも適用される。 + + *gV* *v_gV* +gV 選択モードのマッピング及びメニューが終了したあとでビ + ジュアル領域が再度自動的に選択されるのを抑制する。マッ + ピングやメニューの終わる直前にこれを使用する。少なくと + もセレクションのあらゆる操作の後に行われるべきである。 + + *gh* +gh 文字選択モードを開始する。これは "v" に似ているが、ビ + ジュアルモードの代わりに選択モードを開始する。 + 覚え方: "get highlighted" + + *gH* +gH 行選択モードを開始する。これは "V" に似ているが、ビジュ + アルモードの代わりに選択モードを開始する。 + 覚え方: "get Highlighted". + + *g_CTRL-H* +g CTRL-H 矩形選択モードを開始する。これは CTRL-V に似ているが、 + ビジュアルモードの代わりに選択モードを開始する。 + 覚え方: "get Highlighted". + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/windows.jax b/plugins/vimdoc-ja/doc/windows.jax new file mode 100644 index 0000000000..87f8208b5b --- /dev/null +++ b/plugins/vimdoc-ja/doc/windows.jax @@ -0,0 +1,1329 @@ +*windows.txt* For Vim バージョン 8.0. Last change: 2016 Dec 01 + + + VIMリファレンスマニュアル by Bram Moolenaar + + +マルチウィンドウ、マルチバッファを使った編集 *windows* *buffers* + +ここではマルチウィンドウやマルチバッファを使用するために追加したコマンドについ +て説明する。さらに、2つ以上のウィンドウを組合せて使用するときに異なる動作をす +るコマンドについての説明もする。 + +基本についてはユーザーマニュアルの7章と8章で説明されている。 +|usr_07.txt| |usr_08.txt|. + +1. はじめに |windows-intro| +2. Vim の起動 |windows-starting| +3. ウィンドウのオープンとクローズ |opening-window| +4. ウィンドウ間のカーソル移動 |window-move-cursor| +5. ウィンドウの移動 |window-moving| +6. ウィンドウのサイズ変更 |window-resize| +7. コマンド引数とバッファリスト |buffer-list| +8. 全てのバッファ/ウィンドウに対してコマンド実行 |list-repeat| +9. カーソル位置のタグ名/ファイル名 |window-tag| +10. プレビューウィンドウ |preview-window| +11. 隠れ(hidden)バッファを使う |buffer-hidden| +12. 特殊なバッファ |special-buffers| + + +{Vi にはこれらのコマンドはない} +{|+windows| 機能なしでコンパイルされた場合は複数のウィンドウを使うことはできな +い} +{|+vertsplit| 機能なしでコンパイルされた場合は垂直分割ウィンドウを使うことはで +きない} + + +============================================================================== +1. はじめに *windows-intro* *window* + +要約: + バッファとはメモリに保持しているファイルの内容である。 + ウィンドウとはバッファの表示領域である。 + タブページとはウィンドウを集めたものである。 + +ウィンドウはバッファの表示領域である。1つのバッファに対して複数のウィンドウを +開くことができるし、異なる複数のバッファに対して複数のウィンドウを開くこともで +きる。 + +バッファは編集時にメモリ上にロードされたファイルのことを言う。 +オリジナルのファイルはバッファ内容をそのファイルに上書きするまで変更されずにい +る。 + +バッファは以下の3つの状態のうちのどれか1つの状態にある。 + + *active-buffer* +アクティブ: バッファ内容はウィンドウに表示されている。このバッファに対応する + ファイルが存在する場合、ファイルがバッファに読み込まれている。 + バッファはそれ以降編集されていて、ファイルと異なっているかもしれ + ない。 + *hidden-buffer* +隠れ(hidden): バッファ内容はウィンドウに表示されていない。このバッファに対応す + るファイルが存在する場合、ファイルはバッファに読み込まれている。 + 見ることができないが、それ以外はアクティブなバッファと同じ。 + *inactive-buffer* +非アクティブ: バッファ内容はウィンドウに表示されていない。バッファには何もロー + ドされていない。ファイルが一度でもメモリにロードされていたなら、 + そのバッファのオプションは記憶されている。|viminfo|ファイルにより + マークを含んでいるかもしれない。 + +状態表: + +状態 ウィンドウ メモリ上に ":buffers" ~ + 表示 ロード 表示 ~ +アクティブ ○ ○ 'a' +隠れ(hidden) × ○ 'h' +非アクティブ × × ' ' + + +Note: ノーマルコマンドが利用できない、あるいは使い勝手が悪い状況のために、全て +のCTRL-Wコマンドは|:wincmd|によっても実行できる。 + +Vimではウィンドウを複数に分割することができる。タブページ|tab-page|というもの +もあり、タブページは複数のウィンドウを保持することができる。 + *window-ID* *winid* *windowid* +個々のウィンドウにはウィンドウIDと呼ばれる一意な識別が与えられる。この識別子は +Vimのセッション中は決して変わらない。|win_getid()| と |win_id2tabwin()| 関数 +は、ウィンドウ/タブ番号を識別子に変換するのに利用できる。似たようなものとして +ウィンドウ番号があるが、こちらはウィンドウを開いたり閉じたりするたびに変わる可 +能性がある。 |winnr()| を参照。 + +個々のバッファには一意な番号が割り振られており、Vimのセッション中は決して変わ +らない。バッファ名とバッファ番号を相互に変換するのには、|bufnr()| と +|bufname()| 関数を使える。 + + +============================================================================== +2. Vim の起動 *windows-starting* + +デフォルトでは、Vim は Vi のように1つのウィンドウで起動する。 + +Vim のオプション引数に "-o" と "-O" を使うと、引数で指定した各ファイルのウィン +ドウがオープンする。オプション "-o" はウィンドウを水平分割し、"-O" オプション +はウィンドウを垂直分割する。"-o" と "-O" の両方が与えられた場合は、後に現れた +方が分割方向を決めるのに使われる。例えば、これは3つのウィンドウが垂直分割して +開かれる: > + vim -o file1 file2 file3 + +"-oN" (N は10進数)の場合は、N個のウィンドウが水平に分割して開く。ウィンドウの +数(N)より引数で指定したファイルの数が多い場合、N個のウィンドウが開き、残りの +ファイルはウィンドウに表示されない。逆にウィンドウの数より引数で指定したファイ +ルの数が少ない場合、残りのウィンドウは空のバッファを表示する。同様に "-ON" は +N個のウィンドウを垂直分割して開く。制限も同じである。 + +引数にたくさんのファイル名を指定した場合、ウィンドウは非常に小さくなる。もしか +したら、作業のできる環境にするために 'winheight' または 'winwidth' オプション +を設定したくなるかもしれない。 + +Buf/Win Enter/Leave 時のオートコマンド|autocommand|は、新しいウィンドウを開い +たりファイルを読み込んだりしても実行されない。そのオートコマンドはバッファ/ +ウィンドウへ入った時にのみ実行される。 + + *status-line* +ステータス行はウィンドウの分割に使われる。'laststatus' オプションは一番下のウィ +ンドウにステータス行を表示するかを設定する: + 'laststatus' = 0 常にステータス行を表示しない。 + 'laststatus' = 1 ウィンドウが2つ以上ある場合に表示する。 + 'laststatus' = 2 常にステータス行を表示する。 + +ステータス行の内容は 'statusline' オプションで変更できる。 +このオプションはウィンドウについてローカルにすることもでき、そうすると各ウィン +ドウごとに異なるステータスラインを表示することができる。 + +通常、ステータス行は反転表示される。これは 'highlight' オプションの 's' キャラ +クタで変更できる。例えば、"sb" は太文字に設定する。ステータス行にハイライトを +使用しない場合("sn")、'^' がカレントウィンドウに使われ、'=' が他のウィンドウに +使われる。マウスがサポートされていて 'mouse' オプションでマウスが使用可能になっ +ている場合は、ステータス行をドラッグすることでウィンドウのリサイズを行える。 + +Note: ステータス行が反転表示されるはずが反転表示されなければ、'highlight' オプ +ションに 'si' が含まれているか確認すること。version 3.0 では、'si' がステータ +ス行の反転表示を意味していた。今は反転表示には 'sr' を使用し、'si' はイタリッ +ク表示を意味している! イタリックを表示できない端末では、ステータス行は反転表 +示となる。イタリック表示のための termcap コードがある場合にのみ、この問題が見 +られる。 + +============================================================================== +3. ウィンドウのオープンとクローズ *opening-window* *E36* + +CTRL-W s *CTRL-W_s* +CTRL-W S *CTRL-W_S* +CTRL-W CTRL-S *CTRL-W_CTRL-S* +:[N]sp[lit] [++opt] [+cmd] [file] *:sp* *:split* + カレントウィンドウを2つに分割する。その結果、2つの表示領域に同 + じファイルが表示されるようになる。 + + 新しいウィンドウの高さはNになる(デフォルトの高さはカレントウィ + ンドウの高さの半分)。新しいウィンドウの場所を確保するため、カ + レントウィンドウの高さは低くなる('equalalways' オプションが + セットされていて、かつ'eadirection' の値が "hor" でない場合、 + 他のウィンドウの中でカレントウィンドウか新しいウィンドウより大 + きいものがあれば、そのウィンドウも小さくなる)。 + + [file] が与えられている場合は新しいウィンドウで編集される。ど + のバッファでもロードされていない場合、読み込まれる。そうでなれ + ければ新しいウィンドウは既にロードされたバッファを使用する。 + + Note: CTRL-S は端末によっては使用できない。また、それ以上の入 + 力をブロックしてしまうかもしれない。続けるためにはCTRL-Qを使う + こと。 + |++opt|と|+cmd| も参照のこと。 + +CTRL-W CTRL-V *CTRL-W_CTRL-V* +CTRL-W v *CTRL-W_v* +:[N]vs[plit] [++opt] [+cmd] [file] *:vs* *:vsplit* + |:split|と同様、ただし垂直分割する。次のすべてに当てはまる場合、 + ウィンドウは水平に広げられる: + 1. 幅が指定されていない。 + 2. 'equalalways' がセットされている。 + 3. 'eadirection' が "ver" でない。 + 4. 他のウィンドウの中でカレントウィンドウか新しいウィンドウよ + り幅が広いものがある。 + Note: 他の局面ではCTRL-QはCTRL-Vと同じだが、ここではそうでな + い。 + +CTRL-W n *CTRL-W_n* +CTRL-W CTRL_N *CTRL-W_CTRL-N* +:[N]new [++opt] [+cmd] *:new* + 新しいウィンドウを作成して空のファイルの編集が始まる。新しい + ウィンドウの高さはNになる(デフォルトの高さはカレントウィンドウ + の高さの半分)。新しいウィンドウの場所を確保するため、カレント + ウィンドウの高さは低くなる。 ('equalalways' オプションがセット + されていてかつ 'equalalways' オプションが "hor" でない場合、他 + のウィンドウの高さも低くなる)。|++opt|と |+cmd| も参照のこと。 + 'fileformats' オプションが空でない場合は、与えられた最初の + フォーマットが新しいバッファにも使用される。 + 'fileformats' オプションが空の場合は、カレントバッファの + 'fileformat' が使用される。これは引数|++opt|によって上書きされ + うる。 + オートコマンドはこの順で実行される: + 1. カレントウィンドウに対する WinLeave + 2. 新しいウィンドウに対する WinEnter + 3. カレントバッファに対する BufLeave + 4. 新しいバッファに対する BufEnter + この動作は、はじめに ":split"、次に ":enew" コマンドを実行した + 場合と同じ動作である。 + +:[N]vne[w] [++opt] [+cmd] [file] *:vne* *:vnew* + |:new|と同様だが、垂直分割する。'equalalways' がセットされ、 + 'eadirection' が "ver" でないならば、幅が指定されない限りウィ + ンドウは水平に広げられる。 + +:[N]new [++opt] [+cmd] {file} +:[N]sp[lit] [++opt] [+cmd] {file} *:split_f* + 新しいウィンドウを作成し、そのウィンドウでファイル {file} の編 + 集が始まる。この動作は、はじめに ":split"、次に ":e" コマンド + を実行した場合と同じ動作である。 + [+cmd] が指定された場合は、ファイルをロードしコマンドを実行す + る |+cmd|。 + |++opt| も参照のこと。 + 新しいウィンドウの高さはNになる(デフォルトの高さはカレントウィ + ンドウの高さの半分)。新しいウィンドウの場所を確保するため、カ + レントウィンドウの高さは低くなる。('equalalways' オプションが + セットされていれば他のウィンドウも低くなる) + +:[N]sv[iew] [++opt] [+cmd] {file} *:sv* *:sview* *splitview* + ":split" と同じ。ただし、バッファに対して 'readonly' オプショ + ンがセットされる。 + +:[N]sf[ind] [++opt] [+cmd] {file} *:sf* *:sfind* *splitfind* + ":split" と同じ。ただし、|:find| と同様に 'path' から {file} + を検索する。{file}が見つからなければ、ウィンドウは分割されない。 + +CTRL-W CTRL-^ *CTRL-W_CTRL-^* *CTRL-W_^* +CTRL-W ^ ":split #" と同じ。つまり、ウィンドウを2つに分割してもう一方の + ファイルを編集する。カウントが指定された場合は ":split #N" と + 同じ。つまり、ウィンドウを分割してバッファNを編集する。 + +オプション 'splitbelow' と 'splitright' が新しいウィンドウが現れる場所に影響を +及ぼすことに注意。 + + *:vert* *:vertical* +:vert[ical] {cmd} + {cmd}を実行する。{cmd}がウィンドウを分割させるコマンドを含んで + いれば、垂直分割させる。 + cmdとして|:execute|または|:normal|を指定しても効果がない。 + +:lefta[bove] {cmd} *:lefta* *:leftabove* +:abo[veleft] {cmd} *:abo* *:aboveleft* + {cmd}を実行する。{cmd}がウィンドウを分割させるコマンドを含んで + いる場合は、垂直分割ならば左側に、水平分割ならば上側にカレント + ウィンドウを出現させる。'splitbelow' と 'splitright' を無視す + る。 + cmdとして|:execute|または|:normal|を指定しても効果がない。 + +:rightb[elow] {cmd} *:rightb* *:rightbelow* +:bel[owright] {cmd} *:bel* *:belowright* + {cmd}を実行する。{cmd}がウィンドウを分割させるコマンドを含んで + いる場合は、垂直分割ならば右側に、水平分割ならば下側にカレント + ウィンドウを出現させる。'splitbelow' と 'splitright' を無視す + る。 + cmdとして|:execute|または|:normal|を指定しても効果がない。 + + *:topleft* *E442* +:to[pleft] {cmd} + {cmd}を実行する。{cmd}がウィンドウを分割させるコマンドを含んで + いる場合は、最上段に現れ、Vimのウィンドウの中で幅を最大にする。 + 垂直分割のときはウィンドウは最も左側に現れ、Vimウィンドウの中 + で高さを最大にする。 + cmdとして|:execute|または|:normal|を指定しても効果がない。 + + *:bo* *:botright* +:bo[tright] {cmd} + {cmd}を実行する。{cmd}がウィンドウを分割させるコマンドを含んで + いる場合は、最下段に現れ、Vimのウィンドウの中で幅を最大にす + る。垂直分割のときはウィンドウは最も右側に現れ、Vimウィンドウ + の中で高さを最大にする。 + cmdとして|:execute|または|:normal|を指定しても効果がない。 + +これらのコマンドモディファイヤを組み合わせて、最大高さの垂直分割したウィンドウ +を作ることができる。例: > + :vertical topleft split tags +ウィンドウを垂直分割し、"tags" ファイルのウィンドウを最大の高さで最も左に開く。 + + +ウィンドウを閉じる +------------------ + +:q[uit] +:{count}q[uit] +CTRL-W q *CTRL-W_q* +CTRL-W CTRL-Q *CTRL-W_CTRL-Q* + {count} なしの場合、カレントウィンドウを終了する。もし {count} + が与えられた場合、{count} ウィンドウを終了する。 + + 最後のウィンドウ(ヘルプウィンドウを除く)を終了すると Vim が終 + 了する。 + + 'hidden' オプションがセットされていて、かつカレントバッファを + 表示しているウィンドウが 1つしかない場合は、そのバッファは隠れ + 状態(hidden)となる。'hidden' オプションがセットされていなく + て、カレントバッファを表示しているウィンドウが1つしかなくて、 + かつ、そのバッファが編集中の場合は、このコマンドは失敗する。 + + (Note: CTRL-Q は全ての端末で動作するわけではない。) + + もし [count] が最後のウィンドウ番号よりも大きいとき、最後の + ウィンドウが閉じられる: > + :1quit " 最初のウィンドウを終了する + :$quit " 最後のウィンドウを終了する + :9quit " 最後のウィンドウを終了する + " もし 9 個より少ないウィンドウが開かれていれば + :-quit " 前のウィンドウを終了する + :+quit " 次のウィンドウを終了する + :+2quit " 2 個先のウィンドウを終了する +< +:q[uit]! +:{count}q[uit]! + {count} なしの場合、カレントウィンドウを終了する。もし {count} + が与えられた場合、{count} ウィンドウを終了する。 + + このウィンドウがバッファを表示している最後のウィンドウの場合、 + このバッファに対する変更は全て失われる。最後のウィンドウ(ヘル + プウィンドウを除く)を終了するとVim が終了する。たとえ 'hidden' + オプションがセットされていたとしても、バッファ内容は失われる。 + +:clo[se][!] +:{count}clo[se][!] +CTRL-W c *CTRL-W_c* *:clo* *:close* + {count} なしの場合、カレントウィンドウを閉じる。もし {count} + が与えられた場合、{count} ウィンドウを閉じる。 + + 'hidden' オプションがセットされている時、または、バッファが変 + 更されていて[!]を使用した時は、(バッファが他のウィンドウで編集 + 中でなければ)バッファは隠れ状態(hidden)になる。 + + カレントタブページにウィンドウが1つしかなく、他にタブページが + あるとき、このコマンドを実行するとカレントタブページが閉じる。 + |tab-page| + + このコマンドは以下の場合に失敗する: *E444* + - スクリーン上に1つのウィンドウしかない時 + - 'hidden' がセットされていなくて、[!]を使用せず、バッファが変 + 更されていて、かつ、このバッファが他のウィンドウで表示されて + いない場合 + バッファへの変更は保存されず、失われることもないため、このコマ + ンドは「安全な」コマンドである。 + +CTRL-W CTRL-C *CTRL-W_CTRL-C* + CTRL-W CTRL-C はカレントウィンドウを閉じると期待するかもしれな + いが、CTRL-C はコマンドをキャンセルするために期待通りには動作 + しない。 + + *:hide* +:hid[e] +:{count}hid[e] + カレントウィンドウがスクリーン上の最後のウィンドウでなければ、 + カレントウィンドウを終了する。 {count} については |:quit| コマ + ンドを参照。 + + (他のウィンドウがバッファを編集していなく、かつ 'bufhidden' の + 値が "unload", "delete", "wipe" のいずれでもないならば)その + バッファは隠れ状態(hidden)となる。そのウィンドウがカレントタブ + ページで最後のウィンドウであるならばタブページも閉じる。 + |tab-page| + + 'hidden' の値はこのコマンドには無関係である。バッファへの変更 + は保存されず、失われることもないため、このコマンドは「安全な」 + コマンドである。 + +:hid[e] {cmd} {cmd} を実行し、同時に 'hidden' をセットする。{cmd} が実行され + た後に 'hidden' の以前の値が復旧される。 + 例: > + :hide edit Makefile + これはカレントバッファに変更があっても、それを隠しバッファに + し、"Makefile" を編集する。 + +:on[ly][!] +:{count}on[ly][!] +CTRL-W o *CTRL-W_o* *E445* +CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only* + カレントウィンドウをスクリーン上にある唯一のウィンドウにする。 + 他の全てのウィンドウは閉じられる。 {count} については |:quit| + コマンドを参照。 + + 'hidden' オプションがセットされていれば、閉じられた全てのバッ + ファは隠れ状態(hidden)となる。 + + 'hidden' オプションがセットされておらず、'autowrite' オプショ + ンがセットされている場合は、編集中のバッファは保存される。さも + なければ、編集中のバッファを表示しているウィンドウは閉じられる + ことはない。ただし[!]が与えられていれば、それらのバッファは隠 + れ状態(hidden)となる。しかし、編集中のバッファは決して削除され + ないので、変更は失われない。 + +============================================================================== +4. ウィンドウ間のカーソル移動 *window-move-cursor* + +CTRL-W <Down> *CTRL-W_<Down>* +CTRL-W CTRL-J *CTRL-W_CTRL-J* *CTRL-W_j* +CTRL-W j カーソルをカレントウィンドウのN個下のウィンドウに移動。 + 候補が複数ある場合は、現在のカーソル位置によって選択される。 + +CTRL-W <Up> *CTRL-W_<Up>* +CTRL-W CTRL-K *CTRL-W_CTRL-K* *CTRL-W_k* +CTRL-W k カーソルをカレントウィンドウのN個上のウィンドウに移動。 + 候補が複数ある場合は、現在のカーソル位置によって選択される。 + +CTRL-W <Left> *CTRL-W_<Left>* +CTRL-W CTRL-H *CTRL-W_CTRL-H* +CTRL-W <BS> *CTRL-W_<BS>* *CTRL-W_h* +CTRL-W h カーソルをカレントウィンドウのN個左のウィンドウに移動。 + 候補が複数ある場合は、現在のカーソル位置によって選択される。 + +CTRL-W <Right> *CTRL-W_<Right>* +CTRL-W CTRL-L *CTRL-W_CTRL-L* *CTRL-W_l* +CTRL-W l カーソルをカレントウィンドウのN個右のウィンドウに移動。 + 候補が複数ある場合は、現在のカーソル位置によって選択される。 + +CTRL-W w *CTRL-W_w* *CTRL-W_CTRL-W* +CTRL-W CTRL-W カウント指定なし: カーソルをカレントウィンドウの下/右のウィン + ドウに移動。下/右にウィンドウがなければ、一番上/左のウィンド + ウに移動。カウント指定有り: N番目のウィンドウに移動 (ウィンド + ウは左上から右下へと番号が振られる)。ウィンドウの番号を知るに + は |bufwinnr()| と |winnr()| を参照。N がウィンドウの個数より + 大きい場合、最後のウィンドウへ移動する。 + + *CTRL-W_W* +CTRL-W W カウント指定なし: カーソルをカレントウィンドウの上/左のウィン + ドウに移動。上/左にウィンドウがなければ、一番下/右のウィンド + ウに移動。カウント指定有り: N番目のウィンドウに移動 + (CTRL-W w と同様)。 + +CTRL-W t *CTRL-W_t* *CTRL-W_CTRL-T* +CTRL-W CTRL-T カーソルを一番左上のウィンドウに移動。 + +CTRL-W b *CTRL-W_b* *CTRL-W_CTRL-B* +CTRL-W CTRL-B カーソルを一番右下のウィンドウに移動。 + +CTRL-W p *CTRL-W_p* *CTRL-W_CTRL-P* +CTRL-W CTRL-P カーソルを直前の(最後にアクセスしていた)ウィンドウに移動。 + + *CTRL-W_P* *E441* +CTRL-W P プレビューウィンドウに移動。プレビューウィンドウがない場合には + エラーになる。 + {|+quickfix| 機能なしでコンパイルされた場合には使用できない} + +ビジュアルモードがアクティブで移動先のウィンドウがカレントバッファと同じバッ +ファを表示していない場合、ビジュアルモードは終了する。ウィンドウが同じバッファ +を表示している場合、カーソル位置は選択領域が保たれるようにセットされる。 + + *:winc* *:wincmd* +以上のコマンドは ":wincmd" によっても実行することができる: + +:[count]winc[md] {arg} + CTRL-W [count] {arg} を実行するのと同じ。例: > + :wincmd j +< 下のウィンドウに移動する。 + このコマンドは (|CursorHold| 自動コマンドイベントのため) ノー + マルモードが利用できないときやノーマルコマンドが不便なときに有 + 効である。 + count はウィンドウ番号であってもよい。例: > + :exe nr . "wincmd w" +< これは "nr" 番のウィンドウへ移動する。 + +============================================================================== +5. ウィンドウの移動 *window-moving* + +CTRL-W r *CTRL-W_r* *CTRL-W_CTRL-R* *E443* +CTRL-W CTRL-R ウィンドウ位置を下/右へ回転させる。1番のウィンドウは2番目に、 + 2番目のウィンドウは3番目になる。最後のウィンドウは1番になる。 + カーソルは同じウィンドウにとどまる。 + この移動はカレントウィンドウと同じ段/列の中だけで行われる。 + + *CTRL-W_R* +CTRL-W R ウィンドウ位置を上/左へ回転させる。1番のウィンドウは2番目に、 + 2番目のウィンドウは3番目になる。最後のウィンドウは1番になる。 + カーソルは同じウィンドウにとどまる。 + この移動はカレントウィンドウと同じ段/列の中だけで行われる。 + + +CTRL-W x *CTRL-W_x* *CTRL-W_CTRL-X* +CTRL-W CTRL-X カウント指定なし: カレントウィンドウと次(1つ下)のウィンドウを + 入れ替える。次のウィンドウがない(カレントウィンドウが一番下の) + 場合は、前(1つ上)のウィンドウと入れ替える。 + カウント指定有り: カレントウィンドウと上からN番目のウィンドウ + (一番上は1番目)を入れ替える。カーソルは入れ替えた相手のウィン + ドウに移動する。 + 水平分割と垂直分割が混ざっている場合には、カレントウィンドウと + 同じ段/列の中だけで入れ替えが行われる。 + +以下のコマンドはウィンドウのレイアウトを変更するために使える。例えば、2つの垂 +直分割されたウィンドウがある場合、CTRL-W K はそれらを水平分割に変更する。 +CTRL-W H はその逆を行う。 + + *CTRL-W_K* +CTRL-W K カレントウィンドウを最上段に移動し、幅を最大にする。これは、カ + レントウィンドウを閉じ、それから "topleft split" で別のウィン + ドウを作るのと同様で、違いは新しいウィンドウにカレントウィンド + ウの内容が表示されるということだけである。 + + *CTRL-W_J* +CTRL-W J カレントウィンドウを最下段に移動し、幅を最大にする。これは、カ + レントウィンドウを閉じ、それから "botright split" で別のウィン + ドウを作るのと同様で、違いは新しいウィンドウにカレントウィンド + ウの内容が表示されるということだけである。 + + *CTRL-W_H* +CTRL-W H カレントウィンドウを最左列に移動し、高さを最大にする。これは、 + カレントウィンドウを閉じ、それから ":vert topleft split" で別 + のウィンドウを作るのと同様で、違いは新しいウィンドウにカレント + ウィンドウの中身が使われるということだけである。 + {|+vertsplit| 機能なしでコンパイルされた場合は使用できない} + + *CTRL-W_L* +CTRL-W L カレントウィンドウを最右列に移動し、高さを最大にする。これは、 + カレントウィンドウを閉じ、それから ":vert botright split" で別 + のウィンドウを作るのと同様で、違いは新しいウィンドウにカレント + ウィンドウの中身が使われるということだけである。 + {|+vertsplit| 機能なしでコンパイルされた場合は使用できない} + + *CTRL-W_T* +CTRL-W T カレントウィンドウを新しいタブページへ移動する。カレントタブ + ページにウィンドウが1つしかないときは、このコマンドは失敗す + る。カウントが指定されると、その番号のタブページの前に新しいタ + ブページが開く。指定されないときはカレントタブページの後ろに開 + く。 + +============================================================================== +6. ウィンドウのサイズ変更 *window-resize* + + *CTRL-W_=* +CTRL-W = 全てのウィンドウの高さ・幅を(ほとんど)同じにする。ただしカレン + トウィンドウに対しては 'winheight' と 'winwidth' が適用される。 + 'winfixheight' がセットされたウィンドウの高さはそのままにし、 + 'winfixwidth' がセットされたウィンドウの幅はそのままにする。 + +:res[ize] -N *:res* *:resize* *CTRL-W_-* +CTRL-W - カレントウィンドウの高さをN (デフォルトは1) 行分低くする。 + |:vertical| の後に置かれたときは、幅を N 桁分減らす。 + +:res[ize] +N *CTRL-W_+* +CTRL-W + カレントウィンドウの高さをN (デフォルトは1) 行分高くする。 + |:vertical| の後に置かれたときは、幅を N 桁分増やす。 + +:res[ize] [N] +CTRL-W CTRL-_ *CTRL-W_CTRL-_* *CTRL-W__* +CTRL-W _ カレントウィンドウの高さをN行にする(デフォルト: 可能な限り高く + する) + +z{nr}<CR> カレントウィンドウの高さを {nr} にする。 + + *CTRL-W_<* +CTRL-W < カレントウィンドウの幅を N (デフォルトは1) 桁分減らす。 + + *CTRL-W_>* +CTRL-W > カレントウィンドウの幅を N (デフォルトは1) 桁分増やす。 + +:vertical res[ize] [N] *:vertical-resize* *CTRL-W_bar* +CTRL-W | カレントウィンドウの幅を N桁にする (デフォルト:可能な限り広く + する) + +マウスでステータス行を上下にドラッグすることによってもウィンドウのサイズを変更 +できる。垂直セパレータ行を左右にドラッグしても同様。これができるのは、使用して +いる Vim がマウスをサポートしていて 'mouse' オプションでマウスが使えるように設 +定されているときである。 + +'winheight' ('wh') オプションはカレントウィンドウの最小の高さを設定する。この +オプションは他のウィンドウがカレントウィンドウになるたびに使用される。このオプ +ションが '0' に設定されている場合、オプションが無効になる。'winheight' オプショ +ンをかなり大きい値、例えば '9999' に設定すると、カレントウィンドウの高さは常に +可能な限り高くなる。このオプションを適当な値、例えば '10' に設定した場合、カレ +ントウィンドウでの編集がやりやすくなる。 + +同様のオプション 'winwidth' ('wiw') がカレントウィンドウの最小幅を設定するのに +使える。 + +'equalalways' ('ea') オプションをセットした場合、ウィンドウを分割したり閉じた +りした後は全てのウィンドウは自動的に同じ高さとなる。このオプションをセットして +いない場合、ウィンドウを分割するとカレントウィンドウが低くなり他のウィンドウの +高さは変化しない。ウィンドウを閉じると、閉じたウィンドウの上のウィンドウの下の +ウィンドウが高くなる。 + +オプション 'eadirection' は 'equalalways' がどの方向に適用されるかを制限する。 +デフォルトの "both" は両方の方向にリサイズする。その値が "ver" のときはウィン +ドウの高さだけが等しくされる。垂直分割したウィンドウを手動でリサイズし、この幅 +を保ちたいときにこれを使うとよい。同じように、値が "hor" のときはウィンドウの +幅だけが等しくされる。 + +'cmdheight' ('ch') オプションはコマンド行の高さを設定する。長いメッセージの表 +示の際の |hit-enter| プロンプトをわずらわしいと感じたら、このオプションを2か3 +に設定すること。 + +ウィンドウが1つしかない場合、ウィンドウの高さを変更するとコマンド行の高さも変 +化する。2つ以上ウィンドウがある場合、カレントウィンドウの高さを変更するとその +下のウィンドウの高さも変化する(たまに上のウィンドウの高さが変化することもあ +る)。 + +ウィンドウの最小の高さと幅は 'winminheight' と 'winminwidth' によって設定され +る。これらは絶対的な値で、ウィンドウはこれらより小さくなることはない。 + +============================================================================== +7. コマンド引数とバッファリスト *buffer-list* + + args list buffer list meaning ~ +1. :[N]argument [N] 11. :[N]buffer [N] N番目の引数/バッファに移動 +2. :[N]next [file ..] 12. :[N]bnext [N] N個先の引数/バッファに移動 +3. :[N]Next [N] 13. :[N]bNext [N] N個前の引数/バッファに移動 +4. :[N]previous [N] 14. :[N]bprevious [N] N個前の引数/バッファに移動 +5. :rewind / :first 15. :brewind / :bfirst 最初の引数/バッファに移動 +6. :last 16. :blast 最後の引数/バッファに移動 +7. :all 17. :ball 全ての引数/バッファを編集 + 18. :unhide 全ての読み込まれたバッファを編集 + 19. :[N]bmod [N] N個先の編集中のバッファに移動 + + split & args list split & buffer list meaning ~ +21. :[N]sargument [N] 31. :[N]sbuffer [N] split + N番目の引数/バッファに + 移動 +22. :[N]snext [file ..] 32. :[N]sbnext [N] split + N個先の引数/バッファに + 移動 +23. :[N]sNext [N] 33. :[N]sbNext [N] split + N個前の引数/バッファに + 移動 +24. :[N]sprevious [N] 34. :[N]sbprevious [N] split + N個前の引数/バッファに + 移動 +25. :srewind / :sfirst 35. :sbrewind / :sbfirst split + 最初の引数/バッファに + 移動 +26. :slast 36. :sblast split + 最後の引数/バッファに + 移動 +27. :sall 37: :sball 全ての引数/バッファを編集 + 38. :sunhide 全ての読み込まれたバッファを編集 + 39. :[N]sbmod [N] split + N個先の編集中のバッ + ファに移動 + +40. :args コマンド引数の表示 +41. :buffers バッファの表示 + +[N] の意味はコマンドによって異なる。 + ?2、?3、?4のコマンドにおいては、[N]は前方/後方に移動するバッファ数 + 1、21のコマンドにおいては、[N]は引数番号、デフォルトはカレント引数 + 11、31のコマンドにおいては、[N]はバッファ番号、デフォルトはカレントバッファ + 19、39のコマンドにおいては、[N]はカウント + +Note: ":next" は例外である。なぜならこのコマンドは Vi との互換性のためにファイ +ル名リストを受け付けなければならないからである。 + + +引数リストと複数のウィンドウ +---------------------------- + +引数リストのカレント位置は各ウィンドウ毎に異なっている可能性がある。":e file" +コマンドを実行した際には引数リストないのカレント位置は変化しないが、カレント位 +置のファイルを編集していないことを忘れないでほしい。この状態を示すために、ファ +イルメッセージに(もしあるならタイトルにも)「(file (N) of M)」と表示する。ここ +で、"(N)" はファイルリスト中のカレント位置を、"M" はファイルリスト中のファイル +の数を表している。 + +引数リストの全てはバッファリストに追加される。だから、":bnext" のようなバッファ +リストコマンドで引数リストを表示することができる。 + +:[N]al[l][!] [N] *:al* *:all* *:sal* *:sall* +:[N]sal[l][!] [N] + 各引数に対して1つのウィンドウを開き、スクリーンを再構成する。 + 他の全てのウィンドウは閉じられる。カウントが指定された時は、開 + くウィンドウの最大数となる。 + コマンド修飾子|:tab|をつけて実行すると、各引数に対して1つずつ + タブページを開く。'tabpagemax' 個より多くの引数が与えられたと + きは、多すぎる引数は最後のタブページの中でウィンドウに分割され + て開かれる。 + 'hidden' オプションがセットされている場合は、閉じられるウィン + ドウで表示されている全てのバッファは隠れ状態(hidden)となる。 + 'hidden' オプションがセットされておらず 'autowrite' オプション + がセットされている場合は、編集中のバッファは保存される。さもな + ければ、編集中のバッファを表示しているウィンドウは閉じられな + い。ただし[!]が与えられていれば、それらのバッファは隠れ状態 + (hidden)となる。しかし、編集中のバッファは決して削除されないの + で、変更は失われない。 + [N] は開かれるウィンドウの数の最大値。'winheight' (|:vertical| + が前に与えられている場合は 'winwidth') もまた開かれるウィンド + ウの数を制限する。 + この時点では Buf/Win Enter/Leave オートコマンドは新しいウィン + ドウに対して実行されない。実際にそのウィンドウに移ったときに実 + 行される。 + +:[N]sa[rgument][!] [++opt] [+cmd] [N] *:sa* *:sargument* + ":split | argument [N]" の短縮形: ウィンドウを分割し、N番目の + 引数へ移動する。しかし、N番目の引数がなければ、ウィンドウは分 + 割しない。|++opt| と |+cmd| も参照。 + +:[N]sn[ext][!] [file ..] *:sn* *:snext* + ":split | [N]next" の短縮形: ウィンドウを分割し、N個先の引数へ + 移動する。しかし、N個先の引数がなければ、ウィンドウは分割しな + い。|++opt| と |+cmd| も参照。 + +:[N]spr[evious][!] [++opt] [+cmd] [N] *:spr* *:sprevious* +:[N]sN[ext][!] [++opt] [+cmd] [N] *:sN* *:sNext* + ":split | [N]Next" の短縮形: ウィンドウを分割し、N個前の引数へ + 移動する。しかし、N個前の引数がなければ、ウィンドウは分割しな + い。|++opt| と |+cmd| も参照。 + + *:sre* *:srewind* +:sre[wind][!] [++opt] [+cmd] + ":split | rewind" の短縮形: ウィンドウを分割し、最初の引数へ移 + 動する。しかし、引数がなければ、ウィンドウは分割しない。 + |++opt| と |+cmd| も参照。 + + *:sfir* *:sfirst* +:sfir[st] [++opt] [+cmd] + ":srewind" と同じ。 + + *:sla* *:slast* +:sla[st][!] [++opt] [+cmd] + ":split | last" の短縮形: ウィンドウを分割し、最後の引数へ移動 + する。しかし、引数がなければ、ウィンドウは分割しない。 + |++opt| と |+cmd| も参照。 + + *:dr* *:drop* +:dr[op] [++opt] [+cmd] {file} .. + 最初の {file} を編集する。 + - そのファイルがすでにあるウィンドウで開かれていたら、そのウィ + ンドウに移動する。 + - そのファイルがウィンドウで開かれていなければ、カレントウィン + ドウで開く。カレントバッファが破棄されえない(|abandon|)ならば + まずウィンドウが分割される。 + - 引数リストにないウィンドウや、ウィンドウ幅が最大でないウィン + ドウは、可能ならば閉じられる。 + |:next| コマンドと同様に、|argument-list| がセットされる。 + このコマンドの目的は、Vimに別のファイルを開いてほしいプログラ + ム (例:デバッガ) から使われることである。 + コマンド修飾子|:tab|をつけて実行すると、各引数が1つずつタブ + ページで開かれる。最後のウィンドウが空ならそのウィンドウが使わ + れる。 + |++opt| と |+cmd| も参照。 + {GUI 機能つきでコンパイルされたときのみ使用可能} + +============================================================================== +8. 全てのバッファ/ウィンドウに対してコマンド実行 *list-repeat* + *:windo* +:[range]windo {cmd} 各ウィンドウに対して {cmd} を実行する。[range]が指定さ + れた場合には、指定された範囲の番号のウィンドウが操作対 + 象となる。これは次のようにするのと同じ動作をする: > + CTRL-W t + :{cmd} + CTRL-W w + :{cmd} + etc. +< カレントタブページ内でのみ実行される。 + 1つのウィンドウに対してエラーが検出されると、それ以降 + のウィンドウに対しては実行されない。 + 最後のウィンドウ (またはエラーが起こったウィンドウ) が + カレントウィンドウになる。 + {cmd} は '|' を含んで複数のコマンドを連結していてもよ + い。 + {cmd} はウィンドウの開閉、並べ替えをしてはならない。 + {Vi にはない} {|+listcmds| 機能なしでコンパイルされた場 + 合は使用できない} + |:tabdo|、|:argdo|、|:bufdo|、|:cdo|、|:ldo|、|:cfdo|、 + |:lfdo|も参照。 + + *:bufdo* +:[range]bufdo[!] {cmd} {cmd} をバッファリスト内の各バッファに対して実行する。 + [range]が指定された場合は、指定された範囲の番号の + バッファが操作対象となる。これは次のようにするのと同じ + 動作をする: > + :bfirst + :{cmd} + :bnext + :{cmd} + etc. +< カレントファイルが破棄されえなく(|abandon|)かつ [!]が + 与えられない場合、このコマンドは失敗する。 + 1つのバッファに対してエラーが検出されると、それ以降 + のバッファに対しては実行されない。 + リストされていないバッファはスキップされる。 + 最後のバッファ (またはエラーが起こったバッファ) がカレ + ントウィンドウになる。 + {cmd} は '|' を含んで複数のコマンドを連結していてもよ + い。 + {cmd} はバッファリストにバッファを削除、追加してはなら + ない。 + Note:このコマンドを実行している間、Syntax 自動コマンド + イベントが 'eventignore' に追加され、無効化される。 + これは各バッファの編集を大幅にスピードアップさせる。 + {Vi にはない} {|+listcmds| 機能なしでコンパイルされた + 場合は使用できない} + |:tabdo|、|:argdo|、|:windo|、|:cdo|、|:ldo|、|:cfdo|、 + |:lfdo| も参照。 + +例: > + + :windo set nolist nofoldcolumn | normal zn + +これは 'list' オプションをリセットし全てのウィンドウの折り畳みを無効化する。 + > + :bufdo set fileencoding= | update + +これは各バッファの 'fileencoding' をリセットし、バッファに変更があったらそれを +保存する。結果として、すべてのバッファが同じ 'encoding' のエンコーディングを使 +用する (変換がうまくいったとすれば)。 + +============================================================================== +9. カーソル位置のタグ名/ファイル名 *window-tag* + + *:sta* *:stag* +:sta[g][!] [tagname] + ":tag[!] [tagname]" を実行し見つかったタグの表示のためにウィン + ドウを分割する。 |:tag| を参照。 + +CTRL-W ] *CTRL-W_]* *CTRL-W_CTRL-]* +CTRL-W CTRL-] カレントウィンドウを2つに分割する。カーソル位置の識別子をタグ + として使用し、新しくできた上側のウィンドウでタグに移動する。 + ビジュアルモードではビジュアル選択されたテキストがタグとして使 + われる。 + 新しいウィンドウの高さは N となる。 + + *CTRL-W_g]* +CTRL-W g ] カレントウィンドウを2つに分割する。カーソル位置の識別子をタグ + として使用し、新しくできた上側のウィンドウで ":tselect" を実行 + する。 + ビジュアルモードではビジュアル選択されたテキストがタグとして使 + われる。 + 新しいウィンドウの高さは N となる。 + + *CTRL-W_g_CTRL-]* +CTRL-W g CTRL-] カレントウィンドウを2つに分割する。カーソル位置の識別子をタグ + として使用し、新しくできた上側のウィンドウで ":tjump" を実行す + る。 + ビジュアルモードではビジュアル選択されたテキストがタグとして使 + われる。 + 新しいウィンドウの高さはNとなる。 + +CTRL-W f *CTRL-W_f* *CTRL-W_CTRL-F* +CTRL-W CTRL-F カレントウィンドウを2つに分割する。カーソル位置のファイル名を + 編集する。":split ]f" と同様だが、ファイルが存在しなければウィ + ンドウを分割しない。 + ファイルを探すディレクトリのリストとして変数 'path' が使われ + る。また、カレントファイルのパスも探される。 + その名前が "type://machine/path" のようにハイパーテキストリン + クならば "/path" のみが使われる。 + count が与えられた場合、count 番目にマッチしたファイルが編集さ + れる。 + {|+file_in_path| 機能なしでコンパイルされた場合は使用できない} + +CTRL-W F *CTRL-W_F* + カレントウィンドウを2つに分割する。カーソル下のファイル名を開 + き、そのファイル名の後に書かれている行番号へジャンプする。ど + のように行番号を取得するかについては|gF|を参照。 + {|+file_in_path| 機能なしでコンパイルされた場合は使用できない} + +CTRL-W gf *CTRL-W_gf* + 新しいタブページを開き、カーソル下のファイル名を開く。 + "tab split" と "gf" の組み合わせに似ているが、そのファイルが存 + 在しない場合に新しいタブページを作成しないところが異なる。 + {|+file_in_path| 機能なしでコンパイルされた場合は使用できない} + +CTRL-W gF *CTRL-W_gF* + 新しいタブページを開き、カーソル下のファイル名を開いて、ファイ + ル名の後に書かれている行番号へジャンプする。 + "tab split" と "gF" の組み合わせに似ているが、そのファイルが存 + 在しない場合に新しいタブページを作成しないところが異なる。 + {|+file_in_path| 機能なしでコンパイルされた場合は使用できない} + +|CTRL-W_CTRL-I| も参照:カーソル位置のキーワードを含むインクルードファイルを新 +しいウィンドウで開く。 + +============================================================================== +10. プレビューウィンドウ *preview-window* + +プレビューウィンドウは別のファイルをプレビューする特別なウィンドウである。通常 +はインクルードファイルや関数の定義を示すのに使われる小さなウィンドウである。 +{|+quickfix| 機能なしでコンパイルされた場合は使用できない} + +プレビューウィンドウはタブページにつき1つだけ開くことができる。プレビューウィ +ンドウは以下のコマンドのどれかが実行されたとき作成される。オプション +'previewheight' によってプレビューウィンドウが開くときの高さを設定できる。プレ +ビューウィンドウを識別するために、プレビューウィンドウにはオプション +'previewwindow' がセットされる。他のウィンドウを開閉したときにも同じ高さを保つ +ためにオプション 'winfixheight' がセットされる。 + + *:pta* *:ptag* +:pta[g][!] [tagname] + ":tag[!] [tagname]" を実行し、現在のバッファまたはカーソル位置 + を変えずに「プレビュー」ウィンドウ内で検索したタグを表示する。 + 「プレビュー」ウィンドウがすでに存在していた場合は、(ヘルプ + ウィンドウのように)そのウィンドウに表示する。新しいウィンドウ + が開いたときは、'previewheight' の設定がそのウィンドウの高さに + なる。|:tag| も参照のこと。 + 例は下を参照。|CursorHold-example| + |:tag|とは小さな違いがある:[tagname] がすでに表示されているタ + グと同じ場合、マッチしたタグリスト内の位置はリセットされない。 + このおかげで |:ptnext| の後でも CursorHold の例がうまくいくよ + うになっている。 + +CTRL-W z *CTRL-W_z* +CTRL-W CTRL-Z *CTRL-W_CTRL-Z* *:pc* *:pclose* +:pc[lose][!] 現在開いている「プレビュー」ウィンドウを閉じる。'hidden' オプ + ションがセットされている時、または、バッファが編集中で[!]が使 + われた時、(そのバッファを編集している他のウィンドウがなければ) + そのバッファは隠れ状態(hidden)となる。いずれかの「プレビュー」 + バッファを閉じることができない場合、このコマンドは失敗する。 + |:close| も参照のこと。 + + *:pp* *:ppop* +:[count]pp[op][!] + プレビューウィンドウで ":[count]pop[!]" を実行する。 |:pop| と + |:ptag| を参照。 {Vi にはない} + +CTRL-W } *CTRL-W_}* + カーソル位置の識別子をタグとして使用し、:ptag を実行する。 (必 + 要なら)高さNの新しいプレビューウィンドウを作成する。 Nが与えら + れなければ、'previewheight' が使われる。 + +CTRL-W g } *CTRL-W_g}* + カーソル位置の識別子をタグとして使用し、:ptjump を実行する。 + (必要なら)高さNの新しいプレビューウィンドウを作成する。 Nが与 + えられなければ、'previewheight' が使われる。 + + *:ped* *:pedit* +:ped[it][!] [++opt] [+cmd] {file} + {file} をプレビューウィンドウで編集する。プレビューウィンドウ + は |:ptag| と同じように開かれる。カレントウィンドウとカーソル + 位置は変わらない。便利な例: > + :pedit +/fputc /usr/include/stdio.h +< + *:ps* *:psearch* +:[range]ps[earch][!] [count] [/]pattern[/] + |:ijump| と同様だが、見つかったマッチをプレビューウィンドウで + 開く。プレビューウィンドウは |:ptag| と同じように開かれる。カ + レントウィンドウとカーソル位置は変わらない。便利な例: > + :psearch popen +< |:ptag| コマンドと同じように、これを使ってカーソル位置の単語に + 関する情報を自動的に表示させることができる。これは |:ptag| コ + マンドを使うほど賢くないが、tags ファイルが必要なく、システム + インクルードファイル内のマッチを見つけることもできる。例: > + :au! CursorHold *.[ch] nested exe "silent! psearch " . expand("<cword>") +< 注意:遅いかもしれない。 + + +例 *CursorHold-example* + + :au! CursorHold *.[ch] nested exe "silent! ptag " . expand("<cword>") + +この例では、'updatetime' に設定された時間の間カーソルが動かなければ、カーソル +下のキーワードで ":ptag" が実行される。"nested" は他のオートコマンドを実行する +ので、シンタックスハイライトはプレビューウィンドウ内で動作する。"silent!" は +タグが見つからなかったときのエラーメッセージを抑止する。|CursorHold|も参照。 +この自動コマンドを再び無効化するには: > + + :au! CursorHold + +見つかったタグをハイライトさせる、カーソル位置に単語がないときに ":ptag" を実 +行しない、などの改良をしたものが以下の通り: > + + :au! CursorHold *.[ch] nested call PreviewWord() + :func PreviewWord() + : if &previewwindow " プレビューウィンドウ内では実行しない + : return + : endif + : let w = expand("<cword>") " カーソル下の単語を得る + : if w =~ '\a' " その単語が文字を含んでいるなら + : + : " 別のタグを表示させる前にすでに存在するハイライトを消去する + : silent! wincmd P " プレビューウィンドウにジャンプ + : if &previewwindow " すでにそこにいるなら + : match none " 存在するハイライトを消去する + : wincmd p " もとのウィンドウに戻る + : endif + : + : " カーソル下の単語にマッチするタグを表示してみる + : try + : exe "ptag " . w + : catch + : return + : endtry + : + : silent! wincmd P " プレビューウィンドウにジャンプ + : if &previewwindow " すでにそこにいるなら + : if has("folding") + : silent! .foldopen " 閉じた折り畳みを開く + : endif + : call search("$", "b") " 前の行の最後へ + : let w = substitute(w, '\\', '\\\\', "") + : call search('\<\V' . w . '\>') " カーソルをマッチしたところへ + : " ここで単語にハイライトをつける + : hi previewWord term=bold ctermbg=green guibg=green + : exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' + : wincmd p " もとのウィンドウへ戻る + : endif + : endif + :endfun + +============================================================================== +11. 隠れ(hidden)バッファを使う *buffer-hidden* + +隠れ(hidden)バッファはウィンドウに表示されないが、メモリ上にはすでにロードされ +ている。これにより、毎回ファイルを保存したり読み込んだりしなくても、また、ウィ +ンドウ内にファイルを残しておかなくても、他のバッファをウィンドウに表示すること +が可能となる。 +{|+listcmds| 機能なしでコンパイルされた場合には使用できない} + + *:buffer-!* +'hidden' ('hi') オプションがセットされている場合は、":edit", ":next", ":tag" +等の他のファイルの編集をスタートさせる全てのコマンドに関して、いらないバッファ +は捨てられない。バッファリストで移動コマンドを実行すると、'hidden' オプション +がセットされていないにも関わらず、バッファが隠れ状態(hidden)になることがある。 +これはバッファが編集中で、ウィンドウが強制的に削除され('!' を使用)、 +'autowrite' がセットされていないかバッファを保存できなかったときに起こる。 + +隠れ状態の(hidden)バッファはそのバッファの編集を開始するコマンドで隠れ状態 +(hidden)ではなくなる。":bdelete" コマンドでバッファを削除しても隠れ状態 +(hidden)ではなくなる。 + +オプション 'hidden' はグローバルである、全てのバッファに適用される。オプション +'bufhidden' は特定のバッファを例外にするために使える。'bufhidden' はこれらの値 +をとりうる: + <empty> 'hidden' の値を使う。 + hide 'hidden' が設定されてなくてもこのバッファを隠れ状態に + する。 + unload 'hidden' が設定されているときでも隠れ状態にせず、この + バッファをアンロードする。 + delete バッファを削除する。 + + *hidden-quit* +編集中で隠れ状態(hidden)のバッファがあるときに Vim を終了しようとすると、エ +ラーが表示されてその編集中のバッファがカレントバッファになる。そして、バッファ +を保存するか(":wq")、保存しないで終了するか(":q!")を指定することができる。 +注意: 他にも編集中の隠れバッファ(hidden)や編集中のバッファがあるかも! + +バッファはリストから除かれることもある。これは、存在しているがバッファのリスト +内にはないことを意味する。|unlisted-buffer| + +:files[!] [flags] *:files* +:buffers[!] [flags] *:buffers* *:ls* +:ls[!] [flags] + 全バッファを表示。例: + + 1 #h "/test/text" line 1 ~ + 2u "asdf" line 0 ~ + 3 %a + "version.c" line 1 ~ + + [!] が含まれているときは、バッファリストにないバッファも表示さ + れる。 + + 各バッファは一意の番号が割り当てられている。この番号は変わらな + いので、":buffer N" や "N CTRL-^" を使ってある特定のバッファへ + 移動できる。Nはバッファの番号である。 + + 指標 (同じ桁にある文字は互いに排他的): + u リストされていないバッファ ([!] が使われたときのみ表示 + される) |unlisted-buffer| + % カレントウィンドウにあるバッファ + # ":e #" や CTRL_^ で使われる代替バッファ + a アクティブバッファ:ロードされていて、表示されている + h 隠れバッファ:ロードされているが、現在はウィンドウに表 + 示されていない |hidden-buffer| + - 'modifiable' がオフのバッファ + = リードオンリーのバッファ + + 変更のあるバッファ + x 読み込みエラーのあるバッファ + + [flags] は以下の組み合わせを取る事ができる。 + ただしリストに存在するバッファに限られる: + + 変更されたバッファ + - 'modifiable' がオフのバッファ + = リードオンリーのバッファ + a アクティブバッファ + u リストに存在しないバッファ ("!" の挙動は上書きされる) + h 隠れたバッファ + x 読み込みエラーのあるバッファ + % 現在のバッファ + # 代替バッファ + フラグの合成は互いの "and" を意味します。例えば: + h+ 変更された隠れバッファ + a+ 変更されたアクティブバッファ + + 表示されるバッファ名に対して |:filter| でパターンをマッチさせ + るには次のようにする: > + filter /\.vim/ ls +< + *:bad* *:badd* +:bad[d] [+lnum] {fname} + ファイル名 {fname} をバッファリストに追加する。ただし、メモリ + 上には読み込まれない。"lnum" が指定された場合、バッファに初め + て移動したときにカーソルが指定された行番号にジャンプする。+ 以 + 降の他のコマンドは無視されることに注意。 + +:[N]bd[elete][!] *:bd* *:bdel* *:bdelete* *E516* +:bd[elete][!] [N] + バッファ[N](デフォルト: カレントバッファ)をメモリから取り除 + き、バッファリストから削除する。バッファが編集中の場合はこのコ + マンドは失敗する ([!] が与えられた場合は成功する。そのとき変更 + は破棄される)。ファイルには影響はない。このバッファを表示して + いる全てのウィンドウは閉じられる。バッファ[N]がカレントバッ + ファの場合は、他のバッファが代わりに表示される。このバッファに + は、ジャンプリストの中のメモリ上にロードされているバッファを指 + し示している最も最近のエントリが使用される。 + 実際は、バッファは完全に削除されていない。バッファリストから削 + 除され |unlisted-buffer|、バッファに対するオプションの値、変数、 + マッピング・略語が消去される。 Examples: > + :.,$-bdelete " delete buffers from the current one to + " last but one + :%bdelete " delete all buffers + +:bdelete[!] {bufname} *E93* *E94* + ":bdelete[!] [N]" と同様だが、バッファを名前で指定する。数字が + 名前になっているバッファは、その数字では参照されない。つまり、 + バッファ番号として使用されてしまう。バッファ名中のスペースの前 + にはバックスラッシュを入れる必要がある。 + +:bdelete[!] N1 N2 ... + ":bdelete[!]" をバッファN1、N2、等に対して実行する。引数には + バッファ番号かバッファ名(ただし数字のバッファ名は使用不可)を使 + 用できる。バッファ名中のスペースの前にはバックスラッシュを入れ + る必要がある。 + +:N,Mbdelete[!] ":bdelete[!]" を N から M まで(N,Mを含む)の全てのバッファに対 + して実行する。 + +:[N]bw[ipeout][!] *:bw* *:bwipe* *:bwipeout* *E517* +:bw[ipeout][!] {bufname} +:N,Mbw[ipeout][!] +:bw[ipeout][!] N1 N2 ... + |:bdelete| に似ているが、本当にバッファを削除する。このバッ + ファに関するすべてが失われる。例えば、このバッファ中のすべての + マークが無効になり、オプション設定が失われるなど。このことの意 + 味がわからなければ使わないこと。 Examples: > + :.+,$bwipeout " wipe out all buffers after the current + " one + :%bwipeout " wipe out all buffers + +:[N]bun[load][!] *:bun* *:bunload* *E515* +:bun[load][!] [N] + バッファ[N] (デフォルト:カレントバッファ)をメモリから取り除 + く。このバッファに割り当てられたメモリ領域を解放する。バッファ + はバッファリストには残る。バッファが編集中の場合は、このコマン + ドは失敗する ([!] が与えられた場合は成功する。そのとき変更は破 + 棄される)。このバッファを表示しているどのウィンドウも閉じられ + る。バッファ[N]がカレントバッファの場合、他のバッファが代わり + に表示される。このバッファには、ジャンプリストの中のメモリ上に + ロードされているバッファを指し示している最も最近のエントリが使 + 用される。 + +:bunload[!] {bufname} + ":bunload[!] [N]" と同様だが、バッファを名前で指定する。数字が + 名前になっているバッファは、その数字では参照されない。つまり、 + バッファ番号として使用されてしまう。バッファ名中のスペースの前 + にはバックスラッシュを入れる必要がある。 + +:N,Mbunload[!] ":bunload[!]" を N から M まで(N,Mを含む)の全てのバッファに対 + して実行する。 + +:bunload[!] N1 N2 ... + ":bunload[!]" をバッファN1、N2、等に対して実行する。引数には + バッファ番号かバッファ名(ただし数字のバッファ名は使用不可)を使 + 用できる。バッファ名中のスペースの前にはバックスラッシュを入れ + る必要がある。 + +:[N]b[uffer][!] [+cmd] [N] *:b* *:bu* *:buf* *:buffer* *E86* + バッファリストのバッファ[N]を編集する。 [N]が与えられなけれ + ば、そのままカレントバッファが編集される。 [!]については + |:buffer-!| を参照。これはバッファリストにないバッファも + 'buflisted' フラグを設定することなく編集する。 + |+cmd| も参照。 + +:[N]b[uffer][!] [+cmd] {bufname} + バッファリストの {bufname} のバッファを編集する。 [!]について + は |:buffer-!| を参照。これはバッファリストにないバッファも + 'buflisted' フラグを設定することなく編集する。 + |+cmd| も参照。 + +:[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer* + ウィンドウを分割しバッファリストのバッファ[N]を編集する。 [N] + が与えられなければ、そのままカレントバッファが編集される。ウィ + ンドウ分割の際には、'switchbuf' の "useopen" の設定に従う。 + これはバッファリストにないバッファも 'buflisted' フラグを設定 + することなく編集する。 + |+cmd| も参照。 + +:[N]sb[uffer] [+cmd] {bufname} + ウィンドウを分割しバッファリストの {bufname} バッファを編集す + る。これはバッファリストにないバッファも 'buflisted' フラグを + 設定することなく編集する。 + Note: 別名でカレントバッファのコピーを作って、それを別のウィン + ドウで表示したいのなら、次のようにすること: > + :w foobar | sp # +< |+cmd| も参照。 + +:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87* + バッファリスト中の[N]個先のバッファへ移動する。 [N] のデフォル + ト値は1である。バッファリストの最後に到達したら、先頭に戻って + バッファを探す。 [!]については |:buffer-!| を参照。 + |+cmd| も参照。 + ヘルプバッファにいる場合、(もし有れば)次のヘルプバッファへ移動 + する。同様に、通常の(ヘルプではない)バッファにいる場合、次の通 + 常のバッファへ移動する。従って、ヘルプウィンドウを表示していて + も、コード/テキストバッファを次々と表示する際にヘルプが邪魔に + ならない。次の3つのコマンドも同じように動作する。 + + + *:sbn* *:sbnext* +:[N]sbn[ext] [+cmd] [N] + ウィンドウを分割しバッファリストの[N]個先のバッファへ移動す + る。バッファリストの最後に到達したら、先頭に戻ってバッファを探 + す。ウィンドウ分割の際には、'switchbuf' の "useopen" 設定に従 + う。|+cmd| も参照。 + +:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* +:[N]bp[revious][!] [+cmd] [N] + バッファリスト中の[N]個前のバッファへ移動する。 [N] のデフォル + ト値は1である。バッファリストの先頭に到達したら、最後に戻って + バッファを探す。 [!]については |:buffer-!| を参照。'switchbuf' + も参照。|+cmd| も参照。 + +:[N]sbN[ext] [+cmd] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* +:[N]sbp[revious] [+cmd] [N] + ウィンドウを分割しバッファリストの[N]個前のバッファへ移動す + る。バッファリストの先頭に到達したら、最後に戻ってバッファを探 + す。ウィンドウ分割の際には、'switchbuf' の "useopen" 設定に従 + う。|+cmd| も参照。 + +:br[ewind][!] [+cmd] *:br* *:brewind* + バッファリスト中の先頭のバッファへ移動する。バッファリストが空 + の場合はリストされていない最初のバッファに移動する。 [!]につい + ては |:buffer-!| を参照。 + +:bf[irst] [+cmd] *:bf* *:bfirst* + |:brewind| と同じ。 + |+cmd| も参照。 + +:sbr[ewind] [+cmd] *:sbr* *:sbrewind* + ウィンドウを分割してバッファリスト中の先頭のバッファへ移動す + る。バッファリストが空の場合はリストされていない最初のバッファ + へ移動する。'switchbuf' オプションの設定に従う。 + |+cmd| も参照。 + +:sbf[irst] [+cmd] *:sbf* *:sbfirst* + ":sbrewind" と同じ。 + +:bl[ast][!] [+cmd] *:bl* *:blast* + バッファリスト中の最後のバッファへ移動する。バッファリストが空 + の場合はリストされていない最初のバッファへ移動する。 [!]につい + ては |:buffer-!| を参照。 + +:sbl[ast] [+cmd] *:sbl* *:sblast* + ウィンドウを分割してバッファリスト中の最後のバッファへ移動す + る。バッファリストが空の場合はリストされていない最初のバッファ + へ移動する。'switchbuf' オプションの設定に従う。 + +:[N]bm[odified][!] [+cmd] [N] *:bm* *:bmodified* *E84* + バッファリスト中の[N]個先の編集中のバッファへ移動する。 + Note:このコマンドはリストされていないバッファも見つける。変更 + されているバッファがない場合はコマンドは失敗する。 + +:[N]sbm[odified] [+cmd] [N] *:sbm* *:sbmodified* + ウィンドウを分割し、バッファリスト中の[N]個先の編集中のバッ + ファへ移動する。'switchbuf' オプションの設定に従う。 + Note:このコマンドはリストされていないバッファも見つける。 + +:[N]unh[ide] [N] *:unh* *:unhide* *:sun* *:sunhide* +:[N]sun[hide] [N] + バッファリスト中のメモリ上にロードされた各バッファに対して1つ + のウィンドウが開かれているようにスクリーンを再構成する。カウン + トが与えられたら、開くウィンドウの最大数となる。 + +:[N]ba[ll] [N] *:ba* *:ball* *:sba* *:sball* +:[N]sba[ll] [N] バッファリスト中の各バッファに対して1つのウィンドウが開かれて + いるようにスクリーンを再構成する。カウントが与えられたら、開く + ウィンドウの最大数となる。'winheight' も開くウィンドウの数を制 + 限する (|:vertical| が前に与えられているときは 'winwidth')。こ + の時点では、Buf/Win Enter/Leave オートコマンドは新しいウィンド + ウに対して実行されない。ウィンドウに移動したときにのみ実行され + る。 + コマンド修飾子|:tab|をつけて実行すると、新しいウィンドウがそれ + ぞれ新しいタブで開く。ただしタブの個数は 'tabpagemax' に制限さ + れる。 + +Note: 上の全てのコマンドは他のバッファの編集を開始する。各バッファの +'readonly' フラグは保存されている。":edit" コマンドと異なる点は、":edit" コマ +ンドではファイルが読まれた時点で 'readonly' フラグが設定される点である。 + +============================================================================== +12. 特殊なバッファ *special-buffers* + +バッファがファイルのテキストを保持するのでなく、他の目的のために使われることも +ある。バッファの振る舞いを変更するためにいくつかのオプションを設定することがで +きる: + 'bufhidden' バッファがウィンドウに表示されなくなったときどうするか + 'buftype' どんな種類のバッファか + 'swapfile' バッファがスワップファイルを持つか + 'buflisted' バッファリストに現れるか + +いくつかの有用なバッファの種類: + +quickfix エラーリストやロケーションリストを保持するのに使われる。 + |:cwindow| と |:lwindow| を参照。このコマンドは 'buftype' オプ + ションを "quickfix" にセット。これを変更してはならない。 + 'swapfile' はオフ。 + +help ヘルプファイルを保持する。|:help| コマンドによってのみ作成され + る。ヘルプバッファを示すフラグは内部にあり、変更することはでき + ない。ヘルプバッファに対する 'buflisted' オプションはリセット + される。 + +directory ディレクトリの内容を表示する。ファイルエクスプローラープラグイ + ンで使用されている。このバッファは以下の設定で作成される: > + :setlocal buftype=nowrite + :setlocal bufhidden=delete + :setlocal noswapfile +< バッファ名はディレクトリの名前になり、|:cd| コマンドを使ったと + きは変更される。 + +scratch いつでも破棄されうるテキストを保持する。ウィンドウを閉じても + 保たれ、明示的に削除されなければならない。 + 設定は: > + :setlocal buftype=nofile + :setlocal bufhidden=hide + :setlocal noswapfile +< このバッファを識別するためにはバッファ名が使われる。ただし、そ + のためにはそのバッファに意味のある名前がついていなければならな + い。 + + *unlisted-buffer* +unlisted このバッファはバッファリストにない。通常の編集には使われず、 + ヘルプファイルを表示するためや、ファイル名やマークを記憶するた + めに使われる。":bdelete" コマンドによってもこのオプションが + セットされる。それゆえ、このコマンドは完全にはバッファを削除し + ない。設定は: > + :setlocal nobuflisted +< + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/doc/workshop.jax b/plugins/vimdoc-ja/doc/workshop.jax new file mode 100644 index 0000000000..9f0f2b2883 --- /dev/null +++ b/plugins/vimdoc-ja/doc/workshop.jax @@ -0,0 +1,99 @@ +*workshop.txt* For Vim バージョン 8.0. Last change: 2013 Jul 06 + + + VIM リファレンスマニュアル by Gordon Prieur + + +Sun Visual WorkShop との連携機能 *workshop* *workshop-support* + +1. 機能紹介 |workshop-intro| +2. コマンド |workshop-commands| +3. WorkShop用vim/gvimのコンパイル |workshop-compiling| +4. Configuring gvim for a WorkShop release tree |workshop-configure| +5. 最新のXPMライブラリの取得方法 |workshop-xpm| + +{Vi にはこれらの機能はない} +{|+sun_workshop|機能を付けてコンパイルしたときのみ利用可能} + +============================================================================== +1. 機能紹介 *workshop-intro* + +Sun Visual WorkShopではデバッグに使用するエディタを "Editor of Choice" {訳注: +エディタの選択}によってユーザーの好みのものに変更できる。バージョン6.0のリリー +スにあたりgvimはこれに対応した。WorkShopのデバッグセッションにはデバッグウィン +ドウとエディタウィンドウが表示される(同じように他のウィンドウが表示される可能 +性もある)。ウィンドウを切換える必要は最低限で良く、ユーザーはエディタウィンド +ウから多くのデバッグ操作を行うことができる。 + +Sun Visual WorkShop 6 (Forte Developer6とも呼ばれる)に付属するVimのバージョン +は5.3である。このリリース{訳注:Vim 6}の機能はVisual WorkShopに付属するvim/gvim +よりもかなり頼りになる。vimをエディタとして選択しているVWS{訳注:Visual +WorkShopの略}のユーザーは、{訳注: Vim 6の}ソースをコンパイルしWorkShopのリリー +スツリーへインストールするべきだ。 + +============================================================================== +2. コマンド *workshop-commands* + + *:ws* *:wsverb* +:ws[verb] {verb} {verb}を命令実行エンジンに渡す + +WorkShop関数に{verb}を渡し、関数は幾つかの引数を集めて{verb}とデータをIPC接続 +を通じてWorkShopへ送る。 + +============================================================================== +3. WorkShop用vim/gvimのコンパイル *workshop-compiling* + +コンパイル時にFEAT_SUN_WORKSHOPを指定すると、Visual WorkShopに対応したVimを構 +築するのに必要なコンパイルフラグが全て有効化される。VWSのリリースに含まれるSun +のコンパイラを使って、VWSに必要な機能が構築されテストされる。GNUのコンパイラを +使っている場合は構築もテストもされない。これはgccでは決して構築し実行すること +ができないのではなく、単に保証ができないという意味である。 + +============================================================================== +4. Configuring gvim for a WorkShop release tree *workshop-configure* + +VimをSun Visual WorkShop 6と共に使えるようにするためには、幾つかの仮定をしなけ +ればならない。 + + o gccではなくVWSに付属のコンパイラを使わなければならない。gccでは構築もテ + ストもしていないので正しく構築できるかは保証できない。 + + o XPMライブラリを自分で用意しなければならない。最新のXPMの入手方法の詳細は + 下記の|workshop-xpm|を参照すること。 + + o ディレクトリsrc/の中のMakefileを編集し、Sun Visual WorkShopのための何行 + かのコメントを解除する。文字列FEAT_SUN_WORKSHOPを検索すれば簡単に見つけ + ることができる。 + + o GUIにはMotifを使用することを提案する。そうすればgvimの外見と感触がSun + Visual WorkShopの他の部分と同じようなものになる。 + +下のコマンドはSun Visual WorkShopに対応したvimを構築するよう構成したい時に使用 +できる: > + + $ CC=cc configure --enable-workshop --enable-gui=motif \ + -prefix=<VWS-install-dir>/contrib/contrib6/<vim-version> +< +<VWS-install-dir>にはSun Visual WorkShopをインストールしたベースディレクトリを +指定する。デフォルトでは/opt/SUNWsproである。通常Vimをインストールするには管理 +者権限が必要になる。<VWS-install-dir>/bin/gvimが新しくインストールしたgvimを指 +すようにsymlinkを変更する必要もある。<vim-version>にはバージョンを示す文字列を +指定する。著者は "vim" にversion.hの中のVIM_VERSION_SHORTと同じ物を付加して使っ +ている。 + +============================================================================== +5. 最新のXPMライブラリの取得方法 *workshop-xpm* + +XPMライブラリはVimで(MotifかAthenaを使って)画像を表示するために必要とされる。 +それ無しではツールバーと目印が利用できなくなる。 + +XPMライブラリは French National Institute for Research in Computer Science and +Control{訳注:フランス国立コンピュータ科学/制御研究所---通称INRIA} の Arnaud Le +Hors によって提供されている。http://cgit.freedesktop.org/xorg/lib/libXpm より +ダウンロードできる。これを書いている時点での最新版はxpm-3.4k-solaris.tgzでgzip +されたtarファイルである。ディレクトリ /usr/local/xpmを作成してそこにファイルを +伸長展開したならば、Makefile内のコメントアウトされた行を内容は変更せずにコメン +トを解除するだけで使うことができる。もしもxpmを他のディレクトリに置いたならば +src/Makefile内のXPM_DIRを変更する必要がある。 + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugins/vimdoc-ja/syntax/help_ja.vim b/plugins/vimdoc-ja/syntax/help_ja.vim new file mode 100644 index 0000000000..5293499e9f --- /dev/null +++ b/plugins/vimdoc-ja/syntax/help_ja.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 + +syn match helpVim "Vim バージョン [0-9.a-z]\+" +syn match helpVim "VIMリファレンス.*" +syn region helpNotVi start="{Vim" start="{|++\?[A-Za-z0-9_/()]\+|" end="}" contains=helpLeadBlank,helpHyperTextJump diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim index 1f8234a575..d04feb9250 100644 --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -2,12 +2,13 @@ " Description: Perform Ada specific completion & tagging. " Language: Ada (2005) " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ -" Maintainer: Martin Krischik <krischik@users.sourceforge.net> +" Maintainer: Mathias Brousset <mathiasb17@gmail.com> +" Martin Krischik <krischik@users.sourceforge.net> " Taylor Venable <taylor@metasyntax.net> " Neil Bird <neil@fnxweb.com> " Ned Okie <nokie@radford.edu> " $Author: krischik $ -" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ +" $Date: 2017-01-31 20:20:05 +0200 (Mon, 01 Jan 2017) $ " Version: 4.6 " $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/ada.vim $ @@ -23,6 +24,7 @@ " 09.05.2007 MK Session just won't work no matter how much " tweaking is done " 19.09.2007 NO still some mapleader problems +" 31.01.2017 MB fix more mapleader problems " Help Page: ft-ada-functions "------------------------------------------------------------------------------ @@ -447,7 +449,7 @@ function ada#Switch_Session (New_Session) if a:New_Session != v:this_session " - " We actualy got a new session - otherwise there + " We actually got a new session - otherwise there " is nothing to do. " if strlen (v:this_session) > 0 @@ -585,11 +587,11 @@ function ada#Map_Menu (Text, Keys, Command) \ " :" . a:Command . "<CR>" execute \ "nnoremap <buffer>" . - \ escape(l:leader . "a" . a:Keys , '\') . + \ " <Leader>a" . a:Keys . \" :" . a:Command execute \ "inoremap <buffer>" . - \ escape(l:leader . "a" . a:Keys , '\') . + \ " <Leader>a" . a:Keys . \" <C-O>:" . a:Command endif return diff --git a/runtime/autoload/clojurecomplete.vim b/runtime/autoload/clojurecomplete.vim index 708bb31104..030785e901 100644 --- a/runtime/autoload/clojurecomplete.vim +++ b/runtime/autoload/clojurecomplete.vim @@ -1,14 +1,14 @@ " Vim completion script -" Language: Clojure -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Language: Clojure +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 " -*- COMPLETION WORDS -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj -" Clojure version 1.6.0 -let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*source-path*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn","bound-fn*","bound?","butlast","byte","byte-array","bytes","case","cast","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","doubles","drop","drop-last","drop-while","empty","empty?","ensure","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","quot","quote","rand","rand-int","rand-nth","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","sync","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unsigned-bit-shift-right","update-in","update-proxy","use","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"] +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj +" Clojure version 1.8.0 +let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn","bound-fn*","bound?","butlast","byte","byte-array","bytes","case","cast","cat","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","quot","quote","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","use","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"] " Simple word completion for special forms and public vars in clojure.core function! clojurecomplete#Complete(findstart, base) diff --git a/runtime/autoload/context.vim b/runtime/autoload/context.vim new file mode 100644 index 0000000000..254d710c01 --- /dev/null +++ b/runtime/autoload/context.vim @@ -0,0 +1,184 @@ +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Latest Revision: 2016 Oct 21 + +let s:keepcpo= &cpo +set cpo&vim + +" Helper functions {{{ +function! s:context_echo(message, mode) + redraw + echo "\r" + execute 'echohl' a:mode + echomsg '[ConTeXt]' a:message + echohl None +endf + +function! s:sh() + return has('win32') || has('win64') || has('win16') || has('win95') + \ ? ['cmd.exe', '/C'] + \ : ['/bin/sh', '-c'] +endfunction + +" For backward compatibility +if exists('*win_getid') + + function! s:win_getid() + return win_getid() + endf + + function! s:win_id2win(winid) + return win_id2win(a:winid) + endf + +else + + function! s:win_getid() + return winnr() + endf + + function! s:win_id2win(winnr) + return a:winnr + endf + +endif +" }}} + +" ConTeXt jobs {{{ +if has('job') + + let g:context_jobs = [] + + " Print the status of ConTeXt jobs + function! context#job_status() + let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') + let l:n = len(l:jobs) + call s:context_echo( + \ 'There '.(l:n == 1 ? 'is' : 'are').' '.(l:n == 0 ? 'no' : l:n) + \ .' job'.(l:n == 1 ? '' : 's').' running' + \ .(l:n == 0 ? '.' : ' (' . join(l:jobs, ', ').').'), + \ 'ModeMsg') + endfunction + + " Stop all ConTeXt jobs + function! context#stop_jobs() + let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') + for job in l:jobs + call job_stop(job) + endfor + sleep 1 + let l:tmp = [] + for job in l:jobs + if job_status(job) == "run" + call add(l:tmp, job) + endif + endfor + let g:context_jobs = l:tmp + if empty(g:context_jobs) + call s:context_echo('Done. No jobs running.', 'ModeMsg') + else + call s:context_echo('There are still some jobs running. Please try again.', 'WarningMsg') + endif + endfunction + + function! context#callback(path, job, status) + if index(g:context_jobs, a:job) != -1 && job_status(a:job) != 'run' " just in case + call remove(g:context_jobs, index(g:context_jobs, a:job)) + endif + call s:callback(a:path, a:job, a:status) + endfunction + + function! context#close_cb(channel) + call job_status(ch_getjob(a:channel)) " Trigger exit_cb's callback for faster feedback + endfunction + + function! s:typeset(path) + call add(g:context_jobs, + \ job_start(add(s:sh(), context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))), { + \ 'close_cb' : 'context#close_cb', + \ 'exit_cb' : function(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), + \ [a:path]), + \ 'in_io' : 'null' + \ })) + endfunction + +else " No jobs + + function! context#job_status() + call s:context_echo('Not implemented', 'WarningMsg') + endfunction! + + function! context#stop_jobs() + call s:context_echo('Not implemented', 'WarningMsg') + endfunction + + function! context#callback(path, job, status) + call s:callback(a:path, a:job, a:status) + endfunction + + function! s:typeset(path) + execute '!' . context#command() . ' ' . shellescape(fnamemodify(a:path, ":t")) + call call(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), + \ [a:path, 0, v:shell_error]) + endfunction + +endif " has('job') + +function! s:callback(path, job, status) abort + if a:status < 0 " Assume the job was terminated + return + endif + " Get info about the current window + let l:winid = s:win_getid() " Save window id + let l:efm = &l:errorformat " Save local errorformat + let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory + " Set errorformat to parse ConTeXt errors + execute 'setl efm=' . escape(b:context_errorformat, ' ') + try " Set cwd to expand error file correctly + execute 'lcd' fnameescape(fnamemodify(a:path, ':h')) + catch /.*/ + execute 'setl efm=' . escape(l:efm, ' ') + throw v:exception + endtry + try + execute 'cgetfile' fnameescape(fnamemodify(a:path, ':r') . '.log') + botright cwindow + finally " Restore cwd and errorformat + execute s:win_id2win(l:winid) . 'wincmd w' + execute 'lcd ' . fnameescape(l:cwd) + execute 'setl efm=' . escape(l:efm, ' ') + endtry + if a:status == 0 + call s:context_echo('Success!', 'ModeMsg') + else + call s:context_echo('There are errors. ', 'ErrorMsg') + endif +endfunction + +function! context#command() + return get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) + \ . ' --script context --autogenerate --nonstopmode' + \ . ' --synctex=' . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') + \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) +endfunction + +" Accepts an optional path (useful for big projects, when the file you are +" editing is not the project's root document). If no argument is given, uses +" the path of the current buffer. +function! context#typeset(...) abort + let l:path = fnamemodify(strlen(a:000[0]) > 0 ? a:1 : expand("%"), ":p") + let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory + call s:context_echo('Typesetting...', 'ModeMsg') + execute 'lcd' fnameescape(fnamemodify(l:path, ":h")) + try + call s:typeset(l:path) + finally " Restore local working directory + execute 'lcd ' . fnameescape(l:cwd) + endtry +endfunction! +"}}} + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim: sw=2 fdm=marker diff --git a/runtime/autoload/contextcomplete.vim b/runtime/autoload/contextcomplete.vim new file mode 100644 index 0000000000..5b93bb0986 --- /dev/null +++ b/runtime/autoload/contextcomplete.vim @@ -0,0 +1,25 @@ +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Latest Revision: 2016 Oct 15 + +let s:keepcpo= &cpo +set cpo&vim + +" Complete keywords in MetaPost blocks +function! contextcomplete#Complete(findstart, base) + if a:findstart == 1 + if len(synstack(line('.'), 1)) > 0 && + \ synIDattr(synstack(line('.'), 1)[0], "name") ==# 'contextMPGraphic' + return syntaxcomplete#Complete(a:findstart, a:base) + else + return -3 + endif + else + return syntaxcomplete#Complete(a:findstart, a:base) + endif +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim: sw=2 fdm=marker diff --git a/runtime/autoload/csscomplete.vim b/runtime/autoload/csscomplete.vim index 9eebb87d5b..50048a37fd 100644 --- a/runtime/autoload/csscomplete.vim +++ b/runtime/autoload/csscomplete.vim @@ -1,429 +1,740 @@ " Vim completion script -" Language: CSS 2.1 -" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2007 May 5 +" Language: CSS +" Based on MDN CSS Reference at 2016 Jan <https://developer.mozilla.org/en-US/docs/Web/CSS/Reference> +" plus CSS Speech Module <http://www.w3.org/TR/css3-speech/> +" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com ) +" Original Author: Mikolaj Machowski ( mikmach AT wp DOT pl ) +" Last Change: 2016 Jan 11 - let s:values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index") +let s:values = split("all additive-symbols align-content align-items align-self animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size block-size border border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip clip-path color columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width content counter-increment counter-reset cue cue-before cue-after cursor direction display empty-cells fallback filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-start grid-column-end grid-row grid-row-start grid-row-end grid-template grid-template-areas grid-template-rows grid-template-columns height hyphens image-rendering image-resolution image-orientation ime-mode inline-size isolation justify-content left letter-spacing line-break line-height list-style list-style-image list-style-position list-style-type margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin-top marks mask mask-type max-block-size max-height max-inline-size max-width max-zoom min-block-size min-height min-inline-size min-width min-zoom mix-blend-mode negative object-fit object-position offset-block-end offset-block-start offset-inline-end offset-inline-start opacity order orientation orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y pad padding padding-block-end padding-block-start padding-bottom padding-inline-end padding-inline-start padding-left padding-right padding-top page-break-after page-break-before page-break-inside pause-before pause-after pause perspective perspective-origin pointer-events position prefix quotes range resize rest rest-before rest-after right ruby-align ruby-merge ruby-position scroll-behavior scroll-snap-coordinate scroll-snap-destination scroll-snap-points-x scroll-snap-points-y scroll-snap-type scroll-snap-type-x scroll-snap-type-y shape-image-threshold shape-margin shape-outside speak speak-as suffix symbols system table-layout tab-size text-align text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-orientation text-overflow text-rendering text-shadow text-transform text-underline-position top touch-action transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi unicode-range user-zoom vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-rate voice-range voice-stress voice-volume white-space widows width will-change word-break word-spacing word-wrap writing-mode z-index zoom") -function! csscomplete#CompleteCSS(findstart, base) - -if a:findstart - " We need whole line to proper checking - let line = getline('.') - let start = col('.') - 1 - let compl_begin = col('.') - 2 - while start >= 0 && line[start - 1] =~ '\%(\k\|-\)' - let start -= 1 - endwhile - let b:compl_context = line[0:compl_begin] - return start -endif - -" There are few chars important for context: -" ^ ; : { } /* */ -" Where ^ is start of line and /* */ are comment borders -" Depending on their relative position to cursor we will know what should -" be completed. -" 1. if nearest are ^ or { or ; current word is property -" 2. if : it is value (with exception of pseudo things) -" 3. if } we are outside of css definitions -" 4. for comments ignoring is be the easiest but assume they are the same -" as 1. -" 5. if @ complete at-rule -" 6. if ! complete important -if exists("b:compl_context") - let line = b:compl_context - unlet! b:compl_context -else - let line = a:base -endif - -let res = [] -let res2 = [] -let borders = {} - -" Check last occurrence of sequence - -let openbrace = strridx(line, '{') -let closebrace = strridx(line, '}') -let colon = strridx(line, ':') -let semicolon = strridx(line, ';') -let opencomm = strridx(line, '/*') -let closecomm = strridx(line, '*/') -let style = strridx(line, 'style\s*=') -let atrule = strridx(line, '@') -let exclam = strridx(line, '!') - -if openbrace > -1 - let borders[openbrace] = "openbrace" -endif -if closebrace > -1 - let borders[closebrace] = "closebrace" -endif -if colon > -1 - let borders[colon] = "colon" -endif -if semicolon > -1 - let borders[semicolon] = "semicolon" -endif -if opencomm > -1 - let borders[opencomm] = "opencomm" -endif -if closecomm > -1 - let borders[closecomm] = "closecomm" -endif -if style > -1 - let borders[style] = "style" -endif -if atrule > -1 - let borders[atrule] = "atrule" -endif -if exclam > -1 - let borders[exclam] = "exclam" -endif - - -if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$' - " Complete properties - - - let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$') - - for m in s:values - if m =~? '^'.entered_property - call add(res, m . ':') - elseif m =~? entered_property - call add(res2, m . ':') - endif - endfor - - return res + res2 - -elseif borders[max(keys(borders))] == 'colon' - " Get name of property - let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$')) - - if prop == 'azimuth' - let values = ["left-side", "far-left", "left", "center-left", "center", "center-right", "right", "far-right", "right-side", "behind", "leftwards", "rightwards"] - elseif prop == 'background-attachment' - let values = ["scroll", "fixed"] - elseif prop == 'background-color' - let values = ["transparent", "rgb(", "#"] - elseif prop == 'background-image' - let values = ["url(", "none"] - elseif prop == 'background-position' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z]\+\)\?$' - let values = ["top", "center", "bottom"] - elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["left", "center", "right"] - else - return [] - endif - elseif prop == 'background-repeat' - let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] - elseif prop == 'background' - let values = ["url(", "scroll", "fixed", "transparent", "rgb(", "#", "none", "top", "center", "bottom" , "left", "right", "repeat", "repeat-x", "repeat-y", "no-repeat"] - elseif prop == 'border-collapse' - let values = ["collapse", "separate"] - elseif prop == 'border-color' - let values = ["rgb(", "#", "transparent"] - elseif prop == 'border-spacing' - return [] - elseif prop == 'border-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)$' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = ["thin", "thick", "medium"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["rgb(", "#", "transparent"] - else - return [] - endif - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-color' - let values = ["rgb(", "#", "transparent"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'border-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'border' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = ["thin", "thick", "medium"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["rgb(", "#", "transparent"] - else - return [] - endif - elseif prop == 'bottom' - let values = ["auto"] - elseif prop == 'caption-side' - let values = ["top", "bottom"] - elseif prop == 'clear' - let values = ["none", "left", "right", "both"] - elseif prop == 'clip' - let values = ["auto", "rect("] - elseif prop == 'color' - let values = ["rgb(", "#"] - elseif prop == 'content' - let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] - elseif prop =~ 'counter-\%(increment\|reset\)$' - let values = ["none"] - elseif prop =~ '^\%(cue-after\|cue-before\|cue\)$' - let values = ["url(", "none"] - elseif prop == 'cursor' - let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] - elseif prop == 'direction' - let values = ["ltr", "rtl"] - elseif prop == 'display' - let values = ["inline", "block", "list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none"] - elseif prop == 'elevation' - let values = ["below", "level", "above", "higher", "lower"] - elseif prop == 'empty-cells' - let values = ["show", "hide"] - elseif prop == 'float' - let values = ["left", "right", "none"] - elseif prop == 'font-family' - let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"] - elseif prop == 'font-size' - let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] - elseif prop == 'font-style' - let values = ["normal", "italic", "oblique"] - elseif prop == 'font-variant' - let values = ["normal", "small-caps"] - elseif prop == 'font-weight' - let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] - elseif prop == 'font' - let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"] - elseif prop =~ '^\%(height\|width\)$' - let values = ["auto"] - elseif prop =~ '^\%(left\|rigth\)$' - let values = ["auto"] - elseif prop == 'letter-spacing' - let values = ["normal"] - elseif prop == 'line-height' - let values = ["normal"] - elseif prop == 'list-style-image' - let values = ["url(", "none"] - elseif prop == 'list-style-position' - let values = ["inside", "outside"] - elseif prop == 'list-style-type' - let values = ["disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-latin", "upper-latin", "none"] - elseif prop == 'list-style' - return [] - elseif prop == 'margin' - let values = ["auto"] - elseif prop =~ 'margin-\%(right\|left\|top\|bottom\)$' - let values = ["auto"] - elseif prop == 'max-height' - let values = ["auto"] - elseif prop == 'max-width' - let values = ["none"] - elseif prop == 'min-height' - let values = ["none"] - elseif prop == 'min-width' - let values = ["none"] - elseif prop == 'orphans' - return [] - elseif prop == 'outline-color' - let values = ["rgb(", "#"] - elseif prop == 'outline-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop == 'outline-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'outline' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' - let values = ["rgb(", "#"] - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["thin", "thick", "medium"] - else - return [] - endif - elseif prop == 'overflow' - let values = ["visible", "hidden", "scroll", "auto"] - elseif prop == 'padding' - return [] - elseif prop =~ 'padding-\%(top\|right\|bottom\|left\)$' - return [] - elseif prop =~ 'page-break-\%(after\|before\)$' - let values = ["auto", "always", "avoid", "left", "right"] - elseif prop == 'page-break-inside' - let values = ["auto", "avoid"] - elseif prop =~ 'pause-\%(after\|before\)$' - return [] - elseif prop == 'pause' - return [] - elseif prop == 'pitch-range' - return [] - elseif prop == 'pitch' - let values = ["x-low", "low", "medium", "high", "x-high"] - elseif prop == 'play-during' - let values = ["url(", "mix", "repeat", "auto", "none"] - elseif prop == 'position' - let values = ["static", "relative", "absolute", "fixed"] - elseif prop == 'quotes' - let values = ["none"] - elseif prop == 'richness' - return [] - elseif prop == 'speak-header' - let values = ["once", "always"] - elseif prop == 'speak-numeral' - let values = ["digits", "continuous"] - elseif prop == 'speak-punctuation' - let values = ["code", "none"] - elseif prop == 'speak' - let values = ["normal", "none", "spell-out"] - elseif prop == 'speech-rate' - let values = ["x-slow", "slow", "medium", "fast", "x-fast", "faster", "slower"] - elseif prop == 'stress' - return [] - elseif prop == 'table-layout' - let values = ["auto", "fixed"] - elseif prop == 'text-align' - let values = ["left", "right", "center", "justify"] - elseif prop == 'text-decoration' - let values = ["none", "underline", "overline", "line-through", "blink"] - elseif prop == 'text-indent' - return [] - elseif prop == 'text-transform' - let values = ["capitalize", "uppercase", "lowercase", "none"] - elseif prop == 'top' - let values = ["auto"] - elseif prop == 'unicode-bidi' - let values = ["normal", "embed", "bidi-override"] - elseif prop == 'vertical-align' - let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] - elseif prop == 'visibility' - let values = ["visible", "hidden", "collapse"] - elseif prop == 'voice-family' - return [] - elseif prop == 'volume' - let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] - elseif prop == 'white-space' - let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] - elseif prop == 'widows' - return [] - elseif prop == 'word-spacing' - let values = ["normal"] - elseif prop == 'z-index' - let values = ["auto"] - else - " If no property match it is possible we are outside of {} and - " trying to complete pseudo-(class|element) - let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$')) - if stridx(',a,abbr,acronym,address,area,b,base,bdo,big,blockquote,body,br,button,caption,cite,code,col,colgroup,dd,del,dfn,div,dl,dt,em,fieldset,form,head,h1,h2,h3,h4,h5,h6,hr,html,i,img,input,ins,kbd,label,legend,li,link,map,meta,noscript,object,ol,optgroup,option,p,param,pre,q,samp,script,select,small,span,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,ul,var,', ','.element.',') > -1 - let values = ["first-child", "link", "visited", "hover", "active", "focus", "lang", "first-line", "first-letter", "before", "after"] - else - return [] - endif - endif - - " Complete values - let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$') - - for m in values - if m =~? '^'.entered_value - call add(res, m) - elseif m =~? entered_value - call add(res2, m) - endif - endfor - - return res + res2 - -elseif borders[max(keys(borders))] == 'closebrace' - - return [] - -elseif borders[max(keys(borders))] == 'exclam' - - " Complete values - let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$') - - let values = ["important"] - - for m in values - if m =~? '^'.entered_imp - call add(res, m) - endif - endfor - - return res - -elseif borders[max(keys(borders))] == 'atrule' - - let afterat = matchstr(line, '.*@\zs.*') - - if afterat =~ '\s' - - let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze') - - if atrulename == 'media' - let values = ["screen", "tty", "tv", "projection", "handheld", "print", "braille", "aural", "all"] - - let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$') - - elseif atrulename == 'import' - let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$') - - if entered_atruleafter =~ "^[\"']" - let filestart = matchstr(entered_atruleafter, '^.\zs.*') - let files = split(glob(filestart.'*'), '\n') - let values = map(copy(files), '"\"".v:val') - - elseif entered_atruleafter =~ "^url(" - let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*") - let files = split(glob(filestart.'*'), '\n') - let values = map(copy(files), '"url(".v:val') - - else - let values = ['"', 'url('] - - endif - - else - return [] - - endif - - for m in values - if m =~? '^'.entered_atruleafter - call add(res, m) - elseif m =~? entered_atruleafter - call add(res2, m) - endif - endfor - - return res + res2 - - endif - - let values = ["charset", "page", "media", "import", "font-face"] - let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$') - - for m in values - if m =~? '^'.entered_atrule - call add(res, m .' ') - elseif m =~? entered_atrule - call add(res2, m .' ') - endif - endfor - - return res + res2 - -endif +function! csscomplete#CompleteCSS(findstart, base) -return [] + if a:findstart + " We need whole line to proper checking + let line = getline('.') + let start = col('.') - 1 + let compl_begin = col('.') - 2 + while start >= 0 && line[start - 1] =~ '\%(\k\|-\)' + let start -= 1 + endwhile + let b:after = line[compl_begin :] + let b:compl_context = line[0:compl_begin] + return start + endif + + " There are few chars important for context: + " ^ ; : { } /* */ + " Where ^ is start of line and /* */ are comment borders + " Depending on their relative position to cursor we will know what should + " be completed. + " 1. if nearest are ^ or { or ; current word is property + " 2. if : it is value (with exception of pseudo things) + " 3. if } we are outside of css definitions + " 4. for comments ignoring is be the easiest but assume they are the same + " as 1. + " 5. if @ complete at-rule + " 6. if ! complete important + if exists("b:compl_context") + let line = b:compl_context + let after = b:after + unlet! b:compl_context + else + let line = a:base + endif + + let res = [] + let res2 = [] + let borders = {} + + " Check last occurrence of sequence + + let openbrace = strridx(line, '{') + let closebrace = strridx(line, '}') + let colon = strridx(line, ':') + let semicolon = strridx(line, ';') + let opencomm = strridx(line, '/*') + let closecomm = strridx(line, '*/') + let style = strridx(line, 'style\s*=') + let atrule = strridx(line, '@') + let exclam = strridx(line, '!') + + if openbrace > -1 + let borders[openbrace] = "openbrace" + endif + if closebrace > -1 + let borders[closebrace] = "closebrace" + endif + if colon > -1 + let borders[colon] = "colon" + endif + if semicolon > -1 + let borders[semicolon] = "semicolon" + endif + if opencomm > -1 + let borders[opencomm] = "opencomm" + endif + if closecomm > -1 + let borders[closecomm] = "closecomm" + endif + if style > -1 + let borders[style] = "style" + endif + if atrule > -1 + let borders[atrule] = "atrule" + endif + if exclam > -1 + let borders[exclam] = "exclam" + endif + + + if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$' + " Complete properties + + + let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$') + + for m in s:values + if m =~? '^'.entered_property + call add(res, m . ':') + elseif m =~? entered_property + call add(res2, m . ':') + endif + endfor + + return res + res2 + + elseif borders[max(keys(borders))] == 'colon' + " Get name of property + let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$')) + + let wide_keywords = ["initial", "inherit", "unset"] + let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"] + let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + let border_width_values = ["thin", "thick", "medium"] + let list_style_type_values = ["decimal", "decimal-leading-zero", "arabic-indic", "armenian", "upper-armenian", "lower-armenian", "bengali", "cambodian", "khmer", "cjk-decimal", "devanagari", "georgian", "gujarati", "gurmukhi", "hebrew", "kannada", "lao", "malayalam", "mongolian", "myanmar", "oriya", "persian", "lower-roman", "upper-roman", "tamil", "telugu", "thai", "tibetan", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "cjk-earthly-branch", "cjk-heavenly-stem", "lower-greek", "hiragana", "hiragana-iroha", "katakana", "katakana-iroha", "disc", "circle", "square", "disclosure-open", "disclosure-closed"] + let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"] + + if prop == 'all' + let values = [] + elseif prop == 'additive-symbols' + let values = [] + elseif prop == 'align-content' + let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"] + elseif prop == 'align-items' + let values = ["flex-start", "flex-end", "center", "baseline", "stretch"] + elseif prop == 'align-self' + let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"] + elseif prop == 'animation' + let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"] + elseif prop == 'animation-delay' + let values = [] + elseif prop == 'animation-direction' + let values = ["normal", "reverse", "alternate", "alternate-reverse"] + elseif prop == 'animation-duration' + let values = [] + elseif prop == 'animation-fill-mode' + let values = ["none", "forwards", "backwards", "both"] + elseif prop == 'animation-iteration-count' + let values = [] + elseif prop == 'animation-name' + let values = [] + elseif prop == 'animation-play-state' + let values = ["running", "paused"] + elseif prop == 'animation-timing-function' + let values = timing_functions + elseif prop == 'background-attachment' + let values = ["scroll", "fixed"] + elseif prop == 'background-color' + let values = color_values + elseif prop == 'background-image' + let values = ["url(", "none"] + elseif prop == 'background-position' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z]\+\)\?$' + let values = ["top", "center", "bottom"] + elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = ["left", "center", "right"] + else + return [] + endif + elseif prop == 'background-repeat' + let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] + elseif prop == 'background-size' + let values = ["auto", "contain", "cover"] + elseif prop == 'background' + let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"] + elseif prop =~ 'border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' + let values = border_width_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = border_style_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = color_values + else + return [] + endif + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color' + let values = color_values + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style' + let values = border_style_values + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width' + let values = border_width_values + elseif prop == 'border-color' + let values = color_values + elseif prop == 'border-style' + let values = border_style_values + elseif prop == 'border-width' + let values = border_width_values + elseif prop == 'bottom' + let values = ["auto"] + elseif prop == 'box-decoration-break' + let values = ["slice", "clone"] + elseif prop == 'box-shadow' + let values = ["inset"] + elseif prop == 'box-sizing' + let values = ["border-box", "content-box"] + elseif prop =~ 'break-\%(before\|after\)' + let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"] + elseif prop == 'break-inside' + let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"] + elseif prop == 'caption-side' + let values = ["top", "bottom"] + elseif prop == 'clear' + let values = ["none", "left", "right", "both"] + elseif prop == 'clip' + let values = ["auto", "rect("] + elseif prop == 'clip-path' + let values = ["fill-box", "stroke-box", "view-box", "none"] + elseif prop == 'color' + let values = color_values + elseif prop == 'columns' + let values = [] + elseif prop == 'column-count' + let values = ['auto'] + elseif prop == 'column-fill' + let values = ['auto', 'balance'] + elseif prop == 'column-rule-color' + let values = color_values + elseif prop == 'column-rule-style' + let values = border_style_values + elseif prop == 'column-rule-width' + let values = border_width_values + elseif prop == 'column-rule' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' + let values = border_width_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = border_style_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = color_values + else + return [] + endif + elseif prop == 'column-span' + let values = ["none", "all"] + elseif prop == 'column-width' + let values = ["auto"] + elseif prop == 'content' + let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] + elseif prop =~ 'counter-\%(increment\|reset\)$' + let values = ["none"] + elseif prop =~ 'cue\%(-after\|-before\)\=$' + let values = ["url("] + elseif prop == 'cursor' + let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] + elseif prop == 'direction' + let values = ["ltr", "rtl"] + elseif prop == 'display' + let values = ["inline", "block", "list-item", "inline-list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none", "flex", "inline-flex", "grid", "inline-grid", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"] + elseif prop == 'elevation' + let values = ["below", "level", "above", "higher", "lower"] + elseif prop == 'empty-cells' + let values = ["show", "hide"] + elseif prop == 'fallback' + let values = list_style_type_values + elseif prop == 'filter' + let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("] + elseif prop == 'flex-basis' + let values = ["auto", "content"] + elseif prop == 'flex-flow' + let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + elseif prop == 'flex-grow' + let values = [] + elseif prop == 'flex-shrink' + let values = [] + elseif prop == 'flex-wrap' + let values = ["nowrap", "wrap", "wrap-reverse"] + elseif prop == 'flex' + let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"] + elseif prop == 'float' + let values = ["left", "right", "none"] + elseif prop == 'font-family' + let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"] + elseif prop == 'font-feature-settings' + let values = ["normal", '"aalt"', '"abvf"', '"abvm"', '"abvs"', '"afrc"', '"akhn"', '"blwf"', '"blwm"', '"blws"', '"calt"', '"case"', '"ccmp"', '"cfar"', '"cjct"', '"clig"', '"cpct"', '"cpsp"', '"cswh"', '"curs"', '"cv', '"c2pc"', '"c2sc"', '"dist"', '"dlig"', '"dnom"', '"dtls"', '"expt"', '"falt"', '"fin2"', '"fin3"', '"fina"', '"flac"', '"frac"', '"fwid"', '"half"', '"haln"', '"halt"', '"hist"', '"hkna"', '"hlig"', '"hngl"', '"hojo"', '"hwid"', '"init"', '"isol"', '"ital"', '"jalt"', '"jp78"', '"jp83"', '"jp90"', '"jp04"', '"kern"', '"lfbd"', '"liga"', '"ljmo"', '"lnum"', '"locl"', '"ltra"', '"ltrm"', '"mark"', '"med2"', '"medi"', '"mgrk"', '"mkmk"', '"mset"', '"nalt"', '"nlck"', '"nukt"', '"numr"', '"onum"', '"opbd"', '"ordn"', '"ornm"', '"palt"', '"pcap"', '"pkna"', '"pnum"', '"pref"', '"pres"', '"pstf"', '"psts"', '"pwid"', '"qwid"', '"rand"', '"rclt"', '"rkrf"', '"rlig"', '"rphf"', '"rtbd"', '"rtla"', '"rtlm"', '"ruby"', '"salt"', '"sinf"', '"size"', '"smcp"', '"smpl"', '"ss01"', '"ss02"', '"ss03"', '"ss04"', '"ss05"', '"ss06"', '"ss07"', '"ss08"', '"ss09"', '"ss10"', '"ss11"', '"ss12"', '"ss13"', '"ss14"', '"ss15"', '"ss16"', '"ss17"', '"ss18"', '"ss19"', '"ss20"', '"ssty"', '"stch"', '"subs"', '"sups"', '"swsh"', '"titl"', '"tjmo"', '"tnam"', '"tnum"', '"trad"', '"twid"', '"unic"', '"valt"', '"vatu"', '"vert"', '"vhal"', '"vjmo"', '"vkna"', '"vkrn"', '"vpal"', '"vrt2"', '"zero"'] + elseif prop == 'font-kerning' + let values = ["auto", "normal", "none"] + elseif prop == 'font-language-override' + let values = ["normal"] + elseif prop == 'font-size' + let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] + elseif prop == 'font-size-adjust' + let values = [] + elseif prop == 'font-stretch' + let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"] + elseif prop == 'font-style' + let values = ["normal", "italic", "oblique"] + elseif prop == 'font-synthesis' + let values = ["none", "weight", "style"] + elseif prop == 'font-variant-alternates' + let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + elseif prop == 'font-variant-caps' + let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + elseif prop == 'font-variant-asian' + let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + elseif prop == 'font-variant-ligatures' + let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + elseif prop == 'font-variant-numeric' + let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + elseif prop == 'font-variant-position' + let values = ["normal", "sub", "super"] + elseif prop == 'font-variant' + let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + ["small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + ["ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + ["none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + ["ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + ["sub", "super"] + elseif prop == 'font-weight' + let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] + elseif prop == 'font' + let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"] + elseif prop =~ '^\%(height\|width\)$' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop =~ '^\%(left\|rigth\)$' + let values = ["auto"] + elseif prop == 'image-rendering' + let values = ["auto", "crisp-edges", "pixelated"] + elseif prop == 'image-orientation' + let values = ["from-image", "flip"] + elseif prop == 'ime-mode' + let values = ["auto", "normal", "active", "inactive", "disabled"] + elseif prop == 'inline-size' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == 'isolation' + let values = ["auto", "isolate"] + elseif prop == 'justify-content' + let values = ["flex-start", "flex-end", "center", "space-between", "space-around"] + elseif prop == 'letter-spacing' + let values = ["normal"] + elseif prop == 'line-break' + let values = ["auto", "loose", "normal", "strict"] + elseif prop == 'line-height' + let values = ["normal"] + elseif prop == 'list-style-image' + let values = ["url(", "none"] + elseif prop == 'list-style-position' + let values = ["inside", "outside"] + elseif prop == 'list-style-type' + let values = list_style_type_values + elseif prop == 'list-style' + let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"] + elseif prop == 'margin' + let values = ["auto"] + elseif prop =~ 'margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$' + let values = ["auto"] + elseif prop == 'marks' + let values = ["crop", "cross", "none"] + elseif prop == 'mask' + let values = ["url("] + elseif prop == 'mask-type' + let values = ["luminance", "alpha"] + elseif prop == '\%(max\|min\)-\%(block\|inline\)-size' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == '\%(max\|min\)-\%(height\|width\)' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == '\%(max\|min\)-zoom' + let values = ["auto"] + elseif prop == 'mix-blend-mode' + let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"] + elseif prop == 'opacity' + let values = [] + elseif prop == 'orientation' + let values = ["auto", "portrait", "landscape"] + elseif prop == 'orphans' + let values = [] + elseif prop == 'outline-offset' + let values = [] + elseif prop == 'outline-color' + let values = color_values + elseif prop == 'outline-style' + let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + elseif prop == 'outline-width' + let values = ["thin", "thick", "medium"] + elseif prop == 'outline' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' + let values = color_values + elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = ["thin", "thick", "medium"] + else + return [] + endif + elseif prop == 'overflow-wrap' + let values = ["normal", "break-word"] + elseif prop =~ 'overflow\%(-x\|-y\)\=' + let values = ["visible", "hidden", "scroll", "auto"] + elseif prop == 'pad' + let values = [] + elseif prop == 'padding' + let values = [] + elseif prop =~ 'padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$' + let values = [] + elseif prop =~ 'page-break-\%(after\|before\)$' + let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"] + elseif prop == 'page-break-inside' + let values = ["auto", "avoid"] + elseif prop =~ 'pause\%(-after\|-before\)\=$' + let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] + elseif prop == 'perspective' + let values = ["none"] + elseif prop == 'perspective-origin' + let values = ["top", "bottom", "left", "center", " right"] + elseif prop == 'pointer-events' + let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"] + elseif prop == 'position' + let values = ["static", "relative", "absolute", "fixed", "sticky"] + elseif prop == 'prefix' + let values = [] + elseif prop == 'quotes' + let values = ["none"] + elseif prop == 'range' + let values = ["auto", "infinite"] + elseif prop == 'resize' + let values = ["none", "both", "horizontal", "vertical"] + elseif prop =~ 'rest\%(-after\|-before\)\=$' + let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] + elseif prop == 'ruby-align' + let values = ["start", "center", "space-between", "space-around"] + elseif prop == 'ruby-merge' + let values = ["separate", "collapse", "auto"] + elseif prop == 'ruby-position' + let values = ["over", "under", "inter-character"] + elseif prop == 'scroll-behavior' + let values = ["auto", "smooth"] + elseif prop == 'scroll-snap-coordinate' + let values = ["none"] + elseif prop == 'scroll-snap-destination' + return [] + elseif prop == 'scroll-snap-points-\%(x\|y\)$' + let values = ["none", "repeat("] + elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$' + let values = ["none", "mandatory", "proximity"] + elseif prop == 'shape-image-threshold' + let values = [] + elseif prop == 'shape-margin' + let values = [] + elseif prop == 'shape-outside' + let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url('] + elseif prop == 'speak' + let values = ["auto", "none", "normal"] + elseif prop == 'speak-as' + let values = ["auto", "normal", "spell-out", "digits"] + elseif prop == 'src' + let values = ["url("] + elseif prop == 'suffix' + let values = [] + elseif prop == 'symbols' + let values = [] + elseif prop == 'system' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^extends' + let values = list_style_type_values + else + let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"] + endif + elseif prop == 'table-layout' + let values = ["auto", "fixed"] + elseif prop == 'tab-size' + let values = [] + elseif prop == 'text-align' + let values = ["start", "end", "left", "right", "center", "justify", "match-parent"] + elseif prop == 'text-align-last' + let values = ["auto", "start", "end", "left", "right", "center", "justify"] + elseif prop == 'text-combine-upright' + let values = ["none", "all", "digits"] + elseif prop == 'text-decoration-line' + let values = ["none", "underline", "overline", "line-through", "blink"] + elseif prop == 'text-decoration-color' + let values = color_values + elseif prop == 'text-decoration-style' + let values = ["solid", "double", "dotted", "dashed", "wavy"] + elseif prop == 'text-decoration' + let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values + elseif prop == 'text-emphasis-color' + let values = color_values + elseif prop == 'text-emphasis-position' + let values = ["over", "under", "left", "right"] + elseif prop == 'text-emphasis-style' + let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] + elseif prop == 'text-emphasis' + let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] + elseif prop == 'text-indent' + let values = ["hanging", "each-line"] + elseif prop == 'text-orientation' + let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"] + elseif prop == 'text-overflow' + let values = ["clip", "ellipsis"] + elseif prop == 'text-rendering' + let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"] + elseif prop == 'text-shadow' + let values = color_values + elseif prop == 'text-transform' + let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"] + elseif prop == 'text-underline-position' + let values = ["auto", "under", "left", "right"] + elseif prop == 'touch-action' + let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"] + elseif prop == 'transform' + let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("] + elseif prop == 'transform-box' + let values = ["border-box", "fill-box", "view-box"] + elseif prop == 'transform-origin' + let values = ["left", "center", "right", "top", "bottom"] + elseif prop == 'transform-style' + let values = ["flat", "preserve-3d"] + elseif prop == 'top' + let values = ["auto"] + elseif prop == 'transition-property' + let values = ["all", "none"] + s:values + elseif prop == 'transition-duration' + let values = [] + elseif prop == 'transition-delay' + let values = [] + elseif prop == 'transition-timing-function' + let values = timing_functions + elseif prop == 'transition' + let values = ["all", "none"] + s:values + timing_functions + elseif prop == 'unicode-bidi' + let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"] + elseif prop == 'unicode-range' + let values = ["U+"] + elseif prop == 'user-zoom' + let values = ["zoom", "fixed"] + elseif prop == 'vertical-align' + let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] + elseif prop == 'visibility' + let values = ["visible", "hidden", "collapse"] + elseif prop == 'voice-volume' + let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] + elseif prop == 'voice-balance' + let values = ["left", "center", "right", "leftwards", "rightwards"] + elseif prop == 'voice-family' + let values = [] + elseif prop == 'voice-rate' + let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"] + elseif prop == 'voice-pitch' + let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] + elseif prop == 'voice-range' + let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] + elseif prop == 'voice-stress' + let values = ["normal", "strong", "moderate", "none", "reduced "] + elseif prop == 'voice-duration' + let values = ["auto"] + elseif prop == 'white-space' + let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] + elseif prop == 'widows' + let values = [] + elseif prop == 'will-change' + let values = ["auto", "scroll-position", "contents"] + s:values + elseif prop == 'word-break' + let values = ["normal", "break-all", "keep-all"] + elseif prop == 'word-spacing' + let values = ["normal"] + elseif prop == 'word-wrap' + let values = ["normal", "break-word"] + elseif prop == 'writing-mode' + let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"] + elseif prop == 'z-index' + let values = ["auto"] + elseif prop == 'zoom' + let values = ["auto"] + else + " If no property match it is possible we are outside of {} and + " trying to complete pseudo-(class|element) + let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$')) + if stridx('a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,bgsound,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,element,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,main,map,mark,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,pre,progress,q,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr', ','.element.',') > -1 + let values = ["active", "any", "checked", "default", "dir(", "disabled", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "focus", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "not(", "nth-child(", "nth-last-child(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "read-only", "read-write", "required", "right", "root", "scope", "target", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"] + else + return [] + endif + endif + + let values = wide_keywords + values + " Complete values + let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$') + + for m in values + if m =~? '^'.entered_value + call add(res, m) + elseif m =~? entered_value + call add(res2, m) + endif + endfor + + return res + res2 + + elseif borders[max(keys(borders))] == 'closebrace' + + return [] + + elseif borders[max(keys(borders))] == 'exclam' + + " Complete values + let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$') + + let values = ["important"] + + for m in values + if m =~? '^'.entered_imp + call add(res, m) + endif + endfor + + return res + + elseif borders[max(keys(borders))] == 'atrule' + + let afterat = matchstr(line, '.*@\zs.*') + + if afterat =~ '\s' + + let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze') + + if atrulename == 'media' + let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$') + + if entered_atruleafter =~ "([^)]*$" + let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs[^)]*$') + let values = ["max-width", "min-width", "width", "max-height", "min-height", "height", "max-aspect-ration", "min-aspect-ration", "aspect-ratio", "orientation", "max-resolution", "min-resolution", "resolution", "scan", "grid", "update-frequency", "overflow-block", "overflow-inline", "max-color", "min-color", "color", "max-color-index", "min-color-index", "color-index", "monochrome", "inverted-colors", "pointer", "hover", "any-pointer", "any-hover", "light-level", "scripting"] + else + let values = ["screen", "print", "speech", "all", "not", "and", "("] + endif + + elseif atrulename == 'supports' + let entered_atruleafter = matchstr(line, '.*@supports\s\+\zs.*$') + + if entered_atruleafter =~ "([^)]*$" + let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs.*$') + let values = s:values + else + let values = ["("] + endif + + elseif atrulename == 'charset' + let entered_atruleafter = matchstr(line, '.*@charset\s\+\zs.*$') + let values = [ + \ '"UTF-8";', '"ANSI_X3.4-1968";', '"ISO_8859-1:1987";', '"ISO_8859-2:1987";', '"ISO_8859-3:1988";', '"ISO_8859-4:1988";', '"ISO_8859-5:1988";', + \ '"ISO_8859-6:1987";', '"ISO_8859-7:1987";', '"ISO_8859-8:1988";', '"ISO_8859-9:1989";', '"ISO-8859-10";', '"ISO_6937-2-add";', '"JIS_X0201";', + \ '"JIS_Encoding";', '"Shift_JIS";', '"Extended_UNIX_Code_Packed_Format_for_Japanese";', '"Extended_UNIX_Code_Fixed_Width_for_Japanese";', + \ '"BS_4730";', '"SEN_850200_C";', '"IT";', '"ES";', '"DIN_66003";', '"NS_4551-1";', '"NF_Z_62-010";', '"ISO-10646-UTF-1";', '"ISO_646.basic:1983";', + \ '"INVARIANT";', '"ISO_646.irv:1983";', '"NATS-SEFI";', '"NATS-SEFI-ADD";', '"NATS-DANO";', '"NATS-DANO-ADD";', '"SEN_850200_B";', '"KS_C_5601-1987";', + \ '"ISO-2022-KR";', '"EUC-KR";', '"ISO-2022-JP";', '"ISO-2022-JP-2";', '"JIS_C6220-1969-jp";', '"JIS_C6220-1969-ro";', '"PT";', '"greek7-old";', + \ '"latin-greek";', '"NF_Z_62-010_(1973)";', '"Latin-greek-1";', '"ISO_5427";', '"JIS_C6226-1978";', '"BS_viewdata";', '"INIS";', '"INIS-8";', + \ '"INIS-cyrillic";', '"ISO_5427:1981";', '"ISO_5428:1980";', '"GB_1988-80";', '"GB_2312-80";', '"NS_4551-2";', '"videotex-suppl";', '"PT2";', + \ '"ES2";', '"MSZ_7795.3";', '"JIS_C6226-1983";', '"greek7";', '"ASMO_449";', '"iso-ir-90";', '"JIS_C6229-1984-a";', '"JIS_C6229-1984-b";', + \ '"JIS_C6229-1984-b-add";', '"JIS_C6229-1984-hand";', '"JIS_C6229-1984-hand-add";', '"JIS_C6229-1984-kana";', '"ISO_2033-1983";', + \ '"ANSI_X3.110-1983";', '"T.61-7bit";', '"T.61-8bit";', '"ECMA-cyrillic";', '"CSA_Z243.4-1985-1";', '"CSA_Z243.4-1985-2";', '"CSA_Z243.4-1985-gr";', + \ '"ISO_8859-6-E";', '"ISO_8859-6-I";', '"T.101-G2";', '"ISO_8859-8-E";', '"ISO_8859-8-I";', '"CSN_369103";', '"JUS_I.B1.002";', '"IEC_P27-1";', + \ '"JUS_I.B1.003-serb";', '"JUS_I.B1.003-mac";', '"greek-ccitt";', '"NC_NC00-10:81";', '"ISO_6937-2-25";', '"GOST_19768-74";', '"ISO_8859-supp";', + \ '"ISO_10367-box";', '"latin-lap";', '"JIS_X0212-1990";', '"DS_2089";', '"us-dk";', '"dk-us";', '"KSC5636";', '"UNICODE-1-1-UTF-7";', '"ISO-2022-CN";', + \ '"ISO-2022-CN-EXT";', '"ISO-8859-13";', '"ISO-8859-14";', '"ISO-8859-15";', '"ISO-8859-16";', '"GBK";', '"GB18030";', '"OSD_EBCDIC_DF04_15";', + \ '"OSD_EBCDIC_DF03_IRV";', '"OSD_EBCDIC_DF04_1";', '"ISO-11548-1";', '"KZ-1048";', '"ISO-10646-UCS-2";', '"ISO-10646-UCS-4";', '"ISO-10646-UCS-Basic";', + \ '"ISO-10646-Unicode-Latin1";', '"ISO-10646-J-1";', '"ISO-Unicode-IBM-1261";', '"ISO-Unicode-IBM-1268";', '"ISO-Unicode-IBM-1276";', + \ '"ISO-Unicode-IBM-1264";', '"ISO-Unicode-IBM-1265";', '"UNICODE-1-1";', '"SCSU";', '"UTF-7";', '"UTF-16BE";', '"UTF-16LE";', '"UTF-16";', '"CESU-8";', + \ '"UTF-32";', '"UTF-32BE";', '"UTF-32LE";', '"BOCU-1";', '"ISO-8859-1-Windows-3.0-Latin-1";', '"ISO-8859-1-Windows-3.1-Latin-1";', + \ '"ISO-8859-2-Windows-Latin-2";', '"ISO-8859-9-Windows-Latin-5";', '"hp-roman8";', '"Adobe-Standard-Encoding";', '"Ventura-US";', + \ '"Ventura-International";', '"DEC-MCS";', '"IBM850";', '"PC8-Danish-Norwegian";', '"IBM862";', '"PC8-Turkish";', '"IBM-Symbols";', '"IBM-Thai";', + \ '"HP-Legal";', '"HP-Pi-font";', '"HP-Math8";', '"Adobe-Symbol-Encoding";', '"HP-DeskTop";', '"Ventura-Math";', '"Microsoft-Publishing";', + \ '"Windows-31J";', '"GB2312";', '"Big5";', '"macintosh";', '"IBM037";', '"IBM038";', '"IBM273";', '"IBM274";', '"IBM275";', '"IBM277";', '"IBM278";', + \ '"IBM280";', '"IBM281";', '"IBM284";', '"IBM285";', '"IBM290";', '"IBM297";', '"IBM420";', '"IBM423";', '"IBM424";', '"IBM437";', '"IBM500";', '"IBM851";', + \ '"IBM852";', '"IBM855";', '"IBM857";', '"IBM860";', '"IBM861";', '"IBM863";', '"IBM864";', '"IBM865";', '"IBM868";', '"IBM869";', '"IBM870";', '"IBM871";', + \ '"IBM880";', '"IBM891";', '"IBM903";', '"IBM904";', '"IBM905";', '"IBM918";', '"IBM1026";', '"EBCDIC-AT-DE";', '"EBCDIC-AT-DE-A";', '"EBCDIC-CA-FR";', + \ '"EBCDIC-DK-NO";', '"EBCDIC-DK-NO-A";', '"EBCDIC-FI-SE";', '"EBCDIC-FI-SE-A";', '"EBCDIC-FR";', '"EBCDIC-IT";', '"EBCDIC-PT";', '"EBCDIC-ES";', + \ '"EBCDIC-ES-A";', '"EBCDIC-ES-S";', '"EBCDIC-UK";', '"EBCDIC-US";', '"UNKNOWN-8BIT";', '"MNEMONIC";', '"MNEM";', '"VISCII";', '"VIQR";', '"KOI8-R";', + \ '"HZ-GB-2312";', '"IBM866";', '"IBM775";', '"KOI8-U";', '"IBM00858";', '"IBM00924";', '"IBM01140";', '"IBM01141";', '"IBM01142";', '"IBM01143";', + \ '"IBM01144";', '"IBM01145";', '"IBM01146";', '"IBM01147";', '"IBM01148";', '"IBM01149";', '"Big5-HKSCS";', '"IBM1047";', '"PTCP154";', '"Amiga-1251";', + \ '"KOI7-switched";', '"BRF";', '"TSCII";', '"windows-1250";', '"windows-1251";', '"windows-1252";', '"windows-1253";', '"windows-1254";', '"windows-1255";', + \ '"windows-1256";', '"windows-1257";', '"windows-1258";', '"TIS-620";'] + + elseif atrulename == 'namespace' + let entered_atruleafter = matchstr(line, '.*@namespace\s\+\zs.*$') + let values = ["url("] + + elseif atrulename == 'document' + let entered_atruleafter = matchstr(line, '.*@document\s\+\zs.*$') + let values = ["url(", "url-prefix(", "domain(", "regexp("] + + elseif atrulename == 'import' + let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$') + + if entered_atruleafter =~ "^[\"']" + let filestart = matchstr(entered_atruleafter, '^.\zs.*') + let files = split(glob(filestart.'*'), '\n') + let values = map(copy(files), '"\"".v:val') + + elseif entered_atruleafter =~ "^url(" + let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*") + let files = split(glob(filestart.'*'), '\n') + let values = map(copy(files), '"url(".v:val') + + else + let values = ['"', 'url('] + + endif + + else + return [] + + endif + + for m in values + if m =~? '^'.entered_atruleafter + if entered_atruleafter =~? '^"' && m =~? '^"' + let m = m[1:] + endif + if b:after =~? '"' && stridx(m, '"') > -1 + let m = m[0:stridx(m, '"')-1] + endif + call add(res, m) + elseif m =~? entered_atruleafter + if m =~? '^"' + let m = m[1:] + endif + call add(res2, m) + endif + endfor + + return res + res2 + + endif + + let values = ["charset", "page", "media", "import", "font-face", "namespace", "supports", "keyframes", "viewport", "document"] + + let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$') + + for m in values + if m =~? '^'.entered_atrule + call add(res, m .' ') + elseif m =~? entered_atrule + call add(res2, m .' ') + endif + endfor + + return res + res2 + + endif + + return [] endfunction diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim new file mode 100644 index 0000000000..81fdc9d956 --- /dev/null +++ b/runtime/autoload/dist/ft.vim @@ -0,0 +1,745 @@ +" Vim functions for file type detection +" +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2017 Dec 05 + +" These functions are moved here from runtime/filetype.vim to make startup +" faster. + +" Line continuation is used here, remove 'C' from 'cpoptions' +let s:cpo_save = &cpo +set cpo&vim + +func dist#ft#Check_inp() + if getline(1) =~ '^\*' + setf abaqus + else + let n = 1 + if line("$") > 500 + let nmax = 500 + else + let nmax = line("$") + endif + while n <= nmax + if getline(n) =~? "^header surface data" + setf trasys + break + endif + let n = n + 1 + endwhile + endif +endfunc + +" This function checks for the kind of assembly that is wanted by the user, or +" can be detected from the first five lines of the file. +func dist#ft#FTasm() + " make sure b:asmsyntax exists + if !exists("b:asmsyntax") + let b:asmsyntax = "" + endif + + if b:asmsyntax == "" + call dist#ft#FTasmsyntax() + endif + + " if b:asmsyntax still isn't set, default to asmsyntax or GNU + if b:asmsyntax == "" + if exists("g:asmsyntax") + let b:asmsyntax = g:asmsyntax + else + let b:asmsyntax = "asm" + endif + endif + + exe "setf " . fnameescape(b:asmsyntax) +endfunc + +func dist#ft#FTasmsyntax() + " see if file contains any asmsyntax=foo overrides. If so, change + " b:asmsyntax appropriately + let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). + \" ".getline(5)." " + let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s') + if match != '' + let b:asmsyntax = match + elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) + let b:asmsyntax = "vmasm" + endif +endfunc + +" Check if one of the first five lines contains "VB_Name". In that case it is +" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype. +func dist#ft#FTVB(alt) + if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' + setf vb + else + exe "setf " . a:alt + endif +endfunc + +func dist#ft#FTbtm() + if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm + setf dosbatch + else + setf btm + endif +endfunc + +func dist#ft#BindzoneCheck(default) + if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' + setf bindzone + elseif a:default != '' + exe 'setf ' . a:default + endif +endfunc + +func dist#ft#FTlpc() + if exists("g:lpc_syntax_for_c") + let lnum = 1 + while lnum <= 12 + if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)' + setf lpc + return + endif + let lnum = lnum + 1 + endwhile + endif + setf c +endfunc + +func dist#ft#FTheader() + if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 + if exists("g:c_syntax_for_h") + setf objc + else + setf objcpp + endif + elseif exists("g:c_syntax_for_h") + setf c + elseif exists("g:ch_syntax_for_h") + setf ch + else + setf cpp + endif +endfunc + +" This function checks if one of the first ten lines start with a '@'. In +" that case it is probably a change file. +" If the first line starts with # or ! it's probably a ch file. +" If a line has "main", "include", "//" ir "/*" it's probably ch. +" Otherwise CHILL is assumed. +func dist#ft#FTchange() + let lnum = 1 + while lnum <= 10 + if getline(lnum)[0] == '@' + setf change + return + endif + if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!') + setf ch + return + endif + if getline(lnum) =~ "MODULE" + setf chill + return + endif + if getline(lnum) =~ 'main\s*(\|#\s*include\|//' + setf ch + return + endif + let lnum = lnum + 1 + endwhile + setf chill +endfunc + +func dist#ft#FTent() + " This function checks for valid cl syntax in the first five lines. + " Look for either an opening comment, '#', or a block start, '{". + " If not found, assume SGML. + let lnum = 1 + while lnum < 6 + let line = getline(lnum) + if line =~ '^\s*[#{]' + setf cl + return + elseif line !~ '^\s*$' + " Not a blank line, not a comment, and not a block start, + " so doesn't look like valid cl code. + break + endif + let lnum = lnum + 1 + endw + setf dtd +endfunc + +func dist#ft#EuphoriaCheck() + if exists('g:filetype_euphoria') + exe 'setf ' . g:filetype_euphoria + else + setf euphoria3 + endif +endfunc + +func dist#ft#DtraceCheck() + let lines = getline(1, min([line("$"), 100])) + if match(lines, '^module\>\|^import\>') > -1 + " D files often start with a module and/or import statement. + setf d + elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1 + setf dtrace + else + setf d + endif +endfunc + +func dist#ft#FTe() + if exists('g:filetype_euphoria') + exe 'setf ' . g:filetype_euphoria + else + let n = 1 + while n < 100 && n < line("$") + if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" + setf specman + return + endif + let n = n + 1 + endwhile + setf eiffel + endif +endfunc + +" Distinguish between HTML, XHTML and Django +func dist#ft#FThtml() + let n = 1 + while n < 10 && n < line("$") + if getline(n) =~ '\<DTD\s\+XHTML\s' + setf xhtml + return + endif + if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+' + setf htmldjango + return + endif + let n = n + 1 + endwhile + setf html +endfunc + +" Distinguish between standard IDL and MS-IDL +func dist#ft#FTidl() + let n = 1 + while n < 50 && n < line("$") + if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' + setf msidl + return + endif + let n = n + 1 + endwhile + setf idl +endfunc + +" Distinguish between "default" and Cproto prototype file. */ +func dist#ft#ProtoCheck(default) + " Cproto files have a comment in the first line and a function prototype in + " the second line, it always ends in ";". Indent files may also have + " comments, thus we can't match comments to see the difference. + " IDL files can have a single ';' in the second line, require at least one + " chacter before the ';'. + if getline(2) =~ '.;$' + setf cpp + else + exe 'setf ' . a:default + endif +endfunc + +func dist#ft#FTm() + let n = 1 + let saw_comment = 0 " Whether we've seen a multiline comment leader. + while n < 100 + let line = getline(n) + if line =~ '^\s*/\*' + " /* ... */ is a comment in Objective C and Murphi, so we can't conclude + " it's either of them yet, but track this as a hint in case we don't see + " anything more definitive. + let saw_comment = 1 + endif + if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)' + setf objc + return + endif + if line =~ '^\s*%' + setf matlab + return + endif + if line =~ '^\s*(\*' + setf mma + return + endif + if line =~ '^\c\s*\(\(type\|var\)\>\|--\)' + setf murphi + return + endif + let n = n + 1 + endwhile + + if saw_comment + " We didn't see anything definitive, but this looks like either Objective C + " or Murphi based on the comment leader. Assume the former as it is more + " common. + setf objc + elseif exists("g:filetype_m") + " Use user specified default filetype for .m + exe "setf " . g:filetype_m + else + " Default is matlab + setf matlab + endif +endfunc + +func dist#ft#FTmms() + let n = 1 + while n < 10 + let line = getline(n) + if line =~ '^\s*\(%\|//\)' || line =~ '^\*' + setf mmix + return + endif + if line =~ '^\s*#' + setf make + return + endif + let n = n + 1 + endwhile + setf mmix +endfunc + +" This function checks if one of the first five lines start with a dot. In +" that case it is probably an nroff file: 'filetype' is set and 1 is returned. +func dist#ft#FTnroff() + if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' + setf nroff + return 1 + endif + return 0 +endfunc + +func dist#ft#FTmm() + let n = 1 + while n < 10 + let line = getline(n) + if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)' + setf objcpp + return + endif + let n = n + 1 + endwhile + setf nroff +endfunc + +func dist#ft#FTpl() + if exists("g:filetype_pl") + exe "setf " . g:filetype_pl + else + " recognize Prolog by specific text in the first non-empty line + " require a blank after the '%' because Perl uses "%list" and "%translate" + let l = getline(nextnonblank(1)) + if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' + setf prolog + else + setf perl + endif + endif +endfunc + +func dist#ft#FTinc() + if exists("g:filetype_inc") + exe "setf " . g:filetype_inc + else + let lines = getline(1).getline(2).getline(3) + if lines =~? "perlscript" + setf aspperl + elseif lines =~ "<%" + setf aspvbs + elseif lines =~ "<?" + setf php + else + call dist#ft#FTasmsyntax() + if exists("b:asmsyntax") + exe "setf " . fnameescape(b:asmsyntax) + else + setf pov + endif + endif + endif +endfunc + +func dist#ft#FTprogress_cweb() + if exists("g:filetype_w") + exe "setf " . g:filetype_w + return + endif + if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' + setf progress + else + setf cweb + endif +endfunc + +func dist#ft#FTprogress_asm() + if exists("g:filetype_i") + exe "setf " . g:filetype_i + return + endif + " This function checks for an assembly comment the first ten lines. + " If not found, assume Progress. + let lnum = 1 + while lnum <= 10 && lnum < line('$') + let line = getline(lnum) + if line =~ '^\s*;' || line =~ '^\*' + call dist#ft#FTasm() + return + elseif line !~ '^\s*$' || line =~ '^/\*' + " Not an empty line: Doesn't look like valid assembly code. + " Or it looks like a Progress /* comment + break + endif + let lnum = lnum + 1 + endw + setf progress +endfunc + +func dist#ft#FTprogress_pascal() + if exists("g:filetype_p") + exe "setf " . g:filetype_p + return + endif + " This function checks for valid Pascal syntax in the first ten lines. + " Look for either an opening comment or a program start. + " If not found, assume Progress. + let lnum = 1 + while lnum <= 10 && lnum < line('$') + let line = getline(lnum) + if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' + \ || line =~ '^\s*{' || line =~ '^\s*(\*' + setf pascal + return + elseif line !~ '^\s*$' || line =~ '^/\*' + " Not an empty line: Doesn't look like valid Pascal code. + " Or it looks like a Progress /* comment + break + endif + let lnum = lnum + 1 + endw + setf progress +endfunc + +func dist#ft#FTr() + let max = line("$") > 50 ? 50 : line("$") + + for n in range(1, max) + " Rebol is easy to recognize, check for that first + if getline(n) =~? '\<REBOL\>' + setf rebol + return + endif + endfor + + for n in range(1, max) + " R has # comments + if getline(n) =~ '^\s*#' + setf r + return + endif + " Rexx has /* comments */ + if getline(n) =~ '^\s*/\*' + setf rexx + return + endif + endfor + + " Nothing recognized, use user default or assume Rexx + if exists("g:filetype_r") + exe "setf " . g:filetype_r + else + " Rexx used to be the default, but R appears to be much more popular. + setf r + endif +endfunc + +func dist#ft#McSetf() + " Rely on the file to start with a comment. + " MS message text files use ';', Sendmail files use '#' or 'dnl' + for lnum in range(1, min([line("$"), 20])) + let line = getline(lnum) + if line =~ '^\s*\(#\|dnl\)' + setf m4 " Sendmail .mc file + return + elseif line =~ '^\s*;' + setf msmessages " MS Message text file + return + endif + endfor + setf m4 " Default: Sendmail .mc file +endfunc + +" Called from filetype.vim and scripts.vim. +func dist#ft#SetFileTypeSH(name) + if expand("<amatch>") =~ g:ft_ignore_pat + return + endif + if a:name =~ '\<csh\>' + " Some .sh scripts contain #!/bin/csh. + call dist#ft#SetFileTypeShell("csh") + return + elseif a:name =~ '\<tcsh\>' + " Some .sh scripts contain #!/bin/tcsh. + call dist#ft#SetFileTypeShell("tcsh") + return + elseif a:name =~ '\<zsh\>' + " Some .sh scripts contain #!/bin/zsh. + call dist#ft#SetFileTypeShell("zsh") + return + elseif a:name =~ '\<ksh\>' + let b:is_kornshell = 1 + if exists("b:is_bash") + unlet b:is_bash + endif + if exists("b:is_sh") + unlet b:is_sh + endif + elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' + let b:is_bash = 1 + if exists("b:is_kornshell") + unlet b:is_kornshell + endif + if exists("b:is_sh") + unlet b:is_sh + endif + elseif a:name =~ '\<sh\>' + let b:is_sh = 1 + if exists("b:is_kornshell") + unlet b:is_kornshell + endif + if exists("b:is_bash") + unlet b:is_bash + endif + endif + call dist#ft#SetFileTypeShell("sh") +endfunc + +" For shell-like file types, check for an "exec" command hidden in a comment, +" as used for Tcl. +" Also called from scripts.vim, thus can't be local to this script. +func dist#ft#SetFileTypeShell(name) + if expand("<amatch>") =~ g:ft_ignore_pat + return + endif + let l = 2 + while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' + " Skip empty and comment lines. + let l = l + 1 + endwhile + if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' + " Found an "exec" line after a comment with continuation + let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') + if n =~ '\<tclsh\|\<wish' + setf tcl + return + endif + endif + exe "setf " . a:name +endfunc + +func dist#ft#CSH() + if exists("g:filetype_csh") + call dist#ft#SetFileTypeShell(g:filetype_csh) + elseif &shell =~ "tcsh" + call dist#ft#SetFileTypeShell("tcsh") + else + call dist#ft#SetFileTypeShell("csh") + endif +endfunc + +let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' +func dist#ft#FTRules() + let path = expand('<amatch>:p') + if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$' + setf udevrules + return + endif + if path =~ '^/etc/ufw/' + setf conf " Better than hog + return + endif + if path =~ '^/\(etc\|usr/share\)/polkit-1/rules\.d' + setf javascript + return + endif + try + let config_lines = readfile('/etc/udev/udev.conf') + catch /^Vim\%((\a\+)\)\=:E484/ + setf hog + return + endtry + let dir = expand('<amatch>:p:h') + for line in config_lines + if line =~ s:ft_rules_udev_rules_pattern + let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") + if dir == udev_rules + setf udevrules + endif + break + endif + endfor + setf hog +endfunc + +func dist#ft#SQL() + if exists("g:filetype_sql") + exe "setf " . g:filetype_sql + else + setf sql + endif +endfunc + +" If the file has an extension of 't' and is in a directory 't' or 'xt' then +" it is almost certainly a Perl test file. +" If the first line starts with '#' and contains 'perl' it's probably a Perl +" file. +" (Slow test) If a file contains a 'use' statement then it is almost certainly +" a Perl file. +func dist#ft#FTperl() + let dirname = expand("%:p:h:t") + if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt') + setf perl + return 1 + endif + if getline(1)[0] == '#' && getline(1) =~ 'perl' + setf perl + return 1 + endif + let save_cursor = getpos('.') + call cursor(1,1) + let has_use = search('^use\s\s*\k', 'c', 30) + call setpos('.', save_cursor) + if has_use + setf perl + return 1 + endif + return 0 +endfunc + +" Choose context, plaintex, or tex (LaTeX) based on these rules: +" 1. Check the first line of the file for "%&<format>". +" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. +" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. +func dist#ft#FTtex() + let firstline = getline(1) + if firstline =~ '^%&\s*\a\+' + let format = tolower(matchstr(firstline, '\a\+')) + let format = substitute(format, 'pdf', '', '') + if format == 'tex' + let format = 'latex' + elseif format == 'plaintex' + let format = 'plain' + endif + elseif expand('%') =~ 'tex/context/.*/.*.tex' + let format = 'context' + else + " Default value, may be changed later: + let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' + " Save position, go to the top of the file, find first non-comment line. + let save_cursor = getpos('.') + call cursor(1,1) + let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) + if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. + let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' + let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>' + let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', + \ 'cnp', firstNC + 1000) + if kwline == 1 " lpat matched + let format = 'latex' + elseif kwline == 2 " cpat matched + let format = 'context' + endif " If neither matched, keep default set above. + " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) + " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) + " if cline > 0 + " let format = 'context' + " endif + " if lline > 0 && (cline == 0 || cline > lline) + " let format = 'tex' + " endif + endif " firstNC + call setpos('.', save_cursor) + endif " firstline =~ '^%&\s*\a\+' + + " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? + if format == 'plain' + setf plaintex + elseif format == 'context' + setf context + else " probably LaTeX + setf tex + endif + return +endfunc + +func dist#ft#FTxml() + let n = 1 + while n < 100 && n < line("$") + let line = getline(n) + " DocBook 4 or DocBook 5. + let is_docbook4 = line =~ '<!DOCTYPE.*DocBook' + let is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"' + if is_docbook4 || is_docbook5 + let b:docbk_type = "xml" + if is_docbook5 + let b:docbk_ver = 5 + else + let b:docbk_ver = 4 + endif + setf docbk + return + endif + if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"' + setf xbl + return + endif + let n += 1 + endwhile + setf xml +endfunc + +func dist#ft#FTy() + let n = 1 + while n < 100 && n < line("$") + let line = getline(n) + if line =~ '^\s*%' + setf yacc + return + endif + if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' + setf racc + return + endif + let n = n + 1 + endwhile + setf yacc +endfunc + +func dist#ft#Redif() + let lnum = 1 + while lnum <= 5 && lnum < line('$') + if getline(lnum) =~ "^\ctemplate-type:" + setf redif + return + endif + let lnum = lnum + 1 + endwhile +endfunc + + +" Restore 'cpoptions' +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim index d50bc2edc0..f64c5f199d 100644 --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -236,7 +236,7 @@ fun! getscript#GetLatestVimScripts() " call Decho("..depscript<".depscript.">") " found a "GetLatestVimScripts: # #" line in the script; - " check if its already in the datafile by searching backwards from llp1, + " check if it's already in the datafile by searching backwards from llp1, " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file, " for the script-id with no wrapping allowed. let curline = line(".") diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index 1245fdddc9..e4adec0947 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -1,6 +1,6 @@ " Vim autoload file for editing compressed files. " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2008 Jul 04 +" Last Change: 2016 Sep 28 " These functions are used by the gzip plugin. @@ -63,6 +63,9 @@ fun gzip#read(cmd) " set 'modifiable' let ma_save = &ma setlocal ma + " set 'write' + let write_save = &write + set write " Reset 'foldenable', otherwise line numbers get adjusted. if has("folding") let fen_save = &fen @@ -120,11 +123,14 @@ fun gzip#read(cmd) silent! exe "bwipe " . tmp_esc silent! exe "bwipe " . tmpe_esc endif + " Store the OK flag, so that we can use it when writing. + let b:uncompressOk = ok " Restore saved option values. let &pm = pm_save let &cpo = cpo_save let &l:ma = ma_save + let &write = write_save if has("folding") let &l:fen = fen_save endif @@ -146,8 +152,10 @@ endfun " After writing compressed file: Compress written file with "cmd" fun gzip#write(cmd) + if exists('b:uncompressOk') && !b:uncompressOk + echomsg "Not compressing file because uncompress failed; reset b:uncompressOk to compress anyway" " don't do anything if the cmd is not supported - if s:check(a:cmd) + elseif s:check(a:cmd) " Rename the file before compressing it. let nm = resolve(expand("<afile>")) let nmt = s:tempname(nm) diff --git a/runtime/autoload/javascriptcomplete.vim b/runtime/autoload/javascriptcomplete.vim index 2abe41b463..14bc3d7ce3 100644 --- a/runtime/autoload/javascriptcomplete.vim +++ b/runtime/autoload/javascriptcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Java Script " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Apr 30 +" Last Change: 2017 Mar 04 function! javascriptcomplete#CompleteJS(findstart, base) if a:findstart @@ -563,7 +563,7 @@ function! javascriptcomplete#CompleteJS(findstart, base) for i in arguments let g:ia = i let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))') - if len(f_elements) == 3 + if len(f_elements) >= 3 let b:js_menuinfo[f_elements[1].'('] = f_elements[2] endif endfor diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index d8d1857099..76485c2f38 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 13, 2014 -" Version: 152 +" Date: Apr 20, 2016 +" Version: 156 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -22,14 +22,15 @@ if &cp || exists("g:loaded_netrw") finish endif -if v:version < 704 || !has("patch213") +" netrw requires vim having patch 7.4.213; netrw will benefit from vim's having patch#656, too +if v:version < 704 || (v:version == 704 && !has("patch213")) if !exists("s:needpatch213") - echo "***sorry*** this version of netrw requires vim v7.4 with patch 213" + unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" endif let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v152" +let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -38,9 +39,9 @@ endif let s:keepcpo= &cpo setl cpo&vim -"let g:dechofuncname=1 +"let g:dechofuncname= 1 "DechoRemOn -"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) +"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("<slnum>")) " ====================== " Netrw Variables: {{{1 @@ -51,7 +52,10 @@ setl cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Apr 16, 2014 : max errnum currently is 97 +" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) +" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) +" (this function can optionally take a list of messages) +" Jan 19, 2016 : max errnum currently is 103 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -67,37 +71,50 @@ fun! netrw#ErrorMsg(level,msg,errnum) else let level= "**note** (netrw) " endif -" call Decho("level=".level) +" call Decho("level=".level,'~'.expand("<slnum>")) if g:netrw_use_errorwindow " (default) netrw creates a one-line window to show error/warning " messages (reliably displayed) - " record current window number for NetrwRestorePosn()'s benefit + " record current window number let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr) +" call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("<slnum>")) " getting messages out reliably is just plain difficult! " This attempt splits the current window, creating a one line window. if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer") +" call Decho("write to NetrwMessage buffer",'~'.expand("<slnum>")) exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro - keepj call setline(line("$")+1,level.a:msg) - keepj $ + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$")+1,level.a:msg) + endif + NetrwKeepj $ else -" call Decho("create a NetrwMessage buffer window") +" call Decho("create a NetrwMessage buffer window",'~'.expand("<slnum>")) bo 1split sil! call s:NetrwEnew() - sil! keepj call s:NetrwSafeOptions() + sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile - keepj file NetrwMessage -" call Decho("setl ma noro") + NetrwKeepj file NetrwMessage +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro - call setline(line("$"),level.a:msg) + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$"),level.a:msg) + endif + NetrwKeepj $ endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) +" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr(),'~'.expand("<slnum>")) if &fo !~ '[ta]' syn clear syn match netrwMesgNote "^\*\*note\*\*" @@ -106,7 +123,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) hi link netrwMesgWarning WarningMsg hi link netrwMesgError Error endif -" call Decho("setl noma ro bh=wipe") +" call Decho("setl noma ro bh=wipe",'~'.expand("<slnum>")) setl ro nomod noma bh=wipe else @@ -118,8 +135,16 @@ fun! netrw#ErrorMsg(level,msg,errnum) elseif a:level == s:ERROR echohl Error endif - echomsg level.a:msg -" call Decho("echomsg ***netrw*** ".a:msg) + + if type(a:msg) == 3 + for msg in a:msg + unsilent echomsg level.msg + endfor + else + unsilent echomsg level.a:msg + endif + +" call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("<slnum>")) echohl None endif @@ -127,10 +152,10 @@ fun! netrw#ErrorMsg(level,msg,errnum) endfun " --------------------------------------------------------------------- -" NetrwInit: initializes variables if they haven't been defined {{{2 +" s:NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) -" call Decho("varname<".a:varname."> value=".a:value) +" call Decho("varname<".a:varname."> value=".a:value,'~'.expand("<slnum>")) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value @@ -175,6 +200,13 @@ if !exists("g:netrw_fetch_cmd") let g:netrw_fetch_cmd = "" endif endif +if !exists("g:netrw_file_cmd") + if executable("elinks") + call s:NetrwInit("g:netrw_file_cmd","elinks") + elseif executable("links") + call s:NetrwInit("g:netrw_file_cmd","links") + endif +endif if !exists("g:netrw_ftp_cmd") let g:netrw_ftp_cmd = "ftp" endif @@ -203,6 +235,7 @@ if !exists("g:netrw_http_cmd") endif endif call s:NetrwInit("g:netrw_http_put_cmd","curl -T") +call s:NetrwInit("g:netrw_keepj","keepj") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") if !exists("g:netrw_scp_cmd") @@ -300,12 +333,20 @@ if !exists("g:netrw_list_cmd") " provide a pscp-based listing command let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" endif - let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + endif elseif executable(g:netrw_ssh_cmd) " provide a scp-based default listing command - let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + endif else -" call Decho("g:netrw_ssh_cmd." is not executable") +" call Decho(g:netrw_ssh_cmd." is not executable",'~'.expand("<slnum>")) let g:netrw_list_cmd= "" endif endif @@ -331,6 +372,19 @@ if !exists("g:netrw_localcopycmd") let g:netrw_localcopycmd= "" endif endif +if !exists("g:netrw_localcopydircmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= expand("$COMSPEC")." /c xcopy /e /c /h /i /k" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= "" + endif +endif if exists("g:netrw_local_mkdir") let g:netrw_localmkdir= g:netrw_local_mkdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) @@ -362,18 +416,20 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -if exists("g:netrw_local_rmdir") - let g:netrw_localrmdir= g:netrw_local_rmdir - call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) -endif -if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - call s:NetrwInit("g:netrw_localrmdir","rmdir") - else - let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" - endif -else - call s:NetrwInit("g:netrw_localrmdir","rmdir") +if v:version < 704 || !has("patch1109") + if exists("g:netrw_local_rmdir") + let g:netrw_localrmdir= g:netrw_local_rmdir + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) + endif + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + call s:NetrwInit("g:netrw_localrmdir","rmdir") + else + let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" + endif + else + call s:NetrwInit("g:netrw_localrmdir","rmdir") + endif endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks @@ -388,7 +444,7 @@ call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") @@ -399,6 +455,7 @@ else endif call s:NetrwInit("g:netrw_preview" , 0) call s:NetrwInit("g:netrw_scpport" , "-P") +call s:NetrwInit("g:netrw_servername" , "NETRWSERVER") call s:NetrwInit("g:netrw_sshport" , "-p") call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv") call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm") @@ -407,16 +464,20 @@ call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm " Default values - q-s ---------- {{{3 call s:NetrwInit("g:netrw_quickhelp",0) let s:QuickHelp= ["-:go up dir D:delete R:rename s:sort-by x:special", - \ "%:create new file d:create new directory", - \ "o:split&open v:vert-split&open", - \ "i:style qf:file info O:obtain r:reverse p:preview", - \ "mf:mark file mt:set target mm:move mc:copy", - \ "-bookmarks- mb:make mB:delete qb:list gb:go to", - \ "-history- qb:list u:go up U:go down", - \ "-targets- mt:target Tb:use bookmark Th:use history"] + \ "(create new) %:file d:directory", + \ "(windows split&open) o:horz v:vert p:preview", + \ "i:style qf:file info O:obtain r:reverse", + \ "(marks) mf:mark file mt:set target mm:move mc:copy", + \ "(bookmarks) mb:make mB:delete qb:list gb:go to", + \ "(history) qb:list u:go up U:go down", + \ "(targets) mt:target Tb:use bookmark Th:use history"] " g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>") -call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +if !exists("g:netrw_keepj") || g:netrw_keepj == "keepj" + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +else + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil " : " ") +endif call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size call s:NetrwInit("g:netrw_sort_options" , "") call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) @@ -429,7 +490,9 @@ if !exists("g:netrw_sort_sequence") endif call s:NetrwInit("g:netrw_special_syntax" , 0) call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') +call s:NetrwInit("g:netrw_suppress_gx_mesg", 1) call s:NetrwInit("g:netrw_use_noswf" , 1) +call s:NetrwInit("g:netrw_sizestyle" ,"b") " Default values - t-w ---------- {{{3 call s:NetrwInit("g:netrw_timefmt","%c") if !exists("g:netrw_xstrlen") @@ -446,6 +509,7 @@ endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) +call s:NetrwInit("g:netrw_wiw",1) if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 @@ -463,6 +527,7 @@ if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4' else let s:treedepthstring= "| " endif +call s:NetrwInit("s:netrw_nbcd",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -473,21 +538,28 @@ endif " Netrw Initialization: {{{1 " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") -" call Decho("installed beval events") +" call Decho("installed beval events",'~'.expand("<slnum>")) let &l:bexpr = "netrw#BalloonHelp()" au FileType netrw setl beval au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif au VimEnter * let s:initbeval= &beval "else " Decho -" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700") | endif -" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval") | endif -" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists") | endif -" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists") | endif -" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting") | endif -" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists") | endif +" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700","~".expand("<slnum>")) | endif +" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("<slnum>")) | endif +" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("<slnum>")) | endif +" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("<slnum>")) | endif +" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("<slnum>")) | endif +" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("<slnum>")) | endif endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif +if g:netrw_keepj =~# "keepj" + com! -nargs=* NetrwKeepj keepj <args> +else + let g:netrw_keepj= "" + com! -nargs=* NetrwKeepj <args> +endif + " ============================== " Netrw Utility Functions: {{{1 " ============================== @@ -495,7 +567,7 @@ au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif " --------------------------------------------------------------------- " netrw#BalloonHelp: {{{2 if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") -" call Decho("loading netrw#BalloonHelp()") +" call Decho("loading netrw#BalloonHelp()",'~'.expand("<slnum>")) fun! netrw#BalloonHelp() if &ft != "netrw" return "" @@ -507,7 +579,7 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ elseif getline(v:beval_lnum) =~ '^"\s*/' let mesg = "<cr>: edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" elseif v:beval_text == "Sorted" || v:beval_text == "by" - let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' + let mesg = 's: sort by name, time, file size, extension r: reverse sorting order mt: mark target' elseif v:beval_text == "Sort" || v:beval_text == "sequence" let mesg = "S: edit sorting sequence" elseif v:beval_text == "Hiding" || v:beval_text == "Showing" @@ -522,11 +594,11 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ return mesg endfun "else " Decho -" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -")|endif -" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval") |endif -" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled") |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on=".g:syntax_on) |endif -" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif +" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -","~".expand("<slnum>"))|endif +" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("<slnum>")) |endif +" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("<slnum>")) |endif +" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("<slnum>")) |endif +" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("<slnum>")) |endif endif " ------------------------------------------------------------------------ @@ -547,10 +619,11 @@ endif " == 4: Vexplore style == 5: Vexplore! " == 6: Texplore fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")." ft=".&ft) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>")) endif " record current file for Rexplore's benefit @@ -564,23 +637,24 @@ fun! netrw#Explore(indx,dosplit,style,...) if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) let curdir= substitute(curdir,'\','/','g') endif -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") +" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("<slnum>")) " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea) " will end up with backslashes here. Solution: strip off backslashes that precede white space and " try Explore again. if a:0 > 0 " call Decho('considering retry: a:1<'.a:1.'>: '. - \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. - \ ((filereadable(a:1))? 'is readable' : 'is not readable').', '. - \ ((isdirectory(a:1))? 'is a directory' : 'is not a directory')) - if a:1 =~ "\\\s" && !filereadable(a:1) && !isdirectory(a:1) -" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">") + \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. + \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '. + \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory', + \ '~'.expand("<slnum>")) + if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1)) +" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("<slnum>")) call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g')) " call Dret("netrw#Explore : returning from retry") return " else " Decho -" call Decho("retry not needed") +" call Decho("retry not needed",'~'.expand("<slnum>")) endif endif @@ -595,7 +669,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " -or- file has been modified AND file not hidden when abandoned " -or- Texplore used if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") +" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("<slnum>")) call s:SaveWinVars() let winsz= g:netrw_winsize if a:indx > 0 @@ -603,119 +677,119 @@ fun! netrw#Explore(indx,dosplit,style,...) endif if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore") +" call Decho("style=0: Explore or Sexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "noswapfile ".winsz."wincmd s" -" call Decho("exe noswapfile ".winsz."wincmd s") +" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!") +" call Decho("style=1: Explore! or Sexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore") +" call Decho("style=2: Hexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile bel ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!") +" call Decho("style=3: Hexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile abo ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore") +" call Decho("style=4: Vexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile lefta ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!") +" call Decho("style=5: Vexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile rightb ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 6 " Texplore call s:SaveBufVars() -" call Decho("style = 6: Texplore") +" call Decho("style = 6: Texplore",'~'.expand("<slnum>")) exe "keepalt tabnew ".fnameescape(curdir) -" call Decho("exe keepalt tabnew ".fnameescape(curdir)) +" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("<slnum>")) call s:RestoreBufVars() endif call s:RestoreWinVars() " else " Decho -" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") +" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("<slnum>")) endif - keepj norm! 0 + NetrwKeepj norm! 0 if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") +" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("<slnum>")) if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) -" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin") +" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("<slnum>")) let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)") +" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("<slnum>")) elseif a:1 == '.' -" call Decho("..case a:1<".a:1.">: matches .") +" call Decho("..case a:1<".a:1.">: matches .",'~'.expand("<slnum>")) let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) if dirname !~ '/$' let dirname= dirname."/" endif -" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") +" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("<slnum>")) elseif a:1 =~ '\$' -" call Decho("..case a:1<".a:1.">: matches ending $") +" call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("<slnum>")) let dirname= simplify(expand(a:1)) -" call Decho("..using user-specified dirname<".dirname."> with $env-var") +" call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("<slnum>")) elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' -" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern") +" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("<slnum>")) let dirname= simplify(a:1) -" call Decho("..using user-specified dirname<".dirname.">") +" call Decho("..using user-specified dirname<".dirname.">",'~'.expand("<slnum>")) else -" call Decho("..case a:1: pattern or filepattern") +" call Decho("..case a:1: pattern or filepattern",'~'.expand("<slnum>")) let dirname= a:1 endif else " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list") +" call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("<slnum>")) call s:NetrwClearExplore() " call Dret("netrw#Explore : cleared list") return endif -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) if dirname =~ '\.\./\=$' let dirname= simplify(fnamemodify(dirname,':p:h')) elseif dirname =~ '\.\.' || dirname == '.' let dirname= simplify(fnamemodify(dirname,':p')) endif -" call Decho("dirname<".dirname."> (after simplify)") +" call Decho("dirname<".dirname."> (after simplify)",'~'.expand("<slnum>")) if dirname =~ '^\*//' " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case starpat=1: Explore *//pattern") +" call Decho("case starpat=1: Explore *//pattern",'~'.expand("<slnum>")) let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') let starpat= 1 -" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>")) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif dirname =~ '^\*\*//' " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case starpat=2: Explore **//pattern") +" call Decho("case starpat=2: Explore **//pattern",'~'.expand("<slnum>")) let pattern= substitute(dirname,'^\*\*//','','') let starpat= 2 -" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>")) elseif dirname =~ '/\*\*/' " handle .../**/.../filepat -" call Decho("case starpat=4: Explore .../**/.../filepat") +" call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("<slnum>")) let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) let b:netrw_curdir = prefixdir @@ -724,39 +798,38 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') let starpat= 4 -" call Decho("..pwd<".getcwd()."> dirname<".dirname.">") -" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")") +" call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("<slnum>")) elseif dirname =~ '^\*/' " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) let starpat= 3 -" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")") +" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("<slnum>")) elseif dirname=~ '^\*\*/' " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) let starpat= 4 -" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")") +" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("<slnum>")) else let starpat= 0 -" call Decho("case starpat=0: default") +" call Decho("case starpat=0: default",'~'.expand("<slnum>")) endif if starpat == 0 && a:indx >= 0 " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore") +" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("<slnum>")) if dirname == "" let dirname= curfiledir -" call Decho("..empty dirname, using current file's directory<".dirname.">") +" call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("<slnum>")) endif - if dirname =~ '^scp://' || dirname =~ '^ftp://' + if dirname =~# '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) - "call s:NetrwBrowse(0,dirname) else if dirname == "" let dirname= getcwd() elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin - " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', + " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', " depending on whether backslashes have been converted to forward slashes by earlier code). if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+' let dirname= b:netrw_curdir."/".dirname @@ -764,9 +837,10 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif dirname !~ '^/' let dirname= b:netrw_curdir."/".dirname endif -" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)") +" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("<slnum>")) call netrw#LocalBrowseCheck(dirname) -" call Decho("win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) endif if exists("w:netrw_bannercnt") " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. @@ -774,13 +848,13 @@ fun! netrw#Explore(indx,dosplit,style,...) exe w:netrw_bannercnt endif -" call Decho("curdir<".curdir.">") +" call Decho("curdir<".curdir.">",'~'.expand("<slnum>")) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") -" keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') " else -" keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') " endif " --------------------------------------------------------------------- @@ -790,28 +864,28 @@ fun! netrw#Explore(indx,dosplit,style,...) " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) elseif a:indx <= 0 " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx) +" call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx,'~'.expand("<slnum>")) if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir") -" call Decho("..set up <s-up> and <s-down> maps") +" call Decho("..set up <s-up> and <s-down> maps",'~'.expand("<slnum>")) let s:didstarstar= 1 nnoremap <buffer> <silent> <s-up> :Pexplore<cr> nnoremap <buffer> <silent> <s-down> :Nexplore<cr> endif if has("path_extra") -" call Decho("..starpat=".starpat.": has +path_extra") +" call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("<slnum>")) if !exists("w:netrw_explore_indx") let w:netrw_explore_indx= 0 endif let indx = a:indx -" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]") +" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("<slnum>")) if indx == -1 " Nexplore -" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -824,19 +898,19 @@ fun! netrw#Explore(indx,dosplit,style,...) if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>")) while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] let indx= indx + 1 -" call Decho("....indx=".indx." (Nexplore while loop)") +" call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("<slnum>")) endwhile if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif -" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>")) elseif indx == -2 " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -849,32 +923,32 @@ fun! netrw#Explore(indx,dosplit,style,...) if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>")) while indx >= 0 && curfile == w:netrw_explore_list[indx] let indx= indx - 1 -" call Decho("....indx=".indx." (Pexplore while loop)") +" call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("<slnum>")) endwhile if indx < 0 | let indx= 0 | endif -" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>")) else " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore -" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") - keepj keepalt call s:NetrwClearExplore() +" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("<slnum>")) + NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() endif -" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) " switch on starpat to build the w:netrw_explore_list of files if starpat == 1 " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("<slnum>")) +" call Decho("....pattern<".pattern.">",'~'.expand("<slnum>")) try - exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) " call Dret("netrw#Explore : unable to find pattern<".pattern.">") @@ -885,10 +959,10 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif starpat == 2 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("<slnum>")) +" call Decho("....pattern<".pattern.">",'~'.expand("<slnum>")) try - exe "sil keepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" + exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif @@ -907,27 +981,27 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif starpat == 3 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>")) let filepat= substitute(dirname,'^\*/','','') let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("....b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("....filepat<".filepat.">") +" call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) +" call Decho("....filepat<".filepat.">",'~'.expand("<slnum>")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif elseif starpat == 4 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif endif " switch on starpat to build w:netrw_explore_list let w:netrw_explore_listlen = len(w:netrw_explore_list) -" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">") -" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("<slnum>")) +" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("<slnum>")) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - keepalt keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -940,41 +1014,41 @@ fun! netrw#Explore(indx,dosplit,style,...) " NetrwStatusLine support - for exploring support let w:netrw_explore_indx= indx -" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("<slnum>")) " wrap the indx around, but issue a note if indx >= w:netrw_explore_listlen || indx < 0 -" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") +" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("<slnum>")) let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx - keepalt keepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") +" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("<slnum>")) let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("....newdir<".newdir.">") +" call Decho("....newdir<".newdir.">",'~'.expand("<slnum>")) -" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)") +" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("<slnum>")) call netrw#LocalBrowseCheck(newdir) if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle endif if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepalt keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") else - keepalt keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + keepalt NetrwKeepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") endif let w:netrw_explore_mtchcnt = indx + 1 let w:netrw_explore_bufnr = bufnr("%") let w:netrw_explore_line = line(".") - keepalt keepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') -" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) + keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') +" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line,'~'.expand("<slnum>")) else -" call Decho("..your vim does not have +path_extra") +" call Decho("..your vim does not have +path_extra",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") - keepalt keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif if has("clipboard") sil! let @* = keepregstar @@ -986,27 +1060,27 @@ fun! netrw#Explore(indx,dosplit,style,...) endif else -" call Decho("..default case: Explore newdir<".dirname.">") +" call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' sil! unlet w:netrw_treedict sil! unlet w:netrw_treetop endif let newdir= dirname if !exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(getcwd()) + NetrwKeepj call netrw#LocalBrowseCheck(getcwd()) else - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) endif endif " visual display of **/ **// */ Exploration files -" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") +" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("<slnum>")) if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) +" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("<slnum>")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir " only update match list when current directory isn't the same as before -" call Decho("only update match list when current directory not the same as before") +" call Decho("only update match list when current directory not the same as before",'~'.expand("<slnum>")) let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" let dirlen = strlen(b:netrw_curdir) @@ -1015,7 +1089,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let prvfname= "" for fname in w:netrw_explore_list -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) if fname =~ '^'.b:netrw_curdir if s:explore_match == "" let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' @@ -1031,7 +1105,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let prvfname= fname endfor -" call Decho("explore_match<".s:explore_match.">") +" call Decho("explore_match<".s:explore_match.">",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:explore_match."/" endif echo "<s-up>==Pexplore <s-down>==Nexplore" @@ -1040,7 +1114,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if exists("s:explore_match") | unlet s:explore_match | endif if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif echo " " -" call Decho("cleared explore match list") +" call Decho("cleared explore match list",'~'.expand("<slnum>")) endif " since Explore may be used to initialize netrw's browser, @@ -1057,50 +1131,101 @@ endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 -fun! netrw#Lexplore(...) -" call Dfunc("netrw#Lexplore() a:0=".a:0) +fun! netrw#Lexplore(count,rightside,...) +" call Dfunc("netrw#Lexplore(count=".a:count."rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) + let curwin= winnr() + if a:0 > 0 && a:1 != "" " if a netrw window is already on the left-side of the tab " and a directory has been specified, explore with that " directory. - let lexwinnr= winnr() + let a1 = expand(a:1) +" call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("<slnum>")) exe "1wincmd w" if &ft == "netrw" - exe "Explore ".fnameescape(a:1) - exe lexwinnr."wincmd w" +" call Decho("exe Explore ".fnameescape(a:1),'~'.expand("<slnum>")) + exe "Explore ".fnameescape(a1) + exe curwin."wincmd w" + if exists("t:netrw_lexposn") +" call Decho("forgetting t:netrw_lexposn",'~'.expand("<slnum>")) + unlet t:netrw_lexposn + endif +" call Dret("netrw#Lexplore") + return endif - exe lexwinnr."wincmd w" -" call Dret("netrw#Lexplore") - return + exe curwin."wincmd w" + else + let a1= "" endif if exists("t:netrw_lexbufnr") - " close down netrw explorer window + " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) - if lexwinnr != -1 - let curwin = winnr() - exe lexwinnr."wincmd w" - close - exe curwin."wincmd w" - endif + else + let lexwinnr= 0 + endif + + if lexwinnr > 0 + " close down netrw explorer window +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) + exe lexwinnr."wincmd w" + let g:netrw_winsize = -winwidth(0) + let t:netrw_lexposn = winsaveview() +" call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) +" call Decho("saving t:netrw_lexposn",'~'.expand("<slnum>")) + close + if lexwinnr < curwin + let curwin= curwin - 1 + endif + exe curwin."wincmd w" unlet t:netrw_lexbufnr else " open netrw explorer window +" call Decho("t:netrw_lexbufnr<n/a>: open netrw explorer window",'~'.expand("<slnum>")) exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 - if a:0 > 0 && a:1 != "" - exe "Vexplore ".fnameescape(a:1) + if a:count != 0 + let netrw_winsize = g:netrw_winsize + let g:netrw_winsize = a:count + endif + let curfile= expand("%") +" call Decho("curfile<".curfile.">",'~'.expand("<slnum>")) + exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" + if a:0 > 0 && a1 != "" +" call Decho("case 1: Explore ".a1,'~'.expand("<slnum>")) + exe "Explore ".fnameescape(a1) + elseif curfile =~ '^\a\{3,}://' +" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("<slnum>")) + exe "Explore ".substitute(curfile,'[^/\\]*$','','') else - Vexplore . +" call Decho("case 3: Explore .",'~'.expand("<slnum>")) + Explore . + endif + if a:count != 0 + let g:netrw_winsize = netrw_winsize endif + setlocal winfixwidth let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") + if exists("t:netrw_lexposn") +" call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>")) +" call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) + call winrestview(t:netrw_lexposn) + unlet t:netrw_lexposn + endif endif + + " set up default window for editing via <cr> if exists("g:netrw_chgwin") && g:netrw_chgwin == -1 - let g:netrw_chgwin= 2 + if a:rightside + let g:netrw_chgwin= 1 + else + let g:netrw_chgwin= 2 + endif endif + " call Dret("netrw#Lexplore") endfun @@ -1116,14 +1241,14 @@ fun! netrw#Clean(sys) else let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") endif -" call Decho("choice=".choice) +" call Decho("choice=".choice,'~'.expand("<slnum>")) let diddel= 0 let diddir= "" if choice == 1 for dir in split(&rtp,',') if filereadable(dir."/plugin/netrwPlugin.vim") -" call Decho("removing netrw-related files from ".dir) +" call Decho("removing netrw-related files from ".dir,'~'.expand("<slnum>")) if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif @@ -1155,9 +1280,10 @@ endfun fun! netrw#MakeTgt(dname) " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) - let svpos = netrw#SavePosn() - let s:netrwmftgt_islocal= (a:dname !~ '^\a\+://') -" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal) + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') +" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>")) if s:netrwmftgt_islocal let netrwmftgt= simplify(a:dname) else @@ -1170,9 +1296,10 @@ fun! netrw#MakeTgt(dname) let s:netrwmftgt= netrwmftgt endif if g:netrw_fastbrowse <= 1 - call s:NetrwRefresh((b:netrw_curdir !~ '\a\+://'),b:netrw_curdir) + call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) endif - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))" + call winrestview(svpos) " call Dret("netrw#MakeTgt") endfun @@ -1196,40 +1323,40 @@ fun! netrw#Obtain(islocal,fname,...) " call Dret("netrw#Obtain") return endif -" call Decho("fnamelist<".string(fnamelist).">") +" call Decho("fnamelist<".string(fnamelist).">",'~'.expand("<slnum>")) if a:0 > 0 let tgtdir= a:1 else let tgtdir= getcwd() endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>")) if exists("b:netrw_islocal") && b:netrw_islocal " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>")) if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir let topath= s:ComposePath(tgtdir,"") if (has("win32") || has("win95") || has("win64") || has("win16")) " transfer files one at time -" call Decho("transfer files one at a time") +" call Decho("transfer files one at a time",'~'.expand("<slnum>")) for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) +" call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) + call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) return endif endfor else " transfer files with one command -" call Decho("transfer files with one command") - let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) +" call Decho("transfer files with one command",'~'.expand("<slnum>")) + let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) +" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) + call system(g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) return endif endif @@ -1241,7 +1368,7 @@ fun! netrw#Obtain(islocal,fname,...) else " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>")) if type(a:fname) == 1 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) endif @@ -1249,7 +1376,7 @@ fun! netrw#Obtain(islocal,fname,...) if b:netrw_method == 4 " obtain file using scp -" call Decho("obtain via scp (method#4)") +" call Decho("obtain via scp (method#4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -1260,40 +1387,37 @@ fun! netrw#Obtain(islocal,fname,...) else let path= "" endif - let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) + let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() +" call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("<slnum>")) + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("b:netrw_fname") && b:netrw_fname != "" call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in fnamelist call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -1305,82 +1429,80 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) -" call Decho("obtain via ftp+mipf (method #3)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() +" call Decho("obtain via ftp+mipf (method #3)",'~'.expand("<slnum>")) + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_uid +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in fnamelist - keepj call setline(line("$")+1,'get "'.fname.'"') + NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif elseif b:netrw_method == 9 " obtain file using sftp -" call Decho("obtain via sftp (method #9)") +" call Decho("obtain via sftp (method #9)",'~'.expand("<slnum>")) if a:fname =~ '/' let localfile= substitute(a:fname,'^.*/','','') else let localfile= a:fname endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized @@ -1390,7 +1512,7 @@ fun! netrw#Obtain(islocal,fname,...) else " protocol recognized but not supported for Obtain (yet?) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) endif " call Dret("netrw#Obtain : current protocol not supported for obtaining file") return @@ -1398,7 +1520,7 @@ fun! netrw#Obtain(islocal,fname,...) " restore status line if type(a:fname) == 1 && exists("s:netrw_users_stl") - keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) + NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl) endif endif @@ -1419,9 +1541,11 @@ endfun " netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2 fun! netrw#Nread(mode,fname) " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") - call netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call netrw#NetRead(a:mode,a:fname) - call netrw#RestorePosn() +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST if exists("w:netrw_bannercnt") @@ -1436,19 +1560,11 @@ endfun " s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2 fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) - unlet s:nbcd_curpos_{bufnr('%')} - else -" call Decho("no previous position") - endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + call s:RestorePosn(s:netrw_nbcd) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif @@ -1456,7 +1572,7 @@ fun! s:NetrwOptionRestore(vt) if exists("+acd") if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep @@ -1467,9 +1583,6 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif - if g:netrw_liststyle != s:TREELIST - if exists("{a:vt}netrw_bhkeep") |let &l:bh = {a:vt}netrw_bhkeep |unlet {a:vt}netrw_bhkeep |endif - endif if exists("{a:vt}netrw_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif @@ -1481,7 +1594,9 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif - if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + if exists("g:netrw_ffkep") && g:netrw_ffkeep + if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + endif if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif @@ -1517,12 +1632,14 @@ fun! s:NetrwOptionRestore(vt) setl directory= unlet {a:vt}netrw_swfkeep elseif &l:swf != {a:vt}netrw_swfkeep - " following line causes a Press ENTER in windows -- can't seem to work around it!!! - sil! let &l:swf= {a:vt}netrw_swfkeep + if !g:netrw_use_noswf + " following line causes a Press ENTER in windows -- can't seem to work around it!!! + sil! let &l:swf= {a:vt}netrw_swfkeep + endif unlet {a:vt}netrw_swfkeep endif endif - if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir + if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') if exists("{a:vt}netrw_dirkeep") call s:NetrwLcd(dirkeep) @@ -1533,30 +1650,21 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) - if exists("s:nbcd_curpos_".bufnr('%')) - unlet s:nbcd_curpos_{bufnr('%')} - endif - else -" call Decho("no previous position") - endif + call s:RestorePosn(s:netrw_nbcd) -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) -" call Decho("ts=".&l:ts) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ts=".&l:ts,'~'.expand("<slnum>")) " Moved the filetype detect here from NetrwGetFile() because remote files " were having their filetype detect-generated settings overwritten by " NetrwOptionRestore. if &ft != "netrw" -" call Decho("filetype detect (ft=".&ft.")") +" call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>")) filetype detect endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -1570,8 +1678,8 @@ endfun " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) -" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 @@ -1579,10 +1687,10 @@ fun! s:NetrwOptionSave(vt) " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("<slnum>")) " Save current settings and current directory -" call Decho("saving current settings and current directory") +" call Decho("saving current settings and current directory",'~'.expand("<slnum>")) let s:yykeep = @@ if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif let {a:vt}netrw_aikeep = &l:ai @@ -1599,7 +1707,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_cpokeep = &l:cpo let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen - if !exists("g:netrw_ffkeep") || g:netrw_ffkeep == 1 + if !exists("g:netrw_ffkeep") || g:netrw_ffkeep let {a:vt}netrw_ffkeep = &l:ff endif let {a:vt}netrw_fokeep = &l:fo " formatoptions @@ -1617,11 +1725,11 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell - if g:netrw_use_noswf - let {a:vt}netrw_swfkeep = &l:swf + if !g:netrw_use_noswf + let {a:vt}netrw_swfkeep = &l:swf endif if has("clipboard") - let {a:vt}netrw_starkeep = @* + let {a:vt}netrw_starkeep = @* endif let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth @@ -1630,7 +1738,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_writekeep = &l:write " save a few selected netrw-related variables -" call Decho("saving a few selected netrw-related variables") +" call Decho("saving a few selected netrw-related variables",'~'.expand("<slnum>")) if g:netrw_keepdir let {a:vt}netrw_dirkeep = getcwd() endif @@ -1639,7 +1747,7 @@ fun! s:NetrwOptionSave(vt) endif sil! let {a:vt}netrw_regslash= @/ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun @@ -1649,8 +1757,8 @@ endfun " Use s:NetrwOptionRestore() to restore user settings fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) -" call Decho("win#".winnr()."'s ft=".&ft) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) if exists("+acd") | setl noacd | endif setl noai setl noaw @@ -1659,9 +1767,7 @@ fun! s:NetrwSafeOptions() setl bt=nofile setl noci setl nocin - if g:netrw_liststyle == s:TREELIST - setl bh=hide - endif + setl bh=hide setl cino= setl com= setl cpo-=a @@ -1683,14 +1789,14 @@ fun! s:NetrwSafeOptions() call s:NetrwCursor() " allow the user to override safe options -" call Decho("ft<".&ft."> ei=".&ei) +" call Decho("ft<".&ft."> ei=".&ei,'~'.expand("<slnum>")) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds (doau FileType netrw)") - sil! keepalt keepj doau FileType netrw +" call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("<slnum>")) + sil! keepalt NetrwKeepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwSafeOptions") endfun @@ -1744,6 +1850,10 @@ fun! netrw#NetRead(mode,...) call s:NetrwOptionSave("w:") call s:NetrwSafeOptions() call s:RestoreCursorline() + " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. + " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. + setl bl +" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("<slnum>")) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1759,7 +1869,7 @@ fun! netrw#NetRead(mode,...) let readcmd = "r" endif let ichoice = (a:0 == 0)? 0 : 1 -" call Decho("readcmd<".readcmd."> ichoice=".ichoice) +" call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("<slnum>")) " NetRead: get temporary filename {{{3 let tmpfile= s:GetTempfile("") @@ -1772,13 +1882,13 @@ fun! netrw#NetRead(mode,...) " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">") +" call Decho("no lastfile: choice<" . choice . ">",'~'.expand("<slnum>")) if match(choice,"?") == 0 " give help @@ -1790,6 +1900,7 @@ fun! netrw#NetRead(mode,...) echomsg ':Nread fetch://machine/path uses fetch' echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' echomsg ':Nread http://[user@]machine/path uses http wget' + echomsg ':Nread file:///path uses elinks' echomsg ':Nread https://[user@]machine/path uses http wget' echomsg ':Nread rcp://[user@]machine/path uses rcp' echomsg ':Nread rsync://machine[:port]/path uses rsync' @@ -1800,7 +1911,7 @@ fun! netrw#NetRead(mode,...) elseif match(choice,'^"') != -1 " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice") +" call Decho("reconstructing choice",'~'.expand("<slnum>")) if match(choice,'"$') != -1 " case "..." let choice= strpart(choice,1,strlen(choice)-2) @@ -1826,7 +1937,7 @@ fun! netrw#NetRead(mode,...) endif endif -" call Decho("choice<" . choice . ">") +" call Decho("choice<" . choice . ">",'~'.expand("<slnum>")) let ichoice= ichoice + 1 " NetRead: Determine method of read (ftp, rcp, etc) {{{3 @@ -1838,10 +1949,10 @@ fun! netrw#NetRead(mode,...) let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix " Check whether or not NetrwBrowse() should be handling this request -" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") +" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">",'~'.expand("<slnum>")) if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' -" call Decho("yes, choice matches '^.*[\/]$'") - keepj call s:NetrwBrowse(0,choice) +" call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return endif @@ -1856,7 +1967,7 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rcp) NetRead Method #1 {{{3 if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)") +" call Decho("read via rcp (method #1)",'~'.expand("<slnum>")) " ER: nothing done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile " ER: when machine contains '.' adding .user is required (use $USERNAME) @@ -1875,43 +1986,40 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)") +" call Decho("read via ftp+.netrc (method #2)",'~'.expand("<slnum>")) let netrw_fname= b:netrw_fname - keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline(line("$"))) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline(line("$"))) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) endif call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep = &debug setl debug=msg - keepj call netrw#ErrorMsg(s:ERROR,getline(1),4) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug = debugkeep endif call s:SaveBufVars() - bd! + keepj bd! if bufname("%") == "" && getline("$") == "" && line('$') == 1 " needed when one sources a file in a nolbl setting window via ftp q! @@ -1924,80 +2032,85 @@ fun! netrw#NetRead(mode,...) " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_uid +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif - keepj put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif - call s:SaveBufVars()|bd!|call s:RestoreBufVars() + call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars() let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (scp) NetRead Method #4 {{{3 elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)") +" call Decho("read via scp (method #4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else let useport= "" endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + " 'C' in 'C:\path\to\file' is handled as hostname on windows. + " This is workaround to avoid mis-handle windows local-path: + if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16")) + let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '') + else + let tmpfile_get = tmpfile + endif + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (http) NetRead Method #5 (wget) {{{3 elseif b:netrw_method == 5 -" call Decho("read via http (method #5)") +" call Decho("read via http (method #5)",'~'.expand("<slnum>")) if g:netrw_http_cmd == "" if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) @@ -2008,37 +2121,34 @@ fun! netrw#NetRead(mode,...) if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) -" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") +" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("<slnum>")) if exists("g:netrw_http_xcmd") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1)) else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) else " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) -" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)") +" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)",'~'.expand("<slnum>")) let netrw_html= substitute(b:netrw_fname,"#.*$","","") let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">") -" call Decho("netrw_tag <".netrw_tag.">") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1) +" call Decho("netrw_html<".netrw_html.">",'~'.expand("<slnum>")) +" call Decho("netrw_tag <".netrw_tag.">",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') - exe 'keepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>" +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("<slnum>")) + exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>" endif let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("<slnum>")) setl ro nomod "......................................... " NetRead: (dav) NetRead Method #6 {{{3 elseif b:netrw_method == 6 -" call Decho("read via cadaver (method #6)") +" call Decho("read via cadaver (method #6)",'~'.expand("<slnum>")) if !executable(g:netrw_dav_cmd) call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) @@ -2046,29 +2156,27 @@ fun! netrw#NetRead(mode,...) return endif if g:netrw_dav_cmd =~ "curl" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".s:ShellEscape("dav://".g:netrw_machine.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) else " Construct execution string (four lines) which will be passed through filter let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) new setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd endif - keepj put ='get '.netrw_fname.' '.tmpfile - keepj put ='quit' + NetrwKeepj put ='get '.netrw_fname.' '.tmpfile + NetrwKeepj put ='quit' " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) + keepj bd! endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2076,9 +2184,8 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("read via rsync (method #7)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) +" call Decho("read via rsync (method #7)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2086,10 +2193,10 @@ fun! netrw#NetRead(mode,...) " NetRead: (fetch) NetRead Method #8 {{{3 " fetch://[user@]host[:http]/path elseif b:netrw_method == 8 -" call Decho("read via fetch (method #8)") +" call Decho("read via fetch (method #8)",'~'.expand("<slnum>")) if g:netrw_fetch_cmd == "" if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) endif " call Dret("NetRead") return @@ -2099,30 +2206,35 @@ fun! netrw#NetRead(mode,...) else let netrw_option= "ftp" endif -" call Decho("read via fetch for ".netrw_option) +" call Decho("read via fetch for ".netrw_option,'~'.expand("<slnum>")) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("<slnum>")) setl ro nomod "......................................... " NetRead: (sftp) NetRead Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile +" call Decho("read via sftp (method #9)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice + "......................................... + " NetRead: (file) NetRead Method #10 {{{3 + elseif b:netrw_method == 10 && exists("g:netrw_file_cmd") +" " call Decho("read via ".b:netrw_file_cmd." (method #10)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".s:ShellEscape(b:netrw_fname,1)." ".tmpfile) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + "......................................... " NetRead: Complain {{{3 else @@ -2132,15 +2244,15 @@ fun! netrw#NetRead(mode,...) " NetRead: cleanup {{{3 if exists("b:netrw_method") -" call Decho("cleanup b:netrw_method and b:netrw_fname") +" call Decho("cleanup b:netrw_method and b:netrw_fname",'~'.expand("<slnum>")) unlet b:netrw_method unlet b:netrw_fname endif if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' -" call Decho("cleanup by deleting tmpfile<".tmpfile.">") - keepj call s:NetrwDelete(tmpfile) +" call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwDelete(tmpfile) endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Dret("netrw#NetRead :5 getcwd<".getcwd().">") endfun @@ -2169,22 +2281,22 @@ fun! netrw#NetWrite(...) range endif let curbufname= expand("%") -" call Decho("curbufname<".curbufname.">") +" call Decho("curbufname<".curbufname.">",'~'.expand("<slnum>")) if &binary " For binary writes, always write entire file. " (line numbers don't really make sense for that). " Also supports the writing of tar and zip files. -" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "sil keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) +" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>")) + exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) elseif g:netrw_cygwin " write (selected portion of) file to temporary let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile),'~'.expand("<slnum>")) + exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) else " write (selected portion of) file to temporary -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>")) + exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) endif if curbufname == "" @@ -2200,7 +2312,7 @@ fun! netrw#NetWrite(...) range " Process arguments: {{{4 " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else @@ -2248,10 +2360,10 @@ fun! netrw#NetWrite(...) range endif endif let ichoice= ichoice + 1 -" call Decho("choice<" . choice . "> ichoice=".ichoice) +" call Decho("choice<" . choice . "> ichoice=".ichoice,'~'.expand("<slnum>")) " Determine method of write (ftp, rcp, etc) {{{4 - keepj call s:NetrwMethod(choice) + NetrwKeepj call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 " call Dfunc("netrw#NetWrite : unsupported method") return @@ -2262,13 +2374,13 @@ fun! netrw#NetWrite(...) range " ============================ if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your write request..." -" call Decho("(netrw) Processing your write request...") +" call Decho("(netrw) Processing your write request...",'~'.expand("<slnum>")) endif "......................................... " NetWrite: (rcp) NetWrite Method #1 {{{3 if b:netrw_method == 1 -" call Decho("write via rcp (method #1)") +" call Decho("write via rcp (method #1)",'~'.expand("<slnum>")) if s:netrw_has_nt_rcp == 1 if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_machine .'.'. g:netrw_uid @@ -2282,44 +2394,41 @@ fun! netrw#NetWrite(...) range let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 elseif b:netrw_method == 2 -" call Decho("write via ftp+.netrc (method #2)") +" call Decho("write via ftp+.netrc (method #2)",'~'.expand("<slnum>")) let netrw_fname = b:netrw_fname " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew -" call Decho("filter input window#".winnr()) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) setl ff=unix - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) endif - keepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') -" call Decho("filter input: ".getline("$")) + NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),14) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),14) endif let mod=1 endif @@ -2336,44 +2445,44 @@ fun! netrw#NetWrite(...) range " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 elseif b:netrw_method == 3 " Construct execution string (three or more lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>")) let netrw_fname = b:netrw_fname let bhkeep = &l:bh " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_uid +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif endif - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) endif - keepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' -" call Decho("filter input: ".getline('.')) + NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) " save choice/id/password for future use let b:netrw_lastfile = choice @@ -2381,9 +2490,8 @@ fun! netrw#NetWrite(...) range " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" if !exists("g:netrw_quiet") @@ -2401,25 +2509,23 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (scp) NetWrite Method #4 {{{3 elseif b:netrw_method == 4 -" call Decho("write via scp (method #4)") +" call Decho("write via scp (method #4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) else let useport= "" endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (http) NetWrite Method #5 {{{3 elseif b:netrw_method == 5 -" call Decho("write via http (method #5)") +" call Decho("write via http (method #5)",'~'.expand("<slnum>")) let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") if executable(curl) let url= g:netrw_choice -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) - exe s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif @@ -2427,7 +2533,7 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 elseif b:netrw_method == 6 -" call Decho("write via cadaver (method #6)") +" call Decho("write via cadaver (method #6)",'~'.expand("<slnum>")) " Construct execution string (four lines) which will be passed through filter let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) @@ -2436,23 +2542,22 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd endif - keepj put ='put '.tmpfile.' '.netrw_fname + NetrwKeepj put ='put '.tmpfile.' '.netrw_fname " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) " remove enew buffer (quietly) let filtbuf= bufnr("%") @@ -2465,15 +2570,14 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("write via rsync (method #7)") -" call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) +" call Decho("write via rsync (method #7)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (sftp) NetWrite Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("write via sftp (method #9)") +" call Decho("write via sftp (method #9)",'~'.expand("<slnum>")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_uid .'@'. g:netrw_machine @@ -2485,14 +2589,13 @@ fun! netrw#NetWrite(...) range let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) -" call Decho("filter input: ".getline('.')) -" call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") - exe s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.s:ShellEscape(uid_machine,1)) let filtbuf= bufnr("%") exe curbuf."b!" let &l:bh = bhkeep @@ -2508,9 +2611,9 @@ fun! netrw#NetWrite(...) range endwhile " NetWrite: Cleanup: {{{3 -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("<slnum>")) if s:FileReadable(tmpfile) -" call Decho("tmpfile<".tmpfile."> readable, will now delete it") +" call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("<slnum>")) call s:NetrwDelete(tmpfile) endif call s:NetrwOptionRestore("w:") @@ -2518,12 +2621,12 @@ fun! netrw#NetWrite(...) range if a:firstline == 1 && a:lastline == line("$") " restore modifiability; usually equivalent to set nomod let &mod= mod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) elseif !exists("leavemod") " indicate that the buffer has not been modified since last written -" call Decho("set nomod") +" call Decho("set nomod",'~'.expand("<slnum>")) setl nomod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif " call Dret("netrw#NetWrite") @@ -2552,12 +2655,14 @@ fun! netrw#NetSource(...) let i= 1 while i <= a:0 call netrw#NetRead(3,a:{i}) -" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">") +" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>")) if s:FileReadable(s:netrw_tmpfile) -" call Decho("exe so ".fnameescape(s:netrw_tmpfile)) +" call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("<slnum>")) exe "so ".fnameescape(s:netrw_tmpfile) -" call Decho("delete(".s:netrw_tmpfile.")") - call delete(s:netrw_tmpfile) +" call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("<slnum>")) + if delete(s:netrw_tmpfile) + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".s:netrw_tmpfile.">!",103) + endif unlet s:netrw_tmpfile else call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) @@ -2576,33 +2681,37 @@ fun! netrw#SetTreetop(...) " clear out the current tree if exists("w:netrw_treetop") -" call Decho("clearing out current tree") +" call Decho("clearing out current tree",'~'.expand("<slnum>")) let inittreetop= w:netrw_treetop unlet w:netrw_treetop endif if exists("w:netrw_treedict") -" call Decho("freeing w:netrw_treedict") +" call Decho("freeing w:netrw_treedict",'~'.expand("<slnum>")) unlet w:netrw_treedict endif if a:1 == "" && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) -" call Decho("treedir<".treedir.">") +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else - if isdirectory(a:1) -" call Decho("a:1<".a:1."> is a directory") + if isdirectory(s:NetrwFile(a:1)) +" call Decho("a:1<".a:1."> is a directory",'~'.expand("<slnum>")) let treedir= a:1 - elseif exists("b:netrw_curdir") && isdirectory(b:netrw_curdir."/".a:1) + elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') let treedir= b:netrw_curdir."/".a:1 -" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">") +" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">",'~'.expand("<slnum>")) else + " normally the cursor is left in the message window. + " However, here this results in the directory being listed in the message window, which is not wanted. + let netrwbuf= bufnr("%") call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) + exe bufwinnr(netrwbuf)."wincmd w" let treedir= "." endif endif -" call Decho("treedir<".treedir.">") - let islocal= expand("%") !~ '^\a\+://' -" call Decho("islocal=".islocal) +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("islocal=".islocal,'~'.expand("<slnum>")) if islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) else @@ -2622,14 +2731,14 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " readcmd=='t': simply do nothing if a:readcmd == 't' -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwGetFile : skip read of <".a:tfile.">") return endif " get name of remote filename (ie. url and all) let rfile= bufname("%") -" call Decho("rfile<".rfile.">") +" call Decho("rfile<".rfile.">",'~'.expand("<slnum>")) if exists("*NetReadFixup") " for the use of NetReadFixup (not otherwise used internally) @@ -2638,7 +2747,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) if a:readcmd[0] == '%' " get file into buffer -" call Decho("get file into buffer") +" call Decho("get file into buffer",'~'.expand("<slnum>")) " rename the current buffer to the temp file (ie. tfile) if g:netrw_cygwin @@ -2646,41 +2755,41 @@ fun! s:NetrwGetFile(readcmd, tfile, method) else let tfile= a:tfile endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile)) +" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("<slnum>")) exe "sil! keepalt file ".fnameescape(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' -" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") +" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)",'~'.expand("<slnum>")) call zip#Browse(tfile) elseif rfile =~ '\.tar$' -" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") +" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.gz$' -" call Decho("handling remote gzip-compressed tar file") +" call Decho("handling remote gzip-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.bz2$' -" call Decho("handling remote bz2-compressed tar file") +" call Decho("handling remote bz2-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.xz$' -" call Decho("handling remote xz-compressed tar file") +" call Decho("handling remote xz-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.txz$' -" call Decho("handling remote xz-compressed tar file (.txz)") +" call Decho("handling remote xz-compressed tar file (.txz)",'~'.expand("<slnum>")) call tar#Browse(tfile) else -" call Decho("edit temporary file") - e! +" call Decho("edit temporary file",'~'.expand("<slnum>")) + NetrwKeepj e! endif " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile)) - exe "sil! keepj keepalt file ".fnameescape(rfile) +" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim " to process this detection correctly. -" call Decho("detect filetype of local version of remote file") +" call Decho("detect filetype of local version of remote file",'~'.expand("<slnum>")) let iskkeep= &l:isk setl isk-=/ let &l:isk= iskkeep @@ -2690,48 +2799,48 @@ fun! s:NetrwGetFile(readcmd, tfile, method) elseif !&ma " attempting to read a file after the current line in the file, but the buffer is not modifiable - keepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) -" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) +" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") return elseif s:FileReadable(a:tfile) " read file after current line -" call Decho("read file<".a:tfile."> after current line") +" call Decho("read file<".a:tfile."> after current line",'~'.expand("<slnum>")) let curline = line(".") let lastline= line("$") -" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) - exe "keepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) +" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline,'~'.expand("<slnum>")) + exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) let line1= curline + 1 let line2= line("$") - lastline + 1 else " not readable -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tfile<".a:tfile."> not readable") - keepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("tfile<".a:tfile."> not readable",'~'.expand("<slnum>")) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") return endif " User-provided (ie. optional) fix-it-up command if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") - keepj call NetReadFixup(a:method, line1, line2) +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")",'~'.expand("<slnum>")) + NetrwKeepj call NetReadFixup(a:method, line1, line2) " else " Decho -" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") +" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")",'~'.expand("<slnum>")) endif if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu " update the Buffers menu - keepj call s:UpdateBuffersMenu() + NetrwKeepj call s:UpdateBuffersMenu() endif -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile),'~'.expand("<slnum>")) " make sure file is being displayed " redraw! -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwGetFile") endfun @@ -2740,15 +2849,16 @@ endfun " Input: " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] " Output: -" b:netrw_method= 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http[s] (wget) +" b:netrw_method= 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http[s] (wget) " 6: dav -" 7: rsync -" 8: fetch -" 9: sftp +" 7: rsync +" 8: fetch +" 9: sftp +" 10: file " g:netrw_machine= hostname " b:netrw_fname = filename " g:netrw_port = optional port number (for ftp) @@ -2768,7 +2878,7 @@ fun! s:NetrwMethod(choice) " curmachine used if protocol == ftp and no .netrc if exists("g:netrw_machine") let curmachine= g:netrw_machine -" call Decho("curmachine<".curmachine.">") +" call Decho("curmachine<".curmachine.">",'~'.expand("<slnum>")) else let curmachine= "N O T A HOST" endif @@ -2799,11 +2909,9 @@ fun! s:NetrwMethod(choice) " rsyncurm : rsync://host[:port]/path Use rsync " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) " sftpurm : sftp://[user@]host/filename Use scp + " fileurm : file://[user@]host/filename Use elinks or links let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' let mf = '^\(\S\+\)\s\+\(\S\+\)$' -" let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' -" let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' -" let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' let ftpurm = '^ftp://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' let rcpurm = '^rcp://\%(\([^/]*\)@\)\=\([^/]\{-}\)/\(.*\)$' let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' @@ -2813,12 +2921,13 @@ fun! s:NetrwMethod(choice) let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' let fetchurm = '^fetch://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' + let fileurm = '^file\=://\(.*\)$' -" call Decho("determine method:") +" call Decho("determine method:",'~'.expand("<slnum>")) " Determine Method " Method#1: rcp://user@hostname/...path-to-file {{{3 if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...") +" call Decho("rcp://...",'~'.expand("<slnum>")) let b:netrw_method = 1 let userid = substitute(a:choice,rcpurm,'\1',"") let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") @@ -2829,7 +2938,7 @@ fun! s:NetrwMethod(choice) " Method#4: scp://user@hostname/...path-to-file {{{3 elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...") +" call Decho("scp://...",'~'.expand("<slnum>")) let b:netrw_method = 4 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") let g:netrw_port = substitute(a:choice,scpurm,'\2',"") @@ -2837,7 +2946,7 @@ fun! s:NetrwMethod(choice) " Method#5: http[s]://user@hostname/...path-to-file {{{3 elseif match(a:choice,httpurm) == 0 -" call Decho("http[s]://...") +" call Decho("http[s]://...",'~'.expand("<slnum>")) let b:netrw_method = 5 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") @@ -2845,7 +2954,7 @@ fun! s:NetrwMethod(choice) " Method#6: dav://hostname[:port]/..path-to-file.. {{{3 elseif match(a:choice,davurm) == 0 -" call Decho("dav://...") +" call Decho("dav://...",'~'.expand("<slnum>")) let b:netrw_method= 6 if a:choice =~ 'davs:' let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") @@ -2856,19 +2965,19 @@ fun! s:NetrwMethod(choice) " Method#7: rsync://user@hostname/...path-to-file {{{3 elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...") +" call Decho("rsync://...",'~'.expand("<slnum>")) let b:netrw_method = 7 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3 elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...") +" call Decho("ftp://...",'~'.expand("<slnum>")) let userid = substitute(a:choice,ftpurm,'\2',"") let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") -" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>")) if userid != "" let g:netrw_uid= userid endif @@ -2892,16 +3001,16 @@ fun! s:NetrwMethod(choice) if exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) - elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' -" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") -" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">") - if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:' +" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) +" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("<slnum>")) + if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>' let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',g:netrw_machine,'') -" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") +" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) endif let b:netrw_method= 2 elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc -" call Decho("using <".expand("$HOME/.netrc")."> (readable)") +" call Decho("using <".expand("$HOME/.netrc")."> (readable)",'~'.expand("<slnum>")) let b:netrw_method= 2 else if !exists("g:netrw_uid") || g:netrw_uid == "" @@ -2916,7 +3025,7 @@ fun! s:NetrwMethod(choice) " Method#8: fetch {{{3 elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...") +" call Decho("fetch://...",'~'.expand("<slnum>")) let b:netrw_method = 8 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") @@ -2925,7 +3034,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3 elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file") +" call Decho("(ftp) host id pass file",'~'.expand("<slnum>")) let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mipf,'\1',"") let g:netrw_uid = substitute(a:choice,mipf,'\2',"") @@ -2935,7 +3044,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file") +" call Decho("(ftp) host file",'~'.expand("<slnum>")) if exists("g:netrw_uid") && exists("s:netrw_passwd") let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mf,'\1',"") @@ -2949,26 +3058,33 @@ fun! s:NetrwMethod(choice) " Method#9: sftp://user@hostname/...path-to-file {{{3 elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...") +" call Decho("sftp://...",'~'.expand("<slnum>")) let b:netrw_method = 9 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3 elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">",'~'.expand("<slnum>")) let b:netrw_method = 1 let userid = substitute(a:choice,rcphf,'\2',"") let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">",'~'.expand("<slnum>")) +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">",'~'.expand("<slnum>")) +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">",'~'.expand("<slnum>")) +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">",'~'.expand("<slnum>")) if userid != "" let g:netrw_uid= userid endif + " Method#10: file://user@hostname/...path-to-file {{{3 + elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd") +" call Decho("http[s]://...",'~'.expand("<slnum>")) + let b:netrw_method = 10 + let b:netrw_fname = substitute(a:choice,fileurm,'\1',"") +" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">",'~'.expand("<slnum>")) + " Cannot Determine Method {{{3 else if !exists("g:netrw_quiet") @@ -2986,17 +3102,17 @@ fun! s:NetrwMethod(choice) let g:netrw_port= netrw_port endif -" call Decho("a:choice <".a:choice.">") -" call Decho("b:netrw_method <".b:netrw_method.">") -" call Decho("g:netrw_machine<".g:netrw_machine.">") -" call Decho("g:netrw_port <".g:netrw_port.">") +" call Decho("a:choice <".a:choice.">",'~'.expand("<slnum>")) +" call Decho("b:netrw_method <".b:netrw_method.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_port <".g:netrw_port.">",'~'.expand("<slnum>")) " if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">") +" call Decho("g:netrw_uid <".g:netrw_uid.">",'~'.expand("<slnum>")) " endif "Decho " if exists("s:netrw_passwd") "Decho -" call Decho("s:netrw_passwd <".s:netrw_passwd.">") +" call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("<slnum>")) " endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("<slnum>")) " call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) endfun @@ -3023,7 +3139,7 @@ if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp if method == 3 " ftp (no <.netrc>) let fourblanklines= line2 - 3 if fourblanklines >= line1 - exe "sil keepj ".fourblanklines.",".line2."g/^\s*$/d" + exe "sil NetrwKeepj ".fourblanklines.",".line2."g/^\s*$/d" call histdel("/",-1) endif endif @@ -3075,14 +3191,14 @@ fun! NetUserPass(...) if a:1 =~ '^ftp:' " get host from ftp:... url " access userid and password from hup (host-user-passwd) dictionary -" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)",'~'.expand("<slnum>")) let host = substitute(a:1,'^ftp:','','') let host = substitute(host,'\..*','','') if exists("s:netrw_hup[host]") let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>")) +" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>")) else let g:netrw_uid = input("Enter UserId: ") let s:netrw_passwd = inputsecret("Enter Password: ") @@ -3090,7 +3206,7 @@ fun! NetUserPass(...) else " case: one input argument, not an url. Using it as a new user-id. -" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)",'~'.expand("<slnum>")) if exists("g:netrw_machine") if g:netrw_machine =~ '[0-9.]\+' let host= g:netrw_machine @@ -3101,7 +3217,7 @@ fun! NetUserPass(...) let g:netrw_machine= input('Enter hostname: ') endif let g:netrw_uid = a:1 -" call Decho("set g:netrw_uid= <".g:netrw_uid.">") +" call Decho("set g:netrw_uid= <".g:netrw_uid.">",'~'.expand("<slnum>")) if exists("g:netrw_passwd") " ask for password if one not previously entered let s:netrw_passwd= g:netrw_passwd @@ -3110,7 +3226,7 @@ fun! NetUserPass(...) endif endif -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("<slnum>")) if exists("host") if !exists('s:netrw_hup[host]') let s:netrw_hup[host]= {} @@ -3134,8 +3250,8 @@ fun! NetUserPass(...) let s:netrw_hup[host].passwd = a:3 let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>")) +" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>")) endif " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") @@ -3150,9 +3266,9 @@ endfun fun! s:ExplorePatHls(pattern) " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") let repat= substitute(a:pattern,'^**/\{1,2}','','') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("<slnum>")) let repat= escape(repat,'][.\') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("<slnum>")) let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' " call Dret("s:ExplorePatHls repat<".repat.">") return repat @@ -3163,9 +3279,9 @@ endfun " 0: (user: <mb>) bookmark current directory " 1: (user: <gb>) change to the bookmarked directory " 2: (user: <qb>) list bookmarks -" 3: (browsing) record current directory history -" 4: (user: <u>) go up (previous) bookmark -" 5: (user: <U>) go down (next) bookmark +" 3: (browsing) records current directory history +" 4: (user: <u>) go up (previous) directory, using history +" 5: (user: <U>) go down (next) directory, using history " 6: (user: <mB>) delete bookmark fun! s:NetrwBookHistHandler(chg,curdir) " call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) @@ -3174,26 +3290,26 @@ fun! s:NetrwBookHistHandler(chg,curdir) return endif - let ykeep= @@ + let ykeep = @@ + let curbufnr = bufnr("%") + if a:chg == 0 " bookmark the current directory -" call Decho("(user: <b>) bookmark the current directory") - if !exists("g:netrw_bookmarklist") - let g:netrw_bookmarklist= [] - endif - if index(g:netrw_bookmarklist,a:curdir) == -1 - " curdir not currently in g:netrw_bookmarklist, so include it - call add(g:netrw_bookmarklist,a:curdir) - call sort(g:netrw_bookmarklist) +" call Decho("(user: <b>) bookmark the current directory",'~'.expand("<slnum>")) + if exists("s:netrwmarkfilelist_{curbufnr}") + call s:NetrwBookmark(0) + echo "bookmarked marked files" + else + call s:MakeBookmark(a:curdir) + echo "bookmarked the current directory" endif - echo "bookmarked the current directory" elseif a:chg == 1 " change to the bookmarked directory -" call Decho("(user: <".v:count."gb>) change to the bookmarked directory") +" call Decho("(user: <".v:count."gb>) change to the bookmarked directory",'~'.expand("<slnum>")) if exists("g:netrw_bookmarklist[v:count-1]") -" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) - exe "keepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) +" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) + exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" endif @@ -3202,12 +3318,12 @@ fun! s:NetrwBookHistHandler(chg,curdir) " redraw! let didwork= 0 " list user's bookmarks -" call Decho("(user: <q>) list user's bookmarks") +" call Decho("(user: <q>) list user's bookmarks",'~'.expand("<slnum>")) if exists("g:netrw_bookmarklist") -" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') +" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks','~'.expand("<slnum>")) let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) +" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1],'~'.expand("<slnum>")) echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) let didwork = 1 let cnt = cnt + 1 @@ -3220,9 +3336,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) let histcnt = 0 if g:netrw_dirhistmax > 0 while ( first || cnt != g:netrw_dirhist_cnt ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt,'~'.expand("<slnum>")) if exists("g:netrw_dirhist_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) +" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("<slnum>")) echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) let didwork= 1 endif @@ -3242,18 +3358,18 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 3 " saves most recently visited directories (when they differ) -" call Decho("(browsing) record curdir history") +" call Decho("(browsing) record curdir history",'~'.expand("<slnum>")) if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir endif -" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) endif elseif a:chg == 4 " u: change to the previous directory stored on the history list -" call Decho("(user: <u>) chg to prev dir from history") +" call Decho("(user: <u>) chg to prev dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 @@ -3263,17 +3379,17 @@ fun! s:NetrwBookHistHandler(chg,curdir) let g:netrw_dirhist_cnt= 0 endif if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setl ma noro -" call Decho("setl ma noro") - sil! keepj %d +" call Decho("setl ma noro",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ setl nomod -" call Decho("setl nomod") -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("setl nomod",'~'.expand("<slnum>")) +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + v:count1 ) % g:netrw_dirhistmax @@ -3285,22 +3401,22 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 5 " U: change to the subsequent directory stored on the history list -" call Decho("(user: <U>) chg to next dir from history") +" call Decho("(user: <U>) chg to next dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro - sil! keepj %d -" call Decho("removed all lines from buffer (%d)") -" call Decho("setl nomod") + sil! NetrwKeepj %d _ +" call Decho("removed all lines from buffer (%d)",'~'.expand("<slnum>")) +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 @@ -3314,18 +3430,22 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif elseif a:chg == 6 - " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") - let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) -" call Decho("merge bookmarks (active and file)") - keepj call s:NetrwBookHistSave() " done here to merge bookmarks first -" call Decho("bookmark delete savefile<".savefile.">") - keepj call delete(savefile) - endif -" call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") - keepj call remove(g:netrw_bookmarklist,v:count-1) -" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) +" call Decho("(user: <mB>) delete bookmark'd directory",'~'.expand("<slnum>")) + if exists("s:netrwmarkfilelist_{curbufnr}") + call s:NetrwBookmark(1) + echo "removed marked files from bookmarks" + else + " delete the v:count'th bookmark + let iremove = v:count + let dremove = g:netrw_bookmarklist[iremove - 1] +" call Decho("delete bookmark#".iremove."<".g:netrw_bookmarklist[iremove - 1].">",'~'.expand("<slnum>")) + call s:MergeBookmarks() +" call Decho("remove g:netrw_bookmarklist[".(iremove-1)."]<".g:netrw_bookmarklist[(iremove-1)].">",'~'.expand("<slnum>")) + NetrwKeepj call remove(g:netrw_bookmarklist,iremove-1) + echo "removed ".dremove." from g:netrw_bookmarklist" +" call Decho("g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) + endif +" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) endif call s:NetrwBookmarkMenu() call s:NetrwTgtMenu() @@ -3335,6 +3455,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwBookHistRead: this function reads bookmarks and history {{{2 +" Will source the history file (.netrwhist) only if the g:netrw_disthistmax is > 0. " Sister function: s:NetrwBookHistSave() fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") @@ -3346,15 +3467,15 @@ fun! s:NetrwBookHistRead() if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" - if filereadable(savefile) -" call Decho("sourcing .netrwbook") - exe "keepalt keepj so ".savefile + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwbook",'~'.expand("<slnum>")) + exe "keepalt NetrwKeepj so ".savefile endif if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" - if filereadable(savefile) -" call Decho("sourcing .netrwhist") - exe "keepalt keepj so ".savefile + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwhist",'~'.expand("<slnum>")) + exe "keepalt NetrwKeepj so ".savefile endif let s:netrw_initbookhist= 1 au VimLeave * call s:NetrwBookHistSave() @@ -3369,6 +3490,8 @@ endfun " Sister function: s:NetrwBookHistRead() " I used to do this via viminfo but that appears to " be unreliable for long-term storage +" If g:netrw_dirhistmax is <= 0, no history or bookmarks +" will be saved. fun! s:NetrwBookHistSave() " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 @@ -3379,11 +3502,15 @@ fun! s:NetrwBookHistSave() let savefile= s:NetrwHome()."/.netrwhist" 1split call s:NetrwEnew() - setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + if g:netrw_use_noswf + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + else + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 + endif setl nocin noai noci magic nospell nohid wig= noaw setl ma noro write if exists("+acd") | setl noacd | endif - sil! keepj keepalt %d + sil! NetrwKeepj keepalt %d _ " save .netrwhist -- no attempt to merge sil! keepalt file .netrwhist @@ -3397,21 +3524,20 @@ fun! s:NetrwBookHistSave() endwhile exe "sil! w! ".savefile - sil keepj %d + sil NetrwKeepj %d _ if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) + if filereadable(s:NetrwFile(savefile)) let booklist= deepcopy(g:netrw_bookmarklist) - exe "sil keepj keepalt so ".savefile + exe "sil NetrwKeepj keepalt so ".savefile for bdm in booklist if index(g:netrw_bookmarklist,bdm) == -1 call add(g:netrw_bookmarklist,bdm) endif endfor call sort(g:netrw_bookmarklist) - exe "sil! w! ".savefile endif " construct and save .netrwbook @@ -3430,19 +3556,28 @@ endfun " list of the contents of a local or remote directory. It is assumed that the " g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted " with the requested remote hostname first. +" Often called via: Explore/e dirname/etc -> netrw#LocalBrowseCheck() -> s:NetrwBrowse() fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dredir("ls!") - " s:NetrwBrowse: initialize history {{{3 + " save alternate-file's filename if w:netrw_rexlocal doesn't exist + " This is useful when one edits a local file, then :e ., then :Rex + if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != "" + let w:netrw_rexfile= bufname("#") +" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr(),'~'.expand("<slnum>")) + endif + + " s:NetrwBrowse : initialize history {{{3 if !exists("s:netrw_initbookhist") - keepj call s:NetrwBookHistRead() + NetrwKeepj call s:NetrwBookHistRead() endif - " s:NetrwBrowse: simplify the dirname (especially for ".."s in dirnames) {{{3 - if a:dirname !~ '^\a\+://' + " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 + if a:dirname !~ '^\a\{3,}://' let dirname= simplify(a:dirname) else let dirname= a:dirname @@ -3450,83 +3585,89 @@ fun! s:NetrwBrowse(islocal,dirname) if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed") return endif - " s:NetrwBrowse: sanity checks: {{{3 + " s:NetrwBrowse : sanity checks: {{{3 if !exists("*shellescape") - keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) " call Dret("s:NetrwBrowse : missing shellescape()") return endif if !exists("*fnameescape") - keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) " call Dret("s:NetrwBrowse : missing fnameescape()") return endif - " s:NetrwBrowse: save options: {{{3 - call s:NetrwOptionSave("w:") + " s:NetrwBrowse : save options: {{{3 + call s:NetrwOptionSave("w:") - " s:NetrwBrowse: re-instate any marked files {{{3 + " s:NetrwBrowse : re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files") +" call Decho("clearing marked files",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" endif if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep - " s:NetrwBrowse: set up "safe" options for local directory/file {{{3 -" call Decho("handle w:netrw_acdkeep:") -" call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") + " s:NetrwBrowse : set up "safe" options for local directory/file {{{3 +" call Decho("handle w:netrw_acdkeep:",'~'.expand("<slnum>")) +" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("<slnum>")) call s:NetrwLcd(dirname) call s:NetrwSafeOptions() -" call Decho("getcwd<".getcwd().">") +" call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' - " s:NetrwBrowse: looks like a remote regular file, attempt transfer {{{3 -" call Decho("attempt transfer as regular file<".dirname.">") - - " remove any filetype indicator from end of dirname, except for the - " "this is a directory" indicator (/). - " There shouldn't be one of those here, anyway. - let path= substitute(dirname,'[*=@|]\r\=$','','e') -" call Decho("new path<".path.">") - call s:RemotePathAnalysis(dirname) - - " s:NetrwBrowse: remote-read the requested file into current buffer {{{3 - keepj mark ' - call s:NetrwEnew(dirname) - call s:NetrwSafeOptions() - setl ma noro -" call Decho("setl ma noro") - let b:netrw_curdir = dirname - let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") - exe "sil! keepj keepalt file ".fnameescape(url) - exe "sil! keepj keepalt doau BufReadPre ".fnameescape(s:fname) - sil call netrw#NetRead(2,url) - " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error -" call Decho("url<".url.">") -" call Decho("s:path<".s:path.">") -" call Decho("s:fname<".s:fname.">") - if s:path =~ '.bz2' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) - elseif s:path =~ '.gz' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','','')) - elseif s:path =~ '.gz' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','','')) + " s:NetrwBrowse : remote regular file handler {{{3 +" call Decho("handle remote regular file: dirname<".dirname.">",'~'.expand("<slnum>")) + if bufname(dirname) != "" +" call Decho("edit buf#".bufname(dirname)." in win#".winnr(),'~'.expand("<slnum>")) + exe "NetrwKeepj b ".bufname(dirname) else - exe "sil keepj keepalt doau BufReadPost ".fnameescape(s:fname) + " attempt transfer of remote regular file +" call Decho("attempt transfer as regular file<".dirname.">",'~'.expand("<slnum>")) + + " remove any filetype indicator from end of dirname, except for the + " "this is a directory" indicator (/). + " There shouldn't be one of those here, anyway. + let path= substitute(dirname,'[*=@|]\r\=$','','e') +" call Decho("new path<".path.">",'~'.expand("<slnum>")) + call s:RemotePathAnalysis(dirname) + + " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 + call s:NetrwEnew(dirname) + call s:NetrwSafeOptions() + setl ma noro +" call Decho("setl ma noro",'~'.expand("<slnum>")) + let b:netrw_curdir = dirname + let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path +" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")",'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(url) + exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) + sil call netrw#NetRead(2,url) + " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error +" call Decho("url<".url.">",'~'.expand("<slnum>")) +" call Decho("s:path<".s:path.">",'~'.expand("<slnum>")) +" call Decho("s:fname<".s:fname.">",'~'.expand("<slnum>")) + if s:path =~ '.bz2' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) + elseif s:path =~ '.gz' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','','')) + elseif s:path =~ '.gz' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','','')) + else + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(s:fname) + endif endif - " s:NetrwBrowse: save certain window-oriented variables into buffer-oriented variables {{{3 + " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") -" call Decho("setl ma nomod") - setl ma nomod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("setl ma nomod",'~'.expand("<slnum>")) + setl ma nomod noro +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : file<".s:fname.">") return @@ -3541,30 +3682,34 @@ fun! s:NetrwBrowse(islocal,dirname) let s:last_sort_by = g:netrw_sort_by " set up menu {{{3 - keepj call s:NetrwMenu(1) + NetrwKeepj call s:NetrwMenu(1) " get/set-up buffer {{{3 +" call Decho("saving position across a buffer refresh",'~'.expand("<slnum>")) + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let reusing= s:NetrwGetBuffer(a:islocal,dirname) + " maintain markfile highlighting if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("bufnr(%)=".bufnr('%')) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("bufnr(%)=".bufnr('%'),'~'.expand("<slnum>")) +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("<slnum>")) 2match none endif if reusing && line("$") > 1 call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap -" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Dret("s:NetrwBrowse : re-using buffer") +" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Dret("s:NetrwBrowse : re-using not-cleared buffer") return endif " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")") +" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")",'~'.expand("<slnum>")) let b:netrw_curdir= dirname if b:netrw_curdir =~ '[/\\]$' let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') @@ -3585,21 +3730,21 @@ fun! s:NetrwBrowse(islocal,dirname) if !a:islocal && b:netrw_curdir !~ '/$' let b:netrw_curdir= b:netrw_curdir.'/' endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) " ------------ " (local only) {{{3 " ------------ if a:islocal -" call Decho("local only:") +" call Decho("local only:",'~'.expand("<slnum>")) " Set up ShellCmdPost handling. Append current buffer to browselist call s:LocalFastBrowser() " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 if !g:netrw_keepdir -" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) +" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) +" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("<slnum>")) if !exists("&l:acd") || !&l:acd call s:NetrwLcd(b:netrw_curdir) endif @@ -3609,106 +3754,188 @@ fun! s:NetrwBrowse(islocal,dirname) " remote handling: {{{3 " -------------------------------- else -" call Decho("remote only:") +" call Decho("remote only:",'~'.expand("<slnum>")) " analyze dirname and g:netrw_list_cmd {{{3 -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") - if dirname =~ "^NetrwTreeListing\>" +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("<slnum>")) + if dirname =~# "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">") +" call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">",'~'.expand("<slnum>")) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' let dirname= dirname.'/' endif let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">") +" call Decho("(liststyle is TREELIST) dirname<".dirname.">",'~'.expand("<slnum>")) else let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">") +" call Decho("(normal) dirname<".dirname.">",'~'.expand("<slnum>")) endif let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' if dirname !~ dirpat if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif - keepj call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") + NetrwKeepj call s:NetrwOptionRestore("w:") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") return endif let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") +" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("<slnum>")) endif " (additional remote handling) " ----------------------- " Directory Listing: {{{3 " ----------------------- - keepj call s:NetrwMaps(a:islocal) - keepj call s:NetrwCommands(a:islocal) - keepj call s:PerformListing(a:islocal) + NetrwKeepj call s:NetrwMaps(a:islocal) + NetrwKeepj call s:NetrwCommands(a:islocal) + NetrwKeepj call s:PerformListing(a:islocal) + + " restore option(s) + call s:NetrwOptionRestore("w:") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) + + " If there is a rexposn: restore position with rexposn + " Otherwise : set rexposn + if exists("s:rexposn_".bufnr("%")) +" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt + NetrwKeepj exe w:netrw_bannercnt + endif + else + NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) + endif if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") let &l:bexpr= "netrw#BalloonHelp()" -" call Decho("set up balloon help: l:bexpr=".&l:bexpr) +" call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("<slnum>")) setl beval endif - call s:NetrwOptionRestore("w:") + + " restore position + if reusing +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) + endif " The s:LocalBrowseRefresh() function is called by an autocmd " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). " However, s:NetrwBrowse() causes the FocusGained event to fire the firstt time. - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") return endfun +" --------------------------------------------------------------------- +" s:NetrwFile: because of g:netrw_keepdir, isdirectory(), type(), etc may or {{{2 +" may not apply correctly; ie. netrw's idea of the current directory may +" differ from vim's. This function insures that netrw's idea of the current +" directory is used. +fun! s:NetrwFile(fname) +" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) +" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("<slnum>")) +" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) + + " clean up any leading treedepthstring + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','') +" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("<slnum>")) + else + let fname= a:fname + endif + + if g:netrw_keepdir + " vim's idea of the current directory possibly may differ from netrw's + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + + if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) + if fname =~ '^\' || fname =~ '^\a:\' + " windows, but full path given + let ret= fname +" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) + else + " windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,fname) +" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) + endif + + elseif fname =~ '^/' + " not windows, full path given + let ret= fname +" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) + else + " not windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,fname) +" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) + endif + else + " vim and netrw agree on the current directory + let ret= fname +" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>")) +" call Decho("vim directory: ".getcwd(),'~'.expand("<slnum>")) +" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("<slnum>")) + endif + +" call Dret("s:NetrwFile ".ret) + return ret +endfun + " --------------------------------------------------------------------- " s:NetrwFileInfo: supports qf (query for file information) {{{2 fun! s:NetrwFileInfo(islocal,fname) " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">") let ykeep= @@ if a:islocal + let lsopt= "-lsad" + if g:netrw_sizestyle =~# 'H' + let lsopt= "-lsadh" + elseif g:netrw_sizestyle =~# 'h' + let lsopt= "-lsadh --si" + endif if (has("unix") || has("macunix")) && executable("/bin/ls") if getline(".") == "../" - echo system("/bin/ls -lsad ".shellescape("..")) -" call Decho("#1: echo system(/bin/ls -lsad ".shellescape(..).")") + echo system("/bin/ls ".lsopt." ".s:ShellEscape("..")) +" call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("<slnum>")) elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir)) -" call Decho("#2: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir).")") + echo system("/bin/ls ".lsopt." ".s:ShellEscape(b:netrw_curdir)) +" call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("<slnum>")) elseif exists("b:netrw_curdir") - if b:netrw_curdir =~ '/$' - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname)) -" call Decho("#3: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname).")") - - else - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname)) -" call Decho("#4: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname).")") - endif + echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) +" call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("<slnum>")) else -" call Decho('using ls '.a:fname." using cwd<".getcwd().">") - echo system("/bin/ls -lsad ".shellescape(a:fname)) -" call Decho("#5: echo system(/bin/ls -lsad ".shellescape(a:fname).")") +" call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("<slnum>")) + echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:NetrwFile(a:fname))) +" call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("<slnum>")) endif else " use vim functions to return information about file below cursor -" call Decho("using vim functions to query for file info") - if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]' +" call Decho("using vim functions to query for file info",'~'.expand("<slnum>")) + if !isdirectory(s:NetrwFile(a:fname)) && !filereadable(s:NetrwFile(a:fname)) && a:fname =~ '[*@/]' let fname= substitute(a:fname,".$","","") else let fname= a:fname endif - let t = getftime(fname) - let sz = getfsize(fname) - echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)) -" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))) + let t = getftime(s:NetrwFile(fname)) + let sz = getfsize(s:NetrwFile(fname)) + if g:netrw_sizestyle =~# "[hH]" + let sz= s:NetrwHumanReadable(sz) + endif + echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) +" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("<slnum>")) endif else echo "sorry, \"qf\" not supported yet for remote files" @@ -3717,180 +3944,139 @@ fun! s:NetrwFileInfo(islocal,fname) " call Dret("s:NetrwFileInfo") endfun +" --------------------------------------------------------------------- +" s:NetrwFullPath: returns the full path to a directory and/or file {{{2 +fun! s:NetrwFullPath(filename) +" " call Dfunc("s:NetrwFullPath(filename<".a:filename.">)") + let filename= a:filename + if filename !~ '^/' + let filename= resolve(getcwd().'/'.filename) + endif + if filename != "/" && filename =~ '/$' + let filename= substitute(filename,'/$','','') + endif +" " call Dret("s:NetrwFullPath <".filename.">") + return filename +endfun + " --------------------------------------------------------------------- " s:NetrwGetBuffer: {{{2 " returns 0=cleared buffer -" 1=re-used buffer +" 1=re-used buffer (buffer not cleared) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>")) let dirname= a:dirname " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one") - if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr) - let eikeep= &ei - setl ei=all - exe "sil! noswapfile keepalt b ".w:netrw_treebufnr - let &ei= eikeep - setl ma - sil! keepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 0<buffer cleared> : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>") - return 0 +" call Decho("--re-use a buffer if possible--",'~'.expand("<slnum>")) + if !exists("s:netrwbuf") + let s:netrwbuf= {} + endif + if has_key(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum) + if !bufexists(bufnum) + call remove(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= -1 endif - let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") - else - " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--") -" call Dredir("(NetrwGetBuffer) ls!","ls!") - - " get dirname and associated buffer number - let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ") -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum) - - if bufnum < 0 && dirname !~ '/$' - " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">") - let bufnum= bufnr(escape(dirname.'/','\')) - if bufnum > 0 - let dirname= dirname.'/' - endif - endif - - if bufnum < 0 && dirname =~ '/$' - " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">") - let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) - if bufnum > 0 - let dirname= substitute(dirname,'/$','','') - endif - endif - -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") - " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) - if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' - " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") - let ibuf = 1 - let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast) - while ibuf <= buflast - let bname= substitute(bufname(ibuf),'\\','/','g') - let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") - if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' - " bname is not empty - " dirname ends with bname, - " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') - break - endif - if bname =~ '^'.dirname.'/\=$' - " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') - break - endif - if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') - break - endif - if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$') - break - endif - let ibuf= ibuf + 1 - endwhile - if ibuf > buflast - let bufnum= -1 - else - let bufnum= ibuf - endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") - endif +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key") + let bufnum= -1 endif " get enew buffer and name it -or- re-use buffer {{{3 -" call Decho(" get enew buffer and name it OR re-use buffer") - sil! keepj keepalt mark ' - if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") + if bufnum < 0 " get enew buffer and name it +" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("<slnum>")) call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") +" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("<slnum>")) " name the buffer if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " Got enew buffer; transform into a NetrwTreeListing -" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") +" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --",'~'.expand("<slnum>")) if !exists("s:netrw_treelistnum") let s:netrw_treelistnum= 1 else let s:netrw_treelistnum= s:netrw_treelistnum + 1 endif let w:netrw_treebufnr= bufnr("%") -" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) +" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("<slnum>")) exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) - setl bt=nofile noswf - nnoremap <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> - nnoremap <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> - nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[')<cr> - nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']')<cr> -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) + if g:netrw_use_noswf + setl nobl bt=nofile noswf + else + setl nobl bt=nofile + endif + nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[[')<cr> + nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']]')<cr> + nnoremap <silent> <buffer> [] :sil call <SID>TreeListMove('[]')<cr> + nnoremap <silent> <buffer> ][ :sil call <SID>TreeListMove('][')<cr> +" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) else +" let v:errmsg = "" " Decho + let escdirname = fnameescape(dirname) +" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) +" call Decho(' exe sil! keepalt file '.escdirname,'~'.expand("<slnum>")) " let v:errmsg= "" " Decho - let escdirname= fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") -" call Decho(' exe sil! keepalt file '.escdirname) -" let v:errmsg= "" " Decho - exe 'sil! keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") + exe 'sil! keepj keepalt file '.escdirname +" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) + " enter the new buffer into the s:netrwbuf dictionary + let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%") +" call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("<slnum>")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>")) endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") +" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") +" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("<slnum>")) let eikeep= &ei setl ei=all - if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum + if getline(2) =~# '^" Netrw Directory Listing' +" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("<slnum>")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum else -" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum +" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum,'~'.expand("<slnum>")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum endif +" call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd())) - exe "sil! keepalt file ".fnameescape(getcwd()) +" call Decho("exe sil! keepalt file ".fnameescape(getcwd()),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(getcwd()) endif let &ei= eikeep - if line("$") <= 1 - keepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) + + if line("$") <= 1 && getline(1) == "" + " empty buffer + NetrwKeepj call s:NetrwListSettings(a:islocal) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<buffer empty> : re-using buffer#".bufnr("%").", but its empty, so refresh it") return 0 + elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) - keepj call s:NetrwListSettings(a:islocal) - sil keepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwListSettings(a:islocal) + sil NetrwKeepj %d _ +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) return 0 + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("--re-use tree listing--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil keepj %d - keepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("--re-use tree listing--",'~'.expand("<slnum>")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil NetrwKeepj %d _ + NetrwKeepj call s:NetrwListSettings(a:islocal) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") return 0 + else -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 1<buffer not cleared> : buf#".bufnr("%")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Dret("s:NetrwGetBuffer 1<buffer not cleared>") return 1 endif endif @@ -3900,19 +4086,20 @@ fun! s:NetrwGetBuffer(islocal,dirname) " slow 0 D D Deleting a buffer implies it will not be re-used (slow) " med 1 D H " fast 2 H H -" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") +" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("<slnum>")) let fname= expand("%") - keepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname)) - exe "sil! keepj keepalt file ".fnameescape(fname) + NetrwKeepj call s:NetrwListSettings(a:islocal) +" call Decho("exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(fname) " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil! keepalt keepj %d +" call Decho("--delete all lines from buffer--",'~'.expand("<slnum>")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! keepalt NetrwKeepj %d _ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 0<cleared buffer> : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Dret("s:NetrwGetBuffer 0<cleared buffer>") return 0 endfun @@ -3936,7 +4123,11 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol(".")) +" call Dfunc("s:NetrwGetWord() liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) + let keepsol= &l:sol + setl nosol + call s:UseBufWinVars() " insure that w:netrw_liststyle is set up @@ -3946,87 +4137,87 @@ fun! s:NetrwGetWord() else let w:netrw_liststyle= s:THINLIST endif -" call Decho("w:netrw_liststyle=".w:netrw_liststyle) +" call Decho("w:netrw_liststyle=".w:netrw_liststyle,'~'.expand("<slnum>")) endif if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt " Active Banner support -" call Decho("active banner handling") - keepj norm! 0 +" call Decho("active banner handling",'~'.expand("<slnum>")) + NetrwKeepj norm! 0 let dirname= "./" let curline= getline('.') - if curline =~ '"\s*Sorted by\s' - keepj norm s + if curline =~# '"\s*Sorted by\s' + NetrwKeepj norm s let s:netrw_skipbrowse= 1 echo 'Pressing "s" also works' - elseif curline =~ '"\s*Sort sequence:' + elseif curline =~# '"\s*Sort sequence:' let s:netrw_skipbrowse= 1 echo 'Press "S" to edit sorting sequence' - elseif curline =~ '"\s*Quick Help:' - keepj norm ? + elseif curline =~# '"\s*Quick Help:' + NetrwKeepj norm ? let s:netrw_skipbrowse= 1 - echo 'Pressing "?" also works' - elseif curline =~ '"\s*\%(Hiding\|Showing\):' - keepj norm a + elseif curline =~# '"\s*\%(Hiding\|Showing\):' + NetrwKeepj norm a let s:netrw_skipbrowse= 1 echo 'Pressing "a" also works' elseif line("$") > w:netrw_bannercnt - exe 'sil keepj '.w:netrw_bannercnt + exe 'sil NetrwKeepj '.w:netrw_bannercnt endif elseif w:netrw_liststyle == s:THINLIST -" call Decho("thin column handling") - keepj norm! 0 - let dirname= getline('.') +" call Decho("thin column handling",'~'.expand("<slnum>")) + NetrwKeepj norm! 0 + let dirname= substitute(getline('.'),'\t -->.*$','','') elseif w:netrw_liststyle == s:LONGLIST -" call Decho("long column handling") - keepj norm! 0 +" call Decho("long column handling",'~'.expand("<slnum>")) + NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') - elseif w:netrw_liststyle == s:TREELIST -" call Decho("treelist handling") + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST +" call Decho("treelist handling",'~'.expand("<slnum>")) let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') + let dirname= substitute(dirname,'\t -->.*$','','') else -" call Decho("obtain word from wide listing") +" call Decho("obtain word from wide listing",'~'.expand("<slnum>")) let dirname= getline('.') if !exists("b:netrw_cpf") let b:netrw_cpf= 0 - exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' call histdel("/",-1) -" call Decho("computed cpf=".b:netrw_cpf) +" "call Decho("computed cpf=".b:netrw_cpf,'~'.expand("<slnum>")) endif -" call Decho("buf#".bufnr("%")."<".bufname("%").">") +" call Decho("buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) -" call Decho("1: dirname<".dirname.">") +" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) +" call Decho("1: dirname<".dirname.">",'~'.expand("<slnum>")) if filestart == 0 - keepj norm! 0ma + NetrwKeepj norm! 0ma else call cursor(line("."),filestart+1) - keepj norm! ma + NetrwKeepj norm! ma endif let rega= @a let eofname= filestart + b:netrw_cpf + 1 if eofname <= col("$") call cursor(line("."),filestart+b:netrw_cpf+1) - keepj norm! "ay`a + NetrwKeepj norm! "ay`a else - keepj norm! "ay$ + NetrwKeepj norm! "ay$ endif let dirname = @a let @a = rega -" call Decho("2: dirname<".dirname.">") +" call Decho("2: dirname<".dirname.">",'~'.expand("<slnum>")) let dirname= substitute(dirname,'\s\+$','','e') -" call Decho("3: dirname<".dirname.">") +" call Decho("3: dirname<".dirname.">",'~'.expand("<slnum>")) endif " symlinks are indicated by a trailing "@". Remove it before further processing. @@ -4035,6 +4226,8 @@ fun! s:NetrwGetWord() " executables are indicated by a trailing "*". Remove it before further processing. let dirname= substitute(dirname,"\*$","","") + let &l:sol= keepsol + " call Dret("s:NetrwGetWord <".dirname.">") return dirname endfun @@ -4043,17 +4236,17 @@ endfun " s:NetrwListSettings: make standard settings for a netrw listing {{{2 fun! s:NetrwListSettings(islocal) " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) let fname= bufname("%") -" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu") +" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("<slnum>")) setl bt=nofile nobl ma nonu nowrap noro nornu -" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname)) +" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) exe "sil! keepalt file ".fnameescape(fname) if g:netrw_use_noswf setl noswf endif " call Dredir("ls!") -" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) setl isk+=.,~,- if g:netrw_fastbrowse > a:islocal @@ -4061,7 +4254,7 @@ fun! s:NetrwListSettings(islocal) else setl bh=delete endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwListSettings") endfun @@ -4075,55 +4268,57 @@ fun! s:NetrwListStyle(islocal) let ykeep = @@ let fname = s:NetrwGetWord() if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST -" call Decho("fname<".fname.">") -" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>")) if w:netrw_liststyle == s:THINLIST " use one column listing -" call Decho("use one column list") +" call Decho("use one column list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') elseif w:netrw_liststyle == s:LONGLIST " use long list -" call Decho("use long list") +" call Decho("use long list",'~'.expand("<slnum>")) let g:netrw_list_cmd = g:netrw_list_cmd." -l" elseif w:netrw_liststyle == s:WIDELIST " give wide list -" call Decho("use wide list") +" call Decho("use wide list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - elseif w:netrw_liststyle == s:TREELIST -" call Decho("use tree list") + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST +" call Decho("use tree list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') else - keepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) let g:netrw_liststyle = s:THINLIST let w:netrw_liststyle = g:netrw_liststyle let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') endif setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! keepj %d +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ " following prevents tree listing buffer from being marked "modified" -" call Decho("setl nomod") +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " refresh the listing -" call Decho("refresh the listing") - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call s:NetrwCursor() +" call Decho("refresh the listing",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwCursor() " restore position; keep cursor on the filename - keepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) @@ -4139,21 +4334,98 @@ fun! s:NetrwBannerCtrl(islocal) let g:netrw_banner= !g:netrw_banner " refresh the listing - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) " keep cursor on the filename let fname= s:NetrwGetWord() - sil keepj $ + sil NetrwKeepj $ let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("<slnum>")) if result <= 0 && exists("w:netrw_bannercnt") - exe "keepj ".w:netrw_bannercnt + exe "NetrwKeepj ".w:netrw_bannercnt endif let @@= ykeep " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) endfun +" --------------------------------------------------------------------- +" s:NetrwBookmark: supports :NetrwMB[!] [file]s {{{2 +" +" No bang: enters files/directories into Netrw's bookmark system +" No argument and in netrw buffer: +" if there are marked files: bookmark marked files +" otherwise : bookmark file/directory under cursor +" No argument and not in netrw buffer: bookmarks current open file +" Has arguments: globs them individually and bookmarks them +" +" With bang: deletes files/directories from Netrw's bookmark system +fun! s:NetrwBookmark(del,...) +" call Dfunc("s:NetrwBookmark(del=".a:del.",...) a:0=".a:0) + if a:0 == 0 + if &ft == "netrw" + let curbufnr = bufnr("%") + + if exists("s:netrwmarkfilelist_{curbufnr}") + " for every filename in the marked list +" call Decho("bookmark every filename in marked list",'~'.expand("<slnum>")) + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let islocal= expand("%") !~ '^\a\{3,}://' + for fname in s:netrwmarkfilelist_{curbufnr} + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endfor + let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd() + call s:NetrwUnmarkList(curbufnr,curdir) + NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) + else + let fname= s:NetrwGetWord() + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endif + + else + " bookmark currently open file +" call Decho("bookmark currently open file",'~'.expand("<slnum>")) + let fname= expand("%") + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endif + + else + " bookmark specified files + " attempts to infer if working remote or local + " by deciding if the current file begins with an url + " Globbing cannot be done remotely. + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("bookmark specified file".((a:0>1)? "s" : ""),'~'.expand("<slnum>")) + let i = 1 + while i <= a:0 + if islocal + if v:version > 704 || (v:version == 704 && has("patch656")) + let mbfiles= glob(fnameescape(a:{i}),0,1,1) + else + let mbfiles= glob(fnameescape(a:{i}),0,1) + endif + else + let mbfiles= [a:{i}] + endif +" call Decho("mbfiles".string(mbfiles),'~'.expand("<slnum>")) + for mbfile in mbfiles +" call Decho("mbfile<".mbfile.">",'~'.expand("<slnum>")) + if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif + endfor + let i= i + 1 + endwhile + endif + + " update the menu + call s:NetrwBookmarkMenu() + +" call Dret("s:NetrwBookmark") +endfun + " --------------------------------------------------------------------- " s:NetrwBookmarkMenu: Uses menu priorities {{{2 " .2.[cnt] for bookmarks, and @@ -4168,7 +4440,7 @@ fun! s:NetrwBookmarkMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' endif @@ -4180,7 +4452,7 @@ fun! s:NetrwBookmarkMenu() if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd) +" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd,'~'.expand("<slnum>")) let bmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu @@ -4203,7 +4475,7 @@ fun! s:NetrwBookmarkMenu() let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{cnt}") let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) -" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) +" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("<slnum>")) exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\<cr>" endif let first = 0 @@ -4225,27 +4497,26 @@ endfun " NetrwBrowseChgDir() edits the file. fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") -" call Decho("win#".winnr()) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) let ykeep= @@ if !exists("b:netrw_curdir") " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called " and the current window is the NetrwMessage window. let @@= ykeep -" call Decho("b:netrw_curdir doesn't exist!") -" call Decho("getcwd<".getcwd().">") +" call Decho("b:netrw_curdir doesn't exist!",'~'.expand("<slnum>")) +" call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) " call Dredir("ls!") " call Dret("s:NetrwBrowseChgDir") return endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") " NetrwBrowseChgDir: save options and initialize {{{3 -" call Decho("saving options") - keepj call s:NetrwOptionSave("s:") - keepj call s:NetrwSafeOptions() - let nbcd_curpos = netrw#SavePosn() - let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos -" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn") +" call Decho("saving options",'~'.expand("<slnum>")) + call s:SavePosn(s:netrw_nbcd) + NetrwKeepj call s:NetrwOptionSave("s:") + NetrwKeepj call s:NetrwSafeOptions() if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4254,118 +4525,140 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let newdir = a:newdir let dolockout = 0 let dorestore = 1 -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) " ignore <cr>s when done in the banner +" call Decho('ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>")) if g:netrw_banner -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#")) +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt - if getline(".") =~ 'Quick Help' -" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + if getline(".") =~# 'Quick Help' +" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) -" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) setl ma noro nowrap - keepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp]) + NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap - keepj call netrw#RestorePosn(nbcd_curpos) - keepj call s:NetrwOptionRestore("s:") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + call s:RestorePosn(s:netrw_nbcd) + NetrwKeepj call s:NetrwOptionRestore("s:") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif endif " else " Decho -" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)") +" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("<slnum>")) endif " set up o/s-dependent directory recognition pattern -" call Decho("set up o/s-dependent directory recognition pattern") if has("amiga") let dirpat= '[\/:]$' else let dirpat= '[\/]$' endif -" call Decho("dirname<".dirname."> dirpat<".dirpat.">") +" call Decho("set up o/s-dependent directory recognition pattern: dirname<".dirname."> dirpat<".dirpat.">",'~'.expand("<slnum>")) if dirname !~ dirpat " apparently vim is "recognizing" that it is in a directory and " is removing the trailing "/". Bad idea, so let's put it back. let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.">") +" call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("<slnum>")) endif - if newdir !~ dirpat +" call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("<slnum>")) + if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ -" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") +" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= netrw#SavePosn() - -" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")." to SavePosn") -" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">") + let s:rexposn_{bufnr("%")}= winsaveview() +" call Decho("edit-a-file: saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) +" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) +" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">") -" call Decho("edit-a-file: newdir<".newdir.">") - let dirname= s:NetrwTreeDir() +" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("<slnum>")) +" call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("<slnum>")) + let dirname= s:NetrwTreeDir(a:islocal) if dirname =~ '/$' let dirname= dirname.newdir else let dirname= dirname."/".newdir endif -" call Decho("edit-a-file: dirname<".dirname.">") -" call Decho("edit-a-file: tree listing") +" call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("edit-a-file: tree listing",'~'.expand("<slnum>")) elseif newdir =~ '^\(/\|\a:\)' +" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">",'~'.expand("<slnum>")) let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) endif -" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")") - " this lets NetrwBrowseX avoid the edit +" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("<slnum>")) + " this lets netrw#BrowseX avoid the edit if a:0 < 1 -" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) - keepj call s:NetrwOptionRestore("s:") +" call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwOptionRestore("s:") + let curdir= b:netrw_curdir if !exists("s:didsplit") -" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) - if g:netrw_browse_split == 1 +" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>")) + if type(g:netrw_browse_split) == 3 + " open file in server + " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] +" call Decho("edit-a-file: open file in server",'~'.expand("<slnum>")) + call s:NetrwServerEdit(a:islocal,dirname) +" call Dret("s:NetrwBrowseChgDir") + return + elseif g:netrw_browse_split == 1 " horizontally splitting the window first +" call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("<slnum>")) keepalt new if !&ea keepalt wincmd _ endif + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 2 " vertically splitting the window first +" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>")) keepalt rightb vert new if !&ea keepalt wincmd | endif + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 3 " open file in new tab +" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>")) keepalt tabnew + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) +" call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>")) if s:NetrwPrevWinOpen(2) == 3 let @@= ykeep " call Dret("s:NetrwBrowseChgDir") return endif + call s:SetRexDir(a:islocal,curdir) else " handling a file, didn't split, so remove menu -" call Decho("edit-a-file: handling a file+didn't split, so remove menu") +" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>")) call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 +" call Decho("edit-a-file: changing window to #".g:netrw_chgwin,'~'.expand("<slnum>")) if winnr("$")+1 == g:netrw_chgwin " if g:netrw_chgwin is set to one more than the last window, then " vertically split the last window to make that window available. let curwin= winnr() - exe "keepj keepalt ".g:netrw_chgwin."wincmd ".winnr("$") + exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" vs - exe "keepj keepalt ".g:netrw_chgwin."wincmd ".curwin + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin endif - exe "keepj keepalt ".g:netrw_chgwin."wincmd w" + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" endif + call s:SetRexDir(a:islocal,curdir) endif endif @@ -4373,41 +4666,39 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will " no keepalt to support :e # to return to a directory listing if a:islocal -" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname)) +" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("<slnum>")) " some like c-^ to return to the last edited file " others like c-^ to return to the netrw buffer if exists("g:netrw_altfile") && g:netrw_altfile - exe "keepj keepalt e! ".fnameescape(dirname) + exe "NetrwKeepj keepalt e! ".fnameescape(dirname) else - exe "keepj e! ".fnameescape(dirname) + exe "NetrwKeepj e! ".fnameescape(dirname) endif -" call Decho("after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) +" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("<slnum>")) call s:NetrwCursor() -" call Decho("COMBAK#1: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) if &hidden || &bufhidden == "hide" " file came from vim's hidden storage. Don't "restore" options with it. let dorestore= 0 endif else -" call Decho("edit-a-file: remote file: NetrwBrowse will edit it") +" call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("<slnum>")) endif let dolockout= 1 -" call Decho("COMBAK#2: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) " handle g:Netrw_funcref -- call external-to-netrw functions " This code will handle g:Netrw_funcref as an individual function reference " or as a list of function references. It will ignore anything that's not " a function reference. See :help Funcref for information about function references. if exists("g:Netrw_funcref") -" call Decho("edit-a-file: handle optional Funcrefs") +" call Decho("edit-a-file: handle optional Funcrefs",'~'.expand("<slnum>")) if type(g:Netrw_funcref) == 2 -" call Decho("edit-a-file: handling a g:Netrw_funcref") - keepj call g:Netrw_funcref() +" call Decho("edit-a-file: handling a g:Netrw_funcref",'~'.expand("<slnum>")) + NetrwKeepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 -" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs") +" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("<slnum>")) for Fncref in g:Netrw_funcref if type(FncRef) == 2 - keepj call FncRef() + NetrwKeepj call FncRef() endif endfor endif @@ -4418,42 +4709,44 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ---------------------------------------------------- " NetrwBrowseChgDir: just go to the new directory spec {{{3 " ---------------------------------------------------- -" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>') - let dirname = newdir - keepj call s:SetRexDir(a:islocal,dirname) - keepj call s:NetrwOptionRestore("s:") +" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("<slnum>")) + let dirname = newdir + NetrwKeepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:NetrwOptionRestore("s:") + norm! m` elseif newdir == './' " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- -" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"') - keepj call s:SetRexDir(a:islocal,dirname) +" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("<slnum>")) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm! m` elseif newdir == '../' " -------------------------------------- " NetrwBrowseChgDir: go up one directory {{{3 " -------------------------------------- -" call Decho('go-up: case "go up one directory": newdir == "../"') +" call Decho('go-up: case "go up one directory": newdir == "../"','~'.expand("<slnum>")) if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh -" call Decho("go-up: clear buffer<".expand("%")."> with :%d") -" call Decho("go-up: setl noro ma") +" call Decho("go-up: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) +" call Decho("go-up: setl noro ma",'~'.expand("<slnum>")) setl noro ma - keepj %d + NetrwKeepj %d _ endif if has("amiga") " amiga -" call Decho('go-up: case "go up one directory": newdir == "../" and amiga') +" call Decho('go-up: case "go up one directory": newdir == "../" and amiga','~'.expand("<slnum>")) if a:islocal let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') let dirname= substitute(dirname,'/$','','') else let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') endif -" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " windows @@ -4463,88 +4756,96 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif if dirname =~ '^\a:$' let dirname= dirname.'/' endif -" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) else " unix or cygwin -" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin') +" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("<slnum>")) if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif -" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) endif - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " -------------------------------------- " NetrwBrowseChgDir: Handle Tree Listing {{{3 " -------------------------------------- -" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists') - " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) -" call Decho("tree-list: setl noro ma") +" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("<slnum>")) + " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh) +" call Decho("tree-list: setl noro ma",'~'.expand("<slnum>")) setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("tree-list: clear buffer<".expand("%")."> with :%d") - keepj %d +" call Decho("tree-list: clear buffer<".expand("%")."> with :%d (force refresh)",'~'.expand("<slnum>")) + NetrwKeepj %d _ endif - let treedir = s:NetrwTreeDir() - let s:treecurpos = nbcd_curpos - let haskey= 0 -" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">") + let treedir = s:NetrwTreeDir(a:islocal) +" call Decho("tree-list: treedir<".treedir.">",'~'.expand("<slnum>")) + let s:treecurpos = winsaveview() + let haskey = 0 +" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>")) " search treedict for tree dir as-is +" call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("<slnum>")) if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>")) let haskey= 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif - " search treedict for treedir with a / appended - if !haskey && treedir !~ '/$' + " search treedict for treedir with a [/@] appended +" call Decho("tree-list: search treedict for treedir with a [/@] appended",'~'.expand("<slnum>")) + if !haskey && treedir !~ '[/@]$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("<slnum>")) endif endif " search treedict for treedir with any trailing / elided +" call Decho("tree-list: search treedict for treedir with any trailing / elided",'~'.expand("<slnum>")) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif endif +" call Decho("haskey=".haskey,'~'.expand("<slnum>")) if haskey " close tree listing for selected subdirectory -" call Decho("tree-list: closing selected subdirectory<".dirname.">") +" call Decho("tree-list: closing selected subdirectory<".dirname.">",'~'.expand("<slnum>")) call remove(w:netrw_treedict,treedir) -" call Decho("tree-list: removed entry<".treedir."> from treedict") -" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">") +" call Decho("tree-list: removed entry<".treedir."> from treedict",'~'.expand("<slnum>")) +" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>")) let dirname= w:netrw_treetop else " go down one directory let dirname= substitute(treedir,'/*$','/','') -" call Decho("tree-list: go down one dir: treedir<".treedir.">") +" call Decho("tree-list: go down one dir: treedir<".treedir.">",'~'.expand("<slnum>")) +" call Decho("tree-list: ... : dirname<".dirname.">",'~'.expand("<slnum>")) endif - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) +" call Decho("setting s:treeforceredraw to true",'~'.expand("<slnum>")) let s:treeforceredraw = 1 else @@ -4552,38 +4853,37 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: Go down one directory {{{3 " ---------------------------------------- let dirname = s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") - keepj call s:SetRexDir(a:islocal,dirname) +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("<slnum>")) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` endif " -------------------------------------- " NetrwBrowseChgDir: Restore and Cleanup {{{3 " -------------------------------------- -" call Decho("COMBAK#3: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) if dorestore " dorestore is zero'd when a local file was hidden or bufhidden; " in such a case, we want to keep whatever settings it may have. -" call Decho("doing option restore (dorestore=".dorestore.")") - keepj call s:NetrwOptionRestore("s:") +" call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwOptionRestore("s:") " else " Decho -" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod) +" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("<slnum>")) endif -" call Decho("COMBAK#4: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) + call s:RestorePosn(s:netrw_nbcd) if dolockout && dorestore -" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname)) +" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("<slnum>")) if filewritable(dirname) -" call Decho("restore: doing modification lockout settings: ma nomod noro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: doing modification lockout settings: ma nomod noro",'~'.expand("<slnum>")) +" call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>")) setl ma noro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) else -" call Decho("restore: doing modification lockout settings: ma nomod ro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: doing modification lockout settings: ma nomod ro",'~'.expand("<slnum>")) +" call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>")) setl ma ro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif endif -" call Decho("COMBAK#5: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) let @@= ykeep " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") @@ -4596,14 +4896,28 @@ endfun " for tree, keeps cursor on current filename fun! s:NetrwBrowseUpDir(islocal) " call Dfunc("s:NetrwBrowseUpDir(islocal=".a:islocal.")") + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1 + " this test needed because occasionally this function seems to be incorrectly called + " when multiple leftmouse clicks are taken when atop the one line help in the banner. + " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty + " directories. +" call Dret("s:NetrwBrowseUpDir : cursor not in file area") + return + endif + + if !exists("w:netrw_liststyle") || w:netrw_liststyle != s:TREELIST + call s:SavePosn(s:netrw_nbcd) + endif + norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho("ftp + treestyle") +" call Decho("case: treestyle",'~'.expand("<slnum>")) let curline= getline(".") let swwline= winline() - 1 if exists("w:netrw_treetop") let b:netrw_curdir= w:netrw_treetop endif + let curdir= b:netrw_curdir if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else @@ -4611,63 +4925,86 @@ fun! s:NetrwBrowseUpDir(islocal) endif if !search('\c^'.s:treedepthstring.curline,'cw') if !search('\c^'.curline,'cw') - sil! keepj 1 + sil! NetrwKeepj 1 endif endif - exe "sil! keepj norm! z\<cr>" + exe "sil! NetrwKeepj norm! z\<cr>" while winline() < swwline let curwinline= winline() - exe "sil! keepj norm! \<c-y>" + exe "sil! NetrwKeepj norm! \<c-y>" if curwinline == winline() break endif endwhile else -" call Decho("ftp + not treestyle") +" call Decho("case: not treestyle",'~'.expand("<slnum>")) + if exists("b:netrw_curdir") + let curdir= b:netrw_curdir + else + let curdir= expand(getcwd()) + endif if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif - if exists("w:netrw_bannercnt") -" call Decho("moving to line#".w:netrw_bannercnt) + if has_key(s:netrw_nbcd,bufnr("%")) + call s:RestorePosn(s:netrw_nbcd) + elseif exists("w:netrw_bannercnt") +" call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("<slnum>")) exe w:netrw_bannercnt else 1 endif endif + let curdir= substitute(curdir,'^.*[\/]','','') + call search('\<'.curdir.'\>','wc') " call Dret("s:NetrwBrowseUpDir") endfun " --------------------------------------------------------------------- -" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 +" netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 " given filename; typically this means given their extension. " 0=local, 1=remote -fun! netrw#NetrwBrowseX(fname,remote) -" call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") +fun! netrw#BrowseX(fname,remote) +" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")") + + " if its really just a directory, then do a "gf" instead + if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && fname =~ '/$' && fname !~ '^https\=:') + norm! gf +" call Dret("netrw#BrowseX : did gf instead") + endif + let ykeep = @@ - let screenposn = netrw#SavePosn() + let screenposn = winsaveview() +" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + + " need to save and restore aw setting as gx can invoke this function from non-netrw buffers + let awkeep = &aw + set noaw " special core dump handler if a:fname =~ '/core\(\.\d\+\)\=$' if exists("g:Netrw_corehandler") if type(g:Netrw_corehandler) == 2 " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref") - call g:Netrw_corehandler(a:fname) +" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("<slnum>")) + call g:Netrw_corehandler(s:NetrwFile(a:fname)) elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List") +" call Decho("g:Netrw_corehandler is a List",'~'.expand("<slnum>")) for Fncref in g:Netrw_corehandler if type(FncRef) == 2 call FncRef(a:fname) endif endfor endif - call netrw#RestorePosn(screenposn) +" call Decho("restoring posn to screenposn<".string(screenposn).">,'~'.expand("<slnum>"))" + call winrestview(screenposn) let @@= ykeep -" call Dret("NetrwBrowseX : coredump handler invoked") + let &aw= awkeep +" call Dret("netrw#BrowseX : coredump handler invoked") return endif endif @@ -4678,33 +5015,18 @@ fun! netrw#NetrwBrowseX(fname,remote) if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif -" call Decho("exten<".exten.">") - - " seems kde systems often have gnome-open due to dependencies, even though - " gnome-open's subsidiary display tools are largely absent. Kde systems - " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) - if !exists("s:haskdeinit") - if has("unix") && executable("ps") && !has("win32unix") - let s:haskdeinit= system("ps -e") =~ 'kdeinit' - if v:shell_error - let s:haskdeinit = 0 - endif - else - let s:haskdeinit= 0 - endif -" call Decho("setting s:haskdeinit=".s:haskdeinit) - endif +" call Decho("exten<".exten.">",'~'.expand("<slnum>")) if a:remote == 1 " create a local copy -" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">") +" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("<slnum>")) setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">") -" call Decho("newname <".newname.">") +" call Decho("basename<".basename.">",'~'.expand("<slnum>")) +" call Decho("newname <".newname.">",'~'.expand("<slnum>")) if rename(s:netrw_tmpfile,newname) == 0 " renaming succeeded let fname= newname @@ -4713,35 +5035,38 @@ fun! netrw#NetrwBrowseX(fname,remote) let fname= s:netrw_tmpfile endif else -" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">") +" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("<slnum>")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler') - let fname= substitute(fname,'^\~',expand("$HOME"),'') +" call Decho('invoking special ~ handler','~'.expand("<slnum>")) + let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) endif endif -" call Decho("fname<".fname.">") -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>")) - " set up redirection - if &srr =~ "%s" - if (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= substitute(&srr,"%s","nul","") + " set up redirection (avoids browser messages) + " by default, g:netrw_suppress_gx_mesg is true + if g:netrw_suppress_gx_mesg + if &srr =~ "%s" + if (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= substitute(&srr,"%s","nul","") + else + let redir= substitute(&srr,"%s","/dev/null","") + endif + elseif (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= &srr . "nul" else - let redir= substitute(&srr,"%s","/dev/null","") + let redir= &srr . "/dev/null" endif - elseif (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= &srr . "nul" - else - let redir= &srr . "/dev/null" endif -" call Decho("set up redirection: redir{".redir."} srr{".&srr."}") +" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>")) " extract any viewing options. Assumes that they're set apart by quotes. -" call Decho("extract any viewing options") +" call Decho("extract any viewing options",'~'.expand("<slnum>")) if exists("g:netrw_browsex_viewer") -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -4752,35 +5077,32 @@ fun! netrw#NetrwBrowseX(fname,remote) let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " let cnt = cnt + 1 let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endwhile else let viewer = g:netrw_browsex_viewer let viewopt = "" endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endif " execute the file handler -" call Decho("execute the file handler (if any)") +" call Decho("execute the file handler (if any)",'~'.expand("<slnum>")) if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) let ret= netrwFileHandlers#Invoke(exten,fname) elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") -" call Decho("exe sil !".viewer." ".viewopt.shellescape(fname,1).redir) - exe "sil !".viewer." ".viewopt.shellescape(fname,1).redir +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) + call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) if executable("start") -" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) elseif executable("rundll32") -" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif @@ -4789,35 +5111,37 @@ fun! netrw#NetrwBrowseX(fname,remote) elseif has("win32unix") let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') -" call Decho("cygwin: winfname<".shellescape(winfname,1).">") +" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>")) if executable("start") -" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) - exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("rundll32") -" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) - exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) + elseif executable("cygstart") + call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif call inputsave()|call input("Press <cr> to continue")|call inputrestore() let ret= v:shell_error - elseif has("unix") && executable("xdg-open") && !s:haskdeinit -" call Decho("unix and xdg-open") -" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir) - exe "sil !xdg-open ".shellescape(fname,1).redir + elseif has("unix") && executable("kfmclient") && s:CheckIfKde() +" call Decho("unix and kfmclient",'~'.expand("<slnum>")) + call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir) + let ret= v:shell_error + + elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid") +" call Decho("unix, exo-open, xdg-open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error - elseif has("unix") && executable("kfmclient") && s:haskdeinit -" call Decho("unix and kfmclient") -" call Decho("exe sil !kfmclient exec ".shellescape(fname,1)." ".redir) - exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir + elseif has("unix") && executable("xdg-open") +" call Decho("unix and xdg-open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("macunix") && executable("open") -" call Decho("macunix and open") -" call Decho("exe sil !open ".shellescape(fname,1)." ".redir) - exe "sil !open ".shellescape(fname,1)." ".redir +" call Decho("macunix and open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error else @@ -4839,7 +5163,7 @@ fun! netrw#NetrwBrowseX(fname,remote) " Feb 12, 2008: had to de-activiate removal of " temporary file because it wasn't getting seen. " if a:remote == 1 && fname != a:fname -"" call Decho("deleting temporary file<".fname.">") +"" call Decho("deleting temporary file<".fname.">",'~'.expand("<slnum>")) " call s:NetrwDelete(fname) " endif @@ -4848,13 +5172,40 @@ fun! netrw#NetrwBrowseX(fname,remote) if g:netrw_use_noswf setl noswf endif - exe "sil! keepj norm! \<c-o>" + exe "sil! NetrwKeepj norm! \<c-o>" " redraw! endif - call netrw#RestorePosn(screenposn) - let @@= ykeep +" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + call winrestview(screenposn) + let @@ = ykeep + let &aw= awkeep + +" call Dret("netrw#BrowseX") +endfun + +" --------------------------------------------------------------------- +" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2 +fun! netrw#BrowseXVis() +" call Dfunc("netrw#BrowseXVis()") + let atkeep = @@ + norm! gvy +" call Decho("@@<".@@.">",'~'.expand("<slnum>")) + call netrw#BrowseX(@@,netrw#CheckIfRemote()) + let @@ = atkeep +" call Dret("netrw#BrowseXVis") +endfun -" call Dret("NetrwBrowseX") +" --------------------------------------------------------------------- +" netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 +fun! netrw#CheckIfRemote() +" call Dfunc("netrw#CheckIfRemote()") + if expand("%") =~ '^\a\{3,}://' +" call Dret("netrw#CheckIfRemote 1") + return 1 + else +" call Dret("netrw#CheckIfRemote 0") + return 0 + endif endfun " --------------------------------------------------------------------- @@ -4865,20 +5216,45 @@ fun! s:NetrwChgPerm(islocal,curdir) call inputsave() let newperm= input("Enter new permission: ") call inputrestore() - let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',shellescape(expand("<cfile>")),'') - let chgperm= substitute(chgperm,'\<PERM\>',shellescape(newperm),'') -" call Decho("chgperm<".chgperm.">") + let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',s:ShellEscape(expand("<cfile>")),'') + let chgperm= substitute(chgperm,'\<PERM\>',s:ShellEscape(newperm),'') +" call Decho("chgperm<".chgperm.">",'~'.expand("<slnum>")) call system(chgperm) if v:shell_error != 0 - keepj call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75) + NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75) endif if a:islocal - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) endif let @@= ykeep " call Dret("s:NetrwChgPerm") endfun +" --------------------------------------------------------------------- +" s:CheckIfKde: checks if kdeinit is running {{{2 +" Returns 0: kdeinit not running +" 1: kdeinit is running +fun! s:CheckIfKde() +" call Dfunc("s:CheckIfKde()") + " seems kde systems often have gnome-open due to dependencies, even though + " gnome-open's subsidiary display tools are largely absent. Kde systems + " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) + if !exists("s:haskdeinit") + if has("unix") && executable("ps") && !has("win32unix") + let s:haskdeinit= system("ps -e") =~ '\<kdeinit' + if v:shell_error + let s:haskdeinit = 0 + endif + else + let s:haskdeinit= 0 + endif +" call Decho("setting s:haskdeinit=".s:haskdeinit,'~'.expand("<slnum>")) + endif + +" call Dret("s:CheckIfKde ".s:haskdeinit) + return s:haskdeinit +endfun + " --------------------------------------------------------------------- " s:NetrwClearExplore: clear explore variables (if any) {{{2 fun! s:NetrwClearExplore() @@ -4931,7 +5307,7 @@ fun! s:NetrwForceChgDir(islocal,newdir) else let newdir= a:newdir.'/' endif -" call Decho("adjusting newdir<".newdir."> due to gd") +" call Decho("adjusting newdir<".newdir."> due to gd",'~'.expand("<slnum>")) else " should already be getting treatment as a directory let newdir= a:newdir @@ -4942,6 +5318,43 @@ fun! s:NetrwForceChgDir(islocal,newdir) " call Dret("s:NetrwForceChgDir") endfun +" --------------------------------------------------------------------- +" s:NetrwGlob: does glob() if local, remote listing otherwise {{{2 +" direntry: this is the name of the directory. Will be fnameescape'd to prevent wildcard handling by glob() +" expr : this is the expression to follow the directory. Will use s:ComposePath() +" pare =1: remove the current directory from the resulting glob() filelist +" =0: leave the current directory in the resulting glob() filelist +fun! s:NetrwGlob(direntry,expr,pare) +" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr."> pare=".a:pare.")") + if netrw#CheckIfRemote() + keepalt 1sp + keepalt enew + let keep_liststyle = w:netrw_liststyle + let w:netrw_liststyle = s:THINLIST + if s:NetrwRemoteListing() == 0 + keepj keepalt %s@/@@ + let filelist= getline(1,$) + q! + else + " remote listing error -- leave treedict unchanged + let filelist= w:netrw_treedict[a:direntry] + endif + let w:netrw_liststyle= keep_liststyle + elseif v:version > 704 || (v:version == 704 && has("patch656")) + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif + else + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif + endif +" call Dret("s:NetrwGlob ".string(filelist)) + return filelist +endfun + " --------------------------------------------------------------------- " s:NetrwForceFile: (gf support) Force treatment as a file {{{2 fun! s:NetrwForceFile(islocal,newfile) @@ -4969,21 +5382,22 @@ endfun fun! s:NetrwHide(islocal) " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide) let ykeep= @@ - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">") -" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("<slnum>")) +" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) " hide the files in the markfile list for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk) +" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk,'~'.expand("<slnum>")) if match(g:netrw_list_hide,'\<'.fname.'\>') != -1 " remove fname from hiding list let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','') let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g') let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','') -" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) else " append fname to hiding list if exists("g:netrw_list_hide") && g:netrw_list_hide != "" @@ -4991,38 +5405,68 @@ fun! s:NetrwHide(islocal) else let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>' endif -" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) endif endfor - keepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) let g:netrw_hide= 1 else " switch between show-all/show-not-hidden/show-hidden let g:netrw_hide=(g:netrw_hide+1)%3 - exe "keepj norm! 0" + exe "NetrwKeepj norm! 0" if g:netrw_hide && g:netrw_list_hide == "" - keepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) let @@= ykeep " call Dret("NetrwHide") return endif endif - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwHide") endfun +" --------------------------------------------------------------------- +" s:NetrwHideEdit: allows user to edit the file/directory hiding list {{{2 +fun! s:NetrwHideEdit(islocal) +" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") + + let ykeep= @@ + " save current cursor position + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + + " get new hiding list from user + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + let g:netrw_list_hide= newhide +" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) + + " refresh the listing + sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + + " restore cursor position +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) + let @@= ykeep + +" call Dret("NetrwHideEdit") +endfun + " --------------------------------------------------------------------- " s:NetrwHidden: invoked by "gh" {{{2 fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") let ykeep= @@ " save current position - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+' " remove pattern from hiding list @@ -5034,8 +5478,9 @@ fun! s:NetrwHidden(islocal) endif " refresh screen and return to saved position - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("s:NetrwHidden") endfun @@ -5048,9 +5493,9 @@ fun! s:NetrwHome() else " go to vim plugin home for home in split(&rtp,',') + [''] - if isdirectory(home) && filewritable(home) | break | endif + if isdirectory(s:NetrwFile(home)) && filewritable(s:NetrwFile(home)) | break | endif let basehome= substitute(home,'[/\\]\.vim$','','') - if isdirectory(basehome) && filewritable(basehome) + if isdirectory(s:NetrwFile(basehome)) && filewritable(s:NetrwFile(basehome)) let home= basehome."/.vim" break endif @@ -5064,9 +5509,9 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists - if g:netrw_dirhistmax > 0 && !isdirectory(home) + if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home)) if exists("g:netrw_mkdir") - call system(g:netrw_mkdir." ".shellescape(home)) + call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home))) else call mkdir(home) endif @@ -5093,41 +5538,176 @@ fun! s:NetrwLeftmouse(islocal) let mouse_lnum = v:mouse_lnum let wlastline = line('w$') let lastline = line('$') -" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr()) -" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0)) +" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr(),'~'.expand("<slnum>")) +" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0),'~'.expand("<slnum>")) if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() " appears to be a status bar leftmouse click let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click") return endif - " NOTE: following test is preventing leftmouse selection/deselection of directories and files in treelist mode (Dec 04, 2013) + " Dec 04, 2013: following test prevents leftmouse selection/deselection of directories and files in treelist mode " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar - " without this test. -" if v:mouse_col != col('.') -" let @@= ykeep -" call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") -" return -" endif + " without this test when its disabled. + " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop. +" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$"),'~'.expand("<slnum>")) + if v:mouse_col > virtcol('.') + let @@= ykeep +" call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") + return + endif if a:islocal if exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) endif else if exists("b:netrw_curdir") - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) endif endif let @@= ykeep " call Dret("s:NetrwLeftmouse") endfun +" --------------------------------------------------------------------- +" s:NetrwCLeftmouse: used to select a file/directory for a target {{{2 +fun! s:NetrwCLeftmouse(islocal) +" call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")") + call s:NetrwMarkFileTgt(a:islocal) +" call Dret("s:NetrwCLeftmouse") +endfun + +" --------------------------------------------------------------------- +" s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements <c-r>){{{2 +" a:islocal=0 : <c-r> not used, remote +" a:islocal=1 : <c-r> no used, local +" a:islocal=2 : <c-r> used, remote +" a:islocal=3 : <c-r> used, local +fun! s:NetrwServerEdit(islocal,fname) +" call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)") + let islocal = a:islocal%2 " =0: remote =1: local + let ctrlr = a:islocal >= 2 " =0: <c-r> not used =1: <c-r> used +" call Decho("islocal=".islocal." ctrlr=".ctrlr,'~'.expand("<slnum>")) + + if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$') + " handle directories in the local window -- not in the remote vim server + " user must have closed the NETRWSERVER window. Treat as normal editing from netrw. +" call Decho("handling directory in client window",'~'.expand("<slnum>")) + let g:netrw_browse_split= 0 + if exists("s:netrw_browse_split") && exists("s:netrw_browse_split_".winnr()) + let g:netrw_browse_split= s:netrw_browse_split_{winnr()} + unlet s:netrw_browse_split_{winnr()} + endif + call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) +" call Dret("s:NetrwServerEdit") + return + endif + +" call Decho("handling file in server window",'~'.expand("<slnum>")) + if has("clientserver") && executable("gvim") +" call Decho("has clientserver and gvim",'~'.expand("<slnum>")) + + if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3 +" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split),'~'.expand("<slnum>")) + let srvrname = g:netrw_browse_split[0] + let tabnum = g:netrw_browse_split[1] + let winnum = g:netrw_browse_split[2] + + if serverlist() !~ '\<'.srvrname.'\>' +" call Decho("server not available; ctrlr=".ctrlr,'~'.expand("<slnum>")) + + if !ctrlr + " user must have closed the server window and the user did not use <c-r>, but + " used something like <cr>. +" call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>")) + if exists("g:netrw_browse_split") + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= 0 + if exists("s:netrw_browse_split_".winnr()) + let g:netrw_browse_split= s:netrw_browse_split_{winnr()} + endif + call s:NetrwBrowseChgDir(islocal,a:fname) +" call Dret("s:NetrwServerEdit") + return + + elseif has("win32") && executable("start") + " start up remote netrw server under windows +" call Decho("starting up gvim server<".srvrname."> for windows",'~'.expand("<slnum>")) + call system("start gvim --servername ".srvrname) + + else + " start up remote netrw server under linux +" call Decho("starting up gvim server<".srvrname.">",'~'.expand("<slnum>")) + call system("gvim --servername ".srvrname) + endif + endif + +" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">",'~'.expand("<slnum>")) + call remote_send(srvrname,":tabn ".tabnum."\<cr>") + call remote_send(srvrname,":".winnum."wincmd w\<cr>") + call remote_send(srvrname,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>") + + else + + if serverlist() !~ '\<'.g:netrw_servername.'\>' + + if !ctrlr +" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>")) + if exists("g:netrw_browse_split") + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= 0 + call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) +" call Dret("s:NetrwServerEdit") + return + + else +" call Decho("server<".g:netrw_servername."> not available but ctrl-r used",'~'.expand("<slnum>")) + if has("win32") && executable("start") + " start up remote netrw server under windows +" call Decho("starting up gvim server<".g:netrw_servername."> for windows",'~'.expand("<slnum>")) + call system("start gvim --servername ".g:netrw_servername) + else + " start up remote netrw server under linux +" call Decho("starting up gvim server<".g:netrw_servername.">",'~'.expand("<slnum>")) + call system("gvim --servername ".g:netrw_servername) + endif + endif + endif + + while 1 + try +" call Decho("remote-send: e ".a:fname,'~'.expand("<slnum>")) + call remote_send(g:netrw_servername,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>") + break + catch /^Vim\%((\a\+)\)\=:E241/ + sleep 200m + endtry + endwhile + + if exists("g:netrw_browse_split") + if type(g:netrw_browse_split) != 3 + let s:netrw_browse_split_{winnr()}= g:netrw_browse_split + endif + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= [g:netrw_servername,1,1] + endif + + else + call netrw#ErrorMsg(s:ERROR,"you need a gui-capable vim and client-server to use <ctrl-r>",98) + endif + +" call Dret("s:NetrwServerEdit") +endfun + " --------------------------------------------------------------------- " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 fun! s:NetrwSLeftmouse(islocal) " call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")") - + let s:ngw= s:NetrwGetWord() call s:NetrwMarkFile(a:islocal,s:ngw) @@ -5177,7 +5757,7 @@ endfun " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() -" call Dfunc("NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") let ykeep= @@ " find a character not in the "hide" string to use as a separator for :g and :v commands @@ -5186,7 +5766,7 @@ fun! s:NetrwListHide() " string. Use the first character left as a separator character. let listhide= g:netrw_list_hide let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) -" call Decho("sep=".sep) +" call Decho("sep=".sep,'~'.expand("<slnum>")) while listhide != "" if listhide =~ ',' @@ -5199,74 +5779,29 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 -" call Decho("hiding<".hide."> listhide<".listhide.">") - exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' +" call Decho("hiding<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 -" call Decho("showing<".hide."> listhide<".listhide.">") - exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' +" call Decho("showing<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile if g:netrw_hide == 2 - exe 'sil! keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' - exe 'sil! keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' endif " remove any blank lines that have somehow remained. " This seems to happen under Windows. - exe 'sil! keepj 1,$g@^\s*$@d' - - let @@= ykeep -" call Dret("NetrwListHide") -endfun - -" --------------------------------------------------------------------- -" NetrwHideEdit: allows user to edit the file/directory hiding list -fun! s:NetrwHideEdit(islocal) -" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") - - let ykeep= @@ - " save current cursor position - let svpos= netrw#SavePosn() - - " get new hiding list from user - call inputsave() - let newhide= input("Edit Hiding List: ",g:netrw_list_hide) - call inputrestore() - let g:netrw_list_hide= newhide -" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") - - " refresh the listing - sil keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + exe 'sil! NetrwKeepj 1,$g@^\s*$@d' - " restore cursor position - call netrw#RestorePosn(svpos) let @@= ykeep - -" call Dret("NetrwHideEdit") -endfun - -" --------------------------------------------------------------------- -" NetSortSequence: allows user to edit the sorting sequence -fun! s:NetSortSequence(islocal) -" call Dfunc("NetSortSequence(islocal=".a:islocal.")") - - let ykeep= @@ - let svpos= netrw#SavePosn() - call inputsave() - let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) - call inputrestore() - - " refresh the listing - let g:netrw_sort_sequence= newsortseq - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) - let @@= ykeep - -" call Dret("NetSortSequence") +" call Dret("s:NetrwListHide") endfun " --------------------------------------------------------------------- " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2 +" implements the "d" mapping. fun! s:NetrwMakeDir(usrhost) " call Dfunc("s:NetrwMakeDir(usrhost<".a:usrhost.">)") @@ -5277,7 +5812,7 @@ fun! s:NetrwMakeDir(usrhost) call inputsave() let newdirname= input("Please give directory name: ") call inputrestore() -" call Decho("newdirname<".newdirname.">") +" call Decho("newdirname<".newdirname.">",'~'.expand("<slnum>")) if newdirname == "" let @@= ykeep @@ -5286,15 +5821,15 @@ fun! s:NetrwMakeDir(usrhost) endif if a:usrhost == "" -" call Decho("local mkdir") +" call Decho("local mkdir",'~'.expand("<slnum>")) " Local mkdir: " sanity checks let fullnewdir= b:netrw_curdir.'/'.newdirname -" call Decho("fullnewdir<".fullnewdir.">") - if isdirectory(fullnewdir) +" call Decho("fullnewdir<".fullnewdir.">",'~'.expand("<slnum>")) + if isdirectory(s:NetrwFile(fullnewdir)) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif let @@= ykeep " call Dret("s:NetrwMakeDir : directory<".newdirname."> exists previously") @@ -5302,7 +5837,7 @@ fun! s:NetrwMakeDir(usrhost) endif if s:FileReadable(fullnewdir) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) endif let @@= ykeep " call Dret("s:NetrwMakeDir : file<".newdirname."> exists previously") @@ -5320,27 +5855,28 @@ fun! s:NetrwMakeDir(usrhost) else let netrw_origdir= s:NetrwGetcwd(1) call s:NetrwLcd(b:netrw_curdir) -" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") -" call Decho("exe sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) - exe "sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1) +" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("<slnum>")) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) if v:shell_error != 0 let @@= ykeep call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) +" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) return endif if !g:netrw_keepdir -" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir) +" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>")) call s:NetrwLcd(netrw_origdir) endif endif if v:shell_error == 0 " refresh listing -" call Decho("refresh listing") - let svpos= netrw#SavePosn() +" call Decho("refresh listing",'~'.expand("<slnum>")) + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26) endif @@ -5348,48 +5884,53 @@ fun! s:NetrwMakeDir(usrhost) elseif !exists("b:netrw_method") || b:netrw_method == 4 " Remote mkdir: using ssh -" call Decho("remote mkdir") +" call Decho("remote mkdir",'~'.expand("<slnum>")) let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname -" call Decho("exe sil! !".mkdircmd." ".shellescape(newdirname,1)) - exe "sil! !".mkdircmd." ".shellescape(newdirname,1) + call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1)) if v:shell_error == 0 " refresh listing - let svpos= netrw#SavePosn() - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) endif " redraw! elseif b:netrw_method == 2 " Remote mkdir: using ftp+.netrc - let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let remotepath= b:netrw_fname else let remotepath= "" endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) elseif b:netrw_method == 3 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) - let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let remotepath= b:netrw_fname else let remotepath= "" endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif let @@= ykeep @@ -5403,22 +5944,30 @@ fun! s:TreeSqueezeDir(islocal) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " its a tree-listing style let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') - let iline = line(".") - 1 let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1) -" call Decho("curdepth=".curdepth) -" call Decho("stopline#".stopline) -" call Decho("starting with line#".line(".").": ".getline('.')) - while iline > stopline - " find a line that has less depth - let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("considering line#".line(".").": ".getline('.')) - if depth < curdepth - break - endif - norm! k - endwhile -" call Decho("squeezing at line#".line(".").": ".getline('.')) - call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) + let depth = strchars(substitute(curdepth,' ','','g')) + let srch = -1 +" call Decho("curdepth<".curdepth.'>','~'.expand("<slnum>")) +" call Decho("depth =".depth,'~'.expand("<slnum>")) +" call Decho("stopline#".stopline,'~'.expand("<slnum>")) +" call Decho("curline#".line(".")."<".getline('.').'>','~'.expand("<slnum>")) + if depth >= 2 + NetrwKeepj norm! 0 + let curdepthm1= substitute(curdepth,'^'.s:treedepthstring,'','') + let srch = search('^'.curdepthm1.'\%('.s:treedepthstring.'\)\@!','bW',stopline) +" call Decho("curdepthm1<".curdepthm1.'>','~'.expand("<slnum>")) +" call Decho("case depth>=2: srch<".srch.'>','~'.expand("<slnum>")) + elseif depth == 1 + NetrwKeepj norm! 0 + let treedepthchr= substitute(s:treedepthstring,' ','','') + let srch = search('^[^'.treedepthchr.']','bW',stopline) +" call Decho("case depth==1: srch<".srch.'>','~'.expand("<slnum>")) + endif + if srch > 0 +" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) + call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) + exe srch + endif endif " call Dret("s:TreeSqueezeDir") endfun @@ -5429,349 +5978,384 @@ fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") if g:netrw_mousemaps && g:netrw_retmap -" call Decho("set up Rexplore 2-leftmouse") +" call Decho("set up Rexplore 2-leftmouse",'~'.expand("<slnum>")) if !hasmapto("<Plug>NetrwReturn") if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' -" call Decho("making map for 2-leftmouse") +" call Decho("making map for 2-leftmouse",'~'.expand("<slnum>")) nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn elseif maparg("<c-leftmouse>","n") == "" -" call Decho("making map for c-leftmouse") +" call Decho("making map for c-leftmouse",'~'.expand("<slnum>")) nmap <unique> <silent> <c-leftmouse> <Plug>NetrwReturn endif endif nno <silent> <Plug>NetrwReturn :Rexplore<cr> -" call Decho("made <Plug>NetrwReturn map") +" call Decho("made <Plug>NetrwReturn map",'~'.expand("<slnum>")) endif if a:islocal -" call Decho("make local maps") +" call Decho("make local maps",'~'.expand("<slnum>")) " local normal-mode maps - nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr> - nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr> - nnoremap <buffer> <silent> c :call <SID>NetrwLcd(b:netrw_curdir)<cr> - nnoremap <buffer> <silent> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <s-cr> :call <SID>TreeSqueezeDir(1)<cr> - nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr> - nnoremap <buffer> <silent> - :call <SID>NetrwBrowseUpDir(1)<cr> - nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(1)<cr> - nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(1)<cr> - nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr> - nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr> - nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr> - nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr> - nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr> - nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr> - nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr> - nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> - nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr> - nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> - nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr> - nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr> - nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(1)<cr> - nnoremap <buffer> <silent> mX :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - nnoremap <buffer> <silent> O :call <SID>NetrwObtain(1)<cr> - nnoremap <buffer> <silent> o :call <SID>NetrwSplit(3)<cr> - nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(1)<cr> - nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> - nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> - nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(1)<cr> - nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr> - nnoremap <buffer> <silent> t :call <SID>NetrwSplit(4)<cr> - nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> - nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> - nnoremap <buffer> <silent> v :call <SID>NetrwSplit(5)<cr> - nnoremap <buffer> <silent> x :call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> - nnoremap <buffer> <silent> X :call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> - " local insert-mode maps - inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(1)<cr> - inoremap <buffer> <silent> c <c-o>:exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr> - inoremap <buffer> <silent> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> - inoremap <buffer> <silent> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(1)<cr> - inoremap <buffer> <silent> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> - inoremap <buffer> <silent> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <s-cr> <c-o>:call <SID>TreeSqueezeDir(1)<cr> - inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr> - inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> - inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(1)<cr> - inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> - inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> - inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> - inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> - inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> - inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> - inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> - inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> - inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> - inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> - inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> - inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> - inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1)<cr> - inoremap <buffer> <silent> mX <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(1)<cr> - inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(3)<cr> - inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> - inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> - inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(1)<cr> - inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(1)<cr> - inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(4)<cr> - inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> - inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> - inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(5)<cr> - inoremap <buffer> <silent> x <c-o>:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(1)<cr> + nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(1)<cr> + nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(1)<cr> + nnoremap <buffer> <silent> <nowait> c :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> d :<c-u>call <SID>NetrwMakeDir("")<cr> + nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr> + nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(1,0)<cr> + nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(1,1)<cr> + nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr> + nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr> + nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr> + nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr> + nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr> + nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr> + nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr> + nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> + nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr> + nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> + nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr> + nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> + nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> + nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> + nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr> + nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(1)<cr> + nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(3)<cr> + nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(1)<cr> + nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> + nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> + nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(1)<cr> + nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> + nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(4)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> + nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> + nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr> + nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + nnoremap <buffer> <silent> <nowait> X :<c-u>call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> +" " local insert-mode maps +" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr> +" inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> +" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr> +" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> +" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> +" inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr> +" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> +" nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> +" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr> +" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> +" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> +" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> +" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> +" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> +" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> +" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> +" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> +" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> +" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> +" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> +" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> +" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> +" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> +" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> +" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> +" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr> +" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr> +" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> +" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> +" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> +" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> +" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> +" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr> +" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr> +" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr> +" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> +" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr> +" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> +" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> +" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr> +" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit - imap <buffer> <unique> <c-h> <Plug>NetrwHideEdit +" imap <buffer> <unique> <c-h> <c-o><Plug>NetrwHideEdit endif - nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh - imap <buffer> <unique> <c-l> <Plug>NetrwRefresh +" imap <buffer> <unique> <c-l> <c-o><Plug>NetrwRefresh endif - nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> <Plug>NetrwRefresh <c-l>:call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr> if s:didstarstar || !mapcheck("<s-down>","n") nnoremap <buffer> <silent> <s-down> :Nexplore<cr> - inoremap <buffer> <silent> <s-down> :Nexplore<cr> +" inoremap <buffer> <silent> <s-down> <c-o>:Nexplore<cr> endif if s:didstarstar || !mapcheck("<s-up>","n") nnoremap <buffer> <silent> <s-up> :Pexplore<cr> - inoremap <buffer> <silent> <s-up> :Pexplore<cr> +" inoremap <buffer> <silent> <s-up> <c-o>:Pexplore<cr> endif + if !hasmapto('<Plug>NetrwTreeSqueeze') + nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze +" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze + endif + nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(1)<cr> let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 - nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse - nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse + nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr> nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse - nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> + nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag - nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse - nmap <buffer> <silent> <Plug>Netrw2Leftmouse - + nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> +" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> +" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> +" imap <buffer> <s-leftmouse> <Plug>ISLeftmouse +" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - endif - exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr>' - exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr>' +" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + endif + exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> + " support user-specified maps + call netrw#UserMaps(1) + else " remote -" call Decho("make remote maps") +" call Decho("make remote maps",'~'.expand("<slnum>")) call s:RemotePathAnalysis(b:netrw_curdir) " remote normal-mode maps - nnoremap <buffer> <silent> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <s-cr> :call <SID>TreeSqueezeDir(0)<cr> - nnoremap <buffer> <silent> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> - :call <SID>NetrwBrowseUpDir(0)<cr> - nnoremap <buffer> <silent> a :call <SID>NetrwHide(0)<cr> - nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr> - nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> - nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> - nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr> - nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr> - nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr> - nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr> - nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> - nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr> - nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> - nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr> - nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr> - nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(0)<cr> - nnoremap <buffer> <silent> mX :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> - nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(0)<cr> - nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(0)<cr> - nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> o :call <SID>NetrwSplit(0)<cr> - nnoremap <buffer> <silent> O :call <SID>NetrwObtain(0)<cr> - nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(0)<cr> - nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> - nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(0)<cr> - nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr> - nnoremap <buffer> <silent> t :call <SID>NetrwSplit(1)<cr> - nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> v :call <SID>NetrwSplit(2)<cr> - nnoremap <buffer> <silent> x :call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(0)<cr> - " remote insert-mode maps - inoremap <buffer> <silent> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - inoremap <buffer> <silent> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> - inoremap <buffer> <silent> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> - inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(0)<cr> - inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> - inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> - inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> - inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> - inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> - inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> - inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> - inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> - inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> - inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> - inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> - inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> - inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0)<cr> - inoremap <buffer> <silent> mX <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> - inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> - inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(0)<cr> - inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(0)<cr> - inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(0)<cr> - inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> - inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> - inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(0)<cr> - inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(0)<cr> - inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(1)<cr> - inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(2)<cr> - inoremap <buffer> <silent> x <c-o>:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(0)<cr> + nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(0)<cr> + nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(0)<cr> + nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(0)<cr> + nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <nowait> <c-l> :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr> + nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(0)<cr> + nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(0,0)<cr> + nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(0,1)<cr> + nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr> + nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> + nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> + nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr> + nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr> + nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr> + nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr> + nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> + nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr> + nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> + nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr> + nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> + nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> + nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> + nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr> + nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(0)<cr> + nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr> + nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(0)<cr> + nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> + nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr> + nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr> + nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(0)<cr> + nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(0,'b',v:count1)<cr> + nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(0,'h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr> + nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> +" " remote insert-mode maps +" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> +" inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> +" inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> +" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> +" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr> +" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> +" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> +" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> +" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> +" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> +" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> +" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> +" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> +" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> +" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> +" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> +" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> +" nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> +" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> +" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> +" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> +" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> +" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> +" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> +" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr> +" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> +" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr> +" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr> +" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> +" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> +" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> +" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr> +" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> +" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr> +" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr> +" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr> +" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> +" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> +" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr> +" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> +" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <c-h> <Plug>NetrwHideEdit - imap <buffer> <c-h> <Plug>NetrwHideEdit +" imap <buffer> <c-h> <Plug>NetrwHideEdit endif nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <c-l> <Plug>NetrwRefresh - imap <buffer> <c-l> <Plug>NetrwRefresh +" imap <buffer> <c-l> <Plug>NetrwRefresh + endif + if !hasmapto('<Plug>NetrwTreeSqueeze') + nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze +" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze endif + nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(0)<cr> let mapsafepath = escape(s:path, s:netrw_map_escape) - let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape) + let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape) nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> if g:netrw_mousemaps == 1 - nmap <leftmouse> <Plug>NetrwLeftmouse - nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> - nmap <buffer> <leftdrag> <Plug>NetrwLeftdrag - nno <buffer> <silent> <Plug>NetrwLeftdrag :call <SID>NetrwLeftdrag(0)<cr> - nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr> - nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag - nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr> - nmap <middlemouse> <Plug>NetrwMiddlemouse - nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> - nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse - nmap <buffer> <silent> <Plug>Netrw2Leftmouse - - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> - imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> - imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> + nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse + nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(0)<cr> + nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr> + nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr> + nmap <middlemouse> <Plug>NetrwMiddlemouse + nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> + nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse + nmap <buffer> <silent> <Plug>Netrw2Leftmouse - + imap <buffer> <leftmouse> <Plug>ILeftmouse +" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> + imap <buffer> <middlemouse> <Plug>IMiddlemouse +" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> + imap <buffer> <s-leftmouse> <Plug>ISLeftmouse +" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - endif - exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' - exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' - exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + endif + exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> - inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> - endif +" inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> - keepj call s:SetRexDir(a:islocal,b:netrw_curdir) + " support user-specified maps + call netrw#UserMaps(0) + endif " call Dret("s:NetrwMaps") endfun " --------------------------------------------------------------------- -" s:NetrwCommands: sets up commands available only in the netrw buffer windows {{{2 +" s:NetrwCommands: set up commands {{{2 +" If -buffer, the command is only available from within netrw buffers +" Otherwise, the command is available from any window, so long as netrw +" has been used at least once in the session. fun! s:NetrwCommands(islocal) " call Dfunc("s:NetrwCommands(islocal=".a:islocal.")") - com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"not a former netrw window",79)|endif + com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(<bang>0,<f-args>) + com! -nargs=* NetrwC call s:NetrwSetChgwin(<q-args>) + com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"win#".winnr()." not a former netrw window",79)|endif if a:islocal - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,<f-args>) + com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,<f-args>) else - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,<f-args>) + com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,<f-args>) endif - com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget(<q-args>) + com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget(<q-args>) " call Dret("s:NetrwCommands") endfun @@ -5781,16 +6365,21 @@ endfun " glob()ing only works with local files fun! s:NetrwMarkFiles(islocal,...) " call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0) - let i = 1 + let curdir = s:NetrwGetCurdir(a:islocal) + let i = 1 while i <= a:0 if a:islocal - let mffiles= glob(a:{i},0,1) + if v:version > 704 || (v:version == 704 && has("patch656")) + let mffiles= glob(fnameescape(a:{i}),0,1,1) + else + let mffiles= glob(fnameescape(a:{i}),0,1) + endif else let mffiles= [a:{i}] endif -" call Decho("mffiles".string(mffiles)) +" call Decho("mffiles".string(mffiles),'~'.expand("<slnum>")) for mffile in mffiles -" call Decho("mffile<".mffile.">") +" call Decho("mffile<".mffile.">",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,mffile) endfor let i= i + 1 @@ -5799,21 +6388,25 @@ fun! s:NetrwMarkFiles(islocal,...) endfun " --------------------------------------------------------------------- -" s:NetrwMarkTarget: {{{2 +" s:NetrwMarkTarget: implements :MT (mark target) {{{2 fun! s:NetrwMarkTarget(...) " call Dfunc("s:NetrwMarkTarget() a:0=".a:0) if a:0 == 0 || (a:0 == 1 && a:1 == "") - let tgt= b:netrw_curdir + let curdir = s:NetrwGetCurdir(1) + let tgt = b:netrw_curdir else - let tgt= a:1 + let curdir = s:NetrwGetCurdir((a:1 =~ '^\a\{3,}://')? 0 : 1) + let tgt = a:1 endif -" call Decho("tgt<".tgt.">") +" call Decho("tgt<".tgt.">",'~'.expand("<slnum>")) let s:netrwmftgt = tgt - let s:netrwmftgt_islocal = tgt !~ '^\a\+://' - let curislocal = b:netrw_curdir !~ '^\a\+://' - let svpos = netrw#SavePosn() + let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://' + let curislocal = b:netrw_curdir !~ '^\a\{3,}://' + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) " call Dret("s:NetrwMarkTarget") endfun @@ -5836,16 +6429,17 @@ endfun " b:netrw_islocal fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") +" call Decho("bufnr(%)=".bufnr("%").": ".bufname("%"),'~'.expand("<slnum>")) " sanity check if empty(a:fname) " call Dret("s:NetrwMarkFile : emtpy fname") return endif + let curdir = s:NetrwGetCurdir(a:islocal) let ykeep = @@ let curbufnr= bufnr("%") - let curdir = b:netrw_curdir if a:fname =~ '^\a' let leader= '\<' else @@ -5857,29 +6451,30 @@ fun! s:NetrwMarkFile(islocal,fname) let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' endif - if exists("s:netrwmarkfilelist_{curbufnr}") + if exists("s:netrwmarkfilelist_".curbufnr) " markfile list pre-exists -" call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("case s:netrwmarkfilelist_".curbufnr." already exists",'~'.expand("<slnum>")) +" call Decho("starting s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) +" call Decho("starting s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>")) let b:netrw_islocal= a:islocal if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1 " append filename to buffer's markfilelist -" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) call add(s:netrwmarkfilelist_{curbufnr},a:fname) let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(a:fname,g:netrw_markfileesc).trailer else " remove filename from buffer's markfilelist -" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname') if s:netrwmarkfilelist_{curbufnr} == [] " local markfilelist is empty; remove it entirely -" call Decho("markfile list now empty") +" call Decho("markfile list now empty",'~'.expand("<slnum>")) call s:NetrwUnmarkList(curbufnr,curdir) else " rebuild match list to display markings correctly -" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr) +" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr,'~'.expand("<slnum>")) let s:netrwmarkfilemtch_{curbufnr}= "" let first = 1 for fname in s:netrwmarkfilelist_{curbufnr} @@ -5890,17 +6485,18 @@ fun! s:NetrwMarkFile(islocal,fname) endif let first= 0 endfor -" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) endif endif else " initialize new markfilelist +" call Decho("case: initialize new markfilelist",'~'.expand("<slnum>")) -" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr) +" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr,'~'.expand("<slnum>")) let s:netrwmarkfilelist_{curbufnr}= [] - call add(s:netrwmarkfilelist_{curbufnr},a:fname) -" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") + call add(s:netrwmarkfilelist_{curbufnr},substitute(a:fname,'[|@]$','','')) +" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) " build initial markfile matching pattern if a:fname =~ '/$' @@ -5908,7 +6504,7 @@ fun! s:NetrwMarkFile(islocal,fname) else let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc).trailer endif -" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>")) endif " handle global markfilelist @@ -5917,12 +6513,12 @@ fun! s:NetrwMarkFile(islocal,fname) if index(s:netrwmarkfilelist,dname) == -1 " append new filename to global markfilelist call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">") +" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) else " remove new filename from global markfilelist -" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")") +" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>")) call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"') -" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">") +" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif @@ -5931,23 +6527,65 @@ fun! s:NetrwMarkFile(islocal,fname) " initialize new global-directory markfilelist let s:netrwmarkfilelist= [] call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">") +" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) endif - " set up 2match'ing to netrwmarkfilemtch list + " set up 2match'ing to netrwmarkfilemtch_# list if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("<slnum>")) if exists("g:did_drchip_netrwlist_syntax") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" endif else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("<slnum>")) 2match none endif let @@= ykeep " call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") endfun +" --------------------------------------------------------------------- +" s:NetrwMarkFileArgList: ma: move the marked file list to the argument list (tomflist=0) {{{2 +" mA: move the argument list to marked file list (tomflist=1) +" Uses the global marked file list +fun! s:NetrwMarkFileArgList(islocal,tomflist) +" call Dfunc("s:NetrwMarkFileArgList(islocal=".a:islocal.",tomflist=".a:tomflist.")") + + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) + let curbufnr = bufnr("%") + + if a:tomflist + " mA: move argument list to marked file list + while argc() + let fname= argv(0) +" call Decho("exe argdel ".fname,'~'.expand("<slnum>")) + exe "argdel ".fnameescape(fname) + call s:NetrwMarkFile(a:islocal,fname) + endwhile + + else + " ma: move marked file list to argument list + if exists("s:netrwmarkfilelist") + + " for every filename in the marked list + for fname in s:netrwmarkfilelist +" call Decho("exe argadd ".fname,'~'.expand("<slnum>")) + exe "argadd ".fnameescape(fname) + endfor " for every file in the marked list + + " unmark list and refresh + call s:NetrwUnmarkList(curbufnr,curdir) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) + endif + endif + +" call Dret("s:NetrwMarkFileArgList") +endfun + " --------------------------------------------------------------------- " s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2 " compress/decompress files using the programs @@ -5958,44 +6596,45 @@ endfun " g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf", ".xz" : "unxz"} fun! s:NetrwMarkFileCompress(islocal) " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileCompress") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress") " for every filename in the marked list for fname in s:netrwmarkfilelist_{curbufnr} let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') -" call Decho("extracted sfx<".sfx.">") +" call Decho("extracted sfx<".sfx.">",'~'.expand("<slnum>")) if exists("g:netrw_decompress['".sfx."']") " fname has a suffix indicating that its compressed; apply associated decompression routine let exe= g:netrw_decompress[sfx] -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") +" call Decho("fname<".fname."> is compressed so decompress with <".exe.">",'~'.expand("<slnum>")) let exe= netrw#WinPath(exe) if a:islocal if g:netrw_keepdir - let fname= shellescape(s:ComposePath(curdir,fname)) + let fname= s:ShellEscape(s:ComposePath(curdir,fname)) endif else - let fname= shellescape(b:netrw_curdir.fname,1) + let fname= s:ShellEscape(b:netrw_curdir.fname,1) endif if executable(exe) if a:islocal call system(exe." ".fname) else - keepj call s:RemoteSystem(exe." ".fname) + NetrwKeepj call s:RemoteSystem(exe." ".fname) endif else - keepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) endif endif unlet sfx @@ -6004,16 +6643,17 @@ fun! s:NetrwMarkFileCompress(islocal) unlet exe elseif a:islocal " fname not a compressed file, so compress it - call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) + call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - keepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) + NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname)) endif endfor " for every file in the marked list call s:NetrwUnmarkList(curbufnr,curdir) - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif " call Dret("s:NetrwMarkFileCompress") endfun @@ -6028,31 +6668,33 @@ endfun fun! s:NetrwMarkFileCopy(islocal,...) " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") - endif - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") + if b:netrw_curdir !~ '/$' + if !exists("b:netrw_curdir") + let b:netrw_curdir= curdir + endif + let b:netrw_curdir= b:netrw_curdir."/" + endif " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileCopy") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if !exists("s:netrwmftgt") - keepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) - if a:islocal && s:netrwmftgt_islocal + if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory -" call Decho("copy from local to local") +" call Decho("copy from local to local",'~'.expand("<slnum>")) if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s' call netrw#ErrorMsg(s:ERROR,"g:netrw_localcopycmd<".g:netrw_localcopycmd."> not executable on your system, aborting",91) " call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!") @@ -6063,14 +6705,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 " only one marked file - let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) +" call Decho("case: only one marked file",'~'.expand("<slnum>")) + let args = s:ShellEscape(b:netrw_curdir.s:netrwmarkfilelist_{bufnr('%')}[0]) let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] elseif a:0 == 1 +" call Decho("case: handling one input argument",'~'.expand("<slnum>")) " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() - let args = shellescape(b:netrw_curdir."/".a:1) + let args = s:ShellEscape(b:netrw_curdir.a:1) let oldname = a:1 else " copy multiple marked files inside the same directory +" call Decho("case: handling a multiple marked files",'~'.expand("<slnum>")) let s:recursive= 1 for oldname in s:netrwmarkfilelist_{bufnr("%")} let ret= s:NetrwMarkFileCopy(a:islocal,oldname) @@ -6091,47 +6736,71 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif - let args= shellescape(oldname) - let tgt = shellescape(s:netrwmftgt.'/'.newname) + let args= s:ShellEscape(oldname) + let tgt = s:ShellEscape(s:netrwmftgt.'/'.newname) else - let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) - let tgt = shellescape(s:netrwmftgt) + let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)")) + let tgt = s:ShellEscape(s:netrwmftgt) endif if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let args= substitute(args,'/','\\','g') let tgt = substitute(tgt, '/','\\','g') endif + if args =~ "'" |let args= substitute(args,"'\\(.*\\)'",'\1','')|endif + if tgt =~ "'" |let tgt = substitute(tgt ,"'\\(.*\\)'",'\1','')|endif + if args =~ '//'|let args= substitute(args,'//','/','g')|endif + if tgt =~ '//'|let tgt = substitute(tgt ,'//','/','g')|endif +" call Decho("args <".args.">",'~'.expand("<slnum>")) +" call Decho("tgt <".tgt.">",'~'.expand("<slnum>")) + if isdirectory(s:NetrwFile(args)) +" call Decho("args<".args."> is a directory",'~'.expand("<slnum>")) + let copycmd= g:netrw_localcopydircmd +" call Decho("using copydircmd<".copycmd.">",'~'.expand("<slnum>")) + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's + " contents to a target. One must append the source directory name to the target to get xcopy to + " do the right thing. + let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','') +" call Decho("modified tgt for xcopy",'~'.expand("<slnum>")) + endif + else + let copycmd= g:netrw_localcopycmd + endif if g:netrw_localcopycmd =~ '\s' - let copycmd = substitute(g:netrw_localcopycmd,'\s.*$','','') - let copycmdargs = substitute(g:netrw_localcopycmd,'^.\{-}\(\s.*\)$','\1','') + let copycmd = substitute(copycmd,'\s.*$','','') + let copycmdargs = substitute(copycmd,'^.\{-}\(\s.*\)$','\1','') let copycmd = netrw#WinPath(copycmd).copycmdargs else - let copycmd = netrw#WinPath(g:netrw_localcopycmd) + let copycmd = netrw#WinPath(copycmd) endif -" call Decho("args <".args.">") -" call Decho("tgt <".tgt.">") -" call Decho("copycmd<".copycmd.">") -" call Decho("system(".copycmd." ".args." ".tgt.")") - call system(copycmd." ".args." ".tgt) +" call Decho("args <".args.">",'~'.expand("<slnum>")) +" call Decho("tgt <".tgt.">",'~'.expand("<slnum>")) +" call Decho("copycmd<".copycmd.">",'~'.expand("<slnum>")) +" call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("<slnum>")) + call system(copycmd." '".args."' '".tgt."'") if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) -" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",101) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) + endif +" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".s:ShellEscape(s:netrwmftgt)) return 0 endif elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory -" call Decho("copy from local to remote") - keepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) +" call Decho("copy from local to remote",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && s:netrwmftgt_islocal " Copy marked files, remote directory to local directory -" call Decho("copy from remote to local") - keepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) +" call Decho("copy from remote to local",'~'.expand("<slnum>")) + NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && !s:netrwmftgt_islocal " Copy marked files, remote directory to remote directory -" call Decho("copy from remote to remote") +" call Decho("copy from remote to remote",'~'.expand("<slnum>")) let curdir = getcwd() let tmpdir = s:GetTempfile("") if tmpdir !~ '/' @@ -6140,28 +6809,34 @@ fun! s:NetrwMarkFileCopy(islocal,...) if exists("*mkdir") call mkdir(tmpdir) else - exe "sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) ) +" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) ) return endif endif - if isdirectory(tmpdir) + if isdirectory(s:NetrwFile(tmpdir)) call s:NetrwLcd(tmpdir) - keepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) + NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') - keepj call s:NetrwUpload(localfiles,s:netrwmftgt) + NetrwKeepj call s:NetrwUpload(localfiles,s:netrwmftgt) if getcwd() == tmpdir for fname in s:netrwmarkfilelist_{bufnr('%')} - keepj call s:NetrwDelete(fname) + NetrwKeepj call s:NetrwDelete(fname) endfor call s:NetrwLcd(curdir) - exe "sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) - if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) ) - return + if v:version < 704 || !has("patch1109") + call s:NetrwExe("sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) +" " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) + return + endif + else + if delete(tmpdir,"d") + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103) + endif endif else call s:NetrwLcd(curdir) @@ -6172,23 +6847,42 @@ fun! s:NetrwMarkFileCopy(islocal,...) " ------- " cleanup " ------- -" call Decho("cleanup") - if !exists("s:recursive") - " remove markings from local buffer - call s:NetrwUnmarkList(curbufnr,curdir) - endif - - " refresh buffers - if !s:netrwmftgt_islocal - call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) - endif - if a:islocal - keepj call s:NetrwRefreshDir(a:islocal,curdir) +" call Decho("cleanup",'~'.expand("<slnum>")) + " remove markings from local buffer + call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer +" call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("<slnum>")) +" call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("<slnum>")) +" call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>")) +" call Decho(" curdir =".curdir,'~'.expand("<slnum>")) +" call Decho(" a:islocal =".a:islocal,'~'.expand("<slnum>")) +" call Decho(" curbufnr =".curbufnr,'~'.expand("<slnum>")) + if exists("s:recursive") +" call Decho(" s:recursive =".s:recursive,'~'.expand("<slnum>")) + else +" call Decho(" s:recursive =n/a",'~'.expand("<slnum>")) endif + " see s:LocalFastBrowser() for g:netrw_fastbrowse interpretation (refreshing done for both slow and medium) if g:netrw_fastbrowse <= 1 - keepj call s:LocalBrowseRefresh() + NetrwKeepj call s:LocalBrowseRefresh() + else + " refresh local and targets for fast browsing + if !exists("s:recursive") + " remove markings from local buffer +" call Decho(" remove markings from local buffer",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwUnmarkList(curbufnr,curdir) + endif + + " refresh buffers + if s:netrwmftgt_islocal +" call Decho(" refresh s:netrwmftgt=".s:netrwmftgt,'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) + endif + if a:islocal && s:netrwmftgt != curdir +" call Decho(" refresh curdir=".curdir,'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir) + endif endif - + " call Dret("s:NetrwMarkFileCopy 1") return 1 endfun @@ -6204,26 +6898,26 @@ fun! s:NetrwMarkFileDiff(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileDiff") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + let curdir= s:NetrwGetCurdir(a:islocal) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{".curbufnr."}") let cnt = 0 - let curdir = b:netrw_curdir for fname in s:netrwmarkfilelist let cnt= cnt + 1 if cnt == 1 -" call Decho("diffthis: fname<".fname.">") - exe "e ".fnameescape(fname) +" call Decho("diffthis: fname<".fname.">",'~'.expand("<slnum>")) + exe "NetrwKeepj e ".fnameescape(fname) diffthis elseif cnt == 2 || cnt == 3 vsplit wincmd l -" call Decho("diffthis: ".fname) - exe "e ".fnameescape(fname) +" call Decho("diffthis: ".fname,'~'.expand("<slnum>")) + exe "NetrwKeepj e ".fnameescape(fname) diffthis else break @@ -6241,16 +6935,16 @@ endfun fun! s:NetrwMarkFileEdit(islocal) " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileEdit") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:SetRexDir(a:islocal,curdir) @@ -6258,16 +6952,16 @@ fun! s:NetrwMarkFileEdit(islocal) " unmark markedfile list " call s:NetrwUnmarkList(curbufnr,curdir) call s:NetrwUnmarkAll() -" call Decho("exe sil args ".flist) +" call Decho("exe sil args ".flist,'~'.expand("<slnum>")) exe "sil args ".flist endif echo "(use :bn, :bp to navigate files; :Rex to return)" - + " call Dret("s:NetrwMarkFileEdit") endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileQFEL: convert a quickfix-error list into a marked file list {{{2 +" s:NetrwMarkFileQFEL: convert a quickfix-error or location list into a marked file list {{{2 fun! s:NetrwMarkFileQFEL(islocal,qfel) " call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)") call s:NetrwUnmarkAll() @@ -6276,17 +6970,17 @@ fun! s:NetrwMarkFileQFEL(islocal,qfel) if !empty(a:qfel) for entry in a:qfel let bufnmbr= entry["bufnr"] -" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"]) +" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"],'~'.expand("<slnum>")) if !exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("case: no marked file list") +" call Decho("case: no marked file list",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1 " s:NetrwMarkFile will remove duplicate entries from the marked file list. " So, this test lets two or more hits on the same pattern to be ignored. -" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list") +" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) else -" call Decho("case: ".bufname(bufnmbr)." already in marked file list") +" call Decho("case: ".bufname(bufnmbr)." already in marked file list",'~'.expand("<slnum>")) endif endfor echo "(use me to edit marked files)" @@ -6298,73 +6992,110 @@ fun! s:NetrwMarkFileQFEL(islocal,qfel) endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileExe: (invoked by mx) execute arbitrary system command on marked files, one at a time {{{2 -" Uses the local marked-file list. -fun! s:NetrwMarkFileExe(islocal) -" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir +" s:NetrwMarkFileExe: (invoked by mx and mX) execute arbitrary system command on marked files {{{2 +" mx enbloc=0: Uses the local marked-file list, applies command to each file individually +" mX enbloc=1: Uses the global marked-file list, applies command to entire list +fun! s:NetrwMarkFileExe(islocal,enbloc) +" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileExe") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) - - if exists("s:netrwmarkfilelist_{curbufnr}") - " get the command - call inputsave() - let cmd= input("Enter command: ","","file") - call inputrestore() -" call Decho("cmd<".cmd.">") - if cmd == "" -" " call Dret("s:NetrwMarkFileExe : early exit, empty command") - return - endif + if a:enbloc == 0 + " individually apply command to files, one at a time + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileExe") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) - " apply command to marked files. Substitute: filename -> % - " If no %, then append a space and the filename to the command - for fname in s:netrwmarkfilelist_{curbufnr} - if a:islocal - if g:netrw_keepdir - let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + if exists("s:netrwmarkfilelist_{curbufnr}") + " get the command + call inputsave() + let cmd= input("Enter command: ","","file") + call inputrestore() +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) + if cmd == "" +" call Dret("s:NetrwMarkFileExe : early exit, empty command") + return endif - else - let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) - endif - if cmd =~ '%' - let xcmd= substitute(cmd,'%',fname,'g') - else - let xcmd= cmd.' '.fname - endif - if a:islocal -" call Decho("local: xcmd<".xcmd.">") - let ret= system(xcmd) - else -" call Decho("remote: xcmd<".xcmd.">") - let ret= s:RemoteSystem(xcmd) - endif - if v:shell_error < 0 - keepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) - break - else - echo ret - endif - endfor + + " apply command to marked files, individually. Substitute: filename -> % + " If no %, then append a space and the filename to the command + for fname in s:netrwmarkfilelist_{curbufnr} + if a:islocal + if g:netrw_keepdir + let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) + endif + else + let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) + endif + if cmd =~ '%' + let xcmd= substitute(cmd,'%',fname,'g') + else + let xcmd= cmd.' '.fname + endif + if a:islocal +" call Decho("local: xcmd<".xcmd.">",'~'.expand("<slnum>")) + let ret= system(xcmd) + else +" call Decho("remote: xcmd<".xcmd.">",'~'.expand("<slnum>")) + let ret= s:RemoteSystem(xcmd) + endif + if v:shell_error < 0 + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) + break + else + echo ret + endif + endfor " unmark marked file list call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif - + + else " apply command to global list of files, en bloc + + call inputsave() + let cmd= input("Enter command: ","","file") + call inputrestore() +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) + if cmd == "" +" call Dret("s:NetrwMarkFileExe : early exit, empty command") + return + endif + if cmd =~ '%' + let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' '),'g') + else + let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' ') + endif + if a:islocal + call system(cmd) + if v:shell_error < 0 + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) + endif + else + let ret= s:RemoteSystem(cmd) + endif + call s:NetrwUnmarkAll() + + " refresh the listing + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) + + endif + " call Dret("s:NetrwMarkFileExe") endfun @@ -6374,14 +7105,15 @@ endfun " Uses the local marked file list. fun! s:NetrwMarkHideSfx(islocal) " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") " s:netrwmarkfilelist_{curbufnr}: the List of marked files if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6401,7 +7133,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -6416,38 +7148,40 @@ fun! s:NetrwMarkHideSfx(islocal) endfor " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkHideSfx") endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileVimCmd: (invoked by mX) execute arbitrary vim command on marked files, one at a time {{{2 +" s:NetrwMarkFileVimCmd: (invoked by mv) execute arbitrary vim command on marked files, one at a time {{{2 " Uses the local marked-file list. fun! s:NetrwMarkFileVimCmd(islocal) " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileVimCmd") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter vim command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) if cmd == "" " " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command") return @@ -6456,16 +7190,16 @@ fun! s:NetrwMarkFileVimCmd(islocal) " apply command to marked files. Substitute: filename -> % " If no %, then append a space and the filename to the command for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) if a:islocal 1split - exe "sil! keepalt e ".fnameescape(fname) -" call Decho("local<".fname.">: exe ".cmd) + exe "sil! NetrwKeepj keepalt e ".fnameescape(fname) +" call Decho("local<".fname.">: exe ".cmd,'~'.expand("<slnum>")) exe cmd exe "sil! keepalt wq!" else -" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET") - echo "sorry, \"mX\" not supported yet for remote files" +" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET",'~'.expand("<slnum>")) + echo "sorry, \"mv\" not supported yet for remote files" endif endfor @@ -6473,12 +7207,13 @@ fun! s:NetrwMarkFileVimCmd(islocal) call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif - + " call Dret("s:NetrwMarkFileVimCmd") endfun @@ -6488,14 +7223,15 @@ endfun " Uses the local marked file list. fun! s:NetrwMarkHideSfx(islocal) " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") " s:netrwmarkfilelist_{curbufnr}: the List of marked files if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6515,7 +7251,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -6530,10 +7266,11 @@ fun! s:NetrwMarkHideSfx(islocal) endfor " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkHideSfx") @@ -6544,15 +7281,17 @@ endfun " Uses the global markfilelist fun! s:NetrwMarkFileGrep(islocal) " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") + let curdir = s:NetrwGetCurdir(a:islocal) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) call s:NetrwUnmarkAll() else -" call Decho('no marked files, using "*"') +" call Decho('no marked files, using "*"','~'.expand("<slnum>")) let netrwmarkfilelist= "*" endif @@ -6563,7 +7302,7 @@ fun! s:NetrwMarkFileGrep(islocal) let patbang = "" if pat =~ '^!' let patbang = "!" - let pat= strpart(pat,2) + let pat = strpart(pat,2) endif if pat =~ '^\i' let pat = escape(pat,'/') @@ -6573,23 +7312,24 @@ fun! s:NetrwMarkFileGrep(islocal) endif " use vimgrep for both local and remote -" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) +" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist,'~'.expand("<slnum>")) try - exe "keepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist + exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist catch /^Vim\%((\a\+)\)\=:E480/ - keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) " call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">") return endtry echo "(use :cn, :cp to navigate, :Rex to return)" 2match none - keepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident -" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg") - if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' +" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("<slnum>")) + if pat =~# nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' call s:NetrwMarkFileQFEL(a:islocal,getqflist()) endif endif @@ -6604,70 +7344,74 @@ endfun " = 1: target directory is local fun! s:NetrwMarkFileMove(islocal) " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileMove") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if !exists("s:netrwmftgt") - keepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) + NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) if a:islocal && s:netrwmftgt_islocal " move: local -> local -" call Decho("move from local to local") -" call Decho("local to local move") +" call Decho("move from local to local",'~'.expand("<slnum>")) +" call Decho("local to local move",'~'.expand("<slnum>")) if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^'.expand("$COMSPEC").'\s' call netrw#ErrorMsg(s:ERROR,"g:netrw_localmovecmd<".g:netrw_localmovecmd."> not executable on your system, aborting",90) " call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!") return endif - let tgt = shellescape(s:netrwmftgt) -" call Decho("tgt<".tgt.">") + let tgt = s:ShellEscape(s:netrwmftgt) +" call Decho("tgt<".tgt.">",'~'.expand("<slnum>")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let tgt = substitute(tgt, '/','\\','g') -" call Decho("windows exception: tgt<".tgt.">") +" call Decho("windows exception: tgt<".tgt.">",'~'.expand("<slnum>")) if g:netrw_localmovecmd =~ '\s' let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','') let movecmd = netrw#WinPath(movecmd).movecmdargs -" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)") +" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("<slnum>")) else let movecmd = netrw#WinPath(movecmd) -" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)") +" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("<slnum>")) endif else let movecmd = netrw#WinPath(g:netrw_localmovecmd) -" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)") +" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)",'~'.expand("<slnum>")) endif for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".movecmd." ".shellescape(fname)." ".tgt.")") if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let fname= substitute(fname,'/','\\','g') endif - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".tgt) +" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>")) + let ret= system(movecmd." ".s:ShellEscape(fname)." ".tgt) if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",100) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + endif break endif endfor elseif a:islocal && !s:netrwmftgt_islocal " move: local -> remote -" call Decho("move from local to remote") -" call Decho("copy") +" call Decho("move from local to remote",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1) @@ -6676,11 +7420,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && s:netrwmftgt_islocal " move: remote -> local -" call Decho("move from remote to local") -" call Decho("copy") +" call Decho("move from remote to local",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -6689,11 +7433,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && !s:netrwmftgt_islocal " move: remote -> remote -" call Decho("move from remote to remote") -" call Decho("copy") +" call Decho("move from remote to remote",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -6704,25 +7448,25 @@ fun! s:NetrwMarkFileMove(islocal) " ------- " cleanup " ------- -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("<slnum>")) " remove markings from local buffer call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer " refresh buffers if !s:netrwmftgt_islocal -" call Decho("refresh netrwmftgt<".s:netrwmftgt.">") - keepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) +" call Decho("refresh netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal -" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">") - keepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) +" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif if g:netrw_fastbrowse <= 1 -" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh") - keepj call s:LocalBrowseRefresh() +" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh",'~'.expand("<slnum>")) + NetrwKeepj call s:LocalBrowseRefresh() endif - + " call Dret("s:NetrwMarkFileMove") endfun @@ -6735,14 +7479,15 @@ fun! s:NetrwMarkFilePrint(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFilePrint") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -6754,9 +7499,9 @@ fun! s:NetrwMarkFilePrint(islocal) endif 1split " the autocmds will handle both local and remote files -" call Decho("exe sil e ".escape(fname,' ')) - exe "sil e ".fnameescape(fname) -" call Decho("hardcopy") +" call Decho("exe sil e ".escape(fname,' '),'~'.expand("<slnum>")) + exe "sil NetrwKeepj e ".fnameescape(fname) +" call Decho("hardcopy",'~'.expand("<slnum>")) hardcopy q endfor @@ -6778,57 +7523,62 @@ fun! s:NetrwMarkFileRegexp(islocal) call inputrestore() if a:islocal + let curdir= s:NetrwGetCurdir(a:islocal) " get the matching list of files using local glob() -" call Decho("handle local regexp") +" call Decho("handle local regexp",'~'.expand("<slnum>")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let files = glob(s:ComposePath(dirname,regexp)) -" call Decho("files<".files.">") + if v:version > 704 || (v:version == 704 && has("patch656")) + let files = glob(s:ComposePath(dirname,regexp),0,0,1) + else + let files = glob(s:ComposePath(dirname,regexp),0,0) + endif +" call Decho("files<".files.">",'~'.expand("<slnum>")) let filelist= split(files,"\n") " mark the list of files for fname in filelist -" call Decho("fname<".fname.">") - keepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) endfor else -" call Decho("handle remote regexp") +" call Decho("handle remote regexp",'~'.expand("<slnum>")) " convert displayed listing into a filelist let eikeep = &ei let areg = @a - sil keepj %y a + sil NetrwKeepj %y a setl ei=all ma -" call Decho("setl ei=all ma") +" call Decho("setl ei=all ma",'~'.expand("<slnum>")) 1split - keepj call s:NetrwEnew() - keepj call s:NetrwSafeOptions() - sil keepj norm! "ap - keepj 2 + NetrwKeepj call s:NetrwEnew() + NetrwKeepj call s:NetrwSafeOptions() + sil NetrwKeepj norm! "ap + NetrwKeepj 2 let bannercnt= search('^" =====','W') - exe "sil keepj 1,".bannercnt."d" + exe "sil NetrwKeepj 1,".bannercnt."d" setl bt=nofile if g:netrw_liststyle == s:LONGLIST - sil keepj %s/\s\{2,}\S.*$//e + sil NetrwKeepj %s/\s\{2,}\S.*$//e call histdel("/",-1) elseif g:netrw_liststyle == s:WIDELIST - sil keepj %s/\s\{2,}/\r/ge + sil NetrwKeepj %s/\s\{2,}/\r/ge call histdel("/",-1) elseif g:netrw_liststyle == s:TREELIST - exe 'sil keepj %s/^'.s:treedepthstring.' //e' - sil! keepj g/^ .*$/d + exe 'sil NetrwKeepj %s/^'.s:treedepthstring.' //e' + sil! NetrwKeepj g/^ .*$/d call histdel("/",-1) call histdel("/",-1) endif " convert regexp into the more usual glob-style format let regexp= substitute(regexp,'\*','.*','g') -" call Decho("regexp<".regexp.">") - exe "sil! keepj v/".escape(regexp,'/')."/d" +" call Decho("regexp<".regexp.">",'~'.expand("<slnum>")) + exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d" call histdel("/",-1) let filelist= getline(1,line("$")) q! for filename in filelist - keepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) endfor unlet filelist let @a = areg @@ -6848,14 +7598,15 @@ fun! s:NetrwMarkFileSource(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileSource") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -6866,7 +7617,7 @@ fun! s:NetrwMarkFileSource(islocal) let fname= curdir.fname endif " the autocmds will handle sourcing both local and remote files -" call Decho("exe so ".fnameescape(fname)) +" call Decho("exe so ".fnameescape(fname),'~'.expand("<slnum>")) exe "so ".fnameescape(fname) endfor 2match none @@ -6879,26 +7630,27 @@ endfun " Uses the global markfilelist fun! s:NetrwMarkFileTag(islocal) " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileTag") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") - let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")")) +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) + let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "s:ShellEscape(v:val,".!a:islocal.")")) call s:NetrwUnmarkAll() if a:islocal if executable(g:netrw_ctags) -" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")") +" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("<slnum>")) call system(g:netrw_ctags." ".netrwmarkfilelist) else call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51) @@ -6908,16 +7660,17 @@ fun! s:NetrwMarkFileTag(islocal) call netrw#Obtain(a:islocal,"tags") let curdir= b:netrw_curdir 1split - e tags + NetrwKeepj e tags let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') -" call Decho("curdir<".curdir."> path<".path.">") - exe 'keepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' +" call Decho("curdir<".curdir."> path<".path.">",'~'.expand("<slnum>")) + exe 'NetrwKeepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' call histdel("/",-1) wq! endif 2match none call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) endif " call Dret("s:NetrwMarkFileTag") @@ -6925,14 +7678,15 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 -" Sets up two variables, +" Sets up two variables, " s:netrwmftgt : holds the target directory " s:netrwmftgt_islocal : 0=target directory is remote " 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) -" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir +" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) let hadtgt = exists("s:netrwmftgt") if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= b:netrw_bannercnt @@ -6940,60 +7694,100 @@ fun! s:NetrwMarkFileTgt(islocal) " set up target if line(".") < w:netrw_bannercnt +" call Decho("set up target: line(.) < w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) " if cursor in banner region, use b:netrw_curdir for the target unless its already the target if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir -" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target") +" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target",'~'.expand("<slnum>")) unlet s:netrwmftgt s:netrwmftgt_islocal if g:netrw_fastbrowse <= 1 call s:LocalBrowseRefresh() endif call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) " call Dret("s:NetrwMarkFileTgt : removed target") return else let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif else " get word under cursor. " * If directory, use it for the target. " * If file, use b:netrw_curdir for the target +" call Decho("get word under cursor",'~'.expand("<slnum>")) let curword= s:NetrwGetWord() let tgtdir = s:ComposePath(curdir,curword) - if a:islocal && isdirectory(tgtdir) + if a:islocal && isdirectory(s:NetrwFile(tgtdir)) let s:netrwmftgt = tgtdir -" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) elseif !a:islocal && tgtdir =~ '/$' let s:netrwmftgt = tgtdir -" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) else let s:netrwmftgt = curdir -" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif endif if a:islocal " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let s:netrwmftgt= simplify(s:netrwmftgt) -" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif if g:netrw_cygwin - let s:netrwmftgt= substitute(system("cygpath ".shellescape(s:netrwmftgt)),'\n$','','') + let s:netrwmftgt= substitute(system("cygpath ".s:ShellEscape(s:netrwmftgt)),'\n$','','') let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','') endif let s:netrwmftgt_islocal= a:islocal + " need to do refresh so that the banner will be updated + " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing if g:netrw_fastbrowse <= 1 +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers",'~'.expand("<slnum>")) call s:LocalBrowseRefresh() endif - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop)) + else + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + endif +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) if !hadtgt - sil! keepj norm! j + sil! NetrwKeepj norm! j + endif + +" call Decho("getmatches=".string(getmatches()),'~'.expand("<slnum>")) +" call Decho("s:netrwmarkfilelist=".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : 'n/a'),'~'.expand("<slnum>")) +" call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") +endfun + +" --------------------------------------------------------------------- +" s:NetrwGetCurdir: gets current directory and sets up b:netrw_curdir if necessary {{{2 +fun! s:NetrwGetCurdir(islocal) +" call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")") + + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop) +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("<slnum>")) + elseif !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>")) + endif + +" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern",'~'.expand("<slnum>")) + if b:netrw_curdir !~ '\<\a\{3,}://' + let curdir= b:netrw_curdir +" call Decho("g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>")) + if g:netrw_keepdir == 0 + call s:NetrwLcd(curdir) + endif endif -" call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") +" call Dret("s:NetrwGetCurdir <".curdir.">") + return b:netrw_curdir endfun " --------------------------------------------------------------------- @@ -7009,9 +7803,12 @@ fun! s:NetrwOpenFile(islocal) if exists("g:netrw_quiet") let netrw_quiet_keep = g:netrw_quiet endif - let g:netrw_quiet = 1 + let g:netrw_quiet = 1 + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= winsaveview() +" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) if b:netrw_curdir =~ '/$' - exe "e ".fnameescape(b:netrw_curdir.fname) + exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) else exe "e ".fnameescape(b:netrw_curdir."/".fname) endif @@ -7022,21 +7819,93 @@ fun! s:NetrwOpenFile(islocal) endif endif else - exe "e ".fnameescape(fname) + exe "NetrwKeepj e ".fnameescape(fname) endif let @@= ykeep " call Dret("s:NetrwOpenFile") endfun " --------------------------------------------------------------------- -" s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 -" User access provided by the <mu> mapping. (see :help netrw-mu) +" netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2 +" For the mapping to this function be made via +" netrwPlugin, you'll need to have had +" g:netrw_usetab set to non-zero. +fun! netrw#Shrink() +" call Dfunc("netrw#Shrink() ft<".&ft."> winwidth=".winwidth(0)." lexbuf#".((exists("t:netrw_lexbufnr"))? t:netrw_lexbufnr : 'n/a')) + let curwin = winnr() + let wiwkeep = &wiw + set wiw=1 + + if &ft == "netrw" + if winwidth(0) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("<slnum>")) + else + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>")) + endif + + elseif exists("t:netrw_lexbufnr") + exe bufwinnr(t:netrw_lexbufnr)."wincmd w" + if winwidth(bufwinnr(t:netrw_lexbufnr)) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("<slnum>")) + elseif winwidth(bufwinnr(t:netrw_lexbufnr)) >= 0 + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>")) + else + call netrw#Lexplore(0,0) + endif + + else + call netrw#Lexplore(0,0) + endif + let wiw= wiwkeep + +" call Dret("netrw#Shrink") +endfun + +" --------------------------------------------------------------------- +" s:NetSortSequence: allows user to edit the sorting sequence {{{2 +fun! s:NetSortSequence(islocal) +" call Dfunc("NetSortSequence(islocal=".a:islocal.")") + + let ykeep= @@ + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call inputsave() + let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) + call inputrestore() + + " refresh the listing + let g:netrw_sort_sequence= newsortseq + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) + let @@= ykeep + +" call Dret("NetSortSequence") +endfun + +" --------------------------------------------------------------------- +" s:NetrwUnmarkList: delete local marked file list and remove their contents from the global marked-file list {{{2 +" User access provided by the <mF> mapping. (see :help netrw-mF) " Used by many MarkFile functions. fun! s:NetrwUnmarkList(curbufnr,curdir) " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") " remove all files in local marked-file list from global list - if exists("s:netrwmarkfilelist_{a:curbufnr}") + if exists("s:netrwmarkfilelist") for mfile in s:netrwmarkfilelist_{a:curbufnr} let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile @@ -7045,7 +7914,7 @@ fun! s:NetrwUnmarkList(curbufnr,curdir) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif - + " getting rid of the local marked-file lists is easy unlet s:netrwmarkfilelist_{a:curbufnr} endif @@ -7076,7 +7945,7 @@ fun! s:NetrwUnmarkAll2() let redir END let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list - call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ + call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ call map(netrwmarkfilelist_list,"substitute(v:val,'\\s.*$','','')") " remove what the entries are equal to for flist in netrwmarkfilelist_list let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','') @@ -7087,24 +7956,40 @@ fun! s:NetrwUnmarkAll2() endfun " --------------------------------------------------------------------- -" s:NetrwUnMarkFile: {{{2 +" s:NetrwUnMarkFile: called via mu map; unmarks *all* marked files, both global and buffer-local {{{2 +" +" Marked files are in two types of lists: +" s:netrwmarkfilelist -- holds complete paths to all marked files +" s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr()) +" +" Marked files suitable for use with 2match are in: +" s:netrwmarkfilemtch_# -- used with 2match to display marked files fun! s:NetrwUnMarkFile(islocal) " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") - " unmark marked file list (although I expect s:NetrwUpload() - " to do it, I'm just making sure) - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%")) + " unmark marked file list + " (although I expect s:NetrwUpload() to do it, I'm just making sure) + if exists("s:netrwmarkfilelist") +" " call Decho("unlet'ing: s:netrwmarkfilelist",'~'.expand("<slnum>")) unlet s:netrwmarkfilelist - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none endif + let ibuf= 1 + while ibuf < bufnr("$") + if exists("s:netrwmarkfilelist_".ibuf) + unlet s:netrwmarkfilelist_{ibuf} + unlet s:netrwmarkfilemtch_{ibuf} + endif + let ibuf = ibuf + 1 + endwhile + 2match none + " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +"call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) +call winrestview(svpos) " call Dret("s:NetrwUnMarkFile") endfun @@ -7120,7 +8005,7 @@ fun! s:NetrwMenu(domenu) " call Dfunc("NetrwMenu(domenu=".a:domenu.")") if !exists("s:netrw_menu_enabled") && a:domenu -" call Decho("initialize menu") +" call Decho("initialize menu",'~'.expand("<slnum>")) let s:netrw_menu_enabled= 1 exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>' exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' @@ -7149,6 +8034,7 @@ fun! s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p' exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P' exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Tab<tab>t t' exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v' exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */' @@ -7185,6 +8071,7 @@ fun! s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Name<tab>s :let g:netrw_sort_by="name"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Time<tab>s :let g:netrw_sort_by="time"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Size<tab>s :let g:netrw_sort_by="size"<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Exten<tab>s :let g:netrw_sort_by="exten"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R' exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c' let s:netrw_menucnt= 28 @@ -7194,13 +8081,13 @@ fun! s:NetrwMenu(domenu) elseif !a:domenu let s:netrwcnt = 0 let curwin = winnr() - windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif + windo if getline(2) =~# "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif exe curwin."wincmd w" if s:netrwcnt <= 1 -" call Decho("clear menus") +" call Decho("clear menus",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu -" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*') +" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*','~'.expand("<slnum>")) sil! unlet s:netrw_menu_enabled endif endif @@ -7218,7 +8105,7 @@ fun! s:NetrwObtain(islocal) let ykeep= @@ if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' + let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\{3,}://' call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) else @@ -7249,32 +8136,34 @@ fun! s:NetrwPrevWinOpen(islocal) let lastwinnr = winnr("$") let curword = s:NetrwGetWord() let choice = 0 - let s:treedir = s:NetrwTreeDir() + let s:treedir = s:NetrwTreeDir(a:islocal) let curdir = s:treedir -" call Decho("winnr($)#".lastwinnr." curword<".curword.">") +" call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("<slnum>")) let didsplit = 0 if lastwinnr == 1 " if only one window, open a new one first -" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") +" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("<slnum>")) if g:netrw_preview + " vertically split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else + " horizontally split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif let didsplit = 1 -" call Decho("did split") +" call Decho("did split",'~'.expand("<slnum>")) else - keepj call s:SaveBufVars() + NetrwKeepj call s:SaveBufVars() let eikeep= &ei setl ei=all wincmd p -" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">") +" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">",'~'.expand("<slnum>")) " prevwinnr: the window number of the "prev" window " prevbufnr: the buffer number of the buffer in the "prev" window @@ -7284,23 +8173,23 @@ fun! s:NetrwPrevWinOpen(islocal) let prevbufname = bufname("%") let prevmod = &mod let bnrcnt = 0 - keepj call s:RestoreBufVars() -" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr) + NetrwKeepj call s:RestoreBufVars() +" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr,'~'.expand("<slnum>")) " if the previous window's buffer has been changed (ie. its modified flag is set), " and it doesn't appear in any other extant window, then ask the " user if s/he wants to abandon modifications therein. if prevmod -" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr()) +" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr(),'~'.expand("<slnum>")) windo if winbufnr(0) == prevbufnr | let bnrcnt=bnrcnt+1 | endif -" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr) +" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr,'~'.expand("<slnum>")) exe prevwinnr."wincmd w" if bnrcnt == 1 && &hidden == 0 " only one copy of the modified buffer in a window, and " hidden not set, so overwriting will lose the modified file. Ask first... let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel") -" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr()) +" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("<slnum>")) let &ei= eikeep if choice == 1 @@ -7308,7 +8197,7 @@ fun! s:NetrwPrevWinOpen(islocal) let v:errmsg= "" sil w if v:errmsg != "" - call netrw#ErrorMsg(s:ERROR,"unable to write <".prevbufname.">!",30) + call netrw#ErrorMsg(s:ERROR,"unable to write <".(exists("prevbufname")? prevbufname : 'n/a').">!",30) exe origwin."wincmd w" let &ei = eikeep let @@ = ykeep @@ -7318,12 +8207,12 @@ fun! s:NetrwPrevWinOpen(islocal) elseif choice == 2 " No -- don't worry about changed file, just browse anyway -" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")") +" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")",'~'.expand("<slnum>")) echomsg "**note** changes to ".prevbufname." abandoned" else " Cancel -- don't do this -" call Decho("cancel, don't browse, switch to win#".origwin) +" call Decho("cancel, don't browse, switch to win#".origwin,'~'.expand("<slnum>")) exe origwin."wincmd w" let &ei= eikeep let @@ = ykeep @@ -7357,46 +8246,46 @@ endfun fun! s:NetrwUpload(fname,tgt,...) " call Dfunc("s:NetrwUpload(fname<".((type(a:fname) == 1)? a:fname : string(a:fname))."> tgt<".a:tgt.">) a:0=".a:0) - if a:tgt =~ '^\a\+://' - let tgtdir= substitute(a:tgt,'^\a\+://[^/]\+/\(.\{-}\)$','\1','') + if a:tgt =~ '^\a\{3,}://' + let tgtdir= substitute(a:tgt,'^\a\{3,}://[^/]\+/\(.\{-}\)$','\1','') else let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','') endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>")) if a:0 > 0 let fromdir= a:1 else let fromdir= getcwd() endif -" call Decho("fromdir<".fromdir.">") +" call Decho("fromdir<".fromdir.">",'~'.expand("<slnum>")) if type(a:fname) == 1 " handle uploading a single file using NetWrite -" call Decho("handle uploading a single file via NetWrite") +" call Decho("handle uploading a single file via NetWrite",'~'.expand("<slnum>")) 1split -" call Decho("exe e ".fnameescape(a:fname)) - exe "e ".fnameescape(a:fname) -" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines") +" call Decho("exe e ".fnameescape(s:NetrwFile(a:fname)),'~'.expand("<slnum>")) + exe "NetrwKeepj e ".fnameescape(s:NetrwFile(a:fname)) +" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines",'~'.expand("<slnum>")) if a:tgt =~ '/$' let wfname= substitute(a:fname,'^.*/','','') -" call Decho("exe w! ".fnameescape(wfname)) +" call Decho("exe w! ".fnameescape(wfname),'~'.expand("<slnum>")) exe "w! ".fnameescape(a:tgt.wfname) else -" call Decho("writing local->remote: exe w ".fnameescape(a:tgt)) +" call Decho("writing local->remote: exe w ".fnameescape(a:tgt),'~'.expand("<slnum>")) exe "w ".fnameescape(a:tgt) -" call Decho("done writing local->remote") +" call Decho("done writing local->remote",'~'.expand("<slnum>")) endif q! elseif type(a:fname) == 3 " handle uploading a list of files via scp -" call Decho("handle uploading a list of files via scp") +" call Decho("handle uploading a list of files via scp",'~'.expand("<slnum>")) let curdir= getcwd() if a:tgt =~ '^scp:' call s:NetrwLcd(fromdir) let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) - let args = join(map(filelist,"shellescape(v:val, 1)")) + let args = join(map(filelist,"s:ShellEscape(v:val, 1)")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -7404,8 +8293,7 @@ fun! s:NetrwUpload(fname,tgt,...) endif let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1)) call s:NetrwLcd(curdir) elseif a:tgt =~ '^ftp:' @@ -7414,41 +8302,39 @@ fun! s:NetrwUpload(fname,tgt,...) if b:netrw_method == 2 " handle uploading a list of files via ftp+.netrc let netrw_fname = b:netrw_fname - sil keepj new -" call Decho("filter input window#".winnr()) + sil NetrwKeepj new +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif - keepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if tgtdir == "" let tgtdir= '/' endif - keepj call setline(line("$")+1,'cd "'.tgtdir.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) for fname in a:fname - keepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'put "'.s:NetrwFile(fname).'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil keepj g/Local directory now/d + sil NetrwKeepj g/Local directory now/d call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' call netrw#ErrorMsg(s:ERROR,getline(1),14) @@ -7459,59 +8345,58 @@ fun! s:NetrwUpload(fname,tgt,...) elseif b:netrw_method == 3 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc) let netrw_fname= b:netrw_fname - keepj call s:SaveBufVars()|sil keepj new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|sil NetrwKeepj new|NetrwKeepj call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_uid +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") - keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') + NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif endif - keepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in a:fname - keepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil keepj g/Local directory now/d + sil NetrwKeepj g/Local directory now/d call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug @@ -7539,10 +8424,10 @@ endfun fun! s:NetrwPreview(path) range " call Dfunc("NetrwPreview(path<".a:path.">)") let ykeep= @@ - keepj call s:NetrwOptionSave("s:") - keepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionSave("s:") + NetrwKeepj call s:NetrwSafeOptions() if has("quickfix") - if !isdirectory(a:path) + if !isdirectory(s:NetrwFile(a:path)) if g:netrw_preview && !g:netrw_alto let pvhkeep = &pvh let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize @@ -7553,12 +8438,12 @@ fun! s:NetrwPreview(path) range let &pvh= pvhkeep endif elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) endif elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) endif - keepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionRestore("s:") let @@= ykeep " call Dret("NetrwPreview") endfun @@ -7566,39 +8451,42 @@ endfun " --------------------------------------------------------------------- " s:NetrwRefresh: {{{2 fun! s:NetrwRefresh(islocal,dirname) -" call Dfunc("NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) +" call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. setl ma noro -" call Decho("setl ma noro") -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("setl ma noro",'~'.expand("<slnum>")) +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) let ykeep = @@ " save the cursor position before refresh. - let screenposn = netrw#SavePosn() -" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">") -" call Decho("clearing buffer prior to refresh") - sil! keepj %d + let screenposn = winsaveview() +" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + +" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("<slnum>")) +" call Decho("clearing buffer prior to refresh",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ if a:islocal - keepj call netrw#LocalBrowseCheck(a:dirname) + NetrwKeepj call netrw#LocalBrowseCheck(a:dirname) else - keepj call s:NetrwBrowse(a:islocal,a:dirname) + NetrwKeepj call s:NetrwBrowse(a:islocal,a:dirname) endif " restore position - keepj call netrw#RestorePosn(screenposn) +" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(screenposn) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("<slnum>")) 2match none endif " restore let @@= ykeep -" call Dret("NetrwRefresh") +" call Dret("s:NetrwRefresh") endfun " --------------------------------------------------------------------- @@ -7609,27 +8497,27 @@ fun! s:NetrwRefreshDir(islocal,dirname) " call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse) if g:netrw_fastbrowse == 0 " slowest mode (keep buffers refreshed, local or remote) -" call Decho("slowest mode: keep buffers refreshed, local or remote") +" call Decho("slowest mode: keep buffers refreshed, local or remote",'~'.expand("<slnum>")) let tgtwin= bufwinnr(a:dirname) -" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin) +" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin,'~'.expand("<slnum>")) if tgtwin > 0 " tgtwin is being displayed, so refresh it let curwin= winnr() -" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")") +" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")",'~'.expand("<slnum>")) exe tgtwin."wincmd w" - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) exe curwin."wincmd w" elseif bufnr(a:dirname) > 0 let bn= bufnr(a:dirname) -" call Decho("bd bufnr(".a:dirname.")=".bn) - exe "sil bd ".bn +" call Decho("bd bufnr(".a:dirname.")=".bn,'~'.expand("<slnum>")) + exe "sil keepj bd ".bn endif elseif g:netrw_fastbrowse <= 1 -" call Decho("medium-speed mode: refresh local buffers only") - keepj call s:LocalBrowseRefresh() +" call Decho("medium-speed mode: refresh local buffers only",'~'.expand("<slnum>")) + NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwRefreshDir") endfun @@ -7639,14 +8527,22 @@ endfun " window number to do its editing in. " Supports [count]C where the count, if present, is used to specify " a window to use for editing via the <cr> mapping. -fun! s:NetrwSetChgwin() +fun! s:NetrwSetChgwin(...) " call Dfunc("s:NetrwSetChgwin() v:count=".v:count) - if v:count > 0 + if a:0 > 0 +" call Decho("a:1<".a:1.">",'~'.expand("<slnum>")) + if a:1 == "" " :NetrwC win# + let g:netrw_chgwin= winnr() + else " :NetrwC + let g:netrw_chgwin= a:1 + endif + elseif v:count > 0 " [count]C let g:netrw_chgwin= v:count - else + else " C let g:netrw_chgwin= winnr() endif -" call Dret("s:NetrwSetChgwin") + echo "editing window now set to window#".g:netrw_chgwin +" call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin) endfun " --------------------------------------------------------------------- @@ -7685,7 +8581,7 @@ fun! s:NetrwSetSort() else let spriority= priority.g:netrw_sepchr endif -" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">",'~'.expand("<slnum>")) " sanity check if w:netrw_bannercnt > line("$") @@ -7696,18 +8592,18 @@ fun! s:NetrwSetSort() if seq == '*' let starpriority= spriority else - exe 'sil keepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' call histdel("/",-1) " sometimes multiple sorting patterns will match the same file or directory. " The following substitute is intended to remove the excess matches. - exe 'sil keepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' + NetrwKeepj call histdel("/",-1) endif let priority = priority + 1 endwhile if exists("starpriority") - exe 'sil keepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e' + NetrwKeepj call histdel("/",-1) endif " Following line associated with priority -- items that satisfy a priority @@ -7716,8 +8612,8 @@ fun! s:NetrwSetSort() " priority pattern needs to be retained. So, at this point, these excess " priority prefixes need to be removed, but not directories that happen to " be just digits themselves. - exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' + NetrwKeepj call histdel("/",-1) let @@= ykeep " call Dret("SetSort") @@ -7728,8 +8624,8 @@ endfun " Implements [count]Tb (bookhist<b>) " [count]Th (bookhist<h>) " See :help netrw-qb for how to make the choice. -fun! s:NetrwSetTgt(bookhist,choice) -" call Dfunc("s:NetrwSetTgt(bookhist<".a:bookhist."> choice#".a:choice.")") +fun! s:NetrwSetTgt(islocal,bookhist,choice) +" call Dfunc("s:NetrwSetTgt(islocal=".a:islocal." bookhist<".a:bookhist."> choice#".a:choice.")") if a:bookhist == 'b' " supports choosing a bookmark as a target using a qb-generated list @@ -7751,6 +8647,12 @@ fun! s:NetrwSetTgt(bookhist,choice) endif endif + " refresh the display + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + call s:NetrwRefresh(a:islocal,b:netrw_curdir) + " call Dret("s:NetrwSetTgt") endfun @@ -7758,13 +8660,15 @@ endfun " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2 fun! s:NetrwSortStyle(islocal) " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") - keepj call s:NetrwSaveWordPosn() - let svpos= netrw#SavePosn() + NetrwKeepj call s:NetrwSaveWordPosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) - let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' - keepj norm! 0 - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + let g:netrw_sort_by= (g:netrw_sort_by =~# '^n')? 'time' : (g:netrw_sort_by =~# '^t')? 'size' : (g:netrw_sort_by =~# '^siz')? 'exten' : 'name' + NetrwKeepj norm! 0 + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">") endfun @@ -7787,43 +8691,43 @@ fun! s:NetrwSplit(mode) " remote and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 1 " remote and t let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord()) -" call Decho("tabnew") +" call Decho("tabnew",'~'.expand("<slnum>")) tabnew let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,newdir) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,newdir) unlet s:didsplit elseif a:mode == 2 " remote and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 3 " local and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 4 @@ -7833,23 +8737,23 @@ fun! s:NetrwSplit(mode) let netrw_winnr = winnr() let netrw_line = line(".") let netrw_col = virtcol(".") - keepj norm! H0 + NetrwKeepj norm! H0 let netrw_hline = line(".") setl ei=all - exe "keepj norm! ".netrw_hline."G0z\<CR>" - exe "keepj norm! ".netrw_line."G0".netrw_col."\<bar>" - let &ei= eikeep - let netrw_curdir= s:NetrwTreeDir() -" call Decho("tabnew") + exe "NetrwKeepj norm! ".netrw_hline."G0z\<CR>" + exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\<bar>" + let &ei = eikeep + let netrw_curdir = s:NetrwTreeDir(0) +" call Decho("tabnew",'~'.expand("<slnum>")) tabnew let b:netrw_curdir = netrw_curdir let s:didsplit = 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) if &ft == "netrw" setl ei=all - exe "keepj norm! ".netrw_hline."G0z\<CR>" - exe "keepj norm! ".netrw_line."G0".netrw_col."\<bar>" + exe "NetrwKeepj norm! ".netrw_hline."G0z\<CR>" + exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\<bar>" let &ei= eikeep endif unlet s:didsplit @@ -7858,15 +8762,15 @@ fun! s:NetrwSplit(mode) " local and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit else - keepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) endif let @@= ykeep @@ -7884,21 +8788,29 @@ fun! s:NetrwTgtMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' endif if !exists("s:netrw_initbookhist") call s:NetrwBookHistRead() endif + " try to cull duplicate entries + let tgtdict={} + " target bookmarked places if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 -" call Decho("installing bookmarks as easy targets") +" call Decho("installing bookmarks as easy targets",'~'.expand("<slnum>")) let cnt= 1 for bmd in g:netrw_bookmarklist + if has_key(tgtdict,bmd) + let cnt= cnt + 1 + continue + endif + let tgtdict[bmd]= cnt let ebmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu -" call Decho("menu: Targets: ".bmd) +" call Decho("menu: Targets: ".bmd,'~'.expand("<slnum>")) exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#MakeTgt('".bmd."')\<cr>" let cnt= cnt + 1 endfor @@ -7906,14 +8818,19 @@ fun! s:NetrwTgtMenu() " target directory browsing history if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 -" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")") +" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("<slnum>")) let histcnt = 1 while histcnt <= g:netrw_dirhistmax let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{histcnt}") let histentry = g:netrw_dirhist_{histcnt} - let ehistentry = escape(histentry,g:netrw_menu_escape) -" call Decho("menu: Targets: ".histentry) + if has_key(tgtdict,histentry) + let histcnt = histcnt + 1 + continue + endif + let tgtdict[histentry] = histcnt + let ehistentry = escape(histentry,g:netrw_menu_escape) +" call Decho("menu: Targets: ".histentry,'~'.expand("<slnum>")) exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#MakeTgt('".histentry."')\<cr>" endif let histcnt = histcnt + 1 @@ -7926,8 +8843,11 @@ endfun " --------------------------------------------------------------------- " s:NetrwTreeDir: determine tree directory given current cursor position {{{2 " (full path directory with trailing slash returned) -fun! s:NetrwTreeDir() -" call Dfunc("s:NetrwTreeDir() getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) +fun! s:NetrwTreeDir(islocal) +" call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("<slnum>")) if exists("s:treedir") " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early @@ -7936,48 +8856,72 @@ fun! s:NetrwTreeDir() " call Dret("s:NetrwTreeDir ".treedir) return treedir endif + if !exists("b:netrw_curdir") || b:netrw_curdir == "" let b:netrw_curdir= getcwd() endif let treedir = b:netrw_curdir -" call Decho("set initial treedir<".treedir.">") - let s:treecurpos= netrw#SavePosn() +" call Decho("set initial treedir<".treedir.">",'~'.expand("<slnum>")) + + let s:treecurpos= winsaveview() +" call Decho("saving posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) - if w:netrw_liststyle == s:TREELIST -" call Decho("w:netrw_liststyle is TREELIST:") -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST +" call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("<slnum>")) +" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") - if getline('.') =~ '/$' -" call Decho("extract tree subdirectory from current line") + let curline= substitute(getline('.'),"\t -->.*$",'','') + if curline =~ '/$' +" call Decho("extract tree subdirectory from current line",'~'.expand("<slnum>")) let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("treedir<".treedir.">") +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + elseif curline =~ '@$' +" call Decho("handle symbolic link from current line",'~'.expand("<slnum>")) + let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else -" call Decho("do not extract tree subdirectory from current line and set treedir to empty") +" call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("<slnum>")) let treedir= "" endif " detect user attempting to close treeroot -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") -" call Decho("getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring) - if getline('.') !~ '^'.s:treedepthstring && getline('.') != '..' -" call Decho("user may have attempted to close treeroot") +" call Decho("check if user is attempting to close treeroot",'~'.expand("<slnum>")) +" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~# '^'.s:treedepthstring)? '=~#' : '!~').' ^'.s:treedepthstring,'~'.expand("<slnum>")) + if curline !~ '^'.s:treedepthstring && getline('.') != '..' +" call Decho(".user may have attempted to close treeroot",'~'.expand("<slnum>")) " now force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! keepj %d -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return b:netrw_curdir " else " Decho -" call Decho("user did not attempt to close treeroot") +" call Decho(".user not attempting to close treeroot",'~'.expand("<slnum>")) endif - let treedir = s:NetrwTreePath(w:netrw_treetop) +" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>")) + let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) +" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("<slnum>")) + + " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop +" if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir)) +" let newdir = w:netrw_treetop.'/'.potentialdir +" " call Decho("apply NetrwTreePath to newdir<".newdir.">",'~'.expand("<slnum>")) +" let treedir = s:NetrwTreePath(newdir) +" let w:netrw_treetop = newdir +" " call Decho("newdir <".newdir.">",'~'.expand("<slnum>")) +" else +" call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("<slnum>")) + let treedir = s:NetrwTreePath(w:netrw_treetop) +" endif endif " sanity maintenance: keep those //s away... let treedir= substitute(treedir,'//$','/','') +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return treedir endfun @@ -7992,9 +8936,9 @@ fun! s:NetrwTreeDisplay(dir,depth) " install ../ and shortdir if a:depth == "" call setline(line("$")+1,'../') -" call Decho("setline#".line("$")." ../ (depth is zero)") +" call Decho("setline#".line("$")." ../ (depth is zero)",'~'.expand("<slnum>")) endif - if a:dir =~ '^\a\+://' + if a:dir =~ '^\a\{3,}://' if a:dir == w:netrw_treetop let shortdir= a:dir else @@ -8005,67 +8949,112 @@ fun! s:NetrwTreeDisplay(dir,depth) let shortdir= substitute(a:dir,'^.*/','','e') call setline(line("$")+1,a:depth.shortdir.'/') endif -" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">") +" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("<slnum>")) " append a / to dir if its missing one let dir= a:dir - if dir !~ '/$' - let dir= dir.'/' - endif " display subtrees (if any) let depth= s:treedepthstring.a:depth +" call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>")) -" call Decho("display subtrees with depth<".depth."> and current leaves") - for entry in w:netrw_treedict[a:dir] - let direntry= substitute(dir.entry,'/$','','e') -" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") +" call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>")) + for entry in w:netrw_treedict[dir] + if dir =~ '/$' + let direntry= substitute(dir.entry,'[@/]$','','e') + else + let direntry= substitute(dir.'/'.entry,'[@/]$','','e') + endif +" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>")) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) -" call Decho("<".direntry."> is a key in treedict - display subtree for it") - keepj call s:NetrwTreeDisplay(direntry,depth) +" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwTreeDisplay(direntry,depth) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it") - keepj call s:NetrwTreeDisplay(direntry.'/',depth) +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) + elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) else -" call Decho("<".entry."> is not a key in treedict (no subtree)") - sil! keepj call setline(line("$")+1,depth.entry) +" call Decho("<".entry."> is not a key in treedict (no subtree)",'~'.expand("<slnum>")) + sil! NetrwKeepj call setline(line("$")+1,depth.entry) endif endfor " call Dret("NetrwTreeDisplay") endfun +" --------------------------------------------------------------------- +" s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2 +fun! s:NetrwRefreshTreeDict(dir) +" call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)") + for entry in w:netrw_treedict[a:dir] + let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e') +" call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>")) + + if entry =~ '/$' && has_key(w:netrw_treedict,direntry) +" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshTreeDict(direntry) + let liststar = s:NetrwGlob(direntry,'*',1) + let listdotstar = s:NetrwGlob(direntry,'.*',1) + let w:netrw_treedict[direntry] = liststar + listdotstar +" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) + + elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) + let w:netrw_treedict[direntry]= liststar + listdotstar +" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) + + elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) +" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) + + else +" call Decho('not updating w:netrw_treedict['.direntry.'] with entry<'.entry.'> (no subtree)',,'~'.expand("<slnum>")) + endif + endfor +" call Dret("s:NetrwRefreshTreeDict") +endfun + " --------------------------------------------------------------------- " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2 +" Called by s:PerformListing() fun! s:NetrwTreeListing(dirname) - if w:netrw_liststyle == s:TREELIST + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Dfunc("NetrwTreeListing() bufname<".expand("%").">") -" call Decho("curdir<".a:dirname.">") -" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("curdir<".a:dirname.">",'~'.expand("<slnum>")) +" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " update the treetop -" call Decho("update the treetop") +" call Decho("update the treetop",'~'.expand("<slnum>")) if !exists("w:netrw_treetop") let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)") +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("<slnum>")) elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)") +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("<slnum>")) endif - " insure that we have at least an empty treedict if !exists("w:netrw_treedict") + " insure that we have a treedict, albeit empty +" call Decho("initializing w:netrw_treedict to empty",'~'.expand("<slnum>")) let w:netrw_treedict= {} endif - " update the directory listing for the current directory -" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]") -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$")) - exe "sil! keepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' + " update the dictionary for the current directory +" call Decho("updating: w:netrw_treedict[".a:dirname.'] -> [directory listing]','~'.expand("<slnum>")) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d _' let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) -" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname])) - exe "sil! keepj ".w:netrw_bannercnt.",$d" +" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" " if past banner, record word if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt @@ -8073,16 +9062,16 @@ fun! s:NetrwTreeListing(dirname) else let fname= "" endif -" call Decho("fname<".fname.">") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " display from treetop on down - keepj call s:NetrwTreeDisplay(w:netrw_treetop,"") -" call Decho("s:NetrwTreeDisplay) setl noma nomod ro") + NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") +" call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("<slnum>")) " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed) while getline(1) =~ '^\s*$' && byte2line(1) > 0 -" call Decho("deleting blank line") +" call Decho("deleting blank line",'~'.expand("<slnum>")) 1d endwhile @@ -8100,26 +9089,35 @@ endfun " wipes that out prior to calling this function fun! s:NetrwTreePath(treetop) " call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">") + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("(s:NetrwTreePath) depth<".depth."> 1st subst") +" call Decho("depth<".depth."> 1st subst",'~'.expand("<slnum>")) let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) depth<".depth."> 2nd subst (first depth removed)") - if getline('.') =~ '/$' -" call Decho("extract tree directory from current line") - let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("(s:NetrwTreePath) treedir<".treedir.">") +" call Decho("depth<".depth."> 2nd subst (first depth removed)",'~'.expand("<slnum>")) + let curline= getline('.') +" call Decho("curline<".curline.'>','~'.expand("<slnum>")) + if curline =~ '/$' +" call Decho("extract tree directory from current line",'~'.expand("<slnum>")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + elseif curline =~ '@\s\+-->' +" call Decho("extract tree directory using symbolic link",'~'.expand("<slnum>")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') + let treedir= substitute(treedir,'@\s\+-->.*$','','e') +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else -" call Decho("(s:NetrwTreePath) do not extract tree directory from current line and set treedir to empty") +" call Decho("do not extract tree directory from current line and set treedir to empty",'~'.expand("<slnum>")) let treedir= "" endif " construct treedir by searching backwards at correct depth -" call Decho("(s:NetrwTreePath) construct treedir by searching backwards for correct depth") -" call Decho("(s:NetrwTreePath) initial treedir<".treedir."> depth<".depth.">") +" call Decho("construct treedir by searching backwards for correct depth",'~'.expand("<slnum>")) +" call Decho("initial treedir<".treedir."> depth<".depth.">",'~'.expand("<slnum>")) while depth != "" && search('^'.depth.'[^'.s:treedepthstring.'].\{-}/$','bW') let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let treedir= dirname.treedir let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") +" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("<slnum>")) endwhile if a:treetop =~ '/$' let treedir= a:treetop.treedir @@ -8127,6 +9125,8 @@ fun! s:NetrwTreePath(treetop) let treedir= a:treetop.'/'.treedir endif let treedir= substitute(treedir,'//$','/','') +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))" + call winrestview(svpos) " call Dret("s:NetrwTreePath <".treedir.">") return treedir endfun @@ -8142,57 +9142,60 @@ fun! s:NetrwWideListing() " fpl: filenames per line " fpc: filenames per column setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt - exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + NetrwKeepj call histdel("/",-1) else " call Dret("NetrwWideListing") return endif let b:netrw_cpf= b:netrw_cpf + 2 -" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf) +" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>")) " determine qty files per line (fpl) let w:netrw_fpl= winwidth(0)/b:netrw_cpf if w:netrw_fpl <= 0 let w:netrw_fpl= 1 endif -" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) +" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl,'~'.expand("<slnum>")) " make wide display - exe 'sil keepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' - keepj call histdel("/",-1) + " fpc: files per column of wide listing + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'S",submatch(0)),"\\")/' + NetrwKeepj call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 -" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]") +" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>")) if has("clipboard") sil! let keepregstar = @* + sil! let keepregplus = @+ endif while line("$") >= newcolstart if newcolend > line("$") | let newcolend= line("$") | endif let newcolqty= newcolend - newcolstart exe newcolstart if newcolqty == 0 - exe "sil! keepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p" + exe "sil! NetrwKeepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p" else - exe "sil! keepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' + exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' endif - exe "sil! keepj ".newcolstart.','.newcolend.'d' - exe 'sil! keepj '.w:netrw_bannercnt + exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt endwhile if has("clipboard") sil! let @*= keepregstar + sil! let @+= keepregplus endif - exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e' - keepj call histdel("/",-1) - exe "nmap <buffer> <silent> w /^\\\\|\\s\\s\\zs\\S/\<cr>" - exe "nmap <buffer> <silent> b ?^\\\\|\\s\\s\\zs\\S?\<cr>" -" call Decho("NetrwWideListing) setl noma nomod ro") + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e' + NetrwKeepj call histdel("/",-1) + exe 'nno <buffer> <silent> w :call search(''^.\\|\s\s\zs\S'',''W'')'."\<cr>" + exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>" +" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwWideListing") return else @@ -8209,140 +9212,146 @@ endfun " --------------------------------------------------------------------- " s:PerformListing: {{{2 fun! s:PerformListing(islocal) -" call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)") +" call Dfunc("s:PerformListing(islocal=".a:islocal.")") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) +" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)",'~'.expand("<slnum>")) " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting") - if has("syntax") - if !exists("g:syntax_on") || !g:syntax_on -" call Decho("but g:syntax_on".(exists("g:syntax_on")? "=".g:syntax_on : "<doesn't exist>")) - setl ft= - elseif &ft != "netrw" -" call Decho("setl ft=netrw") - setl ft=netrw - endif - endif +" call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("<slnum>")) + sil! setl ft=netrw - keepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwSafeOptions() setl noro ma -" call Decho("setl noro ma bh=".&bh) +" call Decho("setl noro ma bh=".&bh,'~'.expand("<slnum>")) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...") +" call Decho("(netrw) Processing your browsing request...",'~'.expand("<slnum>")) " endif " Decho -" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh for tree listings -" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d") - sil! keepj %d +" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ endif " save current directory on directory history list - keepj call s:NetrwBookHistHandler(3,b:netrw_curdir) + NetrwKeepj call s:NetrwBookHistHandler(3,b:netrw_curdir) " Set up the banner {{{3 if g:netrw_banner -" call Decho("set up banner") - keepj call setline(1,'" ============================================================================') - keepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') +" call Decho("--set up banner",'~'.expand("<slnum>")) + NetrwKeepj call setline(1,'" ============================================================================') + if exists("g:netrw_pchk") + " this undocumented option allows pchk to run with different versions of netrw without causing spurious + " failure detections. + NetrwKeepj call setline(2,'" Netrw Directory Listing') + else + NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + endif + if exists("g:netrw_pchk") + let curdir= substitute(b:netrw_curdir,expand("$HOME"),'~','') + else + let curdir= b:netrw_curdir + endif if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash - keepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) + NetrwKeepj call setline(3,'" '.substitute(curdir,'/','\\','g')) else - keepj call setline(3,'" '.b:netrw_curdir) + NetrwKeepj call setline(3,'" '.curdir) endif let w:netrw_bannercnt= 3 - keepj exe "sil! keepj ".w:netrw_bannercnt + NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt else - keepj 1 +" call Decho("--no banner",'~'.expand("<slnum>")) + NetrwKeepj 1 let w:netrw_bannercnt= 1 endif -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr()) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) let sortby= g:netrw_sort_by - if g:netrw_sort_direction =~ "^r" + if g:netrw_sort_direction =~# "^r" let sortby= sortby." reversed" endif " Sorted by... {{{3 if g:netrw_banner -" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") - if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") +" call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) + if g:netrw_sort_by =~# "^n" +" call Decho("directories will be sorted by name",'~'.expand("<slnum>")) " sorted by name - keepj put ='\" Sorted by '.sortby - keepj put ='\" Sort sequence: '.g:netrw_sort_sequence + NetrwKeepj put ='\" Sorted by '.sortby + NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else -" call Decho("directories will be sorted by size or time") +" call Decho("directories will be sorted by size or time",'~'.expand("<slnum>")) " sorted by size or date - keepj put ='\" Sorted by '.sortby + NetrwKeepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " show copy/move target, if any if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("show copy/move target<".s:netrwmftgt.">") - keepj put ='' +" call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("<slnum>")) + NetrwKeepj put ='' if s:netrwmftgt_islocal - sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') + sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') else - sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') + sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") +" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt",'~'.expand("<slnum>")) endif - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt endif " Hiding... -or- Showing... {{{3 if g:netrw_banner -" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") +" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>")) if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 - keepj put ='\" Hiding: '.g:netrw_list_hide + NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide else - keepj put ='\" Showing: '.g:netrw_list_hide + NetrwKeepj put ='\" Showing: '.g:netrw_list_hide endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif - exe "keepjumps ".w:netrw_bannercnt + exe "NetrwKeepj ".w:netrw_bannercnt -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let quickhelp = g:netrw_quickhelp%len(s:QuickHelp) -" call Decho("quickhelp =".quickhelp) - keepj put ='\" Quick Help: <F1>:help '.s:QuickHelp[quickhelp] -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - keepj put ='\" ==============================================================================' +" call Decho("quickhelp =".quickhelp,'~'.expand("<slnum>")) + NetrwKeepj put ='\" Quick Help: <F1>:help '.s:QuickHelp[quickhelp] +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) + NetrwKeepj put ='\" ==============================================================================' let w:netrw_bannercnt= w:netrw_bannercnt + 2 " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " bannercnt should index the line just after the banner if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 - exe "sil! keepj ".w:netrw_bannercnt -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) + exe "sil! NetrwKeepj ".w:netrw_bannercnt +" call Decho("--w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"),'~'.expand("<slnum>")) " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " get list of files -" call Decho("Get list of files - islocal=".a:islocal) +" call Decho("--Get list of files - islocal=".a:islocal,'~'.expand("<slnum>")) if a:islocal - keepj call s:LocalListing() + NetrwKeepj call s:LocalListing() else " remote - keepj let badresult= s:NetrwRemoteListing() + NetrwKeepj let badresult= s:NetrwRemoteListing() if badresult -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) " call Dret("s:PerformListing : error detected by NetrwRemoteListing") return endif @@ -8352,104 +9361,142 @@ fun! s:PerformListing(islocal) if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= 0 endif -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("--manipulate directory listing (hide, sort)",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (hide)") -" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("manipulate directory listing (hide)",'~'.expand("<slnum>")) +" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) if g:netrw_hide && g:netrw_list_hide != "" - keepj call s:NetrwListHide() + NetrwKeepj call s:NetrwListHide() endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) - if g:netrw_sort_by =~ "^n" + if g:netrw_sort_by =~# "^n" " sort by name - keepj call s:NetrwSetSort() + NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") - if g:netrw_sort_direction =~ 'n' +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) + if g:netrw_sort_direction =~# 'n' " normal direction sorting - exe 'sil keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else " reverse direction sorting - exe 'sil keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif endif " remove priority pattern prefix -" call Decho("remove priority pattern prefix") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' - keepj call histdel("/",-1) +" call Decho("remove priority pattern prefix",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' + NetrwKeepj call histdel("/",-1) + + elseif g:netrw_sort_by =~# "^ext" + " sort by extension + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+['.g:netrw_sepchr.'/]+s/^\(.*\.\)\(.\{-\}\)$/\2'.g:netrw_sepchr.'&/e' + NetrwKeepj call histdel("/",-1) + if !g:netrw_banner || w:netrw_bannercnt < line("$") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) + if g:netrw_sort_direction =~# 'n' + " normal direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options + else + " reverse direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options + endif + endif + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^.\{-}'.g:netrw_sepchr.'//e' + NetrwKeepj call histdel("/",-1) elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) - if g:netrw_sort_direction =~ 'n' -" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort') - exe 'sil! keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("<slnum>")) + if g:netrw_sort_direction =~# 'n' +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else -" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort!') - exe 'sil! keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' - keepj call histdel("/",-1) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + NetrwKeepj call histdel("/",-1) endif endif - elseif g:netrw_sort_direction =~ 'r' -" call Decho('(s:PerformListing) reverse the sorted listing') + elseif g:netrw_sort_direction =~# 'r' +" call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("<slnum>")) if !g:netrw_banner || w:netrw_bannercnt < line('$') - exe 'sil! keepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt call histdel("/",-1) endif endif endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " convert to wide/tree listing {{{3 -" call Decho("modify display if wide/tree listing style") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)") - keepj call s:NetrwWideListing() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)") - keepj call s:NetrwTreeListing(b:netrw_curdir) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)") - - if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) +" call Decho("--modify display if wide/tree listing style",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwWideListing() +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("<slnum>")) + + " resolve symbolic links if local and (thin or tree) + if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)) +" call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("<slnum>")) + g/@$/call s:ShowLink() + endif + + if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing -" call Decho("place cursor on top-left corner of file listing") - exe 'sil! keepj '.w:netrw_bannercnt - sil! keepj norm! 0 +" call Decho("--place cursor on top-left corner of file listing",'~'.expand("<slnum>")) + exe 'sil! '.w:netrw_bannercnt + sil! NetrwKeepj norm! 0 +" call Decho(" tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) + else +" call Decho("--did NOT place cursor on top-left corner",'~'.expand("<slnum>")) +" call Decho(" w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>")) +" call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) +" call Decho(" g:netrw_banner=".(exists("g:netrw_banner")? g:netrw_banner : 'n/a'),'~'.expand("<slnum>")) endif " record previous current directory let w:netrw_prvdir= b:netrw_curdir -" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") +" call Decho("--record netrw_prvdir<".w:netrw_prvdir.">",'~'.expand("<slnum>")) " save certain window-oriented variables into buffer-oriented variables {{{3 -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)") - keepj call s:SetBufWinVars() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)") - keepj call s:NetrwOptionRestore("w:") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)") +" call Decho("--save some window-oriented variables into buffer oriented variables",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)",'~'.expand("<slnum>")) + NetrwKeepj call s:SetBufWinVars() +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwOptionRestore("w:") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("<slnum>")) " set display to netrw display settings -" call Decho("set display to netrw display settings (".g:netrw_bufsettings.")") +" call Decho("--set display to netrw display settings (".g:netrw_bufsettings.")",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)",'~'.expand("<slnum>")) if g:netrw_liststyle == s:LONGLIST -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) endif if exists("s:treecurpos") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)") - keepj call netrw#RestorePosn(s:treecurpos) +" call Decho("s:treecurpos exists; restore posn",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("<slnum>")) +" call Decho("restoring posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:treecurpos) unlet s:treecurpos endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)",'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) " call Dret("s:PerformListing : curpos<".string(getpos(".")).">") endfun @@ -8460,7 +9507,7 @@ fun! s:SetupNetrwStatusLine(statline) if !exists("s:netrw_setup_statline") let s:netrw_setup_statline= 1 -" call Decho("do first-time status line setup") +" call Decho("do first-time status line setup",'~'.expand("<slnum>")) if !exists("s:netrw_users_stl") let s:netrw_users_stl= &stl @@ -8474,7 +9521,7 @@ fun! s:SetupNetrwStatusLine(statline) redir @a try hi User9 - catch /^Vim\%((\a\+)\)\=:E411/ + catch /^Vim\%((\a\{3,})\)\=:E411/ if &bg == "dark" hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue else @@ -8490,7 +9537,7 @@ fun! s:SetupNetrwStatusLine(statline) " make sure statusline is displayed let &stl=a:statline setl laststatus=2 -" call Decho("stl=".&stl) +" call Decho("stl=".&stl,'~'.expand("<slnum>")) redraw " call Dret("SetupNetrwStatusLine : stl=".&stl) @@ -8507,7 +9554,7 @@ endfun " enforced here. fun! s:NetrwRemoteFtpCmd(path,listcmd) " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) -" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("line($)=".line("$")." win#".winnr()." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) " sanity check: {{{3 if !exists("w:netrw_method") if exists("b:netrw_method") @@ -8522,31 +9569,31 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " WinXX ftp uses unix style input, so set ff to unix " {{{3 let ffkeep= &ff setl ma ff=unix noro -" call Decho("setl ma ff=unix noro") +" call Decho("setl ma ff=unix noro",'~'.expand("<slnum>")) " clear off any older non-banner lines " {{{3 " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") - exe "sil! keepjumps ".w:netrw_bannercnt.",$d" +" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d _ (clear off old non-banner lines)",'~'.expand("<slnum>")) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" "......................................... if w:netrw_method == 2 || w:netrw_method == 5 " {{{3 " ftp + <.netrc>: Method #2 if a:path != "" - keepj put ='cd \"'.a:path.'\"' + NetrwKeepj put ='cd \"'.a:path.'\"' endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif - keepj call setline(line("$")+1,a:listcmd) -" exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' + NetrwKeepj call setline(line("$")+1,a:listcmd) +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))' if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1),'~'.expand("<slnum>")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1) else -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1),'~'.expand("<slnum>")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1) endif "......................................... @@ -8554,48 +9601,47 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " ftp + machine,id,passwd,filename: Method #3 setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif " handle userid and password let host= substitute(g:netrw_machine,'\..*$','','') -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("<slnum>")) if exists("s:netrw_hup") && exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' endif endif if a:path != "" - keepj put ='cd \"'.a:path.'\"' + NetrwKeepj put ='cd \"'.a:path.'\"' endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) + NetrwKeepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif - keepj call setline(line("$")+1,a:listcmd) + NetrwKeepj call setline(line("$")+1,a:listcmd) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password if exists("w:netrw_bannercnt") -" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options +" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))' + call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " else " Decho -" call Decho("WARNING: w:netrw_bannercnt doesn't exist!") -" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline(".")) " COMBAK +" call Decho("WARNING: w:netrw_bannercnt doesn't exist!",'~'.expand("<slnum>")) +" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline("."),'~'.expand("<slnum>")) endif "......................................... @@ -8611,34 +9657,34 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) "......................................... else " {{{3 - keepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23) endif " cleanup for Windows " {{{3 if has("win32") || has("win95") || has("win64") || has("win16") - sil! keepj %s/\r$//e - keepj call histdel("/",-1) + sil! NetrwKeepj %s/\r$//e + NetrwKeepj call histdel("/",-1) endif if a:listcmd == "dir" " infer directory/link based on the file permission string - sil! keepj g/d\%([-r][-w][-x]\)\{3}/keepj s@$@/@e - sil! keepj g/l\%([-r][-w][-x]\)\{3}/keepj s/$/@/e - keepj call histdel("/",-1) - keepj call histdel("/",-1) - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST - exe "sil! keepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' - keepj call histdel("/",-1) + sil! NetrwKeepj g/d\%([-r][-w][-x]\)\{3}/NetrwKeepj s@$@/@e + sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' + NetrwKeepj call histdel("/",-1) endif endif " ftp's listing doesn't seem to include ./ or ../ " {{{3 if !search('^\.\/$\|\s\.\/$','wn') - exe 'keepj '.w:netrw_bannercnt - keepj put ='./' + exe 'NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj put ='./' endif if !search('^\.\.\/$\|\s\.\.\/$','wn') - exe 'keepj '.w:netrw_bannercnt - keepj put ='../' + exe 'NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj put ='../' endif " restore settings " {{{3 @@ -8649,7 +9695,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwRemoteListing: {{{2 fun! s:NetrwRemoteListing() -" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)") +" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">) win#".winnr()) if !exists("w:netrw_bannercnt") && exists("s:bannercnt") let w:netrw_bannercnt= s:bannercnt @@ -8662,9 +9708,9 @@ fun! s:NetrwRemoteListing() " sanity check: if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method) +" call Decho("b:netrw_method=".b:netrw_method,'~'.expand("<slnum>")) if !executable("ftp") -" call Decho("ftp is not executable") +" call Decho("ftp is not executable",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) endif @@ -8674,173 +9720,173 @@ fun! s:NetrwRemoteListing() endif elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' -" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">") +" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") if g:netrw_list_cmd == "" - keepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) else - keepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) endif endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Dret("s:NetrwRemoteListing -1") return -1 endif " (remote handling sanity check) -" call Decho("passed remote listing sanity checks") +" call Decho("passed remote listing sanity checks",'~'.expand("<slnum>")) if exists("b:netrw_method") -" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">") +" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">",'~'.expand("<slnum>")) let w:netrw_method= b:netrw_method endif if s:method == "ftp" " use ftp to get remote file listing {{{3 -" call Decho("use ftp to get remote file listing") +" call Decho("use ftp to get remote file listing",'~'.expand("<slnum>")) let s:method = "ftp" let listcmd = g:netrw_ftp_list_cmd - if g:netrw_sort_by =~ '^t' + if g:netrw_sort_by =~# '^t' let listcmd= g:netrw_ftp_timelist_cmd - elseif g:netrw_sort_by =~ '^s' + elseif g:netrw_sort_by =~# '^s' let listcmd= g:netrw_ftp_sizelist_cmd endif -" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("<slnum>")) call s:NetrwRemoteFtpCmd(s:path,listcmd) -" exe "sil! keepalt keepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' +" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."),''~''.expand("<slnum>"))' " report on missing file or directory messages if search('[Nn]o such file or directory\|Failed to change directory') let mesg= getline(".") if exists("w:netrw_bannercnt") setl ma - exe w:netrw_bannercnt.",$d" + exe w:netrw_bannercnt.",$d _" setl noma endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") call netrw#ErrorMsg(s:WARNING,mesg,96) " call Dret("s:NetrwRemoteListing : -1") return -1 endif - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) " shorten the listing -" call Decho("generate short listing") - exe "sil! keepalt keepj ".w:netrw_bannercnt +" call Decho("generate short listing",'~'.expand("<slnum>")) + exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt " cleanup if g:netrw_ftp_browse_reject != "" - exe "sil! keepalt keepj g/".g:netrw_ftp_browse_reject."/keepj d" - keepj call histdel("/",-1) + exe "sil! keepalt NetrwKeepj g/".g:netrw_ftp_browse_reject."/NetrwKeepj d" + NetrwKeepj call histdel("/",-1) endif - sil! keepj %s/\r$//e - keepj call histdel("/",-1) + sil! NetrwKeepj %s/\r$//e + NetrwKeepj call histdel("/",-1) " if there's no ../ listed, then put ../ in let line1= line(".") - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt let line2= search('\.\.\/\%(\s\|$\)','cnW') -" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) if line2 == 0 -" call Decho("netrw is putting ../ into listing") - sil! keepj put='../' +" call Decho("netrw is putting ../ into listing",'~'.expand("<slnum>")) + sil! NetrwKeepj put='../' endif - exe "sil! keepj ".line1 - sil! keepj norm! 0 + exe "sil! NetrwKeepj ".line1 + sil! NetrwKeepj norm! 0 -" call Decho("line1=".line1." line2=".line2." line(.)=".line(".")) +" call Decho("line1=".line1." line2=".line2." line(.)=".line("."),'~'.expand("<slnum>")) if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//' - keepj call histdel("/",-1) +" call Decho("M$ ftp cleanup",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//' + NetrwKeepj call histdel("/",-1) else " normal ftp cleanup -" call Decho("normal ftp cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' - exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' - exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) +" call Decho("normal ftp cleanup",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) endif endif else " use ssh to get remote file listing {{{3 -" call Decho("use ssh to get remote file listing: s:path<".s:path.">") +" call Decho("use ssh to get remote file listing: s:path<".s:path.">",'~'.expand("<slnum>")) let listcmd= s:MakeSshCmd(g:netrw_list_cmd) -" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)",'~'.expand("<slnum>")) if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe sil r! ".shellescape(listcmd.s:path, 1)) - exe "sil! keepj r! ".listcmd.shellescape(s:path, 1) +" call Decho("1: exe r! ".s:ShellEscape(listcmd.s:path, 1),'~'.expand("<slnum>")) + exe "NetrwKeepj r! ".listcmd.s:ShellEscape(s:path, 1) " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like - sil! keepj g/^Listing directory/keepj d - sil! keepj g/^d[-rwx][-rwx][-rwx]/keepj s+$+/+e - sil! keepj g/^l[-rwx][-rwx][-rwx]/keepj s+$+@+e - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) + sil! NetrwKeepj g/^Listing directory/NetrwKeepj d + sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e + sil! NetrwKeepj g/^l[-rwx][-rwx][-rwx]/NetrwKeepj s+$+@+e + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) if g:netrw_liststyle != s:LONGLIST - sil! keepj g/^[dlsp-][-rwx][-rwx][-rwx]/keepj s/^.*\s\(\S\+\)$/\1/e - keepj call histdel("/",-1) + sil! NetrwKeepj g/^[dlsp-][-rwx][-rwx][-rwx]/NetrwKeepj s/^.*\s\(\S\+\)$/\1/e + NetrwKeepj call histdel("/",-1) endif else if s:path == "" -" call Decho("2: exe sil r! ".listcmd) - exe "sil! keepj keepalt r! ".listcmd +" call Decho("2: exe r! ".listcmd,'~'.expand("<slnum>")) + exe "NetrwKeepj keepalt r! ".listcmd else -" call Decho("3: exe sil r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) - exe "sil! keepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) -" call Decho("listcmd<".listcmd."> path<".s:path.">") +" call Decho("3: exe r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1),'~'.expand("<slnum>")) + exe "NetrwKeepj keepalt r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1) +" call Decho("listcmd<".listcmd."> path<".s:path.">",'~'.expand("<slnum>")) endif endif " cleanup if g:netrw_ssh_browse_reject != "" -" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/keepjumps d") - exe "sil! g/".g:netrw_ssh_browse_reject."/keepj d" - keepj call histdel("/",-1) +" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d",'~'.expand("<slnum>")) + exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d" + NetrwKeepj call histdel("/",-1) endif endif if w:netrw_liststyle == s:LONGLIST " do a long listing; these substitutions need to be done prior to sorting {{{3 -" call Decho("fix long listing:") +" call Decho("fix long listing:",'~'.expand("<slnum>")) if s:method == "ftp" " cleanup - exe "sil! keepj ".w:netrw_bannercnt - while getline('.') =~ g:netrw_ftp_browse_reject - sil! keepj d + exe "sil! NetrwKeepj ".w:netrw_bannercnt + while getline('.') =~# g:netrw_ftp_browse_reject + sil! NetrwKeepj d endwhile " if there's no ../ listed, then put ../ in let line1= line(".") - sil! keepj 1 - sil! keepj call search('^\.\.\/\%(\s\|$\)','W') + sil! NetrwKeepj 1 + sil! NetrwKeepj call search('^\.\.\/\%(\s\|$\)','W') let line2= line(".") if line2 == 0 if b:netrw_curdir != '/' - exe 'sil! keepj '.w:netrw_bannercnt."put='../'" + exe 'sil! NetrwKeepj '.w:netrw_bannercnt."put='../'" endif endif - exe "sil! keepj ".line1 - sil! keepj norm! 0 + exe "sil! NetrwKeepj ".line1 + sil! NetrwKeepj norm! 0 endif if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp site listing cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' +" call Decho("M$ ftp site listing cleanup",'~'.expand("<slnum>")) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") -" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$")) - exe 'sil keepj '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' - exe 'sil keepj '.w:netrw_bannercnt - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) +" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>")) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2 \t\1/e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) endif endif " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho -" exe "keepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."),''~''.expand("<slnum>"))' " endif " Decho " call Dret("s:NetrwRemoteListing 0") @@ -8851,18 +9897,19 @@ endfun " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2 fun! s:NetrwRemoteRm(usrhost,path) range " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) -" call Decho("firstline=".a:firstline." lastline=".a:lastline) - let svpos= netrw#SavePosn() +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>")) + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let all= 0 if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files with bufnr#".bufnr("%")) +" call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -8870,28 +9917,32 @@ fun! s:NetrwRemoteRm(usrhost,path) range else " remove files specified by range -" call Decho("remove files specified by range") +" call Decho("remove files specified by range",'~'.expand("<slnum>")) " preparation for removing multiple files/directories - let ctr= a:firstline + let keepsol = &l:sol + setl nosol + let ctr = a:firstline " remove multiple files and directories while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 endwhile + let &l:sol = keepsol endif " refresh the (remote) directory listing -" call Decho("refresh remote directory listing") - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) +" call Decho("refresh remote directory listing",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("s:NetrwRemoteRm") endfun @@ -8906,10 +9957,10 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file (all=".all.")") +" call Decho("attempt to remove file (all=".all.")",'~'.expand("<slnum>")) if !all echohl Statement -" call Decho("case all=0:") +" call Decho("case all=0:",'~'.expand("<slnum>")) call inputsave() let ok= input("Confirm deletion of file<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") call inputrestore() @@ -8918,53 +9969,59 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : "")) + if all || ok =~# 'y\%[es]' || ok == "" +" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("<slnum>")) if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) -" call Decho("case ftp:") +" call Decho("case ftp:",'~'.expand("<slnum>")) let path= a:path - if path =~ '^\a\+://' - let path= substitute(path,'^\a\+://[^/]\+/','','') + if path =~ '^\a\{3,}://' + let path= substitute(path,'^\a\{3,}://[^/]\+/','','') endif - sil! keepj .,$d + sil! NetrwKeepj .,$d _ call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') else -" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">") +" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("<slnum>")) let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>")) if !exists("b:netrw_curdir") - keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) let ok="q" else let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") -" call Decho("remotedir<".remotedir.">") -" call Decho("rmfile<".a:rmfile.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>")) +" call Decho("remotedir<".remotedir.">",'~'.expand("<slnum>")) +" call Decho("rmfile<".a:rmfile.">",'~'.expand("<slnum>")) if remotedir != "" - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(remotedir.a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(remotedir.a:rmfile)) else - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(a:rmfile)) endif -" call Decho("call system(".netrw_rm_cmd.")") +" call Decho("call system(".netrw_rm_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rm_cmd) - if ret != 0 - keepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + if v:shell_error != 0 + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",102) + else + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + endif + elseif ret != 0 + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) endif endif - elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) + elseif ok =~# 'q\%[uit]' +" call Decho("ok==".ok,'~'.expand("<slnum>")) endif else " attempt to remove directory -" call Decho("attempt to remove directory") +" call Decho("attempt to remove directory",'~'.expand("<slnum>")) if !all call inputsave() let ok= input("Confirm deletion of directory<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") @@ -8973,36 +10030,36 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - keepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) + NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') - let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) -" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") + let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.s:ShellEscape(netrw#WinPath(rmfile)) +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rmdir_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) if v:shell_error != 0 -" call Decho("v:shell_error not 0") - let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) -" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") +" call Decho("v:shell_error not 0",'~'.expand("<slnum>")) + let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.s:ShellEscape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rmf_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) if v:shell_error != 0 && !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) endif endif endif - elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) + elseif ok =~# 'q\%[uit]' +" call Decho("ok==".ok,'~'.expand("<slnum>")) endif endif @@ -9016,17 +10073,18 @@ fun! s:NetrwRemoteRename(usrhost,path) range " call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)") " preparation for removing multiple files/directories - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let ctr = a:firstline let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd) " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) else call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9035,16 +10093,16 @@ fun! s:NetrwRemoteRename(usrhost,path) range let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') let newname = substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) endif endif - + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - keepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) + NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif @@ -9054,11 +10112,13 @@ fun! s:NetrwRemoteRename(usrhost,path) range else " attempt to rename files/directories + let keepsol= &l:sol + setl nosol while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr let oldname= s:NetrwGetWord() -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9067,19 +10127,21 @@ fun! s:NetrwRemoteRename(usrhost,path) range if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("NetrwRemoteRename") endfun @@ -9103,37 +10165,37 @@ fun! netrw#FileUrlRead(fname) " call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") let fname = a:fname if fname =~ '^file://localhost/' -" call Decho('converting file://localhost/ -to- file:///') +" call Decho('converting file://localhost/ -to- file:///','~'.expand("<slnum>")) let fname= substitute(fname,'^file://localhost/','file:///','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) endif if (has("win32") || has("win95") || has("win64") || has("win16")) if fname =~ '^file:///\=\a[|:]/' -" call Decho('converting file:///\a|/ -to- file://\a:/') +" call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("<slnum>")) let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) endif endif let fname2396 = netrw#RFC2396(fname) let fname2396e= fnameescape(fname2396) let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows exception for plainfname") +" call Decho("windows exception for plainfname",'~'.expand("<slnum>")) if plainfname =~ '^/\+\a:' -" call Decho('removing leading "/"s') +" call Decho('removing leading "/"s','~'.expand("<slnum>")) let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') endif endif -" call Decho("fname2396<".fname2396.">") -" call Decho("plainfname<".plainfname.">") +" call Decho("fname2396<".fname2396.">",'~'.expand("<slnum>")) +" call Decho("plainfname<".plainfname.">",'~'.expand("<slnum>")) exe "sil doau BufReadPre ".fname2396e - exe 'keepj r '.plainfname + exe 'NetrwKeepj r '.plainfname exe 'sil! bdelete '.plainfname exe 'keepalt file! '.plainfname - keepj 1d -" call Decho("setl nomod") + NetrwKeepj 1d +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("netrw#FileUrlRead") exe "sil doau BufReadPost ".fname2396e endfun @@ -9141,6 +10203,7 @@ endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) + " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), and by <cr> when atop listed file/directory " unfortunate interaction -- split window debugging can't be " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter " event triggers another call to LocalBrowseCheck() when attempts @@ -9149,31 +10212,31 @@ fun! netrw#LocalBrowseCheck(dirname) " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") -" call Decho("isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dredir("ls!","ls!") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) let ykeep= @@ - if isdirectory(a:dirname) -" call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) - let svposn= netrw#SavePosn() + if isdirectory(s:NetrwFile(a:dirname)) +" call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse,'~'.expand("<slnum>")) + if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 -" call Decho("case 1 : ft=".&ft) - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) +" call Decho("case 1 : ft=".&ft,'~'.expand("<slnum>")) +" call Decho("s:rexposn_".bufnr("%")."<".bufname("%")."> ".(exists("s:rexposn_".bufnr("%"))? "exists" : "does not exist"),'~'.expand("<slnum>")) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) elseif &ft == "netrw" && line("$") == 1 -" call Decho("case 2 (ft≡netrw && line($)≡1)") - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) +" call Decho("case 2 (ft≡netrw && line($)≡1)",'~'.expand("<slnum>")) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) elseif exists("s:treeforceredraw") -" call Decho("case 3 (treeforceredraw)") +" call Decho("case 3 (treeforceredraw)",'~'.expand("<slnum>")) unlet s:treeforceredraw - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) endif - +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("netrw#LocalBrowseCheck") return endif @@ -9182,18 +10245,19 @@ fun! netrw#LocalBrowseCheck(dirname) " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) " AND IF the listing style is not a tree listing if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST -" call Decho("wiping out currently unused netrw buffers") +" call Decho("wiping out currently unused netrw buffers",'~'.expand("<slnum>")) let ibuf = 1 let buflast = bufnr("$") while ibuf <= buflast - if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) - exe "sil! keepalt ".ibuf."bw!" + if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf))) + exe "sil! keepj keepalt ".ibuf."bw!" endif let ibuf= ibuf + 1 endwhile endif let @@= ykeep -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " not a directory, ignore it " call Dret("netrw#LocalBrowseCheck : not a directory, ignoring it; dirname<".a:dirname.">") endfun @@ -9205,8 +10269,8 @@ endfun " on the chance that s/he removed/created a file/directory with it. fun! s:LocalBrowseRefresh() " call Dfunc("s:LocalBrowseRefresh() tabpagenr($)=".tabpagenr("$")) -" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '<n/a>')) -" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '<n/a>')) +" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '<n/a>'),'~'.expand("<slnum>")) +" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '<n/a>'),'~'.expand("<slnum>")) " determine which buffers currently reside in a tab if !exists("s:netrw_browselist") @@ -9231,36 +10295,41 @@ fun! s:LocalBrowseRefresh() let itab = itab + 1 tabn endwhile -" call Decho("buftablist".string(buftablist)) -" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") +" call Decho("buftablist".string(buftablist),'~'.expand("<slnum>")) +" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("<slnum>")) " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer let curwin = winnr() let ibl = 0 for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) +" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("<slnum>")) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") - exe "sil! bd ".fnameescape(ibuf) +" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("<slnum>")) + exe "sil! keepj bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>")) continue elseif index(tabpagebuflist(),ibuf) != -1 " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) +" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("<slnum>")) exe bufwinnr(ibuf)."wincmd w" - if getline(".") =~ 'Quick Help' + if getline(".") =~# 'Quick Help' " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp " (counteracts s:NetrwBrowseChgDir()'s incrementing) let g:netrw_quickhelp= g:netrw_quickhelp - 1 endif -" call Decho("#3: quickhelp=".g:netrw_quickhelp) - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) +" call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("<slnum>")) + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop) + endif + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 +" call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("<slnum>")) endfor +" call Decho("restore window: exe ".curwin."wincmd w",'~'.expand("<slnum>")) exe curwin."wincmd w" let @@= ykeep @@ -9271,10 +10340,10 @@ endfun " s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 " " g:netrw_ Directory Is -" fastbrowse Local Remote +" fastbrowse Local Remote " slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) " med 1 D H H=Hiding a buffer implies it may be re-used (fast) -" fast 2 H H +" fast 2 H H " " Deleting a buffer means that it will be re-loaded when examined, hence "slow". " Hiding a buffer means that it will be re-used when examined, hence "fast". @@ -9287,21 +10356,21 @@ endfun " =2: autocmds installed (doesn't ignore any FocusGained events) fun! s:LocalFastBrowser() " call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) -" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a')) -" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed")) -" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed")) +" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("<slnum>")) +" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed"),'~'.expand("<slnum>")) +" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed"),'~'.expand("<slnum>")) " initialize browselist, a list of buffer numbers that the local browser has used if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist") +" call Decho("initialize s:netrw_browselist",'~'.expand("<slnum>")) let s:netrw_browselist= [] endif " append current buffer to fastbrowse list if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] -" call Decho("appendng current buffer to browselist") +" call Decho("appendng current buffer to browselist",'~'.expand("<slnum>")) call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>")) endif " enable autocmd events to handle refreshing/removing local browser buffers @@ -9315,10 +10384,10 @@ fun! s:LocalFastBrowser() augroup AuNetrwEvent au! if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("installing autocmd: ShellCmdPost") +" call Decho("installing autocmd: ShellCmdPost",'~'.expand("<slnum>")) au ShellCmdPost * call s:LocalBrowseRefresh() else -" call Decho("installing autocmds: ShellCmdPost FocusGained") +" call Decho("installing autocmds: ShellCmdPost FocusGained",'~'.expand("<slnum>")) au ShellCmdPost,FocusGained * call s:LocalBrowseRefresh() endif augroup END @@ -9326,7 +10395,7 @@ fun! s:LocalFastBrowser() " user must have changed fastbrowse to its fast setting, so remove " the associated autocmd events elseif g:netrw_fastbrowse > 1 && exists("#ShellCmdPost") && exists("s:netrw_events") -" call Decho("remove AuNetrwEvent autcmd group") +" call Decho("remove AuNetrwEvent autcmd group",'~'.expand("<slnum>")) unlet s:netrw_events augroup AuNetrwEvent au! @@ -9341,70 +10410,71 @@ endfun " s:LocalListing: does the job of "ls" for local directories {{{2 fun! s:LocalListing() " call Dfunc("s:LocalListing()") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) -" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif -" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist",'~'.expand("<slnum>")) |endif +" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist",'~'.expand("<slnum>"))|endif +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(dirname,"*"),0,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) -" call Decho("filelist=".filelist) + let filelist = s:NetrwGlob(dirname,"*",0) + let filelist = filelist + s:NetrwGlob(dirname,".*",0) +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/' " include ../ in the glob() entry if its missing -" call Decho("forcibly including on \"..\"") +" call Decho("forcibly including on \"..\"",'~'.expand("<slnum>")) let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] -" call Decho("filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) endif -" call Decho("before while: dirname<".dirname.">") -" call Decho("before while: dirnamelen<".dirnamelen.">") -" call Decho("before while: filelist=".string(filelist)) +" call Decho("before while: dirname <".dirname.">",'~'.expand("<slnum>")) +" call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("<slnum>")) +" call Decho("before while: filelist =".string(filelist),'~'.expand("<slnum>")) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 -" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy)) -" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen) +" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy),'~'.expand("<slnum>")) +" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen,'~'.expand("<slnum>")) endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) for filename in filelist -" call Decho(" ") -" call Decho("for filename in filelist: filename<".filename.">") +" call Decho(" ",'~'.expand("<slnum>")) +" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>")) if getftype(filename) == "link" " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @") +" call Decho("indicate <".filename."> is a symbolic link with trailing @",'~'.expand("<slnum>")) let pfile= filename."@" elseif getftype(filename) == "socket" " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =") +" call Decho("indicate <".filename."> is a socket with trailing =",'~'.expand("<slnum>")) let pfile= filename."=" elseif getftype(filename) == "fifo" " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |") +" call Decho("indicate <".filename."> is a fifo with trailing |",'~'.expand("<slnum>")) let pfile= filename."|" - elseif isdirectory(filename) + elseif isdirectory(s:NetrwFile(filename)) " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /") +" call Decho("indicate <".filename."> is a directory with trailing /",'~'.expand("<slnum>")) let pfile= filename."/" - elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename) + elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename)) if (has("win32") || has("win95") || has("win64") || has("win16")) if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>")) let pfile= filename."*" else " normal file @@ -9412,7 +10482,7 @@ fun! s:LocalListing() endif elseif executable(filename) " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>")) let pfile= filename."*" else " normal file @@ -9423,54 +10493,60 @@ fun! s:LocalListing() " normal file let pfile= filename endif -" call Decho("pfile<".pfile."> (after *@/ appending)") +" call Decho("pfile<".pfile."> (after *@/ appending)",'~'.expand("<slnum>")) if pfile =~ '//$' let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">") +" call Decho("change // to /: pfile<".pfile.">",'~'.expand("<slnum>")) endif let pfile= strpart(pfile,dirnamelen) let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") +" call Decho("filename<".filename.">",'~'.expand("<slnum>")) +" call Decho("pfile <".pfile.">",'~'.expand("<slnum>")) if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) + if g:netrw_sizestyle =~# "[hH]" + let sz= s:NetrwHumanReadable(sz) + endif let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz) +" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) endif - if g:netrw_sort_by =~ "^t" + if g:netrw_sort_by =~# "^t" " sort by time (handles time up to 1 quintillion seconds, US) -" call Decho("getftime(".filename.")=".getftime(filename)) +" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>")) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe keepjumps put ='".ft.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("<slnum>")) let ftpfile= ft.'/'.pfile - sil! keepj put=ftpfile + sil! NetrwKeepj put=ftpfile elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("getfsize(".filename.")=".getfsize(filename)) +" call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("<slnum>")) let sz = getfsize(filename) + if g:netrw_sizestyle =~# "[hH]" + let sz= s:NetrwHumanReadable(sz) + endif let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe keepj put ='".fsz.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("<slnum>")) let fszpfile= fsz.'/'.pfile - sil! keepj put =fszpfile + sil! NetrwKeepj put =fszpfile else " sort by name -" call Decho("exe keepjumps put ='".pfile."'") - sil! keepj put=pfile +" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>")) + sil! NetrwKeepj put=pfile endif endfor " cleanup any windows mess at end-of-line - sil! keepj g/^$/d - sil! keepj %s/\r$//e + sil! NetrwKeepj g/^$/d + sil! NetrwKeepj %s/\r$//e call histdel("/",-1) -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) " call Dret("s:LocalListing") @@ -9490,9 +10566,9 @@ fun! s:NetrwLocalExecute(cmd) endif let optargs= input(":!".a:cmd,"","file") -" call Decho("optargs<".optargs.">") +" call Decho("optargs<".optargs.">",'~'.expand("<slnum>")) let result= system(a:cmd.optargs) -" call Decho("result) +" call Decho("result,'~'.expand("<slnum>")) " strip any ansi escape sequences off let result = substitute(result,"\e\\[[0-9;]*m","","g") @@ -9505,42 +10581,50 @@ fun! s:NetrwLocalExecute(cmd) endfun " --------------------------------------------------------------------- -" s:NetrwLocalRename: rename a remote file or directory {{{2 +" s:NetrwLocalRename: rename a local file or directory {{{2 fun! s:NetrwLocalRename(path) range " call Dfunc("NetrwLocalRename(path<".a:path.">)") " preparation for removing multiple files/directories - let ykeep = @@ - let ctr = a:firstline - let svpos = netrw#SavePosn() + let ykeep = @@ + let ctr = a:firstline + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) else call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) + let newname= input("Moving ".oldname." to : ",oldname,"file") call inputrestore() + if newname =~ '' + " two ctrl-x's : ignore all of string preceding the ctrl-x's + let newname = substitute(newname,'^.*','','') + elseif newname =~ '' + " one ctrl-x : ignore portion of string preceding ctrl-x but after last / + let newname = substitute(newname,'[^/]*','','') + endif if newname =~ '^s/' let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) let newname = substitute(oldname,subfrom,subto,'') endif endif call rename(oldname,newname) endfor call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - + else " attempt to rename files/directories while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr " sanity checks if line(".") < w:netrw_bannercnt @@ -9553,25 +10637,26 @@ fun! s:NetrwLocalRename(path) range continue endif - keepj norm! 0 + NetrwKeepj norm! 0 let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) call inputsave() let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) call inputrestore() call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") +" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>")) let ctr= ctr + 1 endwhile endif " refresh the directory -" call Decho("refresh the directory listing") - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - keepj call netrw#RestorePosn(svpos) +" call Decho("refresh the directory listing",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwLocalRename") @@ -9581,22 +10666,23 @@ endfun " s:NetrwLocalRm: {{{2 fun! s:NetrwLocalRm(path) range " call Dfunc("s:NetrwLocalRm(path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>")) " preparation for removing multiple files/directories let ykeep = @@ let ret = 0 let all = 0 - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files") +" call Decho("remove all marked files",'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwLocalRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -9604,11 +10690,13 @@ fun! s:NetrwLocalRm(path) range else " remove (multiple) files and directories -" call Decho("remove files in range [".a:firstline.",".a:lastline."]") +" call Decho("remove files in range [".a:firstline.",".a:lastline."]",'~'.expand("<slnum>")) + let keepsol= &l:sol + setl nosol let ctr = a:firstline while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr " sanity checks if line(".") < w:netrw_bannercnt @@ -9621,20 +10709,22 @@ fun! s:NetrwLocalRm(path) range continue endif let ok= s:NetrwLocalRmFile(a:path,curword,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory -" call Decho("bufname<".bufname("%").">") +" call Decho("bufname<".bufname("%").">",'~'.expand("<slnum>")) if bufname("%") != "NetrwMessage" - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif let @@= ykeep @@ -9646,16 +10736,16 @@ endfun " Give confirmation prompt unless all==1 fun! s:NetrwLocalRmFile(path,fname,all) " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all) - + let all= a:all let ok = "" - keepj norm! 0 - let rmfile= s:ComposePath(a:path,a:fname) -" call Decho("rmfile<".rmfile.">") + NetrwKeepj norm! 0 + let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname)) +" call Decho("rmfile<".rmfile.">",'~'.expand("<slnum>")) if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file<".rmfile.">") +" call Decho("attempt to remove file<".rmfile.">",'~'.expand("<slnum>")) if !all echohl Statement call inputsave() @@ -9665,17 +10755,17 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif -" call Decho("response: ok<".ok.">") +" call Decho("response: ok<".ok.">",'~'.expand("<slnum>")) let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') -" call Decho("response: ok<".ok."> (after sub)") - if ok =~ 'a\%[ll]' +" call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>")) + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" let ret= s:NetrwDelete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret) +" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>")) endif else @@ -9689,35 +10779,41 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif let rmfile= substitute(rmfile,'[\/]$','','e') - if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.shellescape(rmfile).')') - call system(netrw#WinPath(g:netrw_localrmdir).' '.shellescape(rmfile)) -" call Decho("v:shell_error=".v:shell_error) + if all || ok =~# 'y\%[es]' || ok == "" + if v:version < 704 || !has("patch1109") +" " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>")) + call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) +" " call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>")) - if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">") - let errcode= s:NetrwDelete(rmfile) -" call Decho("errcode=".errcode) - - if errcode != 0 - if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">") - call system("rm ".shellescape(rmfile)) - if v:shell_error != 0 && !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) + if v:shell_error != 0 +" " call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) + let errcode= s:NetrwDelete(rmfile) +" " call Decho("errcode=".errcode,'~'.expand("<slnum>")) + + if errcode != 0 + if has("unix") +" " call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) + call system("rm ".s:ShellEscape(rmfile)) + if v:shell_error != 0 && !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) + let ok="no" + endif + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) let ok="no" endif - elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) - let ok="no" endif endif + else + if delete(rmfile,"d") + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103) + endif endif endif endif @@ -9729,6 +10825,17 @@ endfun " --------------------------------------------------------------------- " Support Functions: {{{1 +" --------------------------------------------------------------------- +" s:WinNames: COMBAK {{{2 +fun! s:WinNames(id) + let curwin= winnr() + 1wincmd w +" call Decho("--- Windows By Name --- #".a:id) +" windo call Decho("win#".winnr()."<".expand("%").">") +" call Decho("--- --- --- --- --- ---") + exe curwin."wincmd w" +endfun + " --------------------------------------------------------------------- " netrw#Access: intended to provide access to variable values for netrw's test suite {{{2 " 0: marked file list of current buffer @@ -9744,81 +10851,53 @@ fun! netrw#Access(ilist) return s:netrwmftgt endfun -" ------------------------------------------------------------------------ -" netrw#RestorePosn: restores the cursor and file position as saved by NetrwSavePosn() {{{2 -fun! netrw#RestorePosn(...) -" call Dfunc("netrw#RestorePosn() a:0=".a:0." winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1)) - let eikeep= &ei - setl ei=all - if expand("%") == "NetrwMessage" - if exists("s:winBeforeErr") - exe s:winBeforeErr."wincmd w" - endif - endif - +" --------------------------------------------------------------------- +" netrw#Call: allows user-specified mappings to call internal netrw functions {{{2 +fun! netrw#Call(funcname,...) +" call Dfunc("netrw#Call(funcname<".a:funcname.">,".string(a:000).")") if a:0 > 0 - exe "keepj ".a:1 - endif -" call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a')) -" call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) - if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle - let usesrch= 1 + exe "call s:".a:funcname."(".string(a:000).")" else - let usesrch= 0 - endif - -" call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1)) -" call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1)) -" call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0)) -" call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a')) - - " restore window - if exists("w:netrw_winnr") -" call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") - exe "sil! ".w:netrw_winnr."wincmd w" - endif - if v:shell_error == 0 - " as suggested by Bram M: redraw on no error - " allows protocol error messages to remain visible -" redraw! - endif - - " restore top-of-screen line - if exists("w:netrw_hline") -" call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") - exe "keepj norm! ".w:netrw_hline."G0z\<CR>" - endif - - " restore position - " when the window's height x width has changed, the line,col is no longer useful - if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch -" call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") - exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" - - elseif exists("w:netrw_winfile") - if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw') - if exists("w:netrw_bannercnt") -" call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") - exe "keepj ".w:netrw_bannercnt - norm! 0 - else - " go to upper left corner -" call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") - keepj 1 - norm! 0 + exe "call s:".a:funcname."()" + endif +" call Dret("netrw#Call") +endfun + +" --------------------------------------------------------------------- +" netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 +" I expect this function to be used in +" :PChkAssert netrw#Expose("netrwmarkfilelist") +" for example. +fun! netrw#Expose(varname) +" call Dfunc("netrw#Expose(varname<".a:varname.">)") + if exists("s:".a:varname) + exe "let retval= s:".a:varname + if exists("g:netrw_pchk") + if type(retval) == 3 + let retval = copy(retval) + let i = 0 + while i < len(retval) + let retval[i]= substitute(retval[i],expand("$HOME"),'~','') + let i = i + 1 + endwhile endif - else -" call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">") +" call Dret("netrw#Expose ".string(retval)) + return string(retval) endif - else -" call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)) - keepj 1 - norm! 0 + let retval= "n/a" endif - let &ei= eikeep -" call Dret("netrw#RestorePosn : line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) +" call Dret("netrw#Expose ".string(retval)) + return retval +endfun + +" --------------------------------------------------------------------- +" netrw#Modify: allows UserMaps to set (modify) script-local variables {{{2 +fun! netrw#Modify(varname,newvalue) +" call Dfunc("netrw#Modify(varname<".a:varname.">,newvalue<".string(a:newvalue).">)") + exe "let s:".a:varname."= ".string(a:newvalue) +" call Dret("netrw#Modify") endfun " --------------------------------------------------------------------- @@ -9831,45 +10910,43 @@ fun! netrw#RFC2396(fname) endfun " --------------------------------------------------------------------- -" netrw#SavePosn: saves position of cursor on screen {{{2 -fun! netrw#SavePosn() -" call Dfunc("netrw#SavePosn() line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) - " Save current line and column - let w:netrw_winnr= winnr() - let w:netrw_line = line(".") - let w:netrw_col = virtcol(".") -" call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) - - " save filename under cursor -" call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')) - if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw" - let winfile = "|let w:netrw_winfile='".s:NetrwGetWord()."'" - else - let winfile= "" - endif -" call Decho("winfile<".winfile.">") - if exists("w:netrw_liststyle") - let liststyle = "|let liststyle=".w:netrw_liststyle - else - let liststyle= "" - endif -" call Decho("liststyle=".liststyle) - - " Save top-of-screen line - keepj norm! H0 - let w:netrw_hline= line(".") - - " save up alternate position information - " use this when window height x width has changed - let w:netrw_winh = winheight(0) - let w:netrw_winw = winwidth(0) - - " set up string holding position parameters - let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline."|let w:netrw_winh=".w:netrw_winh."|let w:netrw_winw=".w:netrw_winw.liststyle.winfile - - keepj call netrw#RestorePosn() -" call Dret("netrw#SavePosn : winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) - return ret +" netrw#UserMaps: supports user-specified maps {{{2 +" see :help function() +" +" g:Netrw_UserMaps is a List with members such as: +" [[keymap sequence, function reference],...] +" +" The referenced function may return a string, +" refresh : refresh the display +" -other- : this string will be executed +" or it may return a List of strings. +" +" Each keymap-sequence will be set up with a nnoremap +" to invoke netrw#UserMaps(islocal). +" Related functions: +" netrw#Expose(varname) -- see s:varname variables +" netrw#Modify(varname,newvalue) -- modify value of s:varname variable +" netrw#Call(funcname,...) -- call internal netrw function with optional arguments +fun! netrw#UserMaps(islocal) +" call Dfunc("netrw#UserMaps(islocal=".a:islocal.")") +" call Decho("g:Netrw_UserMaps ".(exists("g:Netrw_UserMaps")? "exists" : "does NOT exist"),'~'.expand("<slnum>")) + + " set up usermaplist + if exists("g:Netrw_UserMaps") && type(g:Netrw_UserMaps) == 3 +" call Decho("g:Netrw_UserMaps has type 3<List>",'~'.expand("<slnum>")) + for umap in g:Netrw_UserMaps +" call Decho("type(umap[0]<".string(umap[0]).">)=".type(umap[0])." (should be 1=string)",'~'.expand("<slnum>")) +" call Decho("type(umap[1])=".type(umap[1])." (should be 1=string)",'~'.expand("<slnum>")) + " if umap[0] is a string and umap[1] is a string holding a function name + if type(umap[0]) == 1 && type(umap[1]) == 1 +" call Decho("nno <buffer> <silent> ".umap[0]." :call s:UserMaps(".a:islocal.",".string(umap[1]).")<cr>",'~'.expand("<slnum>")) + exe "nno <buffer> <silent> ".umap[0]." :call <SID>UserMaps(".a:islocal.",'".umap[1]."')<cr>" + else + call netrw#ErrorMsg(s:WARNING,"ignoring usermap <".string(umap[0])."> -- not a [string,funcref] entry",99) + endif + endfor + endif +" call Dret("netrw#UserMaps") endfun " --------------------------------------------------------------------- @@ -9898,28 +10975,28 @@ fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") if has("amiga") -" call Decho("amiga") +" call Decho("amiga",'~'.expand("<slnum>")) let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' - let ret = a:base . "/" . a:subdir + let ret = a:base."/" . a:subdir else - let ret = a:base . a:subdir + let ret = a:base.a:subdir endif elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) let ret= a:subdir elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) if a:base =~ '[/\\]$' let ret= a:base.a:subdir else - let ret= a:base."/".a:subdir + let ret= a:base.'/'.a:subdir endif - elseif a:base =~ '^\a\+://' -" call Decho("remote linux/macos") + elseif a:base =~ '^\a\{3,}://' +" call Decho("remote linux/macos",'~'.expand("<slnum>")) let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','') if a:subdir == '../' @@ -9932,12 +11009,12 @@ fun! s:ComposePath(base,subdir) else let ret= urlbase.curpath.a:subdir endif -" call Decho("urlbase<".urlbase.">") -" call Decho("curpath<".curpath.">") -" call Decho("ret<".ret.">") +" call Decho("urlbase<".urlbase.">",'~'.expand("<slnum>")) +" call Decho("curpath<".curpath.">",'~'.expand("<slnum>")) +" call Decho("ret<".ret.">",'~'.expand("<slnum>")) else -" call Decho("local linux/macos") +" call Decho("local linux/macos",'~'.expand("<slnum>")) let ret = substitute(a:base."/".a:subdir,"//","/","g") if a:base =~ '^//' " keeping initial '//' for the benefit of network share listing support @@ -9950,15 +11027,42 @@ fun! s:ComposePath(base,subdir) return ret endfun +" --------------------------------------------------------------------- +" s:DeleteBookmark: deletes a file/directory from Netrw's bookmark system {{{2 +" Related Functions: s:MakeBookmark() s:NetrwBookHistHandler() s:NetrwBookmark() +fun! s:DeleteBookmark(fname) +" call Dfunc("s:DeleteBookmark(fname<".a:fname.">)") + call s:MergeBookmarks() + + if exists("g:netrw_bookmarklist") + let indx= index(g:netrw_bookmarklist,a:fname) + if indx == -1 + let indx= 0 + while indx < len(g:netrw_bookmarklist) + if g:netrw_bookmarklist[indx] =~ a:fname + call remove(g:netrw_bookmarklist,indx) + let indx= indx - 1 + endif + let indx= indx + 1 + endwhile + else + " remove exact match + call remove(g:netrw_bookmarklist,indx) + endif + endif + +" call Dret("s:DeleteBookmark") +endfun + " --------------------------------------------------------------------- " s:FileReadable: o/s independent filereadable {{{2 fun! s:FileReadable(fname) " call Dfunc("s:FileReadable(fname<".a:fname.">)") if g:netrw_cygwin - let ret= filereadable(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/','')) + let ret= filereadable(s:NetrwFile(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/',''))) else - let ret= filereadable(a:fname) + let ret= filereadable(s:NetrwFile(a:fname)) endif " call Dret("s:FileReadable ".ret) @@ -9975,22 +11079,22 @@ fun! s:GetTempfile(fname) if !exists("b:netrw_tmpfile") " get a brand new temporary filename let tmpfile= tempname() -" call Decho("tmpfile<".tmpfile."> : from tempname()") +" call Decho("tmpfile<".tmpfile."> : from tempname()",'~'.expand("<slnum>")) let tmpfile= substitute(tmpfile,'\','/','ge') -" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /") +" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /",'~'.expand("<slnum>")) " sanity check -- does the temporary file's directory exist? - if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - keepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) + if !isdirectory(s:NetrwFile(substitute(tmpfile,'[^/]\+$','','e'))) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" endif " let netrw#NetSource() know about the tmpfile - let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX() -" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") + let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX() +" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>")) " o/s dependencies if g:netrw_cygwin != 0 @@ -10003,17 +11107,17 @@ fun! s:GetTempfile(fname) let tmpfile = tmpfile endif let b:netrw_tmpfile= tmpfile -" call Decho("o/s dependent fixed tempname<".tmpfile.">") +" call Decho("o/s dependent fixed tempname<".tmpfile.">",'~'.expand("<slnum>")) else " re-use temporary filename let tmpfile= b:netrw_tmpfile -" call Decho("tmpfile<".tmpfile."> re-using") +" call Decho("tmpfile<".tmpfile."> re-using",'~'.expand("<slnum>")) endif " use fname's suffix for the temporary file if a:fname != "" if a:fname =~ '\.[^./]\+$' -" call Decho("using fname<".a:fname.">'s suffix") +" call Decho("using fname<".a:fname.">'s suffix",'~'.expand("<slnum>")) if a:fname =~ '\.tar\.gz$' || a:fname =~ '\.tar\.bz2$' || a:fname =~ '\.tar\.xz$' let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') elseif a:fname =~ '.txz$' @@ -10021,16 +11125,16 @@ fun! s:GetTempfile(fname) else let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') endif -" call Decho("suffix<".suffix.">") +" call Decho("suffix<".suffix.">",'~'.expand("<slnum>")) let tmpfile= substitute(tmpfile,'\.tmp$','','e') -" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)") +" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)",'~'.expand("<slnum>")) let tmpfile .= suffix -" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">") +" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let s:netrw_tmpfile= tmpfile " supports netrw#NetSource() endif endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:GetTempfile <".tmpfile.">") return tmpfile endfun @@ -10056,6 +11160,45 @@ fun! s:MakeSshCmd(sshcmd) return sshcmd endfun +" --------------------------------------------------------------------- +" s:MakeBookmark: enters a bookmark into Netrw's bookmark system {{{2 +fun! s:MakeBookmark(fname) +" call Dfunc("s:MakeBookmark(fname<".a:fname.">)") + + if !exists("g:netrw_bookmarklist") + let g:netrw_bookmarklist= [] + endif + + if index(g:netrw_bookmarklist,a:fname) == -1 + " curdir not currently in g:netrw_bookmarklist, so include it + if isdirectory(s:NetrwFile(a:fname)) && a:fname !~ '/$' + call add(g:netrw_bookmarklist,a:fname.'/') + elseif a:fname !~ '/' + call add(g:netrw_bookmarklist,getcwd()."/".a:fname) + else + call add(g:netrw_bookmarklist,a:fname) + endif + call sort(g:netrw_bookmarklist) + endif + +" call Dret("s:MakeBookmark") +endfun + +" --------------------------------------------------------------------- +" s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2 +fun! s:MergeBookmarks() +" call Dfunc("s:MergeBookmarks() : merge current bookmarks into .netrwbook") + " get bookmarks from .netrwbook file + let savefile= s:NetrwHome()."/.netrwbook" + if filereadable(s:NetrwFile(savefile)) +" call Decho("merge bookmarks (active and file)",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwBookHistSave() +" call Decho("bookmark delete savefile<".savefile.">",'~'.expand("<slnum>")) + NetrwKeepj call delete(savefile) + endif +" call Dret("s:MergeBookmarks") +endfun + " --------------------------------------------------------------------- " s:NetrwBMShow: {{{2 fun! s:NetrwBMShow() @@ -10065,11 +11208,11 @@ fun! s:NetrwBMShow() redir END let bmshowlist = split(bmshowraw,'\n') if bmshowlist != [] - let bmshowfuncs= filter(bmshowlist,'v:val =~ "<SNR>\\d\\+_BMShow()"') + let bmshowfuncs= filter(bmshowlist,'v:val =~# "<SNR>\\d\\+_BMShow()"') if bmshowfuncs != [] let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') - if bmshowfunc =~ '^call.*BMShow()' - exe "sil! keepj ".bmshowfunc + if bmshowfunc =~# '^call.*BMShow()' + exe "sil! NetrwKeepj ".bmshowfunc endif endif endif @@ -10087,13 +11230,13 @@ fun! s:NetrwCursor() if &ft != "netrw" " if the current window isn't a netrw directory listing window, then use user cursorline/column " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. -" call Decho("case ft!=netrw: use user cul,cuc") +" call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc elseif g:netrw_cursor == 4 " all styles: cursorline, cursorcolumn -" call Decho("case g:netrw_cursor==4: setl cul cuc") +" call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("<slnum>")) setl cursorline setl cursorcolumn @@ -10101,11 +11244,11 @@ fun! s:NetrwCursor() " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, cursorcolumn if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc") +" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc",'~'.expand("<slnum>")) setl cursorline setl cursorcolumn else -" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("<slnum>")) setl cursorline let &l:cursorcolumn = s:netrw_usercuc endif @@ -10113,7 +11256,7 @@ fun! s:NetrwCursor() elseif g:netrw_cursor == 2 " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, user's cursorcolumn -" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)") +" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("<slnum>")) let &l:cursorcolumn = s:netrw_usercuc setl cursorline @@ -10122,16 +11265,16 @@ fun! s:NetrwCursor() " wide : cursorline, user's cursorcolumn let &l:cursorcolumn = s:netrw_usercuc if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("<slnum>")) setl cursorline else -" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)") +" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul endif else " all styles: user's cursorline, user's cursorcolumn -" call Decho("default: (use user's cul,cuc)") +" call Decho("default: (use user's cul,cuc)",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc endif @@ -10168,15 +11311,15 @@ fun! s:NetrwDelete(path) let result = delete(path) let &shellslash = sskeep else -" call Decho("exe let result= ".a:cmd."('".path."')") +" call Decho("exe let result= ".a:cmd."('".path."')",'~'.expand("<slnum>")) let result= delete(path) endif else -" call Decho("let result= delete(".path.")") +" call Decho("let result= delete(".path.")",'~'.expand("<slnum>")) let result= delete(path) endif if result < 0 - keepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) endif " call Dret("s:NetrwDelete ".result) @@ -10187,10 +11330,10 @@ endfun " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 fun! s:NetrwEnew(...) " call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")) -" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">") +" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) " grab a function-local-variable copy of buffer variables -" call Decho("make function-local copy of netrw variables") +" call Decho("make function-local copy of netrw variables",'~'.expand("<slnum>")) if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif @@ -10208,16 +11351,20 @@ fun! s:NetrwEnew(...) if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif - keepj call s:NetrwOptionRestore("w:") -" call Decho("generate a buffer with keepjumps keepalt enew!") + NetrwKeepj call s:NetrwOptionRestore("w:") +" call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>")) + " when tree listing uses file TreeListing... a new buffer is made. + " Want the old buffer to be unlisted. + " COMBAK: this causes a problem, see P43 +" setl nobl let netrw_keepdiff= &l:diff - noswapfile keepj keepalt enew! + noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$")) - keepj call s:NetrwOptionSave("w:") +" call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents -" call Decho("copy function-local variables back to buffer netrw variables") +" call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("<slnum>")) if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif @@ -10239,8 +11386,9 @@ fun! s:NetrwEnew(...) let b:netrw_curdir= a:1 if b:netrw_curdir =~ '/$' if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + setl nobl file NetrwTreeListing - setl bt=nowrite noswf bh=hide + setl nobl bt=nowrite bh=hide nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> else @@ -10252,11 +11400,27 @@ fun! s:NetrwEnew(...) " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$")) endfun +" --------------------------------------------------------------------- +" s:NetrwExe: executes a string using "!" {{{2 +fun! s:NetrwExe(cmd) +" call Dfunc("s:NetrwExe(a:cmd)") + if has("win32") && &shell !~? 'cmd' && !g:netrw_cygwin + let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] + set shell& shellcmdflag& shellxquote& shellxescape& + set shellquote& shellpipe& shellredir& shellslash& + exe a:cmd + let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell + else + exe a:cmd + endif +" call Dret("s:NetrwExe") +endfun + " --------------------------------------------------------------------- " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 fun! s:NetrwInsureWinVars() -" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) if !exists("w:netrw_liststyle") +" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) let curbuf = bufnr("%") let curwin = winnr() let iwin = 1 @@ -10271,13 +11435,13 @@ fun! s:NetrwInsureWinVars() endwhile exe "keepalt ".curwin."wincmd w" if exists("winvars") -" call Decho("copying w#".iwin." window variables to w#".curwin) +" call Decho("copying w#".iwin." window variables to w#".curwin,'~'.expand("<slnum>")) for k in keys(winvars) let w:{k}= winvars[k] endfor endif +" call Dret("s:NetrwInsureWinVars win#".winnr()) endif -" call Dret("s:NetrwInsureWinVars win#".winnr()) endfun " --------------------------------------------------------------------- @@ -10286,17 +11450,17 @@ fun! s:NetrwLcd(newdir) " call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)") try - exe 'keepj sil lcd '.fnameescape(a:newdir) + exe 'NetrwKeepj sil lcd '.fnameescape(a:newdir) catch /^Vim\%((\a\+)\)\=:E344/ " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share. " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at - " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or + " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or " forward slashes ('//Foo'), depending on whether backslashes have been converted to " forward slashes by earlier code; so check for both. if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' let dirname = '\' - exe 'keepj sil lcd '.fnameescape(dirname) + exe 'NetrwKeepj sil lcd '.fnameescape(dirname) endif endif catch /^Vim\%((\a\+)\)\=:E472/ @@ -10305,9 +11469,9 @@ fun! s:NetrwLcd(newdir) let a:newdir= w:netrw_prvdir else call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let a:newdir= dirname " call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") return @@ -10326,6 +11490,50 @@ fun! s:NetrwSaveWordPosn() " call Dret("NetrwSaveWordPosn : saveword<".s:netrw_saveword.">") endfun +" --------------------------------------------------------------------- +" s:NetrwHumanReadable: takes a number and makes it "human readable" {{{2 +" 1000 -> 1K, 1000000 -> 1M, 1000000000 -> 1G +fun! s:NetrwHumanReadable(sz) +" call Dfunc("s:NetrwHumanReadable(sz=".a:sz.") type=".type(a:sz)." style=".g:netrw_sizestyle ) + + if g:netrw_sizestyle == 'h' + if a:sz >= 1000000000 + let sz = printf("%.1f",a:sz/1000000000.0)."g" + elseif a:sz >= 10000000 + let sz = printf("%d",a:sz/1000000)."m" + elseif a:sz >= 1000000 + let sz = printf("%.1f",a:sz/1000000.0)."m" + elseif a:sz >= 10000 + let sz = printf("%d",a:sz/1000)."k" + elseif a:sz >= 1000 + let sz = printf("%.1f",a:sz/1000.0)."k" + else + let sz= a:sz + endif + + elseif g:netrw_sizestyle == 'H' + if a:sz >= 1073741824 + let sz = printf("%.1f",a:sz/1073741824.0)."G" + elseif a:sz >= 10485760 + let sz = printf("%d",a:sz/1048576)."M" + elseif a:sz >= 1048576 + let sz = printf("%.1f",a:sz/1048576.0)."M" + elseif a:sz >= 10240 + let sz = printf("%d",a:sz/1024)."K" + elseif a:sz >= 1024 + let sz = printf("%.1f",a:sz/1024.0)."K" + else + let sz= a:sz + endif + + else + let sz= a:sz + endif + +" call Dret("s:NetrwHumanReadable ".sz) + return sz +endfun + " --------------------------------------------------------------------- " s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2 " changed sorting, etc. Also see s:NetrwSaveWordPosn(). @@ -10369,12 +11577,12 @@ fun! s:RemotePathAnalysis(dirname) let s:machine = substitute(s:machine,dirpat,'\2','') endif -" call Decho("set up s:method <".s:method .">") -" call Decho("set up s:user <".s:user .">") -" call Decho("set up s:machine<".s:machine.">") -" call Decho("set up s:port <".s:port.">") -" call Decho("set up s:path <".s:path .">") -" call Decho("set up s:fname <".s:fname .">") +" call Decho("set up s:method <".s:method .">",'~'.expand("<slnum>")) +" call Decho("set up s:user <".s:user .">",'~'.expand("<slnum>")) +" call Decho("set up s:machine<".s:machine.">",'~'.expand("<slnum>")) +" call Decho("set up s:port <".s:port.">",'~'.expand("<slnum>")) +" call Decho("set up s:path <".s:path .">",'~'.expand("<slnum>")) +" call Decho("set up s:fname <".s:fname .">",'~'.expand("<slnum>")) " call Dret("s:RemotePathAnalysis") endfun @@ -10384,23 +11592,23 @@ endfun " Returns status " Runs system() on " [cd REMOTEDIRPATH;] a:cmd -" Note that it doesn't do shellescape(a:cmd)! +" Note that it doesn't do s:ShellEscape(a:cmd)! fun! s:RemoteSystem(cmd) " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") if !executable(g:netrw_ssh_cmd) - keepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) elseif !exists("b:netrw_curdir") - keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) else let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') if remotedir != "" - let cmd= cmd.' cd '.shellescape(remotedir).";" + let cmd= cmd.' cd '.s:ShellEscape(remotedir).";" else let cmd= cmd.' ' endif let cmd= cmd.a:cmd -" call Decho("call system(".cmd.")") +" call Decho("call system(".cmd.")",'~'.expand("<slnum>")) let ret= system(cmd) endif " call Dret("s:RemoteSystem ".ret) @@ -10438,51 +11646,67 @@ endfun " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap " is true) and a command, :Rexplore, which call this function. " -" s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() +" s:netrw_nbcd is set up by s:NetrwBrowseChgDir() +" +" s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) if exists("s:netrwdrag") return endif -" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") -" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">") +" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir."> win#".winnr()) +" call Decho("currently in bufname<".bufname("%").">",'~'.expand("<slnum>")) +" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>")) if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != "" -" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">") - exe "e ".w:netrw_rexfile + " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile +" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">",'~'.expand("<slnum>")) + exe "NetrwKeepj e ".w:netrw_rexfile unlet w:netrw_rexfile " call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")") return +" else " Decho +" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw"),'~'.expand("<slnum>")) +" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>")) endif + " --------------------------- + " :Rex issued while in a file + " --------------------------- + " record current file so :Rex can return to it from netrw let w:netrw_rexfile= expand("%") +" call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("<slnum>")) if !exists("w:netrw_rexlocal") -" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft.")") +" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft." win#".winnr().")") return endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) if w:netrw_rexlocal - keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) + NetrwKeepj call netrw#LocalBrowseCheck(w:netrw_rexdir) else - keepj call s:NetrwBrowse(0,w:netrw_rexdir) + NetrwKeepj call s:NetrwBrowse(0,w:netrw_rexdir) endif if exists("s:initbeval") setl beval endif if exists("s:rexposn_".bufnr("%")) -" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')) - keepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) - unlet s:rexposn_{bufnr('%')} +" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("<slnum>")) + " restore position in directory listing +" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) + if exists("s:rexposn_".bufnr('%')) + unlet s:rexposn_{bufnr('%')} + endif else -" call Decho("s:rexposn_".bufnr('%')." doesn't exist") +" call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("<slnum>")) endif if exists("s:explore_match") exe "2match netrwMarkFile /".s:explore_match."/" endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwRexplore : ft=".&ft) endfun @@ -10502,6 +11726,29 @@ fun! s:SaveBufVars() " call Dret("s:SaveBufVars") endfun +" --------------------------------------------------------------------- +" s:SavePosn: saves position associated with current buffer into a dictionary {{{2 +fun! s:SavePosn(posndict) +" call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + + let a:posndict[bufnr("%")]= winsaveview() +" call Decho("saving posn: posndict[".bufnr("%")."]=".string(winsaveview()),'~'.expand("<slnum>")) + +" call Dret("s:SavePosn posndict") + return a:posndict +endfun + +" --------------------------------------------------------------------- +" s:RestorePosn: restores position associated with current buffer using dictionary {{{2 +fun! s:RestorePosn(posndict) +" call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + if has_key(a:posndict,bufnr("%")) + call winrestview(a:posndict[bufnr("%")]) +" call Decho("restoring posn: posndict[".bufnr("%")."]=".string(a:posndict[bufnr("%")]),'~'.expand("<slnum>")) + endif +" call Dret("s:RestorePosn") +endfun + " --------------------------------------------------------------------- " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2 fun! s:SaveWinVars() @@ -10552,12 +11799,66 @@ endfun " --------------------------------------------------------------------- " s:SetRexDir: set directory for :Rexplore {{{2 fun! s:SetRexDir(islocal,dirname) -" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)") - let w:netrw_rexdir = a:dirname - let w:netrw_rexlocal = a:islocal +" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">) win#".winnr()) + let w:netrw_rexdir = a:dirname + let w:netrw_rexlocal = a:islocal + let s:rexposn_{bufnr("%")} = winsaveview() +" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir,'~'.expand("<slnum>")) +" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal,'~'.expand("<slnum>")) +" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to ".string(winsaveview()),'~'.expand("<slnum>")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun +" --------------------------------------------------------------------- +" s:ShowLink: used to modify thin and tree listings to show links {{{2 +fun! s:ShowLink() +" " call Dfunc("s:ShowLink()") +" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>")) +" " call Decho(printf("line#%4d: %s",line("."),getline(".")),'~'.expand("<slnum>")) + if exists("b:netrw_curdir") + norm! $?\a + let fname = b:netrw_curdir.'/'.s:NetrwGetWord() + let resname = resolve(fname) +" " call Decho("fname <".fname.">",'~'.expand("<slnum>")) +" " call Decho("resname <".resname.">",'~'.expand("<slnum>")) +" " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) + if resname =~ '^\M'.b:netrw_curdir.'/' + let dirlen = strlen(b:netrw_curdir) + let resname = strpart(resname,dirlen+1) +" " call Decho("resname<".resname."> (b:netrw_curdir elided)",'~'.expand("<slnum>")) + endif + let modline = getline(".")."\t --> ".resname +" " call Decho("fname <".fname.">",'~'.expand("<slnum>")) +" " call Decho("modline<".modline.">",'~'.expand("<slnum>")) + setl noro ma + call setline(".",modline) + setl ro noma nomod + endif +" " call Dret("s:ShowLink".((exists("fname")? ' : '.fname : 'n/a'))) +endfun + +" --------------------------------------------------------------------- +" s:ShowStyle: {{{2 +fun! s:ShowStyle() + if !exists("w:netrw_liststyle") + let liststyle= g:netrw_liststyle + else + let liststyle= w:netrw_liststyle + endif + if liststyle == s:THINLIST + return s:THINLIST.":thin" + elseif liststyle == s:LONGLIST + return s:LONGLIST.":long" + elseif liststyle == s:WIDELIST + return s:WIDELIST.":wide" + elseif liststyle == s:TREELIST + return s:TREELIST.":tree" + else + return 'n/a' + endif +endfun + " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its using multi-byte characters. {{{2 " Solution from Nicolai Weibull, vim docs (:help strlen()), @@ -10567,22 +11868,22 @@ fun! s:Strlen(x) if v:version >= 703 && exists("*strdisplaywidth") let ret= strdisplaywidth(a:x) - + elseif type(g:Align_xstrlen) == 1 " allow user to specify a function to compute the string length (ie. let g:Align_xstrlen="mystrlenfunc") exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" - + elseif g:Align_xstrlen == 1 " number of codepoints (Latin a + combining circumflex is two codepoints) " (comment from TM, solution from NW) let ret= strlen(substitute(a:x,'.','c','g')) - + elseif g:Align_xstrlen == 2 " number of spacing codepoints (Latin a + combining circumflex is one spacing " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) " (comment from TM, solution from TM) let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) - + elseif g:Align_xstrlen == 3 " virtual length (counting, for instance, tabs as anything between 1 and " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately @@ -10593,9 +11894,9 @@ fun! s:Strlen(x) call setline(line("."),a:x) let ret= virtcol("$") - 1 d - keepj norm! k + NetrwKeepj norm! k let &l:mod= modkeep - + else " at least give a decent default let ret= strlen(a:x) @@ -10605,56 +11906,49 @@ fun! s:Strlen(x) endfun " --------------------------------------------------------------------- -" s:TreeListMove: {{{2 +" s:ShellEscape: shellescape(), or special windows handling {{{2 +fun! s:ShellEscape(s, ...) + if (has('win32') || has('win64')) && $SHELL == '' && &shellslash + return printf('"%s"', substitute(a:s, '"', '""', 'g')) + endif + let f = a:0 > 0 ? a:1 : 0 + return shellescape(a:s, f) +endfun + +" --------------------------------------------------------------------- +" s:TreeListMove: supports [[, ]], [], and ][ in tree mode {{{2 fun! s:TreeListMove(dir) " call Dfunc("s:TreeListMove(dir<".a:dir.">)") - let curline = getline('.') - let prvline = (line(".") > 1)? getline(line(".")-1) : '' - let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' - let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','') - let indentm1 = substitute(curindent,'^'.s:treedepthstring.' ','','') -" call Decho("prvline <".prvline."> #".line(".")-1) -" call Decho("curline <".curline."> #".line(".")) -" call Decho("nxtline <".nxtline."> #".line(".")+1) -" call Decho("curindent<".curindent.">") -" call Decho("indentm1 <".indentm1.">") - + let curline = getline('.') + let prvline = (line(".") > 1)? getline(line(".")-1) : '' + let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' + let curindent = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') + let indentm1 = substitute(curindent,'^'.s:treedepthstring,'','') + let treedepthchr = substitute(s:treedepthstring,' ','','g') + let stopline = exists("w:netrw_bannercnt")? w:netrw_bannercnt : 1 +" call Decho("prvline <".prvline."> #".(line(".")-1), '~'.expand("<slnum>")) +" call Decho("curline <".curline."> #".line(".") , '~'.expand("<slnum>")) +" call Decho("nxtline <".nxtline."> #".(line(".")+1), '~'.expand("<slnum>")) +" call Decho("curindent<".curindent.">" , '~'.expand("<slnum>")) +" call Decho("indentm1 <".indentm1.">" , '~'.expand("<slnum>")) + " COMBAK : need to handle when on a directory + " COMBAK : need to handle ]] and ][. In general, needs work!!! if curline !~ '/$' -" call Decho('regfile') - if a:dir == '[' && prvline != '' - keepj norm! 0 - let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file -" call Decho("regfile srch back: ".nl) - elseif a:dir == ']' && nxtline != '' - keepj norm! $ - let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file -" call Decho("regfile srch fwd: ".nl) - endif - - elseif a:dir == '[' && prvline != '' - keepj norm! 0 - let curline= line(".") - let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation -" call Decho("dir srch back ind: ".nl) - if nl != 0 - if line(".") == curline-1 - let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from directory, indentation - 1 -" call Decho("dir srch back ind-1: ".nl) - endif - endif - - elseif a:dir == ']' && nxtline != '' - keepj norm! $ - let curline = line(".") - let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation -" call Decho("dir srch fwd ind: ".nl) - if nl != 0 - if line(".") == curline+1 - let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from directory, indentation - 1 -" call Decho("dir srch fwd ind-1: ".nl) + if a:dir == '[[' && prvline != '' + NetrwKeepj norm! 0 + let nl = search('^'.indentm1.'\%('.s:treedepthstring.'\)\@!','bWe',stopline) " search backwards +" call Decho("regfile srch back: ".nl,'~'.expand("<slnum>")) + elseif a:dir == '[]' && nxtline != '' + NetrwKeepj norm! 0 +" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("<slnum>")) + let nl = search('^\%('.curindent.'\)\@!','We') " search forwards + if nl != 0 + NetrwKeepj norm! k + else + NetrwKeepj norm! G endif +" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>")) endif - endif " call Dret("s:TreeListMove") @@ -10672,7 +11966,7 @@ fun! s:UpdateBuffersMenu() sil emenu Buffers.Refresh\ menu catch /^Vim\%((\a\+)\)\=:E/ let v:errmsg= "" - sil keepj call s:NetrwBMShow() + sil NetrwKeepj call s:NetrwBMShow() endtry endif " call Dret("s:UpdateBuffersMenu") @@ -10696,6 +11990,48 @@ fun! s:UseBufWinVars() " call Dret("s:UseBufWinVars") endfun +" --------------------------------------------------------------------- +" s:UserMaps: supports user-defined UserMaps {{{2 +" * calls a user-supplied funcref(islocal,curdir) +" * interprets result +" See netrw#UserMaps() +fun! s:UserMaps(islocal,funcname) +" call Dfunc("s:UserMaps(islocal=".a:islocal.",funcname<".a:funcname.">)") + + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + let Funcref = function(a:funcname) + let result = Funcref(a:islocal) + + if type(result) == 1 + " if result from user's funcref is a string... +" call Decho("result string from user funcref<".result.">",'~'.expand("<slnum>")) + if result == "refresh" +" call Decho("refreshing display",'~'.expand("<slnum>")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif result != "" +" call Decho("executing result<".result.">",'~'.expand("<slnum>")) + exe result + endif + + elseif type(result) == 3 + " if result from user's funcref is a List... +" call Decho("result List from user funcref<".string(result).">",'~'.expand("<slnum>")) + for action in result + if action == "refresh" +" call Decho("refreshing display",'~'.expand("<slnum>")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif action != "" +" call Decho("executing action<".action.">",'~'.expand("<slnum>")) + exe action + endif + endfor + endif + +" call Dret("s:UserMaps") +endfun + " --------------------------------------------------------------------- " Settings Restoration: {{{1 let &cpo= s:keepcpo diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index 541ee65ccb..4639909ee8 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,7 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Aug 27, 2013 +" Date: Dec 30, 2014 " Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz> -" Version: 14 +" Version: 15 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v14" +let g:loaded_netrwSettings = "v15" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" @@ -31,7 +31,7 @@ endif " NetrwSettings: {{{1 fun! netrwSettings#NetrwSettings() " this call is here largely just to insure that netrw has been loaded - call netrw#NetrwSavePosn() + call netrw#SavePosn() if !exists("g:loaded_netrw") echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None return @@ -177,6 +177,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction put = 'let g:netrw_sort_options = '.g:netrw_sort_options put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence + put = 'let g:netrw_servername = '.g:netrw_servername put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd diff --git a/runtime/autoload/netrw_gitignore.vim b/runtime/autoload/netrw_gitignore.vim index 0de902cbb4..da3f50bca0 100644 --- a/runtime/autoload/netrw_gitignore.vim +++ b/runtime/autoload/netrw_gitignore.vim @@ -61,9 +61,16 @@ function! netrw_gitignore#Hide(...) " convert gitignore patterns to Netrw/Vim regex patterns let escaped_lines = [] for line in gitignore_lines - let escaped = line - let escaped = substitute(escaped, '\.', '\\.', 'g') - let escaped = substitute(escaped, '*', '.*', 'g') + let escaped = line + let escaped = substitute(escaped, '\*\*', '*', 'g') + let escaped = substitute(escaped, '\.', '\\.', 'g') + let escaped = substitute(escaped, '\$', '\\$', 'g') + let escaped = substitute(escaped, '*', '.*', 'g') + " correction: dot, dollar and asterisks chars shouldn't be escaped when + " within regex matching groups. + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g') + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g') + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g') let escaped_lines = add(escaped_lines, escaped) endfor diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 0bdcd5d5fb..8e38867a77 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 May 30 +" Last Change: 2016 Oct 10 " " OPTIONS: " @@ -94,9 +94,9 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ " Check if we are inside of PHP markup let pos = getpos('.') let phpbegin = searchpairpos('<?', '', '?>', 'bWn', - \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') let phpend = searchpairpos('<?', '', '?>', 'Wn', - \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') if phpbegin == [0,0] && phpend == [0,0] " We are outside of any PHP markup. Complete HTML @@ -141,71 +141,82 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ if a:base != "" let context = substitute(context, '\s*[$a-zA-Z_0-9\x7f-\xff]*$', '', '') end + else + let context = '' end - let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) + try + let winheight = winheight(0) + let winnr = winnr() - if context =~? '^use\s' - return phpcomplete#CompleteUse(a:base) - endif + let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) - if context =~ '\(->\|::\)$' - " {{{ - " Get name of the class - let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) + if context =~? '^use\s' || context ==? 'use' + return phpcomplete#CompleteUse(a:base) + endif + + if context =~ '\(->\|::\)$' + " {{{ + " Get name of the class + let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) - " Get location of class definition, we have to iterate through all - if classname != '' - if classname =~ '\' - " split the last \ segment as a classname, everything else is the namespace - let classname_parts = split(classname, '\') - let namespace = join(classname_parts[0:-2], '\') - let classname = classname_parts[-1] + " Get location of class definition, we have to iterate through all + if classname != '' + if classname =~ '\' + " split the last \ segment as a classname, everything else is the namespace + let classname_parts = split(classname, '\') + let namespace = join(classname_parts[0:-2], '\') + let classname = classname_parts[-1] + else + let namespace = '\' + endif + let classlocation = phpcomplete#GetClassLocation(classname, namespace) else - let namespace = '\' + let classlocation = '' endif - let classlocation = phpcomplete#GetClassLocation(classname, namespace) - else - let classlocation = '' - endif - if classlocation != '' - if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) - return phpcomplete#CompleteBuiltInClass(context, classname, a:base) - endif + if classlocation != '' + if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) + return phpcomplete#CompleteBuiltInClass(context, classname, a:base) + endif - if filereadable(classlocation) - let classfile = readfile(classlocation) - let classcontent = '' - let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) - let sccontent = split(classcontent, "\n") - let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' + if filereadable(classlocation) + let classfile = readfile(classlocation) + let classcontent = '' + let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) + let sccontent = split(classcontent, "\n") + let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' - return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) + return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) + endif endif - endif - - return phpcomplete#CompleteUnknownClass(a:base, context) - " }}} - elseif context =~? 'implements' - return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) - elseif context =~? 'extends\s\+.\+$' - return ['implements'] - elseif context =~? 'extends' - let kinds = context =~? 'class\s' ? ['c'] : ['i'] - return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) - elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' - " special case when you've typed the class keyword and the name too, only extends and implements allowed there - return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') - elseif context =~? 'new' - return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) - endif - if a:base =~ '^\$' - return phpcomplete#CompleteVariable(a:base) - else - return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) - endif + return phpcomplete#CompleteUnknownClass(a:base, context) + " }}} + elseif context =~? 'implements' + return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) + elseif context =~? 'instanceof' + return phpcomplete#CompleteClassName(a:base, ['c', 'n'], current_namespace, imports) + elseif context =~? 'extends\s\+.\+$' && a:base == '' + return ['implements'] + elseif context =~? 'extends' + let kinds = context =~? 'class\s' ? ['c'] : ['i'] + return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) + elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' + " special case when you've typed the class keyword and the name too, only extends and implements allowed there + return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') + elseif context =~? 'new' + return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) + endif + + if a:base =~ '^\$' + return phpcomplete#CompleteVariable(a:base) + else + return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) + endif + finally + silent! exec winnr.'resize '.winheight + endtry endfunction " }}} @@ -244,12 +255,13 @@ function! phpcomplete#CompleteUse(base) " {{{ if has_key(tag, 'namespace') let patched_ctags_detected = 1 endif + if tag.kind ==? 'n' && tag.name =~? '^'.namespace_match_pattern let patched_ctags_detected = 1 call add(namespaced_matches, {'word': tag.name, 'kind': 'n', 'menu': tag.filename, 'info': tag.filename }) - elseif has_key(tag, 'namespace') && (tag.kind ==? 'c' || tag.kind ==? 'i') && tag.namespace ==? namespace_for_class + elseif has_key(tag, 'namespace') && (tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't') && tag.namespace ==? namespace_for_class call add(namespaced_matches, {'word': namespace_for_class.'\'.tag.name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) - elseif (tag.kind ==? 'c' || tag.kind ==? 'i') + elseif (tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't') call add(no_namespace_matches, {'word': namespace_for_class.'\'.tag.name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) endif endfor @@ -272,12 +284,16 @@ function! phpcomplete#CompleteUse(base) " {{{ endfor endif + for comp in res + let comp.word = substitute(comp.word, '^\\', '', '') + endfor + return res endfunction " }}} function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ - " Complete everything else - + " Complete everything " + functions, DONE " + keywords of language DONE " + defines (constant definitions), DONE @@ -304,7 +320,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') if f_name =~? '^'.substitute(a:base, '\\', '\\\\', 'g') let f_args = matchstr(i, - \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|$\)') + \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|$\)') let int_functions[f_name.'('] = f_args.')' endif endfor @@ -326,6 +342,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ let ext_functions = {} let ext_constants = {} let ext_classes = {} + let ext_traits = {} let ext_interfaces = {} let ext_namespaces = {} @@ -420,7 +437,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ endif endif endif - elseif tag.kind ==? 'c' || tag.kind ==? 'i' + elseif tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't' let info = ' - '.tag.filename let key = '' @@ -441,6 +458,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ let ext_classes[key] = info elseif tag.kind ==? 'i' let ext_interfaces[key] = info + elseif tag.kind ==? 't' + let ext_traits[key] = info endif endif endif @@ -463,7 +482,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ endfor for [interfacename, info] in items(g:php_builtin_interfacenames) if interfacename =~? '^'.base - let builtin_interfaces[leading_slash.interfacename] = info + let builtin_interfaces[leading_slash.g:php_builtin_interfaces[tolower(interfacename)].name] = info endif endfor endif @@ -511,6 +530,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ else let ext_interfaces[imported_name] = ' '.import.name.' - '.import.filename endif + elseif import.kind ==? 't' + let ext_traits[imported_name] = ' '.import.name.' - '.import.filename endif " no builtin interfaces @@ -540,6 +561,9 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ " Add external interfaces call extend(all_values, ext_interfaces) + " Add external traits + call extend(all_values, ext_traits) + " Add built-in classes call extend(all_values, builtin_classnames) @@ -566,6 +590,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ elseif has_key(ext_interfaces, i) || has_key(builtin_interfaces, i) let info = has_key(ext_interfaces, i) ? ext_interfaces[i] : builtin_interfaces[i].' - builtin' let final_list += [{'word':i, 'kind': 'i', 'menu': info, 'info': i.info}] + elseif has_key(ext_traits, i) + let final_list += [{'word':i, 'kind': 't', 'menu': ext_traits[i], 'info': ext_traits[i]}] elseif has_key(int_constants, i) || has_key(builtin_constants, i) let info = has_key(int_constants, i) ? int_constants[i] : ' - builtin' let final_list += [{'word':i, 'kind': 'd', 'menu': info, 'info': i.info}] @@ -622,7 +648,7 @@ function! phpcomplete#CompleteUnknownClass(base, context) " {{{ let f_name = matchstr(i, \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') let f_args = matchstr(i, - \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|$\)') + \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|$\)') let int_functions[f_name.'('] = f_args.')' endfor @@ -763,6 +789,8 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) if kinds == ['c', 'i'] let filterstr = 'v:val =~? "\\(class\\|interface\\)\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' + elseif kinds == ['c', 'n'] + let filterstr = 'v:val =~? "\\(class\\|namespace\\)\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' elseif kinds == ['c'] let filterstr = 'v:val =~? "class\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' elseif kinds == ['i'] @@ -784,7 +812,7 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) let tags = [] if len(tag_match_pattern) >= g:phpcomplete_min_num_of_chars_for_namespace_completion - let tags = phpcomplete#GetTaglist('^'.tag_match_pattern) + let tags = phpcomplete#GetTaglist('^\c'.tag_match_pattern) endif if len(tags) @@ -803,7 +831,7 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) endif let relative_name = namespace_part.tag.name " match base without the namespace part for namespaced base but not namespaced tags, for tagfiles with old ctags - if !has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && stridx(tag.name, base[len(namespace_part):]) == 0 + if !has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && stridx(tolower(tag.name), tolower(base[len(namespace_part):])) == 0 call add(no_namespace_matches, {'word': leading_slash.relative_name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) endif if has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && tag.namespace ==? namespace_for_class @@ -861,6 +889,39 @@ function! phpcomplete#CompareCompletionRow(i1, i2) " {{{ endfunction " }}} +function! s:getNextCharWithPos(filelines, current_pos) " {{{ + let line_no = a:current_pos[0] + let col_no = a:current_pos[1] + let last_line = a:filelines[len(a:filelines) - 1] + let end_pos = [len(a:filelines) - 1, strlen(last_line) - 1] + if line_no > end_pos[0] || line_no == end_pos[0] && col_no > end_pos[1] + return ['EOF', 'EOF'] + endif + + " we've not reached the end of the current line break + if col_no + 1 < strlen(a:filelines[line_no]) + let col_no += 1 + else + " we've reached the end of the current line, jump to the next + " non-blank line (blank lines have no position where we can read from, + " not even a whitespace. The newline char does not positionable by vim + let line_no += 1 + while strlen(a:filelines[line_no]) == 0 + let line_no += 1 + endwhile + + let col_no = 0 + endif + + " return 'EOF' string to signal end of file, normal results only one char + " in length + if line_no == end_pos[0] && col_no > end_pos[1] + return ['EOF', 'EOF'] + endif + + return [[line_no, col_no], a:filelines[line_no][col_no]] +endfunction " }}} + function! phpcomplete#EvaluateModifiers(modifiers, required_modifiers, prohibited_modifiers) " {{{ " if theres no modifier, and no modifier is allowed and no modifier is required if len(a:modifiers) == 0 && len(a:required_modifiers) == 0 @@ -874,7 +935,7 @@ function! phpcomplete#EvaluateModifiers(modifiers, required_modifiers, prohibite endfor for modifier in a:modifiers - " if the modifier is prohibited its a no match + " if the modifier is prohibited it's a no match if index(a:prohibited_modifiers, modifier) != -1 return 0 endif @@ -924,7 +985,7 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " let f_name = matchstr(i, \ 'function\s*&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') let f_args = matchstr(i, - \ 'function\s*&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|\_$\)') + \ 'function\s*&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|\_$\)') if f_name != '' && stridx(f_name, '__') != 0 let c_functions[f_name.'('] = f_args if g:phpcomplete_parse_docblock_comments @@ -939,7 +1000,7 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " let required_modifiers += ['static'] endif let all_variable = filter(deepcopy(a:sccontent), - \ 'v:val =~ "^\\s*\\(var\\s\\+\\|public\\s\\+\\|protected\\s\\+\\|private\\s\\+\\|final\\s\\+\\|abstract\\s\\+\\|static\\s\\+\\)\\+\\$"') + \ 'v:val =~ "\\(^\\s*\\(var\\s\\+\\|public\\s\\+\\|protected\\s\\+\\|private\\s\\+\\|final\\s\\+\\|abstract\\s\\+\\|static\\s\\+\\)\\+\\$\\|^\\s*\\(\\/\\|\\*\\)*\\s*@property\\s\\+\\S\\+\\s\\S\\{-}\\s*$\\)"') let variables = [] for i in all_variable @@ -949,12 +1010,11 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " endif endfor - let jvars = join(variables, ' ') - let svars = split(jvars, '\$') + let static_vars = split(join(variables, ' '), '\$') let c_variables = {} let var_index = 0 - for i in svars + for i in static_vars let c_var = matchstr(i, \ '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') if c_var != '' @@ -1083,7 +1143,6 @@ endfunction " }}} function! phpcomplete#GetTaglist(pattern) " {{{ - let cache_checksum = '' if g:phpcomplete_cache_taglists == 1 " build a string with format of "<tagfile>:<mtime>$<tagfile2>:<mtime2>..." @@ -1105,6 +1164,14 @@ function! phpcomplete#GetTaglist(pattern) " {{{ endif let tags = taglist(a:pattern) + for tag in tags + for prop in keys(tag) + if prop == 'cmd' || prop == 'static' || prop == 'kind' || prop == 'builtin' + continue + endif + let tag[prop] = substitute(tag[prop], '\\\\', '\\', 'g') + endfor + endfor let s:cache_tags[a:pattern] = tags let has_key = has_key(s:cache_tags, a:pattern) let s:cache_tags_checksum = cache_checksum @@ -1174,11 +1241,11 @@ function! phpcomplete#GetCurrentInstruction(line_number, col_number, phpbegin) " " break if we are on a "naked" stop_char (operators, colon, openparent...) if index(stop_chars, current_char) != -1 let do_break = 1 - " dont break does not look like a "->" + " dont break if it does look like a "->" if (prev_char == '-' && current_char == '>') || (current_char == '-' && next_char == '>') let do_break = 0 endif - " dont break if its looks like a "::" + " dont break if it does look like a "::" if (prev_char == ':' && current_char == ':') || (current_char == ':' && next_char == ':') let do_break = 0 endif @@ -1324,16 +1391,25 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat " Get Structured information of all classes and subclasses including namespace and includes " try to find the method's return type in docblock comment for classstructure in classcontents - let doclock_target_pattern = 'function\s\+&\?'.method.'\|\(public\|private\|protected\|var\).\+\$'.method - let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), doclock_target_pattern) + let docblock_target_pattern = 'function\s\+&\?'.method.'\>\|\(public\|private\|protected\|var\).\+\$'.method.'\>\|@property.\+\$'.method.'\>' + let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern) if doc_str != '' break endif endfor if doc_str != '' let docblock = phpcomplete#ParseDocBlock(doc_str) - if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') - let type = has_key(docblock.return, 'type') ? docblock.return.type : docblock.var.type + if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0 + let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : '' + + if type == '' + for property in docblock.properties + if property.description =~? method + let type = property.type + break + endif + endfor + endif " there's a namespace in the type, threat the type as FQCN if type =~ '\\' @@ -1358,8 +1434,12 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat endif " make @return self, static, $this the same way " (not exactly what php means by these) - if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' - let classname_candidate = a:classname_candidate + if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' || returnclass == 'self[]' || returnclass == 'static[]' || returnclass == '$this[]' + if returnclass =~ '\[\]$' + let classname_candidate = a:classname_candidate.'[]' + else + let classname_candidate = a:classname_candidate + endif let class_candidate_namespace = a:class_candidate_namespace else let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(returnclass, fullnamespace, a:imports) @@ -1447,6 +1527,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " Get class name " Class name can be detected in few ways: " @var $myVar class + " @var class $myVar " in the same line (php 5.4 (new Class)-> syntax) " line above " or line in tags file @@ -1472,21 +1553,19 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor return '' endif - if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class' - let class_name = matchstr(line, '\c\s*class\s*\zs'.class_name_pattern.'\ze') + if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class\s' + let class_name = matchstr(line, '\cclass\s\+\zs'.class_name_pattern.'\ze') let extended_class = matchstr(line, '\cclass\s\+'.class_name_pattern.'\s\+extends\s\+\zs'.class_name_pattern.'\ze') let classname_candidate = a:context =~? 'parent::' ? extended_class : class_name - else - let i += 1 - continue + if classname_candidate != '' + let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) + " return absolute classname, without leading \ + return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate + endif endif - if classname_candidate != '' - let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) - " return absolute classname, without leading \ - return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate - endif + let i += 1 endwhile elseif a:context =~? '(\s*new\s\+'.class_name_pattern.'\s*)->' let classname_candidate = matchstr(a:context, '\cnew\s\+\zs'.class_name_pattern.'\ze') @@ -1496,6 +1575,9 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor elseif get(methodstack, 0) =~# function_invocation_pattern let function_name = matchstr(methodstack[0], '^\s*\zs'.function_name_pattern) let function_file = phpcomplete#GetFunctionLocation(function_name, a:current_namespace) + if function_file == '' + let function_file = phpcomplete#GetFunctionLocation(function_name, '\') + endif if function_file == 'VIMPHP_BUILTINFUNCTION' " built in function, grab the return type from the info string @@ -1511,7 +1593,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines) " try to expand the classname of the returned type with the context got from the function's source file - let [classname_candidate, unused] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) endif endif if classname_candidate != '' @@ -1525,6 +1607,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let object_is_array = (object =~ '\v^[^[]+\[' ? 1 : 0) let object = matchstr(object, variable_name_pattern) + let function_boundary = phpcomplete#GetCurrentFunctionBoundaries() + let search_end_line = max([1, function_boundary[0][0]]) + " -1 makes us ignore the current line (where the completion was invoked + let lines = reverse(getline(search_end_line, a:start_line - 1)) + " check Constant lookup let constant_object = matchstr(a:context, '\zs'.class_name_pattern.'\ze::') if constant_object != '' @@ -1533,21 +1620,20 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor if classname_candidate == '' " scan the file backwards from current line for explicit type declaration (@var $variable Classname) - let i = 1 " start from the current line - 1 - while i < a:start_line - let line = getline(a:start_line - i) + for line in lines " in file lookup for /* @var $foo Class */ if line =~# '@var\s\+'.object.'\s\+'.class_name_pattern let classname_candidate = matchstr(line, '@var\s\+'.object.'\s\+\zs'.class_name_pattern.'\(\[\]\)\?') let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break - elseif line !~ '^\s*$' - " type indicator comments should be next to the variable - " non empty lines break the search + endif + " in file lookup for /* @var Class $foo */ + if line =~# '@var\s\+'.class_name_pattern.'\s\+'.object + let classname_candidate = matchstr(line, '@var\s\+\zs'.class_name_pattern.'\(\[\]\)\?\ze'.'\s\+'.object) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break endif - let i += 1 - endwhile + endfor endif if classname_candidate != '' @@ -1555,12 +1641,9 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " return absolute classname, without leading \ return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate endif - " scan the file backwards from the current line let i = 1 - while i < a:start_line " {{{ - let line = getline(a:start_line - i) - + for line in lines " {{{ " do in-file lookup of $var = new Class if line =~# '^\s*'.object.'\s*=\s*new\s\+'.class_name_pattern && !object_is_array let classname_candidate = matchstr(line, object.'\c\s*=\s*new\s*\zs'.class_name_pattern.'\ze') @@ -1591,32 +1674,34 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let sub_methodstack = phpcomplete#GetMethodStack(matchstr(line, '^\s*'.object.'\s*=&\?\s*\s\+\zs.*')) let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType( \ classname, - \ a:current_namespace, + \ namespace_for_class, \ a:imports, \ sub_methodstack) + return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate endif endif - " in-file lookup for typehinted function arguments - " - the function can have a name or be anonymous (e.g., function qux() { ... } vs. function () { ... }) - " - the type-hinted argument can be anywhere in the arguments list. - if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.class_name_pattern.'\s\+'.object && !object_is_array - let f_args = matchstr(line, '\cfunction\(\s\+'.function_name_pattern.'\)\?\s*(\zs.\{-}\ze)') - let args = split(f_args, '\s*\zs,\ze\s*') - for arg in args - if arg =~# object.'\(,\|$\)' - let classname_candidate = matchstr(arg, '\s*\zs'.class_name_pattern.'\ze\s\+'.object) + " function declaration line + if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(' + let function_lines = join(reverse(copy(lines)), " ") + " search for type hinted arguments + if function_lines =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.class_name_pattern.'\s\+'.object && !object_is_array + let f_args = matchstr(function_lines, '\cfunction\(\s\+'.function_name_pattern.'\)\?\s*(\zs.\{-}\ze)') + let args = split(f_args, '\s*\zs,\ze\s*') + for arg in args + if arg =~# object.'\(,\|$\)' + let classname_candidate = matchstr(arg, '\s*\zs'.class_name_pattern.'\ze\s\+'.object) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) + break + endif + endfor + if classname_candidate != '' break endif - endfor - if classname_candidate != '' - break endif - endif - " if we see a function declaration, try loading the docblock for it and look for matching @params - if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.object + " search for docblock for the function let match_line = substitute(line, '\\', '\\\\', 'g') let sccontent = getline(0, a:start_line - i) let doc_str = phpcomplete#GetDocBlock(sccontent, match_line) @@ -1625,6 +1710,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor for param in docblock.params if param.name =~? object let classname_candidate = matchstr(param.type, class_name_pattern.'\(\[\]\)\?') + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break endif endfor @@ -1635,10 +1721,40 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif " assignment for the variable in question with a variable on the right hand side - if line =~# '^\s*'.object.'\s*=&\?\s*'.variable_name_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + if line =~# '^\s*'.object.'\s*=&\?\s\+\(clone\)\?\s*'.variable_name_pattern + + " try to find the next non-comment or string ";" char + let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s\+\(clone\)\?\s*'.variable_name_pattern) + let filelines = reverse(copy(lines)) + let [pos, char] = s:getNextCharWithPos(filelines, [len(filelines) - i, start_col]) + let chars_read = 1 + let last_pos = pos + " function_boundary == 0 if we are not in a function + let real_lines_offset = len(function_boundary) == 1 ? 1 : function_boundary[0][0] + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + " pos values is relative to the function's lines, + " line 0 need to be offsetted with the line number + " where te function was started to get the line number + " in real buffer terms + let synIDName = synIDattr(synID(real_lines_offset + pos[0], pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(real_lines_offset + last_pos[0], last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let prev_class = phpcomplete#GetClassName(a:start_line - i, prev_context, a:current_namespace, a:imports) if stridx(prev_class, '\') != -1 @@ -1654,15 +1770,47 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a function on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.function_invocation_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + " try to find the next non-comment or string ";" char + let start_col = match(line, '\C^\s*'.object.'\s*=\zs&\?\s*'.function_invocation_pattern) + let filelines = reverse(copy(lines)) + let [pos, char] = s:getNextCharWithPos(filelines, [len(filelines) - i, start_col]) + let chars_read = 1 + let last_pos = pos + " function_boundary == 0 if we are not in a function + let real_lines_offset = len(function_boundary) == 1 ? 1 : function_boundary[0][0] + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + " pos values is relative to the function's lines, + " line 0 need to be offsetted with the line number + " where te function was started to get the line number + " in real buffer terms + let synIDName = synIDattr(synID(real_lines_offset + pos[0], pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(real_lines_offset + last_pos[0], last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let function_name = matchstr(prev_context, '^'.function_invocation_pattern.'\ze') let function_name = matchstr(function_name, '^\zs.\+\ze\s*($') " strip the trailing ( let [function_name, function_namespace] = phpcomplete#ExpandClassName(function_name, a:current_namespace, a:imports) let function_file = phpcomplete#GetFunctionLocation(function_name, function_namespace) + if function_file == '' + let function_file = phpcomplete#GetFunctionLocation(function_name, '\') + endif if function_file == 'VIMPHP_BUILTINFUNCTION' " built in function, grab the return type from the info string @@ -1678,7 +1826,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let classname_candidate = docblock.return.type let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines) " try to expand the classname of the returned type with the context got from the function's source file - let [classname_candidate, unused] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) break endif endif @@ -1722,7 +1870,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif let i += 1 - endwhile " }}} + endfor " }}} if classname_candidate != '' let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) @@ -1741,6 +1889,8 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor for tag in tags if tag.kind ==? 'v' && tag.cmd =~? '=\s*new\s\+\zs'.class_name_pattern.'\ze' let classname = matchstr(tag.cmd, '=\s*new\s\+\zs'.class_name_pattern.'\ze') + " unescape the classname, it would have "\" doubled since it is an ex command + let classname = substitute(classname, '\\\(\_.\)', '\1', 'g') return classname endif endfor @@ -1755,6 +1905,9 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ if has_key(g:php_builtin_classes, tolower(a:classname)) && (a:namespace == '' || a:namespace == '\') return 'VIMPHP_BUILTINOBJECT' endif + if has_key(g:php_builtin_interfaces, tolower(a:classname)) && (a:namespace == '' || a:namespace == '\') + return 'VIMPHP_BUILTINOBJECT' + endif if a:namespace == '' || a:namespace == '\' let search_namespace = '\' @@ -1767,7 +1920,7 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ let i = 1 while i < line('.') let line = getline(line('.')-i) - if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*class\s*'.a:classname.'\(\s\+\|$\)' && tolower(current_namespace) == search_namespace + if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*\(class\|interface\|trait\)\s*'.a:classname.'\(\s\+\|$\|{\)' && tolower(current_namespace) == search_namespace return expand('%:p') else let i += 1 @@ -1779,7 +1932,9 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ let no_namespace_candidate = '' let tags = phpcomplete#GetTaglist('^'.a:classname.'$') for tag in tags - if tag.kind == 'c' || tag.kind == 'i' + " We'll allow interfaces and traits to be handled classes since you + " can't have colliding names with different kinds anyway + if tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't' if !has_key(tag, 'namespace') let no_namespace_candidate = tag.filename else @@ -1929,21 +2084,83 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam silent! below 1new silent! 0put =cfile - call search('\(class\|interface\)\_s\+'.a:class_name.'\(\>\|$\)') + call search('\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)') let cfline = line('.') call search('{') let endline = line('.') - let content = join(getline(cfline, endline),"\n") + let content = join(getline(cfline, endline), "\n") " Catch extends if content =~? 'extends' - let extends_class = matchstr(content, 'class\_s\+'.a:class_name.'\_s\+extends\_s\+\zs'.class_name_pattern.'\ze') + let extends_string = matchstr(content, '\(class\|interface\)\_s\+'.a:class_name.'\_.\+extends\_s\+\zs\('.class_name_pattern.'\(,\|\_s\)*\)\+\ze\(extends\|{\)') + let extended_classes = map(split(extends_string, '\(,\|\_s\)\+'), 'substitute(v:val, "\\_s\\+", "", "g")') + else + let extended_classes = '' + endif + + " Catch implements + if content =~? 'implements' + let implements_string = matchstr(content, 'class\_s\+'.a:class_name.'\_.\+implements\_s\+\zs\('.class_name_pattern.'\(,\|\_s\)*\)\+\ze') + let implemented_interfaces = map(split(implements_string, '\(,\|\_s\)\+'), 'substitute(v:val, "\\_s\\+", "", "g")') else - let extends_class = '' + let implemented_interfaces = [] endif call searchpair('{', '', '}', 'W') - let classcontent = join(getline(cfline, line('.')), "\n") + let class_closing_bracket_line = line('.') + + " Include class docblock + let doc_line = cfline - 1 + if getline(doc_line) =~? '^\s*\*/' + while doc_line != 0 + if getline(doc_line) =~? '^\s*/\*\*' + let cfline = doc_line + break + endif + let doc_line -= 1 + endwhile + endif + + let classcontent = join(getline(cfline, class_closing_bracket_line), "\n") + + let used_traits = [] + " move back to the line next to the class's definition + call cursor(endline + 1, 1) + let keep_searching = 1 + while keep_searching != 0 + " try to grab "use..." keywords + let [lnum, col] = searchpos('\c^\s\+use\s\+'.class_name_pattern, 'cW', class_closing_bracket_line) + let syn_name = synIDattr(synID(lnum, col, 0), "name") + if syn_name =~? 'string\|comment' + call cursor(lnum + 1, 1) + continue + endif + + let trait_line = getline(lnum) + if trait_line !~? ';' + " try to find the next line containing ';' + let l = lnum + let search_line = trait_line + + " add lines from the file until theres no ';' in them + while search_line !~? ';' && l > 0 + " file lines are reversed so we need to go backwards + let l += 1 + let search_line = getline(l) + let trait_line .= ' '.substitute(search_line, '\(^\s\+\|\s\+$\)', '', 'g') + endwhile + endif + let use_expression = matchstr(trait_line, '^\s*use\s\+\zs.\{-}\ze;') + let use_parts = map(split(use_expression, '\s*,\s*'), 'substitute(v:val, "\\s+", " ", "g")') + let used_traits += map(use_parts, 'substitute(v:val, "\\s", "", "g")') + call cursor(lnum + 1, 1) + + if [lnum, col] == [0, 0] + let keep_searching = 0 + endif + endwhile + silent! bw! % + let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(a:file_lines[0:cfline]) " go back to original window exe phpcomplete_original_window.'wincmd w' @@ -1956,19 +2173,35 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam \ 'mtime': getftime(full_file_path), \ }) - if extends_class != '' - let [extends_class, namespace] = phpcomplete#ExpandClassName(extends_class, current_namespace, imports) - if namespace == '' - let namespace = '\' - endif - let classlocation = phpcomplete#GetClassLocation(extends_class, namespace) - if classlocation != '' && filereadable(classlocation) - let full_file_path = fnamemodify(classlocation, ':p') - let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), extends_class) - elseif tolower(current_namespace) == tolower(namespace) - " try to find the declaration in the same file. - let result += phpcomplete#GetClassContentsStructure(full_file_path, a:file_lines, extends_class) - endif + let all_extends = used_traits + if len(extended_classes) > 0 + call extend(all_extends, extended_classes) + endif + if len(implemented_interfaces) > 0 + call extend(all_extends, implemented_interfaces) + endif + if len(all_extends) > 0 + for class in all_extends + let [class, namespace] = phpcomplete#ExpandClassName(class, current_namespace, imports) + if namespace == '' + let namespace = '\' + endif + let classlocation = phpcomplete#GetClassLocation(class, namespace) + if classlocation == "VIMPHP_BUILTINOBJECT" + if has_key(g:php_builtin_classes, tolower(class)) + let result += [phpcomplete#GenerateBuiltinClassStub('class', g:php_builtin_classes[tolower(class)])] + endif + if has_key(g:php_builtin_interfaces, tolower(class)) + let result += [phpcomplete#GenerateBuiltinClassStub('interface', g:php_builtin_interfaces[tolower(class)])] + endif + elseif classlocation != '' && filereadable(classlocation) + let full_file_path = fnamemodify(classlocation, ':p') + let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), class) + elseif tolower(current_namespace) == tolower(namespace) && match(join(a:file_lines, "\n"), '\c\(class\|interface\|trait\)\_s\+'.class.'\(\>\|$\)') != -1 + " try to find the declaration in the same file. + let result += phpcomplete#GetClassContentsStructure(full_file_path, a:file_lines, class) + endif + endfor endif return result @@ -1985,6 +2218,61 @@ function! phpcomplete#GetClassContents(classlocation, class_name) " {{{ endfunction " }}} +function! phpcomplete#GenerateBuiltinClassStub(type, class_info) " {{{ + let re = a:type.' '.a:class_info['name']." {" + if has_key(a:class_info, 'constants') + for [name, initializer] in items(a:class_info.constants) + let re .= "\n\tconst ".name." = ".initializer.";" + endfor + endif + if has_key(a:class_info, 'properties') + for [name, info] in items(a:class_info.properties) + let re .= "\n\t// @var $".name." ".info.type + let re .= "\n\tpublic $".name.";" + endfor + endif + if has_key(a:class_info, 'static_properties') + for [name, info] in items(a:class_info.static_properties) + let re .= "\n\t// @var ".name." ".info.type + let re .= "\n\tpublic static ".name." = ".info.initializer.";" + endfor + endif + if has_key(a:class_info, 'methods') + for [name, info] in items(a:class_info.methods) + if name =~ '^__' + continue + endif + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + endif + if has_key(a:class_info, 'static_methods') + for [name, info] in items(a:class_info.static_methods) + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic static function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + endif + let re .= "\n}" + + return { a:type : a:class_info['name'], + \ 'content': re, + \ 'namespace': '', + \ 'imports': {}, + \ 'file': 'VIMPHP_BUILTINOBJECT', + \ 'mtime': 0, + \ } +endfunction " }}} + function! phpcomplete#GetDocBlock(sccontent, search) " {{{ let i = 0 let l = 0 @@ -1996,12 +2284,26 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ let line = a:sccontent[i] " search for a function declaration if line =~? a:search - let l = i - 1 - " start backward serch for the comment block + if line =~? '@property' + let doc_line = i + while doc_line != sccontent_len - 1 + if a:sccontent[doc_line] =~? '^\s*\*/' + let l = doc_line + break + endif + let doc_line += 1 + endwhile + else + let l = i - 1 + endif + " start backward search for the comment block while l != 0 let line = a:sccontent[l] - " if comment end found save line position and end search - if line =~? '^\s*\*/' + " if it's a one line docblock like comment and we can just return it right away + if line =~? '^\s*\/\*\*.\+\*\/\s*$' + return substitute(line, '\v^\s*(\/\*\*\s*)|(\s*\*\/)\s*$', '', 'g') + "... or if comment end found save line position and end search + elseif line =~? '^\s*\*/' let comment_end = l break " ... or the line doesn't blank (only whitespace or nothing) end search @@ -2015,7 +2317,7 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ return '' end - while l != 0 + while l >= 0 let line = a:sccontent[l] if line =~? '^\s*/\*\*' let comment_start = l @@ -2023,6 +2325,7 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ endif let l -= 1 endwhile + " no docblock comment start found if comment_start == -1 return '' @@ -2048,9 +2351,10 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{ \ 'return': {}, \ 'throws': [], \ 'var': {}, + \ 'properties': [], \ } - let res.description = substitute(matchstr(a:docblock, '\zs\_.\{-}\ze\(@var\|@param\|@return\|$\)'), '\(^\_s*\|\_s*$\)', '', 'g') + let res.description = substitute(matchstr(a:docblock, '\zs\_.\{-}\ze\(@type\|@var\|@param\|@return\|$\)'), '\(^\_s*\|\_s*$\)', '', 'g') let docblock_lines = split(a:docblock, "\n") let param_lines = filter(copy(docblock_lines), 'v:val =~? "^@param"') @@ -2085,15 +2389,26 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{ endif endfor - let var_line = filter(copy(docblock_lines), 'v:val =~? "^@var"') + let var_line = filter(copy(docblock_lines), 'v:val =~? "^\\(@var\\|@type\\)"') if len(var_line) > 0 - let var_parts = matchlist(var_line[0], '@var\s\+\(\S\+\)\s*\(.*\)') + let var_parts = matchlist(var_line[0], '\(@var\|@type\)\s\+\(\S\+\)\s*\(.*\)') let res['var'] = { \ 'line': var_parts[0], - \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(var_parts, 1, '')), - \ 'description': get(var_parts, 2, '')} + \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(var_parts, 2, '')), + \ 'description': get(var_parts, 3, '')} endif + let property_lines = filter(copy(docblock_lines), 'v:val =~? "^@property"') + for property_line in property_lines + let parts = matchlist(property_line, '\(@property\)\s\+\(\S\+\)\s*\(.*\)') + if len(parts) > 0 + call add(res.properties, { + \ 'line': parts[0], + \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(parts, 2, '')), + \ 'description': get(parts, 3, '')}) + endif + endfor + return res endfunction " }}} @@ -2171,19 +2486,48 @@ endfunction! " }}} function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ + let original_window = winnr() + + silent! below 1new + silent! 0put =a:file_lines + normal! G + + " clear out classes, functions and other blocks + while 1 + let block_start_pos = searchpos('\c\(class\|trait\|function\|interface\)\s\+\_.\{-}\zs{', 'Web') + if block_start_pos == [0, 0] + break + endif + let block_end_pos = searchpairpos('{', '', '}\|\%$', 'W', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') + + if block_end_pos != [0, 0] + " end of the block found, just delete it + silent! exec block_start_pos[0].','.block_end_pos[0].'d _' + else + " block pair not found, use block start as beginning and the end + " of the buffer instead + silent! exec block_start_pos[0].',$d _' + endif + endwhile + normal! G + + " grab the remains + let file_lines = reverse(getline(1, line('.') - 1)) + + silent! bw! % + exe original_window.'wincmd w' + let namespace_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' - let file_lines = reverse(copy(a:file_lines)) let i = 0 let file_length = len(file_lines) let imports = {} - let current_namespace = '\' while i < file_length let line = file_lines[i] - if line =~? '^\s*namespace\s*'.namespace_name_pattern - let current_namespace = matchstr(line, '^\s*namespace\s*\zs'.namespace_name_pattern.'\ze') + if line =~? '^\(<?php\)\?\s*namespace\s*'.namespace_name_pattern + let current_namespace = matchstr(line, '\c^\(<?php\)\?\s*namespace\s*\zs'.namespace_name_pattern.'\ze') break endif @@ -2204,11 +2548,11 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let use_line .= ' '.substitute(search_line, '\(^\s\+\|\s\+$\)', '', 'g') endwhile endif - let use_expression = matchstr(use_line, '^\s*use\s\+\zs.\{-}\ze;') + let use_expression = matchstr(use_line, '^\c\s*use\s\+\zs.\{-}\ze;') let use_parts = map(split(use_expression, '\s*,\s*'), 'substitute(v:val, "\\s+", " ", "g")') for part in use_parts if part =~? '\s\+as\s\+' - let [object, name] = split(part, '\s\+as\s\+') + let [object, name] = split(part, '\s\+as\s\+\c') let object = substitute(object, '^\\', '', '') let name = substitute(name, '^\\', '', '') else @@ -2220,6 +2564,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let name = matchstr(name, '\\\zs[^\\]\+\ze$') endif endif + " leading slash is not required use imports are always absolute let imports[name] = {'name': object, 'kind': ''} endfor @@ -2244,7 +2589,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ break endif " if the name matches with the extracted classname and namespace - if (tag.kind == 'c' || tag.kind == 'i') && tag.name == classname + if (tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't') && tag.name == classname if has_key(tag, 'namespace') let patched_ctags_detected = 1 if tag.namespace == namespace_for_classes @@ -2255,6 +2600,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ elseif !exists('no_namespace_candidate') " save the first namespacless match to be used if no better " candidate found later on + let tag.namespace = namespace_for_classes let no_namespace_candidate = tag endif endif @@ -2287,7 +2633,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let tags = phpcomplete#GetTaglist('^'.import['name'].'$') for tag in tags " search for the first matchin namespace, class, interface with no namespace - if !has_key(tag, 'namespace') && (tag.kind == 'n' || tag.kind == 'c' || tag.kind == 'i') + if !has_key(tag, 'namespace') && (tag.kind == 'n' || tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't') call extend(import, tag) let import['builtin'] = 0 break @@ -2295,6 +2641,9 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ endfor endif endif + if exists('no_namespace_candidate') + unlet no_namespace_candidate + endif endfor endif let i += 1 @@ -2307,9 +2656,43 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ endfunction " }}} +function! phpcomplete#GetCurrentFunctionBoundaries() " {{{ + let old_cursor_pos = [line('.'), col('.')] + let current_line_no = old_cursor_pos[0] + let function_pattern = '\c\(.*\%#\)\@!\_^\s*\zs\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\_.\{-}(\_.\{-})\_.\{-}{' + + let func_start_pos = searchpos(function_pattern, 'Wbc') + if func_start_pos == [0, 0] + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return 0 + endif + + " get the line where the function declaration actually started + call search('\cfunction\_.\{-}(\_.\{-})\_.\{-}{', 'Wce') + + " get the position of the function block's closing "}" + let func_end_pos = searchpairpos('{', '', '}', 'W') + if func_end_pos == [0, 0] + " there is a function start but no end found, assume that we are in a + " function but the user did not typed the closing "}" yet and the + " function runs to the end of the file + let func_end_pos = [line('$'), len(getline(line('$')))] + endif + + " Decho func_start_pos[0].' <= '.current_line_no.' && '.current_line_no.' <= '.func_end_pos[0] + if func_start_pos[0] <= current_line_no && current_line_no <= func_end_pos[0] + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return [func_start_pos, func_end_pos] + endif + + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return 0 +endfunction +" }}} + function! phpcomplete#ExpandClassName(classname, current_namespace, imports) " {{{ " if there's an imported class, just use that class's information - if has_key(a:imports, a:classname) && (a:imports[a:classname].kind == 'c' || a:imports[a:classname].kind == 'i') + if has_key(a:imports, a:classname) && (a:imports[a:classname].kind == 'c' || a:imports[a:classname].kind == 'i' || a:imports[a:classname].kind == 't') let namespace = has_key(a:imports[a:classname], 'namespace') ? a:imports[a:classname].namespace : '' return [a:imports[a:classname].name, namespace] endif diff --git a/runtime/autoload/python3complete.vim b/runtime/autoload/python3complete.vim index b02200be7f..f0f3aaddb3 100644 --- a/runtime/autoload/python3complete.vim +++ b/runtime/autoload/python3complete.vim @@ -1,7 +1,7 @@ "python3complete.vim - Omni Completion for python " Maintainer: Aaron Griffin <aaronmgriffin@gmail.com> " Version: 0.9 -" Last Updated: 18 Jun 2009 +" Last Updated: 18 Jun 2009 (small fix 2015 Sep 14 from Debian) " " Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim " @@ -359,6 +359,7 @@ class PyParser: def __init__(self): self.top = Scope('global',0) self.scope = self.top + self.parserline = 0 def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) diff --git a/runtime/autoload/pythoncomplete.vim b/runtime/autoload/pythoncomplete.vim index 57add71cbd..ecc36646d9 100644 --- a/runtime/autoload/pythoncomplete.vim +++ b/runtime/autoload/pythoncomplete.vim @@ -377,6 +377,7 @@ class PyParser: def __init__(self): self.top = Scope('global',0) self.scope = self.top + self.parserline = 0 def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index e1064c8a58..40b87f4cbe 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -93,7 +93,7 @@ function! s:GetBufferRubyEntity( name, type, ... ) let stopline = 1 - let crex = '^\s*\<' . a:type . '\>\s*\<' . a:name . '\>\s*\(<\s*.*\s*\)\?' + let crex = '^\s*\<' . a:type . '\>\s*\<' . escape(a:name, '*') . '\>\s*\(<\s*.*\s*\)\?' let [lnum,lcol] = searchpos( crex, 'w' ) "let [lnum,lcol] = searchpairpos( crex . '\zs', '', '\(end\|}\)', 'w' ) @@ -149,7 +149,7 @@ function! s:GetRubyVarType(v) let ctors = ctors.'\)' let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)' - let sstr = ''.a:v.'\>\s*[+\-*/]*'.fstr + let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 let str = matchstr(getline(lnum),fstr,lcol) @@ -196,7 +196,7 @@ function! rubycomplete#Complete(findstart, base) if c =~ '\w' continue elseif ! c =~ '\.' - idx = -1 + let idx = -1 break else break @@ -266,6 +266,28 @@ class VimRubyCompletion end end + def load_gems + fpath = VIM::evaluate("get(g:, 'rubycomplete_gemfile_path', 'Gemfile')") + return unless File.file?(fpath) && File.readable?(fpath) + want_bundler = VIM::evaluate("get(g:, 'rubycomplete_use_bundler')") + parse_file = !want_bundler + begin + require 'bundler' + Bundler.setup + Bundler.require + rescue Exception + parse_file = true + end + if parse_file + File.new(fpath).each_line do |line| + begin + require $1 if /\s*gem\s*['"]([^'"]+)/.match(line) + rescue Exception + end + end + end + end + def load_buffer_class(name) dprint "load_buffer_class(%s) START" % name classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') @@ -588,6 +610,10 @@ class VimRubyCompletion load_rails end + want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')") + load_gems unless want_gems.to_i.zero? + + input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 input = input[0..cpos] @@ -678,7 +704,9 @@ class VimRubyCompletion cv = eval("self.class.constants") vartype = get_var_type( receiver ) dprint "vartype: %s" % vartype - if vartype != '' + + invalid_vartype = ['', "gets"] + if !invalid_vartype.include?(vartype) load_buffer_class( vartype ) begin @@ -706,7 +734,7 @@ class VimRubyCompletion methods.concat m.instance_methods(false) } end - variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0 + variables += add_rails_columns( "#{vartype}" ) if vartype && !invalid_vartype.include?(vartype) when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ message = $1 diff --git a/runtime/autoload/rust.vim b/runtime/autoload/rust.vim new file mode 100644 index 0000000000..34a3b41773 --- /dev/null +++ b/runtime/autoload/rust.vim @@ -0,0 +1,415 @@ +" Author: Kevin Ballard +" Description: Helper functions for Rust commands/mappings +" Last Modified: May 27, 2014 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Jump {{{1 + +function! rust#Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call <SID>Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! s:Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! s:Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction + +" Run {{{1 + +function! rust#Run(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang + let idx = index(l:args, '--') + if idx != -1 + let rustc_args = idx == 0 ? [] : l:args[:idx-1] + let args = l:args[idx+1:] + else + let rustc_args = l:args + let args = [] + endif + else + let rustc_args = [] + endif + + let b:rust_last_rustc_args = l:rustc_args + let b:rust_last_args = l:args + + call s:WithPath(function("s:Run"), rustc_args, args) +endfunction + +function! s:Run(dict, rustc_args, args) + let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r') + if has('win32') + let exepath .= '.exe' + endif + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let rustc_args = [relpath, '-o', exepath] + a:rustc_args + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) + endif +endfunction + +" Expand {{{1 + +function! rust#Expand(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang && !empty(l:args) + let pretty = remove(l:args, 0) + else + let pretty = "expanded" + endif + call s:WithPath(function("s:Expand"), pretty, args) +endfunction + +function! s:Expand(dict, pretty, args) + try + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)' + let flag = '--xpretty' + else + let flag = '--pretty' + endif + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if v:shell_error + echohl WarningMsg + echo output + echohl None + else + new + silent put =output + 1 + d + setl filetype=rust + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.pretty.rs' + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endtry +endfunction + +function! rust#CompleteExpand(lead, line, pos) + if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' + " first argument and it has a ! + let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"] + if !empty(a:lead) + call filter(list, "v:val[:len(a:lead)-1] == a:lead") + endif + return list + endif + + return glob(escape(a:lead, "*?[") . '*', 0, 1) +endfunction + +" Emit {{{1 + +function! rust#Emit(type, args) + let args = s:ShellTokenize(a:args) + call s:WithPath(function("s:Emit"), a:type, args) +endfunction + +function! s:Emit(dict, type, args) + try + let output_path = a:dict.tmpdir.'/output' + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '--emit', a:type, '-o', output_path] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + new + exe 'silent keepalt read' fnameescape(output_path) + 1 + d + if a:type == "llvm-ir" + setl filetype=llvm + let extension = 'll' + elseif a:type == "asm" + setl filetype=asm + let extension = 's' + endif + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + if exists('l:extension') + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.'.extension + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endif + endtry +endfunction + +" Utility functions {{{1 + +" Invokes func(dict, ...) +" Where {dict} is a dictionary with the following keys: +" 'path' - The path to the file +" 'tmpdir' - The path to a temporary directory that will be deleted when the +" function returns. +" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise. +" If {istemp} is 1 then an additional key is provided: +" 'tmpdir_relpath' - The {path} relative to the {tmpdir}. +" +" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the +" existing path of the current buffer. If the path is inside of {dict.tmpdir} +" then it is guaranteed to have a '.rs' extension. +function! s:WithPath(func, ...) + let buf = bufnr('') + let saved = {} + let dict = {} + try + let saved.write = &write + set write + let dict.path = expand('%') + let pathisempty = empty(dict.path) + + " Always create a tmpdir in case the wrapped command wants it + let dict.tmpdir = tempname() + call mkdir(dict.tmpdir) + + if pathisempty || !saved.write + let dict.istemp = 1 + " if we're doing this because of nowrite, preserve the filename + if !pathisempty + let filename = expand('%:t:r').".rs" + else + let filename = 'unnamed.rs' + endif + let dict.tmpdir_relpath = filename + let dict.path = dict.tmpdir.'/'.filename + + let saved.mod = &mod + set nomod + + silent exe 'keepalt write! ' . fnameescape(dict.path) + if pathisempty + silent keepalt 0file + endif + else + let dict.istemp = 0 + update + endif + + call call(a:func, [dict] + a:000) + finally + if bufexists(buf) + for [opt, value] in items(saved) + silent call setbufvar(buf, '&'.opt, value) + unlet value " avoid variable type mismatches + endfor + endif + if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif + endtry +endfunction + +function! rust#AppendCmdLine(text) + call setcmdpos(getcmdpos()) + let cmd = getcmdline() . a:text + return cmd +endfunction + +" Tokenize the string according to sh parsing rules +function! s:ShellTokenize(text) + " states: + " 0: start of word + " 1: unquoted + " 2: unquoted backslash + " 3: double-quote + " 4: double-quoted backslash + " 5: single-quote + let l:state = 0 + let l:current = '' + let l:args = [] + for c in split(a:text, '\zs') + if l:state == 0 || l:state == 1 " unquoted + if l:c ==# ' ' + if l:state == 0 | continue | endif + call add(l:args, l:current) + let l:current = '' + let l:state = 0 + elseif l:c ==# '\' + let l:state = 2 + elseif l:c ==# '"' + let l:state = 3 + elseif l:c ==# "'" + let l:state = 5 + else + let l:current .= l:c + let l:state = 1 + endif + elseif l:state == 2 " unquoted backslash + if l:c !=# "\n" " can it even be \n? + let l:current .= l:c + endif + let l:state = 1 + elseif l:state == 3 " double-quote + if l:c ==# '\' + let l:state = 4 + elseif l:c ==# '"' + let l:state = 1 + else + let l:current .= l:c + endif + elseif l:state == 4 " double-quoted backslash + if stridx('$`"\', l:c) >= 0 + let l:current .= l:c + elseif l:c ==# "\n" " is this even possible? + " skip it + else + let l:current .= '\'.l:c + endif + let l:state = 3 + elseif l:state == 5 " single-quoted + if l:c == "'" + let l:state = 1 + else + let l:current .= l:c + endif + endif + endfor + if l:state != 0 + call add(l:args, l:current) + endif + return l:args +endfunction + +function! s:RmDir(path) + " sanity check; make sure it's not empty, /, or $HOME + if empty(a:path) + echoerr 'Attempted to delete empty path' + return 0 + elseif a:path == '/' || a:path == $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + return system("rm -rf " . shellescape(a:path)) +endfunction + +" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. +" If {pwd} is the empty string then it doesn't change the cwd. +function! s:system(pwd, cmd) + let cmd = a:cmd + if !empty(a:pwd) + let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd + endif + return system(cmd) +endfunction + +" Playpen Support {{{1 +" Parts of gist.vim by Yasuhiro Matsumoto <mattn.jp@gmail.com> reused +" gist.vim available under the BSD license, available at +" http://github.com/mattn/gist-vim +function! s:has_webapi() + if !exists("*webapi#http#post") + try + call webapi#http#post() + catch + endtry + endif + return exists("*webapi#http#post") +endfunction + +function! rust#Play(count, line1, line2, ...) abort + redraw + + let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/') + let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/') + + if !s:has_webapi() + echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None + return + endif + + let bufname = bufname('%') + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + + let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content) + + if strlen(body) > 5000 + echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None + return + endif + + let payload = "format=simple&url=".webapi#http#encodeURI(body) + let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {}) + let url = res.content + + redraw | echomsg 'Done: '.url +endfunction + +" }}}1 + +" vim: set noet sw=8 ts=8: diff --git a/runtime/autoload/rustfmt.vim b/runtime/autoload/rustfmt.vim new file mode 100644 index 0000000000..a689b5e00d --- /dev/null +++ b/runtime/autoload/rustfmt.vim @@ -0,0 +1,107 @@ +" Author: Stephen Sugden <stephen@stephensugden.com> +" +" Adapted from https://github.com/fatih/vim-go +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if !exists("g:rustfmt_autosave") + let g:rustfmt_autosave = 0 +endif + +if !exists("g:rustfmt_command") + let g:rustfmt_command = "rustfmt" +endif + +if !exists("g:rustfmt_options") + let g:rustfmt_options = "" +endif + +if !exists("g:rustfmt_fail_silently") + let g:rustfmt_fail_silently = 0 +endif + +let s:got_fmt_error = 0 + +function! s:RustfmtCommandRange(filename, line1, line2) + let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} + return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg)) +endfunction + +function! s:RustfmtCommand(filename) + return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename) +endfunction + +function! s:RunRustfmt(command, curw, tmpname) + if exists("*systemlist") + let out = systemlist(a:command) + else + let out = split(system(a:command), '\r\?\n') + endif + + if v:shell_error == 0 || v:shell_error == 3 + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + " Replace current file with temp file, then reload buffer + call rename(a:tmpname, expand('%')) + silent edit! + let &syntax = &syntax + + " only clear location list if it was previously filled to prevent + " clobbering other additions + if s:got_fmt_error + let s:got_fmt_error = 0 + call setloclist(0, []) + lwindow + endif + elseif g:rustfmt_fail_silently == 0 + " otherwise get the errors and put them in the location list + let errors = [] + + for line in out + " src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value` + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[5]}) + endif + endfor + + if empty(errors) + % | " Couldn't detect rustfmt error format, output errors + endif + + if !empty(errors) + call setloclist(0, errors, 'r') + echohl Error | echomsg "rustfmt returned error" | echohl None + endif + + let s:got_fmt_error = 1 + lwindow + " We didn't use the temp file, so clean up + call delete(a:tmpname) + endif + + call winrestview(a:curw) +endfunction + +function! rustfmt#FormatRange(line1, line2) + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction + +function! rustfmt#Format() + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommand(l:tmpname) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index 9326c15bb3..ef5ce2e6e2 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -1,8 +1,8 @@ " Vim OMNI completion script for SQL " Language: SQL " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Version: 15.0 -" Last Change: 2013 May 13 +" Version: 16.0 +" Last Change: 2017 Oct 15 " Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Usage: For detailed help " ":help sql.txt" @@ -16,6 +16,12 @@ " look backwards to a FROM clause and find the first table " and complete it. " +" Version 16.0 (Dec 2015) +" - NF: If reseting the cache and table, procedure or view completion +" had been used via dbext, have dbext delete or recreate the +" dictionary so that new objects are picked up for the +" next completion. +" " Version 15.0 (May 2013) " - NF: Changed the SQL precached syntax items, omni_sql_precache_syntax_groups, " to use regular expressions to pick up extended syntax group names. @@ -103,7 +109,7 @@ endif if exists('g:loaded_sql_completion') finish endif -let g:loaded_sql_completion = 150 +let g:loaded_sql_completion = 160 let s:keepcpo= &cpo set cpo&vim @@ -459,6 +465,29 @@ function! sqlcomplete#Complete(findstart, base) let s:tbl_cols = [] let s:syn_list = [] let s:syn_value = [] + + if s:sql_file_table != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("table") + else + DBCompleteTables! + endif + endif + if s:sql_file_procedure != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("procedure") + else + DBCompleteProcedures! + endif + endif + if s:sql_file_view != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("view") + else + DBCompleteViews! + endif + endif + let s:sql_file_table = "" let s:sql_file_procedure = "" let s:sql_file_view = "" @@ -831,7 +860,7 @@ function! s:SQLCGetColumns(table_name, list_type) " Start characterwise visual mode " Advance right one character - " Search foward until one of the following: + " Search forward until one of the following: " 1. Another select/update/delete statement " 2. A ; at the end of a line (the delimiter) " 3. The end of the file (incase no delimiter) diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 5e76870cce..9c518cb9d0 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -117,7 +117,7 @@ fun! tar#Browse(tarfile) if !filereadable(a:tarfile) " call Decho('a:tarfile<'.a:tarfile.'> not filereadable') if a:tarfile !~# '^\a\+://' - " if its an url, don't complain, let url-handlers such as vim do its thing + " if it's an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None endif diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index 5cb23a6146..d972ad63fe 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jun 19 +" Last Change: 2013 Sep 03 " " Additional contributors: " @@ -302,7 +302,7 @@ func! tohtml#Convert2HTML(line1, line2) "{{{ else "{{{ let win_list = [] let buf_list = [] - windo | if &diff | call add(win_list, winbufnr(0)) | endif + windo if &diff | call add(win_list, winbufnr(0)) | endif let s:settings.whole_filler = 1 let g:html_diff_win_num = 0 for window in win_list diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim index 9a5a73c3c1..9c7dcbda0f 100644 --- a/runtime/autoload/vimball.vim +++ b/runtime/autoload/vimball.vim @@ -1,9 +1,9 @@ " vimball.vim : construct a file containing both paths and files -" Author: Charles E. Campbell, Jr. -" Date: Jan 17, 2012 -" Version: 35 +" Author: Charles E. Campbell +" Date: Apr 11, 2016 +" Version: 37 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim -" Copyright: (c) 2004-2011 by Charles E. Campbell, Jr. +" Copyright: (c) 2004-2011 by Charles E. Campbell " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -14,7 +14,7 @@ if &cp || exists("g:loaded_vimball") finish endif -let g:loaded_vimball = "v35" +let g:loaded_vimball = "v37" if v:version < 702 echohl WarningMsg echo "***warning*** this version of vimball needs vim 7.2" @@ -142,7 +142,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range let lastline= line("$") + 1 if lastline == 2 && getline("$") == "" - call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.') + call setline(1,'" Vimball Archiver by Charles E. Campbell') call setline(2,'UseVimball') call setline(3,'finish') let lastline= line("$") + 1 @@ -179,7 +179,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range " remove the evidence setlocal nomod bh=wipe exe "tabn ".curtabnr - exe "tabc ".vbtabnr + exe "tabc! ".vbtabnr " restore options call vimball#RestoreSettings() @@ -280,7 +280,7 @@ fun! vimball#Vimball(really,...) " when AsNeeded/filename is filereadable or was present in VimballRecord if fname =~ '\<plugin/' let anfname= substitute(fname,'\<plugin/','AsNeeded/','') - if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~ anfname) + if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~# anfname) " call Decho("using anfname<".anfname."> instead of <".fname.">") let fname= anfname endif @@ -347,7 +347,7 @@ fun! vimball#Vimball(really,...) " call Decho("exe tabn ".curtabnr) exe "tabn ".curtabnr - " set up help if its a doc/*.txt file + " set up help if it's a doc/*.txt file " call Decho("didhelp<".didhelp."> fname<".fname.">") if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.\(txt\|..x\)$' let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.\(txt\|..x\)$','\1','') @@ -379,10 +379,10 @@ fun! vimball#Vimball(really,...) call s:RecordInFile(home) " restore events, delete tab and buffer - exe "tabn ".vbtabnr + exe "sil! tabn ".vbtabnr setlocal nomod bh=wipe - exe "tabn ".curtabnr - exe "tabc ".vbtabnr + exe "sil! tabn ".curtabnr + exe "sil! tabc! ".vbtabnr call vimball#RestoreSettings() call s:ChgDir(curdir) @@ -555,7 +555,7 @@ fun! vimball#ShowMesg(level,msg) set noruler noshowcmd redraw! - if &fo =~ '[ta]' + if &fo =~# '[ta]' echomsg "***vimball*** ".a:msg else if a:level == s:WARNING || a:level == s:USAGE @@ -715,7 +715,7 @@ fun! vimball#SaveSettings() " call Dfunc("SaveSettings()") let s:makeep = getpos("'a") let s:regakeep= @a - if exists("&acd") + if exists("+acd") let s:acdkeep = &acd endif let s:eikeep = &ei @@ -728,7 +728,7 @@ fun! vimball#SaveSettings() let s:vekeep = &ve let s:ffkeep = &l:ff let s:swfkeep = &l:swf - if exists("&acd") + if exists("+acd") setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf else setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf @@ -743,7 +743,7 @@ endfun fun! vimball#RestoreSettings() " call Dfunc("RestoreSettings()") let @a = s:regakeep - if exists("&acd") + if exists("+acd") let &acd = s:acdkeep endif let &l:fen = s:fenkeep @@ -760,7 +760,7 @@ fun! vimball#RestoreSettings() " call Decho("restore mark-a: makeep=".string(makeep)) call setpos("'a",s:makeep) endif - if exists("&acd") + if exists("+acd") unlet s:acdkeep endif unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim new file mode 100644 index 0000000000..83ba49a073 --- /dev/null +++ b/runtime/autoload/xmlformat.vim @@ -0,0 +1,112 @@ +" Vim plugin for formatting XML +" Last Change: Thu, 22 May 2018 21:26:55 +0100 +" Version: 0.1 +" Author: Christian Brabandt <cb@256bit.org> +" Script: http://www.vim.org/scripts/script.php?script_id= +" License: VIM License +" GetLatestVimScripts: ???? 18 :AutoInstall: xmlformat.vim +" Documentation: see :h xmlformat.txt (TODO!) +" --------------------------------------------------------------------- +" Load Once: {{{1 +if exists("g:loaded_xmlformat") || &cp + finish +endif +let g:loaded_xmlformat = 1 +let s:keepcpo = &cpo +set cpo&vim + +" Main function: Format the input {{{1 +func! xmlformat#Format() + " only allow reformatting through the gq command + " (e.g. Vim is in normal mode) + if mode() != 'n' + " do not fall back to internal formatting + return 0 + endif + let sw = shiftwidth() + let prev = prevnonblank(v:lnum-1) + let s:indent = indent(prev)/sw + let result = [] + let lastitem = prev ? getline(prev) : '' + let is_xml_decl = 0 + " split on `<`, but don't split on very first opening < + for item in split(join(getline(v:lnum, (v:lnum + v:count - 1))), '.\@<=[>]\zs') + if s:EndTag(item) + let s:indent = s:DecreaseIndent() + call add(result, s:Indent(item)) + elseif s:EmptyTag(lastitem) + call add(result, s:Indent(item)) + elseif s:StartTag(lastitem) && s:IsTag(item) + let s:indent += 1 + call add(result, s:Indent(item)) + else + if !s:IsTag(item) + " Simply split on '<' + let t=split(item, '.<\@=\zs') + let s:indent+=1 + call add(result, s:Indent(t[0])) + let s:indent = s:DecreaseIndent() + call add(result, s:Indent(t[1])) + else + call add(result, s:Indent(item)) + endif + endif + let lastitem = item + endfor + + if !empty(result) + exe v:lnum. ",". (v:lnum + v:count - 1). 'd' + call append(v:lnum - 1, result) + " Might need to remove the last line, if it became empty because of the + " append() call + let last = v:lnum + len(result) + if getline(last) is '' + exe last. 'd' + endif + endif + + " do not run internal formatter! + return 0 +endfunc +" Check if given tag is XML Declaration header {{{1 +func! s:IsXMLDecl(tag) + return a:tag =~? '^\s*<?xml\s\?\%(version="[^"]*"\)\?\s\?\%(encoding="[^"]*"\)\? ?>\s*$' +endfunc +" Return tag indented by current level {{{1 +func! s:Indent(item) + return repeat(' ', shiftwidth()*s:indent). s:Trim(a:item) +endfu +" Return item trimmed from leading whitespace {{{1 +func! s:Trim(item) + if exists('*trim') + return trim(a:item) + else + return matchstr(a:item, '\S\+.*') + endif +endfunc +" Check if tag is a new opening tag <tag> {{{1 +func! s:StartTag(tag) + return a:tag =~? '^\s*<[^/?]' +endfunc +" Remove one level of indentation {{{1 +func! s:DecreaseIndent() + return (s:indent > 0 ? s:indent - 1 : 0) +endfunc +" Check if tag is a closing tag </tag> {{{1 +func! s:EndTag(tag) + return a:tag =~? '^\s*</' +endfunc +" Check that the tag is actually a tag and not {{{1 +" something like "foobar</foobar>" +func! s:IsTag(tag) + return s:Trim(a:tag)[0] == '<' +endfunc +" Check if tag is empty <tag/> {{{1 +func! s:EmptyTag(tag) + return a:tag =~ '/>\s*$' +endfunc +" Restoration And Modelines: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" Modeline {{{1 +" vim: fdm=marker fdl=0 ts=2 et sw=0 sts=-1 diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 687500ebe3..ea086e0882 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,7 +1,7 @@ " zip.vim: Handles browsing zipfiles " AUTOLOAD PORTION -" Date: Jul 02, 2013 -" Version: 27 +" Date: Sep 13, 2016 +" Version: 28 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1 @@ -20,10 +20,10 @@ if &cp || exists("g:loaded_zip") finish endif -let g:loaded_zip= "v27" +let g:loaded_zip= "v28" if v:version < 702 echohl WarningMsg - echo "***warning*** this version of zip needs vim 7.2" + echo "***warning*** this version of zip needs vim 7.2 or later" echohl Normal finish endif @@ -53,6 +53,9 @@ endif if !exists("g:zip_unzipcmd") let g:zip_unzipcmd= "unzip" endif +if !exists("g:zip_extractcmd") + let g:zip_extractcmd= g:zip_unzipcmd +endif " ---------------- " Functions: {{{1 @@ -62,14 +65,14 @@ endif " zip#Browse: {{{2 fun! zip#Browse(zipfile) " call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") - " sanity check: insure that the zipfile has "PK" as its first two letters + " sanity check: ensure that the zipfile has "PK" as its first two letters " (zipped files have a leading PK as a "magic cookie") if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' exe "noautocmd e ".fnameescape(a:zipfile) " call Dret("zip#Browse : not a zipfile<".a:zipfile.">") return " else " Decho -" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - its a zip file") +" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file") endif let repkeep= &report @@ -92,7 +95,7 @@ fun! zip#Browse(zipfile) endif if !filereadable(a:zipfile) if a:zipfile !~# '^\a\+://' - " if its an url, don't complain, let url-handlers such as vim do its thing + " if it's an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None " call inputsave()|call input("Press <cr> to continue")|call inputrestore() @@ -136,8 +139,10 @@ fun! zip#Browse(zipfile) return endif + " Maps associated with zip plugin setlocal noma nomod ro - noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr> + noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr> + noremap <silent> <buffer> x :call zip#Extract()<cr> let &report= repkeep " call Dret("zip#Browse") @@ -204,6 +209,15 @@ fun! zip#Read(fname,mode) endif " call Decho("zipfile<".zipfile.">") " call Decho("fname <".fname.">") + " sanity check + if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) + redraw! + echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None +" call inputsave()|call input("Press <cr> to continue")|call inputrestore() + let &report= repkeep +" call Dret("zip#Write") + return + endif " the following code does much the same thing as " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) @@ -236,9 +250,9 @@ fun! zip#Write(fname) set report=10 " sanity checks - if !executable(g:zip_zipcmd) + if !executable(substitute(g:zip_zipcmd,'\s\+.*$','','')) redraw! - echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the zip pgm" | echohl None + echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program" | echohl None " call inputsave()|call input("Press <cr> to continue")|call inputrestore() let &report= repkeep " call Dret("zip#Write") @@ -344,6 +358,48 @@ fun! zip#Write(fname) " call Dret("zip#Write") endfun +" --------------------------------------------------------------------- +" zip#Extract: extract a file from a zip archive {{{2 +fun! zip#Extract() +" call Dfunc("zip#Extract()") + + let repkeep= &report + set report=10 + let fname= getline(".") +" call Decho("fname<".fname.">") + + " sanity check + if fname =~ '^"' + let &report= repkeep +" call Dret("zip#Extract") + return + endif + if fname =~ '/$' + redraw! + echohl Error | echo "***error*** (zip#Extract) Please specify a file, not a directory" | echohl None + let &report= repkeep +" call Dret("zip#Extract") + return + endif + + " extract the file mentioned under the cursor +" call Decho("system(".g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell).")") + call system(g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell)) +" call Decho("zipfile<".b:zipfile.">") + if v:shell_error != 0 + echohl Error | echo "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!" | echohl NONE + elseif !filereadable(fname) + echohl Error | echo "***error*** attempted to extract ".fname." but it doesn't appear to be present!" + else + echo "***note*** successfully extracted ".fname + endif + + " restore option + let &report= repkeep + +" call Dret("zip#Extract") +endfun + " --------------------------------------------------------------------- " s:Escape: {{{2 fun! s:Escape(fname,isfilt) diff --git a/runtime/colors/README.txt b/runtime/colors/README.txt index 3b3445cbc9..057bbec51f 100644 --- a/runtime/colors/README.txt +++ b/runtime/colors/README.txt @@ -41,8 +41,24 @@ this autocmd might be useful: autocmd SourcePre */colors/blue_sky.vim set background=dark Replace "blue_sky" with the name of the colorscheme. -In case you want to tweak a colorscheme after it was loaded, check out that -ColorScheme autocmd event. +In case you want to tweak a colorscheme after it was loaded, check out the +ColorScheme autocommand event. + +To clean up just before loading another colorscheme, use the ColorSchemePre +autocommand event. For example: + let g:term_ansi_colors = ... + augroup MyColorscheme + au! + au ColorSchemePre * unlet g:term_ansi_colors + au ColorSchemePre * au! MyColorscheme + augroup END + +To customize a colorscheme use another name, e.g. "~/.vim/colors/mine.vim", +and use `:runtime` to load the original colorscheme: + " load the "evening" colorscheme + runtime colors/evening.vim + " change the color of statements + hi Statement ctermfg=Blue guifg=Blue To see which highlight group is used where, find the help for "highlight-groups" and "group-name". @@ -57,6 +73,8 @@ Search for "highlight_init". If you think you have a color scheme that is good enough to be used by others, please check the following items: +- Source the $VIMRUNTIME/colors/tools/check_colors.vim script to check for + common mistakes. - Does it work in a color terminal as well as in the GUI? - Is "g:colors_name" set to a meaningful value? In case of doubt you can do it this way: diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index 298fd24811..2e8c52b93c 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -1,6 +1,6 @@ " Vim color file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Apr 14 +" Last Change: 2016 Oct 10 " This color scheme uses a dark grey background. @@ -46,8 +46,8 @@ hi CursorColumn term=reverse ctermbg=Black guibg=grey40 hi CursorLine term=underline cterm=underline guibg=grey40 " Groups for syntax highlighting -hi Constant term=underline ctermfg=Magenta guifg=#ffa0a0 guibg=grey5 -hi Special term=bold ctermfg=LightRed guifg=Orange guibg=grey5 +hi Constant term=underline ctermfg=Magenta guifg=#ffa0a0 +hi Special term=bold ctermfg=LightRed guifg=Orange if &t_Co > 8 hi Statement term=bold cterm=bold ctermfg=Yellow guifg=#ffff60 gui=bold endif diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index a36f9f6972..250472a162 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -2,7 +2,7 @@ " vim: tw=0 ts=4 sw=4 " Vim color file " Maintainer: Ron Aaron <ron@ronware.org> -" Last Change: 2013 May 23 +" Last Change: 2016 Sep 04 hi clear set background=dark @@ -45,6 +45,7 @@ hi TabLineFill term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white g hi TabLineSel term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue hi Underlined term=underline cterm=bold,underline ctermfg=lightblue guifg=lightblue gui=bold,underline hi Ignore ctermfg=black ctermbg=black guifg=black guibg=black +hi EndOfBuffer term=bold cterm=bold ctermfg=darkred guifg=#cc0000 gui=bold hi link IncSearch Visual hi link String Constant hi link Character Constant diff --git a/runtime/colors/tools/check_colors.vim b/runtime/colors/tools/check_colors.vim new file mode 100644 index 0000000000..6c5e8f3c0f --- /dev/null +++ b/runtime/colors/tools/check_colors.vim @@ -0,0 +1,136 @@ +" This script tests a color scheme for some errors. Load the scheme and source +" this script. e.g. :e colors/desert.vim | :so check_colors.vim +" Will output possible errors. + +let s:save_cpo= &cpo +set cpo&vim + +func! Test_check_colors() + call cursor(1,1) + let err={} + + " 1) Check g:colors_name is existing + if !search('\<\%(g:\)\?colors_name\>', 'cnW') + let err['colors_name'] = 'g:colors_name not set' + else + let err['colors_name'] = 'OK' + endif + + " 2) Check for some well-defined highlighting groups + " Some items, check several groups, e.g. Diff, Spell + let hi_groups = ['ColorColumn', 'Diff', 'ErrorMsg', 'Folded', + \ 'FoldColumn', 'IncSearch', 'LineNr', 'ModeMsg', 'MoreMsg', 'NonText', + \ 'Normal', 'Pmenu', 'Todo', 'Search', 'Spell', 'StatusLine', 'TabLine', + \ 'Title', 'Visual', 'WarningMsg', 'WildMenu'] + let groups={} + for group in hi_groups + if search('\c@suppress\s\+'.group, 'cnW') + " skip check, if the script contains a line like + " @suppress Visual: + let groups[group] = 'Ignoring '.group + continue + endif + if !search('hi\%[ghlight] \+'.group, 'cnW') + let groups[group] = 'No highlight definition for '.group + continue + endif + if !search('hi\%[ghlight] \+'.group. '.*fg=', 'cnW') + let groups[group] = 'Missing foreground color for '.group + continue + endif + if search('hi\%[ghlight] \+'.group. '.*guibg=', 'cnW') && + \ !search('hi\%[ghlight] \+'.group. '.*ctermbg=', 'cnW') + let groups[group] = 'Missing bg terminal color for '.group + continue + endif + call search('hi\%[ghlight] \+'.group, 'cW') + " only check in the current line + if !search('guifg', 'cnW', line('.')) || !search('ctermfg', 'cnW', line('.')) + " do not check for background colors, they could be intentionally left out + let groups[group] = 'Missing fg definition for '.group + endif + call cursor(1,1) + endfor + let err['highlight'] = groups + + " 3) Check, that it does not set background highlighting + " Doesn't ':hi Normal ctermfg=253 ctermfg=233' also set the background sometimes? + let bg_set='\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)' + let bg_let='let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1' + let bg_pat='\%('.bg_set. '\|'.bg_let.'\)' + let line=search(bg_pat, 'cnW') + if search(bg_pat, 'cnW') + exe line + if search('hi \U\w\+\s\+\S', 'cbnW') + let err['background'] = 'Should not set background option after :hi statement' + endif + else + let err['background'] = 'OK' + endif + call cursor(1,1) + + " 4) Check, that t_Co is checked + let pat = '[&]t_Co\s*[<>=]=\?\s*\d\+' + if !search(pat, 'ncW') + let err['t_Co'] = 'Does not check terminal for capable colors' + endif + + " 5) Initializes correctly, e.g. should have a section like + " hi clear + " if exists("syntax_on") + " syntax reset + " endif + let pat='hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif' + if !search(pat, 'cnW') + let err['init'] = 'No initialization' + endif + + " 6) Does not use :syn on + if search('syn\%[tax]\s\+on', 'cnW') + let err['background'] = 'Should not issue :syn on' + endif + + " 7) Does not define filetype specfic groups like vimCommand, htmlTag, + let hi_groups = ['vim', 'html', 'python', 'sh', 'ruby'] + for group in hi_groups + let pat='\Chi\%[ghlight]\s*\zs'.group.'\w\+\>' + if search(pat, 'cnW') + let line = search(pat, 'cW') + let err['filetype'] = get(err, 'filetype', 'Should not define: ') . matchstr(getline('.'), pat). ' ' + endif + call cursor(1,1) + endfor + let g:err = err + + " print Result + call Result(err) +endfu + +fu! Result(err) + let do_roups = 0 + echohl Title|echomsg "---------------"|echohl Normal + for key in sort(keys(a:err)) + if key is# 'highlight' + let do_groups = 1 + continue + else + if a:err[key] !~ 'OK' + echohl Title + endif + echomsg printf("%15s: %s", key, a:err[key]) + echohl Normal + endif + endfor + echohl Title|echomsg "---------------"|echohl Normal + if do_groups + echohl Title | echomsg "Groups" | echohl Normal + for v1 in sort(keys(a:err['highlight'])) + echomsg printf("%25s: %s", v1, a:err['highlight'][v1]) + endfor + endif +endfu + +call Test_check_colors() + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/compiler/bdf.vim b/runtime/compiler/bdf.vim index ca33776988..b062e847aa 100644 --- a/runtime/compiler/bdf.vim +++ b/runtime/compiler/bdf.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: BDF to PCF Conversion -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Compiler: BDF to PCF Conversion +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("current_compiler") finish diff --git a/runtime/compiler/cargo.vim b/runtime/compiler/cargo.vim new file mode 100644 index 0000000000..bd48666bc9 --- /dev/null +++ b/runtime/compiler/cargo.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Compiler: Cargo Compiler +" Maintainer: Damien Radtke <damienradtke@gmail.com> +" Latest Revision: 2014 Sep 24 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists('current_compiler') + finish +endif +runtime compiler/rustc.vim +let current_compiler = "cargo" + +let s:save_cpo = &cpo +set cpo&vim + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +if exists('g:cargo_makeprg_params') + execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*' +else + CompilerSet makeprg=cargo\ $* +endif + +" Ignore general cargo progress messages +CompilerSet errorformat+= + \%-G%\\s%#Downloading%.%#, + \%-G%\\s%#Compiling%.%#, + \%-G%\\s%#Finished%.%#, + \%-G%\\s%#error:\ Could\ not\ compile\ %.%#, + \%-G%\\s%#To\ learn\ more\\,%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/compiler/context.vim b/runtime/compiler/context.vim new file mode 100644 index 0000000000..cb78c96df0 --- /dev/null +++ b/runtime/compiler/context.vim @@ -0,0 +1,54 @@ +" Vim compiler file +" Compiler: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Last Change: 2016 Oct 21 + +if exists("current_compiler") + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +" If makefile exists and we are not asked to ignore it, we use standard make +" (do not redefine makeprg) +if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) || + \ (!filereadable('Makefile') && !filereadable('makefile')) + let current_compiler = 'context' + " The following assumes that the current working directory is set to the + " directory of the file to be typeset + let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) + \ . ' --script context --autogenerate --nonstopmode --synctex=' + \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') + \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) + \ . ' ' . shellescape(expand('%:p:t')) +else + let current_compiler = 'make' +endif + +let b:context_errorformat = '' + \ . '%-Popen source%.%#> %f,' + \ . '%-Qclose source%.%#> %f,' + \ . "%-Popen source%.%#name '%f'," + \ . "%-Qclose source%.%#name '%f'," + \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,' + \ . 'tex %trror%.%#error on line %l in file %f: %m,' + \ . '%Elua %trror%.%#error on line %l in file %f:,' + \ . '%+Emetapost %#> error: %#,' + \ . '! error: %#%m,' + \ . '%-C %#,' + \ . '%C! %m,' + \ . '%Z[ctxlua]%m,' + \ . '%+C<*> %.%#,' + \ . '%-C%.%#,' + \ . '%Z...%m,' + \ . '%-Zno-error,' + \ . '%-G%.%#' " Skip remaining lines + +execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ') + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/csslint.vim b/runtime/compiler/csslint.vim new file mode 100644 index 0000000000..14c4289a24 --- /dev/null +++ b/runtime/compiler/csslint.vim @@ -0,0 +1,16 @@ +" Vim compiler file +" Compiler: csslint for CSS +" Maintainer: Daniel Moch <daniel@danielmoch.com> +" Last Change: 2016 May 21 + +if exists("current_compiler") + finish +endif +let current_compiler = "csslint" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=csslint\ --format=compact +CompilerSet errorformat=%-G,%-G%f:\ lint\ free!,%f:\ line\ %l\\,\ col\ %c\\,\ %trror\ -\ %m,%f:\ line\ %l\\,\ col\ %c\\,\ %tarning\ -\ %m,%f:\ line\ %l\\,\ col\ %c\\,\ %m diff --git a/runtime/compiler/cucumber.vim b/runtime/compiler/cucumber.vim index c020be6e3b..17ce3627c1 100644 --- a/runtime/compiler/cucumber.vim +++ b/runtime/compiler/cucumber.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 Aug 09 +" Last Change: 2016 Aug 29 if exists("current_compiler") finish @@ -19,7 +19,7 @@ CompilerSet makeprg=cucumber CompilerSet errorformat= \%W%m\ (Cucumber::Undefined), - \%E%m\ (%.%#), + \%E%m\ (%\\S%#), \%Z%f:%l, \%Z%f:%l:%.%# diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim index aee31d92c2..1af568de57 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -1,7 +1,8 @@ " Vim compiler file -" Compiler: GNU C Compiler -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-14 +" Compiler: GNU C Compiler +" Previous 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', diff --git a/runtime/compiler/ghc.vim b/runtime/compiler/ghc.vim new file mode 100644 index 0000000000..c98ae302a8 --- /dev/null +++ b/runtime/compiler/ghc.vim @@ -0,0 +1,26 @@ +" Vim compiler file +" Compiler: GHC Haskell Compiler +" Maintainer: Daniel Campoverde <alx@sillybytes.net> +" Latest Revision: 2016-11-29 + +if exists("current_compiler") + finish +endif +let current_compiler = "ghc" + +let s:cpo_save = &cpo +set cpo&vim + +CompilerSet errorformat= + \%-G%.%#:\ build, + \%-G%.%#preprocessing\ library\ %.%#, + \%-G[%.%#]%.%#, + \%E%f:%l:%c:\ %m, + \%-G--%.%# + +if exists('g:compiler_ghc_ignore_unmatched_lines') + CompilerSet errorformat+=%-G%.%# +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/go.vim b/runtime/compiler/go.vim new file mode 100644 index 0000000000..cf638f23d6 --- /dev/null +++ b/runtime/compiler/go.vim @@ -0,0 +1,29 @@ +" Vim compiler file +" Compiler: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('current_compiler') + finish +endif +let current_compiler = 'go' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +let s:save_cpo = &cpo +set cpo-=C + +CompilerSet makeprg=go\ build +CompilerSet errorformat= + \%-G#\ %.%#, + \%A%f:%l:%c:\ %m, + \%A%f:%l:\ %m, + \%C%*\\s%m, + \%-G%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: sw=2 sts=2 et diff --git a/runtime/compiler/haml.vim b/runtime/compiler/haml.vim index b06a672df7..9464c3dc85 100644 --- a/runtime/compiler/haml.vim +++ b/runtime/compiler/haml.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("current_compiler") finish @@ -15,7 +15,7 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=haml\ -c +CompilerSet makeprg=haml CompilerSet errorformat= \Haml\ %trror\ on\ line\ %l:\ %m, diff --git a/runtime/compiler/msvc.vim b/runtime/compiler/msvc.vim index 99fd35eb18..efe36c4da2 100644 --- a/runtime/compiler/msvc.vim +++ b/runtime/compiler/msvc.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: Miscrosoft Visual C +" Compiler: Microsoft Visual C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2005 Nov 30 +" Last Change: 2014 Sep 20 if exists("current_compiler") finish diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim new file mode 100644 index 0000000000..93079ce61d --- /dev/null +++ b/runtime/compiler/pylint.vim @@ -0,0 +1,16 @@ +" Vim compiler file +" Compiler: Pylint for Python +" Maintainer: Daniel Moch <daniel@danielmoch.com> +" Last Change: 2016 May 20 + +if exists("current_compiler") + finish +endif +let current_compiler = "pylint" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=pylint\ --output-format=text\ --msg-template=\"{path}:{line}:{column}:{C}:\ [{symbol}]\ {msg}\"\ --reports=no +CompilerSet errorformat=%A%f:%l:%c:%t:\ %m,%A%f:%l:\ %m,%A%f:(%l):\ %m,%-Z%p^%.%#,%-G%.%# diff --git a/runtime/compiler/rake.vim b/runtime/compiler/rake.vim index 3bd9da0daf..8490f2a9e9 100644 --- a/runtime/compiler/rake.vim +++ b/runtime/compiler/rake.vim @@ -27,7 +27,11 @@ CompilerSet errorformat= \%\\s%#[%f:%l:\ %#%m, \%\\s%#%f:%l:\ %#%m, \%\\s%#%f:%l:, - \%m\ [%f:%l]: + \%m\ [%f:%l]:, + \%+Erake\ aborted!, + \%+EDon't\ know\ how\ to\ build\ task\ %.%#, + \%+Einvalid\ option:%.%#, + \%+Irake\ %\\S%\\+%\\s%\\+#\ %.%# let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim index 7c340bab15..c77bd70da7 100644 --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -22,9 +22,10 @@ CompilerSet errorformat= \%f:%l:\ %tarning:\ %m, \%E%.%#:in\ `load':\ %f:%l:%m, \%E%f:%l:in\ `%*[^']':\ %m, - \%-Z\ \ \ \ \ \#\ %f:%l:%.%#, + \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#, \%E\ \ %\\d%\\+)%.%#, \%C\ \ \ \ \ %m, + \%C%\\s%#, \%-G%.%# let &cpo = s:cpo_save diff --git a/runtime/compiler/rst.vim b/runtime/compiler/rst.vim index 15d2d79f64..392bea6ae0 100644 --- a/runtime/compiler/rst.vim +++ b/runtime/compiler/rst.vim @@ -1,7 +1,8 @@ " Vim compiler file -" Compiler: reStructuredText Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org +" Description: reStructuredText Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2017-03-31 if exists("current_compiler") finish @@ -11,12 +12,18 @@ let current_compiler = "rst" let s:cpo_save = &cpo set cpo&vim -setlocal errorformat= - \%f:%l:\ (%tEBUG/0)\ %m, - \%f:%l:\ (%tNFO/1)\ %m, - \%f:%l:\ (%tARNING/2)\ %m, - \%f:%l:\ (%tRROR/3)\ %m, - \%f:%l:\ (%tEVERE/3)\ %m, +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet errorformat= + \%f\\:%l:\ %tEBUG:\ %m, + \%f\\:%l:\ %tNFO:\ %m, + \%f\\:%l:\ %tARNING:\ %m, + \%f\\:%l:\ %tRROR:\ %m, + \%f\\:%l:\ %tEVERE:\ %m, + \%f\\:%s:\ %tARNING:\ %m, + \%f\\:%s:\ %tRROR:\ %m, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%DMaking\ %*\\a\ in\ %f diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim index 93a0c8e653..ed0639b581 100644 --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -17,6 +17,8 @@ let s:cpo_save = &cpo set cpo-=C CompilerSet makeprg=testrb +" CompilerSet makeprg=ruby\ -Itest +" CompilerSet makeprg=m CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:, \%C%m\ [%f:%l]:, diff --git a/runtime/compiler/rustc.vim b/runtime/compiler/rustc.vim new file mode 100644 index 0000000000..c27bdc9c0c --- /dev/null +++ b/runtime/compiler/rustc.vim @@ -0,0 +1,46 @@ +" Vim compiler file +" Compiler: Rust Compiler +" Maintainer: Chris Morgan <me@chrismorgan.info> +" Latest Revision: 2013 Jul 12 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("current_compiler") + finish +endif +let current_compiler = "rustc" + +let s:cpo_save = &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 + CompilerSet makeprg=rustc +else + CompilerSet makeprg=rustc\ \% +endif + +" Old errorformat (before nightly 2016/08/10) +CompilerSet errorformat= + \%f:%l:%c:\ %t%*[^:]:\ %m, + \%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m, + \%-G%f:%l\ %s, + \%-G%*[\ ]^, + \%-G%*[\ ]^%*[~], + \%-G%*[\ ]... + +" New errorformat (after nightly 2016/08/10) +CompilerSet errorformat+= + \%-G, + \%-Gerror:\ aborting\ %.%#, + \%-Gerror:\ Could\ not\ compile\ %.%#, + \%Eerror:\ %m, + \%Eerror[E%n]:\ %m, + \%Wwarning:\ %m, + \%Inote:\ %m, + \%C\ %#-->\ %f:%l:%c + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/sass.vim b/runtime/compiler/sass.vim index 376a52b303..9c540ac443 100644 --- a/runtime/compiler/sass.vim +++ b/runtime/compiler/sass.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("current_compiler") finish @@ -15,7 +15,7 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=sass\ -c +CompilerSet makeprg=sass CompilerSet errorformat= \%f:%l:%m\ (Sass::Syntax%trror), diff --git a/runtime/compiler/tidy.vim b/runtime/compiler/tidy.vim index 56baee2224..75be8b83d9 100644 --- a/runtime/compiler/tidy.vim +++ b/runtime/compiler/tidy.vim @@ -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%.%# diff --git a/runtime/defaults.vim b/runtime/defaults.vim new file mode 100644 index 0000000000..6fd43db51b --- /dev/null +++ b/runtime/defaults.vim @@ -0,0 +1,134 @@ +" The default vimrc file. +" +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last change: 2017 Apr 12 +" +" This is loaded if no vimrc file was found. +" Except when Vim is run with "-u NONE" or "-C". +" Individual settings can be reverted with ":set option&". +" Other commands can be reverted as mentioned below. + +" When started as "evim", evim.vim will already have done these settings. +if v:progname =~? "evim" + finish +endif + +" Bail out if something that ran earlier, e.g. a system wide vimrc, does not +" want Vim to use these default values. +if exists('skip_defaults_vim') + finish +endif + +" Use Vim settings, rather than Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +" Avoid side effects when it was already reset. +if &compatible + set nocompatible +endif + +" When the +eval feature is missing, the set command above will be skipped. +" Use a trick to reset compatible only when the +eval feature is missing. +silent! while 0 + set nocompatible +silent! endwhile + +" Allow backspacing over everything in insert mode. +set backspace=indent,eol,start + +set history=200 " keep 200 lines of command line history +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set wildmenu " display completion matches in a status line + +set ttimeout " time out for key codes +set ttimeoutlen=100 " wait up to 100ms after Esc for special key + +" Show @@@ in the last line if it is truncated. +set display=truncate + +" Show a few lines of context around the cursor. Note that this makes the +" text scroll if you mouse-click near the start or end of the window. +set scrolloff=5 + +" Do incremental searching when it's possible to timeout. +if has('reltime') + set incsearch +endif + +" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it +" confusing. +set nrformats-=octal + +" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries. +if has('win32') + set guioptions-=t +endif + +" Don't use Ex mode, use Q for formatting. +" Revert with ":unmap Q". +map Q gq + +" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, +" so that you can undo CTRL-U after inserting a line break. +" Revert with ":iunmap <C-U>". +inoremap <C-U> <C-G>u<C-U> + +" In many terminal emulators the mouse works just fine. By enabling it you +" can position the cursor, Visually select and scroll with the mouse. +if has('mouse') + set mouse=a +endif + +" Switch syntax highlighting on when the terminal has colors or when using the +" GUI (which always has colors). +if &t_Co > 2 || has("gui_running") + " Revert with ":syntax off". + syntax on + + " I like highlighting strings inside C comments. + " Revert with ":unlet c_comment_strings". + let c_comment_strings=1 +endif + +" Only do this part when compiled with support for autocommands. +if has("autocmd") + + " Enable file type detection. + " Use the default filetype settings, so that mail gets 'tw' set to 72, + " 'cindent' is on in C files, etc. + " Also load indent files, to automatically do language-dependent indenting. + " Revert with ":filetype off". + filetype plugin indent on + + " Put these in an autocmd group, so that you can revert them with: + " ":augroup vimStartup | au! | augroup END" + augroup vimStartup + au! + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END + +endif " has("autocmd") + +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. +" Only define it when not defined already. +" Revert with: ":delcommand DiffOrig". +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis +endif + +if has('langmap') && exists('+langremap') + " Prevent that the langmap option applies to characters that result from a + " mapping. If set (default), this may break plugins (but it's backward + " compatible). + set nolangremap +endif diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index a6610a937a..fd69b3e3fc 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -17,6 +17,7 @@ DOCS = \ arabic.txt \ autocmd.txt \ change.txt \ + channel.txt \ cmdline.txt \ debug.txt \ debugger.txt \ @@ -29,9 +30,10 @@ DOCS = \ filetype.txt \ fold.txt \ ft_ada.txt \ + ft_rust.txt \ ft_sql.txt \ gui.txt \ - gui_w16.txt \ + gui_mac.txt \ gui_w32.txt \ gui_x11.txt \ hangulin.txt \ @@ -75,6 +77,7 @@ DOCS = \ pattern.txt \ pi_getscript.txt \ pi_gzip.txt \ + pi_logipat.txt \ pi_netrw.txt \ pi_paren.txt \ pi_spec.txt \ @@ -141,6 +144,7 @@ DOCS = \ version5.txt \ version6.txt \ version7.txt \ + version8.txt \ vi_diff.txt \ visual.txt \ windows.txt \ @@ -150,6 +154,7 @@ HTMLS = \ arabic.html \ autocmd.html \ change.html \ + channel.html \ cmdline.html \ debug.html \ debugger.html \ @@ -162,9 +167,9 @@ HTMLS = \ filetype.html \ fold.html \ ft_ada.html \ + ft_rust.html \ ft_sql.html \ gui.html \ - gui_w16.html \ gui_w32.html \ gui_x11.html \ hangulin.html \ @@ -207,6 +212,7 @@ HTMLS = \ pattern.html \ pi_getscript.html \ pi_gzip.html \ + pi_logipat.html \ pi_netrw.html \ pi_paren.html \ pi_spec.html \ @@ -229,7 +235,6 @@ HTMLS = \ starting.html \ syntax.html \ tabpage.html \ - tags.html \ tagsrch.html \ term.html \ tips.html \ @@ -274,6 +279,7 @@ HTMLS = \ version5.html \ version6.html \ version7.html \ + version8.html \ vi_diff.html \ vimindex.html \ visual.html \ @@ -302,10 +308,13 @@ CONVERTED = \ vimtutor-ru.UTF-8.1 \ xxd-ru.UTF-8.1 +JATAGS = ../../plugins/vimdoc-ja/doc/tags +JADOCS = ../../plugins/vimdoc-ja/doc/*.jax + .SUFFIXES: .SUFFIXES: .c .o .txt .html -all: tags vim.man evim.man vimdiff.man vimtutor.man xxd.man $(CONVERTED) +all: tags vim.man evim.man vimdiff.man vimtutor.man xxd.man $(CONVERTED) $(JATAGS) # Use Vim to generate the tags file. Can only be used when Vim has been # compiled and installed. Supports multiple languages. @@ -317,6 +326,10 @@ tags: doctags $(DOCS) ./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags uniq -d -2 tags +$(JATAGS): doctags $(JADOCS) + ./doctags $(JADOCS) | LANG=C LC_ALL=C sort >$@ + uniq -d -2 $@ + doctags: doctags.c $(CC) doctags.c -o doctags @@ -336,7 +349,7 @@ xxd.man: xxd.1 nroff -man xxd.1 | sed -e s/.//g > xxd.man uganda.nsis.txt: uganda.txt - sed -e 's/[ ]*\*[-a-zA-Z0-9.]*\*//g' -e 's/vim:tw=78://' \ + sed -e 's/[ ]*\*[-a-zA-Z0-9.]*\*//g' -e 's/vim:tw=78:.*//' \ uganda.txt | uniq >uganda.nsis.txt # Awk version of .txt to .html conversion. @@ -368,6 +381,10 @@ tags.ref tags.html: tags perlhtml: tags $(DOCS) ./vim2html.pl tags $(DOCS) +# Check URLs in the help with "curl". +test_urls: + vim -S test_urls.vim + clean: -rm doctags *.html tags.ref @@ -385,9 +402,6 @@ hebrew.txt: russian.txt: touch russian.txt -gui_w16.txt: - touch gui_w16.txt - gui_w32.txt: touch gui_w32.txt diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt index 2f0be512e7..3253b83583 100644 --- a/runtime/doc/arabic.txt +++ b/runtime/doc/arabic.txt @@ -1,4 +1,4 @@ -*arabic.txt* For Vim version 7.4. Last change: 2010 Nov 13 +*arabic.txt* For Vim version 8.1. Last change: 2010 Nov 13 VIM REFERENCE MANUAL by Nadim Shaikli diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 2a8becebff..703590a5f3 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2014 May 02 +*autocmd.txt* For Vim version 8.1. Last change: 2018 May 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -21,7 +21,6 @@ For a basic explanation, see section |40.3| in the user manual. 11. Disabling autocommands |autocmd-disable| {Vi does not have any of these commands} -{only when the |+autocmd| feature has not been disabled at compile time} ============================================================================== 1. Introduction *autocmd-intro* @@ -33,7 +32,7 @@ files matching *.c. You can also use autocommands to implement advanced features, such as editing compressed files (see |gzip-example|). The usual place to put autocommands is in your .vimrc or .exrc file. - *E203* *E204* *E143* *E855* + *E203* *E204* *E143* *E855* *E937* *E952* WARNING: Using autocommands is very powerful, and may lead to unexpected side effects. Be careful not to destroy your text. - It's a good idea to do some testing on an expendable copy of a file first. @@ -52,14 +51,13 @@ effects. Be careful not to destroy your text. ============================================================================== 2. Defining autocommands *autocmd-define* -Note: The ":autocmd" command cannot be followed by another command, since any -'|' is considered part of the command. - *:au* *:autocmd* :au[tocmd] [group] {event} {pat} [nested] {cmd} Add {cmd} to the list of commands that Vim will execute automatically on {event} for a file matching {pat} |autocmd-patterns|. + Note: A quote character is seen as argument to the + :autocmd and won't start a comment. Vim always adds the {cmd} after existing autocommands, so that the autocommands execute in the order in which they were given. See |autocmd-nested| for [nested]. @@ -67,6 +65,19 @@ Note: The ":autocmd" command cannot be followed by another command, since any The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand. See |autocmd-buflocal|. +Note: The ":autocmd" command can only be followed by another command when the +'|' appears before {cmd}. This works: > + :augroup mine | au! BufRead | augroup END +But this sees "augroup" as part of the defined command: > + :augroup mine | au! BufRead * | augroup END + :augroup mine | au BufRead * set tw=70 | augroup END +Instead you can put the group name into the command: > + :au! mine BufRead * + :au mine BufRead * set tw=70 +Or use `:execute`: > + :augroup mine | exe "au! BufRead *" | augroup END + :augroup mine | exe "au BufRead * set tw=70" | augroup END + Note that special characters (e.g., "%", "<cword>") in the ":autocmd" arguments are not expanded when the autocommand is defined. These will be expanded when the Event is recognized, and the {cmd} is executed. The only @@ -76,11 +87,16 @@ exception is that "<sfile>" is expanded when the autocmd is defined. Example: Here Vim expands <sfile> to the name of the file containing this line. -When your .vimrc file is sourced twice, the autocommands will appear twice. -To avoid this, put this command in your .vimrc file, before defining -autocommands: > +`:autocmd` adds to the list of autocommands regardless of whether they are +already present. When your .vimrc file is sourced twice, the autocommands +will appear twice. To avoid this, define your autocommands in a group, so +that you can easily clear them: > - :autocmd! " Remove ALL autocommands for the current group. + augroup vimrc + " Remove all vimrc autocommands + autocmd! + au BufNewFile,BufRead *.html so <sfile>:h/html.vim + augroup END If you don't want to remove all autocommands, you can instead use a variable to ensure that Vim includes the autocommands only once: > @@ -127,8 +143,15 @@ prompt. When one command outputs two messages this can happen anyway. :au[tocmd]! [group] {event} Remove ALL autocommands for {event}. + Warning: You should not do this without a group for + |BufRead| and other common events, it can break + plugins, syntax highlighting, etc. :au[tocmd]! [group] Remove ALL autocommands. + Note: a quote will be seen as argument to the :autocmd + and won't start a comment. + Warning: You should normally not do this without a + group, it breaks plugins, syntax highlighting, etc. When the [group] argument is not given, Vim uses the current group (as defined with ":augroup"); otherwise, Vim uses the group defined with [group]. @@ -239,6 +262,7 @@ Name triggered by ~ |BufCreate| just after adding a buffer to the buffer list |BufDelete| before deleting a buffer from the buffer list |BufWipeout| before completely deleting a buffer +|TerminalOpen| after a terminal buffer was created |BufFilePre| before changing the name of the current buffer |BufFilePost| after changing the name of the current buffer @@ -259,6 +283,7 @@ Name triggered by ~ |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 Startup and exit |VimEnter| after doing all the startup stuff @@ -266,7 +291,8 @@ Name triggered by ~ |GUIFailed| after starting the GUI failed |TermResponse| after the terminal response to |t_RV| is received -|QuitPre| when using `:quit`, before deciding whether to quit +|QuitPre| when using `:quit`, before deciding whether to exit +|ExitPre| when using a command that may make Vim exit |VimLeavePre| before exiting Vim, before writing the viminfo file |VimLeave| before exiting Vim, after writing the viminfo file @@ -275,9 +301,12 @@ Name triggered by ~ |FileChangedShellPost| After handling a file changed since editing started |FileChangedRO| before making the first change to a read-only file +|DirChanged| after the working directory has changed + |ShellCmdPost| after executing a shell command |ShellFilterPost| after filtering with a shell command +|CmdUndefined| a user command is used but it isn't defined |FuncUndefined| a user function is used but it isn't defined |SpellFileMissing| a spell file is used but it can't be found |SourcePre| before sourcing a Vim script @@ -291,6 +320,9 @@ Name triggered by ~ |CursorMoved| the cursor was moved in Normal mode |CursorMovedI| the cursor was moved in Insert mode +|WinNew| after creating a new window +|TabNew| after creating a new tab page +|TabClosed| after closing a tab page |WinEnter| after entering another window |WinLeave| before leaving a window |TabEnter| after entering another tab page @@ -298,6 +330,10 @@ Name triggered by ~ |CmdwinEnter| after entering the command-line window |CmdwinLeave| before leaving the command-line window +|CmdlineChanged| after a change was made to the command-line text +|CmdlineEnter| after the cursor moves to the command line +|CmdlineLeave| before the cursor leaves the command line + |InsertEnter| starting Insert mode |InsertChange| when typing <Insert> while in Insert or Replace mode |InsertLeave| when leaving Insert mode @@ -306,7 +342,12 @@ Name triggered by ~ |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode + when popup menu is not visible +|TextChangedP| after a change was made to the text in Insert mode + when popup menu visible +|TextYankPost| after text is yanked or deleted +|ColorSchemePre| before loading a color scheme |ColorScheme| after loading a color scheme |RemoteReply| a reply from a server Vim was received @@ -411,8 +452,8 @@ BufUnload Before unloading a buffer. This is when the NOTE: When this autocommand is executed, the current buffer "%" may be different from the buffer being unloaded "<afile>". - Don't change to another buffer, it will cause - problems. + Don't change to another buffer or window, it + will cause problems! When exiting and v:dying is 2 or more this event is not triggered. *BufWinEnter* @@ -428,6 +469,9 @@ BufWinEnter After a buffer is displayed in a window. This existing buffer. But it does happen for a ":split" with the name of the current buffer, since it reloads that buffer. + Does not happen for a terminal window, because + it starts in Terminal-Job mode and Normal mode + commands won't work. Use |TerminalOpen| instead. *BufWinLeave* BufWinLeave Before a buffer is removed from a window. Not when it's still visible in another window. @@ -465,6 +509,39 @@ BufWriteCmd Before writing the whole buffer to a file. *BufWritePost* BufWritePost After writing the whole buffer to a file (should undo the commands for BufWritePre). + *CmdUndefined* +CmdUndefined When a user command is used but it isn't + defined. Useful for defining a command only + when it's used. The pattern is matched + against the command name. Both <amatch> and + <afile> are set to the name of the command. + NOTE: Autocompletion won't work until the + command is defined. An alternative is to + always define the user command and have it + invoke an autoloaded function. See |autoload|. + *CmdlineChanged* +CmdlineChanged After a change was made to the text in the + command line. Be careful not to mess up + the command line, it may cause Vim to lock up. + <afile> is set to a single character, + indicating the type of command-line. + |cmdwin-char| + *CmdlineEnter* +CmdlineEnter After moving the cursor to the command line, + where the user can type a command or search + string. + <afile> is set to a single character, + indicating the type of command-line. + |cmdwin-char| + *CmdlineLeave* +CmdlineLeave Before leaving the command line. + Also when abandoning the command line, after + typing CTRL-C or <Esc>. + When the commands result in an error the + command line is still executed. + <afile> is set to a single character, + indicating the type of command-line. + |cmdwin-char| *CmdwinEnter* CmdwinEnter After entering the command-line window. Useful for setting options specifically for @@ -489,11 +566,17 @@ ColorScheme After loading a color scheme. |:colorscheme| set, and <amatch> for the new colorscheme name. + *ColorSchemePre* +ColorSchemePre Before loading a color scheme. |:colorscheme| + Useful to setup removing things added by a + color scheme, before another one is loaded. *CompleteDone* CompleteDone After Insert mode completion is done. Either when something was completed or abandoning completion. |ins-completion| + The |v:completed_item| variable contains + information about the completed item. *CursorHold* CursorHold When the user doesn't press a key for the time @@ -508,6 +591,11 @@ CursorHold When the user doesn't press a key for the time operator. While recording the CursorHold event is not triggered. |q| + *<CursorHold>* + Internally the autocommand is triggered by the + <CursorHold> key. In an expression mapping + |getchar()| may see this character. + Note: Interactive commands cannot be used for this event. There is no hit-enter prompt, the screen is updated directly (when needed). @@ -520,6 +608,9 @@ CursorHold When the user doesn't press a key for the time versions} *CursorHoldI* CursorHoldI Just like CursorHold, but in Insert mode. + Not triggered when waiting for another key, + e.g. after CTRL-V, and not when in CTRL-X mode + |insert_expand|. *CursorMoved* CursorMoved After the cursor was moved in Normal or Visual @@ -565,6 +656,21 @@ FileChangedRO Before making the first change to a read-only *E881* If the number of lines changes saving for undo may fail and the change will be aborted. + *DirChanged* +DirChanged The working directory has changed in response + to the |:cd| or |:lcd| commands, or as a + result of the 'autochdir' option. + The pattern can be: + "window" to trigger on `:lcd + "global" to trigger on `:cd` + "auto" to trigger on 'autochdir'. + "drop" to trigger on editing a file + <afile> is set to the new directory name. + *ExitPre* +ExitPre When using `:quit`, `:wq` in a way it makes + Vim exit, or using `:qall`, just after + |QuitPre|. Can be used to close any + non-essential window. *FileChangedShell* FileChangedShell When Vim notices that the modification time of a file has changed since editing started. @@ -573,7 +679,7 @@ FileChangedShell When Vim notices that the modification time of |timestamp| Mostly triggered after executing a shell command, but also with a |:checktime| command - or when Gvim regains input focus. + or when gvim regains input focus. This autocommand is triggered for each changed file. It is not used when 'autoread' is set and the buffer was not changed. If a @@ -584,7 +690,7 @@ FileChangedShell When Vim notices that the modification time of to tell Vim what to do next. NOTE: When this autocommand is executed, the current buffer "%" may be different from the - buffer that was changed "<afile>". + buffer that was changed, which is in "<afile>". NOTE: The commands must not change the current buffer, jump to another buffer or delete a buffer. *E246* *E811* @@ -614,7 +720,8 @@ FileType When the 'filetype' option has been set. The pattern is matched against the filetype. <afile> can be used for the name of the file where this option was set, and <amatch> for - the new value of 'filetype'. + the new value of 'filetype'. Navigating to + another window or buffer is not allowed. See |filetypes|. *FileWriteCmd* FileWriteCmd Before writing to a file, when not writing the @@ -670,6 +777,8 @@ FuncUndefined When a user function is used but it isn't when it's used. The pattern is matched against the function name. Both <amatch> and <afile> are set to the name of the function. + NOTE: When writing Vim scripts a better + alternative is to use an autoloaded function. See |autoload-functions|. *GUIEnter* GUIEnter After starting the GUI successfully, and after @@ -699,7 +808,7 @@ InsertCharPre When a character is typed in Insert mode, inserted literally. It is not allowed to change the text |textlock|. The event is not triggered when 'paste' is - set. + set. {only with the +eval feature} *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The @@ -724,6 +833,29 @@ MenuPopup Just before showing the popup menu (under the o Operator-pending i Insert c Command line + *OptionSet* +OptionSet After setting an option. The pattern is + matched against the long option name. + The |v:option_old| variable indicates the + old option value, |v:option_new| variable + indicates the newly set value, the + |v:option_type| variable indicates whether + it's global or local scoped and |<amatch>| + indicates what option has been set. + + Is not triggered on startup and for the 'key' + option for obvious reasons. + + Usage example: Check for the existence of the + directory in the 'backupdir' and 'undodir' + options, create the directory if it doesn't + exist yet. + + Note: It's a bad idea to reset an option + during this autocommand, this may break a + plugin. You can always use `:noa` to prevent + triggering this autocommand. + *QuickFixCmdPre* QuickFixCmdPre Before a quickfix command is run (|:make|, |:lmake|, |:grep|, |:lgrep|, |:grepadd|, @@ -731,7 +863,9 @@ QuickFixCmdPre Before a quickfix command is run (|:make|, |:vimgrepadd|, |:lvimgrepadd|, |:cscope|, |:cfile|, |:cgetfile|, |:caddfile|, |:lfile|, |:lgetfile|, |:laddfile|, |:helpgrep|, - |:lhelpgrep|). + |:lhelpgrep|, |:cexpr|, |:cgetexpr|, + |:caddexpr|, |:cbuffer|, |:cgetbuffer|, + |:caddbuffer|). The pattern is matched against the command being run. When |:grep| is used but 'grepprg' is set to "internal" it still matches "grep". @@ -752,6 +886,7 @@ QuitPre When using `:quit`, `:wq` or `:qall`, before or quits Vim. Can be used to close any non-essential window if the current window is the last ordinary window. + Also see |ExitPre|. *RemoteReply* RemoteReply When a reply from a Vim that functions as server was received |server2client()|. The @@ -820,6 +955,7 @@ SwapExists Detected an existing swap file when starting It is not allowed to change to another buffer, change a buffer name or change directory here. + {only available with the +eval feature} *Syntax* Syntax When the 'syntax' option has been set. The pattern is matched against the syntax name. @@ -827,6 +963,8 @@ Syntax When the 'syntax' option has been set. The where this option was set, and <amatch> for the new value of 'syntax'. See |:syn-on|. + *TabClosed* +TabClosed After closing a tab page. *TabEnter* TabEnter Just after entering a tab page. |tab-page| After triggering the WinEnter and before @@ -835,11 +973,20 @@ TabEnter Just after entering a tab page. |tab-page| TabLeave Just before leaving a tab page. |tab-page| A WinLeave event will have been triggered first. + *TabNew* +TabNew When a tab page was created. |tab-page| + A WinEnter event will have been triggered + first, TabEnter follows. *TermChanged* TermChanged After the value of 'term' has changed. Useful for re-loading the syntax file to update the colors, fonts and other terminal-dependent settings. Executed for all loaded buffers. + *TerminalOpen* +TerminalOpen Just after a terminal buffer was created, with + `:terminal` or |term_start()|. This event is + triggered even if the buffer is created + without a window, with the ++hidden option. *TermResponse* TermResponse After the response to |t_RV| is received from the terminal. The value of |v:termresponse| @@ -862,10 +1009,39 @@ TextChangedI After a change was made to the text in the current buffer in Insert mode. Not triggered when the popup menu is visible. Otherwise the same as TextChanged. + *TextChangedP* +TextChangedP After a change was made to the text in the + current buffer in Insert mode, only when the + popup menu is visible. Otherwise the same as + TextChanged. + *TextYankPost* +TextYankPost After text has been yanked or deleted in the + current buffer. The following values of + |v:event| can be used to determine the operation + that triggered this autocmd: + operator The operation performed. + regcontents Text that was stored in the + register, as a list of lines, + like with: > + getreg(r, 1, 1) +< regname Name of the |register| or + empty string for the unnamed + register. + regtype Type of the register, see + |getregtype()|. + Not triggered when |quote_| is used nor when + called recursively. + It is not allowed to change the buffer text, + see |textlock|. + {only when compiled with the +eval feature} *User* User Never executed automatically. To be used for autocommands that are only executed with ":doautocmd". + Note that when `:doautocmd User MyEvent` is + used while there are no matching autocommands, + you will get an error. If you don't want + that, define a dummy autocommand yourself. *UserGettingBored* UserGettingBored When the user presses the same key 42 times. Just kidding! :-) @@ -874,7 +1050,15 @@ VimEnter After doing all the startup stuff, including loading .vimrc files, executing the "-c cmd" arguments, creating all windows and loading the buffers in them. - *VimLeave* + Just before this event is triggered the + |v:vim_did_enter| variable is set, so that you + can do: > + if v:vim_did_enter + call s:init() + else + au VimEnter * call s:init() + endif +< *VimLeave* VimLeave Before exiting Vim, just after writing the .viminfo file. Executed only once, like VimLeavePre. @@ -902,9 +1086,10 @@ WinEnter After entering another window. Not done for If the window is for another buffer, Vim executes the BufEnter autocommands after the WinEnter autocommands. - Note: When using ":split fname" the WinEnter - event is triggered after the split but before - the file "fname" is loaded. + Note: For split and tabpage commands the + WinEnter event is triggered after the split + or tab command but before the file is loaded. + *WinLeave* WinLeave Before leaving a window. If the window to be entered next is for a different buffer, Vim @@ -912,9 +1097,21 @@ WinLeave Before leaving a window. If the window to be WinLeave autocommands (but not for ":new"). Not used for ":qa" or ":q" when exiting Vim. + *WinNew* +WinNew When a new window was created. Not done for + the first window, when Vim has just started. + Before a WinEnter event. + ============================================================================== 6. Patterns *autocmd-patterns* *{pat}* +The {pat} argument can be a comma separated list. This works as if the +command was given with each pattern separately. Thus this command: > + :autocmd BufRead *.txt,*.info set et +Is equivalent to: > + :autocmd BufRead *.txt set et + :autocmd BufRead *.info set et + The file pattern {pat} is tested for a match against the file name in one of two ways: 1. When there is no '/' in the pattern, Vim checks for a match against only @@ -986,6 +1183,9 @@ Note that for all systems the '/' character is used for path separator (even MS-DOS and OS/2). This was done because the backslash is difficult to use in a pattern and to make the autocommands portable across different systems. +It is possible to use |pattern| items, but they may not work as expected, +because of the translation done for the above. + *autocmd-changes* Matching with the pattern is done when an event is triggered. Changing the buffer name in one of the autocommands, or even deleting the buffer, does not @@ -1021,7 +1221,7 @@ Instead of a pattern buffer-local autocommands use one of these forms: Examples: > :au CursorHold <buffer> echo 'hold' :au CursorHold <buffer=33> echo 'hold' - :au CursorHold <buffer=abuf> echo 'hold' + :au BufNewFile * au CursorHold <buffer=abuf> echo 'hold' All the commands for autocommands also work with buffer-local autocommands, simply use the special string instead of the pattern. Examples: > @@ -1080,11 +1280,16 @@ name! :aug[roup] {name} Define the autocmd group name for the following ":autocmd" commands. The name "end" or "END" selects the default group. + To avoid confusion, the name should be + different from existing {event} names, as this + most likely will not do what you intended. - *:augroup-delete* *E367* + *:augroup-delete* *E367* *W19* *E936* :aug[roup]! {name} Delete the autocmd group {name}. Don't use this if there is still an autocommand using - this group! This is not checked. + this group! You will get a warning if doing + it anyway. when the group is the current group + you will get error E936. To enter autocommands for a specific group, use this method: 1. Select the group with ":augroup {name}". @@ -1139,6 +1344,8 @@ option will not cause any commands to be executed. argument is present. You probably want to use <nomodeline> for events that are not used when loading a buffer, such as |User|. + Processing modelines is also skipped when no + matching autocommands were executed. *:doautoa* *:doautoall* :doautoa[ll] [<nomodeline>] [group] {event} [fname] diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 89293cd243..0f5e0de93f 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2014 Jun 26 +*change.txt* For Vim version 8.1. Last change: 2018 May 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -98,10 +98,10 @@ These commands delete text. You can repeat them with the `.` command An exception for the d{motion} command: If the motion is not linewise, the start and end of the motion are not in the same line, and there are only -blanks before the start and after the end of the motion, the delete becomes -linewise. This means that the delete also removes the line of blanks that you -might expect to remain. Use the |o_v| operator to force the motion to be -characterwise. +blanks before the start and there are no non-blanks after the end of the +motion, the delete becomes linewise. This means that the delete also removes +the line of blanks that you might expect to remain. Use the |o_v| operator to +force the motion to be characterwise. Trying to delete an empty region of text (e.g., "d0" in the first column) is an error when 'cpoptions' includes the 'E' flag. @@ -109,7 +109,9 @@ is an error when 'cpoptions' includes the 'E' flag. *J* J Join [count] lines, with a minimum of two lines. Remove the indent and insert up to two spaces (see - below). + below). Fails when on the last line of the buffer. + If [count] is too big it is reduced to the number of + lines available. *v_J* {Visual}J Join the highlighted lines, with a minimum of two @@ -379,13 +381,56 @@ Adding and subtracting ~ CTRL-A Add [count] to the number or alphabetic character at or after the cursor. {not in Vi} + *v_CTRL-A* +{Visual}CTRL-A Add [count] to the number or alphabetic character in + the highlighted text. {not in Vi} + + *v_g_CTRL-A* +{Visual}g CTRL-A Add [count] to the number or alphabetic character in + the highlighted text. If several lines are + highlighted, each one will be incremented by an + additional [count] (so effectively creating a + [count] incrementing sequence). {not in Vi} + For Example, if you have this list of numbers: + 1. ~ + 1. ~ + 1. ~ + 1. ~ + Move to the second "1." and Visually select three + lines, pressing g CTRL-A results in: + 1. ~ + 2. ~ + 3. ~ + 4. ~ + *CTRL-X* CTRL-X Subtract [count] from the number or alphabetic character at or after the cursor. {not in Vi} -The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned -octal and hexadecimal numbers and alphabetic characters. This depends on the -'nrformats' option. + *v_CTRL-X* +{Visual}CTRL-X Subtract [count] from the number or alphabetic + character in the highlighted text. {not in Vi} + + On MS-Windows, this is mapped to cut Visual text + |dos-standard-mappings|. If you want to disable the + mapping, use this: > + silent! vunmap <C-X> +< + *v_g_CTRL-X* +{Visual}g CTRL-X Subtract [count] from the number or alphabetic + character in the highlighted text. If several lines + are highlighted, each value will be decremented by an + additional [count] (so effectively creating a [count] + decrementing sequence). {not in Vi} + +The CTRL-A and CTRL-X commands can work for: +- signed and unsigned decimal numbers +- unsigned binary, octal and hexadecimal numbers +- alphabetic characters + +This depends on the 'nrformats' option: +- When 'nrformats' includes "bin", Vim assumes numbers starting with '0b' or + '0B' are binary. - When 'nrformats' includes "octal", Vim considers numbers starting with a '0' to be octal, unless the number includes a '8' or '9'. Other numbers are decimal and may have a preceding minus sign. @@ -399,6 +444,10 @@ octal and hexadecimal numbers and alphabetic characters. This depends on the under or after the cursor. This is useful to make lists with an alphabetic index. +For decimals a leading negative sign is considered for incrementing/ +decrementing, for binary, octal and hex values, it won't be considered. To +ignore the sign Visually select the number before using CTRL-A or CTRL-X. + For numbers with leading zeros (including all octal and hexadecimal numbers), Vim preserves the number of characters in the number when possible. CTRL-A on "0077" results in "0100", CTRL-X on "0x100" results in "0x0ff". @@ -410,6 +459,10 @@ octal number. Note that when 'nrformats' includes "octal", decimal numbers with leading zeros cause mistakes, because they can be confused with octal numbers. +Note similarly, when 'nrformats' includes "bin", binary numbers with a leading +'0x' or '0X' can be interpreted as hexadecimal rather than binary since '0b' +are valid hexadecimal digits. + The CTRL-A command is very useful in a macro. Example: Use the following steps to make a numbered list. @@ -480,6 +533,7 @@ If the 'shiftround' option is on, the indent is rounded to a multiple of If the 'smartindent' option is on, or 'cindent' is on and 'cinkeys' contains '#' with a zero value, shift right does not affect lines starting with '#' (these are supposed to be C preprocessor lines that must stay in column 1). +This can be changed with the 'cino' option, see |cino-#|. When the 'expandtab' option is off (this is the default) Vim uses <Tab>s as much as possible to make the indent. You can use ">><<" to replace an indent @@ -582,12 +636,14 @@ For other systems the tmpnam() library function is used. For the {pattern} see |pattern|. {string} can be a literal string, or something special; see |sub-replace-special|. + *E939* When [range] and [count] are omitted, replace in the - current line only. - When [count] is given, replace in [count] lines, - starting with the last line in [range]. When [range] - is omitted start in the current line. - Also see |cmdline-ranges|. + current line only. When [count] is given, replace in + [count] lines, starting with the last line in [range]. + When [range] is omitted start in the current line. + [count] must be a positive number. Also see + |cmdline-ranges|. + See |:s_flags| for [flags]. :[range]s[ubstitute] [flags] [count] @@ -597,9 +653,9 @@ For other systems the tmpnam() library function is used. may add [flags], see |:s_flags|. Note that after `:substitute` the '&' flag can't be used, it's recognized as a pattern separator. - The space between `:substitute` and the 'c', 'g' and - 'r' flags isn't required, but in scripts it's a good - idea to keep it to avoid confusion. + The space between `:substitute` and the 'c', 'g', + 'i', 'I' and 'r' flags isn't required, but in scripts + it's a good idea to keep it to avoid confusion. :[range]~[&][flags] [count] *:~* Repeat last substitute with same substitute string @@ -631,6 +687,7 @@ g& Synonym for `:%s//~/&` (repeat last substitute with *:s_flags* The flags that you can use for the substitute commands: + *:&&* [&] Must be the first one: Keep the flags from the previous substitute command. Examples: > :&& @@ -799,7 +856,7 @@ Examples: > :s/abcde/abc^Mde/ modifies "abcde" to "abc", "de" (two lines) :s/$/\^M/ modifies "abcde" to "abcde^M" :s/\w\+/\u\0/g modifies "bla bla" to "Bla Bla" - :s/\w\+/\L\u/g modifies "BLA bla" to "Bla Bla" + :s/\w\+/\L\u\0/g modifies "BLA bla" to "Bla Bla" Note: "\L\u" can be used to capitalize the first letter of a word. This is not compatible with Vi and older versions of Vim, where the "\u" would cancel @@ -819,6 +876,7 @@ The numbering of "\1", "\2" etc. is done based on which "\(" comes first in the pattern (going left to right). When a parentheses group matches several times, the last one will be used for "\1", "\2", etc. Example: > :s/\(\(a[a-d] \)*\)/\2/ modifies "aa ab x" to "ab x" +The "\2" is for "\(a[a-d] \)". At first it matches "aa ", secondly "ab ". When using parentheses in combination with '|', like in \([ab]\)\|\([cd]\), either the first or second pattern in parentheses did not match, so either @@ -826,11 +884,40 @@ either the first or second pattern in parentheses did not match, so either :s/\([ab]\)\|\([cd]\)/\1x/g modifies "a b c d" to "ax bx x x" < + *:sc* *:sce* *:scg* *:sci* *:scI* *:scl* *:scp* *:sg* *:sgc* + *:sge* *:sgi* *:sgI* *:sgl* *:sgn* *:sgp* *:sgr* *:sI* *:si* + *:sic* *:sIc* *:sie* *:sIe* *:sIg* *:sIl* *:sin* *:sIn* *:sIp* + *:sip* *:sIr* *:sir* *:sr* *:src* *:srg* *:sri* *:srI* *:srl* + *:srn* *:srp* +2-letter and 3-letter :substitute commands ~ + + List of :substitute commands + | c e g i I n p l r + | c :sc :sce :scg :sci :scI :scn :scp :scl --- + | e + | g :sgc :sge :sg :sgi :sgI :sgn :sgp :sgl :sgr + | i :sic :sie --- :si :siI :sin :sip --- :sir + | I :sIc :sIe :sIg :sIi :sI :sIn :sIp :sIl :sIr + | n + | p + | l + | r :src --- :srg :sri :srI :srn :srp :srl :sr + +Exceptions: + :scr is `:scriptnames` + :se is `:set` + :sig is `:sign` + :sil is `:silent` + :sn is `:snext` + :sp is `:split` + :sl is `:sleep` + :sre is `:srewind` + + Substitute with an expression *sub-replace-expression* *sub-replace-\=* *s/\=* When the substitute string starts with "\=" the remainder is interpreted as an -expression. This does not work recursively: a |substitute()| function inside -the expression cannot use "\=" for the substitute string. +expression. The special meaning for characters as mentioned at |sub-replace-special| does not apply except for "<CR>". A <NL> character is used as a line break, you @@ -901,8 +988,6 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|. `:retab!` may also change a sequence of spaces by <Tab> characters, which can mess up a printf(). {not in Vi} - Not available when |+ex_extra| feature was disabled at - compile time. *retab-example* Example for using autocommands and ":retab" to edit a file which is stored @@ -931,7 +1016,7 @@ inside of strings can change! Also see 'softtabstop' option. > :reg[isters] {arg} Display the contents of the numbered and named registers that are mentioned in {arg}. For example: > - :dis 1a + :reg 1a < to display registers '1' and 'a'. Spaces are allowed in {arg}. {not in Vi} @@ -1098,16 +1183,17 @@ Rationale: In Vi the "y" command followed by a backwards motion would With a linewise yank command the cursor is put in the first line, but the column is unmodified, thus it may not be on the first yanked character. -There are nine types of registers: *registers* *E354* +There are ten types of registers: *registers* *E354* 1. The unnamed register "" 2. 10 numbered registers "0 to "9 3. The small delete register "- 4. 26 named registers "a to "z or "A to "Z -5. four read-only registers ":, "., "% and "# -6. the expression register "= -7. The selection and drop registers "*, "+ and "~ -8. The black hole register "_ -9. Last search pattern register "/ +5. three read-only registers ":, "., "% +6. alternate buffer register "# +7. the expression register "= +8. The selection and drop registers "*, "+ and "~ +9. The black hole register "_ +10. Last search pattern register "/ 1. Unnamed register "" *quote_quote* *quotequote* Vim fills this register with text deleted with the "d", "c", "s", "x" commands @@ -1123,7 +1209,7 @@ name '"'. This means you have to type two double quotes. Writing to the "" register writes to register "0. {Vi: register contents are lost when changing files, no '"'} -2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* +2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* *quote2* *quote3* *quote4* *quote9* Vim fills these registers with text from yank and delete commands. Numbered register 0 contains the text from the most recent yank command, @@ -1153,7 +1239,7 @@ letters to replace their previous contents or as uppercase letters to append to their previous contents. When the '>' flag is present in 'cpoptions' then a line break is inserted before the appended text. -5. Read-only registers ":, "., "% and "# +5. Read-only registers ":, ". and "% These are '%', '#', ':' and '.'. You can use them only with the "p", "P", and ":put" commands and with CTRL-R. {not in Vi} *quote_.* *quote.* *E29* @@ -1164,8 +1250,6 @@ and ":put" commands and with CTRL-R. {not in Vi} ('textwidth' and other options affect what is inserted). *quote_%* *quote%* "% Contains the name of the current file. - *quote_#* *quote#* - "# Contains the name of the alternate file. *quote_:* *quote:* *E30* ": Contains the most recent executed command-line. Example: Use "@:" to repeat the previous command-line command. @@ -1174,16 +1258,33 @@ and ":put" commands and with CTRL-R. {not in Vi} the command was completely from a mapping. {not available when compiled without the |+cmdline_hist| feature} - -6. Expression register "= *quote_=* *quote=* *@=* + *quote_#* *quote#* +6. Alternate file register "# +Contains the name of the alternate file for the current window. It will +change how the |CTRL-^| command works. +This register is writable, mainly to allow for restoring it after a plugin has +changed it. It accepts buffer number: > + let altbuf = bufnr(@#) + ... + let @# = altbuf +It will give error |E86| if you pass buffer number and this buffer does not +exist. +It can also accept a match with an existing buffer name: > + let @# = 'buffer_name' +Error |E93| if there is more than one buffer matching the given name or |E94| +if none of buffers matches the given name. + +7. Expression register "= *quote_=* *quote=* *@=* This is not really a register that stores text, but is a way to use an expression in commands which use a register. The expression register is -read-only; you cannot put text into it. After the '=', the cursor moves to -the command-line, where you can enter any expression (see |expression|). All -normal command-line editing commands are available, including a special -history for expressions. When you end the command-line by typing <CR>, Vim -computes the result of the expression. If you end it with <Esc>, Vim abandons -the expression. If you do not enter an expression, Vim uses the previous +read-write. + +When typing the '=' after " or CTRL-R the cursor moves to the command-line, +where you can enter any expression (see |expression|). All normal +command-line editing commands are available, including a special history for +expressions. When you end the command-line by typing <CR>, Vim computes the +result of the expression. If you end it with <Esc>, Vim abandons the +expression. If you do not enter an expression, Vim uses the previous expression (like with the "/" command). The expression must evaluate to a String. A Number is always automatically @@ -1196,7 +1297,7 @@ If the "= register is used for the "p" command, the String is split up at <NL> characters. If the String ends in a <NL>, it is regarded as a linewise register. {not in Vi} -7. Selection and drop registers "*, "+ and "~ +8. Selection and drop registers "*, "+ and "~ Use these registers for storing and retrieving the selected text for the GUI. See |quotestar| and |quoteplus|. When the clipboard is not available or not working, the unnamed register is used instead. For Unix systems the clipboard @@ -1218,17 +1319,17 @@ GTK GUI} Note: The "~ register is only used when dropping plain text onto Vim. Drag'n'drop of URI lists is handled internally. -8. Black hole register "_ *quote_* +9. Black hole register "_ *quote_* When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. When reading from this register, nothing is returned. {not in Vi} -9. Last search pattern register "/ *quote_/* *quote/* +10. Last search pattern register "/ *quote_/* *quote/* Contains the most recent search-pattern. This is used for "n" and 'hlsearch'. It is writable with `:let`, you can change it to have 'hlsearch' highlight other matches without actually searching. You can't yank or delete into this register. The search direction is available in |v:searchforward|. -Note that the valued is restored when returning from a function +Note that the value is restored when returning from a function |function-search-undo|. {not in Vi} @@ -1262,22 +1363,16 @@ The next three commands always work on whole lines. Center lines in [range] between [width] columns (default 'textwidth' or 80 when 'textwidth' is 0). {not in Vi} - Not available when |+ex_extra| feature was disabled at - compile time. :[range]ri[ght] [width] *:ri* *:right* Right-align lines in [range] at [width] columns (default 'textwidth' or 80 when 'textwidth' is 0). {not in Vi} - Not available when |+ex_extra| feature was disabled at - compile time. *:le* *:left* :[range]le[ft] [indent] Left-align lines in [range]. Sets the indent in the lines to [indent] (default 0). {not in Vi} - Not available when |+ex_extra| feature was disabled at - compile time. *gq* gq{motion} Format the lines that {motion} moves over. @@ -1350,6 +1445,55 @@ to the name of an external program for Vim to use for text formatting. The 'textwidth' and other options have no effect on formatting by an external program. + *format-formatexpr* +The 'formatexpr' option can be set to a Vim Script function that performs +reformatting of the buffer. This should usually happen in an |ftplugin|, +since formatting is highly dependent on the type of file. It makes +sense to use an |autoload| script, so the corresponding script is only loaded +when actually needed and the script should be called <filetype>format.vim. + +For example, the XML filetype plugin distributed with Vim in the $VIMRUNTIME +directory, sets the 'formatexpr' option to: > + + setlocal formatexpr=xmlformat#Format() + +That means, you will find the corresponding script, defining the +xmlformat#Format() function, in the directory: +`$VIMRUNTIME/autoload/xmlformat.vim` + +Here is an example script that removes trailing whitespace from the selected +text. Put it in your autoload directory, e.g. ~/.vim/autoload/format.vim: > + + func! format#Format() + " only reformat on explicit gq command + if mode() != 'n' + " fall back to Vims internal reformatting + return 1 + endif + let lines = getline(v:lnum, v:lnum + v:count - 1) + call map(lines, {key, val -> substitute(val, '\s\+$', '', 'g')}) + call setline('.', lines) + + " do not run internal formatter! + return 0 + endfunc + +You can then enable the formatting by executing: > + setlocal formatexpr=format#Format() +> +Note: this function explicitly returns non-zero when called from insert mode +(which basically means, text is inserted beyond the 'textwidth' limit). This +causes Vim to fall back to reformat the text by using the internal formatter. + +However, if the |gq| command is used to reformat the text, the function +will receive the selected lines, trim trailing whitespace from those lines and +put them back in place. If you are going to split single lines into multiple +lines, be careful not to overwrite anything. + +If you want to allow reformatting of text from insert or replace mode, one has +to be very careful, because the function might be called recursively. For +debugging it helps to set the 'debug' option. + *right-justify* There is no command in Vim to right justify text. You can do it with an external command, like "par" (e.g.: "!}par" to format until the end of the @@ -1443,10 +1587,10 @@ When you hit Return in a C-comment, Vim will insert the middle comment leader for the new line: " * ". To close this comment you just have to type "/" before typing anything else on the new line. This will replace the middle-comment leader with the end-comment leader and apply any specified -alignment, leaving just " */". There is no need to hit BackSpace first. +alignment, leaving just " */". There is no need to hit Backspace first. -When there is a match with a middle part, but there also is a maching end part -which is longer, the end part is used. This makes a C style comment work +When there is a match with a middle part, but there also is a matching end +part which is longer, the end part is used. This makes a C style comment work without requiring the middle part to end with a space. Here is an example of alignment flags at work to make a comment stand out @@ -1653,7 +1797,7 @@ Vim has a sorting function and a sorting command. The sorting function can be found here: |sort()|, |uniq()|. *:sor* *:sort* -:[range]sor[t][!] [i][u][r][n][x][o] [/{pattern}/] +:[range]sor[t][!] [b][f][i][n][o][r][u][x] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. @@ -1661,10 +1805,18 @@ found here: |sort()|, |uniq()|. With [i] case is ignored. + Options [n][f][x][o][b] are mutually exclusive. + With [n] sorting is done on the first decimal number in the line (after or inside a {pattern} match). One leading '-' is included in the number. + With [f] sorting is done on the Float in the line. + The value of Float is determined similar to passing + the text (after or inside a {pattern} match) to + str2float() function. This option is available only + if Vim was compiled with Floating point support. + With [x] sorting is done on the first hexadecimal number in the line (after or inside a {pattern} match). A leading "0x" or "0X" is ignored. @@ -1673,10 +1825,13 @@ found here: |sort()|, |uniq()|. With [o] sorting is done on the first octal number in the line (after or inside a {pattern} match). - With [u] only keep the first of a sequence of - identical lines (ignoring case when [i] is used). - Without this flag, a sequence of identical lines - will be kept in their original order. + With [b] sorting is done on the first binary number in + the line (after or inside a {pattern} match). + + With [u] (u stands for unique) only keep the first of + a sequence of identical lines (ignoring case when [i] + is used). Without this flag, a sequence of identical + lines will be kept in their original order. Note that leading and trailing white space may cause lines to be different. diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt new file mode 100644 index 0000000000..bffb3e2833 --- /dev/null +++ b/runtime/doc/channel.txt @@ -0,0 +1,813 @@ +*channel.txt* For Vim version 8.1. Last change: 2018 Apr 18 + + + VIM REFERENCE MANUAL by Bram Moolenaar + + + Inter-process communication *channel* + +Vim uses channels to communicate with other processes. +A channel uses a socket or pipes. *socket-interface* +Jobs can be used to start processes and communicate with them. +The Netbeans interface also uses a channel. |netbeans| + +1. Overview |job-channel-overview| +2. Channel demo |channel-demo| +3. Opening a channel |channel-open| +4. Using a JSON or JS channel |channel-use| +5. Channel commands |channel-commands| +6. Using a RAW or NL channel |channel-raw| +7. More channel functions |channel-more| +8. Starting a job with a channel |job-start| +9. Starting a job without a channel |job-start-nochannel| +10. Job options |job-options| +11. Controlling a job |job-control| +12. Using a prompt buffer |prompt-buffer| + +{Vi does not have any of these features} +{only when compiled with the |+channel| feature for channel stuff} + You can check this with: `has('channel')` +{only when compiled with the |+job| feature for job stuff} + You can check this with: `has('job')` + +============================================================================== +1. Overview *job-channel-overview* + +There are four main types of jobs: +1. A daemon, serving several Vim instances. + Vim connects to it with a socket. +2. One job working with one Vim instance, asynchronously. + Uses a socket or pipes. +3. A job performing some work for a short time, asynchronously. + Uses a socket or pipes. +4. Running a filter, synchronously. + Uses pipes. + +For when using sockets See |job-start|, |job-start-nochannel| and +|channel-open|. For 2 and 3, one or more jobs using pipes, see |job-start|. +For 4 use the ":{range}!cmd" command, see |filter|. + +Over the socket and pipes these protocols are available: +RAW nothing known, Vim cannot tell where a message ends +NL every message ends in a NL (newline) character +JSON JSON encoding |json_encode()| +JS JavaScript style JSON-like encoding |js_encode()| + +Common combination are: +- Using a job connected through pipes in NL mode. E.g., to run a style + checker and receive errors and warnings. +- Using a daemon, connecting over a socket in JSON mode. E.g. to lookup + cross-references in a database. + +============================================================================== +2. Channel demo *channel-demo* *demoserver.py* + +This requires Python. The demo program can be found in +$VIMRUNTIME/tools/demoserver.py +Run it in one terminal. We will call this T1. + +Run Vim in another terminal. Connect to the demo server with: > + let channel = ch_open('localhost:8765') + +In T1 you should see: + === socket opened === ~ + +You can now send a message to the server: > + echo ch_evalexpr(channel, 'hello!') + +The message is received in T1 and a response is sent back to Vim. +You can see the raw messages in T1. What Vim sends is: + [1,"hello!"] ~ +And the response is: + [1,"got it"] ~ +The number will increase every time you send a message. + +The server can send a command to Vim. Type this on T1 (literally, including +the quotes): + ["ex","echo 'hi there'"] ~ +And you should see the message in Vim. You can move the cursor a word forward: + ["normal","w"] ~ + +To handle asynchronous communication a callback needs to be used: > + func MyHandler(channel, msg) + echo "from the handler: " . a:msg + endfunc + call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"}) +Vim will not wait for a response. Now the server can send the response later +and MyHandler will be invoked. + +Instead of giving a callback with every send call, it can also be specified +when opening the channel: > + call ch_close(channel) + let channel = ch_open('localhost:8765', {'callback': "MyHandler"}) + call ch_sendexpr(channel, 'hello!') + +When trying out channels it's useful to see what is going on. You can tell +Vim to write lines in log file: > + call ch_logfile('channellog', 'w') +See |ch_logfile()|. + +============================================================================== +3. Opening a channel *channel-open* + +To open a channel: > + let channel = ch_open({address} [, {options}]) + if ch_status(channel) == "open" + " use the channel + +Use |ch_status()| to see if the channel could be opened. + +{address} has the form "hostname:port". E.g., "localhost:8765". + +{options} is a dictionary with optional entries: *channel-open-options* + +"mode" can be: *channel-mode* + "json" - Use JSON, see below; most convenient way. Default. + "js" - Use JS (JavaScript) encoding, more efficient than JSON. + "nl" - Use messages that end in a NL character + "raw" - Use raw messages + *channel-callback* *E921* +"callback" A function that is called when a message is received that is + not handled otherwise. It gets two arguments: the channel + and the received message. Example: > + func Handle(channel, msg) + echo 'Received: ' . a:msg + endfunc + let channel = ch_open("localhost:8765", {"callback": "Handle"}) +< + When "mode" is "json" or "js" the "msg" argument is the body + of the received message, converted to Vim types. + When "mode" is "nl" the "msg" argument is one message, + excluding the NL. + When "mode" is "raw" the "msg" argument is the whole message + as a string. + + For all callbacks: Use |function()| to bind it to arguments + and/or a Dictionary. Or use the form "dict.function" to bind + the Dictionary. + + Callbacks are only called at a "safe" moment, usually when Vim + is waiting for the user to type a character. Vim does not use + multi-threading. + + *close_cb* +"close_cb" A function that is called when the channel gets closed, other + than by calling ch_close(). It should be defined like this: > + func MyCloseHandler(channel) +< Vim will invoke callbacks that handle data before invoking + close_cb, thus when this function is called no more data will + be passed to the callbacks. + *channel-drop* +"drop" Specifies when to drop messages: + "auto" When there is no callback to handle a message. + The "close_cb" is also considered for this. + "never" All messages will be kept. + + *waittime* +"waittime" The time to wait for the connection to be made in + milliseconds. A negative number waits forever. + + The default is zero, don't wait, which is useful if a local + server is supposed to be running already. On Unix Vim + actually uses a 1 msec timeout, that is required on many + systems. Use a larger value for a remote server, e.g. 10 + msec at least. + *channel-timeout* +"timeout" The time to wait for a request when blocking, E.g. when using + ch_evalexpr(). In milliseconds. The default is 2000 (2 + seconds). + +When "mode" is "json" or "js" the "callback" is optional. When omitted it is +only possible to receive a message after sending one. + +To change the channel options after opening it use |ch_setoptions()|. The +arguments are similar to what is passed to |ch_open()|, but "waittime" cannot +be given, since that only applies to opening the channel. + +For example, the handler can be added or changed: > + call ch_setoptions(channel, {'callback': callback}) +When "callback" is empty (zero or an empty string) the handler is removed. + +After a callback has been invoked Vim will update the screen and put the +cursor back where it belongs. Thus the callback should not need to do +`:redraw`. + +The timeout can be changed: > + call ch_setoptions(channel, {'timeout': msec}) +< + *channel-close* *E906* +Once done with the channel, disconnect it like this: > + call ch_close(channel) +When a socket is used this will close the socket for both directions. When +pipes are used (stdin/stdout/stderr) they are all closed. This might not be +what you want! Stopping the job with job_stop() might be better. +All readahead is discarded, callbacks will no longer be invoked. + +Note that a channel is closed in three stages: + - The I/O ends, log message: "Closing channel". There can still be queued + messages to read or callbacks to invoke. + - The readahead is cleared, log message: "Clearing channel". Some variables + may still reference the channel. + - The channel is freed, log message: "Freeing channel". + +When the channel can't be opened you will get an error message. There is a +difference between MS-Windows and Unix: On Unix when the port doesn't exist +ch_open() fails quickly. On MS-Windows "waittime" applies. +*E898* *E901* *E902* + +If there is an error reading or writing a channel it will be closed. +*E630* *E631* + +============================================================================== +4. Using a JSON or JS channel *channel-use* + +If mode is JSON then a message can be sent synchronously like this: > + let response = ch_evalexpr(channel, {expr}) +This awaits a response from the other side. + +When mode is JS this works the same, except that the messages use +JavaScript encoding. See |js_encode()| for the difference. + +To send a message, without handling a response or letting the channel callback +handle the response: > + call ch_sendexpr(channel, {expr}) + +To send a message and letting the response handled by a specific function, +asynchronously: > + call ch_sendexpr(channel, {expr}, {'callback': Handler}) + +Vim will match the response with the request using the message ID. Once the +response is received the callback will be invoked. Further responses with the +same ID will be ignored. If your server sends back multiple responses you +need to send them with ID zero, they will be passed to the channel callback. + +The {expr} is converted to JSON and wrapped in an array. An example of the +message that the receiver will get when {expr} is the string "hello": + [12,"hello"] ~ + +The format of the JSON sent is: + [{number},{expr}] + +In which {number} is different every time. It must be used in the response +(if any): + + [{number},{response}] + +This way Vim knows which sent message matches with which received message and +can call the right handler. Also when the messages arrive out of order. + +A newline character is terminating the JSON text. This can be used to +separate the read text. For example, in Python: + splitidx = read_text.find('\n') + message = read_text[:splitidx] + rest = read_text[splitidx + 1:] + +The sender must always send valid JSON to Vim. Vim can check for the end of +the message by parsing the JSON. It will only accept the message if the end +was received. A newline after the message is optional. + +When the process wants to send a message to Vim without first receiving a +message, it must use the number zero: + [0,{response}] + +Then channel handler will then get {response} converted to Vim types. If the +channel does not have a handler the message is dropped. + +It is also possible to use ch_sendraw() and ch_evalraw() on a JSON or JS +channel. The caller is then completely responsible for correct encoding and +decoding. + +============================================================================== +5. Channel commands *channel-commands* + +With a JSON channel the process can send commands to Vim that will be +handled by Vim internally, it does not require a handler for the channel. + +Possible commands are: *E903* *E904* *E905* + ["redraw", {forced}] + ["ex", {Ex command}] + ["normal", {Normal mode command}] + ["expr", {expression}, {number}] + ["expr", {expression}] + ["call", {func name}, {argument list}, {number}] + ["call", {func name}, {argument list}] + +With all of these: Be careful what these commands do! You can easily +interfere with what the user is doing. To avoid trouble use |mode()| to check +that the editor is in the expected state. E.g., to send keys that must be +inserted as text, not executed as a command: + ["ex","if mode() == 'i' | call feedkeys('ClassName') | endif"] ~ + +Errors in these commands are normally not reported to avoid them messing up +the display. If you do want to see them, set the 'verbose' option to 3 or +higher. + + +Command "redraw" ~ + +The other commands do not update the screen, so that you can send a sequence +of commands without the cursor moving around. You must end with the "redraw" +command to show any changed text and show the cursor where it belongs. + +The argument is normally an empty string: + ["redraw", ""] ~ +To first clear the screen pass "force": + ["redraw", "force"] ~ + + +Command "ex" ~ + +The "ex" command is executed as any Ex command. There is no response for +completion or error. You could use functions in an |autoload| script: + ["ex","call myscript#MyFunc(arg)"] + +You can also use "call |feedkeys()|" to insert any key sequence. + +When there is an error a message is written to the channel log, if it exists, +and v:errmsg is set to the error. + + +Command "normal" ~ + +The "normal" command is executed like with ":normal!", commands are not +mapped. Example to open the folds under the cursor: + ["normal" "zO"] + + +Command "expr" with response ~ + +The "expr" command can be used to get the result of an expression. For +example, to get the number of lines in the current buffer: + ["expr","line('$')", -2] ~ + +It will send back the result of the expression: + [-2, "last line"] ~ +The format is: + [{number}, {result}] + +Here {number} is the same as what was in the request. Use a negative number +to avoid confusion with message that Vim sends. Use a different number on +every request to be able to match the request with the response. + +{result} is the result of the evaluation and is JSON encoded. If the +evaluation fails or the result can't be encoded in JSON it is the string +"ERROR". + + +Command "expr" without a response ~ + +This command is similar to "expr" above, but does not send back any response. +Example: + ["expr","setline('$', ['one', 'two', 'three'])"] ~ +There is no third argument in the request. + + +Command "call" ~ + +This is similar to "expr", but instead of passing the whole expression as a +string this passes the name of a function and a list of arguments. This +avoids the conversion of the arguments to a string and escaping and +concatenating them. Example: + ["call", "line", ["$"], -2] ~ + +Leave out the fourth argument if no response is to be sent: + ["call", "setline", ["$", ["one", "two", "three"]]] ~ + +============================================================================== +6. Using a RAW or NL channel *channel-raw* + +If mode is RAW or NL then a message can be sent like this: > + let response = ch_evalraw(channel, {string}) + +The {string} is sent as-is. The response will be what can be read from the +channel right away. Since Vim doesn't know how to recognize the end of the +message you need to take care of it yourself. The timeout applies for reading +the first byte, after that it will not wait for anything more. + +If mode is "nl" you can send a message in a similar way. You are expected +to put in the NL after each message. Thus you can also send several messages +ending in a NL at once. The response will be the text up to and including the +first NL. This can also be just the NL for an empty response. +If no NL was read before the channel timeout an empty string is returned. + +To send a message, without expecting a response: > + call ch_sendraw(channel, {string}) +The process can send back a response, the channel handler will be called with +it. + +To send a message and letting the response handled by a specific function, +asynchronously: > + call ch_sendraw(channel, {string}, {'callback': 'MyHandler'}) + +This {string} can also be JSON, use |json_encode()| to create it and +|json_decode()| to handle a received JSON message. + +It is not possible to use |ch_evalexpr()| or |ch_sendexpr()| on a raw channel. + +A String in Vim cannot contain NUL bytes. To send or receive NUL bytes read +or write from a buffer. See |in_io-buffer| and |out_io-buffer|. + +============================================================================== +7. More channel functions *channel-more* + +To obtain the status of a channel: ch_status(channel). The possible results +are: + "fail" Failed to open the channel. + "open" The channel can be used. + "buffered" The channel was closed but there is data to read. + "closed" The channel was closed. + +To obtain the job associated with a channel: ch_getjob(channel) + +To read one message from a channel: > + let output = ch_read(channel) +This uses the channel timeout. To read without a timeout, just get any +message that is available: > + let output = ch_read(channel, {'timeout': 0}) +When no message was available then the result is v:none for a JSON or JS mode +channels, an empty string for a RAW or NL channel. You can use |ch_canread()| +to check if there is something to read. + +Note that when there is no callback, messages are dropped. To avoid that add +a close callback to the channel. + +To read all output from a RAW channel that is available: > + let output = ch_readraw(channel) +To read the error output: > + let output = ch_readraw(channel, {"part": "err"}) + +ch_read() and ch_readraw() use the channel timeout. When there is nothing to +read within that time an empty string is returned. To specify a different +timeout in msec use the "timeout" option: + {"timeout": 123} ~ +To read from the error output use the "part" option: + {"part": "err"} ~ +To read a message with a specific ID, on a JS or JSON channel: + {"id": 99} ~ +When no ID is specified or the ID is -1, the first message is returned. This +overrules any callback waiting for this message. + +For a RAW channel this returns whatever is available, since Vim does not know +where a message ends. +For a NL channel this returns one message. +For a JS or JSON channel this returns one decoded message. +This includes any sequence number. + +============================================================================== +8. Starting a job with a channel *job-start* *job* + +To start a job and open a channel for stdin/stdout/stderr: > + let job = job_start(command, {options}) + +You can get the channel with: > + let channel = job_getchannel(job) + +The channel will use NL mode. If you want another mode it's best to specify +this in {options}. When changing the mode later some text may have already +been received and not parsed correctly. + +If the command produces a line of output that you want to deal with, specify +a handler for stdout: > + let job = job_start(command, {"out_cb": "MyHandler"}) +The function will be called with the channel and a message. You would define +it like this: > + func MyHandler(channel, msg) + +Without the handler you need to read the output with |ch_read()| or +|ch_readraw()|. You can do this in the close callback, see |read-in-close-cb|. + +Note that if the job exits before you read the output, the output may be lost. +This depends on the system (on Unix this happens because closing the write end +of a pipe causes the read end to get EOF). To avoid this make the job sleep +for a short while before it exits. + +The handler defined for "out_cb" will not receive stderr. If you want to +handle that separately, add an "err_cb" handler: > + let job = job_start(command, {"out_cb": "MyHandler", + \ "err_cb": "ErrHandler"}) + +If you want to handle both stderr and stdout with one handler use the +"callback" option: > + let job = job_start(command, {"callback": "MyHandler"}) + +Depending on the system, starting a job can put Vim in the background, the +started job gets the focus. To avoid that, use the `foreground()` function. +This might not always work when called early, put in the callback handler or +use a timer to call it after the job has started. + +You can send a message to the command with ch_evalraw(). If the channel is in +JSON or JS mode you can use ch_evalexpr(). + +There are several options you can use, see |job-options|. +For example, to start a job and write its output in buffer "dummy": > + let logjob = job_start("tail -f /tmp/log", + \ {'out_io': 'buffer', 'out_name': 'dummy'}) + sbuf dummy + + +Job input from a buffer ~ + *in_io-buffer* +To run a job that reads from a buffer: > + let job = job_start({command}, + \ {'in_io': 'buffer', 'in_name': 'mybuffer'}) +< + *E915* *E918* +The buffer is found by name, similar to |bufnr()|. The buffer must exist and +be loaded when job_start() is called. + +By default this reads the whole buffer. This can be changed with the "in_top" +and "in_bot" options. + +A special mode is when "in_top" is set to zero and "in_bot" is not set: Every +time a line is added to the buffer, the last-but-one line will be sent to the +job stdin. This allows for editing the last line and sending it when pressing +Enter. + *channel-close-in* +When not using the special mode the pipe or socket will be closed after the +last line has been written. This signals the reading end that the input +finished. You can also use |ch_close_in()| to close it sooner. + +NUL bytes in the text will be passed to the job (internally Vim stores these +as NL bytes). + + +Reading job output in the close callback ~ + *read-in-close-cb* +If the job can take some time and you don't need intermediate results, you can +add a close callback and read the output there: > + + func! CloseHandler(channel) + while ch_status(a:channel, {'part': 'out'}) == 'buffered' + echomsg ch_read(a:channel) + endwhile + endfunc + let job = job_start(command, {'close_cb': 'CloseHandler'}) + +You will want to do something more useful than "echomsg". + +============================================================================== +9. Starting a job without a channel *job-start-nochannel* + +To start another process without creating a channel: > + let job = job_start(command, + \ {"in_io": "null", "out_io": "null", "err_io": "null"}) + +This starts {command} in the background, Vim does not wait for it to finish. + +When Vim sees that neither stdin, stdout or stderr are connected, no channel +will be created. Often you will want to include redirection in the command to +avoid it getting stuck. + +There are several options you can use, see |job-options|. + + *job-start-if-needed* +To start a job only when connecting to an address does not work, do something +like this: > + let channel = ch_open(address, {"waittime": 0}) + if ch_status(channel) == "fail" + let job = job_start(command) + let channel = ch_open(address, {"waittime": 1000}) + endif + +Note that the waittime for ch_open() gives the job one second to make the port +available. + +============================================================================== +10. Job options *job-options* + +The {options} argument in job_start() is a dictionary. All entries are +optional. Some options can be used after the job has started, using +job_setoptions(job, {options}). Many options can be used with the channel +related to the job, using ch_setoptions(channel, {options}). +See |job_setoptions()| and |ch_setoptions()|. + + *in_mode* *out_mode* *err_mode* +"in_mode" mode specifically for stdin, only when using pipes +"out_mode" mode specifically for stdout, only when using pipes +"err_mode" mode specifically for stderr, only when using pipes + See |channel-mode| for the values. + + Note: when setting "mode" the part specific mode is + overwritten. Therefore set "mode" first and the part + specific mode later. + + Note: when writing to a file or buffer and when + reading from a buffer NL mode is used by default. + + *job-callback* +"callback": handler Callback for something to read on any part of the + channel. + *job-out_cb* *out_cb* +"out_cb": handler Callback for when there is something to read on + stdout. Only for when the channel uses pipes. When + "out_cb" wasn't set the channel callback is used. + The two arguments are the channel and the message. + + *job-err_cb* *err_cb* +"err_cb": handler Callback for when there is something to read on + stderr. Only for when the channel uses pipes. When + "err_cb" wasn't set the channel callback is used. + The two arguments are the channel and the message. + *job-close_cb* +"close_cb": handler Callback for when the channel is closed. Same as + "close_cb" on |ch_open()|, see |close_cb|. + *job-drop* +"drop": when Specifies when to drop messages. Same as "drop" on + |ch_open()|, see |channel-drop|. For "auto" the + exit_cb is not considered. + *job-exit_cb* +"exit_cb": handler Callback for when the job ends. The arguments are the + job and the exit status. + Vim checks up to 10 times per second for jobs that + ended. The check can also be triggered by calling + |job_status()|, which may then invoke the exit_cb + handler. + Note that data can be buffered, callbacks may still be + called after the process ends. + *job-timeout* +"timeout": time The time to wait for a request when blocking, E.g. + when using ch_evalexpr(). In milliseconds. The + default is 2000 (2 seconds). + *out_timeout* *err_timeout* +"out_timeout": time Timeout for stdout. Only when using pipes. +"err_timeout": time Timeout for stderr. Only when using pipes. + Note: when setting "timeout" the part specific mode is + overwritten. Therefore set "timeout" first and the + part specific mode later. + + *job-stoponexit* +"stoponexit": {signal} Send {signal} to the job when Vim exits. See + |job_stop()| for possible values. +"stoponexit": "" Do not stop the job when Vim exits. + The default is "term". + + *job-term* +"term": "open" Start a terminal in a new window and connect the job + stdin/stdout/stderr to it. Similar to using + `:terminal`. + NOTE: Not implemented yet! + +"channel": {channel} Use an existing channel instead of creating a new one. + The parts of the channel that get used for the new job + will be disconnected from what they were used before. + If the channel was still used by another job this may + cause I/O errors. + Existing callbacks and other settings remain. + +"pty": 1 Use a pty (pseudo-tty) instead of a pipe when + possible. This is most useful in combination with a + terminal window, see |terminal|. + {only on Unix and Unix-like systems} + + *job-in_io* *in_top* *in_bot* *in_name* *in_buf* +"in_io": "null" disconnect stdin (read from /dev/null) +"in_io": "pipe" stdin is connected to the channel (default) +"in_io": "file" stdin reads from a file +"in_io": "buffer" stdin reads from a buffer +"in_top": number when using "buffer": first line to send (default: 1) +"in_bot": number when using "buffer": last line to send (default: last) +"in_name": "/path/file" the name of the file or buffer to read from +"in_buf": number the number of the buffer to read from + + *job-out_io* *out_name* *out_buf* +"out_io": "null" disconnect stdout (goes to /dev/null) +"out_io": "pipe" stdout is connected to the channel (default) +"out_io": "file" stdout writes to a file +"out_io": "buffer" stdout appends to a buffer (see below) +"out_name": "/path/file" the name of the file or buffer to write to +"out_buf": number the number of the buffer to write to +"out_modifiable": 0 when writing to a buffer, 'modifiable' will be off + (see below) +"out_msg": 0 when writing to a new buffer, the first line will be + set to "Reading from channel output..." + + *job-err_io* *err_name* *err_buf* +"err_io": "out" stderr messages to go to stdout +"err_io": "null" disconnect stderr (goes to /dev/null) +"err_io": "pipe" stderr is connected to the channel (default) +"err_io": "file" stderr writes to a file +"err_io": "buffer" stderr appends to a buffer (see below) +"err_name": "/path/file" the name of the file or buffer to write to +"err_buf": number the number of the buffer to write to +"err_modifiable": 0 when writing to a buffer, 'modifiable' will be off + (see below) +"err_msg": 0 when writing to a new buffer, the first line will be + set to "Reading from channel error..." + +"block_write": number only for testing: pretend every other write to stdin + will block + +"env": dict environment variables for the new process +"cwd": "/path/to/dir" current working directory for the new process; + if the directory does not exist an error is given + + +Writing to a buffer ~ + *out_io-buffer* +When the out_io or err_io mode is "buffer" and there is a callback, the text +is appended to the buffer before invoking the callback. + +When a buffer is used both for input and output, the output lines are put +above the last line, since the last line is what is written to the channel +input. Otherwise lines are appended below the last line. + +When using JS or JSON mode with "buffer", only messages with zero or negative +ID will be added to the buffer, after decoding + encoding. Messages with a +positive number will be handled by a callback, commands are handled as usual. + +The name of the buffer from "out_name" or "err_name" is compared the full name +of existing buffers, also after expanding the name for the current directory. +E.g., when a buffer was created with ":edit somename" and the buffer name is +"somename" it will use that buffer. + +If there is no matching buffer a new buffer is created. Use an empty name to +always create a new buffer. |ch_getbufnr()| can then be used to get the +buffer number. + +For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If +you prefer other settings, create the buffer first and pass the buffer number. + *out_modifiable* *err_modifiable* +The "out_modifiable" and "err_modifiable" options can be used to set the +'modifiable' option off, or write to a buffer that has 'modifiable' off. That +means that lines will be appended to the buffer, but the user can't easily +change the buffer. + *out_msg* *err_msg* +The "out_msg" option can be used to specify whether a new buffer will have the +first line set to "Reading from channel output...". The default is to add the +message. "err_msg" does the same for channel error. + +When an existing buffer is to be written where 'modifiable' is off and the +"out_modifiable" or "err_modifiable" options is not zero, an error is given +and the buffer will not be written to. + +When the buffer written to is displayed in a window and the cursor is in the +first column of the last line, the cursor will be moved to the newly added +line and the window is scrolled up to show the cursor if needed. + +Undo is synced for every added line. NUL bytes are accepted (internally Vim +stores these as NL bytes). + + +Writing to a file ~ + *E920* +The file is created with permissions 600 (read-write for the user, not +accessible for others). Use |setfperm()| to change this. + +If the file already exists it is truncated. + +============================================================================== +11. Controlling a job *job-control* + +To get the status of a job: > + echo job_status(job) + +To make a job stop running: > + job_stop(job) + +This is the normal way to end a job. On Unix it sends a SIGTERM to the job. +It is possible to use other ways to stop the job, or even send arbitrary +signals. E.g. to force a job to stop, "kill it": > + job_stop(job, "kill") + +For more options see |job_stop()|. + +============================================================================== +12. Using a prompt buffer *prompt-buffer* + +If you want to type input for the job in a Vim window you have a few options: +- Use a normal buffer and handle all possible commands yourself. + This will be complicated, since there are so many possible commands. +- Use a terminal window. This works well if what you type goes directly to + the job and the job output is directly displayed in the window. + See |terminal-window|. +- Use a prompt window. This works well when entering a line for the job in Vim + while displaying (possibly filtered) output from the job. + +A prompt buffer is created by setting 'buftype' to "prompt". You would +normally only do that in a newly created buffer. + +The user can edit and enter one line of text at the very last line of the +buffer. When pressing Enter in the prompt line the callback set with +|prompt_setcallback()| is invoked. It would normally send the line to a job. +Another callback would receive the output from the job and display it in the +buffer, below the prompt (and above the next prompt). + +Only the text in the last line, after the prompt, is editable. The rest of the +buffer is not modifiable with Normal mode commands. It can be modified by +calling functions, such as |append()|. Using other commands may mess up the +buffer. + +After setting 'buftype' to "prompt" Vim does not automatically start Insert +mode, use `:startinsert` if you want to enter Insert mode, so that the user +can start typing a line. + +The text of the prompt can be set with the |prompt_setprompt()| function. + +The user can go to Normal mode and navigate through the buffer. This can be +useful see older output or copy text. + +Any command that starts Insert mode, such as "a", "i", "A" and "I", will move +the cursor to the last line, after the prompt. + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index f58389af8c..d2c81967d1 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.4. Last change: 2014 Feb 23 +*cmdline.txt* For Vim version 8.1. Last change: 2018 May 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -56,7 +56,7 @@ history tables: These are completely separate. Each history can only be accessed when entering the same type of line. Use the 'history' option to set the number of lines that are remembered -(default: 20). +(default: 50). Notes: - When you enter a command-line that is exactly the same as an older one, the old one is removed (to avoid repeated commands moving older commands out of @@ -101,6 +101,11 @@ CTRL-E or <End> *c_CTRL-E* *c_<End>* *c_End* *c_<LeftMouse>* <LeftMouse> Move the cursor to the position of the mouse click. + *c_<MiddleMouse>* +<MiddleMouse> Paste the contents of the clipboard (for X11 the primary + selection). This is similar to using CTRL-R *, but no CR + characters are inserted between lines. + CTRL-H *c_<BS>* *c_CTRL-H* *c_BS* <BS> Delete the character in front of the cursor (see |:fixdel| if your <BS> key does not do what you want). @@ -170,12 +175,14 @@ CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c_<C-R>_<C-F>* CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *c_<C-R>_<C-P>* CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c_<C-R>_<C-W>* CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>* +CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c_<C-R>_<C-L>* Insert the object under the cursor: CTRL-F the Filename under the cursor CTRL-P the Filename under the cursor, expanded with 'path' as in |gf| CTRL-W the Word under the cursor CTRL-A the WORD under the cursor; see |WORD| + CTRL-L the line under the cursor When 'incsearch' is set the cursor position at the end of the currently displayed match is used. With CTRL-W the part of @@ -187,8 +194,8 @@ CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>* *c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>* *c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>* -CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} -CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} +CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} +CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} Insert register or object under the cursor. Works like |c_CTRL-R| but inserts the text literally. For example, if register a contains "xy^Hz" (where ^H is a backspace), @@ -224,9 +231,10 @@ CTRL-Y When there is a modeless selection, copy the selection into the clipboard. |modeless-selection| If there is no selection CTRL-Y is inserted as a character. -CTRL-J *c_CTRL-J* *c_<NL>* *c_<CR>* *c_CR* +CTRL-M or CTRL-J *c_CTRL-M* *c_CTRL-J* *c_<NL>* *c_<CR>* *c_CR* <CR> or <NL> start entered command - *c_<Esc>* *c_Esc* + +CTRL-[ *c_CTRL-[* *c_<Esc>* *c_Esc* <Esc> When typed and 'x' not present in 'cpoptions', quit Command-line mode without executing. In macros or when 'x' present in 'cpoptions', start entered command. @@ -353,8 +361,11 @@ terminals) List entries 6 to 12 from the search history: > :history / 6,12 < - List the recent five entries from all histories: > - :history all -5, + List the penultimate entry from all histories: > + :history all -2 +< + List the most recent two entries from all histories: > + :history all -2, :keepp[atterns] {command} *:keepp* *:keeppatterns* Execute {command}, without adding anything to the search @@ -401,14 +412,17 @@ CTRL-D List names that match the pattern in front of the cursor. match is inserted. After the last match, the first is used again (wrap around). The behavior can be changed with the 'wildmode' option. + *c_<S-Tab>* +<S-Tab> Like 'wildchar' or <Tab>, but begin with the last match and + then go to the previous match. + <S-Tab> does not work everywhere. *c_CTRL-N* CTRL-N After using 'wildchar' which got multiple matches, go to next match. Otherwise recall more recent command-line from history. -<S-Tab> *c_CTRL-P* *c_<S-Tab>* + *c_CTRL-P* CTRL-P After using 'wildchar' which got multiple matches, go to previous match. Otherwise recall older command-line from - history. <S-Tab> only works with the GUI, on the Amiga and - with MS-DOS. + history. *c_CTRL-A* CTRL-A All names that match the pattern in front of the cursor are inserted. @@ -418,20 +432,41 @@ CTRL-L A match is done on the pattern in front of the cursor. If If there are multiple matches the longest common part is inserted in place of the pattern. If the result is shorter than the pattern, no completion is done. + */_CTRL-L* When 'incsearch' is set, entering a search pattern for "/" or "?" and the current match is displayed then CTRL-L will add one character from the end of the current match. If 'ignorecase' and 'smartcase' are set and the command line has no uppercase characters, the added character is converted to lowercase. + *c_CTRL-G* */_CTRL-G* +CTRL-G When 'incsearch' is set, entering a search pattern for "/" or + "?" and the current match is displayed then CTRL-G will move + to the next match (does not take |search-offset| into account) + Use CTRL-T to move to the previous match. Hint: on a regular + keyboard T is above G. + *c_CTRL-T* */_CTRL-T* +CTRL-T When 'incsearch' is set, entering a search pattern for "/" or + "?" and the current match is displayed then CTRL-T will move + to the previous match (does not take |search-offset| into + account). + Use CTRL-G to move to the next match. Hint: on a regular + keyboard T is above G. The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in a previous version <Esc> was used). In the pattern standard wildcards '*' and '?' are accepted when matching file names. '*' matches any string, '?' matches exactly one character. +When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually +ending up back to what was typed. If the first match is not what you wanted, +you can use <S-Tab> or CTRL-P to go straight back to what you typed. + The 'wildignorecase' option can be set to ignore case in filenames. +The 'wildmenu' option can be set to show the matches just above the command +line. + If you like tcsh's autolist completion, you can use this mapping: :cnoremap X <C-L><C-D> (Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D) @@ -511,6 +546,8 @@ followed by another Vim command: :argdo :autocmd :bufdo + :cdo + :cfdo :command :cscope :debug @@ -521,6 +558,8 @@ followed by another Vim command: :help :helpfind :lcscope + :ldo + :lfdo :make :normal :perl @@ -597,6 +636,7 @@ starts editing the three files "foo bar", "goes to" and "school ". When you want to use the special characters '"' or '|' in a command, or want to use '%' or '#' in a file name, precede them with a backslash. The backslash is not required in a range and in the ":substitute" command. +See also |`=|. *:_!* The '!' (bang) character after an Ex command makes the command behave in a @@ -749,13 +789,13 @@ to insert special things while typing you can use the CTRL-R command. For example, "%" stands for the current file name, while CTRL-R % inserts the current file name right away. See |c_CTRL-R|. -Note: If you want to avoid the special characters in a Vim script you may want -to use |fnameescape()|. +Note: If you want to avoid the effects of special characters in a Vim script +you may want to use |fnameescape()|. Also see |`=|. In Ex commands, at places where a file name can be used, the following characters have a special meaning. These can also be used in the expression -function expand() |expand()|. +function |expand()|. % Is replaced with the current file name. *:_%* *c_%* # Is replaced with the alternate file name. *:_#* *c_#* This is remembered for every window. @@ -790,18 +830,26 @@ it, no matter how many backslashes. # alternate.file \# # \\# \# +Also see |`=|. *:<cword>* *:<cWORD>* *:<cfile>* *<cfile>* *:<sfile>* *<sfile>* *:<afile>* *<afile>* *:<abuf>* *<abuf>* *:<amatch>* *<amatch>* + *:<cexpr>* *<cexpr>* *<slnum>* *E495* *E496* *E497* *E499* *E500* Note: these are typed literally, they are not special keys! <cword> is replaced with the word under the cursor (like |star|) <cWORD> is replaced with the WORD under the cursor (see |WORD|) + <cexpr> is replaced with the word under the cursor, including more + to form a C expression. E.g., when the cursor is on "arg" + of "ptr->arg" then the result is "ptr->arg"; when the + cursor is on "]" of "list[idx]" then the result is + "list[idx]". This is used for |v:beval_text|. <cfile> is replaced with the path name under the cursor (like what |gf| uses) <afile> When executing autocommands, is replaced with the file name - for a file read or write. + of the buffer being manipulated, or the file for a read or + write. <abuf> When executing autocommands, is replaced with the currently effective buffer number (for ":r file" and ":so file" it is the current buffer, the file being read/sourced is not in a @@ -811,13 +859,13 @@ Note: these are typed literally, they are not special keys! <afile> only when the file name isn't used to match with (for FileType, Syntax and SpellFileMissing events). <sfile> When executing a ":source" command, is replaced with the - file name of the sourced file. *E498* - When executing a function, is replaced with - "function {function-name}"; function call nesting is - indicated like this: - "function {function-name1}..{function-name2}". Note that - filename-modifiers are useless when <sfile> is used inside - a function. + file name of the sourced file. *E498* + When executing a function, is replaced with: + "function {function-name}[{lnum}]" + function call nesting is indicated like this: + "function {function-name1}[{lnum}]..{function-name2}[{lnum}]" + Note that filename-modifiers are useless when <sfile> is + used inside a function. <slnum> When executing a ":source" command, is replaced with the line number. *E842* When executing a function it's the line number relative to @@ -880,7 +928,7 @@ These modifiers can be given, in this order: :gs?pat?sub? Substitute all occurrences of "pat" with "sub". Otherwise this works like ":s". - :S Escape special characters for use with a shell command (see + :S Escape special characters for use with a shell command (see |shellescape()|). Must be the last one. Examples: > :!dir <cfile>:S :call system('chmod +w -- ' . expand('%:S')) @@ -933,9 +981,8 @@ name). This is included for backwards compatibility with version 3.0, the Note: Where a file name is expected wildcards expansion is done. On Unix the shell is used for this, unless it can be done internally (for speed). -Backticks also work, like in > +Unless in |restricted-mode|, backticks work also, like in > :n `echo *.c` -(backtick expansion is not possible in |restricted-mode|) But expansion is only done if there are any wildcards before expanding the '%', '#', etc.. This avoids expanding wildcards inside a file name. If you want to expand the result of <cfile>, add a wildcard character to it. @@ -946,6 +993,7 @@ Examples: (alternate file name is "?readme?") :e #.* :e {files matching "?readme?.*"} :cd <cfile> :cd {file name under cursor} :cd <cfile>* :cd {file name under cursor plus "*" and then expanded} +Also see |`=|. When the expanded argument contains a "!" and it is used for a shell command (":!cmd", ":r !cmd" or ":w !cmd"), the "!" is escaped with a backslash to @@ -972,6 +1020,8 @@ for the file "$home" in the root directory. A few examples: /\$home file "$home" in root directory \\$home file "\\", followed by expanded $home +Also see |`=|. + ============================================================================== 7. Command-line window *cmdline-window* *cmdwin* *command-line-window* @@ -1029,10 +1079,10 @@ There are several ways to leave the command-line window: Insert and in Normal mode. CTRL-C Continue in Command-line mode. The command-line under the cursor is used as the command-line. Works both in Insert and - in Normal mode. ":close" also works. There is no redraw, - thus the window will remain visible. + in Normal mode. There is no redraw, thus the window will + remain visible. :quit Discard the command line and go back to Normal mode. - ":exit", ":xit" and CTRL-\ CTRL-N also work. + ":close", ":exit", ":xit" and CTRL-\ CTRL-N also work. :qall Quit Vim, unless there are changes in some buffer. :qall! Quit Vim, discarding changes to any buffer. @@ -1084,6 +1134,9 @@ another window, or drag statuslines of other windows. You can drag the statusline of the command-line window itself and the statusline above it. Thus you can resize the command-line window, but not others. +The |getcmdwintype()| function returns the type of the command-line being +edited as described in |cmdwin-char|. + AUTOCOMMANDS diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index 3226fa4599..6d2cea5d81 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -1,4 +1,4 @@ -*debug.txt* For Vim version 7.4. Last change: 2012 Feb 11 +*debug.txt* For Vim version 8.1. Last change: 2017 Jul 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -53,7 +53,7 @@ Use this command to start Vim: valgrind --log-file=valgrind.log --leak-check=full ./vim Note: Vim will run much slower. If your .vimrc is big or you have several -plugins you need to be patient for startup, or run with the "-u NONE" +plugins you need to be patient for startup, or run with the "--clean" argument. There are often a few leaks from libraries, such as getpwuid() and diff --git a/runtime/doc/debugger.txt b/runtime/doc/debugger.txt index df7116bb2a..9aa2fb8467 100644 --- a/runtime/doc/debugger.txt +++ b/runtime/doc/debugger.txt @@ -1,4 +1,4 @@ -*debugger.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*debugger.txt* For Vim version 8.1. Last change: 2017 Nov 21 VIM REFERENCE MANUAL by Gordon Prieur @@ -95,10 +95,12 @@ list and colors can be set via X resources (XmNballoonEvalFontList, XmNballoonEvalBackground, and XmNballoonEvalForeground). The 'balloondelay' option sets the delay before an attempt is made to show a balloon. -The 'ballooneval' option needs to be set to switch it on. +The 'ballooneval' and/or the 'balloonevalterm' option needs to be set to +switch it on. -Balloon evaluation is only available when compiled with the |+balloon_eval| -feature. +Balloon evaluation is only available in the GUI when compiled with the +|+balloon_eval| feature. For the terminal the |+balloon_eval_term| feature +matters. The Balloon evaluation functions are also used to show a tooltip for the toolbar. The 'ballooneval' option does not need to be set for this. But the diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 6e6feb32d6..20a623f362 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -1,4 +1,4 @@ -*develop.txt* For Vim version 7.4. Last change: 2014 Mar 27 +*develop.txt* For Vim version 8.1. Last change: 2018 May 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -18,7 +18,8 @@ See the file README.txt in the "src" directory for an overview of the source code. Vim is open source software. Everybody is encouraged to contribute to help -improving Vim. For sending patches a context diff "diff -c" is preferred. +improving Vim. For sending patches a unified diff "diff -u" is preferred. +You can create a pull request on github, but it's not required. Also see http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch. ============================================================================== @@ -143,9 +144,10 @@ and its environment. VIM IS... NOT *design-not* -- Vim is not a shell or an Operating System. You will not be able to run a - shell inside Vim or use it to control a debugger. This should work the - other way around: Use Vim as a component from a shell or in an IDE. +- Vim is not a shell or an Operating System. It does provide a terminal + window, in which you can run a shell or debugger. E.g. to be able to do + this over an ssh connection. But if you don't need a text editor with that + it is out of scope (use something like screen or tmux instead). A satirical way to say this: "Unlike Emacs, Vim does not attempt to include everything but the kitchen sink, but some people say that you can clean one with it. ;-)" @@ -166,12 +168,58 @@ This list is not complete. Look in the source code for more examples. MAKING CHANGES *style-changes* The basic steps to make changes to the code: -1. Adjust the documentation. Doing this first gives you an impression of how +1. Get the code from github. That makes it easier to keep your changed + version in sync with the main code base (it may be a while before your + changes will be included). You do need to spend some time learning git, + it's not the most user friendly tool. +2. Adjust the documentation. Doing this first gives you an impression of how your changes affect the user. -2. Make the source code changes. -3. Check ../doc/todo.txt if the change affects any listed item. -4. Make a patch with "diff -c" against the unmodified code and docs. -5. Make a note about what changed and include it with the patch. +3. Make the source code changes. +4. Check ../doc/todo.txt if the change affects any listed item. +5. Make a patch with "git diff". You can also create a pull request on + github, but it's the diff that matters. +6. Make a note about what changed, preferably mentioning the problem and the + solution. Send an email to the |vim-dev| maillist with an explanation and + include the diff. Or create a pull request on github. + + +C COMPILER *style-compiler* *ANSI-C* *C89* *C99* + +The minimal C compiler version supported is C89, also known as ANSI C. +Later standards, such as C99, are not widely supported, or at least not 100% +supported. Therefore we use only some of the C99 features and disallow some +(at least for now). + +Please don't make changes everywhere to use the C99 features, it causes merge +problems for existing patches. Only use them for new and changed code. + +Comments ~ + +Traditionally Vim uses /* comments */. We intend to keep it that way, +especially for file and function headers. For new code or lines of code that +change, it is allowed to use // comments. Especially when it comes after +code: + int some_var; // single line comment useful here + +Enums ~ + +The last item in an enum may have a trailing comma. C89 didn't allow this. + +Types ~ + +"long long" is allowed and can be expected to be 64 bits. Use %lld in printf +formats. Also "long long unsigned" with %llu. + +Not to be used ~ + +These C99 features are not to be used, because not enough compilers support +them: +- Declaration after Statements (MSVC 2012 does not support it). All + declarations need to be at the start of the block. +- Variable length arrays (even in C11 this is an optional feature). +- _Bool and _Complex types. +- "inline" (it's hardly ever needed, let the optimizer do its work) +- flexible array members: Not supported by HP-UX C compiler (John Marriott) USE OF COMMON FUNCTIONS *style-functions* @@ -197,7 +245,7 @@ NAMES *style-names* Function names can not be more than 31 characters long (because of VMS). -Don't use "delete" as a variable name, C++ doesn't like it. +Don't use "delete" or "this" as a variable name, C++ doesn't like it. Because of the requirement that Vim runs on as many systems as possible, we need to avoid using names that are already defined by the system. This is a @@ -288,8 +336,27 @@ OK: do a = 1; while (cond); +Wrong: if (cond) { + cmd; + cmd; + } else { + cmd; + cmd; + } -Functions start with: +OK: if (cond) + { + cmd; + cmd; + } + else + { + cmd; + cmd; + } + +Use ANSI (new style) function declarations with the return type on a separate +indented line. Wrong: int function_name(int arg1, int arg2) @@ -299,16 +366,14 @@ OK: /* * Return value explanation. */ int - function_name(arg1, arg2) - int arg1; /* short comment about arg1 */ - int arg2; /* short comment about arg2 */ + function_name( + int arg1, /* short comment about arg1 */ + int arg2) /* short comment about arg2 */ { int local; /* comment about local */ local = arg1 * arg2; -NOTE: Don't use ANSI style function declarations. A few people still have to -use a compiler that doesn't support it. SPACES AND PUNCTUATION *style-spaces* diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 0ee5878341..e263e6b83e 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,16 +1,16 @@ -*diff.txt* For Vim version 7.4. Last change: 2014 May 20 +*diff.txt* For Vim version 8.1. Last change: 2017 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar *diff* *vimdiff* *gvimdiff* *diff-mode* -This file describes the |+diff| feature: Showing 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. -1. Starting diff mode |vimdiff| +1. Starting diff mode |start-vimdiff| 2. Viewing diffs |view-diffs| 3. Jumping to diffs |jumpto-diffs| 4. Copying diffs |copy-diffs| @@ -19,7 +19,7 @@ The basics are explained in section |08.7| of the user manual. {not in Vi} ============================================================================== -1. Starting diff mode +1. Starting diff mode *start-vimdiff* The easiest way to start editing in diff mode is with the "vimdiff" command. This starts Vim as usual, and additionally sets up for viewing the differences @@ -117,7 +117,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. @@ -131,9 +131,12 @@ file for a moment and come back to the same file and be in diff mode again. related options only happens in a window that has 'diff' set, if the current window does not have 'diff' set then no options in it are changed. + Hidden buffers are also removed from the list of diff'ed + buffers. -The ":diffoff" command resets the relevant options to the values they had when -using |:diffsplit|, |:diffpatch| , |:diffthis|. or starting Vim in diff mode. +The `:diffoff` command resets the relevant options to the values they had when +using `:diffsplit`, `:diffpatch` , `:diffthis`. or starting Vim in diff mode. +When using `:diffoff` twice the last saved values are restored. Otherwise they are set to their default value: 'diff' off @@ -163,7 +166,8 @@ The alignment of text will go wrong when: All the buffers edited in a window where the 'diff' option is set will join in the diff. This is also possible for hidden buffers. They must have been -edited in a window first for this to be possible. +edited in a window first for this to be possible. To get rid of the hidden +buffers use `:diffoff!`. *:DiffOrig* *diff-original-file* Since 'diff' is a window-local option, it's possible to view the same buffer @@ -181,8 +185,8 @@ hidden buffers. You can use ":hide" to close a window without unloading the buffer. If you don't want a buffer to remain used for the diff do ":set nodiff" before hiding it. - *:diffu* *:diffupdate* -:diffu[pdate][!] Update the diff highlighting and folds. + *:dif* *:diffupdate* +:dif[fupdate][!] Update the diff highlighting and folds. Vim attempts to keep the differences updated when you make changes to the text. This mostly takes care of inserted and deleted lines. Changes within a @@ -222,8 +226,8 @@ The diffs are highlighted with these groups: (searching from the end of the line). The text in between is highlighted. This means that parts in the middle that are still the - same are highlighted anyway. Only "iwhite" of - 'diffopt' is used here. + same are highlighted anyway. The 'diffopt' + flags "iwhite" and "icase" are used here. |hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, because they don't really exist in this buffer. @@ -266,13 +270,17 @@ that the buffers will be equal within the specified range. See below for [range]. *do* -do Same as ":diffget" without argument or range. The "o" stands - for "obtain" ("dg" can't be used, it could be the start of - "dgg"!). Note: this doesn't work in Visual mode. +[count]do Same as ":diffget" without range. The "o" stands for "obtain" + ("dg" can't be used, it could be the start of "dgg"!). Note: + this doesn't work in Visual mode. + If you give a [count], it is used as the [bufspec] argument + for ":diffget". *dp* -dp Same as ":diffput" without argument or range. - Note: this doesn't work in Visual mode. +[count]dp Same as ":diffput" without range. Note: this doesn't work in + Visual mode. + If you give a [count], it is used as the [bufspec] argument + for ":diffput". When no [range] is given, the diff at the cursor position or just above it is @@ -310,6 +318,19 @@ name or a part of a buffer name. Examples: Also see |'diffopt'| and the "diff" item of |'fillchars'|. + *diff-slow* *diff_translations* +For very long lines, the diff syntax highlighting might be slow, especially +since it tries to match all different kind of localisations. To disable +localisations and speed up the syntax highlighting, set the global variable +g:diff_translations to zero: > + + let g:diff_translations = 0 +< +After setting this variable, reload the syntax script: > + + set syntax=diff +< + FINDING THE DIFFERENCES *diff-diffexpr* diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index 2be73da5b9..2a232228ed 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -1,4 +1,4 @@ -*digraph.txt* For Vim version 7.4. Last change: 2014 Jun 19 +*digraph.txt* For Vim version 8.1. Last change: 2016 Nov 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -147,7 +147,7 @@ a standard meaning: Two 2 Hook Nine 9 Horn - Equals = Cyrillic (= used as second char) + Equals = Cyrillic (= used as second char) Asterisk * Greek Percent sign % Greek/Cyrillic special Plus + smalls: Arabic, capitals: Hebrew @@ -926,6 +926,7 @@ char digraph hex dec official name ~ † /- 2020 8224 DAGGER ‡ /= 2021 8225 DOUBLE DAGGER ‥ .. 2025 8229 TWO DOT LEADER +… ,. 2026 8230 HORIZONTAL ELLIPSIS ‰ %0 2030 8240 PER MILLE SIGN ′ 1' 2032 8242 PRIME ″ 2' 2033 8243 DOUBLE PRIME diff --git a/runtime/doc/doctags.c b/runtime/doc/doctags.c index 9213dd9c1e..53bf33c1d9 100644 --- a/runtime/doc/doctags.c +++ b/runtime/doc/doctags.c @@ -14,9 +14,7 @@ #define LINELEN 200 int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char line[LINELEN]; char *p1, *p2; diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0b5f69a7b7..e553d467d2 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Jul 19 +*editing.txt* For Vim version 8.1. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -78,7 +78,9 @@ g CTRL-G Prints the current position of the cursor in five than one position on the screen (<Tab> or special character), both the "real" column and the screen column are shown, separated with a dash. - See also 'ruler' option. {not in Vi} + Also see the 'ruler' option and the |wordcount()| + function. + {not in Vi} *v_g_CTRL-G* {Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and @@ -179,7 +181,8 @@ start editing another file, Vim will refuse this. In order to overrule this protection, add a '!' to the command. The changes will then be lost. For example: ":q" will not work if the buffer was changed, but ":q!" will. To see whether the buffer was changed use the "CTRL-G" command. The message includes -the string "[Modified]" if the buffer has been changed. +the string "[Modified]" if the buffer has been changed, or "+" if the 'm' flag +is in 'shortmess'. If you want to automatically save the changes without asking, switch on the 'autowriteall' option. 'autowrite' is the associated Vi-compatible option @@ -273,7 +276,7 @@ If you want to keep the changed buffer without saving it, switch on the *:vie* *:view* :vie[w][!] [++opt] [+cmd] file - When used in Ex mode: Leave |Ex mode|, go back to + When used in Ex mode: Leave |Ex-mode|, go back to Normal mode. Otherwise same as |:edit|, but set 'readonly' option for this buffer. {not in Vi} @@ -304,7 +307,8 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is Mnemonic: "goto file". Uses the 'isfname' option to find out which characters are supposed to be in a file name. Trailing - punctuation characters ".,:;!" are ignored. + punctuation characters ".,:;!" are ignored. Escaped + spaces "\ " are reduced to a single space. Uses the 'path' option as a list of directory names to look for the file. See the 'path' option for details about relative directories and wildcards. @@ -390,7 +394,7 @@ These are the common ones: To avoid the special meaning of the wildcards prepend a backslash. However, on MS-Windows the backslash is a path separator and "path\[abc]" is still seen as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this -is to use "path\[[]abc]". Then the file "path[abc]" literally. +is to use "path\[[]abc]", this matches the file "path\[abc]". *starstar-wildcard* Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems. @@ -400,36 +404,63 @@ Note there are some commands where this works slightly differently, see Example: > :n **/*.txt Finds files: - ttt.txt - subdir/ttt.txt - a/b/c/d/ttt.txt -When non-wildcard characters are used these are only matched in the first -directory. Example: > - :n /usr/inc**/*.h + aaa.txt ~ + subdir/bbb.txt ~ + a/b/c/d/ccc.txt ~ +When non-wildcard characters are used right before or after "**" these are +only matched in the top directory. They are not used for directories further +down in the tree. For example: > + :n /usr/inc**/types.h Finds files: - /usr/include/types.h - /usr/include/sys/types.h - /usr/inc_old/types.h + /usr/include/types.h ~ + /usr/include/sys/types.h ~ + /usr/inc/old/types.h ~ +Note that the path with "/sys" is included because it does not need to match +"/inc". Thus it's like matching "/usr/inc*/*/*...", not +"/usr/inc*/inc*/inc*". + *backtick-expansion* *`-expansion* -On Unix and a few other systems you can also use backticks in the file name, -for example: > - :e `find . -name ver\\*.c -print` -The backslashes before the star are required to prevent "ver*.c" to be -expanded by the shell before executing the find program. +On Unix and a few other systems you can also use backticks for the file name +argument, for example: > + :next `find . -name ver\\*.c -print` + :view `ls -t *.patch \| head -n1` +Vim will run the command in backticks using the 'shell' and use the standard +output as argument for the given Vim command (error messages from the shell +command will be discarded). +To see what shell command Vim is running, set the 'verbose' option to 4. When +the shell command returns a non-zero exit code, an error message will be +displayed and the Vim command will be aborted. To avoid this make the shell +always return zero like so: > + :next `find . -name ver\\*.c -print \|\| true` + +The backslashes before the star are required to prevent the shell from +expanding "ver*.c" prior to execution of the find program. The backslash +before the shell pipe symbol "|" prevents Vim from parsing it as command +termination. This also works for most other systems, with the restriction that the backticks must be around the whole item. It is not possible to have text directly before the first or just after the last backtick. *`=* -You can have the backticks expanded as a Vim expression, instead of an -external command, by using the syntax `={expr}` e.g.: > +You can have the backticks expanded as a Vim expression, instead of as an +external command, by putting an equal sign right after the first backtick, +e.g.: > :e `=tempname()` The expression can contain just about anything, thus this can also be used to avoid the special meaning of '"', '|', '%' and '#'. However, 'wildignore' does apply like to other wildcards. + +Environment variables in the expression are expanded when evaluating the +expression, thus this works: > + :e `=$HOME . '/.vimrc'` +This does not work, $HOME is inside a string and used literally: > + :e `='$HOME' . '/.vimrc'` + If the expression returns a string then names are to be separated with line breaks. When the result is a |List| then each item is used as a name. Line breaks also separate names. +Note that such expressions are only supported in places where a filename is +expected as an argument to an Ex-command. *++opt* *[++opt]* The [++opt] argument can be used to force the value of 'fileformat', @@ -595,21 +626,24 @@ list of the current window. Also see |++opt| and |+cmd|. {Vi: no ++opt} -:[count]arge[dit][!] [++opt] [+cmd] {name} *:arge* *:argedit* - Add {name} to the argument list and edit it. +:[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit* + Add {name}s to the argument list and edit it. When {name} already exists in the argument list, this entry is edited. This is like using |:argadd| and then |:edit|. - Note that only one file name is allowed, and spaces - inside the file name are allowed, like with |:edit|. + Spaces in filenames have to be escaped with "\". [count] is used like with |:argadd|. - [!] is required if the current file cannot be - |abandon|ed. + If the current file cannot be |abandon|ed {name}s will + still be added to the argument list, but won't be + edited. No check for duplicates is done. Also see |++opt| and |+cmd|. {not in Vi} :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* - Add the {name}s to the argument list. +:[count]arga[dd] + Add the {name}s to the argument list. When {name} is + omitted add the current buffer name to the argument + list. If [count] is omitted, the {name}s are added just after the current entry in the argument list. Otherwise they are added after the [count]'th file. @@ -619,12 +653,13 @@ list of the current window. :argadd x a b x c :0argadd x x a b c :1argadd x a x b c - :99argadd x a b c x + :$argadd x a b c x + And after the last one: + :+2argadd y a b c x y There is no check for duplicates, it is possible to add a file to the argument list twice. The currently edited file is not changed. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Note: you can also use this method: > :args ## x < This will add the "x" item and sort the new list. @@ -638,16 +673,22 @@ list of the current window. when it's deleted from the argument list. Example: > :argdel *.obj -< {not in Vi} {not available when compiled without the - |+listcmds| feature} +< {not in Vi} -:{range}argd[elete] Delete the {range} files from the argument list. +:[range]argd[elete] Delete the {range} files from the argument list. + Example: > + :10,$argdel +< Deletes arguments 10 and further, keeping 1-9. > + :$argd +< Deletes just the last one. > + :argd + :.argd +< Deletes the current argument. > + :%argd +< Removes all the files from the arglist. When the last number in the range is too high, up to - the last argument is deleted. Example: > - :10,1000argdel -< Deletes arguments 10 and further, keeping 1-9. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + the last argument is deleted. + {not in Vi} *:argu* *:argument* :[count]argu[ment] [count] [++opt] [+cmd] @@ -656,16 +697,14 @@ list of the current window. when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} :[count]argu[ment]! [count] [++opt] [+cmd] Edit file [count] in the argument list, discard any changes to the current buffer. When [count] is omitted the current entry is used. Also see |++opt| and |+cmd|. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* Edit [count] next file. This fails when changes have @@ -788,7 +827,6 @@ fourth file in the argument list. This happens when you do ":e file". LOCAL ARGUMENT LIST {not in Vi} -{not available when compiled without the |+windows| or |+listcmds| features} *:arglocal* :argl[ocal] Make a local copy of the global argument list. @@ -820,8 +858,9 @@ current window. The two windows then share this list, until one of them uses USING THE ARGUMENT LIST *:argdo* -:argdo[!] {cmd} Execute {cmd} for each file in the argument list. - It works like doing this: > +:[range]argdo[!] {cmd} Execute {cmd} for each file in the argument list or + if [range] is specified only for arguments in that + range. It works like doing this: > :rewind :{cmd} :next @@ -839,9 +878,9 @@ USING THE ARGUMENT LIST autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each file. - {not in Vi} {not available when compiled without the - |+listcmds| feature} - Also see |:windo|, |:tabdo| and |:bufdo|. + {not in Vi} + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Example: > :args *.c @@ -863,7 +902,7 @@ Note: When the 'write' option is off, you are not able to write any file. *:w* *:write* *E502* *E503* *E504* *E505* - *E512* *E514* *E667* *E796* + *E512* *E514* *E667* *E796* *E949* :w[rite] [++opt] Write the whole buffer to the current file. This is the normal way to save changes to a file. It fails when the 'readonly' option is set or when there is @@ -919,6 +958,9 @@ used, for example, when the write fails and you want to try again later with ":w #". This can be switched off by removing the 'A' flag from the 'cpoptions' option. +Note that the 'fsync' option matters here. If it's set it may make writes +slower (but safer). + *:sav* *:saveas* :sav[eas][!] [++opt] {file} Save the current buffer under the name {file} and set @@ -940,12 +982,12 @@ WRITING WITH MULTIPLE BUFFERS *buffer-write* *:wa* *:wall* :wa[ll] Write all changed buffers. Buffers without a file - name or which are readonly are not written. {not in - Vi} + name cause an error message. Buffers which are + readonly are not written. {not in Vi} :wa[ll]! Write all changed buffers, even the ones that are readonly. Buffers without a file name are not - written. {not in Vi} + written and cause an error message. {not in Vi} Vim will warn you if you try to overwrite a file that has been changed @@ -980,7 +1022,7 @@ the newly written file (it might be there but contain bogus data). In that case try recovery, because the swap file is synced to disk and might still be there. |:recover| -The directories given with the 'backupdir' option is used to put the backup +The directories given with the 'backupdir' option are used to put the backup file in. (default: same directory as the written file). Whether the backup is a new file, which is a copy of the original file, or the @@ -1072,14 +1114,20 @@ The names can be in upper- or lowercase. window in the current tab page the current tab page is closed |tab-page|. Triggers the |QuitPre| autocommand event. + See |CTRL-W_q| for quitting another window. :conf[irm] q[uit] Quit, but give prompt when changes have been made, or the last file in the argument list has not been edited. See |:confirm| and 'confirm'. {not in Vi} -:q[uit]! Quit without writing, also when visible buffers have - changes. Does not exit when there are changed hidden - buffers. Use ":qall!" to exit always. +:q[uit]! Quit without writing, also when the current buffer has + changes. The buffer is unloaded, also when it has + 'hidden' set. + If this is the last window and there is a modified + hidden buffer, the current buffer is abandoned and the + first changed hidden buffer becomes the current + buffer. + Use ":qall!" to exit always. :cq[uit] Quit always, without writing, and return an error code. See |:cq|. Used for Manx's QuickFix mode (see @@ -1156,7 +1204,8 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit* :wqa[ll]! [++opt] :xa[ll]! Write all changed buffers, even the ones that are readonly, and exit Vim. If there are buffers without a file name or - which cannot be written for another reason, Vim will not quit. + which cannot be written for another reason, or there is a + terminal with a running job, Vim will not quit. {not in Vi} ============================================================================== @@ -1182,7 +1231,7 @@ Examples: > If you want to always use ":confirm", set the 'confirm' option. - *:browse* *:bro* *E338* *E614* *E615* *E616* *E578* + *:browse* *:bro* *E338* *E614* *E615* *E616* :bro[wse] {command} Open a file selection dialog for an argument to {command}. At present this works for |:e|, |:w|, |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|, @@ -1286,9 +1335,11 @@ present in 'cpoptions' and "!" is not used in the command. :chd[ir][!] [path] Same as |:cd|. *:lc* *:lcd* -:lc[d][!] {path} Like |:cd|, but only set the current directory for the - current window. The current directory for other - windows is not changed. {not in Vi} +:lc[d][!] {path} Like |:cd|, but only set the current directory when + the cursor is in the current window. The current + directory for other windows is not changed, switching + to another window will stop using {path}. + {not in Vi} *:lch* *:lchdir* :lch[dir][!] Same as |:lcd|. {not in Vi} @@ -1346,7 +1397,7 @@ There are a few things to remember when editing binary files: - <Nul> characters are shown on the screen as ^@. You can enter them with "CTRL-V CTRL-@" or "CTRL-V 000" {Vi cannot handle <Nul> characters in the file} -- To insert a <NL> character in the file split up a line. When writing the +- To insert a <NL> character in the file split a line. When writing the buffer to a file a <NL> will be written for the <EOL>. - Vim normally appends an <EOL> at the end of the file if there is none. Setting the 'binary' option prevents this. If you want to add the final @@ -1370,8 +1421,14 @@ lose your work. The undo file can be disabled without much disadvantage. > Note: The text in memory is not encrypted. A system administrator may be able to see your text while you are editing it. When filtering text with -":!filter" or using ":w !command" the text is not encrypted, this may reveal -it to others. The 'viminfo' file is not encrypted. +":!filter" or using ":w !command" the text is also not encrypted, this may +reveal it to others. The 'viminfo' file is not encrypted. + +You could do this to edit very secret text: > + :set noundofile viminfo= + :noswapfile edit secrets.txt +Keep in mind that without a swap file you risk losing your work in the event +of a crash or a power failure. WARNING: If you make a typo when entering the key and then write the file and exit, the text will be lost! @@ -1398,22 +1455,39 @@ To disable the encryption, reset the 'key' option to an empty value: > :set key= You can use the 'cryptmethod' option to select the type of encryption, use one -of these two: > - :setlocal cm=zip " weak method, backwards compatible - :setlocal cm=blowfish " strong method +of these: > + :setlocal cm=zip " weak method, backwards compatible + :setlocal cm=blowfish " method with flaws + :setlocal cm=blowfish2 " medium strong method + Do this before writing the file. When reading an encrypted file it will be set automatically to the method used when that file was written. You can change 'cryptmethod' before writing that file to change the method. -To set the default method, used for new files, use one of these in your -|vimrc| file: > - set cm=zip - set cm=blowfish + +To set the default method, used for new files, use this in your |vimrc| +file: > + set cm=blowfish2 +Using "blowfish2" is highly recommended. Only use another method if you +must use an older Vim version that does not support it. + The message given for reading and writing a file will show "[crypted]" when -using zip, "[blowfish]" when using blowfish. +using zip, "[blowfish]" when using blowfish, etc. When writing an undo file, the same key and method will be used for the text in the undo file. |persistent-undo|. +To test for blowfish support you can use these conditions: > + has('crypt-blowfish') + has('crypt-blowfish2') +This works since Vim 7.4.1099 while blowfish support was added earlier. +Thus the condition failing doesn't mean blowfish is not supported. You can +test for blowfish with: > + v:version >= 703 +And for blowfish2 with: > + v:version > 704 || (v:version == 704 && has('patch401')) +If you are sure Vim includes patch 7.4.237 a simpler check is: > + has('patch-7.4.401') +< *E817* *E818* *E819* *E820* When encryption does not work properly, you would be able to write your text to a file and never be able to read it back. Therefore a test is performed to @@ -1444,7 +1518,7 @@ lines to "/etc/magic", "/usr/share/misc/magic" or wherever your system has the 0 string VimCrypt~ Vim encrypted file >9 string 01 - "zip" cryptmethod >9 string 02 - "blowfish" cryptmethod - + >9 string 03 - "blowfish2" cryptmethod Notes: - Encryption is not possible when doing conversion with 'charconvert'. @@ -1468,6 +1542,10 @@ Notes: - Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no objection to its export. Pkzip's public file APPNOTE.TXT describes this algorithm in detail. +- The implementation of 'cryptmethod' "blowfish" has a flaw. It is possible + to crack the first 64 bytes of a file and in some circumstances more of the + file. Use of it is not recommended, but it's still the strongest method + supported by Vim 7.3 and 7.4. The "zip" method is even weaker. - Vim originates from the Netherlands. That is where the sources come from. Thus the encryption code is not exported from the USA. @@ -1489,6 +1567,13 @@ If you want to automatically reload a file when it has been changed outside of Vim, set the 'autoread' option. This doesn't work at the moment you write the file though, only when the file wasn't changed inside of Vim. +If you do not want to be asked or automatically reload the file, you can use +this: > + set buftype=nofile + +Or, when starting gvim from a shell: > + gvim file.log -c "set buftype=nofile" + Note that if a FileChangedShell autocommand is defined you will not get a warning message or prompt. The autocommand is expected to handle this. @@ -1659,7 +1744,7 @@ There are three different types of searching: This searches the same directories, but in a different order. Note that completion for ":find", ":sfind", and ":tabfind" commands do not - currently work with 'path' items that contain a url or use the double star + currently work with 'path' items that contain a URL or use the double star with depth limiter (/usr/**2) or upward search (;) notations. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a6f1f10929..26b0956b00 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Jul 19 +*eval.txt* For Vim version 8.1. Last change: 2018 May 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -9,7 +9,7 @@ Expression evaluation *expression* *expr* *E15* *eval* Using expressions is introduced in chapter 41 of the user manual |usr_41.txt|. Note: Expression evaluation can be disabled at compile time. If this has been -done, the features in this document are not available. See |+eval| and +done, the features in this document are not available. See |+eval| and |no-eval-feature|. 1. Variables |variables| @@ -29,6 +29,7 @@ done, the features in this document are not available. See |+eval| and 10. No +eval feature |no-eval-feature| 11. The sandbox |eval-sandbox| 12. Textlock |textlock| +13. Testing |testing| {Vi does not have any of these commands} @@ -37,21 +38,21 @@ done, the features in this document are not available. See |+eval| and 1.1 Variable types ~ *E712* -There are six types of variables: +There are nine types of variables: Number A 32 or 64 bit signed number. |expr-number| *Number* - Examples: -123 0x10 0177 + 64-bit Numbers are available only when compiled with the + |+num64| feature. + Examples: -123 0x10 0177 0b1011 Float A floating point number. |floating-point-format| *Float* {only when compiled with the |+float| feature} 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' -Funcref A reference to a function |Funcref|. - Example: function("strlen") - List An ordered sequence of items |List|. Example: [1, 2, ['a', 'b']] @@ -59,6 +60,18 @@ Dictionary An associative, unordered array: Each entry has a key and a value. |Dictionary| Example: {'blue': "#0000ff", 'red': "#ff0000"} +Funcref A reference to a function |Funcref|. + Example: function("strlen") + It can be bound to a dictionary and arguments, it then works + like a Partial. + Example: function("Callback", [arg], myDict) + +Special |v:false|, |v:true|, |v:none| and |v:null|. *Special* + +Job Used for a job, see |job_start()|. *Job* *Jobs* + +Channel Used for a channel, see |ch_open()|. *Channel* *Channels* + The Number and String types are converted automatically, depending on how they are used. @@ -68,14 +81,16 @@ the Number. Examples: Number 0 --> String "0" ~ Number -1 --> String "-1" ~ *octal* -Conversion from a String to a Number is done by converting the first digits -to a number. Hexadecimal "0xf9" and Octal "017" numbers are recognized. If -the String doesn't start with digits, the result is zero. Examples: +Conversion from a String to a Number is done by converting the first digits to +a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are +recognized. If the String doesn't start with digits, the result is zero. +Examples: String "456" --> Number 456 ~ String "6bar" --> Number 6 ~ String "foo" --> Number 0 ~ String "0xf1" --> Number 241 ~ String "0100" --> Number 64 ~ + String "0b101" --> Number 5 ~ String "-8" --> Number -8 ~ String "+8" --> Number 0 ~ @@ -86,36 +101,48 @@ To force conversion from String to Number, add zero to it: > To avoid a leading zero to cause octal conversion, or for using a different base, use |str2nr()|. + *TRUE* *FALSE* For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. +You can also use |v:false| and |v:true|. When TRUE is returned from a +function it is the Number one, FALSE is the number zero. -Note that in the command > +Note that in the command: > :if "foo" -"foo" is converted to 0, which means FALSE. To test for a non-empty string, -use empty(): > + :" NOT executed +"foo" is converted to 0, which means FALSE. If the string starts with a +non-zero number it means TRUE: > + :if "8foo" + :" executed +To test for a non-empty string, use empty(): > :if !empty("foo") -< *E745* *E728* *E703* *E729* *E730* *E731* -List, Dictionary and Funcref types are not automatically converted. +< + *non-zero-arg* +Function arguments often behave slightly different from |TRUE|: If the +argument is present and it evaluates to a non-zero Number, |v:true| or a +non-empty String, then the value is considered to be TRUE. +Note that " " and "0" are also non-empty strings, thus considered to be TRUE. +A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE. + + *E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910* *E913* +List, Dictionary, Funcref, Job and Channel types are not automatically +converted. *E805* *E806* *E808* -When mixing Number and Float the Number is converted to Float. Otherwise +When mixing Number and Float the Number is converted to Float. Otherwise there is no automatic conversion of Float. You can use str2float() for String to Float, printf() for Float to String and float2nr() for Float to Number. - *E706* *sticky-type-checking* -You will get an error if you try to change the type of a variable. You need -to |:unlet| it first to avoid this error. String and Number are considered -equivalent though, as well are Float and Number. Consider this sequence of -commands: > - :let l = "string" - :let l = 44 " changes type from String to Number - :let l = [1, 2, 3] " error! l is still a Number - :let l = 4.4 " changes type from Number to Float - :let l = "string" " error! + *E891* *E892* *E893* *E894* *E907* *E911* *E914* +When expecting a Float a Number can also be used, but nothing else. + + *no-type-checking* +You will not get an error if you try to change the type of a variable. 1.2 Function references ~ *Funcref* *E695* *E718* -A Funcref variable is obtained with the |function()| function. It can be used +A Funcref variable is obtained with the |function()| function, the |funcref()| +function or created with the lambda expression |expr-lambda|. It can be used in an expression in the place of a function name, before the parenthesis around the arguments, to invoke the function it refers to. Example: > @@ -145,12 +172,49 @@ The name of the referenced function can be obtained with |string()|. > You can use |call()| to invoke a Funcref and use a list variable for the arguments: > :let r = call(Fn, mylist) +< + *Partial* +A Funcref optionally binds a Dictionary and/or arguments. This is also called +a Partial. This is created by passing the Dictionary and/or arguments to +function() or funcref(). When calling the function the Dictionary and/or +arguments will be passed to the function. Example: > + + let Cb = function('Callback', ['foo'], myDict) + call Cb() + +This will invoke the function as if using: > + call myDict.Callback('foo') + +This is very useful when passing a function around, e.g. in the arguments of +|ch_open()|. + +Note that binding a function to a Dictionary also happens when the function is +a member of the Dictionary: > + + let myDict.myFunction = MyFunction + call myDict.myFunction() + +Here MyFunction() will get myDict passed as "self". This happens when the +"myFunction" member is accessed. When making assigning "myFunction" to +otherDict and calling it, it will be bound to otherDict: > + + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +Now "self" will be "otherDict". But when the dictionary was bound explicitly +this won't happen: > + + let myDict.myFunction = function(MyFunction, myDict) + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +Here "self" will be "myDict", because it was bound explicitly. 1.3 Lists ~ *list* *List* *Lists* *E686* A List is an ordered sequence of items. An item can be of any type. Items -can be accessed by their index number. Items can be added and removed at any +can be accessed by their index number. Items can be added and removed at any position in the sequence. @@ -161,7 +225,7 @@ Examples: > :let mylist = [1, two, 3, "four"] :let emptylist = [] -An item can be any expression. Using a List for an item creates a +An item can be any expression. Using a List for an item creates a List of Lists: > :let nestlist = [[11, 12], [21, 22], [31, 32]] @@ -199,7 +263,7 @@ it. To change a list in-place see |list-modification| below. Sublist ~ - + *sublist* A part of the List can be obtained by specifying the first and last index, separated by a colon in square brackets: > :let shortlist = mylist[2:-1] " get List [3, "four"] @@ -220,7 +284,7 @@ length minus one is used: > :echo mylist[2:8] " result: [2, 3] NOTE: mylist[s:e] means using the variable "s:e" as index. Watch out for -using a single letter variable before the ":". Insert a space when needed: +using a single letter variable before the ":". Insert a space when needed: mylist[s : e]. @@ -346,14 +410,10 @@ This works like: > : let index = index + 1 :endwhile -Note that all items in the list should be of the same type, otherwise this -results in error |E706|. To avoid this |:unlet| the variable at the end of -the loop. - If all you want to do is modify each item in the list then the |map()| function will be a simpler method than a for loop. -Just like the |:let| command, |:for| also accepts a list of variables. This +Just like the |:let| command, |:for| also accepts a list of variables. This requires the argument to be a list of lists. > :for [lnum, col] in [[1, 3], [2, 8], [3, 0]] : call Doit(lnum, col) @@ -410,10 +470,11 @@ only appear once. Examples: > < *E713* *E716* *E717* A key is always a String. You can use a Number, it will be converted to a String automatically. Thus the String '4' and the number 4 will find the same -entry. Note that the String '04' and the Number 04 are different, since the -Number will be converted to the String '4'. +entry. Note that the String '04' and the Number 04 are different, since the +Number will be converted to the String '4'. The empty string can be used as a +key. -A value can be any expression. Using a Dictionary for a value creates a +A value can be any expression. Using a Dictionary for a value creates a nested Dictionary: > :let nestdict = {1: {11: 'a', 12: 'b'}, 2: {21: 'c'}} @@ -440,7 +501,7 @@ key lookup can be repeated: > Dictionary to List conversion ~ -You may want to loop over the entries in a dictionary. For this you need to +You may want to loop over the entries in a dictionary. For this you need to turn the Dictionary into a List and pass it to |:for|. Most often you want to loop over the keys, using the |keys()| function: > @@ -507,7 +568,7 @@ This removes all entries from "dict" with a value not matching 'x'. Dictionary function ~ *Dictionary-function* *self* *E725* *E862* When a function is defined with the "dict" attribute it can be used in a -special way with a dictionary. Example: > +special way with a dictionary. Example: > :function Mylen() dict : return len(self.data) :endfunction @@ -525,13 +586,13 @@ Funcref to a Dictionary, but the "self" variable is not available then. To avoid the extra name for the function it can be defined and directly assigned to a Dictionary in this way: > :let mydict = {'data': [0, 1, 2, 3]} - :function mydict.len() dict + :function mydict.len() : return len(self.data) :endfunction :echo mydict.len() The function will then get a number and the value of dict.len is a |Funcref| -that references this function. The function can only be used through a +that references this function. The function can only be used through a |Funcref|. It will automatically be deleted when there is no |Funcref| remaining that refers to it. @@ -582,13 +643,17 @@ It's possible to form a variable name with curly braces, see Expression syntax summary, from least to most significant: -|expr1| expr2 ? expr1 : expr1 if-then-else +|expr1| expr2 + expr2 ? expr1 : expr1 if-then-else -|expr2| expr3 || expr3 .. logical OR +|expr2| expr3 + expr3 || expr3 .. logical OR -|expr3| expr4 && expr4 .. logical AND +|expr3| expr4 + expr4 && expr4 .. logical AND -|expr4| expr5 == expr5 equal +|expr4| expr5 + expr5 == expr5 equal expr5 != expr5 not equal expr5 > expr5 greater than expr5 >= expr5 greater than or equal @@ -605,24 +670,28 @@ Expression syntax summary, from least to most significant: expr5 is expr5 same |List| instance expr5 isnot expr5 different |List| instance -|expr5| expr6 + expr6 .. number addition or list concatenation +|expr5| expr6 + expr6 + expr6 .. number addition or list concatenation expr6 - expr6 .. number subtraction expr6 . expr6 .. string concatenation -|expr6| expr7 * expr7 .. number multiplication +|expr6| expr7 + expr7 * expr7 .. number multiplication expr7 / expr7 .. number division expr7 % expr7 .. number modulo -|expr7| ! expr7 logical NOT +|expr7| expr8 + ! expr7 logical NOT - expr7 unary minus + expr7 unary plus -|expr8| expr8[expr1] byte of a String or item of a |List| +|expr8| expr9 + expr8[expr1] byte of a String or item of a |List| expr8[expr1 : expr1] substring of a String or sublist of a |List| expr8.name entry in a |Dictionary| expr8(expr1, ...) function call with |Funcref| variable -|expr9| number number constant +|expr9| number number constant "string" string constant, backslash is special 'string' string constant, ' is doubled [expr1, ...] |List| @@ -635,6 +704,7 @@ Expression syntax summary, from least to most significant: @r contents of register 'r' function(expr1, ...) function call func{ti}on(expr1, ...) function call with curly braces + {args -> expr1} lambda expression ".." indicates that the operations in this level can be concatenated. @@ -650,7 +720,7 @@ expr1 *expr1* *E109* expr2 ? expr1 : expr1 The expression before the '?' is evaluated to a number. If it evaluates to -non-zero, the result is the value of the expression between the '?' and ':', +|TRUE|, the result is the value of the expression between the '?' and ':', otherwise the result is the value of the expression after the ':'. Example: > :echo lnum == 1 ? "top" : lnum @@ -674,16 +744,18 @@ use in a variable such as "a:1". expr2 and expr3 *expr2* *expr3* --------------- - *expr-barbar* *expr-&&* +expr3 || expr3 .. logical OR *expr-barbar* +expr4 && expr4 .. logical AND *expr-&&* + The "||" and "&&" operators take one argument on each side. The arguments are (converted to) Numbers. The result is: - input output ~ -n1 n2 n1 || n2 n1 && n2 ~ -zero zero zero zero -zero non-zero non-zero zero -non-zero zero non-zero zero -non-zero non-zero non-zero non-zero + input output ~ +n1 n2 n1 || n2 n1 && n2 ~ +|FALSE| |FALSE| |FALSE| |FALSE| +|FALSE| |TRUE| |TRUE| |FALSE| +|TRUE| |FALSE| |TRUE| |FALSE| +|TRUE| |TRUE| |TRUE| |TRUE| The operators can be concatenated, for example: > @@ -699,8 +771,8 @@ arguments are not evaluated. This is like what happens in C. For example: > let a = 1 echo a || b -This is valid even if there is no variable called "b" because "a" is non-zero, -so the result must be non-zero. Similarly below: > +This is valid even if there is no variable called "b" because "a" is |TRUE|, +so the result must be |TRUE|. Similarly below: > echo exists("b") && b == "yes" @@ -742,31 +814,50 @@ Examples: "abc" == "Abc" evaluates to 1 if 'ignorecase' is set, 0 otherwise *E691* *E692* -A |List| can only be compared with a |List| and only "equal", "not equal" and -"is" can be used. This compares the values of the list, recursively. -Ignoring case means case is ignored when comparing item values. +A |List| can only be compared with a |List| and only "equal", "not equal", +"is" and "isnot" can be used. This compares the values of the list, +recursively. Ignoring case means case is ignored when comparing item values. *E735* *E736* A |Dictionary| can only be compared with a |Dictionary| and only "equal", "not -equal" and "is" can be used. This compares the key/values of the |Dictionary| -recursively. Ignoring case means case is ignored when comparing item values. - - *E693* *E694* -A |Funcref| can only be compared with a |Funcref| and only "equal" and "not -equal" can be used. Case is never ignored. +equal", "is" and "isnot" can be used. This compares the key/values of the +|Dictionary| recursively. Ignoring case means case is ignored when comparing +item values. + + *E694* +A |Funcref| can only be compared with a |Funcref| and only "equal", "not +equal", "is" and "isnot" can be used. Case is never ignored. Whether +arguments or a Dictionary are bound (with a partial) matters. The +Dictionaries must also be equal (or the same, in case of "is") and the +arguments must be equal (or the same). + +To compare Funcrefs to see if they refer to the same function, ignoring bound +Dictionary and arguments, use |get()| to get the function name: > + if get(Part1, 'name') == get(Part2, 'name') + " Part1 and Part2 refer to the same function When using "is" or "isnot" with a |List| or a |Dictionary| this checks if the expressions are referring to the same |List| or |Dictionary| instance. A copy of a |List| is different from the original |List|. When using "is" without a |List| or a |Dictionary| it is equivalent to using "equal", using "isnot" equivalent to using "not equal". Except that a different type means the -values are different: "4 == '4'" is true, "4 is '4'" is false and "0 is []" is -false and not an error. "is#"/"isnot#" and "is?"/"isnot?" can be used to match -and ignore case. +values are different: > + echo 4 == '4' + 1 + echo 4 is '4' + 0 + echo 0 is [] + 0 +"is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case. When comparing a String with a Number, the String is converted to a Number, -and the comparison is done on Numbers. This means that "0 == 'x'" is TRUE, -because 'x' converted to a Number is zero. +and the comparison is done on Numbers. This means that: > + echo 0 == 'x' + 1 +because 'x' converted to a Number is zero. However: > + echo [0] == ['x'] + 0 +Inside a List or Dictionary this conversion is not used. When comparing two Strings, this is done with strcmp() or stricmp(). This results in the mathematical difference (comparing byte values), not @@ -831,6 +922,11 @@ When dividing a Number by zero the result depends on the value: <0 / 0 = -0x7fffffff (like negative infinity) (before Vim 7.2 it was always 0x7fffffff) +When 64-bit Number support is enabled: + 0 / 0 = -0x8000000000000000 (like NaN for Float) + >0 / 0 = 0x7fffffffffffffff (like positive infinity) + <0 / 0 = -0x7fffffffffffffff (like negative infinity) + When the righthand side of '%' is zero, the result is 0. None of these work for |Funcref|s. @@ -844,13 +940,13 @@ expr7 *expr7* - expr7 unary minus *expr-unary--* + expr7 unary plus *expr-unary-+* -For '!' non-zero becomes zero, zero becomes one. +For '!' |TRUE| becomes |FALSE|, |FALSE| becomes |TRUE| (one). For '-' the sign of the number is changed. For '+' the number is unchanged. A String will be converted to a Number first. -These three can be repeated and mixed. Examples: +These three can be repeated and mixed. Examples: !-1 == 0 !!8 == 1 --9 == 9 @@ -859,24 +955,24 @@ These three can be repeated and mixed. Examples: expr8 *expr8* ----- expr8[expr1] item of String or |List| *expr-[]* *E111* - + *E909* *subscript* If expr8 is a Number or String this results in a String that contains the expr1'th single byte from expr8. expr8 is used as a String, expr1 as a -Number. This doesn't recognize multi-byte encodings, see |byteidx()| for -an alternative. +Number. This doesn't recognize multi-byte encodings, see `byteidx()` for +an alternative, or use `split()` to turn the string into a list of characters. -Index zero gives the first character. This is like it works in C. Careful: -text column numbers start with one! Example, to get the character under the +Index zero gives the first byte. This is like it works in C. Careful: +text column numbers start with one! Example, to get the byte under the cursor: > :let c = getline(".")[col(".") - 1] If the length of the String is less than the index, the result is an empty -String. A negative index always results in an empty string (reason: backwards +String. A negative index always results in an empty string (reason: backward compatibility). Use [-1:] to get the last byte. If expr8 is a |List| then it results the item at index expr1. See |list-index| for possible index values. If the index is out of range this results in an -error. Example: > +error. Example: > :let item = mylist[-1] " get last item Generally, if a |List| index is equal to or higher than the length of the @@ -906,10 +1002,10 @@ Examples: > :let s = line(".")[4:] " from the fifth byte to the end :let s = s[:-3] " remove last two bytes < - *sublist* *slice* + *slice* If expr8 is a |List| this results in a new |List| with the items indicated by -the indexes expr1a and expr1b. This works like with a String, as explained -just above, except that indexes out of range cause an error. Examples: > +the indexes expr1a and expr1b. This works like with a String, as explained +just above. Also see |sublist| below. Examples: > :let l = mylist[:3] " first four items :let l = mylist[4:4] " List with one item :let l = mylist[:] " shallow copy of a List @@ -917,6 +1013,11 @@ just above, except that indexes out of range cause an error. Examples: > Using expr8[expr1] or expr8[expr1a : expr1b] on a |Funcref| results in an error. +Watch out for confusion between a namespace and a variable followed by a colon +for a sublist: > + mylist[n:] " uses variable n + mylist[s:] " uses namespace s:, error! + expr8.name entry in a |Dictionary| *expr-entry* @@ -947,22 +1048,23 @@ When expr8 is a |Funcref| type variable, invoke the function it refers to. *expr9* number ------ -number number constant *expr-number* - *hex-number* *octal-number* +number number constant *expr-number* + *hex-number* *octal-number* *binary-number* -Decimal, Hexadecimal (starting with 0x or 0X), or Octal (starting with 0). +Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B) +and Octal (starting with 0). *floating-point-format* Floating point numbers can be written in two forms: [-+]{N}.{M} - [-+]{N}.{M}e[-+]{exp} + [-+]{N}.{M}[eE][-+]{exp} {N} and {M} are numbers. Both {N} and {M} must be present and can only contain digits. [-+] means there is an optional plus or minus sign. {exp} is the exponent, power of 10. -Only a decimal point is accepted, not a comma. No matter what the current +Only a decimal point is accepted, not a comma. No matter what the current locale is. {only when compiled with the |+float| feature} @@ -1005,7 +1107,7 @@ function. Example: > -string *string* *expr-string* *E114* +string *string* *String* *expr-string* *E114* ------ "string" string constant *expr-quote* @@ -1021,7 +1123,7 @@ A string constant accepts these special characters: \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.... same as \u.... +\U.... same as \u but allows up to 8 hex numbers. \b backspace <BS> \e escape <Esc> \f formfeed <FF> @@ -1031,8 +1133,10 @@ A string constant accepts these special characters: \\ backslash \" double quote \<xxx> Special key named "xxx". e.g. "\<C-W>" for CTRL-W. This is for use - in mappings, the 0x80 byte is escaped. Don't use <Char-xxxx> to get a - utf-8 character, use \uxxxx as mentioned above. + in mappings, the 0x80 byte is escaped. + To use the double quote character it must be escaped: "<M-\">". + Don't use <Char-xxxx> to get a 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 @@ -1047,11 +1151,11 @@ literal-string *literal-string* *E115* Note that single quotes are used. -This string is taken as it is. No backslashes are removed or have a special +This string is taken as it is. No backslashes are removed or have a special meaning. The only exception is that two quotes stand for one quote. Single quoted strings are useful for patterns, so that backslashes do not need -to be doubled. These two commands are equivalent: > +to be doubled. These two commands are equivalent: > if a =~ "\\s*" if a =~ '\s*' @@ -1077,7 +1181,7 @@ register *expr-register* *@r* The result is the contents of the named register, as a single string. Newlines are inserted where required. To get the contents of the unnamed -register use @" or @@. See |registers| for an explanation of the available +register use @" or @@. See |registers| for an explanation of the available registers. When using the '=' register you get the expression itself, not what it @@ -1102,9 +1206,9 @@ are known inside the current Vim session. Using expand() will first try using the environment variables known inside the current Vim session. If that fails, a shell will be used to expand the variable. This can be slow, but it does expand all variables that the shell knows about. Example: > - :echo $version - :echo expand("$version") -The first one probably doesn't echo anything, the second echoes the $version + :echo $shell + :echo expand("$shell") +The first one probably doesn't echo anything, the second echoes the $shell variable (if your shell supports it). @@ -1120,6 +1224,66 @@ function(expr1, ...) function call See below |functions|. +lambda expression *expr-lambda* *lambda* +----------------- +{args -> expr1} lambda expression + +A lambda expression creates a new unnamed function which returns the result of +evaluating |expr1|. Lambda expressions differ from |user-functions| in +the following ways: + +1. The body of the lambda expression is an |expr1| and not a sequence of |Ex| + commands. +2. The prefix "a:" should not be used for arguments. E.g.: > + :let F = {arg1, arg2 -> arg1 - arg2} + :echo F(5, 2) +< 3 + +The arguments are optional. Example: > + :let F = {-> 'error function'} + :echo F() +< error function + *closure* +Lambda expressions can access outer scope variables and arguments. This is +often called a closure. Example where "i" and "a:arg" are used in a lambda +while they already exist in the function scope. They remain valid even after +the function returns: > + :function Foo(arg) + : let i = 3 + : return {x -> x + i - a:arg} + :endfunction + :let Bar = Foo(4) + :echo Bar(6) +< 5 + +Note that the variables must exist in the outer scope before the lamba is +defined for this to work. See also |:func-closure|. + +Lambda and closure support can be checked with: > + if has('lambda') + +Examples for using a lambda expression with |sort()|, |map()| and |filter()|: > + :echo map([1, 2, 3], {idx, val -> val + 1}) +< [2, 3, 4] > + :echo sort([3,7,2,1,4], {a, b -> a - b}) +< [1, 2, 3, 4, 7] + +The lambda expression is also useful for Channel, Job and timer: > + :let timer = timer_start(500, + \ {-> execute("echo 'Handler called'", "")}, + \ {'repeat': 3}) +< Handler called + Handler called + Handler called + +Note how execute() is used to execute an Ex command. That's ugly though. + + +Lambda expressions have internal names like '<lambda>42'. If you get an error +for a lambda expression, you can find what it is with the following command: > + :function {'<lambda>42'} +See also: |numbered-function| + ============================================================================== 3. Internal variable *internal-variables* *E461* @@ -1168,7 +1332,8 @@ b:changedtick The total number of changes to the current buffer. It is : let my_changedtick = b:changedtick : call My_Update() :endif -< +< You cannot change or delete the b:changedtick variable. + *window-variable* *w:var* *w:* A variable name that is preceded with "w:" is local to the current window. It is deleted when the window is closed. @@ -1180,7 +1345,7 @@ without the |+windows| feature} *global-variable* *g:var* *g:* Inside functions global variables are accessed with "g:". Omitting this will -access a variable local to a function. But "g:" can also be used in any other +access a variable local to a function. But "g:" can also be used in any other place if you like. *local-variable* *l:var* *l:* @@ -1287,7 +1452,7 @@ v:beval_text The text under or after the mouse pointer. Usually a word as but a dot and "->" before the position is included. When on a ']' the text before it is used, including the matching '[' and word before it. When on a Visual area within one line the - highlighted text is used. + highlighted text is used. Also see |<cexpr>|. Only valid while evaluating the 'balloonexpr' option. *v:beval_winnr* *beval_winnr-variable* @@ -1296,6 +1461,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>|. @@ -1318,7 +1487,7 @@ v:cmdarg This variable is used for two purposes: set before an autocommand event for a file read/write command is triggered. There is a leading space to make it possible to append this variable directly after the - read/write command. Note: The "+cmd" argument isn't + read/write command. Note: The "+cmd" argument isn't included here, because it will be executed anyway. 2. When printing a PostScript file with ":hardcopy" this is the argument for the ":hardcopy" command. This can be used @@ -1330,9 +1499,15 @@ v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" can only be used in autocommands. For user commands |<bang>| can be used. + *v:completed_item* *completed_item-variable* +v:completed_item + |Dictionary| containing the |complete-items| for the most + recently completed word after |CompleteDone|. The + |Dictionary| is empty if the completion failed. + *v:count* *count-variable* v:count The count given for the last Normal mode command. Can be used - to get the count before a mapping. Read-only. Example: > + to get the count before a mapping. Read-only. Example: > :map _x :<C-U>echo "the count is " . v:count<CR> < Note: The <C-U> is required to remove the line range that you get when typing ':' after a count. @@ -1355,7 +1530,7 @@ v:ctype The current locale setting for characters of the runtime See |multi-lang|. *v:dying* *dying-variable* -v:dying Normally zero. When a deadly signal is caught it's set to +v:dying Normally zero. When a deadly signal is caught it's set to one. When multiple signals are caught the number increases. Can be used in an autocommand to check if Vim didn't terminate normally. {only works on Unix} @@ -1373,6 +1548,23 @@ v:errmsg Last given error message. It's allowed to set this variable. : ... handle error < "errmsg" also works, for backwards compatibility. + *v:errors* *errors-variable* *assert-return* +v:errors Errors found by assert functions, such as |assert_true()|. + This is a list of strings. + The assert functions append an item when an assert fails. + The return value indicates this: a one is returned if an item + was added to v:errors, otherwise zero is returned. + To remove old results make it empty: > + :let v:errors = [] +< If v:errors is set to anything but a list it is made an empty + list by the assert function. + + *v:event* *event-variable* +v:event Dictionary containing information about the current + |autocommand|. The dictionary is emptied when the |autocommand| + finishes, please refer to |dict-identity| for how to get an + independent copy of it. + *v:exception* *exception-variable* v:exception The value of the exception most recently caught and not finished. See also |v:throwpoint| and |throw-variables|. @@ -1384,6 +1576,15 @@ v:exception The value of the exception most recently caught and not :endtry < Output: "caught oops". + *v:false* *false-variable* +v:false A Number with value zero. Used to put "false" in JSON. See + |json_encode()|. + When used as a string this evaluates to "v:false". > + echo v:false +< v:false ~ + That is so that eval() can parse the string back to the same + value. Read-only. + *v:fcs_reason* *fcs_reason-variable* v:fcs_reason The reason why the |FileChangedShell| event was triggered. Can be used in an autocommand to decide what to do and/or what @@ -1427,7 +1628,7 @@ v:fname_out The name of the output file. Only valid while 'diffexpr' output of diff 'patchexpr' resulting patched file (*) When doing conversion for a write command (e.g., ":w - file") it will be equal to v:fname_in. When doing conversion + file") it will be equal to v:fname_in. When doing conversion for a read command (e.g., ":e file") it will be a temporary file and different from v:fname_in. @@ -1457,12 +1658,14 @@ v:foldstart Used for 'foldtext': first line of closed fold. Read-only in the |sandbox|. |fold-foldtext| *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that determines whether search highlighting is on. - Makes sense only if 'hlsearch' is enabled which requires - |+extra_search|. Setting this variable to zero acts the like - |:nohlsearch| command, setting it to one acts like > +v:hlsearch Variable that indicates whether search highlighting is on. + Setting it makes sense only if 'hlsearch' is enabled which + requires |+extra_search|. Setting this variable to zero acts + like the |:nohlsearch| command, setting it to one acts like > let &hlsearch = &hlsearch -< +< Note that the value is restored when returning from a + function. |function-search-undo|. + *v:insertmode* *insertmode-variable* v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand events. Values: @@ -1505,6 +1708,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 @@ -1515,6 +1722,26 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|. This is the screen column number, like with |virtcol()|. The value is zero when there was no mouse button click. + *v:none* *none-variable* +v:none An empty String. Used to put an empty item in JSON. See + |json_encode()|. + When used as a number this evaluates to zero. + When used as a string this evaluates to "v:none". > + echo v:none +< v:none ~ + That is so that eval() can parse the string back to the same + value. Read-only. + + *v:null* *null-variable* +v:null An empty String. Used to put "null" in JSON. See + |json_encode()|. + When used as a number this evaluates to zero. + When used as a string this evaluates to "v:null". > + echo v:null +< v:null ~ + That is so that eval() can parse the string back to the same + value. Read-only. + *v:oldfiles* *oldfiles-variable* v:oldfiles List of file names that is loaded from the |viminfo| file on startup. These are the files that Vim remembers marks for. @@ -1527,6 +1754,15 @@ v:oldfiles List of file names that is loaded from the |viminfo| file on than String this will cause trouble. {only when compiled with the |+viminfo| feature} + *v:option_new* +v:option_new New value of the option. Valid while executing an |OptionSet| + autocommand. + *v:option_old* +v:option_old Old value of the option. Valid while executing an |OptionSet| + autocommand. + *v:option_type* +v:option_type Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" *v:operator* *operator-variable* v:operator The last operator given in Normal mode. This is a single character except for commands starting with <g> or <z>, @@ -1549,7 +1785,7 @@ v:prevcount The count given for the last but one Normal mode command. < Read-only. *v:profiling* *profiling-variable* -v:profiling Normally zero. Set to one after using ":profile start". +v:profiling Normally zero. Set to one after using ":profile start". See |profiling|. *v:progname* *progname-variable* @@ -1564,8 +1800,11 @@ v:progpath Contains the command with which Vim was invoked, including the |--remote-expr|. To get the full path use: > echo exepath(v:progpath) -< NOTE: This does not work when the command is a relative path - and the current directory has changed. +< If the path is relative it will be expanded to the full path, + so that it still works after `:cd`. Thus starting "./vim" + results in "/home/user/path/to/vim/src/vim". + On MS-Windows the executable may be called "vim.exe", but the + ".exe" is not added to v:progpath. Read-only. *v:register* *register-variable* @@ -1587,10 +1826,10 @@ v:scrollstart String describing the script or function that caused the hit-enter prompt. *v:servername* *servername-variable* -v:servername The resulting registered |x11-clientserver| name if any. +v:servername The resulting registered |client-server-name| if any. Read-only. - + v:searchforward *v:searchforward* *searchforward-variable* Search direction: 1 after a forward search, 0 after a backward search. It is reset to forward when directly setting @@ -1628,20 +1867,41 @@ v:swapchoice |SwapExists| autocommands can set this to the selected choice 'd' Delete swapfile 'q' Quit 'a' Abort - The value should be a single-character string. An empty value + The value should be a single-character string. An empty value results in the user being asked, as would happen when there is no SwapExists autocommand. The default is empty. *v:swapcommand* *swapcommand-variable* v:swapcommand Normal mode command to be executed after a file has been opened. Can be used for a |SwapExists| autocommand to have - another Vim open the file and jump to the right place. For + another Vim open the file and jump to the right place. For example, when jumping to a tag the value is ":tag tagname\r". For ":edit +cmd file" the value is ":cmd\r". + *v:t_TYPE* *v:t_bool* *t_bool-variable* +v:t_bool Value of Boolean type. Read-only. See: |type()| + *v:t_channel* *t_channel-variable* +v:t_channel Value of Channel type. Read-only. See: |type()| + *v:t_dict* *t_dict-variable* +v:t_dict Value of Dictionary type. Read-only. See: |type()| + *v:t_float* *t_float-variable* +v:t_float Value of Float type. Read-only. See: |type()| + *v:t_func* *t_func-variable* +v:t_func Value of Funcref type. Read-only. See: |type()| + *v:t_job* *t_job-variable* +v:t_job Value of Job type. Read-only. See: |type()| + *v:t_list* *t_list-variable* +v:t_list Value of List type. Read-only. See: |type()| + *v:t_none* *t_none-variable* +v:t_none Value of None type. Read-only. See: |type()| + *v:t_number* *t_number-variable* +v:t_number Value of Number type. Read-only. See: |type()| + *v:t_string* *t_string-variable* +v:t_string Value of String type. Read-only. See: |type()| + *v:termresponse* *termresponse-variable* v:termresponse The escape sequence returned by the terminal for the |t_RV| - termcap entry. It is set when Vim receives an escape sequence + termcap entry. It is set when Vim receives an escape sequence that starts with ESC [ or CSI and ends in a 'c', with only digits, ';' and '.' in between. When this option is set, the TermResponse autocommand event is @@ -1653,6 +1913,36 @@ v:termresponse The escape sequence returned by the terminal for the |t_RV| always 95 or bigger). Pc is always zero. {only when compiled with |+termresponse| feature} + *v:termblinkresp* +v:termblinkresp The escape sequence returned by the terminal for the |t_RC| + termcap entry. This is used to find out whether the terminal + cursor is blinking. This is used by |term_getcursor()|. + + *v:termstyleresp* +v:termstyleresp The escape sequence returned by the terminal for the |t_RS| + termcap entry. This is used to find out what the shape of the + cursor is. This is used by |term_getcursor()|. + + *v:termrbgresp* +v:termrbgresp The escape sequence returned by the terminal for the |t_RB| + termcap entry. This is used to find out what the terminal + background color is, see 'background'. + + *v:termrfgresp* +v:termrfgresp The escape sequence returned by the terminal for the |t_RF| + termcap entry. This is used to find out what the terminal + foreground color is. + + *v:termu7resp* +v:termu7resp The escape sequence returned by the terminal for the |t_u7| + termcap entry. This is used to find out what the terminal + does with ambiguous width characters, see 'ambiwidth'. + + *v:testing* *testing-variable* +v:testing Must be set before using `test_garbagecollect_now()`. + Also, when set certain error messages won't be shown for 2 + seconds. (e.g. "'dictionary' option is empty") + *v:this_session* *this_session-variable* v:this_session Full filename of the last loaded or saved session file. See |:mksession|. It is allowed to set this variable. When no @@ -1661,7 +1951,7 @@ v:this_session Full filename of the last loaded or saved session file. See *v:throwpoint* *throwpoint-variable* v:throwpoint The point where the exception most recently caught and not - finished was thrown. Not set when commands are typed. See + finished was thrown. Not set when commands are typed. See also |v:exception| and |throw-variables|. Example: > :try @@ -1671,8 +1961,16 @@ v:throwpoint The point where the exception most recently caught and not :endtry < Output: "Exception from test.vim, line 2" + *v:true* *true-variable* +v:true A Number with value one. Used to put "true" in JSON. See + |json_encode()|. + When used as a string this evaluates to "v:true". > + echo v:true +< v:true ~ + That is so that eval() can parse the string back to the same + value. Read-only. *v:val* *val-variable* -v:val Value of the current item of a |List| or |Dictionary|. Only +v:val Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and |filter()|. Read-only. @@ -1687,6 +1985,10 @@ v:version Version number of Vim: Major version number times 100 plus version 5.0 and 5.1 may have a patch 123, but these are completely different. + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter Zero until most of startup is done. It is set to one just + before |VimEnter| autocommands are triggered. + *v:warningmsg* *warningmsg-variable* v:warningmsg Last given warning message. It's allowed to set this variable. @@ -1697,7 +1999,8 @@ v:windowid When any X11 based GUI is running or when running in a When an MS-Windows GUI is running this will be set to the window handle. Otherwise the value is zero. - Note: for windows inside Vim use |winnr()|. + Note: for windows inside Vim use |winnr()| or |win_getid()|, + see |window-ID|. ============================================================================== 4. Builtin Functions *functions* @@ -1708,341 +2011,502 @@ See |function-list| for a list grouped by what the function is used for. USAGE RESULT DESCRIPTION ~ -abs( {expr}) Float or Number absolute value of {expr} -acos( {expr}) Float arc cosine of {expr} -add( {list}, {item}) List append {item} to |List| {list} -and( {expr}, {expr}) Number bitwise AND -append( {lnum}, {string}) Number append {string} below line {lnum} -append( {lnum}, {list}) Number append lines {list} below line {lnum} +abs({expr}) Float or Number absolute value of {expr} +acos({expr}) Float arc cosine of {expr} +add({list}, {item}) List append {item} to |List| {list} +and({expr}, {expr}) Number bitwise AND +append({lnum}, {string}) Number append {string} below line {lnum} +append({lnum}, {list}) Number append lines {list} below line {lnum} argc() Number number of files in the argument list argidx() Number current index in the argument list -arglistid( [{winnr}, [ {tabnr}]]) - Number argument list id -argv( {nr}) String {nr} entry of the argument list -argv( ) List the argument list -asin( {expr}) Float arc sine of {expr} -atan( {expr}) Float arc tangent of {expr} -atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} -browse( {save}, {title}, {initdir}, {default}) +arglistid([{winnr} [, {tabnr}]]) Number argument list id +argv({nr}) String {nr} entry of the argument list +argv() List the argument list +assert_beeps({cmd}) Number assert {cmd} causes a beep +assert_equal({exp}, {act} [, {msg}]) + Number assert {exp} is equal to {act} +assert_equalfile({fname-one}, {fname-two}) + Number assert file contents is equal +assert_exception({error} [, {msg}]) + Number assert {error} is in v:exception +assert_fails({cmd} [, {error}]) Number assert {cmd} fails +assert_false({actual} [, {msg}]) + Number assert {actual} is false +assert_inrange({lower}, {upper}, {actual} [, {msg}]) + Number assert {actual} is inside the range +assert_match({pat}, {text} [, {msg}]) + Number assert {pat} matches {text} +assert_notequal({exp}, {act} [, {msg}]) + Number assert {exp} is not equal {act} +assert_notmatch({pat}, {text} [, {msg}]) + Number assert {pat} not matches {text} +assert_report({msg}) Number report a test failure +assert_true({actual} [, {msg}]) Number assert {actual} is true +asin({expr}) Float arc sine of {expr} +atan({expr}) Float arc tangent of {expr} +atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2} +balloon_show({expr}) none show {expr} inside the balloon +balloon_split({msg}) List split {msg} as used for a balloon +browse({save}, {title}, {initdir}, {default}) String put up a file requester -browsedir( {title}, {initdir}) String put up a directory requester -bufexists( {expr}) Number TRUE if buffer {expr} exists -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}) Number Number of the 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} -byteidxcomp( {expr}, {nr}) Number byte index of {nr}'th char in {expr} -call( {func}, {arglist} [, {dict}]) +browsedir({title}, {initdir}) String put up a directory requester +bufexists({expr}) Number |TRUE| if buffer {expr} exists +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} +byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr} +call({func}, {arglist} [, {dict}]) any call {func} with arguments {arglist} -ceil( {expr}) Float round {expr} up +ceil({expr}) Float round {expr} up +ch_canread({handle}) Number check if there is something to read +ch_close({handle}) none close {handle} +ch_close_in({handle}) none close in part of {handle} +ch_evalexpr({handle}, {expr} [, {options}]) + any evaluate {expr} on JSON {handle} +ch_evalraw({handle}, {string} [, {options}]) + any evaluate {string} on raw {handle} +ch_getbufnr({handle}, {what}) Number get buffer number for {handle}/{what} +ch_getjob({channel}) Job get the Job of {channel} +ch_info({handle}) String info about channel {handle} +ch_log({msg} [, {handle}]) none write {msg} in the channel log file +ch_logfile({fname} [, {mode}]) none start logging channel activity +ch_open({address} [, {options}]) + Channel open a channel to {address} +ch_read({handle} [, {options}]) String read from {handle} +ch_readraw({handle} [, {options}]) + String read raw from {handle} +ch_sendexpr({handle}, {expr} [, {options}]) + any send {expr} over JSON {handle} +ch_sendraw({handle}, {string} [, {options}]) + any send {string} over raw {handle} +ch_setoptions({handle}, {options}) + none set options for {handle} +ch_status({handle} [, {options}]) + String status of channel {handle} changenr() Number current change number -char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} -cindent( {lnum}) Number C indent for line {lnum} +char2nr({expr} [, {utf8}]) Number ASCII/UTF8 value of first char in {expr} +cindent({lnum}) Number C indent for line {lnum} clearmatches() none clear all matches -col( {expr}) Number column nr of cursor or mark -complete( {startcol}, {matches}) none set Insert mode completion -complete_add( {expr}) Number add completion match +col({expr}) Number column nr of cursor or mark +complete({startcol}, {matches}) none set Insert mode completion +complete_add({expr}) Number add completion match complete_check() Number check for key typed during completion -confirm( {msg} [, {choices} [, {default} [, {type}]]]) +confirm({msg} [, {choices} [, {default} [, {type}]]]) Number number of choice picked by user -copy( {expr}) any make a shallow copy of {expr} -cos( {expr}) Float cosine of {expr} -cosh( {expr}) Float hyperbolic cosine of {expr} -count( {list}, {expr} [, {start} [, {ic}]]) - Number count how many {expr} are in {list} -cscope_connection( [{num} , {dbpath} [, {prepend}]]) +copy({expr}) any make a shallow copy of {expr} +cos({expr}) Float cosine of {expr} +cosh({expr}) Float hyperbolic cosine of {expr} +count({list}, {expr} [, {ic} [, {start}]]) + Number count how many {expr} are in {list} +cscope_connection([{num}, {dbpath} [, {prepend}]]) Number checks existence of cscope connection -cursor( {lnum}, {col} [, {coladd}]) - Number move cursor to {lnum}, {col}, {coladd} -cursor( {list}) Number move cursor to position in {list} -deepcopy( {expr} [, {noref}]) any make a full copy of {expr} -delete( {fname}) Number delete file {fname} -did_filetype() Number TRUE if FileType autocommand event used -diff_filler( {lnum}) Number diff filler lines about {lnum} -diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col} -empty( {expr}) Number TRUE if {expr} is empty -escape( {string}, {chars}) String escape {chars} in {string} with '\' -eval( {string}) any evaluate {string} into its value -eventhandler( ) Number TRUE if inside an event handler -executable( {expr}) Number 1 if executable {expr} exists -exepath( {expr}) String full path of the command {expr} -exists( {expr}) Number TRUE if {expr} exists -extend( {expr1}, {expr2} [, {expr3}]) +cursor({lnum}, {col} [, {off}]) + Number move cursor to {lnum}, {col}, {off} +cursor({list}) Number move cursor to position in {list} +deepcopy({expr} [, {noref}]) any make a full copy of {expr} +delete({fname} [, {flags}]) Number delete the file or directory {fname} +deletebufline({expr}, {first}[, {last}]) + Number delete lines from buffer {expr} +did_filetype() Number |TRUE| if FileType autocmd event used +diff_filler({lnum}) Number diff filler lines about {lnum} +diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} +empty({expr}) Number |TRUE| if {expr} is empty +escape({string}, {chars}) String escape {chars} in {string} with '\' +eval({string}) any evaluate {string} into its value +eventhandler() Number |TRUE| if inside an event handler +executable({expr}) Number 1 if executable {expr} exists +execute({command}) String execute {command} and get the output +exepath({expr}) String full path of the command {expr} +exists({expr}) Number |TRUE| if {expr} exists +extend({expr1}, {expr2} [, {expr3}]) List/Dict insert items of {expr2} into {expr1} -exp( {expr}) Float exponential of {expr} -expand( {expr} [, {nosuf} [, {list}]]) +exp({expr}) Float exponential of {expr} +expand({expr} [, {nosuf} [, {list}]]) any expand special keywords in {expr} -feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer -filereadable( {file}) Number TRUE if {file} is a readable file -filewritable( {file}) Number TRUE if {file} is a writable file -filter( {expr}, {string}) List/Dict remove items from {expr} where - {string} is 0 -finddir( {name}[, {path}[, {count}]]) +feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer +filereadable({file}) Number |TRUE| if {file} is a readable file +filewritable({file}) Number |TRUE| if {file} is a writable file +filter({expr1}, {expr2}) List/Dict remove items from {expr1} where + {expr2} is 0 +finddir({name} [, {path} [, {count}]]) String find directory {name} in {path} -findfile( {name}[, {path}[, {count}]]) +findfile({name} [, {path} [, {count}]]) String find file {name} in {path} -float2nr( {expr}) Number convert Float {expr} to a Number -floor( {expr}) Float round {expr} down -fmod( {expr1}, {expr2}) Float remainder of {expr1} / {expr2} -fnameescape( {fname}) String escape special characters in {fname} -fnamemodify( {fname}, {mods}) String modify file name -foldclosed( {lnum}) Number first line of fold at {lnum} if closed -foldclosedend( {lnum}) Number last line of fold at {lnum} if closed -foldlevel( {lnum}) Number fold level at {lnum} -foldtext( ) String line displayed for closed fold -foldtextresult( {lnum}) String text for closed fold at {lnum} -foreground( ) Number bring the Vim window to the foreground -function( {name}) Funcref reference to function {name} -garbagecollect( [{atexit}]) none free memory, breaking cyclic references -get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def} -get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def} -getbufline( {expr}, {lnum} [, {end}]) +float2nr({expr}) Number convert Float {expr} to a Number +floor({expr}) Float round {expr} down +fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} +fnameescape({fname}) String escape special characters in {fname} +fnamemodify({fname}, {mods}) String modify file name +foldclosed({lnum}) Number first line of fold at {lnum} if closed +foldclosedend({lnum}) Number last line of fold at {lnum} if closed +foldlevel({lnum}) Number fold level at {lnum} +foldtext() String line displayed for closed fold +foldtextresult({lnum}) String text for closed fold at {lnum} +foreground() Number bring the Vim window to the foreground +funcref({name} [, {arglist}] [, {dict}]) + Funcref reference to function {name} +function({name} [, {arglist}] [, {dict}]) + Funcref named reference to function {name} +garbagecollect([{atexit}]) none free memory, breaking cyclic references +get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} +get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} +get({func}, {what}) any get property of funcref/partial {func} +getbufinfo([{expr}]) List information about buffers +getbufline({expr}, {lnum} [, {end}]) List lines {lnum} to {end} of buffer {expr} -getbufvar( {expr}, {varname} [, {def}]) +getbufvar({expr}, {varname} [, {def}]) any variable {varname} in buffer {expr} -getchar( [expr]) Number get one character from the user -getcharmod( ) Number modifiers for the last typed character +getchangelist({expr}) List list of change list items +getchar([expr]) Number get one character from the user +getcharmod() Number modifiers for the last typed character +getcharsearch() Dict last character search getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line -getcmdtype() String return the current command-line type +getcmdtype() String return current command-line type +getcmdwintype() String return current command-line window type +getcompletion({pat}, {type} [, {filtered}]) + List list of cmdline completion matches getcurpos() List position of the cursor -getcwd() String the current working directory -getfontname( [{name}]) String name of font being used -getfperm( {fname}) String file permissions of file {fname} -getfsize( {fname}) Number size in bytes of file {fname} -getftime( {fname}) Number last modification time of file -getftype( {fname}) String description of type of file {fname} -getline( {lnum}) String line {lnum} of current buffer -getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer -getloclist( {nr}) List list of location list items +getcwd([{winnr} [, {tabnr}]]) String get the current working directory +getfontname([{name}]) String name of font being used +getfperm({fname}) String file permissions of file {fname} +getfsize({fname}) Number size in bytes of file {fname} +getftime({fname}) Number last modification time of file +getftype({fname}) String description of type of file {fname} +getjumplist([{winnr} [, {tabnr}]]) + List list of jump list items +getline({lnum}) String line {lnum} of current buffer +getline({lnum}, {end}) List lines {lnum} to {end} of current buffer +getloclist({nr} [, {what}]) List list of location list items getmatches() List list of current matches getpid() Number process ID of Vim -getpos( {expr}) List position of cursor, mark, etc. -getqflist() List list of quickfix items -getreg( [{regname} [, 1 [, {list}]]]) +getpos({expr}) List position of cursor, mark, etc. +getqflist([{what}]) List list of quickfix items +getreg([{regname} [, 1 [, {list}]]]) String or List contents of register -getregtype( [{regname}]) String type of register -gettabvar( {nr}, {varname} [, {def}]) +getregtype([{regname}]) String type of register +gettabinfo([{expr}]) List list of tab pages +gettabvar({nr}, {varname} [, {def}]) any variable {varname} in tab {nr} or {def} -gettabwinvar( {tabnr}, {winnr}, {name} [, {def}]) +gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} -getwinposx() Number X coord in pixels of GUI Vim window -getwinposy() Number Y coord in pixels of GUI Vim window -getwinvar( {nr}, {varname} [, {def}]) +getwininfo([{winid}]) List list of windows +getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window +getwinposx() Number X coord in pixels of the Vim window +getwinposy() Number Y coord in pixels of the Vim window +getwinvar({nr}, {varname} [, {def}]) any variable {varname} in window {nr} -glob( {expr} [, {nosuf} [, {list}]]) +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) any expand file wildcards in {expr} -globpath( {path}, {expr} [, {nosuf} [, {list}]]) +glob2regpat({expr}) String convert a glob pat into a search pat +globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) String do glob({expr}) for all dirs in {path} -has( {feature}) Number TRUE if feature {feature} supported -has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} -haslocaldir() Number TRUE if current window executed |:lcd| -hasmapto( {what} [, {mode} [, {abbr}]]) - Number TRUE if mapping to {what} exists -histadd( {history},{item}) String add an item to a history -histdel( {history} [, {item}]) String remove an item from a history -histget( {history} [, {index}]) String get the item {index} from a history -histnr( {history}) Number highest index of a history -hlexists( {name}) Number TRUE if highlight group {name} exists -hlID( {name}) Number syntax ID of highlight group {name} +has({feature}) Number |TRUE| if feature {feature} supported +has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key} +haslocaldir([{winnr} [, {tabnr}]]) + Number |TRUE| if the window executed |:lcd| +hasmapto({what} [, {mode} [, {abbr}]]) + Number |TRUE| if mapping to {what} exists +histadd({history}, {item}) String add an item to a history +histdel({history} [, {item}]) String remove an item from a history +histget({history} [, {index}]) String get the item {index} from a history +histnr({history}) Number highest index of a history +hlexists({name}) Number |TRUE| if highlight group {name} exists +hlID({name}) Number syntax ID of highlight group {name} hostname() String name of the machine Vim is running on -iconv( {expr}, {from}, {to}) String convert encoding of {expr} -indent( {lnum}) Number indent of line {lnum} -index( {list}, {expr} [, {start} [, {ic}]]) +iconv({expr}, {from}, {to}) String convert encoding of {expr} +indent({lnum}) Number indent of line {lnum} +index({list}, {expr} [, {start} [, {ic}]]) Number index in {list} where {expr} appears -input( {prompt} [, {text} [, {completion}]]) +input({prompt} [, {text} [, {completion}]]) String get input from the user -inputdialog( {p} [, {t} [, {c}]]) String like input() but in a GUI dialog -inputlist( {textlist}) Number let the user pick from a choice list +inputdialog({prompt} [, {text} [, {completion}]]) + String like input() but in a GUI dialog +inputlist({textlist}) Number let the user pick from a choice list inputrestore() Number restore typeahead inputsave() Number save and clear typeahead -inputsecret( {prompt} [, {text}]) String like input() but hiding the text -insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}] -invert( {expr}) Number bitwise invert -isdirectory( {directory}) Number TRUE if {directory} is a directory -islocked( {expr}) Number TRUE if {expr} is locked -items( {dict}) List key-value pairs in {dict} -join( {list} [, {sep}]) String join {list} items into one String -keys( {dict}) List keys in {dict} -len( {expr}) Number the length of {expr} -libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg} -libcallnr( {lib}, {func}, {arg}) Number idem, but return a Number -line( {expr}) Number line nr of cursor, last line or mark -line2byte( {lnum}) Number byte count of line {lnum} -lispindent( {lnum}) Number Lisp indent for line {lnum} +inputsecret({prompt} [, {text}]) String like input() but hiding the text +insert({list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}] +invert({expr}) Number bitwise invert +isdirectory({directory}) Number |TRUE| if {directory} is a directory +islocked({expr}) Number |TRUE| if {expr} is locked +isnan({expr}) Number |TRUE| if {expr} is NaN +items({dict}) List key-value pairs in {dict} +job_getchannel({job}) Channel get the channel handle for {job} +job_info([{job}]) Dict get information about {job} +job_setoptions({job}, {options}) none set options for {job} +job_start({command} [, {options}]) + Job start a job +job_status({job}) String get the status of {job} +job_stop({job} [, {how}]) Number stop {job} +join({list} [, {sep}]) String join {list} items into one String +js_decode({string}) any decode JS style JSON +js_encode({expr}) String encode JS style JSON +json_decode({string}) any decode JSON +json_encode({expr}) String encode JSON +keys({dict}) List keys in {dict} +len({expr}) Number the length of {expr} +libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} +libcallnr({lib}, {func}, {arg}) Number idem, but return a Number +line({expr}) Number line nr of cursor, last line or mark +line2byte({lnum}) Number byte count of line {lnum} +lispindent({lnum}) Number Lisp indent for line {lnum} localtime() Number current time -log( {expr}) Float natural logarithm (base e) of {expr} -log10( {expr}) Float logarithm of Float {expr} to base 10 -luaeval( {expr}[, {expr}]) any evaluate |Lua| expression -map( {expr}, {string}) List/Dict change each item in {expr} to {expr} -maparg( {name}[, {mode} [, {abbr} [, {dict}]]]) +log({expr}) Float natural logarithm (base e) of {expr} +log10({expr}) Float logarithm of Float {expr} to base 10 +luaeval({expr} [, {expr}]) any evaluate |Lua| expression +map({expr1}, {expr2}) List/Dict change each item in {expr1} to {expr} +maparg({name} [, {mode} [, {abbr} [, {dict}]]]) String or Dict rhs of mapping {name} in mode {mode} -mapcheck( {name}[, {mode} [, {abbr}]]) +mapcheck({name} [, {mode} [, {abbr}]]) String check for mappings matching {name} -match( {expr}, {pat}[, {start}[, {count}]]) +match({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} matches in {expr} -matchadd( {group}, {pattern}[, {priority}[, {id}]]) +matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) Number highlight {pattern} with {group} -matchaddpos( {group}, {list}[, {priority}[, {id}]]) +matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) Number highlight positions with {group} -matcharg( {nr}) List arguments of |:match| -matchdelete( {id}) Number delete match identified by {id} -matchend( {expr}, {pat}[, {start}[, {count}]]) +matcharg({nr}) List arguments of |:match| +matchdelete({id}) Number delete match identified by {id} +matchend({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} ends in {expr} -matchlist( {expr}, {pat}[, {start}[, {count}]]) +matchlist({expr}, {pat} [, {start} [, {count}]]) List match and submatches of {pat} in {expr} -matchstr( {expr}, {pat}[, {start}[, {count}]]) +matchstr({expr}, {pat} [, {start} [, {count}]]) String {count}'th match of {pat} in {expr} -max( {list}) Number maximum value of items in {list} -min( {list}) Number minimum value of items in {list} -mkdir( {name} [, {path} [, {prot}]]) +matchstrpos({expr}, {pat} [, {start} [, {count}]]) + List {count}'th match of {pat} in {expr} +max({expr}) Number maximum value of items in {expr} +min({expr}) Number minimum value of items in {expr} +mkdir({name} [, {path} [, {prot}]]) Number create directory {name} -mode( [expr]) String current editing mode -mzeval( {expr}) any evaluate |MzScheme| expression -nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum} -nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} -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} -prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum} -printf( {fmt}, {expr1}...) String format text +mode([expr]) String current editing mode +mzeval({expr}) any evaluate |MzScheme| expression +nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} +nr2char({expr} [, {utf8}]) String single char with ASCII/UTF8 value {expr} +or({expr}, {expr}) Number bitwise OR +pathshorten({expr}) String shorten directory names in a path +perleval({expr}) any evaluate |Perl| expression +pow({x}, {y}) Float {x} to the power of {y} +prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} +printf({fmt}, {expr1}...) String format text +prompt_addtext({buf}, {expr}) none add text to a prompt buffer +prompt_setcallback({buf}, {expr}) none set prompt callback function +prompt_setinterrupt({buf}, {text}) none set prompt interrupt function +prompt_setprompt({buf}, {text}) none set prompt text pumvisible() Number whether popup menu is visible -pyeval( {expr}) any evaluate |Python| expression -py3eval( {expr}) any evaluate |python3| expression -range( {expr} [, {max} [, {stride}]]) +pyeval({expr}) any evaluate |Python| expression +py3eval({expr}) any evaluate |python3| expression +pyxeval({expr}) any evaluate |python_x| expression +range({expr} [, {max} [, {stride}]]) List items from {expr} to {max} -readfile( {fname} [, {binary} [, {max}]]) +readfile({fname} [, {binary} [, {max}]]) List get list of lines from file {fname} -reltime( [{start} [, {end}]]) List get time value -reltimestr( {time}) String turn time value into a String -remote_expr( {server}, {string} [, {idvar}]) +reg_executing() String get the executing register name +reg_recording() String get the recording register name +reltime([{start} [, {end}]]) List get time value +reltimefloat({time}) Float turn the time value into a Float +reltimestr({time}) String turn time value into a String +remote_expr({server}, {string} [, {idvar} [, {timeout}]]) String send expression -remote_foreground( {server}) Number bring Vim server to the foreground -remote_peek( {serverid} [, {retvar}]) +remote_foreground({server}) Number bring Vim server to the foreground +remote_peek({serverid} [, {retvar}]) Number check for reply string -remote_read( {serverid}) String read reply string -remote_send( {server}, {string} [, {idvar}]) +remote_read({serverid} [, {timeout}]) + String read reply string +remote_send({server}, {string} [, {idvar}]) + String send key sequence +remote_startserver({name}) none become server {name} String send key sequence -remove( {list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} -remove( {dict}, {key}) any remove entry {key} from {dict} -rename( {from}, {to}) Number rename (move) file from {from} to {to} -repeat( {expr}, {count}) String repeat {expr} {count} times -resolve( {filename}) String get filename a shortcut points to -reverse( {list}) List reverse {list} in-place -round( {expr}) Float round off {expr} -screenattr( {row}, {col}) Number attribute at screen position -screenchar( {row}, {col}) Number character at screen position +remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} +remove({dict}, {key}) any remove entry {key} from {dict} +rename({from}, {to}) Number rename (move) file from {from} to {to} +repeat({expr}, {count}) String repeat {expr} {count} times +resolve({filename}) String get filename a shortcut points to +reverse({list}) List reverse {list} in-place +round({expr}) Float round off {expr} +screenattr({row}, {col}) Number attribute at screen position +screenchar({row}, {col}) Number character at screen position screencol() Number current cursor column screenrow() Number current cursor row -search( {pattern} [, {flags} [, {stopline} [, {timeout}]]]) +search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) Number search for {pattern} -searchdecl( {name} [, {global} [, {thisblock}]]) +searchdecl({name} [, {global} [, {thisblock}]]) Number search for variable declaration -searchpair( {start}, {middle}, {end} [, {flags} [, {skip} [...]]]) +searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) Number search for other end of start/end pair -searchpairpos( {start}, {middle}, {end} [, {flags} [, {skip} [...]]]) +searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) List search for other end of start/end pair -searchpos( {pattern} [, {flags} [, {stopline} [, {timeout}]]]) +searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) List search for {pattern} -server2client( {clientid}, {string}) +server2client({clientid}, {string}) Number send reply string serverlist() String get a list of available servers -setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val} -setcmdpos( {pos}) Number set cursor position in command-line -setline( {lnum}, {line}) Number set line {lnum} to {line} -setloclist( {nr}, {list}[, {action}]) +setbufline({expr}, {lnum}, {line}) + Number set line {lnum} to {line} in buffer + {expr} +setbufvar({expr}, {varname}, {val}) + none set {varname} in buffer {expr} to {val} +setcharsearch({dict}) Dict set character search from {dict} +setcmdpos({pos}) Number set cursor position in command-line +setfperm({fname}, {mode}) Number set {fname} file permissions to {mode} +setline({lnum}, {line}) Number set line {lnum} to {line} +setloclist({nr}, {list} [, {action} [, {what}]]) Number modify location list using {list} -setmatches( {list}) Number restore a list of matches -setpos( {expr}, {list}) Number set the {expr} position to {list} -setqflist( {list}[, {action}]) Number modify quickfix list using {list} -setreg( {n}, {v}[, {opt}]) Number set register to value and type -settabvar( {nr}, {varname}, {val}) set {varname} in tab page {nr} to {val} -settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window - {winnr} in tab page {tabnr} to {val} -setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} -sha256( {string}) String SHA256 checksum of {string} -shellescape( {string} [, {special}]) +setmatches({list}) Number restore a list of matches +setpos({expr}, {list}) Number set the {expr} position to {list} +setqflist({list} [, {action} [, {what}]]) + Number modify quickfix list using {list} +setreg({n}, {v} [, {opt}]) Number set register to value and type +settabvar({nr}, {varname}, {val}) none set {varname} in tab page {nr} to {val} +settabwinvar({tabnr}, {winnr}, {varname}, {val}) + none set {varname} in window {winnr} in tab + page {tabnr} to {val} +setwinvar({nr}, {varname}, {val}) none set {varname} in window {nr} to {val} +sha256({string}) String SHA256 checksum of {string} +shellescape({string} [, {special}]) String escape {string} for use as shell command argument shiftwidth() Number effective value of 'shiftwidth' -simplify( {filename}) String simplify filename as much as possible -sin( {expr}) Float sine of {expr} -sinh( {expr}) Float hyperbolic sine of {expr} -sort( {list} [, {func} [, {dict}]]) +simplify({filename}) String simplify filename as much as possible +sin({expr}) Float sine of {expr} +sinh({expr}) Float hyperbolic sine of {expr} +sort({list} [, {func} [, {dict}]]) List sort {list}, using {func} to compare -soundfold( {word}) String sound-fold {word} +soundfold({word}) String sound-fold {word} spellbadword() String badly spelled word at cursor -spellsuggest( {word} [, {max} [, {capital}]]) +spellsuggest({word} [, {max} [, {capital}]]) List spelling suggestions -split( {expr} [, {pat} [, {keepempty}]]) +split({expr} [, {pat} [, {keepempty}]]) List make |List| from {pat} separated {expr} -sqrt( {expr}) Float square root of {expr} -str2float( {expr}) Float convert String to Float -str2nr( {expr} [, {base}]) Number convert String to Number -strchars( {expr}) Number character length of the String {expr} -strdisplaywidth( {expr} [, {col}]) Number display length of the String {expr} -strftime( {format}[, {time}]) String time in specified format -stridx( {haystack}, {needle}[, {start}]) +sqrt({expr}) Float square root of {expr} +str2float({expr}) Float convert String to Float +str2nr({expr} [, {base}]) Number convert String to Number +strchars({expr} [, {skipcc}]) Number character length of the String {expr} +strcharpart({str}, {start} [, {len}]) + String {len} characters of {str} at {start} +strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} +strftime({format} [, {time}]) String time in specified format +strgetchar({str}, {index}) Number get char {index} from {str} +stridx({haystack}, {needle} [, {start}]) Number index of {needle} in {haystack} -string( {expr}) String String representation of {expr} value -strlen( {expr}) Number length of the String {expr} -strpart( {src}, {start}[, {len}]) - String {len} characters of {src} at {start} -strridx( {haystack}, {needle} [, {start}]) +string({expr}) String String representation of {expr} value +strlen({expr}) Number length of the String {expr} +strpart({str}, {start} [, {len}]) + String {len} characters of {str} at {start} +strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} -strtrans( {expr}) String translate string to make it printable -strwidth( {expr}) Number display cell length of the String {expr} -submatch( {nr}[, {list}]) String or List +strtrans({expr}) String translate string to make it printable +strwidth({expr}) Number display cell length of the String {expr} +submatch({nr} [, {list}]) String or List specific match in ":s" or substitute() -substitute( {expr}, {pat}, {sub}, {flags}) +substitute({expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} -synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} -synIDattr( {synID}, {what} [, {mode}]) +synID({lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} +synIDattr({synID}, {what} [, {mode}]) String attribute {what} of syntax ID {synID} -synIDtrans( {synID}) Number translated syntax ID of {synID} -synconcealed( {lnum}, {col}) List info about concealing -synstack( {lnum}, {col}) List stack of syntax IDs at {lnum} and {col} -system( {expr} [, {input}]) String output of shell command/filter {expr} -systemlist( {expr} [, {input}]) List output of shell command/filter {expr} -tabpagebuflist( [{arg}]) List list of buffer numbers in tab page -tabpagenr( [{arg}]) Number number of current or last tab page -tabpagewinnr( {tabarg}[, {arg}]) - Number number of current window in tab page -taglist( {expr}) List list of tags matching {expr} +synIDtrans({synID}) Number translated syntax ID of {synID} +synconcealed({lnum}, {col}) List info about concealing +synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col} +system({expr} [, {input}]) String output of shell command/filter {expr} +systemlist({expr} [, {input}]) List output of shell command/filter {expr} +tabpagebuflist([{arg}]) List list of buffer numbers in tab page +tabpagenr([{arg}]) Number number of current or last tab page +tabpagewinnr({tabarg} [, {arg}]) Number number of current window in tab page +taglist({expr} [, {filename}]) List list of tags matching {expr} tagfiles() List tags files used +tan({expr}) Float tangent of {expr} +tanh({expr}) Float hyperbolic tangent of {expr} tempname() String name for a temporary file -tan( {expr}) Float tangent of {expr} -tanh( {expr}) Float hyperbolic tangent of {expr} -tolower( {expr}) String the String {expr} switched to lowercase -toupper( {expr}) String the String {expr} switched to uppercase -tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} +term_dumpdiff({filename}, {filename} [, {options}]) + Number display difference between two dumps +term_dumpload({filename} [, {options}]) + Number displaying a screen dump +term_dumpwrite({buf}, {filename} [, {options}]) + none dump terminal window contents +term_getaltscreen({buf}) Number get the alternate screen flag +term_getansicolors({buf}) List get ANSI palette in GUI color mode +term_getattr({attr}, {what}) Number get the value of attribute {what} +term_getcursor({buf}) List get the cursor position of a terminal +term_getjob({buf}) Job get the job associated with a terminal +term_getline({buf}, {row}) String get a line of text from a terminal +term_getscrolled({buf}) Number get the scroll count of a terminal +term_getsize({buf}) List get the size of a terminal +term_getstatus({buf}) String get the status of a terminal +term_gettitle({buf}) String get the title of a terminal +term_gettty({buf}, [{input}]) String get the tty name of a terminal +term_list() List get the list of terminal buffers +term_scrape({buf}, {row}) List get row of a terminal screen +term_sendkeys({buf}, {keys}) none send keystrokes to a terminal +term_setansicolors({buf}, {colors}) + none set ANSI palette in GUI color mode +term_setkill({buf}, {how}) none set signal to stop job in terminal +term_setrestore({buf}, {command}) none set command to restore terminal +term_setsize({buf}, {rows}, {cols}) + none set the size of a terminal +term_start({cmd}, {options}) Job open a terminal window and run a job +term_wait({buf} [, {time}]) Number wait for screen to be updated +test_alloc_fail({id}, {countdown}, {repeat}) + none make memory allocation fail +test_autochdir() none enable 'autochdir' during startup +test_feedinput() none add key sequence to input buffer +test_garbagecollect_now() none free memory right now for testing +test_ignore_error({expr}) none ignore a specific error +test_null_channel() Channel null value for testing +test_null_dict() Dict null value for testing +test_null_job() Job null value for testing +test_null_list() List null value for testing +test_null_partial() Funcref null value for testing +test_null_string() String null value for testing +test_override({expr}, {val}) none test with Vim internal overrides +test_settime({expr}) none set current time for testing +timer_info([{id}]) List information about timers +timer_pause({id}, {pause}) none pause or unpause a timer +timer_start({time}, {callback} [, {options}]) + Number create a timer +timer_stop({timer}) none stop a timer +timer_stopall() none stop all timers +tolower({expr}) String the String {expr} switched to lowercase +toupper({expr}) String the String {expr} switched to uppercase +tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} -trunc( {expr}) Float truncate Float {expr} -type( {name}) Number type of variable {name} -undofile( {name}) String undo file name for {name} +trim({text}[, {mask}]) String trim characters in {mask} from {text} +trunc({expr}) Float truncate Float {expr} +type({name}) Number type of variable {name} +undofile({name}) String undo file name for {name} undotree() List undo file tree -uniq( {list} [, {func} [, {dict}]]) +uniq({list} [, {func} [, {dict}]]) List remove adjacent duplicates from a list -values( {dict}) List values in {dict} -virtcol( {expr}) Number screen column of cursor or mark -visualmode( [expr]) String last visual mode used +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 -winbufnr( {nr}) Number buffer number of window {nr} +win_findbuf({bufnr}) List find windows containing {bufnr} +win_getid([{win} [, {tab}]]) Number get window ID for {win} in {tab} +win_gotoid({expr}) Number go to window with ID {expr} +win_id2tabwin({expr}) List get tab and window nr from window ID +win_id2win({expr}) Number get window nr from window ID +win_screenpos({nr}) List get screen position of window {nr} +winbufnr({nr}) Number buffer number of window {nr} wincol() Number window column of the cursor -winheight( {nr}) Number height of window {nr} +winheight({nr}) Number height of window {nr} winline() Number window line of the cursor -winnr( [{expr}]) Number number of current window +winnr([{expr}]) Number number of current window winrestcmd() String returns command to restore window sizes -winrestview( {dict}) none restore view of current window +winrestview({dict}) none restore view of current window winsaveview() Dict save view of current window -winwidth( {nr}) Number width of window {nr} -writefile( {list}, {fname} [, {binary}]) +winwidth({nr}) Number width of window {nr} +wordcount() Dict get byte/char/word statistics +writefile({list}, {fname} [, {flags}]) Number write list of lines to file {fname} -xor( {expr}, {expr}) Number bitwise XOR +xor({expr}, {expr}) Number bitwise XOR + abs({expr}) *abs()* Return the absolute value of {expr}. When {expr} evaluates to @@ -2096,9 +2560,24 @@ append({lnum}, {expr}) *append()* the current buffer. {lnum} can be zero to insert a line before the first one. Returns 1 for failure ({lnum} out of range or out of memory), - 0 for success. Example: > + 0 for success. Example: > :let failed = append(line('$'), "# THE END") :let failed = append(0, ["Chapter 1", "the beginning"]) + +appendbufline({expr}, {lnum}, {text}) *appendbufline()* + Like |append()| but append the text in buffer {expr}. + + For the use of {expr}, see |bufname()|. + + {lnum} is used like with |append()|. Note that using |line()| + would use the current buffer, not the one appending to. + Use "$" to append at the end of the buffer. + + On success 0 is returned, on failure 1 is returned. + + If {expr} is not a valid buffer or {lnum} is not valid, an + error message is given. Example: > + :let failed = appendbufline(13, 0, "# THE START") < *argc()* argc() The result is the number of files in the argument list of the @@ -2109,16 +2588,17 @@ argidx() The result is the current index in the argument list. 0 is the first file. argc() - 1 is the last one. See |arglist|. *arglistid()* -arglistid([{winnr}, [ {tabnr} ]]) +arglistid([{winnr} [, {tabnr}]]) Return the argument list ID. This is a number which identifies the argument list being used. Zero is used for the - global argument list. - Return zero if the arguments are invalid. + global argument list. See |arglist|. + Return -1 if the arguments are invalid. Without arguments use the current window. 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 @@ -2133,6 +2613,118 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the < Without the {nr} argument a |List| with the whole |arglist| is returned. +assert_beeps({cmd}) *assert_beeps()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce a beep or visual bell. + Also see |assert_fails()| and |assert-return|. + + *assert_equal()* +assert_equal({expected}, {actual} [, {msg}]) + When {expected} and {actual} are not equal an error message is + added to |v:errors| and 1 is returned. Otherwise zero is + returned |assert-return|. + There is no automatic conversion, the String "4" is different + from the Number 4. And the number 4 is different from the + Float 4.0. The value of 'ignorecase' is not used here, case + always matters. + When {msg} is omitted an error in the form "Expected + {expected} but got {actual}" is produced. + Example: > + assert_equal('foo', 'bar') +< Will result in a string to be added to |v:errors|: + test.vim line 12: Expected 'foo' but got 'bar' ~ + + *assert_equalfile()* +assert_equalfile({fname-one}, {fname-two}) + When the files {fname-one} and {fname-two} do not contain + exactly the same text an error message is added to |v:errors|. + Also see |assert-return|. + When {fname-one} or {fname-two} does not exist the error will + mention that. + Mainly useful with |terminal-diff|. + +assert_exception({error} [, {msg}]) *assert_exception()* + When v:exception does not contain the string {error} an error + message is added to |v:errors|. Also see |assert-return|. + This can be used to assert that a command throws an exception. + Using the error number, followed by a colon, avoids problems + with translations: > + try + commandthatfails + call assert_false(1, 'command should have failed') + catch + call assert_exception('E492:') + endtry + +assert_fails({cmd} [, {error}]) *assert_fails()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce an error. Also see |assert-return|. + When {error} is given it must match in |v:errmsg|. + Note that beeping is not considered an error, and some failing + commands only beep. Use |assert_beeps()| for those. + +assert_false({actual} [, {msg}]) *assert_false()* + When {actual} is not false an error message is added to + |v:errors|, like with |assert_equal()|. + Also see |assert-return|. + A value is false when it is zero. When {actual} is not a + number the assert fails. + When {msg} is omitted an error in the form + "Expected False but got {actual}" is produced. + +assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* + This asserts number values. When {actual} is lower than + {lower} or higher than {upper} an error message is added to + |v:errors|. Also see |assert-return|. + When {msg} is omitted an error in the form + "Expected range {lower} - {upper}, but got {actual}" is + produced. + + *assert_match()* +assert_match({pattern}, {actual} [, {msg}]) + When {pattern} does not match {actual} an error message is + added to |v:errors|. Also see |assert-return|. + + {pattern} is used as with |=~|: The matching is always done + like 'magic' was set and 'cpoptions' is empty, no matter what + the actual value of 'magic' or 'cpoptions' is. + + {actual} is used as a string, automatic conversion applies. + Use "^" and "$" to match with the start and end of the text. + Use both to match the whole text. + + When {msg} is omitted an error in the form + "Pattern {pattern} does not match {actual}" is produced. + Example: > + assert_match('^f.*o$', 'foobar') +< Will result in a string to be added to |v:errors|: + test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + + *assert_notequal()* +assert_notequal({expected}, {actual} [, {msg}]) + The opposite of `assert_equal()`: add an error message to + |v:errors| when {expected} and {actual} are equal. + Also see |assert-return|. + + *assert_notmatch()* +assert_notmatch({pattern}, {actual} [, {msg}]) + The opposite of `assert_match()`: add an error message to + |v:errors| when {pattern} matches {actual}. + Also see |assert-return|. + +assert_report({msg}) *assert_report()* + Report a test failure directly, using {msg}. + Always returns one. + +assert_true({actual} [, {msg}]) *assert_true()* + When {actual} is not true an error message is added to + |v:errors|, like with |assert_equal()|. + Also see |assert-return|. + A value is TRUE when it is a non-zero number. When {actual} + is not a number the assert fails. + When {msg} is omitted an error in the form "Expected True but + got {actual}" is produced. + asin({expr}) *asin()* Return the arc sine of {expr} measured in radians, as a |Float| in the range of [-pi/2, pi/2]. @@ -2169,13 +2761,48 @@ atan2({expr1}, {expr2}) *atan2()* < 2.356194 {only available when compiled with the |+float| feature} +balloon_show({expr}) *balloon_show()* + Show {expr} inside the balloon. For the GUI {expr} is used as + a string. For a terminal {expr} can be a list, which contains + the lines of the balloon. If {expr} is not a list it will be + split with |balloon_split()|. + + Example: > + func GetBalloonContent() + " initiate getting the content + return '' + endfunc + set balloonexpr=GetBalloonContent() + + func BalloonCallback(result) + call balloon_show(a:result) + endfunc +< + The intended use is that fetching the content of the balloon + is initiated from 'balloonexpr'. It will invoke an + asynchronous method, in which a callback invokes + balloon_show(). The 'balloonexpr' itself can return an + empty string or a placeholder. + + When showing a balloon is not possible nothing happens, no + error message. + {only available when compiled with the +balloon_eval or + +balloon_eval_term feature} + +balloon_split({msg}) *balloon_split()* + Split {msg} into lines to be displayed in a balloon. The + splits are made for the current window size and optimize to + show debugger output. + Returns a |List| with the split lines. + {only available when compiled with the +balloon_eval_term + feature} *browse()* browse({save}, {title}, {initdir}, {default}) Put up a file requester. This only works when "has("browse")" - returns non-zero (only in some GUI versions). + returns |TRUE| (only in some GUI versions). The input fields are: - {save} when non-zero, select file to write + {save} when |TRUE|, select file to write {title} title for the requester {initdir} directory to start browsing in {default} default file name @@ -2185,7 +2812,7 @@ browse({save}, {title}, {initdir}, {default}) *browsedir()* browsedir({title}, {initdir}) Put up a directory requester. This only works when - "has("browse")" returns non-zero (only in some GUI versions). + "has("browse")" returns |TRUE| (only in some GUI versions). On systems where a directory browser is not supported a file browser is used. In that case: select a file in the directory to be used. @@ -2196,9 +2823,11 @@ browsedir({title}, {initdir}) browsing is not possible, an empty string is returned. bufexists({expr}) *bufexists()* - The result is a Number, which is non-zero if a buffer called + The result is a Number, which is |TRUE| if a buffer called {expr} exists. If the {expr} argument is a number, buffer numbers are used. + Number zero is the alternate buffer for the current window. + If the {expr} argument is a string it must match a buffer name exactly. The name can be: - Relative to the current directory. @@ -2218,12 +2847,12 @@ bufexists({expr}) *bufexists()* Obsolete name: buffer_exists(). buflisted({expr}) *buflisted()* - The result is a Number, which is non-zero if a buffer called + The result is a Number, which is |TRUE| if a buffer called {expr} exists and is listed (has the 'buflisted' option set). The {expr} argument is used like with |bufexists()|. bufloaded({expr}) *bufloaded()* - The result is a Number, which is non-zero if a buffer called + The result is a Number, which is |TRUE| if a buffer called {expr} exists and is loaded (shown in a window or hidden). The {expr} argument is used like with |bufexists()|. @@ -2233,7 +2862,7 @@ bufname({expr}) *bufname()* If {expr} is a Number, that buffer number's name is given. Number zero is the alternate buffer for the current window. If {expr} is a String, it is used as a |file-pattern| to match - with the buffer names. This is always done like 'magic' is + with the buffer names. This is always done like 'magic' is set and 'cpoptions' is empty. When there is more than one match an empty string is returned. "" or "%" can be used for the current buffer, "#" for the @@ -2276,10 +2905,20 @@ bufnr({expr} [, {create}]) *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 window associated with buffer {expr}. For the use of {expr}, - see |bufname()| above. If buffer {expr} doesn't exist or + 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 " . (bufwinnr(1)) @@ -2288,7 +2927,6 @@ bufwinnr({expr}) *bufwinnr()* |:wincmd|. Only deals with the current tab page. - byte2line({byte}) *byte2line()* Return the line number that contains the character at byte count {byte} in the current buffer. This includes the @@ -2314,7 +2952,9 @@ byteidx({expr}, {nr}) *byteidx()* same: > let s = strpart(str, byteidx(str, 3)) echo strpart(s, 0, byteidx(s, 1)) -< If there are less than {nr} characters -1 is returned. +< Also see |strgetchar()| and |strcharpart()|. + + If there are less than {nr} characters -1 is returned. If there are exactly {nr} characters the length of the string in bytes is returned. @@ -2353,6 +2993,207 @@ ceil({expr}) *ceil()* < 4.0 {only available when compiled with the |+float| feature} +ch_canread({handle}) *ch_canread()* + Return non-zero when there is something to read from {handle}. + {handle} can be a Channel or a Job that has a Channel. + + This is useful to read from a channel at a convenient time, + e.g. from a timer. + + Note that messages are dropped when the channel does not have + a callback. Add a close callback to avoid that. + + {only available when compiled with the |+channel| feature} + +ch_close({handle}) *ch_close()* + Close {handle}. See |channel-close|. + {handle} can be a Channel or a Job that has a Channel. + A close callback is not invoked. + + {only available when compiled with the |+channel| feature} + +ch_close_in({handle}) *ch_close_in()* + Close the "in" part of {handle}. See |channel-close-in|. + {handle} can be a Channel or a Job that has a Channel. + A close callback is not invoked. + + {only available when compiled with the |+channel| feature} + +ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()* + Send {expr} over {handle}. The {expr} is encoded + according to the type of channel. The function cannot be used + with a raw channel. See |channel-use|. + {handle} can be a Channel or a Job that has a Channel. + *E917* + {options} must be a Dictionary. It must not have a "callback" + entry. It can have a "timeout" entry to specify the timeout + for this specific request. + + ch_evalexpr() waits for a response and returns the decoded + expression. When there is an error or timeout it returns an + empty string. + + {only available when compiled with the |+channel| feature} + +ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()* + Send {string} over {handle}. + {handle} can be a Channel or a Job that has a Channel. + + Works like |ch_evalexpr()|, but does not encode the request or + decode the response. The caller is responsible for the + correct contents. Also does not add a newline for a channel + in NL mode, the caller must do that. The NL in the response + is removed. + Note that Vim does not know when the text received on a raw + channel is complete, it may only return the first part and you + need to use ch_readraw() to fetch the rest. + See |channel-use|. + + {only available when compiled with the |+channel| feature} + +ch_getbufnr({handle}, {what}) *ch_getbufnr()* + Get the buffer number that {handle} is using for {what}. + {handle} can be a Channel or a Job that has a Channel. + {what} can be "err" for stderr, "out" for stdout or empty for + socket output. + Returns -1 when there is no buffer. + {only available when compiled with the |+channel| feature} + +ch_getjob({channel}) *ch_getjob()* + Get the Job associated with {channel}. + If there is no job calling |job_status()| on the returned Job + will result in "fail". + + {only available when compiled with the |+channel| and + |+job| features} + +ch_info({handle}) *ch_info()* + Returns a Dictionary with information about {handle}. The + items are: + "id" number of the channel + "status" "open", "buffered" or "closed", like + ch_status() + When opened with ch_open(): + "hostname" the hostname of the address + "port" the port of the address + "sock_status" "open" or "closed" + "sock_mode" "NL", "RAW", "JSON" or "JS" + "sock_io" "socket" + "sock_timeout" timeout in msec + When opened with job_start(): + "out_status" "open", "buffered" or "closed" + "out_mode" "NL", "RAW", "JSON" or "JS" + "out_io" "null", "pipe", "file" or "buffer" + "out_timeout" timeout in msec + "err_status" "open", "buffered" or "closed" + "err_mode" "NL", "RAW", "JSON" or "JS" + "err_io" "out", "null", "pipe", "file" or "buffer" + "err_timeout" timeout in msec + "in_status" "open" or "closed" + "in_mode" "NL", "RAW", "JSON" or "JS" + "in_io" "null", "pipe", "file" or "buffer" + "in_timeout" timeout in msec + +ch_log({msg} [, {handle}]) *ch_log()* + Write {msg} in the channel log file, if it was opened with + |ch_logfile()|. + When {handle} is passed the channel number is used for the + message. + {handle} can be a Channel or a Job that has a Channel. The + Channel must be open for the channel number to be used. + +ch_logfile({fname} [, {mode}]) *ch_logfile()* + Start logging channel activity to {fname}. + When {fname} is an empty string: stop logging. + + When {mode} is omitted or "a" append to the file. + When {mode} is "w" start with an empty file. + + The file is flushed after every message, on Unix you can use + "tail -f" to see what is going on in real time. + + This function is not available in the |sandbox|. + NOTE: the channel communication is stored in the file, be + aware that this may contain confidential and privacy sensitive + information, e.g. a password you type in a terminal window. + + +ch_open({address} [, {options}]) *ch_open()* + Open a channel to {address}. See |channel|. + Returns a Channel. Use |ch_status()| to check for failure. + + {address} has the form "hostname:port", e.g., + "localhost:8765". + + If {options} is given it must be a |Dictionary|. + See |channel-open-options|. + + {only available when compiled with the |+channel| feature} + +ch_read({handle} [, {options}]) *ch_read()* + Read from {handle} and return the received message. + {handle} can be a Channel or a Job that has a Channel. + For a NL channel this waits for a NL to arrive, except when + there is nothing more to read (channel was closed). + See |channel-more|. + {only available when compiled with the |+channel| feature} + +ch_readraw({handle} [, {options}]) *ch_readraw()* + Like ch_read() but for a JS and JSON channel does not decode + the message. For a NL channel it does not block waiting for + the NL to arrive, but otherwise works like ch_read(). + See |channel-more|. + {only available when compiled with the |+channel| feature} + +ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()* + Send {expr} over {handle}. The {expr} is encoded + according to the type of channel. The function cannot be used + with a raw channel. + See |channel-use|. *E912* + {handle} can be a Channel or a Job that has a Channel. + + {only available when compiled with the |+channel| feature} + +ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()* + Send {string} over {handle}. + Works like |ch_sendexpr()|, but does not encode the request or + decode the response. The caller is responsible for the + correct contents. Also does not add a newline for a channel + in NL mode, the caller must do that. The NL in the response + is removed. + See |channel-use|. + + {only available when compiled with the |+channel| feature} + +ch_setoptions({handle}, {options}) *ch_setoptions()* + Set options on {handle}: + "callback" the channel callback + "timeout" default read timeout in msec + "mode" mode for the whole channel + See |ch_open()| for more explanation. + {handle} can be a Channel or a Job that has a Channel. + + Note that changing the mode may cause queued messages to be + lost. + + These options cannot be changed: + "waittime" only applies to |ch_open()| + +ch_status({handle} [, {options}]) *ch_status()* + Return the status of {handle}: + "fail" failed to open the channel + "open" channel can be used + "buffered" channel can be read, not written to + "closed" channel can not be used + {handle} can be a Channel or a Job that has a Channel. + "buffered" is used when the channel was closed but there is + still data that can be obtained with |ch_read()|. + + If {options} is given it can contain a "part" entry to specify + the part of the channel to return the status for: "out" or + "err". For example, to get the error status: > + ch_status(job, {"part": "err"}) +< changenr() *changenr()* Return the number of the most recent change. This is the same number as what is displayed with |:undolist| and can be used @@ -2361,14 +3202,14 @@ changenr() *changenr()* redo it is the number of the redone change. After undo it is one less than the number of the undone change. -char2nr({expr}[, {utf8}]) *char2nr()* +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 + char2nr("á") returns 225 + char2nr("á"[0]) returns 195 < With {utf8} set to 1, always treat as utf-8 characters. A combining character is a separate character. |nr2char()| does the opposite. @@ -2394,6 +3235,10 @@ col({expr}) The result is a Number, which is the byte index of the column number of bytes in the cursor line plus one) 'x position of mark x (if the mark is not set, 0 is returned) + v In Visual mode: the start of the Visual area (the + cursor is the end). When not in Visual mode + returns the cursor position. Differs from |'<| in + that it's updated right away. Additionally {expr} can be [lnum, col]: a |List| with the line and column number. Most useful when the column is "$", to get the last column of a specific line. When "lnum" or "col" is @@ -2407,7 +3252,7 @@ col({expr}) The result is a Number, which is the byte index of the column col("$") length of cursor line plus one col("'t") column of mark t col("'" . markname) column of mark markname -< The first column is 1. 0 is returned for an error. +< The first column is 1. 0 is returned for an error. For an uppercase mark the column may actually be in another buffer. For the cursor position, when 'virtualedit' is active, the @@ -2422,8 +3267,8 @@ col({expr}) The result is a Number, which is the byte index of the column complete({startcol}, {matches}) *complete()* *E785* Set the matches for Insert mode completion. Can only be used in Insert mode. You need to use a mapping - with CTRL-R = |i_CTRL-R|. It does not work after CTRL-O or - with an expression mapping. + with CTRL-R = (see |i_CTRL-R|). It does not work after CTRL-O + or with an expression mapping. {startcol} is the byte offset in the line where the completed text start. The text up to the cursor is the original text that will be replaced by the matches. Use col('.') for an @@ -2454,13 +3299,13 @@ complete_add({expr}) *complete_add()* Returns 0 for failure (empty string or out of memory), 1 when the match was added, 2 when the match was already in the list. - See |complete-functions| for an explanation of {expr}. It is + See |complete-functions| for an explanation of {expr}. It is the same as one item in the list that 'omnifunc' would return. complete_check() *complete_check()* Check for a key typed while looking for completion matches. This is to be used when looking for matches takes some time. - Returns non-zero when searching for matches is to be aborted, + Returns |TRUE| when searching for matches is to be aborted, zero otherwise. Only to be used by the function specified with the 'completefunc' option. @@ -2514,19 +3359,20 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) :endif < In a GUI dialog, buttons are used. The layout of the buttons depends on the 'v' flag in 'guioptions'. If it is included, - the buttons are always put vertically. Otherwise, confirm() + the buttons are always put vertically. Otherwise, confirm() tries to put the buttons in one horizontal line. If they don't fit, a vertical layout is used anyway. For some systems the horizontal layout is always used. *copy()* -copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't +copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a |List| a shallow copy is created. This means that the original |List| can be changed without changing the copy, and vice versa. But the items are identical, thus - changing an item changes the contents of both |Lists|. Also - see |deepcopy()|. + changing an item changes the contents of both |Lists|. + A |Dictionary| is copied in a similar way as a |List|. + Also see |deepcopy()|. cos({expr}) *cos()* Return the cosine of {expr}, measured in radians, as a |Float|. @@ -2550,14 +3396,19 @@ cosh({expr}) *cosh()* < -1.127626 {only available when compiled with the |+float| feature} - + count({comp}, {expr} [, {ic} [, {start}]]) *count()* Return the number of times an item with value {expr} appears - in |List| or |Dictionary| {comp}. + in |String|, |List| or |Dictionary| {comp}. + If {start} is given then start with the item with this index. {start} can only be used with a |List|. - When {ic} is given and it's non-zero then case is ignored. + When {ic} is given and it's |TRUE| then case is ignored. + + When {comp} is a string then the number of not overlapping + occurrences of {expr} is returned. Zero is returned when + {expr} is an empty string. *cscope_connection()* cscope_connection([{num} , {dbpath} [, {prepend}]]) @@ -2607,6 +3458,7 @@ cursor({list}) When there is one argument {list} this is used as a |List| with two, three or four item: + [{lnum}, {col}] [{lnum}, {col}, {off}] [{lnum}, {col}, {off}, {curswant}] This is like the return value of |getpos()| or |getcurpos()|, @@ -2621,21 +3473,24 @@ cursor({list}) line. If {col} is zero, the cursor will stay in the current column. If {curswant} is given it is used to set the preferred column - for vertical movment. Otherwise {col} is used. + for vertical movement. Otherwise {col} is used. + When 'virtualedit' is used {off} specifies the offset in screen columns from the start of the character. E.g., a position within a <Tab> or after the last character. Returns 0 when the position could be set, -1 otherwise. -deepcopy({expr}[, {noref}]) *deepcopy()* *E698* - Make a copy of {expr}. For Numbers and Strings this isn't +deepcopy({expr} [, {noref}]) *deepcopy()* *E698* + Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a |List| a full copy is created. This means that the original |List| can be changed without changing the - copy, and vice versa. When an item is a |List|, a copy for it - is made, recursively. Thus changing an item in the copy does - not change the contents of the original |List|. + copy, and vice versa. When an item is a |List| or + |Dictionary|, a copy for it is made, recursively. Thus + changing an item in the copy does not change the contents of + the original |List|. + A |Dictionary| is copied in a similar way as a |List|. When {noref} is omitted or zero a contained |List| or |Dictionary| is only copied once. All references point to this single copy. With {noref} set to 1 every occurrence of a @@ -2647,19 +3502,44 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698* {noref} set to 1 will fail. Also see |copy()|. -delete({fname}) *delete()* - Deletes the file by the name {fname}. The result is a Number, - which is 0 if the file was deleted successfully, and non-zero - when the deletion failed. +delete({fname} [, {flags}]) *delete()* + Without {flags} or with {flags} empty: Deletes the file by the + name {fname}. This also works when {fname} is a symbolic link. + + When {flags} is "d": Deletes the directory by the name + {fname}. This fails when directory {fname} is not empty. + + When {flags} is "rf": Deletes the directory by the name + {fname} and everything in it, recursively. BE CAREFUL! + Note: on MS-Windows it is not possible to delete a directory + that is being used. + + A symbolic link itself is deleted, not what it points to. + + The result is a Number, which is 0 if the delete operation was + successful and -1 when the deletion failed or partly failed. + Use |remove()| to delete an item from a |List|. - To delete a line from the buffer use |:delete|. Use |:exe| - when the line number is in a variable. + To delete a line from the buffer use |:delete| or + |deletebufline()|. + +deletebufline({expr}, {first}[, {last}]) *deletebufline()* + Delete lines {first} to {last} (inclusive) from buffer {expr}. + If {last} is omitted then delete line {first} only. + On success 0 is returned, on failure 1 is returned. + + For the use of {expr}, see |bufname()| above. + + {first} and {last} are used like with |setline()|. Note that + when using |line()| this refers to the current buffer. Use "$" + to refer to the last line in buffer {expr}. *did_filetype()* -did_filetype() Returns non-zero when autocommands are being executed and the +did_filetype() Returns |TRUE| when autocommands are being executed and the FileType event has been triggered at least once. Can be used to avoid triggering the FileType event again in the scripts that detect the file type. |FileType| + Returns |FALSE| when `:setf FALLBACK` was used. When editing another file, the counter is reset, thus this really checks if the FileType event has been triggered for the current buffer. This allows an autocommand that starts @@ -2688,8 +3568,14 @@ diff_hlID({lnum}, {col}) *diff_hlID()* empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. - A |List| or |Dictionary| is empty when it does not have any - items. A Number is empty when its value is zero. + - A |List| or |Dictionary| is empty when it does not have any + items. + - A String is empty when its length is zero. + - A Number and Float is empty when its value is zero. + - |v:false|, |v:none| and |v:null| are empty, |v:true| is not. + - A Job is empty when it failed to start. + - A Channel is empty when it is closed. + For a long |List| this is much faster than comparing the length with zero. @@ -2699,7 +3585,7 @@ escape({string}, {chars}) *escape()* :echo escape('c:\program files\vim', ' \') < results in: > c:\\program\ files\\vim -< Also see |shellescape()|. +< Also see |shellescape()| and |fnameescape()|. *eval()* eval({string}) Evaluate {string} and return the result. Especially useful to @@ -2722,10 +3608,10 @@ executable({expr}) *executable()* searchpath for programs. *PATHEXT* On MS-DOS and MS-Windows the ".exe", ".bat", etc. can optionally be included. Then the extensions in $PATHEXT are - tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be - found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is + tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be + found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot by itself can be used in $PATHEXT to try using - the name without an extension. When 'shell' looks like a + the name without an extension. When 'shell' looks like a Unix shell, then the name is also tried without adding an extension. On MS-DOS and MS-Windows it only checks if the file exists and @@ -2738,6 +3624,32 @@ executable({expr}) *executable()* 0 does not exist -1 not implemented on this system +execute({command} [, {silent}]) *execute()* + Execute an Ex command or commands and return the output as a + string. + {command} can be a string or a List. In case of a List the + lines are executed one by one. + This is equivalent to: > + redir => var + {command} + redir END +< + The optional {silent} argument can have these values: + "" no `:silent` used + "silent" `:silent` used + "silent!" `:silent!` used + The default is "silent". Note that with "silent!", unlike + `:redir`, error messages are dropped. When using an external + command the screen may be messed up, use `system()` instead. + *E930* + It is not possible to use `:redir` anywhere in {command}. + + To get a list of lines use |split()| on the result: > + split(execute('args'), "\n") + +< When used recursively the output of the recursive call is not + included in the output of the higher level call. + exepath({expr}) *exepath()* If {expr} is an executable and is either an absolute path, a relative path or found in $PATH, return the full path. @@ -2748,9 +3660,13 @@ exepath({expr}) *exepath()* an empty string is returned. *exists()* -exists({expr}) The result is a Number, which is non-zero if {expr} is - defined, zero otherwise. The {expr} argument is a string, - which contains one of these: +exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, + zero otherwise. + + For checking for a supported feature use |has()|. + For checking if a file exists use |filereadable()|. + + The {expr} argument is a string, which contains one of these: &option-name Vim option (only checks if it exists, not if it really works) +option-name Vim option that works. @@ -2762,7 +3678,7 @@ exists({expr}) The result is a Number, which is non-zero if {expr} is |user-functions|). Also works for a variable that is a Funcref. varname internal variable (see - |internal-variables|). Also works + |internal-variables|). Also works for |curly-braces-names|, |Dictionary| entries, |List| items, etc. Beware that evaluating an index may cause an @@ -2798,7 +3714,6 @@ exists({expr}) The result is a Number, which is non-zero if {expr} is event and pattern. ##event autocommand for this event is supported. - For checking for a supported feature use |has()|. Examples: > exists("&shortname") @@ -2845,13 +3760,13 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* Expand wildcards and the following special keywords in {expr}. 'wildignorecase' applies. - If {list} is given and it is non-zero, a List will be returned. + If {list} is given and it is |TRUE|, a List will be returned. Otherwise the result is a String and when there are several matches, they are separated by <NL> characters. [Note: in version 5.0 a space was used, which caused problems when a file name contains a space] - If the expansion fails, the result is an empty string. A name + If the expansion fails, the result is an empty string. A name for a non-existing file is not included, unless {expr} does not start with '%', '#' or '<', see below. @@ -2904,7 +3819,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* When {expr} does not start with '%', '#' or '<', it is expanded like a file name is expanded on the command line. 'suffixes' and 'wildignore' are used, unless the optional - {nosuf} argument is given and it is non-zero. + {nosuf} argument is given and it is |TRUE|. Names for non-existing files are included. The "**" item can be used to search in a directory tree. For example, to find all "README" files in the current directory and below: > @@ -2912,9 +3827,10 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* < Expand() can also be used to expand variables and environment variables that are only known in a shell. But this can be - slow, because a shell must be started. See |expr-env-expand|. + slow, because a shell may be used to do the expansion. See + |expr-env-expand|. The expanded variable is still handled like a list of file - names. When an environment variable cannot be expanded, it is + names. When an environment variable cannot be expanded, it is left unchanged. Thus ":echo expand('$FOOBAR')" results in "$FOOBAR". @@ -2937,7 +3853,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* items copied is equal to the original length of the List. E.g., when {expr3} is 1 you get N new copies of the first item (where N is the original length of the List). - Use |add()| to concatenate one item to a list. To concatenate + Use |add()| to concatenate one item to a list. To concatenate two lists into a new list use the + operator: > :let newlist = [1, 2, 3] + [4, 5] < @@ -2953,14 +3869,19 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* {expr1} is changed when {expr2} is not empty. If necessary make a copy of {expr1} first. {expr2} remains unchanged. + When {expr1} is locked and {expr2} is not empty the operation + fails. Returns {expr1}. feedkeys({string} [, {mode}]) *feedkeys()* Characters in {string} are queued for processing as if they - come from a mapping or were typed by the user. They are added - to the end of the typeahead buffer, thus if a mapping is still - being executed these characters come after them. + come from a mapping or were typed by the user. + By default the string is added to the end of the typeahead + buffer, thus if a mapping is still being executed the + characters come after them. Use the 'i' flag to insert before + other characters, they will be executed next, before any + characters from a mapping. The function does not wait for processing of keys contained in {string}. To include special keys into {string}, use double-quotes @@ -2974,12 +3895,25 @@ feedkeys({string} [, {mode}]) *feedkeys()* 't' Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, opening folds, etc. + 'i' Insert the string instead of appending (see above). + 'x' Execute commands until typeahead is empty. This is + similar to using ":normal!". You can call feedkeys() + several times without 'x' and then one time with 'x' + (possibly with an empty {string}) to execute all the + typeahead. Note that when Vim ends in Insert mode it + will behave as if <Esc> is typed, to avoid getting + stuck, waiting for a character to be typed before the + script continues. + '!' When used with 'x' will not end Insert mode. Can be + used in a test when a timer is set to exit Insert mode + a little later. Useful for testing CursorHoldI. + Return value is always 0. filereadable({file}) *filereadable()* - The result is a Number, which is TRUE when a file with the + The result is a Number, which is |TRUE| when a file with the name {file} exists, and can be read. If {file} doesn't exist, - or is a directory, the result is FALSE. {file} is any + or is a directory, the result is |FALSE|. {file} is any expression, which is used as a String. If you don't care about the file being readable you can use |glob()|. @@ -2994,34 +3928,54 @@ filewritable({file}) *filewritable()* directory, and we can write to it, the result is 2. -filter({expr}, {string}) *filter()* - {expr} must be a |List| or a |Dictionary|. - For each item in {expr} evaluate {string} and when the result +filter({expr1}, {expr2}) *filter()* + {expr1} must be a |List| or a |Dictionary|. + For each item in {expr1} evaluate {expr2} and when the result is zero remove the item from the |List| or |Dictionary|. - Inside {string} |v:val| has the value of the current item. - For a |Dictionary| |v:key| has the key of the current item. + {expr2} must be a |string| or |Funcref|. + + If {expr2} is a |string|, inside {expr2} |v:val| has the value + of the current item. For a |Dictionary| |v:key| has the key + of the current item and for a |List| |v:key| has the index of + the current item. Examples: > - :call filter(mylist, 'v:val !~ "OLD"') + call filter(mylist, 'v:val !~ "OLD"') < Removes the items where "OLD" appears. > - :call filter(mydict, 'v:key >= 8') + call filter(mydict, 'v:key >= 8') < Removes the items with a key below 8. > - :call filter(var, 0) + call filter(var, 0) < Removes all the items, thus clears the |List| or |Dictionary|. - Note that {string} is the result of expression and is then + Note that {expr2} is the result of expression and is then used as an expression again. Often it is good to use a |literal-string| to avoid having to double backslashes. + If {expr2} is a |Funcref| it must take two arguments: + 1. the key or the index of the current item. + 2. the value of the current item. + The function must return |TRUE| if the item should be kept. + Example that keeps the odd items of a list: > + func Odd(idx, val) + return a:idx % 2 == 1 + endfunc + call filter(mylist, function('Odd')) +< It is shorter when using a |lambda|: > + call filter(myList, {idx, val -> idx * val <= 42}) +< If you do not use "val" you can leave it out: > + call filter(myList, {idx -> idx % 2 == 1}) +< The operation is done in-place. If you want a |List| or |Dictionary| to remain unmodified make a copy first: > :let l = filter(copy(mylist), 'v:val =~ "KEEP"') -< Returns {expr}, the |List| or |Dictionary| that was filtered. - When an error is encountered while evaluating {string} no - further items in {expr} are processed. +< Returns {expr1}, the |List| or |Dictionary| that was filtered. + When an error is encountered while evaluating {expr2} no + further items in {expr1} are processed. When {expr2} is a + Funcref errors inside a function are ignored, unless it was + defined with the "abort" flag. -finddir({name}[, {path}[, {count}]]) *finddir()* +finddir({name} [, {path} [, {count}]]) *finddir()* Find directory {name} in {path}. Supports both downwards and upwards recursive directory searches. See |file-searching| for the syntax of {path}. @@ -3036,7 +3990,7 @@ finddir({name}[, {path}[, {count}]]) *finddir()* {only available when compiled with the |+file_in_path| feature} -findfile({name}[, {path}[, {count}]]) *findfile()* +findfile({name} [, {path} [, {count}]]) *findfile()* Just like |finddir()|, but find a file instead of a directory. Uses 'suffixesadd'. Example: > @@ -3049,17 +4003,19 @@ float2nr({expr}) *float2nr()* decimal point. {expr} must evaluate to a |Float| or a Number. When the value of {expr} is out of range for a |Number| the - result is truncated to 0x7fffffff or -0x7fffffff. NaN results - in -0x80000000. + result is truncated to 0x7fffffff or -0x7fffffff (or when + 64-bit Number support is enabled, 0x7fffffffffffffff or + -0x7fffffffffffffff). NaN results in -0x80000000 (or when + 64-bit Number support is enabled, -0x8000000000000000). Examples: > echo float2nr(3.95) < 3 > echo float2nr(-23.45) < -23 > echo float2nr(1.0e100) -< 2147483647 > +< 2147483647 (or 9223372036854775807) > echo float2nr(-1.0e150) -< -2147483647 > +< -2147483647 (or -9223372036854775807) > echo float2nr(1.0e-100) < 0 {only available when compiled with the |+float| feature} @@ -3077,7 +4033,7 @@ floor({expr}) *floor()* echo floor(4.0) < 4.0 {only available when compiled with the |+float| feature} - + fmod({expr1}, {expr2}) *fmod()* Return the remainder of {expr1} / {expr2}, even if the @@ -3096,7 +4052,7 @@ fmod({expr1}, {expr2}) *fmod()* fnameescape({string}) *fnameescape()* - Escape {string} for use as file name command argument. All + Escape {string} for use as file name command argument. All characters that have a special meaning, such as '%' and '|' are escaped with a backslash. For most systems the characters escaped are @@ -3133,7 +4089,7 @@ foldclosedend({lnum}) *foldclosedend()* foldlevel({lnum}) *foldlevel()* The result is a Number, which is the foldlevel of line {lnum} - in the current buffer. For nested folds the deepest level is + in the current buffer. For nested folds the deepest level is returned. If there is no fold at line {lnum}, zero is returned. It doesn't matter if the folds are open or closed. When used while updating folds (from 'foldexpr') -1 is @@ -3148,11 +4104,14 @@ foldtext() Returns a String, to be displayed for a closed fold. This is |v:foldstart|, |v:foldend| and |v:folddashes| variables. The returned string looks like this: > +-- 45 lines: abcdef -< The number of dashes depends on the foldlevel. The "45" is - the number of lines in the fold. "abcdef" is the text in the - first non-blank line of the fold. Leading white space, "//" - or "/*" and the text from the 'foldmarker' and 'commentstring' - options is removed. +< The number of leading dashes depends on the foldlevel. The + "45" is the number of lines in the fold. "abcdef" is the text + in the first non-blank line of the fold. Leading white space, + "//" or "/*" and the text from the 'foldmarker' and + 'commentstring' options is removed. + When used to draw the actual foldtext, the rest of the line + will be filled with the fold char from the 'fillchars' + setting. {not available when compiled without the |+folding| feature} foldtextresult({lnum}) *foldtextresult()* @@ -3166,7 +4125,7 @@ foldtextresult({lnum}) *foldtextresult()* {not available when compiled without the |+folding| feature} *foreground()* -foreground() Move the Vim window to the foreground. Useful when sent from +foreground() Move the Vim window to the foreground. Useful when sent from a client to a Vim server. |remote_send()| On Win32 systems this might not work, the OS does not always allow a window to bring itself to the foreground. Use @@ -3174,26 +4133,105 @@ foreground() Move the Vim window to the foreground. Useful when sent from {only in the Win32, Athena, Motif and GTK GUI versions and the Win32 console version} + *funcref()* +funcref({name} [, {arglist}] [, {dict}]) + Just like |function()|, but the returned Funcref will lookup + the function by reference, not by name. This matters when the + function {name} is redefined later. -function({name}) *function()* *E700* + Unlike |function()|, {name} must be an existing user function. + Also for autoloaded functions. {name} cannot be a builtin + function. + + *function()* *E700* *E922* *E923* +function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. - {name} can be a user defined function or an internal function. + {name} can be the name of a user defined function or an + internal function. + + {name} can also be a Funcref or a partial. When it is a + partial the dict stored in it will be used and the {dict} + argument is not allowed. E.g.: > + let FuncWithArg = function(dict.Func, [arg]) + let Broken = function(dict.Func, [arg], dict) +< + When using the Funcref the function will be found by {name}, + also when it was redefined later. Use |funcref()| to keep the + same function. + + When {arglist} or {dict} is present this creates a partial. + That means the argument list and/or the dictionary is stored in + the Funcref and will be used when the Funcref is called. + + The arguments are passed to the function in front of other + arguments. Example: > + func Callback(arg1, arg2, name) + ... + let Func = function('Callback', ['one', 'two']) + ... + call Func('name') +< Invokes the function as with: > + call Callback('one', 'two', 'name') + +< The function() call can be nested to add more arguments to the + Funcref. The extra arguments are appended to the list of + arguments. Example: > + func Callback(arg1, arg2, name) + ... + let Func = function('Callback', ['one']) + let Func2 = function(Func, ['two']) + ... + call Func2('name') +< Invokes the function as with: > + call Callback('one', 'two', 'name') + +< The Dictionary is only useful when calling a "dict" function. + In that case the {dict} is passed in as "self". Example: > + function Callback() dict + echo "called for " . self.name + endfunction + ... + let context = {"name": "example"} + let Func = function('Callback', context) + ... + call Func() " will echo: called for example +< The use of function() is not needed when there are no extra + arguments, these two are equivalent: > + let Func = function('Callback', context) + let Func = context.Callback + +< The argument list and the Dictionary can be combined: > + function Callback(arg1, count) dict + ... + let context = {"name": "example"} + let Func = function('Callback', ['one'], context) + ... + call Func(500) +< Invokes the function as with: > + call context.Callback('one', 500) garbagecollect([{atexit}]) *garbagecollect()* - Cleanup unused |Lists| and |Dictionaries| that have circular - references. There is hardly ever a need to invoke this - function, as it is automatically done when Vim runs out of - memory or is waiting for the user to press a key after - 'updatetime'. Items without circular references are always - freed when they become unused. + Cleanup unused |Lists|, |Dictionaries|, |Channels| and |Jobs| + that have circular references. + + There is hardly ever a need to invoke this function, as it is + automatically done when Vim runs out of memory or is waiting + for the user to press a key after 'updatetime'. Items without + circular references are always freed when they become unused. This is useful if you have deleted a very big |List| and/or |Dictionary| with circular references in a script that runs for a long time. + When the optional {atexit} argument is one, garbage collection will also be done when exiting Vim, if it wasn't done before. This is useful when checking for memory leaks. + The garbage collection is not done immediately but only when + it's safe to perform. This is when waiting for the user to + type a character. To force garbage collection immediately use + |test_garbagecollect_now()|. + get({list}, {idx} [, {default}]) *get()* Get item {idx} from |List| {list}. When this item is not available return {default}. Return zero when {default} is @@ -3202,7 +4240,69 @@ get({dict}, {key} [, {default}]) Get item with key {key} from |Dictionary| {dict}. When this item is not available return {default}. Return zero when {default} is omitted. +get({func}, {what}) + Get an item with from Funcref {func}. Possible values for + {what} are: + "name" The function name + "func" The function + "dict" The dictionary + "args" The list with arguments + + *getbufinfo()* +getbufinfo([{expr}]) +getbufinfo([{dict}]) + Get information about buffers as a List of Dictionaries. + + Without an argument information about all the buffers is + returned. + + When the argument is a Dictionary only the buffers matching + the specified criteria are returned. The following keys can + be specified in {dict}: + buflisted include only listed buffers. + bufloaded include only loaded buffers. + bufmodified include only modified buffers. + + Otherwise, {expr} specifies a particular buffer to return + information for. For the use of {expr}, see |bufname()| + above. If the buffer is found the returned List has one item. + Otherwise the result is an empty list. + Each returned List item is a dictionary with the following + entries: + bufnr buffer number. + changed TRUE if the buffer is modified. + changedtick number of changes made to the buffer. + hidden TRUE if the buffer is hidden. + listed TRUE if the buffer is listed. + lnum current line number in buffer. + loaded TRUE if the buffer is loaded. + name full path to the file in the buffer. + signs list of signs placed in the buffer. + Each list item is a dictionary with + the following fields: + id sign identifier + lnum line number + name sign name + variables a reference to the dictionary with + buffer-local variables. + windows list of |window-ID|s that display this + buffer + + Examples: > + for buf in getbufinfo() + echo buf.name + endfor + for buf in getbufinfo({'buflisted':1}) + if buf.changed + .... + endif + endfor +< + To get buffer-local options use: > + getbufvar({bufnr}, '&') + +< *getbufline()* getbufline({expr}, {lnum} [, {end}]) Return a |List| with the lines starting from {lnum} to {end} @@ -3234,6 +4334,10 @@ getbufvar({expr}, {varname} [, {def}]) *getbufvar()* must be used. When {varname} is empty returns a dictionary with all the buffer-local variables. + When {varname} is equal to "&" returns a dictionary with all + the buffer-local options. + Otherwise, when {varname} starts with "&" returns the value of + a buffer-local option. This also works for a global or buffer-local option, but it doesn't work for a global variable, window-local variable or window-local option. @@ -3244,6 +4348,22 @@ getbufvar({expr}, {varname} [, {def}]) *getbufvar()* :let bufmodified = getbufvar(1, "&mod") :echo "todo myvar = " . getbufvar("todo", "myvar") < +getchangelist({expr}) *getchangelist()* + Returns the |changelist| for the buffer {expr}. For the use + of {expr}, see |bufname()| above. If buffer {expr} doesn't + exist, an empty list is returned. + + The returned list contains two entries: a list with the change + locations and the current position in the list. Each + entry in the change list is a dictionary with the following + entries: + col column number + coladd column offset for 'virtualedit' + lnum line number + If buffer {expr} is the current buffer, then the current + position refers to the position in the list. For other + buffers, it is set to the length of the list. + getchar([expr]) *getchar()* Get a single character from the user or input stream. If [expr] is omitted, wait until a character is available. @@ -3253,14 +4373,14 @@ getchar([expr]) *getchar()* not consumed. Return zero if no character available. Without [expr] and when [expr] is 0 a whole character or - special key is returned. If it is an 8-bit character, the + special key is returned. If it is a single character, the result is a number. Use nr2char() to convert it to a String. Otherwise a String is returned with the encoded character. - For a special key it's a sequence of bytes starting with 0x80 - (decimal: 128). This is the same value as the string - "\<Key>", e.g., "\<Left>". The returned value is also a - String when a modifier (shift, control, alt) was used that is - not included in the character. + For a special key it's a String with a sequence of bytes + starting with 0x80 (decimal: 128). This is the same value as + the String "\<Key>", e.g., "\<Left>". The returned value is + also a String when a modifier (shift, control, alt) was used + that is not included in the character. When [expr] is 0 and Esc is typed, there will be a short delay while Vim waits to see if this is the start of an escape @@ -3274,8 +4394,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" @@ -3283,6 +4403,10 @@ getchar([expr]) *getchar()* exe "normal " . v:mouse_col . "|" endif < + When using bracketed paste only the first character is + returned, the rest of the pasted text is dropped. + |xterm-bracketed-paste|. + There is no prompt, you will somehow have to make clear to the user that a character has to be typed. There is no mapping for the character. @@ -3302,6 +4426,17 @@ getchar([expr]) *getchar()* : endif : endwhile :endfunction +< + You may also receive synthetic characters, such as + |<CursorHold>|. Often you will want to ignore this and get + another character: > + :function GetKey() + : let c = getchar() + : while c == "\<CursorHold>" + : let c = getchar() + : endwhile + : return c + :endfunction getcharmod() *getcharmod()* The result is a Number which is the state of the modifiers for @@ -3316,9 +4451,29 @@ getcharmod() *getcharmod()* 96 mouse quadruple click (== 32 + 64) 128 command (Macintosh only) Only the modifiers that have not been included in the - character itself are obtained. Thus Shift-a results in "A" + character itself are obtained. Thus Shift-a results in "A" without a modifier. +getcharsearch() *getcharsearch()* + Return the current character search information as a {dict} + with the following entries: + + char character previously used for a character + search (|t|, |f|, |T|, or |F|); empty string + if no character search has been performed + forward direction of character search; 1 for forward, + 0 for backward + until type of character search; 1 for a |t| or |T| + character search, 0 for an |f| or |F| + character search + + This can be useful to always have |;| and |,| search + forward/backward regardless of the direction of the previous + character search: > + :nnoremap <expr> ; getcharsearch().forward ? ';' : ',' + :nnoremap <expr> , getcharsearch().forward ? ',' : ';' +< Also see |setcharsearch()|. + getcmdline() *getcmdline()* Return the current command-line. Only works when the command line is being edited, thus requires use of |c_CTRL-\_e| or @@ -3344,25 +4499,96 @@ getcmdtype() *getcmdtype()* ? backward search command @ |input()| command - |:insert| or |:append| command + = |i_CTRL-R_=| Only works when editing the command line, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. Returns an empty string otherwise. Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|. +getcmdwintype() *getcmdwintype()* + Return the current |command-line-window| type. Possible return + values are the same as |getcmdtype()|. Returns an empty string + when not in the command-line window. + +getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* + Return a list of command-line completion matches. {type} + specifies what for. The following completion types are + supported: + + arglist file names in argument list + augroup autocmd groups + buffer buffer names + behave :behave suboptions + color color schemes + command Ex command (and arguments) + compiler compilers + cscope |:cscope| suboptions + dir directory names + environment environment variable names + event autocommand events + expression Vim expression + file file and directory names + file_in_path file and directory names in |'path'| + filetype filetype names |'filetype'| + function function name + help help subjects + highlight highlight groups + history :history suboptions + locale locale names (as output of locale -a) + mapclear buffer argument + mapping mapping name + menu menus + messages |:messages| suboptions + option options + packadd optional package |pack-add| names + shellcmd Shell command + sign |:sign| suboptions + syntax syntax file names |'syntax'| + syntime |:syntime| suboptions + tag tags + tag_listfiles tags, file names + user user names + var user variables + + If {pat} is an empty string, then all the matches are returned. + 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. + *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: - [bufnum, lnum, col, off, curswant] + [bufnum, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the - cursor vertically. + cursor vertically. Also see |getpos()|. + This can be used to save and restore the cursor position: > let save_cursor = getcurpos() MoveTheCursorAround call setpos('.', save_cursor) - +< Note that this only works within the window. See + |winrestview()| for restoring more state. *getcwd()* -getcwd() The result is a String, which is the name of the current +getcwd([{winnr} [, {tabnr}]]) + The result is a String, which is the name of the current working directory. + Without arguments, for the current window. + + With {winnr} return the local current directory of this window + in the current tab page. {winnr} can be the window number or + the |window-ID|. + If {winnr} is -1 return the name of the global working + directory. See also |haslocaldir()|. + + With {winnr} and {tabnr} return the local current directory of + the window in the specified tab page. + Return an empty string if the arguments are invalid. getfsize({fname}) *getfsize()* The result is a Number, which is the size in bytes of the @@ -3383,8 +4609,8 @@ getfontname([{name}]) *getfontname()* Only works when the GUI is running, thus not in your vimrc or gvimrc file. Use the |GUIEnter| autocommand to use this function just after the GUI has started. - Note that the GTK 2 GUI accepts any font name, thus checking - for a valid name does not work. + Note that the GTK GUI accepts any font name, thus checking for + a valid name does not work. getfperm({fname}) *getfperm()* The result is a String, which is the read, write, and execute @@ -3401,6 +4627,8 @@ getfperm({fname}) *getfperm()* < This will hopefully (from a security point of view) display the string "rw-r--r--" or even "rw-------". + For setting permissions use |setfperm()|. + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -3426,7 +4654,27 @@ getftype({fname}) *getftype()* getftype("/home") < Note that a type such as "link" will only be returned on systems that support it. On some systems only "dir" and - "file" are returned. + "file" are returned. On MS-Windows a symbolic link to a + directory returns "dir" instead of "link". + +getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* + Returns the |jumplist| for the specified window. + + Without arguments use the current window. + With {winnr} only use this window in the current tab page. + {winnr} can also be a |window-ID|. + With {winnr} and {tabnr} use the window in the specified tab + page. + + The returned list contains two entries: a list with the jump + locations and the last used jump position number in the list. + Each entry in the jump location list is a dictionary with + the following entries: + bufnr buffer number + col column number + coladd column offset for 'virtualedit' + filename filename if available + lnum line number *getline()* getline({lnum} [, {end}]) @@ -3434,7 +4682,7 @@ getline({lnum} [, {end}]) from the current buffer. Example: > getline(1) < When {lnum} is a String that doesn't start with a - digit, line() is called to translate the String into a Number. + digit, |line()| is called to translate the String into a Number. To get the line under the cursor: > getline(".") < When {lnum} is smaller than 1 or bigger than the number of @@ -3453,13 +4701,19 @@ getline({lnum} [, {end}]) < To get lines from another buffer see |getbufline()| -getloclist({nr}) *getloclist()* +getloclist({nr} [, {what}]) *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()|. + If the optional {what} dictionary argument is supplied, then + returns the items listed in {what} as a dictionary. Refer to + |getqflist()| for the supported items in {what}. + getmatches() *getmatches()* Returns a |List| with all matches previously defined by |matchadd()| and the |:match| commands. |getmatches()| is @@ -3484,7 +4738,7 @@ getmatches() *getmatches()* *getpid()* getpid() Return a Number which is the process ID of the Vim process. On Unix and MS-Windows this is a unique number, until Vim - exits. On MS-DOS it's always zero. + exits. On MS-DOS it's always zero. *getpos()* getpos({expr}) Get the position for {expr}. For possible values of {expr} @@ -3506,26 +4760,27 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr} This can be used to save and restore the position of a mark: > let save_a_mark = getpos("'a") ... - call setpos(''a', save_a_mark + call setpos("'a", save_a_mark) < Also see |getcurpos()| and |setpos()|. -getqflist() *getqflist()* +getqflist([{what}]) *getqflist()* Returns a list with all the current quickfix errors. Each list item is a dictionary with these entries: bufnr number of buffer that has the file name, use bufname() to get the name + module module name lnum line number in the buffer (first line is 1) col column number (first column is 1) - vcol non-zero: "col" is visual column - zero: "col" is byte index + vcol |TRUE|: "col" is visual column + |FALSE|: "col" is byte index nr error number pattern search pattern used to locate the error text description of the error type type of the error, 'E', '1', etc. - valid non-zero: recognized error message + valid |TRUE|: recognized error message - When there is no error list or it's empty an empty list is + When there is no error list or it's empty, an empty list is returned. Quickfix list entries with non-existing buffer number are returned with "bufnr" set to zero. @@ -3535,22 +4790,86 @@ getqflist() *getqflist()* :for d in getqflist() : echo bufname(d.bufnr) ':' d.lnum '=' d.text :endfor - - +< + If the optional {what} dictionary argument is supplied, then + returns only the items listed in {what} as a dictionary. The + following string items are supported in {what}: + changedtick get the total number of changes made + to the list |quickfix-changedtick| + context get the |quickfix-context| + efm errorformat to use when parsing "lines". If + not present, then the 'errorformat' option + value is used. + id get information for the quickfix list with + |quickfix-ID|; zero means the id for the + current list or the list specified by "nr" + idx index of the current entry in the list + items quickfix list entries + lines parse a list of lines using 'efm' and return + the resulting entries. Only a |List| type is + accepted. The current quickfix list is not + modified. See |quickfix-parse|. + nr get information for this quickfix list; zero + means the current quickfix list and "$" means + the last quickfix list + size number of entries in the quickfix list + title get the list title |quickfix-title| + winid get the quickfix |window-ID| + all all of the above quickfix properties + Non-string items in {what} are ignored. To get the value of a + particular item, set it to zero. + If "nr" is not present then the current quickfix list is used. + If both "nr" and a non-zero "id" are specified, then the list + specified by "id" is used. + To get the number of lists in the quickfix stack, set "nr" to + "$" in {what}. The "nr" value in the returned dictionary + contains the quickfix stack size. + When "lines" is specified, all the other items except "efm" + are ignored. The returned dictionary contains the entry + "items" with the list of entries. + + The returned dictionary contains the following entries: + changedtick total number of changes made to the + list |quickfix-changedtick| + context quickfix list context. See |quickfix-context| + If not present, set to "". + id quickfix list ID |quickfix-ID|. If not + present, set to 0. + idx index of the current entry in the list. If not + present, set to 0. + items quickfix list entries. If not present, set to + an empty list. + nr quickfix list number. If not present, set to 0 + size number of entries in the quickfix list. If not + present, set to 0. + title quickfix list title text. If not present, set + to "". + winid quickfix |window-ID|. If not present, set to 0 + + Examples (See also |getqflist-examples|): > + :echo getqflist({'all': 1}) + :echo getqflist({'nr': 2, 'title': 1}) + :echo getqflist({'lines' : ["F1:10:L10"]}) +< getreg([{regname} [, 1 [, {list}]]]) *getreg()* The result is a String, which is the contents of register {regname}. Example: > :let cliptext = getreg('*') -< getreg('=') returns the last evaluated value of the expression +< When {regname} was not set the result is an empty string. + + getreg('=') returns the last evaluated value of the expression register. (For use in maps.) getreg('=', 1) returns the expression itself, so that it can be restored with |setreg()|. For other registers the extra argument is ignored, thus you can always give it. - If {list} is present and non-zero result type is changed to - |List|. Each list item is one text line. Use it if you care + + If {list} is present and |TRUE|, the result type is changed + to |List|. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see |NL-used-for-Nul|). + When the register was not set an empty list is returned. + If {regname} is not specified, |v:register| is used. @@ -3564,10 +4883,25 @@ getregtype([{regname}]) *getregtype()* <CTRL-V> is one character with value 0x16. If {regname} is not specified, |v:register| is used. +gettabinfo([{arg}]) *gettabinfo()* + If {arg} is not specified, then information about all the tab + pages is returned as a List. Each List item is a Dictionary. + Otherwise, {arg} specifies the tab page number and information + about that one is returned. If the tab page does not exist an + empty List is returned. + + Each List item is a Dictionary with the following entries: + tabnr tab page number. + variables a reference to the dictionary with + tabpage-local variables + windows List of |window-ID|s in the tag page. + gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| Tabs are numbered starting with one. + When {varname} is empty a dictionary with all tab-local + variables is returned. Note that the name without "t:" must be used. When the tab or variable doesn't exist {def} or an empty string is returned, there is no error message. @@ -3575,13 +4909,16 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. - When {varname} starts with "&" get the value of a window-local - option. When {varname} is empty a dictionary with all window-local variables is returned. + When {varname} is equal to "&" get the values of all + window-local options in a Dictionary. + Otherwise, when {varname} starts with "&" get the value of a + window-local option. 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 @@ -3591,16 +4928,70 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Examples: > :let list_is_on = gettabwinvar(1, 2, '&list') :echo "myvar = " . gettabwinvar(3, 1, 'myvar') +< +getwinpos([{timeout}]) *getwinpos()* + The result is a list with two numbers, the result of + getwinposx() and getwinposy() combined: + [x-pos, y-pos] + {timeout} can be used to specify how long to wait in msec for + a response from the terminal. When omitted 100 msec is used. + Use a longer time for a remote terminal. + When using a value less than 10 and no response is received + within that time, a previously reported position is returned, + if available. This can be used to poll for the position and + do some work in the mean time: > + while 1 + let res = getwinpos(1) + if res[0] >= 0 + break + endif + " Do some work here + endwhile < *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of - the left hand side of the GUI Vim window. The result will be - -1 if the information is not available. + the left hand side of the GUI Vim window. Also works for an + xterm (uses a timeout of 100 msec). + The result will be -1 if the information is not available. + The value can be used with `:winpos`. *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of - the top of the GUI Vim window. The result will be -1 if the - information is not available. + the top of the GUI Vim window. Also works for an xterm (uses + a timeout of 100 msec). + The result will be -1 if the information is not available. + The value can be used with `:winpos`. + +getwininfo([{winid}]) *getwininfo()* + Returns information about windows as a List with Dictionaries. + + If {winid} is given Information about the window with that ID + is returned. If the window does not exist the result is an + empty list. + + Without {winid} information about all the windows in all the + tab pages is returned. + + Each List item is a Dictionary with the following entries: + bufnr number of buffer in the window + height window height (excluding winbar) + winbar 1 if the window has a toolbar, 0 + otherwise + loclist 1 if showing a location list + {only with the +quickfix feature} + quickfix 1 if quickfix or location list window + {only with the +quickfix feature} + terminal 1 if a terminal window + {only with the +terminal feature} + tabnr tab page number + variables a reference to the dictionary with + window-local variables + width window width + winid |window-ID| + winnr window number + + To obtain all window-local variables use: > + gettabwinvar({tabnr}, {winnr}, '&') getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Like |gettabwinvar()| for the current tabpage. @@ -3608,37 +4999,53 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') < -glob({expr} [, {nosuf} [, {list}]]) *glob()* +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the use of special characters. - Unless the optional {nosuf} argument is given and is non-zero, + Unless the optional {nosuf} argument is given and is |TRUE|, the 'suffixes' and 'wildignore' options apply: Names matching one of the patterns in 'wildignore' will be skipped and 'suffixes' affect the ordering of matches. 'wildignorecase' always applies. - When {list} is present and it is non-zero the result is a List + When {list} is present and it is |TRUE| the result is a List with all matching files. The advantage of using a List is, you also get filenames containing newlines correctly. Otherwise the result is a String and when there are several matches, they are separated by <NL> characters. If the expansion fails, the result is an empty String or List. + A name for a non-existing file is not included. A symbolic link is only included if it points to an existing file. + However, when the {alllinks} argument is present and it is + |TRUE| then all symbolic links are included. For most systems backticks can be used to get files names from any external command. Example: > :let tagfiles = glob("`find . -name tags -print`") :let &tags = substitute(tagfiles, "\n", ",", "g") < The result of the program inside the backticks should be one - item per line. Spaces inside an item are allowed. + item per line. Spaces inside an item are allowed. See |expand()| for expanding special Vim variables. See |system()| for getting the raw output of an external command. -globpath({path}, {expr} [, {nosuf} [, {list}]]) *globpath()* +glob2regpat({expr}) *glob2regpat()* + Convert a file pattern, as used by glob(), into a search + pattern. The result can be used to match with a string that + is a file name. E.g. > + if filename =~ glob2regpat('Make*.mak') +< This is equivalent to: > + if filename =~ '^Make.*\.mak$' +< When {expr} is an empty string the result is "^$", match an + empty string. + Note that the result depends on the system. On MS-Windows + a backslash usually means a path separator. + + *globpath()* +globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) Perform glob() on all directories in {path} and concatenate the results. Example: > :echo globpath(&rtp, "syntax/c.vim") @@ -3652,18 +5059,20 @@ globpath({path}, {expr} [, {nosuf} [, {list}]]) *globpath()* If the expansion fails for one of the directories, there is no error message. - Unless the optional {nosuf} argument is given and is non-zero, + Unless the optional {nosuf} argument is given and is |TRUE|, the 'suffixes' and 'wildignore' options apply: Names matching one of the patterns in 'wildignore' will be skipped and 'suffixes' affect the ordering of matches. - When {list} is present and it is non-zero the result is a List + When {list} is present and it is |TRUE| the result is a List with all matching files. The advantage of using a List is, you also get filenames containing newlines correctly. Otherwise the result is a String and when there are several matches, they are separated by <NL> characters. Example: > :echo globpath(&rtp, "syntax/c.vim", 0, 1) < + {alllinks} is used as with |glob()|. + The "**" item can be used to search in a directory tree. For example, to find all "README.txt" files in the directories in 'runtimepath' and below: > @@ -3682,16 +5091,23 @@ has_key({dict}, {key}) *has_key()* The result is a Number, which is 1 if |Dictionary| {dict} has an entry with key {key}. Zero otherwise. -haslocaldir() *haslocaldir()* - The result is a Number, which is 1 when the current - window has set a local path via |:lcd|, and 0 otherwise. +haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()* + The result is a Number, which is 1 when the window has set a + local path via |:lcd|, and 0 otherwise. + + Without arguments use the current window. + With {winnr} 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|. + Return 0 if the arguments are invalid. hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is 1 if there is a mapping that contains {what} in somewhere in the rhs (what it is mapped to) and this mapping exists in one of the modes indicated by {mode}. - When {abbr} is there and it is non-zero use abbreviations + When {abbr} is there and it is |TRUE| use abbreviations instead of mappings. Don't forget to specify Insert and/or Command-line mode. Both the global mappings and the mappings local to the current @@ -3707,7 +5123,7 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* When {mode} is omitted, "nvo" is used. This function is useful to check if a mapping already exists - to a function in a Vim script. Example: > + to a function in a Vim script. Example: > :if !hasmapto('\ABCdoit') : map <Leader>d \ABCdoit :endif @@ -3722,6 +5138,7 @@ histadd({history}, {item}) *histadd()* "expr" or "=" typed expression history "input" or "@" input line history "debug" or ">" debug command history + empty the current or last used history The {history} string does not need to be the whole name, one character is sufficient. If {item} does already exist in the history, it will be @@ -3803,7 +5220,7 @@ hlID({name}) The result is a Number, which is the ID of the highlight group with name {name}. When the highlight group doesn't exist, zero is returned. This can be used to retrieve information about the highlight - group. For example, to get the background color of the + group. For example, to get the background color of the "Comment" group: > :echo synIDattr(synIDtrans(hlID("Comment")), "bg") < *highlightID()* @@ -3850,7 +5267,7 @@ index({list}, {expr} [, {start} [, {ic}]]) *index()* is not used here, case always matters. If {start} is given then start looking at the item with index {start} (may be negative for an item relative to the end). - When {ic} is given and it is non-zero, ignore case. Otherwise + When {ic} is given and it is |TRUE|, ignore case. Otherwise case must match. -1 is returned when {expr} is not found in {list}. Example: > @@ -3865,7 +5282,7 @@ input({prompt} [, {text} [, {completion}]]) *input()* in the prompt to start a new line. The highlighting set with |:echohl| is used for the prompt. The input is entered just like a command-line, with the same - editing commands and mappings. There is a separate history + editing commands and mappings. There is a separate history for lines typed for input(). Example: > :if input("Coffee or beer? ") == "beer" @@ -3879,9 +5296,9 @@ input({prompt} [, {text} [, {completion}]]) *input()* < The optional {completion} argument specifies the type of completion supported for the input. Without it completion is - not performed. The supported completion types are the same as + not performed. The supported completion types are the same as that can be supplied to a user-defined command using the - "-complete=" argument. Refer to |:command-completion| for + "-complete=" argument. Refer to |:command-completion| for more information. Example: > let fname = input("File: ", "", "file") < @@ -3922,12 +5339,12 @@ inputlist({textlist}) *inputlist()* displayed, one string per line. The user will be prompted to enter a number, which is returned. The user can also select an item by clicking on it with the - mouse. For the first string 0 is returned. When clicking + mouse. For the first string 0 is returned. When clicking above the first item a negative number is returned. When clicking on the prompt one more than the length of {textlist} is returned. Make sure {textlist} has less than 'lines' entries, otherwise - it won't work. It's a good idea to put the entry number at + it won't work. It's a good idea to put the entry number at the start of the string. And put a prompt in the first item. Example: > let color = inputlist(['Select color:', '1. red', @@ -3961,7 +5378,7 @@ inputsecret({prompt} [, {text}]) *inputsecret()* insert({list}, {item} [, {idx}]) *insert()* Insert {item} at the start of |List| {list}. If {idx} is specified insert {item} before the item with index - {idx}. If {idx} is zero it goes before the first item, just + {idx}. If {idx} is zero it goes before the first item, just like omitting {idx}. A negative {idx} is also possible, see |list-index|. -1 inserts just before the last item. Returns the resulting |List|. Examples: > @@ -3978,13 +5395,13 @@ invert({expr}) *invert()* :let bits = invert(bits) isdirectory({directory}) *isdirectory()* - The result is a Number, which is non-zero when a directory + The result is a Number, which is |TRUE| when a directory with the name {directory} exists. If {directory} doesn't - exist, or isn't a directory, the result is FALSE. {directory} + exist, or isn't a directory, the result is |FALSE|. {directory} is any expression, which is used as a String. islocked({expr}) *islocked()* *E786* - The result is a Number, which is non-zero when {expr} is the + The result is a Number, which is |TRUE| when {expr} is the name of a locked variable. {expr} must be the name of a variable, |List| item or |Dictionary| entry, not the variable itself! Example: > @@ -3996,12 +5413,146 @@ islocked({expr}) *islocked()* *E786* < When {expr} is a variable that does not exist you get an error message. Use |exists()| to check for existence. +isnan({expr}) *isnan()* + Return |TRUE| if {expr} is a float with value NaN. > + echo isnan(0.0 / 0.0) +< 1 ~ + + {only available when compiled with the |+float| feature} + items({dict}) *items()* Return a |List| with all the key-value pairs of {dict}. Each |List| item is a list with two items: the key of a {dict} entry and the value of this entry. The |List| is in arbitrary order. +job_getchannel({job}) *job_getchannel()* + Get the channel handle that {job} is using. + To check if the job has no channel: > + if string(job_getchannel()) == 'channel fail' +< + {only available when compiled with the |+job| feature} + +job_info([{job}]) *job_info()* + Returns a Dictionary with information about {job}: + "status" what |job_status()| returns + "channel" what |job_getchannel()| returns + "cmd" List of command arguments used to start the job + "process" process ID + "tty_in" terminal input name, empty when none + "tty_out" terminal output name, empty when none + "exitval" only valid when "status" is "dead" + "exit_cb" function to be called on exit + "stoponexit" |job-stoponexit| + + Without any arguments, returns a List with all Job objects. + +job_setoptions({job}, {options}) *job_setoptions()* + Change options for {job}. Supported are: + "stoponexit" |job-stoponexit| + "exit_cb" |job-exit_cb| + +job_start({command} [, {options}]) *job_start()* + Start a job and return a Job object. Unlike |system()| and + |:!cmd| this does not wait for the job to finish. + To start a job in a terminal window see |term_start()|. + + {command} can be a String. This works best on MS-Windows. On + Unix it is split up in white-separated parts to be passed to + execvp(). Arguments in double quotes can contain white space. + + {command} can be a List, where the first item is the executable + and further items are the arguments. All items are converted + to String. This works best on Unix. + + On MS-Windows, job_start() makes a GUI application hidden. If + want to show it, Use |:!start| instead. + + The command is executed directly, not through a shell, the + 'shell' option is not used. To use the shell: > + let job = job_start(["/bin/sh", "-c", "echo hello"]) +< Or: > + let job = job_start('/bin/sh -c "echo hello"') +< Note that this will start two processes, the shell and the + command it executes. If you don't want this use the "exec" + shell command. + + On Unix $PATH is used to search for the executable only when + the command does not contain a slash. + + The job will use the same terminal as Vim. If it reads from + stdin the job and Vim will be fighting over input, that + doesn't work. Redirect stdin and stdout to avoid problems: > + let job = job_start(['sh', '-c', "myserver </dev/null >/dev/null"]) +< + The returned Job object can be used to get the status with + |job_status()| and stop the job with |job_stop()|. + + {options} must be a Dictionary. It can contain many optional + items, see |job-options|. + + {only available when compiled with the |+job| feature} + +job_status({job}) *job_status()* *E916* + Returns a String with the status of {job}: + "run" job is running + "fail" job failed to start + "dead" job died or was stopped after running + + On Unix a non-existing command results in "dead" instead of + "fail", because a fork happens before the failure can be + detected. + + If an exit callback was set with the "exit_cb" option and the + job is now detected to be "dead" the callback will be invoked. + + For more information see |job_info()|. + + {only available when compiled with the |+job| feature} + +job_stop({job} [, {how}]) *job_stop()* + Stop the {job}. This can also be used to signal the job. + + When {how} is omitted or is "term" the job will be terminated. + For Unix SIGTERM is sent. On MS-Windows the job will be + terminated forcedly (there is no "gentle" way). + This goes to the process group, thus children may also be + affected. + + Effect for Unix: + "term" SIGTERM (default) + "hup" SIGHUP + "quit" SIGQUIT + "int" SIGINT + "kill" SIGKILL (strongest way to stop) + number signal with that number + + Effect for MS-Windows: + "term" terminate process forcedly (default) + "hup" CTRL_BREAK + "quit" CTRL_BREAK + "int" CTRL_C + "kill" terminate process forcedly + Others CTRL_BREAK + + On Unix the signal is sent to the process group. This means + that when the job is "sh -c command" it affects both the shell + and the command. + + The result is a Number: 1 if the operation could be executed, + 0 if "how" is not supported on the system. + Note that even when the operation was executed, whether the + job was actually stopped needs to be checked with + |job_status()|. + + If the status of the job is "dead", the signal will not be + sent. This is to avoid to stop the wrong job (esp. on Unix, + where process numbers are recycled). + + When using "kill" Vim will assume the job will die and close + the channel. + + {only available when compiled with the |+job| feature} join({list} [, {sep}]) *join()* Join the items in {list} together into one String. @@ -4014,6 +5565,80 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. +js_decode({string}) *js_decode()* + This is similar to |json_decode()| with these differences: + - Object key names do not have to be in quotes. + - Strings can be in single quotes. + - Empty items in an array (between two commas) are allowed and + result in v:none items. + +js_encode({expr}) *js_encode()* + This is similar to |json_encode()| with these differences: + - Object key names are not in quotes. + - v:none items in an array result in an empty item between + commas. + For example, the Vim object: + [1,v:none,{"one":1},v:none] ~ + Will be encoded as: + [1,,{one:1},,] ~ + While json_encode() would produce: + [1,null,{"one":1},null] ~ + This encoding is valid for JavaScript. It is more efficient + than JSON, especially when using an array with optional items. + + +json_decode({string}) *json_decode()* + This parses a JSON formatted string and returns the equivalent + in Vim values. See |json_encode()| for the relation between + JSON and Vim values. + The decoding is permissive: + - A trailing comma in an array and object is ignored, e.g. + "[1, 2, ]" is the same as "[1, 2]". + - More floating point numbers are recognized, e.g. "1." for + "1.0", or "001.2" for "1.2". Special floating point values + "Infinity" and "NaN" (capitalization ignored) are accepted. + - Leading zeroes in integer numbers are ignored, e.g. "012" + for "12" or "-012" for "-12". + - Capitalization is ignored in literal names null, true or + false, e.g. "NULL" for "null", "True" for "true". + - Control characters U+0000 through U+001F which are not + escaped in strings are accepted, e.g. " " (tab + character in string) for "\t". + - Backslash in an invalid 2-character sequence escape is + ignored, e.g. "\a" is decoded as "a". + - A correct surrogate pair in JSON strings should normally be + a 12 character sequence such as "\uD834\uDD1E", but + json_decode() silently accepts truncated surrogate pairs + such as "\uD834" or "\uD834\u" + *E938* + A duplicate key in an object, valid in rfc7159, is not + accepted by json_decode() as the result must be a valid Vim + type, e.g. this fails: {"a":"b", "a":"c"} + + +json_encode({expr}) *json_encode()* + Encode {expr} as JSON and return this as a string. + The encoding is specified in: + https://tools.ietf.org/html/rfc7159.html + Vim values are converted as follows: + Number decimal number + Float floating point number + Float nan "NaN" + Float inf "Infinity" + String in double quotes (possibly null) + Funcref not possible, error + List as an array (possibly null); when + used recursively: [] + Dict as an object (possibly null); when + used recursively: {} + v:false "false" + v:true "true" + v:none "null" + v:null "null" + Note that NaN and Infinity are passed on as values. This is + missing in the JSON standard, but several implementations do + allow it. If not then you will get an error. + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. @@ -4092,8 +5717,10 @@ line({expr}) The result is a Number, which is the line number of the file $ the last line in the current buffer 'x position of mark x (if the mark is not set, 0 is returned) - w0 first line visible in current window - w$ last line visible in current window + w0 first line visible in current window (one if the + display isn't updated, e.g. in silent Ex mode) + w$ last line visible in current window (this is one + less than "w0" if no lines are visible) v In Visual mode: the start of the Visual area (the cursor is the end). When not in Visual mode returns the cursor position. Differs from |'<| in @@ -4109,7 +5736,10 @@ line({expr}) The result is a Number, which is the line number of the file < *last-position-jump* This autocommand jumps to the last known position in a file just after opening it, if the '" mark is set: > - :au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + :au BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line @@ -4159,54 +5789,73 @@ log10({expr}) *log10()* :echo log10(0.01) < -2.0 {only available when compiled with the |+float| feature} - -luaeval({expr}[, {expr}]) *luaeval()* - Evaluate Lua expression {expr} and return its result converted - to Vim data structures. Second {expr} may hold additional + +luaeval({expr} [, {expr}]) *luaeval()* + Evaluate Lua expression {expr} and return its result converted + to Vim data structures. Second {expr} may hold additional argument accessible as _A inside first {expr}. Strings are returned as they are. Boolean objects are converted to numbers. - Numbers are converted to |Float| values if vim was compiled + Numbers are converted to |Float| values if vim was compiled with |+float| and to numbers otherwise. - Dictionaries and lists obtained by vim.eval() are returned + Dictionaries and lists obtained by vim.eval() are returned as-is. Other objects are returned as zero without any errors. See |lua-luaeval| for more details. {only available when compiled with the |+lua| feature} -map({expr}, {string}) *map()* - {expr} must be a |List| or a |Dictionary|. - Replace each item in {expr} with the result of evaluating - {string}. - Inside {string} |v:val| has the value of the current item. - For a |Dictionary| |v:key| has the key of the current item - and for a |List| |v:key| has the index of the current item. +map({expr1}, {expr2}) *map()* + {expr1} must be a |List| or a |Dictionary|. + Replace each item in {expr1} with the result of evaluating + {expr2}. {expr2} must be a |string| or |Funcref|. + + If {expr2} is a |string|, inside {expr2} |v:val| has the value + of the current item. For a |Dictionary| |v:key| has the key + of the current item and for a |List| |v:key| has the index of + the current item. Example: > :call map(mylist, '"> " . v:val . " <"') < This puts "> " before and " <" after each item in "mylist". - Note that {string} is the result of an expression and is then + Note that {expr2} is the result of an expression and is then used as an expression again. Often it is good to use a |literal-string| to avoid having to double backslashes. You still have to double ' quotes + If {expr2} is a |Funcref| it is called with two arguments: + 1. The key or the index of the current item. + 2. the value of the current item. + The function must return the new value of the item. Example + that changes each value by "key-value": > + func KeyValue(key, val) + return a:key . '-' . a:val + endfunc + call map(myDict, function('KeyValue')) +< It is shorter when using a |lambda|: > + call map(myDict, {key, val -> key . '-' . val}) +< If you do not use "val" you can leave it out: > + call map(myDict, {key -> 'item: ' . key}) +< The operation is done in-place. If you want a |List| or |Dictionary| to remain unmodified make a copy first: > :let tlist = map(copy(mylist), ' v:val . "\t"') -< Returns {expr}, the |List| or |Dictionary| that was filtered. - When an error is encountered while evaluating {string} no - further items in {expr} are processed. +< Returns {expr1}, the |List| or |Dictionary| that was filtered. + When an error is encountered while evaluating {expr2} no + further items in {expr1} are processed. When {expr2} is a + Funcref errors inside a function are ignored, unless it was + defined with the "abort" flag. -maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* +maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String has special characters translated like in the output of the ":map" command listing. - + When there is no mapping for {name}, an empty String is - returned. + returned. When the mapping for {name} is empty, then "<Nop>" + is returned. The {name} can have special key names, like in the ":map" command. @@ -4220,13 +5869,14 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* "s" Select "x" Visual "l" langmap |language-mapping| + "t" Terminal-Job "" Normal, Visual and Operator-pending When {mode} is omitted, the modes for "" are used. - When {abbr} is there and it is non-zero use abbreviations + When {abbr} is there and it is |TRUE| use abbreviations instead of mappings. - When {dict} is there and it is non-zero return a dictionary + When {dict} is there and it is |TRUE| return a dictionary containing all the information of the mapping with the following items: "lhs" The {lhs} of the mapping. @@ -4253,11 +5903,11 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n') -mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* +mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* Check if there is a mapping that matches with {name} in mode {mode}. See |maparg()| for {mode} and special names in {name}. - When {abbr} is there and it is non-zero use abbreviations + When {abbr} is there and it is |TRUE| use abbreviations instead of mappings. A match happens with a mapping that starts with {name} and with a mapping which is equal to the start of {name}. @@ -4272,9 +5922,10 @@ mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* mapping that matches with {name}, while maparg() only finds a mapping for {name} exactly. When there is no mapping that starts with {name}, an empty - String is returned. If there is one, the rhs of that mapping + String is returned. If there is one, the RHS of that mapping is returned. If there are several mappings that start with - {name}, the rhs of one of them is returned. + {name}, the RHS of one of them is returned. This will be + "<Nop>" if the RHS is empty. The mappings local to the current buffer are checked first, then the global mappings. This function can be used to check if a mapping can be added @@ -4285,11 +5936,11 @@ mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* < This avoids adding the "_vv" mapping when there already is a mapping for "_v" or for "_vvv". -match({expr}, {pat}[, {start}[, {count}]]) *match()* +match({expr}, {pat} [, {start} [, {count}]]) *match()* When {expr} is a |List| then this returns the index of the first item where {pat} matches. Each item is used as a String, |Lists| and |Dictionaries| are used as echoed. - Otherwise, {expr} is used as a String. The result is a + Otherwise, {expr} is used as a String. The result is a Number, which gives the index (byte offset) in {expr} where {pat} matches. A match at the first character or |List| item returns zero. @@ -4300,7 +5951,7 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()* :echo match([1, 'x'], '\a') " results in 1 < See |string-match| for how {pat} is used. *strpbrk()* - Vim doesn't have a strpbrk() function. But you can do: > + Vim doesn't have a strpbrk() function. But you can do: > :let sepidx = match(line, '[.,;: \t]') < *strcasestr()* Vim doesn't have a strcasestr() function. But you can add @@ -4337,11 +5988,11 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()* See |pattern| for the patterns that are accepted. The 'ignorecase' option is used to set the ignore-caseness of - the pattern. 'smartcase' is NOT used. The matching is always + the pattern. 'smartcase' is NOT used. The matching is always done like 'magic' is set and 'cpoptions' is empty. *matchadd()* *E798* *E799* *E801* -matchadd({group}, {pattern}[, {priority}[, {id}]]) +matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) Defines a pattern to be highlighted in the current window (a "match"). It will be highlighted with {group}. Returns an identification number (ID), which can be used to delete the @@ -4349,9 +6000,11 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) Matching is case sensitive and magic, unless case sensitivity or magicness are explicitly overridden in {pattern}. The 'magic', 'smartcase' and 'ignorecase' options are not used. + The "Conceal" value is special, it causes the match to be + concealed. The optional {priority} argument assigns a priority to the - match. A match with a high priority will have its + match. A match with a high priority will have its highlighting overrule that of a match with a lower priority. A priority is specified as an integer (negative numbers are no exception). If the {priority} argument is not specified, the @@ -4366,9 +6019,18 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) message will appear and the match will not be added. An ID is specified as a positive integer (zero excluded). IDs 1, 2 and 3 are reserved for |:match|, |:2match| and |:3match|, - respectively. If the {id} argument is not specified, + respectively. If the {id} argument is not specified or -1, |matchadd()| automatically chooses a free ID. + The optional {dict} argument allows for further custom + values. Currently this is used to specify a match specific + conceal character that will be shown for |hl-Conceal| + highlighted matches. The dict can have the following members: + + conceal Special character to show instead of the + match (only for |hl-Conceal| highlighted + matches, see |:syn-cchar|) + The number of matches is not limited, as it is the case with the |:match| commands. @@ -4379,10 +6041,11 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) :call matchdelete(m) < A list of matches defined by |matchadd()| and |:match| are - available from |getmatches()|. All matches can be deleted in + available from |getmatches()|. All matches can be deleted in one operation by |clearmatches()|. -matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()* + *matchaddpos()* +matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) Same as |matchadd()|, but requires a list of positions {pos} instead of a pattern. This command is faster than |matchadd()| because it does not require to handle regular expressions and @@ -4402,7 +6065,7 @@ matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()* be highlighted. - A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes. - + The maximum number of positions is 8. Example: > @@ -4414,8 +6077,6 @@ matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()* < Matches added by |matchaddpos()| are returned by |getmatches()| with an entry "pos1", "pos2", etc., with the value a list like the {pos} item. - These matches cannot be set via |setmatches()|, however they - can still be deleted by |clearmatches()|. matcharg({nr}) *matcharg()* Selects the {nr} match item, as set with a |:match|, @@ -4435,7 +6096,7 @@ matchdelete({id}) *matchdelete()* *E802* *E803* otherwise -1. See example for |matchadd()|. All matches can be deleted in one operation by |clearmatches()|. -matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* +matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()* Same as |match()|, but return the index of first character after the match. Example: > :echo matchend("testing", "ing") @@ -4454,7 +6115,7 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* < result is "-1". When {expr} is a |List| the result is equal to |match()|. -matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* +matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()* Same as |match()|, but return a |List|. The first item in the list is the matched string, same as what matchstr() would return. Following items are submatches, like "\1", "\2", etc. @@ -4464,7 +6125,7 @@ matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* < Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', ''] When there is no match an empty list is returned. -matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* +matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()* Same as |match()|, but return the matched string. Example: > :echo matchstr("testing", "ing") < results in "ing". @@ -4475,19 +6136,41 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* :echo matchstr("testing", "ing", 5) < result is "". When {expr} is a |List| then the matching item is returned. + The type isn't changed, it's not necessarily a String. + +matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* + Same as |matchstr()|, but return the matched string, the start + position and the end position of the match. Example: > + :echo matchstrpos("testing", "ing") +< results in ["ing", 4, 7]. + When there is no match ["", -1, -1] is returned. + The {start}, if given, has the same meaning as for |match()|. > + :echo matchstrpos("testing", "ing", 2) +< results in ["ing", 4, 7]. > + :echo matchstrpos("testing", "ing", 5) +< result is ["", -1, -1]. + When {expr} is a |List| then the matching item, the index + of first item where {pat} matches, the start position and the + end position of the match are returned. > + :echo matchstrpos([1, '__x'], '\a') +< result is ["x", 1, 2, 3]. The type isn't changed, it's not necessarily a String. *max()* -max({list}) Return the maximum value of all items in {list}. - If {list} is not a list or one of the items in {list} cannot - be used as a Number this results in an error. - An empty |List| results in zero. +max({expr}) Return the maximum value of all items in {expr}. + {expr} can be a list or a dictionary. For a dictionary, + it returns the maximum of all values in the dictionary. + If {expr} is neither a list nor a dictionary, or one of the + items in {expr} cannot be used as a Number this results in + an error. An empty |List| or |Dictionary| results in zero. *min()* -min({list}) Return the minimum value of all items in {list}. - If {list} is not a list or one of the items in {list} cannot - be used as a Number this results in an error. - An empty |List| results in zero. +min({expr}) Return the minimum value of all items in {expr}. + {expr} can be a list or a dictionary. For a dictionary, + it returns the minimum of all values in the dictionary. + If {expr} is neither a list nor a dictionary, or one of the + items in {expr} cannot be used as a Number this results in + an error. An empty |List| or |Dictionary| results in zero. *mkdir()* *E739* mkdir({name} [, {path} [, {prot}]]) @@ -4496,13 +6179,15 @@ mkdir({name} [, {path} [, {prot}]]) necessary. Otherwise it must be "". If {prot} is given it is used to set the protection bits of the new directory. The default is 0755 (rwxr-xr-x: r/w for - the user readable for others). Use 0700 to make it unreadable + the user readable for others). Use 0700 to make it unreadable for others. This is only used for the last part of {name}. Thus if you create /tmp/foo/bar then /tmp/foo will be created with 0755. Example: > :call mkdir($HOME . "/tmp/foo/bar", "p", 0700) < This function is not available in the |sandbox|. + There is no error if the directory already exists and the "p" + flag is passed (since patch 8.0.1708). Not available on all systems. To check use: > :if exists("*mkdir") < @@ -4510,10 +6195,9 @@ mkdir({name} [, {path} [, {prot}]]) mode([expr]) Return a string that indicates the current mode. If [expr] is supplied and it evaluates to a non-zero Number or a non-empty String (|non-zero-arg|), then the full mode is - returned, otherwise only the first letter is returned. Note - that " " and "0" are also non-empty strings. + returned, otherwise only the first letter is returned. - n Normal + n Normal, Terminal-Normal no Operator-pending v Visual by character V Visual by line @@ -4522,15 +6206,20 @@ mode([expr]) Return a string that indicates the current mode. S Select by line CTRL-S Select blockwise i Insert + ic Insert mode completion |compl-generic| + ix Insert mode |i_CTRL-X| completion R Replace |R| + Rc Replace mode completion |compl-generic| Rv Virtual Replace |gR| - c Command-line + Rx Replace mode |i_CTRL-X| completion + c Command-line editing cv Vim Ex mode |gQ| ce Normal Ex mode |Q| r Hit-enter prompt rm The -- more -- prompt r? A |:confirm| query of some sort ! Shell or external command is executing + t Terminal-Job mode: keys go to the job This is useful in the 'statusline' option or when used with |remote_expr()| In most other places it always returns "c" or "n". @@ -4561,7 +6250,7 @@ nextnonblank({lnum}) *nextnonblank()* below it, zero is returned. See also |prevnonblank()|. -nr2char({expr}[, {utf8}]) *nr2char()* +nr2char({expr} [, {utf8}]) *nr2char()* Return a string with a single character, which has the number value {expr}. Examples: > nr2char(64) returns "@" @@ -4591,6 +6280,17 @@ pathshorten({expr}) *pathshorten()* < ~/.v/a/myfile.vim ~ It doesn't matter if the path exists or not. +perleval({expr}) *perleval()* + Evaluate Perl expression {expr} in scalar context and return + its result converted to Vim data structures. If value can't be + converted, it is returned as a string Perl representation. + Note: If you want an array or hash, {expr} must return a + reference to it. + Example: > + :echo perleval('[1 .. 4]') +< [1, 2, 3, 4] + {only available when compiled with the |+perl| feature} + pow({x}, {y}) *pow()* Return the power of {x} to the exponent {y} as a |Float|. {x} and {y} must evaluate to a |Float| or a |Number|. @@ -4602,7 +6302,7 @@ pow({x}, {y}) *pow()* :echo pow(32, 0.20) < 2.0 {only available when compiled with the |+float| feature} - + prevnonblank({lnum}) *prevnonblank()* Return the line number of the first line at or above {lnum} that is not blank. Example: > @@ -4631,11 +6331,13 @@ printf({fmt}, {expr1} ...) *printf()* %04x hex number padded with zeros to at least 4 characters %X hex number using upper case letters %o octal number - %f floating point number in the form 123.456 - %e floating point number in the form 1.234e3 - %E floating point number in the form 1.234E3 + %08b binary number padded with zeros to at least 8 chars + %f floating point number as 12.23, inf, -inf or nan + %F floating point number as 12.23, INF, -INF or NAN + %e floating point number as 1.23e3, inf, -inf or nan + %E floating point number as 1.23E3, INF, -INF or NAN %g floating point number, as %f or %e depending on value - %G floating point number, as %f or %E depending on value + %G floating point number, as %F or %E depending on value %% the % character itself Conversion specifications start with '%' and end with the @@ -4657,6 +6359,9 @@ printf({fmt}, {expr1} ...) *printf()* character of the output string to a zero (except if a zero value is printed with an explicit precision of zero). + For b and B conversions, a non-zero result has + the string "0b" (or "0B" for B conversions) + prepended to it. For x and X conversions, a non-zero result has the string "0x" (or "0X" for X conversions) prepended to it. @@ -4664,8 +6369,8 @@ printf({fmt}, {expr1} ...) *printf()* 0 (zero) Zero padding. For all conversions the converted value is padded on the left with zeros rather than blanks. If a precision is given with a - numeric conversion (d, o, x, and X), the 0 flag - is ignored. + numeric conversion (d, b, B, o, x, and X), the 0 + flag is ignored. - A negative field width flag; the converted value is to be left adjusted on the field boundary. @@ -4677,7 +6382,7 @@ printf({fmt}, {expr1} ...) *printf()* number produced by a signed conversion (d). + A sign must always be placed before a number - produced by a signed conversion. A + overrides + produced by a signed conversion. A + overrides a space if both are used. field-width @@ -4703,7 +6408,7 @@ printf({fmt}, {expr1} ...) *printf()* A field width or precision, or both, may be indicated by an asterisk '*' instead of a digit string. In this case, a - Number argument supplies the field width or precision. A + Number argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. Example: > @@ -4713,12 +6418,13 @@ printf({fmt}, {expr1} ...) *printf()* The conversion specifiers and their meanings are: - *printf-d* *printf-o* *printf-x* *printf-X* - doxX The Number argument is converted to signed decimal - (d), unsigned octal (o), or unsigned hexadecimal (x - and X) notation. The letters "abcdef" are used for - x conversions; the letters "ABCDEF" are used for X - conversions. + *printf-d* *printf-b* *printf-B* *printf-o* + *printf-x* *printf-X* + dbBoxX The Number argument is converted to signed decimal + (d), unsigned binary (b and B), unsigned octal (o), or + unsigned hexadecimal (x and X) notation. The letters + "abcdef" are used for x conversions; the letters + "ABCDEF" are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with @@ -4727,6 +6433,16 @@ printf({fmt}, {expr1} ...) *printf()* cause truncation of a numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. + The 'h' modifier indicates the argument is 16 bits. + The 'l' modifier indicates the argument is 32 bits. + The 'L' modifier indicates the argument is 64 bits. + Generally, these modifiers are not useful. They are + ignored when type is known from the argument. + + i alias for d + D alias for ld + U alias for lu + O alias for lo *printf-c* c The Number argument is converted to a byte, and the @@ -4736,19 +6452,24 @@ printf({fmt}, {expr1} ...) *printf()* s The text of the String argument is used. If a precision is specified, no more bytes than the number specified are used. + If the argument is not a String type, it is + automatically converted to text with the same format + as ":echo". + *printf-S* S The text of the String argument is used. If a precision is specified, no more display cells than the number specified are used. Without the |+multi_byte| feature works just like 's'. *printf-f* *E807* - f The Float argument is converted into a string of the + f F The Float argument is converted into a string of the form 123.456. The precision specifies the number of digits after the decimal point. When the precision is zero the decimal point is omitted. When the precision is not specified 6 is used. A really big number - (out of range or dividing by zero) results in "inf". - "0.0 / 0.0" results in "nan". + (out of range or dividing by zero) results in "inf" + or "-inf" with %f (INF or -INF with %F). + "0.0 / 0.0" results in "nan" with %f (NAN with %F). Example: > echo printf("%.2f", 12.115) < 12.12 @@ -4786,21 +6507,66 @@ printf({fmt}, {expr1} ...) *printf()* arguments an error is given. Up to 18 arguments can be used. +prompt_setcallback({buf}, {expr}) *prompt_setcallback()* + Set prompt callback for buffer {buf} to {expr}. When {expr} + is an empty string the callback is removed. This has only + effect if {buf} has 'buftype' set to "prompt". + + The callback is invoked when pressing Enter. The current + buffer will always be the prompt buffer. A new line for a + prompt is added before invoking the callback, thus the prompt + for which the callback was invoked will be in the last but one + line. + If the callback wants to add text to the buffer, it must + insert it above the last line, since that is where the current + prompt is. This can also be done asynchronously. + The callback is invoked with one argument, which is the text + that was entered at the prompt. This can be an empty string + if the user only typed Enter. + Example: > + call prompt_setcallback(bufnr(''), function('s:TextEntered')) + func s:TextEntered(text) + if a:text == 'exit' || a:text == 'quit' + stopinsert + close + else + call append(line('$') - 1, 'Entered: "' . a:text . '"') + " Reset 'modified' to allow the buffer to be closed. + set nomodified + endif + endfunc + +prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()* + Set a callback for buffer {buf} to {expr}. When {expr} is an + empty string the callback is removed. This has only effect if + {buf} has 'buftype' set to "prompt". + + This callback will be invoked when pressing CTRL-C in Insert + mode. Without setting a callback Vim will exit Insert mode, + as in any buffer. + +prompt_setprompt({buf}, {text}) *prompt_setprompt()* + Set prompt for buffer {buf} to {text}. You most likely want + {text} to end in a space. + The result is only visible if {buf} has 'buftype' set to + "prompt". Example: > + call prompt_setprompt(bufnr(''), 'command: ') + + pumvisible() *pumvisible()* Returns non-zero when the popup menu is visible, zero otherwise. See |ins-completion-menu|. This can be used to avoid some things that would remove the popup menu. - *E860* py3eval({expr}) *py3eval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. - Numbers and strings are returned as they are (strings are - copied though, unicode strings are additionally converted to + Numbers and strings are returned as they are (strings are + copied though, Unicode strings are additionally converted to 'encoding'). Lists are represented as Vim |List| type. - Dictionaries are represented as Vim |Dictionary| type with + Dictionaries are represented as Vim |Dictionary| type with keys converted to strings. {only available when compiled with the |+python3| feature} @@ -4808,13 +6574,21 @@ py3eval({expr}) *py3eval()* pyeval({expr}) *pyeval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. - Numbers and strings are returned as they are (strings are + Numbers and strings are returned as they are (strings are copied though). Lists are represented as Vim |List| type. - Dictionaries are represented as Vim |Dictionary| type, + Dictionaries are represented as Vim |Dictionary| type, non-string keys result in error. {only available when compiled with the |+python| feature} +pyxeval({expr}) *pyxeval()* + Evaluate Python expression {expr} and return its result + converted to Vim data structures. + Uses Python 2 or 3, see |python_x| and 'pyxversion'. + See also: |pyeval()|, |py3eval()| + {only available when compiled with the |+python| or the + |+python3| feature} + *E726* *E727* range({expr} [, {max} [, {stride}]]) *range()* Returns a |List| with Numbers: @@ -4837,11 +6611,11 @@ range({expr} [, {max} [, {stride}]]) *range()* *readfile()* readfile({fname} [, {binary} [, {max}]]) Read file {fname} and return a |List|, each line of the file - as an item. Lines broken at NL characters. Macintosh files - separated with CR will result in a single long line (unless a - NL appears somewhere). + as an item. Lines are broken at NL characters. Macintosh + files separated with CR will result in a single long line + (unless a NL appears somewhere). All NUL characters are replaced with a NL character. - When {binary} is equal to "b" binary mode is used: + When {binary} contains "b" binary mode is used: - When the last line ends in a NL an extra empty list item is added. - No CR characters are removed. @@ -4866,10 +6640,20 @@ readfile({fname} [, {binary} [, {max}]]) the result is an empty list. Also see |writefile()|. +reg_executing() *reg_executing()* + Returns the single letter name of the register being executed. + Returns an empty string when no register is being executed. + See |@|. + +reg_recording() *reg_recording()* + Returns the single letter name of the register being recorded. + Returns an empty string string when not recording. See |q|. + reltime([{start} [, {end}]]) *reltime()* Return an item that represents a time value. The format of the item depends on the system. It can be passed to - |reltimestr()| to convert it to a string. + |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 specified in the argument. @@ -4879,6 +6663,16 @@ reltime([{start} [, {end}]]) *reltime()* reltime(). {only available when compiled with the |+reltime| feature} +reltimefloat({time}) *reltimefloat()* + Return a Float that represents the time value of {time}. + Example: > + let start = reltime() + call MyFunction() + let seconds = reltimefloat(reltime(start)) +< See the note of reltimestr() about overhead. + Also see |profiling|. + {only available when compiled with the |+reltime| feature} + reltimestr({time}) *reltimestr()* Return a String that represents the time value of {time}. This is the number of seconds, a dot and the number of @@ -4895,20 +6689,28 @@ reltimestr({time}) *reltimestr()* {only available when compiled with the |+reltime| feature} *remote_expr()* *E449* -remote_expr({server}, {string} [, {idvar}]) - Send the {string} to {server}. The string is sent as an +remote_expr({server}, {string} [, {idvar} [, {timeout}]]) + Send the {string} to {server}. The string is sent as an expression and the result is returned after evaluation. The result must be a String or a |List|. A |List| is turned into a String by joining the items with a line break in between (not at the end), like with join(expr, "\n"). - If {idvar} is present, it is taken as the name of a - variable and a {serverid} for later use with - remote_read() is stored there. + If {idvar} is present and not empty, it is taken as the name + of a variable and a {serverid} for later use with + |remote_read()| is stored there. + If {timeout} is given the read times out after this many + seconds. Otherwise a timeout of 600 seconds is used. See also |clientserver| |RemoteReply|. This function is not available in the |sandbox|. {only available when compiled with the |+clientserver| feature} Note: Any errors will cause a local error message to be issued and the result will be the empty string. + + Variables will be evaluated in the global namespace, + independent of a function currently being active. Except + when in debug mode, then local function variables and + arguments can be evaluated. + Examples: > :echo remote_expr("gvim", "2+2") :echo remote_expr("gvim1", "b:current_syntax") @@ -4931,7 +6733,7 @@ remote_foreground({server}) *remote_foreground()* remote_peek({serverid} [, {retvar}]) *remote_peek()* Returns a positive number if there are available strings from {serverid}. Copies any reply string into the variable - {retvar} if specified. {retvar} must be a string with the + {retvar} if specified. {retvar} must be a string with the name of a variable. Returns zero if none are available. Returns -1 if something is wrong. @@ -4942,9 +6744,10 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()* :let repl = "" :echo "PEEK: ".remote_peek(id, "repl").": ".repl -remote_read({serverid}) *remote_read()* +remote_read({serverid}, [{timeout}]) *remote_read()* Return the oldest available reply from {serverid} and consume - it. It blocks until a reply is available. + it. Unless a {timeout} in seconds is given, it blocks until a + reply is available. See also |clientserver|. This function is not available in the |sandbox|. {only available when compiled with the |+clientserver| feature} @@ -4953,7 +6756,7 @@ remote_read({serverid}) *remote_read()* < *remote_send()* *E241* remote_send({server}, {string} [, {idvar}]) - Send the {string} to {server}. The string is sent as input + Send the {string} to {server}. The string is sent as input keys and the function returns immediately. At the Vim server the keys are not mapped |:map|. If {idvar} is present, it is taken as the name of a variable @@ -4962,6 +6765,7 @@ remote_send({server}, {string} [, {idvar}]) See also |clientserver| |RemoteReply|. This function is not available in the |sandbox|. {only available when compiled with the |+clientserver| feature} + Note: Any errors will be reported in the server and may mess up the display. Examples: > @@ -4973,6 +6777,12 @@ remote_send({server}, {string} [, {idvar}]) :echo remote_send("gvim", ":sleep 10 | echo ". \ 'server2client(expand("<client>"), "HELLO")<CR>') < + *remote_startserver()* *E941* *E942* +remote_startserver({name}) + Become the server {name}. This fails if already running as a + server, when |v:servername| is not empty. + {only available when compiled with the |+clientserver| feature} + remove({list}, {idx} [, {end}]) *remove()* Without {end}: Remove the item at {idx} from |List| {list} and return the item. @@ -5005,7 +6815,7 @@ repeat({expr}, {count}) *repeat()* :let separator = repeat('-', 80) < When {count} is zero or negative the result is empty. When {expr} is a |List| the result is {expr} concatenated - {count} times. Example: > + {count} times. Example: > :let longlist = repeat(['a', 'b'], 3) < Results in ['a', 'b', 'a', 'b', 'a', 'b']. @@ -5024,7 +6834,7 @@ resolve({filename}) *resolve()* *E655* path name) and also keeps a trailing path separator. *reverse()* -reverse({list}) Reverse the order of items in {list} in-place. Returns +reverse({list}) Reverse the order of items in {list} in-place. Returns {list}. If you want a list to remain unmodified make a copy first: > :let revlist = reverse(copy(mylist)) @@ -5043,12 +6853,12 @@ round({expr}) *round()* < -5.0 {only available when compiled with the |+float| feature} -screenattr(row, col) *screenattr()* - Like screenchar(), but return the attribute. This is a rather +screenattr({row}, {col}) *screenattr()* + Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the attribute at other positions. -screenchar(row, col) *screenchar()* +screenchar({row}, {col}) *screenchar()* The result is a Number, which is the character at position [row, col] on the screen. This works for every possible screen position, also status lines, window separators and the @@ -5075,6 +6885,7 @@ screenrow() *screenrow()* The result is a Number, which is the current screen row of the cursor. The top line has number one. This function is mainly used for testing. + Alternatively you can use |winline()|. Note: Same restrictions as with |screencol()|. @@ -5087,14 +6898,15 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* move. No error message is given. {flags} is a String, which can contain these character flags: - 'b' search backward instead of forward - 'c' accept a match at the cursor position + 'b' search Backward instead of forward + 'c' accept a match at the Cursor position 'e' move to the End of the match 'n' do Not move the cursor - 'p' return number of matching sub-pattern (see below) - 's' set the ' mark at the previous location of the cursor - 'w' wrap around the end of the file - 'W' don't wrap around the end of the file + 'p' return number of matching sub-Pattern (see below) + 's' Set the ' mark at the previous location of the cursor + 'w' Wrap around the end of the file + 'W' don't Wrap around the end of the file + 'z' start searching at the cursor column instead of zero If neither 'w' or 'W' is given, the 'wrapscan' option applies. If the 's' flag is supplied, the ' mark is set, only if the @@ -5103,6 +6915,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* 'ignorecase', 'smartcase' and 'magic' are used. + When the 'z' flag is not given, searching always starts in + column zero and then matches before the cursor are skipped. + When the 'c' flag is present in 'cpo' the next search starts + after the match. Without the 'c' flag the next search starts + one column further. + When the {stopline} argument is given then the search stops after searching this line. This is useful to restrict the search to a range of lines. Examples: > @@ -5113,7 +6931,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* A zero value is equal to not giving the argument. When the {timeout} argument is given the search stops when - more than this many milliseconds have passed. Thus when + more than this many milliseconds have passed. Thus when {timeout} is 500 the search stops after half a second. The value must not be negative. A zero value is like not giving the argument. @@ -5214,6 +7032,7 @@ searchpair({start}, {middle}, {end} [, {flags} [, {skip} When {skip} is omitted or empty, every match is accepted. When evaluating {skip} causes an error the search is aborted and -1 returned. + {skip} can be a string, a lambda, a funcref or a partial. For {stopline} and {timeout} see |search()|. @@ -5230,7 +7049,7 @@ searchpair({start}, {middle}, {end} [, {flags} [, {skip} < When starting at the "if 2", with the cursor on the "i", and searching forwards, the "endif 2" is found. When starting on the character just before the "if 2", the "endif 1" will be - found. That's because the "if 2" will be found first, and + found. That's because the "if 2" will be found first, and then this is considered to be a nested if/endif from "if 2" to "endif 2". When searching backwards and {end} is more than one character, @@ -5288,7 +7107,7 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()* < In this example "submatch" is 2 when a lowercase letter is found |/\l|, 3 when an uppercase letter is found |/\u|. -server2client( {clientid}, {string}) *server2client()* +server2client({clientid}, {string}) *server2client()* Send a reply string to {clientid}. The most recent {clientid} that sent a string can be retrieved with expand("<client>"). {only available when compiled with the |+clientserver| feature} @@ -5308,6 +7127,19 @@ serverlist() *serverlist()* Example: > :echo serverlist() < +setbufline({expr}, {lnum}, {text}) *setbufline()* + Set line {lnum} to {text} in buffer {expr}. To insert + lines use |append()|. + + For the use of {expr}, see |bufname()| above. + + {lnum} is used like with |setline()|. + This works like |setline()| for the specified buffer. + On success 0 is returned, on failure 1 is returned. + + If {expr} is not a valid buffer or {lnum} is not valid, an + error message is given. + setbufvar({expr}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} in buffer {expr} to {val}. @@ -5321,9 +7153,29 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()* :call setbufvar("todo", "myvar", "foobar") < This function is not available in the |sandbox|. +setcharsearch({dict}) *setcharsearch()* + Set the current character search information to {dict}, + which contains one or more of the following entries: + + char character which will be used for a subsequent + |,| or |;| command; an empty string clears the + character search + forward direction of character search; 1 for forward, + 0 for backward + until type of character search; 1 for a |t| or |T| + character search, 0 for an |f| or |F| + character search + + This can be useful to save/restore a user's character search + from a script: > + :let prevsearch = getcharsearch() + :" Perform a command which clobbers user's search + :call setcharsearch(prevsearch) +< Also see |getcharsearch()|. + setcmdpos({pos}) *setcmdpos()* Set the cursor position in the command line to byte position - {pos}. The first position is 1. + {pos}. The first position is 1. Use |getcmdpos()| to obtain the current position. Only works while editing the command line, thus you must use |c_CTRL-\_e|, |c_CTRL-R_=| or |c_CTRL-R_CTRL-R| with '='. For @@ -5336,15 +7188,39 @@ setcmdpos({pos}) *setcmdpos()* Returns 0 when successful, 1 when not editing the command line. +setfperm({fname}, {mode}) *setfperm()* *chmod* + Set the file permissions for {fname} to {mode}. + {mode} must be a string with 9 characters. It is of the form + "rwxrwxrwx", where each group of "rwx" flags represent, in + turn, the permissions of the owner of the file, the group the + file belongs to, and other users. A '-' character means the + permission is off, any other character means on. Multi-byte + characters are not supported. + + For example "rw-r-----" means read-write for the user, + readable by the group, not accessible by others. "xx-x-----" + would do the same thing. + + Returns non-zero for success, zero for failure. + + To read permissions see |getfperm()|. + + setline({lnum}, {text}) *setline()* Set line {lnum} of the current buffer to {text}. To insert - lines use |append()|. + lines use |append()|. To set lines in another buffer use + |setbufline()|. + {lnum} is used like with |getline()|. When {lnum} is just below the last line the {text} will be added as a new line. + If this succeeds, 0 is returned. If this fails (most likely - because {lnum} is invalid) 1 is returned. Example: > + because {lnum} is invalid) 1 is returned. + + Example: > :call setline(5, strftime("%c")) + < When {text} is a |List| then line {lnum} and following lines will be set to the items in the list. Example: > :call setline(5, ['aaa', 'bbb', 'ccc']) @@ -5352,16 +7228,23 @@ setline({lnum}, {text}) *setline()* :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']] : call setline(n, l) :endfor + < Note: The '[ and '] marks are not set. -setloclist({nr}, {list} [, {action}]) *setloclist()* +setloclist({nr}, {list} [, {action} [, {what}]]) *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. + {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. Otherwise, same as |setqflist()|. Also see |location-list|. + If the optional {what} dictionary argument is supplied, then + only the items listed in {what} are set. Refer to |setqflist()| + for the list of supported keys in {what}. + setmatches({list}) *setmatches()* Restores a list of matches saved by |getmatches()|. Returns 0 if successful, otherwise -1. All current matches are cleared @@ -5377,11 +7260,13 @@ setpos({expr}, {list}) [bufnum, lnum, col, off] [bufnum, lnum, col, off, curswant] - "bufnum" is the buffer number. Zero can be used for the - current buffer. Setting the cursor is only possible for - the current buffer. To set a mark in another buffer you can - use the |bufnr()| function to turn a file name into a buffer - number. + "bufnum" is the buffer number. Zero can be used for the + current buffer. When setting an uppercase mark "bufnum" is + used for the mark position. For other marks it specifies the + buffer to set the mark in. You can use the |bufnr()| function + to turn a file name into a buffer number. + For setting the cursor and the ' mark "bufnum" is ignored, + since these are associated with a window, not a buffer. Does not change the jumplist. "lnum" and "col" are the position in the buffer. The first @@ -5414,17 +7299,20 @@ setpos({expr}, {list}) also set the preferred column. Also see the "curswant" key in |winrestview()|. +setqflist({list} [, {action} [, {what}]]) *setqflist()* + Create or replace or add to the quickfix list. -setqflist({list} [, {action}]) *setqflist()* - Create or replace or add to the quickfix list using the items - in {list}. Each item in {list} is a dictionary. - Non-dictionary items in {list} are ignored. Each dictionary - item can contain the following entries: + When {what} is not present, use the items in {list}. Each + item must be a dictionary. Non-dictionary items in {list} are + ignored. Each dictionary item can contain the following + entries: bufnr buffer number; must be the number of a valid buffer filename name of a file; only used when "bufnr" is not present or it is invalid. + module name of a module; if given it will be used in + quickfix error window instead of the filename. lnum line number in the file pattern search pattern used to locate the error col column number @@ -5433,6 +7321,7 @@ setqflist({list} [, {action}]) *setqflist()* nr error number text description of the error type single-character error type, 'E', 'W', etc. + valid recognized error message The "col", "vcol", "nr", "type" and "text" entries are optional. Either "lnum" or "pattern" entry can be used to @@ -5442,29 +7331,74 @@ setqflist({list} [, {action}]) *setqflist()* item will not be handled as an error line. If both "pattern" and "lnum" are present then "pattern" will be used. + If the "valid" entry is not supplied, then the valid flag is + set when "bufnr" is a valid buffer or "filename" exists. If you supply an empty {list}, the quickfix list will be cleared. Note that the list is not exactly the same as what |getqflist()| returns. - 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. + {action} values: *E927* + 'a' The items from {list} are added to the existing + quickfix list. If there is no existing list, then a + new list is created. + 'r' 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') +< + 'f' All the quickfix lists in the quickfix stack are + freed. + + If {action} is not present or is set to ' ', then a new list + is created. The new quickfix list is added after the current + quickfix list in the stack and all the following lists are + freed. To add a new quickfix list at the end of the stack, + set "nr" in {what} to "$". + + If the optional {what} dictionary argument is supplied, then + only the items listed in {what} are set. The first {list} + argument is ignored. The following items can be specified in + {what}: + context quickfix list context. See |quickfix-context| + efm errorformat to use when parsing text from + "lines". If this is not present, then the + 'errorformat' option value is used. + id quickfix list identifier |quickfix-ID| + items list of quickfix entries. Same as the {list} + argument. + lines use 'errorformat' to parse a list of lines and + add the resulting entries to the quickfix list + {nr} or {id}. Only a |List| value is supported. + nr list number in the quickfix stack; zero + means the current quickfix list and "$" means + the last quickfix list + title quickfix list title text + Unsupported keys in {what} are ignored. + If the "nr" item is not present, then the current quickfix list + is modified. When creating a new quickfix list, "nr" can be + set to a value one greater than the quickfix stack size. + When modifying a quickfix list, to guarantee that the correct + list is modified, "id" should be used instead of "nr" to + specify the list. + + Examples (See also |setqflist-examples|): > + :call setqflist([], 'r', {'title': 'My search'}) + :call setqflist([], 'r', {'nr': 2, 'title': 'Errors'}) + :call setqflist([], 'a', {'id':qfid, 'lines':["F1:10:L10"]}) +< Returns zero for success, -1 for failure. This function can be used to create a quickfix list independent of the 'errorformat' setting. Use a command like - ":cc 1" to jump to the first position. + `:cc 1` to jump to the first position. *setreg()* -setreg({regname}, {value} [,{options}]) +setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. - {value} may be any value returned by |getreg()|, including + {value} may be any value returned by |getreg()|, including a |List|. If {options} contains "a" or {regname} is upper case, then the value is appended. @@ -5478,14 +7412,14 @@ setreg({regname}, {value} [,{options}]) in the longest line (counting a <Tab> as 1 character). If {options} contains no register settings, then the default - is to use character mode unless {value} ends in a <NL> for - string {value} and linewise mode for list {value}. Blockwise + is to use character mode unless {value} ends in a <NL> for + string {value} and linewise mode for list {value}. Blockwise mode is never selected automatically. Returns zero for success, non-zero for failure. *E883* - Note: you may not use |List| containing more then one item to - set search and expression registers. Lists containing no + Note: you may not use |List| containing more than one item to + set search and expression registers. Lists containing no items act like empty strings. Examples: > @@ -5494,16 +7428,17 @@ setreg({regname}, {value} [,{options}]) :call setreg('a', "1\n2\n3", 'b5') < This example shows using the functions to save and restore a - register (note: you may not reliably restore register value - without using the third argument to |getreg()| as without it - newlines are represented as newlines AND Nul bytes are - represented as newlines as well, see |NL-used-for-Nul|). > + register: > :let var_a = getreg('a', 1, 1) :let var_amode = getregtype('a') .... :call setreg('a', var_a, var_amode) +< Note: you may not reliably restore register value + without using the third argument to |getreg()| as without it + newlines are represented as newlines AND Nul bytes are + represented as newlines as well, see |NL-used-for-Nul|. -< You can also change the type of a register by appending + You can also change the type of a register by appending nothing: > :call setreg('a', '', 'al') @@ -5519,6 +7454,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. @@ -5536,7 +7472,7 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()* :call setwinvar(2, "myvar", "foobar") sha256({string}) *sha256()* - Returns a String with 64 hex charactes, which is the SHA256 + Returns a String with 64 hex characters, which is the SHA256 checksum of {string}. {only available when compiled with the |+cryptv| feature} @@ -5545,20 +7481,24 @@ shellescape({string} [, {special}]) *shellescape()* On MS-Windows and MS-DOS, when 'shellslash' is not set, it will enclose {string} in double quotes and double all double quotes within {string}. - For other systems, it will enclose {string} in single quotes - and replace all "'" with "'\''". + Otherwise it will enclose {string} in single quotes and + replace all "'" with "'\''". + When the {special} argument is present and it's a non-zero Number or a non-empty String (|non-zero-arg|), then special items such as "!", "%", "#" and "<cword>" will be preceded by a backslash. This backslash will be removed again by the |:!| command. + The "!" character will be escaped (again with a |non-zero-arg| {special}) when 'shell' contains "csh" in the tail. That is because for csh and tcsh "!" is used for history replacement even when inside single quotes. - The <NL> character is also escaped. With a |non-zero-arg| - {special} and 'shell' containing "csh" in the tail it's + + With a |non-zero-arg| {special} the <NL> character is also + escaped. When 'shell' containing "csh" in the tail it's escaped a second time. + Example of use with a |:!| command: > :exe '!dir ' . shellescape(expand('<cfile>'), 1) < This results in a directory listing for the file under the @@ -5570,18 +7510,8 @@ shellescape({string} [, {special}]) *shellescape()* shiftwidth() *shiftwidth()* Returns the effective value of 'shiftwidth'. This is the 'shiftwidth' value unless it is zero, in which case it is the - 'tabstop' value. To be backwards compatible in indent - plugins, use this: > - if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc - else - func s:sw() - return &sw - endfunc - endif -< And then use s:sw() instead of &sw. + 'tabstop' value. This function was introduced with patch + 7.3.694 in 2012, everybody should have it by now. simplify({filename}) *simplify()* @@ -5609,7 +7539,7 @@ sin({expr}) *sin()* :echo sin(-4.01) < 0.763301 {only available when compiled with the |+float| feature} - + sinh({expr}) *sinh()* Return the hyperbolic sine of {expr} as a |Float| in the range @@ -5625,7 +7555,7 @@ sinh({expr}) *sinh()* sort({list} [, {func} [, {dict}]]) *sort()* *E702* Sort the items in {list} in-place. Returns {list}. - + If you want a list to remain unmodified make a copy first: > :let sortedlist = sort(copy(mylist)) @@ -5634,14 +7564,21 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* after Strings, |Lists| after Numbers. For sorting text in the current buffer use |:sort|. - When {func} is given and it is is '1' or 'i' then case is + When {func} is given and it is '1' or 'i' then case is ignored. - + When {func} is given and it is 'n' then all items will be sorted numerical (Implementation detail: This uses the strtod() function to parse numbers, Strings, Lists, Dicts and Funcrefs will be considered as being 0). + When {func} is given and it is 'N' then all items will be + sorted numerical. This is like 'n' but a string containing + digits will be used as the number they represent. + + When {func} is given and it is 'f' then all items will be + sorted numerical. All values must be a Number or a Float. + When {func} is a |Funcref| or a function name, this function is called to compare items. The function is invoked with two items as argument and must return zero if they are equal, 1 or @@ -5743,7 +7680,8 @@ split({expr} [, {pattern} [, {keepempty}]]) *split()* :let words = split(getline('.'), '\W\+') < To split a string in individual characters: > :for c in split(mystring, '\zs') -< If you want to keep the separator you can also use '\zs': > +< If you want to keep the separator you can also use '\zs' at + the end of the pattern: > :echo split('abc:def:ghi', ':\zs') < ['abc:', 'def:', 'ghi'] ~ Splitting a table where the first element can be empty: > @@ -5763,9 +7701,9 @@ sqrt({expr}) *sqrt()* < nan "nan" may be different, it depends on system libraries. {only available when compiled with the |+float| feature} - -str2float( {expr}) *str2float()* + +str2float({expr}) *str2float()* Convert String {expr} to a Float. This mostly works the same as when using a floating point number in an expression, see |floating-point-format|. But it's a bit more permissive. @@ -5780,26 +7718,54 @@ str2float( {expr}) *str2float()* < {only available when compiled with the |+float| feature} -str2nr( {expr} [, {base}]) *str2nr()* +str2nr({expr} [, {base}]) *str2nr()* Convert string {expr} to a number. - {base} is the conversion base, it can be 8, 10 or 16. + {base} is the conversion base, it can be 2, 8, 10 or 16. When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as with the default String to Number conversion. When {base} is 16 a leading "0x" or "0X" is ignored. With a - different base the result will be zero. + different base the result will be zero. Similarly, when + {base} is 8 a leading "0" is ignored, and when {base} is 2 a + leading "0b" or "0B" is ignored. Text after the number is silently ignored. -strchars({expr}) *strchars()* +strchars({expr} [, {skipcc}]) *strchars()* The result is a Number, which is the number of characters - String {expr} occupies. Composing characters are counted - separately. + in String {expr}. + When {skipcc} is omitted or zero, composing characters are + counted separately. + When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. -strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* + {skipcc} is only available after 7.4.755. For backward + compatibility, you can define a wrapper function: > + if has("patch-7.4.755") + function s:strchars(str, skipcc) + return strchars(a:str, a:skipcc) + endfunction + else + function s:strchars(str, skipcc) + if a:skipcc + return strlen(substitute(a:str, ".", "x", "g")) + else + return strchars(a:str) + endif + endfunction + endif +< +strcharpart({src}, {start} [, {len}]) *strcharpart()* + Like |strpart()| but using character index and length instead + of byte index and length. + When a character index is used where a character does not + exist it is assumed to be one character. For example: > + strcharpart('abc', -1, 2) +< results in 'a'. + +strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells - String {expr} occupies on the screen when it starts a {col}. + String {expr} occupies on the screen when it starts at {col}. When {col} is omitted zero is used. Otherwise it is the screen column where to start. This matters for Tab characters. @@ -5829,6 +7795,12 @@ strftime({format} [, {time}]) *strftime()* < Not available on all systems. To check use: > :if exists("*strftime") +strgetchar({str}, {index}) *strgetchar()* + Get character {index} from {str}. This uses a character + index, not a byte index. Composing characters are considered + separate characters here. + Also see |strcharpart()| and |strchars()|. + stridx({haystack}, {needle} [, {start}]) *stridx()* The result is a Number, which gives the byte index in {haystack} of the first occurrence of the String {needle}. @@ -5853,39 +7825,42 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number, Float, String or a composition of them, then the result can be parsed back with |eval()|. {expr} type result ~ - String 'string' + String 'string' (single quotes are doubled) Number 123 Float 123.123456 or 1.123456e8 Funcref function('name') List [item, item] Dictionary {key: value, key: value} - Note that in String values the ' character is doubled. + + When a List or Dictionary has a recursive reference it is + replaced by "[...]" or "{...}". Using eval() on the result + will then fail. + Also see |strtrans()|. *strlen()* strlen({expr}) The result is a Number, which is the length of the String {expr} in bytes. - If you want to count the number of multi-byte characters (not - counting composing characters) use something like this: > - - :let len = strlen(substitute(str, ".", "x", "g")) -< If the argument is a Number it is first converted to a String. For other types an error is given. - Also see |len()|, |strchars()|, |strdisplaywidth()| and - |strwidth()|. + If you want to count the number of multi-byte characters use + |strchars()|. + Also see |len()|, |strdisplaywidth()| and |strwidth()|. -strpart({src}, {start}[, {len}]) *strpart()* +strpart({src}, {start} [, {len}]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. - When non-existing bytes are included, this doesn't result in - an error, the bytes are simply omitted. + To count characters instead of bytes use |strcharpart()|. + + When bytes are selected which do not exist, this doesn't + result in an error, the bytes are simply omitted. If {len} is missing, the copy continues from {start} till the end of the {src}. > strpart("abcdefg", 3, 2) == "de" strpart("abcdefg", -2, 4) == "ab" strpart("abcdefg", 5, 4) == "fg" strpart("abcdefg", 3) == "defg" + < Note: To get the first character, {start} must be 0. For example, to get three bytes under and after the cursor: > strpart(getline("."), col(".") - 1, 3) @@ -5924,7 +7899,7 @@ strwidth({expr}) *strwidth()* Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strdisplaywidth()| and |strchars()|. -submatch({nr}[, {list}]) *submatch()* +submatch({nr} [, {list}]) *submatch()* *E935* Only for an expression in a |:substitute| command or substitute() function. Returns the {nr}'th submatch of the matched text. When {nr} @@ -5933,16 +7908,20 @@ submatch({nr}[, {list}]) *submatch()* multi-line match or a NUL character in the text. Also see |sub-replace-expression|. - If {list} is present and non-zero then submatch() returns - a list of strings, similar to |getline()| with two arguments. + If {list} is present and non-zero then submatch() returns + a list of strings, similar to |getline()| with two arguments. NL characters in the text represent NUL characters in the text. Only returns more than one item for |:substitute|, inside |substitute()| this list will always contain one or zero items, since there are no real line breaks. - Example: > + When substitute() is used recursively only the submatches in + the current (deepest) call can be obtained. + + Examples: > :s/\d\+/\=submatch(0) + 1/ + :echo substitute(text, '\d\+', '\=submatch(0) + 1', '') < This finds the first number in the line and adds one to it. A line break is included as a newline character. @@ -5951,7 +7930,7 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* the first match of {pat} is replaced with {sub}. When {flags} is "g", all matches of {pat} in {expr} are replaced. Otherwise {flags} should be "". - + This works like the ":substitute" command (without any flags). But the matching with {pat} is always done like the 'magic' option is set and 'cpoptions' is empty (to make scripts @@ -5962,23 +7941,31 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* A "~" in {sub} is not replaced with the previous {sub}. Note that some codes in {sub} have a special meaning - |sub-replace-special|. For example, to replace something with + |sub-replace-special|. For example, to replace something with "\n" (two characters), use "\\\\n" or '\\n'. When {pat} does not match in {expr}, {expr} is returned unmodified. Example: > - :let &path = substitute(&path, ",\\=[^,]*$", "", "") + :let &path = substitute(&path, ",\\=[^,]*$", "", "") < This removes the last component of the 'path' option. > - :echo substitute("testing", ".*", "\\U\\0", "") + :echo substitute("testing", ".*", "\\U\\0", "") < results in "TESTING". When {sub} starts with "\=", the remainder is interpreted as an expression. See |sub-replace-expression|. Example: > - :echo substitute(s, '%\(\x\x\)', + :echo substitute(s, '%\(\x\x\)', \ '\=nr2char("0x" . submatch(1))', 'g') +< When {sub} is a Funcref that function is called, with one + optional argument. Example: > + :echo substitute(s, '%\(\x\x\)', SubNr, 'g') +< The optional argument is a list which contains the whole + matched string and up to nine submatches, like what + |submatch()| returns. Example: > + :echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g') + synID({lnum}, {col}, {trans}) *synID()* The result is a Number, which is the syntax ID at the position {lnum} and {col} in the current window. @@ -5987,10 +7974,13 @@ synID({lnum}, {col}, {trans}) *synID()* {col} is 1 for the leftmost column, {lnum} is 1 for the first line. 'synmaxcol' applies, in a longer line zero is returned. + Note that when the position is after the last character, + that's where the cursor can be in Insert mode, synID() returns + zero. - When {trans} is non-zero, transparent items are reduced to the - item that they reveal. This is useful when wanting to know - the effective color. When {trans} is zero, the transparent + When {trans} is |TRUE|, transparent items are reduced to the + item that they reveal. This is useful when wanting to know + the effective color. When {trans} is |FALSE|, the transparent item is returned. This is useful when wanting to know which syntax item is effective (e.g. inside parens). Warning: This function can be very slow. Best speed is @@ -6005,7 +7995,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* syntax ID {synID}. This can be used to obtain information about a syntax item. {mode} can be "gui", "cterm" or "term", to get the attributes - for that mode. When {mode} is omitted, or an invalid value is + for that mode. When {mode} is omitted, or an invalid value is used, the attributes for the currently active highlighting are used (GUI, cterm or term). Use synIDtrans() to follow linked highlight groups. @@ -6029,6 +8019,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* "standout" "1" if standout "underline" "1" if underlined "undercurl" "1" if undercurled + "strike" "1" if strikethrough Example (echoes the color of the syntax item under the cursor): > @@ -6041,17 +8032,29 @@ synIDtrans({synID}) *synIDtrans()* ":highlight link" are followed. synconcealed({lnum}, {col}) *synconcealed()* - The result is a List. The first item in the list is 0 if the - character at the position {lnum} and {col} is not part of a - concealable region, 1 if it is. The second item in the list is - a string. If the first item is 1, the second item contains the - text which will be displayed in place of the concealed text, - depending on the current setting of 'conceallevel'. The third - and final item in the list is a unique number representing the - specific syntax region matched. This allows detection of the - beginning of a new concealable region if there are two - consecutive regions with the same replacement character. - For an example use see $VIMRUNTIME/syntax/2html.vim . + The result is a List with currently three items: + 1. The first item in the list is 0 if the character at the + position {lnum} and {col} is not part of a concealable + region, 1 if it is. + 2. The second item in the list is a string. If the first item + is 1, the second item contains the text which will be + displayed in place of the concealed text, depending on the + current setting of 'conceallevel' and 'listchars'. + 3. The third and final item in the list is a number + representing the specific syntax region matched in the + line. When the character is not concealed the value is + zero. This allows detection of the beginning of a new + concealable region if there are two consecutive regions + with the same replacement character. For an example, if + the text is "123456" and both "23" and "45" are concealed + and replace by the character "X", then: + call returns ~ + synconcealed(lnum, 1) [0, '', 0] + synconcealed(lnum, 2) [1, 'X', 1] + synconcealed(lnum, 3) [1, 'X', 1] + synconcealed(lnum, 4) [1, 'X', 2] + synconcealed(lnum, 5) [1, 'X', 2] + synconcealed(lnum, 6) [0, '', 0] synstack({lnum}, {col}) *synstack()* @@ -6076,20 +8079,31 @@ system({expr} [, {input}]) *system()* *E677* Get the output of the shell command {expr} as a string. See |systemlist()| to get the output as a List. - 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 + 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. - - Note: Use |shellescape()| or |::S| with |expand()| or - |fnamemodify()| to escape special characters in a command - argument. Newlines in {expr} may cause the command to fail. - The characters in 'shellquote' and 'shellxquote' may also + list items converted to NULs). + When {input} is given and is a number that is a valid id for + an existing buffer then the content of the buffer is written + to the file line by line, each line terminated by a NL and + NULs characters where the text has a NL. + + Pipes are not used, the 'shelltemp' option is not used. + + When prepended by |:silent| the terminal will not be set to + cooked mode. This is meant to be used for commands that do + not need the user to type. It avoids stray characters showing + up on the screen which require |CTRL-L| to remove. > + :silent let f = system('ls *.vim') +< + Note: Use |shellescape()| or |::S| with |expand()| or + |fnamemodify()| to escape special characters in a command + argument. Newlines in {expr} 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. @@ -6123,19 +8137,19 @@ system({expr} [, {input}]) *system()* *E677* systemlist({expr} [, {input}]) *systemlist()* - Same as |system()|, but returns a |List| with lines (parts of - output separated by NL) with NULs transformed into NLs. Output - is the same as |readfile()| will output with {binary} argument - set to "b". + Same as |system()|, but returns a |List| with lines (parts of + output separated by NL) with NULs transformed into NLs. Output + is the same as |readfile()| will output with {binary} argument + set to "b". Note that on MS-Windows you may get trailing CR + characters. - Returns an empty string on error, so be careful not to run - into |E706|. + Returns an empty string on error. tabpagebuflist([{arg}]) *tabpagebuflist()* The result is a |List|, where each item is the number of the buffer associated with each window in the current tab page. - {arg} specifies the number of tab page to be used. When + {arg} specifies the number of the tab page to be used. When omitted the current tab page is used. When {arg} is invalid the number zero is returned. To get a list of all buffers in all tabs use this: > @@ -6172,8 +8186,13 @@ tagfiles() Returns a |List| with the file names used to search for tags for the current buffer. This is the 'tags' option expanded. -taglist({expr}) *taglist()* +taglist({expr} [, {filename}]) *taglist()* Returns a list of tags matching the regular expression {expr}. + + If {filename} is passed it is used to prioritize the results + in the same way that |:tselect| does. See |tag-priority|. + {filename} should be the full path of the file. + Each list item is a dictionary with at least the following entries: name Name of the tag. @@ -6196,7 +8215,7 @@ taglist({expr}) *taglist()* may appear, they give the name of the entity the tag is contained in. - The ex-command 'cmd' can be either an ex search pattern, a + The ex-command "cmd" can be either an ex search pattern, a line number or a line number followed by a byte number. If there are no matching tags, then an empty list is returned. @@ -6210,17 +8229,6 @@ taglist({expr}) *taglist()* located by Vim. Refer to |tags-file-format| for the format of the tags file generated by the different ctags tools. -tempname() *tempname()* *temp-file-name* - The result is a String, which is the name of a file that - doesn't exist. It can be used for a temporary file. The name - is different for at least 26 consecutive calls. Example: > - :let tmpfile = tempname() - :exe "redir > " . tmpfile -< For Unix, the file will be in a private directory |tempfile|. - For MS-Windows forward slashes are used when the 'shellslash' - option is set or when 'shellcmdflag' starts with '-'. - - tan({expr}) *tan()* Return the tangent of {expr}, measured in radians, as a |Float| in the range [-inf, inf]. @@ -6245,6 +8253,530 @@ tanh({expr}) *tanh()* {only available when compiled with the |+float| feature} +tempname() *tempname()* *temp-file-name* + The result is a String, which is the name of a file that + doesn't exist. It can be used for a temporary file. The name + is different for at least 26 consecutive calls. Example: > + :let tmpfile = tempname() + :exe "redir > " . tmpfile +< For Unix, the file will be in a private directory |tempfile|. + For MS-Windows forward slashes are used when the 'shellslash' + option is set or when 'shellcmdflag' starts with '-'. + + *term_dumpdiff()* +term_dumpdiff({filename}, {filename} [, {options}]) + Open a new window displaying the difference between the two + files. The files must have been created with + |term_dumpwrite()|. + Returns the buffer number or zero when the diff fails. + Also see |terminal-diff|. + NOTE: this does not work with double-width characters yet. + + The top part of the buffer contains the contents of the first + file, the bottom part of the buffer contains the contents of + the second file. The middle part shows the differences. + The parts are separated by a line of dashes. + + If the {options} argument is present, it must be a Dict with + these possible members: + "term_name" name to use for the buffer name, instead + of the first file name. + "term_rows" vertical size to use for the terminal, + instead of using 'termwinsize' + "term_cols" horizontal size to use for the terminal, + instead of using 'termwinsize' + "vertical" split the window vertically + "curwin" use the current window, do not split the + window; fails if the current buffer + cannot be |abandon|ed + "norestore" do not add the terminal window to a + session file + + Each character in the middle part indicates a difference. If + there are multiple differences only the first in this list is + used: + X different character + w different width + f different foreground color + b different background color + a different attribute + + missing position in first file + - missing position in second file + + Using the "s" key the top and bottom parts are swapped. This + makes it easy to spot a difference. + + *term_dumpload()* +term_dumpload({filename} [, {options}]) + Open a new window displaying the contents of {filename} + The file must have been created with |term_dumpwrite()|. + Returns the buffer number or zero when it fails. + Also see |terminal-diff|. + + For {options} see |term_dumpdiff()|. + + *term_dumpwrite()* +term_dumpwrite({buf}, {filename} [, {options}]) + Dump the contents of the terminal screen of {buf} in the file + {filename}. This uses a format that can be used with + |term_dumpload()| and |term_dumpdiff()|. + If {filename} already exists an error is given. *E953* + Also see |terminal-diff|. + + {options} is a dictionary with these optional entries: + "rows" maximum number of rows to dump + "columns" maximum number of columns to dump + +term_getaltscreen({buf}) *term_getaltscreen()* + Returns 1 if the terminal of {buf} is using the alternate + screen. + {buf} is used as with |term_getsize()|. + {only available when compiled with the |+terminal| feature} + +term_getansicolors({buf}) *term_getansicolors()* + Get the ANSI color palette in use by terminal {buf}. + Returns a List of length 16 where each element is a String + representing a color in hexadecimal "#rrggbb" format. + Also see |term_setansicolors()| and |g:terminal_ansi_colors|. + If neither was used returns the default colors. + + {buf} is used as with |term_getsize()|. If the buffer does not + exist or is not a terminal window, an empty list is returned. + {only available when compiled with the |+terminal| feature and + with GUI enabled and/or the |+termguicolors| feature} + +term_getattr({attr}, {what}) *term_getattr()* + Given {attr}, a value returned by term_scrape() in the "attr" + item, return whether {what} is on. {what} can be one of: + bold + italic + underline + strike + reverse + {only available when compiled with the |+terminal| feature} + +term_getcursor({buf}) *term_getcursor()* + Get the cursor position of terminal {buf}. Returns a list with + two numbers and a dictionary: [row, col, dict]. + + "row" and "col" are one based, the first screen cell is row + 1, column 1. This is the cursor position of the terminal + itself, not of the Vim window. + + "dict" can have these members: + "visible" one when the cursor is visible, zero when it + is hidden. + "blink" one when the cursor is visible, zero when it + is hidden. + "shape" 1 for a block cursor, 2 for underline and 3 + for a vertical bar. + + {buf} must be the buffer number of a terminal window. If the + buffer does not exist or is not a terminal window, an empty + list is returned. + {only available when compiled with the |+terminal| feature} + +term_getjob({buf}) *term_getjob()* + Get the Job associated with terminal window {buf}. + {buf} is used as with |term_getsize()|. + Returns |v:null| when there is no job. + {only available when compiled with the |+terminal| feature} + +term_getline({buf}, {row}) *term_getline()* + Get a line of text from the terminal window of {buf}. + {buf} is used as with |term_getsize()|. + + The first line has {row} one. When {row} is "." the cursor + line is used. When {row} is invalid an empty string is + returned. + + To get attributes of each character use |term_scrape()|. + {only available when compiled with the |+terminal| feature} + +term_getscrolled({buf}) *term_getscrolled()* + Return the number of lines that scrolled to above the top of + terminal {buf}. This is the offset between the row number + used for |term_getline()| and |getline()|, so that: > + term_getline(buf, N) +< is equal to: > + `getline(N + term_getscrolled(buf)) +< (if that line exists). + + {buf} is used as with |term_getsize()|. + {only available when compiled with the |+terminal| feature} + +term_getsize({buf}) *term_getsize()* + Get the size of terminal {buf}. Returns a list with two + numbers: [rows, cols]. This is the size of the terminal, not + the window containing the terminal. + + {buf} must be the buffer number of a terminal window. Use an + empty string for the current buffer. If the buffer does not + exist or is not a terminal window, an empty list is returned. + {only available when compiled with the |+terminal| feature} + +term_getstatus({buf}) *term_getstatus()* + Get the status of terminal {buf}. This returns a comma + separated list of these items: + running job is running + finished job has finished + normal in Terminal-Normal mode + One of "running" or "finished" is always present. + + {buf} must be the buffer number of a terminal window. If the + buffer does not exist or is not a terminal window, an empty + string is returned. + {only available when compiled with the |+terminal| feature} + +term_gettitle({buf}) *term_gettitle()* + Get the title of terminal {buf}. This is the title that the + job in the terminal has set. + + {buf} must be the buffer number of a terminal window. If the + buffer does not exist or is not a terminal window, an empty + string is returned. + {only available when compiled with the |+terminal| feature} + +term_gettty({buf} [, {input}]) *term_gettty()* + Get the name of the controlling terminal associated with + terminal window {buf}. {buf} is used as with |term_getsize()|. + + When {input} is omitted or 0, return the name for writing + (stdout). When {input} is 1 return the name for reading + (stdin). On UNIX, both return same name. + {only available when compiled with the |+terminal| feature} + +term_list() *term_list()* + Return a list with the buffer numbers of all buffers for + terminal windows. + {only available when compiled with the |+terminal| feature} + +term_scrape({buf}, {row}) *term_scrape()* + Get the contents of {row} of terminal screen of {buf}. + For {buf} see |term_getsize()|. + + The first line has {row} one. When {row} is "." the cursor + line is used. When {row} is invalid an empty string is + returned. + + Return a List containing a Dict for each screen cell: + "chars" character(s) at the cell + "fg" foreground color as #rrggbb + "bg" background color as #rrggbb + "attr" attributes of the cell, use |term_getattr()| + to get the individual flags + "width" cell width: 1 or 2 + {only available when compiled with the |+terminal| feature} + +term_sendkeys({buf}, {keys}) *term_sendkeys()* + Send keystrokes {keys} to terminal {buf}. + {buf} is used as with |term_getsize()|. + + {keys} are translated as key sequences. For example, "\<c-x>" + means the character CTRL-X. + {only available when compiled with the |+terminal| feature} + +term_setansicolors({buf}, {colors}) *term_setansicolors()* + Set the ANSI color palette used by terminal {buf}. + {colors} must be a List of 16 valid color names or hexadecimal + color codes, like those accepted by |highlight-guifg|. + Also see |term_getansicolors()| and |g:terminal_ansi_colors|. + + The colors normally are: + 0 black + 1 dark red + 2 dark green + 3 brown + 4 dark blue + 5 dark magenta + 6 dark cyan + 7 light grey + 8 dark grey + 9 red + 10 green + 11 yellow + 12 blue + 13 magenta + 14 cyan + 15 white + + These colors are used in the GUI and in the terminal when + 'termguicolors' is set. When not using GUI colors (GUI mode + or 'termguicolors'), the terminal window always uses the 16 + ANSI colors of the underlying terminal. + {only available when compiled with the |+terminal| feature and + with GUI enabled and/or the |+termguicolors| feature} + +term_setkill({buf}, {how}) *term_setkill()* + When exiting Vim or trying to close the terminal window in + another way, {how} defines whether the job in the terminal can + be stopped. + When {how} is empty (the default), the job will not be + stopped, trying to exit will result in |E947|. + Otherwise, {how} specifies what signal to send to the job. + See |job_stop()| for the values. + + After sending the signal Vim will wait for up to a second to + check that the job actually stopped. + +term_setrestore({buf}, {command}) *term_setrestore()* + Set the command to write in a session file to restore the job + in this terminal. The line written in the session file is: > + terminal ++curwin ++cols=%d ++rows=%d {command} +< Make sure to escape the command properly. + + Use an empty {command} to run 'shell'. + Use "NONE" to not restore this window. + {only available when compiled with the |+terminal| feature} + +term_setsize({buf}, {rows}, {cols}) *term_setsize()* *E955* + Set the size of terminal {buf}. The size of the window + containing the terminal will also be adjusted, if possible. + If {rows} or {cols} is zero or negative, that dimension is not + changed. + + {buf} must be the buffer number of a terminal window. Use an + empty string for the current buffer. If the buffer does not + exist or is not a terminal window, an error is given. + {only available when compiled with the |+terminal| feature} + +term_start({cmd}, {options}) *term_start()* + Open a terminal window and run {cmd} in it. + + {cmd} can be a string or a List, like with |job_start()|. The + string "NONE" can be used to open a terminal window without + starting a job, the pty of the terminal can be used by a + command like gdb. + + Returns the buffer number of the terminal window. If {cmd} + cannot be executed the window does open and shows an error + message. + If opening the window fails zero is returned. + + {options} are similar to what is used for |job_start()|, see + |job-options|. However, not all options can be used. These + are supported: + all timeout options + "stoponexit" + "callback", "out_cb", "err_cb" + "exit_cb", "close_cb" + "in_io", "in_top", "in_bot", "in_name", "in_buf" + "out_io", "out_name", "out_buf", "out_modifiable", "out_msg" + "err_io", "err_name", "err_buf", "err_modifiable", "err_msg" + However, at least one of stdin, stdout or stderr must be + connected to the terminal. When I/O is connected to the + terminal then the callback function for that part is not used. + + There are extra options: + "term_name" name to use for the buffer name, instead + of the command name. + "term_rows" vertical size to use for the terminal, + instead of using 'termwinsize' + "term_cols" horizontal size to use for the terminal, + instead of using 'termwinsize' + "vertical" split the window vertically; note that + other window position can be defined with + command modifiers, such as |:belowright|. + "curwin" use the current window, do not split the + window; fails if the current buffer + cannot be |abandon|ed + "hidden" do not open a window + "norestore" do not add the terminal window to a + session file + "term_kill" what to do when trying to close the + terminal window, see |term_setkill()| + "term_finish" What to do when the job is finished: + "close": close any windows + "open": open window if needed + Note that "open" can be interruptive. + See |term++close| and |term++open|. + "term_opencmd" command to use for opening the window when + "open" is used for "term_finish"; must + have "%d" where the buffer number goes, + e.g. "10split|buffer %d"; when not + specified "botright sbuf %d" is used + "eof_chars" Text to send after all buffer lines were + written to the terminal. When not set + CTRL-D is used on MS-Windows. For Python + use CTRL-Z or "exit()". For a shell use + "exit". A CR is always added. + "ansi_colors" A list of 16 color names or hex codes + defining the ANSI palette used in GUI + color modes. See |g:terminal_ansi_colors|. + + {only available when compiled with the |+terminal| feature} + +term_wait({buf} [, {time}]) *term_wait()* + Wait for pending updates of {buf} to be handled. + {buf} is used as with |term_getsize()|. + {time} is how long to wait for updates to arrive in msec. If + not set then 10 msec will be used. + {only available when compiled with the |+terminal| feature} + +test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()* + This is for testing: If the memory allocation with {id} is + called, then decrement {countdown}, and when it reaches zero + let memory allocation fail {repeat} times. When {repeat} is + smaller than one it fails one time. + +test_autochdir() *test_autochdir()* + Set a flag to enable the effect of 'autochdir' before Vim + startup has finished. + +test_feedinput({string}) *test_feedinput()* + Characters in {string} are queued for processing as if they + were typed by the user. This uses a low level input buffer. + This function works only when with |+unix| or GUI is running. + +test_garbagecollect_now() *test_garbagecollect_now()* + Like garbagecollect(), but executed right away. This must + only be called directly to avoid any structure to exist + internally, and |v:testing| must have been set before calling + any function. + +test_ignore_error({expr}) *test_ignore_error()* + Ignore any error containing {expr}. A normal message is given + instead. + This is only meant to be used in tests, where catching the + error with try/catch cannot be used (because it skips over + following code). + {expr} is used literally, not as a pattern. + There is currently no way to revert this. + +test_null_channel() *test_null_channel()* + Return a Channel that is null. Only useful for testing. + {only available when compiled with the +channel feature} + +test_null_dict() *test_null_dict()* + Return a Dict that is null. Only useful for testing. + +test_null_job() *test_null_job()* + Return a Job that is null. Only useful for testing. + {only available when compiled with the +job feature} + +test_null_list() *test_null_list()* + Return a List that is null. Only useful for testing. + +test_null_partial() *test_null_partial()* + Return a Partial that is null. Only useful for testing. + +test_null_string() *test_null_string()* + Return a String that is null. Only useful for testing. + +test_override({name}, {val}) *test_override()* + Overrides certain parts of Vims internal processing to be able + to run tests. Only to be used for testing Vim! + The override is enabled when {val} is non-zero and removed + when {val} is zero. + Current supported values for name are: + + name effect when {val} is non-zero ~ + redraw disable the redrawing() function + char_avail disable the char_avail() function + starting reset the "starting" variable, see below + ALL clear all overrides ({val} is not used) + + "starting" is to be used when a test should behave like + startup was done. Since the tests are run by sourcing a + script the "starting" variable is non-zero. This is usually a + good thing (tests run faster), but sometimes changes behavior + in a way that the test doesn't work properly. + When using: > + call test_override('starting', 1) +< The value of "starting" is saved. It is restored by: > + call test_override('starting', 0) + +test_settime({expr}) *test_settime()* + Set the time Vim uses internally. Currently only used for + timestamps in the history, as they are used in viminfo, and + for undo. + Using a value of 1 makes Vim not sleep after a warning or + error message. + {expr} must evaluate to a number. When the value is zero the + normal behavior is restored. + + *timer_info()* +timer_info([{id}]) + Return a list with information about timers. + When {id} is given only information about this timer is + returned. When timer {id} does not exist an empty list is + returned. + When {id} is omitted information about all timers is returned. + + For each timer the information is stored in a Dictionary with + these items: + "id" the timer ID + "time" time the timer was started with + "remaining" time until the timer fires + "repeat" number of times the timer will still fire; + -1 means forever + "callback" the callback + "paused" 1 if the timer is paused, 0 otherwise + + {only available when compiled with the |+timers| feature} + +timer_pause({timer}, {paused}) *timer_pause()* + Pause or unpause a timer. A paused timer does not invoke its + callback when its time expires. Unpausing a timer may cause + the callback to be invoked almost immediately if enough time + has passed. + + Pausing a timer is useful to avoid the callback to be called + for a short time. + + If {paused} evaluates to a non-zero Number or a non-empty + String, then the timer is paused, otherwise it is unpaused. + See |non-zero-arg|. + + {only available when compiled with the |+timers| feature} + + *timer_start()* *timer* *timers* +timer_start({time}, {callback} [, {options}]) + Create a timer and return the timer ID. + + {time} is the waiting time in milliseconds. This is the + minimum time before invoking the callback. When the system is + busy or Vim is not waiting for input the time will be longer. + + {callback} is the function to call. It can be the name of a + function or a |Funcref|. It is called with one argument, which + is the timer ID. The callback is only invoked when Vim is + waiting for input. + + {options} is a dictionary. Supported entries: + "repeat" Number of times to repeat calling the + callback. -1 means forever. When not present + the callback will be called once. + If the timer causes an error three times in a + row the repeat is cancelled. This avoids that + Vim becomes unusable because of all the error + messages. + + Example: > + func MyHandler(timer) + echo 'Handler called' + endfunc + let timer = timer_start(500, 'MyHandler', + \ {'repeat': 3}) +< This will invoke MyHandler() three times at 500 msec + intervals. + + {only available when compiled with the |+timers| feature} + +timer_stop({timer}) *timer_stop()* + Stop a timer. The timer callback will no longer be invoked. + {timer} is an ID returned by timer_start(), thus it must be a + Number. If {timer} does not exist there is no error. + + {only available when compiled with the |+timers| feature} + +timer_stopall() *timer_stopall()* + Stop all timers. The timer callbacks will no longer be + invoked. Useful if some timers is misbehaving. If there are + no timers there is no error. + + {only available when compiled with the |+timers| feature} + tolower({expr}) *tolower()* The result is a copy of the String given, with all uppercase characters turned into lowercase (just like applying |gu| to @@ -6269,6 +8801,22 @@ tr({src}, {fromstr}, {tostr}) *tr()* echo tr("<blob>", "<>", "{}") < returns "{blob}" +trim({text}[, {mask}]) *trim()* + Return {text} as a String where any character in {mask} is + removed from the beginning and end of {text}. + If {mask} is not given, {mask} is all characters up to 0x20, + which includes Tab, space, NL and CR, plus the non-breaking + space character 0xa0. + This code deals with multibyte characters properly. + + Examples: > + echo trim(" some text ") +< returns "some text" > + echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL" +< returns "RESERVE_TAIL" > + echo trim("rm<Xrm<>X>rrm", "rm<>") +< returns "Xrm<>X" (characters in the middle are not removed) + trunc({expr}) *trunc()* Return the largest integral value with magnitude less than or equal to {expr} as a |Float| (truncate towards zero). @@ -6281,22 +8829,32 @@ trunc({expr}) *trunc()* echo trunc(4.0) < 4.0 {only available when compiled with the |+float| feature} - + *type()* -type({expr}) The result is a Number, depending on the type of {expr}: - Number: 0 - String: 1 - Funcref: 2 - List: 3 - Dictionary: 4 - Float: 5 - To avoid the magic numbers it should be used this way: > +type({expr}) The result is a Number representing the type of {expr}. + Instead of using the number directly, it is better to use the + v:t_ variable that has the value: + Number: 0 |v:t_number| + String: 1 |v:t_string| + Funcref: 2 |v:t_func| + List: 3 |v:t_list| + Dictionary: 4 |v:t_dict| + Float: 5 |v:t_float| + Boolean: 6 |v:t_bool| (v:false and v:true) + None 7 |v:t_none| (v:null and v:none) + Job 8 |v:t_job| + Channel 9 |v:t_channel| + For backward compatibility, this method can be used: > :if type(myvar) == type(0) :if type(myvar) == type("") :if type(myvar) == type(function("tr")) :if type(myvar) == type([]) :if type(myvar) == type({}) :if type(myvar) == type(0.0) + :if type(myvar) == type(v:false) + :if type(myvar) == type(v:none) +< To check if the v:t_ variables exist use this: > + :if exists('v:t_number') undofile({name}) *undofile()* Return the name of the undo file that would be used for a file @@ -6324,7 +8882,7 @@ undotree() *undotree()* "save_last" Number of the last file write. Zero when no write yet. "save_cur" Number of the current position in the undo - tree. + tree. "synced" Non-zero when the last undo block was synced. This happens when waiting from input from the user. See |undo-blocks|. @@ -6363,7 +8921,7 @@ uniq({list} [, {func} [, {dict}]]) *uniq()* *E882* each item. For the use of {func} and {dict} see |sort()|. values({dict}) *values()* - Return a |List| with all the values of {dict}. The |List| is + Return a |List| with all the values of {dict}. The |List| is in arbitrary order. @@ -6390,12 +8948,16 @@ virtcol({expr}) *virtcol()* plus one) 'x position of mark x (if the mark is not set, 0 is returned) + v In Visual mode: the start of the Visual area (the + cursor is the end). When not in Visual mode + returns the cursor position. Differs from |'<| in + that it's updated right away. Note that only marks in the current file can be used. Examples: > virtcol(".") with text "foo^Lbar", with cursor on the "^L", returns 5 virtcol("$") with text "foo^Lbar", returns 9 virtcol("'t") with text " there", with 't at 'h', returns 6 -< The first column is 1. 0 is returned for an error. +< The first column is 1. 0 is returned for an error. A more advanced example that echoes the maximum length of all lines: > echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) @@ -6415,16 +8977,12 @@ visualmode([expr]) *visualmode()* Visual mode that was used. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). - *non-zero-arg* If [expr] is supplied and it evaluates to a non-zero Number or a non-empty String, then the Visual mode will be cleared and - the old value is returned. Note that " " and "0" are also - non-empty strings, thus cause the mode to be cleared. A List, - Dictionary or Float is not a Number or String, thus does not - cause the mode to be cleared. + the old value is returned. See |non-zero-arg|. wildmenumode() *wildmenumode()* - Returns non-zero when the wildmenu is active and zero + Returns |TRUE| when the wildmenu is active and |FALSE| otherwise. See 'wildmenu' and 'wildmode'. This can be used in mappings to handle the 'wildcharm' option gracefully. (Makes only sense with |mapmode-c| mappings). @@ -6435,11 +8993,48 @@ wildmenumode() *wildmenumode()* (Note, this needs the 'wildcharm' option set appropriately). +win_findbuf({bufnr}) *win_findbuf()* + Returns a list with |window-ID|s for windows that contain + buffer {bufnr}. When there is none the list is empty. + +win_getid([{win} [, {tab}]]) *win_getid()* + Get the |window-ID| for the specified window. + When {win} is missing use the current window. + With {win} this is the window number. The top window has + number 1. Use `win_getid(winnr())` for the current window. + Without {tab} use the current tab, otherwise the tab with + number {tab}. The first tab has number one. + Return zero if the window cannot be found. + +win_gotoid({expr}) *win_gotoid()* + Go to window with ID {expr}. This may also change the current + tabpage. + Return 1 if successful, 0 if the window cannot be found. + +win_id2tabwin({expr}) *win_id2tabwin()* + Return a list with the tab number and window number of window + with ID {expr}: [tabnr, winnr]. + Return [0, 0] if the window cannot be found. + +win_id2win({expr}) *win_id2win()* + Return the window number of window with ID {expr}. + Return 0 if the window cannot be found in the current tabpage. + +win_screenpos({nr}) *win_screenpos()* + Return the screen position of window {nr} as a list with two + numbers: [row, col]. The first window always has position + [1, 1]. + {nr} can be the window number or the |window-ID|. + Return [0, 0] if the window cannot be found in the current + tabpage. + *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer - associated with window {nr}. When {nr} is zero, the number of - 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)) < @@ -6450,15 +9045,17 @@ 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. + This excludes any window toolbar line. Examples: > :echo "The current window has " . winheight(0) . " lines." < *winline()* winline() The result is a Number, which is the screen line of the cursor - in the window. This is counting screen lines from the top of + in the window. This is counting screen lines from the top of the window. The first line is one. If the cursor was moved the view on the file will be updated first, this may cause a scroll. @@ -6475,7 +9072,7 @@ winnr([{arg}]) The result is a Number, which is the number of the current is returned. The number can be used with |CTRL-W_w| and ":wincmd w" |:wincmd|. - Also see |tabpagewinnr()|. + Also see |tabpagewinnr()| and |win_getid()|. *winrestcmd()* winrestcmd() Returns a sequence of |:resize| commands that should restore @@ -6529,23 +9126,64 @@ 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. Examples: > :echo "The current window has " . winwidth(0) . " columns." :if winwidth(0) <= 50 - : exe "normal 50\<C-W>|" + : 50 wincmd | :endif -< +< For getting the terminal or screen size, see the 'columns' + option. + + +wordcount() *wordcount()* + The result is a dictionary of byte/chars/word statistics for + the current buffer. This is the same info as provided by + |g_CTRL-G| + The return value includes: + bytes Number of bytes in the buffer + chars Number of chars in the buffer + words Number of words in the buffer + cursor_bytes Number of bytes before cursor position + (not in Visual mode) + cursor_chars Number of chars before cursor position + (not in Visual mode) + cursor_words Number of words before cursor position + (not in Visual mode) + visual_bytes Number of bytes visually selected + (only in Visual mode) + visual_chars Number of chars visually selected + (only in Visual mode) + visual_words Number of words visually selected + (only in Visual mode) + + *writefile()* -writefile({list}, {fname} [, {binary}]) +writefile({list}, {fname} [, {flags}]) Write |List| {list} to file {fname}. Each list item is separated with a NL. Each list item must be a String or Number. - When {binary} is equal to "b" binary mode is used: There will + When {flags} contains "b" then binary mode is used: There will not be a NL after the last list item. An empty item at the end does cause the last line in the file to end in a NL. + + When {flags} contains "a" then append mode is used, lines are + appended to the file: > + :call writefile(["foo"], "event.log", "a") + :call writefile(["bar"], "event.log", "a") +< + When {flags} contains "s" then fsync() is called after writing + the file. This flushes the file to disk, if possible. This + takes more time but avoids losing the file if the system + crashes. + When {flags} does not contain "S" or "s" then fsync() is + called if the 'fsync' option is set. + When {flags} contains "S" then fsync() is not called, even + when 'fsync' is set. + All NL characters are replaced with a NUL character. Inserting CR characters needs to be done before passing {list} to writefile(). @@ -6576,22 +9214,20 @@ 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 - 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): > - :if v:version > 602 || v:version == 602 && has("patch148") -< 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 - 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 - need to use the example above that checks v:version. Example: > +3. Beyond a certain version or at a certain version and including a specific + patch. The "patch-7.4.248" feature means that the Vim version is 7.5 or + later, or it is version 7.4 and patch 248 was included. Example: > :if has("patch-7.4.248") -< Note that it's possible for patch 147 to be omitted even though 148 is - included. +< Note that it's possible for patch 248 to be omitted even though 249 is + included. Only happens when cherry-picking patches. + Note that this form only works for patch 7.4.237 and later, before that + you need to check for the patch and the v:version. Example (checking + version 6.2.148 or later): > + :if v:version > 602 || (v:version == 602 && has("patch148")) + +Hint: To find out if Vim supports backslashes in a file name (MS-Windows), +use: `if exists('+shellslash')` + acl Compiled with |ACL| support. all_builtin_terms Compiled with all builtin terminals enabled. @@ -6599,6 +9235,7 @@ amiga Amiga version of Vim. arabic Compiled with Arabic support |Arabic|. arp Compiled with ARP support (Amiga). autocmd Compiled with autocommand support. |autocommand| +autoservername Automatically enable |clientserver| balloon_eval Compiled with |balloon-eval| support. balloon_multiline GUI supports multiline balloons. beos BeOS version of Vim. @@ -6622,14 +9259,13 @@ dialog_con Compiled with console dialog support. dialog_gui Compiled with GUI dialog support. diff Compiled with |vimdiff| and 'diff' support. digraphs Compiled with support for digraphs. +directx Compiled with support for DirectX and 'renderoptions'. dnd Compiled with support for the "~ register |quote_~|. -dos16 16 bits DOS version of Vim. -dos32 32 bits DOS (DJGPP) version of Vim. ebcdic Compiled on a machine with ebcdic character set. emacs_tags Compiled with support for Emacs tags. eval Compiled with expression evaluation support. Always true, of course! -ex_extra Compiled with extra Ex commands |+ex_extra|. +ex_extra |+ex_extra|, always true now extra_search Compiled with support for |'incsearch'| and |'hlsearch'| farsi Compiled with Farsi support |farsi|. @@ -6651,6 +9287,7 @@ gui_athena Compiled with Athena GUI. gui_gnome Compiled with Gnome support (gui_gtk is also defined). gui_gtk Compiled with GTK+ GUI (any version). gui_gtk2 Compiled with GTK+ 2 GUI (gui_gtk is also defined). +gui_gtk3 Compiled with GTK+ 3 GUI (gui_gtk is also defined). gui_mac Compiled with Macintosh GUI. gui_macvim Compiled with MacVim GUI. gui_motif Compiled with Motif GUI. @@ -6664,6 +9301,7 @@ insert_expand Compiled with support for CTRL-X expansion commands in Insert mode. jumplist Compiled with |jumplist| support. keymap Compiled with 'keymap' support. +lambda Compiled with |lambda| support. langmap Compiled with 'langmap' support. libcall Compiled with |libcall()| support. linebreak Compiled with 'linebreak', 'breakat', 'showbreak' and @@ -6673,8 +9311,8 @@ listcmds Compiled with commands for the buffer list |:files| and the argument list |arglist|. localmap Compiled with local mappings and abbr. |:map-local| lua Compiled with Lua interface |Lua|. -mac Macintosh version of Vim. -macunix Macintosh version of Vim, using Unix files (OS-X). +mac Any Macintosh version of Vim cf. osx +macunix Synonym for osxdarwin menu Compiled with support for |:menu|. mksession Compiled with support for |:mksession|. modify_fname Compiled with file name modifiers. |filename-modifiers| @@ -6695,17 +9333,25 @@ multi_lang Compiled with support for multiple languages. mzscheme Compiled with MzScheme interface |mzscheme|. netbeans_enabled Compiled with support for |netbeans| and connected. netbeans_intg Compiled with support for |netbeans|. +num64 Compiled with 64-bit |Number| support. odbeditor Compiled with |odbeditor| support. ole Compiled with OLE automation support for Win32. -os2 OS/2 version of Vim. +osx Compiled for macOS cf. mac +osxdarwin Compiled for macOS, with |mac-darwin-feature| +packages Compiled with |packages| support. path_extra Compiled with up/downwards search in 'path' and 'tags' perl Compiled with Perl interface. persistent_undo Compiled with support for persistent undo history. postscript Compiled with PostScript file printing. printer Compiled with |:hardcopy| support. profile Compiled with |:profile| support. -python Compiled with Python 2.x interface. |has-python| -python3 Compiled with Python 3.x interface. |has-python| +python Python 2.x interface available. |has-python| +python_compiled Compiled with Python 2.x interface. |has-python| +python_dynamic Python 2.x interface is dynamically loaded. |has-python| +python3 Python 3.x interface available. |has-python| +python3_compiled Compiled with Python 3.x interface. |has-python| +python3_dynamic Python 3.x interface is dynamically loaded. |has-python| +pythonx Compiled with |python_x| interface. |has-pythonx| qnx QNX version of Vim. quickfix Compiled with |quickfix| support. reltime Compiled with |reltime()| support. @@ -6715,7 +9361,6 @@ scrollbind Compiled with 'scrollbind' support. showcmd Compiled with 'showcmd' support. signs Compiled with |:sign| support. smartindent Compiled with 'smartindent' support. -sniff Compiled with SNiFF interface support. spell Compiled with spell checking support |spell|. startuptime Compiled with |--startuptime| support. statusline Compiled with support for 'statusline', 'rulerformat' @@ -6732,18 +9377,27 @@ tag_old_static Compiled with support for old static tags tag_any_white Compiled with support for any white characters in tags files |tag-any-white|. tcl Compiled with Tcl interface. +termguicolors Compiled with true color in terminal support. +terminal Compiled with |terminal| support. terminfo Compiled with terminfo instead of termcap. termresponse Compiled with support for |t_RV| and |v:termresponse|. textobjects Compiled with support for |text-objects|. tgetent Compiled with tgetent support, able to use a termcap or terminfo file. +timers Compiled with |timer_start()| support. title Compiled with window title support |'title'|. toolbar Compiled with support for |gui-toolbar|. transparency Compiled with 'transparency' support. -unix Unix version of Vim. +ttyin input is a terminal (tty) +ttyout output is a terminal (tty) +unix Unix version of Vim. *+unix* +unnamedplus Compiled with support for "unnamedplus" in 'clipboard' user_commands User-defined commands. +vcon Win32: Virtual console support is working, can use + 'termguicolors'. Also see |+vtp|. vertsplit Compiled with vertically split windows |:vsplit|. vim_starting True while initial source'ing takes place. |startup| + *vim_starting* viminfo Compiled with viminfo support. virtualedit Compiled with 'virtualedit' option. visual Compiled with Visual mode. @@ -6751,14 +9405,16 @@ visualextra Compiled with extra Visual mode commands. |blockwise-operators|. vms VMS version of Vim. vreplace Compiled with |gR| and |gr| commands. +vtp Compiled for vcon support |+vtp| (check vcon to find + out if it works in the current console). wildignore Compiled with 'wildignore' option. wildmenu Compiled with 'wildmenu' option. -win16 Win16 version of Vim (MS-Windows 3.1). +win16 old version for MS-Windows 3.1 (always False) win32 Win32 version of Vim (MS-Windows 95 and later, 32 or 64 bits) win32unix Win32 version of Vim, using Unix files (Cygwin) win64 Win64 version of Vim (MS-Windows 64 bit). -win95 Win32 version for MS-Windows 95/98/ME. +win95 Win32 version for MS-Windows 95/98/ME (always False) winaltkeys Compiled with 'winaltkeys' option. windows Compiled with support for more than one window. writebackup Compiled with 'writebackup' default on. @@ -6842,21 +9498,24 @@ last defined. Example: > See |:verbose-cmd| for more information. *E124* *E125* *E853* *E884* -:fu[nction][!] {name}([arguments]) [range] [abort] [dict] - Define a new function by the name {name}. The name - must be made of alphanumeric characters and '_', and - must start with a capital or "s:" (see above). Note - that using "b:" or "g:" is not allowed. (since patch - 7.4.260 E884 is given if the function name has a colon - in the name, e.g. for "foo:bar()". Before that patch - no error was given). +:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure] + Define a new function by the name {name}. The body of + the function follows in the next lines, until the + matching |:endfunction|. + + The name must be made of alphanumeric characters and + '_', and must start with a capital or "s:" (see + above). Note that using "b:" or "g:" is not allowed. + (since patch 7.4.260 E884 is given if the function + name has a colon in the name, e.g. for "foo:bar()". + Before that patch no error was given). {name} can also be a |Dictionary| entry that is a |Funcref|: > :function dict.init(arg) -< "dict" must be an existing dictionary. The entry +< "dict" must be an existing dictionary. The entry "init" is added if it didn't exist yet. Otherwise [!] - is required to overwrite an existing function. The + is required to overwrite an existing function. The result is a |Funcref| to a numbered function. The function can only be used with a |Funcref| and will be deleted if there are no more references to it. @@ -6865,6 +9524,9 @@ See |:verbose-cmd| for more information. not used an error message is given. When [!] is used, an existing function is silently replaced. Unless it is currently being executed, that is an error. + NOTE: Use ! wisely. If used without care it can cause + an existing function to be replaced unexpectedly, + which is hard to debug. For the {arguments} see |function-argument|. @@ -6882,9 +9544,31 @@ See |:verbose-cmd| for more information. abort as soon as an error is detected. *:func-dict* When the [dict] argument is added, the function must - be invoked through an entry in a |Dictionary|. The + be invoked through an entry in a |Dictionary|. The local variable "self" will then be set to the dictionary. See |Dictionary-function|. + *:func-closure* *E932* + When the [closure] argument is added, the function + can access variables and arguments from the outer + scope. This is usually called a closure. In this + example Bar() uses "x" from the scope of Foo(). It + remains referenced even after Foo() returns: > + :function! Foo() + : let x = 0 + : function! Bar() closure + : let x += 1 + : return x + : endfunction + : return funcref('Bar') + :endfunction + + :let F = Foo() + :echo F() +< 1 > + :echo F() +< 2 > + :echo F() +< 3 *function-search-undo* The last used search pattern and the redo command "." @@ -6892,18 +9576,36 @@ See |:verbose-cmd| for more information. implies that the effect of |:nohlsearch| is undone when the function returns. - *:endf* *:endfunction* *E126* *E193* -:endf[unction] The end of a function definition. Must be on a line - by its own, without other commands. - - *:delf* *:delfunction* *E130* *E131* -:delf[unction] {name} Delete function {name}. + *:endf* *:endfunction* *E126* *E193* *W22* +:endf[unction] [argument] + The end of a function definition. Best is to put it + on a line by its own, without [argument]. + + [argument] can be: + | command command to execute next + \n command command to execute next + " comment always ignored + anything else ignored, warning given when + 'verbose' is non-zero + The support for a following command was added in Vim + 8.0.0654, before that any argument was silently + ignored. + + To be able to define a function inside an `:execute` + command, use line breaks instead of |:bar|: > + :exe "func Foo()\necho 'foo'\nendfunc" +< + *:delf* *:delfunction* *E130* *E131* *E933* +:delf[unction][!] {name} + Delete function {name}. {name} can also be a |Dictionary| entry that is a |Funcref|: > :delfunc dict.init -< This will remove the "init" entry from "dict". The +< This will remove the "init" entry from "dict". The function is deleted if there are no more references to it. + With the ! there is no error if the function does not + exist. *:retu* *:return* *E133* :retu[rn] [expr] Return from a function. When "[expr]" is given, it is evaluated and returned as the result of the function. @@ -6921,7 +9623,7 @@ See |:verbose-cmd| for more information. returns at the outermost ":endtry". *function-argument* *a:var* -An argument can be defined by giving its name. In the function this can then +An argument can be defined by giving its name. In the function this can then be used as "a:name" ("a:" for argument). *a:0* *a:1* *a:000* *E740* *...* Up to 20 arguments can be given, separated by commas. After the named @@ -6932,24 +9634,23 @@ can be 0). "a:000" is set to a |List| that contains these arguments. Note that "a:1" is the same as "a:000[0]". *E742* The a: scope and the variables in it cannot be changed, they are fixed. -However, if a |List| or |Dictionary| is used, you can change their contents. -Thus you can pass a |List| to a function and have the function add an item to -it. If you want to make sure the function cannot change a |List| or -|Dictionary| use |:lockvar|. +However, if a composite type is used, such as |List| or |Dictionary| , you can +change their contents. Thus you can pass a |List| to a function and have the +function add an item to it. If you want to make sure the function cannot +change a |List| or |Dictionary| use |:lockvar|. When not using "...", the number of arguments in a function call must be equal to the number of named arguments. When using "...", the number of arguments may be larger. It is also possible to define a function without any arguments. You must -still supply the () then. The body of the function follows in the next lines, -until the matching |:endfunction|. It is allowed to define another function -inside a function body. +still supply the () then. + +It is allowed to define another function inside a function body. *local-variables* -Inside a function variables can be used. These are local variables, which -will disappear when the function returns. Global variables need to be -accessed with "g:". +Inside a function local variables can be used. These will disappear when the +function returns. Global variables need to be accessed with "g:". Example: > :function Table(title, ...) @@ -6993,7 +9694,7 @@ This function can then be called with: > itself, the function is executed for each line in the range, with the cursor in the first column of that line. The cursor is left at the last line (possibly moved by the last function - call). The arguments are re-evaluated for each line. Thus + call). The arguments are re-evaluated for each line. Thus this works: *function-range-example* > :function Mynumber(arg) @@ -7038,7 +9739,7 @@ This is introduced in the user manual, section |41.14|. The autocommand is useful if you have a plugin that is a long Vim script file. You can define the autocommand and quickly quit the script with |:finish|. -That makes Vim startup faster. The autocommand should then load the same file +That makes Vim startup faster. The autocommand should then load the same file again, setting a variable to skip the |:finish| command. Use the FuncUndefined autocommand event with a pattern that matches the @@ -7120,7 +9821,7 @@ name. So in the above example, if the variable "adjective" was set to "adjective" was set to "quiet", then it would be to "my_quiet_variable". One application for this is to create a set of variables governed by an option -value. For example, the statement > +value. For example, the statement > echo my_{&background}_message would output the contents of "my_dark_message" or "my_light_message" depending @@ -7166,7 +9867,7 @@ This does NOT work: > must be a valid index in that list. For nested list the index can be repeated. This cannot be used to add an item to a |List|. - This cannot be used to set a byte in a String. You + This cannot be used to set a byte in a String. You can do that like this: > :let var = var[0:2] . 'X' . var[4:] < @@ -7211,7 +9912,7 @@ This does NOT work: > that would match everywhere. :let @{reg-name} .= {expr1} - Append {expr1} to register {reg-name}. If the + Append {expr1} to register {reg-name}. If the register was empty it's like setting it to {expr1}. :let &{option-name} = {expr1} *:let-option* *:let-&* @@ -7223,6 +9924,11 @@ This does NOT work: > value and the global value are changed. Example: > :let &path = &path . ',/usr/local/include' +< This also works for terminal codes in the form t_xx. + But only for alphanumerical names. Example: > + :let &t_k1 = "\<Esc>[234;" +< When the code does not exist yet it will be created as + a terminal key code, there is no error. :let &{option-name} .= {expr1} For a string option: Append {expr1} to the value. @@ -7287,7 +9993,7 @@ This does NOT work: > |List| item. *E121* -:let {var-name} .. List the value of variable {var-name}. Multiple +:let {var-name} .. List the value of variable {var-name}. Multiple variable names may be given. Special names recognized here: *E738* g: global variables @@ -7323,6 +10029,14 @@ This does NOT work: > variables are automatically deleted when the function ends. +:unl[et] ${env-name} ... *:unlet-environment* *:unlet-$* + Remove environment variable {env-name}. + Can mix {name} and ${env-name} in one :unlet command. + No error message is given for a non-existing + variable, also without !. + If the system does not support deleting an environment + variable, it is made emtpy. + :lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv* Lock the internal variable {name}. Locking means that it can no longer be changed (until it is unlocked). @@ -7330,9 +10044,12 @@ This does NOT work: > :lockvar v :let v = 'asdf' " fails! :unlet v -< *E741* +< *E741* *E940* If you try to change a locked variable you get an - error message: "E741: Value of {name} is locked" + error message: "E741: Value is locked: {name}". + If you try to lock or unlock a built-in variable you + get an error message: "E940: Cannot lock or unlock + variable {name}". [depth] is relevant when locking a |List| or |Dictionary|. It specifies how deep the locking goes: @@ -7378,7 +10095,7 @@ This does NOT work: > From Vim version 4.5 until 5.0, every Ex command in between the ":if" and ":endif" is ignored. These two commands were just to allow for future expansions in a - backwards compatible way. Nesting was allowed. Note + backward compatible way. Nesting was allowed. Note that any ":else" or ":elseif" was ignored, the "else" part was not executed either. @@ -7436,7 +10153,7 @@ This does NOT work: > :for item in copy(mylist) < When not making a copy, Vim stores a reference to the next item in the list, before executing the commands - with the current item. Thus the current item can be + with the current item. Thus the current item can be removed without effect. Removing any later item means it will not be found. Thus the following example works (an inefficient way to make a list empty): > @@ -7445,14 +10162,6 @@ This does NOT work: > endfor < Note that reordering the list (e.g., with sort() or reverse()) may have unexpected effects. - Note that the type of each list item should be - identical to avoid errors for the type of {var} - changing. Unlet the variable at the end of the loop - to allow multiple item types: > - for item in ["foo", ["bar"]] - echo item - unlet item " E706 without this - endfor :for [{var1}, {var2}, ...] in {listlist} :endfo[r] @@ -7650,7 +10359,7 @@ This does NOT work: > message in the |message-history|. When used in a script or function the line number will be added. Spaces are placed between the arguments as with the - :echo command. When used inside a try conditional, + :echo command. When used inside a try conditional, the message is raised as an error exception instead (see |try-echoerr|). Example: > @@ -7779,14 +10488,14 @@ the finally clause. It is resumed at the ":endtry", so that commands after the ":endtry" are not executed and the exception might be caught elsewhere, see |try-nesting|. When during execution of a catch clause another exception is thrown, the -remaining lines in that catch clause are not executed. The new exception is +remaining lines in that catch clause are not executed. The new exception is not matched against the patterns in any of the ":catch" commands of the same try conditional and none of its catch clauses is taken. If there is, however, a finally clause, it is executed, and the exception pends during its execution. The commands following the ":endtry" are not executed. The new exception might, however, be caught elsewhere, see |try-nesting|. When during execution of the finally clause (if present) an exception is -thrown, the remaining lines in the finally clause are skipped. If the finally +thrown, the remaining lines in the finally clause are skipped. If the finally clause has been taken because of an exception from the try block or one of the catch clauses, the original (pending) exception is discarded. The commands following the ":endtry" are not executed, and the exception from the finally @@ -7820,7 +10529,7 @@ catch an exception thrown in its try block or throws a new exception from one of its catch clauses or its finally clause, the outer try conditional is checked according to the rules above. If the inner try conditional is in the try block of the outer try conditional, its catch clauses are checked, but -otherwise only the finally clause is executed. It does not matter for +otherwise only the finally clause is executed. It does not matter for nesting, whether the inner try conditional is directly contained in the outer one, or whether the outer one sources a script or calls a function containing the inner try conditional. @@ -7883,7 +10592,7 @@ executed. > however displays "in Bar" and throws 4711. Any other command that takes an expression as argument might also be -abandoned by an (uncaught) exception during the expression evaluation. The +abandoned by an (uncaught) exception during the expression evaluation. The exception is then propagated to the caller of the command. Example: > @@ -8067,13 +10776,13 @@ CLEANUP CODE *try-finally* Scripts often change global settings and restore them at their end. If the user however interrupts the script by pressing CTRL-C, the settings remain in -an inconsistent state. The same may happen to you in the development phase of +an inconsistent state. The same may happen to you in the development phase of a script when an error occurs or you explicitly throw an exception without catching it. You can solve these problems by using a try conditional with a finally clause for restoring the settings. Its execution is guaranteed on normal control flow, on error, on an explicit ":throw", and on interrupt. (Note that errors and interrupts from inside the try conditional are converted -to exceptions. When not caught, they terminate the script after the finally +to exceptions. When not caught, they terminate the script after the finally clause has been executed.) Example: > @@ -8131,7 +10840,7 @@ This displays "first", "cleanup", "second", "cleanup", and "end". > :echo Foo() "returned by Foo" This displays "cleanup" and "4711 returned by Foo". You don't need to add an -extra ":return" in the finally clause. (Above all, this would override the +extra ":return" in the finally clause. (Above all, this would override the return value.) *except-from-finally* @@ -8175,7 +10884,7 @@ or > Vim:{errmsg} {cmdname} is the name of the command that failed; the second form is used when -the command name is not known. {errmsg} is the error message usually produced +the command name is not known. {errmsg} is the error message usually produced when the error occurs outside try conditionals. It always begins with a capital "E", followed by a two or three-digit error number, a colon, and a space. @@ -8236,7 +10945,7 @@ You can catch all Vim errors by the pattern > *catch-text* NOTE: You should never catch the error message text itself: > :catch /No such variable/ -only works in the english locale, but not when the user has selected +only works in the English locale, but not when the user has selected a different language by the |:language| command. It is however helpful to cite the message text in a comment: > :catch /^Vim(\a\+):E108:/ " No such variable @@ -8280,7 +10989,7 @@ This works also when a try conditional is active. CATCHING INTERRUPTS *catch-interrupt* When there are active try conditionals, an interrupt (CTRL-C) is converted to -the exception "Vim:Interrupt". You can catch it like every exception. The +the exception "Vim:Interrupt". You can catch it like every exception. The script is not terminated, then. Example: > @@ -8314,7 +11023,7 @@ script is not terminated, then. :endwhile You can interrupt a task here by pressing CTRL-C; the script then asks for -a new command. If you press CTRL-C at the prompt, the script is terminated. +a new command. If you press CTRL-C at the prompt, the script is terminated. For testing what happens when CTRL-C would be pressed on a specific line in your script, use the debug mode and execute the |>quit| or |>interrupt| @@ -8471,7 +11180,7 @@ For some commands, the normal action can be replaced by a sequence of autocommands. Exceptions from that sequence will be catchable by the caller of the command. Example: For the ":write" command, the caller cannot know whether the file -had actually been written when the exception occurred. You need to tell it in +had actually been written when the exception occurred. You need to tell it in some way. > :if !exists("cnt") @@ -8619,8 +11328,8 @@ or ":endif". On the other hand, errors should be catchable as exceptions This problem has been solved by converting errors to exceptions and using immediate abortion (if not suppressed by ":silent!") only when a try -conditional is active. This is no restriction since an (error) exception can -be caught only from an active try conditional. If you want an immediate +conditional is active. This is no restriction since an (error) exception can +be caught only from an active try conditional. If you want an immediate termination without catching the error, just use a try conditional without catch clause. (You can cause cleanup code being executed before termination by specifying a finally clause.) @@ -8635,8 +11344,8 @@ conditional of a new script, you might change the control flow of the existing script on error. You get the immediate abortion on error and can catch the error in the new script. If however the sourced script suppresses error messages by using the ":silent!" command (checking for errors by testing -|v:errmsg| if appropriate), its execution path is not changed. The error is -not converted to an exception. (See |:silent|.) So the only remaining cause +|v:errmsg| if appropriate), its execution path is not changed. The error is +not converted to an exception. (See |:silent|.) So the only remaining cause where this happens is for scripts that don't care about errors and produce error messages. You probably won't want to use such code from your new scripts. @@ -8787,7 +11496,7 @@ code can be used: > redir => scriptnames_output silent scriptnames redir END - + " Split the output into lines and parse each line. Add an entry to the " "scripts" dictionary. let scripts = {} @@ -8824,6 +11533,17 @@ missing: > : echo "You will _never_ see this message" :endif +To execute a command only when the |+eval| feature is disabled requires a trick, +as this example shows: > + + silent! while 0 + set history=111 + silent! endwhile + +When the |+eval| feature is available the command is skipped because of the +"while 0". Without the |+eval| feature the "while 0" is an error, which is +silently ignored, and the command is executed. + ============================================================================== 11. The sandbox *eval-sandbox* *sandbox* *E48* @@ -8868,7 +11588,7 @@ option will still be marked as it was set in the sandbox. In a few situations it is not allowed to change the text in the buffer, jump to another window and some other things that might confuse or break what Vim is currently doing. This mostly applies to things that happen when Vim is -actually doing something else. For example, evaluating the 'balloonexpr' may +actually doing something else. For example, evaluating the 'balloonexpr' may happen any moment the mouse cursor is resting at some position. This is not allowed when the textlock is active: @@ -8878,5 +11598,26 @@ This is not allowed when the textlock is active: - closing a window or quitting Vim - etc. +============================================================================== +13. Testing *testing* + +Vim can be tested after building it, usually with "make test". +The tests are located in the directory "src/testdir". + +There are several types of tests added over time: + test33.in oldest, don't add any more + test_something.in old style tests + test_something.vim new style tests + + *new-style-testing* +New tests should be added as new style tests. These use functions such as +|assert_equal()| to keep the test commands and the expected result in one +place. + *old-style-testing* +In some cases an old style test needs to be used. E.g. when testing Vim +without the |+eval| feature. + +Find more information in the file src/testdir/README.txt. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/farsi.txt b/runtime/doc/farsi.txt index 77ec419d1f..1bb9f20727 100644 --- a/runtime/doc/farsi.txt +++ b/runtime/doc/farsi.txt @@ -1,4 +1,4 @@ -*farsi.txt* For Vim version 7.4. Last change: 2010 Aug 07 +*farsi.txt* For Vim version 8.1. Last change: 2015 Aug 29 VIM REFERENCE MANUAL by Mortaza Ghassab Shiran @@ -59,7 +59,7 @@ o Toggling between Farsi ISIR-3342 standard encoding and Vim Farsi via F9 right-to-left mode, this function is also supported only in right-to-left mode. -Farsi Fonts *farsi fonts* +Farsi Fonts *farsi-fonts* ----------- The following files are found in the subdirectories of the '$VIM/farsi/fonts' @@ -222,7 +222,7 @@ o Keyboard Note: stands for Farsi PSP (break without space) - stands for Farsi PCN (for HAMZE attribute ) + stands for Farsi PCN (for HAMZE attribute) Restrictions ------------ diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 94454fb469..f41dc703e3 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 7.4. Last change: 2013 Dec 15 +*filetype.txt* For Vim version 8.1. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -43,7 +43,7 @@ Detail: The ":filetype on" command will load one of these files: BufNewFile and BufRead events. If the file type is not found by the name, the file $VIMRUNTIME/scripts.vim is used to detect it from the contents of the file. - When the GUI is running or will start soon, the menu.vim script is + When the GUI is running or will start soon, the |menu.vim| script is also sourced. See |'go-M'| about avoiding that. To add your own file types, see |new-filetype| below. To search for help on a @@ -319,6 +319,10 @@ then Vim will load all plugins in these directories and below: Note that the last one is the value of $VIMRUNTIME which has been expanded. +Note that when using a plugin manager or |packages| many directories will be +added to 'runtimepath'. These plugins earch require their own directory, +don't put them directly in ~/.vim/plugin. + What if it looks like your plugin is not being loaded? You can find out what happens when Vim starts up by using the |-V| argument: > @@ -353,12 +357,12 @@ define yourself. There are a few ways to avoid this: You need to define your own mapping before the plugin is loaded (before editing a file of that type). The plugin will then skip installing the default mapping. - + *no_mail_maps* 3. Disable defining mappings for a specific filetype by setting a variable, which contains the name of the filetype. For the "mail" filetype this would be: > :let no_mail_maps = 1 - +< *no_plugin_maps* 4. Disable defining mappings for all filetypes by setting a variable: > :let no_plugin_maps = 1 < @@ -552,7 +556,7 @@ Local mappings: to the end of the file in Normal mode. This means "> " is inserted in each line. -MAN *ft-man-plugin* *:Man* +MAN *ft-man-plugin* *:Man* *man.vim* Displays a manual page in a nice way. Also see the user manual |find-manpage|. @@ -573,11 +577,46 @@ Man {number} {name} Global mapping: <Leader>K Displays the manual page for the word under the cursor. +<Plug>ManPreGetPage idem, allows for using a mapping: > + nmap <F1> <Plug>ManPreGetPage<CR> Local mappings: CTRL-] Jump to the manual page for the word under the cursor. CTRL-T Jump back to the previous manual page. +q Same as ":quit" + +To use a vertical split instead of horizontal: > + let g:ft_man_open_mode = 'vert' +To use a new tab: > + let g:ft_man_open_mode = 'tab' + +To enable folding use this: > + let g:ft_man_folding_enable = 1 +If you do not like the default folding, use an autocommand to add your desired +folding style instead. For example: > + autocmd FileType man setlocal foldmethod=indent foldenable + +You may also want to set 'keywordprg' to make the |K| command open a manual +page in a Vim window: > + set keywordprg=:Man + + +MANPAGER *manpager.vim* + +The :Man command allows you to turn Vim into a manpager (that syntax highlights +manpages and follows linked manpages on hitting CTRL-]). +For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...) + + export MANPAGER="vim -M +MANPAGER -" + +For (t)csh, add to the config file + + setenv MANPAGER "vim -M +MANPAGER -" + +For fish, add to the config file + + set -x MANPAGER "vim -M +MANPAGER -" PDF *ft-pdf-plugin* @@ -593,12 +632,29 @@ These maps can be disabled with > :let g:no_pdf_maps = 1 < +PYTHON *ft-python-plugin* *PEP8* + +By default the following options are set, in accordance with PEP8: > + + setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 + +To disable this behaviour, set the following variable in your vimrc: > + + let g:python_recommended_style = 0 + + RPM SPEC *ft-spec-plugin* Since the text for this plugin is rather long it has been put in a separate file: |pi_spec.txt|. +RUST *ft-rust* + +Since the text for this plugin is rather long it has been put in a separate +file: |ft_rust.txt|. + + SQL *ft-sql* Since the text for this plugin is rather long it has been put in a separate @@ -620,4 +676,23 @@ You can change the default by defining the variable g:tex_flavor to the format Currently no other formats are recognized. +VIM *ft-vim-plugin* + +The Vim filetype plugin defines mappings to move to the start and end of +functions with [[ and ]]. Move around comments with ]" and [". + +The mappings can be disabled with: > + let g:no_vim_maps = 1 + + +ZIMBU *ft-zimbu-plugin* + +The Zimbu filetype plugin defines mappings to move to the start and end of +functions with [[ and ]]. + +The mappings can be disabled with: > + let g:no_zimbu_maps = 1 +< + + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 6ae2ff8682..ad3f514663 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -1,4 +1,4 @@ -*fold.txt* For Vim version 7.4. Last change: 2013 Dec 04 +*fold.txt* For Vim version 8.1. Last change: 2017 Mar 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -64,7 +64,7 @@ whichever is lower. These are empty or white lines and lines starting with a character in 'foldignore'. White space is skipped before checking for characters in 'foldignore'. For C use "#" to ignore preprocessor lines. -When you want to ignore lines in another way, use the 'expr' method. The +When you want to ignore lines in another way, use the "expr" method. The |indent()| function can be used in 'foldexpr' to get the indent of a line. @@ -79,7 +79,7 @@ This will call a function to compute the fold level: > :set foldexpr=MyFoldLevel(v:lnum) This will make a fold out of paragraphs separated by blank lines: > :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 -this does the same: > +This does the same: > :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1 Note that backslashes must be used to escape characters that ":set" handles @@ -97,9 +97,9 @@ These are the conditions with which the expression is evaluated: lowest. "=" use fold level from the previous line "a1", "a2", .. add one, two, .. to the fold level of the previous - line + line, use the result for the current line "s1", "s2", .. subtract one, two, .. from the fold level of the - previous line + previous line, use the result for the next line "<1", "<2", .. a fold with this level ends at this line ">1", ">2", .. a fold with this level starts at this line @@ -122,12 +122,24 @@ method can be very slow! Try to avoid the "=", "a" and "s" return values, since Vim often has to search backwards for a line for which the fold level is defined. This can be slow. +An example of using "a1" and "s1": For a multi-line C comment, a line +containing "/*" would return "a1" to start a fold, and a line containing "*/" +would return "s1" to end the fold after that line: > + if match(thisline, '/\*') >= 0 + return 'a1' + elseif match(thisline, '\*/') >= 0 + return 's1' + else + return '=' + endif +However, this won't work for single line comments, strings, etc. + |foldlevel()| can be useful to compute a fold level relative to a previous fold level. But note that foldlevel() may return -1 if the level is not known yet. And it returns the level at the start of the line, while a fold might end in that line. -It may happened that folds are not updated properly. You can use |zx| or |zX| +It may happen that folds are not updated properly. You can use |zx| or |zX| to force updating folds. @@ -191,7 +203,7 @@ and the level given by the marker: 1. If a marker with the same fold level is encountered, the previous fold ends and another fold with the same level starts. 2. If a marker with a higher fold level is found, a nested fold is started. -3. if a marker with a lower fold level is found, all folds up to and including +3. If a marker with a lower fold level is found, all folds up to and including this level end and a fold with the specified level starts. The number indicates the fold level. A zero cannot be used (a marker with @@ -365,7 +377,7 @@ zX Undo manually opened and closed folds: re-apply 'foldlevel'. Also forces recomputing folds, like |zx|. *zm* -zm Fold more: Subtract one from 'foldlevel'. If 'foldlevel' was +zm Fold more: Subtract |v:count1| from 'foldlevel'. If 'foldlevel' was already zero nothing happens. 'foldenable' will be set. @@ -374,7 +386,7 @@ zM Close all folds: set 'foldlevel' to 0. 'foldenable' will be set. *zr* -zr Reduce folding: Add one to 'foldlevel'. +zr Reduce folding: Add |v:count1| to 'foldlevel'. *zR* zR Open all folds. This sets 'foldlevel' to highest fold level. @@ -573,8 +585,9 @@ what you type! When using an operator, a closed fold is included as a whole. Thus "dl" deletes the whole closed fold under the cursor. -For Ex commands the range is adjusted to always start at the first line of a -closed fold and end at the last line of a closed fold. Thus this command: > +For Ex commands that work on buffer lines the range is adjusted to always +start at the first line of a closed fold and end at the last line of a closed +fold. Thus this command: > :s/foo/bar/g when used with the cursor on a closed fold, will replace "foo" with "bar" in all lines of the fold. diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt index dcab23ccb2..089f52d525 100644 --- a/runtime/doc/ft_ada.txt +++ b/runtime/doc/ft_ada.txt @@ -1,4 +1,4 @@ -*ft_ada.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*ft_ada.txt* For Vim version 8.1. Last change: 2010 Jul 20 ADA FILE TYPE PLUG-INS REFERENCE MANUAL~ diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt new file mode 100644 index 0000000000..750ba76afc --- /dev/null +++ b/runtime/doc/ft_rust.txt @@ -0,0 +1,237 @@ +*ft_rust.txt* Filetype plugin for Rust + +============================================================================== +CONTENTS *rust* + +1. Introduction |rust-intro| +2. Settings |rust-settings| +3. Commands |rust-commands| +4. Mappings |rust-mappings| + +============================================================================== +INTRODUCTION *rust-intro* + +This plugin provides syntax and supporting functionality for the Rust +filetype. + +============================================================================== +SETTINGS *rust-settings* + +This plugin has a few variables you can define in your vimrc that change the +behavior of the plugin. + + *g:rustc_path* +g:rustc_path~ + Set this option to the path to rustc for use in the |:RustRun| and + |:RustExpand| commands. If unset, "rustc" will be located in $PATH: > + let g:rustc_path = $HOME."/bin/rustc" +< + + *g:rustc_makeprg_no_percent* +g:rustc_makeprg_no_percent~ + Set this option to 1 to have 'makeprg' default to "rustc" instead of + "rustc %": > + let g:rustc_makeprg_no_percent = 1 +< + + *g:rust_conceal* +g:rust_conceal~ + Set this option to turn on the basic |conceal| support: > + let g:rust_conceal = 1 +< + + *g:rust_conceal_mod_path* +g:rust_conceal_mod_path~ + Set this option to turn on |conceal| for the path connecting token + "::": > + let g:rust_conceal_mod_path = 1 +< + + *g:rust_conceal_pub* +g:rust_conceal_pub~ + Set this option to turn on |conceal| for the "pub" token: > + let g:rust_conceal_pub = 1 +< + + *g:rust_recommended_style* +g:rust_recommended_style~ + Set this option to enable vim indentation and textwidth settings to + conform to style conventions of the rust standard library (i.e. use 4 + spaces for indents and sets 'textwidth' to 99). This option is enabled + by default. To disable it: > + let g:rust_recommended_style = 0 +< + + *g:rust_fold* +g:rust_fold~ + Set this option to turn on |folding|: > + let g:rust_fold = 1 +< + Value Effect ~ + 0 No folding + 1 Braced blocks are folded. All folds are open by + default. + 2 Braced blocks are folded. 'foldlevel' is left at the + global value (all folds are closed by default). + + *g:rust_bang_comment_leader* +g:rust_bang_comment_leader~ + Set this option to 1 to preserve the leader on multi-line doc comments + using the /*! syntax: > + let g:rust_bang_comment_leader = 1 +< + + *g:ftplugin_rust_source_path* +g:ftplugin_rust_source_path~ + Set this option to a path that should be prepended to 'path' for Rust + source files: > + let g:ftplugin_rust_source_path = $HOME.'/dev/rust' +< + + *g:rustfmt_command* +g:rustfmt_command~ + Set this option to the name of the 'rustfmt' executable in your $PATH. If + not specified it defaults to 'rustfmt' : > + let g:rustfmt_command = 'rustfmt' +< + *g:rustfmt_autosave* +g:rustfmt_autosave~ + Set this option to 1 to run |:RustFmt| automatically when saving a + buffer. If not specified it defaults to 0 : > + let g:rustfmt_autosave = 0 +< + *g:rustfmt_fail_silently* +g:rustfmt_fail_silently~ + Set this option to 1 to prevent 'rustfmt' from populating the + |location-list| with errors. If not specified it defaults to 0: > + let g:rustfmt_fail_silently = 0 +< + *g:rustfmt_options* +g:rustfmt_options~ + Set this option to a string of options to pass to 'rustfmt'. The + write-mode is already set to 'overwrite'. If not specified it + defaults to '' : > + let g:rustfmt_options = '' +< + + *g:rust_playpen_url* +g:rust_playpen_url~ + Set this option to override the URL for the playpen to use: > + let g:rust_playpen_url = 'https://play.rust-lang.org/' +< + + *g:rust_shortener_url* +g:rust_shortener_url~ + Set this option to override the URL for the URL shortener: > + let g:rust_shortener_url = 'https://is.gd/' +< + + +============================================================================== +COMMANDS *rust-commands* + +:RustRun [args] *:RustRun* +:RustRun! [rustc-args] [--] [args] + Compiles and runs the current file. If it has unsaved changes, + it will be saved first using |:update|. If the current file is + an unnamed buffer, it will be written to a temporary file + first. The compiled binary is always placed in a temporary + directory, but is run from the current directory. + + The arguments given to |:RustRun| will be passed to the + compiled binary. + + If ! is specified, the arguments are passed to rustc instead. + A "--" argument will separate the rustc arguments from the + arguments passed to the binary. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustExpand [args] *:RustExpand* +:RustExpand! [TYPE] [args] + Expands the current file using --pretty and displays the + results in a new split. If the current file has unsaved + changes, it will be saved first using |:update|. If the + current file is an unnamed buffer, it will be written to a + temporary file first. + + The arguments given to |:RustExpand| will be passed to rustc. + This is largely intended for specifying various --cfg + configurations. + + If ! is specified, the first argument is the expansion type to + pass to rustc --pretty. Otherwise it will default to + "expanded". + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitIr [args] *:RustEmitIr* + Compiles the current file to LLVM IR and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitIr| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitAsm [args] *:RustEmitAsm* + Compiles the current file to assembly and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitAsm| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustPlay *:RustPlay* + This command will only work if you have web-api.vim installed + (available at https://github.com/mattn/webapi-vim). It sends the + current selection, or if nothing is selected, the entirety of the + current buffer to the Rust playpen, and emits a message with the + shortened URL to the playpen. + + |g:rust_playpen_url| is the base URL to the playpen, by default + "https://play.rust-lang.org/". + + |g:rust_shortener_url| is the base URL for the shortener, by + default "https://is.gd/" + +:RustFmt *:RustFmt* + Runs |g:rustfmt_command| on the current buffer. If + |g:rustfmt_options| is set then those will be passed to the + executable. + + If |g:rustfmt_fail_silently| is 0 (the default) then it + will populate the |location-list| with the errors from + |g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1 + then it will not populate the |location-list|. + +:RustFmtRange *:RustFmtRange* + Runs |g:rustfmt_command| with selected range. See + |:RustFmt| for any other information. + +============================================================================== +MAPPINGS *rust-mappings* + +This plugin defines mappings for |[[| and |]]| to support hanging indents. + +It also has a few other mappings: + + *rust_<D-r>* +<D-r> Executes |:RustRun| with no arguments. + Note: This binding is only available in MacVim. + + *rust_<D-R>* +<D-R> Populates the command line with |:RustRun|! using the + arguments given to the last invocation, but does not + execute it. + Note: This binding is only available in MacVim. + +============================================================================== + vim:tw=78:sw=4:noet:ts=8:ft=help:norl: diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt index 72ea3ed366..9819c066af 100644 --- a/runtime/doc/ft_sql.txt +++ b/runtime/doc/ft_sql.txt @@ -1,4 +1,4 @@ -*ft_sql.txt* For Vim version 7.4. Last change: 2013 May 15 +*ft_sql.txt* For Vim version 8.1. Last change: 2013 May 15 by David Fishburn diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 29142c5c26..58e0ac8aac 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 7.4. Last change: 2014 Mar 08 +*gui.txt* For Vim version 8.1. Last change: 2018 Mar 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -25,8 +25,8 @@ Other GUI documentation: First you must make sure you actually have a version of Vim with the GUI code included. You can check this with the ":version" command, it says "with xxx -GUI", where "xxx" is Macvim, X11-Motif, X11-Athena, Photon, GTK, GTK2, etc., -or "MS-Windows 32 bit GUI version". +GUI", where "xxx" is MacVim, X11-Motif, X11-Athena, Photon, GTK2, GTK3, etc., or +"MS-Windows 32 bit GUI version". How to start the GUI depends on the system used. Mostly you can run the GUI version of Vim with: @@ -133,7 +133,7 @@ task bar with the 'guiheadroom' option. :winp[os] Display current position of the top left corner of the GUI vim window in pixels. Does not work in all versions. - Also see |getwinposx()| and |getwinposy()|. + Also see |getwinpos()|, |getwinposx()| and |getwinposy()|. :winp[os] {X} {Y} *E466* Put the GUI vim window at the given {X} and {Y} coordinates. @@ -161,7 +161,7 @@ window Vim is running in with these commands: > *gui-IME* *iBus* Input methods for international characters in X that rely on the XIM framework, most notably iBus, have been known to produce undesirable results -in gVim. These may include an inability to enter spaces, or long delays +in gvim. These may include an inability to enter spaces, or long delays between typing a character and it being recognized by the application. One workaround that has been successful, for unknown reasons, is to prevent @@ -481,6 +481,7 @@ menus and menu items. They are most useful for things that you can't remember what the key sequence was. For creating menus in a different language, see |:menutrans|. +If you don't want to use menus at all, see |'go-M'|. *menu.vim* The default menus are read from the file "$VIMRUNTIME/menu.vim". See @@ -497,7 +498,22 @@ in the menu (which can take a bit of time to load). If you want to have all filetypes already present at startup, add: > :let do_syntax_sel_menu = 1 -< +The following menuitems show all available color schemes, keymaps and compiler +settings: + Edit > Color Scheme ~ + Edit > Keymap ~ + Tools > Set Compiler ~ +However, they can also take a bit of time to load, because they search all +related files from the directories in 'runtimepath'. Therefore they are +loaded lazily (by the |CursorHold| event), or you can also load them manually. +If you want to have all these items already present at startup, add: > + :let do_no_lazyload_menus = 1 + +Note that the menu.vim is sourced when `:syntax on` or `:filetype on` is +executed or after your .vimrc file is sourced. This means that the 'encoding' +option and the language of messages (`:language messages`) must be set before +that (if you want to change them). + *console-menus* Although this documentation is in the GUI section, you can actually use menus in console mode too. You will have to load |menu.vim| explicitly then, it is @@ -514,11 +530,14 @@ a menu entry. Hit <Enter> to execute it. Hit <Esc> if you want to cancel. This does require the |+menu| feature enabled at compile time. *tear-off-menus* -GTK+ and Motif support Tear-off menus. These are sort of sticky menus or +GTK+ 2 and Motif support Tear-off menus. These are sort of sticky menus or pop-up menus that are present all the time. If the resizing does not work correctly, this may be caused by using something like "Vim*geometry" in the defaults. Use "Vim.geometry" instead. +As to GTK+ 3, tear-off menus have been deprecated since GTK+ 3.4. +Accordingly, they are disabled if gvim is linked against GTK+ 3.4 or later. + The Win32 GUI version emulates Motif's tear-off menus. Actually, a Motif user will spot the differences easily, but hopefully they're just as useful. You can also use the |:tearoff| command together with |hidden-menus| to create @@ -650,8 +669,8 @@ When no or zero priority is given, 500 is used. The priority for the PopUp menu is not used. The Help menu will be placed on the far right side of the menu bar on systems -which support this (Motif and GTK+). For GTK+ 2, this is not done anymore -because right-aligning the Help menu is now discouraged UI design. +which support this (Motif and GTK+). For GTK+ 2 and 3, this is not done +anymore because right-aligning the Help menu is now discouraged UI design. You can use a priority higher than 9999, to make it go after the Help menu, but that is non-standard and is discouraged. The highest possible priority is @@ -943,10 +962,15 @@ it behaves in a strange way. :popu[p] {name} Popup the menu {name}. The menu named must have at least one subentry, but need not appear on the menu-bar (see |hidden-menus|). - {only available for Win32, MacVim, and GTK GUI} + {only available for Win32, MacVim, and GTK GUI + or in the terminal when compiled with + +insert_expand} :popu[p]! {name} Like above, but use the position of the mouse pointer instead of the cursor. + In the terminal this is the last known + position, which is usually at the last click + or release (mouse movement is irrelevant). Example: > :popup File @@ -957,6 +981,10 @@ pointer if ! was used). > :popup ]Toolbar This creates a popup menu that doesn't exist on the main menu-bar. +Note that in the GUI the :popup command will return immediately, before a +selection has been made. In the terminal the commands waits for the user to +make a selection. + Note that a menu that starts with ']' will not be displayed. ============================================================================== diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index 769fca9766..89f16785ea 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -1,4 +1,4 @@ -*gui_mac.txt* For Vim version 7.4. Last change: 2012 Jan 13 +*gui_mac.txt* For Vim version 8.0. Last change: 2012 Jan 13 VIM REFERENCE MANUAL by Bjorn Winckler @@ -110,8 +110,9 @@ to your .gvimrc file to revert back to the default Vim tab label. *macvim-options* These are the non-standard options that MacVim supports: - 'antialias' 'fullscreen' 'fuoptions' - 'macmeta' 'toolbariconsize' 'transparency' + 'antialias' 'blurradius' 'fullscreen' + 'fuoptions' 'macligatures' 'macmeta' 'macthinstrokes' + 'toolbariconsize' 'transparency' *macvim-commands* These are the non-standard commands that MacVim supports: @@ -157,55 +158,36 @@ have files open in e.g. splits by changing the "Open files from applications" option in the General preference pane). Finally, you can use Mac OS X System Services to open files in MacVim, see |macvim-services|. -There are essentially two ways to start MacVim from Terminal: either call the -Vim binary with the -g switch > - /Applications/MacVim.app/Contents/MacOS/Vim -g file ... -or use the "open" command (this method can not be used to pass parameters to +Use |mvim| script to start MacVim from Terminal. + +Or use the "open" command (this method can not be used to pass parameters to Vim) > open -a MacVim file ... The advantage of using the latter method is that the settings relating to file opening in the preferences panel are respected, and files open instantly if |Quickstart| is enabled. -To save yourself from having to type the entire path to the Vim binary each -time you start MacVim, you could create an alias such as > - alias gvim='/Applications/MacVim.app/Contents/MacOS/Vim -g' -and add that to "~/.profile". - -Note: Do NOT call the MacVim binary inside the app bundle to start MacVim. - - *mvim* -A more flexible way to start MacVim is to use the shell script "mvim" which -comes bundled with MacVim. Put this script in a folder in your path and then -simply type "mvim" to start MacVim. This script will try to find MacVim.app -in various typical folders such as > - ~/Applications ~/Applications/vim - /Applications /Applications/vim - /Applications/Utilities /Applications/Utilities/vim -If you would rather put MacVim.app in some other directory then that is also -possible, simply set the environment variable VIM_APP_DIR to whatever folder -you have placed MacVim.app in. - -The "mvim" script can be symlinked to in order to start up MacVim in different -modes as follows (assuming you placed "mvim" in "/usr/local/bin"): > - * Diff: ln -s /usr/local/bin/mvim mvimdiff - * Read-only: ln -s /usr/local/bin/mvim mview - * Ex: ln -s /usr/local/bin/mvim mex - * Restricted: ln -s /usr/local/bin/mvim rmvim -If the symlink destination starts with "m" (or "g"), Vim will start in GUI -mode. Removing the initial "m" from the above destination names makes Vim -start without the GUI. (In the last case, the destination name can be -"rmvim", "rgvim" or "rvim".) - -Note: Starting MacVim by creating a symlink to > - .../MacVim.app/Contents/MacOS/Vim -with 'ln -s' does not work. - Once in terminal Vim it is possible to start MacVim by using the following command: :gui [++opt] [+cmd] [-f|-b] [files...] Note: Forking ("-b") currently does not work. + *mvim* +The "mvim" shell script bundled with MacVim. > + /Applications/MacVim.app/Contents/bin/mvim +This is a wrapper script to launch Vim executable in the bundle. Put this +folder > + /Applications/MacVim.app/Contents/bin +in your path and then simply type "mvim" to start MacVim from Terminal. > + $ mvim +You can also specify files to open with. > + $ mvim file ... +Also the bin folder has convenient scripts for diffing and opening file as the file is read-only. > + * Diff: mvimdiff + * Read-only: mview + +You can use "vim", "vimdiff", and "view" if you want to use non-GUI Vim. + *Quickstart* Quickstart ensures that new windows open instantaneously e.g. when <D-n> is pressed. This feature can be enabled from the Advanced preferences pane (it @@ -255,9 +237,12 @@ Here is a list of relevant dictionary entries: KEY VALUE ~ MMCellWidthMultiplier width of a normal glyph in em units [float] MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool] +MMFullScreenFadeTime fade delay for non-native fullscreen [float] MMLoginShellArgument login shell parameter [string] MMLoginShellCommand which shell to use to launch Vim [string] MMNoFontSubstitution disable automatic font substitution [bool] +MMNoTitleBarWindow hide title bar [bool] +MMShareFindPboard share search text to Find Pasteboard [bool] MMShowAddTabButton enable "add tab" button on tabline [bool] MMTabMaxWidth maximum width of a tab [int] MMTabMinWidth minimum width of a tab [int] @@ -268,6 +253,7 @@ MMTextInsetRight text area offset in pixels [int] MMTextInsetTop text area offset in pixels [int] MMTexturedWindow use brushed metal window (Tiger only) [bool] MMTranslateCtrlClick interpret ctrl-click as right-click [bool] +MMUseMouseTime use mousetime to detect multiple clicks [bool] MMVerticalSplit files open in vertical splits [bool] MMZoomBoth zoom button maximizes both directions [bool] @@ -700,7 +686,7 @@ prominent bugs/missing features. - The toolbar looks ugly and is not very useful. If you find new bugs then please post your findings to the vim_mac mailing -list: *vim_mac* > +list: *vim_mac_group* > http://groups.google.com/group/vim_mac This is also the best place for making feature requests as well as for asking diff --git a/runtime/doc/gui_w16.txt b/runtime/doc/gui_w16.txt deleted file mode 100644 index fa84b05419..0000000000 --- a/runtime/doc/gui_w16.txt +++ /dev/null @@ -1,186 +0,0 @@ -*gui_w16.txt* For Vim version 7.4. Last change: 2005 Mar 29 - - - VIM REFERENCE MANUAL by Bram Moolenaar - - -Vim's Graphical User Interface *gui-w16* *win16-gui* - -1. Starting the GUI |win16-start| -2. Vim as default editor |win16-default-editor| -3. Using the clipboard |win16-clipboard| -4. Shell Commands |win16-shell| -5. Special colors |win16-colors| -6. Windows dialogs & browsers |win16-dialogs| -7. Various |win16-various| - -Other relevant documentation: -|gui.txt| For generic items of the GUI. -|os_msdos.txt| For items common to DOS and Windows. -|gui_w32.txt| Some items here are also applicable to the Win16 version. - -{Vi does not have a Windows GUI} - -The Win16 version of Vim will run on Windows 3.1 or later. It has not been -tested on 3.0, it probably won't work without being recompiled and -modified. (But you really should upgrade to 3.11 anyway. :) - -In most respects it behaves identically to the Win32 GUI version, including -having a flat-style toolbar(!). The chief differences: - -1) Bold/Italic text is not available, to speed up repaint/reduce resource - usage. (You can re-instate this by undefining MSWIN16_FASTTEXT.) -2) No tearoff menu emulation. -3) No OLE interface. -4) No long filename support (of course). -5) No tooltips on toolbar buttons - instead they produce command-line tips - like menu items do. -6) Line length limited to 32767 characters (like 16-bit DOS version). - - -============================================================================== -1. Starting the GUI *win16-start* - -The Win16 GUI version of Vim will always start the GUI, no matter how you -start it or what it's called. There is no 'console' version as such, but you -can use one of the DOS versions in a DOS box. - -The Win16 GUI has an extra menu item: "Window/Select Font". It brings up the -standard Windows font selector. Note that bold and italic fonts are not -supported in an attempt to maximize GDI drawing speed. - -Setting the menu height doesn't work for the Win16 GUI. - - *win16-maximized* -If you want Vim to start with a maximized window, add this command to your -vimrc or gvimrc file: > - au GUIEnter * simalt ~x -< - -There is a specific version of gvim.exe that runs under the Win32s subsystem -of Windows 3.1 or 3.11. See |win32s|. - -============================================================================== -2. Vim as default editor *win16-default-editor* - -To set Vim as the default editor for a file type you can use File Manager's -"Associate" feature. - -When you open a file in Vim by double clicking it, Vim changes to that -file's directory. - -See also |notepad|. - -============================================================================== -3. Using the clipboard *win16-clipboard* - -Windows has a clipboard, where you can copy text to, and paste text from. Vim -supports this in several ways. -The clipboard works in the same way as the Win32 version: see |gui-clipboard|. - -============================================================================== -4. Shell Commands *win16-shell* - -Vim spawns a DOS window for external commands, to make it possible to run any -DOS command. The window uses the _default.pif settings. - - *win16-!start* -Normally, Vim waits for a command to complete before continuing (this makes -sense for most shell commands which produce output for Vim to use). If you -want Vim to start a program and return immediately, you can use the following -syntax: - :!start {command} -This may only work for a Windows program though. -Don't forget that you must tell Windows 3.1x to keep executing a DOS command -in the background while you switch back to Vim. - -============================================================================== -5. Special colors *win16-colors* - -On Win16, the normal DOS colors can be used. See |dos-colors|. - -Additionally the system configured colors can also be used. These are known -by the names Sys_XXX, where XXX is the appropriate system color name, from the -following list (see the Win32 documentation for full descriptions). Case is -ignored. - -Sys_BTNFace Sys_BTNShadow Sys_ActiveBorder -Sys_ActiveCaption Sys_AppWorkspace Sys_Background -Sys_BTNText Sys_CaptionText Sys_GrayText -Sys_Highlight Sys_HighlightText Sys_InactiveBorder -Sys_InactiveCaption Sys_InactiveCaptionText Sys_Menu -Sys_MenuText Sys_ScrollBar Sys_Window -Sys_WindowFrame Sys_WindowText - -Probably the most useful values are - Sys_Window Normal window background - Sys_WindowText Normal window text - Sys_Highlight Highlighted background - Sys_HighlightText Highlighted text - -These extra colors are also available: -Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet, - - -See also |rgb.txt|. - -============================================================================== - *win16-dialogs* -6. Windows dialogs & browsers - -The Win16 GUI can use familiar Windows components for some operations, as well -as the traditional interface shared with the console version. - - -6.1 Dialogs - -The dialogs displayed by the "confirm" family (i.e. the 'confirm' option, -|:confirm| command and |confirm()| function) are GUI-based rather than the -console-based ones used by other versions. There is no option to change this. - - -6.2 File Browsers - -When prepending ":browse" before file editing commands, a file requester is -used to allow you to select an existing file. See |:browse|. - - -============================================================================== -7. Various *win16-various* - - *win16-printing* -The "File/Print" menu uses Notepad to print the current buffer. This is a bit -clumsy, but it's portable. If you want something else, you can define your -own print command. For example, you could look for the 16-bit version of -PrintFile. See $VIMRUNTIME/menu.vim for how it works by default. - -Using this should also work: > - :w >>prn - -Vim supports a number of standard MS Windows features. Some of these are -detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. -Also see |:simalt| - - *win16-drag-n-drop* -You can drag and drop one or more files into the vim window, where they will -be opened as normal. If you hold down Shift while doing this, Vim changes to -the (first) dropped file's directory. If you hold Ctrl, Vim will always split -a new window for the file. Otherwise it's only done if the current buffer has -been changed. -You can also drop a directory's icon, but rather than open all files in the -directory (which wouldn't usually be what you want) Vim instead changes to -that directory and begins a new file. -If Vim happens to be editing a command line, the names of the dropped files -and directories will be inserted at the cursor. This allows you to use these -names with any Ex command. - - *win16-truetype* -It is recommended that you use a raster font and not a TrueType -fixed-pitch font. E.g. use Courier, not Courier New. This is not just -to use less resources but because there are subtle bugs in the -handling of fixed-pitch TrueType in Win3.1x. In particular, when you move -a block cursor over a pipe character '|', the cursor is drawn in the wrong -size and bits get left behind. This is a bug in the Win3.1x GDI, it doesn't -happen if you run the exe under 95/NT. - - vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index fbe3f35e74..9d676eaffc 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -1,4 +1,4 @@ -*gui_w32.txt* For Vim version 7.4. Last change: 2012 Aug 04 +*gui_w32.txt* For Vim version 8.1. Last change: 2017 Oct 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -49,10 +49,6 @@ If you want Vim to start with a maximized window, add this command to your vimrc or gvimrc file: > au GUIEnter * simalt ~x < - *gui-w32s* -There is a specific version of gvim.exe that runs under the Win32s subsystem -of Windows 3.1 or 3.11. See |win32s|. - Using Vim as a plugin *gui-w32-windowid* @@ -100,9 +96,10 @@ when you have got a new version): You can also install Vim in the "Send To" menu: 1. Start a Windows Explorer 2. Navigate to your sendto directory: - Windows 95: %windir%\sendto (e.g. "c:\windows\sendto") Windows NT: %windir%\profiles\%user%\sendto (e.g. - "c:\winnt\profiles\mattha\sendto"). + "c:\winnt\profiles\mattha\sendto") + Windows XP: C:\Documents and Settings\%user%\SendTo + Windows Vista: C:\Users\%user%\AppData\Roaming\Microsoft\Windows\SendTo . 3. Right-click in the file pane and select New->Shortcut 4. Follow the shortcut wizard, using the full path to VIM/GVIM. @@ -274,35 +271,17 @@ WARNING: If you close this window with the "X" button, and confirm the question if you really want to kill the application, Vim may be killed too! (This does not apply to commands run asynchronously with ":!start".) -In Windows 95, the window in which the commands are executed is always 25x80 -characters, to be as DOS compatible as possible (this matters!). The default -system font is used. On NT, the window will be the default you have set up for -"Console" in Control Panel. On Win32s, the properties of the DOS box are -determined by _default.pif in the windows directory. - - *msdos-mode* -If you get a dialog that says "This program is set to run in MS-DOS mode..." -when you run an external program, you can solve this by changing the -properties of the associated shortcut: -- Use a Windows Explorer to find the command.com that is used. It can be - c:\command.com, c:\dos\command.com, c:\windows\command.com, etc. -- With the right mouse button, select properties of this command.com. -- In the Program tab select "Advanced". -- Unselect "MS-DOS mode". -- Click "OK" twice. +The window in which the commands are executed will be the default you have set +up for "Console" in Control Panel. *win32-!start* Normally, Vim waits for a command to complete before continuing (this makes sense for most shell commands which produce output for Vim to use). If you want Vim to start a program and return immediately, you can use the following -syntax on W95 & NT: > +syntax: > :!start [/min] {command} The optional "/min" causes the window to be minimized. -On Win32s, you will have to go to another window instead. Don't forget that -you must tell Windows 3.1x to keep executing a DOS command in the background -while you switch back to Vim. - ============================================================================== 5. Special colors *win32-colors* @@ -311,7 +290,7 @@ On Win32, the normal DOS colors can be used. See |dos-colors|. Additionally the system configured colors can also be used. These are known by the names Sys_XXX, where XXX is the appropriate system color name, from the following list (see the Win32 documentation for full descriptions). Case is -ignored. Note: On Win32s not all of these colors are supported. +ignored. Sys_3DDKShadow Sys_3DFace Sys_BTNFace Sys_3DHilight Sys_3DHighlight Sys_BTNHilight @@ -403,38 +382,8 @@ Note that a menu that starts with ']' will not be displayed. ============================================================================== 7. Command line arguments *gui-w32-cmdargs* -Analysis of a command line into parameters is not standardised in MS Windows. -Gvim has to provide logic to analyse a command line. This logic is likely to -be different from the default logic provided by a compilation system used to -build vim. The differences relate to unusual double quote (") usage. -The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the -same way. The argument "+/Sch""iller" may be handled different by gvim and -vim, depending what it was compiled with. - -The rules are: - a) A parameter is a sequence of graphic characters. - b) Parameters are separated by white space. - c) A parameter can be enclosed in double quotes to include white space. - d) A sequence of zero or more backslashes (\) and a double quote (") - is special. The effective number of backslashes is halved, rounded - down. An even number of backslashes reverses the acceptability of - spaces and tabs, an odd number of backslashes produces a literal - double quote. - -So: - " is a special double quote - \" is a literal double quote - \\" is a literal backslash and a special double quote - \\\" is a literal backslash and a literal double quote - \\\\" is 2 literal backslashes and a special double quote - \\\\\" is 2 literal backslashes and a literal double quote - etc. - -Example: > - gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" - -opens "C:\My Music\freude" and executes the line mode commands: > - set ignorecase; /"foo\ and /bar\" +Command line arguments behave the same way as with the console application, +see |win32-cmdargs|. ============================================================================== 8. Various *gui-w32-various* @@ -452,9 +401,10 @@ detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. You can drag and drop one or more files into the Vim window, where they will be opened as normal. See |drag-n-drop|. - *:simalt* *:si* + *:simalt* *:sim* :sim[alt] {key} simulate pressing {key} while holding Alt pressed. {not in Vi} {only for Win32 versions} + Note: ":si" means ":s" with the "i" flag. Normally, Vim takes control of all Alt-<Key> combinations, to increase the number of possible mappings. This clashes with the standard use of Alt as the diff --git a/runtime/doc/gui_x11.txt b/runtime/doc/gui_x11.txt index 0d7070eea0..8a5e9bfe07 100644 --- a/runtime/doc/gui_x11.txt +++ b/runtime/doc/gui_x11.txt @@ -1,4 +1,4 @@ -*gui_x11.txt* For Vim version 7.4. Last change: 2014 Mar 08 +*gui_x11.txt* For Vim version 8.1. Last change: 2018 May 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -40,9 +40,6 @@ The "-f" option runs Vim in the foreground. The "-b" option runs Vim in the background (this is the default). Also see |++opt| and |+cmd|. -Note: For technical reasons, MacVim always runs Vim in the foreground when -using :gui. - *gui-fork* When the GUI is started, it does a fork() and exits the current process. When gvim was started from a shell this makes the shell accept further @@ -55,18 +52,15 @@ When using "gvim -f" and then ":gui", Vim will run in the foreground. The "-f" argument will be remembered. To force running Vim in the background use ":gui -b". -MacVim supports forking only when you're launching Vim. "mvim" and -"mvim -f" work as expected: "mvim" launches the gui and forks, while "mvim -f" -launches the gui but doesn't fork (see |mvim|). However, doing |:gui| in an -already running vim will never fork in MacVim. - "gvim --nofork" does the same as "gvim -f". + +When there are running jobs Vim will not fork, because the processes would no +longer be child processes. *E851* *E852* When starting the GUI fails Vim will try to continue running in the terminal. If you want the GUI to run in the foreground always, include the 'f' -flag in 'guioptions'. |-f|. MacVim does not support this flag in -'guioptions'. +flag in 'guioptions'. |-f|. ============================================================================== 2. GUI Resources *gui-resources* *.Xdefaults* @@ -288,8 +282,9 @@ For CDE "dtwm" (a derivative of Motif) add this line in the .Xdefaults: > For "mwm" (Motif window manager) the line would be: > Mwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm -Mouse Pointers Available in X11 *X11_mouse_shapes* +Mouse Pointers Available in X11 ~ + *X11_mouse_shapes* By using the |'mouseshape'| option, the mouse pointer can be automatically changed whenever Vim enters one of its various modes (e.g., Insert or Command). Currently, the available pointers are: @@ -314,7 +309,7 @@ If a name is used that exists on other systems, but not in X11, the default "arrow" pointer is used. ============================================================================== -5. GTK version *gui-gtk* *GTK+* *GTK* +5. GTK version *gui-gtk* *GTK+* *GTK* *GTK3* The GTK version of the GUI works a little bit different. @@ -363,7 +358,9 @@ to the GTK documentation, however little there is, on how to do this. See http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html for more information. - *gtk-tooltip-colors* + +Tooltip Colors ~ + *gtk-tooltip-colors* Example, which sets the tooltip colors to black on light-yellow: > style "tooltips" @@ -378,8 +375,125 @@ Write this in the file ~/.gtkrc and it will be used by GTK+. For GTK+ 2 you might have to use the file ~/.gtkrc-2.0 instead, depending on your distribution. -Using Vim as a GTK+ plugin *gui-gtk-socketid* +For GTK+ 3, an effect similar to the above can be obtained by adding the +following snippet of CSS code to $XDG_HOME_DIR/gtk-3.0/gtk.css (usually, +$HOME/.config/gtk-3.0/gtk.css): + +For GTK+ 3 < 3.20: > + + .tooltip { + background-color: #ffffcc; + color: #000000; + } +< +For GTK+ 3 >= 3.20: > + + tooltip { + background-color: #ffffcc; + text-shadow: none; + } + + tooltip label { + color: #2e3436; + } +< +A Quick Look at GTK+ CSS ~ + *gtk-css* +The contents of this subsection apply to GTK+ 3.20 or later which provides +stable support for GTK+ CSS: + + https://developer.gnome.org/gtk3/stable/theming.html + +GTK+ uses CSS for styling and layout of widgets. In this subsection, we'll +have a quick look at GTK+ CSS through simple, illustrative examples. + +Example 1. Empty Space Adjustment ~ + +By default, the toolbar and the tabline of the GTK+ 3 GUI are somewhat larger +than those of the GTK+ 2 GUI. Some people may want to make them look similar +to the GTK+ 2 GUI in size. + +To do that, we'll try reducing empty space around icons and labels that looks +apparently superfluous. + +Add the following lines to $XDG_HOME_DIR/gtk-3.0/gtk.css (usually, +$HOME/.config/gtk-3.0/gtk.css): > + + toolbar button { + margin-top: -2px; + margin-right: 0px; + margin-bottom: -2px; + margin-left: 0px; + + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 0px + } + + notebook tab { + margin-top: -1px; + margin-right: 3px; + margin-bottom: -1px; + margin-left: 3px; + + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 0px + } +< +Since it's a CSS, they can be rewritten using shorthand: > + + toolbar button { + margin: -2px 0px; + padding: 0px; + } + + notebook tab { + margin: -1px 3px; + padding: 0px + } +< +Note: You might want to use 'toolbariconsize' to adjust the icon size, too. + +Note: Depending on the icon theme and/or the font in use, some extra tweaks +may be needed for a satisfactory result. + +Note: In addition to margin and padding, you can use border. For details, +refer to the box model of CSS, e.g., + + https://www.w3schools.com/css/css_boxmodel.asp + +Example 2. More Than Just Colors ~ + +GTK+ CSS supports gradients as well: > + + tooltip { + background-image: -gtk-gradient(linear, + 0 0, 0 1, + color-stop(0, #344752), + color-stop(0.5, #546772), + color-stop(1, #243742)); + } + + tooltip label { + color: #f3f3f3; + } +< +Gradients can be used to make a GUI element visually distinguishable from +others without relying on high contrast. Accordingly, effective use of them is +a useful technique to give a theme a sense of unity in color and luminance. + +Note: Theming can be difficult since it must make every application look +equally good; making a single application more charming often gets others +unexpectedly less attractive or even deteriorates their usability. Keep this +in mind always when you try improving a theme. + + +Using Vim as a GTK+ plugin ~ + *gui-gtk-socketid* When the GTK+ version of Vim starts up normally, it creates its own top level window (technically, a 'GtkWindow'). GTK+ provides an embedding facility with its GtkSocket and GtkPlug widgets. If one GTK+ application creates a @@ -420,9 +534,12 @@ These are the different looks: GNOME is compiled with if it was found by configure and the --enable-gnome-check argument was used. +Note: Avoid use of --enable-gnome-check with GTK+ 3 GUI build. The +functionality mentioned above is consolidated in GTK+ 3. -GNOME session support *gui-gnome-session* *gnome-session* +GNOME session support ~ + *gui-gnome-session* *gnome-session* On logout, Vim shows the well-known exit confirmation dialog if any buffers are modified. Clicking [Cancel] will stop the logout process. Otherwise the current session is stored to disk by using the |:mksession| command, and @@ -456,20 +573,37 @@ continues on Yzis: https://github.com/chrizel/Yzis. ============================================================================== 8. Compiling *gui-x11-compiling* -If using X11, Vim's Makefile will by default first try to find the necessary -GTK+ files on your system. If the GTK+ files cannot be found, then the Motif -files will be searched for. Finally, if this fails, the Athena files will be -searched for. If all three fail, the GUI will be disabled. +If using X11, Vim's configure will by default first try to find the necessary +GTK+ files on your system. When both GTK+ 2 and GTK+ 3 are available, GTK+ 2 +will be chosen unless --enable-gui=gtk3 is passed explicitly to configure. + +If the GTK+ files cannot be found, then the Motif files will be searched for. +Finally, if this fails, the Athena files will be searched for. If all three +fail, the GUI will be disabled. + +For GTK+, Vim's configuration process uses pkg-config(1) to check if the +GTK+ required for a specified build is properly installed and usable. +Accordingly, it is a good idea to make sure before running configure that +your system has a working pkg-config together with the .pc file of the +required GTK+. For that, say, run the following on the command line to see if +your pkg-config works with your GTK+ 2: > + + $ pkg-config --modversion gtk+-2.0 + +Replace gtk+-2.0 with gtk+-3.0 for GTK+ 3. If you get the correct version +number of your GTK+, you can proceed; if not, you probably need to do some +system administration chores to set up pkg-config and GTK+ correctly. + +The GTK+ 2 GUI is built by default. Therefore, you usually don't need to pass +any options such as --enable-gui=gtk2 to configure and build that. -For GTK+, Vim's configuration process requires that GTK+ be properly -installed. That is, the shell script 'gtk-config' must be in your PATH, and -you can already successful compile, build, and execute a GTK+ program. The -reason for this is that the compiler flags (CFLAGS) and link flags (LDFLAGS) -are obtained through the 'gtk-config' shell script. +Optionally, the GTK+ 2 GUI can consolidate the GNOME 2 support. This support +is enabled by passing --enable-gnome-check to configure. -If you want to build with GTK+ 2 support pass the --enable-gtk2-check argument -to ./configure. Optionally, support for GNOME 2 will be compiled if the ---enable-gnome-check option is also given. +If you want to build the GTK+ 3 GUI, you have to pass --enable-gui=gtk3 +explicitly to configure, and avoid passing --enable-gnome-check to that, as +the functionality of the GNOME 2 support has already been consolidated in +GTK+ 3. Otherwise, if you are using Motif or Athena, when you have the Motif or Athena files in a directory where configure doesn't look, edit the Makefile to enter @@ -477,18 +611,14 @@ the names of the directories. Search for "GUI_INC_LOC" for an example to set the Motif directories, "CONF_OPT_X" for Athena. *gui-x11-gtk* -At the time of this writing, GTK+ version 1.0.6 and 1.2 are outdated. It -is suggested that you use GTK 2. The GTK 1 support will most likely be -dropped soon. +Currently, Vim supports both GTK+ 2 and GTK+ 3. -For the GTK+ 2 GUI, using the latest release of the GTK+ 2.0 or GTK+ 2.2 -series is recommended. +The GTK+ 2 GUI requires GTK+ 2.2 or later. -Lastly, although GTK+ has supposedly been ported to the Win32 platform, this -has not been tested with Vim and is also unsupported. Also, it's unlikely to -even compile since GTK+ GUI uses parts of the generic X11 code. This might -change in distant future; particularly because getting rid of the X11 centric -code parts is also required for GTK+ framebuffer support. +Although the GTK+ 3 GUI is written in such a way that the source code can be +compiled against all versions of the 3.x series, we recommend GTK+ 3.10 or +later because of its substantial implementation changes in redraw done at +that version. *gui-x11-motif* For Motif, you need at least Motif version 1.2 and/or X11R5. Motif 2.0 and @@ -546,7 +676,7 @@ Of these three, Vim uses PRIMARY when reading and writing the "* register register. Vim does not access the SECONDARY selection. Examples: (assuming the default option values) -- Select an URL in Visual mode in Vim. Go to your browser and click the +- Select a URL in Visual mode in Vim. Go to your browser and click the middle mouse button in the URL text field. The selected text will be inserted (hopefully!). Note: in Firefox you can set the middlemouse.contentLoadURL preference to true in about:config, then the diff --git a/runtime/doc/hangulin.txt b/runtime/doc/hangulin.txt index 79ebff1100..87fc796df5 100644 --- a/runtime/doc/hangulin.txt +++ b/runtime/doc/hangulin.txt @@ -1,11 +1,8 @@ -*hangulin.txt* For Vim version 7.4. Last change: 2009 Jun 24 +*hangulin.txt* For Vim version 8.1. Last change: 2015 Nov 24 VIM REFERENCE MANUAL by Chi-Deok Hwang and Sung-Hyun Nam -NOTE: The |+hangul_input| feature is scheduled to be removed. If you want to -keep it, please send a message to the Vim user maillist. - Introduction *hangul* ------------ @@ -17,7 +14,8 @@ Compile ------- Next is a basic option. You can add any other configure option. > - ./configure --with-x --enable-multibyte --enable-fontset --enable-hangulinput + ./configure --with-x --enable-multibyte --enable-hangulinput \ + --disable-xim And you should check feature.h. If |+hangul_input| feature is enabled by configure, you can select more options such as keyboard type, 2 bulsik @@ -26,18 +24,21 @@ or 3 bulsik. You can find keywords like next in there. > #define HANGUL_DEFAULT_KEYBOARD 2 #define ESC_CHG_TO_ENG_MODE /* #define X_LOCALE */ - /* #define SLOW_XSERVER */ Environment variables --------------------- -You should set LANG variable to Korean locale such as ko or ko_KR.euc. +You should set LANG variable to Korean locale such as ko, ko_KR.eucKR +or ko_KR.UTF-8. If you set LC_ALL variable, it should be set to Korean locale also. VIM resource ------------ -You should add nexts to your global vimrc ($HOME/.vimrc). > +You may want to set 'encoding' and 'fileencodings'. +Next are examples: > - :set fileencoding=korea + :set encoding=euc-kr + :set encoding=utf-8 + :set fileencodings=ucs-bom,utf-8,cp949,euc-kr,latin1 Keyboard -------- @@ -52,8 +53,16 @@ If both are set, VIM_KEYBOARD has higher priority. Hangul Fonts ------------ -You can set text font using $HOME/.Xdefaults or in your gvimrc file. -But to use Hangul, you should set 'guifontset' in your vimrc. +If you use GTK version of GVIM, you should set 'guifont' and 'guifontwide'. +For example: > + set guifont=Courier\ 12 + set guifontwide=NanumGothicCoding\ 12 + +If you use Motif or Athena version of GVIM, you should set 'guifontset' in +your vimrc. You can set fontset in the .Xdefaults file. + +$HOME/.gvimrc: > + set guifontset=english_font,hangul_font $HOME/.Xdefaults: > Vim.font: english_font @@ -66,40 +75,38 @@ $HOME/.Xdefaults: > *international: True Vim*fontList: english_font;hangul_font: -$HOME/.gvimrc: > - set guifontset=english_font,hangul_font - attention! the , (comma) or ; (semicolon) And there should be no ':set guifont'. If it exists, then Gvim ignores ':set guifontset'. It means VIM runs without fontset supporting. So, you can see only English. Hangul does not be correctly displayed. -After 'fontset' feature is enabled, VIM does not allow using 'font'. +After "fontset" feature is enabled, VIM does not allow using english +font only in "font" setting for syntax. For example, if you use > :set guifontset=eng_font,your_font in your .gvimrc, then you should do for syntax > :hi Comment guifg=Cyan font=another_eng_font,another_your_font If you just do > :hi Comment font=another_eng_font -then you can see a GOOD error message. Be careful! +then you can see a error message. Be careful! hangul_font width should be twice than english_font width. Unsupported Feature ------------------- -Johab font not yet supported. And I don't have any plan. -If you really want to use johab font, you can use the -hanguldraw.c in gau package. +We don't support Johab font. +We don't support Hanja input. +And We don't have any plan to support them. -Hanja input not yet supported. And I don't have any plan. -If you really want to input hanja, just use VIM with hanterm. +If you really need such features, you can use console version of VIM with a +capable terminal emulator. Bug or Comment -------------- Send comments, patches and suggestions to: - Chi-Deok Hwang <hwang@mizi.co.kr> SungHyun Nam <goweol@gmail.com> + Chi-Deok Hwang <...> vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/hebrew.txt b/runtime/doc/hebrew.txt index b36c968d02..5400b49326 100644 --- a/runtime/doc/hebrew.txt +++ b/runtime/doc/hebrew.txt @@ -1,4 +1,4 @@ -*hebrew.txt* For Vim version 7.4. Last change: 2007 Jun 14 +*hebrew.txt* For Vim version 8.1. Last change: 2007 Jun 14 VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem) diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 8c46c62799..221862a96e 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2012 Dec 06 +*help.txt* For Vim version 8.1. Last change: 2017 Oct 28 VIM - main help file k @@ -10,20 +10,23 @@ Close this window: Use ":q<Enter>". Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. With the mouse: ":set mouse=a" to enable the mouse (in xterm or GUI). Double-click the left mouse button on a tag, e.g. |bars|. - Jump back: Type CTRL-T or CTRL-O (repeat to go further back). + Jump back: Type CTRL-T or CTRL-O. Repeat to go further back. Get specific help: It is possible to go directly to whatever you want help on, by giving an argument to the |:help| command. - It is possible to further specify the context: - *help-context* + Prepend something to specify the context: *help-context* + WHAT PREPEND EXAMPLE ~ - Normal mode command (nothing) :help x + Normal mode command :help x Visual mode command v_ :help v_u Insert mode command i_ :help i_<Esc> Command-line command : :help :quit Command-line editing c_ :help c_<Del> Vim command argument - :help -r Option ' :help 'textwidth' + Regular expression / :help /[ + See |help-summary| for more contexts and an explanation. + Search for help: Type ":help word", then hit CTRL-D to see matching help entries for "word". Or use ":helpgrep word". |:helpgrep| @@ -132,12 +135,14 @@ Advanced editing ~ |autocmd.txt| automatically executing commands on an event |filetype.txt| settings done specifically for a type of file |eval.txt| expression evaluation, conditional commands +|channel.txt| Jobs, Channels, inter-process communication |fold.txt| hide (fold) ranges of lines Special issues ~ |print.txt| printing |remote.txt| using Vim as a server or client |term.txt| using different terminals and mice +|terminal.txt| Terminal window support |digraph.txt| list of available digraphs |mbyte.txt| multi-byte text support |mlang.txt| non-English language support @@ -146,13 +151,13 @@ Special issues ~ |hebrew.txt| Hebrew language support and editing |russian.txt| Russian language support and editing |ft_ada.txt| Ada (the programming language) support +|ft_rust.txt| Filetype plugin for Rust |ft_sql.txt| about the SQL filetype plugin |hangulin.txt| Hangul (Korean) input mode |rileft.txt| right-to-left editing mode GUI ~ |gui.txt| Graphical User Interface (GUI) -|gui_w16.txt| Windows 3.1 GUI |gui_w32.txt| Win32 GUI |gui_x11.txt| X11 GUI |gui_mac.txt| MacVim GUI @@ -163,7 +168,6 @@ Interfaces ~ |if_mzsch.txt| MzScheme interface |if_perl.txt| Perl interface |if_pyth.txt| Python interface -|if_sniff.txt| SNiFF+ interface |if_tcl.txt| Tcl interface |if_ole.txt| OLE automation interface for Win32 |if_ruby.txt| Ruby interface @@ -178,6 +182,7 @@ Versions ~ |version5.txt| Differences between Vim version 4.6 and 5.x |version6.txt| Differences between Vim version 5.7 and 6.x |version7.txt| Differences between Vim version 6.4 and 7.x +|version8.txt| Differences between Vim version 7.4 and 8.x *sys-file-list* Remarks about specific systems ~ |os_390.txt| OS/390 Unix @@ -197,8 +202,10 @@ Remarks about specific systems ~ Standard plugins ~ |pi_getscript.txt| Downloading latest version of Vim scripts |pi_gzip.txt| Reading and writing compressed files +|pi_logipat.txt| Logical operators on patterns |pi_netrw.txt| Reading and writing files over a network |pi_paren.txt| Highlight matching parens +|pi_spec.txt| Filetype plugin to work with rpm spec files |pi_tar.txt| Tar file explorer |pi_vimball.txt| Create a self-installing Vim script |pi_zip.txt| Zip archive explorer diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index 87f095e56d..29941c1aeb 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -1,4 +1,4 @@ -*helphelp.txt* For Vim version 7.4. Last change: 2012 Nov 28 +*helphelp.txt* For Vim version 8.1. Last change: 2017 Mar 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -28,10 +28,16 @@ Help on help files *helphelp* *{subject}* *E149* *E661* :h[elp] {subject} Like ":help", additionally jump to the tag {subject}. - {subject} can include wildcards like "*", "?" and + For example: > + :help options + +< {subject} can include wildcards such as "*", "?" and "[a-z]": :help z? jump to help for any "z" command :help z. jump to the help for "z." + But when a tag exists it is taken literally: + :help :? jump to help for ":?" + If there is no full match for the pattern, or there are several matches, the "best" match will be used. A sophisticated algorithm is used to decide which @@ -68,18 +74,19 @@ Help on help files *helphelp* example to find help for CTRL-V in Insert mode: > :help i^V < - To use a regexp |pattern|, first do ":help" and then + It is also possible to first do ":help" and then use ":tag {pattern}" in the help window. The ":tnext" command can then be used to jump to other matches, "tselect" to list matches and choose one. > - :help index| :tse z. + :help index + :tselect /.*mode < When there is no argument you will see matches for "help", to avoid listing all possible matches (that would be very slow). The number of matches displayed is limited to 300. - This command can be followed by '|' and another + The `:help` command can be followed by '|' and another command, but you don't need to escape the '|' inside a help command. So these both work: > :help | @@ -96,6 +103,9 @@ Help on help files *helphelp* find a tag in a file with the same language as the current file. See |help-translated|. + *:helpc* *:helpclose* +:helpc[lose] Close one help window, if there is one. + *:helpg* *:helpgrep* :helpg[rep] {pattern}[@xx] Search all help text files and make a list of lines @@ -132,7 +142,8 @@ Help on help files *helphelp* already opened, then the location list for that window is used. Otherwise, a new help window is opened and the location list for that window is set. The - location list for the current window is not changed. + location list for the current window is not changed + then. *:exu* *:exusage* :exu[sage] Show help on Ex commands. Added to simulate the Nvi @@ -194,6 +205,9 @@ command: > *E154* *E150* *E151* *E152* *E153* *E670* :helpt[ags] [++t] {dir} Generate the help tags file(s) for directory {dir}. + When {dir} is ALL then all "doc" directories in + 'runtimepath' will be used. + All "*.txt" and "*.??x" files in the directory and sub-directories are scanned for a help tag definition in between stars. The "*.??x" files are for @@ -202,9 +216,11 @@ command: > sorted. When there are duplicates an error message is given. An existing tags file is silently overwritten. + The optional "++t" argument forces adding the "help-tags" tag. This is also done when the {dir} is equal to $VIMRUNTIME/doc. + To rebuild the help tags in the runtime directory (requires write permission there): > :helptags $VIMRUNTIME/doc @@ -255,7 +271,9 @@ The second one finds the English user manual, even when 'helplang' is set to When using command-line completion for the ":help" command, the "@en" extension is only shown when a tag exists for multiple languages. When the -tag only exists for English "@en" is omitted. +tag only exists for English "@en" is omitted. When the first candidate has an +"@ab" extension and it matches the first language in 'helplang' "@ab" is also +omitted. When using |CTRL-]| or ":help!" in a non-English help file Vim will try to find the tag in the same language. If not found then 'helplang' will be used @@ -297,7 +315,7 @@ the applicable Vim version. The last field specifies the last modification date of the file. Each field is separated by a tab. At the bottom of the help file, place a Vim modeline to set the 'textwidth' -and 'tabstop' options and the 'filetype' to 'help'. Never set a global option +and 'tabstop' options and the 'filetype' to "help". Never set a global option in such a modeline, that can have consequences undesired by whoever reads that help. @@ -312,6 +330,10 @@ aligned on a line. When referring to an existing help tag and to create a hot-link, place the name between two bars (|) eg. |help-writing|. +When referring to a Vim command and to create a hot-link, place the +name between two backticks, eg. inside `:filetype`. You will see this is +highlighted as a command, like a code block (see below). + When referring to a Vim option in the help file, place the option name between two single quotes, eg. 'statusline' diff --git a/runtime/doc/howto.txt b/runtime/doc/howto.txt index 03ae3dbd8d..f6973102c6 100644 --- a/runtime/doc/howto.txt +++ b/runtime/doc/howto.txt @@ -1,4 +1,4 @@ -*howto.txt* For Vim version 7.4. Last change: 2006 Apr 02 +*howto.txt* For Vim version 8.1. Last change: 2006 Apr 02 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index d8dc48f066..cf2aff2bcc 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -1,4 +1,4 @@ -*if_cscop.txt* For Vim version 7.4. Last change: 2011 Jun 12 +*if_cscop.txt* For Vim version 8.1. Last change: 2018 Jan 21 VIM REFERENCE MANUAL by Andy Kahn @@ -91,14 +91,15 @@ suggested use.) 2. Cscope related commands *cscope-commands* *:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560* -All cscope commands are accessed through suboptions to the main cscope -command ":cscope". The shortest abbreviation is ":cs". The ":scscope" -command does the same and also splits the window (short: "scs"). +All cscope commands are accessed through suboptions to the cscope commands. + `:cscope` or `:cs` is the main command + `:scscope` or `:scs` does the same and splits the window + `:lcscope` or `:lcs` uses the location list, see |:lcscope| The available subcommands are: - *E563* *E564* *E566* *E568* *E569* *E622* *E623* - *E625* *E626* *E609* + *E563* *E564* *E566* *E568* *E622* *E623* *E625* + *E626* *E609* add : Add a new cscope database/connection. USAGE :cs add {file|dir} [pre-path] [flags] @@ -129,6 +130,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} @@ -255,13 +257,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" @@ -422,6 +424,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 @@ -435,6 +438,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 @@ -453,6 +457,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* @@ -462,36 +468,18 @@ license or OS distribution), then you can download it for free from: http://cscope.sourceforge.net/ This is released by SCO under the BSD license. -If you want a newer version of cscope, you will probably have to buy it. -According to the (old) nvi documentation: - - You can buy version 13.3 source with an unrestricted license - for $400 from AT&T Software Solutions by calling +1-800-462-8146. - -Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope -which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL) -from World-Wide Exptools Open Source packages page: - http://www.bell-labs.com/project/wwexptools/packages.html - In Solaris 2.x, if you have the C compiler license, you will also have cscope. Both are usually located under /opt/SUNWspro/bin -SGI developers can also get it. Search for Cscope on this page: - http://freeware.sgi.com/index-by-alpha.html - https://toolbox.sgi.com/toolbox/utilities/cscope/ -The second one is for those who have a password for the SGI toolbox. - There is source to an older version of a cscope clone (called "cs") available on the net. Due to various reasons, this is not supported with Vim. The cscope interface/support for Vim was originally written by Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny -bit of code) was adapted from the cscope interface in nvi. Please report -any problems, suggestions, patches, et al., you have for the usage of -cscope within Vim to him. +bit of code) was adapted from the cscope interface in nvi. *cscope-win32* -For a cscope version for Win32 see: - http://code.google.com/p/cscope-win32/ +For a cscope version for Win32 see (seems abandoned): + https://code.google.com/archive/p/cscope-win32/ Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact him if you have Win32-specific issues. diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 2b322ddbae..51e332df71 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,4 +1,4 @@ -*if_lua.txt* For Vim version 7.4. Last change: 2013 Sep 04 +*if_lua.txt* For Vim version 8.1. Last change: 2015 Oct 16 VIM REFERENCE MANUAL by Luis Carvalho @@ -14,6 +14,7 @@ The Lua Interface to Vim *lua* *Lua* 6. Buffer userdata |lua-buffer| 7. Window userdata |lua-window| 8. The luaeval function |lua-luaeval| +9. Dynamic loading |lua-dynamic| {Vi does not have any of these commands} @@ -58,6 +59,12 @@ Example: EOF endfunction < +To see what version of Lua you have: > + :lua print(_VERSION) + +If you use LuaJIT you can also use this: > + :lua print(jit.version) +< *:luado* :[range]luado {body} Execute Lua function "function (line, linenr) {body} @@ -399,5 +406,31 @@ Examples: > :echo Rand(1,10) +============================================================================== +9. Dynamic loading *lua-dynamic* + +On MS-Windows and Unix the Lua library can be loaded dynamically. The +|:version| output then includes |+lua/dyn|. + +This means that Vim will search for the Lua DLL or shared library file only +when needed. When you don't use the Lua interface you don't need it, thus +you can use Vim without this file. + + +MS-Windows ~ + +To use the Lua interface the Lua DLL must be in your search path. In a +console window type "path" to see what directories are used. The 'luadll' +option can be also used to specify the Lua DLL. The version of the DLL must +match the Lua version Vim was compiled with. + + +Unix ~ + +The 'luadll' option can be used to specify the Lua shared library file instead +of DYNAMIC_LUA_DLL file what was specified at compile time. The version of +the shared library must match the Lua version Vim was compiled with. + + ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/if_mzsch.txt b/runtime/doc/if_mzsch.txt index b42570a75a..f118b17dcc 100644 --- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -1,4 +1,4 @@ -*if_mzsch.txt* For Vim version 7.4. Last change: 2012 Dec 17 +*if_mzsch.txt* For Vim version 8.1. Last change: 2017 Oct 08 VIM REFERENCE MANUAL by Sergey Khorev @@ -13,6 +13,7 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme* 5. mzeval() Vim function |mzscheme-mzeval| 6. Using Function references |mzscheme-funcref| 7. Dynamic loading |mzscheme-dynamic| +8. MzScheme setup |mzscheme-setup| {Vi does not have any of these commands} @@ -96,6 +97,9 @@ procedures is restricted. :mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x :mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x :mzscheme (vim-set-buff-line 10 "This is line #10") + +To see what version of MzScheme you have: > + :mzscheme (display (version)) < Inline script usage: > function! <SID>SetFirstLine() @@ -245,7 +249,7 @@ Windows *mzscheme-window* 5. mzeval() Vim function *mzscheme-mzeval* To facilitate bi-directional interface, you can use |mzeval()| function to -evaluate MzScheme expressions and pass their values to VimL. +evaluate MzScheme expressions and pass their values to Vim script. ============================================================================== 6. Using Function references *mzscheme-funcref* @@ -264,7 +268,7 @@ directly from Scheme. For instance: > < ============================================================================== -7. Dynamic loading *mzscheme-dynamic* *E815* +7. Dynamic loading *mzscheme-dynamic* *E815* On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version| output then includes |+mzscheme/dyn|. @@ -272,15 +276,40 @@ output then includes |+mzscheme/dyn|. This means that Vim will search for the MzScheme DLL files only when needed. When you don't use the MzScheme interface you don't need them, thus you can use Vim without these DLL files. +NOTE: Newer version of MzScheme (Racket) require earlier (trampolined) +initialisation via scheme_main_setup. So Vim always loads the MzScheme DLL at +startup if possible. This may make Vim startup slower. To use the MzScheme interface the MzScheme DLLs must be in your search path. In a console window type "path" to see what directories are used. -The names of the DLLs must match the MzScheme version Vim was compiled with. +On MS-Windows the options 'mzschemedll' and 'mzschemegcdll' are used for the +name of the library to load. The initial value is specified at build time. + +The version of the DLL must match the MzScheme version Vim was compiled with. For MzScheme version 209 they will be "libmzsch209_000.dll" and "libmzgc209_000.dll". To know for sure look at the output of the ":version" command, look for -DDYNAMIC_MZSCH_DLL="something" and -DDYNAMIC_MZGC_DLL="something" in the "Compilation" info. +For example, if MzScheme (Racket) is installed at C:\Racket63, you may need +to set the environment variable as the following: > + + PATH=%PATH%;C:\Racket63\lib + PLTCOLLECTS=C:\Racket63\collects + PLTCONFIGDIR=C:\Racket63\etc +< +============================================================================== +8. MzScheme setup *mzscheme-setup* *E895* + +Vim requires "racket/base" module for if_mzsch core (fallback to "scheme/base" +if it doesn't exist), "r5rs" module for test and "raco ctool" command for +building Vim. If MzScheme did not have them, you can install them with +MzScheme's raco command: +> + raco pkg install scheme-lib # scheme/base module + raco pkg install r5rs-lib # r5rs module + raco pkg install cext-lib # raco ctool command +< ====================================================================== vim:tw=78:ts=8:sts=4:ft=help:norl: diff --git a/runtime/doc/if_ole.txt b/runtime/doc/if_ole.txt index 7d77b660f1..836905a382 100644 --- a/runtime/doc/if_ole.txt +++ b/runtime/doc/if_ole.txt @@ -1,4 +1,4 @@ -*if_ole.txt* For Vim version 7.4. Last change: 2008 Aug 16 +*if_ole.txt* For Vim version 8.1. Last change: 2008 Aug 16 VIM REFERENCE MANUAL by Paul Moore @@ -197,7 +197,7 @@ files in it. --remote-silent "+call cursor(10, 27)" - Places the cursor on line 10 column 27 In Vim > - :h --remote-silent for mor details + :h --remote-silent for more details [.Net remarks provided by Dave Fishburn and Brian Sturk] diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index 7be5f06f68..e81aa41caf 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -1,4 +1,4 @@ -*if_perl.txt* For Vim version 7.4. Last change: 2013 Oct 05 +*if_perl.txt* For Vim version 8.1. Last change: 2017 Nov 24 VIM REFERENCE MANUAL by Sven Verdoolaege @@ -83,6 +83,9 @@ Example vim script: > EOF endfunction < +To see what version of Perl you have: > + :perl print $^V +< *:perldo* *:perld* :[range]perld[o] {cmd} Execute Perl command {cmd} for each line in the @@ -109,7 +112,7 @@ possible. Here is an overview of the functions that are available to Perl: > :perl VIM::Msg("Text") # displays a message - :perl VIM::Msg("Error", "ErrorMsg") # displays an error message + :perl VIM::Msg("Wrong!", "ErrorMsg") # displays an error message :perl VIM::Msg("remark", "Comment") # displays a highlighted message :perl VIM::SetOption("ai") # sets a vim option :perl $nbuf = VIM::Buffers() # returns the number of buffers @@ -284,11 +287,20 @@ used for building Vim. To use the Perl interface the Perl DLL must be in your search path. If Vim reports it cannot find the perl512.dll, make sure your $PATH includes the directory where it is located. The Perl installer normally does that. -In a console window type "path" to see what directories are used. +In a console window type "path" to see what directories are used. The +'perldll' option can be also used to specify the Perl DLL. The name of the DLL must match the Perl version Vim was compiled with. Currently the name is "perl512.dll". That is for Perl 5.12. To know for sure edit "gvim.exe" and search for "perl\d*.dll\c". + +Unix ~ + +The 'perldll' option can be used to specify the Perl shared library file +instead of DYNAMIC_PERL_DLL file what was specified at compile time. The +version of the shared library must match the Perl version Vim was compiled +with. + ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 4ed8eac742..fd18e6ca2e 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 7.4. Last change: 2014 Jul 23 +*if_pyth.txt* For Vim version 8.1. Last change: 2018 Jan 30 VIM REFERENCE MANUAL by Paul Moore @@ -16,6 +16,8 @@ The Python Interface to Vim *python* *Python* 8. pyeval(), py3eval() Vim functions |python-pyeval| 9. Dynamic loading |python-dynamic| 10. Python 3 |python3| +11. Python X |python_x| +12. Building with Python support |python-building| {Vi does not have any of these commands} @@ -56,7 +58,11 @@ Example: > print 'EAT ME' EOF endfunction -< + +To see what version of Python you have: > + :python import sys + :python print(sys.version) + Note: Python is very sensitive to the indenting. Make sure the "class" line and "EOF" do not have any indent. @@ -169,8 +175,8 @@ vim.eval(str) *python-eval* :py tagList = vim.eval('taglist("eval_expr")') < The latter will return a python list of python dicts, for instance: - [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': - 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] + [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': ~ + 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] ~ vim.bindeval(str) *python-bindeval* Like |python-eval|, but returns special objects described in @@ -653,10 +659,37 @@ vim.List object *python-List* class List(vim.List): # Subclassing vim.Function object *python-Function* - Function-like object, acting like vim |Funcref| object. Supports `.name` - attribute and is callable. Accepts special keyword argument `self`, see - |Dictionary-function|. You can also use `vim.Function(name)` constructor, - it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`. + Function-like object, acting like vim |Funcref| object. Accepts special + keyword argument `self`, see |Dictionary-function|. You can also use + `vim.Function(name)` constructor, it is the same as + `vim.bindeval('function(%s)'%json.dumps(name))`. + + Attributes (read-only): + Attribute Description ~ + name Function name. + args `None` or a |python-List| object with arguments. Note + that this is a copy of the arguments list, constructed + each time you request this attribute. Modifications made + to the list will be ignored (but not to the containers + inside argument list: this is like |copy()| and not + |deepcopy()|). + self `None` or a |python-Dictionary| object with self + dictionary. Note that explicit `self` keyword used when + calling resulting object overrides this attribute. + auto_rebind Boolean. True if partial created from this Python object + and stored in the Vim script dictionary should be + automatically rebound to the dictionary it is stored in + when this dictionary is indexed. Exposes Vim internal + difference between `dict.func` (auto_rebind=True) and + `function(dict.func,dict)` (auto_rebind=False). This + attribute makes no sense if `self` attribute is `None`. + + Constructor additionally accepts `args`, `self` and `auto_rebind` + keywords. If `args` and/or `self` argument is given then it constructs + a partial, see |function()|. `auto_rebind` is only used when `self` + argument is given, otherwise it is assumed to be `True` regardless of + whether it was given or not. If `self` is given then it defaults to + `False`. Examples: > f = vim.Function('tr') # Constructor @@ -670,28 +703,50 @@ vim.Function object *python-Function* print f(self={}) # Like call('DictFun', [], {}) print isinstance(f, vim.Function) # True + p = vim.Function('DictFun', self={}) + print f() + p = vim.Function('tr', args=['abc', 'a']) + print f('b') + ============================================================================== 8. pyeval() and py3eval() Vim functions *python-pyeval* To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()| -functions to evaluate Python expressions and pass their values to VimL. +functions to evaluate Python expressions and pass their values to Vim script. +|pyxeval()| is also available. + +The Python value "None" is converted to v:none. ============================================================================== 9. Dynamic loading *python-dynamic* -On MS-Windows the Python library can be loaded dynamically. The |:version| -output then includes |+python/dyn|. +On MS-Windows and Unix the Python library can be loaded dynamically. The +|:version| output then includes |+python/dyn| or |+python3/dyn|. + +This means that Vim will search for the Python DLL or shared library file only +when needed. When you don't use the Python interface you don't need it, thus +you can use Vim without this file. + -This means that Vim will search for the Python DLL file only when needed. -When you don't use the Python interface you don't need it, thus you can use -Vim without this DLL file. +MS-Windows ~ To use the Python interface the Python DLL must be in your search path. In a -console window type "path" to see what directories are used. +console window type "path" to see what directories are used. The 'pythondll' +or 'pythonthreedll' option can be also used to specify the Python DLL. + +The name of the DLL should match the Python version Vim was compiled with. +Currently the name for Python 2 is "python27.dll", that is for Python 2.7. +That is the default value for 'pythondll'. For Python 3 it is python36.dll +(Python 3.6). To know for sure edit "gvim.exe" and search for +"python\d*.dll\c". + -The name of the DLL must match the Python version Vim was compiled with. -Currently the name is "python24.dll". That is for Python 2.4. To know for -sure edit "gvim.exe" and search for "python\d*.dll\c". +Unix ~ + +The 'pythondll' or 'pythonthreedll' option can be used to specify the Python +shared library file instead of DYNAMIC_PYTHON_DLL or DYNAMIC_PYTHON3_DLL file +what were specified at compile time. The version of the shared library must +match the Python 2.x or Python 3 version Vim was compiled with. ============================================================================== 10. Python 3 *python3* @@ -700,9 +755,13 @@ sure edit "gvim.exe" and search for "python\d*.dll\c". The `:py3` and `:python3` commands work similar to `:python`. A simple check if the `:py3` command is working: > :py3 print("Hello") + +To see what version of Python you have: > + :py3 import sys + :py3 print(sys.version) < *:py3file* The `:py3file` command works similar to `:pyfile`. - *:py3do* *E863* + *:py3do* The `:py3do` command works similar to `:pydo`. @@ -750,7 +809,8 @@ Raising SystemExit exception in python isn't endorsed way to quit vim, use: > You can test what Python version is available with: > if has('python') echo 'there is Python 2.x' - elseif has('python3') + endif + if has('python3') echo 'there is Python 3.x' endif @@ -759,5 +819,109 @@ dynamically, these has() calls will try to load them. If only one can be loaded at a time, just checking if Python 2 or 3 are available will prevent the other one from being available. +To avoid loading the dynamic library, only check if Vim was compiled with +python support: > + if has('python_compiled') + echo 'compiled with Python 2.x support' + if has('python_dynamic') + echo 'Python 2.x dynamically loaded' + endif + endif + if has('python3_compiled') + echo 'compiled with Python 3.x support' + if has('python3_dynamic') + echo 'Python 3.x dynamically loaded' + endif + endif + +This also tells you whether Python is dynamically loaded, which will fail if +the runtime library cannot be found. + +============================================================================== +11. Python X *python_x* *pythonx* + +Because most python code can be written so that it works with python 2.6+ and +python 3 the pyx* functions and commands have been written. They work exactly +the same as the Python 2 and 3 variants, but select the Python version using +the 'pyxversion' setting. + +You should set 'pyxversion' in your |.vimrc| to prefer Python 2 or Python 3 +for Python commands. If you change this setting at runtime you may risk that +state of plugins (such as initialization) may be lost. + +If you want to use a module, you can put it in the {rtp}/pythonx directory. +See |pythonx-directory|. + + *:pyx* *:pythonx* +The `:pyx` and `:pythonx` commands work similar to `:python`. A simple check +if the `:pyx` command is working: > + :pyx print("Hello") + +To see what version of Python is being used: > + :pyx import sys + :pyx print(sys.version) +< + *:pyxfile* *python_x-special-comments* +The `:pyxfile` command works similar to `:pyfile`. However you can add one of +these comments to force Vim using `:pyfile` or `:py3file`: > + #!/any string/python2 " Shebang. Must be the first line of the file. + #!/any string/python3 " Shebang. Must be the first line of the file. + # requires python 2.x " Maximum lines depend on 'modelines'. + # requires python 3.x " Maximum lines depend on 'modelines'. +Unlike normal modelines, the bottom of the file is not checked. +If none of them are found, the 'pyxversion' setting is used. + *W20* *W21* +If Vim does not support the selected Python version a silent message will be +printed. Use `:messages` to read them. + + *:pyxdo* +The `:pyxdo` command works similar to `:pydo`. + + *has-pythonx* +You can test if pyx* commands are available with: > + if has('pythonx') + echo 'pyx* commands are available. (Python ' . &pyx . ')' + endif + +When compiled with only one of |+python| or |+python3|, the has() returns 1. +When compiled with both |+python| and |+python3|, the test depends on the +'pyxversion' setting. If 'pyxversion' is 0, it tests Python 3 first, and if +it is not available then Python 2. If 'pyxversion' is 2 or 3, it tests only +Python 2 or 3 respectively. + +Note that for `has('pythonx')` to work it may try to dynamically load Python 3 +or 2. This may have side effects, especially when Vim can only load one of +the two. + +If a user prefers Python 2 and want to fallback to Python 3, he needs to set +'pyxversion' explicitly in his |.vimrc|. E.g.: > + if has('python') + set pyx=2 + elseif has('python3') + set pyx=3 + endif + +============================================================================== +12. Building with Python support *python-building* + +A few hints for building with Python 2 or 3 support. + +UNIX + +See src/Makefile for how to enable including the Python interface. + +On Ubuntu you will want to install these packages for Python 2: + python + python-dev +For Python 3: + python3 + pytyon3-dev +For Python 3.6: + python3.6 + pytyon3.6-dev + +If you have more than one version of Python 3, you need to link python3 to the +one you prefer, before running configure. + ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index 0a32d87851..1b4fd40f3c 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -1,4 +1,4 @@ -*if_ruby.txt* For Vim version 7.4. Last change: 2012 Aug 02 +*if_ruby.txt* For Vim version 8.1. Last change: 2018 Mar 15 VIM REFERENCE MANUAL by Shugo Maeda @@ -7,9 +7,9 @@ The Ruby Interface to Vim *ruby* *Ruby* 1. Commands |ruby-commands| -2. The VIM module |ruby-vim| -3. VIM::Buffer objects |ruby-buffer| -4. VIM::Window objects |ruby-window| +2. The Vim module |ruby-vim| +3. Vim::Buffer objects |ruby-buffer| +4. Vim::Window objects |ruby-window| 5. Global variables |ruby-globals| 6. Dynamic loading |ruby-dynamic| @@ -47,7 +47,7 @@ Example Vim script: > ruby << EOF class Garnet def initialize(s) - @buffer = VIM::Buffer.current + @buffer = Vim::Buffer.current vimputs(s) end def vimputs(s) @@ -58,6 +58,9 @@ Example Vim script: > EOF endfunction < +To see what version of Ruby you have: > + :ruby print RUBY_VERSION +< *:rubydo* *:rubyd* *E265* :[range]rubyd[o] {cmd} Evaluate Ruby command {cmd} for each line in the @@ -69,24 +72,24 @@ Example Vim script: > *:rubyfile* *:rubyf* :rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as - ":ruby load 'file'", but allows file name completion. + `:ruby load 'file'`, but allows file name completion. Executing Ruby commands is not possible in the |sandbox|. ============================================================================== -2. The VIM module *ruby-vim* +2. The Vim module *ruby-vim* -Ruby code gets all of its access to vim via the "VIM" module. +Ruby code gets all of its access to vim via the "Vim" module. -Overview > +Overview: > print "Hello" # displays a message - VIM.command(cmd) # execute an Ex command - num = VIM::Window.count # gets the number of windows - w = VIM::Window[n] # gets window "n" - cw = VIM::Window.current # gets the current window - num = VIM::Buffer.count # gets the number of buffers - b = VIM::Buffer[n] # gets buffer "n" - cb = VIM::Buffer.current # gets the current buffer + Vim.command(cmd) # execute an Ex command + num = Vim::Window.count # gets the number of windows + w = Vim::Window[n] # gets window "n" + cw = Vim::Window.current # gets the current window + num = Vim::Buffer.count # gets the number of buffers + b = Vim::Buffer[n] # gets buffer "n" + cb = Vim::Buffer.current # gets the current buffer w.height = lines # sets the window height w.cursor = [row, col] # sets the window cursor position pos = w.cursor # gets an array [row, col] @@ -96,38 +99,42 @@ Overview > b[n] = str # sets a line in the buffer b.delete(n) # deletes a line b.append(n, str) # appends a line after n - line = VIM::Buffer.current.line # gets the current line - num = VIM::Buffer.current.line_number # gets the current line number - VIM::Buffer.current.line = "test" # sets the current line number + line = Vim::Buffer.current.line # gets the current line + num = Vim::Buffer.current.line_number # gets the current line number + Vim::Buffer.current.line = "test" # sets the current line number < Module Functions: *ruby-message* -VIM::message({msg}) +Vim::message({msg}) Displays the message {msg}. *ruby-set_option* -VIM::set_option({arg}) +Vim::set_option({arg}) Sets a vim option. {arg} can be any argument that the ":set" command accepts. Note that this means that no spaces are allowed in the argument! See |:set|. *ruby-command* -VIM::command({cmd}) +Vim::command({cmd}) Executes Ex command {cmd}. *ruby-evaluate* -VIM::evaluate({expr}) +Vim::evaluate({expr}) Evaluates {expr} using the vim internal expression evaluator (see - |expression|). Returns the expression result as a string. - A |List| is turned into a string by joining the items and inserting - line breaks. + |expression|). Returns the expression result as: + - a Integer if the Vim expression evaluates to a number + - a Float if the Vim expression evaluates to a float + - a String if the Vim expression evaluates to a string + - a Array if the Vim expression evaluates to a Vim list + - a Hash if the Vim expression evaluates to a Vim dictionary + Dictionaries and lists are recursively expanded. ============================================================================== -3. VIM::Buffer objects *ruby-buffer* +3. Vim::Buffer objects *ruby-buffer* -VIM::Buffer objects represent vim buffers. +Vim::Buffer objects represent vim buffers. Class Methods: @@ -155,9 +162,9 @@ line_number Returns the number of the current line if the buffer is active. ============================================================================== -4. VIM::Window objects *ruby-window* +4. Vim::Window objects *ruby-window* -VIM::Window objects represent vim windows. +Vim::Window objects represent vim windows. Class Methods: @@ -195,22 +202,35 @@ This means that Vim will search for the Ruby DLL file or shared library only when needed. When you don't use the Ruby interface you don't need it, thus you can use Vim even though this library file is not on your system. + +MS-Windows ~ + You need to install the right version of Ruby for this to work. You can find the package to download from: -http://www.garbagecollect.jp/ruby/mswin32/en/download/release.html -Currently that is ruby-1.9.1-p429-i386-mswin32.zip +http://rubyinstaller.org/downloads/ +Currently that is rubyinstaller-2.2.5.exe To use the Ruby interface the Ruby DLL must be in your search path. In a -console window type "path" to see what directories are used. +console window type "path" to see what directories are used. The 'rubydll' +option can be also used to specify the Ruby DLL. The name of the DLL must match the Ruby version Vim was compiled with. -Currently the name is "msvcrt-ruby191.dll". That is for Ruby 1.9.1. To know +Currently the name is "msvcrt-ruby220.dll". That is for Ruby 2.2.X. To know for sure edit "gvim.exe" and search for "ruby\d*.dll\c". -If you want to build Vim with Ruby 1.9.1, you need to edit the config.h file -and comment-out the check for _MSC_VER. -You may also need to rename the include directory name to match the version, -strangely for Ruby 1.9.3 the directory is called 1.9.1. +If you want to build Vim with RubyInstaller 1.9 or 2.X using MSVC, you need +some tricks. See the src/INSTALLpc.txt for detail. + +If Vim is built with RubyInstaller 2.4 or later, you may also need to add +"C:\Ruby<version>\bin\ruby_builtin_dlls" to the PATH environment variable. + + +Unix ~ + +The 'rubydll' option can be used to specify the Ruby shared library file +instead of DYNAMIC_RUBY_DLL file what was specified at compile time. The +version of the shared library must match the Ruby version Vim was compiled +with. ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_sniff.txt b/runtime/doc/if_sniff.txt index a3d52085f2..cf6ed1c981 100644 --- a/runtime/doc/if_sniff.txt +++ b/runtime/doc/if_sniff.txt @@ -1,95 +1,11 @@ -*if_sniff.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*if_sniff.txt* For Vim version 8.1. Last change: 2016 Feb 27 VIM REFERENCE MANUAL by Anton Leherbauer (toni@takefive.co.at) -SNiFF+ and Vim *sniff* - -1. Introduction |sniff-intro| -2. Commands |sniff-commands| -3. Compiling Vim with SNiFF+ interface |sniff-compiling| - -{Vi does not have any of these commands} *E275* *E274* *E276* *E278* *E279* - -The SNiFF+ interface only works, when Vim was compiled with the |+sniff| -feature. - -============================================================================== -1. Introduction *sniff-intro* - -The following features for the use with SNiFF+ are available: - - * Vim can be used for all editing requests - * SNiFF+ recognizes and updates all browsers when a file is saved in Vim - * SNiFF+ commands can be issued directly from Vim - -How to use Vim with SNiFF+ - 1. Make sure SNiFF+ is running. - 2. In the Editor view of the Preferences dialog set the Field named - 'External Editor' to 'Emacs/Vim'. - 4. Start Vim - 5. Connect to SNiFF+ (:sniff connect) - -Once a connection is established, SNiFF+ uses Vim for all requests to show or -edit source code. On the other hand, you can send queries to SNiFF+ with the -:sniff command. - -============================================================================== -2. Commands *sniff-commands* - - *:sniff* *:sni* -:sni[ff] request [symbol] Send request to sniff with optional symbol. - {not in Vi} -:sni[ff] Display all possible requests and the connection - status - -Most requests require a symbol (identifier) as parameter. If it is omitted, -Vim will use the current word under the cursor. -The available requests are listed below: - -request mapping description -------------------------------------------------------------------------------- -connect sc Establish connection with SNiFF+. - Make sure SNiFF+ is prepared for this in the - Preferences -disconnect sq Disconnect from SNiFF+. You can reconnect any - time with :sniff connect (or 'sc') -toggle st Toggle between implementation - and definition file -find-symbol sf Load the symbol into a Symbol Browser -browse-class sb Loads the class into a Class Browser -superclass ss Edit superclass of symbol -overridden so Edit overridden method of symbol -retrieve-file srf Retrieve symbol in current file -retrieve-project srp Retrieve symbol in current project -retrieve-all-projects srP Retrieve symbol in all projects -retrieve-next sR Retrieve symbol using current Retriever - settings -goto-symbol sg Goto definition or implementation of symbol -hierarchy sh Load symbol into the Hierarchy Browser -restr-hier sH same as above but show only related classes -xref-to sxt Start a refers-to query on symbol and - load the results into the Cross Referencer -xref-by sxb Start a referred-by query on symbol -xref-has sxh Start a refers-to components query on symbol -xref-used-by sxu Start a referred-by as component query on - symbol -show-docu sd Show documentation of symbol -gen-docu sD Generate documentation of symbol - -The mappings are defined in a file 'sniff.vim', which is part of every SNiFF+ -product ($SNIFF_DIR/config/sniff.vim). This file is sourced whenever Vim -connects to SNiFF+. - -============================================================================== -3. Compiling Vim with SNiFF+ interface *sniff-compiling* - -To compile Vim with SNiFF+ support, you need two source files of the extra -archive: if_sniff.c and if_sniff.h. -On Unix: Edit the Makefile and uncomment the line "--enable-sniff". Or run -configure manually with this argument. -On NT: Specify SNIFF=yes with your make command. +The SNiFF+ support was removed at patch 7.4.1433. If you want to check it out +sync to before that. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_tcl.txt b/runtime/doc/if_tcl.txt index d6726a3546..979a19b473 100644 --- a/runtime/doc/if_tcl.txt +++ b/runtime/doc/if_tcl.txt @@ -1,4 +1,4 @@ -*if_tcl.txt* For Vim version 7.4. Last change: 2012 Aug 02 +*if_tcl.txt* For Vim version 8.1. Last change: 2016 Jan 01 VIM REFERENCE MANUAL by Ingo Wilken @@ -16,7 +16,7 @@ The Tcl Interface to Vim *tcl* *Tcl* *TCL* 8. Examples |tcl-examples| 9. Dynamic loading |tcl-dynamic| -{Vi does not have any of these commands} *E280* *E281* +{Vi does not have any of these commands} *E280* The Tcl interface only works when Vim was compiled with the |+tcl| feature. @@ -54,6 +54,9 @@ Example: > EOF endfunction < +To see what version of Tcl you have: > + :tcl puts [info patchlevel] +< *:tcldo* *:tcld* :[range]tcld[o] {cmd} Execute Tcl command {cmd} for each line in [range] @@ -515,19 +518,30 @@ startup file (usually "~/.vimrc" on Unix): ============================================================================== 9. Dynamic loading *tcl-dynamic* -On MS-Windows the Tcl library can be loaded dynamically. The |:version| -output then includes |+tcl/dyn|. +On MS-Windows and Unix the Tcl library can be loaded dynamically. The +|:version| output then includes |+tcl/dyn|. + +This means that Vim will search for the Tcl DLL or shared library file only +when needed. When you don't use the Tcl interface you don't need it, thus you +can use Vim without this file. + -This means that Vim will search for the Tcl DLL file only when needed. When -you don't use the Tcl interface you don't need it, thus you can use Vim -without this DLL file. +MS-Windows ~ To use the Tcl interface the Tcl DLL must be in your search path. In a -console window type "path" to see what directories are used. +console window type "path" to see what directories are used. The 'tcldll' +option can be also used to specify the Tcl DLL. The name of the DLL must match the Tcl version Vim was compiled with. -Currently the name is "tcl83.dll". That is for Tcl 8.3. To know for sure +Currently the name is "tcl86.dll". That is for Tcl 8.6. To know for sure edit "gvim.exe" and search for "tcl\d*.dll\c". + +Unix ~ + +The 'tcldll' option can be used to specify the Tcl shared library file instead +of DYNAMIC_TCL_DLL file what was specified at compile time. The version of +the shared library must match the Tcl version Vim was compiled with. + ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index fc16b1a7e7..180d932b3f 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 7.4. Last change: 2014 Apr 23 +*indent.txt* For Vim version 8.1. Last change: 2018 Apr 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -324,6 +324,21 @@ The examples below assume a 'shiftwidth' of 4. { { void function(); void function(); } } +< + *cino-E* + EN Indent inside C++ linkage specifications (extern "C" or + extern "C++") N characters extra compared to a normal block. + (default 0). + + cino= cino=E-s > + extern "C" { extern "C" { + void function(); void function(); + } } + + extern "C" extern "C" + { { + void function(); void function(); + } } < *cino-p* pN Parameter declarations for K&R-style function declarations will @@ -399,10 +414,10 @@ The examples below assume a 'shiftwidth' of 4. *cino-(* (N When in unclosed parentheses, indent N characters from the line with the unclosed parentheses. Add a 'shiftwidth' for every - unclosed parentheses. When N is 0 or the unclosed parentheses - is the first non-white character in its line, line up with the - next non-white character after the unclosed parentheses. - (default 'shiftwidth' * 2). + extra unclosed parentheses. When N is 0 or the unclosed + parentheses is the first non-white character in its line, line + up with the next non-white character after the unclosed + parentheses. (default 'shiftwidth' * 2). cino= cino=(0 > if (c1 && (c2 || if (c1 && (c2 || @@ -413,7 +428,8 @@ The examples below assume a 'shiftwidth' of 4. { { < *cino-u* - uN Same as (N, but for one level deeper. (default 'shiftwidth'). + uN Same as (N, but for one nesting level deeper. + (default 'shiftwidth'). cino= cino=u2 > if (c123456789 if (c123456789 @@ -554,7 +570,7 @@ The examples below assume a 'shiftwidth' of 4. The defaults, spelled out in full, are: - cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,ps,ts,is,+s, + cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s, c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0 Vim puts a line in column 1 if: @@ -813,7 +829,7 @@ PHP indenting can be altered in several ways by modifying the values of some global variables: *php-comment* *PHP_autoformatcomment* -To not enable auto-formating of comments by default (if you want to use your +To not enable auto-formatting of comments by default (if you want to use your own 'formatoptions'): > :let g:PHP_autoformatcomment = 0 @@ -891,6 +907,25 @@ In PHP braces are not required inside 'case/default' blocks therefore 'case:' and 'default:' are indented at the same level than the 'switch()' to avoid meaningless indentation. You can use the above option to return to the traditional way. +------------- + + *PHP_noArrowMatching* +By default the indent script will indent multi-line chained calls by matching +the position of the '->': > + + $user_name_very_long->name() + ->age() + ->info(); + +You can revert to the classic way of indenting by setting this option to 1: > + :let g:PHP_noArrowMatching = 1 + +You will obtain the following result: > + + $user_name_very_long->name() + ->age() + ->info(); + PYTHON *ft-python-indent* diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 2d0eda42da..2dd5eab674 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*index.txt* For Vim version 8.1. Last change: 2018 Apr 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -49,6 +49,7 @@ tag char action in Insert mode ~ |i_CTRL-G_k| CTRL-G k line up, to column where inserting started |i_CTRL-G_k| CTRL-G <Up> line up, to column where inserting started |i_CTRL-G_u| CTRL-G u start new undoable edit +|i_CTRL-G_U| CTRL-G U don't break undo with next cursor movement |i_<BS>| <BS> delete character before the cursor |i_digraph| {char1}<BS>{char2} enter digraph (only when 'digraph' option set) @@ -308,10 +309,10 @@ tag char note action in Normal mode ~ |B| B 1 cursor N WORDS backward |C| ["x]C 2 change from the cursor position to the end of the line, and N-1 more lines [into - buffer x]; synonym for "c$" + register x]; synonym for "c$" |D| ["x]D 2 delete the characters under the cursor until the end of the line and N-1 more - lines [into buffer x]; synonym for "d$" + lines [into register x]; synonym for "d$" |E| E 1 cursor forward to the end of WORD N |F| F{char} 1 cursor to the Nth occurrence of {char} to the left @@ -328,13 +329,13 @@ tag char note action in Normal mode ~ opposite direction |O| O 2 begin a new line above the cursor and insert text, repeat N times -|P| ["x]P 2 put the text [from buffer x] before the +|P| ["x]P 2 put the text [from register x] before the cursor N times |Q| Q switch to "Ex" mode |R| R 2 enter replace mode: overtype existing characters, repeat the entered text N-1 times -|S| ["x]S 2 delete N lines [into buffer x] and start +|S| ["x]S 2 delete N lines [into register x] and start insert; synonym for "cc". |T| T{char} 1 cursor till after Nth occurrence of {char} to the left @@ -342,8 +343,8 @@ tag char note action in Normal mode ~ |V| V start linewise Visual mode |W| W 1 cursor N WORDS forward |X| ["x]X 2 delete N characters before the cursor [into - buffer x] -|Y| ["x]Y yank N lines [into buffer x]; synonym for + register x] +|Y| ["x]Y yank N lines [into register x]; synonym for "yy" |ZZ| ZZ store current file if modified, and exit |ZQ| ZQ exit current file always @@ -366,12 +367,12 @@ tag char note action in Normal mode ~ |`}| `} 1 cursor to the end of the current paragraph |a| a 2 append text after the cursor N times |b| b 1 cursor N words backward -|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start +|c| ["x]c{motion} 2 delete Nmove text [into register x] and + start insert +|cc| ["x]cc 2 delete N lines [into register x] and start insert -|cc| ["x]cc 2 delete N lines [into buffer x] and start - insert -|d| ["x]d{motion} 2 delete Nmove text [into buffer x] -|dd| ["x]dd 2 delete N lines [into buffer x] +|d| ["x]d{motion} 2 delete Nmove text [into register x] +|dd| ["x]dd 2 delete N lines [into register x] |do| do 2 same as ":diffget" |dp| dp 2 same as ":diffput" |e| e 1 cursor forward to the end of word N @@ -397,16 +398,16 @@ tag char note action in Normal mode ~ |q?| q? edit ? command-line in command-line window |r| r{char} 2 replace N chars with {char} |s| ["x]s 2 (substitute) delete N characters [into - buffer x] and start insert + register x] and start insert |t| t{char} 1 cursor till before Nth occurrence of {char} to the right |u| u 2 undo changes |v| v start characterwise Visual mode |w| w 1 cursor N words forward |x| ["x]x 2 delete N characters under and after the - cursor [into buffer x] -|y| ["x]y{motion} yank Nmove text [into buffer x] -|yy| ["x]yy yank N lines [into buffer x] + cursor [into register x] +|y| ["x]y{motion} yank Nmove text [into register x] +|yy| ["x]yy yank N lines [into register x] |z| z{char} commands starting with 'z', see |z| below |{| { 1 cursor N paragraphs backward |bar| | 1 cursor to column N @@ -527,8 +528,11 @@ tag command action in Normal mode ~ |CTRL-W_CTRL-]| CTRL-W CTRL-] same as "CTRL-W ]" |CTRL-W_CTRL-^| CTRL-W CTRL-^ same as "CTRL-W ^" |CTRL-W_CTRL-_| CTRL-W CTRL-_ same as "CTRL-W _" +|CTRL-W_quote| CTRL-W " terminal window: paste register |CTRL-W_+| CTRL-W + increase current window height N lines |CTRL-W_-| CTRL-W - decrease current window height N lines +|CTRL-W_.| CTRL-W . terminal window: type CTRL-W +|CTRL-W_:| CTRL-W : same as |:|, edit a command line |CTRL-W_<| CTRL-W < decrease current window width N columns |CTRL-W_=| CTRL-W = make all windows the same height & width |CTRL-W_>| CTRL-W > increase current window width N columns @@ -536,6 +540,7 @@ tag command action in Normal mode ~ |CTRL-W_J| CTRL-W J move current window to the very bottom |CTRL-W_K| CTRL-W K move current window to the very top |CTRL-W_L| CTRL-W L move current window to the far right +|CTRL-W_N| CTRL-W N terminal window: go to Terminal Normal mode |CTRL-W_P| CTRL-W P go to preview window |CTRL-W_R| CTRL-W R rotate windows upwards N times |CTRL-W_S| CTRL-W S same as "CTRL-W s" @@ -702,12 +707,16 @@ tag char note action in Normal mode ~ |g'| g'{mark} 1 like |'| but without changing the jumplist |g`| g`{mark} 1 like |`| but without changing the jumplist |gstar| g* 1 like "*", but without using "\<" and "\>" +|g+| g+ go to newer text state N times +|g,| g, 1 go to N newer position in change list +|g-| g- go to older text state N times |g0| g0 1 when 'wrap' off go to leftmost character of the current line that is on the screen; when 'wrap' on go to the leftmost character of the current screen line |g8| g8 print hex value of bytes used in UTF-8 character under the cursor +|g;| g; 1 go to N older position in change list |g<| g< display previous command output |g?| g? 2 Rot13 encoding operator |g?g?| g?? 2 Rot13 encode current line @@ -736,6 +745,7 @@ tag char note action in Normal mode ~ the screen; when 'wrap' on go to the leftmost non-white character of the current screen line +|g_| g_ 1 cursor to the last CHAR N - 1 lines lower |ga| ga print ascii value of character under the cursor |gd| gd 1 go to definition of word under the cursor @@ -854,6 +864,7 @@ tag command note action in Visual mode ~ ------------------------------------------------------------------------------ |v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode |v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|v_CTRL-A| CTRL-A 2 add N to number in highlighted text |v_CTRL-C| CTRL-C stop Visual mode |v_CTRL-G| CTRL-G toggle between Visual mode and Select mode |v_<BS>| <BS> 2 Select mode: delete highlighted area @@ -862,6 +873,7 @@ tag command note action in Visual mode ~ command |v_CTRL-V| CTRL-V make Visual mode blockwise or stop Visual mode +|v_CTRL-X| CTRL-X 2 subtract N from number in highlighted text |v_<Esc>| <Esc> stop Visual mode |v_CTRL-]| CTRL-] jump to highlighted tag |v_!| !{filter} 2 filter the highlighted lines through the @@ -918,6 +930,8 @@ tag command note action in Visual mode ~ |v_a}| a} same as aB |v_c| c 2 delete highlighted area and start insert |v_d| d 2 delete highlighted area +|v_g_CTRL-A| g CTRL-A 2 add N to number in highlighted text +|v_g_CTRL-X| g CTRL-X 2 subtract N from number in highlighted text |v_gJ| gJ 2 join the highlighted lines without inserting spaces |v_gq| gq 2 format the highlighted lines @@ -945,7 +959,7 @@ tag command note action in Visual mode ~ |v_i{| i{ same as iB |v_i}| i} same as iB |v_o| o move cursor to other corner of area -|v_r| r 2 delete highlighted area and start insert +|v_r| r 2 replace highlighted area with a character |v_s| s 2 delete highlighted area and start insert |v_u| u 2 make highlighted area lowercase |v_v| v make Visual mode characterwise or stop @@ -974,7 +988,7 @@ tag command action in Command-line editing mode ~ |c_CTRL-E| CTRL-E cursor to end of command-line |'cedit'| CTRL-F default value for 'cedit': opens the command-line window; otherwise not used - CTRL-G not used +|c_CTRL-G| CTRL-G next match when 'incsearch' is active |c_<BS>| <BS> delete the character in front of the cursor |c_digraph| {char1} <BS> {char2} enter digraph when 'digraph' is on @@ -992,12 +1006,14 @@ tag command action in Command-line editing mode ~ |c_CTRL-L| CTRL-L do completion on the pattern in front of the cursor and insert the longest common part |c_<CR>| <CR> execute entered command -|c_<CR>| CTRL-M same as <CR> +|c_CTRL-M| CTRL-M same as <CR> |c_CTRL-N| CTRL-N after using 'wildchar' with multiple matches: - go to next match, otherwise: same as <Down> + go to next match, otherwise: recall older + command-line from history. CTRL-O not used |c_CTRL-P| CTRL-P after using 'wildchar' with multiple matches: - go to previous match, otherwise: same as <Up> + go to previous match, otherwise: recall older + command-line from history. |c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal control flow |c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} @@ -1007,7 +1023,7 @@ tag command action in Command-line editing mode ~ insert the contents of a register or object under the cursor literally CTRL-S (used for terminal control flow) - CTRL-T not used +|c_CTRL-T| CTRL-T previous match when 'incsearch' is active |c_CTRL-U| CTRL-U remove all characters |c_CTRL-V| CTRL-V insert next non-digit literally, insert three digit decimal number as a single byte. @@ -1016,7 +1032,7 @@ tag command action in Command-line editing mode ~ CTRL-Y copy (yank) modeless selection CTRL-Z not used (reserved for suspend) |c_<Esc>| <Esc> abandon command-line without executing it -|c_<Esc>| CTRL-[ same as <Esc> +|c_CTRL-[| CTRL-[ same as <Esc> |c_CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode, abandon command-line |c_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode', abandon command-line @@ -1050,7 +1066,7 @@ tag command action in Command-line editing mode ~ |c_<Insert>| <Insert> toggle insert/overstrike mode |c_<LeftMouse>| <LeftMouse> cursor at mouse click -You found it, Arthur! *holy-grail* +You found it, Arthur! *holy-grail* *:smile* ============================================================================== 5. EX commands *ex-cmd-index* *:index* @@ -1129,10 +1145,13 @@ tag command action ~ |:caddfile| :caddf[ile] add error message to current quickfix list |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command +|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window |:cbuffer| :cb[uffer] parse error messages and jump to first error |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdo execute command in each valid error list entry +|:cfdo| :cfd[o] execute command in each file in error list |:center| :ce[nter] format lines at the center |:cexpr| :cex[pr] read errors from expr and jump to first |:cfile| :cf[ile] read file with error messages and jump to first @@ -1144,8 +1163,10 @@ tag command action ~ |:chdir| :chd[ir] change directory |:checkpath| :che[ckpath] list included files |:checktime| :checkt[ime] check timestamp of loaded buffers -|:clist| :cl[ist] list all errors +|:chistory| :chi[story] list the error lists |:clast| :cla[st] go to the specified error, default last one +|:clearjumps| :cle[arjumps] clear the jump list +|:clist| :cl[ist] list all errors |:close| :clo[se] close current window |:cmap| :cm[ap] like ":map" but for Command-line mode |:cmapclear| :cmapc[lear] clear all mappings for Command-line mode @@ -1169,7 +1190,7 @@ tag command action ~ |:cpfile| :cpf[ile] go to last error in previous file |:cquit| :cq[uit] quit Vim with an error code |:crewind| :cr[ewind] go to the specified error, default first one -|:cscope| :cs[cope] execute cscope command +|:cscope| :cs[cope] execute cscope command |:cstag| :cst[ag] use cscope to jump to a tag |:cunmap| :cu[nmap] like ":unmap" but for Command-line mode |:cunabbrev| :cuna[bbrev] like ":unabbrev" but for Command-line mode @@ -1192,7 +1213,7 @@ tag command action ~ |:display| :di[splay] display registers |:djump| :dj[ump] jump to #define |:dl| :dl short for |:delete| with the 'l' flag -|:dl| :del[ete]l short for |:delete| with the 'l' flag +|:del| :del[ete]l short for |:delete| with the 'l' flag |:dlist| :dli[st] list #defines |:doautocmd| :do[autocmd] apply autocommands to current buffer |:doautoall| :doautoa[ll] apply autocommands for all loaded buffers @@ -1224,6 +1245,7 @@ tag command action ~ |:file| :f[ile] show or set the current file name |:files| :files list all files in the buffer list |:filetype| :filet[ype] switch file type detection on/off +|:filter| :filt[er] filter output of following command |:find| :fin[d] find file in 'path' and edit it |:finally| :fina[lly] part of a :try command |:finish| :fini[sh] quit sourcing a Vim script @@ -1244,6 +1266,7 @@ tag command action ~ |:gvim| :gv[im] start the GUI |:hardcopy| :ha[rdcopy] send text to the printer |:help| :h[elp] open a help window +|:helpclose| :helpc[lose] close one help window |:helpfind| :helpf[ind] dialog to open a help window |:helpgrep| :helpg[rep] like ":grep" but searches help files |:helptags| :helpt[ags] generate help tags for a directory @@ -1285,11 +1308,14 @@ tag command action ~ |:last| :la[st] go to the last file in the argument list |:language| :lan[guage] set the language (locale) |:later| :lat[er] go to newer change, redo +|:lbottom| :lbo[ttom] scroll to the bottom of the location window |:lbuffer| :lb[uffer] parse locations and jump to first location |:lcd| :lc[d] change directory locally |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window -|:lcscope| :lcs[cope] like ":cscope" but uses location list +|:lcscope| :lcs[cope] like ":cscope" but uses location list +|:ldo| :ld[o] execute command in valid location list entries +|:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines |:leftabove| :lefta[bove] make split window appear left or above |:let| :let assign a value to a variable or option @@ -1302,6 +1328,7 @@ tag command action ~ |:lgrep| :lgr[ep] run 'grepprg' and jump to first match |:lgrepadd| :lgrepa[dd] like :grep, but append to current list |:lhelpgrep| :lh[elpgrep] like ":helpgrep" but uses location list +|:lhistory| :lhi[story] list the location lists |:ll| :ll go to specific location |:llast| :lla[st] go to the specified location, default last one |:llist| :lli[st] list all locations @@ -1343,7 +1370,7 @@ tag command action ~ |:marks| :marks list all marks |:match| :mat[ch] define a match to highlight |:menu| :me[nu] enter a new menu item -|:menutranslate| :menut[ranslate] add a menu translation item +|:menutranslate| :menut[ranslate] add a menu translation item |:messages| :mes[sages] view previously displayed messages |:mkexrc| :mk[exrc] write current mappings and settings to a file |:mksession| :mks[ession] write session info to a file @@ -1386,6 +1413,8 @@ tag command action ~ |:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode |:ounmenu| :ounme[nu] remove menu for Operator-pending mode |:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window +|:packadd| :pa[ckadd] add a plugin from 'packpath' +|:packloadall| :packl[oadall] load all packages under 'packpath' |:pclose| :pc[lose] close preview window |:pedit| :ped[it] edit file in the preview window |:perl| :pe[rl] execute Perl command @@ -1419,6 +1448,10 @@ tag command action ~ |:python| :py[thon] execute Python command |:pydo| :pyd[o] execute Python command for each line |:pyfile| :pyf[ile] execute Python script file +|:pyx| :pyx execute |python_x| command +|:pythonx| :pythonx same as :pyx +|:pyxdo| :pyxd[o] execute |python_x| command for each line +|:pyxfile| :pyxf[ile] execute |python_x| script file |:quit| :q[uit] quit current window (when one window quit Vim) |:quitall| :quita[ll] quit Vim |:qall| :qa[ll] quit Vim @@ -1466,7 +1499,7 @@ tag command action ~ buffer list |:sbrewind| :sbr[ewind] split window and go to first file in the buffer list -|:scriptnames| :scrip[tnames] list names of all sourced Vim scripts +|:scriptnames| :scr[iptnames] list names of all sourced Vim scripts |:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script |:scscope| :scs[cope] split window and execute cscope command |:set| :se[t] show or set options @@ -1487,9 +1520,9 @@ tag command action ~ |:smap| :smap like ":map" but for Select mode |:smapclear| :smapc[lear] remove all mappings for Select mode |:smenu| :sme[nu] add menu for Select mode +|:smile| :smi[le] make the user happy |:snext| :sn[ext] split window and go to next file in the argument list -|:sniff| :sni[ff] send request to sniff |:snomagic| :sno[magic] :substitute with 'nomagic' |:snoremap| :snor[emap] like ":noremap" but for Select mode |:snoremenu| :snoreme[nu] like ":noremenu" but for Select mode @@ -1509,7 +1542,7 @@ tag command action ~ |:stop| :st[op] suspend the editor or escape to a shell |:stag| :sta[g] split window and jump to a tag |:startinsert| :star[tinsert] start Insert mode -|:startgreplace| :startg[replace] start Virtual Replace mode +|:startgreplace| :startg[replace] start Virtual Replace mode |:startreplace| :startr[eplace] start Replace mode |:stopinsert| :stopi[nsert] stop Insert mode |:stjump| :stj[ump] do ":tjump" and split window @@ -1530,14 +1563,14 @@ tag command action ~ |:tabdo| :tabdo execute command in each tab page |:tabedit| :tabe[dit] edit a file in a new tab page |:tabfind| :tabf[ind] find file in 'path', edit it in a new tab page -|:tabfirst| :tabfir[st] got to first tab page -|:tablast| :tabl[ast] got to last tab page +|:tabfirst| :tabfir[st] go to first tab page +|:tablast| :tabl[ast] go to last tab page |:tabmove| :tabm[ove] move tab page to other position |:tabnew| :tabnew edit a file in a new tab page |:tabnext| :tabn[ext] go to next tab page |:tabonly| :tabo[nly] close all tab pages except the current one |:tabprevious| :tabp[revious] go to previous tab page -|:tabrewind| :tabr[ewind] got to first tab page +|:tabrewind| :tabr[ewind] go to first tab page |:tabs| :tabs list the tab pages and what they contain |:tab| :tab create new tab when opening new window |:tag| :ta[g] jump to tag @@ -1546,18 +1579,23 @@ tag command action ~ |:tcldo| :tcld[o] execute Tcl command for each line |:tclfile| :tclf[ile] execute Tcl script file |:tearoff| :te[aroff] tear-off a menu +|:terminal| :ter[minal] open a terminal window |:tfirst| :tf[irst] jump to first matching tag |:throw| :th[row] throw an exception |:tjump| :tj[ump] like ":tselect", but jump directly when there is only one match |:tlast| :tl[ast] jump to last matching tag +|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode +|:tmap| :tma[p] like ":map" but for Terminal-Job mode |:tmenu| :tm[enu] define menu tooltip |:tnext| :tn[ext] jump to next matching tag +|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode |:topleft| :to[pleft] make split window appear at top or far left |:tprevious| :tp[revious] jump to previous matching tag |:trewind| :tr[ewind] jump to first matching tag |:try| :try execute commands, abort on error or exception |:tselect| :ts[elect] list matching tags and select one +|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode |:tunmenu| :tu[nmenu] remove menu tooltip |:undo| :u[ndo] undo last change(s) |:undojoin| :undoj[oin] join next change with previous undo block diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 4136c91898..7c2547f105 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.4. Last change: 2014 Jul 06 +*insert.txt* For Vim version 8.1. Last change: 2018 Feb 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -51,6 +51,8 @@ char action ~ abbreviation. Note: If your <Esc> key is hard to hit on your keyboard, train yourself to use CTRL-[. + If Esc doesn't work and you are using a Mac, try CTRL-Esc. + Or disable Listening under Accessibility preferences. *i_CTRL-C* CTRL-C Quit insert mode, go back to Normal mode. Do not check for abbreviations. Does not trigger the |InsertLeave| autocommand @@ -79,9 +81,11 @@ CTRL-W Delete the word before the cursor (see |i_backspacing| about joining lines). See the section "word motions", |word-motions|, for the definition of a word. *i_CTRL-U* -CTRL-U Delete all entered characters in the current line (see - |i_backspacing| about joining lines). - +CTRL-U Delete all entered characters before the cursor in the current + line. If there are no newly entered characters and + 'backspace' is not empty, delete all characters before the + cursor in the current line. + See |i_backspacing| about joining lines. *i_CTRL-I* *i_<Tab>* *i_Tab* <Tab> or CTRL-I Insert a tab. If the 'expandtab' option is on, the equivalent number of spaces is inserted (use CTRL-V <Tab> to @@ -148,14 +152,15 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* CTRL-R a results in "ac". CTRL-R CTRL-R a results in "ab^Hc". < Options 'textwidth', 'formatoptions', etc. still apply. If - you also want to avoid these, use "<C-R><C-O>r", see below. + you also want to avoid these, use CTRL-R CTRL-O, see below. The '.' register (last inserted text) is still inserted as typed. {not in Vi} CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* Insert the contents of a register literally and don't auto-indent. Does the same as pasting with the mouse - |<MiddleMouse>|. + |<MiddleMouse>|. When the register is linewise this will + insert the text above the current line, like with `P`. Does not replace characters! The '.' register (last inserted text) is still inserted as typed. {not in Vi} @@ -373,6 +378,9 @@ CTRL-O execute one command, return to Insert mode *i_CTRL-O* CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L* CTRL-G u break undo sequence, start new change *i_CTRL-G_u* +CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U* + movement (but only if the cursor stays + within same the line) ----------------------------------------------------------------------- Note: If the cursor keys take you out of Insert mode, check the 'noesckeys' @@ -412,6 +420,28 @@ that, with CTRL-O u. Another example: > This breaks undo at each line break. It also expands abbreviations before this. +An example for using CTRL-G U: > + + inoremap <Left> <C-G>U<Left> + inoremap <Right> <C-G>U<Right> + inoremap <expr> <Home> col('.') == match(getline('.'), '\S') + 1 ? + \ repeat('<C-G>U<Left>', col('.') - 1) : + \ (col('.') < match(getline('.'), '\S') ? + \ repeat('<C-G>U<Right>', match(getline('.'), '\S') + 0) : + \ repeat('<C-G>U<Left>', col('.') - 1 - match(getline('.'), '\S'))) + inoremap <expr> <End> repeat('<C-G>U<Right>', col('$') - col('.')) + inoremap ( ()<C-G>U<Left> + +This makes it possible to use the cursor keys in Insert mode, without breaking +the undo sequence and therefore using |.| (redo) will work as expected. +Also entering a text like (with the "(" mapping from above): > + + Lorem ipsum (dolor + +will be repeatable by the |.|to the expected + + Lorem ipsum (dolor) + Using CTRL-O splits undo: the text typed before and after it is undone separately. If you want to avoid this (e.g., in a mapping) you might be able to use CTRL-R = |i_CTRL-R|. E.g., to call a function: > @@ -604,13 +634,13 @@ Completion can be done for: 10. User defined completion |i_CTRL-X_CTRL-U| 11. omni completion |i_CTRL-X_CTRL-O| 12. Spelling suggestions |i_CTRL-X_s| -13. keywords in 'complete' |i_CTRL-N| +13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P| -All these (except 2) are done in CTRL-X mode. This is a sub-mode of Insert -and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the -CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid -CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), -and CTRL-P (previous). +All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a +sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X +and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is +not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself, +CTRL-N (next), and CTRL-P (previous). Also see the 'infercase' option if you want to adjust the case of the match. @@ -1073,8 +1103,10 @@ items: item with the same word is already present. empty when non-zero this match will be added even when it is an empty string + user_data custom data which is associated with the item and + available in |v:completed_item| -All of these except 'icase', 'dup' and 'empty' must be a string. If an item +All of these except "icase", "dup" and "empty" must be a string. If an item does not meet these requirements then an error message is given and further items in the list are not used. You can mix string and Dictionary items in the returned list. @@ -1166,6 +1198,8 @@ The menu is used when: The 'pumheight' option can be used to set a maximum height. The default is to use all space available. +The 'pumwidth' option can be used to set a minimum width. The default is 15 +characters. There are three states: 1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P. @@ -1266,7 +1300,8 @@ it here: http://ctags.sourceforge.net/ Version 5.6 or later is recommended. For version 5.5.4 you should add a patch that adds the "typename:" field: ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch A compiled .exe for MS-Windows can be found at: - http://georgevreilly.com/vim/ctags.html + http://ctags.sourceforge.net/ + https://github.com/universal-ctags/ctags-win32 If you want to complete system functions you can do something like this. Use ctags to generate a tags file for all the system header files: > @@ -1442,7 +1477,7 @@ The completions provided by CTRL-X CTRL-O are sensitive to the context: Notes: - Vim will load/evaluate code in order to provide completions. This may - cause some code execution, which may be a concern. This is no longer + cause some code execution, which may be a concern. This is no longer enabled by default, to enable this feature add > let g:rubycomplete_buffer_loading = 1 <- In context 1 above, Vim can parse the entire buffer to add a list of @@ -1498,15 +1533,15 @@ that begin with the filetype, "php", in this case. For example these syntax groups are included by default with the PHP: phpEnvVar, phpIntVar, phpFunctions. -If you wish non-filetype syntax items to also be included, you can use a -regular expression syntax (added in version 13.0 of autoload\syntaxcomplete.vim) -to add items. Looking at the output from ":syntax list" while editing a PHP file -I can see some of these entries: > +If you wish non-filetype syntax items to also be included, you can use a +regular expression syntax (added in version 13.0 of +autoload\syntaxcomplete.vim) to add items. Looking at the output from +":syntax list" while editing a PHP file I can see some of these entries: > htmlArg,htmlTag,htmlTagName,javaScriptStatement,javaScriptGlobalObjects To pick up any JavaScript and HTML keyword syntax groups while editing a PHP -file, you can use 3 different regexs, one for each language. Or you can -simply restrict the include groups to a particular value, without using +file, you can use 3 different regexs, one for each language. Or you can +simply restrict the include groups to a particular value, without using a regex string: > let g:omni_syntax_group_include_php = 'php\w\+,javaScript\w\+,html\w\+' let g:omni_syntax_group_include_php = 'phpFunctions,phpMethods' @@ -1519,9 +1554,9 @@ highlight. These items will be available within the omni completion list. Some people may find this list unwieldy or are only interested in certain items. There are two ways to prune this list (if necessary). If you find -certain syntax groups you do not wish displayed you can use two different -methods to identify these groups. The first specifically lists the syntax -groups by name. The second uses a regular expression to identify both +certain syntax groups you do not wish displayed you can use two different +methods to identify these groups. The first specifically lists the syntax +groups by name. The second uses a regular expression to identify both syntax groups. Simply add one the following to your vimrc: > let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant' let g:omni_syntax_group_exclude_php = 'php\w*Constant' @@ -1544,22 +1579,22 @@ vimrc: > For plugin developers, the plugin exposes a public function OmniSyntaxList. This function can be used to request a List of syntax items. When editing a -SQL file (:e syntax.sql) you can use the ":syntax list" command to see the +SQL file (:e syntax.sql) you can use the ":syntax list" command to see the various groups and syntax items. For example: > - syntax list - -Yields data similar to this: > - sqlOperator xxx some prior all like and any escape exists in is not - or intersect minus between distinct - links to Operator - sqlType xxx varbit varchar nvarchar bigint int uniqueidentifier - date money long tinyint unsigned xml text smalldate - double datetime nchar smallint numeric time bit char - varbinary binary smallmoney - image float integer timestamp real decimal + syntax list + +Yields data similar to this: + sqlOperator xxx some prior all like and any escape exists in is not ~ + or intersect minus between distinct ~ + links to Operator ~ + sqlType xxx varbit varchar nvarchar bigint int uniqueidentifier ~ + date money long tinyint unsigned xml text smalldate ~ + double datetime nchar smallint numeric time bit char ~ + varbinary binary smallmoney ~ + image float integer timestamp real decimal ~ There are two syntax groups listed here: sqlOperator and sqlType. To retrieve -a List of syntax items you can call OmniSyntaxList a number of different +a List of syntax items you can call OmniSyntaxList a number of different ways. To retrieve all syntax items regardless of syntax group: > echo OmniSyntaxList( [] ) @@ -1576,7 +1611,6 @@ From within a plugin, you would typically assign the output to a List: > let myKeywords = [] let myKeywords = OmniSyntaxList( ['sqlKeyword'] ) - SQL *ft-sql-omni* @@ -1843,8 +1877,6 @@ NOTE: These commands cannot be used with |:global| or |:vglobal|. or script is finished. This command does not work from |:normal|. {not in Vi} - {not available when compiled without the |+ex_extra| - feature} *:stopi* *:stopinsert* :stopi[nsert] Stop Insert mode as soon as possible. Works like @@ -1862,15 +1894,11 @@ NOTE: These commands cannot be used with |:global| or |:vglobal|. script that the replacement will only start after the function or script is finished. {not in Vi} - {not available when compiled without the |+ex_extra| - feature} *:startgreplace* :startg[replace][!] Just like |:startreplace|, but use Virtual Replace mode, like with |gR|. {not in Vi} - {not available when compiled without the |+ex_extra| - feature} ============================================================================== 10. Inserting a file *inserting-file* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index a03079c798..f4fdd41e6e 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -1,4 +1,4 @@ -*intro.txt* For Vim version 7.4. Last change: 2014 May 24 +*intro.txt* For Vim version 8.1. Last change: 2018 Jan 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -96,21 +96,18 @@ mention that. *mail-list* *maillist* There are several mailing lists for Vim: -<vim@vim.org> +<vim@vim.org> *vim-use* *vim_use* For discussions about using existing versions of Vim: Useful mappings, questions, answers, where to get a specific version, etc. There are quite a few people watching this list and answering questions, also for beginners. Don't hesitate to ask your question here. -<vim-dev@vim.org> *vim-dev* *vimdev* +<vim-dev@vim.org> *vim-dev* *vim_dev* *vimdev* For discussions about changing Vim: New features, porting, patches, beta-test versions, etc. -<vim-announce@vim.org> *vim-announce* +<vim-announce@vim.org> *vim-announce* *vim_announce* Announcements about new versions of Vim; also for beta-test versions and ports to different systems. This is a read-only list. -<vim-multibyte@vim.org> *vim-multibyte* - For discussions about using and improving the multi-byte aspects of - Vim. -<vim-mac@vim.org> *vim-mac* +<vim-mac@vim.org> *vim-mac* *vim_mac* For discussions about using and improving the Macintosh version of Vim. @@ -135,10 +132,14 @@ http://www.vim.org/maillist.php Bug reports: *bugs* *bug-reports* *bugreport.vim* -Send bug reports to: Vim Developers <vim_dev@vim.org> -This is a maillist, you need to become a member first and many people will see -the message. If you don't want that, e.g. because it is a security issue, -send it to <bugs@vim.org>, this only goes to the Vim maintainer (that's Bram). +There are two ways to report bugs, both work: +1. Send bug reports to: Vim Developers <vim-dev@vim.org> + This is a maillist, you need to become a member first and many people will + see the message. If you don't want that, e.g. because it is a security + issue, send it to <bugs@vim.org>, this only goes to the Vim maintainer + (that's Bram). +2. Open an issue on GitHub: https://github.com/vim/vim/issues + The text will be forwarded to the vim-dev maillist. Please be brief; all the time that is spent on answering mail is subtracted from the time that is spent on improving Vim! Always give a reproducible diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 3ac8e5db9d..18b61df001 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Jun 02 +*map.txt* For Vim version 8.1. Last change: 2018 May 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -29,7 +29,7 @@ manual. 1. Key mapping *key-mapping* *mapping* *macro* Key mapping is used to change the meaning of typed keys. The most common use -is to define a sequence commands for a function key. Example: > +is to define a sequence of commands for a function key. Example: > :map <F2> a<C-R>=strftime("%c")<CR><Esc> @@ -55,6 +55,7 @@ modes. :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* :lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* +:tma[p] {lhs} {rhs} |mapmode-t| *:tma* *:tmap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. The result, including {rhs}, is then further scanned for mappings. This @@ -71,6 +72,7 @@ modes. :ino[remap] {lhs} {rhs} |mapmode-i| *:ino* *:inoremap* :ln[oremap] {lhs} {rhs} |mapmode-l| *:ln* *:lnoremap* :cno[remap] {lhs} {rhs} |mapmode-c| *:cno* *:cnoremap* +:tno[remap] {lhs} {rhs} |mapmode-t| *:tno* *:tnoremap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often @@ -87,6 +89,7 @@ modes. :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* :cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* +:tunma[p] {lhs} |mapmode-t| *:tunma* *:tunmap* Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. @@ -105,6 +108,7 @@ modes. :imapc[lear] |mapmode-i| *:imapc* *:imapclear* :lmapc[lear] |mapmode-l| *:lmapc* *:lmapclear* :cmapc[lear] |mapmode-c| *:cmapc* *:cmapclear* +:tmapc[lear] |mapmode-t| *:tmapc* *:tmapclear* Remove ALL mappings for the modes where the map command applies. {not in Vi} Use the <buffer> argument to remove buffer-local @@ -121,6 +125,7 @@ modes. :im[ap] |mapmode-i| :lm[ap] |mapmode-l| :cm[ap] |mapmode-c| +:tma[p] |mapmode-t| List all key mappings for the modes where the map command applies. Note that ":map" and ":map!" are used most often, because they include the other modes. @@ -135,6 +140,7 @@ modes. :im[ap] {lhs} |mapmode-i| *:imap_l* :lm[ap] {lhs} |mapmode-l| *:lmap_l* :cm[ap] {lhs} |mapmode-c| *:cmap_l* +:tma[p] {lhs} |mapmode-t| *:tmap_l* List the key mappings for the key sequences starting with {lhs} in the modes where the map command applies. {not in Vi} @@ -185,7 +191,7 @@ that starts with ",". Then you need to type another character for Vim to know whether to use the "," mapping or the longer one. To avoid this add the <nowait> argument. Then the mapping will be used when it matches, Vim does not wait for more characters to be typed. However, if the characters were -already type they are used. +already typed they are used. *:map-<silent>* *:map-silent* To define a mapping which will not be echoed on the command line, add @@ -318,6 +324,7 @@ Overview of which map command works in which mode. More details below. :imap :inoremap :iunmap Insert :lmap :lnoremap :lunmap Insert, Command-line, Lang-Arg :cmap :cnoremap :cunmap Command-line +:tmap :tnoremap :tunmap Terminal-Job COMMANDS MODES ~ @@ -358,6 +365,10 @@ Therefore the ":map" and ":map!" commands enter and display mappings for several modes. In Vim you can use the ":nmap", ":vmap", ":omap", ":cmap" and ":imap" commands to enter mappings for each mode separately. + *mapmode-t* +The terminal mappings are used in a terminal window, when typing keys for the +job running in the terminal. See |terminal-typing|. + *omap-info* Operator-pending mappings can be used to define a movement command that can be used with any operator. Simple example: ":omap { w" makes "y{" work like "yw" @@ -418,6 +429,7 @@ When listing mappings the characters in the first two columns are: i Insert l ":lmap" mappings for Insert, Command-line and Lang-Arg c Command-line + t Terminal-Job Just before the {rhs} a special character can appear: * indicates that it is not remappable @@ -431,6 +443,9 @@ with a space. Note: When using mappings for Visual mode, you can use the "'<" mark, which is the start of the last selected Visual area in the current buffer |'<|. +The |:filter| command can be used to select what mappings to list. The +pattern is matched against the {lhs} and {rhs} in the raw form. + *:map-verbose* When 'verbose' is non-zero, listing a key map will also display where it was last defined. Example: > @@ -483,7 +498,7 @@ internal code is written to the script file. 1.6 SPECIAL CHARACTERS *:map-special-chars* - *map_backslash* + *map_backslash* *map-backslash* Note that only CTRL-V is mentioned here as a special character for mappings and abbreviations. When 'cpoptions' does not contain 'B', a backslash can also be used like CTRL-V. The <> notation can be fully used then |<>|. But @@ -494,21 +509,21 @@ To map a backslash, or use a backslash literally in the {rhs}, the special sequence "<Bslash>" can be used. This avoids the need to double backslashes when using nested mappings. - *map_CTRL-C* + *map_CTRL-C* *map-CTRL-C* Using CTRL-C in the {lhs} is possible, but it will only work when Vim is waiting for a key, not when Vim is busy with something. When Vim is busy CTRL-C interrupts/breaks the command. When using the GUI version on MS-Windows CTRL-C can be mapped to allow a Copy command to the clipboard. Use CTRL-Break to interrupt Vim. - *map_space_in_lhs* + *map_space_in_lhs* *map-space_in_lhs* To include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for each space). - *map_space_in_rhs* + *map_space_in_rhs* *map-space_in_rhs* If you want a {rhs} that starts with a space, use "<Space>". To be fully Vi compatible (but unreadable) don't use the |<>| notation, precede {rhs} with a single CTRL-V (you have to type CTRL-V two times). - *map_empty_rhs* + *map_empty_rhs* *map-empty-rhs* You can create an empty {rhs} by typing nothing after a single CTRL-V (you have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc file. @@ -527,9 +542,9 @@ scenario: > :imap <M-C> foo :set encoding=utf-8 The mapping for <M-C> is defined with the latin1 encoding, resulting in a 0xc3 -byte. If you type the character (0xe1 <M-a>) in UTF-8 encoding this is the +byte. If you type the character á (0xe1 <M-a>) in UTF-8 encoding this is the two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then or -otherwise it would be impossible to type the character. +otherwise it would be impossible to type the á character. *<Leader>* *mapleader* To define a mapping which uses the "mapleader" variable, the special string @@ -581,9 +596,10 @@ Upper and lowercase differences are ignored. *map-comments* It is not possible to put a comment after these commands, because the '"' -character is considered to be part of the {lhs} or {rhs}. +character is considered to be part of the {lhs} or {rhs}. However, one can +use |", since this starts a new, empty command with a comment. - *map_bar* + *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next command, you will have to do something special to include a '|' in {rhs}. There are three methods: @@ -601,7 +617,7 @@ When 'b' is present in 'cpoptions', "\|" will be recognized as a mapping ending in a '\' and then another command. This is Vi compatible, but illogical when compared to other commands. - *map_return* + *map_return* *map-return* When you have a mapping that contains an Ex command, you need to put a line terminator after it to have it executed. The use of <CR> is recommended for this (see |<>|). Example: > @@ -678,7 +694,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If you type slowly, or your system is slow, reset the 'timeout' option. Then you might want to set the 'ttimeout' option. - *map-precedence* + *map-precedence* Buffer-local mappings (defined using |:map-<buffer>|) take precedence over global mappings. When a buffer-local mapping is the same as a global mapping, Vim will use the buffer-local mapping. In addition, Vim will use a complete @@ -794,7 +810,7 @@ Bear in mind that convert-meta has been reported to have troubles when used in UTF-8 locales. On terminals like xterm, the "metaSendsEscape" resource can be toggled on the fly through the "Main Options" menu, by pressing Ctrl-LeftClick on the terminal; that's a good last resource in case you want to send ESC when -using other applications but not when inside VIM. +using other applications but not when inside Vim. 1.11 MAPPING AN OPERATOR *:map-operator* @@ -901,7 +917,9 @@ an additional rule: full-id In front of the match is a non-keyword character, or this is where the line or insertion starts. Exception: When the abbreviation is only one character, it is not recognized if there is a non-keyword - character in front of it, other than a space or a tab. + character in front of it, other than a space or a tab. However, for + the command line "'<,'>" (or any other marks) is ignored, as if the + command line starts after it. end-id In front of the match is a keyword character, or a space or a tab, or this is where the line or insertion starts. @@ -923,9 +941,11 @@ Examples: ({CURSOR} is where you type a non-keyword character) > < "test;;" is not expanded "test ;;" is expanded to "test <endofline>" -To avoid the abbreviation in insert mode: Type part of the abbreviation, exit -insert mode with <Esc>, re-enter insert mode with "a" and type the rest. Or -type CTRL-V before the character after the abbreviation. +To avoid the abbreviation in Insert mode: Type CTRL-V before the character +that would trigger the abbreviation. E.g. CTRL-V <Space>. Or type part of +the abbreviation, exit insert mode with <Esc>, re-enter insert mode with "a" +and type the rest. + To avoid the abbreviation in Command-line mode: Type CTRL-V twice somewhere in the abbreviation to avoid it to be replaced. A CTRL-V in front of a normal character is mostly ignored otherwise. @@ -1175,6 +1195,10 @@ scripts. " Command has the -register attribute b Command is local to current buffer (see below for details on attributes) + The list can be filtered on command name with + |:filter|, e.g., to list all commands with "Pyth" in + the name: > + filter Pyth command :com[mand] {cmd} List the user-defined commands that start with {cmd} @@ -1250,6 +1274,7 @@ By default, the arguments of user defined commands do not undergo completion. However, by specifying one or the other of the following attributes, argument completion can be enabled: + -complete=arglist file names in argument list -complete=augroup autocmd groups -complete=buffer buffer names -complete=behave :behave suboptions @@ -1269,9 +1294,12 @@ completion can be enabled: -complete=highlight highlight groups -complete=history :history suboptions -complete=locale locale names (as output of locale -a) + -complete=mapclear buffer argument -complete=mapping mapping name -complete=menu menus + -complete=messages |:messages| suboptions -complete=option options + -complete=packadd optional package |pack-add| names -complete=shellcmd Shell command -complete=sign |:sign| suboptions -complete=syntax syntax file names |'syntax'| @@ -1283,6 +1311,8 @@ completion can be enabled: -complete=custom,{func} custom completion, defined via {func} -complete=customlist,{func} custom completion, defined via {func} +Note: That some completion methods might expand environment variables. + Custom completion *:command-completion-custom* *:command-completion-customlist* @@ -1354,6 +1384,19 @@ Possible attributes are: Note that -range=N and -count=N are mutually exclusive - only one should be specified. + *:command-addr* +It is possible that the special characters in the range like ., $ or % which +by default correspond to the current line, last line and the whole buffer, +relate to arguments, (loaded) buffers, windows or tab pages. + +Possible values are: + -addr=lines Range of lines (this is the default) + -addr=arguments Range for arguments + -addr=buffers Range for buffers (also not loaded buffers) + -addr=loaded_buffers Range for loaded buffers + -addr=windows Range for windows + -addr=tabs Range for tab pages + Special cases *:command-bang* *:command-bar* *:command-register* *:command-buffer* There are some special cases as well: @@ -1387,6 +1430,8 @@ The valid escape sequences are <line1> The starting line of the command range. *<line2>* <line2> The final line of the command range. + *<range>* + <range> The number of items in the command range: 0, 1 or 2 *<count>* <count> Any count supplied (as described for the '-range' and '-count' attributes). @@ -1394,6 +1439,29 @@ 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|, |:leftabove|, + |:lockmarks|, |:noswapfile| |:rightbelow|, |:silent|, |:tab|, + |:topleft|, |:verbose|, and |:vertical|. + Note that these are not yet supported: |:noautocmd|, + |:sandbox| and |:unsilent|. + 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> diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 87ae8777c2..e949ca6756 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -1,4 +1,4 @@ -*mbyte.txt* For Vim version 7.4. Last change: 2013 May 18 +*mbyte.txt* For Vim version 8.1. Last change: 2018 Jan 21 VIM REFERENCE MANUAL by Bram Moolenaar et al. @@ -26,8 +26,9 @@ For changing the language of messages and menus see |mlang.txt|. 7. Input on X11 |mbyte-XIM| 8. Input on MS-Windows |mbyte-IME| 9. Input with a keymap |mbyte-keymap| -10. Using UTF-8 |mbyte-utf8| -11. Overview of options |mbyte-options| +10. Input with imactivatefunc() |mbyte-func| +11. Using UTF-8 |mbyte-utf8| +12. Overview of options |mbyte-options| NOTE: This file contains UTF-8 characters. These may show up as strange characters or boxes when using another encoding. @@ -1010,6 +1011,7 @@ text, you can use the 'keymap' option. This will translate one or more (English) characters to another (non-English) character. This only happens when typing text, not when typing Vim commands. This avoids having to switch between two keyboard settings. +{only available when compiled with the |+keymap| feature} The value of the 'keymap' option specifies a keymap file to use. The name of this file is one of these two: @@ -1250,7 +1252,35 @@ Combining forms: ﭏ 0xfb4f Xal alef-lamed ============================================================================== -10. Using UTF-8 *mbyte-utf8* *UTF-8* *utf-8* *utf8* +10. Input with imactivatefunc() *mbyte-func* + +Vim has the 'imactivatefunc' and 'imstatusfunc' options. These are useful to +activate/deactivate the input method from Vim in any way, also with an external +command. For example, fcitx provide fcitx-remote command: > + + set iminsert=2 + set imsearch=2 + set imcmdline + + set imactivatefunc=ImActivate + function! ImActivate(active) + if a:active + call system('fcitx-remote -o') + else + call system('fcitx-remote -c') + endif + endfunction + + set imstatusfunc=ImStatus + function! ImStatus() + return system('fcitx-remote')[0] is# '2' + endfunction + +Using this script, you can activate/deactivate XIM via Vim even when it is not +compiled with |+xim|. + +============================================================================== +11. Using UTF-8 *mbyte-utf8* *UTF-8* *utf-8* *utf8* *Unicode* *unicode* The Unicode character set was designed to include all characters from other character sets. Therefore it is possible to write text in any language using @@ -1398,7 +1428,7 @@ not everybody is able to type a composing character. ============================================================================== -11. Overview of options *mbyte-options* +12. Overview of options *mbyte-options* These options are relevant for editing multi-byte files. Check the help in options.txt for detailed information. diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 84afe2f2b1..cdd50f6b95 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 7.4. Last change: 2013 Feb 23 +*message.txt* For Vim version 8.1. Last change: 2018 Feb 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,6 +19,15 @@ The ":messages" command can be used to view previously given messages. This is especially useful when messages have been overwritten or truncated. This depends on the 'shortmess' option. + :messages Show all messages. + + :{count}messages Show the {count} most recent messages. + + :messages clear Clear all messages. + + :{count}messages clear Clear messages, keeping only the {count} most + recent ones. + The number of remembered messages is fixed at 20 for the tiny version and 200 for other versions. @@ -30,6 +39,7 @@ back. Note: If the output has been stopped with "q" at the more prompt, it will only be displayed up to this point. The previous command output is cleared when another command produces output. +The "g<" output is not redirected. If you are using translated messages, the first printed line tells who maintains the messages or the translations. You can use this to contact the @@ -58,14 +68,15 @@ If you are lazy, it also works without the shift key: > When an error message is displayed, but it is removed before you could read it, you can see it again with: > :echo errmsg -or view a list of recent messages with: > +Or view a list of recent messages with: > :messages +See `:messages` above. LIST OF MESSAGES *E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317* *E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322* - *E323* *E341* *E473* *E570* *E685* > + *E323* *E341* *E473* *E570* *E685* *E950* > Add to read buffer makemap: Illegal mode Cannot create BalloonEval with both message and callback @@ -86,6 +97,7 @@ LIST OF MESSAGES Internal error Internal error: {function} fatal error in cs_manage_matches + Invalid count for del_bytes(): {N} This is an internal error. If you can reproduce it, please send in a bug report. |bugs| @@ -118,8 +130,9 @@ closed properly. Mostly harmless. Command too recursive This happens when an Ex command executes an Ex command that executes an Ex -command, etc. This is only allowed 200 times. When it's more there probably -is an endless loop. Probably a |:execute| or |:source| command is involved. +command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is +larger. When it's more there probably is an endless loop. Probably a +|:execute| or |:source| command is involved. *E254* > Cannot allocate color {name} @@ -476,8 +489,6 @@ in memory, you can reduce that with these options: helps for a change that affects all lines. - 'undoreload' Set to zero to disable. -Also see |msdos-limitations|. - *E339* > Pattern too long @@ -635,6 +646,9 @@ starts. It can be fixed in one of these ways: - Just write the file again the next day. Or set your clock to the next day, write the file twice and set the clock back. +If you get W11 all the time, you may need to disable "Acronis Active +Protection" or register Vim as a trusted service/application. + *W12* > Warning: File "{filename}" has changed and the buffer was changed in Vim as well @@ -665,6 +679,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 happen 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 @@ -752,6 +772,13 @@ Example: > You tried to execute a command that is neither an Ex command nor a user-defined command. + *E943* > + Command table needs to be updated, run 'make cmdidxs' + +This can only happen when changing the source code, when adding a command in +src/ex_cmds.h. The lookup table then needs to be updated, by running: > + make cmdidxs + ============================================================================== 3. Messages *messages* diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index eb95660d00..3d590e0e06 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -1,4 +1,4 @@ -*mlang.txt* For Vim version 7.4. Last change: 2012 Jan 15 +*mlang.txt* For Vim version 8.1. Last change: 2018 May 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -97,13 +97,15 @@ If you used the self-installing .exe file, message translations should work already. Otherwise get the libintl.dll file if you don't have it yet: http://sourceforge.net/projects/gettext +Or: + https://mlocati.github.io/gettext-iconv-windows/ This also contains tools xgettext, msgformat and others. libintl.dll should be placed in same directory with (g)vim.exe, or some -place where PATH environment value describe. Message files (vim.mo) -have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the -abbreviation of the language (mostly two letters). +place where PATH environment value describe. Vim also finds libintl-8.dll. +Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", +where "xx" is the abbreviation of the language (mostly two letters). If you write your own translations you need to generate the .po file and convert it to a .mo file. You need to get the source distribution and read @@ -177,6 +179,7 @@ Send an e-mail to the Vim maintainer <maintainer@vim.org>. special characters like "&" and "<Tab>" need to be included. Spaces and dots need to be escaped with a backslash, just like in other |:menu| commands. + Case in {english} is ignored. See the $VIMRUNTIME/lang directory for examples. @@ -187,8 +190,8 @@ you can do it without restarting Vim: > :source $VIMRUNTIME/menu.vim Each part of a menu path is translated separately. The result is that when -"Help" is translated to "Hilfe" and "Overview" to "berblick" then -"Help.Overview" will be translated to "Hilfe.berblick". +"Help" is translated to "Hilfe" and "Overview" to "Überblick" then +"Help.Overview" will be translated to "Hilfe.Überblick". ============================================================================== 3. Scripts *multilang-scripts* diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index eaa2d8df35..c0d249253a 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 7.4. Last change: 2014 Feb 11 +*motion.txt* For Vim version 8.1. Last change: 2017 Oct 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -172,6 +172,8 @@ CTRL-H or *CTRL-H* *<BS>* l or *l* <Right> or *<Right>* *<Space>* <Space> [count] characters to the right. |exclusive| motion. + See the 'whichwrap' option for adjusting the behavior + at end of line *0* 0 To the first character of the line. |exclusive| @@ -191,7 +193,7 @@ l or *l* *$* *<End>* *<kEnd>* $ or <End> To the end of the line. When a count is given also go - [count - 1] lines downward |inclusive|. + [count - 1] lines downward. |inclusive| motion. In Visual mode the cursor goes to just after the last character in the line. When 'virtualedit' is active, "$" may move the cursor @@ -584,7 +586,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 @@ -592,7 +594,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 |[(|). @@ -913,6 +915,7 @@ was made yet in the current file. then the position can be near the end of what the command changed. For example when inserting a word, the position will be on the last character. + To jump to older changes use |g;|. {not in Vi} *'(* *`(* @@ -1025,7 +1028,8 @@ unless the line containing that position was changed or deleted. *CTRL-O* CTRL-O Go to [count] Older cursor position in jump list - (not a motion command). {not in Vi} + (not a motion command). + {not in Vi} {not available without the |+jumplist| feature} <Tab> or *CTRL-I* *<Tab>* @@ -1035,8 +1039,14 @@ CTRL-I Go to [count] newer cursor position in jump list {not available without the |+jumplist| feature} *:ju* *:jumps* -:ju[mps] Print the jump list (not a motion command). {not in - Vi} {not available without the |+jumplist| feature} +:ju[mps] Print the jump list (not a motion command). + {not in Vi} + {not available without the |+jumplist| feature} + + *:cle* *:clearjumps* +:cle[arjumps] Clear the jump list of the current window. + {not in Vi} + {not available without the |+jumplist| feature} *jumplist* Jumps are remembered in a jump list. With the CTRL-O and CTRL-I command you diff --git a/runtime/doc/netbeans.txt b/runtime/doc/netbeans.txt index e0ac2bf82a..4eadc8596a 100644 --- a/runtime/doc/netbeans.txt +++ b/runtime/doc/netbeans.txt @@ -1,10 +1,10 @@ -*netbeans.txt* For Vim version 7.4. Last change: 2012 Jan 26 +*netbeans.txt* For Vim version 8.1. Last change: 2016 Jul 15 VIM REFERENCE MANUAL by Gordon Prieur et al. - *socket-interface* *netbeans* *netbeans-support* + *netbeans* *netbeans-support* Vim NetBeans Protocol: a socket interface for Vim integration into an IDE. @@ -59,6 +59,8 @@ Current projects using the NetBeans protocol of Vim are: Check the specific project pages to see how to use Vim with these projects. +An alternative is to use a channel, see |channel|. + In the rest of this help page, we will use the term "Vim Controller" to describe the program controlling Vim through the NetBeans socket interface. @@ -194,6 +196,8 @@ There are two different ways to run Vim in NetBeans mode: + an IDE may start Vim with the |-nb| command line argument + NetBeans can be started from within Vim with the |:nbstart| command +Vim uses a 3 second timeout on trying to make the connection. + *netbeans-parameters* Three forms can be used to setup the NetBeans connection parameters. When started from the command line, the |-nb| command line argument may be: @@ -306,7 +310,12 @@ bufID Buffer number. A message may be either for a specific buffer or generic. Generic messages use a bufID of zero. NOTE: this buffer ID is assigned by the IDE, it is not Vim's buffer number. The bufID must be a sequentially rising number, - starting at one. + starting at one. When the 'switchbuf' option is set to + "usetab" and the "bufID" buffer is not found in the current + tab page, the netbeans commands and functions that set this + buffer as the current buffer will jump to the first open + window that contains this buffer in other tab pages instead of + replacing the buffer in the current window. seqno The IDE uses a sequence number for Commands and Functions. A Reply must use the sequence number of the Function that it is @@ -470,7 +479,7 @@ raise Bring the editor to the foreground. New in version 2.1. removeAnno serNum - Remove a previously place annotation for this buffer. + Remove a previously placed annotation for this buffer. "serNum" is the same number used in addAnno. save Save the buffer when it was modified. The other side of the @@ -818,9 +827,9 @@ REJECT Not used. 6.7 Protocol errors *nb-protocol_errors* These errors occur when a message violates the protocol: -*E627* *E628* *E629* *E630* *E631* *E632* *E633* *E634* *E635* *E636* +*E627* *E628* *E629* *E632* *E633* *E634* *E635* *E636* *E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646* -*E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654* +*E647* *E648* *E649* *E650* *E651* *E652* ============================================================================== diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 2ca782978d..c7aebfac0f 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Jul 23 +*options.txt* For Vim version 8.1. Last change: 2018 May 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10,7 +10,7 @@ Options *options* 2. Automatically setting options |auto-setting| 3. Options summary |option-summary| -For an overview of options see help.txt |option-list|. +For an overview of options see quickref.txt |option-list|. Vim has a number of internal variables and switches which can be set to achieve special effects. These options come in three forms: @@ -50,18 +50,26 @@ achieve special effects. These options come in three forms: :se[t] {option}&vi Reset option to its Vi default value. {not in Vi} :se[t] {option}&vim Reset option to its Vim default value. {not in Vi} -:se[t] all& Set all options, except terminal options, to their - default value. The values of 'term', 'lines' and - 'columns' are not changed. {not in Vi} +:se[t] all& Set all options to their default value. The values of + these options are not changed: + all terminal options, starting with t_ + 'columns' + 'cryptmethod' + 'encoding' + 'key' + 'lines' + 'term' + 'ttymouse' + 'ttytype' + Warning: This may have a lot of side effects. + {not in Vi} *:set-args* *E487* *E521* :se[t] {option}={value} or :se[t] {option}:{value} Set string or number option to {value}. For numeric options the value can be given in decimal, - hex (preceded with 0x) or octal (preceded with '0') - (hex and octal are only available for machines which - have the strtol() function). + hex (preceded with 0x) or octal (preceded with '0'). The old value can be inserted by typing 'wildchar' (by default this is a <Tab> or CTRL-E if 'compatible' is set). See |cmdline-completion|. @@ -234,7 +242,7 @@ opt+=val" the expansion is done before the adding or removing. Handling of local options *local-options* Some of the options only apply to a window or buffer. Each window or buffer -has its own copy of this option, thus can each have their own value. This +has its own copy of this option, thus each can have its own value. This allows you to set 'list' in one window but not in another. And set 'shiftwidth' to 3 in one buffer and 4 in another. @@ -253,10 +261,10 @@ global value, which is used for new buffers. With ":set" both the local and global value is changed. With "setlocal" only the local value is changed, thus this value is not used when editing a new buffer. -When editing a buffer that has been edited before, the last used window -options are used again. If this buffer has been edited in this window, the -values from back then are used. Otherwise the values from the window where -the buffer was edited last are used. +When editing a buffer that has been edited before, the options from the window +that was last closed are used again. If this buffer has been edited in this +window, the values from back then are used. Otherwise the values from the +last closed window where the buffer was edited last are used. It's possible to set a local window option specifically for a type of buffer. When you edit another buffer in the same window, you don't want to keep @@ -362,7 +370,7 @@ Note: In the future more global options can be made global-local. Using Setting the filetype -:setf[iletype] {filetype} *:setf* *:setfiletype* +:setf[iletype] [FALLBACK] {filetype} *:setf* *:setfiletype* Set the 'filetype' option to {filetype}, but only if not done yet in a sequence of (nested) autocommands. This is short for: > @@ -372,6 +380,13 @@ Setting the filetype < This command is used in a filetype.vim file to avoid setting the 'filetype' option twice, causing different settings and syntax files to be loaded. + + When the optional FALLBACK argument is present, a + later :setfiletype command will override the + 'filetype'. This is to used for filetype detections + that are just a guess. |did_filetype()| will return + false after this command. + {not in Vi} *option-window* *optwin* @@ -387,8 +402,8 @@ Setting the filetype used to set the option value in, unless this is a help window, in which case the window below help window is used (skipping the option-window). - {not available when compiled without the |+eval| or - |+autocmd| features} + {not available when compiled without the |+eval| + feature} *$HOME* Using "~" is like using "$HOME", but it is only recognized at the start of an @@ -402,11 +417,22 @@ On Unix systems the form "${HOME}" can be used too. The name between {} can contain non-id characters then. Note that if you want to use this for the "gf" command, you need to add the '{' and '}' characters to 'isfname'. +NOTE: expanding environment variables and "~/" is only done with the ":set" +command, not when assigning a value to an option with ":let". + + *$HOME-windows* On MS-Windows, if $HOME is not defined as an environment variable, then at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH. +If $HOMEDRIVE is not set then $USERPROFILE is used. -NOTE: expanding environment variables and "~/" is only done with the ":set" -command, not when assigning a value to an option with ":let". +This expanded value is not exported to the environment, this matters when +running an external command: > + :echo system('set | findstr ^HOME=') +and > + :echo luaeval('os.getenv("HOME")') +should echo nothing (an empty string) despite exists('$HOME') being true. +When setting $HOME to a non-empty string it will be exported to the +subprocesses. Note the maximum length of an expanded option is limited. How much depends on @@ -538,11 +564,11 @@ number can be specified where "vim:" or "Vim:" is used: vim<{vers}: version before {vers} vim={vers}: version {vers} vim>{vers}: version after {vers} -{vers} is 600 for Vim 6.0 (hundred times the major version plus minor). -For example, to use a modeline only for Vim 6.0 and later: - /* vim600: set foldmethod=marker: */ ~ -To use a modeline for Vim before version 5.7: - /* vim<570: set sw=4: */ ~ +{vers} is 700 for Vim 7.0 (hundred times the major version plus minor). +For example, to use a modeline only for Vim 7.0: + /* vim700: set foldmethod=marker */ ~ +To use a modeline for Vim after version 7.2: + /* vim>702: set cole=2: */ ~ There can be no blanks between "vim" and the ":". @@ -706,7 +732,8 @@ A jump table for the options with a short description can be found at |Q_op|. Vim may set this option automatically at startup time when Vim is compiled with the |+termresponse| feature and if |t_u7| is set to the - escape sequence to request cursor position report. + escape sequence to request cursor position report. The response can + be found in |v:termu7resp|. *'antialias'* *'anti'* *'noantialias'* *'noanti'* 'antialias' 'anti' boolean (default off, on for MacVim) @@ -720,6 +747,7 @@ A jump table for the options with a short description can be found at |Q_op|. Setting this option in the Carbon version can sometimes cause problems if 'guifont' is set to its default (empty string). + NOTE: This option is reset when 'compatible' is set. Support for this option is not flawless in MacVim. In particular, Monaco always seems to render not antialiased for point sizes up @@ -735,8 +763,6 @@ A jump table for the options with a short description can be found at |Q_op|. open a file, switch buffers, delete a buffer or open/close a window. It will change to the directory containing the file which was opened or selected. - This option is provided for backward compatibility with the Vim - released with Sun ONE Studio 4 Enterprise Edition. Note: When this option is on some plugins may not work. *'arabic'* *'arab'* *'noarabic'* *'noarab'* @@ -759,6 +785,7 @@ A jump table for the options with a short description can be found at |Q_op|. - Disable the use of 'keymap' (without changing its value). Note that 'arabicshape' and 'delcombine' are not reset (it is a global option). + NOTE: This option is reset when 'compatible' is set. Also see |arabic.txt|. *'arabicshape'* *'arshape'* @@ -780,6 +807,7 @@ A jump table for the options with a short description can be found at |Q_op|. form. Arabic is a complex language which requires other settings, for further details see |arabic.txt|. + NOTE: This option is set when 'compatible' is set. *'autoindent'* *'ai'* *'noautoindent'* *'noai'* 'autoindent' 'ai' boolean (default off) @@ -795,7 +823,8 @@ A jump table for the options with a short description can be found at |Q_op|. line. When 'smartindent' or 'cindent' is on the indent is changed in a different way. - The 'autoindent' option is reset when the 'paste' option is set. + The 'autoindent' option is reset when the 'paste' option is set and + restored when 'paste' is reset. {small difference from Vi: After the indent is deleted when typing <Esc> or <CR>, the cursor position when moving up or down is after the deleted indent; Vi puts the cursor somewhere in the deleted indent}. @@ -857,6 +886,13 @@ A jump table for the options with a short description can be found at |Q_op|. < Vim will guess the value. In the GUI this should work correctly, in other cases Vim might not be able to guess the right value. + When the |t_RB| option is set, Vim will use it to request the background + color from the terminal. If the returned RGB value is dark/light and + 'background' is not dark/light, 'background' will be set and the + screen is redrawn. This may have side effects, make t_BG empty in + your .vimrc if you suspect this problem. The response to |t_RB| can + be found in |v:termrbgresp|. + When starting the GUI, the default value for 'background' will be "light". When the value is not set in the .gvimrc, and Vim detects that the background is actually quite dark, 'background' is set to @@ -871,6 +907,10 @@ A jump table for the options with a short description can be found at |Q_op|. "screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark background. Otherwise the default is "light". + The |:terminal| command and the |term_start()| function use the + 'background' value to decide whether the terminal window will start + with a white or black background. + Normally this option would be set in the .vimrc file. Possibly depending on the terminal name. Example: > :if &term == "pcterm" @@ -885,7 +925,8 @@ A jump table for the options with a short description can be found at |Q_op|. done with ":syntax on". *'backspace'* *'bs'* -'backspace' 'bs' string (default "") +'backspace' 'bs' string (default "", set to "indent,eol,start" + in |defaults.vim|) global {not in Vi} Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert @@ -926,7 +967,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'backupcopy'* *'bkc'* 'backupcopy' 'bkc' string (Vi default for Unix: "yes", otherwise: "auto") - global + global or local to buffer |global-local| {not in Vi} When writing a file and a backup is made, this option tells how it's done. This is a comma separated list of words. @@ -990,6 +1031,9 @@ A jump table for the options with a short description can be found at |Q_op|. the system may refuse to do this. In that case the "auto" value will again not rename the file. + NOTE: This option is set to the Vi default value when 'compatible' is + set and to the Vim default value when 'compatible' is reset. + *'backupdir'* *'bdir'* 'backupdir' 'bdir' string (default for Amiga: ".,t:", for MS-DOS and Win32: ".,$TEMP,c:/tmp,c:/temp" @@ -1000,7 +1044,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. @@ -1048,7 +1092,9 @@ A jump table for the options with a short description can be found at |Q_op|. < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* -'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") +'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*" + Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") global {not in Vi} {not available when compiled without the |+wildignore| @@ -1068,7 +1114,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note that environment variables are not expanded. If you want to use $HOME you must expand it explicitly, e.g.: > - :let backupskip = escape(expand('$HOME'), '\') . '/tmp/*' + :let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*' < Note that the default also makes sure that "crontab -e" works (when a backup would be made by renaming the original file crontab won't see @@ -1088,7 +1134,16 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} {only available when compiled with the |+balloon_eval| feature} - Switch on the |balloon-eval| functionality. + Switch on the |balloon-eval| functionality for the GUI. + + *'balloonevalterm'* *'bevalterm'* *'noballoonevalterm'* + *'nobevalterm'* +'balloonevalterm' 'bevalterm' boolean (default off) + global + {not in Vi} + {only available when compiled with the + |+balloon_eval_term| feature} + Switch on the |balloon-eval| functionality for the terminal. *'balloonexpr'* *'bexpr'* 'balloonexpr' 'bexpr' string (default "") @@ -1101,6 +1156,7 @@ A jump table for the options with a short description can be found at |Q_op|. v:beval_bufnr number of the buffer in which balloon is going to show v:beval_winnr number of the window + v:beval_winid ID of the window v:beval_lnum line number v:beval_col column number (byte index) v:beval_text word under or after the mouse pointer @@ -1116,6 +1172,9 @@ A jump table for the options with a short description can be found at |Q_op|. set bexpr=MyBalloonExpr() set ballooneval < + Also see |balloon_show()|, can be used if the content of the balloon + is to be fetched asynchronously. + NOTE: The balloon is displayed only if the cursor is on a text character. If the result of evaluating 'balloonexpr' is not empty, Vim does not try to send a message to an external debugger (Netbeans @@ -1132,6 +1191,48 @@ A jump table for the options with a short description can be found at |Q_op|. < When they are supported "\n" characters will start a new line. If the expression evaluates to a |List| this is equal to using each List item as a string and putting "\n" in between them. + NOTE: This option is set to "" when 'compatible' is set. + + *'belloff'* *'bo'* +'belloff' 'bo' string (default "") + global + {not in Vi} + Specifies for which events the bell will not be rung. It is a comma + separated list of items. For each item that is present, the bell + will be silenced. This is most useful to specify specific events in + insert mode to be silenced. + + item meaning when present ~ + all All events. + backspace When hitting <BS> or <Del> and deleting results in an + error. + cursor Fail to move around using the cursor keys or + <PageUp>/<PageDown> in |Insert-mode|. + complete Error occurred when using |i_CTRL-X_CTRL-K| or + |i_CTRL-X_CTRL-T|. + copy Cannot copy char from insert mode using |i_CTRL-Y| or + |i_CTRL-E|. + ctrlg Unknown Char after <C-G> in Insert mode. + error Other Error occurred (e.g. try to join last line) + (mostly used in |Normal-mode| or |Cmdline-mode|). + esc hitting <Esc> in |Normal-mode|. + ex In |Visual-mode|, hitting |Q| results in an error. + hangul Error occurred when using hangul input. + insertmode Pressing <Esc> in 'insertmode'. + lang Calling the beep module for Lua/Mzscheme/TCL. + mess No output available for |g<|. + showmatch Error occurred for 'showmatch' function. + operator Empty region error |cpo-E|. + register Unknown register after <C-R> in |Insert-mode|. + shell Bell from shell output |:!|. + spell Error happened on spell suggest. + wildmode More matches in |cmdline-completion| available + (depends on the 'wildmode' setting). + + This is most useful to fine tune when in Insert mode the bell should + be rung. For Normal mode and Ex commands, the bell is often rung to + indicate that an error occurred. It can be silenced by adding the + "error" keyword. *'binary'* *'bin'* *'nobinary'* *'nobin'* 'binary' 'bin' boolean (default off) @@ -1168,10 +1269,15 @@ A jump table for the options with a short description can be found at |Q_op|. 'bioskey' 'biosk' boolean (default on) global {not in Vi} {only for MS-DOS} - When on the BIOS is called to obtain a keyboard character. This works - better to detect CTRL-C, but only works for the console. When using a - terminal over a serial port reset this option. - Also see |'conskey'|. + This was for MS-DOS and is no longer supported. + + *'blurradius'* *'blur'* +'blurradius' 'blur' number (default 0) + global + {not in Vi} + {only in MacVim GUI} + When 'transparency' is in effect, a positive value adds a blur effect + to the window background. *'bomb'* *'nobomb'* 'bomb' boolean (default off) @@ -1205,7 +1311,7 @@ A jump table for the options with a short description can be found at |Q_op|. break if 'linebreak' is on. Only works for ASCII and also for 8-bit characters when 'encoding' is an 8-bit encoding. - *'breakindent'* *'bri'* + *'breakindent'* *'bri'* *'nobreakindent'* *'nobri'* 'breakindent' 'bri' boolean (default off) local to window {not in Vi} @@ -1214,6 +1320,7 @@ A jump table for the options with a short description can be found at |Q_op|. Every wrapped line will continue visually indented (same amount of space as the beginning of that line), thus preserving horizontal blocks of text. + NOTE: This option is reset when 'compatible' is set. *'breakindentopt'* *'briopt'* 'breakindentopt' 'briopt' string (default empty) @@ -1233,7 +1340,7 @@ A jump table for the options with a short description can be found at |Q_op|. characters. It permits dynamic French paragraph indentation (negative) or emphasizing the line continuation (positive). - sbr Display the 'showbreak' value before applying the + sbr Display the 'showbreak' value before applying the additional indent. The default value for min is 20 and shift is 0. @@ -1253,8 +1360,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'bufhidden' 'bh' string (default: "") local to buffer {not in Vi} - {not available when compiled without the |+quickfix| - feature} This option specifies what happens when a buffer is no longer displayed in a window: <empty> follow the global 'hidden' option @@ -1289,20 +1394,22 @@ A jump table for the options with a short description can be found at |Q_op|. 'buftype' 'bt' string (default: "") local to buffer {not in Vi} - {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. {not available when compiled without the - |+autocmd| feature} + 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 buffer for a |terminal| (you are not supposed to set + this manually) + prompt buffer where only the last line can be edited, meant + to be used by a plugin, see |prompt-buffer| + {only when compiled with the |+channel| feature} This option is used together with 'bufhidden' and 'swapfile' to specify special kinds of buffers. See |special-buffers|. @@ -1325,6 +1432,9 @@ A jump table for the options with a short description can be found at |Q_op|. nofile only: The buffer name is fixed, it is not handled like a file name. It is not modified in response to a |:cd| command. + both: When using ":e bufname" and already editing "bufname" + the buffer is made empty and autocommands are + triggered as usual for |:edit|. *E676* "acwrite" implies that the buffer name is not related to a file, like "nofile", but it will be written. Thus, in contrast to "nofile" and @@ -1383,10 +1493,12 @@ A jump table for the options with a short description can be found at |Q_op|. Only non-printable keys are allowed. The key can be specified as a single character, but it is difficult to type. The preferred way is to use the <> notation. Examples: > - :set cedit=<C-Y> - :set cedit=<Esc> + :exe "set cedit=\<C-Y>" + :exe "set cedit=\<Esc>" < |Nvi| also has this option, but it only uses the first character. See |cmdwin|. + NOTE: This option is set to the Vim default value when 'compatible' + is reset. *'charconvert'* *'ccv'* *E202* *E214* *E513* 'charconvert' 'ccv' string (default "") @@ -1629,6 +1741,16 @@ A jump table for the options with a short description can be found at |Q_op|. :set columns=9999 < Minimum value is 12, maximum value is 10000. + *'columnspace'* *'csp'* +'columnspace' 'csp' number (default 0) + global + {not in Vi} + {only in the MacVim GUI} + Number of pixel columns inserted between characters. With some fonts + there can be too much room between characters. Then it makes sense + to set 'columnspace' to a negative value. This may cause display + problems though! + *'comments'* *'com'* *E524* *E525* 'comments' 'com' string (default "s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-") @@ -1652,17 +1774,19 @@ A jump table for the options with a short description can be found at |Q_op|. *'compatible'* *'cp'* *'nocompatible'* *'nocp'* 'compatible' 'cp' boolean (default on, off when a |vimrc| or |gvimrc| - file is found) + file is found, reset in |defaults.vim|) global {not in Vi} This option has the effect of making Vim either more Vi-compatible, or make Vim behave in a more useful way. + This is a special kind of option, because when it's set or reset, - other options are also changed as a side effect. CAREFUL: Setting or - resetting this option can have a lot of unexpected effects: Mappings - are interpreted in another way, undo behaves differently, etc. If you - set this option in your vimrc file, you should probably put it at the - very start. + other options are also changed as a side effect. + NOTE: Setting or resetting this option can have a lot of unexpected + effects: Mappings are interpreted in another way, undo behaves + differently, etc. If you set this option in your vimrc file, you + should probably put it at the very start. + By default this option is on and the Vi defaults are used for the options. This default was chosen for those people who want to use Vim just like Vi, and don't even (want to) know about the 'compatible' @@ -1677,69 +1801,98 @@ A jump table for the options with a short description can be found at |Q_op|. |posix-compliance|. You can also set this option with the "-C" argument, and reset it with "-N". See |-C| and |-N|. - Switching this option off makes the Vim defaults be used for options - that have a different Vi and Vim default value. See the options - marked with a '+' below. Other options are not modified. - At the moment this option is set, several other options will be set - or reset to make Vim as Vi-compatible as possible. See the table - below. This can be used if you want to revert to Vi compatible - editing. - See also 'cpoptions'. - - option + set value effect ~ - - 'allowrevins' off no CTRL-_ command - 'backupcopy' Unix: "yes" backup file is a copy - others: "auto" copy or rename backup file - 'backspace' "" normal backspace - 'backup' off no backup file - 'cindent' off no C code indentation - 'cedit' + "" no key to open the |cmdwin| - 'cpoptions' + (all flags) Vi-compatible flags - 'cscopetag' off don't use cscope for ":tag" - 'cscopetagorder' 0 see |cscopetagorder| - 'cscopeverbose' off see |cscopeverbose| - 'digraph' off no digraphs - 'esckeys' + off no <Esc>-keys in Insert mode - 'expandtab' off tabs not expanded to spaces - 'fileformats' + "" no automatic file format detection, + See 'cpoptions' for more fine tuning of Vi compatibility. + + When this option is set, numerous other options are set to make Vim as + Vi-compatible as possible. When this option is unset, various options + are set to make Vim more useful. The table below lists all the + options affected. + The {?} column indicates when the options are affected: + + Means that the option is set to the value given in {set value} when + 'compatible' is set. + & Means that the option is set to the value given in {set value} when + 'compatible' is set AND is set to its Vim default value when + 'compatible' is unset. + - Means the option is NOT changed when setting 'compatible' but IS + set to its Vim default when 'compatible' is unset. + The {effect} column summarises the change when 'compatible' is set. + + option ? set value effect ~ + + 'allowrevins' + off no CTRL-_ command + 'antialias' + off don't use antialiased fonts + 'arabic' + off reset arabic-related options + 'arabicshape' + on correct character shapes + 'backspace' + "" normal backspace + 'backup' + off no backup file + 'backupcopy' & Unix: "yes" backup file is a copy + else: "auto" copy or rename backup file + 'balloonexpr' + "" text to show in evaluation balloon + 'breakindent' + off don't indent when wrapping lines + 'cedit' - {unchanged} {set vim default only on resetting 'cp'} + 'cindent' + off no C code indentation + 'compatible' - {unchanged} {set vim default only on resetting 'cp'} + 'copyindent' + off don't copy indent structure + 'cpoptions' & (all flags) Vi-compatible flags + 'cscopepathcomp'+ 0 don't show directories in tags list + 'cscoperelative'+ off don't use basename of path as prefix + 'cscopetag' + off don't use cscope for ":tag" + 'cscopetagorder'+ 0 see |cscopetagorder| + 'cscopeverbose' + off see |cscopeverbose| + 'delcombine' + off unicode: delete whole char combination + 'digraph' + off no digraphs + 'esckeys' & off no <Esc>-keys in Insert mode + 'expandtab' + off tabs not expanded to spaces + 'fileformats' & "" no automatic file format detection, "dos,unix" except for DOS, Windows and OS/2 - 'formatoptions' + "vt" Vi compatible formatting - 'gdefault' off no default 'g' flag for ":s" - 'history' + 0 no commandline history - 'hkmap' off no Hebrew keyboard mapping - 'hkmapp' off no phonetic Hebrew keyboard mapping - 'hlsearch' off no highlighting of search matches - 'incsearch' off no incremental searching - 'indentexpr' "" no indenting by expression - 'insertmode' off do not start in Insert mode - 'iskeyword' + "@,48-57,_" keywords contain alphanumeric + 'formatexpr' + "" use 'formatprg' for auto-formatting + 'formatoptions' & "vt" Vi compatible formatting + 'gdefault' + off no default 'g' flag for ":s" + 'history' & 0 no commandline history + 'hkmap' + off no Hebrew keyboard mapping + 'hkmapp' + off no phonetic Hebrew keyboard mapping + 'hlsearch' + off no highlighting of search matches + 'incsearch' + off no incremental searching + 'indentexpr' + "" no indenting by expression + 'insertmode' + off do not start in Insert mode + 'iskeyword' & "@,48-57,_" keywords contain alphanumeric characters and '_' - 'joinspaces' on insert 2 spaces after period - 'modeline' + off no modelines - 'more' + off no pauses in listings - 'revins' off no reverse insert - 'ruler' off no ruler - 'scrolljump' 1 no jump scroll - 'scrolloff' 0 no scroll offset - 'shiftround' off indent not rounded to shiftwidth - 'shortmess' + "" no shortening of messages - 'showcmd' + off command characters not shown - 'showmode' + off current mode not shown - 'smartcase' off no automatic ignore case switch - 'smartindent' off no smart indentation - 'smarttab' off no smart tab size - 'softtabstop' 0 tabs are always 'tabstop' positions - 'startofline' on goto startofline with some commands - 'tagrelative' + off tag file names are not relative - 'textauto' + off no automatic textmode detection - 'textwidth' 0 no automatic line wrap - 'tildeop' off tilde is not an operator - 'ttimeout' off no terminal timeout - 'whichwrap' + "" left-right movements don't wrap - 'wildchar' + CTRL-E only when the current value is <Tab> + 'joinspaces' + on insert 2 spaces after period + 'modeline' & off no modelines + 'more' & off no pauses in listings + 'mzquantum' - {unchanged} {set vim default only on resetting 'cp'} + 'numberwidth' & 8 min number of columns for line number + 'preserveindent'+ off don't preserve current indent structure + when changing it + 'revins' + off no reverse insert + 'ruler' + off no ruler + 'scrolljump' + 1 no jump scroll + 'scrolloff' + 0 no scroll offset + 'shelltemp' - {unchanged} {set vim default only on resetting 'cp'} + 'shiftround' + off indent not rounded to shiftwidth + 'shortmess' & "" no shortening of messages + 'showcmd' & off command characters not shown + 'showmode' & off current mode not shown + 'sidescrolloff' + 0 cursor moves to edge of screen in scroll + 'smartcase' + off no automatic ignore case switch + 'smartindent' + off no smart indentation + 'smarttab' + off no smart tab size + 'softtabstop' + 0 tabs are always 'tabstop' positions + 'startofline' + on goto startofline with some commands + 'tagcase' & "followic" 'ignorecase' when searching tags file + 'tagrelative' & off tag file names are not relative + 'termguicolors' + off don't use highlight-(guifg|guibg) + 'textauto' & off no automatic textmode detection + 'textwidth' + 0 no automatic line wrap + 'tildeop' + off tilde is not an operator + 'ttimeout' + off no terminal timeout + 'undofile' + off don't use an undo file + 'viminfo' - {unchanged} {set Vim default only on resetting 'cp'} + 'virtualedit' + "" cursor can only be placed on characters + 'whichwrap' & "" left-right movements don't wrap + 'wildchar' & CTRL-E only when the current value is <Tab> use CTRL-E for cmdline completion - 'writebackup' on or off depends on the |+writebackup| feature + 'writebackup' + on or off depends on the |+writebackup| feature *'complete'* *'cpt'* *E535* 'complete' 'cpt' string (default: ".,w,b,u,t,i") @@ -1749,7 +1902,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 @@ -1825,6 +1978,14 @@ A jump table for the options with a short description can be found at |Q_op|. completion in the preview window. Only works in combination with "menu" or "menuone". + noinsert Do not insert any text for a match until the user selects + a match from the menu. Only works in combination with + "menu" or "menuone". No effect if "longest" is present. + + noselect Do not select a match in the menu, force the user to + select one from the menu. Only works in combination with + "menu" or "menuone". + *'concealcursor'* *'cocu'* 'concealcursor' 'cocu' string (default: "") @@ -1892,13 +2053,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'conskey' 'consk' boolean (default off) global {not in Vi} {only for MS-DOS} - When on direct console I/O is used to obtain a keyboard character. - This should work in most cases. Also see |'bioskey'|. Together, - three methods of console input are available: - 'conskey' 'bioskey' action ~ - on on or off direct console input - off on BIOS - off off STDIN + This was for MS-DOS and is no longer supported. *'copyindent'* *'ci'* *'nocopyindent'* *'noci'* 'copyindent' 'ci' boolean (default off) @@ -1912,10 +2067,10 @@ A jump table for the options with a short description can be found at |Q_op|. existing line. 'expandtab' has no effect on these characters, a Tab remains a Tab. If the new indent is greater than on the existing line, the remaining space is filled in the normal manner. - NOTE: 'copyindent' is reset when 'compatible' is set. + NOTE: This option is reset when 'compatible' is set. Also see 'preserveindent'. - *'cpoptions'* *'cpo'* + *'cpoptions'* *'cpo'* *cpo* 'cpoptions' 'cpo' string (Vim default: "aABceFs", Vi default: all flags) global @@ -1988,7 +2143,7 @@ A jump table for the options with a short description can be found at |Q_op|. *cpo-E* E It is an error when using "y", "d", "c", "g~", "gu" or "gU" on an Empty region. The operators only work when - at least one character is to be operate on. Example: + at least one character is to be operated on. Example: This makes "y0" fail in the first column. *cpo-f* f When included, a ":read" command with a file name @@ -2226,7 +2381,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'cryptmethod'* *'cm'* -'cryptmethod' string (default "zip") +'cryptmethod' 'cm' string (default "zip") global or local to buffer |global-local| {not in Vi} Method used for encryption when the buffer is written to a file: @@ -2234,10 +2389,20 @@ A jump table for the options with a short description can be found at |Q_op|. zip PkZip compatible method. A weak kind of encryption. Backwards compatible with Vim 7.2 and older. *blowfish* - blowfish Blowfish method. Strong encryption. Requires Vim 7.3 - or later, files can NOT be read by Vim 7.2 and older. - This adds a "seed" to the file, every time you write - the file the encrypted bytes will be different. + blowfish Blowfish method. Medium strong encryption but it has + an implementation flaw. Requires Vim 7.3 or later, + files can NOT be read by Vim 7.2 and older. This adds + a "seed" to the file, every time you write the file + the encrypted bytes will be different. + *blowfish2* + blowfish2 Blowfish method. Medium strong encryption. Requires + Vim 7.4.401 or later, files can NOT be read by Vim 7.3 + and older. This adds a "seed" to the file, every time + you write the file the encrypted bytes will be + different. The whole undo file is encrypted, not just + the pieces of text. + + You should use "blowfish2", also to re-encrypt older files. When reading an encrypted file 'cryptmethod' will be set automatically to the detected method of the file being read. Thus if you write it @@ -2263,6 +2428,7 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Determines how many components of the path to show in a list of tags. See |cscopepathcomp|. + NOTE: This option is set to 0 when 'compatible' is set. *'cscopeprg'* *'csprg'* 'cscopeprg' 'csprg' string (default "cscope") @@ -2292,6 +2458,7 @@ A jump table for the options with a short description can be found at |Q_op|. In the absence of a prefix (-P) for cscope. setting this option enables to use the basename of cscope.out path as the prefix. See |cscoperelative|. + NOTE: This option is reset when 'compatible' is set. *'cscopetag'* *'cst'* *'nocscopetag'* *'nocst'* 'cscopetag' 'cst' boolean (default off) @@ -2326,8 +2493,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'cursorbind' 'crb' boolean (default off) local to window {not in Vi} - {not available when compiled without the |+cursorbind| - feature} When this option is set, as the cursor in the current window moves other cursorbound windows (windows that also have this option set) move their cursors to the corresponding line and @@ -2411,6 +2576,7 @@ A jump table for the options with a short description can be found at |Q_op|. This is useful for Arabic, Hebrew and many other languages where one may have combining characters overtop of base characters, and want to remove only the combining ones. + NOTE: This option is reset when 'compatible' is set. *'dictionary'* *'dict'* 'dictionary' 'dict' string (default "") @@ -2421,8 +2587,11 @@ A jump table for the options with a short description can be found at |Q_op|. contain a list of words. This can be one word per line, or several words per line, separated by non-keyword characters (white space is preferred). Maximum line length is 510 bytes. - When this option is empty, or an entry "spell" is present, spell - checking is enabled the currently active spelling is used. |spell| + + When this option is empty or an entry "spell" is present, and spell + checking is enabled, words in the word lists for the currently active + 'spelllang' are used. See |spell|. + To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file name. See |option-backslash| about using backslashes. @@ -2493,6 +2662,9 @@ A jump table for the options with a short description can be found at |Q_op|. vertical Start diff mode with vertical splits (unless explicitly specified otherwise). + hiddenoff Do not use diff mode for a buffer when it + becomes hidden. + foldcolumn:{n} Set the 'foldcolumn' option to {n} when starting diff mode. Without this 2 is used. @@ -2561,17 +2733,24 @@ A jump table for the options with a short description can be found at |Q_op|. {Vi: directory to put temp file in, defaults to "/tmp"} *'display'* *'dy'* -'display' 'dy' string (default "") +'display' 'dy' string (default "", set to "truncate" in + |defaults.vim|) global {not in Vi} 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" nor "truncate" is included, a last line that + doesn't fit is replaced with "@" lines. + *'eadirection'* *'ead'* 'eadirection' 'ead' string (default "both") global @@ -2589,7 +2768,16 @@ A jump table for the options with a short description can be found at |Q_op|. Makes the 'g' and 'c' flags of the ":substitute" command to be toggled each time the flag is given. See |complex-change|. See also 'gdefault' option. - Switching this option on is discouraged! + Switching this option on may break plugins! + + *'emoji'* *'emo'* *'noemoji'* *'noemo'* +'emoji' 'emo' boolean (default: on) + global + {not in Vi} + {only available when compiled with the |+multi_byte| + feature} + When on all Unicode emoji characters are considered to be full width. + *'encoding'* *'enc'* *E543* 'encoding' 'enc' string (default: "latin1" or value from $LANG) @@ -2610,7 +2798,7 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline|. It would most likely corrupt the text. - NOTE: For MacVim and GTK+ 2 it is highly recommended to set 'encoding' + NOTE: For MacVim and GTK+, it is highly recommended to set 'encoding' to "utf-8". Although care has been taken to allow different values of 'encoding', "utf-8" is the natural choice for the environment and avoids unnecessary conversion overhead. "utf-8" has not been made @@ -2661,15 +2849,16 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer {not in Vi} When writing a file and this option is off and the 'binary' option - is on, no <EOL> will be written for the last line in the file. This - option is automatically set when starting to edit a new file, unless - the file does not have an <EOL> for the last line in the file, in - which case it is reset. Normally you don't have to set or reset this - option. When 'binary' is off the value is not used when writing the - file. When 'binary' is on it is used to remember the presence of a - <EOL> for the last line in the file, so that when you write the file - the situation from the original file can be kept. But you can change - it if you want to. + is on, or 'fixeol' option is off, no <EOL> will be written for the + last line in the file. This option is automatically set or reset when + starting to edit a new file, depending on whether file has an <EOL> + for the last line in the file. Normally you don't have to set or + reset this option. + When 'binary' is off and 'fixeol' is on the value is not used when + writing the file. When 'binary' is on or 'fixeol' is off it is used + to remember the presence of a <EOL> for the last line in the file, so + that when you write the file the situation from the original file can + be kept. But you can change it if you want to. *'equalalways'* *'ea'* *'noequalalways'* *'noea'* 'equalalways' 'ea' boolean (default on) @@ -2710,7 +2899,8 @@ A jump table for the options with a short description can be found at |Q_op|. makes a difference for error messages, the bell will be used always for a lot of errors without a message (e.g., hitting <Esc> in Normal mode). See 'visualbell' on how to make the bell behave like a beep, - screen flash or do nothing. + screen flash or do nothing. See 'belloff' to finetune when to ring the + bell. *'errorfile'* *'ef'* 'errorfile' 'ef' string (Amiga default: "AztecC.Err", @@ -2756,8 +2946,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'eventignore' 'ei' string (default "") global {not in Vi} - {not available when compiled without the |+autocmd| - feature} A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. @@ -2772,6 +2960,8 @@ A jump table for the options with a short description can be found at |Q_op|. <Tab>. Spaces are used in indents with the '>' and '<' commands and when 'autoindent' is on. To insert a real tab when 'expandtab' is on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|. + This option is reset when the 'paste' option is set and restored when + the 'paste' option is reset. NOTE: This option is reset when 'compatible' is set. *'exrc'* *'ex'* *'noexrc'* *'noex'* @@ -2779,10 +2969,17 @@ A jump table for the options with a short description can be found at |Q_op|. global {not in Vi} Enables the reading of .vimrc, .exrc and .gvimrc in the current - directory. If you switch this option on you should also consider - setting the 'secure' option (see |initialization|). Using a local - .exrc, .vimrc or .gvimrc is a potential security leak, use with care! - also see |.vimrc| and |gui-init|. + directory. + + Setting this option is a potential security leak. E.g., consider + unpacking a package or fetching files from github, a .vimrc in there + might be a trojan horse. BETTER NOT SET THIS OPTION! + Instead, define an autocommand in your .vimrc to set options for a + matching directory. + + If you do switch this option on you should also consider setting the + 'secure' option (see |initialization|). + Also see |.vimrc| and |gui-init|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -2798,6 +2995,8 @@ A jump table for the options with a short description can be found at |Q_op|. 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). + No error will be given when the value is set, only when it is used, + only when 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. @@ -2949,8 +3148,8 @@ A jump table for the options with a short description can be found at |Q_op|. 2. If a <NL> is found and 'fileformats' includes "unix", 'fileformat' is set to "unix". Note that when a <NL> is found without a preceding <CR>, "unix" is preferred over "dos". - 3. If 'fileformat' has not yet been set, and if 'fileformats' - includes "mac", 'fileformat' is set to "mac". + 3. If 'fileformat' has not yet been set, and if a <CR> is found, and + if 'fileformats' includes "mac", 'fileformat' is set to "mac". This means that "mac" is only chosen when: "unix" is not present or no <NL> is found in the file, and "dos" is not present or no <CR><NL> is found in the file. @@ -2964,8 +3163,8 @@ A jump table for the options with a short description can be found at |Q_op|. file only, the option is not changed. When 'binary' is set, the value of 'fileformats' is not used. - Note that when Vim starts up with an empty buffer this option is not - used. Set 'fileformat' in your .vimrc instead. + When Vim starts up with an empty buffer the first item is used. You + can overrule this by setting 'fileformat' in your .vimrc. For systems with a Dos-like <EOL> (<CR><NL>), when reading files that are ":source"ed and for vimrc files, automatic <EOL> detection may be @@ -2995,8 +3194,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'filetype' 'ft' string (default: "") local to buffer {not in Vi} - {not available when compiled without the |+autocmd| - feature} When this option is set, the FileType autocommand event is triggered. All autocommands that match with the value of this option will be executed. Thus the value of 'filetype' is used in place of the file @@ -3030,17 +3227,17 @@ A jump table for the options with a short description can be found at |Q_op|. item default Used for ~ stl:c ' ' or '^' statusline of the current window - stlnc:c ' ' or '-' statusline of the non-current windows + stlnc:c ' ' or '=' statusline of the non-current windows vert:c '|' vertical separators |:vsplit| fold:c '-' filling 'foldtext' diff:c '-' deleted lines of the 'diff' option Any one that is omitted will fall back to the default. For "stl" and - "stlnc" the space will be used when there is highlighting, '^' or '-' + "stlnc" the space will be used when there is highlighting, '^' or '=' otherwise. Example: > - :set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:- + :set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:- < This is similar to the default, except that these characters will also be used when there is highlighting. @@ -3054,6 +3251,17 @@ A jump table for the options with a short description can be found at |Q_op|. fold:c Folded |hl-Folded| diff:c DiffDelete |hl-DiffDelete| + *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* +'fixendofline' 'fixeol' boolean (default on) + local to buffer + {not in Vi} + When writing a file and this option is on, <EOL> at the end of file + will be restored if missing. Turn this option off if you want to + preserve the situation from the original file. + When the 'binary' option is set the value of this option doesn't + matter. + See the 'endofline' option. + *'fkmap'* *'fk'* *'nofkmap'* *'nofk'* 'fkmap' 'fk' boolean (default off) *E198* global @@ -3257,6 +3465,42 @@ A jump table for the options with a short description can be found at |Q_op|. It is not allowed to change text or jump to another window while evaluating 'foldtext' |textlock|. + *'formatexpr'* *'fex'* +'formatexpr' 'fex' string (default "") + local to buffer + {not in Vi} + {not available when compiled without the |+eval| + feature} + Expression which is evaluated to format a range of lines for the |gq| + operator or automatic formatting (see 'formatoptions'). When this + option is empty 'formatprg' is used. + + The |v:lnum| variable holds the first line to be formatted. + The |v:count| variable holds the number of lines to be formatted. + The |v:char| variable holds the character that is going to be + inserted if the expression is being evaluated due to + automatic formatting. This can be empty. Don't insert + it yet! + + Example: > + :set formatexpr=mylang#Format() +< This will invoke the mylang#Format() function in the + autoload/mylang.vim file in 'runtimepath'. |autoload| + + The expression is also evaluated when 'textwidth' is set and adding + text beyond that limit. This happens under the same conditions as + when internal formatting is used. Make sure the cursor is kept in the + same spot relative to the text then! The |mode()| function will + return "i" or "R" in this situation. + + When the expression evaluates to non-zero Vim will fall back to using + the internal format mechanism. + + The expression will be evaluated in the |sandbox| when set from a + modeline, see |sandbox-option|. That stops the option from working, + since changing the buffer text is not allowed. + NOTE: This option is set to "" when 'compatible' is set. + *'formatoptions'* *'fo'* 'formatoptions' 'fo' string (Vim default: "tcq", Vi default: "vt") local to buffer @@ -3286,7 +3530,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'formatprg'* *'fp'* 'formatprg' 'fp' string (default "") - global + global or local to buffer |global-local| {not in Vi} The name of an external program that will be used to format the lines selected with the |gq| operator. The program must take the input on @@ -3300,43 +3544,8 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - *'formatexpr'* *'fex'* -'formatexpr' 'fex' string (default "") - local to buffer - {not in Vi} - {not available when compiled without the |+eval| - feature} - Expression which is evaluated to format a range of lines for the |gq| - operator or automatic formatting (see 'formatoptions'). When this - option is empty 'formatprg' is used. - - The |v:lnum| variable holds the first line to be formatted. - The |v:count| variable holds the number of lines to be formatted. - The |v:char| variable holds the character that is going to be - inserted if the expression is being evaluated due to - automatic formatting. This can be empty. Don't insert - it yet! - - Example: > - :set formatexpr=mylang#Format() -< This will invoke the mylang#Format() function in the - autoload/mylang.vim file in 'runtimepath'. |autoload| - - The expression is also evaluated when 'textwidth' is set and adding - text beyond that limit. This happens under the same conditions as - when internal formatting is used. Make sure the cursor is kept in the - same spot relative to the text then! The |mode()| function will - return "i" or "R" in this situation. - - When the expression evaluates to non-zero Vim will fall back to using - the internal format mechanism. - - The expression will be evaluated in the |sandbox| when set from a - modeline, see |sandbox-option|. That stops the option from working, - since changing the buffer text is not allowed. - *'fsync'* *'fs'* *'nofsync'* *'nofs'* -'fsync' 'fs' boolean (default on) +'fsync' 'fs' boolean (default on) global {not in Vi} When on, the library function fsync() will be called after writing a @@ -3348,6 +3557,8 @@ A jump table for the options with a short description can be found at |Q_op|. systems without an fsync() implementation, this variable is always off. Also see 'swapsync' for controlling fsync() on swap files. + 'fsync' also applies to |writefile()|, unless a flag is used to + overrule it. *'fullscreen'* *'fu'* *'nofullscreen'* *'nofu'* 'fullscreen' 'fu' boolean (default off) @@ -3363,6 +3574,10 @@ A jump table for the options with a short description can be found at |Q_op|. See 'fuoptions' for how Vim resizes and colors the background when entering and leaving fullscreen mode. + You can use the hidden preference MMFullScreenFadeTime to adjust how + long the animation takes to fade in and out. The default is 0.25 + seconds. See |macvim-preferences|for how to set hidden preferences. + Note: Setting 'fullscreen' usually changes the size of the Vim control. However, for technical reasons, 'lines' and 'columns' will currently only be updated when Vim runs its event loop. As a @@ -3446,9 +3661,12 @@ A jump table for the options with a short description can be found at |Q_op|. :s///gg subst. all subst. one NOTE: This option is reset when 'compatible' is set. + DEPRECATED: Setting this option may break plugins that are not aware + of this option. Also, many users get confused that adding the /g flag + has the opposite effect of that it normally does. *'grepformat'* *'gfm'* -'grepformat' 'gfm' string (default "%f:%l%m,%f %l%m") +'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m") global {not in Vi} Format to recognize for the ":grep" command output. @@ -3500,7 +3718,8 @@ A jump table for the options with a short description can be found at |Q_op|. the height of the cursor can be changed. This can be done by specifying a block cursor, or a percentage for a vertical or horizontal cursor. - For a console the 't_SI' and 't_EI' escape sequences are used. + For a console the 't_SI', 't_SR', and 't_EI' escape sequences are + used. The option is a comma separated list of parts. Each part consist of a mode-list and an argument-list: @@ -3581,6 +3800,14 @@ A jump table for the options with a short description can be found at |Q_op|. On systems where 'guifontset' is supported (X11) and 'guifontset' is not empty, then 'guifont' is not used. + Note: As to the GTK GUIs, no error is given against any invalid names, + and the first element of the list is always picked up and made use of. + This is because, instead of identifying a given name with a font, the + GTK GUIs use it to construct a pattern and try to look up a font which + best matches the pattern among available fonts, and this way, the + matching never fails. An invalid name doesn't matter because a number + of font properties other than name will do to get the matching done. + Spaces after a comma are ignored. To include a comma in a font name precede it with a backslash. Setting an option requires an extra backslash before a space and a backslash. See also @@ -3606,7 +3833,7 @@ A jump table for the options with a short description can be found at |Q_op|. The font name depends on the GUI used. See |setting-guifont| for a way to set 'guifont' for various systems. - For the GTK+ 2 GUI the font name looks like this: > + For the GTK+ 2 and 3 GUIs, the font name looks like this: > :set guifont=Andale\ Mono\ 11 < That's all. XLFDs are not used. For Chinese this is reported to work well: > @@ -3615,7 +3842,9 @@ A jump table for the options with a short description can be found at |Q_op|. set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12 endif < - For Mac OS X you can use something like this: > + (Replace gui_gtk2 with gui_gtk3 for the GTK+ 3 GUI) + + For Mac OSX you can use something like this: > :set guifont=Monaco:h10 < Also see 'macatsui', it can help fix display problems {not in MacVim}. In MacVim, fonts with spaces are set like this: > @@ -3623,7 +3852,7 @@ A jump table for the options with a short description can be found at |Q_op|. < *E236* Note that the fonts must be mono-spaced (all characters have the same - width). An exception is MacVim and GTK 2: all fonts are accepted, but + width). An exception is MacVim and GTK: all fonts are accepted, but mono-spaced fonts look best. To preview a font on X11, you might be able to use the "xfontsel" @@ -3642,6 +3871,10 @@ A jump table for the options with a short description can be found at |Q_op|. HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS, SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC. Normally you would use "cDEFAULT". + qXX - quality XX. Valid quality names are: PROOF, DRAFT, + ANTIALIASED, NONANTIALIASED, CLEARTYPE, DEFAULT. + Normally you would use "qDEFAULT". + Some quality values are not supported in legacy OSs. Use a ':' to separate the options. - A '_' can be used in the place of a space, so you don't need to use @@ -3658,7 +3891,7 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} {only available when compiled with GUI enabled and with the |+xfontset| feature} - {not available in the GTK+ 2 GUI} + {not available in the GTK+ GUI} When not empty, specifies two (or more) fonts to be used. The first one for normal English, the second one for your special language. See |xfontset|. @@ -3687,7 +3920,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. - All GUI versions but MacVim and GTK+ 2: + All GUI versions but MacVim and GTK+: 'guifontwide' is only used when 'encoding' is set to "utf-8" and 'guifontset' is empty or invalid. @@ -3701,7 +3934,7 @@ A jump table for the options with a short description can be found at |Q_op|. that font will be used for all wide fonts. However, if a glyph is not available in the wide font, then font substitution is still used. - GTK+ 2 GUI only: *guifontwide_gtk2* + GTK+ GUI only: *guifontwide_gtk2* If set and valid, 'guifontwide' is always used for double width characters, even if 'encoding' is not set to "utf-8". @@ -3728,8 +3961,10 @@ A jump table for the options with a short description can be found at |Q_op|. screen. *'guioptions'* *'go'* -'guioptions' 'go' string (default "egmrLtT" (MS-Windows), - "aegimrLtT" (GTK, Motif and Athena)) +'guioptions' 'go' string (default "egmrLtT" (MS-Windows, "t" is + removed in |defaults.vim|), + "aegimrLtT" (GTK, Motif and Athena), + ) global {not in Vi} {only available when compiled with GUI enabled} @@ -3739,7 +3974,14 @@ A jump table for the options with a short description can be found at |Q_op|. To avoid problems with flags that are added in the future, use the "+=" and "-=" feature of ":set" |add-option-flags|. - Valid letters are as follows: + Valid characters are as follows: + *'go-!'* + '!' External commands are executed in a terminal window. Without + this flag the MS-Windows GUI will open a console window to + execute the command. The Unix GUI will simulate a dumb + terminal to list the command output. + The terminal window will be positioned at the bottom, and grow + upwards as needed. *guioptions_a* *'go-a'* 'a' Autoselect: If present, then whenever VISUAL mode is started, or the Visual area extended, Vim tries to become the owner of @@ -3757,7 +3999,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. @@ -3798,7 +4040,7 @@ A jump table for the options with a short description can be found at |Q_op|. that this flag must be added in the .vimrc file, before switching on syntax or filetype recognition (when the |gvimrc| file is sourced the system menu has already been loaded; the - ":syntax on" and ":filetype on" commands load the menu too). + `:syntax on` and `:filetype on` commands load the menu too). *'go-g'* 'g' Grey menu items: Make menu items that are not active grey. If 'g' is not included inactive menu items are not shown at all. @@ -3842,7 +4084,13 @@ 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. *'go-F'* 'F' Add a footer. Only for Motif. See |gui-footer|. - + *'go-k'* + 'k' Keep the GUI window size when adding/removing a scrollbar, or + toolbar, tabline, etc. Instead, the behavior is similar to + when the window is maximized and will adjust 'lines' and + 'columns' to fit to the window. Without the 'k' flag Vim will + try to keep 'lines' and 'columns' the same when adding and + removing GUI components. *'guipty'* *'noguipty'* 'guipty' boolean (default on) @@ -3864,6 +4112,8 @@ A jump table for the options with a short description can be found at |Q_op|. The format of this option is like that of 'statusline'. 'guitabtooltip' is used for the tooltip, see below. + The expression will be evaluated in the |sandbox| when set from a + modeline, see |sandbox-option|. Only used when the GUI tab pages line is displayed. 'e' must be present in 'guioptions'. For the non-GUI tab pages line 'tabline' is @@ -3946,18 +4196,20 @@ A jump table for the options with a short description can be found at |Q_op|. *'highlight'* *'hl'* 'highlight' 'hl' string (default (as a single string): - "8:SpecialKey,@:NonText,d:Directory, - e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg, - M:ModeMsg,n:LineNr,N:CursorLineNr, - r:Question,s:StatusLine,S:StatusLineNC, - c:VertSplit, t:Title,v:Visual, - w:WarningMsg,W:WildMenu, - f:Folded,F:FoldColumn,A:DiffAdd, - C:DiffChange,D:DiffDelete,T:DiffText, - >:SignColumn,B:SpellBad,P:SpellCap, - R:SpellRare,L:SpellLocal,-:Conceal, - +:Pmenu,=:PmenuSel, - x:PmenuSbar,X:PmenuThumb") + "8:SpecialKey,~:EndOfBuffer,@:NonText, + d:Directory,e:ErrorMsg,i:IncSearch, + l:Search,m:MoreMsg,M:ModeMsg,n:LineNr, + N:CursorLineNr,r:Question,s:StatusLine, + S:StatusLineNC,c:VertSplit,t:Title, + v:Visual,w:WarningMsg,W:WildMenu,f:Folded, + F:FoldColumn,A:DiffAdd,C:DiffChange, + D:DiffDelete,T:DiffText,>:SignColumn, + B:SpellBad,P:SpellCap,R:SpellRare, + L:SpellLocal,-:Conceal,+:Pmenu,=:PmenuSel, + x:PmenuSbar,X:PmenuThumb,*:TabLine, + #:TabLineSel,_:TabLineFill,!:CursorColumn, + .:CursorLine,o:ColorColumn,q:QuickFixLine, + z:StatusLineTerm,Z:StatusLineTermNC") global {not in Vi} This option can be used to set highlighting mode for various @@ -3965,7 +4217,8 @@ A jump table for the options with a short description can be found at |Q_op|. first character in a pair gives the occasion, the second the mode to use for that occasion. The occasions are: |hl-SpecialKey| 8 Meta and special keys listed with ":map" - |hl-NonText| @ '~' and '@' at the end of the window and + |hl-EndOfBuffer| ~ lines after the last line in the buffer + |hl-NonText| @ '@' at the end of the window and characters from 'showbreak' |hl-Directory| d directories in CTRL-D listing and other special things in listings @@ -3981,7 +4234,7 @@ A jump table for the options with a short description can be found at |Q_op|. set. |hl-Question| r |hit-enter| prompt and yes/no questions |hl-StatusLine| s status line of current window |status-line| - |hl-StatusLineNC| S status lines of not-current windows + |hl-StatusLineNC| S status lines of not-current windows |hl-Title| t Titles for output from ":set all", ":autocmd" etc. |hl-VertSplit| c column used to separate vertically split windows |hl-Visual| v Visual mode @@ -4015,6 +4268,7 @@ A jump table for the options with a short description can be found at |Q_op|. s standout (termcap entry "so" and "se") u underline (termcap entry "us" and "ue") c undercurl (termcap entry "Cs" and "Ce") + t strikethrough (termcap entry "Ts" and "Te") n no highlighting - no highlighting : use a highlight group @@ -4027,33 +4281,9 @@ A jump table for the options with a short description can be found at |Q_op|. define one. The default uses a different group for each occasion. See |highlight-default| for the default highlight groups. - *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* -'hlsearch' 'hls' boolean (default off) - global - {not in Vi} - {not available when compiled without the - |+extra_search| feature} - When there is a previous search pattern, highlight all its matches. - The type of highlighting used can be set with the 'l' occasion in the - 'highlight' option. This uses the "Search" highlight group by - default. Note that only the matching text is highlighted, any offsets - are not applied. - See also: 'incsearch' and |:match|. - When you get bored looking at the highlighted matches, you can turn it - off with |:nohlsearch|. This does not change the option value, as - soon as you use a search command, the highlighting comes back. - 'redrawtime' specifies the maximum time spent on finding matches. - When the search pattern can match an end-of-line, Vim will try to - highlight all of the matched text. However, this depends on where the - search starts. This will be the first line in the window or the first - line below a closed fold. A match in a previous line which is not - drawn may not continue in a newly drawn line. - You can specify whether the highlight status is restored on startup - with the 'h' flag in 'viminfo' |viminfo-h|. - NOTE: This option is reset when 'compatible' is set. - *'history'* *'hi'* -'history' 'hi' number (Vim default: 50, Vi default: 0) +'history' 'hi' number (Vim default: 50, Vi default: 0, + set to 200 in |defaults.vim|) global {not in Vi} A history of ":" commands, and a history of previous search patterns @@ -4083,6 +4313,31 @@ A jump table for the options with a short description can be found at |Q_op|. When on, phonetic keyboard mapping is used. 'hkmap' must also be on. This is useful if you have a non-Hebrew keyboard. See |rileft.txt|. + NOTE: This option is reset when 'compatible' is set. + + *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* +'hlsearch' 'hls' boolean (default off) + global + {not in Vi} + {not available when compiled without the + |+extra_search| feature} + When there is a previous search pattern, highlight all its matches. + The type of highlighting used can be set with the 'l' occasion in the + 'highlight' option. This uses the "Search" highlight group by + default. Note that only the matching text is highlighted, any offsets + are not applied. + See also: 'incsearch' and |:match|. + When you get bored looking at the highlighted matches, you can turn it + off with |:nohlsearch|. This does not change the option value, as + soon as you use a search command, the highlighting comes back. + 'redrawtime' specifies the maximum time spent on finding matches. + When the search pattern can match an end-of-line, Vim will try to + highlight all of the matched text. However, this depends on where the + search starts. This will be the first line in the window or the first + line below a closed fold. A match in a previous line which is not + drawn may not continue in a newly drawn line. + You can specify whether the highlight status is restored on startup + with the 'h' flag in 'viminfo' |viminfo-h|. NOTE: This option is reset when 'compatible' is set. *'icon'* *'noicon'* @@ -4102,6 +4357,7 @@ A jump table for the options with a short description can be found at |Q_op|. When Vim was compiled with HAVE_X11 defined, the original icon will be restored if possible |X11|. See |X11-icon| for changing the icon on X11. + For MS-Windows the icon can be changed, see |windows-icon|. *'iconstring'* 'iconstring' string (default "") @@ -4126,7 +4382,7 @@ A jump table for the options with a short description can be found at |Q_op|. global Ignore case in search patterns. Also used when searching in the tags file. - Also see 'smartcase'. + Also see 'smartcase' and 'tagcase'. Can be overruled by using "\c" or "\C" in the pattern, see |/ignorecase|. @@ -4134,10 +4390,11 @@ A jump table for the options with a short description can be found at |Q_op|. 'imactivatefunc' 'imaf' string (default "") global {not in Vi} - {only available when compiled with |+xim| and - |+GUI_GTK|} + {only available when compiled with the |+multi_byte| + feature} This option specifies a function that will be called to - activate/inactivate Input Method. + activate or deactivate the Input Method. + It is not used in the GUI. Example: > function ImActivateFunc(active) @@ -4186,8 +4443,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'imcmdline' 'imc' boolean (default off) global {not in Vi} - {only available when compiled with the |+xim|, - |+multi_byte_ime| or |global-ime| features} + {only available when compiled with the |+multi_byte| + feature} When set the Input Method is always on when starting to edit a command line, unless entering a search pattern (see 'imsearch' for that). Setting this option is useful when your input method allows entering @@ -4198,16 +4455,15 @@ A jump table for the options with a short description can be found at |Q_op|. 'imdisable' 'imd' boolean (default off, on for some systems (SGI)) global {not in Vi} - {only available when compiled with the |+xim|, - |+multi_byte_ime| or |global-ime| features, always - available in MacVim} + {only available when compiled with the |+multi_byte| + feature} When set the Input Method is never used. This is useful to disable the IM when it doesn't work properly. Currently this option is on by default for SGI/IRIX. This may change in later releases. *'iminsert'* *'imi'* -'iminsert' 'imi' number (default 0, 2 when an input method is supported) +'iminsert' 'imi' number (default 0) local to buffer {not in Vi} Specifies whether :lmap or an Input Method (IM) is to be used in @@ -4215,8 +4471,6 @@ A jump table for the options with a short description can be found at |Q_op|. 0 :lmap is off and IM is off 1 :lmap is ON and IM is off 2 :lmap is off and IM is ON - 2 is available only when compiled with the |+multi_byte_ime|, |+xim| - or |global-ime|. To always reset the option to zero when leaving Insert mode with <Esc> this can be used: > :inoremap <ESC> <ESC>:set iminsert=0<CR> @@ -4229,8 +4483,12 @@ A jump table for the options with a short description can be found at |Q_op|. The value 0 may not work correctly with Athena and Motif with some XIM methods. Use 'imdisable' to disable XIM then. + You can set 'imactivatefunc' and 'imstatusfunc' to handle IME/XIM + via external command if vim is not compiled with the |+xim|, + |+multi_byte_ime| or |global-ime|. + *'imsearch'* *'ims'* -'imsearch' 'ims' number (default 0, 2 when an input method is supported) +'imsearch' 'ims' number (default -1) local to buffer {not in Vi} Specifies whether :lmap or an Input Method (IM) is to be used when @@ -4251,10 +4509,11 @@ A jump table for the options with a short description can be found at |Q_op|. 'imstatusfunc' 'imsf' string (default "") global {not in Vi} - {only available when compiled with |+xim| and - |+GUI_GTK|} + {only available when compiled with the |+multi_byte| + feature} This option specifies a function that is called to obtain the status of Input Method. It must return a positive number when IME is active. + It is not used in the GUI. Example: > function ImStatusFunc() @@ -4265,6 +4524,23 @@ A jump table for the options with a short description can be found at |Q_op|. < NOTE: This function is invoked very often. Keep it fast. + *'imstyle'* *'imst'* +'imstyle' 'imst' number (default 1) + global + {not in Vi} + {only available when compiled with |+xim| and + |+GUI_GTK|} + This option specifies the input style of Input Method: + 0 use on-the-spot style + 1 over-the-spot style + See: |xim-input-style| + + For a long time on-the-spot style had been used in the GTK version of + vim, however, it is known that it causes troubles when using mappings, + |single-repeat|, etc. Therefore over-the-spot style becomes the + default now. This should work fine for most people, however if you + have any problem with it, try using on-the-spot style. + *'include'* *'inc'* 'include' 'inc' string (default "^\s*#\s*include") global or local to buffer |global-local| @@ -4305,7 +4581,8 @@ A jump table for the options with a short description can be found at |Q_op|. evaluating 'includeexpr' |textlock|. *'incsearch'* *'is'* *'noincsearch'* *'nois'* -'incsearch' 'is' boolean (default off) +'incsearch' 'is' boolean (default off, set in |defaults.vim| if the + +reltime feature is supported) global {not in Vi} {not available when compiled without the @@ -4318,12 +4595,24 @@ A jump table for the options with a short description can be found at |Q_op|. original position when no match is found and when pressing <Esc>. You still need to finish the search command with <Enter> to move the cursor to the match. + You can use the CTRL-G and CTRL-T keys to move to the next and + previous match. |c_CTRL-G| |c_CTRL-T| When compiled with the |+reltime| feature Vim only searches for about half a second. With a complicated pattern and/or a lot of text the match may not be found. This is to avoid that Vim hangs while you are typing the pattern. The highlighting can be set with the 'i' flag in 'highlight'. - See also: 'hlsearch'. + When 'hlsearch' is on, all matched strings are highlighted too while + typing a search command. See also: 'hlsearch'. + If you don't want turn 'hlsearch' on, but want to highlight all matches + while searching, you can turn on and off 'hlsearch' with autocmd. + Example: > + augroup vimrc-incsearch-highlight + autocmd! + autocmd CmdlineEnter /,\? :set hlsearch + autocmd CmdlineLeave /,\? :set nohlsearch + augroup END +< CTRL-L can be used to add one character from after the current match to the command line. If 'ignorecase' and 'smartcase' are set and the command line has no uppercase characters, the added character is @@ -4361,7 +4650,7 @@ A jump table for the options with a short description can be found at |Q_op|. < Error messages will be suppressed, unless the 'debug' option contains "msg". See |indent-expression|. - NOTE: This option is made empty when 'compatible' is set. + NOTE: This option is set to "" when 'compatible' is set. The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. @@ -4402,7 +4691,7 @@ A jump table for the options with a short description can be found at |Q_op|. if you want to use Vim as a modeless editor. Used for |evim|. These Insert mode commands will be useful: - Use the cursor keys to move around. - - Use CTRL-O to execute one Normal mode command |i_CTRL-O|). When + - Use CTRL-O to execute one Normal mode command |i_CTRL-O|. When this is a mapping, it is executed as if 'insertmode' was off. Normal mode remains active until the mapping is finished. - Use CTRL-L to execute a number of Normal mode commands, then use @@ -4507,6 +4796,8 @@ A jump table for the options with a short description can be found at |Q_op|. '*', '"' and '|' (so that CTRL-] on a command finds the help for that command). When the 'lisp' option is on the '-' character is always included. + This option also influences syntax highlighting, unless the syntax + uses |:syn-iskeyword|. NOTE: This option is set to the Vi default value when 'compatible' is set and to the Vim default value when 'compatible' is reset. @@ -4597,16 +4888,18 @@ A jump table for the options with a short description can be found at |Q_op|. *'keywordprg'* *'kp'* 'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help", - OS/2: "view /", VMS: "help") + VMS: "help") global or local to buffer |global-local| {not in Vi} Program to use for the |K| command. Environment variables are expanded |:set_env|. ":help" may be used to access the Vim internal help. (Note that previously setting the global option to the empty value did this, which is now deprecated.) - When "man" is used, Vim will automatically translate a count for the - "K" command to a section number. Also for "man -s", in which case the - "-s" is removed when there is no count. + When the first character is ":", the command is invoked as a Vim + Ex command prefixed with [count]. + When "man", "man -s" or an Ex command is used, Vim will automatically + translate a count for the "K" command and pass it as the first + argument. For "man -s" the "-s" is removed when there is no count. See |option-backslash| about including spaces and backslashes. Example: > :set keywordprg=man\ -s @@ -4621,12 +4914,14 @@ A jump table for the options with a short description can be found at |Q_op|. feature} This option allows switching your keyboard into a special language mode. When you are typing text in Insert mode the characters are - inserted directly. When in command mode the 'langmap' option takes + inserted directly. When in Normal mode the 'langmap' option takes care of translating these special characters to the original meaning of the key. This means you don't have to change the keyboard mode to be able to execute Normal mode commands. This is the opposite of the 'keymap' option, where characters are mapped in Insert mode. + Also consider resetting 'langremap' to avoid 'langmap' applies to + characters resulting from a mapping. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -4682,6 +4977,28 @@ A jump table for the options with a short description can be found at |Q_op|. :source $VIMRUNTIME/menu.vim < Warning: This deletes all menus that you defined yourself! + *'langnoremap'* *'lnr'* *'nolangnoremap'* *'nolnr'* +'langnoremap' 'lnr' boolean (default off, set in |defaults.vim|) + global + {not in Vi} + {only available when compiled with the |+langmap| + feature} + This is just like 'langremap' but with the value inverted. It only + exists for backwards compatibility. When setting 'langremap' then + 'langnoremap' is set to the inverted value, and the other way around. + + *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'* +'langremap' 'lrm' boolean (default on, reset in |defaults.vim|) + global + {not in Vi} + {only available when compiled with the |+langmap| + feature} + When off, setting 'langmap' does not apply to characters resulting from + a mapping. This basically means, if you noticed that setting + 'langmap' disables some of your mappings, try resetting this option. + This option defaults to on for backwards compatibility. Set it off if + that works for you to avoid mappings to break. + *'laststatus'* *'ls'* 'laststatus' 'ls' number (default 1) global @@ -4732,7 +5049,7 @@ A jump table for the options with a short description can be found at |Q_op|. use this command to get the tallest window possible: > :set lines=999 < Minimum value is 2, maximum value is 1000. - If you get less lines than expected, check the 'guiheadroom' option. + If you get fewer lines than expected, check the 'guiheadroom' option. When you set this option and Vim is unable to change the physical number of lines of the display, the display may be messed up. @@ -4796,33 +5113,38 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Strings to use in 'list' mode and for the |:list| command. It is a comma separated list of string settings. - *lcs-eol* + *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 line. - *lcs-tab* + *lcs-tab* tab:xy Two characters to be used to show a tab. The first char is used once. The second char is repeated to fill the space that the tab normally occupies. "tab:>-" will show a tab that takes four spaces as ">---". When omitted, a tab is show as ^I. - *lcs-trail* + *lcs-space* + space:c Character to show for a space. When omitted, spaces + are left blank. + *lcs-trail* trail:c Character to show for trailing spaces. When omitted, - trailing spaces are blank. - *lcs-extends* + trailing spaces are blank. Overrides the "space" + setting for trailing spaces. + *lcs-extends* extends:c Character to show in the last column, when 'wrap' is off and the line continues beyond the right of the screen. - *lcs-precedes* + *lcs-precedes* precedes:c Character to show in the first column, when 'wrap' is off and there is text preceding the character visible in the first column. - *lcs-conceal* + *lcs-conceal* conceal:c Character to show in place of concealed text, when 'conceallevel' is set to 1. - *lcs-nbsp* - nbsp:c Character to show for a non-breakable space (character - 0xA0, 160). Left blank when omitted. + *lcs-nbsp* + nbsp:c Character to show for a non-breakable space character + (0xA0 (160 decimal) and U+202F). Left blank when + omitted. The characters ':' and ',' should not be used. UTF-8 characters can be used when 'encoding' is "utf-8", otherwise only printable @@ -4833,7 +5155,7 @@ A jump table for the options with a short description can be found at |Q_op|. :set lcs=tab:>-,eol:<,nbsp:% :set lcs=extends:>,precedes:< < The "NonText" highlighting will be used for "eol", "extends" and - "precedes". "SpecialKey" for "nbsp", "tab" and "trail". + "precedes". "SpecialKey" for "nbsp", "space", "tab" and "trail". |hl-NonText| |hl-SpecialKey| *'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'* @@ -4843,8 +5165,20 @@ A jump table for the options with a short description can be found at |Q_op|. When on the plugin scripts are loaded when starting up |load-plugins|. This option can be reset in your |vimrc| file to disable the loading of plugins. - Note that using the "-u NONE" and "--noplugin" command line arguments - reset this option. |-u| |--noplugin| + Note that using the "-u NONE", "-u DEFAULTS" and "--noplugin" command + line arguments reset this option. See |-u| and |--noplugin|. + + *'luadll'* +'luadll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+lua/dyn| + feature} + Specifies the name of the Lua shared library. The default is + DYNAMIC_LUA_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'macatsui'* *'nomacatsui'* 'macatsui' boolean (default on) @@ -4863,6 +5197,31 @@ A jump table for the options with a short description can be found at |Q_op|. 'termencoding'. Note: MacVim does not use this option. + *'macligatures'* *'nomacligatures'* +'macligatures' boolean (default off) + global + {not in Vi} + {only available when compiled with GUI enabled on + Mac OS X} + This option only has an effect in the GUI version of Vim on Mac OS X + v10.5 or later. When on, Vim will display ligatures if the selected + 'guifont' supports them. Examples for such fonts are Fira Code or + Haskelig. + Note: Currently this option only has an effect if + 'Use Core Text renderer' is enabled in the GUI preferences pane. + + *'macthinstrokes'* *'nomacthinstrokes'* +'macthinstrokes' boolean (default off) + global + {not in Vi} + {only available when compiled with GUI enabled on + Mac OS X} + This option only has an effect in the GUI version of Vim on Mac OS X + v10.8 or later. When on, Vim will render the text a little lighter + which looks nice with a dark colorscheme. + Note: Currently this option only has an effect if + 'Use Core Text renderer' is enabled in the GUI preferences pane. + *'macmeta'* *'mmta'* *'nomacmeta'* *'nommta'* 'macmeta' boolean (default off) local to buffer @@ -4880,10 +5239,11 @@ A jump table for the options with a short description can be found at |Q_op|. global Changes the special characters that can be used in search patterns. See |pattern|. - NOTE: To avoid portability problems with using patterns, always keep - this option at the default "on". Only switch it off when working with - old Vi scripts. In any other situation write patterns that work when - 'magic' is on. Include "\M" when you want to |/\M|. + WARNING: Switching this option off most likely breaks plugins! That + is because many patterns assume it's on and will fail when it's off. + Only switch it off when working with old Vi scripts. In any other + situation write patterns that work when 'magic' is on. Include "\M" + when you want to |/\M|. *'makeef'* *'mef'* 'makeef' 'mef' string (default: "") @@ -4903,13 +5263,32 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. + *'makeencoding'* *'menc'* +'makeencoding' 'menc' string (default "") + global or local to buffer |global-local| + {only available when compiled with the |+multi_byte| + feature} + {not in Vi} + Encoding used for reading the output of external commands. When empty, + encoding is not converted. + This is used for `:make`, `:lmake`, `:grep`, `:lgrep`, `:grepadd`, + `:lgrepadd`, `:cfile`, `:cgetfile`, `:caddfile`, `:lfile`, `:lgetfile`, + and `:laddfile`. + + This would be mostly useful when you use MS-Windows and set 'encoding' + to "utf-8". If |+iconv| is enabled and GNU libiconv is used, setting + 'makeencoding' to "char" has the same effect as setting to the system + locale encoding. Example: > + :set encoding=utf-8 + :set makeencoding=char " system locale is used +< *'makeprg'* *'mp'* 'makeprg' 'mp' string (default "make", VMS: "MMS") global or local to buffer |global-local| {not in Vi} Program to use for the ":make" command. See |:make_makeprg|. - This option may contain '%' and '#' characters (see |:_%| and |:_#|), - which are expanded to the current and alternate file name. Use |::S| + This option may contain '%' and '#' characters (see |:_%| and |:_#|), + which are expanded to the current and alternate file name. Use |::S| to escape file names in case they contain special characters. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. @@ -4941,7 +5320,7 @@ A jump table for the options with a short description can be found at |Q_op|. :au FileType c,cpp,java set mps+==:; < For a more advanced way of using "%", see the matchit.vim plugin in - the $VIMRUNTIME/macros directory. |add-local-help| + the $VIMRUNTIME/pack/dist/opt/matchit directory. |add-local-help| *'matchtime'* *'mat'* 'matchtime' 'mat' number (default 5) @@ -4975,6 +5354,8 @@ A jump table for the options with a short description can be found at |Q_op|. catches endless recursion. When using a recursive function with more depth, set 'maxfuncdepth' to a bigger number. But this will use more memory, there is the danger of failing when memory is exhausted. + Increasing this limit above 200 also changes the maximum for Ex + command recursion, see |E169|. See also |:function|. *'maxmapdepth'* *'mmd'* *E223* @@ -4995,8 +5376,11 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Maximum amount of memory (in Kbyte) to use for one buffer. When this limit is reached allocating extra memory for a buffer will cause - other memory to be freed. The maximum usable value is about 2000000. - Use this to work without a limit. Also see 'maxmemtot'. + other memory to be freed. + The maximum usable value is about 2000000. Use this to work without a + limit. + The value is ignored when 'swapfile' is off. + Also see 'maxmemtot'. *'maxmempattern'* *'mmp'* 'maxmempattern' 'mmp' number (default 1000) @@ -5020,8 +5404,13 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Maximum amount of memory in Kbyte to use for all buffers together. The maximum usable value is about 2000000 (2 Gbyte). Use this to work - without a limit. On 64 bit machines higher values might work. But - hey, do you really need more than 2 Gbyte for text editing? + without a limit. + On 64 bit machines higher values might work. But hey, do you really + need more than 2 Gbyte for text editing? Keep in mind that text is + stored in the swap file, one can edit files > 2 Gbyte anyway. We do + need the memory to store undo info. + Buffers with 'swapfile' off still count to the total amount of memory + used. Also see 'maxmem'. *'menuitems'* *'mis'* @@ -5093,7 +5482,7 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} *E21* When off the buffer contents cannot be changed. The 'fileformat' and 'fileencoding' options also can't be changed. - Can be reset with the |-M| command line argument. + Can be reset on startup with the |-M| command line argument. *'modified'* *'mod'* *'nomodified'* *'nomod'* 'modified' 'mod' boolean (default off) @@ -5111,12 +5500,15 @@ A jump table for the options with a short description can be found at |Q_op|. written. A ":set nomodified" command also resets the original values to the current values and the 'modified' option will be reset. + Similarly for 'eol' and 'bomb'. This option is not set when a change is made to the buffer as the result of a BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost or VimLeave autocommand event. See |gzip-example| for an explanation. When 'buftype' is "nowrite" or "nofile" this option may be set, but will be ignored. + Note that the text may actually be the same, e.g. 'modified' is set + when using "rA" on an "A". *'more'* *'nomore'* 'more' boolean (Vim default: on, Vi default: off) @@ -5129,7 +5521,8 @@ A jump table for the options with a short description can be found at |Q_op|. set and to the Vim default value when 'compatible' is reset. *'mouse'* *E538* -'mouse' string (default "", "a" for GUI, MS-DOS and Win32) +'mouse' string (default "", "a" for GUI, MS-DOS and Win32, + set to "a" in |defaults.vim|) global {not in Vi} Enable the use of the mouse. Only works for certain terminals @@ -5137,7 +5530,7 @@ A jump table for the options with a short description can be found at |Q_op|. sysmouse and Linux console with gpm). For using the mouse in the GUI, see |gui-mouse|. The mouse can be enabled for different modes: - n Normal mode + n Normal mode and Terminal modes v Visual mode i Insert mode c Command-line mode @@ -5204,6 +5597,8 @@ A jump table for the options with a short description can be found at |Q_op|. In the "popup" model the right mouse button produces a pop-up menu. You need to define this first, see |popup-menu|. + In a terminal the popup menu works if Vim is compiled with the + |+insert_expand| option. Note that you can further refine the meaning of buttons with mappings. See |gui-mouse-mapping|. But mappings are NOT used for modeless @@ -5285,6 +5680,33 @@ A jump table for the options with a short description can be found at |Q_op|. time in msec between two mouse clicks for the second click to be recognized as a multi click. + *'mzschemedll'* +'mzschemedll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+mzscheme/dyn| + feature} + Specifies the name of the MzScheme shared library. The default is + DYNAMIC_MZSCH_DLL which was specified at compile time. + Environment variables are expanded |:set_env|. + The value must be set in the |vimrc| script or earlier. In the + startup, before the |load-plugins| step. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + *'mzschemegcdll'* +'mzschemegcdll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+mzscheme/dyn| + feature} + Specifies the name of the MzScheme GC shared library. The default is + DYNAMIC_MZGC_DLL which was specified at compile time. + The value can be equal to 'mzschemedll' if it includes the GC code. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'mzquantum'* *'mzq'* 'mzquantum' 'mzq' number (default 100) global @@ -5293,9 +5715,12 @@ A jump table for the options with a short description can be found at |Q_op|. feature} The number of milliseconds between polls for MzScheme threads. Negative or zero value means no thread scheduling. + NOTE: This option is set to the Vim default value when 'compatible' + is reset. *'nrformats'* *'nf'* -'nrformats' 'nf' string (default "octal,hex") +'nrformats' 'nf' string (default "bin,octal,hex", + set to "bin,hex" in |defaults.vim|) local to buffer {not in Vi} This defines what bases Vim will consider for numbers when using the @@ -5303,12 +5728,15 @@ 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 considered to be hexadecimal. Example: Using CTRL-X on "0x100" results in "0x0ff". + bin If included, numbers starting with "0b" or "0B" will be + considered to be binary. Example: Using CTRL-X on + "0b1000" subtracts one, resulting in "0b0111". Numbers which simply begin with a digit in the range 1-9 are always considered decimal. This also happens for numbers that are not recognized as octal or hex. @@ -5330,7 +5758,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 @@ -5354,7 +5782,8 @@ A jump table for the options with a short description can be found at |Q_op|. is set. Thus with the Vim default of 4 there is room for a line number up to 999. When the buffer has 1000 lines five columns will be used. The minimum value is 1, the maximum value is 10. - NOTE: 'numberwidth' is reset to 8 when 'compatible' is set. + NOTE: This option is set to the Vi default value when 'compatible' is + set and to the Vim default value when 'compatible' is reset. *'omnifunc'* *'ofu'* 'omnifunc' 'ofu' string (default: empty) @@ -5402,6 +5831,12 @@ A jump table for the options with a short description can be found at |Q_op|. This option was supported on RISC OS, which has been removed. + *'packpath'* *'pp'* +'packpath' 'pp' string (default: see 'runtimepath') + {not in Vi} + Directories used to find packages. See |packages|. + + *'paragraphs'* *'para'* 'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp") global @@ -5427,19 +5862,21 @@ A jump table for the options with a short description can be found at |Q_op|. When the 'paste' option is switched on (also when it was already on): - mapping in Insert mode and Command-line mode is disabled - abbreviations are disabled - - 'textwidth' is set to 0 - - 'wrapmargin' is set to 0 - 'autoindent' is reset - - 'smartindent' is reset - - 'softtabstop' is set to 0 + - 'expandtab' is reset + - 'formatoptions' is used like it is empty - 'revins' is reset - 'ruler' is reset - 'showmatch' is reset - - 'formatoptions' is used like it is empty + - 'smartindent' is reset + - 'smarttab' is reset + - 'softtabstop' is set to 0 + - 'textwidth' is set to 0 + - 'wrapmargin' is set to 0 These options keep their value, but their effect is disabled: - - 'lisp' - - 'indentexpr' - 'cindent' + - 'indentexpr' + - 'lisp' NOTE: When you start editing another file while the 'paste' option is on, settings from the modelines or autocommands may change the settings again, causing trouble when pasting text. You might want to @@ -5494,11 +5931,11 @@ A jump table for the options with a short description can be found at |Q_op|. copy of the original file will be kept. The name of the copy is the name of the original file with the string in the 'patchmode' option appended. This option should start with a dot. Use a string like - ".org". 'backupdir' must not be empty for this to work (Detail: The - backup file is renamed to the patchmode file after the new file has - been successfully written, that's why it must be possible to write a - backup file). If there was no file to be backed up, an empty file is - created. + ".orig" or ".org". 'backupdir' must not be empty for this to work + (Detail: The backup file is renamed to the patchmode file after the + new file has been successfully written, that's why it must be possible + to write a backup file). If there was no file to be backed up, an + empty file is created. When the 'backupskip' pattern matches, a patchmode file is not made. Using 'patchmode' for compressed files appends the extension at the end (e.g., "file.gz.orig"), thus the resulting name isn't always @@ -5560,6 +5997,18 @@ A jump table for the options with a short description can be found at |Q_op|. < Replace the ';' with a ':' or whatever separator is used. Note that this doesn't work when $INCL contains a comma or white space. + *'perldll'* +'perldll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+perl/dyn| + feature} + Specifies the name of the Perl shared library. The default is + DYNAMIC_PERL_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'preserveindent'* *'pi'* *'nopreserveindent'* *'nopi'* 'preserveindent' 'pi' boolean (default off) local to buffer @@ -5574,7 +6023,7 @@ A jump table for the options with a short description can be found at |Q_op|. a Tab. NOTE: When using ">>" multiple times the resulting indent is a mix of tabs and spaces. You might not like this. - NOTE: 'preserveindent' is reset when 'compatible' is set. + NOTE: This option is reset when 'compatible' is set. Also see 'copyindent'. Use |:retab| to clean up white space. @@ -5626,6 +6075,8 @@ A jump table for the options with a short description can be found at |Q_op|. and |+postscript| features} Expression used to print the PostScript produced with |:hardcopy|. See |pexpr-option|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'printfont'* *'pfn'* 'printfont' 'pfn' string (default "courier") @@ -5686,6 +6137,94 @@ A jump table for the options with a short description can be found at |Q_op|. Insert mode completion. When zero as much space as available is used. |ins-completion-menu|. + *'pumwidth'* *'pw'* +'pumwidth' 'pw' number (default 15) + global + {not available when compiled without the + |+insert_expand| feature} + {not in Vi} + Determines the minimum width to use for the popup menu for Insert mode + completion. |ins-completion-menu|. + + *'pythondll'* +'pythondll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+python/dyn| + feature} + Specifies the name of the Python 2.x shared library. The default is + DYNAMIC_PYTHON_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + *'pythonhome'* +'pythonhome' string (default "") + global + {not in Vi} + {only available when compiled with the |+python/dyn| + feature} + Specifies the name of the Python 2.x home directory. When 'pythonhome' + and the PYTHONHOME environment variable are not set, PYTHON_HOME, + which was specified at compile time, will be used for the Python 2.x + home directory. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + *'pythonthreedll'* +'pythonthreedll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+python3/dyn| + feature} + Specifies the name of the Python 3 shared library. The default is + DYNAMIC_PYTHON3_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + *'pythonthreehome'* +'pythonthreehome' string (default "") + global + {not in Vi} + {only available when compiled with the |+python3/dyn| + feature} + Specifies the name of the Python 3 home directory. When + 'pythonthreehome' and the PYTHONHOME environment variable are not set, + PYTHON3_HOME, which was specified at compile time, will be used for + the Python 3 home directory. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + *'pyxversion'* *'pyx'* +'pyxversion' 'pyx' number (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+python| or + the |+python3| feature} + Specifies the python version used for pyx* functions and commands + |python_x|. The default value is as follows: + + Compiled with Default ~ + |+python| and |+python3| 0 + only |+python| 2 + only |+python3| 3 + + Available values are 0, 2 and 3. + If 'pyxversion' is 0, it is set to 2 or 3 after the first execution of + any python2/3 commands or functions. E.g. `:py` sets to 2, and `:py3` + sets to 3. `:pyx` sets it to 3 if Python 3 is available, otherwise sets + to 2 if Python 2 is available. + See also: |has-pythonx| + + If Vim is compiled with only |+python| or |+python3| setting + 'pyxversion' has no effect. The pyx* functions and commands are + always the same as the compiled version. + + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'quoteescape'* *'qe'* 'quoteescape' 'qe' string (default "\") @@ -5707,6 +6246,7 @@ A jump table for the options with a short description can be found at |Q_op|. buffer, unless the 'Z' flag is in 'cpoptions'. {not in Vi:} When using the ":view" command the 'readonly' option is set for the newly edited buffer. + See 'modifiable' for disallowing changes to the buffer. *'redrawtime'* *'rdt'* 'redrawtime' 'rdt' number (default 2000) @@ -5715,10 +6255,14 @@ A jump table for the options with a short description can be found at |Q_op|. {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. + searching for patterns for 'hlsearch', |:match| highlighting and syntax + 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. + matches will be highlighted. + For syntax highlighting the time applies per window. When over the + limit syntax highlighting is disabled until |CTRL-L| is used. + This is used to avoid that Vim hangs when using a very complicated + pattern. *'regexpengine'* *'re'* 'regexpengine' 're' number (default 0) @@ -5732,6 +6276,10 @@ A jump table for the options with a short description can be found at |Q_op|. Note that when using the NFA engine and the pattern contains something that is not supported the pattern will not match. This is only useful for debugging the regexp engine. + Using automatic selection enables Vim to switch the engine, if the + default engine becomes too costly. E.g., when the NFA engine uses too + many states. This should prevent Vim from hanging on a combination of + a complex pattern with long text. *'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'* 'relativenumber' 'rnu' boolean (default off) @@ -5751,7 +6299,7 @@ A jump table for the options with a short description can be found at |Q_op|. characters are put before the number. See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for the number. - + The number in front of the cursor line also depends on the value of 'number', see |number_relativenumber| for all combinations of the two options. @@ -5765,6 +6313,104 @@ A jump table for the options with a short description can be found at |Q_op|. this option at the default "on". Only switch it off when working with old Vi scripts. + *'renderoptions'* *'rop'* +'renderoptions' 'rop' string (default: empty) + global + {not in Vi} + {only available when compiled with GUI and DIRECTX on + MS-Windows} + Select a text renderer and set its options. The options depend on the + renderer. + + Syntax: > + set rop=type:{renderer}(,{name}:{value})* +< + Currently, only one optional renderer is available. + + render behavior ~ + directx Vim will draw text using DirectX (DirectWrite). It makes + drawn glyphs more beautiful than default GDI. + It requires 'encoding' is "utf-8", and only works on + MS-Windows Vista or newer version. + + Options: + name meaning type value ~ + gamma gamma float 1.0 - 2.2 (maybe) + contrast enhancedContrast float (unknown) + level clearTypeLevel float (unknown) + geom pixelGeometry int 0 - 2 (see below) + renmode renderingMode int 0 - 6 (see below) + taamode textAntialiasMode int 0 - 3 (see below) + scrlines Scroll Lines int (deprecated) + + See this URL for detail (except for scrlines): + https://msdn.microsoft.com/en-us/library/dd368190.aspx + + For geom: structure of a device pixel. + 0 - DWRITE_PIXEL_GEOMETRY_FLAT + 1 - DWRITE_PIXEL_GEOMETRY_RGB + 2 - DWRITE_PIXEL_GEOMETRY_BGR + + See this URL for detail: + https://msdn.microsoft.com/en-us/library/dd368114.aspx + + For renmode: method of rendering glyphs. + 0 - DWRITE_RENDERING_MODE_DEFAULT + 1 - DWRITE_RENDERING_MODE_ALIASED + 2 - DWRITE_RENDERING_MODE_GDI_CLASSIC + 3 - DWRITE_RENDERING_MODE_GDI_NATURAL + 4 - DWRITE_RENDERING_MODE_NATURAL + 5 - DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC + 6 - DWRITE_RENDERING_MODE_OUTLINE + + See this URL for detail: + https://msdn.microsoft.com/en-us/library/dd368118.aspx + + For taamode: antialiasing mode used for drawing text. + 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT + 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE + 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE + 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED + + See this URL for detail: + https://msdn.microsoft.com/en-us/library/dd368170.aspx + + For scrlines: + This was used for optimizing scrolling behavior, however this + is now deprecated. If specified, it is simply ignored. + + Example: > + set encoding=utf-8 + set gfn=Ricty_Diminished:h12 + set rop=type:directx +< + If select a raster font (Courier, Terminal or FixedSys which + have ".fon" extension in file name) to 'guifont', it will be + drawn by GDI as a fallback. + + NOTE: It is known that some fonts and options combination + causes trouble on drawing glyphs. + + - 'renmode:5' and 'renmode:6' will not work with some + special made fonts (True-Type fonts which includes only + bitmap glyphs). + - 'taamode:3' will not work with some vector fonts. + + NOTE: With this option, you can display colored emoji + (emoticon) in Windows 8.1 or later. To display colored emoji, + there are some conditions which you should notice. + + - If your font includes non-colored emoji already, it will + be used. + - If your font doesn't have emoji, the system chooses an + alternative symbol font. On Windows 10, "Segoe UI Emoji" + will be used. + - When this alternative font didn't have fixed width glyph, + emoji might be rendered beyond the bounding box of drawing + cell. + + Other render types are currently not supported. + *'report'* 'report' number (default 2) global @@ -5797,7 +6443,9 @@ A jump table for the options with a short description can be found at |Q_op|. Inserting characters in Insert mode will work backwards. See "typing backwards" |ins-reverse|. This option can be toggled with the CTRL-_ command in Insert mode, when 'allowrevins' is set. - NOTE: This option is reset when 'compatible' or 'paste' is set. + NOTE: This option is reset when 'compatible' is set. + This option is reset when 'paste' is set and restored when 'paste' is + reset. *'rightleft'* *'rl'* *'norightleft'* *'norl'* 'rightleft' 'rl' boolean (default off) @@ -5829,8 +6477,20 @@ A jump table for the options with a short description can be found at |Q_op|. This is useful for languages such as Hebrew, Arabic and Farsi. The 'rightleft' option must be set for 'rightleftcmd' to take effect. + *'rubydll'* +'rubydll' string (default: depends on the build) + global + {not in Vi} + {only available when compiled with the |+ruby/dyn| + feature} + Specifies the name of the Ruby shared library. The default is + DYNAMIC_RUBY_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'ruler'* *'ru'* *'noruler'* *'noru'* -'ruler' 'ru' boolean (default off) +'ruler' 'ru' boolean (default off, set in |defaults.vim|) global {not in Vi} {not available when compiled without the @@ -5853,7 +6513,8 @@ A jump table for the options with a short description can be found at |Q_op|. separated with a dash. For an empty line "0-1" is shown. For an empty buffer the line number will also be zero: "0,0-1". - This option is reset when the 'paste' option is set. + This option is reset when 'paste' is set and restored when 'paste' is + reset. If you don't want to see the ruler all the time but want to know where you are, use "g CTRL-G" |g_CTRL-G|. NOTE: This option is reset when 'compatible' is set. @@ -5915,6 +6576,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| @@ -5936,6 +6598,10 @@ A jump table for the options with a short description can be found at |Q_op|. personal preferences to overrule or add to the distributed defaults or system-wide settings (rarely needed). + More entries are added when using |packages|. If it gets very long + then `:set rtp` will be truncated, use `:echo &rtp` to see the full + string. + 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 @@ -5952,6 +6618,8 @@ A jump table for the options with a short description can be found at |Q_op|. to find files which replace a distributed runtime files. You can put a directory after $VIMRUNTIME to find files which add to distributed runtime files. + When Vim is started with |--clean| the home directory entries are not + included. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5970,8 +6638,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'scrollbind' 'scb' boolean (default off) local to window {not in Vi} - {not available when compiled without the |+scrollbind| - feature} See also |scroll-binding|. When this option is set, the current window scrolls as other scrollbind windows (windows that also have this option set) scroll. This option is useful for viewing the @@ -5995,7 +6661,7 @@ A jump table for the options with a short description can be found at |Q_op|. NOTE: This option is set to 1 when 'compatible' is set. *'scrolloff'* *'so'* -'scrolloff' 'so' number (default 0) +'scrolloff' 'so' number (default 0, set to 5 in |defaults.vim|) global {not in Vi} Minimal number of screen lines to keep above and below the cursor. @@ -6009,8 +6675,6 @@ A jump table for the options with a short description can be found at |Q_op|. *'scrollopt'* *'sbo'* 'scrollopt' 'sbo' string (default "ver,jump") global - {not available when compiled without the |+scrollbind| - feature} {not in Vi} This is a comma-separated list of words that specifies how 'scrollbind' windows should behave. 'sbo' stands for ScrollBind @@ -6077,6 +6741,8 @@ A jump table for the options with a short description can be found at |Q_op|. "inclusive" means that the last character of the selection is included in an operation. For example, when "x" is used to delete the selection. + When "old" is used and 'virtualedit' allows the cursor to move past + the end of line the line break still isn't included. Note that when "exclusive" is used and selecting from the end backwards, you cannot include the last character of a line, when starting in Normal mode and 'virtualedit' empty. @@ -6098,7 +6764,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'sessionoptions'* *'ssop'* 'sessionoptions' 'ssop' string (default: "blank,buffers,curdir,folds, - help,options,tabpages,winsize") + help,options,tabpages,winsize,terminal") global {not in Vi} {not available when compiled without the |+mksession| @@ -6130,6 +6796,7 @@ A jump table for the options with a short description can be found at |Q_op|. tabpages all tab pages; without this only the current tab page is restored, so that you can make a session for each tab page separately + terminal include terminal windows where the command can be restored unix with Unix end-of-line format (single <NL>), even when on Windows or DOS winpos position of the whole Vim window @@ -6153,17 +6820,21 @@ A jump table for the options with a short description can be found at |Q_op|. It is allowed to give an argument to the command, e.g. "csh -f". See |option-backslash| about including spaces and backslashes. Environment variables are expanded |:set_env|. + If the name of the shell contains a space, you might need to enclose - it in quotes. Example: > + it in quotes or escape the space. Example with quotes: > :set shell=\"c:\program\ files\unix\sh.exe\"\ -f < Note the backslash before each quote (to avoid starting a comment) and each space (to avoid ending the option value). Also note that the "-f" is not inside the quotes, because it is not part of the command - name. And Vim automagically recognizes the backslashes that are path + name. Vim automagically recognizes the backslashes that are path separators. - For Dos 32 bits (DJGPP), you can set the $DJSYSFLAGS environment - variable to change the way external commands are executed. See the - libc.inf file of DJGPP. + Example with escaped space (Vim will do this when initializing the + option from $SHELL): > + :set shell=/bin/with\\\ space/sh +< The resulting value of 'shell' is "/bin/with\ space/sh", two + backslashes are consumed by `:set`. + Under MS-Windows, when the executable ends in ".com" it must be included. Thus setting the shell to "command.com" or "4dos.com" works, but "command" and "4dos" do not work for all commands (e.g., @@ -6183,8 +6854,7 @@ A jump table for the options with a short description can be found at |Q_op|. Flag passed to the shell to execute "!" and ":!" commands; e.g., "bash.exe -c ls" or "command.com /c dir". For the MS-DOS-like systems, the default is set according to the value of 'shell', to - reduce the need to set this option by the user. It's not used for - OS/2 (EMX figures this out itself). + reduce the need to set this option by the user. On Unix it can have more than one flag. Each white space separated part is passed as an argument to the shell command. See |option-backslash| about including spaces and backslashes. @@ -6301,6 +6971,10 @@ 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. + NOTE: This option is set to the Vim default value when 'compatible' + is reset. *'shelltype'* *'st'* 'shelltype' 'st' number (default 0) @@ -6406,6 +7080,9 @@ A jump table for the options with a short description can be found at |Q_op|. c don't give |ins-completion-menu| messages. For example, "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found", "Back at original", etc. + q use "recording" instead of "recording @a" + F don't give the file info when editing a file, like `:silent` + was used for the command This gives you the opportunity to avoid that a change between buffers requires you to hit <Enter>, but still gives as useful a message as @@ -6454,8 +7131,8 @@ A jump table for the options with a short description can be found at |Q_op|. "n" flag to 'cpoptions'. *'showcmd'* *'sc'* *'noshowcmd'* *'nosc'* -'showcmd' 'sc' boolean (Vim default: on, off for Unix, Vi default: - off) +'showcmd' 'sc' boolean (Vim default: on, off for Unix, + Vi default: off, set in |defaults.vim|) global {not in Vi} {not available when compiled without the @@ -6492,7 +7169,9 @@ A jump table for the options with a short description can be found at |Q_op|. jump is only done if the match can be seen on the screen. The time to show the match can be set with 'matchtime'. A Beep is given if there is no match (no matter if the match can be - seen or not). This option is reset when the 'paste' option is set. + seen or not). + This option is reset when 'paste' is set and restored when 'paste' is + reset. When the 'm' flag is not included in 'cpoptions', typing a character will immediately move the cursor back to where it belongs. See the "sm" field in 'guicursor' for setting the cursor shape and @@ -6558,10 +7237,21 @@ A jump table for the options with a short description can be found at |Q_op|. Example: Try this together with 'sidescroll' and 'listchars' as in the following example to never allow the cursor to move - onto the "extends" character: + onto the "extends" character: > :set nowrap sidescroll=1 listchars=extends:>,precedes:< :set sidescrolloff=1 +< + *'signcolumn'* *'scl'* +'signcolumn' 'scl' string (default "auto") + local to window + {not in Vi} + {not available when compiled without the |+signs| + feature} + Whether or not to draw the signcolumn. Valid values are: + "auto" only when there is a sign to display + "no" never + "yes" always *'smartcase'* *'scs'* *'nosmartcase'* *'noscs'* @@ -6601,8 +7291,9 @@ A jump table for the options with a short description can be found at |Q_op|. mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H. When using the ">>" command, lines starting with '#' are not shifted right. - NOTE: 'smartindent' is reset when 'compatible' is set. When 'paste' - is set smart indenting is disabled. + NOTE: This option is reset when 'compatible' is set. + This option is reset when 'paste' is set and restored when 'paste' is + reset. *'smarttab'* *'sta'* *'nosmarttab'* *'nosta'* 'smarttab' 'sta' boolean (default off) @@ -6618,6 +7309,8 @@ A jump table for the options with a short description can be found at |Q_op|. What gets inserted (a <Tab> or spaces) depends on the 'expandtab' option. Also see |ins-expandtab|. When 'expandtab' is not set, the number of spaces is minimized by using <Tab>s. + This option is reset when 'paste' is set and restored when 'paste' is + reset. NOTE: This option is reset when 'compatible' is set. *'softtabstop'* *'sts'* @@ -6632,7 +7325,8 @@ A jump table for the options with a short description can be found at |Q_op|. commands like "x" still work on the actual characters. When 'sts' is zero, this feature is off. When 'sts' is negative, the value of 'shiftwidth' is used. - 'softtabstop' is set to 0 when the 'paste' option is set. + 'softtabstop' is set to 0 when the 'paste' option is set and restored + when 'paste' is reset. See also |ins-expandtab|. When 'expandtab' is not set, the number of spaces is minimized by using <Tab>s. The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is @@ -6709,7 +7403,8 @@ A jump table for the options with a short description can be found at |Q_op|. the two-letter, lower case region name. You can use more than one region by listing them: "en_us,en_ca" supports both US and Canadian English, but not words specific for Australia, New Zealand or Great - Britain. + Britain. (Note: currently en_au and en_nz dictionaries are older than + en_ca, en_gb and en_us). If the name "cjk" is included East Asian characters are excluded from spell checking. This is useful when editing text that also has Asian words. @@ -6784,7 +7479,7 @@ A jump table for the options with a short description can be found at |Q_op|. word. The expression must evaluate to a List of Lists, each with a suggestion and a score. Example: - [['the', 33], ['that', 44]] + [['the', 33], ['that', 44]] ~ Set 'verbose' and use |z=| to see the scores that the internal methods use. A lower score is better. This may invoke |spellsuggest()| if you temporarily @@ -6845,7 +7540,7 @@ A jump table for the options with a short description can be found at |Q_op|. The option consists of printf style '%' items interspersed with normal text. Each status line item is of the form: %-0{minwid}.{maxwid}{item} - All fields except the {item} is optional. A single percent sign can + All fields except the {item} are optional. A single percent sign can be given as "%%". Up to 80 items can be specified. *E541* When the option starts with "%!" then it is used as an expression, @@ -6897,7 +7592,6 @@ A jump table for the options with a short description can be found at |Q_op|. W F Preview window flag, text is ",PRV". y F Type of file in the buffer, e.g., "[vim]". See 'filetype'. Y F Type of file in the buffer, e.g., ",VIM". See 'filetype'. - {not available when compiled without |+autocmd| feature} q S "[Quickfix List]", "[Location List]" or empty. k S Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are being used: "<keymap>" @@ -6921,7 +7615,9 @@ A jump table for the options with a short description can be found at |Q_op|. a S Argument list status as in default title. ({current} of {max}) Empty if the argument file count is zero or one. { NF Evaluate expression between '%{' and '}' and substitute result. - Note that there is no '%' before the closing '}'. + Note that there is no '%' before the closing '}'. The + expression cannot contain a '}' character, call a function to + work around that. ( - Start of item group. Can be used for setting the width and alignment of a section. Must be followed by %) somewhere. ) - End of item group. No width fields allowed. @@ -6953,7 +7649,7 @@ A jump table for the options with a short description can be found at |Q_op|. become empty. This will make a group like the following disappear completely from the statusline when none of the flags are set. > :set statusline=...%(\ [%M%R%H]%)... -< +< *g:actual_curbuf* Beware that an expression is evaluated each and every time the status line is displayed. The current buffer and current window will be set temporarily to that of the window (and buffer) whose statusline is @@ -6978,7 +7674,7 @@ A jump table for the options with a short description can be found at |Q_op|. Watch out for errors in expressions. They may render Vim unusable! If you are stuck, hold down ':' or 'Q' to get a prompt, then quit and - edit your .vimrc or whatever with "vim -u NONE" to get it right. + edit your .vimrc or whatever with "vim --clean" to get it right. Examples: Emulate standard status line with 'ruler' set > @@ -7042,6 +7738,7 @@ A jump table for the options with a short description can be found at |Q_op|. Also see |swap-file| and |'swapsync'|. If you want to open a new buffer without creating a swap file for it, use the |:noswapfile| modifier. + See 'directory' for where the swap file is created. This option is used together with 'bufhidden' and 'buftype' to specify special kinds of buffers. See |special-buffers|. @@ -7079,6 +7776,7 @@ A jump table for the options with a short description can be found at |Q_op|. split If included, split the current window before loading a buffer for a |quickfix| command that display errors. Otherwise: do not split, use current window. + vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. @@ -7209,19 +7907,25 @@ A jump table for the options with a short description can be found at |Q_op|. < [The whitespace before and after the '0' must be a single <Tab>] When a binary search was done and no match was found in any of the - files listed in 'tags', and 'ignorecase' is set or a pattern is used + files listed in 'tags', and case is ignored or a pattern is used instead of a normal tag name, a retry is done with a linear search. Tags in unsorted tags files, and matches with different case will only be found in the retry. If a tag file indicates that it is case-fold sorted, the second, - linear search can be avoided for the 'ignorecase' case. Use a value - of '2' in the "!_TAG_FILE_SORTED" line for this. A tag file can be - case-fold sorted with the -f switch to "sort" in most unices, as in - the command: "sort -f -o tags tags". For "Exuberant ctags" version - 5.x or higher (at least 5.5) the --sort=foldcase switch can be used - for this as well. Note that case must be folded to uppercase for this - to work. + linear search can be avoided when case is ignored. Use a value of '2' + in the "!_TAG_FILE_SORTED" line for this. A tag file can be case-fold + sorted with the -f switch to "sort" in most unices, as in the command: + "sort -f -o tags tags". For "Exuberant ctags" version 5.x or higher + (at least 5.5) the --sort=foldcase switch can be used for this as + well. Note that case must be folded to uppercase for this to work. + + By default, tag searches are case-sensitive. Case is ignored when + 'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is + "ignore". + Also when 'tagcase' is "followscs" and 'smartcase' is set, or + 'tagcase' is "smart", and the pattern contains only lowercase + characters. When 'tagbsearch' is off, tags searching is slower when a full match exists, but faster when no full match exists. Tags in unsorted tags @@ -7233,6 +7937,20 @@ A jump table for the options with a short description can be found at |Q_op|. command-line completion and ":help"). {Vi: always uses binary search in some versions} + *'tagcase'* *'tc'* +'tagcase' 'tc' string (default "followic") + global or local to buffer |global-local| + {not in Vi} + This option specifies how case is handled when searching the tags + file: + followic Follow the 'ignorecase' option + followscs Follow the 'smartcase' and 'ignorecase' options + ignore Ignore case + match Match case + smart Ignore case unless an upper case letter is used + NOTE: This option is set to the Vi default value when 'compatible' is + set and to the Vim default value when 'compatible' is reset. + *'taglength'* *'tl'* 'taglength' 'tl' number (default 0) global @@ -7287,6 +8005,18 @@ 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. + *'tcldll'* +'tcldll' string (default depends on the build) + global + {not in Vi} + {only available when compiled with the |+tcl/dyn| + feature} + Specifies the name of the Tcl shared library. The default is + DYNAMIC_TCL_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'term'* *E529* *E530* *E531* 'term' string (default is $TERM, if that fails: in the GUI: "builtin_gui" @@ -7325,7 +8055,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'termencoding'* *'tenc'* 'termencoding' 'tenc' string (default "" - with GTK+ 2 and MacVim GUIs: "utf-8" + with GTK+ and MacVim GUIs: "utf-8" with Macintosh (Carbon) GUI: "macroman") global {only available when compiled with the |+multi_byte| @@ -7333,17 +8063,15 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Encoding used for the terminal. This specifies what character encoding the keyboard produces and the display will understand. For - the GUI it only applies to the keyboard ( 'encoding' is used for the + the GUI it only applies to the keyboard ('encoding' is used for the display). Except for the Mac when 'macatsui' is off, then - 'termencoding' should be "macroman" (for the Carbon GUI). - In the Win32 console version the default value is the console codepage - when it differs from the ANSI codepage. + 'termencoding' should be "macroman". *E617* - Note: This does not apply to the GTK+ 2 and MacVim GUIs. After the + Note: This does not apply to the GTK+ and MacVim GUIs. After the GUI has been successfully initialized, 'termencoding' is forcibly set to "utf-8". Any attempts to set a different value will be rejected, and an error message is shown. - For the Win32 GUI 'termencoding' is not used for typed characters, + For the Win32 GUI and console versions 'termencoding' is not used, because the Win32 system always passes Unicode characters. When empty, the same encoding is used as for the 'encoding' option. This is the normal value. @@ -7358,6 +8086,75 @@ A jump table for the options with a short description can be found at |Q_op|. :set encoding=utf-8 < You need to do this when your system has no locale support for UTF-8. + *'termguicolors'* *'tgc'* *E954* +'termguicolors' 'tgc' boolean (default off) + global + {not in Vi} + {not available when compiled without the + |+termguicolors| feature} + When on, uses |highlight-guifg| and |highlight-guibg| attributes in + the terminal (thus using 24-bit color). + + Requires a ISO-8613-3 compatible terminal. If setting this option + does not work (produces a colorless UI) reading |xterm-true-color| + might help. + + For Win32 console, Windows 10 version 1703 (Creators Update) or later + is required. Use this check to find out: > + if has('vcon') +< This requires Vim to be built with the |+vtp| feature. + + Note that the "cterm" attributes are still used, not the "gui" ones. + NOTE: This option is reset when 'compatible' is set. + + *'termwinscroll'* *'twsl'* +'termwinscroll' 'twsl' number (default 10000) + local to buffer + {not in Vi} + {not available when compiled without the + |+terminal| feature} + Number of scrollback lines to keep. When going over this limit the + first 10% of the scrollback lines are deleted. This is just to reduce + the memory usage. See |Terminal-Normal|. + + *'termwinkey'* *'twk'* +'termwinkey' 'twk' string (default "") + local to window + {not in Vi} + The key that starts a CTRL-W command in a terminal window. Other keys + are sent to the job running in the window. + The <> notation can be used, e.g.: > + :set termwinkey=<C-L> +< The string must be one key stroke but can be multiple bytes. + When not set CTRL-W is used, so that CTRL-W : gets you to the command + line. If 'termwinkey' is set to CTRL-L then CTRL-L : gets you to the + command line. + + *'termwinsize'* *'tws'* +'termwinsize' 'tws' string (default "") + local to window + {not in Vi} + Size of the |terminal| window. Format: {rows}x{columns} or + {rows}*{columns}. + - When empty the terminal gets the size from the window. + - When set with a "x" (e.g., "24x80") the terminal size is not + adjusted to the window size. If the window is smaller only the + top-left part is displayed. + - When set with a "*" (e.g., "10*50") the terminal size follows the + window size, but will not be smaller than the specified rows and/or + columns. + - When rows is zero then use the height of the window. + - When columns is zero then use the width of the window. + - Using "0x0" or "0*0" is the same as empty. + + Examples: + "30x0" uses 30 rows and the current window width. + "20*0" uses at least 20 rows and the current window width. + "0*40" uses the current window height and at least 40 columns. + Note that the command running in the terminal window may still change + the size of the terminal. In that case the Vim window will be + adjusted to that size, if possible. + *'terse'* *'noterse'* 'terse' boolean (default off) global @@ -7393,8 +8190,10 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} Maximum width of text that is being inserted. A longer line will be broken after white space to get this width. A zero value disables - this. 'textwidth' is set to 0 when the 'paste' option is set. When - 'textwidth' is zero, 'wrapmargin' may be used. See also + this. + 'textwidth' is set to 0 when the 'paste' option is set and restored + when 'paste' is reset. + When 'textwidth' is zero, 'wrapmargin' may be used. See also 'formatoptions' and |ins-textwidth|. When 'formatexpr' is set it will be used to break the line. NOTE: This option is set to 0 when 'compatible' is set. @@ -7409,6 +8208,7 @@ A jump table for the options with a short description can be found at |Q_op|. non-keyword characters (white space is preferred). Maximum line length is 510 bytes. To obtain a file to be used here, check out this ftp site: + [Sorry this link doesn't work anymore, do you know the right one?] ftp://ftp.ox.ac.uk/pub/wordlists/ First get the README file. To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file @@ -7429,7 +8229,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'timeout' 'to' boolean (default on) global *'ttimeout'* *'nottimeout'* -'ttimeout' boolean (default off) +'ttimeout' boolean (default off, set in |defaults.vim|) global {not in Vi} These two options together determine the behavior when part of a @@ -7464,7 +8264,7 @@ A jump table for the options with a short description can be found at |Q_op|. global {not in all versions of Vi} *'ttimeoutlen'* *'ttm'* -'ttimeoutlen' 'ttm' number (default -1) +'ttimeoutlen' 'ttm' number (default -1, set to 100 in |defaults.vim|) global {not in Vi} The time in milliseconds that is waited for a key code or mapped key @@ -7559,7 +8359,7 @@ A jump table for the options with a short description can be found at |Q_op|. Amiga console, Win32 console, all GUI versions and terminals with a non-empty 't_ts' option). When Vim was compiled with HAVE_X11 defined, the original title will - be restored if possible |X11|. + be restored if possible, see |X11|. When this option contains printf-style '%' items, they will be expanded according to the rules used for 'statusline'. Example: > @@ -7608,16 +8408,18 @@ A jump table for the options with a short description can be found at |Q_op|. 'toolbariconsize' 'tbis' string (default "small") global {not in Vi} - {only in the GTK+ 2 and MacVim GUIs} + {only in the GTK+ and MacVim GUIs} Controls the size of toolbar icons. The possible values are: - tiny Use tiny toolbar icons. - small Use small toolbar icons (default). - medium Use medium-sized toolbar icons. - large Use large toolbar icons. + tiny Use tiny icons. + small Use small icons (default). + medium Use medium-sized icons. + large Use large icons. + huge Use even larger icons. + giant Use very big icons. The exact dimensions in pixels of the various icon sizes depend on - the current theme. Common dimensions are large=32x32, medium=24x24, - small=20x20 and tiny=16x16. In MacVim, both tiny and small equal - 24x24, whereas medium and large equal 32x32. + the current theme. Common dimensions are giant=48x48, huge=32x32, + large=24x24, medium=24x24, small=20x20 and tiny=16x16. In MacVim, both + tiny and small equal 24x24, whereas medium and large equal 32x32. If 'toolbariconsize' is empty, the global default size as determined by user preferences or the current theme is used. @@ -7716,14 +8518,15 @@ A jump table for the options with a short description can be found at |Q_op|. "xterm", "xterm2", "urxvt" or "sgr" (because dec mouse codes conflict with them). This option is automatically set to "xterm", when the 'term' option is - set to a name that starts with "xterm", "mlterm", or "screen", and - 'ttymouse' is not set already. + set to a name that starts with "xterm", "mlterm", "screen", "tmux", + "st" (full match only), "st-" or "stterm", and 'ttymouse' is not set + already. Additionally, if vim is compiled with the |+termresponse| feature and |t_RV| is set to the escape sequence to request the xterm version number, more intelligent detection process runs. The "xterm2" value will be set if the xterm version is reported to be from 95 to 276. The "sgr" value will be set if the xterm version is - 277 or highter. + 277 or higher and when Vim detects Mac Terminal.app or iTerm2. If you do not want 'ttymouse' to be set to "xterm2" or "sgr" automatically, set t_RV to an empty string: > :set t_RV= @@ -7772,6 +8575,7 @@ A jump table for the options with a short description can be found at |Q_op|. The undo file is not read when 'undoreload' causes the buffer from before a reload to be saved for undo. When 'undofile' is turned off the undo file is NOT deleted. + NOTE: This option is reset when 'compatible' is set. *'undolevels'* *'ul'* 'undolevels' 'ul' number (default 100, 1000 for Unix, VMS, @@ -7791,6 +8595,9 @@ A jump table for the options with a short description can be found at |Q_op|. current buffer: > setlocal ul=-1 < This helps when you run out of memory for a single change. + + The local value is set to -123456 when the global value is to be used. + Also see |clear-undo|. *'undoreload'* *'ur'* @@ -7800,7 +8607,7 @@ A jump table for the options with a short description can be found at |Q_op|. Save the whole buffer for undo when reloading it. This applies to the ":e!" command and reloading for when the buffer changed outside of Vim. |FileChangedShell| - The save only happens when this options is negative or when the number + The save only happens when this option is negative or when the number of lines is smaller than the value of this option. Set this option to zero to disable undo for a reload. @@ -7885,7 +8692,7 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'viewoptions'* *'vop'* -'viewoptions' 'vop' string (default: "folds,options,cursor") +'viewoptions' 'vop' string (default: "folds,options,cursor,curdir") global {not in Vi} {not available when compiled without the |+mksession| @@ -7898,10 +8705,12 @@ A jump table for the options with a short description can be found at |Q_op|. fold options options options and mappings local to a window or buffer (not global values for local options) + localoptions same as "options" slash backslashes in file names replaced with forward slashes unix with Unix end-of-line format (single <NL>), even when on Windows or DOS + curdir the window-local directory, if set with `:lcd` "slash" and "unix" are useful on Windows when sharing view files with Unix. The Unix version of Vim cannot source dos format scripts, @@ -7917,13 +8726,14 @@ A jump table for the options with a short description can be found at |Q_op|. {not available when compiled without the |+viminfo| feature} When non-empty, the viminfo file is read upon startup and written - when exiting Vim (see |viminfo-file|). The string should be a comma - separated list of parameters, each consisting of a single character - identifying the particular parameter, followed by a number or string - which specifies the value of that parameter. If a particular - character is left out, then the default value is used for that - parameter. The following is a list of the identifying characters and - the effect of their value. + when exiting Vim (see |viminfo-file|). Except when 'viminfofile' is + "NONE". + The string should be a comma separated list of parameters, each + consisting of a single character identifying the particular parameter, + followed by a number or string which specifies the value of that + parameter. If a particular character is left out, then the default + value is used for that parameter. The following is a list of the + identifying characters and the effect of their value. CHAR VALUE ~ *viminfo-!* ! When included, save and restore global variables that start @@ -7940,9 +8750,9 @@ A jump table for the options with a short description can be found at |Q_op|. % When included, save and restore the buffer list. If Vim is started with a file name argument, the buffer list is not restored. If Vim is started without a file name argument, the - buffer list is restored from the viminfo file. Buffers - without a file name and buffers for help files are not written - to the viminfo file. + buffer list is restored from the viminfo file. Quickfix + ('buftype'), unlisted ('buflisted'), unnamed and buffers on + removable media (|viminfo-r|) are not saved. When followed by a number, the number specifies the maximum number of buffers that are stored. Without a number all buffers are stored. @@ -7983,10 +8793,10 @@ A jump table for the options with a short description can be found at |Q_op|. has been used since the last search command. *viminfo-n* n Name of the viminfo file. The name must immediately follow - the 'n'. Must be the last one! If the "-i" argument was - given when starting Vim, that file name overrides the one - given here with 'viminfo'. Environment variables are expanded - when opening the file, not when setting the option. + the 'n'. Must be at the end of the option! If the + 'viminfofile' option is set, that file name overrides the one + given here with 'viminfo'. Environment variables are + expanded when opening the file, not when setting the option. *viminfo-r* r Removable media. The argument is a string (up to the next ','). This parameter can be given several times. Each @@ -8023,6 +8833,19 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. + NOTE: This option is set to the Vim default value when 'compatible' + is reset. + + *'viminfofile'* *'vif'* +'viminfofile' 'vif' string (default: "") + global + {not in Vi} + {not available when compiled without the |+viminfo| + feature} + When non-empty, overrides the file name used for viminfo. + When equal to "NONE" no viminfo file will be read or written. + This option can be set with the |-i| command line flag. The |--clean| + command line flag sets it to "NONE". *'virtualedit'* *'ve'* 'virtualedit' 've' string (default "") @@ -8051,19 +8874,33 @@ A jump table for the options with a short description can be found at |Q_op|. The `g$` command will move to the end of the screen line. It doesn't make sense to combine "all" with "onemore", but you will not get a warning for it. + NOTE: This option is set to "" when 'compatible' is set. *'visualbell'* *'vb'* *'novisualbell'* *'novb'* *beep* 'visualbell' 'vb' boolean (default off) global {not in Vi} - Use visual bell instead of beeping. The terminal code to display the + Use a visual bell instead of beeping. The terminal code to display the visual bell is given with 't_vb'. When no beep or flash is wanted, - use ":set vb t_vb=". - Note: When the GUI starts, 't_vb' is reset to its default value. You - might want to set it again in your |gvimrc|. + use: > + :set vb t_vb= +< If you want a short flash, you can use this on many terminals: > + :set vb t_vb=[?5h$<100>[?5l +< Here $<100> specifies the time, you can use a smaller or bigger value + to get a shorter or longer flash. + + Note: Vim will limit the bell to once per half a second. This avoids + having to wait for the flashing to finish when there are lots of + bells, e.g. on key repeat. This also happens without 'visualbell' + set. + In the GUI, 't_vb' defaults to "<Esc>|f", which inverts the display for 20 msec. If you want to use a different time, use "<Esc>|40f", where 40 is the time in msec. + + Note: When the GUI starts, 't_vb' is reset to its default value. You + might want to set it again in your |gvimrc|. + Does not work on the Amiga, you always get a screen flash. Also see 'errorbells'. @@ -8172,7 +9009,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'* -'wildmenu' 'wmnu' boolean (default off) +'wildmenu' 'wmnu' boolean (default off, set in |defaults.vim|) global {not in Vi} {not available if compiled without the |+wildmenu| @@ -8378,6 +9215,20 @@ A jump table for the options with a short description can be found at |Q_op|. large number, it will cause errors when opening more than a few windows. A value of 0 to 12 is reasonable. + *'winptydll'* +'winptydll' string (default "winpty32.dll" or "winpty64.dll") + global + {not in Vi} + {only available when compiled with the |terminal| + feature on MS-Windows} + Specifies the name of the winpty shared library, used for the + |:terminal| command. The default depends on whether was build as a + 32-bit or 64-bit executable. If not found, "winpty.dll" is tried as + a fallback. + Environment variables are expanded |:set_env|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'winwidth'* *'wiw'* *E592* 'winwidth' 'wiw' number (default 20) global @@ -8423,6 +9274,8 @@ A jump table for the options with a short description can be found at |Q_op|. Options that add a margin, such as 'number' and 'foldcolumn', cause the text width to be further reduced. This is Vi compatible. When 'textwidth' is non-zero, this option is not used. + This option is set to 0 when 'paste' is set and restored when 'paste' + is reset. See also 'formatoptions' and |ins-textwidth|. {Vi: works differently and less usefully} @@ -8469,7 +9322,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'writedelay' 'wd' number (default 0) global {not in Vi} - The number of microseconds to wait for each character sent to the + The number of milliseconds to wait for each character sent to the screen. When non-zero, characters are sent to the terminal one by one. For MS-DOS pcterm this does not work. For debugging purposes. diff --git a/runtime/doc/os_390.txt b/runtime/doc/os_390.txt index 5e564d8416..5b4b9f7a6f 100644 --- a/runtime/doc/os_390.txt +++ b/runtime/doc/os_390.txt @@ -1,4 +1,4 @@ -*os_390.txt* For Vim version 7.4. Last change: 2010 May 30 +*os_390.txt* For Vim version 8.1. Last change: 2016 Feb 27 VIM REFERENCE MANUAL by Ralf Schandl @@ -108,7 +108,6 @@ Never tested: - Langmap (|'langmap'|) - Python support (|Python|) - Right-to-left mode (|'rightleft'|) - - SNiFF+ interface (|sniff|) - TCL interface (|tcl|) ... diff --git a/runtime/doc/os_amiga.txt b/runtime/doc/os_amiga.txt index b9ac611129..ad083b58a8 100644 --- a/runtime/doc/os_amiga.txt +++ b/runtime/doc/os_amiga.txt @@ -1,4 +1,4 @@ -*os_amiga.txt* For Vim version 7.4. Last change: 2010 Aug 14 +*os_amiga.txt* For Vim version 8.1. Last change: 2010 Aug 14 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/os_beos.txt b/runtime/doc/os_beos.txt index 5099ae6126..148f5fe0e7 100644 --- a/runtime/doc/os_beos.txt +++ b/runtime/doc/os_beos.txt @@ -1,4 +1,4 @@ -*os_beos.txt* For Vim version 7.4. Last change: 2010 Aug 14 +*os_beos.txt* For Vim version 8.1. Last change: 2016 Mar 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -248,8 +248,9 @@ reality. Vim uses this mapping: Button 3 -> MiddleMouse. If your mouse has fewer than 3 buttons you can provide your own mapping from -mouse clicks with modifier(s) to other mouse buttons. See the file -vim-5.x/macros/swapmous.vim for an example. |gui-mouse-mapping| +mouse clicks with modifier(s) to other mouse buttons. See the swapmouse +package for an example: |gui-mouse-mapping| +$VIMRUNTIME/pack/dist/opt/swapmouse/plugin/swapmouse.vim 12. Color names *beos-colors* diff --git a/runtime/doc/os_dos.txt b/runtime/doc/os_dos.txt index 245a31846f..b950953022 100644 --- a/runtime/doc/os_dos.txt +++ b/runtime/doc/os_dos.txt @@ -1,4 +1,4 @@ -*os_dos.txt* For Vim version 7.4. Last change: 2006 Mar 30 +*os_dos.txt* For Vim version 8.1. Last change: 2006 Mar 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -94,6 +94,7 @@ Shift-Insert paste text (from clipboard) *<S-Insert>* CTRL-Insert copy Visual text (to clipboard) *<C-Insert>* CTRL-Del cut Visual text (to clipboard) *<C-Del>* Shift-Del cut Visual text (to clipboard) *<S-Del>* +CTRL-X cut Visual text (to clipboard) These mappings accomplish this (Win32 and DJGPP versions of Vim): @@ -102,6 +103,7 @@ Shift-Insert <M-N><M-T> "*P "-d"*P <C-R><C-O>* CTRL-Insert <M-N><M-U> "*y Shift-Del <M-N><M-W> "*d CTRL-Del <M-N><M-X> "*d +CTRL-X <C-X> "*d Or these mappings (non-Win32 version of Vim): diff --git a/runtime/doc/os_mac.txt b/runtime/doc/os_mac.txt index 028b3c98a0..1bb94ab1bf 100644 --- a/runtime/doc/os_mac.txt +++ b/runtime/doc/os_mac.txt @@ -1,4 +1,4 @@ -*os_mac.txt* For Vim version 7.4. Last change: 2006 Apr 30 +*os_mac.txt* For Vim version 8.1. Last change: 2018 Jan 21 VIM REFERENCE MANUAL by Bram Moolenaar et al. @@ -16,11 +16,13 @@ Carbon version of Vim here: http://macvim.org/ 1. Filename Convention |mac-filename| -2. .vimrc an .vim files |mac-vimfile| -3. FAQ |mac-faq| -4. Known Lack |mac-lack| -5. Mac Bug Report |mac-bug| -6. Compiling Vim |mac-compile| +2. .vimrc and .vim files |mac-vimfile| +3. Standard mappings |mac-standard-mappings| +4. FAQ |mac-faq| +5. Known Lack |mac-lack| +6. Mac Bug Report |mac-bug| +7. Compiling Vim |mac-compile| +8. The darwin feature |mac-darwin-feature| There was a Mac port for version 3.0 of Vim. Here are the first few lines from the old file: @@ -76,7 +78,18 @@ the |'nocompatible'| option is set, otherwise it will only handle mac format files. ============================================================================== -3. Mac FAQ *mac-faq* +3. Standard mappings *mac-standard-mappings* + +The following mappings are available for cut/copy/paste from/to clipboard. + +key Normal Visual Insert Description ~ +Command-v "*P "-d"*P <C-R>* paste text *<D-v>* +Command-c "*y copy Visual text *<D-c>* +Command-x "*d cut Visual text *<D-x>* +Backspace "*d cut Visual text + +============================================================================== +4. Mac FAQ *mac-faq* On the internet: http://macvim.org/OSX/index.php#FAQ @@ -99,13 +112,13 @@ A: The following trick works with most shells. Put it in your vimrc file. let $PATH = matchstr(s:path, 'VIMPATH\zs.\{-}\ze\n') ============================================================================== -4. Mac Lack *mac-lack* +5. Mac Lack *mac-lack* In a terminal CTRL-^ needs to be entered as Shift-Control-6. CTRL-@ as Shift-Control-2. ============================================================================== -5. Mac Bug Report *mac-bug* +6. Mac Bug Report *mac-bug* When reporting any Mac specific bug or feature change, please use the vim-mac maillist |vim-mac|. However, you need to be subscribed. An alternative is to @@ -114,9 +127,60 @@ send a message to the current MacVim maintainers: mac@vim.org ============================================================================== -6. Compiling Vim *mac-compile* +7. Compiling Vim *mac-compile* See the file "src/INSTALLmac.txt" that comes with the source files. +============================================================================== +8. The Darwin Feature *mac-darwin-feature* + +If you have a Mac that isn't very old, you will be running OS X, also called +Darwin. The last pre-Darwin OS was Mac OS 9. The darwin feature makes Vim +use Darwin-specific properties. + +What is accomplished with this feature is two-fold: + +- Make Vim interoperable with the system clipboard. +- Incorporate into Vim a converter module that bridges the gap between some + character encodings specific to the platform and those known to Vim. + +Needless to say, both are not to be missed for any decent text editor to work +nicely with other applications running on the same desktop environment. + +As Vim is not an application dedicated only to macOS, we need an extra feature +to add in order for it to offer the same user experience that our users on +other platforms enjoy to people on macOS. + +For brevity, the feature is referred to as "darwin" to signify it one of the +Vim features that are specific to that particular platform. + +The feature is a configuration option. Accordingly, whether it is enabled or +not is determined at build time; once it is selected to be enabled, it is +compiled in and hence cannot be disabled at runtime. + +The feature is enabled by default. For most macOS users, that should be +sufficient unless they have specific needs mentioned briefly below. + +If you want to disable it, pass `--disable-darwin` to the configure script: > + + ./configure --disable-darwin <other options> + +and then run `make` to build Vim. The order of the options doesn't matter. + +To make sure at runtime whether or not the darwin feature is compiled in, you +can use `has('osxdarwin')` which returns 1 if the feature is compiled in; 0 +otherwise. For backward compatibility, you can still use `macunix` instead of +`osxdarwin`. + +Notable use cases where `--disable-darwin` is turned out to be useful are: + +- When you want to use |x11-selection| instead of the system clipboard. +- When you want to use |x11-clientserver|. + +Since both have to make use of X11 inter-client communication for them to work +properly, and since the communication mechanism can come into conflict with +the system clipboard, the darwin feature should be disabled to prevent Vim +from hanging at runtime. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/os_mint.txt b/runtime/doc/os_mint.txt index d44b1a4f40..96e139d3e7 100644 --- a/runtime/doc/os_mint.txt +++ b/runtime/doc/os_mint.txt @@ -1,4 +1,4 @@ -*os_mint.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*os_mint.txt* For Vim version 8.1. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Jens M. Felderhoff diff --git a/runtime/doc/os_msdos.txt b/runtime/doc/os_msdos.txt index bd996be0c3..50fb4e899d 100644 --- a/runtime/doc/os_msdos.txt +++ b/runtime/doc/os_msdos.txt @@ -1,276 +1,15 @@ -*os_msdos.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*os_msdos.txt* For Vim version 8.1. Last change: 2016 Feb 26 VIM REFERENCE MANUAL by Bram Moolenaar *msdos* *ms-dos* *MSDOS* *MS-DOS* -This file contains the particularities for the MS-DOS version of Vim. +This file used to contain the particularities for the MS-DOS version of Vim. +MS-DOS support was removed in patch 7.4.1399. If you want to use it you will +need to get a version older than that. Note that the MS-DOS version doesn't +work, there is not enough memory. The DOS32 version (using DJGPP) might still +work on older systems. -1. Two versions for MS-DOS |msdos-versions| -2. Known problems |msdos-problems| -3. Long file names |msdos-longfname| -4. Termcap codes |msdos-termcap| -5. Shifted arrow keys |msdos-arrows| -6. Filename extensions |msdos-fname-extensions| -7. Memory usage and limitations |msdos-limitations| -8. Symbolically linked files |msdos-linked-files| -9. Copy/paste in a dos box |msdos-copy-paste| - -Additionally, there are a number of common Win32 and DOS items: -File locations |dos-locations| -Using backslashes |dos-backslash| -Standard mappings |dos-standard-mappings| -Screen output and colors |dos-colors| -File formats |dos-file-formats| -:cd command |dos-:cd| -Interrupting |dos-CTRL-Break| -Temp files |dos-temp-files| -Shell option default |dos-shell| - -For compiling Vim see src/INSTALL.pc. *msdos-compiling* - -============================================================================== -1. Two versions for MS-DOS *msdos-versions* - -There are two versions of Vim that can be used with MS-DOS machines: - - *dos16* -Dos16 version Can be used on any MS-DOS system, only uses up to 640 Kbyte of - memory. Also runs on OS/2, Windows 95, and NT. Excludes some - Vim-specific features (autocommands, syntax highlighting, - etc.). Recommended for use on pre-386 machines. - *dos32* -Dos32 version Requires 386 processor and a |DPMI| driver, uses all - available memory. Supports long file names and the Windows - clipboard, but NOT on Windows NT. Recommended for MS-DOS, - Windows 3.1 and Windows 95. - -There are also two versions that run under Windows: -Win32 version Requires Windows 95 or Windows NT, uses all available - memory, supports long file names, etc. Has some problems on - Windows 95. Recommended for Windows NT. See |os_win32.txt| -Win32 GUI Requirements like the Win32 version, but runs in its own - window, instead of a console. Has scrollbars, menu, etc. - Recommended for Windows 95 and Windows NT. See |gui-w32|. - -It is recommended to use the Dos32 or Win32 version. Although the Dos16 -version is able to edit very big files, it quickly runs out of memory when -making big changes. Disabling undo helps: ":set ul=-1". The screen updating -of the Dos16 version is the fastest of the three on DOS or Windows 95; on -Windows NT, the Win32 version is just as fast. - - *DPMI* -For the Dos32 version, you may need a DPMI driver when running in MS-DOS. If -you are running Windows or installed a clever memory manager, it will probably -work already. If you get the message "No DPMI", you need to install a DPMI -driver. Such a driver is included with the executable in CSDPMI4B.ZIP. Run -"cwsdpmi" just before starting Vim each time. Or you might want to include -"cwsdpmi -p" in your autoexec.bat to make it resident. The latest version of -"CSDPMI*.ZIP" can be obtained from: "ftp.neosoft.com:pub/users/s/sandmann". - - *minimal-features* -The 16 bit DOS version has been compiled with minimal features. Check the -|+feature-list| which ones are included (marked with a "T"). -You can include more features by editing feature.h and recompiling. - -============================================================================== -2. Known problems *msdos-problems* - -When using smartdrive (MS-DOS 6.x) with write-behind caching, it is possible -that Vim will try to create a swap file on a read-only file system (e.g. -write protected floppy). You will then be given the message > - A serious disk error has occurred .., Retry (r)? -There is nothing you can do but unprotect the floppy or switch off the -computer. Even CTRL-ALT-DEL will not get you out of this. This is really a -problem of smartdrive, not Vim. Smartdrive works fine otherwise. If this -bothers you, don't use the write-behind caching. - -Vim can't read swap files that have been opened already, unless the "share" -command has been used. If you see stray warnings for existing swap files, -include the "share" command in your config.sys or autoexec.bat (see your MSDOS -documentation). - -The Dos16 version can only have about 10 files open (in a window or hidden) at -one time. With more files you will get error messages when trying to read or -write a file, and for filter commands. Or Vim runs out of memory, and random -problems may result. - -The Dos32 version cannot have an unlimited number of files open at any one -time. The limit depends on the setting of FILES in your CONFIG.SYS. This -defaults to 15; if you need to edit a lot of files, you should increase this. -If you do not set FILES high enough, you can get strange errors, and shell -commands may cause a crash! - -The Dos32 version can work with long file names. When doing file name -completion, matches for the short file name will also be found. But this will -result in the corresponding long file name. For example, if you have the long -file name "this_is_a_test" with the short file name "this_i~1", the command -":e *1" will start editing "this_is_a_test". - -When using the Dos32 version and you run into problems with DPMI support, -check if there is a program in your config.sys that eats resources. One -program known to cause this problem is "netx", which says "NetWare v. 3.26 -Workstation shell". Replace it with version 3.32 to fix the problem. - -The Dos32 version will parse its arguments to handle quotation. This is good -to edit a file with spaces in its name, for example: > - vim "program files\accessories\ppp.scp" -A side effect is that single quotes are removed. Insert a backslash to avoid -that. For example, to edit the file "fi'le.txt": > - vim fi\'le.txt - -============================================================================== -3. Long file names *msdos-longfname* - -If the Dos32 version is run on Windows 95, it can use long file names. It -will work by default. If you want to disable this, use this setting: - set LFN=N -You can put this in your autoexec.bat file. - -Note: If you have installed DJGPP on your machine, you probably have a -"djgpp.env" file, which contains "LFN=n". You need to use "LFN=Y" to switch -on using long file names then. - -============================================================================== -4. Termcap codes *msdos-termcap* - -If you want to use another output method (e.g., when using a terminal on a COM -port), set the terminal name to "pcansi". You can change the termcap options -when needed (see |terminal-options|). Note that the -normal IBM ansi.sys does not support all the codes of the builtin pcansi -terminal. If you use ansi.sys, you will need to delete the termcap entries -t_al and t_dl with > - :set t_al= t_dl= -Otherwise, the screen will not be updated correctly. It is better to use -nansi.sys, nnansi.sys, or the like instead of ansi.sys. - -If you want to use Vim on a terminal connected to a COM: port, reset the -'bioskey' option. Otherwise the commands will be read from the PC keyboard. -CTRL-C and CTRL-P may not work correctly with 'bioskey' reset. - -============================================================================== -5. Shifted arrow keys *msdos-arrows* - -Use CTRL-arrow-left and CTRL-arrow-right instead of SHIFT-arrow-left and -SHIFT-arrow-right. The arrow-up and arrow-down cannot be used with SHIFT or -CTRL. - -============================================================================== -6. Filename extensions *msdos-fname-extensions* - -MS-DOS allows for only one file name extension. Therefore, when appending an -extension, the '.' in the original file name is replaced with a '_', the name -is truncated to 8 characters, and the new extension (e.g., ".swp") is -appended. Two examples: "test.c" becomes "test_c.bak", "thisisat.est" -becomes "thisisat.bak". To reduce these problems, the default for -'backupext' is "~" instead of ".bak". The backup file for "thisisat.est" -then becomes "thisisat.es~". The 'shortname' option is not available, -because it would always be set. - -============================================================================== -7. Memory usage and limitations *msdos-limitations* - -A swap file is used to store most of the text. You should be able to edit -very large files. However, memory is used for undo and other things. If you -delete a lot of text, you can still run out of memory in the Dos16 version. - -If Vim gives an "Out of memory" warning, you should stop editing. The result -of further editing actions is unpredictable. Setting 'undolevels' to 0 saves -some memory. Running the maze macros on a big maze is guaranteed to run out -of memory, because each change is remembered for undo. In this case set -'undolevels' to a negative number. This will switch off undo completely. - - *msdos-clipboard-limits* -In the Dos32 version, extended memory is used to avoid these problems. -However, if you are using the clipboard, you can still run into memory -limitations because the Windows clipboard can only communicate with Vim using -Dos memory. This means that the largest amount of text that can be sent to -or received from the Windows clipboard is limited by how much free Dos memory -is available on your system. - -You can usually maximize the amount of available Dos memory by adding the -following lines to Dos's "config.sys" file: > - - DOS=HIGH,UMB - DEVICE=C:\WINDOWS\himem.sys - DEVICE=C:\WINDOWS\emm386.exe RAM - -Modifying config.sys in this way will also help to make more memory available -for the Dos16 version, if you are using that. - -In the Dos16 version the line length is limited to about 32000 characters. -When reading a file the lines are automatically split. But editing a line -in such a way that it becomes too long may give unexpected results. - -============================================================================== -8. Symbolically linked files *msdos-linked-files* - -When using Vim to edit a symbolically linked file on a unix NFS file server, -you may run into problems. When writing the file, Vim does not "write -through" the symlink. Instead, it deletes the symbolic link and creates a new -file in its place. - -On Unix, Vim is prepared for links (symbolic or hard). A backup copy of the -original file is made and then the original file is overwritten. This assures -that all properties of the file remain the same. On non-Unix systems, the -original file is renamed and a new file is written. Only the protection bits -are set like the original file. However, this doesn't work properly when -working on an NFS-mounted file system where links and other things exist. The -only way to fix this in the current version is not making a backup file, by -":set nobackup nowritebackup" |'writebackup'| - -A similar problem occurs when mounting a Unix filesystem through Samba or a -similar system. When Vim creates a new file it will get the default user ID -for the mounted file system. This may be different from the original user ID. -To avoid this set the 'backupcopy' option to "yes". - -============================================================================== -9. Copy/paste in a dos box *msdos-copy-paste* - - *E450* *E451* *E452* *E453* *E454* -The 32 bit version can copy/paste from/to the Windows clipboard directly. Use -the "* register. Large amounts of text can be copied this way, but it must be -possible to allocate memory for it, see |msdos-clipboard-limits|. When moving -text from one Vim to another, the type of the selection -(characterwise/linewise/blockwise) is passed on. - -In other versions, the following can be used. - -(posted to comp.editors by John Velman <velman@igate1.hac.com>) - -How to copy/paste text from/to vim in a dos box: - -1) To get VIM to run in a window, instead of full screen, press alt+enter. - This toggles back and forth between full screen and a dos window. - NOTE: In Windows 95 you must have the property "Fast Pasting" unchecked! - In the properties dialog box for the MS-DOS window, go to "MS-DOS - Prompt/Misc/Fast pasting" and make sure that it is NOT checked. - To make this permanent, change the properties for - "\windows\system\conagent.exe" (from Philip Nelson, unverified). - -2) To paste something _into_ Vim, put Vim in insert mode. - -3) Put the text you want to paste on the windows clipboard. - -4) Click the control box in the upper left of the Vim window. (This looks - like a big minus sign.) If you don't want to use the mouse, you can get - this with alt+spacebar. -5) On the resulting dropdown menu choose "Edit". -6) On the child dropdown menu choose "Paste". - -To copy something from the Vim window to the clipboard, - -1) Select the control box to get the control drop down menu. -2) Select "Edit". -3) Select "Mark". -4) Using either the keys or the mouse, select the part of the Vim window that - you want to copy. To use the keys, use the arrow keys, and hold down shift - to extend the selection. -5) When you've completed your selection, press 'enter'. The selection - is now in the windows clipboard. By the way, this can be any - rectangular selection, for example columns 4-25 in rows 7-10. It can - include anything in the VIM window: the output of a :!dir, for - example. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/os_os2.txt b/runtime/doc/os_os2.txt index 231d7d1027..7891756612 100644 --- a/runtime/doc/os_os2.txt +++ b/runtime/doc/os_os2.txt @@ -1,221 +1,13 @@ -*os_os2.txt* For Vim version 7.4. Last change: 2007 Apr 22 +*os_os2.txt* For Vim version 8.1. Last change: 2015 Dec 31 VIM REFERENCE MANUAL by Paul Slootman *os2* *OS2* *OS/2* -This file contains the particularities for the OS/2 version of Vim. +This file used to contain the particularities for the OS/2 version of Vim. -At present there is no native PM version of the GUI version of Vim: The OS/2 -version is a console application. However, there is now a Win32s-compatible -GUI version, which should be usable by owners of Warp 4 (which supports -Win32s) in a Win-OS/2 session. The notes in this file refer to the native -console version. +The OS/2 support was removed in patch 7.4.1008. -NOTE - -This OS/2 port works well for me and a couple of other OS/2 users; however, -since I haven't had much feedback, that either means no (OS/2-specific) bugs -exist (besides the ones mentioned below), or no one has yet created a -situation in which any bugs are apparent. File I/O in Dos and Unix mode, -binary mode, and FAT handling all seem to work well, which would seem to be -the most likely places for trouble. - -A known problem is that files opened by Vim are inherited by other programs -that are started via a shell escape from within Vim. This specifically means -that Vim won't be able to remove the swap file(s) associated with buffers open -at the time the other program was started, until the other program is stopped. -At that time, the swap file may be removed, but if Vim could not do that the -first time, it won't be removed at all. You'll get warnings that some other -Vim session may be editing the file when you start Vim up again on that file. -This can be reproduced with ":!start epm". Now quit Vim, and start Vim again -with the file that was in the buffer at the time epm was started. I'm working -on this! - -A second problem is that Vim doesn't understand the situation when using it -when accessing the OS/2 system via the network, e.g. using telnet from a Unix -system, and then starting Vim. The problem seems to be that OS/2 =sometimes= -recognizes function / cursor keys, and tries to convert those to the -corresponding OS/2 codes generated by the "normal" PC keyboard. I've been -testing a workaround (mapping the OS/2 codes to the correct functions), but so -far I can't say anything conclusive (this is on Warp 3, by the way). In the -meantime any help will be appreciated. - - -PREREQUISITES - -To run Vim, you need the emx runtime environment (at least rev. 0.9b). This -is generally available as (ask Archie about it): - - emxrt.zip emx runtime package - -I've included a copy of emx.dll, which should be copied to one of the -directories listed in your LIBPATH. Emx is GPL'ed, but the emx.dll library is -not (read COPYING.EMX to find out what that means to you). - -This emx.dll is from the emxfix04.zip package, which unfortunately has a bug, -eh, I mean a POSIX feature, in select(). Versions of Vim before 3.27 will -appear to hang when starting (actually, while processing vimrc). Hit <Enter> a -couple of times until Vim starts working if this happens. Next, get an up to -date version of Vim! - - -HELP AND VIMRC FILE - -If you unpack the archive that Vim came in and run Vim directly from where it -was unpacked, Vim should be able to find the runtime files and your .vimrc -without any settings. - -If you put the runtime files separately from the binary, the VIM environment -variable is used to find the location of the help files and the system .vimrc. -Place an entry such as this in CONFIG.SYS: > - - SET VIM=c:/local/lib/vim - -Put your .vimrc and your other Vim files in this directory. Copy the runtime -directory to this directory. Each version of Vim has its own runtime -directory. It will be called something like "c:/local/lib/vim/vim54". Thus -you get a tree of Vim files like this: - c:/local/lib/vim/.vimrc - c:/local/lib/vim/vim54/filetype.vim - c:/local/lib/vim/vim54/doc/help.txt - etc. - -Note: .vimrc may also be called _vimrc to accommodate those who have chosen to -install OS/2 on a FAT file system. Vim first tries to find .vimrc and if that -fails, looks for _vimrc in the same place. The existence of a .vimrc or -_vimrc file influences the 'compatible' options, which can have unexpected side -effects. See |'compatible'|. - -If you're using network drives with OS/2, then you can install Vim on a -network drive (including .vimrc; this is then called the "system" vimrc file), -and then use a personal copy of .vimrc (the "user" vimrc file). This should be -located in a directory indicated by the HOME environment variable. - - -ENVIRONMENT VARIABLES IN FILE NAMES - -This HOME environment variable is also used when using ~ in file names, so -":e ~/textfile" will edit the file "textfile" in the directory referred to by -HOME. Additionally you can use other environment variables in file names, as -in ":n $SRC/*.c". - -The HOME environment variable is also used to locate the .viminfo file -(see |viminfo-file|). There is no support yet for .viminfo on FAT file -systems yet, sorry. You could try the -i startup flag (as in "vim -i -$HOME/_viminfo") however. - -If the HOME environment variable is not set, the value "C:/" is used as a -default. - - -BACKSLASHES - -Using slashes ('/') and backslashes ('\') can be a bit of a problem (see -|dos-backslash| for more explanation), but in almost all cases Vim does "The -Right Thing". Vim itself uses backslashes in file names, but will happily -accept forward slashes if they are entered (in fact, sometimes that works -better!). - - -TEMP FILES - -Temporary files (for filtering) are put in the first directory in the next -list that exists and where a file can be created: - $TMP - $TEMP - C:\TMP - C:\TEMP - current directory - - -TERMINAL SETTING - - *os2ansi* -Use "os2ansi" as the TERM environment variable (or don't set it at all, as the -default is the correct value). You can set term to os2ansi in the .vimrc, in -case you need TERM to be a different value for other applications. The -problem is that OS/2 ANSI emulation is quite limited (it doesn't have insert / -delete line, for example). - -If you want to use a different value for TERM (because of other programs, for -example), make sure that the termcap entry for that TERM value has the -appropriate key mappings. The termcap.dat distributed with emx does not always -have them. Here are some suitable values to add to the termcap entry of your -choice; these allow the cursor keys and the named function keys (such as -pagedown) to work. - - :ku=\316H:kd=\316P:kl=\316K:kr=\316M:%i=\316t:#4=\316s:\ - :kD=\316S:kI=\316R:kN=\316Q:kP=\316I:kh=\316G:@7=\316O:\ - :k1=\316;:k2=\316<:k3=\316=:k4=\316>:k5=\316?:k6=\316@:\ - :k7=\316A:k8=\316B:k9=\316C:k;=\316D: - - -Paul Slootman - - -43 LINE WINDOW - -A suggestion from Steven Tryon, on how to run Vim in a bigger window: - -When I call Vim from an OS/2 WPS application such as PMMail it comes up -in the default 25-line mode. To get a more useful window size I make -my external editor "vimbig.cmd" which in turn calls "vimbig2.cmd". -Brute force and awkwardness, perhaps, but it works. - -vimbig.cmd: > - @echo off - start "Vi Improved" /f vimbig2.cmd %1 %2 %3 %4 - -vimbig2.cmd: > - @echo off - mode 80,43 - vim.exe %1 %2 %3 %4 - exit -< - -CLIPBOARD ACCESS (provided by Alexander Wagner) - -Vim for OS/2 has no direct access to the system clipboard. To enable access -anyway you need an additional tool which gives you access to the clipboard -from within a vio application. The freeware package clipbrd.zip by Stefan -Gruendel can be used for this purpose. You might download the package -including precompiled binaries and all sources from: - http://www.os2site.com/sw/util/clipboard/index.html - http://download.uni-hd.de/ftp/pub/os2/pmtools/ - -Installation of this package is straight forward: just put the two executables -that come with this package into a directory within your PATH for Vim should -be able to call them from whatever directory you are working. - -To copy text from the clipboard to your Vim session you can use the :r -command. Simply call clipbrd.exe from within Vim in the following way: > - - :r !clipbrd -r - -To copy text from Vim to the system clipboard just mark the text in the usual -vim-manner and call: > - - :!clipbrd -w - -which will write your selection right into OS/2's clipboard. - -For ease of use you might want to add some maps for these commands. E.g. to -use F11 to paste the clipboard into Vim and F12 to copy selected text to the -clipboard you would use: > - - if has("os2") - imap <F11> <ESC>:r !clipbrd -r<CR>i - vmap <F12> :!clipbrd -w<cr> - else - imap <F11> <ESC>"*p<CR>i - vmap <F12> "*y - endif - -This will ensure that only on OS/2 clipbrd is called whereas on other -platforms vims build in mechanism is used. (To enable this functions on every -load of Vim place the above lines in your .vimrc.) - vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/os_qnx.txt b/runtime/doc/os_qnx.txt index 92132e9701..466699fcf6 100644 --- a/runtime/doc/os_qnx.txt +++ b/runtime/doc/os_qnx.txt @@ -1,4 +1,4 @@ -*os_qnx.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*os_qnx.txt* For Vim version 8.1. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Julian Kinraid diff --git a/runtime/doc/os_risc.txt b/runtime/doc/os_risc.txt index 62b4a4b8e2..095d5a9856 100644 --- a/runtime/doc/os_risc.txt +++ b/runtime/doc/os_risc.txt @@ -1,4 +1,4 @@ -*os_risc.txt* For Vim version 7.4. Last change: 2011 May 10 +*os_risc.txt* For Vim version 8.1. Last change: 2011 May 10 VIM REFERENCE MANUAL by Thomas Leonard diff --git a/runtime/doc/os_unix.txt b/runtime/doc/os_unix.txt index 6273597d27..4b69af5aa8 100644 --- a/runtime/doc/os_unix.txt +++ b/runtime/doc/os_unix.txt @@ -1,4 +1,4 @@ -*os_unix.txt* For Vim version 7.4. Last change: 2005 Mar 29 +*os_unix.txt* For Vim version 8.1. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/os_vms.txt b/runtime/doc/os_vms.txt index 03b11ba87e..0f8ab94bc9 100644 --- a/runtime/doc/os_vms.txt +++ b/runtime/doc/os_vms.txt @@ -1,4 +1,4 @@ -*os_vms.txt* For Vim version 7.4. Last change: 2014 Feb 24 +*os_vms.txt* For Vim version 8.1. Last change: 2018 May 06 VIM REFERENCE MANUAL @@ -702,13 +702,13 @@ In a cluster that contains nodes with different architectures like below: $show cluster View of Cluster from system ID 11655 node: TOR 18-AUG-2008 11:58:31 +---------------------------------+ - SYSTEMS MEMBERS -+-----------------------+--------- - NODE SOFTWARE STATUS -+--------+--------------+--------- - TOR VMS V7.3-2 MEMBER - TITAN2 VMS V8.3 MEMBER - ODIN VMS V7.3-2 MEMBER +| SYSTEMS | MEMBERS | ++-----------------------+---------| +| NODE | SOFTWARE | STATUS | ++--------+--------------+---------| +| TOR | VMS V7.3-2 | MEMBER | +| TITAN2 | VMS V8.3 | MEMBER | +| ODIN | VMS V7.3-2 | MEMBER | +---------------------------------+ It is convenient to have a common VIM directory but execute different @@ -774,7 +774,7 @@ Version 7.4 - correct RealWaitForChar - after 7.4-119 use different functions lib$cvtf_to_internal_time because Alpha and VAX have G_FLOAT but IA64 uses IEEE float otherwise Vim crashes -- guard agains crashes that are caused by mixed filenames +- guard against crashes that are caused by mixed filenames - [TESTDIR]make_vms.mms changed to see the output files - Improve tests, update known issues - minor compiler warnings fixed diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index a01a06c8ec..1ad3df6dd7 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -1,4 +1,4 @@ -*os_win32.txt* For Vim version 7.4. Last change: 2012 May 18 +*os_win32.txt* For Vim version 8.1. Last change: 2017 Mar 21 VIM REFERENCE MANUAL by George Reilly @@ -7,20 +7,18 @@ *win32* *Win32* *MS-Windows* This file documents the idiosyncrasies of the Win32 version of Vim. -The Win32 version of Vim works on Windows NT, 95, 98, ME, XP, Vista and -Windows 7. There are both console and GUI versions. +The Win32 version of Vim works on Windows XP, Vista, 7, 8 and 10. There are +both console and GUI versions. The 32 bit version also runs on 64 bit MS-Windows systems. -There is GUI version for use in the Win32s subsystem in Windows 3.1[1]. You -can also use the 32-bit DOS version of Vim instead. See |os_msdos.txt|. - 1. Known problems |win32-problems| 2. Startup |win32-startup| 3. Restore screen contents |win32-restore| 4. Using the mouse |win32-mouse| -5. Running under Windows 3.1 |win32-win3.1| -6. Win32 mini FAQ |win32-faq| +5. Running under Windows 95 |win32-win95| +6. Running under Windows 3.1 |win32-win3.1| +7. Win32 mini FAQ |win32-faq| Additionally, there are a number of common Win32 and DOS items: File locations |dos-locations| @@ -43,20 +41,7 @@ The GUI version was made by George V. Reilly and Robert Webb. For compiling see "src/INSTALLpc.txt". *win32-compiling* ============================================================================== -1. Known problems *windows95* *win32-problems* - -There are a few known problems with running in a console on Windows 95. As -far as we know, this is the same in Windows 98 and Windows ME. - -Comments from somebody working at Microsoft: "Win95 console support has always -been and will always be flaky". -1. Dead key support doesn't work. -2. Resizing the window with ":set columns=nn lines=nn" works, but executing - external commands MAY CAUSE THE SYSTEM TO HANG OR CRASH. -3. Screen updating is slow, unless you change 'columns' or 'lines' to a - non-DOS value. But then the second problem applies! - -If this bothers you, use the 32 bit MS-DOS version or the Win32 GUI version. +1. Known problems *win32-problems* When doing file name completion, Vim also finds matches for the short file name. But Vim will still find and use the corresponding long file name. For @@ -96,6 +81,66 @@ The directory of the Vim executable is appended to $PATH. This is mostly to make "!xxd" work, as it is in the Tools menu. And it also means that when executable() returns 1 the executable can actually be executed. +Command line arguments *win32-cmdargs* + +Analysis of a command line into parameters is not standardised in MS Windows. +Vim and gvim used to use different logic to parse it (before 7.4.432), and the +logic was also depended on what it was compiled with. Now Vim and gvim both +use the CommandLineToArgvW() Win32 API, so they behave in the same way. + +The basic rules are: *win32-backslashes* + a) A parameter is a sequence of graphic characters. + b) Parameters are separated by white space. + c) A parameter can be enclosed in double quotes to include white space. + d) A sequence of zero or more backslashes (\) and a double quote (") + is special. The effective number of backslashes is halved, rounded + down. An even number of backslashes reverses the acceptability of + spaces and tabs, an odd number of backslashes produces a literal + double quote. + +So: + " is a special double quote + \" is a literal double quote + \\" is a literal backslash and a special double quote + \\\" is a literal backslash and a literal double quote + \\\\" is 2 literal backslashes and a special double quote + \\\\\" is 2 literal backslashes and a literal double quote + etc. + +Example: > + vim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" + +opens "C:\My Music\freude" and executes the line mode commands: > + set ignorecase; /"foo\ and /bar\" + +These rules are also described in the reference of the CommandLineToArgvW API: + https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391.aspx + + *win32-quotes* +There are additional rules for quotes (which are not well documented). +As described above, quotes inside a file name (or any other command line +argument) can be escaped with a backslash. E.g. > + vim -c "echo 'foo\"bar'" + +Alternatively use three quotes to get one: > + vim -c "echo 'foo"""bar'" + +The quotation rules are: + +1. A `"` starts quotation. +2. Another `"` or `""` ends quotation. If the quotation ends with `""`, a `"` + is produced at the end of the quoted string. + +Examples, with [] around an argument: + "foo" -> [foo] + "foo"" -> [foo"] + "foo"bar -> [foobar] + "foo" bar -> [foo], [bar] + "foo""bar -> [foo"bar] + "foo"" bar -> [foo"], [bar] + "foo"""bar" -> [foo"bar] + + ============================================================================== 3. Restore screen contents *win32-restore* @@ -116,81 +161,20 @@ When the mouse doesn't work, try disabling the "Quick Edit Mode" feature of the console. ============================================================================== -5. Running under Windows 3.1 *win32-win3.1* - - *win32s* *windows-3.1* -There is a special version of Gvim that runs under Windows 3.1 and 3.11. You -need the gvim.exe that was compiled with Visual C++ 4.1. - -To run the Win32 version under Windows 3.1, you need to install Win32s. You -might have it already from another Win32 application which you have installed. -If Vim doesn't seem to be running properly, get the latest version: 1.30c. -You can find it at: - - http://support.microsoft.com/download/support/mslfiles/pw1118.exe +5. Running under Windows 95 *win32-win95* + *windows95* *windows98* *windowsme* +Windows 95/98/ME support was removed in patch 8.0.0029 If you want to use it +you will need to get a version older than that. -(Microsoft moved it again, we don't know where it is now :-( ). - -The reason for having two versions of gvim.exe is that the Win32s version was -compiled with VC++ 4.1. This is the last version of VC++ that supports Win32s -programs. VC++ 5.0 is better, so that one was used for the Win32 version. -Apart from that, there is no difference between the programs. If you are in a -mixed environment, you can use the gvim.exe for Win32s on both. +============================================================================== +6. Running under Windows 3.1 *win32-win3.1* -The Win32s version works the same way as the Win32 version under 95/NT. When -running under Win32s the following differences apply: -- You cannot use long file names, because Windows 3.1 doesn't support them! -- When executing an external command, it doesn't return an exit code. After - doing ":make" you have to do ":cn" yourself. + *win32s* *windows-3.1* *gui-w32s* +There was a special version of Gvim that runs under Windows 3.1 and 3.11. +Support was removed in patch 7.4.1363. ============================================================================== -6. Win32 mini FAQ *win32-faq* - -Q. Why does the Win32 version of Vim update the screen so slowly on Windows 95? -A. The support for Win32 console mode applications is very buggy in Win95. - For some unknown reason, the screen updates very slowly when Vim is run at - one of the standard resolutions (80x25, 80x43, or 80x50) and the 16-bit DOS - version updates the screen much more quickly than the Win32 version. - However, if the screen is set to some other resolution, such as by ":set - columns=100" or ":set lines=40", screen updating becomes about as fast as - it is with the 16-bit version. - - WARNING: Changing 'columns' may make Windows 95 crash while updating the - window (complaints --> Microsoft). Since this mostly works, this has not - been disabled, but be careful with changing 'columns'. - - Changing the screen resolution makes updates faster, but it brings - additional problems. External commands (e.g., ":!dir") can cause Vim to - freeze when the screen is set to a non-standard resolution, particularly - when 'columns' is not equal to 80. It is not possible for Vim to reliably - set the screen resolution back to the value it had upon startup before - running external commands, so if you change the number of 'lines' or - 'columns', be very, very careful. In fact, Vim will not allow you to - execute external commands when 'columns' is not equal to 80, because it is - so likely to freeze up afterwards. - - None of the above applies on Windows NT. Screen updates are fast, no - matter how many 'lines' or 'columns' the window has, and external commands - do not cause Vim to freeze. - -Q. So if the Win32 version updates the screen so slowly on Windows 95 and the - 16-bit DOS version updates the screen quickly, why would I want to run the - Win32 version? -A. Firstly, the Win32 version isn't that slow, especially when the screen is - set to some non-standard number of 'lines' or 'columns'. Secondly, the - 16-bit DOS version has some severe limitations: It can't do big changes and - it doesn't know about long file names. The Win32 version doesn't have these - limitations and it's faster overall (the same is true for the 32-bit DJGPP - DOS version of Vim). The Win32 version is smarter about handling the - screen, the mouse, and the keyboard than the DJGPP version is. - -Q. And what about the 16-bit DOS version versus the Win32 version on NT? -A. There are no good reasons to run the 16-bit DOS version on NT. The Win32 - version updates the screen just as fast as the 16-bit version does when - running on NT. All of the above disadvantages apply. Finally, DOS - applications can take a long time to start up and will run more slowly. On - non-Intel NT platforms, the DOS version is almost unusably slow, because it - runs on top of an 80x86 emulator. +7. Win32 mini FAQ *win32-faq* Q. How do I change the font? A. In the GUI version, you can use the 'guifont' option. Example: > @@ -198,47 +182,6 @@ A. In the GUI version, you can use the 'guifont' option. Example: > < In the console version, you need to set the font of the console itself. You cannot do this from within Vim. -Q. When I change the size of the console window with ':set lines=xx' or - similar, the font changes! (Win95) -A. You have the console font set to 'Auto' in Vim's (or your MS-DOS prompt's) - properties. This makes W95 guess (badly!) what font is best. Set an explicit - font instead. - -Q. Why can't I paste into Vim when running Windows 95? -A. In the properties dialog box for the MS-DOS window, go to "MS-DOS - Prompt/Misc/Fast pasting" and make sure that it is NOT checked. You should - also do ":set paste" in Vim to avoid unexpected effects. |'paste'| - -Q. How do I type dead keys on Windows 95, in the console version? - (A dead key is an accent key, such as acute, grave, or umlaut, that doesn't - produce a character by itself, but when followed by another key, produces - an accented character, such as a-acute, e-grave, u-umlaut, n-tilde, and so - on. Very useful for most European languages. English-language keyboard - layouts don't use dead keys, as far as we know.) -A. You don't. The console mode input routines simply do not work correctly in - Windows 95, and I have not been able to work around them. In the words - of a senior developer at Microsoft: - Win95 console support has always been and will always be flaky. - - The flakiness is unavoidable because we are stuck between the world of - MS-DOS keyboard TSRs like KEYB (which wants to cook the data; - important for international) and the world of Win32. - - So keys that don't "exist" in MS-DOS land (like dead keys) have a - very tenuous existence in Win32 console land. Keys that act - differently between MS-DOS land and Win32 console land (like - capslock) will act flaky. - - Don't even _mention_ the problems with multiple language keyboard - layouts... - - You may be able to fashion some sort of workaround with the digraphs - mechanism. |digraphs| - - The best solution is to use the Win32 GUI version gvim.exe. Alternatively, - you can try one of the DOS versions of Vim where dead keys reportedly do - work. - Q. How do I type dead keys on Windows NT? A. Dead keys work on NT 3.51. Just type them as you would in any other application. @@ -304,10 +247,19 @@ A. You can't! This is a limitation of the NT console. NT 5.0 is reported to be able to set the blink rate for all console windows at the same time. *:!start* -Q. How can I run an external command or program asynchronously? -A. When using :! to run an external command, you can run it with "start": > - :!start winfile.exe<CR> -< Using "start" stops Vim switching to another screen, opening a new console, +Q. How can I asynchronously run an external command or program, or open a + document or URL with its default program? +A. When using :! to run an external command, you can run it with "start". For + example, to run notepad: > + :!start notepad +< To open "image.jpg" with the default image viewer: > + :!start image.jpg +< To open the folder of the current file in Windows Explorer: > + :!start %:h +< To open the Vim home page with the default browser: > + :!start http://www.vim.org/ +< + Using "start" stops Vim switching to another screen, opening a new console, or waiting for the program to complete; it indicates that you are running a program that does not affect the files you are editing. Programs begun with :!start do not get passed Vim's open file handles, which means they do @@ -334,7 +286,7 @@ A. You have two possible solutions depending on what you want: :!start /min ctags -R . < When it has finished you should see file named "tags" in your current directory. You should notice the window title blinking on your taskbar. - This is more noticable for commands that take longer. + This is more noticeable for commands that take longer. Now delete the "tags" file and run this command: > :!start /b ctags -R . < You should have the same "tags" file, but this time there will be no @@ -345,26 +297,10 @@ A. You have two possible solutions depending on what you want: < The first command runs notepad minimized and the second one runs it normally. -Q. I'm using Win32s, and when I try to run an external command like "make", - Vim doesn't wait for it to finish! Help! -A. The problem is that a 32-bit application (Vim) can't get notification from - Windows that a 16-bit application (your DOS session) has finished. Vim - includes a work-around for this, but you must set up your DOS commands to - run in a window, not full-screen. Unfortunately the default when you - install Windows is full-screen. To change this: - 1) Start PIF editor (in the Main program group). - 2) Open the file "_DEFAULT.PIF" in your Windows directory. - 3) Changes the display option from "Full Screen" to "Windowed". - 4) Save and exit. - - To test, start Vim and type > - :!dir C:\<CR>". -< You should see a DOS box window appear briefly with the directory listing. - -Q. I use Vim under Win32s and NT. In NT, I can define the console to default to - 50 lines, so that I get a 80x50 shell when I ':sh'. Can I do the same in - W3.1x, or am I stuck with 80x25? -A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp] section. DOS - prompts and external DOS commands will now run in a 50-line window. + *windows-icon* +Q. I don't like the Vim icon, can I change it? +A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of + 'runtimepath'. For example ~/vimfiles/bitmaps/vim.ico. + vim:tw=78:fo=tcq2:ts=8:ft=help:norl: diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 207a43d87f..502706ce01 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2014 May 28 +*pattern.txt* For Vim version 8.1. Last change: 2018 Mar 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -59,6 +59,8 @@ explanations are in chapter 27 |usr_27.txt|. *n* n Repeat the latest "/" or "?" [count] times. + If the cursor doesn't move the search is repeated with + count + 1. |last-pattern| {Vi: no count} *N* @@ -353,8 +355,8 @@ For starters, read chapter 27 of the user manual |usr_27.txt|. */\%#=* *two-engines* *NFA* Vim includes two regexp engines: 1. An old, backtracking engine that supports everything. -2. A new, NFA engine that works much faster on some patterns, but does not - support everything. +2. A new, NFA engine that works much faster on some patterns, possibly slower + on some patterns. Vim will automatically select the right engine for you. However, if you run into a problem or want to specifically select one engine or the other, you can @@ -391,8 +393,8 @@ Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used. Use of "\v" means that in the pattern after it all ASCII characters except '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic" -Use of "\V" means that in the pattern after it only the backslash has a -special meaning. "very nomagic" +Use of "\V" means that in the pattern after it only the backslash and the +terminating character (/ or ?) has a special meaning. "very nomagic" Examples: after: \v \m \M \V matches ~ @@ -400,6 +402,7 @@ after: \v \m \M \V matches ~ $ $ $ \$ matches end-of-line . . \. \. matches any character * * \* \* any number of the previous atom + ~ ~ \~ \~ latest substitute string () \(\) \(\) \(\) grouping into an atom | \| \| \| separating alternatives \a \a \a \a alphabetic character @@ -478,6 +481,7 @@ More explanation and examples below, follow the links. |/\%v| \%23v \%23v in virtual column 23 |/zero-width| Character classes {not in Vi}: */character-classes* + magic nomagic matches ~ |/\i| \i \i identifier character (see 'isident' option) |/\I| \I \I like "\i", but excluding digits |/\k| \k \k keyword character (see 'iskeyword' option) @@ -508,6 +512,7 @@ Character classes {not in Vi}: */character-classes* class with end-of-line included (end of character classes) + magic nomagic matches ~ |/\e| \e \e <Esc> |/\t| \t \t <Tab> |/\r| \r \r <CR> @@ -533,6 +538,7 @@ Character classes {not in Vi}: */character-classes* |/\Z| \Z \Z ignore differences in Unicode "combining characters". Useful when searching voweled Hebrew or Arabic text. + magic nomagic matches ~ |/\m| \m \m 'magic' on for the following chars in the pattern |/\M| \M \M 'magic' off for the following chars in the pattern |/\v| \v \v the following chars in the pattern are "very magic" @@ -570,7 +576,7 @@ An atom can be followed by an indication of how many times the atom can be matched and in what way. This is called a multi. See |/multi| for an overview. - */star* */\star* *E56* + */star* */\star* * (use \* when 'magic' is not set) Matches 0 or more of the preceding atom, as many as possible. Example 'nomagic' matches ~ @@ -590,7 +596,7 @@ overview. the end of the file and then tries matching "END", backing up one character at a time. - */\+* *E57* + */\+* \+ Matches 1 or more of the preceding atom, as many as possible. {not in Vi} Example matches ~ @@ -606,7 +612,7 @@ overview. \? Just like \=. Cannot be used when searching backwards with the "?" command. {not in Vi} - */\{* *E58* *E60* *E554* *E870* + */\{* *E60* *E554* *E870* \{n,m} Matches n to m of the preceding atom, as many as possible \{n} Matches n of the preceding atom \{n,} Matches at least n of the preceding atom, as many as possible @@ -706,11 +712,18 @@ overview. But to limit the time needed, only the line where what follows matches is searched, and one line before that (if there is one). This should be sufficient to match most things and not be too slow. - The part of the pattern after "\@<=" and "\@<!" are checked for a - match first, thus things like "\1" don't work to reference \(\) inside - the preceding atom. It does work the other way around: - Example matches ~ - \1\@<=,\([a-z]\+\) ",abc" in "abc,abc" + + In the old regexp engine the part of the pattern after "\@<=" and + "\@<!" are checked for a match first, thus things like "\1" don't work + to reference \(\) inside the preceding atom. It does work the other + way around: + Bad example matches ~ + \%#=1\1\@<=,\([a-z]\+\) ",abc" in "abc,abc" + + However, the new regexp engine works differently, it is better to not + rely on this behavior, do not use \@<= if it can be avoided: + Example matches ~ + \([a-z]\+\)\zs,\1 ",abc" in "abc,abc" \@123<= Like "\@<=" but only look back 123 bytes. This avoids trying lots @@ -822,6 +835,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): branch is used. Example: > /\(.\{-}\zsFab\)\{3} < Finds the third occurrence of "Fab". + This cannot be followed by a multi. *E888* {not in Vi} {not available when compiled without the |+syntax| feature} */\ze* \ze Matches at any position, and sets the end of the match there: The @@ -830,6 +844,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): branch is used. Example: "end\ze\(if\|for\)" matches the "end" in "endif" and "endfor". + This cannot be followed by a multi. |E888| {not in Vi} {not available when compiled without the |+syntax| feature} */\%^* *start-of-file* @@ -854,10 +869,13 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): \%V Match inside the Visual area. When Visual mode has already been stopped match in the area that |gv| would reselect. This is a |/zero-width| match. To make sure the whole pattern is - inside the Visual area put it at the start and end of the pattern, - e.g.: > + inside the Visual area put it at the start and just before the end of + the pattern, e.g.: > + /\%Vfoo.*ba\%Vr +< This also works if only "foo bar" was Visually selected. This: > /\%Vfoo.*bar\%V -< Only works for the current buffer. +< would match "foo bar" if the Visual selection continues after the "r". + Only works for the current buffer. */\%#* *cursor-position* \%# Matches with the cursor position. Only works when matching in a @@ -887,7 +905,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): becomes invalid. Vim doesn't automatically update the matches. Similar to moving the cursor for "\%#" |/\%#|. - */\%l* */\%>l* */\%<l* + */\%l* */\%>l* */\%<l* *E951* \%23l Matches in a specific line. \%<23l Matches above a specific line (lower line number). \%>23l Matches below a specific line (higher line number). @@ -939,14 +957,18 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): < When 'hlsearch' is set and you move the cursor around and make changes this will clearly show when the match is updated or not. To match the text up to column 17: > - /.*\%17v -< Column 17 is included, because that's where the "\%17v" matches, - even though this is a |/zero-width| match. Adding a dot to match the - next character has the same result: > - /.*\%17v. + /^.*\%17v +< Column 17 is not included, because this is a |/zero-width| match. To + include the column use: > + /^.*\%17v. < This command does the same thing, but also matches when there is no character in column 17: > - /.*\%<18v. + /^.*\%<18v. +< Note that without the "^" to anchor the match in the first column, + this will also highlight column 17: > + /.*\%17v +< Column 17 is highlighted by 'hlsearch' because there is another match + where ".*" matches zero characters. < Character classes: {not in Vi} @@ -1049,7 +1071,10 @@ x A single character, with no special meaning, matches itself *E769* When the ']' is not there Vim will not give an error message but assume no collection is used. Useful to search for '['. However, you - do get E769 for internal searching. + do get E769 for internal searching. And be aware that in a + `:substitute` command the whole command becomes the pattern. E.g. + ":s/[/x/" searches for "[/x" and replaces it with nothing. It does + not search for "[" and replaces it with "x"! If the sequence begins with "^", it matches any single character NOT in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'. @@ -1060,31 +1085,44 @@ x A single character, with no special meaning, matches itself - A character class expression is evaluated to the set of characters belonging to that character class. The following character classes are supported: - Name Contents ~ -*[:alnum:]* [:alnum:] letters and digits -*[:alpha:]* [:alpha:] letters -*[:blank:]* [:blank:] space and tab characters -*[:cntrl:]* [:cntrl:] control characters -*[:digit:]* [:digit:] decimal digits -*[:graph:]* [:graph:] printable characters excluding space -*[:lower:]* [:lower:] lowercase letters (all letters when + Name Func Contents ~ +*[:alnum:]* [:alnum:] isalnum ASCII letters and digits +*[:alpha:]* [:alpha:] isalpha ASCII letters +*[:blank:]* [:blank:] space and tab +*[:cntrl:]* [:cntrl:] iscntrl ASCII control characters +*[:digit:]* [:digit:] decimal digits '0' to '9' +*[:graph:]* [:graph:] isgraph ASCII printable characters excluding + space +*[:lower:]* [:lower:] (1) lowercase letters (all letters when 'ignorecase' is used) -*[:print:]* [:print:] printable characters including space -*[:punct:]* [:punct:] punctuation characters -*[:space:]* [:space:] whitespace characters -*[:upper:]* [:upper:] uppercase letters (all letters when +*[:print:]* [:print:] (2) printable characters including space +*[:punct:]* [:punct:] ispunct ASCII punctuation characters +*[:space:]* [:space:] whitespace characters: space, tab, CR, + NL, vertical tab, form feed +*[:upper:]* [:upper:] (3) uppercase letters (all letters when 'ignorecase' is used) -*[:xdigit:]* [:xdigit:] hexadecimal digits -*[:return:]* [:return:] the <CR> character -*[:tab:]* [:tab:] the <Tab> character -*[:escape:]* [:escape:] the <Esc> character -*[:backspace:]* [:backspace:] the <BS> character +*[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F +*[:return:]* [:return:] the <CR> character +*[:tab:]* [:tab:] the <Tab> character +*[:escape:]* [:escape:] the <Esc> character +*[:backspace:]* [:backspace:] the <BS> character The brackets in character class expressions are additional to the brackets delimiting a collection. For example, the following is a plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is, a list of at least one character, each of which is either '-', '.', '/', alphabetic, numeric, '_' or '~'. - These items only work for 8-bit characters. + 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. For now, to get all "alpha" + characters you can use: [[:lower:][:upper:]]. + + The "Func" column shows what library function is used. The + implementation depends on the system. Otherwise: + (1) Uses islower() for ASCII and Vim builtin rules for other + characters when built with the |+multi_byte| feature. + (2) Uses Vim builtin rules + (3) As with (1) but using isupper() */[[=* *[==]* - An equivalence class. This means that characters are matched that have almost the same meaning, e.g., when ignoring accents. This @@ -1124,7 +1162,8 @@ x A single character, with no special meaning, matches itself - Matching with a collection can be slow, because each character in the text has to be compared with each character in the collection. Use one of the other atoms above when possible. Example: "\d" is - much faster than "[0-9]" and matches the same characters. + much faster than "[0-9]" and matches the same characters. However, + the new |NFA| regexp engine deals with this better than the old one. */\%[]* *E69* *E70* *E369* \%[] A sequence of optionally matched atoms. This always matches. diff --git a/runtime/doc/pi_getscript.txt b/runtime/doc/pi_getscript.txt index 628d9b74e5..4190706829 100644 --- a/runtime/doc/pi_getscript.txt +++ b/runtime/doc/pi_getscript.txt @@ -1,4 +1,4 @@ -*pi_getscript.txt* For Vim version 7.0. Last change: 2013 Nov 29 +*pi_getscript.txt* For Vim version 8.1. Last change: 2017 Aug 01 > GETSCRIPT REFERENCE MANUAL by Charles E. Campbell < @@ -9,7 +9,7 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright* The VIM LICENSE (see |copyright|) applies to the files in this package, including getscriptPlugin.vim, getscript.vim, GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript" - instead of "VIM". Like anything else that's free, getscript and its + instead of "Vim". Like anything else that's free, getscript and its associated files are provided *as is* and comes with no warranty of any kind, either expressed or implied. No guarantees of merchantability. No guarantees of suitability for any purpose. By @@ -68,7 +68,7 @@ Your computer needs to have wget or curl for GetLatestVimScripts to do its work. mv GetLatestVimScripts.dist GetLatestVimScripts.dat (edit GetLatestVimScripts.dat to install your own personal list of desired plugins -- see |GetLatestVimScripts_dat|) - + 3. Windows: vim getscript.vba :so % @@ -389,7 +389,7 @@ v36 Apr 22, 2013 : * (glts) suggested use of plugin/**/*.vim instead of plugin/*.vim in globpath() call. * (Andy Wokula) got warning message when setting g:loaded_getscriptPlugin -v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script url has +v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script URL has changed (somewhat). However, it doesn't work, and the original one does (under Linux). I'll make it yet-another-option. diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt index a3998d567a..21b6520ee1 100644 --- a/runtime/doc/pi_gzip.txt +++ b/runtime/doc/pi_gzip.txt @@ -1,4 +1,4 @@ -*pi_gzip.txt* For Vim version 7.4. Last change: 2012 Jul 19 +*pi_gzip.txt* For Vim version 8.1. Last change: 2016 Nov 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -27,6 +27,8 @@ with these extensions: *.bz2 bzip2 *.lzma lzma *.xz xz + *.lz lzip + *.zst zstd That's actually the only thing you need to know. There are no options. diff --git a/runtime/doc/pi_logipat.txt b/runtime/doc/pi_logipat.txt new file mode 100644 index 0000000000..f8d666234f --- /dev/null +++ b/runtime/doc/pi_logipat.txt @@ -0,0 +1,121 @@ +*pi_logipat.txt* Logical Patterns Jun 22, 2015 + +Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> +Copyright: (c) 2004-2015 by Charles E. Campbell *logiPat-copyright* + The VIM LICENSE applies to LogiPat.vim and LogiPat.txt + (see |copyright|) except use "LogiPat" instead of "Vim" + No warranty, express or implied. Use At-Your-Own-Risk. + +============================================================================== +1. Contents *logiPat* *logiPat-contents* + + 1. Contents.................: |logiPat-contents| + 2. LogiPat Manual...........: |logiPat-manual| + 3. LogiPat Examples.........: |logiPat-examples| + 4. Caveat...................: |logiPat-caveat| + 5. LogiPat History..........: |logiPat-history| + + +============================================================================== +2. LogiPat Manual *logiPat-manual* *logiPat-man* + + *logiPat-arg* *logiPat-input* *logiPat-pattern* *logiPat-operators* + Boolean logic patterns are composed of + + operators ! = not + | = logical-or + & = logical-and + grouping ( ... ) + patterns "pattern" + + :LogiPat {boolean-logic pattern} *:LogiPat* + :LogiPat is a command which takes a boolean-logic + argument (|logiPat-arg|). + + :LP {boolean-logic pattern} *:LP* + :LP is a shorthand command version of :LogiPat + + :LPE {boolean-logic pattern} *:LPE* + No search is done, but the conversion from the + boolean logic pattern to the regular expression + is performed and echoed onto the display. + + :LogiPatFlags {search flags} *LogiPat-flags* + :LogiPatFlags {search flags} + LogiPat uses the |search()| command. The flags + passed to that call to search() may be specified + by the :LogiPatFlags command. + + :LPF {search flags} *:LPF* + :LPF is a shorthand version of :LogiPatFlags. + + :let pat=LogiPat({boolean-logic pattern}) *LogiPat()* + If one calls LogiPat() directly, no search + is done, but the transformation from the boolean + logic pattern into a regular expression pattern + is performed and returned. + + To get a " inside a pattern, as opposed to having it delimit + the pattern, double it. + + +============================================================================== +3. LogiPat Examples *logiPat-examples* + + LogiPat takes Boolean logic arguments and produces a regular + expression which implements the choices. A series of examples + follows: +> + :LogiPat "abc" +< will search for lines containing the string :abc: +> + :LogiPat "ab""cd" +< will search for lines containing the string :ab"c: +> + :LogiPat !"abc" +< will search for lines which don't contain the string :abc: +> + :LogiPat "abc"|"def" +< will search for lines which contain either the string + :abc: or the string :def: +> + :LogiPat !("abc"|"def") +< will search for lines which don't contain either + of the strings :abc: or :def: +> + :LogiPat "abc"&"def" +< will search for lines which contain both of the strings + :abc: and :def: +> + :let pat= LogiPat('!"abc"') +< will return the regular expression which will match + all lines not containing :abc: . The double quotes + are needed to pass normal patterns to LogiPat, and + differentiate such patterns from boolean logic + operators. + + +============================================================================== +4. Caveat *logiPat-caveat* + + The "not" operator may be fragile; ie. it may not always play well + with the & (logical-and) and | (logical-or) operators. Please try out + your patterns, possibly with :set hls, to insure that what is matching + is what you want. + + +============================================================================== +3. LogiPat History *logiPat-history* + + v4 Jun 22, 2015 * LogiPat has been picked up by Bram M for standard + plugin distribution; hence the name change + v3 Sep 25, 2006 * LP_Or() fixed; it now encapsulates its output + in \%(...\) parentheses + Dec 12, 2011 * |:LPE| added + * "" is mapped to a single " and left inside patterns + v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working + v1 May 23, 2005 * initial release + + +============================================================================== +vim:tw=78:ts=8:ft=help diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 32f576af6a..b4f2f2693e 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2014 May 13 +*pi_netrw.txt* For Vim version 8.1. Last change: 2017 Nov 03 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -6,7 +6,7 @@ Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* +Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* The VIM LICENSE applies to the files in this package, including netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and syntax/netrw.vim. Like anything else that's free, netrw.vim and its @@ -17,10 +17,10 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* holder be liable for any damages resulting from the use of this software. Use at your own risk! - + *netrw* *dav* *ftp* *netrw-file* *rcp* *scp* *davs* *http* *netrw.vim* *rsync* *sftp* - *fetch* *netrw* *network* + *fetch* *network* ============================================================================== 1. Contents *netrw-contents* {{{1 @@ -47,9 +47,10 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* Introduction To Browsing............................|netrw-intro-browse| Quick Reference: Maps...............................|netrw-browse-maps| Quick Reference: Commands...........................|netrw-browse-cmds| + Banner Display......................................|netrw-I| Bookmarking A Directory.............................|netrw-mb| Browsing............................................|netrw-cr| - Squeezing the Current Tree-Listing Directory......|:netrw-s-cr| + Squeezing the Current Tree-Listing Directory........|netrw-s-cr| Browsing With A Horizontally Split Window...........|netrw-o| Browsing With A New Tab.............................|netrw-t| Browsing With A Vertically Split Window.............|netrw-v| @@ -57,7 +58,7 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* Changing To A Bookmarked Directory..................|netrw-gb| Changing To A Predecessor Directory.................|netrw-u| Changing To A Successor Directory...................|netrw-U| - Customizing Browsing With A User Function...........|netrw-x| + Customizing Browsing With A Special Handler.........|netrw-x| Deleting Bookmarks..................................|netrw-mB| Deleting Files Or Directories.......................|netrw-D| Directory Exploring Commands........................|netrw-explore| @@ -71,12 +72,17 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* Improving Browsing..................................|netrw-ssh-hack| Listing Bookmarks And History.......................|netrw-qb| Making A New Directory..............................|netrw-d| - Making The Browsing Directory The Current Directory.|netrw-c| + Making The Browsing Directory The Current Directory.|netrw-cd| Marking Files.......................................|netrw-mf| Unmarking Files.....................................|netrw-mF| + Marking Files By Location List......................|netrw-qL| Marking Files By QuickFix List......................|netrw-qF| Marking Files By Regular Expression.................|netrw-mr| - Marked Files: Arbitrary Command.....................|netrw-mx| + Marked Files: Arbitrary Shell Command...............|netrw-mx| + Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX| + Marked Files: Arbitrary Vim Command.................|netrw-mv| + Marked Files: Argument List.........................|netrw-ma| |netrw-mA| + Marked Files: Buffer List...........................|netrw-cb| |netrw-cB| Marked Files: Compression And Decompression.........|netrw-mz| Marked Files: Copying...............................|netrw-mc| Marked Files: Diff..................................|netrw-md| @@ -149,7 +155,7 @@ Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE' < -Netrw will substitute the host's machine name for "MACHINE" from the url it is +Netrw will substitute the host's machine name for "MACHINE" from the URL it is attempting to open, and so one may specify > userid password @@ -206,9 +212,10 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 http: g:netrw_http_cmd = "fetch" elseif fetch is available http: *g:netrw_http_put_cmd* = "curl -T" rcp: *g:netrw_rcp_cmd* = "rcp" - rsync: *g:netrw_rsync_cmd* = "rsync -a" + rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|) scp: *g:netrw_scp_cmd* = "scp -q" sftp: *g:netrw_sftp_cmd* = "sftp" + file: *g:netrw_file_cmd* = "elinks" or "links" *g:netrw_http_xcmd* : the option string for http://... protocols are specified via this variable and may be independently overridden. By @@ -216,7 +223,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 elinks : "-source >" links : "-dump >" - curl : "-o" + curl : "-L -o" wget : "-q -O" fetch : "-o" < @@ -231,7 +238,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 READING *netrw-read* *netrw-nread* {{{2 - Generally, one may just use the url notation with a normal editing + Generally, one may just use the URL notation with a normal editing command, such as > :e ftp://[user@]machine/path @@ -253,7 +260,7 @@ READING *netrw-read* *netrw-nread* {{{2 WRITING *netrw-write* *netrw-nwrite* {{{2 - One may just use the url notation with a normal file writing + One may just use the URL notation with a normal file writing command, such as > :w ftp://[user@]machine/path @@ -274,7 +281,7 @@ WRITING *netrw-write* *netrw-nwrite* {{{2 SOURCING *netrw-source* {{{2 - One may just use the url notation with the normal file sourcing + One may just use the URL notation with the normal file sourcing command, such as > :so ftp://[user@]machine/path @@ -346,7 +353,7 @@ settings are described below, in |netrw-browser-options|, and in per-buffer basis (supports plain :Nw ) *g:netrw_bufsettings* the settings that netrw buffers have - (default) noma nomod nonu nowrap ro nobl + (default) noma nomod nonu nowrap ro nobl *g:netrw_chgwin* specifies a window number where subsequent file edits will take place. (also see |netrw-C|) @@ -363,7 +370,12 @@ settings are described below, in |netrw-browser-options|, and in fun! MyFuncRef() endfun let g:Netrw_funcref= function("MyFuncRef") + < + *g:Netrw_UserMaps* specifies a function or |List| of functions which can + be used to set up user-specified maps and functionality. + See |netrw-usermaps| + *g:netrw_ftp* if it doesn't exist, use default ftp =0 use default ftp (uid password) =1 use alternate ftp method (user uid password) @@ -399,18 +411,26 @@ settings are described below, in |netrw-browser-options|, and in be available (see |netrw-gx|) *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis - *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis + *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis *g:netrw_preview* =0 (default) preview window shown in a horizontally split window =1 preview window shown in a vertically split window. Also affects the "previous window" (see |netrw-P|) in the same way. + The |g:netrw_alto| variable may be used to provide + additional splitting control: + g:netrw_preview g:netrw_alto result + 0 0 |:aboveleft| + 0 1 |:belowright| + 1 0 |:topleft| + 1 1 |:botright| + To control sizing, see |g:netrw_winsize| *g:netrw_scpport* = "-P" : option to use to set port for scp *g:netrw_sshport* = "-p" : option to use to set port for ssh - *g:netrw_sepchr* =\0xff + *g:netrw_sepchr* =\0xff =\0x01 for enc == euc-jp (and perhaps it should be for others, too, please let me know) Separates priority codes from filenames internally. @@ -430,7 +450,7 @@ settings are described below, in |netrw-browser-options|, and in lines that o/s's ftp "provides" on transfers =0 force normal ftp behavior (no trailing line removal) - *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also + *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also permits network browsing to use ls with time and size sorting (default if windows) =0 assume Windows' scp accepts windows-style paths @@ -459,7 +479,7 @@ file using root-relative paths, use the full path: ============================================================================== 4. Network-Oriented File Transfer *netrw-xfer* {{{1 -Network-oriented file transfer under Vim is implemented by a VimL-based script +Network-oriented file transfer under Vim is implemented by a vim script (<netrw.vim>) using plugin techniques. It currently supports both reading and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, dav/cadaver, rsync, or sftp. @@ -681,6 +701,16 @@ your <.vimrc> customization file: > filetype plugin indent on endif < +By also including the following lines in your .vimrc, one may have netrw +immediately activate when using [g]vim without any filenames, showing the +current directory: > + + " Augroup VimStartup: + augroup VimStartup + au! + au VimEnter * if expand("%") == "" | e . | endif + augroup END +< ============================================================================== 6. Transparent Remote File Editing *netrw-transparent* {{{1 @@ -704,11 +734,11 @@ such as netrw. The usual read/write commands are supported. There are also a few additional commands available. Often you won't need to use Nwrite or Nread as shown in |netrw-transparent| (ie. simply use > - :e url - :r url - :w url + :e URL + :r URL + :w URL instead, as appropriate) -- see |netrw-urls|. In the explanations -below, a {netfile} is an url to a remote file. +below, a {netfile} is a URL to a remote file. *:Nwrite* *:Nw* :[range]Nw[rite] Write the specified lines to the current @@ -838,9 +868,11 @@ variables listed below, and may be modified by the user. g:netrw_http_cmd var ="fetch -o" if fetch is available g:netrw_http_cmd var ="wget -O" else if wget is available g:netrw_http_put_cmd var ="curl -T" - g:netrw_list_cmd var ="ssh USEPORT HOSTNAME ls -Fa" + |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa" g:netrw_rcp_cmd var ="rcp" - g:netrw_rsync_cmd var ="rsync -a" + g:netrw_rsync_cmd var ="rsync" + *g:netrw_rsync_sep* var ="/" used to separate the hostname + from the file spec g:netrw_scp_cmd var ="scp -q" g:netrw_sftp_cmd var ="sftp" > ------------------------------------------------------------------------- @@ -977,7 +1009,7 @@ where [protocol] is typically scp or ftp. As an example, try: > vim ftp://ftp.home.vim.org/pub/vim/ < For local directories, the trailing slash is not required. Again, because it's -easy to miss: to browse remote directories, the url must terminate with a +easy to miss: to browse remote directories, the URL must terminate with a slash! If you'd like to avoid entering the password repeatedly for remote directory @@ -1042,32 +1074,42 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 < <F1> Causes Netrw to issue help <cr> Netrw will enter the directory or read the file |netrw-cr| <del> Netrw will attempt to remove the file/directory |netrw-del| + <c-h> Edit file hiding list |netrw-ctrl-h| + <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| + <c-r> Browse using a gvim server |netrw-ctrl-r| + <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab| - Makes Netrw go up one directory |netrw--| - a Toggles between normal display, |netrw-a| + a Cycles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) - showing (display only files which match g:netrw_list_hide) + and showing (display only files which match g:netrw_list_hide) c Make browsing directory the current directory |netrw-c| C Setting the editing window |netrw-C| d Make a directory |netrw-d| D Attempt to remove the file(s)/directory(ies) |netrw-D| gb Go to previous bookmarked directory |netrw-gb| + gd Force treatment as directory |netrw-gd| + gf Force treatment as file |netrw-gf| gh Quick hide/unhide of dot-files |netrw-gh| - <c-h> Edit file hiding list |netrw-ctrl-h| + gn Make top of tree the directory below the cursor |netrw-gn| i Cycle between thin, long, wide, and tree listings |netrw-i| - <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| + I Toggle the displaying of the banner |netrw-I| mb Bookmark current directory |netrw-mb| mc Copy marked files to marked-file target directory |netrw-mc| md Apply diff to marked files (up to 3) |netrw-md| me Place marked files on arg list and edit them |netrw-me| mf Mark a file |netrw-mf| + mF Unmark files |netrw-mF| + mg Apply vimgrep to marked files |netrw-mg| mh Toggle marked file suffices' presence on hiding list |netrw-mh| mm Move marked files to marked-file target directory |netrw-mm| mp Print marked files |netrw-mp| - mr Mark files satisfying a shell-style |regexp| |netrw-mr| + mr Mark files using a shell-style |regexp| |netrw-mr| mt Current browsing directory becomes markfile target |netrw-mt| mT Apply ctags to marked files |netrw-mT| mu Unmark all marked files |netrw-mu| + mv Apply arbitrary vim command to marked files |netrw-mv| mx Apply arbitrary shell command to marked files |netrw-mx| + mX Apply arbitrary shell command to marked files en bloc|netrw-mX| mz Compress/decompress marked files |netrw-mz| o Enter the file/directory under the cursor in a new |netrw-o| browser window. A horizontal split is used. @@ -1076,8 +1118,10 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 P Browse in the previously used window |netrw-P| qb List bookmarked directories and history |netrw-qb| qf Display information on file |netrw-qf| + qF Mark files using a quickfix list |netrw-qF| + qL Mark files using a |location-list| |netrw-qL| r Reverse sorting order |netrw-r| - R Rename the designed file(s)/directory(ies) |netrw-R| + R Rename the designated file(s)/directory(ies) |netrw-R| s Select sorting style: by name, time, or file size |netrw-s| S Specify suffix priority for name-sorting |netrw-S| t Enter the file/directory under the cursor in a new tab|netrw-t| @@ -1099,7 +1143,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 mouse <2-leftmouse> (gvim only) when: * in a netrw-selected file, AND - * |g:netrw_retmap| == 1 AND + * |g:netrw_retmap| == 1 AND * the user doesn't already have a <2-leftmouse> mapping defined before netrw is autoloaded, then a double clicked leftmouse button will return @@ -1117,7 +1161,7 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 :Ntree....................................................|netrw-ntree| :Explore[!] [dir] Explore directory of current file......|netrw-explore| :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore| - :Lexplore [dir] Left Explorer Toggle...................|netrw-explore| + :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore| :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| :Rexplore Return to Explorer.....................|netrw-explore| @@ -1125,22 +1169,57 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore| :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| -BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 -One may easily "bookmark" a directory by using > +BANNER DISPLAY *netrw-I* + +One may toggle the displaying of the banner by pressing "I". + +Also See: |g:netrw_banner| + + +BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 + +One may easily "bookmark" the currently browsed directory by using > mb < -Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are -kept in sorted order. + *.netrwbook* +Bookmarks are retained in between sessions of vim in a file called .netrwbook +as a |List|, which is typically stored in the first directory on the user's +'|runtimepath|'; entries are kept in sorted order. + +If there are marked files and/or directories, mb will add them to the bookmark +list. + + *netrw-:NetrwMB* +Addtionally, one may use :NetrwMB to bookmark files or directories. > + + :NetrwMB[!] [files/directories] + +< No bang: enters files/directories into Netrw's bookmark system + + No argument and in netrw buffer: + if there are marked files : bookmark marked files + otherwise : bookmark file/directory under cursor + No argument and not in netrw buffer: bookmarks current open file + Has arguments : |glob()|s each arg and bookmarks them + + With bang: deletes files/directories from Netrw's bookmark system + +The :NetrwMB command is available outside of netrw buffers (once netrw has been +invoked in the session). + +The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By +default, its stored on the first directory on the user's |'runtimepath'|. Related Topics: |netrw-gb| how to return (go) to a bookmark |netrw-mB| how to delete bookmarks |netrw-qb| how to list bookmarks + |g:netrw_home| controls where .netrwbook is kept -BROWSING *netrw-cr* {{{2 +BROWSING *netrw-enter* *netrw-cr* {{{2 Browsing is simple: move the cursor onto a file or directory of interest. Hitting the <cr> (the return key) will select the file or directory. @@ -1163,7 +1242,7 @@ horizontally or vertically, respectively. When the option is set to three, a When using the gui (gvim), one may select a file by pressing the <leftmouse> button. In addition, if - *|g:netrw_retmap| == 1 AND (its default value is 0) + * |g:netrw_retmap| == 1 AND (its default value is 0) * in a netrw-selected file, AND * the user doesn't already have a <2-leftmouse> mapping defined before netrw is loaded @@ -1182,18 +1261,29 @@ are introduced into a directory), the listing may become out-of-date. One may always refresh directory listing buffers by pressing ctrl-L (see |netrw-ctrl-l|). - *:netrw-s-cr* - Squeezing the Current Tree-Listing Directory~ - When the tree listing style is enabled (see |netrw-i|) and one is using - gvim, then the <s-cr> mapping may be used to squeeze (close) the - directory currently containing the cursor. + *netrw-s-cr* +Squeezing the Current Tree-Listing Directory~ + +When the tree listing style is enabled (see |netrw-i|) and one is using +gvim, then the <s-cr> mapping may be used to squeeze (close) the +directory currently containing the cursor. + +Otherwise, one may remap a key combination of one's own choice to get +this effect: > + nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze +< +Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated +for netrw buffers only. -Related topics: |netrw-o| |netrw-p| |netrw-P| |netrw-t| |netrw-v| -Associated setting variables: |g:netrw_browse_split| |g:netrw_fastbrowse| - |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| - |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_cmd| - |g:netrw_ssh_browse_reject| |g:netrw_use_noswf| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| +Associated setting variables: + |g:netrw_browse_split| |g:netrw_fastbrowse| + |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| + |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject| + |g:netrw_ssh_cmd| |g:netrw_use_noswf| BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2 @@ -1207,12 +1297,14 @@ cursor at the top. Associated setting variables: |g:netrw_alto| |g:netrw_winsize| -Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_alto| control above/below splitting |g:netrw_winsize| control initial sizing -BROWSING WITH A NEW TAB *netrw-t* +BROWSING WITH A NEW TAB *netrw-t* {{{2 Normally one enters a file or directory using the <cr>. The "t" map allows one to open a new window holding the new directory listing or file in @@ -1220,7 +1312,9 @@ a new tab. If you'd like to have the new listing in a background tab, use |gT|. -Related Actions |netrw-cr| |netrw-o| |netrw-p| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_winsize| control initial sizing @@ -1236,13 +1330,30 @@ cursor at the left. There is only one tree listing buffer; using "v" on a displayed subdirectory will split the screen, but the same buffer will be shown twice. -Related Actions: |netrw-cr| |netrw-o| |netrw-t| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_altv| control right/left splitting |g:netrw_winsize| control initial sizing -CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2 +BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2 + +One may keep a browsing gvim separate from the gvim being used to edit. +Use the <c-r> map on a file (not a directory) in the netrw browser, and it +will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr> +(see |netrw-cr|) will re-use that server for editing files. + +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| +Associated setting variables: + |g:netrw_servername| : sets name of server + |g:netrw_browse_split| : controls how <cr> will open files + + +CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2 The "i" map cycles between the thin, long, wide, and tree listing formats. @@ -1267,7 +1378,7 @@ name. One may make a preferred listing style your default; see |g:netrw_liststyle|. As an example, by putting the following line in your .vimrc, > - let g:netrw_liststyle= 4 + let g:netrw_liststyle= 3 the tree style will become your default listing style. One typical way to use the netrw tree display is to: > @@ -1311,25 +1422,32 @@ Related Topics: CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2 -Every time you change to a new directory (new for the current session), -netrw will save the directory in a recently-visited directory history -list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the -"u" map, one can change to an earlier directory (predecessor). To do -the opposite, see |netrw-U|. +Every time you change to a new directory (new for the current session), netrw +will save the directory in a recently-visited directory history list (unless +|g:netrw_dirhistmax| is zero; by default, it holds ten entries). With the "u" +map, one can change to an earlier directory (predecessor). To do the +opposite, see |netrw-U|. -The "u" map also accepts counts to go back in the history several slots. -For your convenience, |netrw-qb| lists the history number which can be -re-used in that count. +The "u" map also accepts counts to go back in the history several slots. For +your convenience, qb (see |netrw-qb|) lists the history number which may be +used in that count. + *.netrwhist* See |g:netrw_dirhistmax| for how to control the quantity of history stack -slots. +slots. The file ".netrwhist" holds history when netrw (and vim) is not +active. By default, its stored on the first directory on the user's +|'runtimepath'|. + +Related Topics: + |netrw-U| changing to a successor directory + |g:netrw_home| controls where .netrwhist is kept CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2 With the "U" map, one can change to a later directory (successor). This map is the opposite of the "u" map. (see |netrw-u|) Use the -q map to list both the bookmarks and history. (see |netrw-qb|) +qb map to list both the bookmarks and history. (see |netrw-qb|) The "U" map also accepts counts to go forward in the history several slots. @@ -1337,7 +1455,7 @@ See |g:netrw_dirhistmax| for how to control the quantity of history stack slots. -CHANGING TREE TOP *netrw-ntree* *:Ntree* +CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2 One may specify a new tree top for tree listings using > @@ -1347,30 +1465,34 @@ Without a "dirname", the current line is used (and any leading depth information is elided). With a "dirname", the specified directory name is used. +The "gn" map will take the word below the cursor and use that for +changing the top of the tree listing. -NETRW CLEAN *netrw-clean* *:NetrwClean* + +NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2 With :NetrwClean one may easily remove netrw from one's home directory; more precisely, from the first directory on your |'runtimepath'|. -With :NetrwClean!, netrw will remove netrw from all directories on your -|'runtimepath'|. +With :NetrwClean!, netrw will attempt to remove netrw from all directories on +your |'runtimepath'|. Of course, you have to have write/delete permissions +correct to do this. With either form of the command, netrw will first ask for confirmation that the removal is in fact what you want to do. If netrw doesn't have permission to remove a file, it will issue an error message. *netrw-gx* -CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* {{{2 +CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2 (also see |netrw_filehandler|) Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are -best seen with a special handler (ie. a tool provided with your computer). -Netrw allows one to invoke such special handlers by: > +best seen with a special handler (ie. a tool provided with your computer's +operating system). Netrw allows one to invoke such special handlers by: > * when Exploring, hit the "x" key * when editing, hit gx with the cursor atop the special filename -< (not available if the |g:netrw_nogx| variable exists) +< (latter not available if the |g:netrw_nogx| variable exists) Netrw determines which special handler by the following method: @@ -1379,14 +1501,14 @@ Netrw determines which special handler by the following method: :let g:netrw_browsex_viewer= "kfmclient exec" < or > - :let g:netrw_browsex_viewer= "gnome-open" + :let g:netrw_browsex_viewer= "xdg-open" < - If g:netrw_browsex_viewer == '-', then netrwFileHandler() will be - invoked first (see |netrw_filehandler|). + If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be + used instead (see |netrw_filehandler|). - * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. + * for Windows 32 or 64, the URL and FileProtocolHandler dlls are used. * for Gnome (with gnome-open): gnome-open is used. - * for KDE (with kfmclient) : kfmclient is used. + * for KDE (with kfmclient) : kfmclient is used * for Mac OS X : open is used. * otherwise the netrwFileHandler plugin is used. @@ -1395,17 +1517,34 @@ appropriate application to use to "handle" these files. Such things as OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps, *.eps) can be handled. +The gx mapping extends to all buffers; apply "gx" while atop a word and netrw +will apply a special handler to it (like "x" works when in a netrw buffer). +One may also use visual mode (see |visual-start|) to select the text that the +special handler will use. Normally gx uses expand("<cfile>") to pick up the +text under the cursor; one may change what |expand()| uses via the +|g:netrw_gx| variable (options include "<cword>", "<cWORD>"). Note that +expand("<cfile>") depends on the |'isfname'| setting. Alternatively, one may +select the text to be used by gx by making a visual selection (see +|visual-block|) and then pressing gx. + +Associated setting variables: + |g:netrw_gx| control how gx picks up the text under the cursor + |g:netrw_nogx| prevent gx map while editing + |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages + *netrw_filehandler* -The "x" map applies a function to a file, based on its extension. Of course, -the handler function must exist for it to be called! +When |g:netrw_browsex_viewer| exists and is "-", then netrw will attempt to +handle the special file with a vim function. The "x" map applies a function +to a file, based on its extension. Of course, the handler function must exist +for it to be called! > - Ex. mypgm.html x -> - NFH_html("scp://user@host/some/path/mypgm.html") -< -Users may write their own netrw File Handler functions to support more -suffixes with special handling. See <autoload/netrwFileHandlers.vim> for -examples on how to make file handler functions. As an example: > + Ex. mypgm.html x -> NFH_html("scp://user@host/some/path/mypgm.html") + +< Users may write their own netrw File Handler functions to + support more suffixes with special handling. See + <autoload/netrwFileHandlers.vim> for examples on how to make + file handler functions. As an example: > " NFH_suffix(filename) fun! NFH_suffix(filename) @@ -1439,7 +1578,14 @@ DELETING BOOKMARKS *netrw-mB* {{{2 To delete a bookmark, use > {cnt}mB -< + +If there are marked files, then mB will remove them from the +bookmark list. + +Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). > + + :NetrwMB! [files/directories] + Related Topics: |netrw-gb| how to return (go) to a bookmark |netrw-mb| how to make a bookmark @@ -1471,6 +1617,11 @@ A further approach is to delete files which match a pattern. This will cause the matching files to be marked. Then, press "D". +If your vim has 7.4 with patch#1107, then |g:netrw_localrmdir| no longer +is used to remove directories; instead, vim's |delete()| is used with +the "d" option. Please note that only empty directories may be deleted +with the "D" mapping. Regular files are deleted with |delete()|, too. + The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are used to control the attempts to remove remote files and directories. The g:netrw_rm_cmd is used with files, and its default value is: @@ -1498,11 +1649,11 @@ DIRECTORY EXPLORATION COMMANDS {{{2 :[N]Explore[!] [dir]... Explore directory of current file *:Explore* :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore* - :Rexplore ... Return to/from Explorer *:Rexplore* + :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore* :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore* - :Texplore [dir]... Tab & Explore *:Texplore* :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore* - :Lexplore [dir]... Left Explorer Toggle *:Lexplore* + :Texplore [dir]... Tab & Explore *:Texplore* + :Rexplore ... Return to/from Explorer *:Rexplore* Used with :Explore **/pattern : (also see |netrw-starstar|) :Nexplore............. go to next matching file *:Nexplore* @@ -1511,54 +1662,78 @@ DIRECTORY EXPLORATION COMMANDS {{{2 *netrw-:Explore* :Explore will open the local-directory browser on the current file's directory (or on directory [dir] if specified). The window will be - split only if the file has been modified, otherwise the browsing - window will take over that window. Normally the splitting is taken - horizontally. + split only if the file has been modified and |'hidden'| is not set, + otherwise the browsing window will take over that window. Normally + the splitting is taken horizontally. Also see: |netrw-:Rexplore| :Explore! is like :Explore, but will use vertical splitting. - *netrw-:Lexplore* -:Lexplore [dir] toggles an Explorer window on the left hand side - of the current tab It will open a netrw window on the current - directory if [dir] is omitted; a :Lexplore [dir] will show - the specified directory in the left-hand side browser display - no matter from which window the command is issued. By default, - :Lexplore will change an uninitialized |g:netrw_chgwin| to 2; - edits will thus be preferentially made in window#2. - Also see: |netrw-C|| |g:netrw_chgwin| |g:netrw_winsize| - |netrw-p| |netrw-P|| |g:netrw_browse_split| - *netrw-:Sexplore* -:Sexplore will always split the window before invoking the local-directory - browser. As with Explore, the splitting is normally done - horizontally. -:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. + *netrw-:Hexplore* :Hexplore [dir] does an :Explore with |:belowright| horizontal splitting. :Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting. - *netrw-:Vexplore* -:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. -:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. + + *netrw-:Lexplore* +:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side + of the current tab. It will open a netrw window on the current + directory if [dir] is omitted; a :Lexplore [dir] will show the + specified directory in the left-hand side browser display no matter + from which window the command is issued. + + By default, :Lexplore will change an uninitialized |g:netrw_chgwin| + to 2; edits will thus preferentially be made in window#2. + + The [N] specifies a |g:netrw_winsize| just for the new :Lexplore + window. + + Those who like this method often also like tree style displays; + see |g:netrw_liststyle|. + +:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height + Explorer window will open on the right hand side and an + uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will + preferentially occur in the leftmost window). + + Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw| + |netrw-p| |netrw-P| |g:netrw_chgwin| + |netrw-c-tab| |g:netrw_winsize| + + *netrw-:Sexplore* +:[N]Sexplore will always split the window before invoking the local-directory + browser. As with Explore, the splitting is normally done + horizontally. +:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. + *netrw-:Texplore* :Texplore [dir] does a |:tabnew| before generating the browser window -By default, these commands use the current file's directory. However, one may -explicitly provide a directory (path) to use. + *netrw-:Vexplore* +:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. +:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. + +The optional parameters are: -The [N] will override |g:netrw_winsize| to specify the quantity of rows and/or -columns the new explorer window should have. + [N]: This parameter will override |g:netrw_winsize| to specify the quantity of + rows and/or columns the new explorer window should have. + Otherwise, the |g:netrw_winsize| variable, if it has been specified by the + user, is used to control the quantity of rows and/or columns new + explorer windows should have. -Otherwise, the |g:netrw_winsize| variable, if it has been specified by the -user, is used to control the quantity of rows and/or columns new explorer -windows should have. + [dir]: By default, these explorer commands use the current file's directory. + However, one may explicitly provide a directory (path) to use instead; + ie. > + :Explore /some/path +< *netrw-:Rexplore* -:Rexplore This command is a little different from the others as it doesn't - necessarily open an Explorer window. +:Rexplore This command is a little different from the other Explore commands + as it doesn't necessarily open an Explorer window. Return to Explorer~ - When one edits a file, for example by pressing <cr> when the - cursor is atop a file in a netrw browser window, :Rexplore will - return the display to that of the last netrw browser display - in that window. + When one edits a file using netrw which can occur, for example, + when pressing <cr> while the cursor is atop a filename in a netrw + browser window, a :Rexplore issued while editing that file will + return the display to that of the last netrw browser display in + that window. Return from Explorer~ Conversely, when one is editing a directory, issuing a :Rexplore @@ -1571,12 +1746,13 @@ windows should have. Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize| -*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* -EXPLORING WITH STARS AND PATTERNS +*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep* +EXPLORING WITH STARS AND PATTERNS {{{2 When Explore, Sexplore, Hexplore, or Vexplore are used with one of the -following four styles, Explore generates a list of files which satisfy -the request. > +following four patterns Explore generates a list of files which satisfy the +request for the local file system. These exploration patterns will not work +with remote file browsing. */filepat files in current directory which satisfy filepat **/filepat files in current directory or below which satisfy the @@ -1597,7 +1773,7 @@ will clear the explore list. If your console or gui produces recognizable shift-up or shift-down sequences, then you'll likely find using shift-downarrow and shift-uparrow convenient. -They're mapped by netrw: +They're mapped by netrw as follows: <s-down> == Nexplore, and <s-up> == Pexplore. @@ -1678,13 +1854,15 @@ Related topics: |netrw-s| |netrw-S| Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options| -EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* +EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2 Pressing X while the cursor is atop an executable file will yield a prompt using the filename asking for any arguments. Upon pressing a [return], netrw -will then call |system()| with that command and arguments. The result will -be displayed by |:echomsg|, and so |:messages| will repeat display of the -result. Ansi escape sequences will be stripped out. +will then call |system()| with that command and arguments. The result will be +displayed by |:echomsg|, and so |:messages| will repeat display of the result. +Ansi escape sequences will be stripped out. + +See |cmdline-window| for directions for more on how to edit the arguments. FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2 @@ -1769,18 +1947,19 @@ Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh| Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with |g:netrw_list_hide| automatically hides all git-ignored files. -'netrw_gitignore#Hide' searches for patterns in the following files: +'netrw_gitignore#Hide' searches for patterns in the following files: > + './.gitignore' './.git/info/exclude' global gitignore file: `git config --global core.excludesfile` system gitignore file: `git config --system core.excludesfile` - +< Files that do not exist, are ignored. Git-ignore patterns are taken from existing files, and converted to patterns for hiding files. For example, if you had '*.log' in your '.gitignore' file, it would be converted to '.*\.log'. -To use this function, simply assign it's output to |g:netrw_list_hide| option. +To use this function, simply assign its output to |g:netrw_list_hide| option. > Example: let g:netrw_list_hide= netrw_gitignore#Hide() Git-ignored files are hidden in Netrw. @@ -1790,7 +1969,7 @@ To use this function, simply assign it's output to |g:netrw_list_hide| option. Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$' Combining 'netrw_gitignore#Hide' with custom patterns. - +< IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2 @@ -1906,7 +2085,7 @@ Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd| |g:netrw_remote_mkdir| |netrw-%| -MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2 +MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2 By default, |g:netrw_keepdir| is 1. This setting means that the current directory will not track the browsing directory. (done for backwards @@ -1921,12 +2100,15 @@ the two directories the same, use the "c" map (just type c). That map will set Vim's notion of the current directory to netrw's current browsing directory. +*netrw-c* : This map's name has been changed from "c" to cd (see |netrw-cd|). + This change was done to allow for |netrw-cb| and |netrw-cB| maps. + Associated setting variable: |g:netrw_keepdir| MARKING FILES *netrw-:MF* *netrw-mf* {{{2 (also see |netrw-mr|) -Netrw has several ways of marking files: +Netrw provides several ways to mark files: * One may mark files with the cursor atop a filename and then pressing "mf". @@ -1940,15 +2122,24 @@ Netrw has several ways of marking files: :MF *.c < - * Note that :MF uses |<f-args>| to break the line - at spaces. + (Note that :MF uses |<f-args>| to break the line + at spaces) + + * Mark files using the |argument-list| (|netrw-mA|) + + * Mark files based upon a |location-list| (|netrw-qL|) * Mark files based upon the quickfix list (|netrw-qF|) + (|quickfix-error-lists|) The following netrw maps make use of marked files: |netrw-a| Hide marked files/directories |netrw-D| Delete marked files/directories + |netrw-ma| Move marked files' names to |arglist| + |netrw-mA| Move |arglist| filenames to marked file list + |netrw-mb| Append marked files to bookmarks + |netrw-mB| Delete marked files from bookmarks |netrw-mc| Copy marked files to target |netrw-md| Apply vimdiff to marked files |netrw-me| Edit marked files @@ -1956,9 +2147,12 @@ The following netrw maps make use of marked files: |netrw-mg| Apply vimgrep to marked files |netrw-mm| Move marked files to target |netrw-mp| Print marked files + |netrw-ms| Netrw will source marked files |netrw-mt| Set target for |netrw-mm| and |netrw-mc| |netrw-mT| Generate tags using marked files + |netrw-mv| Apply vim command to marked files |netrw-mx| Apply shell command to marked files + |netrw-mX| Apply shell command to marked files, en bloc |netrw-mz| Compress/Decompress marked files |netrw-O| Obtain marked files |netrw-R| Rename marked files @@ -1982,13 +2176,13 @@ If the mouse is enabled and works with your vim, you may use <s-leftmouse> to mark one or more files. You may mark multiple files by dragging the shifted leftmouse. (see |netrw-mouse|) -*markfilelist* *global_markfilelist* *local_markfilelist* + *markfilelist* *global_markfilelist* *local_markfilelist* All marked files are entered onto the global marked file list; there is only -one such list. In addition, every netrw buffer also has its own local marked -file list; since netrw buffers are associated with specific directories, this -means that each directory has its own local marked file list. The various -commands which operate on marked files use one or the other of the marked file -lists. +one such list. In addition, every netrw buffer also has its own buffer-local +marked file list; since netrw buffers are associated with specific +directories, this means that each directory has its own local marked file +list. The various commands which operate on marked files use one or the other +of the marked file lists. Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several directories have files with the same name, then marking such a file will @@ -1998,19 +2192,24 @@ is unlikely to be fixed. UNMARKING FILES *netrw-mF* {{{2 + (also see |netrw-mf|, |netrw-mu|) + +The "mF" command will unmark all files in the current buffer. One may also use +mf (|netrw-mf|) on a specific, already marked, file to unmark just that file. + +MARKING FILES BY LOCATION LIST *netrw-qL* {{{2 (also see |netrw-mf|) -This command will unmark all files in the current buffer. One may also use -mf (|netrw-mf|) on a specific file to unmark just that file. +One may convert |location-list|s into a marked file list using "qL". +You may then proceed with commands such as me (|netrw-me|) to edit them. -MARKING FILES BY QUICKFIX LIST *netrw-qF* +MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 (also see |netrw-mf|) -One may convert the |quickfix-error-lists| into a marked file list using -"qF". You may then proceed with commands such as me (|netrw-me|) to -edit them. Quickfix error lists are generated, for example, by calls -to |:vimgrep|. +One may convert |quickfix-error-lists| into a marked file list using "qF". +You may then proceed with commands such as me (|netrw-me|) to edit them. +Quickfix error lists are generated, for example, by calls to |:vimgrep|. MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 @@ -2023,8 +2222,28 @@ converts "*" into ".*" (see |regexp|) and marks files based on that. In the future I may make it possible to use |regexp|s instead of glob()-style expressions (yet-another-option). +See |cmdline-window| for directions on more on how to edit the regular +expression. + + +MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2 + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked-file list) + +The "mv" map causes netrw to execute an arbitrary vim command on each file on +the local marked file list, individually: + + * 1split + * sil! keepalt e file + * run vim command + * sil! keepalt wq! -MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2 +A prompt, "Enter vim command: ", will be issued to elicit the vim command you +wish used. See |cmdline-window| for directions for more on how to edit the +command. + + +MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked-file list) @@ -2033,6 +2252,57 @@ command to be applied to all marked files. All "%"s in the command will be substituted with the name of each marked file in turn. If no "%"s are in the command, then the command will be followed by a space and a marked filename. +Example: + (mark files) + mx + Enter command: cat + + The result is a series of shell commands: + cat 'file1' + cat 'file2' + ... + + +MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2 + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Upon activation of the 'mX' map, netrw will query the user for some (external) +command to be applied to all marked files on the global marked file list. The +"en bloc" means that one command will be executed on all the files at once: > + + command files + +This approach is useful, for example, to select files and make a tarball: > + + (mark files) + mX + Enter command: tar cf mynewtarball.tar +< +The command that will be run with this example: + + tar cf mynewtarball.tar 'file1' 'file2' ... + + +MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA* + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Using ma, one moves filenames from the marked file list to the argument list. +Using mA, one moves filenames from the argument list to the marked file list. + +See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args| + + +MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB* + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Using cb, one moves filenames from the marked file list to the buffer list. +Using cB, one copies filenames from the buffer list to the marked file list. + +See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers| + MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2043,9 +2313,13 @@ If any marked files are decompressed, then "mz" will compress them using the command specified by |g:netrw_compress|; by default, that's "gzip". -For decompression, netrw provides a |Dictionary| of suffices and their +For decompression, netrw uses a |Dictionary| of suffices and their associated decompressing utilities; see |g:netrw_decompress|. +Remember that one can mark multiple files by regular expression +(see |netrw-mr|); this is particularly useful to facilitate compressing and +decompressing a large number of files. + Associated setting variables: |g:netrw_compress| |g:netrw_decompress| MARKED FILES: COPYING *netrw-mc* {{{2 @@ -2056,7 +2330,16 @@ Select a target directory with mt (|netrw-mt|). Then change directory, select file(s) (see |netrw-mf|), and press "mc". The copy is done from the current window (where one does the mf) to the target. -Associated setting variable: |g:netrw_localcopycmd| |g:netrw_ssh_cmd| +If one does not have a target directory set with |netrw-mt|, then netrw +will query you for a directory to copy to. + +One may also copy directories and their contents (local only) to a target +directory. + +Associated setting variables: + |g:netrw_localcopycmd| |g:netrw_localcopycmdopt| + |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt| + |g:netrw_ssh_cmd| MARKED FILES: DIFF *netrw-md* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2069,7 +2352,7 @@ MARKED FILES: EDITING *netrw-me* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -This command will place the marked files on the |arglist| and commence +The "me" command will place the marked files on the |arglist| and commence editing them. One may return the to explorer window with |:Rexplore|. (use |:n| and |:p| to edit next and previous files in the arglist) @@ -2077,26 +2360,33 @@ MARKED FILES: GREP *netrw-mg* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -This command will apply |:vimgrep| to the marked files. +The "mg" command will apply |:vimgrep| to the marked files. The command will ask for the requested pattern; one may then enter: > /pattern/[g][j] ! /pattern/[g][j] pattern < -In the cases of "j" option usage as shown above, "mg" will winnow the current -marked file list to just those possessing the specified pattern. -Thus, one may use > - mr ...file-pattern - mg ..contents-pattern -to have a marked file list satisfying the file-pattern but containing the -desried contents-pattern. +With /pattern/, editing will start with the first item on the |quickfix| list +that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep| +command is in use, so without 'g' each line is added to quickfix list only +once; with 'g' every match is included. + +With /pattern/j, "mg" will winnow the current marked file list to just those +marked files also possessing the specified pattern. Thus, one may use > + + mr ...file-pattern... + mg /pattern/j +< +to have a marked file list satisfying the file-pattern but also restricted to +files containing some desired pattern. + MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -This command extracts the suffices of the marked files and toggles their +The "mh" command extracts the suffices of the marked files and toggles their presence on the hiding list. Please note that marking the same suffix this way multiple times will result in the suffix's presence being toggled for each file (so an even quantity of marked files having the same suffix @@ -2125,16 +2415,16 @@ MARKED FILES: PRINTING *netrw-mp* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -Netrw will apply the |:hardcopy| command to marked files. What it does -is open each file in a one-line window, execute hardcopy, then close the -one-line window. +When "mp" is used, netrw will apply the |:hardcopy| command to marked files. +What netrw does is open each file in a one-line window, execute hardcopy, then +close the one-line window. MARKED FILES: SOURCING *netrw-ms* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -Netrw will source the marked files (using vim's |:source| command) +With "ms", netrw will source the marked files (using vim's |:source| command) MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 @@ -2148,7 +2438,7 @@ Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): * Also, if the cursor is in the banner, then the netrw window's currently displayed directory is used for the copy/move-to target. Unless the target already is the current directory. In which case, - remove the target. + typing "mf" clears the target. * However, if the cursor is atop a directory name, then that directory is used for the copy/move-to target @@ -2157,9 +2447,12 @@ Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): This command uses |<q-args>|, so spaces in the directory name are permitted without escaping. -There is only one copy/move-to target per vim session; ie. the target is a -script variable (see |s:var|) and is shared between all netrw windows (in an -instance of vim). + * With mouse-enabled vim or with gvim, one may select a target by using + <c-leftmouse> + +There is only one copy/move-to target at a time in a vim session; ie. the +target is a script variable (see |s:var|) and is shared between all netrw +windows (in an instance of vim). When using menus and gvim, netrw provides a "Targets" entry which allows one to pick a target from the list of bookmarks and history. @@ -2190,13 +2483,13 @@ When a remote set of files are tagged, the resulting tags file is "obtained"; ie. a copy is transferred to the local system's directory. The now local tags file is then modified so that one may use it through the network. The modification made concerns the names of the files in the tags; each filename is -preceded by the netrw-compatible url used to obtain it. When one subsequently -uses one of the go to tag actions (|tags|), the url will be used by netrw to +preceded by the netrw-compatible URL used to obtain it. When one subsequently +uses one of the go to tag actions (|tags|), the URL will be used by netrw to edit the desired file and go to the tag. Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd| -MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 +MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 Sets the marked file copy/move-to target. @@ -2214,7 +2507,7 @@ Related topics: Moving files to target.............................|netrw-mm| -MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 +MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 Sets the marked file copy/move-to target. @@ -2233,9 +2526,13 @@ Related topics: MARKED FILES: UNMARKING *netrw-mu* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf|, |netrw-mF|) + +The "mu" mapping will unmark all currently marked files. This command differs +from "mF" as the latter only unmarks files in the current directory whereas +"mu" will unmark global and all buffer-local marked files. +(see |netrw-mF|) -The "mu" mapping will unmark all currently marked files. *netrw-browser-settings* NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2 @@ -2269,15 +2566,13 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_banner* enable/suppress the banner =0: suppress the banner =1: banner is enabled (default) - NOTE: suppressing the banner is a new feature - which may cause problems. *g:netrw_bannerbackslash* if this variable exists and is not zero, the banner will be displayed with backslashes rather than forward slashes. *g:netrw_browse_split* when browsing, <cr> will open the file by: - =0: re-using the same window + =0: re-using the same window (default) =1: horizontally splitting the window first =2: vertically splitting the window first =3: open file in new tab @@ -2285,10 +2580,19 @@ your browsing preferences. (see also: |netrw-settings|) Note that |g:netrw_preview| may be used to get vertical splitting instead of horizontal splitting. + =[servername,tab-number,window-number] + Given a |List| such as this, a remote server + named by the "servername" will be used for + editing. It will also use the specified tab + and window numbers to perform editing + (see |clientserver|, |netrw-ctrl-r|) + This option does not affect the production of + |:Lexplore| windows. Related topics: - |netrw-cr| |netrw-C| - |g:netrw_alto| |g:netrw_altv| + |g:netrw_alto| |g:netrw_altv| + |netrw-C| |netrw-cr| + |netrw-ctrl-r| *g:netrw_browsex_viewer* specify user's preference for a viewer: > "kfmclient exec" @@ -2321,7 +2625,7 @@ your browsing preferences. (see also: |netrw-settings|) tags *g:netrw_cursor* = 2 (default) - This option controls the use of the + This option controls the use of the |'cursorline'| (cul) and |'cursorcolumn'| (cuc) settings by netrw: @@ -2385,7 +2689,7 @@ your browsing preferences. (see also: |netrw-settings|) versus speed. *g:netrw_ffkeep* (default: doesn't exist) - If this variable exists and is zero, then + If this variable exists and is zero, then netrw will not do a save and restore for |'fileformat'|. @@ -2428,6 +2732,11 @@ your browsing preferences. (see also: |netrw-settings|) These characters in directory names are escaped before applying glob() + *g:netrw_gx* ="<cfile>" + This option controls how gx (|netrw-gx|) picks + up the text under the cursor. See |expand()| + for possibilities. + *g:netrw_hide* Controlled by the "a" map (see |netrw-a|) =0 : show all =1 : show not-hidden files @@ -2437,6 +2746,7 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_home* The home directory for where bookmarks and history are saved (as .netrwbook and .netrwhist). + Netrw uses |expand()|on the string. default: the first directory on the |'runtimepath'| @@ -2447,10 +2757,22 @@ your browsing preferences. (see also: |netrw-settings|) The current browsing directory is contained in b:netrw_curdir (also see |netrw-c|) + *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the + |:jumps| table unaffected. + ="" netrw will not use |:keepjumps| with + exceptions only for the + saving/restoration of position. + *g:netrw_list_cmd* command for listing remote directories default: (if ssh is executable) "ssh HOSTNAME ls -FLa" + *g:netrw_list_cmd_options* If this variable exists, then its contents are + appended to the g:netrw_list_cmd. For + example, use "2>/dev/null" to get rid of banner + messages on unix systems. + + *g:netrw_liststyle* Set the default listing style: = 0: thin listing (one file per line) = 1: long listing (one file per line with time @@ -2468,24 +2790,55 @@ your browsing preferences. (see also: |netrw-settings|) Examples: let g:netrw_list_hide= '.*\.swp$' - let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' + let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' default: "" - *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin - ="copy" Windows + *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows Copies marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mc|) - *g:netrw_localmkdir* command for making a local directory - default: "mkdir" + *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin + =' \c copy' Windows + Options for the |g:netrw_localcopycmd| + + *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows + Copies directories to target directory. + (|netrw-mc|, |netrw-mt|) + + *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin + =" /c xcopy /e /c /h/ /i /k" Windows + Options for |g:netrw_localcopydircmd| + + *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows + command for making a local directory - *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin - ="move" Windows + *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin + =" /c mkdir" Windows + Options for |g:netrw_localmkdir| + + *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows Moves marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mm|) - *g:netrw_localrmdir* remove directory command (rmdir) - default: "rmdir" + *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin + =" /c move" Windows + Options for |g:netrw_localmovecmd| + + *g:netrw_localrmdir* ="rmdir" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows + Remove directory command (rmdir) + This variable is only used if your vim is + earlier than 7.4 or if your vim doesn't + have patch#1107. Otherwise, |delete()| + is used with the "d" option. + + *g:netrw_localrmdiropt* ="" Linux/Unix/MacOS/Cygwin + =" /c rmdir" Windows + Options for |g:netrw_localrmdir| *g:netrw_maxfilenamelen* =32 by default, selected so as to make long listings fit on 80 column displays. @@ -2499,7 +2852,7 @@ your browsing preferences. (see also: |netrw-settings|) default: "ssh USEPORT HOSTNAME mkdir" *g:netrw_mousemaps* =1 (default) enables mouse buttons while - browsing to: + browsing to: leftmouse : open file/directory shift-leftmouse : mark file middlemouse : same as P @@ -2511,6 +2864,21 @@ your browsing preferences. (see also: |netrw-settings|) evaluation will be suppressed (see |'ballooneval'|) + *g:netrw_sizestyle* not defined: actual bytes (default) + ="b" : actual bytes (default) + ="h" : human-readable (ex. 5k, 4m, 3g) + uses 1000 base + ="H" : human-readable (ex. 5K, 4M, 3G) + uses 1024 base + The long listing (|netrw-i|) and query-file + maps (|netrw-qf|) will display file size + using the specified style. + + *g:netrw_usetab* if this variable exists and is non-zero, then + the <tab> map supporting shrinking/expanding a + Lexplore or netrw window will be enabled. + (see |netrw-c-tab|) + *g:netrw_remote_mkdir* command for making a remote directory via ftp (also see |g:netrw_mkdir_cmd|) default: "mkdir" @@ -2543,7 +2911,12 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_rmf_cmd* command for removing remote softlinks default: "ssh USEPORT HOSTNAME rm -f" - *g:netrw_sort_by* sort by "name", "time", or "size" + *g:netrw_servername* use this variable to provide a name for + |netrw-ctrl-r| to use for its server. + default: "NETRWSERVER" + + *g:netrw_sort_by* sort by "name", "time", "size", or + "exten". default: "name" *g:netrw_sort_direction* sorting direction: "normal" or "reverse" @@ -2578,17 +2951,23 @@ your browsing preferences. (see also: |netrw-settings|) netrwTilde : * netrwTmp : tmp* *tmp - These syntax highlighting groups are linked - to Folded or DiffChange by default - (see |hl-Folded| and |hl-DiffChange|), but - one may put lines like > + In addition, those groups mentioned in + |'suffixes'| are also added to the special + file highlighting group. + These syntax highlighting groups are linked + to netrwGray or Folded by default + (see |hl-Folded|), but one may put lines like > hi link netrwCompress Visual < into one's <.vimrc> to use one's own preferences. Alternatively, one may - put such specifications into - .vim/after/syntax/netrw.vim. - - As an example, I myself use a dark-background + put such specifications into > + .vim/after/syntax/netrw.vim. +< The netrwGray highlighting is set up by + netrw when > + * netrwGray has not been previously + defined + * the gui is running +< As an example, I myself use a dark-background colorscheme with the following in .vim/after/syntax/netrw.vim: > @@ -2617,6 +2996,13 @@ your browsing preferences. (see also: |netrw-settings|) such as listing, file removal, etc. default: ssh + *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages + which are normally unwanted intermixed + with the page. + However, when using links, for example, + those messages are what the browser produces. + By setting this option to 0, netrw will not + suppress browser messages. *g:netrw_tmpfile_escape* =' &;' escape() is applied to all temporary files @@ -2655,6 +3041,10 @@ your browsing preferences. (see also: |netrw-settings|) take effect, for example). default: 50 (for 50%) + *g:netrw_wiw* =1 specifies the minimum window width to use + when shrinking a netrw/Lexplore window + (see |netrw-c-tab|). + *g:netrw_xstrlen* Controls how netrw computes string lengths, including multi-byte characters' string length. (thanks to N Weibull, T Mechelynck) @@ -2700,7 +3090,7 @@ help on what each of the variables do. ============================================================================== -OBTAINING A FILE *netrw-O* {{{2 +OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2 If there are no marked files: @@ -2730,8 +3120,8 @@ Related topics: * To automatically make the currently browsed directory the current directory, see |g:netrw_keepdir|. - *netrw-createfile* -OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* + *netrw-newfile* *netrw-createfile* +OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2 To open a new file in netrw's current directory, press "%". This map will query the user for a new filename; an empty file by that name will @@ -2744,9 +3134,9 @@ PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2 One may use a preview window by using the "p" key when the cursor is atop the desired filename to be previewed. The display will then split to show both -the browser (where the cursor will remain) and the file (see |:pedit|). -By default, the split will be taken horizontally; one may use vertical -splitting if one has set |g:netrw_preview| first. +the browser (where the cursor will remain) and the file (see |:pedit|). By +default, the split will be taken horizontally; one may use vertical splitting +if one has set |g:netrw_preview| first. An interesting set of netrw settings is: > @@ -2755,20 +3145,24 @@ An interesting set of netrw settings is: > let g:netrw_winsize = 30 These will: + 1. Make vertical splitting the default for previewing files 2. Make the default listing style "tree" 3. When a vertical preview window is opened, the directory listing will use only 30% of the columns available; the rest of the window is used for the preview window. -Also see: |g:netrw_chgwin| |netrw-P| + Related: if you like this idea, you may also find :Lexplore + (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest + +Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose| -PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 +PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 -To edit a file or directory in the previously used (last accessed) window (see -:he |CTRL-W_p|), press a "P". If there's only one window, then the one window -will be horizontally split (by default). +To edit a file or directory under the cursor in the previously used (last +accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one +window, then the one window will be horizontally split (by default). If there's more than one window, the previous window will be re-used on the selected file/directory. If the previous window's associated buffer @@ -2786,7 +3180,7 @@ Associated setting variables: Also see: |g:netrw_chgwin| |netrw-p| -REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* {{{2 +REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2 To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or hit the <cr> when atop the ./ directory entry in the listing. One may also @@ -2806,31 +3200,55 @@ RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2 If there are no marked files: (see |netrw-mf|) - Renaming/moving files and directories involves moving the cursor to the + Renaming files and directories involves moving the cursor to the file/directory to be moved (renamed) and pressing "R". You will then be - queried for where you want the file/directory to be moved. You may select - a range of lines with the "V" command (visual selection), and then - pressing "R". + queried for what you want the file/directory to be renamed to. You may + select a range of lines with the "V" command (visual selection), and then + press "R"; you will be queried for each file as to what you want it + renamed to. If there are marked files: (see |netrw-mf|) Marked files will be renamed (moved). You will be queried as above in order to specify where you want the file/directory to be moved. + If you answer a renaming query with a "s/frompattern/topattern/", then + subsequent files on the marked file list will be renamed by taking each + name, applying that substitute, and renaming each file to the result. + As an example : > + + mr [query: reply with *.c] + R [query: reply with s/^\(.*\)\.c$/\1.cpp/] +< + This example will mark all *.c files and then rename them to *.cpp + files. + + The ctrl-X character has special meaning for renaming files: > + + <c-x> : a single ctrl-x tells netrw to ignore the portion of the response + lying between the last '/' and the ctrl-x. + + <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any + portion of the string preceding the double ctrl-x's. +< WARNING:~ Note that moving files is a dangerous operation; copies are safer. That's because a "move" for remote files is actually a copy + delete -- and if - the copy fails and the delete does not, you may lose the file. + the copy fails and the delete succeeds you may lose the file. Use at your own risk. -The g:netrw_rename_cmd variable is used to implement renaming. By default its -value is: +The *g:netrw_rename_cmd* variable is used to implement remote renaming. By +default its value is: > ssh HOSTNAME mv - +< One may rename a block of files and directories by selecting them with -the V (|linewise-visual|). +V (|linewise-visual|) when using thin style. + +See |cmdline-editing| for more on how to edit the command line; in particular, +you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the +command line under the cursor) useful in conjunction with the R command. SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 @@ -2843,25 +3261,113 @@ Related topics: |netrw-r| |netrw-S| Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence| -SETTING EDITING WINDOW *netrw-C* {{{2 +SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2 -One may select a netrw window for editing with the "C" mapping, or by setting -g:netrw_chgwin to the selected window number. Subsequent selection of a file -to edit (|netrw-cr|) will use that window. +One may select a netrw window for editing with the "C" mapping, using the +:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window +number. Subsequent selection of a file to edit (|netrw-cr|) will use that +window. + + * C : by itself, will select the current window holding a netrw buffer + for subsequent editing via |netrw-cr|. The C mapping is only available + while in netrw buffers. + + * [count]C : the count will be used as the window number to be used + for subsequent editing via |netrw-cr|. + + * :NetrwC will set |g:netrw_chgwin| to the current window - * C by itself, will select the current window for editing via - |netrw-cr| + * :NetrwC win# will set |g:netrw_chgwin| to the specified window + number - * [count]C the count will be used as the window number to be used - for editing via |netrw-cr|. Using > let g:netrw_chgwin= -1 -will restore the default editing behavior (ie. use the current window). +will restore the default editing behavior +(ie. subsequent editing will use the current window). Related topics: |netrw-cr| |g:netrw_browse_split| Associated setting variables: |g:netrw_chgwin| +SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2 + +The <c-tab> key will toggle a netrw or |:Lexplore| window's width, +but only if |g:netrw_usetab| exists and is non-zero (and, of course, +only if your terminal supports differentiating <c-tab> from a plain +<tab>). + + * If the current window is a netrw window, toggle its width + (between |g:netrw_wiw| and its original width) + + * Else if there is a |:Lexplore| window in the current tab, toggle + its width + + * Else bring up a |:Lexplore| window + +If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping +for <c-tab>, then the <c-tab> will not be mapped. One may map something other +than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). > + + nmap <unique> (whatever) <Plug>NetrwShrink +< +Related topics: |:Lexplore| +Associated setting variable: |g:netrw_usetab| + + +USER SPECIFIED MAPS *netrw-usermaps* {{{1 + +One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|, +to hold a |List| of lists of keymap strings and function names: > + + [["keymap-sequence","ExampleUserMapFunc"],...] +< +When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps| +exists, then the internal function netrw#UserMaps(islocal) is called. +This function goes through all the entries in the |g:Netrw_UserMaps| list: + + * sets up maps: > + nno <buffer> <silent> KEYMAP-SEQUENCE + :call s:UserMaps(islocal,"ExampleUserMapFunc") +< * refreshes if result from that function call is the string + "refresh" + * if the result string is not "", then that string will be + executed (:exe result) + * if the result is a List, then the above two actions on results + will be taken for every string in the result List + +The user function is passed one argument; it resembles > + + fun! ExampleUserMapFunc(islocal) +< +where a:islocal is 1 if its a local-directory system call or 0 when +remote-directory system call. + + *netrw-call* *netrw-expose* *netrw-modify* +Use netrw#Expose("varname") to access netrw-internal (script-local) + variables. +Use netrw#Modify("varname",newvalue) to change netrw-internal variables. +Use netrw#Call("funcname"[,args]) to call a netrw-internal function with + specified arguments. + +Example: Get a copy of netrw's marked file list: > + + let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist") +< +Example: Modify the value of netrw's marked file list: > + + call netrw#Modify("netrwmarkfilelist",[]) +< +Example: Clear netrw's marked file list via a mapping on gu > + " ExampleUserMap: {{{2 + fun! ExampleUserMap(islocal) + call netrw#Modify("netrwmarkfilelist",[]) + call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"") + let retval= ["refresh"] + return retval + endfun + let g:Netrw_UserMaps= [["gu","ExampleUserMap"]] +< + 10. Problems and Fixes *netrw-problems* {{{1 (This section is likely to grow as I get feedback) @@ -3036,6 +3542,7 @@ Associated setting variables: |g:netrw_chgwin| The first one (|g:netrw_ssh_cmd|) is the most important; most of the others will use the string in g:netrw_ssh_cmd by default. + *netrw-p9* *netrw-ml_get* P9. I'm browsing, changing directory, and bang! ml_get errors appear and I have to kill vim. Any way around this? @@ -3062,6 +3569,14 @@ Associated setting variables: |g:netrw_chgwin| P11. I want to have two windows; a thin one on the left and my editing window on the right. How may I accomplish this? + You probably want netrw running as in a side window. If so, you + will likely find that ":[N]Lexplore" does what you want. The + optional "[N]" allows you to select the quantity of columns you + wish the |:Lexplore|r window to start with (see |g:netrw_winsize| + for how this parameter works). + + Previous solution: + * Put the following line in your <.vimrc>: let g:netrw_altv = 1 * Edit the current directory: :e . @@ -3075,6 +3590,7 @@ Associated setting variables: |g:netrw_chgwin| <leftmouse> in the browser window and then press the <middlemouse> to select the file. + *netrw-p12* P12. My directory isn't sorting correctly, or unwanted letters are appearing in the listed filenames, or things aren't lining @@ -3107,7 +3623,7 @@ Associated setting variables: |g:netrw_chgwin| "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe" < *netrw-p14* - P14. I'd would like to speed up writes using Nwrite and scp/ssh + P14. I would like to speed up writes using Nwrite and scp/ssh style connections. How? (Thomer M. Gil) Try using ssh's ControlMaster and ControlPath (see the ssh_config @@ -3152,18 +3668,121 @@ Associated setting variables: |g:netrw_chgwin| to open a swap file. (romainl) It looks like you are starting Vim from a protected - directory. Start if from your $HOME or another writable + directory. Start netrw from your $HOME or other writable directory. + *netrw-p17* + P17. Netrw is closing buffers on its own. + What steps will reproduce the problem? + 1. :Explore, navigate directories, open a file + 2. :Explore, open another file + 3. Buffer opened in step 1 will be closed. o + What is the expected output? What do you see instead? + I expect both buffers to exist, but only the last one does. + + (Lance) Problem is caused by "set autochdir" in .vimrc. + (drchip) I am able to duplicate this problem with |'acd'| set. + It appears that the buffers are not exactly closed; + a ":ls!" will show them (although ":ls" does not). + + *netrw-P18* + P18. How to locally edit a file that's only available via + another server accessible via ssh? + See http://stackoverflow.com/questions/12469645/ + "Using Vim to Remotely Edit A File on ServerB Only + Accessible From ServerA" + + *netrw-P19* + P19. How do I get numbering on in directory listings? + With |g:netrw_bufsettings|, you can control netrw's buffer + settings; try putting > + let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu" +< in your .vimrc. If you'd like to have relative numbering + instead, try > + let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu" +< + *netrw-P20* + P20. How may I have gvim start up showing a directory listing? + Try putting the following code snippet into your .vimrc: > + augroup VimStartup + au! + au VimEnter * if expand("%") == "" && argc() == 0 && + \ (v:servername =~ 'GVIM\d*' || v:servername == "") + \ | e . | endif + augroup END +< You may use Lexplore instead of "e" if you're so inclined. + This snippet assumes that you have client-server enabled + (ie. a "huge" vim version). + + *netrw-P21* + P21. I've made a directory (or file) with an accented character, but + netrw isn't letting me enter that directory/read that file: + + Its likely that the shell or o/s is using a different encoding + than you have vim (netrw) using. A patch to vim supporting + "systemencoding" may address this issue in the future; for + now, just have netrw use the proper encoding. For example: > + + au FileType netrw set enc=latin1 +< + *netrw-P22* + P22. I get an error message when I try to copy or move a file: + + **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work! + + What's wrong? + + Netrw uses several system level commands to do things (see + + |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, + |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). + + You may need to adjust the default commands for one or more of + these commands by setting them properly in your .vimrc. Another + source of difficulty is that these commands use vim's local + directory, which may not be the same as the browsing directory + shown by netrw (see |g:netrw_keepdir|). + + ============================================================================== 11. Debugging Netrw Itself *netrw-debug* {{{1 -The <netrw.vim> script is typically available as something like: +Step 1: check that the problem you've encountered hasn't already been resolved +by obtaining a copy of the latest (often developmental) netrw at: + + http://www.drchip.org/astronaut/vim/index.html#NETRW + +The <netrw.vim> script is typically installed on systems as something like: > /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim /usr/local/share/vim/vim7x/autoload/netrw.vim + (see output of :echo &rtp) +< +which is loaded automatically at startup (assuming :set nocp). If you +installed a new netrw, then it will be located at > + + $HOME/.vim/plugin/netrwPlugin.vim + $HOME/.vim/autoload/netrw.vim +< +Step 2: assuming that you've installed the latest version of netrw, +check that your problem is really due to netrw. Create a file +called netrw.vimrc with the following contents: > + + set nocp + so $HOME/.vim/plugin/netrwPlugin.vim +< +Then run netrw as follows: > + + vim -u netrw.vimrc --noplugins -i NONE [some path here] < -which is loaded automatically at startup (assuming :set nocp). +Perform whatever netrw commands you need to, and check that the problem is +still present. This procedure sidesteps any issues due to personal .vimrc +settings, .viminfo file, and other plugins. If the problem does not appear, +then you need to determine which setting in your .vimrc is causing the +conflict with netrw or which plugin(s) is/are involved. + +Step 3: If the problem still is present, then get a debugging trace from +netrw: 1. Get the <Decho.vim> script, available as: @@ -3192,7 +3811,8 @@ which is loaded automatically at startup (assuming :set nocp). 3. Then bring up vim and attempt to evoke the problem by doing a transfer or doing some browsing. A set of messages should appear concerning the steps that <netrw.vim> took in attempting to - read/write your file over the network in a separate tab. + read/write your file over the network in a separate tab or + server vim window. To save the file, use > @@ -3207,14 +3827,266 @@ which is loaded automatically at startup (assuming :set nocp). debugging trace is due to which command. Please send that information to <netrw.vim>'s maintainer along - with the o/s you're using and vim version you're using + with the o/s you're using and the vim version that you're using (see |:version|) > NdrOchip at ScampbellPfamily.AbizM - NOSPAM < ============================================================================== 12. History *netrw-history* {{{1 - v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires + v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors + with a patch; these are now fixed. + Oct 26, 2016 * I started using mate-terminal and found that + x and gx (|netrw-x| and |netrw-gx|) were no + longer working. Fixed (using atril when + $DESKTOP_SESSION is "mate"). + Nov 04, 2016 * (Martin Vuille) pointed out that @+ was + being restored with keepregstar rather than + keepregplus. + Nov 09, 2016 * Broke apart the command from the options, + mostly for Windows. Introduced new netrw + settings: |g:netrw_localcopycmdopt| + |g:netrw_localcopydircmdopt| |g:netrw_localmkdiropt| + |g:netrw_localmovecmdopt| |g:netrw_localrmdiropt| + Nov 21, 2016 * (mattn) provided a patch for preview; swapped + winwidth() with winheight() + Nov 22, 2016 * (glacambre) reported that files containing + spaces weren't being obtained properly via + scp. Fix: apparently using single quotes + such as with 'file name' wasn't enough; the + spaces inside the quotes also had to be + escaped (ie. 'file\ name'). + * Also fixed obtain (|netrw-O|) to be able to + obtain files with spaces in their names + Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|) + when atop "Hiding" in the banner also caused + the active-banner hiding control to occur + Jan 03, 2017 * (Enno Nagel) reported that attempting to + apply netrw to a directory that was without + read permission caused a syntax error. + Jan 13, 2017 * (Ingo Karkat) provided a patch which makes + using netrw#Call() better. Now returns + value of internal routines return, for example. + Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to + use |:edit| instead of |:read|. I also + changed the routine name to netrw#FileUrlEdit. + Jan 16, 2017 * (Sayem) reported a problem where :Lexplore + could generate a new listing buffer and + window instead of toggling the netrw display. + Unfortunately, the directions for eliciting + the problem weren't complete, so I may or + may not have fixed that issue. + Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd". + (see |netrw-cb|, |netrw-cB|, and |netrw-cd|) + Mar 21, 2017 * previously, netrw would specify (safe) settings + even when the setting was already safe for + netrw. Netrw now attempts to leave such + already-netrw-safe settings alone. + (affects s:NetrwOptionRestore() and + s:NetrwSafeOptions(); also introduced + s:NetrwRestoreSetting()) + Jun 26, 2017 * (Christian Brabandt) provided a patch to + allow curl to follow redirects (ie. -L + option) + Jun 26, 2017 * (Callum Howard) reported a problem with + :Lexpore not removing the Lexplore window + after a change-directory + Aug 30, 2017 * (Ingo Karkat) one cannot switch to the + previously edited file (e.g. with CTRL-^) + after editing a file:// URL. Patch to + have a "keepalt" included. + Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|) + did not work on directories in the current + tree + v157: Apr 20, 2016 * (Nicola) had set up a "nmap <expr> ..." with + a function that returned a 0 while silently + invoking a shell command. The shell command + activated a ShellCmdPost event which in turn + called s:LocalBrowseRefresh(). That looks + over all netrw buffers for changes needing + refreshes. However, inside a |:map-<expr>|, + tab and window changes are disallowed. Fixed. + (affects netrw's s:LocalBrowseRefresh()) + * |g:netrw_localrmdir| not used any more, but + the relevant patch that causes |delete()| to + take over was #1107 (not #1109). + * |expand()| is now used on |g:netrw_home|; + consequently, g:netrw_home may now use + environment variables + * s:NetrwLeftmouse and s:NetrwCLeftmouse will + return without doing anything if invoked + when inside a non-netrw window + Jun 15, 2016 * gx now calls netrw#GX() which returns + the word under the cursor. The new + wrinkle: if one is in a netrw buffer, + then netrw's s:NetrwGetWord(). + Jun 22, 2016 * Netrw was executing all its associated + Filetype commands silently; I'm going + to try doing that "noisily" and see if + folks have a problem with that. + Aug 12, 2016 * Changed order of tool selection for + handling http://... viewing. + (Nikolay Aleksandrovich Pavlov) + Aug 21, 2016 * Included hiding/showing/all for tree + listings + * Fixed refresh (^L) for tree listings + v156: Feb 18, 2016 * Changed =~ to =~# where appropriate + Feb 23, 2016 * s:ComposePath(base,subdir) now uses + fnameescape() on the base portion + Mar 01, 2016 * (gt_macki) reported where :Explore would + make file unlisted. Fixed (tst943) + Apr 04, 2016 * (reported by John Little) netrw normally + suppresses browser messages, but sometimes + those "messages" are what is wanted. + See |g:netrw_suppress_gx_mesg| + Apr 06, 2016 * (reported by Carlos Pita) deleting a remote + file was giving an error message. Fixed. + Apr 08, 2016 * (Charles Cooper) had a problem with an + undefined b:netrw_curdir. He also provided + a fix. + Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses + dictionaries. Also fixed the "No Name" + buffer problem. + v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's + mapping of ctrl-l was not allowing refresh of + other windows when it was done in a netrw + window. + Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search() + instead of a loop + * NetrwBrowse() will return line to + w:netrw_bannercnt if cursor ended up in + banner + Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|) + Nov 17, 2015 * Commented out imaps -- perhaps someone can + tell me how they're useful and should be + retained? + Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support + Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the + file in addition to simply bringing up the + URL in a browser. Fixed. + Nov 23, 2015 * Added |g:netrw_sizestyle| support + Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw + maps. + Jan 05, 2016 * |netrw-qL| implemented to mark files based + upon |location-list|s; similar to |netrw-qF|. + Jan 19, 2016 * using - call delete(directoryname,"d") - + instead of using g:netrw_localrmdir if + v7.4 + patch#1107 is available + Jan 28, 2016 * changed to using |winsaveview()| and + |winrestview()| + Jan 28, 2016 * s:NetrwTreePath() now does a save and + restore of view + Feb 08, 2016 * Fixed a tree-listing problem with remote + directories + v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where + a file was not treated properly as a file + due to g:netrw_keepdir == 1 + Mar 25, 2015 * (requested by Ben Friz) one may now sort by + extension + Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot + of buffer-local mappings; however, some + plugins (such as vim-surround) set up + conflicting mappings that cause vim to wait. + The "<nowait>" modifier has been included + with most of netrw's mappings to avoid that + delay. + Jun 26, 2015 * |netrw-gn| mapping implemted + * :Ntree NotADir resulted in having + the tree listing expand in the error messages + window. Fixed. + Jun 29, 2015 * Attempting to delete a file remotely caused + an error with "keepsol" mentioned; fixed. + Jul 08, 2015 * Several changes to keep the |:jumps| table + correct when working with + |g:netrw_fastbrowse| set to 2 + * wide listing with accented characters fixed + (using %-S instead of %-s with a |printf()| + Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true + but kfmclient not installed. Changed order + in netrw#BrowseX(): checks if kde and + kfmclient, then will use xdg-open on a unix + system (if xdg-open is executable) + Aug 11, 2015 * (McDonnell) tree listing mode wouldn't + select a file in a open subdirectory. + * (McDonnell) when multiple subdirectories + were concurrently open in tree listing + mode, a ctrl-L wouldn't refresh properly. + * The netrw:target menu showed duplicate + entries + Oct 13, 2015 * (mattn) provided an exception to handle + windows with shellslash set but no shell + Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used + to control whether NetrwShrink is used + (see |netrw-c-tab|) + v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2 + May 14, 2014 * changed s:PerformListing() so that it + always sets ft=netrw for netrw buffers + (ie. even when syntax highlighting is + off, not available, etc) + May 16, 2014 * introduced the |netrw-ctrl-r| functionality + May 17, 2014 * introduced the |netrw-:NetrwMB| functionality + * mb and mB (|netrw-mb|, |netrw-mB|) will + add/remove marked files from bookmark list + May 20, 2014 * (Enno Nagel) reported that :Lex <dirname> + wasn't working. Fixed. + May 26, 2014 * restored test to prevent leftmouse window + resizing from causing refresh. + (see s:NetrwLeftmouse()) + * fixed problem where a refresh caused cursor + to go just under the banner instead of + staying put + May 28, 2014 * (László Bimba) provided a patch for opening + the |:Lexplore| window 100% high, optionally + on the right, and will work with remote + files. + May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|) + Jun 01, 2014 * Removed some "silent"s from commands used + to implemented scp://... and pscp://... + directory listing. Permits request for + password to appear. + Jun 05, 2014 * (Enno Nagel) reported that user maps "/" + caused problems with "b" and "w", which + are mapped (for wide listings only) to + skip over files rather than just words. + Jun 10, 2014 * |g:netrw_gx| introduced to allow users to + override default "<cfile>" with the gx + (|netrw-gx|) map + Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set, + will write modified files. s:NetrwBrowseX() + will now save, turn off, and restore the + |'autowrite'| setting. + Jun 13, 2014 * added visual map for gx use + Jun 15, 2014 * (Enno Nagel) reported that with having hls + set and wide listing style in use, that the + b and w maps caused unwanted highlighting. + Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included + Jul 09, 2014 * |g:netrw_keepj| included, allowing optional + keepj + Jul 09, 2014 * fixing bugs due to previous update + Jul 21, 2014 * (Bruno Sutic) provided an updated + netrw_gitignore.vim + Jul 30, 2014 * (Yavuz Yetim) reported that editing two + remote files of the same name caused the + second instance to have a "temporary" + name. Fixed: now they use the same buffer. + Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which + allows scp and windows local paths to work. + Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory, + will now do |gf| instead + Nov 06, 2014 * For cygwin: cygstart will be available for + netrw#BrowseX() to use if its executable. + Nov 07, 2014 * Began support for file://... urls. Will use + |g:netrw_file_cmd| (typically elinks or links) + Dec 02, 2014 * began work on having mc (|netrw-mc|) copy + directories. Works for linux machines, + cygwin+vim, but not for windows+gvim. + Dec 02, 2014 * in tree mode, netrw was not opening + directories via symbolic links. + Dec 02, 2014 * added resolved link information to + thin and tree modes + Dec 30, 2014 * (issue#231) |:ls| was not showing + remote-file buffers reliably. Fixed. + v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2 vim 7.4 with patch 213) * (Enno Nagel) turn |'rnu'| off in netrw buffers. @@ -3240,7 +4112,7 @@ which is loaded automatically at startup (assuming :set nocp). chgwin window. May 09, 2014 * SavePosn was "saving filename under cursor" from a non-netrw window when using :Rex. - v151: Jan 22, 2014 * extended :Rexplore to return to buffer + v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2 prior to Explore or editing a directory * (Ken Takata) netrw gave error when clipboard was disabled. Sol'n: Placed @@ -3266,7 +4138,7 @@ which is loaded automatically at startup (assuming :set nocp). handling. * |:Lexplore| path: will be used to update a left-side netrw browsing directory. - Mar 12, 2014 * |:netrw-s-cr|: use <s-cr> to close + Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close tree directory implemented Mar 13, 2014 * (Tony Mechylynck) reported that using the browser with ftp on a directory, @@ -3287,7 +4159,7 @@ which is loaded automatically at startup (assuming :set nocp). and it also handles Window's shares * Fixed |netrw-d| command when applied with ftp * https: support included for netrw#NetRead() - v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to + v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2 return to the netrw directory listing Jul 13, 2013 * (Jonas Diemer) suggested changing a <cWORD> to <cfile>. @@ -3342,7 +4214,7 @@ which is loaded automatically at startup (assuming :set nocp). style, with a previous window open, that the wrong directory was being used to open a file. Fixed. (P21) - v149: Apr 18, 2013 * in wide listing format, now have maps for + v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2 w and b to move to next/previous file Apr 26, 2013 * one may now copy files in the same directory; netrw will issue requests for @@ -3356,133 +4228,9 @@ which is loaded automatically at startup (assuming :set nocp). requested by Paul Domaskis. Jul 03, 2013 * Explore now avoids splitting when a buffer will be hidden. - v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct + v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2 choice of listing style, hiding style, and sorting style - v147: Nov 24, 2012 * (James McCoy) Even with g:netrw_dirhistmax - at zero, the .vim/ directory would be - created to support history/bookmarks. I've - gone over netrw to suppress history and - bookmarking when g:netrw_dirhistmax is zero. - For instance, the menus will display - (disabled) when attempts to use - bookmarks/history are made. - Nov 29, 2012 * (Kim Jang-hwan) reported that with - g:Align_xstrlen set to 3 that the cursor was - moved (linewise) after invocation. This - problem also afflicted netrw. - (see |g:netrw_xstrlen|) Fixed. - Jan 21, 2013 * (mattn) provided a patch to insert some - endifs needed with the code implementing - |netrw-O|. - Jan 24, 2013 * (John Szakmeister) found that remote file - editing resulted in filetype options being - overwritten by NetrwOptionRestore(). I - moved filetype detect from NetrwGetFile() - to NetrwOptionRestore. - Feb 17, 2013 * (Yukhiro Nakadaira) provided a patch - correcting some syntax errors. - Feb 28, 2013 * (Ingo Karkat) provided a patch preventing - receipt of an |E95| when revisiting a - file://... style url. - Mar 18, 2013 * (Gary Johnson) pointed out that changing - cedit to <Esc> caused problems with visincr; - the cedit setting is now bypassed in netrw too. - Apr 02, 2013 * (Paul Domaskis) reported an undefined - variable error (s:didstarstar) was - occurring. It is now defined at - initialization. - * included additional sanity checking for the - marked file functions. - * included |netrw-qF| and special "j" option - handling for |netrw-mg| - Apr 12, 2013 * |netrw-u| and |netrw-U| now handle counts - * the former mapping for "T" has been removed; - in its place are new maps, |netrw-Tb| and |netrw-Th|. - * the menu now supports a "Targets" entry for - easier target selection. (see |netrw-mt|) - * (Paul Domaskis) reported some problems with - moving/copying files under Windows' gvim - (ie. not cygwin). Fixed. - * (Paul Mueller) provided a patch to get - start and rundll working via |netrw-gx| - by bypassing the user's |'shellslash'| option. - v146: Oct 20, 2012 * (David Kotchan) reported that under Windows, - directories named with unusual characters - such as "#" or "$" were not being listed - properly. - * (Kenny Lee) reported that the buffer list - was being populated by netrw buffers. - Netrw will now |:bwipe| netrw buffers - upon editing a file if g:netrw_fastbrowse - is zero and its not in tree listing style. - * fixed a bug with s:NetrwInit() that - prevented initialization with |Lists| and - |Dictionaries|. - * |netrw-mu| now unmarks marked-file lists - v145: Apr 05, 2012 * moved some command from a g:netrw_local_... - format to g:netwr_local... format - * included some NOTE level messages about - commands that aren't executable - * |g:netrw_errorlvl| (default: NOTE=0) - option introduced - May 18, 2012 * (Ilya Dogolazky) a scenario where a - |g:netrw_fastbrowse| of zero did not - have a local directory refreshed fixed. - Jul 10, 2012 * (Donatas) |netrw-gb| wasn't working due - to an incorrectly used variable. - Aug 09, 2012 * (Bart Baker) netrw was doubling - of entries after a split. - * (code by Takahiro Yoshihara) implemented - |g:netrw_dynamic_maxfilenamelen| - Aug 31, 2012 * (Andrew Wong) netrw refresh overwriting - the yank buffer. - v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used, - or their wincmd equivalents, on a netrw - buffer, the netrw's w: variables were - not copied over. Fixed. - Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented - out, and was mistakenly used during - RestorePosn. Unfortunately, I'm not - sure why it was commented out, so this - "fix" may re-introduce an earlier problem. - Mar 21, 2012 * included s:rexposn internally to make - :Rex return the cursor to the same pos'n - upon restoration of netrw buffer - Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove - "/" from the netrw buffer's usual |'isk'| - in order to allow "filetype detect" to work - properly for scripts. - v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative - number; the absolute value of it will then - be used to specify lines/columns instead of - a percentage. - Jul 05, 2011 * the "d" map now supports mkdir via ftp - See |netrw-d| and |g:netrw_remote_mkdir| - Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore - to use a percentage of |winwidth()| instead - of a percentage of |winheight()|. - Jul 11, 2011 * included support for https://... I'm just - beginning to test this, however. - Aug 01, 2011 * changed RestoreOptions to also restore - cursor position in netrw buffers. - Aug 12, 2011 * added a note about "%" to the balloon - Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon - evaluation is suppressed. - Aug 31, 2011 * (Benjamin R Haskell) provided a patch that - implements non-standard port handling for - files opened via the remote browser. - Aug 31, 2011 * Fixed a **//pattern Explorer bug - Sep 15, 2011 * (reported by Francesco Campana) netrw - now permits the "@" to be part of the - user id (if there's an @ that appears - to the right). - Nov 21, 2011 * New option: |g:netrw_ftp_options| - Dec 07, 2011 * (James Sinclair) provided a fix handling - attempts to use a uid and password when - they weren't defined. This affected - NetWrite (NetRead already had that fix). - ============================================================================== 13. Todo *netrw-todo* {{{1 diff --git a/runtime/doc/pi_paren.txt b/runtime/doc/pi_paren.txt index 497186204f..d4ab4a08c8 100644 --- a/runtime/doc/pi_paren.txt +++ b/runtime/doc/pi_paren.txt @@ -1,4 +1,4 @@ -*pi_paren.txt* For Vim version 7.4. Last change: 2013 May 08 +*pi_paren.txt* For Vim version 8.1. Last change: 2013 May 08 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/pi_spec.txt b/runtime/doc/pi_spec.txt index f76841832e..abe5f1159a 100644 --- a/runtime/doc/pi_spec.txt +++ b/runtime/doc/pi_spec.txt @@ -1,4 +1,4 @@ -*pi_spec.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*pi_spec.txt* For Vim version 8.1. Last change: 2006 Apr 24 by Gustavo Niemeyer ~ diff --git a/runtime/doc/pi_tar.txt b/runtime/doc/pi_tar.txt index b2fab290b3..7a6faf167d 100644 --- a/runtime/doc/pi_tar.txt +++ b/runtime/doc/pi_tar.txt @@ -1,4 +1,4 @@ -*pi_tar.txt* For Vim version 7.4. Last change: 2013 Apr 17 +*pi_tar.txt* For Vim version 8.1. Last change: 2013 Apr 17 +====================+ | Tar File Interface | diff --git a/runtime/doc/pi_vimball.txt b/runtime/doc/pi_vimball.txt index bbc74988ca..563b12a966 100644 --- a/runtime/doc/pi_vimball.txt +++ b/runtime/doc/pi_vimball.txt @@ -1,12 +1,12 @@ -*pi_vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17 +*pi_vimball.txt* For Vim version 8.1. Last change: 2016 Apr 11 ---------------- Vimball Archiver ---------------- -Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> +Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: (c) 2004-2012 by Charles E. Campbell, Jr. *Vimball-copyright* +Copyright: (c) 2004-2015 by Charles E. Campbell *Vimball-copyright* The VIM LICENSE (see |copyright|) applies to the files in this package, including vimballPlugin.vim, vimball.vim, and pi_vimball.txt. except use "vimball" instead of "VIM". Like anything else that's free, @@ -99,10 +99,10 @@ MAKING DIRECTORIES VIA VIMBALLS *g:vimball_mkdir* If it doesn't exist, then if g:vimball_mkdir doesn't exist, it is set as follows: > - |g:netrw_local_mkdir|, if it exists - "mkdir" , if it is executable - "makedir" , if it is executable - Otherwise , it is undefined. + |g:netrw_localmkdir|, if it exists + "mkdir" , if it is executable + "makedir" , if it is executable + Otherwise , it is undefined. < One may explicitly specify the directory making command using g:vimball_mkdir. This command is used to make directories that are needed as indicated by the vimball. @@ -120,8 +120,7 @@ CONTROLLING THE VIMBALL EXTRACTION DIRECTORY *g:vimball_home* source the file to extract its contents. Extraction will only proceed if the first line of a putative vimball - file holds the "Vimball Archiver by Charles E. Campbell, Jr., Ph.D." - line. + file holds the "Vimball Archiver by Charles E. Campbell" line. LISTING FILES IN A VIMBALL *:VimballList* @@ -182,13 +181,16 @@ WINDOWS *vimball-windows* ============================================================================== 4. Vimball History *vimball-history* {{{1 + 37 : Jul 18, 2014 * (by request of T. Miedema) added augroup around + the autocmds in vimballPlugin.vim + Jul 06, 2015 * there are two uses of tabc; changed to tabc! 34 : Sep 22, 2011 * "UseVimball path" now supports a non-full path by prepending the current directory to it. 33 : Apr 02, 2011 * Gave priority to *.vmb over *.vba * Changed silent! to sil! (shorter) * Safed |'swf'| setting (during vimball extraction, its now turned off) - 32 : May 19, 2010 * (Christian Brabandt) :so someplugin.vba and + 32 : May 19, 2010 * (Christian Brabrandt) :so someplugin.vba and :so someplugin.vba.gz (and the other supported compression types) now works * (Jan Steffens) added support for xz compression @@ -200,6 +202,7 @@ WINDOWS *vimball-windows* MkVimball, however, now will create *.vmb files. Feb 11, 2011 * motoyakurotsu reported an error with vimball's handling of zero-length files + Feb 18, 2016 * Changed =~ to =~# where appropriate 30 : Dec 08, 2008 * fnameescape() inserted to protect error messaging using corrupted filenames from causing problems diff --git a/runtime/doc/pi_zip.txt b/runtime/doc/pi_zip.txt index 0a081f24d3..c5fa391bfc 100644 --- a/runtime/doc/pi_zip.txt +++ b/runtime/doc/pi_zip.txt @@ -1,4 +1,4 @@ -*pi_zip.txt* For Vim version 7.4. Last change: 2013 Apr 17 +*pi_zip.txt* For Vim version 8.1. Last change: 2016 Sep 13 +====================+ | Zip File Interface | @@ -6,7 +6,7 @@ Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright* +Copyright: Copyright (C) 2005-2015 Charles E Campbell *zip-copyright* The VIM LICENSE (see |copyright|) applies to the files in this package, including zipPlugin.vim, zip.vim, and pi_zip.vim. except use "zip.vim" instead of "VIM". Like anything else that's free, zip.vim @@ -33,6 +33,9 @@ Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright* also write to the file. Currently, one may not make a new file in zip archives via the plugin. + *zip-x* + x : may extract a listed file when the cursor is atop it + OPTIONS *g:zip_nomax* @@ -60,6 +63,11 @@ Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright* It's used during the writing (updating) of a file already in a zip file; by default: > let g:zip_zipcmd= "zip" +< + *g:zip_extractcmd* + This option specifies the program (and any options needed) used to + extract a file from a zip archive. By default, > + let g:zip_extractcmd= g:zip_unzipcmd < PREVENTING LOADING~ @@ -83,8 +91,26 @@ Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright* One can simply extend this line to accommodate additional extensions that should be treated as zip files. + Alternatively, one may change *g:zipPlugin_ext* in one's .vimrc. + Currently (11/30/15) it holds: > + + let g:zipPlugin_ext= '*.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip, + \ *.oxt,*.kmz,*.wsz,*.xap,*.docx,*.docm,*.dotx,*.dotm,*.potx,*.potm, + \ *.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsx,*.xlsm, + \ *.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx,*.epub' + ============================================================================== 4. History *zip-history* {{{1 + v28 Oct 08, 2014 * changed the sanity checks for executables to reflect + the command actually to be attempted in zip#Read() + and zip#Write() + * added the extraction of a file capability + Nov 30, 2015 * added *.epub to the |g:zipPlugin_ext| list + Sep 13, 2016 * added *.apk to the |g:zipPlugin_ext| list and + sorted the suffices. + v27 Jul 02, 2013 * sanity check: zipfile must have "PK" as its first + two bytes. + * modified to allow zipfile: entries in quickfix lists v26 Nov 15, 2012 * (Jason Spiro) provided a lot of new extensions that are synonyms for .zip v25 Jun 27, 2011 * using keepj with unzip -Z diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 2ff6b1063c..f55cc4c842 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -1,4 +1,4 @@ -*print.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*print.txt* For Vim version 8.1. Last change: 2010 Jul 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -693,7 +693,7 @@ It is possible to achieve a poor man's version of duplex printing using the PS utility psselect. This utility has options -e and -o for printing just the even or odd pages of a PS file respectively. -First generate a PS file with the 'hardcopy' command, then generate a new +First generate a PS file with the 'hardcopy' command, then generate new files with all the odd and even numbered pages with: > psselect -o test.ps odd.ps diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 22d99b908b..c3f8504372 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 7.4. Last change: 2014 Mar 27 +*quickfix.txt* For Vim version 8.1. Last change: 2018 May 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -35,27 +35,55 @@ positions in files. For example, |:vimgrep| finds pattern matches. You can use the positions in a script with the |getqflist()| function. Thus you can do a lot more than the edit/compile/fix cycle! -If you are using Manx's Aztec C compiler on the Amiga look here for how to use -it with Vim: |quickfix-manx|. If you are using another compiler you should -save the error messages in a file and start Vim with "vim -q filename". An -easy way to do this is with the |:make| command (see below). The -'errorformat' option should be set to match the error messages from your +If you have the error messages in a file you can start Vim with: > + vim -q filename + +From inside Vim an easy way to run a command and handle the output is with the +|:make| command (see below). + +The 'errorformat' option should be set to match the error messages from your compiler (see |errorformat| below). + *quickfix-ID* +Each quickfix list has a unique identifier called the quickfix ID and this +number will not change within a Vim session. The getqflist() function can be +used to get the identifier assigned to a list. There is also a quickfix list +number which may change whenever more than ten lists are added to a quickfix +stack. + *location-list* *E776* -A location list is similar to a quickfix list and contains a list of positions -in files. A location list is associated with a window and each window can -have a separate location list. A location list can be associated with only -one window. The location list is independent of the quickfix list. +A location list is a window-local quickfix list. You get one after commands +like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a +location list instead of a quickfix list as the corresponding `:vimgrep`, +`:grep`, `:helpgrep`, `:make` do. +A location list is associated with a window and each window can have a +separate location list. A location list can be associated with only one +window. The location list is independent of the quickfix list. When a window with a location list is split, the new window gets a copy of the -location list. When there are no references to a location list, the location -list is destroyed. +location list. When there are no longer any references to a location list, +the location list is destroyed. + + *quickfix-changedtick* +Every quickfix and location list has a read-only changedtick variable that +tracks the total number of changes made to the list. Every time the quickfix +list is modified, this count is incremented. This can be used to perform an +action only when the list has changed. The getqflist() and getloclist() +functions can be used to query the current value of changedtick. You cannot +change the changedtick variable. The following quickfix commands can be used. The location list commands are similar to the quickfix commands, replacing the 'c' prefix in the quickfix command with 'l'. + *E924* +If the current window was closed by an |autocommand| while processing a +location list command, it will be aborted. + + *E925* *E926* +If the current quickfix or location list was changed by an |autocommand| while +processing a quickfix or location list command, it will be aborted. + *:cc* :cc[!] [nr] Display error [nr]. If [nr] is omitted, the same error is displayed again. Without [!] this doesn't @@ -154,6 +182,9 @@ command with 'l'. keep Vim running while compiling. If you give the name of the errorfile, the 'errorfile' option will be set to [errorfile]. See |:cc| for [!]. + If the encoding of the error file differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. *:lf* *:lfile* :lf[ile][!] [errorfile] Same as ":cfile", except the location list for the @@ -165,6 +196,9 @@ command with 'l'. :cg[etfile] [errorfile] *:cg* *:cgetfile* Read the error file. Just like ":cfile" but don't jump to the first error. + If the encoding of the error file differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. :lg[etfile] [errorfile] *:lg* *:lgetfile* @@ -175,6 +209,9 @@ command with 'l'. :caddf[ile] [errorfile] Read the error file and add the errors from the errorfile to the current quickfix list. If a quickfix list is not present, then a new list is created. + If the encoding of the error file differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. *:laddf* *:laddfile* :laddf[ile] [errorfile] Same as ":caddfile", except the location list for the @@ -262,11 +299,24 @@ command with 'l'. 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. - *:lli* *:llist* -:lli[st] [from] [, [to]] +: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[st] [from] [, [to]] *:lli* *:llist* Same as ":clist", except the location list for the current window is used instead of the quickfix list. @@ -280,9 +330,9 @@ deleted for some reason, the message "line changed" is shown to warn you that the error location may not be correct. If you quit Vim and start again the marks are lost and the error locations may not be correct anymore. -If vim is built with |+autocmd| support, two autocommands are available for -running commands before and after a quickfix command (':make', ':grep' and so -on) is executed. See |QuickFixCmdPre| and |QuickFixCmdPost| for details. +Two autocommands are available for running commands before and after a +quickfix command (':make', ':grep' and so on) is executed. See +|QuickFixCmdPre| and |QuickFixCmdPost| for details. *QuickFixCmdPost-example* When 'encoding' differs from the locale, the error messages may have a @@ -297,7 +347,117 @@ use this code: > endfunction au QuickfixCmdPost make call QfMakeConv() +Another option is using 'makeencoding'. + + *quickfix-title* +Every quickfix and location list has a title. By default the title is set to +the command that created the list. The |getqflist()| and |getloclist()| +functions can be used to get the title of a quickfix and a location list +respectively. The |setqflist()| and |setloclist()| functions can be used to +modify the title of a quickfix and location list respectively. Examples: > + call setqflist([], 'a', {'title' : 'Cmd output'}) + echo getqflist({'title' : 1}) + call setloclist(3, [], 'a', {'title' : 'Cmd output'}) + echo getloclist(3, {'title' : 1}) +< + *quickfix-size* +You can get the number of entries (size) in a quickfix and a location list +using the |getqflist()| and |getloclist()| functions respectively. Examples: > + echo getqflist({'size' : 1}) + echo getloclist(5, {'size' : 1}) +< + *quickfix-context* +Any Vim type can be associated as a context with a quickfix or location list. +The |setqflist()| and the |setloclist()| functions can be used to associate a +context with a quickfix and a location list respectively. The |getqflist()| +and the |getloclist()| functions can be used to retrieve the context of a +quickfix and a location list respectively. This is useful for a Vim plugin +dealing with multiple quickfix/location lists. +Examples: > + + let somectx = {'name' : 'Vim', 'type' : 'Editor'} + call setqflist([], 'a', {'context' : somectx}) + echo getqflist({'context' : 1}) + + let newctx = ['red', 'green', 'blue'] + call setloclist(2, [], 'a', {'id' : qfid, 'context' : newctx}) + echo getloclist(2, {'id' : qfid, 'context' : 1}) +< + *quickfix-parse* +You can parse a list of lines using 'errorformat' without creating or +modifying a quickfix list using the |getqflist()| function. Examples: > + echo getqflist({'lines' : ["F1:10:Line10", "F2:20:Line20"]}) + echo getqflist({'lines' : systemlist('grep -Hn quickfix *')}) +This returns a dictionary where the 'items' key contains the list of quickfix +entries parsed from lines. The following shows how to use a custom +'errorformat' to parse the lines without modifying the 'errorformat' option: > + echo getqflist({'efm' : '%f#%l#%m', 'lines' : ['F1#10#Line']}) +< +EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: + *:cdo* +:cdo[!] {cmd} Execute {cmd} in each valid entry in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnext + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + 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. + + Only valid entries in the quickfix list are used. + A range can be used to select entries, e.g.: > + :10,$cdo cmd +< To skip entries 1 to 9. + + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + {not in Vi} + Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, + |:ldo|, |:cfdo| and |:lfdo|. + + *:cfdo* +:cfdo[!] {cmd} Execute {cmd} in each file in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnfile + :{cmd} + etc. +< Otherwise it works the same as `:cdo`. + {not in Vi} + + *:ldo* +:ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list + for the current window. + It works like doing this: > + :lfirst + :{cmd} + :lnext + :{cmd} + etc. +< Only valid entries in the location list are used. + Otherwise it works the same as `:cdo`. + {not in Vi} + + *:lfdo* +:lfdo[!] {cmd} Execute {cmd} in each file in the location list for + the current window. + It works like doing this: > + :lfirst + :{cmd} + :lnfile + :{cmd} + etc. +< Otherwise it works the same as `:ldo`. + {not in Vi} ============================================================================= 2. The error window *quickfix-window* @@ -320,7 +480,9 @@ use this code: > which will indicate the command that produced the quickfix list. This can be used to compose a custom status line if the value of 'statusline' is adjusted - properly. + properly. Whenever this buffer is modified by a + quickfix command or function, the |b:changedtick| + variable is incremented. *:lop* *:lopen* :lop[en] [height] Open a window to show the location list for the @@ -343,6 +505,17 @@ use this code: > *:lw* *:lwindow* :lw[indow] [height] Same as ":cwindow", except use the window showing the + location list for the current window. + + *:cbo* *:cbottom* +:cbo[ttom] Put the cursor in the last line of the quickfix window + and scroll to make it visible. This is useful for + when errors are added by an asynchronous callback. + Only call it once in a while if there are many + updates to avoid a lot of redrawing. + + *:lbo* *:lbottom* +:lbo[ttom] Same as ":cbottom", except use the window showing the location list for the current window. Normally the quickfix window is at the bottom of the screen. If there are @@ -356,7 +529,11 @@ keep its height, ignoring 'winheight' and 'equalalways'. You can change the height manually (e.g., by dragging the status line above it with the mouse). In the quickfix window, each line is one error. The line number is equal to -the error number. You can use ":.cc" to jump to the error under the cursor. +the error number. The current entry is highlighted with the QuickFixLine +highlighting. You can change it to your liking, e.g.: > + :hi QuickFixLine ctermbg=Yellow guibg=Yellow + +You can use ":.cc" to jump to the error under the cursor. Hitting the <Enter> key or double-clicking the mouse on a line has the same effect. The file containing the error is opened in the window above the quickfix window. If there already is a window for that file, it is used @@ -380,6 +557,9 @@ expression. The BufWinEnter event is also triggered, again using "quickfix" for the buffer name. +Note: When adding to an existing quickfix list the autocommand are not +triggered. + Note: Making changes in the quickfix window has no effect on the list of errors. 'modifiable' is off to avoid making changes. If you delete or insert lines anyway, the relation between the text and the error number is messed up. @@ -410,6 +590,117 @@ In all of the above cases, if the location list for the selected window is not yet set, then it is set to the location list displayed in the location list window. + *quickfix-window-ID* +You can use the |getqflist()| and |getloclist()| functions to obtain the +window ID of the quickfix window and location list window respectively (if +present). Examples: > + echo getqflist({'winid' : 1}).winid + echo getloclist(2, {'winid' : 1}).winid +< + *getqflist-examples* +The getqflist() and getloclist() functions can be used to get the various +attributes of a quickfix and location list respectively. Some examples for +using these functions are below: +> + " get the title of the current quickfix list + :echo getqflist({'title' : 0}).title + + " get the identifier of the current quickfix list + :let qfid = getqflist({'id' : 0}).id + + " get the identifier of the fourth quickfix list in the stack + :let qfid = getqflist({'nr' : 4, 'id' : 0}).id + + " check whether a quickfix list with a specific identifier exists + :if getqflist({'id' : qfid}).id == qfid + + " get the index of the current quickfix list in the stack + :let qfnum = getqflist({'nr' : 0}).nr + + " get the items of a quickfix list specified by an identifier + :echo getqflist({'id' : qfid, 'items' : 0}).items + + " get the number of entries in a quickfix list specified by an id + :echo getqflist({'id' : qfid, 'size' : 0}).size + + " get the context of the third quickfix list in the stack + :echo getqflist({'nr' : 3, 'context' : 0}).context + + " get the number of quickfix lists in the stack + :echo getqflist({'nr' : '$'}).nr + + " get the number of times the current quickfix list is changed + :echo getqflist({'changedtick' : 0}).changedtick + + " get the current entry in a quickfix list specified by an identifier + :echo getqflist({'id' : qfid, 'idx' : 0}).idx + + " get all the quickfix list attributes using an identifier + :echo getqflist({'id' : qfid, 'all' : 0}) + + " parse text from a List of lines and return a quickfix list + :let myList = ["a.java:10:L10", "b.java:20:L20"] + :echo getqflist({'lines' : myList}).items + + " parse text using a custom 'efm' and return a quickfix list + :echo getqflist({'lines' : ['a.c#10#Line 10'], 'efm':'%f#%l#%m'}).items + + " get the quickfix list window id + :echo getqflist({'winid' : 0}).winid + + " get the context of the current location list + :echo getloclist(0, {'context' : 0}).context + + " get the location list window id of the third window + :echo getloclist(3, {'winid' : 0}).winid +< + *setqflist-examples* +The setqflist() and setloclist() functions can be used to set the various +attributes of a quickfix and location list respectively. Some examples for +using these functions are below: +> + " create an empty quickfix list with a title and a context + :let t = 'Search results' + :let c = {'cmd' : 'grep'} + :call setqflist([], ' ', {'title' : t, 'context' : c}) + + " set the title of the current quickfix list + :call setqflist([], 'a', {'title' : 'Mytitle'}) + + " set the context of a quickfix list specified by an identifier + :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}}) + + " create a new quickfix list from a command output + :call setqflist([], ' ', {'lines' : systemlist('grep -Hn main *.c')}) + + " parse text using a custom efm and add to a particular quickfix list + :call setqflist([], 'a', {'id' : qfid, + \ 'lines' : ["a.c#10#L10", "b.c#20#L20"], 'efm':'%f#%l#%m'}) + + " add items to the quickfix list specified by an identifier + :let newItems = [{'filename' : 'a.txt', 'lnum' : 10, 'text' : "Apple"}, + \ {'filename' : 'b.txt', 'lnum' : 20, 'text' : "Orange"}] + :call setqflist([], 'a', {'id' : qfid, 'items' : newItems}) + + " empty a quickfix list specified by an identifier + :call setqflist([], 'r', {'id' : qfid, 'items' : []}) + + " free all the quickfix lists in the stack + :call setqflist([], 'f') + + " set the title of the fourth quickfix list + :call setqflist([], 'a', {'nr' : 4, 'title' : 'SomeTitle'}) + + " create a new quickfix list at the end of the stack + :call setqflist([], ' ', {'nr' : '$', + \ 'lines' : systemlist('grep -Hn class *.java')}) + + " create a new location list from a command output + :call setloclist(0, [], ' ', {'lines' : systemlist('grep -Hn main *.c')}) + + " replace the location list entries for the third window + :call setloclist(3, [], 'r', {'items' : newItems}) +< ============================================================================= 3. Using more than one list of errors *quickfix-error-lists* @@ -424,7 +715,7 @@ lists. They set one of the existing error lists as the current one. list, an error message is given. *:lolder* *:lol* -:lol[der] [count] Same as ":colder", except use the location list for +:lol[der] [count] Same as `:colder`, except use the location list for the current window instead of the quickfix list. *:cnewer* *:cnew* *E381* @@ -433,9 +724,20 @@ lists. They set one of the existing error lists as the current one. list, an error message is given. *:lnewer* *:lnew* -:lnew[er] [count] Same as ":cnewer", except use the location list for +:lnew[er] [count] Same as `:cnewer`, except use the location list for the current window instead of the quickfix list. + *:chistory* *:chi* +:chi[story] Show the list of error lists. The current list is + marked with ">". The output looks like: + error list 1 of 3; 43 errors ~ + > error list 2 of 3; 0 errors ~ + error list 3 of 3; 15 errors ~ + + *:lhistory* *:lhi* +:lhi[story] Show the list of location lists, otherwise like + `:chistory`. + When adding a new error list, it becomes the current list. When ":colder" has been used and ":make" or ":grep" is used to add a new error @@ -443,12 +745,20 @@ list, one newer list is overwritten. This is especially useful if you are browsing with ":grep" |grep|. If you want to keep the more recent error lists, use ":cnewer 99" first. +To get the number of lists in the quickfix and location list stack, you can +use the |getqflist()| and |getloclist()| functions respectively with the list +number set to the special value '$'. Examples: > + echo getqflist({'nr' : '$'}).nr + echo getloclist(3, {'nr' : '$'}).nr +To get the number of the current list in the stack: > + echo getqflist({'nr' : 0}).nr +< ============================================================================= 4. Using :make *:make_makeprg* *:mak* *:make* -:mak[e][!] [arguments] 1. If vim was built with |+autocmd|, all relevant - |QuickFixCmdPre| autocommands are executed. +:mak[e][!] [arguments] 1. All relevant |QuickFixCmdPre| autocommands are + executed. 2. If the 'autowrite' option is on, write any changed buffers 3. An errorfile name is made from 'makeef'. If @@ -460,15 +770,17 @@ lists, use ":cnewer 99" first. errorfile (for Unix it is also echoed on the screen). 5. The errorfile is read using 'errorformat'. - 6. If vim was built with |+autocmd|, all relevant - |QuickFixCmdPost| autocommands are executed. - See example below. + 6. All relevant |QuickFixCmdPost| autocommands are + executed. See example below. 7. If [!] is not given the first error is jumped to. 8. The errorfile is deleted. 9. You can now move through the errors with commands like |:cnext| and |:cprevious|, see above. This command does not accept a comment, any " characters are considered part of the arguments. + If the encoding of the program output differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. *:lmak* *:lmake* :lmak[e][!] [arguments] @@ -528,6 +840,7 @@ read the error messages: > au QuickfixCmdPost make call QfMakeConv() (Example by Faque Cheng) +Another option is using 'makeencoding'. ============================================================================== 5. Using :vimgrep and :grep *grep* *lid* @@ -642,6 +955,9 @@ id-utils) in a similar way to its compiler integration (see |:make| above). When 'grepprg' is "internal" this works like |:vimgrep|. Note that the pattern needs to be enclosed in separator characters then. + If the encoding of the program output differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. *:lgr* *:lgrep* :lgr[ep][!] [arguments] Same as ":grep", except the location list for the @@ -666,6 +982,10 @@ id-utils) in a similar way to its compiler integration (see |:make| above). \ | catch /E480:/ \ | endtry" < + If the encoding of the program output differs from the + 'encoding' option, you can use the 'makeencoding' + option to specify the encoding. + *:lgrepa* *:lgrepadd* :lgrepa[dd][!] [arguments] Same as ":grepadd", except the location list for the @@ -761,7 +1081,7 @@ need to write down a "todo" list. The Vim plugins in the "compiler" directory will set options to use the -selected compiler. For ":compiler" local options are set, for ":compiler!" +selected compiler. For `:compiler` local options are set, for `:compiler!` global options. *current_compiler* To support older Vim versions, the plugins always use "current_compiler" and @@ -914,6 +1234,7 @@ you want to match case, add "\C" to the pattern |/\C|. Basic items %f file name (finds a string) + %o module name (finds a string) %l line number (finds a number) %c column number (finds a number representing character column of the error, (1 <tab> == 1 character column)) @@ -950,7 +1271,7 @@ or > to indicate the column of the error. This is to be used in a multi-line error message. See |errorformat-javac| for a useful example. -The "%s" conversion specifies the text to search for to locate the error line. +The "%s" conversion specifies the text to search for, to locate the error line. The text is used as a literal string. The anchors "^" and "$" are added to the text to locate the error line exactly matching the search text and the text is prefixed with the "\V" atom to make it "very nomagic". The "%s" @@ -958,6 +1279,11 @@ conversion can be used to locate lines without a line number in the error output. Like the output of the "grep" shell command. When the pattern is present the line number will not be used. +The "%o" conversion specifies the module name in quickfix entry. If present +it will be used in quickfix error window instead of the filename. The module +name is used only for displaying purposes, the file name is used when jumping +to the file. + Changing directory The following uppercase conversion characters specify the type of special @@ -1282,7 +1608,7 @@ prints information about entering a directory in the form "Making all in dir". Making all in dir2 ./dir1/dir2 This can be solved by printing absolute directories in the "enter directory" - message or by printing "leave directory" messages.. + message or by printing "leave directory" messages. To avoid this problem, ensure to print absolute directory names and "leave directory" messages. diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index e26bd8558b..bb1a9126f3 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.4. Last change: 2014 Jun 25 +*quickref.txt* For Vim version 8.1. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -618,10 +618,13 @@ Short explanation of each option: *option-list* 'backupext' 'bex' extension used for the backup file 'backupskip' 'bsk' no backup for files that match these patterns 'balloondelay' 'bdlay' delay in mS before a balloon may pop up -'ballooneval' 'beval' switch on balloon evaluation +'ballooneval' 'beval' switch on balloon evaluation in the GUI +'balloonevalterm' 'bevalterm' switch on balloon evaluation in the terminal 'balloonexpr' 'bexpr' expression to show in balloon +'belloff' 'bo' do not ring the bell for these reasons 'binary' 'bin' read/write/edit file in binary mode 'bioskey' 'biosk' MS-DOS: use bios calls for input characters +'blurradius' 'blur' transparency blur of the GUI window (MacVim only) 'bomb' prepend a Byte Order Mark to the file 'breakat' 'brk' characters that may cause a line break 'breakindent' 'bri' wrapped line repeats indent @@ -643,6 +646,7 @@ Short explanation of each option: *option-list* 'cmdwinheight' 'cwh' height of the command-line window 'colorcolumn' 'cc' columns to highlight 'columns' 'co' number of columns in the display +'columnspace' 'csp' number of pixel columns to use between characters 'comments' 'com' patterns that can start a comment line 'commentstring' 'cms' template for comments; used for fold marker 'compatible' 'cp' behave Vi-compatible as much as possible @@ -678,6 +682,7 @@ Short explanation of each option: *option-list* 'display' 'dy' list of flags for how to display text 'eadirection' 'ead' in which direction 'equalalways' works 'edcompatible' 'ed' toggle flags of ":substitute" command +'emoji' 'emo' emoji characters are considered full width 'encoding' 'enc' encoding used internally 'endofline' 'eol' write <EOL> for last line in file 'equalalways' 'ea' windows are automatically made the same size @@ -696,6 +701,7 @@ Short explanation of each option: *option-list* 'fileignorecase' 'fic' ignore case when using file names 'filetype' 'ft' type of file, used for autocommands 'fillchars' 'fcs' characters to use for displaying special items +'fixendofline' 'fixeol' make sure last line in file has <EOL> 'fkmap' 'fk' Farsi keyboard mapping 'foldclose' 'fcl' close a fold when the cursor leaves it 'foldcolumn' 'fdc' width of the column used to indicate folds @@ -710,10 +716,10 @@ Short explanation of each option: *option-list* 'foldnestmax' 'fdn' maximum fold depth 'foldopen' 'fdo' for which commands a fold will be opened 'foldtext' 'fdt' expression used to display for a closed fold +'formatexpr' 'fex' expression used with "gq" command 'formatlistpat' 'flp' pattern used to recognize a list header 'formatoptions' 'fo' how automatic formatting is to be done 'formatprg' 'fp' name of external program used with "gq" command -'formatexpr' 'fex' expression used with "gq" command 'fsync' 'fs' whether to invoke fsync() after file write 'fullscreen' 'fu' let vim cover the whole screen (MacVim only) 'fuoptions' 'fuopt' controls how 'fullscreen' behaves (MacVim only) @@ -734,20 +740,21 @@ Short explanation of each option: *option-list* 'helplang' 'hlg' preferred help languages 'hidden' 'hid' don't unload buffer when it is |abandon|ed 'highlight' 'hl' sets highlighting mode for various occasions -'hlsearch' 'hls' highlight matches with last search pattern 'history' 'hi' number of command-lines that are remembered 'hkmap' 'hk' Hebrew keyboard mapping 'hkmapp' 'hkp' phonetic Hebrew keyboard mapping +'hlsearch' 'hls' highlight matches with last search pattern 'icon' let Vim set the text of the window icon 'iconstring' string to use for the Vim icon text 'ignorecase' 'ic' ignore case in search patterns -'imactivatekey' 'imak' key that activates the X input method 'imactivatefunc' 'imaf' function to enable/disable the X input method +'imactivatekey' 'imak' key that activates the X input method 'imcmdline' 'imc' use IM when starting to edit a command line 'imdisable' 'imd' do not use the IM in any mode 'iminsert' 'imi' use :lmap or IM in Insert mode 'imsearch' 'ims' use :lmap or IM when typing a search pattern 'imstatusfunc' 'imsf' function to obtain X input method status +'imstyle' 'imst' specifies the input style of the input method 'include' 'inc' pattern to be used to find an include file 'includeexpr' 'inex' expression used to process an include line 'incsearch' 'is' highlight match while typing search pattern @@ -766,6 +773,7 @@ Short explanation of each option: *option-list* 'keywordprg' 'kp' program to use for the "K" command 'langmap' 'lmap' alphabetic characters for other language mode 'langmenu' 'lm' language to be used for the menus +'langremap' 'lrm' do apply 'langmap' to mapped characters 'laststatus' 'ls' tells when last window has status lines 'lazyredraw' 'lz' don't redraw while executing macros 'linebreak' 'lbr' wrap long lines at a blank @@ -776,10 +784,16 @@ Short explanation of each option: *option-list* 'list' show <Tab> and <EOL> 'listchars' 'lcs' characters for displaying in list mode 'loadplugins' 'lpl' load plugin scripts when starting up +'luadll' name of the Lua dynamic library +'mzschemedll' name of the MzScheme dynamic library +'mzschemegcdll' name of the MzScheme dynamic library for GC 'macatsui' Mac GUI: use ATSUI text drawing +'macligatures' display ligatures (MacVim GUI only) 'macmeta' 'mmta' use option as meta key (MacVim GUI only) +'macthinstrokes' render the text lighter by using thin strokes (MacVim GUI only) 'magic' changes special characters in search patterns 'makeef' 'mef' name of the errorfile for ":make" +'makeencoding' 'menc' encoding of external make/grep commands 'makeprg' 'mp' program to use for the ":make" command 'matchpairs' 'mps' pairs of characters that "%" can match 'matchtime' 'mat' tenths of a second to show matching paren @@ -809,13 +823,15 @@ Short explanation of each option: *option-list* 'omnifunc' 'ofu' function for filetype-specific completion 'opendevice' 'odev' allow reading/writing devices on MS-Windows 'operatorfunc' 'opfunc' function to be called for |g@| operator -'osfiletype' 'oft' no longer supported +'osfiletype' 'oft' no longer supported +'packpath' 'pp' list of directories used for packages 'paragraphs' 'para' nroff macros that separate paragraphs 'paste' allow pasting text 'pastetoggle' 'pt' key code that causes 'paste' to toggle 'patchexpr' 'pex' expression used to patch a file 'patchmode' 'pm' keep the oldest version of a file 'path' 'pa' list of directories searched with "gf" et.al. +'perldll' name of the Perl dynamic library 'preserveindent' 'pi' preserve the indent structure when reindenting 'previewheight' 'pvh' height of the preview window 'previewwindow' 'pvw' identifies the preview window @@ -827,18 +843,27 @@ Short explanation of each option: *option-list* 'printmbcharset' 'pmbcs' CJK character set to be used for :hardcopy 'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy 'printoptions' 'popt' controls the format of :hardcopy output +'prompt' 'prompt' enable prompt in Ex mode 'pumheight' 'ph' maximum height of the popup menu +'pumwidth' 'pw' minimum width of the popup menu +'pythondll' name of the Python 2 dynamic library +'pythonhome' name of the Python 2 home directory +'pythonthreedll' name of the Python 3 dynamic library +'pythonthreehome' name of the Python 3 home directory +'pyxversion' 'pyx' Python version used for pyx* commands 'quoteescape' 'qe' escape characters used in a string 'readonly' 'ro' disallow writing the buffer 'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting 'regexpengine' 're' default regexp engine to use 'relativenumber' 'rnu' show relative line number in front of each line 'remap' allow mappings to work recursively +'renderoptions' 'rop' options for text rendering on Windows 'report' threshold for reporting nr. of lines changed 'restorescreen' 'rs' Win32: restore screen when exiting 'revins' 'ri' inserting characters will work backwards 'rightleft' 'rl' window is right-to-left oriented 'rightleftcmd' 'rlc' commands for which editing works right-to-left +'rubydll' name of the Ruby dynamic library 'ruler' 'ru' show cursor line and column in the status line 'rulerformat' 'ruf' custom format for the ruler 'runtimepath' 'rtp' list of directories used for runtime files @@ -874,6 +899,7 @@ Short explanation of each option: *option-list* 'showtabline' 'stal' tells when the tab pages line is displayed 'sidescroll' 'ss' minimum number of columns to scroll horizontal 'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor +'signcolumn' 'scl' when to display the sign column 'smartcase' 'scs' no ignore case when pattern has uppercase 'smartindent' 'si' smart autoindenting for C programs 'smarttab' 'sta' use 'shiftwidth' when inserting <Tab> @@ -894,17 +920,23 @@ Short explanation of each option: *option-list* 'switchbuf' 'swb' sets behavior when switching to another buffer 'synmaxcol' 'smc' maximum column to find syntax items 'syntax' 'syn' syntax to be loaded for current buffer -'tabstop' 'ts' number of spaces that <Tab> in file uses 'tabline' 'tal' custom format for the console tab pages line 'tabpagemax' 'tpm' maximum number of tab pages for |-p| and "tab all" +'tabstop' 'ts' number of spaces that <Tab> in file uses 'tagbsearch' 'tbs' use binary searching in tags files +'tagcase' 'tc' how to handle case when searching in tags files 'taglength' 'tl' number of significant characters for a tag 'tagrelative' 'tr' file names in tag file are relative 'tags' 'tag' list of file names used by the tag command 'tagstack' 'tgst' push tags onto the tag stack +'tcldll' name of the Tcl dynamic library 'term' name of the terminal 'termbidi' 'tbidi' terminal takes care of bi-directionality 'termencoding' 'tenc' character encoding used by the terminal +'termguicolors' 'tgc' use GUI colors for the terminal +'termwinkey' 'twk' key that precedes a Vim command in a terminal +'termwinscroll' 'twsl' max number of scrollback lines in a terminal window +'termwinsize' 'tws' size of a terminal window 'terse' shorten some messages 'textauto' 'ta' obsolete, use 'fileformats' 'textmode' 'tx' obsolete, use 'fileformat' @@ -938,6 +970,7 @@ Short explanation of each option: *option-list* 'viewdir' 'vdir' directory where to store files with :mkview 'viewoptions' 'vop' specifies what to save for :mkview 'viminfo' 'vi' use .viminfo file upon startup and exiting +'viminfofile' 'vif' file name used for the viminfo file 'virtualedit' 've' when to use virtual editing 'visualbell' 'vb' use visual bell instead of beeping 'warn' warn for shell command when buffer was changed @@ -957,6 +990,7 @@ Short explanation of each option: *option-list* 'winfixwidth' 'wfw' keep window width when opening/closing windows 'winminheight' 'wmh' minimum number of lines for any window 'winminwidth' 'wmw' minimal number of columns for any window +'winptydll' name of the winpty dynamic library 'winwidth' 'wiw' minimal number of columns for current window 'wrap' long lines wrap and continue on the next line 'wrapmargin' 'wm' chars from the right where wrapping starts @@ -1055,6 +1089,8 @@ Short explanation of each option: *option-list* |c_<Up>| <Up>/<Down> recall older/newer command-line that starts with current command |c_<S-Up>| <S-Up>/<S-Down> recall older/newer command-line from history +|c_CTRL-G| CTRL-G next match when 'incsearch' is active +|c_CTRL-T| CTRL-T previous match when 'incsearch' is active |:history| :his[tory] show older command-lines Context-sensitive completion on the command-line: @@ -1293,6 +1329,7 @@ Context-sensitive completion on the command-line: |:sfind| :sf[ind] {file} split window, find {file} in 'path' and edit it +|:terminal| :terminal {cmd} open a terminal window |CTRL-W_]| CTRL-W ] split window and jump to tag under cursor |CTRL-W_f| CTRL-W f split window and edit file name under @@ -1316,11 +1353,16 @@ Context-sensitive completion on the command-line: |CTRL-W_R| CTRL-W R rotate windows upwards |CTRL-W_x| CTRL-W x exchange current window with next one -|CTRL-W_=| CTRL-W = make all windows equal height +|CTRL-W_=| CTRL-W = make all windows equal height & width |CTRL-W_-| CTRL-W - decrease current window height |CTRL-W_+| CTRL-W + increase current window height |CTRL-W__| CTRL-W _ set current window height (default: very high) + +|CTRL-W_<| CTRL-W < decrease current window width +|CTRL-W_>| CTRL-W > increase current window width +|CTRL-W_bar| CTRL-W | set current window width (default: + widest possible) ------------------------------------------------------------------------------ *Q_bu* Buffer list commands diff --git a/runtime/doc/quotes.txt b/runtime/doc/quotes.txt index 11d8550121..0414a57a9d 100644 --- a/runtime/doc/quotes.txt +++ b/runtime/doc/quotes.txt @@ -1,4 +1,4 @@ -*quotes.txt* For Vim version 7.4. Last change: 2010 Nov 03 +*quotes.txt* For Vim version 8.1. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -18,7 +18,7 @@ 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 Fonseca) +application which deals with text editing. (José 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, @@ -178,14 +178,14 @@ 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 any more, is that I +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 any more. (Emmanuel Mogenet, USA) +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 diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt index 75318b00e6..89703fdded 100644 --- a/runtime/doc/recover.txt +++ b/runtime/doc/recover.txt @@ -1,4 +1,4 @@ -*recover.txt* For Vim version 7.4. Last change: 2014 Mar 27 +*recover.txt* For Vim version 8.1. Last change: 2014 Mar 27 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index b465ac32b9..f856c98fc7 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -1,4 +1,4 @@ -*remote.txt* For Vim version 7.4. Last change: 2008 May 24 +*remote.txt* For Vim version 8.1. Last change: 2017 Nov 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -9,7 +9,6 @@ Vim client-server communication *client-server* 1. Common functionality |clientserver| 2. X11 specific items |x11-clientserver| 3. MS-Windows specific items |w32-clientserver| -4. MacVim specific items |macvim-clientserver| {Vi does not have any of these commands} @@ -37,7 +36,8 @@ The following command line arguments are available: The remote Vim is raised. If you don't want this use > vim --remote-send "<C-\><C-N>:n filename<CR>" -< --remote-silent [+{cmd}] {file} ... *--remote-silent* +< + --remote-silent [+{cmd}] {file} ... *--remote-silent* As above, but don't complain if there is no server and the file is edited locally. --remote-wait [+{cmd}] {file} ... *--remote-wait* @@ -99,7 +99,7 @@ Tell the remote server "BLA" to write all files and exit: > vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>' -SERVER NAME +SERVER NAME *client-server-name* By default Vim will try to register the name under which it was invoked (gvim, egvim ...). This can be overridden with the --servername argument. If the @@ -149,6 +149,7 @@ the description in |eval.txt| or use CTRL-] on the function name to jump to the full explanation. synopsis explanation ~ + remote_startserver( name) run a server remote_expr( server, string, idvar) send expression remote_send( server, string, idvar) send key sequence serverlist() get a list of available servers @@ -180,7 +181,8 @@ name on the 'VimRegistry' property on the root window. A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can also act as a command server if a server name is explicitly given with the ---servername argument. +--servername argument, or when Vim was build with the |+autoservername| +feature. An empty --servername argument will cause the command server to be disabled. @@ -202,23 +204,4 @@ When using gvim, the --remote-wait only works properly this way: > start /w gvim --remote-wait file.txt < -============================================================================== -4. MacVim specific items *macvim-clientserver* - -MacVim uses distributed objects for interprocess communication. A server -listens to a named port for new connections, and clients connect to this port -to send messages. Server listings are made possible by the frontend (MacVim) -keeping a list of all currently running servers. Thus, servers are not aware -of each other directly; only MacVim knows which servers are running. - -A client is any object which implements the MMVimClientProtocol (see -MacVim.h). Take a look at MMBackend if you wish to implement this protocol in -your own application. The current implementation assumes that the -NSConnections use mach ports for interprocess communication. This means that -you can only use Vim's client/server feature on a local machine (and not -across a network). - -Note: Client mode always works, but server mode only works when the GUI is -started. - vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 4b28e8617b..62464780e8 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*repeat.txt* For Vim version 8.1. Last change: 2018 Mar 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -8,12 +8,14 @@ Repeating commands, Vim scripts and debugging *repeating* Chapter 26 of the user manual introduces repeating |usr_26.txt|. -1. Single repeats |single-repeat| -2. Multiple repeats |multi-repeat| -3. Complex repeats |complex-repeat| -4. Using Vim scripts |using-scripts| -5. Debugging scripts |debug-scripts| -6. Profiling |profiling| +1. Single repeats |single-repeat| +2. Multiple repeats |multi-repeat| +3. Complex repeats |complex-repeat| +4. Using Vim scripts |using-scripts| +5. Using Vim packages |packages| +6. Creating Vim packages |package-create| +7. Debugging scripts |debug-scripts| +8. Profiling |profiling| ============================================================================== 1. Single repeats *single-repeat* @@ -44,7 +46,7 @@ of area is used, see |visual-repeat|. ============================================================================== 2. Multiple repeats *multi-repeat* - *:g* *:global* *E147* *E148* + *:g* *:global* *E148* :[range]g[lobal]/{pattern}/[cmd] Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} matches. @@ -64,18 +66,28 @@ replacement string. For the definition of a pattern, see |pattern|. +NOTE [cmd] may contain a range; see |collapse| and |edit-paragraph-join| for +examples. + The global commands work by first scanning through the [range] lines and marking each line where a match occurs (for a multi-line pattern, only the start of the match matters). -In a second scan the [cmd] is executed for each marked line with its line -number prepended. For ":v" and ":g!" the command is executed for each not +In a second scan the [cmd] is executed for each marked line, as if the cursor +was in that line. For ":v" and ":g!" the command is executed for each not marked line. If a line is deleted its mark disappears. The default for [range] is the whole buffer (1,$). Use "CTRL-C" to interrupt the command. If an error message is given for a line, the command for that line is aborted and the global command continues with the next marked or unmarked line. - -To repeat a non-Ex command, you can use the ":normal" command: > + *E147* +When the command is used recursively, it only works on one line. Giving a +range is then not allowed. This is useful to find all lines that match a +pattern and do not match another pattern: > + :g/found/v/notfound/{cmd} +This first finds all lines containing "found", but only executes {cmd} when +there is no match for "notfound". + +To execute a non-Ex command, you can use the `:normal` command: > :g/pat/normal {commands} Make sure that {commands} ends with a whole command, otherwise Vim will wait for you to type the rest of the command for each match. The screen will not @@ -106,7 +118,13 @@ To abort this type CTRL-C twice. q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"} (uppercase to append). The 'q' command is disabled while executing a register, and it doesn't work inside - a mapping and |:normal|. {Vi: no recording} + a mapping and |:normal|. + + Note: If the register being used for recording is also + used for |y| and |p| the result is most likely not + what is expected, because the put will paste the + recorded macro and the yank will overwrite the + recorded macro. {Vi: no recording} q Stops recording. (Implementation note: The 'q' that stops recording is not stored in the register, unless @@ -147,7 +165,7 @@ q Stops recording. (Implementation note: The 'q' that :[addr]@: Repeat last command-line. First set cursor at line [addr] (default is current line). {not in Vi} - *:@@* +:[addr]@ *:@@* :[addr]@@ Repeat the previous :@{0-9a-z"}. First set cursor at line [addr] (default is current line). {Vi: only in some versions} @@ -172,10 +190,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. {not in Vi} *:ru* *:runtime* -:ru[ntime][!] {file} .. +:ru[ntime][!] [where] {file} .. Read Ex commands from {file} in each directory given - by 'runtimepath'. There is no error for non-existing - files. Example: > + by 'runtimepath' and/or 'packpath'. There is no error + for non-existing files. + + Example: > :runtime syntax/c.vim < There can be multiple {file} arguments, separated by @@ -189,6 +209,15 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. When it is not included only the first found file is sourced. + When [where] is omitted only 'runtimepath' is used. + Other values: + START search under "start" in 'packpath' + OPT search under "opt" in 'packpath' + PACK search under "start" and "opt" in + 'packpath' + ALL first use 'runtimepath', then search + under "start" and "opt" in 'packpath' + When {file} contains wildcards it is expanded to all matching files. Example: > :runtime! plugin/*.vim @@ -203,6 +232,65 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. about each searched file. {not in Vi} + *:pa* *:packadd* *E919* +:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath' + and source any plugin files found. The directory must + match: + pack/*/opt/{name} ~ + The directory is added to 'runtimepath' if it wasn't + there yet. + If the directory pack/*/opt/{name}/after exists it is + added at the end of 'runtimepath'. + + If loading packages from "pack/*/start" was skipped, + then this directory is searched first: + pack/*/start/{name} ~ + + Note that {name} is the directory name, not the name + of the .vim file. All the files matching the pattern + pack/*/opt/{name}/plugin/**/*.vim ~ + will be sourced. This allows for using subdirectories + below "plugin", just like with plugins in + 'runtimepath'. + + If the filetype detection was not enabled yet (this + is usually done with a "syntax enable" or "filetype + on" command in your .vimrc file), this will also look + for "{name}/ftdetect/*.vim" files. + + When the optional ! is added no plugin files or + ftdetect scripts are loaded, only the matching + directories are added to 'runtimepath'. This is + useful in your .vimrc. The plugins will then be + loaded during initialization, see |load-plugins|. + + Also see |pack-add|. + {only available when compiled with +eval} + + *:packl* *:packloadall* +:packl[oadall][!] Load all packages in the "start" directory under each + entry in 'packpath'. + + First all the directories found are added to + 'runtimepath', then the plugins found in the + directories are sourced. This allows for a plugin to + depend on something of another plugin, e.g. an + "autoload" directory. See |packload-two-steps| for + how this can be useful. + + This is normally done automatically during startup, + after loading your .vimrc file. With this command it + can be done earlier. + + Packages will be loaded only once. After this command + it won't happen again. When the optional ! is added + this command will load packages even when done before. + + An error only causes sourcing the script where it + happens to be aborted, further plugins will be loaded. + See |packages|. + {only available when compiled with +eval} + :scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167* Specify the character encoding used in the script. The following lines will be converted from [encoding] @@ -220,7 +308,9 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. ... not converted ... < When conversion isn't supported by the system, there - is no error message and no conversion is done. + is no error message and no conversion is done. When a + line can't be converted there is no error and the + original line is kept. Don't use "ucs-2" or "ucs-4", scripts cannot be in these encodings (they would contain NUL bytes). @@ -228,12 +318,17 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. Mark) in utf-8 format Vim will recognize it, no need to use ":scriptencoding utf-8" then. + If you set the 'encoding' option in your |.vimrc|, + `:scriptencoding` must be placed after that. E.g.: > + set encoding=utf-8 + scriptencoding utf-8 +< When compiled without the |+multi_byte| feature this command is ignored. {not in Vi} - *:scrip* *:scriptnames* -:scrip[tnames] List all sourced script names, in the order they were + *:scr* *:scriptnames* +:scr[iptnames] List all sourced script names, in the order they were first sourced. The number is used for the script ID |<SID>|. {not in Vi} {not available when compiled without the @@ -379,7 +474,188 @@ Rationale: < Therefore the unusual leading backslash is used. ============================================================================== -5. Debugging scripts *debug-scripts* +5. Using Vim packages *packages* + +A Vim package is a directory that contains one or more plugins. The +advantages over normal plugins: +- A package can be downloaded as an archive and unpacked in its own directory. + Thus the files are not mixed with files of other plugins. That makes it + easy to update and remove. +- A package can be a git, mercurial, etc. repository. That makes it really + easy to update. +- A package can contain multiple plugins that depend on each other. +- A package can contain plugins that are automatically loaded on startup and + ones that are only loaded when needed with `:packadd`. + + +Using a package and loading automatically ~ + +Let's assume your Vim files are in the "~/.vim" directory and you want to add a +package from a zip archive "/tmp/foopack.zip": + % mkdir -p ~/.vim/pack/foo + % cd ~/.vim/pack/foo + % unzip /tmp/foopack.zip + +The directory name "foo" is arbitrary, you can pick anything you like. + +You would now have these files under ~/.vim: + pack/foo/README.txt + pack/foo/start/foobar/plugin/foo.vim + pack/foo/start/foobar/syntax/some.vim + pack/foo/opt/foodebug/plugin/debugger.vim + +When Vim starts up, after processing your .vimrc, it scans all directories in +'packpath' for plugins under the "pack/*/start" directory. First all those +directories are added to 'runtimepath'. Then all the plugins are loaded. +See |packload-two-steps| for how these two steps can be useful. + +In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds +"~/.vim/pack/foo/start/foobar" to 'runtimepath'. + +If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will +find the syntax/some.vim file, because its directory is in 'runtimepath'. + +Vim will also load ftdetect files, if there are any. + +Note that the files under "pack/foo/opt" are not loaded automatically, only the +ones under "pack/foo/start". See |pack-add| below for how the "opt" directory +is used. + +Loading packages automatically will not happen if loading plugins is disabled, +see |load-plugins|. + +To load packages earlier, so that 'runtimepath' gets updated: > + :packloadall +This also works when loading plugins is disabled. The automatic loading will +only happen once. + +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 ~ + +If you don't have a package but a single plugin, you need to create the extra +directory level: + % mkdir -p ~/.vim/pack/foo/start/foobar + % cd ~/.vim/pack/foo/start/foobar + % unzip /tmp/someplugin.zip + +You would now have these files: + pack/foo/start/foobar/plugin/foo.vim + pack/foo/start/foobar/syntax/some.vim + +From here it works like above. + + +Optional plugins ~ + *pack-add* +To load an optional plugin from a pack use the `:packadd` command: > + :packadd foodebug +This searches for "pack/*/opt/foodebug" in 'packpath' and will find +~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim and source it. + +This could be done if some conditions are met. For example, depending on +whether Vim supports a feature or a dependency is missing. + +You can also load an optional plugin at startup, by putting this command in +your |.vimrc|: > + :packadd! foodebug +The extra "!" is so that the plugin isn't loaded if Vim was started with +|--noplugin|. + +It is perfectly normal for a package to only have files in the "opt" +directory. You then need to load each plugin when you want to use it. + + +Where to put what ~ + +Since color schemes, loaded with `:colorscheme`, are found below +"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend +you put them below "pack/*/opt", for example +".vim/pack/mycolors/opt/dark/colors/very_dark.vim". + +Filetype plugins should go under "pack/*/start", so that they are always +found. Unless you have more than one plugin for a file type and want to +select which one to load with `:packadd`. E.g. depending on the compiler +version: > + if foo_compiler_version > 34 + packadd foo_new + else + packadd foo_old + endif + +The "after" directory is most likely not useful in a package. It's not +disallowed though. + +============================================================================== +6. Creating Vim packages *package-create* + +This assumes you write one or more plugins that you distribute as a package. + +If you have two unrelated plugins you would use two packages, so that Vim +users can chose what they include or not. Or you can decide to use one +package with optional plugins, and tell the user to add the ones he wants with +`:packadd`. + +Decide how you want to distribute the package. You can create an archive or +you could use a repository. An archive can be used by more users, but is a +bit harder to update to a new version. A repository can usually be kept +up-to-date easily, but it requires a program like "git" to be available. +You can do both, github can automatically create an archive for a release. + +Your directory layout would be like this: + start/foobar/plugin/foo.vim " always loaded, defines commands + start/foobar/plugin/bar.vim " always loaded, defines commands + start/foobar/autoload/foo.vim " loaded when foo command used + start/foobar/doc/foo.txt " help for foo.vim + start/foobar/doc/tags " help tags + opt/fooextra/plugin/extra.vim " optional plugin, defines commands + opt/fooextra/autoload/extra.vim " loaded when extra command used + opt/fooextra/doc/extra.txt " help for extra.vim + opt/fooextra/doc/tags " help tags + +This allows for the user to do: > + mkdir ~/.vim/pack/myfoobar + cd ~/.vim/pack/myfoobar + git clone https://github.com/you/foobar.git + +Here "myfoobar" is a name that the user can choose, the only condition is that +it differs from other packages. + +In your documentation you explain what the plugins do, and tell the user how +to load the optional plugin: > + :packadd! fooextra + +You could add this packadd command in one of your plugins, to be executed when +the optional plugin is needed. + +Run the `:helptags` command to generate the doc/tags file. Including this +generated file in the package means that the user can drop the package in his +pack directory and the help command works right away. Don't forget to re-run +the command after changing the plugin help: > + :helptags path/start/foobar/doc + :helptags path/opt/fooextra/doc + + +Dependencies between plugins ~ + *packload-two-steps* +Suppose you have two plugins that depend on the same functionality. You can +put the common functionality in an autoload directory, so that it will be +found automatically. Your package would have these files: + + pack/foo/start/one/plugin/one.vim > + call foolib#getit() +< pack/foo/start/two/plugin/two.vim > + call foolib#getit() +< pack/foo/start/lib/autoload/foolib.vim > + func foolib#getit() + +This works, because loading packages will first add all found directories to +'runtimepath' before sourcing the plugins. + +============================================================================== +7. Debugging scripts *debug-scripts* Besides the obvious messages that you can add to your scripts to find out what they are doing, Vim offers a debug mode. This allows you to step through a @@ -474,16 +750,44 @@ Additionally, these commands can be used: finish Finish the current script or user function and come back to debug mode for the command after the one that sourced or called it. + *>bt* + *>backtrace* + *>where* + backtrace Show the call stacktrace for current debugging session. + bt + where + *>frame* + frame N Goes to N backtrace level. + and - signs make movement + relative. E.g., ":frame +3" goes three frames up. + *>up* + up Goes one level up from call stacktrace. + *>down* + down Goes one level down from call stacktrace. About the additional commands in debug mode: - There is no command-line completion for them, you get the completion for the normal Ex commands only. -- You can shorten them, up to a single character: "c", "n", "s" and "f". +- You can shorten them, up to a single character, unless more than one command + starts with the same letter. "f" stands for "finish", use "fr" for "frame". - Hitting <CR> will repeat the previous one. When doing another command, this is reset (because it's not clear what you want to repeat). - When you want to use the Ex command with the same name, prepend a colon: ":cont", ":next", ":finish" (or shorter). +The backtrace shows the hierarchy of function calls, e.g.: + >bt ~ + 3 function One[3] ~ + 2 Two[3] ~ + ->1 Three[3] ~ + 0 Four ~ + line 1: let four = 4 ~ + +The "->" points to the current frame. Use "up", "down" and "frame N" to +select another frame. + +In the current frame you can evaluate the local function variables. There is +no way to see the command at the current line yet. + DEFINING BREAKPOINTS *:breaka* *:breakadd* @@ -504,6 +808,19 @@ DEFINING BREAKPOINTS < Note that this only works for commands that are executed when sourcing the file, not for a function defined in that file. +:breaka[dd] expr {expression} + Sets a breakpoint, that will break whenever the {expression} + evaluates to a different value. Example: > + :breakadd expr g:lnum + +< Will break, whenever the global variable lnum changes. + Note if you watch a |script-variable| this will break + when switching scripts, since the script variable is only + valid in the script where it has been defined and if that + script is called from several other scripts, this will stop + whenever that particular variable will become visible or + unaccessible again. + The [lnum] is the line number of the breakpoint. Vim will stop at or after this line. When omitted line 1 is used. @@ -576,7 +893,7 @@ OBSCURE user, don't use typeahead for debug commands. ============================================================================== -6. Profiling *profile* *profiling* +8. Profiling *profile* *profiling* Profiling means that Vim measures the time that is spent on executing functions and/or scripts. The |+profile| feature is required for this. @@ -597,6 +914,7 @@ For example, to profile the one_script.vim script file: > :prof[ile] start {fname} *:prof* *:profile* *E750* Start profiling, write the output in {fname} upon exit. + "~/" and environment variables in {fname} will be expanded. If {fname} already exists it will be silently overwritten. The variable |v:profiling| is set to one. diff --git a/runtime/doc/rileft.txt b/runtime/doc/rileft.txt index f4b8f41fd3..17bfdba7ba 100644 --- a/runtime/doc/rileft.txt +++ b/runtime/doc/rileft.txt @@ -1,4 +1,4 @@ -*rileft.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*rileft.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM REFERENCE MANUAL by Avner Lottem diff --git a/runtime/doc/russian.txt b/runtime/doc/russian.txt index 36f3d0b715..cf64873194 100644 --- a/runtime/doc/russian.txt +++ b/runtime/doc/russian.txt @@ -1,4 +1,4 @@ -*russian.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*russian.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM REFERENCE MANUAL by Vassily Ragosin diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index b2c56634a0..971fec8e98 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -1,4 +1,4 @@ -*scroll.txt* For Vim version 7.4. Last change: 2006 Aug 27 +*scroll.txt* For Vim version 8.1. Last change: 2018 Apr 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -32,6 +32,7 @@ seen): *CTRL-E* CTRL-E Scroll window [count] lines downwards in the buffer. + The text moves upwards on the screen. Mnemonic: Extra lines. *CTRL-D* @@ -70,6 +71,7 @@ seen): *CTRL-Y* CTRL-Y Scroll window [count] lines upwards in the buffer. + The text moves downwards on the screen. Note: When using the MS-Windows key bindings CTRL-Y is remapped to redo. @@ -108,7 +110,8 @@ z^ Without [count]: Redraw with the line just above the 3. Scrolling relative to cursor *scroll-cursor* The following commands reposition the edit window (the part of the buffer that -you see) while keeping the cursor on the same line: +you see) while keeping the cursor on the same line. Note that the 'scrolloff' +option may cause context lines to show above and below the cursor. *z<CR>* z<CR> Redraw, line [count] at top of window (default @@ -220,7 +223,7 @@ past its buffer's limits. However, if a 'scrollbind' window that has a relative offset that is past its buffer's limits is given the cursor focus, the other 'scrollbind' windows must jump to a location where the current window's relative offset is valid. This -behavior can be changed by clearing the 'jump' flag from the 'scrollopt' +behavior can be changed by clearing the "jump" flag from the 'scrollopt' option. *syncbind* *:syncbind* *:sync* diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 6c92073076..dab63b1e48 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -1,4 +1,4 @@ -*sign.txt* For Vim version 7.4. Last change: 2014 May 07 +*sign.txt* For Vim version 8.1. Last change: 2016 Aug 17 VIM REFERENCE MANUAL by Gordon Prieur @@ -45,8 +45,10 @@ There are two steps in using signs: When signs are defined for a file, Vim will automatically add a column of two characters to display them in. When the last sign is unplaced the column -disappears again. The color of the column is set with the SignColumn group -|hl-SignColumn|. Example to set the color: > +disappears again. This behavior can be changed with the 'signcolumn' option. + +The color of the column is set with the SignColumn group |hl-SignColumn|. +Example to set the color: > :highlight SignColumn guibg=darkgrey @@ -195,7 +197,9 @@ JUMPING TO A SIGN *:sign-jump* *E157* If the file isn't displayed in window and the current file can not be |abandon|ed this fails. -:sign jump {id} buffer={nr} - Same, but use buffer {nr}. +:sign jump {id} buffer={nr} *E934* + Same, but use buffer {nr}. This fails if buffer {nr} does not + have a name. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 3ffd8932e1..abcd8f88ff 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.4. Last change: 2014 Jul 02 +*spell.txt* For Vim version 8.1. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -723,7 +723,7 @@ Additionally the following items are recognized: = Case must match exactly. ? Rare word. ! Bad (wrong) word. - digit A region in which the word is valid. If no regions are + 1 to 9 A region in which the word is valid. If no regions are specified the word is valid in all regions. Example: @@ -907,9 +907,9 @@ when using "cp1250" on Unix. *spell-LOW* *spell-UPP* Three lines in the affix file are needed. Simplistic example: - FOL ~ - LOW ~ - UPP ~ + FOL áëñ ~ + LOW áëñ ~ + UPP ÁËÑ ~ All three lines must have exactly the same number of characters. @@ -924,9 +924,9 @@ The "UPP" line specifies the characters with upper-case. That is, a character is upper-case where it's different from the character at the same position in "FOL". -An exception is made for the German sharp s . The upper-case version is +An exception is made for the German sharp s ß. The upper-case version is "SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized -as a word character, but use the character in all three. +as a word character, but use the ß character in all three. ASCII characters should be omitted, Vim always handles these in the same way. When the encoding is UTF-8 no word characters need to be specified. @@ -1058,6 +1058,9 @@ this text to start with a "#" so that mistakes don't go unnoticed. Example: SFX F 0 in [^i]n # Spion > Spionin ~ SFX F 0 nen in # Bauerin > Bauerinnen ~ +However, to avoid lots of errors in affix files written for Myspell, you can +add the IGNOREEXTRA flag. + Apparently Myspell allows an affix name to appear more than once. Since this might also be a mistake, Vim checks for an extra "S". The affix files for Myspell that use this feature apparently have this flag. Example: @@ -1111,6 +1114,14 @@ Specifically, the affix flags can be used for: - CIRCUMFIX, as explained just below. +IGNOREEXTRA *spell-IGNOREEXTRA* + +Normally Vim gives an error for an extra field that does not start with '#'. +This avoids errors going unnoticed. However, some files created for Myspell +or Hunspell may contain many entries with an extra field. Use the IGNOREEXTRA +flag to avoid lots of errors. + + CIRCUMFIX *spell-CIRCUMFIX* The CIRCUMFIX flag means a prefix and suffix must be added at the same time. @@ -1375,10 +1386,18 @@ the item name. Case is always ignored. The Hunspell feature to use three arguments and flags is not supported. + *spell-NOCOMPOUNDSUGS* +This item indicates that using compounding to make suggestions is not a good +idea. Use this when compounding is used with very short or one-character +words. E.g. to make numbers out of digits. Without this flag creating +suggestions would spend most time trying all kind of weird compound words. + + NOCOMPOUNDSUGS ~ + *spell-SYLLABLE* The SYLLABLE item defines characters or character sequences that are used to count the number of syllables in a word. Example: - SYLLABLE aeiouy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~ + SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~ Before the first slash is the set of characters that are counted for one syllable, also when repeated and mixed, until the next character that is not @@ -1459,8 +1478,8 @@ alike. This is mostly used for a letter with different accents. This is used to prefer suggestions with these letters substituted. Example: MAP 2 ~ - MAP e ~ - MAP u ~ + MAP eéëêè ~ + MAP uüùúû ~ The first line specifies the number of MAP lines following. Vim ignores the number, but the line must be there. diff --git a/runtime/doc/sponsor.txt b/runtime/doc/sponsor.txt index a99d66d843..6e42d157df 100644 --- a/runtime/doc/sponsor.txt +++ b/runtime/doc/sponsor.txt @@ -1,4 +1,4 @@ -*sponsor.txt* For Vim version 7.4. Last change: 2008 Jun 21 +*sponsor.txt* For Vim version 8.1. Last change: 2008 Jun 21 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index cb7de32dfe..5973524476 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.4. Last change: 2014 Jul 09 +*starting.txt* For Vim version 8.1. Last change: 2018 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -12,9 +12,10 @@ Starting Vim *starting* 4. Initialization |initialization| 5. $VIM and $VIMRUNTIME |$VIM| 6. Suspending |suspend| -7. Saving settings |save-settings| -8. Views and Sessions |views-sessions| -9. The viminfo file |viminfo-file| +7. Exiting |exiting| +8. Saving settings |save-settings| +9. Views and Sessions |views-sessions| +10. The viminfo file |viminfo-file| ============================================================================== 1. Vim arguments *vim-arguments* @@ -44,6 +45,7 @@ filename One or more file names. The first one will be the current vim -- -filename < All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. + For behavior of quotes on MS-Windows, see |win32-quotes|. *--* - This argument can mean two things, depending on whether Ex @@ -56,9 +58,9 @@ filename One or more file names. The first one will be the current that is read from stdin. The commands that would normally be read from stdin will now be read from stderr. Example: > find . -name "*.c" -print | vim - -< The buffer will be marked modified, because it contains text - that needs to be saved. Except when in readonly mode, then - the buffer is not marked modified. Example: > +< The buffer will not be marked as modified, so that it's easy + to exit. Be careful to mark it as modified if you don't want + to accidentally lose it. Example: > ls | view - < Starting in Ex mode: > @@ -125,7 +127,8 @@ argument. On VMS all option arguments are assumed to be lowercase, unless preceded with a slash. Thus "-R" means recovery and "-/R" readonly. ---help *-h* *--help* +--help *-h* *--help* *-?* +-? -h Give usage (help) message and exit. {not in Vi} See |info-message| about capturing the text. @@ -138,11 +141,12 @@ a slash. Thus "-R" means recovery and "-/R" readonly. --noplugin Skip loading plugins. Resets the 'loadplugins' option. {not in Vi} Note that the |-u| argument may also disable loading plugins: - argument load vimrc files load plugins ~ - (nothing) yes yes - -u NONE no no - -u NORC no yes - --noplugin yes no + argument load: vimrc files plugins defaults.vim ~ + (nothing) yes yes yes + -u NONE no no no + -u DEFAULTS no no yes + -u NORC no yes no + --noplugin yes no yes --startuptime {fname} *--startuptime* During startup write timing messages to the file {fname}. @@ -228,6 +232,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. the executable "view" has the same effect as the -R argument. The 'updatecount' option will be set to 10000, meaning that the swap file will not be updated automatically very often. + See |-M| for disallowing modifications. *-m* -m Modifications not allowed to be written. The 'write' option @@ -247,7 +252,8 @@ a slash. Thus "-R" means recovery and "-/R" readonly. -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(), + job_start(), etc. {not in Vi} *-g* @@ -413,6 +419,17 @@ a slash. Thus "-R" means recovery and "-/R" readonly. not needed, because Vim will be able to find out what type of terminal you are using. (See |terminal-info|.) {not in Vi} + *--not-a-term* +--not-a-term Tells Vim that the user knows that the input and/or output is + not connected to a terminal. This will avoid the warning and + the two second delay that would happen. + Also avoids the "Reading from stdin..." message. + {not in Vi} + + *--ttyfail* +--ttyfail When the stdin or stdout is not a terminal (tty) then exit + right away. + *-d* -d Start in diff mode, like |vimdiff|. {not in Vi} {not available when compiled without the |+diff| @@ -452,21 +469,30 @@ a slash. Thus "-R" means recovery and "-/R" readonly. --nofork GUI: Do not fork. Same as |-f|. *-u* *E282* -u {vimrc} The file {vimrc} is read for initializations. Most other - initializations are skipped; see |initialization|. This can - be used to start Vim in a special mode, with special + initializations are skipped; see |initialization|. + + This can be used to start Vim in a special mode, with special mappings and settings. A shell alias can be used to make this easy to use. For example: > alias vimc vim -u ~/.c_vimrc !* < Also consider using autocommands; see |autocommand|. + When {vimrc} is equal to "NONE" (all uppercase), all initializations from files and environment variables are skipped, including reading the |gvimrc| file when the GUI starts. Loading plugins is also skipped. + When {vimrc} is equal to "NORC" (all uppercase), this has the same effect as "NONE", but loading plugins is not skipped. - Using the "-u" argument has the side effect that the - 'compatible' option will be on by default. This can have - unexpected effects. See |'compatible'|. + + When {vimrc} is equal to "DEFAULTS" (all uppercase), this has + the same effect as "NONE", but the |defaults.vim| script is + loaded, which will also set 'nocompatible'. + + Using the "-u" argument with another argument than DEFAULTS + has the side effect that the 'compatible' option will be on by + default. This can have unexpected effects. See + |'compatible'|. {not in Vi} *-U* *E230* @@ -484,6 +510,15 @@ a slash. Thus "-R" means recovery and "-/R" readonly. ":rv" or ":wv" are used. See also |viminfo-file|. {not in Vi} + *--clean* +--clean Equal to "-u DEFAULTS -U NONE -i NONE": + - initializations from files and environment variables is + skipped + - the |defaults.vim| script is loaded, which implies + 'nocompatible': use Vim defaults + - no |gvimrc| script is loaded + - no viminfo file is read or written + - the home directory is excluded from 'runtimepath' *-x* -x Use encryption to read/write files. Will prompt for a key, which is then stored in the 'key' option. All writes will @@ -799,13 +834,13 @@ accordingly. Vim proceeds in this order: MacVim.app, this only applies to the older Carbon version). *VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC* - c. Four places are searched for initializations. The first that exists + c. Five places are searched for initializations. The first that exists is used, the others are ignored. The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT. - - The environment variable VIMINIT (see also |compatible-default|) (*) - The value of $VIMINIT is used as an Ex command line. - - The user vimrc file(s): + I The environment variable VIMINIT (see also |compatible-default|) (*) + The value of $VIMINIT is used as an Ex command line. + II The user vimrc file(s): "$HOME/.vimrc" (for Unix and OS/2) (*) "$HOME/.vim/vimrc" (for Unix and OS/2) (*) "s:.vimrc" (for Amiga) (*) @@ -822,13 +857,16 @@ accordingly. Vim proceeds in this order: Note: For MS-DOS and Win32, "$HOME" is checked first. If no "_vimrc" or ".vimrc" is found there, "$VIM" is tried. See |$VIM| for when $VIM is not set. - - The environment variable EXINIT. - The value of $EXINIT is used as an Ex command line. - - The user exrc file(s). Same as for the user vimrc file, but with - "vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is - used, depending on the system. And without the (*)! - - d. If the 'exrc' option is on (which is not the default), the current + III The environment variable EXINIT. + The value of $EXINIT is used as an Ex command line. + IV The user exrc file(s). Same as for the user vimrc file, but with + "vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is + used, depending on the system. And without the (*)! + V The default vimrc file, $VIMRUNTIME/defaults.vim. This sets up + options values and has "syntax on" and "filetype on" commands, + which is what most new users will want. See |defaults.vim|. + + d. If the 'exrc' option is on (which is NOT the default), the current directory is searched for three files. The first that exists is used, the others are ignored. - The file ".vimrc" (for Unix, Amiga and OS/2) (*) @@ -841,6 +879,9 @@ accordingly. Vim proceeds in this order: (*) Using this file or environment variable will cause 'compatible' to be off by default. See |compatible-default|. + Note: When using the |mzscheme| interface, it is initialized after loading + the vimrc file. Changing 'mzschemedll' later has no effect. + 4. Load the plugin scripts. *load-plugins* This does the same as the command: > :runtime! plugin/**/*.vim @@ -848,14 +889,27 @@ accordingly. Vim proceeds in this order: searched for the "plugin" sub-directory and all files ending in ".vim" will be sourced (in alphabetical order per directory), also in subdirectories. + However, directories in 'runtimepath' ending in "after" are skipped + here and only loaded after packages, see below. Loading plugins won't be done when: - The 'loadplugins' option was reset in a vimrc file. - The |--noplugin| command line argument is used. + - The |--clean| command line argument is used. - The "-u NONE" command line argument is used |-u|. - When Vim was compiled without the |+eval| feature. Note that using "-c 'set noloadplugins'" doesn't work, because the commands from the command line have not been executed yet. You can - use "--cmd 'set noloadplugins'" |--cmd|. + use "--cmd 'set noloadplugins'" or "--cmd 'set loadplugins'" |--cmd|. + + Packages are loaded. These are plugins, as above, but found in the + "start" directory of each entry in 'packpath'. Every plugin directory + found is added in 'runtimepath' and then the plugins are sourced. See + |packages|. + + The plugins scripts are loaded, as above, but now only the directories + ending in "after" are used. Note that 'runtimepath' will have changed + if packages have been found, but that should not add a directory + ending in "after". 5. Set 'shellpipe' and 'shellredir' The 'shellpipe' and 'shellredir' options are set according to the @@ -893,11 +947,16 @@ accordingly. Vim proceeds in this order: 12. Execute startup commands If a "-t" flag was given to Vim, the tag is jumped to. The commands given with the |-c| and |+cmd| arguments are executed. - The starting flag is reset, has("vim_starting") will now return zero. If the 'insertmode' option is set, Insert mode is entered. + The starting flag is reset, has("vim_starting") will now return zero. + The |v:vim_did_enter| variable is set to 1. The |VimEnter| autocommands are executed. -Some hints on using initializations: +The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or +gvimrc file. + + +Some hints on using initializations ~ Standard setup: Create a vimrc file to set the default settings and mappings for all your edit @@ -920,39 +979,62 @@ want to set the defaults for all users. Create a vimrc file with commands for default settings and mappings and put it in the place that is given with the ":version" command. -Saving the current state of Vim to a file: + +Saving the current state of Vim to a file ~ + Whenever you have changed values of options or when you have created a mapping, then you may want to save them in a vimrc file for later use. See |save-settings| about saving the current state of settings to a file. -Avoiding setup problems for Vi users: + +Avoiding setup problems for Vi users ~ + Vi uses the variable EXINIT and the file "~/.exrc". So if you do not want to interfere with Vi, then use the variable VIMINIT and the file "vimrc" instead. -Amiga environment variables: + +Amiga environment variables ~ + On the Amiga, two types of environment variables exist. The ones set with the DOS 1.3 (or later) setenv command are recognized. See the AmigaDos 1.3 manual. The environment variables set with the old Manx Set command (before version 5.0) are not recognized. -MS-DOS line separators: + +MS-DOS line separators ~ + On MS-DOS-like systems (MS-DOS itself, Win32, and OS/2), Vim assumes that all the vimrc files have <CR> <NL> pairs as line separators. This will give problems if you have a file with only <NL>s and have a line like ":map xx yy^M". The trailing ^M will be ignored. + +Vi compatible default value ~ *compatible-default* When Vim starts, the 'compatible' option is on. This will be used when Vim -starts its initializations. But as soon as a user vimrc file is found, or a -vimrc file in the current directory, or the "VIMINIT" environment variable is -set, it will be set to 'nocompatible'. This has the side effect of setting or -resetting other options (see 'compatible'). But only the options that have -not been set or reset will be changed. This has the same effect like the -value of 'compatible' had this value when starting Vim. Note that this -doesn't happen for the system-wide vimrc file nor when Vim was started with -the |-u| command line argument. It does also happen for gvimrc files. The -$MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or gvimrc -file. +starts its initializations. But as soon as: +- a user vimrc file is found, or +- a vimrc file in the current directory is found, or +- the "VIMINIT" environment variable is set, or +- the "-N" command line argument is given, or +- the "--clean" command line argument is given, or +- the |defaults.vim| script is loaded, or +- a gvimrc file was found, +then the option will be set to 'nocompatible'. + +Note that this does NOT happen when a system-wide vimrc file was found. + +This has the side effect of setting or resetting other options (see +'compatible'). But only the options that have not been set or reset will be +changed. This has the same effect like the value of 'compatible' had this +value when starting Vim. + +'compatible' is NOT reset, and |defaults.vim| is not loaded: +- when Vim was started with the |-u| command line argument, especially with + "-u NONE", or +- when started with the |-C| command line argument, or +- when the name of the executable ends in "ex". (This has been done to make + Vim behave like "ex", when it is started as "ex") But there is a side effect of setting or resetting 'compatible' at the moment a .vimrc file is found: Mappings are interpreted the moment they are @@ -960,18 +1042,35 @@ encountered. This makes a difference when using things like "<CR>". If the mappings depend on a certain value of 'compatible', set or reset it before giving the mapping. -The above behavior can be overridden in these ways: -- If the "-N" command line argument is given, 'nocompatible' will be used, - even when no vimrc file exists. -- If the "-C" command line argument is given, 'compatible' will be used, even - when a vimrc file exists. -- If the "-u {vimrc}" argument is used, 'compatible' will be used. -- When the name of the executable ends in "ex", then this works like the "-C" - argument was given: 'compatible' will be used, even when a vimrc file - exists. This has been done to make Vim behave like "ex", when it is started - as "ex". - -Avoiding trojan horses: *trojan-horse* + +Defaults without a .vimrc file ~ + *defaults.vim* +If Vim is started normally and no user vimrc file is found, the +$VIMRUNTIME/defaults.vim script is loaded. This will set 'compatible' off, +switch on syntax highlighting and a few more things. See the script for +details. NOTE: this is done since Vim 8.0, not in Vim 7.4. (it was added in +patch 7.4.2111 to be exact). + +This should work well for new Vim users. If you create your own .vimrc, it is +recommended to add these lines somewhere near the top: > + unlet! skip_defaults_vim + source $VIMRUNTIME/defaults.vim +Then Vim works like before you had a .vimrc. Copying $VIMRUNTIME/vimrc_example +is way to do this. Alternatively, you can copy defaults.vim to your .vimrc +and modify it (but then you won't get updates when it changes). + +If you don't like some of the defaults, you can still source defaults.vim and +revert individual settings. See the defaults.vim file for hints on how to +revert each item. + *skip_defaults_vim* +If you use a system-wide vimrc and don't want defaults.vim to change settings, +set the "skip_defaults_vim" variable. If this was set and you want to load +defaults.vim from your .vimrc, first unlet skip_defaults_vim, as in the +example above. + + +Avoiding trojan horses ~ + *trojan-horse* While reading the "vimrc" or the "exrc" file in the current directory, some commands can be disabled for security reasons by setting the 'secure' option. This is always done when executing the command from a tags file. Otherwise it @@ -994,6 +1093,8 @@ Be careful! part of the line in the tags file) is always done in secure mode. This works just like executing a command from a vimrc/exrc in the current directory. + +If Vim startup is slow ~ *slow-start* If Vim takes a long time to start up, use the |--startuptime| argument to find out what happens. There are a few common causes: @@ -1008,6 +1109,8 @@ out what happens. There are a few common causes: moment (use the Vim argument "-i NONE", |-i|). Try reducing the number of lines stored in a register with ":set viminfo='20,<50,s10". |viminfo-file|. + +Intro message ~ *:intro* When Vim starts without a file name, an introductory message is displayed (for those who don't know what Vim is). It is removed as soon as the display is @@ -1134,7 +1237,20 @@ can't paste it in another application (since Vim is going to sleep an attempt to get the selection would make the program hang). ============================================================================== -7. Saving settings *save-settings* +7. Exiting *exiting* + +There are several ways to exit Vim: +- Close the last window with `:quit`. Only when there are no changes. +- Close the last window with `:quit!`. Also when there are changes. +- Close all windows with `:qall`. Only when there are no changes. +- Close all windows with `:qall!`. Also when there are changes. +- Use `:cquit`. Also when there are changes. + +When using `:cquit` or when there was an error message Vim exits with exit +code 1. Errors can be avoided by using `:silent!` or with `:catch`. + +============================================================================== +8. Saving settings *save-settings* Mostly you will edit your vimrc files manually. This gives you the greatest flexibility. There are a few commands to generate a vimrc file automatically. @@ -1196,7 +1312,7 @@ option, which has several side effects. See |'compatible'|. 'compatible' option to the output file first, because of these side effects. ============================================================================== -8. Views and Sessions *views-sessions* +9. Views and Sessions *views-sessions* This is introduced in sections |21.4| and |21.5| of the user manual. @@ -1307,7 +1423,7 @@ The output of ":mkview" contains these items: 5. The scroll position and the cursor position in the file. Doesn't work very well when there are closed folds. 6. The local current directory, if it is different from the global current - directory. + directory and 'viewoptions' contains "curdir". Note that Views and Sessions are not perfect: - They don't restore everything. For example, defined functions, autocommands @@ -1343,7 +1459,7 @@ To automatically save and restore views for *.c files: > au BufWinEnter *.c silent loadview ============================================================================== -9. The viminfo file *viminfo* *viminfo-file* *E136* +10. The viminfo file *viminfo* *viminfo-file* *E136* *E575* *E576* *E577* If you exit Vim and later start it again, you would normally lose a lot of information. The viminfo file can be used to remember that information, which @@ -1385,13 +1501,41 @@ file (it's actually merged with the existing one, if one exists). The 'viminfo' option is a string containing information about what info should be stored, and contains limits on how much should be stored (see 'viminfo'). +Merging happens in two ways. Most items that have been changed or set in the +current Vim session are stored, and what was not changed is filled from what +is currently in the viminfo file. For example: +- Vim session A reads the viminfo, which contains variable START. +- Vim session B does the same +- Vim session A sets the variables AAA and BOTH and exits +- Vim session B sets the variables BBB and BOTH and exits +Now the viminfo will have: + START - it was in the viminfo and wasn't changed in session A or B + AAA - value from session A, session B kept it + BBB - value from session B + BOTH - value from session B, value from session A is lost + + *viminfo-timestamp* +For some items a timestamp is used to keep the last changed version. Here it +doesn't matter in which sequence Vim sessions exit, the newest item(s) are +always kept. This is used for: +- The command line history. +- The search string history. +- The input-line history. +- Contents of non-empty registers. +- The jump list +- File marks +The timestamp feature was added before Vim 8.0. Older versions of Vim, +starting with 7.4.1131, will keep the items with timestamp, but not use them. +Thus when using both an older and a newer version of Vim the most recent data +will be kept. + Notes for Unix: - The file protection for the viminfo file will be set to prevent other users from being able to read it, because it may contain any text or commands that you have worked with. - If you want to share the viminfo file with other users (e.g. when you "su" to another user), you can make the file writable for the group or everybody. - Vim will preserve this when writing new viminfo files. Be careful, don't + Vim will preserve this when replacing the viminfo file. Be careful, don't allow just anybody to read and write your viminfo file! - Vim will not overwrite a viminfo file that is not writable by the current "real" user. This helps for when you did "su" to become root, but your @@ -1507,14 +1651,14 @@ most of the information will be restored). already set (registers, marks, |v:oldfiles|, etc.) will be overwritten {not in Vi} - *:wv* *:wviminfo* *E137* *E138* *E574* *E886* + *:wv* *:wviminfo* *E137* *E138* *E574* *E886* *E929* :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above). The information in the file is first read in to make a merge between old and new info. When [!] is used, the old information is not read first, only the internal info is written. If 'viminfo' is empty, marks for up to 100 files will be written. - When you get error "E138: Can't write viminfo file" + When you get error "E929: Too many viminfo temp files" check that no old temp files were left behind (e.g. ~/.viminf*) and that you can write in the directory of the .viminfo file. @@ -1523,8 +1667,11 @@ most of the information will be restored). *:ol* *:oldfiles* :ol[dfiles] List the files that have marks stored in the viminfo file. This list is read on startup and only changes - afterwards with ":rviminfo!". Also see |v:oldfiles|. + afterwards with `:rviminfo!`. Also see |v:oldfiles|. The number can be used with |c_#<|. + The output can be filtered with |:filter|, e.g.: > + filter /\.vim/ oldfiles +< The filtering happens on the file name. {not in Vi, only when compiled with the |+eval| feature} diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index c868c745be..1ccd451041 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Jun 27 +*syntax.txt* For Vim version 8.1. Last change: 2018 Apr 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -61,10 +61,12 @@ fine. If it doesn't, try setting the VIM environment variable to the directory where the Vim stuff is located. For example, if your syntax files are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to "/usr/vim/vim50". You must do this in the shell, before starting Vim. +This command also sources the |menu.vim| script when the GUI is running or +will start soon. See |'go-M'| about avoiding that. *:syn-on* *:syntax-on* -The ":syntax enable" command will keep your current color settings. This -allows using ":highlight" commands to set your preferred colors before or +The `:syntax enable` command will keep your current color settings. This +allows using `:highlight` commands to set your preferred colors before or after using this command. If you want Vim to overrule your settings with the defaults, use: > :syntax on @@ -211,7 +213,8 @@ thing. These are then linked to a highlight group that specifies the color. A syntax group name doesn't specify any color or attributes itself. The name for a highlight or syntax group must consist of ASCII letters, digits -and the underscore. As a regexp: "[a-zA-Z0-9_]*" +and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give +an error when using other characters. To be able to allow each user to pick his favorite set of colors, there must be preferred names for highlight groups that are common for many languages. @@ -421,18 +424,19 @@ and last line to be converted. Example, using the last set Visual area: > *:TOhtml* :[range]TOhtml The ":TOhtml" command is defined in a standard plugin. This command will source |2html.vim| for you. When a - range is given, set |g:html_start_line| and - |g:html_end_line| to the start and end of the range, - respectively. Default range is the entire buffer. - - If the current window is part of a |diff|, unless - |g:html_diff_one_file| is set, :TOhtml will convert - all windows which are part of the diff in the current - tab and place them side-by-side in a <table> element - in the generated HTML. With |g:html_line_ids| you can - jump to lines in specific windows with (for example) - #W1L42 for line 42 in the first diffed window, or - #W3L87 for line 87 in the third. + range is given, this command sets |g:html_start_line| + and |g:html_end_line| to the start and end of the + range, respectively. Default range is the entire + buffer. + + If the current window is part of a |diff|, unless + |g:html_diff_one_file| is set, :TOhtml will convert + all windows which are part of the diff in the current + tab and place them side-by-side in a <table> element + in the generated HTML. With |g:html_line_ids| you can + jump to lines in specific windows with (for example) + #W1L42 for line 42 in the first diffed window, or + #W3L87 for line 87 in the third. Examples: > @@ -501,7 +505,7 @@ inserted for that purpose if no line numbers are shown. This ID attribute takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view pages, and is used to jump to a specific line (in a specific window of a diff view). Javascript is inserted to open any closed dynamic folds -(|g:html_dynamic_folds|) containing the specificed line before jumping. The +(|g:html_dynamic_folds|) containing the specified line before jumping. The javascript also allows omitting the window ID in the url, and the leading L. For example: > @@ -746,6 +750,22 @@ and UTF-32 instead, use: > Note that documents encoded in either UTF-32 or UTF-16 have known compatibility problems with some major browsers. + *g:html_font* +Default: "monospace" +You can specify the font or fonts used in the converted document using +g:html_font. If this option is set to a string, then the value will be +surrounded with single quotes. If this option is set to a list then each list +item is surrounded by single quotes and the list is joined with commas. Either +way, "monospace" is added as the fallback generic family name and the entire +result used as the font family (using CSS) or font face (if not using CSS). +Examples: > + + " font-family: 'Consolas', monospace; + :let g:html_font = "Consolas" + + " font-family: 'DejaVu Sans Mono', 'Consolas', monospace; + :let g:html_font = ["DejaVu Sans Mono", "Consolas"] +< *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml* Default: 0. When 0, generate standard HTML 4.01 (strict when possible). @@ -792,12 +812,9 @@ See |mysyntaxfile-add| for installing script languages permanently. APACHE *apache.vim* *ft-apache-syntax* -The apache syntax file provides syntax highlighting depending on Apache HTTP -server version, by default for 1.3.x. Set "apache_version" to Apache version -(as a string) to get highlighting for another version. Example: > +The apache syntax file provides syntax highlighting for Apache HTTP server +version 2.2.3. - :let apache_version = "2.0" -< *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k* ASSEMBLY *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax* @@ -923,26 +940,29 @@ To disable them use ":unlet". Example: > :unlet c_comment_strings Variable Highlight ~ -c_gnu GNU gcc specific items -c_comment_strings strings and numbers inside a comment -c_space_errors trailing white space and spaces before a <Tab> -c_no_trail_space_error ... but no trailing spaces -c_no_tab_space_error ... but no spaces before a <Tab> -c_no_bracket_error don't highlight {}; inside [] as errors -c_no_curly_error don't highlight {}; inside [] and () as errors; +*c_gnu* GNU gcc specific items +*c_comment_strings* strings and numbers inside a comment +*c_space_errors* trailing white space and spaces before a <Tab> +*c_no_trail_space_error* ... but no trailing spaces +*c_no_tab_space_error* ... but no spaces before a <Tab> +*c_no_bracket_error* don't highlight {}; inside [] as errors +*c_no_curly_error* don't highlight {}; inside [] and () as errors; except { and } in first column -c_curly_error highlight a missing }; this forces syncing from the + Default is to highlight them, otherwise you + can't spot a missing ")". +*c_curly_error* highlight a missing }; this forces syncing from the start of the file, can be slow -c_no_ansi don't do standard ANSI types and constants -c_ansi_typedefs ... but do standard ANSI types -c_ansi_constants ... but do standard ANSI constants -c_no_utf don't highlight \u and \U in strings -c_syntax_for_h for *.h files use C syntax instead of C++ and use objc +*c_no_ansi* don't do standard ANSI types and constants +*c_ansi_typedefs* ... but do standard ANSI types +*c_ansi_constants* ... but do standard ANSI constants +*c_no_utf* don't highlight \u and \U in strings +*c_syntax_for_h* for *.h files use C syntax instead of C++ and use objc syntax instead of objcpp -c_no_if0 don't highlight "#if 0" blocks as comments -c_no_cformat don't highlight %-formats in strings -c_no_c99 don't highlight C99 standard items -c_no_c11 don't highlight C11 standard items +*c_no_if0* don't highlight "#if 0" blocks as comments +*c_no_cformat* don't highlight %-formats in strings +*c_no_c99* don't highlight C99 standard items +*c_no_c11* don't highlight C11 standard items +*c_no_bsd* don't highlight BSD specific types When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will become a fold. If you don't want comments to become a fold use: > @@ -1024,6 +1044,21 @@ This works immediately. CLOJURE *ft-clojure-syntax* +The default syntax groups can be augmented through the +*g:clojure_syntax_keywords* and *b:clojure_syntax_keywords* variables. The +value should be a |Dictionary| of syntax group names to a |List| of custom +identifiers: +> + let g:clojure_syntax_keywords = { + \ 'clojureMacro': ["defproject", "defcustom"], + \ 'clojureFunc': ["string/join", "string/replace"] + \ } +< +Refer to the Clojure syntax script for valid syntax group names. + +If the |buffer-variable| *b:clojure_syntax_without_core_keywords* is set, only +language constants and special forms are matched. + Setting *g:clojure_fold* enables folding Clojure code via the syntax engine. Any list, vector, or map that extends over more than one line can be folded using the standard Vim |fold-commands|. @@ -1063,7 +1098,8 @@ CPP *cpp.vim* *ft-cpp-syntax* Most of things are same as |ft-c-syntax|. Variable Highlight ~ -cpp_no_c11 don't highlight C++11 standard items +cpp_no_cpp11 don't highlight C++11 standard items +cpp_no_cpp14 don't highlight C++14 standard items CSH *csh.vim* *ft-csh-syntax* @@ -1128,6 +1164,16 @@ to standard by placing this in your vimrc file: > :let enforce_freedesktop_standard = 1 +DIFF *diff.vim* + +The diff highlighting normally finds translated headers. This can be slow if +there are very long lines in the file. To disable translations: > + + :let diff_translations = 0 + +Also see |diff-slow|. + + DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* The dircolors utility highlighting definition has one option. It exists to @@ -1409,34 +1455,27 @@ form, then > :let fortran_fixed_source=1 in your .vimrc prior to the :syntax on command. -If the form of the source code depends upon the file extension, then it is -most convenient to set fortran_free_source in a ftplugin file. For more -information on ftplugin files, see |ftplugin|. For example, if all your -fortran files with an .f90 extension are written in free source form and the -rest in fixed source form, add the following code to your ftplugin file > - let s:extfname = expand("%:e") - if s:extfname ==? "f90" - let fortran_free_source=1 - unlet! fortran_fixed_source - else - let fortran_fixed_source=1 - unlet! fortran_free_source - endif -Note that this will work only if the "filetype plugin indent on" command -precedes the "syntax on" command in your .vimrc file. +If the form of the source code depends, in a non-standard way, upon the file +extension, then it is most convenient to set fortran_free_source in a ftplugin +file. For more information on ftplugin files, see |ftplugin|. Note that this +will work only if the "filetype plugin indent on" command precedes the "syntax +on" command in your .vimrc file. When you edit an existing fortran file, the syntax script will assume free source form if the fortran_free_source variable has been set, and assumes fixed source form if the fortran_fixed_source variable has been set. If neither of these variables have been set, the syntax script attempts to -determine which source form has been used by examining the first five columns -of the first 250 lines of your file. If no signs of free source form are -detected, then the file is assumed to be in fixed source form. The algorithm -should work in the vast majority of cases. In some cases, such as a file that -begins with 250 or more full-line comments, the script may incorrectly decide -that the fortran code is in fixed form. If that happens, just add a -non-comment statement beginning anywhere in the first five columns of the -first twenty five lines, save (:w) and then reload (:e!) the file. +determine which source form has been used by examining the file extension +using conventions common to the ifort, gfortran, Cray, NAG, and PathScale +compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for +free-source). If none of this works, then the script examines the first five +columns of the first 500 lines of your file. If no signs of free source form +are detected, then the file is assumed to be in fixed source form. The +algorithm should work in the vast majority of cases. In some cases, such as a +file that begins with 500 or more full-line comments, the script may +incorrectly decide that the fortran code is in fixed form. If that happens, +just add a non-comment statement beginning anywhere in the first five columns +of the first twenty-five lines, save (:w) and then reload (:e!) the file. Tabs in fortran files ~ Tabs are not recognized by the Fortran standards. Tabs are not a good idea in @@ -2098,6 +2137,16 @@ set "msql_minlines" to the value you desire. Example: > :let msql_minlines = 200 +N1QL *n1ql.vim* *ft-n1ql-syntax* + +N1QL is a SQL-like declarative language for manipulating JSON documents in +Couchbase Server databases. + +Vim syntax highlights N1QL statements, keywords, operators, types, comments, +and special values. Vim ignores syntactical elements specific to SQL or its +many dialects, like COLUMN or CHAR, that don't exist in N1QL. + + NCF *ncf.vim* *ft-ncf-syntax* There is one option for NCF syntax highlighting. @@ -2606,9 +2655,9 @@ later, and part earlier) adds. RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* -You may set what syntax definitions should be used for code blocks via +You may set what syntax definitions should be used for code blocks via > let rst_syntax_code_list = ['vim', 'lisp', ...] - +< REXX *rexx.vim* *ft-rexx-syntax* @@ -2629,79 +2678,111 @@ your .vimrc: *g:filetype_r* RUBY *ruby.vim* *ft-ruby-syntax* -There are a number of options to the Ruby syntax highlighting. + Ruby: Operator highlighting |ruby_operators| + Ruby: Whitespace errors |ruby_space_errors| + Ruby: Folding |ruby_fold| |ruby_foldable_groups| + Ruby: Reducing expensive operations |ruby_no_expensive| |ruby_minlines| + Ruby: Spellchecking strings |ruby_spellcheck_strings| -By default, the "end" keyword is colorized according to the opening statement -of the block it closes. While useful, this feature can be expensive; if you -experience slow redrawing (or you are on a terminal with poor color support) -you may want to turn it off by defining the "ruby_no_expensive" variable: > + *ruby_operators* + Ruby: Operator highlighting ~ - :let ruby_no_expensive = 1 +Operators can be highlighted by defining "ruby_operators": > + + :let ruby_operators = 1 < -In this case the same color will be used for all control keywords. + *ruby_space_errors* + Ruby: Whitespace errors ~ -If you do want this feature enabled, but notice highlighting errors while -scrolling backwards, which are fixed when redrawing with CTRL-L, try setting -the "ruby_minlines" variable to a value larger than 50: > +Whitespace errors can be highlighted by defining "ruby_space_errors": > - :let ruby_minlines = 100 + :let ruby_space_errors = 1 < -Ideally, this value should be a number of lines large enough to embrace your -largest class or module. +This will highlight trailing whitespace and tabs preceded by a space character +as errors. This can be refined by defining "ruby_no_trail_space_error" and +"ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after +spaces respectively. -Highlighting of special identifiers can be disabled by removing the -rubyIdentifier highlighting: > + *ruby_fold* *ruby_foldable_groups* + Ruby: Folding ~ - :hi link rubyIdentifier NONE +Folding can be enabled by defining "ruby_fold": > + + :let ruby_fold = 1 < -This will prevent highlighting of special identifiers like "ConstantName", -"$global_var", "@@class_var", "@instance_var", "| block_param |", and -":symbol". +This will set the value of 'foldmethod' to "syntax" locally to the current +buffer or window, which will enable syntax-based folding when editing Ruby +filetypes. + +Default folding is rather detailed, i.e., small syntax units like "if", "do", +"%w[]" may create corresponding fold levels. -Significant methods of Kernel, Module and Object are highlighted by default. -This can be disabled by defining "ruby_no_special_methods": > +You can set "ruby_foldable_groups" to restrict which groups are foldable: > - :let ruby_no_special_methods = 1 + :let ruby_foldable_groups = 'if case %' < -This will prevent highlighting of important methods such as "require", "attr", -"private", "raise" and "proc". +The value is a space-separated list of keywords: + + keyword meaning ~ + -------- ------------------------------------- ~ + ALL Most block syntax (default) + NONE Nothing + if "if" or "unless" block + def "def" block + class "class" block + module "module" block + do "do" block + begin "begin" block + case "case" block + for "for", "while", "until" loops + { Curly bracket block or hash literal + [ Array literal + % Literal with "%" notation, e.g.: %w(STRING), %!STRING! + / Regexp + string String and shell command output (surrounded by ', ", `) + : Symbol + # Multiline comment + << Here documents + __END__ Source code after "__END__" directive + + *ruby_no_expensive* + Ruby: Reducing expensive operations ~ -Ruby operators can be highlighted. This is enabled by defining -"ruby_operators": > +By default, the "end" keyword is colorized according to the opening statement +of the block it closes. While useful, this feature can be expensive; if you +experience slow redrawing (or you are on a terminal with poor color support) +you may want to turn it off by defining the "ruby_no_expensive" variable: > - :let ruby_operators = 1 + :let ruby_no_expensive = 1 < -Whitespace errors can be highlighted by defining "ruby_space_errors": > +In this case the same color will be used for all control keywords. - :let ruby_space_errors = 1 -< -This will highlight trailing whitespace and tabs preceded by a space character -as errors. This can be refined by defining "ruby_no_trail_space_error" and -"ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after -spaces respectively. + *ruby_minlines* -Folding can be enabled by defining "ruby_fold": > +If you do want this feature enabled, but notice highlighting errors while +scrolling backwards, which are fixed when redrawing with CTRL-L, try setting +the "ruby_minlines" variable to a value larger than 50: > - :let ruby_fold = 1 + :let ruby_minlines = 100 < -This will set the 'foldmethod' option to "syntax" and allow folding of -classes, modules, methods, code blocks, heredocs and comments. +Ideally, this value should be a number of lines large enough to embrace your +largest class or module. -Folding of multiline comments can be disabled by defining -"ruby_no_comment_fold": > + *ruby_spellcheck_strings* + Ruby: Spellchecking strings ~ - :let ruby_no_comment_fold = 1 +Ruby syntax will perform spellchecking of strings if you define +"ruby_spellcheck_strings": > + + :let ruby_spellcheck_strings = 1 < SCHEME *scheme.vim* *ft-scheme-syntax* -By default only R5RS keywords are highlighted and properly indented. - -MzScheme-specific stuff will be used if b:is_mzscheme or g:is_mzscheme -variables are defined. +By default only R7RS keywords are highlighted and properly indented. -Also scheme.vim supports keywords of the Chicken Scheme->C compiler. Define -b:is_chicken or g:is_chicken, if you need them. +scheme.vim also supports extensions of the CHICKEN Scheme->C compiler. +Define b:is_chicken or g:is_chicken, if you need them. SDL *sdl.vim* *ft-sdl-syntax* @@ -2788,9 +2869,11 @@ vimrc file: > (Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>) -SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax* + *ft-posix-synax* *ft-dash-syntax* +SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax* -This covers the "normal" Unix (Bourne) sh, bash and the Korn shell. +This covers syntax highlighting for the older Unix (Bourne) sh, and newer +shells such as bash, dash, posix, and the Korn shells. Vim attempts to determine which shell type is in use by specifying that various filenames are of specific types: > @@ -2799,28 +2882,31 @@ various filenames are of specific types: > bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash < If none of these cases pertain, then the first line of the file is examined -(ex. /bin/sh /bin/ksh /bin/bash). If the first line specifies a shelltype, -then that shelltype is used. However some files (ex. .profile) are known to -be shell files but the type is not apparent. Furthermore, on many systems -sh is symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" (Posix). +(ex. looking for /bin/sh /bin/ksh /bin/bash). If the first line specifies a +shelltype, then that shelltype is used. However some files (ex. .profile) are +known to be shell files but the type is not apparent. Furthermore, on many +systems sh is symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" +(Posix). -One may specify a global default by instantiating one of the following three +One may specify a global default by instantiating one of the following variables in your <.vimrc>: - ksh: > + ksh: > let g:is_kornshell = 1 -< posix: (using this is the same as setting is_kornshell to 1) > +< posix: (using this is the nearly the same as setting g:is_kornshell to 1) > let g:is_posix = 1 < bash: > let g:is_bash = 1 < sh: (default) Bourne shell > let g:is_sh = 1 +< (dash users should use posix) + If there's no "#! ..." line, and the user hasn't availed himself/herself of a default sh.vim syntax setting as just shown, then syntax/sh.vim will assume the Bourne shell syntax. No need to quote RFCs or market penetration statistics in error reports, please -- just select the default version of the -sh your system uses in your <.vimrc>. +sh your system uses and install the associated "let..." in your <.vimrc>. The syntax/sh.vim file provides several levels of syntax-based folding: > @@ -2829,7 +2915,7 @@ The syntax/sh.vim file provides several levels of syntax-based folding: > let g:sh_fold_enabled= 2 (enable heredoc folding) let g:sh_fold_enabled= 4 (enable if/do/for folding) > -then various syntax items (HereDocuments and function bodies) become +then various syntax items (ie. HereDocuments and function bodies) become syntax-foldable (see |:syn-fold|). You also may add these together to get multiple types of folding: > @@ -2853,14 +2939,14 @@ reduce this, the "sh_maxlines" internal variable can be set. Example: > The default is to use the twice sh_minlines. Set it to a smaller number to speed up displaying. The disadvantage is that highlight errors may appear. - *g:sh_isk* *g:sh_noisk* -The shell languages appear to let "." be part of words, commands, etc; -consequently it should be in the isk for sh.vim. As of v116 of syntax/sh.vim, -syntax/sh.vim will append the "." to |'iskeyword'| by default; you may control -this behavior with: > - let g:sh_isk = '..whatever characters you want as part of iskeyword' - let g:sh_noisk= 1 " otherwise, if this exists, the isk will NOT chg +syntax/sh.vim tries to flag certain problems as errors; usually things like +extra ']'s, 'done's, 'fi's, etc. If you find the error handling problematic +for your purposes, you may suppress such error highlighting by putting +the following line in your .vimrc: > + + let g:sh_no_error= 1 < + *sh-embed* *sh-awk* Sh: EMBEDDING LANGUAGES~ @@ -2868,7 +2954,7 @@ You may wish to embed languages into sh. I'll give an example courtesy of Lorance Stinson on how to do this with awk as an example. Put the following file into $HOME/.vim/after/syntax/sh/awkembed.vim: > - " AWK Embedding: {{{1 + " AWK Embedding: " ============== " Shamelessly ripped from aspperl.vim by Aaron Hope. if exists("b:current_syntax") @@ -2975,6 +3061,7 @@ TEX *tex.vim* *ft-tex-syntax* *latex-syntax* Tex: Taking Advantage of Conceal Mode |tex-conceal| Tex: Selective Conceal Mode |g:tex_conceal| Tex: Controlling iskeyword |g:tex_isk| + Tex: Fine Subscript and Superscript Control |tex-supersub| *tex-folding* *g:tex_fold_enabled* Tex: Want Syntax Folding? ~ @@ -3068,6 +3155,7 @@ selectively to enable just some syntax highlighting: > < As an example, let g:tex_fast= "M" will allow math-associated highlighting but suppress all the other region-based syntax highlighting. +(also see: |g:tex_conceal| and |tex-supersub|) *tex-morecommands* *tex-package* Tex: Want To Highlight More Commands? ~ @@ -3160,15 +3248,37 @@ syntax highlighting script handles this with the following logic: * If g:tex_stylish exists and is 1 then the file will be treated as a "sty" file, so the "_" will be allowed as part of keywords - (irregardless of g:tex_isk) + (regardless of g:tex_isk) * Else if the file's suffix is sty, cls, clo, dtx, or ltx, then the file will be treated as a "sty" file, so the "_" will be allowed as part of keywords - (irregardless of g:tex_isk) + (regardless of g:tex_isk) * If g:tex_isk exists, then it will be used for the local 'iskeyword' * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255 + *tex-supersub* *g:tex_superscripts* *g:tex_subscripts* + Tex: Fine Subscript and Superscript Control~ + + See |tex-conceal| for how to enable concealed character replacement. + + See |g:tex_conceal| for selectively concealing accents, bold/italic, + math, Greek, and superscripts/subscripts. + + One may exert fine control over which superscripts and subscripts one + wants syntax-based concealment for (see |:syn-cchar|). Since not all + fonts support all characters, one may override the + concealed-replacement lists; by default these lists are given by: > + + let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" + let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" +< + For example, I use Luxi Mono Bold; it doesn't support subscript + characters for "hklmnpst", so I put > + let g:tex_subscripts= "[0-9aeijoruvx,+-/().]" +< in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable + utf-8 glyphs appear. + TF *tf.vim* *ft-tf-syntax* @@ -3196,7 +3306,8 @@ improve screen updating rates (see |:syn-sync| for more on this). > The g:vimsyn_embed option allows users to select what, if any, types of embedded script highlighting they wish to have. > - g:vimsyn_embed == 0 : don't embed any scripts + g:vimsyn_embed == 0 : don't support any embedded scripts + g:vimsyn_embed =~ 'l' : support embedded lua g:vimsyn_embed =~ 'm' : support embedded mzscheme g:vimsyn_embed =~ 'p' : support embedded perl g:vimsyn_embed =~ 'P' : support embedded python @@ -3214,6 +3325,7 @@ Some folding is now supported with syntax/vim.vim: > g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding g:vimsyn_folding =~ 'a' : augroups g:vimsyn_folding =~ 'f' : fold functions + g:vimsyn_folding =~ 'l' : fold lua script g:vimsyn_folding =~ 'm' : fold mzscheme script g:vimsyn_folding =~ 'p' : fold perl script g:vimsyn_folding =~ 'P' : fold python script @@ -3221,8 +3333,8 @@ Some folding is now supported with syntax/vim.vim: > g:vimsyn_folding =~ 't' : fold tcl script < *g:vimsyn_noerror* -Not all error highlighting that syntax/vim.vim does may be correct; VimL is a -difficult language to highlight correctly. A way to suppress error +Not all error highlighting that syntax/vim.vim does may be correct; Vim script +is a difficult language to highlight correctly. A way to suppress error highlighting is to put the following line in your |vimrc|: > let g:vimsyn_noerror = 1 @@ -3287,6 +3399,39 @@ must not click outside of the pixel strings, but feel free to improve it. It will look much better with a font in a quadratic cell size, e.g. for X: > :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-* + +YAML *yaml.vim* *ft-yaml-syntax* + + *g:yaml_schema* *b:yaml_schema* +A YAML schema is a combination of a set of tags and a mechanism for resolving +non-specific tags. For user this means that YAML parser may, depending on +plain scalar contents, treat plain scalar (which can actually be only string +and nothing else) as a value of the other type: null, boolean, floating-point, +integer. `g:yaml_schema` option determines according to which schema values +will be highlighted specially. Supported schemas are + +Schema Description ~ +failsafe No additional highlighting. +json Supports JSON-style numbers, booleans and null. +core Supports more number, boolean and null styles. +pyyaml In addition to core schema supports highlighting timestamps, + but there are some differences in what is recognized as + numbers and many additional boolean values not present in core + schema. + +Default schema is `core`. + +Note that schemas are not actually limited to plain scalars, but this is the +only difference between schemas defined in YAML specification and the only +difference defined in the syntax file. + + +ZSH *zsh.vim* *ft-zsh-syntax* + +The syntax script for zsh allows for syntax-based folding: > + + :let g:zsh_fold_enable = 1 + ============================================================================== 5. Defining a syntax *:syn-define* *E410* @@ -3347,6 +3492,8 @@ DEFINING CASE *:syn-case* *E390* "ignore". Note that any items before this are not affected, and all items until the next ":syntax case" command are affected. +:sy[ntax] case + Show either "syntax case match" or "syntax case ignore" (translated). SPELL CHECKING *:syn-spell* @@ -3364,6 +3511,37 @@ SPELL CHECKING *:syn-spell* To activate spell checking the 'spell' option must be set. +:sy[ntax] spell + Show either "syntax spell toplevel", "syntax spell notoplevel" or + "syntax spell default" (translated). + + +SYNTAX ISKEYWORD SETTING *:syn-iskeyword* + +:sy[ntax] iskeyword [clear | {option}] + This defines the keyword characters. It's like the 'iskeyword' option + for but only applies to syntax highlighting. + + clear: Syntax specific iskeyword setting is disabled and the + buffer-local 'iskeyword' setting is used. + {option} Set the syntax 'iskeyword' option to a new value. + + Example: > + :syntax iskeyword @,48-57,192-255,$,_ +< + This would set the syntax specific iskeyword option to include all + alphabetic characters, plus the numeric characters, all accented + characters and also includes the "_" and the "$". + + If no argument is given, the current value will be output. + + Setting this option influences what |/\k| matches in syntax patterns + and also determines where |:syn-keyword| will be checked for a new + match. + + It is recommended when writing syntax files, to use this command to + set the correct value for the specific syntax language and not change + the 'iskeyword' option. DEFINING KEYWORDS *:syn-keyword* @@ -3384,7 +3562,7 @@ DEFINING KEYWORDS *:syn-keyword* :syntax keyword Type contained int long char :syntax keyword Type int long contained char :syntax keyword Type int long char contained -< *E789* +< *E789* *E890* When you have a keyword with an optional tail, like Ex commands in Vim, you can put the optional characters inside [], to define all the variations at once: > @@ -3395,6 +3573,7 @@ DEFINING KEYWORDS *:syn-keyword* isn't, the keyword will never be recognized. Multi-byte characters can also be used. These do not have to be in 'iskeyword'. + See |:syn-iskeyword| for defining syntax specific iskeyword settings. A keyword always has higher priority than a match or region, the keyword is used if more than one item matches. Keywords do not nest @@ -3419,7 +3598,11 @@ DEFINING KEYWORDS *:syn-keyword* DEFINING MATCHES *:syn-match* -:sy[ntax] match {group-name} [{options}] [excludenl] {pattern} [{options}] +:sy[ntax] match {group-name} [{options}] + [excludenl] + [keepend] + {pattern} + [{options}] This defines one match. @@ -3428,6 +3611,9 @@ DEFINING MATCHES *:syn-match* [excludenl] Don't make a pattern with the end-of-line "$" extend a containing match or region. Must be given before the pattern. |:syn-excludenl| + keepend Don't allow contained matches to go past a + match with the end pattern. See + |:syn-keepend|. {pattern} The search pattern that defines the match. See |:syn-pattern| below. Note that the pattern may match more than one @@ -3638,6 +3824,7 @@ Whether or not it is actually concealed depends on the value of the 'conceallevel' option. The 'concealcursor' option is used to decide whether concealable items in the current line are displayed unconcealed to be able to edit the line. +Another way to conceal text is with |matchadd()|. concealends *:syn-concealends* @@ -3775,7 +3962,7 @@ The 'foldnestmax' option limits the nesting of syntax folds. *:syn-contains* *E405* *E406* *E407* *E408* *E409* -contains={groupname},.. +contains={group-name},.. The "contains" argument is followed by a list of syntax group names. These groups will be allowed to begin inside the item (they may extend past the @@ -3828,13 +4015,13 @@ region where contained items do match. Note that this may also limit the area that is highlighted -containedin={groupname}... *:syn-containedin* +containedin={group-name}... *:syn-containedin* The "containedin" argument is followed by a list of syntax group names. The item will be allowed to begin inside these groups. This works as if the containing item has a "contains=" argument that includes this item. -The {groupname}... can be used just like for "contains", as explained above. +The {group-name}... can be used just like for "contains", as explained above. This is useful when adding a syntax item afterwards. An item can be told to be included inside an already existing item, without changing the definition @@ -3850,7 +4037,7 @@ keywords never contain another item, thus adding them to "containedin" won't work. -nextgroup={groupname},.. *:syn-nextgroup* +nextgroup={group-name},.. *:syn-nextgroup* The "nextgroup" argument is followed by a list of syntax group names, separated by commas (just like with "contains", so you can also use patterns). @@ -3922,6 +4109,9 @@ IMPLICIT CONCEAL *:syn-conceal-implicit* off" returns to the normal state where the "conceal" flag must be given explicitly. +:sy[ntax] conceal + Show either "syntax conceal on" or "syntax conceal off" (translated). + ============================================================================== 7. Syntax patterns *:syn-pattern* *E401* *E402* @@ -4084,7 +4274,7 @@ example, for instance, can be done like this: > As can be seen here, the \z actually does double duty. In the start pattern, it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it -changes the \1 back-reference into an external reference referring to the +changes the \z1 back-reference into an external reference referring to the first external sub-expression in the start pattern. External references can also be used in skip patterns: > :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1" @@ -4219,7 +4409,7 @@ If the "maxlines={N}" argument is given, the number of lines that are searched for a comment or syncing pattern is restricted to N lines backwards (after adding "minlines"). This is useful if you have few things to sync on and a slow machine. Example: > - :syntax sync ccomment maxlines=500 + :syntax sync maxlines=500 ccomment < *:syn-sync-linebreaks* When using a pattern that matches multiple lines, a change in one line may @@ -4425,11 +4615,20 @@ in their own color. :colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath' for the file "colors/{name}.vim". The first one that is found is loaded. - To see the name of the currently active color scheme: > - :colo -< The name is also stored in the g:colors_name variable. + Also searches all plugins in 'packpath', first below + "start" and then under "opt". + Doesn't work recursively, thus you can't use ":colorscheme" in a color scheme script. + + To customize a colorscheme use another name, e.g. + "~/.vim/colors/mine.vim", and use `:runtime` to load + the original colorscheme: > + runtime colors/evening.vim + hi Statement ctermfg=Blue guifg=Blue + +< Before the color scheme will be loaded the + |ColorSchemePre| autocommand event is triggered. After the color scheme has been loaded the |ColorScheme| autocommand event is triggered. For info about writing a colorscheme file: > @@ -4498,23 +4697,26 @@ the same syntax file on all terminals, and use the optimal highlighting. *bold* *underline* *undercurl* *inverse* *italic* *standout* + *nocombine* *strikethrough* term={attr-list} *attr-list* *highlight-term* *E418* attr-list is a comma separated list (without spaces) of the following items (in any order): bold underline undercurl not always available + strikethrough not always available reverse inverse same as reverse italic standout + nocombine override attributes instead of combining them NONE no attributes used (used to reset it) Note that "bold" can be used here and by using a bold font. They have the same effect. "undercurl" is a curly underline. When "undercurl" is not possible - then "underline" is used. In general "undercurl" is only available in - the GUI. The color is set with |highlight-guisp|. + then "underline" is used. In general "undercurl" and "strikethrough" + is only available in the GUI. The color is set with |highlight-guisp|. start={term-list} *highlight-start* *E422* stop={term-list} *term-list* *highlight-stop* @@ -4613,16 +4815,19 @@ ctermbg={color-nr} *highlight-ctermbg* Note that for some color terminals these names may result in the wrong colors! + You can also use "NONE" to remove the color. + *:hi-normal-cterm* When setting the "ctermfg" or "ctermbg" colors for the Normal group, these will become the colors used for the non-highlighted text. Example: > :highlight Normal ctermfg=grey ctermbg=darkblue < When setting the "ctermbg" color for the Normal group, the - 'background' option will be adjusted automatically. This causes the - highlight groups that depend on 'background' to change! This means - you should set the colors for Normal first, before setting other - colors. + 'background' option will be adjusted automatically, under the + condition that the color is recognized and 'background' was not set + explicitly. This causes the highlight groups that depend on + 'background' to change! This means you should set the colors for + Normal first, before setting other colors. When a colorscheme is being used, changing 'background' causes it to be reloaded, which may reset all colors (including Normal). First delete the "g:colors_name" variable when you don't want this. @@ -4667,12 +4872,17 @@ font={font-name} *highlight-font* All fonts used, except for Menu and Tooltip, should be of the same character size as the default font! Otherwise redrawing problems will occur. + To use a font name with an embedded space or other special character, + put it in single quotes. The single quote cannot be used then. + Example: > + :hi comment font='Monospace 10' guifg={color-name} *highlight-guifg* guibg={color-name} *highlight-guibg* guisp={color-name} *highlight-guisp* These give the foreground (guifg), background (guibg) and special - (guisp) color to use in the GUI. "guisp" is used for undercurl. + (guisp) color to use in the GUI. "guisp" is used for undercurl and + strikethrough. There are a few special names: NONE no color (transparent) bg use normal background color @@ -4697,7 +4907,7 @@ guisp={color-name} *highlight-guisp* Orange Purple Violet In the Win32 and MacVim GUI versions, additional system colors are - available. See |win32-colors| and |macvim-colors| respectively. + available. See |win32-colors| and |macvim-colors|. You can also specify a color by its Red, Green and Blue values. The format is "#rrggbb", where @@ -4737,6 +4947,9 @@ DiffChange diff mode: Changed line |diff.txt| DiffDelete diff mode: Deleted line |diff.txt| *hl-DiffText* DiffText diff mode: Changed text within a changed line |diff.txt| + *hl-EndOfBuffer* +EndOfBuffer filler lines (~) after the last line in the buffer. + By default, this is highlighted like |hl-NonText|. *hl-ErrorMsg* ErrorMsg error messages on the command line *hl-VertSplit* @@ -4765,10 +4978,10 @@ ModeMsg 'showmode' message (e.g., "-- INSERT --") *hl-MoreMsg* MoreMsg |more-prompt| *hl-NonText* -NonText '~' and '@' at the end of the window, characters from - 'showbreak' and other characters that do not really exist in - the text (e.g., ">" displayed when a double-wide character - doesn't fit at the end of the line). +NonText '@' at the end of the window, characters from 'showbreak' + and other characters that do not really exist in the text + (e.g., ">" displayed when a double-wide character doesn't + fit at the end of the line). *hl-Normal* Normal normal text *hl-Pmenu* @@ -4781,10 +4994,11 @@ PmenuSbar Popup menu: scrollbar. PmenuThumb Popup menu: Thumb of the scrollbar. *hl-Question* Question |hit-enter| prompt and yes/no questions + *hl-QuickFixLine* +QuickFixLine Current |quickfix| item in the quickfix window. *hl-Search* Search Last search pattern highlighting (see 'hlsearch'). - Also used for highlighting the current line in the quickfix - window and similar items that need to stand out. + Also used for similar items that need to stand out. *hl-SpecialKey* SpecialKey Meta and special keys listed with ":map", also for text used to show unprintable characters in the text, 'listchars'. @@ -4810,12 +5024,19 @@ StatusLine status line of current window StatusLineNC status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + *hl-StatusLineTerm* +StatusLineTerm status line of current window, if it is a |terminal| window. + *hl-StatusLineTermNC* +StatusLineTermNC status lines of not-current windows that is a |terminal| + window. *hl-TabLine* TabLine tab pages line, not active tab page label *hl-TabLineFill* TabLineFill tab pages line, where there are no labels *hl-TabLineSel* TabLineSel tab pages line, active tab page label + *hl-Terminal* +Terminal |terminal| window (see |terminal-size-color|) *hl-Title* Title titles for output from ":set all", ":autocmd" etc. *hl-Visual* @@ -4936,6 +5157,9 @@ defaults back: > :syntax reset +It is a bit of a wrong name, since it does not reset any syntax items, it only +affects the highlighting. + This doesn't change the colors for the 'highlight' option. Note that the syntax colors that you set in your vimrc file will also be reset @@ -5041,6 +5265,7 @@ This will set the "w:current_syntax" variable to "foo". The value of restoring "b:current_syntax", since the syntax files do set "b:current_syntax". The value set by the syntax file is assigned to "w:current_syntax". +Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options. Once a window has its own syntax, syntax commands executed from other windows on the same buffer (including :syntax clear) have no effect. Conversely, diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 3c7ad9fe28..31fcc43564 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 7.4. Last change: 2012 Aug 08 +*tabpage.txt* For Vim version 8.1. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -58,19 +58,30 @@ clicking right of the labels. In the GUI tab pages line you can use the right mouse button to open menu. |tabline-menu|. +For the related autocommands see |tabnew-autocmd|. + :[count]tabe[dit] *:tabe* *:tabedit* *:tabnew* :[count]tabnew Open a new tab page with an empty window, after the current - tab page. For [count] see |:tab| below. + tab page. 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. > + :tabnew " opens tabpage after the current one + :.tabnew " as above + :+tabnew " opens tabpage after the next tab page + " note: it is one further than :tabnew + :-tabnew " opens tabpage before the current one + :0tabnew " opens tabpage before the first one + :$tabnew " opens tabpage after the last one :[count]tabe[dit] [++opt] [+cmd] {file} :[count]tabnew [++opt] [+cmd] {file} Open a new tab page and edit {file}, like with |:edit|. - For [count] see |:tab| below. + For [count] see |:tabnew| above. :[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind* Open a new tab page and edit {file} in 'path', like with - |:find|. For [count] see |:tab| below. + |:find|. For [count] see |:tabnew| above. {not available when the |+file_in_path| feature was disabled at compile time} @@ -78,14 +89,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|. @@ -110,12 +128,22 @@ something else. - When 'hidden' is not set, [!] is not used, a buffer has changes, and there is no other window on this buffer. Changes to the buffer are not written and won't get lost, so - this is a "safe" command. + this is a "safe" command. > + :tabclose " close the current tab page +:{count}tabc[lose][!] :tabc[lose][!] {count} Close tab page {count}. Fails in the same way as `:tabclose` - above. - + above. > + :-tabclose " close the previous tab page + :+tabclose " close the next tab page + :1tabclose " close the first tab page + :$tabclose " close the last tab page + :tabclose -2 " close the two previous tab page + :tabclose + " close the next tab page + :tabclose 3 " close the third tab page + :tabclose $ " close the last tab page +< *:tabo* *:tabonly* :tabo[nly][!] Close all other tab pages. When the 'hidden' option is set, all buffers in closed windows @@ -124,7 +152,25 @@ something else. modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is given, then they become hidden. But modified buffers are - never abandoned, so changes cannot get lost. + never abandoned, so changes cannot get lost. > + :tabonly " close all tab pages except the current + " one + +:{count}tabo[nly][!] +:tabo[nly][!] {count} + Close all tab pages except {count} 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 + :$tabonly " close all tab pages except the last one + :tabonly - " close all tab pages except the previous + " one + :tabonly +2 " close all tab pages except the two next + " one + :tabonly 1 " close all tab pages except the first one + :tabonly $ " close all tab pages except the last one SWITCHING TO ANOTHER TAB PAGE: @@ -139,7 +185,20 @@ gt *i_CTRL-<PageDown>* *i_<C-PageDown>* Go to the next tab page. Wraps around from the last to the first one. +:{count}tabn[ext] :tabn[ext] {count} + Go to tab page {count}. The first tab page has number one. > + :-tabnext " go to the previous tab page + :+tabnext " go to the next tab page + :+2tabnext " go to the two next tab page + :1tabnext " go to the first tab page + :$tabnext " go to the last tab page + :tabnext $ " as above + :tabnext - " go to the previous tab page + :tabnext -1 " as above + :tabnext + " go to the next tab page + :tabnext +1 " as above + {count}<C-PageDown> {count}gt Go to tab page {count}. The first tab page has number one. @@ -154,7 +213,8 @@ gT Go to the previous tab page. Wraps around from the first one :tabN[ext] {count} {count}<C-PageUp> {count}gT Go {count} tab pages back. Wraps around from the first one - to the last one. + to the last one. Note that the use of {count} is different + from |:tabnext|, where it is used as the tab page number. :tabr[ewind] *:tabfir* *:tabfirst* *:tabr* *:tabrewind* :tabfir[st] Go to the first tab page. @@ -168,6 +228,12 @@ Other commands: :tabs List the tab pages and the windows they contain. Shows a ">" for the current window. Shows a "+" for modified buffers. + For example: + Tab page 1 ~ + + tabpage.txt ~ + ex_docmd.c ~ + Tab page 2 ~ + > main.c ~ REORDERING TAB PAGES: @@ -176,23 +242,39 @@ REORDERING TAB PAGES: :[N]tabm[ove] Move the current tab page to after tab page N. Use zero to make the current tab page the first one. Without N the tab - page is made the last one. + page is made the last one. > + :.tabmove " do nothing + :-tabmove " move the tab page to the left + :+tabmove " move the tab page to the right + :0tabmove " move the tab page to the beginning of the tab + " list + :tabmove 0 " as above + :tabmove " move the tab page to the last + :$tabmove " as above + :tabmove $ " as above :tabm[ove] +[N] :tabm[ove] -[N] Move the current tab page N places to the right (with +) or to - the left (with -). + the left (with -). > + :tabmove - " move the tab page to the left + :tabmove -1 " as above + :tabmove + " move the tab page to the right + :tabmove +1 " as above + Note that although it is possible to move a tab behind the N-th one by using -:Ntabmove, it is impossible to move it by N places by using :+Ntabmove. For -clarification what +N means in this context see |[range]|. +:Ntabmove. And move it by N places by using :+Ntabmove. For clarification what ++N means in this context see |[range]|. LOOPING OVER TAB PAGES: *:tabd* *:tabdo* -:tabd[o] {cmd} Execute {cmd} in each tab page. - It works like doing this: > +:[range]tabd[o] {cmd} + Execute {cmd} in each tab page or if [range] is given only in + tab pages which tab page number is in the [range]. It works + like doing this: > :tabfirst :{cmd} :tabnext @@ -205,9 +287,9 @@ LOOPING OVER TAB PAGES: current tab page. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close tab pages or reorder them. - {not in Vi} {not available when compiled without the - |+listcmds| feature} - Also see |:windo|, |:argdo| and |:bufdo|. + {not in Vi} + Also see |:windo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| + and |:lfdo| ============================================================================== 3. Other items *tab-page-other* @@ -231,6 +313,7 @@ Variables local to a tab page start with "t:". |tabpage-variable| Currently there is only one option local to a tab page: 'cmdheight'. + *tabnew-autocmd* The TabLeave and TabEnter autocommand events can be used to do something when switching from one tab page to another. The exact order depends on what you are doing. When creating a new tab page this works as if you create a new @@ -238,8 +321,8 @@ window on the same buffer and then edit another buffer. Thus ":tabnew" triggers: WinLeave leave current window TabLeave leave current tab page - TabEnter enter new tab page WinEnter enter window in new tab page + TabEnter enter new tab page BufLeave leave current buffer BufEnter enter new empty buffer diff --git a/runtime/doc/tags b/runtime/doc/tags index c2deea1504..3cbafc3160 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4,11 +4,13 @@ $ motion.txt /*$* $HOME options.txt /*$HOME* $HOME-use version5.txt /*$HOME-use* +$HOME-windows options.txt /*$HOME-windows* $MYGVIMRC gui.txt /*$MYGVIMRC* $MYVIMRC starting.txt /*$MYVIMRC* $VIM starting.txt /*$VIM* $VIM-use version5.txt /*$VIM-use* $VIMRUNTIME starting.txt /*$VIMRUNTIME* +$VIM_POSIX vi_diff.txt /*$VIM_POSIX* % motion.txt /*%* %:. cmdline.txt /*%:.* %:8 cmdline.txt /*%:8* @@ -72,11 +74,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'backupskip' options.txt /*'backupskip'* 'balloondelay' options.txt /*'balloondelay'* 'ballooneval' options.txt /*'ballooneval'* +'balloonevalterm' options.txt /*'balloonevalterm'* 'balloonexpr' options.txt /*'balloonexpr'* 'bdir' options.txt /*'bdir'* 'bdlay' options.txt /*'bdlay'* 'beautify' vi_diff.txt /*'beautify'* +'belloff' options.txt /*'belloff'* 'beval' options.txt /*'beval'* +'bevalterm' options.txt /*'bevalterm'* 'bex' options.txt /*'bex'* 'bexpr' options.txt /*'bexpr'* 'bf' vi_diff.txt /*'bf'* @@ -89,6 +94,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'bk' options.txt /*'bk'* 'bkc' options.txt /*'bkc'* 'bl' options.txt /*'bl'* +'blur' options.txt /*'blur'* +'blurradius' options.txt /*'blurradius'* +'bo' options.txt /*'bo'* 'bomb' options.txt /*'bomb'* 'breakat' options.txt /*'breakat'* 'breakindent' options.txt /*'breakindent'* @@ -136,6 +144,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'cole' options.txt /*'cole'* 'colorcolumn' options.txt /*'colorcolumn'* 'columns' options.txt /*'columns'* +'columnspace' options.txt /*'columnspace'* 'com' options.txt /*'com'* 'comments' options.txt /*'comments'* 'commentstring' options.txt /*'commentstring'* @@ -163,6 +172,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'cscopetag' options.txt /*'cscopetag'* 'cscopetagorder' options.txt /*'cscopetagorder'* 'cscopeverbose' options.txt /*'cscopeverbose'* +'csp' options.txt /*'csp'* 'cspc' options.txt /*'cspc'* 'csprg' options.txt /*'csprg'* 'csqf' options.txt /*'csqf'* @@ -204,6 +214,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'efm' options.txt /*'efm'* 'ei' options.txt /*'ei'* 'ek' options.txt /*'ek'* +'emo' options.txt /*'emo'* +'emoji' options.txt /*'emoji'* 'enc' options.txt /*'enc'* 'encoding' options.txt /*'encoding'* 'endofline' options.txt /*'endofline'* @@ -246,6 +258,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'fileignorecase' options.txt /*'fileignorecase'* 'filetype' options.txt /*'filetype'* 'fillchars' options.txt /*'fillchars'* +'fixendofline' options.txt /*'fixendofline'* +'fixeol' options.txt /*'fixeol'* 'fk' options.txt /*'fk'* 'fkmap' options.txt /*'fkmap'* 'fl' vi_diff.txt /*'fl'* @@ -288,6 +302,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'gfw' options.txt /*'gfw'* 'ghr' options.txt /*'ghr'* 'go' options.txt /*'go'* +'go-!' options.txt /*'go-!'* 'go-A' options.txt /*'go-A'* 'go-F' options.txt /*'go-F'* 'go-L' options.txt /*'go-L'* @@ -303,6 +318,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'go-g' options.txt /*'go-g'* 'go-h' options.txt /*'go-h'* 'go-i' options.txt /*'go-i'* +'go-k' options.txt /*'go-k'* 'go-l' options.txt /*'go-l'* 'go-m' options.txt /*'go-m'* 'go-p' options.txt /*'go-p'* @@ -363,7 +379,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'ims' options.txt /*'ims'* 'imsearch' options.txt /*'imsearch'* 'imsf' options.txt /*'imsf'* +'imst' options.txt /*'imst'* 'imstatusfunc' options.txt /*'imstatusfunc'* +'imstyle' options.txt /*'imstyle'* 'inc' options.txt /*'inc'* 'include' options.txt /*'include'* 'includeexpr' options.txt /*'includeexpr'* @@ -396,6 +414,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'kp' options.txt /*'kp'* 'langmap' options.txt /*'langmap'* 'langmenu' options.txt /*'langmenu'* +'langnoremap' options.txt /*'langnoremap'* +'langremap' options.txt /*'langremap'* 'laststatus' options.txt /*'laststatus'* 'lazyredraw' options.txt /*'lazyredraw'* 'lbr' options.txt /*'lbr'* @@ -409,17 +429,23 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'listchars' options.txt /*'listchars'* 'lm' options.txt /*'lm'* 'lmap' options.txt /*'lmap'* +'lnr' options.txt /*'lnr'* 'loadplugins' options.txt /*'loadplugins'* 'lpl' options.txt /*'lpl'* +'lrm' options.txt /*'lrm'* 'ls' options.txt /*'ls'* 'lsp' options.txt /*'lsp'* +'luadll' options.txt /*'luadll'* 'lw' options.txt /*'lw'* 'lz' options.txt /*'lz'* 'ma' options.txt /*'ma'* 'macatsui' options.txt /*'macatsui'* +'macligatures' options.txt /*'macligatures'* 'macmeta' options.txt /*'macmeta'* +'macthinstrokes' options.txt /*'macthinstrokes'* 'magic' options.txt /*'magic'* 'makeef' options.txt /*'makeef'* +'makeencoding' options.txt /*'makeencoding'* 'makeprg' options.txt /*'makeprg'* 'mat' options.txt /*'mat'* 'matchpairs' options.txt /*'matchpairs'* @@ -432,6 +458,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'maxmemtot' options.txt /*'maxmemtot'* 'mco' options.txt /*'mco'* 'mef' options.txt /*'mef'* +'menc' options.txt /*'menc'* 'menuitems' options.txt /*'menuitems'* 'mesg' vi_diff.txt /*'mesg'* 'mfd' options.txt /*'mfd'* @@ -466,6 +493,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'msm' options.txt /*'msm'* 'mzq' options.txt /*'mzq'* 'mzquantum' options.txt /*'mzquantum'* +'mzschemedll' options.txt /*'mzschemedll'* +'mzschemegcdll' options.txt /*'mzschemegcdll'* 'nf' options.txt /*'nf'* 'noacd' options.txt /*'noacd'* 'noai' options.txt /*'noai'* @@ -491,7 +520,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'noawa' options.txt /*'noawa'* 'nobackup' options.txt /*'nobackup'* 'noballooneval' options.txt /*'noballooneval'* +'noballoonevalterm' options.txt /*'noballoonevalterm'* 'nobeval' options.txt /*'nobeval'* +'nobevalterm' options.txt /*'nobevalterm'* 'nobin' options.txt /*'nobin'* 'nobinary' options.txt /*'nobinary'* 'nobiosk' options.txt /*'nobiosk'* @@ -499,6 +530,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'nobk' options.txt /*'nobk'* 'nobl' options.txt /*'nobl'* 'nobomb' options.txt /*'nobomb'* +'nobreakindent' options.txt /*'nobreakindent'* +'nobri' options.txt /*'nobri'* 'nobuflisted' options.txt /*'nobuflisted'* 'nocf' options.txt /*'nocf'* 'noci' options.txt /*'noci'* @@ -532,6 +565,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'noed' options.txt /*'noed'* 'noedcompatible' options.txt /*'noedcompatible'* 'noek' options.txt /*'noek'* +'noemo' options.txt /*'noemo'* +'noemoji' options.txt /*'noemoji'* 'noendofline' options.txt /*'noendofline'* 'noeol' options.txt /*'noeol'* 'noequalalways' options.txt /*'noequalalways'* @@ -544,6 +579,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'nofen' options.txt /*'nofen'* 'nofic' options.txt /*'nofic'* 'nofileignorecase' options.txt /*'nofileignorecase'* +'nofixendofline' options.txt /*'nofixendofline'* +'nofixeol' options.txt /*'nofixeol'* 'nofk' options.txt /*'nofk'* 'nofkmap' options.txt /*'nofkmap'* 'nofoldenable' options.txt /*'nofoldenable'* @@ -577,17 +614,23 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'nois' options.txt /*'nois'* 'nojoinspaces' options.txt /*'nojoinspaces'* 'nojs' options.txt /*'nojs'* +'nolangnoremap' options.txt /*'nolangnoremap'* +'nolangremap' options.txt /*'nolangremap'* 'nolazyredraw' options.txt /*'nolazyredraw'* 'nolbr' options.txt /*'nolbr'* 'nolinebreak' options.txt /*'nolinebreak'* 'nolisp' options.txt /*'nolisp'* 'nolist' options.txt /*'nolist'* +'nolnr' options.txt /*'nolnr'* 'noloadplugins' options.txt /*'noloadplugins'* 'nolpl' options.txt /*'nolpl'* +'nolrm' options.txt /*'nolrm'* 'nolz' options.txt /*'nolz'* 'noma' options.txt /*'noma'* 'nomacatsui' options.txt /*'nomacatsui'* +'nomacligatures' options.txt /*'nomacligatures'* 'nomacmeta' options.txt /*'nomacmeta'* +'nomacthinstrokes' options.txt /*'nomacthinstrokes'* 'nomagic' options.txt /*'nomagic'* 'nomh' options.txt /*'nomh'* 'noml' options.txt /*'noml'* @@ -722,6 +765,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'option' intro.txt /*'option'* 'osfiletype' options.txt /*'osfiletype'* 'pa' options.txt /*'pa'* +'packpath' options.txt /*'packpath'* 'para' options.txt /*'para'* 'paragraphs' options.txt /*'paragraphs'* 'paste' options.txt /*'paste'* @@ -731,6 +775,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'path' options.txt /*'path'* 'pdev' options.txt /*'pdev'* 'penc' options.txt /*'penc'* +'perldll' options.txt /*'perldll'* 'pex' options.txt /*'pex'* 'pexpr' options.txt /*'pexpr'* 'pfn' options.txt /*'pfn'* @@ -741,6 +786,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'pmbcs' options.txt /*'pmbcs'* 'pmbfn' options.txt /*'pmbfn'* 'popt' options.txt /*'popt'* +'pp' options.txt /*'pp'* 'preserveindent' options.txt /*'preserveindent'* 'previewheight' options.txt /*'previewheight'* 'previewwindow' options.txt /*'previewwindow'* @@ -755,8 +801,16 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'prompt' options.txt /*'prompt'* 'pt' options.txt /*'pt'* 'pumheight' options.txt /*'pumheight'* +'pumwidth' options.txt /*'pumwidth'* 'pvh' options.txt /*'pvh'* 'pvw' options.txt /*'pvw'* +'pw' options.txt /*'pw'* +'pythondll' options.txt /*'pythondll'* +'pythonhome' options.txt /*'pythonhome'* +'pythonthreedll' options.txt /*'pythonthreedll'* +'pythonthreehome' options.txt /*'pythonthreehome'* +'pyx' options.txt /*'pyx'* +'pyxversion' options.txt /*'pyxversion'* 'qe' options.txt /*'qe'* 'quote motion.txt /*'quote* 'quoteescape' options.txt /*'quoteescape'* @@ -768,6 +822,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'regexpengine' options.txt /*'regexpengine'* 'relativenumber' options.txt /*'relativenumber'* 'remap' options.txt /*'remap'* +'renderoptions' options.txt /*'renderoptions'* 'report' options.txt /*'report'* 'restorescreen' options.txt /*'restorescreen'* 'revins' options.txt /*'revins'* @@ -778,9 +833,11 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'rlc' options.txt /*'rlc'* 'rnu' options.txt /*'rnu'* 'ro' options.txt /*'ro'* +'rop' options.txt /*'rop'* 'rs' options.txt /*'rs'* 'rtp' options.txt /*'rtp'* 'ru' options.txt /*'ru'* +'rubydll' options.txt /*'rubydll'* 'ruf' options.txt /*'ruf'* 'ruler' options.txt /*'ruler'* 'rulerformat' options.txt /*'rulerformat'* @@ -790,6 +847,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'sbr' options.txt /*'sbr'* 'sc' options.txt /*'sc'* 'scb' options.txt /*'scb'* +'scl' options.txt /*'scl'* 'scr' options.txt /*'scr'* 'scroll' options.txt /*'scroll'* 'scrollbind' options.txt /*'scrollbind'* @@ -832,6 +890,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'si' options.txt /*'si'* 'sidescroll' options.txt /*'sidescroll'* 'sidescrolloff' options.txt /*'sidescrolloff'* +'signcolumn' options.txt /*'signcolumn'* 'siso' options.txt /*'siso'* 'sj' options.txt /*'sj'* 'slm' options.txt /*'slm'* @@ -895,16 +954,21 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 't_%1' term.txt /*'t_%1'* 't_%i' term.txt /*'t_%i'* 't_&8' term.txt /*'t_&8'* +'t_8b' term.txt /*'t_8b'* +'t_8f' term.txt /*'t_8f'* 't_@7' term.txt /*'t_@7'* 't_AB' term.txt /*'t_AB'* 't_AF' term.txt /*'t_AF'* 't_AL' term.txt /*'t_AL'* +'t_BD' term.txt /*'t_BD'* +'t_BE' term.txt /*'t_BE'* 't_CS' term.txt /*'t_CS'* 't_CV' term.txt /*'t_CV'* 't_Ce' term.txt /*'t_Ce'* 't_Co' term.txt /*'t_Co'* 't_Cs' term.txt /*'t_Cs'* 't_DL' term.txt /*'t_DL'* +'t_EC' term.txt /*'t_EC'* 't_EI' term.txt /*'t_EI'* 't_F1' term.txt /*'t_F1'* 't_F2' term.txt /*'t_F2'* @@ -915,6 +979,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 't_F7' term.txt /*'t_F7'* 't_F8' term.txt /*'t_F8'* 't_F9' term.txt /*'t_F9'* +'t_GP' term.txt /*'t_GP'* 't_IE' term.txt /*'t_IE'* 't_IS' term.txt /*'t_IS'* 't_K1' term.txt /*'t_K1'* @@ -937,11 +1002,23 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 't_KJ' term.txt /*'t_KJ'* 't_KK' term.txt /*'t_KK'* 't_KL' term.txt /*'t_KL'* +'t_PE' term.txt /*'t_PE'* +'t_PS' term.txt /*'t_PS'* +'t_RB' term.txt /*'t_RB'* +'t_RC' term.txt /*'t_RC'* +'t_RF' term.txt /*'t_RF'* 't_RI' term.txt /*'t_RI'* +'t_RS' term.txt /*'t_RS'* 't_RV' term.txt /*'t_RV'* +'t_SC' term.txt /*'t_SC'* +'t_SH' term.txt /*'t_SH'* 't_SI' term.txt /*'t_SI'* +'t_SR' term.txt /*'t_SR'* 't_Sb' term.txt /*'t_Sb'* 't_Sf' term.txt /*'t_Sf'* +'t_Te' term.txt /*'t_Te'* +'t_Ts' term.txt /*'t_Ts'* +'t_VS' term.txt /*'t_VS'* 't_WP' term.txt /*'t_WP'* 't_WS' term.txt /*'t_WS'* 't_ZH' term.txt /*'t_ZH'* @@ -1003,6 +1080,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 't_ve' term.txt /*'t_ve'* 't_vi' term.txt /*'t_vi'* 't_vs' term.txt /*'t_vs'* +'t_xn' term.txt /*'t_xn'* 't_xs' term.txt /*'t_xs'* 'ta' options.txt /*'ta'* 'tabline' options.txt /*'tabline'* @@ -1010,6 +1088,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'tabstop' options.txt /*'tabstop'* 'tag' options.txt /*'tag'* 'tagbsearch' options.txt /*'tagbsearch'* +'tagcase' options.txt /*'tagcase'* 'taglength' options.txt /*'taglength'* 'tagrelative' options.txt /*'tagrelative'* 'tags' options.txt /*'tags'* @@ -1020,15 +1099,22 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'tbidi' options.txt /*'tbidi'* 'tbis' options.txt /*'tbis'* 'tbs' options.txt /*'tbs'* +'tc' options.txt /*'tc'* +'tcldll' options.txt /*'tcldll'* 'tenc' options.txt /*'tenc'* 'term' options.txt /*'term'* 'termbidi' options.txt /*'termbidi'* 'termencoding' options.txt /*'termencoding'* +'termguicolors' options.txt /*'termguicolors'* +'termwinkey' options.txt /*'termwinkey'* +'termwinscroll' options.txt /*'termwinscroll'* +'termwinsize' options.txt /*'termwinsize'* 'terse' options.txt /*'terse'* 'textauto' options.txt /*'textauto'* 'textmode' options.txt /*'textmode'* 'textwidth' options.txt /*'textwidth'* 'tf' options.txt /*'tf'* +'tgc' options.txt /*'tgc'* 'tgst' options.txt /*'tgst'* 'thesaurus' options.txt /*'thesaurus'* 'tildeop' options.txt /*'tildeop'* @@ -1062,6 +1148,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'ttyscroll' options.txt /*'ttyscroll'* 'ttytype' options.txt /*'ttytype'* 'tw' options.txt /*'tw'* +'twk' options.txt /*'twk'* +'tws' options.txt /*'tws'* +'twsl' options.txt /*'twsl'* 'tx' options.txt /*'tx'* 'uc' options.txt /*'uc'* 'udf' options.txt /*'udf'* @@ -1085,7 +1174,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'vi' options.txt /*'vi'* 'viewdir' options.txt /*'viewdir'* 'viewoptions' options.txt /*'viewoptions'* +'vif' options.txt /*'vif'* 'viminfo' options.txt /*'viminfo'* +'viminfofile' options.txt /*'viminfofile'* 'virtualedit' options.txt /*'virtualedit'* 'visualbell' options.txt /*'visualbell'* 'vop' options.txt /*'vop'* @@ -1122,6 +1213,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'winheight' options.txt /*'winheight'* 'winminheight' options.txt /*'winminheight'* 'winminwidth' options.txt /*'winminwidth'* +'winptydll' options.txt /*'winptydll'* 'winwidth' options.txt /*'winwidth'* 'wiv' options.txt /*'wiv'* 'wiw' options.txt /*'wiw'* @@ -1162,10 +1254,13 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +acl various.txt /*+acl* +arabic various.txt /*+arabic* +autocmd various.txt /*+autocmd* ++autoservername various.txt /*+autoservername* +balloon_eval various.txt /*+balloon_eval* ++balloon_eval_term various.txt /*+balloon_eval_term* +browse various.txt /*+browse* +builtin_terms various.txt /*+builtin_terms* +byte_offset various.txt /*+byte_offset* ++channel various.txt /*+channel* +cindent various.txt /*+cindent* +clientserver various.txt /*+clientserver* +clipboard various.txt /*+clipboard* @@ -1185,6 +1280,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +dialog_gui various.txt /*+dialog_gui* +diff various.txt /*+diff* +digraphs various.txt /*+digraphs* ++directx various.txt /*+directx* +dnd various.txt /*+dnd* +emacs_tags various.txt /*+emacs_tags* +eval various.txt /*+eval* @@ -1204,8 +1300,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +iconv various.txt /*+iconv* +iconv/dyn various.txt /*+iconv\/dyn* +insert_expand various.txt /*+insert_expand* ++job various.txt /*+job* +jumplist various.txt /*+jumplist* +keymap various.txt /*+keymap* ++lambda various.txt /*+lambda* +langmap various.txt /*+langmap* +libcall various.txt /*+libcall* +linebreak various.txt /*+linebreak* @@ -1234,8 +1332,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +mzscheme various.txt /*+mzscheme* +mzscheme/dyn various.txt /*+mzscheme\/dyn* +netbeans_intg various.txt /*+netbeans_intg* ++num64 various.txt /*+num64* +odbeditor various.txt /*+odbeditor* +ole various.txt /*+ole* ++packages various.txt /*+packages* +path_extra various.txt /*+path_extra* +perl various.txt /*+perl* +perl/dyn various.txt /*+perl\/dyn* @@ -1255,7 +1355,6 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +scrollbind various.txt /*+scrollbind* +signs various.txt /*+signs* +smartindent various.txt /*+smartindent* -+sniff various.txt /*+sniff* +startuptime various.txt /*+startuptime* +statusline various.txt /*+statusline* +sun_workshop various.txt /*+sun_workshop* @@ -1266,13 +1365,17 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +tag_old_static various.txt /*+tag_old_static* +tcl various.txt /*+tcl* +tcl/dyn various.txt /*+tcl\/dyn* ++termguicolors various.txt /*+termguicolors* ++terminal various.txt /*+terminal* +terminfo various.txt /*+terminfo* +termresponse various.txt /*+termresponse* +textobjects various.txt /*+textobjects* +tgetent various.txt /*+tgetent* ++timers various.txt /*+timers* +title various.txt /*+title* +toolbar various.txt /*+toolbar* +transparency various.txt /*+transparency* ++unix eval.txt /*+unix* +user_commands various.txt /*+user_commands* +vertsplit various.txt /*+vertsplit* +viminfo various.txt /*+viminfo* @@ -1280,6 +1383,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* +visual various.txt /*+visual* +visualextra various.txt /*+visualextra* +vreplace various.txt /*+vreplace* ++vtp various.txt /*+vtp* +wildignore various.txt /*+wildignore* +wildmenu various.txt /*+wildmenu* +windows various.txt /*+windows* @@ -1301,12 +1405,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* -+rv gui_x11.txt /*-+rv* -- starting.txt /*--* --- starting.txt /*---* +--clean starting.txt /*--clean* --cmd starting.txt /*--cmd* --echo-wid starting.txt /*--echo-wid* --help starting.txt /*--help* --literal starting.txt /*--literal* --nofork starting.txt /*--nofork* --noplugin starting.txt /*--noplugin* +--not-a-term starting.txt /*--not-a-term* --remote remote.txt /*--remote* --remote-expr remote.txt /*--remote-expr* --remote-send remote.txt /*--remote-send* @@ -1322,8 +1428,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* --servername remote.txt /*--servername* --socketid starting.txt /*--socketid* --startuptime starting.txt /*--startuptime* +--ttyfail starting.txt /*--ttyfail* --version starting.txt /*--version* --windowid starting.txt /*--windowid* +-? starting.txt /*-?* -A starting.txt /*-A* -C starting.txt /*-C* -D starting.txt /*-D* @@ -1410,6 +1518,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* .dic spell.txt /*.dic* .exrc starting.txt /*.exrc* .gvimrc gui.txt /*.gvimrc* +.netrwbook pi_netrw.txt /*.netrwbook* +.netrwhist pi_netrw.txt /*.netrwhist* .vimrc starting.txt /*.vimrc* / pattern.txt /*\/* /$ pattern.txt /*\/$* @@ -1560,6 +1670,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* /\{- pattern.txt /*\/\\{-* /\~ pattern.txt /*\/\\~* /^ pattern.txt /*\/^* +/_CTRL-G cmdline.txt /*\/_CTRL-G* +/_CTRL-L cmdline.txt /*\/_CTRL-L* +/_CTRL-T cmdline.txt /*\/_CTRL-T* /atom pattern.txt /*\/atom* /bar pattern.txt /*\/bar* /branch pattern.txt /*\/branch* @@ -1616,6 +1729,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 05.5 usr_05.txt /*05.5* 05.6 usr_05.txt /*05.6* 05.7 usr_05.txt /*05.7* +05.8 usr_05.txt /*05.8* 06.1 usr_06.txt /*06.1* 06.2 usr_06.txt /*06.2* 06.3 usr_06.txt /*06.3* @@ -1803,6 +1917,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :$ cmdline.txt /*:$* :% cmdline.txt /*:%* :& change.txt /*:&* +:&& change.txt /*:&&* :' cmdline.txt /*:'* :, cmdline.txt /*:,* :. cmdline.txt /*:.* @@ -1827,6 +1942,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :<afile> cmdline.txt /*:<afile>* :<amatch> cmdline.txt /*:<amatch>* :<cWORD> cmdline.txt /*:<cWORD>* +:<cexpr> cmdline.txt /*:<cexpr>* :<cfile> cmdline.txt /*:<cfile>* :<cword> cmdline.txt /*:<cword>* :<sfile> cmdline.txt /*:<sfile>* @@ -1842,17 +1958,28 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :AdaTagDir ft_ada.txt /*:AdaTagDir* :AdaTagFile ft_ada.txt /*:AdaTagFile* :AdaTypes ft_ada.txt /*:AdaTypes* +:Arguments terminal.txt /*:Arguments* +:Break terminal.txt /*:Break* +:Clear terminal.txt /*:Clear* :CompilerSet usr_41.txt /*:CompilerSet* +:Continue terminal.txt /*:Continue* :DiffOrig diff.txt /*:DiffOrig* :DoMatchParen pi_paren.txt /*:DoMatchParen* +:Evaluate terminal.txt /*:Evaluate* :Explore pi_netrw.txt /*:Explore* +:Finish terminal.txt /*:Finish* :GLVS pi_getscript.txt /*:GLVS* +:Gdb terminal.txt /*:Gdb* :GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat* :GnatFind ft_ada.txt /*:GnatFind* :GnatPretty ft_ada.txt /*:GnatPretty* :GnatTags ft_ada.txt /*:GnatTags* :Hexplore pi_netrw.txt /*:Hexplore* +:LP pi_logipat.txt /*:LP* +:LPE pi_logipat.txt /*:LPE* +:LPF pi_logipat.txt /*:LPF* :Lexplore pi_netrw.txt /*:Lexplore* +:LogiPat pi_logipat.txt /*:LogiPat* :Man filetype.txt /*:Man* :MkVimball pi_vimball.txt /*:MkVimball* :N editing.txt /*:N* @@ -1867,19 +1994,35 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :Ntree pi_netrw.txt /*:Ntree* :Nw pi_netrw.txt /*:Nw* :Nwrite pi_netrw.txt /*:Nwrite* +:Over terminal.txt /*:Over* :P various.txt /*:P* :Pexplore pi_netrw.txt /*:Pexplore* :Print various.txt /*:Print* +:Program terminal.txt /*:Program* :Rexplore pi_netrw.txt /*:Rexplore* :RmVimball pi_vimball.txt /*:RmVimball* +:Run terminal.txt /*:Run* +:RustEmitAsm ft_rust.txt /*:RustEmitAsm* +:RustEmitIr ft_rust.txt /*:RustEmitIr* +:RustExpand ft_rust.txt /*:RustExpand* +:RustFmt ft_rust.txt /*:RustFmt* +:RustFmtRange ft_rust.txt /*:RustFmtRange* +:RustPlay ft_rust.txt /*:RustPlay* +:RustRun ft_rust.txt /*:RustRun* :Sexplore pi_netrw.txt /*:Sexplore* +:Source terminal.txt /*:Source* +:Step terminal.txt /*:Step* +:Stop terminal.txt /*:Stop* :TOhtml syntax.txt /*:TOhtml* :TarDiff pi_tar.txt /*:TarDiff* +:Termdebug terminal.txt /*:Termdebug* +:TermdebugCommand terminal.txt /*:TermdebugCommand* :Texplore pi_netrw.txt /*:Texplore* :UseVimball pi_vimball.txt /*:UseVimball* :Vexplore pi_netrw.txt /*:Vexplore* :VimballList pi_vimball.txt /*:VimballList* :Vimuntar pi_tar.txt /*:Vimuntar* +:Winbar terminal.txt /*:Winbar* :X editing.txt /*:X* :XMLent insert.txt /*:XMLent* :XMLns insert.txt /*:XMLns* @@ -1959,6 +2102,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :bmodified windows.txt /*:bmodified* :bn windows.txt /*:bn* :bnext windows.txt /*:bnext* +:bo windows.txt /*:bo* :botright windows.txt /*:botright* :bp windows.txt /*:bp* :bprevious windows.txt /*:bprevious* @@ -2006,17 +2150,21 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :cat eval.txt /*:cat* :catch eval.txt /*:catch* :cb quickfix.txt /*:cb* +:cbo quickfix.txt /*:cbo* +:cbottom quickfix.txt /*:cbottom* :cbuffer quickfix.txt /*:cbuffer* :cc quickfix.txt /*:cc* :ccl quickfix.txt /*:ccl* :cclose quickfix.txt /*:cclose* :cd editing.txt /*:cd* :cd- editing.txt /*:cd-* +:cdo quickfix.txt /*:cdo* :ce change.txt /*:ce* :center change.txt /*:center* :cex quickfix.txt /*:cex* :cexpr quickfix.txt /*:cexpr* :cf quickfix.txt /*:cf* +:cfdo quickfix.txt /*:cfdo* :cfile quickfix.txt /*:cfile* :cfir quickfix.txt /*:cfir* :cfirst quickfix.txt /*:cfirst* @@ -2035,9 +2183,13 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :checkpath tagsrch.txt /*:checkpath* :checkt editing.txt /*:checkt* :checktime editing.txt /*:checktime* +:chi quickfix.txt /*:chi* +:chistory quickfix.txt /*:chistory* :cl quickfix.txt /*:cl* :cla quickfix.txt /*:cla* :clast quickfix.txt /*:clast* +:cle motion.txt /*:cle* +:clearjumps motion.txt /*:clearjumps* :clist quickfix.txt /*:clist* :clo windows.txt /*:clo* :close windows.txt /*:close* @@ -2069,6 +2221,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :comc map.txt /*:comc* :comclear map.txt /*:comclear* :command map.txt /*:command* +:command-addr map.txt /*:command-addr* :command-bang map.txt /*:command-bang* :command-bar map.txt /*:command-bar* :command-buffer map.txt /*:command-buffer* @@ -2126,6 +2279,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :delm motion.txt /*:delm* :delmarks motion.txt /*:delmarks* :di change.txt /*:di* +:dif diff.txt /*:dif* :diffg diff.txt /*:diffg* :diffget diff.txt /*:diffget* :diffo diff.txt /*:diffo* @@ -2138,7 +2292,6 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :diffsplit diff.txt /*:diffsplit* :difft diff.txt /*:difft* :diffthis diff.txt /*:diffthis* -:diffu diff.txt /*:diffu* :diffupdate diff.txt /*:diffupdate* :dig digraph.txt /*:dig* :digraphs digraph.txt /*:digraphs* @@ -2219,6 +2372,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :filetype-overview filetype.txt /*:filetype-overview* :filetype-plugin-off filetype.txt /*:filetype-plugin-off* :filetype-plugin-on filetype.txt /*:filetype-plugin-on* +:filt various.txt /*:filt* +:filter various.txt /*:filter* :fin editing.txt /*:fin* :fina eval.txt /*:fina* :finally eval.txt /*:finally* @@ -2242,6 +2397,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :for eval.txt /*:for* :fu eval.txt /*:fu* :func-abort eval.txt /*:func-abort* +:func-closure eval.txt /*:func-closure* :func-dict eval.txt /*:func-dict* :func-range eval.txt /*:func-range* :function eval.txt /*:function* @@ -2262,6 +2418,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :ha print.txt /*:ha* :hardcopy print.txt /*:hardcopy* :help helphelp.txt /*:help* +:helpc helphelp.txt /*:helpc* +:helpclose helphelp.txt /*:helpclose* :helpf helphelp.txt /*:helpf* :helpfind helphelp.txt /*:helpfind* :helpg helphelp.txt /*:helpg* @@ -2351,6 +2509,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :lat undo.txt /*:lat* :later undo.txt /*:later* :lb quickfix.txt /*:lb* +:lbo quickfix.txt /*:lbo* +:lbottom quickfix.txt /*:lbottom* :lbuffer quickfix.txt /*:lbuffer* :lc editing.txt /*:lc* :lcd editing.txt /*:lcd* @@ -2360,6 +2520,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :lclose quickfix.txt /*:lclose* :lcs if_cscop.txt /*:lcs* :lcscope if_cscop.txt /*:lcscope* +:ldo quickfix.txt /*:ldo* :le change.txt /*:le* :left change.txt /*:left* :lefta windows.txt /*:lefta* @@ -2378,6 +2539,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :lex quickfix.txt /*:lex* :lexpr quickfix.txt /*:lexpr* :lf quickfix.txt /*:lf* +:lfdo quickfix.txt /*:lfdo* :lfile quickfix.txt /*:lfile* :lfir quickfix.txt /*:lfir* :lfirst quickfix.txt /*:lfirst* @@ -2393,6 +2555,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :lgrepadd quickfix.txt /*:lgrepadd* :lh helphelp.txt /*:lh* :lhelpgrep helphelp.txt /*:lhelpgrep* +:lhi quickfix.txt /*:lhi* +:lhistory quickfix.txt /*:lhistory* :list various.txt /*:list* :ll quickfix.txt /*:ll* :lla quickfix.txt /*:lla* @@ -2527,7 +2691,6 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :nbkey netbeans.txt /*:nbkey* :nbstart netbeans.txt /*:nbstart* :ne editing.txt /*:ne* -:netrw-s-cr pi_netrw.txt /*:netrw-s-cr* :new windows.txt /*:new* :next editing.txt /*:next* :next_f editing.txt /*:next_f* @@ -2594,6 +2757,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :ounmenu gui.txt /*:ounmenu* :ownsyntax syntax.txt /*:ownsyntax* :p various.txt /*:p* +:pa repeat.txt /*:pa* +:packadd repeat.txt /*:packadd* +:packl repeat.txt /*:packl* +:packloadall repeat.txt /*:packloadall* :pc windows.txt /*:pc* :pclose windows.txt /*:pclose* :pe if_perl.txt /*:pe* @@ -2655,6 +2822,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :pyfile if_pyth.txt /*:pyfile* :python if_pyth.txt /*:python* :python3 if_pyth.txt /*:python3* +:pythonx if_pyth.txt /*:pythonx* +:pyx if_pyth.txt /*:pyx* +:pyxdo if_pyth.txt /*:pyxdo* +:pyxfile if_pyth.txt /*:pyxfile* :q editing.txt /*:q* :qa editing.txt /*:qa* :qall editing.txt /*:qall* @@ -2708,6 +2879,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :rviminfo starting.txt /*:rviminfo* :s change.txt /*:s* :s% change.txt /*:s%* +:sI change.txt /*:sI* +:sIc change.txt /*:sIc* +:sIe change.txt /*:sIe* +:sIg change.txt /*:sIg* +:sIl change.txt /*:sIl* +:sIn change.txt /*:sIn* +:sIp change.txt /*:sIp* +:sIr change.txt /*:sIr* :sN windows.txt /*:sN* :sNext windows.txt /*:sNext* :s\= change.txt /*:s\\=* @@ -2739,7 +2918,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sbr windows.txt /*:sbr* :sbrewind windows.txt /*:sbrewind* :sbuffer windows.txt /*:sbuffer* -:scrip repeat.txt /*:scrip* +:sc change.txt /*:sc* +:scI change.txt /*:scI* +:sce change.txt /*:sce* +:scg change.txt /*:scg* +:sci change.txt /*:sci* +:scl change.txt /*:scl* +:scp change.txt /*:scp* +:scr repeat.txt /*:scr* :scripte repeat.txt /*:scripte* :scriptencoding repeat.txt /*:scriptencoding* :scriptnames repeat.txt /*:scriptnames* @@ -2772,9 +2958,20 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sfind windows.txt /*:sfind* :sfir windows.txt /*:sfir* :sfirst windows.txt /*:sfirst* +:sg change.txt /*:sg* +:sgI change.txt /*:sgI* +:sgc change.txt /*:sgc* +:sge change.txt /*:sge* +:sgi change.txt /*:sgi* +:sgl change.txt /*:sgl* +:sgn change.txt /*:sgn* +:sgp change.txt /*:sgp* +:sgr change.txt /*:sgr* :sh various.txt /*:sh* :shell various.txt /*:shell* -:si gui_w32.txt /*:si* +:si change.txt /*:si* +:sic change.txt /*:sic* +:sie change.txt /*:sie* :sig sign.txt /*:sig* :sign sign.txt /*:sign* :sign-define sign.txt /*:sign-define* @@ -2787,7 +2984,12 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sign-unplace sign.txt /*:sign-unplace* :sil various.txt /*:sil* :silent various.txt /*:silent* +:silent! various.txt /*:silent!* +:sim gui_w32.txt /*:sim* :simalt gui_w32.txt /*:simalt* +:sin change.txt /*:sin* +:sip change.txt /*:sip* +:sir change.txt /*:sir* :sl various.txt /*:sl* :sla windows.txt /*:sla* :slast windows.txt /*:slast* @@ -2800,10 +3002,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :smapclear map.txt /*:smapclear* :sme gui.txt /*:sme* :smenu gui.txt /*:smenu* +:smile index.txt /*:smile* :sn windows.txt /*:sn* :snext windows.txt /*:snext* -:sni if_sniff.txt /*:sni* -:sniff if_sniff.txt /*:sniff* :sno change.txt /*:sno* :snomagic change.txt /*:snomagic* :snor map.txt /*:snor* @@ -2832,8 +3033,16 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :split_f windows.txt /*:split_f* :spr windows.txt /*:spr* :sprevious windows.txt /*:sprevious* +:sr change.txt /*:sr* +:srI change.txt /*:srI* +:src change.txt /*:src* :sre windows.txt /*:sre* :srewind windows.txt /*:srewind* +:srg change.txt /*:srg* +:sri change.txt /*:sri* +:srl change.txt /*:srl* +:srn change.txt /*:srn* +:srp change.txt /*:srp* :st starting.txt /*:st* :sta windows.txt /*:sta* :stag windows.txt /*:stag* @@ -2889,6 +3098,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :syn-files syntax.txt /*:syn-files* :syn-fold syntax.txt /*:syn-fold* :syn-include syntax.txt /*:syn-include* +:syn-iskeyword syntax.txt /*:syn-iskeyword* :syn-keepend syntax.txt /*:syn-keepend* :syn-keyword syntax.txt /*:syn-keyword* :syn-lc syntax.txt /*:syn-lc* @@ -2972,6 +3182,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :tclfile if_tcl.txt /*:tclfile* :te gui_w32.txt /*:te* :tearoff gui_w32.txt /*:tearoff* +:ter terminal.txt /*:ter* +:terminal terminal.txt /*:terminal* :tf tagsrch.txt /*:tf* :tfirst tagsrch.txt /*:tfirst* :th eval.txt /*:th* @@ -2981,9 +3193,16 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :tl tagsrch.txt /*:tl* :tlast tagsrch.txt /*:tlast* :tm gui.txt /*:tm* +:tma map.txt /*:tma* +:tmap map.txt /*:tmap* +:tmap_l map.txt /*:tmap_l* +:tmapc map.txt /*:tmapc* +:tmapclear map.txt /*:tmapclear* :tmenu gui.txt /*:tmenu* :tn tagsrch.txt /*:tn* :tnext tagsrch.txt /*:tnext* +:tno map.txt /*:tno* +:tnoremap map.txt /*:tnoremap* :topleft windows.txt /*:topleft* :tp tagsrch.txt /*:tp* :tprevious tagsrch.txt /*:tprevious* @@ -2993,6 +3212,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :ts tagsrch.txt /*:ts* :tselect tagsrch.txt /*:tselect* :tu gui.txt /*:tu* +:tunma map.txt /*:tunma* +:tunmap map.txt /*:tunmap* :tunmenu gui.txt /*:tunmenu* :u undo.txt /*:u* :un undo.txt /*:un* @@ -3007,6 +3228,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :unhide windows.txt /*:unhide* :unl eval.txt /*:unl* :unlet eval.txt /*:unlet* +:unlet-$ eval.txt /*:unlet-$* +:unlet-environment eval.txt /*:unlet-environment* :unlo eval.txt /*:unlo* :unlockvar eval.txt /*:unlockvar* :unm map.txt /*:unm* @@ -3150,6 +3373,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* <CSI> intro.txt /*<CSI>* <Char-> map.txt /*<Char->* <Char> map.txt /*<Char>* +<CursorHold> autocmd.txt /*<CursorHold>* <D- intro.txt /*<D-* <D-.> gui_mac.txt /*<D-.>* <D-Down> gui_mac.txt /*<D-Down>* @@ -3157,6 +3381,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* <D-Right> gui_mac.txt /*<D-Right>* <D-Up> gui_mac.txt /*<D-Up>* <D-`> gui_mac.txt /*<D-`>* +<D-c> os_mac.txt /*<D-c>* +<D-v> os_mac.txt /*<D-v>* +<D-x> os_mac.txt /*<D-x>* <Del> change.txt /*<Del>* <Down> motion.txt /*<Down>* <Drop> change.txt /*<Drop>* @@ -3267,6 +3494,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* <bang> map.txt /*<bang>* <buffer=N> autocmd.txt /*<buffer=N>* <buffer=abuf> autocmd.txt /*<buffer=abuf>* +<cexpr> cmdline.txt /*<cexpr>* <cfile> cmdline.txt /*<cfile>* <character> intro.txt /*<character>* <count> map.txt /*<count>* @@ -3294,8 +3522,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* <line1> map.txt /*<line1>* <line2> map.txt /*<line2>* <lt> intro.txt /*<lt>* +<mods> map.txt /*<mods>* <nomodeline> autocmd.txt /*<nomodeline>* <q-args> map.txt /*<q-args>* +<range> map.txt /*<range>* <reg> map.txt /*<reg>* <register> map.txt /*<register>* <sfile> cmdline.txt /*<sfile>* @@ -3321,12 +3551,18 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* == change.txt /*==* > change.txt /*>* >> change.txt /*>>* +>backtrace repeat.txt /*>backtrace* +>bt repeat.txt /*>bt* >cont repeat.txt /*>cont* +>down repeat.txt /*>down* >finish repeat.txt /*>finish* +>frame repeat.txt /*>frame* >interrupt repeat.txt /*>interrupt* >next repeat.txt /*>next* >quit repeat.txt /*>quit* >step repeat.txt /*>step* +>up repeat.txt /*>up* +>where repeat.txt /*>where* ? pattern.txt /*?* ?<CR> pattern.txt /*?<CR>* @ repeat.txt /*@* @@ -3337,6 +3573,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* @r eval.txt /*@r* A insert.txt /*A* ACL editing.txt /*ACL* +ANSI-C develop.txt /*ANSI-C* ATTENTION usr_11.txt /*ATTENTION* Abbreviations map.txt /*Abbreviations* Actions.plist gui_mac.txt /*Actions.plist* @@ -3378,6 +3615,8 @@ BufWritePre autocmd.txt /*BufWritePre* C change.txt /*C* C-editing tips.txt /*C-editing* C-indenting indent.txt /*C-indenting* +C89 develop.txt /*C89* +C99 develop.txt /*C99* COMSPEC starting.txt /*COMSPEC* CR-used-for-NL pattern.txt /*CR-used-for-NL* CTRL-6 editing.txt /*CTRL-6* @@ -3408,6 +3647,8 @@ CTRL-V-alternative gui_w32.txt /*CTRL-V-alternative* CTRL-W index.txt /*CTRL-W* CTRL-W_+ windows.txt /*CTRL-W_+* CTRL-W_- windows.txt /*CTRL-W_-* +CTRL-W_. terminal.txt /*CTRL-W_.* +CTRL-W_: windows.txt /*CTRL-W_:* CTRL-W_< windows.txt /*CTRL-W_<* CTRL-W_<BS> windows.txt /*CTRL-W_<BS>* CTRL-W_<CR> quickfix.txt /*CTRL-W_<CR>* @@ -3446,6 +3687,7 @@ CTRL-W_H windows.txt /*CTRL-W_H* CTRL-W_J windows.txt /*CTRL-W_J* CTRL-W_K windows.txt /*CTRL-W_K* CTRL-W_L windows.txt /*CTRL-W_L* +CTRL-W_N terminal.txt /*CTRL-W_N* CTRL-W_P windows.txt /*CTRL-W_P* CTRL-W_R windows.txt /*CTRL-W_R* CTRL-W_S windows.txt /*CTRL-W_S* @@ -3473,6 +3715,7 @@ CTRL-W_n windows.txt /*CTRL-W_n* CTRL-W_o windows.txt /*CTRL-W_o* CTRL-W_p windows.txt /*CTRL-W_p* CTRL-W_q windows.txt /*CTRL-W_q* +CTRL-W_quote terminal.txt /*CTRL-W_quote* CTRL-W_r windows.txt /*CTRL-W_r* CTRL-W_s windows.txt /*CTRL-W_s* CTRL-W_t windows.txt /*CTRL-W_t* @@ -3489,6 +3732,8 @@ CTRL-\_CTRL-N intro.txt /*CTRL-\\_CTRL-N* CTRL-] tagsrch.txt /*CTRL-]* CTRL-^ editing.txt /*CTRL-^* CTRL-{char} intro.txt /*CTRL-{char}* +Channel eval.txt /*Channel* +Channels eval.txt /*Channels* Chinese mbyte.txt /*Chinese* Cmd-. gui_mac.txt /*Cmd-.* Cmd-Down gui_mac.txt /*Cmd-Down* @@ -3497,11 +3742,16 @@ Cmd-Right gui_mac.txt /*Cmd-Right* Cmd-Up gui_mac.txt /*Cmd-Up* Cmd-` gui_mac.txt /*Cmd-`* Cmd-event autocmd.txt /*Cmd-event* +CmdUndefined autocmd.txt /*CmdUndefined* Cmdline cmdline.txt /*Cmdline* Cmdline-mode cmdline.txt /*Cmdline-mode* +CmdlineChanged autocmd.txt /*CmdlineChanged* +CmdlineEnter autocmd.txt /*CmdlineEnter* +CmdlineLeave autocmd.txt /*CmdlineLeave* CmdwinEnter autocmd.txt /*CmdwinEnter* CmdwinLeave autocmd.txt /*CmdwinLeave* ColorScheme autocmd.txt /*ColorScheme* +ColorSchemePre autocmd.txt /*ColorSchemePre* Colors.plist gui_mac.txt /*Colors.plist* Command-line cmdline.txt /*Command-line* Command-line-mode cmdline.txt /*Command-line-mode* @@ -3518,11 +3768,11 @@ D change.txt /*D* DOS os_dos.txt /*DOS* DOS-format editing.txt /*DOS-format* DOS-format-write editing.txt /*DOS-format-write* -DPMI os_msdos.txt /*DPMI* Dictionaries eval.txt /*Dictionaries* Dictionary eval.txt /*Dictionary* Dictionary-function eval.txt /*Dictionary-function* Digraphs digraph.txt /*Digraphs* +DirChanged autocmd.txt /*DirChanged* E motion.txt /*E* E10 message.txt /*E10* E100 diff.txt /*E100* @@ -3603,7 +3853,6 @@ E169 message.txt /*E169* E17 message.txt /*E17* E170 eval.txt /*E170* E171 eval.txt /*E171* -E172 message.txt /*E172* E173 message.txt /*E173* E174 map.txt /*E174* E175 map.txt /*E175* @@ -3711,15 +3960,9 @@ E270 if_ruby.txt /*E270* E271 if_ruby.txt /*E271* E272 if_ruby.txt /*E272* E273 if_ruby.txt /*E273* -E274 if_sniff.txt /*E274* -E275 if_sniff.txt /*E275* -E276 if_sniff.txt /*E276* E277 remote.txt /*E277* -E278 if_sniff.txt /*E278* -E279 if_sniff.txt /*E279* E28 syntax.txt /*E28* E280 if_tcl.txt /*E280* -E281 if_tcl.txt /*E281* E282 starting.txt /*E282* E283 motion.txt /*E283* E284 mbyte.txt /*E284* @@ -3804,7 +4047,6 @@ E358 options.txt /*E358* E359 term.txt /*E359* E36 windows.txt /*E36* E360 various.txt /*E360* -E362 term.txt /*E362* E363 options.txt /*E363* E364 eval.txt /*E364* E365 print.txt /*E365* @@ -3899,11 +4141,6 @@ E447 editing.txt /*E447* E448 various.txt /*E448* E449 eval.txt /*E449* E45 message.txt /*E45* -E450 os_msdos.txt /*E450* -E451 os_msdos.txt /*E451* -E452 os_msdos.txt /*E452* -E453 os_msdos.txt /*E453* -E454 os_msdos.txt /*E454* E455 print.txt /*E455* E456 print.txt /*E456* E457 print.txt /*E457* @@ -4017,7 +4254,6 @@ E556 tagsrch.txt /*E556* E557 term.txt /*E557* E558 term.txt /*E558* E559 term.txt /*E559* -E56 pattern.txt /*E56* E560 if_cscop.txt /*E560* E561 if_cscop.txt /*E561* E562 if_cscop.txt /*E562* @@ -4026,8 +4262,6 @@ E564 if_cscop.txt /*E564* E566 if_cscop.txt /*E566* E567 if_cscop.txt /*E567* E568 if_cscop.txt /*E568* -E569 if_cscop.txt /*E569* -E57 pattern.txt /*E57* E570 message.txt /*E570* E571 if_tcl.txt /*E571* E572 if_tcl.txt /*E572* @@ -4036,9 +4270,7 @@ E574 starting.txt /*E574* E575 starting.txt /*E575* E576 starting.txt /*E576* E577 starting.txt /*E577* -E578 editing.txt /*E578* E579 eval.txt /*E579* -E58 pattern.txt /*E58* E580 eval.txt /*E580* E581 eval.txt /*E581* E582 eval.txt /*E582* @@ -4092,8 +4324,8 @@ E627 netbeans.txt /*E627* E628 netbeans.txt /*E628* E629 netbeans.txt /*E629* E63 pattern.txt /*E63* -E630 netbeans.txt /*E630* -E631 netbeans.txt /*E631* +E630 channel.txt /*E630* +E631 channel.txt /*E631* E632 netbeans.txt /*E632* E633 netbeans.txt /*E633* E634 netbeans.txt /*E634* @@ -4117,8 +4349,6 @@ E65 pattern.txt /*E65* E650 netbeans.txt /*E650* E651 netbeans.txt /*E651* E652 netbeans.txt /*E652* -E653 netbeans.txt /*E653* -E654 netbeans.txt /*E654* E655 eval.txt /*E655* E656 netbeans.txt /*E656* E657 netbeans.txt /*E657* @@ -4161,7 +4391,6 @@ E69 pattern.txt /*E69* E690 eval.txt /*E690* E691 eval.txt /*E691* E692 eval.txt /*E692* -E693 eval.txt /*E693* E694 eval.txt /*E694* E695 eval.txt /*E695* E696 eval.txt /*E696* @@ -4175,7 +4404,6 @@ E702 eval.txt /*E702* E703 eval.txt /*E703* E704 eval.txt /*E704* E705 eval.txt /*E705* -E706 eval.txt /*E706* E707 eval.txt /*E707* E708 eval.txt /*E708* E709 eval.txt /*E709* @@ -4343,9 +4571,7 @@ E855 autocmd.txt /*E855* E858 eval.txt /*E858* E859 eval.txt /*E859* E86 windows.txt /*E86* -E860 eval.txt /*E860* E862 eval.txt /*E862* -E863 if_pyth.txt /*E863* E864 pattern.txt /*E864* E865 pattern.txt /*E865* E866 pattern.txt /*E866* @@ -4372,13 +4598,76 @@ E884 eval.txt /*E884* E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* +E888 pattern.txt /*E888* E89 message.txt /*E89* +E890 syntax.txt /*E890* +E891 eval.txt /*E891* +E892 eval.txt /*E892* +E893 eval.txt /*E893* +E894 eval.txt /*E894* +E895 if_mzsch.txt /*E895* +E898 channel.txt /*E898* E90 message.txt /*E90* +E901 channel.txt /*E901* +E902 channel.txt /*E902* +E903 channel.txt /*E903* +E904 channel.txt /*E904* +E905 channel.txt /*E905* +E906 channel.txt /*E906* +E907 eval.txt /*E907* +E908 eval.txt /*E908* +E909 eval.txt /*E909* E91 options.txt /*E91* +E910 eval.txt /*E910* +E911 eval.txt /*E911* +E912 eval.txt /*E912* +E913 eval.txt /*E913* +E914 eval.txt /*E914* +E915 channel.txt /*E915* +E916 eval.txt /*E916* +E917 eval.txt /*E917* +E918 channel.txt /*E918* +E919 repeat.txt /*E919* E92 message.txt /*E92* +E920 channel.txt /*E920* +E921 channel.txt /*E921* +E922 eval.txt /*E922* +E923 eval.txt /*E923* +E924 quickfix.txt /*E924* +E925 quickfix.txt /*E925* +E926 quickfix.txt /*E926* +E927 eval.txt /*E927* +E928 eval.txt /*E928* +E929 starting.txt /*E929* E93 windows.txt /*E93* +E930 eval.txt /*E930* +E931 message.txt /*E931* +E932 eval.txt /*E932* +E933 eval.txt /*E933* +E934 sign.txt /*E934* +E935 eval.txt /*E935* +E936 autocmd.txt /*E936* +E937 autocmd.txt /*E937* +E938 eval.txt /*E938* +E939 change.txt /*E939* E94 windows.txt /*E94* +E940 eval.txt /*E940* +E941 eval.txt /*E941* +E942 eval.txt /*E942* +E943 message.txt /*E943* +E944 pattern.txt /*E944* +E945 pattern.txt /*E945* +E946 terminal.txt /*E946* +E947 terminal.txt /*E947* +E948 terminal.txt /*E948* +E949 editing.txt /*E949* E95 message.txt /*E95* +E950 message.txt /*E950* +E951 pattern.txt /*E951* +E952 autocmd.txt /*E952* +E953 eval.txt /*E953* +E954 options.txt /*E954* +E955 eval.txt /*E955* E96 diff.txt /*E96* E97 diff.txt /*E97* E98 diff.txt /*E98* @@ -4390,8 +4679,10 @@ EncodingChanged autocmd.txt /*EncodingChanged* Eterm syntax.txt /*Eterm* Ex intro.txt /*Ex* Ex-mode intro.txt /*Ex-mode* +ExitPre autocmd.txt /*ExitPre* Exuberant_ctags tagsrch.txt /*Exuberant_ctags* F motion.txt /*F* +FALSE eval.txt /*FALSE* FAQ intro.txt /*FAQ* Farsi farsi.txt /*Farsi* FileAppendCmd autocmd.txt /*FileAppendCmd* @@ -4422,6 +4713,7 @@ G motion.txt /*G* GNOME gui_x11.txt /*GNOME* GTK gui_x11.txt /*GTK* GTK+ gui_x11.txt /*GTK+* +GTK3 gui_x11.txt /*GTK3* GUI gui.txt /*GUI* GUI-X11 gui_x11.txt /*GUI-X11* GUIEnter autocmd.txt /*GUIEnter* @@ -4443,6 +4735,8 @@ InsertEnter autocmd.txt /*InsertEnter* InsertLeave autocmd.txt /*InsertLeave* J change.txt /*J* Japanese mbyte.txt /*Japanese* +Job eval.txt /*Job* +Jobs eval.txt /*Jobs* K various.txt /*K* KDE gui_x11.txt /*KDE* KVim gui_x11.txt /*KVim* @@ -4452,6 +4746,8 @@ L motion.txt /*L* Linux-backspace options.txt /*Linux-backspace* List eval.txt /*List* Lists eval.txt /*Lists* +LogiPat() pi_logipat.txt /*LogiPat()* +LogiPat-flags pi_logipat.txt /*LogiPat-flags* Lua if_lua.txt /*Lua* M motion.txt /*M* MDI starting.txt /*MDI* @@ -4498,16 +4794,20 @@ OffTheSpot mbyte.txt /*OffTheSpot* OnTheSpot mbyte.txt /*OnTheSpot* Operator-pending intro.txt /*Operator-pending* Operator-pending-mode intro.txt /*Operator-pending-mode* +OptionSet autocmd.txt /*OptionSet* OverTheSpot mbyte.txt /*OverTheSpot* P change.txt /*P* PATHEXT eval.txt /*PATHEXT* +PEP8 filetype.txt /*PEP8* PHP_BracesAtCodeLevel indent.txt /*PHP_BracesAtCodeLevel* PHP_autoformatcomment indent.txt /*PHP_autoformatcomment* PHP_default_indenting indent.txt /*PHP_default_indenting* +PHP_noArrowMatching indent.txt /*PHP_noArrowMatching* PHP_outdentSLComments indent.txt /*PHP_outdentSLComments* PHP_outdentphpescape indent.txt /*PHP_outdentphpescape* PHP_removeCRwhenUnix indent.txt /*PHP_removeCRwhenUnix* PHP_vintage_case_default_indent indent.txt /*PHP_vintage_case_default_indent* +Partial eval.txt /*Partial* Pattern pattern.txt /*Pattern* Perl if_perl.txt /*Perl* Posix intro.txt /*Posix* @@ -4585,9 +4885,11 @@ ShellCmdPost autocmd.txt /*ShellCmdPost* ShellFilterPost autocmd.txt /*ShellFilterPost* SourceCmd autocmd.txt /*SourceCmd* SourcePre autocmd.txt /*SourcePre* +Special eval.txt /*Special* SpellFileMissing autocmd.txt /*SpellFileMissing* StdinReadPost autocmd.txt /*StdinReadPost* StdinReadPre autocmd.txt /*StdinReadPre* +String eval.txt /*String* SwapExists autocmd.txt /*SwapExists* Syntax autocmd.txt /*Syntax* SystemColors.plist gui_mac.txt /*SystemColors.plist* @@ -4599,16 +4901,25 @@ TOhtml-encoding-detect syntax.txt /*TOhtml-encoding-detect* TOhtml-performance syntax.txt /*TOhtml-performance* TOhtml-uncopyable-text syntax.txt /*TOhtml-uncopyable-text* TOhtml-wrap-text syntax.txt /*TOhtml-wrap-text* +TRUE eval.txt /*TRUE* TSQL ft_sql.txt /*TSQL* TTpro-telnet syntax.txt /*TTpro-telnet* Tab intro.txt /*Tab* +TabClosed autocmd.txt /*TabClosed* TabEnter autocmd.txt /*TabEnter* TabLeave autocmd.txt /*TabLeave* +TabNew autocmd.txt /*TabNew* Tcl if_tcl.txt /*Tcl* TermChanged autocmd.txt /*TermChanged* TermResponse autocmd.txt /*TermResponse* +Terminal-Job terminal.txt /*Terminal-Job* +Terminal-Normal terminal.txt /*Terminal-Normal* +Terminal-mode terminal.txt /*Terminal-mode* +TerminalOpen autocmd.txt /*TerminalOpen* TextChanged autocmd.txt /*TextChanged* TextChangedI autocmd.txt /*TextChangedI* +TextChangedP autocmd.txt /*TextChangedP* +TextYankPost autocmd.txt /*TextYankPost* Transact-SQL ft_sql.txt /*Transact-SQL* U undo.txt /*U* UTF-8 mbyte.txt /*UTF-8* @@ -4644,11 +4955,17 @@ W15 repeat.txt /*W15* W16 message.txt /*W16* W17 arabic.txt /*W17* W18 syntax.txt /*W18* +W19 autocmd.txt /*W19* +W20 if_pyth.txt /*W20* +W21 if_pyth.txt /*W21* +W22 eval.txt /*W22* WORD motion.txt /*WORD* WWW intro.txt /*WWW* Win32 os_win32.txt /*Win32* +WinBar gui.txt /*WinBar* WinEnter autocmd.txt /*WinEnter* WinLeave autocmd.txt /*WinLeave* +WinNew autocmd.txt /*WinNew* X change.txt /*X* X11 options.txt /*X11* X11-icon gui_x11.txt /*X11-icon* @@ -4805,6 +5122,7 @@ add-filetype-plugin usr_05.txt /*add-filetype-plugin* add-global-plugin usr_05.txt /*add-global-plugin* add-local-help usr_05.txt /*add-local-help* add-option-flags options.txt /*add-option-flags* +add-package usr_05.txt /*add-package* add-plugin usr_05.txt /*add-plugin* added-5.1 version5.txt /*added-5.1* added-5.2 version5.txt /*added-5.2* @@ -4822,6 +5140,7 @@ added-7.1 version7.txt /*added-7.1* added-7.2 version7.txt /*added-7.2* added-7.3 version7.txt /*added-7.3* added-7.4 version7.txt /*added-7.4* +added-8.1 version8.txt /*added-8.1* added-BeOS version5.txt /*added-BeOS* added-Mac version5.txt /*added-Mac* added-VMS version5.txt /*added-VMS* @@ -4862,6 +5181,19 @@ asin() eval.txt /*asin()* asm.vim syntax.txt /*asm.vim* asm68k syntax.txt /*asm68k* asmh8300.vim syntax.txt /*asmh8300.vim* +assert-return eval.txt /*assert-return* +assert_beeps() eval.txt /*assert_beeps()* +assert_equal() eval.txt /*assert_equal()* +assert_equalfile() eval.txt /*assert_equalfile()* +assert_exception() eval.txt /*assert_exception()* +assert_fails() eval.txt /*assert_fails()* +assert_false() eval.txt /*assert_false()* +assert_inrange() eval.txt /*assert_inrange()* +assert_match() eval.txt /*assert_match()* +assert_notequal() eval.txt /*assert_notequal()* +assert_notmatch() eval.txt /*assert_notmatch()* +assert_report() eval.txt /*assert_report()* +assert_true() eval.txt /*assert_true()* at motion.txt /*at* atan() eval.txt /*atan()* atan2() eval.txt /*atan2()* @@ -4905,10 +5237,13 @@ b motion.txt /*b* b: eval.txt /*b:* b:changedtick eval.txt /*b:changedtick* b:changelog_name filetype.txt /*b:changelog_name* +b:clojure_syntax_keywords syntax.txt /*b:clojure_syntax_keywords* +b:clojure_syntax_without_core_keywords syntax.txt /*b:clojure_syntax_without_core_keywords* b:current_syntax-variable syntax.txt /*b:current_syntax-variable* b:netrw_lastfile pi_netrw.txt /*b:netrw_lastfile* b:tex_stylish syntax.txt /*b:tex_stylish* b:var eval.txt /*b:var* +b:yaml_schema syntax.txt /*b:yaml_schema* baan-folding syntax.txt /*baan-folding* baan-syntax syntax.txt /*baan-syntax* baan.vim syntax.txt /*baan.vim* @@ -4921,6 +5256,8 @@ backup-changed version4.txt /*backup-changed* backup-extension version4.txt /*backup-extension* backup-table editing.txt /*backup-table* balloon-eval debugger.txt /*balloon-eval* +balloon_show() eval.txt /*balloon_show()* +balloon_split() eval.txt /*balloon_split()* bar motion.txt /*bar* bars help.txt /*bars* base_font_name_list mbyte.txt /*base_font_name_list* @@ -4945,13 +5282,16 @@ beval_bufnr-variable eval.txt /*beval_bufnr-variable* beval_col-variable eval.txt /*beval_col-variable* beval_lnum-variable eval.txt /*beval_lnum-variable* beval_text-variable eval.txt /*beval_text-variable* +beval_winid-variable eval.txt /*beval_winid-variable* beval_winnr-variable eval.txt /*beval_winnr-variable* +binary-number eval.txt /*binary-number* bitwise-function usr_41.txt /*bitwise-function* blockwise-examples visual.txt /*blockwise-examples* blockwise-operators visual.txt /*blockwise-operators* blockwise-register change.txt /*blockwise-register* blockwise-visual visual.txt /*blockwise-visual* blowfish options.txt /*blowfish* +blowfish2 options.txt /*blowfish2* bold syntax.txt /*bold* bom-bytes mbyte.txt /*bom-bytes* book intro.txt /*book* @@ -4976,10 +5316,12 @@ buflisted() eval.txt /*buflisted()* bufloaded() eval.txt /*bufloaded()* bufname() eval.txt /*bufname()* bufnr() eval.txt /*bufnr()* +bufwinid() eval.txt /*bufwinid()* bufwinnr() eval.txt /*bufwinnr()* bug-fixes-5 version5.txt /*bug-fixes-5* bug-fixes-6 version6.txt /*bug-fixes-6* bug-fixes-7 version7.txt /*bug-fixes-7* +bug-fixes-8 version8.txt /*bug-fixes-8* bug-reports intro.txt /*bug-reports* bugreport.vim intro.txt /*bugreport.vim* bugs intro.txt /*bugs* @@ -5004,6 +5346,7 @@ c_<C-Left> cmdline.txt /*c_<C-Left>* c_<C-R> cmdline.txt /*c_<C-R>* c_<C-R>_<C-A> cmdline.txt /*c_<C-R>_<C-A>* c_<C-R>_<C-F> cmdline.txt /*c_<C-R>_<C-F>* +c_<C-R>_<C-L> cmdline.txt /*c_<C-R>_<C-L>* c_<C-R>_<C-O> cmdline.txt /*c_<C-R>_<C-O>* c_<C-R>_<C-P> cmdline.txt /*c_<C-R>_<C-P>* c_<C-R>_<C-R> cmdline.txt /*c_<C-R>_<C-R>* @@ -5018,6 +5361,7 @@ c_<Home> cmdline.txt /*c_<Home>* c_<Insert> cmdline.txt /*c_<Insert>* c_<Left> cmdline.txt /*c_<Left>* c_<LeftMouse> cmdline.txt /*c_<LeftMouse>* +c_<MiddleMouse> cmdline.txt /*c_<MiddleMouse>* c_<NL> cmdline.txt /*c_<NL>* c_<PageDown> cmdline.txt /*c_<PageDown>* c_<PageUp> cmdline.txt /*c_<PageUp>* @@ -5037,11 +5381,13 @@ c_CTRL-C cmdline.txt /*c_CTRL-C* c_CTRL-D cmdline.txt /*c_CTRL-D* c_CTRL-E cmdline.txt /*c_CTRL-E* c_CTRL-F cmdline.txt /*c_CTRL-F* +c_CTRL-G cmdline.txt /*c_CTRL-G* c_CTRL-H cmdline.txt /*c_CTRL-H* c_CTRL-I cmdline.txt /*c_CTRL-I* c_CTRL-J cmdline.txt /*c_CTRL-J* c_CTRL-K cmdline.txt /*c_CTRL-K* c_CTRL-L cmdline.txt /*c_CTRL-L* +c_CTRL-M cmdline.txt /*c_CTRL-M* c_CTRL-N cmdline.txt /*c_CTRL-N* c_CTRL-P cmdline.txt /*c_CTRL-P* c_CTRL-Q cmdline.txt /*c_CTRL-Q* @@ -5049,14 +5395,17 @@ c_CTRL-R cmdline.txt /*c_CTRL-R* c_CTRL-R_= cmdline.txt /*c_CTRL-R_=* c_CTRL-R_CTRL-A cmdline.txt /*c_CTRL-R_CTRL-A* c_CTRL-R_CTRL-F cmdline.txt /*c_CTRL-R_CTRL-F* +c_CTRL-R_CTRL-L cmdline.txt /*c_CTRL-R_CTRL-L* c_CTRL-R_CTRL-O cmdline.txt /*c_CTRL-R_CTRL-O* c_CTRL-R_CTRL-P cmdline.txt /*c_CTRL-R_CTRL-P* c_CTRL-R_CTRL-R cmdline.txt /*c_CTRL-R_CTRL-R* c_CTRL-R_CTRL-W cmdline.txt /*c_CTRL-R_CTRL-W* +c_CTRL-T cmdline.txt /*c_CTRL-T* c_CTRL-U cmdline.txt /*c_CTRL-U* c_CTRL-V cmdline.txt /*c_CTRL-V* c_CTRL-W cmdline.txt /*c_CTRL-W* c_CTRL-Y cmdline.txt /*c_CTRL-Y* +c_CTRL-[ cmdline.txt /*c_CTRL-[* c_CTRL-\_CTRL-G intro.txt /*c_CTRL-\\_CTRL-G* c_CTRL-\_CTRL-N intro.txt /*c_CTRL-\\_CTRL-N* c_CTRL-\_e cmdline.txt /*c_CTRL-\\_e* @@ -5072,7 +5421,25 @@ c_Insert cmdline.txt /*c_Insert* c_Left cmdline.txt /*c_Left* c_Right cmdline.txt /*c_Right* c_Up cmdline.txt /*c_Up* +c_ansi_constants syntax.txt /*c_ansi_constants* +c_ansi_typedefs syntax.txt /*c_ansi_typedefs* +c_comment_strings syntax.txt /*c_comment_strings* +c_curly_error syntax.txt /*c_curly_error* c_digraph cmdline.txt /*c_digraph* +c_gnu syntax.txt /*c_gnu* +c_no_ansi syntax.txt /*c_no_ansi* +c_no_bracket_error syntax.txt /*c_no_bracket_error* +c_no_bsd syntax.txt /*c_no_bsd* +c_no_c11 syntax.txt /*c_no_c11* +c_no_c99 syntax.txt /*c_no_c99* +c_no_cformat syntax.txt /*c_no_cformat* +c_no_curly_error syntax.txt /*c_no_curly_error* +c_no_if0 syntax.txt /*c_no_if0* +c_no_tab_space_error syntax.txt /*c_no_tab_space_error* +c_no_trail_space_error syntax.txt /*c_no_trail_space_error* +c_no_utf syntax.txt /*c_no_utf* +c_space_errors syntax.txt /*c_space_errors* +c_syntax_for_h syntax.txt /*c_syntax_for_h* c_wildchar cmdline.txt /*c_wildchar* call() eval.txt /*call()* carriage-return intro.txt /*carriage-return* @@ -5085,6 +5452,23 @@ catch-text eval.txt /*catch-text* cc change.txt /*cc* ceil() eval.txt /*ceil()* ch.vim syntax.txt /*ch.vim* +ch_canread() eval.txt /*ch_canread()* +ch_close() eval.txt /*ch_close()* +ch_close_in() eval.txt /*ch_close_in()* +ch_evalexpr() eval.txt /*ch_evalexpr()* +ch_evalraw() eval.txt /*ch_evalraw()* +ch_getbufnr() eval.txt /*ch_getbufnr()* +ch_getjob() eval.txt /*ch_getjob()* +ch_info() eval.txt /*ch_info()* +ch_log() eval.txt /*ch_log()* +ch_logfile() eval.txt /*ch_logfile()* +ch_open() eval.txt /*ch_open()* +ch_read() eval.txt /*ch_read()* +ch_readraw() eval.txt /*ch_readraw()* +ch_sendexpr() eval.txt /*ch_sendexpr()* +ch_sendraw() eval.txt /*ch_sendraw()* +ch_setoptions() eval.txt /*ch_setoptions()* +ch_status() eval.txt /*ch_status()* change-list-jumps motion.txt /*change-list-jumps* change-name tips.txt /*change-name* change-tabs change.txt /*change-tabs* @@ -5105,11 +5489,28 @@ changed-7.1 version7.txt /*changed-7.1* changed-7.2 version7.txt /*changed-7.2* changed-7.3 version7.txt /*changed-7.3* changed-7.4 version7.txt /*changed-7.4* +changed-8.1 version8.txt /*changed-8.1* changelist motion.txt /*changelist* changelog.vim syntax.txt /*changelog.vim* changenr() eval.txt /*changenr()* changetick eval.txt /*changetick* changing change.txt /*changing* +channel channel.txt /*channel* +channel-callback channel.txt /*channel-callback* +channel-close channel.txt /*channel-close* +channel-close-in channel.txt /*channel-close-in* +channel-commands channel.txt /*channel-commands* +channel-demo channel.txt /*channel-demo* +channel-drop channel.txt /*channel-drop* +channel-functions usr_41.txt /*channel-functions* +channel-mode channel.txt /*channel-mode* +channel-more channel.txt /*channel-more* +channel-open channel.txt /*channel-open* +channel-open-options channel.txt /*channel-open-options* +channel-raw channel.txt /*channel-raw* +channel-timeout channel.txt /*channel-timeout* +channel-use channel.txt /*channel-use* +channel.txt channel.txt /*channel.txt* char-variable eval.txt /*char-variable* char2nr() eval.txt /*char2nr()* characterwise motion.txt /*characterwise* @@ -5121,6 +5522,7 @@ charity uganda.txt /*charity* charset mbyte.txt /*charset* charset-conversion mbyte.txt /*charset-conversion* chill.vim syntax.txt /*chill.vim* +chmod eval.txt /*chmod* cindent() eval.txt /*cindent()* cinkeys-format indent.txt /*cinkeys-format* cino-# indent.txt /*cino-#* @@ -5132,6 +5534,7 @@ cino-: indent.txt /*cino-:* cino-= indent.txt /*cino-=* cino-> indent.txt /*cino->* cino-C indent.txt /*cino-C* +cino-E indent.txt /*cino-E* cino-J indent.txt /*cino-J* cino-L indent.txt /*cino-L* cino-M indent.txt /*cino-M* @@ -5162,6 +5565,7 @@ cinoptions-values indent.txt /*cinoptions-values* clear-undo undo.txt /*clear-undo* clearmatches() eval.txt /*clearmatches()* client-server remote.txt /*client-server* +client-server-name remote.txt /*client-server-name* clientserver remote.txt /*clientserver* clipboard gui.txt /*clipboard* clipboard-autoselect options.txt /*clipboard-autoselect* @@ -5172,6 +5576,8 @@ clipboard-html options.txt /*clipboard-html* clipboard-unnamed options.txt /*clipboard-unnamed* clipboard-unnamedplus options.txt /*clipboard-unnamedplus* clojure-indent indent.txt /*clojure-indent* +close_cb channel.txt /*close_cb* +closure eval.txt /*closure* cmd-key gui_mac.txt /*cmd-key* cmd-movement gui_mac.txt /*cmd-movement* cmd-shortcuts gui_mac.txt /*cmd-shortcuts* @@ -5206,6 +5612,7 @@ compatible-default starting.txt /*compatible-default* compile-changes-5 version5.txt /*compile-changes-5* compile-changes-6 version6.txt /*compile-changes-6* compile-changes-7 version7.txt /*compile-changes-7* +compile-changes-8 version8.txt /*compile-changes-8* compiler-compaqada ft_ada.txt /*compiler-compaqada* compiler-decada ft_ada.txt /*compiler-decada* compiler-gcc quickfix.txt /*compiler-gcc* @@ -5237,6 +5644,7 @@ complete_CTRL-E insert.txt /*complete_CTRL-E* complete_CTRL-Y insert.txt /*complete_CTRL-Y* complete_add() eval.txt /*complete_add()* complete_check() eval.txt /*complete_check()* +completed_item-variable eval.txt /*completed_item-variable* completion-functions usr_41.txt /*completion-functions* complex-change change.txt /*complex-change* complex-repeat repeat.txt /*complex-repeat* @@ -5264,6 +5672,7 @@ count-items tips.txt /*count-items* count-variable eval.txt /*count-variable* count1-variable eval.txt /*count1-variable* cp-default version5.txt /*cp-default* +cpo options.txt /*cpo* cpo-! options.txt /*cpo-!* cpo-# options.txt /*cpo-#* cpo-$ options.txt /*cpo-$* @@ -5414,12 +5823,14 @@ debugger.txt debugger.txt /*debugger.txt* dec-mouse options.txt /*dec-mouse* decada_members ft_ada.txt /*decada_members* deepcopy() eval.txt /*deepcopy()* +defaults.vim starting.txt /*defaults.vim* definition-search tagsrch.txt /*definition-search* definitions intro.txt /*definitions* delete() eval.txt /*delete()* delete-insert change.txt /*delete-insert* delete-menus gui.txt /*delete-menus* deleting change.txt /*deleting* +demoserver.py channel.txt /*demoserver.py* design-assumptions develop.txt /*design-assumptions* design-compatible develop.txt /*design-compatible* design-decisions develop.txt /*design-decisions* @@ -5454,9 +5865,12 @@ diff-mode diff.txt /*diff-mode* diff-options diff.txt /*diff-options* diff-original-file diff.txt /*diff-original-file* diff-patchexpr diff.txt /*diff-patchexpr* +diff-slow diff.txt /*diff-slow* diff.txt diff.txt /*diff.txt* +diff.vim syntax.txt /*diff.vim* diff_filler() eval.txt /*diff_filler()* diff_hlID() eval.txt /*diff_hlID()* +diff_translations diff.txt /*diff_translations* digraph digraph.txt /*digraph* digraph-arg change.txt /*digraph-arg* digraph-encoding digraph.txt /*digraph-encoding* @@ -5495,8 +5909,6 @@ dos-locations os_dos.txt /*dos-locations* dos-shell os_dos.txt /*dos-shell* dos-standard-mappings os_dos.txt /*dos-standard-mappings* dos-temp-files os_dos.txt /*dos-temp-files* -dos16 os_msdos.txt /*dos16* -dos32 os_msdos.txt /*dos32* dosbatch.vim syntax.txt /*dosbatch.vim* double-click term.txt /*double-click* download intro.txt /*download* @@ -5517,6 +5929,7 @@ edit-dialogs editing.txt /*edit-dialogs* edit-files editing.txt /*edit-files* edit-intro editing.txt /*edit-intro* edit-no-break usr_25.txt /*edit-no-break* +edit-paragraph-join usr_25.txt /*edit-paragraph-join* editing.txt editing.txt /*editing.txt* efm-%> quickfix.txt /*efm-%>* efm-entries quickfix.txt /*efm-entries* @@ -5534,6 +5947,13 @@ end intro.txt /*end* end-of-file pattern.txt /*end-of-file* enlightened-terminal syntax.txt /*enlightened-terminal* erlang.vim syntax.txt /*erlang.vim* +err_buf channel.txt /*err_buf* +err_cb channel.txt /*err_cb* +err_mode channel.txt /*err_mode* +err_modifiable channel.txt /*err_modifiable* +err_msg channel.txt /*err_msg* +err_name channel.txt /*err_name* +err_timeout channel.txt /*err_timeout* errmsg-variable eval.txt /*errmsg-variable* error-file-format quickfix.txt /*error-file-format* error-messages message.txt /*error-messages* @@ -5549,6 +5969,7 @@ errorformat-multi-line quickfix.txt /*errorformat-multi-line* errorformat-separate-filename quickfix.txt /*errorformat-separate-filename* errorformats quickfix.txt /*errorformats* errors message.txt /*errors* +errors-variable eval.txt /*errors-variable* escape intro.txt /*escape* escape() eval.txt /*escape()* escape-bar version4.txt /*escape-bar* @@ -5559,6 +5980,7 @@ eval() eval.txt /*eval()* eval-examples eval.txt /*eval-examples* eval-sandbox eval.txt /*eval-sandbox* eval.txt eval.txt /*eval.txt* +event-variable eval.txt /*event-variable* eventhandler() eval.txt /*eventhandler()* eview starting.txt /*eview* evim starting.txt /*evim* @@ -5587,10 +6009,12 @@ exception-variable eval.txt /*exception-variable* exclusive motion.txt /*exclusive* exclusive-linewise motion.txt /*exclusive-linewise* executable() eval.txt /*executable()* +execute() eval.txt /*execute()* execute-menus gui.txt /*execute-menus* exepath() eval.txt /*exepath()* exim starting.txt /*exim* exists() eval.txt /*exists()* +exiting starting.txt /*exiting* exp() eval.txt /*exp()* expand() eval.txt /*expand()* expand-env options.txt /*expand-env* @@ -5641,6 +6065,7 @@ expr-is? eval.txt /*expr-is?* expr-isnot eval.txt /*expr-isnot* expr-isnot# eval.txt /*expr-isnot#* expr-isnot? eval.txt /*expr-isnot?* +expr-lambda eval.txt /*expr-lambda* expr-nesting eval.txt /*expr-nesting* expr-number eval.txt /*expr-number* expr-option eval.txt /*expr-option* @@ -5669,8 +6094,10 @@ extension-removal cmdline.txt /*extension-removal* extensions-improvements todo.txt /*extensions-improvements* external-editor gui_mac.txt /*external-editor* f motion.txt /*f* +false-variable eval.txt /*false-variable* faq intro.txt /*faq* farsi farsi.txt /*farsi* +farsi-fonts farsi.txt /*farsi-fonts* farsi.txt farsi.txt /*farsi.txt* fasm.vim syntax.txt /*fasm.vim* fcs_choice-variable eval.txt /*fcs_choice-variable* @@ -5775,6 +6202,7 @@ fork os_unix.txt /*fork* form.vim syntax.txt /*form.vim* format-bullet-list tips.txt /*format-bullet-list* format-comments change.txt /*format-comments* +format-formatexpr change.txt /*format-formatexpr* formatting change.txt /*formatting* formfeed intro.txt /*formfeed* fortran.vim syntax.txt /*fortran.vim* @@ -5814,6 +6242,7 @@ ft-csh-syntax syntax.txt /*ft-csh-syntax* ft-css-omni insert.txt /*ft-css-omni* ft-cweb-syntax syntax.txt /*ft-cweb-syntax* ft-cynlib-syntax syntax.txt /*ft-cynlib-syntax* +ft-dash-syntax syntax.txt /*ft-dash-syntax* ft-desktop-syntax syntax.txt /*ft-desktop-syntax* ft-dircolors-syntax syntax.txt /*ft-dircolors-syntax* ft-docbk-syntax syntax.txt /*ft-docbk-syntax* @@ -5860,6 +6289,7 @@ ft-mathematica-syntax syntax.txt /*ft-mathematica-syntax* ft-mma-syntax syntax.txt /*ft-mma-syntax* ft-moo-syntax syntax.txt /*ft-moo-syntax* ft-msql-syntax syntax.txt /*ft-msql-syntax* +ft-n1ql-syntax syntax.txt /*ft-n1ql-syntax* ft-nasm-syntax syntax.txt /*ft-nasm-syntax* ft-ncf-syntax syntax.txt /*ft-ncf-syntax* ft-nroff-syntax syntax.txt /*ft-nroff-syntax* @@ -5874,12 +6304,14 @@ ft-php-syntax syntax.txt /*ft-php-syntax* ft-php3-syntax syntax.txt /*ft-php3-syntax* ft-phtml-syntax syntax.txt /*ft-phtml-syntax* ft-plaintex-syntax syntax.txt /*ft-plaintex-syntax* +ft-posix-synax syntax.txt /*ft-posix-synax* ft-postscr-syntax syntax.txt /*ft-postscr-syntax* ft-ppwiz-syntax syntax.txt /*ft-ppwiz-syntax* ft-printcap-syntax syntax.txt /*ft-printcap-syntax* ft-progress-syntax syntax.txt /*ft-progress-syntax* ft-ptcap-syntax syntax.txt /*ft-ptcap-syntax* ft-python-indent indent.txt /*ft-python-indent* +ft-python-plugin filetype.txt /*ft-python-plugin* ft-python-syntax syntax.txt /*ft-python-syntax* ft-quake-syntax syntax.txt /*ft-quake-syntax* ft-r-indent indent.txt /*ft-r-indent* @@ -5888,6 +6320,7 @@ ft-rexx-syntax syntax.txt /*ft-rexx-syntax* ft-rst-syntax syntax.txt /*ft-rst-syntax* ft-ruby-omni insert.txt /*ft-ruby-omni* ft-ruby-syntax syntax.txt /*ft-ruby-syntax* +ft-rust filetype.txt /*ft-rust* ft-scheme-syntax syntax.txt /*ft-scheme-syntax* ft-sdl-syntax syntax.txt /*ft-sdl-syntax* ft-sed-syntax syntax.txt /*ft-sed-syntax* @@ -5911,13 +6344,18 @@ ft-vb-syntax syntax.txt /*ft-vb-syntax* ft-verilog-indent indent.txt /*ft-verilog-indent* ft-vhdl-indent indent.txt /*ft-vhdl-indent* ft-vim-indent indent.txt /*ft-vim-indent* +ft-vim-plugin filetype.txt /*ft-vim-plugin* ft-vim-syntax syntax.txt /*ft-vim-syntax* ft-xf86conf-syntax syntax.txt /*ft-xf86conf-syntax* ft-xhtml-omni insert.txt /*ft-xhtml-omni* ft-xml-omni insert.txt /*ft-xml-omni* ft-xml-syntax syntax.txt /*ft-xml-syntax* ft-xpm-syntax syntax.txt /*ft-xpm-syntax* +ft-yaml-syntax syntax.txt /*ft-yaml-syntax* +ft-zimbu-plugin filetype.txt /*ft-zimbu-plugin* +ft-zsh-syntax syntax.txt /*ft-zsh-syntax* ft_ada.txt ft_ada.txt /*ft_ada.txt* +ft_rust.txt ft_rust.txt /*ft_rust.txt* ft_sql.txt ft_sql.txt /*ft_sql.txt* ftdetect filetype.txt /*ftdetect* ftp pi_netrw.txt /*ftp* @@ -5927,6 +6365,7 @@ ftplugin-name usr_05.txt /*ftplugin-name* ftplugin-overrule filetype.txt /*ftplugin-overrule* ftplugin-special usr_41.txt /*ftplugin-special* ftplugins usr_05.txt /*ftplugins* +funcref() eval.txt /*funcref()* function() eval.txt /*function()* function-argument eval.txt /*function-argument* function-key intro.txt /*function-key* @@ -5951,8 +6390,10 @@ g0 motion.txt /*g0* g8 various.txt /*g8* g: eval.txt /*g:* g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu* +g:Netrw_UserMaps pi_netrw.txt /*g:Netrw_UserMaps* g:Netrw_corehandler pi_netrw.txt /*g:Netrw_corehandler* g:Netrw_funcref pi_netrw.txt /*g:Netrw_funcref* +g:actual_curbuf options.txt /*g:actual_curbuf* g:ada#Comment ft_ada.txt /*g:ada#Comment* g:ada#Ctags_Kinds ft_ada.txt /*g:ada#Ctags_Kinds* g:ada#DotWordRegex ft_ada.txt /*g:ada#DotWordRegex* @@ -5983,6 +6424,7 @@ g:clojure_fuzzy_indent_blacklist indent.txt /*g:clojure_fuzzy_indent_blacklist* g:clojure_fuzzy_indent_patterns indent.txt /*g:clojure_fuzzy_indent_patterns* g:clojure_maxlines indent.txt /*g:clojure_maxlines* g:clojure_special_indent_words indent.txt /*g:clojure_special_indent_words* +g:clojure_syntax_keywords syntax.txt /*g:clojure_syntax_keywords* g:colors_name options.txt /*g:colors_name* g:decada ft_ada.txt /*g:decada* g:decada.Error_Format ft_ada.txt /*g:decada.Error_Format* @@ -5991,6 +6433,7 @@ g:decada.Make_Command ft_ada.txt /*g:decada.Make_Command* g:decada.Unit_Name() ft_ada.txt /*g:decada.Unit_Name()* g:filetype_csh syntax.txt /*g:filetype_csh* g:filetype_r syntax.txt /*g:filetype_r* +g:ftplugin_rust_source_path ft_rust.txt /*g:ftplugin_rust_source_path* g:gnat ft_ada.txt /*g:gnat* g:gnat.Error_Format ft_ada.txt /*g:gnat.Error_Format* g:gnat.Find() ft_ada.txt /*g:gnat.Find()* @@ -6009,6 +6452,7 @@ g:html_dynamic_folds syntax.txt /*g:html_dynamic_folds* g:html_encoding_override syntax.txt /*g:html_encoding_override* g:html_end_line syntax.txt /*g:html_end_line* g:html_expand_tabs syntax.txt /*g:html_expand_tabs* +g:html_font syntax.txt /*g:html_font* g:html_hover_unfold syntax.txt /*g:html_hover_unfold* g:html_id_expr syntax.txt /*g:html_id_expr* g:html_ignore_conceal syntax.txt /*g:html_ignore_conceal* @@ -6048,6 +6492,7 @@ g:netrw_errorlvl pi_netrw.txt /*g:netrw_errorlvl* g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse* g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd* g:netrw_ffkeep pi_netrw.txt /*g:netrw_ffkeep* +g:netrw_file_cmd pi_netrw.txt /*g:netrw_file_cmd* g:netrw_fname_escape pi_netrw.txt /*g:netrw_fname_escape* g:netrw_ftp pi_netrw.txt /*g:netrw_ftp* g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* @@ -6059,6 +6504,7 @@ g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* g:netrw_ftpextracmd pi_netrw.txt /*g:netrw_ftpextracmd* g:netrw_ftpmode pi_netrw.txt /*g:netrw_ftpmode* g:netrw_glob_escape pi_netrw.txt /*g:netrw_glob_escape* +g:netrw_gx pi_netrw.txt /*g:netrw_gx* g:netrw_hide pi_netrw.txt /*g:netrw_hide* g:netrw_home pi_netrw.txt /*g:netrw_home* g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd* @@ -6066,13 +6512,21 @@ g:netrw_http_put_cmd pi_netrw.txt /*g:netrw_http_put_cmd* g:netrw_http_xcmd pi_netrw.txt /*g:netrw_http_xcmd* g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc* g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir* +g:netrw_keepj pi_netrw.txt /*g:netrw_keepj* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* +g:netrw_list_cmd_options pi_netrw.txt /*g:netrw_list_cmd_options* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd* +g:netrw_localcopycmdopt pi_netrw.txt /*g:netrw_localcopycmdopt* +g:netrw_localcopydircmd pi_netrw.txt /*g:netrw_localcopydircmd* +g:netrw_localcopydircmdopt pi_netrw.txt /*g:netrw_localcopydircmdopt* g:netrw_localmkdir pi_netrw.txt /*g:netrw_localmkdir* +g:netrw_localmkdiropt pi_netrw.txt /*g:netrw_localmkdiropt* g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd* +g:netrw_localmovecmdopt pi_netrw.txt /*g:netrw_localmovecmdopt* g:netrw_localrmdir pi_netrw.txt /*g:netrw_localrmdir* +g:netrw_localrmdiropt pi_netrw.txt /*g:netrw_localrmdiropt* g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen* g:netrw_menu pi_netrw.txt /*g:netrw_menu* g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd* @@ -6082,16 +6536,20 @@ g:netrw_nogx pi_netrw.txt /*g:netrw_nogx* g:netrw_preview pi_netrw.txt /*g:netrw_preview* g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd* g:netrw_remote_mkdir pi_netrw.txt /*g:netrw_remote_mkdir* +g:netrw_rename_cmd pi_netrw.txt /*g:netrw_rename_cmd* g:netrw_retmap pi_netrw.txt /*g:netrw_retmap* g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd* g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd* g:netrw_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd* g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd* +g:netrw_rsync_sep pi_netrw.txt /*g:netrw_rsync_sep* g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd* g:netrw_scpport pi_netrw.txt /*g:netrw_scpport* g:netrw_sepchr pi_netrw.txt /*g:netrw_sepchr* +g:netrw_servername pi_netrw.txt /*g:netrw_servername* g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd* g:netrw_silent pi_netrw.txt /*g:netrw_silent* +g:netrw_sizestyle pi_netrw.txt /*g:netrw_sizestyle* g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by* g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction* g:netrw_sort_options pi_netrw.txt /*g:netrw_sort_options* @@ -6100,17 +6558,32 @@ g:netrw_special_syntax pi_netrw.txt /*g:netrw_special_syntax* g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject* g:netrw_ssh_cmd pi_netrw.txt /*g:netrw_ssh_cmd* g:netrw_sshport pi_netrw.txt /*g:netrw_sshport* +g:netrw_suppress_gx_mesg pi_netrw.txt /*g:netrw_suppress_gx_mesg* g:netrw_timefmt pi_netrw.txt /*g:netrw_timefmt* g:netrw_tmpfile_escape pi_netrw.txt /*g:netrw_tmpfile_escape* g:netrw_uid pi_netrw.txt /*g:netrw_uid* g:netrw_use_errorwindow pi_netrw.txt /*g:netrw_use_errorwindow* g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf* g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp* +g:netrw_usetab pi_netrw.txt /*g:netrw_usetab* g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp* g:netrw_winsize pi_netrw.txt /*g:netrw_winsize* +g:netrw_wiw pi_netrw.txt /*g:netrw_wiw* g:netrw_xstrlen pi_netrw.txt /*g:netrw_xstrlen* -g:sh_isk syntax.txt /*g:sh_isk* -g:sh_noisk syntax.txt /*g:sh_noisk* +g:rust_bang_comment_leader ft_rust.txt /*g:rust_bang_comment_leader* +g:rust_conceal ft_rust.txt /*g:rust_conceal* +g:rust_conceal_mod_path ft_rust.txt /*g:rust_conceal_mod_path* +g:rust_conceal_pub ft_rust.txt /*g:rust_conceal_pub* +g:rust_fold ft_rust.txt /*g:rust_fold* +g:rust_playpen_url ft_rust.txt /*g:rust_playpen_url* +g:rust_recommended_style ft_rust.txt /*g:rust_recommended_style* +g:rust_shortener_url ft_rust.txt /*g:rust_shortener_url* +g:rustc_makeprg_no_percent ft_rust.txt /*g:rustc_makeprg_no_percent* +g:rustc_path ft_rust.txt /*g:rustc_path* +g:rustfmt_autosave ft_rust.txt /*g:rustfmt_autosave* +g:rustfmt_command ft_rust.txt /*g:rustfmt_command* +g:rustfmt_fail_silently ft_rust.txt /*g:rustfmt_fail_silently* +g:rustfmt_options ft_rust.txt /*g:rustfmt_options* g:syntax_on syntax.txt /*g:syntax_on* g:tar_browseoptions pi_tar.txt /*g:tar_browseoptions* g:tar_cmd pi_tar.txt /*g:tar_cmd* @@ -6120,6 +6593,7 @@ g:tar_nomax pi_tar.txt /*g:tar_nomax* g:tar_readoptions pi_tar.txt /*g:tar_readoptions* g:tar_secure pi_tar.txt /*g:tar_secure* g:tar_writeoptions pi_tar.txt /*g:tar_writeoptions* +g:terminal_ansi_colors terminal.txt /*g:terminal_ansi_colors* g:tex_comment_nospell syntax.txt /*g:tex_comment_nospell* g:tex_conceal syntax.txt /*g:tex_conceal* g:tex_fast syntax.txt /*g:tex_fast* @@ -6129,6 +6603,8 @@ g:tex_isk syntax.txt /*g:tex_isk* g:tex_no_error syntax.txt /*g:tex_no_error* g:tex_nospell syntax.txt /*g:tex_nospell* g:tex_stylish syntax.txt /*g:tex_stylish* +g:tex_subscripts syntax.txt /*g:tex_subscripts* +g:tex_superscripts syntax.txt /*g:tex_superscripts* g:tex_verbspell syntax.txt /*g:tex_verbspell* g:var eval.txt /*g:var* g:vimball_home pi_vimball.txt /*g:vimball_home* @@ -6138,6 +6614,9 @@ g:vimsyn_folding syntax.txt /*g:vimsyn_folding* g:vimsyn_maxlines syntax.txt /*g:vimsyn_maxlines* g:vimsyn_minlines syntax.txt /*g:vimsyn_minlines* g:vimsyn_noerror syntax.txt /*g:vimsyn_noerror* +g:yaml_schema syntax.txt /*g:yaml_schema* +g:zipPlugin_ext pi_zip.txt /*g:zipPlugin_ext* +g:zip_extractcmd pi_zip.txt /*g:zip_extractcmd* g:zip_nomax pi_zip.txt /*g:zip_nomax* g:zip_shq pi_zip.txt /*g:zip_shq* g:zip_unzipcmd pi_zip.txt /*g:zip_unzipcmd* @@ -6182,16 +6661,22 @@ ga various.txt /*ga* garbagecollect() eval.txt /*garbagecollect()* gd pattern.txt /*gd* gdb debug.txt /*gdb* +gdb-version terminal.txt /*gdb-version* ge motion.txt /*ge* get() eval.txt /*get()* get-ms-debuggers debug.txt /*get-ms-debuggers* +getbufinfo() eval.txt /*getbufinfo()* getbufline() eval.txt /*getbufline()* getbufvar() eval.txt /*getbufvar()* +getchangelist() eval.txt /*getchangelist()* getchar() eval.txt /*getchar()* getcharmod() eval.txt /*getcharmod()* +getcharsearch() eval.txt /*getcharsearch()* getcmdline() eval.txt /*getcmdline()* getcmdpos() eval.txt /*getcmdpos()* getcmdtype() eval.txt /*getcmdtype()* +getcmdwintype() eval.txt /*getcmdwintype()* +getcompletion() eval.txt /*getcompletion()* getcurpos() eval.txt /*getcurpos()* getcwd() eval.txt /*getcwd()* getfontname() eval.txt /*getfontname()* @@ -6199,6 +6684,7 @@ getfperm() eval.txt /*getfperm()* getfsize() eval.txt /*getfsize()* getftime() eval.txt /*getftime()* getftype() eval.txt /*getftype()* +getjumplist() eval.txt /*getjumplist()* getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install* getline() eval.txt /*getline()* getloclist() eval.txt /*getloclist()* @@ -6206,6 +6692,7 @@ getmatches() eval.txt /*getmatches()* getpid() eval.txt /*getpid()* getpos() eval.txt /*getpos()* getqflist() eval.txt /*getqflist()* +getqflist-examples quickfix.txt /*getqflist-examples* getreg() eval.txt /*getreg()* getregtype() eval.txt /*getregtype()* getscript pi_getscript.txt /*getscript* @@ -6214,8 +6701,11 @@ getscript-data pi_getscript.txt /*getscript-data* getscript-history pi_getscript.txt /*getscript-history* getscript-plugins pi_getscript.txt /*getscript-plugins* getscript-start pi_getscript.txt /*getscript-start* +gettabinfo() eval.txt /*gettabinfo()* gettabvar() eval.txt /*gettabvar()* gettabwinvar() eval.txt /*gettabwinvar()* +getwininfo() eval.txt /*getwininfo()* +getwinpos() eval.txt /*getwinpos()* getwinposx() eval.txt /*getwinposx()* getwinposy() eval.txt /*getwinposy()* getwinvar() eval.txt /*getwinvar()* @@ -6227,6 +6717,7 @@ gi insert.txt /*gi* gj motion.txt /*gj* gk motion.txt /*gk* glob() eval.txt /*glob()* +glob2regpat() eval.txt /*glob2regpat()* global-ime mbyte.txt /*global-ime* global-local options.txt /*global-local* global-variable eval.txt /*global-variable* @@ -6270,6 +6761,7 @@ gs various.txt /*gs* gsp.vim syntax.txt /*gsp.vim* gstar pattern.txt /*gstar* gt tabpage.txt /*gt* +gtk-css gui_x11.txt /*gtk-css* gtk-tooltip-colors gui_x11.txt /*gtk-tooltip-colors* gu change.txt /*gu* gugu change.txt /*gugu* @@ -6307,7 +6799,6 @@ gui-shell-win32 gui_w32.txt /*gui-shell-win32* gui-start gui.txt /*gui-start* gui-toolbar gui.txt /*gui-toolbar* gui-vert-scroll gui.txt /*gui-vert-scroll* -gui-w16 gui_w16.txt /*gui-w16* gui-w32 gui_w32.txt /*gui-w32* gui-w32-cmdargs gui_w32.txt /*gui-w32-cmdargs* gui-w32-dialogs gui_w32.txt /*gui-w32-dialogs* @@ -6315,7 +6806,7 @@ gui-w32-printing gui_w32.txt /*gui-w32-printing* gui-w32-start gui_w32.txt /*gui-w32-start* gui-w32-various gui_w32.txt /*gui-w32-various* gui-w32-windowid gui_w32.txt /*gui-w32-windowid* -gui-w32s gui_w32.txt /*gui-w32s* +gui-w32s os_win32.txt /*gui-w32s* gui-win32-maximized gui_w32.txt /*gui-win32-maximized* gui-x11 gui_x11.txt /*gui-x11* gui-x11-athena gui_x11.txt /*gui-x11-athena* @@ -6330,7 +6821,6 @@ gui-x11-start gui_x11.txt /*gui-x11-start* gui-x11-various gui_x11.txt /*gui-x11-various* gui.txt gui.txt /*gui.txt* gui_mac.txt gui_mac.txt /*gui_mac.txt* -gui_w16.txt gui_w16.txt /*gui_w16.txt* gui_w32.txt gui_w32.txt /*gui_w32.txt* gui_x11.txt gui_x11.txt /*gui_x11.txt* guifontwide_gtk2 options.txt /*guifontwide_gtk2* @@ -6359,6 +6849,7 @@ hangulin.txt hangulin.txt /*hangulin.txt* has() eval.txt /*has()* has-patch eval.txt /*has-patch* has-python if_pyth.txt /*has-python* +has-pythonx if_pyth.txt /*has-pythonx* has_key() eval.txt /*has_key()* haskell.vim syntax.txt /*haskell.vim* haslocaldir() eval.txt /*haslocaldir()* @@ -6368,6 +6859,7 @@ hebrew.txt hebrew.txt /*hebrew.txt* help helphelp.txt /*help* help-context help.txt /*help-context* help-summary usr_02.txt /*help-summary* +help-tags tags 1 help-translated helphelp.txt /*help-translated* help-writing helphelp.txt /*help-writing* help-xterm-window helphelp.txt /*help-xterm-window* @@ -6424,6 +6916,7 @@ hl-DiffChange syntax.txt /*hl-DiffChange* hl-DiffDelete syntax.txt /*hl-DiffDelete* hl-DiffText syntax.txt /*hl-DiffText* hl-Directory syntax.txt /*hl-Directory* +hl-EndOfBuffer syntax.txt /*hl-EndOfBuffer* hl-ErrorMsg syntax.txt /*hl-ErrorMsg* hl-FoldColumn syntax.txt /*hl-FoldColumn* hl-Folded syntax.txt /*hl-Folded* @@ -6441,6 +6934,7 @@ hl-PmenuSbar syntax.txt /*hl-PmenuSbar* hl-PmenuSel syntax.txt /*hl-PmenuSel* hl-PmenuThumb syntax.txt /*hl-PmenuThumb* hl-Question syntax.txt /*hl-Question* +hl-QuickFixLine syntax.txt /*hl-QuickFixLine* hl-Scrollbar syntax.txt /*hl-Scrollbar* hl-Search syntax.txt /*hl-Search* hl-SignColumn syntax.txt /*hl-SignColumn* @@ -6451,9 +6945,12 @@ hl-SpellLocal syntax.txt /*hl-SpellLocal* hl-SpellRare syntax.txt /*hl-SpellRare* hl-StatusLine syntax.txt /*hl-StatusLine* hl-StatusLineNC syntax.txt /*hl-StatusLineNC* +hl-StatusLineTerm syntax.txt /*hl-StatusLineTerm* +hl-StatusLineTermNC syntax.txt /*hl-StatusLineTermNC* hl-TabLine syntax.txt /*hl-TabLine* hl-TabLineFill syntax.txt /*hl-TabLineFill* hl-TabLineSel syntax.txt /*hl-TabLineSel* +hl-Terminal syntax.txt /*hl-Terminal* hl-Title syntax.txt /*hl-Title* hl-Tooltip syntax.txt /*hl-Tooltip* hl-User1 syntax.txt /*hl-User1* @@ -6464,6 +6961,8 @@ hl-Visual syntax.txt /*hl-Visual* hl-VisualNOS syntax.txt /*hl-VisualNOS* hl-WarningMsg syntax.txt /*hl-WarningMsg* hl-WildMenu syntax.txt /*hl-WildMenu* +hl-debugBreakpoint terminal.txt /*hl-debugBreakpoint* +hl-debugPC terminal.txt /*hl-debugPC* hlID() eval.txt /*hlID()* hlexists() eval.txt /*hlexists()* hlsearch-variable eval.txt /*hlsearch-variable* @@ -6546,6 +7045,7 @@ i_CTRL-G_<Down> insert.txt /*i_CTRL-G_<Down>* i_CTRL-G_<Up> insert.txt /*i_CTRL-G_<Up>* i_CTRL-G_CTRL-J insert.txt /*i_CTRL-G_CTRL-J* i_CTRL-G_CTRL-K insert.txt /*i_CTRL-G_CTRL-K* +i_CTRL-G_U insert.txt /*i_CTRL-G_U* i_CTRL-G_j insert.txt /*i_CTRL-G_j* i_CTRL-G_k insert.txt /*i_CTRL-G_k* i_CTRL-G_u insert.txt /*i_CTRL-G_u* @@ -6632,6 +7132,13 @@ improved-viminfo version5.txt /*improved-viminfo* improvements-5 version5.txt /*improvements-5* improvements-6 version6.txt /*improvements-6* improvements-7 version7.txt /*improvements-7* +improvements-8 version8.txt /*improvements-8* +in_bot channel.txt /*in_bot* +in_buf channel.txt /*in_buf* +in_io-buffer channel.txt /*in_io-buffer* +in_mode channel.txt /*in_mode* +in_name channel.txt /*in_name* +in_top channel.txt /*in_top* inactive-buffer windows.txt /*inactive-buffer* include-search tagsrch.txt /*include-search* inclusive motion.txt /*inclusive* @@ -6639,6 +7146,7 @@ incomp-small-6 version6.txt /*incomp-small-6* incompatible-5 version5.txt /*incompatible-5* incompatible-6 version6.txt /*incompatible-6* incompatible-7 version7.txt /*incompatible-7* +incompatible-8 version8.txt /*incompatible-8* indent() eval.txt /*indent()* indent-expression indent.txt /*indent-expression* indent.txt indent.txt /*indent.txt* @@ -6693,6 +7201,7 @@ iquote motion.txt /*iquote* is motion.txt /*is* isdirectory() eval.txt /*isdirectory()* islocked() eval.txt /*islocked()* +isnan() eval.txt /*isnan()* it motion.txt /*it* italic syntax.txt /*italic* items() eval.txt /*items()* @@ -6705,8 +7214,38 @@ java-indenting indent.txt /*java-indenting* java.vim syntax.txt /*java.vim* javascript-cinoptions indent.txt /*javascript-cinoptions* javascript-indenting indent.txt /*javascript-indenting* +job channel.txt /*job* +job-callback channel.txt /*job-callback* +job-channel-overview channel.txt /*job-channel-overview* +job-close_cb channel.txt /*job-close_cb* +job-control channel.txt /*job-control* +job-drop channel.txt /*job-drop* +job-err_cb channel.txt /*job-err_cb* +job-err_io channel.txt /*job-err_io* +job-exit_cb channel.txt /*job-exit_cb* +job-functions usr_41.txt /*job-functions* +job-in_io channel.txt /*job-in_io* +job-options channel.txt /*job-options* +job-out_cb channel.txt /*job-out_cb* +job-out_io channel.txt /*job-out_io* +job-start channel.txt /*job-start* +job-start-if-needed channel.txt /*job-start-if-needed* +job-start-nochannel channel.txt /*job-start-nochannel* +job-stoponexit channel.txt /*job-stoponexit* +job-term channel.txt /*job-term* +job-timeout channel.txt /*job-timeout* +job_getchannel() eval.txt /*job_getchannel()* +job_info() eval.txt /*job_info()* +job_setoptions() eval.txt /*job_setoptions()* +job_start() eval.txt /*job_start()* +job_status() eval.txt /*job_status()* +job_stop() eval.txt /*job_stop()* join() eval.txt /*join()* +js_decode() eval.txt /*js_decode()* +js_encode() eval.txt /*js_encode()* jsbterm-mouse options.txt /*jsbterm-mouse* +json_decode() eval.txt /*json_decode()* +json_encode() eval.txt /*json_encode()* jtags tagsrch.txt /*jtags* jump-motions motion.txt /*jump-motions* jumplist motion.txt /*jumplist* @@ -6743,6 +7282,7 @@ l: eval.txt /*l:* l:var eval.txt /*l:var* lCursor mbyte.txt /*lCursor* lace.vim syntax.txt /*lace.vim* +lambda eval.txt /*lambda* lang-variable eval.txt /*lang-variable* language-mapping map.txt /*language-mapping* last-pattern pattern.txt /*last-pattern* @@ -6755,6 +7295,7 @@ lcs-eol options.txt /*lcs-eol* lcs-extends options.txt /*lcs-extends* lcs-nbsp options.txt /*lcs-nbsp* lcs-precedes options.txt /*lcs-precedes* +lcs-space options.txt /*lcs-space* lcs-tab options.txt /*lcs-tab* lcs-trail options.txt /*lcs-trail* left-right-motions motion.txt /*left-right-motions* @@ -6802,6 +7343,18 @@ location-list quickfix.txt /*location-list* location-list-window quickfix.txt /*location-list-window* log() eval.txt /*log()* log10() eval.txt /*log10()* +logiPat pi_logipat.txt /*logiPat* +logiPat-arg pi_logipat.txt /*logiPat-arg* +logiPat-caveat pi_logipat.txt /*logiPat-caveat* +logiPat-contents pi_logipat.txt /*logiPat-contents* +logiPat-copyright pi_logipat.txt /*logiPat-copyright* +logiPat-examples pi_logipat.txt /*logiPat-examples* +logiPat-history pi_logipat.txt /*logiPat-history* +logiPat-input pi_logipat.txt /*logiPat-input* +logiPat-man pi_logipat.txt /*logiPat-man* +logiPat-manual pi_logipat.txt /*logiPat-manual* +logiPat-operators pi_logipat.txt /*logiPat-operators* +logiPat-pattern pi_logipat.txt /*logiPat-pattern* long-lines version5.txt /*long-lines* love intro.txt /*love* lowercase change.txt /*lowercase* @@ -6810,6 +7363,7 @@ lua if_lua.txt /*lua* lua-buffer if_lua.txt /*lua-buffer* lua-commands if_lua.txt /*lua-commands* lua-dict if_lua.txt /*lua-dict* +lua-dynamic if_lua.txt /*lua-dynamic* lua-eval if_lua.txt /*lua-eval* lua-funcref if_lua.txt /*lua-funcref* lua-list if_lua.txt /*lua-list* @@ -6828,9 +7382,11 @@ m` motion.txt /*m`* mac os_mac.txt /*mac* mac-bug os_mac.txt /*mac-bug* mac-compile os_mac.txt /*mac-compile* +mac-darwin-feature os_mac.txt /*mac-darwin-feature* mac-faq os_mac.txt /*mac-faq* mac-filename os_mac.txt /*mac-filename* mac-lack os_mac.txt /*mac-lack* +mac-standard-mappings os_mac.txt /*mac-standard-mappings* mac-vimfile os_mac.txt /*mac-vimfile* macintosh os_mac.txt /*macintosh* macro map.txt /*macro* @@ -6871,12 +7427,18 @@ mail.vim syntax.txt /*mail.vim* maillist intro.txt /*maillist* maillist-archive intro.txt /*maillist-archive* make.vim syntax.txt /*make.vim* +man.vim filetype.txt /*man.vim* +manpager.vim filetype.txt /*manpager.vim* manual-copyright usr_01.txt /*manual-copyright* map() eval.txt /*map()* map-<SID> map.txt /*map-<SID>* +map-CTRL-C map.txt /*map-CTRL-C* map-ambiguous map.txt /*map-ambiguous* +map-backslash map.txt /*map-backslash* map-backtick tips.txt /*map-backtick* +map-bar map.txt /*map-bar* map-comments map.txt /*map-comments* +map-empty-rhs map.txt /*map-empty-rhs* map-error map.txt /*map-error* map-examples map.txt /*map-examples* map-keys-fails map.txt /*map-keys-fails* @@ -6885,7 +7447,10 @@ map-modes map.txt /*map-modes* map-multibyte map.txt /*map-multibyte* map-overview map.txt /*map-overview* map-precedence map.txt /*map-precedence* +map-return map.txt /*map-return* map-self-destroy tips.txt /*map-self-destroy* +map-space_in_lhs map.txt /*map-space_in_lhs* +map-space_in_rhs map.txt /*map-space_in_rhs* map-typing map.txt /*map-typing* map-which-keys map.txt /*map-which-keys* map.txt map.txt /*map.txt* @@ -6909,6 +7474,7 @@ mapmode-n map.txt /*mapmode-n* mapmode-nvo map.txt /*mapmode-nvo* mapmode-o map.txt /*mapmode-o* mapmode-s map.txt /*mapmode-s* +mapmode-t map.txt /*mapmode-t* mapmode-v map.txt /*mapmode-v* mapmode-x map.txt /*mapmode-x* mapping map.txt /*mapping* @@ -6930,6 +7496,7 @@ matchit-install usr_05.txt /*matchit-install* matchlist() eval.txt /*matchlist()* matchparen pi_paren.txt /*matchparen* matchstr() eval.txt /*matchstr()* +matchstrpos() eval.txt /*matchstrpos()* max() eval.txt /*max()* mbyte-IME mbyte.txt /*mbyte-IME* mbyte-XIM mbyte.txt /*mbyte-XIM* @@ -6940,6 +7507,7 @@ mbyte-encoding mbyte.txt /*mbyte-encoding* mbyte-first mbyte.txt /*mbyte-first* mbyte-fonts-MSwin mbyte.txt /*mbyte-fonts-MSwin* mbyte-fonts-X11 mbyte.txt /*mbyte-fonts-X11* +mbyte-func mbyte.txt /*mbyte-func* mbyte-keymap mbyte.txt /*mbyte-keymap* mbyte-locale mbyte.txt /*mbyte-locale* mbyte-options mbyte.txt /*mbyte-options* @@ -6958,7 +7526,6 @@ message.txt message.txt /*message.txt* messages message.txt /*messages* meta intro.txt /*meta* min() eval.txt /*min()* -minimal-features os_msdos.txt /*minimal-features* missing-options vi_diff.txt /*missing-options* mkdir() eval.txt /*mkdir()* mlang.txt mlang.txt /*mlang.txt* @@ -6986,21 +7553,10 @@ mouse-using term.txt /*mouse-using* mouse_col-variable eval.txt /*mouse_col-variable* mouse_lnum-variable eval.txt /*mouse_lnum-variable* mouse_win-variable eval.txt /*mouse_win-variable* +mouse_winid-variable eval.txt /*mouse_winid-variable* movement intro.txt /*movement* ms-dos os_msdos.txt /*ms-dos* msdos os_msdos.txt /*msdos* -msdos-arrows os_msdos.txt /*msdos-arrows* -msdos-clipboard-limits os_msdos.txt /*msdos-clipboard-limits* -msdos-compiling os_msdos.txt /*msdos-compiling* -msdos-copy-paste os_msdos.txt /*msdos-copy-paste* -msdos-fname-extensions os_msdos.txt /*msdos-fname-extensions* -msdos-limitations os_msdos.txt /*msdos-limitations* -msdos-linked-files os_msdos.txt /*msdos-linked-files* -msdos-longfname os_msdos.txt /*msdos-longfname* -msdos-mode gui_w32.txt /*msdos-mode* -msdos-problems os_msdos.txt /*msdos-problems* -msdos-termcap os_msdos.txt /*msdos-termcap* -msdos-versions os_msdos.txt /*msdos-versions* msql.vim syntax.txt /*msql.vim* mswin.vim gui_w32.txt /*mswin.vim* multi-byte mbyte.txt /*multi-byte* @@ -7030,11 +7586,13 @@ mzscheme-examples if_mzsch.txt /*mzscheme-examples* mzscheme-funcref if_mzsch.txt /*mzscheme-funcref* mzscheme-mzeval if_mzsch.txt /*mzscheme-mzeval* mzscheme-sandbox if_mzsch.txt /*mzscheme-sandbox* +mzscheme-setup if_mzsch.txt /*mzscheme-setup* mzscheme-threads if_mzsch.txt /*mzscheme-threads* mzscheme-vim if_mzsch.txt /*mzscheme-vim* mzscheme-vimext if_mzsch.txt /*mzscheme-vimext* mzscheme-window if_mzsch.txt /*mzscheme-window* n pattern.txt /*n* +n1ql.vim syntax.txt /*n1ql.vim* nasm.vim syntax.txt /*nasm.vim* navigation motion.txt /*navigation* nb-commands netbeans.txt /*nb-commands* @@ -7071,14 +7629,22 @@ netrw-:Hexplore pi_netrw.txt /*netrw-:Hexplore* netrw-:Lexplore pi_netrw.txt /*netrw-:Lexplore* netrw-:MF pi_netrw.txt /*netrw-:MF* netrw-:MT pi_netrw.txt /*netrw-:MT* +netrw-:NetrwC pi_netrw.txt /*netrw-:NetrwC* +netrw-:NetrwMB pi_netrw.txt /*netrw-:NetrwMB* netrw-:Rexplore pi_netrw.txt /*netrw-:Rexplore* netrw-:Sexplore pi_netrw.txt /*netrw-:Sexplore* netrw-:Texplore pi_netrw.txt /*netrw-:Texplore* netrw-:Vexplore pi_netrw.txt /*netrw-:Vexplore* netrw-C pi_netrw.txt /*netrw-C* netrw-D pi_netrw.txt /*netrw-D* +netrw-I pi_netrw.txt /*netrw-I* netrw-O pi_netrw.txt /*netrw-O* netrw-P pi_netrw.txt /*netrw-P* +netrw-P18 pi_netrw.txt /*netrw-P18* +netrw-P19 pi_netrw.txt /*netrw-P19* +netrw-P20 pi_netrw.txt /*netrw-P20* +netrw-P21 pi_netrw.txt /*netrw-P21* +netrw-P22 pi_netrw.txt /*netrw-P22* netrw-R pi_netrw.txt /*netrw-R* netrw-S pi_netrw.txt /*netrw-S* netrw-Tb pi_netrw.txt /*netrw-Tb* @@ -7098,7 +7664,12 @@ netrw-browser-settings pi_netrw.txt /*netrw-browser-settings* netrw-browser-var pi_netrw.txt /*netrw-browser-var* netrw-browsing pi_netrw.txt /*netrw-browsing* netrw-c pi_netrw.txt /*netrw-c* +netrw-c-tab pi_netrw.txt /*netrw-c-tab* +netrw-cB pi_netrw.txt /*netrw-cB* netrw-cadaver pi_netrw.txt /*netrw-cadaver* +netrw-call pi_netrw.txt /*netrw-call* +netrw-cb pi_netrw.txt /*netrw-cb* +netrw-cd pi_netrw.txt /*netrw-cd* netrw-chgup pi_netrw.txt /*netrw-chgup* netrw-clean pi_netrw.txt /*netrw-clean* netrw-contents pi_netrw.txt /*netrw-contents* @@ -7108,6 +7679,7 @@ netrw-createfile pi_netrw.txt /*netrw-createfile* netrw-credits pi_netrw.txt /*netrw-credits* netrw-ctrl-h pi_netrw.txt /*netrw-ctrl-h* netrw-ctrl-l pi_netrw.txt /*netrw-ctrl-l* +netrw-ctrl-r pi_netrw.txt /*netrw-ctrl-r* netrw-ctrl_l pi_netrw.txt /*netrw-ctrl_l* netrw-curdir pi_netrw.txt /*netrw-curdir* netrw-d pi_netrw.txt /*netrw-d* @@ -7118,9 +7690,12 @@ netrw-dir pi_netrw.txt /*netrw-dir* netrw-dirlist pi_netrw.txt /*netrw-dirlist* netrw-downdir pi_netrw.txt /*netrw-downdir* netrw-edithide pi_netrw.txt /*netrw-edithide* +netrw-editwindow pi_netrw.txt /*netrw-editwindow* +netrw-enter pi_netrw.txt /*netrw-enter* netrw-ex pi_netrw.txt /*netrw-ex* netrw-explore pi_netrw.txt /*netrw-explore* netrw-explore-cmds pi_netrw.txt /*netrw-explore-cmds* +netrw-expose pi_netrw.txt /*netrw-expose* netrw-externapp pi_netrw.txt /*netrw-externapp* netrw-file pi_netrw.txt /*netrw-file* netrw-filigree pi_netrw.txt /*netrw-filigree* @@ -7133,7 +7708,9 @@ netrw-getftype pi_netrw.txt /*netrw-getftype* netrw-gf pi_netrw.txt /*netrw-gf* netrw-gh pi_netrw.txt /*netrw-gh* netrw-gitignore pi_netrw.txt /*netrw-gitignore* +netrw-gn pi_netrw.txt /*netrw-gn* netrw-gp pi_netrw.txt /*netrw-gp* +netrw-grep pi_netrw.txt /*netrw-grep* netrw-gx pi_netrw.txt /*netrw-gx* netrw-handler pi_netrw.txt /*netrw-handler* netrw-help pi_netrw.txt /*netrw-help* @@ -7152,9 +7729,12 @@ netrw-list pi_netrw.txt /*netrw-list* netrw-listbookmark pi_netrw.txt /*netrw-listbookmark* netrw-listhack pi_netrw.txt /*netrw-listhack* netrw-login pi_netrw.txt /*netrw-login* +netrw-mA pi_netrw.txt /*netrw-mA* netrw-mB pi_netrw.txt /*netrw-mB* netrw-mF pi_netrw.txt /*netrw-mF* netrw-mT pi_netrw.txt /*netrw-mT* +netrw-mX pi_netrw.txt /*netrw-mX* +netrw-ma pi_netrw.txt /*netrw-ma* netrw-mb pi_netrw.txt /*netrw-mb* netrw-mc pi_netrw.txt /*netrw-mc* netrw-md pi_netrw.txt /*netrw-md* @@ -7165,6 +7745,7 @@ netrw-mh pi_netrw.txt /*netrw-mh* netrw-middlemouse pi_netrw.txt /*netrw-middlemouse* netrw-ml_get pi_netrw.txt /*netrw-ml_get* netrw-mm pi_netrw.txt /*netrw-mm* +netrw-modify pi_netrw.txt /*netrw-modify* netrw-mouse pi_netrw.txt /*netrw-mouse* netrw-move pi_netrw.txt /*netrw-move* netrw-mp pi_netrw.txt /*netrw-mp* @@ -7172,15 +7753,18 @@ netrw-mr pi_netrw.txt /*netrw-mr* netrw-ms pi_netrw.txt /*netrw-ms* netrw-mt pi_netrw.txt /*netrw-mt* netrw-mu pi_netrw.txt /*netrw-mu* +netrw-mv pi_netrw.txt /*netrw-mv* netrw-mx pi_netrw.txt /*netrw-mx* netrw-mz pi_netrw.txt /*netrw-mz* netrw-netrc pi_netrw.txt /*netrw-netrc* +netrw-newfile pi_netrw.txt /*netrw-newfile* netrw-nexplore pi_netrw.txt /*netrw-nexplore* netrw-noload pi_netrw.txt /*netrw-noload* netrw-nread pi_netrw.txt /*netrw-nread* netrw-ntree pi_netrw.txt /*netrw-ntree* netrw-nwrite pi_netrw.txt /*netrw-nwrite* netrw-o pi_netrw.txt /*netrw-o* +netrw-obtain pi_netrw.txt /*netrw-obtain* netrw-options pi_netrw.txt /*netrw-options* netrw-p pi_netrw.txt /*netrw-p* netrw-p1 pi_netrw.txt /*netrw-p1* @@ -7191,6 +7775,7 @@ netrw-p13 pi_netrw.txt /*netrw-p13* netrw-p14 pi_netrw.txt /*netrw-p14* netrw-p15 pi_netrw.txt /*netrw-p15* netrw-p16 pi_netrw.txt /*netrw-p16* +netrw-p17 pi_netrw.txt /*netrw-p17* netrw-p2 pi_netrw.txt /*netrw-p2* netrw-p3 pi_netrw.txt /*netrw-p3* netrw-p4 pi_netrw.txt /*netrw-p4* @@ -7211,6 +7796,7 @@ netrw-pscp pi_netrw.txt /*netrw-pscp* netrw-psftp pi_netrw.txt /*netrw-psftp* netrw-putty pi_netrw.txt /*netrw-putty* netrw-qF pi_netrw.txt /*netrw-qF* +netrw-qL pi_netrw.txt /*netrw-qL* netrw-qb pi_netrw.txt /*netrw-qb* netrw-qf pi_netrw.txt /*netrw-qf* netrw-quickcom pi_netrw.txt /*netrw-quickcom* @@ -7221,11 +7807,13 @@ netrw-quickmaps pi_netrw.txt /*netrw-quickmaps* netrw-r pi_netrw.txt /*netrw-r* netrw-read pi_netrw.txt /*netrw-read* netrw-ref pi_netrw.txt /*netrw-ref* +netrw-refresh pi_netrw.txt /*netrw-refresh* netrw-rename pi_netrw.txt /*netrw-rename* netrw-reverse pi_netrw.txt /*netrw-reverse* netrw-rexplore pi_netrw.txt /*netrw-rexplore* netrw-rightmouse pi_netrw.txt /*netrw-rightmouse* netrw-s pi_netrw.txt /*netrw-s* +netrw-s-cr pi_netrw.txt /*netrw-s-cr* netrw-settings pi_netrw.txt /*netrw-settings* netrw-settings-window pi_netrw.txt /*netrw-settings-window* netrw-sexplore pi_netrw.txt /*netrw-sexplore* @@ -7247,6 +7835,7 @@ netrw-transparent pi_netrw.txt /*netrw-transparent* netrw-u pi_netrw.txt /*netrw-u* netrw-updir pi_netrw.txt /*netrw-updir* netrw-urls pi_netrw.txt /*netrw-urls* +netrw-usermaps pi_netrw.txt /*netrw-usermaps* netrw-userpass pi_netrw.txt /*netrw-userpass* netrw-v pi_netrw.txt /*netrw-v* netrw-var pi_netrw.txt /*netrw-var* @@ -7264,6 +7853,7 @@ network pi_netrw.txt /*network* new-5 version5.txt /*new-5* new-6 version6.txt /*new-6* new-7 version7.txt /*new-7* +new-8 version8.txt /*new-8* new-GTK-GUI version5.txt /*new-GTK-GUI* new-MzScheme version7.txt /*new-MzScheme* new-Select-mode version5.txt /*new-Select-mode* @@ -7296,6 +7886,7 @@ new-highlighting version5.txt /*new-highlighting* new-indent-flex version6.txt /*new-indent-flex* new-items-6 version6.txt /*new-items-6* new-items-7 version7.txt /*new-items-7* +new-items-8 version8.txt /*new-items-8* new-line-continuation version5.txt /*new-line-continuation* new-location-list version7.txt /*new-location-list* new-lua version7.txt /*new-lua* @@ -7330,7 +7921,9 @@ new-search-path version6.txt /*new-search-path* new-searchpat version6.txt /*new-searchpat* new-session-files version5.txt /*new-session-files* new-spell version7.txt /*new-spell* +new-style-testing eval.txt /*new-style-testing* new-tab-pages version7.txt /*new-tab-pages* +new-terminal-window version8.txt /*new-terminal-window* new-undo-branches version7.txt /*new-undo-branches* new-unlisted-buffers version6.txt /*new-unlisted-buffers* new-user-defined version5.txt /*new-user-defined* @@ -7338,6 +7931,7 @@ new-user-manual version6.txt /*new-user-manual* new-utf-8 version6.txt /*new-utf-8* new-vertsplit version6.txt /*new-vertsplit* new-vim-script version7.txt /*new-vim-script* +new-vim-script-8 version8.txt /*new-vim-script-8* new-vim-server version6.txt /*new-vim-server* new-vimgrep version7.txt /*new-vimgrep* new-virtedit version6.txt /*new-virtedit* @@ -7345,9 +7939,14 @@ news intro.txt /*news* nextnonblank() eval.txt /*nextnonblank()* nice todo.txt /*nice* no-eval-feature eval.txt /*no-eval-feature* +no-type-checking eval.txt /*no-type-checking* no_buffers_menu gui.txt /*no_buffers_menu* +no_mail_maps filetype.txt /*no_mail_maps* +no_plugin_maps filetype.txt /*no_plugin_maps* +nocombine syntax.txt /*nocombine* non-greedy pattern.txt /*non-greedy* non-zero-arg eval.txt /*non-zero-arg* +none-variable eval.txt /*none-variable* normal-index index.txt /*normal-index* not-compatible usr_01.txt /*not-compatible* not-edited editing.txt /*not-edited* @@ -7355,6 +7954,7 @@ notation intro.txt /*notation* notepad gui_w32.txt /*notepad* nr2char() eval.txt /*nr2char()* nroff.vim syntax.txt /*nroff.vim* +null-variable eval.txt /*null-variable* number_relativenumber options.txt /*number_relativenumber* numbered-function eval.txt /*numbered-function* o insert.txt /*o* @@ -7370,6 +7970,7 @@ octal eval.txt /*octal* octal-nrformats options.txt /*octal-nrformats* octal-number eval.txt /*octal-number* odbeditor gui_mac.txt /*odbeditor* +old-style-testing eval.txt /*old-style-testing* oldfiles-variable eval.txt /*oldfiles-variable* ole-activation if_ole.txt /*ole-activation* ole-eval if_ole.txt /*ole-eval* @@ -7390,14 +7991,16 @@ option-backslash options.txt /*option-backslash* option-list quickref.txt /*option-list* option-summary options.txt /*option-summary* option-window options.txt /*option-window* +option_restore() todo.txt /*option_restore()* +option_save() todo.txt /*option_save()* options options.txt /*options* options-changed version5.txt /*options-changed* +options-in-terminal terminal.txt /*options-in-terminal* options.txt options.txt /*options.txt* optwin options.txt /*optwin* or() eval.txt /*or()* oracle ft_sql.txt /*oracle* os2 os_os2.txt /*os2* -os2ansi os_os2.txt /*os2ansi* os390 os_390.txt /*os390* os_390.txt os_390.txt /*os_390.txt* os_amiga.txt os_amiga.txt /*os_amiga.txt* @@ -7413,7 +8016,19 @@ os_unix.txt os_unix.txt /*os_unix.txt* os_vms.txt os_vms.txt /*os_vms.txt* os_win32.txt os_win32.txt /*os_win32.txt* other-features vi_diff.txt /*other-features* +out_buf channel.txt /*out_buf* +out_cb channel.txt /*out_cb* +out_io-buffer channel.txt /*out_io-buffer* +out_mode channel.txt /*out_mode* +out_modifiable channel.txt /*out_modifiable* +out_msg channel.txt /*out_msg* +out_name channel.txt /*out_name* +out_timeout channel.txt /*out_timeout* p change.txt /*p* +pack-add repeat.txt /*pack-add* +package-create repeat.txt /*package-create* +packages repeat.txt /*packages* +packload-two-steps repeat.txt /*packload-two-steps* page-down intro.txt /*page-down* page-up intro.txt /*page-up* page_down intro.txt /*page_down* @@ -7422,6 +8037,8 @@ pager message.txt /*pager* papp.vim syntax.txt /*papp.vim* paragraph motion.txt /*paragraph* pascal.vim syntax.txt /*pascal.vim* +patches-8 version8.txt /*patches-8* +patches-8.1 version8.txt /*patches-8.1* pathshorten() eval.txt /*pathshorten()* pattern pattern.txt /*pattern* pattern-atoms pattern.txt /*pattern-atoms* @@ -7458,6 +8075,7 @@ perl-overview if_perl.txt /*perl-overview* perl-patterns pattern.txt /*perl-patterns* perl-using if_perl.txt /*perl-using* perl.vim syntax.txt /*perl.vim* +perleval() eval.txt /*perleval()* persistent-undo undo.txt /*persistent-undo* pexpr-option print.txt /*pexpr-option* pfn-option print.txt /*pfn-option* @@ -7472,6 +8090,7 @@ php3.vim syntax.txt /*php3.vim* phtml.vim syntax.txt /*phtml.vim* pi_getscript.txt pi_getscript.txt /*pi_getscript.txt* pi_gzip.txt pi_gzip.txt /*pi_gzip.txt* +pi_logipat.txt pi_logipat.txt /*pi_logipat.txt* pi_netrw.txt pi_netrw.txt /*pi_netrw.txt* pi_paren.txt pi_paren.txt /*pi_paren.txt* pi_spec.txt pi_spec.txt /*pi_spec.txt* @@ -7516,9 +8135,12 @@ print-options print.txt /*print-options* print.txt print.txt /*print.txt* printf() eval.txt /*printf()* printf-% eval.txt /*printf-%* +printf-B eval.txt /*printf-B* printf-E eval.txt /*printf-E* printf-G eval.txt /*printf-G* +printf-S eval.txt /*printf-S* printf-X eval.txt /*printf-X* +printf-b eval.txt /*printf-b* printf-c eval.txt /*printf-c* printf-d eval.txt /*printf-d* printf-e eval.txt /*printf-e* @@ -7556,6 +8178,7 @@ python-bindeval if_pyth.txt /*python-bindeval* python-bindeval-objects if_pyth.txt /*python-bindeval-objects* python-buffer if_pyth.txt /*python-buffer* python-buffers if_pyth.txt /*python-buffers* +python-building if_pyth.txt /*python-building* python-chdir if_pyth.txt /*python-chdir* python-command if_pyth.txt /*python-command* python-commands if_pyth.txt /*python-commands* @@ -7586,7 +8209,11 @@ python.vim syntax.txt /*python.vim* python2-directory if_pyth.txt /*python2-directory* python3 if_pyth.txt /*python3* python3-directory if_pyth.txt /*python3-directory* +python_x if_pyth.txt /*python_x* +python_x-special-comments if_pyth.txt /*python_x-special-comments* +pythonx if_pyth.txt /*pythonx* pythonx-directory if_pyth.txt /*pythonx-directory* +pyxeval() eval.txt /*pyxeval()* q repeat.txt /*q* q/ cmdline.txt /*q\/* q: cmdline.txt /*q:* @@ -7598,14 +8225,21 @@ qnx-terminal os_qnx.txt /*qnx-terminal* quake.vim syntax.txt /*quake.vim* quickfix quickfix.txt /*quickfix* quickfix-6 version6.txt /*quickfix-6* +quickfix-ID quickfix.txt /*quickfix-ID* +quickfix-changedtick quickfix.txt /*quickfix-changedtick* +quickfix-context quickfix.txt /*quickfix-context* quickfix-directory-stack quickfix.txt /*quickfix-directory-stack* quickfix-error-lists quickfix.txt /*quickfix-error-lists* quickfix-functions usr_41.txt /*quickfix-functions* quickfix-gcc quickfix.txt /*quickfix-gcc* quickfix-manx quickfix.txt /*quickfix-manx* +quickfix-parse quickfix.txt /*quickfix-parse* quickfix-perl quickfix.txt /*quickfix-perl* +quickfix-size quickfix.txt /*quickfix-size* +quickfix-title quickfix.txt /*quickfix-title* quickfix-valid quickfix.txt /*quickfix-valid* quickfix-window quickfix.txt /*quickfix-window* +quickfix-window-ID quickfix.txt /*quickfix-window-ID* quickfix.txt quickfix.txt /*quickfix.txt* quickref quickref.txt /*quickref* quickref.txt quickref.txt /*quickref.txt* @@ -7648,6 +8282,7 @@ r change.txt /*r* range() eval.txt /*range()* raw-terminal-mode term.txt /*raw-terminal-mode* rcp pi_netrw.txt /*rcp* +read-in-close-cb channel.txt /*read-in-close-cb* read-messages insert.txt /*read-messages* read-only-share editing.txt /*read-only-share* read-stdin version5.txt /*read-stdin* @@ -7662,6 +8297,8 @@ redo-register undo.txt /*redo-register* ref intro.txt /*ref* reference intro.txt /*reference* reference_toc help.txt /*reference_toc* +reg_executing() eval.txt /*reg_executing()* +reg_recording() eval.txt /*reg_recording()* regexp pattern.txt /*regexp* regexp-changes-5.4 version5.txt /*regexp-changes-5.4* register sponsor.txt /*register* @@ -7671,6 +8308,7 @@ registers change.txt /*registers* regular-expression pattern.txt /*regular-expression* reload editing.txt /*reload* reltime() eval.txt /*reltime()* +reltimefloat() eval.txt /*reltimefloat()* reltimestr() eval.txt /*reltimestr()* remote.txt remote.txt /*remote.txt* remote_expr() eval.txt /*remote_expr()* @@ -7678,6 +8316,7 @@ remote_foreground() eval.txt /*remote_foreground()* remote_peek() eval.txt /*remote_peek()* remote_read() eval.txt /*remote_read()* remote_send() eval.txt /*remote_send()* +remote_startserver() eval.txt /*remote_startserver()* remove() eval.txt /*remove()* remove-filetype filetype.txt /*remove-filetype* remove-option-flags options.txt /*remove-option-flags* @@ -7720,12 +8359,26 @@ ruby-set_option if_ruby.txt /*ruby-set_option* ruby-vim if_ruby.txt /*ruby-vim* ruby-window if_ruby.txt /*ruby-window* ruby.vim syntax.txt /*ruby.vim* +ruby_fold syntax.txt /*ruby_fold* +ruby_foldable_groups syntax.txt /*ruby_foldable_groups* +ruby_minlines syntax.txt /*ruby_minlines* +ruby_no_expensive syntax.txt /*ruby_no_expensive* +ruby_operators syntax.txt /*ruby_operators* +ruby_space_errors syntax.txt /*ruby_space_errors* +ruby_spellcheck_strings syntax.txt /*ruby_spellcheck_strings* russian russian.txt /*russian* russian-intro russian.txt /*russian-intro* russian-issues russian.txt /*russian-issues* russian-keymap russian.txt /*russian-keymap* russian-l18n russian.txt /*russian-l18n* russian.txt russian.txt /*russian.txt* +rust ft_rust.txt /*rust* +rust-commands ft_rust.txt /*rust-commands* +rust-intro ft_rust.txt /*rust-intro* +rust-mappings ft_rust.txt /*rust-mappings* +rust-settings ft_rust.txt /*rust-settings* +rust_<D-R> ft_rust.txt /*rust_<D-R>* +rust_<D-r> ft_rust.txt /*rust_<D-r>* rview starting.txt /*rview* rvim starting.txt /*rvim* rxvt syntax.txt /*rxvt* @@ -7810,13 +8463,17 @@ servername-variable eval.txt /*servername-variable* session-file starting.txt /*session-file* set-option options.txt /*set-option* set-spc-auto spell.txt /*set-spc-auto* +setbufline() eval.txt /*setbufline()* setbufvar() eval.txt /*setbufvar()* +setcharsearch() eval.txt /*setcharsearch()* setcmdpos() eval.txt /*setcmdpos()* +setfperm() eval.txt /*setfperm()* setline() eval.txt /*setline()* setloclist() eval.txt /*setloclist()* setmatches() eval.txt /*setmatches()* setpos() eval.txt /*setpos()* setqflist() eval.txt /*setqflist()* +setqflist-examples quickfix.txt /*setqflist-examples* setreg() eval.txt /*setreg()* settabvar() eval.txt /*settabvar()* settabwinvar() eval.txt /*settabwinvar()* @@ -7852,15 +8509,12 @@ sin() eval.txt /*sin()* single-repeat repeat.txt /*single-repeat* sinh() eval.txt /*sinh()* skeleton autocmd.txt /*skeleton* +skip_defaults_vim starting.txt /*skip_defaults_vim* slice eval.txt /*slice* slow-fast-terminal term.txt /*slow-fast-terminal* slow-start starting.txt /*slow-start* slow-terminal term.txt /*slow-terminal* -sniff if_sniff.txt /*sniff* -sniff-commands if_sniff.txt /*sniff-commands* -sniff-compiling if_sniff.txt /*sniff-compiling* -sniff-intro if_sniff.txt /*sniff-intro* -socket-interface netbeans.txt /*socket-interface* +socket-interface channel.txt /*socket-interface* sort() eval.txt /*sort()* sorting change.txt /*sorting* soundfold() eval.txt /*soundfold()* @@ -7907,6 +8561,7 @@ spell-FLAG spell.txt /*spell-FLAG* spell-FOL spell.txt /*spell-FOL* spell-FORBIDDENWORD spell.txt /*spell-FORBIDDENWORD* spell-HOME spell.txt /*spell-HOME* +spell-IGNOREEXTRA spell.txt /*spell-IGNOREEXTRA* spell-KEEPCASE spell.txt /*spell-KEEPCASE* spell-KEY spell.txt /*spell-KEY* spell-LANG spell.txt /*spell-LANG* @@ -7918,6 +8573,7 @@ spell-NAME spell.txt /*spell-NAME* spell-NEEDAFFIX spell.txt /*spell-NEEDAFFIX* spell-NEEDCOMPOUND spell.txt /*spell-NEEDCOMPOUND* spell-NOBREAK spell.txt /*spell-NOBREAK* +spell-NOCOMPOUNDSUGS spell.txt /*spell-NOCOMPOUNDSUGS* spell-NOSPLITSUGS spell.txt /*spell-NOSPLITSUGS* spell-NOSUGFILE spell.txt /*spell-NOSUGFILE* spell-NOSUGGEST spell.txt /*spell-NOSUGGEST* @@ -8015,6 +8671,7 @@ star pattern.txt /*star* starstar editing.txt /*starstar* starstar-wildcard editing.txt /*starstar-wildcard* start-of-file pattern.txt /*start-of-file* +start-vimdiff diff.txt /*start-vimdiff* starting starting.txt /*starting* starting-amiga starting.txt /*starting-amiga* starting.txt starting.txt /*starting.txt* @@ -8024,16 +8681,18 @@ startup-terminal term.txt /*startup-terminal* static-tag tagsrch.txt /*static-tag* status-line windows.txt /*status-line* statusmsg-variable eval.txt /*statusmsg-variable* -sticky-type-checking eval.txt /*sticky-type-checking* str2float() eval.txt /*str2float()* str2nr() eval.txt /*str2nr()* strcasestr() eval.txt /*strcasestr()* +strcharpart() eval.txt /*strcharpart()* strchars() eval.txt /*strchars()* strchr() eval.txt /*strchr()* strcspn() eval.txt /*strcspn()* strdisplaywidth() eval.txt /*strdisplaywidth()* strftime() eval.txt /*strftime()* +strgetchar() eval.txt /*strgetchar()* stridx() eval.txt /*stridx()* +strikethrough syntax.txt /*strikethrough* string eval.txt /*string* string() eval.txt /*string()* string-functions usr_41.txt /*string-functions* @@ -8048,6 +8707,7 @@ strstr() eval.txt /*strstr()* strtrans() eval.txt /*strtrans()* strwidth() eval.txt /*strwidth()* style-changes develop.txt /*style-changes* +style-compiler develop.txt /*style-compiler* style-examples develop.txt /*style-examples* style-functions develop.txt /*style-functions* style-names develop.txt /*style-names* @@ -8060,6 +8720,7 @@ sub-replace-special change.txt /*sub-replace-special* sublist eval.txt /*sublist* submatch() eval.txt /*submatch()* subscribe-maillist intro.txt /*subscribe-maillist* +subscript eval.txt /*subscript* substitute() eval.txt /*substitute()* substitute-CR version6.txt /*substitute-CR* suffixes cmdline.txt /*suffixes* @@ -8109,16 +8770,23 @@ t_#4 term.txt /*t_#4* t_%1 term.txt /*t_%1* t_%i term.txt /*t_%i* t_&8 term.txt /*t_&8* +t_8b term.txt /*t_8b* +t_8f term.txt /*t_8f* t_@7 term.txt /*t_@7* t_AB term.txt /*t_AB* t_AF term.txt /*t_AF* t_AL term.txt /*t_AL* +t_BD term.txt /*t_BD* +t_BE term.txt /*t_BE* t_CS term.txt /*t_CS* +t_CTRL-W_CTRL-C terminal.txt /*t_CTRL-W_CTRL-C* +t_CTRL-\_CTRL-N terminal.txt /*t_CTRL-\\_CTRL-N* t_CV term.txt /*t_CV* t_Ce term.txt /*t_Ce* t_Co term.txt /*t_Co* t_Cs term.txt /*t_Cs* t_DL term.txt /*t_DL* +t_EC term.txt /*t_EC* t_EI term.txt /*t_EI* t_F1 term.txt /*t_F1* t_F2 term.txt /*t_F2* @@ -8129,6 +8797,7 @@ t_F6 term.txt /*t_F6* t_F7 term.txt /*t_F7* t_F8 term.txt /*t_F8* t_F9 term.txt /*t_F9* +t_GP term.txt /*t_GP* t_IE term.txt /*t_IE* t_IS term.txt /*t_IS* t_K1 term.txt /*t_K1* @@ -8151,20 +8820,34 @@ t_KI term.txt /*t_KI* t_KJ term.txt /*t_KJ* t_KK term.txt /*t_KK* t_KL term.txt /*t_KL* +t_PE term.txt /*t_PE* +t_PS term.txt /*t_PS* +t_RB term.txt /*t_RB* +t_RC term.txt /*t_RC* +t_RF term.txt /*t_RF* t_RI term.txt /*t_RI* +t_RS term.txt /*t_RS* t_RV term.txt /*t_RV* +t_SC term.txt /*t_SC* +t_SH term.txt /*t_SH* t_SI term.txt /*t_SI* +t_SR term.txt /*t_SR* t_Sb term.txt /*t_Sb* t_Sf term.txt /*t_Sf* +t_Te term.txt /*t_Te* +t_Ts term.txt /*t_Ts* +t_VS term.txt /*t_VS* t_WP term.txt /*t_WP* t_WS term.txt /*t_WS* t_ZH term.txt /*t_ZH* t_ZR term.txt /*t_ZR* t_al term.txt /*t_al* t_bc term.txt /*t_bc* +t_bool-variable eval.txt /*t_bool-variable* t_cd term.txt /*t_cd* t_cdl version4.txt /*t_cdl* t_ce term.txt /*t_ce* +t_channel-variable eval.txt /*t_channel-variable* t_ci version4.txt /*t_ci* t_cil version4.txt /*t_cil* t_cl term.txt /*t_cl* @@ -8176,6 +8859,7 @@ t_cv version4.txt /*t_cv* t_cvv version4.txt /*t_cvv* t_da term.txt /*t_da* t_db term.txt /*t_db* +t_dict-variable eval.txt /*t_dict-variable* t_dl term.txt /*t_dl* t_ed version4.txt /*t_ed* t_el version4.txt /*t_el* @@ -8189,9 +8873,12 @@ t_f6 version4.txt /*t_f6* t_f7 version4.txt /*t_f7* t_f8 version4.txt /*t_f8* t_f9 version4.txt /*t_f9* +t_float-variable eval.txt /*t_float-variable* t_fs term.txt /*t_fs* +t_func-variable eval.txt /*t_func-variable* t_help version4.txt /*t_help* t_il version4.txt /*t_il* +t_job-variable eval.txt /*t_job-variable* t_k1 term.txt /*t_k1* t_k2 term.txt /*t_k2* t_k3 term.txt /*t_k3* @@ -8216,12 +8903,15 @@ t_kr term.txt /*t_kr* t_ks term.txt /*t_ks* t_ku term.txt /*t_ku* t_le term.txt /*t_le* +t_list-variable eval.txt /*t_list-variable* t_mb term.txt /*t_mb* t_md term.txt /*t_md* t_me term.txt /*t_me* t_mr term.txt /*t_mr* t_ms term.txt /*t_ms* t_nd term.txt /*t_nd* +t_none-variable eval.txt /*t_none-variable* +t_number-variable eval.txt /*t_number-variable* t_op term.txt /*t_op* t_se term.txt /*t_se* t_sf1 version4.txt /*t_sf1* @@ -8241,6 +8931,7 @@ t_sku version4.txt /*t_sku* t_so term.txt /*t_so* t_sr term.txt /*t_sr* t_star7 term.txt /*t_star7* +t_string-variable eval.txt /*t_string-variable* t_tb version4.txt /*t_tb* t_te term.txt /*t_te* t_ti term.txt /*t_ti* @@ -8256,6 +8947,7 @@ t_vb term.txt /*t_vb* t_ve term.txt /*t_ve* t_vi term.txt /*t_vi* t_vs term.txt /*t_vs* +t_xn term.txt /*t_xn* t_xs term.txt /*t_xs* tab intro.txt /*tab* tab-page tabpage.txt /*tab-page* @@ -8263,6 +8955,7 @@ tab-page-commands tabpage.txt /*tab-page-commands* tab-page-intro tabpage.txt /*tab-page-intro* tab-page-other tabpage.txt /*tab-page-other* tabline-menu tabpage.txt /*tabline-menu* +tabnew-autocmd tabpage.txt /*tabnew-autocmd* tabpage tabpage.txt /*tabpage* tabpage-variable eval.txt /*tabpage-variable* tabpage.txt tabpage.txt /*tabpage.txt* @@ -8356,9 +9049,34 @@ temp-file-name eval.txt /*temp-file-name* tempfile change.txt /*tempfile* template autocmd.txt /*template* tempname() eval.txt /*tempname()* +term++close terminal.txt /*term++close* +term++open terminal.txt /*term++open* term-dependent-settings term.txt /*term-dependent-settings* term-list syntax.txt /*term-list* term.txt term.txt /*term.txt* +term_dumpdiff() eval.txt /*term_dumpdiff()* +term_dumpload() eval.txt /*term_dumpload()* +term_dumpwrite() eval.txt /*term_dumpwrite()* +term_getaltscreen() eval.txt /*term_getaltscreen()* +term_getansicolors() eval.txt /*term_getansicolors()* +term_getattr() eval.txt /*term_getattr()* +term_getcursor() eval.txt /*term_getcursor()* +term_getjob() eval.txt /*term_getjob()* +term_getline() eval.txt /*term_getline()* +term_getscrolled() eval.txt /*term_getscrolled()* +term_getsize() eval.txt /*term_getsize()* +term_getstatus() eval.txt /*term_getstatus()* +term_gettitle() eval.txt /*term_gettitle()* +term_gettty() eval.txt /*term_gettty()* +term_list() eval.txt /*term_list()* +term_scrape() eval.txt /*term_scrape()* +term_sendkeys() eval.txt /*term_sendkeys()* +term_setansicolors() eval.txt /*term_setansicolors()* +term_setkill() eval.txt /*term_setkill()* +term_setrestore() eval.txt /*term_setrestore()* +term_setsize() eval.txt /*term_setsize()* +term_start() eval.txt /*term_start()* +term_wait() eval.txt /*term_wait()* termcap term.txt /*termcap* termcap-changed version4.txt /*termcap-changed* termcap-colors term.txt /*termcap-colors* @@ -8366,11 +9084,62 @@ termcap-cursor-color term.txt /*termcap-cursor-color* termcap-cursor-shape term.txt /*termcap-cursor-shape* termcap-options term.txt /*termcap-options* termcap-title term.txt /*termcap-title* +termdebug-commands terminal.txt /*termdebug-commands* +termdebug-communication terminal.txt /*termdebug-communication* +termdebug-customizing terminal.txt /*termdebug-customizing* +termdebug-example terminal.txt /*termdebug-example* +termdebug-starting terminal.txt /*termdebug-starting* +termdebug-stepping terminal.txt /*termdebug-stepping* +termdebug-variables terminal.txt /*termdebug-variables* +termdebug_popup terminal.txt /*termdebug_popup* +termdebug_wide terminal.txt /*termdebug_wide* +terminal terminal.txt /*terminal* +terminal-api terminal.txt /*terminal-api* +terminal-client-server terminal.txt /*terminal-client-server* terminal-colors os_unix.txt /*terminal-colors* +terminal-communication terminal.txt /*terminal-communication* +terminal-cursor-style terminal.txt /*terminal-cursor-style* +terminal-debug terminal.txt /*terminal-debug* +terminal-debugger terminal.txt /*terminal-debugger* +terminal-diff terminal.txt /*terminal-diff* +terminal-diffscreendump terminal.txt /*terminal-diffscreendump* +terminal-dumptest terminal.txt /*terminal-dumptest* +terminal-functions usr_41.txt /*terminal-functions* terminal-info term.txt /*terminal-info* +terminal-key-codes term.txt /*terminal-key-codes* +terminal-ms-windows terminal.txt /*terminal-ms-windows* terminal-options term.txt /*terminal-options* +terminal-output-codes term.txt /*terminal-output-codes* +terminal-resizing terminal.txt /*terminal-resizing* +terminal-screendump terminal.txt /*terminal-screendump* +terminal-session terminal.txt /*terminal-session* +terminal-size-color terminal.txt /*terminal-size-color* +terminal-special-keys terminal.txt /*terminal-special-keys* +terminal-testing terminal.txt /*terminal-testing* +terminal-to-job terminal.txt /*terminal-to-job* +terminal-typing terminal.txt /*terminal-typing* +terminal-unix terminal.txt /*terminal-unix* +terminal-use terminal.txt /*terminal-use* +terminal-window terminal.txt /*terminal-window* +terminal.txt terminal.txt /*terminal.txt* terminfo term.txt /*terminfo* termresponse-variable eval.txt /*termresponse-variable* +test-functions usr_41.txt /*test-functions* +test_alloc_fail() eval.txt /*test_alloc_fail()* +test_autochdir() eval.txt /*test_autochdir()* +test_feedinput() eval.txt /*test_feedinput()* +test_garbagecollect_now() eval.txt /*test_garbagecollect_now()* +test_ignore_error() eval.txt /*test_ignore_error()* +test_null_channel() eval.txt /*test_null_channel()* +test_null_dict() eval.txt /*test_null_dict()* +test_null_job() eval.txt /*test_null_job()* +test_null_list() eval.txt /*test_null_list()* +test_null_partial() eval.txt /*test_null_partial()* +test_null_string() eval.txt /*test_null_string()* +test_override() eval.txt /*test_override()* +test_settime() eval.txt /*test_settime()* +testing eval.txt /*testing* +testing-variable eval.txt /*testing-variable* tex-cchar syntax.txt /*tex-cchar* tex-cole syntax.txt /*tex-cole* tex-conceal syntax.txt /*tex-conceal* @@ -8384,6 +9153,7 @@ tex-runon syntax.txt /*tex-runon* tex-slow syntax.txt /*tex-slow* tex-stopzone syntax.txt /*tex-stopzone* tex-style syntax.txt /*tex-style* +tex-supersub syntax.txt /*tex-supersub* tex-sync syntax.txt /*tex-sync* tex-verb syntax.txt /*tex-verb* tex.vim syntax.txt /*tex.vim* @@ -8399,6 +9169,14 @@ throw-from-catch eval.txt /*throw-from-catch* throw-variables eval.txt /*throw-variables* throwpoint-variable eval.txt /*throwpoint-variable* time-functions usr_41.txt /*time-functions* +timer eval.txt /*timer* +timer-functions usr_41.txt /*timer-functions* +timer_info() eval.txt /*timer_info()* +timer_pause() eval.txt /*timer_pause()* +timer_start() eval.txt /*timer_start()* +timer_stop() eval.txt /*timer_stop()* +timer_stopall() eval.txt /*timer_stopall()* +timers eval.txt /*timers* timestamp editing.txt /*timestamp* timestamps editing.txt /*timestamps* tips tips.txt /*tips* @@ -8411,7 +9189,9 @@ tolower() eval.txt /*tolower()* toolbar-icon gui.txt /*toolbar-icon* toupper() eval.txt /*toupper()* tr() eval.txt /*tr()* +trim() eval.txt /*trim()* trojan-horse starting.txt /*trojan-horse* +true-variable eval.txt /*true-variable* trunc() eval.txt /*trunc()* try-conditionals eval.txt /*try-conditionals* try-echoerr eval.txt /*try-echoerr* @@ -8441,6 +9221,7 @@ undo-tree undo.txt /*undo-tree* undo-two-ways undo.txt /*undo-two-ways* undo.txt undo.txt /*undo.txt* undo_ftplugin usr_41.txt /*undo_ftplugin* +undo_indent usr_41.txt /*undo_indent* undofile() eval.txt /*undofile()* undotree() eval.txt /*undotree()* unicode mbyte.txt /*unicode* @@ -8507,18 +9288,23 @@ v:beval_bufnr eval.txt /*v:beval_bufnr* v:beval_col eval.txt /*v:beval_col* v:beval_lnum eval.txt /*v:beval_lnum* v:beval_text eval.txt /*v:beval_text* +v:beval_winid eval.txt /*v:beval_winid* v:beval_winnr eval.txt /*v:beval_winnr* v:char eval.txt /*v:char* v:charconvert_from eval.txt /*v:charconvert_from* v:charconvert_to eval.txt /*v:charconvert_to* v:cmdarg eval.txt /*v:cmdarg* v:cmdbang eval.txt /*v:cmdbang* +v:completed_item eval.txt /*v:completed_item* v:count eval.txt /*v:count* v:count1 eval.txt /*v:count1* v:ctype eval.txt /*v:ctype* v:dying eval.txt /*v:dying* v:errmsg eval.txt /*v:errmsg* +v:errors eval.txt /*v:errors* +v:event eval.txt /*v:event* v:exception eval.txt /*v:exception* +v:false eval.txt /*v:false* v:fcs_choice eval.txt /*v:fcs_choice* v:fcs_reason eval.txt /*v:fcs_reason* v:fname_diff eval.txt /*v:fname_diff* @@ -8538,8 +9324,14 @@ v:lnum eval.txt /*v:lnum* v:mouse_col eval.txt /*v:mouse_col* v:mouse_lnum eval.txt /*v:mouse_lnum* v:mouse_win eval.txt /*v:mouse_win* +v:mouse_winid eval.txt /*v:mouse_winid* +v:none eval.txt /*v:none* +v:null eval.txt /*v:null* v:oldfiles eval.txt /*v:oldfiles* v:operator eval.txt /*v:operator* +v:option_new eval.txt /*v:option_new* +v:option_old eval.txt /*v:option_old* +v:option_type eval.txt /*v:option_type* v:prevcount eval.txt /*v:prevcount* v:profiling eval.txt /*v:profiling* v:progname eval.txt /*v:progname* @@ -8553,12 +9345,31 @@ v:statusmsg eval.txt /*v:statusmsg* v:swapchoice eval.txt /*v:swapchoice* v:swapcommand eval.txt /*v:swapcommand* v:swapname eval.txt /*v:swapname* +v:t_TYPE eval.txt /*v:t_TYPE* +v:t_bool eval.txt /*v:t_bool* +v:t_channel eval.txt /*v:t_channel* +v:t_dict eval.txt /*v:t_dict* +v:t_float eval.txt /*v:t_float* +v:t_func eval.txt /*v:t_func* +v:t_job eval.txt /*v:t_job* +v:t_list eval.txt /*v:t_list* +v:t_none eval.txt /*v:t_none* +v:t_number eval.txt /*v:t_number* +v:t_string eval.txt /*v:t_string* +v:termblinkresp eval.txt /*v:termblinkresp* +v:termrbgresp eval.txt /*v:termrbgresp* v:termresponse eval.txt /*v:termresponse* +v:termrfgresp eval.txt /*v:termrfgresp* +v:termstyleresp eval.txt /*v:termstyleresp* +v:termu7resp eval.txt /*v:termu7resp* +v:testing eval.txt /*v:testing* v:this_session eval.txt /*v:this_session* v:throwpoint eval.txt /*v:throwpoint* +v:true eval.txt /*v:true* v:val eval.txt /*v:val* v:var eval.txt /*v:var* v:version eval.txt /*v:version* +v:vim_did_enter eval.txt /*v:vim_did_enter* v:warningmsg eval.txt /*v:warningmsg* v:windowid eval.txt /*v:windowid* v_! change.txt /*v_!* @@ -8571,11 +9382,13 @@ v_<Esc> visual.txt /*v_<Esc>* v_= change.txt /*v_=* v_> change.txt /*v_>* v_C change.txt /*v_C* +v_CTRL-A change.txt /*v_CTRL-A* v_CTRL-C visual.txt /*v_CTRL-C* v_CTRL-G visual.txt /*v_CTRL-G* v_CTRL-H change.txt /*v_CTRL-H* v_CTRL-O visual.txt /*v_CTRL-O* v_CTRL-V visual.txt /*v_CTRL-V* +v_CTRL-X change.txt /*v_CTRL-X* v_CTRL-Z starting.txt /*v_CTRL-Z* v_CTRL-\_CTRL-G intro.txt /*v_CTRL-\\_CTRL-G* v_CTRL-\_CTRL-N intro.txt /*v_CTRL-\\_CTRL-N* @@ -8631,7 +9444,9 @@ v_gJ change.txt /*v_gJ* v_gN visual.txt /*v_gN* v_gV visual.txt /*v_gV* v_g] tagsrch.txt /*v_g]* +v_g_CTRL-A change.txt /*v_g_CTRL-A* v_g_CTRL-G editing.txt /*v_g_CTRL-G* +v_g_CTRL-X change.txt /*v_g_CTRL-X* v_g_CTRL-] tagsrch.txt /*v_g_CTRL-]* v_gf editing.txt /*v_gf* v_gn visual.txt /*v_gn* @@ -8666,6 +9481,7 @@ v_v visual.txt /*v_v* v_x change.txt /*v_x* v_y change.txt /*v_y* v_~ change.txt /*v_~* +vab motion.txt /*vab* val-variable eval.txt /*val-variable* valgrind debug.txt /*valgrind* values() eval.txt /*values()* @@ -8696,6 +9512,8 @@ version-7.1 version7.txt /*version-7.1* version-7.2 version7.txt /*version-7.2* version-7.3 version7.txt /*version-7.3* version-7.4 version7.txt /*version-7.4* +version-8.0 version8.txt /*version-8.0* +version-8.1 version8.txt /*version-8.1* version-variable eval.txt /*version-variable* version4.txt version4.txt /*version4.txt* version5.txt version5.txt /*version5.txt* @@ -8706,14 +9524,21 @@ version7.2 version7.txt /*version7.2* version7.3 version7.txt /*version7.3* version7.4 version7.txt /*version7.4* version7.txt version7.txt /*version7.txt* +version8.0 version8.txt /*version8.0* +version8.1 version8.txt /*version8.1* +version8.txt version8.txt /*version8.txt* vi intro.txt /*vi* vi-differences vi_diff.txt /*vi-differences* vi: options.txt /*vi:* vi_diff.txt vi_diff.txt /*vi_diff.txt* +vib motion.txt /*vib* view starting.txt /*view* view-diffs diff.txt /*view-diffs* view-file starting.txt /*view-file* views-sessions starting.txt /*views-sessions* +vim-7.4 version7.txt /*vim-7.4* +vim-8 version8.txt /*vim-8* +vim-8.1 version8.txt /*vim-8.1* vim-additions vi_diff.txt /*vim-additions* vim-announce intro.txt /*vim-announce* vim-arguments starting.txt /*vim-arguments* @@ -8722,13 +9547,20 @@ vim-dev intro.txt /*vim-dev* vim-mac intro.txt /*vim-mac* vim-modes intro.txt /*vim-modes* vim-modes-intro intro.txt /*vim-modes-intro* -vim-multibyte intro.txt /*vim-multibyte* vim-script-intro usr_41.txt /*vim-script-intro* +vim-use intro.txt /*vim-use* vim-variable eval.txt /*vim-variable* vim.vim syntax.txt /*vim.vim* vim7 version7.txt /*vim7* +vim8 version8.txt /*vim8* vim: options.txt /*vim:* -vim_mac gui_mac.txt /*vim_mac* +vim_announce intro.txt /*vim_announce* +vim_dev intro.txt /*vim_dev* +vim_did_enter-variable eval.txt /*vim_did_enter-variable* +vim_mac intro.txt /*vim_mac* +vim_mac_group gui_mac.txt /*vim_mac_group* +vim_starting eval.txt /*vim_starting* +vim_use intro.txt /*vim_use* vimball pi_vimball.txt /*vimball* vimball-contents pi_vimball.txt /*vimball-contents* vimball-extract pi_vimball.txt /*vimball-extract* @@ -8761,6 +9593,7 @@ viminfo-r options.txt /*viminfo-r* viminfo-read starting.txt /*viminfo-read* viminfo-read-write starting.txt /*viminfo-read-write* viminfo-s options.txt /*viminfo-s* +viminfo-timestamp starting.txt /*viminfo-timestamp* viminfo-write starting.txt /*viminfo-write* vimrc starting.txt /*vimrc* vimrc-filetype usr_05.txt /*vimrc-filetype* @@ -8805,28 +9638,18 @@ w: eval.txt /*w:* w:current_syntax syntax.txt /*w:current_syntax* w:quickfix_title quickfix.txt /*w:quickfix_title* w:var eval.txt /*w:var* +waittime channel.txt /*waittime* warningmsg-variable eval.txt /*warningmsg-variable* white-space pattern.txt /*white-space* whitespace pattern.txt /*whitespace* wildcard editing.txt /*wildcard* wildcards editing.txt /*wildcards* wildmenumode() eval.txt /*wildmenumode()* -win16-!start gui_w16.txt /*win16-!start* -win16-clipboard gui_w16.txt /*win16-clipboard* -win16-colors gui_w16.txt /*win16-colors* -win16-default-editor gui_w16.txt /*win16-default-editor* -win16-dialogs gui_w16.txt /*win16-dialogs* -win16-drag-n-drop gui_w16.txt /*win16-drag-n-drop* -win16-gui gui_w16.txt /*win16-gui* -win16-maximized gui_w16.txt /*win16-maximized* -win16-printing gui_w16.txt /*win16-printing* -win16-shell gui_w16.txt /*win16-shell* -win16-start gui_w16.txt /*win16-start* -win16-truetype gui_w16.txt /*win16-truetype* -win16-various gui_w16.txt /*win16-various* win32 os_win32.txt /*win32* win32-!start gui_w32.txt /*win32-!start* win32-PATH os_win32.txt /*win32-PATH* +win32-backslashes os_win32.txt /*win32-backslashes* +win32-cmdargs os_win32.txt /*win32-cmdargs* win32-colors gui_w32.txt /*win32-colors* win32-compiling os_win32.txt /*win32-compiling* win32-curdir os_win32.txt /*win32-curdir* @@ -8838,15 +9661,24 @@ win32-mouse os_win32.txt /*win32-mouse* win32-open-with-menu gui_w32.txt /*win32-open-with-menu* win32-popup-menu gui_w32.txt /*win32-popup-menu* win32-problems os_win32.txt /*win32-problems* +win32-quotes os_win32.txt /*win32-quotes* win32-restore os_win32.txt /*win32-restore* win32-startup os_win32.txt /*win32-startup* win32-term os_win32.txt /*win32-term* win32-vimrun gui_w32.txt /*win32-vimrun* win32-win3.1 os_win32.txt /*win32-win3.1* +win32-win95 os_win32.txt /*win32-win95* win32s os_win32.txt /*win32s* +win_findbuf() eval.txt /*win_findbuf()* +win_getid() eval.txt /*win_getid()* +win_gotoid() eval.txt /*win_gotoid()* +win_id2tabwin() eval.txt /*win_id2tabwin()* +win_id2win() eval.txt /*win_id2win()* +win_screenpos() eval.txt /*win_screenpos()* winbufnr() eval.txt /*winbufnr()* wincol() eval.txt /*wincol()* window windows.txt /*window* +window-ID windows.txt /*window-ID* window-contents intro.txt /*window-contents* window-exit editing.txt /*window-exit* window-functions usr_41.txt /*window-functions* @@ -8856,15 +9688,21 @@ window-resize windows.txt /*window-resize* window-size term.txt /*window-size* window-size-functions usr_41.txt /*window-size-functions* window-tag windows.txt /*window-tag* +window-toolbar gui.txt /*window-toolbar* window-variable eval.txt /*window-variable* +windowid windows.txt /*windowid* windowid-variable eval.txt /*windowid-variable* windows windows.txt /*windows* windows-3.1 os_win32.txt /*windows-3.1* +windows-icon os_win32.txt /*windows-icon* windows-intro windows.txt /*windows-intro* windows-starting windows.txt /*windows-starting* windows.txt windows.txt /*windows.txt* windows95 os_win32.txt /*windows95* +windows98 os_win32.txt /*windows98* +windowsme os_win32.txt /*windowsme* winheight() eval.txt /*winheight()* +winid windows.txt /*winid* winline() eval.txt /*winline()* winnr() eval.txt /*winnr()* winrestcmd() eval.txt /*winrestcmd()* @@ -8874,6 +9712,7 @@ winwidth() eval.txt /*winwidth()* word motion.txt /*word* word-count editing.txt /*word-count* word-motions motion.txt /*word-motions* +wordcount() eval.txt /*wordcount()* workbench starting.txt /*workbench* workshop workshop.txt /*workshop* workshop-commands workshop.txt /*workshop-commands* @@ -8919,6 +9758,7 @@ xterm-8-bit term.txt /*xterm-8-bit* xterm-8bit term.txt /*xterm-8bit* xterm-blink syntax.txt /*xterm-blink* xterm-blinking-cursor syntax.txt /*xterm-blinking-cursor* +xterm-bracketed-paste term.txt /*xterm-bracketed-paste* xterm-clipboard term.txt /*xterm-clipboard* xterm-codes term.txt /*xterm-codes* xterm-color syntax.txt /*xterm-color* @@ -8935,7 +9775,9 @@ xterm-save-screen tips.txt /*xterm-save-screen* xterm-screens tips.txt /*xterm-screens* xterm-scroll-region term.txt /*xterm-scroll-region* xterm-shifted-keys term.txt /*xterm-shifted-keys* +xterm-true-color term.txt /*xterm-true-color* y change.txt /*y* +yaml.vim syntax.txt /*yaml.vim* yank change.txt /*yank* ye-option-gone version4.txt /*ye-option-gone* year-2000 intro.txt /*year-2000* @@ -8989,6 +9831,7 @@ zip-extension pi_zip.txt /*zip-extension* zip-history pi_zip.txt /*zip-history* zip-manual pi_zip.txt /*zip-manual* zip-usage pi_zip.txt /*zip-usage* +zip-x pi_zip.txt /*zip-x* zj fold.txt /*zj* zk fold.txt /*zk* zl scroll.txt /*zl* @@ -8997,6 +9840,7 @@ zn fold.txt /*zn* zo fold.txt /*zo* zr fold.txt /*zr* zs scroll.txt /*zs* +zsh.vim syntax.txt /*zsh.vim* zt scroll.txt /*zt* zuG spell.txt /*zuG* zuW spell.txt /*zuW* @@ -9010,6 +9854,7 @@ zz scroll.txt /*zz* {Visual} intro.txt /*{Visual}* {address} cmdline.txt /*{address}* {arglist} editing.txt /*{arglist}* +{bufname} windows.txt /*{bufname}* {char1-char2} intro.txt /*{char1-char2}* {event} autocmd.txt /*{event}* {file} editing.txt /*{file}* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 06c9838603..555beb509a 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 7.4. Last change: 2013 Oct 01 +*tagsrch.txt* For Vim version 8.1. Last change: 2018 May 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -36,12 +36,12 @@ An easy way back is with the CTRL-T command. Also read about the tag stack below. *:ta* *:tag* *E426* *E429* -:[count]ta[g][!] {ident} - Jump to the definition of {ident}, using the - information in the tags file(s). Put {ident} in the +:[count]ta[g][!] {name} + Jump to the definition of {name}, using the + information in the tags file(s). Put {name} in the tag stack. See |tag-!| for [!]. - {ident} can be a regexp pattern, see |tag-regexp|. - When there are several matching tags for {ident}, jump + {name} can be a regexp pattern, see |tag-regexp|. + When there are several matching tags for {name}, jump to the [count] one. When [count] is omitted the first one is jumped to. See |tag-matchlist| for jumping to other matching tags. @@ -49,16 +49,16 @@ below. g<LeftMouse> *g<LeftMouse>* <C-LeftMouse> *<C-LeftMouse>* *CTRL-]* CTRL-] Jump to the definition of the keyword under the - cursor. Same as ":tag {ident}", where {ident} is the + cursor. Same as ":tag {name}", where {name} is the keyword under or after cursor. - When there are several matching tags for {ident}, jump + When there are several matching tags for {name}, jump to the [count] one. When no [count] is given the first one is jumped to. See |tag-matchlist| for jumping to other matching tags. {Vi: identifier after the cursor} *v_CTRL-]* -{Visual}CTRL-] Same as ":tag {ident}", where {ident} is the text that +{Visual}CTRL-] Same as ":tag {name}", where {name} is the text that is highlighted. {not in Vi} *telnet-CTRL-]* @@ -82,14 +82,25 @@ When there are multiple matches for a tag, this priority is used: Note that when the current file changes, the priority list is mostly not changed, to avoid confusion when using ":tnext". It is changed when using -":tag {ident}". - -The ignore-case matches are not found for a ":tag" command when the -'ignorecase' option is off. They are found when a pattern is used (starting -with a "/") and for ":tselect", also when 'ignorecase' is off. Note that -using ignore-case tag searching disables binary searching in the tags file, -which causes a slowdown. This can be avoided by fold-case sorting the tag -file. See the 'tagbsearch' option for an explanation. +":tag {name}". + +The ignore-case matches are not found for a ":tag" command when: +- the 'ignorecase' option is off and 'tagcase' is "followic" +- 'tagcase' is "match" +- 'tagcase' is "smart" and the pattern contains an upper case character. +- 'tagcase' is "followscs" and 'smartcase' option is on and the pattern + contains an upper case character. + +The ignore-case matches are found when: +- a pattern is used (starting with a "/") +- for ":tselect" +- when 'tagcase' is "followic" and 'ignorecase' is off +- when 'tagcase' is "match" +- when 'tagcase' is "followscs" and the 'smartcase' option is off + +Note that using ignore-case tag searching disables binary searching in the +tags file, which causes a slowdown. This can be avoided by fold-case sorting +the tag file. See the 'tagbsearch' option for an explanation. ============================================================================== 2. Tag stack *tag-stack* *tagstack* *E425* @@ -156,7 +167,7 @@ You can get from main to FuncA by using CTRL-] on the call to FuncA. Then you can CTRL-] to get to FuncC. If you now want to go back to main you can use CTRL-T twice. Then you can CTRL-] to FuncB. -If you issue a ":ta {ident}" or CTRL-] command, this tag is inserted at the +If you issue a ":ta {name}" or CTRL-] command, this tag is inserted at the current position in the stack. If the stack was full (it can hold up to 20 entries), the oldest entry is deleted and the older entries shift one position up (their index number is decremented by one). If the last used @@ -180,13 +191,14 @@ between them. Note that these commands don't change the tag stack, they keep the same entry. *:ts* *:tselect* -:ts[elect][!] [ident] List the tags that match [ident], using the +:ts[elect][!] [name] List the tags that match [name], using the information in the tags file(s). - When [ident] is not given, the last tag name from the + When [name] is not given, the last tag name from the tag stack is used. + See |tag-!| for [!]. With a '>' in the first column is indicated which is the current position in the list (if there is one). - [ident] can be a regexp pattern, see |tag-regexp|. + [name] can be a regexp pattern, see |tag-regexp|. See |tag-priority| for the priorities used in the listing. {not in Vi} Example output: @@ -214,7 +226,7 @@ the same entry. type 'q' and enter the number. *:sts* *:stselect* -:sts[elect][!] [ident] Does ":tselect[!] [ident]" and splits the window for +:sts[elect][!] [name] Does ":tselect[!] [name]" and splits the window for the selected tag. {not in Vi} *g]* @@ -226,11 +238,11 @@ g] Like CTRL-], but use ":tselect" instead of ":tag". identifier. {not in Vi} *:tj* *:tjump* -:tj[ump][!] [ident] Like ":tselect", but jump to the tag directly when +:tj[ump][!] [name] Like ":tselect", but jump to the tag directly when there is only one match. {not in Vi} *:stj* *:stjump* -:stj[ump][!] [ident] Does ":tjump[!] [ident]" and splits the window for the +:stj[ump][!] [name] Does ":tjump[!] [name]" and splits the window for the selected tag. {not in Vi} *g_CTRL-]* @@ -265,9 +277,9 @@ g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag". in Vi} *:lt* *:ltag* -:lt[ag][!] [ident] Jump to tag [ident] and add the matching tags to a new - location list for the current window. [ident] can be - a regexp pattern, see |tag-regexp|. When [ident] is +:lt[ag][!] [name] Jump to tag [name] and add the matching tags to a new + location list for the current window. [name] can be + a regexp pattern, see |tag-regexp|. When [name] is not given, the last tag name from the tag stack is used. The search pattern to locate the tag line is prefixed with "\V" to escape all the special @@ -299,12 +311,12 @@ the same as above, with a "p" prepended. {not available when compiled without the |+quickfix| feature} *:pts* *:ptselect* -:pts[elect][!] [ident] Does ":tselect[!] [ident]" and shows the new tag in a +:pts[elect][!] [name] Does ":tselect[!] [name]" and shows the new tag in a "Preview" window. See |:ptag| for more info. {not in Vi} *:ptj* *:ptjump* -:ptj[ump][!] [ident] Does ":tjump[!] [ident]" and shows the new tag in a +:ptj[ump][!] [name] Does ":tjump[!] [name]" and shows the new tag in a "Preview" window. See |:ptag| for more info. {not in Vi} @@ -440,12 +452,18 @@ file "tags". It can also be used to access a common tags file. The next file in the list is not used when: - A matching static tag for the current buffer has been found. - A matching global tag has been found. -This also depends on the 'ignorecase' option. If it is off, and the tags file -only has a match without matching case, the next tags file is searched for a -match with matching case. If no tag with matching case is found, the first -match without matching case is used. If 'ignorecase' is on, and a matching -global tag with or without matching case is found, this one is used, no -further tags files are searched. +This also depends on whether case is ignored. Case is ignored when: +- 'tagcase' is "followic" and 'ignorecase' is set +- 'tagcase' is "ignore" +- 'tagcase' is "smart" and the pattern only contains lower case + characters. +- 'tagcase' is "followscs" and 'smartcase' is set and the pattern only + contains lower case characters. +If case is not ignored, and the tags file only has a match without matching +case, the next tags file is searched for a match with matching case. If no +tag with matching case is found, the first match without matching case is +used. If case is ignored, and a matching global tag with or without matching +case is found, this one is used, no further tags files are searched. When a tag file name starts with "./", the '.' is replaced with the path of the current file. This makes it possible to use a tags file in the directory @@ -579,8 +597,10 @@ that indicates if the file was sorted. When this line is found, Vim uses binary searching for the tags file: !_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~ -A tag file may be case-fold sorted to avoid a linear search when 'ignorecase' -is on. See 'tagbsearch' for details. The value '2' should be used then: +A tag file may be case-fold sorted to avoid a linear search when case is +ignored. (Case is ignored when 'ignorecase' is set and 'tagcase' is +"followic", or when 'tagcase' is "ignore".) See 'tagbsearch' for details. +The value '2' should be used then: !_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~ The other tag that Vim recognizes, but only when compiled with the @@ -814,24 +834,24 @@ CTRL-W d Open a new window, with the cursor on the first *:search-args* Common arguments for the commands above: -[!] When included, find matches in lines that are recognized as comments. - When excluded, a match is ignored when the line is recognized as a - comment (according to 'comments'), or the match is in a C comment (after - "//" or inside /* */). Note that a match may be missed if a line is - recognized as a comment, but the comment ends halfway the line. - And if the line is a comment, but it is not recognized (according to - 'comments') a match may be found in it anyway. Example: > +[!] When included, find matches in lines that are recognized as comments. + When excluded, a match is ignored when the line is recognized as a + comment (according to 'comments'), or the match is in a C comment + (after "//" or inside /* */). Note that a match may be missed if a + line is recognized as a comment, but the comment ends halfway the line. + And if the line is a comment, but it is not recognized (according to + 'comments') a match may be found in it anyway. Example: > /* comment foobar */ -< A match for "foobar" is found, because this line is not recognized as a - comment (even though syntax highlighting does recognize it). - Note: Since a macro definition mostly doesn't look like a comment, the - [!] makes no difference for ":dlist", ":dsearch" and ":djump". -[/] A pattern can be surrounded by '/'. Without '/' only whole words are - matched, using the pattern "\<pattern\>". Only after the second '/' a - next command can be appended with '|'. Example: > +< A match for "foobar" is found, because this line is not recognized as + a comment (even though syntax highlighting does recognize it). + Note: Since a macro definition mostly doesn't look like a comment, the + [!] makes no difference for ":dlist", ":dsearch" and ":djump". +[/] A pattern can be surrounded by '/'. Without '/' only whole words are + matched, using the pattern "\<pattern\>". Only after the second '/' a + next command can be appended with '|'. Example: > :isearch /string/ | echo "the last one" -< For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern - is used as a literal string, not as a search pattern. +< For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern + is used as a literal string, not as a search pattern. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index d2dd547061..c7579fe8b3 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.4. Last change: 2014 May 13 +*term.txt* For Vim version 8.1. Last change: 2017 Oct 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -89,6 +89,28 @@ an external command (e.g., "!!"), the terminal will be put into Normal mode for a moment. This means that you can stop the output to the screen by hitting a printing key. Output resumes when you hit <BS>. + *xterm-bracketed-paste* +When the 't_BE' option is set then 't_BE' will be sent to the +terminal when entering "raw" mode and 't_BD' when leaving "raw" mode. The +terminal is then expected to put 't_PS' before pasted text and 't_PE' after +pasted text. This way Vim can separate text that is pasted from characters +that are typed. The pasted text is handled like when the middle mouse button +is used, it is inserted literally and not interpreted as commands. + +When the cursor is in the first column, the pasted text will be inserted +before it. Otherwise the pasted text is appended after the cursor position. +This means one cannot paste after the first column. Unfortunately Vim does +not have a way to tell where the mouse pointer was. + +Note that in some situations Vim will not recognize the bracketed paste and +you will get the raw text. In other situations Vim will only get the first +pasted character and drop the rest, e.g. when using the "r" command. If you +have a problem with this, disable bracketed paste by putting this in your +.vimrc: > + set t_BE= +If this is done while Vim is running the 't_BD' will be sent to the terminal +to disable bracketed paste. + *cs7-problem* Note: If the terminal settings are changed after running Vim, you might have an illegal combination of settings. This has been reported on Solaris 2.5 @@ -224,12 +246,13 @@ The options are listed below. The associated termcap code is always equal to the last two characters of the option name. Only one termcap code is required: Cursor motion, 't_cm'. -The options 't_da', 't_db', 't_ms', 't_xs' represent flags in the termcap. -When the termcap flag is present, the option will be set to "y". But any -non-empty string means that the flag is set. An empty string means that the -flag is not set. 't_CS' works like this too, but it isn't a termcap flag. +The options 't_da', 't_db', 't_ms', 't_xs', 't_xn' represent flags in the +termcap. When the termcap flag is present, the option will be set to "y". +But any non-empty string means that the flag is set. An empty string means +that the flag is not set. 't_CS' works like this too, but it isn't a termcap +flag. -OUTPUT CODES +OUTPUT CODES *terminal-output-codes* option meaning ~ t_AB set background color (ANSI) *t_AB* *'t_AB'* @@ -272,32 +295,73 @@ OUTPUT CODES t_ts set window title start (to status line) *t_ts* *'t_ts'* t_ue underline end *t_ue* *'t_ue'* t_us underline mode *t_us* *'t_us'* - t_Ce undercurl end *t_Ce* *'t_Ce'* - t_Cs undercurl mode *t_Cs* *'t_Cs'* t_ut clearing uses the current background color *t_ut* *'t_ut'* t_vb visual bell *t_vb* *'t_vb'* t_ve cursor visible *t_ve* *'t_ve'* t_vi cursor invisible *t_vi* *'t_vi'* - t_vs cursor very visible *t_vs* *'t_vs'* + t_vs cursor very visible (blink) *t_vs* *'t_vs'* *t_xs* *'t_xs'* t_xs if non-empty, standout not erased by overwriting (hpterm) + *t_xn* *'t_xn'* + t_xn if non-empty, writing a character at the last screen cell + does not cause scrolling t_ZH italics mode *t_ZH* *'t_ZH'* t_ZR italics end *t_ZR* *'t_ZR'* Added by Vim (there are no standard codes for these): + t_Ce undercurl end *t_Ce* *'t_Ce'* + t_Cs undercurl mode *t_Cs* *'t_Cs'* + t_Te strikethrough end *t_Te* *'t_Te'* + t_Ts strikethrough mode *t_Ts* *'t_Ts'* t_IS set icon text start *t_IS* *'t_IS'* t_IE set icon text end *t_IE* *'t_IE'* t_WP set window position (Y, X) in pixels *t_WP* *'t_WP'* - t_WS set window size (height, width) in characters *t_WS* *'t_WS'* + t_GP get window position (Y, X) in pixels *t_GP* *'t_GP'* + t_WS set window size (height, width in cells) *t_WS* *'t_WS'* + t_VS cursor normally visible (no blink) *t_VS* *'t_VS'* t_SI start insert mode (bar cursor shape) *t_SI* *'t_SI'* - t_EI end insert mode (block cursor shape) *t_EI* *'t_EI'* + t_SR start replace mode (underline cursor shape) *t_SR* *'t_SR'* + t_EI end insert or replace mode (block cursor shape) *t_EI* *'t_EI'* |termcap-cursor-shape| t_RV request terminal version string (for xterm) *t_RV* *'t_RV'* |xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes| t_u7 request cursor position (for xterm) *t_u7* *'t_u7'* see |'ambiwidth'| - -KEY CODES + t_RF request terminal foreground color *t_RF* *'t_RF'* + t_RB request terminal background color *t_RB* *'t_RB'* + t_8f set foreground color (R, G, B) *t_8f* *'t_8f'* + |xterm-true-color| + t_8b set background color (R, G, B) *t_8b* *'t_8b'* + |xterm-true-color| + t_BE enable bracketed paste mode *t_BE* *'t_BE'* + |xterm-bracketed-paste| + t_BD disable bracketed paste mode *t_BD* *'t_BD'* + |xterm-bracketed-paste| + t_SC set cursor color start *t_SC* *'t_SC'* + t_EC set cursor color end *t_EC* *'t_EC'* + t_SH set cursor shape *t_SH* *'t_SH'* + t_RC request terminal cursor blinking *t_RC* *'t_RC'* + t_RS request terminal cursor style *t_RS* *'t_RS'* + +Some codes have a start, middle and end part. The start and end are defined +by the termcap option, the middle part is text. + set title text: t_ts {title text} t_fs + set icon text: t_IS {icon text} t_IE + set cursor color: t_SC {color name} t_EC + +t_SH must take one argument: + 0, 1 or none blinking block cursor + 2 block cursor + 3 blinking underline cursor + 4 underline cursor + 5 blinking vertical bar cursor + 6 vertical bar cursor + +t_RS is sent only if the response to t_RV has been received. It is not used +on Mac OS when Terminal.app could be recognized from the termresponse. + + +KEY CODES *terminal-key-codes* Note: Use the <> form if possible option name meaning ~ @@ -388,6 +452,9 @@ Note: Use the <> form if possible t_KK <k8> keypad 8 *<k8>* *t_KK* *'t_KK'* t_KL <k9> keypad 9 *<k9>* *t_KL* *'t_KL'* <Mouse> leader of mouse code *<Mouse>* + *t_PS* *'t_PS'* + t_PS start of bracketed paste |xterm-bracketed-paste| + t_PE end of bracketed paste |xterm-bracketed-paste| *t_PE* *'t_PE'* Note about t_so and t_mr: When the termcap entry "so" is not present the entry for "mr" is used. And vice versa. The same is done for "se" and "me". @@ -410,7 +477,28 @@ adjust the various t_ codes. This avoids the problem that the xterm can produce different codes, depending on the mode it is in (8-bit, VT102, VT220, etc.). The result is that codes like <xF1> are no longer needed. Note: This is only done on startup. If the xterm options are changed after -Vim has started, the escape sequences may not be recognized any more. +Vim has started, the escape sequences may not be recognized anymore. + + *xterm-true-color* +Vim supports using true colors in the terminal (taken from |highlight-guifg| +and |highlight-guibg|), given that the terminal supports this. To make this +work the 'termguicolors' option needs to be set. +See https://gist.github.com/XVilka/8346728 for a list of terminals that +support true colors. + +Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f| +and |t_8b| options explicitly. Default values of these options are +"^[[38;2;%lu;%lu;%lum" and "^[[48;2;%lu;%lu;%lum" respectively, but it is only +set when `$TERM` is `xterm`. Some terminals accept the same sequences, but +with all semicolons replaced by colons (this is actually more compatible, but +less widely supported): > + let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum" + let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum" + +These options contain printf strings, with |printf()| (actually, its C +equivalent hence `l` modifier) invoked with the t_ option value and three +unsigned long integers that may have any value between 0 and 255 (inclusive) +representing red, green and blue colors respectively. *xterm-resize* Window resizing with xterm only works if the allowWindowOps resource is @@ -434,13 +522,16 @@ If one of these is not available, 't_Sb' and 't_Sf' are used. 't_me' is used to reset to the default colors. *termcap-cursor-shape* *termcap-cursor-color* -When Vim enters Insert mode the 't_SI' escape sequence is sent. When leaving -Insert mode 't_EI' is used. But only if both are defined. This can be used -to change the shape or color of the cursor in Insert mode. These are not -standard termcap/terminfo entries, you need to set them yourself. +When Vim enters Insert mode the 't_SI' escape sequence is sent. When Vim +enters Replace mode the 't_SR' escape sequence is sent if it is set, otherwise +'t_SI' is sent. When leaving Insert mode or Replace mode 't_EI' is used. This +can be used to change the shape or color of the cursor in Insert or Replace +mode. These are not standard termcap/terminfo entries, you need to set them +yourself. Example for an xterm, this changes the color of the cursor: > if &term =~ "xterm" let &t_SI = "\<Esc>]12;purple\x7" + let &t_SR = "\<Esc>]12;red\x7" let &t_EI = "\<Esc>]12;blue\x7" endif NOTE: When Vim exits the shape for Normal mode will remain. The shape from @@ -532,7 +623,7 @@ correct values. One command can be used to set the screen size: - *:mod* *:mode* *E359* *E362* + *:mod* *:mode* *E359* :mod[e] [mode] Without argument this only detects the screen size and redraws the screen. @@ -842,7 +933,7 @@ Mouse clicks can be mapped. The codes for mouse clicks are: The X1 and X2 buttons refer to the extra buttons found on some mice. The 'Microsoft Explorer' mouse has these buttons available to the right thumb. -Currently X1 and X2 only work on Win32 environments. +Currently X1 and X2 only work on Win32 and X11 environments. Examples: > :noremap <MiddleMouse> <LeftMouse><MiddleMouse> diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt new file mode 100644 index 0000000000..a6c40f6ef1 --- /dev/null +++ b/runtime/doc/terminal.txt @@ -0,0 +1,895 @@ +*terminal.txt* For Vim version 8.1. Last change: 2018 May 17 + + + VIM REFERENCE MANUAL by Bram Moolenaar + + +Terminal window support *terminal* *terminal-window* + + +The terminal feature is optional, use this to check if your Vim has it: > + echo has('terminal') +If the result is "1" you have it. + + +1. Basic use |terminal-use| + Typing |terminal-typing| + Size and color |terminal-size-color| + Syntax |:terminal| + Resizing |terminal-resizing| + Terminal Modes |Terminal-mode| + Cursor style |terminal-cursor-style| + Special keys |terminal-special-keys| + Session |terminal-session| + Unix |terminal-unix| + MS-Windows |terminal-ms-windows| +2. Terminal communication |terminal-communication| + Vim to job: term_sendkeys() |terminal-to-job| + Job to Vim: JSON API |terminal-api| + Using the client-server feature |terminal-client-server| +3. Remote testing |terminal-testing| +4. Diffing screen dumps |terminal-diff| + Writing a screen dump test for Vim |terminal-dumptest| + Creating a screen dump |terminal-screendump| + Comparing screen dumps |terminal-diffscreendump| +5. Debugging |terminal-debug| + Starting |termdebug-starting| + Example session |termdebug-example| + Stepping through code |termdebug-stepping| + Inspecting variables |termdebug-variables| + Other commands |termdebug-commands| + Prompt mode |termdebug-prompt| + Communication |termdebug-communication| + Customizing |termdebug-customizing| + +{Vi does not have any of these commands} +{only available when compiled with the |+terminal| feature} +The terminal feature requires the |+multi_byte|, |+job| and |+channel| features. + +============================================================================== +1. Basic use *terminal-use* + +This feature is for running a terminal emulator in a Vim window. A job can be +started connected to the terminal emulator. For example, to run a shell: > + :term bash + +Or to run build command: > + :term make myprogram + +The job runs asynchronously from Vim, the window will be updated to show +output from the job, also while editing in another window. + + +Typing ~ + *terminal-typing* +When the keyboard focus is in the terminal window, typed keys will be sent to +the job. This uses a pty when possible. You can click outside of the +terminal window to move keyboard focus elsewhere. + +CTRL-W can be used to navigate between windows and other CTRL-W commands, e.g.: + CTRL-W CTRL-W move focus to the next window + CTRL-W : enter an Ex command +See |CTRL-W| for more commands. + +Special in the terminal window: *CTRL-W_.* *CTRL-W_N* + CTRL-W . send a CTRL-W to the job in the terminal + CTRL-W CTRL-\ send a CTRL-\ to the job in the terminal + CTRL-W N go to Terminal-Normal mode, see |Terminal-mode| + CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode| + CTRL-W " {reg} paste register {reg} *CTRL-W_quote* + Also works with the = register to insert the result of + evaluating an expression. + CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| + +See option 'termwinkey' for specifying another key instead of CTRL-W that +will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey' +to the job. For example: + 'termwinkey' CTRL-W move focus to the next window + 'termwinkey' : enter an Ex command + 'termwinkey' 'termwinkey' send 'termwinkey' to the job in the terminal + 'termwinkey' . send 'termwinkey' to the job in the terminal + 'termwinkey' CTRL-\ send a CTRL-\ to the job in the terminal + 'termwinkey' N go to terminal Normal mode, see below + 'termwinkey' CTRL-N same as CTRL-W N + 'termwinkey' CTRL-C same as |t_CTRL-W_CTRL-C| + *t_CTRL-\_CTRL-N* +The special key combination CTRL-\ CTRL-N can be used to switch to Normal +mode, just like this works in any other mode. + *t_CTRL-W_CTRL-C* +CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a +CTRL-BREAK will also kill the job. + +If you type CTRL-C the effect depends on what the pty has been configured to +do. For simple commands this causes a SIGINT to be sent to the job, which +would end it. Other commands may ignore the SIGINT or handle the CTRL-C +themselves (like Vim does). + +To change the keys you type use terminal mode mappings, see |:tmap|. +These are defined like any mapping, but apply only when typing keys that are +sent to the job running in the terminal. For example, to make F1 switch +to Terminal-Normal mode: > + tnoremap <F1> <C-W>N +You can use Esc, but you need to make sure it won't cause other keys to +break: > + tnoremap <Esc> <C-W>N + set notimeout ttimeout timeoutlen=100 + +< *options-in-terminal* +After opening the terminal window and setting 'buftype' to "terminal" the +BufWinEnter autocommand event is triggered. This makes it possible to set +options specifically for the window and buffer. Example: > + au BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif + +Mouse events (click and drag) are passed to the terminal. Mouse move events +are only passed when Vim itself is receiving them. For a terminal that is +when 'balloonevalterm' is enabled. + + +Size and color ~ + *terminal-size-color* +See option 'termwinsize' for controlling the size of the terminal window. +(TODO: scrolling when the terminal is larger than the window) + +The job running in the terminal can change the colors. The default foreground +and background colors are taken from Vim, the Normal highlight group. + +For a color terminal the 'background' option is used to decide whether the +terminal window will start with a white or black background. + +To use a different color the Terminal highlight group can be used, for +example: > + hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue +< + *g:terminal_ansi_colors* +In GUI mode or with 'termguicolors', the 16 ANSI colors used by default in new +terminal windows may be configured using the variable +`g:terminal_ansi_colors`, which should be a list of 16 color names or +hexadecimal color codes, similar to those accepted by |highlight-guifg|. When +not using GUI colors, the terminal window always uses the 16 ANSI colors of +the underlying terminal. +The |term_setansicolors()| function can be used to change the colors, and +|term_getansicolors()| to get the currently used colors. + + +Syntax ~ + +:[range]ter[minal] [options] [command] *:ter* *:terminal* + Open a new terminal window. + + If [command] is provided run it as a job and connect + the input and output to the terminal. + If [command] is not given the 'shell' option is used. + if [command] is NONE no job is started, the pty of the + terminal can be used by a command like gdb. + + If [command] is missing the default behavior is to + close the terminal when the shell exits. This can be + changed with the ++noclose argument. + If [command] is present the default behavior is to + keep the terminal open in Terminal-Normal mode. This + can be changed with the ++close argument. + + A new buffer will be created, using [command] or + 'shell' as the name, prefixed with a "!". If a buffer + by this name already exists a number is added in + parentheses. E.g. if "gdb" exists the second terminal + buffer will use "!gdb (1)". + + If [range] is given the specified lines are used as + input for the job. It will not be possible to type + keys in the terminal window. For MS-Windows see the + ++eof argument below. + + *term++close* *term++open* + Supported [options] are: + ++close The terminal window will close + automatically when the job terminates. + ++noclose The terminal window will NOT close + automatically when the job terminates. + ++open When the job terminates and no window + shows it, a window will be opened. + Note that this can be interruptive. + The last of ++close, ++noclose and ++open + matters and rules out earlier arguments. + + ++curwin Open the terminal in the current + window, do not split the current + window. Fails if the current buffer + cannot be |abandon|ed. + ++hidden Open the terminal in a hidden buffer, + no window will be used. + ++norestore Do not include this terminal window + in a session file. + ++kill={how} When trying to close the terminal + window kill the job with {how}. See + |term_setkill()| for the values. + ++rows={height} Use {height} for the terminal window + height. If the terminal uses the full + Vim height (no window above or below + the terminal window) the command line + height will be reduced as needed. + ++cols={width} Use {width} for the terminal window + width. If the terminal uses the full + Vim width (no window left or right of + the terminal window) this value is + ignored. + ++eof={text} when using [range]: text to send after + the last line was written. Cannot + contain white space. A CR is + appended. For MS-Windows the default + is to send CTRL-D. + E.g. for a shell use "++eof=exit" and + for Python "++eof=exit()". Special + codes can be used like with `:map`, + e.g. "<C-Z>" for CTRL-Z. + + If you want to use more options use the |term_start()| + function. + +When the buffer associated with the terminal is forcibly unloaded or wiped out +the job is killed, similar to calling `job_stop(job, "kill")` . +Closing the window normally results in |E947|. When a kill method was set +with "++kill={how}" or |term_setkill()| then closing the window will use that +way to kill or interrupt the job. For example: > + :term ++kill=term tail -f /tmp/log + +So long as the job is running the window behaves like it contains a modified +buffer. Trying to close the window with `CTRL-W :quit` fails. When using +`CTRL-W :quit!` the job is ended. The text in the window is lost. The buffer +still exists, but getting it in a window with `:buffer` will show an empty +buffer. + +Trying to close the window with `CTRL-W :close` also fails. Using +`CTRL-W :close!` will close the window and make the buffer hidden. + +You can use `CTRL-W :hide` to close the terminal window and make the buffer +hidden, the job keeps running. The `:buffer` command can be used to turn the +current window into a terminal window. If there are unsaved changes this +fails, use ! to force, as usual. + +To have a background job run without a window, and open the window when it's +done, use options like this: > + :term ++hidden ++open make +Note that the window will open at an unexpected moment, this will interrupt +what you are doing. + + *E947* *E948* +So long as the job is running, the buffer is considered modified and Vim +cannot be quit easily, see |abandon|. + +When the job has finished and no changes were made to the buffer: closing the +window will wipe out the buffer. + +Before changes can be made to a terminal buffer, the 'modifiable' option must +be set. This is only possible when the job has finished. At the first change +the buffer will become a normal buffer and the highlighting is removed. +You may want to change the buffer name with |:file| to be able to write, since +the buffer name will still be set to the command. + + +Resizing ~ + *terminal-resizing* +The size of the terminal can be in one of three modes: + +1. The 'termwinsize' option is empty: The terminal size follows the window + size. The minimal size is 2 screen lines with 10 cells. + +2. The 'termwinsize' option is "rows*cols", where "rows" is the minimal number + of screen rows and "cols" is the minimal number of cells. + +3. The 'termwinsize' option is "rowsXcols" (where the x is upper or lower + case). The terminal size is fixed to the specified number of screen lines + and cells. If the window is bigger there will be unused empty space. + +If the window is smaller than the terminal size, only part of the terminal can +be seen (the lower-left part). + +The |term_getsize()| function can be used to get the current size of the +terminal. |term_setsize()| can be used only when in the first or second mode, +not when 'termwinsize' is "rowsXcols". + + +Terminal-Job and Terminal-Normal mode ~ + *Terminal-mode* *Terminal-Job* +When the job is running the contents of the terminal is under control of the +job. That includes the cursor position. Typed keys are sent to the job. +The terminal contents can change at any time. This is called Terminal-Job +mode. + +Use CTRL-W N (or 'termwinkey' N) to switch to Terminal-Normal mode. Now the +contents of the terminal window is under control of Vim, the job output is +suspended. CTRL-\ CTRL-N does the same. + +Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by +|term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are. + +It is not possible to enter Insert mode from Terminal-Job mode. + + *Terminal-Normal* *E946* +In Terminal-Normal mode you can move the cursor around with the usual Vim +commands, Visually mark text, yank text, etc. But you cannot change the +contents of the buffer. The commands that would start insert mode, such as +'i' and 'a', return to Terminal-Job mode. The window will be updated to show +the contents of the terminal. |:startinsert| is ineffective. + +In Terminal-Normal mode the statusline and window title show "(Terminal)". If +the job ends while in Terminal-Normal mode this changes to +"(Terminal-finished)". + +When the job outputs lines in the terminal, such that the contents scrolls off +the top, those lines are remembered and can be seen in Terminal-Normal mode. +The number of lines is limited by the 'termwinscroll' option. When going over +this limit, the first 10% of the scrolled lines are deleted and are lost. + + +Cursor style ~ + *terminal-cursor-style* +By default the cursor in the terminal window uses a not blinking block. The +normal xterm escape sequences can be used to change the blinking state and the +shape. Once focus leaves the terminal window Vim will restore the original +cursor. + +An exception is when xterm is started with the "-bc" argument, or another way +that causes the cursor to blink. This actually means that the blinking flag +is inverted. Since Vim cannot detect this, the terminal window cursor +blinking will also be inverted. + + +Session ~ + *terminal-session* +A terminal window will be restored when using a session file, if possible and +wanted. + +If "terminal" was removed from 'sessionoptions' then no terminal windows will +be restored. + +If the job in the terminal was finished the window will not be restored. + +If the terminal can be restored, the command that was used to open it will be +used again. To change this use the |term_setrestore()| function. This can +also be used to not restore a specific terminal by setting the command to +"NONE". + + +Special keys ~ + *terminal-special-keys* +Since the terminal emulator simulates an xterm, only escape sequences that +both Vim and xterm recognize will be available in the terminal window. If you +want to pass on other escape sequences to the job running in the terminal you +need to set up forwarding. Example: > + tmap <expr> <Esc>]b SendToTerm("\<Esc>]b") + func SendToTerm(what) + call term_sendkeys('', a:what) + return '' + endfunc + + +Unix ~ + *terminal-unix* +On Unix a pty is used to make it possible to run all kinds of commands. You +can even run Vim in the terminal! That's used for debugging, see below. + +Environment variables are used to pass information to the running job: + TERM the name of the terminal, from the 'term' option or + $TERM in the GUI; falls back to "xterm" if it does not + start with "xterm" + ROWS number of rows in the terminal initially + LINES same as ROWS + COLUMNS number of columns in the terminal initially + COLORS number of colors, 't_Co' (256*256*256 in the GUI) + VIM_SERVERNAME v:servername + VIM_TERMINAL v:version + + +MS-Windows ~ + *terminal-ms-windows* +On MS-Windows winpty is used to make it possible to run all kind of commands. +Obviously, they must be commands that run in a terminal, not open their own +window. + +You need the following two files from winpty: + + winpty.dll + winpty-agent.exe + +You can download them from the following page: + + https://github.com/rprichard/winpty + +Just put the files somewhere in your PATH. You can set the 'winptydll' option +to point to the right file, if needed. If you have both the 32-bit and 64-bit +version, rename to winpty32.dll and winpty64.dll to match the way Vim was +build. + +Environment variables are used to pass information to the running job: + VIM_SERVERNAME v:servername + +============================================================================== +2. Terminal communication *terminal-communication* + +There are several ways to communicate with the job running in a terminal: +- Use |term_sendkeys()| to send text and escape sequences from Vim to the job. +- Use the JSON API to send encoded commands from the job to Vim. +- Use the |client-server| mechanism. This works on machines with an X server + and on MS-Windows. + + +Vim to job: term_sendkeys() ~ + *terminal-to-job* +This allows for remote controlling the job running in the terminal. It is a +one-way mechanism. The job can update the display to signal back to Vim. +For example, if a shell is running in a terminal, you can do: > + call term_sendkeys(buf, "ls *.java\<CR>") + +This requires for the job to be in the right state where it will do the right +thing when receiving the keys. For the above example, the shell must be +waiting for a command to be typed. + +For a job that was written for the purpose, you can use the JSON API escape +sequence in the other direction. E.g.: > + call term_sendkeys(buf, "\<Esc>]51;["response"]\x07") + + +Job to Vim: JSON API ~ + *terminal-api* +The job can send JSON to Vim, using a special escape sequence. The JSON +encodes a command that Vim understands. Example of such a message: > + <Esc>]51;["drop", "README.md"]<07> + +The body is always a list, making it easy to find the end: ]<07>. +The <Esc>]51;msg<07> sequence is reserved by xterm for "Emacs shell", which is +similar to what we are doing here. + +Currently supported commands: + + call {funcname} {argument} + + Call a user defined function with {argument}. + The function is called with two arguments: the buffer number + of the terminal and {argument}, the decoded JSON argument. + The function name must start with "Tapi_" to avoid + accidentally calling a function not meant to be used for the + terminal API + The user function should sanity check the argument. + The function can use |term_sendkeys()| to send back a reply. + Example in JSON: > + ["call", "Tapi_Impression", ["play", 14]] +< Calls a function defined like this: > + function Tapi_Impression(bufnum, arglist) + if len(a:arglist) == 2 + echomsg "impression " . a:arglist[0] + echomsg "count " . a:arglist[1] + endif + endfunc +< Output from `:echo` may be erased by a redraw, use `:echomsg` + to be able to see it with `:messages`. + + drop {filename} [options] + + Let Vim open a file, like the `:drop` command. If {filename} + is already open in a window, switch to that window. Otherwise + open a new window to edit {filename}. + Note that both the job and Vim may change the current + directory, thus it's best to use the full path. + + [options] is only used when opening a new window. If present, + it must be a Dict. Similarly to |++opt|, These entries are recognized: + "ff" file format: "dos", "mac" or "unix" + "fileformat" idem + "enc" overrides 'fileencoding' + "encoding" idem + "bin" sets 'binary' + "binary" idem + "nobin" resets 'binary' + "nobinary" idem + "bad" specifies behavior for bad characters, see + |++bad| + + Example in JSON: > + ["drop", "path/file.txt", {"ff": "dos"}] + +A trick to have Vim send this escape sequence: > + exe "set t_ts=\<Esc>]51; t_fs=\x07" + let &titlestring = '["call","Tapi_TryThis",["hello",123]]' + redraw + set t_ts& t_fs& + +Rationale: Why not allow for any command or expression? Because that might +create a security problem. + + +Using the client-server feature ~ + *terminal-client-server* +This only works when v:servername is not empty. If needed you can set it, +before opening the terminal, with: > + call remote_startserver('vim-server') + +$VIM_SERVERNAME is set in the terminal to pass on the server name. + +In the job you can then do something like: > + vim --servername $VIM_SERVERNAME --remote +123 some_file.c +This will open the file "some_file.c" and put the cursor on line 123. + +============================================================================== +3. Remote testing *terminal-testing* + +Most Vim tests execute a script inside Vim. For some tests this does not +work, running the test interferes with the code being tested. To avoid this +Vim is executed in a terminal window. The test sends keystrokes to it and +inspects the resulting screen state. + +Functions ~ + +term_sendkeys() send keystrokes to a terminal (not subject to tmap) +term_wait() wait for screen to be updated +term_scrape() inspect terminal screen + + +============================================================================== +4. Diffing screen dumps *terminal-diff* + +In some cases it can be bothersome to test that Vim displays the right +characters on the screen. E.g. with syntax highlighting. To make this +simpler it is possible to take a screen dump of a terminal and compare it to +an expected screen dump. + +Vim uses the window size, text, color and other attributes as displayed. The +Vim screen size, font and other properties do not matter. Therefore this +mechanism is portable across systems. A conventional screenshot would reflect +all differences, including font size and family. + + +Writing a screen dump test for Vim ~ + *terminal-dumptest* +For an example see the Test_syntax_c() function in +src/testdir/test_syntax.vim. The main parts are: +- Write a file you want to test with. This is useful for testing syntax + highlighting. You can also start Vim with en empty buffer. +- Run Vim in a terminal with a specific size. The default is 20 lines of 75 + characters. This makes sure the dump is always this size. The function + RunVimInTerminal() takes care of this. Pass it the arguments for the Vim + command. +- Send any commands to Vim using term_sendkeys(). For example: > + call term_sendkeys(buf, ":echo &lines &columns\<CR>") +- Check that the screen is now in the expected state, using + VerifyScreenDump(). This expects the reference screen dump to be in the + src/testdir/dumps/ directory. Pass the name without ".dump". It is + recommended to use the name of the test function and a sequence number, so + that we know what test is using the file. +- Repeat sending commands and checking the state. +- Finally stop Vim by calling StopVimInTerminal(). + +The first time you do this you won't have a screen dump yet. Create an empty +file for now, e.g.: > + touch src/testdir/dumps/Test_function_name_01.dump + +The test will then fail, giving you the command to compare the reference dump +and the failed dump, e.g.: > + call term_dumpdiff("Test_func.dump.failed", "dumps/Test_func.dump") + +Use this command in Vim, with the current directory set to src/testdir. +Once you are satisfied with the test, move the failed dump in place of the +reference: > + :!mv Test_func.dump.failed dumps/Test_func.dump + + +Creating a screen dump ~ + *terminal-screendump* + +To create the screen dump, run Vim (or any other program) in a terminal and +make it show the desired state. Then use the term_dumpwrite() function to +create a screen dump file. For example: > + :call term_dumpwrite(77, "mysyntax.dump") + +Here "77" is the buffer number of the terminal. Use `:ls!` to see it. + +You can view the screen dump with term_dumpload(): > + :call term_dumpload("mysyntax.dump") + +To verify that Vim still shows exactly the same screen, run Vim again with +exactly the same way to show the desired state. Then create a screen dump +again, using a different file name: > + :call term_dumpwrite(88, "test.dump") + +To assert that the files are exactly the same use assert_equalfile(): > + call assert_equalfile("mysyntax.dump", "test.dump") + +If there are differences then v:errors will contain the error message. + + +Comparing screen dumps ~ + *terminal-diffscreendump* + +assert_equalfile() does not make it easy to see what is different. +To spot the problem use term_dumpdiff(): > + call term_dumpdiff("mysyntax.dump", "test.dump") + +This will open a window consisting of three parts: +1. The contents of the first dump +2. The difference between the first and second dump +3. The contents of the second dump + +You can usually see what differs in the second part. Use the 'ruler' to +relate it to the position in the first or second dump. + +Alternatively, press "s" to swap the first and second dump. Do this several +times so that you can spot the difference in the context of the text. + +============================================================================== +5. Debugging *terminal-debug* *terminal-debugger* + +The Terminal debugging plugin can be used to debug a program with gdb and view +the source code in a Vim window. Since this is completely contained inside +Vim this also works remotely over an ssh connection. + +When the |+terminal| feature is missing, the plugin will use the "prompt" +buffer type, if possible. The running program will then use a newly opened +terminal window. See |termdebug-prompt| below for details. + + +Starting ~ + *termdebug-starting* +Load the plugin with this command: > + packadd termdebug +< *:Termdebug* +To start debugging use `:Termdebug` or `:TermdebugCommand`` followed by the +command name, for example: > + :Termdebug vim + +This opens two windows: + +gdb window A terminal window in which "gdb vim" is executed. Here you + can directly interact with gdb. The buffer name is "!gdb". + +program window A terminal window for the executed program. When "run" is + used in gdb the program I/O will happen in this window, so + that it does not interfere with controlling gdb. The buffer + name is "gdb program". + +The current window is used to show the source code. When gdb pauses the +source file location will be displayed, if possible. A sign is used to +highlight the current position, using highlight group debugPC. + +If the buffer in the current window is modified, another window will be opened +to display the current gdb position. You can use `:Winbar` to add a window +toolbar there. + +Focus the terminal of the executed program to interact with it. This works +the same as any command running in a terminal window. + +When the debugger ends, typically by typing "quit" in the gdb window, the two +opened windows are closed. + +Only one debugger can be active at a time. + *:TermdebugCommand* +If you want to give specific commands to the command being debugged, you can +use the `:TermdebugCommand` command followed by the command name and +additional parameters. > + :TermdebugCommand vim --clean -c ':set nu' + +Both the `:Termdebug` and `:TermdebugCommand` support an optional "!" bang +argument to start the command right away, without pausing at the gdb window +(and cursor will be in the debugged window). For example: > + :TermdebugCommand! vim --clean + +To attach gdb to an already running executable or use a core file, pass extra +arguments. E.g.: > + :Termdebug vim core + :Termdebug vim 98343 + +If no argument is given, you'll end up in a gdb window, in which you need to +specify which command to run using e.g. the gdb `file` command. + + +Example session ~ + *termdebug-example* +Start in the Vim "src" directory and build Vim: > + % make +Start Vim: > + % ./vim +Load the termdebug plugin and start debugging Vim: > + :packadd termdebug + :Termdebug vim +You should now have three windows: + source - where you started, has a window toolbar with buttons + gdb - you can type gdb commands here + program - the executed program will use this window + +You can use CTRL-W CTRL-W or the mouse to move focus between windows. +Put focus on the gdb window and type: > + break ex_help + run +Vim will start running in the program window. Put focus there and type: > + :help gui +Gdb will run into the ex_help breakpoint. The source window now shows the +ex_cmds.c file. A ">>" marker will appear where the breakpoint was set. The +line where the debugger stopped is highlighted. You can now step through the +program. Let's use the mouse: click on the "Next" button in the window +toolbar. You will see the highlighting move as the debugger executes a line +of source code. + +Click "Next" a few times until the for loop is highlighted. Put the cursor on +the end of "eap->arg", then click "Eval" in the toolbar. You will see this +displayed: + "eap->arg": 0x555555e68855 "gui" ~ +This way you can inspect the value of local variables. You can also focus the +gdb window and use a "print" command, e.g.: > + print *eap +If mouse pointer movements are working, Vim will also show a balloon when the +mouse rests on text that can be evaluated by gdb. + +Now go back to the source window and put the cursor on the first line after +the for loop, then type: > + :Break +You will see a ">>" marker appear, this indicates the new breakpoint. Now +click "Cont" in the toolbar and the code until the breakpoint will be +executed. + +You can type more advanced commands in the gdb window. For example, type: > + watch curbuf +Now click "Cont" in the toolbar (or type "cont" in the gdb window). Execution +will now continue until the value of "curbuf" changes, which is in do_ecmd(). +To remove this watchpoint again type in the gdb window: > + delete 3 + +You can see the stack by typing in the gdb window: > + where +Move through the stack frames, e.g. with: > + frame 3 +The source window will show the code, at the point where the call was made to +a deeper level. + + +Stepping through code ~ + *termdebug-stepping* +Put focus on the gdb window to type commands there. Some common ones are: +- CTRL-C interrupt the program +- next execute the current line and stop at the next line +- step execute the current line and stop at the next statement, + entering functions +- finish execute until leaving the current function +- where show the stack +- frame N go to the Nth stack frame +- continue continue execution + + *:Run* *:Arguments* +In the window showing the source code these commands can be used to control +gdb: + `:Run` [args] run the program with [args] or the previous arguments + `:Arguments` {args} set arguments for the next `:Run` + + *:Break* set a breakpoint at the current line; a sign will be displayed + *:Clear* delete the breakpoint at the current line + + *:Step* execute the gdb "step" command + *:Over* execute the gdb "next" command (`:Next` is a Vim command) + *:Finish* execute the gdb "finish" command + *:Continue* execute the gdb "continue" command + *:Stop* interrupt the program + +If 'mouse' is set the plugin adds a window toolbar with these entries: + Step `:Step` + Next `:Over` + Finish `:Finish` + Cont `:Continue` + Stop `:Stop` + Eval `:Evaluate` +This way you can use the mouse to perform the most common commands. You need +to have the 'mouse' option set to enable mouse clicks. + *:Winbar* +You can add the window toolbar in other windows you open with: > + :Winbar + +If gdb stops at a source line and there is no window currently showing the +source code, a new window will be created for the source code. This also +happens if the buffer in the source code window has been modified and can't be +abandoned. + + +Inspecting variables ~ + *termdebug-variables* *:Evaluate* + `:Evaluate` evaluate the expression under the cursor + `K` same + `:Evaluate` {expr} evaluate {expr} + `:'<,'>Evaluate` evaluate the Visually selected text + +This is similar to using "print" in the gdb window. +You can usually shorten `:Evaluate` to `:Ev`. + + +Other commands ~ + *termdebug-commands* + *:Gdb* jump to the gdb window + *:Program* jump to the window with the running program + *:Source* jump to the window with the source code, create it if there + isn't one + + +Prompt mode ~ + *termdebug-prompt* +When the |+terminal| feature is not supported and on MS-Windows, gdb will run +in a buffer with 'buftype' set to "prompt". This works slightly differently: +- The gdb window will be in Insert mode while typing commands. Go to Normal + mode with <Esc>, then you can move around in the buffer, copy/paste, etc. + Go back to editing the gdb command with any command that starts Insert mode, + such as `a` or `i`. +- The program being debugged will run in a separate window. On MS-Windows + this is a new console window. On Unix, if the |+terminal| feature is + available a Terminal window will be opened to run the debugged program in. + + *termdebug_use_prompt* +Prompt mode can be used even when the |+terminal| feature is present with: > + let g:termdebug_use_prompt = 1 + + +Communication ~ + *termdebug-communication* +There is another, hidden, buffer, which is used for Vim to communicate with +gdb. The buffer name is "gdb communication". Do not delete this buffer, it +will break the debugger. + + +Customizing ~ + +GDB command *termdebug-customizing* + +To change the name of the gdb command, set the "termdebugger" variable before +invoking `:Termdebug`: > + let termdebugger = "mygdb" +< *gdb-version* +Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI +interface. The "new-ui" command requires gdb version 7.12 or later. if you +get this error: + Undefined command: "new-ui". Try "help".~ +Then your gdb is too old. + + +Colors *hl-debugPC* *hl-debugBreakpoint* + +The color of the signs can be adjusted with these highlight groups: +- debugPC the current position +- debugBreakpoint a breakpoint + +The defaults are, when 'background' is "light": + hi debugPC term=reverse ctermbg=lightblue guibg=lightblue + hi debugBreakpoint term=reverse ctermbg=red guibg=red + +When 'background' is "dark": + hi debugPC term=reverse ctermbg=darkblue guibg=darkblue + hi debugBreakpoint term=reverse ctermbg=red guibg=red + + +Shorcuts *termdebug_shortcuts* + +You can define your own shortcuts (mappings) to control gdb, that can work in +any window, using the TermDebugSendCommand() function. Example: > + map ,w :call TermDebugSendCommand('where')<CR> +The argument is the gdb command. + + +Popup menu *termdebug_popup* + +By default the Termdebug plugin sets 'mousemodel' to "popup_setpos" and adds +these entries to the popup menu: + Set breakpoint `:Break` + Clear breakpoint `:Clear` + Evaluate `:Evaluate` +If you don't want this then disable it with: > + let g:termdebug_popup = 0 + + +Vim window width *termdebug_wide* + +To change the width of the Vim window when debugging starts, and use a +vertical split: > + let g:termdebug_wide = 163 +This will set &columns to 163 when :Termdebug is used. The value is restored +when quitting the debugger. +If g:termdebug_wide is set and &Columns is already larger than +g:termdebug_wide then a vertical split will be used without changing &columns. +Set it to 1 to get a vertical split without every changing &columns (useful +for when the terminal can't be resized by Vim). + + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/test_urls.vim b/runtime/doc/test_urls.vim new file mode 100644 index 0000000000..3580b79475 --- /dev/null +++ b/runtime/doc/test_urls.vim @@ -0,0 +1,68 @@ +" Test for URLs in help documents. +" +" Opens a new window with all found URLS followed by return code from curl +" (anything other than 0 means unreachable) +" +" Written by Christian Brabandt. + +func Test_check_URLs() + if has("win32") + echoerr "Doesn't work on MS-Windows" + return + endif + if executable('curl') + " Note: does not follow redirects! + let s:command = 'curl --silent --fail --output /dev/null --head ' + elseif executable('wget') + " Note: only allow a couple of redirects + let s:command = 'wget --quiet -S --spider --max-redirect=2 --timeout=5 --tries=2 -O /dev/null ' + else + echoerr 'Only works when "curl" or "wget" is available' + return + endif + + let pat='\(https\?\|ftp\)://[^\t* ]\+' + exe 'helpgrep' pat + helpclose + + let urls = map(getqflist(), 'v:val.text') + " do not use submatch(1)! + let urls = map(urls, {key, val -> matchstr(val, pat)}) + " remove examples like user@host (invalid urls) + let urls = filter(urls, 'v:val !~ "@"') + " Remove example URLs which are invalid + let urls = filter(urls, {key, val -> val !~ '\<\(\(my\|some\)\?host\|machine\|hostname\|file\)\>'}) + new + put =urls + " remove some more invalid items + " empty lines + v/./d + " remove # anchors + %s/#.*$//e + " remove trailing stuff (parenthesis, dot, comma, quotes), but only for HTTP + " links + g/^h/s#[.,)'"/>][:.]\?$## + g#^[hf]t\?tp:/\(/\?\.*\)$#d + silent! g/ftp://,$/d + silent! g/=$/d + let a = getline(1,'$') + let a = uniq(sort(a)) + %d + call setline(1, a) + + " Do the testing. + set nomore + %s/.*/\=TestURL(submatch(0))/ + + " highlight the failures + /.* \([0-9]*[1-9]\|[0-9]\{2,}\)$ +endfunc + +func TestURL(url) + " Relies on the return code to determine whether a page is valid + echom printf("Testing URL: %d/%d %s", line('.'), line('$'), a:url) + call system(s:command . shellescape(a:url)) + return printf("%s %d", a:url, v:shell_error) +endfunc + +call Test_check_URLs() diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt index 90aa20e8b4..3698348ea7 100644 --- a/runtime/doc/tips.txt +++ b/runtime/doc/tips.txt @@ -1,4 +1,4 @@ -*tips.txt* For Vim version 7.4. Last change: 2009 Nov 07 +*tips.txt* For Vim version 8.1. Last change: 2009 Nov 07 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 21f24a7d33..dbd293526b 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Jul 26 +*todo.txt* For Vim version 8.1. Last change: 2018 May 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7,9 +7,9 @@ TODO list for Vim *todo* This is a veeeery long list of known bugs, current work and desired -improvements. To make it a little bit accessible, the items are grouped by -subject. In the first column of the line a classification is used to be able -to look for "the next thing to do": +improvements. To make it a little bit accessible, the older items are grouped +by subject. In the first column of the line a classification is used to be +able to look for "the next thing to do": Priority classification: 9 next point release @@ -27,108 +27,1254 @@ Priority classification: See |develop.txt| for development plans. You can vote for which items should be worked on, but only if you sponsor Vim development. See |sponsor|. -Issues can also be entered online: http://code.google.com/p/vim/issues/list -Updates will be forwarded to the vim_dev maillist. Issues entered there will -not be repeated below, unless there is extra information. +Issues can also be entered online: https://github.com/vim/vim/issues +Only use this for bug reports, not for questions! Those belong on the +maillist. Updates will be forwarded to the |vim_dev| maillist. Issues +entered there will not be repeated below, unless there is extra information. + +The #1234 numbers refer to an issue or pull request on github. To see it in a +browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- +Prompt buffer: +- Add a command line history. +- delay next prompt until plugin gives OK? + +Terminal emulator window: +- Win32: Termdebug doesn't work, because gdb does not support mi2 on a tty. + This plugin: https://github.com/cpiger/NeoDebug runs gdb as a job, + redirecting input and output. + Open new console for for program with: "set new-console on" +- Win32: Redirecting input does not work, half of Test_terminal_redir_file() + is disabled. +- Win32: Redirecting output works but includes escape sequences. +- Win32: Make terminal used for :!cmd in the GUI work better. Allow for + redirection. +- Terminal API: Add more functionality? (Ozaki Kiichi 2018 May 13, #2907) +- When the job only outputs lines, we could handle resizing the terminal + better: store lines separated by line breaks, instead of screen lines, + then when the window is resized redraw those lines. +- Redrawing is slow with Athena and Motif. (Ramel Eshed) +- For the GUI fill termios with default values, perhaps like pangoterm: + http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 +- When 'encoding' is not utf-8, or the job is using another encoding, setup + conversions. +- Termdebug does not work when Vim was build with mzscheme: gdb hangs just + after "run". Everything else works, including communication channel. Not + initializing mzscheme avoid the problem, thus it's not some #ifdef. + +Does not build with MinGW out of the box: +- _stat64 is not defined, need to use "struct stat" in vim.h +- WINVER conflict, should use 0x0600 by default? + +Crash when mixing matchadd and substitute()? (Max Christian Pohle, 2018 May +13, #2910) Can't reproduce? + +On Win32 when not in the console and t_Co >= 256, allow using 'tgc'. +(Nobuhiro Takasaki, #2833) Also check t_Co. + +Patch to fix arguments of :edit. (Dominique Pelle, 2018 May 28 #2966) + +Ptch to update html syntax. (Jorge Maldonado Ventura, #2974) + +Patch to fix that restoring window doesn't work when 'winheight' is large. +(Darrell Nash, 2018 May 30, #2971) Doesn't work? Issue #2970 + +Patch to add completion to :unlet for environment vars. (Jason Franklin, 2018 +May 30) Last update. + +Errors found with random data: + heap-buffer-overflow in alist_add (#2472) + +More warnings from static analysis: +https://lgtm.com/projects/g/vim/vim/alerts/?mode=list + +Patch to make "is" and "as" work bettter. (Jason Franklin, 2018 May 19) + +Patch to add tests for user and language completion. (Dominique Pelle, 2018 +Jun 2, #2978) + +Using ":file" in quickfix window during an autocommand doesn't work. +(Jason Franklin, 2018 May 23) Allow for using it when there is no argument. + +Pull request #2967: Allow white space in sign text. (Ben Jackson) + +Patch for xterm and vt320 builtin termcap. (Kouichi Iwamoto, 2018 May 31, +#2973) + +Patch to add more testing for :cd command. (Dominique Pelle, 2018 May 30, +#2972) + +Script generated by :mksession does not work well if there are windows with +modified buffers + change "silent only" into "silent only!" + change "edit fname" of first buffer to "hide edit fname" + skip "badd fname" if "fname" is already in the buffer list + remove remark about unloading buffers from documentation + +Patch to make :help work for tags with a ?. (Hirohito Higashi, 2018 May 28) + +Compiler warnings (geeknik, 2017 Oct 26): +- signed integer overflow in do_sub() (#2249) +- signed integer overflow in get_address() (#2248) +- signed integer overflow in getdecchrs() (#2254) +- undefined left shift in get_string_tv() (#2250) + +Patch for more quickfix refactoring. (Yegappan Lakshmanan, #2950) + +Tests failing for "make testgui" with GTK: +- Test_setbufvar_options() +- Test_exit_callback_interval() + +Make balloon_show() work outside of 'balloonexpr'? Users expect it to work: +#2948. (related to #1512?) +On Win32 it stops showing, because showState is already ShS_SHOWING. +balloon_show() does not work properly in the terminal. (Ben Jackson, 2017 Dec +20, #2481) +Also see #2352, want better control over balloon, perhaps set the position. + +Try out background make plugin: + https://github.com/AndrewVos/vim-make-background +or asyncmake: + https://github.com/yegappan/asyncmake + +Add a ModeChanged autocommand that has an argument indicating the old and new +mode. Also used for switching Terminal mode. + +Add an option with file patterns, to be used when unloading a buffer: If there +is a match, remove entries for the buffer from marks, jumplist, etc. To be +used for git temp files. + +Cursor in wrong position when line wraps. (#2540) + +Patch for Lua support. (Kazunobu Kuriyama, 2018 May 26) + +Add an option similar to 'lazyredraw' to skip redrawing while executing a +script or function. + +MS-Windows: write may fail if another program is reading the file. +If 'readonly' is not set but the file appears to be readonly later, try again +(wait a little while). +CreateFile() returns ERROR_SHARING_VIOLATION (Linwei, 2018 May 5) + +Should add a test for every command line argument. Check coverage for what is +missing: --nofork, -A , -b, -h, etc. + +Patch for variable tabstops. On github (Christian Brabandt, 2014 May 15) +Update 2018 March 12, #2711 + +Improve the installer for MS-Windows. There are a few alternatives: +- Add silent install option. (Shane Lee, #751) +- Installer from Cream (Steve Hall). +- Modern UI 2.0 for the Nsis installer. (Guopeng Wen) + https://github.com/gpwen/vim-installer-mui2 +- make it possible to do a silent install, see + http://nsis.sourceforge.net/Docs/Chapter4.html#4.12 + Version from Guopeng Wen does this. +- MSI installer: https://github.com/petrkle/vim-msi/ +- The one on Issue 279. +Problem: they all work slightly different (e.g. don't install vimrun.exe). +How to test that it works well for all Vim users? + +Alternative manpager.vim. (Enno, 2018 Jan 5, #2529) + +Patch to use NGETTEXT() in many more places. (Sergey Alyoshin, 2018 May 25) +Updated ptach May 27. + +Does setting 'cursorline' cause syntax highlighting to slow down? Perhaps is +mess up the cache? (Mike Lee Williams, 2018 Jan 27, #2539) +Also: 'foldtext' is evaluated too often. (Daniel Hahler, #2773) + +When using :packadd files under "later" are not used, which is inconsistent +with packages under "start". (xtal8, #1994) + +Patch to support "xxd -ps". (Erik Auerswald, 2018 May 1) +Lacks a test. + +Column number is wrong when using 'linebreak' and 'wrap'. (Keith Smiley, 2018 +Jan 15, #2555) + +":bufdo e" disabled syntax HL in windows other than the current. (BPJ) + +Check argument of systemlist(). (Pavlov) + +No maintainer for Vietnamese translations. +No maintainer for Simplified Chinese translations. + +Python indenting: alternative way to indent arguments: +http://orchistro.tistory.com/236 +Should be supported with a flag. + +Starting job with cwd option, when the directory does not exist, gives a +confusing error message. (Wang Shidong, 2018 Jan 2, #2519) + +Add the debug command line history to viminfo. + +Avoid that "sign unplace id" does a redraw right away, esp. when there is a +sequence of these commands. (Andy Stewart, 2018 Mar 16) + +ch_sendraw() with long string does not try to read inbetween, which may cause +a deadlock if the reading side is waiting for the write to finish. (Nate +Bosch, 2018 Jan 13, #2548) + +Patch to include a cfilter plugin to filter quickfix/location lists. +(Yegappan Lakshmanan, 2018 May 12) + +Add Makefiles to the runtime/spell directory tree, since nobody uses Aap. +Will have to explain the manual steps (downloading the .aff and .dic files, +applying the diff, etc. + +Pasting a register in Visual mode cannot be repeated. (Mahmoud Al-Qudsi, 2018 +Apr 26, #2849) + +User dictionary ~/.vim/spell/lang.utf-8.add not used for spell checking until a +word is re-added to it. (Matej Cepl, 2018 Feb 6) + +Fold at end of the buffer behaves inconsistently. (James McCoy, 2017 Oct 9) + +With foldmethod=syntax and nofoldenable comment highlighting isn't removed. +(Marcin Szewczyk, 2017 Apr 26) + +Using 'wildignore' also applies to literally entered file name. Also with +:drop (remote commands). + +Patch to support ":tag <tagkind> <tagname". (emmrk, 2018 May 7, #2871) + +Implement option_save() and option_restore(): +option_restore({list}) *option_restore()* + Restore options previously saved by option_save(). + When buffer-local options have been saved, this function must + be called when the same buffer is the current buffer. + When window-local options have been saved, this function must + be called when the same window is the current window. + When in the wrong buffer and/or window an error is given and + the local options won't be restored. + +option_save({list}) *option_save()* + Saves the options named in {list}. The returned value can be + passed to option_restore(). Example: > + let s:saved_options = option_save([ + \ 'ignorecase', + \ 'iskeyword', + \ ]) + au <buffer> BufLeave * + \ call option_restore(s:saved_options) +< The advantage over using `:let` is that global and local + values are handled and the script ID is restored, so that + `:verbose set` will show where the option was originally set, + not where it was restored. + +"gvim --remote" from a directory with non-word characters changes the current +directory (Paulo Marcel Coelho Arabic, 2017 Oct 30, #2266) +Also see #1689. + +ml_get error when using a Python script. (Yggdroot, 2017 Jun 1, #1737) +Lemonboy can reproduce (2017 Jun 5) + +crash when removing an element while inside map(). (Nikolai Pavlov, 2018 Feb +17, #2652) + +When 'virtualedit' is "all" and 'cursorcolumn' is set, the wrong column may be +highlighted. (van-de-bugger, 2018 Jan 23, #2576) + +Patch to parse ":line" in tags file and use it for search. (Daniel Hahler, +#2546) Fixes #1057. Missing a test. + +Patch to add winlayout() function. (Yegappan Lakshmanan, 2018 Jan 4) + +No profile information for function that executes ":quit". (Daniel Hahler, +2017 Dec 26, #2501) + +Get a "No Name" buffer when 'hidden' is set and opening a new window from the +quickfix list. (bfrg, 2018 Jan 22, #2574) + +CTRL-X on zero gets stuck on 0xfffffffffffffffe. (Hengyang Zhao, #2746) + +A function on a dictionary is not profiled. (ZyX, 2010 Dec 25) + +Invalid range error when using BufWinLeave for closing terminal. +(Gabriel Barta, 2017 Nov 15, #2339) + +Using an external diff is inefficient. Not all systems have a good diff +program available (esp. MS-Windows). Would be nice to have in internal diff +implementation. Can then also use this for displaying changes within a line. +Olaf Dabrunz is working on this. (10 Jan 2016) +9 Instead invoking an external diff program, use builtin code. One can be + found here: http://www.ioplex.com/~miallen/libmba/dl/src/diff.c + It's complicated and badly documented. +Alternative: use the xdiff library. Patch from Christian Brabandt, 2018 Mar +20, #2732) + +ml_get errors with buggy script. (Dominique, 2017 Apr 30) + +Error in emsg with buggy script. (Dominique, 2017 Apr 30) + +Join truncates xml comment. (Dmitrii Tcyganok, 2017 Dec 24, #2494) +Requires 'formatoptions' to include "j". (Gary Johnson, 2017 Dec 24) + +Patch to support hunspell. (Matej Cepl, Jan 2018, #2500) Based on older patch +in #846) +Doesn't work on Windows yet. Not ready to included, hard coded paths. + +Win32 GUI: when running a fast timer, the cursor no longer blinks. +Was reported: cursor blinks in terminal on widows with a timer. (xtal8, #2142) + +When a timer is running and typing CTRL-R on the command line, it is not +redrawn properly. (xtal8, 2017 Oct 23, #2241) + +In an optional package the "after" directory is not scanned? +(Renato Fabbri, 2018 Feb 22) + +Universal solution to detect if t_RS is working, using cursor position. +Koichi Iwamoto, #2126 + +Patch for Neovim concerning restoring when closing help window. (glacambre +neovim #7431) + +Default install on MS-Windows should source defaults.vim. +Ask whether to use Windows or Vim key behavior? + +Patch for improving detecting Ruby on Mac in configure. (Ilya Mikhaltsou, 2017 +Nov 21) + +When t_Co is changed from termresponse, the OptionSet autocmmand event isn't +triggered. Use the code from the end of set_num_option() in +set_color_count(). + +Add another autocommand like TermResponse that is fired for the other terminal +responses, such as bg and fg. Use "bg", "fg", "blink", etc. for the name. + +When using command line window, CmdlineLeave is triggered without +CmdlineEnter. (xtal8, 2017 Oct 30, #2263) +Add some way to get the nested state. Although CmdwinEnter is obviously +always nested. + +matchit hasn't been maintained for a long time. #955. + +Patch to add variable name after "scope add". (Eddie Lebow, 2018 Feb 7, #2620) +Maybe not needed? + +Problem with 'delcombine'. (agguser, 2017 Nov 10, #2313) + +MS-Windows: buffer completion doesn't work when using backslash (or slash) +for a path separator. (xtal8, #2201) + +Patch to adjust to DPI setting for GTK. (Roel van de Kraats, 2017 Nov 20, +#2357) + +Test runtime files. +Start with filetype detection: testdir/test_filetype.vim + +Window not closed when deleting buffer. (Harm te Hennepe, 2017 Aug 27, #2029) + +Add options_default() / options_restore() to set several options to Vim +defaults for a plugin. Comments from Zyx, 2017 May 10. +Perhaps use a vimcontext / endvimcontext command block. + +After using :noautocmd CursorMoved may still trigger. (Andy Stewart, 2017 Sep +13, #2084). Set old position after the command. + +Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28) +Still happens (2017 Jul 9) + +When bracketed paste is used, pasting at the ":append" prompt does not get the +line breaks. (Ken Takata, 2017 Aug 22) + +The ":move" command does not honor closed folds. (Ryan Lue, #2351) + +Patch to fix increment/decrement not working properly when 'virtualedit' is +set. (Hirohito Higashi, 2016 Aug 1, #923) + +Memory leaks in test_channel? (or is it because of fork()) +Using uninitialized value in test_crypt. +Memory leaks in test_escaped_glob + +Patch to make gM move to middle of line. (Yasuhiro Matsumoto, Sep 8, #2070) + +Cannot copy modeless selection when cursor is inside it. (lkintact, #2300) + +Include Haiku port. (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) +It can replace the BeOS code, which is likely not used anymore. +Now on github: #1856. Updated Oct 2017 +Got permission to include this under the Vim license. + +Refactored HTML indent file. (Michael Lee, #1821) + +Test_writefile_fails_conversion failure on Solaris because if different iconv +behavior. Skip when "uname" returns "SunOS"? (Pavel Heimlich, #1872) + +'tagrelative' is broken in specific situation. (xaizek, 2017 Oct 19, #2221) + +All functions are global, which makes functions like get() and len() awkward. +For the future use the ~get() and ~len() syntax, e.g.: + mylist~get(idx) + mydict~get(idx) + mystring~len() +Alternatives for ~: + ^ list^get() could also be used + . list.get() already means concatenate + $ list$get() harder to read + @ list@get() harder to read + -> list->get() two characters, used for lambda + +The ++ options for the :edit command are also useful on the Vim command line. + +When recovering a file, put the swap file name in b:recovered_swapfile. Then +a command can delete it. + +Overlong utf-8 sequence is displayed wrong. (Harm te Hennepe, 2017 Sep 14, +#2089) Patch with possible solution by Björn Linse. + +The change list index is local to a buffer, but it doesn't make sense using it +for another buffer. (lacygoll) Copy w_changelistidx to wininfo_S and back. + +X11: Putting more than about 262040 characters of text on the clipboard and +pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23) +clip_x11_request_selection_cb() is called with zero value and length. +Also: Get an error message from free() in the process that owns the selection. +Seems to happen when the selection is requested the second time, but before +clip_x11_convert_selection_cb() is invoked, thus in X library code. +Kazunobu Kuriyama is working on a proper fix. (2017 Jul 25) + +Include a few color schemes, based on popularity: +http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search +http://vimawesome.com/?q=tag:color-scheme +Use names that indicate their appearance (Christian Brabandt, 2017 Aug 3) +- monokai - Xia Crusoe (2017 Aug 4) +- seoul256 - Christian Brabandt (2017 Aug 3) +- gruvbox - Christian Brabandt (2017 Aug 3) (simplified version from + Lifepillar, 2018 Jan 22, #2573) +- janah - Marco Hinz (2017 Aug 4) +- apprentice - Romain Lafourcade (2017 Aug 6) remarks about help file #1964 +Suggested by Hiroki Kokubun: +- [Iceberg](https://github.com/cocopon/iceberg.vim) (my one) +- [hybrid](https://github.com/w0ng/vim-hybrid) +Include solarized color scheme?, it does not support termguicolors. +- Sanitized version of pablo (Lifepillar, 2017 Nov 21) + +Problem with three-piece comment. (Michael Lee, 2017 May 11, #1696) + +Creating a partial with an autoload function is confused about the "self" +attribute of the function. For an unknown function assume "self" and make +that optiona? (Bjorn Linse, 2017 Aug 5) + +Cindent: returning a structure has more indent for the second item. +(Sam Pagenkopf, 2017 Sep 14, #2090) + +Completion mixes results from the current buffer with tags and other files. +Happens when typing CTRL-N while still search for results. E.g., type "b_" in +terminal.c and then CTRL-N twice. +Should do current file first and not split it up when more results are found. +(Also #1890) + +Patch from Christian Brabandt to preserve upper case marks when wiping out a +buffer. (2013 Dec 9) +Also fixes #2166? + +Patch to add argument to :cquit. (Thinca, 2014 Oct 12) + +Python: After "import vim" error messages only show the first line of the +stack trace. (Yggdroot, 2017 Jul 28, #1887) + +Profile of a dict function is lost when the dict is deleted. Would it be +possible to collect this? (Daniel Hahler, #2350) + +Add `:filter` support for various commands (Marcin Szamotulski, 2017 Nov 12 +#2322) Now in #2327? + +When checking if a bufref is valid, also check the buffer number, to catch the +case of :bwipe followed by :new. + +Patch to skip writing a temp file for diffing if the buffer is equal to the +existing file. (Akria Sheng, 2017 Jul 22) +Could also skip writing lines that are the same. + +Patch with Files for Latvian language. (Vitolins, 2017 May 3, #1675) + +MS-Windows: Opening same file in a second gvim hangs. (Sven Bruggemann, 2017 +Jul 4) + +Setting 'clipboard' to "unnamed" makes a global command very slow (Daniel +Drucker, 2017 May 8). +This was supposed to be fixed, did it break again somehow? +Christian cannot reproduce it. + +Using composing char in mapping does not work properly. maparg() shows the +wrong thing. (Nikolai Pavlov, 2017 Jul 8, #1827) +Or is this not an actual problem? + +Better TeX indent file. (Christian Brabandt, 2017 May 3) + +Patch to use a separate code for BS on Windows. (Linwei, #1823) + +Use gvimext.dll from the nightly build? (Issue #249) + +'synmaxcol' works with bytes instead of screen cells. (Llandon, 2017 May 31, +#1736) + +Problem with using :cd when remotely editing a file. (Gerd Wachsmuth, 2017 May +8, #1690) + +Running test_gui and test_gui_init with Motif sometimes kills the window +manager. Problem with Motif? + +Bogus characters inserted when triggering indent while changing text. +(Vitor Antunes, 2016 Nov 22, #1269) + +Using "wviminfo /tmp/viminfo" does not store file marks that Vim knows about, +it only works when merging with an existing file. (Shougo, 2017 Jun 19, #1781) + +Segmentation fault with complete(). (Lifepillar, 2017 Apr 29, #1668) +Check for "pat" to be NULL in search_for_exact_line()? +How did it get NULL? Comment by Christian, Apr 30. + +Is it possible to keep the complete menu open when calling complete()? +(Prabir Shrestha, 2017 May 19, #1713) + +Memory leak in test97? The string is actually freed. Weird. + +Patch to add configure flags to skip rtl, farsi and arabic support. +(Diego Carrión, #1867) + +assert_fails() can only check for the first error. Make it possible to have +it catch multiple errors and check all of them. + +New value "uselast" for 'switchbuf'. (Lemonboy, 2017 Apr 23, #1652) + +Add a toolbar in the terminal. Can be global, above all windows, or specific +for one window. + +Make maparg() also return the raw rhs, so that it doesn't depend on 'cpo'. +(Brett Stahlman, 2017 May 23) +Even better: add a way to disable a mapping temporarily and re-enable it +later. This is for a sub-mode that is active for a short while (one buffer). +Still need maplist() to find the mappings. What can we use to identify a +mapping? Something unique would be better than the LHS. +Perhaps simpler: actually delete the mappings. Use maplist() to list matching +mappings (with a lhs prefix, like maparg()), mapdelete() to delete, +maprestore() to restore (using the output of maplist()). + +Add an argument to :mkvimrc (or add another command) to skip mappings from +plugins (source is a Vim script). No need to put these in a .vimrc, they will +be defined when the plugin is loaded. + +Use tb_set(winid, [{'text': 'stop', 'cb': callback, 'hi': 'Green'}]) + tb_highlight(winid, 'ToolBar') + tb_get(winid) + +json_encode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23) +What if there is an invalid character? + +Json string with trailing \u should be an error. (Lcd) + +import can't be used in define option when include matches too. +(Romain Lafourcade, 2017 Jun 18, #1519) + +When session file has name in argument list but the buffer was deleted, the +buffer is not deleted when using the session file. (#1393) +Should add the buffer in hidden state. + +When an item in the quickfix list has a file name that does not exist, behave +like the item was not a match for :cnext. + +Wrong diff highlighting with three files. (2016 Oct 20, #1186) +Also get E749 on exit. +Another example in #1309 + +When deleting a mark or register, leave a tombstone, so that it's also deleted +when writing viminfo (and the delete was the most recent action). #1339 + +Suggestion to improve pt-br spell checking. (Marcelo D Montu, 2016 Dec 15, +#1330) + +Error in test_startup_utf8 on Solaris. (Danek Duvall, 2016 Aug 17) + +Completion for :!cmd shows each match twice. #1435 + +GTK: When adding a timer from 'balloonexpr' it won't fire, because +g_main_context_iteration() doesn't return. Need to trigger an event when the +timer expires. + +Screen update bug related to matchparen. (Chris Heath, 2017 Mar 4, #1532) + +Rule to use "^" for statusline does not work if a space is defined with +highlighting for both stl and stlnc. Patch by Ken Hamada (itchyny, 2016 Dec 11) + +8 "stl" and "stlnc" in 'fillchars' don't work for multi-byte characters. + Patch by Christian Wellenbrock, 2013 Jul 5. + +Using CTRL-G_U in InsertCharPre causes trouble for redo. (Israel Chauca +Fuentes, 2017 Feb 12, #1470) + +Add a "keytrans()" function, which turns the internal byte representation of a +key into a form that can be used for :map. E.g. + let xx = "\<C-Home>" + echo keytrans(xx) + <C-Home> + +Check for errors E704 and E705 only does VAR_FUNC, should also do VAR_PARTIAL. +(Nikolai Pavlov, 2017 Mar 13, #1557) +Make a function to check for function-like type? + +Screen updated delayed when using CTRL-O u in Insert mode. +(Barlik, #1191) Perhaps because status message? + +Implement optional arguments for functions. + func Foo(start, count = 1 all = 1) + call Foo(12) + call Foo(12, all = 0) + call Foo(12, 15, 0) + +Change the Farsi code to work with UTF-8. Possibly combined with the Arabic +support, or similar. +Invalid read error in Farsi mode. (Dominique Pelle, 2009 Aug 2) + +Add a command to take a range of lines, filter them and put the output +somewhere else. :{range}copy {dest} !cmd + +Patch to fix that empty first tab is not in session. +(Hirohito Higashi, 2016 Nov 25, #1282) + +Patch to add random number generator. (Hong Xu, 2010 Nov 8, update Nov 10) +Alternative from Christian Brabandt. (2010 Sep 19) +New one from Yasuhiro Matsumoto, #1277. + +Patch to fix escaping of job arguments. (Yasuhiro Matsumoto, 2016 Oct 5) +Update Oct 14: https://gist.github.com/mattn/d47e7d3bfe5ade4be86062b565a4bfca +Update Aug 2017: #1954 + +The TermResponse event is not triggered when a plugin has set 'eventignore' to +"all". Netrw does this. (Gary Johnson, 2017 Jan 24) +Postpone the event until 'eventignore' is reset. + +Expanding /**/ is slow. Idea by Luc Hermitte, 2017 Apr 14. + +Once .exe with updated installer is available: Add remark to download page +about /S and /D options (Ken Takata, 2016 Apr 13) +Or point to nightly builds: https://github.com/vim/vim-win32-installer/releases + +Problem passing non-UTF-8 strings to Python 3. (Björn Linse, 2016 Sep 11, +#1053) With patch, does it work? + +Using --remote to open a file in which a # appears does not work on +MS-Windows. Perhaps in \# the \ is seen as a path separator. (Axel Bender, +2017 Feb 9) Can we expand wildcards first and send the path literally to the +receiving Vim? Or make an exception for #, it's not useful remotely. + +":sbr" docs state it respects 'switchbuf', but "vsplit" does not cause a +vertical split. (Haldean Brown, 2017 Mar 1) + +Use ADDR_OTHER instead of ADDR_LINES for many more commands. +Add tests for using number larger than number of lines in buffer. + +Might be useful to have isreadonly(), like we have islocked(). +Avoids exceptions, e.g. when using the b: namespace as a dict. + +Patch to make v:shell_error writable. (Christian Brabandt, 2016 Sep 27) +Useful to restore it. Is there another solution? + +"ci[" does not look for next [ like ci" does look for next ". +(J.F. 2017 Jan 7) + +Patch for wrong cursor position on wrapped line, involving breakindent. +(Ozaki Kiichi, 2016 Nov 25) +Does this also fix #1408 ? + +'cursorline' and match interfere. (Ozaki Kiichi, 2017 Jun 23, #1792) + +Patch for 'cursorlinenr' option. (Ozaki Kiichi, 2016 Nov 30) + +Patch to fix profiling condition lines. (Ozaki Kiichi,, 2017 Dec 26, #2499) + +Patch to be able to separately map CTRL-H and BS on Windows. +(Linwei, 2017 Jul 11, #1833) + +When 'completeopt' has "noselect" does not insert a newline. (Lifepillar, 2017 +Apr 23, #1653) + +Window resizing with 'winfixheight': With a vertical split the height changes +anyway. (Tommy allen, 2017 Feb 21, #1502) + +When adding an item to a new quickfix list make ":cnext" jump to that item. +Make a difference being at the first item and not having used :cnext at all. +(Afanasiy Fet, 2017 Jan 3) + +Invalid behavior with NULL list. (Nikolai Pavlov, #768) +E.g. deepcopy(test_null_list()) + +Patch to make it possible to extend a list with itself. +(Nikolai Pavlov, 2016 Sep 23) + +Patch to add Zstandard compressed file support. (Nick Terrell, 2016 Oct 24) + +Patch to add MODIFIED_BY to MSVC build file. (Chen Lei, 2016 Nov 24, #1275) + +Patch to change argument of :marks. (LemonBoy, 2017 Jan 29, #1426) + +On Windows buffer completion sees backslash as escape char instead of path +separator. (Toffanim, 2016 Nov 24, #1274) + +min() and max() spawn lots of error messages if sorted list/dictionary +contains invalid data (Nikolay Pavlov, 2016 Sep 4, #1039) + +Should :vmap in matchit.vim be :xmap? (Tony Mechelynck) + +Problem with whitespace in errorformat. (Gerd Wachsmuth, 2016 May 15, #807) + +Undo problem: "g-" doesn't go back, gets stuck. (Björn Linse, 2016 Jul 18) + +Add "unicode true" to NSIS installer. Doesn't work with Windows 95, which we +no longer support. + +sort() is not stable when using numeric/float sort (Nikolay Pavlov, 2016 Sep +4#1038) + ++channel: +- Add a separate timeout for opening a socket. Currently it's fixed at 50 + msec, which is too small for a remote connection. (tverniquet, #2130) +- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026) +- Writing raw mode to a buffer should still handle NL characters as line + breaks. (Dmitry Zotikov, 2017 Aug 16) +- When out_cb executes :sleep, the close_cb may be invoked. (Daniel Hahler, + 2016 Dec 11, #1320) +- Implement |job-term| ? +- Channel test fails with Motif. Sometimes kills the X11 server. +- When a message in the queue but there is no callback, drop it after a while? + Add timestamp to queued messages and callbacks with ID, remove after a + minute. Option to set the droptime. +- Add an option to drop text of very long lines? Default to 1 Mbyte. +- Add remark about undo sync, is there a way to force it? +- When starting a job, have an option to open the server socket, so we know + the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz, + Feb 9) How to do this on MS-Windows? +- For connection to server, a "keep open" flag would be useful. Retry + connecting in the main loop with zero timeout. +- job_start(): run job in a newly opened terminal (not a terminal window). + With xterm could use -S{pty}. + Although user could use "xterm -e 'cmd arg'". + Regexp problems: +- When search pattern has the base character both with and without combining + character, search fails. E.g. "รรีบ" in "การรีบรักใคร". (agguser, #2312) +- [:space:] only matches ASCII spaces. Add [:white:] for all space-like + characters, esp. including 0xa0. Use character class zero. +- Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6. + (Manuel Ortega, 2016 Apr 24) + Test fails on Mac. Avoid using isalpha(), isalnum(), etc? Depends on + LC_CTYPE +- The old engine does not find a match for "/\%#=1\(\)\{80}", the new engine + matches everywhere. +- Using win_linetabsize() can still be slow. Cache the result, store col and + vcol. Reset them when moving to another line. +- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4) - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$' (Lech Lorens, 2014 Feb 3) - Issue 164: freeze on regexp search. - Ignorecase not handled properly for multi-byte characters. (Axel Bender, 2013 Dec 11) -- Using \@> and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin Szamotulski - Remark from Brett 2014 Jan 6 and 7. -- Bug when using \>. (Ramel, 2014 Feb 2) (Aaron Bohannon, 2014 Feb 13) +- Using \@> and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin + Szamotulski; Remark from Brett 2014 Jan 6 and 7. - NFA regexp doesn't handle \%<v correctly. (Ingo Karkat, 2014 May 12) - Does not work with NFA regexp engine: \%u, \%x, \%o, \%d followed by a composing character +- Search for \%d0\+ may fail with E363. (Christian Brabandt, 2016 Oct 4) +- \%'[ does not work. '%'] does work. (Masaaki Nakamura, 2016 Apr 4) - Bug relating to back references. (Ingo Karkat, 2014 Jul 24) +- New RE does not give an error for empty group: "\(\)\{2}" (Dominique Pelle, + 2015 Feb 7) +- Using back reference before the capturing group sometimes works with the old + engine, can we do this with the new engine? E.g. with + "/\%(<\1>\)\@<=.*\%(<\/\(\w\+\)>\)\@=" matching text inside HTML tags. + This problem is probably the same: "\%(^\1.*$\n\)\@<=\(\d\+\).*$". + (guotuofeng, 2015 Jun 22) +- Strange matching with "\(Hello\n\)\@<=A". (Anas Syed, 2015 Feb 12) +- Problem with \v(A)@<=b+\1c. (Issue 334) +- Diff highlighting can be very slow. (Issue 309) +- Using %> for a virtual column has a check based on 'tabsize'. Better would + be to cache the result of win_linetabsize(col), storing both col and vcol, + and use them to decide whether win_linetabsize() needs to be called. Reset + col and vcol when moving to another line. +- this doesn't work: "syntax match ErrorMsg /.\%9l\%>20c\&\%<28c/". Leaving + out the \& works. Seems any column check after \& fails. +- Difference between two engines: ".*\zs\/\@>\/" on text "///" + (Chris Paul, 2016 Nov 13) New engine not greedy enough? + Another one: echom matchstr(" sdfsfsf\n sfdsdfsdf",'[^\n]*') + (2017 May 15, #1252) + +Patch to add "cmdline" completion to getcompletion(). (Shougo, Oct 1, #1140) + +Feature request: Complete members of a dictionary. (Luc Hermitte, 2017 Jan 4, +#1350) -Still using freed memory after using setloclist(). (lcd, 2014 Jul 23) +Undo message is not always properly displayed. Patch by Ken Takata, 2013 oct +3. Doesn't work properly according to Yukihiro Nakadaira. +Also see #1635. -Patch to make getregtype() return the right size for non-linux systems. -(Yasuhiro Matsumoto, 2014 Jul 8) -Breaks test_eval. Inefficient, can we only compute y_width when needed? +Patch for systemlist(), add empty item. (thinca, Sep 30, #1135) +Add an argument to choose binary or non-binary (like readfile()), when omitted +use the current behavior. +Include the test. + +Patch to add tagfunc(). Cleaned up by Christian Brabandt, 2013 Jun 22. +New update 2017 Apr 10, #1628 + +When 'keywordprg' starts with ":" the argument is still escaped as a shell +command argument. (Romain Lafourcade, 2016 Oct 16, #1175) + +Patch to support CamelCase for spell checking: See a lower-to-upper case +change as a word boundary. (btucker-MPCData, 2016 Nov 6, #1235) +patch for 'spellcamelcase' option: spellcheck each CamelCased word. +(Ben Tucker, 2016 Dec 2) + +Idea from Sven: record sequence of keys. Useful to show others what they are +doing (look over the shoulder), and also to see what happened. +Probably list of keystrokes, with some annotations for mode changes. +Could store in logfile to be able to analyse it with an external command. +E.g. to see when's the last time a plugin command was used. + +execute() cannot be used with command completion. (Daniel Hahler, 2016 Oct 1, +#1141) + +cmap using execute() has side effects. (Killthemule, 2016 Aug 17, #983) + +:map X may print invalid data. (Nikolay Pavlov, 2017 Jul 3, #1816) + +Patch to order results from taglist(). (Duncan McDougall, 2016 Oct 25) + +When using ":diffput" through a mapping, undo in the target buffer isn't +synced. (Ryan Carney, 2016 Sep 14) + +Syntax highlighting for messages with RFC3339 timestamp (#946) +Did maintainer reply? + +Patch to avoid problem with special characters in file name. +(Shougo, 2016 Sept 19, #1099) Not finished? + +ml_get errors when reloading file. (Chris Desjardins, 2016 Apr 19) +Also with latest version. + +Cannot delete a file with square brackets with delete(). (#696) + +Patch to add ":syn foldlevel" to use fold level further down the line. +(Brad King, 2016 Oct 19, update 2017 Jan 30) + +Completion for input() does not expand environment variables. (chdiza, 2016 +Jul 25, #948) + +Patch to add 'systemencoding', convert between 'encoding' and this for file +names, shell commands and the like. (Kikuchan, 2010 Oct 14) +Assume the system converts between the actual encoding of the filesystem to +the system encoding (usually utf-8). + +Using ":tab drop file" does not trigger BufEnter or TabEnter events. +(Andy Stewart, 2017 Apr 27, #1660) +Autocommands blocked in do_arg_all(). Supposed to happen later? + +'hlsearch' interferes with a Conceal match. (Rom Grk, 2016 Aug 9) + +MS-Windows: use WS_HIDE instead of SW_SHOWMINNOACTIVE in os_win32.c? +Otherwise task flickers in taskbar. + +Should make ":@r" handle line continuation. (Cesar Romani, 2016 Jun 26) +Also for ":@.". + +Repeating 'opfunc' in a function only works once. (Tarmean, 2016 Jul 15, #925) + +Have a way to get the call stack, in a function and from an exception. +#1125 + +Second problem in #966: ins_compl_add_tv() uses get_dict_string() multiple +times, overwrites the one buffer. (Nikolay Pavlov, 2016 Aug 5) + +This does not work: :set cscopequickfix=a- +(Linewi, 2015 Jul 12, #914) + +Possibly wrong value for seq_cur. (Florent Fayolle, 2016 May 15, #806) + +Filetype plugin for awk. (Doug Kearns, 2016 Sep 5) + +Patch to improve map documentation. Issue #799. + +Patch for syntax folding optimization. (Shougo, 2016 Sep 6, #1045) + +We can use '. to go to the last change in the current buffer, but how about +the last change in any buffer? Can we use ', (, is next to .)? + +Ramel Eshed: system() is much slower than job_start(), why? (Aug 26) + +When generating the Unicode tables with runtime/tools/unicode.vim the +emoji_width table has only one entry. + +It's possible to add ",," to 'wildignore', an empty entry. Causes problems. +Reject the value? #710. + +When doing "vi buf.md" a BufNew autocommand for *.md is not triggered. +Because of using the initial buffer? (Dun Peal, 2016 May 12) + +Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12) +Updated 2016 Jun 10, #858 Update 2017 Mar 28: use <buffer> + +Add redrawtabline command. (Naruhiko Nishino, 2016 Jun 11) + +Neovim patch for utfc_ptr2char_len() https://github.com/neovim/neovim/pull/4574 +No test, needs some work to include. + +Patch to improve indenting for C++ constructor with initializer list. +(Hirohito Higashi, 2016 Mar 31) + +Zero-out krypt key information when no longer in use. (Ben Fritz, 2017 May 15) + +Add stronger encryption. Could use libsodium (NaCl). +https://github.com/jedisct1/libsodium/ +Possibly include the needed code so that it can be build everywhere. + +Add a way to restart a timer. It's similar to timer_stop() and timer_start(), +but the reference remains valid. + +Need to try out instructions in INSSTALLpc.txt about how to install all +interfaces and how to build Vim with them. +Appveyor build with self-installing executable, includes getting most +interfaces: https://github.com/k-takata/vim/tree/chrisbra-appveyor-build +result: https://ci.appveyor.com/project/k-takata/vim/history Problem that a previous silent ":throw" causes a following try/catch not to -work. (ZyX, 2013 Sep 28) +work. (ZyX, 2013 Sep 28) With examples: (Malcolm Rowe, 2015 Dec 24) + +Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) + +Patch to make tests pass with EBCDIC. (Owen Leibman, 2016 Apr 10) + +Add ":read :command", to insert the output of an Ex command? +Can already do it with ":$put =execute('command')". + +When repeating the 'confirm' dialog one needs to press Enter. (ds26gte, 2016 +Apr 17) #762 + +exists(":tearoff") does not tell you if the command is implemented. (Tony +Mechelynck) Perhaps use exists("::tearoff") to check? + +Use vim.vim syntax highlighting for help file examples, but without ":" in +'iskeyword' for syntax. + +Patch to make "%:h:h" return "." instead of the full path. +(Coot, 2016 Jan 24, #592) + +Remove SPACE_IN_FILENAME ? What could possibly go wrong? -DiffChange highlighting doesn't combine with 'cursurline'. (Benjamin Fritz) -Patch by Christian (2014 Jul 12) +When command names are very long :command output is difficult to read. Use a +maximum for the column width? (#871) +Patcy by varmanishant, 2016 Jun 18, #876 -BufWinLeave autocommand executed in the wrong buffer? (Davit Samvelyan, 2014 -Jul 14) +Installation of .desktop files does not work everywhere. +It's now fixed, but the target directory probably isn't right. +Add configure check? +Should use /usr/local/share/applications or /usr/share/applications. +Or use $XDG_DATA_DIRS. +Also need to run update-desktop-database (Kuriyama Kazunobu, 2015 Nov 4) -When 'clipboard' is "unnamed", :g/pat/d is very slow. Only set the clipboard -after the last delete? (Praful, 2014 May 28) -Patch by Christian Brabandt, 2014 Jun 18. Update Jun 25. +Test object i{ and it do not behave the same. #1379 +Do not include the linebreak at the start? -Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) +Patch to have text objects defined by arbitrary single characters. (Daniel +Thau, 2013 Nov 20, 2014 Jan 29, 2014 Jan 31) +Added tests (James McCoy, 2016 Aug 3). Still needs more work. + +Feature request: add the "al" text object, to manipulate a screen line. +Especially useful when using 'linebreak' + +Access to uninitialized memory in match_backref() regexp_nda.c:4882 +(Dominique Pelle, 2015 Nov 6) ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) -The entries added by matchaddpos() are returned by getmatches() but can't be -set with setmatches(). (lcd47, 2014 Jun 29) +In debug mode one can inspect variables, but not the function parameters +(starting with a:). (Luc Hermitte, 2017 Jan 4, #1352) -Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) +If ":bd" also closes a Tab page then the " mark is not set. (Harm te Hennepe, +2016 Apr 25, #780) + +Patch to avoid redrawing tabline when the popup menu is visible. +(Christian Brabandt, 2016 Jan 28) + +Patch to add {skip} argument to search(). (Christian Brabandt, 2016 Feb 24) +Update 2016 Jun 10, #861 + +Patch to be able to use hex numbers with :digraph. (Lcd, 2015 Sep 6) +Update Sep 7. Update by Christian Brabandt, 2015 Sep 8, 2016 Feb 1. + +Patch to show search statistics. (Christian Brabandt, 2016 Jul 22) + +When the CursorMovedI event triggers, and CTRL-X was typed, a script cannot +restore the mode properly. (Andrew Stewart, 2016 Apr 20) +Do not trigger the event? + +Using ":windo" to set options in all windows has the side effect that it +changes the window layout and the current window. Make a variant that saves +and restores. Use in the matchparen plugin. +Perhaps we can use ":windo <restore> {cmd}"? +Patch to add <restore> to :windo, :bufdo, etc. (Christian Brabandt, 2015 Jan +6, 2nd message) +Alternative: ":keeppos" command modifier: ":keeppos windo {cmd}". + +Patch to fix that executable() may fail on very long filename in MS-Windows. +(Ken Takata, 2016 Feb 1) + +Patch to fix display of listchars on the cursorline. (Nayuri Aohime, 2013) +Update suggested by Yasuhiro Matsumoto, 2014 Nov 25: +https://gist.github.com/presuku/d3d6b230b9b6dcfc0477 + +Patch to make the behavior of "w" more straightforward, but not Vi compatible. +With a 'cpo' flag. (Christian Brabandt, 2016 Feb 8) + +Patch to add optionproperties(). (Anton Lindqvist, 2016 Mar 27, update Apr 13) + +Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3) + +Patch to add Error autocommand. (Anton Lindqvist, 2016 Feb 17) +Only remembers one error. + +Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. + +Unexpected delay when using CTRL-O u. It's not timeoutlen. +(Gary Johnson, 2015 Aug 28) + +Instead of separately uploading patches to the ftp site, we can get them from +github with a URL like this: + https://github.com/vim/vim/compare/v7.4.920%5E...v7.4.920.diff +Diff for version.c contains more context, can't skip a patch. Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -When using an undo file, also restore the changelist, so that "g;" works. +Comparing nested structures with "==" uses a different comparator than when +comparing individual items. +Also, "'' == 0" evaluates to true, which isn't nice. +Add "===" to have a strict comparison (type and value match). +Add "==*" (?) to have a value match, but no automatic conversion, and v:true +equals 1 and 1.0, v:false equals 0 and 0.0.? + +Using uninitialized memory. (Dominique Pelle, 2015 Nov 4) + +MS-Windows: When editing a file with a leading space, writing it uses the +wrong name. (Aram, 2014 Nov 7) Vim 7.4. + +Can't recognize the $ProgramFiles(x86) environment variable. Recognize it +specifically? First try with the parens, then without. + +Patch to add :mapgroup, put mappings in a group like augroup. +(Yasuhiro Matsumoto, 2016 Feb 19) Value returned by virtcol() changes depending on how lines wrap. This is -inconsistant with the documentation. +inconsistent with the documentation. + +Value of virtcol() for '[ and '] depend on multi-byte character. +(Luchr, #277) + +Can we cache the syntax attributes, so that updates for 'relativenumber' and +'cursorline'/'cursorcolumn' are a lot faster? Thus store the attributes +before combining them. + +C highlighting: modern C allows: /* comment */ #ifdef +and also line continuation after #include. +I can't recommend it though. + +Build with Python on Mac does not always use the right library. +(Kazunobu Kuriyama, 2015 Mar 28) + +Patch to add arguments to argc() and argv(). (Yegappan Lakshmanan, 2016 Jan +24) Also need a way to get the global arg list? Update later on Jan 24 +Update Mar 5. Update Apr 7. Update Jun 5. + +To support Thai (and other languages) word boundaries, include the ICU +library: http://userguide.icu-project.org/boundaryanalysis + +When complete() first argument is before where insert started and 'backspace' +is Vi compatible, the completion fails. (Hirohito Higashi, 2015 Feb 19) + +Patch to use two highlight groups for relative numbers. (Shaun Brady, 2016 Jan +30) MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) +The OptionSet autocommand event is not always triggered. (Rick Howe, 2015 Sep +24): :diffthis, :diffoff. + +":set all&" still does not handle all side effects. Centralize handling side +effects for when set by the user, on init and when reset to default. + +":tag" does not jump to the right entry of a :tselect. (James Speros, 2015 Oct +9) + +The argument for "-S" is not taken literally, the ":so" command expands +wildcards. Add a ":nowild" command modifier? (ZyX, 2015 March 4) + +Proposal to make options.txt easier to read. (Arnaud Decara, 2015 Aug 5) +Update Aug 14. + +When using --remote-tab on MS-Windows 'encoding' hasn't been initialized yet, +the file name ends up encoded wrong. (Raul Coronado, 2015 Dec 21) + +Example in editing.txt uses $HOME with the expectation that it ends in a +slash. For me it does, but perhaps not for everybody. Add a function that +inserts a slash when needed? pathconcat(dir, path) (Thilo Six, 2015 Aug 12) + +ml_updatechunk() is slow when retrying for another encoding. (John Little, +2014 Sep 11) + +Patch to fix checking global option value when not using it. +(Arnaud Decara, 2015 Jul 23) + +When 'showbreak' is set repeating a Visual operation counts the size of the +'showbreak' text as part of the operation. (Axel Bender, 2015 Jul 20) + +Patch for multi-byte characters in langmap and applying a mapping on them. +(Christian Brabandt, 2015 Jun 12, update July 25) +Is this the right solution? Need to cleanup langmap behavior: +- in vgetorpeek() apply langmap to the typeahead buffer and put the result in + a copy-buffer, only when langmap is appropriate for the current mode. Then + check for mapping and let gotchars() work on the copy-buffer. +- Remove LANGMAP_ADJUST() in other parts of the code. Make sure the mode is + covered by the above change. +So that replaying the register doesn't use keymap/langmap and still does the +same thing. Remarks on issue 543 (Roland Puntaier). +Also see #737: langmap not applied to replaying recording. + +Patch to add grepfile(). (Scott Prager, 2015 May 26) +Work in progress. + +Would be useful to have a treemap() or deepmap() function. Like map() but +when an item is a list or dict would recurse into it. + +Patch for global-local options consistency. (Arnaud Decara, 2015 Jul 22) +Is this right? + +Patch to make getregtype() return the right size for non-linux systems. +(Yasuhiro Matsumoto, 2014 Jul 8) +Breaks test_eval. Inefficient, can we only compute y_width when needed? + +Patch to use different terminal mode settings for system(). (Hayaki Saito) +Does this work for everybody? + +Patch for man.vim. (SungHyun Nam, 2015 May 20) +Doesn't work completely (Dominique Orban) + +Patch to add a "literal" argument to bufnr(). (Olaf Dabrunz, 2015 Aug 4) + +When a session file is created and there are "nofile" buffers, these are not +filled. Need to trigger BufReadCmd autocommands. Also handle deleting the +initial empty buffer better. (ZyX, 2015 March 8) + +Extended file attributes lost on write (backupcopy=no). Issue 306. + +Patch to add :lockjumps. (Carlo Baldassi, 2015 May 25) +OK to not block marks? + +Mixup of highlighting when there is a match and SpellBad. (ZyX, 2015 Jan 1) + +Patch on Issue 72: 'autochdir' causes problems for :vimgrep. + +When two SIGWINCH arrive very quickly, the second one may be lost. +(Josh Triplett, 2015 Sep 17) + +Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24) + +Result of systemlist() does not show whether text ended in line break. +(Bjorn Linse, 2014 Nov 27) + +When in 'comments' "n:x" follows after three-part comment directly it repeats +any one-character from the previous line. (Kartik Agaram, 2014 Sep 19) + Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) +Should be easy to highlight all matches with 'incsearch'. Idea by Itchyny, +2015 Feb 6. + +Wrong scrolling when using incsearch. Patch by Christian Brabandt, 2014 Dec 4. +Is this a good solution? + +Patch: Let rare word highlighting overrule good word highlighting. +(Jakson A. Aquino, 2010 Jul 30, again 2011 Jul 2) + +Patch to add digits argument to round(). (Yasuhiro Matsumoto, 2015 Apr 26) + +Can assign to s:type when a function s:type has been defined. +Also the other way around: define a function while a variable with that name +was already defined. +(Yasuhiro Matsumoto, 2014 Nov 3) + +Patch for ordered dict. (Ozaki Kiichi, 2015 May 7) + +Patch to make closed folds line up. (Charles Campbell, 2014 Sep 12) +Remark from Roland Eggner: does it cause crashes? (2014 Dec 12) +Updated patch by Roland Eggner, Dec 16 +Updated patch from Charles, 2016 Jul 2 + +Patch to open folds for 'incsearch'. (Christian Brabandt, 2015 Jan 6) + +Patch for building a 32bit Vim with 64bit MingW compiler. +(Michael Soyka, 2014 Oct 15) + +Patch: On MS-Windows shellescape() may have to triple double quotes. +(Ingo Karkat, 2015 Jan 16) + +Redo only remembers the last change. Could use "{count}g." to redo an older +change. How does the user know which change? At least have a way to list +them: ":repeats". + +Patch for glob(), adding slash to normal files. (Ingo Karkat, 2014 Dec 22) + +When entering and leaving the preview window autocommands are triggered, but +these may not work well. Perhaps set a flag to indicate that the preview +window is involved? (John Otter, 2015 Oct 27) + +Using "." to repeat an Ex command puts that command in history. Probably +should not happen. If the command is the result of a mapping it's not put in +history either. (Jacob Niehus, 2014 Nov 2) +Patch from Jacob, Nov 2. + "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 Jun 8) -Syntax file for gnuplot. Existing one is very old. (Andrew Rasmussen, 2014 -Feb 24) - -Issue 174: Detect Mason files. +Bug: Autocompleting ":tag/pat" replaces "/pat" with a match but does not +insert a space. (Micha Mos, 2014 Nov 7) No error for missing endwhile. (ZyX, 2014 Mar 20) -Phpcomplete.vim update. (Complex, 2014 Jan 15) +Patch to make extend() fail early when it might fail at some point. +(Olaf Dabrunz, 2015 May 2) Makes extend() slower, do we still want it? +Perhaps only the checks that can be done without looping over the dict or +arguments. -PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19) +Problem with transparent and matchgroup. Issue #475 -Patch for matchparen. (James McCoy, 2014 Jul 11) +Patch to add :arglocal and :arglists. (Marcin Szamotulski, 2014 Aug 6) Spell files use a latin single quote. Unicode also has another single quote: 0x2019. (Ron Aaron, 2014 Apr 4) New OpenOffice spell files support this with ICONV. But they are not compatible with Vim spell files. The old files can no longer be downloaded. -Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) -Also fixes wrong result from executable(). -Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. +Spell checking: Add a feature to only consider two spaces after a dot to start +a new sentence. Don't give the capitalization error when there is one space. -Win32: use 64 bit stat() if possible. (Ken Takata, 2014 May 12) -More tests May 14. Update May 29. - -The garbage collector may use too much stack. Make set_ref_in_item() -iterative instead of recursive. Test program by Marc Weber (2013 Dec 10) -Patch by Ben Fritz, 2014 Jun 22. +xterm should be able to pass focus changes to Vim, so that Vim can check for +buffers that changed. Perhaps in misc.c, function selectwindow(). +Xterm 224 supports it! +Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki +Saito, 2013 Apr 24) Update 2016 Aug 12. +Also see issue #609. +We could add the enable/disable sequences to t_ti/t_te or t_ks/t_ke. Idea: For a window in the middle (has window above and below it), use right-mouse-drag on the status line to move a window up/down without changing -it's height? It's like dragging the status bar above it at the same time. +its height? It's like dragging the status bar above it at the same time. -Can we make ":unlet $VAR" use unsetenv() to delete the env var? -What for systems that don't have unsetenv()? +Patch to add a :domodeline command. (Christian Brabandt, 2014 Oct 21) This does not give an error: (Andre Sihera, 2014 Mar 21) vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1' @@ -143,11 +1289,13 @@ Problem with upwards search on Windows (works OK on Linux). (Brett Stahlman, 2014 Jun 8) Include a plugin manager with Vim? Neobundle seems to be the best currently. +Also Vundle: https://github.com/gmarik/vundle Long message about this from ZyX, 2014 Mar 23. And following replies. Also see http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html User view: -- Support multiple sources, basically any http:// URL. Be able to look into - the files before deciding to install. +- Support multiple sources, basically any http:// URL. Or a central place that + will work for everybody (github? redirects from vim.org?). + Be able to look into the files before deciding to install. - Be able to try out a plugin and remove it again with (almost) no traces. - Each plugin needs a "manifest" file that has the version, dependencies (including Vim version and features), conflicts, list of files, etc. @@ -179,9 +1327,6 @@ Out of scope: Setting the spell file in a session only reads the local additions, not the normal spell file. (Enno Nagel, 2014 Mar 29) -CTRL-] in Visual mode uses the selected text as a tag. This does not work -when preceded with CTRL-W. (Patrick Hemmer, 2014 Jun 28) - When typing the first character of a command, e.g. "f", then using a menu, the menu item doesn't work. Clear typeahead when using a menu? @@ -191,69 +1336,38 @@ Editing an ascii file as ucs-2 or ucs-4 causes display errors. ":Next 1 some-arg" does not complain about trailing argument. Also for various other commands. (ZyX, 2014 Mar 30) -patch to skip sort if no line matches the expression. +Patch to skip sort if no line matches the expression. (Christian Brabandt, 2014 Jun 25) -Patch to add sortuniq(). (Cade Forester, 2014 Mar 19) -Or add uniq() instead? Patch by lcd47, but it has problems. - -Patch to support sorting on floating point number. (Alex Jakushev, 2010 Oct -30) - -Patch to support expression argument to sort() instead of a function name. -Yasuhiro Matsumoto, 2013 May 31. -Or should we add a more general mechanism, like lambda functions? - VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow instead. (Samuel Ferencik, 2013 Sep 28) Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4) Remark on the docs. Should not be a compile time feature. But then what? -Completion of ":e" is ":earlier", whould be ":edit". Complete to the matching +Completion of ":e" is ":earlier", should be ":edit". Complete to the matching command instead of doing this alphabetically. (Mikel Jorgensen) -Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29). - -Patch to make test 100 work on MS-Windows. (Taro Muraoka, 2013 Dec 12) - Patch to define macros for hardcoded values. (Elias Diem, 2013 Dec 14) -Perl: support for Activestate perl 5.18: Issue 170. - Several syntax file match "^\s*" which may get underlined if that's in the highlight group. Add a "\zs" after it? -Patch to fix temp directories for Windows, so that it works without tweaking. -Issue 28. - -Go through more coverity reports. +The undo file name can get too long. (Issue 346) +For the path use a hash instead of dir%dir%dir%name hash%name. Patch to add ":undorecover", get as much text out of the undo file as -possible. (Christian Brabandt, 2014 Mar 12) - -Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) +possible. (Christian Brabandt, 2014 Mar 12, update Aug 22) Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16) -Some quickfix messages appear twice. (Gary Johnson, 2014 Feb 16) -Patch by Christian Brabandt, 2014 Feb 17. - Patch to right-align signs. (James Kolb (email james), 2013 Sep 23) Patch to handle integer overflow. (Aaron Burrow, 2013 Dec 12) -With "$" in 'cpoptions' the popup menu isn't fully drawn. (Matti Niemenmaa, -2013 Sep 5) - Patch to add "ntab" item in 'listchars' to repeat first character. (Nathaniel Braun, pragm, 2013 Oct 13) A better solution 2014 Mar 5. -Undo message is not always properly displayed. Patch by Ken Takata, 2013 oct -3. Doesn't work properly according to Yukihiro Nakadaira. - -/[b-a] gives error E16, should probably be E769. - 7 Windows XP: When using "ClearType" for text smoothing, a column of yellow pixels remains when typing spaces in front of a "D" ('guifont' set to "lucida_console:h8"). @@ -261,17 +1375,9 @@ Patch by Thomas Tuegel, also for GTK, 2013 Nov 24 :help gives example for z?, but it does not work. m? and t? do work. -Python: Extended funcrefs: use func_T* structure in place of char_u* function -names. -(ZyX, 2013 Jul 15, update Sep 22, 24, 28; Update 2013 Dec 15, 2014 Jan 6) -Also fixes Bug: E685 error for func_unref(). (ZyX, 2010 Aug 5) - Patch to add funcref to Lua. (Luis Carvalho, 2013 Sep 4) With tests: Sep 5. -Patch to fix that on suckless Terminal mousewheel up does not work. -(Ralph Eastwood, 2013 Nov 25) - Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10) Checking runtime scripts: Thilo Six, 2012 Jun 6. @@ -280,19 +1386,7 @@ When evaluating expression in backticks, autoload doesn't work. (Andy Wokula, 2013 Dec 14) Using <nr>ifoobar<esc> can slow down Vim. Patch by Christian Brabandt, 2013 -Dec 13. - -Fold can't be opened after ":move". (Ein Brown) -Patch from Christian Brabandt doesn't fix it completely. - -Patch from Christian Brabandt to preserve upper case marks when wiping out a -buffer. (2013 Dec 9) - -Patch for drag&drop reordering of GUI tab pages reordering. -(Ken Takata, 2013 Nov 22, second one, also by Masamichi Abe) - -":sign-jump" uses first window in buffer instead of current window. -Patch by James McCoy, 2013 Nov 22. +Dec 13. Only helps a bit, 10000ii<Esc> is still too slow. GTK: problem with 'L' in 'guioptions' changing the window width. (Aaron Cornelius, 2012 Feb 6) @@ -314,26 +1408,12 @@ Patch to allow more types in remote_expr(). (Lech Lorens, 2014 Jan 5) Doesn't work for string in list. Other way to pass all types of variables reliably? -Using ":call foo#d.f()" doesn't autoload the "foo.vim" file. -That is, calling a dictionary function on an autoloaded dict. -Works OK for echo, just not for ":call" and ":call call()". (Ted, 2011 Mar -17) -Patch by Christian Brabandt, 2013 Mar 23. -Not 100% sure this is the right solution. - -Problem caused by patch 7.3.638: window->open does not update window -correctly. Issue 91. - Patch to add {lhs} to :mapclear: clear all maps starting with {lhs}. (Christian Brabandt, 2013 Dec 9) Exception caused by argument of return is not caught by try/catch. (David Barnett, 2013 Nov 19) -8 'backupdir' and 'directory' should use $TMPDIR, $TMP and/or $TEMP when - defined. -Issue 28. - Patch to fix that 'cedit' is recognized after :normal. (Christian Brabandt, 2013 Mar 19, later message) @@ -350,11 +1430,6 @@ highlighted as the cursor line. (Alessandro Ivaldi, 2013 Jun 4) Two highlighting bugs. (ZyX, 2013 Aug 18) -Patch to add the bufferlist() function. (Yegappan Lakshmanan, 2013 May 5) -May 17: with winlist() and tabpagelist(). -May 19: with local variables. -May 28: with options - Patch to support 'u' in interactive substitute. (Christian Brabandt, 2012 Sep 28) With tests: Oct 9. @@ -363,53 +1438,23 @@ optional. (2013 Jul 12) Dialog is too big on Linux too. (David Fishburn, 2013 Sep 2) -Patch to allow setting w:quickfix_title via setqflist() and setloclist() -functions. (Christian Brabandt, 2013 May 8, update May 21) -Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14) -Second one. Update May 22. -Update by Daniel Hahler, 2014 Jul 4. - Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) -MS-Windows: Patch to make tests copy files to avoid changing the fileformat of -the files under version control. (Taro Muraoka, 2013 Jul 5) - -Issue 54: document behavior of -complete, also expands arg. - - Add regex for 'paragraphs' and 'sections': 'parare' and 'sectre'. Combine the two into a regex for searching. (Ned Konz) Patch by Christian Brabandt, 2013 Apr 20, unfinished. Bug: findfile("any", "file:///tmp;") does not work. -'ff' is wrong for one-line file without EOL. (Issue 77) - -Patch to set antialiasing style on Windows. (Ondrej Balaz, 2013 Mar 14) -Needs a different check for CLEARTYPE_QUALITY. - In the ATTENTION message about an existing swap file, mention the name of the process that is running. It might actually be some other program, e.g. after a reboot. -Patch to have text objects defined by arbitrary single characters. (Daniel -Thau, 2013 Nov 20, 2014 Jan 29, 2014 Jan 31) -Ben Fritz: problem with 'selection' set to "exclusive". -Updated to current Vim, not quite right yet. (Ben Fritz, 2014 Mar 27) - -Patch to select the next or previous text object if there isn't one under the -cursor. (Daniel Thau, 2013 Nov 20) - patch to add "combine" flag to syntax commands. (so8res, 2012 Dec 6) -Bug caused by patch 7.3.1288? Issue 183. -I can't reproduce it. - Syntax update problem in one buffer opened in two windows, bottom window is not correctly updated. (Paul Harris, 2012 Feb 27) -Patch to add assignments in cscope. (Uli Meis, Estabrooks, 2012 Sep 1) -Alternate patch by Gary Johnson, Sep 4. - Patch to add getsid(). (Tyru, 2011 Oct 2) Do we want this? Update Oct 4. Or use expand('<sid>')? @@ -417,22 +1462,8 @@ Patch to make confirm() display colors. (Christian Brabandt, 2012 Nov 9) Patch to add functions for signs. (Christian Brabandt, 2013 Jan 27) -Do we need some way (option) to show the sign column even when there are no -signs? Patch by Christian Brabandt, 2013 Aug 22. - Patch to remove flicker from popup menu. (Yasuhiro Matsumoto, 2013 Aug 15) -Patch to use directX to draw text on Windows. Adds the 'renderoptions' -option. (Taro Muraoka, 2013 Jan 25, update 2013 Apr 3, May 14) -Fixes this problem: -8 Win32: Multi-byte characters are not displayed, even though the same font - in Notepad can display them. (Srinath Avadhanula) Try with the - UTF-8-demo.txt page with Andale Mono. - -Patch to add 'completeselect' option. Specifies how to select a candidate in -insert completion. (Shougo, 2013 May 29) -Update to add to existing 'completeopt'. 2013 May 30 - Problem with refresh:always in completion. (Tyler Wade, 2013 Mar 17) b:undo_ftplugin cannot call a script-local function. (Boris Danilov, 2013 Jan @@ -451,31 +1482,19 @@ Patch for :tabcloseleft, after closing a tab go to left tab. (William Bowers, Patch to improve equivalence classes in regexp patterns. (Christian Brabandt, 2013 Jan 16, update Jan 17) +Patch to add new regexp classes :ident:, :keyword:, :fname:. +(ichizok, 2016 Jan 12, #1373) + Patch with suggestions for starting.txt. (Tony Mechelynck, 2012 Oct 24) But use Gnome instead of GTK? -Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki -Saito, 2013 Apr 24) - Should be possible to enable/disable matchparen per window or buffer. Add a check for b:no_match_paren in Highlight_matching_Pair() (Marcin Szamotulski, 2012 Nov 8) -Issue 72: 'autochdir' causes problems for :vimgrep. - Session file creation: 'autochdir' causes trouble. Keep it off until after loading all files. -Win32: When 'autochdir' is on and 'encoding' is changed, files on the command -line are opened again, but from the wrong directory. Apply 'autochdir' only -after starting up? - -Patch to add ":ldo" and ":cdo", execute commands over quickfix list and -location list. (Yegappan Lakshmanan, 2013 Jun 2) - -8 "stl" and "stlnc" in 'fillchars' don't work for multi-byte characters. - Patch by Christian Wellenbrock, 2013 Jul 5. - MS-Windows resizing problems: - Windows window on screen positioning: Patch by Yukihiro Nakadaira, 2012 Jun 20. Uses getWindowRect() instead of GetWindowPlacement() @@ -488,11 +1507,6 @@ MS-Windows resizing problems: Patch to append regexp to tag commands to make it possible to select one out of many matches. (Cody Cutler, 2013 Mar 28) -Patch to add tagfunc(). Cleaned up by Christian Brabandt, 2013 Jun 22. - -Help for 'b:undo_indent'. (Thilo Six, 2012 May 28) -Also question if examples are correct. - The input map for CTRL-O in mswin.vim causes problems after CTRL-X CTRL-O. Suggestion for another map. (Philip Mat, 2012 Jun 18) But use "gi" instead of "a". Or use CTRL-\ CTRL-O. @@ -503,14 +1517,15 @@ Aug 16) When there are no command line arguments ":next" and ":argu" give E163, which is confusing. Should say "the argument list is empty". -xterm supports escape sequences to mark a paste operation. Need to be -enabled. (Bruno Sutic, 2014 Jul 11) How to know the terminal supports this? - URXVT: - will get stuck if byte sequence does not contain the expected semicolon. - Use urxvt mouse support also in xterm. Explanations: http://www.midnight-commander.org/ticket/2662 +Patch to have the fold and sign column and at the last line of the buffer. +(Marco Hinz, 2014 Sep 25) +Alternate suggestion: let all columns continue, also the number column. + Patch to add tests for if_xcmdsrv.c., Jul 8, need some more work. (Brian Burns) New tests Jul 13. Update Jul 17. Discussion Jul 18. @@ -565,11 +1580,6 @@ Only for MS-Windows. No documentation. Do we want this? Patch to support cursor shape in Cygwin console. (Ben bgold, 2011 Dec 27) -Patch to support UTF-8 for Hangul. (Shawn Y.H. Kim, 2011 May 1) -Needs more work. Pinged 2012 Jan 4. - -Issue 64: when 'incsearch' is on can't paste LF on command line. - On MS-Windows a temp dir with a & init causes system() to fail. (Ben Fritz, 2012 Jun 19) @@ -586,6 +1596,9 @@ Syntax region with 'concealends' and a 'cchar' value, 'conceallevel' set to 2, only one of the two ends gets the cchar displayed. (Brett Stahlman, 2010 Aug 21, Ben Fritz, 2010 Sep 14) +The :syntax cchar value can only be a single character. It would be useful to +support combining characters. (Charles Campbell) + 'cursorline' works on a text line only. Add 'cursorscreenline' for highlighting the screen line. (Christian Brabandt, 2012 Mar 31) @@ -598,9 +1611,9 @@ Sep 17) Asked for feedback from others. Win32: Cannot cd into a directory that starts with a space. (Andy Wokula, 2012 Jan 19) -Need to escape $HOME on Windows? (ZyX, 2011 Jul 21, discussion 2013 Jul 4) -Can't simply use a backslash, \$HOME has a different meaning already. -Would be possible to use $$HOME where $HOME is to be used. +Need to escape $HOME on Windows for fnameescape()? (ZyX, 2011 Jul 21, +discussion 2013 Jul 4) Can't simply use a backslash, \$HOME has a different +meaning already. Would be possible to use $$HOME where $HOME is to be used. "2" in 'formatoptions' not working in comments. (Christian Corneliussen, 2011 Oct 26) @@ -615,13 +1628,6 @@ Windows keys not set properly on Windows 7? (cncyber, 2010 Aug 26) When using a Vim server, a # in the path causes an error message. (Jeff Lanzarotta, 2011 Feb 17) -Setting $HOME on MS-Windows is not very well documented. Suggestion by Ben -Fritz (2011 Oct 27). - -Bug: Windows 7 64 bit system freezes when 'clipboard' set to "unnamed" and -doing ":g/test/d". Putting every delete on the clipboard? (Robert Chan, 2011 -Jun 17) - When there is a ">" in a line that "gq" wraps to the start of the next line, then the following line will pick it up as a leader. Should get the leader from the first line, not a wrapped line. (Matt Ackeret, 2012 Feb 27) @@ -635,14 +1641,10 @@ Vim using lots of memory when joining lines. (John Little, 2010 Dec 3) BT regexp engine: After trying a \@> match and failing, submatches are not cleared. See test64. -Changes to manpage plugin. (Elias Toivanen, 2011 Jul 25) - Patch to make "z=" work when 'spell' is off. Does this have nasty side effects? (Christian Brabandt, 2012 Aug 5, Update 2013 Aug 12) Would also need to do this for spellbadword() and spellsuggest(). -Patch for variable tabstops. On github (Christian Brabandt, 2014 May 15) - On 64 bit MS-Windows "long" is only 32 bits, but we sometimes need to store a 64 bits value. Change all number options to use nropt_T and define it to the right type. @@ -650,8 +1652,6 @@ right type. string() can't parse back "inf" and "nan". Fix documentation or fix code? (ZyX, 2010 Aug 23) -Make 'formatprg' global-local. (Sung Pae) - When doing "redir => s:foo" in a script and then "redir END" somewhere else (e.g. in a function) it can't find s:foo. When a script contains "redir => s:foo" but doesn't end redirection, a @@ -663,9 +1663,6 @@ doesn't jump to the correct line with :cfirst. (ZyX, 2011 Sep 18) Behavior of i" and a" text objects isn't logical. (Ben Fritz, 2013 Nov 19) -7 Make "ga" show the digraph for a character, if it exists. -Patch from Christian Brabandt, 2011 Aug 19. - maparg() does not show the <script> flag. When temporarily changing a mapping, how to restore the script ID? @@ -683,9 +1680,6 @@ Build problem with small features on Mac OS X 10.6. (Rainer, 2011 Jan 24) "0g@$" puts '] on last byte of multi-byte. (ZyX, 2011 Jan 22) -Patch to addd TextDeletePost and TextYankPost events. (Philippe Vaucher, 2011 -May 24) Update May 26. - Patch for :tabrecently. (Hirokazu Yoshida, 2012 Jan 30) Problem with "syn sync grouphere". (Gustavo Niemeyer, 2011 Jan 27) @@ -703,11 +1697,9 @@ Is this needed? CTRL-O and CTRL-I do the same, just more difficult to use. 8 Add a command to jump to the next character highlighted with "Error". Patch by Christian Brabandt, uses ]e [e ]t and [t. 2011 Aug 9. -8 Add an event like CursorHold that is triggered repeatedly, not just once - after typing something. -Need for CursorHold that retriggers. Use a key that doesn't do anything, or a -function that resets did_cursorhold. -Patch by Christian Brabandt, 2011 May 6. +Add event for when the text scrolls. A bit like CursorMoved. Also a similar +one for insert mode. Use the event in matchparen to update the highlight if +the match scrolls into view. 7 Use "++--", "+++--" for different levels instead of "+---" "+----". Patch by Christian Brabandt, 2011 Jul 27. @@ -732,6 +1724,9 @@ GTK: tear-off menu does not work. (Kurt Sonnenmoser, 2010 Oct 25) Win32: tear-off menu does not work when menu language is German. (Markus Bossler, 2011 Mar 2) Fixed by 7.3.095? +Wish for NetBeans commands: + - make it possible to have 'defineAnnoType' also handle terminal colors. + Version of netbeans.c for use with MacVim. (Kazuki Sakamoto, 2010 Nov 18) 7.3.014 changed how backslash at end of line works, but still get a NUL when @@ -752,9 +1747,6 @@ New esperanto spell file can't be processed. (Dominique Pelle, 2011 Jan 30) Editing a file with a ^M with 'ff' set to "mac", opening a help file, then the ^M is displayed as ^J sometimes. Getting 'ff' value from wrong window/buffer? -'colorcolumn' has higher priority than hlsearch. Should probably be the other -way around. (Nazri Ramliy, 2013 Feb 19) - When Vim is put in the background (SIGTSTP) and then gets a SIGHUP it doesn't exit. It exists as soon as back in the foreground. (Stephen Liang, 2011 Jan 9) Caused by vim_handle_signal(SIGNAL_BLOCK); in ui.c. @@ -791,14 +1783,6 @@ Regexp engine performance: 7.2.274. (Christian Brabandt, 2010 May 27) Generally, folding with 'foldmethod' set to "syntax" is slow. Do profiling to find out why. -Patch to add 'systemencoding', convert between 'encoding' and this for file -names, shell commands and the like. (Kikuchan, 2010 Oct 14) -Assume the system converts between the actual encoding of the filesystem to -the system encoding (usually utf-8). - -Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan -26, update 2013 Dec 14) - Problem producing tags file when hebrew.frx is present. It has a BOM. Results in E670. (Tony Mechelynck, 2010 May 2) @@ -811,13 +1795,13 @@ setpos() does not restore cursor position after :normal. (Tyru, 2010 Aug 11) 7 The 'directory' option supports changing path separators to "%" to make file names unique, also support this for 'backupdir'. (Mikolaj Machowski) Patch by Christian Brabandt, 2010 Oct 21. + Is this an update: related to: #179 + https://github.com/chrisbra/vim-mq-patches/blob/master/backupdir + Fixed patch 2017 Jul 1. With "tw=55 fo+=a" typing space before ) doesn't work well. (Scott Mcdermott, 2010 Oct 24) -Patch to add random number generator. (Hong Xu, 2010 Nov 8, update Nov 10) -Alternative from Christian Brabandt. (2010 Sep 19) - Messages in message.txt are highlighted as examples. When using cp850 the NBSP (0xff) is not drawn correctly. (Brett Stahlman, 2010 @@ -844,12 +1828,6 @@ setwinvar(). Patch for GVimExt to show an icon. (Dominik Riebeling, 2010 Nov 7) -When writing a file > 2Gbyte, the reported number of bytes is negative. -(Antonio Colombo, 2010 Dec 18) - -Patch: Let rare word highlighting overrule good word highlighting. -(Jakson A. Aquino, 2010 Jul 30, again 2011 Jul 2) - When 'lines' is 25 and 'scrolloff' is 12, "j" scrolls zero or two lines instead of one. (Constantin Pan, 2010 Sep 10) @@ -907,13 +1885,13 @@ Dominique can't reproduce it. ":function f(x) keepjumps" creates a function where every command is executed like it has ":keepjumps" before it. -Coverity: ask someone to create new user: Dominique. -Check if there are new reported defects: http://scan.coverity.com/rung2.html +Coverity: Check if there are new reported defects: +https://scan.coverity.com/projects/241 Patch to support :undo absolute jump to file save number. (Christian Brabandt, 2010 Nov 5) -Patch to use 'foldnextmax' also for "marker" foldmethod. (Arnaud Lacombe, 2011 +Patch to use 'foldnestmax' also for "marker" foldmethod. (Arnaud Lacombe, 2011 Jan 7) Bug with 'incsearch' going to wrong line. (Wolfram Kresse, 2009 Aug 17) @@ -942,9 +1920,7 @@ When a:base in 'completefunc' starts with a number it's passed as a number, not a string. (Sean Ma) Need to add flag to call_func_retlist() to force a string value. -Invalid read error in Farsi mode. (Dominique Pelle, 2009 Aug 2) - -For running gvim on an USB stick: avoid the OLE registration. Use a command +For running gvim on a USB stick: avoid the OLE registration. Use a command line argument -noregister. When using an expression in 'statusline' leading white space sometimes goes @@ -966,6 +1942,12 @@ to avoid changing 'eventignore'? Patch for displaying 0x200c and 0x200d. (Ali Gholami Rudi, 2009 May 6) Probably needs a bit of work. +Patch to add farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2) +Added test, updates, June 23. +Updated for 7.4: http://litcave.rudi.ir/farsi_vim.diff +With modification for Tatweel character: https://dpaste.de/VmFw +Remark from Ameretat Reith (2014 Oct 13) + List of encoding aliases. (Takao Fujiwara, 2009 Jul 18) Are they all OK? Update Jul 22. @@ -984,10 +1966,6 @@ on the first character. (John Beckett, 2010 Aug 7) Setting 'tags' to "tagsdir/*" does not find "tagsdir/tags". (Steven K. Wong, 2009 Jul 18) -Patch to add farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2) -Added test, updates, June 23. -Updated for 7.4: http://litcave.rudi.ir/farsi_vim.diff - Patch to add "focusonly" to 'scrollopt', so that scrollbind also applies in window that doesn't have focus. (Jonathon Mah, 2009 Jan 12) Needs more work. @@ -1010,8 +1988,6 @@ Patch for GTK buttons X1Mouse and X2Mouse. (Christian J. Robinson, 2010 Aug 9) Motif: Build on Ubuntu can't enter any text in dialog text fields. -When 'ft' changes redraw custom status line. - ":tab split fname" doesn't set the alternate file in the original window, because win_valid() always returns FALSE. Below win_new_tabpage() in ex_docmd.c. @@ -1059,10 +2035,6 @@ perhaps. And undo CTRL-W. CTRL-G l would redo. Diff mode out of sync. (Gary Johnson, 2010 Aug 4) -Support a 'systemencoding' option (for Unix). It specifies the encoding of -file names. (Kikuchan, 2010 Oct 5). Useful on a latin1 or double-byte Asian -system when 'encoding' is "utf-8". - Win32 GUI: last message from startup doesn't show up when there is an echoerr command. (Cyril Slobin, 2009 Mar 13) @@ -1087,8 +2059,6 @@ Haskell, 2010 Aug 24) This does not work yet: "a\(%C\)" (get composing characters into a submatch). -A function on a dictionary is not profiled. (ZyX, 2010 Dec 25) - Inconsistent: starting with $LANG set to es_ES.utf-8 gives Spanish messages, even though locale is not supported. But ":lang messages es_ES.utf-8" gives an error and doesn't switch messages. (Dominique Pelle, @@ -1107,9 +2077,6 @@ Sergey Khorev) Consider making YankRing or something else that keeps a list of yanked text part of standard Vim. The "1 to "9 registers are not sufficient. -netrw: dragging status line causes selection of entry. Should check row -number to be below last visible line. - After doing "su" $HOME can be the old user's home, thus ~root/file is not correct. Don't use it in the swap file. @@ -1139,8 +2106,6 @@ still delete them. Also convert all buffer file names? Update src/testdir/main.aap. -"vim -c 'sniff connect'" hangs Vim. (Dominique Pelle, 2008 Dec 7) - Something wrong with session that has "cd" commands and "badd", in such a way that Vim doesn't find the edited file in the buffer list, causing the ATTENTION message? (Tony Mechelynck, 2008 Dec 1) @@ -1156,9 +2121,6 @@ probably causes this. 'scrollbind' is not respected when deleting lines or undo. (Milan Vancura, 2009 Jan 16) -Patch to support strikethrough next to bold and italic. (Christian Brabandt, -2013 Jul 30) Update from Ken Takata, 2013 Oct 12. - Document that default font in Athena can be set with resources: XtDefaultFont: "9x15" XtDefaultFontSet: "9x15" @@ -1185,8 +2147,6 @@ doesn't. (John Little, 2008 Nov 9) Shell expansion returns unexpanded string? Don't use shell when "~" is not at the start? -":unlet $VAR" doesn't work. - When using ":e ++enc=foo file" and the file is already loaded with 'fileencoding' set to "bar", then do_ecmd() uses that buffer, even though the fileencoding differs. Reload the buffer in this situation? Need to check for @@ -1221,9 +2181,6 @@ command is not executed. Fix by Ian Kelling? ":help s/~" jumps to *s/\~*, while ":help s/\~" doesn't find anything. (Tim Chase) Fix by Ian Kelling, 2008 Jul 14. -Use "\U12345678" for 32 bit Unicode characters? (Tony Mechelynck, 2009 -Apr 6) Or use "\u(123456)", similar to Perl. - When mapping : to ; and ; to :, @; doesn't work like @: and @: doesn't work either. Matt Wozniski: nv_at() calls do_execreg() which uses put_in_typebuf(). Char mapped twice? @@ -1254,8 +2211,13 @@ Win32: A --remote command that has a directory name starting with a ( doesn't work, the backslash is removed, assuming that it escapes the (. (Valery Kondakoff, 2009 May 13) +Win32: Using "gvim --remote-tab-silent elŝuti.txt" doesn't work, the +multi-byte character isn't passed and edits elsuti.txt. +(Raúl Núñez de Arenas Coronado, 2015 Dec 18) + Problem with 'langmap' being used on the rhs of a mapping. (Nikolai Weibull, 2008 May 14) +Possibly related problem: Alexey Muranov, 2015 Apr 2 Problem with CTRL-F. (Charles Campbell, 2008 March 21) Only happens with "gvim -geometry "160x26+4+27" -u NONE -U NONE prop.c". @@ -1275,8 +2237,6 @@ Works OK when 'cmdheight' is 2. that the context can be taken into account. (Robert Webb) Patch by Christian Brabandt, 2013 May 31. -Test54 should not use shell commands. Make it portable. - The utf class table is missing some entries: 0x2212, minus sign 0x2217, star @@ -1321,9 +2281,6 @@ Fail to edit file after failed register access. Error flag remains set? Patch for redo register. (Ben Schmidt, 2007 Oct 19) Await response to question to make the register writable. -src/testdir/Make_dos.mak: not all tests are included, e.g., test49, without a -remark why. - Problem with 'ts' set to 9 and 'showbreak' to ">>>". (Matthew Winn, 2007 Oct 1) @@ -1349,10 +2306,6 @@ Jul 31) C syntax: {} inside () causes following {} to be highlighted as error. (Michalis Giannakidis, 2006 Jun 1) -Can't easily close the help window, like ":pc" closes the preview window and -":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal) -Patch for :helpclose, Christian Brabandt, 2010 Sep 6. - When 'diffopt' has "context:0" a single deleted line causes two folds to merge and mess up syncing. (Austin Jennings, 2008 Jan 31) @@ -1413,10 +2366,6 @@ popup menu over it, first draw the new popup menu, remember its position and size and then redraw the text, skipping the characters under the popup menu. This should avoid flicker. Other solution by A.Politz, 2007 Aug 22. -Windows 98: pasting from the clipboard with text from another application has -a trailing NUL. (Joachim Hofmann) Perhaps the length specified for CF_TEXT -isn't right? - When a register contains illegal bytes, writing viminfo in utf-8 and reading it back doesn't result in utf-8. (Devin Bayer) @@ -1426,8 +2375,8 @@ files with "foo/**" in 'path'. (Kalisiak, 2006 July 15) Additional info: When using the |wildcards| ** globing, vim hangs indefinitely on lots of directories. The |file-searching| globing, like in ":set path=/**" does not hang as often as with globing with |wildcards|, like -in ":1find /**/file". This is for a files that unix "find" can find very -quick. Merging the 2 kinds of globing might make this an easier fix. (Ian +in ":1find /**/file". This is for files that unix "find" can find very +quickly. Merging the 2 kinds of globing might make this an easier fix. (Ian Kelling, 2008 July 4) When the file name has parenthesis, e.g., "foo (bar).txt", ":!ls '%'" has the @@ -1459,16 +2408,6 @@ with "gvim -nb:localhost:55555:foo". From nc do: '1:editFile!0 "foo"'. Then go to Insert mode and add a few lines. Then backspacing every other time moves the cursor instead of deleting. (Chris Kaiser, 2007 Sep 25) -Patch to use Modern UI 2.0 for the Nsis installer. (Guopeng Wen, 2010 Jul 30) -Latest version: 2011 May 18 -8 Windows install with NSIS: make it possible to do a silent install, see - http://nsis.sourceforge.net/Docs/Chapter4.html#4.12 - Version from Guopeng Wen that does this (2010 Dec 27) -Alternative: MSI installer: https://github.com/petrkle/vim-msi/ - -Windows installer should install 32-bit version of right-click handler also on -64-bit systems. (Brian Cunningham, 2011 Dec 28) - Windows installer could add a "open in new tab of existing Vim" menu entry. Gvimext: patch to add "Edit with single Vim &tabbed" menu entry. Just have two choices, always using one Vim and selecting between using an @@ -1489,8 +2428,6 @@ Changes for Win32 makefile. (Mike Williams, 2007 Jan 22, Alexei Alexandrov, Win32: Can't complete shell command names. Why is setting xp_context in set_one_cmd_context() inside #ifndef BACKSLASH_IN_FILENAME? -Win32: Patch for convert_filterW(). (Taro Muraoka, 2007 Mar 2) - Win32: Patch for cscope external command. (Mike Williams, 2007 Aug 7) Win32: XPM support only works with path without spaces. Patch by Mathias @@ -1501,8 +2438,6 @@ patches by Mathias, see mail Feb 22) Win32: compiling with normal features and OLE fails. Patch by Mathias Michaelis, 2006 Jun 4. -Win16: include patches to make Win16 version work. (Vince Negri, 2006 May 22) - Win32: after "[I" showing matches, scroll wheel messes up screen. (Tsakiridis, 2007 Feb 18) Patch by Alex Dobrynin, 2007 Jun 3. Also fixes other scroll wheel problems. @@ -1514,10 +2449,6 @@ Win32: using "gvim --remote-tab-silent fname" sometimes gives an empty screen with the more prompt. Caused by setting the guitablabel? (Thomas Michael Engelke, 2007 Dec 20 - 2008 Jan 17) -Win64: Seek error in swap file for a very big file (3 Gbyte). Check storing -pointer in long and seek offset in 64 bit var. -Patches from Ken Takata might help (2014 Apr 17) - Win32: patch for fullscreen mode. (Liushaolin, 2008 April 17) Win32: When 'shell' is bash shellescape() doesn't always do the right thing. @@ -1529,12 +2460,6 @@ Check for this and use iconv? (Edward L. Fox, 2007 Sep 12) Does the conversion in the other direction work when 'fileencodings' is set properly? -Add a few features to xxd. (Vadim Vygonets, 2013 Nov 11) -Patches: 2013 Nov 19 -1: Add -e: little endian hexdump -2: Add -o: add offset to displayed position -3: Change displayed file position width to 8 chars - Cursor displayed in the wrong position when using 'numberwidth'. (James Vega, 2007 Jun 21) @@ -1550,9 +2475,6 @@ F1 - F4 in an xterm produce a different escape sequence when used with a modifier key. Need to catch three different sequences. Use K_ZF1, like K_ZHOME? (Dickey, 2007 Dec 2) -UTF-8: mapping a multi-byte key where the second byte is 0x80 doesn't appear -to work. (Tony Mechelynck, 2007 March 2) - In debug mode, using CTRL-R = to evaluate a function causes stepping through the function. (Hari Krishna Dara, 2006 Jun 28) @@ -1657,15 +2579,6 @@ When showing a diff between a non-existent file and an existing one, with the cursor in the empty buffer, the other buffer only shows the last line. Change the "insert" into a change from one line to many? (Yakov Lerner, 2008 May 27) -Add autocommand for when a tabpage is being closed. Also for when a tab page -has been created. - -Using ":make" blocks Vim. Allow running one make in the background (if the -shell supports it), catch errors in a file and update the error list on the -fly. A bit like "!make > file&" and repeating ":cf file". ":bgmake", -background make. ":bgcancel" interrupts it. -A.Politz may work on this. - These two abbreviations don't give the same result: let asdfasdf = "xyz\<Left>" cabbr XXX <C-R>=asdfasdf<CR> @@ -1678,9 +2591,6 @@ In FileChangedShell command it's no longer allowed to switch to another buffer. But the changed buffer may differ from the current buffer, how to reload it then? -New syntax files for fstab and resolv from Radu Dineiu, David Necas did -previous version. - For Aap: include a config.arg.example file with hints how to use config.arg. Command line completion when 'cmdheight' is maximum and 'wildmenu' is set, @@ -1710,11 +2620,6 @@ start of the path is shown in the menu. Should move the menu to the right to show more text of the completions. Shorten the items that don't fit in the middle? -When running inside screen it's possible to kill the X server and restart it -(using pty's the program can keep on running). Vim dies because it loses the -connection to the X server. Can Vim simply quit using the X server instead of -dying? Also relevant when running in a console. - Accessing file#var in a function should not need the g: prepended. When exiting detects a modified buffer, instead of opening the buffer in the @@ -1749,10 +2654,6 @@ the cursor line. It works OK after some other commands. Win32: Is it possible to have both postscript and Win32 printing? -Check: Running Vim in a console and still having connect to the X server for -copy/paste: is stopping the X server handled gracefully? Should catch the X -error and stop using the connection to the server. - Problem with 'cdpath' on MS-Windows when a directory is equal to $HOME. (2006 Jul 26, Gary Johnson) @@ -1789,34 +2690,11 @@ differently and unexpectedly. Caused by patch 7.2.398? The magic clipboard format "VimClipboard2" appears in several places. Should be only one. -"vim -C" often has 'nocompatible', because it's set somewhere in a startup -script. Do "set compatible" after startup? - -It's difficult to debug numbered functions (function in a Dictionary). Print -the function name before resolving it to a number? - let d = {} - fun! d.foo() - echo "here" - endfun - call d.foo(9) - -Add a mark for the other end of the Visual area (VIsual pos). '< and '> are -only set after Visual moded is ended. -Also add a variable for the Visual mode. So that this mode and '< '> can be -used to set what "gv" selects. (Ben Schmidt) - -Win32: When running ":make" and 'encoding' differs from the system locale, the -output should be converted. Esp. when 'encoding' is "utf-8". (Yongwei Wu) -Should we use 'termencoding' for this? - Win32, NTFS: When editing a specific infostream directly and 'backupcopy' is "auto" should detect this situation and work like 'backupcopy' is "yes". File name is something like "c:\path\foo.txt:bar", includes a colon. (Alex Jakushev, 2008 Feb 1) -printf() uses the field width in bytes. Can it be made character width, -perhaps with a modifier? What does Posix say? - Small problem displaying diff filler line when opening windows with a script. (David Luyer, 2007 Mar 1 ~/Mail/oldmail/mool/in.15872 ) @@ -1833,16 +2711,10 @@ Patch for adding ":lscscope". (Navdeep Parhar, 2007 Apr 26; update 2008 Apr tabs and the autocommand "autocmd BufWinLeave * mkview". (James Vega, 2007 Jun 18) -xterm should be able to pass focus changes to Vim, so that Vim can check for -buffers that changed. Perhaps in misc.c, function selectwindow(). -Xterm 224 supports it! - When completing from another file that uses a different encoding completion text has the wrong encoding. E.g., when 'encoding' is utf-8 and file is latin1. Example from Gombault Damien, 2007 Mar 24. -Is it possible to use "foo#var" instead of "g:foo#var" inside a function? - Syntax HL: When using "nextgroup" and the group has an empty match, there is no search at that position for another match. (Lukas Mai, 2008 April 11) @@ -1864,13 +2736,6 @@ respond to selection requests. Invoking XtDisownSelection() before executing the shell doesn't help. Would require forking and doing a message loop, like what happens for the GUI. -X11: Putting more than about 262040 characters of text on the clipboard and -pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23) -clip_x11_request_selection_cb() is called with zero value and length. -Also: Get an error message from free() in the process that owns the selection. -Seems to happen when the selection is requested the second time, but before -clip_x11_convert_selection_cb() is invoked, thus in X library code. - ":vimgrep" does not recognize a recursive symlink. Is it possible to detect this, at least for Unix (using device/inode)? @@ -1881,19 +2746,28 @@ restored. (Luc St-Louis) Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler, 2010 Jun 30) +Add an option for a minimal text length before inserting a line break for +'textwidth'. Avoids very short lines when a very long word follows. +(Kartik Agaram) -At next release: -- Build a huge version by default. -- Improve plugin handling: Automatic updates, handle dependencies? - E.g. Vundle: https://github.com/gmarik/vundle + +Better plugin support (not plugin manager, see elsewhere for that): +- Avoid use of feedkeys, add eval functions where needed: + - manipulating the Visual selection? +- Add createmark(): add a mark like mM, but return a unique ID. Need some way + to clean them up again... Use a name + the script ID. + Add createmark( , 'c') to track inserts/deletes before the column. +- Plugins need to make a lot of effort, lots of mappings, to know what + happened before pressing the key that triggers a plugin action. How about + keeping the last N pressed keys, so that they do not need to be mapped? +- equivalent of netbeans_beval_cb(). With an autocommand? +- Add something to enable debugging when a remote message is received. More patches: - Another patch for Javascript indenting. (Hari Kumar, 2010 Jul 11) Needs a few tests. - Add 'cscopeignorecase' option. (Liang Wenzhi, 2006 Sept 3) -- Argument for feedkeys() to prepend to typeahead (Yakov Lerner, 2006 Oct - 21) - Load intl.dll too, not only libintl.dll. (Mike Williams, 2006 May 9, docs patch May 10) - Extra argument to strtrans() to translate special keys to their name (Eric @@ -1918,8 +2792,6 @@ More patches: Schmidt, 2008 Jul 22. - testdir/Make_dos_sh.mak for running tests with MingW. (Bill Mccarthy, 2008 Sep 13) -- Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29, - Docs patch Oct 30, update David Burgin (glts) 2013 Aug 24) - Replace ccomplete.vim by cppcomplete.vim from www.vim.org? script 1520 by Vissale Neang. (Martin Stubenschrott) Asked Vissale to make the scripts more friendly for the Vim distribution. @@ -1942,8 +2814,6 @@ Awaiting updated patches: 9 HTML indenting can be slow. Caused by using searchpair(). Can search() be used instead? A.Politz is looking into a solution. 8 Win32: Add minidump generation. (George Reilly, 2006 Apr 24) -8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible. - Aric Blumer has a patch for this. He will update the patch for 6.3. 7 Completion of network shares, patch by Yasuhiro Matsumoto. Update 2004 Sep 6. How does this work? Missing comments. @@ -1975,8 +2845,6 @@ Awaiting updated patches: Search in 'runtimepath'? More docs needed about how to use this. How to get the messages into the .po files? - strchars() Like strlen() and strwidth() but counting characters - instead of bytes. confirm() add "flags" argument, with 'v' for vertical layout and 'c' for console dialog. (Haegg) Flemming Madsen has a patch for the 'c' flag @@ -2001,9 +2869,6 @@ Awaiting updated patches: done for filetype detection. Patch from Walter Briscoe, 2003 Jul 1. 7 Add a "-@ filelist" argument: read file names from a file. (David Kotchan has a patch for it) -8 Include a connection to an external program through a pipe? See - patches from Felbinger for a mathematica interface. - Or use emacs server kind of thing? 7 Add ":justify" command. Patch from Vit Stradal 2002 Nov 25. - findmatch() should be adjusted for Lisp. See remark at get_lisp_indent(). Esp. \( and \) should be skipped. (Dorai Sitaram, @@ -2049,8 +2914,6 @@ Vi incompatibility: the ":map" when it's used without arguments? 7 CTRL-L is not the end of a section? It is for Posix! Make it an option. 7 Implement 'prompt' option. Init to off when stdin is not a tty. -7 CTRL-T in Insert mode inserts 'shiftwidth' of spaces at the cursor. Add a - flag in 'cpoptions' for this. 7 Add a way to send an email for a crashed edit session. Create a file when making changes (containing name of the swap file), delete it when writing the file. Supply a program that can check for crashed sessions (either @@ -2098,8 +2961,6 @@ GTK+ GUI known bugs: Win32 GUI known bugs: - Win32: tearoff menu window should have a scrollbar when it's taller than the screen. -8 On Windows 98 the unicows library is needed to support functions with UCS2 - file names. Can we load unicows.dll dynamically? 8 The -P argument doesn't work very well with many MDI applications. The last argument of CreateWindowEx() should be used, see MSDN docs. Tutorial: http://win32assembly.online.fr/tut32.html @@ -2113,9 +2974,6 @@ Win32 GUI known bugs: 7 When font smoothing is enabled, redrawing can become very slow. The reason appears to be drawing with a transparent background. Would it be possible to use an opaque background in most places? -8 Use another default for 'termencoding': the active codepage. Means that - when 'encoding' is changed typing characters still works properly. - Alternative: use the Unicode functions to obtain typed characters. 7 The cursor color indicating IME mode doesn't work properly. (Shizhu Pan, 2004 May 9) 8 Win32: When clicking on the gvim title bar, which gives it focus, produces @@ -2249,7 +3107,7 @@ GUI: Need better separation of Vim core and GUI code. 8 When fontset support is enabled, setting 'guifont' to a single font doesn't work. -8 Menu priority for sub-menus for: Amiga, BeOS. +8 Menu priority for sub-menus for: Amiga. 8 When translating menus ignore the part after the Tab, the shortcut. So that the same menu item with a different shortcut (e.g., for the Mac) are still translated. @@ -2301,64 +3159,7 @@ GUI: currently. This is very obvious on a 66Mhz 486. -MSDOS/DJGPP: -9 Pressing CTRL-C often crashes the console Vim runs in. (Ken Liao) - When 'bioskey' isn't set it doesn't happen. Could be a problem with the - BIOS emulation of the console. Version 5.6 already had this problem. -8 DJGPP: "cd c:" can take us to a directory that no longer exists. - change_drive() doesn't check this. How to check for this error? -9 The 16 bit version runs out of memory very quickly. Should find unused - code and reduce static data. Resetting 'writebackup' helps to be able to - write a file. -9 Crash when running on Windows 98 in a console window and pressing CTRL-C. - Happens now and then. When debugging Vim in gdb this also happens. Since - the console crashes, might be a bug in the DOS console. Resetting - 'bioskey' avoids it, but then CTRL-C doesn't work. -9 DOS: Make CTRL-Fx and ALT-Fx work. - CTRL-F1 = CE-5E, CTRL-F2 = CE-5F, .., CTRL-F10 = CE-67 - ALT-F1 = CE-68, ALT-F2 = CE-69, .., ALT-F10 = CE-71 - Shifted cursor keys produce same codes as unshifted keys. Use bioskey(2) - to get modifier mask for <S-C-M-Fx>. - Use K_SPECIAL/KS_MODIFIER codes to insert modifier mask in input stream? - Make this work like in Win32 console. - Mapping things like <M-A> doesn't work, because it generates an extended - key code. Use a translation table? -9 Can't read an opened swap file when the "share" command has not been used. - At least ignore the swap files that Vim has opened itself. -8 Use DJGPP 2.03. -8 The Dos32 version (DJGPP) can't use long file names on Windows NT. - Check if new package can be used (v2misc/ntlfn08[bs].zip). -8 setlocale() is bogus. -8 Vim busy waits for new characters or mouse clicks. Should put in some - sort of sleep, to avoid eating 50% of the CPU time. Test on an unpatched - Windows 95 system! -8 DJGPP: when shell is bash, make fails. (Donahoe) -7 Hitting CTRL-P twice quickly (e.g., in keyword completion) on a 8088 - machine, starts printer echo! (John Mullin). -7 MSDOS 16 bit version can't work with COMSPEC that has an argument, e.g.: - COMSPEC=C:\WINDOWS\COMMAND.COM /E:4096 (Bradley) - Caused by BCC system() function (Borland "make" has the same problem). -8 Mouse: handle left&right button pressed as middle button pressed. Add - modifier keys shift, ctrl and alt. -7 When too many files are open (depends on FILES), strange things happen. - The Dos16 version runs out of memory, in the Dos32 version "!ls" causes a - crash. Another symptom: .swp files are not deleted, existing files are - "[New file]". -7 DJGPP version doesn't work with graphics display mode. Switch to a mode - that is supported? -8 DJGPP: ":mode" doesn't work for many modes. Disable them. -8 DJGPP: When starting in Ex mode, shouldn't clear the screen. (Walter - Briscoe) - - -MSDOS, OS/2 and Win32: -8 OS/2: Add backtick expansion. Undefine NO_EXPANDPATH and use - gen_expand_wildcards(). -8 OS/2: Add clipboard support? See example clipbrd.exe from Alexander - Wagner. -8 OS/2: Add Extended Attributes support and define HAVE_ACL. -8 OS/2: When editing a file name "foo.txt" that is actually called FOO.txt, - writing uses "foo.txt". Should obtain the real file name. +Win32 console: 8 Should $USERPROFILE be preferred above $HOMEDRIVE/$HOMEPATH? No, but it's a good fallback, thus use: $HOME @@ -2385,14 +3186,6 @@ MSDOS, OS/2 and Win32: backslashes. (Ronald Hoellwarth) -Windows 95: -8 Editing a file by its short file name and writing it, makes the long file - name disappear. Setting 'backupcopy' helps. - Use FindFirstFile()->cAlternateFileName in fname_case() (George Reilly). -8 Doing wildcard expansion, will match the short filename, but result in the - long filename (both DJGPP and Win32). - - Win32 console: 9 When editing a file by its short file name, it should be expanded into its long file name, to avoid problems like these: (Mccollister) @@ -2416,9 +3209,6 @@ Win32 console: a Netware network drive. Use same function as for Win32 GUI? 8 In os_win32.h, HAVE_STRICMP and HAVE_STRNICMP are defined only if __GNUC__ is not defined. Shouldn't that be the other way around? -7 Use SetConsoleCP() and SetConsoleOutputCP() to implement 'termencoding'? - Avoids that input and output work differently. Need to be restored when - exiting. Amiga: @@ -2487,8 +3277,7 @@ Macintosh: 8 On MS-Windows ":make" doesn't show output while it is working. Use the tee.exe from http://unxutils.sourceforge.net/ ? About 16 Kbyte in the UnxUtils.zip archive. - Alternate one: http://www.pramodx.20m.com/tee_for_win32.htm, but Walter - Briscoe says it's not as good. + Is it better than what we have in src/tee? 8 When doing Insert mode completion a mapping cannot recursively call edit(), because the completion information is global. Put everything in an allocated structure? @@ -2522,9 +3311,6 @@ Macintosh: is currently fixed to use ".,:;!". Add an option to make this configurable? 8 'hkmap' should probably be global-local. -9 When "$" is in 'cpoptions' and folding is active, a "C" command changes - the folds and resets w_lines_valid. The display updating doesn't work - then. (Pritesh Mistry) 8 Using ":s" in a function changes the previous replacement string. Save "old_sub" in save_search_patterns()? 8 Should allow multi-byte characters for the delimiter: ":s+a+b+" where "+" @@ -2568,11 +3354,6 @@ Macintosh: - Be able to print a window in diff mode. - Be able to specify a colorscheme to use for printing. And a separate one for B&W printing (if that can be detected). -8 In Visual block mode with 'lbr' set, a change command doesn't insert the - text in following lines where the linebreak changes. -9 dosinst.c: The DJGPP version can't uninstall the Uninstall registry key on - Windows NT. How to install a .inf file on Windows NT and how to detect - that Windows NT is being used? 8 When 'virtualedit' is "block,insert" and encoding is "utf-8", selecting a block of one double-wide character, then "d" deletes only half of it. 8 When 'virtualedit' is set, should "I" in blockwise visual mode also insert @@ -2629,8 +3410,6 @@ Macintosh: (e.g., ":w"). 8 CTRL-A can't handle big "long" numbers, they become negative. Check for "-" character, if not present, use unsigned long. -8 Make it possible to disable the special meaning of "#" in the first column - for ">>". 8 Add suspending with CTRL-Z at the "more" prompt, and when executing a long script in do_cmdline(). 8 When using 'hidden', many swap files will be open. When Vim runs into the @@ -2752,11 +3531,6 @@ Problems that will (probably) not be solved: - Amiga: The ":cq" command does not always abort the Manx compiler. Why? - Linux: A file with protection r--rw-rw- is seen readonly for others. The access() function in GNU libc is probably wrong. -- MSDOS: When using smartdrive with write-back buffering, writing to a - readonly floppy will cause problems. How to test for a writable floppy - first? -- MSDOS: Both 16 and 32 bit versions: File name expansion doesn't work for - names that start with a dot. These used to be illegal file names. - When doing a CTRL-Z and typing a command for the shell, while Vim is busy (e.g. writing a file), the command for the shell is sometimes eaten by Vim, because the terminal mode is changed from RAW to CBREAK. @@ -2824,18 +3598,6 @@ Most interesting new features to be added when all bugs have been fixed: Alternative: Make a function for Ex commands: cmd_edit(). - Add COLUMN NUMBERS to ":" commands ":line1,line2[col1,col2]cmd". Block can be selected with CTRL-V. Allow '$' (end of line) for col2. -- Add DEBUGGER INTERFACE. Implementation for gdb by Xavier de Gaye. - Should work like an IDE. Try to keep it generic. Now found here: - http://clewn.sf.net. - And the idevim plugin/script. - To be able to start the debugger from inside Vim: For GUI run a program - with a netbeans connection; for console: start a program that splits the - terminal, runs the debugger in one window and reconnect Vim I/O to the - other window. - Wishes for NetBeans commands: - - make it possible to have 'defineAnnoType' also handle terminal colors. - - send 'balloonText' events for the cursor position (using CursorHold ?) - in terminal mode. - ECLIPSE plugin. Problem is: the interface is very complicated. Need to implement part in Java and then connect to Vim. Some hints from Alexandru Roman, 2004 Dec 15. Should then also work with Oracle Jdeveloper, see JSR @@ -2848,9 +3610,6 @@ Most interesting new features to be added when all bugs have been fixed: scrolls back to where the cursor is. - Scroll commands by screen line. g CTRL-E and g CTRL-Y ? Requires the first line to be able to start halfway. -- Running a shell command from the GUI still has limitations. Look into how - the terminal emulator of the Vim shell project can help: - http://vimshell.wana.at 8 Add a command to jump to a certain kind of tag. Allow the user to specify values for the optional fields. E.g., ":tag size type=m". Also allow specifying the file and command, so that the result of @@ -2867,7 +3626,6 @@ Documentation: 8 List of options should mention whether environment variables are expanded or not. 8 Extend usr_27.txt a bit. (Adam Seyfarth) -7 Add a section on debugging scripts in the user manual. 9 Make the Reference Manual more precise. For each command mention: - change to cursor position and curswant - if it can be undone (u/CTRL-R) and redone (.) @@ -2893,7 +3651,6 @@ Help: - When a help item has multiple matches make it possible to use ":tn" to go to the other matches. - Support a way to view (and edit) .info files. -- Default mapping for help files: <Tab> to position cursor on next |:tag|. - Implement a "sticky" help window, some help text lines that are always displayed in a window with fixed height. (Guckes) Use "~/.vimhelp" file, user can edit it to insert his favorite commands, new account can contain a @@ -2917,20 +3674,12 @@ User Friendlier: $HOME/_vimrc, etc.) and add "edit vimrc" to the File menu. - Add a way to save local settings and mappings into a new plugin file. ":mkplugin <file>"? -8 Add ":plugininstall" command. Can be used to install a plugin file that - includes documentation. Let the user select a directory from - 'runtimepath'. - " Vim plugin - <main plugin code> - " >>> plugin help start <<< - <plugin docs> - Add mappings local to a window: ":map <window> ..."? 9 Add buffer-local menu. Should offer a choice between removing the menu or disabling it. Be careful that tear-offs don't disappear (keep one empty item?). Alternative: use BufEnter and BufLeave autocommands. 8 make a vimtutor script for Amiga and other systems. -7 Add the arguments for configure to the ":version" output? 7 When Vim detects a file is being edited elsewhere and it's a gvim session of the same user it should offer a "Raise" button, so that the other gvim window can be displayed. (Eduard) @@ -2949,7 +3698,6 @@ Tab pages: 7 :tabdup duplicate the tab with all its windows. 7 Option to put tab line at the left or right? Need an option to specify its width. It's like a separate window with ":tabs" output. -7 Add local variables for each tab page? 8 Add local options for each tab page? E.g., 'diffopt' could differ between tab pages. 7 Add local highlighting for each tab page? @@ -3048,18 +3796,10 @@ Spell checking: Diff mode: -9 Instead invoking an external diff program, use builtin code. One can be - found here: http://www.ioplex.com/~miallen/libmba/dl/src/diff.c - It's quite big and badly documented though. -8 Use diff mode to show the changes made in a buffer (compared to the file). - Use an unnamed buffer, like doing: - new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis - Also show difference with the file when editing started? Should show what +9 When making small changes, e.g. deleting a character, update the diff. + Possibly without running diff. +8 Also show difference with the file when editing started? Should show what can be undone. (Tom Popovich) -7 Add cursor-binding: when moving the cursor in one diff'ed buffer, also - move it in other diff'ed buffers, so that CTRL-W commands go to the same - location. - Folding: (commands still available: zI zJ zK zp zP zq zQ zV zy zY; @@ -3067,8 +3807,6 @@ Folding: 8 Vertical folds: looks like vertically split windows, but the cursor moves through the vertical separator, separator moves when scrolling. 8 Add "z/" and "z?" for searching in not folded text only. -9 Add search pattern item to only match in closed or open fold and/or fold - with certain level. Allows doing ":g/pat/cmd" to work on closed folds. 8 When a closed fold is displayed open because of 'foldminlines', the behavior of commands is still like the fold is closed. How to make the user aware of this? @@ -3099,9 +3837,6 @@ Folding: - 'foldmethod' "syntax": "fold=3" argument: set fold level for a region or match. - Apply a new foldlevel to a range of lines. (Steve Litt) -8 Have some way to restrict commands to not folded text. Also commands like - searches. - Multi-byte characters: - When editing a file with both utf-8 and latin1 text Vim always falls back @@ -3171,15 +3906,13 @@ Multi-byte characters: convert_input() for Mac GUI. - Add mnemonics from RFC1345 longer than two characters. Support CTRL-K _{mnemonic}_ -7 In "-- INSERT (lang) --" show the name of the keymap used instead of - "lang". (Ilya Dogolazky) - Make 'breakat' accept multi-byte characters. Problem: can't use a lookup table anymore (breakat_flags[]). Simplistic solution: when 'formatoptions' contains "m" also break a line at a multi-byte character >= 0x100. - Add the possibility to enter mappings which are used whenever normal text could be entered. E.g., for "f" command. But not in Normal mode. Sort - of opposite of 'langmap'. Use ":tmap" command? + of opposite of 'langmap'. Use ":amap" command? - When breaking a line, take properties of multi-byte characters into account. The "linebreak" program from Bruno Haible can do it: ftp://ftp.ilog.fr/pub/Users/haible/gnu/linebreak-0.1.tar.gz @@ -3235,10 +3968,7 @@ Syntax highlighting: one is contained in. Like "keepend" but specified on the contained item, instead of the containing item. 8 cpp.vim: In C++ it's allowed to use {} inside (). -8 Some syntax files set 'iskeyword'. When switching to another filetype - this isn't reset. Add a special keyword definition for the syntax rules? - When this is done, use vim.vim syntax highlighting for help file examples, - but without ":" in 'iskeyword' for syntax. +8 Some syntax files set 'iskeyword', they should use "syn iskeyword". Also need a separate 'iskeyword' for the command line, e.g., in a help window ":e /asdf/asdf/" CTRL-W works different. 8 Add specific syntax item to match with parens/braces that don't have a @@ -3298,9 +4028,6 @@ Syntax highlighting: 8 When using a regexp for "contains=", should delay matching with it until redrawing happens. Set a flag when a group is added, check this flag when highlighting starts. -8 Some terminals can display colors like the GUI. Add some setting to use - GUI colors for the terminal? With something to define the escape - sequence. 7 It's possible for an item to be transparent, so that the colors of an item lower on the stack is used. Also do this with highlighting, so that the user can set transparent highlighting? E.g. a number in a C comment would @@ -3364,7 +4091,7 @@ Syntax highlighting: unprintable char another color. Would be useful for ^M at end of line. -Built-in script language: +Vim script language: 8 Make the filename and line number available to script functions, so that they can give useful debugging info. The whole call stack would be ideal. At least use this for error messages. @@ -3385,14 +4112,10 @@ Built-in script language: 7 ":include" command: just like ":source" but doesn't start a new scriptID? Will be tricky for the list of script names. 8 Have a look at VSEL. Would it be useful to include? (Bigham) -8 Add ":fungroup" command, to group function definitions together. When - encountered, all functions in the group are removed. Suggest using an - obscure name to avoid name clashes. Require a ":fungroup END" in the same - sourced file? Assume the group ends at the end of the file. Handle - nested packages? - Alternative: Support packages. {package-name}:{function-name}(). - Packages are loaded automatically when first used, from - $VIMRUNTIME/packages (or use a search path). +8 Have a prefix for a function to make it unique. When using packages it + can be the plugin name. + Perhaps also have a way to remove everything that the package added? + including autocommands. 7 Pre-parse or compile Vim scripts into a bytecode. 1. Put the bytecode with the original script, with an ":if has('bytecode')" around it, so that it's only used with a Vim that @@ -3409,8 +4132,6 @@ Built-in script language: 8 Add functions: has(":command") Check if ":command" works. compare function with "ex_ni". E.g. for ":simalt". - system() With a List argument. Bypasses the shell, use - exec() directly. (Bob Hiestand) escape() Add argument to specify what to escape with. modestack() Instead of just the current mode return the stack of Insert / CTRL-O / :normal things. @@ -3460,7 +4181,7 @@ Built-in script language: 8 Pass the command line arguments to Vim scripts in some way. As v:args List? Or extra parameter to argv()? 8 Add command arguments with three dashes, passed on to Vim scripts. -7 Add optional arguments to user functions: +9 Add optional arguments to user functions: :func myFunc(arg1, arg2, arg3 = "blah", arg4 = 17) 6 User functions: Functions local to buffer "b:func()"? 8 For Strings add ":let var[{expr}] = {expr}". When past the end of "var" @@ -3512,9 +4233,6 @@ Performance: so that we don't need to make a copy? Or avoid invoking ml_updatechunk(), that is taking a lot of time. (Ralf Wildenhues, 2008 Jul 7) With a patch, but does it work? -8 Instead of loading rgb.txt every time a color wasn't recognized load it - once and keep it in memory. Move the code to a common place to avoid - repeating it in various system files. 8 Turn b_syn_ic and b_syn_containedin into b_syn_flags. 9 Loading menu.vim still takes quite a bit of time. How to make it faster? 8 in_id_list() takes much time for syntax highlighting. Cache the result? @@ -3539,7 +4257,6 @@ Performance: http://www.theregister.co.uk/content/4/22908.html. (Andre Pang) 7 Check how performance of loading the wordlist can be improved (adding a lot of abbreviations). -7 MS-DOS console: Add t_DL support, to make scrolling faster. 7 Compile Ex commands to byte codes. Store byte codes in a vim script file at the end, after "compiled:. Make it look like a single comment line for old Vim versions. Insert first line "Vim script compiled <timestamp>. @@ -3570,7 +4287,6 @@ Performance: - Have a look at how pdksh does memory allocation (alloc.c). (Dalecki) - Do profiling on: - :g/pat/normal cmd - - 1000ii<Esc> - deleting 10Mbyte worth of lines (netscape binary) - "[i" and "[d" (Yegappan Lakshmanan) - ":g/^/m0" on a 450Kbyte file. And the "u". @@ -3589,8 +4305,6 @@ Performance: - Executing a register, e.g. "10000@@" is slow, because ins_typebuf has to move the previous commands forward each time. Pass count from normal_cmd() down to do_execreg(). -- Repeating insert "1000i-<Esc>" displays --INSERT-- all the time, because of - the <Esc> at the end. Make this work faster (disable redrawing). - Avoid calls to plines() for cursor line, use w_cline_height. - After ":set nowrap" remove superfluous redraw with wrong hor. offset if cursor is right of the screen. @@ -3609,7 +4323,7 @@ Code size: left out. 8 When compiled with a GUI-only version, the termcap entries for terminals can be removed. -8 Can the check for libelf in configure.in be removed? +8 Can the check for libelf in configure.ac be removed? Messages: @@ -3664,8 +4378,6 @@ Screen updating: 8 Add a ":refresh [winnr]" command, to force updating a window. Useful from an event handler where ":normal" can't be used. Also useful when 'lazyredraw' is set in a mapping. -7 Make 'list' and 'linebreak' work together. - Scrolling: 8 Add "zy" command: scroll horizontally to put the cursor in the middle. @@ -3708,6 +4420,8 @@ Perl interface: Shared libraries: +8 libcall() can keep the library around instead of always calling dlclose(). + (Jason Felice, 2018 Mar 20) 6 Add support for loading shared libraries, and calling functions in it. :libload internal-name libname :libunload internal-name @@ -3849,8 +4563,6 @@ GUI: use them again? Otherwise, allow disabling allocating the default colors. Or allocate an own colormap (check UAE). With an option to use it. For the commandline, "-install" is mostly used for X11 programs. -7 Add command line argument for "gvim" not to start the GUI. Sort of the - inverse of "vim -g". (Vikas) 7 Should support multi-column menus. - Should add option for where to put the "Help" menu: like Motif at the far right, or with the other menus (but still at the right). @@ -3909,8 +4621,6 @@ Autocommands: 8 Autocommand for when modified files have been found, when getting input focus again (e.g., FileChangedFocus). Check when: getting focus, jumping to another buffer, ... -7 Autocommand for when an option is changed. Match buffer name or option - name? 8 Autocommands should not change registers. And marks? And the jumplist? And anything else? Add a command to save and restore these things. 8 Add autocommands, user functions and user commands to ":mkvimrc". @@ -3934,15 +4644,12 @@ Autocommands: Error - When an error happens NormalEnter - Entering Normal mode ReplaceEnter - Entering Replace mode - CmdEnter - Entering Cmdline mode (with type of cmdline to allow - different mapping) VisualEnter - Entering Visual mode *Leave - Leaving a mode (in pair with the above *Enter) VimLeaveCheck - Before Vim decides to exit, so that it can be cancelled when exiting isn't a good idea. CursorHoldC - CursorHold while command-line editing WinMoved - when windows have been moved around, e.g, ":wincmd J" - CmdUndefined - Like FuncUndefined but for user commands. SearchPost - After doing a search command (e.g. to do "M") PreDirChanged/PostDirChanged - Before/after ":cd" has been used (for changing the @@ -4134,7 +4841,7 @@ Command line history: - Add "KeyWasTyped" flag: It's reset before each command and set when a character from the keyboard is consumed. Value is used to decide to put a command line in history or not. Put line in history if it didn't - completely resulted from one mapping. + completely result from one mapping. - When using ":browse", also put the resulting edit command in the history, so that it can be repeated. (Demirel) @@ -4154,7 +4861,6 @@ Insert mode: 7 Use CTRL-G <count> to repeat what follows. Useful for inserting a character multiple times or repeating CTRL-Y. - Make 'revins' work in Replace mode. -9 Can't use multi-byte characters for 'matchpairs'. 7 Use 'matchpairs' for 'showmatch': When inserting a character check if it appears in the rhs of 'matchpairs'. - In Insert mode (and command line editing?): Allow undo of the last typed @@ -4296,8 +5002,6 @@ Text objects: use "aq" and "iq". Use 'quotepairs' to define pairs of quotes, like 'matchpairs'? 8 Add text object for any kind of parens, also multi-byte ones. -7 Add text object for current search pattern: "a/" and "i/". Makes it - possible to turn text highlighted for 'hlsearch' into a Visual area. 8 Add a way to make an ":omap" for a user-defined text object. Requires changing the starting position in oap->start. 8 Add "gp" and "gP" commands: insert text and make sure there is a single @@ -4354,8 +5058,6 @@ Visual mode: receive dropped text from another program. (Ben Godfrey) 7 With blockwise Visual mode and "c", "C", "I", "A", etc., allow the use of a <CR>. The entered lines are repeated over the Visual area. -7 CTRL-V :s should substitute only in the block, not to whole lines. (David - Young is working on this) 7 Filtering a block should only apply to the block, not to the whole lines. When the number of lines is increased, add lines. When decreased, pad with spaces or delete? Use ":`<,`>" on the command line. @@ -4374,7 +5076,6 @@ Visual mode: 6 ":left" and ":right" should work in Visual block mode. 7 CTRL-I and CTRL-O should work in Visual mode, but only jump to marks in the current buffer. -7 CTRL-A and CTRL-X should increase/decrease all numbers in the Visual area. 6 In non-Block mode, "I" should insert the same text in front of each line, before the first non-blank, "gI" in column 1. 6 In non-Block mode, "A" should append the same text after each line. @@ -4386,8 +5087,6 @@ Visual mode: More advanced repeating commands: - Add "." command for visual mode: redo last visual command (e.g. ":fmt"). -7 Repeating "d:{cmd}" with "." doesn't work. (Benji Fisher) Somehow remember - the command line so that it can be repeated? - Add command to repeat last movement. Including count. - Add "." command after operator: repeat last command of same operator. E.g. "c." will repeat last change, also when "x" used since then (Webb). @@ -4416,9 +5115,6 @@ Mappings and Abbreviations: not the <Space>. 8 Give a warning when using CTRL-C in the lhs of a mapping. It will never (?) work. -8 Add a way to save a current mapping and restore it later. Use a function - that returns the mapping command to restore it: mapcmd()? mapcheck() is - not fool proof. How to handle ambiguous mappings? 7 Add <0x8f> (hex), <033> (octal) and <123> (decimal) to <> notation? 7 When someone tries to unmap with a trailing space, and it fails, try unmapping without the trailing space. Helps for ":unmap xx | unmap yy". @@ -4471,8 +5167,6 @@ Incsearch: cases, saves a lot of time in big files. (Slootman wants to work on this?) When not using special characters, can continue search from the last match (or not at all, when there was no match). See oldmail/webb/in.872. -- With incsearch, use CTRL-N/CTRL-P to go to next/previous match, some other - key to copy matched word to search pattern (Alexander Schmid). Searching: @@ -4496,9 +5190,6 @@ Searching: 8 Show the progress every second. Could use the code that checks for CTRL-C to find out how much time has passed. Or use SIGALRM. Where to show the number? -8 When using an expression for ":s", set the match position in a v: - variable. So that you can do ":%s/^/\=v:lnum/" to put a line number - before each line. 7 Support for approximate-regexps to find similar words (agrep http://www.tgries.de/agrep/ tre: http://laurikari.net/tre/index.html). 8 Add an item for a big character range, so that one can search for a @@ -4507,8 +5198,6 @@ Searching: the stack if previous atom matched". Other side is "match with top of stack, pop it when it matches". Use "\@pX" and "\@m"? Example: \((\@p).\{-}\@m\)* -7 Add an option to accept a match at the cursor position. Also for - search(). (Brett) 7 Add a flag to "/pat/" to discard an error. Useful to continue a mapping when a search fails. Could be "/pat/E" (e is already used for end offset). 7 Add pattern item to use properties of Unicode characters. In Perl it's @@ -4517,7 +5206,7 @@ Searching: lines 23 to 45? Or does this conflict with Ex range syntax? 8 Allow identical pairs in 'matchpairs'. Restrict the search to the current line. -7 Allow longer pairs in 'matchpairs'. Use ~/vim/macros/matchit.vim as an +7 Allow longer pairs in 'matchpairs'. Use matchit.vim as an example. 8 Make it possible to define the character that "%" checks for in #if/#endif. For nmake it's !if/!endif. @@ -4525,7 +5214,6 @@ Searching: should be ignored (like "*/" or "#endif" inside /* */). Also: use "%" to jump from start to end of syntax region and back. Alternative: use matchit.vim -8 "/:/e+1" gets stuck on a match at the end of the line. Do we care? 8 A pattern like "\([^a]\+\)\+" takes an awful long time. Recognize that the recursive "\+" is meaningless and optimize for it. This one is also very slow on "/* some comment */": "^\/\*\(.*[^/]\)*$". @@ -4613,9 +5301,6 @@ Undo: when tests fail after making changes and you forgot in which files. 9 After undo/redo, in the message show whether the buffer is modified or not. -8 Use timestamps for undo, so that a version a certain time ago can be found - and info before some time/date can be flushed. 'undopersist' gives maximum - time to keep undo: "3h", "1d", "2w", "1y", etc. 8 Search for pattern in undo tree, showing when it happened and the text state, so that you can jump to it. 8 Undo tree: visually show the tree somehow (Damian Conway) @@ -4623,13 +5308,6 @@ Undo: timestamp? Put branch with most recent change on the left, older changes get more indent? -8 See ":e" as a change operation, find the changes and add them to the - undo info. Also be able to undo the "Reload file" choice for when a file - was changed outside of Vim. - Would require doing a diff between the buffer text and the file and - storing the differences. - Alternative: before reloading a buffer, store it somewhere. Keep a list - of about 10 last reloaded buffers. - Make it possible to undo all the commands from a mapping, including a trailing unfinished command, e.g. for ":map K iX^[r". - When accidentally hitting "R" instead of Ctrl-R, further Ctrl-R is not @@ -4681,8 +5359,6 @@ Buffer list: 7 Add expansion of buffer names, so that "*.c" is expanded to all buffer names. Needed for ":bdel *.c", ":bunload *.c", etc. 8 Support for <afile> where a buffer name is expected. -8 Some commands don't use line numbers, but buffer numbers. '$' - should then mean the number of the last buffer. E.g.: "4,$bdel". 7 Add an option to mostly use slashes in file names. Separately for internal use and for when executing an external program? 8 Some file systems are case-sensitive, some are not. Besides @@ -4713,7 +5389,7 @@ Swap (.swp) files: - Add an option to create a swap file only when making the first change to the buffer. (Liang) Or only when the buffer is not read-only. - Add option to set "umask" for backup files and swap files (Antwerpen). - 'backupumask' and 'swapumask'? Or 'umaskback' and 'umaskswap'? + 'backupumask' and 'swapumask'? Or 'umaskbackup' and 'umaskswap'? - When editing a readonly file, don't use a swap file but read parts from the original file. Also do this when the file is huge (>'maxmem'). We do need to load the file once to count the number of lines? Perhaps keep a @@ -4952,8 +5628,6 @@ Argument list: Registers: 8 Don't display empty registers with ":display". (Etienne) -8 Make the # register writable, so that it can be restored after jumping - around in windows. 8 Add put command that overwrites existing text. Should also work for blocks. Useful to move text around in a table. Works like using "R ^R r" for every line. @@ -4973,13 +5647,8 @@ Registers: Debug mode: -7 Add something to enable debugging when a remote message is received. 8 Add breakpoints for setting an option 8 Add breakpoints for assigning to a variable. -7 Add a watchpoint in the debug mode: An expression that breaks execution - when evaluating to non-zero. Add the "watchadd expr" command, stop when - the value of the expression changes. ":watchdel" deletes an item, - ":watchlist" lists the items. (Charles Campbell) 7 Store the history from debug mode in viminfo. 7 Make the debug mode history available with histget() et al. @@ -5009,11 +5678,6 @@ Various improvements: 7 Allow a window not to have a statusline. Makes it possible to use a window as a buffer-tab selection. 8 Allow non-active windows to have a different statusline. (Yakov Lerner) -7 Support using ":vert" with User commands. Add expandable items <vert>. - Do the same for ":browse" and ":confirm"? - For ":silent" and ":debug" apply to the whole user command. - More general: need a way to access command modifiers in a user command. - Assign them to a v: variable? 7 Add an invisible buffer which can be edited. For use in scripts that want to manipulate text without changing the window layout. 8 Add a command to revert to the saved version of file; undo or redo until @@ -5063,10 +5727,6 @@ Various improvements: non-unix systems. Perhaps let configure define CONF_XXX, and use #ifdef CONF_XXX in feature.h? Then what should min-features and max-features do? 8 Add "g^E" and "g^Y", to scroll a screen-full line up and down. -6 Add ":timer" command, to set a command to be executed at a certain - interval, or once after some time has elapsed. (Aaron) - Perhaps an autocommand event like CursorHold is better? - Patch to add async functionality. (Geoff Greer, 2013 Sep 1 and later) 8 Add ":confirm" handling in open_exfile(), for when file already exists. 8 When quitting with changed files, make the dialog list the changed file and allow "write all", "discard all", "write some". The last one would @@ -5221,11 +5881,11 @@ Various improvements: - Support %name% expansion for "gf" on Windows. - Make "gf" work on "file://c:/path/name". "file:/c:/" and "file:///c:/" should also work? -- Add 'urlpath', used like 'path' for when "gf" used on an URL? +- Add 'urlpath', used like 'path' for when "gf" used on a URL? 8 When using "gf" on an absolute file name, while editing a remote file (starts with scp:// or http://) should prepend the method and machine name. -- When finding an URL or file name, and it doesn't exist, try removing a +- When finding a URL or file name, and it doesn't exist, try removing a trailing '.'. - Add ":path" command modifier. Should work for every command that takes a file name argument, to search for the file name in 'path'. Use @@ -5302,7 +5962,6 @@ Various improvements: gives read errors. Check protection before opening. - When writing check for file exists but no permission, "Permission denied". - If file does not exist, check if directory exists. -- MSDOS: although t_cv and t_ci are not set, do invert char under cursor. - Settings edit mode: make file with ":set opt=xx", edit it, parse it as ex commands. - ":set -w all": list one option per line. @@ -5337,10 +5996,7 @@ Various improvements: instead of CTRL-R to make repeating possible. (Marinichev) - Add "^Vb" on the command line, replace with word before or under the cursor? -- Option to make a .swp file only when a change is made (Templeton). - Support mapping for replace mode and "r" command (Vi doesn't do this)? -5 Add 'ignorefilecase' option: Ignore case when expanding file names. - ":e ma<Tab>" would also find "Makefile" on Unix. 8 Sorting of filenames for completion is wrong on systems that ignore case of filenames. Add 'ignorefncase' option. When set, case in filenames is ignored for sorting them. Patch by Mike Williams: @@ -5389,7 +6045,7 @@ From vile: Far future and "big" extensions: - Instead of using a Makefile and autoconf, use a simple shell script to find the C compiler and do everything with C code. Translate something - like an Aap recipe and configure.in to C. Avoids depending on Python, + like an Aap recipe and configure.ac to C. Avoids depending on Python, thus will work everywhere. With batch file to find the C compiler it would also work on MS-Windows. - Make it easy to setup Vim for groups of users: novice vi users, novice @@ -5409,11 +6065,6 @@ Far future and "big" extensions: - Add open mode, use it when terminal has no cursor positioning. - Special "drawing mode": a line is drawn where the cursor is moved to. Backspace deletes along the line (from jvim). -- Implement ":Bset", set option in all buffers. Also ":Wset", set in all - windows, ":Aset, set in all arguments and ":Tset", set in all files - mentioned in the tags file. - Add buffer/arg range, like in ":2,5B%s/..." (do we really need this???) - Add search string: "B/*.c/%s/.."? Or ":F/*.c/%s/.."? - Support for underlining (underscore-BS-char), bold (char-BS-char) and other standout modes switched on/off with , 'overstrike' option (Reiter). - Add vertical mode (Paul Jury, Demirel): "5vdw" deletes a word in five @@ -5429,8 +6080,5 @@ Far future and "big" extensions: are reflected in each Vim immediately. Could work with local files but also over the internet. See http://www.codingmonkeys.de/subethaedit/. -When using "do" or ":diffget" in a buffer with changes in every line an extra -empty line would appear. - vim:tw=78:sw=4:sts=4:ts=8:ft=help:norl: vim: set fo+=n : diff --git a/runtime/doc/uganda.txt b/runtime/doc/uganda.txt index 113df4f64f..befb9f31d1 100644 --- a/runtime/doc/uganda.txt +++ b/runtime/doc/uganda.txt @@ -1,4 +1,4 @@ -*uganda.txt* For Vim version 7.4. Last change: 2013 Jul 06 +*uganda.txt* For Vim version 8.1. Last change: 2018 May 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -194,7 +194,7 @@ child, you should have the intention to do this for at least one year. How do you know that the money will be spent right? First of all you have my personal guarantee as the author of Vim. I trust the people that are working -at the centre, I know them personally. Further more, the centre has been +at the centre, I know them personally. Furthermore, the centre has been co-sponsored and inspected by World Vision, Save the Children Fund and is now under the supervision of Pacific Academy Outreach Society. The centre is visited about once a year to check the progress (at our own cost). I have diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 46469b3533..d271222d2e 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -1,4 +1,4 @@ -*undo.txt* For Vim version 7.4. Last change: 2014 May 24 +*undo.txt* For Vim version 8.1. Last change: 2014 May 24 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt index 11fa2173d6..040bcd9450 100644 --- a/runtime/doc/usr_01.txt +++ b/runtime/doc/usr_01.txt @@ -1,4 +1,4 @@ -*usr_01.txt* For Vim version 7.4. Last change: 2010 Nov 03 +*usr_01.txt* For Vim version 8.1. Last change: 2017 Jul 15 VIM USER MANUAL - by Bram Moolenaar @@ -140,19 +140,19 @@ On other systems, you have to do a little work: 1. Copy the tutor file. You can do this with Vim (it knows where to find it): > - vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' + vim --clean -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' < This will write the file "TUTORCOPY" in the current directory. To use a translated version of the tutor, append the two-letter language code to the filename. For French: > - vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q' + vim --clean -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q' < 2. Edit the copied file with Vim: > - vim -u NONE -c "set nocp" TUTORCOPY + vim --clean TUTORCOPY < - The extra arguments make sure Vim is started in a good mood. + The --clean argument makes sure Vim is started with nice defaults. 3. Delete the copied file when you are finished with it: > diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 8bfa9ba05d..2f976ba014 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_02.txt* For Vim version 8.1. Last change: 2017 Mar 14 VIM USER MANUAL - by Bram Moolenaar @@ -408,7 +408,15 @@ original version of the file. Everything you always wanted to know can be found in the Vim help files. Don't be afraid to ask! - To get generic help use this command: > + +If you know what you are looking for, it is usually easier to search for it +using the help system, instead of using Google. Because the subjects follow +a certain style guide. + +Also the help has the advantage of belonging to your particular Vim version. +You won't see help for commands added later. These would not work for you. + +To get generic help use this command: > :help @@ -482,7 +490,7 @@ example, use the following command: > :help 'number' -The table with all mode prefixes can be found here: |help-context|. +The table with all mode prefixes can be found below: |help-summary|. Special keys are enclosed in angle brackets. To find help on the up-arrow key in Insert mode, for instance, use this command: > @@ -499,62 +507,191 @@ You can use the error ID at the start to find help about it: > Summary: *help-summary* > - :help -< Gives you very general help. Scroll down to see a list of all - helpfiles, including those added locally (i.e. not distributed - with Vim). > - :help user-toc.txt -< Table of contents of the User Manual. > - :help :subject -< Ex-command "subject", for instance the following: > - :help :help -< Help on getting help. > - :help abc -< normal-mode command "abc". > - :help CTRL-B -< Control key <C-B> in Normal mode. > - :help i_abc - :help i_CTRL-B -< The same in Insert mode. > - :help v_abc - :help v_CTRL-B -< The same in Visual mode. > - :help c_abc - :help c_CTRL-B -< The same in Command-line mode. > - :help 'subject' -< Option 'subject'. > - :help subject() -< Function "subject". > - :help -subject -< Command-line option "-subject". > - :help +subject -< Compile-time feature "+subject". > - :help EventName -< Autocommand event "EventName". > - :help digraphs.txt -< The top of the helpfile "digraph.txt". - Similarly for any other helpfile. > - :help pattern<Tab> -< Find a help tag starting with "pattern". Repeat <Tab> for - others. > - :help pattern<Ctrl-D> -< See all possible help tag matches "pattern" at once. > - :helpgrep pattern -< Search the whole text of all help files for pattern "pattern". - Jumps to the first match. Jump to other matches with: > - :cn -< next match > - :cprev - :cN -< previous match > - :cfirst - :clast -< first or last match > - :copen - :cclose -< open/close the quickfix window; press <Enter> to jump - to the item under the cursor + +1) Use Ctrl-D after typing a topic and let Vim show all available topics. + Or press Tab to complete: > + :help some<Tab> +< More information on how to use the help: > + :help helphelp + +2) Follow the links in bars to related help. You can go from the detailed + help to the user documentation, which describes certain commands more from + a user perspective and less detailed. E.g. after: > + :help pattern.txt +< You can see the user guide topics |03.9| and |usr_27.txt| in the + introduction. + +3) Options are enclosed in single apostrophes. To go to the help topic for the + list option: > + :help 'list' +< If you only know you are looking for a certain option, you can also do: > + :help options.txt +< to open the help page which describes all option handling and then search + using regular expressions, e.g. textwidth. + Certain options have their own namespace, e.g.: > + :help cpo-<letter> +< for the corresponding flag of the 'cpoptions' settings, substitute <letter> + by a specific flag, e.g.: > + :help cpo-; +< And for the guioption flags: > + :help go-<letter> + +4) Normal mode commands do not have a prefix. To go to the help page for the + "gt" command: > + :help gt + +5) Insert mode commands start with i_. Help for deleting a word: > + :help i_CTRL-W + +6) Visual mode commands start with v_. Help for jumping to the other side of + the Visual area: > + :help v_o + +7) Command line editing and arguments start with c_. Help for using the + command argument %: > + :help c_% + +8) Ex-commands always start with ":", so to go to the :s command help: > + :help :s + +9) Commands specifically for debugging start with ">". To go to the help + for the "cont" debug command: > + :help >cont + +10) Key combinations. They usually start with a single letter indicating + the mode for which they can be used. E.g.: > + :help i_CTRL-X +< takes you to the family of Ctrl-X commands for insert mode which can be + used to auto complete different things. Note, that certain keys will + always be written the same, e.g. Control will always be CTRL. + For normal mode commands there is no prefix and the topic is available at + :h CTRL-<Letter>. E.g. > + :help CTRL-W +< In contrast > + :help c_CTRL-R +< will describe what the Ctrl-R does when entering commands in the Command + line and > + :help v_Ctrl-A +< talks about incrementing numbers in visual mode and > + :help g_CTRL-A +< talks about the g<C-A> command (e.g. you have to press "g" then <Ctrl-A>). + Here the "g" stand for the normal command "g" which always expects a second + key before doing something similar to the commands starting with "z" + +11) Regexp items always start with /. So to get help for the "\+" quantifier + in Vim regexes: > + :help /\+ +< If you need to know everything about regular expressions, start reading + at: > + :help pattern.txt + +12) Registers always start with "quote". To find out about the special ":" + register: > + :help quote: + +13) Vim script is available at > + :help eval.txt +< Certain aspects of the language are available at :h expr-X where "X" is a + single letter. E.g. > + :help expr-! +< will take you to the topic describing the "!" (Not) operator for + VimScript. + Also important is > + :help function-list +< to find a short description of all functions available. Help topics for + Vim script functions always include the "()", so: > + :help append() +< talks about the append Vim script function rather than how to append text + in the current buffer. + +14) Mappings are talked about in the help page :h |map.txt|. Use > + :help mapmode-i +< to find out about the |:imap| command. Also use :map-topic + to find out about certain subtopics particular for mappings. e.g: > + :help :map-local +< for buffer-local mappings or > + :help map-bar +< for how the '|' is handled in mappings. + +15) Command definitions are talked about :h command-topic, so use > + :help command-bar +< to find out about the '!' argument for custom commands. + +16) Window management commands always start with CTRL-W, so you find the + corresponding help at :h CTRL-W_letter. E.g. > + :help CTRL-W_p +< for moving the previous accessed window. You can also access > + :help windows.txt +< and read your way through if you are looking for window handling + commands. + +17) Use |:helpgrep| to search in all help pages (and also of any installed + plugins). See |:helpgrep| for how to use it. + To search for a topic: > + :helpgrep topic +< This takes you to the first match. To go to the next one: > + :cnext +< All matches are available in the quickfix window which can be opened + with: > + :copen +< Move around to the match you like and press Enter to jump to that help. + +18) The user manual. This describes help topics for beginners in a rather + friendly way. Start at |usr_toc.txt| to find the table of content (as you + might have guessed): > + :help usr_toc.txt +< Skim over the contents to find interesting topics. The "Digraphs" and + "Entering special characters" items are in chapter 24, so to go to that + particular help page: > + :help usr_24.txt +< Also if you want to access a certain chapter in the help, the chapter + number can be accessed directly like this: > + :help 10.1 +< goes to chapter 10.1 in |usr_10.txt| and talks about recording macros. + +19) Highlighting groups. Always start with hl-groupname. E.g. > + :help hl-WarningMsg +< talks about the WarningMsg highlighting group. + +20) Syntax highlighting is namespaced to :syn-topic e.g. > + :help :syn-conceal +< talks about the conceal argument for the :syn command. + +21) Quickfix commands usually start with :c while location list commands + usually start with :l + +22) Autocommand events can be found by their name: > + :help BufWinLeave +< To see all possible events: > + :help autocommand-events + +23) Command-line switches always start with "-". So for the help of the -f + command switch of Vim use: > + :help -f + +24) Optional features always start with "+". To find out about the + conceal feature use: > + :help +conceal + +25) Documentation for included filetype specific functionality is usually + available in the form ft-<filetype>-<functionality>. So > + :help ft-c-syntax +< talks about the C syntax file and the option it provides. Sometimes, + additional sections for omni completion > + :help ft-php-omni +< or filetype plugins > + :help ft-tex-plugin +< are available. + +26) Error and Warning codes can be looked up directly in the help. So > + :help E297 +< takes you exactly to the description of the swap error message and > + :help W10 +< talks about the warning "Changing a readonly file". + Sometimes however, those error codes are not described, but rather are + listed at the Vim command that usually causes this. So: > + :help E128 +< takes you to the |:function| command ============================================================================== diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt index 6173260895..ba51aa203c 100644 --- a/runtime/doc/usr_03.txt +++ b/runtime/doc/usr_03.txt @@ -1,4 +1,4 @@ -*usr_03.txt* For Vim version 7.4. Last change: 2006 Jun 21 +*usr_03.txt* For Vim version 8.1. Last change: 2017 Jul 21 VIM USER MANUAL - by Bram Moolenaar @@ -57,8 +57,11 @@ paragraph, much faster than using "l". "b" does the same in the other direction. A word ends at a non-word character, such as a ".", "-" or ")". To change -what Vim considers to be a word, see the 'iskeyword' option. - It is also possible to move by white-space separated WORDs. This is not a +what Vim considers to be a word, see the 'iskeyword' option. If you try this +out in the help directly, 'iskeyword' needs to be reset for the examples to +work: > + :set iskeyword& +It is also possible to move by white-space separated WORDs. This is not a word in the normal sense, that's why the uppercase is used. The commands for moving by WORDs are also uppercase, as this figure shows: @@ -179,7 +182,7 @@ the following: This tells you that you might want to fix something on line 33. So how do you find line 33? One way is to do "9999k" to go to the top of the file and "32j" -to go down thirty two lines. It is not a good way, but it works. A much +to go down thirty-two lines. It is not a good way, but it works. A much better way of doing things is to use the "G" command. With a count, this command positions you at the given line number. For example, "33G" puts you on line 33. (For a better way of going through a compiler's error list, see @@ -349,7 +352,7 @@ The "?" command works like "/" but searches backwards: > ?word The "N" command repeats the last search the opposite direction. Thus using -"N" after a "/" command search backwards, using "N" after "?" searches +"N" after a "/" command searches backwards, using "N" after "?" searches forward. @@ -410,8 +413,8 @@ in "the" use: > /the\> The "\>" item is a special marker that only matches at the end of a word. -Similarly "\<" only matches at the begin of a word. Thus to search for the -word "the" only: > +Similarly "\<" only matches at the beginning of a word. Thus to search for +the word "the" only: > /\<the\> @@ -509,7 +512,7 @@ only if it is at the beginning of a line. The $ character matches the end of a line. Therefore, "was$" matches the word was only if it is at the end of a line. -Let's mark the places where "the" matches in this example line with "x"s: +Let's mark the places where "/the" matches in this example line with "x"s: the solder holding one of the chips melted and the ~ xxx xxx xxx @@ -532,7 +535,7 @@ MATCHING ANY SINGLE CHARACTER The . (dot) character matches any existing character. For example, the pattern "c.m" matches a string whose first character is a c, whose second -character is anything, and whose the third character is m. Example: +character is anything, and whose third character is m. Example: We use a computer that became the cummin winter. ~ xxx xxx xxx diff --git a/runtime/doc/usr_04.txt b/runtime/doc/usr_04.txt index c09cb204c5..1b4f579448 100644 --- a/runtime/doc/usr_04.txt +++ b/runtime/doc/usr_04.txt @@ -1,4 +1,4 @@ -*usr_04.txt* For Vim version 7.4. Last change: 2008 Sep 06 +*usr_04.txt* For Vim version 8.1. Last change: 2014 Aug 29 VIM USER MANUAL - by Bram Moolenaar @@ -186,7 +186,7 @@ commands: /four<Enter> find the first string "four" cwfive<Esc> change the word to "five" n find the next "four" - . repeat the change to "five' + . repeat the change to "five" n find the next "four" . repeat the change etc. diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index f71cf42cff..368551a220 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 7.4. Last change: 2012 Nov 20 +*usr_05.txt* For Vim version 8.1. Last change: 2018 Feb 20 VIM USER MANUAL - by Bram Moolenaar @@ -12,10 +12,11 @@ Vim's capabilities. Or define your own macros. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings -|05.4| Adding a plugin -|05.5| Adding a help file -|05.6| The option window -|05.7| Often used options +|05.4| Adding a package +|05.5| Adding a plugin +|05.6| Adding a help file +|05.7| The option window +|05.8| Often used options Next chapter: |usr_06.txt| Using syntax highlighting Previous chapter: |usr_04.txt| Making small changes @@ -47,6 +48,14 @@ For MS-DOS and MS-Windows you can use one of these: $HOME/_vimrc ~ $VIM/_vimrc ~ +If you are creating the vimrc file for the first time, it is recommended to +put this line at the top: > + + source $VIMRUNTIME/defaults.vim + +This initializes Vim for new users (as opposed to traditional Vi users). See +|defaults.vim| for the details. + The vimrc file can contain all the commands that you type after a colon. The most simple ones are for setting options. For example, if you want Vim to always start with the 'incsearch' option on, add this line your vimrc file: > @@ -263,7 +272,45 @@ The ":map" command (with no arguments) lists your current mappings. At least the ones for Normal mode. More about mappings in section |40.1|. ============================================================================== -*05.4* Adding a plugin *add-plugin* *plugin* +*05.4* Adding a package *add-package* *matchit-install* + +A package is a set of files that you can add to Vim. There are two kinds of +packages: optional and automatically loaded on startup. + +The Vim distribution comes with a few packages that you can optionally use. +For example, the matchit plugin. This plugin makes the "%" command jump to +matching HTML tags, if/else/endif in Vim scripts, etc. Very useful, although +it's not backwards compatible (that's why it is not enabled by default). + +To start using the matchit plugin, add one line to your vimrc file: > + packadd! matchit + +That's all! After restarting Vim you can find help about this plugin: > + :help matchit + +This works, because when `:packadd` loaded the plugin it also added the +package directory in 'runtimepath', so that the help file can be found. + +You can find packages on the Internet in various places. It usually comes as +an archive or as a repository. For an archive you can follow these steps: + 1. create the package directory: > + mkdir -p ~/.vim/pack/fancy +< "fancy" can be any name of your liking. Use one that describes the + package. + 2. unpack the archive in that directory. This assumes the top + directory in the archive is "start": > + cd ~/.vim/pack/fancy + unzip /tmp/fancy.zip +< If the archive layout is different make sure that you end up with a + path like this: + ~/.vim/pack/fancy/start/fancytext/plugin/fancy.vim ~ + Here "fancytext" is the name of the package, it can be anything + else. + +More information about packages can be found here: |packages|. + +============================================================================== +*05.5* Adding a plugin *add-plugin* *plugin* Vim's functionality can be extended by adding plugins. A plugin is nothing more than a Vim script file that is loaded automatically when Vim starts. You @@ -324,10 +371,9 @@ Example for Unix (assuming you didn't have a plugin directory yet): > mkdir ~/.vim mkdir ~/.vim/plugin - cp /usr/local/share/vim/vim60/macros/justify.vim ~/.vim/plugin + cp /tmp/yourplugin.vim ~/.vim/plugin -That's all! Now you can use the commands defined in this plugin to justify -text. +That's all! Now you can use the commands defined in this plugin. Instead of putting plugins directly into the plugin/ directory, you may better organize them by putting them into subdirectories under plugin/. @@ -415,23 +461,19 @@ Further reading: |new-filetype| How to detect a new file type. ============================================================================== -*05.5* Adding a help file *add-local-help* *matchit-install* +*05.6* Adding a help file *add-local-help* If you are lucky, the plugin you installed also comes with a help file. We will explain how to install the help file, so that you can easily find help for your new plugin. - Let us use the "matchit.vim" plugin as an example (it is included with -Vim). This plugin makes the "%" command jump to matching HTML tags, -if/else/endif in Vim scripts, etc. Very useful, although it's not backwards -compatible (that's why it is not enabled by default). - This plugin comes with documentation: "matchit.txt". Let's first copy the -plugin to the right directory. This time we will do it from inside Vim, so -that we can use $VIMRUNTIME. (You may skip some of the "mkdir" commands if -you already have the directory.) > + Let us use the "doit.vim" plugin as an example. This plugin comes with +documentation: "doit.txt". Let's first copy the plugin to the right +directory. This time we will do it from inside Vim. (You may skip some of +the "mkdir" commands if you already have the directory.) > :!mkdir ~/.vim :!mkdir ~/.vim/plugin - :!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin + :!cp /tmp/doit.vim ~/.vim/plugin The "cp" command is for Unix, on MS-DOS you can use "copy". @@ -441,7 +483,7 @@ Now create a "doc" directory in one of the directories in 'runtimepath'. > Copy the help file to the "doc" directory. > - :!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc + :!cp /tmp/doit.txt ~/.vim/doc Now comes the trick, which allows you to jump to the subjects in the new help file: Generate the local tags file with the |:helptags| command. > @@ -450,10 +492,10 @@ file: Generate the local tags file with the |:helptags| command. > Now you can use the > - :help g% + :help doit -command to find help for "g%" in the help file you just added. You can see an -entry for the local help file when you do: > +command to find help for "doit" in the help file you just added. You can see +an entry for the local help file when you do: > :help local-additions @@ -464,7 +506,7 @@ them through the tag. For writing a local help file, see |write-local-help|. ============================================================================== -*05.6* The option window +*05.7* The option window If you are looking for an option that does what you want, you can search in the help files here: |options|. Another way is by using this command: > @@ -503,7 +545,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset from the window border where scrolling starts. ============================================================================== -*05.7* Often used options +*05.8* Often used options There are an awful lot of options. Most of them you will hardly ever use. Some of the more useful ones will be mentioned here. Don't forget you can diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index 5e3c7726d4..e2750aeb6b 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -1,4 +1,4 @@ -*usr_06.txt* For Vim version 7.4. Last change: 2009 Oct 28 +*usr_06.txt* For Vim version 8.1. Last change: 2009 Oct 28 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_07.txt b/runtime/doc/usr_07.txt index 8a0600b84d..a163006e06 100644 --- a/runtime/doc/usr_07.txt +++ b/runtime/doc/usr_07.txt @@ -1,4 +1,4 @@ -*usr_07.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*usr_07.txt* For Vim version 8.1. Last change: 2017 Sep 18 VIM USER MANUAL - by Bram Moolenaar @@ -215,14 +215,14 @@ change: > `. -Suppose you are editing the file "one.txt". Somewhere halfway the file you -use "x" to delete a character. Then you go to the last line with "G" and -write the file with ":w". You edit several other files, and then use ":edit -one.txt" to come back to "one.txt". If you now use `" Vim jumps to the last -line of the file. Using `. takes you to the position where you deleted the -character. Even when you move around in the file `" and `. will take you to -the remembered position. At least until you make another change or leave the -file. +Suppose you are editing the file "one.txt". Somewhere halfway through the +file you use "x" to delete a character. Then you go to the last line with "G" +and write the file with ":w". You edit several other files, and then use +":edit one.txt" to come back to "one.txt". If you now use `" Vim jumps to the +last line of the file. Using `. takes you to the position where you deleted +the character. Even when you move around in the file `" and `. will take you +to the remembered position. At least until you make another change or leave +the file. FILE MARKS @@ -233,8 +233,8 @@ another file and place marks there, these are specific for that file. Thus each file has its own set of marks, they are local to the file. So far we were using marks with a lowercase letter. There are also marks with an uppercase letter. These are global, they can be used from any file. -For example suppose that we are editing the file "foo.txt". Go to halfway the -file ("50%") and place the F mark there (F for foo): > +For example suppose that we are editing the file "foo.txt". Go to halfway +down the file ("50%") and place the F mark there (F for foo): > 50%mF @@ -355,7 +355,7 @@ a sentence to the f register (f for First): > "fyas The "yas" command yanks a sentence like before. It's the "f that tells Vim -the text should be place in the f register. This must come just before the +the text should be placed in the f register. This must come just before the yank command. Now yank three whole lines to the l register (l for line): > diff --git a/runtime/doc/usr_08.txt b/runtime/doc/usr_08.txt index ef26b46eb7..5253856396 100644 --- a/runtime/doc/usr_08.txt +++ b/runtime/doc/usr_08.txt @@ -1,4 +1,4 @@ -*usr_08.txt* For Vim version 7.4. Last change: 2014 Jul 06 +*usr_08.txt* For Vim version 8.1. Last change: 2017 Aug 11 VIM USER MANUAL - by Bram Moolenaar @@ -45,7 +45,7 @@ top one: +----------------------------------+ What you see here is two windows on the same file. The line with "====" is -that status line. It displays information about the window above it. (In +the status line. It displays information about the window above it. (In practice the status line will be in reverse video.) The two windows allow you to view two parts of the same file. For example, you could make the top window show the variable declarations of a program, and diff --git a/runtime/doc/usr_09.txt b/runtime/doc/usr_09.txt index 68575f5184..ee33f941f0 100644 --- a/runtime/doc/usr_09.txt +++ b/runtime/doc/usr_09.txt @@ -1,4 +1,4 @@ -*usr_09.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*usr_09.txt* For Vim version 8.1. Last change: 2017 Aug 11 VIM USER MANUAL - by Bram Moolenaar @@ -21,7 +21,7 @@ Table of contents: |usr_toc.txt| ============================================================================== *09.1* Parts of the GUI -You might have an icon on your desktop that starts gVim. Otherwise, one of +You might have an icon on your desktop that starts gvim. Otherwise, one of these commands should do it: > gvim file.txt @@ -60,7 +60,7 @@ THE WINDOW TITLE At the very top is the window title. This is drawn by your window system. Vim will set the title to show the name of the current file. First comes the name of the file. Then some special characters and the directory of the file -in parens. These special character can be present: +in parens. These special characters can be present: - The file cannot be modified (e.g., a help file) + The file contains changes @@ -184,14 +184,14 @@ currently highlighted. In Vim this is the Visual area (this assumes you are using the default option settings). You can paste this selection in another application without any further action. For example, in this text select a few words with the mouse. Vim will -switch to Visual mode and highlight the text. Now start another gVim, without +switch to Visual mode and highlight the text. Now start another gvim, without a file name argument, so that it displays an empty window. Click the middle mouse button. The selected text will be inserted. The "current selection" will only remain valid until some other text is -selected. After doing the paste in the other gVim, now select some characters +selected. After doing the paste in the other gvim, now select some characters in that window. You will notice that the words that were previously selected -in the other gVim window are displayed differently. This means that it no +in the other gvim window are displayed differently. This means that it no longer is the current selection. You don't need to select text with the mouse, using the keyboard commands for @@ -204,10 +204,10 @@ Now for the other place with which text can be exchanged. We call this the "real clipboard", to avoid confusion. Often both the "current selection" and the "real clipboard" are called clipboard, you'll have to get used to that. To put text on the real clipboard, select a few different words in one of -the gVims you have running. Then use the Edit/Copy menu entry. Now the text +the gvims you have running. Then use the Edit/Copy menu entry. Now the text has been copied to the real clipboard. You can't see this, unless you have -some application that shows the clipboard contents (e.g., KDE's klipper). - Now select the other gVim, position the cursor somewhere and use the +some application that shows the clipboard contents (e.g., KDE's Klipper). + Now select the other gvim, position the cursor somewhere and use the Edit/Paste menu. You will see the text from the real clipboard is inserted. @@ -215,7 +215,7 @@ USING BOTH This use of both the "current selection" and the "real clipboard" might sound a bit confusing. But it is very useful. Let's show this with an example. -Use one gVim with a text file and perform these actions: +Use one gvim with a text file and perform these actions: - Select two words in Visual mode. - Use the Edit/Copy menu to get these words onto the clipboard. diff --git a/runtime/doc/usr_10.txt b/runtime/doc/usr_10.txt index 4398c4d64f..46f76770f8 100644 --- a/runtime/doc/usr_10.txt +++ b/runtime/doc/usr_10.txt @@ -1,4 +1,4 @@ -*usr_10.txt* For Vim version 7.4. Last change: 2006 Nov 05 +*usr_10.txt* For Vim version 8.1. Last change: 2006 Nov 05 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_11.txt b/runtime/doc/usr_11.txt index 9935ded48c..13c08f91a1 100644 --- a/runtime/doc/usr_11.txt +++ b/runtime/doc/usr_11.txt @@ -1,4 +1,4 @@ -*usr_11.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_11.txt* For Vim version 8.1. Last change: 2018 Apr 13 VIM USER MANUAL - by Bram Moolenaar @@ -234,7 +234,7 @@ that file, be prepared to redo your last changes. WHAT TO DO? *swap-exists-choices* -If dialogs are supported you will be asked to select one of five choices: +If dialogs are supported you will be asked to select one of six choices: Swap file ".main.c.swp" already exists! ~ [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete it: ~ diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index fba1b53274..13401b15ea 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -1,4 +1,4 @@ -*usr_12.txt* For Vim version 7.4. Last change: 2007 May 11 +*usr_12.txt* For Vim version 8.1. Last change: 2017 Aug 11 VIM USER MANUAL - by Bram Moolenaar @@ -290,7 +290,7 @@ command: > The line range "%" is used, thus this works on the whole file. The pattern that the ":substitute" command matches with is "\s\+$". This finds white space characters (\s), 1 or more of them (\+), before the end-of-line ($). -Later will be explained how you write patterns like this |usr_27.txt|. +Later will be explained how you write patterns like this, see |usr_27.txt|. The "to" part of the substitute command is empty: "//". Thus it replaces with nothing, effectively deleting the matched white space. diff --git a/runtime/doc/usr_20.txt b/runtime/doc/usr_20.txt index 5f0a660187..afeb7133e6 100644 --- a/runtime/doc/usr_20.txt +++ b/runtime/doc/usr_20.txt @@ -1,4 +1,4 @@ -*usr_20.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*usr_20.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt index 450d394337..40388eee7a 100644 --- a/runtime/doc/usr_21.txt +++ b/runtime/doc/usr_21.txt @@ -1,4 +1,4 @@ -*usr_21.txt* For Vim version 7.4. Last change: 2012 Nov 02 +*usr_21.txt* For Vim version 8.1. Last change: 2012 Nov 02 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt index cff8e9db1e..17209976b8 100644 --- a/runtime/doc/usr_22.txt +++ b/runtime/doc/usr_22.txt @@ -1,4 +1,4 @@ -*usr_22.txt* For Vim version 7.4. Last change: 2012 Nov 15 +*usr_22.txt* For Vim version 8.1. Last change: 2016 Dec 13 VIM USER MANUAL - by Bram Moolenaar @@ -93,7 +93,7 @@ browser. This is what you get: > o................Browsing with a Horizontal Split...........|netrw-o| p................Use Preview Window.........................|netrw-p| P................Edit in Previous Window....................|netrw-p| - q................Listing Bookmarks and History..............|netrw-q| + q................Listing Bookmarks and History..............|netrw-qb| r................Reversing Sorting Order....................|netrw-r| < (etc) diff --git a/runtime/doc/usr_23.txt b/runtime/doc/usr_23.txt index 63cbc612de..049ca20688 100644 --- a/runtime/doc/usr_23.txt +++ b/runtime/doc/usr_23.txt @@ -1,4 +1,4 @@ -*usr_23.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*usr_23.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_24.txt b/runtime/doc/usr_24.txt index 46a22c683c..a5e3344458 100644 --- a/runtime/doc/usr_24.txt +++ b/runtime/doc/usr_24.txt @@ -1,4 +1,4 @@ -*usr_24.txt* For Vim version 7.4. Last change: 2006 Jul 23 +*usr_24.txt* For Vim version 8.1. Last change: 2018 Mar 18 VIM USER MANUAL - by Bram Moolenaar @@ -538,8 +538,8 @@ a 16 bit and a 32 bit number (e.g., for a Unicode character): > *24.9* Digraphs Some characters are not on the keyboard. For example, the copyright character -(). To type these characters in Vim, you use digraphs, where two characters -represent one. To enter a , for example, you press three keys: > +(©). To type these characters in Vim, you use digraphs, where two characters +represent one. To enter a ©, for example, you press three keys: > CTRL-K Co @@ -549,12 +549,12 @@ To find out what digraphs are available, use the following command: > Vim will display the digraph table. Here are three lines of it: - AC ~_ 159 NS | 160 !I 161 Ct 162 Pd 163 Cu 164 Ye 165 ~ - BB 166 SE 167 ': 168 Co 169 -a 170 << 171 NO 172 ~ - -- 173 Rg 174 'm 175 DG 176 +- 177 2S 178 3S 179 ~ + AC ~_ 159 NS | 160 !I ¡ 161 Ct ¢ 162 Pd £ 163 Cu ¤ 164 Ye ¥ 165 ~ + BB ¦ 166 SE § 167 ': ¨ 168 Co © 169 -a ª 170 << « 171 NO ¬ 172 ~ + -- ­ 173 Rg ® 174 'm ¯ 175 DG ° 176 +- ± 177 2S ² 178 3S ³ 179 ~ This shows, for example, that the digraph you get by typing CTRL-K Pd is the -character (). This is character number 163 (decimal). +character (£). This is character number 163 (decimal). Pd is short for Pound. Most digraphs are selected to give you a hint about the character they will produce. If you look through the list you will understand the logic. @@ -569,9 +569,9 @@ that combination. Thus CTRL-K dP also works. Since there is no digraph for You can define your own digraphs. Example: > - :digraph a" + :digraph a" ä -This defines that CTRL-K a" inserts an character. You can also specify the +This defines that CTRL-K a" inserts an ä character. You can also specify the character with a decimal number. This defines the same digraph: > :digraph a" 228 diff --git a/runtime/doc/usr_25.txt b/runtime/doc/usr_25.txt index 5a687599b3..f5be3e048f 100644 --- a/runtime/doc/usr_25.txt +++ b/runtime/doc/usr_25.txt @@ -1,4 +1,4 @@ -*usr_25.txt* For Vim version 7.4. Last change: 2007 May 11 +*usr_25.txt* For Vim version 8.1. Last change: 2016 Mar 28 VIM USER MANUAL - by Bram Moolenaar @@ -196,12 +196,16 @@ Vim has no built-in way of justifying text. However, there is a neat macro package that does the job. To use this package, execute the following command: > - :runtime macros/justify.vim + :packadd justify + +Or put this line in your |vimrc|: > + + packadd! justify This Vim script file defines a new visual command "_j". To justify a block of text, highlight the text in Visual mode and then execute "_j". Look in the file for more explanations. To go there, do "gf" on this name: -$VIMRUNTIME/macros/justify.vim. +$VIMRUNTIME/pack/dist/opt/justify/plugin/justify.vim. An alternative is to filter the text through an external program. Example: > @@ -402,7 +406,7 @@ the cursor keys: > :map <Down> gj -TURNING A PARAGRAPH INTO ONE LINE +TURNING A PARAGRAPH INTO ONE LINE *edit-paragraph-join* If you want to import text into a program like MS-Word, each paragraph should be a single line. If your paragraphs are currently separated with empty diff --git a/runtime/doc/usr_26.txt b/runtime/doc/usr_26.txt index cc23959621..f3afe9be9d 100644 --- a/runtime/doc/usr_26.txt +++ b/runtime/doc/usr_26.txt @@ -1,4 +1,4 @@ -*usr_26.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*usr_26.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_27.txt b/runtime/doc/usr_27.txt index fb096593f2..7098c070d0 100644 --- a/runtime/doc/usr_27.txt +++ b/runtime/doc/usr_27.txt @@ -1,4 +1,4 @@ -*usr_27.txt* For Vim version 7.4. Last change: 2010 Mar 28 +*usr_27.txt* For Vim version 8.1. Last change: 2018 Jan 26 VIM USER MANUAL - by Bram Moolenaar @@ -225,9 +225,9 @@ specify a line offset, this can cause trouble. For example: > /const/-2 This finds the next word "const" and then moves two lines up. If you -use "n" to search again, Vim could start at the current position and find the same -"const" match. Then using the offset again, you would be back where you started. -You would be stuck! +use "n" to search again, Vim could start at the current position and find the +same "const" match. Then using the offset again, you would be back where you +started. You would be stuck! It could be worse: Suppose there is another match with "const" in the next line. Then repeating the forward search would find this match and move two lines up. Thus you would actually move the cursor back! diff --git a/runtime/doc/usr_28.txt b/runtime/doc/usr_28.txt index 46db1b90af..e2565b01fd 100644 --- a/runtime/doc/usr_28.txt +++ b/runtime/doc/usr_28.txt @@ -1,4 +1,4 @@ -*usr_28.txt* For Vim version 7.4. Last change: 2008 Jun 14 +*usr_28.txt* For Vim version 8.1. Last change: 2008 Jun 14 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt index f13cd3a409..996046e5d5 100644 --- a/runtime/doc/usr_29.txt +++ b/runtime/doc/usr_29.txt @@ -1,4 +1,4 @@ -*usr_29.txt* For Vim version 7.4. Last change: 2008 Jun 28 +*usr_29.txt* For Vim version 8.1. Last change: 2016 Feb 27 VIM USER MANUAL - by Bram Moolenaar @@ -255,7 +255,8 @@ function. RELATED ITEMS -You can set 'ignorecase' to make case in tag names be ignored. +To make case in tag names be ignored, you can set 'ignorecase' while leaving +'tagcase' as "followic", or set 'tagcase' to "ignore". The 'tagbsearch' option tells if the tags file is sorted or not. The default is to assume a sorted tags file, which makes a tags search a lot faster, but @@ -264,9 +265,6 @@ doesn't work if the tags file isn't sorted. The 'taglength' option can be used to tell Vim the number of significant characters in a tag. -When you use the SNiFF+ program, you can use the Vim interface to it |sniff|. -SNiFF+ is a commercial program. - Cscope is a free program. It does not only find places where an identifier is declared, but also where it is used. See |cscope|. diff --git a/runtime/doc/usr_30.txt b/runtime/doc/usr_30.txt index b2be512980..fa39dbf705 100644 --- a/runtime/doc/usr_30.txt +++ b/runtime/doc/usr_30.txt @@ -1,4 +1,4 @@ -*usr_30.txt* For Vim version 7.4. Last change: 2007 Nov 10 +*usr_30.txt* For Vim version 8.1. Last change: 2007 Nov 10 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_31.txt b/runtime/doc/usr_31.txt index 550564e10c..13de489baa 100644 --- a/runtime/doc/usr_31.txt +++ b/runtime/doc/usr_31.txt @@ -1,4 +1,4 @@ -*usr_31.txt* For Vim version 7.4. Last change: 2007 May 08 +*usr_31.txt* For Vim version 8.1. Last change: 2007 May 08 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_32.txt b/runtime/doc/usr_32.txt index fd58f2d517..9e48d53ea9 100644 --- a/runtime/doc/usr_32.txt +++ b/runtime/doc/usr_32.txt @@ -1,4 +1,4 @@ -*usr_32.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_32.txt* For Vim version 8.1. Last change: 2010 Jul 20 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_40.txt b/runtime/doc/usr_40.txt index 9d706481df..151c4e6eed 100644 --- a/runtime/doc/usr_40.txt +++ b/runtime/doc/usr_40.txt @@ -1,4 +1,4 @@ -*usr_40.txt* For Vim version 7.4. Last change: 2013 Aug 05 +*usr_40.txt* For Vim version 8.1. Last change: 2013 Aug 05 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f30b79a2ea..f891f441cf 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.4. Last change: 2014 May 28 +*usr_41.txt* For Vim version 8.1. Last change: 2018 Apr 11 VIM USER MANUAL - by Bram Moolenaar @@ -95,7 +95,7 @@ Then there is the ":let i += 1" command. This does the same thing as to the same variable. The example was given to explain the commands, but would you really want to -make such a loop it can be written much more compact: > +make such a loop, it can be written much more compact: > :for i in range(1, 4) : echo "count is" i @@ -592,6 +592,7 @@ String manipulation: *string-functions* match() position where a pattern matches in a string matchend() position where a pattern match ends in a string matchstr() match of a pattern in a string + matchstrpos() match and positions of a pattern in a string matchlist() like matchstr() and also return submatches stridx() first index of a short string in a long string strridx() last index of a short string in a long string @@ -601,13 +602,16 @@ String manipulation: *string-functions* strdisplaywidth() size of string when displayed, deals with tabs substitute() substitute a pattern match with a string submatch() get a specific match in ":s" and substitute() - strpart() get part of a string + strpart() get part of a string using byte index + strcharpart() get part of a string using char index + strgetchar() get character from a string using char index expand() expand special keywords iconv() convert text from one encoding to another byteidx() byte index of a character in a string byteidxcomp() like byteidx() but count composing characters repeat() repeat a string multiple times eval() evaluate a string expression + execute() execute an Ex command and get the output List manipulation: *list-functions* get() get an item without error for wrong index @@ -677,6 +681,7 @@ Floating point computation: *float-functions* sinh() hyperbolic sine cosh() hyperbolic cosine tanh() hyperbolic tangent + isnan() check for not a number Other computation: *bitwise-function* and() bitwise AND @@ -688,6 +693,7 @@ Other computation: *bitwise-function* Variables: *var-functions* type() type of a variable islocked() check if a variable is locked + funcref() get a Funcref for a function reference function() get a Funcref for a function name getbufvar() get a variable value from a specific buffer setbufvar() set a variable in a specific buffer @@ -731,11 +737,14 @@ Working with text in the current buffer: *text-functions* searchpair() find the other end of a start/skip/end searchpairpos() find the other end of a start/skip/end searchdecl() search for the declaration of a name + getcharsearch() return character search information + setcharsearch() set character search information *system-functions* *file-functions* System functions and manipulation of files: glob() expand wildcards globpath() expand wildcards in a number of directories + glob2regpat() convert a glob pattern into a search pattern findfile() find a file in a list of directories finddir() find a directory in a list of directories resolve() find out where a shortcut points to @@ -747,6 +756,7 @@ System functions and manipulation of files: filereadable() check if a file can be read filewritable() check if a file can be written to getfperm() get the permissions of a file + setfperm() set the permissions of a file getftype() get the kind of a file isdirectory() check if a directory exists getfsize() get the size of a file @@ -768,6 +778,7 @@ Date and Time: *date-functions* *time-functions* strftime() convert time to a string reltime() get the current or elapsed time accurately reltimestr() convert reltime() result to a string + reltimefloat() convert reltime() result to a Float *buffer-functions* *window-functions* *arg-functions* Buffers, windows and the argument list: @@ -784,15 +795,28 @@ Buffers, windows and the argument list: tabpagenr() get the number of a tab page tabpagewinnr() like winnr() for a specified tab page winnr() get the window number for the current window + bufwinid() get the window ID of a specific buffer bufwinnr() get the window number of a specific buffer winbufnr() get the buffer number of a specific window getbufline() get a list of lines from the specified buffer + win_findbuf() find windows containing a buffer + win_getid() get window ID of a window + win_gotoid() go to window with ID + win_id2tabwin() get tab and window nr from window ID + win_id2win() get window nr from window ID + getbufinfo() get a list with buffer information + gettabinfo() get a list with tab page information + getwininfo() get a list with window information + getchangelist() get a list of change list entries + getjumplist() get a list of jump list entries Command line: *command-line-functions* getcmdline() get the current command line getcmdpos() get position of the cursor in the command line setcmdpos() set position of the cursor in the command line getcmdtype() return the current command-line type + getcmdwintype() return the current command-line window type + getcompletion() list of command-line completion matches Quickfix and location lists: *quickfix-functions* getqflist() list of quickfix errors @@ -861,11 +885,15 @@ Interactive: *interactive-functions* GUI: *gui-functions* getfontname() get name of current font being used - getwinposx() X position of the GUI Vim window - getwinposy() Y position of the GUI Vim window + getwinpos() position of the Vim window + getwinposx() X position of the Vim window + getwinposy() Y position of the Vim window + balloon_show() set the balloon content + balloon_split() split a message for a balloon Vim server: *server-functions* serverlist() return the list of server names + remote_startserver() run a server remote_send() send command characters to a Vim server remote_expr() evaluate an expression in a Vim server server2client() send a reply to a client of a Vim server @@ -877,6 +905,7 @@ Vim server: *server-functions* Window size and position: *window-size-functions* winheight() get height of a specific window winwidth() get width of a specific window + win_screenpos() get screen position of a window winrestcmd() return command to restore window sizes winsaveview() get view of current window winrestview() restore saved view of current window @@ -887,6 +916,88 @@ Mappings: *mapping-functions* maparg() get rhs of a mapping wildmenumode() check if the wildmode is active +Testing: *test-functions* + assert_equal() assert that two expressions values are equal + assert_notequal() assert that two expressions values are not equal + assert_inrange() assert that an expression is inside a range + assert_match() assert that a pattern matches the value + assert_notmatch() assert that a pattern does not match the value + assert_false() assert that an expression is false + assert_true() assert that an expression is true + assert_exception() assert that a command throws an exception + assert_beeps() assert that a command beeps + assert_fails() assert that a command fails + assert_report() report a test failure + test_alloc_fail() make memory allocation fail + test_autochdir() enable 'autochdir' during startup + test_override() test with Vim internal overrides + test_garbagecollect_now() free memory right now + test_ignore_error() ignore a specific error message + test_null_channel() return a null Channel + test_null_dict() return a null Dict + test_null_job() return a null Job + test_null_list() return a null List + test_null_partial() return a null Partial function + test_null_string() return a null String + test_settime() set the time Vim uses internally + +Inter-process communication: *channel-functions* + ch_canread() check if there is something to read + ch_open() open a channel + ch_close() close a channel + ch_close_in() close the in part of a channel + ch_read() read a message from a channel + ch_readraw() read a raw message from a channel + ch_sendexpr() send a JSON message over a channel + ch_sendraw() send a raw message over a channel + ch_evalexpr() evaluates an expression over channel + ch_evalraw() evaluates a raw string over channel + ch_status() get status of a channel + ch_getbufnr() get the buffer number of a channel + ch_getjob() get the job associated with a channel + ch_info() get channel information + ch_log() write a message in the channel log file + ch_logfile() set the channel log file + ch_setoptions() set the options for a channel + json_encode() encode an expression to a JSON string + json_decode() decode a JSON string to Vim types + js_encode() encode an expression to a JSON string + js_decode() decode a JSON string to Vim types + +Jobs: *job-functions* + job_start() start a job + job_stop() stop a job + job_status() get the status of a job + job_getchannel() get the channel used by a job + job_info() get information about a job + job_setoptions() set options for a job + +Terminal window: *terminal-functions* + term_start() open a terminal window and run a job + term_list() get the list of terminal buffers + term_sendkeys() send keystrokes to a terminal + term_wait() wait for screen to be updated + term_getjob() get the job associated with a terminal + term_scrape() get row of a terminal screen + term_getline() get a line of text from a terminal + term_getattr() get the value of attribute {what} + term_getcursor() get the cursor position of a terminal + term_getscrolled() get the scroll count of a terminal + term_getaltscreen() get the alternate screen flag + term_getsize() get the size of a terminal + term_getstatus() get the status of a terminal + term_gettitle() get the title of a terminal + term_gettty() get the tty name of a terminal + term_setansicolors() set 16 ANSI colors, used for GUI + term_getansicolors() get 16 ANSI colors, used for GUI + +Timers: *timer-functions* + timer_start() create a timer + timer_pause() pause or unpause a timer + timer_stop() stop a timer + timer_stopall() stop all timers + timer_info() get information about timers + Various: *various-functions* mode() get current editing mode visualmode() last visual mode used @@ -907,16 +1018,22 @@ Various: *various-functions* getreg() get contents of a register getregtype() get type of a register setreg() set contents and type of a register + reg_executing() return the name of the register being executed + reg_recording() return the name of the register being recorded shiftwidth() effective value of 'shiftwidth' + wordcount() get byte/word/char count of buffer + taglist() get list of matching tags tagfiles() get a list of tags files luaeval() evaluate Lua expression mzeval() evaluate |MzScheme| expression + perleval() evaluate Perl expression (|+perl|) py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) + pyxeval() evaluate |python_x| expression ============================================================================== *41.7* Defining a function @@ -1384,9 +1501,9 @@ Now we can instantiate a Dutch translation object: > And a German translator: > :let uk2de = copy(transdict) - :let uk2de.words = {'one': 'ein', 'two': 'zwei', 'three': 'drei'} + :let uk2de.words = {'one': 'eins', 'two': 'zwei', 'three': 'drei'} :echo uk2de.translate('three one') -< drei ein ~ +< drei eins ~ You see that the copy() function is used to make a copy of the "transdict" Dictionary and then the copy is changed to add the words. The original @@ -1504,7 +1621,7 @@ WHITE SPACE Blank lines are allowed and ignored. Leading whitespace characters (blanks and TABs) are always ignored. The -whitespaces between parameters (e.g. between the 'set' and the 'cpoptions' in +whitespaces between parameters (e.g. between the "set" and the "cpoptions" in the example below) are reduced to one blank character and plays the role of a separator, the whitespaces after the last (visible) character may or may not be ignored depending on the situation, see below. @@ -2187,8 +2304,8 @@ plugin for the mail filetype: > endif Two global variables are used: -no_plugin_maps disables mappings for all filetype plugins -no_mail_maps disables mappings for a specific filetype +|no_plugin_maps| disables mappings for all filetype plugins +|no_mail_maps| disables mappings for the "mail" filetype USER COMMANDS @@ -2219,7 +2336,7 @@ This construct makes sure the function is only defined once: > :endif < -UNDO *undo_ftplugin* +UNDO *undo_indent* *undo_ftplugin* When the user does ":setfiletype xyz" the effect of the previous filetype should be undone. Set the b:undo_ftplugin variable to the commands that will @@ -2234,6 +2351,9 @@ global value. That is mostly the best way to reset the option value. This does require removing the "C" flag from 'cpoptions' to allow line continuation, as mentioned above |use-cpo-save|. +For undoing the effect of an indent script, the b:undo_indent variable should +be set accordingly. + FILE NAME diff --git a/runtime/doc/usr_42.txt b/runtime/doc/usr_42.txt index 1d16112aa0..1e187e9496 100644 --- a/runtime/doc/usr_42.txt +++ b/runtime/doc/usr_42.txt @@ -1,4 +1,4 @@ -*usr_42.txt* For Vim version 7.4. Last change: 2008 May 05 +*usr_42.txt* For Vim version 8.1. Last change: 2008 May 05 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_43.txt b/runtime/doc/usr_43.txt index 6eaa9c14a5..331f5b8d47 100644 --- a/runtime/doc/usr_43.txt +++ b/runtime/doc/usr_43.txt @@ -1,4 +1,4 @@ -*usr_43.txt* For Vim version 7.4. Last change: 2008 Dec 28 +*usr_43.txt* For Vim version 8.1. Last change: 2015 Oct 23 VIM USER MANUAL - by Bram Moolenaar @@ -46,6 +46,7 @@ three-line comment. You do this with only two steps: setlocal softtabstop=4 noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc> + let b:undo_ftplugin = "setl softtabstop< | unmap <buffer> <LocalLeader>c" Try editing a C file. You should notice that the 'softtabstop' option is set to 4. But when you edit another file it's reset to the default zero. That is @@ -60,6 +61,11 @@ buffer. This works with any mapping command: ":map!", ":vmap", etc. The |<LocalLeader>| in the mapping is replaced with the value of the "maplocalleader" variable. +The line to set b:undo_ftplugin is for when the filetype is set to another +value. In that case you will want to undo your preferences. The +b:undo_ftplugin variable is executed as a command. Watch out for characters +with a special meaning inside a string, such as a backslash. + You can find examples for filetype plugins in this directory: > $VIMRUNTIME/ftplugin/ diff --git a/runtime/doc/usr_44.txt b/runtime/doc/usr_44.txt index 48f661eb07..b6f37e2d3f 100644 --- a/runtime/doc/usr_44.txt +++ b/runtime/doc/usr_44.txt @@ -1,4 +1,4 @@ -*usr_44.txt* For Vim version 7.4. Last change: 2008 Dec 28 +*usr_44.txt* For Vim version 8.1. Last change: 2017 May 06 VIM USER MANUAL - by Bram Moolenaar @@ -686,7 +686,7 @@ that included files do this too, you might have to reset "b:current_syntax" if you include two files. If you want your syntax file to work with Vim 5.x, add a check for v:version. -See yacc.vim for an example. +Find an syntax file in the Vim 7.2 distribution for an example. Do not include anything that is a user preference. Don't set 'tabstop', 'expandtab', etc. These belong in a filetype plugin. diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt index 828ea6fe2d..e7844a8e91 100644 --- a/runtime/doc/usr_45.txt +++ b/runtime/doc/usr_45.txt @@ -1,4 +1,4 @@ -*usr_45.txt* For Vim version 7.4. Last change: 2008 Nov 15 +*usr_45.txt* For Vim version 8.1. Last change: 2008 Nov 15 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_90.txt b/runtime/doc/usr_90.txt index 38e5886fa0..5ecba60152 100644 --- a/runtime/doc/usr_90.txt +++ b/runtime/doc/usr_90.txt @@ -1,4 +1,4 @@ -*usr_90.txt* For Vim version 7.4. Last change: 2008 Sep 10 +*usr_90.txt* For Vim version 8.1. Last change: 2008 Sep 10 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt index d98a999aa4..6a6543d1a3 100644 --- a/runtime/doc/usr_toc.txt +++ b/runtime/doc/usr_toc.txt @@ -1,4 +1,4 @@ -*usr_toc.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_toc.txt* For Vim version 8.1. Last change: 2016 Mar 25 VIM USER MANUAL - by Bram Moolenaar @@ -104,10 +104,11 @@ Read this from start to end to learn the essential commands. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings - |05.4| Adding a plugin - |05.5| Adding a help file - |05.6| The option window - |05.7| Often used options + |05.4| Adding a package + |05.5| Adding a plugin + |05.6| Adding a help file + |05.7| The option window + |05.8| Often used options |usr_06.txt| Using syntax highlighting |06.1| Switching it on diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 2bdfeeb73a..7c8f3111c1 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2014 May 22 +*various.txt* For Vim version 8.1. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -40,23 +40,35 @@ CTRL-L Clear and redraw the screen. The redraw may happen :as[cii] or *ga* *:as* *:ascii* ga Print the ascii value of the character under the - cursor in decimal, hexadecimal and octal. For - example, when the cursor is on a 'R': + cursor in decimal, hexadecimal and octal. + Mnemonic: Get Ascii value. + + For example, when the cursor is on a 'R': <R> 82, Hex 52, Octal 122 ~ When the character is a non-standard ASCII character, but printable according to the 'isprint' option, the - non-printable version is also given. When the - character is larger than 127, the <M-x> form is also - printed. For example: + non-printable version is also given. + + When the character is larger than 127, the <M-x> form + is also printed. For example: <~A> <M-^A> 129, Hex 81, Octal 201 ~ <p> <|~> <M-~> 254, Hex fe, Octal 376 ~ (where <p> is a special character) + The <Nul> character in a file is stored internally as <NL>, but it will be shown as: <^@> 0, Hex 00, Octal 000 ~ + If the character has composing characters these are also shown. The value of 'maxcombine' doesn't matter. - Mnemonic: Get Ascii value. {not in Vi} + + If the character can be inserted as a digraph, also + output the two characters that can be used to create + the character: + <ö> 246, Hex 00f6, Oct 366, Digr o: ~ + This shows you can type CTRL-K o : to insert ö. + + {not in Vi} *g8* g8 Print the hex values of the bytes used in the @@ -91,6 +103,8 @@ g8 Print the hex values of the bytes used in the on paper see |:hardcopy|. In the GUI you can use the File.Print menu entry. See |ex-flags| for [flags]. + The |:filter| command can be used to only show lines + matching a pattern. :[range]p[rint] {count} [flags] Print {count} lines, starting with [range] (default @@ -208,8 +222,6 @@ g8 Print the hex values of the bytes used in the Example: > :exe "normal \<c-w>\<c-w>" < {not in Vi, of course} - {not available when the |+ex_extra| feature was - disabled at compile time} :{range}norm[al][!] {commands} *:normal-range* Execute Normal mode commands {commands} for each line @@ -218,8 +230,6 @@ g8 Print the hex values of the bytes used in the for each line. Otherwise it's the same as the ":normal" command without a range. {not in Vi} - {not available when |+ex_extra| feature was disabled - at compile time} *:sh* *:shell* *E371* :sh[ell] This command starts a shell. When the shell exits @@ -296,7 +306,7 @@ g8 Print the hex values of the bytes used in the Here is an overview of the features. The first column shows the smallest version in which they are included: - T tiny + T tiny (always) S small N normal B big @@ -310,26 +320,31 @@ g8 Print the hex values of the bytes used in the *+acl* |ACL| support included *+ARP* Amiga only: ARP support included B *+arabic* |Arabic| language support -N *+autocmd* |:autocmd|, automatic commands -m *+balloon_eval* |balloon-eval| support. Included when compiling with - supported GUI (Motif, GTK, GUI) and either - Netbeans/Sun Workshop integration or |+eval| feature. +T *+autocmd* |:autocmd|, automatic commands +H *+autoservername* Automatically enable |clientserver| +m *+balloon_eval* |balloon-eval| support in the GUI. Included when + compiling with supported GUI (Motif, GTK, GUI) and + either Netbeans/Sun Workshop integration or |+eval| + feature. +H *+balloon_eval_term* |balloon-eval| support in the terminal, + 'balloonevalterm' N *+browse* |:browse| command N *+builtin_terms* some terminals builtin |builtin-terms| B *++builtin_terms* maximal terminals builtin |builtin-terms| N *+byte_offset* support for 'o' flag in 'statusline' option, "go" and ":goto" commands. +m *+channel* inter process communication |channel| N *+cindent* |'cindent'|, C indenting N *+clientserver* Unix and Win32: Remote invocation |clientserver| *+clipboard* |clipboard| support N *+cmdline_compl* command line completion |cmdline-completion| -N *+cmdline_hist* command line history |cmdline-history| +S *+cmdline_hist* command line history |cmdline-history| N *+cmdline_info* |'showcmd'| and |'ruler'| N *+comments* |'comments'| support B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc. N *+cryptv* encryption support |encryption| B *+cscope* |cscope| support -m *+cursorbind* |'cursorbind'| support +T *+cursorbind* |'cursorbind'| support m *+cursorshape* |termcap-cursor-shape| support m *+debug* Compiled for debugging. N *+dialog_gui* Support for |:confirm| with GUI dialog. @@ -337,11 +352,11 @@ N *+dialog_con* Support for |:confirm| with console dialog. N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. N *+diff* |vimdiff| and 'diff' N *+digraphs* |digraphs| *E196* + *+directx* Win32 GUI only: DirectX and |'renderoptions'| *+dnd* Support for DnD into the "~ register |quote_~|. B *+emacs_tags* |emacs-tags| files N *+eval* expression evaluation |eval.txt| -N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|, - |:normal|, |:retab| and |:right| +N *+ex_extra* always on now, used to be for Vim's extra Ex commands N *+extra_search* |'hlsearch'| and |'incsearch'| options. B *+farsi* |farsi| language N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>| @@ -351,7 +366,6 @@ N *+folding* |folding| *+footer* |gui-footer| *+fork* Unix only: |fork| shell commands *+float* Floating point support -m *+fullscreen* MacVim only: edit in full-screen N *+gettext* message translations |multi-lang| *+GUI_Athena* Unix only: Athena |GUI| *+GUI_neXtaw* Unix only: neXtaw |GUI| @@ -362,13 +376,15 @@ m *+hangul_input* Hangul input support |hangul| *+iconv* Compiled with the |iconv()| function *+iconv/dyn* Likewise |iconv-dynamic| |/dyn| N *+insert_expand* |insert_expand| Insert mode completion -N *+jumplist* |jumplist| +m *+job* starting and stopping jobs |job| +S *+jumplist* |jumplist| B *+keymap* |'keymap'| +N *+lambda* |lambda| and |closure| B *+langmap* |'langmap'| N *+libcall* |libcall()| N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'| N *+lispindent* |'lisp'| -N *+listcmds* Vim commands for the list of buffers |buffer-hidden| +T *+listcmds* Vim commands for the list of buffers |buffer-hidden| and argument list |:argdelete| N *+localmap* Support for mappings local to a buffer |:map-local| m *+lua* |Lua| interface @@ -393,8 +409,9 @@ N *+multi_lang* non-English language support |multi-lang| m *+mzscheme* Mzscheme interface |mzscheme| m *+mzscheme/dyn* Mzscheme interface |mzscheme-dynamic| |/dyn| m *+netbeans_intg* |netbeans| -m *+odbeditor* MacVim only: ODB Editor Protocol support |odbeditor| + *+num64* 64-bit Number support |Number| m *+ole* Win32 GUI only: |ole-interface| +N *+packages* Loading |packages| N *+path_extra* Up/downwards search in 'path' and 'tags' m *+perl* Perl interface |perl| m *+perl/dyn* Perl interface |perl-dynamic| |/dyn| @@ -412,38 +429,42 @@ N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout, B *+rightleft* Right to left typing |'rightleft'| m *+ruby* Ruby interface |ruby| m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn| -N *+scrollbind* |'scrollbind'| +T *+scrollbind* |'scrollbind'| B *+signs* |:sign| N *+smartindent* |'smartindent'| -m *+sniff* SniFF interface |sniff| N *+startuptime* |--startuptime| argument N *+statusline* Options 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring' m *+sun_workshop* |workshop| N *+syntax* Syntax highlighting |syntax| *+system()* Unix only: opposite of |+fork| -N *+tag_binary* binary searching in tags file |tag-binary-search| +T *+tag_binary* binary searching in tags file |tag-binary-search| N *+tag_old_static* old method for static tags |tag-old-static| m *+tag_any_white* any white space allowed in tags file |tag-any-white| m *+tcl* Tcl interface |tcl| m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn| +m *+terminal* Support for terminal window |terminal| *+terminfo* uses |terminfo| instead of termcap N *+termresponse* support for |t_RV| and |v:termresponse| +B *+termguicolors* 24-bit color in xterm-compatible terminals support N *+textobjects* |text-objects| selection *+tgetent* non-Unix only: able to use external termcap +N *+timers* the |timer_start()| function N *+title* Setting the window 'title' and 'icon' N *+toolbar* |gui-toolbar| -m *+transparency* MacVim only: window background transparency N *+user_commands* User-defined commands. |user-commands| N *+viminfo* |'viminfo'| -N *+vertsplit* Vertically split windows |:vsplit| + *+vertsplit* Vertically split windows |:vsplit|; Always enabled + since 8.0.1118. + in sync with the |+windows| feature N *+virtualedit* |'virtualedit'| S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200. N *+visualextra* extra Visual mode commands |blockwise-operators| N *+vreplace* |gR| and |gr| + *+vtp* on MS-Windows console: support for 'termguicolors' N *+wildignore* |'wildignore'| N *+wildmenu* |'wildmenu'| -S *+windows* more than one window + *+windows* more than one window; Always enabled since 8.0.1118. m *+writebackup* |'writebackup'| is default on m *+xim* X input method |xim| *+xfontset* X fontset support |xfontset| @@ -472,9 +493,12 @@ N *+X11* Unix only: can restore window title |X11| shown on the screen. When [!] is included, an existing file is overwritten. When [!] is omitted, and {file} exists, this command fails. + Only one ":redir" can be active at a time. Calls to ":redir" will close any active redirection before - starting redirection to the new target. + starting redirection to the new target. For recursive + use check out |execute()|. + To stop the messages and commands from being echoed to the screen, put the commands in a function and call it with ":silent call Function()". @@ -514,13 +538,38 @@ N *+X11* Unix only: can restore window title |X11| redirection starts, if the variable is removed or locked or the variable type is changed, then further command output messages will cause errors. {not in Vi} + To get the output of one command the |execute()| + function can be used. :redi[r] =>> {var} Append messages to an existing variable. Only string variables can be used. {not in Vi} :redi[r] END End redirecting messages. {not in Vi} - *:sil* *:silent* + *:filt* *:filter* +:filt[er][!] {pat} {command} +:filt[er][!] /{pat}/ {command} + Restrict the output of {command} to lines matching + with {pat}. For example, to list only xml files: > + :filter /\.xml$/ oldfiles +< If the [!] is given, restrict the output of {command} + to lines that do NOT match {pat}. + + {pat} is a Vim search pattern. Instead of enclosing + it in / any non-ID character (see |'isident'|) can be + used, so long as it does not appear in {pat}. Without + the enclosing character the pattern cannot include the + bar character. + + The pattern is matched against the relevant part of + the output, not necessarily the whole line. Only some + commands support filtering, try it out to check if it + works. + + Only normal messages are filtered, error messages are + not. + + *:sil* *:silent* *:silent!* :sil[ent][!] {command} Execute {command} silently. Normal messages will not be given or added to the message history. When [!] is added, error messages will also be @@ -607,16 +656,19 @@ K Run a program to lookup the keyword under the with the command > :!{program} {keyword} < There is an example of a program to use in the tools - directory of Vim. It is called 'ref' and does a + directory of Vim. It is called "ref" and does a simple spelling check. Special cases: + - If 'keywordprg' begins with ":" it is invoked as + a Vim Ex command with [count]. - If 'keywordprg' is empty, the ":help" command is used. It's a good idea to include more characters in 'iskeyword' then, to be able to find more help. - - When 'keywordprg' is equal to "man", a count before - "K" is inserted after the "man" command and before - the keyword. For example, using "2K" while the - cursor is on "mkdir", results in: > + - When 'keywordprg' is equal to "man" or starts with + ":", a [count] before "K" is inserted after + keywordprg and before the keyword. For example, + using "2K" while the cursor is on "mkdir", results + in: > !man 2 mkdir < - When 'keywordprg' is equal to "man -s", a count before "K" is inserted after the "-s". If there is @@ -649,6 +701,7 @@ K Run a program to lookup the keyword under the g CTRL-A Only when Vim was compiled with MEM_PROFILING defined (which is very rare): print memory usage statistics. Only useful for debugging Vim. + For incrementing in Visual mode see |v_g_CTRL-A|. ============================================================================== 2. Using Vim like less or more *less* @@ -667,4 +720,12 @@ highlighting. The "h" key will give you a short overview of the available commands. +If you want to set options differently when using less, define the +LessInitFunc in your vimrc, for example: > + + func LessInitFunc() + set nocursorcolumn nocursorline + endfunc +< + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/version4.txt b/runtime/doc/version4.txt index 6b791be88b..3990a4b1b9 100644 --- a/runtime/doc/version4.txt +++ b/runtime/doc/version4.txt @@ -1,4 +1,4 @@ -*version4.txt* For Vim version 7.4. Last change: 2006 Apr 24 +*version4.txt* For Vim version 8.1. Last change: 2006 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/version5.txt b/runtime/doc/version5.txt index 1cc6a25597..a3e3cfeb14 100644 --- a/runtime/doc/version5.txt +++ b/runtime/doc/version5.txt @@ -1,4 +1,4 @@ -*version5.txt* For Vim version 7.4. Last change: 2012 Aug 08 +*version5.txt* For Vim version 8.1. Last change: 2016 Feb 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -848,7 +848,7 @@ putting a backslash before it. |+cmd| After recovery, BufReadPost autocommands are applied. |:recover| -Added color support for "os2ansi", OS/2 console. (Slootman) |os2ansi| +Added color support for "os2ansi", OS/2 console. (Slootman) Allow "%:p:h" when % is empty. |:_%| @@ -934,7 +934,7 @@ Don't add "-L/usr/lib" to the link line, causes problems on a few systems. When compiling, allow a choice for minimal, normal or maximal features in an easy way, by changing a single line in src/feature.h. The DOS16 version has been compiled with minimal features to avoid running -out of memory too quickly. |dos16| +out of memory too quickly. The Win32, DJGPP, and OS/2 versions use maximal features, because they have enough memory. The Amiga version is available with normal and maximal features. diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt index f18fea8705..053160dbc5 100644 --- a/runtime/doc/version6.txt +++ b/runtime/doc/version6.txt @@ -1,4 +1,4 @@ -*version6.txt* For Vim version 7.4. Last change: 2013 Jul 28 +*version6.txt* For Vim version 8.1. Last change: 2018 Mar 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -886,7 +886,7 @@ Adjusted test2 for this. Allow using a URL in 'path'. Makes ":find index.html" work. GTK: Allow dropping a http:// and ftp:// URL on Vim. The netrw plugin takes -care of downloading the file. (MiKael Berthe) +care of downloading the file. (Mikael Berthe) Window for command-line editing *new-cmdwin* @@ -5388,7 +5388,7 @@ Files: src/os_win32.c Patch 6.0.256 (extra) Problem: Win32: ":highlight Comment guifg=asdf" does not give an error - message. (Randall W. Morris) Also for other systems. + message. (Randall W. Morris) Also for other systems. Solution: Add gui_get_color() to give one error message for all systems. Files: src/gui.c, src/gui_amiga.c, src/gui_athena.c, src/gui_motif.c, src/gui_riscos.c, src/gui_x11.c, src/gui_gtk_x11.c, @@ -6103,7 +6103,7 @@ New tutor translations: Slovak (Lubos Celko) Greek (Christos Kontas) German (Joachim Hofmann) - Norwegian (yvind Holm) + Norwegian (Øyvind Holm) New filetype plugins: Occam (Mario Schweigler) @@ -6121,13 +6121,13 @@ New compiler plugins: Modelsim vcom (Paul Baleme) New menu translations: - Brazilian (Jos de Paula) + Brazilian (José de Paula) British (Mike Williams) Korean in UTF-8. (Nam SungHyun) - Norwegian (yvind Holm) + Norwegian (Øyvind Holm) Serbian (Aleksandar Jelenak) -New message translation for Norwegian. (yvind Holm) +New message translation for Norwegian. (Øyvind Holm) New color scheme: desert (Hans Fugal) @@ -7816,7 +7816,7 @@ Files: src/buffer.c, src/eval.c, src/ex_docmd.c, src/fileio.c, Patch 6.1.212 Problem: When Vim was started with "-R" ":new" creates a buffer 'noreadonly' while ":enew" has 'readonly' set. (Preben Guldberg) -Solution: Don't set 'readonly in a new empty buffer for ":enew". +Solution: Don't set 'readonly' in a new empty buffer for ":enew". Files: src/ex_docmd.c Patch 6.1.213 @@ -9955,7 +9955,7 @@ Use "copy /y" in Make_bc5.mak to avoid a prompt for overwriting. Patch 6.2.001 Problem: The ":stopinsert" command doesn't have a help tag. -Solution: Add the tag. (Antoine J. Mechelynck) +Solution: Add the tag. (Antoine J. Mechelynck) Files: runtime/doc/insert.txt, runtime/doc/tags Patch 6.2.002 @@ -10066,7 +10066,7 @@ Files: src/os_unix.c Patch 6.2.019 (lang) Problem: Loading the Portuguese menu causes an error message. -Solution: Join two lines. (Jose Pedro Oliveira, Jos de Paula) +Solution: Join two lines. (Jose Pedro Oliveira, José de Paula) Files: runtime/lang/menu_pt_br.vim Patch 6.2.020 @@ -12418,7 +12418,7 @@ Files: src/message.c Patch 6.2.376 Problem: Win32: Ruby interface cannot be dynamically linked with Ruby 1.6. -Solution: Add #ifdefs around use of rb_w32_snprintf(). (Benot Cerrina) +Solution: Add #ifdefs around use of rb_w32_snprintf(). (Benoît Cerrina) Files: src/if_ruby.c Patch 6.2.377 (after 6.2.372) @@ -14320,7 +14320,7 @@ Files: src/edit.c Patch 6.3.061 Problem: When editing a utf-8 file in an utf-8 xterm and there is a multi-byte character in the last column, displaying is messed up. - (Jol Rio) + (Joël Rio) Solution: Check for a multi-byte character, not a multi-column character. Files: src/screen.c diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index fe9b9dd0e0..435c8f3841 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.4. Last change: 2013 Nov 18 +*version7.txt* For Vim version 8.1. Last change: 2016 Jul 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -931,7 +931,7 @@ New and extended functions: ~ |spellbadword()| get a badly spelled word |spellsuggest()| get suggestions for correct spelling |split()| split a String into a List -|str2nr()| convert a string to a number, base 8, 10 or 16 +|str2nr()| convert a string to a number, base 2, 8, 10 or 16 |stridx()| extra argument: start position |strridx()| extra argument: start position |string()| string representation of a List or Dictionary @@ -1447,7 +1447,7 @@ g CTRL-G also shows the number of characters if it differs from the number of bytes. Completion for ":debug" and entering an expression for the '=' register. Skip -":" between range and command name. (Peter winters) +":" between range and command name. (Peter Winters) CTRL-Q in Insert mode now works like CTRL-V by default. Previously it was ignored. @@ -1628,10 +1628,10 @@ and merge it back in. When running the tests and one of them fails to produce "test.out" the following tests are still executed. This helps when running out of memory. -When compiling with EXITFREE defined and the ccmalloc library it is possible -to detect memory leaks. Some memory will always reported as leaked, such as -allocated by X11 library functions and the memory allocated in alloc_cmdbuff() -to store the ":quit" command. +When compiling with EXITFREE defined and the ccmalloc library, it is possible +to detect memory leaks. Some memory will always be reported as leaked, such +as allocated by X11 library functions and the memory allocated in +alloc_cmdbuff() to store the ":quit" command. Moved the code for printing to src/hardcopy.c. @@ -1683,7 +1683,7 @@ work. Use "LPT1" then. The GTK font dialog uses a font size zero when the font name doesn't include a size. Use a default size of 10. -This example in the documentation didn't work: +This example in the documentation didn't work: > :e `=foo . ".c"` Skip over the expression in `=expr` when looking for comments, |, % and #. @@ -2040,8 +2040,8 @@ Removed the "COUNT" flag from ":argadd", to avoid ":argadd 1*" to be used like Avoid that $LANG is used for the menus when LC_MESSAGES is "en_US". -Added backslashes before dashes in the vim.1 manual page to make the appear as -real dashes. (Pierr Habouzit) +Added backslashes before dashes in the vim.1 manual page to make them appear +as real dashes. (Pierre Habouzit) Where "gq" left the cursor depended on the value of 'formatprg'. Now "gq" always leaves the cursor at the last line of the formatted text. @@ -2051,7 +2051,7 @@ detection may try to check the contents of the file while it's still compressed. Skip setting 'filetype' for compressed files until they have been decompressed. Required for patterns that end in a "*". -Starting with an argument "+cmd" or "-S script" causes the cursor the be moved +Starting with an argument "+cmd" or "-S script" causes the cursor to be moved to the first line. That breaks a BufReadPost autocommand that uses g`". Don't move the cursor if it's somewhere past the first line. @@ -3373,7 +3373,7 @@ Files: runtime/scripts.vim Patch 7.0.050 Problem: After using the netbeans interface close command a stale pointer may be used. -Solution: Clear the pointer to the closed buffer. (Xaview de Gaye) +Solution: Clear the pointer to the closed buffer. (Xavier de Gaye) Files: src/netbeans.c Patch 7.0.051 (after 7.0.44) @@ -4028,7 +4028,7 @@ Solution: Check for NULL pointer returned from mch_open(). Files: src/if_cscope.c Patch 7.0.154 -Problem: When 'foldnextmax' is negative Vim can hang. (James Vega) +Problem: When 'foldnestmax' is negative Vim can hang. (James Vega) Solution: Avoid the fold level becoming negative. Files: src/fold.c, src/syntax.c @@ -6487,7 +6487,7 @@ Patch 7.1.282 (extra) Problem: Win64: Edit with Vim context menu isn't installed correctly. Compiler warnings and a few other things. Solution: Add [ and ] to entry of class name. Use UINT_PTR instead of UINT. - And a fixes for the other things. (George V. Reilly) + And fixes for other things. (George V. Reilly) Files: src/GvimExt/Makefile, src/dosinst.c, src/if_ole.cpp, src/if_ole.h, src/if_ole.idl, src/INSTALLpc.txt, src/Make_mvc.mak, src/os_win32.c, @@ -10160,7 +10160,7 @@ an error. Was caused by patch 7.2.132. Make the references to features in the help more consistent. (Sylvain Hitier) ============================================================================== -VERSION 7.4 *version-7.4* *version7.4* +VERSION 7.4 *version-7.4* *version7.4* *vim-7.4* This section is about improvements made between version 7.3 and 7.4. @@ -10204,7 +10204,7 @@ objects in place of `str()` ones avoiding possibility of UnicodeDecodeError. interfaces to some extent. Extent will be improved in the future. Added special |python-vars| objects also available for |python-buffer| and -|python-window|. They ease access to VimL variables from Python. +|python-window|. They ease access to Vim script variables from Python. Now you no longer need to alter `sys.path` to import your module: special hooks are responsible for importing from {rtp}/python2, {rtp}/python3 and @@ -15785,7 +15785,7 @@ Files: src/if_py_both.h, src/if_python3.c, src/testdir/test86.in, src/testdir/test87.ok Patch 7.3.944 -Problem: External program receives the termrespone. +Problem: External program receives the termresponse. Solution: Insert a delay and discard input. (Hayaki Saito) Files: src/term.c @@ -16274,7 +16274,7 @@ Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok Patch 7.3.1026 Problem: New regexp: pattern that includes a new-line matches too early. - (john McGowan) + (John McGowan) Solution: Do not start searching in the second line. Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok @@ -18310,4 +18310,5 @@ Solution: Subtract the unsigned numbers and cast to int. (Ken Takata) Files: src/os_win32.c + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt new file mode 100644 index 0000000000..f9096bc54f --- /dev/null +++ b/runtime/doc/version8.txt @@ -0,0 +1,25795 @@ +*version8.txt* For Vim version 8.1. Last change: 2018 May 17 + + + VIM REFERENCE MANUAL by Bram Moolenaar + + + *vim8* *vim-8* *version-8.0* *version8.0* +Welcome to Vim 8! A large number of bugs have been fixed and several nice +features have been added. This file mentions all the new items and changes to +existing features since Vim 7.4. The patches up to Vim 7.4 can be found here: +|vim-7.4|. + +Use this command to see the full version and features information of the Vim +program you are using: > + :version + +NEW FEATURES |new-8| + Vim script enhancements |new-vim-script-8| + Various new items |new-items-8| + +INCOMPATIBLE CHANGES |incompatible-8| + +IMPROVEMENTS |improvements-8| + +COMPILE TIME CHANGES |compile-changes-8| + +PATCHES |patches-8| + +VERSION 8.1 |version-8.1| +Changed |changed-8.1| +Added |added-8.1| +Patches |patches-8.1| + + +See |vi_diff.txt| for an overview of differences between Vi and Vim 8.0. +See |version4.txt|, |version5.txt|, |version6.txt| and |version7.txt| for +differences between other versions. + +============================================================================== +NEW FEATURES *new-8* + +First an overview of the more interesting new features. A comprehensive list +is below. + + +Asynchronous I/O support, channels ~ + +Vim can now exchange messages with other processes in the background. This +makes it possible to have servers do work and send back the results to Vim. +See |channel-demo| for an example, this shows communicating with a Python +server. + +Closely related to channels is JSON support. JSON is widely supported and can +easily be used for inter-process communication, allowing for writing a server +in any language. The functions to use are |json_encode()| and |json_decode()|. + +This makes it possible to build very complex plugins, written in any language +and running in a separate process. + + +Jobs ~ + +Vim can now start a job, communicate with it and stop it. This is very useful +to run a process for completion, syntax checking, etc. Channels are used to +communicate with the job. Jobs can also read from or write to a buffer or a +file. See |job_start()|. + + +Timers ~ + +Also asynchronous are timers. They can fire once or repeatedly and invoke a +function to do any work. For example: > + let tempTimer = timer_start(4000, 'CheckTemp') +This will call the CheckTemp() function four seconds (4000 milli seconds) +later. See |timer_start()|. + + +Partials ~ + +Vim already had a Funcref, a reference to a function. A partial also refers +to a function, and additionally binds arguments and/or a dictionary. This is +especially useful for callbacks on channels and timers. E.g., for the timer +example above, to pass an argument to the function: > + let tempTimer = timer_start(4000, function('CheckTemp', ['out'])) +This will call CheckTemp('out') four seconds later. + + +Lambda and Closure ~ + +A short way to create a function has been added: {args -> expr}. See |lambda|. +This is useful for functions such as `filter()` and `map()`, which now also +accept a function argument. Example: > + :call filter(mylist, {idx, val -> val > 20}) + +A lambda can use variables defined in the scope where the lambda is defined. +This is usually called a |closure|. + +User defined functions can also be a closure by adding the "closure" argument +|:func-closure|. + + +Packages ~ + +Plugins keep growing and more of them are available than ever before. To keep +the collection of plugins manageable package support has been added. This is +a convenient way to get one or more plugins, drop them in a directory and +possibly keep them updated. Vim will load them automatically, or only when +desired. See |packages|. + + +New style tests ~ + +This is for Vim developers. So far writing tests for Vim has not been easy. +Vim 8 adds assert functions and a framework to run tests. This makes it a lot +simpler to write tests and keep them updated. Also new are several functions +that are added specifically for testing. See |test-functions|. + + +Window IDs ~ + +Previously windows could only be accessed by their number. And every time a +window would open, close or move that number changes. Each window now has a +unique ID, so that they are easy to find. See |win_getid()| and |win_id2win()|. + + +Viminfo uses timestamps ~ + +Previously the information stored in viminfo was whatever the last Vim wrote +there. Now timestamps are used to always keep the most recent items. +See |viminfo-timestamp|. + + +Wrapping lines with indent ~ + +The 'breakindent' option has been added to be able to wrap lines without +changing the amount of indent. + + +Windows: DirectX support ~ + +This adds the 'renderoptions' option to allow for switching on DirectX +(DirectWrite) support on MS-Windows. + + +GTK+ 3 support ~ + +The GTK+ 3 GUI works just like GTK+ 2 except for hardly noticeable technical +differences between them. Configure still chooses GTK+ 2 if both 2 and 3 are +available. See src/Makefile for how to use GTK+ 3 instead. See +|gui-x11-compiling| for other details. + + +Vim script enhancements *new-vim-script-8* +----------------------- + +In Vim script the following types have been added: + + |Special| |v:false|, |v:true|, |v:none| and |v:null| + |Channel| connection to another process for asynchronous I/O + |Job| process control + +Many functions and commands have been added to support the new types. + +On some systems the numbers used in Vim script are now 64 bit. This can be +checked with the |+num64| feature. + +Many items were added to support |new-style-testing|. + +printf() now accepts any type of argument for %s. It is converted to a string +like with string(). + + +Various new items *new-items-8* +----------------- + +Visual mode commands: ~ + +|v_CTRL-A| CTRL-A add N to number in highlighted text +|v_CTRL-X| CTRL-X subtract N from number in highlighted text +|v_g_CTRL-A| g CTRL-A add N to number in highlighted text +|v_g_CTRL-X| g CTRL-X subtract N from number in highlighted text + + +Insert mode commands: ~ + +|i_CTRL-G_U| CTRL-G U don't break undo with next cursor movement + + +Cmdline mode commands: ~ + +|/_CTRL-G| CTRL-G move to the next match in 'incsearch' mode +|/_CTRL-T| CTRL-T move to the previous match in 'incsearch' mode + + +Options: ~ + +'belloff' do not ring the bell for these reasons +'breakindent' wrapped line repeats indent +'breakindentopt' settings for 'breakindent'. +'emoji' emoji characters are considered full width +'fixendofline' make sure last line in file has <EOL> +'langremap' do apply 'langmap' to mapped characters +'luadll' name of the Lua dynamic library +'packpath' list of directories used for packages +'perldll' name of the Perl dynamic library +'pythondll' name of the Python 2 dynamic library +'pythonthreedll' name of the Python 3 dynamic library +'renderoptions' options for text rendering on Windows +'rubydll' name of the Ruby dynamic library +'signcolumn' when to display the sign column +'tagcase' how to handle case when searching in tags files +'tcldll' name of the Tcl dynamic library +'termguicolors' use GUI colors for the terminal + + +Ex commands: ~ + +|:cbottom| scroll to the bottom of the quickfix window +|:cdo| execute command in each valid error list entry +|:cfdo| execute command in each file in error list +|:chistory| display quickfix list stack +|:clearjumps| clear the jump list +|:filter| only output lines that (do not) match a pattern +|:helpclose| close one help window +|:lbottom| scroll to the bottom of the location window +|:ldo| execute command in valid location list entries +|:lfdo| execute command in each file in location list +|:lhistory| display location list stack +|:noswapfile| following commands don't create a swap file +|:packadd| add a plugin from 'packpath' +|:packloadall| load all packages under 'packpath' +|:smile| make the user happy + + +Ex command modifiers: ~ + +|:keeppatterns| following command keeps search pattern history +|<mods>| supply command modifiers to user defined commands + + +New and extended functions: ~ + +|arglistid()| get id of the argument list +|assert_equal()| assert that two expressions values are equal +|assert_exception()| assert that a command throws an exception +|assert_fails()| assert that a function call fails +|assert_false()| assert that an expression is false +|assert_inrange()| assert that an expression is inside a range +|assert_match()| assert that a pattern matches the value +|assert_notequal()| assert that two expressions values are not equal +|assert_notmatch()| assert that a pattern does not match the value +|assert_true()| assert that an expression is true +|bufwinid()| get the window ID of a specific buffer +|byteidxcomp()| like byteidx() but count composing characters +|ch_close()| close a channel +|ch_close_in()| close the in part of a channel +|ch_evalexpr()| evaluates an expression over channel +|ch_evalraw()| evaluates a raw string over channel +|ch_getbufnr()| get the buffer number of a channel +|ch_getjob()| get the job associated with a channel +|ch_info()| get channel information +|ch_log()| write a message in the channel log file +|ch_logfile()| set the channel log file +|ch_open()| open a channel +|ch_read()| read a message from a channel +|ch_readraw()| read a raw message from a channel +|ch_sendexpr()| send a JSON message over a channel +|ch_sendraw()| send a raw message over a channel +|ch_setoptions()| set the options for a channel +|ch_status()| get status of a channel +|execute()| execute an Ex command and get the output +|exepath()| full path of an executable program +|funcref()| return a reference to function {name} +|getbufinfo()| get a list with buffer information +|getcharsearch()| return character search information +|getcmdwintype()| return the current command-line window type +|getcompletion()| return a list of command-line completion matches +|getcurpos()| get position of the cursor +|gettabinfo()| get a list with tab page information +|getwininfo()| get a list with window information +|glob2regpat()| convert a glob pattern into a search pattern +|isnan()| check for not a number +|job_getchannel()| get the channel used by a job +|job_info()| get information about a job +|job_setoptions()| set options for a job +|job_start()| start a job +|job_status()| get the status of a job +|job_stop()| stop a job +|js_decode()| decode a JSON string to Vim types +|js_encode()| encode an expression to a JSON string +|json_decode()| decode a JSON string to Vim types +|json_encode()| encode an expression to a JSON string +|matchaddpos()| define a list of positions to highlight +|matchstrpos()| match and positions of a pattern in a string +|perleval()| evaluate Perl expression +|reltimefloat()| convert reltime() result to a Float +|setcharsearch()| set character search information +|setfperm()| set the permissions of a file +|strcharpart()| get part of a string using char index +|strgetchar()| get character from a string using char index +|systemlist()| get the result of a shell command as a list +|test_alloc_fail()| make memory allocation fail +|test_autochdir()| test 'autochdir' functionality +test_disable_char_avail() test without typeahead (removed later) +|test_garbagecollect_now()| free memory right now +|test_null_channel()| return a null Channel +|test_null_dict()| return a null Dict +|test_null_job()| return a null Job +|test_null_list()| return a null List +|test_null_partial()| return a null Partial function +|test_null_string()| return a null String +|test_settime()| set the time Vim uses internally +|timer_info()| get information about timers +|timer_pause()| pause or unpause a timer +|timer_start()| create a timer +|timer_stop()| stop a timer +|timer_stopall()| stop all timers +|uniq()| remove copies of repeated adjacent items +|win_findbuf()| find windows containing a buffer +|win_getid()| get window ID of a window +|win_gotoid()| go to window with ID +|win_id2tabwin()| get tab and window nr from window ID +|win_id2win()| get window nr from window ID +|wordcount()| get byte/word/char count of buffer + + +New Vim variables: ~ + +|v:beval_winid| Window ID of the window where the mouse pointer is +|v:completed_item| complete items for the most recently completed word +|v:errors| errors found by assert functions +|v:false| a Number with value zero +|v:hlsearch| indicates whether search highlighting is on +|v:mouse_winid| Window ID for a mouse click obtained with |getchar()| +|v:none| an empty String, used for JSON +|v:null| an empty String, used for JSON +|v:option_new| new value of the option, used by |OptionSet| +|v:option_old| old value of the option, used by |OptionSet| +|v:option_type| scope of the set command, used by |OptionSet| +|v:progpath| the command with which Vim was invoked +|v:t_bool| value of Boolean type +|v:t_channel| value of Channel type +|v:t_dict| value of Dictionary type +|v:t_float| value of Float type +|v:t_func| value of Funcref type +|v:t_job| value of Job type +|v:t_list| value of List type +|v:t_none| value of None type +|v:t_number| value of Number type +|v:t_string| value of String type +|v:testing| must be set before using `test_garbagecollect_now()` +|v:true| a Number with value one +|v:vim_did_enter| set just before VimEnter autocommands are triggered + + +New autocommand events: ~ + +|CmdUndefined| a user command is used but it isn't defined +|OptionSet| after setting any option +|TabClosed| after closing a tab page +|TabNew| after creating a new tab page +|TextChangedI| after a change was made to the text in Insert mode +|TextChanged| after a change was made to the text in Normal mode +|WinNew| after creating a new window + + +New highlight groups: ~ + +EndOfBuffer filler lines (~) after the last line in the buffer. + |hl-EndOfBuffer| + + +New items in search patterns: ~ + +|/\%C| \%C match any composing characters + + +New Syntax/Indent/FTplugin files: ~ + +AVR Assembler (Avra) syntax +Arduino syntax +Bazel syntax and indent and ftplugin +Dockerfile syntax and ftplugin +Eiffel ftplugin +Euphoria 3 and 4 syntax +Go syntax and indent and ftplugin +Godoc syntax +Groovy ftplugin +HGcommit ftplugin +Hog indent and ftplugin +Innovation Data Processing upstream.pt syntax +J syntax and indent and ftplugin +Jproperties ftplugin +Json syntax and indent and ftplugin +Kivy syntax +Less syntax and indent +Mix syntax +Motorola S-Record syntax +R ftplugin +ReStructuredText syntax and indent and ftplugin +Registry ftplugin +Rhelp indent and ftplugin +Rmd (markdown with R code chunks) syntax and indent +Rmd ftplugin +Rnoweb ftplugin +Rnoweb indent +Scala syntax and indent and ftplugin +SystemVerilog syntax and indent and ftplugin +Systemd syntax and indent and ftplugin +Teraterm (TTL) syntax and indent +Text ftplugin +Vroom syntax and indent and ftplugin + + +New Keymaps: ~ + +Armenian eastern and western +Russian jcukenwintype +Vietnamese telex and vni + +============================================================================== +INCOMPATIBLE CHANGES *incompatible-8* + +These changes are incompatible with previous releases. Check this list if you +run into a problem when upgrading from Vim 7.4 to 8.0. + + +Better defaults without a vimrc ~ + +When no vimrc file is found, the |defaults.vim| script is loaded to set more +useful default values for new users. That includes setting 'nocompatible'. +Thus Vim no longer starts up in Vi compatible mode. If you do want that, +either create a .vimrc file that does "set compatible" or start Vim with +"vim -C". + + +Support removed ~ + +The support for MS-DOS has been removed. It hasn't been working for a while +(Vim doesn't fit in memory) and removing it cleans up the code quite a bit. + +The support for Windows 16 bit (Windows 95 and older) has been removed. + +The support for OS/2 has been removed. It probably hasn't been working for a +while since nobody uses it. + +The SNiFF+ support has been removed. + + +Minor incompatibilities: ~ + +Probably... + +============================================================================== +IMPROVEMENTS *improvements-8* + +The existing blowfish encryption turned out to be much weaker than it was +supposed to be. The blowfish2 method has been added to fix that. Note that +this still isn't a state-of-the-art encryption, but good enough for most +usage. See 'cryptmethod'. + + +============================================================================== +COMPILE TIME CHANGES *compile-changes-8* + +The Vim repository was moved from Google code to github, since Google code +was shut down. It can now be found at https://github.com/vim/vim. + +Functions now use ANSI-C declarations. At least a C-89 compatible compiler is +required. + +The +visual feature is now always included. + +============================================================================== +PATCHES *patches-8* *bug-fixes-8* + +The list of patches that got included since 7.4.0. This includes all the new +features, but does not include runtime file changes (syntax, indent, help, +etc.) + +Patch 7.4.001 +Problem: Character classes such as [a-z] do not react to 'ignorecase'. + Breaks man page highlighting. (Mario Grgic) +Solution: Add separate items for classes that react to 'ignorecase'. Clean + up logic handling character classes. Add more tests. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.002 +Problem: Pattern with two alternative look-behind matches does not match. + (Amadeus Demarzi) +Solution: When comparing PIMs also compare their state ID to see if they are + different. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.003 +Problem: Memory access error in Ruby syntax highlighting. (Christopher Chow) +Solution: Refresh stale pointer. (James McCoy) +Files: src/regexp_nfa.c + +Patch 7.4.004 +Problem: When closing a window fails ":bwipe" may hang. +Solution: Let win_close() return FAIL and break out of the loop. +Files: src/window.c, src/proto/window.pro, src/buffer.c + +Patch 7.4.005 +Problem: Using "vaB" while 'virtualedit' is set selects the wrong area. + (Dimitar Dimitrov) +Solution: Reset coladd when finding a match. +Files: src/search.c + +Patch 7.4.006 +Problem: mkdir("foo/bar/", "p") gives an error message. (David Barnett) +Solution: Remove the trailing slash. (lcd) +Files: src/eval.c + +Patch 7.4.007 +Problem: Creating a preview window on startup leaves the screen layout in a + messed up state. (Marius Gedminas) +Solution: Don't change firstwin. (Christian Brabandt) +Files: src/main.c + +Patch 7.4.008 +Problem: New regexp engine can't be interrupted. +Solution: Check for CTRL-C pressed. (Yasuhiro Matsumoto) +Files: src/regexp_nfa.c, src/regexp.c + +Patch 7.4.009 +Problem: When a file was not decrypted (yet), writing it may destroy the + contents. +Solution: Mark the file as readonly until decryption was done. (Christian + Brabandt) +Files: src/fileio.c + +Patch 7.4.010 (after 7.4.006) +Problem: Crash with invalid argument to mkdir(). +Solution: Check for empty string. (lcd47) +Files: src/eval.c + +Patch 7.4.011 +Problem: Cannot find out if "acl" and "xpm" features are supported. +Solution: Add "acl" and "xpm" to the list of features. (Ken Takata) +Files: src/eval.c, src/version.c + +Patch 7.4.012 +Problem: MS-Windows: resolving shortcut does not work properly with + multi-byte characters. +Solution: Use wide system functions. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.013 +Problem: MS-Windows: File name buffer too small for utf-8. +Solution: Use character count instead of byte count. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.014 +Problem: MS-Windows: check for writing to device does not work. +Solution: Fix #ifdefs. (Ken Takata) +Files: src/fileio.c + +Patch 7.4.015 +Problem: MS-Windows: Detecting node type does not work for multi-byte + characters. +Solution: Use wide character function when needed. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.016 +Problem: MS-Windows: File name case can be wrong. +Solution: Add fname_casew(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.017 +Problem: ":help !!" does not find the "!!" tag in the help file. (Ben + Fritz) +Solution: When reading the start of the tags file do parse lines that are + not header lines. +Files: src/tag.c + +Patch 7.4.018 +Problem: When completing item becomes unselected. (Shougo Matsu) +Solution: Revert patch 7.3.1269. +Files: src/edit.c + +Patch 7.4.019 +Problem: MS-Windows: File name completion doesn't work properly with + Chinese characters. (Yue Wu) +Solution: Take care of multi-byte characters when looking for the start of + the file name. (Ken Takata) +Files: src/edit.c + +Patch 7.4.020 +Problem: NFA engine matches too much with \@>. (John McGowan) +Solution: When a whole pattern match is found stop searching. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.021 +Problem: NFA regexp: Using \ze in one branch which doesn't match may cause + end of another branch to be wrong. (William Fugh) +Solution: Set end position if it wasn't set yet. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.022 +Problem: Deadlock while exiting, because of allocating memory. +Solution: Do not use gettext() in deathtrap(). (James McCoy) +Files: src/os_unix.c, src/misc1.c + +Patch 7.4.023 +Problem: Compiler warning on 64 bit windows. +Solution: Add type cast. (Mike Williams) +Files: src/edit.c + +Patch 7.4.024 +Problem: When root edits a file the undo file is owned by root while the + edited file may be owned by another user, which is not allowed. + (cac2s) +Solution: Accept an undo file owned by the current user. +Files: src/undo.c + +Patch 7.4.025 (after 7.4.019) +Problem: Reading before start of a string. +Solution: Do not call mb_ptr_back() at start of a string. (Dominique Pelle) +Files: src/edit.c + +Patch 7.4.026 +Problem: Clang warning for int shift overflow. +Solution: Use unsigned and cast back to int. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.027 (after 7.4.025) +Problem: Another valgrind error when using CTRL-X CTRL-F at the start of + the line. (Dominique Pelle) +Solution: Don't call mb_ptr_back() at the start of the line. Add a test. +Files: src/edit.c, src/testdir/test32.in + +Patch 7.4.028 +Problem: Equivalence classes are not working for multi-byte characters. +Solution: Copy the rules from the old to the new regexp engine. Add a test + to check both engines. +Files: src/regexp_nfa.c, src/testdir/test44.in, src/testdir/test99.in, + src/testdir/test99.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.029 +Problem: An error in a pattern is reported twice. +Solution: Remove the retry with the backtracking engine, it won't work. +Files: src/regexp.c + +Patch 7.4.030 +Problem: The -mno-cygwin argument is no longer supported by Cygwin. +Solution: Remove the arguments. (Steve Hall) +Files: src/GvimExt/Make_cyg.mak, src/Make_cyg.mak, src/xxd/Make_cyg.mak + +Patch 7.4.031 +Problem: ":diffoff!" resets options even when 'diff' is not set. (Charles + Cooper) +Solution: Only resets related options in a window where 'diff' is set. +Files: src/diff.c + +Patch 7.4.032 +Problem: NFA engine does not match the NUL character. (Jonathon Merz) +Solution: Use 0x0a instead of NUL. (Christian Brabandt) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.033 +Problem: When the terminal has only 20 lines test 92 and 93 overwrite the + input file. +Solution: Explicitly write test.out. Check that the terminal is large enough + to run the tests. (Hirohito Higashi) +Files: src/testdir/test92.in, src/testdir/test93.in, + src/testdir/test1.in, src/testdir/Makefile + +Patch 7.4.034 +Problem: Using "p" in Visual block mode only changes the first line. +Solution: Repeat the put in all text in the block. (Christian Brabandt) +Files: runtime/doc/change.txt, src/ops.c, src/normal.c, + src/testdir/test20.in, src/testdir/test20.ok + +Patch 7.4.035 +Problem: MS-Windows: The mouse pointer flickers when going from command + line mode to Normal mode. +Solution: Check for WM_NCMOUSEMOVE. (Ken Takata) +Files: src/gui_w48.c + +Patch 7.4.036 +Problem: NFA engine does not capture group correctly when using \@>. (ZyX) +Solution: Copy submatches before doing the recursive match. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.037 +Problem: Using "\ze" in a sub-pattern does not result in the end of the + match to be set. (Axel Bender) +Solution: Copy the end of match position when a recursive match was + successful. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.038 +Problem: Using "zw" and "zg" when 'spell' is off give a confusing error + message. (Gary Johnson) +Solution: Ignore the error when locating the word. Explicitly mention what + word was added. (Christian Brabandt) +Files: src/normal.c, src/spell.c + +Patch 7.4.039 +Problem: MS-Windows: MSVC10 and earlier can't handle symlinks to a + directory properly. +Solution: Add stat_symlink_aware() and wstat_symlink_aware(). (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c, src/os_win32.h + +Patch 7.4.040 +Problem: Valgrind error on exit when a script-local variable holds a + reference to the scope of another script. +Solution: First clear all variables, then free the scopes. (ZyX) +Files: src/eval.c + +Patch 7.4.041 (after 7.4.034) +Problem: Visual selection does not remain after being copied over. (Axel + Bender) +Solution: Move when VIsual_active is reset. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.042 +Problem: When using ":setlocal" for 'spell' and 'spelllang' then :spelldump + doesn't work. (Dimitar Dimitrov) +Solution: Copy the option variables to the new window used to show the dump. + (Christian Brabandt) +Files: src/spell.c + +Patch 7.4.043 +Problem: VMS can't handle long function names. +Solution: Shorten may_req_ambiguous_character_width. (Samuel Ferencik) +Files: src/main.c, src/term.c, src/proto/term.pro + + +Patch 7.4.044 (after 7.4.039) +Problem: Can't build with old MSVC. (Wang Shoulin) +Solution: Define OPEN_OH_ARGTYPE instead of using intptr_t directly. +Files: src/os_mswin.c + +Patch 7.4.045 +Problem: substitute() does not work properly when the pattern starts with + "\ze". +Solution: Detect an empty match. (Christian Brabandt) +Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.046 +Problem: Can't use Tcl 8.6. +Solution: Change how Tcl_FindExecutable is called. (Jan Nijtmans) +Files: src/if_tcl.c + +Patch 7.4.047 +Problem: When using input() in a function invoked by a mapping it doesn't + work. +Solution: Temporarily reset ex_normal_busy. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.048 +Problem: Recent clang version complains about -fno-strength-reduce. +Solution: Add a configure check for the clang version. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.049 +Problem: In Ex mode, when line numbers are enabled the substitute prompt is + wrong. +Solution: Adjust for the line number size. (Benoit Pierre) +Files: src/ex_cmds.c + +Patch 7.4.050 +Problem: "gn" selects too much for the pattern "\d" when there are two + lines with a single digit. (Ryan Carney) +Solution: Adjust the logic of is_one_char(). (Christian Brabandt) +Files: src/search.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.051 +Problem: Syntax highlighting a Yaml file causes a crash. (Blake Preston) +Solution: Copy the pim structure before calling addstate() to avoid it + becoming invalid when the state list is reallocated. +Files: src/regexp_nfa.c + +Patch 7.4.052 +Problem: With 'fo' set to "a2" inserting a space in the first column may + cause the cursor to jump to the previous line. +Solution: Handle the case when there is no comment leader properly. (Tor + Perkins) Also fix that cursor is in the wrong place when spaces + get replaced with a Tab. +Files: src/misc1.c, src/ops.c, src/testdir/test68.in, + src/testdir/test68.ok + +Patch 7.4.053 +Problem: Test75 has a wrong header. (ZyX) +Solution: Fix the text and remove leading ". +Files: src/testdir/test75.in + +Patch 7.4.054 +Problem: Reading past end of the 'stl' string. +Solution: Don't increment pointer when already at the NUL. (Christian + Brabandt) +Files: src/buffer.c + +Patch 7.4.055 +Problem: Mac: Where availability macros are defined depends on the system. +Solution: Add a configure check. (Felix Bünemann) +Files: src/config.h.in, src/configure.in, src/auto/configure, + src/os_mac.h + +Patch 7.4.056 +Problem: Mac: Compilation problem with OS X 10.9 Mavericks. +Solution: Include AvailabilityMacros.h when available. (Kazunobu Kuriyama) +Files: src/os_unix.c + +Patch 7.4.057 +Problem: byteidx() does not work for composing characters. +Solution: Add byteidxcomp(). +Files: src/eval.c, src/testdir/test69.in, src/testdir/test69.ok, + runtime/doc/eval.txt + +Patch 7.4.058 +Problem: Warnings on 64 bit Windows. +Solution: Add type casts. (Mike Williams) +Files: src/ops.c + +Patch 7.4.059 +Problem: set_last_cursor() may encounter w_buffer being NULL. (Matt + Mkaniaris) +Solution: Check for NULL. +Files: src/mark.c + +Patch 7.4.060 +Problem: Declaration has wrong return type for PyObject_SetAttrString(). +Solution: Use int instead of PyObject. (Andreas Schwab) +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.061 (after 7.4.055 and 7.4.056) +Problem: Availability macros configure check in wrong place. +Solution: Also check when not using Darwin. Remove version check. +Files: src/configure.in, src/auto/configure, src/os_unix.c + +Patch 7.4.062 (after 7.4.061) +Problem: Configure check for AvailabilityMacros.h is wrong. +Solution: Use AC_CHECK_HEADERS(). +Files: src/configure.in, src/auto/configure + +Patch 7.4.063 +Problem: Crash when using invalid key in Python dictionary. +Solution: Check for object to be NULL. Add tests. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.064 +Problem: When replacing a character in Visual block mode, entering a CR + does not cause a repeated line break. +Solution: Recognize the situation and repeat the line break. (Christian + Brabandt) +Files: src/normal.c, src/ops.c, src/testdir/test39.in, + src/testdir/test39.ok + +Patch 7.4.065 +Problem: When recording, the character typed at the hit-enter prompt is + recorded twice. (Urtica Dioica) +Solution: Avoid recording the character twice. (Christian Brabandt) +Files: src/message.c + +Patch 7.4.066 +Problem: MS-Windows: When there is a colon in the file name (sub-stream + feature) the swap file name is wrong. +Solution: Change the colon to "%". (Yasuhiro Matsumoto) +Files: src/fileio.c, src/memline.c, src/misc1.c, src/proto/misc1.pro + +Patch 7.4.067 +Problem: After inserting comment leader, CTRL-\ CTRL-O does move the + cursor. (Wiktor Ruben) +Solution: Avoid moving the cursor. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.068 +Problem: Cannot build Vim on Mac with non-Apple compilers. +Solution: Remove the -no-cpp-precomp flag. (Misty De Meo) +Files: src/configure.in, src/auto/configure, src/osdef.sh + +Patch 7.4.069 +Problem: Cannot right shift lines starting with #. +Solution: Allow the right shift when 'cino' contains #N with N > 0. + (Christian Brabandt) + Refactor parsing 'cino', store the values in the buffer. +Files: runtime/doc/indent.txt, src/buffer.c, src/edit.c, src/eval.c, + src/ex_getln.c, src/fold.c, src/misc1.c, src/ops.c, + src/proto/misc1.pro, src/proto/option.pro, src/structs.h, + src/option.c + +Patch 7.4.070 (after 7.4.069) +Problem: Can't compile with tiny features. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/buffer.c + +Patch 7.4.071 (after 7.4.069) +Problem: Passing limits around too often. +Solution: Use limits from buffer. +Files: src/edit.c, src/misc1.c, src/proto/misc1.pro + +Patch 7.4.072 +Problem: Crash when using Insert mode completion. +Solution: Avoid going past the end of pum_array. (idea by Francisco Lopes) +Files: src/popupmnu.c + +Patch 7.4.073 +Problem: Setting undolevels for one buffer changes undo in another. +Solution: Make 'undolevels' a global-local option. (Christian Brabandt) +Files: runtime/doc/options.txt, src/buffer.c, src/option.c, src/option.h + src/structs.h, src/undo.c + +Patch 7.4.074 +Problem: When undo'ing all changes and creating a new change the undo + structure is incorrect. (Christian Brabandt) +Solution: When deleting the branch starting at the old header, delete the + whole branch, not just the first entry. +Files: src/undo.c + +Patch 7.4.075 +Problem: Locally setting 'undolevels' is not tested. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test100.in, src/testdir/test100.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, src/Makefile + +Patch 7.4.076 +Problem: "cgn" does not wrap around the end of the file. (Dimitar Dimitrov) +Solution: Restore 'wrapscan' earlier. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.077 +Problem: DOS installer creates shortcut without a path, resulting in the + current directory to be C:\Windows\system32. +Solution: Use environment variables. +Files: src/dosinst.c + +Patch 7.4.078 +Problem: MSVC 2013 is not supported. +Solution: Recognize and support MSVC 2013. (Ed Brown) +Files: src/Make_mvc.mak + +Patch 7.4.079 +Problem: A script cannot detect whether 'hlsearch' highlighting is actually + displayed. +Solution: Add the "v:hlsearch" variable. (ZyX) +Files: src/eval.c, src/ex_docmd.c, + src/option.c, src/screen.c, src/search.c, src/tag.c, src/vim.h, + src/testdir/test101.in, src/testdir/test101.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.080 (after 7.4.079) +Problem: Missing documentation for v:hlsearch. +Solution: Include the right file in the patch. +Files: runtime/doc/eval.txt + +Patch 7.4.081 (after 7.4.078) +Problem: Wrong logic when ANALYZE is "yes". +Solution: Use or instead of and. (KF Leong) +Files: src/Make_mvc.mak + +Patch 7.4.082 +Problem: Using "gf" in a changed buffer suggests adding "!", which is not + possible. (Tim Chase) +Solution: Pass a flag to check_changed() whether adding ! make sense. +Files: src/vim.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/globals.h, + src/ex_cmds.c, src/ex_docmd.c + +Patch 7.4.083 +Problem: It's hard to avoid adding a used pattern to the search history. +Solution: Add the ":keeppatterns" modifier. (Christian Brabandt) +Files: runtime/doc/cmdline.txt, src/ex_cmds.h, src/ex_docmd.c, + src/ex_getln.c, src/structs.h + +Patch 7.4.084 +Problem: Python: interrupt not being properly discarded. (Yggdroot Chen) +Solution: Discard interrupt in VimTryEnd. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.085 +Problem: When inserting text in Visual block mode and moving the cursor the + wrong text gets repeated in other lines. +Solution: Use the '[ mark to find the start of the actually inserted text. + (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.086 +Problem: Skipping over an expression when not evaluating it does not work + properly for dict members. +Solution: Skip over unrecognized expression. (ZyX) +Files: src/eval.c, src/testdir/test34.in, src/testdir/test34.ok + +Patch 7.4.087 +Problem: Compiler warning on 64 bit Windows systems. +Solution: Fix type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.088 +Problem: When spell checking is enabled Asian characters are always marked + as error. +Solution: When 'spelllang' contains "cjk" do not mark Asian characters as + error. (Ken Takata) +Files: runtime/doc/options.txt, runtime/doc/spell.txt, src/mbyte.c, + src/option.c, src/spell.c, src/structs.h + +Patch 7.4.089 +Problem: When editing a file in a directory mounted through sshfs Vim + doesn't set the security context on a renamed file. +Solution: Add mch_copy_sec() to vim_rename(). (Peter Backes) +Files: src/fileio.c + +Patch 7.4.090 +Problem: Win32: When a directory name contains an exclamation mark, + completion doesn't complete the contents of the directory. +Solution: Escape the exclamation mark. (Jan Stocker) +Files: src/ex_getln.c, src/testdir/test102.in, src/testdir/test102.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.091 (after 7.4.089) +Problem: Missing semicolon. +Solution: Add the semicolon. +Files: src/fileio.c + +Patch 7.4.092 (after 7.4.088) +Problem: Can't build small version. +Solution: Add #ifdef where the b_cjk flag is used. (Ken Takata) +Files: src/spell.c + +Patch 7.4.093 +Problem: Configure can't use LuaJIT on ubuntu 12.04. +Solution: Adjust the configure regexp that locates the version number. + (Charles Strahan) +Files: src/configure.in, src/auto/configure + +Patch 7.4.094 +Problem: Configure may not find that -lint is needed for gettext(). +Solution: Check for gettext() with empty $LIBS. (Thomas De Schampheleire) +Files: src/configure.in, src/auto/configure + +Patch 7.4.095 (after 7.4.093) +Problem: Regexp for LuaJIT version doesn't work on BSD. +Solution: Use "*" instead of "\+" and "\?". (Ozaki Kiichi) +Files: src/configure.in, src/auto/configure + +Patch 7.4.096 +Problem: Can't change directory to an UNC path. +Solution: Use win32_getattrs() in mch_getperm(). (Christian Brabandt) +Files: src/os_win32.c + +Patch 7.4.097 (after 7.4.034) +Problem: Unexpected behavior change related to 'virtualedit'. (Ingo Karkat) +Solution: Update the valid cursor position. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.098 +Problem: When using ":'<,'>del" errors may be given for the visual line + numbers being out of range. +Solution: Reset Visual mode in ":del". (Lech Lorens) +Files: src/ex_docmd.c, src/testdir/test103.in, src/testdir/test103.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.099 +Problem: Append in blockwise Visual mode with "$" is wrong. +Solution: After "$" don't use the code that checks if the cursor was moved. + (Hirohito Higashi, Ken Takata) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.100 +Problem: NFA regexp doesn't handle backreference correctly. (Ryuichi + Hayashida, Urtica Dioica) +Solution: Always add NFA_SKIP, also when it already exists at the start + position. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.101 +Problem: Using \1 in pattern goes one line too far. (Bohr Shaw, John Little) +Solution: Only advance the match end for the matched characters in the last + line. +Files: src/regexp.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.102 +Problem: Crash when interrupting "z=". +Solution: Add safety check for word length. (Christian Brabandt, Dominique + Pelle) +Files: src/spell.c + +Patch 7.4.103 +Problem: Dos installer uses an old way to escape spaces in the diff + command. +Solution: Adjust the quoting to the new default shellxquote. (Ben Fritz) +Files: src/dosinst.c + +Patch 7.4.104 +Problem: ":help s/\_" reports an internal error. (John Beckett) +Solution: Check for NUL and invalid character classes. +Files: src/regexp_nfa.c + +Patch 7.4.105 +Problem: Completing a tag pattern may give an error for invalid pattern. +Solution: Suppress the error, just return no matches. +Files: src/tag.c + +Patch 7.4.106 +Problem: Can't build with Ruby using Cygwin. +Solution: Fix library name in makefile. (Steve Hall) +Files: src/Make_cyg.mak + +Patch 7.4.107 +Problem: Python: When vim.eval() encounters a Vim error, a try/catch in the + Python code doesn't catch it. (Yggdroot Chen) +Solution: Throw exceptions on errors in vim.eval(). (ZyX) +Files: src/ex_eval.c, src/if_py_both.h, src/proto/ex_eval.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.108 +Problem: "zG" and "zW" leave temp files around on MS-Windows. +Solution: Delete the temp files when exiting. (Ken Takata) +Files: src/memline.c, src/proto/spell.pro, src/spell.c + +Patch 7.4.109 +Problem: ColorScheme autocommand matches with the current buffer name. +Solution: Match with the colorscheme name. (Christian Brabandt) +Files: runtime/doc/autocmd.txt, src/fileio.c, src/syntax.c + +Patch 7.4.110 +Problem: "gUgn" cannot be repeated. (Dimitar Dimitrov) +Solution: Don't put "gn" in a different order in the redo buffer. Restore + 'wrapscan' when the pattern isn't found. (Christian Wellenbrock) +Files: src/normal.c, src/search.c, src/test53.in, src/test53.ok + +Patch 7.4.111 +Problem: Memory leak in Python OptionsAssItem. (Ken Takata) +Solution: Call Py_XDECREF() where needed. (ZyX) +Files: src/if_py_both.h + +Patch 7.4.112 +Problem: The defaults for 'directory' and 'backupdir' on MS-Windows do not + include a directory that exists. +Solution: Use $TEMP. +Files: src/os_dos.h + +Patch 7.4.113 +Problem: MSVC static analysis gives warnings. +Solution: Avoid the warnings and avoid possible bugs. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.114 +Problem: New GNU make outputs messages about changing directory in another + format. +Solution: Recognize the new format. +Files: src/option.h + +Patch 7.4.115 +Problem: When using Zsh expanding ~abc doesn't work when the result + contains a space. +Solution: Off-by-one error in detecting the NUL. (Pavol Juhas) +Files: src/os_unix.c + +Patch 7.4.116 +Problem: When a mapping starts with a space, the typed space does not show + up for 'showcmd'. +Solution: Show "<20>". (Brook Hong) +Files: src/normal.c + +Patch 7.4.117 +Problem: Can't build with Cygwin/MingW and Perl 5.18. +Solution: Add a linker argument for the Perl library. (Cesar Romani) + Adjust CFLAGS and LIB. (Cesar Romani) + Move including inline.h further down. (Ken Takata) +Files: src/Make_cyg.mak, src/Make_ming.mak, src/if_perl.xs + +Patch 7.4.118 +Problem: It's possible that redrawing the status lines causes + win_redr_custom() to be called recursively. +Solution: Protect against recursiveness. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 7.4.119 +Problem: Vim doesn't work well on OpenVMS. +Solution: Fix various problems. (Samuel Ferencik) +Files: src/os_unix.c, src/os_unix.h, src/os_vms.c + +Patch 7.4.120 (after 7.4.117) +Problem: Can't build with Perl 5.18 on Linux. (Lcd 47) +Solution: Add #ifdef. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.121 +Problem: Completion doesn't work for ":py3d" and ":py3f". (Bohr Shaw) +Solution: Skip over letters after ":py3". +Files: src/ex_docmd.c + +Patch 7.4.122 +Problem: Win32: When 'encoding' is set to "utf-8" and the active codepage + is cp932 then ":grep" and other commands don't work for multi-byte + characters. +Solution: (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.123 +Problem: Win32: Getting user name does not use wide function. +Solution: Use GetUserNameW() if possible. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.124 +Problem: Win32: Getting host name does not use wide function. +Solution: Use GetComputerNameW() if possible. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.125 +Problem: Win32: Dealing with messages may not work for multi-byte chars. +Solution: Use pDispatchMessage(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.126 +Problem: Compiler warnings for "const" and incompatible types. +Solution: Remove "const", add type cast. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.127 +Problem: Perl 5.18 on Unix doesn't work. +Solution: Move workaround to after including vim.h. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.128 +Problem: Perl 5.18 for MSVC doesn't work. +Solution: Add check in makefile and define __inline. (Ken Takata) +Files: src/Make_mvc.mak, src/if_perl.xs + +Patch 7.4.129 +Problem: getline(-1) returns zero. (mvxxc) +Solution: Return an empty string. +Files: src/eval.c + +Patch 7.4.130 +Problem: Relative line numbers mix up windows when using folds. +Solution: Use hasFoldingWin() instead of hasFolding(). (Lech Lorens) +Files: src/misc2.c + +Patch 7.4.131 +Problem: Syncbind causes E315 errors in some situations. (Liang Li) +Solution: Set and restore curbuf in ex_syncbind(). (Christian Brabandt) +Files: src/ex_docmd.c, src/testdir/test37.ok + +Patch 7.4.132 (after 7.4.122) +Problem: Win32: flags and inherit_handles arguments mixed up. +Solution: Swap the argument. (cs86661) +Files: src/os_win32.c + +Patch 7.4.133 +Problem: Clang warns for using NUL. +Solution: Change NUL to NULL. (Dominique Pelle) +Files: src/eval.c, src/misc2.c + +Patch 7.4.134 +Problem: Spurious space in MingW Makefile. +Solution: Remove the space. (Michael Soyka) +Files: src/Make_ming.mak + +Patch 7.4.135 +Problem: Missing dot in MingW test Makefile. +Solution: Add the dot. (Michael Soyka) +Files: src/testdir/Make_ming.mak + +Patch 7.4.136 (after 7.4.096) +Problem: MS-Windows: When saving a file with a UNC path the file becomes + read-only. +Solution: Don't mix up Win32 attributes and Unix attributes. (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.137 +Problem: Cannot use IME with Windows 8 console. +Solution: Change the user of ReadConsoleInput() and PeekConsoleInput(). + (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.138 (after 7.4.114) +Problem: Directory change messages are not recognized. +Solution: Fix using a character range literally. (Lech Lorens) +Files: src/option.h + +Patch 7.4.139 +Problem: Crash when using :cd in autocommand. (François Ingelrest) +Solution: Set w_localdir to NULL after freeing it. (Dominique Pelle) +Files: src/ex_docmd.c, src/window.c + +Patch 7.4.140 +Problem: Crash when wiping out buffer triggers autocommand that wipes out + only other buffer. +Solution: Do not delete the last buffer, make it empty. (Hirohito Higashi) +Files: src/buffer.c + +Patch 7.4.141 +Problem: Problems when building with Borland: st_mode is signed short; + can't build with Python; temp files not ignored by Mercurial; + building with DEBUG doesn't define _DEBUG. +Solution: Fix the problems. (Ken Takata) +Files: src/Make_bc5.mak, src/if_py_both.h, src/os_win32.c + +Patch 7.4.142 (after 7.4.137) +Problem: On MS-Windows 8 IME input doesn't work correctly. +Solution: Work around the problem. (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.143 +Problem: TextChangedI is not triggered. +Solution: Reverse check for "ready". (lilydjwg) +Files: src/edit.c + +Patch 7.4.144 +Problem: MingW also supports intptr_t for OPEN_OH_ARGTYPE. +Solution: Adjust #ifdef. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.145 +Problem: getregtype() does not return zero for unknown register. +Solution: Adjust documentation: return empty string for unknown register. + Check the register name to be valid. (Yukihiro Nakadaira) +Files: runtime/doc/eval.txt, src/ops.c + +Patch 7.4.146 +Problem: When starting Vim with "-u NONE" v:oldfiles is NULL. +Solution: Set v:oldfiles to an empty list. (Yasuhiro Matsumoto) +Files: src/main.c + +Patch 7.4.147 +Problem: Cursor moves to wrong position when using "gj" after "$" and + virtual editing is active. +Solution: Make "gj" behave differently when virtual editing is active. + (Hirohito Higashi) +Files: src/normal.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.148 +Problem: Cannot build with Cygwin and X11. +Solution: Include Xwindows.h instead of windows.h. (Lech Lorens) +Files: src/mbyte.c + +Patch 7.4.149 +Problem: Get E685 error when assigning a function to an autoload variable. + (Yukihiro Nakadaira) +Solution: Instead of having a global no_autoload variable, pass an autoload + flag down to where it is used. (ZyX) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok, + src/testdir/test60.in, src/testdir/test60.ok, + src/testdir/sautest/autoload/footest.vim + +Patch 7.4.150 +Problem: :keeppatterns is not respected for :s. +Solution: Check the keeppatterns flag. (Yasuhiro Matsumoto) +Files: src/search.c, src/testdir/test14.in, src/testdir/test14.ok + +Patch 7.4.151 +Problem: Python: slices with steps are not supported. +Solution: Support slices in Python vim.List. (ZyX) +Files: src/eval.c, src/if_py_both.h, src/if_python3.c, src/if_python.c, + src/proto/eval.pro, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.152 +Problem: Python: Cannot iterate over options. +Solution: Add options iterator. (ZyX) +Files: src/if_py_both.h, src/option.c, src/proto/option.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok, src/vim.h + +Patch 7.4.153 +Problem: Compiler warning for pointer type. +Solution: Add type cast. +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.154 (after 7.4.149) +Problem: Still a problem with auto-loading. +Solution: Pass no_autoload to deref_func_name(). (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.155 +Problem: ":keeppatterns /pat" does not keep search pattern offset. +Solution: Restore the offset after doing the search. +Files: src/search.c, src/testdir/test14.in, src/testdir/test14.ok + +Patch 7.4.156 +Problem: Test file missing from distribution. +Solution: Add new directory to file list. +Files: Filelist + +Patch 7.4.157 +Problem: Error number used twice. (Yukihiro Nakadaira) +Solution: Change the one not referred in the docs. +Files: src/undo.c + +Patch 7.4.158 (after 7.4.045) +Problem: Pattern containing \zs is not handled correctly by substitute(). +Solution: Change how an empty match is skipped. (Yukihiro Nakadaira) +Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.159 +Problem: Completion hangs when scanning the current buffer after doing + keywords. (Christian Brabandt) +Solution: Set the first match position when starting to scan the current + buffer. +Files: src/edit.c + +Patch 7.4.160 +Problem: Win32: Crash when executing external command. +Solution: Only close the handle when it was created. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.161 +Problem: Crash in Python exception handling. +Solution: Only use exception variables if did_throw is set. (ZyX) +Files: src/if_py_both.h + +Patch 7.4.162 +Problem: Running tests in shadow dir doesn't work. +Solution: Add testdir/sautest to the shadow target. (James McCoy) +Files: src/Makefile + +Patch 7.4.163 (after 7.4.142) +Problem: MS-Windows input doesn't work properly on Windows 7 and earlier. +Solution: Add a check for Windows 8. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.164 (after 7.4.163) +Problem: Problem with event handling on Windows 8. +Solution: Ignore duplicate WINDOW_BUFFER_SIZE_EVENTs. (Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.165 +Problem: By default, after closing a buffer changes can't be undone. +Solution: In the example vimrc file set 'undofile'. +Files: runtime/vimrc_example.vim + +Patch 7.4.166 +Problem: Auto-loading a function for code that won't be executed. +Solution: Do not auto-load when evaluation is off. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.167 (after 7.4.149) +Problem: Fixes are not tested. +Solution: Add a test for not autoloading on assignment. (Yukihiro Nakadaira) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/sautest/autoload/Test104.vim, src/testdir/test104.in, + src/testdir/test104.ok + +Patch 7.4.168 +Problem: Can't compile with Ruby 2.1.0. +Solution: Add support for new GC. (Kohei Suzuki) +Files: src/if_ruby.c + +Patch 7.4.169 +Problem: ":sleep" puts cursor in the wrong column. (Liang Li) +Solution: Add the window offset. (Christian Brabandt) +Files: src/ex_docmd.c + +Patch 7.4.170 +Problem: Some help tags don't work with ":help". (Tim Chase) +Solution: Add exceptions. +Files: src/ex_cmds.c + +Patch 7.4.171 +Problem: Redo does not set v:count and v:count1. +Solution: Use a separate buffer for redo, so that we can set the counts when + performing redo. +Files: src/getchar.c, src/globals.h, src/normal.c, src/proto/getchar.pro, + src/structs.h + +Patch 7.4.172 +Problem: The blowfish code mentions output feedback, but the code is + actually doing cipher feedback. +Solution: Adjust names and comments. +Files: src/blowfish.c, src/fileio.c, src/proto/blowfish.pro, + src/memline.c + +Patch 7.4.173 +Problem: When using scrollbind the cursor can end up below the last line. + (mvxxc) +Solution: Reset w_botfill when scrolling up. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.174 +Problem: Compiler warnings for Python interface. (Tony Mechelynck) +Solution: Add type casts, initialize variable. +Files: src/if_py_both.h + +Patch 7.4.175 +Problem: When a wide library function fails, falling back to the non-wide + function may do the wrong thing. +Solution: Check the platform, when the wide function is supported don't fall + back to the non-wide function. (Ken Takata) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.176 +Problem: Dictionary.update() throws an error when used without arguments. + Python programmers don't expect that. +Solution: Make Dictionary.update() without arguments do nothing. (ZyX) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.177 +Problem: Compiler warning for unused variable. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/move.c + +Patch 7.4.178 +Problem: The J command does not update '[ and '] marks. (William Gardner) +Solution: Set the marks. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.179 +Problem: Warning for type-punned pointer. (Tony Mechelynck) +Solution: Use intermediate variable. +Files: src/if_py_both.h + +Patch 7.4.180 (after 7.4.174) +Problem: Older Python versions don't support %ld. +Solution: Use %d instead. (ZyX) +Files: src/if_py_both.h + +Patch 7.4.181 +Problem: When using 'pastetoggle' the status lines are not updated. (Samuel + Ferencik, Jan Christoph Ebersbach) +Solution: Update the status lines. (Nobuhiro Takasaki) +Files: src/getchar.c + +Patch 7.4.182 +Problem: Building with mzscheme and racket does not work. (David Chimay) +Solution: Adjust autoconf. (Sergey Khorev) +Files: src/configure.in, src/auto/configure + +Patch 7.4.183 +Problem: MSVC Visual Studio update not supported. +Solution: Add version number. (Mike Williams) +Files: src/Make_mvc.mak + +Patch 7.4.184 +Problem: match() does not work properly with a {count} argument. +Solution: Compute the length once and update it. Quit the loop when at the + end. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.185 +Problem: Clang gives warnings. +Solution: Adjust how bigness is set. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.186 (after 7.4.085) +Problem: Insert in Visual mode sometimes gives incorrect results. + (Dominique Pelle) +Solution: Remember the original insert start position. (Christian Brabandt, + Dominique Pelle) +Files: src/edit.c, src/globals.h, src/ops.c, src/structs.h + +Patch 7.4.187 +Problem: Delete that crosses line break splits multi-byte character. +Solution: Advance a character instead of a byte. (Cade Foster) +Files: src/normal.c, src/testdir/test69.in, src/testdir/test69.ok + +Patch 7.4.188 +Problem: SIZEOF_LONG clashes with similar defines in header files. +Solution: Rename to a name starting with VIM_. Also for SIZEOF_INT. +Files: src/if_ruby.c, src/vim.h, src/configure.in, src/auto/configure, + src/config.h.in, src/fileio.c, src/if_python.c, src/message.c, + src/spell.c, src/feature.h, src/os_os2_cfg.h, src/os_vms_conf.h, + src/os_win16.h, src/structs.h + +Patch 7.4.189 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/eval.c + +Patch 7.4.190 +Problem: Compiler warning for using %lld for off_t. +Solution: Add type cast. +Files: src/fileio.c + +Patch 7.4.191 +Problem: Escaping a file name for shell commands can't be done without a + function. +Solution: Add the :S file name modifier. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test105.in, src/testdir/test105.ok, + runtime/doc/cmdline.txt, runtime/doc/eval.txt, + runtime/doc/map.txt, runtime/doc/options.txt, + runtime/doc/quickfix.txt, runtime/doc/usr_30.txt, + runtime/doc/usr_40.txt, runtime/doc/usr_42.txt, + runtime/doc/vi_diff.txt, src/eval.c, src/misc2.c, src/normal.c, + src/proto/misc2.pro + +Patch 7.4.192 +Problem: Memory leak when giving E853. +Solution: Free the argument. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.193 +Problem: Typos in messages. +Solution: "then" -> "than". (Dominique Pelle) +Files: src/if_py_both.h, src/spell.c + +Patch 7.4.194 +Problem: Can't build for Android. +Solution: Add #if condition. (Fredrik Fornwall) +Files: src/mbyte.c + +Patch 7.4.195 (after 7.4.193) +Problem: Python tests fail. +Solution: Change "then" to "than" in more places. (Dominique Pelle, Taro + Muraoka) +Files: src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.196 +Problem: Tests fail on Solaris 9 and 10. +Solution: Use "test -f" instead of "test -e". (Laurent Blume) +Files: src/testdir/Makefile + +Patch 7.4.197 +Problem: Various problems on VMS. +Solution: Fix several VMS problems. (Zoltan Arpadffy) +Files: runtime/doc/os_vms.txt, src/Make_vms.mms, src/fileio.c, + src/os_unix.c, src/os_unix.h, src/os_vms.c, src/os_vms_conf.h, + src/proto/os_vms.pro, src/testdir/Make_vms.mms, + src/testdir/test72.in, src/testdir/test77a.com, + src/testdir/test77a.in, src/testdir/test77a.ok src/undo.c + +Patch 7.4.198 +Problem: Can't build Vim with Perl when -Dusethreads is not specified for + building Perl, and building Vim with --enable-perlinterp=dynamic. +Solution: Adjust #ifdefs. (Yasuhiro Matsumoto) +Files: src/if_perl.xs + +Patch 7.4.199 +Problem: (issue 197) ]P doesn't paste over Visual selection. +Solution: Handle Visual mode specifically. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.200 +Problem: Too many #ifdefs in the code. +Solution: Enable FEAT_VISUAL always, await any complaints +Files: src/feature.h + +Patch 7.4.201 +Problem: 'lispwords' is a global option. +Solution: Make 'lispwords' global-local. (Sung Pae) +Files: runtime/doc/options.txt, runtime/optwin.vim, src/buffer.c, + src/misc1.c, src/option.c, src/option.h, src/structs.h, + src/testdir/test100.in, src/testdir/test100.ok + +Patch 7.4.202 +Problem: MS-Windows: non-ASCII font names don't work. +Solution: Convert between the current code page and 'encoding'. (Ken Takata) +Files: src/gui_w48.c, src/os_mswin.c, src/proto/winclip.pro, + src/winclip.c + +Patch 7.4.203 +Problem: Parsing 'errorformat' is not correct. +Solution: Reset "multiignore" at the start of a multi-line message. (Lcd) +Files: src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test106.in, + src/testdir/test106.ok + +Patch 7.4.204 +Problem: A mapping where the second byte is 0x80 doesn't work. +Solution: Unescape before checking for incomplete multi-byte char. (Nobuhiro + Takasaki) +Files: src/getchar.c, src/testdir/test75.in, src/testdir/test75.ok + +Patch 7.4.205 +Problem: ":mksession" writes command to move to second argument while it + does not exist. When it does exist the order might be wrong. +Solution: Use ":argadd" for each argument instead of using ":args" with a + list of names. (Nobuhiro Takasaki) +Files: src/ex_docmd.c + +Patch 7.4.206 +Problem: Compiler warnings on 64 bit Windows. +Solution: Add type casts. (Mike Williams) +Files: src/gui_w48.c, src/os_mswin.c + +Patch 7.4.207 +Problem: The cursor report sequence is sometimes not recognized and results + in entering replace mode. +Solution: Also check for the cursor report when not asked for. +Files: src/term.c + +Patch 7.4.208 +Problem: Mercurial picks up some files that are not distributed. +Solution: Add patterns to the ignore list. (Cade Forester) +Files: .hgignore + +Patch 7.4.209 +Problem: When repeating a filter command "%" and "#" are expanded. +Solution: Escape the command when storing for redo. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.210 +Problem: Visual block mode plus virtual edit doesn't work well with tabs. + (Liang Li) +Solution: Take coladd into account. (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.211 +Problem: ":lu" is an abbreviation for ":lua", but it should be ":lunmap". + (ZyX) +Solution: Move "lunmap" to above "lua". +Files: src/ex_cmds.h + +Patch 7.4.212 (after 7.4.200) +Problem: Now that the +visual feature is always enabled the #ifdefs for it + are not useful. +Solution: Remove the checks for FEAT_VISUAL. +Files: src/buffer.c, src/charset.c, src/edit.c, src/eval.c, + src/ex_cmds.c, src/ex_docmd.c, src/fold.c, src/getchar.c, + src/gui.c, src/gui_mac.c, src/gui_w48.c, src/main.c, src/mark.c, + src/menu.c, src/misc2.c, src/move.c, src/netbeans.c, src/normal.c, + src/ops.c, src/option.c, src/os_msdos.c, src/os_qnx.c, + src/quickfix.c, src/regexp.c, src/regexp_nfa.c, src/screen.c, + src/search.c, src/spell.c, src/syntax.c, src/term.c, src/ui.c, + src/undo.c, src/version.c, src/window.c, src/feature.h, + src/globals.h, src/option.h, src/os_win32.h, src/structs.h + +Patch 7.4.213 +Problem: It's not possible to open a new buffer without creating a swap + file. +Solution: Add the ":noswapfile" modifier. (Christian Brabandt) +Files: runtime/doc/recover.txt, src/ex_cmds.h, src/ex_docmd.c, + src/memline.c, src/structs.h + +Patch 7.4.214 +Problem: Compilation problems on HP_nonStop (Tandem). +Solution: Add #defines. (Joachim Schmitz) +Files: src/vim.h + +Patch 7.4.215 +Problem: Inconsistency: ":sp foo" does not reload "foo", unless "foo" is + the current buffer. (Liang Li) +Solution: Do not reload the current buffer on a split command. +Files: runtime/doc/windows.txt, src/ex_docmd.c + +Patch 7.4.216 +Problem: Compiler warnings. (Tony Mechelynck) +Solution: Initialize variables, add #ifdef. +Files: src/term.c, src/os_unix.h + +Patch 7.4.217 +Problem: When src/auto/configure was updated, "make clean" would run + configure pointlessly. +Solution: Do not run configure for "make clean" and "make distclean" when + the make program supports $MAKECMDGOALS. (Ken Takata) +Files: src/Makefile + +Patch 7.4.218 +Problem: It's not easy to remove duplicates from a list. +Solution: Add the uniq() function. (Lcd) +Files: runtime/doc/change.txt, runtime/doc/eval.txt, + runtime/doc/usr_41.txt, runtime/doc/version7.txt, src/eval.c, + src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.219 +Problem: When 'relativenumber' or 'cursorline' are set the window is + redrawn much to often. (Patrick Hemmer, Dominique Pelle) +Solution: Check the VALID_CROW flag instead of VALID_WROW. +Files: src/move.c + +Patch 7.4.220 +Problem: Test 105 does not work in a shadow dir. (James McCoy) +Solution: Omit "src/" from the checked path. +Files: src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.221 +Problem: Quickfix doesn't resize on ":copen 20". (issue 199) +Solution: Resize the window when requested. (Christian Brabandt) +Files: src/quickfix.c + +Patch 7.4.222 +Problem: The Ruby directory is constructed from parts. +Solution: Use 'rubyarchhdrdir' if it exists. (James McCoy) +Files: src/configure.in, src/auto/configure + +Patch 7.4.223 +Problem: Still using an older autoconf version. +Solution: Switch to autoconf 2.69. +Files: src/Makefile, src/configure.in, src/auto/configure + +Patch 7.4.224 +Problem: /usr/bin/grep on Solaris does not support -F. +Solution: Add configure check to find a good grep. (Danek Duvall) +Files: src/configure.in, src/auto/configure + +Patch 7.4.225 +Problem: Dynamic Ruby doesn't work on Solaris. +Solution: Always use the stubs. (Danek Duvall, Yukihiro Nakadaira) +Files: src/if_ruby.c + +Patch 7.4.226 (after 7.4.219) +Problem: Cursorline highlighting not redrawn when scrolling. (John + Marriott) +Solution: Check for required redraw in two places. +Files: src/move.c + +Patch 7.4.227 (after 7.4.225) +Problem: Can't build with Ruby 1.8. +Solution: Do include a check for the Ruby version. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.228 +Problem: Compiler warnings when building with Python 3.2. +Solution: Make type cast depend on Python version. (Ken Takata) +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.229 +Problem: Using ":let" for listing variables and the second one is a curly + braces expression may fail. +Solution: Check for an "=" in a better way. (ZyX) +Files: src/eval.c, src/testdir/test104.in, src/testdir/test104.ok + +Patch 7.4.230 +Problem: Error when using ":options". +Solution: Fix the entry for 'lispwords'. (Kenichi Ito) +Files: runtime/optwin.vim + +Patch 7.4.231 +Problem: An error in ":options" is not caught by the tests. +Solution: Add a test for ":options". Set $VIMRUNTIME for the tests so that + it uses the current runtime files instead of the installed ones. +Files: src/Makefile, src/testdir/Makefile, src/testdir/test_options.in, + src/testdir/test_options.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms + +Patch 7.4.232 +Problem: ":%s/\n//" uses a lot of memory. (Aidan Marlin) +Solution: Turn this into a join command. (Christian Brabandt) +Files: src/ex_cmds.c, src/ex_docmd.c, src/proto/ex_docmd.pro + +Patch 7.4.233 +Problem: Escaping special characters for using "%" with a shell command is + inconsistent, parentheses are escaped but spaces are not. +Solution: Only escape "!". (Gary Johnson) +Files: src/ex_docmd.c + +Patch 7.4.234 +Problem: Can't get the command that was used to start Vim. +Solution: Add v:progpath. (Viktor Kojouharov) +Files: runtime/doc/eval.txt, src/eval.c, src/main.c, src/vim.h + +Patch 7.4.235 +Problem: It is not easy to get the full path of a command. +Solution: Add the exepath() function. +Files: src/eval.c, src/misc1.c, src/os_amiga.c, src/os_msdos.c, + src/os_unix.c, src/os_vms.c, src/os_win32.c, + src/proto/os_amiga.pro, src/proto/os_msdos.pro, + src/proto/os_unix.pro, src/proto/os_win32.pro, + runtime/doc/eval.txt + +Patch 7.4.236 +Problem: It's not that easy to check the Vim patch version. +Solution: Make has("patch-7.4.123") work. (partly by Marc Weber) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test60.in, + src/testdir/test60.ok + +Patch 7.4.237 (after 7.4.236) +Problem: When some patches were not included has("patch-7.4.123") may return + true falsely. +Solution: Check for the specific patch number. +Files: runtime/doc/eval.txt, src/eval.c + +Patch 7.4.238 +Problem: Vim does not support the smack library. +Solution: Add smack support (Jose Bollo) +Files: src/config.h.in, src/configure.in, src/fileio.c, src/memfile.c, + src/os_unix.c, src/undo.c, src/auto/configure + +Patch 7.4.239 +Problem: ":e +" does not position cursor at end of the file. +Solution: Check for "+" being the last character (ZyX) +Files: src/ex_docmd.c + +Patch 7.4.240 +Problem: ":tjump" shows "\n" as "\\n". +Solution: Skip over "\" that escapes a backslash. (Gary Johnson) +Files: src/tag.c + +Patch 7.4.241 +Problem: The string returned by submatch() does not distinguish between a + NL from a line break and a NL that stands for a NUL character. +Solution: Add a second argument to return a list. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c, src/proto/regexp.pro, + src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok, + src/testdir/test80.in, src/testdir/test80.ok + +Patch 7.4.242 +Problem: getreg() does not distinguish between a NL used for a line break + and a NL used for a NUL character. +Solution: Add another argument to return a list. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c src/ops.c, src/proto/ops.pro, + src/vim.h, src/Makefile, src/testdir/test_eval.in, + src/testdir/test_eval.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms + +Patch 7.4.243 +Problem: Cannot use setreg() to add text that includes a NUL. +Solution: Make setreg() accept a list. +Files: runtime/doc/eval.txt, src/eval.c, src/ops.c, src/proto/ops.pro, + src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.244 (after 7.4.238) +Problem: The smack feature causes stray error messages. +Solution: Remove the error messages. +Files: src/os_unix.c + +Patch 7.4.245 +Problem: Crash for "vim -u NONE -N -c '&&'". +Solution: Check for the pattern to be NULL. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.246 +Problem: Configure message for detecting smack are out of sequence. +Solution: Put the messages in the right place. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.247 +Problem: When passing input to system() there is no way to keep NUL and + NL characters separate. +Solution: Optionally use a list for the system() input. (ZyX) +Files: runtime/doc/eval.txt, src/eval.c + +Patch 7.4.248 +Problem: Cannot distinguish between NL and NUL in output of system(). +Solution: Add systemlist(). (ZyX) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_cmds2.c, src/misc1.c, + src/proto/misc1.pro + +Patch 7.4.249 +Problem: Using setreg() with a list of numbers does not work. +Solution: Use a separate buffer for numbers. (ZyX) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.250 +Problem: Some test files missing from distribution. +Solution: Add pattern for newly added tests. +Files: Filelist + +Patch 7.4.251 +Problem: Crash when BufAdd autocommand wipes out the buffer. +Solution: Check for buffer to still be valid. Postpone freeing the buffer + structure. (Hirohito Higashi) +Files: src/buffer.c, src/ex_cmds.c, src/fileio.c, src/globals.h + +Patch 7.4.252 +Problem: Critical error in GTK, removing timer twice. +Solution: Clear the timer after removing it. (James McCoy) +Files: src/gui_gtk_x11.c + +Patch 7.4.253 +Problem: Crash when using cpp syntax file with pattern using external + match. (Havard Garnes) +Solution: Discard match when end column is before start column. +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.254 +Problem: Smack support detection is incomplete. +Solution: Check for attr/xattr.h and specific macro. +Files: src/configure.in, src/auto/configure + +Patch 7.4.255 +Problem: Configure check for smack doesn't work with all shells. (David + Larson) +Solution: Remove spaces in set command. +Files: src/configure.in, src/auto/configure + +Patch 7.4.256 (after 7.4.248) +Problem: Using systemlist() may cause a crash and does not handle NUL + characters properly. +Solution: Increase the reference count, allocate memory by length. (Yasuhiro + Matsumoto) +Files: src/eval.c + +Patch 7.4.257 +Problem: Compiler warning, possibly for mismatch in parameter name. +Solution: Rename the parameter in the declaration. +Files: src/ops.c + +Patch 7.4.258 +Problem: Configure fails if $CC contains options. +Solution: Remove quotes around $CC. (Paul Barker) +Files: src/configure.in, src/auto/configure + +Patch 7.4.259 +Problem: Warning for misplaced "const". +Solution: Move the "const". (Yukihiro Nakadaira) +Files: src/os_unix.c + +Patch 7.4.260 +Problem: It is possible to define a function with a colon in the name. It + is possible to define a function with a lower case character if a + "#" appears after the name. +Solution: Disallow using a colon other than with "s:". Ignore "#" after the + name. +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_eval.in, + src/testdir/test_eval.ok + +Patch 7.4.261 +Problem: When updating the window involves a regexp pattern, an interactive + substitute to replace a "\n" with a line break fails. (Ingo + Karkat) +Solution: Set reg_line_lbr in vim_regsub() and vim_regsub_multi(). +Files: src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok + +Patch 7.4.262 +Problem: Duplicate code in regexec(). +Solution: Add line_lbr flag to regexec_nl(). +Files: src/regexp.c, src/regexp_nfa.c, src/regexp.h + +Patch 7.4.263 +Problem: GCC 4.8 compiler warning for hiding a declaration (François Gannaz) +Solution: Remove the second declaration. +Files: src/eval.c + +Patch 7.4.264 (after 7.4.260) +Problem: Can't define a function starting with "g:". Can't assign a + funcref to a buffer-local variable. +Solution: Skip "g:" at the start of a function name. Don't check for colons + when assigning to a variable. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.265 (after 7.4.260) +Problem: Can't call a global function with "g:" in an expression. +Solution: Skip the "g:" when looking up the function. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.266 +Problem: Test 62 fails. +Solution: Set the language to C. (Christian Brabandt) +Files: src/testdir/test62.in + +Patch 7.4.267 (after 7.4.178) +Problem: The '[ mark is in the wrong position after "gq". (Ingo Karkat) +Solution: Add the setmark argument to do_join(). (Christian Brabandt) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_autoformat_join.in, + src/testdir/test_autoformat_join.ok, src/Makefile, src/edit.c, + src/ex_cmds.c, src/ex_docmd.c, src/normal.c, src/ops.c, + src/proto/ops.pro + +Patch 7.4.268 +Problem: Using exists() on a funcref for a script-local function does not + work. +Solution: Translate <SNR> to the special byte sequence. Add a test. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + src/testdir/test_eval_func.vim, Filelist + +Patch 7.4.269 +Problem: CTRL-U in Insert mode does not work after using a cursor key. + (Pine Wu) +Solution: Use the original insert start position. (Christian Brabandt) +Files: src/edit.c, src/testdir/test29.in, src/testdir/test29.ok + +Patch 7.4.270 +Problem: Comparing pointers instead of the string they point to. +Solution: Use strcmp(). (Ken Takata) +Files: src/gui_gtk_x11.c + +Patch 7.4.271 +Problem: Compiler warning on 64 bit windows. +Solution: Add type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.272 +Problem: Using just "$" does not cause an error message. +Solution: Check for empty environment variable name. (Christian Brabandt) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.273 +Problem: "make autoconf" and "make reconfig" may first run configure and + then remove the output. +Solution: Add these targets to the exceptions. (Ken Takata) +Files: src/Makefile + +Patch 7.4.274 +Problem: When doing ":update" just before running an external command that + changes the file, the timestamp may be unchanged and the file + is not reloaded. +Solution: Also check the file size. +Files: src/fileio.c + +Patch 7.4.275 +Problem: When changing the type of a sign that hasn't been placed there is + no error message. +Solution: Add an error message. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.276 +Problem: The fish shell is not supported. +Solution: Use begin/end instead of () for fish. (Andy Russell) +Files: src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro + +Patch 7.4.277 +Problem: Using ":sign unplace *" may leave the cursor in the wrong position + (Christian Brabandt) +Solution: Update the cursor position when removing all signs. +Files: src/buffer.c + +Patch 7.4.278 +Problem: list_remove() conflicts with function defined in Sun header file. +Solution: Rename the function. (Richard Palo) +Files: src/eval.c, src/if_lua.c, src/if_py_both.h, src/proto/eval.pro + +Patch 7.4.279 +Problem: globpath() returns a string, making it difficult to get a list of + matches. (Greg Novack) +Solution: Add an optional argument like with glob(). (Adnan Zafar) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_getln.c, src/misc1.c, + src/misc2.c, src/proto/ex_getln.pro, src/proto/misc2.pro, + src/testdir/test97.in, src/testdir/test97.ok + +Patch 7.4.280 +Problem: When using a session file the relative position of the cursor is + not restored if there is another tab. (Nobuhiro Takasaki) +Solution: Update w_wrow before calculating the fraction. +Files: src/window.c + +Patch 7.4.281 +Problem: When a session file has more than one tabpage and 'showtabline' is + one the positions may be slightly off. +Solution: Set 'showtabline' to two while positioning windows. +Files: src/ex_docmd.c + +Patch 7.4.282 (after 7.4.279) +Problem: Test 97 fails on Mac. +Solution: Do not ignore case in file names. (Jun Takimoto) +Files: src/testdir/test97.in + +Patch 7.4.283 (after 7.4.276) +Problem: Compiler warning about unused variable. (Charles Cooper) +Solution: Move the variable inside the #if block. +Files: src/ex_cmds.c + +Patch 7.4.284 +Problem: Setting 'langmap' in the modeline can cause trouble. E.g. mapping + ":" breaks many commands. (Jens-Wolfhard Schicke-Uffmann) +Solution: Disallow setting 'langmap' from the modeline. +Files: src/option.c + +Patch 7.4.285 +Problem: When 'relativenumber' is set and deleting lines or undoing that, + line numbers are not always updated. (Robert Arkwright) +Solution: (Christian Brabandt) +Files: src/misc1.c + +Patch 7.4.286 +Problem: Error messages are inconsistent. (ZyX) +Solution: Change "Lists" to "list". +Files: src/eval.c + +Patch 7.4.287 +Problem: Patches for .hgignore don't work, since the file is not in the + distribution. +Solution: Add .hgignore to the distribution. Will be effective with the + next version. +Files: Filelist + +Patch 7.4.288 +Problem: When 'spellfile' is set the screen is not redrawn. +Solution: Redraw when updating the spelling info. (Christian Brabandt) +Files: src/spell.c + +Patch 7.4.289 +Problem: Pattern with repeated backreference does not match with new regexp + engine. (Urtica Dioica) +Solution: Also check the end of a submatch when deciding to put a state in + the state list. +Files: src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c + +Patch 7.4.290 +Problem: A non-greedy match followed by a branch is too greedy. (Ingo + Karkat) +Solution: Add NFA_MATCH when it is already in the state list if the position + differs. +Files: src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c + +Patch 7.4.291 +Problem: Compiler warning for int to pointer of different size when DEBUG + is defined. +Solution: use smsg() instead of EMSG3(). +Files: src/regexp.c + +Patch 7.4.292 +Problem: Searching for "a" does not match accented "a" with new regexp + engine, does match with old engine. (David Bürgin) + "ca" does not match "ca" with accented "a" with either engine. +Solution: Change the old engine, check for following composing character + also for single-byte patterns. +Files: src/regexp.c, src/testdir/test95.in, src/testdir/test95.ok + +Patch 7.4.293 +Problem: It is not possible to ignore composing characters at a specific + point in a pattern. +Solution: Add the %C item. +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test95.in, + src/testdir/test95.ok, runtime/doc/pattern.txt + +Patch 7.4.294 (7.4.293) +Problem: Test files missing from patch. +Solution: Patch the test files. +Files: src/testdir/test95.in, src/testdir/test95.ok + +Patch 7.4.295 +Problem: Various typos, bad white space and unclear comments. +Solution: Fix typos. Improve white space. Update comments. +Files: src/testdir/test49.in, src/macros.h, src/screen.c, src/structs.h, + src/gui_gtk_x11.c, src/os_unix.c + +Patch 7.4.296 +Problem: Can't run tests on Solaris. +Solution: Change the way VIMRUNTIME is set. (Laurent Blume) +Files: src/testdir/Makefile + +Patch 7.4.297 +Problem: Memory leak from result of get_isolated_shell_name(). +Solution: Free the memory. (Dominique Pelle) +Files: src/ex_cmds.c, src/misc1.c + +Patch 7.4.298 +Problem: Can't have a funcref start with "t:". +Solution: Add "t" to the list of accepted names. (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.299 +Problem: When running configure twice DYNAMIC_PYTHON_DLL may become empty. +Solution: Use AC_CACHE_VAL. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.300 +Problem: The way config.cache is removed doesn't always work. +Solution: Always remove config.cache. (Ken Takata) +Files: src/Makefile + +Patch 7.4.301 (after 7.4.280) +Problem: Still a scrolling problem when loading a session file. +Solution: Fix off-by-one mistake. (Nobuhiro Takasaki) +Files: src/window.c + +Patch 7.4.302 +Problem: Signs placed with 'foldcolumn' set don't show up after filler + lines. +Solution: Take filler lines into account. (Olaf Dabrunz) +Files: src/screen.c + +Patch 7.4.303 +Problem: When using double-width characters the text displayed on the + command line is sometimes truncated. +Solution: Reset the string length. (Nobuhiro Takasaki) +Files: src/screen.c + +Patch 7.4.304 +Problem: Cannot always use Python with Vim. +Solution: Add the manifest to the executable. (Jacques Germishuys) +Files: src/Make_mvc.mak + +Patch 7.4.305 +Problem: Making 'ttymouse' empty after the xterm version was requested + causes problems. (Elijah Griffin) +Solution: Do not check for DEC mouse sequences when the xterm version was + requested. Also don't request the xterm version when DEC mouse + was enabled. +Files: src/term.c, src/os_unix.c, src/proto/term.pro, src/globals.h + +Patch 7.4.306 +Problem: getchar(0) does not return Esc. +Solution: Do not wait for an Esc sequence to be complete. (Yasuhiro + Matsumoto) +Files: src/eval.c, src/getchar.c + +Patch 7.4.307 (after 7.4.305) +Problem: Can't build without the +termresponse feature. +Solution: Add proper #ifdefs. +Files: src/os_unix.c, src/term.c + +Patch 7.4.308 +Problem: When using ":diffsplit" on an empty file the cursor is displayed + on the command line. +Solution: Limit the value of w_topfill. +Files: src/diff.c + +Patch 7.4.309 +Problem: When increasing the size of the lower window, the upper window + jumps back to the top. (Ron Aaron) +Solution: Change setting the topline. (Nobuhiro Takasaki) +Files: src/window.c + +Patch 7.4.310 +Problem: getpos()/setpos() don't include curswant. +Solution: Add a fifth number when getting/setting the cursor. +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + runtime/doc/eval.txt + +Patch 7.4.311 +Problem: Can't use winrestview to only restore part of the view. +Solution: Handle missing items in the dict. (Christian Brabandt) +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.312 +Problem: Cannot figure out what argument list is being used for a window. +Solution: Add the arglistid() function. (Marcin Szamotulski) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/ex_docmd.c, src/globals.h, src/structs.h, src/main.c + +Patch 7.4.313 (after 7.4.310) +Problem: Changing the return value of getpos() causes an error. (Jie Zhu) +Solution: Revert getpos() and add getcurpos(). +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, + runtime/doc/eval.txt + +Patch 7.4.314 +Problem: Completion messages can get in the way of a plugin. +Solution: Add 'c' flag to 'shortmess' option. (Shougo Matsu) +Files: runtime/doc/options.txt, src/edit.c, src/option.h, src/screen.c + +Patch 7.4.315 (after 7.4.309) +Problem: Fixes for computation of topline not tested. +Solution: Add test. (Hirohito Higashi) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test107.in, src/testdir/test107.ok + +Patch 7.4.316 +Problem: Warning from 64-bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/ex_getln.c + +Patch 7.4.317 +Problem: Crash when starting gvim. Issue 230. +Solution: Check for a pointer to be NULL. (Christian Brabandt) +Files: src/window.c + +Patch 7.4.318 +Problem: Check for whether a highlight group has settings ignores fg and bg + color settings. +Solution: Also check cterm and GUI color settings. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.319 +Problem: Crash when putting zero bytes on the clipboard. +Solution: Do not support the utf8_atom target when not using a Unicode + encoding. (Naofumi Honda) +Files: src/ui.c + +Patch 7.4.320 +Problem: Possible crash when an BufLeave autocommand deletes the buffer. +Solution: Check for the window pointer being valid. Postpone freeing the + window until autocommands are done. (Yasuhiro Matsumoto) +Files: src/buffer.c, src/fileio.c, src/globals.h, src/window.c + +Patch 7.4.321 +Problem: Can't build with strawberry perl 5.20 + mingw-w64-4.9.0. +Solution: Define save_strlen. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.322 +Problem: Using "msgfmt" is hard coded, cannot use "gmsgfmt". +Solution: Use the msgfmt command found by configure. (Danek Duvall) +Files: src/config.mk.in, src/po/Makefile + +Patch 7.4.323 +Problem: Substitute() with zero width pattern breaks multi-byte character. +Solution: Take multi-byte character size into account. (Yukihiro Nakadaira) +Files: src/eval.c src/testdir/test69.in, src/testdir/test69.ok + +Patch 7.4.324 +Problem: In Ex mode, cyrillic characters are not handled. (Stas Malavin) +Solution: Support multi-byte characters in Ex mode. (Yukihiro Nakadaira) +Files: src/ex_getln.c + +Patch 7.4.325 +Problem: When starting the gui and changing the window size the status line + may not be drawn correctly. +Solution: Catch new_win_height() being called recursively. (Christian + Brabandt) +Files: src/window.c + +Patch 7.4.326 +Problem: Can't build Tiny version. (Elimar Riesebieter) +Solution: Add #ifdef. +Files: src/window.c + +Patch 7.4.327 +Problem: When 'verbose' is set to display the return value of a function, + may get E724 repeatedly. +Solution: Do not give an error for verbose messages. Abort conversion to + string after an error. +Files: src/eval.c + +Patch 7.4.328 +Problem: Selection of inner block is inconsistent. +Solution: Skip indent not only for '}' but all parens. (Tom McDonald) +Files: src/search.c + +Patch 7.4.329 +Problem: When moving the cursor and then switching to another window the + previous window isn't scrolled. (Yukihiro Nakadaira) +Solution: Call update_topline() before leaving the window. (Christian + Brabandt) +Files: src/window.c + +Patch 7.4.330 +Problem: Using a regexp pattern to highlight a specific position can be + slow. +Solution: Add matchaddpos() to highlight specific positions efficiently. + (Alexey Radkov) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, + runtime/plugin/matchparen.vim, src/eval.c, src/ex_docmd.c, + src/proto/window.pro, src/screen.c, src/structs.h, + src/testdir/test63.in, src/testdir/test63.ok, src/window.c + +Patch 7.4.331 +Problem: Relative numbering not updated after a linewise yank. Issue 235. +Solution: Redraw after the yank. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.332 +Problem: GTK: When a sign icon doesn't fit exactly there can be ugly gaps. +Solution: Scale the sign to fit when the aspect ratio is not too far off. + (Christian Brabandt) +Files: src/gui_gtk_x11.c + +Patch 7.4.333 +Problem: Compiler warning for unused function. +Solution: Put the function inside the #ifdef. +Files: src/screen.c + +Patch 7.4.334 (after 7.4.330) +Problem: Uninitialized variables, causing some problems. +Solution: Initialize the variables. (Dominique Pelle) +Files: src/screen.c, src/window.c + +Patch 7.4.335 +Problem: No digraph for the new rouble sign. +Solution: Add the digraphs =R and =P. +Files: src/digraph.c, runtime/doc/digraph.txt + +Patch 7.4.336 +Problem: Setting 'history' to a big value causes out-of-memory errors. +Solution: Limit the value to 10000. (Hirohito Higashi) +Files: runtime/doc/options.txt, src/option.c + +Patch 7.4.337 +Problem: When there is an error preparing to edit the command line, the + command won't be executed. (Hirohito Higashi) +Solution: Reset did_emsg before editing. +Files: src/ex_getln.c + +Patch 7.4.338 +Problem: Cannot wrap lines taking indent into account. +Solution: Add the 'breakindent' option. (many authors, final improvements by + Christian Brabandt) +Files: runtime/doc/eval.txt, runtime/doc/options.txt, runtime/optwin.vim, + src/buffer.c, src/charset.c, src/edit.c, src/ex_getln.c, + src/getchar.c, src/misc1.c, src/misc2.c, src/ops.c, src/option.c, + src/option.h, src/proto/charset.pro, src/proto/misc1.pro, + src/proto/option.pro, src/screen.c, src/structs.h, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok, + src/ui.c, src/version.c + +Patch 7.4.339 +Problem: Local function is available globally. +Solution: Add "static". +Files: src/option.c, src/proto/option.pro + +Patch 7.4.340 +Problem: Error from sed about illegal bytes when installing Vim. +Solution: Prepend LC_ALL=C. (Itchyny) +Files: src/installman.sh + +Patch 7.4.341 +Problem: sort() doesn't handle numbers well. +Solution: Add an argument to specify sorting on numbers. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.342 +Problem: Clang gives warnings. +Solution: Add an else block. (Dominique Pelle) +Files: src/gui_beval.c + +Patch 7.4.343 +Problem: matchdelete() does not always update the right lines. +Solution: Fix off-by-one error. (Ozaki Kiichi) +Files: src/window.c + +Patch 7.4.344 +Problem: Unnecessary initializations and other things related to + matchaddpos(). +Solution: Code cleanup. (Alexey Radkov) +Files: runtime/doc/eval.txt, src/screen.c, src/window.c + +Patch 7.4.345 (after 7.4.338) +Problem: Indent is not updated when deleting indent. +Solution: Remember changedtick. +Files: src/misc1.c + +Patch 7.4.346 (after 7.4.338) +Problem: Indent is not updated when changing 'breakindentopt'. (itchyny) +Solution: Do not cache "brishift". (Christian Brabandt) +Files: src/misc1.c + +Patch 7.4.347 +Problem: test55 fails on some systems. +Solution: Remove the elements that all result in zero and can end up in an + arbitrary position. +Files: src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.348 +Problem: When using "J1" in 'cinoptions' a line below a continuation line + gets too much indent. +Solution: Fix parentheses in condition. +Files: src/misc1.c + +Patch 7.4.349 +Problem: When there are matches to highlight the whole window is redrawn, + which is slow. +Solution: Only redraw everything when lines were inserted or deleted. + Reset b_mod_xlines when needed. (Alexey Radkov) +Files: src/screen.c, src/window.c + +Patch 7.4.350 +Problem: Using C indenting for Javascript does not work well for a {} block + inside parentheses. +Solution: When looking for a matching paren ignore one that is before the + start of a {} block. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.351 +Problem: sort() is not stable. +Solution: When the items are identical, compare the pointers. +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.352 +Problem: With 'linebreak' a tab causes a missing line break. +Solution: Count a tab for what it's worth also for shorter lines. + (Christian Brabandt) +Files: src/charset.c + +Patch 7.4.353 +Problem: 'linebreak' doesn't work with the 'list' option. +Solution: Make it work. (Christian Brabandt) +Files: runtime/doc/options.txt, src/charset.c, src/screen.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_listlbr.in, src/testdir/test_listlbr.ok + +Patch 7.4.354 +Problem: Compiler warning. +Solution: Change NUL to NULL. (Ken Takata) +Files: src/screen.c + +Patch 7.4.355 +Problem: Several problems with Javascript indenting. +Solution: Improve Javascript indenting. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.356 +Problem: Mercurial does not ignore memfile_test. (Daniel Hahler) +Solution: Add memfile_test to ignored files, remove trailing spaces. +Files: .hgignore + +Patch 7.4.357 +Problem: After completion some characters are not redrawn. +Solution: Clear the command line unconditionally. (Jacob Niehus) +Files: src/edit.c + +Patch 7.4.358 (after 7.4.351) +Problem: Sort is not always stable. +Solution: Add an index instead of relying on the pointer to remain the same. + Idea by Jun Takimoto. +Files: src/eval.c + +Patch 7.4.359 +Problem: When 'ttymouse' is set to 'uxterm' the xterm version is not + requested. (Tomas Janousek) +Solution: Do not mark uxterm as a conflict mouse and add + resume_get_esc_sequence(). +Files: src/term.c, src/os_unix.c, src/proto/term.pro + +Patch 7.4.360 +Problem: In a regexp pattern a "$" followed by \v or \V is not seen as the + end-of-line. +Solution: Handle the situation. (Ozaki Kiichi) +Files: src/regexp.c + +Patch 7.4.361 +Problem: Lots of flickering when filling the preview window for 'omnifunc'. +Solution: Disable redrawing. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 7.4.362 +Problem: When matchaddpos() uses a length smaller than the number of bytes + in the (last) character the highlight continues until the end of + the line. +Solution: Change condition from equal to larger-or-equal. +Files: src/screen.c + +Patch 7.4.363 +Problem: In Windows console typing 0xCE does not work. +Solution: Convert 0xCE to K_NUL 3. (Nobuhiro Takasaki et al.) +Files: src/os_win32.c, src/term.c + +Patch 7.4.364 +Problem: When the viminfo file can't be renamed there is no error message. + (Vladimir Berezhnoy) +Solution: Check for the rename to fail. +Files: src/ex_cmds.c + +Patch 7.4.365 +Problem: Crash when using ":botright split" when there isn't much space. +Solution: Add a check for the minimum width/height. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.366 +Problem: Can't run the linebreak test on MS-Windows. +Solution: Fix the output file name. (Taro Muraoka) +Files: src/testdir/Make_dos.mak + +Patch 7.4.367 (after 7.4.357) +Problem: Other solution for redrawing after completion. +Solution: Schedule a window redraw instead of just clearing the command + line. (Jacob Niehus) +Files: src/edit.c + +Patch 7.4.368 +Problem: Restoring the window sizes after closing the command line window + doesn't work properly if there are nested splits. +Solution: Restore the sizes twice. (Hirohito Higashi) +Files: src/window.c + +Patch 7.4.369 +Problem: Using freed memory when exiting while compiled with EXITFREE. +Solution: Set curwin to NULL and check for that. (Dominique Pelle) +Files: src/buffer.c, src/window.c + +Patch 7.4.370 +Problem: Linebreak test fails when encoding is not utf-8. (Danek Duvall) +Solution: Split the test in a single byte one and a utf-8 one. (Christian + Brabandt) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_listlbr.in, src/testdir/test_listlbr.ok, + src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.371 +Problem: When 'linebreak' is set control characters are not correctly + displayed. (Kimmy Lindvall) +Solution: Set n_extra. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.372 +Problem: When 'winminheight' is zero there might not be one line for the + current window. +Solution: Change the size computations. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.373 +Problem: Compiler warning for unused argument and unused variable. +Solution: Add UNUSED. Move variable inside #ifdef. +Files: src/charset.c, src/window.c + +Patch 7.4.374 +Problem: Character after "fb" command not mapped if it might be a composing + character. +Solution: Don't disable mapping when looking for a composing character. + (Jacob Niehus) +Files: src/normal.c + +Patch 7.4.375 +Problem: Test 63 fails when run with GUI-only Vim. +Solution: Add guibg attributes. (suggested by Mike Soyka) +Files: src/testdir/test63.in + +Patch 7.4.376 (after 7.4.367) +Problem: Popup menu flickers too much. +Solution: Remove the forced redraw. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.377 +Problem: When 'equalalways' is set a split may report "no room" even though + there is plenty of room. +Solution: Compute the available room properly. (Yukihiro Nakadaira) +Files: src/window.c + +Patch 7.4.378 +Problem: Title of quickfix list is not kept for setqflist(list, 'r'). +Solution: Keep the title. Add a test. (Lcd) +Files: src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_qf_title.in, + src/testdir/test_qf_title.ok + +Patch 7.4.379 +Problem: Accessing freed memory after using setqflist(list, 'r'). (Lcd) +Solution: Reset qf_index. +Files: src/quickfix.c + +Patch 7.4.380 +Problem: Loading python may cause Vim to exit. +Solution: Avoid loading the "site" module. (Taro Muraoka) +Files: src/if_python.c + +Patch 7.4.381 +Problem: Get u_undo error when backspacing in Insert mode deletes more than + one line break. (Ayberk Ozgur) +Solution: Also decrement Insstart.lnum. +Files: src/edit.c + +Patch 7.4.382 +Problem: Mapping characters may not work after typing Esc in Insert mode. +Solution: Fix the noremap flags for inserted characters. (Jacob Niehus) +Files: src/getchar.c + +Patch 7.4.383 +Problem: Bad interaction between preview window and omnifunc. +Solution: Avoid redrawing the status line. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 7.4.384 +Problem: Test 102 fails when compiled with small features. +Solution: Source small.vim. (Jacob Niehus) +Files: src/testdir/test102.in + +Patch 7.4.385 +Problem: When building with tiny or small features building the .mo files + fails. +Solution: In autoconf do not setup for building the .mo files when it would + fail. +Files: src/configure.in, src/auto/configure + +Patch 7.4.386 +Problem: When splitting a window the changelist position is wrong. +Solution: Copy the changelist position. (Jacob Niehus) +Files: src/window.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_changelist.in, + src/testdir/test_changelist.ok + +Patch 7.4.387 +Problem: "4gro" replaces one character then executes "ooo". (Urtica Dioica) +Solution: Write the ESC in the second stuff buffer. +Files: src/getchar.c, src/proto/getchar.pro, src/edit.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_insertcount.in, src/testdir/test_insertcount.ok + +Patch 7.4.388 +Problem: With 'linebreak' set and 'list' unset a Tab is not counted + properly. (Kent Sibilev) +Solution: Check the 'list' option. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.389 +Problem: Still sometimes Vim enters Replace mode when starting up. +Solution: Use a different solution in detecting the termresponse and + location response. (Hayaki Saito) +Files: src/globals.h, src/os_unix.c, src/term.c, src/proto/term.pro + +Patch 7.4.390 +Problem: Advancing pointer over end of a string. +Solution: Init quote character to -1 instead of zero. (Dominique Pelle) +Files: src/misc1.c + +Patch 7.4.391 +Problem: No 'cursorline' highlighting when the cursor is on a line with + diff highlighting. (Benjamin Fritz) +Solution: Combine the highlight attributes. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.392 +Problem: Not easy to detect type of command line window. +Solution: Add the getcmdwintype() function. (Jacob Niehus) +Files: src/eval.c + +Patch 7.4.393 +Problem: Text drawing on newer MS-Windows systems is suboptimal. Some + multi-byte characters are not displayed, even though the same font + in Notepad can display them. (Srinath Avadhanula) +Solution: Add the 'renderoptions' option to enable DirectX drawing. (Taro + Muraoka) +Files: runtime/doc/eval.txt, runtime/doc/options.txt, + runtime/doc/various.txt, src/Make_cyg.mak, src/Make_ming.mak, + src/Make_mvc.mak, src/eval.c, src/gui_dwrite.cpp, + src/gui_dwrite.h, src/gui_w32.c, src/gui_w48.c, src/option.c, + src/option.h, src/version.c, src/vim.h, src/proto/gui_w32.pro + +Patch 7.4.394 (after 7.4.393) +Problem: When using DirectX last italic character is incomplete. +Solution: Add one to the number of cells. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.395 (after 7.4.355) +Problem: C indent is wrong below an if with wrapped condition followed by + curly braces. (Trevor Powell) +Solution: Make a copy of tryposBrace. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.396 +Problem: When 'clipboard' is "unnamed", :g/pat/d is very slow. (Praful) +Solution: Only set the clipboard after the last delete. (Christian Brabandt) +Files: src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/globals.h, + src/ops.c, src/proto/ui.pro, src/ui.c + +Patch 7.4.397 +Problem: Matchparen only uses the topmost syntax item. +Solution: Go through the syntax stack to find items. (James McCoy) + Also use getcurpos() when possible. +Files: runtime/plugin/matchparen.vim + +Patch 7.4.398 (after 7.4.393) +Problem: Gcc error for the argument of InterlockedIncrement() and + InterlockedDecrement(). (Axel Bender) +Solution: Remove "unsigned" from the cRefCount_ declaration. +Files: src/gui_dwrite.cpp + +Patch 7.4.399 +Problem: Encryption implementation is messy. Blowfish encryption has a + weakness. +Solution: Refactor the encryption, store the state in an allocated struct + instead of using a save/restore mechanism. Introduce the + "blowfish2" method, which does not have the weakness and encrypts + the whole undo file. (largely by David Leadbeater) +Files: runtime/doc/editing.txt, runtime/doc/options.txt, src/Makefile, + src/blowfish.c, src/crypt.c, src/crypt_zip.c, src/ex_docmd.c, + src/fileio.c, src/globals.h, src/main.c, src/memline.c, + src/misc2.c, src/option.c, src/proto.h, src/proto/blowfish.pro, + src/proto/crypt.pro, src/proto/crypt_zip.pro, + src/proto/fileio.pro, src/proto/misc2.pro, src/structs.h, + src/undo.c, src/testdir/test71.in, src/testdir/test71.ok, + src/testdir/test71a.in, src/testdir/test72.in, + src/testdir/test72.ok + +Patch 7.4.400 +Problem: List of distributed files is incomplete. +Solution: Add recently added files. +Files: Filelist + +Patch 7.4.401 (after 7.4.399) +Problem: Can't build on MS-Windows. +Solution: Include the new files in all the Makefiles. +Files: src/Make_bc3.mak, src/Make_bc5.mak, src/Make_cyg.mak, + src/Make_dice.mak, src/Make_djg.mak, src/Make_ivc.mak, + src/Make_manx.mak, src/Make_ming.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_os2.mak, src/Make_sas.mak, + Make_vms.mms + +Patch 7.4.402 +Problem: Test 72 crashes under certain conditions. (Kazunobu Kuriyama) +Solution: Clear the whole bufinfo_T early. +Files: src/undo.c + +Patch 7.4.403 +Problem: Valgrind reports errors when running test 72. (Dominique Pelle) +Solution: Reset the local 'cryptmethod' option before storing the seed. + Set the seed in the memfile even when there is no block0 yet. +Files: src/fileio.c, src/option.c, src/memline.c + +Patch 7.4.404 +Problem: Windows 64 bit compiler warnings. +Solution: Add type casts. (Mike Williams) +Files: src/crypt.c, src/undo.c + +Patch 7.4.405 +Problem: Screen updating is slow when using matches. +Solution: Do not use the ">=" as in patch 7.4.362, check the lnum. +Files: src/screen.c, src/testdir/test63.in, src/testdir/test63.ok + +Patch 7.4.406 +Problem: Test 72 and 100 fail on MS-Windows. +Solution: Set fileformat to unix in the tests. (Taro Muraoka) +Files: src/testdir/test72.in, src/testdir/test100.in + +Patch 7.4.407 +Problem: Inserting text for Visual block mode, with cursor movement, + repeats the wrong text. (Aleksandar Ivanov) +Solution: Reset the update_Insstart_orig flag. (Christian Brabandt) +Files: src/edit.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.408 +Problem: Visual block insert breaks a multi-byte character. +Solution: Calculate the position properly. (Yasuhiro Matsumoto) +Files: src/ops.c, src/testdir/test_utf8.in, src/testdir/test_utf8.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.409 +Problem: Can't build with Perl on Fedora 20. +Solution: Find xsubpp in another directory. (Michael Henry) +Files: src/Makefile, src/config.mk.in, src/configure.in, + src/auto/configure + +Patch 7.4.410 +Problem: Fold does not open after search when there is a CmdwinLeave + autocommand. +Solution: Restore KeyTyped. (Jacob Niehus) +Files: src/ex_getln.c + +Patch 7.4.411 +Problem: "foo bar" sorts before "foo" with sort(). (John Little) +Solution: Avoid putting quotes around strings before comparing them. +Files: src/eval.c + +Patch 7.4.412 +Problem: Can't build on Windows XP with MSVC. +Solution: Add SUBSYSTEM_VER to the Makefile. (Yongwei Wu) +Files: src/Make_mvc.mak, src/INSTALLpc.txt + +Patch 7.4.413 +Problem: MS-Windows: Using US international keyboard layout, inserting dead + key by pressing space does not always work. Issue 250. +Solution: Let MS-Windows translate the message. (John Wellesz) +Files: src/gui_w48.c + +Patch 7.4.414 +Problem: Cannot define a command only when it's used. +Solution: Add the CmdUndefined autocommand event. (partly by Yasuhiro + Matsumoto) +Files: runtime/doc/autocmd.txt, src/ex_docmd.c, src/fileio.c, + src/proto/fileio.pro + +Patch 7.4.415 (after 7.4.414) +Problem: Cannot build. Warning for shadowed variable. (John Little) +Solution: Add missing change. Remove declaration. +Files: src/vim.h, src/ex_docmd.c + +Patch 7.4.416 +Problem: Problem with breakindent/showbreak and tabs. +Solution: Handle tabs differently. (Christian Brabandt) +Files: src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok, + src/charset.c + +Patch 7.4.417 +Problem: After splitting a window and setting 'breakindent' the default + minimum with is not respected. +Solution: Call briopt_check() when copying options to a new window. +Files: src/option.c, src/proto/option.pro, + src/testdir/test_breakindent.in + +Patch 7.4.418 +Problem: When leaving ":append" the cursor shape is like in Insert mode. + (Jacob Niehus) +Solution: Do not have State set to INSERT when calling getline(). +Files: src/ex_cmds.c + +Patch 7.4.419 +Problem: When part of a list is locked it's possible to make changes. +Solution: Check if any of the list items is locked before make a change. + (ZyX) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.420 +Problem: It's not obvious how to add a new test. +Solution: Add a README file. (Christian Brabandt) +Files: src/testdir/README.txt + +Patch 7.4.421 +Problem: Crash when searching for "\ze*". (Urtica Dioica) +Solution: Disallow a multi after \ze and \zs. +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.422 +Problem: When using conceal with linebreak some text is not displayed + correctly. (Grüner Gimpel) +Solution: Check for conceal mode when using linebreak. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.423 +Problem: expand("$shell") does not work as documented. +Solution: Do not escape the $ when expanding environment variables. +Files: src/os_unix.c, src/misc1.c, src/vim.h + +Patch 7.4.424 +Problem: Get ml_get error when using Python to delete lines in a buffer + that is not in a window. issue 248. +Solution: Do not try adjusting the cursor for a different buffer. +Files: src/if_py_both.h + +Patch 7.4.425 +Problem: When 'showbreak' is used "gj" may move to the wrong position. + (Nazri Ramliy) +Solution: Adjust virtcol when 'showbreak' is set. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.426 +Problem: README File missing from list of files. +Solution: Update the list of files. +Files: Filelist + +Patch 7.4.427 +Problem: When an InsertCharPre autocommand executes system() typeahead may + be echoed and messes up the display. (Jacob Niehus) +Solution: Do not set cooked mode when invoked from ":silent". +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.428 +Problem: executable() may return a wrong result on MS-Windows. +Solution: Change the way SearchPath() is called. (Yasuhiro Matsumoto, Ken + Takata) +Files: src/os_win32.c + +Patch 7.4.429 +Problem: Build fails with fewer features. (Elimar Riesebieter) +Solution: Add #ifdef. +Files: src/normal.c + +Patch 7.4.430 +Problem: test_listlbr fails when compiled with normal features. +Solution: Check for the +conceal feature. +Files: src/testdir/test_listlbr.in + +Patch 7.4.431 +Problem: Compiler warning. +Solution: Add type cast. (Mike Williams) +Files: src/ex_docmd.c + +Patch 7.4.432 +Problem: When the startup code expands command line arguments, setting + 'encoding' will not properly convert the arguments. +Solution: Call get_cmd_argsW() early in main(). (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/main.c, src/os_mswin.c + +Patch 7.4.433 +Problem: Test 75 fails on MS-Windows. +Solution: Use ":normal" instead of feedkeys(). (Michael Soyka) +Files: src/testdir/test75.in + +Patch 7.4.434 +Problem: gettabvar() is not consistent with getwinvar() and getbufvar(). +Solution: Return a dict with all variables when the varname is empty. + (Yasuhiro Matsumoto) +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test91.in, + src/testdir/test91.ok + +Patch 7.4.435 +Problem: Line formatting behaves differently when 'linebreak' is set. + (mvxxc) +Solution: Disable 'linebreak' temporarily. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.436 +Problem: ml_get error for autocommand that moves the cursor of the current + window. +Solution: Check the cursor position after switching back to the current + buffer. (Christian Brabandt) +Files: src/fileio.c + +Patch 7.4.437 +Problem: New and old regexp engine are not consistent. +Solution: Also give an error for "\ze*" for the old regexp engine. +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.438 +Problem: Cached values for 'cino' not reset for ":set all&". +Solution: Call parse_cino(). (Yukihiro Nakadaira) +Files: src/option.c + +Patch 7.4.439 +Problem: Duplicate message in message history. Some quickfix messages + appear twice. (Gary Johnson) +Solution: Do not reset keep_msg too early. (Hirohito Higashi) +Files: src/main.c + +Patch 7.4.440 +Problem: Omni complete popup drawn incorrectly. +Solution: Call validate_cursor() instead of check_cursor(). (Hirohito + Higashi) +Files: src/edit.c + +Patch 7.4.441 +Problem: Endless loop and other problems when 'cedit' is set to CTRL-C. +Solution: Do not call ex_window() when ex_normal_busy or got_int was set. + (Yasuhiro Matsumoto) +Files: src/ex_getln.c + +Patch 7.4.442 (after 7.4.434) +Problem: Using uninitialized variable. +Solution: Pass the first window of the tabpage. +Files: src/eval.c + +Patch 7.4.443 +Problem: Error reported by ubsan when running test 72. +Solution: Add type cast to unsigned. (Dominique Pelle) +Files: src/undo.c + +Patch 7.4.444 +Problem: Reversed question mark not recognized as punctuation. (Issue 258) +Solution: Add the Supplemental Punctuation range. +Files: src/mbyte.c + +Patch 7.4.445 +Problem: Clipboard may be cleared on startup. +Solution: Set clip_did_set_selection to -1 during startup. (Christian + Brabandt) +Files: src/main.c, src/ui.c + +Patch 7.4.446 +Problem: In some situations, when setting up an environment to trigger an + autocommand, the environment is not properly restored. +Solution: Check the return value of switch_win() and call restore_win() + always. (Daniel Hahler) +Files: src/eval.c, src/misc2.c, src/window.c + +Patch 7.4.447 +Problem: Spell files from Hunspell may generate a lot of errors. +Solution: Add the IGNOREEXTRA flag. +Files: src/spell.c, runtime/doc/spell.txt + +Patch 7.4.448 +Problem: Using ETO_IGNORELANGUAGE causes problems. +Solution: Remove this flag. (Paul Moore) +Files: src/gui_w32.c + +Patch 7.4.449 +Problem: Can't easily close the help window. (Chris Gaal) +Solution: Add ":helpclose". (Christian Brabandt) +Files: runtime/doc/helphelp.txt, runtime/doc/index.txt, src/ex_cmds.c, + src/ex_cmds.h, src/proto/ex_cmds.pro + +Patch 7.4.450 +Problem: Not all commands that edit another buffer support the +cmd + argument. +Solution: Add the +cmd argument to relevant commands. (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/ex_cmds.h, src/ex_docmd.c + +Patch 7.4.451 +Problem: Calling system() with empty input gives an error for writing the + temp file. +Solution: Do not try writing if the string length is zero. (Olaf Dabrunz) +Files: src/eval.c + +Patch 7.4.452 +Problem: Can't build with tiny features. (Tony Mechelynck) +Solution: Use "return" instead of "break". +Files: src/ex_cmds.c + +Patch 7.4.453 +Problem: Still can't build with tiny features. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.454 +Problem: When using a Visual selection of multiple words and doing CTRL-W_] + it jumps to the tag matching the word under the cursor, not the + selected text. (Patrick hemmer) +Solution: Do not reset Visual mode. (idea by Christian Brabandt) +Files: src/window.c + +Patch 7.4.455 +Problem: Completion for :buf does not use 'wildignorecase'. (Akshay H) +Solution: Pass the 'wildignorecase' flag around. +Files: src/buffer.c + +Patch 7.4.456 +Problem: 'backupcopy' is global, cannot write only some files in a + different way. +Solution: Make 'backupcopy' global-local. (Christian Brabandt) +Files: runtime/doc/options.txt, src/buffer.c, src/fileio.c, src/option.c, + src/option.h, src/proto/option.pro, src/structs.h + +Patch 7.4.457 +Problem: Using getchar() in an expression mapping may result in + K_CURSORHOLD, which can't be recognized. +Solution: Add the <CursorHold> key. (Hirohito Higashi) +Files: src/misc2.c + +Patch 7.4.458 +Problem: Issue 252: Cursor moves in a zero-height window. +Solution: Check for zero height. (idea by Christian Brabandt) +Files: src/move.c + +Patch 7.4.459 +Problem: Can't change the icon after building Vim. +Solution: Load the icon from a file on startup. (Yasuhiro Matsumoto) +Files: src/gui_w32.c, src/os_mswin.c, src/os_win32.c, + src/proto/os_mswin.pro + +Patch 7.4.460 (after 7.4.454) +Problem: Can't build without the quickfix feature. (Erik Falor) +Solution: Add a #ifdef. +Files: src/window.c + +Patch 7.4.461 +Problem: MS-Windows: When collate is on the number of copies is too high. +Solution: Only set the collated/uncollated count when collate is on. + (Yasuhiro Matsumoto) +Files: src/os_mswin.c + +Patch 7.4.462 +Problem: Setting the local value of 'backupcopy' empty gives an error. + (Peter Mattern) +Solution: When using an empty value set the flags to zero. (Hirohito + Higashi) +Files: src/option.c + +Patch 7.4.463 +Problem: Test 86 and 87 may hang on MS-Windows. +Solution: Call inputrestore() after inputsave(). (Ken Takata) +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.464 (after 7.4.459) +Problem: Compiler warning. +Solution: Add type cast. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.465 (after 7.4.016) +Problem: Crash when expanding a very long string. +Solution: Use wcsncpy() instead of wcscpy(). (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.466 (after 7.4.460) +Problem: CTRL-W } does not open preview window. (Erik Falor) +Solution: Don't set g_do_tagpreview for CTRL-W }. +Files: src/window.c + +Patch 7.4.467 +Problem: 'linebreak' does not work well together with Visual mode. +Solution: Disable 'linebreak' while applying an operator. Fix the test. + (Christian Brabandt) +Files: src/normal.c, src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.468 +Problem: Issue 26: CTRL-C does not interrupt after it was mapped and then + unmapped. +Solution: Reset mapped_ctrl_c. (Christian Brabandt) +Files: src/getchar.c + +Patch 7.4.469 (after 7.4.467) +Problem: Can't build with MSVC. (Ken Takata) +Solution: Move the assignment after the declarations. +Files: src/normal.c + +Patch 7.4.470 +Problem: Test 11 and 100 do not work properly on Windows. +Solution: Avoid using feedkeys(). (Ken Takata) +Files: src/testdir/Make_dos.mak, src/testdir/test11.in, + src/testdir/test100.in + +Patch 7.4.471 +Problem: MS-Windows: When printer name contains multi-byte, the name is + displayed as ???. +Solution: Convert the printer name from the active codepage to 'encoding'. + (Yasuhiro Matsumoto) +Files: src/os_mswin.c + +Patch 7.4.472 +Problem: The "precedes" entry in 'listchar' will be drawn when 'showbreak' + is set and 'list' is not. +Solution: Only draw this character when 'list' is on. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.473 +Problem: Cursor movement is incorrect when there is a number/sign/fold + column and 'sbr' is displayed. +Solution: Adjust the column for 'sbr'. (Christian Brabandt) +Files: src/charset.c + +Patch 7.4.474 +Problem: AIX compiler can't handle // comment. Issue 265. +Solution: Remove that line. +Files: src/regexp_nfa.c + +Patch 7.4.475 +Problem: Can't compile on a system where Xutf8SetWMProperties() is not in + the X11 library. Issue 265. +Solution: Add a configure check. +Files: src/configure.in, src/auto/configure, src/config.h.in, + src/os_unix.c + +Patch 7.4.476 +Problem: MingW: compiling with "XPM=no" doesn't work. +Solution: Check for the "no" value. (KF Leong) Also for Cygwin. (Ken + Takata) +Files: src/Make_ming.mak, src/Make_cyg.mak + +Patch 7.4.477 +Problem: When using ":%diffput" and the other file is empty an extra empty + line remains. +Solution: Set the buf_empty flag. +Files: src/diff.c + +Patch 7.4.478 +Problem: Using byte length instead of character length for 'showbreak'. +Solution: Compute the character length. (Marco Hinz) +Files: src/charset.c + +Patch 7.4.479 +Problem: MS-Windows: The console title can be wrong. +Solution: Take the encoding into account. When restoring the title use the + right function. (Yasuhiro Matsumoto) +Files: src/os_mswin.c, src/os_win32.c + +Patch 7.4.480 (after 7.4.479) +Problem: MS-Windows: Can't build. +Solution: Remove goto, use a flag instead. +Files: src/os_win32.c + +Patch 7.4.481 (after 7.4.471) +Problem: Compiler warning on MS-Windows. +Solution: Add type casts. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.482 +Problem: When 'balloonexpr' results in a list, the text has a trailing + newline. (Lcd) +Solution: Remove one trailing newline. +Files: src/gui_beval.c + +Patch 7.4.483 +Problem: A 0x80 byte is not handled correctly in abbreviations. +Solution: Unescape special characters. Add a test. (Christian Brabandt) +Files: src/getchar.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.484 (after 7.4.483) +Problem: Compiler warning on MS-Windows. (Ken Takata) +Solution: Add type cast. +Files: src/getchar.c + +Patch 7.4.485 (after 7.4.484) +Problem: Abbreviations don't work. (Toothpik) +Solution: Move the length computation inside the for loop. Compare against + the unescaped key. +Files: src/getchar.c + +Patch 7.4.486 +Problem: Check for writing to a yank register is wrong. +Solution: Negate the check. (Zyx). Also clean up the #ifdefs. +Files: src/ex_docmd.c, src/ex_cmds.h + +Patch 7.4.487 +Problem: ":sign jump" may use another window even though the file is + already edited in the current window. +Solution: First check if the file is in the current window. (James McCoy) +Files: src/window.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_signs.in, + src/testdir/test_signs.ok + +Patch 7.4.488 +Problem: test_mapping fails for some people. +Solution: Set the 'encoding' option. (Ken Takata) +Files: src/testdir/test_mapping.in + +Patch 7.4.489 +Problem: Cursor movement still wrong when 'lbr' is set and there is a + number column. (Hirohito Higashi) +Solution: Add correction for number column. (Hiroyuki Takagi) +Files: src/charset.c + +Patch 7.4.490 +Problem: Cannot specify the buffer to use for "do" and "dp", making them + useless for three-way diff. +Solution: Use the count as the buffer number. (James McCoy) +Files: runtime/doc/diff.txt, src/diff.c, src/normal.c, src/proto/diff.pro + +Patch 7.4.491 +Problem: When winrestview() has a negative "topline" value there are + display errors. +Solution: Correct a negative value to 1. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.492 +Problem: In Insert mode, after inserting a newline that inserts a comment + leader, CTRL-O moves to the right. (ZyX) Issue 57. +Solution: Correct the condition for moving the cursor back to the NUL. + (Christian Brabandt) +Files: src/edit.c, src/testdir/test4.in, src/testdir/test4.ok + +Patch 7.4.493 +Problem: A TextChanged autocommand is triggered when saving a file. + (William Gardner) +Solution: Update last_changedtick after calling unchanged(). (Christian + Brabandt) +Files: src/fileio.c + +Patch 7.4.494 +Problem: Cursor shape is wrong after a CompleteDone autocommand. +Solution: Update the cursor and mouse shape after ":normal" restores the + state. (Jacob Niehus) +Files: src/ex_docmd.c + +Patch 7.4.495 +Problem: XPM isn't used correctly in the Cygwin Makefile. +Solution: Include the rules like in Make_ming.mak. (Ken Takata) +Files: src/Make_cyg.mak + +Patch 7.4.496 +Problem: Many lines are both in Make_cyg.mak and Make_ming.mak +Solution: Move the common parts to one file. (Ken Takata) +Files: src/INSTALLpc.txt, src/Make_cyg.mak, src/Make_cyg_ming.mak, + src/Make_ming.mak, src/Make_mvc.mak, Filelist + +Patch 7.4.497 +Problem: With some regexp patterns the NFA engine uses many states and + becomes very slow. To the user it looks like Vim freezes. +Solution: When the number of states reaches a limit fall back to the old + engine. (Christian Brabandt) +Files: runtime/doc/options.txt, src/Makefile, src/regexp.c, src/regexp.h, + src/regexp_nfa.c, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Makefile, src/testdir/samples/re.freeze.txt, + src/testdir/bench_re_freeze.in, src/testdir/bench_re_freeze.vim, + Filelist + +Patch 7.4.498 (after 7.4.497) +Problem: Typo in DOS makefile. +Solution: Change exists to exist. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.499 +Problem: substitute() can be slow with long strings. +Solution: Store a pointer to the end, instead of calling strlen() every + time. (Ozaki Kiichi) +Files: src/eval.c + +Patch 7.4.500 +Problem: Test 72 still fails once in a while. +Solution: Don't set 'fileformat' to unix, reset it. (Ken Takata) +Files: src/testdir/test72.in + +Patch 7.4.501 (after 7.4.497) +Problem: Typo in file pattern. +Solution: Insert a slash and remove a dot. +Files: Filelist + +Patch 7.4.502 +Problem: Language mapping also applies to mapped characters. +Solution: Add the 'langnoremap' option, when on 'langmap' does not apply to + mapped characters. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/vimrc_example.vim, src/macros.h, + src/option.c, src/option.h + +Patch 7.4.503 +Problem: Cannot append a list of lines to a file. +Solution: Add the append option to writefile(). (Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, src/Makefile, src/eval.c, + src/testdir/test_writefile.in, src/testdir/test_writefile.ok + +Patch 7.4.504 +Problem: Restriction of the MS-Windows installer that the path must end in + "Vim" prevents installing more than one version. +Solution: Remove the restriction. (Tim Lebedkov) +Files: nsis/gvim.nsi + +Patch 7.4.505 +Problem: On MS-Windows when 'encoding' is a double-byte encoding a file + name longer than MAX_PATH bytes but shorter than that in + characters causes problems. +Solution: Fail on file names longer than MAX_PATH bytes. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.506 +Problem: MS-Windows: Cannot open a file with 259 characters. +Solution: Fix off-by-one error. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.507 (after 7.4.496) +Problem: Building with MingW and Perl. +Solution: Remove quotes. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.508 +Problem: When generating ja.sjis.po the header is not correctly adjusted. +Solution: Check for the right header string. (Ken Takata) +Files: src/po/sjiscorr.c + +Patch 7.4.509 +Problem: Users are not aware their encryption is weak. +Solution: Give a warning when prompting for the key. +Files: src/crypt.c, src/ex_docmd.c, src/fileio.c, src/main.c, + src/proto/crypt.pro + +Patch 7.4.510 +Problem: "-fwrapv" argument breaks use of cproto. +Solution: Remove the alphabetic arguments in a drastic way. +Files: src/Makefile + +Patch 7.4.511 +Problem: Generating proto for if_ruby.c uses type not defined elsewhere. +Solution: Do not generate a prototype for + rb_gc_writebarrier_unprotect_promoted() +Files: src/if_ruby.c + +Patch 7.4.512 +Problem: Cannot generate prototypes for Win32 files and VMS. +Solution: Add typedefs and #ifdef +Files: src/os_win32.c, src/gui_w32.c, src/os_vms.c + +Patch 7.4.513 +Problem: Crash because reference count is wrong for list returned by + getreg(). +Solution: Increment the reference count. (Kimmy Lindvall) +Files: src/eval.c + +Patch 7.4.514 (after 7.4.492) +Problem: Memory access error. (Dominique Pelle) +Solution: Update tpos. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.515 +Problem: In a help buffer the global 'foldmethod' is used. (Paul Marshall) +Solution: Reset 'foldmethod' when starting to edit a help file. Move the + code to a separate function. +Files: src/ex_cmds.c + +Patch 7.4.516 +Problem: Completing a function name containing a # does not work. Issue + 253. +Solution: Recognize the # character. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.517 +Problem: With a wrapping line the cursor may not end up in the right place. + (Nazri Ramliy) +Solution: Adjust n_extra for a Tab that wraps. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.518 +Problem: Using status line height in width computations. +Solution: Use one instead. (Hirohito Higashi) +Files: src/window.c + +Patch 7.4.519 (after 7.4.497) +Problem: Crash when using syntax highlighting. +Solution: When regprog is freed and replaced, store the result. +Files: src/buffer.c, src/regexp.c, src/syntax.c, src/spell.c, + src/ex_cmds2.c, src/fileio.c, src/proto/fileio.pro, + src/proto/regexp.pro, src/os_unix.c + +Patch 7.4.520 +Problem: Sun PCK locale is not recognized. +Solution: Add PCK in the table. (Keiichi Oono) +Files: src/mbyte.c + +Patch 7.4.521 +Problem: When using "vep" a mark is moved to the next line. (Maxi Padulo, + Issue 283) +Solution: Decrement the line number. (Christian Brabandt) +Files: src/ops.c + +Patch 7.4.522 +Problem: Specifying wrong buffer size for GetLongPathName(). +Solution: Use the actual size. (Ken Takata) +Files: src/eval.c + +Patch 7.4.523 +Problem: When the X11 server is stopped and restarted, while Vim is kept in + the background, copy/paste no longer works. (Issue 203) +Solution: Setup the clipboard again. (Christian Brabandt) +Files: src/os_unix.c + +Patch 7.4.524 +Problem: When using ":ownsyntax" spell checking is messed up. (Issue 78) +Solution: Use the window-local option values. (Christian Brabandt) +Files: src/option.c, src/syntax.c + +Patch 7.4.525 +Problem: map() leaks memory when there is an error in the expression. +Solution: Call clear_tv(). (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.526 +Problem: matchstr() fails on long text. (Daniel Hahler) +Solution: Return NFA_TOO_EXPENSIVE from regexec_nl(). (Christian Brabandt) +Files: src/regexp.c + +Patch 7.4.527 +Problem: Still confusing regexp failure and NFA_TOO_EXPENSIVE. +Solution: NFA changes equivalent of 7.4.526. +Files: src/regexp_nfa.c + +Patch 7.4.528 +Problem: Crash when using matchadd() (Yasuhiro Matsumoto) +Solution: Copy the match regprog. +Files: src/screen.c + +Patch 7.4.529 +Problem: No test for what 7.4.517 fixes. +Solution: Adjust the tests for breakindent. (Christian Brabandt) +Files: src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok + +Patch 7.4.530 +Problem: Many commands take a count or range that is not using line + numbers. +Solution: For each command specify what kind of count it uses. For windows, + buffers and arguments have "$" and "." have a relevant meaning. + (Marcin Szamotulski) +Files: runtime/doc/editing.txt, runtime/doc/tabpage.txt, + runtime/doc/windows.txt, src/Makefile, src/ex_cmds.h, + src/ex_docmd.c, src/testdir/Make_amiga.mak + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_argument_count.in, + src/testdir/test_argument_count.ok, + src/testdir/test_close_count.in, src/testdir/test_close_count.ok, + src/window.c + +Patch 7.4.531 +Problem: Comments about parsing an Ex command are wrong. +Solution: Correct the step numbers. +Files: src/ex_docmd.c + +Patch 7.4.532 +Problem: When using 'incsearch' "2/pattern/e" highlights the first match. +Solution: Move the code to set extra_col inside the loop for count. (Ozaki + Kiichi) +Files: src/search.c + +Patch 7.4.533 +Problem: ":hardcopy" leaks memory in case of errors. +Solution: Free memory in all code paths. (Christian Brabandt) +Files: src/hardcopy.c + +Patch 7.4.534 +Problem: Warnings when compiling if_ruby.c. +Solution: Avoid the warnings. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.535 (after 7.4.530) +Problem: Can't build with tiny features. +Solution: Add #ifdefs and skip a test. +Files: src/ex_docmd.c, src/testdir/test_argument_count.in + +Patch 7.4.536 +Problem: Test 63 fails when using a black&white terminal. +Solution: Add attributes for a non-color terminal. (Christian Brabandt) +Files: src/testdir/test63.in + +Patch 7.4.537 +Problem: Value of v:hlsearch reflects an internal variable. +Solution: Make the value reflect whether search highlighting is actually + displayed. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/testdir/test101.in, + src/testdir/test101.ok, src/vim.h + +Patch 7.4.538 +Problem: Tests fail with small features plus Python. +Solution: Disallow weird combination of options. Do not set "fdm" when + folding is disabled. +Files: src/option.c, src/ex_cmds.c, src/configure.in, src/auto/configure, + src/feature.h + +Patch 7.4.539 (after 7.4.530) +Problem: Crash when computing buffer count. Problem with range for user + commands. Line range wrong in Visual area. +Solution: Avoid segfault in compute_buffer_local_count(). Check for + CMD_USER when checking type of range. (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/ex_docmd.c + +Patch 7.4.540 (after 7.4.539) +Problem: Cannot build with tiny and small features. (Taro Muraoka) +Solution: Add #ifdef around CMD_USER. +Files: src/ex_docmd.c + +Patch 7.4.541 +Problem: Crash when doing a range assign. +Solution: Check for NULL pointer. (Yukihiro Nakadaira) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.542 +Problem: Using a range for window and buffer commands has a few problems. + Cannot specify the type of range for a user command. +Solution: Add the -addr argument for user commands. Fix problems. (Marcin + Szamotulski) +Files: src/testdir/test_command_count.in, + src/testdir/test_command_count.ok src/testdir/Make_amiga.mak + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, runtime/doc/map.txt, src/Makefile, + src/ex_cmds.h, src/ex_docmd.c, src/ex_getln.c, + src/proto/ex_docmd.pro, src/vim.h, + +Patch 7.4.543 +Problem: Since patch 7.4.232 "1,3s/\n//" joins two lines instead of three. + (Eliseo Martínez) Issue 287 +Solution: Correct the line count. (Christian Brabandt) + Also set the last used search pattern. +Files: src/ex_cmds.c, src/search.c, src/proto/search.pro + +Patch 7.4.544 +Problem: Warnings for unused arguments when compiling with a combination of + features. +Solution: Add "UNUSED". +Files: src/if_cscope.c + +Patch 7.4.545 +Problem: Highlighting for multi-line matches is not correct. +Solution: Stop highlight at the end of the match. (Hirohito Higashi) +Files: src/screen.c + +Patch 7.4.546 +Problem: Repeated use of vim_snprintf() with a number. +Solution: Move these vim_snprintf() calls into a function. +Files: src/window.c + +Patch 7.4.547 +Problem: Using "vit" does not select a multi-byte character at the end + correctly. +Solution: Advance the cursor over the multi-byte character. (Christian + Brabandt) +Files: src/search.c + +Patch 7.4.548 +Problem: Compilation fails with native version of MinGW-w64, because + it doesn't have x86_64-w64-mingw32-windres.exe. +Solution: Use windres instead. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.549 +Problem: Function name not recognized correctly when inside a function. +Solution: Don't check for an alpha character. (Ozaki Kiichi) +Files: src/eval.c, src/testdir/test_nested_function.in, + src/testdir/test_nested_function.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.550 +Problem: curs_rows() function is always called with the second argument + false. +Solution: Remove the argument. (Christian Brabandt) + validate_botline_win() can then also be removed. +Files: src/move.c + +Patch 7.4.551 +Problem: "ygn" may yank too much. (Fritzophrenic) Issue 295. +Solution: Check the width of the next match. (Christian Brabandt) +Files: src/search.c, src/testdir/test53.in, src/testdir/test53.ok + +Patch 7.4.552 +Problem: Langmap applies to Insert mode expression mappings. +Solution: Check for Insert mode. (Daniel Hahler) +Files: src/getchar.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.553 +Problem: Various small issues. +Solution: Fix those issues. +Files: src/ex_cmds.h, src/gui.h, src/message.c, src/testdir/test39.in, + src/proto/eval.pro, src/proto/misc1.pro, src/proto/ops.pro, + src/proto/screen.pro, src/proto/window.pro. src/os_unix.c, + src/Make_vms.mms, src/proto/os_vms.pro, src/INSTALL + +Patch 7.4.554 +Problem: Missing part of patch 7.4.519. +Solution: Copy back regprog after calling vim_regexec. +Files: src/quickfix.c + +Patch 7.4.555 +Problem: test_close_count may fail for some combination of features. +Solution: Require normal features. +Files: src/testdir/test_close_count.in + +Patch 7.4.556 +Problem: Failed commands in Python interface not handled correctly. +Solution: Restore window and buffer on failure. +Files: src/if_py_both.h + +Patch 7.4.557 +Problem: One more small issue. +Solution: Update function proto. +Files: src/proto/window.pro + +Patch 7.4.558 +Problem: When the X server restarts Vim may get stuck. +Solution: Destroy the application context and create it again. (Issue 203) +Files: src/os_unix.c + +Patch 7.4.559 +Problem: Appending a block in the middle of a tab does not work correctly + when virtualedit is set. +Solution: Decrement spaces and count, don't reset them. (James McCoy) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.560 +Problem: Memory leak using :wviminfo. Issue 296. +Solution: Free memory when needed. (idea by Christian Brabandt) +Files: src/ops.c + +Patch 7.4.561 +Problem: Ex range handling is wrong for buffer-local user commands. +Solution: Check for CMD_USER_BUF. (Marcin Szamotulski) +Files: src/ex_docmd.c, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.562 +Problem: Segfault with wide screen and error in 'rulerformat'. (Ingo Karkat) +Solution: Check there is enough space. (Christian Brabandt) +Files: src/buffer.c, src/screen.c + +Patch 7.4.563 +Problem: No test for replacing on a tab in Virtual replace mode. +Solution: Add a test. (Elias Diem) +Files: src/testdir/test48.in, src/testdir/test48.ok + +Patch 7.4.564 +Problem: FEAT_OSFILETYPE is used even though it's never defined. +Solution: Remove the code. (Christian Brabandt) +Files: src/fileio.c + +Patch 7.4.565 +Problem: Ranges for arguments, buffers, tabs, etc. are not checked to be + valid but limited to the maximum. This can cause the wrong thing + to happen. +Solution: Give an error for an invalid value. (Marcin Szamotulski) + Use windows range for ":wincmd". +Files: src/ex_docmd.c, src/ex_cmds.h, src/testdir/test62.in, + src/testdir/test_argument_count.in, + src/testdir/test_argument_count.ok, + src/testdir/test_close_count.in, + src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.566 +Problem: :argdo, :bufdo, :windo and :tabdo don't take a range. +Solution: Support the range. (Marcin Szamotulski) +Files: runtime/doc/editing.txt, runtime/doc/tabpage.txt, + runtime/doc/windows.txt, src/ex_cmds.h, src/ex_cmds2.c, + src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.567 +Problem: Non-ascii vertical separator characters are always redrawn. +Solution: Compare only the one byte that's stored. (Thiago Padilha) +Files: src/screen.c + +Patch 7.4.568 +Problem: Giving an error for ":0wincmd w" is a problem for some plugins. +Solution: Allow the zero in the range. (Marcin Szamotulski) +Files: src/ex_docmd.c, src/testdir/test_command_count.ok + +Patch 7.4.569 (after 7.4.468) +Problem: Having CTRL-C interrupt or not does not check the mode of the + mapping. (Ingo Karkat) +Solution: Use a bitmask with the map mode. (Christian Brabandt) +Files: src/getchar.c, src/structs.h, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok, src/ui.c, src/globals.h + +Patch 7.4.570 +Problem: Building with dynamic library does not work for Ruby 2.2.0 +Solution: Change #ifdefs and #defines. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.571 (after 7.4.569) +Problem: Can't build with tiny features. (Ike Devolder) +Solution: Add #ifdef. +Files: src/getchar.c + +Patch 7.4.572 +Problem: Address type of :wincmd depends on the argument. +Solution: Check the argument. +Files: src/ex_docmd.c, src/window.c, src/proto/window.pro + +Patch 7.4.573 (after 7.4.569) +Problem: Mapping CTRL-C in Visual mode doesn't work. (Ingo Karkat) +Solution: Call get_real_state() instead of using State directly. +Files: src/ui.c, src/testdir/test_mapping.in, src/testdir/test_mapping.ok + +Patch 7.4.574 +Problem: No error for eval('$'). +Solution: Check for empty name. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.575 +Problem: Unicode character properties are outdated. +Solution: Update the tables with the latest version. +Files: src/mbyte.c + +Patch 7.4.576 +Problem: Redrawing problem with 'relativenumber' and 'linebreak'. +Solution: Temporarily reset 'linebreak' and restore it in more places. + (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.577 +Problem: Matching with a virtual column has a lot of overhead on very long + lines. (Issue 310) +Solution: Bail out early if there can't be a match. (Christian Brabandt) + Also check for CTRL-C at every position. +Files: src/regexp_nfa.c + +Patch 7.4.578 +Problem: Using getcurpos() after "$" in an empty line returns a negative + number. +Solution: Don't add one when this would overflow. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.579 +Problem: Wrong cursor positioning when 'linebreak' is set and lines wrap. +Solution: Fix it. (Christian Brabandt) +Files: src/charset.c, src/screen.c + +Patch 7.4.580 +Problem: ":52wincmd v" still gives an invalid range error. (Charles + Campbell) +Solution: Skip over white space. +Files: src/ex_docmd.c + +Patch 7.4.581 +Problem: Compiler warnings for uninitialized variables. (John Little) +Solution: Initialize the variables. +Files: src/ops.c + +Patch 7.4.582 (after 7.4.577) +Problem: Can't match "%>80v" properly. (Axel Bender) +Solution: Correctly handle ">". (Christian Brabandt) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.583 +Problem: With tiny features test 16 may fail. +Solution: Source small.vim. (Christian Brabandt) +Files: src/testdir/test16.in + +Patch 7.4.584 +Problem: With tiny features test_command_count may fail. +Solution: Source small.vim. (Christian Brabandt) +Files: src/testdir/test_command_count.in + +Patch 7.4.585 +Problem: Range for :bdelete does not work. (Ronald Schild) +Solution: Also allow unloaded buffers. +Files: src/ex_cmds.h, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.586 +Problem: Parallel building of the documentation html files is not reliable. +Solution: Remove a cyclic dependency. (Reiner Herrmann) +Files: runtime/doc/Makefile + +Patch 7.4.587 +Problem: Conceal does not work properly with 'linebreak'. (cs86661) +Solution: Save and restore boguscols. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.588 +Problem: ":0argedit foo" puts the new argument in the second place instead + of the first. +Solution: Adjust the range type. (Ingo Karkat) +Files: src/ex_cmds.h, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_argument_0count.in, + src/testdir/test_argument_0count.ok + +Patch 7.4.589 +Problem: In the MS-Windows console Vim can't handle greek characters when + encoding is utf-8. +Solution: Escape K_NUL. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.590 +Problem: Using ctrl_x_mode as if it contains flags. +Solution: Don't use AND with CTRL_X_OMNI. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.591 (after 7.4.587) +Problem: test_listlbr_utf8 fails when the conceal feature is not available. +Solution: Check for the conceal feature. (Kazunobu Kuriyama) +Files: src/testdir/test_listlbr_utf8.in + +Patch 7.4.592 +Problem: When doing ":e foobar" when already editing "foobar" and 'buftype' + is "nofile" the buffer is cleared. (Xavier de Gaye) +Solution: Do no clear the buffer. +Files: src/ex_cmds.c + +Patch 7.4.593 +Problem: Crash when searching for "x\{0,90000}". (Dominique Pelle) +Solution: Bail out from the NFA engine when the max limit is much higher + than the min limit. +Files: src/regexp_nfa.c, src/regexp.c, src/vim.h + +Patch 7.4.594 +Problem: Using a block delete while 'breakindent' is set does not work + properly. +Solution: Use "line" instead of "prev_pend" as the first argument to + lbr_chartabsize_adv(). (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_breakindent.in, + src/testdir/test_breakindent.ok + +Patch 7.4.595 +Problem: The test_command_count test fails when using Japanese. +Solution: Force the language to C. (Hirohito Higashi) +Files: src/testdir/test_command_count.in + +Patch 7.4.596 (after 7.4.592) +Problem: Tiny build doesn't compile. (Ike Devolder) +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.597 +Problem: Cannot change the result of systemlist(). +Solution: Initialize v_lock. (Yukihiro Nakadaira) +Files: src/eval.c + +Patch 7.4.598 +Problem: ":tabdo windo echo 'hi'" causes "* register not to be changed. + (Salman Halim) +Solution: Change how clip_did_set_selection is used and add + clipboard_needs_update and global_change_count. (Christian + Brabandt) +Files: src/main.c, src/ui.c, src/testdir/test_eval.in, + src/testdir/test_eval.ok + +Patch 7.4.599 +Problem: Out-of-memory error. +Solution: Avoid trying to allocate a negative amount of memory, use size_t + instead of int. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.600 +Problem: Memory wasted in struct because of aligning. +Solution: Split pos in lnum and col. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.601 +Problem: It is not possible to have feedkeys() insert characters. +Solution: Add the 'i' flag. +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.602 +Problem: ":set" does not accept hex numbers as documented. +Solution: Use vim_str2nr(). (ZyX) +Files: src/option.c, runtime/doc/options.txt + +Patch 7.4.603 +Problem: 'foldcolumn' may be set such that it fills the whole window, not + leaving space for text. +Solution: Reduce the foldcolumn width when there is not sufficient room. + (idea by Christian Brabandt) +Files: src/screen.c + +Patch 7.4.604 +Problem: Running tests changes viminfo. +Solution: Disable viminfo. +Files: src/testdir/test_breakindent.in + +Patch 7.4.605 +Problem: The # register is not writable, it cannot be restored after + jumping around. +Solution: Make the # register writable. (Marcin Szamotulski) +Files: runtime/doc/change.txt, src/ops.c, src/buffer.c, src/globals.h + +Patch 7.4.606 +Problem: May crash when using a small window. +Solution: Avoid dividing by zero. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.607 (after 7.4.598) +Problem: Compiler warnings for unused variables. +Solution: Move them inside #ifdef. (Kazunobu Kuriyama) +Files: src/ui.c + +Patch 7.4.608 (after 7.4.598) +Problem: test_eval fails when the clipboard feature is missing. +Solution: Skip part of the test. Reduce the text used. +Files: src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.609 +Problem: For complicated list and dict use the garbage collector can run + out of stack space. +Solution: Use a stack of dicts and lists to be marked, thus making it + iterative instead of recursive. (Ben Fritz) +Files: src/eval.c, src/if_lua.c, src/if_py_both.h, src/if_python.c, + src/if_python3.c, src/proto/eval.pro, src/proto/if_lua.pro, + src/proto/if_python.pro, src/proto/if_python3.pro, src/structs.h + +Patch 7.4.610 +Problem: Some function headers may be missing from generated .pro files. +Solution: Add PROTO to the #ifdef. +Files: src/option.c, src/syntax.c + +Patch 7.4.611 (after 7.4.609) +Problem: Syntax error. +Solution: Change statement to return. +Files: src/if_python3.c + +Patch 7.4.612 +Problem: test_eval fails on Mac. +Solution: Use the * register instead of the + register. (Jun Takimoto) +Files: src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.613 +Problem: The NFA engine does not implement the 'redrawtime' time limit. +Solution: Implement the time limit. +Files: src/regexp_nfa.c + +Patch 7.4.614 +Problem: There is no test for what patch 7.4.601 fixes. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test_mapping.in, src/testdir/test_mapping.ok + +Patch 7.4.615 +Problem: Vim hangs when freeing a lot of objects. +Solution: Do not go back to the start of the list every time. (Yasuhiro + Matsumoto and Ariya Mizutani) +Files: src/eval.c + +Patch 7.4.616 +Problem: Cannot insert a tab in front of a block. +Solution: Correctly compute aop->start. (Christian Brabandt) +Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.617 +Problem: Wrong ":argdo" range does not cause an error. +Solution: Reset "cmd" to NULL. (Marcin Szamotulski, Ingo Karkat) +Files: src/ex_docmd.c + +Patch 7.4.618 (after 7.4.609) +Problem: luaV_setref() is missing a return statement. (Ozaki Kiichi) +Solution: Put the return statement back. +Files: src/if_lua.c + +Patch 7.4.619 (after 7.4.618) +Problem: luaV_setref() not returning the correct value. +Solution: Return one. +Files: src/if_lua.c + +Patch 7.4.620 +Problem: Compiler warning for uninitialized variable. (Tony Mechelynck) +Solution: Initialize "did_free". (Ben Fritz) +Files: src/eval.c + +Patch 7.4.621 (after 7.4.619) +Problem: Returning 1 in the wrong function. (Raymond Ko) +Solution: Return 1 in the right function (hopefully). +Files: src/if_lua.c + +Patch 7.4.622 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/regexp_nfa.c + +Patch 7.4.623 +Problem: Crash with pattern: \(\)\{80000} (Dominique Pelle) +Solution: When the max limit is large fall back to the old engine. +Files: src/regexp_nfa.c + +Patch 7.4.624 +Problem: May leak memory or crash when vim_realloc() returns NULL. +Solution: Handle a NULL value properly. (Mike Williams) +Files: src/if_cscope.c, src/memline.c, src/misc1.c, src/netbeans.c + +Patch 7.4.625 +Problem: Possible NULL pointer dereference. +Solution: Check for NULL before using it. (Mike Williams) +Files: src/if_py_both.h + +Patch 7.4.626 +Problem: MSVC with W4 gives useless warnings. +Solution: Disable more warnings. (Mike Williams) +Files: src/vim.h + +Patch 7.4.627 +Problem: The last screen cell is not updated. +Solution: Respect the "tn" termcap feature. (Hayaki Saito) +Files: runtime/doc/term.txt, src/option.c, src/screen.c, src/term.c, + src/term.h + +Patch 7.4.628 +Problem: Compiler warning for variable might be clobbered by longjmp. +Solution: Add volatile. (Michael Jarvis) +Files: src/main.c + +Patch 7.4.629 +Problem: Coverity warning for Out-of-bounds read. +Solution: Increase MAXWLEN to 254. (Eliseo Martínez) +Files: src/spell.c + +Patch 7.4.630 +Problem: When using Insert mode completion combined with autocommands the + redo command may not work. +Solution: Do not save the redo buffer when executing autocommands. (Yasuhiro + Matsumoto) +Files: src/fileio.c + +Patch 7.4.631 +Problem: The default conceal character is documented to be a space but it's + initially a dash. (Christian Brabandt) +Solution: Make the initial value a space. +Files: src/globals.h + +Patch 7.4.632 (after 7.4.592) +Problem: 7.4.592 breaks the netrw plugin, because the autocommands are + skipped. +Solution: Roll back the change. +Files: src/ex_cmds.c + +Patch 7.4.633 +Problem: After 7.4.630 the problem persists. +Solution: Also skip redo when calling a user function. +Files: src/eval.c + +Patch 7.4.634 +Problem: Marks are not restored after redo + undo. +Solution: Fix the way marks are restored. (Olaf Dabrunz) +Files: src/undo.c, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_marks.in, src/testdir/test_marks.ok + +Patch 7.4.635 +Problem: If no NL or CR is found in the first block of a file then the + 'fileformat' may be set to "mac". (Issue 77) +Solution: Check if a CR was found. (eswald) +Files: src/fileio.c + +Patch 7.4.636 +Problem: A search with end offset gets stuck at end of file. (Gary Johnson) +Solution: When a search doesn't move the cursor repeat it with a higher + count. (Christian Brabandt) +Files: src/normal.c, src/testdir/test44.in, src/testdir/test44.ok + +Patch 7.4.637 +Problem: Incorrectly read the number of buffer for which an autocommand + should be registered. +Solution: Reverse check for "<buffer=abuf>". (Lech Lorens) +Files: src/fileio.c + +Patch 7.4.638 +Problem: Can't build with Lua 5.3 on Windows. +Solution: use luaL_optinteger() instead of LuaL_optlong(). (Ken Takata) +Files: src/if_lua.c + +Patch 7.4.639 +Problem: Combination of linebreak and conceal doesn't work well. +Solution: Fix the display problems. (Christian Brabandt) +Files: src/screen.c, src/testdir/test88.in, src/testdir/test88.ok, + src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.640 +Problem: After deleting characters in Insert mode such that lines are + joined undo does not work properly. (issue 324) +Solution: Use Insstart instead of Insstart_orig. (Christian Brabandt) +Files: src/edit.c + +Patch 7.4.641 +Problem: The tabline menu was using ":999tabnew" which is now invalid. +Solution: Use ":$tabnew" instead. (Florian Degner) +Files: src/normal.c + +Patch 7.4.642 +Problem: When using "gf" escaped spaces are not handled. +Solution: Recognize escaped spaces. +Files: src/vim.h, src/window.c, src/misc2.c + +Patch 7.4.643 +Problem: Using the default file format for Mac files. (Issue 77) +Solution: Reset the try_mac counter in the right place. (Oswald) +Files: src/fileio.c, src/testdir/test30.in, src/testdir/test30.ok + +Patch 7.4.644 +Problem: Stratus VOS doesn't have sync(). +Solution: Use fflush(). (Karli Aurelia) +Files: src/memfile.c + +Patch 7.4.645 +Problem: When splitting the window in a BufAdd autocommand while still in + the first, empty buffer the window count is wrong. +Solution: Do not reset b_nwindows to zero and don't increment it. +Files: src/buffer.c, src/ex_cmds.c + +Patch 7.4.646 +Problem: ":bufdo" may start at a deleted buffer. +Solution: Find the first not deleted buffer. (Shane Harper) +Files: src/ex_cmds2.c, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok + +Patch 7.4.647 +Problem: After running the tests on MS-Windows many files differ from their + originals as they were checked out. +Solution: Use a temp directory for executing the tests. (Ken Takata, Taro + Muraoka) +Files: src/testdir/Make_dos.mak + +Patch 7.4.648 (after 7.4.647) +Problem: Tests broken on MS-Windows. +Solution: Delete wrong copy line. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.649 +Problem: Compiler complains about ignoring return value of fwrite(). + (Michael Jarvis) +Solution: Add (void). +Files: src/misc2.c + +Patch 7.4.650 +Problem: Configure check may fail because the dl library is not used. +Solution: Put "-ldl" in LIBS rather than LDFLAGS. (Ozaki Kiichi) +Files: src/configure.in, src/auto/configure + +Patch 7.4.651 (after 7.4.582) +Problem: Can't match "%>80v" properly for multi-byte characters. +Solution: Multiply the character number by the maximum number of bytes in a + character. (Yasuhiro Matsumoto) +Files: src/regexp_nfa.c + +Patch 7.4.652 +Problem: Xxd lacks a few features. +Solution: Use 8 characters for the file position. Add the -e and -o + arguments. (Vadim Vygonets) +Files: src/xxd/xxd.c, runtime/doc/xxd.1 + +Patch 7.4.653 +Problem: Insert mode completion with complete() may have CTRL-L work like + CTRL-P. +Solution: Handle completion with complete() differently. (Yasuhiro + Matsumoto, Christian Brabandt, Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.654 +Problem: glob() and globpath() cannot include links to non-existing files. + (Charles Campbell) +Solution: Add an argument to include all links with glob(). (James McCoy) + Also for globpath(). +Files: src/vim.h, src/eval.c, src/ex_getln.c + +Patch 7.4.655 +Problem: Text deleted by "dit" depends on indent of closing tag. + (Jan Parthey) +Solution: Do not adjust oap->end in do_pending_operator(). (Christian + Brabandt) +Files: src/normal.c, src/search.c, src/testdir/test53.in, + src/testdir/test53.ok + +Patch 7.4.656 (after 7.4.654) +Problem: Missing changes for glob() in one file. +Solution: Add the missing changes. +Files: src/misc1.c + +Patch 7.4.657 (after 7.4.656) +Problem: Compiler warnings for pointer mismatch. +Solution: Add a typecast. (John Marriott) +Files: src/misc1.c + +Patch 7.4.658 +Problem: 'formatexpr' is evaluated too often. +Solution: Only invoke it when beyond the 'textwidth' column, as it is + documented. (James McCoy) +Files: src/edit.c + +Patch 7.4.659 +Problem: When 'ruler' is set the preferred column is reset. (Issue 339) +Solution: Don't set curswant when redrawing the status lines. +Files: src/option.c + +Patch 7.4.660 +Problem: Using freed memory when g:colors_name is changed in the colors + script. (oni-link) +Solution: Make a copy of the variable value. +Files: src/syntax.c + +Patch 7.4.661 +Problem: Using "0 CTRL-D" in Insert mode may have CursorHoldI interfere. + (Gary Johnson) +Solution: Don't store K_CURSORHOLD as the last character. (Christian + Brabandt) +Files: src/edit.c + +Patch 7.4.662 +Problem: When 'M' is in the 'cpo' option then selecting a text object in + parentheses does not work correctly. +Solution: Keep 'M' in 'cpo' when finding a match. (Hirohito Higashi) +Files: src/search.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_textobjects.in, + src/testdir/test_textobjects.ok + +Patch 7.4.663 +Problem: When using netbeans a buffer is not found in another tab. +Solution: When 'switchbuf' is set to "usetab" then switch to another tab + when possible. (Xavier de Gaye) +Files: src/netbeans.c + +Patch 7.4.664 +Problem: When 'compatible' is reset 'numberwidth' is set to 4, but the + effect doesn't show until a change is made. +Solution: Check if 'numberwidth' changed. (Christian Brabandt) +Files: src/screen.c, src/structs.h + +Patch 7.4.665 +Problem: 'linebreak' does not work properly with multi-byte characters. +Solution: Compute the pointer offset with mb_head_off(). (Yasuhiro + Matsumoto) +Files: src/screen.c + +Patch 7.4.666 +Problem: There is a chance that Vim may lock up. +Solution: Handle timer events differently. (Aaron Burrow) +Files: src/os_unix.c + +Patch 7.4.667 +Problem: 'colorcolumn' isn't drawn in a closed fold while 'cursorcolumn' + is. (Carlos Pita) +Solution: Make it consistent. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.668 +Problem: Can't use a glob pattern as a regexp pattern. +Solution: Add glob2regpat(). (Christian Brabandt) +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.669 +Problem: When netbeans is active the sign column always shows up. +Solution: Only show the sign column once a sign has been added. (Xavier de + Gaye) +Files: src/buffer.c, src/edit.c, src/move.c, src/netbeans.c, + src/screen.c, src/structs.h + +Patch 7.4.670 +Problem: Using 'cindent' for Javascript is less than perfect. +Solution: Improve indenting of continuation lines. (Hirohito Higashi) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.671 (after 7.4.665) +Problem: Warning for shadowing a variable. +Solution: Rename off to mb_off. (Kazunobu Kuriyama) +Files: src/screen.c + +Patch 7.4.672 +Problem: When completing a shell command, directories in the current + directory are not listed. +Solution: When "." is not in $PATH also look in the current directory for + directories. +Files: src/ex_getln.c, src/vim.h, src/misc1.c, src/eval.c, + src/os_amiga.c, src/os_msdos.c, src/os_unix.c, src/os_vms.c, + src/proto/os_amiga.pro, src/proto/os_msdos.pro, + src/proto/os_unix.pro, src/proto/os_win32.pro + +Patch 7.4.673 +Problem: The first syntax entry gets sequence number zero, which doesn't + work. (Clinton McKay) +Solution: Start at number one. (Bjorn Linse) +Files: src/syntax.c + +Patch 7.4.674 (after 7.4.672) +Problem: Missing changes in one file. +Solution: Also change the win32 file. +Files: src/os_win32.c + +Patch 7.4.675 +Problem: When a FileReadPost autocommand moves the cursor inside a line it + gets moved back. +Solution: When checking whether an autocommand moved the cursor store the + column as well. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 7.4.676 +Problem: On Mac, when not using the default Python framework configure + doesn't do the right thing. +Solution: Use a linker search path. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.677 (after 7.4.676) +Problem: Configure fails when specifying a python-config-dir. (Lcd) +Solution: Check if PYTHONFRAMEWORKPREFIX is set. +Files: src/configure.in, src/auto/configure + +Patch 7.4.678 +Problem: When using --remote the directory may end up being wrong. +Solution: Use localdir() to find out what to do. (Xaizek) +Files: src/main.c + +Patch 7.4.679 +Problem: Color values greater than 255 cause problems on MS-Windows. +Solution: Truncate to 255 colors. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.680 +Problem: CTRL-W in Insert mode does not work well for multi-byte + characters. +Solution: Use mb_get_class(). (Yasuhiro Matsumoto) +Files: src/edit.c, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_erasebackword.in, + src/testdir/test_erasebackword.ok, + +Patch 7.4.681 +Problem: MS-Windows: When Vim is minimized the window height is computed + incorrectly. +Solution: When minimized use the previously computed size. (Ingo Karkat) +Files: src/gui_w32.c + +Patch 7.4.682 +Problem: The search highlighting and match highlighting replaces the + cursorline highlighting, this doesn't look good. +Solution: Combine the highlighting. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 7.4.683 +Problem: Typo in the vimtutor command. +Solution: Fix the typo. (Corey Farwell, github pull 349) +Files: vimtutor.com + +Patch 7.4.684 +Problem: When starting several Vim instances in diff mode, the temp files + used may not be unique. (Issue 353) +Solution: Add an argument to vim_tempname() to keep the file. +Files: src/diff.c, src/eval.c, src/ex_cmds.c, src/fileio.c, + src/hardcopy.c, src/proto/fileio.pro, src/if_cscope.c, + src/memline.c, src/misc1.c, src/os_unix.c, src/quickfix.c, + src/spell.c + +Patch 7.4.685 +Problem: When there are illegal utf-8 characters the old regexp engine may + go past the end of a string. +Solution: Only advance to the end of the string. (Dominique Pelle) +Files: src/regexp.c + +Patch 7.4.686 +Problem: "zr" and "zm" do not take a count. +Solution: Implement the count, restrict the fold level to the maximum + nesting depth. (Marcin Szamotulski) +Files: runtime/doc/fold.txt, src/normal.c + +Patch 7.4.687 +Problem: There is no way to use a different in Replace mode for a terminal. +Solution: Add t_SR. (Omar Sandoval) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/syntax/vim.vim, src/option.c, src/term.c, src/term.h + +Patch 7.4.688 +Problem: When "$" is in 'cpo' the popup menu isn't undrawn correctly. + (Issue 166) +Solution: When using the popup menu remove the "$". +Files: src/edit.c + +Patch 7.4.689 +Problem: On MS-Windows, when 'autochdir' is set, diff mode with files in + different directories does not work. (Axel Bender) +Solution: Remember the current directory and use it where needed. (Christian + Brabandt) +Files: src/main.c + +Patch 7.4.690 +Problem: Memory access errors when changing indent in Ex mode. Also missing + redraw when using CTRL-U. (Knil Ino) +Solution: Update pointers after calling ga_grow(). +Files: src/ex_getln.c + +Patch 7.4.691 (after 7.4.689) +Problem: Can't build with MzScheme. +Solution: Change "cwd" into the global variable "start_dir". +Files: src/main.c + +Patch 7.4.692 +Problem: Defining SOLARIS for no good reason. (Danek Duvall) +Solution: Remove it. +Files: src/os_unix.h + +Patch 7.4.693 +Problem: Session file is not correct when there are multiple tab pages. +Solution: Reset the current window number for each tab page. (Jacob Niehus) +Files: src/ex_docmd.c + +Patch 7.4.694 +Problem: Running tests changes the .viminfo file. +Solution: Disable viminfo in the text objects test. +Files: src/testdir/test_textobjects.in + +Patch 7.4.695 +Problem: Out-of-bounds read, detected by Coverity. +Solution: Remember the value of cmap for the first matching encoding. Reset + cmap to that value if first matching encoding is going to be used. + (Eliseo Martínez) +Files: src/hardcopy.c + +Patch 7.4.696 +Problem: Not freeing memory when encountering an error. +Solution: Free the stack before returning. (Eliseo Martínez) +Files: src/regexp_nfa.c + +Patch 7.4.697 +Problem: The filename used for ":profile" must be given literally. +Solution: Expand "~" and environment variables. (Marco Hinz) +Files: src/ex_cmds2.c + +Patch 7.4.698 +Problem: Various problems with locked and fixed lists and dictionaries. +Solution: Disallow changing locked items, fix a crash, add tests. (Olaf + Dabrunz) +Files: src/structs.h, src/eval.c, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.699 +Problem: E315 when trying to delete a fold. (Yutao Yuan) +Solution: Make sure the fold doesn't go beyond the last buffer line. + (Christian Brabandt) +Files: src/fold.c + +Patch 7.4.700 +Problem: Fold can't be opened after ":move". (Ein Brown) +Solution: Delete the folding information and update it afterwards. + (Christian Brabandt) +Files: src/ex_cmds.c, src/fold.c, src/testdir/test45.in, + src/testdir/test45.ok + +Patch 7.4.701 +Problem: Compiler warning for using uninitialized variable. (Yasuhiro + Matsumoto) +Solution: Initialize it. +Files: src/hardcopy.c + +Patch 7.4.702 +Problem: Joining an empty list does unnecessary work. +Solution: Let join() return early. (Marco Hinz) +Files: src/eval.c + +Patch 7.4.703 +Problem: Compiler warning for start_dir unused when building unittests. +Solution: Move start_dir inside the #ifdef. +Files: src/main.c + +Patch 7.4.704 +Problem: Searching for a character matches an illegal byte and causes + invalid memory access. (Dominique Pelle) +Solution: Do not match an invalid byte when search for a character in a + string. Fix equivalence classes using negative numbers, which + result in illegal bytes. +Files: src/misc2.c, src/regexp.c, src/testdir/test44.in + +Patch 7.4.705 +Problem: Can't build with Ruby 2.2. +Solution: Add #ifdefs to handle the incompatible change. (Andrei Olsen) +Files: src/if_ruby.c + +Patch 7.4.706 +Problem: Window drawn wrong when 'laststatus' is zero and there is a + command-line window. (Yclept Nemo) +Solution: Set the status height a bit later. (Christian Brabandt) +Files: src/window.c + +Patch 7.4.707 +Problem: Undo files can have their executable bit set. +Solution: Strip of the executable bit. (Mikael Berthe) +Files: src/undo.c + +Patch 7.4.708 +Problem: gettext() is called too often. +Solution: Do not call gettext() for messages until they are actually used. + (idea by Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.709 +Problem: ":tabmove" does not work as documented. +Solution: Make it work consistently. Update documentation and add tests. + (Hirohito Higashi) +Files: src/window.c, runtime/doc/tabpage.txt, src/ex_docmd.c, + src/testdir/test62.in, src/testdir/test62.ok + +Patch 7.4.710 +Problem: It is not possible to make spaces visible in list mode. +Solution: Add the "space" item to 'listchars'. (David Bürgin, issue 350) +Files: runtime/doc/options.txt, src/globals.h, src/message.h, + src/screen.c, src/testdir/test_listchars.in, + src/testdir/test_listchars.ok, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile + +Patch 7.4.711 (after 7.4.710) +Problem: Missing change in one file. +Solution: Also change option.c +Files: src/option.c + +Patch 7.4.712 (after 7.4.710) +Problem: Missing change in another file. +Solution: Also change message.c +Files: src/message.c + +Patch 7.4.713 +Problem: Wrong condition for #ifdef. +Solution: Change USR_EXRC_FILE2 to USR_VIMRC_FILE2. (Mikael Fourrier) +Files: src/os_unix.h + +Patch 7.4.714 +Problem: Illegal memory access when there are illegal bytes. +Solution: Check the byte length of the character. (Dominique Pelle) +Files: src/regexp.c + +Patch 7.4.715 +Problem: Invalid memory access when there are illegal bytes. +Solution: Get the length from the text, not from the character. (Dominique + Pelle) +Files: src/regexp_nfa.c + +Patch 7.4.716 +Problem: When using the 'c' flag of ":substitute" and selecting "a" or "l" + at the prompt the flags are not remembered for ":&&". (Ingo + Karkat) +Solution: Save the flag values and restore them. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.717 +Problem: ":let list += list" can change a locked list. +Solution: Check for the lock earlier. (Olaf Dabrunz) +Files: src/eval.c, src/testdir/test55.in, src/testdir/test55.ok + +Patch 7.4.718 +Problem: Autocommands triggered by quickfix cannot get the current title + value. +Solution: Set w:quickfix_title earlier. (Yannick) + Also move the check for a title into the function. +Files: src/quickfix.c + +Patch 7.4.719 +Problem: Overflow when adding MAXCOL to a pointer. +Solution: Subtract pointers instead. (James McCoy) +Files: src/screen.c + +Patch 7.4.720 +Problem: Can't build with Visual Studio 2015. +Solution: Recognize the "version 14" numbers and omit /nodefaultlib when + appropriate. (Paul Moore) +Files: src/Make_mvc.mak + +Patch 7.4.721 +Problem: When 'list' is set Visual mode does not highlight anything in + empty lines. (mgaleski) +Solution: Check the value of lcs_eol in another place. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.722 +Problem: 0x202f is not recognized as a non-breaking space character. +Solution: Add 0x202f to the list. (Christian Brabandt) +Files: runtime/doc/options.txt, src/message.c, src/screen.c + +Patch 7.4.723 +Problem: For indenting, finding the C++ baseclass can be slow. +Solution: Cache the result. (Hirohito Higashi) +Files: src/misc1.c + +Patch 7.4.724 +Problem: Vim icon does not show in Windows context menu. (issue 249) +Solution: Load the icon in GvimExt. +Files: src/GvimExt/gvimext.cpp, src/GvimExt/gvimext.h + +Patch 7.4.725 +Problem: ":call setreg('"', [])" reports an internal error. +Solution: Make the register empty. (Yasuhiro Matsumoto) +Files: src/ops.c + +Patch 7.4.726 (after 7.4.724) +Problem: Cannot build GvimExt. +Solution: Set APPVER to 5.0. (KF Leong) +Files: src/GvimExt/Makefile + +Patch 7.4.727 (after 7.4.724) +Problem: Cannot build GvimExt with MingW. +Solution: Add -lgdi32. (KF Leong) +Files: src/GvimExt/Make_ming.mak + +Patch 7.4.728 +Problem: Can't build with some version of Visual Studio 2015. +Solution: Recognize another version 14 number. (Sinan) +Files: src/Make_mvc.mak + +Patch 7.4.729 (after 7.4.721) +Problem: Occasional crash with 'list' set. +Solution: Fix off-by-one error. (Christian Brabandt) +Files: src/screen.c + +Patch 7.4.730 +Problem: When setting the crypt key and using a swap file, text may be + encrypted twice or unencrypted text remains in the swap file. + (Issue 369) +Solution: Call ml_preserve() before re-encrypting. Set correct index for + next pointer block. +Files: src/memfile.c, src/memline.c, src/proto/memline.pro, src/option.c + +Patch 7.4.731 +Problem: The tab menu shows "Close tab" even when it doesn't work. +Solution: Don't show "Close tab" for the last tab. (John Marriott) +Files: src/gui_w48.c, src/gui_gtk_x11.c, src/gui_mac.c, src/gui_motif.c + +Patch 7.4.732 +Problem: The cursor line is not always updated for the "O" command. +Solution: Reset the VALID_CROW flag. (Christian Brabandt) +Files: src/normal.c + +Patch 7.4.733 +Problem: test_listchars breaks on MS-Windows. (Kenichi Ito) +Solution: Set fileformat to "unix". (Christian Brabandt) +Files: src/testdir/test_listchars.in + +Patch 7.4.734 +Problem: ml_get error when using "p" in a Visual selection in the last + line. +Solution: Change the behavior at the last line. (Yukihiro Nakadaira) +Files: src/normal.c, src/ops.c, src/testdir/test94.in, + src/testdir/test94.ok + +Patch 7.4.735 +Problem: Wrong argument for sizeof(). +Solution: Use a pointer argument. (Chris Hall) +Files: src/eval.c + +Patch 7.4.736 +Problem: Invalid memory access. +Solution: Avoid going over the end of a NUL terminated string. (Dominique + Pelle) +Files: src/regexp.c + +Patch 7.4.737 +Problem: On MS-Windows vimgrep over arglist doesn't work (Issue 361) +Solution: Only escape backslashes in ## expansion when it is not used as the + path separator. (James McCoy) +Files: src/ex_docmd.c + +Patch 7.4.738 (after 7.4.732) +Problem: Can't compile without the syntax highlighting feature. +Solution: Add #ifdef around use of w_p_cul. (Hirohito Higashi) +Files: src/normal.c, src/screen.c + +Patch 7.4.739 +Problem: In a string "\U" only takes 4 digits, while after CTRL-V U eight + digits can be used. +Solution: Make "\U" also take eight digits. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.740 +Problem: ":1quit" works like ":.quit". (Bohr Shaw) +Solution: Don't exit Vim when a range is specified. (Christian Brabandt) +Files: src/ex_docmd.c, src/testdir/test13.in, src/testdir/test13.ok + +Patch 7.4.741 +Problem: When using += with ":set" a trailing comma is not recognized. + (Issue 365) +Solution: Don't add a second comma. Add a test. (partly by Christian + Brabandt) +Files: src/option.c, src/testdir/test_set.in, src/testdir/test_set.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.742 +Problem: Cannot specify a vertical split when loading a buffer for a + quickfix command. +Solution: Add the "vsplit" value to 'switchbuf'. (Brook Hong) +Files: runtime/doc/options.txt, src/buffer.c, src/option.h + +Patch 7.4.743 +Problem: "p" in Visual mode causes an unexpected line split. +Solution: Advance the cursor first. (Yukihiro Nakadaira) +Files: src/ops.c, src/testdir/test94.in, src/testdir/test94.ok + +Patch 7.4.744 +Problem: No tests for Ruby and Perl. +Solution: Add minimal tests. (Ken Takata) +Files: src/testdir/test_perl.in, src/testdir/test_perl.ok, + src/testdir/test_ruby.in, src/testdir/test_ruby.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.745 +Problem: The entries added by matchaddpos() are returned by getmatches() + but can't be set with setmatches(). (Lcd) +Solution: Fix setmatches(). (Christian Brabandt) +Files: src/eval.c, src/testdir/test63.in, src/testdir/test63.ok + +Patch 7.4.746 +Problem: ":[count]tag" is not always working. (cs86661) +Solution: Set cur_match a bit later. (Hirohito Higashi) +Files: src/tag.c, + +Patch 7.4.747 +Problem: ":cnext" may jump to the wrong column when setting + 'virtualedit=all' (cs86661) +Solution: Reset the coladd field. (Hirohito Higashi) +Files: src/quickfix.c + +Patch 7.4.748 (after 7.4.745) +Problem: Buffer overflow. +Solution: Make the buffer larger. (Kazunobu Kuriyama) +Files: src/eval.c + +Patch 7.4.749 (after 7.4.741) +Problem: For some options two consecutive commas are OK. (Nikolai Pavlov) +Solution: Add the P_ONECOMMA flag. +Files: src/option.c + +Patch 7.4.750 +Problem: Cannot build with clang 3.5 on Cygwin with perl enabled. +Solution: Strip "-fdebug-prefix-map" in configure. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.751 +Problem: It is not obvious how to enable the address sanitizer. +Solution: Add commented-out flags in the Makefile. (Dominique Pelle) + Also add missing test targets. +Files: src/Makefile + +Patch 7.4.752 +Problem: Unicode 8.0 not supported. +Solution: Update tables for Unicode 8.0. Avoid E36 when running the script. + (James McCoy) +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.753 +Problem: Appending in Visual mode with 'linebreak' set does not work + properly. Also when 'selection' is "exclusive". (Ingo Karkat) +Solution: Recalculate virtual columns. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.754 +Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson) +Solution: Make it increment all numbers in the Visual area. (Christian + Brabandt) +Files: runtime/doc/change.txt, src/normal.c, src/ops.c, + src/proto/ops.pro, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.755 +Problem: It is not easy to count the number of characters. +Solution: Add the skipcc argument to strchars(). (Hirohito Higashi, Ken + Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_utf8.in, + src/testdir/test_utf8.ok + +Patch 7.4.756 +Problem: Can't use strawberry Perl 5.22 x64 on MS-Windows. +Solution: Add new defines and #if. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/if_perl.xs + +Patch 7.4.757 +Problem: Cannot detect the background color of a terminal. +Solution: Add T_RBG to request the background color if possible. (Lubomir + Rintel) +Files: src/main.c, src/term.c, src/term.h, src/proto/term.pro + +Patch 7.4.758 +Problem: When 'conceallevel' is 1 and quitting the command-line window with + CTRL-C the first character ':' is erased. +Solution: Reset 'conceallevel' in the command-line window. (Hirohito + Higashi) +Files: src/ex_getln.c + +Patch 7.4.759 +Problem: Building with Lua 5.3 doesn't work, symbols have changed. +Solution: Use the new names for the new version. (Felix Schnizlein) +Files: src/if_lua.c + +Patch 7.4.760 +Problem: Spelling mistakes are not displayed after ":syn spell". +Solution: Force a redraw after ":syn spell" command. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.761 (after 7.4.757) +Problem: The request-background termcode implementation is incomplete. +Solution: Add the missing pieces. +Files: src/option.c, src/term.c + +Patch 7.4.762 (after 7.4.757) +Problem: Comment for may_req_bg_color() is wrong. (Christ van Willegen) +Solution: Rewrite the comment. +Files: src/term.c + +Patch 7.4.763 (after 7.4.759) +Problem: Building with Lua 5.1 doesn't work. +Solution: Define lua_replace and lua_remove. (KF Leong) +Files: src/if_lua.c + +Patch 7.4.764 (after 7.4.754) +Problem: test_increment fails on MS-Windows. (Ken Takata) +Solution: Clear Visual mappings. (Taro Muraoka) +Files: src/testdir/test_increment.in + +Patch 7.4.765 (after 7.4.754) +Problem: CTRL-A and CTRL-X in Visual mode do not always work well. +Solution: Improvements for increment and decrement. (Christian Brabandt) +Files: src/normal.c, src/ops.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.766 (after 7.4.757) +Problem: Background color check does not work on Tera Term. +Solution: Also recognize ST as a termination character. (Hirohito Higashi) +Files: src/term.c + +Patch 7.4.767 +Problem: --remote-tab-silent can fail on MS-Windows. +Solution: Use single quotes to avoid problems with backslashes. (Idea by + Weiyong Mao) +Files: src/main.c + +Patch 7.4.768 +Problem: :diffoff only works properly once. +Solution: Also make :diffoff work when used a second time. (Olaf Dabrunz) +Files: src/diff.c + +Patch 7.4.769 (after 7.4 768) +Problem: Behavior of :diffoff is not tested. +Solution: Add a bit of testing. (Olaf Dabrunz) +Files: src/testdir/test47.in, src/testdir/test47.ok + +Patch 7.4.770 (after 7.4.766) +Problem: Background color response with transparency is not ignored. +Solution: Change the way escape sequences are recognized. (partly by + Hirohito Higashi) +Files: src/ascii.h, src/term.c + +Patch 7.4.771 +Problem: Search does not handle multi-byte character at the start position + correctly. +Solution: Take byte size of character into account. (Yukihiro Nakadaira) +Files: src/search.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_search_mbyte.in, + src/testdir/test_search_mbyte.ok + +Patch 7.4.772 +Problem: Racket 6.2 is not supported on MS-Windows. +Solution: Check for the "racket" subdirectory. (Weiyong Mao) +Files: src/Make_mvc.mak, src/if_mzsch.c + +Patch 7.4.773 +Problem: 'langmap' is used in command-line mode when checking for mappings. + Issue 376. +Solution: Do not use 'langmap' in command-line mode. (Larry Velazquez) +Files: src/getchar.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.774 +Problem: When using the CompleteDone autocommand event it's difficult to + get to the completed items. +Solution: Add the v:completed_items variable. (Shougo Matsu) +Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/edit.c, + src/eval.c, src/macros.h, src/proto/eval.pro, src/vim.h + +Patch 7.4.775 +Problem: It is not possible to avoid using the first item of completion. +Solution: Add the "noinsert" and "noselect" values to 'completeopt'. (Shougo + Matsu) +Files: runtime/doc/options.txt, src/edit.c, src/option.c + +Patch 7.4.776 +Problem: Equivalence class for 'd' does not work correctly. +Solution: Fix 0x1e0f and 0x1d0b. (Dominique Pelle) +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.777 +Problem: The README file doesn't look nice on github. +Solution: Add a markdown version of the README file. +Files: Filelist, README.md + +Patch 7.4.778 +Problem: Coverity warns for uninitialized variable. +Solution: Change condition of assignment. +Files: src/ops.c + +Patch 7.4.779 +Problem: Using CTRL-A in a line without a number moves the cursor. May + cause a crash when at the start of the line. (Urtica Dioica) +Solution: Do not move the cursor if no number was changed. +Files: src/ops.c + +Patch 7.4.780 +Problem: Compiler complains about uninitialized variable and clobbered + variables. +Solution: Add Initialization. Make variables static. +Files: src/ops.c, src/main.c + +Patch 7.4.781 +Problem: line2byte() returns one less when 'bin' and 'noeol' are set. +Solution: Only adjust the size for the last line. (Rob Wu) +Files: src/memline.c + +Patch 7.4.782 +Problem: Still a few problems with CTRL-A and CTRL-X in Visual mode. +Solution: Fix the reported problems. (Christian Brabandt) +Files: src/charset.c, src/eval.c, src/ex_cmds.c, src/ex_getln.c, + src/misc2.c, src/normal.c, src/ops.c, src/option.c, + src/proto/charset.pro, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.783 +Problem: copy_chars() and copy_spaces() are inefficient. +Solution: Use memset() instead. (Dominique Pelle) +Files: src/ex_getln.c, src/misc2.c, src/ops.c, src/proto/misc2.pro, + src/screen.c + +Patch 7.4.784 +Problem: Using both "noinsert" and "noselect" in 'completeopt' does not + work properly. +Solution: Change the ins_complete() calls. (Ozaki Kiichi) +Files: src/edit.c + +Patch 7.4.785 +Problem: On some systems automatically adding the missing EOL causes + problems. Setting 'binary' has too many side effects. +Solution: Add the 'fixeol' option, default on. (Pavel Samarkin) +Files: src/buffer.c, src/fileio.c, src/memline.c, src/netbeans.c, + src/ops.c, src/option.c, src/option.h, src/os_unix.c, + src/os_win32.c, src/structs.h, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_fixeol.in, + src/testdir/test_fixeol.ok, runtime/doc/options.txt, + runtime/optwin.vim + +Patch 7.4.786 +Problem: It is not possible for a plugin to adjust to a changed setting. +Solution: Add the OptionSet autocommand event. (Christian Brabandt) +Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/eval.c, + src/fileio.c, src/option.c, src/proto/eval.pro, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok, src/vim.h + +Patch 7.4.787 (after 7.4.786) +Problem: snprintf() isn't available everywhere. +Solution: Use vim_snprintf(). (Ken Takata) +Files: src/option.c + +Patch 7.4.788 (after 7.4.787) +Problem: Can't build without the crypt feature. (John Marriott) +Solution: Add #ifdef's. +Files: src/option.c + +Patch 7.4.789 (after 7.4.788) +Problem: Using freed memory and crash. (Dominique Pelle) +Solution: Correct use of pointers. (Hirohito Higashi) +Files: src/option.c + +Patch 7.4.790 (after 7.4.786) +Problem: Test fails when the autochdir feature is not available. Test + output contains the test script. +Solution: Check for the autochdir feature. (Kazunobu Kuriyama) Only write + the relevant test output. +Files: src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok + +Patch 7.4.791 +Problem: The buffer list can be very long. +Solution: Add an argument to ":ls" to specify the type of buffer to list. + (Marcin Szamotulski) +Files: runtime/doc/windows.txt, src/buffer.c, src/ex_cmds.h + +Patch 7.4.792 +Problem: Can only conceal text by defining syntax items. +Solution: Use matchadd() to define concealing. (Christian Brabandt) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c, + src/proto/window.pro, src/screen.c, src/structs.h, + src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_match_conceal.in, + src/testdir/test_match_conceal.ok, src/window.c + +Patch 7.4.793 +Problem: Can't specify when not to ring the bell. +Solution: Add the 'belloff' option. (Christian Brabandt) +Files: runtime/doc/options.txt, src/edit.c, src/ex_getln.c, + src/hangulin.c, src/if_lua.c, src/if_mzsch.c, src/if_tcl.c, + src/message.c, src/misc1.c, src/normal.c, src/option.c, + src/option.h, src/proto/misc1.pro, src/search.c, src/spell.c + +Patch 7.4.794 +Problem: Visual Studio 2015 is not recognized. +Solution: Add the version numbers to the makefile. (Taro Muraoka) +Files: src/Make_mvc.mak + +Patch 7.4.795 +Problem: The 'fixeol' option is not copied to a new window. +Solution: Copy the option value. (Yasuhiro Matsumoto) +Files: src/option.c + +Patch 7.4.796 +Problem: Warning from 64 bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/ops.c + +Patch 7.4.797 +Problem: Crash when using more lines for the command line than + 'maxcombine'. +Solution: Use the correct array index. Also, do not try redrawing when + exiting. And use screen_Columns instead of Columns. +Files: src/screen.c + +Patch 7.4.798 (after 7.4.753) +Problem: Repeating a change in Visual mode does not work as expected. + (Urtica Dioica) +Solution: Make redo in Visual mode work better. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.799 +Problem: Accessing memory before an allocated block. +Solution: Check for not going before the start of a pattern. (Dominique + Pelle) +Files: src/fileio.c + +Patch 7.4.800 +Problem: Using freed memory when triggering CmdUndefined autocommands. +Solution: Set pointer to NULL. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.801 (after 7.4.769) +Problem: Test for ":diffoff" doesn't catch all potential problems. +Solution: Add a :diffthis and a :diffoff command. (Olaf Dabrunz) +Files: src/testdir/test47.in + +Patch 7.4.802 +Problem: Using "A" in Visual mode while 'linebreak' is set is not tested. +Solution: Add a test for this, verifies the problem is fixed. (Ingo Karkat) +Files: src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.803 +Problem: C indent does not support C11 raw strings. (Mark Lodato) +Solution: Do not change indent inside the raw string. +Files: src/search.c, src/misc1.c, src/edit.c, src/ops.c, + src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.804 +Problem: Xxd doesn't have a license notice. +Solution: Add license as indicated by Juergen. +Files: src/xxd/xxd.c + +Patch 7.4.805 +Problem: The ruler shows "Bot" even when there are only filler lines + missing. (Gary Johnson) +Solution: Use "All" when the first line and one filler line are visible. +Files: src/buffer.c + +Patch 7.4.806 +Problem: CTRL-A in Visual mode doesn't work properly with "alpha" in + 'nrformats'. +Solution: Make it work. (Christian Brabandt) +Files: src/ops.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.807 (after 7.4.798) +Problem: After CTRL-V CTRL-A mode isn't updated. (Hirohito Higashi) +Solution: Clear the command line or update the displayed command. +Files: src/normal.c + +Patch 7.4.808 +Problem: On MS-Windows 8 IME input doesn't work correctly. +Solution: Read console input before calling MsgWaitForMultipleObjects(). + (vim-jp, Nobuhiro Takasaki) +Files: src/os_win32.c + +Patch 7.4.809 (after 7.4.802) +Problem: Test is duplicated. +Solution: Roll back 7.4.802. +Files: src/testdir/test39.in, src/testdir/test39.ok + +Patch 7.4.810 +Problem: With a sequence of commands using buffers in diff mode E749 is + given. (itchyny) +Solution: Skip unloaded buffer. (Hirohito Higashi) +Files: src/diff.c + +Patch 7.4.811 +Problem: Invalid memory access when using "exe 'sc'". +Solution: Avoid going over the end of the string. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.812 +Problem: Gcc sanitizer complains about using a NULL pointer to memmove(). +Solution: Only call memmove when there is something to move. (Vittorio + Zecca) +Files: src/memline.c + +Patch 7.4.813 +Problem: It is not possible to save and restore character search state. +Solution: Add getcharsearch() and setcharsearch(). (James McCoy) +Files: runtime/doc/eval.txt, src/eval.c, src/proto/search.pro, + src/search.c, src/testdir/test_charsearch.in, + src/testdir/test_charsearch.ok, src/testdir/Makefile, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms + +Patch 7.4.814 +Problem: Illegal memory access with "sy match a fold". +Solution: Check for empty string. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.815 +Problem: Invalid memory access when doing ":call g:". +Solution: Check for an empty name. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.816 +Problem: Invalid memory access when doing ":fun X(". +Solution: Check for missing ')'. (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.817 +Problem: Invalid memory access in file_pat_to_reg_pat(). +Solution: Use vim_isspace() instead of checking for a space only. (Dominique + Pelle) +Files: src/fileio.c + +Patch 7.4.818 +Problem: 'linebreak' breaks c% if the last Visual selection was block. + (Chris Morganiser, Issue 389) +Solution: Handle Visual block mode differently. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.819 +Problem: Beeping when running the tests. +Solution: Fix 41 beeps. (Roland Eggner) +Files: src/testdir/test17.in, src/testdir/test29.in, + src/testdir/test4.in, src/testdir/test61.in, + src/testdir/test82.in, src/testdir/test83.in, + src/testdir/test90.in, src/testdir/test95.in, + src/testdir/test_autoformat_join.in + +Patch 7.4.820 +Problem: Invalid memory access in file_pat_to_reg_pat. +Solution: Avoid looking before the start of a string. (Dominique Pelle) +Files: src/fileio.c + +Patch 7.4.821 +Problem: Coverity reports a few problems. +Solution: Avoid the warnings. (Christian Brabandt) +Files: src/ex_docmd.c, src/option.c, src/screen.c + +Patch 7.4.822 +Problem: More problems reported by coverity. +Solution: Avoid the warnings. (Christian Brabandt) +Files: src/os_unix.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_getln.c, src/fold.c, src/gui.c, src/gui_w16.c, + src/gui_w32.c, src/if_cscope.c, src/if_xcmdsrv.c, src/move.c, + src/normal.c, src/regexp.c, src/syntax.c, src/ui.c, src/window.c + +Patch 7.4.823 +Problem: Cursor moves after CTRL-A on alphabetic character. +Solution: (Hirohito Higashi, test by Christian Brabandt) +Files: src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/ops.c + +Patch 7.4.824 (after 7.4.813) +Problem: Can't compile without the multi-byte feature. (John Marriott) +Solution: Add #ifdef. +Files: src/eval.c + +Patch 7.4.825 +Problem: Invalid memory access for ":syn keyword x a[". +Solution: Do not skip over the NUL. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.826 +Problem: Compiler warnings and errors. +Solution: Make it build properly without the multi-byte feature. +Files: src/eval.c, src/search.c + +Patch 7.4.827 +Problem: Not all test targets are in the Makefile. +Solution: Add the missing targets. +Files: src/Makefile + +Patch 7.4.828 +Problem: Crash when using "syn keyword x c". (Dominique Pelle) +Solution: Initialize the keyword table. (Raymond Ko, PR 397) +Files: src/syntax.c + +Patch 7.4.829 +Problem: Crash when clicking in beval balloon. (Travis Lebsock) +Solution: Use PostMessage() instead of DestroyWindow(). (Raymond Ko, PR 298) +Files: src/gui_w32.c + +Patch 7.4.830 +Problem: Resetting 'encoding' when doing ":set all&" causes problems. + (Bjorn Linse) Display is not updated. +Solution: Do not reset 'encoding'. Do a full redraw. +Files: src/option.c + +Patch 7.4.831 +Problem: When expanding `=expr` on the command line and encountering an + error, the command is executed anyway. +Solution: Bail out when an error is detected. +Files: src/misc1.c + +Patch 7.4.832 +Problem: $HOME in `=$HOME . '/.vimrc'` is expanded too early. +Solution: Skip over `=expr` when expanding environment names. +Files: src/misc1.c + +Patch 7.4.833 +Problem: More side effects of ":set all&" are missing. (Björn Linse) +Solution: Call didset_options() and add didset_options2() to collect more + side effects to take care of. Still not everything... +Files: src/option.c + +Patch 7.4.834 +Problem: gettabvar() doesn't work after Vim start. (Szymon Wrozynski) +Solution: Handle first window in tab still being NULL. (Christian Brabandt) +Files: src/eval.c, src/testdir/test91.in, src/testdir/test91.ok + +Patch 7.4.835 +Problem: Comparing utf-8 sequences does not handle different byte sizes + correctly. +Solution: Get the byte size of each character. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.836 +Problem: Accessing uninitialized memory. +Solution: Add missing calls to init_tv(). (Dominique Pelle) +Files: src/eval.c + +Patch 7.4.837 +Problem: Compiler warning with MSVC compiler when using +sniff. +Solution: Use Sleep() instead of _sleep(). (Tux) +Files: src/if_sniff.c + +Patch 7.4.838 (after 7.4.833) +Problem: Can't compile without the crypt feature. (John Marriott) +Solution: Add #ifdef. +Files: src/option.c + +Patch 7.4.839 +Problem: Compiler warning on 64-bit system. +Solution: Add cast to int. (Mike Williams) +Files: src/search.c + +Patch 7.4.840 (after 7.4.829) +Problem: Tooltip window stays open. +Solution: Send a WM_CLOSE message. (Jurgen Kramer) +Files: src/gui_w32.c + +Patch 7.4.841 +Problem: Can't compile without the multi-byte feature. (John Marriott) +Solution: Add more #ifdef's. +Files: src/option.c + +Patch 7.4.842 (after 7.4.840) +Problem: Sending too many messages to close the balloon. +Solution: Only send a WM_CLOSE message. (Jurgen Kramer) +Files: src/gui_w32.c + +Patch 7.4.843 (after 7.4.835) +Problem: Still possible to go beyond the end of a string. +Solution: Check for NUL also in second string. (Dominique Pelle) +Files: src/misc2.c + +Patch 7.4.844 +Problem: When '#' is in 'isident' the is# comparator doesn't work. +Solution: Don't use vim_isIDc(). (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_comparators.in, + src/testdir/test_comparators.ok, src/testdir/Makefile, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms + +Patch 7.4.845 +Problem: Compiler warning for possible loss of data. +Solution: Add a type cast. (Erich Ritz) +Files: src/misc1.c + +Patch 7.4.846 +Problem: Some GitHub users don't know how to use issues. +Solution: Add a file that explains the basics of contributing. +Files: Filelist, CONTRIBUTING.md + +Patch 7.4.847 +Problem: "vi)d" may leave a character behind. +Solution: Skip over multi-byte character. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.848 +Problem: CTRL-A on hex number in Visual block mode is incorrect. +Solution: Account for the "0x". (Hirohito Higashi) +Files: src/charset.c, src/testdir/test_increment.in, + src/testdir/test_increment.ok + +Patch 7.4.849 +Problem: Moving the cursor in Insert mode starts new undo sequence. +Solution: Add CTRL-G U to keep the undo sequence for the following cursor + movement command. (Christian Brabandt) +Files: runtime/doc/insert.txt, src/edit.c, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok + +Patch 7.4.850 (after 7.4.846) +Problem: <Esc> does not show up. +Solution: Use > and <. (Kazunobu Kuriyama) +Files: CONTRIBUTING.md + +Patch 7.4.851 +Problem: Saving and restoring the console buffer does not work properly. +Solution: Instead of ReadConsoleOutputA/WriteConsoleOutputA use + CreateConsoleScreenBuffer and SetConsoleActiveScreenBuffer. + (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.852 +Problem: On MS-Windows console Vim uses ANSI APIs for keyboard input and + console output, it cannot input/output Unicode characters. +Solution: Use Unicode APIs for console I/O. (Ken Takata, Yasuhiro Matsumoto) +Files: src/os_win32.c, src/ui.c, runtime/doc/options.txt + +Patch 7.4.853 +Problem: "zt" in diff mode does not always work properly. (Gary Johnson) +Solution: Don't count filler lines twice. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.854 (after 7.4.850) +Problem: Missing information about runtime files. +Solution: Add section about runtime files. (Christian Brabandt) +Files: CONTRIBUTING.md + +Patch 7.4.855 +Problem: GTK: font glitches for combining characters +Solution: Use pango_shape_full() instead of pango_shape(). (luchr, PR #393) +Files: src/gui_gtk_x11.c + +Patch 7.4.856 +Problem: "zt" still doesn't work well with filler lines. (Gary Johnson) +Solution: Check for filler lines above the cursor. (Christian Brabandt) +Files: src/move.c + +Patch 7.4.857 +Problem: Dragging the current tab with the mouse doesn't work properly. +Solution: Take the current tabpage index into account. (Hirohito Higashi) +Files: src/normal.c + +Patch 7.4.858 +Problem: It's a bit clumsy to execute a command on a list of matches. +Solution: Add the ":ldo", ":lfdo", ":cdo" and ":cfdo" commands. (Yegappan + Lakshmanan) +Files: runtime/doc/cmdline.txt, runtime/doc/editing.txt, + runtime/doc/index.txt, runtime/doc/quickfix.txt, + runtime/doc/tabpage.txt, runtime/doc/windows.txt, src/ex_cmds.h, + src/ex_cmds2.c, src/ex_docmd.c, src/proto/quickfix.pro, + src/quickfix.c, src/testdir/Make_amiga.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, + src/testdir/Makefile, src/testdir/test_cdo.in, + src/testdir/test_cdo.ok + +Patch 7.4.859 +Problem: Vim doesn't recognize all htmldjango files. +Solution: Recognize a comment. (Daniel Hahler, PR #410) +Files: runtime/filetype.vim + +Patch 7.4.860 +Problem: Filetype detection is outdated. +Solution: Include all recent and not-so-recent changes. +Files: runtime/filetype.vim + +Patch 7.4.861 (after 7.4.855) +Problem: pango_shape_full() is not always available. +Solution: Add a configure check. +Files: src/configure.in, src/auto/configure, src/config.h.in, + src/gui_gtk_x11.c + +Patch 7.4.862 (after 7.4.861) +Problem: Still problems with pango_shape_full() not available. +Solution: Change AC_TRY_COMPILE to AC_TRY_LINK. +Files: src/configure.in, src/auto/configure + +Patch 7.4.863 (after 7.4.856) +Problem: plines_nofill() used without the diff feature. +Solution: Define PLINES_NOFILL(). +Files: src/macros.h, src/move.c + +Patch 7.4.864 (after 7.4.858) +Problem: Tiny build fails. +Solution: Put qf_ items inside #ifdef. +Files: src/ex_docmd.c + +Patch 7.4.865 +Problem: Compiler warning for uninitialized variable. +Solution: Initialize. +Files: src/ex_cmds2.c + +Patch 7.4.866 +Problem: Crash when changing the 'tags' option from a remote command. + (Benjamin Fritz) +Solution: Instead of executing messages immediately, use a queue, like for + netbeans. (James Kolb) +Files: src/ex_docmd.c, src/getchar.c, src/gui_gtk_x11.c, src/gui_w48.c, + src/gui_x11.c, src/if_xcmdsrv.c, src/misc2.c, src/os_unix.c, + src/proto/if_xcmdsrv.pro, src/proto/misc2.pro, src/macros.h + +Patch 7.4.867 (after 7.4.866) +Problem: Can't build on MS-Windows. (Taro Muraoka) +Solution: Adjust #ifdef. +Files: src/misc2.c + +Patch 7.4.868 +Problem: 'smarttab' is also effective when 'paste' is enabled. (Alexander + Monakov) +Solution: Disable 'smarttab' when 'paste' is set. (Christian Brabandt) + Do the same for 'expandtab'. +Files: src/option.c, src/structs.h + +Patch 7.4.869 +Problem: MS-Windows: scrolling may cause text to disappear when using an + Intel GPU. +Solution: Call GetPixel(). (Yohei Endo) +Files: src/gui_w48.c + +Patch 7.4.870 +Problem: May get into an invalid state when using getchar() in an + expression mapping. +Solution: Anticipate mod_mask to change. (idea by Yukihiro Nakadaira) +Files: src/getchar.c + +Patch 7.4.871 +Problem: Vim leaks memory, when 'wildignore' filters out all matches. +Solution: Free the files array when it becomes empty. +Files: src/misc1.c + +Patch 7.4.872 +Problem: Not using CI services available. +Solution: Add configuration files for travis and appveyor. (Ken Takata, + vim-jp, PR #401) +Files: .travis.yml, appveyor.yml, Filelist + +Patch 7.4.873 (after 7.4.866) +Problem: Compiler warning for unused variable. (Tony Mechelynck) +Solution: Remove the variable. Also fix int vs long_u mixup. +Files: src/if_xcmdsrv.c + +Patch 7.4.874 +Problem: MS-Windows: When Vim runs inside another application, the size + isn't right. +Solution: When in child mode compute the size differently. (Agorgianitis + Loukas) +Files: src/gui_w48.c + +Patch 7.4.875 +Problem: Not obvious how to contribute. +Solution: Add a remark about CONTRIBUTING.md to README.md +Files: README.md + +Patch 7.4.876 +Problem: Windows7: when using vim.exe with msys or msys2, conhost.exe + (console window provider on Windows7) will freeze or crash. +Solution: Make original screen buffer active, before executing external + program. And when the program is finished, revert to vim's one. + (Taro Muraoka) +Files: src/os_win32.c + +Patch 7.4.877 (after 7.4.843) +Problem: ":find" sometimes fails. (Excanoe) +Solution: Compare current characters instead of previous ones. +Files: src/misc2.c + +Patch 7.4.878 +Problem: Coverity error for clearing only one byte of struct. +Solution: Clear the whole struct. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.879 +Problem: Can't see line numbers in nested function calls. +Solution: Add line number to the file name. (Alberto Fanjul) +Files: src/eval.c + +Patch 7.4.880 +Problem: No build and coverage status. +Solution: Add links to the README file. (Christian Brabandt) +Files: README.md + +Patch 7.4.881 (after 7.4.879) +Problem: Test 49 fails. +Solution: Add line number to check of call stack. +Files: src/testdir/test49.vim + +Patch 7.4.882 +Problem: When leaving the command line window with CTRL-C while a + completion menu is displayed the menu isn't removed. +Solution: Force a screen update. (Hirohito Higashi) +Files: src/edit.c + +Patch 7.4.883 (after 7.4.818) +Problem: Block-mode replace works characterwise instead of blockwise after + column 147. (Issue #422) +Solution: Set Visual mode. (Christian Brabandt) +Files: src/normal.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.884 +Problem: Travis also builds on a tag push. +Solution: Filter out tag pushes. (Kenichi Ito) +Files: .travis.yml + +Patch 7.4.885 +Problem: When doing an upwards search without wildcards the search fails if + the initial directory doesn't exist. +Solution: Fix the non-wildcard case. (Stefan Kempf) +Files: src/misc2.c + +Patch 7.4.886 (after 7.4.876) +Problem: Windows7: Switching screen buffer causes flicker when using + system(). +Solution: Instead of actually switching screen buffer, duplicate the handle. + (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.887 +Problem: Using uninitialized memory for regexp with back reference. + (Dominique Pelle) +Solution: Initialize end_lnum. +Files: src/regexp_nfa.c + +Patch 7.4.888 +Problem: The OptionSet autocommands are not triggered from setwinvar(). +Solution: Do not use switch_win() when not needed. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.889 +Problem: Triggering OptionSet from setwinvar() isn't tested. +Solution: Add a test. (Christian Brabandt) +Files: src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok + +Patch 7.4.890 +Problem: Build failure when using dynamic python but not python3. +Solution: Adjust the #if to also include DYNAMIC_PYTHON3 and UNIX. +Files: src/if_python3.c + +Patch 7.4.891 +Problem: Indentation of array initializer is wrong. +Solution: Avoid that calling find_start_rawstring() changes the position + returned by find_start_comment(), add a test. (Hirohito Higashi) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.892 +Problem: On MS-Windows the iconv DLL may have a different name. +Solution: Also try libiconv2.dll and libiconv-2.dll. (Yasuhiro Matsumoto) +Files: src/mbyte.c + +Patch 7.4.893 +Problem: C indenting is wrong below a "case (foo):" because it is + recognized as a C++ base class construct. Issue #38. +Solution: Check for the case keyword. +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.894 +Problem: vimrun.exe is picky about the number of spaces before -s. +Solution: Skip all spaces. (Cam Sinclair) +Files: src/vimrun.c + +Patch 7.4.895 +Problem: Custom command line completion does not work for a command + containing digits. +Solution: Skip over the digits. (suggested by Yasuhiro Matsumoto) +Files: src/ex_docmd.c + +Patch 7.4.896 +Problem: Editing a URL, which netrw should handle, doesn't work. +Solution: Avoid changing slashes to backslashes. (Yasuhiro Matsumoto) +Files: src/fileio.c, src/os_mswin.c + +Patch 7.4.897 +Problem: Freeze and crash when there is a sleep in a remote command. + (Karl Yngve Lervåg) +Solution: Remove a message from the queue before dealing with it. (James + Kolb) +Files: src/if_xcmdsrv.c + +Patch 7.4.898 +Problem: The 'fixendofline' option is set on with ":edit". +Solution: Don't set the option when clearing a buffer. (Yasuhiro Matsumoto) +Files: src/buffer.c + +Patch 7.4.899 +Problem: README file is not optimal. +Solution: Move buttons, update some text. (closes #460) +Files: README.txt, README.md + +Patch 7.4.900 (after 7.4.899) +Problem: README file can still be improved +Solution: Add a couple of links. (Christian Brabandt) +Files: README.md + +Patch 7.4.901 +Problem: When a BufLeave autocommand changes folding in a way it syncs + undo, undo can be corrupted. +Solution: Prevent undo sync. (Jacob Niehus) +Files: src/popupmnu.c + +Patch 7.4.902 +Problem: Problems with using the MS-Windows console. +Solution: Revert patches 7.4.851, 7.4.876 and 7.4.886 until we find a better + solution. (suggested by Ken Takata) +Files: src/os_win32.c + +Patch 7.4.903 +Problem: MS-Windows: When 'encoding' differs from the current code page, + expanding wildcards may cause illegal memory access. +Solution: Allocate a longer buffer. (Ken Takata) +Files: src/misc1.c + +Patch 7.4.904 +Problem: Vim does not provide .desktop files. +Solution: Include and install .desktop files. (James McCoy, closes #455) +Files: Filelist, runtime/vim.desktop, runtime/gvim.desktop, src/Makefile + +Patch 7.4.905 +Problem: Python interface can produce error "vim.message' object has no + attribute 'isatty'". +Solution: Add dummy isatty(), readable(), etc. (closes #464) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.906 +Problem: On MS-Windows the viminfo file is (always) given the hidden + attribute. (raulnac) +Solution: Check the hidden attribute in a different way. (Ken Takata) +Files: src/ex_cmds.c, src/os_win32.c, src/os_win32.pro + +Patch 7.4.907 +Problem: Libraries for dynamically loading interfaces can only be defined + at compile time. +Solution: Add options to specify the dll names. (Kazuki Sakamoto, + closes #452) +Files: runtime/doc/if_lua.txt, runtime/doc/if_perl.txt, + runtime/doc/if_pyth.txt, runtime/doc/if_ruby.txt, + runtime/doc/options.txt, src/if_lua.c, src/if_perl.xs, + src/if_python.c, src/if_python3.c, src/if_ruby.c, src/option.c, + src/option.h + +Patch 7.4.908 (after 7.4.907) +Problem: Build error with MingW compiler. (Cesar Romani) +Solution: Change #if into #ifdef. +Files: src/if_perl.xs + +Patch 7.4.909 (after 7.4.905) +Problem: "make install" fails. +Solution: Only try installing desktop files if the destination directory + exists. +Files: src/Makefile + +Patch 7.4.910 (after 7.4.905) +Problem: Compiler complains about type punned pointer. +Solution: Use another way to increment the ref count. +Files: src/if_py_both.h + +Patch 7.4.911 +Problem: t_Ce and t_Cs are documented but not supported. (Hirohito Higashi) +Solution: Define the options. +Files: src/option.c + +Patch 7.4.912 +Problem: Wrong indenting for C++ constructor. +Solution: Recognize ::. (Anhong) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 7.4.913 +Problem: No utf-8 support for the hangul input feature. +Solution: Add utf-8 support. (Namsh) +Files: src/gui.c, src/hangulin.c, src/proto/hangulin.pro, src/screen.c, + src/ui.c, runtime/doc/hangulin.txt, src/feature.h + +Patch 7.4.914 +Problem: New compiler warning: logical-not-parentheses +Solution: Silence the warning. +Files: src/term.c + +Patch 7.4.915 +Problem: When removing from 'path' and then adding, a comma may go missing. + (Malcolm Rowe) +Solution: Fix the check for P_ONECOMMA. (closes #471) +Files: src/option.c, src/testdir/test_options.in, + src/testdir/test_options.ok + +Patch 7.4.916 +Problem: When running out of memory while copying a dict memory may be + freed twice. (ZyX) +Solution: Do not call the garbage collector when running out of memory. +Files: src/misc2.c + +Patch 7.4.917 +Problem: Compiler warning for comparing signed and unsigned. +Solution: Add a type cast. +Files: src/hangulin.c + +Patch 7.4.918 +Problem: A digit in an option name has problems. +Solution: Rename 'python3dll' to 'pythonthreedll'. +Files: src/option.c, src/option.h, runtime/doc/options.txt + +Patch 7.4.919 +Problem: The dll options are not in the options window. +Solution: Add the dll options. And other fixes. +Files: runtime/optwin.vim + +Patch 7.4.920 +Problem: The rubydll option is not in the options window. +Solution: Add the rubydll option. +Files: runtime/optwin.vim + +Patch 7.4.921 (after 7.4.906) +Problem: Missing proto file update. (Randall W. Morris) +Solution: Add the missing line for mch_ishidden. +Files: src/proto/os_win32.pro + +Patch 7.4.922 +Problem: Leaking memory with ":helpt {dir-not-exists}". +Solution: Free dirname. (Dominique Pelle) +Files: src/ex_cmds.c + +Patch 7.4.923 +Problem: Prototypes not always generated. +Solution: Change #if to OR with PROTO. +Files: src/window.c + +Patch 7.4.924 +Problem: DEVELOPER_DIR gets reset by configure. +Solution: Do not reset DEVELOPER_DIR when there is no --with-developer-dir + argument. (Kazuki Sakamoto, closes #482) +Files: src/configure.in, src/auto/configure + +Patch 7.4.925 +Problem: User may yank or put using the register being recorded in. +Solution: Add the recording register in the message. (Christian Brabandt, + closes #470) +Files: runtime/doc/options.txt, runtime/doc/repeat.txt, src/ops.c, + src/option.h, src/screen.c + +Patch 7.4.926 +Problem: Completing the longest match doesn't work properly with multi-byte + characters. +Solution: When using multi-byte characters use another way to find the + longest match. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_utf8.in, src/testdir/test_utf8.ok + +Patch 7.4.927 +Problem: Ruby crashes when there is a runtime error. +Solution: Use ruby_options() instead of ruby_process_options(). (Damien) +Files: src/if_ruby.c + +Patch 7.4.928 +Problem: A clientserver message interrupts handling keys of a mapping. +Solution: Have mch_inchar() send control back to WaitForChar when it is + interrupted by server message. (James Kolb) +Files: src/os_unix.c + +Patch 7.4.929 +Problem: "gv" after paste selects one character less if 'selection' is + "exclusive". +Solution: Increment the end position. (Christian Brabandt) +Files: src/normal.c, src/testdir/test94.in, src/testdir/test94.ok + +Patch 7.4.930 +Problem: MS-Windows: Most users appear not to like the window border. +Solution: Remove WS_EX_CLIENTEDGE. (Ian Halliday) +Files: src/gui_w32.c + +Patch 7.4.931 (after 7.4.929) +Problem: Test 94 fails on some systems. +Solution: Set 'encoding' to utf-8. +Files: src/testdir/test94.in + +Patch 7.4.932 (after 7.4.926) +Problem: test_utf8 has confusing dummy command. +Solution: Use a real command instead of a colon. +Files: src/testdir/test_utf8.in + +Patch 7.4.933 (after 7.4.926) +Problem: Crash when using longest completion match. +Solution: Fix array index. +Files: src/ex_getln.c + +Patch 7.4.934 +Problem: Appveyor also builds on a tag push. +Solution: Add a skip_tags line. (Kenichi Ito, closes #489) +Files: appveyor.yml + +Patch 7.4.935 (after 7.4.932) +Problem: test_utf8 fails on MS-Windows when executed with gvim. +Solution: Use the insert flag on feedkeys() to put the string before the + ":" that was already read when checking for available chars. +Files: src/testdir/test_utf8.in + +Patch 7.4.936 +Problem: Crash when dragging with the mouse. +Solution: Add safety check for NULL pointer. Check mouse position for valid + value. (Hirohito Higashi) +Files: src/window.c, src/term.c + +Patch 7.4.937 +Problem: Segfault reading uninitialized memory. +Solution: Do not read match \z0, it does not exist. (Marius Gedminas, closes + #497) +Files: src/regexp_nfa.c + +Patch 7.4.938 +Problem: X11 and GTK have more mouse buttons than Vim supports. +Solution: Recognize more mouse buttons. (Benoit Pierre, closes #498) +Files: src/gui_gtk_x11.c, src/gui_x11.c + +Patch 7.4.939 +Problem: Memory leak when encountering a syntax error. +Solution: Free the memory. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.940 +Problem: vt52 terminal codes are not correct. +Solution: Move entries outside of #if. (Random) Adjustments based on + documented codes. +Files: src/term.c + +Patch 7.4.941 +Problem: There is no way to ignore case only for tag searches. +Solution: Add the 'tagcase' option. (Gary Johnson) +Files: runtime/doc/options.txt, runtime/doc/quickref.txt, + runtime/doc/tagsrch.txt, runtime/doc/usr_29.txt, + runtime/optwin.vim, src/Makefile, src/buffer.c, src/option.c, + src/option.h, src/structs.h, src/tag.c, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_tagcase.in, src/testdir/test_tagcase.ok + +Patch 7.4.942 (after 7.4.941) +Problem: test_tagcase breaks for small builds. +Solution: Bail out of the test early. (Hirohito Higashi) +Files: src/testdir/test_tagcase.in + +Patch 7.4.943 +Problem: Tests are not run. +Solution: Add test_writefile to makefiles. (Ken Takata) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.944 +Problem: Writing tests for Vim script is hard. +Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add + the v:errors variable. Add the runtest script. Add a first new + style test script. +Files: src/eval.c, src/vim.h, src/misc2.c, src/testdir/Makefile, + src/testdir/runtest.vim, src/testdir/test_assert.vim, + runtime/doc/eval.txt + +Patch 7.4.945 (after 7.4.944) +Problem: New style testing is incomplete. +Solution: Add the runtest script to the list of distributed files. + Add the new functions to the function overview. + Rename the functions to match Vim function style. + Move undolevels testing into a new style test script. +Files: Filelist, runtime/doc/usr_41.txt, runtime/doc/eval.txt, + src/testdir/test_assert.vim, src/testdir/Makefile, + src/testdir/test_undolevels.vim, src/testdir/test100.in, + src/testdir/test100.ok + +Patch 7.4.946 (after 7.4.945) +Problem: Missing changes in source file. +Solution: Include changes to the eval.c file. +Files: src/eval.c + +Patch 7.4.947 +Problem: Test_listchars fails with MingW. (Michael Soyka) +Solution: Add the test to the ones that need the fileformat fixed. + (Christian Brabandt) +Files: src/testdir/Make_ming.mak + +Patch 7.4.948 +Problem: Can't build when the insert_expand feature is disabled. +Solution: Add #ifdefs. (Dan Pasanen, closes #499) +Files: src/eval.c, src/fileio.c + +Patch 7.4.949 +Problem: When using 'colorcolumn' and there is a sign with a fullwidth + character the highlighting is wrong. (Andrew Stewart) +Solution: Only increment vcol when in the right state. (Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok + +Patch 7.4.950 +Problem: v:errors is not initialized. +Solution: Initialize it to an empty list. (Thinca) +Files: src/eval.c + +Patch 7.4.951 +Problem: Sorting number strings does not work as expected. (Luc Hermitte) +Solution: Add the "N" argument to sort() +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/testdir/test_sort.vim, src/testdir/Makefile + +Patch 7.4.952 +Problem: 'lispwords' is tested in the old way. +Solution: Make a new style test for 'lispwords'. +Files: src/testdir/test_alot.vim, src/testdir/test_lispwords.vim, + src/testdir/test100.in, src/testdir/test100.ok, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.953 +Problem: When a test script navigates to another buffer the .res file is + created with the wrong name. +Solution: Use the "testname" for the .res file. (Damien) +Files: src/testdir/runtest.vim + +Patch 7.4.954 +Problem: When using Lua there may be a crash. (issue #468) +Solution: Avoid using an uninitialized tv. (Yukihiro Nakadaira) +Files: src/if_lua.c + +Patch 7.4.955 +Problem: Vim doesn't recognize .pl6 and .pod6 files. +Solution: Recognize them as perl6 and pod6. (Mike Eve, closes #511) +Files: runtime/filetype.vim + +Patch 7.4.956 +Problem: A few more file name extensions not recognized. +Solution: Add .asciidoc, .bzl, .gradle, etc. +Files: runtime/filetype.vim + +Patch 7.4.957 +Problem: Test_tagcase fails when using another language than English. +Solution: Set the messages language to C. (Kenichi Ito) +Files: src/testdir/test_tagcase.in + +Patch 7.4.958 +Problem: Vim checks if the directory "$TMPDIR" exists. +Solution: Do not check if the name starts with "$". +Files: src/fileio.c + +Patch 7.4.959 +Problem: When setting 'term' the clipboard ownership is lost. +Solution: Do not call clip_init(). (James McCoy) +Files: src/term.c + +Patch 7.4.960 +Problem: Detecting every version of nmake is clumsy. +Solution: Use a tiny C program to get the version of _MSC_VER. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 7.4.961 +Problem: Test107 fails in some circumstances. +Solution: When using "zt", "zb" and "z=" recompute the fraction. +Files: src/normal.c, src/window.c, src/proto/window.pro + +Patch 7.4.962 +Problem: Cannot run the tests with gvim. Cannot run individual new tests. +Solution: Add the -f flag. Add new test targets in Makefile. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.963 +Problem: test_listlbr_utf8 sometimes fails. +Solution: Don't use a literal multibyte character but <C-V>uXXXX. Do not + dump the screen highlighting. (Christian Brabandt, closes #518) +Files: src/testdir/test_listlbr_utf8.in, src/testdir/test_listlbr_utf8.ok + +Patch 7.4.964 +Problem: Test 87 doesn't work in a shadow directory. +Solution: Handle the extra subdirectory. (James McCoy, closes #515) +Files: src/testdir/test87.in + +Patch 7.4.965 +Problem: On FreeBSD /dev/fd/ files are special. +Solution: Use is_dev_fd_file() also for FreeBSD. (Derek Schrock, closes #521) +Files: src/fileio.c + +Patch 7.4.966 +Problem: Configure doesn't work with a space in a path. +Solution: Put paths in quotes. (James McCoy, closes #525) +Files: src/configure.in, src/auto/configure + +Patch 7.4.967 +Problem: Cross compilation on MS-windows doesn't work well. +Solution: Tidy up cross compilation across architectures with Visual Studio. + (Mike Williams) +Files: src/Make_mvc.mak + +Patch 7.4.968 +Problem: test86 and test87 are flaky in Appveyor. +Solution: Reduce the count from 8 to 7. (suggested by ZyX) +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.969 +Problem: Compiler warnings on Windows x64 build. +Solution: Add type casts. (Mike Williams) +Files: src/option.c + +Patch 7.4.970 +Problem: Rare crash in getvcol(). (Timo Mihaljov) +Solution: Check for the buffer being NULL in init_preedit_start_col. + (Hirohito Higashi, Christian Brabandt) +Files: src/mbyte.c + +Patch 7.4.971 +Problem: The asin() function can't be used. +Solution: Sort the function table properly. (Watiko) +Files: src/eval.c + +Patch 7.4.972 +Problem: Memory leak when there is an error in setting an option. +Solution: Free the saved value (Christian Brabandt) +Files: src/option.c + +Patch 7.4.973 +Problem: When pasting on the command line line breaks result in literal + <CR> characters. This makes pasting a long file name difficult. +Solution: Skip the characters. +Files: src/ex_getln.c, src/ops.c + +Patch 7.4.974 +Problem: When using :diffsplit the cursor jumps to the first line. +Solution: Put the cursor on the line related to where the cursor was before + the split. +Files: src/diff.c + +Patch 7.4.975 +Problem: Using ":sort" on a very big file sometimes causes text to be + corrupted. (John Beckett) +Solution: Copy the line into a buffer before calling ml_append(). +Files: src/ex_cmds.c + +Patch 7.4.976 +Problem: When compiling Vim for MSYS2 (linked with msys-2.0.dll), the Win32 + clipboard is not enabled. +Solution: Recognize MSYS like CYGWIN. (Ken Takata) +Files: src/configure.in, src/auto/configure + +Patch 7.4.977 +Problem: 'linebreak' does not work properly when using "space" in + 'listchars'. +Solution: (Hirohito Higashi, Christian Brabandt) +Files: src/screen.c, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok + +Patch 7.4.978 +Problem: test_cdo fails when using another language than English. +Solution: Set the language to C. (Dominique Pelle, Kenichi Ito) +Files: src/testdir/test_cdo.in + +Patch 7.4.979 +Problem: When changing the crypt key the blocks read from disk are not + decrypted. +Solution: Also call ml_decrypt_data() when mf_old_key is set. (Ken Takata) +Files: src/memfile.c + +Patch 7.4.980 +Problem: Tests for :cdo, :ldo, etc. are outdated. +Solution: Add new style tests for these commands. (Yegappan Lakshmanan) +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/test_cdo.in, src/testdir/test_cdo.ok, + src/testdir/test_cdo.vim + +Patch 7.4.981 +Problem: An error in a test script goes unnoticed. +Solution: Source the test script inside try/catch. (Hirohito Higashi) +Files: src/testdir/runtest.vim + +Patch 7.4.982 +Problem: Keeping the list of tests updated is a hassle. +Solution: Move the list to a separate file, so that it only needs to be + updated in one place. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.983 +Problem: Executing one test after "make testclean" doesn't work. +Solution: Add a dependency on test1.out. +Files: src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.984 +Problem: searchpos() always starts searching in the first column, which is + not what some people expect. (Brett Stahlman) +Solution: Add the 'z' flag: start at the specified column. +Files: src/vim.h, src/eval.c, src/search.c, + src/testdir/test_searchpos.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.985 +Problem: Can't build with Ruby 2.3.0. +Solution: Use the new TypedData_XXX macro family instead of Data_XXX. Use + TypedData. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.986 +Problem: Test49 doesn't work on MS-Windows. test70 is listed twice. +Solution: Move test49 to the group not used on Amiga and MS-Windows. + Remove test70 from SCRIPTS_WIN32. +Files: src/testdir/Make_all.mak, src/testdir/Make_dos.mak + +Patch 7.4.987 (after 7.4.985) +Problem: Can't build with Ruby 1.9.2. +Solution: Require Rub 2.0 for defining USE_TYPEDDATA. +Files: src/if_ruby.c + +Patch 7.4.988 (after 7.4.982) +Problem: Default test target is test49.out. +Solution: Add a build rule before including Make_all.mak. +Files: src/testdir/Make_dos.mak, src/testdir/Make_amiga.mak, + src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.989 +Problem: Leaking memory when hash_add() fails. Coverity error 99126. +Solution: When hash_add() fails free the memory. +Files: src/eval.c + +Patch 7.4.990 +Problem: Test 86 fails on AppVeyor. +Solution: Do some registry magic. (Ken Takata) +Files: appveyor.yml + +Patch 7.4.991 +Problem: When running new style tests the output is not visible. +Solution: Add the testdir/messages file and show it. Update the list of + test names. +Files: src/Makefile, src/testdir/Makefile, src/testdir/runtest.vim + +Patch 7.4.992 +Problem: Makefiles for MS-Windows in src/po are outdated. +Solution: Make them work. (Ken Takata, Taro Muraoka) +Files: src/po/Make_cyg.mak, src/po/Make_ming.mak, src/po/Make_mvc.mak, + src/po/README_mingw.txt, src/po/README_mvc.txt + +Patch 7.4.993 +Problem: Test 87 is flaky on AppVeyor. +Solution: Reduce the minimum background thread count. +Files: src/testdir/test86.in, src/testdir/test87.in + +Patch 7.4.994 +Problem: New style tests are not run on MS-Windows. +Solution: Add the new style tests. +Files: src/testdir/Make_dos.mak + +Patch 7.4.995 +Problem: gdk_pixbuf_new_from_inline() is deprecated. +Solution: Generate auto/gui_gtk_gresources.c. (Kazunobu Kuriyama, + closes #507) +Files: src/Makefile, src/auto/configure, src/config.h.in, + src/config.mk.in, src/configure.in, src/gui_gtk.c, + src/gui_gtk_gresources.xml, src/gui_gtk_x11.c, + src/proto/gui_gtk_gresources.pro, + pixmaps/stock_vim_build_tags.png, pixmaps/stock_vim_find_help.png, + pixmaps/stock_vim_save_all.png, + pixmaps/stock_vim_session_load.png, + pixmaps/stock_vim_session_new.png, + pixmaps/stock_vim_session_save.png, pixmaps/stock_vim_shell.png, + pixmaps/stock_vim_window_maximize.png, + pixmaps/stock_vim_window_maximize_width.png, + pixmaps/stock_vim_window_minimize.png, + pixmaps/stock_vim_window_minimize_width.png, + pixmaps/stock_vim_window_split.png, + pixmaps/stock_vim_window_split_vertical.png + +Patch 7.4.996 +Problem: New GDK files and testdir/Make_all.mak missing from distribution. + PC build instructions are outdated. +Solution: Add the file to the list. Update PC build instructions. +Files: Filelist, Makefile + +Patch 7.4.997 +Problem: "make shadow" was sometimes broken. +Solution: Add a test for it. (James McCoy, closes #520) +Files: .travis.yml + +Patch 7.4.998 +Problem: Running tests in shadow directory fails. Test 49 fails. +Solution: Link more files for the shadow directory. Make test 49 ends up in + the right buffer. +Files: src/Makefile, src/testdir/test49.in + +Patch 7.4.999 +Problem: "make shadow" creates a broken link. (Tony Mechelynck) +Solution: Remove vimrc.unix from the list. +Files: src/Makefile + +Patch 7.4.1000 +Problem: Test 49 is slow and doesn't work on MS-Windows. +Solution: Start moving parts of test 49 to test_viml. +Files: src/Makefile, src/testdir/runtest.vim, src/testdir/test_viml.vim, + src/testdir/test49.vim, src/testdir/test49.ok + +Patch 7.4.1001 (after 7.4.1000) +Problem: test_viml isn't run. +Solution: Include change in makefile. +Files: src/testdir/Make_all.mak + +Patch 7.4.1002 +Problem: Cannot run an individual test on MS-Windows. +Solution: Move the rule to run test1 downwards. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1003 +Problem: Travis could check a few more things. +Solution: Run autoconf on one of the builds. (James McCoy, closes #510) + Also build with normal features. +Files: .travis.yml + +Patch 7.4.1004 +Problem: Using Makefile when auto/config.mk does not exist results in + warnings. +Solution: Use default values for essential variables. +Files: src/Makefile + +Patch 7.4.1005 +Problem: Vim users are not always happy. +Solution: Make them happy. +Files: src/ex_cmds.h, src/ex_cmds.c, src/proto/ex_cmds.pro + +Patch 7.4.1006 +Problem: The fix in patch 7.3.192 is not tested. +Solution: Add a test, one for each regexp engine. (Elias Diem) +Files: src/testdir/test44.in, src/testdir/test44.ok, + src/testdir/test99.in, src/testdir/test99.ok + +Patch 7.4.1007 +Problem: When a symbolic link points to a file in the root directory, the + swapfile is not correct. +Solution: Do not try getting the full name of a file in the root directory. + (Milly, closes #501) +Files: src/os_unix.c + +Patch 7.4.1008 +Problem: The OS/2 code pollutes the source while nobody uses it these days. +Solution: Drop the support for OS/2. +Files: src/feature.h, src/globals.h, src/macros.h, src/option.h, + src/os_unix.c, src/os_unix.h, src/proto/os_unix.pro, src/vim.h, + src/digraph.c, src/eval.c, src/ex_cmds.c, src/ex_docmd.c, + src/ex_getln.c, src/fileio.c, src/getchar.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/option.c, + src/term.c, src/ui.c, src/window.c, src/os_os2_cfg.h, + src/Make_os2.mak, src/testdir/Make_os2.mak, src/testdir/os2.vim, + src/INSTALL, runtime/doc/os_os2.txt + +Patch 7.4.1009 +Problem: There are still #ifdefs for ARCHIE. +Solution: Remove references to ARCHIE, the code was removed in Vim 5. +Files: src/ex_cmds.c, src/ex_docmd.c, src/fileio.c, src/main.c, + src/memline.c, src/option.c, src/term.c + +Patch 7.4.1010 +Problem: Some developers are unhappy while running tests. +Solution: Add a test and some color. +Files: src/ex_cmds.c, src/testdir/test_assert.vim + +Patch 7.4.1011 +Problem: Can't build with Strawberry Perl. +Solution: Include stdbool.h. (Ken Takata, closes #328) +Files: Filelist, src/Make_mvc.mak, src/if_perl_msvc/stdbool.h + +Patch 7.4.1012 +Problem: Vim overwrites the value of $PYTHONHOME. +Solution: Do not set $PYTHONHOME if it is already set. (Kazuki Sakamoto, + closes #500) +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1013 +Problem: The local value of 'errorformat' is not used for ":lexpr" and + ":cexpr". +Solution: Use the local value if it exists. (Christian Brabandt) Adjust the + help for this. +Files: runtime/doc/quickfix.txt, src/quickfix.c + +Patch 7.4.1014 +Problem: `fnamemodify('.', ':.')` returns an empty string in Cygwin. +Solution: Use CCP_RELATIVE in the call to cygwin_conv_path. (Jacob Niehus, + closes #505) +Files: src/os_unix.c + +Patch 7.4.1015 +Problem: The column is not restored properly when the matchparen plugin is + used in Insert mode and the cursor is after the end of the line. +Solution: Set the curswant flag. (Christian Brabandt). Also fix + highlighting the match of the character before the cursor. +Files: src/eval.c, runtime/plugin/matchparen.vim + +Patch 7.4.1016 +Problem: Still a few OS/2 pieces remain. +Solution: Delete more. +Files: Filelist, README_os2.txt, testdir/todos.vim, src/xxd/Make_os2.mak + +Patch 7.4.1017 +Problem: When there is a backslash in an option ":set -=" doesn't work. +Solution: Handle a backslash better. (Jacob Niehus) Add a new test, merge + in old test. +Files: src/testdir/test_cdo.vim, src/testdir/test_set.vim, + src/testdir/test_alot.vim, src/option.c, src/testdir/test_set.in, + src/testdir/test_set.ok, src/Makefile + +Patch 7.4.1018 (after 7.4.1017) +Problem: Failure running tests. +Solution: Add missing change to list of old style tests. +Files: src/testdir/Make_all.mak + +Patch 7.4.1019 +Problem: Directory listing of "src" is too long. +Solution: Rename the resources file to make it shorter. +Files: src/gui_gtk_gresources.xml, src/gui_gtk_res.xml, src/Makefile, + Filelist + +Patch 7.4.1020 +Problem: On MS-Windows there is no target to run tests with gvim. +Solution: Add the testgvim target. +Files: src/Make_mvc.mak + +Patch 7.4.1021 +Problem: Some makefiles are outdated. +Solution: Add a note to warn developers. +Files: src/Make_manx.mak, src/Make_bc3.mak, src/Make_bc5.mak, + src/Make_djg.mak, src/Make_w16.mak + +Patch 7.4.1022 +Problem: The README file contains some outdated information. +Solution: Update the information about supported systems. +Files: README.txt, README.md + +Patch 7.4.1023 +Problem: The distribution files for MS-Windows use CR-LF, which is + inconsistent with what one gets from github. +Solution: Use LF in the distribution files. +Files: Makefile + +Patch 7.4.1024 +Problem: Interfaces for MS-Windows are outdated. +Solution: Use Python 2.7.10, Python 3.4.4, Perl 5.22, TCL 8.6. +Files: src/bigvim.bat + +Patch 7.4.1025 +Problem: Version in installer needs to be updated manually. +Solution: Generate a file with the version number. (Guopeng Wen) +Files: Makefile, nsis/gvim.nsi, nsis/gvim_version.nsh + +Patch 7.4.1026 +Problem: When using MingW the tests do not clean up all files. E.g. test + 17 leaves Xdir1 behind. (Michael Soyka) +Solution: Also delete directories, like Make_dos.mak. Delete files after + directories to reduce warnings. +Files: src/testdir/Make_ming.mak, src/testdir/Make_dos.mak + +Patch 7.4.1027 +Problem: No support for binary numbers. +Solution: Add "bin" to 'nrformats'. (Jason Schulz) +Files: runtime/doc/change.txt, runtime/doc/eval.txt, + runtime/doc/version7.txt, src/charset.c, src/eval.c, + src/ex_cmds.c, src/ex_getln.c, src/misc2.c, src/ops.c, + src/option.c, src/proto/charset.pro, src/spell.c, + src/testdir/test57.in, src/testdir/test57.ok, + src/testdir/test58.in, src/testdir/test58.ok, + src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/vim.h + +Patch 7.4.1028 +Problem: Nsis version file missing from the distribution. +Solution: Add the file to the list. +Files: Filelist + +Patch 7.4.1029 (after 7.4.1027) +Problem: test_increment fails on systems with 32 bit long. +Solution: Only test with 32 bits. +Files: src/testdir/test_increment.in, src/testdir/test_increment.ok + +Patch 7.4.1030 +Problem: test49 is still slow. +Solution: Move more tests from old to new style. +Files: src/testdir/test_viml.vim, src/testdir/test49.vim, + src/testdir/test49.ok, src/testdir/runtest.vim + +Patch 7.4.1031 +Problem: Can't build with Python interface using MingW. +Solution: Update the Makefile. (Yasuhiro Matsumoto) +Files: src/INSTALLpc.txt, src/Make_cyg_ming.mak + +Patch 7.4.1032 +Problem: message from assert_false() does not look nice. +Solution: Handle missing sourcing_name. Use right number of spaces. (Watiko) + Don't use line number if it's zero. +Files: src/eval.c + +Patch 7.4.1033 +Problem: Memory use on MS-Windows is very conservative. +Solution: Use the global memory status to estimate amount of memory. + (Mike Williams) +Files: src/os_win32.c, src/os_win32.h, src/proto/os_win32.pro + +Patch 7.4.1034 +Problem: There is no test for the 'backspace' option behavior. +Solution: Add a test. (Hirohito Higashi) +Files: src/testdir/test_alot.vim, src/testdir/test_backspace_opt.vim + +Patch 7.4.1035 +Problem: An Ex range gets adjusted for folded lines even when the range is + not using line numbers. +Solution: Only adjust line numbers for folding. (Christian Brabandt) +Files: runtime/doc/fold.txt, src/ex_docmd.c + +Patch 7.4.1036 +Problem: Only terminals with up to 256 colors work properly. +Solution: Use the 256 color behavior for all terminals with 256 or more + colors. (Robert de Bath, closes #504) +Files: src/syntax.c + +Patch 7.4.1037 +Problem: Using "q!" when there is a modified hidden buffer does not unload + the current buffer, resulting in the need to abandon it again. +Solution: When using "q!" unload the current buffer when needed. (Yasuhiro + Matsumoto, Hirohito Higashi) +Files: src/testdir/test31.in, src/testdir/test31.ok, + runtime/doc/editing.txt, src/ex_cmds2.c, src/ex_docmd.c, + src/gui.c, src/gui_gtk_x11.c, src/os_unix.c, + src/proto/ex_cmds2.pro + +Patch 7.4.1038 +Problem: Still get a warning for a deprecated function with gdk-pixbuf + 2.31. +Solution: Change minimum minor version from 32 to 31. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1039 (after 7.4.1037) +Problem: Test 31 fails with small build. +Solution: Bail out for small build. (Hirohito Higashi) +Files: src/testdir/test31.in + +Patch 7.4.1040 +Problem: The tee command is not available on MS-Windows. +Solution: Adjust tee.c for MSVC and add a makefile. (Yasuhiro Matsumoto) +Files: src/tee/tee.c, src/tee/Make_mvc.mak, src/Make_mvc.mak + +Patch 7.4.1041 +Problem: Various small things. +Solution: Add file to list of distributed files. Adjust README. Fix typo. +Files: Filelist, src/testdir/README.txt, src/testdir/test_charsearch.in, + src/INSTALLmac.txt + +Patch 7.4.1042 +Problem: g-CTRL-G shows the word count, but there is no way to get the word + count in a script. +Solution: Add the wordcount() function. (Christian Brabandt) +Files: runtime/doc/editing.txt, runtime/doc/eval.txt, + runtime/doc/usr_41.txt, src/eval.c, src/normal.c, src/ops.c, + src/proto/ops.pro, src/testdir/test_wordcount.in, + src/testdir/test_wordcount.ok, src/testdir/Make_all.mak + +Patch 7.4.1043 +Problem: Another small thing. +Solution: Now really update the Mac install text. +Files: src/INSTALLmac.txt + +Patch 7.4.1044 (after 7.4.1042) +Problem: Can't build without the +eval feature. +Solution: Add #ifdef. +Files: src/ops.c + +Patch 7.4.1045 +Problem: Having shadow and coverage on the same build results in the source + files not being available in the coverage view. +Solution: Move using shadow to the normal build. +Files: .travis.yml + +Patch 7.4.1046 +Problem: No test coverage for menus. +Solution: Load the standard menus and check there is no error. +Files: src/testdir/test_menu.vim, src/testdir/test_alot.vim + +Patch 7.4.1047 (after patch 7.4.1042) +Problem: Tests fail on MS-Windows. +Solution: Set 'selection' to inclusive. +Files: src/testdir/test_wordcount.in + +Patch 7.4.1048 (after patch 7.4.1047) +Problem: Wordcount test still fail on MS-Windows. +Solution: Set 'fileformat' to "unix". +Files: src/testdir/test_wordcount.in + +Patch 7.4.1049 (after patch 7.4.1048) +Problem: Wordcount test still fails on MS-Windows. +Solution: Set 'fileformats' to "unix". +Files: src/testdir/test_wordcount.in + +Patch 7.4.1050 +Problem: Warning for unused var with tiny features. (Tony Mechelynck) +Solution: Add #ifdef. Use vim_snprintf(). Reduce number of statements. +Files: src/ops.c + +Patch 7.4.1051 +Problem: Segfault when unletting "count". +Solution: Check for readonly and locked first. (Dominique Pelle) + Add a test. +Files: src/eval.c, src/testdir/test_alot.vim, src/testdir/test_unlet.vim + +Patch 7.4.1052 +Problem: Illegal memory access with weird syntax command. (Dominique Pelle) +Solution: Check for column past end of line. +Files: src/syntax.c + +Patch 7.4.1053 +Problem: Insufficient testing for quickfix commands. +Solution: Add a new style quickfix test. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test_quickfix.vim + +Patch 7.4.1054 +Problem: Illegal memory access. +Solution: Check for missing pattern. (Dominique Pelle) +Files: src/syntax.c + +Patch 7.4.1055 +Problem: Running "make newtests" in src/testdir has no output. +Solution: List the messages file when a test fails. (Christian Brabandt) + Update the list of tests. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.1056 +Problem: Don't know why finding spell suggestions is slow. +Solution: Add some code to gather profiling information. +Files: src/spell.c + +Patch 7.4.1057 +Problem: Typos in the :options window. +Solution: Fix the typos. (Dominique Pelle) +Files: runtime/optwin.vim + +Patch 7.4.1058 +Problem: It is not possible to test code that is only reached when memory + allocation fails. +Solution: Add the alloc_fail() function. Try it out with :vimgrep. +Files: runtime/doc/eval.txt, src/globals.h, src/eval.c, src/quickfix.c, + src/misc2.c, src/proto/misc2.pro, src/testdir/test_quickfix.vim + +Patch 7.4.1059 +Problem: Code will never be executed. +Solution: Remove the code. +Files: src/quickfix.c + +Patch 7.4.1060 +Problem: Instructions for writing tests are outdated. +Solution: Mention Make_all.mak. Add steps for new style tests. +Files: src/testdir/README.txt + +Patch 7.4.1061 +Problem: Compiler warning for ignoring return value of fwrite(). +Solution: Do use the return value. (idea: Charles Campbell) +Files: src/misc2.c, src/proto/misc2.pro + +Patch 7.4.1062 +Problem: Building with Ruby on MS-Windows requires a lot of arguments. +Solution: Make it simpler. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1063 +Problem: TCL_VER_LONG and DYNAMIC_TCL_VER are not set when building with + Cygwin and MingW. +Solution: Add TCL_VER_LONG and DYNAMIC_TCL_VER to the makefile. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1064 +Problem: When a spell file has single letter compounding creating + suggestions takes an awful long time. +Solution: Add the NOCOMPOUNDSUGS flag. +Files: runtime/doc/spell.txt, src/spell.c + +Patch 7.4.1065 +Problem: Cannot use the "dll" options on MS-Windows. +Solution: Support the options on all platforms. Use the built-in name as + the default, so that it's clear what Vim is looking for. +Files: src/if_python.c, src/if_python3.c, src/if_lua.c, src/if_perl.xs, + src/if_ruby.c, src/option.c, runtime/doc/options.txt, src/Makefile + +Patch 7.4.1066 (after 7.4.1065) +Problem: Build fails on MS-Windows. +Solution: Adjust the #ifdefs for "dll" options. +Files: src/option.h + +Patch 7.4.1067 (after 7.4.1065) +Problem: Can't build with MingW and Python on MS-Windows. +Solution: Move the build flags to CFLAGS. +Files: src/Make_cyg_ming.mak + +Patch 7.4.1068 +Problem: Wrong way to check for unletting internal variables. +Solution: Use a better way. (Olaf Dabrunz) +Files: src/testdir/test_unlet.c, src/eval.c + +Patch 7.4.1069 +Problem: Compiler warning for unused argument. +Solution: Add UNUSED. +Files: src/misc2.c + +Patch 7.4.1070 +Problem: The Tcl interface can't be loaded dynamically on Unix. +Solution: Make it possible to load it dynamically. (Ken Takata) +Files: runtime/doc/if_tcl.txt, runtime/doc/options.txt, + runtime/doc/quickref.txt, runtime/optwin.vim, src/Makefile, + src/config.h.in, src/configure.in, src/auto/configure, + src/if_tcl.c, src/option.c, src/option.h + +Patch 7.4.1071 +Problem: New style tests are executed in arbitrary order. +Solution: Sort the test function names. (Hirohito Higashi) + Fix the quickfix test that depended on the order. +Files: src/testdir/runtest.vim, src/testdir/test_quickfix.vim + +Patch 7.4.1072 +Problem: Increment test is old style. +Solution: Make the increment test a new style test. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_increment.in, src/testdir/test_increment.ok, + src/testdir/test_increment.vim + +Patch 7.4.1073 +Problem: Alloc_id depends on numbers, may use the same one twice. It's not + clear from the number what it's for. +Solution: Use an enum. Add a function to lookup the enum value from the + name. +Files: src/misc2.c, src/vim.h, src/alloc.h, src/globals.h, + src/testdir/runtest.vim, src/proto/misc2.pro, + src/testdir/test_quickfix.vim + +Patch 7.4.1074 +Problem: Warning from VC2015 compiler. +Solution: Add a type cast. (Mike Williams) +Files: src/gui_dwrite.cpp + +Patch 7.4.1075 +Problem: Crash when using an invalid command. +Solution: Fix generating the error message. (Dominique Pelle) +Files: src/ex_docmd.c + +Patch 7.4.1076 +Problem: CTRL-A does not work well in right-left mode. +Solution: Remove reversing the line, add a test. (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_increment.vim + +Patch 7.4.1077 +Problem: The build instructions for MS-Windows are incomplete. +Solution: Add explanations for how to build with various interfaces. (Ken + Takata) +Files: src/INSTALLpc.txt + +Patch 7.4.1078 +Problem: MSVC: "make clean" doesn't cleanup in the tee directory. +Solution: Add the commands to cleanup tee. (Erich Ritz) +Files: src/Make_mvc.mak + +Patch 7.4.1079 (after 7.4.1073) +Problem: New include file missing from distribution. Missing changes to + quickfix code. +Solution: Add alloc.h to the list of distributed files. Use the enum in + quickfix code. +Files: Filelist, src/quickfix.c + +Patch 7.4.1080 +Problem: VS2015 has a function HandleToLong() that is shadowed by the macro + that Vim defines. +Solution: Do not define HandleToLong() for MSVC version 1400 and later. + (Mike Williams) +Files: src/gui_w32.c + +Patch 7.4.1081 +Problem: No test for what previously caused a crash. +Solution: Add test for unletting errmsg. +Files: src/testdir/test_unlet.vim + +Patch 7.4.1082 +Problem: The Tcl interface is always skipping memory free on exit. +Solution: Only skip for dynamically loaded Tcl. +Files: src/if_tcl.c + +Patch 7.4.1083 +Problem: Building GvimExt with VS2015 may fail. +Solution: Adjust the makefile. (Mike Williams) +Files: src/GvimExt/Makefile + +Patch 7.4.1084 +Problem: Using "." to repeat CTRL-A in Visual mode increments the wrong + numbers. +Solution: Append right size to the redo buffer. (Ozaki Kiichi) +Files: src/normal.c, src/testdir/test_increment.vim + +Patch 7.4.1085 +Problem: The CTRL-A and CTRL-X commands do not update the '[ and '] marks. +Solution: (Yukihiro Nakadaira) +Files: src/ops.c, src/testdir/test_marks.in, src/testdir/test_marks.ok + +Patch 7.4.1086 +Problem: Crash with an extremely long buffer name. +Solution: Limit the return value of vim_snprintf(). (Dominique Pelle) +Files: src/buffer.c + +Patch 7.4.1087 +Problem: CTRL-A and CTRL-X do not work properly with blockwise visual + selection if there is a mix of Tab and spaces. +Solution: Add OP_NR_ADD and OP_NR_SUB. (Hirohito Higashi) +Files: src/testdir/test_increment.vim, src/normal.c, src/ops.c, + src/proto/ops.pro, src/vim.h + +Patch 7.4.1088 +Problem: Coverity warns for uninitialized variables. Only one is an actual + problem. +Solution: Move the conditions. Don't use endpos if handling an error. +Files: src/ops.c + +Patch 7.4.1089 +Problem: Repeating CTRL-A doesn't work. +Solution: Call prep_redo_cmd(). (Hirohito Higashi) +Files: src/normal.c, src/testdir/test_increment.vim + +Patch 7.4.1090 +Problem: No tests for :hardcopy and related options. +Solution: Add test_hardcopy. +Files: src/testdir/test_hardcopy.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 7.4.1091 +Problem: When making a change while need_wait_return is set there is a two + second delay. +Solution: Do not assume the ATTENTION prompt was given when need_wait_return + was set already. +Files: src/misc1.c + +Patch 7.4.1092 +Problem: It is not simple to test for an exception and give a proper error + message. +Solution: Add assert_exception(). +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.1093 +Problem: Typo in test goes unnoticed. +Solution: Fix the typo. Give error for wrong arguments to cursor(). + (partly by Hirohito Higashi) Add a test for cursor(). +Files: src/testdir/test_searchpos.vim, src/testdir/test_cursor_func.vim, + src/eval.c, src/testdir/test_alot.vim + +Patch 7.4.1094 +Problem: Test for :hardcopy fails on MS-Windows. +Solution: Check for the +postscript feature. +Files: src/testdir/test_hardcopy.vim + +Patch 7.4.1095 +Problem: Can't build GvimExt with SDK 7.1. +Solution: Support using setenv.bat instead of vcvars32.bat. (Ken Takata) +Files: src/Make_mvc.mak, src/GvimExt/Makefile + +Patch 7.4.1096 +Problem: Need several lines to verify a command produces an error. +Solution: Add assert_fails(). (suggested by Nikolai Pavlov) + Make the quickfix alloc test actually work. +Files: src/testdir/test_quickfix.vim, src/eval.c, runtime/doc/eval.txt, + src/misc2.c, src/alloc.h + +Patch 7.4.1097 +Problem: Looking up the alloc ID for tests fails. +Solution: Fix the line computation. Use assert_fails() for unlet test. +Files: src/testdir/runtest.vim, src/testdir/test_unlet.vim + +Patch 7.4.1098 +Problem: Still using old style C function declarations. +Solution: Always define __ARGS() to include types. Turn a few functions + into ANSI style to find out if this causes problems for anyone. +Files: src/vim.h, src/os_unix.h, src/eval.c, src/main.c + +Patch 7.4.1099 +Problem: It's not easy to know if Vim supports blowfish. (Smu Johnson) +Solution: Add has('crypt-blowfish') and has('crypt-blowfish2'). +Files: src/eval.c + +Patch 7.4.1100 +Problem: Cygwin makefiles are unused. +Solution: Remove them. +Files: src/GvimExt/Make_ming.mak, src/GvimExt/Make_cyg.mak, + src/xxd/Make_ming.mak, src/xxd/Make_cyg.mak + +Patch 7.4.1101 +Problem: With 'rightleft' and concealing the cursor may move to the wrong + position. +Solution: Compute the column differently when 'rightleft' is set. (Hirohito + Higashi) +Files: src/screen.c + +Patch 7.4.1102 +Problem: Debugger has no stack backtrace support. +Solution: Add "backtrace", "frame", "up" and "down" commands. (Alberto + Fanjul, closes #433) +Files: runtime/doc/repeat.txt, src/eval.c, src/ex_cmds2.c, src/globals.h, + src/testdir/Make_all.mak, src/testdir/test108.in, + src/testdir/test108.ok + +Patch 7.4.1103 (after 7.4.1100) +Problem: Removed file still in distribution. +Solution: Remove Make_cyg.mak from the list of files. +Files: Filelist + +Patch 7.4.1104 +Problem: Various problems building with MzScheme/Racket. +Solution: Make it work with new versions of Racket. (Yukihiro Nakadaira, Ken + Takata) +Files: runtime/doc/if_mzsch.txt, src/INSTALLpc.txt, + src/Make_cyg_ming.mak, src/Make_mvc.mak, src/auto/configure, + src/configure.in, src/if_mzsch.c + +Patch 7.4.1105 +Problem: When using slices there is a mixup of variable name and namespace. +Solution: Recognize variables that can't be a namespace. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok + +Patch 7.4.1106 +Problem: The nsis script can't be used from the appveyor build. +Solution: Add "ifndef" to allow for variables to be set from the command + line. Remove duplicate SetCompressor command. Support using other + gettext binaries. (Ken Takata) Update build instructions to use + libintl-8.dll. +Files: Makefile, nsis/gvim.nsi, src/os_win32.c, src/proto/os_win32.pro, + src/main.c, os_w32exe.c + +Patch 7.4.1107 +Problem: Vim can create a directory but not delete it. +Solution: Add an argument to delete() to make it possible to delete a + directory, also recursively. +Files: src/fileio.c, src/eval.c, src/proto/fileio.pro, + src/testdir/test_delete.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.1108 +Problem: Expanding "~" halfway a file name. +Solution: Handle the file name as one name. (Marco Hinz) Add a test. + Closes #564. +Files: src/testdir/test27.in, src/testdir/test27.ok, + src/testdir/test_expand.vim, src/testdir/test_alot.vim, + src/Makefile, src/misc2.c + +Patch 7.4.1109 (after 7.4.1107) +Problem: MS-Windows doesn't have rmdir(). +Solution: Add mch_rmdir(). +Files: src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1110 +Problem: Test 108 fails when language is French. +Solution: Force English messages. (Dominique Pelle) +Files: src/testdir/test108.in + +Patch 7.4.1111 +Problem: test_expand fails on MS-Windows. +Solution: Always use forward slashes. Remove references to test27. +Files: src/testdir/runtest.vim, src/testdir/test_expand.vim, + src/testdir/Make_dos.mak, src/testdir/Make_all.mak, + src/testdir/Make_amiga.mak, src/testdir/Make_ming.mak + +Patch 7.4.1112 +Problem: When using ":next" with an illegal file name no error is reported. +Solution: Give an error message. +Files: src/ex_cmds2.c + +Patch 7.4.1113 (after 7.4.1105) +Problem: Using {ns} in variable name does not work. (lilydjwg) +Solution: Fix recognizing colon. Add a test. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1114 (after 7.4.1107) +Problem: delete() does not work well with symbolic links. +Solution: Recognize symbolic links. +Files: src/eval.c, src/fileio.c, src/os_unix.c, src/proto/os_unix.pro, + src/testdir/test_delete.vim, runtime/doc/eval.txt + +Patch 7.4.1115 +Problem: MS-Windows: make clean in testdir doesn't clean everything. +Solution: Add command to delete X* directories. (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1116 +Problem: delete(x, 'rf') does not delete files starting with a dot. +Solution: Also delete files starting with a dot. +Files: src/misc1.c, src/fileio.c, src/vim.h + +Patch 7.4.1117 (after 7.4.1116) +Problem: No longer get "." and ".." in directory list. +Solution: Do not skip "." and ".." unless EW_DODOT is set. +Files: src/misc1.c + +Patch 7.4.1118 +Problem: Tests hang in 24 line terminal. +Solution: Set the 'more' option off. +Files: src/testdir/runtest.vim + +Patch 7.4.1119 +Problem: argidx() has a wrong value after ":%argdelete". (Yegappan + Lakshmanan) +Solution: Correct the value of w_arg_idx. Add a test. +Files: src/ex_cmds2.c, src/testdir/test_arglist.vim, + src/testdir/Make_all.mak + +Patch 7.4.1120 +Problem: delete(x, 'rf') fails if a directory is empty. (Lcd) +Solution: Ignore not finding matches in an empty directory. +Files: src/fileio.c, src/misc1.c, src/vim.h, src/testdir/test_delete.vim + +Patch 7.4.1121 +Problem: test_expand leaves files behind. +Solution: Edit another file before deleting, otherwise the swap file + remains. +Files: src/testdir/test_expand.vim + +Patch 7.4.1122 +Problem: Test 92 and 93 fail when using gvim on a system with a non utf-8 + locale. +Solution: Avoid using .gvimrc by adding -U NONE. (Yukihiro Nakadaira) +Files: src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/Makefile + +Patch 7.4.1123 +Problem: Using ":argadd" when there are no arguments results in the second + argument to be the current one. (Yegappan Lakshmanan) +Solution: Correct the w_arg_idx value. +Files: src/ex_cmds2.c, src/testdir/test_arglist.vim + +Patch 7.4.1124 +Problem: MS-Windows: dead key behavior is not ideal. +Solution: Handle dead keys differently when not in Insert or Select mode. + (John Wellesz, closes #399) +Files: src/gui_w48.c + +Patch 7.4.1125 +Problem: There is no perleval(). +Solution: Add perleval(). (Damien) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/if_perl.xs, src/proto/if_perl.pro, src/testdir/Make_all.mak, + src/testdir/test_perl.vim + +Patch 7.4.1126 +Problem: Can only get the directory of the current window. +Solution: Add window and tab arguments to getcwd() and haslocaldir(). + (Thinca, Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_getcwd.in, src/testdir/test_getcwd.ok, + runtime/doc/eval.txt, patching file src/eval.c + +Patch 7.4.1127 +Problem: Both old and new style tests for Perl. +Solution: Merge the old tests with the new style tests. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_perl.in, + src/testdir/test_perl.ok, src/testdir/test_perl.vim + +Patch 7.4.1128 +Problem: MS-Windows: delete() does not recognize junctions. +Solution: Add mch_isrealdir() for MS-Windows. Update mch_is_symbolic_link(). + (Ken Takata) +Files: src/fileio.c, src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1129 +Problem: Python None value can't be converted to a Vim value. +Solution: Just use zero. (Damien) +Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok, + +Patch 7.4.1130 +Problem: Memory leak in :vimgrep. +Solution: Call FreeWild(). (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1131 +Problem: New lines in the viminfo file are dropped. +Solution: Copy lines starting with "|". Fix that when using :rviminfo in a + function global variables were restored as function-local + variables. +Files: src/eval.c, src/structs.h, src/ex_cmds.c, src/misc2.c, + src/proto/misc2.pro, src/testdir/test_viminfo.vim, + src/testdir/Make_all.mak, src/testdir/test74.in, + src/testdir/test74.ok + +Patch 7.4.1132 +Problem: Old style tests for the argument list. +Solution: Add more new style tests. (Yegappan Lakshmanan) +Files: src/testdir/test_arglist.vim, src/testdir/test_argument_0count.in, + src/testdir/test_argument_0count.ok, + src/testdir/test_argument_count.in, src/Makefile, + src/testdir/test_argument_count.ok, src/testdir/Make_all.mak + +Patch 7.4.1133 +Problem: Generated function prototypes still have __ARGS(). +Solution: Generate function prototypes without __ARGS(). +Files: src/Makefile, src/if_ruby.c, src/os_win32.c, + src/proto/blowfish.pro, src/proto/buffer.pro, + src/proto/charset.pro, src/proto/crypt.pro, + src/proto/crypt_zip.pro, src/proto/diff.pro, + src/proto/digraph.pro, src/proto/edit.pro, src/proto/eval.pro, + src/proto/ex_cmds2.pro, src/proto/ex_cmds.pro, + src/proto/ex_docmd.pro, src/proto/ex_eval.pro, + src/proto/ex_getln.pro, src/proto/fileio.pro, src/proto/fold.pro, + src/proto/getchar.pro, src/proto/gui_athena.pro, + src/proto/gui_beval.pro, src/proto/gui_gtk_gresources.pro, + src/proto/gui_gtk.pro, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_motif.pro, + src/proto/gui_photon.pro, src/proto/gui.pro, + src/proto/gui_w16.pro, src/proto/gui_w32.pro, + src/proto/gui_x11.pro, src/proto/gui_xmdlg.pro, + src/proto/hangulin.pro, src/proto/hardcopy.pro, + src/proto/hashtab.pro, src/proto/if_cscope.pro, + src/proto/if_lua.pro, src/proto/if_mzsch.pro, + src/proto/if_ole.pro, src/proto/if_perl.pro, + src/proto/if_perlsfio.pro, src/proto/if_python3.pro, + src/proto/if_python.pro, src/proto/if_ruby.pro, + src/proto/if_tcl.pro, src/proto/if_xcmdsrv.pro, + src/proto/main.pro, src/proto/mark.pro, src/proto/mbyte.pro, + src/proto/memfile.pro, src/proto/memline.pro, src/proto/menu.pro, + src/proto/message.pro, src/proto/misc1.pro, src/proto/misc2.pro, + src/proto/move.pro, src/proto/netbeans.pro, src/proto/normal.pro, + src/proto/ops.pro, src/proto/option.pro, src/proto/os_amiga.pro, + src/proto/os_beos.pro, src/proto/os_mac_conv.pro, + src/proto/os_msdos.pro, src/proto/os_mswin.pro, + src/proto/os_qnx.pro, src/proto/os_unix.pro, src/proto/os_vms.pro, + src/proto/os_win16.pro, src/proto/os_win32.pro, + src/proto/popupmnu.pro, src/proto/pty.pro, src/proto/quickfix.pro, + src/proto/regexp.pro, src/proto/screen.pro, src/proto/search.pro, + src/proto/sha256.pro, src/proto/spell.pro, src/proto/syntax.pro, + src/proto/tag.pro, src/proto/termlib.pro, src/proto/term.pro, + src/proto/ui.pro, src/proto/undo.pro, src/proto/version.pro, + src/proto/winclip.pro, src/proto/window.pro, + src/proto/workshop.pro + +Patch 7.4.1134 +Problem: The arglist test fails on MS-Windows. +Solution: Only check for failure of argedit on Unix. +Files: src/testdir/test_arglist.vim + +Patch 7.4.1135 +Problem: One more arglist test fails on MS-Windows. +Solution: Don't edit "Y" after editing "y". +Files: src/testdir/test_arglist.vim + +Patch 7.4.1136 +Problem: Wrong argument to assert_exception() causes a crash. (reported by + Coverity) +Solution: Check for NULL pointer. Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1137 +Problem: Illegal memory access when using :copen and :cclose. +Solution: Avoid that curbuf is invalid. (suggestion by Justin M. Keyes) + Add a test. +Files: src/window.c, src/testdir/test_quickfix.vim + +Patch 7.4.1138 +Problem: When running gvim in the foreground some icons are missing. + (Taylor Venable) +Solution: Move the call to gui_gtk_register_resource(). (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1139 +Problem: MS-Windows: getftype() returns "file" for symlink to directory. +Solution: Make it return "dir". (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.1140 +Problem: Recognizing <sid> does not work when the language is Turkish. + (Christian Brabandt) +Solution: Use MB_STNICMP() instead of STNICMP(). +Files: src/eval.c + +Patch 7.4.1141 +Problem: Using searchpair() with a skip expression that uses syntax + highlighting sometimes doesn't work. (David Fishburn) +Solution: Reset next_match_idx. (Christian Brabandt) +Files: src/syntax.c + +Patch 7.4.1142 +Problem: Cannot define keyword characters for a syntax file. +Solution: Add the ":syn iskeyword" command. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/doc/syntax.txt, src/buffer.c, + src/option.c, src/structs.h, src/syntax.c, + src/testdir/Make_all.mak, src/testdir/test_syntax.vim + +Patch 7.4.1143 +Problem: Can't sort on floating point numbers. +Solution: Add the "f" flag to ":sort". (Alex Jakushev) Also add the "f" + flag to sort(). +Files: runtime/doc/change.txt, src/ex_cmds.c, src/testdir/test_sort.vim, + src/testdir/test57.in, src/testdir/test57.ok, src/eval.c + +Patch 7.4.1144 (after 7.4.1143) +Problem: Can't build on several systems. +Solution: Include float.h. (Christian Robinson, closes #570 #571) +Files: src/ex_cmds.c + +Patch 7.4.1145 +Problem: Default features are conservative. +Solution: Make the default feature set for most of today's systems "huge". +Files: src/feature.h, src/configure.in, src/auto/configure + +Patch 7.4.1146 +Problem: Can't build with Python 3 interface using MingW. +Solution: Update the Makefile. (Yasuhiro Matsumoto, Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1147 +Problem: Conflict for "chartab". (Kazunobu Kuriyama) +Solution: Rename the global one to something less obvious. Move it into + src/chartab.c. +Files: src/macros.h, src/globals.h, src/charset.c, src/main.c, + src/option.c, src/screen.c, src/vim.h + +Patch 7.4.1148 +Problem: Default for MingW and Cygwin is still "normal". +Solution: Use "huge" as default. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1149 (after 7.4.1013) +Problem: Using the local value of 'errorformat' causes more problems than + it solves. +Solution: Revert 7.4.1013. +Files: runtime/doc/quickfix.txt, src/quickfix.c + +Patch 7.4.1150 +Problem: 'langmap' applies to the first character typed in Select mode. + (David Watson) +Solution: Check for SELECTMODE. (Christian Brabandt, closes #572) + Add the 'x' flag to feedkeys(). +Files: src/getchar.c, src/normal.c, src/testdir/test_langmap.vim, + src/ex_docmd.c, src/proto/ex_docmd.pro, src/testdir/Make_all.mak, + runtime/doc/eval.txt + +Patch 7.4.1151 (after 7.4.1150) +Problem: Missing change to eval.c +Solution: Also change feedkeys(). +Files: src/eval.c + +Patch 7.4.1152 +Problem: Langmap test fails with normal build. +Solution: Check for +langmap feature. +Files: src/testdir/test_langmap.vim + +Patch 7.4.1153 +Problem: Autocommands triggered by quickfix cannot always get the current + title value. +Solution: Call qf_fill_buffer() later. (Christian Brabandt) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1154 +Problem: No support for JSON. +Solution: Add jsonencode() and jsondecode(). Also add v:false, v:true, + v:null and v:none. +Files: src/json.c, src/eval.c, src/proto.h, src/structs.h, src/vim.h, + src/if_lua.c, src/if_mzsch.c, src/if_ruby.c, src/if_py_both.h, + src/globals.h, src/Makefile, src/Make_bc3.mak, src/Make_bc5.mak, + src/Make_cyg_ming.mak, src/Make_dice.mak, src/Make_ivc.mak, + src/Make_manx.mak, src/Make_morph.mak, src/Make_mvc.mak, + src/Make_sas.mak, src/Make_vms.mms, src/proto/json.pro, + src/proto/eval.pro, src/testdir/test_json.vim, + src/testdir/test_alot.vim, Filelist, runtime/doc/eval.txt + +Patch 7.4.1155 +Problem: Build with normal features fails. +Solution: Always define dict_lookup(). +Files: src/eval.c + +Patch 7.4.1156 +Problem: Coverity warns for NULL pointer and ignoring return value. +Solution: Check for NULL pointer. When dict_add() returns FAIL free the item. +Files: src/json.c + +Patch 7.4.1157 +Problem: type() does not work for v:true, v:none, etc. +Solution: Add new type numbers. +Files: src/eval.c, src/testdir/test_json.vim, src/testdir/test_viml.vim + +Patch 7.4.1158 +Problem: Still using __ARGS(). +Solution: Remove __ARGS() from eval.c +Files: src/eval.c + +Patch 7.4.1159 +Problem: Automatically generated function prototypes use __ARGS. +Solution: Remove __ARGS from osdef.sh. +Files: src/osdef.sh, src/osdef1.h.in, src/osdef2.h.in + +Patch 7.4.1160 +Problem: No error for jsondecode('"'). +Solution: Give an error message for missing double quote. +Files: src/json.c + +Patch 7.4.1161 +Problem: ":argadd" without argument is supposed to add the current buffer + name to the arglist. +Solution: Make it work as documented. (Coot, closes #577) +Files: src/ex_cmds.h, src/ex_cmds2.c, src/testdir/test_arglist.vim + +Patch 7.4.1162 +Problem: Missing error number in MzScheme. (Dominique Pelle) +Solution: Add a proper error number. +Files: src/if_mzsch.c + +Patch 7.4.1163 +Problem: Expressions "0 + v:true" and "'' . v:true" cause an error. +Solution: Return something sensible when using a special variable as a + number or as a string. (suggested by Damien) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1164 +Problem: No tests for comparing special variables. Error in jsondecode() + not reported. test_json does not work with Japanese system. +Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error. +Files: src/json.c, src/testdir/test_viml.vim, src/testdir/test_json.vim + +Patch 7.4.1165 +Problem: When defining DYNAMIC_ICONV_DLL in the makefile, the build fails. +Solution: Add #ifdef's. (Taro Muraoka) Try the newer version first. +Files: src/mbyte.c, src/os_win32.c + +Patch 7.4.1166 +Problem: Can't encode a Funcref into JSON. jsonencode() doesn't handle the + same list or dict twice properly. (Nikolai Pavlov) +Solution: Give an error. Reset copyID when the list or dict is finished. +Files: src/json.c, src/proto/json.pro, src/testdir/test_json.vim + +Patch 7.4.1167 +Problem: No tests for "is" and "isnot" with the new variables. +Solution: Add tests. +Files: src/testdir/test_viml.vim + +Patch 7.4.1168 +Problem: This doesn't give the right result: eval(string(v:true)). (Nikolai + Pavlov) +Solution: Make the string "v:true" instead of "true". +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1169 +Problem: The socket I/O is intertwined with the netbeans code. +Solution: Start refactoring the netbeans communication to split off the + socket I/O. Add the +channel feature. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/proto/netbeans.pro, src/proto/gui_w32.pro, src/gui_w32.c, + src/eval.c, src/os_mswin.c, src/ui.c, src/macros.h, Makefile, + src/proto.h, src/feature.h, src/os_unix.c, src/vim.h, + src/configure.in, src/auto/configure, src/config.mk.in, + src/config.aap.in, src/config.h.in, src/Make_bc5.mak, + src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1170 (after 7.4.1169) +Problem: Missing changes in src/Makefile, Filelist. +Solution: Add the missing changes. +Files: Filelist, src/Makefile + +Patch 7.4.1171 +Problem: Makefile dependencies are outdated. +Solution: Run "make depend". Add GTK resource dependencies. +Files: src/Makefile + +Patch 7.4.1172 (after 7.4.1169) +Problem: Configure is overly positive. +Solution: Insert "test". +Files: src/configure.in, src/auto/configure + +Patch 7.4.1173 (after 7.4.1168) +Problem: No test for new behavior of v:true et al. +Solution: Add a test. +Files: src/testdir/test_viml.vim + +Patch 7.4.1174 +Problem: Netbeans contains dead code inside #ifndef INIT_SOCKETS. +Solution: Remove the dead code. +Files: src/netbeans.c + +Patch 7.4.1175 (after 7.4.1169) +Problem: Can't build with Mingw and Cygwin. +Solution: Remove extra "endif". (Christian J. Robinson) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1176 +Problem: Missing change to proto file. +Solution: Update the proto file. (Charles Cooper) +Files: src/proto/gui_w32.pro + +Patch 7.4.1177 +Problem: The +channel feature is not in :version output. (Tony Mechelynck) +Solution: Add the feature string. +Files: src/version.c + +Patch 7.4.1178 +Problem: empty() doesn't work for the new special variables. +Solution: Make empty() work. (Damien) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1179 +Problem: test_writefile and test_viml do not delete the tempfile. +Solution: Delete the tempfile. (Charles Cooper) Add DeleteTheScript(). +Files: src/testdir/test_writefile.in, src/testdir/test_viml.vim + +Patch 7.4.1180 +Problem: Crash with invalid argument to glob2regpat(). +Solution: Check for NULL. (Justin M. Keyes, closes #596) Add a test. +Files: src/eval.c, src/testdir/test_glob2regpat.vim, + src/testdir/test_alot.vim + +Patch 7.4.1181 +Problem: free_tv() can't handle special variables. (Damien) +Solution: Add the variable type. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1182 +Problem: Still socket code intertwined with netbeans. +Solution: Move code from netbeans.c to channel.c +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/proto/netbeans.pro, src/gui.c, src/gui_w48.c + +Patch 7.4.1183 (after 7.4.1182) +Problem: MS-Windows build is broken. +Solution: Remove init in wrong place. +Files: src/channel.c + +Patch 7.4.1184 (after 7.4.1182) +Problem: MS-Windows build is still broken. +Solution: Change nbsock to ch_fd. +Files: src/channel.c + +Patch 7.4.1185 +Problem: Can't build with TCL on some systems. +Solution: Rename the channel_ functions. +Files: src/if_tcl.c + +Patch 7.4.1186 +Problem: Error messages for security context are hard to translate. +Solution: Use one string with %s. (Ken Takata) +Files: src/os_unix.c + +Patch 7.4.1187 +Problem: MS-Windows channel code only supports one channel. Doesn't build + without netbeans support. +Solution: Get the channel index from the socket in the message. Closes #600. +Files: src/channel.c, src/netbeans.c, src/gui_w48.c, + src/proto/channel.pro, src/proto/netbeans.pro + +Patch 7.4.1188 +Problem: Using older JSON standard. +Solution: Update the link. Adjust the text a bit. +Files: src/json.c, runtime/doc/eval.txt + +Patch 7.4.1189 (after 7.4.1165) +Problem: Using another language on MS-Windows does not work. (Yongwei Wu) +Solution: Undo the change to try loading libintl-8.dll first. +Files: src/os_win32.c + +Patch 7.4.1190 +Problem: On OSX the default flag for dlopen() is different. +Solution: Add RTLD_LOCAL in the configure check. (sv99, closes #604) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1191 +Problem: The channel feature isn't working yet. +Solution: Add the connect(), disconnect(), sendexpr() and sendraw() + functions. Add initial documentation. Add a demo server. +Files: src/channel.c, src/eval.c, src/proto/channel.pro, + src/proto/eval.pro, runtime/doc/channel.txt, runtime/doc/eval.txt, + runtime/doc/Makefile, runtime/tools/demoserver.py + +Patch 7.4.1192 +Problem: Can't build with FEAT_EVAL but without FEAT_MBYTE. (John + Marriott) +Solution: Add #ifdef for FEAT_MBYTE. +Files: src/json.c + +Patch 7.4.1193 +Problem: Can't build the channel feature on MS-Windows. +Solution: Add #ifdef HAVE_POLL. +Files: src/channel.c + +Patch 7.4.1194 +Problem: Compiler warning for not using return value of fwrite(). +Solution: Return OK/FAIL. (Charles Campbell) +Files: src/channel.c, src/proto/channel.pro + +Patch 7.4.1195 +Problem: The channel feature does not work in the MS-Windows console. +Solution: Add win32 console support. (Yasuhiro Matsumoto) +Files: src/channel.c, src/gui_w32.c, src/os_mswin.c, src/os_win32.c, + src/proto/gui_w32.pro, src/proto/os_mswin.pro, src/vim.h + +Patch 7.4.1196 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/arabic.c, src/buffer.c, src/charset.c, src/crypt_zip.c, + src/diff.c, src/digraph.c, src/edit.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c + +Patch 7.4.1197 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/ex_eval.c, src/ex_getln.c, src/farsi.c, src/fileio.c, + src/fold.c, src/getchar.c, src/gui.c, src/gui_at_fs.c, + gui_at_sb.c, src/gui_athena.c, src/gui_beval.c, src/gui_motif.c, + src/gui_w32.c, src/gui_w48.c + +Patch 7.4.1198 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) + Also remove use of HAVE_STDARG_H. +Files: src/gui_x11.c, src/hangulin.c, src/hardcopy.c, src/hashtab.c, + src/if_cscope.c, src/if_python3.c, src/if_sniff.c, + src/if_xcmdsrv.c, src/main.c, src/mark.c, src/mbyte.c, + src/memfile.c, src/memfile_test.c, src/memline.c, src/menu.c, + src/message.c, src/misc1.c, src/misc2.c, src/move.c, + src/netbeans.c, src/normal.c + +Patch 7.4.1199 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/ops.c, src/option.c, src/os_amiga.c, src/os_mac_conv.c, + src/os_unix.c, src/os_vms.c, src/os_w32exe.c, src/popupmnu.c, + src/pty.c, src/quickfix.c, src/regexp.c, src/regexp_nfa.c, + src/screen.c, src/search.c, src/sha256.c, src/spell.c, + src/syntax.c, src/tag.c, src/term.c, src/termlib.c, src/ui.c, + src/undo.c, src/version.c, src/window.c + +Patch 7.4.1200 +Problem: Still using __ARGS. +Solution: Remove __ARGS in several files. (script by Hirohito Higashi) +Files: src/blowfish.c, src/ex_cmds2.c, src/ex_getln.c, src/fold.c, + src/gui_beval.c, src/gui_w32.c, src/os_unix.c, src/os_win16.c, + src/pty.c, src/regexp.c, src/syntax.c, src/xpm_w32.c, + src/ex_cmds.h, src/globals.h, src/gui_at_sb.h, src/gui_beval.h, + src/if_cscope.h, src/if_sniff.h, src/nbdebug.h, src/os_unix.h, + src/proto.h, src/structs.h, src/vim.h, src/xpm_w32.h, + src/if_perl.xs, src/proto/if_lua.pro, src/proto/pty.pro, + runtime/tools/xcmdsrv_client.c, + src/Makefile + +Patch 7.4.1201 +Problem: One more file still using __ARGS. +Solution: Remove __ARGS in the last file. (script by Hirohito Higashi) +Files: src/gui_at_sb.c + +Patch 7.4.1202 +Problem: Still one more file still using __ARGS. +Solution: Remove __ARGS in the last file. (script by Hirohito Higashi) + (closes #612) +Files: src/proto/os_mac_conv.pro, src/os_mac_conv.c, src/Makefile + +Patch 7.4.1203 +Problem: Still more files still using __ARGS. +Solution: Remove __ARGS in really the last files. +Files: src/proto/if_mzsch.pro, src/if_mzsch.c, src/vim.h, + src/proto/gui_gtk_gresources.pro, src/proto/gui_mac.pro, + src/proto/if_ole.pro, src/proto/os_qnx.pro, src/Makefile + +Patch 7.4.1204 +Problem: Latin1 characters cause encoding conversion. +Solution: Remove the characters. +Files: src/gui_motif.c + +Patch 7.4.1205 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/arabic.c, src/blowfish.c, src/buffer.c, src/channel.c, + src/charset.c, src/crypt.c, src/crypt_zip.c, src/diff.c, + src/digraph.c, src/edit.c, src/eval.c + +Patch 7.4.1206 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_eval.c, + src/ex_getln.c, src/farsi.c, src/fileio.c + +Patch 7.4.1207 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/fold.c, src/getchar.c, src/gui_at_fs.c, src/gui_athena.c, + src/gui_at_sb.c, src/gui_beval.c, src/gui.c, src/gui_gtk.c, + src/gui_gtk_x11.c, src/gui_mac.c, src/gui_motif.c + +Patch 7.4.1208 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/gui_photon.c, src/gui_w32.c, src/gui_w48.c, src/gui_x11.c, + src/hangulin.c, src/hardcopy.c, src/hashtab.c, src/if_cscope.c, + src/if_mzsch.c, src/if_perlsfio.c, src/if_python.c, + src/if_python3.c, src/if_ruby.c, src/if_sniff.c, src/if_tcl.c, + src/if_xcmdsrv.c, src/integration.c + +Patch 7.4.1209 (after 7.4.1207) +Problem: Can't build with Athena. (Elimar Riesebieter) +Solution: Fix function declarations. +Files: src/gui_athena.c, src/gui_x11.c, src/gui_at_sb.c, src/gui_at_fs.c + +Patch 7.4.1210 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/main.c, src/mark.c, src/mbyte.c, src/memfile.c, + src/memfile_test.c, src/memline.c, src/menu.c, src/message.c + +Patch 7.4.1211 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/misc1.c, src/misc2.c, src/move.c, src/netbeans.c, + src/normal.c, src/ops.c, src/option.c + +Patch 7.4.1212 (after 7.4.1207) +Problem: Can't build with Motif. +Solution: Fix function declaration.(Dominique Pelle) +Files: src/gui_motif.c + +Patch 7.4.1213 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/os_amiga.c, src/os_mac_conv.c, src/os_msdos.d, src/os_mswin.c, + src/os_qnx.c, src/os_unix.c, src/os_vms.c, src/os_win16.c, + src/os_win32.c, src/popupmnu.c, src/pty.c, src/quickfix.c, + src/regexp.c, src/regexp_nfa.c, src/screen.c + +Patch 7.4.1214 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/search.c, src/sha256.c, src/spell.c, src/syntax.c, src/tag.c, + src/term.c, src/termlib.c, src/ui.c, src/undo.c + +Patch 7.4.1215 +Problem: Using old style function declarations. +Solution: Change to new style function declarations. (script by Hirohito + Higashi) +Files: src/version.c, src/winclip.c, src/window.c, src/workshop.c, + src/xpm_w32.c, runtime/doc/doctags.c, + runtime/tools/xcmdsrv_client.c, src/po/sjiscorr.c, src/xxd/xxd.c + +Patch 7.4.1216 +Problem: Still using HAVE_STDARG_H. +Solution: Assume it's always defined. +Files: src/eval.c, src/misc2.c, src/vim.h, src/proto.h, src/configure.in, + src/auto/configure, config.h.in, src/os_amiga.h, src/os_msdos.h, + src/os_vms_conf.h, src/os_win32.h + +Patch 7.4.1217 +Problem: Execution of command on channel doesn't work yet. +Solution: Implement the "ex" and "normal" commands. +Files: src/channel.c, src/proto/channel.pro, src/misc2.c, src/eval.c, + src/ex_docmd.c, src/proto/ex_docmd.pro, src/feature.h + +Patch 7.4.1218 +Problem: Missing change in configure. More changes for function style. +Solution: Avoid the typos. +Files: src/configure.in, src/config.h.in, runtime/tools/ccfilter.c, + src/os_msdos.c + +Patch 7.4.1219 +Problem: Build fails with +channel but without +float. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.1220 +Problem: Warnings for unused variables in tiny build. (Tony Mechelynck) +Solution: Move declarations inside #ifdef. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.1221 +Problem: Including netbeans and channel support in small and tiny builds. + Build fails with some interfaces. +Solution: Only include these features in small build and above. Let + configure fail if trying to enable an interface that won't build. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1222 +Problem: ":normal" command and others missing in tiny build. +Solution: Graduate FEAT_EX_EXTRA. +Files: src/feature.h, src/charset.c, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/getchar.c, + src/normal.c, src/ui.c, src/version.c, src/globals.h + +Patch 7.4.1223 +Problem: Crash when setting v:errors to a number. +Solution: Free the typval without assuming its type. (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1224 +Problem: Build problems with GTK on BSD. (Mike Williams) +Solution: Don't use "$<". Skip building gui_gtk_gresources.h when it doesn't + work. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1225 +Problem: Still a few old style function declarations. +Solution: Make them new style. (Hirohito Higashi) +Files: runtime/tools/blink.c, src/eval.c, src/ex_cmds2.c, src/ex_getln.c, + src/fileio.c, src/gui_w32.c, src/gui_x11.c, src/if_perl.xs, + src/os_unix.c, src/po/sjiscorr.c, src/pty.c + +Patch 7.4.1226 +Problem: GRESOURCE_HDR is unused. +Solution: Remove it. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure, src/config.mk.in + +Patch 7.4.1227 +Problem: Compiler warnings. +Solution: Add UNUSED. Add type cast. (Yegappan Lakshmanan) +Files: src/getchar.c, src/os_macosx.m + +Patch 7.4.1228 +Problem: copy() and deepcopy() fail with special variables. (Nikolai + Pavlov) +Solution: Make it work. Add a test. Closes #614. +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1229 +Problem: "eval" and "expr" channel commands don't work yet. +Solution: Implement them. Update the error numbers. Also add "redraw". +Files: src/channel.c, src/eval.c, src/json.c, src/ex_docmd.c, + src/proto/channel.pro, src/proto/json.pro, src/proto/ex_docmd.pro, + runtime/doc/channel.txt + +Patch 7.4.1230 +Problem: Win32: opening a channel may hang. Not checking for messages + while waiting for characters. +Solution: Add a zero timeout. Call parse_queued_messages(). (Yasuhiro + Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1231 +Problem: JSON messages are not parsed properly. +Solution: Queue received messages. +Files: src/eval.c src/channel.c, src/json.c, src/proto/eval.pro, + src/proto/channel.pro, src/proto/json.pro, src/structs.h + +Patch 7.4.1232 +Problem: Compiler warnings when the Sniff feature is enabled. +Solution: Add UNUSED. +Files: src/gui_gtk_x11.c + +Patch 7.4.1233 +Problem: Channel command may cause a crash. +Solution: Check for NULL argument. (Damien) +Files: src/channel.c + +Patch 7.4.1234 +Problem: Demo server only runs with Python 2. +Solution: Make it run with Python 3 as well. (Ken Takata) +Files: runtime/tools/demoserver.py + +Patch 7.4.1235 (after 7.4.1231) +Problem: Missing change to eval.c. +Solution: Include that change. +Files: src/eval.c + +Patch 7.4.1236 +Problem: When "syntax manual" was used switching between buffers removes + the highlighting. +Solution: Set the syntax option without changing the value. (Anton + Lindqvist) +Files: runtime/syntax/manual.vim + +Patch 7.4.1237 +Problem: Can't translate message without adding a line break. +Solution: Join the two parts of the message. +Files: src/memline.c + +Patch 7.4.1238 +Problem: Can't handle two messages right after each other. +Solution: Find the end of the JSON. Read more when incomplete. Add a C + test for the JSON decoding. +Files: src/channel.c, src/json.c, src/proto/json.pro, src/eval.c, + src/Makefile, src/json_test.c, src/memfile_test.c, src/structs.h + +Patch 7.4.1239 +Problem: JSON message after the first one is dropped. +Solution: Put remainder of message back in the queue. +Files: src/channel.c + +Patch 7.4.1240 +Problem: Visual studio tools are noisy. +Solution: Suppress startup info. (Mike Williams) +Files: src/GvimExt/Makefile, src/Make_mvc.mak, src/tee/Make_mvc.mak + +Patch 7.4.1241 (after 7.4.1238) +Problem: Missing change in Makefile due to diff mismatch +Solution: Update the list of object files. +Files: src/Makefile + +Patch 7.4.1242 (after 7.4.1238) +Problem: json_test fails without the eval feature. +Solution: Add #ifdef. +Files: src/json_test.c + +Patch 7.4.1243 +Problem: Compiler warning for uninitialized variable. +Solution: Initialize it. (Elias Diem) +Files: src/json.c + +Patch 7.4.1244 +Problem: The channel functions don't sort together. +Solution: Use a common "ch_" prefix. +Files: src/eval.c, runtime/doc/eval.txt, runtime/tools/demoserver.py + +Patch 7.4.1245 +Problem: File missing from distribution. +Solution: Add json_test.c. +Files: Filelist + +Patch 7.4.1246 +Problem: The channel functionality isn't tested. +Solution: Add a test using a Python test server. +Files: src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel.py, + src/testdir/Make_all.mak + +Patch 7.4.1247 +Problem: The channel test doesn't run on MS-Windows. +Solution: Make it work on the MS-Windows console. (Ken Takata) +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1248 +Problem: Can't reliably stop the channel test server. Can't start the + server if the python file is not executable. +Solution: Use "pkill" instead of "killall". Run the python file as an + argument instead of as an executable. +Files: src/testdir/test_channel.vim + +Patch 7.4.1249 +Problem: Crash when the process a channel is connected to exits. +Solution: Use the file descriptor properly. Add a test. (Damien) + Also add a test for eval(). +Files: src/channel.c, src/testdir/test_channel.py, + src/testdir/test_channel.vim + +Patch 7.4.1250 +Problem: Running tests in shadow directory fails. +Solution: Also link testdir/*.py +Files: src/Makefile + +Patch 7.4.1251 +Problem: New test file missing from distribution. +Solution: Add src/testdir/*.py. +Files: Filelist + +Patch 7.4.1252 +Problem: The channel test server may receive two messages concatenated. +Solution: Split the messages. +Files: src/testdir/test_channel.py + +Patch 7.4.1253 +Problem: Python test server not displaying second of two commands. + Solaris doesn't have "pkill --full". +Solution: Also echo the second command. Use "pkill -f". +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1254 +Problem: Opening a second channel causes a crash. (Ken Takata) +Solution: Don't re-allocate the array with channels. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1255 +Problem: Crash for channel "eval" command without third argument. +Solution: Check for missing argument. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1256 +Problem: On Mac sys.exit(0) doesn't kill the test server. +Solution: Use self.server.shutdown(). (Jun Takimoto) +Files: src/testdir/test_channel.py + +Patch 7.4.1257 +Problem: Channel test fails in some configurations. +Solution: Add check for the +channel feature. +Files: src/testdir/test_channel.vim + +Patch 7.4.1258 +Problem: The channel test can fail if messages arrive later. +Solution: Add a short sleep. (Jun Takimoto) +Files: src/testdir/test_channel.vim + +Patch 7.4.1259 +Problem: No test for what patch 7.3.414 fixed. +Solution: Add a test. (Elias Diem) +Files: src/testdir/test_increment.vim + +Patch 7.4.1260 +Problem: The channel feature doesn't work on Win32 GUI. +Solution: Use WSAGetLastError(). (Ken Takata) +Files: src/channel.c, src/testdir/test_channel.vim, src/vim.h + +Patch 7.4.1261 +Problem: Pending channel messages are garbage collected. Leaking memory in + ch_sendexpr(). Leaking memory for a decoded JSON string. +Solution: Mark the message list as used. Free the encoded JSON. Don't save + the JSON string. +Files: src/eval.c, src/channel.c, src/json.c, src/proto/channel.pro + +Patch 7.4.1262 +Problem: The channel callback is not invoked. +Solution: Make a list of pending callbacks. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1263 +Problem: ch_open() hangs when the server isn't running. +Solution: Add a timeout. Use a dict to pass arguments. (Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, runtime/doc/channel.txt, src/channel.c, + src/eval.c, src/netbeans.c, src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1264 +Problem: Crash when receiving an empty array. +Solution: Check for array with wrong number of arguments. (Damien) +Files: src/channel.c, src/eval.c, src/testdir/test_channel.py, + src/testdir.test_channel.vim + +Patch 7.4.1265 +Problem: Not all channel commands are tested. +Solution: Add a test for "normal", "expr" and "redraw". +Files: src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1266 +Problem: A BufAdd autocommand may cause an ml_get error (Christian + Brabandt) +Solution: Increment RedrawingDisabled earlier. +Files: src/ex_cmds.c + +Patch 7.4.1267 +Problem: Easy to miss handling all types of variables. +Solution: Change the variable type into an enum. +Files: src/structs.h, src/eval.c + +Patch 7.4.1268 +Problem: Waittime is used as seconds instead of milliseconds. (Hirohito + Higashi) +Solution: Divide by 1000. +Files: src/channel.c + +Patch 7.4.1269 +Problem: Encoding {'key':v:none} to JSON doesn't give an error (Tyru) +Solution: Give an error. +Files: src/json.c, src/testdir/test_json.vim + +Patch 7.4.1270 +Problem: Warnings for missing values in switch. +Solution: Change switch to if-else or add values. +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 7.4.1271 +Problem: assert_false(v:false) reports an error. (Nikolai Pavlov) +Solution: Recognize v:true and v:false. (Closes #625) +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1272 (after 7.4.1270) +Problem: Using future enum value. +Solution: Remove it. +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1273 (after 7.4.1271) +Problem: assert_false(v:false) still fails. +Solution: Fix the typo. +Files: src/eval.c + +Patch 7.4.1274 +Problem: Cannot run a job. +Solution: Add job_start(), job_status() and job_stop(). Currently only works + for Unix. +Files: src/eval.c, src/structs.h, runtime/doc/eval.txt, src/os_unix.c, + src/proto/os_unix.pro, src/feature.h, src/version.c, + src/testdir/test_channel.vim + +Patch 7.4.1275 (after 7.4.1274) +Problem: Build fails on MS-Windows. +Solution: Fix wrong #ifdef. +Files: src/eval.c + +Patch 7.4.1276 +Problem: Warning for not using return value of fcntl(). +Solution: Explicitly ignore the return value. +Files: src/fileio.c, src/channel.c, src/memfile.c, src/memline.c + +Patch 7.4.1277 +Problem: Compiler can complain about missing enum value in switch with some + combination of features. +Solution: Remove #ifdefs around case statements. +Files: src/eval.c + +Patch 7.4.1278 +Problem: When jsonencode() fails it still returns something. +Solution: Return an empty string on failure. +Files: src/json.c, src/channel.c, src/testdir/test_json.vim, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1279 +Problem: jsonencode() is not producing strict JSON. +Solution: Add jsencode() and jsdecode(). Make jsonencode() and jsondecode() + strict. +Files: src/json.c, src/json_test.c, src/proto/json.pro, src/channel.c, + src/proto/channel.pro, src/eval.c, src/vim.h, src/structs.h, + runtime/doc/eval.txt, runtime/doc/channel.txt, + src/testdir/test_json.vim + +Patch 7.4.1280 +Problem: Missing case value. +Solution: Add VAR_JOB. +Files: src/if_python.c, src/if_python3.c + +Patch 7.4.1281 +Problem: No test for skipping over code that isn't evaluated. +Solution: Add a test with code that would fail when not skipped. +Files: src/testdir/test_viml.vim + +Patch 7.4.1282 +Problem: Crash when evaluating the pattern of ":catch" causes an error. + (Dominique Pelle) +Solution: Block error messages at this point. +Files: src/ex_eval.c + +Patch 7.4.1283 +Problem: The job feature isn't available on MS-Windows. +Solution: Add the job feature. Fix argument of job_stop(). (Yasuhiro + Matsumoto) +Files: src/eval.c, src/feature.h, src/os_win32.c, src/proto/os_win32.pro + +Patch 7.4.1284 (after 7.4.1282) +Problem: Test 49 fails. +Solution: Check for a different error message. +Files: src/testdir/test49.vim + +Patch 7.4.1285 +Problem: Cannot measure elapsed time. +Solution: Add reltimefloat(). +Files: src/ex_cmds2.c, src/eval.c, src/proto/ex_cmds2.pro, + src/testdir/test_reltime.vim, src/testdir/test_alot.vim + +Patch 7.4.1286 +Problem: ch_open() with a timeout doesn't work correctly. +Solution: Change how select() is used. Don't give an error on timeout. + Add a test for ch_open() failing. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1287 (after 7.4.1286) +Problem: Channel test fails. +Solution: Use reltimefloat(). +Files: src/testdir/test_channel.vim + +Patch 7.4.1288 +Problem: ch_sendexpr() does not use JS encoding. +Solution: Use the encoding that fits the channel mode. Refuse using + ch_sendexpr() on a raw channel. +Files: src/channel.c, src/proto/channel.pro, src/eval.c + +Patch 7.4.1289 +Problem: Channel test fails on MS-Windows, connect() takes too long. +Solution: Adjust the test for MS-Windows using "waittime". +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1290 +Problem: Coverity complains about unnecessary check for NULL. +Solution: Remove the check. +Files: src/eval.c + +Patch 7.4.1291 +Problem: On MS-Windows the channel test server doesn't quit. +Solution: Use return instead of break. (Ken Takata) +Files: src/testdir/test_channel.py + +Patch 7.4.1292 +Problem: Some compilers complain about uninitialized variable, even though + all possible cases are handled. (Dominique Pelle) +Solution: Add a default initialization. +Files: src/eval.c + +Patch 7.4.1293 +Problem: Sometimes a channel may hang waiting for a message that was + already discarded. (Ken Takata) +Solution: Store the ID of the message blocking on in the channel. +Files: src/channel.c + +Patch 7.4.1294 +Problem: job_stop() only kills the started process. +Solution: Send the signal to the process group. (Olaf Dabrunz) +Files: src/os_unix.c + +Patch 7.4.1295 +Problem: string(job) doesn't work well on MS-Windows. +Solution: Use the process ID. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1296 +Problem: Cursor changes column with up motion when the matchparen plugin + saves and restores the cursor position. (Martin Kunev) +Solution: Make sure curswant is updated before invoking the autocommand. +Files: src/edit.c + +Patch 7.4.1297 +Problem: On Mac test_channel leaves python instances running. +Solution: Use a small waittime to make ch_open() work. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1298 +Problem: When the channel test fails in an unexpected way the server keeps + running. +Solution: Use try/catch. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1299 +Problem: When the server sends a message with ID zero the channel handler + is not invoked. (Christian J. Robinson) +Solution: Recognize zero value for the request ID. Add a test for invoking + the channel handler. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1300 +Problem: Cannot test CursorMovedI because there is typeahead. +Solution: Add disable_char_avail_for_testing(). +Files: src/eval.c, src/getchar.c, src/globals.h, + src/testdir/test_cursor_func.vim, src/testdir/README.txt + +Patch 7.4.1301 +Problem: Missing options in ch_open(). +Solution: Add s:chopt like in the other calls. (Ozaki Kiichi) +Files: src/testdir/test_channel.vim + +Patch 7.4.1302 +Problem: Typo in struct field name. (Ken Takata) +Solution: Rename jf_pi to jv_pi. +Files: src/eval.c, src/os_win32.c, src/structs.h + +Patch 7.4.1303 +Problem: A Funcref is not accepted as a callback. +Solution: Make a Funcref work. (Damien) +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1304 +Problem: Function names are difficult to read. +Solution: Rename jsonencode to json_encode, jsondecode to json_decode, + jsencode to js_encode and jsdecode to js_decode. +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_json.vim + +Patch 7.4.1305 +Problem: "\%1l^#.*" does not match on a line starting with "#". +Solution: Do not clear the start-of-line flag. (Christian Brabandt) +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test36.in, + src/testdir/test36.ok + +Patch 7.4.1306 +Problem: Job control doesn't work well on MS-Windows. +Solution: Various fixes. (Ken Takata, Ozaki Kiichi, Yukihiro Nakadaira, + Yasuhiro Matsumoto) +Files: src/Make_mvc.mak, src/eval.c, src/os_unix.c, src/os_win32.c, + src/proto/os_unix.pro, src/proto/os_win32.pro, src/structs.h + +Patch 7.4.1307 +Problem: Some channel tests fail on MS-Windows. +Solution: Disable the failing tests temporarily. +Files: src/testdir/test_channel.vim + +Patch 7.4.1308 (after 7.4.1307) +Problem: Typo in test. +Solution: Change endf to endif. +Files: src/testdir/test_channel.vim + +Patch 7.4.1309 +Problem: When a test fails not all relevant info is listed. +Solution: Add the errors to the messages. +Files: src/testdir/runtest.vim + +Patch 7.4.1310 +Problem: Jobs don't open a channel. +Solution: Create pipes and add them to the channel. Add ch_logfile(). + Only Unix for now. +Files: src/channel.c, src/eval.c, src/os_unix.c, src/structs.h, + src/gui_w48.c, src/proto/channel.pro, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py, runtime/doc/eval.txt + +Patch 7.4.1311 (after 7.4.1310) +Problem: sock_T is defined too late. +Solution: Move it up. +Files: src/vim.h + +Patch 7.4.1312 (after 7.4.1311) +Problem: sock_T is not defined without the +channel feature. +Solution: Always define it. +Files: src/vim.h + +Patch 7.4.1313 +Problem: MS-Windows: Using socket after it was closed causes an exception. +Solution: Don't give an error when handling WM_NETBEANS. Re-enable tests + for MS-Windows. +Files: src/gui_w48.c, src/testdir/test_channel.vim + +Patch 7.4.1314 +Problem: Warning for uninitialized variable. +Solution: Initialize it. (Dominique Pelle) +Files: src/channel.c + +Patch 7.4.1315 +Problem: Using a channel handle does not allow for freeing it when unused. +Solution: Add the Channel variable type. +Files: src/structs.h, src/channel.c, src/misc2.c, src/eval.c, + src/if_python.c, src/if_python3.c, src/json.c, src/gui_w48.c, + src/netbeans.c, src/proto/channel.pro, src/os_unix.c, + src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1316 +Problem: Can't build MS-Windows console version. (Tux) +Solution: Add #ifdefs. +Files: src/eval.c + +Patch 7.4.1317 +Problem: MS-Windows: channel test fails. +Solution: Temporarily disable Test_connect_waittime(). +Files: src/testdir/test_channel.vim + +Patch 7.4.1318 +Problem: Channel with pipes doesn't work in GUI. +Solution: Register input handlers for pipes. +Files: src/structs.h, src/feature.h, src/channel.c, src/eval.c, + src/os_unix.c, src/os_win32.c, src/gui_w48.c, src/proto/channel.pro + +Patch 7.4.1319 (after 7.4.1318) +Problem: Tests fail on MS-Windows and on Unix with GUI. +Solution: Fix unregistering. +Files: src/structs.h, src/channel.c, src/os_unix.c, src/os_win32.c, + src/proto/channel.pro + +Patch 7.4.1320 +Problem: Building with Cygwin or MingW with channel but without Netbeans + doesn't work. +Solution: Set NETBEANS to "no" when not used. +Files: src/Make_cyg_ming.mak + +Patch 7.4.1321 +Problem: Compiler complains about missing statement. +Solution: Add an empty statement. (Andrei Olsen) +Files: src/os_win32.c + +Patch 7.4.1322 +Problem: Crash when unletting the variable that holds the channel in a + callback function. (Christian Robinson) +Solution: Increase the reference count while invoking the callback. +Files: src/eval.c, src/channel.c, src/proto/eval.pro, + src/testdir/test_channel.vim + +Patch 7.4.1323 +Problem: Do not get warnings when building with MingW. +Solution: Remove the -w flag. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1324 +Problem: Channels with pipes don't work on MS-Windows. +Solution: Add pipe I/O support. (Yasuhiro Matsumoto) +Files: src/channel.c, src/os_win32.c, src/proto/channel.pro, + src/structs.h, src/vim.h, src/testdir/test_channel.vim + +Patch 7.4.1325 +Problem: Channel test fails on difference between Unix and DOS line endings. +Solution: Strip off CR. Make assert show difference better. +Files: src/eval.c, src/channel.c + +Patch 7.4.1326 +Problem: Build rules are bit too complicated. +Solution: Remove -lwsock32 from Netbeans, it's already added for the channel + feature that it depends on. (Tony Mechelynck) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1327 +Problem: Channel test doesn't work if Python executable is python.exe. +Solution: Find py.exe or python.exe. (Ken Takata) +Files: src/testdir/test_channel.vim + +Patch 7.4.1328 +Problem: Can't compile with +job but without +channel. (John Marriott) +Solution: Add more #ifdefs. +Files: src/os_unix.c + +Patch 7.4.1329 +Problem: Crash when using channel that failed to open. +Solution: Check for NULL. Update messages. (Yukihiro Nakadaira) +Files: src/channel.c, src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1330 +Problem: fd_read() has an unused argument. +Solution: Remove the timeout. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1331 +Problem: Crash when closing the channel in a callback. (Christian J. + Robinson) +Solution: Take the callback out of the list before invoking it. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1332 +Problem: Problem using Python3 when compiled with MingW. +Solution: Define PYTHON3_HOME as a wide character string. (Yasuhiro + Matsumoto) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1333 +Problem: Channel test fails on non-darwin builds. +Solution: Add the "osx" feature and test for that. (Kazunobu Kuriyama) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1334 +Problem: Many compiler warnings with MingW. +Solution: Add type casts. (Yasuhiro Matsumoto) +Files: src/channel.c, src/dosinst.h, src/eval.c, src/ex_cmds2.c, + src/ex_getln.c, src/fileio.c, src/if_cscope.c, src/if_perl.xs, + src/if_python.c, src/if_python3.c, src/if_ruby.c, src/main.c, + src/mbyte.c, src/misc1.c, src/option.c, src/os_mswin.c, + src/os_win32.c + +Patch 7.4.1335 +Problem: Can't build on MS-Windows with +job but without +channel. (Cesar + Romani) +Solution: Add #ifdefs. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1336 +Problem: Channel NL mode is not supported yet. +Solution: Add NL mode support to channels. +Files: src/channel.c, src/netbeans.c, src/structs.h, src/os_unix.d, + src/os_win32.c, src/proto/channel.pro, src/proto/os_unix.pro, + src/proto/os_win32.pro, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1337 (after 7.4.1336) +Problem: Part of the change is missing. +Solution: Add changes to eval.c +Files: src/eval.c + + +Patch 7.4.1338 (after 7.4.1336) +Problem: Another part of the change is missing. +Solution: Type os_unix.c right this time. +Files: src/os_unix.c + +Patch 7.4.1339 +Problem: Warnings when building the GUI with MingW. (Cesar Romani) +Solution: Add type casts. (Yasuhiro Matsumoto) +Files: src/edit.c, src/gui_w32.c, src/gui_w48.c, src/os_mswin.c, + src/os_win32.c + +Patch 7.4.1340 (after 7.4.1339) +Problem: Merge left extra #endif behind. +Solution: Remove the #endif +Files: src/os_win32.c + +Patch 7.4.1341 +Problem: It's difficult to add more arguments to ch_sendraw() and + ch_sendexpr(). +Solution: Make the third option a dictionary. +Files: src/eval.c, src/structs.h, src/channel.c, src/os_unix.c, + src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1342 +Problem: On Mac OS/X the waittime must be > 0 for connect to work. +Solution: Use select() in a different way. (partly by Kazunobu Kuriyama) + Always use a waittime of 1 or more. +Files: src/eval.c, src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1343 +Problem: Can't compile with +job but without +channel. (Andrei Olsen) +Solution: Move get_job_options up and adjust #ifdef. +Files: src/eval.c + +Patch 7.4.1344 +Problem: Can't compile Win32 GUI with tiny features. +Solution: Add #ifdef. (Christian Brabandt) +Files: src/gui_w32.c + +Patch 7.4.1345 +Problem: A few more compiler warnings. (Axel Bender) +Solution: Add type casts. +Files: src/gui_w32.c, src/gui_w48.c + +Patch 7.4.1346 +Problem: Compiler warnings in build with -O2. +Solution: Add initializations. +Files: src/eval.c + +Patch 7.4.1347 +Problem: When there is any error Vim will use a non-zero exit code. +Solution: When using ":silent!" do not set the exit code. (Yasuhiro + Matsumoto) +Files: src/message.c + +Patch 7.4.1348 +Problem: More compiler warnings. (John Marriott) +Solution: Add type casts, remove unused variable. +Files: src/gui_w32.c + +Patch 7.4.1349 +Problem: And some more MingW compiler warnings. (Cesar Romani) +Solution: Add type casts. +Files: src/if_mzsch.c + +Patch 7.4.1350 +Problem: When the test server fails to start Vim hangs. +Solution: Check that there is actually something to read from the tty fd. +Files: src/os_unix.c + +Patch 7.4.1351 +Problem: When the port isn't opened yet when ch_open() is called it may + fail instead of waiting for the specified time. +Solution: Loop when select() succeeds but when connect() failed. Also use + channel logging for jobs. Add ch_log(). +Files: src/channel.c, src/eval.c, src/netbeans.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1352 +Problem: The test script lists all functions before executing them. +Solution: Only list the function currently being executed. +Files: src/testdir/runtest.vim + +Patch 7.4.1353 +Problem: Test_connect_waittime is skipped for MS-Windows. +Solution: Add the test back, it works now. +Files: src/testdir/test_channel.vim + +Patch 7.4.1354 +Problem: MS-Windows: Mismatch between default compile options and what the + code expects. +Solution: Change the default WINVER from 0x0500 to 0x0501. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.1355 +Problem: Win32 console and GUI handle channels differently. +Solution: Consolidate code between Win32 console and GUI. +Files: src/channel.c, src/eval.c, src/gui_w48.c, src/os_win32.c, + src/proto/channel.pro + +Patch 7.4.1356 +Problem: Job and channel options parsing is scattered. +Solution: Move all option value parsing to get_job_options(); +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1357 (after 7.4.1356) +Problem: Error for returning value from void function. +Solution: Don't do that. +Files: src/eval.c + +Patch 7.4.1358 +Problem: Compiler warning when not building with +crypt. +Solution: Add #ifdef. (John Marriott) +Files: src/undo.c + +Patch 7.4.1359 (after 7.4.1356) +Problem: Channel test ch_sendexpr() times out. +Solution: Increase the timeout +Files: src/testdir/test_channel.vim + +Patch 7.4.1360 +Problem: Can't remove a callback with ch_setoptions(). +Solution: When passing zero or an empty string remove the callback. +Files: src/channel.c, src/proto/channel.pro, src/testdir/test_channel.vim + +Patch 7.4.1361 +Problem: Channel test fails on Solaris. +Solution: Use the 1 msec waittime for all systems. +Files: src/channel.c + +Patch 7.4.1362 (after 7.4.1356) +Problem: Using uninitialized value. +Solution: Initialize jo_set. +Files: src/eval.c + +Patch 7.4.1363 +Problem: Compiler warnings with tiny build. +Solution: Add #ifdefs. +Files: src/gui_w48.c, src/gui_w32.c + +Patch 7.4.1364 +Problem: The Win 16 code is not maintained and unused. +Solution: Remove the Win 16 support. +Files: src/gui_w16.c, src/gui_w32.c, src/gui_w48.c, src/Make_w16.mak, + src/Makefile, src/Make_cyg_ming.mak, src/Make_mvc.mak, + src/proto/gui_w16.pro, src/proto/os_win16.pro, src/guiw16rc.h, + src/vim16.rc, src/vim16.def, src/tools16.bmp, src/eval.c, + src/gui.c, src/misc2.c, src/option.c, src/os_msdos.c, + src/os_mswin.c, src/os_win16.c, src/os_win16.h, src/version.c, + src/winclip.c, src/feature.h, src/proto.h, src/vim.h, Filelist + +Patch 7.4.1365 +Problem: Cannot execute a single test function. +Solution: Add an argument to filter the functions with. (Yasuhiro Matsumoto) +Files: src/testdir/runtest.vim + +Patch 7.4.1366 +Problem: Typo in test and resulting error in test result. +Solution: Fix the typo and correct the result. (James McCoy, closes #650) +Files: src/testdir/test_charsearch.in, src/testdir/test_charsearch.ok + +Patch 7.4.1367 +Problem: Compiler warning for unreachable code. +Solution: Remove a "break". (Danek Duvall) +Files: src/json.c + +Patch 7.4.1368 +Problem: One more Win16 file remains. +Solution: Delete it. +Files: src/proto/os_win16.pro + +Patch 7.4.1369 +Problem: Channels don't have a queue for stderr. +Solution: Have a queue for each part of the channel. +Files: src/channel.c, src/eval.c, src/structs.h, src/netbeans.c, + src/gui_w32.c, src/proto/channel.pro + +Patch 7.4.1370 +Problem: The Python test script may keep on running. +Solution: Join the threads. (Yasuhiro Matsumoto) +Files: src/testdir/test_channel.py + +Patch 7.4.1371 +Problem: X11 GUI callbacks don't specify the part of the channel. +Solution: Pass the fd instead of the channel ID. +Files: src/channel.c + +Patch 7.4.1372 +Problem: channel read implementation is incomplete. +Solution: Add ch_read() and options for ch_readraw(). +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1373 +Problem: Calling a Vim function over a channel requires turning the + arguments into a string. +Solution: Add the "call" command. (Damien) Also merge "expr" and "eval" + into one. +Files: src/channel.c, src/testdir/test_channel.py, + src/testdir/test_channel.vim + +Patch 7.4.1374 +Problem: Channel test hangs on MS-Windows. +Solution: Disable the ch_read() that is supposed to time out. +Files: src/testdir/test_channel.vim + +Patch 7.4.1375 +Problem: Still some Win16 code. +Solution: Remove FEAT_GUI_W16.(Hirohito Higashi) +Files: src/eval.c, src/ex_cmds.h, src/feature.h, src/gui.h, src/menu.c, + src/misc1.c, src/option.c, src/proto.h, src/structs.h, src/term.c, + src/vim.h, runtime/doc/gui_w16.txt + +Patch 7.4.1376 +Problem: ch_setoptions() cannot set all options. +Solution: Support more options. +Files: src/channel.c, src/eval.c, src/structs.h, runtime/doc/channel.txt, + src/testdir/test_channel.vim + +Patch 7.4.1377 +Problem: Test_connect_waittime() is flaky. +Solution: Ignore the "Connection reset by peer" error. +Files: src/testdir/test_channel.vim + +Patch 7.4.1378 +Problem: Can't change job settings after it started. +Solution: Add job_setoptions() with the "stoponexit" flag. +Files: src/eval.c, src/main.c, src/structs.h, src/proto/eval.pro, + src/testdir/test_channel.vim + +Patch 7.4.1379 +Problem: Channel test fails on Win32 console. +Solution: Don't sleep when timeout is zero. Call channel_wait() before + channel_read(). Channels are not polled during ":sleep". (Yukihiro + Nakadaira) +Files: src/channel.c, src/misc2.c, src/gui_w32.c, src/os_win32.c + +Patch 7.4.1380 +Problem: The job exit callback is not implemented. +Solution: Add the "exit-cb" option. +Files: src/structs.h, src/eval.c, src/channel.c, src/proto/eval.pro, + src/misc2.c, src/macros.h, src/testdir/test_channel.vim + +Patch 7.4.1381 (after 7.4.1380) +Problem: Exit value not available on MS-Windows. +Solution: Set the exit value. +Files: src/structs.h, src/os_win32.c + +Patch 7.4.1382 +Problem: Can't get the job of a channel. +Solution: Add ch_getjob(). +Files: src/eval.c, runtime/doc/channel.txt, runtime/doc/eval.txt + +Patch 7.4.1383 +Problem: GvimExt only loads the old libintl.dll. +Solution: Also try loading libint-8.dll. (Ken Takata, closes #608) +Files: src/GvimExt/gvimext.cpp, src/GvimExt/gvimext.h + +Patch 7.4.1384 +Problem: It is not easy to use a set of plugins and their dependencies. +Solution: Add packages, ":loadplugin", 'packpath'. +Files: src/main.c, src/ex_cmds2.c, src/option.c, src/option.h, + src/ex_cmds.h, src/eval.c, src/version.c, src/proto/ex_cmds2.pro, + runtime/doc/repeat.txt, runtime/doc/options.txt, + runtime/optwin.vim + +Patch 7.4.1385 +Problem: Compiler warning for using array. +Solution: Use the right member name. (Yegappan Lakshmanan) +Files: src/eval.c + +Patch 7.4.1386 +Problem: When the Job exit callback is invoked, the job may be freed too + soon. (Yasuhiro Matsumoto) +Solution: Increase refcount. +Files: src/eval.c + +Patch 7.4.1387 +Problem: Win16 docs still referenced. +Solution: Remove Win16 files from the docs Makefile. (Kenichi Ito) +Files: runtime/doc/Makefile + +Patch 7.4.1388 +Problem: Compiler warning. (Cesar Romani) +Solution: Initialize variable. +Files: src/ex_cmds2.c + +Patch 7.4.1389 +Problem: Incomplete function declaration. +Solution: Add "void". (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1390 +Problem: When building with GTK and glib-compile-resources cannot be found + building Vim fails. (Michael Gehring) +Solution: Make GLIB_COMPILE_RESOURCES empty instead of leaving it at "no". + (nuko8, closes #655) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1391 +Problem: Warning for uninitialized variable. +Solution: Set it to zero. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.1392 +Problem: Some tests fail for Win32 console version. +Solution: Move the tests to SCRIPTS_MORE2. Pass VIMRUNTIME. (Christian + Brabandt) +Files: src/testdir/Make_all.mak + +Patch 7.4.1393 +Problem: Starting a job hangs in the GUI. (Takuya Fujiwara) +Solution: Don't check if ch_job is NULL when checking for an error. + (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1394 +Problem: Can't sort inside a sort function. +Solution: Use a struct to store the sort parameters. (Jacob Niehus) +Files: src/eval.c, src/testdir/test_sort.vim + +Patch 7.4.1395 +Problem: Using DETACH in quotes is not compatible with the Netbeans + interface. (Xavier de Gaye) +Solution: Remove the quotes, only use them for JSON and JS mode. +Files: src/netbeans.c, src/channel.c + +Patch 7.4.1396 +Problem: Compiler warnings for conversions. +Solution: Add type cast. +Files: src/ex_cmds2.c + +Patch 7.4.1397 +Problem: Sort test fails on MS-Windows. +Solution: Correct the compare function. +Files: src/testdir/test_sort.vim + +Patch 7.4.1398 +Problem: The close-cb option is not implemented yet. +Solution: Implement close-cb. (Yasuhiro Matsumoto) +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.py, src/testdir/test_channel.vim + +Patch 7.4.1399 +Problem: The MS-DOS code does not build. +Solution: Remove the old MS-DOS code. +Files: Filelist, src/Make_bc3.mak, src/Make_bc5.mak, src/Make_djg.mak, + src/Makefile, src/blowfish.c, src/buffer.c, src/diff.c, + src/digraph.c, src/dosinst.h, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/feature.h, + src/fileio.c, src/getchar.c, src/globals.h, src/macros.h, + src/main.c, src/mbyte.c, src/memfile.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/option.c, + src/option.h, src/os_msdos.c, src/os_msdos.h, src/proto.h, + src/proto/os_msdos.pro, src/regexp.c, src/screen.c, src/structs.h, + src/syntax.c, src/term.c, src/undo.c, src/uninstal.c, + src/version.c, src/vim.h, src/window.c, src/xxd/Make_bc3.mak, + src/xxd/Make_djg.mak + + +Patch 7.4.1400 +Problem: Perl eval doesn't work properly on 64-bit big-endian machine. +Solution: Use 32 bit type for the key. (Danek Duvall) +Files: src/if_perl.xs + +Patch 7.4.1401 +Problem: Having 'autochdir' set during startup and using diff mode doesn't + work. (Axel Bender) +Solution: Don't use 'autochdir' while still starting up. (Christian + Brabandt) +Files: src/buffer.c + +Patch 7.4.1402 +Problem: GTK 3 is not supported. +Solution: Add GTK 3 support. (Kazunobu Kuriyama) +Files: runtime/doc/eval.txt, runtime/doc/gui.txt, + runtime/doc/gui_x11.txt, src/auto/configure, src/channel.c, + src/config.h.in, src/configure.in, src/eval.c, src/gui.h, + src/gui_beval.c, src/gui_beval.h, src/gui_gtk.c, src/gui_gtk_f.c, + src/gui_gtk_f.h, src/gui_gtk_x11.c, src/if_mzsch.c, src/mbyte.c, + src/netbeans.c, src/structs.h, src/version.c + +Patch 7.4.1403 +Problem: Can't build without the quickfix feature. +Solution: Add #ifdefs. Call ex_ni() for unimplemented commands. (Yegappan + Lakshmanan) +Files: src/ex_cmds2.c, src/popupmnu.c + +Patch 7.4.1404 +Problem: ch_read() doesn't time out on MS-Windows. +Solution: Instead of WM_NETBEANS use select(). (Yukihiro Nakadaira) +Files: src/channel.c, src/gui_w32.c, src/os_win32.c, src/structs.h, + src/testdir/test_channel.vim, src/vim.h + +Patch 7.4.1405 +Problem: Completion menu flickers. +Solution: Delay showing the popup menu. (Shougo Matsu, Justin M. Keyes, + closes #656) +Files: src/edit.c + +Patch 7.4.1406 +Problem: Leaking memory in cs_print_tags_priv(). +Solution: Free tbuf. (idea by Forrest Fleming) +Files: src/if_cscope.c + +Patch 7.4.1407 +Problem: json_encode() does not handle NaN and inf properly. (David + Barnett) +Solution: For JSON turn them into "null". For JS use "NaN" and "Infinity". + Add isnan(). +Files: src/eval.c, src/json.c, src/testdir/test_json.vim + +Patch 7.4.1408 +Problem: MS-Windows doesn't have isnan() and isinf(). +Solution: Use _isnan() and _isinf(). +Files: src/eval.c, src/json.c + +Patch 7.4.1409 (after 7.4.1402) +Problem: Configure includes GUI despite --disable-gui flag. +Solution: Add SKIP_GTK3. (Kazunobu Kuriyama) +Files: src/configure.in, src/auto/configure + +Patch 7.4.1410 +Problem: Leaking memory in cscope interface. +Solution: Free memory when no tab is found. (Christian Brabandt) +Files: src/if_cscope.c + +Patch 7.4.1411 +Problem: Compiler warning for indent. (Ajit Thakkar) +Solution: Indent normally. +Files: src/ui.c + +Patch 7.4.1412 +Problem: Compiler warning for indent. (Dominique Pelle) +Solution: Fix the indent. +Files: src/farsi.c + +Patch 7.4.1413 +Problem: When calling ch_close() the close callback is invoked, even though + the docs say it isn't. (Christian J. Robinson) +Solution: Don't call the close callback. +Files: src/eval.c, src/channel.c, src/netbeans.c, src/proto/channel.pro + +Patch 7.4.1414 +Problem: Appveyor only builds one feature set. +Solution: Build a combination of features and GUI/console. (Christian + Brabandt) +Files: appveyor.yml, src/appveyor.bat + +Patch 7.4.1415 (after 7.4.1414) +Problem: Dropped the skip-tags setting. +Solution: Put it back. +Files: appveyor.yml + +Patch 7.4.1416 +Problem: Using "u_char" instead of "char_u", which doesn't work everywhere. + (Jörg Plate) +Solution: Use "char_u" always. +Files: src/integration.c, src/macros.h + +Patch 7.4.1417 (after 7.4.1414) +Problem: Missing appveyor.bat from the distribution. +Solution: Add it to the list of files. +Files: Filelist + +Patch 7.4.1418 +Problem: job_stop() on MS-Windows does not really stop the job. +Solution: Make the default to stop the job forcefully. (Ken Takata) + Make MS-Windows and Unix more similar. +Files: src/os_win32.c, src/os_unix.c, runtime/doc/eval.txt + +Patch 7.4.1419 +Problem: Tests slowed down because of the "not a terminal" warning. +Solution: Add the --not-a-term command line argument. +Files: src/main.c, src/testdir/Makefile, src/Make_all.mak, + src/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_vms.mms, + runtime/doc/starting.txt + +Patch 7.4.1420 (after 7.4.1419) +Problem: Missing makefile. +Solution: Type the path correctly. +Files: src/testdir/Make_all.mak + +Patch 7.4.1421 +Problem: May free a channel when a callback may need to be invoked. +Solution: Keep the channel when refcount is zero. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1422 +Problem: Error when reading fails uses wrong errno. Keeping channel open + after job stops results in test failing. +Solution: Move the error up. Add ch_job_killed. +Files: src/channel.c, src/eval.c, src/structs.h + +Patch 7.4.1423 +Problem: Channel test fails on MS-Windows. +Solution: Do not give an error message when reading fails, assume the other + end exited. +Files: src/channel.c + +Patch 7.4.1424 +Problem: Not using --not-a-term when running tests on MS-Windows. +Solution: Use NO_PLUGIN. (Christian Brabandt) +Files: src/testdir/Make_dos.mak + +Patch 7.4.1425 +Problem: There are still references to MS-DOS support. +Solution: Remove most of the help txt and install instructions. (Ken Takata) +Files: src/INSTALLpc.txt, runtime/doc/os_msdos.txt, csdpmi4b.zip, + Filelist + +Patch 7.4.1426 +Problem: The "out-io" option for jobs is not implemented yet. +Solution: Implement the "buffer" value: append job output to a buffer. +Files: src/eval.c, src/channel.c, src/structs.h, src/netbeans.c, + runtime/doc/channel.txt + +Patch 7.4.1427 +Problem: Trailing comma in enums is not ANSI C. +Solution: Remove the trailing commas. +Files: src/alloc.h, src/gui_mac.c + +Patch 7.4.1428 +Problem: Compiler warning for non-virtual destructor. +Solution: Make it virtual. (Yasuhiro Matsumoto) +Files: src/gui_dwrite.cpp + +Patch 7.4.1429 +Problem: On MS-Windows, when not use renderoptions=type:directx, drawing + emoji will be broken. +Solution: Fix usage of unicodepdy. (Yasuhiro Matsumoto) +Files: src/gui_w32.c + +Patch 7.4.1430 +Problem: When encoding JSON, turning NaN and Infinity into null without + giving an error is not useful. +Solution: Pass NaN and Infinity on. If the receiver can't handle them it + will generate the error. +Files: src/json.c, src/testdir/test_json.vim, runtime/doc/eval.txt + +Patch 7.4.1431 +Problem: Including header files twice. +Solution: Remove the extra includes. +Files: src/if_cscope.h + +Patch 7.4.1432 +Problem: Typo in button text. +Solution: Fix the typo. (Dominique Pelle) +Files: src/gui_gtk.c + +Patch 7.4.1433 +Problem: The Sniff interface is no longer useful, the tool has not been + available for may years. +Solution: Delete the Sniff interface and related code. +Files: src/if_sniff.c, src/if_sniff.h, src/charset.c, src/edit.c, + src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, + src/gui_gtk_x11.c, src/gui_w32.c, src/gui_x11.c, src/normal.c, + src/os_unix.c, src/os_win32.c, src/term.c, src/ui.c, + src/version.c, src/ex_cmds.h, src/feature.h, src/keymap.h, + src/structs.h, src/vim.h, src/Make_mvc.mak, src/Make_vms.mms, + src/Makefile, src/configure.in, src/auto/configure, + src/config.h.in, src/config.mk.in, runtime/doc/if_sniff.txt, + src/config.aap.in, src/main.aap + +Patch 7.4.1434 +Problem: JSON encoding doesn't handle surrogate pair. +Solution: Improve multi-byte handling of JSON. (Yasuhiro Matsumoto) +Files: src/json.c, src/testdir/test_json.vim + +Patch 7.4.1435 +Problem: It is confusing that ch_sendexpr() and ch_sendraw() wait for a + response. +Solution: Add ch_evalexpr() and ch_evalraw(). +Files: src/eval.c, runtime/doc/channel.txt, runtime/doc/eval.txt, + src/testdir/test_channel.vim + +Patch 7.4.1436 (after 7.4.1433) +Problem: Sniff files still referenced in distribution. +Solution: Remove sniff files from distribution. +Files: Filelist + +Patch 7.4.1437 +Problem: Old system doesn't have isinf() and NAN. (Ben Fritz) +Solution: Adjust #ifdefs. Detect isnan() and isinf() functions with + configure. Use a replacement when missing. (Kazunobu Kuriyama) +Files: src/eval.c, src/json.c, src/macros.h, src/message.c, + src/config.h.in, src/configure.in, src/auto/configure + +Patch 7.4.1438 +Problem: Can't get buffer number of a channel. +Solution: Add ch_getbufnr(). +Files: src/eval.c, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt, runtime/doc/eval.txt + +Patch 7.4.1439 (after 7.4.1434) +Problem: Using uninitialized variable. +Solution: Initialize vc_type. +Files: src/json.c + +Patch 7.4.1440 (after 7.4.1437) +Problem: Can't build on Windows. +Solution: Change #ifdefs. Only define isnan when used. +Files: src/macros.h, src/eval.c, src/json.c + +Patch 7.4.1441 +Problem: Using empty name instead of no name for channel buffer. +Solution: Remove the empty name. +Files: src/channel.c + +Patch 7.4.1442 +Problem: MS-Windows: more compilation warnings for destructor. +Solution: Add "virtual". (Ken Takata) +Files: src/if_ole.cpp + +Patch 7.4.1443 +Problem: Can't build GTK3 with small features. +Solution: Use gtk_widget_get_window(). Fix typos. (Dominique Pelle) +Files: src/gui_gtk_x11.c + +Patch 7.4.1444 +Problem: Can't build with JSON but without multi-byte. +Solution: Fix pointer name. +Files: src/json.c + +Patch 7.4.1445 +Problem: Memory corruption when 'encoding' is not utf-8. +Solution: Convert decoded string later. +Files: src/json.c + +Patch 7.4.1446 +Problem: Crash when using json_decode(). +Solution: Terminate string with a NUL byte. +Files: src/json.c + +Patch 7.4.1447 +Problem: Memory leak when using ch_read(). (Dominique Pelle) + No log message when stopping a job and a few other situations. + Too many "Nothing to read" messages. Channels are not freed. +Solution: Free the listtv. Add more log messages. Remove "Nothing to read" + message. Remove the channel from the job when its refcount + becomes zero. +Files: src/eval.c, src/channel.c + +Patch 7.4.1448 +Problem: JSON tests fail if 'encoding' is not utf-8. +Solution: Force encoding to utf-8. +Files: src/testdir/test_json.vim + +Patch 7.4.1449 +Problem: Build fails with job feature but without channel feature. +Solution: Add #ifdef. +Files: src/eval.c + +Patch 7.4.1450 +Problem: Json encoding still fails when encoding is not utf-8. +Solution: Set 'encoding' before :scriptencoding. Run the json test + separately to avoid affecting other tests. +Files: src/testdir/test_json.vim, src/testdir/Make_all.mak, + src/testdir/test_alot.vim + +Patch 7.4.1451 +Problem: Vim hangs when a channel has a callback but isn't referenced. +Solution: Have channel_unref() only return TRUE when the channel was + actually freed. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1452 +Problem: When a callback adds a syntax item either the redraw doesn't + happen right away or in the GUI the cursor is in the wrong + position for a moment. (Jakson Alves de Aquino) +Solution: Redraw after the callback was invoked. +Files: src/channel.c + +Patch 7.4.1453 +Problem: Missing --not-a-term. +Solution: Add the argument. +Files: src/testdir/Make_amiga.mak + +Patch 7.4.1454 +Problem: The exit callback test is flaky. +Solution: Loop to wait for a short time up to a second. +Files: src/testdir/test_channel.vim + +Patch 7.4.1455 +Problem: JSON decoding test for surrogate pairs is in the wrong place. +Solution: Move the test lines. (Ken Takata) +Files: src/testdir/test_json.vim + +Patch 7.4.1456 +Problem: Test 87 fails with Python 3.5. +Solution: Work around difference. (Taro Muraoka) +Files: src/testdir/test87.in + +Patch 7.4.1457 +Problem: Opening a channel with select() is not done properly. +Solution: Also used read-fds. Use getsockopt() to check for errors. (Ozaki + Kiichi) +Files: src/channel.c + +Patch 7.4.1458 +Problem: When a JSON channel has a callback it may never be cleared. +Solution: Do not write "DETACH" into a JS or JSON channel. +Files: src/channel.c + +Patch 7.4.1459 (after 7.4.1457) +Problem: MS-Windows doesn't know socklen_t. +Solution: Use previous method for WIN32. +Files: src/channel.c + +Patch 7.4.1460 +Problem: Syntax error in rarely used code. +Solution: Fix the mch_rename() declaration. (Ken Takata) +Files: src/os_unix.c, src/proto/os_unix.pro + +Patch 7.4.1461 +Problem: When starting job on MS-Windows all parts of the command are put + in quotes. +Solution: Only use quotes when needed. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1462 +Problem: Two more rarely used functions with errors. +Solution: Add proper argument types. (Dominique Pelle) +Files: src/misc2.c, src/termlib.c + +Patch 7.4.1463 +Problem: Configure doesn't find isinf() and isnan() on some systems. +Solution: Use a configure check that includes math.h. +Files: src/configure.in, src/auto/configure + +Patch 7.4.1464 +Problem: When the argument of sort() is zero or empty it fails. +Solution: Make zero work as documented. (suggested by Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_sort.vim + +Patch 7.4.1465 +Problem: Coverity reported possible use of NULL pointer when using buffer + output with JSON mode. +Solution: Make it actually possible to use JSON mode with a buffer. + Re-encode the JSON to append it to the buffer. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1466 +Problem: Coverity reports dead code. +Solution: Remove the two lines. +Files: src/channel.c + +Patch 7.4.1467 +Problem: Can't build without the float feature. +Solution: Add #ifdefs. (Nick Owens, closes #667) +Files: src/eval.c, src/json.c + +Patch 7.4.1468 +Problem: Sort test doesn't test with "1" argument. +Solution: Also test ignore-case sorting. (Yasuhiro Matsumoto) +Files: src/testdir/test_sort.vim + +Patch 7.4.1469 +Problem: Channel test sometimes fails, especially on OS/X. (Kazunobu + Kuriyama) +Solution: Change the && into ||, call getsockopt() in more situations. + (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.1470 +Problem: Coverity reports missing restore. +Solution: Move json_encode() call up. +Files: src/channel.c + +Patch 7.4.1471 +Problem: Missing out-of-memory check. And Coverity warning. +Solution: Bail out when msg is NULL. +Files: src/channel.c + +Patch 7.4.1472 +Problem: Coverity warning for not using return value. +Solution: Add "(void)". +Files: src/os_unix.c + +Patch 7.4.1473 +Problem: Can't build without the autocommand feature. +Solution: Add #ifdefs. (Yegappan Lakshmanan) +Files: src/edit.c, src/main.c, src/syntax.c + +Patch 7.4.1474 +Problem: Compiler warnings without the float feature. +Solution: Move #ifdefs. (John Marriott) +Files: src/eval.c + +Patch 7.4.1475 +Problem: When using hangulinput with utf-8 a CSI character is + misinterpreted. +Solution: Convert CSI to K_CSI. (SungHyun Nam) +Files: src/ui.c + +Patch 7.4.1476 +Problem: Function arguments marked as unused while they are not. +Solution: Remove UNUSED. (Yegappan Lakshmanan) +Files: src/diff.c, src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, + src/window.c + +Patch 7.4.1477 +Problem: Test_reltime is flaky, it depends on timing. +Solution: When it fails run it a second time. +Files: src/testdir/runtest.vim + +Patch 7.4.1478 +Problem: ":loadplugin" doesn't take care of ftdetect files. +Solution: Also load ftdetect scripts when appropriate. +Files: src/ex_cmds2.c + +Patch 7.4.1479 +Problem: No testfor ":loadplugin". +Solution: Add a test. Fix how option is being set. +Files: src/ex_cmds2.c, src/testdir/test_loadplugin.vim, + src/testdir/Make_all.mak + +Patch 7.4.1480 +Problem: Cannot add a pack directory without loading a plugin. +Solution: Add the :packadd command. +Files: src/ex_cmds.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + src/testdir/test_loadplugin.vim, runtime/doc/repeat.txt + +Patch 7.4.1481 +Problem: Can't build with small features. +Solution: Add #ifdef. +Files: src/ex_cmds2.c + +Patch 7.4.1482 +Problem: "timeout" option not supported on ch_eval*(). +Solution: Get and use the timeout option from the argument. +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1483 +Problem: A one-time callback is not used for a raw channel. +Solution: Use a one-time callback when it exists. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1484 +Problem: Channel "err-io" value "out" is not supported. +Solution: Connect stderr to stdout if wanted. +Files: src/os_unix.c, src/os_win32.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1485 +Problem: Job input from buffer is not implemented. +Solution: Implement it. Add "in-top" and "in-bot" options. +Files: src/structs.h, src/eval.c, src/channel.c, src/proto/channel.pro, + src/os_unix.c, src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1486 +Problem: ":loadplugin" is not optimal, some people find it confusing. +Solution: Only use ":packadd" with an optional "!". +Files: src/ex_cmds.h, src/ex_cmds2.c, src/testdir/test_loadplugin.vim, + src/testdir/test_packadd.vim, src/testdir/Make_all.mak, + runtime/doc/repeat.txt + +Patch 7.4.1487 +Problem: For WIN32 isinf() is defined as a macro. +Solution: Define it as an inline function. (ZyX) +Files: src/macros.h + +Patch 7.4.1488 (after 7.4.1475) +Problem: Not using key when result from hangul_string_convert() is NULL. +Solution: Fall back to not converted string. +Files: src/ui.c + +Patch 7.4.1489 (after 7.4.1487) +Problem: "inline" is not supported by old MSVC. +Solution: use "__inline". (Ken Takata) +Files: src/macros.h + +Patch 7.4.1490 +Problem: Compiler warning for unused function. +Solution: Add #ifdef. (Dominique Pelle) +Files: src/gui_gtk_x11.c + +Patch 7.4.1491 +Problem: Visual-block shift breaks multi-byte characters. +Solution: Compute column differently. (Yasuhiro Matsumoto) Add a test. +Files: src/ops.c, src/testdir/test_visual.vim, src/testdir/Make_all.mak + +Patch 7.4.1492 +Problem: No command line completion for ":packadd". +Solution: Implement completion. (Hirohito Higashi) +Files: src/ex_docmd.c, src/ex_getln.c, src/testdir/test_packadd.vim, + src/vim.h + +Patch 7.4.1493 +Problem: Wrong callback invoked for zero-id messages. +Solution: Don't use the first one-time callback when the sequence number + doesn't match. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1494 +Problem: clr_history() does not work properly. +Solution: Increment hisptr. Add a test. (Yegappan Lakshmanan) +Files: src/ex_getln.c, src/testdir/test_history.vim, + src/testdir/Make_all.mak + +Patch 7.4.1495 +Problem: Compiler warnings when building on Unix with the job feature but + without the channel feature. +Solution: Move #ifdefs. (Dominique Pelle) +Files: src/os_unix.c + +Patch 7.4.1496 +Problem: Crash when built with GUI but it's not active. (Dominique Pelle) +Solution: Check gui.in_use. +Files: src/channel.c + +Patch 7.4.1497 +Problem: Cursor drawing problem with GTK 3. +Solution: Handle blinking differently. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1498 +Problem: Error for locked item when using json_decode(). (Shougo Matsu) +Solution: Initialize v_lock. +Files: src/json.c + +Patch 7.4.1499 +Problem: No error message when :packadd does not find anything. +Solution: Add an error message. (Hirohito Higashi) +Files: runtime/doc/repeat.txt, src/ex_cmds.h, src/ex_cmds2.c, + src/globals.h, src/testdir/test_packadd.vim + +Patch 7.4.1500 +Problem: Should_free flag set to FALSE. +Solution: Set it to TRUE. (Neovim 4415) +Files: src/ex_eval.c + +Patch 7.4.1501 +Problem: Garbage collection with an open channel is not tested. +Solution: Call garbagecollect() in the test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1502 +Problem: Writing last-but-one line of buffer to a channel isn't implemented + yet. +Solution: Implement it. Fix leaving a swap file behind. +Files: src/channel.c, src/structs.h, src/memline.c, src/proto/channel.pro + +Patch 7.4.1503 +Problem: Crash when using ch_getjob(). (Damien) +Solution: Check for a NULL job. +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1504 (after 7.4.1502) +Problem: No test for reading last-but-one line. +Solution: Add a test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1505 +Problem: When channel log is enabled get too many "looking for messages" + log entries. +Solution: Only give the message after another message. +Files: src/channel.c + +Patch 7.4.1506 +Problem: Job cannot read from a file. +Solution: Implement reading from a file for Unix. +Files: src/eval.c, src/os_unix.c, src/os_win32.c, + src/testdir/test_channel.vim + +Patch 7.4.1507 +Problem: Crash when starting a job fails. +Solution: Check for the channel to be NULL. (idea by Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1508 +Problem: Can't build GvimExt with MingW. +Solution: Adjust the makefile. (Ben Fritz) +Files: src/GvimExt/Make_ming.mak + +Patch 7.4.1509 +Problem: Keeping both a variable for a job and the channel it refers to is + a hassle. +Solution: Allow passing the job where a channel is expected. (Damien) +Files: src/eval.c, src/testdir/test_channel.vim + +Patch 7.4.1510 +Problem: Channel test fails on AppVeyor. +Solution: Wait longer than 10 msec if needed. +Files: src/testdir/test_channel.vim + +Patch 7.4.1511 +Problem: Statusline highlighting is sometimes wrong. +Solution: Check for Highlight type. (Christian Brabandt) +Files: src/buffer.c + +Patch 7.4.1512 +Problem: Channel input from file not supported on MS-Windows. +Solution: Implement it. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1513 +Problem: "J" fails if there are not enough lines. (Christian Neukirchen) +Solution: Reduce the count, only fail on the last line. +Files: src/normal.c, src/testdir/test_join.vim, src/testdir/test_alot.vim + +Patch 7.4.1514 +Problem: Channel output to file not implemented yet. +Solution: Implement it for Unix. +Files: src/os_unix.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1515 +Problem: Channel test is a bit flaky. +Solution: Instead of a fixed sleep time wait until an expression evaluates + to true. +Files: src/testdir/test_channel.vim + +Patch 7.4.1516 +Problem: Cannot change file permissions. +Solution: Add setfperm(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/testdir/test_file_perm.vim + +Patch 7.4.1517 +Problem: Compiler warning with 64bit compiler. +Solution: Add typecast. (Mike Williams) +Files: src/channel.c + +Patch 7.4.1518 +Problem: Channel with disconnected in/out/err is not supported. +Solution: Implement it for Unix. +Files: src/eval.c, src/os_unix.c, src/structs.h, + src/testdir/test_channel.vim, src/testdir/test_channel_pipe.py + +Patch 7.4.1519 (after 7.4.1514) +Problem: Channel output to file not implemented for MS-Windows. +Solution: Implement it. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1520 +Problem: Channel test: Waiting for a file to appear doesn't work. +Solution: In waitFor() ignore errors. +Files: src/testdir/test_channel.vim + +Patch 7.4.1521 (after 7.4.1516) +Problem: File permission test fails on MS-Windows. +Solution: Expect a different permission. +Files: src/testdir/test_file_perm.vim + +Patch 7.4.1522 +Problem: Cannot write channel err to a buffer. +Solution: Implement it. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1523 +Problem: Writing channel to a file fails on MS-Windows. +Solution: Disable it for now. +Files: src/testdir/test_channel.vim + +Patch 7.4.1524 +Problem: Channel test fails on BSD. +Solution: Break out of the loop when connect() succeeds. (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.1525 +Problem: On a high resolution screen the toolbar icons are too small. +Solution: Add "huge" and "giant" to 'toolbariconsize'. (Brian Gix) +Files: src/gui_gtk_x11.c, src/option.h + +Patch 7.4.1526 +Problem: Writing to file and not connecting a channel doesn't work for + MS-Windows. +Solution: Make it work. (Yasuhiro Matsumoto) +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.1527 +Problem: Channel test is flaky on MS-Windows. +Solution: Limit the select() timeout to 50 msec and try with a new socket if + it fails. +Files: src/channel.c + +Patch 7.4.1528 +Problem: Using "ever" for packages is confusing. +Solution: Use "start", as it's related to startup. +Files: src/ex_cmds2.c, runtime/doc/repeat.txt + +Patch 7.4.1529 +Problem: Specifying buffer number for channel not implemented yet. +Solution: Implement passing a buffer number. +Files: src/structs.h, src/channel.c, src/eval.c, + src/testdir/test_channel.vim + +Patch 7.4.1530 +Problem: MS-Windows job_start() closes wrong handle. +Solution: Close hThread on the process info. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.1531 +Problem: Compiler warning for uninitialized variable. (Dominique Pelle) +Solution: Always give the variable a value. +Files: src/channel.c + +Patch 7.4.1532 +Problem: MS-Windows channel leaks file descriptor. +Solution: Use CreateFile with the right options. (Yasuhiro Matsumoto) +Files: src/os_win32.c + +Patch 7.4.1533 +Problem: Using feedkeys() with an empty string disregards 'x' option. +Solution: Make 'x' work with an empty string. (Thinca) +Files: src/eval.c, src/testdir/test_alot.vim, + src/testdir/test_feedkeys.vim + +Patch 7.4.1534 +Problem: Compiler warning for shadowed variable. (Kazunobu Kuriyama) +Solution: Rename it. +Files: src/eval.c + +Patch 7.4.1535 +Problem: The feedkeys test has a one second delay. +Solution: Avoid need_wait_return() to delay. (Hirohito Higashi) +Files: src/eval.c + +Patch 7.4.1536 +Problem: Cannot re-use a channel for another job. +Solution: Add the "channel" option to job_start(). +Files: src/channel.c, src/eval.c, src/structs.h, src/os_unix.c, + src/os_win32.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1537 +Problem: Too many feature flags for pipes, jobs and channels. +Solution: Only use FEAT_JOB_CHANNEL. +Files: src/structs.h, src/feature.h, src/configure.in, + src/auto/configure, src/config.h.in, src/channel.c, src/eval.c, + src/gui.c, src/main.c, src/memline.c, src/misc2.c, src/os_mswin.c, + src/os_unix.c, src/os_win32.c, src/ui.c, src/version.c, + src/macros.h, src/proto.h, src/vim.h, src/Make_cyg_ming.mak, + src/Make_bc5.mak, src/Make_mvc.mak + +Patch 7.4.1538 +Problem: Selection with the mouse does not work in command line mode. +Solution: Use cairo functions. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1539 +Problem: Too much code in eval.c. +Solution: Move job and channel code to channel.c. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/proto/eval.pro + +Patch 7.4.1540 +Problem: Channel test is a bit flaky. +Solution: Increase expected wait time. +Files: src/testdir/test_channel.vim + +Patch 7.4.1541 +Problem: Missing job_info(). +Solution: Implement it. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1542 +Problem: job_start() with a list is not tested. +Solution: Call job_start() with a list. +Files: src/testdir/test_channel.vim + +Patch 7.4.1543 +Problem: Channel log methods are not tested. +Solution: Log job activity and check it. +Files: src/testdir/test_channel.vim + +Patch 7.4.1544 +Problem: On Win32 escaping the command does not work properly. +Solution: Reset 'ssl' when escaping the command. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1545 +Problem: GTK3: horizontal cursor movement in Visual selection not good. +Solution: Make it work better. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1546 +Problem: Sticky type checking is more annoying than useful. +Solution: Remove the error for changing a variable type. +Files: src/eval.c, src/testdir/test_assign.vim, + src/testdir/test_alot.vim, runtime/doc/eval.txt + +Patch 7.4.1547 +Problem: Getting a cterm highlight attribute that is not set results in the + string "-1". +Solution: Return an empty string. (Taro Muraoka) +Files: src/syntax.c, src/testdir/test_alot.vim, + src/testdir/test_syn_attr.vim + +Patch 7.4.1548 (after 7.4.1546) +Problem: Two tests fail. +Solution: Adjust the expected error number. Remove check for type. +Files: src/testdir/test101.ok, src/testdir/test55.in, + src/testdir/test55.ok + +Patch 7.4.1549 (after 7.4.1547) +Problem: Test for syntax attributes fails in Win32 GUI. +Solution: Use an existing font name. +Files: src/testdir/test_syn_attr.vim + +Patch 7.4.1550 +Problem: Cannot load packages early. +Solution: Add the ":packloadall" command. +Files: src/ex_cmds.h, src/ex_cmds2.c, src/main.c, + src/proto/ex_cmds2.pro, src/testdir/test_packadd.vim + +Patch 7.4.1551 +Problem: Cannot generate help tags in all doc directories. +Solution: Make ":helptags ALL" work. +Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/ex_cmds.c, src/vim.h + src/testdir/test_packadd.vim + +Patch 7.4.1552 +Problem: ":colorscheme" does not use 'packpath'. +Solution: Also use in "start" and "opt" directories in 'packpath'. +Files: src/ex_cmds2.c, src/gui.c, src/hardcopy.c, src/os_mswin.c, + src/spell.c, src/tag.c, src/if_py_both.h, src/vim.h, + src/digraph.c, src/eval.c, src/ex_docmd.c, src/main.c, + src/option.c, src/syntax.c, src/testdir/test_packadd.vim + +Patch 7.4.1553 +Problem: ":runtime" does not use 'packpath'. +Solution: Add "what" argument. +Files: src/ex_cmds2.c, src/vim.h, runtime/doc/repeat.txt, + src/testdir/test_packadd.vim + +Patch 7.4.1554 +Problem: Completion for :colorscheme does not use 'packpath'. +Solution: Make it work, add a test. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_packadd.vim + +Patch 7.4.1555 +Problem: List of test targets incomplete. +Solution: Add newly added tests. +Files: src/Makefile + +Patch 7.4.1556 +Problem: "make install" changes the help tags file, causing it to differ + from the repository. +Solution: Move it aside and restore it. +Files: src/Makefile + +Patch 7.4.1557 +Problem: Windows cannot be identified. +Solution: Add a unique window number to each window and functions to use it. +Files: src/structs.h, src/window.c, src/eval.c, src/proto/eval.pro, + src/proto/window.pro, src/testdir/test_window_id.vim, + src/testdir/Make_all.mak, runtime/doc/eval.txt + +Patch 7.4.1558 +Problem: It is not easy to find out what windows display a buffer. +Solution: Add win_findbuf(). +Files: src/eval.c, src/window.c, src/proto/window.pro, + src/testdir/test_window_id.vim, runtime/doc/eval.txt + +Patch 7.4.1559 +Problem: Passing cookie to a callback is clumsy. +Solution: Change function() to take arguments and return a partial. +Files: src/structs.h, src/channel.c, src/eval.c, src/if_python.c, + src/if_python3.c, src/if_py_both.h, src/json.c, + src/proto/eval.pro, src/testdir/test_partial.vim, + src/testdir/test_alot.vim, runtime/doc/eval.txt + +Patch 7.4.1560 +Problem: Dict options with a dash are more difficult to use. +Solution: Use an underscore, so that dict.err_io can be used. +Files: src/channel.c, src/structs.h, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.1561 (after 7.4.1559) +Problem: Missing update to proto file. +Solution: Change the proto file. +Files: src/proto/channel.pro + +Patch 7.4.1562 +Problem: ":helptags ALL" crashes. (Lcd) +Solution: Don't free twice. +Files: src/ex_cmds.c + +Patch 7.4.1563 +Problem: Partial test fails on windows. +Solution: Return 1 or -1 from compare function. +Files: src/testdir/test_partial.vim + +Patch 7.4.1564 +Problem: An empty list in function() causes an error. +Solution: Handle an empty list like there is no list of arguments. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1565 +Problem: Crash when assert_equal() runs into a NULL string. +Solution: Check for NULL. (Dominique) Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1566 +Problem: Compiler warning for shadowed variable. (Kazunobu Kuriyama) +Solution: Remove the inner one. +Files: src/eval.c + +Patch 7.4.1567 +Problem: Crash in assert_fails(). +Solution: Check for NULL. (Dominique Pelle) Add a test. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 7.4.1568 +Problem: Using CTRL-] in help on option in parentheses doesn't work. +Solution: Skip the "(" in "('". (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.1569 +Problem: Using old style tests for quickfix. +Solution: Change them to new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test106.in, + src/testdir/test106.ok, src/testdir/test_qf_title.in, + src/testdir/test_qf_title.ok, src/testdir/test_quickfix.vim + +Patch 7.4.1570 +Problem: There is no way to avoid the message when editing a file. +Solution: Add the "F" flag to 'shortmess'. (Shougo Matsu, closes #686) +Files: runtime/doc/options.txt, src/buffer.c, src/ex_cmds.c, + src/option.h + +Patch 7.4.1571 +Problem: No test for ":help". +Solution: Add a test for what 7.4.1568 fixed. (Hirohito Higashi) +Files: src/testdir/test_alot.vim, src/testdir/test_help_tagjump.vim + +Patch 7.4.1572 +Problem: Setting 'compatible' in test influences following tests. +Solution: Turn 'compatible' off again. +Files: src/testdir/test_backspace_opt.vim + +Patch 7.4.1573 +Problem: Tests get stuck at the more prompt. +Solution: Move the backspace test out of test_alot. +Files: src/testdir/test_alot.vim, src/testdir/Make_all.mak + +Patch 7.4.1574 +Problem: ":undo 0" does not work. (Florent Fayolle) +Solution: Make it undo all the way. (closes #688) +Files: src/undo.c, src/testdir/test_undolevels.vim, + src/testdir/test_ex_undo.vim, src/testdir/test_alot.vim + +Patch 7.4.1575 +Problem: Using wrong size for struct. +Solution: Use the size for wide API. (Ken Takata) +Files: src/gui_w32.c + +Patch 7.4.1576 +Problem: Write error of viminfo file is not handled properly. (Christian + Neukirchen) +Solution: Check the return value of fclose(). (closes #682) +Files: src/ex_cmds.c + +Patch 7.4.1577 +Problem: Cannot pass "dict.Myfunc" around as a partial. +Solution: Create a partial when expected. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1578 +Problem: There is no way to invoke a function later or periodically. +Solution: Add timer support. +Files: src/eval.c, src/ex_cmds2.c, src/screen.c, src/ex_docmd.c, + src/feature.h, src/gui.c, src/proto/eval.pro, + src/proto/ex_cmds2.pro, src/proto/screen.pro, src/structs.h, + src/version.c, src/testdir/test_alot.vim, + src/testdir/test_timers.vim, runtime/doc/eval.txt + +Patch 7.4.1579 (after 7.4.1578) +Problem: Missing changes in channel.c +Solution: Include the changes. +Files: src/channel.c + +Patch 7.4.1580 +Problem: Crash when using function reference. (Luchr) +Solution: Set initial refcount. (Ken Takata, closes #690) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1581 +Problem: Using ":call dict.func()" where the function is a partial does + not work. Using "dict.func()" where the function does not take a + Dictionary does not work. +Solution: Handle partial properly in ":call". (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_partial.vim, src/testdir/test55.ok + +Patch 7.4.1582 +Problem: Get E923 when using function(dict.func, [], dict). (Kent Sibilev) + Storing a function with a dict in a variable drops the dict if the + function is script-local. +Solution: Translate the function name. Use dict arg if present. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1583 +Problem: Warning for uninitialized variable. +Solution: Initialize it. (Dominique) +Files: src/ex_cmds2.c + +Patch 7.4.1584 +Problem: Timers don't work for Win32 console. +Solution: Add check_due_timer() in WaitForChar(). +Files: src/os_win32.c + +Patch 7.4.1585 +Problem: Partial is not recognized everywhere. +Solution: Check for partial in trans_function_name(). (Yasuhiro Matsumoto) + Add a test. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1586 +Problem: Nesting partials doesn't work. +Solution: Append arguments. (Ken Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1587 +Problem: Compiler warnings with 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/ex_cmds2.c + +Patch 7.4.1588 +Problem: Old style test for quickfix. +Solution: Turn test 96 into a new style test. +Files: src/testdir/Make_all.mak, src/testdir/test96.in, + src/testdir/test96.ok, src/testdir/test_quickfix.vim + +Patch 7.4.1589 +Problem: Combining dict and args with partial doesn't always work. +Solution: Use the arguments from the partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1590 +Problem: Warning for shadowed variable. (Christian Brabandt) +Solution: Move the variable into a local block. +Files: src/eval.c + +Patch 7.4.1591 +Problem: The quickfix title is truncated. +Solution: Save the command before it is truncated. (Anton Lindqvist) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1592 +Problem: Quickfix code using memory after being freed. (Dominique Pelle) +Solution: Detect that the window was closed. (Hirohito Higashi) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1593 +Problem: Using channel timeout instead of request timeout. (Coverity) +Solution: Remove the extra assignment. +Files: src/channel.c + +Patch 7.4.1594 +Problem: Timers don't work on Unix. +Solution: Add missing code. +Files: src/os_unix.c + +Patch 7.4.1595 +Problem: Not checking for failed open(). (Coverity) +Solution: Check file descriptor not being negative. +Files: src/os_unix.c + +Patch 7.4.1596 +Problem: Memory leak. (Coverity) +Solution: Free the pattern. +Files: src/ex_cmds2.c + +Patch 7.4.1597 +Problem: Memory leak when out of memory. (Coverity) +Solution: Free the name. +Files: src/eval.c + +Patch 7.4.1598 +Problem: When starting the GUI fails a swap file is left behind. (Joerg + Plate) +Solution: Preserve files before exiting. (closes #692) +Files: src/main.c, src/gui.c + +Patch 7.4.1599 +Problem: No link to Coverity. +Solution: Add Coverity badge in README. +Files: README.md + +Patch 7.4.1600 +Problem: libs directory is not useful. +Solution: Remove arp.library, it was only for very old Amiga versions. +Files: libs/arp.library, Filelist + +Patch 7.4.1601 +Problem: README files take a lot of space in the top directory. +Solution: Move most of them to "READMEdir". +Files: Filelist, Makefile, README.txt.info, README_ami.txt, + README_ami.txt.info, README_amibin.txt, README_amibin.txt.info, + README_amisrc.txt, README_amisrc.txt.info, README_bindos.txt, + README_dos.txt, README_extra.txt, README_mac.txt, README_ole.txt, + README_os2.txt, README_os390.txt, README_src.txt, + README_srcdos.txt, README_unix.txt, README_vms.txt, + README_w32s.txt, READMEdir/README.txt.info, + READMEdir/README_ami.txt, READMEdir/README_ami.txt.info, + READMEdir/README_amibin.txt, READMEdir/README_amibin.txt.info, + READMEdir/README_amisrc.txt, READMEdir/README_amisrc.txt.info, + READMEdir/README_bindos.txt, READMEdir/README_dos.txt, + READMEdir/README_extra.txt, READMEdir/README_mac.txt, + READMEdir/README_ole.txt, READMEdir/README_os2.txt, + READMEdir/README_os390.txt, READMEdir/README_src.txt, + READMEdir/README_srcdos.txt, READMEdir/README_unix.txt, + READMEdir/README_vms.txt, READMEdir/README_w32s.txt, + +Patch 7.4.1602 +Problem: Info files take space in the top directory. +Solution: Move them to "READMEdir". +Files: Filelist, src.info, Contents.info, runtime.info, vimdir.info, + Vim.info, Xxd.info, READMEdir/src.info, READMEdir/Contents.info, + READMEdir/runtime.info, READMEdir/vimdir.info, READMEdir/Vim.info, + READMEdir/Xxd.info + +Patch 7.4.1603 +Problem: Timer with an ":echo" command messes up display. +Solution: Redraw depending on the mode. (Hirohito Higashi) Avoid the more + prompt being used recursively. +Files: src/screen.c, src/message.c + +Patch 7.4.1604 +Problem: Although emoji characters are ambiguous width, best is to treat + them as full width. +Solution: Update the Unicode character tables. Add the 'emoji' options. + (Yasuhiro Matsumoto) +Files: runtime/doc/options.txt, runtime/optwin.vim, + runtime/tools/unicode.vim, src/mbyte.c, src/option.c, src/option.h + +Patch 7.4.1605 +Problem: Catching exception that won't be thrown. +Solution: Remove try/catch. +Files: src/testdir/test55.in + +Patch 7.4.1606 +Problem: Having type() handle a Funcref that is or isn't a partial + differently causes problems for existing scripts. +Solution: Make type() return the same value. (Thinca) +Files: src/eval.c, src/testdir/test_viml.vim + +Patch 7.4.1607 +Problem: Comparing a function that exists on two dicts is not backwards + compatible. (Thinca) +Solution: Only compare the function, not what the partial adds. +Files: src/eval.c, src/testdir/test_alot.vim, src/testdir/test_expr.vim + +Patch 7.4.1608 +Problem: string() doesn't handle a partial. +Solution: Make a string from a partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1609 +Problem: Contents file is only for Amiga distro. +Solution: Move it to "READMEdir". Update some info. +Files: Filelist, Contents, READMEdir/Contents + +Patch 7.4.1610 +Problem: Compiler warnings for non-virtual destructor. +Solution: Mark the classes final. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/gui_dwrite.cpp, src/if_ole.cpp + +Patch 7.4.1611 +Problem: The versplit feature makes the code unnecessary complicated. +Solution: Remove FEAT_VERTSPLIT, always support vertical splits when + FEAT_WINDOWS is defined. +Files: src/buffer.c, src/charset.c, src/eval.c, src/ex_cmds.c, + src/ex_docmd.c, src/ex_getln.c, src/gui.c, src/if_lua.c, + src/if_mzsch.c, src/if_ruby.c, src/main.c, src/misc1.c, + src/misc2.c, src/move.c, src/normal.c, src/option.c, + src/quickfix.c, src/screen.c, src/syntax.c, src/term.c, src/ui.c, + src/window.c, src/globals.h, src/gui.h, src/if_py_both.h, + src/option.h, src/structs.h, src/term.h + src/feature.h, src/vim.h, src/version.c + +Patch 7.4.1612 (after 7.4.1611) +Problem: Can't build with small features. +Solution: Move code and #ifdefs. +Files: src/ex_getln.c + +Patch 7.4.1613 (after 7.4.1612) +Problem: Still can't build with small features. +Solution: Adjust #ifdefs. +Files: src/ex_getln.c + +Patch 7.4.1614 +Problem: Still quickfix test in old style. +Solution: Turn test 10 into a new style test. +Files: src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test10.in, + src/testdir/test10.ok, src/testdir/test_quickfix.vim, + src/testdir/test10a.in, src/testdir/test10a.ok + +Patch 7.4.1615 +Problem: Build fails with tiny features. +Solution: Adjust #ifdefs. +Files: src/normal.c, src/window.c + +Patch 7.4.1616 +Problem: Malformed channel request causes a hang. +Solution: Drop malformed message. (Damien) +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1617 +Problem: When a JSON message is split it isn't decoded. +Solution: Wait a short time for the rest of the message to arrive. +Files: src/channel.c, src/json.c, src/structs.h, + src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1618 +Problem: Starting job with output to buffer changes options in the current + buffer. +Solution: Set "curbuf" earlier. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 7.4.1619 +Problem: When 'fileformats' is set in the vimrc it applies to new buffers + but not the initial buffer. +Solution: Set 'fileformat' when starting up. (Mike Williams) +Files: src/option.c + +Patch 7.4.1620 +Problem: Emoji characters are not considered as a kind of word character. +Solution: Give emoji characters a word class number. (Yasuhiro Matsumoto) +Files: src/mbyte.c + +Patch 7.4.1621 +Problem: Channel test doesn't work with Python 2.6. +Solution: Add number in formatting placeholder. (Wiredool) +Files: src/testdir/test_channel.py + +Patch 7.4.1622 +Problem: Channel demo doesn't work with Python 2.6. +Solution: Add number in formatting placeholder +Files: runtime/tools/demoserver.py + +Patch 7.4.1623 +Problem: All Channels share the message ID, it keeps getting bigger. +Solution: Use a message ID per channel. +Files: src/channel.c, src/proto/channel.pro, src/structs.h + +Patch 7.4.1624 +Problem: Can't get info about a channel. +Solution: Add ch_info(). +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1625 +Problem: Trying to close file descriptor that isn't open. +Solution: Check for negative number. +Files: src/os_unix.c + +Patch 7.4.1626 (after 7.4.1624) +Problem: Missing changes to structs. +Solution: Include the changes. +Files: src/structs.h + +Patch 7.4.1627 +Problem: Channel out_cb and err_cb are not tested. +Solution: Add a test. +Files: src/testdir/test_channel.vim + +Patch 7.4.1628 +Problem: 64-bit Compiler warning. +Solution: Change type of variable. (Mike Williams) +Files: src/channel.c + +Patch 7.4.1629 +Problem: Handling emoji characters as full width has problems with + backwards compatibility. +Solution: Remove ambiguous and double width characters from the emoji table. + Use a separate table for the character class. + (partly by Yasuhiro Matsumoto) +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.1630 +Problem: Unicode table for double width is outdated. +Solution: Update to the latest Unicode standard. +Files: src/mbyte.c + +Patch 7.4.1631 +Problem: Compiler doesn't understand switch on all enum values. (Tony + Mechelynck) +Solution: Initialize variable. +Files: src/channel.c + +Patch 7.4.1632 +Problem: List of test targets is outdated. +Solution: Update to current list of test targets. +Files: src/Makefile + +Patch 7.4.1633 +Problem: If the help tags file was removed "make install" fails. (Tony + Mechelynck) +Solution: Only try moving the file if it exists. +Files: src/Makefile + +Patch 7.4.1634 +Problem: Vertical movement after CTRL-A ends up in the wrong column. + (Urtica Dioica) +Solution: Set curswant when appropriate. (Hirohito Higashi) +Files: src/ops.c, src/testdir/test_increment.vim + +Patch 7.4.1635 +Problem: Channel test is a bit flaky. +Solution: Remove 'DETACH' if it's there. +Files: src/testdir/test_channel.vim + +Patch 7.4.1636 +Problem: When 'F' is in 'shortmess' the prompt for the encryption key isn't + displayed. (Toothpik) +Solution: Reset msg_silent. +Files: src/ex_getln.c + +Patch 7.4.1637 +Problem: Can't build with older MinGW compiler. +Solution: Change option from c++11 to gnu++11. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1638 +Problem: When binding a function to a dict the reference count is wrong. +Solution: Decrement dict reference count, only reference the function when + actually making a copy. (Ken Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1639 +Problem: Invoking garbage collection may cause a double free. +Solution: Don't free the dict in a partial when recursive is FALSE. +Files: src/eval.c + +Patch 7.4.1640 +Problem: Crash when an autocommand changes a quickfix list. (Dominique) +Solution: Check whether an entry is still valid. (Yegappan Lakshmanan, + Hirohito Higashi) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1641 +Problem: Using unterminated string. +Solution: Add NUL before calling vim_strsave_shellescape(). (James McCoy) +Files: src/eval.c, src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.1642 +Problem: Handling emoji characters as full width has problems with + backwards compatibility. +Solution: Only put characters in the 1f000 range in the emoji table. +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 7.4.1643 (after 7.4.1641) +Problem: Terminating file name has side effects. +Solution: Restore the character. (mostly by James McCoy, closes #713) +Files: src/eval.c, src/testdir/test105.in, src/testdir/test105.ok + +Patch 7.4.1644 +Problem: Using string() on a partial that exists in the dictionary it binds + results in an error. (Nikolai Pavlov) +Solution: Make string() not fail on a recursively nested structure. (Ken + Takata) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1645 +Problem: When a dict contains a partial it can't be redefined as a + function. (Nikolai Pavlov) +Solution: Remove the partial when overwriting with a function. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1646 +Problem: Using Python vim.bindeval() on a partial doesn't work. (Nikolai + Pavlov) +Solution: Add VAR_PARTIAL support in Python. +Files: src/if_py_both.h, src/testdir/test_partial.vim + +Patch 7.4.1647 +Problem: Using freed memory after setqflist() and ":caddbuffer". (Dominique) +Solution: Set qf_ptr when adding the first item to the quickfix list. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1648 +Problem: Compiler has a problem copying a string into di_key[]. (Yegappan + Lakshmanan) +Solution: Add dictitem16_T. +Files: src/structs.h, src/eval.c + +Patch 7.4.1649 +Problem: The matchit plugin needs to be copied to be used. +Solution: Put the matchit plugin in an optional package. +Files: Filelist, runtime/macros/matchit.vim, runtime/macros/matchit.txt, + runtime/macros/README.txt, src/Makefile, + runtime/pack/dist/opt/matchit/plugin/matchit.vim, + runtime/pack/dist/opt/matchit/doc/matchit.txt, + runtime/pack/dist/opt/matchit/doc/tags, + runtime/doc/usr_05.txt, runtime/doc/usr_toc.txt + +Patch 7.4.1650 +Problem: Quickfix test fails. +Solution: Accept any number of matches. +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1651 +Problem: Some dead (MSDOS) code remains. +Solution: Remove the unused lines. (Ken Takata) +Files: src/misc1.c + +Patch 7.4.1652 +Problem: Old style test for fnamemodify(). +Solution: Turn it into a new style test. +Files: src/testdir/test105.in, src/testdir/test105.ok, + src/testdir/test_fnamemodify.vim, src/testdir/test_alot.vim, + src/testdir/Make_all.mak + +Patch 7.4.1653 (after 7.4.1649) +Problem: Users who loaded matchit.vim manually have to change their + startup. (Gary Johnson) +Solution: Add a file in the old location that loads the package. +Files: runtime/macros/matchit.vim, Filelist + +Patch 7.4.1654 +Problem: Crash when using expand('%:S') in a buffer without a name. +Solution: Don't set a NUL. (James McCoy, closes #714) +Files: src/eval.c, src/testdir/test_fnamemodify.vim + +Patch 7.4.1655 +Problem: remote_expr() hangs. (Ramel) +Solution: Check for messages in the waiting loop. +Files: src/if_xcmdsrv.c + +Patch 7.4.1656 +Problem: Crash when using partial with a timer. +Solution: Increment partial reference count. (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_timers.vim + +Patch 7.4.1657 +Problem: On Unix in a terminal: channel messages are not handled right away. + (Jackson Alves de Aquino) +Solution: Break the loop for timers when something was received. +Files: src/os_unix.c + +Patch 7.4.1658 +Problem: A plugin does not know when VimEnter autocommands were already + triggered. +Solution: Add the v:vim_did_enter variable. +Files: src/eval.c, src/main.c, src/vim.h, src/testdir/test_autocmd.vim, + src/testdir/test_alot.vim, runtime/doc/autocmd.txt, + runtime/doc/eval.txt + +Patch 7.4.1659 (after 7.4.1657) +Problem: Compiler warning for argument type. (Manuel Ortega) +Solution: Remove "&". +Files: src/os_unix.c + +Patch 7.4.1660 +Problem: has('patch-7.4.1') doesn't work. +Solution: Fix off-by-one error. (Thinca) +Files: src/eval.c, src/testdir/test_expr.vim, src/testdir/test60.in, + src/testdir/test60.ok + +Patch 7.4.1661 +Problem: No test for special characters in channel eval command. +Solution: Testing sending and receiving text with special characters. +Files: src/testdir/test_channel.vim, src/testdir/test_channel.py + +Patch 7.4.1662 +Problem: No test for an invalid Ex command on a channel. +Solution: Test handling an invalid command gracefully. Avoid getting an + error message, do write it to the channel log. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel.py + +Patch 7.4.1663 +Problem: In tests it's often useful to check if a pattern matches. +Solution: Add assert_match(). +Files: src/eval.c, src/testdir/test_assert.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1664 +Problem: Crash in :cgetexpr. +Solution: Check for NULL pointer. (Dominique) Add a test. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1665 +Problem: Crash when calling job_start() with a NULL string. (Dominique) +Solution: Check for an invalid argument. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1666 +Problem: When reading JSON from a channel all readahead is used. +Solution: Use the fill function to reduce overhead. +Files: src/channel.c, src/json.c, src/structs.h + +Patch 7.4.1667 +Problem: Win32: waiting on a pipe with fixed sleep time. +Solution: Start with a short delay and increase it when looping. +Files: src/channel.c + +Patch 7.4.1668 +Problem: channel_get_all() does multiple allocations. +Solution: Compute the size and allocate once. +Files: src/channel.c + +Patch 7.4.1669 +Problem: When writing buffer lines to a pipe Vim may block. +Solution: Avoid blocking, write more lines later. +Files: src/channel.c, src/misc2.c, src/os_unix.c, src/structs.h, + src/vim.h, src/proto/channel.pro, src/testdir/test_channel.vim + +Patch 7.4.1670 +Problem: Completion doesn't work well for a variable containing "#". +Solution: Recognize the "#". (Watiko) +Files: src/eval.c + +Patch 7.4.1671 +Problem: When help exists in multiple languages, adding @ab while "ab" is + the default help language is unnecessary. +Solution: Leave out "@ab" when not needed. (Ken Takata) +Files: src/ex_getln.c + +Patch 7.4.1672 +Problem: The Dvorak support is a bit difficult to install. +Solution: Turn it into an optional package. +Files: runtime/macros/dvorak, runtime/macros/README.txt, + runtime/pack/dist/opt/dvorak/plugin/dvorak.vim, + runtime/pack/dist/opt/dvorak/dvorak/enable.vim, + runtime/pack/dist/opt/dvorak/dvorak/disable.vim + +Patch 7.4.1673 +Problem: The justify plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/justify.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/justify/plugin/justify.vim, Filelist + +Patch 7.4.1674 +Problem: The editexisting plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/editexisting.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/editexisting/plugin/editexisting.vim, + Filelist + +Patch 7.4.1675 +Problem: The swapmous plugin has to be copied or sourced to be used. +Solution: Turn it into the swapmouse package. +Files: runtime/macros/swapmous.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim, Filelist + +Patch 7.4.1676 +Problem: The shellmenu plugin has to be copied or sourced to be used. +Solution: Turn it into a package. +Files: runtime/macros/shellmenu.vim, runtime/macros/README.txt, + runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim, Filelist + +Patch 7.4.1677 +Problem: A reference to the removed file_select plugin remains. +Solution: Remove it. +Files: runtime/macros/README.txt + +Patch 7.4.1678 +Problem: Warning for unused argument. +Solution: Add UNUSED. (Dominique Pelle) +Files: src/if_mzsch.c + +Patch 7.4.1679 +Problem: Coverity: copying value of v_lock without initializing it. +Solution: Init v_lock in rettv_list_alloc() and rettv_dict_alloc(). +Files: src/eval.c + +Patch 7.4.1680 +Problem: Coverity warns for not checking name length (false positive). +Solution: Only copy the characters we know are there. +Files: src/channel.c + +Patch 7.4.1681 +Problem: Coverity warns for fixed size buffer length (false positive). +Solution: Add a check for the name length. +Files: src/eval.c + +Patch 7.4.1682 +Problem: Coverity: no check for NULL. +Solution: Add check for invalid argument to assert_match(). +Files: src/eval.c + +Patch 7.4.1683 +Problem: Generated .bat files do not support --nofork. +Solution: Add check for --nofork. Also add "setlocal". (Kevin Cantú, + closes #659) +Files: src/dosinst.c + +Patch 7.4.1684 +Problem: README text is slightly outdated. +Solution: Mention the READMEdir directory. +Files: README.md, README.txt + +Patch 7.4.1685 +Problem: There is no easy way to get all the information about a match. +Solution: Add matchstrpos(). (Ozaki Kiichi) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/eval.c, + src/testdir/test_alot.vim, src/testdir/test_matchstrpos.vim + +Patch 7.4.1686 +Problem: When running tests $HOME/.viminfo is written. (James McCoy) +Solution: Add 'nviminfo' to the 'viminfo' option. (closes #722) +Files: src/testdir/test_backspace_opt.vim, src/testdir/test_viminfo.vim, + src/testdir/runtest.vim. + +Patch 7.4.1687 +Problem: The channel close_cb option does not work. +Solution: Use jo_close_partial instead of jo_err_partial. (Damien) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1688 +Problem: MzScheme does not support partial. +Solution: Add minimal partial support. (Ken Takata) +Files: src/if_mzsch.c + +Patch 7.4.1689 +Problem: Ruby interface has inconsistent coding style. +Solution: Fix the coding style. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.1690 +Problem: Can't compile with the conceal feature but without multi-byte. +Solution: Adjust #ifdef. (Owen Leibman) +Files: src/eval.c, src/window.c + +Patch 7.4.1691 +Problem: When switching to a new buffer and an autocommand applies syntax + highlighting an ml_get error may occur. +Solution: Check "syn_buf" against the buffer in the window. (Alexander von + Buddenbrock, closes #676) +Files: src/syntax.c + +Patch 7.4.1692 +Problem: feedkeys('i', 'x') gets stuck, waits for a character to be typed. +Solution: Behave like ":normal". (Yasuhiro Matsumoto) +Files: src/eval.c, src/testdir/test_feedkeys.vim + +Patch 7.4.1693 +Problem: Building the Perl interface gives compiler warnings. +Solution: Remove a pragma. Add noreturn attributes. (Damien) +Files: src/if_perl.xs + +Patch 7.4.1694 +Problem: Win32 gvim doesn't work with "dvorakj" input method. +Solution: Wait for QS_ALLINPUT instead of QS_ALLEVENTS. (Yukihiro Nakadaira) +Files: src/gui_w32.c + +Patch 7.4.1695 +Problem: ":syn reset" clears the effect ":syn iskeyword". (James McCoy) +Solution: Remove clearing the syntax keywords. +Files: src/syntax.c + +Patch 7.4.1696 +Problem: When using :stopinsert in a silent mapping the "INSERT" message + isn't cleared. (Coacher) +Solution: Always clear the message. (Christian Brabandt, closes #718) +Files: src/ex_docmd.c, src/proto/screen.pro, src/screen.c + +Patch 7.4.1697 +Problem: Display problems when the 'ambiwidth' and 'emoji' options are not + set properly or the terminal doesn't behave as expected. +Solution: After drawing an ambiguous width character always position the + cursor. +Files: src/mbyte.c, src/screen.c, src/proto/mbyte.pro + +Patch 7.4.1698 +Problem: Two tests fail when running tests with MinGW. (Michael Soyka) +Solution: Convert test_getcwd.ok test_wordcount.ok to unix fileformat. +Files: src/testdir/Make_ming.mak + +Patch 7.4.1699 +Problem: :packadd does not work the same when used early or late. +Solution: Always load plugins matching "plugin/**/*.vim". +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1700 +Problem: Equivalence classes are not properly tested. +Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman) +Files: src/regexp.c, src/testdir/Make_all.mak, + src/testdir/test_alot_latin.vim, src/testdir/test_alot_utf8.vim, + src/testdir/test_regexp_latin.vim, + src/testdir/test_regexp_utf8.vim + +Patch 7.4.1701 +Problem: Equivalence classes still tested in old style tests. +Solution: Remove the duplicate. +Files: src/testdir/test44.in, src/testdir/test44.ok, + src/testdir/test99.in, src/testdir/test99.ok + +Patch 7.4.1702 +Problem: Using freed memory when parsing 'printoptions' fails. +Solution: Save the old options and restore them in case of an error. + (Dominique) +Files: src/hardcopy.c, src/testdir/test_hardcopy.vim + +Patch 7.4.1703 +Problem: Can't assert for not equal and not matching. +Solution: Add assert_notmatch() and assert_notequal(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_assert.vim + +Patch 7.4.1704 +Problem: Using freed memory with "wincmd p". (Dominique Pelle) +Solution: Also clear "prevwin" in other tab pages. +Files: src/window.c + +Patch 7.4.1705 +Problem: The 'guifont' option does not allow for a quality setting. +Solution: Add the "q" item, supported on MS-Windows. (Yasuhiro Matsumoto) +Files: runtime/doc/options.txt, src/gui_w32.c, src/os_mswin.c, + src/proto/os_mswin.pro + +Patch 7.4.1706 +Problem: Old style function declaration breaks build. +Solution: Remove __ARGS(). +Files: src/proto/os_mswin.pro + +Patch 7.4.1707 +Problem: Cannot use empty dictionary key, even though it can be useful. +Solution: Allow using an empty dictionary key. +Files: src/hashtab.c, src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1708 +Problem: New regexp engine does not work properly with EBCDIC. +Solution: Define equivalence class characters. (Owen Leibman) +Files: src/regexp_nfa.c + +Patch 7.4.1709 +Problem: Mistake in #ifdef. +Solution: Change PROOF_QUALITY to DRAFT_QUALITY. (Ken Takata) +Files: src/os_mswin.c + +Patch 7.4.1710 +Problem: Not all output of an external command is read. +Solution: Avoid timing out when the process has exited. (closes #681) +Files: src/os_unix.c + +Patch 7.4.1711 +Problem: When using try/catch in 'statusline' it is still considered an + error and the status line will be disabled. +Solution: Check did_emsg instead of called_emsg. (haya14busa, closes #729) +Files: src/screen.c, src/testdir/test_statusline.vim, + src/testdir/test_alot.vim + +Patch 7.4.1712 +Problem: For plugins in packages, plugin authors need to take care of all + dependencies. +Solution: When loading "start" packages and for :packloadall, first add all + directories to 'runtimepath' before sourcing plugins. +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1713 +Problem: GTK GUI doesn't work on Wayland. +Solution: Specify that only the X11 backend is allowed. (Simon McVittie) +Files: src/gui_gtk_x11.c + +Patch 7.4.1714 +Problem: Non-GUI specific settings in the gvimrc_example file. +Solution: Move some settings to the vimrc_example file. Remove setting + 'hlsearch' again. (suggested by Hirohito Higashi) +Files: runtime/vimrc_example.vim, runtime/gvimrc_example.vim + +Patch 7.4.1715 +Problem: Double free when a partial is in a cycle with a list or dict. + (Nikolai Pavlov) +Solution: Do not free a nested list or dict used by the partial. +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1716 +Problem: 'autochdir' doesn't work for the first file. (Rob Hoelz) +Solution: Call DO_AUTOCHDIR after startup. (Christian Brabandt, closes #704) +Files: src/main.c + +Patch 7.4.1717 +Problem: Leaking memory when opening a channel fails. +Solution: Unreference partials in job options. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1718 +Problem: Coverity: not using return value of set_ref_in_item(). +Solution: Use the return value. +Files: src/eval.c + +Patch 7.4.1719 +Problem: Leaking memory when there is a cycle involving a job and a + partial. +Solution: Add a copyID to job and channel. Set references in items referred + by them. Go through all jobs and channels to find unreferenced + items. Also, decrement reference counts when garbage collecting. +Files: src/eval.c, src/channel.c, src/netbeans.c, src/globals.h, + src/ops.c, src/regexp.c, src/tag.c, src/proto/channel.pro, + src/proto/eval.pro, src/testdir/test_partial.vim, src/structs.h + +Patch 7.4.1720 +Problem: Tests fail without the job feature. +Solution: Skip tests when the job feature is not present. +Files: src/testdir/test_partial.vim + +Patch 7.4.1721 +Problem: The vimtbar files are unused. +Solution: Remove them. (Ken Takata) +Files: src/vimtbar.dll, src/vimtbar.h, src/vimtbar.lib, Filelist + +Patch 7.4.1722 +Problem: Crash when calling garbagecollect() after starting a job. +Solution: Set the copyID on job and channel. (Hirohito Higashi, Ozaki + Kiichi) +Files: src/eval.c + +Patch 7.4.1723 +Problem: When using try/catch in 'tabline' it is still considered an + error and the tabline will be disabled. +Solution: Check did_emsg instead of called_emsg. (haya14busa, closes #746) +Files: src/screen.c, src/testdir/test_tabline.vim, + src/testdir/test_alot.vim + +Patch 7.4.1724 (after 7.4.1723) +Problem: Tabline test fails in GUI. +Solution: Remove 'e' from 'guioptions'. +Files: src/testdir/test_tabline.vim + +Patch 7.4.1725 +Problem: Compiler errors for non-ANSI compilers. +Solution: Remove // comment. Remove comma at end of enum. (Michael Jarvis) +Files: src/eval.c + +Patch 7.4.1726 +Problem: ANSI compiler complains about string length. +Solution: Split long string in two parts. (Michael Jarvis) +Files: src/ex_cmds.c + +Patch 7.4.1727 +Problem: Cannot detect a crash in tests when caused by garbagecollect(). +Solution: Add garbagecollect_for_testing(). Do not free a job if is still + useful. +Files: src/channel.c, src/eval.c, src/getchar.c, src/main.c, src/vim.h, + src/proto/eval.pro, src/testdir/runtest.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1728 +Problem: The help for functions require a space after the "(". +Solution: Make CTRL-] on a function name ignore the arguments. (Hirohito + Higashi) +Files: src/ex_cmds.c, src/testdir/test_help_tagjump.vim, + runtime/doc/eval.txt + +Patch 7.4.1729 +Problem: The Perl interface cannot use 'print' operator for writing + directly in standard IO. +Solution: Add a minimal implementation of PerlIO Layer feature and try to + use it for STDOUT/STDERR. (Damien) +Files: src/if_perl.xs, src/testdir/test_perl.vim + +Patch 7.4.1730 +Problem: It is not easy to get a character out of a string. +Solution: Add strgetchar() and strcharpart(). +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1731 +Problem: Python: turns partial into simple funcref. +Solution: Use partials like partials. (Nikolai Pavlov, closes #734) +Files: runtime/doc/if_pyth.txt, src/eval.c, src/if_py_both.h, + src/if_python.c, src/if_python3.c, src/proto/eval.pro, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.1732 +Problem: Folds may close when using autocomplete. (Anmol Sethi) +Solution: Increment/decrement disable_fold. (Christian Brabandt, closes + #643) +Files: src/edit.c, src/fold.c, src/globals.h + +Patch 7.4.1733 +Problem: "make install" doesn't know about cross-compiling. (Christian + Neukirchen) +Solution: Add CROSS_COMPILING. (closes #740) +Files: src/configure.in, src/auto/configure, src/config.mk.in, + src/Makefile + +Patch 7.4.1734 (after 7.4.1730) +Problem: Test fails when not using utf-8. +Solution: Split test in regular and utf-8 part. +Files: src/testdir/test_expr.vim, src/testdir/test_expr_utf8.vim, + src/testdir/test_alot_utf8.vim + +Patch 7.4.1735 +Problem: It is not possible to only see part of the message history. It is + not possible to clear messages. +Solution: Add a count to ":messages" and a clear argument. (Yasuhiro + Matsumoto) +Files: runtime/doc/message.txt, src/ex_cmds.h, src/message.c, + src/testdir/test_messages.vim, src/testdir/test_alot.vim + +Patch 7.4.1736 (after 7.4.1731) +Problem: Unused variable. +Solution: Remove it. (Yasuhiro Matsumoto) +Files: src/if_py_both.h + +Patch 7.4.1737 +Problem: Argument marked as unused is used. +Solution: Remove UNUSED. +Files: src/message.c + +Patch 7.4.1738 +Problem: Count for ":messages" depends on number of lines. +Solution: Add ADDR_OTHER address type. +Files: src/ex_cmds.h + +Patch 7.4.1739 +Problem: Messages test fails on MS-Windows. +Solution: Adjust the asserts. Skip the "messages maintainer" line if not + showing all messages. +Files: src/message.c, src/testdir/test_messages.vim + +Patch 7.4.1740 +Problem: syn-cchar defined with matchadd() does not appear if there are no + other syntax definitions which matches buffer text. +Solution: Check for startcol. (Ozaki Kiichi, haya14busa, closes #757) +Files: src/screen.c, src/testdir/Make_all.mak, + src/testdir/test_alot_utf8.vim, src/testdir/test_match_conceal.in, + src/testdir/test_match_conceal.ok, + src/testdir/test_matchadd_conceal.vim, + src/testdir/test_matchadd_conceal_utf8.vim, + src/testdir/test_undolevels.vim + +Patch 7.4.1741 +Problem: Not testing utf-8 characters. +Solution: Move the right asserts to the test_expr_utf8 test. +Files: src/testdir/test_expr.vim, src/testdir/test_expr_utf8.vim + +Patch 7.4.1742 +Problem: strgetchar() does not work correctly. +Solution: use mb_cptr2len(). Add a test. (Naruhiko Nishino) +Files: src/eval.c, src/testdir/test_expr_utf8.vim + +Patch 7.4.1743 +Problem: Clang warns for uninitialized variable. (Michael Jarvis) +Solution: Initialize it. +Files: src/if_py_both.h + +Patch 7.4.1744 +Problem: Python: Converting a sequence may leak memory. +Solution: Decrement a reference. (Nikolai Pavlov) +Files: src/if_py_both.h + +Patch 7.4.1745 +Problem: README file is not clear about where to get Vim. +Solution: Add links to github, releases and the Windows installer. + (Suggested by Christian Brabandt) +Files: README.md, README.txt + +Patch 7.4.1746 +Problem: Memory leak in Perl. +Solution: Decrement the reference count. Add a test. (Damien) +Files: src/if_perl.xs, src/testdir/test_perl.vim + +Patch 7.4.1747 +Problem: Coverity: missing check for NULL pointer. +Solution: Check for out of memory. +Files: src/if_py_both.h + +Patch 7.4.1748 +Problem: "gD" does not find match in first column of first line. (Gary + Johnson) +Solution: Accept match at the cursor. +Files: src/normal.c, src/testdir/test_goto.vim, src/testdir/test_alot.vim + +Patch 7.4.1749 +Problem: When using GTK 3.20 there are a few warnings. +Solution: Use new functions when available. (Kazunobu Kuriyama) +Files: src/gui_beval.c src/gui_gtk_x11.c + +Patch 7.4.1750 +Problem: When a buffer gets updated while in command line mode, the screen + may be messed up. +Solution: Postpone the redraw when the screen is scrolled. +Files: src/channel.c + +Patch 7.4.1751 +Problem: Crash when 'tagstack' is off. (Dominique Pelle) +Solution: Fix it. (Hirohito Higashi) +Files: src/tag.c, src/testdir/test_alot.vim, src/testdir/test_tagjump.vim + +Patch 7.4.1752 +Problem: When adding to the quickfix list the current position is reset. +Solution: Do not reset the position when not needed. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1753 +Problem: "noinsert" in 'completeopt' is sometimes ignored. +Solution: Set the variables when the 'completeopt' was set. (Ozaki Kiichi) +Files: src/edit.c, src/option.c, src/proto/edit.pro + +Patch 7.4.1754 +Problem: When 'filetype' was set and reloading a buffer which does not + cause it to be set, the syntax isn't loaded. (KillTheMule) +Solution: Remember whether the FileType event was fired and fire it if not. + (Anton Lindqvist, closes #747) +Files: src/fileio.c, src/testdir/test_syntax.vim + +Patch 7.4.1755 +Problem: When using getreg() on a non-existing register a NULL list is + returned. (Bjorn Linse) +Solution: Allocate an empty list. Add a test. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1756 +Problem: "dll" options are not expanded. +Solution: Expand environment variables. (Ozaki Kiichi) +Files: src/option.c, src/testdir/test_alot.vim, + src/testdir/test_expand_dllpath.vim + +Patch 7.4.1757 +Problem: When using complete() it may set 'modified' even though nothing + was inserted. +Solution: Use Down/Up instead of Next/Previous match. (Shougo Matsu, closes + #745) +Files: src/edit.c + +Patch 7.4.1758 +Problem: Triggering CursorHoldI when in CTRL-X mode causes problems. +Solution: Do not trigger CursorHoldI in CTRL-X mode. Add "!" flag to + feedkeys() (test with that didn't work though). +Files: src/edit.c, src/eval.c + +Patch 7.4.1759 +Problem: When using feedkeys() in a timer the inserted characters are not + used right away. +Solution: Break the wait loop when characters have been added to typebuf. + use this for testing CursorHoldI. +Files: src/gui.c, src/os_win32.c, src/os_unix.c, + src/testdir/test_autocmd.vim + +Patch 7.4.1760 (after 7.4.1759) +Problem: Compiler warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/os_win32.c + +Patch 7.4.1761 +Problem: Coverity complains about ignoring return value. +Solution: Add "(void)" to get rid of the warning. +Files: src/eval.c + +Patch 7.4.1762 +Problem: Coverity: useless assignments. +Solution: Remove them. +Files: src/search.c + +Patch 7.4.1763 +Problem: Coverity: useless assignment. +Solution: Add #if 0. +Files: src/spell.c + +Patch 7.4.1764 +Problem: C++ style comment. (Ken Takata) +Solution: Finish the work started here: don't call perror() when stderr + isn't working. +Files: src/os_unix.c + +Patch 7.4.1765 +Problem: Undo options are not together in the options window. +Solution: Put them together. (Gary Johnson) +Files: runtime/optwin.vim + +Patch 7.4.1766 +Problem: Building instructions for MS-Windows are outdated. +Solution: Mention setting SDK_INCLUDE_DIR. (Ben Franklin, closes #771) Move + outdated instructions further down. +Files: src/INSTALLpc.txt + +Patch 7.4.1767 +Problem: When installing Vim on a GTK system the icon cache is not updated. +Solution: Update the GTK icon cache when possible. (Kazunobu Kuriyama) +Files: src/Makefile, src/configure.in, src/config.mk.in, + src/auto/configure + +Patch 7.4.1768 +Problem: Arguments of setqflist() are not checked properly. +Solution: Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi, + closes #661) +Files: src/eval.c, src/testdir/test_quickfix.vim + +Patch 7.4.1769 +Problem: No "closed", "errors" and "encoding" attribute on Python output. +Solution: Add attributes and more tests. (Roland Puntaier, closes #622) +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c, + src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.1770 +Problem: Cannot use true color in the terminal. +Solution: Add the 'guicolors' option. (Nikolai Pavlov) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/doc/various.txt, src/auto/configure, src/config.h.in, + src/configure.in, src/eval.c, src/globals.h, src/hardcopy.c, + src/option.c, src/option.h, src/proto/term.pro, src/screen.c, + src/structs.h, src/syntax.c, src/term.c, src/term.h, + src/version.c, src/vim.h + +Patch 7.4.1771 (after 7.4.1768) +Problem: Warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/eval.c + +Patch 7.4.1772 (after 7.4.1767) +Problem: Installation fails when $GTK_UPDATE_ICON_CACHE is empty. +Solution: Add quotes. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1773 (after 7.4.1770) +Problem: Compiler warnings. (Dominique Pelle) +Solution: Add UNUSED. Add type cast. Avoid a buffer overflow. +Files: src/syntax.c, src/term.c + +Patch 7.4.1774 (after 7.4.1770) +Problem: Cterm true color feature has warnings. +Solution: Add type casts. +Files: src/screen.c, src/syntax.c, src/term.c + +Patch 7.4.1775 +Problem: The rgb.txt file is not installed. +Solution: Install the file. (Christian Brabandt) +Files: src/Makefile + +Patch 7.4.1776 +Problem: Using wrong buffer length. +Solution: use the right name. (Kazunobu Kuriyama) +Files: src/term.c + +Patch 7.4.1777 +Problem: Newly added features can escape the sandbox. +Solution: Add checks for restricted and secure. (Yasuhiro Matsumoto) +Files: src/eval.c + +Patch 7.4.1778 +Problem: When using the term truecolor feature, the t_8f and t_8b termcap + options are not set by default. +Solution: Move the values to before BT_EXTRA_KEYS. (Christian Brabandt) +Files: src/term.c + +Patch 7.4.1779 +Problem: Using negative index in strcharpart(). (Yegappan Lakshmanan) +Solution: Assume single byte when using a negative index. +Files: src/eval.c + +Patch 7.4.1780 +Problem: Warnings reported by cppcheck. +Solution: Fix the warnings. (Dominique Pelle) +Files: src/ex_cmds2.c, src/json.c, src/misc1.c, src/ops.c, + src/regexp_nfa.c + +Patch 7.4.1781 +Problem: synIDattr() does not respect 'guicolors'. +Solution: Change the condition for the mode. (Christian Brabandt) +Files: src/eval.c + +Patch 7.4.1782 +Problem: strcharpart() does not work properly with some multi-byte + characters. +Solution: Use mb_cptr2len() instead of mb_char2len(). (Hirohito Higashi) +Files: src/eval.c, src/testdir/test_expr_utf8.vim + +Patch 7.4.1783 +Problem: The old regexp engine doesn't handle character classes correctly. + (Manuel Ortega) +Solution: Use regmbc() instead of regc(). Add a test. +Files: src/regexp.c, src/testdir/test_regexp_utf8.vim + +Patch 7.4.1784 +Problem: The termtruecolor feature is enabled differently from many other + features. +Solution: Enable the termtruecolor feature for the big build, not through + configure. +Files: src/configure.in, src/config.h.in, src/auto/configure, + src/feature.h + +Patch 7.4.1785 (after 7.4.1783) +Problem: Regexp test fails on windows. +Solution: set 'isprint' to the right value for testing. +Files: src/testdir/test_regexp_utf8.vim + +Patch 7.4.1786 +Problem: Compiled-in colors do not match rgb.txt. +Solution: Use the rgb.txt colors. (Kazunobu Kuriyama) +Files: src/term.c + +Patch 7.4.1787 +Problem: When a job ends the close callback is invoked before other + callbacks. On Windows the close callback is not called. +Solution: First invoke out/err callbacks before the close callback. + Make the close callback work on Windows. +Files: src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel_pipe.py + +Patch 7.4.1788 +Problem: NSIS script is missing packages. +Solution: Add the missing directories. (Ken Takata) +Files: nsis/gvim.nsi + +Patch 7.4.1789 +Problem: Cannot use ch_read() in the close callback. +Solution: Do not discard the channel if there is readahead. Do not discard + readahead if there is a close callback. +Files: src/eval.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 7.4.1790 +Problem: Leading white space in a job command matters. (Andrew Stewart) +Solution: Skip leading white space. +Files: src/os_unix.c + +Patch 7.4.1791 +Problem: Channel could be garbage collected too early. +Solution: Don't free a channel or remove it from a job when it is still + useful. +Files: src/channel.c + +Patch 7.4.1792 +Problem: Color name decoding is implemented several times. +Solution: Move it to term.c. (Christian Brabandt) +Files: src/gui_mac.c, src/gui_photon.c, src/gui_w32.c, + src/proto/term.pro, src/term.c + +Patch 7.4.1793 +Problem: Some character classes may differ between systems. On OS/X the + regexp test fails. +Solution: Make this less dependent on the system. (idea by Kazunobu Kuriyama) +Files: src/regexp.c, src/regexp_nfa.c + +Patch 7.4.1794 (after 7.4.1792) +Problem: Can't build on MS-Windows. +Solution: Add missing declaration. +Files: src/gui_w32.c + +Patch 7.4.1795 +Problem: Compiler warning for redefining RGB. (John Marriott) +Solution: Rename it to TORGB. +Files: src/term.c + +Patch 7.4.1796 (after 7.4.1795) +Problem: Colors are wrong on MS-Windows. (Christian Robinson) +Solution: Use existing RGB macro if it exists. (Ken Takata) +Files: src/term.c + +Patch 7.4.1797 +Problem: Warning from Windows 64 bit compiler. +Solution: Change int to size_t. (Mike Williams) +Files: src/term.c + +Patch 7.4.1798 +Problem: Still compiler warning for unused return value. (Charles Campbell) +Solution: Assign to ignoredp. +Files: src/term.c + +Patch 7.4.1799 +Problem: 'guicolors' is a confusing option name. +Solution: Use 'termguicolors' instead. (Hirohito Higashi, Ken Takata) +Files: runtime/doc/options.txt, runtime/doc/term.txt, + runtime/doc/various.txt, runtime/syntax/dircolors.vim, src/eval.c, + src/feature.h, src/globals.h, src/hardcopy.c, src/option.c, + src/option.h, src/proto/term.pro, src/screen.c, src/structs.h, + src/syntax.c, src/term.c, src/version.c, src/vim.h + +Patch 7.4.1800 (after 7.4.1799) +Problem: Unnecessary #ifdef. +Solution: Just use USE_24BIT. (Ken Takata) +Files: src/syntax.c + +Patch 7.4.1801 +Problem: Make uninstall leaves file behind. +Solution: Delete rgb.txt. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 7.4.1802 +Problem: Quickfix doesn't handle long lines well, they are split. +Solution: Drop characters after a limit. (Anton Lindqvist) +Files: src/quickfix.c, src/testdir/test_quickfix.vim, + src/testdir/samples/quickfix.txt + +Patch 7.4.1803 +Problem: GTK3 doesn't handle menu separators properly. +Solution: Use gtk_separator_menu_item_new(). (Kazunobu Kuriyama) +Files: src/gui_gtk.c + +Patch 7.4.1804 +Problem: Can't use Vim as MANPAGER. +Solution: Add manpager.vim. (Enno Nagel, closes #491) +Files: runtime/doc/filetype.txt, runtime/plugin/manpager.vim + +Patch 7.4.1805 +Problem: Running tests in shadow dir fails. +Solution: Link the samples directory +Files: src/Makefile + +Patch 7.4.1806 +Problem: 'termguicolors' option missing from the options window. +Solution: Add the entry. +Files: runtime/optwin.vim + +Patch 7.4.1807 +Problem: Test_out_close_cb sometimes fails. +Solution: Always write DETACH to out, not err. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1808 (after 7.4.1806) +Problem: Using wrong feature name to check for 'termguicolors'. +Solution: Use the right feature name. (Ken Takata) +Files: runtime/optwin.vim + +Patch 7.4.1809 (after 7.4.1808) +Problem: Using wrong short option name for 'termguicolors'. +Solution: Use the option name. +Files: runtime/optwin.vim + +Patch 7.4.1810 +Problem: Sending DETACH after a channel was closed isn't useful. +Solution: Only add DETACH for a netbeans channel. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1811 +Problem: Netbeans channel gets garbage collected. +Solution: Set reference in nb_channel. +Files: src/eval.c, src/netbeans.c, src/proto/netbeans.pro + +Patch 7.4.1812 +Problem: Failure on startup with Athena and Motif. +Solution: Check for INVALCOLOR. (Kazunobu Kuriyama) +Files: src/syntax.c, src/vim.h + +Patch 7.4.1813 +Problem: Memory access error when running test_quickfix. +Solution: Allocate one more byte. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1814 +Problem: A channel may be garbage collected while it's still being used by + a job. (James McCoy) +Solution: Mark the channel as used if the job is still used. Do the same + for channels that are still used. +Files: src/eval.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1815 +Problem: Compiler warnings for unused variables. (Ajit Thakkar) +Solution: Add a dummy initialization. (Yasuhiro Matsumoto) +Files: src/quickfix.c + +Patch 7.4.1816 +Problem: Looping over a null list throws an error. +Solution: Skip over the for loop. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1817 +Problem: The screen is not updated if a callback is invoked when closing a + channel. +Solution: Invoke redraw_after_callback(). +Files: src/channel.c + +Patch 7.4.1818 +Problem: Help completion adds @en to all matches except the first one. +Solution: Remove "break", go over all items. +Files: src/ex_getln.c + +Patch 7.4.1819 +Problem: Compiler warnings when sprintf() is a macro. +Solution: Don't interrupt sprintf() with an #ifdef. (Michael Jarvis, + closes #788) +Files: src/fileio.c, src/tag.c, src/term.c + +Patch 7.4.1820 +Problem: Removing language from help tags too often. +Solution: Only remove @en when not needed. (Hirohito Higashi) +Files: src/ex_getln.c, src/testdir/test_help_tagjump.vim + +Patch 7.4.1821 (after 7.4.1820) +Problem: Test fails on MS-Windows. +Solution: Sort the completion results. +Files: src/testdir/test_help_tagjump.vim + +Patch 7.4.1822 +Problem: Redirecting stdout of a channel to "null" doesn't work. (Nicola) +Solution: Correct the file descriptor number. +Files: src/os_unix.c + +Patch 7.4.1823 +Problem: Warning from 64 bit compiler. +Solution: Add type cast. (Mike Williams) +Files: src/quickfix.c + +Patch 7.4.1824 +Problem: When a job is no longer referenced and does not have an exit + callback the process may hang around in defunct state. (Nicola) +Solution: Call job_status() if the job is running and won't get freed + because it might still be useful. +Files: src/channel.c + +Patch 7.4.1825 +Problem: When job writes to buffer nothing is written. (Nicola) +Solution: Do not discard a channel before writing is done. +Files: src/channel.c + +Patch 7.4.1826 +Problem: Callbacks are invoked when it's not safe. (Andrew Stewart) +Solution: When a channel is to be closed don't invoke callbacks right away, + wait for a safe moment. +Files: src/structs.h, src/channel.c + +Patch 7.4.1827 +Problem: No error when invoking a callback when it's not safe. +Solution: Add an error message. Avoid the error when freeing a channel. +Files: src/structs.h, src/channel.c + +Patch 7.4.1828 +Problem: May try to access buffer that's already freed. +Solution: When freeing a buffer remove it from any channel. +Files: src/buffer.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1829 (after 7.4.1828) +Problem: No message on channel log when buffer was freed. +Solution: Log a message. +Files: src/channel.c + +Patch 7.4.1830 +Problem: non-antialiased misnamed. +Solution: Use NONANTIALIASED and NONANTIALIASED_QUALITY. (Kim Brouer, + closes #793) +Files: src/os_mswin.c, runtime/doc/options.txt + +Patch 7.4.1831 +Problem: When timer_stop() is called with a string there is no proper error + message. +Solution: Require getting a number. (Bjorn Linse) +Files: src/eval.c + +Patch 7.4.1832 +Problem: Memory leak in debug commands. +Solution: Free memory before overwriting the pointer. (hint by Justin Keyes) +Files: src/ex_cmds2.c + +Patch 7.4.1833 +Problem: Cannot use an Ex command for 'keywordprg'. +Solution: Accept an Ex command. (Nelo-Thara Wallus) +Files: src/normal.c, runtime/doc/options.txt + +Patch 7.4.1834 +Problem: Possible crash when conceal is active. +Solution: Check for the screen to be valid when redrawing a line. +Files: src/screen.c + +Patch 7.4.1835 +Problem: When splitting and closing a window the status height changes. +Solution: Compute the frame height correctly. (Hirohito Higashi) +Files: src/window.c, src/testdir/test_alot.vim, + src/testdir/test_window_cmd.vim + +Patch 7.4.1836 +Problem: When using a partial on a dictionary it always gets bound to that + dictionary. +Solution: Make a difference between binding a function to a dictionary + explicitly or automatically. +Files: src/structs.h, src/eval.c, src/testdir/test_partial.vim, + runtime/doc/eval.txt + +Patch 7.4.1837 +Problem: The BufUnload event is triggered twice, when :bunload is used with + `bufhidden` set to `unload` or `delete`. +Solution: Do not trigger the event when ml_mfp is NULL. (Hirohito Higashi) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.1838 +Problem: Functions specifically for testing do not sort together. +Solution: Rename garbagecollect_for_testing() to test_garbagecollect_now(). + Add test_null_list(), test_null_dict(), etc. +Files: src/eval.c, src/testdir/test_expr.vim, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 7.4.1839 +Problem: Cannot get the items stored in a partial. +Solution: Support using get() on a partial. +Files: src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt + +Patch 7.4.1840 +Problem: When using packages an "after" directory cannot be used. +Solution: Add the "after" directory of the package to 'runtimepath' if it + exists. +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 7.4.1841 +Problem: The code to reallocate the buffer used for quickfix is repeated. +Solution: Move the code to a function. (Yegappan Lakshmanan, closes #831) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1842 (after 7.4.1839) +Problem: get() works for Partial but not for Funcref. +Solution: Accept Funcref. Also return the function itself. (Nikolai Pavlov) +Files: src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt + +Patch 7.4.1843 +Problem: Tests involving Python are flaky. +Solution: Set the pt_auto field. Add tests. (Nikolai Pavlov) +Files: runtime/doc/if_pyth.txt, src/if_py_both.h, src/testdir/test86.in, + src/testdir/test86.ok, src/testdir/test87.in, + src/testdir/test87.ok + +Patch 7.4.1844 +Problem: Using old function name in comment. More functions should start + with test_. +Solution: Rename function in comment. (Hirohito Higashi) Rename + disable_char_avail_for_testing() to test_disable_char_avail(). + And alloc_fail() to test_alloc_fail(). +Files: src/eval.c, src/getchar.c, src/testdir/runtest.vim, + src/testdir/test_cursor_func.vim, src/testdir/test_quickfix.vim, + runtime/doc/eval.txt + +Patch 7.4.1845 +Problem: Mentioning NetBeans when reading from channel. (Ramel Eshed) +Solution: Make the text more generic. +Files: src/channel.c + +Patch 7.4.1846 +Problem: Ubsan detects a multiplication overflow. +Solution: Don't use orig_mouse_time when it's zero. (Dominique Pelle) +Files: src/term.c + +Patch 7.4.1847 +Problem: Getting an item from a NULL dict crashes. Setting a register to a + NULL list crashes. (Nikolai Pavlov, issue #768) Comparing a NULL + dict with a NULL dict fails. +Solution: Properly check for NULL. +Files: src/eval.c, src/testdir/test_expr.vim + +Patch 7.4.1848 +Problem: Can't build with Strawberry Perl 5.24. +Solution: Define S_SvREFCNT_dec() if needed. (Damien, Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1849 +Problem: Still trying to read from channel that is going to be closed. + (Ramel Eshed) +Solution: Check if ch_to_be_closed is set. +Files: src/channel.c + +Patch 7.4.1850 +Problem: GUI freezes when using a job. (Shougo Matsu) +Solution: Unregister the channel when there is an input error. +Files: src/channel.c + +Patch 7.4.1851 +Problem: test_syn_attr fails when using the GUI. (Dominique Pelle) +Solution: Escape the font name properly. +Files: src/testdir/test_syn_attr.vim + +Patch 7.4.1852 +Problem: Unix: Cannot run all tests with the GUI. +Solution: Add the "testgui" target. +Files: src/Makefile, src/testdir/Makefile + +Patch 7.4.1853 +Problem: Crash when job and channel are in the same dict while using + partials. (Luc Hermitte) +Solution: Do not decrement the channel reference count too early. +Files: src/channel.c + +Patch 7.4.1854 +Problem: When setting 'termguicolors' the Ignore highlighting doesn't work. + (Charles Campbell) +Solution: Handle the color names "fg" and "bg" when the GUI isn't running + and no colors are specified, fall back to black and white. +Files: src/syntax.c + +Patch 7.4.1855 +Problem: Valgrind reports memory leak for job that is not freed. +Solution: Free all jobs on exit. Add test for failing job. +Files: src/channel.c, src/misc2.c, src/proto/channel.pro, + src/testdir/test_partial.vim + +Patch 7.4.1856 (after 7.4.1855) +Problem: failing job test fails on MS-Windows. +Solution: Expect "fail" status instead of "dead". +Files: src/testdir/test_partial.vim + +Patch 7.4.1857 +Problem: When a channel appends to a buffer that is 'nomodifiable' there is + an error but appending is done anyway. +Solution: Add the 'modifiable' option. Refuse to write to a 'nomodifiable' + when the value is 1. +Files: src/structs.h, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.1858 +Problem: When a channel writes to a buffer it doesn't find a buffer by the + short name but re-uses it anyway. +Solution: Find buffer also by the short name. +Files: src/channel.c, src/buffer.c, src/vim.h + +Patch 7.4.1859 +Problem: Cannot use a function reference for "exit_cb". +Solution: Use get_callback(). (Yegappan Lakshmanan) +Files: src/channel.c, src/structs.h + +Patch 7.4.1860 +Problem: Using a partial for timer_start() may cause a crash. +Solution: Set the copyID in timer objects. (Ozaki Kiichi) +Files: src/testdir/test_timers.vim, src/eval.c, src/ex_cmds2.c, + src/proto/ex_cmds2.pro + +Patch 7.4.1861 +Problem: Compiler warnings with 64 bit compiler. +Solution: Change int to size_t. (Mike Williams) +Files: src/ex_cmds2.c + +Patch 7.4.1862 +Problem: string() with repeated argument does not give a result usable by + eval(). +Solution: Refactor echo_string and tv2string(), moving the common part to + echo_string_core(). (Ken Takata) +Files: src/eval.c, src/testdir/test_viml.vim, src/testdir/test86.ok, + src/testdir/test87.ok + +Patch 7.4.1863 +Problem: Compiler warnings on Win64. +Solution: Adjust types, add type casts. (Ken Takata) +Files: src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/version.c + +Patch 7.4.1864 +Problem: Python: encoding error with Python 2. +Solution: Use "getcwdu" instead of "getcwd". (Ken Takata) +Files: src/if_py_both.h + +Patch 7.4.1865 +Problem: Memory leaks in test49. (Dominique Pelle) +Solution: Use NULL instead of an empty string. +Files: src/eval.c + +Patch 7.4.1866 +Problem: Invalid memory access when exiting with EXITFREE defined. + (Dominique Pelle) +Solution: Set "really_exiting" and skip error messages. +Files: src/misc2.c, src/eval.c + +Patch 7.4.1867 +Problem: Memory leak in test_matchstrpos. +Solution: Free the string before overwriting. (Yegappan Lakshmanan) +Files: src/eval.c + +Patch 7.4.1868 +Problem: Setting really_exiting causes memory leaks to be reported. +Solution: Add the in_free_all_mem flag. +Files: src/globals.h, src/misc2.c, src/eval.c + +Patch 7.4.1869 +Problem: Can't build with old version of Perl. +Solution: Define PERLIO_FUNCS_DECL. (Tom G. Christensen) +Files: src/if_perl.xs + +Patch 7.4.1870 (after 7.4.1863) +Problem: One more Win64 compiler warning. +Solution: Change declared argument type. (Ken Takata) +Files: src/if_mzsch.c + +Patch 7.4.1871 +Problem: Appending to the quickfix list while the quickfix window is open + is very slow. +Solution: Do not delete all the lines, only append the new ones. Avoid + using a window while updating the list. (closes #841) +Files: src/quickfix.c + +Patch 7.4.1872 +Problem: Still build problem with old version of Perl. +Solution: Also define SvREFCNT_inc_void_NN if needed. (Tom G. Christensen) +Files: src/if_perl.xs + +Patch 7.4.1873 +Problem: When a callback adds a timer the GUI doesn't use it until later. + (Ramel Eshed) +Solution: Return early if a callback adds a timer. +Files: src/ex_cmds2.c, src/gui_gtk_x11.c, src/gui_w32.c, src/gui_x11.c, + src/globals.h + +Patch 7.4.1874 +Problem: Unused variable in Win32 code. +Solution: Remove it. (Mike Williams) +Files: src/gui_w32.c + +Patch 7.4.1875 +Problem: Comparing functions and partials doesn't work well. +Solution: Add tests. (Nikolai Pavlov) Compare the dict and arguments in the + partial. (closes #813) +Files: src/eval.c, src/testdir/test_partial.vim + +Patch 7.4.1876 +Problem: Typing "k" at the hit-enter prompt has no effect. +Solution: Don't assume recursive use of the prompt if a character was typed. + (Hirohito Higashi) +Files: src/message.c + +Patch 7.4.1877 +Problem: No test for invoking "close_cb" when writing to a buffer. +Solution: Add using close_cb to a test case. +Files: src/testdir/test_channel.vim + +Patch 7.4.1878 +Problem: Whether a job has exited isn't detected until a character is + typed. After calling exit_cb the cursor is in the wrong place. +Solution: Don't wait forever for a character to be typed when there is a + pending job. Update the screen if needed after calling exit_cb. +Files: src/os_unix.c, src/channel.c, src/proto/channel.pro + +Patch 7.4.1879 (after 7.4.1877) +Problem: Channel test is flaky. +Solution: Wait for close_cb to be invoked. +Files: src/testdir/test_channel.vim + +Patch 7.4.1880 +Problem: MS-Windows console build defaults to not having +channel. +Solution: Include the channel feature if building with huge features. +Files: src/Make_mvc.mak + +Patch 7.4.1881 +Problem: Appending to a long quickfix list is slow. +Solution: Add qf_last. +Files: src/quickfix.c + +Patch 7.4.1882 +Problem: Check for line break at end of line wrong. (Dominique Pelle) +Solution: Correct the logic. +Files: src/quickfix.c + +Patch 7.4.1883 +Problem: Cppcheck found 2 incorrect printf formats. +Solution: Use %ld and %lx. (Dominique Pelle) +Files: src/VisVim/Commands.cpp, src/gui_mac.c + +Patch 7.4.1884 +Problem: Updating marks in a quickfix list is very slow when the list is + long. +Solution: Only update marks if the buffer has a quickfix entry. +Files: src/structs.h, src/quickfix.c + +Patch 7.4.1885 +Problem: MinGW console build defaults to not having +channel. +Solution: Include the channel feature if building with huge features. (Ken + Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.1886 +Problem: When waiting for a character is interrupted by receiving channel + data and the first character of a mapping was typed, the mapping + times out. (Ramel Eshed) +Solution: When dealing with channel data don't return from mch_inchar(). +Files: src/getchar.c, src/proto/getchar.pro, src/os_unix.c + +Patch 7.4.1887 +Problem: When receiving channel data 'updatetime' is not respected. +Solution: Recompute the waiting time after being interrupted. +Files: src/os_unix.c + +Patch 7.4.1888 +Problem: Wrong computation of remaining wait time in RealWaitForChar() +Solution: Remember the original waiting time. +Files: src/os_unix.c + +Patch 7.4.1889 +Problem: When umask is set to 0177 Vim can't create temp files. (Lcd) +Solution: Also correct umask when using mkdtemp(). +Files: src/fileio.c + +Patch 7.4.1890 +Problem: GUI: When channel data is received the cursor blinking is + interrupted. (Ramel Eshed) +Solution: Don't update the cursor when it is blinking. +Files: src/screen.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, + src/gui_mac.c, src/proto/gui_mac.pro, src/gui_photon.c, + src/proto/gui_photon.pro, src/gui_w32.c, src/proto/gui_w32.pro, + src/gui_x11.c, src/proto/gui_x11.pro + +Patch 7.4.1891 +Problem: Channel reading very long lines is slow. +Solution: Collapse multiple buffers until a NL is found. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro, + src/structs.h + +Patch 7.4.1892 +Problem: balloon eval only gets the window number, not the ID. +Solution: Add v:beval_winid. +Files: src/eval.c, src/gui_beval.c, src/vim.h + +Patch 7.4.1893 +Problem: Cannot easily get the window ID for a buffer. +Solution: Add bufwinid(). +Files: src/eval.c, runtime/doc/eval.txt + +Patch 7.4.1894 +Problem: Cannot get the window ID for a mouse click. +Solution: Add v:mouse_winid. +Files: src/eval.c, src/vim.h, runtime/doc/eval.txt + +Patch 7.4.1895 +Problem: Cannot use a window ID where a window number is expected. +Solution: Add LOWEST_WIN_ID, so that the window ID can be used where a + number is expected. +Files: src/window.c, src/eval.c, src/vim.h, runtime/doc/eval.txt, + src/testdir/test_window_id.vim + +Patch 7.4.1896 +Problem: Invoking mark_adjust() when adding a new line below the last line + is pointless. +Solution: Skip calling mark_adjust() when appending below the last line. +Files: src/misc1.c, src/ops.c + +Patch 7.4.1897 +Problem: Various typos, long lines and style mistakes. +Solution: Fix the typos, wrap lines, improve style. +Files: src/buffer.c, src/ex_docmd.c, src/getchar.c, src/option.c, + src/main.aap, src/testdir/README.txt, + src/testdir/test_reltime.vim, src/testdir/test_tagjump.vim, + src/INSTALL, src/config.aap.in, src/if_mzsch.c + +Patch 7.4.1898 +Problem: User commands don't support modifiers. +Solution: Add the <mods> item. (Yegappan Lakshmanan, closes #829) +Files: runtime/doc/map.txt, src/ex_docmd.c, src/testdir/Make_all.mak, + src/testdir/test_usercommands.vim + +Patch 7.4.1899 +Problem: GTK 3: cursor blinking doesn't work well. +Solution: Instead of gui_gtk_window_clear() use gui_mch_clear_block(). + (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.1900 +Problem: Using CTRL-] in the help on "{address}." doesn't work. +Solution: Recognize an item in {}. (Hirohito Higashi, closes #814) +Files: src/ex_cmds.c, src/testdir/test_help_tagjump.vim + +Patch 7.4.1901 +Problem: Win32: the "Disabled" menu items would appear enabled. +Solution: Use submenu_id if there is a parent. (Shane Harper, closes #834) +Files: src/gui_w32.c + +Patch 7.4.1902 +Problem: No test for collapsing buffers for a channel. Some text is lost. +Solution: Add a simple test. Set rq_buflen correctly. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel_pipe.py + +Patch 7.4.1903 +Problem: When writing viminfo merging current history with history in + viminfo may drop recent history entries. +Solution: Add new format for viminfo lines, use it for history entries. Use + a timestamp for ordering the entries. Add test_settime(). + Add the viminfo version. Does not do merging on timestamp yet. +Files: src/eval.c, src/ex_getln.c, src/ex_cmds.c, src/structs.h, + src/globals.h, src/proto/ex_cmds.pro, src/proto/ex_getln.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.1904 (after 7.4.1903) +Problem: Build fails. +Solution: Add missing changes. +Files: src/vim.h + +Patch 7.4.1905 (after 7.4.1903) +Problem: Some compilers can't handle a double semicolon. +Solution: Remove one semicolon. +Files: src/ex_cmds.c + +Patch 7.4.1906 +Problem: Collapsing channel buffers and searching for NL does not work + properly. (Xavier de Gaye, Ramel Eshed) +Solution: Do not assume the buffer contains a NUL or not. Change NUL bytes + to NL to avoid the string is truncated. +Files: src/channel.c, src/netbeans.c, src/proto/channel.pro + +Patch 7.4.1907 +Problem: Warnings from 64 bit compiler. +Solution: Change type to size_t. (Mike Williams) +Files: src/ex_cmds.c + +Patch 7.4.1908 +Problem: Netbeans uses uninitialized pointer and freed memory. +Solution: Set "buffer" at the right place (hint by Ken Takata) +Files: src/netbeans.c + +Patch 7.4.1909 +Problem: Doubled semicolons. +Solution: Reduce to one. (Dominique Pelle) +Files: src/dosinst.c, src/fold.c, src/gui_gtk_x11.c, src/gui_w32.c, + src/main.c, src/misc2.c + +Patch 7.4.1910 +Problem: Tests using external command to delete directory. +Solution: Use delete(). +Files: src/testdir/test17.in, src/testdir/test73.in, + src/testdir/test_getcwd.in + +Patch 7.4.1911 +Problem: Recent history lines may be lost when exiting Vim. +Solution: Merge history using the timestamp. +Files: src/ex_getln.c, src/ex_cmds.c, src/vim.h, src/proto/ex_getln.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.1912 +Problem: No test for using setqflist() on an older quickfix list. +Solution: Add a couple of tests. +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1913 +Problem: When ":doautocmd" is used modelines are used even when no + autocommands were executed. (Daniel Hahler) +Solution: Skip processing modelines. (closes #854) +Files: src/fileio.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/fileio.pro + +Patch 7.4.1914 +Problem: Executing autocommands while using the signal stack has a high + chance of crashing Vim. +Solution: Don't invoke autocommands when on the signal stack. +Files: src/os_unix.c + +Patch 7.4.1915 +Problem: The effect of the PopupMenu autocommand isn't directly visible. +Solution: Call gui_update_menus() before displaying the popup menu. (Shane + Harper, closes #855) +Files: src/menu.c + +Patch 7.4.1916 (after 7.4.1906) +Problem: No proper test for what 7.4.1906 fixes. +Solution: Add a test for reading many lines. +Files: src/testdir/test_channel.vim + +Patch 7.4.1917 +Problem: History lines read from viminfo in different encoding than when + writing are not converted. +Solution: Convert the history lines. +Files: src/ex_cmds.c, src/testdir/test_viminfo.vim + +Patch 7.4.1918 +Problem: Not enough testing for parsing viminfo lines. +Solution: Add test with viminfo lines in bad syntax. Fix memory leak. +Files: src/ex_cmds.c, src/ex_getln.c, src/testdir/test_viminfo.vim + +Patch 7.4.1919 +Problem: Register contents is not merged when writing viminfo. +Solution: Use timestamps for register contents. +Files: src/ops.c, src/ex_getln.c, src/ex_cmds.c, src/proto/ex_cmds.pro, + src/proto/ex_getln.pro, src/proto/ops.pro, src/vim.h + +Patch 7.4.1920 (after 7.4.1919) +Problem: Missing test changes. +Solution: Update viminfo test. +Files: src/testdir/test_viminfo.vim + +Patch 7.4.1921 (after 7.4.1919) +Problem: vim_time() not included when needed. +Solution: Adjust #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.1922 +Problem: Ruby 2.4.0 unifies Fixnum and Bignum into Integer. +Solution: Use rb_cInteger. (Weiyong Mao) +Files: src/if_ruby.c + +Patch 7.4.1923 +Problem: Command line editing is not tested much. +Solution: Add tests for expanding the file name and 'wildmenu'. +Files: src/testdir/test_cmdline.vim, src/testdir/Make_all.mak + +Patch 7.4.1924 +Problem: Missing "void" for functions without argument. +Solution: Add "void". (Hirohito Higashi) +Files: src/channel.c, src/edit.c, src/ex_cmds2.c, src/ops.c, src/screen.c + +Patch 7.4.1925 +Problem: Viminfo does not merge file marks properly. +Solution: Use a timestamp. Add the :clearjumps command. +Files: src/mark.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/mark.pro, + src/structs.h, src/vim.h, src/ex_cmds.h, + src/testdir/test_viminfo.vim + +Patch 7.4.1926 +Problem: Possible crash with many history items. +Solution: Avoid the index going past the last item. +Files: src/ex_getln.c + +Patch 7.4.1927 +Problem: Compiler warning for signed/unsigned. +Solution: Add type cast. +Files: src/if_mzsch.c + +Patch 7.4.1928 +Problem: Overwriting pointer argument. +Solution: Assign to what it points to. (Dominique Pelle) +Files: src/fileio.c + +Patch 7.4.1929 +Problem: Inconsistent indenting and weird name. +Solution: Fix indent, make name all upper case. (Ken Takata) +Files: src/if_ruby.c + +Patch 7.4.1930 +Problem: Can't build without +spell but with +quickfix. (Charles) +Solution: Add better #ifdef around ml_append_buf(). (closes #864) +Files: src/memline.c + +Patch 7.4.1931 +Problem: Using both old and new style file mark lines from viminfo. +Solution: Skip the old style lines if the viminfo file was written with a + Vim version that supports the new style. +Files: src/ex_cmds.c + +Patch 7.4.1932 +Problem: When writing viminfo the jumplist is not merged with the one in + the viminfo file. +Solution: Merge based on timestamp. +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 7.4.1933 +Problem: Compiler warning about uninitialized variable. (Yegappan) +Solution: Give it a dummy value. +Files: src/ex_getln.c + +Patch 7.4.1934 +Problem: New style tests not executed with MinGW compiler. +Solution: Add new style test support. (Yegappan Lakshmanan) +Files: src/testdir/Make_ming.mak + +Patch 7.4.1935 +Problem: When using the GUI search/replace a second match right after the + replacement is skipped. +Solution: Add the SEARCH_START flag. (Mleddy) +Files: src/gui.c + +Patch 7.4.1936 +Problem: Off-by-one error in bounds check. (Coverity) +Solution: Check register number properly. +Files: src/ops.c + +Patch 7.4.1937 +Problem: No test for directory stack in quickfix. +Solution: Add a test. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1938 +Problem: When writing viminfo numbered marks were duplicated. +Solution: Check for duplicates between current numbered marks and the ones + read from viminfo. +Files: src/mark.c + +Patch 7.4.1939 +Problem: Memory access error when reading viminfo. (Dominique Pelle) +Solution: Correct index in jumplist when at the end. +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 7.4.1940 +Problem: "gd" hangs in some situations. (Eric Biggers) +Solution: Remove the SEARCH_START flag when looping. Add a test. +Files: src/normal.c, src/testdir/test_goto.vim + +Patch 7.4.1941 +Problem: Not all quickfix tests are also done with the location lists. +Solution: Test more quickfix code. Use user commands instead of "exe". + (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1942 +Problem: Background is not drawn properly when 'termguicolors' is set. +Solution: Check cterm_normal_bg_color. (Jacob Niehus, closes #805) +Files: src/screen.c + +Patch 7.4.1943 +Problem: Coverity warns for unreachable code. +Solution: Remove the code that won't do anything. +Files: src/mark.c + +Patch 7.4.1944 +Problem: Win32: Cannot compile with XPM feature using VC2015 +Solution: Add XPM libraries compiled with VC2015, and enable to build + gvim.exe which supports XPM using VC2015. (Ken Takata) +Files: src/Make_mvc.mak, src/xpm/x64/lib-vc14/libXpm.lib, + src/xpm/x86/lib-vc14/libXpm.lib + +Patch 7.4.1945 +Problem: The Man plugin doesn't work that well. +Solution: Use "g:ft_man_open_mode" to be able open man pages in vert split + or separate tab. Set nomodifiable for buffer with man content. Add + a test. (Andrey Starodubtsev, closes #873) +Files: runtime/ftplugin/man.vim, src/testdir/test_man.vim, + src/testdir/Make_all.mak + +Patch 7.4.1946 (after 7.4.1944) +Problem: File list does not include new XPM libraries. +Solution: Add the file list entries. +Files: Filelist + +Patch 7.4.1947 +Problem: Viminfo continuation line with wrong length isn't skipped. (Marius + Gedminas) +Solution: Skip a line when encountering an error, but not two lines. +Files: src/ex_cmds.c + +Patch 7.4.1948 +Problem: Using Ctrl-A with double-byte encoding may result in garbled text. +Solution: Skip to the start of a character. (Hirohito Higashi) +Files: src/ops.c + +Patch 7.4.1949 +Problem: Minor problems with the quickfix code. +Solution: Fix the problems. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1950 +Problem: Quickfix long lines test not executed for buffer. +Solution: Call the function to test long lines. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1951 +Problem: Ruby test is old style. +Solution: Convert to a new style test. (Ken Takata) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_ruby.in, + src/testdir/test_ruby.ok, src/testdir/test_ruby.vim + +Patch 7.4.1952 +Problem: Cscope interface does not support finding assignments. +Solution: Add the "a" command. (ppettina, closes #882) +Files: runtime/doc/if_cscop.txt, src/if_cscope.c + +Patch 7.4.1953 +Problem: Not all parts of the quickfix code are tested. +Solution: Add more tests. (Yegappan Lakshmanan) +Files: src/testdir/samples/quickfix.txt, + src/testdir/test_quickfix.vim + +Patch 7.4.1954 (after 7.4.1948) +Problem: No test for what 7.4.1948 fixes. +Solution: Add a test. (Hirohito Higashi, closes #880) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_increment_dbcs.vim + +Patch 7.4.1955 +Problem: Using 32-bit Perl with 64-bit time_t causes memory corruption. + (Christian Brabandt) +Solution: Use time_T instead of time_t for global variables. (Ken Takata) +Files: src/ex_cmds.c, src/globals.h, src/misc2.c, src/proto/ex_cmds.pro, + src/proto/misc2.pro, src/structs.h, src/vim.h + +Patch 7.4.1956 +Problem: When using CTRL-W f and pressing "q" at the ATTENTION dialog the + newly opened window is not closed. +Solution: Close the window and go back to the original one. (Norio Takagi, + Hirohito Higashi) +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 7.4.1957 +Problem: Perl interface has obsolete workaround. +Solution: Remove the workaround added by 7.3.623. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1958 +Problem: Perl interface preprocessor statements not nicely indented. +Solution: Improve the indenting. (Ken Takata) +Files: src/if_perl.xs + +Patch 7.4.1959 +Problem: Crash when running test_channel.vim on Windows. +Solution: Check for NULL pointer result from FormatMessage(). (Christian + Brabandt) +Files: src/channel.c + +Patch 7.4.1960 +Problem: Unicode standard 9 was released. +Solution: Update the character property tables. (Christian Brabandt) +Files: src/mbyte.c + +Patch 7.4.1961 +Problem: When 'insertmode' is reset while doing completion the popup menu + remains even though Vim is in Normal mode. +Solution: Ignore stop_insert_mode when the popup menu is visible. Don't set + stop_insert_mode when 'insertmode' was already off. (Christian + Brabandt) +Files: src/edit.c, src/option.c, src/Makefile, src/testdir/test_alot.vim, + src/testdir/test_popup.vim + +Patch 7.4.1962 +Problem: Two test files for increment/decrement. +Solution: Move the old style test into the new style test. (Hirohito + Higashi, closes #881) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/main.aap, + src/testdir/test35.in, src/testdir/test35.ok, + src/testdir/test_increment.vim + +Patch 7.4.1963 +Problem: Running Win32 Vim in mintty does not work. +Solution: Detect mintty and give a helpful error message. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/iscygpty.c, + src/iscygpty.h, src/main.c, Filelist + +Patch 7.4.1964 +Problem: The quickfix init function is too big. +Solution: Factor out parsing 'errorformat' to a separate function. (Yegappan + Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.1965 +Problem: When using a job in raw mode to append to a buffer garbage + characters are added. +Solution: Do not replace the trailing NUL with a NL. (Ozaki Kiichi) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.1966 +Problem: Coverity reports a resource leak. +Solution: Close "fd" also when bailing out. +Files: src/quickfix.c + +Patch 7.4.1967 +Problem: Falling back from NFA to old regexp engine does not work properly. + (fritzophrenic) +Solution: Do not restore nfa_match. (Christian Brabandt, closes #867) +Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok + +Patch 7.4.1968 +Problem: Invalid memory access with "\<C-">. +Solution: Do not recognize this as a special character. (Dominique Pelle) +Files: src/misc2.c, src/testdir/test_expr.vim + +Patch 7.4.1969 +Problem: When the netbeans channel is closed consuming the buffer may cause + a crash. +Solution: Check for nb_channel not to be NULL. (Xavier de Gaye) +Files: src/netbeans.c + +Patch 7.4.1970 +Problem: Using ":insert" in an empty buffer sets the jump mark. (Ingo + Karkat) +Solution: Don't adjust marks when replacing the empty line in an empty + buffer. (closes #892) +Files: src/ex_cmds.c, src/testdir/test_jumps.vim, + src/testdir/test_alot.vim + +Patch 7.4.1971 +Problem: It is not easy to see unrecognized error lines below the current + error position. +Solution: Add ":clist +count". +Files: src/quickfix.c, runtime/doc/quickfix.txt + +Patch 7.4.1972 +Problem: On Solaris select() does not work as expected when there is + typeahead. +Solution: Add ICANON when sleeping. (Ozaki Kiichi) +Files: src/os_unix.c + +Patch 7.4.1973 +Problem: On MS-Windows the package directory may be added at the end + because of forward/backward slash differences. (Matthew + Desjardins) +Solution: Ignore slash differences. +Files: src/ex_cmds2.c + +Patch 7.4.1974 +Problem: GUI has a problem with some termcodes. +Solution: Handle negative numbers. (Kazunobu Kuriyama) +Files: src/gui.c + +Patch 7.4.1975 +Problem: On MS-Windows large files (> 2Gbyte) cause problems. +Solution: Use "off_T" instead of "off_t". Use "stat_T" instead of "struct + stat". Use 64 bit system functions if available. (Ken Takata) +Files: src/Makefile, src/buffer.c, src/diff.c, src/eval.c, src/ex_cmds.c, + src/ex_cmds2.c, src/fileio.c, src/gui.c, src/gui_at_fs.c, + src/if_cscope.c, src/main.c, src/memfile.c, src/memline.c, + src/misc1.c, src/misc2.c, src/netbeans.c, src/os_mswin.c, + src/os_win32.c, src/proto/fileio.pro, src/proto/memline.pro, + src/proto/os_mswin.pro, src/pty.c, src/quickfix.c, src/spell.c, + src/structs.h, src/tag.c, src/testdir/Make_all.mak, + src/testdir/test_largefile.vim, src/testdir/test_stat.vim, + src/undo.c, src/vim.h + +Patch 7.4.1976 +Problem: Number variables are not 64 bits while they could be. +Solution: Add the num64 feature. (Ken Takata, Yasuhiro Matsumoto) +Files: runtime/doc/eval.txt, runtime/doc/various.txt, + src/Make_cyg_ming.mak, src/Make_mvc.mak, src/charset.c, + src/eval.c, src/ex_cmds.c, src/ex_getln.c, src/feature.h, + src/fileio.c, src/fold.c, src/json.c, src/message.c, src/misc1.c, + src/misc2.c, src/ops.c, src/option.c, src/proto/charset.pro, + src/proto/eval.pro, src/quickfix.c, src/structs.h, + src/testdir/test_viml.vim, src/version.c + +Patch 7.4.1977 +Problem: With 64 bit changes don't need three calls to sprintf(). +Solution: Simplify the code, use vim_snprintf(). (Ken Takata) +Files: src/fileio.c + +Patch 7.4.1978 (after 7.4.1975) +Problem: Large file test does not delete its output. +Solution: Delete the output. Check size properly when possible. (Ken Takata) +Files: src/testdir/test_largefile.vim + +Patch 7.4.1979 (after 7.4.1976) +Problem: Getting value of binary option is wrong. (Kent Sibilev) +Solution: Fix type cast. Add a test. +Files: src/option.c, src/testdir/test_expr.vim + +Patch 7.4.1980 +Problem: 'errorformat' is parsed for every call to ":caddexpr". Can't add + to two location lists asynchronously. +Solution: Keep the previously parsed data when appropriate. (mostly by + Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.1981 +Problem: No testing for Farsi code. +Solution: Add a minimal test. Clean up Farsi code. +Files: src/farsi.c, src/Makefile, src/charset.c, src/normal.c, + src/proto/main.pro, src/testdir/Make_all.mak, + src/testdir/test_farsi.vim + +Patch 7.4.1982 +Problem: Viminfo file contains duplicate change marks. +Solution: Drop duplicate marks. +Files: src/mark.c + +Patch 7.4.1983 +Problem: farsi.c and arabic.c are included in a strange way. +Solution: Build them like other files. +Files: src/main.c, src/farsi.c, src/arabic.c, src/proto.h, + src/proto/main.pro, src/proto/farsi.pro, src/proto/arabic.pro, + src/Makefile, src/Make_bc5.mak, src/Make_cyg_ming.mak, + src/Make_dice.mak, src/Make_ivc.mak, src/Make_manx.mak, + src/Make_morph.mak, src/Make_mvc.mak, src/Make_sas.mak, + Filelist + +Patch 7.4.1984 +Problem: Not all quickfix features are tested. +Solution: Add a few more tests. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.1985 (after 7.4.1983) +Problem: Missing changes in VMS build file. +Solution: Use the right file name. +Files: src/Make_vms.mms + +Patch 7.4.1986 +Problem: Compiler warns for loss of data. +Solution: Use size_t instead of int. (Christian Brabandt) +Files: src/ex_cmds2.c + +Patch 7.4.1987 +Problem: When copying unrecognized lines for viminfo, end up with useless + continuation lines. +Solution: Skip continuation lines. +Files: src/ex_cmds.c + +Patch 7.4.1988 +Problem: When updating viminfo with file marks there is no time order. +Solution: Remember the time when a buffer was last used, store marks for + the most recently used buffers. +Files: src/buffer.c, src/structs.h, src/mark.c, src/main.c, + src/ex_cmds.c, src/proto/mark.pro, src/testdir/test_viminfo.vim + +Patch 7.4.1989 +Problem: filter() and map() only accept a string argument. +Solution: Implement using a Funcref argument (Yasuhiro Matsumoto, Ken + Takata) +Files: runtime/doc/eval.txt, src/Makefile, src/eval.c, + src/testdir/test_alot.vim, src/testdir/test_filter_map.vim, + src/testdir/test_partial.vim + +Patch 7.4.1990 (after 7.4.1952) +Problem: Cscope items are not sorted. +Solution: Put the new "a" command first. (Ken Takata) +Files: src/if_cscope.c + +Patch 7.4.1991 +Problem: glob() does not add a symbolic link when there are no wildcards. +Solution: Remove the call to mch_getperm(). +Files: src/misc1.c + +Patch 7.4.1992 +Problem: Values for true and false can be confusing. +Solution: Update the documentation. Add a test. Make v:true evaluate to + TRUE for a non-zero-arg. +Files: runtime/doc/eval.txt, src/eval.c, src/Makefile, + src/testdir/test_true_false.vim, src/testdir/test_alot.vim + +Patch 7.4.1993 +Problem: Not all TRUE and FALSE arguments are tested. +Solution: Add a few more tests. +Files: src/testdir/test_true_false.vim + +Patch 7.4.1994 (after 7.4.1993) +Problem: True-false test fails. +Solution: Filter the dict to only keep the value that matters. +Files: src/testdir/test_true_false.vim + +Patch 7.4.1995 +Problem: GUI: cursor drawn in wrong place if a timer callback causes a + screen update. (David Samvelyan) +Solution: Also redraw the cursor when it's blinking and on. +Files: src/gui_gtk_x11.c, src/gui_mac.c, src/gui_photon.c, src/gui_w32.c, + src/gui_x11.c, src/screen.c, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_photon.pro, + src/proto/gui_w32.pro, src/proto/gui_x11.pro + +Patch 7.4.1996 +Problem: Capturing the output of a command takes a few commands. +Solution: Add evalcmd(). +Files: src/eval.c, runtime/doc/eval.txt, src/testdir/test_alot.vim, + src/Makefile, src/testdir/test_evalcmd.vim + +Patch 7.4.1997 +Problem: Cannot easily scroll the quickfix window. +Solution: Add ":cbottom". +Files: src/ex_cmds.h, src/quickfix.c, src/proto/quickfix.pro, + src/ex_docmd.c, src/testdir/test_quickfix.vim, + runtime/doc/quickfix.txt + +Patch 7.4.1998 +Problem: When writing buffer lines to a job there is no NL to NUL + conversion. +Solution: Make it work symmetrical with writing lines from a job into a + buffer. +Files: src/channel.c, src/proto/channel.pro, src/netbeans.c + +Patch 7.4.1999 +Problem: evalcmd() doesn't work recursively. +Solution: Use redir_evalcmd instead of redir_vname. +Files: src/message.c, src/eval.c, src/globals.h, src/proto/eval.pro, + src/testdir/test_evalcmd.vim + +Patch 7.4.2000 (after 7.4.1999) +Problem: Evalcmd test fails. +Solution: Add missing piece. +Files: src/ex_docmd.c + +Patch 7.4.2001 (after 7.4.2000) +Problem: Tiny build fails. (Tony Mechelynck) +Solution: Add #ifdef. +Files: src/ex_docmd.c + +Patch 7.4.2002 +Problem: Crash when passing number to filter() or map(). +Solution: Convert to a string. (Ozaki Kiichi) +Files: src/eval.c, src/testdir/test_filter_map.vim + +Patch 7.4.2003 +Problem: Still cursor flickering when a callback updates the screen. (David + Samvelyan) +Solution: Put the cursor in the right position after updating the screen. +Files: src/screen.c + +Patch 7.4.2004 +Problem: GUI: cursor displayed in the wrong position. +Solution: Correct screen_cur_col and screen_cur_row. +Files: src/screen.c + +Patch 7.4.2005 +Problem: After using evalcmd() message output is in the wrong position. + (Christian Brabandt) +Solution: Reset msg_col. +Files: src/eval.c + +Patch 7.4.2006 +Problem: Crash when using tabnext in BufUnload autocmd. (Norio Takagi) +Solution: First check that the current buffer is the right one. (Hirohito + Higashi) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.2007 +Problem: Running the tests leaves a viminfo file behind. +Solution: Make the viminfo option empty. +Files: src/testdir/runtest.vim + +Patch 7.4.2008 +Problem: evalcmd() has a confusing name. +Solution: Rename to execute(). Make silent optional. Support a list of + commands. +Files: src/eval.c, src/ex_docmd.c, src/message.c, src/globals.h, + src/proto/eval.pro, src/Makefile, src/testdir/test_evalcmd.vim, + src/testdir/test_execute_func.vim, src/testdir/test_alot.vim, + runtime/doc/eval.txt + +Patch 7.4.2009 (after 7.4.2008) +Problem: Messages test fails. +Solution: Don't set redir_execute before returning. Add missing version + number. +Files: src/eval.c + +Patch 7.4.2010 +Problem: There is a :cbottom command but no :lbottom command. +Solution: Add :lbottom. (Yegappan Lakshmanan) +Files: runtime/doc/index.txt, runtime/doc/quickfix.txt, src/ex_cmds.h, + src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2011 +Problem: It is not easy to get a list of command arguments. +Solution: Add getcompletion(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c, + src/proto/ex_docmd.pro, src/testdir/test_cmdline.vim + +Patch 7.4.2012 (after 7.4.2011) +Problem: Test for getcompletion() does not pass on all systems. +Solution: Only test what is supported. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2013 +Problem: Using "noinsert" in 'completeopt' breaks redo. +Solution: Set compl_curr_match. (Shougo Matsu, closes #874) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2014 +Problem: Using "noinsert" in 'completeopt' does not insert match. +Solution: Set compl_enter_selects. (Shougo Matsu, closes #875) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2015 +Problem: When a file gets a name when writing it 'acd' is not effective. + (Dan Church) +Solution: Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes + #777, closes #803) Add test_autochdir() to enable 'acd' before + "starting" is reset. +Files: src/ex_cmds.c, src/buffer.c, src/eval.c, src/globals.h, + src/Makefile, src/testdir/test_autochdir.vim, + src/testdir/Make_all.mak + +Patch 7.4.2016 +Problem: Warning from MinGW about _WIN32_WINNT redefined. (John Marriott) +Solution: First undefine it. (Ken Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2017 +Problem: When there are many errors adding them to the quickfix list takes + a long time. +Solution: Add BLN_NOOPT. Don't call buf_valid() in buf_copy_options(). + Remember the last file name used. When going through the buffer + list start from the end of the list. Only call buf_valid() when + autocommands were executed. +Files: src/buffer.c, src/option.c, src/quickfix.c, src/vim.h + +Patch 7.4.2018 +Problem: buf_valid() can be slow when there are many buffers. +Solution: Add bufref_valid(), only go through the buffer list when a buffer + was freed. +Files: src/structs.h, src/buffer.c, src/quickfix.c, src/proto/buffer.pro + +Patch 7.4.2019 +Problem: When ignoring case utf_fold() may consume a lot of time. +Solution: Optimize for ASCII. +Files: src/mbyte.c + +Patch 7.4.2020 +Problem: Can't build without +autocmd feature. +Solution: Adjust #ifdefs. +Files: src/buffer.c + +Patch 7.4.2021 +Problem: Still too many buf_valid() calls. +Solution: Make au_new_curbuf a bufref. Use bufref_valid() in more places. +Files: src/ex_cmds.c, src/buffer.c, src/globals.h + +Patch 7.4.2022 +Problem: Warnings from 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/eval.c + +Patch 7.4.2023 +Problem: buflist_findname_stat() may find a dummy buffer. +Solution: Set the BF_DUMMY flag after loading a dummy buffer. Start + finding buffers from the end of the list. +Files: src/quickfix.c, src/buffer.c + +Patch 7.4.2024 +Problem: More buf_valid() calls can be optimized. +Solution: Use bufref_valid() instead. +Files: src/buffer.c, src/ex_cmds.c, src/structs.h, src/channel.c, + src/diff.c, src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, + src/ex_getln.c, src/fileio.c, src/main.c, src/misc2.c, + src/netbeans.c, src/quickfix.c, src/spell.c, src/term.c, + src/if_py_both.h, src/window.c, src/proto/buffer.pro, + src/proto/window.pro + +Patch 7.4.2025 +Problem: The cursor blinking stops or is irregular when receiving date over + a channel and writing it in a buffer, and when updating the status + line. (Ramel Eshed) +Solution: Make it a bit better by flushing GUI output. Don't redraw the + cursor after updating the screen if the blink state is off. +Files: src/gui_gtk_x11.c, src/screen.c + +Patch 7.4.2026 +Problem: Reference counting for callbacks isn't right. +Solution: Add free_callback(). (Ken Takata) Fix reference count. +Files: src/channel.c, src/eval.c, src/ex_cmds2.c, src/proto/eval.pro + +Patch 7.4.2027 +Problem: Can't build with +eval but without +menu. +Solution: Add #ifdef. (John Marriott) +Files: src/eval.c + +Patch 7.4.2028 +Problem: cppcheck warns for using index before limits check. +Solution: Swap the expressions. (Dominique Pelle) +Files: src/mbyte.c + +Patch 7.4.2029 +Problem: printf() does not work with 64 bit numbers. +Solution: use the "L" length modifier. (Ken Takata) +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2030 +Problem: ARCH must be set properly when using MinGW. +Solution: Detect the default value of ARCH from the current compiler. (Ken + Takata) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2031 +Problem: The list_lbr_utf8 test fails if ~/.vim/syntax/c.vim sets + 'textwidth' to a non-zero value. (Oyvind A. Holm) +Solution: Add a setup.vim file that sets 'runtimepath' and $HOME to a safe + value. (partly by Christian Brabandt, closes #912) +Files: src/testdir/setup.vim, src/testdir/amiga.vim, src/testdir/dos.vim, + src/testdir/unix.vim, src/testdir/vms.vim, src/testdir/runtest.vim + +Patch 7.4.2032 (after 7.4.2030) +Problem: Build fails with 64 bit MinGW. (Axel Bender) +Solution: Handle dash vs. underscore. (Ken Takata, Hirohito Higashi) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2033 +Problem: 'cscopequickfix' option does not accept new value "a". +Solution: Adjust list of command characters. (Ken Takata) +Files: src/option.h, src/Makefile, src/testdir/test_cscope.vim, + src/testdir/Make_all.mak + +Patch 7.4.2034 (after 7.4.2032) +Problem: Build fails with some version of MinGW. (illusorypan) +Solution: Recognize mingw32. (Ken Takata, closes #921) +Files: src/Make_cyg_ming.mak + +Patch 7.4.2035 +Problem: On Solaris with ZFS the ACL may get removed. +Solution: Always restore the ACL for Solaris ZFS. (Danek Duvall) +Files: src/fileio.c + +Patch 7.4.2036 +Problem: Looking up a buffer by number is slow if there are many. +Solution: Use a hashtab. +Files: src/structs.h, src/buffer.c + +Patch 7.4.2037 (after 7.4.2036) +Problem: Small build fails. +Solution: Adjust #ifdefs. +Files: src/hashtab.c + +Patch 7.4.2038 (after 7.4.2036) +Problem: Small build still fails. +Solution: Adjust more #ifdefs. +Files: src/globals.h, src/buffer.c + +Patch 7.4.2039 +Problem: The Netbeans integration is not tested. +Solution: Add a first Netbeans test. +Files: src/testdir/test_netbeans.vim, src/testdir/test_netbeans.py, + src/testdir/Make_all.mak, src/Makefile, + src/testdir/test_channel.vim, src/testdir/shared.vim + +Patch 7.4.2040 +Problem: New files missing from distribution. +Solution: Add new test scripts. +Files: Filelist + +Patch 7.4.2041 +Problem: Netbeans file authentication not tested. +Solution: Add a test. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2042 +Problem: GTK: display updating is not done properly and can be slow. +Solution: Use gdk_display_flush() instead of gdk_display_sync(). Don't call + gdk_window_process_updates(). (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 7.4.2043 +Problem: setbuvfar() causes a screen redraw. +Solution: Only use aucmd_prepbuf() for options. +Files: src/eval.c + +Patch 7.4.2044 +Problem: filter() and map() either require a string or defining a function. +Solution: Support lambda, a short way to define a function that evaluates an + expression. (Yasuhiro Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/testdir/test_alot.vim, + src/Makefile, src/testdir/test_channel.vim, + src/testdir/test_lambda.vim + +Patch 7.4.2045 +Problem: Memory leak when using a function callback. +Solution: Don't save the function name when it's in the partial. +Files: src/channel.c + +Patch 7.4.2046 +Problem: The qf_init_ext() function is too big. +Solution: Refactor it. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 7.4.2047 +Problem: Compiler warning for initializing a struct. +Solution: Initialize in another way. (Anton Lindqvist) +Files: src/quickfix.c + +Patch 7.4.2048 +Problem: There is still code and help for unsupported systems. +Solution: Remove the code and text. (Hirohito Higashi) +Files: runtime/doc/eval.txt, runtime/lang/menu_sk_sk.vim, + runtime/menu.vim, runtime/optwin.vim, src/Make_bc5.mak, + src/ex_docmd.c, src/feature.h, src/fileio.c, src/globals.h, + src/main.c, src/memfile.c, src/memline.c, src/misc1.c, + src/misc2.c, src/option.c, src/option.h, src/os_unix.c, + src/os_unix.h, src/proto.h, src/term.c, src/undo.c, src/version.c, + src/vim.h, src/xxd/xxd.c + +Patch 7.4.2049 +Problem: There is no way to get a list of the error lists. +Solution: Add ":chistory" and ":lhistory". +Files: src/ex_cmds.h, src/quickfix.c, src/ex_docmd.c, src/message.c, + src/proto/quickfix.pro, src/testdir/test_quickfix.vim + +Patch 7.4.2050 +Problem: When using ":vimgrep" may end up with duplicate buffers. +Solution: When adding an error list entry pass the buffer number if possible. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2051 +Problem: No proper testing of trunc_string(). +Solution: Add a unittest for message.c. +Files: src/Makefile, src/message.c, src/message_test.c, src/main.c, + src/proto/main.pro, src/structs.h + +Patch 7.4.2052 +Problem: Coverage report is messed up by the unittests. +Solution: Add a separate test target for script tests. Use that when + collecting coverage information. +Files: src/Makefile + +Patch 7.4.2053 +Problem: Can't run scripttests in the top directory. +Solution: Add targets to the top Makefile. +Files: Makefile + +Patch 7.4.2054 (after 7.4.2048) +Problem: Wrong part of #ifdef removed. +Solution: Use the right part. (Hirohito Higashi) +Files: src/os_unix.c + +Patch 7.4.2055 +Problem: eval.c is too big +Solution: Move Dictionary functions to dict.c +Files: src/eval.c, src/dict.c, src/vim.h, src/globals.h, + src/proto/eval.pro, src/proto/dict.pro, src/Makefile, Filelist + +Patch 7.4.2056 (after 7.4.2055) +Problem: Build fails. +Solution: Add missing changes. +Files: src/proto.h + +Patch 7.4.2057 +Problem: eval.c is too big. +Solution: Move List functions to list.c +Files: src/eval.c, src/dict.c, src/list.c, src/proto.h, src/Makefile, + src/globals.h, src/proto/eval.pro, src/proto/list.pro, Filelist + +Patch 7.4.2058 +Problem: eval.c is too big. +Solution: Move user functions to userfunc.c +Files: src/userfunc.c, src/eval.c, src/vim.h, src/globals.h, + src/structs.h, src/proto.h, src/Makefile, src/proto/eval.pro, + src/proto/userfunc.pro, Filelist + +Patch 7.4.2059 +Problem: Non-Unix builds fail. +Solution: Update Makefiles for new files. +Files: src/Make_bc5.mak, src/Make_cyg_ming.mak, src/Make_dice.mak, + src/Make_ivc.mak, src/Make_manx.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2060 (after 7.4.2059) +Problem: Wrong file name. +Solution: Fix typo. +Files: src/Make_mvc.mak + +Patch 7.4.2061 +Problem: qf_init_ext() is too big. +Solution: Move code to qf_parse_line() (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2062 +Problem: Using dummy variable to compute struct member offset. +Solution: Use offsetof(). +Files: src/globals.h, src/macros.h, src/vim.h, src/spell.c + +Patch 7.4.2063 +Problem: eval.c is still too big. +Solution: Split off internal functions to evalfunc.c. +Files: src/eval.c, src/evalfunc.c, src/list.c, src/proto.h, + src/globals.h, src/vim.h, src/proto/eval.pro, + src/proto/evalfunc.pro, src/proto/list.pro, src/Makefile, Filelist, + src/Make_bc5.mak, src/Make_cyg_ming.mak, src/Make_dice.mak, + src/Make_ivc.mak, src/Make_manx.mak, src/Make_morph.mak, + src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2064 +Problem: Coverity warns for possible buffer overflow. +Solution: Use vim_strcat() instead of strcat(). +Files: src/quickfix.c + +Patch 7.4.2065 +Problem: Compiler warns for uninitialized variable. (John Marriott) +Solution: Set lnum to the right value. +Files: src/evalfunc.c + +Patch 7.4.2066 +Problem: getcompletion() not well tested. +Solution: Add more testing. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2067 +Problem: Compiler warning for char/char_u conversion. (Tony Mechelynck) + Inefficient code. +Solution: Use more lines to fill with spaces. (Nikolai Pavlov) Add type cast. +Files: src/quickfix.c + +Patch 7.4.2068 +Problem: Not all arguments of trunc_string() are tested. Memory access + error when running the message tests. +Solution: Add another test case. (Yegappan Lakshmanan) Make it easy to run + unittests with valgrind. Fix the access error. +Files: src/message.c, src/message_test.c, src/Makefile + +Patch 7.4.2069 +Problem: spell.c is too big. +Solution: Split it in spell file handling and spell checking. +Files: src/spell.c, src/spellfile.c, src/spell.h, src/Makefile, + src/proto/spell.pro, src/proto/spellfile.pro, src/proto.h + Filelist, src/Make_bc5.mak, src/Make_cyg_ming.mak, + src/Make_dice.mak, src/Make_ivc.mak, src/Make_manx.mak, + src/Make_morph.mak, src/Make_mvc.mak, src/Make_sas.mak + +Patch 7.4.2070 (after 7.4.2069) +Problem: Missing change to include file. +Solution: Include the spell header file. +Files: src/vim.h + +Patch 7.4.2071 +Problem: The return value of type() is difficult to use. +Solution: Define v:t_ constants. (Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/evalfunc.c, + src/testdir/test_channel.vim, src/testdir/test_viml.vim, src/vim.h + +Patch 7.4.2072 +Problem: substitute() does not support a Funcref argument. +Solution: Support a Funcref like it supports a string starting with "\=". +Files: src/evalfunc.c, src/regexp.c, src/eval.c, src/proto/eval.pro, + src/proto/regexp.pro, src/testdir/test_expr.vim + +Patch 7.4.2073 +Problem: rgb.txt is read for every color name. +Solution: Load rgb.txt once. (Christian Brabandt) Add a test. +Files: runtime/rgb.txt, src/term.c, src/testdir/test_syn_attr.vim + +Patch 7.4.2074 +Problem: One more place using a dummy variable. +Solution: Use offsetof(). (Ken Takata) +Files: src/userfunc.c + +Patch 7.4.2075 +Problem: No autocommand event to initialize a window or tab page. +Solution: Add WinNew and TabNew events. (partly by Felipe Morales) +Files: src/fileio.c, src/window.c, src/vim.h, + src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt + +Patch 7.4.2076 +Problem: Syntax error when dict has '>' key. +Solution: Check for endchar. (Ken Takata) +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2077 +Problem: Cannot update 'tabline' when a tab was closed. +Solution: Add the TabClosed autocmd event. (partly by Felipe Morales) +Files: src/fileio.c, src/window.c, src/vim.h, + src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt + +Patch 7.4.2078 +Problem: Running checks in po directory fails. +Solution: Add colors used in syntax.c to the builtin color table. +Files: src/term.c + +Patch 7.4.2079 +Problem: Netbeans test fails on non-Unix systems. +Solution: Only do the permission check on Unix systems. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2080 +Problem: When using PERROR() on some systems assert_fails() does not see + the error. +Solution: Make PERROR() always report the error. +Files: src/vim.h, src/message.c, src/proto/message.pro + +Patch 7.4.2081 +Problem: Line numbers in the error list are not always adjusted. +Solution: Set b_has_qf_entry properly. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/structs.h, src/testdir/test_quickfix.vim + +Patch 7.4.2082 +Problem: Not much test coverage for digraphs. +Solution: Add a new style digraph test. (Christian Brabandt) +Files: src/Makefile, src/testdir/test_alot.vim, + src/testdir/test_digraph.vim + +Patch 7.4.2083 +Problem: Coverity complains about not restoring a value. +Solution: Restore the value, although it's not really needed. Change return + to jump to cleanup, might leak memory. +Files: src/userfunc.c + +Patch 7.4.2084 +Problem: New digraph test makes testing hang. +Solution: Don't set "nocp". +Files: src/testdir/test_digraph.vim + +Patch 7.4.2085 +Problem: Digraph tests fails on some systems. +Solution: Run it separately and set 'encoding' early. +Files: src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/test_digraph.vim + +Patch 7.4.2086 +Problem: Using the system default encoding makes tests unpredictable. +Solution: Always use utf-8 or latin1 in the new style tests. Remove setting + encoding and scriptencoding where it is not needed. +Files: src/testdir/runtest.vim, src/testdir/test_channel.vim, + src/testdir/test_digraph.vim, src/testdir/test_expand_dllpath.vim, + src/testdir/test_expr_utf8.vim, src/testdir/test_json.vim, + src/testdir/test_matchadd_conceal_utf8.vim, + src/testdir/test_regexp_utf8.vim, src/testdir/test_visual.vim, + src/testdir/test_alot_utf8.vim, + +Patch 7.4.2087 +Problem: Digraph code test coverage is still low. +Solution: Add more tests. (Christian Brabandt) +Files: src/testdir/test_digraph.vim + +Patch 7.4.2088 (after 7.4.2087) +Problem: Keymap test fails with normal features. +Solution: Bail out if the keymap feature is not supported. +Files: src/testdir/test_digraph.vim + +Patch 7.4.2089 +Problem: Color handling of X11 GUIs is too complicated. +Solution: Simplify the code. Use RGBA where appropriate. (Kazunobu + Kuriyama) +Files: src/gui.h, src/gui_beval.c, src/gui_gtk_x11.c, src/netbeans.c + +Patch 7.4.2090 +Problem: Using submatch() in a lambda passed to substitute() is verbose. +Solution: Use a static list and pass it as an optional argument to the + function. Fix memory leak. +Files: src/structs.h, src/list.c, src/userfunc.c, src/channel.c, + src/eval.c, src/evalfunc.c, src/ex_cmds2.c, src/regexp.c, + src/proto/list.pro, src/proto/userfunc.pro, + src/testdir/test_expr.vim, runtime/doc/eval.txt + +Patch 7.4.2091 +Problem: Coverity reports a resource leak when out of memory. +Solution: Close the file before returning. +Files: src/term.c + +Patch 7.4.2092 +Problem: GTK 3 build fails with older GTK version. +Solution: Check the pango version. (Kazunobu Kuriyama) +Files: src/gui_beval.c + +Patch 7.4.2093 +Problem: Netbeans test fails once in a while. Leaving log file behind. +Solution: Add it to the list of flaky tests. Disable logfile. +Files: src/testdir/runtest.vim, src/testdir/test_channel.vim + +Patch 7.4.2094 +Problem: The color allocation in X11 is overly complicated. +Solution: Remove find_closest_color(), XAllocColor() already does this. + (Kazunobu Kuriyama) +Files: src/gui_x11.c + +Patch 7.4.2095 +Problem: Man test fails when run with the GUI. +Solution: Adjust for different behavior of GUI. Add assert_inrange(). +Files: src/eval.c, src/evalfunc.c, src/proto/eval.pro, + src/testdir/test_assert.vim, src/testdir/test_man.vim, + runtime/doc/eval.txt + +Patch 7.4.2096 +Problem: Lambda functions show up with completion. +Solution: Don't show lambda functions. (Ken Takata) +Files: src/userfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2097 +Problem: Warning from 64 bit compiler. +Solution: use size_t instead of int. (Mike Williams) +Files: src/message.c + +Patch 7.4.2098 +Problem: Text object tests are old style. +Solution: Turn them into new style tests. (James McCoy, closes #941) +Files: src/testdir/Make_all.mak, src/testdir/test_textobjects.in, + src/testdir/test_textobjects.ok, src/testdir/test_textobjects.vim, + src/Makefile + +Patch 7.4.2099 +Problem: When a keymap is active only "(lang)" is displayed. (Ilya + Dogolazky) +Solution: Show the keymap name. (Dmitri Vereshchagin, closes #933) +Files: src/buffer.c, src/proto/screen.pro, src/screen.c + +Patch 7.4.2100 +Problem: "cgn" and "dgn" do not work correctly with a single character + match and the replacement includes the searched pattern. (John + Beckett) +Solution: If the match is found in the wrong column try in the next column. + Turn the test into new style. (Christian Brabandt) +Files: src/search.c, src/testdir/Make_all.mak, src/Makefile, + src/testdir/test53.in, src/testdir/test53.ok, + src/testdir/test_gn.vim + +Patch 7.4.2101 +Problem: Looping over windows, buffers and tab pages is inconsistent. +Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan) +Files: src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c, + src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/fileio.c, + src/globals.h, src/gui.c, src/gui_mac.c, src/if_lua.c, + src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/if_tcl.c, + src/main.c, src/mark.c, src/memfile.c, src/memline.c, src/misc1.c, + src/move.c, src/netbeans.c, src/normal.c, src/option.c, + src/quickfix.c, src/screen.c, src/spell.c, src/term.c, + src/window.c, src/workshop.c + +Patch 7.4.2102 (after 7.4.2101) +Problem: Tiny build with GUI fails. +Solution: Revert one FOR_ALL_ change. +Files: src/gui.c + +Patch 7.4.2103 +Problem: Can't have "augroup END" right after ":au!". +Solution: Check for the bar character before the command argument. +Files: src/fileio.c, src/testdir/test_autocmd.vim, + runtime/doc/autocmd.txt + +Patch 7.4.2104 +Problem: Code duplication when unreferencing a function. +Solution: De-duplicate. +Files: src/userfunc.c + +Patch 7.4.2105 +Problem: Configure reports default features to be "normal" while it is + "huge". +Solution: Change the default text. Build with newer autoconf. +Files: src/configure.in, src/auto/configure + +Patch 7.4.2106 +Problem: Clang warns about missing field in initializer. +Solution: Define COMMA and use it. (Kazunobu Kuriyama) +Files: src/ex_cmds.c, src/globals.h, src/vim.h + +Patch 7.4.2107 (after 7.4.2106) +Problem: Misplaced equal sign. +Solution: Remove it. +Files: src/globals.h + +Patch 7.4.2108 +Problem: Netbeans test is flaky. +Solution: Wait for the cursor to be positioned. +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2109 +Problem: Setting 'display' to "lastline" is a drastic change, while + omitting it results in lots of "@" lines. +Solution: Add "truncate" to show "@@@" for a truncated line. +Files: src/option.h, src/screen.c, runtime/doc/options.txt + +Patch 7.4.2110 +Problem: When there is an CmdUndefined autocmd then the error for a missing + command is E464 instead of E492. (Manuel Ortega) +Solution: Don't let the pointer be NULL. +Files: src/ex_docmd.c, src/testdir/test_usercommands.vim + +Patch 7.4.2111 +Problem: Defaults are very conservative. +Solution: Move settings from vimrc_example.vim to defaults.vim. Load + defaults.vim if no .vimrc was found. +Files: src/main.c, src/version.c, src/os_amiga.h, src/os_dos.h, + src/os_mac.h, src/os_unix.h, src/feature.h, src/Makefile, + runtime/vimrc_example.vim, runtime/defaults.vim, + runtime/evim.vim, Filelist, runtime/doc/starting.txt + +Patch 7.4.2112 +Problem: getcompletion(.., 'dir') returns a match with trailing "*" when + there are no matches. (Chdiza) +Solution: Return an empty list when there are no matches. Add a trailing + slash to directories. (Yegappan Lakshmanan) Add tests for no + matches. (closes #947) +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2113 +Problem: Test for undo is flaky. +Solution: Turn it into a new style test. Use test_settime() to avoid + flakyness. +Files: src/Makefile, src/undo.c, src/testdir/test61.in, + src/testdir/test61.ok, src/testdir/test_undo.vim, + src/testdir/test_undolevels.vim, src/testdir/Make_all.mak, + src/testdir/test_alot.vim + +Patch 7.4.2114 +Problem: Tiny build fails. +Solution: Always include vim_time(). +Files: src/ex_cmds.c + +Patch 7.4.2115 +Problem: Loading defaults.vim with -C argument. +Solution: Don't load the defaults script with -C argument. Test sourcing + the defaults script. Set 'display' to "truncate". +Files: src/main.c, src/Makefile, runtime/defaults.vim, + src/testdir/test_startup.vim, src/testdir/Make_all.mak + +Patch 7.4.2116 +Problem: The default vimrc for Windows is very conservative. +Solution: Use the defaults.vim in the Windows installer. +Files: src/dosinst.c + +Patch 7.4.2117 +Problem: Deleting an augroup that still has autocmds does not give a + warning. The next defined augroup takes its place. +Solution: Give a warning and prevent the index being used for another group + name. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2118 +Problem: Mac: can't build with tiny features. +Solution: Don't define FEAT_CLIPBOARD unconditionally. (Kazunobu Kuriyama) +Files: src/vim.h + +Patch 7.4.2119 +Problem: Closures are not supported. +Solution: Capture variables in lambdas from the outer scope. (Yasuhiro + Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/eval.c, src/ex_cmds2.c, src/globals.h, + src/proto/eval.pro, src/proto/userfunc.pro, + src/testdir/test_lambda.vim, src/userfunc.c + +Patch 7.4.2120 +Problem: User defined functions can't be a closure. +Solution: Add the "closure" argument. Allow using :unlet on a bound + variable. (Yasuhiro Matsumoto, Ken Takata) +Files: runtime/doc/eval.txt, src/testdir/test_lambda.vim, src/userfunc.c, + src/eval.c src/proto/userfunc.pro + +Patch 7.4.2121 +Problem: No easy way to check if lambda and closure are supported. +Solution: Add the +lambda feature. +Files: src/evalfunc.c, src/version.c, src/testdir/test_lambda.vim + +Patch 7.4.2122 (after 7.4.2118) +Problem: Mac: don't get +clipboard in huge build. +Solution: Move #define down below including feature.h +Files: src/vim.h + +Patch 7.4.2123 +Problem: No new style test for diff mode. +Solution: Add a test. Check that folds are in sync. +Files: src/Makefile, src/testdir/test_diffmode.vim, + src/testdir/Make_all.mak, src/testdir/test47.in, + src/testdir/test47.ok + +Patch 7.4.2124 +Problem: diffmode test leaves files behind, breaking another test. +Solution: Delete the files. +Files: src/testdir/test_diffmode.vim + +Patch 7.4.2125 +Problem: Compiler warning for loss of data. +Solution: Add a type cast. (Christian Brabandt) +Files: src/message.c + +Patch 7.4.2126 +Problem: No tests for :diffget and :diffput +Solution: Add tests. +Files: src/testdir/test_diffmode.vim + +Patch 7.4.2127 +Problem: The short form of ":noswapfile" is ":noswap" instead of ":nos". + (Kent Sibilev) +Solution: Only require three characters. Add a test for the short forms. +Files: src/ex_docmd.c, src/testdir/test_usercommands.vim + +Patch 7.4.2128 +Problem: Memory leak when saving for undo fails. +Solution: Free allocated memory. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 7.4.2129 +Problem: Memory leak when using timer_start(). (Dominique Pelle) +Solution: Don't copy the callback when using a partial. +Files: src/evalfunc.c + +Patch 7.4.2130 +Problem: Pending timers cause false memory leak reports. +Solution: Free all timers on exit. +Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/misc2.c + +Patch 7.4.2131 +Problem: More memory leaks when using partial, e.g. for "exit-cb". +Solution: Don't copy the callback when using a partial. +Files: src/channel.c + +Patch 7.4.2132 +Problem: test_partial has memory leaks reported. +Solution: Add a note about why this happens. +Files: src/testdir/test_partial.vim + +Patch 7.4.2133 (after 7.4.2128) +Problem: Can't build with tiny features. +Solution: Add #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.2134 +Problem: No error for using function() badly. +Solution: Check for passing wrong function name. (Ken Takata) +Files: src/eval.c, src/evalfunc.c, src/proto/userfunc.pro, + src/testdir/test_expr.vim, src/userfunc.c, src/vim.h + +Patch 7.4.2135 +Problem: Various tiny issues. +Solution: Update comments, white space, etc. +Files: src/diff.c, src/digraph.c, src/testdir/test80.in, + src/testdir/test_channel.vim, src/testdir/Makefile, + runtime/menu.vim, src/INSTALLpc.txt, src/xpm/README.txt + +Patch 7.4.2136 +Problem: Closure function fails. +Solution: Don't reset uf_scoped when it points to another funccal. +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2137 +Problem: Using function() with a name will find another function when it is + redefined. +Solution: Add funcref(). Refer to lambda using a partial. Fix several + reference counting issues. +Files: src/vim.h, src/structs.h, src/userfunc.c, src/eval.c, + src/evalfunc.c, src/channel.c, src/proto/eval.pro, + src/proto/userfunc.pro, src/if_mzsch.c, src/regexp.c, src/misc2.c, + src/if_py_both.h, src/testdir/test_expr.vim, runtime/doc/eval.txt + +Patch 7.4.2138 +Problem: Test 86 and 87 fail. +Solution: Call func_ref() also for regular functions. +Files: src/if_py_both.h + +Patch 7.4.2139 +Problem: :delfunction causes illegal memory access. +Solution: Correct logic when deciding to free a function. +Files: src/userfunc.c, src/testdir/test_lambda.vim + +Patch 7.4.2140 +Problem: Tiny build fails. +Solution: Add dummy typedefs. +Files: src/structs.h + +Patch 7.4.2141 +Problem: Coverity reports bogus NULL check. +Solution: When checking for a variable in the funccal scope don't pass the + varname. +Files: src/userfunc.c, src/proto/userfunc.pro, src/eval.c + +Patch 7.4.2142 +Problem: Leaking memory when redefining a function. +Solution: Don't increment the function reference count when it's found by + name. Don't remove the wrong function from the hashtab. More + reference counting fixes. +Files: src/structs.h, src/userfunc.c + +Patch 7.4.2143 +Problem: A funccal is garbage collected while it can still be used. +Solution: Set copyID in all referenced functions. Do not list lambda + functions with ":function". +Files: src/userfunc.c, src/proto/userfunc.pro, src/eval.c, + src/testdir/test_lambda.vim + +Patch 7.4.2144 +Problem: On MS-Windows quickfix does not handle a line with 1023 bytes + ending in CR-LF properly. +Solution: Don't consider CR a line break. (Ken Takata) +Files: src/quickfix.c + +Patch 7.4.2145 +Problem: Win32: Using CreateThread/ExitThread is not safe. +Solution: Use _beginthreadex and return from the thread. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.2146 +Problem: Not enough testing for popup menu. CTRL-E does not always work + properly. +Solution: Add more tests. When using CTRL-E check if the popup menu is + visible. (Christian Brabandt) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2147 (after 7.4.2146) +Problem: test_alot fails. +Solution: Close window. +Files: src/testdir/test_popup.vim + +Patch 7.4.2148 +Problem: Not much testing for cscope. +Solution: Add a test that uses the cscope program. (Christian Brabandt) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2149 +Problem: If a test leaves a window open a following test may fail. +Solution: Always close extra windows after running a test. +Files: src/testdir/runtest.vim, src/testdir/test_popup.vim + +Patch 7.4.2150 +Problem: Warning with MinGW 64. (John Marriott) +Solution: Change return type. (Ken Takata) +Files: src/os_win32.c + +Patch 7.4.2151 +Problem: Quickfix test fails on MS-Windows. +Solution: Close the help window. (Christian Brabandt) +Files: src/testdir/test_quickfix.vim + +Patch 7.4.2152 +Problem: No proper translation of messages with a count. +Solution: Use ngettext(). (Sergey Alyoshin) +Files: src/evalfunc.c, src/fold.c, src/os_win32.c, src/screen.c, src/vim.h + +Patch 7.4.2153 +Problem: GUI test isn't testing much. +Solution: Turn into a new style test. Execute a shell command. +Files: src/testdir/test_gui.vim, src/testdir/test16.in, + src/testdir/test16.ok, src/testdir/Make_all.mak, src/Makefile, + src/testdir/Make_vms.mms + +Patch 7.4.2154 +Problem: Test_communicate() fails sometimes. +Solution: Add it to the flaky tests. +Files: src/testdir/runtest.vim + +Patch 7.4.2155 +Problem: Quotes make GUI test fail on MS-Windows. +Solution: Remove quotes, strip white space. +Files: src/testdir/test_gui.vim + +Patch 7.4.2156 +Problem: Compiler warning. +Solution: Add type cast. (Ken Takata, Mike Williams) +Files: src/os_win32.c + +Patch 7.4.2157 +Problem: Test_job_start_fails() is expected to report memory leaks, making + it hard to see other leaks in test_partial. +Solution: Move Test_job_start_fails() to a separate test file. +Files: src/testdir/test_partial.vim, src/testdir/test_job_fails.vim, + src/Makefile, src/testdir/Make_all.mak + +Patch 7.4.2158 +Problem: Result of getcompletion('', 'cscope') depends on previous + completion. (Christian Brabandt) +Solution: Call set_context_in_cscope_cmd(). +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2159 +Problem: Insufficient testing for cscope. +Solution: Add more tests. (Dominique Pelle) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2160 +Problem: setmatches() mixes up values. (Nikolai Pavlov) +Solution: Save the string instead of reusing a shared buffer. +Files: src/dict.c, src/evalfunc.c, src/testdir/test_expr.vim, + +Patch 7.4.2161 (after 7.4.2160) +Problem: Expression test fails without conceal feature. +Solution: Only check "conceal" with the conceal feature. +Files: src/testdir/test_expr.vim + +Patch 7.4.2162 +Problem: Result of getcompletion('', 'sign') depends on previous + completion. +Solution: Call set_context_in_sign_cmd(). (Dominique Pelle) +Files: src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2163 +Problem: match() and related functions tested with old style test. +Solution: Convert to new style test. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test63.in, + src/testdir/test63.ok, src/testdir/test_alot.vim, + src/testdir/test_match.vim, src/testdir/test_matchstrpos.vim + +Patch 7.4.2164 +Problem: It is not possible to use plugins in an "after" directory to tune + the behavior of a package. +Solution: First load plugins from non-after directories, then packages and + finally plugins in after directories. + Reset 'loadplugins' before executing --cmd arguments. +Files: src/main.c, src/vim.h, src/ex_cmds2.c, src/testdir/Makefile, + src/testdir/shared.vim, src/testdir/test_startup.vim, + src/testdir/setup.vim, runtime/doc/starting.txt + +Patch 7.4.2165 (after 7.4.2164) +Problem: Startup test fails on MS-Windows. +Solution: Don't check output if RunVim() returns zero. +Files: src/testdir/test_startup.vim + +Patch 7.4.2166 (after 7.4.2164) +Problem: Small build can't run startup test. +Solution: Skip the test. +Files: src/testdir/test_startup.vim + +Patch 7.4.2167 (after 7.4.2164) +Problem: Small build can't run tests. +Solution: Don't try setting 'packpath'. +Files: src/testdir/setup.vim + +Patch 7.4.2168 +Problem: Not running the startup test on MS-Windows. +Solution: Write vimcmd. +Files: src/testdir/Make_ming.mak, src/testdir/Make_dos.mak + +Patch 7.4.2169 (after 7.4.2168) +Problem: Startup test gets stuck on MS-Windows. +Solution: Use double quotes. +Files: src/testdir/shared.vim, src/testdir/test_startup.vim + +Patch 7.4.2170 +Problem: Cannot get information about timers. +Solution: Add timer_info(). +Files: src/evalfunc.c, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + runtime/doc/eval.txt + +Patch 7.4.2171 (after 7.4.2170) +Problem: MS-Windows build fails. +Solution: Add QueryPerformanceCounter(). +Files: src/ex_cmds2.c + +Patch 7.4.2172 +Problem: No test for "vim --help". +Solution: Add a test. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2173 (after 7.4.2172) +Problem: Can't test help on MS-Windows. +Solution: Skip the test. +Files: src/testdir/test_startup.vim + +Patch 7.4.2174 +Problem: Adding duplicate flags to 'whichwrap' leaves commas behind. +Solution: Also remove the commas. (Naruhiko Nishino) +Files: src/Makefile, src/option.c, src/testdir/Make_all.mak, + src/testdir/test_alot.vim, src/testdir/test_options.in, + src/testdir/test_options.ok, src/testdir/test_options.vim + +Patch 7.4.2175 +Problem: Insufficient testing of cscope. +Solution: Add more tests. (Dominique Pelle) +Files: src/testdir/test_cscope.vim + +Patch 7.4.2176 +Problem: #ifdefs in main() are complicated. +Solution: Always define vim_main2(). Move params to the file level. + (suggested by Ken Takata) +Files: src/main.c, src/structs.h, src/vim.h, src/if_mzsch.c, + src/proto/if_mzsch.pro + +Patch 7.4.2177 +Problem: No testing for -C and -N command line flags, file arguments, + startuptime. +Solution: Add tests. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2178 +Problem: No test for reading from stdin. +Solution: Add a test. +Files: src/testdir/test_startup.vim, src/testdir/shared.vim + +Patch 7.4.2179 (after 7.4.2178) +Problem: Reading from stdin test fails on MS-Windows. +Solution: Strip the extra space. +Files: src/testdir/test_startup.vim + +Patch 7.4.2180 +Problem: There is no easy way to stop all timers. There is no way to + temporary pause a timer. +Solution: Add timer_stopall() and timer_pause(). +Files: src/evalfunc.c, src/ex_cmds2.c, src/proto/ex_cmds2.pro, + src/structs.h, src/testdir/test_timers.vim, + src/testdir/shared.vim, runtime/doc/eval.txt + +Patch 7.4.2181 +Problem: Compiler warning for unused variable. +Solution: Remove it. (Dominique Pelle) +Files: src/ex_cmds2.c + +Patch 7.4.2182 +Problem: Color Grey40 used in startup but not in the short list. +Solution: Add Grey40 to the builtin colors. +Files: src/term.c + +Patch 7.4.2183 +Problem: Sign tests are old style. +Solution: Turn them into new style tests. (Dominique Pelle) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_signs.in, + src/testdir/test_signs.ok, src/testdir/test_signs.vim, + +Patch 7.4.2184 +Problem: Tests that use RunVim() do not actually perform the test. +Solution: Use "return" instead of "call". (Ken Takata) +Files: src/testdir/shared.vim + +Patch 7.4.2185 +Problem: Test glob2regpat does not test much. +Solution: Add a few more test cases. (Dominique Pelle) +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2186 +Problem: Timers test is flaky. +Solution: Relax the sleep time check. +Files: src/testdir/test_timers.vim + +Patch 7.4.2187 (after 7.4.2185) +Problem: glob2regpat test fails on Windows. +Solution: Remove the checks that use backslashes. +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2188 (after 7.4.2146) +Problem: Completion does not work properly with some plugins. +Solution: Revert the part related to typing CTRL-E. (closes #972) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 7.4.2189 +Problem: Cannot detect encoding in a fifo. +Solution: Extend the stdin way of detecting encoding to fifo. Add a test + for detecting encoding on stdin and fifo. (Ken Takata) +Files: src/buffer.c, src/fileio.c, src/Makefile, + src/testdir/Make_all.mak, src/testdir/test_startup_utf8.vim, + src/vim.h + +Patch 7.4.2190 +Problem: When startup test fails it's not easy to find out why. + GUI test fails with Gnome. +Solution: Add the help entry matches to a list an assert that. + Set $HOME for Gnome to create .gnome2 directory. +Files: src/testdir/test_startup.vim, src/testdir/test_gui.vim + +Patch 7.4.2191 +Problem: No automatic prototype for vim_main2(). +Solution: Move the #endif. (Ken Takata) +Files: src/main.c, src/vim.h, src/proto/main.pro + +Patch 7.4.2192 +Problem: Generating prototypes with Cygwin doesn't work well. +Solution: Change #ifdefs. (Ken Takata) +Files: src/gui.h, src/gui_w32.c, src/ops.c, src/proto/fileio.pro, + src/proto/message.pro, src/proto/normal.pro, src/proto/ops.pro, + src/vim.h + +Patch 7.4.2193 +Problem: With Gnome when the GUI can't start test_startup hangs. +Solution: Call gui_mch_early_init_check(). (Hirohito Higashi) +Files: src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro + +Patch 7.4.2194 +Problem: Sign tests don't cover enough. +Solution: Add more test cases. (Dominique Pelle) +Files: src/testdir/test_signs.vim + +Patch 7.4.2195 +Problem: MS-Windows: The vimrun program does not support Unicode. +Solution: Use GetCommandLineW(). Cleanup old #ifdefs. (Ken Takata) +Files: src/vimrun.c + +Patch 7.4.2196 +Problem: glob2regpat test doesn't test everything on MS-Windows. +Solution: Add patterns with backslash handling. +Files: src/testdir/test_glob2regpat.vim + +Patch 7.4.2197 +Problem: All functions are freed on exit, which may hide leaks. +Solution: Only free named functions, not reference counted ones. +Files: src/userfunc.c + +Patch 7.4.2198 +Problem: Test alot sometimes fails under valgrind. (Dominique Pelle) +Solution: Avoid passing a callback with the wrong number of arguments. +Files: src/testdir/test_partial.vim + +Patch 7.4.2199 +Problem: In the GUI the cursor is hidden when redrawing any window, + causing flicker. +Solution: Only undraw the cursor when updating the window it's in. +Files: src/screen.c, src/gui.c, src/proto/gui.pro, src/gui_gtk_x11.c + +Patch 7.4.2200 +Problem: Cannot get all information about a quickfix list. +Solution: Add an optional argument to get/set loc/qf list(). (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/proto/quickfix.pro, + src/quickfix.c, src/tag.c, src/testdir/test_quickfix.vim + +Patch 7.4.2201 +Problem: The sign column disappears when the last sign is deleted. +Solution: Add the 'signcolumn' option. (Christian Brabandt) +Files: runtime/doc/options.txt, runtime/optwin.vim, src/edit.c, + src/move.c, src/option.c, src/option.h, src/proto/option.pro, + src/screen.c, src/structs.h, src/testdir/test_options.vim + +Patch 7.4.2202 +Problem: Build fails with small features. +Solution: Correct option initialization. +Files: src/option.c + +Patch 7.4.2203 +Problem: Test fails with normal features. +Solution: Check is signs are supported. +Files: src/testdir/test_options.vim + +Patch 7.4.2204 +Problem: It is not easy to get information about buffers, windows and + tabpages. +Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/dict.c, + src/evalfunc.c, src/option.c, src/proto/dict.pro, + src/proto/option.pro, src/proto/window.pro, + src/testdir/Make_all.mak, src/testdir/test_bufwintabinfo.vim, + src/window.c, src/Makefile + +Patch 7.4.2205 +Problem: 'wildignore' always applies to getcompletion(). +Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_cmdline.vim + +Patch 7.4.2206 +Problem: Warning for unused function. +Solution: Put the function inside #ifdef. (John Marriott) +Files: src/evalfunc.c + +Patch 7.4.2207 +Problem: The +xpm feature is not sorted properly in :version output. +Solution: Move it up. (Tony Mechelynck) +Files: src/version.c + +Patch 7.4.2208 +Problem: Test for mappings is old style. +Solution: Convert the test to new style. +Files: src/testdir/test_mapping.vim, src/testdir/test_mapping.in, + src/testdir/test_mapping.ok, src/Makefile, + src/testdir/test_alot.vim, src/testdir/Make_all.mak + +Patch 7.4.2209 +Problem: Cannot map <M-">. (Stephen Riehm) +Solution: Solve the memory access problem in another way. (Dominique Pelle) + Allow for using <M-\"> in a string. +Files: src/eval.c, src/gui_mac.c, src/misc2.c, src/option.c, + src/proto/misc2.pro, src/syntax.c, src/term.c, + src/testdir/test_mapping.vim + +Patch 7.4.2210 +Problem: On OSX configure mixes up a Python framework and the Unix layout. +Solution: Make configure check properly. (Tim D. Smith, closes #980) +Files: src/configure.in, src/auto/configure + +Patch 7.4.2211 +Problem: Mouse support is not automatically enabled with simple term. +Solution: Recognize "st" and other names. (Manuel Schiller, closes #963) +Files: src/os_unix.c + +Patch 7.4.2212 +Problem: Mark " is not set when closing a window in another tab. (Guraga) +Solution: Check all tabs for the window to be valid. (based on patch by + Hirohito Higashi, closes #974) +Files: src/window.c, src/proto/window.pro, src/buffer.c, + src/testdir/test_viminfo.vim + +Patch 7.4.2213 +Problem: Cannot highlight the "~" lines at the end of a window differently. +Solution: Add the EndOfBuffer highlighting. (Marco Hinz, James McCoy) +Files: runtime/doc/options.txt, runtime/doc/syntax.txt, src/option.c, + src/screen.c, src/syntax.c, src/vim.h + +Patch 7.4.2214 +Problem: A font that uses ligatures messes up the screen display. +Solution: Put spaces between characters when building the glyph table. + (based on a patch from Manuel Schiller) +Files: src/gui_gtk_x11.c + +Patch 7.4.2215 +Problem: It's not easy to find out if a window is a quickfix or location + list window. +Solution: Add "loclist" and "quickfix" entries to the dict returned by + getwininfo(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2216 (after 7.4.2215) +Problem: Test fails without the +sign feature. +Solution: Only check for signcolumn with the +sign feature. +Files: src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2217 +Problem: When using matchaddpos() a character after the end of the line can + be highlighted. +Solution: Only highlight existing characters. (Hirohito Higashi) +Files: src/screen.c, src/structs.h, src/testdir/test_match.vim + +Patch 7.4.2218 +Problem: Can't build with +timers when +digraph is not included. +Solution: Change #ifdef for e_number_exp. (Damien) +Files: src/globals.h + +Patch 7.4.2219 +Problem: Recursive call to substitute gets stuck in sandbox. (Nikolai + Pavlov) +Solution: Handle the recursive call. (Christian Brabandt, closes #950) + Add a test. +Files: src/ex_cmds.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2220 +Problem: printf() gives an error when the argument for %s is not a string. + (Ozaki Kiichi) +Solution: Behave like invoking string() on the argument. (Ken Takata) +Files: runtime/doc/eval.txt, src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2221 +Problem: printf() does not support binary format. +Solution: Add %b and %B. (Ozaki Kiichi) +Files: runtime/doc/eval.txt, src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2222 +Problem: Sourcing a script where a character has 0x80 as a second byte does + not work. (Filipe L B Correia) +Solution: Turn 0x80 into K_SPECIAL KS_SPECIAL KE_FILLER. (Christian + Brabandt, closes #728) Add a test case. +Files: src/getchar.c, src/proto/getchar.pro, src/misc1.c, + src/testdir/test_regexp_utf8.vim + +Patch 7.4.2223 +Problem: Buffer overflow when using latin1 character with feedkeys(). +Solution: Check for an illegal character. Add a test. +Files: src/testdir/test_regexp_utf8.vim, src/testdir/test_source_utf8.vim, + src/testdir/test_alot_utf8.vim, src/Makefile, src/getchar.c, + src/macros.h, src/evalfunc.c, src/os_unix.c, src/os_win32.c, + src/spell.c, + +Patch 7.4.2224 +Problem: Compiler warnings with older compiler and 64 bit numbers. +Solution: Add "LL" to large values. (Mike Williams) +Files: src/eval.c, src/evalfunc.c + +Patch 7.4.2225 +Problem: Crash when placing a sign in a deleted buffer. +Solution: Check for missing buffer name. (Dominique Pelle). Add a test. +Files: src/ex_cmds.c, src/testdir/test_signs.vim + +Patch 7.4.2226 +Problem: The field names used by getbufinfo(), gettabinfo() and + getwininfo() are not consistent. +Solution: Use bufnr, winnr and tabnr. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_bufwintabinfo.vim + +Patch 7.4.2227 +Problem: Tab page tests are old style. +Solution: Change into new style tests. (Hirohito Higashi) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test62.in, + src/testdir/test62.ok, src/testdir/test_alot.vim, + src/testdir/test_tabpage.vim + +Patch 7.4.2228 +Problem: Test files have inconsistent modelines. +Solution: Don't set 'tabstop' to 2, use 'sts' and 'sw'. +Files: src/testdir/README.txt, src/testdir/test_backspace_opt.vim, + src/testdir/test_digraph.vim, src/testdir/test_gn.vim + src/testdir/test_help_tagjump.vim, + src/testdir/test_increment_dbcs.vim, + src/testdir/test_increment.vim, src/testdir/test_match.vim, + src/testdir/test_tagjump.vim, src/testdir/test_window_cmd.vim, + src/testdir/test_regexp_latin.vim, src/testdir/test_timers.vim + +Patch 7.4.2229 +Problem: Startup test fails on Solaris. +Solution: Recognize a character device. (Danek Duvall) +Files: src/buffer.c, src/fileio.c, src/proto/fileio.pro, src/vim.h + +Patch 7.4.2230 +Problem: There is no equivalent of 'smartcase' for a tag search. +Solution: Add value "followscs" and "smart" to 'tagcase'. (Christian + Brabandt, closes #712) Turn tagcase test into new style. +Files: runtime/doc/options.txt, runtime/doc/tagsrch.txt, src/option.h, + src/tag.c, src/search.c, src/proto/search.pro, + src/testdir/test_tagcase.in, src/testdir/test_tagcase.ok, + src/testdir/test_tagcase.vim, src/Makefile, + src/testdir/Make_all.mak, src/testdir/test_alot.vim + +Patch 7.4.2231 +Problem: ":oldfiles" output is a very long list. +Solution: Add a pattern argument. (Coot, closes #575) +Files: runtime/doc/starting.txt, src/ex_cmds.h, src/eval.c, + src/ex_cmds.c, src/proto/eval.pro, src/proto/ex_cmds.pro, + src/testdir/test_viminfo.vim + +Patch 7.4.2232 +Problem: The default ttimeoutlen is very long. +Solution: Use "100". (Hirohito Higashi) +Files: runtime/defaults.vim + +Patch 7.4.2233 +Problem: Crash when using funcref() with invalid name. (Dominique Pelle) +Solution: Check for NULL translated name. +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2234 +Problem: Can't build with +eval but without +quickfix. (John Marriott) +Solution: Move skip_vimgrep_pat() to separate #ifdef block. +Files: src/quickfix.c + +Patch 7.4.2235 +Problem: submatch() does not check for a valid argument. +Solution: Give an error if the argument is out of range. (Dominique Pelle) +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2236 +Problem: The 'langnoremap' option leads to double negatives. And it does + not work for the last character of a mapping. +Solution: Add 'langremap' with the opposite value. Keep 'langnoremap' for + backwards compatibility. Make it work for the last character of a + mapping. Make the test work. +Files: runtime/doc/options.txt, runtime/defaults.vim, src/option.c, + src/option.h, src/macros.h, src/testdir/test_mapping.vim + +Patch 7.4.2237 +Problem: Can't use "." and "$" with ":tab". +Solution: Support a range for ":tab". (Hirohito Higashi) +Files: runtime/doc/tabpage.txt, src/ex_docmd.c, + src/testdir/test_tabpage.vim + +Patch 7.4.2238 +Problem: With SGR mouse reporting (suckless terminal) the mouse release and + scroll up/down is confused. +Solution: Don't see a release as a scroll up/down. (Ralph Eastwood) +Files: src/term.c + +Patch 7.4.2239 +Problem: Warning for missing declaration of skip_vimgrep_pat(). (John + Marriott) +Solution: Move it to another file. +Files: src/quickfix.c, src/proto/quickfix.pro, src/ex_cmds.c, + src/proto/ex_cmds.pro + +Patch 7.4.2240 +Problem: Tests using the sleep time can be flaky. +Solution: Use reltime() if available. (Partly by Shane Harper) +Files: src/testdir/shared.vim, src/testdir/test_timers.vim + +Patch 7.4.2241 (after 7.4.2240) +Problem: Timer test sometimes fails. +Solution: Increase the maximum time for repeating timer. +Files: src/testdir/test_timers.vim + +Patch 7.4.2242 (after 7.4.2240) +Problem: Timer test sometimes fails. +Solution: Increase the maximum time for callback timer test. +Files: src/testdir/test_timers.vim + +Patch 7.4.2243 +Problem: Warning for assigning negative value to unsigned. (Danek Duvall) +Solution: Make cterm_normal_fg_gui_color and _bg_ guicolor_T, cast to long_u + only when an unsigned is needed. +Files: src/structs.h, src/globals.h, src/screen.c, src/term.c, + src/syntax.c, src/gui_gtk_x11.c, src/gui.c, src/gui_mac.c, + src/gui_photon.c, src/gui_w32.c, src/gui_x11.c, + src/proto/term.pro, src/proto/gui_gtk_x11.pro, + src/proto/gui_mac.pro, src/proto/gui_photon.pro, + src/proto/gui_w32.pro, src/proto/gui_x11.pro + +Patch 7.4.2244 +Problem: Adding pattern to ":oldfiles" is not a generic solution. +Solution: Add the ":filter /pat/ cmd" command modifier. Only works for some + commands right now. +Files: src/structs.h, src/ex_docmd.c, src/ex_cmds.h, src/message.c, + src/proto/message.pro, runtime/doc/starting.txt, + runtime/doc/various.txt, src/testdir/test_viminfo.vim, + src/testdir/test_alot.vim, src/testdir/test_filter_cmd.vim, + src/Makefile + +Patch 7.4.2245 (after 7.4.2244) +Problem: Filter test fails. +Solution: Include missing changes. +Files: src/buffer.c + +Patch 7.4.2246 (after 7.4.2244) +Problem: Oldfiles test fails. +Solution: Include missing changes. +Files: src/ex_cmds.c + +Patch 7.4.2247 (after 7.4.2244) +Problem: Tiny build fails. (Tony Mechelynck) +Solution: Remove #ifdef. +Files: src/ex_cmds.c + +Patch 7.4.2248 +Problem: When cancelling the :ptjump prompt a preview window is opened for + a following command. +Solution: Reset g_do_tagpreview. (Hirohito Higashi) Add a test. Avoid that + the test runner gets stuck in trying to close a window. +Files: src/tag.c, src/testdir/test_tagjump.vim, src/testdir/runtest.vim + +Patch 7.4.2249 +Problem: Missing colon in error message. +Solution: Add the colon. (Dominique Pelle) +Files: src/userfunc.c + +Patch 7.4.2250 +Problem: Some error messages cannot be translated. +Solution: Enclose them in _() and N_(). (Dominique Pelle) +Files: src/channel.c, src/evalfunc.c, src/ex_cmds.c, src/spell.c, + src/window.c + +Patch 7.4.2251 +Problem: In rare cases diffing 4 buffers is not enough. +Solution: Raise the limit to 8. (closes #1000) +Files: src/structs.h, runtime/doc/diff.txt + +Patch 7.4.2252 +Problem: Compiler warnings for signed/unsigned in expression. +Solution: Remove type cast. (Dominique Pelle) +Files: src/vim.h + +Patch 7.4.2253 +Problem: Check for Windows 3.1 will always return false. (Christian + Brabandt) +Solution: Remove the dead code. +Files: src/gui_w32.c, src/evalfunc.c, src/ex_cmds.c, src/option.c, + src/os_win32.c, src/version.c, src/proto/gui_w32.pro + +Patch 7.4.2254 +Problem: Compiler warnings in MzScheme code. +Solution: Add UNUSED. Remove unreachable code. +Files: src/if_mzsch.c + +Patch 7.4.2255 +Problem: The script that checks translations can't handle plurals. +Solution: Check for plural msgid and msgstr entries. Leave the cursor on + the first error. +Files: src/po/check.vim + +Patch 7.4.2256 +Problem: Coverity complains about null pointer check. +Solution: Remove wrong and superfluous error check. +Files: src/eval.c + +Patch 7.4.2257 +Problem: Coverity complains about not checking for NULL. +Solution: Check for out of memory. +Files: src/if_py_both.h + +Patch 7.4.2258 +Problem: Two JSON messages are sent without a separator. +Solution: Separate messages with a NL. (closes #1001) +Files: src/json.c, src/channel.c, src/vim.h, src/testdir/test_channel.py, + src/testdir/test_channel.vim, runtime/doc/channel.txt + +Patch 7.4.2259 +Problem: With 'incsearch' can only see the next match. +Solution: Make CTRL-N/CTRL-P move to the previous/next match. (Christian + Brabandt) +Files: runtime/doc/cmdline.txt, src/ex_getln.c, src/testdir/Make_all.mak, + src/testdir/test_search.vim, src/Makefile + +Patch 7.4.2260 (after 7.4.2258) +Problem: Channel test is flaky. +Solution: Add a newline to separate JSON messages. +Files: src/testdir/test_channel.vim + +Patch 7.4.2261 (after 7.4.2259) +Problem: Build fails with small features. +Solution: Move "else" inside the #ifdef. +Files: src/ex_getln.c + +Patch 7.4.2262 +Problem: Fail to read register content from viminfo if it is 438 characters + long. (John Chen) +Solution: Adjust the check for line wrapping. (closes #1010) +Files: src/testdir/test_viminfo.vim, src/ex_cmds.c + +Patch 7.4.2263 +Problem: :filter does not work for many commands. Can only get matching + messages. +Solution: Make :filter work for :command, :map, :list, :number and :print. + Make ":filter!" show non-matching lines. +Files: src/getchar.c, src/ex_cmds.c, src/ex_cmds.h, src/ex_docmd.c, + src/message.c, src/structs.h, src/testdir/test_filter_cmd.vim + +Patch 7.4.2264 +Problem: When adding entries to an empty quickfix list the title is reset. +Solution: Improve handling of the title. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim, src/quickfix.c + +Patch 7.4.2265 +Problem: printf() isn't tested much. +Solution: Add more tests for printf(). (Dominique Pelle) +Files: src/testdir/test_expr.vim + +Patch 7.4.2266 (after 7.4.2265) +Problem: printf() test fails on Windows. "-inf" is not used. +Solution: Check for Windows-specific values for "nan". Add sign to "inf" + when appropriate. +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2267 (after 7.4.2266) +Problem: Build fails on MS-Windows. +Solution: Add define to get isinf(). +Files: src/message.c + +Patch 7.4.2268 (after 7.4.2259) +Problem: Using CTRL-N and CTRL-P for incsearch shadows completion keys. +Solution: Use CTRL-T and CTRL-G instead. +Files: runtime/doc/cmdline.txt, src/ex_getln.c, + src/testdir/test_search.vim + +Patch 7.4.2269 +Problem: Using 'hlsearch' highlighting instead of matchpos if there is no + search match. +Solution: Pass NULL as last item to next_search_hl() when searching for + 'hlsearch' match. (Shane Harper, closes #1013) +Files: src/screen.c, src/testdir/test_match.vim. + +Patch 7.4.2270 +Problem: Insufficient testing for NUL bytes on a raw channel. +Solution: Add a test for writing and reading. +Files: src/testdir/test_channel.vim + +Patch 7.4.2271 +Problem: Netbeans test doesn't read settings from file. +Solution: Use "-Xnbauth". +Files: src/testdir/test_netbeans.vim + +Patch 7.4.2272 +Problem: getbufinfo(), getwininfo() and gettabinfo() are inefficient. +Solution: Instead of making a copy of the variables dictionary, use a + reference. +Files: src/evalfunc.c + +Patch 7.4.2273 +Problem: getwininfo() and getbufinfo() are inefficient. +Solution: Do not make a copy of all window/buffer-local options. Make it + possible to get them with gettabwinvar() or getbufvar(). +Files: src/evalfunc.c, src/eval.c, src/testdir/test_bufwintabinfo.vim, + runtime/doc/eval.txt + +Patch 7.4.2274 +Problem: Command line completion on "find **/filename" drops sub-directory. +Solution: Handle this case separately. (Harm te Hennepe, closes #932, closes + #939) +Files: src/misc1.c, src/testdir/test_cmdline.vim + +Patch 7.4.2275 +Problem: ":diffoff!" does not remove filler lines. +Solution: Force a redraw and invalidate the cursor. (closes #1014) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 7.4.2276 +Problem: Command line test fails on Windows when run twice. +Solution: Wipe the buffer so that the directory can be deleted. +Files: src/testdir/test_cmdline.vim + +Patch 7.4.2277 +Problem: Memory leak in getbufinfo() when there is a sign. (Dominique + Pelle) +Solution: Remove extra vim_strsave(). +Files: src/evalfunc.c + +Patch 7.4.2278 +Problem: New users have no idea of the 'scrolloff' option. +Solution: Set 'scrolloff' in defaults.vim. +Files: runtime/defaults.vim + +Patch 7.4.2279 +Problem: Starting diff mode with the cursor in the last line might end up + only showing one closed fold. (John Beckett) +Solution: Scroll the window to show the same relative cursor position. +Files: src/diff.c, src/window.c, src/proto/window.pro + +Patch 7.4.2280 +Problem: printf() doesn't handle infinity float values correctly. +Solution: Add a table with possible infinity values. (Dominique Pelle) +Files: src/message.c, src/testdir/test_expr.vim + +Patch 7.4.2281 +Problem: Timer test fails sometimes. +Solution: Reduce minimum time by 1 msec. +Files: src/testdir/test_timers.vim + +Patch 7.4.2282 +Problem: When a child process is very fast waiting 10 msec for it is + noticeable. (Ramel Eshed) +Solution: Start waiting for 1 msec and gradually increase. +Files: src/os_unix.c + +Patch 7.4.2283 +Problem: Part of ":oldfiles" command isn't cleared. (Lifepillar) +Solution: Clear the rest of the line. (closes 1018) +Files: src/ex_cmds.c + +Patch 7.4.2284 +Problem: Comment in scope header file is outdated. (KillTheMule) +Solution: Point to the help instead. (closes #1017) +Files: src/if_cscope.h + +Patch 7.4.2285 +Problem: Generated files are outdated. +Solution: Generate the files. Avoid errors when generating prototypes. +Files: src/if_mzsch.h, src/Makefile, src/option.h, src/os_mac_conv.c, + src/os_amiga.c, src/vim.h, src/structs.h, src/os_win32.c, + src/if_lua.c, src/proto/mbyte.pro + +Patch 7.4.2286 +Problem: The tee program isn't included. Makefile contains build + instructions that don't work. +Solution: Update the Filelist and build instructions. Remove build + instructions for DOS and old Windows. Add the tee program. +Files: Filelist, Makefile, nsis/gvim.nsi + +Patch 7.4.2287 +Problem: The callback passed to ch_sendraw() is not used. +Solution: Pass the read part, not the send part. (haya14busa, closes #1019) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.2288 +Problem: MS-Windows build instructions are clumsy. "dosbin" doesn't build. +Solution: Add rename.bat. Fix building "dosbin". +Files: Makefile, Filelist, rename.bat + +Patch 7.4.2289 +Problem: When installing and $DESTDIR is set the icons probably won't be + installed. +Solution: Create the icon directories if $DESTDIR is not empty. (Danek + Duvall) +Files: src/Makefile + +Patch 7.4.2290 +Problem: Compiler warning in tiny build. (Tony Mechelynck) +Solution: Add #ifdef around infinity_str(). +Files: src/message.c + +Patch 7.4.2291 +Problem: printf() handles floats wrong when there is a sign. +Solution: Fix placing the sign. Add tests. (Dominique Pelle) +Files: src/testdir/test_expr.vim, runtime/doc/eval.txt, src/message.c + +Patch 7.4.2292 (after 7.4.2291) +Problem: Not all systems understand %F in printf(). +Solution: Use %f. +Files: src/message.c + +Patch 7.4.2293 +Problem: Modelines in source code are inconsistent. +Solution: Use the same line in most files. Add 'noet'. (Naruhiko Nishino) +Files: src/alloc.h, src/arabic.c, src/arabic.h, src/ascii.h, + src/blowfish.c, src/buffer.c, src/channel.c, src/charset.c, + src/crypt.c, src/crypt_zip.c, src/dict.c, src/diff.c, + src/digraph.c, src/dosinst.c, src/dosinst.h, src/edit.c, + src/eval.c, src/evalfunc.c, src/ex_cmds.c, src/ex_cmds.h, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_eval.c, src/ex_getln.c, + src/farsi.c, src/farsi.h, src/feature.h, src/fileio.c, src/fold.c, + src/getchar.c, src/glbl_ime.cpp, src/glbl_ime.h, src/globals.h, + src/gui.c, src/gui.h, src/gui_at_fs.c, src/gui_at_sb.c, + src/gui_at_sb.h, src/gui_athena.c, src/gui_beval.c, + src/gui_beval.h, src/gui_gtk.c, src/gui_gtk_f.c, src/gui_gtk_f.h, + src/gui_gtk_vms.h, src/gui_gtk_x11.c, src/gui_mac.c, + src/gui_motif.c, src/gui_photon.c, src/gui_w32.c, src/gui_x11.c, + src/gui_x11_pm.h, src/gui_xmdlg.c, src/gui_xmebw.c, + src/gui_xmebw.h, src/gui_xmebwp.h, src/hangulin.c, src/hardcopy.c, + src/hashtab.c, src/if_cscope.c, src/if_cscope.h, src/if_mzsch.c, + src/if_mzsch.h, src/if_ole.cpp, src/if_perl.xs, src/if_perlsfio.c, + src/if_python3.c, src/if_ruby.c, src/if_tcl.c, src/if_xcmdsrv.c, + src/integration.c, src/integration.h, src/iscygpty.c, src/json.c, + src/json_test.c, src/keymap.h, src/list.c, src/macros.h, + src/main.c, src/mark.c, src/mbyte.c, src/memfile.c, + src/memfile_test.c, src/memline.c, src/menu.c, src/message.c, + src/message_test.c, src/misc1.c, src/misc2.c, src/move.c, + src/nbdebug.c, src/nbdebug.h, src/netbeans.c, src/normal.c, + src/ops.c, src/option.c, src/option.h, src/os_amiga.c, + src/os_amiga.h, src/os_beos.c, src/os_beos.h, src/os_dos.h, + src/os_mac.h, src/os_mac_conv.c, src/os_macosx.m, src/os_mint.h, + src/os_mswin.c, src/os_qnx.c, src/os_qnx.h, src/os_unix.c, + src/os_unix.h, src/os_unixx.h, src/os_vms.c, src/os_w32dll.c, + src/os_w32exe.c, src/os_win32.c, src/os_win32.h, src/popupmnu.c, + src/proto.h, src/pty.c, src/quickfix.c, src/regexp.c, + src/regexp.h, src/regexp_nfa.c, src/screen.c, src/search.c, + src/sha256.c, src/spell.c, src/spell.h, src/spellfile.c, + src/structs.h, src/syntax.c, src/tag.c, src/term.c, src/term.h, + src/termlib.c, src/ui.c, src/undo.c, src/uninstal.c, + src/userfunc.c, src/version.c, src/version.h, src/vim.h, + src/vim.rc, src/vimio.h, src/vimrun.c, src/winclip.c, + src/window.c, src/workshop.c, src/workshop.h, src/wsdebug.c, + src/wsdebug.h, src/xpm_w32.c + +Patch 7.4.2294 +Problem: Sign test fails on MS-Windows when using the distributed zip + archives. +Solution: Create dummy files instead of relying on files in the pixmaps + directory. +Files: src/testdir/test_signs.vim + +Patch 7.4.2295 (after 7.4.2293) +Problem: Cscope test fails. +Solution: Avoid checking for specific line and column numbers. +Files: src/testdir/test_cscope.vim + +Patch 7.4.2296 +Problem: No tests for :undolist and "U" command. +Solution: Add tests. (Dominique Pelle) +Files: src/testdir/test_undo.vim + +Patch 7.4.2297 +Problem: When starting a job that reads from a buffer and reaching the end, + the job hangs. +Solution: Close the pipe or socket when all lines were read. +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 7.4.2298 +Problem: It is not possible to close the "in" part of a channel. +Solution: Add ch_close_in(). +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt, + runtime/doc/channel.txt + +Patch 7.4.2299 +Problem: QuickFixCmdPre and QuickFixCmdPost autocommands are not always + triggered. +Solution: Also trigger on ":cexpr", ":cbuffer", etc. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 7.4.2300 +Problem: Get warning for deleting autocommand group when the autocommand + using the group is scheduled for deletion. (Pavol Juhas) +Solution: Check for deleted autocommand. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2301 +Problem: MS-Windows: some files remain after testing. +Solution: Close the channel output file. Wait for the file handle to be + closed before deleting the file. +Files: src/os_win32.c, src/testdir/test_channel.vim + +Patch 7.4.2302 +Problem: Default interface versions for MS-Windows are outdated. +Solution: Use Active Perl 5.24, Python 3.5.2. Could only make it work with + Ruby 1.9.2. +Files: src/bigvim.bat, src/bigvim64.bat, src/Make_mvc.mak + +Patch 7.4.2303 +Problem: When using "is" the mode isn't always updated. +Solution: Redraw the command line. (Christian Brabandt) +Files: src/search.c + +Patch 7.4.2304 +Problem: In a timer callback the timer itself can't be found or stopped. + (Thinca) +Solution: Do not remove the timer from the list, remember whether it was + freed. +Files: src/ex_cmds2.c, src/testdir/test_timers.vim + +Patch 7.4.2305 +Problem: Marks, writefile and nested function tests are old style. +Solution: Turn them into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test_marks.in, + src/testdir/test_marks.ok, src/testdir/test_marks.vim, + src/testdir/test_nested_function.in, + src/testdir/test_nested_function.ok, + src/testdir/test_nested_function.vim, + src/testdir/test_writefile.in, src/testdir/test_writefile.ok, + src/testdir/test_writefile.vim, src/Makefile + +Patch 7.4.2306 +Problem: Default value for 'langremap' is wrong. +Solution: Set the right value. (Jürgen Krämer) Add a test. +Files: src/option.c, src/testdir/test_mapping.vim + +Patch 7.4.2307 +Problem: Several tests are old style. +Solution: Turn them into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test102.in, + src/testdir/test102.ok, src/testdir/test46.in, + src/testdir/test46.ok, src/testdir/test81.in, + src/testdir/test81.ok, src/testdir/test_charsearch.in, + src/testdir/test_charsearch.ok, src/testdir/test_charsearch.vim, + src/testdir/test_fnameescape.vim, src/testdir/test_substitute.vim, + src/Makefile + +Patch 7.4.2308 (after 7.4.2307) +Problem: Old charsearch test still listed in Makefile. +Solution: Remove the line. +Files: src/testdir/Make_all.mak + +Patch 7.4.2309 +Problem: Crash when doing tabnext in a BufUnload autocmd. (Dominique Pelle) +Solution: When detecting that the tab page changed, don't just abort but + delete the window where w_buffer is NULL. +Files: src/window.c, src/testdir/test_tabpage.vim + +Patch 7.4.2310 (after 7.4.2304) +Problem: Accessing freed memory when a timer does not repeat. +Solution: Free after removing it. (Dominique Pelle) +Files: src/ex_cmds2.c + +Patch 7.4.2311 +Problem: Appveyor 64 bit build still using Python 3.4 +Solution: Switch to Python 3.5. (Ken Takata, closes #1032) +Files: appveyor.yml, src/appveyor.bat + +Patch 7.4.2312 +Problem: Crash when autocommand moves to another tab. (Dominique Pelle) +Solution: When navigating to another window halfway the :edit command go + back to the right window. +Files: src/buffer.c, src/ex_cmds.c, src/ex_getln.c, src/ex_docmd.c, + src/window.c, src/proto/ex_getln.pro, src/testdir/test_tabpage.vim + +Patch 7.4.2313 +Problem: Crash when deleting an augroup and listing an autocommand. + (Dominique Pelle) +Solution: Make sure deleted_augroup is valid. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2314 +Problem: No error when deleting an augroup while it's the current one. +Solution: Disallow deleting an augroup when it's the current one. +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 7.4.2315 +Problem: Insufficient testing for Normal mode commands. +Solution: Add a big test. (Christian Brabandt, closes #1029) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_normal.vim + +Patch 7.4.2316 +Problem: Channel sort test is flaky. +Solution: Add a check the output has been read. +Files: src/testdir/test_channel.vim + +Patch 7.4.2317 (after 7.4.2315) +Problem: Normal mode tests fail on MS-Windows. +Solution: Do some tests only on Unix. Set 'fileformat' to "unix". +Files: src/testdir/test_normal.vim + +Patch 7.4.2318 +Problem: When 'incsearch' is not set CTRL-T and CTRL-G are not inserted as + before. +Solution: Move #ifdef and don't use goto. +Files: src/ex_getln.c + +Patch 7.4.2319 +Problem: No way for a system wide vimrc to stop loading defaults.vim. + (Christian Hesse) +Solution: Bail out of defaults.vim if skip_defaults_vim was set. +Files: runtime/defaults.vim + +Patch 7.4.2320 +Problem: Redraw problem when using 'incsearch'. +Solution: Save the current view when deleting characters. (Christian + Brabandt) Fix that the '" mark is set in the wrong position. Don't + change the search start when using BS. +Files: src/ex_getln.c, src/normal.c, src/testdir/test_search.vim + +Patch 7.4.2321 +Problem: When a test is commented out we forget about it. +Solution: Let a test throw an exception with "Skipped" and list skipped test + functions. (Christian Brabandt) +Files: src/testdir/Makefile, src/testdir/runtest.vim, + src/testdir/test_popup.vim, src/testdir/README.txt + +Patch 7.4.2322 +Problem: Access memory beyond the end of the line. (Dominique Pelle) +Solution: Adjust the cursor column. +Files: src/move.c, src/testdir/test_normal.vim + +Patch 7.4.2323 +Problem: Using freed memory when using 'formatexpr'. (Dominique Pelle) +Solution: Make a copy of 'formatexpr' before evaluating it. +Files: src/ops.c, src/testdir/test_normal.vim + +Patch 7.4.2324 +Problem: Crash when editing a new buffer and BufUnload autocommand wipes + out the new buffer. (Norio Takagi) +Solution: Don't allow wiping out this buffer. (partly by Hirohito Higashi) + Move old style test13 into test_autocmd. Avoid ml_get error when + editing a file. +Files: src/structs.h, src/buffer.c, src/ex_cmds.c, src/ex_docmd.c, + src/window.c, src/testdir/test13.in, src/testdir/test13.ok, + src/testdir/test_autocmd.vim, src/testdir/Make_all.mak, + src/Makefile + +Patch 7.4.2325 (after 7.4.2324) +Problem: Tiny build fails. +Solution: Add #ifdef. +Files: src/buffer.c + +Patch 7.4.2326 +Problem: Illegal memory access when Visual selection starts in invalid + position. (Dominique Pelle) +Solution: Correct position when needed. +Files: src/normal.c, src/misc2.c, src/proto/misc2.pro + +Patch 7.4.2327 +Problem: Freeing a variable that is on the stack. +Solution: Don't free res_tv or err_tv. (Ozaki Kiichi) +Files: src/channel.c + +Patch 7.4.2328 +Problem: Crash when BufWinLeave autocmd goes to another tab page. (Hirohito + Higashi) +Solution: Make close_buffer() go back to the right window. +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 7.4.2329 +Problem: Error for min() and max() contains %s. (Nikolai Pavlov) +Solution: Pass the function name. (closes #1040) +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 7.4.2330 +Problem: Coverity complains about not checking curwin to be NULL. +Solution: Use firstwin to avoid the warning. +Files: src/buffer.c + +Patch 7.4.2331 +Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode + does not work after entering an expression on the command line. +Solution: Don't use "ccline" when not actually using a command line. (test + by Hirohito Higashi) +Files: src/edit.c, src/ex_getln.c, src/proto/ex_getln.pro, + src/testdir/test_popup.vim + +Patch 7.4.2332 +Problem: Crash when stop_timer() is called in a callback of a callback. + Vim hangs when the timer callback uses too much time. +Solution: Set tr_id to -1 when a timer is to be deleted. Don't keep calling + callbacks forever. (Ozaki Kiichi) +Files: src/evalfunc.c, src/ex_cmds2.c, src/structs.h, + src/proto/ex_cmds2.pro, src/testdir/test_timers.vim + +Patch 7.4.2333 +Problem: Outdated comments in test. +Solution: Cleanup normal mode test. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2334 +Problem: On MS-Windows test_getcwd leaves Xtopdir behind. +Solution: Set 'noswapfile'. (Michael Soyka) +Files: src/testdir/test_getcwd.in + +Patch 7.4.2335 +Problem: taglist() is slow. (Luc Hermitte) +Solution: Check for CTRL-C less often when doing a linear search. (closes + #1044) +Files: src/tag.c + +Patch 7.4.2336 +Problem: Running normal mode tests leave a couple of files behind. + (Yegappan Lakshmanan) +Solution: Delete the files. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2337 +Problem: taglist() is still slow. (Luc Hermitte) +Solution: Check for CTRL-C less often when finding duplicates. +Files: src/tag.c + +Patch 7.4.2338 +Problem: Can't build with small features. (John Marriott) +Solution: Nearly always define FEAT_TAG_BINS. +Files: src/feature.h, src/tag.c + +Patch 7.4.2339 +Problem: Tab page test fails when run as fake root. +Solution: Check 'buftype' instead of 'filetype'. (James McCoy, closes #1042) +Files: src/testdir/test_tabpage.vim + +Patch 7.4.2340 +Problem: MS-Windows: Building with Ruby uses old version. +Solution: Update to 2.2.X. Use clearer name for the API version. (Ken + Takata) +Files: Makefile, src/INSTALLpc.txt, src/Make_cyg_ming.mak, + src/Make_mvc.mak, src/bigvim.bat + +Patch 7.4.2341 +Problem: Tiny things. Test doesn't clean up properly. +Solution: Adjust comment and white space. Restore option value. +Files: src/ex_cmds.c, src/message.c, src/testdir/test_autocmd.vim + +Patch 7.4.2342 +Problem: Typo in MS-Windows build script. +Solution: change "w2" to "22". +Files: src/bigvim.bat + +Patch 7.4.2343 +Problem: Too many old style tests. +Solution: Turn several into new style tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/test101.in, + src/testdir/test101.ok, src/testdir/test18.in, + src/testdir/test18.ok, src/testdir/test2.in, src/testdir/test2.ok, + src/testdir/test21.in, src/testdir/test21.ok, + src/testdir/test6.in, src/testdir/test6.ok, + src/testdir/test_arglist.vim, src/testdir/test_charsearch.vim, + src/testdir/test_fnameescape.vim, src/testdir/test_gf.vim, + src/testdir/test_hlsearch.vim, src/testdir/test_smartindent.vim, + src/testdir/test_tagjump.vim, src/Makefile + +Patch 7.4.2344 +Problem: The "Reading from channel output..." message can be unwanted. + Appending to a buffer leaves an empty first line behind. +Solution: Add the "out_msg" and "err_msg" options. Writing the first line + overwrites the first, empty line. +Files: src/structs.h, src/channel.c, src/testdir/test_channel.vim, + runtime/doc/channel.txt + +Patch 7.4.2345 (after 7.4.2340) +Problem: For MinGW RUBY_API_VER_LONG isn't set correctly. Many default + version numbers are outdated. +Solution: Set RUBY_API_VER_LONG to RUBY_VER_LONG. Use latest stable releases + for defaults. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 7.4.2346 +Problem: Autocommand test fails when run directly, passes when run as part + of test_alot. +Solution: Add command to make the cursor move. Close a tab page. +Files: src/testdir/test_autocmd.vim + +Patch 7.4.2347 +Problem: Crash when closing a buffer while Visual mode is active. + (Dominique Pelle) +Solution: Adjust the position before computing the number of lines. + When closing the current buffer stop Visual mode. +Files: src/buffer.c, src/normal.c, src/testdir/test_normal.vim + +Patch 7.4.2348 +Problem: Crash on exit when EXITFREE is defined. (Dominique Pelle) +Solution: Don't access curwin when exiting. +Files: src/buffer.c + +Patch 7.4.2349 +Problem: Valgrind reports using uninitialized memory. (Dominique Pelle) +Solution: Check the length before checking for a NUL. +Files: src/message.c + +Patch 7.4.2350 +Problem: Test 86 and 87 fail with some version of Python. +Solution: Unify "can't" and "cannot". Unify quotes. +Files: src/testdir/test86.in, src/testdir/test86.ok, + src/testdir/test87.in, src/testdir/test87.ok + +Patch 7.4.2351 +Problem: Netbeans test fails when run from unpacked MS-Windows sources. +Solution: Open README.txt instead of Makefile. +Files: src/testdir/test_netbeans.py, src/testdir/test_netbeans.vim + +Patch 7.4.2352 +Problem: Netbeans test fails in shadow directory. +Solution: Also copy README.txt to the shadow directory. +Files: src/Makefile + +Patch 7.4.2353 +Problem: Not enough test coverage for Normal mode commands. +Solution: Add more tests. (Christian Brabandt) +Files: src/testdir/test_normal.vim + +Patch 7.4.2354 +Problem: The example that explains nested backreferences does not work + properly with the new regexp engine. (Harm te Hennepe) +Solution: Also save the end position when adding a state. (closes #990) +Files: src/regexp_nfa.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2355 +Problem: Regexp fails to match when using "\>\)\?". (Ramel) +Solution: When a state is already in the list, but addstate_here() is used + and the existing state comes later, add the new state anyway. +Files: src/regexp_nfa.c, src/testdir/test_regexp_latin.vim + +Patch 7.4.2356 +Problem: Reading past end of line when using previous substitute pattern. + (Dominique Pelle) +Solution: Don't set "pat" only set "searchstr". +Files: src/search.c, src/testdir/test_search.vim + +Patch 7.4.2357 +Problem: Attempt to read history entry while not initialized. +Solution: Skip when the index is negative. +Files: src/ex_getln.c + +Patch 7.4.2358 +Problem: Compiler warnings with Solaris Studio when using GTK3. (Danek + Duvall) +Solution: Define FUNC2GENERIC depending on the system. (Kazunobu Kuriyama) +Files: src/gui.h, src/gui_beval.c, src/gui_gtk_f.c + +Patch 7.4.2359 +Problem: Memory leak in timer_start(). +Solution: Check the right field to be NULL. +Files: src/evalfunc.c, src/testdir/test_timers.vim + +Patch 7.4.2360 +Problem: Invalid memory access when formatting. (Dominique Pelle) +Solution: Make sure cursor line and column are associated. +Files: src/misc1.c + +Patch 7.4.2361 +Problem: Checking for last_timer_id to overflow is not reliable. (Ozaki + Kiichi) +Solution: Check for the number not going up. +Files: src/ex_cmds2.c + +Patch 7.4.2362 +Problem: Illegal memory access with ":1@". (Dominique Pelle) +Solution: Correct cursor column after setting the line number. Also avoid + calling end_visual_mode() when not in Visual mode. +Files: src/ex_docmd.c, src/buffer.c + +Patch 7.4.2363 +Problem: Superfluous function prototypes. +Solution: Remove them. +Files: src/regexp.c + +Patch 7.4.2364 +Problem: Sort test sometimes fails. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 7.4.2365 +Problem: Needless line break. Confusing directory name. +Solution: Remove line break. Prepend "../" to "tools". +Files: Makefile, src/normal.c + +Patch 7.4.2366 +Problem: MS-Windows gvim.exe does not have DirectX support. +Solution: Add the DIRECTX to the script. +Files: src/bigvim.bat + +Patch 7.4.2367 (after 7.4.2364) +Problem: Test runner misses a comma. +Solution: Add the comma. +Files: src/testdir/runtest.vim + + +============================================================================== +VERSION 8.1 *version-8.1* *version8.1* *vim-8.1* + +This section is about improvements made between version 8.0 and 8.1. + +This release has hundreds of bug fixes, there is a new feature and there are +many minor improvements. + + +The terminal window *new-terminal-window* +------------------- + +You can now open a window which functions as a terminal. You can use it for: +- Running a command, such as "make", while editing in other windows +- Running a shell and execute several commands +- Use the terminal debugger plugin, see |terminal-debugger| + +All of this is especially useful when running Vim on a remote (ssh) +connection, when you can't easily open more terminals. + +For more information see |terminal-window|. + + +Changed *changed-8.1* +------- + +Internal: A few C99 features are now allowed such as // comments and a +comma after the last enum entry. See |style-compiler|. + +Since patch 8.0.0029 removed support for older MS-Windows systems, only +MS-Windows XP and later are supported. + + +Added *added-8.1* +----- + +Various syntax, indent and other plugins were added. + +Quickfix improvements (by Yegappan Lakshmanan): + Added support for modifying any quickfix/location list in the quickfix + stack. + Added a unique identifier for every quickfix/location list. + Added support for associating any Vim type as a context information to + a quickfix/location list. + Enhanced the getqflist(), getloclist(), setqflist() and setloclist() + functions to get and set the various quickfix/location list attributes. + Added the QuickFixLine highlight group to highlight the current line + in the quickfix window. + The quickfix buffer b:changedtick variable is incremented for every + change to the contained quickfix list. + Added a changedtick variable to a quickfix/location list which is + incremented when the list is modified. + Added support for parsing text using 'errorformat' without creating a + new quickfix list. + Added support for the "module" item to a quickfix entry which can be + used for display purposes instead of a long file name. + Added support for freeing all the lists in the quickfix/location stack. + When opening a quickfix window using the :copen/:cwindow commands, the + supplied split modifiers are used. + +Functions: + All the term_ functions. + + |assert_beeps()| + |assert_equalfile()| + |assert_report()| + |balloon_show()| + |balloon_split()| + |ch_canread()| + |getchangelist()| + |getjumplist()| + |getwinpos()| + |pyxeval()| + |remote_startserver()| + |setbufline()| + |test_ignore_error()| + |test_override()| + |trim()| + |win_screenpos()| + +Autocommands: + |CmdlineChanged| + |CmdlineEnter| + |CmdlineLeave| + |ColorSchemePre| + |DirChanged| + |ExitPre| + |TerminalOpen| + |TextChangedP| + |TextYankPost| + +Commands: + |:pyx| + |:pythonx| + |:pyxdo| + |:pyxfile| + |:terminal| + |:tmapclear| + |:tmap| + |:tnoremap| + |:tunmap| + +Options: + 'balloonevalterm' + 'imstyle' + 'mzschemedll' + 'mzschemegcdll' + 'makeencoding' + 'pumwidth' + 'pythonhome' + 'pythonthreehome' + 'pyxversion' + 'termwinkey' + 'termwinscroll' + 'termwinsize' + 'viminfofile' + 'winptydll' + + +Patches *patches-8.1* +------- + +Patch 8.0.0001 +Problem: Intro screen still mentions version7. (Paul) +Solution: Change it to version8. +Files: src/version.c + +Patch 8.0.0002 +Problem: The netrw plugin does not work. +Solution: Make it accept version 8.0. +Files: runtime/autoload/netrw.vim + +Patch 8.0.0003 +Problem: getwinvar() returns wrong Value of boolean and number options, + especially non big endian systems. (James McCoy) +Solution: Cast the pointer to long or int. (closes #1060) +Files: src/option.c, src/testdir/test_bufwintabinfo.vim + +Patch 8.0.0004 +Problem: A string argument for function() that is not a function name + results in an error message with NULL. (Christian Brabandt) +Solution: Use the argument for the error message. +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 8.0.0005 +Problem: Netbeans test fails with Python 3. (Jonathonf) +Solution: Encode the string before sending it. (closes #1070) +Files: src/testdir/test_netbeans.py + +Patch 8.0.0006 +Problem: ":lb" is interpreted as ":lbottom" while the documentation says it + means ":lbuffer". +Solution: Adjust the order of the commands. (haya14busa, closes #1093) +Files: src/ex_cmds.h + +Patch 8.0.0007 +Problem: Vim 7.4 is still mentioned in a few places. +Solution: Update to Vim 8. (Uncle Bill, closes #1094) +Files: src/INSTALLpc.txt, src/vimtutor, uninstal.txt + +Patch 8.0.0008 +Problem: Popup complete test is disabled. +Solution: Enable the test and change the assert. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0009 +Problem: Unnecessary workaround for AppVeyor. +Solution: Revert patch 7.4.990. (Christian Brabandt) +Files: appveyor.yml + +Patch 8.0.0010 +Problem: Crash when editing file that starts with crypt header. (igor2x) +Solution: Check for length of text. (Christian Brabandt) Add a test. +Files: src/fileio.c, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0011 +Problem: On OSX Test_pipe_through_sort_all() sometimes fails. +Solution: Add the test to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0012 +Problem: Typos in comments. +Solution: Change "its" to "it's". (Matthew Brener, closes #1088) +Files: src/evalfunc.c, src/main.aap, src/nbdebug.c, src/netbeans.c, + src/quickfix.c, src/workshop.c, src/wsdebug.c + +Patch 8.0.0013 (after 8.0.0011) +Problem: Missing comma in list. +Solution: Add the comma. +Files: src/testdir/runtest.vim + +Patch 8.0.0014 +Problem: Crypt tests are old style. +Solution: Convert to new style. +Files: src/testdir/test71.in, src/testdir/test71.ok, + src/testdir/test71a.in, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0015 +Problem: Can't tell which part of a channel has "buffered" status. +Solution: Add an optional argument to ch_status(). Let ch_info() also + return "buffered" for out_status and err_status. +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 8.0.0016 (after 8.0.0015) +Problem: Build fails. +Solution: Include missing change. +Files: src/eval.c + +Patch 8.0.0017 +Problem: Cannot get the number of the current quickfix or location list. +Solution: Use the current list if "nr" in "what" is zero. (Yegappan + Lakshmanan) Remove debug command from test. +Files: src/quickfix.c, src/testdir/test_quickfix.vim, + runtime/doc/eval.txt + +Patch 8.0.0018 +Problem: When using ":sleep" channel input is not handled. +Solution: When there is a channel check for input also when not in raw mode. + Check every 100 msec. +Files: src/channel.c, src/proto/channel.pro, src/ui.c, src/proto/ui.pro, + src/ex_docmd.c, src/os_amiga.c, src/proto/os_amiga.pro, + src/os_unix.c, src/proto/os_unix.pro, src/os_win32.c, + src/proto/os_win32.pro + +Patch 8.0.0019 +Problem: Test_command_count is old style. +Solution: Turn it into a new style test. (Naruhiko Nishino) + Use more assert functions. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/test_autocmd.vim, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok, + src/testdir/test_command_count.vim + +Patch 8.0.0020 +Problem: The regexp engines are not reentrant. +Solution: Add regexec_T and save/restore the state when needed. +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test_expr.vim, + runtime/doc/eval.txt, runtime/doc/change.txt + +Patch 8.0.0021 +Problem: In the GUI when redrawing the cursor it may be on the second half + of a double byte character. +Solution: Correct the cursor column. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 8.0.0022 +Problem: If a channel in NL mode is missing the NL at the end the remaining + characters are dropped. +Solution: When the channel is closed use the remaining text. (Ozaki Kiichi) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 8.0.0023 +Problem: "gd" and "gD" may find a match in a comment or string. +Solution: Ignore matches in comments and strings. (Anton Lindqvist) +Files: src/normal.c, src/testdir/test_goto.vim + +Patch 8.0.0024 +Problem: When the netbeans channel closes, "DETACH" is put in the output + part. (Ozaki Kiichi) +Solution: Write "DETACH" in the socket part. +Files: src/channel.c, src/testdir/test_netbeans.vim + +Patch 8.0.0025 +Problem: Inconsistent use of spaces vs tabs in gd test. +Solution: Use tabs. (Anton Lindqvist) +Files: src/testdir/test_goto.vim + +Patch 8.0.0026 +Problem: Error format with %W, %C and %Z does not work. (Gerd Wachsmuth) +Solution: Skip code when qf_multiignore is set. (Lcd) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0027 +Problem: A channel is closed when reading on stderr or stdout fails, but + there may still be something to read on another part. +Solution: Turn ch_to_be_closed into a bitfield. (Ozaki Kiichi) +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 8.0.0028 +Problem: Superfluous semicolons. +Solution: Remove them. (Ozaki Kiichi) +Files: src/ex_cmds2.c + +Patch 8.0.0029 +Problem: Code for MS-Windows is complicated because of the exceptions for + old systems. +Solution: Drop support for MS-Windows older than Windows XP. (Ken Takata) +Files: runtime/doc/gui_w32.txt, runtime/doc/os_win32.txt, + runtime/doc/todo.txt, src/GvimExt/Makefile, src/Make_mvc.mak, + src/evalfunc.c, src/ex_cmds.c, src/ex_docmd.c, src/gui_w32.c, + src/if_cscope.c, src/misc1.c, src/misc2.c, src/option.c, + src/os_mswin.c, src/os_win32.c, src/os_win32.h, + src/proto/os_mswin.pro, src/proto/os_win32.pro, src/version.c + +Patch 8.0.0030 +Problem: Mouse mode is not automatically detected for tmux. +Solution: Check for 'term' to be "tmux". (Michael Henry) +Files: src/os_unix.c + +Patch 8.0.0031 +Problem: After ":bwipeout" 'fileformat' is not set to the right default. +Solution: Get the default from 'fileformats'. (Mike Williams) +Files: src/option.c, src/Makefile, src/testdir/test_fileformat.vim, + src/testdir/test_alot.vim + +Patch 8.0.0032 +Problem: Tests may change the input file when something goes wrong. +Solution: Avoid writing the input file. +Files: src/testdir/test51.in, src/testdir/test67.in, + src/testdir/test97.in, src/testdir/test_tabpage.vim + +Patch 8.0.0033 +Problem: Cannot use overlapping positions with matchaddpos(). +Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0034 +Problem: No completion for ":messages". +Solution: Complete "clear" argument. (Hirohito Higashi) +Files: src/ex_docmd.c, src/ex_getln.c, src/proto/ex_docmd.pro, + src/testdir/test_cmdline.vim, src/vim.h, + runtime/doc/eval.txt, runtime/doc/map.txt + +Patch 8.0.0035 (after 7.4.2013) +Problem: Order of matches for 'omnifunc' is messed up. (Danny Su) +Solution: Do not set compl_curr_match when called from complete_check(). + (closes #1168) +Files: src/edit.c, src/evalfunc.c, src/proto/edit.pro, src/search.c, + src/spell.c, src/tag.c, src/testdir/test76.in, + src/testdir/test76.ok, src/testdir/test_popup.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0036 +Problem: Detecting that a job has finished may take a while. +Solution: Check for a finished job more often (Ozaki Kiichi) +Files: src/channel.c, src/os_unix.c, src/os_win32.c, + src/proto/os_unix.pro, src/proto/os_win32.pro, + src/testdir/test_channel.vim + +Patch 8.0.0037 +Problem: Get E924 when switching tabs. () +Solution: Use win_valid_any_tab() instead of win_valid(). (Martin Vuille, + closes #1167, closes #1171) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0038 +Problem: OPEN_CHR_FILES not defined for FreeBSD using Debian userland + files. +Solution: Check for __FreeBSD_kernel__. (James McCoy, closes #1166) +Files: src/vim.h + +Patch 8.0.0039 +Problem: When Vim 8 reads an old viminfo and exits, the next time marks are + not read from viminfo. (Ned Batchelder) +Solution: Set a mark when it wasn't set before, even when the timestamp is + zero. (closes #1170) +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 8.0.0040 (after 8.0.0033) +Problem: Whole line highlighting with matchaddpos() does not work. +Solution: Check for zero length. (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0041 +Problem: When using Insert mode completion but not actually inserting + anything an undo item is still created. (Tommy Allen) +Solution: Do not call stop_arrow() when not inserting anything. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0042 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" change is not saved for undo. (Tommy Allen) +Solution: Call stop_arrow() before inserting for pressing Enter. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0043 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" with CTRL-N the change is not saved for undo. (Tommy + Allen) +Solution: Call stop_arrow() before inserting for any key. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0044 +Problem: In diff mode the cursor may end up below the last line, resulting + in an ml_get error. +Solution: Check the line to be valid. +Files: src/move.c, src/diff.c, src/proto/diff.pro, + src/testdir/test_diffmode.vim + +Patch 8.0.0045 +Problem: Calling job_stop() right after job_start() does not work. +Solution: Block signals while fork is still busy. (Ozaki Kiichi, closes + #1155) +Files: src/auto/configure, src/config.h.in, src/configure.in, + src/os_unix.c, src/testdir/test_channel.vim + +Patch 8.0.0046 +Problem: Using NUL instead of NULL. +Solution: Change to NULL. (Dominique Pelle) +Files: src/ex_cmds.c, src/json.c + +Patch 8.0.0047 +Problem: Crash when using the preview window from an unnamed buffer. + (lifepillar) +Solution: Do not clear the wrong buffer. (closes #1200) +Files: src/popupmnu.c + +Patch 8.0.0048 +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. (Yasuhiro Matsumoto, closes #1184) +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0049 +Problem: When a match ends in part of concealed text highlighting, it might + mess up concealing by resetting prev_syntax_id. +Solution: Do not reset prev_syntax_id and add a test to verify. (Christian + Brabandt, closes #1092) +Files: src/screen.c, src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0050 +Problem: An exiting job is detected with a large latency. +Solution: Check for pending job more often. (Ozaki Kiichi) Change the + double loop in mch_inchar() into one. +Files: src/channel.c, src/os_unix.c, src/testdir/shared.vim, + src/testdir/test_channel.vim + +Patch 8.0.0051 (after 8.0.0048) +Problem: New code for job_stop() breaks channel test on AppVeyor. +Solution: Revert the change. +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0052 (after 8.0.0049) +Problem: Conceal test passes even without the bug fix. +Solution: Add a redraw command. (Christian Brabandt) +Files: src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0053 (after 8.0.0047) +Problem: No test for what 8.0.0047 fixes. +Solution: Add a test. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0054 (after 8.0.0051) +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. Now only when there is no job object. + (Yasuhiro Matsumoto, closes #1203) +Files: src/os_win32.c + +Patch 8.0.0055 +Problem: Minor comment and style deficiencies. +Solution: Update comments and fix style. +Files: src/buffer.c, src/misc2.c, src/os_unix.c + +Patch 8.0.0056 +Problem: When setting 'filetype' there is no check for a valid name. +Solution: Only allow valid characters in 'filetype', 'syntax' and 'keymap'. +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0057 (after 8.0.0056) +Problem: Tests fail without the 'keymap' features. +Solution: Check for feature in test. +Files: src/testdir/test_options.vim + +Patch 8.0.0058 +Problem: Positioning of the popup menu is not good. +Solution: Position it better. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 8.0.0059 +Problem: Vim does not build on VMS systems. +Solution: Various changes for VMS. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h, src/Make_vms.mms, src/os_unix.c, + src/os_unix.h, src/os_vms.c, src/os_vms_conf.h, + src/proto/os_vms.pro, src/testdir/Make_vms.mms + +Patch 8.0.0060 +Problem: When using an Ex command for 'keywordprg' it is escaped as with a + shell command. (Romain Lafourcade) +Solution: Escape for an Ex command. (closes #1175) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0061 (after 8.0.0058) +Problem: Compiler warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/popupmnu.c + +Patch 8.0.0062 +Problem: No digraph for HORIZONTAL ELLIPSIS. +Solution: Use ",.". (Hans Ginzel, closes #1226) +Files: src/digraph.c, runtime/doc/digraph.txt + +Patch 8.0.0063 +Problem: Compiler warning for comparing with unsigned. (Zoltan Arpadffy) +Solution: Change <= to ==. +Files: src/undo.c + +Patch 8.0.0064 (after 8.0.0060) +Problem: Normal test fails on MS-Windows. +Solution: Don't try using an illegal file name. +Files: src/testdir/test_normal.vim + +Patch 8.0.0065 (after 8.0.0056) +Problem: Compiler warning for unused function in tiny build. (Tony + Mechelynck) +Solution: Add #ifdef. +Files: src/option.c + +Patch 8.0.0066 +Problem: when calling an operator function when 'linebreak' is set, it is + internally reset before calling the operator function. +Solution: Restore 'linebreak' before calling op_function(). (Christian + Brabandt) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0067 +Problem: VMS has a problem with infinity. +Solution: Avoid an overflow. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h + +Patch 8.0.0068 +Problem: Checking did_throw after executing autocommands is wrong. (Daniel + Hahler) +Solution: Call aborting() instead, and only when autocommands were executed. +Files: src/quickfix.c, src/if_cscope.c, src/testdir/test_quickfix.vim + +Patch 8.0.0069 +Problem: Compiler warning for self-comparison. +Solution: Define ONE_WINDOW and add #ifdef. +Files: src/globals.h, src/buffer.c, src/ex_docmd.c, src/move.c, + src/screen.c, src/quickfix.c, src/window.c + +Patch 8.0.0070 +Problem: Tests referred in Makefile that no longer exist. +Solution: Remove test71 and test74 entries. (Michael Soyka) +Files: src/testdir/Mak_ming.mak + +Patch 8.0.0071 +Problem: Exit value from a shell command is wrong. (Hexchain Tong) +Solution: Do not check for ended jobs while waiting for a shell command. + (ichizok, closes #1196) +Files: src/os_unix.c + +Patch 8.0.0072 +Problem: MS-Windows: Crash with long font name. (Henry Hu) +Solution: Fix comparing with LF_FACESIZE. (Ken Takata, closes #1243) +Files: src/os_mswin.c + +Patch 8.0.0073 (after 8.0.0069) +Problem: More comparisons between firstwin and lastwin. +Solution: Use ONE_WINDOW for consistency. (Hirohito Higashi) +Files: src/buffer.c, src/ex_cmds.c, src/ex_docmd.c, src/option.c, + src/window.c + +Patch 8.0.0074 +Problem: Cannot make Vim fail on an internal error. +Solution: Add IEMSG() and IEMSG2(). (Dominique Pelle) Avoid reporting an + internal error without mentioning where. +Files: src/globals.h, src/blowfish.c, src/dict.c, src/edit.c, src/eval.c, + src/evalfunc.c, src/ex_eval.c, src/getchar.c, src/gui_beval.c, + src/gui_w32.c, src/hangulin.c, src/hashtab.c, src/if_cscope.c, + src/json.c, src/memfile.c, src/memline.c, src/message.c, + src/misc2.c, src/option.c, src/quickfix.c, src/regexp.c, + src/spell.c, src/undo.c, src/userfunc.c, src/vim.h, src/window.c, + src/proto/misc2.pro, src/proto/message.pro, src/Makefile + +Patch 8.0.0075 +Problem: Using number for exception type lacks type checking. +Solution: Use an enum. +Files: src/structs.h, src/ex_docmd.c, src/ex_eval.c, + src/proto/ex_eval.pro + +Patch 8.0.0076 +Problem: Channel log has double parens ()(). +Solution: Remove () for write_buf_line. (Yasuhiro Matsumoto) +Files: src/channel.c + +Patch 8.0.0077 +Problem: The GUI code is not tested by Travis. +Solution: Install the virtual framebuffer. +Files: .travis.yml + +Patch 8.0.0078 +Problem: Accessing freed memory in quickfix. +Solution: Reset pointer when freeing 'errorformat'. (Dominique Pelle) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0079 +Problem: Accessing freed memory in quickfix. (Dominique Pelle) +Solution: Do not free the current list when adding to it. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0080 +Problem: The OS X build fails on Travis. +Solution: Skip the virtual framebuffer on OS X. +Files: .travis.yml + +Patch 8.0.0081 +Problem: Inconsistent function names. +Solution: Rename do_cscope to ex_cscope. Clean up comments. +Files: src/ex_cmds.h, src/if_cscope.c, src/ex_docmd.c, + src/proto/if_cscope.pro + +Patch 8.0.0082 +Problem: Extension for configure should be ".ac". +Solution: Rename configure.in to configure.ac. (James McCoy, closes #1173) +Files: src/configure.in, src/configure.ac, Filelist, src/Makefile, + src/blowfish.c, src/channel.c, src/config.h.in, src/main.aap, + src/os_unix.c, src/INSTALL, src/mysign + +Patch 8.0.0083 +Problem: Using freed memory with win_getid(). (Dominique Pelle) +Solution: For the current tab use curwin. +Files: src/window.c, src/testdir/test_window_id.vim + +Patch 8.0.0084 +Problem: Using freed memory when adding to a quickfix list. (Dominique + Pelle) +Solution: Clear the directory name. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0085 +Problem: Using freed memory with recursive function call. (Dominique Pelle) +Solution: Make a copy of the function name. +Files: src/eval.c, src/testdir/test_nested_function.vim + +Patch 8.0.0086 +Problem: Cannot add a comment after ":hide". (Norio Takagi) +Solution: Make it work, add a test. (Hirohito Higashi) +Files: src/Makefile, src/ex_cmds.h, src/ex_docmd.c, + src/testdir/Make_all.mak, src/testdir/test_hide.vim + +Patch 8.0.0087 +Problem: When the channel callback gets job info the job may already have + been deleted. (lifepillar) +Solution: Do not delete the job when the channel is still useful. (ichizok, + closes #1242, closes #1245) +Files: src/channel.c, src/eval.c, src/os_unix.c, src/os_win32.c, + src/structs.h, src/testdir/test_channel.vim + +Patch 8.0.0088 +Problem: When a test fails in Setup or Teardown the problem is not reported. +Solution: Add a try/catch. (Hirohito Higashi) +Files: src/testdir/runtest.vim + +Patch 8.0.0089 +Problem: Various problems with GTK 3.22.2. +Solution: Fix the problems, add #ifdefs. (Kazunobu Kuriyama) +Files: src/gui_beval.c, src/gui_gtk.c, src/gui_gtk_x11.c + +Patch 8.0.0090 +Problem: Cursor moved after last character when using 'breakindent'. +Solution: Fix the cursor positioning. Turn the breakindent test into new + style. (Christian Brabandt) +Files: src/screen.c, src/testdir/Make_all.mak, + src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok, + src/testdir/test_breakindent.vim, src/Makefile + +Patch 8.0.0091 +Problem: Test_help_complete sometimes fails in MS-Windows console. +Solution: Use getcompletion() instead of feedkeys() and command line + completion. (Hirohito Higashi) +Files: src/testdir/test_help_tagjump.vim + +Patch 8.0.0092 +Problem: C indenting does not support nested namespaces that C++ 17 has. +Solution: Add check that passes double colon inside a name. (Pauli, closes + #1214) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 8.0.0093 +Problem: Not using multiprocess build feature. +Solution: Enable multiprocess build with MSVC 10. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 8.0.0094 +Problem: When vimrun.exe is not found the error message is not properly + encoded. +Solution: Use utf-16 and MessageBoxW(). (Ken Takata) +Files: src/os_win32.c + +Patch 8.0.0095 +Problem: Problems with GTK 3.22.2 fixed in 3.22.4. +Solution: Adjust the #ifdefs. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 8.0.0096 +Problem: When the input or output is not a tty Vim appears to hang. +Solution: Add the --ttyfail argument. Also add the "ttyin" and "ttyout" + features to be able to check in Vim script. +Files: src/globals.h, src/structs.h, src/main.c, src/evalfunc.c, + runtime/doc/starting.txt, runtime/doc/eval.txt + +Patch 8.0.0097 +Problem: When a channel callback consumes a lot of time Vim becomes + unresponsive. (skywind) +Solution: Bail out of checking channel readahead after 100 msec. +Files: src/os_unix.c, src/misc2.c, src/vim.h, src/os_win32.c, + src/channel.c + +Patch 8.0.0098 (after 8.0.0097) +Problem: Can't build on MS-Windows. +Solution: Add missing parenthesis. +Files: src/vim.h + +Patch 8.0.0099 +Problem: Popup menu always appears above the cursor when it is in the lower + half of the screen. (Matt Gardner) +Solution: Compute the available space better. (Hirohito Higashi, + closes #1241) +Files: src/popupmnu.c + +Patch 8.0.0100 +Problem: Options that are a file name may contain non-filename characters. +Solution: Check for more invalid characters. +Files: src/option.c + +Patch 8.0.0101 +Problem: Some options are not strictly checked. +Solution: Add flags for strickter checks. +Files: src/option.c + +Patch 8.0.0102 (after 8.0.0101) +Problem: Cannot set 'dictionary' to a path. +Solution: Allow for slash and backslash. Add a test (partly by Daisuke + Suzuki, closes #1279, closes #1284) +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0103 +Problem: May not process channel readahead. (skywind) +Solution: If there is readahead don't block on input. +Files: src/channel.c, src/proto/channel.pro, src/os_unix.c, + src/os_win32.c, src/misc2.c + +Patch 8.0.0104 +Problem: Value of 'thesaurus' option not checked properly. +Solution: Add P_NDNAME flag. (Daisuke Suzuki) +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0105 +Problem: When using ch_read() with zero timeout, can't tell the difference + between reading an empty line and nothing available. +Solution: Add ch_canread(). +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/shared.vim, + runtime/doc/eval.txt, runtime/doc/channel.txt + +Patch 8.0.0106 (after 8.0.0100) +Problem: Cannot use a semicolon in 'backupext'. (Jeff) +Solution: Allow for a few more characters when "secure" isn't set. +Files: src/option.c + +Patch 8.0.0107 +Problem: When reading channel output in a timer, messages may go missing. + (Skywind) +Solution: Add the "drop" option. Write error messages in the channel log. + Don't have ch_canread() check for the channel being open. +Files: src/structs.h, src/channel.c, src/message.c, src/evalfunc.c, + src/proto/channel.pro, runtime/doc/channel.txt + +Patch 8.0.0108 (after 8.0.0107) +Problem: The channel "drop" option is not tested. +Solution: Add a test. +Files: src/testdir/test_channel.vim + +Patch 8.0.0109 +Problem: Still checking if memcmp() exists while every system should have + it now. +Solution: Remove vim_memcmp(). (James McCoy, closes #1295) +Files: src/config.h.in, src/configure.ac, src/misc2.c, src/os_vms_conf.h, + src/osdef1.h.in, src/search.c, src/tag.c, src/vim.h + +Patch 8.0.0110 +Problem: Drop command doesn't use existing window. +Solution: Check the window width properly. (Hirohito Higashi) +Files: src/buffer.c, src/testdir/test_tabpage.vim + +Patch 8.0.0111 +Problem: The :history command is not tested. +Solution: Add tests. (Dominique Pelle) +Files: runtime/doc/cmdline.txt, src/testdir/test_history.vim + +Patch 8.0.0112 +Problem: Tests 92 and 93 are old style. +Solution: Make test92 and test93 new style. (Hirohito Higashi, closes #1289) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test92.in, src/testdir/test92.ok, + src/testdir/test93.in, src/testdir/test93.ok, + src/testdir/test_mksession.vim, + src/testdir/test_mksession_utf8.vim + +Patch 8.0.0113 +Problem: MS-Windows: message box to prompt for saving changes may appear on + the wrong monitor. +Solution: Adjust the CenterWindow function. (Ken Takata) +Files: src/gui_w32.c + +Patch 8.0.0114 +Problem: Coding style not optimal. +Solution: Add spaces. (Ken Takata) +Files: src/gui_w32.c, src/os_mswin.c + +Patch 8.0.0115 +Problem: When building with Cygwin libwinpthread isn't found. +Solution: Link winpthread statically. (jmmerz, closes #1255, closes #1256) +Files: src/Make_cyg_ming.mak + +Patch 8.0.0116 +Problem: When reading English help and using CTRl-] the language from + 'helplang' is used. +Solution: Make help tag jumps keep the language. (Tatsuki, test by Hirohito + Higashi, closes #1249) +Files: src/tag.c, src/testdir/test_help_tagjump.vim + +Patch 8.0.0117 +Problem: Parallel make fails. (J. Lewis Muir) +Solution: Make sure the objects directory exists. (closes #1259) +Files: src/Makefile + +Patch 8.0.0118 +Problem: "make proto" adds extra function prototype. +Solution: Add #ifdef. +Files: src/misc2.c + +Patch 8.0.0119 +Problem: No test for using CTRL-R on the command line. +Solution: Add a test. (Dominique Pelle) And some more. +Files: src/testdir/test_cmdline.vim + +Patch 8.0.0120 +Problem: Channel test is still flaky on OS X. +Solution: Set the drop argument to "never". +Files: src/testdir/test_channel.vim + +Patch 8.0.0121 +Problem: Setting 'cursorline' changes the curswant column. (Daniel Hahler) +Solution: Add the P_RWINONLY flag. (closes #1297) +Files: src/option.c, src/testdir/test_goto.vim + +Patch 8.0.0122 +Problem: Channel test is still flaky on OS X. +Solution: Add a short sleep. +Files: src/testdir/test_channel.py + +Patch 8.0.0123 +Problem: Modern Sun compilers define "__sun" instead of "sun". +Solution: Use __sun. (closes #1296) +Files: src/mbyte.c, src/pty.c, src/os_unixx.h, src/vim.h + +Patch 8.0.0124 +Problem: Internal error for assert_inrange(1, 1). +Solution: Adjust number of allowed arguments. (Dominique Pelle) +Files: src/evalfunc.c, src/testdir/test_assert.vim + +Patch 8.0.0125 +Problem: Not enough testing for entering Ex commands. +Solution: Add test for CTRL-\ e {expr}. (Dominique Pelle) +Files: src/testdir/test_cmdline.vim + +Patch 8.0.0126 +Problem: Display problem with 'foldcolumn' and a wide character. + (esiegerman) +Solution: Don't use "extra" but an allocated buffer. (Christian Brabandt, + closes #1310) +Files: src/screen.c, src/testdir/Make_all.mak, src/Makefile, + src/testdir/test_display.vim + +Patch 8.0.0127 +Problem: Cancelling completion still inserts text when formatting is done + for 'textwidth'. (lacygoill) +Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, + closes #1312) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0128 (after 8.0.0126) +Problem: Display test fails on MS-Windows. +Solution: Set 'isprint' to "@". +Files: src/testdir/test_display.vim + +Patch 8.0.0129 +Problem: Parallel make still doesn't work. (Lewis Muir) +Solution: Define OBJ_MAIN. +Files: src/Makefile + +Patch 8.0.0130 +Problem: Configure uses "ushort" while the Vim code doesn't. +Solution: Use "unsigned short" instead. (Fredrik Fornwall, closes #1314) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.0131 +Problem: Not enough test coverage for syntax commands. +Solution: Add more tests. (Dominique Pelle) +Files: src/testdir/test_syntax.vim + +Patch 8.0.0132 (after 8.0.0131) +Problem: Test fails because of using :finish. +Solution: Change to return. +Files: src/testdir/test_syntax.vim + +Patch 8.0.0133 +Problem: "2;'(" causes ml_get errors in an empty buffer. (Dominique Pelle) +Solution: Check the cursor line earlier. +Files: src/ex_docmd.c, src/testdir/test_cmdline.vim + +Patch 8.0.0134 +Problem: Null pointer access reported by UBsan. +Solution: Check curwin->w_buffer is not NULL. (Yegappan Lakshmanan) +Files: src/ex_cmds.c + +Patch 8.0.0135 +Problem: An address relative to the current line, ":.,+3y", does not work + properly on a closed fold. (Efraim Yawitz) +Solution: Correct for including the closed fold. (Christian Brabandt) +Files: src/ex_docmd.c, src/testdir/test_fold.vim, + src/testdir/Make_all.mak, src/Makefile + +Patch 8.0.0136 +Problem: When using indent folding and changing indent the wrong fold is + opened. (Jonathan Fudger) +Solution: Open the fold under the cursor a bit later. (Christian Brabandt) +Files: src/ops.c, src/testdir/test_fold.vim + +Patch 8.0.0137 +Problem: When 'maxfuncdepth' is set above 200 the nesting is limited to + 200. (Brett Stahlman) +Solution: Allow for Ex command recursion depending on 'maxfuncdepth'. +Files: src/ex_docmd.c, src/testdir/test_nested_function.vim + +Patch 8.0.0138 (after 8.0.0137) +Problem: Small build fails. +Solution: Add #ifdef. +Files: src/ex_docmd.c + +Patch 8.0.0139 (after 8.0.0135) +Problem: Warning for unused argument. +Solution: Add UNUSED. +Files: src/ex_docmd.c + +Patch 8.0.0140 +Problem: Pasting inserted text in Visual mode does not work properly. + (Matthew Malcomson) +Solution: Stop Visual mode before stuffing the inserted text. (Christian + Brabandt, from neovim #5709) +Files: src/ops.c, src/testdir/test_visual.vim + +Patch 8.0.0141 (after 8.0.0137) +Problem: Nested function test fails on AppVeyor. +Solution: Disable the test on Windows for now. +Files: src/testdir/test_nested_function.vim + +Patch 8.0.0142 +Problem: Normal colors are wrong with 'termguicolors'. +Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes + #1344) +Files: src/syntax.c + +Patch 8.0.0143 +Problem: Line number of current buffer in getbufinfo() is wrong. +Solution: For the current buffer use the current line number. (Ken Takata) +Files: src/evalfunc.c + +Patch 8.0.0144 +Problem: When using MSVC the GvimExt directory is cleaned twice. +Solution: Remove the lines. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 8.0.0145 +Problem: Running tests on MS-Windows is a little bit noisy. +Solution: Redirect some output to "nul". (Ken Takata) +Files: src/testdir/Make_dos.mak + +Patch 8.0.0146 +Problem: When using 'termguicolors' on MS-Windows the RGB definition causes + the colors to be wrong. +Solution: Undefined RGB and use our own. (Gabriel Barta) +Files: src/term.c + +Patch 8.0.0147 +Problem: searchpair() does not work when 'magic' is off. (Chris Paul) +Solution: Add \m in the pattern. (Christian Brabandt, closes #1341) +Files: src/evalfunc.c, src/testdir/test_search.vim + +Patch 8.0.0148 +Problem: When a C preprocessor statement has two line continuations the + following line does not have the right indent. (Ken Takata) +Solution: Add the indent of the previous continuation line. (Hirohito + Higashi) +Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 8.0.0149 +Problem: ":earlier" and ":later" do not work after startup or reading the + undo file. +Solution: Use absolute time stamps instead of relative to the Vim start + time. (Christian Brabandt, Pavel Juhas, closes #1300, closes + #1254) +Files: src/testdir/test_undo.vim, src/undo.c + +Patch 8.0.0150 +Problem: When the pattern of :filter does not have a separator then + completion of the command fails. +Solution: Skip over the pattern. (Ozaki Kiichi, closes #1299) +Files: src/ex_docmd.c, src/testdir/test_filter_cmd.vim + +Patch 8.0.0151 +Problem: To pass buffer content to system() and systemlist() one has to + first create a string or list. +Solution: Allow passing a buffer number. (LemonBoy, closes #1240) +Files: runtime/doc/eval.txt, src/Makefile, src/evalfunc.c, + src/testdir/Make_all.mak, src/testdir/test_system.vim + +Patch 8.0.0152 +Problem: Running the channel test creates channellog. +Solution: Delete the debug line. +Files: src/testdir/test_channel.vim + +Patch 8.0.0153 (after 8.0.0151) +Problem: system() test fails on MS-Windows. +Solution: Deal with extra space and CR. +Files: src/testdir/test_system.vim + +Patch 8.0.0154 (after 8.0.0151) +Problem: system() test fails on OS/X. +Solution: Deal with leading spaces. +Files: src/testdir/test_system.vim + +Patch 8.0.0155 +Problem: When sorting zero elements a NULL pointer is passed to qsort(), + which ubsan warns for. +Solution: Don't call qsort() if there are no elements. (Dominique Pelle) +Files: src/syntax.c + +Patch 8.0.0156 +Problem: Several float functions are not covered by tests. +Solution: Add float tests. (Dominique Pelle) +Files: src/Makefile, src/testdir/test_alot.vim, + src/testdir/test_float_func.vim + +Patch 8.0.0157 +Problem: No command line completion for ":syntax spell" and ":syntax sync". +Solution: Implement the completion. (Dominique Pelle) +Files: src/syntax.c, src/testdir/test_syntax.vim + +Patch 8.0.0158 (after 8.0.0156) +Problem: On MS-Windows some float functions return a different value when + passed unusual values. strtod() doesn't work for "inf" and "nan". +Solution: Accept both results. Fix str2float() for MS-Windows. Also + reorder assert function arguments. +Files: src/testdir/test_float_func.vim, src/eval.c + +Patch 8.0.0159 +Problem: Using a NULL pointer when using feedkeys() to trigger drawing a + tabline. +Solution: Skip drawing a tabline if TabPageIdxs is NULL. (Dominique Pelle) + Also fix recursing into getcmdline() from the cmd window. +Files: src/screen.c, src/ex_getln.c + +Patch 8.0.0160 +Problem: EMSG() is sometimes used for internal errors. +Solution: Change them to IEMSG(). (Dominique Pelle) And a few more. +Files: src/regexp_nfa.c, src/channel.c, src/eval.c + +Patch 8.0.0161 (after 8.0.0159) +Problem: Build fails when using small features. +Solution: Update #ifdef for using save_ccline. (Hirohito Higashi) +Files: src/ex_getln.c + +Patch 8.0.0162 +Problem: Build error on Fedora 23 with small features and gnome2. +Solution: Undefine ngettext(). (Hirohito Higashi) +Files: src/gui_gtk.c, src/gui_gtk_x11.c + +Patch 8.0.0163 +Problem: Ruby 2.4 no longer supports rb_cFixnum. +Solution: move rb_cFixnum into an #ifdef. (Kazuki Sakamoto, closes #1365) +Files: src/if_ruby.c + +Patch 8.0.0164 +Problem: Outdated and misplaced comments. +Solution: Fix the comments. +Files: src/charset.c, src/getchar.c, src/list.c, src/misc2.c, + src/testdir/README.txt + +Patch 8.0.0165 +Problem: Ubsan warns for integer overflow. +Solution: Swap two conditions. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 8.0.0166 +Problem: JSON with a duplicate key gives an internal error. (Lcd) +Solution: Give a normal error. Avoid an error when parsing JSON from a + remote client fails. +Files: src/evalfunc.c, src/json.c, src/channel.c, + src/testdir/test_json.vim + +Patch 8.0.0167 +Problem: str2nr() and str2float() do not always work with negative values. +Solution: Be more flexible about handling signs. (LemonBoy, closes #1332) + Add more tests. +Files: src/evalfunc.c, src/testdir/test_float_func.vim, + src/testdir/test_functions.vim, src/testdir/test_alot.vim, + src/Makefile + +Patch 8.0.0168 +Problem: Still some float functionality is not covered by tests. +Solution: Add more tests. (Dominique Pelle, closes #1364) +Files: src/testdir/test_float_func.vim + +Patch 8.0.0169 +Problem: For complicated string json_decode() may run out of stack space. +Solution: Change the recursive solution into an iterative solution. +Files: src/json.c + +Patch 8.0.0170 (after 8.0.0169) +Problem: Channel test fails for using freed memory. +Solution: Fix memory use in json_decode(). +Files: src/json.c + +Patch 8.0.0171 +Problem: JS style JSON does not support single quotes. +Solution: Allow for single quotes. (Yasuhiro Matsumoto, closes #1371) +Files: src/json.c, src/testdir/test_json.vim, src/json_test.c, + runtime/doc/eval.txt + +Patch 8.0.0172 (after 8.0.0159) +Problem: The command selected in the command line window is not executed. + (Andrey Starodubtsev) +Solution: Save and restore the command line at a lower level. (closes #1370) +Files: src/ex_getln.c, src/testdir/test_history.vim + +Patch 8.0.0173 +Problem: When compiling with EBCDIC defined the build fails. (Yaroslav + Kuzmin) +Solution: Move sortFunctions() to the right file. Avoid warning for + redefining __SUSV3. +Files: src/eval.c, src/evalfunc.c, src/os_unixx.h + +Patch 8.0.0174 +Problem: For completion "locale -a" is executed on MS-Windows, even though + it most likely won't work. +Solution: Skip executing "locale -a" on MS-Windows. (Ken Takata) +Files: src/ex_cmds2.c + +Patch 8.0.0175 +Problem: Setting language in gvim on MS-Windows does not work when + libintl.dll is dynamically linked with msvcrt.dll. +Solution: Use putenv() from libintl as well. (Ken Takata, closes #1082) +Files: src/mbyte.c, src/misc1.c, src/os_win32.c, src/proto/os_win32.pro, + src/vim.h + +Patch 8.0.0176 +Problem: Using :change in between :function and :endfunction fails. +Solution: Recognize :change inside a function. (ichizok, closes #1374) +Files: src/userfunc.c, src/testdir/test_viml.vim + +Patch 8.0.0177 +Problem: When opening a buffer on a directory and inside a try/catch then + the BufEnter event is not triggered. +Solution: Return NOTDONE from readfile() for a directory and deal with the + three possible return values. (Justin M. Keyes, closes #1375, + closes #1353) +Files: src/buffer.c, src/ex_cmds.c, src/ex_docmd.c, src/fileio.c, + src/memline.c + +Patch 8.0.0178 +Problem: test_command_count may fail when a previous test interferes, seen + on MS-Windows. +Solution: Run it separately. +Files: src/testdir/test_alot.vim, src/testdir/Make_all.mak + +Patch 8.0.0179 +Problem: 'formatprg' is a global option but the value may depend on the + type of buffer. (Sung Pae) +Solution: Make 'formatprg' global-local. (closes #1380) +Files: src/structs.h, src/option.h, src/option.c, src/normal.c, + runtime/doc/options.txt, src/testdir/test_normal.vim + +Patch 8.0.0180 +Problem: Error E937 is used both for duplicate key in JSON and for trying + to delete a buffer that is in use. +Solution: Rename the JSON error to E938. (Norio Takagi, closes #1376) +Files: src/json.c, src/testdir/test_json.vim + +Patch 8.0.0181 +Problem: When 'cursorbind' and 'cursorcolumn' are both on, the column + highlight in non-current windows is wrong. +Solution: Add validate_cursor(). (Masanori Misono, closes #1372) +Files: src/move.c + +Patch 8.0.0182 +Problem: When 'cursorbind' and 'cursorline' are set, but 'cursorcolumn' is + not, then the cursor line highlighting is not updated. (Hirohito + Higashi) +Solution: Call redraw_later() with NOT_VALID. +Files: src/move.c + +Patch 8.0.0183 +Problem: Ubsan warns for using a pointer that is not aligned. +Solution: First copy the address. (Yegappan Lakshmanan) +Files: src/channel.c + +Patch 8.0.0184 +Problem: When in Ex mode and an error is caught by try-catch, Vim still + exits with a non-zero exit code. +Solution: Don't set ex_exitval when inside a try-catch. (partly by Christian + Brabandt) +Files: src/message.c, src/testdir/test_system.vim + +Patch 8.0.0185 (after 8.0.0184) +Problem: The system() test fails on MS-Windows. +Solution: Skip the test on MS-Windows. +Files: src/testdir/test_system.vim + +Patch 8.0.0186 +Problem: The error message from assert_notequal() is confusing. +Solution: Only mention the expected value. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 8.0.0187 +Problem: Building with a new Ruby version fails. +Solution: Use ruby_sysinit() instead of NtInitialize(). (Tomas Volf, + closes #1382) +Files: src/if_ruby.c + +Patch 8.0.0188 (after 8.0.0182) +Problem: Using NOT_VALID for redraw_later() to update the cursor + line/column highlighting is not efficient. +Solution: Call validate_cursor() when 'cul' or 'cuc' is set. +Files: src/move.c + +Patch 8.0.0189 +Problem: There are no tests for the :profile command. +Solution: Add tests. (Dominique Pelle, closes #1383) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_profile.vim + +Patch 8.0.0190 +Problem: Detecting duplicate tags uses a slow linear search. +Solution: Use a much faster hash table solution. (James McCoy, closes #1046) + But don't add hi_keylen, it makes hash tables 50% bigger. +Files: src/tag.c + +Patch 8.0.0191 (after 8.0.0187) +Problem: Some systems do not have ruby_sysinit(), causing the build to + fail. +Solution: Clean up how ruby_sysinit() and NtInitialize() are used. (Taro + Muraoka) +Files: src/if_ruby.c + +Patch 8.0.0192 (after 8.0.0190) +Problem: Build fails with tiny features. +Solution: Change #ifdef for hash_clear(). Avoid warning for unused + argument. +Files: src/hashtab.c, src/if_cscope.c + +Patch 8.0.0193 (after 8.0.0188) +Problem: Accidentally removed #ifdef. +Solution: Put it back. (Masanori Misono) +Files: src/move.c + +Patch 8.0.0194 (after 8.0.0189) +Problem: Profile tests fails if total and self time are equal. +Solution: Make one time optional. +Files: src/testdir/test_profile.vim + +Patch 8.0.0195 (after 8.0.0190) +Problem: Jumping to a tag that is a static item in the current file fails. + (Kazunobu Kuriyama) +Solution: Make sure the first byte of the tag key is not NUL. (Suggested by + James McCoy, closes #1387) +Files: src/tag.c, src/testdir/test_tagjump.vim + +Patch 8.0.0196 (after 8.0.0194) +Problem: The test for :profile is slow and does not work on MS-Windows. +Solution: Use the "-es" argument. (Dominique Pelle) Swap single and double + quotes for system() +Files: src/testdir/test_profile.vim + +Patch 8.0.0197 +Problem: On MS-Windows the system() test skips a few parts. +Solution: Swap single and double quotes for the command. +Files: src/testdir/test_system.vim + +Patch 8.0.0198 +Problem: Some syntax arguments take effect even after "if 0". (Taylor + Venable) +Solution: Properly skip the syntax statements. Make "syn case" and "syn + conceal" report the current state. Fix that "syn clear" didn't + reset the conceal flag. Add tests for :syntax skipping properly. +Files: src/syntax.c, src/testdir/test_syntax.vim + +Patch 8.0.0199 +Problem: Warning for an unused parameter when the libcall feature is + disabled. Warning for a function type cast when compiling with + -pedantic. +Solution: Add UNUSED. Use a different type cast. (Damien Molinier) +Files: src/evalfunc.c, src/os_unix.c + +Patch 8.0.0200 +Problem: Some syntax arguments are not tested. +Solution: Add more syntax command tests. +Files: src/testdir/test_syntax.vim + +Patch 8.0.0201 +Problem: When completing a group name for a highlight or syntax command + cleared groups are included. +Solution: Skip groups that have been cleared. +Files: src/syntax.c, src/testdir/test_syntax.vim + +Patch 8.0.0202 +Problem: No test for invalid syntax group name. +Solution: Add a test for group name error and warning. +Files: src/testdir/test_syntax.vim + +Patch 8.0.0203 +Problem: Order of complication flags is sometimes wrong. +Solution: Put interface-specific flags before ALL_CFLAGS. (idea by Yousong + Zhou, closes #1100) +Files: src/Makefile + +Patch 8.0.0204 +Problem: Compiler warns for uninitialized variable. (Tony Mechelynck) +Solution: When skipping set "id" to -1. +Files: src/syntax.c + +Patch 8.0.0205 +Problem: After :undojoin some commands don't work properly, such as :redo. + (Matthew Malcomson) +Solution: Don't set curbuf->b_u_curhead. (closes #1390) +Files: src/undo.c, src/testdir/test_undo.vim + +Patch 8.0.0206 +Problem: Test coverage for :retab insufficient. +Solution: Add test for :retab. (Dominique Pelle, closes #1391) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_retab.vim + +Patch 8.0.0207 +Problem: Leaking file descriptor when system() cannot find the buffer. + (Coverity) +Solution: Close the file descriptor. (Dominique Pelle, closes #1398) +Files: src/evalfunc.c + +Patch 8.0.0208 +Problem: Internally used commands for CTRL-Z and mouse click end up in + history. (Matthew Malcomson) +Solution: Use do_cmdline_cmd() instead of stuffing them in the readahead + buffer. (James McCoy, closes #1395) +Files: src/edit.c, src/normal.c + +Patch 8.0.0209 +Problem: When using :substitute with the "c" flag and 'cursorbind' is set + the cursor is not updated in other windows. +Solution: Call do_check_cursorbind(). (Masanori Misono) +Files: src/ex_cmds.c + +Patch 8.0.0210 +Problem: Vim does not support bracketed paste, as implemented by xterm and + other terminals. +Solution: Add t_BE, t_BD, t_PS and t_PE. +Files: src/term.c, src/term.h, src/option.c, src/misc2.c, src/keymap.h, + src/edit.c, src/normal.c, src/evalfunc.c, src/getchar.c, + src/vim.h, src/proto/edit.pro, runtime/doc/term.txt + +Patch 8.0.0211 (after 8.0.0210) +Problem: Build fails if the multi-byte feature is disabled. +Solution: Change #ifdef around ins_char_bytes. +Files: src/misc1.c + +Patch 8.0.0212 +Problem: The buffer used to store a key name theoreticaly could be too + small. (Coverity) +Solution: Count all possible modifier characters. Add a check for the + length just in case. +Files: src/keymap.h, src/misc2.c + +Patch 8.0.0213 +Problem: The Netbeans "specialKeys" command does not check if the argument + fits in the buffer. (Coverity) +Solution: Add a length check. +Files: src/netbeans.c + +Patch 8.0.0214 +Problem: Leaking memory when syntax cluster id is unknown. (Coverity) +Solution: Free the memory. +Files: src/syntax.c + +Patch 8.0.0215 +Problem: When a Cscope line contains CTRL-L a NULL pointer may be used. + (Coverity) +Solution: Don't check for an emacs tag in a cscope line. +Files: src/tag.c + +Patch 8.0.0216 +Problem: When decoding JSON with a JS style object the JSON test may use a + NULL pointer. (Coverity) +Solution: Check for a NULL pointer. +Files: src/json.c, src/json_test.c + +Patch 8.0.0217 (after 8.0.0215) +Problem: Build fails without the cscope feature. +Solution: Add #ifdef. +Files: src/tag.c + +Patch 8.0.0218 +Problem: No command line completion for :cexpr, :cgetexpr, :caddexpr, etc. +Solution: Make completion work. (Yegappan Lakshmanan) Add a test. +Files: src/ex_docmd.c, src/testdir/test_cmdline.vim + +Patch 8.0.0219 +Problem: Ubsan reports errors for integer overflow. +Solution: Define macros for minimum and maximum values. Select an + expression based on the value. (Mike Williams) +Files: src/charset.c, src/eval.c, src/evalfunc.c, src/structs.h, + src/testdir/test_viml.vim + +Patch 8.0.0220 +Problem: Completion for :match does not show "none" and other missing + highlight names. +Solution: Skip over cleared entries before checking the index to be at the + end. +Files: src/syntax.c, src/testdir/test_cmdline.vim + +Patch 8.0.0221 +Problem: Checking if PROTO is defined inside a function has no effect. +Solution: Remove the check for PROTO. (Hirohito Higashi) +Files: src/misc1.c + +Patch 8.0.0222 +Problem: When a multi-byte character ends in a zero byte, putting blockwise + text puts it before the character instead of after it. +Solution: Use int instead of char for the character under the cursor. + (Luchr, closes #1403) Add a test. +Files: src/ops.c, src/testdir/test_put.vim, src/Makefile, + src/testdir/test_alot.vim + +Patch 8.0.0223 +Problem: Coverity gets confused by the flags passed to find_tags() and + warnts for an uninitialized variable. +Solution: Disallow using cscope and help tags at the same time. +Files: src/tag.c + +Patch 8.0.0224 +Problem: When 'fileformats' is changed in a BufReadPre auto command, it + does not take effect in readfile(). (Gary Johnson) +Solution: Check the value of 'fileformats' after executing auto commands. + (Christian Brabandt) +Files: src/fileio.c, src/testdir/test_fileformat.vim + +Patch 8.0.0225 +Problem: When a block is visually selected and put is used on the end of + the selection only one line is changed. +Solution: Check for the end properly. (Christian Brabandt, neovim issue + 5781) +Files: src/ops.c, src/testdir/test_put.vim + +Patch 8.0.0226 +Problem: The test for patch 8.0.0224 misses the CR characters and passes + even without the fix. (Christian Brabandt) +Solution: Use double quotes and \<CR>. +Files: src/testdir/test_fileformat.vim + +Patch 8.0.0227 +Problem: Crash when 'fileformat' is forced to "dos" and the first line in + the file is empty and does not have a CR character. +Solution: Don't check for CR before the start of the buffer. +Files: src/fileio.c, src/testdir/test_fileformat.vim + +Patch 8.0.0228 (after 8.0.0210) +Problem: When pasting test in an xterm on the command line it is surrounded + by <PasteStart> and <PasteEnd>. (Johannes Kaltenbach) +Solution: Add missing changes. +Files: src/ex_getln.c, src/term.c + +Patch 8.0.0229 (after 8.0.0179) +Problem: When freeing a buffer the local value of the 'formatprg' option is + not cleared. +Solution: Add missing change. +Files: src/buffer.c + +Patch 8.0.0230 (after 8.0.0210) +Problem: When using bracketed paste line breaks are not respected. +Solution: Turn CR characters into a line break if the text is being + inserted. (closes #1404) +Files: src/edit.c + +Patch 8.0.0231 +Problem: There are no tests for bracketed paste mode. +Solution: Add a test. Fix repeating with "normal .". +Files: src/edit.c, src/testdir/test_paste.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0232 +Problem: Pasting in Insert mode does not work when bracketed paste is used + and 'esckeys' is off. +Solution: When 'esckeys' is off disable bracketed paste in Insert mode. +Files: src/edit.c + +Patch 8.0.0233 (after 8.0.0231) +Problem: The paste test fails if the GUI is being used. +Solution: Skip the test in the GUI. +Files: src/testdir/test_paste.vim + +Patch 8.0.0234 (after 8.0.0225) +Problem: When several lines are visually selected and one of them is short, + using put may cause a crash. (Axel Bender) +Solution: Check for a short line. (Christian Brabandt) +Files: src/ops.c, src/testdir/test_put.vim + +Patch 8.0.0235 +Problem: Memory leak detected when running tests for diff mode. +Solution: Free p_extra_free. +Files: src/screen.c + +Patch 8.0.0236 (after 8.0.0234) +Problem: Gcc complains that a variable may be used uninitialized. Confusion + between variable and label name. (John Marriott) +Solution: Initialize it. Rename end to end_lnum. +Files: src/ops.c + +Patch 8.0.0237 +Problem: When setting wildoptions=tagfile the completion context is not set + correctly. (desjardins) +Solution: Check for EXPAND_TAGS_LISTFILES. (Christian Brabandt, closes #1399) +Files: src/ex_getln.c, src/testdir/test_cmdline.vim + +Patch 8.0.0238 +Problem: When using bracketed paste autoindent causes indent to be + increased. +Solution: Disable 'ai' and set 'paste' temporarily. (Ken Takata) +Files: src/edit.c, src/testdir/test_paste.vim + +Patch 8.0.0239 +Problem: The address sanitizer sometimes finds errors, but it needs to be + run manually. +Solution: Add an environment to Travis with clang and the address sanitizer. + (Christian Brabandt) Also include changes only on github. +Files: .travis.yml + +Patch 8.0.0240 (after 8.0.0239) +Problem: The clang build on CI fails with one configuration. +Solution: Redo a previous patch that was accidentally reverted. +Files: .travis.yml + +Patch 8.0.0241 +Problem: Vim defines a mch_memmove() function but it doesn't work, thus is + always unused. +Solution: Remove the mch_memmove implementation. (suggested by Dominique + Pelle) +Files: src/os_unix.h, src/misc2.c, src/vim.h + +Patch 8.0.0242 +Problem: Completion of user defined functions is not covered by tests. +Solution: Add tests. Also test various errors of user-defined commands. + (Dominique Pelle, closes #1413) +Files: src/testdir/test_usercommands.vim + +Patch 8.0.0243 +Problem: When making a character lower case with tolower() changes the byte + cound, it is not made lower case. +Solution: Add strlow_save(). (Dominique Pelle, closes #1406) +Files: src/evalfunc.c, src/misc2.c, src/proto/misc2.pro, + src/testdir/test_functions.vim + +Patch 8.0.0244 +Problem: When the user sets t_BE empty after startup to disable bracketed + paste, this has no direct effect. +Solution: When t_BE is made empty write t_BD. When t_BE is made non-empty + write the new value. +Files: src/option.c + +Patch 8.0.0245 +Problem: The generated zh_CN.cp936.po message file is not encoded properly. +Solution: Instead of using zh_CN.po as input, use zh_CN.UTF-8.po. +Files: src/po/Makefile + +Patch 8.0.0246 +Problem: Compiler warnings for int to pointer conversion. +Solution: Fix macro for mch_memmove(). (John Marriott) +Files: src/vim.h + +Patch 8.0.0247 +Problem: Under some circumstances, one needs to type Ctrl-N or Ctrl-P twice + to have a menu entry selected. (Lifepillar) +Solution: call ins_compl_free(). (Christian Brabandt, closes #1411) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0248 +Problem: vim_strcat() cannot handle overlapping arguments. +Solution: Use mch_memmove() instead of strcpy(). (Justin M Keyes, + closes #1415) +Files: src/misc2.c + +Patch 8.0.0249 +Problem: When two submits happen quick after each other, the tests for the + first one may error out. +Solution: Use a git depth of 10 instead of 1. (Christian Brabandt) +Files: .travis.yml + +Patch 8.0.0250 +Problem: When virtcol() gets a column that is not the first byte of a + multi-byte character the result is unpredictable. (Christian + Ludwig) +Solution: Correct the column to the first byte of a multi-byte character. + Change the utf-8 test to new style. +Files: src/charset.c, src/testdir/test_utf8.in, src/testdir/test_utf8.ok, + src/testdir/test_utf8.vim, src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_alot_utf8.vim + +Patch 8.0.0251 +Problem: It is not so easy to write a script that works with both Python 2 + and Python 3, even when the Python code works with both. +Solution: Add 'pyxversion', :pyx, etc. (Marc Weber, Ken Takata) +Files: Filelist, runtime/doc/eval.txt, runtime/doc/if_pyth.txt, + runtime/doc/index.txt, runtime/doc/options.txt, + runtime/optwin.vim, runtime/doc/quickref.txt, + runtime/doc/usr_41.txt, src/Makefile, src/evalfunc.c, + src/ex_cmds.h, src/ex_cmds2.c, src/ex_docmd.c, src/if_python.c, + src/if_python3.c, src/option.c, src/option.h, + src/proto/ex_cmds2.pro, src/testdir/Make_all.mak, + src/testdir/pyxfile/py2_magic.py, + src/testdir/pyxfile/py2_shebang.py, + src/testdir/pyxfile/py3_magic.py, + src/testdir/pyxfile/py3_shebang.py, src/testdir/pyxfile/pyx.py, + src/testdir/test_pyx2.vim, src/testdir/test_pyx3.vim + src/userfunc.c + +Patch 8.0.0252 +Problem: Characters below 256 that are not one byte are not always + recognized as word characters. +Solution: Make vim_iswordc() and vim_iswordp() work the same way. Add a test + for this. (Ozaki Kiichi) +Files: src/Makefile, src/charset.c, src/kword_test.c, src/mbyte.c, + src/proto/mbyte.pro + +Patch 8.0.0253 +Problem: When creating a session when winminheight is 2 or larger and + loading that session gives an error. +Solution: Also set winminheight before setting winheight to 1. (Rafael + Bodill, neovim #5717) +Files: src/ex_docmd.c, src/testdir/test_mksession.vim + +Patch 8.0.0254 +Problem: When using an assert function one can either specify a message or + get a message about what failed, not both. +Solution: Concatenate the error with the message. +Files: src/eval.c, src/testdir/test_assert.vim + +Patch 8.0.0255 +Problem: When calling setpos() with a buffer argument it often is ignored. + (Matthew Malcomson) +Solution: Make the buffer argument work for all marks local to a buffer. + (neovim #5713) Add more tests. +Files: src/mark.c, src/testdir/test_marks.vim, runtime/doc/eval.txt + +Patch 8.0.0256 (after 8.0.0255) +Problem: Tests fail because some changes were not included. +Solution: Add changes to evalfunc.c +Files: src/evalfunc.c + +Patch 8.0.0257 (after 8.0.0252) +Problem: The keyword test file is not included in the archive. +Solution: Update the list of files. +Files: Filelist + +Patch 8.0.0258 (after 8.0.0253) +Problem: mksession test leaves file behind. +Solution: Delete the file. Rename files to start with "X". +Files: src/testdir/test_mksession.vim + +Patch 8.0.0259 +Problem: Tab commands do not handle count correctly. (Ken Hamada) +Solution: Add ADDR_TABS_RELATIVE. (Hirohito Higashi) +Files: runtime/doc/tabpage.txt, src/ex_cmds.h, src/ex_docmd.c, + src/testdir/test_tabpage.vim + +Patch 8.0.0260 +Problem: Build fails with tiny features. +Solution: Move get_tabpage_arg() inside #ifdef. +Files: src/ex_docmd.c + +Patch 8.0.0261 +Problem: Not enough test coverage for eval functions. +Solution: Add more tests. (Dominique Pelle, closes #1420) +Files: src/testdir/test_functions.vim + +Patch 8.0.0262 +Problem: Farsi support is barely tested. +Solution: Add more tests for Farsi. Clean up the code. +Files: src/edit.c, src/farsi.c, src/testdir/test_farsi.vim + +Patch 8.0.0263 +Problem: Farsi support is not tested enough. +Solution: Add more tests for Farsi. Clean up the code. +Files: src/farsi.c, src/testdir/test_farsi.vim + +Patch 8.0.0264 +Problem: Memory error reported by ubsan, probably for using the string + returned by execute(). +Solution: NUL terminate the result of execute(). +Files: src/evalfunc.c + +Patch 8.0.0265 +Problem: May get ml_get error when :pydo deletes lines or switches to + another buffer. (Nikolai Pavlov, issue #1421) +Solution: Check the buffer and line every time. +Files: src/if_py_both.h, src/testdir/test_python2.vim, + src/testdir/test_python3.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0266 +Problem: Compiler warning for using uninitialized variable. +Solution: Set tab_number also when there is an error. +Files: src/ex_docmd.c + +Patch 8.0.0267 +Problem: A channel test sometimes fails on Mac. +Solution: Add the test to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0268 +Problem: May get ml_get error when :luado deletes lines or switches to + another buffer. (Nikolai Pavlov, issue #1421) +Solution: Check the buffer and line every time. +Files: src/if_lua.c, src/testdir/test_lua.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0269 +Problem: May get ml_get error when :perldo deletes lines or switches to + another buffer. (Nikolai Pavlov, issue #1421) +Solution: Check the buffer and line every time. +Files: src/if_perl.xs, src/testdir/test_perl.vim + +Patch 8.0.0270 +Problem: May get ml_get error when :rubydo deletes lines or switches to + another buffer. (Nikolai Pavlov, issue #1421) +Solution: Check the buffer and line every time. +Files: src/if_ruby.c, src/testdir/test_ruby.vim + +Patch 8.0.0271 +Problem: May get ml_get error when :tcldo deletes lines or switches to + another buffer. (Nikolai Pavlov, closes #1421) +Solution: Check the buffer and line every time. +Files: src/if_tcl.c, src/testdir/test_tcl.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0272 +Problem: Crash on exit is not detected when running tests. +Solution: Remove the dash before the command. (Dominique Pelle, closes + #1425) +Files: src/testdir/Makefile + +Patch 8.0.0273 +Problem: Dead code detected by Coverity when not using gnome. +Solution: Rearrange the #ifdefs to avoid dead code. +Files: src/gui_gtk_x11.c + +Patch 8.0.0274 +Problem: When update_single_line() is called recursively, or another screen + update happens while it is busy, errors may occur. +Solution: Check and update updating_screen. (Christian Brabandt) +Files: src/screen.c + +Patch 8.0.0275 +Problem: When checking for CTRL-C typed the GUI may detect a screen resize + and redraw the screen, causing trouble. +Solution: Set updating_screen in ui_breakcheck(). +Files: src/ui.c + +Patch 8.0.0276 +Problem: Checking for FEAT_GUI_GNOME inside GTK 3 code is unnecessary. +Solution: Remove the #ifdef. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 8.0.0277 +Problem: The GUI test may trigger fontconfig and take a long time. +Solution: Set $XDG_CACHE_HOME. (Kazunobu Kuriyama) +Files: src/testdir/unix.vim, src/testdir/test_gui.vim + +Patch 8.0.0278 (after 8.0.0277) +Problem: GUI test fails on MS-Windows. +Solution: Check that tester_HOME exists. +Files: src/testdir/test_gui.vim + +Patch 8.0.0279 +Problem: With MSVC 2015 the dll name is vcruntime140.dll. +Solution: Check the MSVC version and use the right dll name. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 8.0.0280 +Problem: On MS-Windows setting an environment variable with multi-byte + strings does not work well. +Solution: Use wputenv when possible. (Taro Muraoka, Ken Takata) +Files: src/misc1.c, src/os_win32.c, src/os_win32.h, + src/proto/os_win32.pro, src/vim.h + +Patch 8.0.0281 +Problem: MS-Windows files are still using ARGSUSED while most other files + have UNUSED. +Solution: Change ARGSUSED to UNUSED or delete it. +Files: src/os_win32.c, src/gui_w32.c, src/os_mswin.c, src/os_w32exe.c, + src/winclip.c + +Patch 8.0.0282 +Problem: When doing a Visual selection and using "I" to go to insert mode, + CTRL-O needs to be used twice to go to Normal mode. (Coacher) +Solution: Check for the return value of edit(). (Christian Brabandt, + closes #1290) +Files: src/normal.c, src/ops.c + +Patch 8.0.0283 +Problem: The return value of mode() does not indicate that completion is + active in Replace and Insert mode. (Zhen-Huan (Kenny) Hu) +Solution: Add "c" or "x" for two kinds of completion. (Yegappan Lakshmanan, + closes #1397) Test some more modes. +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_functions.vim, src/testdir/test_mapping.vim + +Patch 8.0.0284 +Problem: The Test_collapse_buffers() test failed once, looks like it is + flaky. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0285 (after 8.0.0277) +Problem: Tests fail with tiny build on Unix. +Solution: Only set g:tester_HOME when build with the +eval feature. +Files: src/testdir/unix.vim + +Patch 8.0.0286 +Problem: When concealing is active and the screen is resized in the GUI it + is not immediately redrawn. +Solution: Use update_prepare() and update_finish() from + update_single_line(). +Files: src/screen.c + +Patch 8.0.0287 +Problem: Cannot access the arguments of the current function in debug mode. + (Luc Hermitte) +Solution: use get_funccal(). (Lemonboy, closes #1432, closes #1352) +Files: src/userfunc.c + +Patch 8.0.0288 (after 8.0.0284) +Problem: Errors reported while running tests. +Solution: Put comma in the right place. +Files: src/testdir/runtest.vim + +Patch 8.0.0289 +Problem: No test for "ga" and :ascii. +Solution: Add a test. (Dominique Pelle, closes #1429) +Files: src/Makefile, src/testdir/test_alot.vim, src/testdir/test_ga.vim + +Patch 8.0.0290 +Problem: If a wide character doesn't fit at the end of the screen line, and + the line doesn't fit on the screen, then the cursor position may + be wrong. (anliting) +Solution: Don't skip over wide character. (Christian Brabandt, closes #1408) +Files: src/screen.c + +Patch 8.0.0291 (after 8.0.0282) +Problem: Visual block insertion does not insert in all lines. +Solution: Don't bail out of insert too early. Add a test. (Christian + Brabandt, closes #1290) +Files: src/ops.c, src/testdir/test_visual.vim + +Patch 8.0.0292 +Problem: The stat test is a bit slow. +Solution: Remove a couple of sleep comments and reduce another. +Files: src/testdir/test_stat.vim + +Patch 8.0.0293 +Problem: Some tests have a one or three second wait. +Solution: Reset the 'showmode' option. Use a test time of one to disable + sleep after an error or warning message. +Files: src/misc1.c, src/testdir/runtest.vim, src/testdir/test_normal.vim + +Patch 8.0.0294 +Problem: Argument list is not stored correctly in a session file. + (lgpasquale) +Solution: Use "$argadd" instead of "argadd". (closes #1434) +Files: src/ex_docmd.c, src/testdir/test_mksession.vim + +Patch 8.0.0295 (after 8.0.0293) +Problem: test_viml hangs. +Solution: Put resetting 'more' before sourcing the script. +Files: src/testdir/runtest.vim + +Patch 8.0.0296 +Problem: Bracketed paste can only append, not insert. +Solution: When the cursor is in the first column insert the text. +Files: src/normal.c, src/testdir/test_paste.vim, runtime/doc/term.txt + +Patch 8.0.0297 +Problem: Double free on exit when using a closure. (James McCoy) +Solution: Split free_al_functions in two parts. (closes #1428) +Files: src/userfunc.c, src/structs.h + +Patch 8.0.0298 +Problem: Ex command range with repeated search does not work. (Bruce + DeVisser) +Solution: Skip over \/, \? and \&. +Files: src/ex_docmd.c, src/testdir/test_cmdline.vim + +Patch 8.0.0299 +Problem: When the GUI window is resized Vim does not always take over the + new size. (Luchr) +Solution: Reset new_p_guifont in gui_resize_shell(). Call + gui_may_resize_shell() in the main loop. +Files: src/main.c, src/gui.c + +Patch 8.0.0300 +Problem: Cannot stop diffing hidden buffers. (Daniel Hahler) +Solution: When using :diffoff! make the whole list if diffed buffers empty. + (closes #736) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 8.0.0301 +Problem: No tests for ":set completion" and various errors of the :set + command. +Solution: Add more :set tests. (Dominique Pelle, closes #1440) +Files: src/testdir/test_options.vim + +Patch 8.0.0302 +Problem: Cannot set terminal key codes with :let. +Solution: Make it work. +Files: src/option.c, src/testdir/test_assign.vim + +Patch 8.0.0303 +Problem: Bracketed paste does not work in Visual mode. +Solution: Delete the text before pasting +Files: src/normal.c, src/ops.c, src/proto/ops.pro, + src/testdir/test_paste.vim + +Patch 8.0.0304 (after 8.0.0302) +Problem: Assign test fails in the GUI. +Solution: Skip the test for setting t_k1. +Files: src/testdir/test_assign.vim + +Patch 8.0.0305 +Problem: Invalid memory access when option has duplicate flag. +Solution: Correct pointer computation. (Dominique Pelle, closes #1442) +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0306 +Problem: mode() not sufficiently tested. +Solution: Add more tests. (Yegappan Lakshmanan) +Files: src/testdir/test_functions.vim + +Patch 8.0.0307 +Problem: Asan detects a memory error when EXITFREE is defined. (Dominique + Pelle) +Solution: In getvcol() check for ml_get_buf() returning an empty string. + Also skip adjusting the scroll position. Set "exiting" in + mch_exit() for all systems. +Files: src/charset.c, src/window.c, src/os_mswin.c, src/os_win32.c, + src/os_amiga.c + +Patch 8.0.0308 +Problem: When using a symbolic link, the package path will not be inserted + at the right position in 'runtimepath'. (Dugan Chen, Norio Takagi) +Solution: Resolve symbolic links when finding the right position in + 'runtimepath'. (Hirohito Higashi) +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 8.0.0309 +Problem: Cannot use an empty key in json. +Solution: Allow for using an empty key. +Files: src/json.c, src/testdir/test_json.vim + +Patch 8.0.0310 +Problem: Not enough testing for GUI functionality. +Solution: Add tests for v:windowid and getwinpos[xy](). (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0311 +Problem: Linebreak tests are old style. +Solution: Turn the tests into new style. Share utility functions. (Ozaki + Kiichi, closes #1444) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_breakindent.vim, src/testdir/test_listlbr.in, + src/testdir/test_listlbr.ok, src/testdir/test_listlbr.vim, + src/testdir/test_listlbr_utf8.in, + src/testdir/test_listlbr_utf8.ok, + src/testdir/test_listlbr_utf8.vim, src/testdir/view_util.vim + +Patch 8.0.0312 +Problem: When a json message arrives in pieces, the start is dropped and + the decoding fails. +Solution: Do not drop the start when it is still needed. (Kay Zheng) Add a + test. Reset the timeout when something is received. +Files: src/channel.c, src/testdir/test_channel.vim, src/structs.h, + src/testdir/test_channel_pipe.py + +Patch 8.0.0313 (after 8.0.0310) +Problem: Not enough testing for GUI functionality. +Solution: Add tests for the GUI font. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0314 +Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested. +Solution: Add tests. (Yegappan Lakshmanan) +Files: src/testdir/test_cmdline.vim + +Patch 8.0.0315 +Problem: ":help :[range]" does not work. (Tony Mechelynck) +Solution: Translate to insert a backslash. +Files: src/ex_cmds.c + +Patch 8.0.0316 +Problem: ":help z?" does not work. (Pavol Juhas) +Solution: Remove exception for z?. +Files: src/ex_cmds.c + +Patch 8.0.0317 +Problem: No test for setting 'guifont'. +Solution: Add a test for X11 GUIs. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0318 +Problem: Small mistake in 7x13 font name. +Solution: Use ISO 8859-1 name instead of 10646-1. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0319 +Problem: Insert mode completion does not respect "start" in 'backspace'. +Solution: Check whether backspace can go before where insert started. + (Hirohito Higashi) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0320 +Problem: Warning for unused variable with small build. +Solution: Change #ifdef to exclude FEAT_CMDWIN. (Kazunobu Kuriyama) +Files: src/ex_getln.c + +Patch 8.0.0321 +Problem: When using the tiny version trying to load the matchit plugin + gives an error. On MS-Windows some default mappings fail. +Solution: Add a check if the command used is available. (Christian Brabandt) +Files: runtime/mswin.vim, runtime/macros/matchit.vim + +Patch 8.0.0322 +Problem: Possible overflow with spell file where the tree length is + corrupted. +Solution: Check for an invalid length (suggested by shqking) +Files: src/spellfile.c + +Patch 8.0.0323 +Problem: When running the command line tests there is a one second wait. +Solution: Change an Esc to Ctrl-C. (Yegappan Lakshmanan) +Files: src/testdir/test_cmdline.vim + +Patch 8.0.0324 +Problem: Illegal memory access with "1;y". +Solution: Call check_cursor() instead of check_cursor_lnum(). (Dominique + Pelle, closes #1455) +Files: src/ex_docmd.c, src/testdir/test_cmdline.vim + +Patch 8.0.0325 +Problem: Packadd test does not clean up symlink. +Solution: Delete the link. (Hirohito Higashi) +Files: src/testdir/test_packadd.vim + +Patch 8.0.0326 (after 8.0.0325) +Problem: Packadd test uses wrong directory name. +Solution: Use the variable name value. (Hirohito Higashi) +Files: src/testdir/test_packadd.vim + +Patch 8.0.0327 +Problem: The E11 error message in the command line window is not + translated. +Solution: use _(). (Hirohito Higashi) +Files: src/ex_docmd.c + +Patch 8.0.0328 +Problem: The "zero count" error doesn't have a number. (Hirohito Higashi) +Solution: Give it a number and be more specific about the error. +Files: src/globals.h + +Patch 8.0.0329 +Problem: Xfontset and guifontwide are not tested. +Solution: Add tests. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0330 +Problem: Illegal memory access after "vapo". (Dominique Pelle) +Solution: Fix the cursor column. +Files: src/search.c, src/testdir/test_visual.vim + +Patch 8.0.0331 +Problem: Restoring help snapshot accesses freed memory. (Dominique Pelle) +Solution: Don't restore a snapshot when the window closes. +Files: src/window.c, src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_help.vim + +Patch 8.0.0332 +Problem: GUI test fails on some systems. +Solution: Try different language settings. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0333 +Problem: Illegal memory access when 'complete' ends in a backslash. +Solution: Check for trailing backslash. (Dominique Pelle, closes #1478) +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0334 +Problem: Can't access b:changedtick from a dict reference. +Solution: Make changedtick a member of the b: dict. (inspired by neovim + #6112) +Files: src/structs.h, src/buffer.c, src/edit.c, src/eval.c, + src/evalfunc.c, src/ex_docmd.c, src/main.c, src/globals.h, + src/fileio.c, src/memline.c, src/misc1.c, src/syntax.c, + src/proto/eval.pro, src/testdir/test_changedtick.vim, + src/Makefile, src/testdir/test_alot.vim, src/testdir/test91.in, + src/testdir/test91.ok, src/testdir/test_functions.vim + +Patch 8.0.0335 (after 8.0.0335) +Problem: Functions test fails. +Solution: Use the right buffer number. +Files: src/testdir/test_functions.vim + +Patch 8.0.0336 +Problem: Flags of :substitute not sufficiently tested. +Solution: Test up to two letter flag combinations. (James McCoy, closes + #1479) +Files: src/testdir/test_substitute.vim + +Patch 8.0.0337 +Problem: Invalid memory access in :recover command. +Solution: Avoid access before directory name. (Dominique Pelle, + closes #1488) +Files: src/Makefile, src/memline.c, src/testdir/test_alot.vim, + src/testdir/test_recover.vim + +Patch 8.0.0338 (after 8.0.0337) +Problem: :recover test fails on MS-Windows. +Solution: Use non-existing directory on MS-Windows. +Files: src/testdir/test_recover.vim + +Patch 8.0.0339 +Problem: Illegal memory access with vi' +Solution: For quoted text objects bail out if the Visual area spans more + than one line. +Files: src/search.c, src/testdir/test_visual.vim + +Patch 8.0.0340 +Problem: Not checking return valud of dict_add(). (Coverity) +Solution: Handle a failure. +Files: src/buffer.c + +Patch 8.0.0341 +Problem: When using complete() and typing a character undo is saved after + the character was inserted. (Shougo) +Solution: Save for undo before inserting the character. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0342 +Problem: Double free when compiled with EXITFREE and setting 'ttytype'. +Solution: Avoid setting P_ALLOCED on 'ttytype'. (Dominique Pelle, + closes #1461) +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0343 +Problem: b:changedtick can be unlocked, even though it has no effect. + (Nikolai Pavlov) +Solution: Add a check and error E940. (closes #1496) +Files: src/eval.c, src/testdir/test_changedtick.vim, runtime/doc/eval.txt + +Patch 8.0.0344 +Problem: Unlet command leaks memory. (Nikolai Pavlov) +Solution: Free the memory on error. (closes #1497) +Files: src/eval.c, src/testdir/test_unlet.vim + +Patch 8.0.0345 +Problem: islocked('d.changedtick') does not work. +Solution: Make it work. +Files: src/buffer.c, src/eval.c, src/evalfunc.c, src/vim.h, + src/testdir/test_changedtick.vim, + +Patch 8.0.0346 +Problem: Vim relies on limits.h to be included indirectly, but on Solaris 9 + it may not be. (Ben Fritz) +Solution: Always include limits.h. +Files: src/os_unixx.h, src/vim.h + +Patch 8.0.0347 +Problem: When using CTRL-X CTRL-U inside a comment, the use of the comment + leader may not work. (Klement) +Solution: Save and restore did_ai. (Christian Brabandt, closes #1494) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0348 +Problem: When building with a shadow directory on macOS lacks the + +clipboard feature. +Solution: Link *.m files, specifically os_macosx.m. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 8.0.0349 +Problem: Redrawing errors with GTK 3. +Solution: When updating, first clear all rectangles and then draw them. + (Kazunobu Kuriyama, Christian Ludwig, closes #848) +Files: src/gui_gtk_x11.c + +Patch 8.0.0350 +Problem: Not enough test coverage for Perl. +Solution: Add more Perl tests. (Dominique Perl, closes #1500) +Files: src/testdir/test_perl.vim + +Patch 8.0.0351 +Problem: No test for concatenating an empty string that results from out of + bounds indexing. +Solution: Add a simple test. +Files: src/testdir/test_expr.vim + +Patch 8.0.0352 +Problem: The condition for when a typval needs to be cleared is too + complicated. +Solution: Init the type to VAR_UNKNOWN and clear it always. +Files: src/eval.c + +Patch 8.0.0353 +Problem: If [RO] in the status line is translated to a longer string, it is + trunctted to 4 bytes. +Solution: Skip over the resulting string. (Jente Hidskes, closes #1499) +Files: src/screen.c + +Patch 8.0.0354 +Problem: Test to check that setting termcap key fails sometimes. +Solution: Check for "t_k1" to exist. (Christian Brabandt, closes #1459) +Files: src/testdir/test_assign.vim + +Patch 8.0.0355 +Problem: Using uninitialized memory when 'isfname' is empty. +Solution: Don't call getpwnam() without an argument. (Dominique Pelle, + closes #1464) +Files: src/misc1.c, src/testdir/test_options.vim + +Patch 8.0.0356 (after 8.0.0342) +Problem: Leaking memory when setting 'ttytype'. +Solution: Get free_oldval from the right option entry. +Files: src/option.c + +Patch 8.0.0357 +Problem: Crash when setting 'guicursor' to weird value. +Solution: Avoid negative size. (Dominique Pelle, closes #1465) +Files: src/misc2.c, src/testdir/test_options.vim + +Patch 8.0.0358 +Problem: Invalid memory access in C-indent code. +Solution: Don't go over end of empty line. (Dominique Pelle, closes #1492) +Files: src/edit.c, src/testdir/test_options.vim + +Patch 8.0.0359 +Problem: 'number' and 'relativenumber' are not properly tested. +Solution: Add tests, change old style to new style tests. (Ozaki Kiichi, + closes #1447) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test89.in, src/testdir/test89.ok, + src/testdir/test_alot.vim, src/testdir/test_findfile.vim, + src/testdir/test_number.vim + +Patch 8.0.0360 +Problem: Sometimes VimL is used, which is confusing. +Solution: Consistently use "Vim script". (Hirohito Higashi) +Files: runtime/doc/if_mzsch.txt, runtime/doc/if_pyth.txt, + runtime/doc/syntax.txt, runtime/doc/usr_02.txt, + runtime/doc/version7.txt, src/Makefile, src/eval.c, + src/ex_getln.c, src/if_py_both.h, src/if_xcmdsrv.c, + src/testdir/Make_all.mak, src/testdir/runtest.vim, + src/testdir/test49.vim, src/testdir/test_vimscript.vim, + src/testdir/test_viml.vim + +Patch 8.0.0361 +Problem: GUI initialisation is not sufficiently tested. +Solution: Add the gui_init test. (Kazunobu Kuriyama) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Makefile, + src/testdir/gui_init.vim, src/testdir/setup_gui.vim, + src/testdir/test_gui.vim, src/testdir/test_gui_init.vim, Filelist + +Patch 8.0.0362 (after 8.0.0361) +Problem: Tests fail on MS-Windows. +Solution: Use $*.vim instead of $<. +Files: src/testdir/Make_dos.mak + +Patch 8.0.0363 +Problem: Travis is too slow to keep up with patches. +Solution: Increase git depth to 20 +Files: .travis.yml + +Patch 8.0.0364 +Problem: ]s does not move cursor with two spell errors in one line. (Manuel + Ortega) +Solution: Don't stop search immediately when wrapped, search the line first. + (Ken Takata) Add a test. +Files: src/spell.c, src/Makefile, src/testdir/test_spell.vim, + src/testdir/Make_all.mak + +Patch 8.0.0365 +Problem: Might free a dict item that wasn't allocated. +Solution: Call dictitem_free(). (Nikolai Pavlov) Use this for + b:changedtick. +Files: src/dict.c, src/structs.h, src/buffer.c, src/edit.c, + src/evalfunc.c, src/ex_docmd.c, src/fileio.c, src/main.c, + src/memline.c, src/misc1.c, src/syntax.c + +Patch 8.0.0366 (after 8.0.0365) +Problem: Build fails with tiny features. +Solution: Add #ifdef. +Files: src/buffer.c + +Patch 8.0.0367 +Problem: If configure defines _LARGE_FILES some include files are included + before it is defined. +Solution: Include vim.h first. (Sam Thursfield, closes #1508) +Files: src/gui_at_sb.c, src/gui_athena.c, src/gui_motif.c, src/gui_x11.c, + src/gui_xmdlg.c + +Patch 8.0.0368 +Problem: Not all options are tested with a range of values. +Solution: Generate a test script from the source code. +Files: Filelist, src/gen_opt_test.vim, src/testdir/test_options.vim, + src/Makefile + +Patch 8.0.0369 (after 8.0.0368) +Problem: The 'balloondelay', 'ballooneval' and 'balloonexpr' options are + not defined without the +balloon_eval feature. Testing that an + option value fails does not work for unsupported options. +Solution: Make the options defined but not supported. Don't test if + setting unsupported options fails. +Files: src/option.c, src/gen_opt_test.vim + +Patch 8.0.0370 +Problem: Invalid memory access when setting wildchar empty. +Solution: Avoid going over the end of the option value. (Dominique Pelle, + closes #1509) Make option test check all number options with + empty value. +Files: src/gen_opt_test.vim, src/option.c, src/testdir/test_options.vim + +Patch 8.0.0371 (after 8.0.0365) +Problem: Leaking memory when setting v:completed_item. +Solution: Or the flags instead of setting them. +Files: src/eval.c + +Patch 8.0.0372 +Problem: More options are not always defined. +Solution: Consistently define all possible options. +Files: src/option.c, src/testdir/test_expand_dllpath.vim + +Patch 8.0.0373 +Problem: Build fails without +folding. +Solution: Move misplaced #ifdef. +Files: src/option.c + +Patch 8.0.0374 +Problem: Invalid memory access when using :sc in Ex mode. (Dominique Pelle) +Solution: Avoid the column being negative. Also fix a hang in Ex mode. +Files: src/ex_getln.c, src/ex_cmds.c, src/testdir/test_substitute.vim + +Patch 8.0.0375 +Problem: The "+ register is not tested. +Solution: Add a test using another Vim instance to change the "+ register. + (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0376 +Problem: Size computations in spell file reading are not exactly right. +Solution: Make "len" a "long" and check with LONG_MAX. +Files: src/spellfile.c + +Patch 8.0.0377 +Problem: Possible overflow when reading corrupted undo file. +Solution: Check if allocated size is not too big. (King) +Files: src/undo.c + +Patch 8.0.0378 +Problem: Another possible overflow when reading corrupted undo file. +Solution: Check if allocated size is not too big. (King) +Files: src/undo.c + +Patch 8.0.0379 +Problem: CTRL-Z and mouse click use CTRL-O unnecessary. +Solution: Remove stuffing CTRL-O. (James McCoy, closes #1453) +Files: src/edit.c, src/normal.c + +Patch 8.0.0380 +Problem: With 'linebreak' set and 'breakat' includes ">" a double-wide + character results in "<<" displayed. +Solution: Check for the character not to be replaced. (Ozaki Kiichi, + closes #1456) +Files: src/screen.c, src/testdir/test_listlbr_utf8.vim + +Patch 8.0.0381 +Problem: Diff mode is not sufficiently tested. +Solution: Add more diff mode tests. (Dominique Pelle, closes #1515) +Files: src/testdir/test_diffmode.vim + +Patch 8.0.0382 (after 8.0.0380) +Problem: Warning in tiny build for unused variable. (Tony Mechelynck) +Solution: Add #ifdefs. +Files: src/screen.c + +Patch 8.0.0383 (after 8.0.0382) +Problem: Misplaced #ifdef. (Christ van Willigen) +Solution: Split assignment. +Files: src/screen.c + +Patch 8.0.0384 +Problem: Timer test failed for no apparent reason. +Solution: Mark the test as flaky. +Files: src/testdir/runtest.vim + +Patch 8.0.0385 +Problem: No tests for arabic. +Solution: Add a first test for arabic. (Dominique Pelle, closes #1518) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_arabic.vim + +Patch 8.0.0386 +Problem: Tiny build has a problem with generating the options test. +Solution: Change the "if" to skip over statements. +Files: src/gen_opt_test.vim + +Patch 8.0.0387 +Problem: compiler warnings +Solution: Add type casts. (Christian Brabandt) +Files: src/channel.c, src/memline.c, + +Patch 8.0.0388 +Problem: filtering lines through "cat", without changing the line count, + changes manual folds. +Solution: Change how marks and folds are adjusted. (Matthew Malcomson, from + neovim #6194. +Files: src/fold.c, src/testdir/test_fold.vim + +Patch 8.0.0389 +Problem: Test for arabic does not check what is displayed. +Solution: Improve what is asserted. (Dominique Pelle, closes #1523) + Add a first shaping test. +Files: src/testdir/test_arabic.vim + +Patch 8.0.0390 +Problem: When the window scrolls horizontally when the popup menu is + displayed part of it may not be cleared. (Neovim issue #6184) +Solution: Remove the menu when the windows scrolled. (closes #1524) +Files: src/edit.c + +Patch 8.0.0391 +Problem: Arabic support is verbose and not well tested. +Solution: Simplify the code. Add more tests. +Files: src/arabic.c, src/testdir/test_arabic.vim + +Patch 8.0.0392 +Problem: GUI test fails with Athena and Motif. +Solution: Add test_ignore_error(). Use it to ignore the "failed to create + input context" error. +Files: src/message.c, src/proto/message.pro, src/evalfunc.c, + src/testdir/test_gui.vim, runtime/doc/eval.txt + +Patch 8.0.0393 (after 8.0.0190) +Problem: When the same tag appears more than once, the order is + unpredictable. (Charles Campbell) +Solution: Besides using a dict for finding duplicates, use a grow array for + keeping the tags in sequence. +Files: src/tag.c, src/testdir/test_tagjump.vim + +Patch 8.0.0394 +Problem: Tabs are not aligned when scrolling horizontally and a Tab doesn't + fit. (Axel Bender) +Solution: Handle a Tab as a not fitting character. (Christian Brabandt) + Also fix that ":redraw" does not scroll horizontally to show the + cursor. And fix the test that depended on the old behavior. +Files: src/screen.c, src/ex_docmd.c, src/testdir/test_listlbr.vim, + src/testdir/test_listlbr_utf8.vim, + src/testdir/test_breakindent.vim + +Patch 8.0.0395 (after 8.0.0392) +Problem: Testing the + register fails with Motif. +Solution: Also ignore the "failed to create input context" error in the + second gvim. Don't use msg() when it would result in a dialog. +Files: src/message.c, src/testdir/test_gui.vim, src/testdir/setup_gui.vim + +Patch 8.0.0396 +Problem: 'balloonexpr' only works synchronously. +Solution: Add balloon_show(). (Jusufadis Bakamovic, closes #1449) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/os_unix.c, + src/os_win32.c + +Patch 8.0.0397 (after 8.0.0392) +Problem: Cannot build with the viminfo feature but without the eval + feature. +Solution: Adjust #ifdef. (John Marriott) +Files: src/message.c, src/misc2.c + +Patch 8.0.0398 +Problem: Illegal memory access with "t". +Solution: Use strncmp() instead of memcmp(). (Dominique Pelle, closes #1528) +Files: src/search.c, src/testdir/test_search.vim + +Patch 8.0.0399 +Problem: Crash when using balloon_show() when not supported. (Hirohito + Higashi) +Solution: Check for balloonEval not to be NULL. (Ken Takata) +Files: src/evalfunc.c, src/testdir/test_functions.vim + +Patch 8.0.0400 +Problem: Some tests have a one second delay. +Solution: Add --not-a-term in RunVim(). +Files: src/testdir/shared.vim + +Patch 8.0.0401 +Problem: Test fails with missing balloon feature. +Solution: Add check for balloon feature. +Files: src/testdir/test_functions.vim + +Patch 8.0.0402 +Problem: :map completion does not have <special>. (Dominique Pelle) +Solution: Recognize <special> in completion. Add a test. +Files: src/getchar.c, src/testdir/test_cmdline.vim + +Patch 8.0.0403 +Problem: GUI tests may fail. +Solution: Ignore the E285 error better. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim, src/testdir/test_gui_init.vim + +Patch 8.0.0404 +Problem: Not enough testing for quickfix. +Solution: Add some more tests. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 8.0.0405 +Problem: v:progpath may become invalid after ":cd". +Solution: Turn v:progpath into a full path if needed. +Files: src/main.c, src/testdir/test_startup.vim, runtime/doc/eval.txt + +Patch 8.0.0406 +Problem: The arabic shaping code is verbose. +Solution: Shorten the code without changing the functionality. +Files: src/arabic.c + +Patch 8.0.0407 (after 8.0.0388) +Problem: Filtering folds with marker method not tested. +Solution: Also set 'foldmethod' to "marker". +Files: src/testdir/test_fold.vim + +Patch 8.0.0408 +Problem: Updating folds does not work properly when inserting a file and a + few other situations. +Solution: Adjust the way folds are updated. (Matthew Malcomson) +Files: src/fold.c, src/testdir/test_fold.vim + +Patch 8.0.0409 +Problem: set_progpath is defined but not always used +Solution: Adjust #ifdef. +Files: src/main.c + +Patch 8.0.0410 +Problem: Newer gettext/iconv library has extra dll file. +Solution: Add the file to the Makefile and nsis script. (Christian Brabandt) +Files: Makefile, nsis/gvim.nsi + +Patch 8.0.0411 +Problem: We can't change the case in menu entries, it breaks translations. +Solution: Ignore case when looking up a menu translation. +Files: src/menu.c, src/testdir/test_menu.vim + +Patch 8.0.0412 (after 8.0.0411) +Problem: Menu test fails on MS-Windows. +Solution: Use a menu entry with only ASCII characters. +Files: src/testdir/test_menu.vim + +Patch 8.0.0413 (after 8.0.0412) +Problem: Menu test fails on MS-Windows using gvim. +Solution: First delete the English menus. +Files: src/testdir/test_menu.vim + +Patch 8.0.0414 +Problem: Balloon eval is not tested. +Solution: Add a few balloon tests. (Kazunobu Kuriyama) +Files: src/testdir/test_gui.vim + +Patch 8.0.0415 (after 8.0.0414) +Problem: Balloon test fails on MS-Windows. +Solution: Test with 0x7fffffff instead of 0xffffffff. +Files: src/testdir/test_gui.vim + +Patch 8.0.0416 +Problem: Setting v:progpath is not quite right. +Solution: On MS-Windows add the extension. On Unix use the full path for a + relative directory. (partly by James McCoy, closes #1531) +Files: src/main.c, src/os_win32.c, src/os_unix.c + +Patch 8.0.0417 +Problem: Test for the clipboard fails sometimes. +Solution: Add it to the flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0418 +Problem: ASAN logs are disabled and don't cause a failure. +Solution: Enable ASAN logs and fail if not empty. (James McCoy, + closes #1425) +Files: .travis.yml + +Patch 8.0.0419 +Problem: Test for v:progpath fails on MS-Windows. +Solution: Expand to full path. Also add ".exe" when the path is an absolute + path. +Files: src/os_win32.c, src/main.c + +Patch 8.0.0420 +Problem: When running :make the output may be in the system encoding, + different from 'encoding'. +Solution: Add the 'makeencoding' option. (Ken Takata) +Files: runtime/doc/options.txt, runtime/doc/quickfix.txt, + runtime/doc/quickref.txt, src/Makefile, src/buffer.c, + src/if_cscope.c, src/main.c, src/option.c, src/option.h, + src/proto/quickfix.pro, src/quickfix.c, src/structs.h, + src/testdir/Make_all.mak, src/testdir/test_makeencoding.py, + src/testdir/test_makeencoding.vim + +Patch 8.0.0421 +Problem: Diff mode is displayed wrong when adding a line at the end of a + buffer. +Solution: Adjust marks in diff mode. (James McCoy, closes #1329) +Files: src/misc1.c, src/ops.c, src/testdir/test_diffmode.vim + +Patch 8.0.0422 +Problem: Python test fails with Python 3.6. +Solution: Convert new exception messages to old ones. (closes #1359) +Files: src/testdir/test87.in + +Patch 8.0.0423 +Problem: The effect of adding "#" to 'cinoptions' is not always removed. + (David Briscoe) +Solution: Reset b_ind_hash_comment. (Christian Brabandt, closes #1475) +Files: src/misc1.c, src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_cindent.vim, src/testdir/test3.in + +Patch 8.0.0424 +Problem: Compiler warnings on MS-Windows. (Ajit Thakkar) +Solution: Add type casts. +Files: src/os_win32.c + +Patch 8.0.0425 +Problem: Build errors when building without folding. +Solution: Add #ifdefs. (John Marriott) +Files: src/diff.c, src/edit.c, src/option.c, src/syntax.c + +Patch 8.0.0426 +Problem: Insufficient testing for statusline. +Solution: Add several tests. (Dominique Pelle, closes #1534) +Files: src/testdir/test_statusline.vim + +Patch 8.0.0427 +Problem: 'makeencoding' missing from the options window. +Solution: Add the entry. +Files: runtime/optwin.vim + +Patch 8.0.0428 +Problem: Git and hg see new files after running tests. (Manuel Ortega) +Solution: Add the generated file to .hgignore (or .gitignore). Delete the + resulting verbose file. (Christian Brabandt) Improve dependency + on opt_test.vim. Reset the 'more' option. +Files: .hgignore, src/gen_opt_test.vim, src/testdir/gen_opt_test.vim, + src/Makefile, src/testdir/Make_all.mak, src/testdir/Makefile, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, + Filelist + +Patch 8.0.0429 +Problem: Options test does not always test everything. +Solution: Fix dependency for opt_test.vim. Give a message when opt_test.vim + was not found. +Files: src/testdir/test_options.vim, src/testdir/gen_opt_test.vim, + src/testdir/Makefile, src/testdir/Make_all.mak, + src/testdir/Make_dos.mak, src/testdir/Make_ming.mak + +Patch 8.0.0430 +Problem: Options test fails or hangs on MS-Windows. +Solution: Run it separately instead of part of test_alot. Use "-S" instead + of "-u" to run the script. Fix failures. +Files: src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/Makefile, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/gen_opt_test.vim + +Patch 8.0.0431 +Problem: 'cinoptions' cannot set indent for extern block. +Solution: Add the "E" flag in 'cinoptions'. (Hirohito Higashi) +Files: runtime/doc/indent.txt, src/misc1.c, src/structs.h, + src/testdir/test_cindent.vim + +Patch 8.0.0432 +Problem: "make shadow" creates an invalid link. +Solution: Don't link "*.vim". (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 8.0.0433 +Problem: Quite a few beeps when running tests. +Solution: Set 'belloff' for these tests. (Christian Brabandt) +Files: src/testdir/test103.in, src/testdir/test14.in, + src/testdir/test29.in, src/testdir/test30.in, + src/testdir/test32.in, src/testdir/test45.in, + src/testdir/test72.in, src/testdir/test73.in, + src/testdir/test77.in, src/testdir/test78.in, + src/testdir/test85.in, src/testdir/test94.in, + src/testdir/test_alot.vim, src/testdir/test_alot_utf8.vim, + src/testdir/test_close_count.in, src/testdir/test_cmdline.vim, + src/testdir/test_diffmode.vim, src/testdir/test_digraph.vim, + src/testdir/test_erasebackword.in, src/testdir/test_normal.vim, + src/testdir/test_packadd.vim, src/testdir/test_search.vim, + src/testdir/test_textobjects.vim, src/testdir/test_undo.vim, + src/testdir/test_usercommands.vim, src/testdir/test_visual.vim + +Patch 8.0.0434 +Problem: Clang version not correctly detected. +Solution: Adjust the configure script. (Kazunobu Kuriyama) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.0435 +Problem: Some functions are not tested. +Solution: Add more tests for functions. (Dominique Pelle, closes #1541) +Files: src/testdir/test_functions.vim + +Patch 8.0.0436 +Problem: Running the options test sometimes resizes the terminal. +Solution: Clear out t_WS. +Files: src/testdir/gen_opt_test.vim + +Patch 8.0.0437 +Problem: The packadd test does not create the symlink correctly and does + not test the right thing. +Solution: Create the directory and symlink correctly. +Files: src/testdir/test_packadd.vim + +Patch 8.0.0438 +Problem: The fnamemodify test changes 'shell' in a way later tests may not + be able to use system(). +Solution: Save and restore 'shell'. +Files: src/testdir/test_fnamemodify.vim + +Patch 8.0.0439 +Problem: Using ":%argdel" while the argument list is already empty gives an + error. (Pavol Juhas) +Solution: Don't give an error. (closes #1546) +Files: src/ex_cmds2.c, src/testdir/test_arglist.vim + +Patch 8.0.0440 +Problem: Not enough test coverage in Insert mode. +Solution: Add lots of tests. Add test_override(). (Christian Brabandt, + closes #1521) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/edit.c, + src/evalfunc.c, src/globals.h, src/screen.c, + src/testdir/Make_all.mak, src/testdir/test_cursor_func.vim, + src/testdir/test_edit.vim, src/testdir/test_search.vim, + src/testdir/test_assert.vim, src/Makefile, src/testdir/runtest.vim + +Patch 8.0.0441 +Problem: Dead code in #ifdef. +Solution: Remove the #ifdef and #else part. +Files: src/option.c + +Patch 8.0.0442 +Problem: Patch shell command uses double quotes around the argument, which + allows for $HOME to be expanded. (Etienne) +Solution: Use single quotes on Unix. (closes #1543) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 8.0.0443 +Problem: Terminal width is set to 80 in test3. +Solution: Instead of setting 'columns' set 'wrapmargin' depending on + 'columns. +Files: src/testdir/test3.in + +Patch 8.0.0444 (after 8.0.0442) +Problem: Diffpatch fails when the file name has a quote. +Solution: Escape the name properly. (zetzei) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 8.0.0445 +Problem: Getpgid is not supported on all systems. +Solution: Add a configure check. +Files: src/configure.ac, src/auto/configure, src/config.h.in, + src/os_unix.c + +Patch 8.0.0446 +Problem: The ";" command does not work after characters with a lower byte + that is NUL. +Solution: Properly check for not having a previous character. (Hirohito + Higashi) +Files: src/Makefile, src/search.c, src/testdir/test_alot_utf8.vim, + src/testdir/test_charsearch_utf8.vim + +Patch 8.0.0447 +Problem: Getting font name does not work on X11. +Solution: Implement gui_mch_get_fontname() for X11. Add more GUI tests. + (Kazunobu Kuriyama) +Files: src/gui_x11.c, src/syntax.c, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Makefile, + src/testdir/gui_init.vim, src/testdir/gui_preinit.vim, + src/testdir/test_gui.vim, src/testdir/test_gui_init.vim, + Filelist + +Patch 8.0.0448 +Problem: Some macros are in lower case, which can be confusing. +Solution: Make a few lower case macros upper case. +Files: src/macros.h, src/buffer.c, src/charset.c, src/ops.c, src/diff.c, + src/edit.c, src/evalfunc.c, src/ex_cmds.c, src/ex_getln.c, + src/fileio.c, src/fold.c, src/gui.c, src/gui_beval.c, src/main.c, + src/mark.c, src/misc1.c, src/move.c, src/normal.c, + src/option.c, src/popupmnu.c, src/regexp.c, src/screen.c, + src/search.c, src/spell.c, src/tag.c, src/ui.c, src/undo.c, + src/version.c, src/workshop.c, src/if_perl.xs + +Patch 8.0.0449 (after 8.0.0448) +Problem: Part of fold patch accidentally included. +Solution: Revert that part of the patch. +Files: src/ex_cmds.c + +Patch 8.0.0450 +Problem: v:progpath is not reliably set. +Solution: Read /proc/self/exe if possible. (idea by Michal Grochmal) + Also fixes missing #if. +Files: src/main.c, src/config.h.in + +Patch 8.0.0451 +Problem: Some macros are in lower case. +Solution: Make a few more macros upper case. Avoid lower case macros use an + argument twice. +Files: src/macros.h, src/charset.c, src/misc2.c, src/proto/misc2.pro, + src/edit.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/fold.c, + src/gui.c, src/gui_gtk.c, src/mark.c, src/memline.c, src/mbyte.c, + src/menu.c, src/message.c, src/misc1.c, src/ops.c, src/option.c, + src/os_amiga.c, src/os_mswin.c, src/os_unix.c, src/os_win32.c, + src/popupmnu.c, src/regexp.c, src/regexp_nfa.c, src/screen.c, + src/search.c, src/spell.c, src/spellfile.c, src/syntax.c, + src/tag.c, src/ui.c, src/undo.c, src/window.c + +Patch 8.0.0452 +Problem: Some macros are in lower case. +Solution: Make a few more macros upper case. +Files: src/vim.h, src/macros.h, src/evalfunc.c, src/fold.c, + src/gui_gtk.c, src/gui_gtk_x11.c, src/charset.c, src/diff.c, + src/edit.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/getchar.c, + src/gui.c, src/gui_w32.c, src/if_cscope.c, src/mbyte.c, + src/menu.c, src/message.c, src/misc1.c, src/misc2.c, src/normal.c, + src/ops.c, src/option.c, src/os_unix.c, src/os_win32.c, + src/quickfix.c, src/regexp.c, src/regexp_nfa.c, src/screen.c, + src/search.c, src/spell.c, src/syntax.c, src/tag.c, src/userfunc.c + +Patch 8.0.0453 +Problem: Adding fold marker creates new comment. +Solution: Use an existing comment if possible. (LemonBoy, closes #1549) +Files: src/ops.c, src/proto/ops.pro, src/fold.c, + src/testdir/test_fold.vim + +Patch 8.0.0454 +Problem: Compiler warnings for comparing unsigned char with 256 always + being true. (Manuel Ortega) +Solution: Add type cast. +Files: src/screen.c, src/charset.c + +Patch 8.0.0455 +Problem: The mode test may hang in Test_mode(). (Michael Soyka) +Solution: Set 'complete' to only search the current buffer (as suggested by + Michael) +Files: src/testdir/test_functions.vim + +Patch 8.0.0456 +Problem: Typo in MinGW test makefile. +Solution: Change an underscore to a dot. (Michael Soyka) +Files: src/testdir/Make_ming.mak + +Patch 8.0.0457 +Problem: Using :move messes up manual folds. +Solution: Split adjusting marks and folds. Add foldMoveRange(). (neovim + patch #6221) +Files: src/ex_cmds.c, src/fold.c, src/mark.c, src/proto/fold.pro, + src/proto/mark.pro src/testdir/test_fold.vim + +Patch 8.0.0458 +Problem: Potential crash if adding list or dict to dict fails. +Solution: Make sure the reference count is correct. (Nikolai Pavlov, closes + #1555) +Files: src/dict.c + +Patch 8.0.0459 (after 8.0.0457) +Problem: Old fix for :move messing up folding no longer needed, now that we + have a proper solution. +Solution: Revert patch 7.4.700. (Christian Brabandt) +Files: src/ex_cmds.c + +Patch 8.0.0460 (after 8.0.0452) +Problem: Can't build on HPUX. +Solution: Fix argument names in vim_stat(). (John Marriott) +Files: src/misc2.c + +Patch 8.0.0461 (after 8.0.0457) +Problem: Test 45 hangs on MS-Windows. +Solution: Reset 'shiftwidth'. Also remove redundent function. +Files: src/fold.c, src/testdir/test45.in + +Patch 8.0.0462 +Problem: If an MS-Windows tests succeeds at first and then fails in a way + it does not produce a test.out file it looks like the test + succeeded. +Solution: Delete the previous output file. +Files: src/testdir/Make_dos.mak + +Patch 8.0.0463 +Problem: Resetting 'compatible' in defaults.vim has unexpected side + effects. (David Fishburn) +Solution: Only reset 'compatible' if it was set. +Files: runtime/defaults.vim + +Patch 8.0.0464 +Problem: Can't find executable name on Solaris and FreeBSD. +Solution: Check for "/proc/self/path/a.out". (Danek Duvall) And for + "/proc/curproc/file". +Files: src/config.h.in, src/configure.ac, src/main.c, + src/auto/configure + +Patch 8.0.0465 +Problem: Off-by-one error in using :move with folding. +Solution: Correct off-by-one mistakes and add more tests. (Matthew + Malcomson) +Files: src/fold.c, src/testdir/test_fold.vim + +Patch 8.0.0466 +Problem: There are still a few macros that should be all-caps. +Solution: Make a few more macros all-caps. +Files: src/buffer.c, src/edit.c, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_docmd.c, src/ex_getln.c, src/farsi.c, src/fileio.c, + src/getchar.c, src/gui_beval.c, src/hardcopy.c, src/if_cscope.c, + src/if_xcmdsrv.c, src/mark.c, src/memline.c, src/menu.c, + src/message.c, src/misc1.c, src/normal.c, src/ops.c, src/option.c, + src/quickfix.c, src/screen.c, src/search.c, src/syntax.c, + src/tag.c, src/term.c, src/term.h, src/ui.c, src/undo.c, + src/userfunc.c, src/version.c, src/vim.h + +Patch 8.0.0467 +Problem: Using g< after :for does not show the right output. (Marcin + Szamotulski) +Solution: Call msg_sb_eol() in :echomsg. +Files: src/eval.c + +Patch 8.0.0468 +Problem: After aborting an Ex command g< does not work. (Marcin + Szamotulski) +Solution: Postpone clearing scrollback messages to until the command line + has been entered. Also fix that the screen isn't redrawn if after + g< the command line is cancelled. +Files: src/message.c, src/proto/message.pro, src/ex_getln.c, src/misc2.c, + src/gui.c + +Patch 8.0.0469 +Problem: Compiler warnings on MS-Windows. +Solution: Add type casts. (Christian Brabandt) +Files: src/fold.c + +Patch 8.0.0470 +Problem: Not enough testing for help commands. +Solution: Add a few more help tests. (Dominique Pelle, closes #1565) +Files: src/testdir/test_help.vim, src/testdir/test_help_tagjump.vim + +Patch 8.0.0471 +Problem: Exit callback test sometimes fails. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0472 +Problem: When a test fails and test.log is created, Test_edit_CTRL_I + matches it instead of test1.in. +Solution: Match with runtest.vim instead. +Files: src/testdir/test_edit.vim + +Patch 8.0.0473 +Problem: No test covering arg_all(). +Solution: Add a test expanding ##. +Files: src/testdir/test_arglist.vim + +Patch 8.0.0474 +Problem: The client-server feature is not tested. +Solution: Add a test. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/shared.vim, + src/testdir/test_clientserver.vim, src/os_mswin.c + +Patch 8.0.0475 +Problem: Not enough testing for the client-server feature. +Solution: Add more tests. Add the remote_startserver() function. Fix that + a locally evaluated expression uses function-local variables. +Files: src/if_xcmdsrv.c, src/evalfunc.c, src/os_mswin.c, + src/proto/main.pro, src/testdir/test_clientserver.vim, + runtime/doc/eval.txt + +Patch 8.0.0476 (after 8.0.0475) +Problem: Missing change to main.c. +Solution: Add new function. +Files: src/main.c + +Patch 8.0.0477 +Problem: The client-server test may hang when failing. +Solution: Set a timer. Add assert_report() +Files: src/testdir/test_clientserver.vim, src/testdir/runtest.vim, + src/eval.c, src/evalfunc.c, src/proto/eval.pro, src/if_xcmdsrv.c, + src/os_mswin.c, runtime/doc/eval.txt + +Patch 8.0.0478 +Problem: Tests use assert_true(0) and assert_false(1) to report errors. +Solution: Use assert_report(). +Files: src/testdir/test_cscope.vim, src/testdir/test_expr.vim, + src/testdir/test_perl.vim, src/testdir/test_channel.vim, + src/testdir/test_cursor_func.vim, src/testdir/test_gui.vim, + src/testdir/test_menu.vim, src/testdir/test_popup.vim, + src/testdir/test_viminfo.vim, src/testdir/test_vimscript.vim, + src/testdir/test_assert.vim + +Patch 8.0.0479 +Problem: remote_peek() is not tested. +Solution: Add a test. +Files: src/testdir/test_clientserver.vim, src/testdir/runtest.vim + +Patch 8.0.0480 +Problem: The remote_peek() test fails on MS-Windows. +Solution: Check for pending messages. Also report errors in the first run if + a flaky test fails twice. +Files: src/os_mswin.c, src/testdir/runtest.vim + +Patch 8.0.0481 +Problem: Unnecessary if statement. +Solution: Remove the statement. Fix "it's" vs "its" mistakes. (Dominique + Pelle, closes #1568) +Files: src/syntax.c + +Patch 8.0.0482 +Problem: The setbufvar() function may mess up the window layout. (Kay Z.) +Solution: Do not check the window to be valid if it is NULL. +Files: src/window.c, src/testdir/test_functions.vim + +Patch 8.0.0483 +Problem: Illegal memory access when using :all. (Dominique Pelle) +Solution: Adjust the cursor position right after setting "curwin". +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 8.0.0484 +Problem: Using :lhelpgrep with an argument that should fail does not + produce an error if the previous :helpgrep worked. +Solution: Use another way to detect that autocommands made the quickfix info + invalid. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0485 +Problem: Not all windows commands are tested. +Solution: Add more tests for windows commands. (Dominique Pelle, + closes #1575) Run test_autocmd separately, it interferes with + other tests. Fix tests that depended on side effects. +Files: src/testdir/test_window_cmd.vim, src/testdir/test_alot.vim, + src/testdir/test_autocmd.vim, src/testdir/test_fnamemodify.vim, + src/testdir/test_functions.vim, src/testdir/test_delete.vim, + src/testdir/Make_all.mak + +Patch 8.0.0486 +Problem: Crash and endless loop when closing windows in a SessionLoadPost + autocommand. +Solution: Check for valid tabpage. (partly neovim #6308) +Files: src/testdir/test_autocmd.vim, src/fileio.c, src/proto/window.pro, + src/window.c + +Patch 8.0.0487 +Problem: The autocmd test hangs on MS-Windows. +Solution: Skip the hanging tests for now. +Files: src/testdir/test_autocmd.vim + +Patch 8.0.0488 +Problem: Running tests leaves an "xxx" file behind. +Solution: Delete the 'verbosefile' after resetting the option. +Files: src/testdir/gen_opt_test.vim + +Patch 8.0.0489 +Problem: Clipboard and "* register is not tested. +Solution: Add a test for Mac and X11. (Kazunobu Kuriyama) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/test_quotestar.vim, src/testdir/runtest.vim + +Patch 8.0.0490 +Problem: Splitting a 'winfixwidth' window vertically makes it one column + smaller. (Dominique Pelle) +Solution: Add one to the width for the separator. +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 8.0.0491 +Problem: The quotestar test fails when a required feature is missing. +Solution: Prepend "Skipped" to the thrown exception. +Files: src/testdir/test_quotestar.vim + +Patch 8.0.0492 +Problem: A failing client-server request can make Vim hang. +Solution: Add a timeout argument to functions that wait. +Files: src/evalfunc.c, src/if_xcmdsrv.c, src/proto/if_xcmdsrv.pro, + src/main.c, src/os_mswin.c, src/proto/os_mswin.pro, + src/vim.h, runtime/doc/eval.txt, src/testdir/test_clientserver.vim + +Patch 8.0.0493 +Problem: Crash with cd command with very long argument. +Solution: Check for running out of space. (Dominique pending, closes #1576) +Files: src/testdir/test_alot.vim, src/testdir/test_cd.vim, src/Makefile, + src/misc2.c + +Patch 8.0.0494 +Problem: Build failure with older compiler on MS-Windows. +Solution: Move declaration to start of block. +Files: src/evalfunc.c, src/main.c, src/os_mswin.c + +Patch 8.0.0495 +Problem: The quotestar test uses a timer instead of a timeout, thus it + cannot be rerun like a flaky test. +Solution: Remove the timer and add a timeout. (Kazunobu Kuriyama) +Files: src/testdir/test_quotestar.vim + +Patch 8.0.0496 +Problem: Insufficient testing for folding. +Solution: Add a couple more fold tests. (Dominique Pelle, closes #1579) +Files: src/testdir/test_fold.vim + +Patch 8.0.0497 +Problem: Arabic support is not fully tested. +Solution: Add more tests for the untested functions. Comment out + unreachable code. +Files: src/arabic.c, src/testdir/test_arabic.vim + +Patch 8.0.0498 +Problem: Two autocmd tests are skipped on MS-Windows. +Solution: Make the test pass on MS-Windows. Write the messages in a file + instead of getting the output of system(). +Files: src/testdir/test_autocmd.vim + +Patch 8.0.0499 +Problem: taglist() does not prioritize tags for a buffer. +Solution: Add an optional buffer argument. (Duncan McDougall, closes #1194) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/proto/tag.pro, + src/Makefile, src/tag.c, src/testdir/test_alot.vim, + src/testdir/test_taglist.vim + +Patch 8.0.0500 +Problem: Quotestar test is still a bit flaky. +Solution: Add a slower check for v:version. +Files: src/testdir/test_quotestar.vim + +Patch 8.0.0501 +Problem: On MS-Windows ":!start" does not work as expected. +Solution: When creating a process fails try passing the argument to + ShellExecute(). (Katsuya Hino, closes #1570) +Files: runtime/doc/os_win32.txt, src/os_win32.c + +Patch 8.0.0502 +Problem: Coverity complains about possible NULL pointer. +Solution: Add an assert(), let's see if this works on all systems. +Files: src/window.c + +Patch 8.0.0503 +Problem: Endless loop in updating folds with 32 bit ints. +Solution: Subtract from LHS instead of add to the RHS. (Matthew Malcomson) +Files: src/fold.c + +Patch 8.0.0504 +Problem: Looking up an Ex command is a bit slow. +Solution: Instead of just using the first letter, also use the second letter + to skip ahead in the list of commands. Generate the table with a + Perl script. (Dominique Pelle, closes #1589) +Files: src/Makefile, src/create_cmdidxs.pl, src/ex_docmd.c, Filelist + +Patch 8.0.0505 +Problem: Failed window split for :stag not handled. (Coverity CID 99204) +Solution: If the split fails skip to the end. (bstaletic, closes #1577) +Files: src/tag.c + +Patch 8.0.0506 (after 8.0.0504) +Problem: Can't build with ANSI C. +Solution: Move declarations to start of block. +Files: src/ex_docmd.c + +Patch 8.0.0507 +Problem: Client-server tests fail when $DISPLAY is not set. +Solution: Check for E240 before running the test. +Files: src/testdir/test_quotestar.vim, src/testdir/test_clientserver.vim + +Patch 8.0.0508 +Problem: Coveralls no longer shows per-file coverage. +Solution: Add coverage from codecov.io. (Christian Brabandt) +Files: .travis.yml + +Patch 8.0.0509 +Problem: No link to codecov.io results. +Solution: Add a badge to the readme file. +Files: README.md + +Patch 8.0.0510 (after 8.0.0509) +Problem: Typo in link to codecov.io results. +Solution: Remove duplicate https:. +Files: README.md + +Patch 8.0.0511 +Problem: Menuage for skipping client-server tests is unclear. +Solution: Be more specific about what's missing (Hirohito Higashi, Kazunobu + Kuriyama) +Files: src/testdir/test_quotestar.vim, src/testdir/test_clientserver.vim + +Patch 8.0.0512 +Problem: Check for available characters takes too long. +Solution: Only check did_start_blocking if wtime is negative. (Daisuke + Suzuki, closes #1591) +Files: src/os_unix.c + +Patch 8.0.0513 (after 8.0.0201) +Problem: Getting name of cleared highlight group is wrong. (Matt Wozniski) +Solution: Only skip over cleared names for completion. (closes #1592) + Also fix that a cleared group causes duplicate completions. +Files: src/syntax.c, src/proto/syntax.pro, src/evalfunc.c, + src/ex_cmds.c, src/testdir/test_syntax.vim, + src/testdir/test_cmdline.vim + +Patch 8.0.0514 +Problem: Script for creating cmdidxs can be improved. +Solution: Count skipped lines instead of collecting the lines. Add "const". + (Dominique Pelle, closes #1594) +Files: src/create_cmdidxs.pl, src/ex_docmd.c + +Patch 8.0.0515 +Problem: ml_get errors in silent Ex mode. (Dominique Pelle) +Solution: Clear valid flags when setting the cursor. Set the topline when + not in full screen mode. +Files: src/ex_docmd.c, src/move.c, src/testdir/test_startup.vim + +Patch 8.0.0516 +Problem: A large count on a normal command causes trouble. (Dominique + Pelle) +Solution: Make "opcount" long. +Files: src/globals.h, src/testdir/test_normal.vim + +Patch 8.0.0517 +Problem: There is no way to remove quickfix lists (for testing). +Solution: Add the 'f' action to setqflist(). Add tests. (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0518 +Problem: Storing a zero byte from a multi-byte character causes fold text + to show up wrong. +Solution: Avoid putting zero in ScreenLines. (Christian Brabandt, + closes #1567) +Files: src/screen.c, src/testdir/test_display.vim + +Patch 8.0.0519 +Problem: Character classes are not well tested. They can differ between + platforms. +Solution: Add tests. In the documentation make clear which classes depend + on what library function. Only use :cntrl: and :graph: for ASCII. + (Kazunobu Kuriyama, Dominique Pelle, closes #1560) + Update the documentation. +Files: src/regexp.c, src/regexp_nfa.c, runtime/doc/pattern.txt, + src/testdir/test_regexp_utf8.vim + +Patch 8.0.0520 +Problem: Using a function pointer instead of the actual function, which we + know. +Solution: Change mb_ functions to utf_ functions when already checked for + Unicode. (Dominique Pelle, closes #1582) +Files: src/message.c, src/misc2.c, src/regexp.c, src/regexp_nfa.c, + src/screen.c, src/spell.c + +Patch 8.0.0521 +Problem: GtkForm handling is outdated. +Solution: Get rid of event filter functions. Get rid of GtkForm.width and + .height. Eliminate gtk_widget_size_request() calls. (Kazunobu + Kuriyama) +Files: src/gui_gtk_f.c, src/gui_gtk_f.h + +Patch 8.0.0522 +Problem: MS-Windows: when 'clipboard' is "unnamed" yyp does not work in a + :global command. +Solution: When setting the clipboard was postponed, do not clear the + register. +Files: src/ops.c, src/proto/ui.pro, src/ui.c, src/globals.h, + src/testdir/test_global.vim, src/Makefile, + src/testdir/test_alot.vim + +Patch 8.0.0523 +Problem: dv} deletes part of a multi-byte character. (Urtica Dioica) +Solution: Include the whole character. +Files: src/search.c, src/testdir/test_normal.vim + +Patch 8.0.0524 (after 8.0.0518) +Problem: Folds are messed up when 'encodin' is "utf-8". +Solution: Also set the fold character when it's not multi-byte. +Files: src/screen.c, src/testdir/test_display.vim + +Patch 8.0.0525 +Solution: Completion for user command argument not tested. +Problem: Add a test. +Files: src/testdir/test_cmdline.vim + +Patch 8.0.0526 +Problem: Coverity complains about possible negative value. +Solution: Check return value of ftell() not to be negative. +Files: src/os_unix.c + +Patch 8.0.0527 +Problem: RISC OS support was removed long ago, but one file is still + included. +Solution: Delete the file. (Thomas Dziedzic, closes #1603) +Files: Filelist, src/swis.s + +Patch 8.0.0528 +Problem: When 'wildmenu' is set and 'wildmode' has "longest" then the first + file name is highlighted, even though the text shows the longest + match. +Solution: Do not highlight the first match. (LemonBoy, closes #1602) +Files: src/ex_getln.c + +Patch 8.0.0529 +Problem: Line in test commented out. +Solution: Uncomment the lines for character classes that were failing before + 8.0.0519. (Dominique Pelle, closes #1599) +Files: src/testdir/test_regexp_utf8.vim + +Patch 8.0.0530 +Problem: Buffer overflow when 'columns' is very big. (Nikolai Pavlov) +Solution: Correctly compute where to truncate. Fix translation. + (closes #1600) +Files: src/edit.c, src/testdir/test_edit.vim + +Patch 8.0.0531 (after 8.0.0530) +Problem: Test with long directory name fails on non-unix systems. +Solution: Skip the test on non-unix systems. +Files: src/testdir/test_edit.vim + +Patch 8.0.0532 (after 8.0.0531) +Problem: Test with long directory name fails on Mac. +Solution: Skip the test on Mac systems. +Files: src/testdir/test_edit.vim + +Patch 8.0.0533 +Problem: Abbreviation doesn't work after backspacing newline. (Hkonrk) +Solution: Set the insert start column. (closes #1609) +Files: src/testdir/test_mapping.vim, src/edit.c + +Patch 8.0.0534 +Problem: Defaults.vim does not work well with tiny features. (crd477) +Solution: When the +eval feature is not available always reset 'compatible'. +Files: runtime/defaults.vim + +Patch 8.0.0535 +Problem: Memory leak when exiting from within a user function. +Solution: Clear the function call stack on exit. +Files: src/userfunc.c + +Patch 8.0.0536 +Problem: Quickfix window not updated when freeing quickfix stack. +Solution: Update the quickfix window. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0537 +Problem: Illegal memory access with :z and large count. +Solution: Check for number overflow, using long instead of int. (Dominique + Pelle, closes #1612) +Files: src/Makefile, src/ex_cmds.c, src/testdir/test_alot.vim, + src/testdir/test_ex_z.vim + +Patch 8.0.0538 +Problem: No test for falling back to default term value. +Solution: Add a test. +Files: src/testdir/test_startup.vim + +Patch 8.0.0539 (after 8.0.0538) +Problem: Startup test fails on Mac. +Solution: Use another term name, "unknown" is known. Avoid a 2 second delay. +Files: src/testdir/test_startup.vim, src/main.c, src/proto/main.pro, + src/term.c + +Patch 8.0.0540 (after 8.0.0540) +Problem: Building unit tests fails. +Solution: Move params outside of #ifdef. +Files: src/main.c, src/message_test.c + +Patch 8.0.0541 +Problem: Compiler warning on MS-Windows. +Solution: Add a type cast. (Mike Williams) +Files: src/edit.c + +Patch 8.0.0542 +Problem: getpos() can return a negative line number. (haya14busa) +Solution: Handle a zero topline and botline. (closes #1613) +Files: src/eval.c, runtime/doc/eval.txt + +Patch 8.0.0543 +Problem: Test_edit causes older xfce4-terminal to close. (Dominique Pelle) +Solution: Reduce number of columns to 2000. Try to restore the window + position. +Files: src/testdir/test_edit.vim, src/evalfunc.c, src/term.c, + src/proto/term.pro, src/term.h + +Patch 8.0.0544 +Problem: Cppcheck warnings. +Solution: Use temp variable. Change NUL to NULL. Swap conditions. (Dominique + Pelle) +Files: src/channel.c, src/edit.c, src/farsi.c + +Patch 8.0.0545 +Problem: Edit test may fail on some systems. +Solution: If creating a directory with a very long path fails, bail out. +Files: src/testdir/test_edit.vim + +Patch 8.0.0546 +Problem: Swap file exists briefly when opening the command window. +Solution: Set the noswapfile command modifier before splitting the window. + (James McCoy, closes #1620) +Files: src/ex_getln.c, src/option.c + +Patch 8.0.0547 +Problem: Extra line break in verbosefile when using ":echomsg". (Ingo + Karkat) +Solution: Don't call msg_start(). (closes #1618) +Files: src/eval.c, src/testdir/test_cmdline.vim + +Patch 8.0.0548 +Problem: Saving the redo buffer only works one time, resulting in the "." + command not working well for a function call inside another + function call. (Ingo Karkat) +Solution: Save the redo buffer at every user function call. (closes #1619) +Files: src/getchar.c, src/proto/getchar.pro, src/structs.h, + src/fileio.c, src/userfunc.c, src/testdir/test_functions.vim + +Patch 8.0.0549 +Problem: No test for the 8g8 command. +Solution: Add a test. (Dominique Pelle, closes #1615) +Files: src/testdir/test_normal.vim + +Patch 8.0.0550 +Problem: Some etags format tags file use 0x01, breaking the parsing. +Solution: Use 0x02 for TAG_SEP. (James McCoy, closes #1614) +Files: src/tag.c, src/testdir/test_taglist.vim + +Patch 8.0.0551 +Problem: The typeahead buffer is reallocated too often. +Solution: Re-use the existing buffer if possible. +Files: src/getchar.c + +Patch 8.0.0552 +Problem: Toupper and tolower don't work properly for Turkish when 'casemap' + is empty. (Bjorn Linse) +Solution: Check the 'casemap' options when deciding how to upper/lower case. +Files: src/charset.c, src/testdir/test_normal.vim + +Patch 8.0.0553 (after 8.0.0552) +Problem: Toupper/tolower test with Turkish locale fails on Mac. +Solution: Skip the test on Mac. +Files: src/testdir/test_normal.vim + +Patch 8.0.0554 (after 8.0.0552) +Problem: Toupper and tolower don't work properly for Turkish when 'casemap' + contains "keepascii". (Bjorn Linse) +Solution: When 'casemap' contains "keepascii" use ASCII toupper/tolower. +Files: src/charset.c, src/testdir/test_normal.vim + +Patch 8.0.0555 (after 8.0.0552) +Problem: Toupper/tolower test fails on OSX without Darwin. +Solution: Skip that part of the test also for OSX. (Kazunobu Kuriyama) +Files: src/testdir/test_normal.vim + +Patch 8.0.0556 +Problem: Getting the window position fails if both the GUI and term + code is built in. +Solution: Return after getting the GUI window position. (Kazunobu Kuriyama) +Files: src/evalfunc.c + +Patch 8.0.0557 +Problem: GTK: using static gravities is not useful. +Solution: Remove setting static gravities. (Kazunobu Kuriyama) +Files: src/gui_gtk_f.c + +Patch 8.0.0558 +Problem: The :ownsyntax command is not tested. +Solution: Add a test. (Dominique Pelle, closes #1622) +Files: src/testdir/test_syntax.vim + +Patch 8.0.0559 +Problem: Setting ttytype to xxx does not always fail as expected. (Marvin + Schmidt) +Solution: Catch both possible errors. (closes #1601) +Files: src/testdir/test_options.vim + +Patch 8.0.0560 +Problem: :windo allows for ! but it's not supported. +Solution: Disallow passing !. (Hirohito Higashi) +Files: src/ex_cmds.h + +Patch 8.0.0561 +Problem: Undefined behavior when using backslash after empty line. +Solution: Check for an empty line. (Dominique Pelle, closes #1631) +Files: src/misc2.c, src/testdir/test_vimscript.vim + +Patch 8.0.0562 +Problem: Not enough test coverage for syntax commands. +Solution: Add a few more tests. (Dominique Pelle, closes #1624) +Files: src/testdir/test_cmdline.vim, src/testdir/test_syntax.vim + +Patch 8.0.0563 +Problem: Crash when getting the window position in tmux. (Marvin Schmidt) +Solution: Add t_GP to the list of terminal options. (closes #1627) +Files: src/option.c + +Patch 8.0.0564 +Problem: Cannot detect Bazel BUILD files on some systems. +Solution: Check for BUILD after script checks. (Issue #1340) +Files: runtime/filetype.vim + +Patch 8.0.0565 +Problem: Using freed memory in :caddbuf after clearing quickfix list. + (Dominique Pelle) +Solution: Set qf_last to NULL. +Files: src/quickfix.c + +Patch 8.0.0566 +Problem: Setting nocompatible for the tiny version moves the cursor. +Solution: Use another trick to skip commands when the +eval feature is + present. (Christian Brabandt, closes #1630) +Files: runtime/defaults.vim + +Patch 8.0.0567 +Problem: Call for requesting color and ambiwidth is too early. (Hirohito + Higashi) +Solution: Move the call down to below resetting "starting". +Files: src/main.c + +Patch 8.0.0568 +Problem: "1gd" may hang. +Solution: Don't get stuck in one position. (Christian Brabandt, closes #1643) +Files: src/testdir/test_goto.vim, src/normal.c + +Patch 8.0.0569 +Problem: Bracketed paste is still enabled when executing a shell command. + (Michael Smith) +Solution: Disable brackted paste when going into cooked mode. (closes #1638) +Files: src/term.c + +Patch 8.0.0570 +Problem: Can't run make with several jobs, creating directories has a race + condition. +Solution: Use the MKDIR_P autoconf mechanism. (Eric N. Vander Weele, + closes #1639) +Files: src/configure.ac, src/auto/configure, src/Makefile, + src/config.mk.in, src/install-sh, src/mkinstalldirs, Filelist + +Patch 8.0.0571 +Problem: The cursor line number becomes negative when using :z^ in an empty + buffer. (neovim #6557) +Solution: Correct the line number. Also reset the column. +Files: src/testdir/test_ex_z.vim, src/ex_cmds.c + +Patch 8.0.0572 +Problem: Building the command table requires Perl. +Solution: Use a Vim script solution. (Dominique Pelle, closes #1641) +Files: src/Makefile, src/create_cmdidxs.pl, src/create_cmdidxs.vim, + src/ex_cmdidxs.h, src/ex_docmd.c, Filelist + +Patch 8.0.0573 +Problem: Running parallel make after distclean fails. (Manuel Ortega) +Solution: Instead of using targets "scratch config myself" use "reconfig". +Files: src/Makefile, src/config.mk.dist + +Patch 8.0.0574 +Problem: Get only one quickfix list after :caddbuf. +Solution: Reset qf_multiline. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0575 +Problem: Using freed memory when resetting 'indentexpr' while evaluating + it. (Dominique Pelle) +Solution: Make a copy of 'indentexpr'. +Files: src/misc1.c, src/testdir/test_options.vim + +Patch 8.0.0576 (after 8.0.0570 and 8.0.0573) +Problem: Can't build when configure choses "install-sh". (Daniel Hahler) +Solution: Always use install-sh. Fix remaining use of mkinstalldirs. + (closes #1647) +Files: src/installman.sh, src/installml.sh, src/config.mk.in, + src/configure.ac, src/auto/configure, src/Makefile + +Patch 8.0.0577 (after 8.0.0575) +Problem: Warning for uninitialized variable. (John Marriott) +Solution: Initialize "indent". +Files: src/misc1.c + +Patch 8.0.0578 +Problem: :simalt on MS-Windows does not work properly. +Solution: Put something in the typeahead buffer. (Christian Brabandt) +Files: src/gui_w32.c + +Patch 8.0.0579 +Problem: Duplicate test case for quickfix. +Solution: Remove the function. (Yegappan Lakshmanan) +Files: src/testdir/test_quickfix.vim + +Patch 8.0.0580 +Problem: Cannot set the valid flag with setqflist(). +Solution: Add the "valid" argument. (Yegappan Lakshmanan, closes #1642) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0581 +Problem: Moving folded text is sometimes not correct. +Solution: Bail out when "move_end" is zero. (Matthew Malcomson) +Files: src/fold.c, src/testdir/test_fold.vim + +Patch 8.0.0582 +Problem: Illegal memory access with z= command. (Dominique Pelle) +Solution: Avoid case folded text to be longer than the original text. Use + MB_PTR2LEN() instead of MB_BYTE2LEN(). +Files: src/spell.c, src/testdir/test_spell.vim + +Patch 8.0.0583 +Problem: Fold test hangs on MS-Windows. +Solution: Avoid overflow in compare. +Files: src/fold.c + +Patch 8.0.0584 +Problem: Memory leak when executing quickfix tests. +Solution: Free the list reference. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.0585 +Problem: Test_options fails when run in the GUI. +Solution: Also check the 'imactivatekey' value when the GUI is not running. + Specify test values that work and that fail. +Files: src/option.c, src/testdir/gen_opt_test.vim + +Patch 8.0.0586 +Problem: No test for mapping timing out. +Solution: Add a test. +Files: src/testdir/test_mapping.vim + +Patch 8.0.0587 +Problem: Configure check for return value of tgetent is skipped. +Solution: Always perform the check. (Marvin Schmidt, closes #1664) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.0588 +Problem: job_stop() often assumes the channel will be closed, while the job + may not actually be stopped. (Martin Gammelsæter) +Solution: Only assume the job stops on "kill". Don't send a signal if the + job has already ended. (closes #1632) +Files: src/channel.c + +Patch 8.0.0589 (after 8.0.0578) +Problem: :simalt still does not work. +Solution: Use K_NOP instead of K_IGNORE. (Christian Brabandt) +Files: src/gui_w32.c + +Patch 8.0.0590 +Problem: Cannot add a context to locations. +Solution: Add the "context" entry in location entries. (Yegappan Lakshmanan, + closes #1012) +Files: src/eval.c, src/proto/quickfix.pro, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0591 +Problem: Changes to eval functionality not documented. +Solution: Include all the changes. +Files: runtime/doc/eval.txt + +Patch 8.0.0592 +Problem: If a job writes to a buffer and the user is typing a command, the + screen isn't updated. When a message is displayed the changed + buffer may cause it to be cleared. (Ramel Eshed) +Solution: Update the screen and then the command line if the screen didn't + scroll. Avoid inserting screen lines, as it clears any message. + Update the status line when the buffer changed. +Files: src/channel.c, src/screen.c, src/ex_getln.c, src/globals.h, + src/vim.h, src/proto/ex_getln.pro, src/proto/screen.pro + +Patch 8.0.0593 +Problem: Duplication of code for adding a list or dict return value. +Solution: Add rettv_dict_set() and rettv_list_set(). (Yegappan Lakshmanan) +Files: src/dict.c, src/eval.c, src/evalfunc.c, src/if_perl.xs, src/list.c, + src/proto/dict.pro, src/proto/list.pro + +Patch 8.0.0594 (after 8.0.0592) +Problem: Build failure when windows feature is missing. +Solution: Add #ifdef. +Files: src/screen.c + +Patch 8.0.0595 (after 8.0.0590) +Problem: Coverity warning for not checking return value of dict_add(). +Solution: Check the return value for FAIL. +Files: src/quickfix.c + +Patch 8.0.0596 +Problem: Crash when complete() is called after complete_add() in + 'completefunc'. (Lifepillar) +Solution: Bail out if compl_pattern is NULL. (closes #1668) + Also avoid using freed memory. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0597 +Problem: Off-by-one error in buffer size computation. +Solution: Use ">=" instead of ">". (Lemonboy, closes #1694) +Files: src/quickfix.c + +Patch 8.0.0598 +Problem: Building with gcc 7.1 yields new warnings. +Solution: Initialize result. (John Marriott) +Files: src/ex_docmd.c + +Patch 8.0.0599 +Problem: diff mode is insufficiently tested +Solution: Add more test cases. (Dominique Pelle, closes #1685) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 8.0.0600 +Problem: test_recover fails on some systems. +Solution: Explicitly check if "/" is writable. (Ken Takata) +Files: src/testdir/test_recover.vim + +Patch 8.0.0601 +Problem: No test coverage for :spellrepall. +Solution: Add a test. (Dominique Pelle, closes #1717) +Files: src/testdir/test_spell.vim + +Patch 8.0.0602 +Problem: When gF fails to edit the file the cursor still moves to the found + line number. +Solution: Check the return value of do_ecmd(). (Michael Hwang) +Files: src/normal.c, src/testdir/test_gf.vim + +Patch 8.0.0603 (after 8.0.0602) +Problem: gF test fails on MS-Windows. +Solution: Use @ instead of : before the line number +Files: src/testdir/test_gf.vim + +Patch 8.0.0604 (after 8.0.0603) +Problem: gF test still fails on MS-Windows. +Solution: Use : before the line number and remove it from 'isfname'. +Files: src/testdir/test_gf.vim + +Patch 8.0.0605 +Problem: The buffer that quickfix caches for performance may become + invalid. (Daniel Hahler) +Solution: Reset qf_last_bufref in qf_init_ext(). (Daniel Hahler, + closes #1728, closes #1676) +Files: src/quickfix.c + +Patch 8.0.0606 +Problem: Cannot set the context for a specified quickfix list. +Solution: Use the list index instead of the current list. (Yegappan + Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0607 +Problem: When creating a bufref, then using :bwipe and :new it might get + the same memory and bufref_valid() returns true. +Solution: Add br_fnum to check the buffer number didn't change. +Files: src/structs.h, src/buffer.c, src/globals.h, src/if_py_both.h, + src/quickfix.c + +Patch 8.0.0608 +Problem: Cannot manipulate other than the current quickfix list. +Solution: Pass the list index to quickfix functions. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.0609 +Problem: For some people the hint about quitting is not sufficient. +Solution: Put <Enter> separately. Also use ":qa!" to get out even when + there are changes. +Files: src/normal.c + +Patch 8.0.0610 +Problem: The screen is redrawn when t_BG is set and used to detect the + value for 'background'. +Solution: Don't redraw when the value of 'background' didn't change. +Files: src/term.c. + +Patch 8.0.0611 +Problem: When t_u7 is sent a few characters in the second screen line are + overwritten and not redrawn later. (Rastislav Barlik) +Solution: Move redrawing the screen to after overwriting the characters. +Files: src/main.c, src/term.c. + +Patch 8.0.0612 +Problem: Package directories are added to 'runtimepath' only after loading + non-package plugins. +Solution: Split off the code to add package directories to 'runtimepath'. + (Ingo Karkat, closes #1680) +Files: src/ex_cmds2.c, src/globals.h, src/main.c, src/proto/ex_cmds2.pro, + src/testdir/test_startup.vim + +Patch 8.0.0613 +Problem: The conf filetype detection is done before ftdetect scripts from + packages that are added later. +Solution: Add the FALLBACK argument to :setfiletype. (closes #1679, + closes #1693) +Files: src/ex_docmd.c, runtime/filetype.vim, src/Makefile, + src/testdir/test_filetype.vim, src/testdir/test_alot.vim + +Patch 8.0.0614 +Problem: float2nr() is not exactly right. +Solution: Make float2nr() more accurate. Turn test65 into a new style test. + (Hirohito Higashi, closes #1688) +Files: src/Makefile, src/evalfunc.c, src/testdir/Make_all.mak, + src/testdir/Make_vms.mms, src/testdir/test65.in, + src/testdir/test65.ok, src/testdir/test_float_func.vim, + src/testdir/test_vimscript.vim, src/macros.h + +Patch 8.0.0615 +Problem: Using % with :hardcopy wrongly escapes spaces. (Alexey Muranov) +Solution: Expand % differently. (Christian Brabandt, closes #1682) +Files: src/ex_docmd.c, src/testdir/test_hardcopy.vim + + +Patch 8.0.0616 +Problem: When setting the cterm background with ":hi Normal" the value of + 'background' may be set wrongly. +Solution: Check that the color is less than 16. Don't set 'background' when + it was set explicitly. (Lemonboy, closes #1710) +Files: src/syntax.c, src/testdir/test_syntax.vim + +Patch 8.0.0617 (after 8.0.0615) +Problem: Hardcopy test hangs on MS-Windows. +Solution: Check the postscript feature is supported. +Files: src/testdir/test_hardcopy.vim + +Patch 8.0.0618 +Problem: NFA regex engine handles [0-z] incorrectly. +Solution: Return at the right point. (James McCoy, closes #1703) +Files: src/regexp_nfa.c, src/testdir/test36.in, src/testdir/test36.ok + +Patch 8.0.0619 +Problem: In the GUI, when a timer uses feedkeys(), it still waits for an + event. (Raymond Ko) +Solution: Check tb_change_cnt in one more place. +Files: src/gui.c + +Patch 8.0.0620 +Problem: Since we only support GTK versions that have it, the check for + HAVE_GTK_MULTIHEAD is no longer needed. +Solution: Remove HAVE_GTK_MULTIHEAD. (Kazunobu Kuriyama) +Files: src/config.h.in, src/configure.ac, src/auto/configure, + src/gui_beval.c, src/gui_gtk_x11.c, src/mbyte.c + +Patch 8.0.0621 +Problem: The ":stag" command does not respect 'switchbuf'. +Solution: Check 'switchbuf' for tag commands that may open a new window. + (Ingo Karkat, closes #1681) Define macros for the return values + of getfile(). +Files: src/tag.c, src/testdir/test_tagjump.vim, src/vim.h, src/buffer.c, + src/ex_cmds.c, src/search.c, + +Patch 8.0.0622 +Problem: Using a text object to select quoted text fails when 'selection' + is set to "exclusive". (Guraga) +Solution: Swap cursor and visual start position. (Christian Brabandt, + closes #1687) +Files: src/search.c, src/testdir/test_textobjects.vim + +Patch 8.0.0623 +Problem: The message "Invalid range" is used for multiple errors. +Solution: Add two more specific error messages. (Itchyny, Ken Hamada) +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test_regexp_utf8.vim + +Patch 8.0.0624 (after 8.0.0623) +Problem: Warning for unused variable in tiny build. (Tony Mechelynck) +Solution: Add an #ifdef. +Files: src/regexp.c + +Patch 8.0.0625 +Problem: shellescape() always escapes a newline, which does not work with + some shells. (Harm te Hennepe) +Solution: Only escape a newline when the "special" argument is non-zero. + (Christian Brabandt, closes #1590) +Files: src/evalfunc.c, src/testdir/test_functions.vim + +Patch 8.0.0626 +Problem: In the GUI the cursor may flicker. +Solution: Check the cmd_silent flag before updating the cursor shape. + (Hirohito Higashi, closes #1637) +Files: src/getchar.c + +Patch 8.0.0627 +Problem: When 'wrapscan' is off "gn" does not select the whole pattern when + it's the last one in the text. (KeyboardFire) +Solution: Check if the search fails. (Christian Brabandt, closes #1683) +Files: src/search.c, src/testdir/test_gn.vim + +Patch 8.0.0628 (after 8.0.0626 +Problem: Cursor disappears after silent mapping. (Ramel Eshed) +Solution: Do restore the cursor when it was changed, but don't change it in + the first place for a silent mapping. +Files: src/getchar.c + + +Patch 8.0.0629 (after 8.0.0611) +Problem: Checking for ambiguous width is not working. (Hirohito Higashi) +Solution: Reset "starting" earlier. +Files: src/main.c + +Patch 8.0.0630 +Problem: The :global command does not work recursively, which makes it + difficult to execute a command on a line where one pattern matches + and another does not match. (Miles Cranmer) +Solution: Allow for recursion if it is for only one line. (closes #1760) +Files: src/ex_cmds.c, src/testdir/test_global.vim, runtime/doc/repeat.txt + +Patch 8.0.0631 +Problem: Perl 5.26 also needs S_TOPMARK and S_POPMARK defined. +Solution: Define the functions when needed. (Jesin, closes #1748) +Files: src/if_perl.xs + +Patch 8.0.0632 +Problem: The quotestar test is still a bit flaky. +Solution: Kill any existing server to make the retry work. Wait for the + register to be filled. +Files: src/testdir/test_quotestar.vim + +Patch 8.0.0633 +Problem: The client-server test is still a bit flaky. +Solution: Wait a bit for the GUI to start. Check that the version number + can be obtained. +Files: src/testdir/test_clientserver.vim + +Patch 8.0.0634 +Problem: Cannot easily get to the last quickfix list. +Solution: Add "$" as a value for the "nr" argument of getqflist() and + setqflist(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0635 +Problem: When 'ignorecase' is set script detection is inaccurate. +Solution: Enforce matching case for text. (closes #1753) +Files: runtime/scripts.vim + +Patch 8.0.0636 +Problem: When reading the undo file fails may use uninitialized data. +Solution: Always clear the buffer on failure. +Files: src/undo.c + +Patch 8.0.0637 +Problem: Crash when using some version of GTK 3. +Solution: Add #ifdefs around incrementing the menu index. (Kazunobu + Kuriyama) +Files: src/gui_gtk.c + +Patch 8.0.0638 +Problem: Cannot build with new MSVC version VS2017. +Solution: Change the compiler arguments. (Leonardo Manera, closes #1731, + closes #1747) +Files: src/GvimExt/Makefile, src/Make_mvc.mak + +Patch 8.0.0639 +Problem: The cursor position is set to the last position in a new commit + message. +Solution: Don't set the position if the filetype matches "commit". + (Christian Brabandt) +Files: runtime/defaults.vim + +Patch 8.0.0640 +Problem: Mismatch between help and actual message for ":syn conceal". +Solution: Change the message to match the help. (Ken Takata) +Files: src/syntax.c + +Patch 8.0.0641 +Problem: Cannot set a separate highlighting for the current line in the + quickfix window. +Solution: Add QuickFixLine. (anishsane, closes #1755) +Files: src/option.c, src/quickfix.c, src/screen.c, src/syntax.c, + src/vim.h, runtime/doc/options.txt, runtime/doc/quickfix.txt + +Patch 8.0.0642 +Problem: writefile() continues after detecting an error. +Solution: Bail out as soon as an error is detected. (suggestions by Nikolai + Pavlov, closes #1476) +Files: src/evalfunc.c, src/testdir/test_writefile.vim + +Patch 8.0.0643 +Problem: When 'hlsearch' is set and matching with the last search pattern + is very slow, Vim becomes unusable. Cannot quit search by + pressing CTRL-C. +Solution: When the search times out set a flag and don't try again. Check + for timeout and CTRL-C in NFA loop that adds states. +Files: src/screen.c, src/ex_cmds.c, src/quickfix.c, src/regexp.c, + src/proto/regexp.pro, src/regexp.h, src/search.c, + src/proto/search.pro, src/syntax.c, src/regexp_nfa.c, src/spell.c, + src/tag.c, src/gui.c, src/edit.c, src/evalfunc.c, src/ex_docmd.c, + src/ex_getln.c, src/normal.c + +Patch 8.0.0644 +Problem: There is no test for 'hlsearch' timing out. +Solution: Add a test. +Files: src/testdir/test_hlsearch.vim + +Patch 8.0.0645 +Problem: The new regexp engine does not give an error for using a back + reference where it is not allowed. (Dominique Pelle) +Solution: Check the back reference like the old engine. (closes #1774) +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test_hlsearch.vim, + src/testdir/test_statusline.vim, + src/testdir/test_regexp_latin1.vim + +Patch 8.0.0646 +Problem: The hlsearch test fails on fast systems. +Solution: Make the search pattern slower. Fix that the old regexp engine + doesn't timeout properly. +Files: src/regexp.c, src/testdir/test_hlsearch.vim + +Patch 8.0.0647 +Problem: Syntax highlighting can cause a freeze. +Solution: Apply 'redrawtime' to syntax highlighting, per window. +Files: src/structs.h, src/screen.c, src/syntax.c, src/normal.c, + src/regexp.c, src/proto/syntax.pro, src/testdir/test_syntax.vim, + runtime/doc/options.txt + +Patch 8.0.0648 +Problem: Possible use of NULL pointer if buflist_new() returns NULL. + (Coverity) +Solution: Check for NULL pointer in set_bufref(). +Files: src/buffer.c + +Patch 8.0.0649 +Problem: When opening a help file the filetype is set several times. +Solution: When setting the filetype to the same value from a modeline, don't + trigger FileType autocommands. Don't set the filetype to "help" + when it's already set correctly. +Files: src/ex_cmds.c, src/option.c, runtime/filetype.vim + +Patch 8.0.0650 +Problem: For extra help files the filetype is set more than once. +Solution: In *.txt files check that there is no help file modline. +Files: runtime/filetype.vim + +Patch 8.0.0651 (after 8.0.0649) +Problem: Build failure without the auto command feature. +Solution: Add #ifdef. (closes #1782) +Files: src/ex_cmds.c + +Patch 8.0.0652 +Problem: Unicode information is outdated. +Solution: Update to Unicode 10. (Christian Brabandt) +Files: runtime/tools/unicode.vim, src/mbyte.c + +Patch 8.0.0653 +Problem: The default highlight for QuickFixLine does not work for several + color schemes. (Manas Thakur) +Solution: Make the default use the old color. (closes #1780) +Files: src/syntax.c + +Patch 8.0.0654 +Problem: Text found after :endfunction is silently ignored. +Solution: Give a warning if 'verbose' is set. When | or \n are used, + execute the text as a command. +Files: src/testdir/test_vimscript.vim, src/userfunc.c, + runtime/doc/eval.txt + +Patch 8.0.0655 +Problem: Not easy to make sure a function does not exist. +Solution: Add ! as an optional argument to :delfunc. +Files: src/userfunc.c, src/ex_cmds.h, src/testdir/test_vimscript.vim + +Patch 8.0.0656 +Problem: Cannot use ! after some user commands. +Solution: Properly check for existing command. (Hirohito Higashi) +Files: src/ex_docmd.c, src/testdir/test_vimscript.vim + +Patch 8.0.0657 +Problem: Cannot get and set quickfix list items. +Solution: Add the "items" argument to getqflist() and setqflist(). (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0658 +Problem: Spell test is old style. +Solution: Turn the spell test into a new style test (pschuh, closes #1778) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test58.in, src/testdir/test58.ok, + src/testdir/test_spell.vim + +Patch 8.0.0659 +Problem: No test for conceal mode. +Solution: Add a conceal mode test. (Dominique Pelle, closes #1783) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_syntax.vim + +Patch 8.0.0660 +Problem: Silent install on MS-Windows does show a dialog. +Solution: Add /SD to the default choice. (allburov, closes #1772) +Files: nsis/gvim.nsi + +Patch 8.0.0661 +Problem: Recognizing urxvt mouse codes does not work well. +Solution: Recognize "Esc[*M" and "Esc[*m". (Maurice Bos, closes #1486) +Files: src/keymap.h, src/misc2.c, src/os_unix.c, src/term.c + +Patch 8.0.0662 (after 8.0.0659) +Problem: Stray FIXME for fixed problem. +Solution: Remove the comment. (Dominique Pelle) +Files: src/testdir/test_syntax.vim + +Patch 8.0.0663 +Problem: Giving an error message only when 'verbose' set is unexpected. +Solution: Give a warning message instead. +Files: src/message.c, src/proto/message.pro, src/userfunc.c, + src/testdir/test_vimscript.vim, runtime/doc/eval.txt + +Patch 8.0.0664 (after 8.0.0661) +Problem: Mouse does not work in tmux. (lilydjwg) +Solution: Add flag for SGR release being present. +Files: src/term.c + +Patch 8.0.0665 (after 8.0.0661) +Problem: Warning for uninitialized variable. (Tony Mechelynck) +Solution: Initialize it. +Files: src/term.c + +Patch 8.0.0666 +Problem: Dead for loop. (Coverity) +Solution: Remove the for loop. +Files: src/term.c + +Patch 8.0.0667 +Problem: Memory access error when command follows :endfunction. (Nikolai + Pavlov) +Solution: Make memory handling in :function straightforward. (closes #1793) +Files: src/userfunc.c, src/testdir/test_vimscript.vim + +Patch 8.0.0668 (after 8.0.0660) +Problem: Nsis installer script does not work. (Christian Brabandt) +Solution: Fix the syntax of /SD. +Files: nsis/gvim.nsi + +Patch 8.0.0669 +Problem: In Insert mode, CTRL-N at start of the buffer does not work + correctly. (zuloloxi) +Solution: Wrap around the start of the buffer. (Christian Brabandt) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0670 +Problem: Can't use input() in a timer callback. (Cosmin Popescu) +Solution: Reset vgetc_busy and set timer_busy. (Ozaki Kiichi, closes #1790, + closes #1129) +Files: src/evalfunc.c, src/ex_cmds2.c, src/globals.h, + src/testdir/test_timers.vim + +Patch 8.0.0671 +Problem: When a function invoked from a timer calls confirm() and the user + types CTRL-C then Vim hangs. +Solution: Reset typebuf_was_filled. (Ozaki Kiichi, closes #1791) +Files: src/getchar.c + +Patch 8.0.0672 +Problem: Third item of synconcealed() changes too often. (Dominique Pelle) +Solution: Reset the sequence number at the start of each line. +Files: src/syntax.c, src/testdir/test_syntax.vim, runtime/doc/eval.txt + +Patch 8.0.0673 (after 8.0.0673) +Problem: Build failure without conceal feature. +Solution: Add #ifdef. +Files: src/syntax.c + +Patch 8.0.0674 (after 8.0.0670) +Problem: Cannot build with eval but without timers. +Solution: Add #ifdef (John Marriott) +Files: src/evalfunc.c + +Patch 8.0.0675 +Problem: 'colorcolumn' has a higher priority than 'hlsearch', it should be + the other way around. (Nazri Ramliy) +Solution: Change the priorities. (LemonBoy, closes #1794) +Files: src/screen.c, src/testdir/test_listlbr_utf8.vim + +Patch 8.0.0676 +Problem: Crash when closing the quickfix window in a FileType autocommand + that triggers when the quickfix window is opened. +Solution: Save the new value before triggering the OptionSet autocommand. + Add the "starting" flag to test_override() to make the text work. +Files: src/evalfunc.c, src/option.c, runtime/doc/eval.txt + +Patch 8.0.0677 +Problem: Setting 'filetype' internally may cause the current buffer and + window to change unexpectedly. +Solution: Set curbuf_lock. (closes #1734) +Files: src/quickfix.c, src/ex_cmds.c, src/ex_getln.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0678 +Problem: When 'equalalways' is set and closing a window in a separate + frame, not all window sizes are adjusted. (Glacambre) +Solution: Resize all windows if the new current window is not in the same + frame as the closed window. (closes #1707) +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 8.0.0679 (after 8.0.0678) +Problem: Using freed memory. +Solution: Get the parent frame pointer earlier. +Files: src/window.c + +Patch 8.0.0680 (after 8.0.0612) +Problem: Plugins in start packages are sourced twice. (mseplowitz) +Solution: Use the unmodified runtime path when loading plugins (test by Ingo + Karkat, closes #1801) +Files: src/testdir/test_startup.vim, src/main.c, src/ex_cmds2.c, + src/proto/ex_cmds2.pro + +Patch 8.0.0681 +Problem: Unnamed register only contains the last deleted text when + appending deleted text to a register. (Wolfgang Jeltsch) +Solution: Only set y_previous when not using y_append. (Christian Brabandt) +Files: src/ops.c, src/testdir/test_put.vim + +Patch 8.0.0682 +Problem: No test for synIDtrans(). +Solution: Add a test. (Dominique Pelle, closes #1796) +Files: src/testdir/test_syntax.vim + +Patch 8.0.0683 +Problem: When using a visual bell there is no delay, causing the flash to + be very short, possibly unnoticeable. Also, the flash and the + beep can lockup the UI when repeated often. +Solution: Do the delay in Vim or flush the output before the delay. Limit the + bell to once per half a second. (Ozaki Kiichi, closes #1789) +Files: src/misc1.c, src/proto/term.pro, src/term.c + +Patch 8.0.0684 +Problem: Old style tests are not nice. +Solution: Turn two tests into new style. (pschuh, closes #1797) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test82.in, src/testdir/test82.ok, + src/testdir/test90.in, src/testdir/test90.ok, + src/testdir/test_sha256.vim, src/testdir/test_utf8_comparisons.vim + +Patch 8.0.0685 +Problem: When making backups is disabled and conversion with iconv fails + the written file is truncated. (Luo Chen) +Solution: First try converting the file and write the file only when it did + not fail. (partly by Christian Brabandt) +Files: src/fileio.c, src/testdir/test_writefile.vim + +Patch 8.0.0686 +Problem: When typing CTRL-L in a window that's not the first one, another + redraw will happen later. (Christian Brabandt) +Solution: Reset must_redraw after calling screenclear(). +Files: src/screen.c + +Patch 8.0.0687 +Problem: Minor issues related to quickfix. +Solution: Set the proper return status for all cases in setqflist() and at + test cases for this. Move the "adding" flag outside of + FEAT_WINDOWS. Minor update to the setqflist() help text. (Yegappan + Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0688 +Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat) +Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat, + closes #1804) +Files: src/ex_cmds.h, src/testdir/test_quickfix.vim + +Patch 8.0.0689 +Problem: The ~ character is not escaped when adding to the search pattern + with CTRL-L. (Ramel Eshed) +Solution: Escape the character. (Christian Brabandt) +Files: src/ex_getln.c, src/testdir/test_search.vim + +Patch 8.0.0690 +Problem: Compiler warning on non-Unix system. +Solution: Add #ifdef. (John Marriott) +Files: src/term.c + +Patch 8.0.0691 +Problem: Compiler warning without the linebreak feature. +Solution: Add #ifdef. (John Marriott) +Files: src/edit.c + +Patch 8.0.0692 +Problem: Using CTRL-G with 'incsearch' and ? goes in the wrong direction. + (Ramel Eshed) +Solution: Adjust search_start. (Christian Brabandt) +Files: src/ex_getln.c, src/testdir/test_search.vim + +Patch 8.0.0693 +Problem: No terminal emulator support. Cannot properly run commands in the + GUI. Cannot run a job interactively with an ssh connection. +Solution: Very early implementation of the :terminal command. Includes + libvterm converted to ANSI C. Many parts still missing. +Files: src/feature.h, src/Makefile, src/configure.ac, src/auto/configure, + src/config.mk.in, src/config.h.in, src/terminal.c, src/structs.h, + src/ex_cmdidxs.h, src/ex_docmd.c, src/option.c, src/option.h, + src/evalfunc.c, src/proto/terminal.pro, src/proto.h, + runtime/doc/terminal.txt, runtime/doc/Makefile, Filelist, + src/libvterm/.bzrignore, src/libvterm/.gitignore, + src/libvterm/LICENSE, src/libvterm/README, src/libvterm/Makefile, + src/libvterm/tbl2inc_c.pl, src/libvterm/vterm.pc.in, + src/libvterm/bin/unterm.c, src/libvterm/bin/vterm-ctrl.c, + src/libvterm/bin/vterm-dump.c, src/libvterm/doc/URLs, + src/libvterm/doc/seqs.txt, src/libvterm/include/vterm.h, + src/libvterm/include/vterm_keycodes.h, + src/libvterm/src/encoding.c, + src/libvterm/src/encoding/DECdrawing.inc, + src/libvterm/src/encoding/DECdrawing.tbl, + src/libvterm/src/encoding/uk.inc, + src/libvterm/src/encoding/uk.tbl, src/libvterm/src/keyboard.c, + src/libvterm/src/mouse.c, src/libvterm/src/parser.c, + src/libvterm/src/pen.c, src/libvterm/src/rect.h, + src/libvterm/src/screen.c, src/libvterm/src/state.c, + src/libvterm/src/unicode.c, src/libvterm/src/utf8.h, + src/libvterm/src/vterm.c, src/libvterm/src/vterm_internal.h, + src/libvterm/t/02parser.test, src/libvterm/t/03encoding_utf8.test, + src/libvterm/t/10state_putglyph.test, + src/libvterm/t/11state_movecursor.test, + src/libvterm/t/12state_scroll.test, + src/libvterm/t/13state_edit.test, + src/libvterm/t/14state_encoding.test, + src/libvterm/t/15state_mode.test, + src/libvterm/t/16state_resize.test, + src/libvterm/t/17state_mouse.test, + src/libvterm/t/18state_termprops.test, + src/libvterm/t/20state_wrapping.test, + src/libvterm/t/21state_tabstops.test, + src/libvterm/t/22state_save.test, + src/libvterm/t/25state_input.test, + src/libvterm/t/26state_query.test, + src/libvterm/t/27state_reset.test, + src/libvterm/t/28state_dbl_wh.test, + src/libvterm/t/29state_fallback.test, src/libvterm/t/30pen.test, + src/libvterm/t/40screen_ascii.test, + src/libvterm/t/41screen_unicode.test, + src/libvterm/t/42screen_damage.test, + src/libvterm/t/43screen_resize.test, + src/libvterm/t/44screen_pen.test, + src/libvterm/t/45screen_protect.test, + src/libvterm/t/46screen_extent.test, + src/libvterm/t/47screen_dbl_wh.test, + src/libvterm/t/48screen_termprops.test, + src/libvterm/t/90vttest_01-movement-1.test, + src/libvterm/t/90vttest_01-movement-2.test, + src/libvterm/t/90vttest_01-movement-3.test, + src/libvterm/t/90vttest_01-movement-4.test, + src/libvterm/t/90vttest_02-screen-1.test, + src/libvterm/t/90vttest_02-screen-2.test, + src/libvterm/t/90vttest_02-screen-3.test, + src/libvterm/t/90vttest_02-screen-4.test, + src/libvterm/t/92lp1640917.test, src/libvterm/t/harness.c, + src/libvterm/t/run-test.pl + +Patch 8.0.0694 +Problem: Building in shadow directory does not work. Running Vim fails. +Solution: Add the new libvterm directory. Add missing change in command + list. +Files: src/Makefile, src/ex_cmds.h + +Patch 8.0.0695 +Problem: Missing dependencies breaks parallel make. +Solution: Add dependencies for terminal.o. +Files: src/Makefile + +Patch 8.0.0696 +Problem: The .inc files are missing in git. (Nazri Ramliy) +Solution: Remove the .inc line from .gitignore. +Files: src/libvterm/.gitignore + +Patch 8.0.0697 +Problem: Recorded key sequences may become invalid. +Solution: Add back KE_SNIFF removed in 7.4.1433. Use fixed numbers for the + key_extra enum. +Files: src/keymap.h + +Patch 8.0.0698 +Problem: When a timer uses ":pyeval" or another Python command and it + happens to be triggered while exiting a Crash may happen. + (Ricky Zhou) +Solution: Avoid running a Python command after python_end() was called. + Do not trigger timers while exiting. (closes #1824) +Files: src/if_python.c, src/if_python3.c, src/ex_cmds2.c + +Patch 8.0.0699 +Problem: Checksum tests are not actually run. +Solution: Add the tests to the list. (Dominique Pelle, closes #1819) +Files: src/testdir/test_alot.vim, src/testdir/test_alot_utf8.vim + +Patch 8.0.0700 +Problem: Segfault with QuitPre autocommand closes the window. (Marek) +Solution: Check that the window pointer is still valid. (Christian Brabandt, + closes #1817) +Files: src/testdir/test_tabpage.vim, src/ex_docmd.c + +Patch 8.0.0701 +Problem: System test failing when using X11 forwarding. +Solution: Set $XAUTHORITY before changing $HOME. (closes #1812) + Also use a better check for the exit value. +Files: src/testdir/setup.vim, src/testdir/test_system.vim + +Patch 8.0.0702 +Problem: An error in a timer can make Vim unusable. +Solution: Don't set the error flag or exception from a timer. Stop a timer + if it causes an error 3 out of 3 times. Discard an exception + caused inside a timer. +Files: src/ex_cmds2.c, src/structs.h, src/testdir/test_timers.vim, + runtime/doc/eval.txt + +Patch 8.0.0703 +Problem: Illegal memory access with empty :doau command. +Solution: Check the event for being out of range. (James McCoy) +Files: src/testdir/test_autocmd.vim, src/fileio.c + +Patch 8.0.0704 +Problem: Problems with autocommands when opening help. +Solution: Avoid using invalid "varp" value. Allow using :wincmd if buffer + is locked. (closes #1806, closes #1804) +Files: src/option.c, src/ex_cmds.h + +Patch 8.0.0705 (after 8.0.0702) +Problem: Crash when there is an error in a timer callback. (Aron Griffis, + Ozaki Kiichi) +Solution: Check did_throw before discarding an exception. NULLify + current_exception when no longer valid. +Files: src/ex_eval.c, src/ex_cmds2.c + +Patch 8.0.0706 +Problem: Crash when cancelling the cmdline window in Ex mode. (James McCoy) +Solution: Do not set cmdbuff to NULL, make it empty. +Files: src/ex_getln.c + +Patch 8.0.0707 +Problem: Freeing wrong memory when manipulating buffers in autocommands. + (James McCoy) +Solution: Also set the w_s pointer if w_buffer was NULL. +Files: src/ex_cmds.c + +Patch 8.0.0708 +Problem: Some tests are old style. +Solution: Change a few tests from old style to new style. (pschuh, + closes #1813) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/main.aap, + src/testdir/test23.in, src/testdir/test23.ok, + src/testdir/test24.in, src/testdir/test24.ok, + src/testdir/test26.in, src/testdir/test26.ok, + src/testdir/test67.in, src/testdir/test67.ok, + src/testdir/test75.in, src/testdir/test75.ok, + src/testdir/test97.in, src/testdir/test97.ok, + src/testdir/test_comparators.in, src/testdir/test_comparators.ok, + src/testdir/test_comparators.vim, + src/testdir/test_escaped_glob.vim, + src/testdir/test_exec_while_if.vim, + src/testdir/test_exists_autocmd.vim, src/testdir/test_getcwd.in, + src/testdir/test_getcwd.ok, src/testdir/test_getcwd.vim, + src/testdir/test_maparg.vim, src/testdir/test_plus_arg_edit.vim, + src/testdir/test_regex_char_classes.vim + +Patch 8.0.0709 +Problem: Libvterm cannot use vsnprintf(), it does not exist in C90. +Solution: Use vim_vsnprintf() instead. +Files: src/message.c, src/Makefile, src/proto.h, src/evalfunc.c, + src/netbeans.c, src/libvterm/src/vterm.c + +Patch 8.0.0710 +Problem: A job that writes to a buffer clears command line completion. + (Ramel Eshed) +Solution: Do not redraw while showing the completion menu. +Files: src/screen.c + +Patch 8.0.0711 (after 8.0.0710) +Problem: Cannot build without the wildmenu feature. +Solution: Add #ifdef +Files: src/screen.c + +Patch 8.0.0712 +Problem: The terminal implementation is incomplete. +Solution: Add the 'termkey' option. +Files: src/option.c, src/option.h, src/structs.h + +Patch 8.0.0713 (after 8.0.0712) +Problem: 'termkey' option not fully implemented. +Solution: Add initialisation. +Files: src/option.c + +Patch 8.0.0714 +Problem: When a timer causes a command line redraw the " that is displayed + for CTRL-R goes missing. +Solution: Remember an extra character to display. +Files: src/ex_getln.c + +Patch 8.0.0715 +Problem: Writing to the wrong buffer if the buffer that a channel writes to + was closed. +Solution: Do not write to a buffer that was unloaded. +Files: src/channel.c, src/testdir/test_channel.vim, + src/testdir/test_channel_write.py + +Patch 8.0.0716 +Problem: Not easy to start Vim cleanly without changing the viminfo file. + Not possible to know whether the -i command line flag was used. +Solution: Add the --clean command line argument. Add the 'viminfofile' + option. Add "-u DEFAULTS". +Files: src/main.c, runtime/doc/starting.txt, src/option.c, src/option.h, + src/ex_cmds.c, src/globals.h, runtime/doc/options.txt + +Patch 8.0.0717 +Problem: Terminal feature not included in :version output. +Solution: Add +terminal or -terminal. +Files: src/version.c, src/terminal.c + +Patch 8.0.0718 +Problem: Output of job in terminal is not displayed. +Solution: Connect the job output to the terminal. +Files: src/channel.c, src/proto/channel.pro, src/terminal.c, + src/proto/terminal.pro, src/channel.c, src/proto/channel.pro, + src/evalfunc.c, src/screen.c, src/proto/screen.pro + +Patch 8.0.0719 +Problem: Build failure without +terminal feature. +Solution: Add #ifdefs. +Files: src/screen.c, src/channel.c + +Patch 8.0.0720 +Problem: Unfinished mapping not displayed when running timer. +Solution: Also use the extra_char while waiting for a mapping and digraph. + (closes #1844) +Files: src/ex_getln.c + +Patch 8.0.0721 +Problem: :argedit can only have one argument. +Solution: Allow for multiple arguments. (Christian Brabandt) +Files: runtime/doc/editing.txt, src/ex_cmds.h, src/ex_cmds2.c, + src/testdir/test_arglist.vim + +Patch 8.0.0722 +Problem: Screen is messed by timer up at inputlist() prompt. +Solution: Set state to ASKMORE. (closes #1843) +Files: src/misc1.c + +Patch 8.0.0723 (after 8.0.0721) +Problem: Arglist test fails if file name case is ignored. +Solution: Wipe existing buffers, check for fname_case property. +Files: src/testdir/test_arglist.vim + +Patch 8.0.0724 +Problem: The message for yanking doesn't indicate the register. +Solution: Show the register name in the "N lines yanked" message. (Lemonboy, + closes #1803, closes #1809) +Files: src/ops.c, src/Makefile, src/testdir/test_registers.vim, + src/testdir/Make_all.mak + +Patch 8.0.0725 +Problem: A terminal window does not handle keyboard input. +Solution: Add terminal_loop(). ":term bash -i" sort of works now. +Files: src/main.c, src/terminal.c, src/proto/terminal.pro, src/normal.c + +Patch 8.0.0726 +Problem: Translations cleanup script is too conservative. +Solution: Also delete untranslated messages. +Files: src/po/cleanup.vim + +Patch 8.0.0727 +Problem: Message about what register to yank into is not translated. + (LemonBoy) +Solution: Add _(). +Files: src/ops.c + +Patch 8.0.0728 +Problem: The terminal structure is never freed. +Solution: Free the structure and unreference what it contains. +Files: src/terminal.c, src/buffer.c, src/proto/terminal.pro, + src/channel.c, src/proto/channel.pro, src/evalfunc.c + +Patch 8.0.0729 +Problem: The help for the terminal configure option is wrong. +Solution: Change "Disable" to "Enable". (E Kawashima, closes #1849) + Improve alignment. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.0730 +Problem: Terminal feature only supports Unix-like systems. +Solution: Prepare for adding an MS-Windows implementation. +Files: src/terminal.c + +Patch 8.0.0731 +Problem: Cannot build the terminal feature on MS-Windows. +Solution: Add the Makefile changes. (Yasuhiro Matsumoto, closes #1851) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.0732 +Problem: When updating a buffer for a callback the modeless selection is + lost. +Solution: Do not insert or delete screen lines when redrawing for a callback + and there is a modeless selection. +Files: src/screen.c + +Patch 8.0.0733 +Problem: Can only add entries to one list in the quickfix stack. +Solution: Move state variables from qf_list_T to qf_list_T. (Yegappan + Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.0734 +Problem: The script to check translations can be improved. +Solution: Restore the view when no errors are found. Check for matching + line break at the end of the message. (Christian Brabandt) +Files: src/po/check.vim + +Patch 8.0.0735 +Problem: There is no way to notice that the quickfix window contents has + changed. +Solution: Increment b:changedtick when updating the quickfix window. + (Yegappan Lakshmanan) +Files: runtime/doc/quickfix.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0736 +Problem: The OptionSet autocommand event is not triggered when entering + diff mode. +Solution: use set_option_value() instead of setting the option directly. + Change the tests from old to new style. (Christian Brabandt) +Files: src/diff.c, src/testdir/Make_all.mak, src/Makefile, + src/testdir/test_autocmd.vim, src/testdir/test_autocmd_option.in, + src/testdir/test_autocmd_option.ok + +Patch 8.0.0737 +Problem: Crash when X11 selection is very big. +Solution: Use static items instead of allocating them. Add callbacks. + (Ozaki Kiichi) +Files: src/testdir/shared.vim, src/testdir/test_quotestar.vim, + src/ui.c + +Patch 8.0.0738 +Problem: Cannot use the mouse to resize window while the focus is in a + terminal window. +Solution: Recognize nice mouse events in the terminal window. A few more + fixes for the terminal window. +Files: src/terminal.c + +Patch 8.0.0739 +Problem: Terminal resizing doesn't work well. +Solution: Resize the terminal to the Vim window and the other way around. + Avoid mapping typed keys. Set the environment properly. +Files: src/terminal.c, src/os_unix.c, src/structs.h + +Patch 8.0.0740 +Problem: Cannot resize a terminal window by the command running in it. +Solution: Add support for the window size escape sequence. Make BS work. +Files: src/terminal.c, src/libvterm/src/state.c + +Patch 8.0.0741 +Problem: Cannot build with HPUX. +Solution: Rename envbuf_TERM to envbuf_Term. (John Marriott) +Files: src/os_unix.c + +Patch 8.0.0742 +Problem: Terminal feature does not work on MS-Windows. +Solution: Use libvterm and libwinpty on MS-Windows. (Yasuhiro Matsumoto) +Files: src/INSTALLpc.txt, src/Make_cyg_ming.mak, src/channel.c, + src/proto/channel.pro, src/terminal.c + +Patch 8.0.0743 +Problem: The 'termsize' option can be set to an invalid value. +Solution: Check the 'termsize' option to be valid. +Files: src/option.c, src/testdir/gen_opt_test.vim + +Patch 8.0.0744 +Problem: A terminal window uses pipes instead of a pty. +Solution: Add pty support. +Files: src/structs.h, src/os_unix.c, src/terminal.c, src/channel.c, + src/proto/os_unix.pro, src/os_win32.c, src/proto/os_win32.pro + +Patch 8.0.0745 +Problem: multi-byte characters in a terminal window are not displayed + properly. +Solution: Set the unused screen characters. (Yasuhiro Matsumoto, closes + #1857) +Files: src/terminal.c + +Patch 8.0.0746 +Problem: When :term fails the job is not properly cleaned up. +Solution: Free the terminal. Handle a job that failed to start. (closes + #1858) +Files: src/os_unix.c, src/channel.c, src/terminal.c + +Patch 8.0.0747 +Problem: :terminal without an argument doesn't work. +Solution: Use the 'shell' option. (Yasuhiro Matsumoto, closes #1860) +Files: src/terminal.c + +Patch 8.0.0748 +Problem: When running Vim in a terminal window it does not detect the right + number of colors available. +Solution: Detect the version string that libvterm returns. Pass the number + of colors in $COLORS. +Files: src/term.c, src/os_unix.c + +Patch 8.0.0749 +Problem: Some unicode digraphs are hard to remember. +Solution: Add alternatives with a backtick. (Chris Harding, closes #1861) +Files: src/digraph.c + +Patch 8.0.0750 +Problem: OpenPTY missing in non-GUI build. +Solution: Always include pty.c, add an #ifdef to skip over the contents. +Files: src/pty.c, src/Makefile + +Patch 8.0.0751 (after 8.0.0750) +Problem: OpenPTY missing with some combination of features. (Kazunobu + Kuriyama) +Solution: Adjust #ifdef. Also include pty.pro when needed. +Files: src/pty.c, src/misc2.c, src/proto.h + +Patch 8.0.0752 +Problem: Build fails on MS-Windows. +Solution: Change #ifdef for set_color_count(). +Files: src/term.c + +Patch 8.0.0753 +Problem: A job running in a terminal does not get notified of changes in + the terminal size. +Solution: Use ioctl() and SIGWINCH to report the terminal size. +Files: src/terminal.c, src/os_unix.c, src/proto/os_unix.pro + +Patch 8.0.0754 +Problem: Terminal window does not support colors. +Solution: Lookup the color attribute. +Files: src/terminal.c, src/syntax.c, src/proto/syntax.pro + +Patch 8.0.0755 +Problem: Terminal window does not have colors in the GUI. +Solution: Lookup the GUI color. +Files: src/terminal.c, src/syntax.c, src/proto/syntax.pro, src/term.c, + src/proto/term.pro, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, + src/gui_x11.c, src/proto/gui_x11.pro, src/gui_mac.c, + src/proto/gui_mac.pro, src/gui_photon.c, src/proto/gui_photon.pro, + src/gui_w32.c, src/proto/gui_w32.pro, + +Patch 8.0.0756 +Problem: Cannot build libvterm with MSVC. +Solution: Add an MSVC Makefile to libvterm. (Yasuhiro Matsumoto, closes + #1865) +Files: src/INSTALLpc.txt, src/Make_mvc.mak, src/libvterm/Makefile.msc + +Patch 8.0.0757 +Problem: Libvterm MSVC Makefile not included in the distribution. +Solution: Add the file to the list. +Files: Filelist + +Patch 8.0.0758 +Problem: Possible crash when using a terminal window. +Solution: Check for NULL pointers. (Yasuhiro Matsumoto, closes #1864) +Files: src/terminal.c + +Patch 8.0.0759 +Problem: MS-Windows: terminal does not adjust size to the Vim window size. +Solution: Add a call to winpty_set_size(). (Yasuhiro Matsumoto, closes #1863) +Files: src/terminal.c + +Patch 8.0.0760 +Problem: Terminal window colors wrong with 'termguicolors'. +Solution: Add 'termguicolors' support. +Files: src/terminal.c, src/syntax.c, src/proto/syntax.pro + +Patch 8.0.0761 +Problem: Options of a buffer for a terminal window are not set properly. +Solution: Add "terminal" value for 'buftype'. Make 'buftype' and + 'bufhidden' not depend on the quickfix feature. + Also set the buffer name and show "running" or "finished" in the + window title. +Files: src/option.c, src/terminal.c, src/proto/terminal.pro, + runtime/doc/options.txt, src/quickfix.c, src/proto/quickfix.pro, + src/structs.h, src/buffer.c, src/ex_docmd.c, src/fileio.c, + src/channel.c + +Patch 8.0.0762 +Problem: ml_get error with :psearch in buffer without a name. (Dominique + Pelle) +Solution: Use the buffer number instead of the file name. Check the cursor + position. +Files: src/search.c, src/testdir/test_preview.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0763 +Problem: Libvterm can be improved. +Solution: Various small improvements, more comments. +Files: src/libvterm/README, src/libvterm/include/vterm.h, + src/libvterm/include/vterm_keycodes.h, + src/libvterm/src/keyboard.c, src/libvterm/src/parser.c, + src/libvterm/src/screen.c, src/libvterm/src/state.c + +Patch 8.0.0764 +Problem: 'termkey' does not work yet. +Solution: Implement 'termkey'. +Files: src/terminal.c, src/option.c, src/proto/option.pro + +Patch 8.0.0765 +Problem: Build fails with tiny features. +Solution: Adjust #ifdef. (John Marriott) +Files: src/option.c, src/option.h + +Patch 8.0.0766 +Problem: Option test fails with +terminal feature. +Solution: Fix using the right option when checking the value. +Files: src/option.c + +Patch 8.0.0767 +Problem: Build failure with Athena and Motif. +Solution: Move local variable declarations. (Kazunobu Kuriyama) +Files: src/gui_x11.c + +Patch 8.0.0768 +Problem: Terminal window status shows "[Scratch]". +Solution: Show "[Terminal]" when no title was set. (Yasuhiro Matsumoto) + Store the terminal title that vterm sends and use it. Update the + special buffer name. (closes #1869) +Files: src/terminal.c, src/proto/terminal.pro, src/buffer.c + +Patch 8.0.0769 +Problem: Build problems with terminal on MS-Windows using MSVC. +Solution: Remove stdbool.h dependency. Only use ScreenLinesUC when it was + allocated. Fix typos. (Ken Takata) +Files: src/libvterm/bin/vterm-ctrl.c, runtime/doc/terminal.txt, + src/INSTALLpc.txt, src/Make_cyg_ming.mak, src/Make_mvc.mak, + src/libvterm/Makefile.msc, src/terminal.c + +Patch 8.0.0770 +Problem: Compiler warning for missing field initializer. +Solution: Add two more values. (Yegappan Lakshmanan) +Files: src/libvterm/src/encoding.c + +Patch 8.0.0771 +Problem: Cursor in a terminal window not always updated in the GUI. +Solution: Call gui_update_cursor(). (Yasuhiro Matsumoto, closes #1868) +Files: src/terminal.c + +Patch 8.0.0772 +Problem: Other stdbool.h dependencies in libvterm. +Solution: Remove the dependency and use TRUE/FALSE/int. (Ken Takata) +Files: src/libvterm/include/vterm.h, src/libvterm/src/mouse.c, + src/libvterm/src/pen.c, src/libvterm/t/harness.c, + src/libvterm/bin/unterm.c + +Patch 8.0.0773 +Problem: Mixing 32 and 64 bit libvterm builds fails. +Solution: Use OUTDIR. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/libvterm/Makefile.msc + +Patch 8.0.0774 +Problem: Build failure without the multi-byte feature on HPUX. +Solution: Move #ifdefs. (John Marriott) +Files: src/term.c + +Patch 8.0.0775 +Problem: In a terminal the cursor is updated too often. +Solution: Only flush when needed. (Yasuhiro Matsumoto). Remember whether the + cursor is visible. (closes #1873) +Files: src/terminal.c + +Patch 8.0.0776 +Problem: Function prototypes missing without the quickfix feature. (Tony + Mechelynck) +Solution: Move non-quickfix functions to buffer.c. +Files: src/buffer.c, src/proto/buffer.pro, src/quickfix.c, + src/proto/quickfix.pro + +Patch 8.0.0777 +Problem: Compiler warnings with 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/libvterm/src/pen.c, src/libvterm/src/state.c, src/terminal.c + +Patch 8.0.0778 +Problem: In a terminal the cursor may be hidden and screen updating lags + behind. (Nazri Ramliy) +Solution: Switch the cursor on and flush output when needed. (Ozaki Kiichi) +Files: src/terminal.c + +Patch 8.0.0779 +Problem: :term without an argument uses empty buffer name but runs the + shell. +Solution: Change the command to the shell earlier. +Files: src/terminal.c + +Patch 8.0.0780 +Problem: Build failure on Travis. +Solution: Set distribution explicitly. Use Lua and Ruby dev. (Ken Takata, + closes #1884) +Files: .travis.yml + +Patch 8.0.0781 +Problem: MS-Windows: Memory leak when using :terminal. +Solution: Handle failures properly. (Ken Takata) +Files: src/terminal.c + +Patch 8.0.0782 +Problem: Using freed memory in quickfix code. (Dominique Pelle) +Solution: Handle a help window differently. (Yegappan Lakshmanan) +Files: src/buffer.c, src/proto/buffer.pro, src/quickfix.c, + src/testdir/test_quickfix.vim, src/ex_cmds.c, src/window.c + +Patch 8.0.0783 +Problem: Job of terminal may be freed too early. +Solution: Increment job refcount. (Yasuhiro Matsumoto) +Files: src/terminal.c + +Patch 8.0.0784 +Problem: Job of terminal may be garbage collected. +Solution: Set copyID on job in terminal. (Ozaki Kiichi) +Files: src/terminal.c, src/eval.c, src/proto/terminal.pro + +Patch 8.0.0785 +Problem: Wildcards are not expanded for :terminal. +Solution: Add FILES to the command flags. (Yasuhiro Matsumoto, closes #1883) + Also complete commands. +Files: src/ex_cmds.h, src/ex_docmd.c + +Patch 8.0.0786 +Problem: Build failures on Travis. +Solution: Go back to precise temporarily. Disable coverage with clang. +Files: .travis.yml + +Patch 8.0.0787 +Problem: Cannot send CTRL-W command to terminal job. +Solution: Make CTRL-W . a prefix for sending a key to the job. +Files: src/terminal.c, runtime/doc/terminal.txt, src/option.c + +Patch 8.0.0788 +Problem: MS-Windows: cannot build with terminal feature. +Solution: Move set_ref_in_term(). (Ozaki Kiichi) +Files: src/terminal.c + +Patch 8.0.0789 +Problem: When splitting a terminal window where the terminal follows the + size of the window doesn't work. +Solution: Use the size of the smallest window. (Yasuhiro Matsumoto, closes + #1885) +Files: src/terminal.c + +Patch 8.0.0790 +Problem: MSVC compiler warning for strncpy in libvterm. +Solution: Add a define to stop the warnings. (Mike Williams) +Files: src/Make_mvc.mak + +Patch 8.0.0791 +Problem: Terminal colors depend on the system. +Solution: Use the highlight color lookup tables. +Files: src/syntax.c, src/proto/syntax.pro, src/terminal.c + +Patch 8.0.0792 +Problem: Spell test leaves files behind. +Solution: Delete the files. +Files: src/testdir/test_spell.vim + +Patch 8.0.0793 +Problem: Using wrong terminal name for terminal window. +Solution: When 'term' starts with "xterm" use it for $TERM in a terminal + window. +Files: src/os_unix.c + +Patch 8.0.0794 +Problem: The script to check translations fails if there is more than one + NL in one line. +Solution: Count the number of NL characters. Make count() accept a string. +Files: src/po/check.vim, src/evalfunc.c, runtime/doc/eval.txt, + src/testdir/test_functions.vim + +Patch 8.0.0795 +Problem: Terminal feature does not build with older MSVC. +Solution: Do not use stdint.h. +Files: src/libvterm/include/vterm.h + +Patch 8.0.0796 +Problem: No coverage on Travis with clang. +Solution: Use a specific coveralls version. (Ozaki Kiichi, closes #1888) +Files: .travis.yml + +Patch 8.0.0797 +Problem: Finished job in terminal window is not handled. +Solution: Add the scrollback buffer. Use it to fill the buffer when the job + has ended. +Files: src/terminal.c, src/screen.c, src/proto/terminal.pro, + src/channel.c, src/os_unix.c, src/buffer.c + +Patch 8.0.0798 +Problem: No highlighting in a terminal window with a finished job. +Solution: Highlight the text. +Files: src/terminal.c, src/proto/terminal.pro, src/screen.c, src/undo.c + +Patch 8.0.0799 +Problem: Missing semicolon. +Solution: Add it. +Files: src/terminal.c + +Patch 8.0.0800 +Problem: Terminal window scrollback contents is wrong. +Solution: Fix handling of multi-byte characters (Yasuhiro Matsumoto) Handle + empty lines correctly. (closes #1891) +Files: src/terminal.c + +Patch 8.0.0801 +Problem: The terminal window title sometimes still says "running" even + though the job has finished. +Solution: Also consider the job finished when the channel has been closed. +Files: src/terminal.c + +Patch 8.0.0802 +Problem: After a job exits the last line in the terminal window does not + get color attributes. +Solution: Fix off-by-one error. +Files: src/terminal.c + +Patch 8.0.0803 +Problem: Terminal window functions not yet implemented. +Solution: Implement several functions. Add a first test. (Yasuhiro + Matsumoto, closes #1871) +Files: runtime/doc/eval.txt, src/Makefile, src/evalfunc.c, + src/proto/evalfunc.pro, src/proto/terminal.pro, src/terminal.c, + src/testdir/Make_all.mak, src/testdir/test_terminal.vim + +Patch 8.0.0804 +Problem: Running tests fails when stdin is /dev/null. (James McCoy) +Solution: Do not bail out from getting input if the --not-a-term argument + was given. (closes #1460) +Files: src/eval.c, src/evalfunc.c + +Patch 8.0.0805 +Problem: GUI test fails with gnome2. +Solution: Set $HOME to an existing directory. +Files: src/testdir/setup.vim, src/testdir/runtest.vim + +Patch 8.0.0806 +Problem: Tests may try to create XfakeHOME twice. +Solution: Avoid loading setup.vim twice. +Files: src/testdir/setup.vim + +Patch 8.0.0807 +Problem: Terminal window can't handle mouse buttons. (Hirohito Higashi) +Solution: Implement mouse buttons and many other keys. Ignore the ones that + are not implemented. +Files: src/terminal.c + +Patch 8.0.0808 +Problem: Cannot build with terminal feature and DEBUG defined. (Christian + Brabandt) +Solution: Use DEBUG_LOG3(). +Files: src/libvterm/src/pen.c + +Patch 8.0.0809 +Problem: MS-Windows: tests hang. +Solution: Delete the XfakeHOME directory. +Files: src/testdir/Make_dos.mak, src/testdir/Make_ming.mak + +Patch 8.0.0810 +Problem: MS-Windows: tests still hang. +Solution: Only create the XfakeHOME directory if it does not exist yet. +Files: src/testdir/setup.vim + +Patch 8.0.0811 +Problem: MS-Windows: test_expand_dllpath fails. +Solution: Change backslashes to forward slashes +Files: src/testdir/test_expand_dllpath.vim + +Patch 8.0.0812 +Problem: Terminal window colors shift when 'number' is set. (Nazri Ramliy) +Solution: Use vcol instead of col. +Files: src/screen.c + +Patch 8.0.0813 +Problem: Cannot use Vim commands in a terminal window while the job is + running. +Solution: Implement Terminal Normal mode. +Files: src/terminal.c, src/proto/terminal.pro, src/main.c, src/screen.c, + src/normal.c, src/option.c, runtime/doc/terminal.txt + +Patch 8.0.0814 (after 8.0.0757) +Problem: File in Filelist does not exist. +Solution: Remove the line. +Files: Filelist + +Patch 8.0.0815 +Problem: Terminal window not correctly updated when 'statusline' invokes + ":sleep". (NIkolay Pavlov) +Solution: Clear got_int. Repeat redrawing when needed. +Files: src/terminal.c + +Patch 8.0.0816 +Problem: Crash when using invalid buffer number. +Solution: Check for NULL buffer. (Yasuhiro Matsumoto, closes #1899) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0817 +Problem: Cannot get the line of a terminal window at the cursor. +Solution: Make the row argument optional. (Yasuhiro Matsumoto, closes #1898) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/terminal.c + +Patch 8.0.0818 +Problem: Cannot get the cursor position of a terminal. +Solution: Add term_getcursor(). +Files: runtime/doc/eval.txt, src/evalfunc.c, src/terminal.c, + src/proto/terminal.pro + +Patch 8.0.0819 +Problem: After changing current window the cursor position in the terminal + window is not updated. +Solution: Set w_wrow, w_wcol and w_valid. +Files: src/terminal.c + +Patch 8.0.0820 +Problem: GUI: cursor in terminal window lags behind. +Solution: call gui_update_cursor() under different conditions. (Ozaki + Kiichi, closes #1893) +Files: src/terminal.c + +Patch 8.0.0821 +Problem: Cannot get the title and status of a terminal window. +Solution: Implement term_gettitle() and term_getstatus(). +Files: src/evalfunc.c, src/terminal.c, src/proto/terminal.pro, + runtime/doc/eval.txt + +Patch 8.0.0822 +Problem: Test_with_partial_callback is a tiny bit flaky. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0823 +Problem: Cannot paste text into a terminal window. +Solution: Make CTRL-W " work. +Files: src/terminal.c + +Patch 8.0.0824 +Problem: In Terminal mode the cursor and screen gets redrawn when the job + produces output. +Solution: Check for tl_terminal_mode. (partly by Yasuhiro Matsumoto, closes + #1904) +Files: src/terminal.c + +Patch 8.0.0825 +Problem: Not easy to see that a window is a terminal window. +Solution: Add StatusLineTerm highlighting. +Files: src/option.c, src/vim.h, src/screen.c, src/syntax.c + +Patch 8.0.0826 +Problem: Cannot use text objects in Terminal mode. +Solution: Check for pending operator and Visual mode first. (Yasuhiro + Matsumoto, closes #1906) +Files: src/normal.c + +Patch 8.0.0827 +Problem: Coverity: could leak pty file descriptor, theoretically. +Solution: If channel is NULL, free the file descriptors. +Files: src/os_unix.c + +Patch 8.0.0828 +Problem: Coverity: may dereference NULL pointer. +Solution: Bail out if calloc_state() returns NULL. +Files: src/regexp_nfa.c + +Patch 8.0.0829 +Problem: A job running in a terminal window cannot easily communicate with + the Vim it is running in. +Solution: Pass v:servername in an environment variable. (closes #1908) +Files: src/os_unix.c + +Patch 8.0.0830 +Problem: Translating messages is not ideal. +Solution: Add a remark about obsolete messages. Use msgfmt in the check + script. (Christian Brabandt) +Files: src/po/README.txt, src/po/check.vim + +Patch 8.0.0831 (after 8.0.0791) +Problem: With 8 colors the bold attribute is not set properly. +Solution: Move setting HL_TABLE() out of lookup_color. (closes #1901) +Files: src/syntax.c, src/proto/syntax.pro, src/terminal.c + +Patch 8.0.0832 +Problem: Terminal function arguments are not consistent. +Solution: Use one-based instead of zero-based rows and cols. Use "." for + the current row. +Files: src/terminal.c, runtime/doc/eval.txt + +Patch 8.0.0833 +Problem: Terminal test fails. +Solution: Update the row argument to one based. +Files: src/testdir/test_terminal.vim + +Patch 8.0.0834 +Problem: Can't build without the client-server feature. +Solution: Add #ifdef. +Files: src/os_unix.c + +Patch 8.0.0835 +Problem: Translations check with msgfmt does not work. +Solution: Add a space before the file name. +Files: src/po/check.vim + +Patch 8.0.0836 +Problem: When a terminal buffer is changed it can still be accidentally + abandoned. +Solution: When making a change reset the 'buftype' option. +Files: src/terminal.c, src/testdir/test_terminal.vim, src/option.c + +Patch 8.0.0837 +Problem: Signs can be drawn on top of console messages. +Solution: don't redraw at a prompt or when scrolled up. (Christian Brabandt, + closes #1907) +Files: src/screen.c + +Patch 8.0.0838 +Problem: Buffer hangs around when terminal window is closed. +Solution: When the job has ended wipe out a terminal buffer when the window + is closed. +Files: src/buffer.c, src/terminal.c, src/proto/terminal.pro, + src/testdir/test_terminal.vim + +Patch 8.0.0839 +Problem: Cannot kill a job in a terminal with CTRL-C. +Solution: Set the controlling tty and send SIGINT. (closes #1910) +Files: src/os_unix.c, src/terminal.c, src/proto/os_unix.pro + +Patch 8.0.0840 +Problem: MS-Windows: fopen() and open() prototypes do not match the ones in + the system header file. Can't build without FEAT_MBYTE. +Solution: Add "const". Move macro to after including protoo.h. +Files: src/os_win32.c, src/proto/os_win32.pro, src/macros.h, src/vim.h + +Patch 8.0.0841 +Problem: term_getline() may cause a crash. +Solution: Check that the row is valid. (Hirohito Higashi) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0842 +Problem: Using slave pty after closing it. +Solution: Do the ioctl() before dup'ing it. +Files: src/os_unix.c + +Patch 8.0.0843 +Problem: MS-Windows: compiler warning for signed/unsigned. +Solution: Add type cast. (Yasuhiro Matsumoto, closes #1912) +Files: src/terminal.c + +Patch 8.0.0844 +Problem: Wrong function prototype because of missing static. +Solution: Add "static". +Files: src/os_win32.c, src/proto/os_win32.pro + +Patch 8.0.0845 +Problem: MS-Windows: missing semicolon in terminal code. +Solution: Add it. (Naruhiko Nishino, closes #1923) +Files: src/terminal.c + +Patch 8.0.0846 +Problem: Cannot get the name of the pty of a job. +Solution: Add the "tty" entry to the job info. (Ozaki Kiichi, closes #1920) + Add the term_gettty() function. +Files: runtime/doc/eval.txt, src/channel.c, src/os_unix.c, src/structs.h, + src/terminal.c, src/proto/terminal.pro, src/evalfunc.c, + src/testdir/test_terminal.vim + +Patch 8.0.0847 +Problem: :argadd without argument can't handle space in file name. (Harm te + Hennepe) +Solution: Escape the space. (Yasuhiro Matsumoto, closes #1917) +Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro, + src/testdir/test_arglist.vim + +Patch 8.0.0848 +Problem: Using multiple ch_log functions is clumsy. +Solution: Use variable arguments. (Ozaki Kiichi, closes #1919) +Files: src/channel.c, src/message.c, src/proto/channel.pro, + src/terminal.c + +Patch 8.0.0849 +Problem: Crash when job exit callback wipes the terminal. +Solution: Check for b_term to be NULL. (Yasuhiro Matsumoto, closes #1922) + Implement options for term_start() to be able to test. + Make term_wait() more reliable. +Files: src/terminal.c, src/testdir/test_terminal.vim, src/channel.c + +Patch 8.0.0850 +Problem: MS-Windows: Depending on the console encoding, an error message + that is given during startup may be broken. +Solution: Convert the message to the console codepage. (Yasuhiro Matsumoto, + closes #1927) +Files: src/message.c + +Patch 8.0.0851 +Problem: 'smartindent' is used even when 'indentexpr' is set. +Solution: Ignore 'smartindent' when 'indentexpr' is set. (Hirohito Higashi) +Files: src/misc1.c, src/testdir/test_smartindent.vim + +Patch 8.0.0852 (after 8.0.0850) +Problem: MS-Windows: possible crash when giving a message on startup. +Solution: Initialize length. (Yasuhiro Matsumoto, closes #1931) +Files: src/message.c + +Patch 8.0.0853 +Problem: Crash when running terminal with unknown command. +Solution: Check "term" not to be NULL. (Yasuhiro Matsumoto, closes #1932) +Files: src/terminal.c + +Patch 8.0.0854 +Problem: No redraw after terminal was closed. +Solution: Set typebuf_was_filled. (Yasuhiro Matsumoto, closes #1925, closes + #1924) Add function to check for messages even when input is + available. +Files: src/terminal.c, src/os_unix.c, src/proto/os_unix.pro, + src/os_win32.c, src/proto/os_win32.pro, src/os_mswin.c + +Patch 8.0.0855 +Problem: MS-Windows: can't get tty name of terminal. +Solution: Use the winpty process number. (Yasuhiro Matsumoto, closes #1929) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0856 +Problem: MS-Windows: terminal job doesn't take options. +Solution: Call job_set_options(). (Yasuhiro Matsumoto) +Files: src/terminal.c + +Patch 8.0.0857 +Problem: Terminal test fails on MS-Windows. +Solution: Sleep a fraction of a second. +Files: src/testdir/test_terminal.vim + +Patch 8.0.0858 +Problem: Can exit while a terminal is still running a job. +Solution: Consider a buffer with a running job like a changed file. +Files: src/undo.c, src/terminal.c, src/option.h, src/buffer.c, + src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/normal.c, + src/window.c, src/testdir/test_terminal.vim + +Patch 8.0.0859 +Problem: NULL pointer access when term_free_vterm called twice. +Solution: Return when tl_vterm is NULL. (Yasuhiro Matsumoto, closes #1934) +Files: src/terminal.c + +Patch 8.0.0860 +Problem: There may be side effects when a channel appends to a buffer that + is not the current buffer. +Solution: Properly switch to another buffer before appending. (Yasuhiro + Matsumoto, closes #1926, closes #1937) +Files: src/channel.c, src/buffer.c, src/proto/buffer.pro, + src/if_py_both.h + +Patch 8.0.0861 +Problem: Still many old style tests. +Solution: Convert several tests to new style. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test104.in, + src/testdir/test104.ok, src/testdir/test22.in, + src/testdir/test22.ok, src/testdir/test77.in, + src/testdir/test77.ok, src/testdir/test84.in, + src/testdir/test84.ok, src/testdir/test9.in, src/testdir/test9.ok, + src/testdir/test98.in, src/testdir/test98.ok, + src/testdir/test_autocmd.vim, src/testdir/test_curswant.vim, + src/testdir/test_file_size.vim, src/testdir/test_let.vim, + src/testdir/test_lineending.vim, src/testdir/test_scrollbind.vim, + src/Makefile + +Patch 8.0.0862 (after 8.0.0862) +Problem: File size test fails on MS-Windows. +Solution: Set fileformat after opening new buffer. Strip CR. +Files: src/testdir/test_file_size.vim + +Patch 8.0.0863 +Problem: A remote command starting with CTRL-\ CTRL-N does not work in the + terminal window. (Christian J. Robinson) +Solution: Use CTRL-\ CTRL-N as a prefix or a Normal mode command. +Files: src/terminal.c, runtime/doc/terminal.txt + +Patch 8.0.0864 +Problem: Cannot specify the name of a terminal. +Solution: Add the "term_name" option. (Yasuhiro Matsumoto, closes #1936) +Files: src/channel.c, src/structs.h, src/terminal.c, runtime/doc/eval.txt + +Patch 8.0.0865 +Problem: Cannot build with channel but without terminal feature. +Solution: Add #ifdef +Files: src/channel.c + +Patch 8.0.0866 +Problem: Solaris also doesn't have MIN and MAX. +Solution: Define MIN and MAX whenever they are not defined. (Ozaki Kiichi, + closes #1939) +Files: src/terminal.c + +Patch 8.0.0867 +Problem: When using a job or channel value as a dict value, when turning it + into a string the quotes are missing. +Solution: Add quotes to the job and channel values. (Yasuhiro Matsumoto, + closes #1930) +Files: src/list.c, src/eval.c, src/testdir/test_terminal.vim + +Patch 8.0.0868 +Problem: Cannot specify the terminal size on the command line. +Solution: Use the address range for the terminal size. (Yasuhiro Matsumoto, + closes #1941) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0869 +Problem: Job output is sometimes not displayed in a terminal. +Solution: Flush output before closing the channel. +Files: src/channel.c, src/terminal.c + +Patch 8.0.0870 +Problem: Mouse escape codes sent to terminal unintentionally. +Solution: Fix libvterm to send mouse codes only when enabled. +Files: src/terminal.c, src/libvterm/src/mouse.c + +Patch 8.0.0871 +Problem: The status line for a terminal window always has "[+]". +Solution: Do make the status line include "[+]" for a terminal window. +Files: src/screen.c + +Patch 8.0.0872 +Problem: Using mouse scroll while a terminal window has focus and the mouse + pointer is on another window does not work. Same for focus in a + non-terminal window and the mouse pointer is over a terminal + window. +Solution: Send the scroll action to the right window. +Files: src/terminal.c, src/normal.c, src/proto/terminal.pro + +Patch 8.0.0873 +Problem: In a terminal window cannot use CTRL-\ CTRL-N to start Visual + mode. +Solution: After CTRL-\ CTRL-N enter Terminal-Normal mode for one command. +Files: src/main.c, src/terminal.c, src/proto/terminal.pro + +Patch 8.0.0874 (after 8.0.0873) +Problem: Can't build with terminal feature. +Solution: Include change to term_use_loop(). (Dominique Pelle) +Files: src/normal.c + +Patch 8.0.0875 +Problem: Crash with weird command sequence. (Dominique Pelle) +Solution: Use vim_snprintf() instead of STRCPY(). +Files: src/misc1.c + +Patch 8.0.0876 +Problem: MS-Windows: Backslashes and wildcards in backticks don't work. +Solution: Do not handle backslashes inside backticks in the wrong place. + (Yasuhiro Matsumoto, closes #1942) +Files: src/os_mswin.c, src/os_win32.c + +Patch 8.0.0877 +Problem: Using CTRL-\ CTRL-N in terminal is inconsistent. +Solution: Stay in Normal mode. +Files: src/terminal.c, src/proto/terminal.pro, src/main.c, src/normal.c, + src/option.c + +Patch 8.0.0878 +Problem: No completion for :mapclear. +Solution: Add completion (Nobuhiro Takasaki et al. closes #1943) +Files: runtime/doc/eval.txt, runtime/doc/map.txt, src/ex_docmd.c, + src/ex_getln.c, src/proto/ex_docmd.pro, + src/testdir/test_cmdline.vim, src/vim.h + +Patch 8.0.0879 +Problem: Crash when shifting with huge number. +Solution: Check for overflow. (Dominique Pelle, closes #1945) +Files: src/ops.c, src/testdir/test_visual.vim + +Patch 8.0.0880 +Problem: Travis uses an old Ubuntu version. +Solution: Switch from precise to trusty. (Ken Takata, closes #1897) +Files: .travis.yml, Filelist, src/testdir/if_ver-1.vim, + src/testdir/if_ver-2.vim, src/testdir/lsan-suppress.txt + +Patch 8.0.0881 +Problem: win32.mak no longer included in Windows SDK. +Solution: Do not include win32.mak. (Ken Takata) +Files: src/GvimExt/Makefile, src/Make_mvc.mak + +Patch 8.0.0882 +Problem: term_scrape() and term_getline() require two arguments but it is + not enforced. +Solution: Correct minimal number of arguments. (Hirohito Higashi) Update + documentation. (Ken Takata) +Files: src/evalfunc.c, runtime/doc/eval.txt + +Patch 8.0.0883 +Problem: Invalid memory access with nonsensical script. +Solution: Check "dstlen" being positive. (Dominique Pelle) +Files: src/misc1.c + +Patch 8.0.0884 +Problem: Can't specify the wait time for term_wait(). +Solution: Add an optional second argument. +Files: src/evalfunc.c, src/terminal.c, runtime/doc/eval.txt + +Patch 8.0.0885 +Problem: Terminal window scrollback is stored inefficiently. +Solution: Store the text in the Vim buffer. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0886 +Problem: Crash when using ":term ls". +Solution: Fix line number computation. Add a test for this. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0887 +Problem: Can create a logfile in the sandbox. +Solution: Disable ch_logfile() in the sandbox. (Yasuhiro Matsumoto) +Files: src/evalfunc.c + +Patch 8.0.0888 +Problem: Compiler warnings with 64 bit build. +Solution: Add type cast of change the type. (Mike Williams) +Files: src/message.c, src/os_mswin.c, src/os_win32.c + +Patch 8.0.0889 +Problem: Gcc gives warnings for uninitialized variables. (Tony Mechelynck) +Solution: Initialize variables even though they are not used. +Files: src/terminal.c + +Patch 8.0.0890 +Problem: Still many old style tests. +Solution: Convert several tests to new style. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test103.in, src/testdir/test103.ok, + src/testdir/test107.in, src/testdir/test107.ok, + src/testdir/test51.in, src/testdir/test51.ok, + src/testdir/test91.in, src/testdir/test91.ok, + src/testdir/test_getvar.vim, src/testdir/test_highlight.vim, + src/testdir/test_visual.vim, src/testdir/test_window_cmd.vim, + src/Makefile + +Patch 8.0.0891 +Problem: Uninitialized memory use with empty line in terminal. +Solution: Initialize growarray earlier. (Yasuhiro Matsumoto, closes #1949) +Files: src/terminal.c + +Patch 8.0.0892 +Problem: When opening a terminal the pty size doesn't always match. +Solution: Update the pty size after opening the terminal. (Ken Takata) +Files: src/terminal.c + +Patch 8.0.0893 +Problem: Cannot get the scroll count of a terminal window. +Solution: Add term_getscrolled(). +Files: src/terminal.c, src/proto/terminal.pro, src/evalfunc.c, + runtime/doc/eval.txt, src/testdir/test_terminal.vim + +Patch 8.0.0894 +Problem: There is no test for runtime filetype detection. +Solution: Test a list of filetypes from patterns. +Files: src/testdir/test_filetype.vim, runtime/filetype.vim + +Patch 8.0.0895 (after 8.0.0894) +Problem: Filetype test fails on MS-Windows. +Solution: Fix file names. +Files: src/testdir/test_filetype.vim + +Patch 8.0.0896 +Problem: Cannot automatically close a terminal window when the job ends. +Solution: Add the ++close argument to :term. Add the term_finish option to + term_start(). (Yasuhiro Matsumoto, closes #1950) Also add + ++open. +Files: runtime/doc/eval.txt, runtime/doc/terminal.txt, src/channel.c, + src/structs.h, src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0897 (after 8.0.0896) +Problem: Wrong error message for invalid term_finish value +Solution: Pass the right argument to emsg(). +Files: src/channel.c + +Patch 8.0.0898 +Problem: Can't use the alternate screen in a terminal window. +Solution: Initialize the alternate screen. (Yasuhiro Matsumoto, closes + #1957) Add term_getaltscreen(). +Files: src/libvterm/include/vterm.h, src/terminal.c, + src/proto/terminal.pro, src/evalfunc.c, runtime/doc/eval.txt + +Patch 8.0.0899 +Problem: Function name mch_stop_job() is confusing. +Solution: Rename to mch_signal_job(). +Files: src/channel.c, src/os_unix.c, src/proto/os_unix.pro, + src/os_win32.c, src/proto/os_win32.pro, src/terminal.c + +Patch 8.0.0900 +Problem: :tab options doesn't open a new tab page. (Aviany) +Solution: Support the :tab modifier. (closes #1960) +Files: src/ex_cmds2.c, runtime/optwin.vim + +Patch 8.0.0901 +Problem: Asan suppress file missing from distribution. +Solution: Add the file. +Files: Filelist + +Patch 8.0.0902 +Problem: Cannot specify directory or environment for a job. +Solution: Add the "cwd" and "env" arguments to job options. (Yasuhiro + Matsumoto, closes #1160) +Files: runtime/doc/channel.txt, src/channel.c, src/terminal.c, + src/os_unix.c, src/os_win32.c, src/structs.h, + src/testdir/test_channel.vim, src/testdir/test_terminal.vim + +Patch 8.0.0903 (after 8.0.0902) +Problem: Early return from test function. +Solution: Remove the return. +Files: src/testdir/test_terminal.vim + +Patch 8.0.0904 +Problem: Cannot set a location list from text. +Solution: Add the "text" argument to setqflist(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0905 +Problem: MS-Windows: broken multi-byte characters in the console. +Solution: Restore all regions of the console buffer. (Ken Takata) +Files: src/os_win32.c + +Patch 8.0.0906 +Problem: Don't recognize Couchbase files. +Solution: Add filetype detection. (Eugene Ciurana, closes #1951) +Files: runtime/filetype.vim, src/testdir/test_filetype.vim + +Patch 8.0.0907 +Problem: With cp932 font names might be misinterpreted. +Solution: Do not see "_" as a space when it is the second byte of a double + byte character. (Ken Takata) +Files: src/os_win32.c + +Patch 8.0.0908 +Problem: Cannot set terminal size with options. +Solution: Add "term_rows", "term_cols" and "vertical". +Files: src/terminal.c, runtime/doc/eval.txt, src/channel.c, + src/proto/channel.pro, src/structs.h, src/evalfunc.c, + src/testdir/test_terminal.vim + +Patch 8.0.0909 +Problem: Channel test fails. +Solution: Allow for "cwd" and "env" arguments. +Files: src/channel.c + +Patch 8.0.0910 +Problem: Cannot create a terminal in the current window. +Solution: Add option "curwin" and ++curwin. +Files: src/terminal.c, runtime/doc/eval.txt, src/channel.c, + src/structs.h, src/ex_cmds.h, src/testdir/test_terminal.vim + +Patch 8.0.0911 +Problem: Terminal test takes too long. +Solution: Instead of "sleep 1" use a Python program to briefly sleep. +Files: src/testdir/test_terminal.vim, src/testdir/test_short_sleep.py + +Patch 8.0.0912 +Problem: Cannot run a job in a hidden terminal. +Solution: Add option "hidden" and ++hidden. +Files: src/terminal.c, src/structs.h, src/channel.c, src/fileio.c, + runtime/doc/terminal.txt, src/testdir/test_terminal.vim + +Patch 8.0.0913 +Problem: MS-Windows: CTRL-C kills shell in terminal window instead of the + command running in the shell. +Solution: Make CTRL-C only send a CTRL_C_EVENT and have CTRL-BREAK kill the + job. (partly by Yasuhiro Matsumoto, closes #1962) +Files: src/os_win32.c, src/gui_w32.c, src/terminal.c, src/globals.h + +Patch 8.0.0914 +Problem: Highlight attributes are always combined. +Solution: Add the 'nocombine' value to replace attributes instead of + combining them. (scauligi, closes #1963) +Files: runtime/doc/syntax.txt, src/syntax.c, src/vim.h + +Patch 8.0.0915 +Problem: Wrong initialisation of global. +Solution: Use INIT(). +Files: src/globals.h + +Patch 8.0.0916 +Problem: Cannot specify properties of window for when opening a window for + a finished terminal job. +Solution: Add "term_opencmd". +Files: src/channel.c, src/structs.h, src/terminal.c, + runtime/doc/eval.txt, src/testdir/test_terminal.vim + +Patch 8.0.0917 +Problem: MS-Windows:CTRL-C handling in terminal window is wrong +Solution: Pass CTRL-C as a key. Turn CTRL-BREAK into a key stroke. (Yasuhiro + Matsumoto, closes #1965) +Files: src/os_win32.c, src/terminal.c + +Patch 8.0.0918 +Problem: Cannot get terminal window cursor shape or attributes. +Solution: Support cursor shape, attributes and color. +Files: src/terminal.c, runtime/doc/eval.txt, + src/libvterm/include/vterm.h, src/libvterm/src/state.c, + src/libvterm/src/vterm.c, src/feature.h, src/ui.c, + src/proto/ui.pro, src/term.c, src/proto/term.pro, + src/option.c, src/term.h + +Patch 8.0.0919 +Problem: Cursor color isn't set on startup. +Solution: Initialize showing_mode to invalid value. +Files: src/term.c + +Patch 8.0.0920 +Problem: The cursor shape is wrong after switch back from an alternate + screen in a terminal window. (Marius Gedminas) +Solution: Change bitfield to unsigned. Set flag that cursor shape was set. +Files: src/terminal.c, src/libvterm/src/vterm_internal.h + +Patch 8.0.0921 +Problem: Terminal window cursor shape not supported in the GUI. +Solution: Use the terminal window cursor shape in the GUI. +Files: src/terminal.c, src/proto/terminal.pro, src/gui.c, src/syntax.c, + src/proto/syntax.pro + +Patch 8.0.0922 +Problem: Quickfix list always added after current one. +Solution: Make it possible to add a quickfix list after the last one. + (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.0923 +Problem: Crash in GUI when terminal job exits. (Kazunobu Kuriyama) +Solution: reset in_terminal_loop when a terminal is freed. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.0924 +Problem: Terminal window not updated after using term_sendkeys(). +Solution: Call redraw_after_callback(). +Files: src/terminal.c + +Patch 8.0.0925 +Problem: MS-Windows GUI: channel I/O not handled right away. +Solution: Don't call process_message() unless a message is available. + (Yasuhiro Matsumoto, closes #1969) +Files: src/gui_w32.c + +Patch 8.0.0926 +Problem: When job in terminal window ends topline may be wrong. +Solution: When the job ends adjust topline so that the active part of the + terminal is displayed. +Files: src/terminal.c + +Patch 8.0.0927 +Problem: If a terminal job sends a blank title "running" is not shown. +Solution: When the title is blank make it empty. +Files: src/terminal.c + +Patch 8.0.0928 +Problem: MS-Windows: passing arglist to job has escaping problems. +Solution: Improve escaping. (Yasuhiro Matsumoto, closes #1954) +Files: src/testdir/test_channel.vim, src/testdir/test_terminal.vim, + src/channel.c, src/proto/channel.pro, src/terminal.c + +Patch 8.0.0929 +Problem: :term without argument does not work. +Solution: Use shell for empty command. (Yasuhiro Matsumoto, closes #1970) +Files: src/terminal.c + +Patch 8.0.0930 +Problem: Terminal buffers are stored in the viminfo file while they can't + be useful. +Solution: Skip terminal buffers for file marks and buffer list +Files: src/buffer.c, src/mark.c + +Patch 8.0.0931 +Problem: getwininfo() does not indicate a terminal window. +Solution: Add "terminal" to the dictionary. +Files: runtime/doc/eval.txt, src/evalfunc.c + +Patch 8.0.0932 +Problem: Terminal may not use right characters for BS and Enter. +Solution: Get the characters from the tty. +Files: src/os_unix.c, src/proto/os_unix.pro, src/terminal.c + +Patch 8.0.0933 +Problem: Terminal test tries to start GUI when it's not possible. +Solution: Check if the GUI can run. (James McCoy, closes #1971) +Files: src/testdir/shared.vim, src/testdir/test_terminal.vim, + src/testdir/test_gui.vim, src/testdir/test_gui_init.vim + +Patch 8.0.0934 (after 8.0.0932) +Problem: Change to struts.h missing in patch. +Solution: Include adding ttyinfo_T. +Files: src/structs.h + +Patch 8.0.0935 +Problem: Cannot recognize a terminal buffer in :ls output. +Solution: Use R for a running job and F for a finished job. +Files: src/buffer.c + +Patch 8.0.0936 +Problem: Mode() returns wrong value for a terminal window. +Solution: Return 't' when typed keys go to a job. +Files: src/evalfunc.c, src/testdir/test_terminal.vim + +Patch 8.0.0937 +Problem: User highlight groups are not adjusted for StatusLineTerm. +Solution: Combine attributes like for StatusLineNC. +Files: src/syntax.c, src/globals.h, src/screen.c + +Patch 8.0.0938 +Problem: Scrolling in terminal window is inefficient. +Solution: Use win_del_lines(). +Files: src/terminal.c + +Patch 8.0.0939 +Problem: Test_terminal_env is flaky. (James McCoy) +Solution: Use WaitFor() instead of term_wait(). +Files: src/testdir/test_terminal.vim + +Patch 8.0.0940 +Problem: Test_terminal_scrape_multibyte is flaky. (James McCoy) +Solution: Use WaitFor() instead of term_wait(). +Files: src/testdir/test_terminal.vim + +Patch 8.0.0941 +Problem: Existing color schemes don't work well with StatusLineTerm. +Solution: Don't use "reverse", use fg and bg colors. Also add + StatusLineTermNC. +Files: src/syntax.c, src/vim.h, src/screen.c, src/globals.h, src/option.c + +Patch 8.0.0942 +Problem: Using freed memory with ":terminal" if an autocommand changes + 'shell' when splitting the window. (Marius Gedminas) +Solution: Make a copy of 'shell'. (closes #1974) +Files: src/terminal.c + +Patch 8.0.0943 +Problem: Test_terminal_scrape_multibyte fails if the codepage is not utf-8. +Solution: Start "cmd" with the utf-8 codepage. (micbou, closes #1975) +Files: src/testdir/test_terminal.vim + +Patch 8.0.0944 +Problem: Test_profile is a little bit flaky. +Solution: Accept a match when self and total time are the same. (James + McCoy, closes #1972) +Files: src/testdir/test_profile.vim + +Patch 8.0.0945 +Problem: 64-bit compiler warnings. +Solution: Use "size_t" instead of "int". (Mike Williams) +Files: src/os_win32.c + +Patch 8.0.0946 +Problem: Using PATH_MAX does not work well on some systems. +Solution: use MAXPATHL instead. (James McCoy, closes #1973) +Files: src/main.c + +Patch 8.0.0947 +Problem: When in Insert mode and using CTRL-O CTRL-W CTRL-W to move to a + terminal window, get in a weird Insert mode. +Solution: Don't go to Insert mode in a terminal window. (closes #1977) +Files: src/normal.c + +Patch 8.0.0948 +Problem: Crash if timer closes window while dragging status line. +Solution: Check if the window still exists. (Yasuhiro Matsumoto, closes + #1979) +Files: src/edit.c, src/evalfunc.c, src/gui.c, src/normal.c, src/ui.c + +Patch 8.0.0949 +Problem: winpty.dll name is fixed. +Solution: Add the 'winptydll' option. Make the default name depend on + whether it is a 32-bit or 64-bit build. (idea by Yasuhiro + Matsumoto, closes #1978) +Files: src/option.c, src/option.h, src/terminal.c, + runtime/doc/options.txt + +Patch 8.0.0950 +Problem: MS-Windows: wrong #ifdef, compiler warnings for signed/unsigned. +Solution: Change variable type. Change TERMINAL to FEAT_TERMINAL. +Files: src/os_win32.c, src/option.h + +Patch 8.0.0951 +Problem: Another wrong #ifdef. +Solution: Change TERMINAL to FEAT_TERMINAL. (closes #1981) +Files: src/option.c + +Patch 8.0.0952 +Problem: MS-Windows: has('terminal') does not check existence of dll file. +Solution: Check if the winpty dll file can be loaded. (Ken Takata) +Files: src/evalfunc.c, src/proto/terminal.pro, src/terminal.c + +Patch 8.0.0953 +Problem: Get "no write since last change" error in terminal window. +Solution: Use another message when closing a terminal window. Make ":quit!" + also end the job. +Files: src/globals.h, src/buffer.c, src/proto/buffer.pro, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/quickfix.c, src/terminal.c + +Patch 8.0.0954 +Problem: /proc/self/exe might be a relative path. +Solution: Make the path a full path. (James McCoy, closes #1983) +Files: src/main.c + +Patch 8.0.0955 +Problem: Test_existent_file() fails on some file systems. +Solution: Run the test again with a sleep when the test fails without a + sleep. (James McCoy, closes #1984) +Files: src/testdir/test_stat.vim + +Patch 8.0.0956 +Problem: Scrolling in a terminal hwindow as flicker when the Normal + background differs from the terminal window background. +Solution: Set the attribute to clear with. +Files: src/terminal.c, src/screen.c, src/proto/screen.pro, src/message.c, + src/move.c + +Patch 8.0.0957 +Problem: When term_sendkeys() sends many keys it may get stuck in writing + to the job. +Solution: Make the write non-blocking, buffer keys to be sent. +Files: src/terminal.c, src/channel.c, src/proto/channel.pro, + src/structs.h src/testdir/test_terminal.vim + +Patch 8.0.0958 +Problem: The terminal test fails on MS-Windows when compiled with the + terminal feature but the winpty DLL is missing. +Solution: Check if the terminal feature works. (Ken Takata) +Files: src/testdir/test_terminal.vim + +Patch 8.0.0959 +Problem: Build failure on MS-Windows. +Solution: Use ioctlsocket() instead of fcntl(). +Files: src/channel.c + +Patch 8.0.0960 +Problem: Job in terminal does not get CTRL-C, we send a SIGINT instead. +Solution: Don't call may_send_sigint() on CTRL-C. Make CTRL-W CTRL-C end + the job. +Files: src/terminal.c, runtime/doc/terminal.txt + +Patch 8.0.0961 +Problem: The script to build the installer does not include winpty. +Solution: Add winpty32.dll and winpty-agent.exe like diff.exe +Files: nsis/gvim.nsi + +Patch 8.0.0962 +Problem: Crash with virtualedit and joining lines. (Joshua T Corbin, Neovim + #6726) +Solution: When using a mark check that coladd is valid. +Files: src/normal.c, src/misc2.c, src/Makefile, + src/testdir/test_virtualedit.vim, src/testdir/test_alot.vim + +Patch 8.0.0963 +Problem: Terminal test fails on MacOS. (chdiza) +Solution: Wait for the shell to echo the characters. (closes #1991) +Files: src/testdir/test_terminal.vim + +Patch 8.0.0964 +Problem: Channel write buffer does not work with poll(). +Solution: Use the same mechanism as with select(). +Files: src/channel.c + +Patch 8.0.0965 +Problem: The cursor shape is not reset after it was changed in a terminal. +Solution: Request the original cursor shape and restore it. Add t_RS. + Do not add t_SH for now, it does not work properly. +Files: src/term.c, src/term.h, src/option.c, src/terminal.c + +Patch 8.0.0966 (after 8.0.0965) +Problem: Build failure without terminal feature. +Solution: Move #endif. +Files: src/term.c + +Patch 8.0.0967 +Problem: Using a terminal may cause the cursor to blink. +Solution: Do not set t_vs, since we cannot restore the old blink state. +Files: src/term.c + +Patch 8.0.0968 +Problem: Crash when switching terminal modes. (Nikolai Pavlov) +Solution: Check that there are scrollback lines. +Files: src/terminal.c + +Patch 8.0.0969 +Problem: Coverity warning for unused return value. +Solution: Add (void) to avoid the warning. +Files: src/channel.c + +Patch 8.0.0970 +Problem: if there is no StatusLine highlighting and there is StatusLineNC + or StatusLineTermNC highlighting then an invalid highlight id is + passed to combine_stl_hlt(). (Coverity) +Solution: Check id_S to be -1 instead of zero. +Files: src/syntax.c + +Patch 8.0.0971 +Problem: 'winptydll' missing from :options. +Solution: Add the entry. +Files: runtime/optwin.vim + +Patch 8.0.0972 +Problem: Compiler warnings for unused variables. (Tony Mechelynck) +Solution: Add #ifdefs. +Files: src/term.c + +Patch 8.0.0973 +Problem: initial info about blinking cursor is wrong +Solution: Invert the blink flag. Add t_VS to stop a blinking cursor. +Files: src/term.c, src/proto/term.pro, src/term.h, src/option.c, + src/terminal.c + +Patch 8.0.0974 +Problem: Resetting a string option does not trigger OptionSet. (Rick Howe) +Solution: Set the origval. +Files: src/option.c, src/testdir/test_autocmd.vim + +Patch 8.0.0975 +Problem: Using freed memory when setting 'backspace'. +Solution: When changing oldval also change origval. +Files: src/option.c + +Patch 8.0.0976 +Problem: Cannot send lines to a terminal job. +Solution: Make [range]terminal send selected lines to the job. + Use ++rows and ++cols for the terminal size. +Files: src/ex_cmds.h, src/terminal.c, src/os_unix.c, + src/testdir/test_terminal.vim + +Patch 8.0.0977 +Problem: Cannot send lines to a terminal job on MS-Windows. +Solution: Set jv_in_buf. Command doesn't get EOF yet though. +Files: src/terminal.c + +Patch 8.0.0978 +Problem: Writing to terminal job is not tested. +Solution: Add a test. +Files: src/testdir/test_terminal.vim + +Patch 8.0.0979 +Problem: Terminal noblock test fails on MS-Windows. (Christian Brabandt) +Solution: Ignore empty line below "done". +Files: src/testdir/test_terminal.vim + +Patch 8.0.0980 +Problem: Coverity warning for failing to open /dev/null. +Solution: When /dev/null can't be opened exit the child. +Files: src/os_unix.c + +Patch 8.0.0981 +Problem: Cursor in terminal window blinks by default, while in a real xterm + it does not blink, unless the -bc argument is used. +Solution: Do not use a blinking cursor by default. +Files: src/terminal.c + +Patch 8.0.0982 +Problem: When 'encoding' is set to a multi-byte encoding other than utf-8 + the characters from their terminal are messed up. +Solution: Convert displayed text from utf-8 to 'encoding' for MS-Windows. + (Yasuhiro Matsumoto, close #2000) +Files: src/terminal.c + +Patch 8.0.0983 +Problem: Unnecessary check for NULL pointer. +Solution: Remove the NULL check in dialog_changed(), it already happens in + dialog_msg(). (Ken Takata) +Files: src/ex_cmds2.c + +Patch 8.0.0984 +Problem: Terminal blinking cursor not correct in the GUI. +Solution: Set blinkoff correctly. Also make the cursor blink on MS-Windows + by default. (Ken Takata) +Files: src/terminal.c + +Patch 8.0.0985 +Problem: Libvterm has its own idea of character width. +Solution: Use the Vim functions for character width and composing to avoid a + mismatch. (idea by Yasuhiro Matsumoto) +Files: src/Makefile, src/libvterm/src/unicode.c, src/mbyte.c, + src/proto/mbyte.pro, src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.0986 +Problem: Terminal feature always requires multi-byte feature. +Solution: Remove #ifdef FEAT_MBYTE, disable terminal without multi-byte. +Files: src/terminal.c, src/feature.h + +Patch 8.0.0987 +Problem: terminal: second byte of double-byte char wrong +Solution: Set the second byte to NUL only for utf-8 and non-multibyte. +Files: src/terminal.c + +Patch 8.0.0988 +Problem: Warning from Covscan about using NULL pointer. +Solution: Add extra check for NULL. (zdohnal) +Files: src/fileio.c, src/undo.c + +Patch 8.0.0989 +Problem: ActiveTcl dll name has changed in 8.6.6. +Solution: Adjust the makefile. (Ken Takata) +Files: src/INSTALLpc.txt, src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.0990 +Problem: When 'encoding' is a double-byte encoding, pasting a register into + a terminal ends up with the wrong characters. +Solution: Convert from 'encoding' to utf-8. (Yasuhiro Matsumoto, closes + #2007) +Files: src/terminal.c + +Patch 8.0.0991 +Problem: Using wrong character conversion for DBCS. +Solution: Use utf_char2bytes instead of mb_char2bytes. (Yasuhiro Matsumoto, + closes #2012) +Files: src/terminal.c + +Patch 8.0.0992 +Problem: Terminal title is wrong when 'encoding' is DBCS. +Solution: Convert the title from DBCS to utf-8. (Yasuhiro Matsumoto, closes + #2009) +Files: src/terminal.c + +Patch 8.0.0993 +Problem: Sometimes an xterm sends an extra CTRL-X after the response for + the background color. Related to t_RS. +Solution: Check for the CTRL-X after the terminating 0x7. +Files: src/term.c + +Patch 8.0.0994 +Problem: MS-Windows: cursor in terminal blinks even though the blinking + cursor was disabled on the system. +Solution: Use GetCaretBlinkTime(). (Ken Takata) +Files: src/terminal.c + +Patch 8.0.0995 +Problem: Terminal tests fail on Mac. +Solution: Add workaround: sleep a moment in between sending keys. +Files: src/testdir/test_terminal.vim + +Patch 8.0.0996 +Problem: Mac: t_RS is echoed on the screen in Terminal.app. Even though + $TERM is set to "xterm-256colors" it cannot handle this xterm + escape sequence. +Solution: Recognize Terminal.app from the termresponse and skip sending t_RS + if it looks like Terminal.app. +Files: src/term.c + +Patch 8.0.0997 (after 8.0.0996) +Problem: Libvterm and Terminal.app not recognized from termresponse. +Solution: Adjust string compare. +Files: src/term.c + +Patch 8.0.0998 +Problem: Strange error when using K while only spaces are selected. + (Christian J. Robinson) +Solution: Check for blank argument. +Files: src/normal.c, src/testdir/test_help.vim + +Patch 8.0.0999 +Problem: Indenting raw C++ strings is wrong. +Solution: Add special handling of raw strings. (Christian Brabandt) +Files: src/misc1.c, src/testdir/test_cindent.vim + +Patch 8.0.1000 +Problem: Cannot open a terminal without running a job in it. +Solution: Make ":terminal NONE" open a terminal with a pty. +Files: src/terminal.c, src/os_unix.c, src/proto/os_unix.pro, + src/channel.c, src/proto/channel.pro, src/structs.h, + src/testdir/test_terminal.c, src/misc2.c, src/gui_gtk_x11.c + +Patch 8.0.1001 +Problem: Setting 'encoding' makes 'printheader' invalid. +Solution: Do not translate the default value of 'printheader'. (Yasuhiro + Matsumoto, closes #2026) +Files: src/option.c + +Patch 8.0.1002 +Problem: Unnecessarily updating screen after timer callback. +Solution: Check if calling the timer sets must_redraw. +Files: src/ex_cmds2.c, src/channel.c, src/screen.c, src/proto/screen.pro, + src/terminal.c + +Patch 8.0.1003 +Problem: 64 bit compiler warning +Solution: Add type cast. (Mike Williams) +Files: src/channel.c + +Patch 8.0.1004 +Problem: Matchstrpos() without a match returns too many items. +Solution: Also remove the second item when the position is beyond the end of + the string. (Hirohito Higashi) Use an enum for the type. +Files: src/evalfunc.c, src/testdir/test_match.vim + +Patch 8.0.1005 +Problem: Terminal without job updates slowly in GUI. +Solution: Poll for input when a channel has the keep_open flag. +Files: src/channel.c, src/proto/channel.pro, src/gui_gtk_x11.c + +Patch 8.0.1006 +Problem: Cannot parse text with 'errorformat' without changing a quickfix + list. +Solution: Add the "text" argument to getqflist(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/proto/quickfix.pro, + src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1007 +Problem: No test for filetype detection for scripts. +Solution: Add a first test file script filetype detection. +Files: src/testdir/test_filetype.vim, runtime/scripts.vim + +Patch 8.0.1008 +Problem: Slow updating of terminal window in Motif. +Solution: Add a timeout to the wait-for-character loop. +Files: src/gui_x11.c + +Patch 8.0.1009 +Problem: Xterm cursor blinking status may be inverted. +Solution: Use another request to get the blink status and compare with the + cursor style report +Files: src/term.c, src/proto/term.pro, src/term.h, src/option.c, + src/terminal.c + +Patch 8.0.1010 (after 8.0.1009) +Problem: Build failure without termresponse feature. +Solution: Add #ifdef. +Files: src/term.c + +Patch 8.0.1011 +Problem: Terminal test fails with Athena and Motif. +Solution: Ignore the error for the input context. (Kazunobu Kuriyama) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1012 +Problem: MS-Windows: Problem with $HOME when it was set internally. +Solution: Only use the $HOME default internally. (Yasuhiro Matsumoto, closes + #2013) +Files: src/misc1.c, src/testdir/Make_all.mak, src/Makefile, + src/testdir/test_windows_home.vim + +Patch 8.0.1013 +Problem: A terminal window with a running job behaves different from a + window containing a changed buffer. +Solution: Do not set 'bufhidden' to "hide". Fix that a buffer where a + terminal used to run is listed as "[Scratch]". +Files: src/terminal.c, runtime/doc/terminal.txt, src/buffer.c + +Patch 8.0.1014 +Problem: Old compiler doesn't know uint32_t. Warning for using NULL instead + of NUL. +Solution: Use UINT32_T. Use NUL instead of NULL. +Files: src/mbyte.c, src/proto/mbyte.pro, src/misc1.c + +Patch 8.0.1015 (after 8.0.1013) +Problem: Missing update to terminal test. +Solution: Add the changes to the test. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1016 +Problem: Gnome terminal echoes t_RC. +Solution: Detect Gnome terminal by the version string. Add v: variables for + all the term responses. +Files: src/term.c, src/eval.c, src/vim.h, runtime/doc/eval.txt + +Patch 8.0.1017 +Problem: Test for MS-Windows $HOME always passes. +Solution: Rename the test function. Make the test pass. +Files: src/testdir/test_windows_home.vim + +Patch 8.0.1018 +Problem: Warnings from 64-bit compiler. (Christian Brabandt) +Solution: Add type casts. +Files: src/terminal.c + +Patch 8.0.1019 +Problem: Pasting in virtual edit happens in the wrong place. +Solution: Do not adjust coladd when after the end of the line (closes #2015) +Files: src/testdir/test_virtualedit.vim, src/misc2.c + +Patch 8.0.1020 +Problem: When a timer calls getchar(1) input is overwritten. +Solution: Increment tb_change_cnt in inchar(). (closes #1940) +Files: src/getchar.c + +Patch 8.0.1021 +Problem: Older Gnome terminal still echoes t_RC. (François Ingelrest) +Solution: Check for version > 3000 instead of 4000. +Files: src/term.c + +Patch 8.0.1022 +Problem: Test 80 is old style. +Solution: Turn it into a new style test. (Yegappan Lakshmanan) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test80.in, src/testdir/test80.ok, + src/testdir/test_substitute.vim + +Patch 8.0.1023 +Problem: It is not easy to identify a quickfix list. +Solution: Add the "id" field. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, runtime/doc/quickfix.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1024 +Problem: Manual folds are lost when a session file has the same buffer in + two windows. (Jeansen) +Solution: Use ":edit" only once. (Christian Brabandt, closes #1958) +Files: src/ex_docmd.c, src/testdir/test_mksession.vim + +Patch 8.0.1025 +Problem: Stray copy command in test. +Solution: Remove the copy command. +Files: src/testdir/test_mksession.vim + +Patch 8.0.1026 +Problem: GTK on-the-spot input has problems. (Gerd Wachsmuth) +Solution: Support over-the-spot. (Yukihiro Nakadaira, Ken Takata, closes + #1215) +Files: runtime/doc/mbyte.txt, runtime/doc/options.txt, src/edit.c, + src/ex_getln.c, src/mbyte.c, src/misc1.c, src/option.c, + src/option.h, src/screen.c, src/undo.c, + src/testdir/gen_opt_test.vim + +Patch 8.0.1027 +Problem: More terminals can't handle requesting cursor mode. +Solution: Recognize Putty. (Hirohito Higashi) Also include Xfce in the + version check. (Dominique Pelle) Recognize Konsole. +Files: src/term.c + +Patch 8.0.1028 +Problem: MS-Windows: viminfo uses $VIM/_viminfo if $HOME not set. (Yongwei + Wu) +Solution: Use vim_getenv() but check it's returning the default "C:/". +Files: src/ex_cmds.c + +Patch 8.0.1029 +Problem: Return value of getqflist() is inconsistent. (Lcd47) +Solution: Always return an "items" entry. +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1030 +Problem: MS-Windows: wrong size computation in is_cygpty(). +Solution: Compute the size properly. (Ken Takata) +Files: src/iscygpty.c, src/iscygpty.h + +Patch 8.0.1031 +Problem: "text" argument for getqflist() is confusing. (Lcd47) +Solution: Use "lines" instead. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1032 +Problem: "make tags" doesn't work well on MS-Windows. +Solution: Add or fix tags target. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.1033 +Problem: Detecting background color does not work in screen, even when it + is working like an xterm. +Solution: Make "screen.xterm" use termcap entries like an xterm. (Lubomir + Rintel, closes #2048) When termresponse version is huge also + recognize as not being an xterm. +Files: src/os_unix.c, src/term.c + +Patch 8.0.1034 +Problem: Sending buffer lines to terminal doesn't work on MS-Windows. +Solution: Send CTRL-D to mark the end of the text. (Yasuhiro Matsumoto, + closes #2043) Add the "eof_chars" option. +Files: src/channel.c, src/proto/terminal.pro, src/terminal.c, + src/testdir/test_terminal.vim, src/structs.h + +Patch 8.0.1035 +Problem: Sending buffer lines to terminal doesn't work on MS-Windows. +Solution: Use CR instead of NL after every line. Make the EOF text work + properly. Add the ++eof argument to :terminal. +Files: src/structs.h, src/channel.c, src/terminal.c, + runtime/doc/terminal.txt, runtime/doc/eval.txt + +Patch 8.0.1036 +Problem: ++eof argument for terminal only available on MS-Windows. +Solution: Also support ++eof on Unix. Add a test. +Files: src/channel.c, src/terminal.c, src/structs.h, + src/testdir/test_terminal.vim + +Patch 8.0.1037 +Problem: "icase" of 'diffopt' is not used for highlighting differences. +Solution: Also use "icase". (Rick Howe) +Files: src/diff.c, src/testdir/test_diffmode.vim + +Patch 8.0.1038 +Problem: Strike-through text not supported. +Solution: Add support for the "strikethrough" attribute. (Christian + Brabandt, Ken Takata) +Files: runtime/doc/eval.txt, runtime/doc/options.txt, + runtime/doc/syntax.txt, runtime/doc/term.txt, src/evalfunc.c, + src/gui.c, src/gui.h, src/gui_gtk_x11.c, src/gui_mac.c, + src/gui_w32.c, src/gui_x11.c, src/option.c, src/screen.c, + src/syntax.c, src/term.c, src/term.h, src/terminal.c, src/vim.h + +Patch 8.0.1039 +Problem: Cannot change a line in a buffer other than the current one. +Solution: Add setbufline(). (Yasuhiro Matsumoto, Ozaki Kiichi, closes #1953) +Files: src/evalfunc.c, runtime/doc/eval.txt, src/Makefile, + src/testdir/test_bufline.vim, src/testdir/test_alot.vim + + +Patch 8.0.1040 +Problem: Cannot use another error format in getqflist(). +Solution: Add the "efm" argument to getqflist(). (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1041 +Problem: Bogus characters appear when indenting kicks in while doing a + visual-block append. +Solution: Recompute when indenting is done. (Christian Brabandt) +Files: runtime/doc/visual.txt, src/charset.c, src/edit.c, src/misc1.c, + src/ops.c, src/proto/charset.pro, src/proto/misc1.pro, + src/screen.c, src/spell.c, src/testdir/test_cindent.vim + +Patch 8.0.1042 (after 8.0.1038) +Problem: Without the syntax feature highlighting doesn't work. +Solution: Always use unsigned short to store attributes. +Files: src/vim.h + +Patch 8.0.1043 +Problem: Warning for uninitialized variable. (John Marriott) +Solution: Move code to check indent inside "if". +Files: src/ops.c + +Patch 8.0.1044 +Problem: Warning for uninitialized variable. (John Marriott) +Solution: Initialize ind_pre. +Files: src/ops.c + +Patch 8.0.1045 +Problem: Running tests may pollute shell history. (Manuel Ortega) +Solution: Make $HISTFILE empty. +Files: src/testdir/setup.vim + +Patch 8.0.1046 +Problem: Code duplication in diff mode. +Solution: Use diff_equal_char() also in diff_cmp(). (Rick Howe) +Files: src/diff.c + +Patch 8.0.1047 +Problem: Buffer overflow in Ruby. +Solution: Allocate one more byte. (Dominique Pelle) +Files: src/if_ruby.c + +Patch 8.0.1048 +Problem: No test for what 8.0.1020 fixes. +Solution: Add test_feedinput(). Add a test. (Ozaki Kiichi, closes #2046) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_timers.vim, + src/ui.c + +Patch 8.0.1049 +Problem: Shell on Mac can't handle long text, making terminal test fail. +Solution: Only write 1000 characters instead of 5000. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1050 +Problem: Terminal window feature not included by default. +Solution: Include the terminal feature for the "huge" build. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1051 +Problem: Cannot run terminal with spaces in argument. +Solution: Accept backslash to escape space and other characters. (closes + #1999) +Files: src/os_unix.c, src/testdir/test_terminal.vim + +Patch 8.0.1052 +Problem: term_start() does not allow in_io, out_io and err_io options. +Solution: Add JO_OUT_IO to get_job_options(). +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1053 +Problem: setline() does not work on startup. (Manuel Ortega) +Solution: Do not check for ml_mfp to be set for the current buffer. + (Christian Brabandt) +Files: src/testdir/shared.vim, src/testdir/test_alot.vim, + src/testdir/test_bufline.vim, src/testdir/test_timers.vim, + src/evalfunc.c + +Patch 8.0.1054 +Problem: Terminal test fails on MS-Windows. +Solution: Disable the redirection test for now. Improve scrape test to make + it less flaky. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1055 +Problem: Bufline test hangs on MS-Windows. +Solution: Avoid message for writing file. Source shared.vim when running + test individually. +Files: src/testdir/test_bufline.vim, src/testdir/test_timers.vim + +Patch 8.0.1056 +Problem: Cannot build with the diff feature but without the multi-byte + feature. +Solution: Remove #ifdefs. (John Marriott) +Files: src/diff.c + +Patch 8.0.1057 +Problem: Terminal scrape test waits too long, it checks for one instead of + three. +Solution: Check there are three characters. (micbou) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1058 +Problem: Terminal redirection test is flaky. +Solution: Wait for job to finish. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1059 +Problem: older Gnome terminal returns smaller version number. (antarestrue) +Solution: Lower version limit from 2800 to 2500. (#2032) +Files: src/term.c + +Patch 8.0.1060 +Problem: When imstyle is zero, mapping <Left> breaks preediting. +Solution: Pass though preediting key-events. (Yasuhiro Matsumoto, closes + #2064, closes #2063) +Files: src/getchar.c, src/mbyte.c + +Patch 8.0.1061 +Problem: Coverity: no check for NULL command. +Solution: Check for NULL list item. +Files: src/terminal.c + +Patch 8.0.1062 +Problem: Coverity warnings in libvterm. +Solution: Add (void) to avoid warning for not checking return value. + Add "break" before "case". +Files: src/libvterm/src/screen.c, src/libvterm/src/state.c + +Patch 8.0.1063 +Problem: Coverity warns for NULL check and using variable pointer as an + array. +Solution: Remove the NULL check. Make "argvar" an array. +Files: src/terminal.c + +Patch 8.0.1064 +Problem: Coverity warns for leaking resource. +Solution: Free pty_master_fd on failure. +Files: src/os_unix.c + +Patch 8.0.1065 +Problem: Not all macro examples are included in the self-installing + executable. (lkintact) +Solution: Add the directories to the NSIS script. (closes #2065) +Files: nsis/gvim.nsi + +Patch 8.0.1066 +Problem: Some terminals can't handle requesting cursor mode. (Steven + Hartland) +Solution: Recognize vandyke SecureCRT. (closes #2008) +Files: src/term.c + +Patch 8.0.1067 +Problem: Using try/catch in timer does not prevent it from being stopped. +Solution: Reset the exception context and use did_emsg instead of + called_emsg. +Files: src/ex_cmds2.c, src/testdir/test_timers.vim, src/globals.h, + src/message.c + +Patch 8.0.1068 (after 8.0.1066) +Problem: Vandyke SecureCRT terminal can't handle cursor mode request. + (Steven Hartland) +Solution: Fix pointer computation. (closes #2008) +Files: src/term.c + +Patch 8.0.1069 +Problem: Still get CTRL-X sometimes for t_RS request. +Solution: Also skip 0x18 after a key code response. +Files: src/term.c + +Patch 8.0.1070 +Problem: Terminal test is flaky on Mac. +Solution: Add Test_terminal_noblock() to list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1071 +Problem: $TERM names starting with "putty" and "cygwin" are likely to have + a dark background, but are not recognized. +Solution: Only check the first few characters of $TERM to match "putty" or + "cygwin". (Christian Brabandt) +Files: src/option.c + +Patch 8.0.1072 +Problem: The :highlight command causes a redraw even when nothing changed. +Solution: Only set "need_highlight_changed" when an attribute changed. +Files: src/syntax.c + +Patch 8.0.1073 +Problem: May get an endless loop if 'statusline' changes a highlight. +Solution: Do not let evaluating 'statusline' trigger a redraw. +Files: src/buffer.c + +Patch 8.0.1074 +Problem: ":term NONE" does not work on MS-Windows. +Solution: Make it work. Split "pty" into "pty_in" and "pty_out". (Yasuhiro + Matsumoto, closes #2058, closes #2045) +Files: runtime/doc/eval.txt, + runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + src/channel.c, src/evalfunc.c, src/os_unix.c, src/structs.h, + src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1075 +Problem: MS-Windows: mouse does not work in terminal. +Solution: Force the winpty mouse on. (Yasuhiro Matsumoto, closes #2072) +Files: src/terminal.c + +Patch 8.0.1076 +Problem: term_start() does not take callbacks. When using two terminals + without a job only one is read from. A terminal without a window + returns the wrong pty. +Solution: Support "callback", "out_cb" and "err_cb". Fix terminal without a + window. Fix reading from multiple channels. +Files: src/terminal.c, src/proto/terminal.pro, src/channel.c, + +Patch 8.0.1077 +Problem: No debugger making use of the terminal window. +Solution: Add the term debugger plugin. So far only displays the current + line when stopped. +Files: Filelist, runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1078 +Problem: Using freed memory with ":hi Normal". +Solution: Get "item" again after updating the table. +Files: src/syntax.c + +Patch 8.0.1079 +Problem: Memory leak when remote_foreground() fails. +Solution: Free the error message. +Files: src/evalfunc.c, src/if_xcmdsrv.c + +Patch 8.0.1080 +Problem: Memory leak for eof_chars terminal option and buffer name. +Solution: Free job options. Free the buffer name +Files: src/terminal.c + +Patch 8.0.1081 +Problem: Memory leak for the channel write queue. +Solution: Free the write queue when clearing a channel. +Files: src/channel.c + +Patch 8.0.1082 +Problem: Tests fail when run under valgrind. +Solution: Increase waiting times. +Files: src/testdir/test_clientserver.vim, src/testdir/test_terminal.vim + +Patch 8.0.1083 +Problem: Leaking memory in input part of channel. +Solution: Clear the input part of channel. Free the entry. Move failing + command test to a separate file to avoid bogus leak reports + clouding tests that should not leak. +Files: src/channel.c, src/testdir/test_terminal.vim, src/Makefile, + src/testdir/test_terminal_fail.vim, src/testdir/Make_all.mak + +Patch 8.0.1084 +Problem: GTK build has compiler warnings. (Christian Brabandt) +Solution: Get screen size with a different function. (Ken Takata, Yasuhiro + Matsumoto) +Files: src/mbyte.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, + src/gui_beval.c + +Patch 8.0.1085 +Problem: The terminal debugger can't set breakpoints. +Solution: Add :Break and :Delete commands. Also commands for stepping + through code. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1086 (after 8.0.1084) +Problem: Can't build with GTK 3. +Solution: Rename function argument. (Kazunobu Kuriyama) +Files: src/gui_gtk_x11.c + +Patch 8.0.1087 +Problem: Test_terminal_cwd is flaky. MS-Windows: term_start() "cwd" + argument does not work. +Solution: Wait for the condition to be true instead of using a sleep. + Pass the directory to winpty. +Files: src/testdir/test_terminal.vim, src/terminal.c + +Patch 8.0.1088 +Problem: Occasional memory use after free. +Solution: Use the highlight table directly, don't keep a pointer. +Files: src/syntax.c + +Patch 8.0.1089 +Problem: Cannot get range count in user command. +Solution: Add <range> argument. +Files: src/ex_docmd.c, runtime/doc/map.txt + +Patch 8.0.1090 +Problem: cannot get the text under the cursor like v:beval_text +Solution: Add <cexpr>. +Files: src/ex_docmd.c, src/testdir/test_normal.vim, + runtime/doc/cmdline.txt + +Patch 8.0.1091 (after 8.0.1090) +Problem: Test for <cexpr> fails without +balloon_eval feature. +Solution: Remove #ifdefs. +Files: src/normal.c + +Patch 8.0.1092 +Problem: Terminal debugger can't evaluate expressions. +Solution: Add :Evaluate and K. Various other improvements. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1093 +Problem: Various small quickfix issues. +Solution: Remove ":" prefix from title set by a user. Add the qf_id2nr(). + function. Add a couple more tests. Update documentation. + (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, runtime/doc/quickfix.txt, src/evalfunc.c, + src/proto/quickfix.pro, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1094 +Problem: Using ssh from Terminal.app runs into xterm incompatibility. +Solution: Also detect Terminal.app on non-Mac systems. +Files: src/term.c + +Patch 8.0.1095 +Problem: Terminal multibyte scrape test is flaky. +Solution: Add another condition to wait for. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1096 +Problem: Terminal window in Normal mode has wrong background. +Solution: Store the default background and use it for clearing until the + end of the line. Not for below the last line, since there is no + text there. +Files: src/screen.c, src/terminal.c + +Patch 8.0.1097 (after 8.0.1096) +Problem: Background color wrong if job changes background color. +Solution: Get the background color from vterm. +Files: src/terminal.c, src/screen.c + +Patch 8.0.1098 +Problem: Build failure if libvterm installed on the system. (Oleh + Hushchenkov) +Solution: Change the CCCTERM argument order. (Ken Takata, closes #2080) +Files: src/Makefile + +Patch 8.0.1099 +Problem: Warnings for GDK calls. +Solution: Use other calls for GTK 3 and fix a few problems. (Kazunobu + Kuriyama) +Files: src/mbyte.c + +Patch 8.0.1100 +Problem: Stuck in redraw loop when 'lazyredraw' is set. +Solution: Don't loop on update_screen() when not redrawing. (Yasuhiro + Matsumoto, closes #2082) +Files: src/terminal.c, src/screen.c, src/proto/screen.pro + +Patch 8.0.1101 +Problem: Channel write fails if writing to log fails. +Solution: Ignore return value of fwrite(). (Ozaki Kiichi, closes #2081) +Files: src/channel.c + +Patch 8.0.1102 +Problem: Terminal window does not use Normal colors. +Solution: For the GUI and when 'termguicolors' is enabled, use the actual + foreground and background colors for the terminal. (Yasuhiro + Matsumoto, closes #2067) + Use the "Terminal" highlight group if defined. +Files: src/terminal.c, src/syntax.c, src/proto/syntax.pro + +Patch 8.0.1103 (after 8.0.1102) +Problem: Converting cterm color fails for grey ramp. +Solution: Use index instead of number. +Files: src/terminal.c + +Patch 8.0.1104 +Problem: The qf_jump() function is too long. +Solution: Split of parts to separate functions. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1105 +Problem: match() and matchend() are not tested. +Solution: Add tests. (Ozaki Kiichi, closes #2088) +Files: src/testdir/test_functions.vim, src/testdir/test_match.vim + +Patch 8.0.1106 +Problem: Terminal colors on an MS-Windows console are not matching the + normal colors. +Solution: Use the normal colors for the terminal. (Yasuhiro Matsumoto, + closes #2087) +Files: src/terminal.c + +Patch 8.0.1107 +Problem: Terminal debugger jumps to non-existing file. +Solution: Check that the file exists. Add an option to make the Vim width + wide. Fix removing highlight groups. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1108 +Problem: Cannot specify mappings for the terminal window. +Solution: Add the :tmap command and associated code. (Jacob Askeland, + closes #2073) +Files: runtime/doc/map.txt, runtime/doc/terminal.txt, src/ex_cmdidxs.h, + src/ex_cmds.h, src/ex_docmd.c, src/getchar.c, src/gui.c, + src/terminal.c, src/testdir/test_terminal.vim, src/vim.h, + src/proto/terminal.pro, src/main.c, src/evalfunc.c + +Patch 8.0.1109 +Problem: Timer causes error on exit from Ex mode. (xtal8) +Solution: save and restore the ex_pressedreturn flag. (Christian Brabandt, + closes #2079) +Files: src/ex_docmd.c, src/proto/ex_docmd.pro, src/ex_cmds2.c, + src/testdir/test_timers.vim + +Patch 8.0.1110 +Problem: FORTIFY_SOURCE from Perl causes problems. (Scott Baker) +Solution: Filter out the flag. (Christian Brabandt, closes #2068) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1111 +Problem: Syntax error in configure when using Perl. +Solution: Add missing quote +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1112 +Problem: Can't get size or current index from quickfix list. +Solution: Add "idx" and "size" options. (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1113 +Problem: Can go to Insert mode from Terminal-Normal mode. +Solution: Prevent :startinsert and "VA" to enter Insert mode. (Yasuhiro + Matsumoto, closes #2092) +Files: src/normal.c + +Patch 8.0.1114 +Problem: Default for 'iminsert' is annoying. +Solution: Make the default always zero. (Yasuhiro Matsumoto, closes #2071) +Files: src/option.c, runtime/doc/options.txt + +Patch 8.0.1115 +Problem: Crash when using foldtextresult() recursively. +Solution: Avoid recursive calls. (Yasuhiro Matsumoto, closes #2098) +Files: src/evalfunc.c, src/testdir/test_fold.vim + +Patch 8.0.1116 +Problem: Terminal test fails on MS-Windows. +Solution: Wait for the text to appear. (micbou, closes #2097) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1117 +Problem: Test_terminal_no_cmd hangs on MS-Windows with GUI. (Christian + Brabandt) +Solution: Run the command with "start" and wait for the text to appear. + (micbou, closes #2096) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1118 +Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always + enabled and only adds 7% to the binary size of the tiny build. +Solution: Graduate FEAT_WINDOWS. +Files: src/feature.h, src/window.c, src/vim.h, src/structs.h, + src/globals.h, src/gui.h, src/if_py_both.h, src/option.h, + src/term.h, src/buffer.c, src/charset.c, src/digraph.c, + src/edit.c, src/eval.c, src/evalfunc.c, src/ex_cmds.c, + src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/fileio.c, + src/fold.c, src/getchar.c, src/gui.c, src/gui_athena.c, + src/gui_beval.c, src/gui_gtk.c, src/gui_motif.c, src/gui_w32.c, + src/if_cscope.c, src/if_lua.c, src/if_mzsch.c, src/if_python.c, + src/if_python3.c, src/if_ruby.c, src/if_tcl.c, src/main.c, + src/mark.c, src/memline.c, src/misc1.c, src/misc2.c, src/move.c, + src/netbeans.c, src/normal.c, src/option.c, src/popupmnu.c, + src/quickfix.c, src/screen.c, src/search.c, src/spell.c, + src/syntax.c, src/tag.c, src/term.c, src/ui.c, src/version.c, + src/workshop.c, src/if_perl.xs, src/testdir/test_normal.vim + +Patch 8.0.1119 +Problem: Quitting a split terminal window kills the job. (Yasuhiro + Matsumoto) +Solution: Only stop terminal job if it is the last window. +Files: src/buffer.c, src/testdir/test_terminal.vim + +Patch 8.0.1120 (after 8.0.1108) +Problem: :tm means :tmap instead of :tmenu. (Taro Muraoka) +Solution: Move the new entry below the old entry. (closes #2102) +Files: src/ex_cmds.h, runtime/doc/map.txt + +Patch 8.0.1121 +Problem: Can uncheck executables in MS-Windows installer. +Solution: Make the choice read-only. (Ken Takata, closes #2106) +Files: nsis/gvim.nsi + +Patch 8.0.1122 +Problem: vimtutor.bat doesn't work well with vim.bat. +Solution: Use "call vim". (Ken Takata, closes #2105) +Files: vimtutor.bat + +Patch 8.0.1123 +Problem: Cannot define a toolbar for a window. +Solution: Add a window-local toolbar. +Files: src/syntax.c, src/proto/syntax.pro, src/structs.h, src/menu.c, + src/proto/menu.pro, src/testdir/test_winbar.vim, src/Makefile, + src/normal.c, src/testdir/Make_all.mak, src/if_perl.xs, + src/eval.c, src/evalfunc.c, src/window.c, src/ui.c, + src/terminal.c, src/screen.c, + runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/gui.txt, runtime/doc/terminal.txt + +Patch 8.0.1124 +Problem: Use of MZSCHEME_VER is unclear. +Solution: Add a comment. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.1125 +Problem: Wrong window height when splitting window with window toolbar. +Solution: Add or subtract the window toolbar height. +Files: src/window.c + +Patch 8.0.1126 +Problem: Endless resize when terminal showing in two buffers. (Hirohito + Higashi) +Solution: Set a flag to prevent resizing the window. +Files: src/terminal.c + +Patch 8.0.1127 +Problem: Test_peek_and_get_char fails on 32 bit system. (Elimar + Riesebieter) +Solution: Avoid an integer overflow. (James McCoy, closes #2116) +Files: src/ex_cmds2.c + +Patch 8.0.1128 +Problem: Old xterm sends CTRL-X in response to t_RS. +Solution: Only send t_RS for xterm 279 and later. Remove the workaround to + ignore CTRL-X. +Files: src/term.c + +Patch 8.0.1129 +Problem: Window toolbar missing a part of the patch. +Solution: Add change in vim.h. +Files: src/vim.h + +Patch 8.0.1130 +Problem: The qf_jump() function is still too long. +Solution: Split of parts to separate functions. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1131 +Problem: It is not easy to trigger an autocommand for new terminal window. + (Marco Restelli) +Solution: Trigger BufWinEnter after setting 'buftype'. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1132 +Problem: #if condition is not portable. +Solution: Add defined(). (Zuloloxi, closes #2136) +Files: src/libvterm/src/vterm.c + +Patch 8.0.1133 +Problem: Syntax timeout not used correctly. +Solution: Do not pass the timeout to syntax_start() but set it explicitly. + (Yasuhiro Matsumoto, closes #2139) +Files: src/proto/syntax.pro, src/screen.c, src/syntax.c + +Patch 8.0.1134 +Problem: Superfluous call to syn_get_final_id(). +Solution: Remove it. (Ken Takata) +Files: src/syntax.c + +Patch 8.0.1135 +Problem: W_WINCOL() is always the same. +Solution: Expand the macro. +Files: src/edit.c, src/ex_docmd.c, src/gui_gtk.c, src/gui_w32.c, + src/netbeans.c, src/popupmnu.c, src/screen.c, src/term.c, + src/terminal.c, src/ui.c, src/window.c, src/if_py_both.h, + src/structs.h, src/vim.h + +Patch 8.0.1136 +Problem: W_WIDTH() is always the same. +Solution: Expand the macro. +Files: src/charset.c, src/edit.c, src/evalfunc.c, src/ex_cmds.c, + src/ex_docmd.c, src/getchar.c, src/gui.c, src/gui_beval.c, + src/gui_mac.c, src/if_lua.c, src/if_mzsch.c, src/if_py_both.h, + src/if_ruby.c, src/misc1.c, src/misc2.c, src/move.c, src/normal.c, + src/popupmnu.c, src/quickfix.c, src/screen.c, src/search.c, + src/structs.h, src/ui.c, src/vim.h, src/window.c + +Patch 8.0.1137 (after 8.0.1136) +Problem: Cannot build with Ruby. +Solution: Fix misplaced brace. +Files: src/if_ruby.c + +Patch 8.0.1138 +Problem: Click in window toolbar starts Visual mode. +Solution: Add the MOUSE_WINBAR flag. +Files: src/ui.c, src/vim.h, src/normal.c + +Patch 8.0.1139 +Problem: Using window toolbar changes state. +Solution: Always execute window toolbar actions in Normal mode. +Files: runtime/doc/gui.txt, src/structs.h, src/ex_docmd.c, + src/proto/ex_docmd.pro, src/menu.c + +Patch 8.0.1140 +Problem: Still old style tests. +Solution: Convert two tests to new style. (Yegappan Lakshmanan) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/test56.in, src/testdir/test56.ok, + src/testdir/test57.in, src/testdir/test57.ok, + src/testdir/test_sort.vim, src/testdir/test_vimscript.vim + +Patch 8.0.1141 +Problem: MS-Windows build dependencies are incomplete. +Solution: Fix the dependencies. (Ken Takata) +Files: src/Make_cyg.mak, src/Make_cyg_ming.mak, src/Make_ming.mak, + src/Make_mvc.mak + +Patch 8.0.1142 +Problem: Window toolbar menu gets a tear-off item. +Solution: Recognize the window toolbar. +Files: src/menu.c + +Patch 8.0.1143 +Problem: Macros always expand to the same thing. +Solution: Remove W_VSEP_WIDTH() and W_STATUS_HEIGHT(). +Files: src/vim.h, src/structs.h, src/gui.c, src/ex_getln.c, src/screen.c + +Patch 8.0.1144 +Problem: Using wrong #ifdef for computing length. +Solution: use BACKSLASH_IN_FILENAME instead of COLON_IN_FILENAME. (Yasuhiro + Matsumoto, closes #2153) +Files: src/quickfix.c + +Patch 8.0.1145 +Problem: Warning when compiling with Perl. +Solution: Remove unused variable. (Ken Takata) +Files: src/if_perl.xs + +Patch 8.0.1146 +Problem: Redraw when highlight is set with same names. (Ozaki Kiichi) +Solution: Only free and save a name when it changed. (closes #2120) +Files: src/syntax.c + +Patch 8.0.1147 +Problem: Fail to build with tiny features. (Tony Mechelynck) +Solution: Move #ifdefs. +Files: src/syntax.c + +Patch 8.0.1148 +Problem: "gN" doesn't work on last match with 'wrapscan' off. (fcpg) +Solution: Adjust for searching backward. (Christian Brabandt) +Files: src/search.c, src/testdir/test_gn.vim + +Patch 8.0.1149 +Problem: libvterm colors differ from xterm. +Solution: Use the xterm colors for libvterm. +Files: src/terminal.c, src/libvterm/src/pen.c, + src/testdir/xterm_ramp.vim, Filelist + +Patch 8.0.1150 +Problem: MS-Windows GUI: dialog font size is incorrect. +Solution: Pass flag to indicate 'encoding' or active codepage. (Yasuhiro + Matsumoto, closes #2160) +Files: src/gui_w32.c + +Patch 8.0.1151 +Problem: "vim -c startinsert!" doesn't append. +Solution: Correct line number on startup. (Christian Brabandt, closes #2117) +Files: src/ex_docmd.c, src/testdir/test_startup.vim + +Patch 8.0.1152 +Problem: Encoding of error message wrong in Cygwin terminal. +Solution: Get locale from environment variables. (Ken Takata) +Files: src/main.c, src/mbyte.c, src/proto/mbyte.pro + +Patch 8.0.1153 +Problem: No tests for diff_hlID() and diff_filler(). +Solution: Add tests. (Dominique Pelle, closes #2156) +Files: src/testdir/test_diffmode.vim + +Patch 8.0.1154 +Problem: 'indentkeys' does not work properly. (Gary Johnson) +Solution: Get the cursor line again. (Christian Brabandt, closes #2151) +Files: src/edit.c, src/testdir/test_edit.vim + +Patch 8.0.1155 +Problem: Ruby command triggers a warning when RUBYOPT is set to "-w". +Solution: use "-e_=0" instead of "-e0". (Masataka Pocke Kuwabara, closes + #2143) +Files: src/if_ruby.c + +Patch 8.0.1156 +Problem: Removing one -W argument from Perl CFLAGS may cause trouble. +Solution: Remove all -W flags. (Christian Brabandt) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1157 +Problem: Compiler warning on MS-Windows. +Solution: Add type cast. (Yasuhiro Matsomoto) +Files: src/main.c + +Patch 8.0.1158 +Problem: Still old style tests. +Solution: Convert several tests to new style. (Yegappan Lakshmanan) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test33.in, + src/testdir/test33.ok, src/testdir/test41.in, + src/testdir/test41.ok, src/testdir/test43.in, + src/testdir/test43.ok, src/testdir/test53.in, + src/testdir/test53.ok, src/testdir/test_file_size.vim, + src/testdir/test_lispwords.vim, src/testdir/test_search.vim, + src/testdir/test_textobjects.vim + +Patch 8.0.1159 +Problem: Typo in #ifdef. +Solution: Change "PROT" to "PROTO". (Nobuhiro Takasaki, closes #2165) +Files: src/syntax.c + +Patch 8.0.1160 +Problem: Getting tab-local variable fails after closing window. +Solution: set tp_firstwin and tp_lastwin. (Jason Franklin, closes #2170) +Files: src/window.c, src/evalfunc.c, src/testdir/test_getvar.vim + +Patch 8.0.1161 +Problem: Popup menu drawing problem when resizing terminal. +Solution: Redraw after resizing also when a popup menu is visible. (Ozaki + Kiichi, closes #2110) +Files: src/popupmnu.c, src/term.c, src/testdir/shared.vim, + src/testdir/test_popup.vim + +Patch 8.0.1162 +Problem: Shared script for tests cannot be included twice. +Solution: Include it where needed, it will "finish" if loaded again. +Files: src/testdir/test_alot.vim, src/testdir/test_bufline.vim, + src/testdir/test_timers.vim + +Patch 8.0.1163 +Problem: Popup test is flaky. +Solution: Add a WaitFor() and fix another. +Files: src/testdir/test_popup.vim + +Patch 8.0.1164 +Problem: Changing StatusLine highlight while evaluating 'statusline' may + not change the status line color. +Solution: When changing highlighting while redrawing don't cause another + redraw. (suggested by Ozaki Kiichi, closes #2171, closes #2120) +Files: src/buffer.c, src/syntax.c + +Patch 8.0.1165 +Problem: Popup test is still flaky. +Solution: Add a term_wait() call. (Ozaki Kiichi) +Files: src/testdir/test_popup.vim + +Patch 8.0.1166 +Problem: :terminal doesn't work on Mac High Sierra. +Solution: Change #ifdef for OpenPTY(). (Ozaki Kiichi, Kazunobu Kuriyama, + closes #2162) +Files: src/pty.c + +Patch 8.0.1167 +Problem: Motif: typing in terminal window is slow. +Solution: Do not redraw the whole terminal window but only what was changed. +Files: src/terminal.c + +Patch 8.0.1168 +Problem: wrong highlighting with combination of match and 'cursorline'. +Solution: Use "line_attr" when appropriate. (Ozaki Kiichi, closes #2111) + But don't highlight more than one character. +Files: src/screen.c, src/testdir/test_highlight.vim, + src/testdir/view_util.vim + +Patch 8.0.1169 +Problem: Highlighting one char too many with 'list' and 'cul'. +Solution: Check for 'list' being active. (Ozaki Kiichi, closes #2177) +Files: src/screen.c, src/testdir/test_highlight.vim + +Patch 8.0.1170 +Problem: Using termdebug results in 100% CPU time. (tomleb) +Solution: Use polling instead of select(). +Files: src/os_unix.c, src/channel.c, src/proto/channel.pro + +Patch 8.0.1171 +Problem: Popup test is still a bit flaky. +Solution: Change term_wait() calls. (Ozaki Kiichi) +Files: src/testdir/test_popup.vim + +Patch 8.0.1172 +Problem: When E734 is given option is still set. +Solution: Assign NULL to "s". (Christian Brabandt) +Files: src/eval.c, src/testdir/test_assign.vim + +Patch 8.0.1173 +Problem: Terminal window is not redrawn after CTRL-L. (Marcin Szamotulski) +Solution: Redraw the whole terminal when w_redr_type is NOT_VALID. +Files: src/terminal.c + +Patch 8.0.1174 +Problem: Mac Terminal.app has wrong color for white. +Solution: Use white from the color cube. +Files: src/globals.h, src/term.c, src/syntax.c + +Patch 8.0.1175 (after 8.0.1174) +Problem: Build failure without +termresponse. +Solution: Add #ifdef. +Files: src/syntax.c + +Patch 8.0.1176 +Problem: Job_start() does not handle quote and backslash correctly. +Solution: Remove quotes, recognize and remove backslashes. +Files: src/testdir/test_channel.vim, src/os_unix.c + +Patch 8.0.1177 +Problem: In a terminal window the popup menu is not cleared. (Gerry + Agbobada) +Solution: Redraw when SOME_VALID is used instead of NOT_VALID. (closes + #2194) +Files: src/terminal.c + +Patch 8.0.1178 +Problem: Using old compiler on MS-Windows. +Solution: Switch default build on MS-Windows to use MSVC 2015. (Ken Takata) +Files: src/msvc2015.bat, src/INSTALLpc.txt, src/GvimExt/Makefile, + src/Make_mvc.mak, src/tee/Make_mvc.mak, src/xxd/Make_mvc.mak + +Patch 8.0.1179 +Problem: Test_popup_and_window_resize() does not always pass. +Solution: Do not use $VIMPROG, pass the Vim executable in the vimcmd file. + (Ozaki Kiichi, closes #2186) +Files: src/testdir/Makefile, src/testdir/shared.vim, + src/testdir/test_popup.vim + +Patch 8.0.1180 +Problem: MS-Windows testclean target deletes the color script. +Solution: Rename the script file. +Files: src/testdir/xterm_ramp.vim, src/testdir/color_ramp.vim + +Patch 8.0.1181 +Problem: Tests using Vim command fail on MS-Windows. +Solution: Do not add quotes around the Vim command. +Files: src/testdir/Make_dos.mak, src/testdir/Make_ming.mak + +Patch 8.0.1182 +Problem: Cannot see or change mzscheme dll name. +Solution: Add 'mzschemedll' and 'mzschemegcdll'. +Files: src/if_mzsch.c, src/option.h, src/option.c, + runtime/doc/if_mzsch.txt + +Patch 8.0.1183 +Problem: MS-Windows build instructions are outdated. +Solution: Update instructions for MSVC 2015. Update the build script. +Files: Filelist, Makefile, src/INSTALLpc.txt, src/bigvim.bat + +Patch 8.0.1184 +Problem: The :marks command is not tested. +Solution: Add a test. (Dominique Pelle, closes #2197) +Files: src/testdir/test_marks.vim + +Patch 8.0.1185 +Problem: Ruby library includes minor version number. +Solution: Only use the API version number. (Ben Boeckel, closes #2199) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1186 +Problem: Still quite a few old style tests. +Solution: Convert old to new style tests. (Yegappan Lakshmanan) + Avoid ringing the bell while running tests. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/main.aap, + src/testdir/test31.in, src/testdir/test31.ok, + src/testdir/test4.in, src/testdir/test4.ok, src/testdir/test5.in, + src/testdir/test5.ok, src/testdir/test60.in, + src/testdir/test60.ok, src/testdir/test60.vim, + src/testdir/test7.in, src/testdir/test7.ok, src/testdir/test78.in, + src/testdir/test78.ok, src/testdir/test_autocmd.vim, + src/testdir/test_exists.vim, src/testdir/test_recover.vim, + src/testdir/test_winbuf_close.vim, src/testdir/runtest.vim + +Patch 8.0.1187 +Problem: Building with lua fails for OSX on Travis. +Solution: Separate brew-update and brew-install. (Ozaki Kiichi, closes #2203) +Files: .travis.yml + +Patch 8.0.1188 +Problem: Autocmd test fails on MS-Windows. +Solution: Give the buffer a name and find the buffer to be wiped out by + name. +Files: src/testdir/test_autocmd.vim + +Patch 8.0.1189 +Problem: E172 is not actually useful, it's only on Unix anyway. +Solution: Remove the check and the error. +Files: src/ex_docmd.c, runtime/doc/message.txt + +Patch 8.0.1190 +Problem: Vim becomes unusable after opening new window in BufWritePre + event. +Solution: Call not_exiting(). (Martin Tournoij, closes #2205) + Also for "2q" when a help window is open. Add a test. +Files: src/ex_docmd.c, src/testdir/test_writefile.vim + +Patch 8.0.1191 +Problem: MS-Windows: missing 32 and 64 bit files in installer. +Solution: Include both 32 and 64 bit GvimExt and related dll files. Remove + old Windows code from the installer. (Ken Takata, closes #2144) +Files: nsis/README.txt, nsis/gvim.nsi, src/GvimExt/gvimext.cpp, + src/dosinst.c, src/dosinst.h, src/uninstal.c, Makefile + +Patch 8.0.1192 +Problem: MS-Windows: terminal feature not enabled by default. +Solution: Enable it. (Ken Takata) +Files: src/Make_cyg_ming.mak, src/Make_mvc.mak + +Patch 8.0.1193 +Problem: Crash when wiping out a buffer after using getbufinfo(). + (Yegappan Lakshmanan) +Solution: Remove b:changedtick from the buffer variables. +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 8.0.1194 +Problem: Actual fg and bg colors of terminal are unknown. +Solution: Add t_RF. Store response to t_RB and t_RF, use for terminal. +Files: src/term.c, src/term.h, src/proto/term.pro, src/terminal.c, + src/vim.h, src/eval.c, runtime/doc/eval.txt + +Patch 8.0.1195 (after 8.0.1194) +Problem: Can't build on MS-Windows. +Solution: Adjust #ifdef and add #ifdefs. +Files: src/term.c, src/terminal.c + +Patch 8.0.1196 (after 8.0.1194) +Problem: Crash when t_RF is not set. (Brian Pina) +Solution: Add t_RF to the list of terminal options. (Hirohito Higashi) +Files: src/option.c + +Patch 8.0.1197 +Problem: MS-Windows build instructions are not up to date. +Solution: Adjust the instructions. Fix the nsis script. +Files: Makefile, nsis/gvim.nsi + +Patch 8.0.1198 +Problem: Older compilers don't know uint8_t. +Solution: Use char_u instead. +Files: src/term.c, src/proto/term.pro + +Patch 8.0.1199 +Problem: When 'clipboard' is "autoselectplus" the star register is also + set. (Gilles Moris) +Solution: Don't set the star register in this situation. +Files: src/ops.c + +Patch 8.0.1200 +Problem: Tests switch the bell off twice. +Solution: Don't set 'belloff' in individual tests. (Christian Brabandt) +Files: src/testdir/test_alot.vim, src/testdir/test_alot_utf8.vim, + src/testdir/test_autocmd.vim, src/testdir/test_cmdline.vim, + src/testdir/test_diffmode.vim, src/testdir/test_digraph.vim, + src/testdir/test_edit.vim, src/testdir/test_file_size.vim, + src/testdir/test_gn.vim, src/testdir/test_normal.vim, + src/testdir/test_packadd.vim, src/testdir/test_popup.vim, + src/testdir/test_recover.vim, src/testdir/test_search.vim, + src/testdir/test_textobjects.vim, src/testdir/test_undo.vim, + src/testdir/test_usercommands.vim, src/testdir/test_visual.vim + +Patch 8.0.1201 +Problem: "yL" is affected by 'scrolloff'. (Eli the Bearded) +Solution: Don't use 'scrolloff' when an operator is pending. +Files: src/normal.c, runtime/doc/motion.txt + +Patch 8.0.1202 +Problem: :wall gives an error for a terminal window. (Marius Gedminas) +Solution: Don't try writing a buffer that can't be written. (Yasuhiro + Matsumoto, closes #2190) +Files: src/ex_cmds.c, src/testdir/test_terminal.vim + +Patch 8.0.1203 +Problem: Terminal window mistreats composing characters. +Solution: Count composing characters with the base character. (Ozaki Kiichi, + closes #2195) +Files: src/mbyte.c, src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1204 +Problem: A QuitPre autocommand may get the wrong file name. +Solution: Pass the buffer being closed to apply_autocmds(). (Rich Howe) +Files: src/ex_docmd.c, src/testdir/test_autocmd.vim + +Patch 8.0.1205 +Problem: Using "1q" it is possible to unload a changed buffer. (Rick Howe) +Solution: Check the right window for changes. +Files: src/testdir/test_edit.vim, src/ex_docmd.c + +Patch 8.0.1206 +Problem: No autocmd for entering or leaving the command line. +Solution: Add CmdlineEnter and CmdlineLeave. +Files: runtime/doc/autocmd.txt, src/ex_getln.c, src/fileio.c, src/vim.h, + src/testdir/test_autocmd.vim + +Patch 8.0.1207 +Problem: Profiling skips the first and last script line. +Solution: Check for BOM after setting script ID. (Lemonboy, closes #2103, + closes #2112) Add a test. List the trailing script lines. +Files: src/testdir/test_profile.vim, src/ex_cmds2.c + +Patch 8.0.1208 +Problem: 'statusline' drops empty group with highlight change. +Solution: Do not drop an empty group if it changes highlighting. (Marius + Gedminas, closes #2228) +Files: src/buffer.c, src/testdir/test_statusline.vim + +Patch 8.0.1209 +Problem: Still too many old style tests. +Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, + closes #2230) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_ming.mak, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Makefile, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test34.in, + src/testdir/test34.ok, src/testdir/test54.in, + src/testdir/test54.ok, src/testdir/test8.in, src/testdir/test8.ok, + src/testdir/test_autocmd.vim, src/testdir/test_autoformat_join.in, + src/testdir/test_autoformat_join.ok, src/testdir/test_join.vim, + src/testdir/test_user_func.vim + +Patch 8.0.1210 +Problem: When typing a search pattern CTRL-G and CTRL-T are ignored when + there is typeahead. +Solution: Don't pass SEARCH_PEEK and don't call char_avail(). (haya14busa, + closes #2233) +Files: src/ex_getln.c, src/testdir/test_search.vim + +Patch 8.0.1211 +Problem: Cannot reorder tab pages with drag & drop. +Solution: Support drag & drop for GTK and MS-Windows. (Ken Takata, Masamichi + Abe) +Files: src/gui_gtk_x11.c, src/gui_w32.c + +Patch 8.0.1212 +Problem: MS-Windows: tear-off menu does not work on 64 bit. (shaggyaxe) +Solution: Change how the menu handle is looked up. (Ken Takata, closes + #1205) +Files: src/gui_w32.c + +Patch 8.0.1213 +Problem: Setting 'mzschemedll' has no effect. +Solution: Move loading .vimrc to before call to mzscheme_main(). +Files: src/main.c + +Patch 8.0.1214 +Problem: Accessing freed memory when EXITFREE is set and there is more than + one tab and window. (Dominique Pelle) +Solution: Free options later. Skip redraw when exiting. +Files: src/screen.c, src/misc2.c + +Patch 8.0.1215 +Problem: Newer gcc warns for implicit fallthrough. +Solution: Consistently use a FALLTHROUGH comment. (Christian Brabandt) +Files: src/buffer.c, src/edit.c, src/eval.c, src/ex_docmd.c, + src/ex_getln.c, src/main.c, src/message.c, src/normal.c, + src/regexp.c, src/regexp_nfa.c, src/spell.c, src/window.c, + src/if_perl.xs + +Patch 8.0.1216 +Problem: Tabline is not always updated for :file command. (Norio Takagi) +Solution: Set redraw_tabline. (Hirohito Higashi) +Files: src/ex_cmds.c + +Patch 8.0.1217 +Problem: Can't use remote eval to inspect vars in debug mode. +Solution: Don't discard the call stack in debug mode. (closes #2237, #2247) +Files: src/globals.h, src/ex_cmds2.c, src/main.c + +Patch 8.0.1218 +Problem: Writing to freed memory in autocmd. +Solution: Make a copy of the tag line. (Dominique Pelle, closes #2245) +Files: src/tag.c, src/testdir/test_autocmd.vim + +Patch 8.0.1219 +Problem: Terminal test is flaky. +Solution: Add test function to list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1220 +Problem: Skipping empty statusline groups is not correct. +Solution: Also set group_end_userhl. (itchyny) +Files: src/buffer.c, src/testdir/test_statusline.vim + +Patch 8.0.1221 +Problem: Still too many old style tests. +Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, + closes #2256) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test19.in, + src/testdir/test19.ok, src/testdir/test20.in, + src/testdir/test20.ok, src/testdir/test25.in, + src/testdir/test25.ok, src/testdir/test28.in, + src/testdir/test28.ok, src/testdir/test32.in, + src/testdir/test32.ok, src/testdir/test38.in, + src/testdir/test38.ok, src/testdir/test66.in, + src/testdir/test66.ok, src/testdir/test79.in, + src/testdir/test79.ok, src/testdir/test_ins_complete.vim, + src/testdir/test_source_utf8.vim, src/testdir/test_substitute.vim, + src/testdir/test_tab.vim, src/testdir/test_tagjump.vim, + src/testdir/test_undo.vim, src/testdir/test_visual.vim, + src/testdir/test79.ok, src/testdir/test79.in, + src/testdir/test28.in + +Patch 8.0.1222 +Problem: Test functions interfere with each other. +Solution: Cleanup tab pages, windows and buffers. Reset option. +Files: src/testdir/runtest.vim, src/testdir/test_filetype.vim, + src/testdir/test_tabpage.vim, src/testdir/test_lispwords.vim + +Patch 8.0.1223 +Problem: Crash when using autocomplete and tab pages. +Solution: Check if the current tab changed. (Christian Brabandt, closes + #2239) +Files: src/popupmnu.c, src/testdir/test_popup.vim, src/misc1.c, + +Patch 8.0.1224 +Problem: Still interference between test functions. +Solution: Clear autocommands. Wipe all buffers. Fix tests that depend on a + specific start context. +Files: src/testdir/runtest.vim, src/testdir/test_autocmd.vim, + src/testdir/test_arglist.vim, src/testdir/test_bufwintabinfo.vim, + src/testdir/test_command_count.vim, src/testdir/test_quickfix.vim, + src/testdir/test_hardcopy.vim, src/testdir/test_ins_complete.vim, + src/testdir/test_packadd.vim, src/testdir/test_signs.vim, + src/testdir/test_autochdir.vim + +Patch 8.0.1225 +Problem: No check for spell region being zero. (geeknik) +Solution: Check for zero. (closes #2252) +Files: src/spellfile.c, src/testdir/test_spell.vim + +Patch 8.0.1226 +Problem: Edit and popup tests failing. +Solution: Make the tests pass. +Files: src/testdir/test_edit.vim, src/testdir/test_popup.vim + +Patch 8.0.1227 +Problem: Undefined left shift in readfile(). (Brian 'geeknik' Carpenter) +Solution: Add cast to unsigned. (Dominique Pelle, closes #2253) +Files: src/fileio.c + +Patch 8.0.1228 +Problem: Invalid memory access in GUI test. +Solution: Check that the row is not outside of the screen. +Files: src/screen.c + +Patch 8.0.1229 +Problem: Condition in vim_str2nr() is always true. (Nikolai Pavlov) +Solution: Remove the condition. (Closes #2259) +Files: src/charset.c + +Patch 8.0.1230 +Problem: CTRL-A in Visual mode uses character after selection. (Nikolai + Pavlov) +Solution: Check the length before using a character. +Files: src/charset.c + +Patch 8.0.1231 +Problem: Expanding file name drops dash. (stucki) +Solution: Use the right position. (Christian Brabandt, closes #2184) +Files: src/ex_docmd.c, src/testdir/test_cmdline.vim + +Patch 8.0.1232 +Problem: MS-Windows users are confused about default mappings. +Solution: Don't map keys in the console where they don't work. Add a choice + in the installer to use MS-Windows key bindings or not. (Christian + Brabandt, Ken Takata, closes #2093) +Files: Filelist, nsis/gvim.nsi, nsis/vimrc.ini, src/dosinst.c, + runtime/mswin.vim + +Patch 8.0.1233 +Problem: Typo in dos installer. +Solution: Remove comma. +Files: src/dosinst.c + +Patch 8.0.1234 +Problem: MS-Windows: composing characters are not shown properly. +Solution: Pass base character and composing characters to the renderer at + once. (Ken Takata, closes #2206) +Files: src/gui.c, src/gui_w32.c + +Patch 8.0.1235 +Problem: Cannot disable the terminal feature in a huge build. (lindhobe) +Solution: Adjust the autoconf check. (Kazunobu Kuriyama, closes #2242) +Files: src/configure.ac, src/auto/configure, src/Makefile + +Patch 8.0.1236 +Problem: Mac features are confusing. +Solution: Make feature names more consistent, add "osxdarwin". Rename + feature flags, cleanup Mac code. (Kazunobu Kuriyama, closes #2178) + Also includes a fix for when Ruby throws an exception inside + :rubyfile.(ujihisa) +Files: runtime/doc/eval.txt, runtime/doc/os_mac.txt, src/auto/configure, + src/config.h.in, src/configure.ac, src/digraph.c, src/edit.c, + src/evalfunc.c, src/feature.h, src/fileio.c, src/getchar.c, + src/globals.h, src/gui.c, src/gui_mac.c, src/if_python.c, + src/if_python3.c, src/if_ruby.c, src/keymap.h, src/macros.h, + src/main.c, src/mbyte.c, src/message.c, src/misc1.c, src/misc2.c, + src/option.c, src/os_mac.h, src/os_macosx.m, src/os_unix.c, + src/proto.h, src/pty.c, src/structs.h, src/term.c, src/termlib.c, + src/ui.c, src/undo.c, src/version.c, src/vim.h, src/window.c + +Patch 8.0.1237 +Problem: ":set scroll&" often gives an error. +Solution: Don't use a fixed default value, use half the window height. Add a + test. (Ozaki Kiichi, closes #2104) +Files: src/Makefile, src/option.c, src/testdir/test_alot.vim, + src/testdir/test_scroll_opt.vim + +Patch 8.0.1238 +Problem: Incremental search only shows one match. +Solution: When 'incsearch' and 'hlsearch' are both set highlight all + matches. (haya14busa, itchyny, closes #2198) +Files: runtime/doc/options.txt, src/ex_getln.c, src/proto/search.pro, + src/search.c, src/testdir/test_search.vim + +Patch 8.0.1239 +Problem: Cannot use a lambda for the skip argument to searchpair(). +Solution: Evaluate a partial, funcref and lambda. (LemonBoy, closes #1454, + closes #2265) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/proto/evalfunc.pro, + src/eval.c, src/proto/eval.pro, src/search.c, + src/testdir/test_search.vim + +Patch 8.0.1240 +Problem: MS-Windows: term_start() does not support environment. +Solution: Implement the environment argument. (Yasuhiro Matsumoto, closes + #2264) +Files: src/os_win32.c, src/proto/os_win32.pro, src/terminal.c, + src/testdir/test_terminal.vim + +Patch 8.0.1241 +Problem: Popup test is flaky. (James McCoy) +Solution: Increase the wait time. (Dominique Pelle) +Files: src/testdir/test_popup.vim + +Patch 8.0.1242 +Problem: Function argument with only dash is seen as number zero. (Wang + Shidong) +Solution: See a dash as a string. (Christian Brabandt) +Files: src/testdir/test_ins_complete.vim, src/Makefile, src/eval.c + +Patch 8.0.1243 +Problem: No test for what 8.0.1227 fixes. +Solution: Add a test that triggers the problem. (Christian Brabandt) +Files: src/testdir/test_normal.vim, src/testdir/test_search.vim + +Patch 8.0.1244 +Problem: Search test does not work correctly on MS-Windows. +Solution: Put text in a file instead of sending it to the terminal. + (Christian Brabandt) +Files: src/testdir/test_search.vim + +Patch 8.0.1245 +Problem: When WaitFor() has a wrong expression it just waits a second, + which goes unnoticed. (James McCoy) +Solution: When WaitFor() times out throw an exception. Fix places where the + expression was wrong. +Files: src/testdir/shared.vim, src/testdir/test_channel.vim, + src/testdir/test_netbeans.vim, src/testdir/test_terminal.vim + +Patch 8.0.1246 +Problem: Popup test has an arbitrary delay. +Solution: Wait for the ruler to show. (James McCoy) +Files: src/testdir/test_popup.vim + +Patch 8.0.1247 +Problem: Not easy to find Debian build info. +Solution: Add a badge in the README file. (Dominique Pelle) +Files: README.md + +Patch 8.0.1248 (after 8.0.1247) +Problem: Stray + in README file. +Solution: Remove the +. Add a line break. +Files: README.md + +Patch 8.0.1249 +Problem: No error when WaitFor() gets an invalid wrong expression. +Solution: Do not ignore errors in evaluation of the expression. Fix places + where the expression was wrong. +Files: src/testdir/shared.vim, src/testdir/test_netbeans.vim + +Patch 8.0.1250 +Problem: 'hlsearch' highlighting not removed after incsearch (lacygoill) +Solution: Redraw all windows. Start search at the end of the match. Improve + how CTRL-G works with incremental search. Add tests. (Christian + Brabandt, Hirohito Higashi, haya14busa, closes #2267) +Files: runtime/doc/options.txt, src/ex_getln.c, + src/testdir/test_search.vim + +Patch 8.0.1251 (after 8.0.1249) +Problem: Invalid expression passed to WaitFor(). +Solution: Check if the variable exists. +Files: src/testdir/test_clientserver.vim + +Patch 8.0.1252 +Problem: Incomplete translations makefile for MinGW/Cygwin. +Solution: Add missing source files. Make it work with msys2's bash. (Ken + Takata) +Files: src/po/Make_cyg.mak, src/po/Make_ming.mak, src/po/Make_mvc.mak + +Patch 8.0.1253 +Problem: Still too many old style tests. +Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, + closes #2272) +Files: src/Makefile, src/testdir/Make_all.mak, + src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, + src/testdir/Make_ming.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test12.in, + src/testdir/test12.ok, src/testdir/test40.in, + src/testdir/test40.ok, src/testdir/test45.in, + src/testdir/test45.ok, src/testdir/test83.in, + src/testdir/test83.ok, src/testdir/test_autocmd.vim, + src/testdir/test_fold.vim, src/testdir/test_swap.vim, + src/testdir/test_tagjump.vim + +Patch 8.0.1254 +Problem: Undefined left shift in gethexchrs(). (geeknik) +Solution: Use unsigned long. (idea by Christian Brabandt, closes #2255) +Files: src/regexp.c, src/regexp_nfa.c + + +Patch 8.0.1255 (after 8.0.1248) +Problem: duplicate badge README file. +Solution: Remove one. (Dominique Pelle) +Files: README.md + +Patch 8.0.1256 +Problem: Typo in configure variable vim_cv_tgent. (Matthieu Guillard) +Solution: Rename the variable. (closes #2281) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1257 (after 8.0.1254) +Problem: No test for fix of undefined behavior. +Solution: Add a test. (closes #2255) +Files: src/testdir/test_search.vim + +Patch 8.0.1258 +Problem: 'ttymouse' is set to "sgr" even though it's not supported. (Gary + Johnson) +Solution: Adjust #ifdef +Files: src/term.c + +Patch 8.0.1259 +Problem: Search test can be flaky. +Solution: Use WaitFor() instead of a delay. Make it possible to pass a + funcref to WaitFor() to avoid the need for global variables. + (James McCoy, closes #2282) +Files: src/testdir/shared.vim, src/testdir/test_search.vim + +Patch 8.0.1260 (after 8.0.1259) +Problem: Using global variables for WaitFor(). +Solution: Use a lambda function instead. Don't check a condition if + WaitFor() already checked it. +Files: src/testdir/test_popup.vim, src/testdir/test_terminal.vim, + src/testdir/test_channel.vim, src/testdir/test_clientserver.vim, + src/testdir/test_job_fails.vim, src/testdir/test_quotestar.vim + +Patch 8.0.1261 +Problem: Program in terminal window gets NL instead of CR. (Lifepillar) +Solution: Check the tty setup more often. (closes #1998) +Files: src/terminal.c + +Patch 8.0.1262 +Problem: Terminal redir test is flaky. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1263 +Problem: Others can read the swap file if a user is careless with his + primary group. +Solution: If the group permission allows for reading but the world + permissions doesn't, make sure the group is right. +Files: src/fileio.c, src/testdir/test_swap.vim, src/Makefile + +Patch 8.0.1264 +Problem: Terminal debugger gets stuck in small window. +Solution: Add "-quiet" to the gdb command. (Christian Brabandt, closes #2154) +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1265 (after 8.0.1263) +Problem: Swap test not skipped when there is one group. +Solution: Convert list to string for the message. +Files: src/testdir/test_swap.vim + +Patch 8.0.1266 (after 8.0.1263) +Problem: Test_swap_directory was accidentally commented out. +Solution: Uncomment the test. +Files: src/testdir/test_swap.vim + +Patch 8.0.1267 (after 8.0.1263) +Problem: Test_swap_group may leave file behind. +Solution: Add a try/finally. +Files: src/testdir/test_swap.vim, src/testdir/test_undo.vim + +Patch 8.0.1268 +Problem: PC install instructions are incomplete. +Solution: Update the instructions. (Ken Takata) +Files: src/INSTALLpc.txt + +Patch 8.0.1269 +Problem: Effect of autocommands on marks is not tested. +Solution: Add a couple of tests. (James McCoy, closes #2271) +Files: src/testdir/test_autocmd.vim + +Patch 8.0.1270 +Problem: Mismatching file name with Filelist. +Solution: Rename color_ramp.vim to xterm_ramp.vim +Files: src/testdir/color_ramp.vim, src/testdir/xterm_ramp.vim + +Patch 8.0.1271 +Problem: Still too many old style tests. +Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, + closes #2290) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/sautest/autoload/footest.vim, src/testdir/test55.in, + src/testdir/test55.ok, src/testdir/test_changelist.in, + src/testdir/test_changelist.ok, src/testdir/test_fold.vim, + src/testdir/test_ins_complete.vim, + src/testdir/test_insertcount.in, src/testdir/test_insertcount.ok, + src/testdir/test_listdict.vim, src/testdir/test_normal.vim, + src/testdir/test_search.vim, src/testdir/test_search_mbyte.in + +Patch 8.0.1272 +Problem: Warnings for unused variables in tiny build. +Solution: Add #ifdef. (Dominique Pelle, closes #2288) +Files: src/term.c + +Patch 8.0.1273 (after 8.0.1271) +Problem: Old test file remaining. +Solution: Delete it. +Files: src/testdir/test_search_mbyte.ok + +Patch 8.0.1274 +Problem: setbufline() fails when using folding. +Solution: Set "curwin" if needed. (Ozaki Kiichi, closes #2293) +Files: src/evalfunc.c, src/testdir/test_bufline.vim + +Patch 8.0.1275 +Problem: CmdlineLeave autocmd prevents fold from opening. (Waivek) +Solution: Save and restore KeyTyped. (closes #2305) +Files: src/fileio.c + +Patch 8.0.1276 +Problem: Typed key is lost when the terminal window is closed in exit + callback. (Gabriel Barta) +Solution: When the current window changes bail out of the wait loop. (closes + #2302) +Files: src/misc2.c, src/terminal.c + +Patch 8.0.1277 +Problem: Terminal window CR-NL conversions may cause problems. +Solution: Avoid most conversions, only fetch the current backspace key value + from the tty. (mostly by Ozaki Kiichi, closes #2278) +Files: src/terminal.c + +Patch 8.0.1278 +Problem: GUI window always resizes when adding/removing a scrollbar, + toolbar, etc. +Solution: Add the 'k' flag in 'guioptions' to keep the GUI window size and + change the number of lines/columns instead. (Ychin, closes #703) +Files: runtime/doc/options.txt, src/gui.c, src/gui_gtk_x11.c, + src/gui_w32.c, src/option.h + +Patch 8.0.1279 +Problem: Initializing menus can be slow, especially when there are many + keymaps, color schemes, etc. +Solution: Do the globbing for runtime files lazily. (Ken Takata) +Files: runtime/doc/gui.txt, runtime/menu.vim + +Patch 8.0.1280 +Problem: Python None cannot be converted to a Vim type. +Solution: Convert it to v:none. (Ken Takata) +Files: src/if_py_both.h, src/testdir/test86.ok, src/testdir/test87.ok, + runtime/doc/if_pyth.txt + +Patch 8.0.1281 +Problem: Loading file type detection slows down startup. +Solution: Move functions to an autoload script. +Files: runtime/filetype.vim, runtime/autoload/filetype.vim, + runtime/scripts.vim + +Patch 8.0.1282 (after 8.0.1281) +Problem: script-local variable defined in the wrong script +Solution: Move variable to autoload/filetype.vim. +Files: runtime/filetype.vim, runtime/autoload/filetype.vim + +Patch 8.0.1283 +Problem: Test 86 fails under ASAN. +Solution: Fix that an item was added to a dictionary twice. +Files: src/if_py_both.h + +Patch 8.0.1284 +Problem: Loading file type detection slows down startup. +Solution: Store the last pattern of an autocommand event to make appending + quicker. +Files: src/fileio.c + +Patch 8.0.1285 +Problem: Distributed autoload files may clash with user files. (Andy + Wokula) +Solution: Use the "autoload/dist" directory. +Files: runtime/filetype.vim, runtime/autoload/filetype.vim, + runtime/autoload/dist/ft.vim, runtime/scripts.vim, Filelist, + src/Makefile, nsis/gvim.nsi + +Patch 8.0.1286 +Problem: Occasional crash when using a channel. (Marek) +Solution: Decrement reference count later. (closes #2315) +Files: src/channel.c + +Patch 8.0.1287 +Problem: The temp file used when updating the viminfo file may have the + wrong permissions if setting the group fails. +Solution: Check if the group matches and reduce permissions if not. +Files: src/ex_cmds.c + +Patch 8.0.1288 +Problem: GUI: cannot drag the statusline of a terminal window. +Solution: Handle the TERMINAL state. (Hirohito Higashi) +Files: src/gui.c + +Patch 8.0.1289 +Problem: Mkview always includes the local directory. +Solution: Add the "curdir" value in 'viewoptions'. (Eric Roberts, closes + #2316) +Files: runtime/doc/options.txt, runtime/doc/starting.txt, src/ex_docmd.c, + src/option.c + +Patch 8.0.1290 +Problem: seq_cur of undotree() wrong after undo. +Solution: Get the actual sequence number instead of decrementing the current + one. (Ozaki Kiichi, closes #2319) +Files: src/undo.c, src/testdir/test_undo.vim + +Patch 8.0.1291 +Problem: C indent wrong when * immediately follows comment. (John Bowler) +Solution: Do not see "/*" after "*" as a comment start. (closes #2321) +Files: src/search.c, src/testdir/test3.in, src/testdir/test3.ok + +Patch 8.0.1292 +Problem: Quick clicks in the WinBar start Visual mode. +Solution: Use a double click in the WinBar like a normal click. +Files: src/ui.c + +Patch 8.0.1293 +Problem: Setting a breakpoint in the terminal debugger sometimes fails. +Solution: Interrupt the program if needed. Set the interface to async. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1294 +Problem: GUI: get stuck when splitting a terminal window. +Solution: Stop blinking when values become zero. (Hirohito Higashi) +Files: src/gui.c + +Patch 8.0.1295 +Problem: Cannot automatically get a server name in a terminal. +Solution: Add the --enable-autoservername flag to configure. (Cimbali, + closes #2317) +Files: runtime/doc/eval.txt, runtime/doc/various.txt, src/config.h.in, + src/configure.ac, src/auto/configure, src/evalfunc.c, + src/feature.h, src/main.c, src/version.c, src/Makefile + +Patch 8.0.1296 (after 8.0.1294) +Problem: Checking the same condition twice. (John Marriott) +Solution: Check blinkwait. +Files: src/gui.c + +Patch 8.0.1297 +Problem: +autoservername does not show enabled on MS-Windows. +Solution: Always define the flag on MS-Windows. (Ken Takata) +Files: src/feature.h + +Patch 8.0.1298 +Problem: Missing test file. +Solution: Add samples/test000. (Christian Brabandt) +Files: src/testdir/samples/test000, Filelist + +Patch 8.0.1299 +Problem: Bracketed paste does not work well in terminal window. +Solution: Send translated string to job right away. (Ozaki Kiichi, closes + #2341) +Files: src/terminal.c + +Patch 8.0.1300 +Problem: File permissions may end up wrong when writing. +Solution: Use fchmod() instead of chmod() when possible. Don't truncate + until we know we can change the file. +Files: src/os_unix.c, src/proto/os_unix.pro, src/configure.ac, + src/auto/configure, src/config.h.in, src/fileio.c + +Patch 8.0.1301 +Problem: Generated license file for NSIS has a modeline. +Solution: Adjust the pattern for sed. (Ken Takata) +Files: runtime/doc/Makefile + +Patch 8.0.1302 +Problem: Still too many old style tests. +Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, + closes #2326) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/runtest.vim, + src/testdir/test68.in, src/testdir/test68.ok, + src/testdir/test73.in, src/testdir/test73.ok, + src/testdir/test_close_count.in, src/testdir/test_close_count.ok, + src/testdir/test_close_count.vim, + src/testdir/test_erasebackword.in, + src/testdir/test_erasebackword.ok, + src/testdir/test_erasebackword.vim, + src/testdir/test_find_complete.vim, src/testdir/test_fixeol.in, + src/testdir/test_fixeol.ok, src/testdir/test_fixeol.vim, + src/testdir/test_listchars.in, src/testdir/test_listchars.ok, + src/testdir/test_listchars.vim, src/testdir/test_textformat.vim + +Patch 8.0.1303 +Problem: 'ttymouse' is not set to "sgr" for Terminal.app and Iterm2. +Solution: Recognize Iterm2 by the termresponse. +Files: src/term.c + +Patch 8.0.1304 +Problem: CTRL-G/CTRL-T don't work with incsearch and empty pattern. +Solution: Use the last search pattern. (Christian Brabandt, closes #2292) +Files: src/ex_getln.c, src/proto/search.pro, src/search.c, + src/testdir/test_search.vim + +Patch 8.0.1305 +Problem: Writefile() never calls fsync(). +Solution: Follow the 'fsync' option with override to enable or disable. +Files: src/fileio.c, src/evalfunc.c, runtime/doc/eval.txt, src/globals.h, + src/testdir/test_writefile.vim + +Patch 8.0.1306 +Problem: ASAN error stack trace is not useful. +Solution: Add "asan_symbolize". (James McCoy, closes #2344) +Files: .travis.yml + +Patch 8.0.1307 (after 8.0.1300) +Problem: Compiler warning for ignoring return value of ftruncate(). (Tony + Mechelynck) +Solution: Assign returned value to "ignore". +Files: src/fileio.c + +Patch 8.0.1308 +Problem: The "Reading from stdin" message may be undesired and there is no + easy way to skip it. +Solution: Don't show the message with --not-a-term was used. +Files: src/fileio.c + +Patch 8.0.1309 +Problem: Cannot use 'balloonexpr' in a terminal. +Solution: Add 'balloonevalterm' and add code to handle mouse movements in a + terminal. Initial implementation for Unix with GUI. +Files: src/option.c, src/option.h, src/os_unix.c, src/proto/os_unix.pro, + src/feature.h, src/misc2.c, src/keymap.h, src/edit.c, + src/ex_getln.c, src/message.c, src/misc1.c, src/normal.c, + src/terminal.c, src/getchar.c, src/ex_cmds2.c, src/gui_beval.c, + src/proto/gui_beval.pro, src/evalfunc.c, src/popupmnu.c, + src/proto/popupmnu.pro, src/version.c, src/globals.h, src/gui.c, + runtime/doc/options.txt, src/term.c, + runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1310 +Problem: Cproto generates errors because of missing type. +Solution: Define _Float128 when generating prototypes. +Files: src/vim.h + +Patch 8.0.1311 +Problem: No test for strpart(). +Solution: Add a test. (Dominique Pelle, closes #2347) +Files: src/testdir/test_functions.vim + +Patch 8.0.1312 (after 8.0.1309) +Problem: balloon_show() only works in terminal when compiled with the GUI. +Solution: Add FEAT_BEVAL_GUI and refactor to move common code out of the GUI + specific file. +Files: src/feature.h, src/evalfunc.c, src/gui.c, src/gui_athena.c, + src/gui_beval.c, src/proto/gui_beval.pro, src/beval.c, + src/proto/beval.pro, src/gui_motif.c, src/gui_w32.c, + src/gui_x11.c, src/integration.c, src/workshop.c, src/menu.c, + src/netbeans.c, src/option.c, src/os_unix.c, src/os_win32.c, + src/syntax.c, src/version.c, src/gui.h, src/gui_beval.h, + src/vim.h, src/beval.h, src/option.h, src/ex_cmds2.c, src/ui.c, + src/getchar.c, src/normal.c, src/popupmnu.c, src/globals.h, + src/Makefile, src/Make_cyg_ming.mak, src/Make_mvc.mak, + src/Make_vms.mms, Filelist + +Patch 8.0.1313 (after 8.0.1312) +Problem: Missing dependencies cause parallel make to fail. +Solution: Update dependencies. +Files: src/Makefile + +Patch 8.0.1314 (after 8.0.1312) +Problem: Build fails on Mac. (chdiza) +Solution: Add #ifdef around GUI fields. +Files: src/beval.h + +Patch 8.0.1315 (after 8.0.1312) +Problem: Build still fails on Mac. (chdiza) +Solution: Remove bogus typedef. +Files: src/os_macosx.m + +Patch 8.0.1316 (after 8.0.1312) +Problem: Build still still fails on Mac. (chdiza) +Solution: Remove another bogus typedef. +Files: src/os_mac_conv.c + +Patch 8.0.1317 +Problem: Accessing freed memory in term_wait(). (Dominique Pelle) +Solution: Check that the buffer still exists. +Files: src/terminal.c + +Patch 8.0.1318 +Problem: Terminal balloon only shows one line. +Solution: Split into several lines in a clever way. Add balloon_split(). + Make balloon_show() accept a list in the terminal. +Files: src/popupmnu.c, src/proto/popupmnu.pro, src/evalfunc.c, + src/beval.c, src/proto/beval.pro, src/testdir/test_popup.vim, + runtime/doc/eval.txt, + runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1319 +Problem: Can't build GUI on MS-Windows. +Solution: Don't define the balloon_split() function in a GUI-only build. +Files: src/evalfunc.c, runtime/doc/eval.txt + +Patch 8.0.1320 +Problem: Popup test fails on GUI-only build. +Solution: Don't test balloon_split() when it's not available. +Files: src/testdir/test_popup.vim + +Patch 8.0.1321 +Problem: Can't build huge version with Athena. (Mark Kelly) +Solution: Move including beval.h to before structs.h. Include beval.pro like + other proto files. +Files: src/vim.h, src/beval.h, src/proto.h + +Patch 8.0.1322 +Problem: Textformat test isn't run. (Yegappan Lakshmanan) +Solution: Add target to the list of tests. +Files: src/testdir/Make_all.mak + +Patch 8.0.1323 +Problem: Mouse events in a terminal window may cause endless loop. +Solution: Adjust position computation. Don't stuff a mouse event when + coming from normal_cmd(). +Files: src/normal.c, src/terminal.c + +Patch 8.0.1324 +Problem: Some xterm sends different mouse move codes. +Solution: Also accept 0x80 as a move event. +Files: src/term.c + +Patch 8.0.1325 +Problem: More tests are not run. +Solution: Add targets to the list of tests. (Yegappan Lakshmanan) +Files: src/testdir/Make_all.mak + +Patch 8.0.1326 +Problem: Largefile test fails on CI, glob test on MS-Windows. +Solution: Remove largefile test from list of all tests. Don't run + Test_glob() on non-unix systems. More cleanup. (Yegappan + Lakshmanan, closes #2354) +Files: src/testdir/Make_all.mak, src/testdir/test_escaped_glob.vim, + src/testdir/test_plus_arg_edit.vim + +Patch 8.0.1327 +Problem: New proto file missing from distribution. +Solution: Add it. (closes #2355) +Files: Filelist + +Patch 8.0.1328 +Problem: Trouble when using ":term ++close" with autocmd. (Gabriel Barta) +Solution: Use aucmd_prepbuf() and aucmd_restbuf() instead of setting curbuf. + (closes #2339) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1329 +Problem: When a flaky test fails it also often fails the second time. +Solution: Sleep a couple of seconds before the second try. +Files: src/testdir/runtest.vim + +Patch 8.0.1330 +Problem: MS-Windows: job in terminal can't get back to Vim. +Solution: set VIM_SERVERNAME in the environment. (Yasuhiro Matsumoto, closes + #2360) +Files: runtime/doc/terminal.txt, src/os_win32.c, src/proto/os_win32.pro, + src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1331 +Problem: Possible crash when window can be zero lines high. (Joseph + Dornisch) +Solution: Only set w_fraction if the window is at least two lines high. +Files: src/window.c + +Patch 8.0.1332 +Problem: Highlighting in quickfix window could be better. (Axel Bender) +Solution: Use the qfSeparator highlight item. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1333 +Problem: Some tests are run twice. +Solution: Invoked most utf8 tests only from test_alot_utf8. (Yegappan + Lakshmanan, closes #2369) +Files: src/testdir/Make_all.mak, src/testdir/test_alot_utf8.vim, + src/testdir/test_mksession_utf8.vim + +Patch 8.0.1334 +Problem: Splitting a window with a WinBar damages window layout. + (Lifepillar) +Solution: Take the winbar into account when computing the new window + position. Add WINBAR_HEIGHT(). +Files: src/vim.h, src/window.c + +Patch 8.0.1335 +Problem: Writefile() using fsync() may give an error for a device. + (Yasuhiro Matsumoto) +Solution: Ignore fsync() failing. (closes #2373) +Files: src/evalfunc.c + +Patch 8.0.1336 +Problem: Cannot use imactivatefunc() unless compiled with +xim. +Solution: Allow using imactivatefunc() when not compiled with +xim. + (Yasuhiro Matsumoto, closes #2349) +Files: runtime/doc/options.txt, runtime/doc/mbyte.txt, src/mbyte.c, + src/option.c, src/option.h, src/structs.h, + src/testdir/test_iminsert.vim, src/Makefile, + src/testdir/Make_all.mak, src/vim.h + +Patch 8.0.1337 (after 8.0.1336) +Problem: Typo in #ifdef. +Solution: Fix the #if line. +Files: src/mbyte.c + +Patch 8.0.1338 (after 8.0.1337) +Problem: USE_IM_CONTROL is confusing and incomplete. +Solution: Just use FEAT_MBYTE. Call 'imactivatefunc' also without GUI. +Files: src/vim.h, src/edit.c, src/ex_getln.c, src/getchar.c, src/gui.c, + src/gui_mac.c, src/gui_w32.c, src/mbyte.c, src/normal.c, + src/option.c, src/ui.c, src/globals.h, src/option.h + +Patch 8.0.1339 +Problem: No test for what 8.0.1335 fixes. +Solution: Add a test. (Yasuhiro Matsumoto, closes #2373) +Files: src/testdir/test_writefile.vim + +Patch 8.0.1340 +Problem: MS-Windows: cannot build GUI without IME. +Solution: Define im_get_status() and im_set_active() when IME is not used. +Files: src/mbyte.c + +Patch 8.0.1341 +Problem: 'imactivatefunc' test fails on MS-Windows. +Solution: Skip the text. +Files: src/testdir/test_iminsert.vim, runtime/doc/options.txt + +Patch 8.0.1342 +Problem: Cannot build with Motif and multi-byte. (Mohamed Boughaba) +Solution: Use the right input method status flag. (closes #2374) +Files: src/mbyte.c + +Patch 8.0.1343 +Problem: MS-Windows: does not show colored emojis. +Solution: Implement colored emojis. Improve drawing speed. Make 'taamode' + work. (Taro Muraoka, Yasuhiro Matsumoto, Ken Takata, close #2375) +Files: appveyor.yml, runtime/doc/options.txt, src/gui_dwrite.cpp, + src/gui_dwrite.h, src/gui_w32.c, src/proto/gui_w32.pro + +Patch 8.0.1344 +Problem: Using 'imactivatefunc' in the GUI does not work. +Solution: Do not use 'imactivatefunc' and 'imstatusfunc' in the GUI. +Files: runtime/doc/options.txt, src/mbyte.c, + src/testdir/test_iminsert.vim + +Patch 8.0.1345 +Problem: Race condition between stat() and open() for the viminfo temp + file. (Simon Ruderich) +Solution: use open() with O_EXCL to atomically check if the file exists. + Don't try using a temp file, renaming it will fail anyway. +Files: src/ex_cmds.c + +Patch 8.0.1346 +Problem: Crash when passing 50 char string to balloon_split(). +Solution: Fix off-by-one error. +Files: src/testdir/test_popup.vim, src/popupmnu.c + +Patch 8.0.1347 +Problem: MS-Windows: build broken by misplaced curly. +Solution: Move curly after #endif. +Files: src/ex_cmds.c + +Patch 8.0.1348 +Problem: Make testclean deletes script file on MS-Windows. +Solution: Rename file to avoid it starting with an "x". +Files: src/testdir/xterm_ramp.vim, src/testdir/color_ramp.vim, Filelist + +Patch 8.0.1349 +Problem: Options test fails when using Motif or GTK GUI. +Solution: Use "fixed" instead of "fixedsys" for Unix. Don't try "xxx" for + guifonteset. Don't set 'termencoding' to anything but "utf-8" for + GTK. Give an error if 'termencoding' can't be converted. +Files: src/testdir/gen_opt_test.vim, src/option.c + +Patch 8.0.1350 +Problem: Cannot build with +eval and -multi_byte. +Solution: Adjust #ifdefs. (John Marriott) Always include the multi_byte + feature when an input method feature is enabled. +Files: src/mbyte.c, src/feature.h + +Patch 8.0.1351 +Problem: Warning for unused variables building with MinGW. +Solution: Change a few #ifdefs (suggested by John Marriott). Remove + superfluous checks of FEAT_MBYTE. +Files: src/gui_w32.c + +Patch 8.0.1352 +Problem: Dead URLs in the help go unnoticed. +Solution: Add a script to check URLs in the help files. (Christian Brabandt) +Files: runtime/doc/Makefile, runtime/doc/test_urls.vim, Filelist + +Patch 8.0.1353 +Problem: QuickFixCmdPost is not used consistently. +Solution: Invoke QuickFixCmdPost consistently after QuickFixCmdPre. + (Yegappan Lakshmanan, closes #2377) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1354 +Problem: Shift-Insert doesn't always work in MS-Windows console. +Solution: Handle K_NUL differently. (Yasuhiro Matsumoto, closes #2381) +Files: src/os_win32.c + +Patch 8.0.1355 (after 8.0.1354) +Problem: Cursor keys don't work in MS-Windows console. +Solution: Revert the previous patch. Also delete dead code. +Files: src/os_win32.c + +Patch 8.0.1356 +Problem: Using simalt in a GUIEnter autocommand inserts strange characters. + (Chih-Long Chang) +Solution: Ignore K_NOP in Insert mode. (closes #2379) +Files: src/edit.c, src/ex_getln.c + +Patch 8.0.1357 +Problem: Startup test fails on OpenBSD. (Edd Barrett) +Solution: Check for "BSD" instead of "FreeBSD" being defined. (James McCoy, + closes #2376, closes #2378) +Files: src/vim.h + +Patch 8.0.1358 +Problem: Undercurl is not used in the terminal. (Kovid Goyal) +Solution: Only fall back to underline when undercurl highlighting is not + defined. (closes #1306) +Files: src/screen.c + +Patch 8.0.1359 +Problem: Libvterm ANSI colors can not always be recognized from the RGB + values. The default color is wrong when t_RB is empty. +Solution: Add the ANSI color index to VTermColor. +Files: src/libvterm/include/vterm.h, src/libvterm/src/pen.c, + src/terminal.c + +Patch 8.0.1360 +Problem: The Terminal highlighting doesn't work in a terminal. (Ozaki + Kiichi) +Solution: Use the Terminal highlighting when the cterm index is zero. +Files: src/terminal.c + +Patch 8.0.1361 +Problem: Some users don't want to diff with hidden buffers. +Solution: Add the "hiddenoff" item to 'diffopt'. (Alisue, closes #2394) +Files: runtime/doc/options.txt, src/buffer.c, src/diff.c, + src/proto/diff.pro, src/testdir/test_diffmode.vim + +Patch 8.0.1362 +Problem: Terminal window colors wrong when using Terminal highlighting. +Solution: Set ansi_index when setting the default color. Also cache the + color index for Terminal. (Ozaki Kiichi, closes #2393) +Files: src/libvterm/src/pen.c, src/proto/terminal.pro, src/syntax.c, + src/terminal.c + +Patch 8.0.1363 +Problem: Recovering does not work when swap file ends in .stz. +Solution: Check for all possible swap file names. (Elfling, closes #2395, + closes #2396) +Files: src/memline.c + +Patch 8.0.1364 +Problem: There is no easy way to get the window position. +Solution: Add win_screenpos(). +Files: src/evalfunc.c, src/testdir/test_window_cmd.vim, + runtime/doc/eval.txt + +Patch 8.0.1365 +Problem: When one channel test fails others fail as well. +Solution: Stop the job after a failure. Also add a couple of tests to the + list of flaky tests. +Files: src/testdir/test_channel.vim, src/testdir/runtest.vim + +Patch 8.0.1366 +Problem: Balloon shows when cursor is in WinBar. +Solution: Don't show the balloon when row is negative. +Files: src/beval.c + +Patch 8.0.1367 +Problem: terminal test hangs, executing abcde. (Stucki) +Solution: Rename abcde to abxde. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1368 +Problem: Cannot drag status line or vertical separator of new terminal + window. (UncleBill) +Solution: Adjust mouse row and column computation. (Yasuhiro Matsumoto, + closes #2410) +Files: src/terminal.c + +Patch 8.0.1369 +Problem: MS-Windows: drawing underline, curl and strikethrough is slow, + mFallbackDC not properly updated. +Solution: Several performance improvements. (Ken Takata, Taro Muraoka, + Yasuhiro Matsumoto, closes #2401) +Files: runtime/doc/options.txt, src/gui_dwrite.cpp, src/gui_dwrite.h, + src/gui_w32.c + +Patch 8.0.1370 +Problem: Channel test for callback is flaky. +Solution: Add the test to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1371 +Problem: Shift-Insert doesn't always work in MS-Windows console. +Solution: Handle K_NUL differently if the second character is more than one + byte. (Yasuhiro Matsumoto, closes #2381) +Files: src/os_win32.c + +Patch 8.0.1372 +Problem: Profile log may be truncated halfway a character. +Solution: Find the start of the character. (Ozaki Kiichi, closes #2385) +Files: src/ex_cmds2.c, src/testdir/test_profile.vim + +Patch 8.0.1373 +Problem: No error when setting 'renderoptions' to an invalid value before + starting the GUI. +Solution: Always check the value. (Ken Takata, closes #2413) +Files: src/gui_w32.c, src/option.c + +Patch 8.0.1374 +Problem: CTRL-A does not work with an empty line. (Alex) +Solution: Decrement the end only once. (Hirohito Higashi, closes #2387) +Files: src/ops.c, src/testdir/test_increment.vim + +Patch 8.0.1375 +Problem: Window size wrong after maximizing with WinBar. (Lifepillar) +Solution: Fix height computations. Redraw window when it is zero height but + has a WinBar. (closes #2356) +Files: src/window.c, src/screen.c, src/vim.h + +Patch 8.0.1376 +Problem: Cursor in terminal not always updated. +Solution: Call gui_mch_flush(). (Ken Takata) +Files: src/terminal.c + +Patch 8.0.1377 +Problem: Cannot call a dict function in autoloaded dict. +Solution: Call get_lval() passing the read-only flag. +Files: src/userfunc.c, src/eval.c, src/testdir/sautest/autoload/foo.vim, + src/testdir/sautest/autoload/globone.vim, + src/testdir/sautest/autoload/globtwo.vim, + src/testdir/test_escaped_glob.vim, src/Makefile, + src/testdir/test_autoload.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.1378 +Problem: Autoload script sources itself when defining function. +Solution: Pass TFN_NO_AUTOLOAD to trans_function_name(). (Yasuhiro + Matsumoto, closes #2423) +Files: src/userfunc.c, src/testdir/test_autoload.vim, + src/testdir/sautest/autoload/sourced.vim + +Patch 8.0.1379 +Problem: Configure check for selinux does not check for header file. +Solution: Add an AC_CHECK_HEADER(). (Benny Siegert) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1380 +Problem: When recovering a file with "vim -r swapfile" the hit-enter prompt + is at the top of the window. +Solution: Invalidate the cursor position. +Files: src/term.c + +Patch 8.0.1381 +Problem: ch_readraw() waits for NL if channel mode is NL. +Solution: Pass a "raw" flag to channel_read_block(). (Yasuhiro Matsumoto) +Files: src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, src/testdir/test_channel_pipe.py + +Patch 8.0.1382 +Problem: Get "no write since last change" message if a terminal is open. + (Fritz mehner) +Solution: Don't consider a buffer changed if it's a terminal window. +Files: src/ex_cmds.c, src/undo.c, src/proto/undo.pro + +Patch 8.0.1383 +Problem: Local additions in help skips some files. (joshklod) +Solution: Check the base file name length equals. +Files: src/ex_cmds.c, src/testdir/test_help.vim + +Patch 8.0.1384 +Problem: Not enough quickfix help; confusing winid. +Solution: Add more examples in the help. When the quickfix window is not + present, return zero for getqflist() with 'winid'. Add more tests + for jumping to quickfix list entries. (Yegappan Lakshmanan, closes + #2427) +Files: runtime/doc/eval.txt, runtime/doc/quickfix.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1385 +Problem: Python 3.5 is getting old. +Solution: Make Python 3.6 the default. (Ken Takata, closes #2429) +Files: runtime/doc/if_pyth.txt, src/INSTALLpc.txt, src/Make_cyg_ming.mak, + src/Make_mvc.mak, src/bigvim.bat + +Patch 8.0.1386 +Problem: Cannot select modified buffers with getbufinfo(). +Solution: Add the "bufmodified" flag. (Yegappan Lakshmanan, closes #2431) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_bufwintabinfo.vim + +Patch 8.0.1387 +Problem: Wordcount test is old style. +Solution: Change into a new style test. (Yegappan Lakshmanan, closes #2434) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_ming.mak, + src/testdir/Make_vms.mms, src/testdir/test_wordcount.in, + src/testdir/test_wordcount.ok, src/testdir/test_wordcount.vim + +Patch 8.0.1388 +Problem: Char not overwritten with ambiguous width char, if the ambiguous + char is single width but we reserve double-width space. +Solution: First clear the screen cells. (Ozaki Kiichi, closes #2436) +Files: src/screen.c + +Patch 8.0.1389 +Problem: getqflist() items are missing if not set, that makes it more + difficult to handle the values. +Solution: When a value is not available return zero or another invalid + value. (Yegappan Lakshmanan, closes #2430) +Files: runtime/doc/eval.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1390 +Problem: DirectX scrolling can be slow, vertical positioning is off. +Solution: Make scroll slightly faster when using "scrlines:1". Fix y + position of displayed text. Fix DirectX with non-utf8 encoding. + (Ken Takata, closes #2440) +Files: src/INSTALLpc.txt, src/Make_cyg_ming.mak, src/Make_mvc.mak, + src/gui_dwrite.cpp, src/gui_w32.c + +Patch 8.0.1391 +Problem: Encoding empty string to JSON sometimes gives "null". +Solution: Handle NULL string as empty string. (closes #2446) +Files: src/testdir/test_json.vim, src/json.c + +Patch 8.0.1392 +Problem: Build fails with --with-features=huge --disable-channel. +Solution: Don't enable the terminal feature when the channel feature is + missing. (Dominique Pelle, closes #2453) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1393 +Problem: Too much highlighting with 'hlsearch' and 'incsearch' set. +Solution: Do not highlight matches when the pattern matches everything. +Files: src/ex_getln.c + +Patch 8.0.1394 +Problem: Cannot intercept a yank command. +Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al., + closes #2333) +Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/dict.c, + src/eval.c, src/fileio.c, src/ops.c, src/proto/dict.pro, + src/proto/eval.pro, src/proto/fileio.pro, + src/testdir/test_autocmd.vim, src/vim.h + +Patch 8.0.1395 +Problem: It is not easy to see if a colorscheme is well written. +Solution: Add a script that checks for common mistakes. (Christian Brabandt) +Files: runtime/colors/check_colors.vim, runtime/colors/README.txt + +Patch 8.0.1396 +Problem: Memory leak when CTRL-G in search command line fails. +Solution: Move restore_last_search_pattern to after "if". +Files: src/ex_getln.c + +Patch 8.0.1397 +Problem: Pattern with \& following nothing gives an error. +Solution: Emit an empty node when needed. +Files: src/regexp_nfa.c, src/testdir/test_search.vim + +Patch 8.0.1398 +Problem: :packadd does not load packages from the "start" directory. + (Alejandro Hernandez) +Solution: Make :packadd look in the "start" directory if those packages were + not loaded on startup. +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 8.0.1399 +Problem: Warnings and errors when building tiny version. (Tony Mechelynck) +Solution: Add #ifdefs. +Files: src/ex_getln.c, src/ops.c + +Patch 8.0.1400 +Problem: Color scheme check script shows up as color scheme. +Solution: Move it to the "tools" subdirectory. (closes #2457) +Files: Filelist, runtime/colors/check_colors.vim, + runtime/colors/tools/check_colors.vim, runtime/colors/README.txt + +Patch 8.0.1401 +Problem: Cannot build with GTK but without XIM. (Guido) +Solution: Adjust #ifdef. (closes #2461) +Files: src/gui.c + +Patch 8.0.1402 +Problem: Crash with nasty autocommand. (gy741, Dominique Pelle) +Solution: Check that the new current buffer isn't wiped out. (closes #2447) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 8.0.1403 +Problem: Using freed buffer in grep command. (gy741, Dominique Pelle) +Solution: Lock the dummy buffer to avoid autocommands wiping it out. +Files: src/quickfix.c, src/testdir/test_autocmd.vim + +Patch 8.0.1404 +Problem: Invalid memory access on exit when autocommands wipe out a buffer. + (gy741, Dominique Pelle) +Solution: Check if the buffer is still valid. (closes #2449) +Files: src/main.c + +Patch 8.0.1405 +Problem: Duplicated code for getting a typed character. CursorHold is + called too often in the GUI. (lilydjwg) +Solution: Refactor code to move code up from mch_inchar(). Don't fire + CursorHold if feedkeys() was used. (closes #2451) +Files: src/gui.c, src/proto/gui.pro, src/main.c, src/ui.c, + src/proto/ui.pro, src/os_unix.c + +Patch 8.0.1406 +Problem: Difficult to track changes to a quickfix list. +Solution: Add a "changedtick" value. (Yegappan Lakshmanan, closes #2460) +Files: runtime/doc/eval.txt, runtime/doc/quickfix.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1407 +Problem: GUI: CursorHold may trigger before 'updatetime' when using timers. +Solution: Check that 'updatetime' has passed. +Files: src/gui.c + +Patch 8.0.1408 +Problem: Crash in setqflist(). +Solution: Check for string to be NULL. (Dominique Pelle, closes #2464) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1409 +Problem: Buffer overflow in :tags command. +Solution: Use vim_snprintf(). (Dominique Pelle, closes #2471, closes #2475) + Add a test. +Files: src/testdir/test_taglist.vim, src/tag.c + +Patch 8.0.1410 +Problem: Hang when using count() with an empty string. +Solution: Return zero for an empty string. (Dominique Pelle, closes #2465) +Files: runtime/doc/eval.txt, src/evalfunc.c, + src/testdir/test_functions.vim + +Patch 8.0.1411 +Problem: Reading invalid memory with CTRL-W :. +Solution: Correct the command characters. (closes #2469) +Files: src/normal.c, src/testdir/test_window_cmd.vim, src/ops.c + +Patch 8.0.1412 +Problem: Using free memory using setloclist(). (Dominique Pelle) +Solution: Mark location list context as still in use when needed. (Yegappan + Lakshmanan, closes #2462) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1413 +Problem: Accessing freed memory in :cbuffer. +Solution: Get quickfix list after executing autocmds. (closes #2470) +Files: src/quickfix.c, src/testdir/test_autocmd.vim + +Patch 8.0.1414 +Problem: Accessing freed memory in :lfile. +Solution: Get the current window after executing autocommands. (Yegappan + Lakshmanan, closes #2473) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1415 +Problem: Warning for unused function without timers feature. +Solution: Add #ifdef. (John Marriott) +Files: src/gui.c + +Patch 8.0.1416 +Problem: Crash when searching for a sentence. +Solution: Return NUL when getting character at MAXCOL. (closes #2468) +Files: src/misc1.c, src/misc2.c, src/testdir/test_search.vim, + src/ex_docmd.c + +Patch 8.0.1417 +Problem: Test doesn't search for a sentence. Still fails when searching for + start of sentence. (Dominique Pelle) +Solution: Add paren. Check for MAXCOL in dec(). +Files: src/testdir/test_search.vim, src/misc2.c + +Patch 8.0.1418 +Problem: No test for expanding backticks. +Solution: Add a test. (Dominique Pelle, closes #2479) +Files: src/testdir/test_normal.vim + +Patch 8.0.1419 +Problem: Cursor column is not updated after ]s. (Gary Johnson) +Solution: Set the curswant flag. +Files: src/testdir/test_spell.vim, src/normal.c, src/evalfunc.c + +Patch 8.0.1420 +Problem: Accessing freed memory in vimgrep. +Solution: Check that the quickfix list is still valid. (Yegappan Lakshmanan, + closes #2474) +Files: src/quickfix.c, src/testdir/test_autocmd.vim, + src/testdir/test_quickfix.vim + +Patch 8.0.1421 +Problem: Accessing invalid memory with overlong byte sequence. +Solution: Check for NUL character. (test by Dominique Pelle, closes #2485) +Files: src/misc2.c, src/testdir/test_functions.vim + +Patch 8.0.1422 +Problem: No fallback to underline when undercurl is not set. (Ben Jackson) +Solution: Check for the value to be empty instead of NULL. (closes #2424) +Files: src/screen.c + +Patch 8.0.1423 +Problem: Error in return not caught by try/catch. +Solution: Call update_force_abort(). (Yasuhiro Matsomoto, closes #2483) +Files: src/testdir/test_eval.in, src/testdir/test_eval_stuff.vim, + src/Makefile, src/testdir/Make_all.mak, src/userfunc.c + +Patch 8.0.1424 +Problem: The timer_pause test is flaky on Travis. +Solution: Accept a longer sleep time on Mac. +Files: src/testdir/test_timers.vim + +Patch 8.0.1425 +Problem: execute() does not work in completion of user command. (thinca) +Solution: Switch off redir_off and restore it. (Ozaki Kiichi, closes #2492) +Files: src/evalfunc.c, src/testdir/test_usercommands.vim + +Patch 8.0.1426 +Problem: "gf" and <cfile> don't accept ? and & in URL. (Dmitrii Tcyganok) +Solution: Check for a URL and allow for extra characters. (closes #2493) +Files: src/window.c, src/testdir/test_gf.vim + +Patch 8.0.1427 +Problem: The :leftabove modifier doesn't work for :copen. +Solution: Respect the split modifier. (Yegappan Lakshmanan, closes #2496) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1428 +Problem: Compiler warning on 64 bit MS-Windows system. +Solution: Change type from "int" to "size_t". (Mike Williams) +Files: src/ex_getln.c + +Patch 8.0.1429 +Problem: Crash when calling term_start() with empty argument. +Solution: Check for invalid argument. (Yasuhiro Matsomoto, closes #2503) + Fix memory leak. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1430 (after 8.0.1429) +Problem: Crash when term_start() fails. +Solution: Initialize winpty_err. +Files: src/terminal.c + +Patch 8.0.1431 +Problem: MS-Windows: vimtutor fails if %TMP% has special chars. +Solution: Add quotes. (Tamce, closes #2561) +Files: vimtutor.bat + +Patch 8.0.1432 +Problem: After ":copen" can't get the window-ID of the quickfix window. + (FalacerSelene) +Solution: Make it work without a quickfix list. Add a test. (Yegappan + Lakshmanan, closes #2541) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1433 +Problem: Illegal memory access after undo. (Dominique Pelle) +Solution: Avoid the column becomes negative. (Christian Brabandt, + closes #2533) +Files: src/mbyte.c, src/testdir/test_undo.vim + +Patch 8.0.1434 +Problem: GTK: :promtfind does not put focus on text input. (Adam Novak) +Solution: When re-opening the dialog put focus on the text input. (Kazunobu + Kuriyama, closes #2563) +Files: src/gui_gtk.c + +Patch 8.0.1435 +Problem: Memory leak in test_arabic. +Solution: Free the from and to parts. (Christian Brabandt, closes #2569) +Files: src/buffer.c, src/digraph.c, src/proto/digraph.pro + +Patch 8.0.1436 +Problem: Not enough information about what Python version may work. +Solution: Add "python_compiled", "python3_compiled", "python_dynamic" and + "python3_dynamic" values for has(). +Files: src/evalfunc.c, runtime/doc/eval.txt + +Patch 8.0.1437 +Problem: Pkg-config doesn't work with cross compiling. +Solution: Use AC_PATH_TOOL() instead of AC_PATH_PROG(). (James McCoy, + closes #2513) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1438 +Problem: Filetype detection test not updated for change. +Solution: Update the test. +Files: src/testdir/test_filetype.vim + +Patch 8.0.1439 +Problem: If cscope fails a search Vim may hang. +Solution: Bail out when a search error is encountered. (Safouane Baroudi, + closes #2598) +Files: src/if_cscope.c + +Patch 8.0.1440 +Problem: Terminal window: some vterm responses are delayed. +Solution: After writing input. check if there is output to read. (Ozaki + Kiichi, closes #2594) +Files: src/terminal.c, src/testdir/test_search.vim, + src/testdir/test_terminal.vim + +Patch 8.0.1441 +Problem: Using ":undo 0" leaves undo in wrong state. +Solution: Instead of searching for state 1 and go above, just use the start. + (Ozaki Kiichi, closes #2595) +Files: src/undo.c, src/testdir/test_undo.vim + +Patch 8.0.1442 (after 8.0.1439) +Problem: Using pointer before it is set. +Solution: Search in whole buffer instead of next token. +Files: src/if_cscope.c + +Patch 8.0.1443 (after 8.0.1441) +Problem: Compiler complains about uninitialized variable. (Tony Mechelynck) +Solution: Assign a value to the variable. +Files: src/undo.c + +Patch 8.0.1444 +Problem: Missing -D_FILE_OFFSET_BITS=64 may cause problems if a library is + compiled with it. +Solution: Include -D_FILE_OFFSET_BITS if some CFLAGS has it. (James McCoy, + closes #2600) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1445 +Problem: Cannot act on edits in the command line. +Solution: Add the CmdlineChanged autocommand event. (xtal8, closes #2603, + closes #2524) +Files: runtime/doc/autocmd.txt, src/ex_getln.c, src/fileio.c, + src/testdir/test_autocmd.vim, src/vim.h + +Patch 8.0.1446 +Problem: Accessing freed memory after window command in auto command. + (gy741) +Solution: Adjust the pointer in the parent frame. (Christian Brabandt, + closes #2467) +Files: src/window.c, src/testdir/test_window_cmd.vim + +Patch 8.0.1447 +Problem: Still too many old style tests. +Solution: Turn a few tests into new style. (Yegappan Lakshmanan, + closes #2509) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, + src/testdir/main.aap, src/testdir/test15.in, + src/testdir/test15.ok, src/testdir/test36.in, + src/testdir/test36.ok, src/testdir/test50.in, + src/testdir/test50.ok, src/testdir/test_regex_char_classes.vim, + src/testdir/test_shortpathname.vim, + src/testdir/test_textformat.vim + +Patch 8.0.1448 +Problem: Segmentation fault when Ruby throws an exception inside :rubyfile + command. +Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa, + closes #2147, greywolf, closes #2512, #2511) +Files: src/if_ruby.c, src/testdir/test_ruby.vim + +Patch 8.0.1449 +Problem: Slow redrawing with DirectX. +Solution: Avoid calling gui_mch_flush() unnecessarily, especially when + updating the cursor. (Ken Takata, closes #2560) +Files: runtime/doc/options.txt, src/channel.c, src/edit.c, src/getchar.c, + src/gui.c, src/gui_dwrite.cpp, src/gui_dwrite.h, src/gui_w32.c, + src/macros.h, src/main.c, src/message.c, src/netbeans.c, + src/proto/gui.pro, src/proto/term.pro, src/screen.c, src/search.c, + src/term.c, src/ui.c + +Patch 8.0.1450 +Problem: Endless loop when gui_mch_stop_blink() is called while blink_state + is BLINK_OFF. (zdohnal) +Solution: Avoid calling gui_update_cursor() recursively. +Files: src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, + src/gui_mac.c, src/proto/gui_mac.pro, src/gui_photon.c, + src/proto/gui_photon.pro, src/gui_w32.c, src/proto/gui_w32.pro, + src/gui_x11.c, src/proto/gui_x11.pro + +Patch 8.0.1451 +Problem: It is difficult to set the python home directory properly for + Python 2.7 and 3.5 since both use $PYTHONHOME. +Solution: Add the 'pythonhome' and 'pythonthreehome' options. (Kazuki + Sakamoto, closes #1266) +Files: runtime/doc/options.txt, runtime/doc/quickref.txt, + runtime/optwin.vim, src/if_python.c, src/if_python3.c, + src/option.c, src/option.h + +Patch 8.0.1452 +Problem: Terminal test fails on some systems. (jonathonf) +Solution: Use "cat" instead of Python to produce the input. Add a delay. + (closes #2607) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1453 +Problem: Terminal test fails on some slow terminals. +Solution: Increase timeout to 10 seconds. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1454 +Problem: When in silent mode too much output is buffered. +Solution: Use line buffering instead of fully buffered. (Brian M. Carlson, + closes #2537) +Files: src/main.c + +Patch 8.0.1455 +Problem: If $SHELL contains a space then the default value of 'shell' is + incorrect. (Matthew Horan) +Solution: Escape spaces in $SHELL. (Christian Brabandt, closes #459) +Files: src/option.c, runtime/doc/options.txt, + src/testdir/test_startup.vim + +Patch 8.0.1456 +Problem: Timer test on travis Mac is still flaky. +Solution: Increase time range a bit more. +Files: src/testdir/test_timers.vim + +Patch 8.0.1457 +Problem: Clojure now supports a shebang line. +Solution: Detect clojure script from the shebang line. (David Burgin, + closes #2570) +Files: runtime/scripts.vim + +Patch 8.0.1458 +Problem: Filetype detection test does not check all scripts. +Solution: Add most scripts to the test +Files: src/testdir/test_filetype.vim + +Patch 8.0.1459 +Problem: Cannot handle change of directory. +Solution: Add the DirChanged autocommand event. (Andy Massimino, + closes #888) Avoid changing directory for 'autochdir' too often. +Files: runtime/doc/autocmd.txt, src/buffer.c, src/ex_docmd.c, + src/fileio.c, src/main.c, src/vim.h, src/proto/misc2.pro, + src/gui_mac.c, src/netbeans.c, src/os_win32.c, + src/testdir/test_autocmd.vim + +Patch 8.0.1460 (after 8.0.1459) +Problem: Missing file in patch. +Solution: Add changes to missing file. +Files: src/misc2.c + +Patch 8.0.1461 (after 8.0.1459) +Problem: Missing another file in patch. +Solution: Add changes to missing file. +Files: src/ex_cmds.c + +Patch 8.0.1462 (after 8.0.1459) +Problem: Missing yet another file in patch. +Solution: Add changes to missing file. +Files: src/gui.c + +Patch 8.0.1463 +Problem: Test fails without 'autochdir' option. +Solution: Skip test if 'autochdir' is not supported. +Files: src/testdir/test_autocmd.vim + +Patch 8.0.1464 +Problem: Completing directory after :find does not add slash. +Solution: Adjust the flags for globpath(). (Genki Sky) +Files: src/misc1.c, src/testdir/test_find_complete.vim + +Patch 8.0.1465 +Problem: Python2 and python3 detection not tested. (Matej Cepl) +Solution: Add test for detecting python2 and python3. Also detect a script + using "js" as javascript. +Files: runtime/scripts.vim, src/testdir/test_filetype.vim + +Patch 8.0.1466 +Problem: Older GTK versions don't have gtk_entry_get_text_length(). +Solution: Add a function with #ifdefs to take care of GTK version + differences. (Kazunobu Kuriyama, closes #2605) +Files: src/gui_gtk.c + +Patch 8.0.1467 +Problem: Libvterm doesn't handle illegal byte sequence correctly. +Solution: After the invalid code check if there is space to store another + character. Allocate one more character. (zhykzhykzhyk, closes + #2614, closes #2613) +Files: src/libvterm/src/encoding.c, src/libvterm/src/state.c + +Patch 8.0.1468 +Problem: Illegal memory access in del_bytes(). +Solution: Check for negative byte count. (Christian Brabandt, closes #2466) +Files: src/message.c, src/misc1.c + +Patch 8.0.1469 +Problem: When package path is a symlink adding it to 'runtimepath' happens + at the end. +Solution: Do not resolve symlinks before locating the position in + 'runtimepath'. (Ozaki Kiichi, closes #2604) +Files: src/ex_cmds2.c, src/testdir/test_packadd.vim + +Patch 8.0.1470 +Problem: Integer overflow when using regexp pattern. (geeknik) +Solution: Use a long instead of int. (Christian Brabandt, closes #2251) +Files: src/regexp_nfa.c + +Patch 8.0.1471 (after 8.0.1401) +Problem: On MS-Windows CursorIM highlighting no longer works. +Solution: Adjust #if statements. (Ken Takata) +Files: src/gui.c + +Patch 8.0.1472 +Problem: MS-Windows: nsis installer is a bit slow. +Solution: Use ReserveFile for vimrc.ini. (Ken Takata, closes #2522) +Files: nsis/gvim.nsi + +Patch 8.0.1473 +Problem: MS-Windows: D&D fails between 32 and 64 bit apps. +Solution: Add the /HIGHENTROPYVA:NO linker option. (Ken Takata, closes #2504) +Files: src/Make_mvc.mak + +Patch 8.0.1474 +Problem: Visual C 2017 has multiple MSVCVER numbers. +Solution: Assume the 2017 version if MSVCVER >= 1910. (Leonardo Valeri + Manera, closes #2619) +Files: src/Make_mvc.mak + +Patch 8.0.1475 +Problem: Invalid memory access in read_redo(). (gy741) +Solution: Convert the replacement character back from a negative number to + CR or NL. (hint by Dominique Pelle, closes #2616) +Files: src/testdir/test_undo.vim, src/normal.c, src/vim.h, src/ops.c + +Patch 8.0.1476 +Problem: Screen isn't always updated right away. +Solution: Adjust #ifdef: Call out_flush() when not running the GUI. +Files: src/screen.c + +Patch 8.0.1477 +Problem: Redraw flicker when moving the mouse outside of terminal window. +Solution: Instead of updating the cursor color and shape every time leaving + and entering a terminal window, only update when different from + the previously used cursor. +Files: src/terminal.c + +Patch 8.0.1478 +Problem: Unnecessary condition for "len" being zero. +Solution: Remove the condition. (Dominique Pelle) +Files: src/regexp_nfa.c + +Patch 8.0.1479 +Problem: Insert mode completion state is confusing. +Solution: Move ctrl_x_mode into edit.c. Add CTRL_X_NORMAL for zero. +Files: src/edit.c, src/globals.h, src/proto/edit.pro, src/search.c, + src/getchar.c + +Patch 8.0.1480 (after 8.0.1479) +Problem: Patch missing change. +Solution: Add missing change. +Files: src/evalfunc.c + +Patch 8.0.1481 +Problem: Clearing a pointer takes two lines. +Solution: Add vim_clear() to free and clear the pointer. +Files: src/misc2.c, src/proto/misc2.pro, src/edit.c + +Patch 8.0.1482 +Problem: Using feedkeys() does not work to test Insert mode completion. + (Lifepillar) +Solution: Do not check for typed keys when executing :normal or feedkeys(). + Fix thesaurus completion not working when 'complete' is empty. +Files: src/edit.c, src/testdir/test_ins_complete.vim, + src/testdir/test_popup.vim, src/testdir/test_edit.vim + +Patch 8.0.1483 +Problem: Searchpair() might return an invalid value on timeout. +Solution: When the second search times out, do not accept a match from the + first search. (Daniel Hahler, closes #2552) +Files: src/search.c + +Patch 8.0.1484 +Problem: Redundant conditions. +Solution: Remove them. (Dominique Pelle) +Files: src/terminal.c + +Patch 8.0.1485 +Problem: Weird autocmd may cause arglist to be changed recursively. +Solution: Prevent recursively changing the argument list. (Christian + Brabandt, closes #2472) +Files: src/ex_docmd.c, src/globals.h + +Patch 8.0.1486 +Problem: Accessing invalid memory with "it". (Dominique Pelle) +Solution: Avoid going over the end of the line. (Christian Brabandt, + closes #2532) +Files: src/search.c, src/testdir/test_textobjects.vim + +Patch 8.0.1487 (after 8.0.1486) +Problem: Test 14 fails. +Solution: Fix of-by-one error. +Files: src/search.c + +Patch 8.0.1488 (after 8.0.1218) +Problem: Emacs tags no longer work. (zdohnal) +Solution: Do not skip over end of line. +Files: src/tag.c, src/testdir/test_tagjump.vim + +Patch 8.0.1489 +Problem: There is no easy way to get the global directory, esp. if some + windows have a local directory. +Solution: Make getcwd(-1) return the global directory. (Andy Massimino, + closes #2606) +Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_getcwd.vim + +Patch 8.0.1490 +Problem: Number of spell regions is spread out through the code. +Solution: Define MAXREGIONS. +Files: src/spell.h, src/spellfile.c + +Patch 8.0.1491 +Problem: The minimum width of the popup menu is hard coded. +Solution: Add the 'pumwidth' option. (Christian Brabandt, James McCoy, + closes #2314) +Files: runtime/doc/options.txt, src/option.c, src/option.h, + src/popupmnu.c + +Patch 8.0.1492 +Problem: Memory leak in balloon_split(). +Solution: Free the balloon lines. Free the balloon when exiting. +Files: src/misc2.c, src/evalfunc.c + +Patch 8.0.1493 +Problem: Completion items cannot be annotated. +Solution: Add a "user_data" entry to the completion item. (Ben Jackson, + coses #2608, closes #2508) +Files: runtime/doc/insert.txt, src/edit.c, src/structs.h, + src/testdir/test_ins_complete.vim + +Patch 8.0.1494 +Problem: No autocmd triggered in Insert mode with visible popup menu. +Solution: Add TextChangedP. (Prabir Shrestha, Christian Brabandt, + closes #2372, closes #1691) + Fix that the TextChanged autocommands are not always triggered + when sourcing a script. +Files: runtime/doc/autocmd.txt, src/edit.c, src/globals.h, src/structs.h, + src/fileio.c, src/proto/fileio.pro, src/vim.h, src/main.c, + src/testdir/test_autocmd.vim + +Patch 8.0.1495 +Problem: Having 'pumwidth' default to zero has no merit. +Solution: Make the default 15, as the actual default value. +Files: src/popupmnu.c, src/option.c + +Patch 8.0.1496 +Problem: Clearing a pointer takes two lines. +Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, + closes #2629) +Files: src/buffer.c, src/channel.c, src/crypt.c, src/edit.c, src/eval.c, + src/evalfunc.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, + src/ex_getln.c, src/fileio.c, src/gui_gtk_x11.c, src/gui_photon.c, + src/gui_w32.c, src/gui_x11.c, src/hardcopy.c, src/if_cscope.c, + src/macros.h, src/main.c, src/mark.c, src/mbyte.c, src/memfile.c, + src/memline.c, src/menu.c, src/message.c, src/misc1.c, + src/misc2.c, src/netbeans.c, src/normal.c, src/ops.c, + src/option.c, src/os_amiga.c, src/os_mac_conv.c, src/os_mswin.c, + src/os_unix.c, src/os_win32.c, src/popupmnu.c, + src/proto/misc2.pro, src/quickfix.c, src/regexp.c, + src/regexp_nfa.c, src/screen.c, src/search.c, src/spell.c, + src/spellfile.c, src/syntax.c, src/tag.c, src/term.c, + src/terminal.c, src/ui.c, src/undo.c, src/userfunc.c, src/window.c + +Patch 8.0.1497 +Problem: Getting the jump list requires parsing the output of :jumps. +Solution: Add getjumplist(). (Yegappan Lakshmanan, closes #2609) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/Makefile, + src/evalfunc.c, src/list.c, src/proto/list.pro, + src/testdir/Make_all.mak, src/testdir/test_jumplist.vim + +Patch 8.0.1498 (after 8.0.1497) +Problem: Getjumplist() returns duplicate entries. (lacygoill) +Solution: Call cleanup_jumplist(). (Yegappan Lakshmanan) +Files: src/evalfunc.c, src/mark.c, src/proto/mark.pro, + src/testdir/test_jumplist.vim + +Patch 8.0.1499 +Problem: Out-of-memory situation not correctly handled. (Coverity) +Solution: Check for NULL value. +Files: src/terminal.c + +Patch 8.0.1500 +Problem: Possible NULL pointer dereference. (Coverity) +Solution: Check for the pointer not being NULL. +Files: src/quickfix.c + +Patch 8.0.1501 +Problem: Out-of-memory situation not correctly handled. (Coverity) +Solution: Check for NULL value. +Files: src/ops.c + +Patch 8.0.1502 +Problem: In out-of-memory situation character is not restored. (Coverity) +Solution: Restore the character in all situations. +Files: src/ex_getln.c + +Patch 8.0.1503 +Problem: Access memory beyond end of string. (Coverity) +Solution: Keep allocated memory in separate pointer. Avoid outputting the + NUL character. +Files: src/hardcopy.c + +Patch 8.0.1504 +Problem: Win32: the screen may be cleared on startup. +Solution: Only call shell_resized() when the size actually changed. (Ken + Takata, closes #2527) +Files: src/os_win32.c + +Patch 8.0.1505 +Problem: Debugger can't break on a condition. (Charles Campbell) +Solution: Add ":breakadd expr". (Christian Brabandt, closes #859) +Files: runtime/doc/repeat.txt, src/eval.c, src/evalfunc.c, + src/userfunc.c, src/ex_cmds2.c, src/ex_docmd.c, + src/proto/eval.pro, src/proto/ex_cmds2.pro, src/structs.h + +Patch 8.0.1506 +Problem: New version of HP NonStop (Tandem) doesn't like the default header + for setenv(). +Solution: Put a #ifdef around the setenv() entry. (Joachim Schmitz) +Files: src/osdef2.h.in + +Patch 8.0.1507 +Problem: Timer test is a bit flaky. +Solution: Add it to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1508 +Problem: The :drop command is not always available. +Solution: Include :drop in all builds. (Yasuhiro Matsumoto, closes #2639) +Files: runtime/doc/windows.txt, src/ex_cmds.c, src/ex_cmds2.c, + src/ex_docmd.c, src/testdir/test_normal.vim, + src/testdir/test_tabpage.vim + +Patch 8.0.1509 (after 8.0.1508) +Problem: Test for failing drag-n-drop command no longer fails. +Solution: Check for the "dnd" feature. +Files: src/testdir/test_normal.vim + +Patch 8.0.1510 +Problem: Cannot test if a command causes a beep. +Solution: Add assert_beeps(). +Files: runtime/doc/eval.txt, src/evalfunc.c, src/eval.c, + src/proto/eval.pro, src/misc1.c, src/globals.h, + src/testdir/test_normal.vim, src/testdir/test_assert.vim + +Patch 8.0.1511 (after 8.0.1505) +Problem: Some code for the debugger watch expression is clumsy. +Solution: Clean up the code. +Files: src/ex_cmds2.c, src/eval.c, src/proto/eval.pro + +Patch 8.0.1512 +Problem: Warning for possibly using NULL pointer. (Coverity) +Solution: Skip using the pointer if it's NULL. +Files: src/ex_cmds.c + +Patch 8.0.1513 +Problem: The jumplist is not always properly cleaned up. +Solution: Call fname2fnum() before cleanup_jumplist(). (Yegappan Lakshmanan) +Files: src/evalfunc.c, src/mark.c, src/proto/mark.pro + +Patch 8.0.1514 +Problem: Getting the list of changes is not easy. +Solution: Add the getchangelist() function. (Yegappan Lakshmanan, + closes #2634) +Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt, src/evalfunc.c, + src/testdir/Make_all.mak, src/testdir/test_changelist.vim, + src/Makefile + +Patch 8.0.1515 +Problem: BufWinEnter event fired when opening hidden terminal. +Solution: Do not fire BufWinEnter when the terminal is hidden and does not + open a window. (Kenta Sato, closes #2636) +Files: src/terminal.c + +Patch 8.0.1516 +Problem: Errors for job options are not very specific. +Solution: Add more specific error messages. +Files: src/channel.c, src/globals.h + +Patch 8.0.1517 +Problem: Invalid memory access with pattern using look-behind match. + (Dominique Pelle) +Solution: Get a pointer to the right line. +Files: src/regexp.c + +Patch 8.0.1518 +Problem: Error messages suppressed after ":silent! try". (Ben Reilly) +Solution: Restore emsg_silent before executing :try. (closes #2531) +Files: src/ex_docmd.c, src/testdir/test_eval_stuff.vim + +Patch 8.0.1519 +Problem: Getchangelist() does not use argument as bufname(). +Solution: Use get_buf_tv(). (Yegappan Lakshmanan, closes #2641) +Files: src/evalfunc.c, src/testdir/test_changelist.vim + +Patch 8.0.1520 +Problem: Cursor is in the wrong line when using a WinBar in a Terminal + window. +Solution: Adjust the row number. (Christian Brabandt, closes #2362) +Files: src/screen.c, src/terminal.c + +Patch 8.0.1521 +Problem: Shift-Tab does not work in a terminal window. +Solution: Recognize Shift-Tab key press. (Jsees Luehrs, closes #2644) +Files: src/terminal.c + +Patch 8.0.1522 (after 8.0.1491) +Problem: Popup menu is positioned in the wrong place. (Davit Samvelyan, + Boris Staletic) +Solution: Correct computation of the column and the conditions for that. + (Hirohito Higashi, closes #2640) +Files: src/popupmnu.c + +Patch 8.0.1523 +Problem: Cannot write and read terminal screendumps. +Solution: Add term_dumpwrite(), term_dumpread() and term_dumpdiff(). + Also add assert_equalfile(). +Files: src/terminal.c, src/proto/terminal.pro, src/evalfunc.c, + src/normal.c, src/eval.c, src/proto/eval.pro, + runtime/doc/eval.txt, src/testdir/test_assert.vim + +Patch 8.0.1524 (after 8.0.1523) +Problem: Compiler warnings for uninitialized variables. (Tony Mechelynck) +Solution: Initialize variables. +Files: src/terminal.c + +Patch 8.0.1525 +Problem: Using :wqa exits even if a job runs in a terminal window. (Jason + Felice) +Solution: Check if a terminal has a running job. (closes #2654) +Files: src/ex_cmds2.c, src/buffer.c, src/proto/buffer.pro, src/ex_cmds.c, + src/testdir/test_terminal.vim + +Patch 8.0.1526 +Problem: No test using a screen dump yet. +Solution: Add a test for C syntax highlighting. Add helper functions. +Files: src/terminal.c, src/testdir/test_syntax.vim, + src/testdir/shared.vim, src/testdir/screendump.vim, + src/testdir/dumps/Test_syntax_c_01.dump, runtime/doc/terminal.txt, + src/testdir/README.txt + +Patch 8.0.1527 (after 8.0.1526) +Problem: Screen dump test fails on MS-Windows. +Solution: Skip dump test on MS-Windows for now. +Files: src/testdir/test_syntax.vim + +Patch 8.0.1528 +Problem: Dead code found. +Solution: Remove the useless lines. (CodeAi, closes #2656) +Files: src/screen.c, src/spell.c, src/syntax.c, src/window.c + +Patch 8.0.1529 +Problem: Assert_equalfile() does not close file descriptors. (Coverity) +Solution: Close the file descriptors. +Files: src/eval.c + +Patch 8.0.1530 +Problem: Dump test fails when using a shadow directory. +Solution: Add the directory to the list of symlinks to make (Elimar + Riesebieter) +Files: src/Makefile + +Patch 8.0.1531 +Problem: Cannot use 24 bit colors in MS-Windows console. +Solution: Add support for vcon. (Nobuhiro Takasaki, Ken Takata, + fixes #1270, fixes #2060) +Files: runtime/doc/options.txt, src/misc1.c, src/option.c, + src/evalfunc.c, src/os_win32.c, src/proto/os_win32.pro, + src/feature.h, src/proto/term.pro, src/screen.c, src/syntax.c, + src/term.c, src/testdir/gen_opt_test.vim, src/version.c + +Patch 8.0.1532 +Problem: Compiler warnings without termguicolors feature. +Solution: Add #ifdef. (John Marriott) Cleanup the code a bit. +Files: src/term.c + +Patch 8.0.1533 +Problem: Libterm doesn't support requesting fg and bg color. +Solution: Implement t_RF and t_RB. +Files: src/libvterm/src/vterm_internal.h, src/libvterm/src/state.c, + src/libvterm/src/vterm.c + +Patch 8.0.1534 +Problem: C syntax test fails when using gvim +Solution: Force running in a terminal. Check that 'background' is correct + even when $COLORFGBG is set. +Files: src/testdir/test_syntax.vim, src/testdir/screendump.vim + +Patch 8.0.1535 (after 8.0.1534) +Problem: C syntax test still fails when using gvim. +Solution: Clear Normal cterm highlighting instead of setting it. +Files: src/testdir/test_syntax.vim, src/testdir/screendump.vim, + src/testdir/dumps/Test_syntax_c_01.dump + +Patch 8.0.1536 +Problem: Quotestar test is flaky when using the GUI. +Solution: Add check that the star register arrived at the server. Increase + timeouts. +Files: src/testdir/test_quotestar.vim + +Patch 8.0.1537 +Problem: Xxd does not skip NUL lines when using ebcdic. +Solution: Check for a NUL before converting a character for ebcdic. (Tim + Sell, closes #2668) +Files: src/xxd/xxd.c + +Patch 8.0.1538 +Problem: Popupmenu is too far left when completion is long. (Linwei) +Solution: Adjust column computations. (Hirohito Higashi, closes #2661) +Files: src/popupmnu.c + +Patch 8.0.1539 +Problem: No test for the popup menu positioning. +Solution: Add a screendump test for the popup menu. +Files: src/terminal.c, src/testdir/test_syntax.vim, + src/testdir/screendump.vim, + src/testdir/test_popup.vim, + src/testdir/dumps/Test_popup_position_01.dump, + src/testdir/dumps/Test_popup_position_02.dump, + src/testdir/dumps/Test_popup_position_03.dump, + runtime/doc/eval.txt + +Patch 8.0.1540 +Problem: Popup menu positioning fails with longer string. +Solution: Only align with right side of window when width is less than + 'pumwidth' (closes #2661) +Files: src/popupmnu.c, src/testdir/screendump.vim, + src/testdir/test_popup.vim, + src/testdir/dumps/Test_popup_position_04.dump + +Patch 8.0.1541 +Problem: synpat_T is taking too much memory. +Solution: Reorder members to reduce padding. (Dominique Pelle, closes #2671) +Files: src/syntax.c + +Patch 8.0.1542 +Problem: Terminal screen dump does not include cursor position. +Solution: Mark the cursor position in the dump. +Files: src/terminal.c, + src/testdir/dumps/Test_popup_position_01.dump, + src/testdir/dumps/Test_popup_position_02.dump, + src/testdir/dumps/Test_popup_position_03.dump, + src/testdir/dumps/Test_popup_position_04.dump, + src/testdir/dumps/Test_syntax_c_01.dump + +Patch 8.0.1543 +Problem: With 'termguicolors' Normal color doesn't work correctly. +Solution: Set cterm_normal_bg_gui_color and cterm_normal_fg_color always. + (Kazunobu Kuriyama, closes #981, closes #2332) +Files: src/syntax.c + +Patch 8.0.1544 +Problem: When using 'termguicolors' SpellBad doesn't show. +Solution: When the GUI colors are not set fall back to the cterm colors. +Files: src/syntax.c, src/screen.c, src/gui.h, src/structs.h + +Patch 8.0.1545 +Problem: Screen dumps not included in distribution. +Solution: Add dumps to the list of distributed files. +Files: Filelist + +Patch 8.0.1546 +Problem: Using feedkeys() in a terminal window may trigger mappings. + (Charles Sheridan) +Solution: Avoid triggering a mapping when peeking for a key. +Files: src/getchar.c, src/terminal.c + +Patch 8.0.1547 +Problem: Undo in the options window makes it empty. +Solution: Set 'undolevels' while filling the buffer. (Yasuhiro Matsumoto, + closes #2645) +Files: runtime/optwin.vim + +Patch 8.0.1548 +Problem: Screen dump test script not included in distribution. +Solution: Add the script to the list of distributed files. +Files: Filelist + +Patch 8.0.1549 +Problem: Various small problems in test files. +Solution: Include small changes. +Files: src/testdir/test_channel.py, src/testdir/shared.vim, + src/testdir/test_gui.vim, src/testdir/test_gui_init.vim + +Patch 8.0.1550 +Problem: Various small problems in source files. +Solution: Fix the problems. +Files: src/README.txt, src/beval.c, src/json_test.c, src/mbyte.c, + src/libvterm/include/vterm_keycodes.h, src/Makefile, + src/gui_gtk.c, src/if_xcmdsrv.c, src/pty.c, src/if_python.c, + src/if_py_both.h, uninstal.txt, src/dosinst.c, src/iscygpty.c, + src/vimrun.c, src/os_vms.c + +Patch 8.0.1551 +Problem: On Mac 'maxmemtot' is set to a weird value. +Solution: For Mac use total memory and subtract system memory. For other + systems accept both a 32 bit and 64 bit result. (Ozaki Kiichi, + closes #2646) +Files: src/os_unix.c + +Patch 8.0.1552 +Problem: May leak file descriptors when executing job. +Solution: Close more file descriptors. (Ozaki Kiichi, closes #2651) +Files: src/os_unix.c, src/testdir/test_channel.vim + +Patch 8.0.1553 +Problem: Cannot see what digraph is used to insert a character. +Solution: Show the digraph with the "ga" command. (Christian Brabandt) +Files: runtime/doc/various.txt, src/digraph.c, src/ex_cmds.c, + src/proto/digraph.pro, src/testdir/shared.vim, + src/testdir/test_matchadd_conceal.vim, + src/testdir/test_digraph.vim, src/testdir/test_ga.vim, + src/testdir/test_arabic.vim + +Patch 8.0.1554 +Problem: Custom plugins loaded with --clean. +Solution: Do not include the home directory in 'runtimepath'. +Files: src/option.c, src/main.c, src/proto/option.pro, src/structs.h, + src/os_unix.h, src/os_amiga.h, src/os_dos.h, src/os_mac.h, + runtime/doc/starting.txt + +Patch 8.0.1555 +Problem: Build error for some combination of features. +Solution: Declare variable in more situations. +Files: src/main.c + +Patch 8.0.1556 +Problem: May not parse the t_RS response correctly, resulting in wrong + characters in the input stream. +Solution: When the t_RS response is partly received wait for more + characters. +Files: src/term.c + +Patch 8.0.1557 +Problem: printf() does not work with only one argument. (Daniel Hahler) +Solution: Allow using just the format. (Ken Takata, closes #2687) +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 8.0.1558 +Problem: No right-click menu in a terminal. +Solution: Implement the right click menu for the terminal. +Files: src/popupmnu.c, src/proto/popupmnu.pro, src/normal.c, src/menu.c, + src/proto/menu.pro, src/feature.h + +Patch 8.0.1559 +Problem: Build failure without GUI. +Solution: Adjust #ifdef for get_fpos_of_mouse(). +Files: src/ui.c + +Patch 8.0.1560 +Problem: Build failure without GUI on MS-Windows. +Solution: Adjust #ifdef for vcol2col(). +Files: src/ui.c + +Patch 8.0.1561 +Problem: Crash with rust syntax highlighting. (Edd Barrett) +Solution: Avoid going past the end of an empty line. +Files: src/syntax.c + +Patch 8.0.1562 +Problem: The terminal debugger can't set a breakpoint with the mouse. +Solution: Add popup menu entries. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1563 +Problem: Timeout of getwinposx() can be too short. (lilydjwg) +Solution: Add getwinpos(). (closes #2689) +Files: src/evalfunc.c, src/term.c, src/proto/term.pro, runtime/doc/eval.txt + +Patch 8.0.1564 +Problem: Too many #ifdefs. +Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and + increases code size of tiny Vim by only 40 Kbyte. +Files: src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c, + src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, + src/fileio.c, src/getchar.c, src/globals.h, src/gui.c, + src/if_cscope.c, src/if_xcmdsrv.c, src/main.c, src/mbyte.c, + src/memline.c, src/menu.c, src/misc1.c, src/gui_mac.c, + src/misc2.c, src/move.c, src/netbeans.c, src/normal.c, src/ops.c, + src/option.c, src/option.h, src/feature.h, src/vim.h, + src/os_amiga.c, src/os_mswin.c, src/os_unix.c, src/os_win32.c, + src/quickfix.c, src/screen.c, src/search.c, src/spell.c, + src/structs.h, src/syntax.c, src/tag.c, src/term.c, + src/terminal.c, src/ui.c, src/undo.c, src/userfunc.c, + src/version.c, src/window.c + +Patch 8.0.1565 +Problem: Can't build Mac version without GUI. +Solution: Adjust when IME_WITHOUT_XIM is defined. +Files: src/vim.h + +Patch 8.0.1566 +Problem: Too many #ifdefs. +Solution: Graduate FEAT_SCROLLBIND and FEAT_CURSORBIND. +Files: src/buffer.c, src/diff.c, src/edit.c, src/evalfunc.c, + src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/gui.c, + src/main.c, src/move.c, src/normal.c, src/option.c, src/term.c, + src/version.c, src/window.c, src/globals.h, src/macros.h, + src/option.h, src/structs.h + +Patch 8.0.1567 +Problem: Cannot build Win32 GUI without IME. (John Marriott) +Solution: Adjust when IME_WITHOUT_XIM and HAVE_INPUT_METHOD are defined and + use it in a few more places. +Files: src/vim.h, src/gui.c + +Patch 8.0.1568 +Problem: Can't build on older Mac, header file is missing. +Solution: Remove the header file. (Ozaki Kiichi, closes #2691) +Files: src/os_unix.c + +Patch 8.0.1569 +Problem: Warning for uninitialized variable from gcc. +Solution: Initialize the variable. +Files: src/quickfix.c + +Patch 8.0.1570 +Problem: Can't use :popup for a menu in the terminal. (Wei Zhang) +Solution: Make :popup work in the terminal. Also fix that entries were + included that don't work in the current state. +Files: src/ex_docmd.c, src/popupmnu.c, src/proto/popupmnu.pro, + src/menu.c, src/proto/menu.pro + +Patch 8.0.1571 (after 8.0.1571) +Problem: Can't build without GUI. +Solution: Adjust #ifdef for gui_find_menu(). +Files: src/menu.c + +Patch 8.0.1572 +Problem: Mac: getting memory size doesn't work everywhere. +Solution: Use MACOS_X instead of MACOS_X_DARWIN. (Kazunobu Kuriyama) +Files: src/os_unix.c + +Patch 8.0.1573 +Problem: getwinpos(1) may cause response to be handled as command. +Solution: Handle any cursor position report once one was request. (partly by + Hirohito Higashi) +Files: src/term.c + +Patch 8.0.1574 +Problem: Show cursor in wrong place when using popup menu. (Wei Zhang) +Solution: Force updating the cursor position. Fix skipping over unused + entries. +Files: src/screen.c, src/proto/screen.pro, src/popupmnu.c + +Patch 8.0.1575 +Problem: Crash when using virtual replace. +Solution: Adjust orig_line_count. Add more tests. (Christian Brabandt) +Files: src/edit.c, src/testdir/test_visual.vim + +Patch 8.0.1576 +Problem: Perl VIM::Buffers() does not find every buffer. +Solution: Also find unlisted buffer by number or name. (Chris Weyl, + closes #2692) +Files: src/if_perl.xs + +Patch 8.0.1577 +Problem: Virtual replace test fails on MS-Windows. +Solution: Make adding a termcap entry work for a builtin terminal. + Restore terminal keys in a better way. +Files: src/term.c, src/testdir/test_visual.vim + +Patch 8.0.1578 +Problem: No test for :popup in terminal. +Solution: Add a screen dump test. +Files: src/testdir/test_popup.vim, + src/testdir/dumps/Test_popup_command_01.dump, + src/testdir/dumps/Test_popup_command_02.dump, + src/testdir/dumps/Test_popup_command_03.dump + +Patch 8.0.1579 +Problem: Virtual replace test fails in GUI. +Solution: Don't save key options if they were not set. +Files: src/testdir/test_visual.vim + +Patch 8.0.1580 +Problem: FEAT_CURSORBIND and FEAT_SCROLLBIND are unused. +Solution: Delete them. +Files: src/feature.h + +Patch 8.0.1581 +Problem: Cannot build Win32 GUI without +eval. +Solution: Define HAVE_INPUT_METHOD without +eval. (Ken Takata) +Files: src/vim.h + +Patch 8.0.1582 +Problem: In the MS-Windows console mouse movement is not used. +Solution: Pass mouse movement events when useful. +Files: src/os_win32.c, src/proto/os_win32.pro, src/feature.h + +Patch 8.0.1583 +Problem: Using C99 comment. +Solution: Use old style comment. (Kazunobu Kuriyama) +Files: src/quickfix.c + +Patch 8.0.1584 +Problem: Using C99 in Mac file gives compiler warning messages. +Solution: Add #pragmas to avoid the warnings. (Kazunobu Kuriyama) +Files: src/os_macosx.m + +Patch 8.0.1585 +Problem: Enabling beval_term feature in Win32 GUI. +Solution: Only enable beval_term in Win32 console. +Files: src/feature.h + +Patch 8.0.1586 +Problem: Imactivatefunc does not work on non-GUI Mac. +Solution: Fix logic in #ifdef. +Files: src/vim.h + +Patch 8.0.1587 +Problem: inserting from the clipboard doesn't work literally +Solution: When pasting from the * or + register always assume literally. +Files: src/ops.c, src/proto/ops.pro, src/testdir/test_paste.vim + +Patch 8.0.1588 +Problem: Popup menu hangs after typing CTRL-C. +Solution: Make CTRL-C exit the loop. (Ozaki Kiichi, closes #2697) +Files: src/popupmnu.c + +Patch 8.0.1589 +Problem: Error for setting 'modifiable' when resetting it. +Solution: Check if 'modifiable' was actually set. +Files: src/option.c + +Patch 8.0.1590 +Problem: Padding in list type wastes memory. +Solution: Reorder struct members to optimize padding. (Dominique Pelle, + closes #2704) +Files: src/structs.h + +Patch 8.0.1591 +Problem: MS-Windows: when reparsing the arguments 'wildignore' matters. +Solution: Save and reset 'wildignore'. (Yasuhiro Matsumoto, closes #2702) +Files: src/os_win32.c + +Patch 8.0.1592 +Problem: Terminal windows in a session are not properly restored. +Solution: Add "terminal" in 'sessionoptions'. When possible restore the + command running in a terminal. +Files: src/option.c, src/option.h, src/ex_docmd.c, src/terminal.c, + src/proto/terminal.pro, src/evalfunc.c, src/structs.h, + src/channel.c, src/testdir/test_terminal.vim, + src/testdir/shared.vim, src/testdir/test_mksession.vim + +Patch 8.0.1593 +Problem: :qall never exits with an active terminal window. +Solution: Add a way to kill a job in a terminal window. +Files: src/ex_cmds2.c, src/terminal.c, src/proto/terminal.pro, + src/structs.h, src/channel.c, src/evalfunc.c, + src/testdir/test_terminal.vim, runtime/doc/terminal.txt, + runtime/doc/eval.txt + +Patch 8.0.1594 +Problem: :confirm qall not tested with active terminal window. +Solution: Add a test. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1595 +Problem: No autocommand triggered before exiting. +Solution: Add the ExitPre autocommand event. +Files: src/ex_docmd.c, src/fileio.c, src/vim.h, + src/testdir/test_exit.vim, src/Makefile, src/testdir/Make_all.mak, + runtime/doc/autocmd.txt + +Patch 8.0.1596 +Problem: No autocommand specifically for opening a terminal window. +Solution: Add TerminalOpen. (Yasuhiro Matsumoto, closes #2484) +Files: runtime/doc/autocmd.txt, src/fileio.c, src/terminal.c, + src/testdir/test_terminal.vim, src/vim.h + +Patch 8.0.1597 +Problem: Autocommand events are not sorted. +Solution: Sort the autocommand events. +Files: src/vim.h + +Patch 8.0.1598 +Problem: Cannot select text in a terminal with the mouse. +Solution: When a job in a terminal is not consuming mouse events, use them + for modeless selection. Also stop Insert mode when clicking in a + terminal window. +Files: src/libvterm/include/vterm.h, src/libvterm/src/state.c, + src/libvterm/src/vterm_internal.h, src/terminal.c, + src/proto/terminal.pro, src/ui.c + +Patch 8.0.1599 +Problem: No error message when gdb does not support the terminal debugger. +Solution: Check for the response to open the Machine Interface. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1600 +Problem: Crash when setting t_Co to zero when 'termguicolors' is set. +Solution: Use IS_CTERM instead of checking the number of colors. + (closes #2710) +Files: src/screen.c, src/testdir/test_highlight.vim + +Patch 8.0.1601 +Problem: Highlight test fails on Win32. +Solution: Check for vtp and vcon support. +Files: src/evalfunc.c, src/testdir/test_highlight.vim + +Patch 8.0.1602 +Problem: Crash in parsing JSON. +Solution: Fail when using array or dict as dict key. (Damien) +Files: src/json.c, src/testdir/test_json.vim + +Patch 8.0.1603 +Problem: Cannot build with +terminal but without +menu. +Solution: Add #ifdef. (Damien) +Files: src/terminal.c + +Patch 8.0.1604 +Problem: Paste test may fail if $DISPLAY is not set. +Solution: Add WorkingClipboard() and use it in the paste test. +Files: src/testdir/shared.vim, src/testdir/test_paste.vim + +Patch 8.0.1605 +Problem: Terminal test is a bit flaky. +Solution: Check for the shell prompt. Use more lambda functions. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1606 +Problem: Singular/plural variants not translated. +Solution: Add NGETTEXT argument to xgettext. (Sergey Alyoshin) +Files: src/po/Make_cyg.mak, src/po/Make_ming.mak, src/po/Make_mvc.mak, + src/po/Makefile + +Patch 8.0.1607 +Problem: --clean loads user settings from .gvimrc. +Solution: Behave like "-U NONE" was used. (Ken Takata) +Files: src/main.c, runtime/doc/starting.txt + +Patch 8.0.1608 +Problem: Win32: directx not enabled by default. +Solution: Change Makefile to enable directx by default. (Ken Takata) +Files: runtime/doc/various.txt, src/Make_cyg_ming.mak, + src/Make_mvc.mak + +Patch 8.0.1609 +Problem: Shell commands in the GUI use a dumb terminal. +Solution: Add the "!" flag to 'guioptions' to execute system commands in a + special terminal window. Only for Unix now. +Files: src/os_unix.c, src/option.h, src/evalfunc.c, src/terminal.c, + src/proto/terminal.pro, src/channel.c, src/proto/channel.pro, + src/vim.h, runtime/doc/options.txt + +Patch 8.0.1610 (after 8.0.1609) +Problem: Cannot build without GUI. +Solution: Add #ifdef. +Files: src/terminal.c + +Patch 8.0.1611 +Problem: CTRL-W in system terminal does not go to job. +Solution: Do not use CTRL-W as a terminal command in a system terminal. +Files: src/terminal.c + +Patch 8.0.1612 +Problem: Need to close terminal after shell stopped. +Solution: Make :terminal without argument close the window by default. +Files: src/terminal.c, src/testdir/test_terminal.vim, + runtime/doc/terminal.txt + +Patch 8.0.1613 +Problem: Warning for unused variable in tiny build. (Tony Mechelynck) +Solution: Move declaration to inner block. +Files: src/os_unix.c + +Patch 8.0.1614 +Problem: "make tags" doesn't include libvterm. +Solution: Add the libvterm sources to the tags command. +Files: src/Makefile + +Patch 8.0.1615 +Problem: term_dumpload() does not use the right colors. +Solution: Initialize colors when not using create_vterm(). +Files: src/terminal.c + +Patch 8.0.1616 +Problem: Win32: shell commands in the GUI open a new console. +Solution: Use a terminal window for interactive use when 'guioptions' + contains "!". +Files: src/os_win32.c + +Patch 8.0.1617 (after 8.0.1616) +Problem: Win32: :shell command in the GUI crashes. +Solution: Handle the situation that "cmd" is NULL. (Yasuhiro Matsumoto, + closes #2721) +Files: src/os_win32.c + +Patch 8.0.1618 +Problem: Color Grey50, used for ToolbarLine, is missing in the compiled-in + table. +Solution: Add the color to the list. (Kazunobu Kuriyama) +Files: src/term.c + +Patch 8.0.1619 +Problem: Win32 GUI: crash when winpty is not installed and trying to use + :shell in a terminal window. +Solution: Check for NULL return form term_start(). (Yasuhiro Matsumoto, + closes #2727) +Files: src/os_win32.c + +Patch 8.0.1620 +Problem: Reading spell file has no good EOF detection. +Solution: Check for EOF at every character read for a length field. +Files: src/misc2.c + +Patch 8.0.1621 +Problem: Using invalid default value for highlight attribute. +Solution: Use zero instead of -1. +Files: src/syntax.c + +Patch 8.0.1622 +Problem: Possible NULL pointer dereferencey. (Coverity) +Solution: Reverse the check for a NULL pointer. +Files: src/quickfix.c + +Patch 8.0.1623 +Problem: Terminal kill tests are flaky. +Solution: Instead of running Vim in a terminal, run it as a normal command. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1624 +Problem: Options for term_dumpdiff() and term_dumpload() not implemented + yet. +Solution: Implement the relevant options. +Files: src/terminal.c, runtime/doc/eval.txt + +Patch 8.0.1625 +Problem: Test_quotestar is flaky when run in GTK GUI. +Solution: Do not call lose_selection when invoked from + selection_clear_event(). +Files: src/gui_gtk_x11.c + +Patch 8.0.1626 +Problem: Compiler warning for possible loss of data. +Solution: Use size_t instead of int. (Christian Brabandt) +Files: src/terminal.c + +Patch 8.0.1627 +Problem: Compiler warning for visibility attribute not supported on MinGW + builds. +Solution: Don't add the attribute when we don't expect it to work. + (Christian Brabandt) +Files: src/libvterm/src/vterm_internal.h + +Patch 8.0.1628 +Problem: Channel log doesn't mention exiting. +Solution: Add a ch_log() call in getout(). +Files: src/main.c + +Patch 8.0.1629 +Problem: Mac: getpagesize() is deprecated. +Solution: Use sysconf() instead. (Ozaki Kiichi, closes #2741) +Files: src/os_unix.c + +Patch 8.0.1630 +Problem: Trimming white space is not that easy. +Solution: Add the trim() function. (Bukn, Yasuhiro Matsumoto, closes #1280) +Files: src/evalfunc.c, runtime/doc/eval.txt, + src/testdir/test_functions.vim + +Patch 8.0.1631 +Problem: Testing with Vim running in terminal is a bit flaky. +Solution: Delete any .swp file so that later tests don't fail. +Files: src/testdir/screendump.vim + +Patch 8.0.1632 +Problem: In a terminal dump NUL and space considered are different, + although they are displayed the same. +Solution: When encountering NUL handle it like space. +Files: src/terminal.c + +Patch 8.0.1633 +Problem: A TextChanged autocmd triggers when it is defined after creating a + buffer. +Solution: Set b_last_changedtick when opening a buffer. (Hirohito Higashi, + closes #2742) +Files: src/buffer.c, src/testdir/test_autocmd.vim + +Patch 8.0.1634 +Problem: The ex_vimgrep() function is too long. +Solution: Split it in smaller functions. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1635 +Problem: Undefining _POSIX_THREADS causes problems with Python 3. (Micah + Bucy, closes #2748) +Solution: Remove the lines. +Files: src/if_python3.c + +Patch 8.0.1636 +Problem: No test for term_dumpload() and term_dumpdiff(). +Solution: Add tests. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1637 +Problem: No test for term_dumpdiff() options argument. +Solution: Add a test. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1638 +Problem: Popup test fails depending on environment variable. +Solution: Reset $COLORFGBG when running Vim in a terminal. (closes #2693) +Files: src/testdir/screendump.vim + +Patch 8.0.1639 +Problem: Libvterm code lags behind master. +Solution: Sync to head, solve merge problems. +Files: src/libvterm/README, src/libvterm/bin/unterm.c, + src/libvterm/bin/vterm-ctrl.c, src/libvterm/bin/vterm-dump.c, + src/libvterm/doc/URLs, src/libvterm/doc/seqs.txt, + src/libvterm/include/vterm.h, + src/libvterm/include/vterm_keycodes.h, src/libvterm/src/mouse.c, + src/libvterm/src/parser.c, src/libvterm/src/pen.c, + src/libvterm/src/screen.c, src/libvterm/src/state.c, + src/libvterm/src/vterm.c, src/libvterm/src/vterm_internal.h, + src/libvterm/t/10state_putglyph.test, + src/libvterm/t/25state_input.test, src/libvterm/t/harness.c, + src/libvterm/t/26state_query.test + +Patch 8.0.1640 +Problem: Test_cwd() is flaky. +Solution: Add to list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.1641 +Problem: Job in terminal can't communicate with Vim. +Solution: Add the terminal API. +Files: src/terminal.c, src/buffer.c, src/testdir/test_terminal.vim, + src/testdir/screendump.vim, runtime/doc/terminal.txt + +Patch 8.0.1642 +Problem: Running Vim in terminal fails with two windows. +Solution: Pass the number of rows to RunVimInTerminal(). +Files: src/testdir/screendump.vim, src/testdir/test_terminal.vim + +Patch 8.0.1643 +Problem: Terminal API tests fail. +Solution: Explicitly set 'title'. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1644 +Problem: Terminal API tests still fail. +Solution: Explicitly set 'title' in the terminal job. (Ozaki Kiichi, + closes #2750) +Files: src/testdir/test_terminal.vim, src/testdir/screendump.vim + +Patch 8.0.1645 +Problem: Test for terminal response to escape sequence fails for some + people. (toothpik) +Solution: Run "cat" and let it echo the characters. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1646 +Problem: MS-Windows: executable contains unreferenced functions and data. +Solution: Add /opt:ref to the compiler command. (Ken Takata) +Files: src/Make_mvc.mak + +Patch 8.0.1647 +Problem: Terminal API may call a function not meant to be called by this + API. +Solution: Require the function to start with Tapi_. +Files: runtime/doc/terminal.txt, src/terminal.c, + src/testdir/test_terminal.vim + +Patch 8.0.1648 +Problem: Resource fork tool doesn't work on Python 3. +Solution: Use "print()" instead of "print". (Marius Gedminas) +Files: src/dehqx.py + +Patch 8.0.1649 +Problem: No completion for argument list commands. +Solution: Add arglist completion. (Yegappan Lakshmanan, closes #2706) +Files: runtime/doc/eval.txt, runtime/doc/map.txt, src/ex_cmds2.c, + src/ex_docmd.c, src/ex_getln.c, src/proto/ex_cmds2.pro, + src/testdir/test_cmdline.vim, src/vim.h + +Patch 8.0.1650 +Problem: Too many #ifdefs. +Solution: Graduate FEAT_LISTCMDS, no reason to leave out buffer commands. +Files: runtime/doc/various.txt, src/buffer.c, src/charset.c, + src/evalfunc.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, + src/version.c, src/feature.h + +Patch 8.0.1651 +Problem: Cannot filter :ls output for terminal buffers. +Solution: Add flags for terminal buffers. (Marcin Szamotulski, closes #2751) +Files: runtime/doc/windows.txt, src/buffer.c, + src/testdir/test_terminal.vim + +Patch 8.0.1652 +Problem: term_dumpwrite() does not output composing characters. +Solution: Use the cell index. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1653 +Problem: Screen dump is made too soon. +Solution: Wait until the ruler is displayed. (Ozaki Kiichi, closes #2755) +Files: src/testdir/dumps/Test_popup_command_01.dump, + src/testdir/dumps/Test_popup_command_02.dump, + src/testdir/screendump.vim, src/testdir/test_autocmd.vim, + src/testdir/test_terminal.vim + +Patch 8.0.1654 +Problem: Warnings for conversion of void to function pointer. +Solution: Use a temp variable that is a function pointer. +Files: src/if_python.c, src/if_python3.c + +Patch 8.0.1655 +Problem: Outdated gdb message in terminal debugger unclear. +Solution: Specifically mention the required gdb version. Avoid getting + stuck on pagination. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim + +Patch 8.0.1656 +Problem: No option to have xxd produce upper case variable names. +Solution: Add the -C argument. (Matt Panaro closes #2772) +Files: src/xxd/xxd.c + +Patch 8.0.1657 +Problem: Crash when reading a channel. +Solution: Clear the write flag before writing. (idea by Shinya Ohyanagi, + closes #2769). +Files: src/channel.c + +Patch 8.0.1658 +Problem: Capitalize argument not available in long form. +Solution: Recognize -capitalize. Update man page. +Files: src/xxd/xxd.c, runtime/doc/xxd.1, runtime/doc/xxd.man + +Patch 8.0.1659 +Problem: Scroll events not recognized for some xterm emulators. +Solution: Recognize mouse codes 0x40 and 0x41 as scroll events. +Files: src/term.c + +Patch 8.0.1660 +Problem: The terminal API "drop" command doesn't support options. +Solution: Implement the options. +Files: src/terminal.c, src/ex_docmd.c, src/proto/ex_docmd.pro, + src/ex_cmds.h, src/eval.c, src/misc2.c, src/fileio.c, + src/testdir/test_terminal.vim, runtime/doc/terminal.txt + +Patch 8.0.1661 +Problem: Warnings from 64 bit compiler. +Solution: Add type casts. (Mike Williams) +Files: src/terminal.c + +Patch 8.0.1662 +Problem: Showing dump diff doesn't mention both file names. +Solution: Add the file name in the separator line. +Files: src/terminal.c + +Patch 8.0.1663 (after 8.0.1660) +Problem: Cannot build without multi-byte feature. +Solution: Add #ifdef. +Files: src/ex_docmd.c + +Patch 8.0.1664 +Problem: Test failure because of not allocating enough space. +Solution: Allocate more bytes. +Files: src/terminal.c + +Patch 8.0.1665 +Problem: When running a terminal from the GUI 'term' is not useful. +Solution: Use $TERM in the GUI if it starts with "xterm". (closes #2776) +Files: src/os_unix.c, runtime/doc/terminal.txt + +Patch 8.0.1666 +Problem: % argument in ch_log() causes trouble. +Solution: Use string as third argument in internal ch_log(). (Dominique + Pelle, closes #2784) +Files: src/evalfunc.c, src/testdir/test_channel.vim + +Patch 8.0.1667 +Problem: Terminal window tests are flaky. +Solution: Increase the waiting time for Vim to start. +Files: src/testdir/screendump.vim + +Patch 8.0.1668 +Problem: Terminal debugger: can't re-open source code window. +Solution: Add the :Source command. Also create the window if needed when + gdb stops at a source line. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1669 +Problem: :vimgrep may add entries to the wrong quickfix list. +Solution: Use the list identifier. (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1670 +Problem: Terminal window tests are still a bit flaky. +Solution: Increase the waiting time for the buffer to be created. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1671 +Problem: Crash when passing non-dict argument as env to job_start(). +Solution: Check for valid argument. (Ozaki Kiichi, closes #2765) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 8.0.1672 +Problem: Error during completion causes command to be cancelled. +Solution: Reset did_emsg before waiting for another character. (Tom M.) +Files: src/ex_getln.c, src/testdir/test_cmdline.vim + +Patch 8.0.1673 +Problem: Terminal window tests are still a bit flaky. +Solution: Increase the waiting time even more. (Elimar Riesebieter) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1674 +Problem: Libvterm can't handle a long OSC string that is split. +Solution: When an incomplete OSC string is received copy it to the parser + buffer. Increase the size of the parser buffer to be able to + handle longer strings. +Files: src/libvterm/src/parser.c, src/libvterm/src/vterm.c + +Patch 8.0.1675 +Problem: Unused macro argument in libvterm. (Randall W. Morris) +Solution: Remove the argument. +Files: src/libvterm/src/parser.c + +Patch 8.0.1676 +Problem: No compiler warning for wrong printf format. +Solution: Add a printf attribute for gcc. Fix reported problems. (Dominique + Pelle, closes #2789) +Files: src/channel.c, src/vim.h, src/proto/channel.pro + +Patch 8.0.1677 +Problem: No compiler warning for wrong format in vim_snprintf(). +Solution: Add printf attribute for gcc. Fix reported problems. +Files: src/vim.h, src/proto.h, src/eval.c, src/fileio.c, src/mbyte.c, + src/ops.c, src/spellfile.c, src/undo.c, src/json.c + +Patch 8.0.1678 +Problem: Errorformat "%r" implies "%>". (Jan Gosmann) +Solution: Jump to before setting fmt_ptr. (Yegappan Lakshmanan, + closes #2785) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1679 +Problem: Compiler warning for printf format. (Chdiza) +Solution: Change type to "long long". (closes #2791) +Files: src/ops.c + +Patch 8.0.1680 +Problem: Memory allocated by libvterm does not show up in profile. +Solution: Pass allocator functions to vterm_new(). +Files: src/terminal.c + +Patch 8.0.1681 +Problem: The format attribute fails with MinGW. (John Marriott) +Solution: Don't use the format attribute with MinGW. +Files: src/vim.h, src/proto.h, src/channel.c + +Patch 8.0.1682 +Problem: Auto indenting breaks inserting a block. +Solution: Do not check for cursor movement if indent was changed. (Christian + Brabandt, closes #2778) +Files: src/testdir/test_blockedit.vim, src/testdir/Make_all.mak, + src/Makefile, src/ops.c + +Patch 8.0.1683 +Problem: Python upgrade breaks Vim when defining PYTHON_HOME. +Solution: Do not define PYTHON_HOME and PYTHON3_HOME in configure. (Naoki + Inada, closes #2787) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1684 +Problem: ml_get errors when using terminal window for shell command. + (Blay263) +Solution: Do not change the size of the current window. +Files: src/terminal.c + +Patch 8.0.1685 +Problem: Can't set ANSI colors of a terminal window. +Solution: Add term_setansicolors(), term_getansicolors() and + g:term_ansi_colors. (Andy Massimino, closes #2747) +Files: runtime/doc/eval.txt, runtime/doc/terminal.txt, src/channel.c, + src/evalfunc.c, src/proto/terminal.pro, src/structs.h, + src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1686 (after 8.0.1683) +Problem: Python does not work when configuring with specific dir. (Rajdeep) +Solution: Do define PYTHON_HOME and PYTHON3_HOME in configure if the Python + config dir was specified. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1687 +Problem: 64 bit compiler warnings. +Solution: change type, add type cast. (Mike Williams) +Files: src/terminal.c + +Patch 8.0.1688 +Problem: Some macros are used without a semicolon, causing auto-indent to be + wrong. +Solution: Use the do-while(0) trick. (Ozaki Kiichi, closes #2729) +Files: src/buffer.c, src/dosinst.c, src/ex_cmds.c, src/gui_at_sb.c, + src/macros.h, src/main.c, src/memline.c, src/option.c, + src/os_vms.c, src/screen.c, src/window.c + +Patch 8.0.1689 +Problem: No tests for xxd. +Solution: Add a test. (Christian Brabandt) +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Makefile, + src/testdir/test_xxd.vim, src/testdir/runtest.vim + +Patch 8.0.1690 +Problem: Not easy to run one test with gvim instead of vim. +Solution: Add VIMTESTTARGET in Makefile. +Files: src/Makefile + +Patch 8.0.1691 +Problem: Xxd test sometimes fails. +Solution: Wipe out the XXDfile buffer. +Files: src/testdir/test_xxd.vim + +Patch 8.0.1692 (after 8.0.1686) +Problem: Python may not work when using statically linked library. +Solution: Do not define PYTHON_HOME and PYTHON3_HOME in configure if the + Python library is linked statically. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1693 +Problem: Xxd is excluded from coverage statistics. +Solution: Don't skip the xxd directory. (Christian Brabandt) +Files: .travis.yml + +Patch 8.0.1694 +Problem: Terminal API test is a bit flaky. +Solution: Wait longer for Vim to stop. +Files: src/testdir/screendump.vim + +Patch 8.0.1695 +Problem: Xxd test not run on MS-Windows. +Solution: Use xxd.exe if it exists. +Files: src/testdir/test_xxd.vim + +Patch 8.0.1696 +Problem: Coverage statistics don't work. +Solution: Include the xxd directory. (Christian Brabandt) +Files: .travis.yml + +Patch 8.0.1697 +Problem: Various tests are still a bit flaky. +Solution: Increase the default wait time to five seconds. +Files: src/testdir/shared.vim, src/testdir/screendump.vim, + src/testdir/test_channel.vim, src/testdir/test_clientserver.vim, + src/testdir/test_quotestar.vim, src/testdir/test_terminal.vim + +Patch 8.0.1698 +Problem: Coverage statistics don't work on coveralls. +Solution: Use curly braces for $SRCDIR. +Files: .travis.yml + +Patch 8.0.1699 +Problem: Leftover stuff for Python 1.4. +Solution: Remove outdated Python 1.4 stuff. (Naoki Inada, closes #2794) +Files: src/Makefile, src/config.aap.in, src/config.mk.in, + src/configure.ac, src/auto/configure + +Patch 8.0.1700 +Problem: Coverage statistics still don't work on coveralls. +Solution: Exclude the xxd directory again. +Files: .travis.yml + +Patch 8.0.1701 +Problem: Can disable COLOR_EMOJI with MSVC but not MinGW. +Solution: Add COLOR_EMOJI flag. Also add some empty lines for readability. +Files: src/Make_cyg_ming.mak + +Patch 8.0.1702 +Problem: Leaking memory when autocommands make a quickfix list invalid. +Solution: Call FreeWild(). (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1703 +Problem: In the tutor 'showcmd' is not set. +Solution: Set 'showcmd' in the vimtutor script. (Ken Takata, closes #2792) +Files: src/vimtutor + +Patch 8.0.1704 +Problem: 'backupskip' default doesn't work for Mac. +Solution: Use "/private/tmp". (Rainer Müller, closes #2793) +Files: src/option.c, src/testdir/test_options.vim, + runtime/doc/options.txt + +Patch 8.0.1705 +Problem: When making a vertical split the mode message isn't always + updated, "VISUAL" remains. (Alexei Averchenko) +Solution: Only reset clear_cmdline when filling all columns of the last + screen line. (Tom M. closes #2611) +Files: src/screen.c, src/testdir/test_window_cmd.vim + +Patch 8.0.1706 +Problem: Cannot send CTRL-\ to a terminal window. +Solution: Make CTRL-W CTRL-\ send CTRL-\ to a terminal window. +Files: src/terminal.c, runtime/doc/terminal.txt + +Patch 8.0.1707 +Problem: When 'wfh' is set ":bel 10new" scrolls window. (Andrew Pyatkov) +Solution: Set the fraction before changing the window height. (closes #2798) +Files: src/window.c + +Patch 8.0.1708 +Problem: Mkdir with 'p' flag fails on existing directory, which is + different from the mkdir shell command. +Solution: Don't fail if the directory already exists. (James McCoy, + closes #2775) +Files: src/evalfunc.c, src/testdir/test_eval_stuff.vim, + runtime/doc/eval.txt + +Patch 8.0.1709 +Problem: Some non-C89 code may slip through. +Solution: Enforce C89 in configure. Fix detected problems. (James McCoy, + closes #2735) +Files: src/channel.c, src/configure.ac, src/auto/configure, + src/gui_gtk_x11.c, src/if_python3.c + +Patch 8.0.1710 +Problem: Building with Ruby fails. +Solution: Don't add -ansi when building with Ruby. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1711 +Problem: Term_setsize() is not implemented yet. +Solution: Implement it. +Files: src/evalfunc.c, src/terminal.c, src/proto/terminal.pro, + src/testdir/test_terminal.vim, runtime/doc/eval.txt + +Patch 8.0.1712 +Problem: Terminal scrollback is not limited. +Solution: Add the 'terminalscroll' option. +Files: src/terminal.c, src/option.h, src/option.c, + runtime/doc/options.txt, runtime/doc/terminal.txt + +Patch 8.0.1713 +Problem: Terminal debugger doesn't handle arguments. +Solution: Use <f-args> and pass all the arguments to gdb, e.g. the core file + or process number. (suggested by Christian Brabandt) Disallow + starting the debugger twice. +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1714 +Problem: Term_setsize() does not give an error in a normal buffer. +Solution: Add an error message. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1715 +Problem: Terminal buffer can be 1 more than 'terminalscroll' lines. +Solution: Change > to >=. +Files: src/terminal.c + +Patch 8.0.1716 +Problem: Test for term_setsize() does not give a good error message. +Solution: use assert_inrange(). +Files: src/testdir/test_terminal.vim + +Patch 8.0.1717 +Problem: C89 check causes too much trouble. +Solution: Remove enforcing C89 for now. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1718 +Problem: Terminal scrollback test fails on MS-Windows. +Solution: Check for the last line of output anticipating there might be an + empty line below it. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1719 +Problem: Cannot specify which Python executable configure should use. +Solution: Add --with-python-command and --with-python3-command. +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1720 +Problem: When a timer is running a terminal window may not close after a + shell has exited. +Solution: Call job_status() more often. +Files: src/terminal.c + +Patch 8.0.1721 +Problem: No test for using the 'termsize' option. +Solution: Add a test. +Files: src/testdir/screendump.vim, src/testdir/test_terminal.vim + +Patch 8.0.1722 +Problem: Cannot specify a minimal size for a terminal window. +Solution: Support the "rows*cols" format for 'winsize'. +Files: src/terminal.c, src/testdir/test_terminal.vim, src/option.c, + runtime/doc/options.txt + +Patch 8.0.1723 +Problem: Using one item array size declaration is misleading. +Solution: Instead of using "[1]" and actually using a larger array, use + "[]". This is to verify that this C99 feature works for all + compilers. +Files: src/structs.h, src/getchar.c + +Patch 8.0.1724 +Problem: Declarations cannot be halfway a block. +Solution: Move one declaration to check if this works for all compilers. +Files: src/main.c + +Patch 8.0.1725 +Problem: Terminal debugger doesn't handle command arguments. +Solution: Add the :TermdebugCommand command. Use a ! to execute right away. + (Christian Brabandt) +Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim, + runtime/doc/terminal.txt + +Patch 8.0.1726 (after 8.0.1724) +Problem: Older MSVC doesn't support declarations halfway a block. +Solution: Move the declaration back to the start of the block. +Files: src/main.c + +Patch 8.0.1727 +Problem: qf_get_properties() function is too long. +Solution: Refactor the code. (Yegappan Lakshmanan, closes #2807) +Files: src/quickfix.c + +Patch 8.0.1728 +Problem: Condition always false, useless code. +Solution: Remove the code. (Nikolai Pavlov, closes #2808) +Files: src/message.c + +Patch 8.0.1729 +Problem: No comma after last enum item. +Solution: Add a few commas to check if this works for all compilers. Also + add a few // comments. +Files: src/structs.h + +Patch 8.0.1730 +Problem: No configure check for the used C99 features. +Solution: Add a compilation check. Tentatively document C99 features. +Files: src/configure.ac, src/auto/configure, runtime/doc/develop.txt + +Patch 8.0.1731 +Problem: Characters deleted on completion. (Adrià Farrés) +Solution: Also check the last item for the ORIGINAL_TEXT flag. (Christian + Brabandt, closes #1645) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.1732 +Problem: Crash when terminal API call deletes the buffer. +Solution: Lock the buffer while calling a function. (closes #2813) +Files: src/buffer.c, src/terminal.c, src/testdir/test_terminal.vim, + src/testdir/test_autocmd.vim + +Patch 8.0.1733 +Problem: Incomplete testing for completion fix. (Lifepillar) +Solution: Add a test with CTRL-P. +Files: src/testdir/test_popup.vim + +Patch 8.0.1734 +Problem: Package directory not added to 'rtp' if prefix matches. +Solution: Check the match is a full match. (Ozaki Kiichi, closes #2817) + Also handle different ways of spelling a path. +Files: src/testdir/test_packadd.vim, src/ex_cmds2.c + +Patch 8.0.1735 (after 8.0.1723 and 8.0.1730) +Problem: Flexible array member feature not supported by HP-UX. (John + Marriott) +Solution: Do not use the flexible array member feature of C99. +Files: src/configure.ac, src/auto/configure, src/structs.h, + src/getchar.c, runtime/doc/develop.txt + +Patch 8.0.1736 +Problem: Check for C99 features is incomplete. +Solution: Use AC_PROG_CC_C99 and when C99 isn't fully supported check the + features we need. (James McCoy, closes #2820) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1737 +Problem: fchown() used when it is not supported. +Solution: Add #ifdef. +Files: src/fileio.c + +Patch 8.0.1738 +Problem: ":args" output is hard to read. +Solution: Make columns with the names if the output is more than one line. +Files: src/ex_cmds2.c, src/version.c, src/proto/version.pro, + src/testdir/test_arglist.vim + +Patch 8.0.1739 +Problem: MS-Windows with msys2 cannot build Ruby statically. +Solution: Define RUBY_VERSION. (Gray Wolf, closes #2826) +Files: src/Make_cyg_ming.mak + +Patch 8.0.1740 +Problem: Warning for signed-unsigned incompatibility. +Solution: Change type from "char *" to "char_u *". (John Marriott) +Files: src/ex_cmds2.c + +Patch 8.0.1741 +Problem: MS-Windows with msys2 cannot build Ruby statically. +Solution: Add RUBY_VERSION to CFLAGS later. (Gray Wolf, closes #2833) +Files: src/Make_cyg_ming.mak + +Patch 8.0.1742 +Problem: Cannot get a list of all the jobs. Cannot get the command of + the job. +Solution: When job_info() is called without an argument return a list of + jobs. Otherwise, include the command that the job is running. + (Yegappan Lakshmanan) +Files: runtime/doc/eval.txt, src/channel.c, src/evalfunc.c, + src/proto/channel.pro, src/structs.h, src/testdir/test_channel.vim + +Patch 8.0.1743 +Problem: Terminal window options are named inconsistently. +Solution: prefix terminal window options with "termwin". Keep the old names + for now as an alias. +Files: src/option.c, src/option.h, src/structs.h, src/terminal.c, + src/testdir/test_terminal.vim, src/testdir/gen_opt_test.vim, + runtime/doc/options.txt, runtime/doc/quickref.txt, + runtime/doc/terminal.txt, runtime/optwin.vim + +Patch 8.0.1744 +Problem: On some systems /dev/stdout isn't writable. +Solution: Skip test if writing is not possible. (James McCoy, closes #2830) +Files: src/testdir/test_writefile.vim + +Patch 8.0.1745 +Problem: Build failure on MS-Windows. +Solution: Build job arguments for MS-Windows. Fix allocating job twice. +Files: src/structs.h, src/channel.c, src/os_unix.c, src/misc2.c, + src/terminal.c, src/proto/misc2.pro + +Patch 8.0.1746 +Problem: MS-Windows: channel tests fail. +Solution: Make a copy of the command before splitting it. +Files: src/channel.c + +Patch 8.0.1747 +Problem: MS-Windows: term_start() does not set job_info() cmd. +Solution: Share the code from job_start() to set jv_argv. +Files: src/testdir/test_terminal.vim, src/channel.c, src/misc2.c, + src/proto/misc2.pro, src/terminal.c + +Patch 8.0.1748 +Problem: CmdlineEnter command uses backslash instead of slash. +Solution: Don't treat the character as a file name. (closes #2837) +Files: src/fileio.c, src/testdir/test_autocmd.vim + +Patch 8.0.1749 +Problem: VMS: 100% CPU use, redefining mch_open() and mch_fopen() fails. +Solution: Do not wait indefinitely in RealWaitForChar(). (Neil Rieck) + Do not redefine mch_open() and mch_fopen() on VMS. (Zoltan + Arpadffy) +Files: src/os_vms.c, src/vim.h + +Patch 8.0.1750 +Problem: Crash when clearing location list in autocommand. +Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1751 +Problem: #ifdef causes bad highlighting. +Solution: Move code around. (Ozaki Kiichi, closes #2731) +Files: src/ui.c + +Patch 8.0.1752 +Problem: qf_set_properties() is to long. +Solution: Refactor the function. Define INVALID_QFIDX. (Yegappan + Lakshmanan, closes #2812) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1753 +Problem: Various warnings from a static analyser +Solution: Add type casts, remove unneeded conditions. (Christian Brabandt, + closes #2770) +Files: src/evalfunc.c, src/ex_cmds2.c, src/fileio.c, src/getchar.c, + src/normal.c, src/os_unix.c, src/search.c, src/term.c + +Patch 8.0.1754 +Problem: ex_helpgrep() is too long. +Solution: Refactor the function. (Yegappan Lakshmanan, closes #2766) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1755 +Problem: MS-Windows GUI: high unicode char received as two utf-16 words. +Solution: Keep the first word until the second word is received. (Chris + Morgan, closes #2800) +Files: src/gui_w32.c + +Patch 8.0.1756 +Problem: GUI: after prompting for a number the mouse shape is sometimes + wrong. +Solution: Call setmouse() after setting "State". (Hirohito Higashi, + closes #2709) +Files: src/misc1.c + +Patch 8.0.1757 +Problem: Unnecessary changes in libvterm. +Solution: Bring back // comments and trailing comma in enums. +Files: src/libvterm/bin/unterm.c, src/libvterm/bin/vterm-ctrl.c, + src/libvterm/bin/vterm-dump.c, src/libvterm/include/vterm.h, + src/libvterm/include/vterm_keycodes.h, + src/libvterm/src/encoding.c, src/libvterm/src/keyboard.c, + src/libvterm/src/parser.c, src/libvterm/src/pen.c, + src/libvterm/src/screen.c, src/libvterm/src/state.c, + src/libvterm/src/unicode.c, src/libvterm/src/utf8.h, + src/libvterm/src/vterm.c, src/libvterm/src/vterm_internal.h + +Patch 8.0.1758 +Problem: open_line() returns TRUE/FALSE for success/failure. +Solution: Return OK or FAIL. +Files: src/misc1.c, src/normal.c, src/edit.c + +Patch 8.0.1759 +Problem: Memory leak from duplicate options. (Yegappan Lakshmanan) +Solution: Don't set the default value twice. +Files: src/option.c + +Patch 8.0.1760 +Problem: Wrong number of arguments to vms_read(). +Solution: Drop the first argument. (Ozaki Kiichi) +Files: src/ui.c + +Patch 8.0.1761 +Problem: Job in terminal window with no output channel is killed. +Solution: Keep the job running when the input is a tty. (Ozaki Kiichi, + closes #2734) +Files: src/channel.c, src/os_unix.c, src/testdir/test_channel.vim + +Patch 8.0.1762 +Problem: Terminal debug logging is a bit complicated. +Solution: Make log_tr() use variable arguments (Ozaki Kiichi, closes #2730) +Files: src/term.c + +Patch 8.0.1763 +Problem: :argedit does not reuse an empty unnamed buffer. +Solution: Add the BLN_CURBUF flag and fix all the side effects. (Christian + Brabandt, closes #2713) +Files: src/buffer.c, src/ex_cmds2.c, src/proto/buffer.pro, + src/testdir/test_arglist.vim, src/testdir/test_command_count.vim + +Patch 8.0.1764 +Problem: Lgtm considers tutor.es to be EcmaScript. +Solution: Add a config file for lgtm. (Bas van Schaik, closes #2844) +Files: .lgtm.yml, Filelist + +Patch 8.0.1765 +Problem: CTRL-G j in Insert mode is incorrect when 'virtualedit' is set. +Solution: Take coladd into account. (Christian Brabandt, closes #2743) +Files: src/charset.c, src/testdir/test_virtualedit.vim + +Patch 8.0.1766 (after 8.0.1758) +Problem: Expanding abbreviation doesn't work. (Tooth Pik) +Solution: Return OK instead of FALSE and FAIL instead of TRUE. (Christian + Brabandt) +Files: src/edit.c, src/testdir/test_mapping.vim + +Patch 8.0.1767 +Problem: With 'incsearch' text may jump up and down. () +Solution: Besides w_botline also save and restore w_empty_rows. + (closes #2530) +Files: src/ex_getln.c, src/testdir/test_search.vim, + src/testdir/dumps/Test_incsearch_scrolling_01.dump + +Patch 8.0.1768 +Problem: SET_NO_HLSEARCH() used in a wrong way. +Solution: Make it a function. (suggested by Dominique Pelle, + closes #2850) +Files: src/vim.h, src/ex_docmd.c, src/proto/ex_docmd.pro, src/search.c, + src/ex_getln.c, src/option.c, src/screen.c, src/tag.c + +Patch 8.0.1769 +Problem: Repeated saving and restoring viewstate for 'incsearch'. +Solution: Use a structure. +Files: src/ex_getln.c + +Patch 8.0.1770 +Problem: Assert functions don't return anything. +Solution: Return non-zero when the assertion fails. +Files: src/evalfunc.c, src/eval.c, src/proto/eval.pro, + src/testdir/test_assert.vim, runtime/doc/eval.txt + +Patch 8.0.1771 +Problem: In tests, when WaitFor() fails it doesn't say why. (James McCoy) +Solution: Add WaitForAssert(), which produces an assert error when it fails. +Files: src/testdir/shared.vim, src/testdir/test_terminal.vim, + src/testdir/screendump.vim, src/testdir/test_autocmd.vim, + src/testdir/test_channel.vim, src/testdir/test_clientserver.vim, + src/testdir/test_job_fails.vim + +Patch 8.0.1772 +Problem: Quickfix: mixup of FALSE and FAIL, returning -1. +Solution: Use FAIL and INVALID_QFIDX. (Yegappan Lakshmanan) +Files: src/quickfix.c + +Patch 8.0.1773 +Problem: Dialog messages are not translated. +Solution: Add N_() and _() where needed. (Sergey Alyoshin) +Files: src/diff.c, src/ex_cmds2.c, src/ex_docmd.c, src/message.c, + src/po/Make_cyg.mak, src/po/Make_ming.mak, src/po/Make_mvc.mak, + src/po/Makefile, src/quickfix.c, src/vim.h + +Patch 8.0.1774 +Problem: Reading very long lines can be slow. +Solution: Read up to 1 Mbyte at a time to avoid a lot of copying. Add a + check for going over the column limit. +Files: src/fileio.c + +Patch 8.0.1775 +Problem: MS-Windows: warning for unused variable. +Solution: Move declaration inside #ifdef. (Mike Williams) +Files: src/channel.c + +Patch 8.0.1776 +Problem: In tests, when WaitFor() fails it doesn't say why. +Solution: Turn a few more WaitFor() into WaitForAssert(). +Files: src/testdir/test_popup.vim, src/testdir/test_quotestar.vim, + src/testdir/test_search.vim, src/testdir/test_terminal.vim, + src/testdir/test_timers.vim + +Patch 8.0.1777 +Problem: Cannot cleanup before loading another colorscheme. +Solution: Add the ColorSchemePre autocommand event. +Files: src/fileio.c, src/syntax.c, src/vim.h, src/testdir/test_gui.vim, + runtime/colors/README.txt + +Patch 8.0.1778 +Problem: Script to check translations does not always work. +Solution: Go to first line before searching for MIME. +Files: src/po/check.vim + +Patch 8.0.1779 +Problem: Deleting in a block selection causes problems. +Solution: Check the length of the line before adding bd.textcol and + bd.textlen. (Christian Brabandt, closes #2825) +Files: src/ops.c, src/testdir/test_blockedit.vim + +Patch 8.0.1780 +Problem: Test fails because Vim in a terminal uses wrong 'encoding'. +Solution: Set encoding in the test where it matters. (James McCoy, + closes #2847) +Files: src/testdir/test_terminal.vim + +Patch 8.0.1781 +Problem: File names in quickfix window are not always shortened. +Solution: Shorten the file name when opening the quickfix window. (Yegappan + Lakshmanan, closes #2851, closes #2846) +Files: src/testdir/test_quickfix.vim, src/fileio.c, src/proto/fileio.pro, + src/quickfix.c + +Patch 8.0.1782 +Problem: No simple way to label quickfix entries. +Solution: Add the "module" item, to be used instead of the file name for + display purposes. (Martin Szamotulski, closes #1757) +Files: runtime/doc/eval.txt, runtime/doc/quickfix.txt, src/alloc.h, + src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1783 +Problem: Cannot use 256 colors in a MS-Windows console. +Solution: Add 256 color support. (Nobuhiro Takasaki, closes #2821) +Files: src/misc1.c, src/option.c, src/os_win32.c, src/proto/os_win32.pro, + src/term.c, src/proto/term.pro, src/terminal.c + +Patch 8.0.1784 (after 8.0.1782) +Problem: Gvim test gets stuck in dialog. +Solution: Rename the file used. +Files: src/testdir/test_quickfix.vim + +Patch 8.0.1785 (after 8.0.1783) +Problem: Missing symbol in Win32 small build. +Solution: Define VTERM_ANSI_INDEX_NONE without the terminal feature. Also + fix unused function with #ifdef. +Files: src/term.c, src/os_win32.c + +Patch 8.0.1786 +Problem: No test for 'termwinkey'. +Solution: Add a test. Make feedkeys() handle terminal_loop() returning + before characters are consumed. +Files: src/testdir/test_terminal.vim, src/terminal.c, src/evalfunc.c, + src/ex_docmd.c, src/getchar.c, src/keymap.h + +Patch 8.0.1787 +Problem: Cannot insert the whole cursor line. +Solution: Make CTRL-R CTRL-L work. (Andy Massimino, closes #2857) +Files: runtime/doc/cmdline.txt, src/ex_getln.c, src/ops.c, + src/testdir/test_cmdline.vim + +Patch 8.0.1788 +Problem: Tool to check a color scheme is not installed. +Solution: Update the install rule. (Christian Brabandt) +Files: src/Makefile + +Patch 8.0.1789 +Problem: BufWinEnter does not work well for a terminal window. +Solution: Do not trigger BufWinEnter when opening a terminal window. +Files: src/terminal.c, runtime/doc/autocmd.txt, + src/testdir/test_terminal.vim + +Patch 8.0.1790 +Problem: 'winfixwidth' is not always respected by :close. +Solution: Prefer a frame without 'winfixwidth' or 'winfixheight'. (Jason + Franklin) +Files: src/window.c, src/testdir/test_winbuf_close.vim + +Patch 8.0.1791 +Problem: Using uint8_t does not work everywhere. +Solution: Use char_u instead. +Files: src/term.c, src/proto/term.pro, src/os_win32.c + +Patch 8.0.1792 +Problem: MS-Windows users expect -? to work like --help. +Solution: Add -?. (Christian Brabandt, closes #2867) +Files: src/main.c + +Patch 8.0.1793 +Problem: No test for "vim -g". +Solution: Add a test for "-g" and "-y". +Files: src/testdir/shared.vim, src/testdir/test_gui.vim + +Patch 8.0.1794 +Problem: Duplicate term options after renaming. +Solution: Remove the old names 'termkey', 'termsize' and 'terminalscroll'. +Files: src/option.c, src/terminal.c, src/option.h, + src/testdir/gen_opt_test.vim, src/testdir/screendump.vim + +Patch 8.0.1795 +Problem: Lose contact with jobs when :gui forks. +Solution: Don't fork when there is a running job. Make log message for a + died job clearer. Also close the terminal when stderr and stdout + are the same FD. +Files: src/gui.h, src/gui.c, src/channel.c, src/proto/channel.pro, + src/os_unix.c, src/terminal.c + +Patch 8.0.1796 +Problem: GUI: click on tab fails when the focus is in a terminal window. +Solution: Handle K_TABLINE. +Files: src/terminal.c + +Patch 8.0.1797 +Problem: Terminal window is redrawn too often and scrolling is repeated. +Solution: Don't scroll immediately but only when redrawing. Avoid redrawing + the whole terminal window on every change. +Files: src/terminal.c, src/screen.c, src/proto/terminal.pro + +Patch 8.0.1798 +Problem: MS-Windows: file considered read-only when another program has + opened it. +Solution: Pass file sharing flag to CreateFile(). (Linwei, closes #2860) +Files: src/os_win32.c + +Patch 8.0.1799 +Problem: No test for :registers command. +Solution: Add a test. (Dominique Pelle, closes #2880) +Files: src/testdir/test_registers.vim + +Patch 8.0.1800 +Problem: X11: getting color is slow. +Solution: Avoid using sprintf() and XParseColor(), put the RGB values in + XColor directly. +Files: src/gui_x11.c + +Patch 8.0.1801 +Problem: MS-Windows: redirecting terminal output does not work. +Solution: Intercept the text written to the terminal and write it to the + file. +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1802 (after 8.0.1802) +Problem: MS-Windows: terminal test fails. +Solution: Close redirected output file earlier. +Files: src/terminal.c + +Patch 8.0.1803 +Problem: Warning for uninitialized variable. (Tony Mechelynck) +Solution: Initialize it. +Files: src/terminal.c + +Patch 8.0.1804 +Problem: Using :normal in terminal window causes problems. (Dominique + Pelle) +Solution: Don't call terminal_loop() for :normal. (closes #2886) +Files: src/ex_docmd.c, src/proto/ex_docmd.pro, src/evalfunc.c + +Patch 8.0.1805 +Problem: qf_parse_line() is too long. +Solution: Split it in parts. Properly handle vim_realloc() failing. + (Yegappan Lakshmanan, closes #2881) +Files: src/quickfix.c + +Patch 8.0.1806 +Problem: InsertCharPre causes problems for autocomplete. (Lifepillar) +Solution: Check for InsertCharPre before calling vpeekc(). (Christian + Brabandt, closes #2876) +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.1807 +Problem: Function to set terminal name is too long. +Solution: Refactor the function. Fix typo in test. +Files: src/term.c, src/testdir/test_options.vim + +Patch 8.0.1808 (after 8.0.1807) +Problem: Can't build without TGETENT. +Solution: Add #ifdef +Files: src/term.c + +Patch 8.0.1809 +Problem: Various typos. +Solution: Correct the mistakes, change "cursur" to "cursor". (closes #2887) +Files: src/edit.c, src/normal.c, src/screen.c, src/proto/screen.pro, + src/ui.c + +Patch 8.0.1810 +Problem: Buffer of a terminal only updated in Terminal-Normal mode. +Solution: Copy the terminal window content to the buffer when in + Terminal-Job mode. +Files: src/terminal.c, src/proto/terminal.pro, src/ex_cmds2.c, + src/proto/ex_cmds2.pro + +Patch 8.0.1811 +Problem: No test for winrestcmd(). +Solution: Add a test. (Dominique Pelle, closes #2894) +Files: src/testdir/test_window_cmd.vim + +Patch 8.0.1812 +Problem: The qf_jump_to_usable_window() function is too long. +Solution: Split it in parts. (Yegappan Lakshmanan, closes #2891) +Files: src/quickfix.c + +Patch 8.0.1813 +Problem: Windows installer doesn't install terminal debugger. +Solution: Add the package to the list of files to install. +Files: nsis/gvim.nsi + +Patch 8.0.1814 +Problem: Crash with terminal window and with 'lazyredraw' set. (Antoine) +Solution: Check the terminal still exists after update_screen(). +Files: src/terminal.c + +Patch 8.0.1815 (after 8.0.1814) +Problem: Still a crash with terminal window and with 'lazyredraw' set. + (Antoine) +Solution: Do not wipe out the buffer when updating the screen. +Files: src/terminal.c, src/proto/terminal.pro, src/screen.c, + src/proto/screen.pro, src/ui.c + +Patch 8.0.1816 +Problem: No test for setcmdpos(). +Solution: Add a test. (Dominique Pelle, closes #2901) +Files: src/testdir/test_cmdline.vim + +Patch 8.0.1817 +Problem: A timer may change v:count unexpectedly. +Solution: Save and restore v:count and similar variables when a timer + callback is invoked. (closes #2897) +Files: src/eval.c, src/proto/eval.pro, src/ex_cmds2.c, src/structs.h, + src/testdir/test_timers.vim + +Patch 8.0.1818 (after 8.0.1810) +Problem: Lines remove from wrong buffer when using terminal window. +Solution: Make sure to use tl_buffer. +Files: src/terminal.c + +Patch 8.0.1819 +Problem: Swap file warning for a file in a non-existing directory, if there + is another with the same file name. (Juergen Weigert) +Solution: When expanding the file name fails compare the file names. +Files: src/testdir/test_swap.vim, src/memline.c + +Patch 8.0.1820 +Problem: Terminal window redirecting stdout does not show stderr. (Matéo + Zanibelli) +Solution: When stdout is not connected to pty_master_fd then use it for + stderr. (closes #2903) +Files: src/os_unix.c, src/testdir/test_terminal.vim + +Patch 8.0.1821 +Problem: Cursor in terminal window moves when pressing CTRL-W. (Dominique + Pelle) +Solution: Do not more the cursor or redraw when not in Terminal-Normal mode. + (closes #2904) +Files: src/terminal.c + +Patch 8.0.1822 +Problem: Make uninstall does not remove colors/tools. +Solution: Add a line to delete the tools directory. (Kazunobu Kuriyama) +Files: src/Makefile + +Patch 8.0.1823 +Problem: Test for terminal stdout redirection is flaky. +Solution: Wait for the job to finish. +Files: src/testdir/test_terminal.vim + +Patch 8.0.1824 +Problem: Coverity warns for variable that may be uninitialized. +Solution: Initialize the variable. +Files: src/terminal.c + +Patch 8.0.1825 +Problem: Might use NULL pointer when out of memory. (Coverity) +Solution: Handle NULL pointer better. +Files: src/getchar.c + +Patch 8.0.1826 +Problem: Configure uses old compiler flag. +Solution: Remove _DARWIN_C_SOURCE. (Kazunobu Kuriyama) +Files: src/configure.ac, src/auto/configure + +Patch 8.0.1827 +Problem: Compiler warning for signed/unsigned char pointers. (Cesar Romani) +Solution: Change the type of jv_argv. +Files: src/channel.c, src/structs.h + +Patch 8.0.1828 +Problem: Get no clue why :gui does not fork. +Solution: Add a channel log message. +Files: src/channel.c + +Patch 8.0.1829 +Problem: MS-Windows: script for vimdiff can't handle ! chars. +Solution: Escape the ! chars. (Hans Ginzel, closes #2896) +Files: src/dosinst.c + +Patch 8.0.1830 +Problem: Switching to Terminal-Normal mode does not redraw. (Dominique + Pelle) +Solution: Also redraw when not updating the snapshot. (closes #2904) +Files: src/terminal.c + +Patch 8.0.1831 +Problem: Sometimes the quickfix title is incorrectly prefixed with ':'. +Solution: Prepend the colon in another way. (Yegappan Lakshmanan, closes + #2905) +Files: src/evalfunc.c, src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.1832 +Problem: Cannot use :unlet for an environment variable. +Solution: Make it work. Use unsetenv() if available. (Yasuhiro Matsumoto, + closes #2855) +Files: runtime/doc/eval.txt, src/config.h.in, src/configure.ac, + src/auto/configure, src/eval.c, src/misc1.c, src/proto/misc1.pro, + src/testdir/test_unlet.vim + +Patch 8.0.1833 +Problem: X11: ":echo 3.14" gives E806. +Solution: set LC_NUMERIC to "C". (Dominique Pelle, closes #2368) +Files: src/gui_x11.c + +Patch 8.0.1834 +Problem: GUI: find/replace dialog does not handle some chars properly. +Solution: Escape '?' when needed. Always escape backslash. (closes #2418, + closes #2435) +Files: src/gui.c + +Patch 8.0.1835 +Problem: Print document name does not support multi-byte. +Solution: Use StartDocW() if needed. (Yasuhiro Matsumoto, closes #2478) +Files: src/os_mswin.c + +Patch 8.0.1836 +Problem: Buffer-local window options may not be recent if the buffer is + still open in another window. +Solution: Copy the options from the window instead of the outdated window + options. (Bjorn Linse, closes #2336) +Files: src/buffer.c, src/testdir/test_options.vim + +Patch 8.0.1837 +Problem: One character cmdline abbreviation not triggered after '<,'>. +Solution: Skip over the special range. (Christian Brabandt, closes #2320) +Files: src/ex_getln.c, src/testdir/test_mapping.vim + +Patch 8.0.1838 +Problem: Cursor in wrong position when switching to Terminal-Normal mode. + (Dominique Pelle) +Solution: Move to the end of the line if coladvance() fails. Do not take a + snapshot a second time. +Files: src/terminal.c + +Patch 8.0.1839 +Problem: Script to check .po file doesn't check for plural header. +Solution: Add a check that the plural header is present when needed. +Files: src/po/check.vim + +Patch 8.0.1840 +Problem: getwinpos() is not tested. +Solution: Add a test. (Dominique Pelle, closes #2911) +Files: src/testdir/test_gui.vim + +Patch 8.0.1841 +Problem: HP-UX does not have setenv(). +Solution: Use vim_setenv(). (John Marriott) +Files: src/misc1.c + +Patch 8.0.1842 +Problem: Popup menu inside terminal window isn't cleared. +Solution: Use NOT_VALID in pum_undisplay(). (suggested by Christian + Brabandt, closes #2908) +Files: src/popupmnu.c + +Patch 8.0.1843 +Problem: Entry for 'wrap' in options window is wrong. (John Little) +Solution: Make the change apply locally. +Files: runtime/optwin.vim + +Patch 8.0.1844 +Problem: Superfluous quickfix code, missing examples. +Solution: Remove unneeded code. Add a few examples. Add a bit more + testing. (Yegappan Lakshmanan, closes #2916) +Files: runtime/doc/quickfix.txt, src/quickfix.c, + src/testdir/test_quickfix.vim + +Patch 8.0.1845 +Problem: Various comment updates needed, missing white space. +Solution: Update comments, add white space. +Files: src/getchar.c, src/testdir/test_cscope.vim, src/gui_mac.c + +Patch 8.0.1846 +Problem: Python interface is incompatible with lldb. +Solution: For OutputType set the base to be PyFile_Type. (Boxu Zhang) + Partly disabled to avoid a crash. +Files: src/if_py_both.h, src/if_python.c, src/if_python3.c + +Patch 8.0.1847 +Problem: Some build options don't have an example. +Solution: Add a couple more examples and compiler flags. +Files: src/Makefile + +Patch 8.0.1848 +Problem: 'termwinscroll' does not work properly. (Dominique Pelle) +Solution: Subtract removed scrollback from the scrollback count. Add a test + for 'termwinscroll'. (closes #2909) +Files: src/terminal.c, src/testdir/test_terminal.vim + +Patch 8.0.1849 +Problem: Compiler warning for unused arguments and missing prototype. +Solution: Add UNUSED. Add static. +Files: src/mbyte.c, src/if_ruby.c + +Patch 8.0.1850 +Problem: Todo items in source code not visible for users. +Solution: Move the todo items to the help file. +Files: src/terminal.c + + + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index aadbf9b419..a395c88779 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -1,4 +1,4 @@ -*vi_diff.txt* For Vim version 7.4. Last change: 2013 Aug 22 +*vi_diff.txt* For Vim version 8.1. Last change: 2016 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -147,7 +147,7 @@ Support for different systems. resource usage, esp. on MS-DOS. For some outdated systems you need to use an older Vim version. -Multi level undo. |undo| +Multi level persistent undo. |undo| 'u' goes backward in time, 'CTRL-R' goes forward again. Set option 'undolevels' to the number of changes to be remembered (default 1000). Set 'undolevels' to 0 for a Vi-compatible one level undo. Set it to @@ -158,6 +158,9 @@ Multi level undo. |undo| create a branch in the undo tree. This means you can go back to any state of the text, there is no risk of a change causing text to be lost forever. |undo-tree| + The undo information is stored in a file when the 'undofile' option is + set. This means you can exit Vim, start Vim on a previously edited + file and undo changes that were made before exiting Vim. Graphical User Interface (GUI). |gui| Included support for GUI: menu's, mouse, scrollbars, etc. You can @@ -212,6 +215,15 @@ Plugins. |add-plugin| right directory. That's an easy way to start using Vim scripts written by others. Plugins can be for all kind of files, or specifically for a filetype. + Packages make this even easier. |packages| + +Asynchronous communication and timers. |channel| |job| |timer| + Vim can exchange messages with other processes in the background. + This makes it possible to have servers do work and send back the + results to Vim. |channel| + Vim can start a job, communicate with it and stop it. |job| + Timers can fire once or repeatedly and invoke a function to do any + work. |timer| Repeat a series of commands. |q| "q{c}" starts recording typed characters into named register {c}. @@ -960,7 +972,7 @@ Only Vim is able to accept options in between and after the file names. In 2005 the POSIX test suite was run to check the compatibility of Vim. Most of the test was executed properly. There are the few things where Vim is not POSIX compliant, even when run in Vi compatibility mode. - + *$VIM_POSIX* Set the $VIM_POSIX environment variable to have 'cpoptions' include the POSIX flags when Vim starts up. This makes Vim run as POSIX as it can. That's a bit different from being Vi compatible. diff --git a/runtime/doc/vim-ja.UTF-8.1 b/runtime/doc/vim-ja.UTF-8.1 index a4788b3c48..5b7798b544 100644 --- a/runtime/doc/vim-ja.UTF-8.1 +++ b/runtime/doc/vim-ja.UTF-8.1 @@ -159,7 +159,7 @@ Note: "+" と "\-c" は合わせて 10 個まで指定できます。 .TP \-b バイナリモード。 -バイナリファイルを編集ためのオプションがいくつか設定されます。 +バイナリファイルを編集するためのオプションがいくつか設定されます。 .TP \-C 互換モード。'compatible' オプションがオンになります。 @@ -280,7 +280,7 @@ N を省略した場合は、引数のファイルを個別のタブページで ぐことができます。 ファイルを保存したい場合は、":w!" のように、Ex コマンドに感嘆符を付けてくだ さい。 -\-R オプションは \-n オプションの効果も含んでいます (下記参照)。 +\-R オプションは \-n オプションの効果も含んでいます (上記参照)。 オプション 'readonly' は ":set noro" でオフにできます。 詳しくは ":help 'readonly'" を参照してください。 .TP diff --git a/runtime/doc/vim.1 b/runtime/doc/vim.1 index 820caa24f5..e3c8773541 100644 --- a/runtime/doc/vim.1 +++ b/runtime/doc/vim.1 @@ -135,7 +135,7 @@ For the first file the cursor will be positioned on line "num". If "num" is missing, the cursor will be positioned on the last line. .TP +/{pat} -For the first file the cursor will be positioned on the +For the first file the cursor will be positioned in the line with the first occurrence of {pat}. See ":help search\-pattern" for the available search patterns. .TP @@ -321,7 +321,7 @@ When N is omitted, open one tab page for each file. \-R Read-only mode. The 'readonly' option will be set. -You can still edit the buffer, but will be prevented from accidently +You can still edit the buffer, but will be prevented from accidentally overwriting a file. If you do want to overwrite a file, add an exclamation mark to the Ex command, as in ":w!". diff --git a/runtime/doc/vim.man b/runtime/doc/vim.man index 5b9b83cb6c..cb0057a1f5 100644 --- a/runtime/doc/vim.man +++ b/runtime/doc/vim.man @@ -1,4 +1,4 @@ -VIM(1) VIM(1) +VIM(1) General Commands Manual VIM(1) @@ -21,13 +21,13 @@ DESCRIPTION to edit all kinds of plain text. It is especially useful for editing programs. - There are a lot of enhancements above Vi: multi level undo, multi win- + There are a lot of enhancements above Vi: multi level undo, multi win‐ dows and buffers, syntax highlighting, command line editing, filename completion, on-line help, visual selection, etc.. See ":help vi_diff.txt" for a summary of the differences between Vim and Vi. While running Vim a lot of help can be obtained from the on-line help - system, with the ":help" command. See the ON-LINE HELP section below. + system, with the ":help" command. See the ON-LINE HELP section below. Most often Vim is started to edit a single file with the command @@ -38,44 +38,44 @@ DESCRIPTION vim [options] [filelist] If the filelist is missing, the editor will start with an empty buffer. - Otherwise exactly one out of the following four may be used to choose + Otherwise exactly one out of the following four may be used to choose one or more files to be edited. - file .. A list of filenames. The first one will be the current - file and read into the buffer. The cursor will be posi- + file .. A list of filenames. The first one will be the current + file and read into the buffer. The cursor will be posi‐ tioned on the first line of the buffer. You can get to the - other files with the ":next" command. To edit a file that + other files with the ":next" command. To edit a file that starts with a dash, precede the filelist with "--". - - The file to edit is read from stdin. Commands are read + - The file to edit is read from stdin. Commands are read from stderr, which should be a tty. -t {tag} The file to edit and the initial cursor position depends on - a "tag", a sort of goto label. {tag} is looked up in the + a "tag", a sort of goto label. {tag} is looked up in the tags file, the associated file becomes the current file and - the associated command is executed. Mostly this is used - for C programs, in which case {tag} could be a function + the associated command is executed. Mostly this is used + for C programs, in which case {tag} could be a function name. The effect is that the file containing that function - becomes the current file and the cursor is positioned on + becomes the current file and the cursor is positioned on the start of the function. See ":help tag-commands". -q [errorfile] - Start in quickFix mode. The file [errorfile] is read and - the first error is displayed. If [errorfile] is omitted, + Start in quickFix mode. The file [errorfile] is read and + the first error is displayed. If [errorfile] is omitted, the filename is obtained from the 'errorfile' option - (defaults to "AztecC.Err" for the Amiga, "errors.err" on - other systems). Further errors can be jumped to with the + (defaults to "AztecC.Err" for the Amiga, "errors.err" on + other systems). Further errors can be jumped to with the ":cn" command. See ":help quickfix". - Vim behaves differently, depending on the name of the command (the exe- + Vim behaves differently, depending on the name of the command (the exe‐ cutable may still be the same file). vim The "normal" way, everything is default. - ex Start in Ex mode. Go to Normal mode with the ":vi" command. + ex Start in Ex mode. Go to Normal mode with the ":vi" command. Can also be done with the "-e" argument. - view Start in read-only mode. You will be protected from writing + view Start in read-only mode. You will be protected from writing the files. Can also be done with the "-R" argument. gvim gview @@ -87,102 +87,102 @@ DESCRIPTION be done with the "-y" argument. rvim rview rgvim rgview - Like the above, but with restrictions. It will not be possi- - ble to start shell commands, or suspend Vim. Can also be + Like the above, but with restrictions. It will not be possi‐ + ble to start shell commands, or suspend Vim. Can also be done with the "-Z" argument. OPTIONS - The options may be given in any order, before or after filenames. + The options may be given in any order, before or after filenames. Options without an argument can be combined after a single dash. - +[num] For the first file the cursor will be positioned on line - "num". If "num" is missing, the cursor will be positioned + +[num] For the first file the cursor will be positioned on line + "num". If "num" is missing, the cursor will be positioned on the last line. - +/{pat} For the first file the cursor will be positioned on the - first occurrence of {pat}. See ":help search-pattern" for - the available search patterns. + +/{pat} For the first file the cursor will be positioned in the + line with the first occurrence of {pat}. See ":help + search-pattern" for the available search patterns. +{command} -c {command} - {command} will be executed after the first file has been - read. {command} is interpreted as an Ex command. If the - {command} contains spaces it must be enclosed in double - quotes (this depends on the shell that is used). Example: + {command} will be executed after the first file has been + read. {command} is interpreted as an Ex command. If the + {command} contains spaces it must be enclosed in double + quotes (this depends on the shell that is used). Example: Vim "+set si" main.c Note: You can use up to 10 "+" or "-c" commands. - -S {file} {file} will be sourced after the first file has been read. - This is equivalent to -c "source {file}". {file} cannot + -S {file} {file} will be sourced after the first file has been read. + This is equivalent to -c "source {file}". {file} cannot start with '-'. If {file} is omitted "Session.vim" is used (only works when -S is the last argument). --cmd {command} - Like using "-c", but the command is executed just before - processing any vimrc file. You can use up to 10 of these + Like using "-c", but the command is executed just before + processing any vimrc file. You can use up to 10 of these commands, independently from "-c" commands. - -A If Vim has been compiled with ARABIC support for editing - right-to-left oriented files and Arabic keyboard mapping, - this option starts Vim in Arabic mode, i.e. 'arabic' is + -A If Vim has been compiled with ARABIC support for editing + right-to-left oriented files and Arabic keyboard mapping, + this option starts Vim in Arabic mode, i.e. 'arabic' is set. Otherwise an error message is given and Vim aborts. - -b Binary mode. A few options will be set that makes it pos- + -b Binary mode. A few options will be set that makes it pos‐ sible to edit a binary or executable file. - -C Compatible. Set the 'compatible' option. This will make - Vim behave mostly like Vi, even though a .vimrc file + -C Compatible. Set the 'compatible' option. This will make + Vim behave mostly like Vi, even though a .vimrc file exists. - -d Start in diff mode. There should be two, three or four - file name arguments. Vim will open all the files and show + -d Start in diff mode. There should be two, three or four + file name arguments. Vim will open all the files and show differences between them. Works like vimdiff(1). - -d {device} Open {device} for use as a terminal. Only on the Amiga. + -d {device} Open {device} for use as a terminal. Only on the Amiga. Example: "-d con:20/30/600/150". - -D Debugging. Go to debugging mode when executing the first + -D Debugging. Go to debugging mode when executing the first command from a script. - -e Start Vim in Ex mode, just like the executable was called + -e Start Vim in Ex mode, just like the executable was called "ex". -E Start Vim in improved Ex mode, just like the executable was called "exim". - -f Foreground. For the GUI version, Vim will not fork and + -f Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in. On the Amiga, Vim - is not restarted to open a new window. This option should - be used when Vim is executed by a program that will wait - for the edit session to finish (e.g. mail). On the Amiga + is not restarted to open a new window. This option should + be used when Vim is executed by a program that will wait + for the edit session to finish (e.g. mail). On the Amiga the ":sh" and ":!" commands will not work. - --nofork Foreground. For the GUI version, Vim will not fork and + --nofork Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in. - -F If Vim has been compiled with FKMAP support for editing - right-to-left oriented files and Farsi keyboard mapping, - this option starts Vim in Farsi mode, i.e. 'fkmap' and - 'rightleft' are set. Otherwise an error message is given + -F If Vim has been compiled with FKMAP support for editing + right-to-left oriented files and Farsi keyboard mapping, + this option starts Vim in Farsi mode, i.e. 'fkmap' and + 'rightleft' are set. Otherwise an error message is given and Vim aborts. - -g If Vim has been compiled with GUI support, this option - enables the GUI. If no GUI support was compiled in, an + -g If Vim has been compiled with GUI support, this option + enables the GUI. If no GUI support was compiled in, an error message is given and Vim aborts. - -h Give a bit of help about the command line arguments and + -h Give a bit of help about the command line arguments and options. After this Vim exits. -H If Vim has been compiled with RIGHTLEFT support for editing - right-to-left oriented files and Hebrew keyboard mapping, - this option starts Vim in Hebrew mode, i.e. 'hkmap' and - 'rightleft' are set. Otherwise an error message is given + right-to-left oriented files and Hebrew keyboard mapping, + this option starts Vim in Hebrew mode, i.e. 'hkmap' and + 'rightleft' are set. Otherwise an error message is given and Vim aborts. -i {viminfo} - When using the viminfo file is enabled, this option sets - the filename to use, instead of the default "~/.viminfo". + When using the viminfo file is enabled, this option sets + the filename to use, instead of the default "~/.viminfo". This can also be used to skip the use of the .viminfo file, by giving the name "NONE". @@ -190,92 +190,92 @@ OPTIONS -l Lisp mode. Sets the 'lisp' and 'showmatch' options on. - -m Modifying files is disabled. Resets the 'write' option. - You can still modify the buffer, but writing a file is not + -m Modifying files is disabled. Resets the 'write' option. + You can still modify the buffer, but writing a file is not possible. - -M Modifications not allowed. The 'modifiable' and 'write' - options will be unset, so that changes are not allowed and - files can not be written. Note that these options can be + -M Modifications not allowed. The 'modifiable' and 'write' + options will be unset, so that changes are not allowed and + files can not be written. Note that these options can be set to enable making modifications. - -N No-compatible mode. Reset the 'compatible' option. This - will make Vim behave a bit better, but less Vi compatible, + -N No-compatible mode. Reset the 'compatible' option. This + will make Vim behave a bit better, but less Vi compatible, even though a .vimrc file does not exist. - -n No swap file will be used. Recovery after a crash will be - impossible. Handy if you want to edit a file on a very - slow medium (e.g. floppy). Can also be done with ":set + -n No swap file will be used. Recovery after a crash will be + impossible. Handy if you want to edit a file on a very + slow medium (e.g. floppy). Can also be done with ":set uc=0". Can be undone with ":set uc=200". - -nb Become an editor server for NetBeans. See the docs for + -nb Become an editor server for NetBeans. See the docs for details. -o[N] Open N windows stacked. When N is omitted, open one window for each file. - -O[N] Open N windows side by side. When N is omitted, open one + -O[N] Open N windows side by side. When N is omitted, open one window for each file. -p[N] Open N tab pages. When N is omitted, open one tab page for each file. - -R Read-only mode. The 'readonly' option will be set. You - can still edit the buffer, but will be prevented from acci- - dently overwriting a file. If you do want to overwrite a - file, add an exclamation mark to the Ex command, as in - ":w!". The -R option also implies the -n option (see - below). The 'readonly' option can be reset with ":set + -R Read-only mode. The 'readonly' option will be set. You + can still edit the buffer, but will be prevented from acci‐ + dentally overwriting a file. If you do want to overwrite a + file, add an exclamation mark to the Ex command, as in + ":w!". The -R option also implies the -n option (see + below). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'". - -r List swap files, with information about using them for + -r List swap files, with information about using them for recovery. - -r {file} Recovery mode. The swap file is used to recover a crashed - editing session. The swap file is a file with the same + -r {file} Recovery mode. The swap file is used to recover a crashed + editing session. The swap file is a file with the same filename as the text file with ".swp" appended. See ":help recovery". - -s Silent mode. Only when started as "Ex" or when the "-e" + -s Silent mode. Only when started as "Ex" or when the "-e" option was given before the "-s" option. -s {scriptin} - The script file {scriptin} is read. The characters in the - file are interpreted as if you had typed them. The same + The script file {scriptin} is read. The characters in the + file are interpreted as if you had typed them. The same can be done with the command ":source! {scriptin}". If the end of the file is reached before the editor exits, further characters are read from the keyboard. -T {terminal} - Tells Vim the name of the terminal you are using. Only - required when the automatic way doesn't work. Should be a - terminal known to Vim (builtin) or defined in the termcap + Tells Vim the name of the terminal you are using. Only + required when the automatic way doesn't work. Should be a + terminal known to Vim (builtin) or defined in the termcap or terminfo file. - -u {vimrc} Use the commands in the file {vimrc} for initializations. - All the other initializations are skipped. Use this to - edit a special kind of files. It can also be used to skip - all initializations by giving the name "NONE". See ":help + -u {vimrc} Use the commands in the file {vimrc} for initializations. + All the other initializations are skipped. Use this to + edit a special kind of files. It can also be used to skip + all initializations by giving the name "NONE". See ":help initialization" within vim for more details. - -U {gvimrc} Use the commands in the file {gvimrc} for GUI initializa- - tions. All the other GUI initializations are skipped. It - can also be used to skip all GUI initializations by giving - the name "NONE". See ":help gui-init" within vim for more + -U {gvimrc} Use the commands in the file {gvimrc} for GUI initializa‐ + tions. All the other GUI initializations are skipped. It + can also be used to skip all GUI initializations by giving + the name "NONE". See ":help gui-init" within vim for more details. - -V[N] Verbose. Give messages about which files are sourced and - for reading and writing a viminfo file. The optional num- + -V[N] Verbose. Give messages about which files are sourced and + for reading and writing a viminfo file. The optional num‐ ber N is the value for 'verbose'. Default is 10. - -v Start Vim in Vi mode, just like the executable was called - "vi". This only has effect when the executable is called + -v Start Vim in Vi mode, just like the executable was called + "vi". This only has effect when the executable is called "ex". -w {scriptout} - All the characters that you type are recorded in the file - {scriptout}, until you exit Vim. This is useful if you - want to create a script file to be used with "vim -s" or + All the characters that you type are recorded in the file + {scriptout}, until you exit Vim. This is useful if you + want to create a script file to be used with "vim -s" or ":source!". If the {scriptout} file exists, characters are appended. @@ -285,27 +285,27 @@ OPTIONS -x Use encryption when writing files. Will prompt for a crypt key. - -X Don't connect to the X server. Shortens startup time in a - terminal, but the window title and clipboard will not be + -X Don't connect to the X server. Shortens startup time in a + terminal, but the window title and clipboard will not be used. -y Start Vim in easy mode, just like the executable was called - "evim" or "eview". Makes Vim behave like a click-and-type + "evim" or "eview". Makes Vim behave like a click-and-type editor. - -Z Restricted mode. Works like the executable starts with + -Z Restricted mode. Works like the executable starts with "r". - -- Denotes the end of the options. Arguments after this will - be handled as a file name. This can be used to edit a + -- Denotes the end of the options. Arguments after this will + be handled as a file name. This can be used to edit a filename that starts with a '-'. --echo-wid GTK GUI only: Echo the Window ID on stdout. --help Give a help message and exit, just like "-h". - --literal Take file name arguments literally, do not expand wild- - cards. This has no effect on Unix where the shell expands + --literal Take file name arguments literally, do not expand wild‐ + cards. This has no effect on Unix where the shell expands wildcards. --noplugin Skip loading plugins. Implied by -u NONE. @@ -315,18 +315,18 @@ OPTIONS is given and the files are edited in the current Vim. --remote-expr {expr} - Connect to a Vim server, evaluate {expr} in it and print + Connect to a Vim server, evaluate {expr} in it and print the result on stdout. --remote-send {keys} Connect to a Vim server and send {keys} to it. --remote-silent - As --remote, but without the warning when no server is + As --remote, but without the warning when no server is found. --remote-wait - As --remote, but Vim does not exit until the files have + As --remote, but Vim does not exit until the files have been edited. --remote-wait-silent @@ -337,31 +337,31 @@ OPTIONS List the names of all Vim servers that can be found. --servername {name} - Use {name} as the server name. Used for the current Vim, + Use {name} as the server name. Used for the current Vim, unless used with a --remote argument, then it's the name of the server to connect to. --socketid {id} - GTK GUI only: Use the GtkPlug mechanism to run gvim in + GTK GUI only: Use the GtkPlug mechanism to run gvim in another window. --version Print version information and exit. ON-LINE HELP - Type ":help" in Vim to get started. Type ":help subject" to get help - on a specific subject. For example: ":help ZZ" to get help for the - "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmd- - line-completion"). Tags are present to jump from one place to another + Type ":help" in Vim to get started. Type ":help subject" to get help + on a specific subject. For example: ":help ZZ" to get help for the + "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmd‐ + line-completion"). Tags are present to jump from one place to another (sort of hypertext links, see ":help"). All documentation files can be viewed in this way, for example ":help syntax.txt". FILES /usr/local/lib/vim/doc/*.txt - The Vim documentation files. Use ":help doc-file-list" + The Vim documentation files. Use ":help doc-file-list" to get the complete list. /usr/local/lib/vim/doc/tags - The tags file used for finding information in the docu- + The tags file used for finding information in the docu‐ mentation files. /usr/local/lib/vim/syntax/syntax.vim @@ -381,7 +381,7 @@ FILES ~/.gvimrc Your personal gvim initializations. /usr/local/lib/vim/optwin.vim - Script used for the ":options" command, a nice way to + Script used for the ":options" command, a nice way to view and set options. /usr/local/lib/vim/menu.vim @@ -391,11 +391,11 @@ FILES Script to generate a bug report. See ":help bugs". /usr/local/lib/vim/filetype.vim - Script to detect the type of a file by its name. See + Script to detect the type of a file by its name. See ":help 'filetype'". /usr/local/lib/vim/scripts.vim - Script to detect the type of a file by its contents. + Script to detect the type of a file by its contents. See ":help 'filetype'". /usr/local/lib/vim/print/*.ps @@ -410,8 +410,8 @@ SEE ALSO AUTHOR Most of Vim was made by Bram Moolenaar, with a lot of help from others. See ":help credits" in Vim. - Vim is based on Stevie, worked on by: Tim Thompson, Tony Andrews and - G.R. (Fred) Walter. Although hardly any of the original code remains. + Vim is based on Stevie, worked on by: Tim Thompson, Tony Andrews and + G.R. (Fred) Walter. Although hardly any of the original code remains. BUGS Probably. See ":help todo" for a list of known problems. diff --git a/runtime/doc/vim2html.pl b/runtime/doc/vim2html.pl old mode 100644 new mode 100755 diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index fe47e996aa..5e15b3b962 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -1,4 +1,4 @@ -*visual.txt* For Vim version 7.4. Last change: 2014 Mar 23 +*visual.txt* For Vim version 8.1. Last change: 2017 Sep 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -314,8 +314,8 @@ Visual-block Insert *v_b_I* With a blockwise selection, I{string}<ESC> will insert {string} at the start of block on every line of the block, provided that the line extends into the block. Thus lines that are short will remain unmodified. TABs are split to -retain visual columns. -See |v_b_I_example|. +retain visual columns. Works only for adding text to a line, not for +deletions. See |v_b_I_example|. Visual-block Append *v_b_A* With a blockwise selection, A{string}<ESC> will append {string} to the end of @@ -331,6 +331,7 @@ See |v_b_A_example|. Note: "I" and "A" behave differently for lines that don't extend into the selected block. This was done intentionally, so that you can do it the way you want. +Works only for adding text to a line, not for deletions. Visual-block change *v_b_c* All selected text in the block will be replaced by the same text string. When diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 4ba28a3c08..e88cfcb935 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*windows.txt* For Vim version 8.1. Last change: 2018 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -75,6 +75,16 @@ places where a Normal mode command can't be used or is inconvenient. The main Vim window can hold several split windows. There are also tab pages |tab-page|, each of which can hold multiple windows. + *window-ID* *winid* *windowid* +Each window has a unique identifier called the window ID. This identifier +will not change within a Vim session. The |win_getid()| and |win_id2tabwin()| +functions can be used to convert between the window/tab number and the +identifier. There is also the window number, which may change whenever +windows are opened or closed, see |winnr()|. + +Each buffer has a unique number and the number will not change within a Vim +session. The |bufnr()| and |bufname()| functions can be used to convert +between a buffer name and the buffer number. ============================================================================== 2. Starting Vim *windows-starting* @@ -212,6 +222,11 @@ CTRL-W ^ Does ":split #", split window in two and edit alternate file. When a count is given, it becomes ":split #N", split window and edit buffer N. + *CTRL-W_:* +CTRL-W : Does the same as typing |:| : edit a command line. Useful in a + terminal window, where all Vim commands must be preceded with + CTRL-W or 'termkey'. + Note that the 'splitbelow' and 'splitright' options influence where a new window will appear. @@ -245,7 +260,7 @@ window will appear. far left and occupies the full height of the Vim window. Doesn't work for |:execute| and |:normal|. - *:botright* + *:bo* *:botright* :bo[tright] {cmd} Execute {cmd}. If it contains a command that splits a window, it will appear at the bottom and occupy the full width of the @@ -263,28 +278,57 @@ left of the Vim window. Closing a window ---------------- +:q[uit] +:{count}q[uit] CTRL-W q *CTRL-W_q* CTRL-W CTRL-Q *CTRL-W_CTRL-Q* -:q[uit] Quit current window. When quitting the last window (not - counting a help window), exit Vim. - When 'hidden' is set, and there is only one window for the - current buffer, it becomes hidden. - When 'hidden' is not set, and there is only one window for the - current buffer, and the buffer was changed, the command fails. - (Note: CTRL-Q does not work on all terminals) - -:q[uit]! Quit current window. If this was the last window for a buffer, - any changes to that buffer are lost. When quitting the last - window (not counting help windows), exit Vim. The contents of - the buffer are lost, even when 'hidden' is set. + Without {count}: Quit the current window. If {count} is + given quit the {count} window. + When quitting the last window (not counting a help window), + exit Vim. + + When 'hidden' is set, and there is only one window for the + current buffer, it becomes hidden. When 'hidden' is not set, + and there is only one window for the current buffer, and the + buffer was changed, the command fails. + + (Note: CTRL-Q does not work on all terminals). + + If [count] is greater than the last window number the last + window will be closed: > + :1quit " quit the first window + :$quit " quit the last window + :9quit " quit the last window + " if there are fewer than 9 windows opened + :-quit " quit the previous window + :+quit " quit the next window + :+2quit " quit the second next window +< +:q[uit]! +:{count}q[uit]! + Without {count}: Quit the current window. If {count} is + given quit the {count} window. + + If this was the last window for a buffer, any changes to that + buffer are lost. When quitting the last window (not counting + help windows), exit Vim. The contents of the buffer are lost, + even when 'hidden' is set. + +:clo[se][!] +:{count}clo[se][!] CTRL-W c *CTRL-W_c* *:clo* *:close* -:clo[se][!] Close current window. When the 'hidden' option is set, or - when the buffer was changed and the [!] is used, the buffer - becomes hidden (unless there is another window editing it). + Without {count}: Close the current window. If {count} is + given close the {count} window. + + When the 'hidden' option is set, or when the buffer was + changed and the [!] is used, the buffer becomes hidden (unless + there is another window editing it). + When there is only one window in the current tab page and there is another tab page, this closes the current tab page. |tab-page|. + This command fails when: *E444* - There is only one window on the screen. - When 'hidden' is not set, [!] is not used, the buffer has @@ -298,14 +342,20 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* command. *:hide* -:hid[e] Quit current window, unless it is the last window on the - screen. The buffer becomes hidden (unless there is another - window editing it or 'bufhidden' is "unload" or "delete"). +:hid[e] +:{count}hid[e] + Without {count}: Quit the current window, unless it is the + last window on the screen. + If {count} is given quit the {count} window. + + The buffer becomes hidden (unless there is another window + editing it or 'bufhidden' is "unload", "delete" or "wipe"). If the window is the last one in the current tab page the tab - page is closed. |tab-page| - The value of 'hidden' is irrelevant for this command. - Changes to the buffer are not written and won't get lost, so - this is a "safe" command. + page is closed. |tab-page| + + The value of 'hidden' is irrelevant for this command. Changes + to the buffer are not written and won't get lost, so this is a + "safe" command. :hid[e] {cmd} Execute {cmd} with 'hidden' is set. The previous value of 'hidden' is restored after {cmd} has been executed. @@ -314,12 +364,16 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* < This will edit "Makefile", and hide the current buffer if it has any changes. +:on[ly][!] +:{count}on[ly][!] CTRL-W o *CTRL-W_o* *E445* CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only* -:on[ly][!] Make the current window the only one on the screen. All other - windows are closed. + Make the current window the only one on the screen. All other + windows are closed. For {count} see |:quit| command. + When the 'hidden' option is set, all buffers in closed windows become hidden. + When 'hidden' is not set, and the 'autowrite' option is set, modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is @@ -565,7 +619,8 @@ The minimal height and width of a window is set with 'winminheight' and 41. :buffers list of buffers The meaning of [N] depends on the command: - [N] is number of buffers to go forward/backward on ?2, ?3, and ?4 + [N] is the number of buffers to go forward/backward on 2/12/22/32, + 3/13/23/33, and 4/14/24/34 [N] is an argument number, defaulting to current argument, for 1 and 21 [N] is a buffer number, defaulting to current buffer, for 11 and 31 [N] is a count for 19 and 39 @@ -648,20 +703,22 @@ can also get to them with the buffer list commands, like ":bnext". - If the file is not open in a window edit the file in the current window. If the current buffer can't be |abandon|ed, the window is split first. + - Windows that are not in the argument list or are not full + width will be closed if possible. The |argument-list| is set, like with the |:next| command. The purpose of this command is that it can be used from a program that wants Vim to edit another file, e.g., a debugger. When using the |:tab| modifier each argument is opened in a tab page. The last window is used if it's empty. Also see |++opt| and |+cmd|. - {only available when compiled with a GUI} ============================================================================== 8. Do a command in all buffers or windows *list-repeat* *:windo* -:windo {cmd} Execute {cmd} in each window. - It works like doing this: > +:[range]windo {cmd} Execute {cmd} in each window or if [range] is given + only in windows for which the window number lies in + the [range]. It works like doing this: > CTRL-W t :{cmd} CTRL-W w @@ -674,13 +731,15 @@ can also get to them with the buffer list commands, like ":bnext". the current window. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close windows or reorder them. - {not in Vi} {not available when compiled without the - |+listcmds| feature} - Also see |:tabdo|, |:argdo| and |:bufdo|. + {not in Vi} + Also see |:tabdo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| *:bufdo* -:bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list. - It works like doing this: > +:[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if + [range] is given only for buffers for which their + buffer number is in the [range]. It works like doing + this: > :bfirst :{cmd} :bnext @@ -700,9 +759,9 @@ can also get to them with the buffer list commands, like ":bnext". autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - {not in Vi} {not available when compiled without the - |+listcmds| feature} - Also see |:tabdo|, |:argdo| and |:windo|. + {not in Vi} + Also see |:tabdo|, |:argdo|, |:windo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Examples: > @@ -726,18 +785,21 @@ the buffer. The result is that all buffers will use the 'encoding' encoding CTRL-W ] *CTRL-W_]* *CTRL-W_CTRL-]* CTRL-W CTRL-] Split current window in two. Use identifier under cursor as a - tag and jump to it in the new upper window. Make new window N - high. + tag and jump to it in the new upper window. + In Visual mode uses the Visually selected text as a tag. + Make new window N high. *CTRL-W_g]* CTRL-W g ] Split current window in two. Use identifier under cursor as a tag and perform ":tselect" on it in the new upper window. + In Visual mode uses the Visually selected text as a tag. Make new window N high. *CTRL-W_g_CTRL-]* CTRL-W g CTRL-] Split current window in two. Use identifier under cursor as a - tag and perform ":tjump" on it in the new upper window. Make - new window N high. + tag and perform ":tjump" on it in the new upper window. + In Visual mode uses the Visually selected text as a tag. + Make new window N high. CTRL-W f *CTRL-W_f* *CTRL-W_CTRL-F* CTRL-W CTRL-F Split current window in two. Edit file name under cursor. @@ -910,7 +972,6 @@ is no word under the cursor, and a few other things: > A hidden buffer is not displayed in a window, but is still loaded into memory. This makes it possible to jump from file to file, without the need to read or write the file every time you get another buffer in a window. -{not available when compiled without the |+listcmds| feature} *:buffer-!* If the option 'hidden' ('hid') is set, abandoned buffers are kept for all @@ -942,9 +1003,10 @@ A buffer can also be unlisted. This means it exists, but it is not in the list of buffers. |unlisted-buffer| -:files[!] *:files* -:buffers[!] *:buffers* *:ls* -:ls[!] Show all buffers. Example: +:files[!] [flags] *:files* +:buffers[!] [flags] *:buffers* *:ls* +:ls[!] [flags] + Show all buffers. Example: 1 #h "/test/text" line 1 ~ 2u "asdf" line 0 ~ @@ -954,8 +1016,8 @@ list of buffers. |unlisted-buffer| (the term "unlisted" is a bit confusing then...). Each buffer has a unique number. That number will not change, - so you can always go to a specific buffer with ":buffer N" or - "N CTRL-^", where N is the buffer number. + thus you can always go to a specific buffer with ":buffer N" + or "N CTRL-^", where N is the buffer number. Indicators (chars in the same column are mutually exclusive): u an unlisted buffer (only displayed when [!] is used) @@ -967,9 +1029,34 @@ list of buffers. |unlisted-buffer| displayed in a window |hidden-buffer| - a buffer with 'modifiable' off = a readonly buffer + R a terminal buffer with a running job + F a terminal buffer with a finished job + ? a terminal buffer without a job: `:terminal NONE` + a modified buffer x a buffer with read errors + [flags] can be a combination of the following characters, + which restrict the buffers to be listed: + + modified buffers + - buffers with 'modifiable' off + = readonly buffers + a active buffers + u unlisted buffers (overrides the "!") + h hidden buffers + x buffers with a read error + % current buffer + # alternate buffer + R terminal buffers with a running job + F terminal buffers with a finished job + ? terminal buffers without a job: `:terminal NONE` + Combining flags means they are "and"ed together, e.g.: + h+ hidden buffers which are modified + a+ active buffers which are modified + + When using |:filter| the pattern is matched against the + displayed buffer name, e.g.: > + filter /\.vim/ ls +< *:bad* *:badd* :bad[d] [+lnum] {fname} Add file name {fname} to the buffer list, without loading it. @@ -989,13 +1076,15 @@ list of buffers. |unlisted-buffer| Actually, the buffer isn't completely deleted, it is removed from the buffer list |unlisted-buffer| and option values, variables and mappings/abbreviations for the buffer are - cleared. + cleared. Examples: > + :.,$-bdelete " delete buffers from the current one to + " last but one + :%bdelete " delete all buffers +< :bdelete[!] {bufname} *E93* *E94* - Like ":bdelete[!] [N]", but buffer given by name. Note that a - buffer whose name is a number cannot be referenced by that - name; use the buffer number instead. Insert a backslash - before a space in a buffer name. + Like ":bdelete[!] [N]", but buffer given by name, see + |{bufname}|. :bdelete[!] N1 N2 ... Do ":bdelete[!]" for buffer N1, N2, etc. The arguments can be @@ -1013,7 +1102,11 @@ list of buffers. |unlisted-buffer| Like |:bdelete|, but really delete the buffer. Everything related to the buffer is lost. All marks in this buffer become invalid, option settings are lost, etc. Don't use this - unless you know what you are doing. + unless you know what you are doing. Examples: > + :.+,$bwipeout " wipe out all buffers after the current + " one + :%bwipeout " wipe out all buffers +< :[N]bun[load][!] *:bun* *:bunload* *E515* :bun[load][!] [N] @@ -1028,10 +1121,8 @@ list of buffers. |unlisted-buffer| into a loaded buffer. :bunload[!] {bufname} - Like ":bunload[!] [N]", but buffer given by name. Note that a - buffer whose name is a number cannot be referenced by that - name; use the buffer number instead. Insert a backslash - before a space in a buffer name. + Like ":bunload[!] [N]", but buffer given by name. + Also see |{bufname}|. :N,Mbunload[!] Do ":bunload[!]" for all buffers in the range N to M |inclusive|. @@ -1042,36 +1133,47 @@ list of buffers. |unlisted-buffer| a number). Insert a backslash before a space in a buffer name. -:[N]b[uffer][!] [N] *:b* *:bu* *:buf* *:buffer* *E86* +:[N]b[uffer][!] [+cmd] [N] *:b* *:bu* *:buf* *:buffer* *E86* Edit buffer [N] from the buffer list. If [N] is not given, the current buffer remains being edited. See |:buffer-!| for [!]. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. + Also see |+cmd|. + +:[N]b[uffer][!] [+cmd] {bufname} *{bufname}* + Edit buffer for {bufname} from the buffer list. A partial + name also works, so long as it is unique in the list of + buffers. + Note that a buffer whose name is a number cannot be referenced + by that name; use the buffer number instead. + Insert a backslash before a space in a buffer name. + See |:buffer-!| for [!]. + This will also edit a buffer that is not in the buffer list, + without setting the 'buflisted' flag. + Also see |+cmd|. -:[N]b[uffer][!] {bufname} - Edit buffer for {bufname} from the buffer list. See - |:buffer-!| for [!]. This will also edit a buffer that is not - in the buffer list, without setting the 'buflisted' flag. - -:[N]sb[uffer] [N] *:sb* *:sbuffer* +:[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer* Split window and edit buffer [N] from the buffer list. If [N] is not given, the current buffer is edited. Respects the "useopen" setting of 'switchbuf' when splitting. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. + Also see |+cmd|. -:[N]sb[uffer] {bufname} - Split window and edit buffer for {bufname} from the buffer +:[N]sb[uffer] [+cmd] {bufname} + Split window and edit buffer for |{bufname}| from the buffer list. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. Note: If what you want to do is split the buffer, make a copy under another name, you can do it this way: > :w foobar | sp # +< Also see |+cmd|. -:[N]bn[ext][!] [N] *:bn* *:bnext* *E87* +:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87* Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list. See |:buffer-!| for [!]. + Also see |+cmd|. If you are in a help buffer, this takes you to the next help buffer (if there is one). Similarly, if you are in a normal (non-help) buffer, this takes you to the next normal buffer. @@ -1079,55 +1181,61 @@ list of buffers. |unlisted-buffer| the way when you're browsing code/text buffers. The next three commands also work like this. + *:sbn* *:sbnext* -:[N]sbn[ext] [N] +:[N]sbn[ext] [+cmd] [N] Split window and go to [N]th next buffer in buffer list. Wraps around the end of the buffer list. Uses 'switchbuf' + Also see |+cmd|. -:[N]bN[ext][!] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* -:[N]bp[revious][!] [N] +:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* +:[N]bp[revious][!] [+cmd] [N] Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list. See |:buffer-!| for [!] and 'switchbuf'. + Also see |+cmd|. -:[N]sbN[ext] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* -:[N]sbp[revious] [N] +:[N]sbN[ext] [+cmd] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* +:[N]sbp[revious] [+cmd] [N] Split window and go to [N]th previous buffer in buffer list. Wraps around the start of the buffer list. Uses 'switchbuf'. + Also see |+cmd|. - *:br* *:brewind* -:br[ewind][!] Go to first buffer in buffer list. If the buffer list is +:br[ewind][!] [+cmd] *:br* *:brewind* + Go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. See |:buffer-!| for [!]. - *:bf* *:bfirst* -:bf[irst] Same as ":brewind". +:bf[irst] [+cmd] *:bf* *:bfirst* + Same as |:brewind|. + Also see |+cmd|. - *:sbr* *:sbrewind* -:sbr[ewind] Split window and go to first buffer in buffer list. If the +:sbr[ewind] [+cmd] *:sbr* *:sbrewind* + Split window and go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. Respects the 'switchbuf' option. + Also see |+cmd|. - *:sbf* *:sbfirst* -:sbf[irst] Same as ":sbrewind". +:sbf[irst] [+cmd] *:sbf* *:sbfirst* + Same as ":sbrewind". - *:bl* *:blast* -:bl[ast][!] Go to last buffer in buffer list. If the buffer list is +:bl[ast][!] [+cmd] *:bl* *:blast* + Go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer. See |:buffer-!| for [!]. - *:sbl* *:sblast* -:sbl[ast] Split window and go to last buffer in buffer list. If the +:sbl[ast] [+cmd] *:sbl* *:sblast* + Split window and go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer. Respects 'switchbuf' option. -:[N]bm[odified][!] [N] *:bm* *:bmodified* *E84* +:[N]bm[odified][!] [+cmd] [N] *:bm* *:bmodified* *E84* Go to [N]th next modified buffer. Note: this command also finds unlisted buffers. If there is no modified buffer the command fails. -:[N]sbm[odified] [N] *:sbm* *:sbmodified* +:[N]sbm[odified] [+cmd] [N] *:sbm* *:sbmodified* Split window and go to [N]th next modified buffer. Respects 'switchbuf' option. Note: this command also finds buffers not in the buffer list. @@ -1175,6 +1283,9 @@ help Contains a help file. Will only be created with the |:help| and can't be changed. The 'buflisted' option will be reset for a help buffer. +terminal A terminal window buffer, see |terminal|. The contents cannot + be read or changed until the job ends. + directory Displays directory contents. Can be used by a file explorer plugin. The buffer is created with these settings: > :setlocal buftype=nowrite diff --git a/runtime/doc/workshop.txt b/runtime/doc/workshop.txt index 5514f9ebb7..8a699a47d8 100644 --- a/runtime/doc/workshop.txt +++ b/runtime/doc/workshop.txt @@ -1,4 +1,4 @@ -*workshop.txt* For Vim version 7.4. Last change: 2013 Jul 06 +*workshop.txt* For Vim version 8.1. Last change: 2013 Jul 06 VIM REFERENCE MANUAL by Gordon Prieur diff --git a/runtime/doc/xxd-ja.UTF-8.1 b/runtime/doc/xxd-ja.UTF-8.1 index 8a8d54b021..47688f87aa 100644 --- a/runtime/doc/xxd-ja.UTF-8.1 +++ b/runtime/doc/xxd-ja.UTF-8.1 @@ -61,11 +61,24 @@ 行末には ascii (または ebcdic) で表した場合の文字が表示されます。 このモードでは \-r、\-p、\-i は機能しません。 .TP +.IR \-e +リトルエンディアンの 16 進ダンプに切り替える。 +このオプションは、バイトのグループをリトルエンディアンのバイト順のワードとして +扱います。標準のグルーピングは 4 バイトですが、 +.RI "" \-g +を使うことで変更可能です。 +このオプションは 16 進ダンプのみに適用され、ASCII (あるいは EBCDIC) 表示は +変更されません。 +このモードでは \-r、\-p、\-i は機能しません。 +.TP .IR "\-c cols " | " \-cols cols" 一行 .RI < cols > オクテットで出力する。標準設定は 16 (\-i: 12, \-ps: 30, \-b: 6)。最大 256。 .TP +.IR \-C " | " \-capitalize +\-i を使用した際に、C インクルードファイル形式の変数名を大文字にする。 +.TP .IR \-E " | " \-EBCDIC 右端に出力される文字のエンコーディングを ASCII から EBCDIC に変更する。 16 進ダンプの出力形式は変更されません。 @@ -80,7 +93,8 @@ .I \-g 0 を指定してください。 .RI < Bytes > -の標準設定は \fI2\fP です。2 進ダンプの場合は \fI1\fP です。 +の標準設定は \fI2\fP で、リトルエンディアンモードの場合は \fI4\fP 、 +2 進ダンプの場合は \fI1\fP です。 ポストスクリプト形式やインクルード形式で出力するときは、このオプションは使わ れません。 .TP @@ -95,6 +109,11 @@ C インクルードファイル形式で出力します。入力ファイルの .RI < len > オクテットだけ出力する。 .TP +.I \-o offset +表示されるファイル位置に +.RI < offset > +を加算する。 +.TP .IR \-p " | " \-ps " | " \-postscript " | " \-plain ポストスクリプト形式の 16 進ダンプを出力する。別名 プレーン 16 進ダンプ。 .TP diff --git a/runtime/doc/xxd.1 b/runtime/doc/xxd.1 index e8f7358591..46bfedc1e8 100644 --- a/runtime/doc/xxd.1 +++ b/runtime/doc/xxd.1 @@ -57,7 +57,7 @@ are all equivalent. .PP .TP .IR \-a " | " \-autoskip -toggle autoskip: A single '*' replaces nul-lines. Default off. +Toggle autoskip: A single '*' replaces nul-lines. Default off. .TP .IR \-b " | " \-bits Switch to bits (binary digits) dump, rather than hexdump. @@ -67,44 +67,62 @@ followed by an ascii (or ebcdic) representation. The command line switches \-r, \-p, \-i do not work with this mode. .TP .IR "\-c cols " | " \-cols cols" -format +Format .RI < cols > octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. .TP +.IR \-C " | " \-capitalize +Capitalize variable names in C include file style, when using \-i. +.TP .IR \-E " | " \-EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is meaningless in combinations with \-r, \-p or \-i. .TP +.IR \-e +Switch to little-endian hexdump. +This option treats byte groups as words in little-endian byte order. +The default grouping of 4 bytes may be changed using +.RI "" \-g . +This option only applies to hexdump, leaving the ASCII (or EBCDIC) +representation unchanged. +The command line switches +\-r, \-p, \-i do not work with this mode. +.TP .IR "\-g bytes " | " \-groupsize bytes" -separate the output of every +Separate the output of every .RI < bytes > bytes (two hex characters or eight bit-digits each) by a whitespace. Specify .I \-g 0 to suppress grouping. .RI < Bytes "> defaults to " 2 -in normal mode and \fI1\fP in bits mode. +in normal mode, \fI4\fP in little-endian mode and \fI1\fP in bits mode. Grouping does not apply to postscript or include style. .TP .IR \-h " | " \-help -print a summary of available commands and exit. No hex dumping is performed. +Print a summary of available commands and exit. No hex dumping is performed. .TP .IR \-i " | " \-include -output in C include file style. A complete static array definition is written +Output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin. .TP .IR "\-l len " | " \-len len" -stop after writing +Stop after writing .RI < len > octets. .TP +.I \-o offset +Add +.RI < offset > +to the displayed file position. +.TP .IR \-p " | " \-ps " | " \-postscript " | " \-plain -output in postscript continuous hexdump style. Also known as plain hexdump +Output in postscript continuous hexdump style. Also known as plain hexdump style. .TP .IR \-r " | " \-revert -reverse operation: convert (or patch) hexdump into binary. +Reverse operation: convert (or patch) hexdump into binary. If not writing to stdout, xxd writes into its output file without truncating it. Use the combination .I \-r \-p @@ -120,7 +138,7 @@ revert with added to file positions found in hexdump. .TP .I \-s [+][\-]seek -start at +Start at .RI < seek > bytes abs. (or rel.) infile offset. \fI+ \fRindicates that the seek is relative to the current stdin file position @@ -130,10 +148,10 @@ should be that many characters from the end of the input (or if combined with Without \-s option, xxd starts at the current file position. .TP .I \-u -use upper case hex letters. Default is lower case. +Use upper case hex letters. Default is lower case. .TP .IR \-v " | " \-version -show version string. +Show version string. .SH CAVEATS .PP .I xxd \-r diff --git a/runtime/doc/xxd.man b/runtime/doc/xxd.man index 057c8e911b..607db8aa99 100644 --- a/runtime/doc/xxd.man +++ b/runtime/doc/xxd.man @@ -1,4 +1,4 @@ -XXD(1) XXD(1) +XXD(1) General Commands Manual XXD(1) @@ -14,71 +14,83 @@ DESCRIPTION xxd creates a hex dump of a given file or standard input. It can also convert a hex dump back to its original binary form. Like uuencode(1) and uudecode(1) it allows the transmission of binary data in a `mail- - safe' ASCII representation, but has the advantage of decoding to stan- + safe' ASCII representation, but has the advantage of decoding to stan‐ dard output. Moreover, it can be used to perform binary file patching. OPTIONS - If no infile is given, standard input is read. If infile is specified - as a `-' character, then input is taken from standard input. If no + If no infile is given, standard input is read. If infile is specified + as a `-' character, then input is taken from standard input. If no outfile is given (or a `-' character is in its place), results are sent to standard output. - Note that a "lazy" parser is used which does not check for more than - the first option letter, unless the option is followed by a parameter. - Spaces between a single option letter and its parameter are optional. + Note that a "lazy" parser is used which does not check for more than + the first option letter, unless the option is followed by a parameter. + Spaces between a single option letter and its parameter are optional. Parameters to options can be specified in decimal, hexadecimal or octal notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent. - -a | -autoskip - toggle autoskip: A single '*' replaces nul-lines. Default off. + Toggle autoskip: A single '*' replaces nul-lines. Default off. -b | -bits Switch to bits (binary digits) dump, rather than hexdump. This option writes octets as eight digits "1"s and "0"s instead of a normal hexadecimal dump. Each line is preceded by a line number - in hexadecimal and followed by an ascii (or ebcdic) representa- + in hexadecimal and followed by an ascii (or ebcdic) representa‐ tion. The command line switches -r, -p, -i do not work with this mode. -c cols | -cols cols - format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b: + Format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b: 6). Max 256. + -C | -capitalize + Capitalize variable names in C include file style, when using + -i. + -E | -EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is meaningless in combinations with -r, -p or -i. + -e Switch to little-endian hexdump. This option treats byte groups + as words in little-endian byte order. The default grouping of 4 + bytes may be changed using -g. This option only applies to hex‐ + dump, leaving the ASCII (or EBCDIC) representation unchanged. + The command line switches -r, -p, -i do not work with this mode. + -g bytes | -groupsize bytes - separate the output of every <bytes> bytes (two hex characters - or eight bit-digits each) by a whitespace. Specify -g 0 to sup- - press grouping. <Bytes> defaults to 2 in normal mode and 1 in - bits mode. Grouping does not apply to postscript or include - style. + Separate the output of every <bytes> bytes (two hex characters + or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐ + press grouping. <Bytes> defaults to 2 in normal mode, 4 in lit‐ + tle-endian mode and 1 in bits mode. Grouping does not apply to + postscript or include style. -h | -help - print a summary of available commands and exit. No hex dumping + Print a summary of available commands and exit. No hex dumping is performed. -i | -include - output in C include file style. A complete static array defini- - tion is written (named after the input file), unless xxd reads + Output in C include file style. A complete static array defini‐ + tion is written (named after the input file), unless xxd reads from stdin. -l len | -len len - stop after writing <len> octets. + Stop after writing <len> octets. + + -o offset + Add <offset> to the displayed file position. -p | -ps | -postscript | -plain - output in postscript continuous hexdump style. Also known as + Output in postscript continuous hexdump style. Also known as plain hexdump style. -r | -revert - reverse operation: convert (or patch) hexdump into binary. If - not writing to stdout, xxd writes into its output file without - truncating it. Use the combination -r -p to read plain hexadeci- - mal dumps without line number information and without a particu- - lar column layout. Additional Whitespace and line-breaks are + Reverse operation: convert (or patch) hexdump into binary. If + not writing to stdout, xxd writes into its output file without + truncating it. Use the combination -r -p to read plain hexadeci‐ + mal dumps without line number information and without a particu‐ + lar column layout. Additional Whitespace and line-breaks are allowed anywhere. -seek offset @@ -86,34 +98,34 @@ OPTIONS found in hexdump. -s [+][-]seek - start at <seek> bytes abs. (or rel.) infile offset. + indicates - that the seek is relative to the current stdin file position + Start at <seek> bytes abs. (or rel.) infile offset. + indicates + that the seek is relative to the current stdin file position (meaningless when not reading from stdin). - indicates that the - seek should be that many characters from the end of the input + seek should be that many characters from the end of the input (or if combined with +: before the current stdin file position). Without -s option, xxd starts at the current file position. - -u use upper case hex letters. Default is lower case. + -u Use upper case hex letters. Default is lower case. -v | -version - show version string. + Show version string. CAVEATS xxd -r has some builtin magic while evaluating line number information. - If the output file is seekable, then the linenumbers at the start of - each hexdump line may be out of order, lines may be missing, or over- - lapping. In these cases xxd will lseek(2) to the next position. If the - output file is not seekable, only gaps are allowed, which will be + If the output file is seekable, then the linenumbers at the start of + each hexdump line may be out of order, lines may be missing, or over‐ + lapping. In these cases xxd will lseek(2) to the next position. If the + output file is not seekable, only gaps are allowed, which will be filled by null-bytes. xxd -r never generates parse errors. Garbage is silently skipped. - When editing hexdumps, please note that xxd -r skips everything on the + When editing hexdumps, please note that xxd -r skips everything on the input line after reading enough columns of hexadecimal data (see option - -c). This also means, that changes to the printable ascii (or ebcdic) - columns are always ignored. Reverting a plain (or postscript) style - hexdump with xxd -r -p does not depend on the correct number of col- - umns. Here anything that looks like a pair of hex-digits is inter- + -c). This also means, that changes to the printable ascii (or ebcdic) + columns are always ignored. Reverting a plain (or postscript) style + hexdump with xxd -r -p does not depend on the correct number of col‐ + umns. Here anything that looks like a pair of hex-digits is inter‐ preted. Note the difference between @@ -121,28 +133,28 @@ CAVEATS and % xxd -i < file - xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to + xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to "rewind" input. A '+' makes a difference if the input source is stdin, - and if stdin's file position is not at the start of the file by the - time xxd is started and given its input. The following examples may + and if stdin's file position is not at the start of the file by the + time xxd is started and given its input. The following examples may help to clarify (or further confuse!)... - Rewind stdin before reading; needed because the `cat' has already read + Rewind stdin before reading; needed because the `cat' has already read to the end of stdin. % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file - Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign + Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign means "relative to the current position", thus the `128' adds to the 1k where dd left off. - % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" + % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" < file Hexdump from file position 0x100 ( = 1024-768) on. % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet" < file - However, this is a rare situation and the use of `+' is rarely needed. - The author prefers to monitor the effect of xxd with strace(1) or + However, this is a rare situation and the use of `+' is rarely needed. + The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever -s is used. EXAMPLES @@ -186,7 +198,7 @@ EXAMPLES % xxd -s 0x36 -l 13 -c 13 xxd.1 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 - Create a 65537 byte file with all bytes 0x00, except for the last one + Create a 65537 byte file with all bytes 0x00, except for the last one which is 'A' (hex 0x41). % echo "010000: 41" | xxd -r > file @@ -196,7 +208,7 @@ EXAMPLES * 000fffc: 0000 0000 40 ....A - Create a 1 byte file containing a single 'A' character. The number + Create a 1 byte file containing a single 'A' character. The number after '-r -s' adds to the linenumbers found in the file; in effect, the leading bytes are suppressed. % echo "010000: 41" | xxd -r -s -0x10000 > file @@ -218,7 +230,6 @@ EXAMPLES % stty < /dev/term/b -echo -opost -isig -icanon min 1 % echo -n foo > /dev/term/b - RETURN VALUES The following error values are returned: @@ -238,7 +249,7 @@ SEE ALSO uuencode(1), uudecode(1), patch(1) WARNINGS - The tools weirdness matches its creators brain. Use entirely at your + The tools weirdness matches its creators brain. Use entirely at your own risk. Copy files. Trace it. Become a wizard. VERSION @@ -256,7 +267,4 @@ AUTHOR <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au> Small changes by Bram Moolenaar. Edited by Juergen Weigert. - - - Manual page for xxd August 1996 XXD(1) diff --git a/runtime/evim.vim b/runtime/evim.vim index 650ce428d6..f80b3c03b6 100644 --- a/runtime/evim.vim +++ b/runtime/evim.vim @@ -1,6 +1,6 @@ " Vim script for Evim key bindings " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Mar 29 +" Last Change: 2016 Jul 24 " Don't use Vi-compatible mode. set nocompatible @@ -63,4 +63,12 @@ if has("autocmd") endif " has("autocmd") +" Add optional packages. +" +" The matchit plugin makes the % command work better, but it is not backwards +" compatible. +if has('syntax') && has('eval') + packadd matchit +endif + " vim: set sw=2 : diff --git a/runtime/filetype.vim b/runtime/filetype.vim index dac44d72af..541f613ac9 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jul 23 +" Last Change: 2018 May 04 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -17,7 +17,7 @@ augroup filetypedetect " Ignored extensions if exists("*fnameescape") -au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew +au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew,?\+.pacsave,?\+.pacnew \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) au BufNewFile,BufRead *~ \ let s:name = expand("<afile>") | @@ -48,28 +48,11 @@ func! s:StarSetf(ft) endif endfunc +" Vim help file +au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt setf help + " Abaqus or Trasys -au BufNewFile,BufRead *.inp call s:Check_inp() - -func! s:Check_inp() - if getline(1) =~ '^\*' - setf abaqus - else - let n = 1 - if line("$") > 500 - let nmax = 500 - else - let nmax = line("$") - endif - while n <= nmax - if getline(n) =~? "^header surface data" - setf trasys - break - endif - let n = n + 1 - endwhile - endif -endfunc +au BufNewFile,BufRead *.inp call dist#ft#Check_inp() " A-A-P recipe au BufNewFile,BufRead *.aap setf aap @@ -143,7 +126,7 @@ au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch au BufNewFile,BufRead *.art setf art " AsciiDoc -au BufNewFile,BufRead *.asciidoc setf asciidoc +au BufNewFile,BufRead *.asciidoc,*.adoc setf asciidoc " ASN.1 au BufNewFile,BufRead *.asn,*.asn1 setf asn @@ -171,44 +154,7 @@ au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf " Assembly (all kinds) " *.lst is not pure assembly, it has two extra columns (address, byte codes) -au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm() - -" This function checks for the kind of assembly that is wanted by the user, or -" can be detected from the first five lines of the file. -func! s:FTasm() - " make sure b:asmsyntax exists - if !exists("b:asmsyntax") - let b:asmsyntax = "" - endif - - if b:asmsyntax == "" - call s:FTasmsyntax() - endif - - " if b:asmsyntax still isn't set, default to asmsyntax or GNU - if b:asmsyntax == "" - if exists("g:asmsyntax") - let b:asmsyntax = g:asmsyntax - else - let b:asmsyntax = "asm" - endif - endif - - exe "setf " . fnameescape(b:asmsyntax) -endfunc - -func! s:FTasmsyntax() - " see if file contains any asmsyntax=foo overrides. If so, change - " b:asmsyntax appropriately - let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). - \" ".getline(5)." " - let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s') - if match != '' - let b:asmsyntax = match - elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) - let b:asmsyntax = "vmasm" - endif -endfunc +au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm() " Macro (VAX) au BufNewFile,BufRead *.mar setf vmasm @@ -238,17 +184,7 @@ au BufNewFile,BufRead *.awk setf awk au BufNewFile,BufRead *.mch,*.ref,*.imp setf b " BASIC or Visual Basic -au BufNewFile,BufRead *.bas call s:FTVB("basic") - -" Check if one of the first five lines contains "VB_Name". In that case it is -" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype. -func! s:FTVB(alt) - if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' - setf vb - else - exe "setf " . a:alt - endif -endfunc +au BufNewFile,BufRead *.bas call dist#ft#FTVB("basic") " Visual Basic Script (close to Visual Basic) or Visual Basic .NET au BufNewFile,BufRead *.vb,*.vbs,*.dsm,*.ctl setf vb @@ -266,14 +202,7 @@ au BufNewFile,BufRead *.cmd \ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif " Batch file for 4DOS -au BufNewFile,BufRead *.btm call s:FTbtm() -func! s:FTbtm() - if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm - setf dosbatch - else - setf btm - endif -endfunc +au BufNewFile,BufRead *.btm call dist#ft#FTbtm() " BC calculator au BufNewFile,BufRead *.bc setf bc @@ -288,19 +217,12 @@ au BufNewFile,BufRead *.bib setf bib au BufNewFile,BufRead *.bst setf bst " BIND configuration -au BufNewFile,BufRead named.conf,rndc.conf setf named +" sudoedit uses namedXXXX.conf +au BufNewFile,BufRead named*.conf,rndc*.conf,rndc*.key setf named " BIND zone au BufNewFile,BufRead named.root setf bindzone -au BufNewFile,BufRead *.db call s:BindzoneCheck('') - -func! s:BindzoneCheck(default) - if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' - setf bindzone - elseif a:default != '' - exe 'setf ' . a:default - endif -endfunc +au BufNewFile,BufRead *.db call dist#ft#BindzoneCheck('') " Blank au BufNewFile,BufRead *.bl setf blank @@ -308,22 +230,16 @@ au BufNewFile,BufRead *.bl setf blank " Blkid cache file au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml +" Bazel (http://bazel.io) +autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl +if has("fname_case") + " There is another check for BUILD further below. + autocmd BufRead,BufNewFile BUILD setf bzl +endif + " C or lpc -au BufNewFile,BufRead *.c call s:FTlpc() - -func! s:FTlpc() - if exists("g:lpc_syntax_for_c") - let lnum = 1 - while lnum <= 12 - if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)' - setf lpc - return - endif - let lnum = lnum + 1 - endwhile - endif - setf c -endfunc +au BufNewFile,BufRead *.c call dist#ft#FTlpc() +au BufNewFile,BufRead *.lpc,*.ulpc setf lpc " Calendar au BufNewFile,BufRead calendar setf calendar @@ -377,23 +293,7 @@ endif " .h files can be C, Ch C++, ObjC or ObjC++. " Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is " detected automatically. -au BufNewFile,BufRead *.h call s:FTheader() - -func! s:FTheader() - if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 - if exists("g:c_syntax_for_h") - setf objc - else - setf objcpp - endif - elseif exists("g:c_syntax_for_h") - setf c - elseif exists("g:ch_syntax_for_h") - setf ch - else - setf cpp - endif -endfunc +au BufNewFile,BufRead *.h call dist#ft#FTheader() " Ch (CHscript) au BufNewFile,BufRead *.chf setf ch @@ -427,36 +327,7 @@ au BufNewFile,BufRead NEWS au BufNewFile,BufRead *..ch setf chill " Changes for WEB and CWEB or CHILL -au BufNewFile,BufRead *.ch call s:FTchange() - -" This function checks if one of the first ten lines start with a '@'. In -" that case it is probably a change file. -" If the first line starts with # or ! it's probably a ch file. -" If a line has "main", "include", "//" ir "/*" it's probably ch. -" Otherwise CHILL is assumed. -func! s:FTchange() - let lnum = 1 - while lnum <= 10 - if getline(lnum)[0] == '@' - setf change - return - endif - if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!') - setf ch - return - endif - if getline(lnum) =~ "MODULE" - setf chill - return - endif - if getline(lnum) =~ 'main\s*(\|#\s*include\|//' - setf ch - return - endif - let lnum = lnum + 1 - endwhile - setf chill -endfunc +au BufNewFile,BufRead *.ch call dist#ft#FTchange() " ChordPro au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro @@ -468,27 +339,7 @@ au BufNewFile,BufRead *.dcl,*.icl setf clean au BufNewFile,BufRead *.eni setf cl " Clever or dtd -au BufNewFile,BufRead *.ent call s:FTent() - -func! s:FTent() - " This function checks for valid cl syntax in the first five lines. - " Look for either an opening comment, '#', or a block start, '{". - " If not found, assume SGML. - let lnum = 1 - while lnum < 6 - let line = getline(lnum) - if line =~ '^\s*[#{]' - setf cl - return - elseif line !~ '^\s*$' - " Not a blank line, not a comment, and not a block start, - " so doesn't look like valid cl code. - break - endif - let lnum = lnum + 1 - endw - setf dtd -endfunc +au BufNewFile,BufRead *.ent call dist#ft#FTent() " Clipper (or FoxPro; could also be eviews) au BufNewFile,BufRead *.prg @@ -499,7 +350,7 @@ au BufNewFile,BufRead *.prg \ endif " Clojure -au BufNewFile,BufRead *.clj,*.cljs setf clojure +au BufNewFile,BufRead *.clj,*.cljs,*.cljx,*.cljc setf clojure " Cmake au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake @@ -528,7 +379,10 @@ au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf au BufNewFile,BufRead configure.in,configure.ac setf config " CUDA Cumpute Unified Device Architecture -au BufNewFile,BufRead *.cu setf cuda +au BufNewFile,BufRead *.cu,*.cuh setf cuda + +" Dockerfile +au BufNewFile,BufRead Dockerfile,*.Dockerfile setf dockerfile " WildPackets EtherPeek Decoder au BufNewFile,BufRead *.dcd setf dcd @@ -540,19 +394,11 @@ au BufNewFile,BufRead *enlightenment/*.cfg setf c au BufNewFile,BufRead *Eterm/*.cfg setf eterm " Euphoria 3 or 4 -au BufNewFile,BufRead *.eu,*.ew,*.ex,*.exu,*.exw call s:EuphoriaCheck() +au BufNewFile,BufRead *.eu,*.ew,*.ex,*.exu,*.exw call dist#ft#EuphoriaCheck() if has("fname_case") - au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW call s:EuphoriaCheck() + au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW call dist#ft#EuphoriaCheck() endif -func! s:EuphoriaCheck() - if exists('g:filetype_euphoria') - exe 'setf ' . g:filetype_euphoria - else - setf euphoria3 - endif -endfunc - " Lynx config files au BufNewFile,BufRead lynx.cfg setf lynx @@ -583,6 +429,13 @@ au BufNewFile,BufRead control \| setf debcontrol \| endif +" Debian Copyright +au BufNewFile,BufRead */debian/copyright setf debcopyright +au BufNewFile,BufRead copyright + \ if getline(1) =~ '^Format:' + \| setf debcopyright + \| endif + " Debian Sources.list au BufNewFile,BufRead */etc/apt/sources.list setf debsources au BufNewFile,BufRead */etc/apt/sources.list.d/*.list setf debsources @@ -597,19 +450,7 @@ au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq au BufNewFile,BufRead *.desc setf desc " the D language or dtrace -au BufNewFile,BufRead *.d call s:DtraceCheck() - -func! s:DtraceCheck() - let lines = getline(1, min([line("$"), 100])) - if match(lines, '^module\>\|^import\>') > -1 - " D files often start with a module and/or import statement. - setf d - elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1 - setf dtrace - else - setf d - endif -endfunc +au BufNewFile,BufRead *.d call dist#ft#DtraceCheck() " Desktop files au BufNewFile,BufRead *.desktop,.directory setf desktop @@ -621,7 +462,13 @@ au BufNewFile,BufRead dict.conf,.dictrc setf dictconf au BufNewFile,BufRead dictd.conf setf dictdconf " Diff files -au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff +au BufNewFile,BufRead *.diff,*.rej setf diff +au BufNewFile,BufRead *.patch + \ if getline(1) =~ '^From [0-9a-f]\{40\} Mon Sep 17 00:00:00 2001$' | + \ setf gitsendemail | + \ else | + \ setf diff | + \ endif " Dircolors au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf dircolors @@ -635,7 +482,7 @@ au BufNewFile,BufRead *.rul \ endif " DCL (Digital Command Language - vms) or DNS zone file -au BufNewFile,BufRead *.com call s:BindzoneCheck('dcl') +au BufNewFile,BufRead *.com call dist#ft#BindzoneCheck('dcl') " DOT au BufNewFile,BufRead *.dot setf dot @@ -667,34 +514,27 @@ au BufNewFile,BufRead *.dtd setf dtd " DTS/DSTI (device tree files) au BufNewFile,BufRead *.dts,*.dtsi setf dts -" EDIF (*.edf,*.edif,*.edn,*.edo) -au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif +" EDIF (*.edf,*.edif,*.edn,*.edo) or edn +au BufNewFile,BufRead *.ed\(f\|if\|o\) setf edif +au BufNewFile,BufRead *.edn + \ if getline(1) =~ '^\s*(\s*edif\>' | + \ setf edif | + \ else | + \ setf clojure | + \ endif + +" EditorConfig (close enough to dosini) +au BufNewFile,BufRead .editorconfig setf dosini " Embedix Component Description au BufNewFile,BufRead *.ecd setf ecd " Eiffel or Specman or Euphoria -au BufNewFile,BufRead *.e,*.E call s:FTe() +au BufNewFile,BufRead *.e,*.E call dist#ft#FTe() " Elinks configuration au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks -func! s:FTe() - if exists('g:filetype_euphoria') - exe 'setf ' . g:filetype_euphoria - else - let n = 1 - while n < 100 && n < line("$") - if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" - setf specman - return - endif - let n = n + 1 - endwhile - setf eiffel - endif -endfunc - " ERicsson LANGuage; Yaws is erlang too au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang @@ -773,13 +613,15 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom " Git -au BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit -au BufNewFile,BufRead *.git/MERGE_MSG setf gitcommit +au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig -au BufNewFile,BufRead *.git/modules/*/COMMIT_EDITMSG setf gitcommit au BufNewFile,BufRead *.git/modules/*/config setf gitconfig au BufNewFile,BufRead */.config/git/config setf gitconfig +if !empty($XDG_CONFIG_HOME) + au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig +endif au BufNewFile,BufRead git-rebase-todo setf gitrebase +au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail au BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | @@ -799,6 +641,10 @@ au BufNewFile,BufRead *.gp,.gprc setf gp au BufNewFile,BufRead */.gnupg/options setf gpg au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg au BufNewFile,BufRead */usr/*/gnupg/options.skel setf gpg +if !empty($GNUPGHOME) + au BufNewFile,BufRead $GNUPGHOME/options setf gpg + au BufNewFile,BufRead $GNUPGHOME/gpg.conf setf gpg +endif " gnash(1) configuration files au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash @@ -811,6 +657,9 @@ au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl " Gnuplot scripts au BufNewFile,BufRead *.gpi setf gnuplot +" Go (Google) +au BufNewFile,BufRead *.go setf go + " GrADS scripts au BufNewFile,BufRead *.gs setf grads @@ -818,7 +667,7 @@ au BufNewFile,BufRead *.gs setf grads au BufNewFile,BufRead *.gretl setf gretl " Groovy -au BufNewFile,BufRead *.groovy setf groovy +au BufNewFile,BufRead *.gradle,*.groovy setf groovy " GNU Server Pages au BufNewFile,BufRead *.gsp setf gsp @@ -845,7 +694,7 @@ au BufNewFile,BufRead *.ht setf haste au BufNewFile,BufRead *.htpp setf hastepreproc " Hercules -au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules +au BufNewFile,BufRead *.vc,*.ev,*.sum,*.errsum setf hercules " HEX (Intel) au BufNewFile,BufRead *.hex,*.h32 setf hex @@ -854,24 +703,7 @@ au BufNewFile,BufRead *.hex,*.h32 setf hex au BufNewFile,BufRead *.t.html setf tilde " HTML (.shtml and .stm for server side) -au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml() - -" Distinguish between HTML, XHTML and Django -func! s:FThtml() - let n = 1 - while n < 10 && n < line("$") - if getline(n) =~ '\<DTD\s\+XHTML\s' - setf xhtml - return - endif - if getline(n) =~ '{%\s*\(extends\|block\|load\)\>' - setf htmldjango - return - endif - let n = n + 1 - endwhile - setf html -endfunc +au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call dist#ft#FThtml() " HTML with Ruby - eRuby au BufNewFile,BufRead *.erb,*.rhtml setf eruby @@ -898,20 +730,7 @@ au BufNewFile,BufRead *.htt,*.htb setf httest au BufNewFile,BufRead *.icn setf icon " IDL (Interface Description Language) -au BufNewFile,BufRead *.idl call s:FTidl() - -" Distinguish between standard IDL and MS-IDL -func! s:FTidl() - let n = 1 - while n < 50 && n < line("$") - if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' - setf msidl - return - endif - let n = n + 1 - endwhile - setf idl -endfunc +au BufNewFile,BufRead *.idl call dist#ft#FTidl() " Microsoft IDL (Interface Description Language) Also *.idl " MOF = WMI (Windows Management Instrumentation) Managed Object Format @@ -922,25 +741,10 @@ au BufNewFile,BufRead */.icewm/menu setf icemenu " Indent profile (must come before IDL *.pro!) au BufNewFile,BufRead .indent.pro setf indent -au BufNewFile,BufRead indent.pro call s:ProtoCheck('indent') +au BufNewFile,BufRead indent.pro call dist#ft#ProtoCheck('indent') " IDL (Interactive Data Language) -au BufNewFile,BufRead *.pro call s:ProtoCheck('idlang') - -" Distinguish between "default" and Cproto prototype file. */ -func! s:ProtoCheck(default) - " Cproto files have a comment in the first line and a function prototype in - " the second line, it always ends in ";". Indent files may also have - " comments, thus we can't match comments to see the difference. - " IDL files can have a single ';' in the second line, require at least one - " chacter before the ';'. - if getline(2) =~ '.;$' - setf cpp - else - exe 'setf ' . a:default - endif -endfunc - +au BufNewFile,BufRead *.pro call dist#ft#ProtoCheck('idlang') " Indent RC au BufNewFile,BufRead indentrc setf indent @@ -953,7 +757,7 @@ au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng " Innovation Data Processing au BufRead,BufNewFile upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat -au BufRead,BufNewFile upstream.log\c,upstream.*.log\c,*.upstream.log\c setf upstreamlog +au BufRead,BufNewFile fdrupstream.log,upstream.log\c,upstream.*.log\c,*.upstream.log\c,UPSTREAM-*.log\c setf upstreamlog au BufRead,BufNewFile upstreaminstall.log\c,upstreaminstall.*.log\c,*.upstreaminstall.log\c setf upstreaminstalllog au BufRead,BufNewFile usserver.log\c,usserver.*.log\c,*.usserver.log\c setf usserverlog au BufRead,BufNewFile usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog @@ -989,7 +793,7 @@ au BufNewFile,BufRead *.java,*.jav setf java au BufNewFile,BufRead *.jj,*.jjt setf javacc " JavaScript, ECMAScript -au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript +au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.mjs setf javascript " Java Server Pages au BufNewFile,BufRead *.jsp setf jsp @@ -1008,7 +812,7 @@ au BufNewFile,BufRead *.jgr setf jgraph au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial " JSON -au BufNewFile,BufRead *.json setf json +au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest setf json " Kixtart au BufNewFile,BufRead *.kix setf kix @@ -1043,6 +847,9 @@ au BufNewFile,BufRead *.ldif setf ldif " Ld loader au BufNewFile,BufRead *.ld setf ld +" Less +au BufNewFile,BufRead *.less setf less + " Lex au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++ setf lex @@ -1098,6 +905,9 @@ au BufNewFile,BufRead *.lou,*.lout setf lout " Lua au BufNewFile,BufRead *.lua setf lua +" Luarocks +au BufNewFile,BufRead *.rockspec setf lua + " Linden Scripting Language (Second Life) au BufNewFile,BufRead *.lsl setf lsl @@ -1111,8 +921,8 @@ au BufNewFile,BufRead *.m4 " MaGic Point au BufNewFile,BufRead *.mgp setf mgp -" Mail (for Elm, trn, mutt, muttng, rn, slrn) -au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\\\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail +" Mail (for Elm, trn, mutt, muttng, rn, slrn, neomutt) +au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\\\{6\},neomutt-*-\w\+,neomutt[[:alnum:]_-]\\\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail " Mail aliases au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases @@ -1142,38 +952,13 @@ au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple au BufNewFile,BufRead *.map setf map " Markdown -au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,README.md setf markdown +au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md setf markdown " Mason -au BufNewFile,BufRead *.mason,*.mhtml setf mason - -" Matlab or Objective C -au BufNewFile,BufRead *.m call s:FTm() - -func! s:FTm() - let n = 1 - while n < 10 - let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' - setf objc - return - endif - if line =~ '^\s*%' - setf matlab - return - endif - if line =~ '^\s*(\*' - setf mma - return - endif - let n = n + 1 - endwhile - if exists("g:filetype_m") - exe "setf " . g:filetype_m - else - setf matlab - endif -endfunc +au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason + +" Mathematica, Matlab, Murphi or Objective C +au BufNewFile,BufRead *.m call dist#ft#FTm() " Mathematica notebook au BufNewFile,BufRead *.nb setf mma @@ -1203,29 +988,11 @@ au BufNewFile,BufRead *.mgl setf mgl au BufNewFile,BufRead *.mix,*.mixal setf mix " MMIX or VMS makefile -au BufNewFile,BufRead *.mms call s:FTmms() +au BufNewFile,BufRead *.mms call dist#ft#FTmms() " Symbian meta-makefile definition (MMP) au BufNewFile,BufRead *.mmp setf mmp -func! s:FTmms() - let n = 1 - while n < 10 - let line = getline(n) - if line =~ '^\s*\(%\|//\)' || line =~ '^\*' - setf mmix - return - endif - if line =~ '^\s*#' - setf make - return - endif - let n = n + 1 - endwhile - setf mmix -endfunc - - " Modsim III (or LambdaProlog) au BufNewFile,BufRead *.mod \ if getline(1) =~ '\<module\>' | @@ -1234,8 +1001,8 @@ au BufNewFile,BufRead *.mod \ setf modsim3 | \ endif -" Modula 2 -au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2 +" Modula 2 (.md removed in favor of Markdown) +au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2 " Modula 3 (.m3, .i3, .mg, .ig) au BufNewFile,BufRead *.[mi][3g] setf modula3 @@ -1252,8 +1019,8 @@ au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf m " Mplayer config au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf -" Moterola S record -au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec +" Motorola S record +au BufNewFile,BufRead *.s19,*.s28,*.s37,*.mot,*.srec setf srec " Mrxvtrc au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc @@ -1279,8 +1046,11 @@ au BufNewFile,BufRead *.mush setf mush " Mutt setup file (also for Muttng) au BufNewFile,BufRead Mutt{ng,}rc setf muttrc +" N1QL +au BufRead,BufNewfile *.n1ql,*.nql setf n1ql + " Nano -au BufNewFile,BufRead */etc/nanorc,.nanorc setf nanorc +au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc " Nastran input/DMAP "au BufNewFile,BufRead *.dat setf nastran @@ -1288,6 +1058,9 @@ au BufNewFile,BufRead */etc/nanorc,.nanorc setf nanorc " Natural au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural +" Noemutt setup file +au BufNewFile,BufRead Neomuttrc setf neomuttrc + " Netrc au BufNewFile,BufRead .netrc setf netrc @@ -1303,37 +1076,17 @@ au BufNewFile,BufRead *.me \ setf nroff | \ endif au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff -au BufNewFile,BufRead *.[1-9] call s:FTnroff() - -" This function checks if one of the first five lines start with a dot. In -" that case it is probably an nroff file: 'filetype' is set and 1 is returned. -func! s:FTnroff() - if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' - setf nroff - return 1 - endif - return 0 -endfunc +au BufNewFile,BufRead *.[1-9] call dist#ft#FTnroff() " Nroff or Objective C++ -au BufNewFile,BufRead *.mm call s:FTmm() - -func! s:FTmm() - let n = 1 - while n < 10 - let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' - setf objcpp - return - endif - let n = n + 1 - endwhile - setf nroff -endfunc +au BufNewFile,BufRead *.mm call dist#ft#FTmm() " Not Quite C au BufNewFile,BufRead *.nqc setf nqc +" NSE - Nmap Script Engine - uses Lua syntax +au BufNewFile,BufRead *.nse setf lua + " NSIS au BufNewFile,BufRead *.nsi,*.nsh setf nsis @@ -1376,29 +1129,17 @@ au BufNewFile,BufRead *.dpr setf pascal " PDF au BufNewFile,BufRead *.pdf setf pdf +" PCMK - HAE - crm configure edit +au BufNewFile,BufRead *.pcmk setf pcmk + " Perl if has("fname_case") - au BufNewFile,BufRead *.pl,*.PL call s:FTpl() + au BufNewFile,BufRead *.pl,*.PL call dist#ft#FTpl() else - au BufNewFile,BufRead *.pl call s:FTpl() + au BufNewFile,BufRead *.pl call dist#ft#FTpl() endif -au BufNewFile,BufRead *.plx,*.al setf perl -au BufNewFile,BufRead *.p6,*.pm6 setf perl6 - -func! s:FTpl() - if exists("g:filetype_pl") - exe "setf " . g:filetype_pl - else - " recognize Prolog by specific text in the first non-empty line - " require a blank after the '%' because Perl uses "%list" and "%translate" - let l = getline(nextnonblank(1)) - if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' - setf prolog - else - setf perl - endif - endif -endfunc +au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl +au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 " Perl, XPM or XPM2 au BufNewFile,BufRead *.pm @@ -1412,14 +1153,16 @@ au BufNewFile,BufRead *.pm " Perl POD au BufNewFile,BufRead *.pod setf pod +au BufNewFile,BufRead *.pod6 setf pod6 " Php, php3, php4, etc. " Also Phtml (was used for PHP 2 in the past) " Also .ctp for Cake template file au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php -" Pike -au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike +" Pike and Cmod +au BufNewFile,BufRead *.pike,*.pmod setf pike +au BufNewFile,BufRead *.cmod setf cmod " Pinfo config au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo @@ -1461,29 +1204,7 @@ au BufNewFile,BufRead *.pov setf pov au BufNewFile,BufRead .povrayrc setf povini " Povray, PHP or assembly -au BufNewFile,BufRead *.inc call s:FTinc() - -func! s:FTinc() - if exists("g:filetype_inc") - exe "setf " . g:filetype_inc - else - let lines = getline(1).getline(2).getline(3) - if lines =~? "perlscript" - setf aspperl - elseif lines =~ "<%" - setf aspvbs - elseif lines =~ "<?" - setf php - else - call s:FTasmsyntax() - if exists("b:asmsyntax") - exe "setf " . fnameescape(b:asmsyntax) - else - setf pov - endif - endif - endif -endfunc +au BufNewFile,BufRead *.inc call dist#ft#FTinc() " Printcap and Termcap au BufNewFile,BufRead *printcap @@ -1512,74 +1233,13 @@ au BufNewFile,BufRead *.action setf privoxy au BufNewFile,BufRead .procmail,.procmailrc setf procmail " Progress or CWEB -au BufNewFile,BufRead *.w call s:FTprogress_cweb() - -func! s:FTprogress_cweb() - if exists("g:filetype_w") - exe "setf " . g:filetype_w - return - endif - if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' - setf progress - else - setf cweb - endif -endfunc +au BufNewFile,BufRead *.w call dist#ft#FTprogress_cweb() " Progress or assembly -au BufNewFile,BufRead *.i call s:FTprogress_asm() - -func! s:FTprogress_asm() - if exists("g:filetype_i") - exe "setf " . g:filetype_i - return - endif - " This function checks for an assembly comment the first ten lines. - " If not found, assume Progress. - let lnum = 1 - while lnum <= 10 && lnum < line('$') - let line = getline(lnum) - if line =~ '^\s*;' || line =~ '^\*' - call s:FTasm() - return - elseif line !~ '^\s*$' || line =~ '^/\*' - " Not an empty line: Doesn't look like valid assembly code. - " Or it looks like a Progress /* comment - break - endif - let lnum = lnum + 1 - endw - setf progress -endfunc +au BufNewFile,BufRead *.i call dist#ft#FTprogress_asm() " Progress or Pascal -au BufNewFile,BufRead *.p call s:FTprogress_pascal() - -func! s:FTprogress_pascal() - if exists("g:filetype_p") - exe "setf " . g:filetype_p - return - endif - " This function checks for valid Pascal syntax in the first ten lines. - " Look for either an opening comment or a program start. - " If not found, assume Progress. - let lnum = 1 - while lnum <= 10 && lnum < line('$') - let line = getline(lnum) - if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' - \ || line =~ '^\s*{' || line =~ '^\s*(\*' - setf pascal - return - elseif line !~ '^\s*$' || line =~ '^/\*' - " Not an empty line: Doesn't look like valid Pascal code. - " Or it looks like a Progress /* comment - break - endif - let lnum = lnum + 1 - endw - setf progress -endfunc - +au BufNewFile,BufRead *.p call dist#ft#FTprogress_pascal() " Software Distributor Product Specification File (POSIX 1387.2-1995) au BufNewFile,BufRead *.psf setf psf @@ -1603,11 +1263,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 @@ -1667,40 +1325,7 @@ else endif " Rexx, Rebol or R -au BufNewFile,BufRead *.r,*.R call s:FTr() - -func! s:FTr() - let max = line("$") > 50 ? 50 : line("$") - - for n in range(1, max) - " Rebol is easy to recognize, check for that first - if getline(n) =~? '\<REBOL\>' - setf rebol - return - endif - endfor - - for n in range(1, max) - " R has # comments - if getline(n) =~ '^\s*#' - setf r - return - endif - " Rexx has /* comments */ - if getline(n) =~ '^\s*/\*' - setf rexx - return - endif - endfor - - " Nothing recognized, use user default or assume Rexx - if exists("g:filetype_r") - exe "setf " . g:filetype_r - else - " Rexx used to be the default, but R appears to be much more popular. - setf r - endif -endfunc +au BufNewFile,BufRead *.r,*.R call dist#ft#FTr() " Remind au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind @@ -1738,6 +1363,9 @@ au BufNewFile,BufRead *.rb,*.rbw setf ruby " RubyGems au BufNewFile,BufRead *.gemspec setf ruby +" Rust +au BufNewFile,BufRead *.rs setf rust + " Rackup au BufNewFile,BufRead *.ru setf ruby @@ -1765,6 +1393,12 @@ au BufNewFile,BufRead *.sass setf sass " Sather au BufNewFile,BufRead *.sa setf sather +" Scala +au BufNewFile,BufRead *.scala setf scala + +" SBT - Scala Build Tool +au BufNewFile,BufRead *.sbt setf sbt + " Scilab au BufNewFile,BufRead *.sci,*.sce setf scilab @@ -1787,23 +1421,7 @@ au BufNewFile,BufRead *.siv setf sieve au BufNewFile,BufRead sendmail.cf setf sm " Sendmail .mc files are actually m4. Could also be MS Message text file. -au BufNewFile,BufRead *.mc call s:McSetf() - -func! s:McSetf() - " Rely on the file to start with a comment. - " MS message text files use ';', Sendmail files use '#' or 'dnl' - for lnum in range(1, min([line("$"), 20])) - let line = getline(lnum) - if line =~ '^\s*\(#\|dnl\)' - setf m4 " Sendmail .mc file - return - elseif line =~ '^\s*;' - setf msmessages " MS Message text file - return - endif - endfor - setf m4 " Default: Sendmail .mc file -endfunc +au BufNewFile,BufRead *.mc call dist#ft#McSetf() " Services au BufNewFile,BufRead */etc/services setf services @@ -1843,94 +1461,24 @@ au BufNewFile,BufRead catalog setf catalog au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. -" Gentoo ebuilds are actually bash scripts -au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash") -au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") -au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) - -" Also called from scripts.vim. -func! SetFileTypeSH(name) - if expand("<amatch>") =~ g:ft_ignore_pat - return - endif - if a:name =~ '\<csh\>' - " Some .sh scripts contain #!/bin/csh. - call SetFileTypeShell("csh") - return - elseif a:name =~ '\<tcsh\>' - " Some .sh scripts contain #!/bin/tcsh. - call SetFileTypeShell("tcsh") - return - elseif a:name =~ '\<zsh\>' - " Some .sh scripts contain #!/bin/zsh. - call SetFileTypeShell("zsh") - return - elseif a:name =~ '\<ksh\>' - let b:is_kornshell = 1 - if exists("b:is_bash") - unlet b:is_bash - endif - if exists("b:is_sh") - unlet b:is_sh - endif - elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' - let b:is_bash = 1 - if exists("b:is_kornshell") - unlet b:is_kornshell - endif - if exists("b:is_sh") - unlet b:is_sh - endif - elseif a:name =~ '\<sh\>' - let b:is_sh = 1 - if exists("b:is_kornshell") - unlet b:is_kornshell - endif - if exists("b:is_bash") - unlet b:is_bash - endif - endif - call SetFileTypeShell("sh") -endfunc +" Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts +au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD* call dist#ft#SetFileTypeSH("bash") +au BufNewFile,BufRead .kshrc*,*.ksh call dist#ft#SetFileTypeSH("ksh") +au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1)) -" For shell-like file types, check for an "exec" command hidden in a comment, -" as used for Tcl. -" Also called from scripts.vim, thus can't be local to this script. -func! SetFileTypeShell(name) - if expand("<amatch>") =~ g:ft_ignore_pat - return - endif - let l = 2 - while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' - " Skip empty and comment lines. - let l = l + 1 - endwhile - if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' - " Found an "exec" line after a comment with continuation - let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') - if n =~ '\<tclsh\|\<wish' - setf tcl - return - endif - endif - exe "setf " . a:name -endfunc +" Shell script (Arch Linux) or PHP file (Drupal) +au BufNewFile,BufRead *.install + \ if getline(1) =~ '<?php' | + \ setf php | + \ else | + \ call dist#ft#SetFileTypeSH("bash") | + \ endif " tcsh scripts -au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh") +au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call dist#ft#SetFileTypeShell("tcsh") " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) -au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH() - -func! s:CSH() - if exists("g:filetype_csh") - call SetFileTypeShell(g:filetype_csh) - elseif &shell =~ "tcsh" - call SetFileTypeShell("tcsh") - else - call SetFileTypeShell("csh") - endif -endfunc +au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call dist#ft#CSH() " Z-Shell script au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh @@ -2001,38 +1549,7 @@ au BufNewFile,BufRead *.mib,*.my setf mib " Snort Configuration au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog -au BufNewFile,BufRead *.rules call s:FTRules() - -let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' -func! s:FTRules() - let path = expand('<amatch>:p') - if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$' - setf udevrules - return - endif - if path =~ '^/etc/ufw/' - setf conf " Better than hog - return - endif - try - let config_lines = readfile('/etc/udev/udev.conf') - catch /^Vim\%((\a\+)\)\=:E484/ - setf hog - return - endtry - let dir = expand('<amatch>:p:h') - for line in config_lines - if line =~ s:ft_rules_udev_rules_pattern - let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") - if dir == udev_rules - setf udevrules - endif - break - endif - endfor - setf hog -endfunc - +au BufNewFile,BufRead *.rules call dist#ft#FTRules() " Spec (Linux RPM) au BufNewFile,BufRead *.spec setf spec @@ -2056,15 +1573,7 @@ au BufNewFile,BufRead squid.conf setf squid au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql " SQL -au BufNewFile,BufRead *.sql call s:SQL() - -func! s:SQL() - if exists("g:filetype_sql") - exe "setf " . g:filetype_sql - else - setf sql - endif -endfunc +au BufNewFile,BufRead *.sql call dist#ft#SQL() " SQLJ au BufNewFile,BufRead *.sqlj setf sqlj @@ -2079,7 +1588,10 @@ au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig au BufNewFile,BufRead sshd_config setf sshdconfig " Stata -au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata +au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata setf stata +" Also *.class, but not when it's a Java bytecode file +au BufNewFile,BufRead *.class + \ if getline(1) !~ "^\xca\xfe\xba\xbe" | setf stata | endif " SMCL au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl @@ -2096,6 +1608,9 @@ au BufNewFile,BufRead *.cm setf voscm " Sysctl au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl +" Systemd unit files +au BufNewFile,BufRead */systemd/*.{automount,mount,path,service,socket,swap,target,timer} setf systemd + " Synopsys Design Constraints au BufNewFile,BufRead *.sdc setf sdc @@ -2105,32 +1620,9 @@ au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers " SVG (Scalable Vector Graphics) au BufNewFile,BufRead *.svg setf svg -" If the file has an extension of 't' and is in a directory 't' or 'xt' then -" it is almost certainly a Perl test file. -" If the first line starts with '#' and contains 'perl' it's probably a Perl -" file. -" (Slow test) If a file contains a 'use' statement then it is almost certainly -" a Perl file. -func! s:FTperl() - let dirname = expand("%:p:h:t") - if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt') - setf perl - return 1 - endif - if getline(1)[0] == '#' && getline(1) =~ 'perl' - setf perl - return 1 - endif - if search('^use\s\s*\k', 'nc', 30) - setf perl - return 1 - endif - return 0 -endfunc - " Tads (or Nroff or Perl test file) au BufNewFile,BufRead *.t - \ if !s:FTnroff() && !s:FTperl() | setf tads | endif + \ if !dist#ft#FTnroff() && !dist#ft#FTperl() | setf tads | endif " Tags au BufNewFile,BufRead tags setf tags @@ -2151,67 +1643,18 @@ au BufNewFile,BufRead *.tli setf tli " Telix Salt au BufNewFile,BufRead *.slt setf tsalt +" Tera Term Language +au BufRead,BufNewFile *.ttl setf teraterm + " Terminfo au BufNewFile,BufRead *.ti setf terminfo " TeX au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex -au BufNewFile,BufRead *.tex call s:FTtex() - -" Choose context, plaintex, or tex (LaTeX) based on these rules: -" 1. Check the first line of the file for "%&<format>". -" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. -" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. -func! s:FTtex() - let firstline = getline(1) - if firstline =~ '^%&\s*\a\+' - let format = tolower(matchstr(firstline, '\a\+')) - let format = substitute(format, 'pdf', '', '') - if format == 'tex' - let format = 'plain' - endif - else - " Default value, may be changed later: - let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' - " Save position, go to the top of the file, find first non-comment line. - let save_cursor = getpos('.') - call cursor(1,1) - let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) - if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. - let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' - let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>' - let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', - \ 'cnp', firstNC + 1000) - if kwline == 1 " lpat matched - let format = 'latex' - elseif kwline == 2 " cpat matched - let format = 'context' - endif " If neither matched, keep default set above. - " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) - " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) - " if cline > 0 - " let format = 'context' - " endif - " if lline > 0 && (cline == 0 || cline > lline) - " let format = 'tex' - " endif - endif " firstNC - call setpos('.', save_cursor) - endif " firstline =~ '^%&\s*\a\+' - - " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? - if format == 'plain' - setf plaintex - elseif format == 'context' - setf context - else " probably LaTeX - setf tex - endif - return -endfunc +au BufNewFile,BufRead *.tex call dist#ft#FTtex() " ConTeXt -au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv setf context +au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi setf context " Texinfo au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo @@ -2225,6 +1668,9 @@ au BufNewFile,BufRead .tidyrc,tidyrc setf tidy " TF mud client au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf +" tmux configuration +au BufNewFile,BufRead {.,}tmux*.conf setf tmux + " TPP - Text Presentation Program au BufNewFile,BufReadPost *.tpp setf tpp @@ -2268,7 +1714,7 @@ au BufNewFile,BufRead */etc/updatedb.conf setf updatedb au BufNewFile,BufRead */usr/share/upstart/*.conf setf upstart au BufNewFile,BufRead */usr/share/upstart/*.override setf upstart au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override setf upstart -au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart +au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart au BufNewFile,BufRead */.config/upstart/*.conf setf upstart au BufNewFile,BufRead */.config/upstart/*.override setf upstart @@ -2303,7 +1749,7 @@ au BufRead,BufNewFile *.hw,*.module,*.pkg \ endif " Visual Basic (also uses *.bas) or FORM -au BufNewFile,BufRead *.frm call s:FTVB("form") +au BufNewFile,BufRead *.frm call dist#ft#FTVB("form") " SaxBasic is close to Visual Basic au BufNewFile,BufRead *.sba setf vb @@ -2332,6 +1778,9 @@ au BufNewFile,BufRead *.wbt setf winbatch " WSML au BufNewFile,BufRead *.wsml setf wsml +" WPL +au BufNewFile,BufRead *.wpl setf xml + " WvDial au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial @@ -2390,36 +1839,10 @@ au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xd " Xmath au BufNewFile,BufRead *.msc,*.msf setf xmath au BufNewFile,BufRead *.ms - \ if !s:FTnroff() | setf xmath | endif + \ if !dist#ft#FTnroff() | setf xmath | endif " XML specific variants: docbk and xbl -au BufNewFile,BufRead *.xml call s:FTxml() - -func! s:FTxml() - let n = 1 - while n < 100 && n < line("$") - let line = getline(n) - " DocBook 4 or DocBook 5. - let is_docbook4 = line =~ '<!DOCTYPE.*DocBook' - let is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"' - if is_docbook4 || is_docbook5 - let b:docbk_type = "xml" - if is_docbook5 - let b:docbk_ver = 5 - else - let b:docbk_ver = 4 - endif - setf docbk - return - endif - if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"' - setf xbl - return - endif - let n += 1 - endwhile - setf xml -endfunc +au BufNewFile,BufRead *.xml call dist#ft#FTxml() " XMI (holding UML models) is also XML au BufNewFile,BufRead *.xmi setf xml @@ -2462,41 +1885,25 @@ au BufNewFile,BufRead *.xsl,*.xslt setf xslt au BufNewFile,BufRead *.yy,*.yxx,*.y++ setf yacc " Yacc or racc -au BufNewFile,BufRead *.y call s:FTy() - -func! s:FTy() - let n = 1 - while n < 100 && n < line("$") - let line = getline(n) - if line =~ '^\s*%' - setf yacc - return - endif - if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' - setf racc - return - endif - let n = n + 1 - endwhile - setf yacc -endfunc +au BufNewFile,BufRead *.y call dist#ft#FTy() - -" Yaml -au BufNewFile,BufRead *.yaml,*.yml setf yaml +" Yaml or Raml +au BufNewFile,BufRead *.yaml,*.yml,*.raml setf yaml " yum conf (close enough to dosini) au BufNewFile,BufRead */etc/yum.conf setf dosini " Zimbu au BufNewFile,BufRead *.zu setf zimbu +" Zimbu Templates +au BufNewFile,BufRead *.zut setf zimbutempl " Zope " dtml (zope dynamic template markup language), pt (zope page template), " cpt (zope form controller page template) -au BufNewFile,BufRead *.dtml,*.pt,*.cpt call s:FThtml() +au BufNewFile,BufRead *.dtml,*.pt,*.cpt call dist#ft#FThtml() " zsql (zope sql method) -au BufNewFile,BufRead *.zsql call s:SQL() +au BufNewFile,BufRead *.zsql call dist#ft#SQL() " Z80 assembler asz80 au BufNewFile,BufRead *.z8a setf z8a @@ -2527,6 +1934,9 @@ au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif " Most of these should call s:StarSetf() to avoid names ending in .gz and the " like are used. +" More Apache style config files +au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/* call s:StarSetf('apachestyle') + " More Apache config files au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') @@ -2538,6 +1948,11 @@ au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') " Bazaar version control au BufNewFile,BufRead bzr_log.* setf bzr +" Bazel build file +if !has("fname_case") + au BufNewFile,BufRead BUILD setf bzl +endif + " BIND zone au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') @@ -2605,7 +2020,9 @@ au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') " Mail (also matches muttrc.vim, so this is below the other checks) -au BufNewFile,BufRead mutt[[:alnum:]._-]\\\{6\} setf mail +au BufNewFile,BufRead {neo,}mutt[[:alnum:]._-]\\\{6\} setf mail + +au BufNewFile,BufRead reportbug-* call s:StarSetf('mail') " Modconf au BufNewFile,BufRead */etc/modutils/* @@ -2618,9 +2035,16 @@ au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') +" Neomutt setup file +au BufNewFile,BufRead .neomuttrc*,*/.neomutt/neomuttrc* call s:StarSetf('neomuttrc') +au BufNewFile,BufRead neomuttrc*,Neomuttrc* call s:StarSetf('neomuttrc') + " Nroff macros au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') +" OpenBSD hostname.if +au BufNewFile,BufRead /etc/hostname.* call s:StarSetf('config') + " Pam conf au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf') @@ -2636,17 +2060,7 @@ au BufNewFile,BufRead *termcap* " ReDIF " Only used when the .rdf file was not detected to be XML. -au BufRead,BufNewFile *.rdf call s:Redif() -func! s:Redif() - let lnum = 1 - while lnum <= 5 && lnum < line('$') - if getline(lnum) =~ "^\ctemplate-type:" - setf redif - return - endif - let lnum = lnum + 1 - endwhile -endfunc +au BufRead,BufNewFile *.rdf call dist#ft#Redif() " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') @@ -2684,7 +2098,13 @@ au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') " Plain text files, needs to be far down to not override others. This avoids " the "conf" type being used if there is a line starting with '#'. -au BufNewFile,BufRead *.txt,*.text,README setf text +au BufNewFile,BufRead *.text,README setf text + +" Help files match *.txt but should have a last line that is a modeline. +au BufNewFile,BufRead *.txt + \ if getline('$') !~ 'vim:.*ft=help' + \| setf text + \| endif " Use the filetype detect plugins. They may overrule any of the previously @@ -2696,12 +2116,12 @@ runtime! ftdetect/*.vim " state. augroup END -" Generic configuration file (check this last, it's just guessing!) +" Generic configuration file. Use FALLBACK, it's just guessing! au filetypedetect BufNewFile,BufRead,StdinReadPost * \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#' \ || getline(4) =~ '^#' || getline(5) =~ '^#') | - \ setf conf | + \ setf FALLBACK conf | \ endif diff --git a/runtime/ftplugin/a2ps.vim b/runtime/ftplugin/a2ps.vim index 6653351949..0e24e3088f 100644 --- a/runtime/ftplugin/a2ps.vim +++ b/runtime/ftplugin/a2ps.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: a2ps(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: a2ps(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/alsaconf.vim b/runtime/ftplugin/alsaconf.vim index 5d763c8011..6d9d80a208 100644 --- a/runtime/ftplugin/alsaconf.vim +++ b/runtime/ftplugin/alsaconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: alsaconf(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: alsaconf(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/arch.vim b/runtime/ftplugin/arch.vim index 71d831e112..1c697b8ca1 100644 --- a/runtime/ftplugin/arch.vim +++ b/runtime/ftplugin/arch.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: GNU Arch inventory file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: GNU Arch inventory file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/automake.vim b/runtime/ftplugin/automake.vim index 20b06af362..9f981a7a83 100644 --- a/runtime/ftplugin/automake.vim +++ b/runtime/ftplugin/automake.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Automake -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Automake +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim new file mode 100644 index 0000000000..dcefc85ec3 --- /dev/null +++ b/runtime/ftplugin/awk.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin +" Language: awk, nawk, gawk, mawk +" Maintainer: Antonio Colombo <azc100@gmail.com> +" Last Change: 2017 Feb 17 + +" This plugin was prepared by Mark Sikora + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring<" + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/bdf.vim b/runtime/ftplugin/bdf.vim index 120c5df968..85b7b4042a 100644 --- a/runtime/ftplugin/bdf.vim +++ b/runtime/ftplugin/bdf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: BDF font definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: BDF font definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/bzl.vim b/runtime/ftplugin/bzl.vim new file mode 100644 index 0000000000..0296b0c0b8 --- /dev/null +++ b/runtime/ftplugin/bzl.vim @@ -0,0 +1,94 @@ +" Vim filetype plugin file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +"" +" @section Introduction, intro +" Core settings for the bzl filetype, used for BUILD and *.bzl files for the +" Bazel build system (http://bazel.io/). + +if exists('b:did_ftplugin') + finish +endif + + +" Vim 7.4.051 has opinionated settings in ftplugin/python.vim that try to force +" PEP8 conventions on every python file, but these conflict with Google's +" indentation guidelines. As a workaround, we explicitly source the system +" ftplugin, but save indentation settings beforehand and restore them after. +let s:save_expandtab = &l:expandtab +let s:save_shiftwidth = &l:shiftwidth +let s:save_softtabstop = &l:softtabstop +let s:save_tabstop = &l:tabstop + +" NOTE: Vim versions before 7.3.511 had a ftplugin/python.vim that was broken +" for compatible mode. +let s:save_cpo = &cpo +set cpo&vim + +" Load base python ftplugin (also defines b:did_ftplugin). +source $VIMRUNTIME/ftplugin/python.vim + +" NOTE: Vim versions before 7.4.104 and later set this in ftplugin/python.vim. +setlocal comments=b:#,fb:- + +" Restore pre-existing indentation settings. +let &l:expandtab = s:save_expandtab +let &l:shiftwidth = s:save_shiftwidth +let &l:softtabstop = s:save_softtabstop +let &l:tabstop = s:save_tabstop + +setlocal formatoptions-=t + +" Make gf work with imports in BUILD files. +setlocal includeexpr=substitute(v:fname,'//','','') + +" Enable syntax-based folding, if specified. +if get(g:, 'ft_bzl_fold', 0) + setlocal foldmethod=syntax + setlocal foldtext=BzlFoldText() +endif + +if exists('*BzlFoldText') + finish +endif + +function BzlFoldText() abort + let l:start_num = nextnonblank(v:foldstart) + let l:end_num = prevnonblank(v:foldend) + + if l:end_num <= l:start_num + 1 + " If the fold is empty, don't print anything for the contents. + let l:content = '' + else + " Otherwise look for something matching the content regex. + " And if nothing matches, print an ellipsis. + let l:content = '...' + for l:line in getline(l:start_num + 1, l:end_num - 1) + let l:content_match = matchstr(l:line, '\m\C^\s*name = \zs.*\ze,$') + if !empty(l:content_match) + let l:content = l:content_match + break + endif + endfor + endif + + " Enclose content with start and end + let l:start_text = getline(l:start_num) + let l:end_text = substitute(getline(l:end_num), '^\s*', '', '') + let l:text = l:start_text . ' ' . l:content . ' ' . l:end_text + + " Compute the available width for the displayed text. + let l:width = winwidth(0) - &foldcolumn - (&number ? &numberwidth : 0) + let l:lines_folded = ' ' . string(1 + v:foldend - v:foldstart) . ' lines' + + " Expand tabs, truncate, pad, and concatenate + let l:text = substitute(l:text, '\t', repeat(' ', &tabstop), 'g') + let l:text = strpart(l:text, 0, l:width - len(l:lines_folded)) + let l:padding = repeat(' ', l:width - len(l:lines_folded) - len(l:text)) + return l:text . l:padding . l:lines_folded +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 19e8c51edb..371a78cbcd 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Jul 10 +" Last Change: 2017 Sep 28 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -35,9 +35,9 @@ if has("vms") endif " When the matchit plugin is loaded, this makes the % command skip parens and -" braces in comments. -let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' -let b:match_skip = 's:comment\|string\|character' +" braces in comments properly. +let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' +let b:match_skip = 's:comment\|string\|character\|special' " Win32 can filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") diff --git a/runtime/ftplugin/calendar.vim b/runtime/ftplugin/calendar.vim index 6f117e36e5..f454ba1dc8 100644 --- a/runtime/ftplugin/calendar.vim +++ b/runtime/ftplugin/calendar.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: calendar(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: calendar(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/cdrdaoconf.vim b/runtime/ftplugin/cdrdaoconf.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/cdrdaoconf.vim +++ b/runtime/ftplugin/cdrdaoconf.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim index 244245e271..257e9cd9d4 100644 --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: generic Changelog file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2014-01-10 +" Language: generic Changelog file +" Maintainer: Martin Florian <marfl@posteo.de> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-10-25 " Variables: " g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) - " description: the timeformat used in ChangeLog entries. @@ -167,7 +168,7 @@ if &filetype == 'changelog' let cursor = stridx(line, '{cursor}') call setline(lnum, substitute(line, '{cursor}', '', '')) endif - startinsert! + startinsert endfunction " Internal function to create a new entry in the ChangeLog. @@ -223,7 +224,8 @@ if &filetype == 'changelog' endfunction if exists(":NewChangelogEntry") != 2 - noremap <buffer> <silent> <Leader>o <Esc>:call <SID>new_changelog_entry('')<CR> + nnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR> + xnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR> command! -nargs=0 NewChangelogEntry call s:new_changelog_entry('') endif diff --git a/runtime/ftplugin/chicken.vim b/runtime/ftplugin/chicken.vim new file mode 100644 index 0000000000..4dc1e57d0a --- /dev/null +++ b/runtime/ftplugin/chicken.vim @@ -0,0 +1,54 @@ +" CHICKEN-specific Vim customizations +" Last Change: 2018-03-05 +" Author: Evan Hanson <evhan@foldling.org> +" Maintainer: Evan Hanson <evhan@foldling.org> +" URL: https://foldling.org/vim/ftplugin/chicken.vim +" Notes: These are supplemental settings, to be loaded after the core +" Scheme ftplugin file (ftplugin/scheme.vim). Enable it by setting +" b:is_chicken=1 and filetype=scheme. + +if !exists('b:did_scheme_ftplugin') + finish +endif + +setl keywordprg=chicken-doc + +setl lispwords+=and-let* +setl lispwords+=compiler-typecase +setl lispwords+=condition-case +setl lispwords+=define-compiler-syntax +setl lispwords+=define-constant +setl lispwords+=define-external +setl lispwords+=define-for-syntax +setl lispwords+=define-foreign-type +setl lispwords+=define-inline +setl lispwords+=define-location +setl lispwords+=define-record +setl lispwords+=define-record-printer +setl lispwords+=define-specialization +setl lispwords+=fluid-let +setl lispwords+=foreign-lambda* +setl lispwords+=foreign-primitive +setl lispwords+=foreign-safe-lambda* +setl lispwords+=functor +setl lispwords+=handle-exceptions +setl lispwords+=let-compiler-syntax +setl lispwords+=let-location +setl lispwords+=let-optionals +setl lispwords+=let-optionals* +setl lispwords+=letrec-values +setl lispwords+=match +setl lispwords+=match-let +setl lispwords+=match-let* +setl lispwords+=match-letrec +setl lispwords+=module +setl lispwords+=receive +setl lispwords+=set!-values +setl lispwords+=test-group + +let b:undo_ftplugin = b:undo_ftplugin . ' keywordprg<' + +if exists('g:loaded_matchit') && !exists('b:match_words') + let b:match_words = '#>:<#' + let b:undo_ftplugin = b:undo_ftplugin . ' | unlet! b:match_words' +endif diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim index 10fcb9f205..217711f26e 100644 --- a/runtime/ftplugin/clojure.vim +++ b/runtime/ftplugin/clojure.vim @@ -1,11 +1,11 @@ " Vim filetype plugin file -" Language: Clojure -" Author: Meikel Brandmeyer <mb@kotka.de> +" Language: Clojure +" Author: Meikel Brandmeyer <mb@kotka.de> " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:did_ftplugin") finish @@ -43,7 +43,7 @@ setlocal commentstring=;\ %s " specially and hence are not indented specially. " " -*- LISPWORDS -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test " Provide insert mode completions for special forms and clojure.core. As @@ -82,9 +82,9 @@ endif " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" . - \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . - \ "Java Source Files (*.java)\t*.java\n" . - \ "All Files (*.*)\t*.*\n" + \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . + \ "Java Source Files (*.java)\t*.java\n" . + \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/cmake.vim b/runtime/ftplugin/cmake.vim new file mode 100644 index 0000000000..e81cd4071c --- /dev/null +++ b/runtime/ftplugin/cmake.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: CMake +" Maintainer: Keith Smiley <keithbsmiley@gmail.com> +" Last Change: 2017 Dec 24 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring<" + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/conf.vim b/runtime/ftplugin/conf.vim index 1b110e475b..ff2add1fa3 100644 --- a/runtime/ftplugin/conf.vim +++ b/runtime/ftplugin/conf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: generic configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: generic configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/context.vim b/runtime/ftplugin/context.vim index 1c7d678375..10f1ae1648 100644 --- a/runtime/ftplugin/context.vim +++ b/runtime/ftplugin/context.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: ConTeXt typesetting engine -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 30 if exists("b:did_ftplugin") finish @@ -11,16 +12,26 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo<" +if !exists('current_compiler') + compiler context +endif + +let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" + \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" -setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tcroql +setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2 +if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + setlocal omnifunc=contextcomplete#Complete + let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+' + let g:omni_syntax_group_exclude_context = 'mfTodoComment' +endif let &l:define='\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' \ . 'def\|\\font\|\\\%(future\)\=let' \ . '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' \ . '\|fam\|insert\|if\)' -let &l:include = '^\s*\%(input\|component\)' +let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' setlocal suffixesadd=.tex @@ -31,5 +42,61 @@ if exists("loaded_matchit") \ '\\start\(\a\+\):\\stop\1' endif +let s:context_regex = { + \ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', + \ 'endsection' : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', + \ 'beginblock' : '\\\%(start\|setup\|define\)', + \ 'endblock' : '\\\%(stop\|setup\|define\)' + \ } + +function! s:move_around(count, what, flags, visual) + if a:visual + exe "normal! gv" + endif + call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark + call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)') +endfunction + +" Move around macros. +nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> +vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> +nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> +vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> +nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> +vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> +nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> +vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> + +" Other useful mappings +if get(g:, 'context_mappings', 1) + let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)' + + fun! s:tp() + call cursor(search(s:tp_regex, 'bcW') + 1, 1) + normal! V + call cursor(search(s:tp_regex, 'W') - 1, 1) + endf + + " Reflow paragraphs with commands like gqtp ("gq TeX paragraph") + onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr> + " Select TeX paragraph + vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr> + + " $...$ text object + onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr> + onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr> + vnoremap <buffer> i$ T$ot$ + vnoremap <buffer> a$ F$of$ +endif + +" Commands for asynchronous typesetting +command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>) +command! -nargs=0 ConTeXtJobStatus call context#job_status() +command! -nargs=0 ConTeXtStopJobs call context#stop_jobs() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/crm.vim b/runtime/ftplugin/crm.vim index e86e683068..06baee883a 100644 --- a/runtime/ftplugin/crm.vim +++ b/runtime/ftplugin/crm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: CRM114 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: CRM114 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/css.vim b/runtime/ftplugin/css.vim index 43d1edfa5b..ea4424418c 100644 --- a/runtime/ftplugin/css.vim +++ b/runtime/ftplugin/css.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: CSS -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: CSS +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim index 2ec1a5976f..f4848d1c60 100644 --- a/runtime/ftplugin/cucumber.vim +++ b/runtime/ftplugin/cucumber.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 Jun 01 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -19,27 +19,23 @@ setlocal omnifunc=CucumberComplete let b:undo_ftplugin = "setl fo< com< cms< ofu<" let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??') +if !exists("b:cucumber_steps_glob") + let b:cucumber_steps_glob = b:cucumber_root.'/**/*.rb' +endif if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps") - nnoremap <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR> - nnoremap <silent><buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR> - nnoremap <silent><buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<CR> - nnoremap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR> - nnoremap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR> - nnoremap <silent><buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<CR> - nnoremap <silent><buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<CR> - nnoremap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR> - nnoremap <silent><buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR> - nnoremap <silent><buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR> + cnoremap <SID>foldopen <Bar>if &foldopen =~# 'tag'<Bar>exe 'norm! zv'<Bar>endif + nnoremap <silent> <script> <buffer> [<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR> + nnoremap <silent> <script> <buffer> ]<C-D> :<C-U>exe <SID>jump('edit',v:count)<SID>foldopen<CR> + nnoremap <silent> <script> <buffer> <C-W>d :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR> + nnoremap <silent> <script> <buffer> <C-W><C-D> :<C-U>exe <SID>jump('split',v:count)<SID>foldopen<CR> + nnoremap <silent> <script> <buffer> [d :<C-U>exe <SID>jump('pedit',v:count)<CR> + nnoremap <silent> <script> <buffer> ]d :<C-U>exe <SID>jump('pedit',v:count)<CR> let b:undo_ftplugin .= - \ "|sil! nunmap <buffer> <C-]>" . \ "|sil! nunmap <buffer> [<C-D>" . \ "|sil! nunmap <buffer> ]<C-D>" . - \ "|sil! nunmap <buffer> <C-W>]" . - \ "|sil! nunmap <buffer> <C-W><C-]>" . \ "|sil! nunmap <buffer> <C-W>d" . \ "|sil! nunmap <buffer> <C-W><C-D>" . - \ "|sil! nunmap <buffer> <C-W>}" . \ "|sil! nunmap <buffer> [d" . \ "|sil! nunmap <buffer> ]d" endif @@ -59,7 +55,7 @@ endfunction function! s:allsteps() let step_pattern = '\C^\s*\K\k*\>\s*(\=\s*\zs\S.\{-\}\ze\s*)\=\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)' let steps = [] - for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n") + for file in split(glob(b:cucumber_steps_glob),"\n") let lines = readfile(file) let num = 0 for line in lines diff --git a/runtime/ftplugin/cvsrc.vim b/runtime/ftplugin/cvsrc.vim index c410530588..34b148409e 100644 --- a/runtime/ftplugin/cvsrc.vim +++ b/runtime/ftplugin/cvsrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: cvs(1) RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: cvs(1) RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index d2718db88e..a78f7811f1 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -1,22 +1,22 @@ " Vim filetype plugin file (GUI menu, folding and completion) " Language: Debian Changelog -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel <piefel@informatik.hu-berlin.de> " Stefano Zacchiroli <zack@debian.org> -" Last Change: 2014-01-31 +" Last Change: 2018-01-28 " License: Vim License -" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/debchangelog.vim +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim " Bug completion requires apt-listbugs installed for Debian packages or " python-launchpadlib installed for Ubuntu packages -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif let b:did_ftplugin=1 " {{{1 Local settings (do on every load) -if exists("g:debchangelog_fold_enable") +if exists('g:debchangelog_fold_enable') setlocal foldmethod=expr setlocal foldexpr=DebGetChangelogFold(v:lnum) setlocal foldtext=DebChangelogFoldText() @@ -28,10 +28,10 @@ setlocal tw=78 setlocal comments=f:* " Clean unloading -let b:undo_ftplugin = "setlocal tw< comments< foldmethod< foldexpr< foldtext<" +let b:undo_ftplugin = 'setlocal tw< comments< foldmethod< foldexpr< foldtext<' " }}}1 -if exists("g:did_changelog_ftplugin") +if exists('g:did_changelog_ftplugin') finish endif @@ -44,41 +44,41 @@ let g:did_changelog_ftplugin = 1 " Returns full name, either from $DEBFULLNAME or debianfullname. " TODO Is there a way to determine name from anywhere else? function <SID>FullName() - if exists("$DEBFULLNAME") + if exists('$DEBFULLNAME') return $DEBFULLNAME - elseif exists("g:debianfullname") + elseif exists('g:debianfullname') return g:debianfullname else - return "Your Name" + return 'Your Name' endif endfunction " Returns email address, from $DEBEMAIL, $EMAIL or debianemail. function <SID>Email() - if exists("$DEBEMAIL") + if exists('$DEBEMAIL') return $DEBEMAIL - elseif exists("$EMAIL") + elseif exists('$EMAIL') return $EMAIL - elseif exists("g:debianemail") + elseif exists('g:debianemail') return g:debianemail else - return "your@email.address" + return 'your@email.address' endif endfunction " Returns date in RFC822 format. function <SID>Date() let savelang = v:lc_time - execute "language time C" - let dateandtime = strftime("%a, %d %b %Y %X %z") - execute "language time " . savelang + execute 'language time C' + let dateandtime = strftime('%a, %d %b %Y %X %z') + execute 'language time ' . savelang return dateandtime endfunction function <SID>WarnIfNotUnfinalised() - if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + if match(getline('.'), ' -- [[:alpha:]][[:alnum:].]')!=-1 echohl WarningMsg - echo "The entry has not been unfinalised before editing." + echo 'The entry has not been unfinalised before editing.' echohl None return 1 endif @@ -86,10 +86,10 @@ function <SID>WarnIfNotUnfinalised() endfunction function <SID>Finalised() - let savelinenum = line(".") - normal 1G - call search("^ -- ") - if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + let savelinenum = line('.') + 1 + call search('^ -- ') + if match(getline('.'), ' -- [[:alpha:]][[:alnum:].]')!=-1 let returnvalue = 1 else let returnvalue = 0 @@ -109,54 +109,54 @@ function NewVersion() amenu disable Changelog.Unfinalise amenu enable Changelog.Finalise call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', '')) - call append(1, "") - call append(2, "") - call append(3, " -- ") - call append(4, "") - call Urgency("low") - normal 1G0 - call search(")") - normal h - normal  + call append(1, '') + call append(2, '') + call append(3, ' -- ') + call append(4, '') + call Urgency('low') + normal! 1G0 + call search(')') + normal! h + normal!  call setline(1, substitute(getline(1), '-\$\$', '-', '')) - if exists("g:debchangelog_fold_enable") + if exists('g:debchangelog_fold_enable') foldopen endif call AddEntry() endfunction function AddEntry() - normal 1G - call search("^ -- ") - normal kk - call append(".", " * ") - normal jjj + 1 + call search('^ -- ') + .-2 + call append('.', ' * ') + .+3 let warn=<SID>WarnIfNotUnfinalised() - normal kk + .-2 if warn echohl MoreMsg - call input("Hit ENTER") + call input('Hit ENTER') echohl None endif startinsert! endfunction function CloseBug() - normal 1G - call search("^ -- ") + 1 + call search('^ -- ') let warn=<SID>WarnIfNotUnfinalised() - normal kk - call append(".", " * (closes: #" . input("Bug number to close: ") . ")") - normal j^ll + .-2 + call append('.', ' * (closes: #' . input('Bug number to close: ') . ')') + normal! j^ll startinsert endfunction function Distribution(dist) - call setline(1, substitute(getline(1), ') *\%(UNRELEASED\|\l\+\);', ") " . a:dist . ";", "")) + call setline(1, substitute(getline(1), ') *\%(UNRELEASED\|\l\+\);', ') ' . a:dist . ';', '')) endfunction function Urgency(urg) - call setline(1, substitute(getline(1), "urgency=.*$", "urgency=" . a:urg, "")) + call setline(1, substitute(getline(1), 'urgency=.*$', 'urgency=' . a:urg, '')) endfunction function <SID>UnfinaliseMenu() @@ -172,9 +172,9 @@ endfunction function Unfinalise() call <SID>UnfinaliseMenu() - normal 1G - call search("^ -- ") - call setline(".", " -- ") + 1 + call search('^ -- ') + call setline('.', ' -- ') endfunction function <SID>FinaliseMenu() @@ -190,9 +190,9 @@ endfunction function Finalise() call <SID>FinaliseMenu() - normal 1G - call search("^ -- ") - call setline(".", " -- " . <SID>FullName() . " <" . <SID>Email() . "> " . <SID>Date()) + 1 + call search('^ -- ') + call setline('.', ' -- ' . <SID>FullName() . ' <' . <SID>Email() . '> ' . <SID>Date()) endfunction @@ -239,7 +239,7 @@ function! s:getAuthor(zonestart, zoneend) let linepos = a:zoneend while linepos >= a:zonestart let line = getline(linepos) - if line =~ '^ --' + if line =~# '^ --' return substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '') endif let linepos -= 1 @@ -254,7 +254,7 @@ function! DebGetPkgSrcName(lineno) let pkgname = '' while lineidx > 0 let curline = getline(lineidx) - if curline =~ '^\S' + if curline =~# '^\S' let pkgname = matchlist(curline, '^\(\S\+\).*$')[1] break endif @@ -264,7 +264,7 @@ function! DebGetPkgSrcName(lineno) endfunction function! DebChangelogFoldText() - if v:folddashes == '-' " changelog entry fold + if v:folddashes ==# '-' " changelog entry fold return foldtext() . ' -- ' . s:getAuthor(v:foldstart, v:foldend) . ' ' endif return foldtext() @@ -272,19 +272,19 @@ endfunction function! DebGetChangelogFold(lnum) let line = getline(a:lnum) - if line =~ '^\w\+' + if line =~# '^\w\+' return '>1' " beginning of a changelog entry endif - if line =~ '^\s\+\[.*\]' + if line =~# '^\s\+\[.*\]' return '>2' " beginning of an author-specific chunk endif - if line =~ '^ --' + if line =~# '^ --' return '1' endif return '=' endfunction -if exists("g:debchangelog_fold_enable") +if exists('g:debchangelog_fold_enable') silent! foldopen! " unfold the entry the cursor is on (usually the first one) endif @@ -305,13 +305,13 @@ fun! DebCompleteBugs(findstart, base) let try_colidx = col('.') - 1 let colidx = -1 " default to no-completion-possible - while try_colidx > 0 && line[try_colidx - 1] =~ '\s\|\d\|#\|,\|:' + while try_colidx > 0 && line[try_colidx - 1] =~# '\s\|\d\|#\|,\|:' let try_colidx = try_colidx - 1 - if line[try_colidx] == '#' && colidx == -1 + if line[try_colidx] ==# '#' && colidx == -1 " found hash, where we complete from: let colidx = try_colidx - elseif line[try_colidx] == ':' - if try_colidx > 1 && strpart(line, try_colidx - 2, 3) =~ '\clp:' + elseif line[try_colidx] ==# ':' + if try_colidx > 1 && strpart(line, try_colidx - 2, 3) =~? '\clp:' let g:debchangelog_complete_mode = 'lp' endif break @@ -320,7 +320,7 @@ fun! DebCompleteBugs(findstart, base) return colidx else " return matches: let bug_lines = [] - if g:debchangelog_complete_mode == 'lp' + if g:debchangelog_complete_mode ==? 'lp' if ! has('python') echoerr 'vim must be built with Python support to use LP bug completion' return @@ -363,7 +363,7 @@ EOF for line in bug_lines let parts = matchlist(line, '^\s*\(#\S\+\)\s*-\s*\(.*\)$') " filter only those which match a:base: - if parts[1] !~ "^" . a:base + if parts[1] !~ '^' . a:base continue endif let completion = {} diff --git a/runtime/ftplugin/debcontrol.vim b/runtime/ftplugin/debcontrol.vim index 7871d9897f..3a6e39a682 100644 --- a/runtime/ftplugin/debcontrol.vim +++ b/runtime/ftplugin/debcontrol.vim @@ -1,18 +1,18 @@ " Vim filetype plugin file (GUI menu and folding) " Language: Debian control files -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Maintainer: Debian Vim Maintainers " Former Maintainer: Pierre Habouzit <madcoder@debian.org> -" Last Change: 2008-03-08 -" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/ftplugin/debcontrol.vim +" Last Change: 2018-01-28 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debcontrol.vim " Do these settings once per buffer -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif let b:did_ftplugin=1 " {{{1 Local settings (do on every load) -if exists("g:debcontrol_fold_enable") +if exists('g:debcontrol_fold_enable') setlocal foldmethod=expr setlocal foldexpr=DebControlFold(v:lnum) setlocal foldtext=DebControlFoldText() @@ -20,7 +20,7 @@ endif setlocal textwidth=0 " Clean unloading -let b:undo_ftplugin = "setlocal tw< foldmethod< foldexpr< foldtext<" +let b:undo_ftplugin = 'setlocal tw< foldmethod< foldexpr< foldtext<' " }}}1 @@ -32,7 +32,7 @@ function! s:getField(f, lnum) while line !~ '^'.a:f.':' let fwdsteps += 1 let line = getline(a:lnum + fwdsteps) - if line == '' + if line ==# '' return 'unknown' endif endwhile @@ -40,9 +40,9 @@ function! s:getField(f, lnum) endfunction function! DebControlFoldText() - if v:folddashes == '-' " debcontrol entry fold + if v:folddashes ==# '-' " debcontrol entry fold let type = substitute(getline(v:foldstart), ':.*', '', '') - if type == 'Source' + if type ==# 'Source' let ftext = substitute(foldtext(), ' *Source: *', ' ', '') return ftext . ' -- ' . s:getField('Maintainer', v:foldstart) . ' ' endif @@ -56,11 +56,11 @@ endfunction function! DebControlFold(l) " This is for not merging blank lines around folds to them - if getline(a:l) =~ '^Source:' + if getline(a:l) =~# '^Source:' return '>1' endif - if getline(a:l) =~ '^Package:' + if getline(a:l) =~# '^Package:' return '>1' endif diff --git a/runtime/ftplugin/denyhosts.vim b/runtime/ftplugin/denyhosts.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/denyhosts.vim +++ b/runtime/ftplugin/denyhosts.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dictconf.vim b/runtime/ftplugin/dictconf.vim index 659046c176..71a2b67258 100644 --- a/runtime/ftplugin/dictconf.vim +++ b/runtime/ftplugin/dictconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dictdconf.vim b/runtime/ftplugin/dictdconf.vim index ee738c50ce..0ee4c9d7e0 100644 --- a/runtime/ftplugin/dictdconf.vim +++ b/runtime/ftplugin/dictdconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dircolors.vim b/runtime/ftplugin/dircolors.vim index 3b3d046e36..d07d1e34da 100644 --- a/runtime/ftplugin/dircolors.vim +++ b/runtime/ftplugin/dircolors.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dircolors(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dircolors(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dockerfile.vim b/runtime/ftplugin/dockerfile.vim new file mode 100644 index 0000000000..2e3c447b59 --- /dev/null +++ b/runtime/ftplugin/dockerfile.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: Dockerfile +" Maintainer: Honza Pokorny <http://honza.ca> +" Last Change: 2014 Aug 29 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring<" + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/dosini.vim b/runtime/ftplugin/dosini.vim index 461403ca95..0d0f0f8983 100644 --- a/runtime/ftplugin/dosini.vim +++ b/runtime/ftplugin/dosini.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Configuration File (ini file) for MSDOS/MS Windows -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Configuration File (ini file) for MSDOS/MS Windows +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim new file mode 100644 index 0000000000..216fdde162 --- /dev/null +++ b/runtime/ftplugin/eiffel.vim @@ -0,0 +1,96 @@ +" Vim filetype plugin +" Language: Eiffel +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2010 Aug 29 + +if (exists("b:did_ftplugin")) + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=:-- +setlocal commentstring=--\ %s + +setlocal formatoptions-=t formatoptions+=croql + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" . + \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" . + \ "All Files (*.*)\t*.*\n" +endif + +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 0 + " Silly \%^ trick to match note at head of pair and in middle prevents + " 'g%' wrapping from 'note' to 'end' + let b:match_words = '\%^:' . + \ '\<\%(^note\|indexing\|class\|^obsolete\|inherit\|insert\|^create\|convert\|feature\|^invariant\)\>:' . + \ '^end\>,' . + \ '\<\%(do\|deferred\|external\|once\%(\s\+"\)\@!\|check\|debug\|if\|inspect\|from\|across\)\>:' . + \ '\%(\%(^\s\+\)\@<=\%(then\|until\|loop\)\|\%(then\|until\|loop\)\s\+[^ -]\|' . + \ '\<\%(ensure\%(\s\+then\)\=\|rescue\|_then\|elseif\|else\|when\|\s\@<=invariant\|_until\|_loop\|variant\|_as\|alias\)\>\):' . + \ '\s\@<=end\>' + let b:match_skip = 's:\<eiffel\%(Comment\|String\|Operator\)\>' + noremap [% <Nop> + noremap ]% <Nop> + vnoremap a% <Nop> +endif + +let b:undo_ftplugin = "setl fo< com< cms<" . + \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + +if !exists("g:no_plugin_maps") && !exists("g:no_eiffel_maps") + function! s:DoMotion(pattern, count, flags) abort + normal! m' + for i in range(a:count) + call search(a:pattern, a:flags) + endfor + endfunction + + let sections = '^\%(note\|indexing\|' . + \ '\%(\%(deferred\|expanded\|external\|frozen\)\s\+\)*class\|' . + \ 'obsolete\|inherit\|insert\|create\|convert\|feature\|' . + \ 'invariant\|end\)\>' + + nnoremap <silent> <buffer> ]] :<C-U>call <SID>DoMotion(sections, v:count1, 'W')<CR> + xnoremap <silent> <buffer> ]] :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'W')<CR> + nnoremap <silent> <buffer> [[ :<C-U>call <SID>DoMotion(sections, v:count1, 'Wb')<CR> + xnoremap <silent> <buffer> [[ :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'Wb')<CR> + + function! s:DoFeatureMotion(count, flags) + let view = winsaveview() + call cursor(1, 1) + let [features_start, _] = searchpos('^feature\>') + call search('^\s\+\a') " find the first feature + let spaces = indent(line('.')) + let [features_end, _] = searchpos('^\%(invariant\|note\|end\)\>') + call winrestview(view) + call s:DoMotion('\%>' . features_start . 'l\%<' . features_end . 'l^\s*\%' . (spaces + 1) . 'v\zs\a', a:count, a:flags) + endfunction + + nnoremap <silent> <buffer> ]m :<C-U>call <SID>DoFeatureMotion(v:count1, 'W')<CR> + xnoremap <silent> <buffer> ]m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'W')<CR> + nnoremap <silent> <buffer> [m :<C-U>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR> + xnoremap <silent> <buffer> [m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR> + + let comment_block_start = '^\%(\s\+--.*\n\)\@<!\s\+--' + let comment_block_end = '^\s\+--.*\n\%(\s\+--\)\@!' + + nnoremap <silent> <buffer> ]- :<C-U>call <SID>DoMotion(comment_block_start, 1, 'W')<CR> + xnoremap <silent> <buffer> ]- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_start, 1, 'W')<CR> + nnoremap <silent> <buffer> [- :<C-U>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR> + xnoremap <silent> <buffer> [- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR> + + let b:undo_ftplugin = b:undo_ftplugin . + \ "| silent! execute 'unmap <buffer> [[' | silent! execute 'unmap <buffer> ]]'" . + \ "| silent! execute 'unmap <buffer> [m' | silent! execute 'unmap <buffer> ]m'" . + \ "| silent! execute 'unmap <buffer> [-' | silent! execute 'unmap <buffer> ]-'" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/elinks.vim b/runtime/ftplugin/elinks.vim index 7d9257566b..921f9c276b 100644 --- a/runtime/ftplugin/elinks.vim +++ b/runtime/ftplugin/elinks.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: elinks(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: elinks(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index 9bb8e86ff3..32f3fb868f 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -27,7 +27,7 @@ elseif !exists("b:eruby_subtype") let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' diff --git a/runtime/ftplugin/eterm.vim b/runtime/ftplugin/eterm.vim index e072c638b1..e2f88ef8c6 100644 --- a/runtime/ftplugin/eterm.vim +++ b/runtime/ftplugin/eterm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: eterm(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: eterm(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/fetchmail.vim b/runtime/ftplugin/fetchmail.vim index a0d4650c03..33bb417be4 100644 --- a/runtime/ftplugin/fetchmail.vim +++ b/runtime/ftplugin/fetchmail.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: fetchmail(1) RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: fetchmail(1) RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim index 7591edd821..5d42409fd4 100644 --- a/runtime/ftplugin/fortran.vim +++ b/runtime/ftplugin/fortran.vim @@ -1,9 +1,9 @@ " Vim settings file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66) -" Version: 0.49 -" Last Change: 2013 Oct. 01 +" Version: 0.50 +" Last Change: 2015 Nov. 30 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> -" Usage: Do :help fortran-plugin from Vim +" Usage: For instructions, do :help fortran-plugin from Vim " Credits: " Useful suggestions were made by Stefano Zacchiroli, Hendrik Merx, Ben " Fritz, and David Barnett. @@ -20,7 +20,10 @@ set cpoptions&vim let b:did_ftplugin = 1 " Determine whether this is a fixed or free format source file -" if this hasn't been done yet +" if this hasn't been done yet using the priority: +" buffer-local value +" > global value +" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers if !exists("b:fortran_fixed_source") if exists("fortran_free_source") " User guarantees free source form @@ -28,13 +31,19 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else - " Modern Fortran allows both fixed and free source form - " assume fixed source form unless signs of free source form - " are detected in the first five columns of the first s:lmax lines + " Modern fortran still allows both fixed and free source form + " Assume fixed source form unless signs of free source form + " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines " are checked. Increase the limit below if you keep lots of comments at - " the very top of each file and you have a fast computer + " the very top of each file and you have a fast computer. let s:lmax = 500 if ( s:lmax > line("$") ) let s:lmax = line("$") diff --git a/runtime/ftplugin/framescript.vim b/runtime/ftplugin/framescript.vim index 805401a89b..48fe0ace7c 100644 --- a/runtime/ftplugin/framescript.vim +++ b/runtime/ftplugin/framescript.vim @@ -1,7 +1,7 @@ " Vim ftplugin file -" Language: FrameScript -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-19 +" Language: FrameScript +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-19 let s:cpo_save = &cpo set cpo&vim diff --git a/runtime/ftplugin/gdb.vim b/runtime/ftplugin/gdb.vim new file mode 100644 index 0000000000..2473b13af0 --- /dev/null +++ b/runtime/ftplugin/gdb.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: gdb +" Maintainer: Michaël Peeters <NOSPAMm.vim@noekeon.org> +" Last Changed: 26 Oct 2017 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms<" diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim index 5fe5b2b0c3..b3d5cff804 100644 --- a/runtime/ftplugin/git.vim +++ b/runtime/ftplugin/git.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: generic git output " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -12,6 +12,8 @@ let b:did_ftplugin = 1 if !exists('b:git_dir') if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' " Stay out of the way + elseif expand('%:p') =~# '[\/]\.git[\/]worktrees' + let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>') elseif expand('%:p') =~# '\.git\>' let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') elseif $GIT_DIR != '' diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index e8619004bf..6767ff719e 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -11,15 +11,10 @@ endif runtime! ftplugin/git.vim let b:did_ftplugin = 1 -setlocal nomodeline tabstop=8 formatoptions-=croq formatoptions+=tl - -let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions<' - -if &textwidth == 0 - " make sure that log messages play nice with git-log on standard terminals - setlocal textwidth=72 - let b:undo_ftplugin .= "|setl tw<" -endif +setlocal comments=:# commentstring=#\ %s +setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 +setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q +let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<' if exists("g:no_gitcommit_commands") || v:version < 700 finish @@ -31,6 +26,8 @@ endif command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) +let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached" + function! s:diffcomplete(A,L,P) let args = "" if a:P <= match(a:L." -- "," -- ")+3 diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim index 0200ba1acc..6f73b5c499 100644 --- a/runtime/ftplugin/gitrebase.vim +++ b/runtime/ftplugin/gitrebase.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 May 21 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -12,10 +12,11 @@ runtime! ftplugin/git.vim let b:did_ftplugin = 1 setlocal comments=:# commentstring=#\ %s formatoptions-=t +setlocal nomodeline if !exists("b:undo_ftplugin") let b:undo_ftplugin = "" endif -let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<" +let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<" function! s:choose(word) s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim new file mode 100644 index 0000000000..61dc1a13b7 --- /dev/null +++ b/runtime/ftplugin/go.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal formatoptions-=t + +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +let b:undo_ftplugin = 'setl fo< com< cms<' + +" vim: sw=2 sts=2 et diff --git a/runtime/ftplugin/gpg.vim b/runtime/ftplugin/gpg.vim index 5caa1f69c1..3f890e58f6 100644 --- a/runtime/ftplugin/gpg.vim +++ b/runtime/ftplugin/gpg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: gpg(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: gpg(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/groovy.vim b/runtime/ftplugin/groovy.vim new file mode 100644 index 0000000000..cc7d6e35eb --- /dev/null +++ b/runtime/ftplugin/groovy.vim @@ -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 diff --git a/runtime/ftplugin/group.vim b/runtime/ftplugin/group.vim index eef3cd68d9..e6b76ba607 100644 --- a/runtime/ftplugin/group.vim +++ b/runtime/ftplugin/group.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: group(5) user group file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: group(5) user group file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/grub.vim b/runtime/ftplugin/grub.vim index 21c4e3609d..cd6e1139e5 100644 --- a/runtime/ftplugin/grub.vim +++ b/runtime/ftplugin/grub.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: grub(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: grub(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim index 654f1fca90..e74530b556 100644 --- a/runtime/ftplugin/haml.vim +++ b/runtime/ftplugin/haml.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 Jun 01 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index c23adc4232..6c0630fe04 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -1,8 +1,8 @@ " Vim filetype plugin " Language: Hamster Script " Version: 2.0.6.0 -" Maintainer: David Fishburn <fishburn@ianywhere.com> -" Last Change: Wed Nov 08 2006 12:03:09 PM +" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> +" Last Change: 2017 Mar 18 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,7 +13,7 @@ endif let b:did_ftplugin = 1 let s:cpo_save = &cpo -set cpo-=C +set cpo&vim let b:undo_ftplugin = "setl fo< com< tw< commentstring<" \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" diff --git a/runtime/ftplugin/haskell.vim b/runtime/ftplugin/haskell.vim index 144f9f6860..de77bdfb8a 100644 --- a/runtime/ftplugin/haskell.vim +++ b/runtime/ftplugin/haskell.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Haskell -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Haskell +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim index 0a4e6fa4fb..aabf44d3a6 100644 --- a/runtime/ftplugin/help.vim +++ b/runtime/ftplugin/help.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Vim help file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Vim help file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/hgcommit.vim b/runtime/ftplugin/hgcommit.vim new file mode 100644 index 0000000000..d5a6c0a383 --- /dev/null +++ b/runtime/ftplugin/hgcommit.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: hg (Mercurial) commit file +" Maintainer: Ken Takata <kentkt at csc dot jp> +" Last Change: 2016 Jan 6 +" Filenames: hg-editor-*.txt +" License: VIM License +" URL: https://github.com/k-takata/hg-vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal nomodeline + +let b:undo_ftplugin = 'setl modeline<' diff --git a/runtime/ftplugin/hog.vim b/runtime/ftplugin/hog.vim new file mode 100644 index 0000000000..4ee0a9f934 --- /dev/null +++ b/runtime/ftplugin/hog.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin +" Language: hog (snort.conf) +" Maintainer: . Victor Roemer, <vroemer@badsec.org>. +" Last Change: Mar 1, 2013 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:undo_ftplugin = "setl fo< com< cms< def< inc<" + +let s:cpo_save = &cpo +set cpo&vim + +setlocal formatoptions=croq +setlocal comments=:# +setlocal commentstring=\c#\ %s +setlocal define=\c^\s\{-}var +setlocal include=\c^\s\{-}include + +" Move around configurations +let s:hog_keyword_match = '\c^\s*\<\(preprocessor\\|config\\|output\\|include\\|ipvar\\|portvar\\|var\\|dynamicpreprocessor\\|' . + \ 'dynamicengine\\|dynamicdetection\\|activate\\|alert\\|drop\\|block\\|dynamic\\|log\\|pass\\|reject\\|sdrop\\|sblock\)\>' + +exec "nnoremap <buffer><silent> ]] :call search('" . s:hog_keyword_match . "', 'W' )<CR>" +exec "nnoremap <buffer><silent> [[ :call search('" . s:hog_keyword_match . "', 'bW' )<CR>" + +if exists("loaded_matchit") + let b:match_words = + \ '^\s*\<\%(preprocessor\|config\|output\|include\|ipvar\|portvar' . + \ '\|var\|dynamicpreprocessor\|dynamicengine\|dynamicdetection' . + \ '\|activate\|alert\|drop\|block\|dynamic\|log\|pass\|reject' . + \ '\|sdrop\|sblock\>\):$,\::\,:;' + let b:match_skip = 'r:\\.\{-}$\|^\s*#.\{-}$\|^\s*$' +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/hostconf.vim b/runtime/ftplugin/hostconf.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/hostconf.vim +++ b/runtime/ftplugin/hostconf.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/hostsaccess.vim b/runtime/ftplugin/hostsaccess.vim index a2f55acb8a..d32485f162 100644 --- a/runtime/ftplugin/hostsaccess.vim +++ b/runtime/ftplugin/hostsaccess.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: hosts_access(5) control file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: hosts_access(5) control file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/indent.vim b/runtime/ftplugin/indent.vim index 0e195b0615..e6d928a073 100644 --- a/runtime/ftplugin/indent.vim +++ b/runtime/ftplugin/indent.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: indent(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: indent(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim index bcd606ffa0..9dc1692534 100644 --- a/runtime/ftplugin/j.vim +++ b/runtime/ftplugin/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2014-04-05 +" Last Change: 2015-09-27 if exists('b:did_ftplugin') finish @@ -12,43 +12,49 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo&vim -setlocal iskeyword=48-57,A-Z,_,a-z +setlocal iskeyword=48-57,A-Z,a-z,_ setlocal comments=:NB. setlocal commentstring=NB.\ %s setlocal formatoptions-=t -setlocal shiftwidth=2 softtabstop=2 expandtab setlocal matchpairs=(:) +setlocal path-=/usr/include -let b:undo_ftplugin = 'setlocal matchpairs< expandtab< softtabstop< shiftwidth< formatoptions< commentstring< comments< iskeyword<' +" Includes. To make the shorthand form "require 'web/cgi'" work, double the +" last path component. Also strip off leading folder names like "~addons/". +setlocal include=\\v^\\s*(load\|require)\\s*'\\zs\\f+\\ze' +setlocal includeexpr=substitute(substitute(tr(v:fname,'\\','/'),'\\v^[^~][^/.]*(/[^/.]+)$','&\\1',''),'\\v^\\~[^/]+/','','') +setlocal suffixesadd=.ijs + +let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword< path< include< includeexpr< suffixesadd<' " Section movement with ]] ][ [[ []. The start/end patterns below are amended " inside the function in order to avoid matching on the current cursor line. -let s:sectionstart = '.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>.*' +let s:sectionstart = '\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\)\>.*' let s:sectionend = '\s*)\s*' function! s:SearchSection(end, backwards, visualmode) abort if a:visualmode !=# '' normal! gv endif - let flags = a:backwards ? 'bsW' : 'sW' + let l:flags = a:backwards ? 'bsW' : 'sW' if a:end - call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), flags) + call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) else - call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), flags) + call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) endif endfunction -noremap <script> <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, '')<CR> -xnoremap <script> <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, visualmode())<CR> +noremap <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, '')<CR> +xnoremap <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, visualmode())<CR> sunmap <buffer> ]] -noremap <script> <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, '')<CR> -xnoremap <script> <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, visualmode())<CR> +noremap <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, '')<CR> +xnoremap <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, visualmode())<CR> sunmap <buffer> ][ -noremap <script> <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, '')<CR> -xnoremap <script> <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, visualmode())<CR> +noremap <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, '')<CR> +xnoremap <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, visualmode())<CR> sunmap <buffer> [[ -noremap <script> <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, '')<CR> -xnoremap <script> <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, visualmode())<CR> +noremap <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, '')<CR> +xnoremap <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, visualmode())<CR> sunmap <buffer> [] let b:undo_ftplugin .= ' | silent! execute "unmap <buffer> ]]"' @@ -66,7 +72,7 @@ endif " Enhanced "%" matching (see ":help matchit") if exists('loaded_matchit') && !exists('b:match_words') let b:match_ignorecase = 0 - let b:match_words = '^.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(\:\s*0\|def\s\+0\|define\)\>:^\s*\:\s*$:^\s*)\s*$' + let b:match_words = '^\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>:^\s*\:\s*$:^\s*)\s*$' \ . ',\<\%(for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.:\<\%(case\|catch[dt]\=\|else\%(if\)\=\|fcase\)\.:\<end\.' let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words' endif diff --git a/runtime/ftplugin/kconfig.vim b/runtime/ftplugin/kconfig.vim index 1b10c86ae3..940ba7427f 100644 --- a/runtime/ftplugin/kconfig.vim +++ b/runtime/ftplugin/kconfig.vim @@ -1,6 +1,10 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Vim syntax file +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-05-29 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-kconfig if exists("b:did_ftplugin") finish @@ -14,5 +18,10 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql +" For matchit.vim +if exists("loaded_matchit") + let b:match_words = '^\<menu\>:\<endmenu\>,^\<if\>:\<endif\>,^\<choice\>:\<endchoice\>' +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/ld.vim b/runtime/ftplugin/ld.vim index 31ce5c9ffd..1ab80d533c 100644 --- a/runtime/ftplugin/ld.vim +++ b/runtime/ftplugin/ld.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/less.vim b/runtime/ftplugin/less.vim new file mode 100644 index 0000000000..637e9d292e --- /dev/null +++ b/runtime/ftplugin/less.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin +" Language: less +" Maintainer: Alessandro Vioni <jenoma@gmail.com> +" URL: https://github.com/genoma/vim-less +" Last Change: 2014 November 24 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<" + +setlocal formatoptions-=t formatoptions+=croql + +setlocal comments=:// commentstring=//\ %s + +setlocal omnifunc=csscomplete#CompleteCSS +setlocal suffixesadd=.less diff --git a/runtime/ftplugin/lftp.vim b/runtime/ftplugin/lftp.vim index 9e2eeb52cb..5bc496c884 100644 --- a/runtime/ftplugin/lftp.vim +++ b/runtime/ftplugin/lftp.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: lftp(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: lftp(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/libao.vim b/runtime/ftplugin/libao.vim index 38bd3de92c..0ce5831b28 100644 --- a/runtime/ftplugin/libao.vim +++ b/runtime/ftplugin/libao.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: libao.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: libao.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/limits.vim b/runtime/ftplugin/limits.vim index cd5b7b5c93..90a10a6c22 100644 --- a/runtime/ftplugin/limits.vim +++ b/runtime/ftplugin/limits.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: limits(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: limits(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/loginaccess.vim b/runtime/ftplugin/loginaccess.vim index 7c44f972f2..d27114a7ae 100644 --- a/runtime/ftplugin/loginaccess.vim +++ b/runtime/ftplugin/loginaccess.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: login.access(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: login.access(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/logindefs.vim b/runtime/ftplugin/logindefs.vim index 668d08a002..7873396808 100644 --- a/runtime/ftplugin/logindefs.vim +++ b/runtime/ftplugin/logindefs.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: login.defs(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: login.defs(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/m4.vim b/runtime/ftplugin/m4.vim index 0ffe0ac77e..3745507321 100644 --- a/runtime/ftplugin/m4.vim +++ b/runtime/ftplugin/m4.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: m4 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: m4 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mailaliases.vim b/runtime/ftplugin/mailaliases.vim index 1b10c86ae3..0ae4b452d0 100644 --- a/runtime/ftplugin/mailaliases.vim +++ b/runtime/ftplugin/mailaliases.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mailcap.vim b/runtime/ftplugin/mailcap.vim index f4c8c232d8..ba8573c722 100644 --- a/runtime/ftplugin/mailcap.vim +++ b/runtime/ftplugin/mailcap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Mailcap configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Mailcap configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index c6e1e9d4f7..ea3f9ac6c9 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: man " Maintainer: SungHyun Nam <goweol@gmail.com> -" Last Change: 2013 Jul 17 +" Last Change: 2018 May 2 " To make the ":Man" command available before editing a manual page, source " this script from your startup vimrc file. @@ -15,12 +15,6 @@ if &filetype == "man" endif let b:did_ftplugin = 1 - " Ensure Vim is not recursively invoked (man-db does this) - " when doing ctrl-[ on a man page reference. - if exists("$MANPAGER") - let $MANPAGER = "" - endif - " allow dot and dash in manual page name. setlocal iskeyword+=\.,- @@ -33,6 +27,11 @@ if &filetype == "man" nnoremap <buffer> <c-]> :call <SID>PreGetPage(v:count)<CR> nnoremap <buffer> <c-t> :call <SID>PopPage()<CR> + nnoremap <buffer> <silent> q :q<CR> + endif + + if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) + setlocal foldmethod=indent foldnestmax=1 foldenable endif let b:undo_ftplugin = "setlocal iskeyword<" @@ -40,8 +39,9 @@ if &filetype == "man" endif if exists(":Man") != 2 - com -nargs=+ Man call s:GetPage(<f-args>) + com -nargs=+ -complete=shellcmd Man call s:GetPage(<f-args>) nmap <Leader>K :call <SID>PreGetPage(0)<CR> + nmap <Plug>ManPreGetPage :call <SID>PreGetPage(0)<CR> endif " Define functions only once. @@ -63,7 +63,9 @@ endtry func <SID>PreGetPage(cnt) if a:cnt == 0 let old_isk = &iskeyword - setl iskeyword+=(,) + if &ft == 'man' + setl iskeyword+=(,) + endif let str = expand("<cword>") let &l:iskeyword = old_isk let page = substitute(str, '(*\(\k\+\).*', '\1', '') @@ -89,7 +91,7 @@ func <SID>GetCmdArg(sect, page) endfunc func <SID>FindPage(sect, page) - let where = system("/usr/bin/man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page)) + let where = system("man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page)) if where !~ "^/" if matchstr(where, " [^ ]*$") !~ "^ /" return 0 @@ -143,7 +145,17 @@ func <SID>GetPage(...) endwhile endif if &filetype != "man" - new + if exists("g:ft_man_open_mode") + if g:ft_man_open_mode == "vert" + vnew + elseif g:ft_man_open_mode == "tab" + tabnew + else + new + endif + else + new + endif setl nonu fdc=0 endif endif @@ -152,20 +164,40 @@ func <SID>GetPage(...) setl buftype=nofile noswapfile setl ma nonu nornu nofen - silent exec "norm 1GdG" - let $MANWIDTH = winwidth(0) - silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b" + silent exec "norm! 1GdG" + let unsetwidth = 0 + if empty($MANWIDTH) + let $MANWIDTH = winwidth(0) + let unsetwidth = 1 + endif + + " Ensure Vim is not recursively invoked (man-db does this) when doing ctrl-[ + " on a man page reference by unsetting MANPAGER. + " Some versions of env(1) do not support the '-u' option, and in such case + " we set MANPAGER=cat. + if !exists('s:env_has_u') + call system('env -u x true') + let s:env_has_u = (v:shell_error == 0) + endif + let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat' + let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' | col -b' + silent exec "r !" . man_cmd + + if unsetwidth + let $MANWIDTH = '' + endif " Remove blank lines from top and bottom. while getline(1) =~ '^\s*$' - silent norm ggdd + silent keepj norm! ggdd endwhile while getline('$') =~ '^\s*$' - silent norm Gdd + silent keepj norm! Gdd endwhile 1 setl ft=man nomod setl bufhidden=hide setl nobuflisted + setl noma endfunc func <SID>PopPage() @@ -176,7 +208,7 @@ func <SID>PopPage() exec "let s:man_tag_col=s:man_tag_col_".s:man_tag_depth exec s:man_tag_buf."b" exec s:man_tag_lin - exec "norm ".s:man_tag_col."|" + exec "norm! ".s:man_tag_col."|" exec "unlet s:man_tag_buf_".s:man_tag_depth exec "unlet s:man_tag_lin_".s:man_tag_depth exec "unlet s:man_tag_col_".s:man_tag_depth @@ -186,4 +218,4 @@ endfunc endif -" vim: set sw=2: +" vim: set sw=2 ts=8 noet: diff --git a/runtime/ftplugin/manconf.vim b/runtime/ftplugin/manconf.vim index a249a97507..aa85408cef 100644 --- a/runtime/ftplugin/manconf.vim +++ b/runtime/ftplugin/manconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: man.conf(5) - man configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: man.conf(5) - man configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim index 5d6ebecd8c..277ba94e8b 100644 --- a/runtime/ftplugin/markdown.vim +++ b/runtime/ftplugin/markdown.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Markdown " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:did_ftplugin") finish @@ -11,7 +11,7 @@ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o -setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]: if exists('b:undo_ftplugin') let b:undo_ftplugin .= "|setl cms< com< fo< flp<" @@ -19,4 +19,32 @@ else let b:undo_ftplugin = "setl cms< com< fo< flp<" endif +function! MarkdownFold() + let line = getline(v:lnum) + + " Regular headers + let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=') + if depth > 0 + return ">" . depth + endif + + " Setext style headings + let nextline = getline(v:lnum + 1) + if (line =~ '^.\+$') && (nextline =~ '^=\+$') + return ">1" + endif + + if (line =~ '^.\+$') && (nextline =~ '^-\+$') + return ">2" + endif + + return "=" +endfunction + +if has("folding") && exists("g:markdown_folding") + setlocal foldexpr=MarkdownFold() + setlocal foldmethod=expr + let b:undo_ftplugin .= " foldexpr< foldmethod<" +endif + " vim:set sw=2: diff --git a/runtime/ftplugin/matlab.vim b/runtime/ftplugin/matlab.vim index 6bfb3d7618..205111c3c2 100644 --- a/runtime/ftplugin/matlab.vim +++ b/runtime/ftplugin/matlab.vim @@ -1,7 +1,10 @@ " Vim filetype plugin file " Language: matlab " Maintainer: Jake Wasserman <jwasserman at gmail dot com> -" Last Changed: 2006 Jan 12 +" Last Changed: 2014 Dec 30 + +" Contributors: +" Charles Campbell if exists("b:did_ftplugin") finish @@ -12,10 +15,11 @@ let s:save_cpo = &cpo set cpo-=C if exists("loaded_matchit") - let s:conditionalEnd = '\(([^()]*\)\@!\<end\>\([^()]*)\)\@!' - let b:match_words = '\<if\>\|\<while\>\|\<for\>\|\<switch\>:' . - \ s:conditionalEnd . ',\<if\>:\<elseif\>:\<else\>:' . - \ s:conditionalEnd + let s:conditionalEnd = '\%(([^()]*\)\@!\<end\>\%([^()]*)\)\@!' + let b:match_words= + \ '\<\%(if\|switch\|for\|while\)\>:\<\%(elseif\|case\|break\|continue\|else\|otherwise\)\>:'.s:conditionalEnd.','. + \ '\<function\>:\<return\>:\<endfunction\>' + unlet s:conditionalEnd endif setlocal suffixesadd=.m diff --git a/runtime/ftplugin/mf.vim b/runtime/ftplugin/mf.vim index fd1d3ce646..7c9a8a1283 100644 --- a/runtime/ftplugin/mf.vim +++ b/runtime/ftplugin/mf.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: MetaFont -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: METAFONT +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 2 if exists("b:did_ftplugin") finish @@ -11,9 +12,59 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = "setl com< cms< fo<" +let b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<" + \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" -setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=croql +setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=cjroql2 +setlocal suffixesadd=.mf +let &l:include = '\<input\>' +let &l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+' +setlocal omnifunc=syntaxcomplete#Complete +let g:omni_syntax_group_include_mf = 'mf\w\+' +let g:omni_syntax_group_exclude_mf = 'mfTodoComment' + +let s:mp_regex = { + \ 'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|beginchar\|beginlogochar\)\>', + \ 'endsection' : '^\s*\%(enddef\|endchar\)\>', + \ 'beginblock' : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>', + \ 'endblock' : '^\s*\%(endgroup\|fi\|endfor\)\>' + \ } + +function! s:move_around(count, what, flags, visual) + if a:visual + exe "normal! gv" + endif + call search(s:mp_regex[a:what], a:flags.'s') " 's' sets previous context mark + call map(range(2, a:count), 'search(s:mp_regex[a:what], a:flags)') +endfunction + + +" Move around macros. +nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> +vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> +nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> +vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> +nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> +vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> +nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> +vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> + +if exists("loaded_matchit") + let b:match_ignorecase = 0 + let b:match_words = + \ '\<if\>:\<else\%[if]\>:\<fi\>,' . + \ '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' . + \ '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' . + \ '\<begingroup\>:\<endgroup\>,' . + \ '\<begin\%(logo\)\?char\>:\<endchar\>' + " Ignore comments and strings + let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") + \ =~# "mf\\(Comment\\|String\\)$"' +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/modconf.vim b/runtime/ftplugin/modconf.vim index f200e9f61e..c8e76b538b 100644 --- a/runtime/ftplugin/modconf.vim +++ b/runtime/ftplugin/modconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: modules.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: modules.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mp.vim b/runtime/ftplugin/mp.vim index 316fa9bb64..3a0a3d0298 100644 --- a/runtime/ftplugin/mp.vim +++ b/runtime/ftplugin/mp.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: MetaPost -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: MetaPost +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 2 if exists("b:did_ftplugin") finish @@ -11,9 +12,16 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = "setl com< cms< fo<" +let b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<" + \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" -setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=croql +setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=cjroql2 +setlocal suffixesadd=.mp,.mpiv +let &l:include = '\<\%(input\|loadmodule\)\>' " loadmodule is in MetaFun +let &l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+' +setlocal omnifunc=syntaxcomplete#Complete +let g:omni_syntax_group_include_mp = 'mf\w\+,mp\w\+' +let g:omni_syntax_group_exclude_mp = 'mfTodoComment' if exists(":FixBeginfigs") != 2 command -nargs=0 FixBeginfigs call s:fix_beginfigs() @@ -24,5 +32,51 @@ if exists(":FixBeginfigs") != 2 endfunction endif +let s:mp_regex = { + \ 'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|begin\%(fig\|char\|logochar\|glyph\|graph\)\)\>', + \ 'endsection' : '^\s*\%(enddef\|end\%(fig\|char\|glyph\|graph\)\)\>', + \ 'beginblock' : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>', + \ 'endblock' : '^\s*\%(endgroup\|fi\|endfor\)\>' + \ } + +function! s:move_around(count, what, flags, visual) + if a:visual + exe "normal! gv" + endif + call search(s:mp_regex[a:what], a:flags.'s') " 's' sets previous context mark + call map(range(2, a:count), 'search(s:mp_regex[a:what], a:flags)') +endfunction + + +" Move around macros. +nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> +vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> +nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> +vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> +nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> +vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> +nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> +vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> + +if exists("loaded_matchit") + let b:match_ignorecase = 0 + let b:match_words = + \ '\<if\>:\<else\%[if]\>:\<fi\>,' . + \ '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' . + \ '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' . + \ '\<beginfig\>:\<endfig\>,' . + \ '\<begingroup\>:\<endgroup\>,' . + \ '\<begin\%(logo\)\?char\>:\<endchar\>,' . + \ '\<beginglyph\>:\<endglyph\>,' . + \ '\<begingraph\>:\<endgraph\>' + " Ignore comments and strings + let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") + \ =~# "^mf\\%(Comment\\|String\\|\\)$\\|^mpTeXinsert$"' +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/mplayerconf.vim b/runtime/ftplugin/mplayerconf.vim index 65034a8152..86547609c3 100644 --- a/runtime/ftplugin/mplayerconf.vim +++ b/runtime/ftplugin/mplayerconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: mplayer(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: mplayer(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/muttrc.vim b/runtime/ftplugin/muttrc.vim index a109e5ddda..c8ad0f2ec5 100644 --- a/runtime/ftplugin/muttrc.vim +++ b/runtime/ftplugin/muttrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: mutt RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: mutt RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/nanorc.vim b/runtime/ftplugin/nanorc.vim index be20d12503..e45ebac0eb 100644 --- a/runtime/ftplugin/nanorc.vim +++ b/runtime/ftplugin/nanorc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: nanorc(5) - GNU nano configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: nanorc(5) - GNU nano configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/neomuttrc.vim b/runtime/ftplugin/neomuttrc.vim new file mode 100644 index 0000000000..86f1cded63 --- /dev/null +++ b/runtime/ftplugin/neomuttrc.vim @@ -0,0 +1,23 @@ +" Vim filetype plugin file +" Language: NeoMutt RC File +" Previous Maintainer: Guillaume Brogi <gui-gui@netcourrier.com> +" Latest Revision: 2017-09-17 +" Original version copied from ftplugin/muttrc.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl com< cms< inc< fo<" + +setlocal comments=:# commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql + +let &l:include = '^\s*source\>' + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/netrc.vim b/runtime/ftplugin/netrc.vim index 105a1d3a8e..02ee327295 100644 --- a/runtime/ftplugin/netrc.vim +++ b/runtime/ftplugin/netrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: netrc(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: netrc(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/nsis.vim b/runtime/ftplugin/nsis.vim index acc26208c4..1a35127c86 100644 --- a/runtime/ftplugin/nsis.vim +++ b/runtime/ftplugin/nsis.vim @@ -1,22 +1,43 @@ " Vim ftplugin file -" Language: NSIS script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 - -let s:cpo_save = &cpo -set cpo&vim +" Language: NSIS script +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Last Change: 2018-01-26 if exists("b:did_ftplugin") finish endif + +let s:cpo_save = &cpo +set cpo&vim + let b:did_ftplugin = 1 let b:undo_ftplugin = "setl com< cms< fo< def< inc<" + \ " | unlet! b:match_ignorecase b:match_words" setlocal comments=s1:/*,mb:*,ex:*/,b:#,:; commentstring=;\ %s setlocal formatoptions-=t formatoptions+=croql setlocal define=^\\s*!define\\%(\\%(utc\\)\\=date\\|math\\)\\= setlocal include=^\\s*!include\\%(/NONFATAL\\)\\= +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_words = + \ '\${\%(If\|IfNot\|Unless\)}:\${\%(Else\|ElseIf\|ElseIfNot\|ElseUnless\)}:\${\%(EndIf\|EndUnless\)},' . + \ '\${Select}:\${EndSelect},' . + \ '\${Switch}:\${EndSwitch},' . + \ '\${\%(Do\|DoWhile\|DoUntil\)}:\${\%(Loop\|LoopWhile\|LoopUntil\)},' . + \ '\${\%(For\|ForEach\)}:\${Next},' . + \ '\<Function\>:\<FunctionEnd\>,' . + \ '\<Section\>:\<SectionEnd\>,' . + \ '\<SectionGroup\>:\<SectionGroupEnd\>,' . + \ '\<PageEx\>:\<PageExEnd\>,' . + \ '\${MementoSection}:\${MementoSectionEnd},' . + \ '!if\%(\%(macro\)\?n\?def\)\?\>:!else\>:!endif\>,' . + \ '!macro\>:!macroend\>' +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/pamconf.vim b/runtime/ftplugin/pamconf.vim index 96d96461e2..f0a693e3a5 100644 --- a/runtime/ftplugin/pamconf.vim +++ b/runtime/ftplugin/pamconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: pam(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: pam(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/passwd.vim b/runtime/ftplugin/passwd.vim index 5088c43359..f6e0f50342 100644 --- a/runtime/ftplugin/passwd.vim +++ b/runtime/ftplugin/passwd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: passwd(5) password file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: passwd(5) password file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/pinfo.vim b/runtime/ftplugin/pinfo.vim index 6ec1f87b9e..50473a8114 100644 --- a/runtime/ftplugin/pinfo.vim +++ b/runtime/ftplugin/pinfo.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: pinfo(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: pinfo(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/procmail.vim b/runtime/ftplugin/procmail.vim index cc2ceede19..d64f19274d 100644 --- a/runtime/ftplugin/procmail.vim +++ b/runtime/ftplugin/procmail.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: procmail(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: procmail(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/prolog.vim b/runtime/ftplugin/prolog.vim index caeb574c5a..f4e7d135b5 100644 --- a/runtime/ftplugin/prolog.vim +++ b/runtime/ftplugin/prolog.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Prolog -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Prolog +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/protocols.vim b/runtime/ftplugin/protocols.vim index 2486ff9370..83856ce7ba 100644 --- a/runtime/ftplugin/protocols.vim +++ b/runtime/ftplugin/protocols.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: protocols(5) - Internet protocols definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: protocols(5) - Internet protocols definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 75c7e87996..5c4a59b1a9 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,8 +1,10 @@ " Vim filetype plugin file " Language: python -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: 2014 Feb 09 -" Last Change By Johannes: Wed, 21 Apr 2004 13:13:08 CEST +" Maintainer: Tom Picton <tom@tompicton.co.uk> +" Previous Maintainer: James Sully <sullyj3@gmail.com> +" Previous Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Sun, 15 April 2018 +" https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -12,41 +14,106 @@ set cpo&vim setlocal cinkeys-=0# setlocal indentkeys-=0# setlocal include=^\\s*\\(from\\\|import\\) -setlocal includeexpr=substitute(v:fname,'\\.','/','g') + +" For imports with leading .., append / and replace additional .s with ../ +let b:grandparent_match = '^\(.\.\)\(\.*\)' +let b:grandparent_sub = '\=submatch(1)."/".repeat("../",strlen(submatch(2)))' + +" For imports with a single leading ., replace it with ./ +let b:parent_match = '^\.\(\.\)\@!' +let b:parent_sub = './' + +" Replace any . sandwiched between word characters with / +let b:child_match = '\(\w\)\.\(\w\)' +let b:child_sub = '\1/\2' + +setlocal includeexpr=substitute(substitute(substitute( + \v:fname, + \b:grandparent_match,b:grandparent_sub,''), + \b:parent_match,b:parent_sub,''), + \b:child_match,b:child_sub,'g') + setlocal suffixesadd=.py setlocal comments=b:#,fb:- setlocal commentstring=#\ %s setlocal omnifunc=pythoncomplete#Complete +if has('python3') + setlocal omnifunc=python3complete#Complete +endif set wildignore+=*.pyc -nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr> -nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr> -nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr> -nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr> +let b:next_toplevel='\v%$\|^(class\|def\|async def)>' +let b:prev_toplevel='\v^(class\|def\|async def)>' +let b:next_endtoplevel='\v%$\|\S.*\n+(def\|class)' +let b:prev_endtoplevel='\v\S.*\n+(def\|class)' +let b:next='\v%$\|^\s*(class\|def\|async def)>' +let b:prev='\v^\s*(class\|def\|async def)>' +let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' +let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' + +execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W', v:count1)<cr>" +execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" +execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" +execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" +execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W', v:count1)<cr>" +execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb', v:count1)<cr>" +execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', 0, v:count1)<cr>" +execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" + +execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W', v:count1)<cr>" +execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" +execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('o', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" +execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" +execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W', v:count1)<cr>" +execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb', v:count1)<cr>" +execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', 0, v:count1)<cr>" +execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" + +execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W', v:count1)<cr>" +execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" +execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('x', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" +execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" +execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W', v:count1)<cr>" +execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb', v:count1)<cr>" +execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', 0, v:count1)<cr>" +execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" if !exists('*<SID>Python_jump') - fun! <SID>Python_jump(motion) range - let cnt = v:count1 - let save = @/ " save last search pattern + fun! <SID>Python_jump(mode, motion, flags, count, ...) range + let l:startofline = (a:0 >= 1) ? a:1 : 1 + + if a:mode == 'x' + normal! gv + endif + + if l:startofline == 1 + normal! 0 + endif + + let cnt = a:count mark ' while cnt > 0 - silent! exe a:motion - let cnt = cnt - 1 + call search(a:motion, a:flags) + let cnt = cnt - 1 endwhile - call histdel('/', -1) - let @/ = save " restore last search pattern + + if l:startofline == 1 + normal! ^ + endif endfun endif if has("browsefilter") && !exists("b:browsefilter") let b:browsefilter = "Python Files (*.py)\t*.py\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif -" As suggested by PEP8. -setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 +if !exists("g:python_recommended_style") || g:python_recommended_style != 0 + " As suggested by PEP8. + setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 +endif " First time: try finding "pydoc". if !exists('g:pydoc_executable') diff --git a/runtime/ftplugin/quake.vim b/runtime/ftplugin/quake.vim index f62693b11a..c3a2e52347 100644 --- a/runtime/ftplugin/quake.vim +++ b/runtime/ftplugin/quake.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Quake[1-3] configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Quake[1-3] configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index 43b208b842..4ea3073922 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Sun Feb 23, 2014 04:07PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/racc.vim b/runtime/ftplugin/racc.vim index 7ff22f8937..0cd852c365 100644 --- a/runtime/ftplugin/racc.vim +++ b/runtime/ftplugin/racc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Racc input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Racc input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim index 0a4dbb5c03..e9ef93ec7f 100644 --- a/runtime/ftplugin/readline.vim +++ b/runtime/ftplugin/readline.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: readline(3) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: readline(3) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index 9b72fb42f9..fdac38f3e9 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 55723ff396..8c092ac13f 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -1,8 +1,9 @@ " Vim filetype plugin file -" Language: R help file +" Language: R Markdown file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM -" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann) +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Mon Jun 06, 2016 09:41PM +" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -11,6 +12,16 @@ endif runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +" Nvim-R plugin needs this +if exists("*CompleteR") + if &omnifunc == "CompleteR" + let b:rplugin_nonr_omnifunc = "" + else + let b:rplugin_nonr_omnifunc = &omnifunc + endif + set omnifunc=CompleteR +endif + setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal formatoptions+=tcqln setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ diff --git a/runtime/ftplugin/rnc.vim b/runtime/ftplugin/rnc.vim index 2b8fd50d8d..90aa111c67 100644 --- a/runtime/ftplugin/rnc.vim +++ b/runtime/ftplugin/rnc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Relax NG compact syntax -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Relax NG compact syntax +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index baf53d0108..e184399dcb 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Rnoweb " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 8140169e61..ecfd6e87a1 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index b871cf1486..e61213e7a5 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: reStructuredText documentation format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: reStructuredText documentation format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 9630a940ab..84fb9930a4 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -28,12 +28,13 @@ if exists("loaded_matchit") && !exists("b:match_words") \ ':' . \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . \ ':' . - \ '\<end\>' . + \ '\%(^\|[^.\:@$]\)\@<=\<end\:\@!\>' . \ ',{:},\[:\],(:)' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . \ "\\<ruby\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" . + \ "Regexp\\|RegexpDelimiter\\|" . \ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" . \ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" . \ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . @@ -43,7 +44,7 @@ endif setlocal formatoptions-=t formatoptions+=croql setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\) -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') +setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','') setlocal suffixesadd=.rb if exists("&ofu") && has("ruby") @@ -66,32 +67,32 @@ if !exists('g:ruby_version_paths') let g:ruby_version_paths = {} endif -function! s:query_path(root) +function! s:query_path(root) abort let code = "print $:.join %q{,}" - if &shell =~# 'sh' && $PATH !~# '\s' - let prefix = 'env PATH='.$PATH.' ' + if &shell =~# 'sh' + let prefix = 'env PATH='.shellescape($PATH).' ' else let prefix = '' endif if &shellxquote == "'" - let path_check = prefix.'ruby -e "' . code . '"' + let path_check = prefix.'ruby --disable-gems -e "' . code . '"' else - let path_check = prefix."ruby -e '" . code . "'" + let path_check = prefix."ruby --disable-gems -e '" . code . "'" endif let cd = haslocaldir() ? 'lcd' : 'cd' - let cwd = getcwd() + let cwd = fnameescape(getcwd()) try exe cd fnameescape(a:root) let path = split(system(path_check),',') - exe cd fnameescape(cwd) + exe cd cwd return path finally - exe cd fnameescape(cwd) + exe cd cwd endtry endfunction -function! s:build_path(path) +function! s:build_path(path) abort let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',') if &g:path !~# '\v^\.%(,/%(usr|emx)/include)=,,$' let path = substitute(&g:path,',,$',',','') . ',' . path @@ -101,7 +102,7 @@ endfunction if !exists('b:ruby_version') && !exists('g:ruby_path') && isdirectory(expand('%:p:h')) let s:version_file = findfile('.ruby-version', '.;') - if !empty(s:version_file) + if !empty(s:version_file) && filereadable(s:version_file) let b:ruby_version = get(readfile(s:version_file, '', 1), '') if !has_key(g:ruby_version_paths, b:ruby_version) let g:ruby_version_paths[b:ruby_version] = s:query_path(fnamemodify(s:version_file, ':p:h')) @@ -135,7 +136,7 @@ if exists('s:ruby_paths') && stridx(&l:tags, join(map(copy(s:ruby_paths),'v:val. let &l:tags = &tags . ',' . join(map(copy(s:ruby_paths),'v:val."/tags"'),',') endif -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" . \ "All Files (*.*)\t*.*\n" endif @@ -145,7 +146,22 @@ let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<" \."| if exists('&ofu') && has('ruby') | setl ofu< | endif" \."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif" +function! s:map(mode, flags, map) abort + let from = matchstr(a:map, '\S\+') + if empty(mapcheck(from, a:mode)) + exe a:mode.'map' '<buffer>'.(a:0 ? a:1 : '') a:map + let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from + endif +endfunction + +cmap <buffer><script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'') +cmap <buffer><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'') +let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile>" + if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") + nmap <buffer><script> <SID>: :<C-U> + nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR> + nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR> nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR> nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR> @@ -168,7 +184,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") \."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['" \."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'" - if maparg('im','n') == '' + if maparg('im','x') == '' && maparg('im','o') == '' && maparg('am','x') == '' && maparg('am','o') == '' onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR> onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR> xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR> @@ -178,7 +194,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") \."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'" endif - if maparg('iM','n') == '' + if maparg('iM','x') == '' && maparg('iM','o') == '' && maparg('aM','x') == '' && maparg('aM','o') == '' onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR> onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR> xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR> @@ -188,33 +204,24 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") \."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'" endif - if maparg("\<C-]>",'n') == '' - nnoremap <silent> <buffer> <C-]> :<C-U>exe v:count1."tag <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> g<C-]> :<C-U>exe "tjump <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> g] :<C-U>exe "tselect <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W>] :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W><C-]> :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W>g<C-]> :<C-U>exe "stjump <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W>g] :<C-U>exe "stselect <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W>} :<C-U>exe "ptag <C-R>=RubyCursorIdentifier()<CR>"<CR> - nnoremap <silent> <buffer> <C-W>g} :<C-U>exe "ptjump <C-R>=RubyCursorIdentifier()<CR>"<CR> - let b:undo_ftplugin = b:undo_ftplugin - \."| sil! exe 'nunmap <buffer> <C-]>'| sil! exe 'nunmap <buffer> g<C-]>'| sil! exe 'nunmap <buffer> g]'" - \."| sil! exe 'nunmap <buffer> <C-W>]'| sil! exe 'nunmap <buffer> <C-W><C-]>'" - \."| sil! exe 'nunmap <buffer> <C-W>g<C-]>'| sil! exe 'nunmap <buffer> <C-W>g]'" - \."| sil! exe 'nunmap <buffer> <C-W>}'| sil! exe 'nunmap <buffer> <C-W>g}'" - endif - - if maparg("gf",'n') == '' - " By using findfile() rather than gf's normal behavior, we prevent - " erroneously editing a directory. - nnoremap <silent> <buffer> gf :<C-U>exe <SID>gf(v:count1,"gf",'edit')<CR> - nnoremap <silent> <buffer> <C-W>f :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>f",'split')<CR> - nnoremap <silent> <buffer> <C-W><C-F> :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>\<Lt>C-F>",'split')<CR> - nnoremap <silent> <buffer> <C-W>gf :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>gf",'tabedit')<CR> - let b:undo_ftplugin = b:undo_ftplugin - \."| sil! exe 'nunmap <buffer> gf' | sil! exe 'nunmap <buffer> <C-W>f' | sil! exe 'nunmap <buffer> <C-W><C-F>' | sil! exe 'nunmap <buffer> <C-W>gf'" - endif + call s:map('c', '', '<C-R><C-W> <Plug><cword>') + call s:map('c', '', '<C-R><C-F> <Plug><cfile>') + + cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : '' + call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><cword>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><cword>"<CR>') + call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><cword>"<CR>') + + call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>') + call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>') + call s:map('n', '<silent>', '<C-W><C-F> <SID>c:sfind <Plug><cfile><CR>') + call s:map('n', '<silent>', '<C-W>gf <SID>c:tabfind <Plug><cfile><CR>') endif let &cpo = s:cpo_save @@ -225,7 +232,7 @@ if exists("g:did_ruby_ftplugin_functions") endif let g:did_ruby_ftplugin_functions = 1 -function! RubyBalloonexpr() +function! RubyBalloonexpr() abort if !exists('s:ri_found') let s:ri_found = executable('ri') endif @@ -274,13 +281,13 @@ function! RubyBalloonexpr() endif endfunction -function! s:searchsyn(pattern,syn,flags,mode) +function! s:searchsyn(pattern, syn, flags, mode) abort + let cnt = v:count1 norm! m' if a:mode ==# 'v' norm! gv endif let i = 0 - let cnt = v:count ? v:count : 1 while i < cnt let i = i + 1 let line = line('.') @@ -296,11 +303,11 @@ function! s:searchsyn(pattern,syn,flags,mode) endwhile endfunction -function! s:synname() +function! s:synname() abort return synIDattr(synID(line('.'),col('.'),0),'name') endfunction -function! s:wrap_i(back,forward) +function! s:wrap_i(back,forward) abort execute 'norm k'.a:forward let line = line('.') execute 'norm '.a:back @@ -310,7 +317,7 @@ function! s:wrap_i(back,forward) execute 'norm jV'.a:forward.'k' endfunction -function! s:wrap_a(back,forward) +function! s:wrap_a(back,forward) abort execute 'norm '.a:forward if line('.') < line('$') && getline(line('.')+1) ==# '' let after = 1 @@ -328,37 +335,55 @@ function! s:wrap_a(back,forward) endif endfunction -function! RubyCursorIdentifier() +function! RubyCursorIdentifier() abort let asciicode = '\%(\w\|[]})\"'."'".']\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)' let number = '\%(\%(\w\|[]})\"'."'".']\s*\)\@<!-\)\=\%(\<[[:digit:]_]\+\%(\.[[:digit:]_]\+\)\=\%([Ee][[:digit:]_]\+\)\=\>\|\<0[xXbBoOdD][[:xdigit:]_]\+\>\)\|'.asciicode let operator = '\%(\[\]\|<<\|<=>\|[!<>]=\=\|===\=\|[!=]\~\|>>\|\*\*\|\.\.\.\=\|=>\|[~^&|*/%+-]\)' - let method = '\%(\<[_a-zA-Z]\w*\>\%([?!]\|\s*=>\@!\)\=\)' + let method = '\%(\.[_a-zA-Z]\w*\s*=>\@!\|\<[_a-zA-Z]\w*\>[?!]\=\)' let global = '$\%([!$&"'."'".'*+,./:;<=>?@\`~]\|-\=\w\+\>\)' let symbolizable = '\%(\%(@@\=\)\w\+\>\|'.global.'\|'.method.'\|'.operator.'\)' let pattern = '\C\s*\%('.number.'\|\%(:\@<!:\)\='.symbolizable.'\)' let [lnum, col] = searchpos(pattern,'bcn',line('.')) let raw = matchstr(getline('.')[col-1 : ],pattern) - let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*:\=','','') + let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*[:.]\=','','') return stripped == '' ? expand("<cword>") : stripped endfunction -function! s:gf(count,map,edit) abort - if getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$' - let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') - return a:edit.' %:h/'.target.'.rb' - elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$' - let target = matchstr(getline('.'),'\(["'']\)\.\./\zs.\{-\}\ze\1') - return a:edit.' %:h/'.target.'.rb' +function! RubyCursorFile() abort + let isfname = &isfname + try + set isfname+=: + let cfile = expand('<cfile>') + finally + let isfname = &isfname + endtry + let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!') + let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*') + let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : '' + if s:synname() ==# 'rubyConstant' + let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','') + let cfile = substitute(cfile,'::','/','g') + let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g') + let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g') + return tolower(cfile) . '.rb' + elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$' + let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . ext + elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$' + let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1') + let cfile = expand('%:p:h') . target . ext elseif getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'']\).*\1\s*$' - let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') + let cfile = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . ext + elseif pre.post =~# '\<File.expand_path[( ].*[''"]\{2\}, *__FILE__\>' && cfile =~# '^\.\.' + let cfile = expand('%:p:h') . strpart(cfile, 2) else - let target = expand('<cfile>') + return substitute(cfile, '\C\v^(.*):(\d+)%(:in)=$', '+\2 \1', '') endif - let found = findfile(target, &path, a:count) - if found ==# '' - return 'norm! '.a:count.a:map + let cwdpat = '^\M' . substitute(getcwd(), '[\/]', '\\[\\/]', 'g').'\ze\[\/]' + let cfile = substitute(cfile, cwdpat, '.', '') + if fnameescape(cfile) !=# cfile + return '+ '.fnameescape(cfile) else - return a:edit.' '.fnameescape(found) + return cfile endif endfunction diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim new file mode 100644 index 0000000000..7efca5985b --- /dev/null +++ b/runtime/ftplugin/rust.vim @@ -0,0 +1,197 @@ +" Language: Rust +" Description: Vim ftplugin for Rust +" Maintainer: Chris Morgan <me@chrismorgan.info> +" Maintainer: Kevin Ballard <kevin@sb.org> +" Last Change: June 08, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +augroup rust.vim +autocmd! + +" Variables {{{1 + +" The rust source code at present seems to typically omit a leader on /*! +" comments, so we'll use that as our default, but make it easy to switch. +" This does not affect indentation at all (I tested it with and without +" leader), merely whether a leader is inserted by default or not. +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +else + setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// +endif +setlocal commentstring=//%s +setlocal formatoptions-=t formatoptions+=croqnl +" j was only added in 7.3.541, so stop complaints about its nonexistence +silent! setlocal formatoptions+=j + +" smartindent will be overridden by indentexpr if filetype indent is on, but +" otherwise it's better than nothing. +setlocal smartindent nocindent + +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif + +" This includeexpr isn't perfect, but it's a good start +setlocal includeexpr=substitute(v:fname,'::','/','g') + +setlocal suffixesadd=.rs + +if exists("g:ftplugin_rust_source_path") + let &l:path=g:ftplugin_rust_source_path . ',' . &l:path +endif + +if exists("g:loaded_delimitMate") + if exists("b:delimitMate_excluded_regions") + let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions + endif + + let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + " For this buffer, when delimitMate issues the `User delimitMate_map` + " event in the autocommand system, add the above-defined extra excluded + " regions to delimitMate's state, if they have not already been added. + autocmd User <buffer> + \ if expand('<afile>') ==# 'delimitMate_map' && match( + \ delimitMate#Get("excluded_regions"), + \ s:delimitMate_extra_excluded_regions) == -1 + \| let b:delimitMate_excluded_regions = + \ delimitMate#Get("excluded_regions") + \ . s:delimitMate_extra_excluded_regions + \|endif + + " For this buffer, when delimitMate issues the `User delimitMate_unmap` + " event in the autocommand system, delete the above-defined extra excluded + " regions from delimitMate's state (the deletion being idempotent and + " having no effect if the extra excluded regions are not present in the + " targeted part of delimitMate's state). + autocmd User <buffer> + \ if expand('<afile>') ==# 'delimitMate_unmap' + \| let b:delimitMate_excluded_regions = substitute( + \ delimitMate#Get("excluded_regions"), + \ '\C\V' . s:delimitMate_extra_excluded_regions, + \ '', 'g') + \|endif +endif + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 +endif + +" Motion Commands {{{1 + +" Bind motion commands to support hanging indents +nnoremap <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR> +nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR> +xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR> +xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR> +onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR> +onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR> + +" Commands {{{1 + +" See |:RustRun| for docs +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>) + +" See |:RustExpand| for docs +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>) + +" See |:RustEmitIr| for docs +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>) + +" See |:RustEmitAsm| for docs +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() + +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) + +" Mappings {{{1 + +" Bind ⌘R in MacVim to :RustRun +nnoremap <silent> <buffer> <D-r> :RustRun<CR> +" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args +nnoremap <buffer> <D-R> :RustRun! <C-r>=join(b:rust_last_rustc_args)<CR><C-\>erust#AppendCmdLine(' -- ' . join(b:rust_last_args))<CR> + +if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] +endif + +" Cleanup {{{1 + +let b:undo_ftplugin = " + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand RustRun + \|delcommand RustExpand + \|delcommand RustEmitIr + \|delcommand RustEmitAsm + \|delcommand RustPlay + \|nunmap <buffer> <D-r> + \|nunmap <buffer> <D-R> + \|nunmap <buffer> [[ + \|nunmap <buffer> ]] + \|xunmap <buffer> [[ + \|xunmap <buffer> ]] + \|ounmap <buffer> [[ + \|ounmap <buffer> ]] + \|set matchpairs-=<:> + \" + +" }}}1 + +" Code formatting on save +if get(g:, "rustfmt_autosave", 0) + autocmd BufWritePre *.rs silent! call rustfmt#Format() +endif + +augroup END + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set noet sw=8 ts=8: diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim index 64232a0894..d6909e7ad5 100644 --- a/runtime/ftplugin/sass.vim +++ b/runtime/ftplugin/sass.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 Jul 26 +" Last Change: 2016 Aug 29 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -9,8 +9,9 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 -let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<" +let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<" +setlocal comments=:// setlocal commentstring=//\ %s setlocal define=^\\s*\\%(@mixin\\\|=\\) setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','') diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim new file mode 100644 index 0000000000..309d30e503 --- /dev/null +++ b/runtime/ftplugin/sbt.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: sbt +" Maintainer: Steven Dobay <stevendobay at protonmail.com> +" License: Same as Vim +" Last Change: 2017.04.30 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif + +let b:did_ftplugin = 1 + +runtime! ftplugin/scala.vim + diff --git a/runtime/ftplugin/scala.vim b/runtime/ftplugin/scala.vim new file mode 100644 index 0000000000..18e16f1d5b --- /dev/null +++ b/runtime/ftplugin/scala.vim @@ -0,0 +1,35 @@ +" Vim filetype plugin file +" Language: Scala +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Same as Vim +" Last Change: 02 August 2016 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif +let b:did_ftplugin = 1 + +" j is fairly new in Vim, so don't complain if it's not there +setlocal formatoptions-=t formatoptions+=croqnl +silent! setlocal formatoptions+=j + +" Just like c.vim, but additionally doesn't wrap text onto /** line when +" formatting. Doesn't bungle bulleted lists when formatting. +if get(g:, 'scala_scaladoc_indent', 0) + setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +else + setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +endif +setlocal commentstring=//\ %s + +setlocal shiftwidth=2 softtabstop=2 expandtab + +setlocal include='^\s*import' +setlocal includeexpr='substitute(v:fname,"\\.","/","g")' + +setlocal path+=src/main/scala,src/test/scala +setlocal suffixesadd=.scala + +" vim:set sw=2 sts=2 ts=8 et: diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim index ab1543a5ee..62fd327e07 100644 --- a/runtime/ftplugin/scheme.vim +++ b/runtime/ftplugin/scheme.vim @@ -1,45 +1,57 @@ -" Vim filetype plugin -" Language: Scheme -" Maintainer: Sergey Khorev <sergey.khorev@gmail.com> -" URL: http://sites.google.com/site/khorser/opensource/vim -" Original author: Dorai Sitaram <ds26@gte.com> -" Original URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html -" Last Change: Oct 23, 2013 - -" Only do this when not done yet for this buffer -if exists("b:did_ftplugin") +" Vim filetype plugin file +" Language: Scheme (R7RS) +" Last Change: 2018-03-05 +" Author: Evan Hanson <evhan@foldling.org> +" Maintainer: Evan Hanson <evhan@foldling.org> +" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com> +" URL: https://foldling.org/vim/ftplugin/scheme.vim + +if exists('b:did_ftplugin') finish endif -" Don't load another plugin for this buffer -let b:did_ftplugin = 1 +let s:cpo = &cpo +set cpo&vim -" Copy-paste from ftplugin/lisp.vim -setl comments=:; -setl define=^\\s*(def\\k* -setl formatoptions-=t -setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 setl lisp +setl comments=:;;;;,:;;;,:;;,:;,sr:#\|,mb:\|,ex:\|# setl commentstring=;%s +setl define=^\\s*(def\\k* +setl iskeyword=33,35-39,42-43,45-58,60-90,94,95,97-122,126 -setl comments^=:;;;,:;;,sr:#\|,mb:\|,ex:\|# +let b:undo_ftplugin = 'setl lisp< comments< commentstring< define< iskeyword<' -" Scheme-specific settings -if exists("b:is_mzscheme") || exists("is_mzscheme") - " improve indenting - setl iskeyword+=#,%,^ - setl lispwords+=module,parameterize,let-values,let*-values,letrec-values - setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case - setl lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig -endif +setl lispwords=case +setl lispwords+=define +setl lispwords+=define-record-type +setl lispwords+=define-syntax +setl lispwords+=define-values +setl lispwords+=do +setl lispwords+=guard +setl lispwords+=lambda +setl lispwords+=let +setl lispwords+=let* +setl lispwords+=let*-values +setl lispwords+=let-syntax +setl lispwords+=let-values +setl lispwords+=letrec +setl lispwords+=letrec* +setl lispwords+=letrec-syntax +setl lispwords+=parameterize +setl lispwords+=set! +setl lispwords+=syntax-rules +setl lispwords+=unless +setl lispwords+=when + +let b:undo_ftplugin = b:undo_ftplugin . ' lispwords<' -if exists("b:is_chicken") || exists("is_chicken") - " improve indenting - setl iskeyword+=#,%,^ - setl lispwords+=let-optionals,let-optionals*,declare - setl lispwords+=let-values,let*-values,letrec-values - setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case - setl lispwords+=cond-expand,and-let*,foreign-lambda,foreign-lambda* +let b:did_scheme_ftplugin = 1 + +if exists('b:is_chicken') || exists('g:is_chicken') + exe 'ru! ftplugin/chicken.vim' endif -let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lispwords< lisp< commentstring<" +unlet b:did_scheme_ftplugin +let b:did_ftplugin = 1 +let &cpo = s:cpo +unlet s:cpo diff --git a/runtime/ftplugin/screen.vim b/runtime/ftplugin/screen.vim index 95c3849556..c22089be2c 100644 --- a/runtime/ftplugin/screen.vim +++ b/runtime/ftplugin/screen.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: screen(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: screen(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/scss.vim b/runtime/ftplugin/scss.vim index 981fb1b881..287d298f4a 100644 --- a/runtime/ftplugin/scss.vim +++ b/runtime/ftplugin/scss.vim @@ -1,12 +1,13 @@ " Vim filetype plugin " Language: SCSS " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 Jul 26 +" Last Change: 2016 Aug 29 if exists("b:did_ftplugin") finish endif runtime! ftplugin/sass.vim +setlocal comments=s1:/*,mb:*,ex:*/,:// " vim:set sw=2: diff --git a/runtime/ftplugin/sensors.vim b/runtime/ftplugin/sensors.vim index 813d14c0e1..c02a729405 100644 --- a/runtime/ftplugin/sensors.vim +++ b/runtime/ftplugin/sensors.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sensors.conf(5) - libsensors configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sensors.conf(5) - libsensors configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/services.vim b/runtime/ftplugin/services.vim index d34349ee28..dda08ac20a 100644 --- a/runtime/ftplugin/services.vim +++ b/runtime/ftplugin/services.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: services(5) - Internet network services list -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: services(5) - Internet network services list +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/setserial.vim b/runtime/ftplugin/setserial.vim index f9d5945787..e5823f4432 100644 --- a/runtime/ftplugin/setserial.vim +++ b/runtime/ftplugin/setserial.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: setserial(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: setserial(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sieve.vim b/runtime/ftplugin/sieve.vim index 9a8759c024..3092b5d2d3 100644 --- a/runtime/ftplugin/sieve.vim +++ b/runtime/ftplugin/sieve.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Sieve filtering language input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Sieve filtering language input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpconf.vim b/runtime/ftplugin/slpconf.vim index 0c45689672..a975a499e5 100644 --- a/runtime/ftplugin/slpconf.vim +++ b/runtime/ftplugin/slpconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpreg.vim b/runtime/ftplugin/slpreg.vim index e9d533e2d4..74c7285b66 100644 --- a/runtime/ftplugin/slpreg.vim +++ b/runtime/ftplugin/slpreg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location registration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location registration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpspi.vim b/runtime/ftplugin/slpspi.vim index 8d64d476f1..633555e493 100644 --- a/runtime/ftplugin/slpspi.vim +++ b/runtime/ftplugin/slpspi.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location SPI file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location SPI file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim index c3af8a9fca..2a961f8244 100644 --- a/runtime/ftplugin/spec.vim +++ b/runtime/ftplugin/spec.vim @@ -2,7 +2,7 @@ " Filename: spec.vim " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014) -" Last Change: Sun Mar 2 11:24 MSK 2014 Igor Gnatenko +" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko if exists("b:did_ftplugin") finish @@ -18,13 +18,41 @@ if !exists("no_plugin_maps") && !exists("no_spec_maps") endif endif -noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR> +if !hasmapto("call <SID>SpecChangelog(\"\")<CR>") + noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR> +endif + +if !exists("*s:GetRelVer") + function! s:GetRelVer() + if has('python') +python << PYEND +import sys, datetime, shutil, tempfile +import vim + +try: + import rpm +except ImportError: + pass +else: + specfile = vim.current.buffer.name + if specfile: + rpm.delMacro("dist") + spec = rpm.spec(specfile) + headers = spec.sourceHeader + version = headers["Version"] + release = headers["Release"] + vim.command("let ver = " + version) + vim.command("let rel = " + release) +PYEND + endif + endfunction +endif if !exists("*s:SpecChangelog") function s:SpecChangelog(format) if strlen(a:format) == 0 if !exists("g:spec_chglog_format") - let email = input("Email address: ") + let email = input("Name <email address>: ") let g:spec_chglog_format = "%a %b %d %Y " . l:email echo "\r" endif @@ -69,6 +97,9 @@ if !exists("*s:SpecChangelog") else let include_release_info = 0 endif + + call s:GetRelVer() + if (chgline == -1) let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3) if (option == 1) @@ -83,7 +114,10 @@ if !exists("*s:SpecChangelog") endif endif if (chgline != -1) - let parsed_format = "* ".strftime(format) + let tmptime = v:lc_time + language time C + let parsed_format = "* ".strftime(format)." - ".ver."-".rel + execute "language time" tmptime let release_info = "+ ".name."-".ver."-".rel let wrong_format = 0 let wrong_release = 0 @@ -149,12 +183,8 @@ if !exists("*s:ParseRpmVars") endif let varname = strpart(a:str, start+2, end-(start+2)) execute a:strline - let definestr = "^[ \t]*%define[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$" + let definestr = "^[ \t]*%(?:global|define)[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$" let linenum = search(definestr, "bW") - if (linenum == 0) - let definestr = substitute(definestr, "%define", "%global", "") - let linenum = search(definestr, "bW") - endif if (linenum != -1) let ret = ret . substitute(getline(linenum), definestr, "\\1", "") else @@ -171,7 +201,7 @@ endif let b:match_ignorecase = 0 let b:match_words = - \ '^Name:^%description:^%clean:^%setup:^%build:^%install:^%files:' . + \ '^Name:^%description:^%clean:^%(?:auto)?setup:^%build:^%install:^%files:' . \ '^%package:^%preun:^%postun:^%changelog' let &cpo = s:cpo_save diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index c2bc857947..4d6fcd9564 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 11.0 +" Version: 12.0 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Last Change: 2013 May 13 +" Last Change: 2017 Mar 07 " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -36,6 +36,14 @@ " " History " +" Version 12.0 (April 2013) +" +" NF: Added support for "BEGIN TRY ... END TRY ... BEGIN CATCH ... END CATCH +" BF: This plugin is designed to be used with other plugins to enable the +" SQL completion with Perl, Python, Java, ... The loading mechanism +" was not checking if the SQL objects were created, which can lead to +" the plugin not loading the SQL support. +" " Version 11.0 (May 2013) " " NF: Updated to use SyntaxComplete's new regex support for syntax groups. @@ -80,15 +88,17 @@ " Only do this when not done yet for this buffer -if exists("b:did_ftplugin") - finish +" This ftplugin can be used with other ftplugins. So ensure loading +" happens if all elements of this plugin have not yet loaded. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let s:save_cpo = &cpo set cpo&vim " Disable autowrapping for code, but enable for comments -" t Auto-wrap text using textwidth +" t Auto-wrap text using textwidth " c Auto-wrap comments using textwidth, inserting the current comment " leader automatically. setlocal formatoptions-=t @@ -171,6 +181,9 @@ if !exists("*SQL_SetType") if exists("b:current_syntax") " echomsg 'SQLSetType - clearing syntax' syntax clear + if exists("b:current_syntax") + unlet b:current_syntax + endif endif if exists("b:did_indent") " echomsg 'SQLSetType - clearing indent' @@ -187,7 +200,7 @@ if !exists("*SQL_SetType") " Do not specify a buffer local variable if it is " the default value if new_sql_type == 'sql' - let new_sql_type = 'sqloracle' + let new_sql_type = 'sqloracle' endif let b:sql_type_override = new_sql_type @@ -234,25 +247,26 @@ if exists("b:sql_type_override") " echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim' if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != '' exec 'runtime ftplugin/'.b:sql_type_override.'.vim' - " else - " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' + " else + " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' endif elseif exists("g:sql_type_default") " echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim' if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != '' exec 'runtime ftplugin/'.g:sql_type_default.'.vim' - " else - " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' + " else + " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' endif endif " If the above runtime command succeeded, do not load the default settings -if exists("b:did_ftplugin") - finish +" as they should have already been loaded from a previous run. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" . - \ " | unlet! b:browsefilter b:match_words" + \ " | unlet! b:browsefilter b:match_words" " Don't load another plugin for this buffer let b:did_ftplugin = 1 @@ -261,7 +275,7 @@ let b:current_ftplugin = 'sql' " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif " Some standard expressions for use with the matchit strings @@ -312,14 +326,24 @@ if !exists("b:match_words") " WHEN column_not_found THEN " WHEN OTHERS THEN " + " begin try + " end try + " begin catch + " end catch + " " create[ or replace] procedure|function|event - " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. + " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. " For ColdFusion support setlocal matchpairs+=<:> let b:match_words = &matchpairs . - \ ',\<begin\>:\<end\>\W*$,'. - \ + \ ',\%(\<begin\)\%(\s\+\%(try\|catch\)\>\)\@!:\<end\>\W*$,'. + \ + \ '\<begin\s\+try\>:'. + \ '\<end\s\+try\>:'. + \ '\<begin\s\+catch\>:'. + \ '\<end\s\+catch\>,'. + \ \ s:notend . '\<if\>:'. \ '\<elsif\>\|\<elseif\>\|\<else\>:'. \ '\<end\s\+if\>,'. @@ -339,14 +363,14 @@ if !exists("b:match_words") \ '\%(\<create\s\+' . s:or_replace . '\)\?'. \ '\%(function\|procedure\|event\):'. \ '\<returns\?\>' - " \ '\<begin\>\|\<returns\?\>:'. - " \ '\<end\>\(;\)\?\s*$' - " \ '\<exception\>:'.s:when_no_matched_or_others. - " \ ':\<when\s\+others\>,'. - " - " \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'. - " \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'. - " \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' . + " \ '\<begin\>\|\<returns\?\>:'. + " \ '\<end\>\(;\)\?\s*$' + " \ '\<exception\>:'.s:when_no_matched_or_others. + " \ ':\<when\s\+others\>,'. + " + " \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'. + " \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'. + " \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' . endif " Define how to find the macro definition of a variable using the various diff --git a/runtime/ftplugin/sshconfig.vim b/runtime/ftplugin/sshconfig.vim index f940af972e..d933ce0527 100644 --- a/runtime/ftplugin/sshconfig.vim +++ b/runtime/ftplugin/sshconfig.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: OpenSSH client configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: OpenSSH client configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sudoers.vim b/runtime/ftplugin/sudoers.vim index 5756302178..38dbf559ee 100644 --- a/runtime/ftplugin/sudoers.vim +++ b/runtime/ftplugin/sudoers.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sudoers(5) configuration files -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sudoers(5) configuration files +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sysctl.vim b/runtime/ftplugin/sysctl.vim index fb1098dd3b..8d331cea38 100644 --- a/runtime/ftplugin/sysctl.vim +++ b/runtime/ftplugin/sysctl.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sysctl.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sysctl.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim new file mode 100644 index 0000000000..60b3fd996d --- /dev/null +++ b/runtime/ftplugin/systemd.vim @@ -0,0 +1,7 @@ +" Vim filetype plugin file +" Language: systemd.unit(5) + +if !exists('b:did_ftplugin') + " Looks a lot like dosini files. + runtime! ftplugin/dosini.vim +endif diff --git a/runtime/ftplugin/terminfo.vim b/runtime/ftplugin/terminfo.vim index 7ce31d1ca1..0ffcc58f58 100644 --- a/runtime/ftplugin/terminfo.vim +++ b/runtime/ftplugin/terminfo.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: terminfo(5) definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: terminfo(5) definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/tmux.vim b/runtime/ftplugin/tmux.vim new file mode 100644 index 0000000000..ed9154924b --- /dev/null +++ b/runtime/ftplugin/tmux.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: tmux(1) configuration file +" URL: https://github.com/ericpruitt/tmux.vim/ +" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> +" Last Changed: 2017 Mar 10 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/treetop.vim b/runtime/ftplugin/treetop.vim index 2da3c405f5..f978d15303 100644 --- a/runtime/ftplugin/treetop.vim +++ b/runtime/ftplugin/treetop.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevconf.vim b/runtime/ftplugin/udevconf.vim index 6042e14413..0bbd86a0a4 100644 --- a/runtime/ftplugin/udevconf.vim +++ b/runtime/ftplugin/udevconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevperm.vim b/runtime/ftplugin/udevperm.vim index e7ad31d071..f8fb4d4d99 100644 --- a/runtime/ftplugin/udevperm.vim +++ b/runtime/ftplugin/udevperm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) permissions file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) permissions file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevrules.vim b/runtime/ftplugin/udevrules.vim index be8d646968..6404f6c85e 100644 --- a/runtime/ftplugin/udevrules.vim +++ b/runtime/ftplugin/udevrules.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) rules file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) rules file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/updatedb.vim b/runtime/ftplugin/updatedb.vim index f4e7bcebd5..3015918d70 100644 --- a/runtime/ftplugin/updatedb.vim +++ b/runtime/ftplugin/updatedb.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: updatedb.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: updatedb.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index edba37b896..61dc79db7a 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Vim " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2013 Jun 26 +" Last Change: 2017 Dec 05 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -25,6 +25,9 @@ setlocal fo-=t fo+=croql " keyword character. E.g., for netrw#Nread(). setlocal isk+=# +" Use :help to lookup the keyword under the cursor with K. +setlocal keywordprg=:help + " Set 'comments' to format dashed lists in comments setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" @@ -36,21 +39,23 @@ endif " Comments start with a double quote setlocal commentstring=\"%s -" Move around functions. -nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR> -vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR> -nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR> -vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR> -nnoremap <silent><buffer> [] m':call search('^\s*endf*\%[unction]\>', "bW")<CR> -vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "bW")<CR> -nnoremap <silent><buffer> ][ m':call search('^\s*endf*\%[unction]\>', "W")<CR> -vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "W")<CR> +if !exists("no_plugin_maps") && !exists("no_vim_maps") + " Move around functions. + nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR> + vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR> + nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR> + vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR> + nnoremap <silent><buffer> [] m':call search('^\s*endf*\%[unction]\>', "bW")<CR> + vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "bW")<CR> + nnoremap <silent><buffer> ][ m':call search('^\s*endf*\%[unction]\>', "W")<CR> + vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "W")<CR> -" Move around comments -nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> -vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> -nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> -vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> + " Move around comments + nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> + vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> + nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> + vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> +endif " Let the matchit plugin know what items can be matched. if exists("loaded_matchit") @@ -62,9 +67,12 @@ if exists("loaded_matchit") \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' . \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' . \ '(:)' - " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif - let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" || - \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' + " Ignore syntax region commands and settings, any 'en*' would clobber + " if-endif. + " - set spl=de,en + " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … + let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") + \ =~? "comment\\|string\\|vimSynReg\\|vimSet"' endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/vroom.vim b/runtime/ftplugin/vroom.vim index 75f61f7b90..3d9e7835d0 100644 --- a/runtime/ftplugin/vroom.vim +++ b/runtime/ftplugin/vroom.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 if exists('b:did_ftplugin') diff --git a/runtime/ftplugin/xdefaults.vim b/runtime/ftplugin/xdefaults.vim index cd851829ca..c1aff70176 100644 --- a/runtime/ftplugin/xdefaults.vim +++ b/runtime/ftplugin/xdefaults.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: X resources files like ~/.Xdefaults (xrdb) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: X resources files like ~/.Xdefaults (xrdb) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xf86conf.vim b/runtime/ftplugin/xf86conf.vim index ab7569a100..5a21539dd5 100644 --- a/runtime/ftplugin/xf86conf.vim +++ b/runtime/ftplugin/xf86conf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: XFree86 Configuration File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: XFree86 Configuration File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xinetd.vim b/runtime/ftplugin/xinetd.vim index f209af18be..2b7b64e4fa 100644 --- a/runtime/ftplugin/xinetd.vim +++ b/runtime/ftplugin/xinetd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim index 236e870537..573a6ba441 100644 --- a/runtime/ftplugin/xml.vim +++ b/runtime/ftplugin/xml.vim @@ -1,8 +1,10 @@ " Vim filetype plugin file " Language: xml -" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> -" Last Changed: 20 Jan 2009 -" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin +" Maintainer: Christian Brabandt <cb@256bit.org> +" Last Changed: May 08th, 2018 +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -10,16 +12,16 @@ let b:did_ftplugin = 1 " Make sure the continuation lines below do not cause problems in " compatibility mode. let s:save_cpo = &cpo -set cpo-=C +set cpo&vim setlocal commentstring=<!--%s--> -setlocal comments=s:<!--,m:\ \ \ \ \ ,e:--> +" Remove the middlepart from the comments section, as this causes problems: +" https://groups.google.com/d/msg/vim_dev/x4GT-nqa0Kg/jvtRnEbtAnMJ +setlocal comments=s:<!--,e:--> setlocal formatoptions-=t -if !exists("g:ft_xml_autocomment") || (g:ft_xml_autocomment == 1) - setlocal formatoptions+=croql -endif - +setlocal formatoptions+=croql +setlocal formatexpr=xmlformat#Format() " XML: thanks to Johannes Zellner and Akbar Ibrahim " - case sensitive @@ -39,7 +41,6 @@ if exists("loaded_matchit") \ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' endif -" " For Omni completion, by Mikolaj Machowski. if exists('&ofu') setlocal ofu=xmlcomplete#CompleteTags @@ -47,17 +48,17 @@ endif command! -nargs=+ XMLns call xmlcomplete#CreateConnection(<f-args>) command! -nargs=? XMLent call xmlcomplete#CreateEntConnection(<f-args>) - " Change the :browse e filter to primarily show xml-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="XML Files (*.xml)\t*.xml\n" . - \ "DTD Files (*.dtd)\t*.dtd\n" . - \ "All Files (*.*)\t*.*\n" + \ "DTD Files (*.dtd)\t*.dtd\n" . + \ "XSD Files (*.xsd)\t*.xsd\n" . + \ "All Files (*.*)\t*.*\n" endif " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal commentstring< comments< formatoptions<" . - \ " | unlet! b:match_ignorecase b:match_words b:browsefilter" +let b:undo_ftplugin = "setlocal commentstring< comments< formatoptions< formatexpr< " . + \ " | unlet! b:match_ignorecase b:match_words b:browsefilter" " Restore the saved compatibility options. let &cpo = s:save_cpo diff --git a/runtime/ftplugin/xmodmap.vim b/runtime/ftplugin/xmodmap.vim index 027ae09ff2..77fccd5b4d 100644 --- a/runtime/ftplugin/xmodmap.vim +++ b/runtime/ftplugin/xmodmap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: xmodmap(1) definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: xmodmap(1) definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/yaml.vim b/runtime/ftplugin/yaml.vim index b88803ab3a..ceff36f7e4 100644 --- a/runtime/ftplugin/yaml.vim +++ b/runtime/ftplugin/yaml.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: YAML (YAML Ain't Markup Language) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: YAML (YAML Ain't Markup Language) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/zimbu.vim b/runtime/ftplugin/zimbu.vim index ff281202e0..2e3138edf8 100644 --- a/runtime/ftplugin/zimbu.vim +++ b/runtime/ftplugin/zimbu.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Zimbu " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Sep 08 +" Last Change: 2017 Dec 05 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -135,8 +135,10 @@ iabbr <buffer> <expr> until GCUpperSpace("until") iabbr <buffer> <expr> while GCUpperSpace("while") iabbr <buffer> <expr> repeat GCUpper("repeat") -nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR> -nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR> +if !exists("no_plugin_maps") && !exists("no_zimbu_maps") + nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR> + nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR> +endif " Using a function makes sure the search pattern is restored func! ZimbuGoStartBlock() diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index 3970d65cc8..fe8efc59ab 100644 --- a/runtime/ftplugin/zsh.vim +++ b/runtime/ftplugin/zsh.vim @@ -1,7 +1,10 @@ " Vim filetype plugin file -" Language: Zsh shell script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-01-23 +" Language: Zsh shell script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2017-11-22 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:did_ftplugin") finish @@ -15,9 +18,7 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql -let b:match_words = - \ &matchpairs - \ . ',\<if\>:\<elif\>:\<else\>:\<fi\>' +let b:match_words = ',\<if\>:\<elif\>:\<else\>:\<fi\>' \ . ',\<case\>:^\s*([^)]*):\<esac\>' \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>' let b:match_skip = 's:comment\|string\|heredoc\|subst' diff --git a/runtime/gvim.desktop b/runtime/gvim.desktop new file mode 100644 index 0000000000..aeeddfc251 --- /dev/null +++ b/runtime/gvim.desktop @@ -0,0 +1,81 @@ +[Desktop Entry] +Name=GVim +GenericName=Text Editor +GenericName[de]=Texteditor +Comment=Edit text files +Comment[af]=Redigeer tekslêers +Comment[am]=የጽሑፍ ፋይሎች ያስተካክሉ +Comment[ar]=حرّر ملفات نصية +Comment[az]=Mətn fayllarını redaktə edin +Comment[be]=Рэдагаваньне тэкставых файлаў +Comment[bg]=Редактиране на текстови файлове +Comment[bn]=টেক্স্ট ফাইল এডিট করুন +Comment[bs]=Izmijeni tekstualne datoteke +Comment[ca]=Edita fitxers de text +Comment[cs]=Úprava textových souborů +Comment[cy]=Golygu ffeiliau testun +Comment[da]=Redigér tekstfiler +Comment[de]=Textdateien bearbeiten +Comment[el]=Επεξεργασία αρχείων κειμένου +Comment[en_CA]=Edit text files +Comment[en_GB]=Edit text files +Comment[es]=Edita archivos de texto +Comment[et]=Redigeeri tekstifaile +Comment[eu]=Editatu testu-fitxategiak +Comment[fa]=ویرایش پرونده‌های متنی +Comment[fi]=Muokkaa tekstitiedostoja +Comment[fr]=Édite des fichiers texte +Comment[ga]=Eagar comhad Téacs +Comment[gu]=લખાણ ફાઇલોમાં ફેરફાર કરો +Comment[he]=ערוך קבצי טקסט +Comment[hi]=पाठ फ़ाइलें संपादित करें +Comment[hr]=Uređivanje tekstualne datoteke +Comment[hu]=Szövegfájlok szerkesztése +Comment[id]=Edit file teks +Comment[it]=Modifica file di testo +Comment[ja]=テキストファイルを編集します +Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು +Comment[ko]=텍스트 파일을 편집합니다 +Comment[lt]=Redaguoti tekstines bylas +Comment[lv]=Rediģēt teksta failus +Comment[mk]=Уреди текстуални фајлови +Comment[ml]=വാചക രചനകള് തിരുത്തുക +Comment[mn]=Текст файл боловсруулах +Comment[mr]=गद्य फाइल संपादित करा +Comment[ms]=Edit fail teks +Comment[nb]=Rediger tekstfiler +Comment[ne]=पाठ फाइललाई संशोधन गर्नुहोस् +Comment[nl]=Tekstbestanden bewerken +Comment[nn]=Rediger tekstfiler +Comment[no]=Rediger tekstfiler +Comment[or]=ପାଠ୍ଯ ଫାଇଲଗୁଡ଼ିକୁ ସମ୍ପାଦନ କରନ୍ତୁ +Comment[pa]=ਪਾਠ ਫਾਇਲਾਂ ਸੰਪਾਦਨ +Comment[pl]=Edytor plików tekstowych +Comment[pt]=Editar ficheiros de texto +Comment[pt_BR]=Edite arquivos de texto +Comment[ro]=Editare fişiere text +Comment[ru]=Редактор текстовых файлов +Comment[sk]=Úprava textových súborov +Comment[sl]=Urejanje datotek z besedili +Comment[sq]=Përpuno files teksti +Comment[sr]=Измени текстуалне датотеке +Comment[sr@Latn]=Izmeni tekstualne datoteke +Comment[sv]=Redigera textfiler +Comment[ta]=உரை கோப்புகளை தொகுக்கவும் +Comment[th]=แก้ไขแฟ้มข้อความ +Comment[tk]=Metin faýllary editle +Comment[tr]=Metin dosyalarını düzenle +Comment[uk]=Редактор текстових файлів +Comment[vi]=Soạn thảo tập tin văn bản +Comment[wa]=Asspougnî des fitchîs tecses +Comment[zh_CN]=编辑文本文件 +Comment[zh_TW]=編輯文字檔 +TryExec=gvim +Exec=gvim -f %F +Terminal=false +Type=Application +Keywords=Text;editor; +Icon=gvim +Categories=Utility;TextEditor; +StartupNotify=true +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; diff --git a/runtime/gvimrc_example.vim b/runtime/gvimrc_example.vim index 5a5197e99a..fa0f6851d1 100644 --- a/runtime/gvimrc_example.vim +++ b/runtime/gvimrc_example.vim @@ -1,8 +1,9 @@ " An example for a gvimrc file. -" The commands in this are executed when the GUI is started. +" The commands in this are executed when the GUI is started, after the vimrc +" has been executed. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2001 Sep 02 +" Last change: 2016 Apr 05 " " To use it, copy it to " for Unix and OS/2: ~/.gvimrc @@ -27,17 +28,11 @@ map! <S-Insert> <MiddleMouse> " Only do this for Vim version 5.0 and later. if version >= 500 - " I like highlighting strings inside C comments - let c_comment_strings=1 - " Switch on syntax highlighting if it wasn't on yet. if !exists("syntax_on") syntax on endif - " Switch on search pattern highlighting. - set hlsearch - " For Win32 version, have "K" lookup the keyword in a help file "if has("win32") " let winhelpfile='windows.hlp' diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 03fbaa3a18..5019f0b736 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -148,7 +148,7 @@ function s:StatementIndent( current_indent, prev_lnum ) " Get previous non-blank/non-comment-only line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) - + if line !~ '^\s*$' && line !~ '^\s*#' break endif diff --git a/runtime/indent/automake.vim b/runtime/indent/automake.vim index 5fbc222bc7..7e38f92ebf 100644 --- a/runtime/indent/automake.vim +++ b/runtime/indent/automake.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: automake -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: automake +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_indent") finish diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim new file mode 100644 index 0000000000..24e5b870cd --- /dev/null +++ b/runtime/indent/bzl.vim @@ -0,0 +1,97 @@ +" Vim indent file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +if exists('b:did_indent') + finish +endif + +" Load base python indent. +if !exists('*GetPythonIndent') + runtime! indent/python.vim +endif + +let b:did_indent = 1 + +" Only enable bzl google indent if python google indent is enabled. +if !get(g:, 'no_google_python_indent') + setlocal indentexpr=GetBzlIndent(v:lnum) +endif + +if exists('*GetBzlIndent') + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +" Maximum number of lines to look backwards. +let s:maxoff = 50 + +"" +" Determine the correct indent level given an {lnum} in the current buffer. +function GetBzlIndent(lnum) abort + let l:use_recursive_indent = !get(g:, 'no_google_python_recursive_indent') + if l:use_recursive_indent + " Backup and override indent setting variables. + if exists('g:pyindent_nested_paren') + let l:pyindent_nested_paren = g:pyindent_nested_paren + endif + if exists('g:pyindent_open_paren') + let l:pyindent_open_paren = g:pyindent_open_paren + endif + " Vim 7.3.693 and later defines a shiftwidth() function to get the effective + " shiftwidth value. Fall back to &shiftwidth if the function doesn't exist. + let l:sw_expr = exists('*shiftwidth') ? 'shiftwidth()' : '&shiftwidth' + let g:pyindent_nested_paren = l:sw_expr . ' * 2' + let g:pyindent_open_paren = l:sw_expr . ' * 2' + endif + + let l:indent = -1 + + " Indent inside parens. + " Align with the open paren unless it is at the end of the line. + " E.g. + " open_paren_not_at_EOL(100, + " (200, + " 300), + " 400) + " open_paren_at_EOL( + " 100, 200, 300, 400) + call cursor(a:lnum, 1) + let [l:par_line, l:par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" . + \ " synIDattr(synID(line('.'), col('.'), 1), 'name')" . + \ " =~ '\\(Comment\\|String\\)$'") + if l:par_line > 0 + call cursor(l:par_line, 1) + if l:par_col != col('$') - 1 + let l:indent = l:par_col + endif + endif + + " Delegate the rest to the original function. + if l:indent == -1 + let l:indent = GetPythonIndent(a:lnum) + endif + + if l:use_recursive_indent + " Restore global variables. + if exists('l:pyindent_nested_paren') + let g:pyindent_nested_paren = l:pyindent_nested_paren + else + unlet g:pyindent_nested_paren + endif + if exists('l:pyindent_open_paren') + let g:pyindent_open_paren = l:pyindent_open_paren + else + unlet g:pyindent_open_paren + endif + endif + + return l:indent +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim index db2b9052b2..5ec2a7b21a 100644 --- a/runtime/indent/cdl.vim +++ b/runtime/indent/cdl.vim @@ -16,7 +16,7 @@ if exists("*CdlGetIndent") "finish endif -" find out if an "...=..." expresion its an asignment (or a conditional) +" find out if an "...=..." expresion is an assignment (or a conditional) " it scans 'line' first, and then the previos lines fun! CdlAsignment(lnum, line) let f = -1 diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim index 476ac1de1c..7592b10d7d 100644 --- a/runtime/indent/clojure.vim +++ b/runtime/indent/clojure.vim @@ -1,17 +1,12 @@ " Vim indent file -" Language: Clojure -" Author: Meikel Brandmeyer <mb@kotka.de> -" URL: http://kotka.de/projects/clojure/vimclojure.html +" Language: Clojure +" Author: Meikel Brandmeyer <mb@kotka.de> +" URL: http://kotka.de/projects/clojure/vimclojure.html " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 - -" TODO: Indenting after multibyte characters is broken: -" (let [Δ (if foo -" bar ; Indent error -" baz)]) +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:did_indent") finish @@ -57,36 +52,39 @@ if exists("*searchpairpos") let g:clojure_align_subforms = 0 endif - function! s:SynIdName() + function! s:syn_id_name() return synIDattr(synID(line("."), col("."), 0), "name") endfunction - function! s:CurrentChar() + function! s:ignored_region() + return s:syn_id_name() =~? '\vstring|regex|comment|character' + endfunction + + function! s:current_char() return getline('.')[col('.')-1] endfunction - function! s:CurrentWord() + function! s:current_word() return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2] endfunction - function! s:IsParen() - return s:CurrentChar() =~# '\v[\(\)\[\]\{\}]' && - \ s:SynIdName() !~? '\vstring|regex|comment|character' + function! s:is_paren() + return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region() endfunction " Returns 1 if string matches a pattern in 'patterns', which may be a " list of patterns, or a comma-delimited string of implicitly anchored " patterns. - function! s:MatchesOne(patterns, string) + function! s:match_one(patterns, string) let list = type(a:patterns) == type([]) - \ ? a:patterns - \ : map(split(a:patterns, ','), '"^" . v:val . "$"') + \ ? a:patterns + \ : map(split(a:patterns, ','), '"^" . v:val . "$"') for pat in list if a:string =~# pat | return 1 | endif endfor endfunction - function! s:MatchPairs(open, close, stopat) + function! s:match_pairs(open, close, stopat) " Stop only on vector and map [ resp. {. Ignore the ones in strings and " comments. if a:stopat == 0 @@ -95,11 +93,11 @@ if exists("*searchpairpos") let stopat = a:stopat endif - let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:IsParen()", stopat) - return [pos[0], virtcol(pos)] + let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat) + return [pos[0], col(pos)] endfunction - function! s:ClojureCheckForStringWorker() + function! s:clojure_check_for_string_worker() " Check whether there is the last character of the previous line is " highlighted as a string. If so, we check whether it's a ". In this " case we have to check also the previous character. The " might be the @@ -113,17 +111,17 @@ if exists("*searchpairpos") call cursor(nb, 0) call cursor(0, col("$") - 1) - if s:SynIdName() !~? "string" + if s:syn_id_name() !~? "string" return -1 endif " This will not work for a " in the first column... - if s:CurrentChar() == '"' + if s:current_char() == '"' call cursor(0, col("$") - 2) - if s:SynIdName() !~? "string" + if s:syn_id_name() !~? "string" return -1 endif - if s:CurrentChar() != '\\' + if s:current_char() != '\\' return -1 endif call cursor(0, col("$") - 1) @@ -138,40 +136,40 @@ if exists("*searchpairpos") return indent(".") endfunction - function! s:CheckForString() + function! s:check_for_string() let pos = getpos('.') try - let val = s:ClojureCheckForStringWorker() + let val = s:clojure_check_for_string_worker() finally call setpos('.', pos) endtry return val endfunction - function! s:StripNamespaceAndMacroChars(word) + function! s:strip_namespace_and_macro_chars(word) return substitute(a:word, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '') endfunction - function! s:ClojureIsMethodSpecialCaseWorker(position) + function! s:clojure_is_method_special_case_worker(position) " Find the next enclosing form. call search('\S', 'Wb') " Special case: we are at a '(('. - if s:CurrentChar() == '(' + if s:current_char() == '(' return 0 endif call cursor(a:position) - let nextParen = s:MatchPairs('(', ')', 0) + let next_paren = s:match_pairs('(', ')', 0) " Special case: we are now at toplevel. - if nextParen == [0, 0] + if next_paren == [0, 0] return 0 endif - call cursor(nextParen) + call cursor(next_paren) call search('\S', 'W') - let w = s:StripNamespaceAndMacroChars(s:CurrentWord()) + let w = s:strip_namespace_and_macro_chars(s:current_word()) if g:clojure_special_indent_words =~# '\V\<' . w . '\>' return 1 endif @@ -179,27 +177,43 @@ if exists("*searchpairpos") return 0 endfunction - function! s:IsMethodSpecialCase(position) + function! s:is_method_special_case(position) let pos = getpos('.') try - let val = s:ClojureIsMethodSpecialCaseWorker(a:position) + let val = s:clojure_is_method_special_case_worker(a:position) finally call setpos('.', pos) endtry return val endfunction - function! GetClojureIndent() + " Check if form is a reader conditional, that is, it is prefixed by #? + " or @#? + function! s:is_reader_conditional_special_case(position) + if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" + return 1 + endif + + return 0 + endfunction + + " Returns 1 for opening brackets, -1 for _anything else_. + function! s:bracket_type(char) + return stridx('([{', a:char) > -1 ? 1 : -1 + endfunction + + " Returns: [opening-bracket-lnum, indent] + function! s:clojure_indent_pos() " Get rid of special case. if line(".") == 1 - return 0 + return [0, 0] endif " We have to apply some heuristics here to figure out, whether to use " normal lisp indenting or not. - let i = s:CheckForString() + let i = s:check_for_string() if i > -1 - return i + !!g:clojure_align_multiline_strings + return [0, i + !!g:clojure_align_multiline_strings] endif call cursor(0, 1) @@ -207,28 +221,28 @@ if exists("*searchpairpos") " Find the next enclosing [ or {. We can limit the second search " to the line, where the [ was found. If no [ was there this is " zero and we search for an enclosing {. - let paren = s:MatchPairs('(', ')', 0) - let bracket = s:MatchPairs('\[', '\]', paren[0]) - let curly = s:MatchPairs('{', '}', bracket[0]) + let paren = s:match_pairs('(', ')', 0) + let bracket = s:match_pairs('\[', '\]', paren[0]) + let curly = s:match_pairs('{', '}', bracket[0]) " In case the curly brace is on a line later then the [ or - in " case they are on the same line - in a higher column, we take the " curly indent. if curly[0] > bracket[0] || curly[1] > bracket[1] if curly[0] > paren[0] || curly[1] > paren[1] - return curly[1] + return curly endif endif " If the curly was not chosen, we take the bracket indent - if " there was one. if bracket[0] > paren[0] || bracket[1] > paren[1] - return bracket[1] + return bracket endif " There are neither { nor [ nor (, ie. we are at the toplevel. if paren == [0, 0] - return 0 + return paren endif " Now we have to reimplement lispindent. This is surprisingly easy, as @@ -246,58 +260,120 @@ if exists("*searchpairpos") " - In any other case we use the column of the end of the word + 2. call cursor(paren) - if s:IsMethodSpecialCase(paren) - return paren[1] + &shiftwidth - 1 + if s:is_method_special_case(paren) + return [paren[0], paren[1] + &shiftwidth - 1] + endif + + if s:is_reader_conditional_special_case(paren) + return paren endif " In case we are at the last character, we use the paren position. if col("$") - 1 == paren[1] - return paren[1] + return paren endif " In case after the paren is a whitespace, we search for the next word. call cursor(0, col('.') + 1) - if s:CurrentChar() == ' ' + if s:current_char() == ' ' call search('\v\S', 'W') endif " If we moved to another line, there is no word after the (. We " use the ( position for indent. if line(".") > paren[0] - return paren[1] + return paren endif " We still have to check, whether the keyword starts with a (, [ or {. " In that case we use the ( position for indent. - let w = s:CurrentWord() - if stridx('([{', w[0]) > -1 - return paren[1] + let w = s:current_word() + if s:bracket_type(w[0]) == 1 + return paren endif " Test words without namespace qualifiers and leading reader macro " metacharacters. " " e.g. clojure.core/defn and #'defn should both indent like defn. - let ww = s:StripNamespaceAndMacroChars(w) + let ww = s:strip_namespace_and_macro_chars(w) if &lispwords =~# '\V\<' . ww . '\>' - return paren[1] + &shiftwidth - 1 + return [paren[0], paren[1] + &shiftwidth - 1] endif if g:clojure_fuzzy_indent - \ && !s:MatchesOne(g:clojure_fuzzy_indent_blacklist, ww) - \ && s:MatchesOne(g:clojure_fuzzy_indent_patterns, ww) - return paren[1] + &shiftwidth - 1 + \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww) + \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww) + return [paren[0], paren[1] + &shiftwidth - 1] endif call search('\v\_s', 'cW') call search('\v\S', 'W') if paren[0] < line(".") - return paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1) + return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)] endif call search('\v\S', 'bW') - return virtcol(".") + 1 + return [line('.'), col('.') + 1] + endfunction + + function! GetClojureIndent() + let lnum = line('.') + let orig_lnum = lnum + let orig_col = col('.') + let [opening_lnum, indent] = s:clojure_indent_pos() + + " Account for multibyte characters + if opening_lnum > 0 + let indent -= indent - virtcol([opening_lnum, indent]) + endif + + " Return if there are no previous lines to inherit from + if opening_lnum < 1 || opening_lnum >= lnum - 1 + call cursor(orig_lnum, orig_col) + return indent + endif + + let bracket_count = 0 + + " Take the indent of the first previous non-white line that is + " at the same sexp level. cf. src/misc1.c:get_lisp_indent() + while 1 + let lnum = prevnonblank(lnum - 1) + let col = 1 + + if lnum <= opening_lnum + break + endif + + call cursor(lnum, col) + + " Handle bracket counting edge case + if s:is_paren() + let bracket_count += s:bracket_type(s:current_char()) + endif + + while 1 + if search('\v[(\[{}\])]', '', lnum) < 1 + break + elseif !s:ignored_region() + let bracket_count += s:bracket_type(s:current_char()) + endif + endwhile + + if bracket_count == 0 + " Check if this is part of a multiline string + call cursor(lnum, 1) + if s:syn_id_name() !~? '\vstring|regex' + call cursor(orig_lnum, orig_col) + return indent(lnum) + endif + endif + endwhile + + call cursor(orig_lnum, orig_col) + return indent endfunction setlocal indentexpr=GetClojureIndent() diff --git a/runtime/indent/config.vim b/runtime/indent/config.vim index 7eb1657572..074f467bee 100644 --- a/runtime/indent/config.vim +++ b/runtime/indent/config.vim @@ -1,8 +1,8 @@ " Vim indent file -" Language: Autoconf configure.{ac,in} file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 -" TODO: how about nested [()]'s in one line +" Language: Autoconf configure.{ac,in} file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 +" TODO: how about nested [()]'s in one line " what's wrong with '\\\@!'? " Only load this indent file when no other was loaded. diff --git a/runtime/indent/context.vim b/runtime/indent/context.vim new file mode 100644 index 0000000000..652479f7e2 --- /dev/null +++ b/runtime/indent/context.vim @@ -0,0 +1,36 @@ +" ConTeXt indent file +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Last Change: 2016 Oct 15 + +if exists("b:did_indent") + finish +endif + +if !get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + finish +endif + +" Load MetaPost indentation script +runtime! indent/mp.vim + +let s:keepcpo= &cpo +set cpo&vim + +setlocal indentexpr=GetConTeXtIndent() + +let b:undo_indent = "setl indentexpr<" + +function! GetConTeXtIndent() + " Use MetaPost rules inside MetaPost graphic environments + if len(synstack(v:lnum, 1)) > 0 && + \ synIDattr(synstack(v:lnum, 1)[0], "name") ==# 'contextMPGraphic' + return GetMetaPostIndent() + endif + return -1 +endfunc + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:sw=2 diff --git a/runtime/indent/css.vim b/runtime/indent/css.vim index f0a272eff9..4d15b8d2dc 100644 --- a/runtime/indent/css.vim +++ b/runtime/indent/css.vim @@ -2,6 +2,7 @@ " Language: CSS " Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2012-05-30 +" Use of shiftwidth() added by Oleg Zubchenko. if exists("b:did_indent") finish @@ -75,8 +76,8 @@ function GetCSSIndent() return 0 endif - return indent(pnum) + s:count_braces(pnum, 1) * &sw - \ - s:count_braces(v:lnum, 0) * &sw + return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + \ - s:count_braces(v:lnum, 0) * shiftwidth() endfunction let &cpo = s:keepcpo diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index 965c7786ed..999b8d6a76 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:did_indent") finish @@ -27,6 +27,7 @@ function! GetCucumberIndent() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) let nline = getline(nextnonblank(v:lnum+1)) + let sw = exists('*shiftwidth') ? shiftwidth() : &sw let syn = s:syn(prevnonblank(v:lnum-1)) let csyn = s:syn(v:lnum) let nsyn = s:syn(nextnonblank(v:lnum+1)) @@ -35,38 +36,38 @@ function! GetCucumberIndent() return 0 elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):' " examples heading - return 2 * &sw + return 2 * sw elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' " background, scenario or outline heading - return &sw + return sw elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:' " line after feature heading - return &sw + return sw elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):' " line after examples heading - return 3 * &sw + return 3 * sw elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' " line after background, scenario or outline heading - return 2 * &sw + return 2 * sw elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) " tag or comment before a feature heading return 0 elseif cline =~# '^\s*@' " other tags - return &sw + return sw elseif cline =~# '^\s*[#|]' && line =~# '^\s*|' " mid-table " preserve indent return indent(prevnonblank(v:lnum-1)) elseif cline =~# '^\s*|' && line =~# '^\s*[^|]' " first line of a table, relative indent - return indent(prevnonblank(v:lnum-1)) + &sw + return indent(prevnonblank(v:lnum-1)) + sw elseif cline =~# '^\s*[^|]' && line =~# '^\s*|' " line after a table, relative unindent - return indent(prevnonblank(v:lnum-1)) - &sw + return indent(prevnonblank(v:lnum-1)) - sw elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):') " comments on scenarios - return &sw + return sw endif return indent(prevnonblank(v:lnum-1)) endfunction diff --git a/runtime/indent/dictconf.vim b/runtime/indent/dictconf.vim index adbc1a5242..2e15c76146 100644 --- a/runtime/indent/dictconf.vim +++ b/runtime/indent/dictconf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish diff --git a/runtime/indent/dictdconf.vim b/runtime/indent/dictdconf.vim index 9427342c7e..5c4fbdafb5 100644 --- a/runtime/indent/dictdconf.vim +++ b/runtime/indent/dictdconf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish diff --git a/runtime/indent/docbk.vim b/runtime/indent/docbk.vim index 3fde2a13b6..d8661ffbe9 100644 --- a/runtime/indent/docbk.vim +++ b/runtime/indent/docbk.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: DocBook Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: DocBook Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_indent") finish diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim index 88c0c5129e..5633362367 100644 --- a/runtime/indent/dtd.vim +++ b/runtime/indent/dtd.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: DTD (Document Type Definition for XML) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-07-08 +" Language: DTD (Document Type Definition for XML) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-07-08 let s:cpo_save = &cpo set cpo&vim @@ -84,7 +84,7 @@ function GetDTDIndent() let [declaration, end] = s:lex1(line, col) if declaration == "" - return indent + &sw + return indent + shiftwidth() elseif declaration == '--' " We’re looking at a comment. Now, simply determine if the comment is " terminated or not. If it isn’t, let Vim take care of that using @@ -100,7 +100,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for token following element name. This can be a specification of @@ -113,7 +113,7 @@ function GetDTDIndent() let n += 1 endwhile if token == "" - return indent + &sw + return indent + shiftwidth() endif " Next comes the content model. If the token we’ve found isn’t a @@ -148,7 +148,7 @@ function GetDTDIndent() return indent endif " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + shiftwidth()) endif " If we’ve seen an addition or exception already and this is of the same @@ -167,7 +167,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for any number of attributes. @@ -180,7 +180,7 @@ function GetDTDIndent() let [name, end] = s:lex(line, end) if name == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth()) elseif name == ">" return indent endif @@ -194,14 +194,14 @@ function GetDTDIndent() " (CDATA|NMTOKEN|NMTOKENS|ID|IDREF|IDREFS|ENTITY|ENTITIES)? let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif value == 'NOTATION' " If this is a enumerated value based on notations, read another token " for the actual value. If it doesn’t exist, indent three levels. " TODO: If validating according to above, value must be equal to '('. let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif @@ -216,13 +216,13 @@ function GetDTDIndent() " two levels. let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|#\(REQUIRED\|IMPLIED\|FIXED\)\)') if default == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif default == '#FIXED' " We need to look for the fixed value. If non exists, indent three " levels. let [default, end] = s:lex(line, end, '^"\_[^"]*"') if default == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif endwhile @@ -233,11 +233,11 @@ function GetDTDIndent() " again, if none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() elseif name == '%' let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif endif @@ -256,27 +256,27 @@ function GetDTDIndent() " we’re now done with this entity. let [value, end] = s:lex(line, end) if value == "" - return indent + &sw + return indent + shiftwidth() elseif value == 'SYSTEM' || value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif endif let [ndata, end] = s:lex(line, end) if ndata == "" - return indent + &sw + return indent + shiftwidth() endif let [name, end] = s:lex(line, end) - return name == "" ? (indent + &sw * 2) : indent + return name == "" ? (indent + shiftwidth() * 2) : indent else return indent endif @@ -284,24 +284,24 @@ function GetDTDIndent() " Check for notation name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Now check for the external ID. If none exists, indent one level. let [id, end] = s:lex(line, end) if id == "" - return indent + &sw + return indent + shiftwidth() elseif id == 'SYSTEM' || id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\|>\)') if quoted_string == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw * 2) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth() * 2) elseif quoted_string == '>' return indent endif diff --git a/runtime/indent/eiffel.vim b/runtime/indent/eiffel.vim index 87e82e833d..d7667a8346 100644 --- a/runtime/indent/eiffel.vim +++ b/runtime/indent/eiffel.vim @@ -2,9 +2,10 @@ " Language: Eiffel " Maintainer: Jocelyn Fiat <jfiat@eiffel.com> " Previous-Maintainer: David Clarke <gadicath@dishevelled.net> +" Contributions from: Takuya Fujiwara " Contributions from: Thilo Six -" $Date: 2004/12/09 21:33:52 $ -" $Revision: 1.3 $ +" $Date: 2017/03/08 06:00:00 $ +" $Revision: 1.4 $ " URL: https://github.com/eiffelhub/vim-eiffel " Only load this indent file when no other was loaded. @@ -28,7 +29,7 @@ let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comme " Define some stuff " keywords grouped by indenting let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$' -let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' +let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|across\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>' let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>' let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$' @@ -63,23 +64,23 @@ function GetEiffelIndent() " Add a 'shiftwidth' after lines that start with an indent word let ind = indent(lnum) if getline(lnum) =~ s:relative_indent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " Indent to single indent if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>' - let ind = &sw + let ind = shiftwidth() endif " Indent to double indent if getline(v:lnum) =~ s:inheritance_dent - let ind = 2 * &sw + let ind = 2 * shiftwidth() endif " Indent line after the first line of the function definition if getline(lnum) =~ s:single_dent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " The following should always be at the start of a line, no indenting @@ -91,17 +92,17 @@ function GetEiffelIndent() " or first thing after the 'do' if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent \ && getline(v:lnum - 1) !~ '^\s*do\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract a shiftwidth for end statements if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " set indent of zero end statements that are at an indent of 3, this should " only ever be the class's end. - if getline(v:lnum) =~ '^\s*end\>' && ind == &sw + if getline(v:lnum) =~ '^\s*end\>' && ind == shiftwidth() let ind = 0 endif diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index 80cab7000e..afabd4fe5b 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -19,6 +19,9 @@ else endif unlet! b:did_indent +" Force HTML indent to not keep state. +let b:html_indent_usestate = 0 + if &l:indentexpr == '' if &l:cindent let &l:indentexpr = 'cindent(v:lnum)' @@ -38,7 +41,18 @@ if exists("*GetErubyIndent") finish endif +" this file uses line continuations +let s:cpo_sav = &cpo +set cpo&vim + function! GetErubyIndent(...) + " The value of a single shift-width + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif + if a:0 && a:1 == '.' let v:lnum = line('.') elseif a:0 && a:1 =~ '^\d' @@ -52,31 +66,44 @@ function! GetErubyIndent(...) let ind = GetRubyIndent(v:lnum) else exe "let ind = ".b:eruby_subtype_indentexpr + + " Workaround for Andy Wokula's HTML indent. This should be removed after + " some time, since the newest version is fixed in a different way. + if b:eruby_subtype_indentexpr =~# '^HtmlIndent(' + \ && exists('b:indent') + \ && type(b:indent) == type({}) + \ && has_key(b:indent, 'lnum') + " Force HTML indent to not keep state + let b:indent.lnum = -1 + endif endif let lnum = prevnonblank(v:lnum-1) let line = getline(lnum) let cline = getline(v:lnum) if cline =~# '^\s*<%[-=]\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\S\s*<%[-=]\=\s*\%(}\|end\).\{-\}\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*[-=]\=%>' - let ind = ind + &sw + let ind = ind + sw elseif line =~# '<%[-=]\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' - let ind = ind + &sw + let ind = ind + sw endif if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' - let ind = ind + &sw + let ind = ind + sw endif - if line !~# '^\s*<%' && line =~# '%>\s*$' - let ind = ind - &sw + if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>' + let ind = ind - sw endif if cline =~# '^\s*[-=]\=%>\s*$' - let ind = ind - &sw + let ind = ind - sw endif return ind endfunction +let &cpo = s:cpo_sav +unlet! s:cpo_sav + " vim:set sw=2 sts=2 ts=8 noet: diff --git a/runtime/indent/eterm.vim b/runtime/indent/eterm.vim index f25f5f4dad..8ee342fcfa 100644 --- a/runtime/indent/eterm.vim +++ b/runtime/indent/eterm.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Eterm configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: Eterm configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -25,11 +25,11 @@ function GetEtermIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*begin\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index e76c64b671..2ba69e86df 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,9 +1,12 @@ " Vim indent file -" Language: Fortran95 (and Fortran90, Fortran77, F and elf90) -" Version: 0.40 -" Last Change: 2011 Dec. 28 -" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www.unb.ca/chem/ajit/> -" Usage: Do :help fortran-indent from Vim +" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) +" Version: 47 +" Last Change: 2016 Oct. 29 +" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> +" Usage: For instructions, do :help fortran-indent from Vim +" Credits: +" Useful suggestions were made, in chronological order, by: +" Albert Oliver Serra, Takuya Fujiwara and Philipp Edelmann. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -25,7 +28,10 @@ if exists("b:fortran_indent_more") || exists("g:fortran_indent_more") endif " Determine whether this is a fixed or free format source file -" if this hasn't been done yet +" if this hasn't been done yet using the priority: +" buffer-local value +" > global value +" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers if !exists("b:fortran_fixed_source") if exists("fortran_free_source") " User guarantees free source form @@ -33,13 +39,19 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else - " f90 and f95 allow both fixed and free source form - " assume fixed source form unless signs of free source form - " are detected in the first five columns of the first 250 lines + " Modern fortran still allows both fixed and free source form + " Assume fixed source form unless signs of free source form + " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines " are checked. Increase the limit below if you keep lots of comments at - " the very top of each file and you have a fast computer + " the very top of each file and you have a fast computer. let s:lmax = 500 if ( s:lmax > line("$") ) let s:lmax = line("$") @@ -81,27 +93,27 @@ function FortranGetIndent(lnum) "Indent do loops only if they are all guaranteed to be of do/end do type if exists("b:fortran_do_enddo") || exists("g:fortran_do_enddo") if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*do\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*end\s*do\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif - "Add a shiftwidth to statements following if, else, else if, case, + "Add a shiftwidth to statements following if, else, else if, case, class, "where, else where, forall, type, interface and associate statements - if prevstat =~? '^\s*\(case\|else\|else\s*if\|else\s*where\)\>' + if prevstat =~? '^\s*\(case\|class\|else\|else\s*if\|else\s*where\)\>' \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>' \ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>' \ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' - let ind = ind + &sw + let ind = ind + shiftwidth() " Remove unwanted indent after logical and arithmetic ifs if prevstat =~? '\<if\>' && prevstat !~? '\<then\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Remove unwanted indent after type( statements if prevstat =~? '^\s*type\s*(' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif @@ -110,40 +122,41 @@ function FortranGetIndent(lnum) let prefix='\(\(pure\|impure\|elemental\|recursive\)\s\+\)\{,2}' let type='\(\(integer\|real\|double\s\+precision\|complex\|logical' \.'\|character\|type\|class\)\s*\S*\s\+\)\=' - if prevstat =~? '^\s*\(module\|contains\|program\)\>' + if prevstat =~? '^\s*\(contains\|submodule\|program\)\>' + \ ||prevstat =~? '^\s*'.'module\>\(\s*\procedure\)\@!' \ ||prevstat =~? '^\s*'.prefix.'subroutine\>' \ ||prevstat =~? '^\s*'.prefix.type.'function\>' \ ||prevstat =~? '^\s*'.type.prefix.'function\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*contains\>' \ ||getline(v:lnum)=~? '^\s*end\s*' - \ .'\(function\|subroutine\|module\|program\)\>' - let ind = ind - &sw + \ .'\(function\|subroutine\|module\|submodule\|program\)\>' + let ind = ind - shiftwidth() endif endif - "Subtract a shiftwidth from else, else if, elsewhere, case, end if, + "Subtract a shiftwidth from else, else if, elsewhere, case, class, end if, " end where, end select, end forall, end interface, end associate, - " end enum, and end type statements + " end enum, end type, end block and end type statements if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*' - \. '\(else\|else\s*if\|else\s*where\|case\|' + \. '\(else\|else\s*if\|else\s*where\|case\|class\|' \. 'end\s*\(if\|where\|select\|interface\|' - \. 'type\|forall\|associate\|enum\)\)\>' - let ind = ind - &sw + \. 'type\|forall\|associate\|enum\|block\)\)\>' + let ind = ind - shiftwidth() " Fix indent for case statement immediately after select if prevstat =~? '\<select\s\+\(case\|type\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif "First continuation line if prevstat =~ '&\s*$' && prev2stat !~ '&\s*$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif "Line after last continuation line - if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$' - let ind = ind - &sw + if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$' && prevstat !~? '\<then\>' + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/framescript.vim b/runtime/indent/framescript.vim index 49ff92a81d..f9a274eab6 100644 --- a/runtime/indent/framescript.vim +++ b/runtime/indent/framescript.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: FrameScript -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-19 +" Language: FrameScript +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-19 if exists("b:did_indent") finish @@ -30,11 +30,11 @@ function GetFrameScriptIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index 7d5d44b779..480c96d1b9 100644 --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:did_indent") finish @@ -20,17 +20,18 @@ if exists("*GetGitconfigIndent") endif function! GetGitconfigIndent() + let sw = exists('*shiftwidth') ? shiftwidth() : &sw let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) if line =~ '\\\@<!\%(\\\\\)*\\$' " odd number of slashes, in a line continuation - return 2 * &sw + return 2 * sw elseif cline =~ '^\s*\[' return 0 elseif cline =~ '^\s*\a' - return &sw + return sw elseif cline == '' && line =~ '^\[' - return &sw + return sw else return -1 endif diff --git a/runtime/indent/gitolite.vim b/runtime/indent/gitolite.vim index 33b7c9f312..b36f30a494 100644 --- a/runtime/indent/gitolite.vim +++ b/runtime/indent/gitolite.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: gitolite configuration -" URL: https://github.com/tmatilai/gitolite.vim -" Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi> -" Last Change: 2011-12-24 +" URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/indent/gitolite.vim +" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim) +" Maintainer: Sitaram Chamarty <sitaramc@gmail.com> +" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>) +" Last Change: 2017 Oct 05 if exists("b:did_indent") finish @@ -27,11 +29,13 @@ function! GetGitoliteIndent() let cline = getline(v:lnum) if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]' - return &sw + return shiftwidth() elseif cline =~ '^\s*config\s' - return &sw + return shiftwidth() + elseif cline =~ '^\s*option\s' + return shiftwidth() elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$' - return &sw + return shiftwidth() elseif cline =~ '^\s*#' return indent(prevln) elseif cline =~ '^\s*$' diff --git a/runtime/indent/go.vim b/runtime/indent/go.vim new file mode 100644 index 0000000000..412ac871c4 --- /dev/null +++ b/runtime/indent/go.vim @@ -0,0 +1,78 @@ +" Vim indent file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 +" +" TODO: +" - function invocations split across lines +" - general line splits (line ends in an operator) + +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +" C indentation is too far off useful, mainly due to Go's := operator. +" Let's just define our own. +setlocal nolisp +setlocal autoindent +setlocal indentexpr=GoIndent(v:lnum) +setlocal indentkeys+=<:>,0=},0=) + +if exists('*GoIndent') + finish +endif + +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + function s:sw() abort + return shiftwidth() + endfunction +else + function s:sw() abort + return &shiftwidth + endfunction +endif + +function! GoIndent(lnum) + let l:prevlnum = prevnonblank(a:lnum-1) + if l:prevlnum == 0 + " top of file + return 0 + endif + + " grab the previous and current line, stripping comments. + let l:prevl = substitute(getline(l:prevlnum), '//.*$', '', '') + let l:thisl = substitute(getline(a:lnum), '//.*$', '', '') + let l:previ = indent(l:prevlnum) + + let l:ind = l:previ + + if l:prevl =~ '[({]\s*$' + " previous line opened a block + let l:ind += s:sw() + endif + if l:prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let l:ind += s:sw() + endif + " TODO: handle if the previous line is a label. + + if l:thisl =~ '^\s*[)}]' + " this line closed a block + let l:ind -= s:sw() + endif + + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if l:thisl =~# '^\s*\(case .*\|default\):$' + let l:ind -= s:sw() + endif + + return l:ind +endfunction + +" vim: sw=2 sts=2 et diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index c47a8a59c7..c3935af9e9 100644 --- a/runtime/indent/haml.vim +++ b/runtime/indent/haml.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:did_indent") finish @@ -37,10 +37,11 @@ function! GetHamlIndent() let line = substitute(line,'^\s\+','','') let indent = indent(lnum) let cindent = indent(v:lnum) + let sw = exists('*shiftwidth') ? shiftwidth() : &sw if cline =~# '\v^-\s*%(elsif|else|when)>' - let indent = cindent < indent ? cindent : indent - &sw + let indent = cindent < indent ? cindent : indent - sw endif - let increase = indent + &sw + let increase = indent + sw if indent == indent(lnum) let indent = cindent <= indent ? -1 : increase endif diff --git a/runtime/indent/hog.vim b/runtime/indent/hog.vim new file mode 100644 index 0000000000..02ac7d4d1b --- /dev/null +++ b/runtime/indent/hog.vim @@ -0,0 +1,77 @@ +" Vim indent file +" Language: hog (Snort.conf) +" Maintainer: Victor Roemer, <vroemer@badsec.org> +" Last Change: Mar 7, 2013 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 +let b:undo_indent = 'setlocal smartindent< indentexpr< indentkeys<' + +setlocal nosmartindent +setlocal indentexpr=GetHogIndent() +setlocal indentkeys+=!^F,o,O,0# + +" Only define the function once. +if exists("*GetHogIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let s:syn_blocks = '\<SnortRuleTypeBody\>' + +function s:IsInBlock(lnum) + return synIDattr(synID(a:lnum, 1, 1), 'name') =~ s:syn_blocks +endfunction + +function GetHogIndent() + let prevlnum = prevnonblank(v:lnum-1) + + " Comment blocks have identical indent + if getline(v:lnum) =~ '^\s*#' && getline(prevlnum) =~ '^\s*#' + return indent(prevlnum) + endif + + " Ignore comment lines when calculating indent + while getline(prevlnum) =~ '^\s*#' + let prevlnum = prevnonblank(prevlnum-1) + if !prevlnum + return previndent + endif + endwhile + + " Continuation of a line that wasn't indented + let prevline = getline(prevlnum) + if prevline =~ '^\k\+.*\\\s*$' + return &sw + endif + + " Continuation of a line that was indented + if prevline =~ '\k\+.*\\\s*$' + return indent(prevlnum) + endif + + " Indent the next line if previous line contained a start of a block + " definition ('{' or '('). + if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$' + return &sw + endif + + " Match inside of a block + if s:IsInBlock(v:lnum) + if prevline =~ "^\k\+.*$" + return &sw + else + return indent(prevlnum) + endif + endif + + return 0 +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index b5374bd68a..ba043e968a 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula <anwoku@yahoo.de> -" Last Change: 2014 Jul 04 +" Last Change: 2018 Mar 28 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -25,27 +25,22 @@ if exists("b:did_indent") "{{{ finish endif + +" Load the Javascript indent script first, it defines GetJavascriptIndent(). +" Undo the rest. +" Load base python indent. +if !exists('*GetJavascriptIndent') + runtime! indent/javascript.vim +endif let b:did_indent = 1 setlocal indentexpr=HtmlIndent() setlocal indentkeys=o,O,<Return>,<>>,{,},!^F -" "j1" is included to make cindent() work better with Javascript. -setlocal cino=j1 -" "J1" should be included, but it doen't work properly before 7.4.355. -if has("patch-7.4.355") - setlocal cino+=J1 -endif -" Before patch 7.4.355 indenting after "(function() {" does not work well, add -" )2 to limit paren search. -if !has("patch-7.4.355") - setlocal cino+=)2 -endif - " Needed for % to work when finding start/end of a tag. setlocal matchpairs+=<:> -let b:undo_indent = "setlocal inde< indk< cino<" +let b:undo_indent = "setlocal inde< indk<" " b:hi_indent keeps state to speed up indenting consecutive lines. let b:hi_indent = {"lnum": -1} @@ -56,20 +51,14 @@ if exists("*HtmlIndent") && !exists('g:force_reload_html') finish endif -" shiftwidth() exists since patch 7.3.694 -if exists('*shiftwidth') - let s:ShiftWidth = function('shiftwidth') -else - func! s:ShiftWidth() - return &shiftwidth - endfunc -endif - " Allow for line continuation below. let s:cpo_save = &cpo set cpo-=C "}}} +" Pattern to match the name of a tag, including custom elements. +let s:tagname = '\w\+\(-\w\+\)*' + " Check and process settings from b:html_indent and g:html_indent... variables. " Prefer using buffer-local settings over global settings, so that there can " be defaults for all HTML files and exceptions for specific types of HTML @@ -94,7 +83,7 @@ func! HtmlIndent_CheckUserSettings() let autotags = g:html_indent_autotags endif let b:hi_removed_tags = {} - if autotags + if len(autotags) > 0 call s:RemoveITags(b:hi_removed_tags, split(autotags, ",")) endif @@ -128,7 +117,7 @@ func! HtmlIndent_CheckUserSettings() let indone = {"zero": 0 \,"auto": "indent(prevnonblank(v:lnum-1))" - \,"inc": "b:hi_indent.blocktagind + s:ShiftWidth()"} + \,"inc": "b:hi_indent.blocktagind + shiftwidth()"} let script1 = '' if exists("b:html_indent_script1") @@ -178,13 +167,15 @@ let s:countonly = 0 " 3 "script" " 4 "style" " 5 comment start +" 6 conditional comment start " -1 closing tag " -2 "/pre" " -3 "/script" " -4 "/style" " -5 comment end +" -6 conditional comment end let s:indent_tags = {} -let s:endtags = [0,0,0,0,0,0] " long enough for the highest index +let s:endtags = [0,0,0,0,0,0,0] " long enough for the highest index "}}} " Add a list of tag names for a pair of <tag> </tag> to "tags". @@ -225,7 +216,8 @@ endfunc "}}} " Add known tag pairs. " Self-closing tags and tags that are sometimes {{{ " self-closing (e.g., <p>) are not here (when encountering </p> we can find -" the matching <p>, but not the other way around). +" the matching <p>, but not the other way around). Known self-closing tags: +" 'p', 'img', 'source'. " Old HTML tags: call s:AddITags(s:indent_tags, [ \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', @@ -238,13 +230,17 @@ 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', 'main', 'mark', 'meter', + \ 'nav', 'output', 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', + \ 'summary', 'svg', 'time', 'track', 'video', 'wbr']) + +" Tags added for web components: +call s:AddITags(s:indent_tags, [ + \ 'content', 'shadow', 'template']) "}}} " Add Block Tags: these contain alien content @@ -253,6 +249,7 @@ call s:AddBlockTag('pre', 2) call s:AddBlockTag('script', 3) call s:AddBlockTag('style', 4) call s:AddBlockTag('<!--', 5, '-->') +call s:AddBlockTag('<!--[', 6, '![endif]-->') "}}} " Return non-zero when "tagname" is an opening tag, not being a block tag, for @@ -287,7 +284,7 @@ func! s:CountITags(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = 0 " assume starting outside of a block let s:countonly = 1 " don't change state - call substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + call substitute(a:text, '<\zs/\=' . s:tagname . '\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') let s:countonly = 0 endfunc "}}} @@ -299,7 +296,7 @@ func! s:CountTagsAndState(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = b:hi_newstate.block - let tmp = substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + let tmp = substitute(a:text, '<\zs/\=' . s:tagname . '\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') if s:block == 3 let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*<SCRIPT\>\zs[^>]*')) endif @@ -311,6 +308,9 @@ func! s:CheckTag(itag) "{{{ " Returns an empty string or "SCRIPT". " a:itag can be "tag" or "/tag" or "<!--" or "-->" + if (s:CheckCustomTag(a:itag)) + return "" + endif let ind = s:get_tag(a:itag) if ind == -1 " closing tag @@ -353,7 +353,7 @@ func! s:CheckBlockTag(blocktag, ind) endif let b:hi_newstate.blocklnr = v:lnum " save allover indent for the endtag - let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth() + let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * shiftwidth() if a:ind == 3 return "SCRIPT" " all except this must be lowercase " line is to be checked again for the type attribute @@ -365,6 +365,36 @@ func! s:CheckBlockTag(blocktag, ind) return "" endfunc "}}} +" Used by s:CheckTag(). +func! s:CheckCustomTag(ctag) + "{{{ + " Returns 1 if ctag is the tag for a custom element, 0 otherwise. + " a:ctag can be "tag" or "/tag" or "<!--" or "-->" + let pattern = '\%\(\w\+-\)\+\w\+' + if match(a:ctag, pattern) == -1 + return 0 + endif + if matchstr(a:ctag, '\/\ze.\+') == "/" + " closing tag + if s:block != 0 + " ignore ctag within a block + return 1 + endif + if s:nextrel == 0 + let s:curind -= 1 + else + let s:nextrel -= 1 + endif + else + " opening tag + if s:block != 0 + return 1 + endif + let s:nextrel += 1 + endif + return 1 +endfunc "}}} + " Return the <script> type: either "javascript" or "" func! s:GetScriptType(str) "{{{ @@ -388,7 +418,7 @@ func! s:FreshState(lnum) " State: " lnum last indented line == prevnonblank(a:lnum - 1) " block = 0 a:lnum located within special tag: 0:none, 2:<pre>, - " 3:<script>, 4:<style>, 5:<!-- + " 3:<script>, 4:<style>, 5:<!--, 6:<!--[ " baseindent use this indent for line a:lnum as a start - kind of " autoindent (if block==0) " scripttype = '' type attribute of a script tag (if block==3) @@ -427,10 +457,13 @@ func! s:FreshState(lnum) " FI " look back for a blocktag - call cursor(a:lnum, 1) - let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bW") - if stopline > 0 - " fugly ... why isn't there searchstr() + let stopline2 = v:lnum + 1 + if has_key(b:hi_indent, 'block') && b:hi_indent.block > 5 + let [stopline2, stopcol2] = searchpos('<!--', 'bnW') + endif + let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bnW") + if stopline > 0 && stopline < stopline2 + " ugly ... why isn't there searchstr() let tagline = tolower(getline(stopline)) let blocktag = matchstr(tagline, '\/\=\%(pre\>\|script\>\|style\>\)', stopcol - 1) if blocktag[0] != "/" @@ -442,7 +475,7 @@ func! s:FreshState(lnum) let state.blocklnr = stopline " check preceding tags in the line: call s:CountITags(tagline[: stopcol-2]) - let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * shiftwidth() return state elseif stopline == state.lnum " handle special case: previous line (= state.lnum) contains a @@ -450,24 +483,30 @@ func! s:FreshState(lnum) " blocktag == "/..." let swendtag = match(tagline, '^\s*</') >= 0 if !swendtag - let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bW") + let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW") call s:CountITags(tolower(getline(bline)[: bcol-2])) - let state.baseindent = indent(bline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(bline) + (s:curind + s:nextrel) * shiftwidth() return state endif endif endif + if stopline > stopline2 + let stopline = stopline2 + let stopcol = stopcol2 + endif " else look back for comment - call cursor(a:lnum, 1) - let [comlnum, comcol, found] = searchpos('\(<!--\)\|-->', 'bpW', stopline) - if found == 2 + let [comlnum, comcol, found] = searchpos('\(<!--\[\)\|\(<!--\)\|-->', 'bpnW', stopline) + if found == 2 || found == 3 " comment opener found, assume a:lnum within comment - let state.block = 5 + let state.block = (found == 3 ? 5 : 6) let state.blocklnr = comlnum " check preceding tags in the line: call s:CountITags(tolower(getline(comlnum)[: comcol-2])) - let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + if found == 2 + let state.baseindent = b:hi_indent.baseindent + endif + let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() return state endif @@ -486,7 +525,7 @@ func! s:FreshState(lnum) let text = tolower(getline(comlnum)[: comcol-2]) endif call s:CountITags(text) - let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() " TODO check tags that follow "-->" return state endif @@ -495,9 +534,9 @@ func! s:FreshState(lnum) let swendtag = match(text, '^\s*</') >= 0 " If previous line ended in a closing tag, line up with the opening tag. - if !swendtag && text =~ '</\w\+\s*>\s*$' + if !swendtag && text =~ '</' . s:tagname . '\s*>\s*$' call cursor(state.lnum, 99999) - normal F< + normal! F< let start_lnum = HtmlIndent_FindStartTag() if start_lnum > 0 let state.baseindent = indent(start_lnum) @@ -506,9 +545,9 @@ func! s:FreshState(lnum) let text = getline(start_lnum) let swendtag = match(text, '^\s*</') >= 0 call s:CountITags(text[: col('.') - 2]) - let state.baseindent += s:nextrel * s:ShiftWidth() + let state.baseindent += s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif endif return state @@ -521,9 +560,9 @@ func! s:FreshState(lnum) let text = getline(state.lnum) let swendtag = match(text, '^\s*</') >= 0 call s:CountITags(tolower(text)) - let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth() + let state.baseindent = indent(state.lnum) + s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif return state endfunc "}}} @@ -547,7 +586,7 @@ func! s:Alien3() return eval(b:hi_js1indent) endif if b:hi_indent.scripttype == "javascript" - return cindent(v:lnum) + return GetJavascriptIndent() else return -1 endif @@ -602,7 +641,7 @@ func! s:CSSIndent() " add indent after { let brace_counts = HtmlIndent_CountBraces(prev_lnum) - let extra = brace_counts.c_open * s:ShiftWidth() + let extra = brace_counts.c_open * shiftwidth() let prev_text = getline(prev_lnum) let below_end_brace = prev_text =~ '}\s*$' @@ -619,7 +658,7 @@ func! s:CSSIndent() " if the current line is not a comment or starts with @ (used by template " systems) reduce indent if previous line is a continuation line if !prev_hasfield && !prev_special - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif else let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:' @@ -627,14 +666,14 @@ func! s:CSSIndent() if !cur_hasfield && (prev_hasfield || prev_unfinished) " Continuation line has extra indent if the previous line was not a " continuation line. - let extra = s:ShiftWidth() + let extra = shiftwidth() " Align with @if if prev_text =~ '^\s*@if ' let extra = 4 endif elseif cur_hasfield && !prev_hasfield && !prev_special " less indent below a continuation line - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif endif @@ -655,10 +694,10 @@ func! s:CSSIndent() if special " do not reduce indent below @{ ... } if extra < 0 - let extra += s:ShiftWidth() + let extra += shiftwidth() endif else - let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * s:ShiftWidth() + let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * shiftwidth() endif endif @@ -666,10 +705,10 @@ func! s:CSSIndent() if extra == 0 if brace_counts.p_open > brace_counts.p_close " previous line has more ( than ): add a shiftwidth - let extra = s:ShiftWidth() + let extra = shiftwidth() elseif brace_counts.p_open < brace_counts.p_close " previous line has more ) than (: subtract a shiftwidth - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif @@ -700,7 +739,7 @@ func! s:CssPrevNonComment(lnum, stopline) while 1 let ccol = match(getline(lnum), '\*/') if ccol < 0 - " No comment end thus its something else. + " No comment end thus it's something else. return lnum endif call cursor(lnum, ccol + 1) @@ -772,7 +811,7 @@ func! s:Alien5() let idx = match(prevtext, '^\s*\zs<!--') if idx >= 0 " just below comment start, add a shiftwidth - return idx + s:ShiftWidth() + return idx + shiftwidth() endif " Some files add 4 spaces just below a TODO line. It's difficult to detect @@ -782,6 +821,20 @@ func! s:Alien5() return indent(prevlnum) endfunc "}}} +" Return the indent for conditional comment: <!--[ ![endif]--> +func! s:Alien6() + "{{{ + let curtext = getline(v:lnum) + if curtext =~ '\s*\zs<!\[endif\]-->' + " current line starts with end of comment, line up with comment start. + let lnum = search('<!--', 'bn') + if lnum > 0 + return indent(lnum) + endif + endif + return b:hi_indent.baseindent + shiftwidth() +endfunc "}}} + " When the "lnum" line ends in ">" find the line containing the matching "<". func! HtmlIndent_FindTagStart(lnum) "{{{ @@ -811,7 +864,7 @@ func! HtmlIndent_FindStartTag() " The cursor must be on or before a closing tag. " If found, positions the cursor at the match and returns the line number. " Otherwise returns 0. - let tagname = matchstr(getline('.')[col('.') - 1:], '</\zs\w\+\ze') + let tagname = matchstr(getline('.')[col('.') - 1:], '</\zs' . s:tagname . '\ze') let start_lnum = searchpair('<' . tagname . '\>', '', '</' . tagname . '\>', 'bW') if start_lnum > 0 return start_lnum @@ -827,7 +880,7 @@ func! HtmlIndent_FindTagEnd() " a self-closing tag, to the matching ">". " Limited to look up to b:html_indent_line_limit lines away. let text = getline('.') - let tagname = matchstr(text, '\w\+\|!--', col('.')) + let tagname = matchstr(text, s:tagname . '\|!--', col('.')) if tagname == '!--' call search('--\zs>') elseif s:get_tag('/' . tagname) != 0 @@ -872,9 +925,22 @@ func! s:InsideTag(foundHtmlString) else let idx = match(text, '\s\zs[_a-zA-Z0-9-]\+="') endif + if idx == -1 + " try <tag attr + let idx = match(text, '<' . s:tagname . '\s\+\zs\w') + endif + if idx == -1 + " after just <tag indent one level more + let idx = match(text, '<' . s:tagname . '$') + if idx >= 0 + call cursor(lnum, idx) + return virtcol('.') + shiftwidth() + endif + endif if idx > 0 - " Found the attribute. TODO: assumes spaces, no Tabs. - return idx + " Found the attribute to align with. + call cursor(lnum, idx) + return virtcol('.') endif endwhile return -1 @@ -883,13 +949,13 @@ endfunc "}}} " THE MAIN INDENT FUNCTION. Return the amount of indent for v:lnum. func! HtmlIndent() "{{{ - if prevnonblank(v:lnum - 1) <= 1 + if prevnonblank(v:lnum - 1) < 1 " First non-blank line has no indent. return 0 endif let curtext = tolower(getline(v:lnum)) - let indentunit = s:ShiftWidth() + let indentunit = shiftwidth() let b:hi_newstate = {} let b:hi_newstate.lnum = v:lnum @@ -898,7 +964,7 @@ func! HtmlIndent() " a tag works very differently. Do not do this when the line starts with " "<", it gets the "htmlTag" ID but we are not inside a tag then. if curtext !~ '^\s*<' - normal ^ + normal! ^ let stack = synstack(v:lnum, col('.')) " assumes there are no tabs let foundHtmlString = 0 for synid in reverse(stack) @@ -972,9 +1038,9 @@ func! HtmlIndent() if col('.') > 2 let swendtag = match(text, '^\s*</') >= 0 call s:CountITags(text[: col('.') - 2]) - let indent += s:nextrel * s:ShiftWidth() + let indent += s:nextrel * shiftwidth() if !swendtag - let indent += s:curind * s:ShiftWidth() + let indent += s:curind * shiftwidth() endif endif else diff --git a/runtime/indent/j.vim b/runtime/indent/j.vim index e268e1fcd3..ea3d50936b 100644 --- a/runtime/indent/j.vim +++ b/runtime/indent/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2014-04-05 +" Last Change: 2015-01-11 if exists('b:did_indent') finish @@ -26,25 +26,25 @@ if !exists('g:j_indent_definitions') endif function GetJIndent() abort - let prevlnum = prevnonblank(v:lnum-1) - if prevlnum == 0 + let l:prevlnum = prevnonblank(v:lnum - 1) + if l:prevlnum == 0 return 0 endif - let indent = indent(prevlnum) - let prevline = getline(prevlnum) - if prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$' + let l:indent = indent(l:prevlnum) + let l:prevline = getline(l:prevlnum) + if l:prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$' " Increase indentation after an initial control word that starts or " continues a block and is not terminated by "end." - let indent += shiftwidth() - elseif g:j_indent_definitions && (prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || prevline =~# '^\s*:\s*$') + let l:indent += shiftwidth() + elseif g:j_indent_definitions && (l:prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || l:prevline =~# '^\s*:\s*$') " Increase indentation in explicit definitions of adverbs, conjunctions, " and verbs - let indent += shiftwidth() + let l:indent += shiftwidth() endif " Decrease indentation in lines that start with either control words that " continue or end a block, or the special items ")" and ":" if getline(v:lnum) =~# '^\s*\%()\|:\|\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)' - let indent -= shiftwidth() + let l:indent -= shiftwidth() endif - return indent + return l:indent endfunction diff --git a/runtime/indent/java.vim b/runtime/indent/java.vim index e0aec0faef..49f8010d21 100644 --- a/runtime/indent/java.vim +++ b/runtime/indent/java.vim @@ -1,12 +1,14 @@ " Vim indent file " Language: Java " Previous Maintainer: Toby Allsopp <toby.allsopp@peace.com> -" Current Maintainer: Hong Xu <xuhdev@gmail.com> -" Last Change: 2012 May 18 -" Version: 1.0 +" Current Maintainer: Hong Xu <hong@topbug.net> +" Homepage: http://www.vim.org/scripts/script.php?script_id=3899 +" https://github.com/xuhdev/indent-java.vim +" Last Change: 2016 Mar 7 +" Version: 1.1 " License: Same as Vim. -" Copyright (c) 2012 Hong Xu -" Before 2012, this file is maintained by Toby Allsopp. +" Copyright (c) 2012-2016 Hong Xu +" Before 2012, this file was maintained by Toby Allsopp. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -29,6 +31,7 @@ let b:undo_indent = "set cin< cino< indentkeys< indentexpr<" if exists("*GetJavaIndent") finish endif + let s:keepcpo= &cpo set cpo&vim @@ -70,7 +73,7 @@ function GetJavaIndent() " If the previous line starts with '@', we should have the same indent as " the previous one - if getline(lnum) =~ '^\s*@\S\+\s*$' + if getline(lnum) =~ '^\s*@.*$' return indent(lnum) endif @@ -85,9 +88,9 @@ function GetJavaIndent() " Try to align "throws" lines for methods and "extends" and "implements" for " classes. - if getline(v:lnum) =~ '^\s*\(extends\|implements\)\>' - \ && getline(lnum) !~ '^\s*\(extends\|implements\)\>' - let theIndent = theIndent + &sw + if getline(v:lnum) =~ '^\s*\(throws\|extends\|implements\)\>' + \ && getline(lnum) !~ '^\s*\(throws\|extends\|implements\)\>' + let theIndent = theIndent + shiftwidth() endif " correct for continuation lines of "throws", "implements" and "extends" @@ -96,27 +99,27 @@ function GetJavaIndent() if strlen(cont_kw) > 0 let amount = strlen(cont_kw) + 1 if getline(lnum) !~ ',\s*$' - let theIndent = theIndent - (amount + &sw) + let theIndent = theIndent - (amount + shiftwidth()) if theIndent < 0 let theIndent = 0 endif elseif prev == lnum let theIndent = theIndent + amount if cont_kw ==# 'throws' - let theIndent = theIndent + &sw + let theIndent = theIndent + shiftwidth() endif endif elseif getline(prev) =~ '^\s*\(throws\|implements\|extends\)\>' \ && (getline(prev) =~ '{\s*$' \ || getline(v:lnum) =~ '^\s*{\s*$') - let theIndent = theIndent - &sw + let theIndent = theIndent - shiftwidth() endif " When the line starts with a }, try aligning it with the matching {, " skipping over "throws", "extends" and "implements" clauses. if getline(v:lnum) =~ '^\s*}\s*\(//.*\|/\*.*\)\=$' call cursor(v:lnum, 1) - silent normal % + silent normal! % let lnum = line('.') if lnum < v:lnum while lnum > 1 diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim index a83d34b110..f3bf96aa97 100644 --- a/runtime/indent/javascript.vim +++ b/runtime/indent/javascript.vim @@ -1,16 +1,480 @@ " Vim indent file -" Language: Javascript -" Maintainer: None! Wanna improve this? -" Last Change: 2007 Jan 22 +" Language: Javascript +" Maintainer: Chris Paul ( https://github.com/bounceme ) +" URL: https://github.com/pangloss/vim-javascript +" Last Change: December 4, 2017 " Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish +if exists('b:did_indent') + finish endif let b:did_indent = 1 -" C indenting is not too bad. -setlocal cindent -setlocal cinoptions+=j1,J1 +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetJavascriptIndent() +setlocal autoindent nolisp nosmartindent +setlocal indentkeys+=0],0) +" Testable with something like: +" vim -eNs "+filetype plugin indent on" "+syntax on" "+set ft=javascript" \ +" "+norm! gg=G" '+%print' '+:q!' testfile.js \ +" | diff -uBZ testfile.js - -let b:undo_indent = "setl cin<" +let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' + +" Only define the function once. +if exists('*GetJavascriptIndent') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" indent correctly if inside <script> +" vim/vim@690afe1 for the switch from cindent +" overridden with b:html_indent_script1 +call extend(g:,{'html_indent_script1': 'inc'},'keep') + +" Regex of syntax group names that are or delimit string or are comments. +let s:bvars = { + \ 'syng_strcom': 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!', + \ 'syng_str': 'string\|template\|special' } +" template strings may want to be excluded when editing graphql: +" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special' +" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc' + +function s:GetVars() + call extend(b:,extend(s:bvars,{'js_cache': [0,0,0]}),'keep') +endfunction + +" Get shiftwidth value +if exists('*shiftwidth') + function s:sw() + return shiftwidth() + endfunction +else + function s:sw() + return &l:shiftwidth ? &l:shiftwidth : &l:tabstop + endfunction +endif + +" Performance for forwards search(): start search at pos rather than masking +" matches before pos. +let s:z = has('patch-7.4.984') ? 'z' : '' + +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = "s:SynAt(line('.'),col('.')) =~? b:syng_strcom" +let s:in_comm = s:skip_expr[:-14] . "'comment\\|doc'" + +let s:rel = has('reltime') +" searchpair() wrapper +if s:rel + function s:GetPair(start,end,flags,skip) + return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1,a:skip ==# 's:SkipFunc()' ? 2000 : 200) + endfunction +else + function s:GetPair(start,end,flags,skip) + return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1) + endfunction +endif + +function s:SynAt(l,c) + let byte = line2byte(a:l) + a:c - 1 + let pos = index(s:synid_cache[0], byte) + if pos == -1 + let s:synid_cache[:] += [[byte], [synIDattr(synID(a:l, a:c, 0), 'name')]] + endif + return s:synid_cache[1][pos] +endfunction + +function s:ParseCino(f) + let [divider, n, cstr] = [0] + matchlist(&cino, + \ '\%(.*,\)\=\%(\%d'.char2nr(a:f).'\(-\)\=\([.s0-9]*\)\)\=')[1:2] + for c in split(cstr,'\zs') + if c == '.' && !divider + let divider = 1 + elseif c ==# 's' + if n !~ '\d' + return n . s:sw() + 0 + endif + let n = str2nr(n) * s:sw() + break + else + let [n, divider] .= [c, 0] + endif + endfor + return str2nr(n) / max([str2nr(divider),1]) +endfunction + +" Optimized {skip} expr, only callable from the search loop which +" GetJavascriptIndent does to find the containing [[{(] (side-effects) +function s:SkipFunc() + if s:top_col == 1 + throw 'out of bounds' + elseif s:check_in + if eval(s:skip_expr) + return 1 + endif + let s:check_in = 0 + elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$' + if eval(s:skip_expr) + return 1 + endif + elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) + if eval(s:skip_expr) + let s:check_in = 1 + return 1 + endif + else + let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']] + endif + let [s:looksyn, s:top_col] = getpos('.')[1:2] +endfunction + +function s:AlternatePair() + let [pat, l:for] = ['[][(){};]', 2] + while s:SearchLoop(pat,'bW','s:SkipFunc()') + if s:LookingAt() == ';' + if !l:for + if s:GetPair('{','}','bW','s:SkipFunc()') + return + endif + break + else + let [pat, l:for] = ['[{}();]', l:for - 1] + endif + else + let idx = stridx('])}',s:LookingAt()) + if idx == -1 + return + elseif !s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()') + break + endif + endif + endwhile + throw 'out of bounds' +endfunction + +function s:Nat(int) + return a:int * (a:int > 0) +endfunction + +function s:LookingAt() + return getline('.')[col('.')-1] +endfunction + +function s:Token() + return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt() +endfunction + +function s:PreviousToken(...) + let [l:pos, tok] = [getpos('.'), ''] + if search('\m\k\{1,}\|\S','ebW') + if getline('.')[col('.')-2:col('.')-1] == '*/' + if eval(s:in_comm) && !s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm) + call setpos('.',l:pos) + else + let tok = s:Token() + endif + else + let two = a:0 || line('.') != l:pos[1] ? strridx(getline('.')[:col('.')],'//') + 1 : 0 + if two && eval(s:in_comm) + call cursor(0,two) + let tok = s:PreviousToken(1) + if tok is '' + call setpos('.',l:pos) + endif + else + let tok = s:Token() + endif + endif + endif + return tok +endfunction + +function s:Pure(f,...) + return eval("[call(a:f,a:000),cursor(a:firstline,".col('.').")][0]") +endfunction + +function s:SearchLoop(pat,flags,expr) + return s:GetPair(a:pat,'\_$.',a:flags,a:expr) +endfunction + +function s:ExprCol() + if getline('.')[col('.')-2] == ':' + return 1 + endif + let bal = 0 + while s:SearchLoop('[{}?:]','bW',s:skip_expr) + if s:LookingAt() == ':' + if getline('.')[col('.')-2] == ':' + call cursor(0,col('.')-1) + continue + endif + let bal -= 1 + elseif s:LookingAt() == '?' + if getline('.')[col('.'):col('.')+1] =~ '^\.\d\@!' + continue + elseif !bal + return 1 + endif + let bal += 1 + elseif s:LookingAt() == '{' + return !s:IsBlock() + elseif !s:GetPair('{','}','bW',s:skip_expr) + break + endif + endwhile +endfunction + +" configurable regexes that define continuation lines, not including (, {, or [. +let s:opfirst = '^' . get(g:,'javascript_opfirst', + \ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)') +let s:continuation = get(g:,'javascript_continuation', + \ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$' + +function s:Continues() + let tok = matchstr(strpart(getline('.'),col('.')-15,15),s:continuation) + if tok =~ '[a-z:]' + return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.' + elseif tok !~ '[/>]' + return tok isnot '' + endif + return s:SynAt(line('.'),col('.')) !~? (tok == '>' ? 'jsflow\|^html' : 'regex') +endfunction + +" Check if line 'lnum' has a balanced amount of parentheses. +function s:Balanced(lnum,line) + let l:open = 0 + let pos = match(a:line, '[][(){}]') + while pos != -1 + if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom + let l:open += match(' ' . a:line[pos],'[[({]') + if l:open < 0 + return + endif + endif + let pos = match(a:line, !l:open ? '[][(){}]' : '()' =~ a:line[pos] ? + \ '[()]' : '{}' =~ a:line[pos] ? '[{}]' : '[][]', pos + 1) + endwhile + return !l:open +endfunction + +function s:OneScope() + if s:LookingAt() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr) + let tok = s:PreviousToken() + return (count(split('for if let while with'),tok) || + \ tok =~# '^await$\|^each$' && s:PreviousToken() ==# 'for') && + \ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile()) + elseif s:Token() =~# '^else$\|^do$' + return s:Pure('s:PreviousToken') != '.' + elseif strpart(getline('.'),col('.')-2,2) == '=>' + call cursor(0,col('.')-1) + if s:PreviousToken() == ')' + return s:GetPair('(', ')', 'bW', s:skip_expr) + endif + return 1 + endif +endfunction + +function s:DoWhile() + let cpos = searchpos('\m\<','cbW') + while s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr) + if s:LookingAt() =~ '\a' + if s:Pure('s:IsBlock') + if s:LookingAt() ==# 'd' + return 1 + endif + break + endif + elseif s:LookingAt() != '}' || !s:GetPair('{','}','bW',s:skip_expr) + break + endif + endwhile + call call('cursor',cpos) +endfunction + +" returns total offset from braceless contexts. 'num' is the lineNr which +" encloses the entire context, 'cont' if whether a:firstline is a continued +" expression, which could have started in a braceless context +function s:IsContOne(cont) + let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0] + let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0 + let ind = indent('.') + !a:cont + while line('.') > l:num && ind > pind || line('.') == l:num + if indent('.') < ind && s:OneScope() + let b_l += 1 + elseif !a:cont || b_l || ind < indent(a:firstline) + break + else + call cursor(0,1) + endif + let ind = min([ind, indent('.')]) + if s:PreviousToken() is '' + break + endif + endwhile + return b_l +endfunction + +function s:IsSwitch() + call call('cursor',b:js_cache[1:]) + return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z) +endfunction + +" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader +function s:IsBlock() + let tok = s:PreviousToken() + if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx' + let s:in_jsx = 1 + return tok != '{' + elseif tok =~ '\k' + if tok ==# 'type' + return s:Pure('eval',"s:PreviousToken() !~# '^\\%(im\\|ex\\)port$' || s:PreviousToken() == '.'") + elseif tok ==# 'of' + return s:Pure('eval',"!s:GetPair('[[({]','[])}]','bW',s:skip_expr) || s:LookingAt() != '(' ||" + \ ."s:{s:PreviousToken() ==# 'await' ? 'Previous' : ''}Token() !=# 'for' || s:PreviousToken() == '.'") + endif + return index(split('return const let import export extends yield default delete var await void typeof throw case new in instanceof') + \ ,tok) < (line('.') != a:firstline) || s:Pure('s:PreviousToken') == '.' + elseif tok == '>' + return getline('.')[col('.')-2] == '=' || s:SynAt(line('.'),col('.')) =~? 'jsflow\|^html' + elseif tok == '*' + return s:Pure('s:PreviousToken') == ':' + elseif tok == ':' + return s:Pure('eval',"s:PreviousToken() =~ '^\\K\\k*$' && !s:ExprCol()") + elseif tok == '/' + return s:SynAt(line('.'),col('.')) =~? 'regex' + elseif tok !~ '[=~!<,.?^%|&([]' + return tok !~ '[-+]' || line('.') != a:firstline && getline('.')[col('.')-2] == tok + endif +endfunction + +function GetJavascriptIndent() + call s:GetVars() + let s:synid_cache = [[],[]] + let l:line = getline(v:lnum) + " use synstack as it validates syn state and works in an empty line + let s:stack = [''] + map(synstack(v:lnum,1),"synIDattr(v:val,'name')") + + " start with strings,comments,etc. + if s:stack[-1] =~? 'comment\|doc' + if l:line =~ '^\s*\*' + return cindent(v:lnum) + elseif l:line !~ '^\s*\/[/*]' + return -1 + endif + elseif s:stack[-1] =~? b:syng_str + if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1,getline(v:lnum-1)) + let b:js_cache[0] = v:lnum + endif + return -1 + endif + + let s:l1 = max([0,prevnonblank(v:lnum) - (s:rel ? 2000 : 1000), + \ get(get(b:,'hi_indent',{}),'blocklnr')]) + call cursor(v:lnum,1) + if s:PreviousToken() is '' + return + endif + let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]] + + let l:line = substitute(l:line,'^\s*','','') + let l:line_raw = l:line + if l:line[:1] == '/*' + let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','') + endif + if l:line =~ '^\/[/*]' + let l:line = '' + endif + + " the containing paren, bracket, or curly. Many hacks for performance + call cursor(v:lnum,1) + let idx = index([']',')','}'],l:line[0]) + if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum || + \ b:js_cache[0] == l:lnum && s:Balanced(l:lnum,pline) + call call('cursor',b:js_cache[1:]) + else + let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0, + \ max([s:l1, &smc ? search('\m^.\{'.&smc.',}','nbW',s:l1 + 1) + 1 : 0])] + try + if idx != -1 + call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()') + elseif getline(v:lnum) !~ '^\S' && s:stack[-1] =~? 'block\|^jsobject$' + call s:GetPair('{','}','bW','s:SkipFunc()') + else + call s:AlternatePair() + endif + catch /^\Cout of bounds$/ + call cursor(v:lnum,1) + endtry + let b:js_cache[1:] = line('.') == v:lnum ? [0,0] : getpos('.')[1:2] + endif + + let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]] + + let [num_ind, is_op, b_l, l:switch_offset, s:in_jsx] = [s:Nat(indent(num)),0,0,0,0] + if !num || s:LookingAt() == '{' && s:IsBlock() + let ilnum = line('.') + if num && !s:in_jsx && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr) + if ilnum == num + let [num, num_ind] = [line('.'), indent('.')] + endif + if idx == -1 && s:PreviousToken() ==# 'switch' && s:IsSwitch() + let l:switch_offset = &cino !~ ':' ? s:sw() : s:ParseCino(':') + if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>' + return s:Nat(num_ind + l:switch_offset) + elseif &cino =~ '=' + let l:case_offset = s:ParseCino('=') + endif + endif + endif + if idx == -1 && pline[-1:] !~ '[{;]' + call cursor(l:lnum, len(pline)) + let sol = matchstr(l:line,s:opfirst) + if sol is '' || sol == '/' && s:SynAt(v:lnum, + \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex' + if s:Continues() + let is_op = s:sw() + endif + elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' && + \ s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) && + \ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) && + \ (s:PreviousToken() == ']' || s:LookingAt() =~ '\k' && + \ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function') + return num_ind + s:sw() + else + let is_op = s:sw() + endif + call cursor(l:lnum, len(pline)) + let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw() + endif + elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U')) + let pval = s:ParseCino('(') + if !pval + let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')] + if search('\m\S','W',num) + return s:ParseCino('w') ? vcol : virtcol('.')-1 + endif + return Wval ? s:Nat(num_ind + Wval) : vcol + endif + return s:Nat(num_ind + pval + searchpair('\m(','','\m)','nbrmW',s:skip_expr,num) * s:sw()) + endif + + " main return + if l:line =~ '^[])}]\|^|}' + if l:line_raw[0] == ')' + if s:ParseCino('M') + return indent(l:lnum) + elseif num && &cino =~# 'm' && !s:ParseCino('m') + return virtcol('.') - 1 + endif + endif + return num_ind + elseif num + return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op) + endif + return b_l + is_op +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/json.vim b/runtime/indent/json.vim index d50112b934..649f2b8aa5 100644 --- a/runtime/indent/json.vim +++ b/runtime/indent/json.vim @@ -1,13 +1,168 @@ " Vim indent file " Language: JSON -" Maintainer: David Barnett <daviebdawg+vim@gmail.com> -" Last Change: 2014 Jul 16 +" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json +" Last Change: 2014 Aug 29 +" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c +" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json +" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe +" http://www.vim.org/scripts/script.php?script_id=2765 -if exists('b:did_indent') - finish +" 0. Initialization {{{1 +" ================= + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish endif +let b:did_indent = 1 -" JSON is a subset of JavaScript. JavaScript indenting should work fine. -runtime! indent/javascript.vim +setlocal nosmartindent -let b:did_indent = 1 +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetJSONIndent() +setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e + +" Only define the function once. +if exists("*GetJSONIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" 1. Variables {{{1 +" ============ + +let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' +" Regex that defines blocks. +let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'jsonString' +endfunction + +" Find line above 'lnum' that isn't empty, or in a string. +function s:PrevNonBlankNonString(lnum) + let lnum = prevnonblank(a:lnum) + while lnum > 0 + " If the line isn't empty or in a string, end search. + let line = getline(lnum) + if !(s:IsInString(lnum, 1) && s:IsInString(lnum, strlen(line))) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum +endfunction + +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + let idx = stridx('(){}[]', line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + let pos = match(line, '[][(){}]', pos + 1) + endwhile + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) +endfunction + +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInString(a:lnum, col) ? col : 0 +endfunction + +" 3. GetJSONIndent Function {{{1 +" ========================= + +function GetJSONIndent() + " 3.1. Setup {{{2 + " ---------- + + " Set up variables for restoring position in file. Could use v:lnum here. + let vcol = col('.') + + " 3.2. Work on the current line {{{2 + " ----------------------------- + + " Get the current line. + let line = getline(v:lnum) + let ind = -1 + + " If we got a closing bracket on an empty line, find its match and indent + " according to it. + let col = matchend(line, '^\s*[]}]') + + if col > 0 && !s:IsInString(v:lnum, col) + call cursor(v:lnum, col) + let bs = strpart('{}[]', stridx('}]', line[col - 1]) * 2, 2) + + let pairstart = escape(bs[0], '[') + let pairend = escape(bs[1], ']') + let pairline = searchpair(pairstart, '', pairend, 'bW') + + if pairline > 0 + let ind = indent(pairline) + else + let ind = virtcol('.') - 1 + endif + + return ind + endif + + " If we are in a multi-line string, don't do anything to it. + if s:IsInString(v:lnum, matchend(line, '^\s*') + 1) + return indent('.') + endif + + " 3.3. Work on the previous line. {{{2 + " ------------------------------- + + let lnum = prevnonblank(v:lnum - 1) + + if lnum == 0 + return 0 + endif + + " Set up variables for current line. + let line = getline(lnum) + let ind = indent(lnum) + + " If the previous line ended with a block opening, add a level of indent. + " if s:Match(lnum, s:block_regex) + " return indent(lnum) + &sw + " endif + + " If the previous line contained an opening bracket, and we are still in it, + " add indent depending on the bracket type. + if line =~ '[[({]' + let counts = s:LineHasOpeningBrackets(lnum) + if counts[0] == '1' || counts[1] == '1' || counts[2] == '1' + return ind + &sw + else + call cursor(v:lnum, vcol) + end + endif + + " }}}2 + + return ind +endfunction + +" }}}1 + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2 ts=8 noet: diff --git a/runtime/indent/ld.vim b/runtime/indent/ld.vim index eccf42b2b4..a72a3a9548 100644 --- a/runtime/indent/ld.vim +++ b/runtime/indent/ld.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -65,7 +65,7 @@ function GetLDIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -73,11 +73,11 @@ function GetLDIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/less.vim b/runtime/indent/less.vim new file mode 100644 index 0000000000..82bf2d87fc --- /dev/null +++ b/runtime/indent/less.vim @@ -0,0 +1,13 @@ +" Vim indent file +" Language: less +" Maintainer: Alessandro Vioni <jenoma@gmail.com> +" URL: https://github.com/genoma/vim-less +" Last Change: 2014 November 24 + +if exists("b:did_indent") + finish +endif + +runtime! indent/css.vim + +" vim:set sw=2: diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim index 01e7223696..f8e1c83079 100644 --- a/runtime/indent/liquid.vim +++ b/runtime/indent/liquid.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Liquid " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists('b:did_indent') finish @@ -54,9 +54,10 @@ function! GetLiquidIndent(...) let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') - let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') - let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') - let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') - let ind -= &sw * s:count(cline,'{%\s*end\w*$') + let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') + let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') + let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= sw * s:count(cline,'{%\s*end\w*$') return ind endfunction diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 21b02f1549..d1d2c0d600 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -2,7 +2,7 @@ " Language: Lua script " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br> " First Author: Max Ischenko <mfi 'at' ukr.net> -" Last Change: 2007 Jul 23 +" Last Change: 2016 Jan 10 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -52,9 +52,9 @@ function! GetLuaIndent() endif endif - " Subtract a 'shiftwidth' on end, else (and elseif), until and '}' + " Subtract a 'shiftwidth' on end, else, elseif, until and '}' " This is the part that requires 'indentkeys'. - let midx = match(getline(v:lnum), '^\s*\%(end\|else\|until\|}\)') + let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)') if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" let ind = ind - &shiftwidth endif diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim index 8412fbb4d1..66a8a40173 100644 --- a/runtime/indent/make.vim +++ b/runtime/indent/make.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Makefile -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-05-07 +" Language: Makefile +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-05-07 if exists("b:did_indent") finish @@ -48,14 +48,14 @@ function GetMakeIndent() if prev_prev_line =~ s:continuation_rx return indent(prev_lnum) elseif prev_line =~ s:rule_rx - return &sw + return shiftwidth() elseif prev_line =~ s:assignment_rx call cursor(prev_lnum, 1) if search(s:assignment_rx, 'W') != 0 return virtcol('.') - 1 else " TODO: ? - return &sw + return shiftwidth() endif else " TODO: OK, this might be a continued shell command, so perhaps indent @@ -66,7 +66,7 @@ function GetMakeIndent() " return indent(prev_lnum) + 2 " endif "endif - return indent(prev_lnum) + &sw + return indent(prev_lnum) + shiftwidth() endif elseif prev_prev_line =~ s:continuation_rx let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line) @@ -102,13 +102,13 @@ function GetMakeIndent() return &ts endif elseif prev_line =~ s:conditional_directive_rx - return &sw + return shiftwidth() else let line = getline(v:lnum) if line =~ s:just_inserted_rule_rx return 0 elseif line =~ s:end_conditional_directive_rx - return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - &sw + return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - shiftwidth() else return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) endif diff --git a/runtime/indent/mf.vim b/runtime/indent/mf.vim new file mode 100644 index 0000000000..88737f4e9f --- /dev/null +++ b/runtime/indent/mf.vim @@ -0,0 +1,6 @@ +" METAFONT indent file +" Language: METAFONT +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Last Change: 2016 Oct 1 + +runtime! indent/mp.vim diff --git a/runtime/indent/mp.vim b/runtime/indent/mp.vim index a118eb8b60..86fa2539c1 100644 --- a/runtime/indent/mp.vim +++ b/runtime/indent/mp.vim @@ -1,56 +1,19 @@ " MetaPost indent file -" Language: MetaPost -" Maintainer: Eugene Minkovskii <emin@mccme.ru> -" Last Change: 2012 May 18 -" Version: 0.1 -" ========================================================================== - -" Identation Rules: {{{1 -" First of all, MetaPost language don't expect any identation rules. -" This screept need for you only if you (not MetaPost) need to do -" exactly code. If you don't need to use indentation, see -" :help filetype-indent-off -" -" Note: Every rules of identation in MetaPost or TeX languages (and in some -" other of course) is very subjective. I can release only my vision of this -" promlem. -" -" .......................................................................... -" Example of correct (by me) identation {{{2 -" shiftwidth=4 -" ========================================================================== -" for i=0 upto 99: -" z[i] = (0,1u) rotated (i*360/100); -" endfor -" draw z0 -- z10 -- z20 -" withpen ... % <- 2sw because breaked line -" withcolor ...; % <- same as previous -" draw z0 for i=1 upto 99: -" -- z[i] % <- 1sw from left end of 'for' satement -" endfor withpen ... % <- 0sw from left end of 'for' satement -" withcolor ...; % <- 2sw because breaked line -" draw if One: % <- This is internal if (like 'for' above) -" one -" elsif Other: -" other -" fi withpen ...; -" if one: % <- This is external if -" draw one; -" elseif other: -" draw other; -" fi -" draw z0; draw z1; -" }}} -" }}} +" Language: MetaPost +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Eugene Minkovskii <emin@mccme.ru> +" Last Change: 2016 Oct 2, 4:13pm +" Version: 0.2 -" Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetMetaPostIndent() -setlocal indentkeys+=;,<:>,=if,=for,=def,=end,=else,=fi +setlocal indentkeys+==end,=else,=fi,=fill,0),0] + +let b:undo_indent = "setl indentkeys< indentexpr<" " Only define the function once. if exists("*GetMetaPostIndent") @@ -59,151 +22,337 @@ endif let s:keepcpo= &cpo set cpo&vim -" Auxiliary Definitions: {{{1 -function! MetaNextNonblankNoncomment(pos) - " Like nextnonblank() but ignore comment lines - let tmp = nextnonblank(a:pos) - while tmp && getline(tmp) =~ '^\s*%' - let tmp = nextnonblank(tmp+1) +function GetMetaPostIndent() + let ignorecase_save = &ignorecase + try + let &ignorecase = 0 + return GetMetaPostIndentIntern() + finally + let &ignorecase = ignorecase_save + endtry +endfunc + +" Regexps {{{ +" Note: the next three variables are made global so that a user may add +" further keywords. +" +" Example: +" +" Put these in ~/.vim/after/indent/mp.vim +" +" let g:mp_open_tag .= '\|\<begintest\>' +" let g:mp_close_tag .= '\|\<endtest\>' + +" Expressions starting indented blocks +let g:mp_open_tag = '' + \ . '\<if\>' + \ . '\|\<else\%[if]\>' + \ . '\|\<for\%(\|ever\|suffixes\)\>' + \ . '\|\<begingroup\>' + \ . '\|\<\%(\|var\|primary\|secondary\|tertiary\)def\>' + \ . '\|^\s*\<begin\%(fig\|graph\|glyph\|char\|logochar\)\>' + \ . '\|[([{]' + +" Expressions ending indented blocks +let g:mp_close_tag = '' + \ . '\<fi\>' + \ . '\|\<else\%[if]\>' + \ . '\|\<end\%(\|for\|group\|def\|fig\|char\|glyph\|graph\)\>' + \ . '\|[)\]}]' + +" Statements that may span multiple lines and are ended by a semicolon. To +" keep this list short, statements that are unlikely to be very long or are +" not very common (e.g., keywords like `interim` or `showtoken`) are not +" included. +" +" The regex for assignments and equations (the last branch) is tricky, because +" it must not match things like `for i :=`, `if a=b`, `def...=`, etc... It is +" not perfect, but it works reasonably well. +let g:mp_statement = '' + \ . '\<\%(\|un\|cut\)draw\>' + \ . '\|\<\%(\|un\)fill\%[draw]\>' + \ . '\|\<draw\%(dbl\)\=arrow\>' + \ . '\|\<clip\>' + \ . '\|\<addto\>' + \ . '\|\<save\>' + \ . '\|\<setbounds\>' + \ . '\|\<message\>' + \ . '\|\<errmessage\>' + \ . '\|\<errhelp\>' + \ . '\|\<fontmapline\>' + \ . '\|\<pickup\>' + \ . '\|\<show\>' + \ . '\|\<special\>' + \ . '\|\<write\>' + \ . '\|\%(^\|;\)\%([^;=]*\%('.g:mp_open_tag.'\)\)\@!.\{-}:\==' + +" A line ends with zero or more spaces, possibly followed by a comment. +let s:eol = '\s*\%($\|%\)' +" }}} + +" Auxiliary functions {{{ +" Returns 1 if (0-based) position immediately preceding `pos` in `line` is +" inside a string or a comment; returns 0 otherwise. + +" This is the function that is called more often when indenting, so it is +" critical that it is efficient. The method we use is significantly faster +" than using syntax attributes, and more general (it does not require +" syntax_items). It is also faster than using a single regex matching an even +" number of quotes. It helps that MetaPost strings cannot span more than one +" line and cannot contain escaped quotes. +function! s:CommentOrString(line, pos) + let in_string = 0 + let q = stridx(a:line, '"') + let c = stridx(a:line, '%') + while q >= 0 && q < a:pos + if c >= 0 && c < q + if in_string " Find next percent symbol + let c = stridx(a:line, '%', q + 1) + else " Inside comment + return 1 + endif + endif + let in_string = 1 - in_string + let q = stridx(a:line, '"', q + 1) " Find next quote endwhile - return tmp + return in_string || (c >= 0 && c <= a:pos) endfunction -function! MetaPrevNonblankNoncomment(pos) - " Like prevnonblank() but ignore comment lines - let tmp = prevnonblank(a:pos) - while tmp && getline(tmp) =~ '^\s*%' - let tmp = prevnonblank(tmp-1) +" Find the first non-comment non-blank line before the current line. +function! s:PrevNonBlankNonComment(lnum) + let l:lnum = prevnonblank(a:lnum - 1) + while getline(l:lnum) =~# '^\s*%' + let l:lnum = prevnonblank(l:lnum - 1) endwhile - return tmp + return l:lnum endfunction -function! MetaSearchNoncomment(pattern, ...) - " Like search() but ignore commented areas - if a:0 - let flags = a:1 - elseif &wrapscan - let flags = "w" - else - let flags = "W" - endif - let cl = line(".") - let cc = col(".") - let tmp = search(a:pattern, flags) - while tmp && synIDattr(synID(line("."), col("."), 1), "name") =~ - \ 'm[fp]\(Comment\|TeXinsert\|String\)' - let tmp = search(a:pattern, flags) +" Returns true if the last tag appearing in the line is an open tag; returns +" false otherwise. +function! s:LastTagIsOpen(line) + let o = s:LastValidMatchEnd(a:line, g:mp_open_tag, 0) + if o == - 1 | return v:false | endif + return s:LastValidMatchEnd(a:line, g:mp_close_tag, o) < 0 +endfunction + +" A simple, efficient and quite effective heuristics is used to test whether +" a line should cause the next line to be indented: count the "opening tags" +" (if, for, def, ...) in the line, count the "closing tags" (endif, endfor, +" ...) in the line, and compute the difference. We call the result the +" "weight" of the line. If the weight is positive, then the next line should +" most likely be indented. Note that `else` and `elseif` are both opening and +" closing tags, so they "cancel out" in almost all cases, the only exception +" being a leading `else[if]`, which is counted as an opening tag, but not as +" a closing tag (so that, for instance, a line containing a single `else:` +" will have weight equal to one, not zero). We do not treat a trailing +" `else[if]` in any special way, because lines ending with an open tag are +" dealt with separately before this function is called (see +" GetMetaPostIndentIntern()). +" +" Example: +" +" forsuffixes $=a,b: if x.$ = y.$ : draw else: fill fi +" % This line will be indented because |{forsuffixes,if,else}| > |{else,fi}| (3 > 2) +" endfor + +function! s:Weight(line) + let [o, i] = [0, s:ValidMatchEnd(a:line, g:mp_open_tag, 0)] + while i > 0 + let o += 1 + let i = s:ValidMatchEnd(a:line, g:mp_open_tag, i) + endwhile + let [c, i] = [0, matchend(a:line, '^\s*\<else\%[if]\>')] " Skip a leading else[if] + let i = s:ValidMatchEnd(a:line, g:mp_close_tag, i) + while i > 0 + let c += 1 + let i = s:ValidMatchEnd(a:line, g:mp_close_tag, i) + endwhile + return o - c +endfunction + +" Similar to matchend(), but skips strings and comments. +" line: a String +function! s:ValidMatchEnd(line, pat, start) + let i = matchend(a:line, a:pat, a:start) + while i > 0 && s:CommentOrString(a:line, i) + let i = matchend(a:line, a:pat, i) + endwhile + return i +endfunction + +" Like s:ValidMatchEnd(), but returns the end position of the last (i.e., +" rightmost) match. +function! s:LastValidMatchEnd(line, pat, start) + let last_found = -1 + let i = matchend(a:line, a:pat, a:start) + while i > 0 + if !s:CommentOrString(a:line, i) + let last_found = i + endif + let i = matchend(a:line, a:pat, i) endwhile - if !tmp - call cursor(cl,cc) + return last_found +endfunction + +function! s:DecreaseIndentOnClosingTag(curr_indent) + let cur_text = getline(v:lnum) + if cur_text =~# '^\s*\%('.g:mp_close_tag.'\)' + return max([a:curr_indent - shiftwidth(), 0]) endif - return tmp + return a:curr_indent endfunction " }}} -function! GetMetaPostIndent() - " not indent in comment ??? - if synIDattr(synID(line("."), col("."), 1), "name") =~ - \ 'm[fp]\(Comment\|TeXinsert\|String\)' +" Main function {{{ +" +" Note: Every rule of indentation in MetaPost is very subjective. We might get +" creative, but things get murky very soon (there are too many corner cases). +" So, we provide a means for the user to decide what to do when this script +" doesn't get it. We use a simple idea: use '%>', '%<' and '%=' to explicitly +" control indentation. The '<' and '>' symbols may be repeated many times +" (e.g., '%>>' will cause the next line to be indented twice). +" +" By using '%>...', '%<...' and '%=', the indentation the user wants is +" preserved by commands like gg=G, even if it does not follow the rules of +" this script. +" +" Example: +" +" def foo = +" makepen( +" subpath(T-n,t) of r %> +" shifted .5down %> +" --subpath(t,T) of r shifted .5up -- cycle %<<< +" ) +" withcolor black +" enddef +" +" The default indentation of the previous example would be: +" +" def foo = +" makepen( +" subpath(T-n,t) of r +" shifted .5down +" --subpath(t,T) of r shifted .5up -- cycle +" ) +" withcolor black +" enddef +" +" Personally, I prefer the latter, but anyway... +function! GetMetaPostIndentIntern() + " Do not touch indentation inside verbatimtex/btex.. etex blocks. + if synIDattr(synID(v:lnum, 1, 1), "name") =~# '^mpTeXinsert$\|^tex\|^Delimiter' return -1 endif - " Some RegExps: {{{1 - " end_of_item: all of end by ';' - " + all of end by :endfor, :enddef, :endfig, :endgroup, :fi - " + all of start by :beginfig(num), :begingroup - " + all of start by :for, :if, :else, :elseif and end by ':' - " + all of start by :def, :vardef and end by '=' - let end_of_item = '\(' . - \ ';\|' . - \ '\<\(end\(for\|def\|fig\|group\)\|fi\)\>\|' . - \ '\<begin\(group\>\|fig\s*(\s*\d\+\s*)\)\|' . - \ '\<\(for\|if\|else\(if\)\=\)\>.\+:\|' . - \ '\<\(var\)\=def\>.\+=' . '\)' - " }}} - " Save: current position {{{1 - let cl = line (".") - let cc = col (".") - let cs = getline(".") - " if it is :beginfig or :endfig use zero indent - if cs =~ '^\s*\(begin\|end\)fig\>' - return 0 - endif - " }}} - " Initialise: ind variable {{{1 - " search previous item not in current line - let p_semicol_l = MetaSearchNoncomment(end_of_item,"bW") - while p_semicol_l == cl - let p_semicol_l = MetaSearchNoncomment(end_of_item,"bW") - endwhile - " if this is first item in program use zero indent - if !p_semicol_l + + " This is the reference line relative to which the current line is indented + " (but see below). + let lnum = s:PrevNonBlankNonComment(v:lnum) + + " At the start of the file use zero indent. + if lnum == 0 return 0 endif - " if this is multiline item, remember first indent - if MetaNextNonblankNoncomment(p_semicol_l+1) < cl - let ind = indent(MetaNextNonblankNoncomment(p_semicol_l+1)) - " else --- search pre-previous item for search first line in previous item - else - " search pre-previous item not in current line - let pp_semicol_l = MetaSearchNoncomment(end_of_item,"bW") - while pp_semicol_l == p_semicol_l - let pp_semicol_l = MetaSearchNoncomment(end_of_item,"bW") - endwhile - " if we find pre-previous item, remember indent of previous item - " else --- remember zero - if pp_semicol_l - let ind = indent(MetaNextNonblankNoncomment(line(".")+1)) - else - let ind = 0 + + let prev_text = getline(lnum) + + " User-defined overrides take precedence over anything else. + " See above for an example. + let j = match(prev_text, '%[<>=]') + if j > 0 + let i = strlen(matchstr(prev_text, '%>\+', j)) - 1 + if i > 0 + return indent(lnum) + i * shiftwidth() + endif + + let i = strlen(matchstr(prev_text, '%<\+', j)) - 1 + if i > 0 + return max([indent(lnum) - i * shiftwidth(), 0]) + endif + + if match(prev_text, '%=', j) + return indent(lnum) endif endif - " }}} - " Increase Indent: {{{1 - " if it is an internal/external :for or :if statements {{{2 - let pnn_s = getline(MetaPrevNonblankNoncomment(cl-1)) - if pnn_s =~ '\<\(for\|if\)\>.\+:\s*\($\|%\)' - let ind = match(pnn_s, '\<\(for\|if\)\>.\+:\s*\($\|%\)') + &sw - " }}} - " if it is a :def, :vardef, :beginfig, :begingroup, :else, :elseif {{{2 - elseif pnn_s =~ '^\s*\(' . - \ '\(var\)\=def\|' . - \ 'begin\(group\|fig\s*(\s*\d\+\s*)\)\|' . - \ 'else\(if\)\=' . '\)\>' - let ind = ind + &sw - " }}} - " if it is a broken line {{{2 - elseif pnn_s !~ end_of_item.'\s*\($\|%\)' - let ind = ind + (2 * &sw) + + " If the reference line ends with an open tag, indent. + " + " Example: + " + " if c: + " 0 + " else: + " 1 + " fi if c2: % Note that this line has weight equal to zero. + " ... % This line will be indented + if s:LastTagIsOpen(prev_text) + return s:DecreaseIndentOnClosingTag(indent(lnum) + shiftwidth()) endif - " }}} - " }}} - " Decrease Indent: {{{1 - " if this is :endfor or :enddef statements {{{2 - " this is correct because :def cannot be inside :for - if cs =~ '\<end\(for\|def\)\=\>' - call MetaSearchNoncomment('\<for\>.\+:\s*\($\|%\)' . '\|' . - \ '^\s*\(var\)\=def\>',"bW") - if col(".") > 1 - let ind = col(".") - 1 + + " Lines with a positive weight are unbalanced and should likely be indented. + " + " Example: + " + " def f = enddef for i = 1 upto 5: if x[i] > 0: 1 else: 2 fi + " ... % This line will be indented (because of the unterminated `for`) + if s:Weight(prev_text) > 0 + return s:DecreaseIndentOnClosingTag(indent(lnum) + shiftwidth()) + endif + + " Unterminated statements cause indentation to kick in. + " + " Example: + " + " draw unitsquare + " withcolor black; % This line is indented because of `draw`. + " x := a + b + c + " + d + e; % This line is indented because of `:=`. + " + let i = s:LastValidMatchEnd(prev_text, g:mp_statement, 0) + if i >= 0 " Does the line contain a statement? + if s:ValidMatchEnd(prev_text, ';', i) < 0 " Is the statement unterminated? + return indent(lnum) + shiftwidth() else - let ind = indent(".") + return s:DecreaseIndentOnClosingTag(indent(lnum)) endif - " }}} - " if this is :fi, :else, :elseif statements {{{2 - elseif cs =~ '\<\(else\(if\)\=\|fi\)\>' - call MetaSearchNoncomment('\<if\>.\+:\s*\($\|%\)',"bW") - let ind = col(".") - 1 - " }}} - " if this is :endgroup statement {{{2 - elseif cs =~ '^\s*endgroup\>' - let ind = ind - &sw endif - " }}} - " }}} - return ind + " Deal with the special case of a statement spanning multiple lines. If the + " current reference line L ends with a semicolon, search backwards for + " another semicolon or a statement keyword. If the latter is found first, + " its line is used as the reference line for indenting the current line + " instead of L. + " + " Example: + " + " if cond: + " draw if a: z0 else: z1 fi + " shifted S + " scaled T; % L + " + " for i = 1 upto 3: % <-- Current line: this gets the same indent as `draw ...` + " + " NOTE: we get here only if L does not contain a statement (among those + " listed in g:mp_statement). + if s:ValidMatchEnd(prev_text, ';'.s:eol, 0) >= 0 " L ends with a semicolon + let stm_lnum = s:PrevNonBlankNonComment(lnum) + while stm_lnum > 0 + let prev_text = getline(stm_lnum) + let sc_pos = s:LastValidMatchEnd(prev_text, ';', 0) + let stm_pos = s:ValidMatchEnd(prev_text, g:mp_statement, sc_pos) + if stm_pos > sc_pos + let lnum = stm_lnum + break + elseif sc_pos > stm_pos + break + endif + let stm_lnum = s:PrevNonBlankNonComment(stm_lnum) + endwhile + endif + + return s:DecreaseIndentOnClosingTag(indent(lnum)) endfunction -" +" }}} let &cpo = s:keepcpo unlet s:keepcpo diff --git a/runtime/indent/nsis.vim b/runtime/indent/nsis.vim new file mode 100644 index 0000000000..223f4fa28e --- /dev/null +++ b/runtime/indent/nsis.vim @@ -0,0 +1,91 @@ +" Vim indent file +" Language: NSIS script +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Last Change: 2018-01-21 +" Filenames: *.nsi +" License: VIM License + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent +setlocal noautoindent +setlocal indentexpr=GetNsisIndent(v:lnum) +setlocal indentkeys=!^F,o,O +setlocal indentkeys+==~${Else,=~${EndIf,=~${EndUnless,=~${AndIf,=~${AndUnless,=~${OrIf,=~${OrUnless,=~${Case,=~${Default,=~${EndSelect,=~${EndSwith,=~${Loop,=~${Next,=~${MementoSectionEnd,=~FunctionEnd,=~SectionEnd,=~SectionGroupEnd,=~PageExEnd,0=~!macroend,0=~!if,0=~!else,0=~!endif + +if exists("*GetNsisIndent") + finish +endif + +function! GetNsisIndent(lnum) + " If this line is explicitly joined: If the previous line was also joined, + " line it up with that one, otherwise add two 'shiftwidth' + if getline(a:lnum - 1) =~ '\\$' + if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' + return indent(a:lnum - 1) + endif + return indent(a:lnum - 1) + shiftwidth() * 2 + endif + + " Grab the current line, stripping comments. + let l:thisl = substitute(getline(a:lnum), '[;#].*$', '', '') + " Check if this line is a conditional preprocessor line. + let l:preproc = l:thisl =~? '^\s*!\%(if\|else\|endif\)' + + " Grab the previous line, stripping comments. + " Skip preprocessor lines and continued lines. + let l:prevlnum = a:lnum + while 1 + let l:prevlnum = prevnonblank(l:prevlnum - 1) + if l:prevlnum == 0 + " top of file + return 0 + endif + let l:prevl = substitute(getline(l:prevlnum), '[;#].*$', '', '') + let l:prevpreproc = l:prevl =~? '^\s*!\%(if\|else\|endif\)' + if l:preproc == l:prevpreproc && getline(l:prevlnum - 1) !~? '\\$' + break + endif + endwhile + let l:previ = indent(l:prevlnum) + let l:ind = l:previ + + if l:preproc + " conditional preprocessor + if l:prevl =~? '^\s*!\%(if\%(\%(macro\)\?n\?def\)\?\|else\)\>' + let l:ind += shiftwidth() + endif + if l:thisl =~? '^\s*!\%(else\|endif\)\?\>' + let l:ind -= shiftwidth() + endif + return l:ind + endif + + if l:prevl =~? '^\s*\%(\${\%(If\|IfNot\|Unless\|ElseIf\|ElseIfNot\|ElseUnless\|Else\|AndIf\|AndIfNot\|AndUnless\|OrIf\|OrIfNot\|OrUnless\|Select\|Case\|Case[2-5]\|CaseElse\|Default\|Switch\|Do\|DoWhile\|DoUntil\|For\|ForEach\|MementoSection\)}\|Function\>\|Section\>\|SectionGroup\|PageEx\>\|!macro\>\)' + " previous line opened a block + let l:ind += shiftwidth() + endif + if l:thisl =~? '^\s*\%(\${\%(ElseIf\|ElseIfNot\|ElseUnless\|Else\|EndIf\|EndUnless\|AndIf\|AndIfNot\|AndUnless\|OrIf\|OrIfNot\|OrUnless\|Loop\|LoopWhile\|LoopUntil\|Next\|MementoSectionEnd\)\>}\?\|FunctionEnd\>\|SectionEnd\>\|SectionGroupEnd\|PageExEnd\>\|!macroend\>\)' + " this line closed a block + let l:ind -= shiftwidth() + elseif l:thisl =~? '^\s*\${\%(Case\|Case[2-5]\|CaseElse\|Default\)\>}\?' + if l:prevl !~? '^\s*\${\%(Select\|Switch\)}' + let l:ind -= shiftwidth() + endif + elseif l:thisl =~? '^\s*\${\%(EndSelect\|EndSwitch\)\>}\?' + " this line closed a block + if l:prevl =~? '^\s*\${\%(Select\|Switch\)}' + let l:ind -= shiftwidth() + else + let l:ind -= shiftwidth() * 2 + endif + endif + + return l:ind +endfunction + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index b83a1923ed..5dee6c9f47 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,8 +3,8 @@ " Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> " URL: http://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2014 April 3rd -" Version: 1.49 +" Last Change: 2018 May 18th +" Version: 1.66 " " " Type :help php-indent for available options @@ -12,7 +12,7 @@ " A fully commented version of this file is available on github " " -" If you find a bug, please open a ticket on github.org +" If you find a bug, please open a ticket on github.com " ( https://github.com/2072/PHP-Indenting-for-VIm/issues ) with an example of " code that breaks the algorithm. " @@ -48,18 +48,17 @@ endif let b:did_indent = 1 -let php_sync_method = 0 - +let g:php_sync_method = 0 if exists("PHP_default_indenting") - let b:PHP_default_indenting = PHP_default_indenting * &sw + let b:PHP_default_indenting = PHP_default_indenting * shiftwidth() else let b:PHP_default_indenting = 0 endif if exists("PHP_outdentSLComments") - let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw + let b:PHP_outdentSLComments = PHP_outdentSLComments * shiftwidth() else let b:PHP_outdentSLComments = 0 endif @@ -83,6 +82,12 @@ else let b:PHP_outdentphpescape = 1 endif +if exists("PHP_noArrowMatching") + let b:PHP_noArrowMatching = PHP_noArrowMatching +else + let b:PHP_noArrowMatching = 0 +endif + if exists("PHP_vintage_case_default_indent") && PHP_vintage_case_default_indent let b:PHP_vintage_case_default_indent = 1 @@ -112,7 +117,7 @@ setlocal nocindent setlocal nolisp setlocal indentexpr=GetPhpIndent() -setlocal indentkeys=0{,0},0),:,!^F,o,O,e,*<Return>,=?>,=<?,=*/ +setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=?>,=<?,=*/ @@ -124,23 +129,27 @@ endif if exists("*GetPhpIndent") call ResetPhpOptions() - finish " XXX -- comment this line for easy dev + finish endif +let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)' let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' -let s:functionDecl = '\<function\>\%(\s\+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\)\=\s*(.*' -let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' -let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.s:endline.'\)\|^[^''"`]*[''"`]$' -let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' +let s:functionDecl = '\<function\>\%(\s\+&\='.s:PHP_validVariable.'\)\=\s*(.*' +let s:endline = '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' +let s:unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.s:endline + +let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)' +let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' +let s:structureHead = '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline . '\|\<new\s\+class\>' let s:escapeDebugStops = 0 function! DebugPrintReturn(scriptLine) - if ! s:escapeDebugStops + if ! s:escapeDebugStops echo "debug:" . a:scriptLine let c = getchar() if c == "\<Del>" @@ -158,8 +167,6 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum = b:GetLastRealCodeLNum_ADD endif - let old_lnum = lnum - while lnum > 1 let lnum = prevnonblank(lnum) let lastline = getline(lnum) @@ -199,15 +206,33 @@ function! GetLastRealCodeLNum(startline) " {{{ elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc - let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '') + let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '') while getline(lnum) !~? tofind && lnum > 1 let lnum = lnum - 1 endwhile elseif lastline =~ '^[^''"`]*[''"`][;,]'.s:endline - let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$', '') - while getline(lnum) !~? tofind && lnum > 1 - let lnum = lnum - 1 + + let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$\\|^[^\1]\\+[=([]\\s*[\1]', '') + let trylnum = lnum + while getline(trylnum) !~? tofind && trylnum > 1 + let trylnum = trylnum - 1 endwhile + + if trylnum == 1 + break + else + if lastline =~ ';'.s:endline + while getline(trylnum) !~? s:terminated && getline(trylnum) !~? '{'.s:endline && trylnum > 1 + let trylnum = prevnonblank(trylnum - 1) + endwhile + + + if trylnum == 1 + break + end + end + let lnum = trylnum + end else break endif @@ -217,7 +242,7 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum=0 endif - if b:InPHPcode_and_script && !b:InPHPcode + if b:InPHPcode_and_script && 1 > b:InPHPcode let b:InPHPcode_and_script = 0 endif @@ -237,7 +262,7 @@ endfun function! Skippmatch() " {{{ let synname = synIDattr(synID(line("."), col("."), 0), "name") - if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# "^phpComment" && b:UserIsTypingComment + if synname ==? "Delimiter" || synname ==? "phpRegionDelimiter" || synname =~? "^phpParent" || synname ==? "phpArrayParens" || synname =~? '^php\%(Block\|Brace\)' || synname ==? "javaScriptBraces" || synname =~? '^php\%(Doc\)\?Comment' && b:UserIsTypingComment return 0 else return 1 @@ -249,10 +274,10 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ let line = searchpair('{', '', '}', 'bW', 'Skippmatch()') if a:blockStarter == 1 - while line > 1 + while line > 1 let linec = getline(line) - if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if linec =~ s:terminated || linec =~ s:structureHead break endif @@ -263,6 +288,62 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ return line endfun " }}} +let s:blockChars = {'{':1, '[': 1, '(': 1, ')':-1, ']':-1, '}':-1} +function! BalanceDirection (str) + + let balance = 0 + + for c in split(a:str, '\zs') + if has_key(s:blockChars, c) + let balance += s:blockChars[c] + endif + endfor + + return balance +endfun + +function! StripEndlineComments (line) + return substitute(a:line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') +endfun + +function! FindArrowIndent (lnum) " {{{ + + let parrentArrowPos = 0 + let lnum = a:lnum + while lnum > 1 + let last_line = getline(lnum) + if last_line =~ '^\s*->' + let parrentArrowPos = indent(a:lnum) + break + else + call cursor(lnum, 1) + let cleanedLnum = StripEndlineComments(last_line) + if cleanedLnum =~ '->' + if ! b:PHP_noArrowMatching + let parrentArrowPos = searchpos('->', 'W', lnum)[1] - 1 + else + let parrentArrowPos = indent(lnum) + shiftwidth() + endif + break + elseif cleanedLnum =~ ')'.s:endline && BalanceDirection(last_line) < 0 + call searchpos(')'.s:endline, 'cW', lnum) + let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') + if openedparent != lnum + let lnum = openedparent + else + let openedparent = -1 + endif + + else + let parrentArrowPos = indent(lnum) + shiftwidth() + break + endif + endif + endwhile + + return parrentArrowPos +endfun "}}} + function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{ if getline(a:lnum) =~# '^\s*}\s*else\%(if\)\=\>' @@ -310,11 +391,10 @@ let s:defaultORcase = '^\s*\%(default\|case\).*:' function! FindTheSwitchIndent (lnum) " {{{ - let test = GetLastRealCodeLNum(a:lnum - 1) if test <= 1 - return indent(1) - &sw * b:PHP_vintage_case_default_indent + return indent(1) - shiftwidth() * b:PHP_vintage_case_default_indent end while getline(test) =~ '^\s*}' && test > 1 @@ -328,14 +408,14 @@ function! FindTheSwitchIndent (lnum) " {{{ if getline(test) =~# '^\s*switch\>' return indent(test) elseif getline(test) =~# s:defaultORcase - return indent(test) - &sw * b:PHP_vintage_case_default_indent + return indent(test) - shiftwidth() * b:PHP_vintage_case_default_indent else return FindTheSwitchIndent(test) endif endfunction "}}} -let s:SynPHPMatchGroups = {'phpParent':1, 'Delimiter':1, 'Define':1, 'Storageclass':1, 'StorageClass':1, 'Structure':1, 'Exception':1} +let s:SynPHPMatchGroups = {'phpparent':1, 'delimiter':1, 'define':1, 'storageclass':1, 'structure':1, 'exception':1} function! IslinePHP (lnum, tofind) " {{{ let cline = getline(a:lnum) @@ -351,15 +431,15 @@ function! IslinePHP (lnum, tofind) " {{{ let synname = synIDattr(synID(a:lnum, coltotest, 0), "name") - if synname == 'phpStringSingle' || synname == 'phpStringDouble' || synname == 'phpBacktick' + if synname ==? 'phpStringSingle' || synname ==? 'phpStringDouble' || synname ==? 'phpBacktick' if cline !~ '^\s*[''"`]' - return "" + return "SpecStringEntrails" else return synname end end - if get(s:SynPHPMatchGroups, synname) || synname =~ '^php' || synname =~? '^javaScript' + if get(s:SynPHPMatchGroups, tolower(synname)) || synname =~ '^php' || synname =~? '^javaScript' return synname else return "" @@ -372,7 +452,7 @@ if ! s:autoresetoptions endif function! ResetPhpOptions() - if ! b:optionsset && &filetype == "php" + if ! b:optionsset && &filetype =~ "php" if b:PHP_autoformatcomment setlocal comments=s1:/*,mb:*,ex:*/,://,:# @@ -390,6 +470,10 @@ endfunc call ResetPhpOptions() +function! GetPhpIndentVersion() + return "1.66-bundle" +endfun + function! GetPhpIndent() let b:GetLastRealCodeLNum_ADD = 0 @@ -401,7 +485,7 @@ function! GetPhpIndent() endif if b:PHP_default_indenting - let b:PHP_default_indenting = g:PHP_default_indenting * &sw + let b:PHP_default_indenting = g:PHP_default_indenting * shiftwidth() endif let cline = getline(v:lnum) @@ -418,7 +502,7 @@ function! GetPhpIndent() let b:PHP_indentinghuge = 0 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting endif - let b:PHP_lastindented = v:lnum + let real_PHP_lastindented = v:lnum let b:PHP_LastIndentedWasComment=0 let b:PHP_InsideMultilineComment=0 let b:PHP_indentbeforelast = 0 @@ -430,12 +514,16 @@ function! GetPhpIndent() elseif v:lnum > b:PHP_lastindented let real_PHP_lastindented = b:PHP_lastindented - let b:PHP_lastindented = v:lnum + else + let real_PHP_lastindented = v:lnum endif + let b:PHP_lastindented = v:lnum + if !b:InPHPcode_checked " {{{ One time check let b:InPHPcode_checked = 1 + let b:UserIsTypingComment = 0 let synname = "" if cline !~ '<?.*?>' @@ -443,14 +531,16 @@ function! GetPhpIndent() endif if synname!="" - if synname != "phpHereDoc" && synname != "phpHereDocDelimiter" + if synname ==? "SpecStringEntrails" + let b:InPHPcode = -1 " thumb down + let b:InPHPcode_tofind = "" + elseif synname !=? "phpHereDoc" && synname !=? "phpHereDocDelimiter" let b:InPHPcode = 1 let b:InPHPcode_tofind = "" - if synname =~# "^phpComment" + if synname =~? '^php\%(Doc\)\?Comment' let b:UserIsTypingComment = 1 - else - let b:UserIsTypingComment = 0 + let b:InPHPcode_checked = 0 endif if synname =~? '^javaScript' @@ -459,18 +549,16 @@ function! GetPhpIndent() else let b:InPHPcode = 0 - let b:UserIsTypingComment = 0 let lnum = v:lnum - 1 - while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1 + while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1 let lnum = lnum - 1 endwhile - let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') + let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') endif else let b:InPHPcode = 0 - let b:UserIsTypingComment = 0 let b:InPHPcode_tofind = s:PHP_startindenttag endif endif "!b:InPHPcode_checked }}} @@ -483,9 +571,16 @@ function! GetPhpIndent() if b:InPHPcode_tofind!="" if cline =~? b:InPHPcode_tofind - let b:InPHPcode = 1 let b:InPHPcode_tofind = "" let b:UserIsTypingComment = 0 + + if b:InPHPcode == -1 + let b:InPHPcode = 1 + return -1 + end + + let b:InPHPcode = 1 + if cline =~ '\*/' call cursor(v:lnum, 1) if cline !~ '^\*/' @@ -510,9 +605,9 @@ function! GetPhpIndent() endif endif - if b:InPHPcode + if 1 == b:InPHPcode - if !b:InPHPcode_and_script && last_line =~ '\%(<?.*\)\@<!?>\%(.*<?\)\@!' && IslinePHP(lnum, '?>')=~"Delimiter" + if !b:InPHPcode_and_script && last_line =~ '\%(<?.*\)\@<!?>\%(.*<?\)\@!' && IslinePHP(lnum, '?>')=~?"Delimiter" if cline !~? s:PHP_startindenttag let b:InPHPcode = 0 let b:InPHPcode_tofind = s:PHP_startindenttag @@ -521,11 +616,11 @@ function! GetPhpIndent() endif elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before - let b:InPHPcode = 0 + let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') - elseif last_line =~? '<<<''\=\a\w*''\=$' + elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' let b:InPHPcode = 0 - let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') + let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*' let b:InPHPcode = 0 @@ -538,7 +633,7 @@ function! GetPhpIndent() endif " }}} - if !b:InPHPcode && !b:InPHPcode_and_script + if 1 > b:InPHPcode && !b:InPHPcode_and_script return -1 endif @@ -568,7 +663,7 @@ function! GetPhpIndent() endif endif - if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*' && cline !~ '\*/\s*$' + if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*\%(.*\*/\)\@!' if getline(v:lnum + 1) !~ '^\s*\*' return -1 endif @@ -640,25 +735,26 @@ function! GetPhpIndent() let terminated = s:terminated - let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline + let unstated = s:unstated + if ind != b:PHP_default_indenting && cline =~# '^\s*else\%(if\)\=\>' let b:PHP_CurrentIndentLevel = b:PHP_default_indenting return indent(FindTheIfOfAnElse(v:lnum, 1)) elseif cline =~# s:defaultORcase - return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent + return FindTheSwitchIndent(v:lnum) + shiftwidth() * b:PHP_vintage_case_default_indent elseif cline =~ '^\s*)\=\s*{' let previous_line = last_line let last_line_num = lnum while last_line_num > 1 - if previous_line =~ terminated || previous_line =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . endline + if previous_line =~ terminated || previous_line =~ s:structureHead let ind = indent(last_line_num) if b:PHP_BracesAtCodeLevel - let ind = ind + &sw + let ind = ind + shiftwidth() endif return ind @@ -667,19 +763,20 @@ function! GetPhpIndent() let last_line_num = GetLastRealCodeLNum(last_line_num - 1) let previous_line = getline(last_line_num) endwhile - + elseif cline =~ '^\s*->' + return FindArrowIndent(lnum) elseif last_line =~# unstated && cline !~ '^\s*);\='.endline - let ind = ind + &sw " we indent one level further when the preceding line is not stated + let ind = ind + shiftwidth() " we indent one level further when the preceding line is not stated return ind + addSpecial - elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things) + elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated let previous_line = last_line let last_line_num = lnum let LastLineClosed = 1 let isSingleLineBlock = 0 while 1 - if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX + if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline call cursor(last_line_num, 1) if previous_line !~ '^}' @@ -740,58 +837,71 @@ function! GetPhpIndent() endif endif - let plinnum = GetLastRealCodeLNum(lnum - 1) - let AntepenultimateLine = getline(plinnum) + if (last_line !~ '^\s*}\%(}}\)\@!') + let plinnum = GetLastRealCodeLNum(lnum - 1) + else + let plinnum = GetLastRealCodeLNum(FindOpenBracket(lnum, 1) - 1) + endif - let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') + let AntepenultimateLine = getline(plinnum) + let last_line = StripEndlineComments(last_line) if ind == b:PHP_default_indenting - if last_line =~ terminated + if last_line =~ terminated && last_line !~# s:defaultORcase let LastLineClosed = 1 endif endif if !LastLineClosed + let openedparent = -1 + - if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline + if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline && BalanceDirection(last_line) > 0 let dontIndent = 0 - if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*[)\]]\+\(\s*:\s*'.s:PHP_validVariable.'\)\=\s*{'.endline && last_line !~ s:structureHead let dontIndent = 1 endif if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{') - let ind = ind + &sw + let ind = ind + shiftwidth() endif if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 let b:PHP_CurrentIndentLevel = ind - return ind + addSpecial endif - elseif last_line =~ '\S\+\s*),'.endline + elseif last_line =~ '),'.endline && BalanceDirection(last_line) < 0 call cursor(lnum, 1) - call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag + call searchpos('),'.endline, 'cW') let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') if openedparent != lnum let ind = indent(openedparent) endif - elseif last_line =~ '^\s*'.s:blockstart - let ind = ind + &sw + elseif last_line =~ s:structureHead + let ind = ind + shiftwidth() - elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase - let ind = ind + &sw + elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase + let ind = ind + shiftwidth() endif + + if openedparent >= 0 + let last_line = StripEndlineComments(getline(openedparent)) + endif + endif + + if cline =~ '^\s*[)\]];\=' + let ind = ind - shiftwidth() endif - if cline =~ '^\s*[)\]];\=' - let ind = ind - &sw + if last_line =~ '^\s*->' && last_line !~? s:structureHead && BalanceDirection(last_line) <= 0 + let ind = ind - shiftwidth() endif let b:PHP_CurrentIndentLevel = ind diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 82bdc8bba4..373b0e65df 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -1,12 +1,13 @@ " Vim indent file " Language: R " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Fri Feb 15, 2013 08:11PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Thu Feb 18, 2016 06:32AM " Only load this indent file when no other was loaded. if exists("b:did_indent") - finish + finish endif let b:did_indent = 1 @@ -15,478 +16,506 @@ setlocal indentexpr=GetRIndent() " Only define the function once. if exists("*GetRIndent") - finish + finish endif " Options to make the indentation more similar to Emacs/ESS: if !exists("g:r_indent_align_args") - let g:r_indent_align_args = 1 + let g:r_indent_align_args = 1 endif if !exists("g:r_indent_ess_comments") - let g:r_indent_ess_comments = 0 + let g:r_indent_ess_comments = 0 endif if !exists("g:r_indent_comment_column") - let g:r_indent_comment_column = 40 + let g:r_indent_comment_column = 40 endif if ! exists("g:r_indent_ess_compatible") - let g:r_indent_ess_compatible = 0 + let g:r_indent_ess_compatible = 0 +endif +if ! exists("g:r_indent_op_pattern") + let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$' endif function s:RDelete_quotes(line) - let i = 0 - let j = 0 - let line1 = "" - let llen = strlen(a:line) - while i < llen - if a:line[i] == '"' - let i += 1 - let line1 = line1 . 's' - while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen - let i += 1 - endwhile - if a:line[i] == '"' - let i += 1 - endif - else - if a:line[i] == "'" - let i += 1 - let line1 = line1 . 's' - while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen - let i += 1 - endwhile - if a:line[i] == "'" - let i += 1 - endif - else - if a:line[i] == "`" - let i += 1 - let line1 = line1 . 's' - while a:line[i] != "`" && i < llen - let i += 1 - endwhile - if a:line[i] == "`" - let i += 1 - endif - endif - endif + let i = 0 + let j = 0 + let line1 = "" + let llen = strlen(a:line) + while i < llen + if a:line[i] == '"' + let i += 1 + let line1 = line1 . 's' + while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen + let i += 1 + endwhile + if a:line[i] == '"' + let i += 1 + endif + else + if a:line[i] == "'" + let i += 1 + let line1 = line1 . 's' + while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen + let i += 1 + endwhile + if a:line[i] == "'" + let i += 1 endif - if i == llen - break + else + if a:line[i] == "`" + let i += 1 + let line1 = line1 . 's' + while a:line[i] != "`" && i < llen + let i += 1 + endwhile + if a:line[i] == "`" + let i += 1 + endif endif - let line1 = line1 . a:line[i] - let j += 1 - let i += 1 - endwhile - return line1 + endif + endif + if i == llen + break + endif + let line1 = line1 . a:line[i] + let j += 1 + let i += 1 + endwhile + return line1 endfunction " Convert foo(bar()) int foo() function s:RDelete_parens(line) - if s:Get_paren_balance(a:line, "(", ")") != 0 - return a:line - endif - let i = 0 - let j = 0 - let line1 = "" - let llen = strlen(a:line) - while i < llen - let line1 = line1 . a:line[i] - if a:line[i] == '(' - let nop = 1 - while nop > 0 && i < llen - let i += 1 - if a:line[i] == ')' - let nop -= 1 - else - if a:line[i] == '(' - let nop += 1 - endif - endif - endwhile - let line1 = line1 . a:line[i] - endif + if s:Get_paren_balance(a:line, "(", ")") != 0 + return a:line + endif + let i = 0 + let j = 0 + let line1 = "" + let llen = strlen(a:line) + while i < llen + let line1 = line1 . a:line[i] + if a:line[i] == '(' + let nop = 1 + while nop > 0 && i < llen let i += 1 - endwhile - return line1 + if a:line[i] == ')' + let nop -= 1 + else + if a:line[i] == '(' + let nop += 1 + endif + endif + endwhile + let line1 = line1 . a:line[i] + endif + let i += 1 + endwhile + return line1 endfunction function! s:Get_paren_balance(line, o, c) - let line2 = substitute(a:line, a:o, "", "g") - let openp = strlen(a:line) - strlen(line2) - let line3 = substitute(line2, a:c, "", "g") - let closep = strlen(line2) - strlen(line3) - return openp - closep + let line2 = substitute(a:line, a:o, "", "g") + let openp = strlen(a:line) - strlen(line2) + let line3 = substitute(line2, a:c, "", "g") + let closep = strlen(line2) - strlen(line3) + return openp - closep endfunction function! s:Get_matching_brace(linenr, o, c, delbrace) - let line = SanitizeRLine(getline(a:linenr)) - if a:delbrace == 1 - let line = substitute(line, '{$', "", "") - endif - let pb = s:Get_paren_balance(line, a:o, a:c) - let i = a:linenr - while pb != 0 && i > 1 - let i -= 1 - let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c) - endwhile - return i + let line = SanitizeRLine(getline(a:linenr)) + if a:delbrace == 1 + let line = substitute(line, '{$', "", "") + endif + let pb = s:Get_paren_balance(line, a:o, a:c) + let i = a:linenr + while pb != 0 && i > 1 + let i -= 1 + let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c) + endwhile + return i endfunction " This function is buggy because there 'if's without 'else' " It must be rewritten relying more on indentation function! s:Get_matching_if(linenr, delif) -" let filenm = expand("%") -" call writefile([filenm], "/tmp/matching_if_" . a:linenr) - let line = SanitizeRLine(getline(a:linenr)) - if a:delif - let line = substitute(line, "if", "", "g") - endif - let elsenr = 0 - let i = a:linenr - let ifhere = 0 - while i > 0 - let line2 = substitute(line, '\<else\>', "xxx", "g") - let elsenr += strlen(line) - strlen(line2) - if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()' - let elsenr -= 1 - if elsenr == 0 - let ifhere = i - break - endif - endif - let i -= 1 - let line = SanitizeRLine(getline(i)) - endwhile - if ifhere - return ifhere - else - return a:linenr + let line = SanitizeRLine(getline(a:linenr)) + if a:delif + let line = substitute(line, "if", "", "g") + endif + let elsenr = 0 + let i = a:linenr + let ifhere = 0 + while i > 0 + let line2 = substitute(line, '\<else\>', "xxx", "g") + let elsenr += strlen(line) - strlen(line2) + if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()' + let elsenr -= 1 + if elsenr == 0 + let ifhere = i + break + endif endif + let i -= 1 + let line = SanitizeRLine(getline(i)) + endwhile + if ifhere + return ifhere + else + return a:linenr + endif endfunction function! s:Get_last_paren_idx(line, o, c, pb) - let blc = a:pb - let line = substitute(a:line, '\t', s:curtabstop, "g") - let theidx = -1 - let llen = strlen(line) - let idx = 0 - while idx < llen - if line[idx] == a:o - let blc -= 1 - if blc == 0 - let theidx = idx - endif - else - if line[idx] == a:c - let blc += 1 - endif - endif - let idx += 1 - endwhile - return theidx + 1 + let blc = a:pb + let line = substitute(a:line, '\t', s:curtabstop, "g") + let theidx = -1 + let llen = strlen(line) + let idx = 0 + while idx < llen + if line[idx] == a:o + let blc -= 1 + if blc == 0 + let theidx = idx + endif + else + if line[idx] == a:c + let blc += 1 + endif + endif + let idx += 1 + endwhile + return theidx + 1 endfunction " Get previous relevant line. Search back until getting a line that isn't " comment or blank function s:Get_prev_line(lineno) - let lnum = a:lineno - 1 + let lnum = a:lineno - 1 + let data = getline( lnum ) + while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$') + let lnum = lnum - 1 let data = getline( lnum ) - while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$') - let lnum = lnum - 1 - let data = getline( lnum ) - endwhile - return lnum + endwhile + return lnum endfunction " This function is also used by r-plugin/common_global.vim " Delete from '#' to the end of the line, unless the '#' is inside a string. function SanitizeRLine(line) - let newline = s:RDelete_quotes(a:line) - let newline = s:RDelete_parens(newline) - let newline = substitute(newline, '#.*', "", "") - let newline = substitute(newline, '\s*$', "", "") - return newline + let newline = s:RDelete_quotes(a:line) + let newline = s:RDelete_parens(newline) + let newline = substitute(newline, '#.*', "", "") + let newline = substitute(newline, '\s*$', "", "") + if &filetype == "rhelp" && newline =~ '^\\method{.*}{.*}(.*' + let newline = substitute(newline, '^\\method{\(.*\)}{.*}', '\1', "") + endif + return newline endfunction function GetRIndent() - let clnum = line(".") " current line + let clnum = line(".") " current line - let cline = getline(clnum) - if cline =~ '^\s*#' - if g:r_indent_ess_comments == 1 - if cline =~ '^\s*###' - return 0 - endif - if cline !~ '^\s*##' - return g:r_indent_comment_column - endif - endif + let cline = getline(clnum) + if cline =~ '^\s*#' + if g:r_indent_ess_comments == 1 + if cline =~ '^\s*###' + return 0 + endif + if cline !~ '^\s*##' + return g:r_indent_comment_column + endif endif - - let cline = SanitizeRLine(cline) - - if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$' - let indline = s:Get_matching_brace(clnum, '{', '}', 1) - if indline > 0 && indline != clnum - let iline = SanitizeRLine(getline(indline)) - if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$' - return indent(indline) - else - let indline = s:Get_matching_brace(indline, '(', ')', 1) - return indent(indline) - endif - endif + endif + + let cline = SanitizeRLine(cline) + + if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$' + let indline = s:Get_matching_brace(clnum, '{', '}', 1) + if indline > 0 && indline != clnum + let iline = SanitizeRLine(getline(indline)) + if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$' + return indent(indline) + else + let indline = s:Get_matching_brace(indline, '(', ')', 1) + return indent(indline) + endif endif + endif - " Find the first non blank line above the current line - let lnum = s:Get_prev_line(clnum) - " Hit the start of the file, use zero indent. - if lnum == 0 - return 0 - endif + " Find the first non blank line above the current line + let lnum = s:Get_prev_line(clnum) + " Hit the start of the file, use zero indent. + if lnum == 0 + return 0 + endif - let line = SanitizeRLine(getline(lnum)) + let line = SanitizeRLine(getline(lnum)) - if &filetype == "rhelp" - if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{' - return 0 - endif - if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{' - return 0 - endif - if line =~ '^\\method{.*}{.*}(.*' - let line = substitute(line, '^\\method{\(.*\)}{.*}', '\1', "") - endif + if &filetype == "rhelp" + if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{' + return 0 endif - - if cline =~ '^\s*{' - if g:r_indent_ess_compatible && line =~ ')$' - let nlnum = lnum - let nline = line - while s:Get_paren_balance(nline, '(', ')') < 0 - let nlnum = s:Get_prev_line(nlnum) - let nline = SanitizeRLine(getline(nlnum)) . nline - endwhile - if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw - return 0 - endif - endif - if s:Get_paren_balance(line, "(", ")") == 0 - return indent(lnum) - endif + if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{' + return 0 endif - - " line is an incomplete command: - if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' - return indent(lnum) + &sw + endif + + if &filetype == "rnoweb" && line =~ "^<<.*>>=" + return 0 + endif + + if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0 + if g:r_indent_ess_compatible && line =~ ')$' + let nlnum = lnum + let nline = line + while s:Get_paren_balance(nline, '(', ')') < 0 + let nlnum = s:Get_prev_line(nlnum) + let nline = SanitizeRLine(getline(nlnum)) . nline + endwhile + if nline =~ '^\s*function\s*(' && indent(nlnum) == shiftwidth() + return 0 + endif endif - - " Deal with () and [] - - let pb = s:Get_paren_balance(line, '(', ')') - - if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$')) - return indent(lnum) + &sw + if s:Get_paren_balance(line, "(", ")") == 0 + return indent(lnum) endif + endif - let bb = s:Get_paren_balance(line, '[', ']') + " line is an incomplete command: + if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$' + return indent(lnum) + shiftwidth() + endif - let s:curtabstop = repeat(' ', &tabstop) - if g:r_indent_align_args == 1 + " Deal with () and [] - if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]') - return indent(lnum) - endif + let pb = s:Get_paren_balance(line, '(', ')') - if pb > 0 - if &filetype == "rhelp" - let ind = s:Get_last_paren_idx(line, '(', ')', pb) - else - let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb) - endif - return ind - endif + if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$')) + return indent(lnum) + shiftwidth() + endif - if pb < 0 && line =~ '.*[,&|\-\*+<>]$' - let lnum = s:Get_prev_line(lnum) - while pb < 1 && lnum > 0 - let line = SanitizeRLine(getline(lnum)) - let line = substitute(line, '\t', s:curtabstop, "g") - let ind = strlen(line) - while ind > 0 - if line[ind] == ')' - let pb -= 1 - else - if line[ind] == '(' - let pb += 1 - endif - endif - if pb == 1 - return ind + 1 - endif - let ind -= 1 - endwhile - let lnum -= 1 - endwhile - return 0 - endif + let s:curtabstop = repeat(' ', &tabstop) - if bb > 0 - let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb) - return ind - endif + if g:r_indent_align_args == 1 + if pb > 0 && line =~ '{$' + return s:Get_last_paren_idx(line, '(', ')', pb) + shiftwidth() endif - let post_block = 0 - if line =~ '}$' - let lnum = s:Get_matching_brace(lnum, '{', '}', 0) - let line = SanitizeRLine(getline(lnum)) - if lnum > 0 && line =~ '^\s*{' - let lnum = s:Get_prev_line(lnum) - let line = SanitizeRLine(getline(lnum)) - endif - let pb = s:Get_paren_balance(line, '(', ')') - let post_block = 1 + let bb = s:Get_paren_balance(line, '[', ']') + + if pb > 0 + if &filetype == "rhelp" + let ind = s:Get_last_paren_idx(line, '(', ')', pb) + else + let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb) + endif + return ind endif - let post_fun = 0 - if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$' - let post_fun = 1 - while pb < 0 && lnum > 0 - let lnum -= 1 - let linepiece = SanitizeRLine(getline(lnum)) - let pb += s:Get_paren_balance(linepiece, "(", ")") - let line = linepiece . line + if pb < 0 && line =~ '.*[,&|\-\*+<>]$' + let lnum = s:Get_prev_line(lnum) + while pb < 1 && lnum > 0 + let line = SanitizeRLine(getline(lnum)) + let line = substitute(line, '\t', s:curtabstop, "g") + let ind = strlen(line) + while ind > 0 + if line[ind] == ')' + let pb -= 1 + else + if line[ind] == '(' + let pb += 1 + endif + endif + if pb == 1 + return ind + 1 + endif + let ind -= 1 endwhile - if line =~ '{$' && post_block == 0 - return indent(lnum) + &sw - endif + let lnum -= 1 + endwhile + return 0 + endif - " Now we can do some tests again - if cline =~ '^\s*{' - return indent(lnum) - endif - if post_block == 0 - let newl = SanitizeRLine(line) - if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$' - return indent(lnum) + &sw - endif - endif + if bb > 0 + let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb) + return ind endif + endif - if cline =~ '^\s*else' - if line =~ '<-\s*if\s*()' - return indent(lnum) + &sw - else - if line =~ '\<if\s*()' - return indent(lnum) - else - return indent(lnum) - &sw - endif - endif + let post_block = 0 + if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0 + let lnum = s:Get_matching_brace(lnum, '{', '}', 0) + let line = SanitizeRLine(getline(lnum)) + if lnum > 0 && line =~ '^\s*{' + let lnum = s:Get_prev_line(lnum) + let line = SanitizeRLine(getline(lnum)) + endif + let pb = s:Get_paren_balance(line, '(', ')') + let post_block = 1 + endif + + " Indent after operator pattern + let olnum = s:Get_prev_line(lnum) + let oline = getline(olnum) + if olnum > 0 + if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + return indent(lnum) + else + return indent(lnum) + shiftwidth() + endif + else + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + return indent(lnum) - shiftwidth() + endif + endif + endif + + let post_fun = 0 + if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$' + let post_fun = 1 + while pb < 0 && lnum > 0 + let lnum -= 1 + let linepiece = SanitizeRLine(getline(lnum)) + let pb += s:Get_paren_balance(linepiece, "(", ")") + let line = linepiece . line + endwhile + if line =~ '{$' && post_block == 0 + return indent(lnum) + shiftwidth() endif - if bb < 0 && line =~ '.*]' - while bb < 0 && lnum > 0 - let lnum -= 1 - let linepiece = SanitizeRLine(getline(lnum)) - let bb += s:Get_paren_balance(linepiece, "[", "]") - let line = linepiece . line - endwhile - let line = s:RDelete_parens(line) + " Now we can do some tests again + if cline =~ '^\s*{' + return indent(lnum) + endif + if post_block == 0 + let newl = SanitizeRLine(line) + if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$' + return indent(lnum) + shiftwidth() + endif endif + endif - let plnum = s:Get_prev_line(lnum) - let ppost_else = 0 - if plnum > 0 + if cline =~ '^\s*else' + if line =~ '<-\s*if\s*()' + return indent(lnum) + shiftwidth() + else + if line =~ '\<if\s*()' + return indent(lnum) + else + return indent(lnum) - shiftwidth() + endif + endif + endif + + let bb = s:Get_paren_balance(line, '[', ']') + if bb < 0 && line =~ '.*]' + while bb < 0 && lnum > 0 + let lnum -= 1 + let linepiece = SanitizeRLine(getline(lnum)) + let bb += s:Get_paren_balance(linepiece, "[", "]") + let line = linepiece . line + endwhile + let line = s:RDelete_parens(line) + endif + + let plnum = s:Get_prev_line(lnum) + let ppost_else = 0 + if plnum > 0 + let pline = SanitizeRLine(getline(plnum)) + let ppost_block = 0 + if pline =~ '}$' + let ppost_block = 1 + let plnum = s:Get_matching_brace(plnum, '{', '}', 0) + let pline = SanitizeRLine(getline(plnum)) + if pline =~ '^\s*{$' && plnum > 0 + let plnum = s:Get_prev_line(plnum) let pline = SanitizeRLine(getline(plnum)) - let ppost_block = 0 - if pline =~ '}$' - let ppost_block = 1 - let plnum = s:Get_matching_brace(plnum, '{', '}', 0) - let pline = SanitizeRLine(getline(plnum)) - if pline =~ '^\s*{$' && plnum > 0 - let plnum = s:Get_prev_line(plnum) - let pline = SanitizeRLine(getline(plnum)) - endif - endif + endif + endif - if pline =~ 'else$' - let ppost_else = 1 - let plnum = s:Get_matching_if(plnum, 0) - let pline = SanitizeRLine(getline(plnum)) - endif + if pline =~ 'else$' + let ppost_else = 1 + let plnum = s:Get_matching_if(plnum, 0) + let pline = SanitizeRLine(getline(plnum)) + endif - if pline =~ '^\s*else\s*if\s*(' - let pplnum = s:Get_prev_line(plnum) - let ppline = SanitizeRLine(getline(pplnum)) - while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$' - let plnum = pplnum - let pline = ppline - let pplnum = s:Get_prev_line(plnum) - let ppline = SanitizeRLine(getline(pplnum)) - endwhile - while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\<else$' || ppline =~ '<-$' - let plnum = pplnum - let pline = ppline - let pplnum = s:Get_prev_line(plnum) - let ppline = SanitizeRLine(getline(pplnum)) - endwhile - endif + if pline =~ '^\s*else\s*if\s*(' + let pplnum = s:Get_prev_line(plnum) + let ppline = SanitizeRLine(getline(pplnum)) + while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$' + let plnum = pplnum + let pline = ppline + let pplnum = s:Get_prev_line(plnum) + let ppline = SanitizeRLine(getline(pplnum)) + endwhile + while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\<else$' || ppline =~ '<-$' + let plnum = pplnum + let pline = ppline + let pplnum = s:Get_prev_line(plnum) + let ppline = SanitizeRLine(getline(pplnum)) + endwhile + endif - let ppb = s:Get_paren_balance(pline, '(', ')') - if ppb < 0 && (pline =~ ')\s*{$' || pline =~ ')$') - while ppb < 0 && plnum > 0 - let plnum -= 1 - let linepiece = SanitizeRLine(getline(plnum)) - let ppb += s:Get_paren_balance(linepiece, "(", ")") - let pline = linepiece . pline - endwhile - let pline = s:RDelete_parens(pline) - endif + let ppb = s:Get_paren_balance(pline, '(', ')') + if ppb < 0 && (pline =~ ')\s*{$' || pline =~ ')$') + while ppb < 0 && plnum > 0 + let plnum -= 1 + let linepiece = SanitizeRLine(getline(plnum)) + let ppb += s:Get_paren_balance(linepiece, "(", ")") + let pline = linepiece . pline + endwhile + let pline = s:RDelete_parens(pline) endif + endif - let ind = indent(lnum) - let pind = indent(plnum) + let ind = indent(lnum) - if g:r_indent_align_args == 0 && pb != 0 - let ind += pb * &sw - return ind - endif + if g:r_indent_align_args == 0 && pb != 0 + let ind += pb * shiftwidth() + return ind + endif - if g:r_indent_align_args == 0 && bb != 0 - let ind += bb * &sw - return ind - endif + if g:r_indent_align_args == 0 && bb != 0 + let ind += bb * shiftwidth() + return ind + endif - if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) - return ind - endif + if plnum > 0 + let pind = indent(plnum) + else + let pind = 0 + endif + + if ind == pind || (ind == (pind + shiftwidth()) && pline =~ '{$' && ppost_else == 0) + return ind + endif + + let pline = getline(plnum) + let pbb = s:Get_paren_balance(pline, '[', ']') + while pind < ind && plnum > 0 && ppb == 0 && pbb == 0 + let ind = pind + let plnum = s:Get_prev_line(plnum) let pline = getline(plnum) + let ppb = s:Get_paren_balance(pline, '(', ')') let pbb = s:Get_paren_balance(pline, '[', ']') - - while pind < ind && plnum > 0 && ppb == 0 && pbb == 0 - let ind = pind - let plnum = s:Get_prev_line(plnum) - let pline = getline(plnum) - let ppb = s:Get_paren_balance(pline, '(', ')') - let pbb = s:Get_paren_balance(pline, '[', ']') - while pline =~ '^\s*else' - let plnum = s:Get_matching_if(plnum, 1) - let pline = getline(plnum) - let ppb = s:Get_paren_balance(pline, '(', ')') - let pbb = s:Get_paren_balance(pline, '[', ']') - endwhile - let pind = indent(plnum) - if ind == (pind + &sw) && pline =~ '{$' - return ind - endif + while pline =~ '^\s*else' + let plnum = s:Get_matching_if(plnum, 1) + let pline = getline(plnum) + let ppb = s:Get_paren_balance(pline, '(', ')') + let pbb = s:Get_paren_balance(pline, '[', ']') endwhile + let pind = indent(plnum) + if ind == (pind + shiftwidth()) && pline =~ '{$' + return ind + endif + endwhile - return ind + return ind endfunction -" vim: sw=4 +" vim: sw=2 diff --git a/runtime/indent/readline.vim b/runtime/indent/readline.vim index 6ac2185bdc..e202ddfd89 100644 --- a/runtime/indent/readline.vim +++ b/runtime/indent/readline.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: readline configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: readline configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -25,11 +25,11 @@ function GetReadlineIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*$\(if\|else\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index 8cc5fdae3b..cf69ae3392 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:34PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. @@ -12,22 +13,18 @@ runtime indent/r.vim let s:RIndent = function(substitute(&indentexpr, "()", "", "")) let b:did_indent = 1 -setlocal indentkeys=0{,0},:,!^F,o,O,e -setlocal indentexpr=GetRHelpIndent() - -" Only define the function once. -if exists("*GetRHelpIndent") - finish -endif - setlocal noautoindent setlocal nocindent setlocal nosmartindent setlocal nolisp - setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetCorrectRHelpIndent() +" Only define the functions once. +if exists("*GetRHelpIndent") + finish +endif + function s:SanitizeRHelpLine(line) let newline = substitute(a:line, '\\\\', "x", "g") let newline = substitute(newline, '\\{', "x", "g") @@ -85,7 +82,7 @@ function GetRHelpIndent() let closeb = strlen(line2) - strlen(line3) let bb = openb - closeb - let ind = indent(lnum) + (bb * &sw) + let ind = indent(lnum) + (bb * shiftwidth()) if line =~ '^\s*}\s*$' let ind = indent(lnum) diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 872790e7b1..88904405e8 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rmd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:33PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. @@ -33,10 +34,10 @@ function GetMdIndent() endfunction function GetRmdIndent() - if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$' + if getline(".") =~ '^[ \t]*```{r .*}$' || getline(".") =~ '^[ \t]*```$' return 0 endif - if search('^```{r', "bncW") > search('^```$', "bncW") + if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW") return s:RIndent() else return GetMdIndent() diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index e69542bd1a..8c11e85cb3 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rnoweb " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:28PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Fri Apr 15, 2016 10:58PM " Only load this indent file when no other was loaded. @@ -9,7 +10,17 @@ if exists("b:did_indent") finish endif runtime indent/tex.vim -let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) + +function! s:NoTeXIndent() + return indent(line(".")) +endfunction + +if &indentexpr == "" || &indentexpr == "GetRnowebIndent()" + let s:TeXIndent = function("s:NoTeXIndent") +else + let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) +endif + unlet b:did_indent runtime indent/r.vim let s:RIndent = function(substitute(&indentexpr, "()", "", "")) @@ -23,7 +34,8 @@ if exists("*GetRnowebIndent") endif function GetRnowebIndent() - if getline(".") =~ "^<<.*>>=$" + let curline = getline(".") + if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$' return 0 endif if search("^<<", "bncW") > search("^@", "bncW") diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim index 8bfa8344ce..f3ee53e7fb 100644 --- a/runtime/indent/rrst.vim +++ b/runtime/indent/rrst.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rrst " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:33PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim index 80d3308fd8..c1ef8c9957 100644 --- a/runtime/indent/rst.vim +++ b/runtime/indent/rst.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: reStructuredText Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Language: reStructuredText Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-08-03 if exists("b:did_indent") finish diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim index 095b3a43c6..a97f4828d6 100644 --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -13,12 +13,23 @@ if exists("b:did_indent") endif let b:did_indent = 1 +if !exists('g:ruby_indent_access_modifier_style') + " Possible values: "normal", "indent", "outdent" + let g:ruby_indent_access_modifier_style = 'normal' +endif + +if !exists('g:ruby_indent_block_style') + " Possible values: "expression", "do" + let g:ruby_indent_block_style = 'expression' +endif + setlocal nosmartindent " Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetRubyIndent(v:lnum) -setlocal indentkeys=0{,0},0),0],!^F,o,O,e +setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,. setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end +setlocal indentkeys+==private,=protected,=public " Only define the function once. if exists("*GetRubyIndent") @@ -34,7 +45,7 @@ set cpo&vim " Regex of syntax group names that are or delimit strings/symbols or are comments. let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' . \ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' . - \ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>' + \ '\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>' " Regex of syntax group names that are strings. let s:syng_string = @@ -49,9 +60,10 @@ let s:skip_expr = \ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'" " Regex used for words that, at the start of a line, add a level of indent. -let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' . - \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . - \ '\|rescue\):\@!\>' . +let s:ruby_indent_keywords = + \ '^\s*\zs\<\%(module\|class\|if\|for' . + \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' . + \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' @@ -64,7 +76,8 @@ let s:ruby_deindent_keywords = " TODO: the do here should be restricted somewhat (only at end of line)? let s:end_start_regex = \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . - \ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' . + \ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' . + \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>' " Regex that defines the middle-match for the 'end' keyword. @@ -79,19 +92,39 @@ let s:end_skip_expr = s:skip_expr . \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")' " Regex that defines continuation lines, not including (, {, or [. -let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +let s:non_bracket_continuation_regex = + \ '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. -" TODO: this needs to deal with if ...: and so on let s:continuation_regex = - \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' + \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$' + +" Regex that defines continuable keywords +let s:continuable_regex = + \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|unless\):\@!\>' " Regex that defines bracket continuations let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$' +" Regex that defines dot continuations +let s:dot_continuation_regex = '%\@<!\.\s*\%(#.*\)\=$' + +" Regex that defines backslash continuations +let s:backslash_continuation_regex = '%\@<!\\\s*$' + +" Regex that defines end of bracket continuation followed by another continuation +let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex + " Regex that defines the first part of a splat pattern let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$' +" Regex that describes all indent access modifiers +let s:access_modifier_regex = '\C^\s*\%(public\|protected\|private\)\s*\%(#.*\)\=$' + +" Regex that describes the indent access modifiers (excludes public) +let s:indent_access_modifier_regex = '\C^\s*\%(protected\|private\)\s*\%(#.*\)\=$' + " Regex that defines blocks. " " Note that there's a slight problem with this regex and s:continuation_regex. @@ -102,10 +135,13 @@ let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$' " The reason is that the pipe matches a hanging "|" operator. " let s:block_regex = - \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$' + \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|[^|]*|\)\=\s*\%(#.*\)\=$' let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex +" Regex that describes a leading operator (only a method call's dot for now) +let s:leading_operator_regex = '^\s*[.]' + " 2. Auxiliary Functions {{{1 " ====================== @@ -165,7 +201,21 @@ function s:GetMSL(lnum) " Otherwise, terminate search as we have found our MSL already. let line = getline(lnum) - if s:Match(lnum, s:splat_regex) + if !s:Match(msl, s:backslash_continuation_regex) && + \ s:Match(lnum, s:backslash_continuation_regex) + " If the current line doesn't end in a backslash, but the previous one + " does, look for that line's msl + " + " Example: + " foo = "bar" \ + " "baz" + " + let msl = lnum + elseif s:Match(msl, s:leading_operator_regex) + " If the current line starts with a leading operator, keep its indent + " and keep looking for an MSL. + let msl = lnum + elseif s:Match(lnum, s:splat_regex) " If the above line looks like the "*" of a splat, use the current one's " indentation. " @@ -175,7 +225,7 @@ function s:GetMSL(lnum) " something " return msl - elseif s:Match(line, s:non_bracket_continuation_regex) && + elseif s:Match(lnum, s:non_bracket_continuation_regex) && \ s:Match(msl, s:non_bracket_continuation_regex) " If the current line is a non-bracket continuation and so is the " previous one, keep its indent and continue looking for an MSL. @@ -186,6 +236,18 @@ function s:GetMSL(lnum) " three " let msl = lnum + elseif s:Match(lnum, s:dot_continuation_regex) && + \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex)) + " If the current line is a bracket continuation or a block-starter, but + " the previous is a dot, keep going to see if the previous line is the + " start of another continuation. + " + " Example: + " parent. + " method_call { + " three + " + let msl = lnum elseif s:Match(lnum, s:non_bracket_continuation_regex) && \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex)) " If the current line is a bracket continuation or a block-starter, but @@ -299,18 +361,39 @@ function s:ExtraBrackets(lnum) endfunction function s:Match(lnum, regex) - let col = match(getline(a:lnum), '\C'.a:regex) + 1 - return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 + let line = getline(a:lnum) + let offset = match(line, '\C'.a:regex) + let col = offset + 1 + + while offset > -1 && s:IsInStringOrComment(a:lnum, col) + let offset = match(line, '\C'.a:regex, offset + 1) + let col = offset + 1 + endwhile + + if offset > -1 + return col + else + return 0 + endif endfunction -function s:MatchLast(lnum, regex) - let line = getline(a:lnum) - let col = match(line, '.*\zs' . a:regex) - while col != -1 && s:IsInStringOrComment(a:lnum, col) - let line = strpart(line, 0, col) - let col = match(line, '.*' . a:regex) +" Locates the containing class/module's definition line, ignoring nested classes +" along the way. +" +function! s:FindContainingClass() + let saved_position = getpos('.') + + while searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + if expand('<cword>') =~# '\<class\|module\>' + let found_lnum = line('.') + call setpos('.', saved_position) + return found_lnum + endif endwhile - return col + 1 + + call setpos('.', saved_position) + return 0 endfunction " 3. GetRubyIndent Function {{{1 @@ -320,6 +403,13 @@ function GetRubyIndent(...) " 3.1. Setup {{{2 " ---------- + " The value of a single shift-width + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif + " For the current line, use the first argument if given, else v:lnum let clnum = a:0 ? a:1 : v:lnum @@ -333,6 +423,24 @@ function GetRubyIndent(...) let line = getline(clnum) let ind = -1 + " If this line is an access modifier keyword, align according to the closest + " class declaration. + if g:ruby_indent_access_modifier_style == 'indent' + if s:Match(clnum, s:access_modifier_regex) + let class_line = s:FindContainingClass() + if class_line > 0 + return indent(class_line) + sw + endif + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + if s:Match(clnum, s:access_modifier_regex) + let class_line = s:FindContainingClass() + if class_line > 0 + return indent(class_line) + endif + endif + endif + " If we got a closing bracket on an empty line, find its match and indent " according to it. For parentheses we indent to its column - 1, for the " others we indent to the containing line's MSL's level. Return -1 if fail. @@ -343,7 +451,9 @@ function GetRubyIndent(...) if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 if line[col-1]==')' && col('.') != col('$') - 1 let ind = virtcol('.') - 1 - else + elseif g:ruby_indent_block_style == 'do' + let ind = indent(line('.')) + else " g:ruby_indent_block_style == 'expression' let ind = indent(s:GetMSL(line('.'))) endif endif @@ -366,10 +476,17 @@ function GetRubyIndent(...) if strpart(line, 0, col('.') - 1) =~ '=\s*$' && \ strpart(line, col('.') - 1, 2) !~ 'do' + " assignment to case/begin/etc, on the same line, hanging indent let ind = virtcol('.') - 1 + elseif g:ruby_indent_block_style == 'do' + " align to line of the "do", not to the MSL + let ind = indent(line('.')) elseif getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the MSL, align to the starting line, + " not to the MSL let ind = indent(line('.')) else + " align to the MSL let ind = indent(msl) endif endif @@ -389,6 +506,11 @@ function GetRubyIndent(...) return 0 endif + " If the current line starts with a leading operator, add a level of indent. + if s:Match(clnum, s:leading_operator_regex) + return indent(s:GetMSL(clnum)) + sw + endif + " 3.3. Work on the previous line. {{{2 " ------------------------------- @@ -409,14 +531,50 @@ function GetRubyIndent(...) let line = getline(lnum) let ind = indent(lnum) + if g:ruby_indent_access_modifier_style == 'indent' + " If the previous line was a private/protected keyword, add a + " level of indent. + if s:Match(lnum, s:indent_access_modifier_regex) + return indent(lnum) + sw + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + " If the previous line was a private/protected/public keyword, add + " a level of indent, since the keyword has been out-dented. + if s:Match(lnum, s:access_modifier_regex) + return indent(lnum) + sw + endif + endif + + if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) + return indent(s:GetMSL(lnum)) + sw + sw + endif + " If the previous line ended with a block opening, add a level of indent. if s:Match(lnum, s:block_regex) - return indent(s:GetMSL(lnum)) + &sw + let msl = s:GetMSL(lnum) + + if g:ruby_indent_block_style == 'do' + " don't align to the msl, align to the "do" + let ind = indent(lnum) + sw + elseif getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the msl, align to the starting line, + " not to the msl + let ind = indent(lnum) + sw + else + let ind = indent(msl) + sw + endif + return ind + endif + + " If the previous line started with a leading operator, use its MSL's level + " of indent + if s:Match(lnum, s:leading_operator_regex) + return indent(s:GetMSL(lnum)) endif " If the previous line ended with the "*" of a splat, add a level of indent if line =~ s:splat_regex - return indent(lnum) + &sw + return indent(lnum) + sw endif " If the previous line contained unclosed opening brackets and we are still @@ -431,22 +589,22 @@ function GetRubyIndent(...) if opening.pos != -1 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') - return ind + &sw + return ind + sw else return virtcol('.') endif else let nonspace = matchend(line, '\S', opening.pos + 1) - 1 - return nonspace > 0 ? nonspace : ind + &sw + return nonspace > 0 ? nonspace : ind + sw endif elseif closing.pos != -1 call cursor(lnum, closing.pos + 1) normal! % if s:Match(line('.'), s:ruby_indent_keywords) - return indent('.') + &sw + return indent('.') + sw else - return indent('.') + return indent(s:GetMSL(line('.'))) endif else call cursor(clnum, vcol) @@ -473,7 +631,7 @@ function GetRubyIndent(...) let col = s:Match(lnum, s:ruby_indent_keywords) if col > 0 call cursor(lnum, col) - let ind = virtcol('.') - 1 + &sw + let ind = virtcol('.') - 1 + sw " TODO: make this better (we need to count them) (or, if a searchpair " fails, we know that something is lacking an end and thus we indent a " level @@ -490,10 +648,14 @@ function GetRubyIndent(...) let p_lnum = lnum let lnum = s:GetMSL(lnum) - " If the previous line wasn't a MSL and is continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. + " If the previous line wasn't a MSL. if p_lnum != lnum - if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) + " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. + if s:Match(p_lnum, s:bracket_switch_continuation_regex) + return ind - 1 + " If previous line is a continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + elseif s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) return ind endif endif @@ -506,9 +668,9 @@ function GetRubyIndent(...) " TODO: this does not take into account contrived things such as " module Foo; class Bar; end if s:Match(lnum, s:ruby_indent_keywords) - let ind = msl_ind + &sw + let ind = msl_ind + sw if s:Match(lnum, s:end_end_regex) - let ind = ind - &sw + let ind = ind - sw endif return ind endif @@ -517,7 +679,7 @@ function GetRubyIndent(...) " closing bracket, indent one extra level. if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') if lnum == p_lnum - let ind = msl_ind + &sw + let ind = msl_ind + sw else let ind = msl_ind endif diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim new file mode 100644 index 0000000000..a3051f0b06 --- /dev/null +++ b/runtime/indent/rust.vim @@ -0,0 +1,213 @@ +" Vim indent file +" Language: Rust +" Author: Chris Morgan <me@chrismorgan.info> +" Last Change: 2017 Mar 21 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal cindent +setlocal cinoptions=L0,(0,Ws,J1,j1 +setlocal cinkeys=0{,0},!^F,o,O,0[,0] +" Don't think cinwords will actually do anything at all... never mind +setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern + +" Some preliminary settings +setlocal nolisp " Make sure lisp indenting doesn't supersede us +setlocal autoindent " indentexpr isn't much help otherwise +" Also do indentkeys, otherwise # gets shoved to column 0 :-/ +setlocal indentkeys=0{,0},!^F,o,O,0[,0] + +setlocal indentexpr=GetRustIndent(v:lnum) + +" Only define the function once. +if exists("*GetRustIndent") + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +" Come here when loading the script the first time. + +function! s:get_line_trimmed(lnum) + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + " NOTE: this is not accurate; /* */ or a line continuation could trick it + let line = getline(a:lnum) + let line_len = strlen(line) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo' + let min = 1 + let max = line_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo' + let max = col + else + let min = col + 1 + endif + endwhile + let line = strpart(line, 0, min - 1) + endif + return substitute(line, "\s*$", "", "") + else + " Sorry, this is not complete, nor fully correct (e.g. string "//"). + " Such is life. + return substitute(line, "\s*//.*$", "", "") + endif +endfunction + +function! s:is_string_comment(lnum, col) + if has('syntax_items') + for id in synstack(a:lnum, a:col) + let synname = synIDattr(id, "name") + if synname == "rustString" || synname =~ "^rustComment" + return 1 + endif + endfor + else + " without syntax, let's not even try + return 0 + endif +endfunction + +function GetRustIndent(lnum) + + " Starting assumption: cindent (called at the end) will do it right + " normally. We just want to fix up a few cases. + + let line = getline(a:lnum) + + if has('syntax_items') + let synname = synIDattr(synID(a:lnum, 1, 1), "name") + if synname == "rustString" + " If the start of the line is in a string, don't change the indent + return -1 + elseif synname =~ '\(Comment\|Todo\)' + \ && line !~ '^\s*/\*' " not /* opening line + if synname =~ "CommentML" " multi-line + if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*' + " This is (hopefully) the line after a /*, and it has no + " leader, so the correct indentation is that of the + " previous line. + return GetRustIndent(a:lnum - 1) + endif + endif + " If it's in a comment, let cindent take care of it now. This is + " for cases like "/*" where the next line should start " * ", not + " "* " as the code below would otherwise cause for module scope + " Fun fact: " /*\n*\n*/" takes two calls to get right! + return cindent(a:lnum) + endif + endif + + " cindent gets second and subsequent match patterns/struct members wrong, + " as it treats the comma as indicating an unfinished statement:: + " + " match a { + " b => c, + " d => e, + " f => g, + " }; + + " Search backwards for the previous non-empty line. + let prevlinenum = prevnonblank(a:lnum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + while prevlinenum > 1 && prevline !~ '[^[:blank:]]' + let prevlinenum = prevnonblank(prevlinenum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + endwhile + + " Handle where clauses nicely: subsequent values should line up nicely. + if prevline[len(prevline) - 1] == "," + \ && prevline =~# '^\s*where\s' + return indent(prevlinenum) + 6 + endif + + if prevline[len(prevline) - 1] == "," + \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' + \ && prevline !~ '^\s*fn\s' + \ && prevline !~ '([^()]\+,$' + \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>' + " Oh ho! The previous line ended in a comma! I bet cindent will try to + " take this too far... For now, let's normally use the previous line's + " indent. + + " One case where this doesn't work out is where *this* line contains + " square or curly brackets; then we normally *do* want to be indenting + " further. + " + " Another case where we don't want to is one like a function + " definition with arguments spread over multiple lines: + " + " fn foo(baz: Baz, + " baz: Baz) // <-- cindent gets this right by itself + " + " Another case is similar to the previous, except calling a function + " instead of defining it, or any conditional expression that leaves + " an open paren: + " + " foo(baz, + " baz); + " + " if baz && (foo || + " bar) { + " + " Another case is when the current line is a new match arm. + " + " There are probably other cases where we don't want to do this as + " well. Add them as needed. + return indent(prevlinenum) + endif + + if !has("patch-7.4.355") + " cindent before 7.4.355 doesn't do the module scope well at all; e.g.:: + " + " static FOO : &'static [bool] = [ + " true, + " false, + " false, + " true, + " ]; + " + " uh oh, next statement is indented further! + + " Note that this does *not* apply the line continuation pattern properly; + " that's too hard to do correctly for my liking at present, so I'll just + " start with these two main cases (square brackets and not returning to + " column zero) + + call cursor(a:lnum, 1) + if searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + if searchpair('\[', '', '\]', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + " Global scope, should be zero + return 0 + else + " At the module scope, inside square brackets only + "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum + if line =~ "^\\s*]" + " It's the closing line, dedent it + return 0 + else + return &shiftwidth + endif + endif + endif + endif + + " Fall back on cindent, which does it mostly right + return cindent(a:lnum) +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/indent/sas.vim b/runtime/indent/sas.vim new file mode 100644 index 0000000000..d591b2796e --- /dev/null +++ b/runtime/indent/sas.vim @@ -0,0 +1,138 @@ +" Vim indent file +" Language: SAS +" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com> +" Version: 3.0.1 +" Last Change: Mar 13, 2017 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetSASIndent() +setlocal indentkeys+=;,=~data,=~proc,=~macro + +if exists("*GetSASIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Regex that captures the start of a data/proc section +let s:section_str = '\v%(^|;)\s*%(data|proc)>' +" Regex that captures the end of a run-processing section +let s:section_run = '\v%(^|;)\s*run\s*;' +" Regex that captures the end of a data/proc section +let s:section_end = '\v%(^|;)\s*%(quit|enddata)\s*;' + +" Regex that captures the start of a control block (anything inside a section) +let s:block_str = '\v<%(do>%([^;]+<%(to|over)>[^;]+)=|%(define|layout|method|select)>[^;]+|begingraph)\s*;' +" Regex that captures the end of a control block (anything inside a section) +let s:block_end = '\v<%(end|endlayout|endgraph)\s*;' + +" Regex that captures the start of a macro +let s:macro_str = '\v%(^|;)\s*\%macro>' +" Regex that captures the end of a macro +let s:macro_end = '\v%(^|;)\s*\%mend\s*;' + +" Regex that defines the end of the program +let s:program_end = '\v%(^|;)\s*endsas\s*;' + +" List of procs supporting run-processing +let s:run_processing_procs = [ + \ 'catalog', 'chart', 'datasets', 'document', 'ds2', 'plot', 'sql', + \ 'gareabar', 'gbarline', 'gchart', 'gkpi', 'gmap', 'gplot', 'gradar', 'greplay', 'gslide', 'gtile', + \ 'anova', 'arima', 'catmod', 'factex', 'glm', 'model', 'optex', 'plan', 'reg', + \ 'iml', + \ ] + +" Find the line number of previous keyword defined by the regex +function! s:PrevMatch(lnum, regex) + let prev_lnum = prevnonblank(a:lnum - 1) + while prev_lnum > 0 + let prev_line = getline(prev_lnum) + if prev_line =~ a:regex + break + else + let prev_lnum = prevnonblank(prev_lnum - 1) + endif + endwhile + return prev_lnum +endfunction + +" Main function +function! GetSASIndent() + let prev_lnum = prevnonblank(v:lnum - 1) + if prev_lnum ==# 0 + " Leave the indentation of the first line unchanged + return indent(1) + else + let prev_line = getline(prev_lnum) + " Previous non-blank line contains the start of a macro/section/block + " while not the end of a macro/section/block (at the same line) + if (prev_line =~ s:section_str && prev_line !~ s:section_run && prev_line !~ s:section_end) || + \ (prev_line =~ s:block_str && prev_line !~ s:block_end) || + \ (prev_line =~ s:macro_str && prev_line !~ s:macro_end) + let ind = indent(prev_lnum) + &sts + elseif prev_line =~ s:section_run && prev_line !~ s:section_end + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + " Check if the section supports run-processing + if prev_section_end_lnum < prev_section_str_lnum && + \ getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let ind = indent(prev_lnum) + &sts + else + let ind = indent(prev_lnum) + endif + else + let ind = indent(prev_lnum) + endif + endif + " Re-adjustments based on the inputs of the current line + let curr_line = getline(v:lnum) + if curr_line =~ s:program_end + " End of the program + " Same indentation as the first non-blank line + return indent(nextnonblank(1)) + elseif curr_line =~ s:macro_end + " Current line is the end of a macro + " Match the indentation of the start of the macro + return indent(s:PrevMatch(v:lnum, s:macro_str)) + elseif curr_line =~ s:block_end && curr_line !~ s:block_str + " Re-adjust if current line is the end of a block + " while not the beginning of a block (at the same line) + " Returning the indent of previous block start directly + " would not work due to nesting + let ind = ind - &sts + elseif curr_line =~ s:section_str || curr_line =~ s:section_run || curr_line =~ s:section_end + " Re-adjust if current line is the start/end of a section + " since the end of a section could be inexplicit + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + " Check if the previous section supports run-processing + if getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + else + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:section_run), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + endif + if prev_section_end_lnum < prev_section_str_lnum + let ind = ind - &sts + endif + endif + return ind +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim index b6e2e66e8a..d87b371fdd 100644 --- a/runtime/indent/sass.vim +++ b/runtime/indent/sass.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:did_indent") finish @@ -29,9 +29,7 @@ function! GetSassIndent() let indent = indent(lnum) let cindent = indent(v:lnum) if line !~ s:property && line !~ s:extend && cline =~ s:property - return indent + &sw - "elseif line =~ s:property && cline !~ s:property - "return indent - &sw + return indent + (exists('*shiftwidth') ? shiftwidth() : &sw) else return -1 endif diff --git a/runtime/indent/scala.vim b/runtime/indent/scala.vim new file mode 100644 index 0000000000..6fd8ca9d81 --- /dev/null +++ b/runtime/indent/scala.vim @@ -0,0 +1,609 @@ +" Vim indent file +" Language: Scala (http://scala-lang.org/) +" Original Author: Stefan Matthias Aust +" Modifications By: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" Last Change: 2016 Aug 26 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent +setlocal indentexpr=GetScalaIndent() +setlocal indentkeys=0{,0},0),!^F,<>>,o,O,e,=case,<CR> + +if exists("*GetScalaIndent") + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +let s:defMatcher = '\%(\%(private\|protected\)\%(\[[^\]]*\]\)\?\s\+\|abstract\s\+\|override\s\+\)*\<def\>' +let s:funcNameMatcher = '\w\+' +let s:typeSpecMatcher = '\%(\s*\[\_[^\]]*\]\)' +let s:defArgMatcher = '\%((\_.\{-})\)' +let s:returnTypeMatcher = '\%(:\s*\w\+' . s:typeSpecMatcher . '\?\)' +let g:fullDefMatcher = '^\s*' . s:defMatcher . '\s\+' . s:funcNameMatcher . '\s*' . s:typeSpecMatcher . '\?\s*' . s:defArgMatcher . '\?\s*' . s:returnTypeMatcher . '\?\s*[={]' + +function! scala#ConditionalConfirm(msg) + if 0 + call confirm(a:msg) + endif +endfunction + +function! scala#GetLine(lnum) + let line = substitute(getline(a:lnum), '//.*$', '', '') + let line = substitute(line, '"\(.\|\\"\)\{-}"', '""', 'g') + return line +endfunction + +function! scala#CountBrackets(line, openBracket, closedBracket) + let line = substitute(a:line, '"\(.\|\\"\)\{-}"', '', 'g') + let open = substitute(line, '[^' . a:openBracket . ']', '', 'g') + let close = substitute(line, '[^' . a:closedBracket . ']', '', 'g') + return strlen(open) - strlen(close) +endfunction + +function! scala#CountParens(line) + return scala#CountBrackets(a:line, '(', ')') +endfunction + +function! scala#CountCurlies(line) + return scala#CountBrackets(a:line, '{', '}') +endfunction + +function! scala#LineEndsInIncomplete(line) + if a:line =~ '[.,]\s*$' + return 1 + else + return 0 + endif +endfunction + +function! scala#LineIsAClosingXML(line) + if a:line =~ '^\s*</\w' + return 1 + else + return 0 + endif +endfunction + +function! scala#LineCompletesXML(lnum, line) + let savedpos = getpos('.') + call setpos('.', [savedpos[0], a:lnum, 0, savedpos[3]]) + let tag = substitute(a:line, '^.*</\([^>]*\)>.*$', '\1', '') + let [lineNum, colnum] = searchpairpos('<' . tag . '>', '', '</' . tag . '>', 'Wbn') + call setpos('.', savedpos) + let pline = scala#GetLine(prevnonblank(lineNum - 1)) + if pline =~ '=\s*$' + return 1 + else + return 0 + endif +endfunction + +function! scala#IsParentCase() + let savedpos = getpos('.') + call setpos('.', [savedpos[0], savedpos[1], 0, savedpos[3]]) + let [l, c] = searchpos('^\s*\%(' . s:defMatcher . '\|\%(\<case\>\)\)', 'bnW') + let retvalue = -1 + if l != 0 && search('\%' . l . 'l\s*\<case\>', 'bnW') + let retvalue = l + endif + call setpos('.', savedpos) + return retvalue +endfunction + +function! scala#CurlyMatcher() + let matchline = scala#GetLineThatMatchesBracket('{', '}') + if scala#CountParens(scala#GetLine(matchline)) < 0 + let savedpos = getpos('.') + call setpos('.', [savedpos[0], matchline, 9999, savedpos[3]]) + call searchpos('{', 'Wbc') + call searchpos(')', 'Wb') + let [lnum, colnum] = searchpairpos('(', '', ')', 'Wbn') + call setpos('.', savedpos) + let line = scala#GetLine(lnum) + if line =~ '^\s*' . s:defMatcher + return lnum + else + return matchline + endif + else + return matchline + endif +endfunction + +function! scala#GetLineAndColumnThatMatchesCurly() + return scala#GetLineAndColumnThatMatchesBracket('{', '}') +endfunction + +function! scala#GetLineAndColumnThatMatchesParen() + return scala#GetLineAndColumnThatMatchesBracket('(', ')') +endfunction + +function! scala#GetLineAndColumnThatMatchesBracket(openBracket, closedBracket) + let savedpos = getpos('.') + let curline = scala#GetLine(line('.')) + if curline =~ a:closedBracket . '.*' . a:openBracket . '.*' . a:closedBracket + call setpos('.', [savedpos[0], savedpos[1], 0, savedpos[3]]) + call searchpos(a:closedBracket . '\ze[^' . a:closedBracket . a:openBracket . ']*' . a:openBracket, 'W') + else + call setpos('.', [savedpos[0], savedpos[1], 9999, savedpos[3]]) + call searchpos(a:closedBracket, 'Wbc') + endif + let [lnum, colnum] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbn') + call setpos('.', savedpos) + return [lnum, colnum] +endfunction + +function! scala#GetLineThatMatchesCurly() + return scala#GetLineThatMatchesBracket('{', '}') +endfunction + +function! scala#GetLineThatMatchesParen() + return scala#GetLineThatMatchesBracket('(', ')') +endfunction + +function! scala#GetLineThatMatchesBracket(openBracket, closedBracket) + let [lnum, colnum] = scala#GetLineAndColumnThatMatchesBracket(a:openBracket, a:closedBracket) + return lnum +endfunction + +function! scala#NumberOfBraceGroups(line) + let line = substitute(a:line, '[^()]', '', 'g') + if strlen(line) == 0 + return 0 + endif + let line = substitute(line, '^)*', '', 'g') + if strlen(line) == 0 + return 0 + endif + let line = substitute(line, '^(', '', 'g') + if strlen(line) == 0 + return 0 + endif + let c = 1 + let counter = 0 + let groupCount = 0 + while counter < strlen(line) + let char = strpart(line, counter, 1) + if char == '(' + let c = c + 1 + elseif char == ')' + let c = c - 1 + endif + if c == 0 + let groupCount = groupCount + 1 + endif + let counter = counter + 1 + endwhile + return groupCount +endfunction + +function! scala#MatchesIncompleteDefValr(line) + if a:line =~ '^\s*\%(' . s:defMatcher . '\|\<va[lr]\>\).*[=({]\s*$' + return 1 + else + return 0 + endif +endfunction + +function! scala#LineIsCompleteIf(line) + if scala#CountBrackets(a:line, '{', '}') == 0 && + \ scala#CountBrackets(a:line, '(', ')') == 0 && + \ a:line =~ '^\s*\<if\>\s*([^)]*)\s*\S.*$' + return 1 + else + return 0 + endif +endfunction + +function! scala#LineCompletesIfElse(lnum, line) + if a:line =~ '^\s*\%(\<if\>\|\%(}\s*\)\?\<else\>\)' + return 0 + endif + let result = search('^\%(\s*\<if\>\s*(.*).*\n\|\s*\<if\>\s*(.*)\s*\n.*\n\)\%(\s*\<else\>\s*\<if\>\s*(.*)\s*\n.*\n\)*\%(\s*\<else\>\s*\n\|\s*\<else\>[^{]*\n\)\?\%' . a:lnum . 'l', 'Wbn') + if result != 0 && scala#GetLine(prevnonblank(a:lnum - 1)) !~ '{\s*$' + return result + endif + return 0 +endfunction + +function! scala#GetPrevCodeLine(lnum) + " This needs to skip comment lines + return prevnonblank(a:lnum - 1) +endfunction + +function! scala#InvertBracketType(openBracket, closedBracket) + if a:openBracket == '(' + return [ '{', '}' ] + else + return [ '(', ')' ] + endif +endfunction + +function! scala#Testhelper(lnum, line, openBracket, closedBracket, iteration) + let bracketCount = scala#CountBrackets(a:line, a:openBracket, a:closedBracket) + " There are more '}' braces than '{' on this line so it may be completing the function definition + if bracketCount < 0 + let [matchedLNum, matchedColNum] = scala#GetLineAndColumnThatMatchesBracket(a:openBracket, a:closedBracket) + if matchedLNum == a:lnum + return -1 + endif + let matchedLine = scala#GetLine(matchedLNum) + if ! scala#MatchesIncompleteDefValr(matchedLine) + let bracketLine = substitute(substitute(matchedLine, '\%' . matchedColNum . 'c.*$', '', ''), '[^{}()]', '', 'g') + if bracketLine =~ '}$' + return scala#Testhelper(matchedLNum, matchedLine, '{', '}', a:iteration + 1) + elseif bracketLine =~ ')$' + return scala#Testhelper(matchedLNum, matchedLine, '(', ')', a:iteration + 1) + else + let prevCodeLNum = scala#GetPrevCodeLine(matchedLNum) + if scala#MatchesIncompleteDefValr(scala#GetLine(prevCodeLNum)) + return prevCodeLNum + else + return -1 + endif + endif + else + " return indent value instead + return matchedLNum + endif + " There's an equal number of '{' and '}' on this line so it may be a single line function definition + elseif bracketCount == 0 + if a:iteration == 0 + let otherBracketType = scala#InvertBracketType(a:openBracket, a:closedBracket) + return scala#Testhelper(a:lnum, a:line, otherBracketType[0], otherBracketType[1], a:iteration + 1) + else + let prevCodeLNum = scala#GetPrevCodeLine(a:lnum) + let prevCodeLine = scala#GetLine(prevCodeLNum) + if scala#MatchesIncompleteDefValr(prevCodeLine) && prevCodeLine !~ '{\s*$' + return prevCodeLNum + else + let possibleIfElse = scala#LineCompletesIfElse(a:lnum, a:line) + if possibleIfElse != 0 + let defValrLine = prevnonblank(possibleIfElse - 1) + let possibleDefValr = scala#GetLine(defValrLine) + if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$' + return possibleDefValr + else + return -1 + endif + else + return -1 + endif + endif + endif + else + return -1 + endif +endfunction + +function! scala#Test(lnum, line, openBracket, closedBracket) + return scala#Testhelper(a:lnum, a:line, a:openBracket, a:closedBracket, 0) +endfunction + +function! scala#LineCompletesDefValr(lnum, line) + let bracketCount = scala#CountBrackets(a:line, '{', '}') + if bracketCount < 0 + let matchedBracket = scala#GetLineThatMatchesBracket('{', '}') + if ! scala#MatchesIncompleteDefValr(scala#GetLine(matchedBracket)) + let possibleDefValr = scala#GetLine(prevnonblank(matchedBracket - 1)) + if matchedBracket != -1 && scala#MatchesIncompleteDefValr(possibleDefValr) + return 1 + else + return 0 + endif + else + return 0 + endif + elseif bracketCount == 0 + let bracketCount = scala#CountBrackets(a:line, '(', ')') + if bracketCount < 0 + let matchedBracket = scala#GetLineThatMatchesBracket('(', ')') + if ! scala#MatchesIncompleteDefValr(scala#GetLine(matchedBracket)) + let possibleDefValr = scala#GetLine(prevnonblank(matchedBracket - 1)) + if matchedBracket != -1 && scala#MatchesIncompleteDefValr(possibleDefValr) + return 1 + else + return 0 + endif + else + return 0 + endif + elseif bracketCount == 0 + let possibleDefValr = scala#GetLine(prevnonblank(a:lnum - 1)) + if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$' + return 1 + else + let possibleIfElse = scala#LineCompletesIfElse(a:lnum, a:line) + if possibleIfElse != 0 + let possibleDefValr = scala#GetLine(prevnonblank(possibleIfElse - 1)) + if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$' + return 2 + else + return 0 + endif + else + return 0 + endif + endif + else + return 0 + endif + endif +endfunction + +function! scala#SpecificLineCompletesBrackets(lnum, openBracket, closedBracket) + let savedpos = getpos('.') + call setpos('.', [savedpos[0], a:lnum, 9999, savedpos[3]]) + let retv = scala#LineCompletesBrackets(a:openBracket, a:closedBracket) + call setpos('.', savedpos) + + return retv +endfunction + +function! scala#LineCompletesBrackets(openBracket, closedBracket) + let savedpos = getpos('.') + let offline = 0 + while offline == 0 + let [lnum, colnum] = searchpos(a:closedBracket, 'Wb') + let [lnumA, colnumA] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbn') + if lnum != lnumA + let [lnumB, colnumB] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbnr') + let offline = 1 + endif + endwhile + call setpos('.', savedpos) + if lnumA == lnumB && colnumA == colnumB + return lnumA + else + return -1 + endif +endfunction + +function! GetScalaIndent() + " Find a non-blank line above the current line. + let prevlnum = prevnonblank(v:lnum - 1) + + " Hit the start of the file, use zero indent. + if prevlnum == 0 + return 0 + endif + + let ind = indent(prevlnum) + let originalIndentValue = ind + let prevline = scala#GetLine(prevlnum) + let curlnum = v:lnum + let curline = scala#GetLine(curlnum) + if get(g:, 'scala_scaladoc_indent', 0) + let star_indent = 2 + else + let star_indent = 1 + end + + if prevline =~ '^\s*/\*\*' + if prevline =~ '\*/\s*$' + return ind + else + return ind + star_indent + endif + endif + + if curline =~ '^\s*\*' + return cindent(curlnum) + endif + + " If this line starts with a { then make it indent the same as the previous line + if curline =~ '^\s*{' + call scala#ConditionalConfirm("1") + " Unless, of course, the previous one is a { as well + if prevline !~ '^\s*{' + call scala#ConditionalConfirm("2") + return indent(prevlnum) + endif + endif + + " '.' continuations + if curline =~ '^\s*\.' + if prevline =~ '^\s*\.' + return ind + else + return ind + shiftwidth() + endif + endif + + " Indent html literals + if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$' + call scala#ConditionalConfirm("3") + return ind + shiftwidth() + endif + + " assumes curly braces around try-block + if curline =~ '^\s*}\s*\<catch\>' + return ind - shiftwidth() + elseif curline =~ '^\s*\<catch\>' + return ind + endif + + " Add a shiftwidth()' after lines that start a block + " If 'if', 'for' or 'while' end with ), this is a one-line block + " If 'val', 'var', 'def' end with =, this is a one-line block + if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1) + \ || prevline =~ '^\s*' . s:defMatcher . '.*=\s*$' + \ || prevline =~ '^\s*\<va[lr]\>.*[=]\s*$' + \ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$' + \ || prevline =~ '=\s*$' + call scala#ConditionalConfirm("4") + let ind = ind + shiftwidth() + elseif prevline =~ '^\s*\<\%(}\?\s*else\s\+\)\?if\>' && curline =~ '^\s*}\?\s*\<else\>' + return ind + endif + + let lineCompletedBrackets = 0 + let bracketCount = scala#CountBrackets(prevline, '{', '}') + if bracketCount > 0 || prevline =~ '.*{\s*$' + call scala#ConditionalConfirm("5b") + let ind = ind + shiftwidth() + elseif bracketCount < 0 + call scala#ConditionalConfirm("6b") + " if the closing brace actually completes the braces entirely, then we + " have to indent to line that started the whole thing + let completeLine = scala#LineCompletesBrackets('{', '}') + if completeLine != -1 + call scala#ConditionalConfirm("8b") + let prevCompleteLine = scala#GetLine(prevnonblank(completeLine - 1)) + " However, what actually started this part looks like it was a function + " definition, so we need to indent to that line instead. This is + " actually pretty weak at the moment. + if prevCompleteLine =~ '=\s*$' + call scala#ConditionalConfirm("9b") + let ind = indent(prevnonblank(completeLine - 1)) + else + call scala#ConditionalConfirm("10b") + let ind = indent(completeLine) + endif + else + let lineCompletedBrackets = 1 + endif + endif + + if ind == originalIndentValue + let bracketCount = scala#CountBrackets(prevline, '(', ')') + if bracketCount > 0 || prevline =~ '.*(\s*$' + call scala#ConditionalConfirm("5a") + let ind = ind + shiftwidth() + elseif bracketCount < 0 + call scala#ConditionalConfirm("6a") + " if the closing brace actually completes the braces entirely, then we + " have to indent to line that started the whole thing + let completeLine = scala#LineCompletesBrackets('(', ')') + if completeLine != -1 && prevline !~ '^.*{\s*$' + call scala#ConditionalConfirm("8a") + let prevCompleteLine = scala#GetLine(prevnonblank(completeLine - 1)) + " However, what actually started this part looks like it was a function + " definition, so we need to indent to that line instead. This is + " actually pretty weak at the moment. + if prevCompleteLine =~ '=\s*$' + call scala#ConditionalConfirm("9a") + let ind = indent(prevnonblank(completeLine - 1)) + else + call scala#ConditionalConfirm("10a") + let ind = indent(completeLine) + endif + else + " This is the only part that's different from from the '{', '}' one below + " Yup... some refactoring is necessary at some point. + let ind = ind + (bracketCount * shiftwidth()) + let lineCompletedBrackets = 1 + endif + endif + endif + + if curline =~ '^\s*}\?\s*\<else\>\%(\s\+\<if\>\s*(.*)\)\?\s*{\?\s*$' && + \ ! scala#LineIsCompleteIf(prevline) && + \ prevline !~ '^.*}\s*$' + let ind = ind - shiftwidth() + endif + + " Subtract a shiftwidth()' on '}' or html + let curCurlyCount = scala#CountCurlies(curline) + if curCurlyCount < 0 + call scala#ConditionalConfirm("14a") + let matchline = scala#CurlyMatcher() + return indent(matchline) + elseif curline =~ '^\s*</[a-zA-Z][^>]*>' + call scala#ConditionalConfirm("14c") + return ind - shiftwidth() + endif + + let prevParenCount = scala#CountParens(prevline) + if prevline =~ '^\s*\<for\>.*$' && prevParenCount > 0 + call scala#ConditionalConfirm("15") + let ind = indent(prevlnum) + 5 + endif + + let prevCurlyCount = scala#CountCurlies(prevline) + if prevCurlyCount == 0 && prevline =~ '^.*\%(=>\|⇒\)\s*$' && prevline !~ '^\s*this\s*:.*\%(=>\|⇒\)\s*$' && curline !~ '^\s*\<case\>' + call scala#ConditionalConfirm("16") + let ind = ind + shiftwidth() + endif + + if ind == originalIndentValue && curline =~ '^\s*\<case\>' + call scala#ConditionalConfirm("17") + let parentCase = scala#IsParentCase() + if parentCase != -1 + call scala#ConditionalConfirm("17a") + return indent(parentCase) + endif + endif + + if prevline =~ '^\s*\*/' + \ || prevline =~ '*/\s*$' + call scala#ConditionalConfirm("18") + let ind = ind - star_indent + endif + + if scala#LineEndsInIncomplete(prevline) + call scala#ConditionalConfirm("19") + return ind + endif + + if scala#LineIsAClosingXML(prevline) + if scala#LineCompletesXML(prevlnum, prevline) + call scala#ConditionalConfirm("20a") + return ind - shiftwidth() + else + call scala#ConditionalConfirm("20b") + return ind + endif + endif + + if ind == originalIndentValue + "let indentMultiplier = scala#LineCompletesDefValr(prevlnum, prevline) + "if indentMultiplier != 0 + " call scala#ConditionalConfirm("19a") + " let ind = ind - (indentMultiplier * shiftwidth()) + let defValrLine = scala#Test(prevlnum, prevline, '{', '}') + if defValrLine != -1 + call scala#ConditionalConfirm("21a") + let ind = indent(defValrLine) + elseif lineCompletedBrackets == 0 + call scala#ConditionalConfirm("21b") + if scala#GetLine(prevnonblank(prevlnum - 1)) =~ '^.*\<else\>\s*\%(//.*\)\?$' + call scala#ConditionalConfirm("21c") + let ind = ind - shiftwidth() + elseif scala#LineCompletesIfElse(prevlnum, prevline) + call scala#ConditionalConfirm("21d") + let ind = ind - shiftwidth() + elseif scala#CountParens(curline) < 0 && curline =~ '^\s*)' && scala#GetLine(scala#GetLineThatMatchesBracket('(', ')')) =~ '.*(\s*$' + " Handles situations that look like this: + " + " val a = func( + " 10 + " ) + " + " or + " + " val a = func( + " 10 + " ).somethingHere() + call scala#ConditionalConfirm("21e") + let ind = ind - shiftwidth() + endif + endif + endif + + call scala#ConditionalConfirm("returning " . ind) + + return ind +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:set sw=2 sts=2 ts=8 et: +" vim600:fdm=marker fdl=1 fdc=0: diff --git a/runtime/indent/scheme.vim b/runtime/indent/scheme.vim index a16f4f9ea1..496da3267d 100644 --- a/runtime/indent/scheme.vim +++ b/runtime/indent/scheme.vim @@ -1,11 +1,14 @@ " Vim indent file -" Language: Scheme -" Maintainer: Sergey Khorev <sergey.khorev@gmail.com> -" Last Change: 2005 Jun 24 +" Language: Scheme +" Last Change: 2018 Jan 31 +" Maintainer: Evan Hanson <evhan@foldling.org> +" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com> +" URL: https://foldling.org/vim/indent/scheme.vim " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif +" Use the Lisp indenting runtime! indent/lisp.vim diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 68f764ee69..fb398cafb0 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -1,8 +1,23 @@ " Vim indent file -" Language: Shell Script -" Maintainer: Peter Aronoff <telemachus@arpinum.org> -" Original Author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2013-11-28 +" Language: Shell Script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Original Author: Nikolai Weibull <now@bitwi.se> +" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> +" Latest Revision: 2018-03-26 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-sh-indent +" Changelog: +" 20180326 - better support for line continuation +" 20180325 - better detection of function definitions +" 20180127 - better support for zsh complex commands +" 20170808: - better indent of line continuation +" 20170502: - get rid of buffer-shiftwidth function +" 20160912: - preserve indentation of here-doc blocks +" 20160627: - detect heredocs correctly +" 20160213: - detect function definition correctly +" 20160202: - use shiftwidth() function +" 20151215: - set b:undo_indent variable +" 20150728: - add foreach detection for zsh if exists("b:did_indent") finish @@ -10,11 +25,13 @@ endif let b:did_indent = 1 setlocal indentexpr=GetShIndent() -setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;& +setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;& setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix setlocal indentkeys-=:,0# setlocal nosmartindent +let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' + if exists("*GetShIndent") finish endif @@ -22,15 +39,11 @@ endif let s:cpo_save = &cpo set cpo&vim -function s:buffer_shiftwidth() - return &shiftwidth -endfunction - let s:sh_indent_defaults = { - \ 'default': function('s:buffer_shiftwidth'), - \ 'continuation-line': function('s:buffer_shiftwidth'), - \ 'case-labels': function('s:buffer_shiftwidth'), - \ 'case-statements': function('s:buffer_shiftwidth'), + \ 'default': function('shiftwidth'), + \ 'continuation-line': function('shiftwidth'), + \ 'case-labels': function('shiftwidth'), + \ 'case-statements': function('shiftwidth'), \ 'case-breaks': 0 } function! s:indent_value(option) @@ -49,34 +62,51 @@ function! GetShIndent() if lnum == 0 return 0 endif + let line = getline(lnum) let pnum = prevnonblank(lnum - 1) - + let pline = getline(pnum) let ind = indent(lnum) - let line = getline(lnum) - if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\)\>' - if line !~ '\<\%(fi\|esac\|done\)\>\s*\%(#.*\)\=$' + + " Check contents of previous lines + if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>' || + \ (&ft is# 'zsh' && line =~ '\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>') + if line !~ '\<\%(fi\|esac\|done\|end\)\>\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif elseif s:is_case_label(line, pnum) if !s:is_case_ended(line) let ind += s:indent_value('case-statements') endif - elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' + " function definition + elseif s:is_function_definition(line) if line !~ '}\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif elseif s:is_continuation_line(line) - if pnum == 0 || !s:is_continuation_line(getline(pnum)) + if pnum == 0 || !s:is_continuation_line(pline) let ind += s:indent_value('continuation-line') endif - elseif pnum != 0 && s:is_continuation_line(getline(pnum)) - let ind = indent(s:find_continued_lnum(pnum)) + elseif s:end_block(line) && !s:start_block(line) + let ind -= s:indent_value('default') + elseif pnum != 0 && s:is_continuation_line(pline) && !s:end_block(getline(v:lnum)) + " only add indent, if line and pline is in the same block + let i = v:lnum + let ind2 = indent(s:find_continued_lnum(pnum)) + while !s:is_empty(getline(i)) && i > pnum + let i -= 1 + endw + if i == pnum + let ind += ind2 + else + let ind = ind2 + endif endif let pine = line + " Check content of current line let line = getline(v:lnum) - if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\)\>' || line =~ '^\s*}' + if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\|end\)\>' || s:end_block(line) let ind -= s:indent_value('default') elseif line =~ '^\s*esac\>' && s:is_case_empty(getline(v:lnum - 1)) let ind -= s:indent_value('default') @@ -91,17 +121,35 @@ function! GetShIndent() if s:is_case(pine) let ind = indent(lnum) + s:indent_value('case-labels') else - let ind -= s:indent_value('case-statements') - s:indent_value('case-breaks') + let ind -= (s:is_case_label(pine, lnum) && s:is_case_ended(pine) ? + \ 0 : s:indent_value('case-statements')) - + \ s:indent_value('case-breaks') endif elseif s:is_case_break(line) let ind -= s:indent_value('case-breaks') + elseif s:is_here_doc(line) + let ind = 0 + " statements, executed within a here document. Keep the current indent + elseif match(map(synstack(v:lnum, 1), 'synIDattr(v:val, "name")'), '\c\mheredoc') > -1 + return indent(v:lnum) + elseif s:is_comment(line) && s:is_empty(getline(v:lnum-1)) + return indent(v:lnum) endif - return ind + return ind > 0 ? ind : 0 endfunction function! s:is_continuation_line(line) - return a:line =~ '\%(\%(^\|[^\\]\)\\\|&&\|||\)$' + " Comment, cannot be a line continuation + if a:line =~ '^\s*#' + return 0 + else + " start-of-line + " \\ or && or || or | + " followed optionally by { or # + return a:line =~ '\%(\%(^\|[^\\]\)\\\|&&\|||\||\)' . + \ '\s*\({\s*\)\=\(#.*\)\=$' + endif endfunction function! s:find_continued_lnum(lnum) @@ -112,6 +160,12 @@ function! s:find_continued_lnum(lnum) return i endfunction +function! s:is_function_definition(line) + return a:line =~ '^\s*\<\k\+\>\s*()\s*{' || + \ a:line =~ '^\s*{' || + \ a:line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{' +endfunction + function! s:is_case_label(line, pnum) if a:line !~ '^\s*(\=.*)' return 0 @@ -153,6 +207,14 @@ function! s:is_case_break(line) return a:line =~ '^\s*;[;&]' endfunction +function! s:is_here_doc(line) + if a:line =~ '^\w\+$' + let here_pat = '<<-\?'. s:escape(a:line). '\$' + return search(here_pat, 'bnW') > 0 + endif + return 0 +endfunction + function! s:is_case_ended(line) return s:is_case_break(a:line) || a:line =~ ';[;&]\s*\%(#.*\)\=$' endfunction @@ -165,5 +227,33 @@ function! s:is_case_empty(line) endif endfunction +function! s:escape(pattern) + return '\V'. escape(a:pattern, '\\') +endfunction + +function! s:is_empty(line) + return a:line =~ '^\s*$' +endfunction + +function! s:end_block(line) + return a:line =~ '^\s*}' +endfunction + +function! s:start_block(line) + return a:line =~ '{\s*\(#.*\)\?$' +endfunction + +function! s:find_start_block(lnum) + let i = a:lnum + while i > 1 && !s:start_block(getline(i)) + let i -= 1 + endwhile + return i +endfunction + +function! s:is_comment(line) + return a:line =~ '^\s*#' +endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/indent/systemd.vim b/runtime/indent/systemd.vim new file mode 100644 index 0000000000..a05a87bb1c --- /dev/null +++ b/runtime/indent/systemd.vim @@ -0,0 +1,10 @@ +" Vim indent file +" Language: systemd.unit(5) + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +" Looks a lot like dosini files. +runtime! indent/dosini.vim diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index a92f57d67d..e9d61e4366 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -56,7 +56,7 @@ function GetTclIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -64,11 +64,11 @@ function GetTclIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/tcsh.vim b/runtime/indent/tcsh.vim index 59a9d56f44..ed08e6c6e2 100644 --- a/runtime/indent/tcsh.vim +++ b/runtime/indent/tcsh.vim @@ -32,17 +32,17 @@ function TcshGetIndent() let ind = indent(lnum) let line = getline(lnum) if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if line =~ '\v^\s*breaksw>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract indent if current line has on end, endif, case commands let line = getline(v:lnum) if line =~ '\v^\s*%(else|end|endif)\s*$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim new file mode 100644 index 0000000000..8467cefcc0 --- /dev/null +++ b/runtime/indent/teraterm.vim @@ -0,0 +1,65 @@ +" Vim indent file +" Language: Tera Term Language (TTL) +" Based on Tera Term Version 4.92 +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-teraterm +" Last Change: 2016 Aug 17 +" Filenames: *.ttl +" License: VIM License + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent +setlocal noautoindent +setlocal indentexpr=GetTeraTermIndent(v:lnum) +setlocal indentkeys=!^F,o,O,e +setlocal indentkeys+==elseif,=endif,=loop,=next,=enduntil,=endwhile + +if exists("*GetTeraTermIndent") + finish +endif + +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + let s:sw = function('shiftwidth') +else + function s:sw() abort + return &shiftwidth + endfunction +endif + +function! GetTeraTermIndent(lnum) + let l:prevlnum = prevnonblank(a:lnum-1) + if l:prevlnum == 0 + " top of file + return 0 + endif + + " grab the previous and current line, stripping comments. + let l:prevl = substitute(getline(l:prevlnum), ';.*$', '', '') + let l:thisl = substitute(getline(a:lnum), ';.*$', '', '') + let l:previ = indent(l:prevlnum) + + let l:ind = l:previ + + if l:prevl =~ '^\s*if\>.*\<then\>' + " previous line opened a block + let l:ind += s:sw() + endif + if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>' + " previous line opened a block + let l:ind += s:sw() + endif + if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>' + " this line closed a block + let l:ind -= s:sw() + endif + + return l:ind +endfunction + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index 7e3a351083..a748cfbb40 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -1,11 +1,10 @@ " Vim indent file " Language: LaTeX -" Maintainer: YiChao Zhou <broken.zhou AT gmail.com> +" Maintainer: Yichao Zhou <broken.zhou AT gmail.com> " Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Last Change: 2012 Mar 18 19:19:50 -" Version: 0.7 -" Please email me if you found something we can do. Bug report and -" feature request is welcome. +" Version: 1.0.0 +" Please email me if you found something I can do. Comments, bug report and +" feature request are welcome. " Last Update: {{{ " 25th Sep 2002, by LH : @@ -16,39 +15,56 @@ " 2005/06/15, Moshe Kaminsky <kaminsky AT math.huji.ac.il> " (*) New variables: " g:tex_items, g:tex_itemize_env, g:tex_noindent_env -" 2011/3/6, by Zhou YiChao <broken.zhou AT gmail.com> +" 2011/3/6, by Yichao Zhou <broken.zhou AT gmail.com> " (*) Don't change indentation of lines starting with '%' " I don't see any code with '%' and it doesn't work properly " so I add some code. " (*) New features: Add smartindent-like indent for "{}" and "[]". " (*) New variables: g:tex_indent_brace -" 2011/9/25, by Zhou Yichao <broken.zhou AT gmail.com> +" 2011/9/25, by Yichao Zhou <broken.zhou AT gmail.com> " (*) Bug fix: smartindent-like indent for "[]" " (*) New features: Align with "&". " (*) New variable: g:tex_indent_and. -" 2011/10/23 by Zhou Yichao <broken.zhou AT gmail.com> +" 2011/10/23 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Bug fix: improve the smartindent-like indent for "{}" and " "[]". -" 2012/02/27 by Zhou Yichao <broken.zhou AT gmail.com> +" 2012/02/27 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Bug fix: support default folding marker. " (*) Indent with "&" is not very handy. Make it not enable by " default. -" 2012/03/06 by Zhou Yichao <broken.zhou AT gmail.com> +" 2012/03/06 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Modify "&" behavior and make it default again. Now "&" " won't align when there are more then one "&" in the previous " line. " (*) Add indent "\left(" and "\right)" " (*) Trust user when in "verbatim" and "lstlisting" -" 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com> +" 2012/03/11 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Modify "&" so that only indent when current line start with -" "&". -" 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com> +" "&". +" 2012/03/12 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Modify indentkeys. -" 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com> +" 2012/03/18 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Add &cpo -" 2013/05/02 by Zhou Yichao <broken.zhou AT gmail.com> +" 2013/05/02 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk " for reporting this. +" 2014/06/23 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Remove the feature g:tex_indent_and because it is buggy. +" (*) If there is not any obvious indentation hints, we do not +" alert our user's current indentation. +" (*) g:tex_indent_brace now only works if the open brace is the +" last character of that line. +" 2014/08/03 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Indent current line if last line has larger indentation +" 2016/11/08 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Fix problems for \[ and \]. Thanks Bruno for reporting. +" 2017/04/30 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Fix a bug between g:tex_noindent_env and g:tex_indent_items +" Now g:tex_noindent_env='document\|verbatim\|itemize' (Emacs +" style) is supported. Thanks Miles Wheeler for reporting. +" 2018/02/07 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Make indentation more smart in the normal mode +" " }}} " Document: {{{ @@ -60,53 +76,50 @@ " * g:tex_indent_brace " " If this variable is unset or non-zero, it will use smartindent-like style -" for "{}" and "[]" -" +" for "{}" and "[]". Now this only works if the open brace is the last +" character of that line. +" +" % Example 1 +" \usetikzlibrary{ +" external +" } +" +" % Example 2 +" \tikzexternalize[ +" prefix=tikz] +" " * g:tex_indent_items " " If this variable is set, item-environments are indented like Emacs does " it, i.e., continuation lines are indented with a shiftwidth. -" -" NOTE: I've already set the variable below; delete the corresponding line -" if you don't like this behaviour. " -" Per default, it is unset. -" -" set unset -" ---------------------------------------------------------------- -" \begin{itemize} \begin{itemize} -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \end{itemize} \end{itemize} +" set unset +" ------------------------------------------------------ +" \begin{itemize} \begin{itemize} +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} " " " * g:tex_items " -" A list of tokens to be considered as commands for the beginning of an item -" command. The tokens should be separated with '\|'. The initial '\' should +" A list of tokens to be considered as commands for the beginning of an item +" command. The tokens should be separated with '\|'. The initial '\' should " be escaped. The default is '\\bibitem\|\\item'. " " * g:tex_itemize_env -" -" A list of environment names, separated with '\|', where the items (item -" commands matching g:tex_items) may appear. The default is +" +" A list of environment names, separated with '\|', where the items (item +" commands matching g:tex_items) may appear. The default is " 'itemize\|description\|enumerate\|thebibliography'. " " * g:tex_noindent_env " -" A list of environment names. separated with '\|', where no indentation is +" A list of environment names. separated with '\|', where no indentation is " required. The default is 'document\|verbatim'. -" -" * g:tex_indent_and -" -" If this variable is unset or zero, vim will try to align the line with first -" "&". This is pretty useful when you use environment like table or align. -" Note that this feature need to search back some line, so vim may become -" a little slow. -" -" }}} +" }}} " Only define the function once if exists("b:did_indent") @@ -126,24 +139,20 @@ endif if !exists("g:tex_indent_brace") let g:tex_indent_brace = 1 endif -if !exists("g:tex_indent_and") - let g:tex_indent_and = 1 +if !exists("g:tex_max_scan_line") + let g:tex_max_scan_line = 60 endif if g:tex_indent_items if !exists("g:tex_itemize_env") let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography' endif if !exists('g:tex_items') - let g:tex_items = '\\bibitem\|\\item' + let g:tex_items = '\\bibitem\|\\item' endif else let g:tex_items = '' endif -if !exists("g:tex_indent_paretheses") - let g:tex_indent_paretheses = 1 -endif - if !exists("g:tex_noindent_env") let g:tex_noindent_env = 'document\|verbatim\|lstlisting' endif "}}} @@ -160,6 +169,7 @@ let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '') function! GetTeXIndent() " {{{ " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) + let cnum = v:lnum " Comment line is not what we need. while lnum != 0 && getline(lnum) =~ '^\s*%' @@ -168,11 +178,11 @@ function! GetTeXIndent() " {{{ " At the start of the file use zero indent. if lnum == 0 - return 0 + return 0 endif - let line = substitute(getline(lnum), '%.*', ' ','g') " last line - let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line + let line = substitute(getline(lnum), '\s*%.*', '','g') " last line + let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line " We are in verbatim, so do what our user what. if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone" @@ -182,27 +192,13 @@ function! GetTeXIndent() " {{{ return indent(v:lnum) end endif - - " You want to align with "&" - if g:tex_indent_and - " Align only when current line start with "&" - if line =~ '&.*\\\\' && cline =~ '^\s*&' - return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&") - endif - - " set line & lnum to the line which doesn't contain "&" - while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%') - let lnum = prevnonblank(lnum - 1) - let line = getline(lnum) - endwhile - endif - if lnum == 0 - return 0 + return 0 endif let ind = indent(lnum) + let stay = 1 " New code for comment: retain the indent of current line if cline =~ '^\s*%' @@ -211,82 +207,206 @@ function! GetTeXIndent() " {{{ " Add a 'shiftwidth' after beginning of environments. " Don't add it for \begin{document} and \begin{verbatim} - ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' + " if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' " LH modification : \begin does not always start a line " ZYC modification : \end after \begin won't cause wrong indent anymore - if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env - let ind = ind + &sw + if line =~ '\\begin{.*}' + if line !~ g:tex_noindent_env + let ind = ind + shiftwidth() + let stay = 0 + endif if g:tex_indent_items " Add another sw for item-environments if line =~ g:tex_itemize_env - let ind = ind + &sw + let ind = ind + shiftwidth() + let stay = 0 endif endif endif + if cline =~ '\\end{.*}' + let retn = s:GetEndIndentation(v:lnum) + if retn != -1 + return retn + endif + end " Subtract a 'shiftwidth' when an environment ends - if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env - + if cline =~ '\\end{.*}' + \ && cline !~ g:tex_noindent_env + \ && cline !~ '\\begin{.*}.*\\end{.*}' if g:tex_indent_items " Remove another sw for item-environments if cline =~ g:tex_itemize_env - let ind = ind - &sw + let ind = ind - shiftwidth() + let stay = 0 endif endif - let ind = ind - &sw + let ind = ind - shiftwidth() + let stay = 0 endif if g:tex_indent_brace - let sum1 = 0 - for i in range(0, strlen(line)-1) - if line[i] == "}" || line[i] == "]" || - \ strpart(line, i, 7) == '\right)' - let sum1 = max([0, sum1-1]) - endif - if line[i] == "{" || line[i] == "[" || - \ strpart(line, i, 6) == '\left(' - let sum1 += 1 - endif - endfor - - let sum2 = 0 - for i in reverse(range(0, strlen(cline)-1)) - if cline[i] == "{" || cline[i] == "[" || - \ strpart(cline, i, 6) == '\left(' - let sum2 = max([0, sum2-1]) - endif - if cline[i] == "}" || cline[i] == "]" || - \ strpart(cline, i, 7) == '\right)' - let sum2 += 1 - endif - endfor + if line =~ '[[{]$' + let ind += shiftwidth() + let stay = 0 + endif - let ind += (sum1 - sum2) * &sw - endif + if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum)) + let ind -= shiftwidth() + let stay = 0 + endif - if g:tex_indent_paretheses + if line !~ '^\s*\\\?[\]}]' + for i in range(indent(lnum)+1, strlen(line)-1) + let char = line[i] + if char == ']' || char == '}' + if s:CheckPairedIsLastCharacter(lnum, i) + let ind -= shiftwidth() + let stay = 0 + endif + endif + endfor + endif endif " Special treatment for 'item' " ---------------------------- if g:tex_indent_items - " '\item' or '\bibitem' itself: if cline =~ g:tex_items - let ind = ind - &sw + let ind = ind - shiftwidth() + let stay = 0 endif - " lines following to '\item' are intented once again: if line =~ g:tex_items - let ind = ind + &sw + let ind = ind + shiftwidth() + let stay = 0 + endif + endif + + if stay && mode() == 'i' + " If there is no obvious indentation hint, and indentation is triggered + " in insert mode, we trust our user. + if empty(cline) + return ind + else + return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)]) + endif + else + return ind + endif +endfunction "}}} + +function! s:GetLastBeginIndentation(lnum) " {{{ + let matchend = 1 + for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1) + let line = getline(lnum) + if line =~ '\\end{.*}' + let matchend += 1 + endif + if line =~ '\\begin{.*}' + let matchend -= 1 + endif + if matchend == 0 + if line =~ g:tex_noindent_env + return indent(lnum) + endif + if line =~ g:tex_itemize_env + return indent(lnum) + 2 * shiftwidth() + endif + return indent(lnum) + shiftwidth() + endif + endfor + return -1 +endfunction + +function! s:GetEndIndentation(lnum) " {{{ + if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}' + return -1 + endif + + let min_indent = 100 + let matchend = 1 + for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1) + let line = getline(lnum) + if line =~ '\\end{.*}' + let matchend += 1 endif + if line =~ '\\begin{.*}' + let matchend -= 1 + endif + if matchend == 0 + return indent(lnum) + endif + if !empty(line) + let min_indent = min([min_indent, indent(lnum)]) + endif + endfor + return min_indent - shiftwidth() +endfunction + +" Most of the code is from matchparen.vim +function! s:CheckPairedIsLastCharacter(lnum, col) "{{{ + let c_lnum = a:lnum + let c_col = a:col+1 + + let line = getline(c_lnum) + if line[c_col-1] == '\' + let c_col = c_col + 1 + endif + let c = line[c_col-1] + + let plist = split(&matchpairs, '.\zs[:,]') + let i = index(plist, c) + if i < 0 + return 0 + endif + + " Figure out the arguments for searchpairpos(). + if i % 2 == 0 + let s_flags = 'nW' + let c2 = plist[i + 1] + else + let s_flags = 'nbW' + let c2 = c + let c = plist[i - 1] + endif + if c == '[' + let c = '\[' + let c2 = '\]' + endif + + " Find the match. When it was just before the cursor move it there for a + " moment. + let save_cursor = winsaveview() + call cursor(c_lnum, c_col) + + " When not in a string or comment ignore matches inside them. + " We match "escape" for special items, such as lispEscapeSpecial. + let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . + \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"' + execute 'if' s_skip '| let s_skip = 0 | endif' + + let stopline = max([0, c_lnum - g:tex_max_scan_line]) + + " Limit the search time to 300 msec to avoid a hang on very long lines. + " This fails when a timeout is not supported. + try + let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100) + catch /E118/ + endtry + + call winrestview(save_cursor) + if m_lnum > 0 + let line = getline(m_lnum) + return strlen(line) == m_col endif - return ind + return 0 endfunction "}}} let &cpo = s:cpo_save diff --git a/runtime/indent/tf.vim b/runtime/indent/tf.vim index 17597734b8..a980538506 100644 --- a/runtime/indent/tf.vim +++ b/runtime/indent/tf.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: tf (TinyFugue) " Maintainer: Christian J. Robinson <heptite@gmail.com> -" URL: http://christianrobinson.name/vim/indent/tf.vim -" Last Change: 2002 May 29 +" URL: http://www.vim.org/scripts/script.php?script_id=174 +" Last Change: 2017 Feb 25 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -38,14 +38,14 @@ function GetTFIndent() endif if line =~ '\(/def.*\\\|/for.*\(%;\s*\)\@\<!\\\)$' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif line =~ '\(/if\|/else\|/then\)' if line !~ '/endif' - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '/while' if line !~ '/done' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif @@ -53,11 +53,11 @@ function GetTFIndent() if line =~ '\(/else\|/endif\|/then\)' if line !~ '/if' - let ind = ind - &sw + let ind = ind - shiftwidth() endif elseif line =~ '/done' if line !~ '/while' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim index a2af78b8c2..2c6eecf5c4 100644 --- a/runtime/indent/treetop.vim +++ b/runtime/indent/treetop.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:did_indent") finish @@ -26,12 +26,12 @@ function GetTreetopIndent() let line = getline(pnum) if line =~ '^\s*\%(grammar\|module\|rule\)\>' - let ind += &sw + let ind += shiftwidth() endif let line = getline(v:lnum) if line =~ '^\s*end\>' - let ind -= &sw + let ind -= shiftwidth() end retur ind diff --git a/runtime/indent/verilog.vim b/runtime/indent/verilog.vim index ecca462636..6222dc341f 100644 --- a/runtime/indent/verilog.vim +++ b/runtime/indent/verilog.vim @@ -1,10 +1,12 @@ " Language: Verilog HDL -" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw> -" Last Change: 2011 Dec 10 by Thilo Six -" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/indent/verilog.vim +" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw> +" Last Change: 2017 Feb 24 by Chih-Tsun Huang +" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/indent/verilog.vim " " Credits: " Suggestions for improvement, bug reports by +" Takuya Fujiwara <tyru.exe@gmail.com> +" Thilo Six <debian@Xk2c.de> " Leo Butlero <lbutler@brocade.com> " " Buffer Variables: @@ -38,7 +40,7 @@ function GetVerilogIndent() if exists('b:verilog_indent_width') let offset = b:verilog_indent_width else - let offset = &sw + let offset = shiftwidth() endif if exists('b:verilog_indent_modules') let indent_modules = offset diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim index 3e847b9575..ad318066f4 100644 --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -1,8 +1,8 @@ " VHDL indent ('93 syntax) " Language: VHDL " Maintainer: Gerald Lai <laigera+vim?gmail.com> -" Version: 1.58 -" Last Change: 2011 Sep 27 +" Version: 1.62 +" Last Change: 2017 Oct 17 " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -104,7 +104,7 @@ function GetVHDLindent() let pn = prevnonblank(pn - 1) let ps = getline(pn) endwhile - if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) + if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\((.*)\)*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\s\+\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) " align closing ")" with opening "(" if curs =~ '^\s*)' return ind2 + stridx(prevs_noi, '(') @@ -114,9 +114,9 @@ function GetVHDLindent() return ind2 + m else if g:vhdl_indent_genportmap - return ind2 + stridx(prevs_noi, '(') + &sw + return ind2 + stridx(prevs_noi, '(') + shiftwidth() else - return ind2 + &sw + return ind2 + shiftwidth() endif endif endif @@ -128,7 +128,7 @@ function GetVHDLindent() if g:vhdl_indent_rhsassign return ind2 + matchend(prevs_noi, '<=\s*\ze.') else - return ind2 + &sw + return ind2 + shiftwidth() endif endif @@ -218,12 +218,12 @@ function GetVHDLindent() let ps = getline(pn) if (ps =~? s:NC.'\<begin\>') - return indent(pn) - &sw + return indent(pn) - shiftwidth() endif endwhile if (pn == 0) - return ind - &sw + return ind - shiftwidth() else return indent(pn) endif @@ -237,7 +237,7 @@ function GetVHDLindent() " keyword: "type" let s3 = s:NC.s:NE.'\<type\>' if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3 - let ind = ind + &sw + let ind = ind + shiftwidth() endif return ind endif @@ -282,7 +282,7 @@ function GetVHDLindent() " removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while" " where: anywhere in previous line if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>' - return ind + &sw + return ind + shiftwidth() endif " indent: +sw @@ -290,7 +290,7 @@ function GetVHDLindent() " removed: "component", "for", "when", "with" " where: start of previous line if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>' - return ind + &sw + return ind + shiftwidth() endif " indent: +sw @@ -298,7 +298,7 @@ function GetVHDLindent() " removed: "generate", "is", "=>" " where: end of previous line if prevs =~? s:NC.'\<select'.s:ES - return ind + &sw + return ind + shiftwidth() endif " indent: +sw @@ -310,7 +310,7 @@ function GetVHDLindent() " where: end of previous line " _note_: indent allowed to leave this filter if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES - let ind = ind + &sw + let ind = ind + shiftwidth() endif " **************************************************************************************** @@ -322,7 +322,7 @@ function GetVHDLindent() if prevs =~? s:NC.'\<is'.s:ES return ind elseif prevs !~? s4 - return ind - &sw + return ind - shiftwidth() else return ind2 endif @@ -336,7 +336,7 @@ function GetVHDLindent() if prevs =~? '^\s*\%(elsif\|'.s5.'\)' return ind else - return ind - &sw + return ind - shiftwidth() endif endif @@ -367,9 +367,9 @@ function GetVHDLindent() "where: start of previous non-comment line if m == 1 if ps =~? '^\s*end\s\+case\>' - return indent(pn) - 2 * &sw + return indent(pn) - 2 * shiftwidth() elseif ps =~? '^\s*when\>' - return indent(pn) - &sw + return indent(pn) - shiftwidth() elseif ps =~? '^\s*case\>' return indent(pn) endif @@ -385,14 +385,14 @@ function GetVHDLindent() let pn = prevnonblank(pn - 1) let ps = getline(pn) endwhile - return ind - &sw + return ind - shiftwidth() endif " indent: -sw " keyword: ")" " where: start of current line if curs =~ '^\s*)' - return ind - &sw + return ind - shiftwidth() endif " indent: 0 @@ -407,7 +407,7 @@ function GetVHDLindent() " where: start of current line "if curs =~? '^\s*end\s\+\w\+\>' if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)' - return ind - &sw + return ind - shiftwidth() endif " **************************************************************************************** @@ -418,6 +418,18 @@ function GetVHDLindent() return ind2 endif + " **************************************************************************************** + " indent: maintain indent of previous opening statement, corner case which + " does not end in ;, but is part of a mapping + " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=", never + ;$ and + " prevline without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$ + " where: start of current line + if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*[^;].*$' + if prevs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*;.*$' + return ind2 + endif + endif + " return leftover filtered indent return ind endfunction diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 8c215733b3..8ebfa12caf 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Aug 02 +" Last Change: 2016 Jun 27 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -37,7 +37,8 @@ function GetVimIndentIntern() " If the current line doesn't start with '\' and below a line that starts " with '\', use the indent of the line above it. - if getline(v:lnum) !~ '^\s*\\' + let cur_text = getline(v:lnum) + if cur_text !~ '^\s*\\' while lnum > 0 && getline(lnum) =~ '^\s*\\' let lnum = lnum - 1 endwhile @@ -47,27 +48,30 @@ function GetVimIndentIntern() if lnum == 0 return 0 endif + let prev_text = getline(lnum) " Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function " and :else. Add it three times for a line that starts with '\' after " a line that doesn't (or g:vim_indent_cont if it exists). let ind = indent(lnum) - if getline(v:lnum) =~ '^\s*\\' && v:lnum > 1 && getline(lnum) !~ '^\s*\\' + if cur_text =~ '^\s*\\' && v:lnum > 1 && prev_text !~ '^\s*\\' if exists("g:vim_indent_cont") let ind = ind + g:vim_indent_cont else - let ind = ind + &sw * 3 + let ind = ind + shiftwidth() * 3 endif - elseif getline(lnum) =~ '^\s*aug\%[roup]' && getline(lnum) !~ '^\s*aug\%[roup]\s*!\=\s\+END' - let ind = ind + &sw + elseif prev_text =~ '^\s*aug\%[roup]\s\+' && prev_text !~ '^\s*aug\%[roup]\s\+[eE][nN][dD]\>' + let ind = ind + shiftwidth() else - let line = getline(lnum) - let i = match(line, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') - if i >= 0 - let ind += &sw - if strpart(line, i, 1) == '|' && has('syntax_items') - \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' - let ind -= &sw + " A line starting with :au does not increment/decrement indent. + if prev_text !~ '^\s*au\%[tocmd]' + let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') + if i >= 0 + let ind += shiftwidth() + if strpart(prev_text, i, 1) == '|' && has('syntax_items') + \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' + let ind -= shiftwidth() + endif endif endif endif @@ -75,19 +79,18 @@ function GetVimIndentIntern() " If the previous line contains an "end" after a pipe, but not in an ":au" " command. And not when there is a backslash before the pipe. " And when syntax HL is enabled avoid a match inside a string. - let line = getline(lnum) - let i = match(line, '[^\\]|\s*\(ene\@!\)') - if i > 0 && line !~ '^\s*au\%[tocmd]' + let i = match(prev_text, '[^\\]|\s*\(ene\@!\)') + if i > 0 && prev_text !~ '^\s*au\%[tocmd]' if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. - if getline(v:lnum) =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+END\)' - let ind = ind - &sw + if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/vroom.vim b/runtime/indent/vroom.vim index 10efb0eb90..d333e2c14e 100644 --- a/runtime/indent/vroom.vim +++ b/runtime/indent/vroom.vim @@ -1,6 +1,6 @@ " Vim indent file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 if exists('b:did_indent') diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim index 4174a24224..5a8bc0fec1 100644 --- a/runtime/indent/xf86conf.vim +++ b/runtime/indent/xf86conf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: XFree86 Configuration File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: XFree86 Configuration File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -26,11 +26,11 @@ function GetXF86ConfIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\(Sub\)\=Section\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim index c8127237e8..977ee3d33b 100644 --- a/runtime/indent/xinetd.vim +++ b/runtime/indent/xinetd.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -47,8 +47,8 @@ function GetXinetdIndent() return 0 endif - return indent(pnum) + s:count_braces(pnum, 1) * &sw - \ - s:count_braces(v:lnum, 0) * &sw + return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + \ - s:count_braces(v:lnum, 0) * shiftwidth() endfunction let &cpo = s:keepcpo diff --git a/runtime/indent/yacc.vim b/runtime/indent/yacc.vim index 2ab7d7b38c..01ad4fc56d 100644 --- a/runtime/indent/yacc.vim +++ b/runtime/indent/yacc.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: YACC input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: YACC input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index 1d03715773..3201462fbc 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -1,6 +1,7 @@ " Vim indent file " Language: YAML " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> +" Last Change: 2015 Nov 01 " Only load this indent file when no other was loaded. if exists('b:did_indent') @@ -13,7 +14,7 @@ set cpo&vim let b:did_indent = 1 setlocal indentexpr=GetYAMLIndent(v:lnum) -setlocal indentkeys=!^F,o,O,0#,0},0],<:>,- +setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0- setlocal nosmartindent let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' @@ -36,7 +37,7 @@ function s:FindPrevLessIndentedLine(lnum, ...) let curindent = a:0 ? a:1 : indent(a:lnum) while prevlnum \&& indent(prevlnum) >= curindent - \&& getline(prevlnum) !~# '^\s*#' + \&& getline(prevlnum) =~# '^\s*#' let prevlnum = prevnonblank(prevlnum-1) endwhile return prevlnum @@ -50,11 +51,33 @@ function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex) return plilnum endfunction -let s:mapkeyregex='\v^\s*%(\''%([^'']|'''')*\'''. - \ '|\"%([^"\\]|\\.)*\"'. - \ '|%(%(\:\ )@!.)*)\:%(\ |$)' +let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''. + \ '|\"%([^"\\]|\\.)*\"'. + \ '|%(%(\:\ )@!.)*)\:%(\ |$)' let s:liststartregex='\v^\s*%(\-%(\ |$))' +let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)' +let s:c_ns_anchor_name = s:c_ns_anchor_char.'+' +let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name + +let s:ns_word_char = '\v[[:alnum:]_\-]' +let s:ns_tag_char = '\v%(%\x\x|'.s:ns_word_char.'|[#/;?:@&=+$.~*''()])' +let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!' +let s:c_secondary_tag_handle = '\v\!\!' +let s:c_primary_tag_handle = '\v\!' +let s:c_tag_handle = '\v%('.s:c_named_tag_handle. + \ '|'.s:c_secondary_tag_handle. + \ '|'.s:c_primary_tag_handle.')' +let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+' +let s:c_non_specific_tag = '\v\!' +let s:ns_uri_char = '\v%(%\x\x|'.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])' +let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>' +let s:c_ns_tag_property = '\v'.s:c_verbatim_tag. + \ '\v|'.s:c_ns_shorthand_tag. + \ '\v|'.s:c_non_specific_tag + +let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?' + function GetYAMLIndent(lnum) if a:lnum == 1 || !prevnonblank(a:lnum-1) return 0 @@ -115,13 +138,21 @@ function GetYAMLIndent(lnum) \ s:liststartregex)) elseif line =~# s:mapkeyregex " Same for line containing mapping key - return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, - \ s:mapkeyregex)) + let prevmapline = s:FindPrevLEIndentedLineMatchingRegex(a:lnum, + \ s:mapkeyregex) + if getline(prevmapline) =~# '^\s*- ' + return indent(prevmapline) + 2 + else + return indent(prevmapline) + endif elseif prevline =~# '^\s*- ' " - List with " multiline scalar return previndent+2 - elseif prevline =~# s:mapkeyregex + elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property. + \ '\v|'.s:c_ns_anchor_property. + \ '\v|'.s:block_scalar_header. + \ '\v)%(\s+|\s*%(\#.*)?$))*' " Mapping with: value " that is multiline scalar return previndent+s:shiftwidth() diff --git a/runtime/indent/zimbu.vim b/runtime/indent/zimbu.vim index 9565b10843..5451877ea7 100644 --- a/runtime/indent/zimbu.vim +++ b/runtime/indent/zimbu.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Zimbu " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Sep 08 +" Last Change: 2016 Jan 25 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -74,9 +74,9 @@ func GetZimbuIndent(lnum) \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" \ . " =~ '\\(Comment\\|String\\|Char\\)$'") if pp > 0 - return indent(prevLnum) + &sw + return indent(prevLnum) + shiftwidth() endif - return indent(prevLnum) + &sw * 2 + return indent(prevLnum) + shiftwidth() * 2 endif if plnumstart == p return indent(prevLnum) @@ -102,13 +102,13 @@ func GetZimbuIndent(lnum) endif if prevline =~ '^\s*\(IF\|\|ELSEIF\|ELSE\|GENERATE_IF\|\|GENERATE_ELSEIF\|GENERATE_ELSE\|WHILE\|REPEAT\|TRY\|CATCH\|FINALLY\|FOR\|DO\|SWITCH\|CASE\|DEFAULT\|FUNC\|VIRTUAL\|ABSTRACT\|DEFINE\|REPLACE\|FINAL\|PROC\|MAIN\|NEW\|ENUM\|CLASS\|INTERFACE\|BITS\|MODULE\|SHARED\)\>' - let plindent += &sw + let plindent += shiftwidth() endif if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)' - let plindent -= &sw + let plindent -= shiftwidth() endif if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>' - let plindent -= &sw + let plindent -= shiftwidth() endif " line up continued comment that started after some code diff --git a/runtime/indent/zsh.vim b/runtime/indent/zsh.vim index c5580a10b1..8e30c65c18 100644 --- a/runtime/indent/zsh.vim +++ b/runtime/indent/zsh.vim @@ -1,7 +1,10 @@ " Vim indent file -" Language: Zsh Shell Script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: Zsh shell script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-05-29 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:did_indent") finish diff --git a/runtime/keymap/armenian-eastern_utf-8.vim b/runtime/keymap/armenian-eastern_utf-8.vim new file mode 100644 index 0000000000..eaa60a77f8 --- /dev/null +++ b/runtime/keymap/armenian-eastern_utf-8.vim @@ -0,0 +1,110 @@ +" Maintainer: Benjamin Linskey <vim@benlinskey.com> +" Last Changed: 2016 December 5 +" URL: https://github.com/blinskey/vim-armenian-keymaps + +let b:keymap_name = "hy" + +loadkeymap + +" Capital letters +A Ա +B Բ +C Գ +D Դ +Y Ե +Z Զ +E Է +U Ը +: Թ ++ Ժ +I Ի +L Լ +Q Խ +? Ծ +K Կ +H Հ +@ Ձ +> Ղ +J Ճ +M Մ +# Յ +N Ն +< Շ +O Ո +{ Չ +P Պ +} Ջ +_ Ռ +S Ս +V Վ +T Տ +R Ր +X Ց +W Ւ +\" Փ +G Ք +) Օ +F Ֆ + +" Lowercase letters +a ա +b բ +c գ +d դ +y ե +z զ +e է +u ը +; թ += ժ +i ի +l լ +q խ +/ ծ +k կ +h հ +2 ձ +. ղ +j ճ +m մ +3 յ +n ն +, շ +o ո +[ չ +p պ +] ջ +- ռ +s ս +v վ +t տ +r ր +x ց +w ւ +' փ +g ք +0 օ +f ֆ + +& և + +" Punctuation +` ՝ +~ ՜ +1 ։ +4 ՛ +5 , +6 - +7 . +8 « +9 » +* ( +( ) +\\ ' +| ՞ + +" Numbers +! 1 +$ 3 +% 4 +^ 9 diff --git a/runtime/keymap/armenian-western_utf-8.vim b/runtime/keymap/armenian-western_utf-8.vim new file mode 100644 index 0000000000..cf3efdc00f --- /dev/null +++ b/runtime/keymap/armenian-western_utf-8.vim @@ -0,0 +1,110 @@ +" Maintainer: Benjamin Linskey <vim@benlinskey.com> +" Last Changed: 2016 December 5 +" URL: https://github.com/blinskey/vim-armenian-keymaps + +let b:keymap_name = "hy" + +loadkeymap + +" Capital letters +A Ա +P Բ +C Գ +T Դ +Y Ե +Z Զ +E Է +U Ը +: Թ ++ Ժ +I Ի +L Լ +Q Խ +? Ծ +G Կ +H Հ +@ Ձ +> Ղ +J Ճ +M Մ +# Յ +N Ն +< Շ +O Ո +{ Չ +B Պ +} Ջ +_ Ռ +S Ս +W Վ +D Տ +R Ր +X Ց +V Ւ +\" Փ +K Ք +) Օ +F Ֆ + +" Lowercase letters +a ա +p բ +c գ +t դ +y ե +z զ +e է +u ը +; թ += ժ +i ի +l լ +q խ +/ ծ +g կ +h հ +2 ձ +. ղ +j ճ +m մ +3 յ +n ն +, շ +o ո +[ չ +b պ +] ջ +- ռ +s ս +w վ +d տ +r ր +x ց +v ւ +' փ +k ք +0 օ +f ֆ + +& և + +" Punctuation +` ՝ +~ ՜ +1 ։ +4 ՛ +5 , +6 - +7 . +8 « +9 » +* ( +( ) +\\ ' +| ՞ + +" Numbers +! 1 +$ 3 +% 4 +^ 9 diff --git a/runtime/keymap/kazakh-jcuken.vim b/runtime/keymap/kazakh-jcuken.vim new file mode 100644 index 0000000000..63d122d112 --- /dev/null +++ b/runtime/keymap/kazakh-jcuken.vim @@ -0,0 +1,102 @@ +" Vim Keymap file for kazakh characters, layout 'jcuken', classical variant + +" Derived from russian-jcuken.vim by Artem Chuprina <ran@ran.pp.ru> +" Maintainer: Darkhan Kubigenov <darkhanu@gmail.com> +" Last Changed: 2016 Oct 25 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "kk" + +loadkeymap +~ ) CYRILLIC CAPITAL LETTER IO +` ( CYRILLIC SMALL LETTER IO +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B И CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Х CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Щ CYRILLIC CAPITAL LETTER SHCHA +} Ъ CYRILLIC CAPITAL LETTER HARD SIGN +S Ы CYRILLIC CAPITAL LETTER YERU +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Э CYRILLIC CAPITAL LETTER E +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b и CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o щ CYRILLIC SMALL LETTER SHCHA +] ъ CYRILLIC SMALL LETTER HARD SIGN +s ы CYRILLIC SMALL LETTER YERU +m ь CYRILLIC SMALL LETTER SOFT SIGN +' э CYRILLIC SMALL LETTER E +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA +@ Ә CYRILLIC CAPITAL LETTER SCHWA +# І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +$ Ң CYRILLIC CAPITAL LETTER EN WITH DESCENDER +% Ғ CYRILLIC CAPITAL LETTER GHE WITH STROKE +^ ; +& : +* Ү CYRILLIC CAPITAL LETTER STRAIGHT U +( Ұ CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE +) Қ CYRILLIC CAPITAL LETTER KA WITH DESCENDER +_ Ө CYRILLIC CAPITAL LETTER BARRED O ++ Һ CYRILLIC CAPITAL LETTER SHHA +1 " +2 ә CYRILLIC SMALL LETTER SCHWA +3 і CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +4 ң CYRILLIC SMALL LETTER EN WITH DESCENDER +5 ғ CYRILLIC SMALL LETTER GHE WITH STROKE +6 , +7 . +8 ү CYRILLIC SMALL LETTER STRAIGHT U +9 ұ CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE +0 қ CYRILLIC SMALL LETTER KA WITH DESCENDER +- ө CYRILLIC SMALL LETTER BARRED O += һ CYRILLIC SMALL LETTER SHHA diff --git a/runtime/keymap/oldturkic-orkhon_utf-8.vim b/runtime/keymap/oldturkic-orkhon_utf-8.vim new file mode 100644 index 0000000000..e1f0015a2a --- /dev/null +++ b/runtime/keymap/oldturkic-orkhon_utf-8.vim @@ -0,0 +1,143 @@ +" Maintainer: Oliver Corff <oliver.corff@email.de> +" Last Changed: 2018 Feb 12 + +scriptencoding utf-8 + +" oto = Old Turkic, Orkhon +let b:keymap_name = "oto" +highlight lCursor guibg=red guifg=NONE + +" map F8 to toggle keymap (Ctrl-^ not present on keyboard) +noremap <F8> :let &iminsert = ! &iminsert<CR> +lnoremap <F8> <C-^> +noremap! <F8> <C-^> + +loadkeymap +A 𐰀 10C00 OLD TURKIC LETTER ORKHON A +00 𐰀 10C00 OLD TURKIC LETTER ORKHON A +I 𐰃 10C03 OLD TURKIC LETTER ORKHON I +03 𐰃 10C03 OLD TURKIC LETTER ORKHON I +O 𐰆 10C06 OLD TURKIC LETTER ORKHON O +U 𐰆 10C06 OLD TURKIC LETTER ORKHON O +06 𐰆 10C06 OLD TURKIC LETTER ORKHON O +OE 𐰇 10C07 OLD TURKIC LETTER ORKHON OE +UE 𐰇 10C07 OLD TURKIC LETTER ORKHON OE +07 𐰇 10C07 OLD TURKIC LETTER ORKHON OE +ab 𐰉 10C09 OLD TURKIC LETTER ORKHON AB +b1 𐰉 10C09 OLD TURKIC LETTER ORKHON AB +09 𐰉 10C09 OLD TURKIC LETTER ORKHON AB +aeb 𐰋 10C0B OLD TURKIC LETTER ORKHON AEB +eb 𐰋 10C0B OLD TURKIC LETTER ORKHON AEB +b2 𐰋 10C0B OLD TURKIC LETTER ORKHON AEB +0b 𐰋 10C0B OLD TURKIC LETTER ORKHON AEB +ag 𐰍 10C0D OLD TURKIC LETTER ORKHON AG +g1 𐰍 10C0D OLD TURKIC LETTER ORKHON AG +0d 𐰍 10C0D OLD TURKIC LETTER ORKHON AG +aeg 𐰏 10C0F OLD TURKIC LETTER ORKHON AEG +eg 𐰏 10C0F OLD TURKIC LETTER ORKHON AEG +g2 𐰏 10C0F OLD TURKIC LETTER ORKHON AEG +0f 𐰏 10C0F OLD TURKIC LETTER ORKHON AEG +ad 𐰑 10C11 OLD TURKIC LETTER ORKHON AD +d1 𐰑 10C11 OLD TURKIC LETTER ORKHON AD +11 𐰑 10C11 OLD TURKIC LETTER ORKHON AD +aed 𐰓 10C13 OLD TURKIC LETTER ORKHON AED +ed 𐰓 10C13 OLD TURKIC LETTER ORKHON AED +d2 𐰓 10C13 OLD TURKIC LETTER ORKHON AED +13 𐰓 10C13 OLD TURKIC LETTER ORKHON AED +ez 𐰔 10C14 OLD TURKIC LETTER ORKHON EZ +z 𐰔 10C14 OLD TURKIC LETTER ORKHON EZ +14 𐰔 10C14 OLD TURKIC LETTER ORKHON EZ +ay 𐰖 10C16 OLD TURKIC LETTER ORKHON AY +y1 𐰖 10C16 OLD TURKIC LETTER ORKHON AY +16 𐰖 10C16 OLD TURKIC LETTER ORKHON AY +aey 𐰘 10C18 OLD TURKIC LETTER ORKHON AEY +ey 𐰘 10C18 OLD TURKIC LETTER ORKHON AEY +y2 𐰘 10C18 OLD TURKIC LETTER ORKHON AEY +18 𐰘 10C18 OLD TURKIC LETTER ORKHON AEY +aek 𐰚 10C1A OLD TURKIC LETTER ORKHON AEK +k 𐰚 10C1A OLD TURKIC LETTER ORKHON AEK +1a 𐰚 10C1A OLD TURKIC LETTER ORKHON AEK +oek 𐰜 10C1C OLD TURKIC LETTER ORKHON OEK +q 𐰜 10C1C OLD TURKIC LETTER ORKHON OEK +1c 𐰜 10C1C OLD TURKIC LETTER ORKHON OEK +al 𐰞 10C1E OLD TURKIC LETTER ORKHON AL +l1 𐰞 10C1E OLD TURKIC LETTER ORKHON AL +1e 𐰞 10C1E OLD TURKIC LETTER ORKHON AL +ael 𐰠 10C20 OLD TURKIC LETTER ORKHON AEL +el 𐰠 10C20 OLD TURKIC LETTER ORKHON AEL +l2 𐰠 10C20 OLD TURKIC LETTER ORKHON AEL +20 𐰠 10C20 OLD TURKIC LETTER ORKHON AEL +elt 𐰡 10C21 OLD TURKIC LETTER ORKHON ELT +lt 𐰡 10C21 OLD TURKIC LETTER ORKHON ELT +21 𐰡 10C21 OLD TURKIC LETTER ORKHON ELT +em 𐰢 10C22 OLD TURKIC LETTER ORKHON EM +m 𐰢 10C22 OLD TURKIC LETTER ORKHON EM +22 𐰢 10C22 OLD TURKIC LETTER ORKHON EM +an 𐰣 10C23 OLD TURKIC LETTER ORKHON AN +n1 𐰣 10C23 OLD TURKIC LETTER ORKHON AN +23 𐰣 10C23 OLD TURKIC LETTER ORKHON AN +en 𐰤 10C24 OLD TURKIC LETTER ORKHON AEN +n2 𐰤 10C24 OLD TURKIC LETTER ORKHON AEN +24 𐰤 10C24 OLD TURKIC LETTER ORKHON AEN +ent 𐰦 10C26 OLD TURKIC LETTER ORKHON ENT +nt 𐰦 10C26 OLD TURKIC LETTER ORKHON ENT +26 𐰦 10C26 OLD TURKIC LETTER ORKHON ENT +enc 𐰨 10C28 OLD TURKIC LETTER ORKHON ENC +nc 𐰨 10C28 OLD TURKIC LETTER ORKHON ENC +28 𐰨 10C28 OLD TURKIC LETTER ORKHON ENC +eny 𐰪 10C2A OLD TURKIC LETTER ORKHON ENY +ny 𐰪 10C2A OLD TURKIC LETTER ORKHON ENY +2a 𐰪 10C2A OLD TURKIC LETTER ORKHON ENY +eng 𐰭 10C2D OLD TURKIC LETTER ORKHON ENG +ng 𐰭 10C2D OLD TURKIC LETTER ORKHON ENG +2d 𐰭 10C2D OLD TURKIC LETTER ORKHON ENG +ep 𐰯 10C2F OLD TURKIC LETTER ORKHON EP +p 𐰯 10C2F OLD TURKIC LETTER ORKHON EP +2f 𐰯 10C2F OLD TURKIC LETTER ORKHON EP +op 𐰰 10C30 OLD TURKIC LETTER ORKHON OP +up 𐰰 10C30 OLD TURKIC LETTER ORKHON OP +30 𐰰 10C30 OLD TURKIC LETTER ORKHON OP +ic 𐰱 10C31 OLD TURKIC LETTER ORKHON IC +31 𐰱 10C31 OLD TURKIC LETTER ORKHON IC +ec 𐰲 10C32 OLD TURKIC LETTER ORKHON EC +32 𐰲 10C32 OLD TURKIC LETTER ORKHON EC +aq 𐰴 10C34 OLD TURKIC LETTER ORKHON AQ +34 𐰴 10C34 OLD TURKIC LETTER ORKHON AQ +iq 𐰶 10C36 OLD TURKIC LETTER ORKHON IQ +yq 𐰶 10C36 OLD TURKIC LETTER ORKHON IQ +36 𐰶 10C36 OLD TURKIC LETTER ORKHON IQ +oq 𐰸 10C38 OLD TURKIC LETTER ORKHON OQ +uq 𐰸 10C38 OLD TURKIC LETTER ORKHON OQ +38 𐰸 10C38 OLD TURKIC LETTER ORKHON OQ +ar 𐰺 10C3A OLD TURKIC LETTER ORKHON AR +r1 𐰺 10C3A OLD TURKIC LETTER ORKHON AR +3a 𐰺 10C3A OLD TURKIC LETTER ORKHON AR +aer 𐰼 10C3C OLD TURKIC LETTER ORKHON AER +er 𐰼 10C3C OLD TURKIC LETTER ORKHON AER +r2 𐰼 10C3C OLD TURKIC LETTER ORKHON AER +3c 𐰼 10C3C OLD TURKIC LETTER ORKHON AER +as 𐰽 10C3D OLD TURKIC LETTER ORKHON AS +s1 𐰽 10C3D OLD TURKIC LETTER ORKHON AS +3d 𐰽 10C3D OLD TURKIC LETTER ORKHON AS +aes 𐰾 10C3E OLD TURKIC LETTER ORKHON AES +es 𐰾 10C3E OLD TURKIC LETTER ORKHON AES +s2 𐰾 10C3E OLD TURKIC LETTER ORKHON AES +3e 𐰾 10C3E OLD TURKIC LETTER ORKHON AES +ash 𐰿 10C3F OLD TURKIC LETTER ORKHON ASH +sh1 𐰿 10C3F OLD TURKIC LETTER ORKHON ASH +3f 𐰿 10C3F OLD TURKIC LETTER ORKHON ASH +esh 𐱁 10C41 OLD TURKIC LETTER ORKHON ESH +sh2 𐱁 10C41 OLD TURKIC LETTER ORKHON ESH +41 𐱁 10C41 OLD TURKIC LETTER ORKHON ESH +at 𐱃 10C43 OLD TURKIC LETTER ORKHON AT +t1 𐱃 10C43 OLD TURKIC LETTER ORKHON AT +43 𐱃 10C43 OLD TURKIC LETTER ORKHON AT +aet 𐱅 10C45 OLD TURKIC LETTER ORKHON AET +et 𐱅 10C45 OLD TURKIC LETTER ORKHON AET +t2 𐱅 10C45 OLD TURKIC LETTER ORKHON AET +45 𐱅 10C45 OLD TURKIC LETTER ORKHON AET +ot 𐱇 10C47 OLD TURKIC LETTER ORKHON OT +ut 𐱇 10C47 OLD TURKIC LETTER ORKHON OT +47 𐱇 10C47 OLD TURKIC LETTER ORKHON OT +bash 𐱈 10C48 OLD TURKIC LETTER ORKHON BASH +48 𐱈 10C48 OLD TURKIC LETTER ORKHON BASH diff --git a/runtime/keymap/oldturkic-yenisei_utf-8.vim b/runtime/keymap/oldturkic-yenisei_utf-8.vim new file mode 100644 index 0000000000..f939f0a405 --- /dev/null +++ b/runtime/keymap/oldturkic-yenisei_utf-8.vim @@ -0,0 +1,115 @@ +" Maintainer: Oliver Corff <oliver.corff@yemail.de> +" Last Changed: 2018 Feb 12 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "oto" +highlight lCursor guibg=red guifg=NONE + +" map F8 to toggle keymap (Ctrl-^ not present on keyboard) +noremap <F8> :let &iminsert = ! &iminsert<CR> +lnoremap <F8> <C-^> +noremap! <F8> <C-^> + +loadkeymap +A 𐰁 10C01 OLD TURKIC LETTER YENISEI A +01 𐰁 10C01 OLD TURKIC LETTER YENISEI A +AE 𐰂 10C02 OLD TURKIC LETTER YENISEI AE +02 𐰂 10C02 OLD TURKIC LETTER YENISEI AE +I 𐰄 10C04 OLD TURKIC LETTER YENISEI I +04 𐰄 10C04 OLD TURKIC LETTER YENISEI I +E 𐰅 10C05 OLD TURKIC LETTER YENISEI E +05 𐰅 10C05 OLD TURKIC LETTER YENISEI E +OE 𐰈 10C08 OLD TURKIC LETTER YENISEI OE +UE 𐰈 10C08 OLD TURKIC LETTER YENISEI OE +08 𐰈 10C08 OLD TURKIC LETTER YENISEI OE +ab 𐰊 10C0A OLD TURKIC LETTER YENISEI AB +b1 𐰊 10C0A OLD TURKIC LETTER YENISEI AB +0a 𐰊 10C0A OLD TURKIC LETTER YENISEI AB +aeb 𐰌 10C0C OLD TURKIC LETTER YENISEI AEB +eb 𐰌 10C0C OLD TURKIC LETTER YENISEI AEB +b2 𐰌 10C0C OLD TURKIC LETTER YENISEI AEB +0c 𐰌 10C0C OLD TURKIC LETTER YENISEI AEB +ag 𐰎 10C0E OLD TURKIC LETTER YENISEI AG +g1 𐰎 10C0E OLD TURKIC LETTER YENISEI AG +0e 𐰎 10C0E OLD TURKIC LETTER YENISEI AG +aeg 𐰐 10C10 OLD TURKIC LETTER YENISEI AEG +eg 𐰐 10C10 OLD TURKIC LETTER YENISEI AEG +g2 𐰐 10C10 OLD TURKIC LETTER YENISEI AEG +10 𐰐 10C10 OLD TURKIC LETTER YENISEI AEG +ad 𐰒 10C12 OLD TURKIC LETTER YENISEI AD +d1 𐰒 10C12 OLD TURKIC LETTER YENISEI AD +12 𐰒 10C12 OLD TURKIC LETTER YENISEI AD +ez 𐰕 10C15 OLD TURKIC LETTER YENISEI EZ +z 𐰕 10C15 OLD TURKIC LETTER YENISEI EZ +15 𐰕 10C15 OLD TURKIC LETTER YENISEI EZ +ay 𐰗 10C17 OLD TURKIC LETTER YENISEI AY +y1 𐰗 10C17 OLD TURKIC LETTER YENISEI AY +17 𐰗 10C17 OLD TURKIC LETTER YENISEI AY +aey 𐰙 10C19 OLD TURKIC LETTER YENISEI AEY +ey 𐰙 10C19 OLD TURKIC LETTER YENISEI AEY +y2 𐰙 10C19 OLD TURKIC LETTER YENISEI AEY +19 𐰙 10C19 OLD TURKIC LETTER YENISEI AEY +aek 𐰛 10C1B OLD TURKIC LETTER YENISEI AEK +ak 𐰛 10C1B OLD TURKIC LETTER YENISEI AEK +k 𐰛 10C1B OLD TURKIC LETTER YENISEI AEK +1b 𐰛 10C1B OLD TURKIC LETTER YENISEI AEK +oek 𐰝 10C1D OLD TURKIC LETTER YENISEI OEK +ök 𐰝 10C1D OLD TURKIC LETTER YENISEI OEK +uek 𐰝 10C1D OLD TURKIC LETTER YENISEI OEK +ük 𐰝 10C1D OLD TURKIC LETTER YENISEI OEK +1d 𐰝 10C1D OLD TURKIC LETTER YENISEI OEK +al 𐰟 10C1F OLD TURKIC LETTER YENISEI AL +l 𐰟 10C1F OLD TURKIC LETTER YENISEI AL +l1 𐰟 10C1F OLD TURKIC LETTER YENISEI AL +1f 𐰟 10C1F OLD TURKIC LETTER YENISEI AL +aen 𐰥 10C25 OLD TURKIC LETTER YENISEI AEN +en 𐰥 10C25 OLD TURKIC LETTER YENISEI AEN +n2 𐰥 10C25 OLD TURKIC LETTER YENISEI AEN +25 𐰥 10C25 OLD TURKIC LETTER YENISEI AEN +ent 𐰧 10C27 OLD TURKIC LETTER YENISEI ENT +nt 𐰧 10C27 OLD TURKIC LETTER YENISEI ENT +27 𐰧 10C27 OLD TURKIC LETTER YENISEI ENT +enc 𐰩 10C29 OLD TURKIC LETTER YENISEI ENC +nc 𐰩 10C29 OLD TURKIC LETTER YENISEI ENC +29 𐰩 10C29 OLD TURKIC LETTER YENISEI ENC +eny 𐰫 10C2B OLD TURKIC LETTER YENISEI ENY +ny 𐰫 10C2B OLD TURKIC LETTER YENISEI ENY +2b 𐰫 10C2B OLD TURKIC LETTER YENISEI ENY +ang 𐰬 10C2C OLD TURKIC LETTER YENISEI ANG +ng 𐰬 10C2C OLD TURKIC LETTER YENISEI ANG +2c 𐰬 10C2C OLD TURKIC LETTER YENISEI ANG +aeng 𐰮 10C2E OLD TURKIC LETTER YENISEI AENG +eng 𐰮 10C2E OLD TURKIC LETTER YENISEI AENG +2e 𐰮 10C2E OLD TURKIC LETTER YENISEI AENG +ec 𐰳 10C33 OLD TURKIC LETTER YENISEI EC +c 𐰳 10C33 OLD TURKIC LETTER YENISEI EC +33 𐰳 10C33 OLD TURKIC LETTER YENISEI EC +aq 𐰵 10C35 OLD TURKIC LETTER YENISEI AQ +q 𐰵 10C35 OLD TURKIC LETTER YENISEI AQ +35 𐰵 10C35 OLD TURKIC LETTER YENISEI AQ +iq 𐰷 10C37 OLD TURKIC LETTER YENISEI IQ +yq 𐰷 10C37 OLD TURKIC LETTER YENISEI IQ +37 𐰷 10C37 OLD TURKIC LETTER YENISEI IQ +oq 𐰹 10C39 OLD TURKIC LETTER YENISEI OQ +uq 𐰹 10C39 OLD TURKIC LETTER YENISEI OQ +39 𐰹 10C39 OLD TURKIC LETTER YENISEI OQ +ar 𐰻 10C3B OLD TURKIC LETTER YENISEI AR +r 𐰻 10C3B OLD TURKIC LETTER YENISEI AR +r1 𐰻 10C3B OLD TURKIC LETTER YENISEI AR +3b 𐰻 10C3B OLD TURKIC LETTER YENISEI AR +ash 𐱀 10C40 OLD TURKIC LETTER YENISEI ASH +sh1 𐱀 10C40 OLD TURKIC LETTER YENISEI ASH +40 𐱀 10C40 OLD TURKIC LETTER YENISEI ASH +esh 𐱂 10C42 OLD TURKIC LETTER YENISEI ESH +sh2 𐱂 10C42 OLD TURKIC LETTER YENISEI ESH +42 𐱂 10C42 OLD TURKIC LETTER YENISEI ESH +at 𐱄 10C44 OLD TURKIC LETTER YENISEI AT +t1 𐱄 10C44 OLD TURKIC LETTER YENISEI AT +44 𐱄 10C44 OLD TURKIC LETTER YENISEI AT +aet 𐱆 10C46 OLD TURKIC LETTER YENISEI AET +et 𐱆 10C46 OLD TURKIC LETTER YENISEI AET +t2 𐱆 10C46 OLD TURKIC LETTER YENISEI AET +46 𐱆 10C46 OLD TURKIC LETTER YENISEI AET diff --git a/runtime/keymap/pinyin.vim b/runtime/keymap/pinyin.vim index 757850b83f..253814c753 100644 --- a/runtime/keymap/pinyin.vim +++ b/runtime/keymap/pinyin.vim @@ -1,5 +1,5 @@ " Vim Keymap file for Hanyu Pinyin tone marks through numbers. -" Maintainer: Fredrik Roubert <roubert@df.lth.se> +" Maintainer: Fredrik Roubert <fredrik@roubert.name> " Last Changed: February 15, 2004 " All characters are given literally. diff --git a/runtime/keymap/russian-jcukenmac.vim b/runtime/keymap/russian-jcukenmac.vim new file mode 100644 index 0000000000..e2120ca1d4 --- /dev/null +++ b/runtime/keymap/russian-jcukenmac.vim @@ -0,0 +1,94 @@ +" Vim Keymap file for russian characters, layout 'jcuken', Mac variant + +" Derived from russian-jcuken.vim by Artem Chuprina <ran@ran.pp.ru> +" Maintainer: Anton Fonarev <avfonarev@gmail.com> +" Last Changed: 2016 August 17 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. + +scriptencoding utf-8 + +let b:keymap_name = "ru" + +loadkeymap + +\| Ё CYRILLIC CAPITAL LETTER IO +\\ ё CYRILLIC SMALL LETTER IO + +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B И CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Х CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Щ CYRILLIC CAPITAL LETTER SHCHA +} Ъ CYRILLIC CAPITAL LETTER HARD SIGN +S Ы CYRILLIC CAPITAL LETTER YERU +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Э CYRILLIC CAPITAL LETTER E +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b и CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o щ CYRILLIC SMALL LETTER SHCHA +] ъ CYRILLIC SMALL LETTER HARD SIGN +s ы CYRILLIC SMALL LETTER YERU +m ь CYRILLIC SMALL LETTER SOFT SIGN +' э CYRILLIC SMALL LETTER E +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA + +§ > +± < +@ " +# № +$ % +% : +^ , +& . +* ; +` ] +~ [ diff --git a/runtime/keymap/russian-jcukenwintype.vim b/runtime/keymap/russian-jcukenwintype.vim new file mode 100644 index 0000000000..dc553af99c --- /dev/null +++ b/runtime/keymap/russian-jcukenwintype.vim @@ -0,0 +1,104 @@ +" Vim Keymap file for russian characters, layout 'jcuken', MS Windows variant +" (slightly incompatible with XFree86 'ru' keymap - makes use of NUMERO SIGN) +" Useful mainly with utf-8 but may work with other encodings + +" Derived from russian-jcuken.vim by Artem Chuprina <ran@ran.pp.ru> +" Typewriter variant of standart russian layout +" Maintainer: Denis Proskurin <danwerspb@gmail.com> +" Last Changed: 2015 May 15 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. + +scriptencoding utf-8 + +let b:keymap_name = "ru" + +loadkeymap +~ + CYRILLIC CAPITAL LETTER IO +` | CYRILLIC SMALL LETTER IO +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B И CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Х CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Щ CYRILLIC CAPITAL LETTER SHCHA +} Ъ CYRILLIC CAPITAL LETTER HARD SIGN +S Ы CYRILLIC CAPITAL LETTER YERU +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Э CYRILLIC CAPITAL LETTER E +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b и CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o щ CYRILLIC SMALL LETTER SHCHA +] ъ CYRILLIC SMALL LETTER HARD SIGN +s ы CYRILLIC SMALL LETTER YERU +m ь CYRILLIC SMALL LETTER SOFT SIGN +' э CYRILLIC SMALL LETTER E +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA +@ " +# № NUMERO SIGN +$ ; +^ : +& ? +/ ё +? Ё +1 № +2 - +3 / +4 " +5 : +6 , +7 . +8 _ +9 ? +0 % +- ! += ; +\\ ) +\| ( diff --git a/runtime/keymap/vietnamese-telex_utf-8.vim b/runtime/keymap/vietnamese-telex_utf-8.vim new file mode 100644 index 0000000000..f9fd055d14 --- /dev/null +++ b/runtime/keymap/vietnamese-telex_utf-8.vim @@ -0,0 +1,196 @@ +" Vim Keymap file for Vietnamese through Telex method +" Maintainer: Raphael McSinyx <vn.mcsinyx@gmail.com> +" Last Change: 2016-06-13 + +scriptencoding utf-8 + +let b:keymap_name = "vi" + +loadkeymap + +A\\ A +AF À +AS Á +AR Ả +AX à +AJ Ạ + +AW Ă +AW\\ Ă +AWF Ằ +AWS Ắ +AWR Ẳ +AWX Ẵ +AWJ Ặ + +AA  +AA\\  +AAF Ầ +AAS Ấ +AAR Ẩ +AAX Ẫ +AAJ Ậ + +D\\ D +DD Đ + +E E +E\\ E +EF È +ES É +ER Ẻ +EX Ẽ +EJ Ẹ + +EE Ê +EE\\ Ê +EEF Ề +EES Ế +EER Ể +EEX Ễ +EEJ Ệ + +I\\ I +IF Ì +IS Í +IR Ỉ +IX Ĩ +IJ Ị + +O\\ O +OF Ò +OS Ó +OR Ỏ +OX Õ +OJ Ọ + +OO Ô +OO\\ Ô +OOF Ồ +OOS Ố +OOR Ổ +OOX Ỗ +OOJ Ộ + +OW Ơ +OW\\ Ơ +OWF Ờ +OWS Ớ +OWR Ở +OWX Ỡ +OWJ Ợ + +U\\ U +UF Ù +US Ú +UR Ủ +UX Ũ +UJ Ụ + +UW Ư +UW\\ Ư +UWF Ừ +UWS Ứ +UWR Ử +UWX Ữ +UWJ Ự + +Y\\ Y +YF Ỳ +YS Ý +YR Ỷ +YX Ỹ +YJ Ỵ + +a\\ a +af à +as á +ar ả +ax ã +aj ạ + +aw ă +aw\\ ă +awf ằ +aws ắ +awr ẳ +awx ẵ +awj ặ + +aa â +aa\\ â +aaf ầ +aas ấ +aar ẩ +aax ẫ +aaj ậ + +d\\ d +dd đ + +e\\ e +ef è +es é +er ẻ +ex ẽ +ej ẹ + +ee ê +ee\\ ê +eef ề +ees ế +eer ể +eex ễ +eej ệ + +i\\ i +if ì +is í +ir ỉ +ix ĩ +ij ị + +o\\ o +of ò +os ó +or ỏ +ox õ +oj ọ + +oo ô +oo\\ ô +oof ồ +oos ố +oor ổ +oox ỗ +ooj ộ + +ow ơ +ow\\ ơ +owf ờ +ows ớ +owr ở +owx ỡ +owj ợ + +u\\ u +uf ù +us ú +ur ủ +ux ũ +uj ụ + +uw ư +uw\\ ư +uwf ừ +uws ứ +uwr ử +uwx ữ +uwj ự + +y\\ y +yf ỳ +ys ý +yr ỷ +yx ỹ +yj ỵ diff --git a/runtime/keymap/vietnamese-vni_utf-8.vim b/runtime/keymap/vietnamese-vni_utf-8.vim new file mode 100644 index 0000000000..c9312c6854 --- /dev/null +++ b/runtime/keymap/vietnamese-vni_utf-8.vim @@ -0,0 +1,196 @@ +" Vim Keymap file for Vietnamese through VNI method +" Maintainer: Raphael McSinyx <vn.mcsinyx@gmail.com> +" Last Change: 2016-06-13 + +scriptencoding utf-8 + +let b:keymap_name = "vi" + +loadkeymap + +A\\ A +A1 Á +A2 À +A3 Ả +A4 à +A5 Ạ + +A8 Ă +A8\\ Ă +A81 Ắ +A82 Ằ +A83 Ẳ +A84 Ẵ +A85 Ặ + +A6  +A6\\  +A61 Ấ +A62 Ầ +A63 Ẩ +A64 Ẫ +A65 Ậ + +D D +D\\ D +D9 Đ + +E\\ E +E1 É +E2 È +E3 Ẻ +E4 Ẽ +E5 Ẹ + +E6 Ê +E6\\ Ê +E61 Ế +E62 Ề +E63 Ể +E64 Ễ +E65 Ệ + +I\\ I +I1 Í +I2 Ì +I3 Ỉ +I4 Ĩ +I5 Ị + +O\\ O +O1 Ó +O2 Ò +O3 Ỏ +O4 Õ +O5 Ọ + +O6 Ô +O6\\ Ô +O61 Ố +O62 Ồ +O63 Ổ +O64 Ỗ +O65 Ộ + +O7 Ơ +O7\\ Ơ +O71 Ớ +O72 Ờ +O73 Ở +O74 Ỡ +O75 Ợ + +U\\ U +U1 Ú +U2 Ù +U3 Ủ +U4 Ũ +U5 Ụ + +U7 Ư +U7\\ Ư +U71 Ứ +U72 Ừ +U73 Ử +U74 Ữ +U75 Ự + +Y\\ Y +Y1 Ý +Y2 Ỳ +Y3 Ỷ +Y4 Ỹ +Y5 Ỵ + +a\\ a +a1 á +a2 à +a3 ả +a4 ã +a5 ạ + +a8 ă +a8\\ ă +a81 ắ +a82 ằ +a83 ẳ +a84 ẵ +a85 ặ + +a6 â +a6\\ â +a61 ấ +a62 ầ +a63 ẩ +a64 ẫ +a65 ậ + +d\\ d +d9 đ + +e\\ e +e1 é +e2 è +e3 ẻ +e4 ẽ +e5 ẹ + +e6 ê +e6\\ ê +e61 ế +e62 ề +e63 ể +e64 ễ +e65 ệ + +i\\ i +i1 í +i2 ì +i3 ỉ +i4 ĩ +i5 ị + +o\\ o +o1 ó +o2 ò +o3 ỏ +o4 õ +o5 ọ + +o6 ô +o6\\ ô +o61 ố +o62 ồ +o63 ổ +o64 ỗ +o65 ộ + +o7 ơ +o7\\ ơ +o71 ớ +o72 ờ +o73 ở +o74 ỡ +o75 ợ + +u\\ u +u1 ú +u2 ù +u3 ủ +u4 ũ +u5 ụ + +u7 ư +u7\\ ư +u71 ứ +u72 ừ +u73 ử +u74 ữ +u75 ự + +y\\ y +y1 ý +y2 ỳ +y3 ỷ +y4 ỹ +y5 ỵ diff --git a/runtime/lang/menu_chinese_gb.936.vim b/runtime/lang/menu_chinese_gb.936.vim index e636a42319..b3276b5365 100644 --- a/runtime/lang/menu_chinese_gb.936.vim +++ b/runtime/lang/menu_chinese_gb.936.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese <i18n-translation@lists.linux.net.cn> -" Translated By: Yuheng Xie <elephant@linux.net.cn> -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai <baishunde@gmail.com> +" Previous Maintainer: Yuheng Xie <elephant@linux.net.cn> +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -90,13 +91,14 @@ menutrans Toggle\ &Right\ Scrollbar menutrans F&ile\ Settings ļ趨(&I) " Boolean options -menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! /ʾк(&N)<Tab>:set\ nu! -menutrans Toggle\ &List\ Mode<Tab>:set\ list! /\ list\ ģʽ(&L)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! /(&W)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! /(&R)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! /չ\ tab(&E)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! /Զ(&A)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! /\ C\ (&C)<Tab>:set\ cin! +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! /ʾк(&N)<Tab>:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! /к(&V)<Tab>:set\ rnu! +menutrans Toggle\ &List\ Mode<Tab>:set\ list! /\ list\ ģʽ(&L)<Tab>:set\ list! +menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! /(&W)<Tab>:set\ wrap! +menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! /(&R)<Tab>:set\ lbr! +menutrans Toggle\ &expand-tab<Tab>:set\ et! /չ\ tab(&E)<Tab>:set\ et! +menutrans Toggle\ &auto-indent<Tab>:set\ ai! /Զ(&A)<Tab>:set\ ai! +menutrans Toggle\ &C-indenting<Tab>:set\ cin! /\ C\ (&C)<Tab>:set\ cin! " other options menutrans &Shiftwidth (&S) diff --git a/runtime/lang/menu_fr_fr.latin1.vim b/runtime/lang/menu_fr_fr.latin1.vim index c4b63c7833..940bd96545 100644 --- a/runtime/lang/menu_fr_fr.latin1.vim +++ b/runtime/lang/menu_fr_fr.latin1.vim @@ -2,7 +2,7 @@ " Maintainer: Adrien Beau <version.francaise@free.fr> " First Version: Francois Thunus <thunus@systran.fr> " Last Modification: David Blanchet <david.blanchet@free.fr> -" Last Change: 2012 May 01 +" Last Change: 2018 Apr 25 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -47,7 +47,7 @@ menutrans &Close<Tab>:close &Fermer<Tab>:close menutrans &Save<Tab>:w &Enregistrer<Tab>:w menutrans Save\ &As\.\.\.<Tab>:sav Enregistrer\ &sous\.\.\.<Tab>:sav " -SEP2- -menutrans Split\ &Diff\ with\.\.\. &Difference\ avec\.\.\. +menutrans Split\ &Diff\ with\.\.\. &Diffrence\ avec\.\.\. "menutrans Split\ Patched\ &By\.\.\. &Patcher\ avec\.\.\. menutrans Split\ Patched\ &By\.\.\. &Tester\ un\ patch\.\.\. " -SEP3- @@ -121,7 +121,7 @@ menutrans Soft\ &Tabstop &Pseudo-tabulations menutrans Te&xt\ Width\.\.\. Largeur\ du\ te&xte\.\.\. menutrans &File\ Format\.\.\. Format\ du\ &fichier\.\.\. -let g:menutrans_textwidth_dialog = "Entrez la nouvelle largeur du texte\n(0 pour dsactiver le formattage)." +let g:menutrans_textwidth_dialog = "Entrez la nouvelle largeur du texte\n(0 pour dsactiver le formatage)." let g:menutrans_fileformat_dialog = "Choisissez le format dans lequel crire le fichier." let g:menutrans_fileformat_choices = " &Unix \n &Dos \n &Mac \n &Annuler " @@ -340,7 +340,7 @@ fun! Do_toolbar_tmenu() tmenu ToolBar.WinClose Fermer fentre endif tmenu ToolBar.LoadSesn Ouvrir session - tmenu ToolBar.SaveSesn Enregister session courante + tmenu ToolBar.SaveSesn Enregistrer session courante tmenu ToolBar.RunScript Lancer un script Vim tmenu ToolBar.Make Lancer make tmenu ToolBar.RunCtags Crer les tiquettes diff --git a/runtime/lang/menu_it_it.latin1.vim b/runtime/lang/menu_it_it.latin1.vim index 092136bf0b..8dec38bb14 100644 --- a/runtime/lang/menu_it_it.latin1.vim +++ b/runtime/lang/menu_it_it.latin1.vim @@ -2,7 +2,7 @@ " Maintainer: Antonio Colombo <azc100@gmail.com> " Vlad Sandrini <vlad.gently@gmail.com> " Luciano Montanaro <mikelima@cirulla.net> -" Last Change: 2012 May 01 +" Last Change: 2018 May 16 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -16,87 +16,92 @@ scriptencoding iso-8859-1 " Help / Aiuto menut &Help &Aiuto + menut &Overview<Tab><F1> &Panoramica<Tab><F1> menut &User\ Manual Manuale\ &Utente menut &How-to\ links Co&Me\.\.\. -"menut &GUI &GUI +menut &Find\.\.\. &Cerca\.\.\. +" -SEP1- menut &Credits Cr&Editi menut Co&pying C&Opie -menut &Sponsor/Register &Sponsor/registrazione +menut &Sponsor/Register &Sponsor/Registrazione menut O&rphans O&Rfani -"menut &Find\.\.\. &Cerca\.\.\. -"NOTA: fa conflitto con 'cerca' nel menu 'modifica' +" -SEP2- menut &Version &Versione menut &About &Intro let g:menutrans_help_dialog = "Batti un comando o una parola per cercare aiuto:\n\nPremetti i_ per comandi in modo Input (ad.es.: i_CTRL-X)\nPremetti c_ per comandi che editano la linea-comandi (ad.es.: c_<Del>)\nPremetti ' per un nome di opzione (ad.es.: 'shiftwidth')" -" File menu -"menut &File &File -" +" File / File +menut &File &File + menut &Open\.\.\.<Tab>:e &Apri\.\.\.<Tab>:e -menut Sp&lit-Open\.\.\.<Tab>:sp A&Pri\ nuova\ finestra\.\.\.<Tab>:sp -menut Open\ Tab\.\.\.<Tab>:tabnew Apri\ nuova\ &Linguetta\.\.\.<Tab>:tabnew -menut &New<Tab>:enew &Nuovo<Tab>:enew -menut &Close<Tab>:close &Chiudi<Tab>:close +menut Sp&lit-Open\.\.\.<Tab>:sp A&Pri\ nuova\ finestra\.\.\.<Tab>:sp +menut Open\ Tab\.\.\.<Tab>:tabnew Apri\ nuova\ &Linguetta\.\.\.<Tab>:tabnew +menut &New<Tab>:enew &Nuovo<Tab>:enew +menut &Close<Tab>:close &Chiudi<Tab>:close +" -SEP1- menut &Save<Tab>:w &Salva<Tab>:w -menut Save\ &As\.\.\.<Tab>:sav Salva\ &Con\ nome\.\.\.<Tab>:sav - -if has("diff") - menut Split\ &Diff\ with\.\.\. Finestra\ &Differenza\ con\.\.\. - menut Split\ Patched\ &By\.\.\. Finestra\ patc&H\ da\.\.\. -endif - -menut &Print S&tampa +menut Save\ &As\.\.\.<Tab>:sav Salva\ &Con\ nome\.\.\.<Tab>:sav +" -SEP2- +menut Split\ &Diff\ with\.\.\. &Differenza\ con\.\.\. +menut Split\ Patched\ &By\.\.\. Patc&H\ da\.\.\. +" -SEP3- +menut &Print S&tampa +" -SEP4- menut Sa&ve-Exit<Tab>:wqa Sa&Lva\ ed\ esci<Tab>:wqa menut E&xit<Tab>:qa &Esci<Tab>:qa " Edit / Modifica - menut &Edit &Modifica + menut &Undo<Tab>u &Annulla<Tab>u menut &Redo<Tab>^R &Ripristina<Tab>^R -menut Rep&eat<Tab>\. Ri&Peti<Tab>\. +menut Rep&eat<Tab>\. Ri&Peti<Tab>\. +" -SEP1- menut Cu&t<Tab>"+x &Taglia<Tab>"+x menut &Copy<Tab>"+y &Copia<Tab>"+y -menut &Paste<Tab>"+gP &Incolla<Tab>"+gP +menut &Paste<Tab>"+gP &Incolla<Tab>"+gP menut Put\ &Before<Tab>[p &Metti\ davanti<Tab>[p menut Put\ &After<Tab>]p M&Etti\ dietro<Tab>]p menut &Delete<Tab>x Cance&Lla<Tab>x menut &Select\ all<Tab>ggVG Seleziona\ &Tutto<Tab>ggVG -menut &Select\ All<Tab>ggVG Seleziona\ &Tutto<Tab>ggVG +" -SEP2- menut &Find\.\.\. &Cerca\.\.\. -menut Find\ and\ Rep&lace\.\.\. &Sostituisci\.\.\. -menut Settings\ &Window &Finestra\ impostazioni -menut Startup\ &Settings Impostazioni\ di\ &Avvio -menut &Global\ Settings Impostazioni\ &Globali -menut Question Domanda - -" Edit / Modifica Impostazioni Globali -menut &Global\ Settings Impostazioni\ &Globali -menut Toggle\ Pattern\ &Highlight<Tab>:set\ hls! &Evidenzia\ ricerche\ S/No<Tab>:set\ hls! -menut Toggle\ &Ignore-case<Tab>:set\ ic! &Ignora\ maiusc\.-minusc\.\ S/No<Tab>:set\ ic! -menut Toggle\ &Showmatch<Tab>:set\ sm! Indica\ &Corrispondente\ S/No<Tab>:set\ sm! +menut &Find\.\.\.<Tab>/ &Cerca\.\.\.<Tab>/ +menut Find\ and\ Rep&lace\.\.\. &Sostituisci\.\.\. +menut Find\ and\ Rep&lace\.\.\.<Tab>:%s &Sostituisci\.\.\.<Tab>:%s +menut Find\ and\ Rep&lace\.\.\.<Tab>:s &Sostituisci\.\.\.<Tab>:s +" -SEP3- +menut Settings\ &Window &Finestra\ Impostazioni +menut Startup\ &Settings Impostazioni\ di\ &Avvio +menut &Global\ Settings Impostazioni\ &Globali +menut Question Domanda + +" Edit / Modifica / Impostazioni Globali -menut &Context\ lines &Linee\ di\ contesto -menut &Virtual\ Edit &Edit\ virtuale +menut Toggle\ Pattern\ &Highlight<Tab>:set\ hls! &Evidenzia\ ricerche\ S/No<Tab>:set\ hls! +menut Toggle\ &Ignoring\ Case<Tab>:set\ ic! &Ignora\ maiusc\.-minusc\.\ S/No<Tab>:set\ ic! +menut Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! Indica\ &Corrispondenze\ S/No<Tab>:set\ sm! -menut Never Mai -menut Block\ Selection Selezione\ blocco -menut Insert\ mode Modo\ insert -menut Block\ and\ Insert Selezione\ blocco+inserimento -menut Always Sempre +menut &Context\ lines &Linee\ di\ contesto -menut Toggle\ Insert\ &Mode<Tab>:set\ im! &Modo\ insert\ S/No<Tab>:set\ im! -menut Toggle\ Vi\ C&ompatible<Tab>:set\ cp! C&Ompatibile\ VI\ S/No<Tab>:set\ cp! +menut &Virtual\ Edit &Edit\ virtuale +menut Never Mai +menut Block\ Selection Selezione\ Blocco +menut Insert\ mode Modo\ Insert +menut Block\ and\ Insert Selezione\ Blocco\ e\ Inserimento +menut Always Sempre + +menut Toggle\ Insert\ &Mode<Tab>:set\ im! &Modo\ Insert\ S/No<Tab>:set\ im! +menut Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! C&Ompatibilit\ VI\ S/No<Tab>:set\ cp! menut Search\ &Path\.\.\. &Percorso\ di\ ricerca\.\.\. menut Ta&g\ Files\.\.\. File\ ta&G\.\.\. -" -" Opzioni GUI -menut Toggle\ &Toolbar Barra\ s&Trumenti\ S/No +" -SEP1- +menut Toggle\ &Toolbar Barra\ s&Trumenti\ S/No menut Toggle\ &Bottom\ Scrollbar Barra\ scorrimento\ in\ &Fondo\ S/No -menut Toggle\ &Left\ Scrollbar Barra\ scorrimento\ a\ &Sinistra\ S/No -menut Toggle\ &Right\ Scrollbar Barra\ scorrimento\ a\ &Destra\ S/No +menut Toggle\ &Left\ Scrollbar Barra\ scorrimento\ a\ &Sinistra\ S/No +menut Toggle\ &Right\ Scrollbar Barra\ scorrimento\ a\ &Destra\ S/No let g:menutrans_path_dialog = "Batti percorso di ricerca per i file.\nSepara fra loro i nomi di directory con una virgola." let g:menutrans_tags_dialog = "Batti nome dei file di tag.\nSepara fra loro i nomi di directory con una virgola." @@ -105,67 +110,103 @@ let g:menutrans_tags_dialog = "Batti nome dei file di tag.\nSepara fra loro i no menut F&ile\ Settings &Impostazioni\ file " Boolean options -menut Toggle\ Line\ &Numbering<Tab>:set\ nu! &Numerazione\ \ S/No<Tab>:set\ nu! -menut Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! Numerazione\ relati&Va\ S/No<Tab>:set\ rnu! +menut Toggle\ Line\ &Numbering<Tab>:set\ nu! &Numerazione\ S/No<Tab>:set\ nu! +menut Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! Numerazione\ relati&Va\ S/No<Tab>:set\ rnu! menut Toggle\ &List\ Mode<Tab>:set\ list! Modo\ &List\ S/No<Tab>:set\ list! -menut Toggle\ Line\ &Wrap<Tab>:set\ wrap! Linee\ &Continuate\ S/No<Tab>:set\ wrap! -menut Toggle\ W&rap\ at\ word<Tab>:set\ lbr! A\ capo\ alla\ &Parola\ S/No<Tab>:set\ lbr! -menut Toggle\ &expand-tab<Tab>:set\ et! &Espandi\ tabulazione\ S/No<Tab>:set\ et! -menut Toggle\ &auto-indent<Tab>:set\ ai! Indentazione\ &Automatica\ S/No<Tab>:set ai! -menut Toggle\ &C-indenting<Tab>:set\ cin! Indentazione\ stile\ &C\ S/No<Tab>:set cin! - -" altre opzioni -menut &Shiftwidth &Spazi\ rientranza -menut Soft\ &Tabstop &Tabulazione\ software -menut Te&xt\ Width\.\.\. Lunghe&Zza\ riga\.\.\. -menut &File\ Format\.\.\. Formato\ &File\.\.\. +menut Toggle\ Line\ &Wrapping<Tab>:set\ wrap! Linee\ &Continuate\ S/No<Tab>:set\ wrap! +menut Toggle\ W&rapping\ at\ word<Tab>:set\ lbr! A\ capo\ alla\ &Parola\ S/No<Tab>:set\ lbr! +menut Toggle\ Tab\ &expanding<Tab>:set\ et! &Espandi\ Tabulazione\ S/No<Tab>:set\ et! +menut Toggle\ &Auto\ Indenting<Tab>:set\ ai! Indentazione\ &Automatica\ S/No<Tab>:set ai! +menut Toggle\ &C-Style\ Indenting<Tab>:set\ cin! Indentazione\ stile\ &C\ S/No<Tab>:set cin! +" -SEP2- +menut &Shiftwidth &Spazi\ rientranza +"menut &Shiftwidth.2<Tab>:set\ sw=2\ sw?<CR> &Spazi\ rientranza.2<Tab>:set\ sw=2\ sw?<CR> +"menut &Shiftwidth.3<Tab>:set\ sw=3\ sw?<CR> &Spazi\ rientranza.3<Tab>:set\ sw=3\ sw?<CR> +"menut &Shiftwidth.4<Tab>:set\ sw=4\ sw?<CR> &Spazi\ rientranza.4<Tab>:set\ sw=4\ sw?<CR> +"menut &Shiftwidth.5<Tab>:set\ sw=5\ sw?<CR> &Spazi\ rientranza.5<Tab>:set\ sw=5\ sw?<CR> +"menut &Shiftwidth.6<Tab>:set\ sw=6\ sw?<CR> &Spazi\ rientranza.6<Tab>:set\ sw=6\ sw?<CR> +"menut &Shiftwidth.8<Tab>:set\ sw=8\ sw?<CR> &Spazi\ rientranza.8<Tab>:set\ sw=8\ sw?<CR> +menut Soft\ &Tabstop &Tabulazione\ software +"menut Soft\ &Tabstop.2<Tab>:set\ sts=2\ sts? &Tabulazione\ software.2<Tab>:set\ sts=2\ sts? +"menut Soft\ &Tabstop.3<Tab>:set\ sts=3\ sts? &Tabulazione\ software.3<Tab>:set\ sts=3\ sts? +"menut Soft\ &Tabstop.4<Tab>:set\ sts=4\ sts? &Tabulazione\ software.4<Tab>:set\ sts=4\ sts? +"menut Soft\ &Tabstop.5<Tab>:set\ sts=5\ sts? &Tabulazione\ software.5<Tab>:set\ sts=5\ sts? +"menut Soft\ &Tabstop.6<Tab>:set\ sts=6\ sts? &Tabulazione\ software.6<Tab>:set\ sts=6\ sts? +"menut Soft\ &Tabstop.8<Tab>:set\ sts=8\ sts? &Tabulazione\ software.8<Tab>:set\ sts=8\ sts? +menut Te&xt\ Width\.\.\. Lunghe&Zza\ riga\.\.\. +menut &File\ Format\.\.\. Formato\ &File\.\.\. let g:menutrans_textwidth_dialog = "Batti nuova lunghezza linea (0 per inibire la formattazione): " - let g:menutrans_fileformat_dialog = "Scegli formato con cui scrivere il file" +let g:menutrans_fileformat_choices = " &Unix \n &Dos \n &Mac \n &Annullare " +menut Show\ C&olor\ Schemes\ in\ Menu Mostra\ Schemi\ C&olore\ in\ Men menut C&olor\ Scheme Schema\ c&Olori -menut default normale -menut DEFAULT NORMALE -menut evening notturno -menut EVENING NOTTURNO -menut morning diurno -menut MORNING DIURNO +menut blue bl +menut darkblue bl\ scuro +menut desert deserto +menut elflord signore\ degli\ elfi +menut evening sera +menut industry industria +menut morning mattino +menut peachpuff pesca menut shine brillante +menut slate ardesia +menut BLUE BL +menut DARKBLUE BL\ SCURO +menut DESERT DESERTO +menut ELFLORD SIGNORE\ DEGLI\ ELFI +menut EVENING SERA +menut INDUSTRY INDUSTRIA +menut MORNING MATTINO +menut PEACHPUFF PESCA menut SHINE BRILLANTE -menut peachpuff pesca -menut PEACHPUF PESCA - -menut &Keymap &Mappa\ tastiera - -menut None nessuna -menut accents accenti -menut ACCENTS ACCENTI -menut hebrew ebraico -menut HEBREW EBRAICO -menut hebrew_iso-8859-8 ebraico_iso-8859-8 -menut hebrew_cp1255 ebraico_cp1255 -menut hebrew_utf-8 ebraico_utf-8 -menut hebrewp_iso-8859-8 ebraico_p_iso-8859-8 -menut HEBREW- EBRAICO+ -menut hebrewp EBRAICOP -menut HEBREWP EBRAICOP -menut russian-jcuken cirillico-jcuken -menut russian-jcukenwin cirillico-jcuken-win -menut RUSSIAN CIRILLICO -menut RUSSIAN- CIRILLICO- +menut SLATE ARDESIA + +menut Show\ &Keymaps\ in\ Menu Mostra\ Ma&ppe\ tastiera\ in\ Men +menut &Keymap Ma&ppa\ tastiera + +menut None nessuna +menut accents accenti +menut arabic arabo +menut armenian-eastern armeno-orientale +menut armenian-western armeno-occidentale +menut belarusian-jcuken bielorusso-jcuken +menut czech ceco +menut greek greco +menut hebrew ebraico +menut hebrewp ebraicop +menut magyar ungherese +menut persian persiano +menut serbian serbo +menut serbian-latin serbo-latino +menut slovak slovacco +menut ACCENTS ACCENTI +menut ARABIC ARABO +menut ARMENIAN-EASTERN ARMENO-ORIENTALE +menut ARMENIAN-WESTERN ARMENO-OCCIDENTALE +menut BELARUSIAN-JCUKEN BIELORUSSO-JCUKEN +menut CZECH CECO +menut GREEK GRECO +menut HEBREW EBRAICO +menut HEBREWP EBRAICOP +menut MAGYAR UNGHERESE +menut PERSIAN PERSIANO +menut SERBIAN SERBO +menut SERBIAN-LATIN SERBO-LATINO +menut SLOVAK SLOVACCO menut Select\ Fo&nt\.\.\. Scegli\ &Font\.\.\. -" Menu strumenti programmazione -menut &Tools &Strumenti +" Men strumenti programmazione +menut &Tools &Strumenti menut &Jump\ to\ this\ tag<Tab>g^] &Vai\ a\ questa\ tag<Tab>g^] menut Jump\ &back<Tab>^T Torna\ &Indietro<Tab>^T menut Build\ &Tags\ File Costruisci\ file\ &Tags\ - -" Menu ortografia / Spelling +" -SEP1- +" Men ortografia / Spelling menut &Spelling &Ortografia menut &Spell\ Check\ On Attiva\ &Controllo\ ortografico @@ -180,46 +221,43 @@ menut Set\ language\ to\ "en_ca" Imposta\ lingua\ a\ "en_ca" menut Set\ language\ to\ "en_gb" Imposta\ lingua\ a\ "en_gb" menut Set\ language\ to\ "en_nz" Imposta\ lingua\ a\ "en_nz" menut Set\ language\ to\ "en_us" Imposta\ lingua\ a\ "en_us" -menut Set\ language\ to\ "it" Imposta\ lingua\ a\ "it" -menut Set\ language\ to\ "it_it" Imposta\ lingua\ a\ "it_it" -menut Set\ language\ to\ "it_ch" Imposta\ lingua\ a\ "it_ch" menut &Find\ More\ Languages &Trova\ altre\ lingue -" Menu piegature / Fold -if has("folding") - menut &Folding &Piegature - " apri e chiudi piegature - menut &Enable/Disable\ folds<Tab>zi Pi&egature\ S/No<Tab>zi - menut &View\ Cursor\ Line<Tab>zv &Vedi\ linea\ col\ Cursore<Tab>zv - menut Vie&w\ Cursor\ Line\ only<Tab>zMzx Vedi\ &Solo\ linea\ col\ Cursore<Tab>zMzx - menut C&lose\ more\ folds<Tab>zm C&Hiudi\ pi\ piegature<Tab>zm - menut &Close\ all\ folds<Tab>zM &Chiudi\ tutte\ le\ piegature<Tab>zM - menut O&pen\ more\ folds<Tab>zr A&Pri\ pi\ piegature<Tab>zr - menut &Open\ all\ folds<Tab>zR &Apri\ tutte\ le\ piegature<Tab>zR - " metodo piegatura - menut Fold\ Met&hod Meto&Do\ piegatura - menut M&anual &Manuale - menut I&ndent &Nidificazione - menut E&xpression &Espressione\ Reg\. - menut S&yntax &Sintassi - menut &Diff &Differenza - menut Ma&rker Mar&Catura - " crea e cancella piegature - menut Create\ &Fold<Tab>zf Crea\ &Piegatura<Tab>zf - menut &Delete\ Fold<Tab>zd &Leva\ piegatura<Tab>zd - menut Delete\ &All\ Folds<Tab>zD Leva\ &Tutte\ le\ piegature<Tab>zD - " movimenti all'interno delle piegature - menut Fold\ col&umn\ width Larghezza\ piegat&Ure\ in\ colonne -endif " has folding - -if has("diff") - menut &Diff &Differenza - " - menut &Update &Aggiorna - menut &Get\ Block &Importa\ differenze - menut &Put\ Block &Esporta\ differenze -endif " has diff +" Men piegature / Fold +menut &Folding &Piegature +" apri e chiudi piegature +menut &Enable/Disable\ folds<Tab>zi Pi&egature\ S/No<Tab>zi +menut &View\ Cursor\ Line<Tab>zv &Vedi\ linea\ col\ Cursore<Tab>zv +menut Vie&w\ Cursor\ Line\ only<Tab>zMzx Vedi\ &Solo\ linea\ col\ Cursore<Tab>zMzx +menut C&lose\ more\ folds<Tab>zm C&Hiudi\ pi\ piegature<Tab>zm +menut &Close\ all\ folds<Tab>zM &Chiudi\ tutte\ le\ piegature<Tab>zM +menut O&pen\ more\ folds<Tab>zr A&Pri\ pi\ piegature<Tab>zr +menut &Open\ all\ folds<Tab>zR &Apri\ tutte\ le\ piegature<Tab>zR +" -SEP1- +" metodo piegatura +menut Fold\ Met&hod Meto&Do\ piegatura +menut M&anual &Manuale +menut I&ndent &Nidificazione +menut E&xpression &Espressione\ Reg\. +menut S&yntax &Sintassi +menut &Diff &Differenza +menut Ma&rker Mar&Catura + +" crea e cancella piegature +menut Create\ &Fold<Tab>zf Crea\ &Piegatura<Tab>zf +menut &Delete\ Fold<Tab>zd &Leva\ piegatura<Tab>zd +menut Delete\ &All\ Folds<Tab>zD Leva\ &Tutte\ le\ piegature<Tab>zD +" -SEP2- +" movimenti all'interno delle piegature +menut Fold\ col&umn\ width Larghezza\ piegat&Ure\ in\ colonne + +menut &Diff &Differenza +" +menut &Update &Aggiorna +menut &Get\ Block &Importa\ differenze +menut &Put\ Block &Esporta\ differenze +" -SEP2- menut &Make<Tab>:make Esegui\ &Make<Tab>:make menut &List\ Errors<Tab>:cl Lista\ &Errori<Tab>:cl @@ -235,56 +273,59 @@ menut &Update<Tab>:cwin A&Ggiorna<Tab>:cwin menut &Open<Tab>:copen &Apri<Tab>:copen menut &Close<Tab>:cclose &Chiudi<Tab>:cclose +" -SEP3- menut &Convert\ to\ HEX<Tab>:%!xxd &Converti\ a\ esadecimale<Tab>:%!xxd menut Conve&rt\ back<Tab>:%!xxd\ -r Conve&rti\ da\ esadecimale<Tab>:%!xxd\ -r menut Se&T\ Compiler Impo&Sta\ Compilatore " Buffers / Buffer -menut &Buffers &Buffer +menut &Buffers &Buffer -menut &Refresh\ menu A&ggiorna\ menu -menut &Delete &Elimina +menut &Refresh\ menu A&ggiorna\ men +menut &Delete &Elimina menut &Alternate &Alternato menut &Next &Successivo -menut &Previous &Precedente +menut &Previous &Precedente menut [No\ File] [Nessun\ File] + " Syntax / Sintassi -menut &Syntax &Sintassi -menut &Show\ filetypes\ in\ menu Mo&Stra\ tipi\ di\ file\ nel\ menu -menut Set\ '&syntax'\ only &S\ Attiva\ solo\ \ 'syntax' -menut Set\ '&filetype'\ too &F\ Attiva\ anche\ 'filetype' -menut &Off &Disattiva -menut &Manual &Manuale -menut A&utomatic A&Utomatico -menut on/off\ for\ &This\ file Attiva\ S/No\ su\ ques&To\ file -menut Co&lor\ test Test\ &Colori -menut &Highlight\ test Test\ &Evidenziamento -menut &Convert\ to\ HTML Converti\ ad\ &HTML +menut &Syntax &Sintassi + +menut &Show\ File\ Types\ in\ menu Mo&Stra\ tipi\ di\ file\ nel\ men +menut Set\ '&syntax'\ only &S\ Attiva\ solo\ \ 'syntax' +menut Set\ '&filetype'\ too &F\ Attiva\ anche\ 'filetype' +menut &Off &Disattiva +menut &Manual &Manuale +menut A&utomatic A&Utomatico +menut on/off\ for\ &This\ file Attiva\ S/No\ su\ ques&To\ file +menut Co&lor\ test Test\ &Colori +menut &Highlight\ test Test\ &Evidenziamento +menut &Convert\ to\ HTML Converti\ ad\ &HTML let g:menutrans_no_file = "[Senza nome]" " Window / Finestra -menut &Window &Finestra +menut &Window &Finestra menut &New<Tab>^Wn &Nuova<Tab>^Wn -menut S&plit<Tab>^Ws &Dividi\ lo\ schermo<Tab>^Ws -menut Sp&lit\ To\ #<Tab>^W^^ D&Ividi\ verso\ #<Tab>^W^^ +menut S&plit<Tab>^Ws &Dividi\ lo\ schermo<Tab>^Ws +menut Sp&lit\ To\ #<Tab>^W^^ D&Ividi\ verso\ #<Tab>^W^^ menut Split\ &Vertically<Tab>^Wv Di&Vidi\ verticalmente<Tab>^Wv -menut Split\ File\ E&xplorer Aggiungi\ finestra\ e&Xplorer - -menut &Close<Tab>^Wc &Chiudi<Tab>^Wc -menut Close\ &Other(s)<Tab>^Wo C&Hiudi\ altra(e)<Tab>^Wo - -menut Move\ &To &Muovi\ verso +menut Split\ File\ E&xplorer Aggiungi\ finestra\ e&Xplorer +" -SEP1- +menut &Close<Tab>^Wc &Chiudi<Tab>^Wc +menut Close\ &Other(s)<Tab>^Wo C&Hiudi\ altra(e)<Tab>^Wo +" -SEP2- +menut Move\ &To &Muovi\ verso menut &Top<Tab>^WK &Cima<Tab>^WK -menut &Bottom<Tab>^WJ &Fondo<Tab>^WJ +menut &Bottom<Tab>^WJ &Fondo<Tab>^WJ menut &Left\ side<Tab>^WH Lato\ &Sinistro<Tab>^WH menut &Right\ side<Tab>^WL Lato\ &Destro<Tab>^WL menut Rotate\ &Up<Tab>^WR Ruota\ verso\ l'&Alto<Tab>^WR menut Rotate\ &Down<Tab>^Wr Ruota\ verso\ il\ &Basso<Tab>^Wr - +" -SEP3- menut &Equal\ Size<Tab>^W= &Uguale\ ampiezza<Tab>^W= menut &Max\ Height<Tab>^W_ &Altezza\ massima<Tab>^W_ menut M&in\ Height<Tab>^W1_ A&Ltezza\ minima<Tab>^W1_ @@ -292,63 +333,57 @@ menut Max\ &Width<Tab>^W\| Larghezza\ massima<Tab>^W\| menut Min\ Widt&h<Tab>^W1\| Larghezza\ minima<Tab>^W1\| " The popup menu -menut &Undo &Annulla -menut Cu&t &Taglia -menut &Copy &Copia +menut &Undo &Annulla +" -SEP1- +menut Cu&t &Taglia +menut &Copy &Copia menut &Paste &Incolla menut &Delete &Elimina - -menut Select\ Blockwise Seleziona\ in\ blocco +" -SEP2- +menut Select\ Blockwise Seleziona\ in\ blocco menut Select\ &Word Seleziona\ &Parola menut Select\ &Line Seleziona\ &Linea -menut Select\ &Block Seleziona\ &Blocco +menut Select\ &Block Seleziona\ &Blocco menut Select\ &All Seleziona\ t&Utto " The GUI Toolbar / Barra Strumenti -if has("toolbar") - if exists("*Do_toolbar_tmenu") - delfun Do_toolbar_tmenu - endif - fun Do_toolbar_tmenu() - tmenu ToolBar.Open Apri - tmenu ToolBar.Save Salva - tmenu ToolBar.SaveAll Salva Tutto - tmenu ToolBar.Print Stampa - tmenu ToolBar.Undo Annulla - tmenu ToolBar.Redo Ripristina - tmenu ToolBar.Cut Taglia - tmenu ToolBar.Copy Copia - tmenu ToolBar.Paste Incolla - - if !has("gui_athena") - tmenu ToolBar.Find Cerca - tmenu ToolBar.FindNext Cerca Successivo - tmenu ToolBar.FindPrev Cerca Precedente - tmenu ToolBar.Replace Sostituisci - endif - -if 0 " disabled; These are in the Windows menu - tmenu ToolBar.New Nuova finestra - tmenu ToolBar.WinSplit Dividi finestra - tmenu ToolBar.WinMax Massima ampiezza - tmenu ToolBar.WinMin Minima ampiezza - tmenu ToolBar.WinVSplit Dividi verticalmente - tmenu ToolBar.WinMaxWidth Massima larghezza - tmenu ToolBar.WinMinWidth Minima larghezza - tmenu ToolBar.WinClose Chiudi finestra -endif - - tmenu ToolBar.LoadSesn Carica Sessione - tmenu ToolBar.SaveSesn Salva Sessione - tmenu ToolBar.RunScript Esegui Script - tmenu ToolBar.Make Make - tmenu ToolBar.Shell Shell - tmenu ToolBar.RunCtags Esegui Ctags - tmenu ToolBar.TagJump Vai a Tag - tmenu ToolBar.Help Aiuto - tmenu ToolBar.FindHelp Cerca in Aiuto - endfun -endif +menut Open Apri +menut Save Salva +menut SaveAll Salva\ Tutto +menut Print Stampa +" -SEP1- +menut Undo Annulla +menut Redo Ripristina +" -SEP2- +menut Cut Taglia +menut Copy Copia +menut Paste Incolla +" -sep3- +menut Find Cerca +menut FindNext Cerca Successivo +menut FindPrev Cerca Precedente +menut Replace Sostituisci +" -sep4- +menut New Nuova\ finestra +menut WinSplit Dividi\ finestra +menut WinMax Massima\ ampiezza +menut WinMin Minima\ ampiezza +menut WinVSplit Dividi\ verticalmente +menut WinMaxWidth Massima\ larghezza +menut WinMinWidth Minima\ larghezza +menut WinClose Chiudi\ finestra +" -SEP5- +menut LoadSesn Carica\ Sessione +menut SaveSesn Salva\ Sessione +menut RunScript Esegui\ Script +" -SEP6- +menut Make Make +menut Shell Shell +menut RunCtags Esegui\ Ctags +menut TagJump Vai\ a\ Tag +" -SEP7- +menut Help Aiuto +menut FindHelp Cerca\ in\ Aiuto let &cpo = s:keepcpo unlet s:keepcpo diff --git a/runtime/lang/menu_ja.euc-jp.vim b/runtime/lang/menu_ja.euc-jp.vim index 0eff4d99c3..4dcd60c187 100644 --- a/runtime/lang/menu_ja.euc-jp.vim +++ b/runtime/lang/menu_ja.euc-jp.vim @@ -5,5 +5,5 @@ " Copyright (C) 2004,12 MURAOKA Taro <koron.kaoriya@gmail.com> " THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. -" eucjp is the same as euc-jp. Source the other one from here. +" ja is the same as ja_jp. Source the other one from here. source <sfile>:p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja.utf-8.vim b/runtime/lang/menu_ja.utf-8.vim index 105a199417..a47cdbe455 100644 --- a/runtime/lang/menu_ja.utf-8.vim +++ b/runtime/lang/menu_ja.utf-8.vim @@ -1,4 +1,4 @@ " Menu Translations: Japanese -" eucjp is the same as euc-jp. Source the other one from here. +" ja is the same as ja_jp. Source the other one from here. source <sfile>:p:h/menu_ja_jp.utf-8.vim diff --git a/runtime/lang/menu_ja_jp.euc-jp.vim b/runtime/lang/menu_ja_jp.euc-jp.vim index ba622a6a3e..6e81f8f7da 100644 --- a/runtime/lang/menu_ja_jp.euc-jp.vim +++ b/runtime/lang/menu_ja_jp.euc-jp.vim @@ -1,10 +1,12 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (EUC-JP) -" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com> -" Last Change: 12-May-2013. +" Last Translator: MURAOKA Taro <koron.kaoriya@gmail.com> +" Last Change: 28-Jan-2016. +" +" Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>, +" vim-jp (http://vim-jp.org/) " -" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> " THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. @@ -20,7 +22,7 @@ scriptencoding euc-jp " Help menu menutrans &Help إ(&H) menutrans &Overview<Tab><F1> ά(&O)<Tab><F1> -menutrans &User\ Manual 桼ޥ˥奢(&U) +menutrans &User\ Manual 桼ޥ˥奢(&U) menutrans &How-to\ links &How-to menutrans &Credits 쥸å(&C) menutrans Co&pying (&P) @@ -71,9 +73,9 @@ menutrans Startup\ &Settings menutrans &Global\ Settings (&G) menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! \ ѥĴ(&H)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! \ 羮ʸ(&I)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! \ ޥåɽ(&S)<Tab>:set\ sm! menutrans &Context\ lines չԿ(&C) menutrans &Virtual\ Edit Խ(&V) @@ -84,7 +86,7 @@ menutrans Block\ and\ Insert menutrans Always menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! \ (鿴)⡼(&M)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! \ Viߴ⡼(&O)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. ѥ(&P)\.\.\. menutrans Ta&g\ Files\.\.\. ե(&G)\.\.\. @@ -104,19 +106,19 @@ let g:menutrans_tags_dialog = " menutrans F&ile\ Settings ե(&I) menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! \ ֹɽ(&N)<Tab>:set\ nu! -menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! \ йֹɽ(&V)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! \ ꥹȥ⡼(&L)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! \ ֤(&W)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! +menutrans Toggle\ W&rapping\ at\ word<Tab>:set\ lbr! \ ñ֤(&R)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! \ Ÿ(&E)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! \ ư(&A)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! \ C(&C)<Tab>:set\ cin! " other options @@ -129,7 +131,9 @@ let g:menutrans_textwidth_dialog = " let g:menutrans_fileformat_dialog = "եϤκݤβԵηǤ." let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n󥻥(&C)" +menutrans Show\ C&olor\ Schemes\ in\ Menu ơޤ˥塼ɽ(&O) menutrans C&olor\ Scheme ơ(&O) +menutrans Show\ &Keymaps\ in\ Menu ޥåפ˥塼ɽ(&K) menutrans &Keymap ޥå(&K) menutrans None ʤ @@ -138,7 +142,7 @@ menutrans &Tools menutrans &Jump\ to\ this\ tag<Tab>g^] (&J)<Tab>g^] menutrans Jump\ &back<Tab>^T (&B)<Tab>^T menutrans Build\ &Tags\ File ե(&T) -menutrans &Make<Tab>:make ᥤ(&M)<Tab>:make +menutrans &Make<Tab>:make ӥ(&M)<Tab>:make menutrans &List\ Errors<Tab>:cl 顼ꥹ(&L)<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! åꥹ(&I)<Tab>:cl! menutrans &Next\ Error<Tab>:cn Υ顼(&N)<Tab>:cn @@ -151,7 +155,8 @@ menutrans &Open<Tab>:copen menutrans &Close<Tab>:cclose Ĥ(&C)<Tab>:cclose menutrans &Convert\ to\ HEX<Tab>:%!xxd HEXѴ(&C)<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r HEXѴ(&R)<Tab>%!xxd\ -r -menutrans Se&T\ Compiler ѥ(&T) +menutrans Show\ Compiler\ Se&ttings\ in\ Menu ѥ˥塼ɽ(&T) +menutrans Se&t\ Compiler ѥ(&T) " Tools.Spelling Menu menutrans &Spelling ڥ(&S) @@ -287,7 +292,7 @@ endif " Syntax menu menutrans &Syntax 󥿥å(&S) -menutrans &Show\ filetypes\ in\ menu б˥塼ɽ(&S) +menutrans &Show\ File\ Types\ in\ Menu б˥塼ɽ(&S) menutrans Set\ '&syntax'\ only 'syntax'(&S) menutrans Set\ '&filetype'\ too 'filetype'(&F) menutrans &Off ̵(&O) diff --git a/runtime/lang/menu_ja_jp.utf-8.macvim.vim b/runtime/lang/menu_ja_jp.utf-8.macvim.vim new file mode 100644 index 0000000000..cd7b15a183 --- /dev/null +++ b/runtime/lang/menu_ja_jp.utf-8.macvim.vim @@ -0,0 +1,390 @@ +" vi:set ts=8 sts=8 sw=8 tw=0: +" +" Menu Translations: Japanese (UTF-8) +" Translated By: MURAOKA Taro <koron@tka.att.ne.jp> +" Last Change: 10-Jun-2010. + +" Quit when menu translations have already been done. +if exists("did_menu_trans") + finish +endif +let did_menu_trans = 1 + +scriptencoding utf-8 + +" Help menu +menutrans &Help ヘルプ +menutrans &Overview<Tab><F1> 概略<Tab><F1> +menutrans &User\ Manual ユーザマニュアル +menutrans &How-to\ links &How-toリンク +menutrans &Credits クレジット +menutrans Co&pying 著作権情報 +menutrans &Sponsor/Register スポンサー/登録 +menutrans O&rphans 孤児 +menutrans &Version バージョン情報 +menutrans &About Vimについて + +let g:menutrans_help_dialog = "ヘルプを検索したいコマンドもしくは単語を入力してください:\n\n挿入モードのコマンドには i_ を先頭に付加します. (例: i_CTRL-X)\nコマンドライン編集コマンドには c_ を先頭に付加します. (例: c_<Del>)\nオプションの名前には ' を付加します. (例: 'shiftwidth')" + +" File menu +menutrans &File ファイル +menutrans &Open\.\.\.<Tab>:e 開く\.\.\.<Tab>:e +menutrans Sp&lit-Open\.\.\.<Tab>:sp 分割して開く\.\.\.<Tab>:sp +menutrans Open\ Tab\.\.\.<Tab>:tabnew タブで開く<Tab>:tabnew +menutrans &New<Tab>:enew 新規作成<Tab>:enew +menutrans &Close<Tab>:close 閉じる<Tab>:close +menutrans &Save<Tab>:w 保存<Tab>:w +menutrans Save\ &As\.\.\.<Tab>:sav 名前を付けて保存\.\.\.<Tab>:sav +menutrans Split\ &Diff\ with\.\.\. 差分表示\.\.\. +menutrans Split\ Patched\ &By\.\.\. パッチ結果を表示\.\.\. +menutrans &Print 印刷 +menutrans Sa&ve-Exit<Tab>:wqa 保存して終了<Tab>:wqa +menutrans E&xit<Tab>:qa 終了<Tab>:qa + +" Edit menu +menutrans &Edit 編集 +menutrans &Undo<Tab>u 取り消す<Tab>u +menutrans &Redo<Tab>^R やり直す<Tab>^R +menutrans Rep&eat<Tab>\. 繰り返す<Tab>\. +menutrans Cu&t<Tab>"+x カット<Tab>"+x +menutrans &Copy<Tab>"+y コピー<Tab>"+y +menutrans &Paste<Tab>"+gP ペースト<Tab>"+gP +menutrans Put\ &Before<Tab>[p 前にペースト<Tab>[p +menutrans Put\ &After<Tab>]p 後にペースト<Tab>]p +menutrans &Delete<Tab>x 消す<Tab>x +menutrans &Select\ All<Tab>ggVG 全て選択<Tab>ggVG +menutrans &Find\.\.\. 検索\.\.\. +menutrans &Find<Tab>/ 検索<Tab>/ +menutrans Find\ and\ Rep&lace\.\.\. 置換\.\.\. +menutrans Find\ and\ Rep&lace<Tab>:%s 置換<Tab>:%s +menutrans Find\ and\ Rep&lace<Tab>:s 置換<Tab>:s +"menutrans Options\.\.\. オプション\.\.\. +menutrans Settings\ &Window 設定ウインドウ +menutrans Startup\ &Settings 起動時の設定 + +" Edit/Global Settings +menutrans &Global\ Settings 全体設定 +menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! + \ パターン強調切替<Tab>:set\ hls! +menutrans Toggle\ &Ignore-case<Tab>:set\ ic! + \ 大小文字区別切替<Tab>:set\ ic! +menutrans Toggle\ &Showmatch<Tab>:set\ sm! + \ マッチ表示切替<Tab>:set\ sm! +menutrans &Context\ lines カーソル周辺行数 +menutrans &Virtual\ Edit 仮想編集 +menutrans Never 無効 +menutrans Block\ Selection ブロック選択時 +menutrans Insert\ mode 挿入モード時 +menutrans Block\ and\ Insert ブロック/挿入モード時 +menutrans Always 常時 +menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! + \ 挿入(初心者)モード切替<Tab>:set\ im! +menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! + \ Vi互換モード切替<Tab>:set\ cp! +menutrans Search\ &Path\.\.\. 検索パス\.\.\. +menutrans Ta&g\ Files\.\.\. タグファイル\.\.\. +" +" GUI options +menutrans Toggle\ &Toolbar ツールバー表示切替 +menutrans Toggle\ &Bottom\ Scrollbar スクロールバー(下)表示切替 +menutrans Toggle\ &Left\ Scrollbar スクロールバー(左)表示切替 +menutrans Toggle\ &Right\ Scrollbar スクロールバー(右)表示切替 + +let g:menutrans_path_dialog = "ファイルの検索パスを入力してください:\nディレクトリ名はカンマ ( , ) で区切ってください." +let g:menutrans_tags_dialog = "タグファイルの名前を入力してください:\n名前はカンマ ( , ) で区切ってください." + +" Edit/File Settings + +" Boolean options +menutrans F&ile\ Settings ファイル設定 +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! + \ 行番号表示切替<Tab>:set\ nu! +menutrans Toggle\ &List\ Mode<Tab>:set\ list! + \ リストモード切替<Tab>:set\ list! +menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! + \ 行折返し切替<Tab>:set\ wrap! +menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! + \ 単語折返し切替<Tab>:set\ lbr! +menutrans Toggle\ &expand-tab<Tab>:set\ et! + \ タブ展開切替<Tab>:set\ et! +menutrans Toggle\ &auto-indent<Tab>:set\ ai! + \ 自動字下げ切替<Tab>:set\ ai! +menutrans Toggle\ &C-indenting<Tab>:set\ cin! + \ C言語字下げ切替<Tab>:set\ cin! + +" other options +menutrans &Shiftwidth シフト幅 +menutrans Soft\ &Tabstop ソフトウェアタブ幅 +menutrans Te&xt\ Width\.\.\. テキスト幅\.\.\. +menutrans &File\ Format\.\.\. 改行記号選択\.\.\. + +let g:menutrans_textwidth_dialog = "テキストの幅('textwidth')を設定してください (0で整形を無効化):" +let g:menutrans_fileformat_dialog = "ファイル出力の際の改行記号の形式を選んでください." +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\nキャンセル" + +menutrans C&olor\ Scheme 色テーマ選択 +menutrans &Keymap キーマップ +menutrans None なし + +" Programming menu +menutrans &Tools ツール +menutrans &Jump\ to\ this\ tag<Tab>g^] タグジャンプ<Tab>g^] +menutrans Jump\ &back<Tab>^T 戻る<Tab>^T +menutrans Build\ &Tags\ File タグファイル作成 +menutrans &Make<Tab>:make メイク<Tab>:make +menutrans &List\ Errors<Tab>:cl エラーリスト<Tab>:cl +menutrans L&ist\ Messages<Tab>:cl! メッセージリスト<Tab>:cl! +menutrans &Next\ Error<Tab>:cn 次のエラーへ<Tab>:cn +menutrans &Previous\ Error<Tab>:cp 前のエラーへ<Tab>:cp +menutrans &Older\ List<Tab>:cold 古いリスト<Tab>:cold +menutrans N&ewer\ List<Tab>:cnew 新しいリスト<Tab>:cnew +menutrans Error\ &Window エラーウインドウ +menutrans &Update<Tab>:cwin 更新<Tab>:cwin +menutrans &Open<Tab>:copen 開く<Tab>:copen +menutrans &Close<Tab>:cclose 閉じる<Tab>:cclose +menutrans &Convert\ to\ HEX<Tab>:%!xxd HEXへ変換<Tab>:%!xxd +menutrans Conve&rt\ back<Tab>:%!xxd\ -r HEXから逆変換<Tab>%!xxd\ -r +menutrans Se&T\ Compiler コンパイラ設定 + +" Tools.Spelling Menu +menutrans &Spelling スペリング +menutrans &Spell\ Check\ On スペルチェック有効 +menutrans Spell\ Check\ &Off スペルチェック有効 +menutrans To\ &Next\ error<Tab>]s 次のエラー<Tab>]s +menutrans To\ &Previous\ error<Tab>[s 前のエラー<Tab>[s +menutrans Suggest\ &Corrections<Tab>z= 修正候補<Tab>z= +menutrans &Repeat\ correction<Tab>:spellrepall 修正を繰り返す<Tab>:spellrepall +menutrans Set\ language\ to\ "en" 言語を\ "en"\ に設定する +menutrans Set\ language\ to\ "en_au" 言語を\ "en_au"\ に設定する +menutrans Set\ language\ to\ "en_ca" 言語を\ "en_ca"\ に設定する +menutrans Set\ language\ to\ "en_gb" 言語を\ "en_gb"\ に設定する +menutrans Set\ language\ to\ "en_nz" 言語を\ "en_nz"\ に設定する +menutrans Set\ language\ to\ "en_us" 言語を\ "en_us"\ に設定する +menutrans &Find\ More\ Languages 他の言語を検索する + +" Tools.Fold Menu +menutrans &Folding 折畳み +" open close folds +menutrans &Enable/Disable\ folds<Tab>zi 有効/無効切替<Tab>zi +menutrans &View\ Cursor\ Line<Tab>zv カーソル行を表示<Tab>zv +menutrans Vie&w\ Cursor\ Line\ only<Tab>zMzx カーソル行だけを表示<Tab>zMzx +menutrans C&lose\ more\ folds<Tab>zm 折畳みを閉じる<Tab>zm +menutrans &Close\ all\ folds<Tab>zM 全折畳みを閉じる<Tab>zM +menutrans O&pen\ more\ folds<Tab>zr 折畳みを開く<Tab>zr +menutrans &Open\ all\ folds<Tab>zR 全折畳みを開く<Tab>zR +" fold method +menutrans Fold\ Met&hod 折畳み方法 +menutrans M&anual 手動 +menutrans I&ndent インデント +menutrans E&xpression 式評価 +menutrans S&yntax シンタックス +menutrans &Diff 差分 +menutrans Ma&rker マーカー +" create and delete folds +menutrans Create\ &Fold<Tab>zf 折畳み作成<Tab>zf +menutrans &Delete\ Fold<Tab>zd 折畳み削除<Tab>zd +menutrans Delete\ &All\ Folds<Tab>zD 全折畳み削除<Tab>zD +" moving around in folds +menutrans Fold\ col&umn\ width 折畳みカラム幅 + +menutrans &Update 更新 +menutrans &Get\ Block ブロック抽出 +menutrans &Put\ Block ブロック適用 + +" Names for buffer menu. +menutrans &Buffers バッファ +menutrans &Refresh\ menu メニュー再読込 +menutrans &Delete 削除 +menutrans &Alternate 裏へ切替 +menutrans &Next 次のバッファ +menutrans &Previous 前のバッファ +menutrans [No\ File] [無題] +let g:menutrans_no_file = "[無題]" + +" Window menu +menutrans &Window ウインドウ +"menutrans &New<Tab>^Wn 新規作成<Tab>^Wn +"menutrans S&plit<Tab>^Ws 分割<Tab>^Ws +"menutrans Sp&lit\ To\ #<Tab>^W^^ 裏バッファへ分割<Tab>^W^^ +"menutrans Split\ &Vertically<Tab>^Wv 垂直分割<Tab>^Wv +"menutrans Split\ File\ E&xplorer ファイルエクスプローラ +"menutrans &Close<Tab>^Wc 閉じる<Tab>^Wc +"menutrans Move\ &To 移動 +"menutrans &Top<Tab>^WK 上<Tab>^WK +"menutrans &Bottom<Tab>^WJ 下<Tab>^WJ +"menutrans &Left\ side<Tab>^WH 左<Tab>^WH +"menutrans &Right\ side<Tab>^WL 右<Tab>^WL +"menutrans Close\ &Other(s)<Tab>^Wo 他を閉じる<Tab>^Wo +"menutrans Ne&xt<Tab>^Ww 次へ<Tab>^Ww +"menutrans P&revious<Tab>^WW 前へ<Tab>^WW +"menutrans &Equal\ Size<Tab>^W= 同じ高さに<Tab>^W= +"menutrans &Max\ Height<Tab>^W_ 最大高に<Tab>^W_ +"menutrans M&in\ Height<Tab>^W1_ 最小高に<Tab>^W1_ +"menutrans Max\ &Width<Tab>^W\| 最大幅に<Tab>^W\| +"menutrans Min\ Widt&h<Tab>^W1\| 最小幅に<Tab>^W1\| +"menutrans Rotate\ &Up<Tab>^WR 上にローテーション<Tab>^WR +"menutrans Rotate\ &Down<Tab>^Wr 下にローテーション<Tab>^Wr +"menutrans Select\ Fo&nt\.\.\. フォント設定\.\.\. + +" The popup menu +menutrans &Undo 取り消す +menutrans Cu&t カット +menutrans &Copy コピー +menutrans &Paste ペースト +menutrans &Delete 削除 +menutrans Select\ Blockwise 矩形ブロック選択 +menutrans Select\ &Word 単語選択 +menutrans Select\ &Line 行選択 +menutrans Select\ &Block ブロック選択 +menutrans Select\ &All すべて選択 +menutrans Select\ &Sentence 文選択 +menutrans Select\ Pa&ragraph 段落選択 + +" The GUI toolbar (for Win32 or GTK) +if has("toolbar") + if exists("*Do_toolbar_tmenu") + delfun Do_toolbar_tmenu + endif + fun Do_toolbar_tmenu() + tmenu ToolBar.Open ファイルを開く + tmenu ToolBar.Save 現在のファイルを保存 + tmenu ToolBar.SaveAll すべてのファイルを保存 + tmenu ToolBar.Print 印刷 + tmenu ToolBar.Undo 取り消し + tmenu ToolBar.Redo もう一度やる + tmenu ToolBar.Cut クリップボードへ切り取り + tmenu ToolBar.Copy クリップボードへコピー + tmenu ToolBar.Paste クリップボードから貼り付け + tmenu ToolBar.Find 検索... + tmenu ToolBar.FindNext 次を検索 + tmenu ToolBar.FindPrev 前を検索 + tmenu ToolBar.Replace 置換... + if 0 " disabled; These are in the Windows menu + tmenu ToolBar.New 新規ウインドウ作成 + tmenu ToolBar.WinSplit ウインドウ分割 + tmenu ToolBar.WinMax ウインドウ最大化 + tmenu ToolBar.WinMin ウインドウ最小化 + tmenu ToolBar.WinClose ウインドウを閉じる + endif + tmenu ToolBar.LoadSesn セッション読込 + tmenu ToolBar.SaveSesn セッション保存 + tmenu ToolBar.RunScript Vimスクリプト実行 + tmenu ToolBar.Make プロジェクトをMake + tmenu ToolBar.Shell シェルを開く + tmenu ToolBar.RunCtags tags作成 + tmenu ToolBar.TagJump タグジャンプ + tmenu ToolBar.Help Vimヘルプ + tmenu ToolBar.FindHelp Vimヘルプ検索 + endfun +endif + +" Syntax menu +menutrans &Syntax シンタックス +menutrans &Show\ filetypes\ in\ menu 対応形式をメニューに表示 +menutrans Set\ '&syntax'\ only 'syntax'だけ設定 +menutrans Set\ '&filetype'\ too 'filetype'も設定 +menutrans &Off 無効化 +menutrans &Manual 手動設定 +menutrans A&utomatic 自動設定 +menutrans on/off\ for\ &This\ file + \ オン/オフ切替 +menutrans Co&lor\ test カラーテスト +menutrans &Highlight\ test ハイライトテスト +menutrans &Convert\ to\ HTML HTMLへコンバート + +" Japanese specific menu +" 成否はiconv次第、必ずしも指定したエンコードになるわけではないことに注意 +if has('iconv') + " iconvのバージョン判定 + let support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0 + " + " 読み込み + an 10.395 &File.-SEPICONV- <Nop> + an 10.396.100.100 &File.エンコード指定\.\.\..開く\.\.\..SJIS<Tab>fenc=cp932 :browse confirm e ++enc=cp932<CR> + if !support_jisx0213 + an 10.396.100.110 &File.エンコード指定\.\.\..開く\.\.\..EUC<Tab>fenc=euc-jp :browse confirm e ++enc=euc-jp<CR> + an 10.396.100.120 &File.エンコード指定\.\.\..開く\.\.\..JIS<Tab>fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp<CR> + else + an 10.396.100.110 &File.エンコード指定\.\.\..開く\.\.\..EUC<Tab>fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213<CR> + an 10.396.100.120 &File.エンコード指定\.\.\..開く\.\.\..JIS<Tab>fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3<CR> + endif + an 10.396.100.130 &File.エンコード指定\.\.\..開く\.\.\..UTF-8<Tab>fenc=utf-8 :browse confirm e ++enc=utf-8<CR> + + " 再読込 + an 10.396.110.100 &File.エンコード指定\.\.\..再読込\.\.\..SJIS<Tab>fenc=cp932 :e ++enc=cp932<CR> + if !support_jisx0213 + an 10.396.110.110 &File.エンコード指定\.\.\..再読込\.\.\..EUC<Tab>fenc=euc-jp :e ++enc=euc-jp<CR> + an 10.396.110.120 &File.エンコード指定\.\.\..再読込\.\.\..JIS<Tab>fenc=iso-2022-jp :e ++enc=iso-2022-jp<CR> + else + an 10.396.110.110 &File.エンコード指定\.\.\..再読込\.\.\..EUC<Tab>fenc=euc-jisx0213 :e ++enc=euc-jisx0213<CR> + an 10.396.110.120 &File.エンコード指定\.\.\..再読込\.\.\..JIS<Tab>fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3<CR> + endif + an 10.396.110.130 &File.エンコード指定\.\.\..再読込\.\.\..UTF-8<Tab>fenc=utf-8 :e ++enc=utf-8<CR> + + " 保存 + an 10.396.115 &File.エンコード指定\.\.\..-SEP1- <Nop> + an 10.396.120.100 &File.エンコード指定\.\.\..保存\.\.\..SJIS<Tab>fenc=cp932 :set fenc=cp932 \| w<CR> + if !support_jisx0213 + an 10.396.120.110 &File.エンコード指定\.\.\..保存\.\.\..EUC<Tab>fenc=euc-jp :set fenc=euc-jp \| w<CR> + an 10.396.120.120 &File.エンコード指定\.\.\..保存\.\.\..JIS<Tab>fenc=iso-2022-jp :set fenc=iso-2022-jp \| w<CR> + else + an 10.396.120.110 &File.エンコード指定\.\.\..保存\.\.\..EUC<Tab>fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w<CR> + an 10.396.120.120 &File.エンコード指定\.\.\..保存\.\.\..JIS<Tab>fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w<CR> + endif + an 10.396.120.130 &File.エンコード指定\.\.\..保存\.\.\..UTF-8<Tab>fenc=utf-8 :set fenc=utf-8 \| w<CR> +endif + + +"--------------------------------------------------------------------------- +" Extra Japanese menus +"--------------------------------------------------------------------------- + +" File menu +menut New\ Window 新規ウインドウ +menut New\ Tab 新規タブ +menut Open\.\.\. 開く\.\.\. +menut Open\ Recent 最近開いたファイル +menut Close\ Window<Tab>:qa ウインドウを閉じる<Tab>:qa +menut Close 閉じる +menut Save\ All すべてを保存 +menut Save\ As\.\.\.<Tab>:sav 名前を付けて保存\.\.\.<Tab>:sav + +" Edit menu +menut Find 検索 +menut Find\.\.\. 検索\.\.\. +menut Find\ Next 次を検索 +menut Find\ Previous 前を検索 +menut Use\ Selection\ for\ Find 選択部分を検索に使用 + +menut Font フォント +menut Show\ Fonts フォントパネルを表示 +menut Bigger 大きく +menut Smaller 小さく +menut Special\ Characters\.\.\. 特殊文字\.\.\. + +" Window menu +menut Minimize しまう +menut Minimize\ All すべてをしまう +menut Zoom 拡大/縮小 +menut Zoom\ All すべてを拡大 +menut Toggle\ Full\ Screen\ Mode フルスクリーンモード切り替え +menut Select\ Next\ Window 次のウインドウ +menut Select\ Previous\ Window 前のウインドウ +menut Select\ Next\ Tab 次のタブを選択 +menut Select\ Previous\ Tab 前のタブを選択 +menut Bring\ All\ To\ Front すべてを手前に移動 + +" Help menu +menut MacVim\ Help MacVim\ ヘルプ +menut MacVim\ Website MacVim\ Webサイト +an <silent> 9999.4 &Help.MacVim-KaoriYa\ Webサイト <Nop> +macm ヘルプ.MacVim-KaoriYa\ Webサイト action=openWebsiteKaoriYa: +an 9999.5 &Help.-sep0- <Nop> + + +" filler to avoid the line above being recognized as a modeline +" filler +" filler +" filler + + diff --git a/runtime/lang/menu_ja_jp.utf-8.vim b/runtime/lang/menu_ja_jp.utf-8.vim index 7c3431d0f3..9dbc47cb97 100644 --- a/runtime/lang/menu_ja_jp.utf-8.vim +++ b/runtime/lang/menu_ja_jp.utf-8.vim @@ -1,10 +1,12 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (UTF-8) -" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com> -" Last Change: 12-May-2013. +" Last Translator: MURAOKA Taro <koron.kaoriya@gmail.com> +" Last Change: 28-Jan-2016. +" +" Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>, +" vim-jp (http://vim-jp.org/) " -" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> " THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. @@ -20,7 +22,7 @@ scriptencoding utf-8 " Help menu menutrans &Help ヘルプ(&H) menutrans &Overview<Tab><F1> 概略(&O)<Tab><F1> -menutrans &User\ Manual ユーザマニュアル(&U) +menutrans &User\ Manual ユーザーマニュアル(&U) menutrans &How-to\ links &How-toリンク menutrans &Credits クレジット(&C) menutrans Co&pying 著作権情報(&P) @@ -71,9 +73,9 @@ menutrans Startup\ &Settings 起動時の設定(&S) menutrans &Global\ Settings 全体設定(&G) menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! \ パターン強調切替(&H)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! \ 大小文字区別切替(&I)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! \ マッチ表示切替(&S)<Tab>:set\ sm! menutrans &Context\ lines カーソル周辺行数(&C) menutrans &Virtual\ Edit 仮想編集(&V) @@ -84,7 +86,7 @@ menutrans Block\ and\ Insert ブロック/挿入モード時 menutrans Always 常時 menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! \ 挿入(初心者)モード切替(&M)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! \ Vi互換モード切替(&O)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. 検索パス(&P)\.\.\. menutrans Ta&g\ Files\.\.\. タグファイル(&G)\.\.\. @@ -104,19 +106,19 @@ let g:menutrans_tags_dialog = "タグファイルの名前を入力してくだ menutrans F&ile\ Settings ファイル設定(&I) menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! \ 行番号表示切替(&N)<Tab>:set\ nu! -menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! \ 相対行番号表示切替(&V)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! \ リストモード切替(&L)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! \ 行折返し切替(&W)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! +menutrans Toggle\ W&rapping\ at\ word<Tab>:set\ lbr! \ 単語折返し切替(&R)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! \ タブ展開切替(&E)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! \ 自動字下げ切替(&A)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! \ C言語字下げ切替(&C)<Tab>:set\ cin! " other options @@ -129,7 +131,9 @@ let g:menutrans_textwidth_dialog = "テキストの幅('textwidth')を設定し let g:menutrans_fileformat_dialog = "ファイル出力の際の改行記号の形式を選んでください." let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\nキャンセル(&C)" +menutrans Show\ C&olor\ Schemes\ in\ Menu 色テーマをメニューに表示(&O) menutrans C&olor\ Scheme 色テーマ選択(&O) +menutrans Show\ &Keymaps\ in\ Menu キーマップをメニューに表示(&K) menutrans &Keymap キーマップ(&K) menutrans None なし @@ -138,7 +142,7 @@ menutrans &Tools ツール(&T) menutrans &Jump\ to\ this\ tag<Tab>g^] タグジャンプ(&J)<Tab>g^] menutrans Jump\ &back<Tab>^T 戻る(&B)<Tab>^T menutrans Build\ &Tags\ File タグファイル作成(&T) -menutrans &Make<Tab>:make メイク(&M)<Tab>:make +menutrans &Make<Tab>:make ビルド(&M)<Tab>:make menutrans &List\ Errors<Tab>:cl エラーリスト(&L)<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! メッセージリスト(&I)<Tab>:cl! menutrans &Next\ Error<Tab>:cn 次のエラーへ(&N)<Tab>:cn @@ -151,7 +155,8 @@ menutrans &Open<Tab>:copen 開く(&O)<Tab>:copen menutrans &Close<Tab>:cclose 閉じる(&C)<Tab>:cclose menutrans &Convert\ to\ HEX<Tab>:%!xxd HEXへ変換(&C)<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r HEXから逆変換(&R)<Tab>%!xxd\ -r -menutrans Se&T\ Compiler コンパイラ設定(&T) +menutrans Show\ Compiler\ Se&ttings\ in\ Menu コンパイラ設定をメニューに表示(&T) +menutrans Se&t\ Compiler コンパイラ設定(&T) " Tools.Spelling Menu menutrans &Spelling スペリング(&S) @@ -287,7 +292,7 @@ endif " Syntax menu menutrans &Syntax シンタックス(&S) -menutrans &Show\ filetypes\ in\ menu 対応形式をメニューに表示(&S) +menutrans &Show\ File\ Types\ in\ Menu 対応形式をメニューに表示(&S) menutrans Set\ '&syntax'\ only 'syntax'だけ設定(&S) menutrans Set\ '&filetype'\ too 'filetype'も設定(&F) menutrans &Off 無効化(&O) diff --git a/runtime/lang/menu_japanese_japan.932.vim b/runtime/lang/menu_japanese_japan.932.vim index 7b775cb2cc..a39d7da3c8 100644 --- a/runtime/lang/menu_japanese_japan.932.vim +++ b/runtime/lang/menu_japanese_japan.932.vim @@ -1,10 +1,12 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (CP932) -" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com> -" Last Change: 12-May-2013. +" Last Translator: MURAOKA Taro <koron.kaoriya@gmail.com> +" Last Change: 28-Jan-2016. +" +" Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>, +" vim-jp (http://vim-jp.org/) " -" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> " THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. @@ -20,7 +22,7 @@ scriptencoding cp932 " Help menu menutrans &Help wv(&H) menutrans &Overview<Tab><F1> T(&O)<Tab><F1> -menutrans &User\ Manual [U}jA(&U) +menutrans &User\ Manual [U[}jA(&U) menutrans &How-to\ links &How-toN menutrans &Credits NWbg(&C) menutrans Co&pying 쌠(&P) @@ -71,9 +73,9 @@ menutrans Startup\ &Settings menutrans &Global\ Settings S̐ݒ(&G) menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! \ p^[ؑ(&H)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! \ 召ʐؑ(&I)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! \ }b`\ؑ(&S)<Tab>:set\ sm! menutrans &Context\ lines J[\Ӎs(&C) menutrans &Virtual\ Edit zҏW(&V) @@ -84,7 +86,7 @@ menutrans Block\ and\ Insert menutrans Always 펞 menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! \ }(S)[hؑ(&M)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! \ Vi݊[hؑ(&O)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. pX(&P)\.\.\. menutrans Ta&g\ Files\.\.\. ^Ot@C(&G)\.\.\. @@ -104,19 +106,19 @@ let g:menutrans_tags_dialog = " menutrans F&ile\ Settings t@Cݒ(&I) menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! \ sԍ\ؑ(&N)<Tab>:set\ nu! -menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! \ ΍sԍ\ؑ(&V)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! \ Xg[hؑ(&L)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! \ sܕԂؑ(&W)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! +menutrans Toggle\ W&rapping\ at\ word<Tab>:set\ lbr! \ PܕԂؑ(&R)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! \ ^uWJؑ(&E)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! \ ؑ(&A)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! \ Cꎚؑ(&C)<Tab>:set\ cin! " other options @@ -129,7 +131,9 @@ let g:menutrans_textwidth_dialog = " let g:menutrans_fileformat_dialog = "t@Co͂̍ۂ̉sĽ`Ił." let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\nLZ(&C)" +menutrans Show\ C&olor\ Schemes\ in\ Menu Fe[}j[ɕ\(&O) menutrans C&olor\ Scheme Fe[}I(&O) +menutrans Show\ &Keymaps\ in\ Menu L[}bvj[ɕ\(&K) menutrans &Keymap L[}bv(&K) menutrans None Ȃ @@ -138,7 +142,7 @@ menutrans &Tools menutrans &Jump\ to\ this\ tag<Tab>g^] ^OWv(&J)<Tab>g^] menutrans Jump\ &back<Tab>^T ߂(&B)<Tab>^T menutrans Build\ &Tags\ File ^Ot@C쐬(&T) -menutrans &Make<Tab>:make CN(&M)<Tab>:make +menutrans &Make<Tab>:make rh(&M)<Tab>:make menutrans &List\ Errors<Tab>:cl G[Xg(&L)<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! bZ[WXg(&I)<Tab>:cl! menutrans &Next\ Error<Tab>:cn ̃G[(&N)<Tab>:cn @@ -151,7 +155,8 @@ menutrans &Open<Tab>:copen menutrans &Close<Tab>:cclose ‚(&C)<Tab>:cclose menutrans &Convert\ to\ HEX<Tab>:%!xxd HEX֕ϊ(&C)<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r HEXtϊ(&R)<Tab>%!xxd\ -r -menutrans Se&T\ Compiler RpCݒ(&T) +menutrans Show\ Compiler\ Se&ttings\ in\ Menu RpCݒj[ɕ\(&T) +menutrans Se&t\ Compiler RpCݒ(&T) " Tools.Spelling Menu menutrans &Spelling XyO(&S) @@ -287,7 +292,7 @@ endif " Syntax menu menutrans &Syntax V^bNX(&S) -menutrans &Show\ filetypes\ in\ menu Ή`j[ɕ\(&S) +menutrans &Show\ File\ Types\ in\ Menu Ή`j[ɕ\(&S) menutrans Set\ '&syntax'\ only 'syntax'ݒ(&S) menutrans Set\ '&filetype'\ too 'filetype'ݒ(&F) menutrans &Off (&O) diff --git a/runtime/lang/menu_ru_ru.vim b/runtime/lang/menu_ru_ru.vim index 69616083b0..22a1c1693a 100644 --- a/runtime/lang/menu_ru_ru.vim +++ b/runtime/lang/menu_ru_ru.vim @@ -1,7 +1,7 @@ " Menu Translations: Russian " Maintainer: Sergey Alyoshin <alyoshin.s@gmail.com> -" Previous Maintainer: vassily ragosin <vrr[at]users.sourceforge.net> -" Last Change: 29 May 2013 +" Previous Maintainer: Vassily Ragosin <vrr[at]users.sourceforge.net> +" Last Change: 16 May 2018 " URL: cvs://cvs.sf.net:/cvsroot/ruvim/extras/menu/menu_ru_ru.vim " " $Id: menu_ru_ru.vim,v 1.1 2004/06/13 16:09:10 vimboss Exp $ @@ -36,7 +36,7 @@ menutrans &Help С&правка " Help menu menutrans &Overview<Tab><F1> &Обзор<Tab><F1> menutrans &User\ Manual Руково&дство\ пользователя -menutrans &How-to\ links &Как\ это\ сделать\.\.\. +menutrans &How-To\ Links &Как\ это\ сделать\.\.\. menutrans &Find\.\.\. &Поиск "-------------------- menutrans &Credits &Благодарности @@ -58,7 +58,7 @@ menutrans &Close<Tab>:close &Закрыть<Tab>:close menutrans &Save<Tab>:w &Сохранить<Tab>:w menutrans Save\ &As\.\.\.<Tab>:sav Сохранить\ &как\.\.\.<Tab>:sav "-------------------- -menutrans Split\ &Diff\ with\.\.\. Ср&авнить\ с\.\.\. +menutrans Split\ &Diff\ With\.\.\. Ср&авнить\ с\.\.\. menutrans Split\ Patched\ &By\.\.\. Сравнить\ с\ применением\ зап&латки\.\.\. "-------------------- menutrans &Print На&печатать @@ -97,12 +97,12 @@ menutrans &Keymap Раскладка\ кл&авиатуры menutrans Select\ Fo&nt\.\.\. Выбор\ &шрифта\.\.\. ">>>----------------- Edit/Global settings menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! Подсветка\ &найденных\ соответствий<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! &Регистронезависимый\ поиск<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! Показывать\ парные\ &элементы<Tab>:set\ sm! -menutrans &Context\ lines Стр&ок\ вокруг\ курсора +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! &Регистронезависимый\ поиск<Tab>:set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! Показывать\ парные\ &элементы<Tab>:set\ sm! +menutrans &Context\ Lines Стр&ок\ вокруг\ курсора menutrans &Virtual\ Edit Вир&туальное\ редактирование menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! Режим\ &Вставки<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! &Совместимость\ с\ Vi<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! &Совместимость\ с\ Vi<Tab>:set\ cp! menutrans Search\ &Path\.\.\. &Путь\ для\ поиска\ файлов\.\.\. menutrans Ta&g\ Files\.\.\. Файлы\ &меток\.\.\. " @@ -113,18 +113,18 @@ menutrans Toggle\ &Right\ Scrollbar Полоса\ прокрутки\ спр& ">>>->>>------------- Edit/Global settings/Virtual edit menutrans Never Выключено menutrans Block\ Selection При\ выделении\ блока -menutrans Insert\ mode В\ режиме\ Вставки +menutrans Insert\ Mode В\ режиме\ Вставки menutrans Block\ and\ Insert При\ выделении\ блока\ и\ в\ режиме\ Вставки menutrans Always Включено\ всегда ">>>----------------- Edit/File settings menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! &Нумерация\ строк<Tab>:set\ nu! -menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! Относите&льная\ нумерация\ строк<Tab>:set\ nru! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! Относите&льная\ нумерация\ строк<Tab>:set\ nru! menutrans Toggle\ &List\ Mode<Tab>:set\ list! Отобра&жение\ невидимых\ символов<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! &Перенос\ длинных\ строк<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! Перенос\ &целых\ слов<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! Про&белы\ вместо\ табуляции<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! Автоматическое\ форматирование\ &отступов<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! Форматирование\ отступов\ в\ &стиле\ C<Tab>:set\ cin! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! &Перенос\ длинных\ строк<Tab>:set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! Перенос\ &целых\ слов<Tab>:set\ lbr! +menutrans Toggle\ Tab\ &Expanding-tab<Tab>:set\ et! Про&белы\ вместо\ табуляции<Tab>:set\ et! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! Автоматическое\ форматирование\ &отступов<Tab>:set\ ai! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! Форматирование\ отступов\ в\ &стиле\ C<Tab>:set\ cin! ">>>--- menutrans &Shiftwidth Вели&чина\ отступа menutrans Soft\ &Tabstop Ширина\ &табуляции @@ -134,55 +134,64 @@ menutrans &File\ Format\.\.\. &Формат\ файла\.\.\. " " " Tools menu -menutrans &Jump\ to\ this\ tag<Tab>g^] &Переход\ к\ метке<Tab>g^] -menutrans Jump\ &back<Tab>^T &Вернуться\ назад<Tab>^T -menutrans Build\ &Tags\ File Создать\ &файл\ меток +menutrans &Jump\ to\ This\ Tag<Tab>g^] &Перейти\ к\ метке<Tab>g^] +menutrans Jump\ &Back<Tab>^T &Вернуться\ назад<Tab>^T +menutrans Build\ &Tags\ File Создать\ файл\ ме&ток "------------------- -menutrans &Folding Работа\ со\ &складками +menutrans &Folding &Складки menutrans &Spelling Пр&авописание menutrans &Diff &Отличия\ (diff) "------------------- -menutrans &Make<Tab>:make Ко&мпиляция<Tab>:make +menutrans &Make<Tab>:make Ко&мпилировать<Tab>:make menutrans &List\ Errors<Tab>:cl Список\ о&шибок<Tab>:cl -menutrans L&ist\ Messages<Tab>:cl! Список\ все&х\ ошибок\ и\ предупреждений<Tab>:cl! +menutrans L&ist\ Messages<Tab>:cl! Список\ соо&бщений<Tab>:cl! menutrans &Next\ Error<Tab>:cn Следу&ющая\ ошибка<Tab>:cn menutrans &Previous\ Error<Tab>:cp П&редыдущая\ ошибка<Tab>:cp menutrans &Older\ List<Tab>:cold Более\ стар&ый\ список\ ошибок<Tab>:cold menutrans N&ewer\ List<Tab>:cnew Более\ све&жий\ список\ ошибок<Tab>:cnew menutrans Error\ &Window Ок&но\ ошибок -menutrans Se&T\ Compiler Выбор\ &компилятора +menutrans Se&t\ Compiler Выбор\ &компилятора +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Пока&зать\ настройки\ компи&лятора\ в\ меню "------------------- menutrans &Convert\ to\ HEX<Tab>:%!xxd П&еревести\ в\ HEX<Tab>:%!xxd -menutrans Conve&rt\ back<Tab>:%!xxd\ -r Перевести\ и&з\ HEX<Tab>:%!xxd\ -r +menutrans Conve&rt\ Back<Tab>:%!xxd\ -r Перевести\ и&з\ HEX<Tab>:%!xxd\ -r ">>>---------------- Tools/Spelling menutrans &Spell\ Check\ On &Вкл\ проверку\ правописания menutrans Spell\ Check\ &Off Вы&кл\ проверку\ правописания -menutrans To\ &Next\ error<Tab>]s &Следующая\ ошибка -menutrans To\ &Previous\ error<Tab>[s &Предыдущая\ ошибка -menutrans Suggest\ &Corrections<Tab>z= Предложить\ исп&равления -menutrans &Repeat\ correction<Tab>:spellrepall Пов&торить\ исправление\ для\ всех +menutrans To\ &Next\ Error<Tab>]s &Следующая\ ошибка<Tab>]s +menutrans To\ &Previous\ Error<Tab>[s &Предыдущая\ ошибка<Tab>[s +menutrans Suggest\ &Corrections<Tab>z= Предложить\ исп&равления<Tab>z= +menutrans &Repeat\ Correction<Tab>:spellrepall Пов&торить\ исправление\ для\ всех<Tab>spellrepall "------------------- -menutrans Set\ language\ to\ "en" Установить\ язык\ "en" -menutrans Set\ language\ to\ "en_au" Установить\ язык\ "en_au" -menutrans Set\ language\ to\ "en_ca" Установить\ язык\ "en_ca" -menutrans Set\ language\ to\ "en_gb" Установить\ язык\ "en_gb" -menutrans Set\ language\ to\ "en_nz" Установить\ язык\ "en_nz" -menutrans Set\ language\ to\ "en_us" Установить\ язык\ "en_us" +menutrans Set\ Language\ to\ "en" Установить\ язык\ "en" +menutrans Set\ Language\ to\ "en_au" Установить\ язык\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Установить\ язык\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Установить\ язык\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Установить\ язык\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Установить\ язык\ "en_us" menutrans &Find\ More\ Languages &Найти\ больше\ языков let g:menutrans_set_lang_to = 'Установить язык' +" +" +" The Spelling popup menu +" +" +let g:menutrans_spell_change_ARG_to = 'Исправить\ "%s"\ на' +let g:menutrans_spell_add_ARG_to_word_list = 'Добавить\ "%s"\ в\ словарь' +let g:menutrans_spell_ignore_ARG = 'Пропустить\ "%s"' ">>>---------------- Folds -menutrans &Enable/Disable\ folds<Tab>zi Вкл/выкл\ &складки<Tab>zi +menutrans &Enable/Disable\ Folds<Tab>zi Вкл/выкл\ &складки<Tab>zi menutrans &View\ Cursor\ Line<Tab>zv Открыть\ строку\ с\ &курсором<Tab>zv -menutrans Vie&w\ Cursor\ Line\ only<Tab>zMzx Открыть\ &только\ строку\ с\ курсором<Tab>zMzx -menutrans C&lose\ more\ folds<Tab>zm Закрыть\ &больше\ складок<Tab>zm -menutrans &Close\ all\ folds<Tab>zM Закрыть\ &все\ складки<Tab>zM -menutrans &Open\ all\ folds<Tab>zR Откр&ыть\ все\ складки<Tab>zR -menutrans O&pen\ more\ folds<Tab>zr Отк&рыть\ больше\ складок<Tab>zr +menutrans Vie&w\ Cursor\ Line\ Only<Tab>zMzx Открыть\ &только\ строку\ с\ курсором<Tab>zMzx +menutrans C&lose\ More\ Folds<Tab>zm Закрыть\ &больше\ складок<Tab>zm +menutrans &Close\ All\ Folds<Tab>zM Закрыть\ &все\ складки<Tab>zM +menutrans &Open\ All\ Folds<Tab>zR Откр&ыть\ все\ складки<Tab>zR +menutrans O&pen\ More\ Folds<Tab>zr Отк&рыть\ больше\ складок<Tab>zr menutrans Fold\ Met&hod &Метод\ складок menutrans Create\ &Fold<Tab>zf Со&здать\ складку<Tab>zf menutrans &Delete\ Fold<Tab>zd У&далить\ складку<Tab>zd menutrans Delete\ &All\ Folds<Tab>zD Удалить\ вс&е\ складки<Tab>zD -menutrans Fold\ col&umn\ width &Ширина\ колонки\ складок +menutrans Fold\ col&umn\ Width &Ширина\ колонки\ складок ">>>->>>----------- Tools/Folds/Fold Method menutrans M&anual Вру&чную menutrans I&ndent О&тступ @@ -201,15 +210,15 @@ menutrans &Open<Tab>:copen &Открыть<Tab>:copen " " Syntax menu " -menutrans &Show\ filetypes\ in\ menu Показать\ меню\ для\ выбора\ типа\ &файла +menutrans &Show\ File\ Types\ in\ Menu Показать\ меню\ выбора\ типа\ &файла menutrans Set\ '&syntax'\ only &Изменять\ только\ значение\ 'syntax' menutrans Set\ '&filetype'\ too Изменять\ &также\ значение\ 'filetype' menutrans &Off &Отключить menutrans &Manual Вру&чную menutrans A&utomatic &Автоматически -menutrans on/off\ for\ &This\ file Вкл/выкл\ для\ &этого\ файла -menutrans Co&lor\ test Проверка\ &цветов -menutrans &Highlight\ test Проверка\ под&светки +menutrans On/Off\ for\ &This\ File Вкл/выкл\ для\ &этого\ файла +menutrans Co&lor\ Test Проверка\ &цветов +menutrans &Highlight\ Test Проверка\ под&светки menutrans &Convert\ to\ HTML С&делать\ HTML\ с\ подсветкой " " @@ -246,8 +255,8 @@ menutrans Min\ Widt&h<Tab>^W1\| Минимал&ьная\ ширина<Tab>^W1 ">>>----------------- Window/Move To menutrans &Top<Tab>^WK В&верх<Tab>^WK menutrans &Bottom<Tab>^WJ В&низ<Tab>^WJ -menutrans &Left\ side<Tab>^WH В&лево<Tab>^WH -menutrans &Right\ side<Tab>^WL В&право<Tab>^WL +menutrans &Left\ Side<Tab>^WH В&лево<Tab>^WH +menutrans &Right\ Side<Tab>^WL В&право<Tab>^WL " " " The popup menu @@ -260,9 +269,11 @@ menutrans &Paste Вк&леить menutrans &Delete &Удалить menutrans Select\ Blockwise Блоковое\ выделение menutrans Select\ &Word Выделить\ &слово +menutrans Select\ &Sentence Выделить\ &предложение +menutrans Select\ Pa&ragraph Выделить\ пара&граф menutrans Select\ &Line Выделить\ ст&року menutrans Select\ &Block Выделить\ &блок -menutrans Select\ &All В&ыделить\ &всё +menutrans Select\ &All Выделить\ &всё " " The GUI toolbar " @@ -280,10 +291,9 @@ if has("toolbar") tmenu ToolBar.Cut Вырезать tmenu ToolBar.Copy Копировать tmenu ToolBar.Paste Вклеить - tmenu ToolBar.Find Поиск... - tmenu ToolBar.FindNext Поиск следующего соответствия - tmenu ToolBar.FindPrev Поиск предыдущего соответствия - tmenu ToolBar.Replace Заменить... + tmenu ToolBar.FindNext Найти следующее + tmenu ToolBar.FindPrev Найти предыдущее + tmenu ToolBar.Replace Найти или заменить... tmenu ToolBar.LoadSesn Загрузить сеанс редактирования tmenu ToolBar.SaveSesn Сохранить сеанс редактирования tmenu ToolBar.RunScript Выполнить сценарий Vim diff --git a/runtime/lang/menu_sk_sk.vim b/runtime/lang/menu_sk_sk.vim index 0a7504d3ea..d02a7cf61d 100644 --- a/runtime/lang/menu_sk_sk.vim +++ b/runtime/lang/menu_sk_sk.vim @@ -2,7 +2,7 @@ " Translated By: Martin Lacko <lacko@host.sk> " Last Change: 2002 May 27 -if has("win32") || has("win16") || has("dos16") || has("dos32") +if has("win32") source <sfile>:p:h/menu_sk_sk.1250.vim else source <sfile>:p:h/menu_sk_sk.iso_8859-2.vim diff --git a/runtime/lang/menu_sl_si.cp1250.vim b/runtime/lang/menu_sl_si.cp1250.vim index 8999b15da0..5b5482d380 100644 --- a/runtime/lang/menu_sl_si.cp1250.vim +++ b/runtime/lang/menu_sl_si.cp1250.vim @@ -1,7 +1,7 @@ " Menu Translations: Slovenian / Slovensko " Maintainer: Mojca Miklavec <mojca.miklavec.lists@gmail.com> " Originally By: Mojca Miklavec <mojca.miklavec.lists@gmail.com> -" Last Change: Sat, 17 Jun 2006 +" Last Change: 2016 Oct 17 " vim:set foldmethod=marker tabstop=8: " TODO: add/check all '&'s @@ -31,7 +31,7 @@ menutrans E&xit<Tab>:qa &Izhod<Tab>:qa if has("diff") menutrans Split\ &Diff\ with\.\.\. Primerjaj\ z\ (di&ff)\ \.\.\. - menutrans Split\ Patched\ &By\.\.\. &Popravi\ z\ (patch)\ \.\.\. + menutrans Split\ Patched\ &By\.\.\. &Popravi\ s\ (patch)\ \.\.\. endif " }}} FILE / DATOTEKA @@ -96,12 +96,12 @@ menutrans Soft\ &Tabstop menutrans Te&xt\ Width\.\.\. irina\ besedila\ \.\.\. menutrans &File\ Format\.\.\. Format\ &datoteke\ \.\.\. menutrans C&olor\ Scheme &Barvna\ shema\ \.\.\. -menutrans &Keymap &Keymap +menutrans &Keymap Razporeditev\ tip&k menutrans Select\ Fo&nt\.\.\. Pisava\ \.\.\. " }}} EDIT / UREDI " {{{ TOOLS / ORODJA -menutrans &Tools &Orodja +menutrans &Tools O&rodja menutrans &Jump\ to\ this\ tag<Tab>g^] &Skoi\ k\ tej\ znaki<Tab>g^] menutrans Jump\ &back<Tab>^T Skoi\ Na&zaj<Tab>^T menutrans Build\ &Tags\ File Napravi\ datoteke\ z\ znakami\ (tag) @@ -175,7 +175,7 @@ menutrans &Set\ Compiler Nastavi\ &prevajalnik menutrans Se&T\ Compiler Nastavi\ &prevajalnik " bug in original translation? menutrans &Convert\ to\ HEX<Tab>:%!xxd Pretvori\ v\ HE&X<Tab>:%!xxd -menutrans Conve&rt\ back<Tab>:%!xxd\ -r Pretvori\ nazaj<Tab>:%!xxd\ -r +menutrans Conve&rt\ back<Tab>:%!xxd\ -r Povrni\ pretvo&rbo<Tab>:%!xxd\ -r " }}} TOOLS / ORODJA " {{{ SYNTAX / BARVANJE KODE @@ -242,7 +242,7 @@ menutrans &About &O\ programu " {{{ POPUP menutrans &Undo &Razveljavi menutrans Cu&t &Izrei -menutrans &Copy &Kopieraj +menutrans &Copy &Kopiraj menutrans &Paste &Prilepi menutrans &Delete &Zbrii menutrans Select\ Blockwise Izbiraj\ po\ blokih diff --git a/runtime/lang/menu_sl_si.latin2.vim b/runtime/lang/menu_sl_si.latin2.vim index fd503871db..a810a2a126 100644 --- a/runtime/lang/menu_sl_si.latin2.vim +++ b/runtime/lang/menu_sl_si.latin2.vim @@ -1,7 +1,7 @@ " Menu Translations: Slovenian / Slovensko " Maintainer: Mojca Miklavec <mojca.miklavec.lists@gmail.com> " Originally By: Mojca Miklavec <mojca.miklavec.lists@gmail.com> -" Last Change: Mon, 12 Jun 2006 00:00:00 CEST +" Last Change: 2016 Oct 17 " vim:set foldmethod=marker tabstop=8: " TODO: add/check all '&'s @@ -31,7 +31,7 @@ menutrans E&xit<Tab>:qa &Izhod<Tab>:qa if has("diff") menutrans Split\ &Diff\ with\.\.\. Primerjaj\ z\ (di&ff)\ \.\.\. - menutrans Split\ Patched\ &By\.\.\. &Popravi\ z\ (patch)\ \.\.\. + menutrans Split\ Patched\ &By\.\.\. &Popravi\ s\ (patch)\ \.\.\. endif " }}} FILE / DATOTEKA @@ -96,12 +96,12 @@ menutrans Soft\ &Tabstop menutrans Te&xt\ Width\.\.\. irina\ besedila\ \.\.\. menutrans &File\ Format\.\.\. Format\ &datoteke\ \.\.\. menutrans C&olor\ Scheme &Barvna\ shema\ \.\.\. -menutrans &Keymap &Keymap +menutrans &Keymap Razporeditev\ tip&k menutrans Select\ Fo&nt\.\.\. Pisava\ \.\.\. " }}} EDIT / UREDI " {{{ TOOLS / ORODJA -menutrans &Tools &Orodja +menutrans &Tools O&rodja menutrans &Jump\ to\ this\ tag<Tab>g^] &Skoi\ k\ tej\ znaki<Tab>g^] menutrans Jump\ &back<Tab>^T Skoi\ Na&zaj<Tab>^T menutrans Build\ &Tags\ File Napravi\ datoteke\ z\ znakami\ (tag) @@ -175,7 +175,7 @@ menutrans &Set\ Compiler Nastavi\ &prevajalnik menutrans Se&T\ Compiler Nastavi\ &prevajalnik " bug in original translation? menutrans &Convert\ to\ HEX<Tab>:%!xxd Pretvori\ v\ HE&X<Tab>:%!xxd -menutrans Conve&rt\ back<Tab>:%!xxd\ -r Pretvori\ nazaj<Tab>:%!xxd\ -r +menutrans Conve&rt\ back<Tab>:%!xxd\ -r Povrni\ pretvo&rbo<Tab>:%!xxd\ -r " }}} TOOLS / ORODJA " {{{ SYNTAX / BARVANJE KODE @@ -242,7 +242,7 @@ menutrans &About &O\ programu " {{{ POPUP menutrans &Undo &Razveljavi menutrans Cu&t &Izrei -menutrans &Copy &Kopieraj +menutrans &Copy &Kopiraj menutrans &Paste &Prilepi menutrans &Delete &Zbrii menutrans Select\ Blockwise Izbiraj\ po\ blokih diff --git a/runtime/lang/menu_sl_si.utf-8.vim b/runtime/lang/menu_sl_si.utf-8.vim index 7043e62dc9..ac5035c7f0 100644 --- a/runtime/lang/menu_sl_si.utf-8.vim +++ b/runtime/lang/menu_sl_si.utf-8.vim @@ -1,7 +1,7 @@ " Menu Translations: Slovenian / Slovensko " Maintainer: Mojca Miklavec <mojca.miklavec.lists@gmail.com> " Originally By: Mojca Miklavec <mojca.miklavec.lists@gmail.com> -" Last Change: Sat, 17 Jun 2006 +" Last Change: 2016 Oct 17 " vim:set foldmethod=marker tabstop=8: " TODO: add/check all '&'s @@ -31,7 +31,7 @@ menutrans E&xit<Tab>:qa &Izhod<Tab>:qa if has("diff") menutrans Split\ &Diff\ with\.\.\. Primerjaj\ z\ (di&ff)\ \.\.\. - menutrans Split\ Patched\ &By\.\.\. &Popravi\ z\ (patch)\ \.\.\. + menutrans Split\ Patched\ &By\.\.\. &Popravi\ s\ (patch)\ \.\.\. endif " }}} FILE / DATOTEKA @@ -96,12 +96,12 @@ menutrans Soft\ &Tabstop Širina\ &tabulatorja menutrans Te&xt\ Width\.\.\. Širina\ besedila\ \.\.\. menutrans &File\ Format\.\.\. Format\ &datoteke\ \.\.\. menutrans C&olor\ Scheme &Barvna\ shema\ \.\.\. -menutrans &Keymap &Keymap +menutrans &Keymap Razporeditev\ tip&k menutrans Select\ Fo&nt\.\.\. Pisava\ \.\.\. " }}} EDIT / UREDI " {{{ TOOLS / ORODJA -menutrans &Tools &Orodja +menutrans &Tools O&rodja menutrans &Jump\ to\ this\ tag<Tab>g^] &Skoči\ k\ tej\ znački<Tab>g^] menutrans Jump\ &back<Tab>^T Skoči\ Na&zaj<Tab>^T menutrans Build\ &Tags\ File Napravi\ datoteke\ z\ značkami\ (tag) @@ -175,7 +175,7 @@ menutrans &Set\ Compiler Nastavi\ &prevajalnik menutrans Se&T\ Compiler Nastavi\ &prevajalnik " bug in original translation? menutrans &Convert\ to\ HEX<Tab>:%!xxd Pretvori\ v\ HE&X<Tab>:%!xxd -menutrans Conve&rt\ back<Tab>:%!xxd\ -r Pretvori\ nazaj<Tab>:%!xxd\ -r +menutrans Conve&rt\ back<Tab>:%!xxd\ -r Povrni\ pretvo&rbo<Tab>:%!xxd\ -r " }}} TOOLS / ORODJA " {{{ SYNTAX / BARVANJE KODE @@ -242,7 +242,7 @@ menutrans &About &O\ programu " {{{ POPUP menutrans &Undo &Razveljavi menutrans Cu&t &Izreži -menutrans &Copy &Kopieraj +menutrans &Copy &Kopiraj menutrans &Paste &Prilepi menutrans &Delete &Zbriši menutrans Select\ Blockwise Izbiraj\ po\ blokih diff --git a/runtime/lang/menu_sr_rs.ascii.vim b/runtime/lang/menu_sr_rs.ascii.vim index 8a12dad8e5..e5b66449eb 100644 --- a/runtime/lang/menu_sr_rs.ascii.vim +++ b/runtime/lang/menu_sr_rs.ascii.vim @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> -" Last Change: Fri, 30 May 2003 12:15:30 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Ivan Pesic on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -19,6 +20,7 @@ menutrans &Find &Nadji menutrans &Credits &Zasluge menutrans Co&pying P&reuzimanje menutrans O&rphans &Sirocici +menutrans &Sponsor/Register Sponzor/&Registrujte\ se menutrans &Version &Verzija menutrans &About &O\ programu @@ -26,6 +28,7 @@ menutrans &About &O\ programu menutrans &File &Datoteka menutrans &Open\.\.\.<Tab>:e &Otvori\.\.\.<Tab>:e menutrans Sp&lit-Open\.\.\.<Tab>:sp &Podeli-otvori\.\.\.<Tab>:sp +menutrans Open\ Tab\.\.\.<Tab>:tabnew Otvori\ karticu\.\.\.<Tab>:tabnew menutrans &New<Tab>:enew &Nova<Tab>:enew menutrans &Close<Tab>:close &Zatvori<Tab>:close menutrans &Save<Tab>:w &Sacuvaj<Tab>:w @@ -52,24 +55,27 @@ menutrans &Select\ all<Tab>ggVG Izaberi\ sv&e<Tab>ggVG menutrans &Find\.\.\. &Nadji\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Nadji\ i\ &zameni\.\.\. menutrans Settings\ &Window P&rozor\ podesavanja +menutrans Startup\ &Settings Po&desavanja\ pri\ pokretanju menutrans &Global\ Settings Op&sta\ podesavanja menutrans F&ile\ Settings Podesavanja\ za\ da&toteke menutrans &Shiftwidth &Pomeraj menutrans Soft\ &Tabstop &Meka\ tabulacija menutrans Te&xt\ Width\.\.\. &Sirina\ teksta\.\.\. menutrans &File\ Format\.\.\. &Vrsta\ datoteke\.\.\. -menutrans C&olor\ Scheme Bo&je -menutrans &Keymap Pres&likavanje\ tastature +menutrans Show\ C&olor\ Schemes\ in\ Menu Prikazi\ seme\ bo&ja\ u\ meniju +menutrans C&olor\ Scheme \Seme\ bo&ja +menutrans Show\ &Keymaps\ in\ Menu Prikazi\ pres&likavanja\ tastature\ u\ meniju +menutrans &Keymap Pres&likavanja\ tastature menutrans Select\ Fo&nt\.\.\. Izbor\ &fonta\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! Naglasi\ &obrazce\ (da/ne)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! Zanemari\ \velicinu\ &slova\ (da/ne)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! Proveri\ pratecu\ &zagradu\ (da/ne)<Tab>:set\ sm! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! Zanemari\ velicinu\ &slova\ (da/ne)<Tab>:set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! Proveri\ pratecu\ &zagradu\ (da/ne)<Tab>:set\ sm! menutrans &Context\ lines Vidljivi\ &redovi menutrans &Virtual\ Edit Virtuelno\ &uredjivanje menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! Rezim\ u&nosa\ (da/ne)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! '&Vi'\ saglasno\ (da/ne)<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! '&Vi'\ saglasno\ (da/ne)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. Putanja\ &pretrage\.\.\. menutrans Ta&g\ Files\.\.\. &Datoteke\ oznaka\.\.\. menutrans Toggle\ &Toolbar Linija\ sa\ &alatkama\ (da/ne) @@ -85,28 +91,30 @@ menutrans Block\ and\ Insert Blok\ i\ unos menutrans Always Uvek " Edit/File Settings -menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Redni\ &brojevi\ (da/ne)<Tab>:set\ nu! -menutrans Toggle\ &List\ Mode<Tab>:set\ list! Rezim\ &liste\ (da/ne)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! Obavijanje\ &redova\ (da/ne)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! Prelomi\ &na\ rec\ (da/ne)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! Auto-&uvlacenje\ (da/ne)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! &Ce-uvlacenje\ (da/ne)<Tab>:set\ cin! +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Prikazi\ &numeraciju\ linija\ (da/ne)<Tab>:set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! Prikazi\ Relati&vnu\ numeraciju\ linija\ (da/ne)<Tab>:set\ rnu! +menutrans Toggle\ &List\ Mode<Tab>:set\ list! Rezim\ &liste\ (da/ne)<Tab>:set\ list! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! Obavijanje\ &redova\ (da/ne)<Tab>:set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! Prelomi\ &na\ rec\ (da/ne)<Tab>:set\ lbr! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne)<Tab>:set\ et! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! Auto-&uvlacenje\ (da/ne)<Tab>:set\ ai! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! &C-uvlacenje\ (da/ne)<Tab>:set\ cin! " Edit/Keymap -menutrans None Nijedan +menutrans None Bez\ preslikavanja " Tools menu menutrans &Tools &Alatke menutrans &Jump\ to\ this\ tag<Tab>g^] Skoci\ na\ &ovu\ oznaku<Tab>g^] menutrans Jump\ &back<Tab>^T Skoci\ &natrag<Tab>^T menutrans Build\ &Tags\ File Izgradi\ &datoteku\ oznaka +menutrans &Spelling Pra&vopis menutrans &Folding &Podvijanje menutrans Create\ &Fold<Tab>zf S&tvori\ podvijutak<Tab>zf menutrans &Delete\ Fold<Tab>zd O&brisi\ podvijutak<Tab>zd menutrans Delete\ &All\ Folds<Tab>zD Obrisi\ sve\ po&dvijutke<Tab>zD menutrans Fold\ column\ &width Sirina\ &reda\ podvijutka -menutrans &Diff &Uporedjivanje +"menutrans &Diff &Uporedjivanje menutrans &Make<Tab>:make 'mak&e'<Tab>:make menutrans &List\ Errors<Tab>:cl Spisak\ &gresaka<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! Sp&isak\ poruka<Tab>:cl! @@ -115,32 +123,49 @@ menutrans &Previous\ Error<Tab>:cp Pre&thodna\ greska<Tab>:cp menutrans &Older\ List<Tab>:cold Stari\ spisa&k<Tab>:cold menutrans N&ewer\ List<Tab>:cnew No&vi\ spisak<Tab>:cnew menutrans Error\ &Window Prozor\ sa\ g&reskama -menutrans &Set\ Compiler I&zaberi\ prevodioca +menutrans Se&t\ Compiler I&zaberi\ prevodioca menutrans &Convert\ to\ HEX<Tab>:%!xxd Pretvori\ u\ &HEKS<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r Vr&ati\ u\ prvobitan\ oblik<Tab>:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Prikazi\ pode&savanja\ prevodioca\ u\ meniju + +" Tools/Spelling +menutrans &Spell\ Check\ On &Ukljuci\ proveru\ pravopisa +menutrans Spell\ Check\ &Off &Iskljuci\ proveru\ pravopisa +menutrans To\ &Next\ Error<Tab>]s Idi\ na\ &sledecu\ gresku<Tab>]s +menutrans To\ &Previous\ Error<Tab>[s Idi\ na\ &prethodnu\ gresku<Tab>[s +menutrans Suggest\ &Corrections<Tab>z= Predlozi\ isp&ravke<Tab>z= +menutrans &Repeat\ Correction<Tab>:spellrepall P&onovi\ ispravku<Tab>:spellrepall +menutrans Set\ Language\ to\ "en" Postavi\ jezik\ na\ "en" +menutrans Set\ Language\ to\ "en_au" Postavi\ jezik\ na\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Postavi\ jezik\ na\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Postavi\ jezik\ na\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Postavi\ jezik\ na\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Postavi\ jezik\ na\ "en_us" +menutrans &Find\ More\ Languages Pronadji\ jos\ jezika " Tools/Folding menutrans &Enable/Disable\ folds<Tab>zi &Omoguci/prekini\ podvijanje<Tab>zi -menutrans &View\ Cursor\ Line<Tab>zv &Pokazi\ red\ sa\ kursorom<Tab>zv +menutrans &View\ Cursor\ Line<Tab>zv &Pokazi\ red\ sa\ kursorom<Tab>zv menutrans Vie&w\ Cursor\ Line\ only<Tab>zMzx Pokazi\ &samo\ red\ sa\ kursorom<Tab>zMzx menutrans C&lose\ more\ folds<Tab>zm &Zatvori\ vise\ podvijutaka<Tab>zm menutrans &Close\ all\ folds<Tab>zM Zatvori\ s&ve\ podvijutke<Tab>zM menutrans O&pen\ more\ folds<Tab>zr Otvori\ vis&e\ podvijutaka<Tab>zr menutrans &Open\ all\ folds<Tab>zR O&tvori\ sve\ podvijutke<Tab>zR menutrans Fold\ Met&hod &Nacin\ podvijanja +menutrans Fold\ Col&umn\ Width Sirina\ kolone\ ispred\ podvijutaka " Tools/Folding/Fold Method -menutrans M&anual &Rucno -menutrans I&ndent &Uvucenost -menutrans E&xpression &Izraz -menutrans S&yntax &Sintaksa +menutrans M&anual &Rucno +menutrans I&ndent &Uvucenost +menutrans E&xpression &Izraz +menutrans S&yntax &Sintaksa "menutrans &Diff -menutrans Ma&rker &Oznaka +menutrans Ma&rker &Oznaka " Tools/Diff -menutrans &Update &Azuriraj -menutrans &Get\ Block &Prihvati\ izmenu -menutrans &Put\ Block Pre&baci\ izmenu +menutrans &Update &Azuriraj +menutrans &Get\ Block &Prihvati\ blok\ izmena +menutrans &Put\ Block Pre&baci\ blok\ izmena " Tools/Error Window menutrans &Update<Tab>:cwin &Azuriraj<Tab>:cwin @@ -188,8 +213,10 @@ menutrans Cu&t &Iseci menutrans &Copy &Kopiraj menutrans &Paste &Ubaci menutrans &Delete I&zbrisi -menutrans Select\ Blockwise Biraj\ &pravougaono +menutrans Select\ Blockwise Biraj\ b&lokovski menutrans Select\ &Word Izaberi\ &rec +menutrans Select\ &Sentence Izaberi\ r&ecenicu +menutrans Select\ Pa&ragraph Izaberi\ ¶graf menutrans Select\ &Line Izaberi\ r&ed menutrans Select\ &Block Izaberi\ &blok menutrans Select\ &All Izaberi\ &sve @@ -235,9 +262,9 @@ endif " Syntax menu menutrans &Syntax &Sintaksa -menutrans &Show\ filetypes\ in\ menu Izbor\ 'filetype'\ iz\ &menija -menutrans Set\ '&syntax'\ only Pode&si\ 'syntax'\ samo -menutrans Set\ '&filetype'\ too Podesi\ 'filetype'\ &takodje +menutrans &Show\ File\ Types\ in\ Menu Prikazi\ tipove\ datoteka\ u\ &meniju +menutrans Set\ '&syntax'\ only Pode&si\ samo\ 'syntax' +menutrans Set\ '&filetype'\ too Podesi\ &takodje\ i\ 'filetype' menutrans &Off &Iskljuceno menutrans &Manual &Rucno menutrans A&utomatic &Automatski @@ -255,9 +282,13 @@ let g:menutrans_tags_dialog = "Unesite imena datoteka sa oznakama\nRazdvojite za let g:menutrans_textwidth_dialog = "Unesite novu sirinu teksta (0 sprecava prelom)" -let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" +let g:menutrans_fileformat_dialog = "Izaberite format zapisa datoteke" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Otkazi" let menutrans_no_file = "[Nema datoteke]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff --git a/runtime/lang/menu_sr_rs.iso_8859-2.vim b/runtime/lang/menu_sr_rs.iso_8859-2.vim index f4b8c68fbb..e7e0db58e9 100644 --- a/runtime/lang/menu_sr_rs.iso_8859-2.vim +++ b/runtime/lang/menu_sr_rs.iso_8859-2.vim @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> -" Last Change: Fri, 30 May 2003 12:04:48 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Ivan Pei on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Find &Na menutrans &Credits &Zasluge menutrans Co&pying P&reuzimanje menutrans O&rphans &Siroii +menutrans &Sponsor/Register Sponzor/&Registrujte\ se menutrans &Version &Verzija menutrans &About &O\ programu @@ -28,6 +30,7 @@ menutrans &About &O\ programu menutrans &File &Datoteka menutrans &Open\.\.\.<Tab>:e &Otvori\.\.\.<Tab>:e menutrans Sp&lit-Open\.\.\.<Tab>:sp &Podeli-otvori\.\.\.<Tab>:sp +menutrans Open\ Tab\.\.\.<Tab>:tabnew Otvori\ karticu\.\.\.<Tab>:tabnew menutrans &New<Tab>:enew &Nova<Tab>:enew menutrans &Close<Tab>:close &Zatvori<Tab>:close menutrans &Save<Tab>:w &Sauvaj<Tab>:w @@ -54,24 +57,27 @@ menutrans &Select\ all<Tab>ggVG Izaberi\ sv&e<Tab>ggVG menutrans &Find\.\.\. &Nai\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Nai\ i\ &zameni\.\.\. menutrans Settings\ &Window P&rozor\ podeavanja +menutrans Startup\ &Settings Po&deavanja\ pri\ pokretanju menutrans &Global\ Settings Op&ta\ podeavanja menutrans F&ile\ Settings Podeavanja\ za\ da&toteke menutrans &Shiftwidth &Pomeraj menutrans Soft\ &Tabstop &Meka\ tabulacija menutrans Te&xt\ Width\.\.\. &irina\ teksta\.\.\. menutrans &File\ Format\.\.\. &Vrsta\ datoteke\.\.\. -menutrans C&olor\ Scheme Bo&je -menutrans &Keymap Pres&likavanje\ tastature +menutrans Show\ C&olor\ Schemes\ in\ Menu Prikai\ eme\ bo&ja\ u\ meniju +menutrans C&olor\ Scheme \eme\ bo&ja +menutrans Show\ &Keymaps\ in\ Menu Prikai\ pres&likavanja\ tastature\ u\ meniju +menutrans &Keymap Pres&likavanja\ tastature menutrans Select\ Fo&nt\.\.\. Izbor\ &fonta\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! Naglasi\ &obrazce\ (da/ne)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! Zanemari\ \veliinu\ &slova\ (da/ne)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! Proveri\ prateu\ &zagradu\ (da/ne)<Tab>:set\ sm! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! Zanemari\ veliinu\ &slova\ (da/ne)<Tab>:set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! Proveri\ prateu\ &zagradu\ (da/ne)<Tab>:set\ sm! menutrans &Context\ lines Vidljivi\ &redovi menutrans &Virtual\ Edit Virtuelno\ &ureivanje -menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! Reim\ u&nosa\ (da/ne)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! '&Vi'\ saglasno\ (da/ne)<Tab>:set\ cp! +menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! Reim\ u&nosa\ (da/ne)<Tab>:set\ im! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! '&Vi'\ saglasno\ (da/ne)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. Putanja\ &pretrage\.\.\. menutrans Ta&g\ Files\.\.\. &Datoteke\ oznaka\.\.\. menutrans Toggle\ &Toolbar Linija\ sa\ &alatkama\ (da/ne) @@ -87,28 +93,30 @@ menutrans Block\ and\ Insert Blok\ i\ unos menutrans Always Uvek " Edit/File Settings -menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Redni\ &brojevi\ (da/ne)<Tab>:set\ nu! +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Prikai\ &numeraciju\ linija\ (da/ne)<Tab>:set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! Prikai\ Relati&vnu\ numeraciju\ linija\ (da/ne)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! Reim\ &liste\ (da/ne)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! Obavijanje\ &redova\ (da/ne)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! Prelomi\ &na\ re\ (da/ne)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! Auto-&uvlaenje\ (da/ne)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! &Ce-uvlaenje\ (da/ne)<Tab>:set\ cin! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! Obavijanje\ &redova\ (da/ne)<Tab>:set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! Prelomi\ &na\ re\ (da/ne)<Tab>:set\ lbr! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne)<Tab>:set\ et! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! Auto-&uvlaenje\ (da/ne)<Tab>:set\ ai! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! &C-uvlaenje\ (da/ne)<Tab>:set\ cin! " Edit/Keymap -menutrans None Nijedan +menutrans None Bez\ preslikavanja " Tools menu menutrans &Tools &Alatke menutrans &Jump\ to\ this\ tag<Tab>g^] Skoi\ na\ &ovu\ oznaku<Tab>g^] menutrans Jump\ &back<Tab>^T Skoi\ &natrag<Tab>^T menutrans Build\ &Tags\ File Izgradi\ &datoteku\ oznaka +menutrans &Spelling Pra&vopis menutrans &Folding &Podvijanje menutrans Create\ &Fold<Tab>zf S&tvori\ podvijutak<Tab>zf menutrans &Delete\ Fold<Tab>zd O&brii\ podvijutak<Tab>zd menutrans Delete\ &All\ Folds<Tab>zD Obrii\ sve\ po&dvijutke<Tab>zD menutrans Fold\ column\ &width irina\ &reda\ podvijutka -menutrans &Diff &Uporeivanje +"menutrans &Diff &Uporeivanje menutrans &Make<Tab>:make 'mak&e'<Tab>:make menutrans &List\ Errors<Tab>:cl Spisak\ &greaka<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! Sp&isak\ poruka<Tab>:cl! @@ -117,9 +125,25 @@ menutrans &Previous\ Error<Tab>:cp Pre&thodna\ gre menutrans &Older\ List<Tab>:cold Stari\ spisa&k<Tab>:cold menutrans N&ewer\ List<Tab>:cnew No&vi\ spisak<Tab>:cnew menutrans Error\ &Window Prozor\ sa\ g&rekama -menutrans &Set\ Compiler I&zaberi\ prevodioca +menutrans Se&t\ Compiler I&zaberi\ prevodioca menutrans &Convert\ to\ HEX<Tab>:%!xxd Pretvori\ u\ &HEKS<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r Vr&ati\ u\ prvobitan\ oblik<Tab>:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Prikai\ pode&avanja\ prevodioca\ u\ meniju + +" Tools/Spelling +menutrans &Spell\ Check\ On &Ukljui\ proveru\ pravopisa +menutrans Spell\ Check\ &Off &Iskljui\ proveru\ pravopisa +menutrans To\ &Next\ Error<Tab>]s Idi\ na\ &sledeu\ greku<Tab>]s +menutrans To\ &Previous\ Error<Tab>[s Idi\ na\ &prethodnu\ greku<Tab>[s +menutrans Suggest\ &Corrections<Tab>z= Predloi\ isp&ravke<Tab>z= +menutrans &Repeat\ Correction<Tab>:spellrepall P&onovi\ ispravku<Tab>:spellrepall +menutrans Set\ Language\ to\ "en" Postavi\ jezik\ na\ "en" +menutrans Set\ Language\ to\ "en_au" Postavi\ jezik\ na\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Postavi\ jezik\ na\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Postavi\ jezik\ na\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Postavi\ jezik\ na\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Postavi\ jezik\ na\ "en_us" +menutrans &Find\ More\ Languages Pronai\ jo\ jezika " Tools/Folding menutrans &Enable/Disable\ folds<Tab>zi &Omogui/prekini\ podvijanje<Tab>zi @@ -130,6 +154,7 @@ menutrans &Close\ all\ folds<Tab>zM Zatvori\ s&ve\ podvijutke<Tab>zM menutrans O&pen\ more\ folds<Tab>zr Otvori\ vi&e\ podvijutaka<Tab>zr menutrans &Open\ all\ folds<Tab>zR O&tvori\ sve\ podvijutke<Tab>zR menutrans Fold\ Met&hod &Nain\ podvijanja +menutrans Fold\ Col&umn\ Width irina\ kolone\ ispred\ podvijutaka " Tools/Folding/Fold Method menutrans M&anual &Runo @@ -141,8 +166,8 @@ menutrans Ma&rker &Oznaka " Tools/Diff menutrans &Update &Auriraj -menutrans &Get\ Block &Prihvati\ izmenu -menutrans &Put\ Block Pre&baci\ izmenu +menutrans &Get\ Block &Prihvati\ blok\ izmena +menutrans &Put\ Block Pre&baci\ blok\ izmena " Tools/Error Window menutrans &Update<Tab>:cwin &Auriraj<Tab>:cwin @@ -190,8 +215,10 @@ menutrans Cu&t &Iseci menutrans &Copy &Kopiraj menutrans &Paste &Ubaci menutrans &Delete I&zbrii -menutrans Select\ Blockwise Biraj\ &pravougaono +menutrans Select\ Blockwise Biraj\ b&lokovski menutrans Select\ &Word Izaberi\ &re +menutrans Select\ &Sentence Izaberi\ r&eenicu +menutrans Select\ Pa&ragraph Izaberi\ ¶graf menutrans Select\ &Line Izaberi\ r&ed menutrans Select\ &Block Izaberi\ &blok menutrans Select\ &All Izaberi\ &sve @@ -202,20 +229,20 @@ if has("toolbar") delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() - tmenu ToolBar.Open Uitaj - tmenu ToolBar.Save Sauvaj + tmenu ToolBar.Open Uitaj + tmenu ToolBar.Save Sauvaj tmenu ToolBar.SaveAll Sauvaj sve tmenu ToolBar.Print tampaj - tmenu ToolBar.Undo Vrati - tmenu ToolBar.Redo Povrati - tmenu ToolBar.Cut Iseci - tmenu ToolBar.Copy Kopiraj + tmenu ToolBar.Undo Vrati + tmenu ToolBar.Redo Povrati + tmenu ToolBar.Cut Iseci + tmenu ToolBar.Copy Kopiraj tmenu ToolBar.Paste Ubaci - tmenu ToolBar.Find Nai + tmenu ToolBar.Find Nai tmenu ToolBar.FindNext Nai sledei tmenu ToolBar.FindPrev Nai prethodni tmenu ToolBar.Replace Zameni - tmenu ToolBar.New Novi + tmenu ToolBar.New Novi tmenu ToolBar.WinSplit Podeli prozor tmenu ToolBar.WinMax Maksimalna visina tmenu ToolBar.WinMin Minimalna visina @@ -226,25 +253,25 @@ if has("toolbar") tmenu ToolBar.LoadSesn Uitaj seansu tmenu ToolBar.SaveSesn Sauvaj seansu tmenu ToolBar.RunScript Izvri spis - tmenu ToolBar.Make 'make' + tmenu ToolBar.Make 'make' tmenu ToolBar.Shell Operativno okruenje tmenu ToolBar.RunCtags Napravi oznake tmenu ToolBar.TagJump Idi na oznaku - tmenu ToolBar.Help Pomo + tmenu ToolBar.Help Pomo tmenu ToolBar.FindHelp Nai objanjenje endfun endif " Syntax menu menutrans &Syntax &Sintaksa -menutrans &Show\ filetypes\ in\ menu Izbor\ 'filetype'\ iz\ &menija -menutrans Set\ '&syntax'\ only Pode&si\ 'syntax'\ samo -menutrans Set\ '&filetype'\ too Podesi\ 'filetype'\ &takoe -menutrans &Off &Iskljueno +menutrans &Show\ File\ Types\ in\ Menu Prikai\ tipove\ datoteka\ u\ &meniju +menutrans Set\ '&syntax'\ only Pode&si\ samo\ 'syntax' +menutrans Set\ '&filetype'\ too Podesi\ &takoe\ i\ 'filetype' +menutrans &Off &Iskljueno menutrans &Manual &Runo -menutrans A&utomatic &Automatski +menutrans A&utomatic &Automatski menutrans on/off\ for\ &This\ file Da/ne\ za\ ovu\ &datoteku -menutrans Co&lor\ test Provera\ &boja +menutrans Co&lor\ test Provera\ &boja menutrans &Highlight\ test Provera\ isti&canja menutrans &Convert\ to\ HTML Pretvori\ &u\ HTML @@ -257,9 +284,13 @@ let g:menutrans_tags_dialog = "Unesite imena datoteka sa oznakama\nRazdvojite za let g:menutrans_textwidth_dialog = "Unesite novu irinu teksta (0 spreava prelom)" -let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" +let g:menutrans_fileformat_dialog = "Izaberite format zapisa datoteke" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Otkai" let menutrans_no_file = "[Nema datoteke]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff --git a/runtime/lang/menu_sr_rs.iso_8859-5.vim b/runtime/lang/menu_sr_rs.iso_8859-5.vim index dd3b436833..f2b1ee37aa 100644 --- a/runtime/lang/menu_sr_rs.iso_8859-5.vim +++ b/runtime/lang/menu_sr_rs.iso_8859-5.vim @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> -" Last Change: Fri, 30 May 2003 12:02:07 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Find & menutrans &Credits & menutrans Co&pying & menutrans O&rphans & +menutrans &Sponsor/Register /&\ menutrans &Version & menutrans &About &\ @@ -28,6 +30,7 @@ menutrans &About & menutrans &File & menutrans &Open\.\.\.<Tab>:e &\.\.\.<Tab>:e menutrans Sp&lit-Open\.\.\.<Tab>:sp &-\.\.\.<Tab>:sp +menutrans Open\ Tab\.\.\.<Tab>:tabnew \ \.\.\.<Tab>:tabnew menutrans &New<Tab>:enew &<Tab>:enew menutrans &Close<Tab>:close &<Tab>:close menutrans &Save<Tab>:w &<Tab>:w @@ -54,24 +57,27 @@ menutrans &Select\ all<Tab>ggVG menutrans &Find\.\.\. &\.\.\. menutrans Find\ and\ Rep&lace\.\.\. \ \ &\.\.\. menutrans Settings\ &Window &\ +menutrans Startup\ &Settings &\ \ menutrans &Global\ Settings &\ menutrans F&ile\ Settings \ \ & menutrans &Shiftwidth & menutrans Soft\ &Tabstop &\ menutrans Te&xt\ Width\.\.\. &\ \.\.\. menutrans &File\ Format\.\.\. &\ \.\.\. -menutrans C&olor\ Scheme & -menutrans &Keymap &\ +menutrans Show\ C&olor\ Schemes\ in\ Menu \ \ &\ \ +menutrans C&olor\ Scheme \\ & +menutrans Show\ &Keymaps\ in\ Menu \ &\ \ \ +menutrans &Keymap &\ menutrans Select\ Fo&nt\.\.\. \ &\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! \ &\ (/)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! \ \\ &\ (/)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! \ \ &\ (/)<Tab>:set\ sm! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! \ \ &\ (/)<Tab>:set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! \ \ &\ (/)<Tab>:set\ sm! menutrans &Context\ lines \ & menutrans &Virtual\ Edit \ & -menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! \ &\ (/)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! '&Vi'\ \ (/)<Tab>:set\ cp! +menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! \ &\ (/)<Tab>:set\ im! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! '&Vi'\ \ (/)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. \ &\.\.\. menutrans Ta&g\ Files\.\.\. &\ \.\.\. menutrans Toggle\ &Toolbar \ \ &\ (/) @@ -87,28 +93,30 @@ menutrans Block\ and\ Insert menutrans Always " Edit/File Settings -menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! \ &\ (/)<Tab>:set\ nu! +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! \ &\ \ (/)<Tab>:set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! \ &\ \ \ (/)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! \ &\ (/)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! \ &\ (/)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! \ &\ \ (/)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! \ \ &\ (/)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! -&\ (/)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! &-\ (/)<Tab>:set\ cin! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! \ &\ (/)<Tab>:set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! \ &\ \ (/)<Tab>:set\ lbr! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! \ \ &\ (/)<Tab>:set\ et! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! -&\ (/)<Tab>:set\ ai! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! &C-\ (/)<Tab>:set\ cin! " Edit/Keymap -menutrans None +menutrans None \ " Tools menu menutrans &Tools & menutrans &Jump\ to\ this\ tag<Tab>g^] \ \ &\ <Tab>g^] menutrans Jump\ &back<Tab>^T \ &<Tab>^T menutrans Build\ &Tags\ File \ &\ +menutrans &Spelling & menutrans &Folding & menutrans Create\ &Fold<Tab>zf &\ <Tab>zf menutrans &Delete\ Fold<Tab>zd &\ <Tab>zd menutrans Delete\ &All\ Folds<Tab>zD \ \ &<Tab>zD menutrans Fold\ column\ &width \ &\ -menutrans &Diff & +"menutrans &Diff & menutrans &Make<Tab>:make 'mak&'<Tab>:make menutrans &List\ Errors<Tab>:cl \ &<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! &\ <Tab>:cl! @@ -117,9 +125,25 @@ menutrans &Previous\ Error<Tab>:cp menutrans &Older\ List<Tab>:cold \ &<Tab>:cold menutrans N&ewer\ List<Tab>:cnew &\ <Tab>:cnew menutrans Error\ &Window \ \ & -menutrans &Set\ Compiler &\ +menutrans Se&t\ Compiler &\ menutrans &Convert\ to\ HEX<Tab>:%!xxd \ \ &ŵ<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r &\ \ \ <Tab>:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu \ &\ \ \ + +" Tools/Spelling +menutrans &Spell\ Check\ On &\ \ +menutrans Spell\ Check\ &Off &\ \ +menutrans To\ &Next\ Error<Tab>]s \ \ &\ <Tab>]s +menutrans To\ &Previous\ Error<Tab>[s \ \ &\ <Tab>[s +menutrans Suggest\ &Corrections<Tab>z= \ &<Tab>z= +menutrans &Repeat\ Correction<Tab>:spellrepall &\ <Tab>:spellrepall +menutrans Set\ Language\ to\ "en" \ \ \ "en" +menutrans Set\ Language\ to\ "en_au" \ \ \ "en_au" +menutrans Set\ Language\ to\ "en_ca" \ \ \ "en_ca" +menutrans Set\ Language\ to\ "en_gb" \ \ \ "en_gb" +menutrans Set\ Language\ to\ "en_nz" \ \ \ "en_nz" +menutrans Set\ Language\ to\ "en_us" \ \ \ "en_us" +menutrans &Find\ More\ Languages \ \ " Tools/Folding menutrans &Enable/Disable\ folds<Tab>zi &/\ <Tab>zi @@ -130,6 +154,7 @@ menutrans &Close\ all\ folds<Tab>zM menutrans O&pen\ more\ folds<Tab>zr \ &\ <Tab>zr menutrans &Open\ all\ folds<Tab>zR &\ \ <Tab>zR menutrans Fold\ Met&hod &\ +menutrans Fold\ Col&umn\ Width \ \ \ " Tools/Folding/Fold Method menutrans M&anual & @@ -141,8 +166,8 @@ menutrans Ma&rker & " Tools/Diff menutrans &Update & -menutrans &Get\ Block &\ -menutrans &Put\ Block &\ +menutrans &Get\ Block &\ \ a +menutrans &Put\ Block &\ \ " Tools/Error Window menutrans &Update<Tab>:cwin &<Tab>:cwin @@ -190,8 +215,10 @@ menutrans Cu&t & menutrans &Copy & menutrans &Paste & menutrans &Delete & -menutrans Select\ Blockwise \ & +menutrans Select\ Blockwise \ & menutrans Select\ &Word \ & +menutrans Select\ &Sentence \ & +menutrans Select\ Pa&ragraph \ & menutrans Select\ &Line \ & menutrans Select\ &Block \ & menutrans Select\ &All \ & @@ -202,20 +229,20 @@ if has("toolbar") delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() - tmenu ToolBar.Open - tmenu ToolBar.Save + tmenu ToolBar.Open + tmenu ToolBar.Save tmenu ToolBar.SaveAll tmenu ToolBar.Print - tmenu ToolBar.Undo - tmenu ToolBar.Redo - tmenu ToolBar.Cut - tmenu ToolBar.Copy + tmenu ToolBar.Undo + tmenu ToolBar.Redo + tmenu ToolBar.Cut + tmenu ToolBar.Copy tmenu ToolBar.Paste - tmenu ToolBar.Find + tmenu ToolBar.Find tmenu ToolBar.FindNext tmenu ToolBar.FindPrev tmenu ToolBar.Replace - tmenu ToolBar.New + tmenu ToolBar.New tmenu ToolBar.WinSplit tmenu ToolBar.WinMax tmenu ToolBar.WinMin @@ -226,25 +253,25 @@ if has("toolbar") tmenu ToolBar.LoadSesn tmenu ToolBar.SaveSesn tmenu ToolBar.RunScript - tmenu ToolBar.Make 'make' + tmenu ToolBar.Make 'make' tmenu ToolBar.Shell tmenu ToolBar.RunCtags tmenu ToolBar.TagJump - tmenu ToolBar.Help + tmenu ToolBar.Help tmenu ToolBar.FindHelp endfun endif " Syntax menu menutrans &Syntax & -menutrans &Show\ filetypes\ in\ menu \ 'filetype'\ \ & -menutrans Set\ '&syntax'\ only &\ 'syntax'\ -menutrans Set\ '&filetype'\ too \ 'filetype'\ & -menutrans &Off & +menutrans &Show\ File\ Types\ in\ Menu \ \ \ \ & +menutrans Set\ '&syntax'\ only &\ \ 'syntax' +menutrans Set\ '&filetype'\ too \ &\ \ 'filetype' +menutrans &Off & menutrans &Manual & -menutrans A&utomatic & +menutrans A&utomatic & menutrans on/off\ for\ &This\ file /\ \ \ & -menutrans Co&lor\ test \ & +menutrans Co&lor\ test \ & menutrans &Highlight\ test \ & menutrans &Convert\ to\ HTML \ &\ HTML @@ -257,9 +284,13 @@ let g:menutrans_tags_dialog = " let g:menutrans_textwidth_dialog = " (0 )" -let g:menutrans_fileformat_dialog = " " +let g:menutrans_fileformat_dialog = " " + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&" let menutrans_no_file = "[ ]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff --git a/runtime/lang/menu_sr_rs.utf-8.vim b/runtime/lang/menu_sr_rs.utf-8.vim index b9e536dac4..21cd684990 100644 --- a/runtime/lang/menu_sr_rs.utf-8.vim +++ b/runtime/lang/menu_sr_rs.utf-8.vim @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> " Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Иван Пешић on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Find &Нађи menutrans &Credits &Заслуге menutrans Co&pying П&реузимање menutrans O&rphans &Сирочићи +menutrans &Sponsor/Register Спонзор/&Региструјте\ се menutrans &Version &Верзија menutrans &About &О\ програму @@ -28,6 +30,7 @@ menutrans &About &О\ програму menutrans &File &Датотека menutrans &Open\.\.\.<Tab>:e &Отвори\.\.\.<Tab>:e menutrans Sp&lit-Open\.\.\.<Tab>:sp &Подели-отвори\.\.\.<Tab>:sp +menutrans Open\ Tab\.\.\.<Tab>:tabnew Отвори\ картицу\.\.\.<Tab>:tabnew menutrans &New<Tab>:enew &Нова<Tab>:enew menutrans &Close<Tab>:close &Затвори<Tab>:close menutrans &Save<Tab>:w &Сачувај<Tab>:w @@ -54,24 +57,27 @@ menutrans &Select\ all<Tab>ggVG Изабери\ св&е<Tab>ggVG menutrans &Find\.\.\. &Нађи\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Нађи\ и\ &замени\.\.\. menutrans Settings\ &Window П&розор\ подешавања +menutrans Startup\ &Settings По&дешавања\ при\ покретању menutrans &Global\ Settings Оп&шта\ подешавања menutrans F&ile\ Settings Подешавања\ за\ да&тотеке menutrans &Shiftwidth &Померај menutrans Soft\ &Tabstop &Мека\ табулација menutrans Te&xt\ Width\.\.\. &Ширина\ текста\.\.\. menutrans &File\ Format\.\.\. &Врста\ датотеке\.\.\. -menutrans C&olor\ Scheme Бо&је -menutrans &Keymap Прес&ликавање\ тастатуре +menutrans Show\ C&olor\ Schemes\ in\ Menu Прикажи\ шеме\ бо&ја\ у\ менију +menutrans C&olor\ Scheme \Шеме\ бо&ја +menutrans Show\ &Keymaps\ in\ Menu Прикажи\ прес&ликавања\ тастатуре\ у\ менију +menutrans &Keymap Прес&ликавања\ тастатуре menutrans Select\ Fo&nt\.\.\. Избор\ &фонта\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight<Tab>:set\ hls! Нагласи\ &образце\ (да/не)<Tab>:set\ hls! -menutrans Toggle\ &Ignore-case<Tab>:set\ ic! Занемари\ \величину\ &слова\ (да/не)<Tab>:set\ ic! -menutrans Toggle\ &Showmatch<Tab>:set\ sm! Провери\ пратећу\ &заграду\ (да/не)<Tab>:set\ sm! +menutrans Toggle\ &Ignoring\ Case<Tab>:set\ ic! Занемари\ величину\ &слова\ (да/не)<Tab>:set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! Провери\ пратећу\ &заграду\ (да/не)<Tab>:set\ sm! menutrans &Context\ lines Видљиви\ &редови menutrans &Virtual\ Edit Виртуелно\ &уређивање menutrans Toggle\ Insert\ &Mode<Tab>:set\ im! Режим\ у&носа\ (да/не)<Tab>:set\ im! -menutrans Toggle\ Vi\ C&ompatible<Tab>:set\ cp! '&Vi'\ сагласно\ (да/не)<Tab>:set\ cp! +menutrans Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! '&Vi'\ сагласно\ (да/не)<Tab>:set\ cp! menutrans Search\ &Path\.\.\. Путања\ &претраге\.\.\. menutrans Ta&g\ Files\.\.\. &Датотеке\ ознака\.\.\. menutrans Toggle\ &Toolbar Линија\ са\ &алаткама\ (да/не) @@ -87,28 +93,30 @@ menutrans Block\ and\ Insert Блок\ и\ унос menutrans Always Увек " Edit/File Settings -menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Редни\ &бројеви\ (да/не)<Tab>:set\ nu! +menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! Прикажи\ &нумерацију\ линија\ (да/не)<Tab>:set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! Прикажи\ Релати&вну\ нумерацију\ линија\ (да/не)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! Режим\ &листе\ (да/не)<Tab>:set\ list! -menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! Обавијање\ &редова\ (да/не)<Tab>:set\ wrap! -menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! Преломи\ &на\ реч\ (да/не)<Tab>:set\ lbr! -menutrans Toggle\ &expand-tab<Tab>:set\ et! Размаци\ уместо\ &табулације\ (да/не)<Tab>:set\ et! -menutrans Toggle\ &auto-indent<Tab>:set\ ai! Ауто-&увлачење\ (да/не)<Tab>:set\ ai! -menutrans Toggle\ &C-indenting<Tab>:set\ cin! &Це-увлачење\ (да/не)<Tab>:set\ cin! +menutrans Toggle\ Line\ &Wrapping<Tab>:set\ wrap! Обавијање\ &редова\ (да/не)<Tab>:set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! Преломи\ &на\ реч\ (да/не)<Tab>:set\ lbr! +menutrans Toggle\ Tab\ &Expanding<Tab>:set\ et! Размаци\ уместо\ &табулације\ (да/не)<Tab>:set\ et! +menutrans Toggle\ &Auto\ Indenting<Tab>:set\ ai! Ауто-&увлачење\ (да/не)<Tab>:set\ ai! +menutrans Toggle\ &C-Style\ Indenting<Tab>:set\ cin! &C-увлачење\ (да/не)<Tab>:set\ cin! " Edit/Keymap -menutrans None Ниједан +menutrans None Без\ пресликавања " Tools menu menutrans &Tools &Алатке menutrans &Jump\ to\ this\ tag<Tab>g^] Скочи\ на\ &ову\ ознаку<Tab>g^] menutrans Jump\ &back<Tab>^T Скочи\ &натраг<Tab>^T menutrans Build\ &Tags\ File Изгради\ &датотеку\ ознака +menutrans &Spelling Пра&вопис menutrans &Folding &Подвијање menutrans Create\ &Fold<Tab>zf С&твори\ подвијутак<Tab>zf menutrans &Delete\ Fold<Tab>zd О&бриши\ подвијутак<Tab>zd menutrans Delete\ &All\ Folds<Tab>zD Обриши\ све\ по&двијутке<Tab>zD menutrans Fold\ column\ &width Ширина\ &реда\ подвијутка -menutrans &Diff &Упоређивање +"menutrans &Diff &Упоређивање menutrans &Make<Tab>:make 'mak&е'<Tab>:make menutrans &List\ Errors<Tab>:cl Списак\ &грешака<Tab>:cl menutrans L&ist\ Messages<Tab>:cl! Сп&исак\ порука<Tab>:cl! @@ -117,9 +125,25 @@ menutrans &Previous\ Error<Tab>:cp Пре&тходна\ грешка<Tab>:cp menutrans &Older\ List<Tab>:cold Стари\ списа&к<Tab>:cold menutrans N&ewer\ List<Tab>:cnew Но&ви\ списак<Tab>:cnew menutrans Error\ &Window Прозор\ са\ г&решкама -menutrans &Set\ Compiler И&забери\ преводиоца +menutrans Se&t\ Compiler И&забери\ преводиоца menutrans &Convert\ to\ HEX<Tab>:%!xxd Претвори\ у\ &ХЕКС<Tab>:%!xxd menutrans Conve&rt\ back<Tab>:%!xxd\ -r Вр&ати\ у\ првобитан\ облик<Tab>:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Прикажи\ поде&шавања\ преводиоца\ у\ менију + +" Tools/Spelling +menutrans &Spell\ Check\ On &Укључи\ проверу\ правописа +menutrans Spell\ Check\ &Off &Искључи\ проверу\ правописа +menutrans To\ &Next\ Error<Tab>]s Иди\ на\ &следећу\ грешку<Tab>]s +menutrans To\ &Previous\ Error<Tab>[s Иди\ на\ &претходну\ грешку<Tab>[s +menutrans Suggest\ &Corrections<Tab>z= Предложи\ исп&равке<Tab>z= +menutrans &Repeat\ Correction<Tab>:spellrepall П&онови\ исправку<Tab>:spellrepall +menutrans Set\ Language\ to\ "en" Постави\ језик\ на\ "en" +menutrans Set\ Language\ to\ "en_au" Постави\ језик\ на\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Постави\ језик\ на\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Постави\ језик\ на\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Постави\ језик\ на\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Постави\ језик\ на\ "en_us" +menutrans &Find\ More\ Languages Пронађи\ још\ језика " Tools/Folding menutrans &Enable/Disable\ folds<Tab>zi &Омогући/прекини\ подвијање<Tab>zi @@ -130,6 +154,7 @@ menutrans &Close\ all\ folds<Tab>zM Затвори\ с&ве\ подвијут menutrans O&pen\ more\ folds<Tab>zr Отвори\ виш&е\ подвијутака<Tab>zr menutrans &Open\ all\ folds<Tab>zR О&твори\ све\ подвијутке<Tab>zR menutrans Fold\ Met&hod &Начин\ подвијања +menutrans Fold\ Col&umn\ Width Ширина\ колоне\ испред\ подвијутака " Tools/Folding/Fold Method menutrans M&anual &Ручно @@ -141,8 +166,8 @@ menutrans Ma&rker &Ознака " Tools/Diff menutrans &Update &Ажурирај -menutrans &Get\ Block &Прихвати\ измену -menutrans &Put\ Block Пре&баци\ измену +menutrans &Get\ Block &Прихвати\ блок\ изменa +menutrans &Put\ Block Пре&баци\ блок\ измена " Tools/Error Window menutrans &Update<Tab>:cwin &Ажурирај<Tab>:cwin @@ -190,8 +215,10 @@ menutrans Cu&t &Исеци menutrans &Copy &Копирај menutrans &Paste &Убаци menutrans &Delete И&збриши -menutrans Select\ Blockwise Бирај\ &правоугаоно +menutrans Select\ Blockwise Бирај\ б&локовски menutrans Select\ &Word Изабери\ &реч +menutrans Select\ &Sentence Изабери\ р&еченицу +menutrans Select\ Pa&ragraph Изабери\ &параграф menutrans Select\ &Line Изабери\ р&ед menutrans Select\ &Block Изабери\ &блок menutrans Select\ &All Изабери\ &све @@ -237,9 +264,9 @@ endif " Syntax menu menutrans &Syntax &Синтакса -menutrans &Show\ filetypes\ in\ menu Избор\ 'filetype'\ из\ &менија -menutrans Set\ '&syntax'\ only Поде&си\ 'syntax'\ само -menutrans Set\ '&filetype'\ too Подеси\ 'filetype'\ &такође +menutrans &Show\ File\ Types\ in\ Menu Прикажи\ типове\ датотека\ у\ &менију +menutrans Set\ '&syntax'\ only Поде&си\ само\ 'syntax' +menutrans Set\ '&filetype'\ too Подеси\ &такође\ и\ 'filetype' menutrans &Off &Искључено menutrans &Manual &Ручно menutrans A&utomatic &Аутоматски @@ -257,7 +284,9 @@ let g:menutrans_tags_dialog = "Унесите имена датотека са let g:menutrans_textwidth_dialog = "Унесите нову ширину текста (0 спречава прелом)" -let g:menutrans_fileformat_dialog = "Изаберите врсту датотеке" +let g:menutrans_fileformat_dialog = "Изаберите формат записа датотеке" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Откажи" let menutrans_no_file = "[Нема датотеке]" diff --git a/runtime/lang/menu_zh_cn.gb2312.vim b/runtime/lang/menu_zh_cn.gb2312.vim index a12d94daf5..0df51885f0 100644 --- a/runtime/lang/menu_zh_cn.gb2312.vim +++ b/runtime/lang/menu_zh_cn.gb2312.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese <i18n-translation@lists.linux.net.cn> -" Translated By: Yuheng Xie <elephant@linux.net.cn> -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai <baishunde@gmail.com> +" Previous Maintainer: Yuheng Xie <elephant@linux.net.cn> +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -94,6 +95,7 @@ menutrans F&ile\ Settings " Boolean options menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! /ʾк(&N)<Tab>:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! /к(&V)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! /\ list\ ģʽ(&L)<Tab>:set\ list! menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! /(&W)<Tab>:set\ wrap! menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! /(&R)<Tab>:set\ lbr! diff --git a/runtime/lang/menu_zh_cn.utf-8.vim b/runtime/lang/menu_zh_cn.utf-8.vim index 956363d29c..cb1288f63e 100644 --- a/runtime/lang/menu_zh_cn.utf-8.vim +++ b/runtime/lang/menu_zh_cn.utf-8.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese <i18n-translation@lists.linux.net.cn> -" Translated By: Yuheng Xie <elephant@linux.net.cn> -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai <baishunde@gmail.com> +" Previous Maintainer: Yuheng Xie <elephant@linux.net.cn> +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -91,6 +92,7 @@ menutrans F&ile\ Settings 文件设定(&I) " Boolean options menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu! 开/关显示行号(&N)<Tab>:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! 开/关相对行号(&V)<Tab>:set\ rnu! menutrans Toggle\ &List\ Mode<Tab>:set\ list! 开/关\ list\ 模式(&L)<Tab>:set\ list! menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap! 开/关折行(&W)<Tab>:set\ wrap! menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr! 开/关整词折行(&R)<Tab>:set\ lbr! diff --git a/runtime/macros/README.txt b/runtime/macros/README.txt index ce61cd361a..22f9a97442 100644 --- a/runtime/macros/README.txt +++ b/runtime/macros/README.txt @@ -8,23 +8,26 @@ maze Macros that solve a maze (amazing!). urm Macros that simulate a simple computer: "Universal Register Machine" + The other files contain some handy utilities. They also serve as examples for how to use Vi and Vim functionality. -dvorak for when you use a Dvorak keyboard +less.sh + less.vim make Vim work like less (or more) -justify.vim user function for justifying text -matchit.vim + matchit.txt make % match if-fi, HTML tags, and much more -less.sh + less.vim make Vim work like less (or more) +The following have been moved to an optional package. Add the command to your +vimrc file to use the package: + +packadd! dvorak " Dvorak keyboard support; adds mappings + +packadd! editexisting " when editing a file that is already edited with + " another Vim instance, go to that Vim instance -shellmenu.vim menus for editing shell scripts in the GUI version +packadd! justify " justifying text. -swapmous.vim swap left and right mouse buttons +packadd! matchit " makes the % command work better -editexisting.vim when editing a file that is already edited with - another Vim instance +packadd! shellmenu " menus for editing shell scripts in the GUI version -This one is only for Unix. It can be found in the extra archive: -file_select.vim macros that make a handy file selector +packadd! swapmouse " swap left and right mouse buttons diff --git a/runtime/macros/dvorak b/runtime/macros/dvorak deleted file mode 100644 index 0c75888703..0000000000 --- a/runtime/macros/dvorak +++ /dev/null @@ -1,164 +0,0 @@ -When using a dvorak keyboard this file may be of help to you. -These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>. -What they do is that the most often used keys, like hjkl, are put in a more -easy to use position. -It may take some time to learn using this. - -Put these lines in your .vimrc: --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -" Key to go into dvorak mode: -map ,d :source ~/.dvorak -" Key to get out of dvorak mode: -map ,q :source ~/.qwerty --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -write these lines into the file ~/.dvorak: --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -" Dvorak keyboard, only in insert mode and ex mode. -" You may want to add a list of map's too. -imap! a a -imap! b x -imap! c j -imap! d e -imap! e . -imap! f u -imap! g i -imap! h d -imap! i c -imap! j h -imap! k t -imap! l n -imap! m m -imap! n b -imap! o r -imap! p l -imap! q ' -imap! r p -imap! s o -imap! t y -imap! u g -imap! v k -imap! w , -imap! x q -imap! y f -imap! z ; -imap! ; s -imap! ' - -imap! " _ -imap! , w -imap! . v -imap! / z -imap! A A -imap! B X -imap! C J -imap! D E -imap! E > -imap! F U -imap! G I -imap! H D -imap! I C -imap! J H -imap! K T -imap! L N -imap! M M -imap! N B -imap! O R -imap! P L -imap! Q " -imap! R P -imap! S O -imap! T Y -imap! U G -imap! V K -imap! W < -imap! X Q -imap! Y F -imap! Z : -imap! < W -imap! > V -imap! ? Z -imap! : S -imap! [ / -imap! ] = -imap! { ? -imap! } + -imap! - [ -imap! _ { -imap! = ] -imap! + } --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -write these lines into the file ~/.qwerty --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -" Qwerty keyboard -unmap! a -unmap! b -unmap! c -unmap! d -unmap! e -unmap! f -unmap! g -unmap! h -unmap! i -unmap! j -unmap! k -unmap! l -unmap! m -unmap! n -unmap! o -unmap! p -unmap! q -unmap! r -unmap! s -unmap! t -unmap! u -unmap! v -unmap! w -unmap! x -unmap! y -unmap! z -unmap! ; -unmap! ' -unmap! \" -unmap! , -unmap! . -unmap! / -unmap! A -unmap! B -unmap! C -unmap! D -unmap! E -unmap! F -unmap! G -unmap! H -unmap! I -unmap! J -unmap! K -unmap! L -unmap! M -unmap! N -unmap! O -unmap! P -unmap! Q -unmap! R -unmap! S -unmap! T -unmap! U -unmap! V -unmap! W -unmap! X -unmap! Y -unmap! Z -unmap! < -unmap! > -unmap! ? -unmap! : -unmap! [ -unmap! ] -unmap! { -unmap! } -unmap! - -unmap! _ -unmap! = -unmap! + --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim index c18f22569f..6e8f74f22f 100644 --- a/runtime/macros/editexisting.vim +++ b/runtime/macros/editexisting.vim @@ -1,119 +1,3 @@ -" Vim Plugin: Edit the file with an existing Vim if possible -" Maintainer: Bram Moolenaar -" Last Change: 2013 Feb 24 - -" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32) -" $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you -" automatically use the latest version. - -" This plugin serves two purposes: -" 1. On startup, if we were invoked with one file name argument and the file -" is not modified then try to find another Vim instance that is editing -" this file. If there is one then bring it to the foreground and exit. -" 2. When a file is edited and a swap file exists for it, try finding that -" other Vim and bring it to the foreground. Requires Vim 7, because it -" uses the SwapExists autocommand event. -if v:version < 700 - finish -endif - -" Function that finds the Vim instance that is editing "filename" and brings -" it to the foreground. -func s:EditElsewhere(filename) - let fname_esc = substitute(a:filename, "'", "''", "g") - - let servers = serverlist() - while servers != '' - " Get next server name in "servername"; remove it from "servers". - let i = match(servers, "\n") - if i == -1 - let servername = servers - let servers = '' - else - let servername = strpart(servers, 0, i) - let servers = strpart(servers, i + 1) - endif - - " Skip ourselves. - if servername ==? v:servername - continue - endif - - " Check if this server is editing our file. - if remote_expr(servername, "bufloaded('" . fname_esc . "')") - " Yes, bring it to the foreground. - if has("win32") - call remote_foreground(servername) - endif - call remote_expr(servername, "foreground()") - - if remote_expr(servername, "exists('*EditExisting')") - " Make sure the file is visible in a window (not hidden). - " If v:swapcommand exists and is set, send it to the server. - if exists("v:swapcommand") - let c = substitute(v:swapcommand, "'", "''", "g") - call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')") - else - call remote_expr(servername, "EditExisting('" . fname_esc . "', '')") - endif - endif - - if !(has('vim_starting') && has('gui_running') && has('gui_win32')) - " Tell the user what is happening. Not when the GUI is starting - " though, it would result in a message box. - echomsg "File is being edited by " . servername - sleep 2 - endif - return 'q' - endif - endwhile - return '' -endfunc - -" When the plugin is loaded and there is one file name argument: Find another -" Vim server that is editing this file right now. -if argc() == 1 && !&modified - if s:EditElsewhere(expand("%:p")) == 'q' - quit - endif -endif - -" Setup for handling the situation that an existing swap file is found. -try - au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p")) -catch - " Without SwapExists we don't do anything for ":edit" commands -endtry - -" Function used on the server to make the file visible and possibly execute a -" command. -func! EditExisting(fname, command) - " Get the window number of the file in the current tab page. - let winnr = bufwinnr(a:fname) - if winnr <= 0 - " Not found, look in other tab pages. - let bufnr = bufnr(a:fname) - for i in range(tabpagenr('$')) - if index(tabpagebuflist(i + 1), bufnr) >= 0 - " Make this tab page the current one and find the window number. - exe 'tabnext ' . (i + 1) - let winnr = bufwinnr(a:fname) - break - endif - endfor - endif - - if winnr > 0 - exe winnr . "wincmd w" - elseif exists('*fnameescape') - exe "split " . fnameescape(a:fname) - else - exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") - endif - - if a:command != '' - exe "normal " . a:command - endif - - redraw -endfunc +" Load the editexisting package. +" For those users who were loading the editexisting plugin from here. +packadd editexisting diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim index 4ef3bf95fa..011a911401 100644 --- a/runtime/macros/justify.vim +++ b/runtime/macros/justify.vim @@ -1,316 +1,3 @@ -" Function to left and right align text. -" -" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk> -" Created: 980806 14:13 (or around that time anyway) -" Revised: 001103 00:36 (See "Revisions" below) - - -" function Justify( [ textwidth [, maxspaces [, indent] ] ] ) -" -" Justify() will left and right align a line by filling in an -" appropriate amount of spaces. Extra spaces are added to existing -" spaces starting from the right side of the line. As an example, the -" following documentation has been justified. -" -" The function takes the following arguments: - -" textwidth argument -" ------------------ -" If not specified, the value of the 'textwidth' option is used. If -" 'textwidth' is zero a value of 80 is used. -" -" Additionally the arguments 'tw' and '' are accepted. The value of -" 'textwidth' will be used. These are handy, if you just want to specify -" the maxspaces argument. - -" maxspaces argument -" ------------------ -" If specified, alignment will only be done, if the longest space run -" after alignment is no longer than maxspaces. -" -" An argument of '' is accepted, should the user like to specify all -" arguments. -" -" To aid user defined commands, negative values are accepted aswell. -" Using a negative value specifies the default behaviour: any length of -" space runs will be used to justify the text. - -" indent argument -" --------------- -" This argument specifies how a line should be indented. The default is -" to keep the current indentation. -" -" Negative values: Keep current amount of leading whitespace. -" Positive values: Indent all lines with leading whitespace using this -" amount of whitespace. -" -" Note that the value 0, needs to be quoted as a string. This value -" leads to a left flushed text. -" -" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be -" added. In this case, if the value of indent is positive, the amount of -" whitespace to be added will be multiplied by the value of the -" 'shiftwidth' and 'tabstop' settings. If these units are used, the -" argument must be given as a string, eg. Justify('','','2sw'). -" -" If the values of 'sw' or 'tw' are negative, they are treated as if -" they were 0, which means that the text is flushed left. There is no -" check if a negative number prefix is used to change the sign of a -" negative 'sw' or 'ts' value. -" -" As with the other arguments, '' may be used to get the default -" behaviour. - - -" Notes: -" -" If the line, adjusted for space runs and leading/trailing whitespace, -" is wider than the used textwidth, the line will be left untouched (no -" whitespace removed). This should be equivalent to the behaviour of -" :left, :right and :center. -" -" If the resulting line is shorter than the used textwidth it is left -" untouched. -" -" All space runs in the line are truncated before the alignment is -" carried out. -" -" If you have set 'noexpandtab', :retab! is used to replace space runs -" with whitespace using the value of 'tabstop'. This should be -" conformant with :left, :right and :center. -" -" If joinspaces is set, an extra space is added after '.', '?' and '!'. -" If 'cpooptions' include 'j', extra space is only added after '.'. -" (This may on occasion conflict with maxspaces.) - - -" Related mappings: -" -" Mappings that will align text using the current text width, using at -" most four spaces in a space run and keeping current indentation. -nmap _j :%call Justify('tw',4)<CR> -vmap _j :call Justify('tw',4)<CR> -" -" Mappings that will remove space runs and format lines (might be useful -" prior to aligning the text). -nmap ,gq :%s/\s\+/ /g<CR>gq1G -vmap ,gq :s/\s\+/ /g<CR>gvgq - - -" User defined command: -" -" The following is an ex command that works as a shortcut to the Justify -" function. Arguments to Justify() can be added after the command. -com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>) -" -" The following commands are all equivalent: -" -" 1. Simplest use of Justify(): -" :call Justify() -" :Justify -" -" 2. The _j mapping above via the ex command: -" :%Justify tw 4 -" -" 3. Justify visualised text at 72nd column while indenting all -" previously indented text two shiftwidths -" :'<,'>call Justify(72,'','2sw') -" :'<,'>Justify 72 -1 2sw -" -" This documentation has been justified using the following command: -":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" / - -" Revisions: -" 001103: If 'joinspaces' was set, calculations could be wrong. -" Tabs at start of line could also lead to errors. -" Use setline() instead of "exec 's/foo/bar/' - safer. -" Cleaned up the code a bit. -" -" Todo: Convert maps to the new script specific form - -" Error function -function! Justify_error(message) - echohl Error - echo "Justify([tw, [maxspaces [, indent]]]): " . a:message - echohl None -endfunction - - -" Now for the real thing -function! Justify(...) range - - if a:0 > 3 - call Justify_error("Too many arguments (max 3)") - return 1 - endif - - " Set textwidth (accept 'tw' and '' as arguments) - if a:0 >= 1 - if a:1 =~ '^\(tw\)\=$' - let tw = &tw - elseif a:1 =~ '^\d\+$' - let tw = a:1 - else - call Justify_error("tw must be a number (>0), '' or 'tw'") - return 2 - endif - else - let tw = &tw - endif - if tw == 0 - let tw = 80 - endif - - " Set maximum number of spaces between WORDs - if a:0 >= 2 - if a:2 == '' - let maxspaces = tw - elseif a:2 =~ '^-\d\+$' - let maxspaces = tw - elseif a:2 =~ '^\d\+$' - let maxspaces = a:2 - else - call Justify_error("maxspaces must be a number or ''") - return 3 - endif - else - let maxspaces = tw - endif - if maxspaces <= 1 - call Justify_error("maxspaces should be larger than 1") - return 4 - endif - - " Set the indentation style (accept sw and ts units) - let indent_fix = '' - if a:0 >= 3 - if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = -1 - elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = 0 - elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = substitute(a:3, '\D', '', 'g') - elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$' - let indent = 1 - else - call Justify_error("indent: a number with 'sw'/'ts' unit") - return 5 - endif - if indent >= 0 - while indent > 0 - let indent_fix = indent_fix . ' ' - let indent = indent - 1 - endwhile - let indent_sw = 0 - if a:3 =~ '\(shiftwidth\|sw\)' - let indent_sw = &sw - elseif a:3 =~ '\(tabstop\|ts\)' - let indent_sw = &ts - endif - let indent_fix2 = '' - while indent_sw > 0 - let indent_fix2 = indent_fix2 . indent_fix - let indent_sw = indent_sw - 1 - endwhile - let indent_fix = indent_fix2 - endif - else - let indent = -1 - endif - - " Avoid substitution reports - let save_report = &report - set report=1000000 - - " Check 'joinspaces' and 'cpo' - if &js == 1 - if &cpo =~ 'j' - let join_str = '\(\. \)' - else - let join_str = '\([.!?!] \)' - endif - endif - - let cur = a:firstline - while cur <= a:lastline - - let str_orig = getline(cur) - let save_et = &et - set et - exec cur . "retab" - let &et = save_et - let str = getline(cur) - - let indent_str = indent_fix - let indent_n = strlen(indent_str) - " Shall we remember the current indentation - if indent < 0 - let indent_orig = matchstr(str_orig, '^\s*') - if strlen(indent_orig) > 0 - let indent_str = indent_orig - let indent_n = strlen(matchstr(str, '^\s*')) - endif - endif - - " Trim trailing, leading and running whitespace - let str = substitute(str, '\s\+$', '', '') - let str = substitute(str, '^\s\+', '', '') - let str = substitute(str, '\s\+', ' ', 'g') - let str_n = strdisplaywidth(str) - - " Possible addition of space after punctuation - if exists("join_str") - let str = substitute(str, join_str, '\1 ', 'g') - endif - let join_n = strdisplaywidth(str) - str_n - - " Can extraspaces be added? - " Note that str_n may be less than strlen(str) [joinspaces above] - if strdisplaywidth(str) <= tw - indent_n && str_n > 0 - " How many spaces should be added - let s_add = tw - str_n - indent_n - join_n - let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n - let s_dup = s_add / s_nr - let s_mod = s_add % s_nr - - " Test if the changed line fits with tw - if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw - - " Duplicate spaces - while s_dup > 0 - let str = substitute(str, '\( \+\)', ' \1', 'g') - let s_dup = s_dup - 1 - endwhile - - " Add extra spaces from the end - while s_mod > 0 - let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '') - let s_mod = s_mod - 1 - endwhile - - " Indent the line - if indent_n > 0 - let str = substitute(str, '^', indent_str, '' ) - endif - - " Replace the line - call setline(cur, str) - - " Convert to whitespace - if &et == 0 - exec cur . 'retab!' - endif - - endif " Change of line - endif " Possible change - - let cur = cur + 1 - endwhile - - norm ^ - - let &report = save_report - -endfunction - -" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai +" Load the justify package. +" For those users who were loading the justify plugin from here. +packadd justify diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim index 9042e849ca..53857c6c08 100644 --- a/runtime/macros/less.vim +++ b/runtime/macros/less.vim @@ -1,6 +1,6 @@ " Vim script to work like "less" " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 May 13 +" Last Change: 2017 Mar 31 " Avoid loading this file twice, allow the user to define his own script. if exists("loaded_less") @@ -48,6 +48,12 @@ set nows let s:lz = &lz set lz +" Allow the user to define a function, which can set options specifically for +" this script. +if exists('*LessInitFunc') + call LessInitFunc() +endif + " Used after each command: put cursor at end and display position if &wrap noremap <SID>L L0:redraw<CR>:file<CR> @@ -75,6 +81,10 @@ fun! s:Help() echo "\n" echo "/pattern Search for pattern ?pattern Search backward for pattern" echo "n next pattern match N Previous pattern match" + if &foldmethod != "manual" + echo "\n" + echo "zR open all folds zm increase fold level" + endif echo "\n" echo ":n<Enter> Next file :p<Enter> Previous file" echo "\n" @@ -90,7 +100,11 @@ map <C-F> <Space> map <PageDown> <Space> map <kPageDown> <Space> map <S-Down> <Space> -map z <Space> +" If 'foldmethod' was changed keep the "z" commands, e.g. "zR" to open all +" folds. +if &foldmethod == "manual" + map z <Space> +endif map <Esc><Space> <Space> fun! s:NextPage() if line(".") == line("$") diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim index 74c1a1eb92..f6f463f40c 100644 --- a/runtime/macros/matchit.vim +++ b/runtime/macros/matchit.vim @@ -1,813 +1,5 @@ -" matchit.vim: (global plugin) Extended "%" matching -" Last Change: Fri Jan 25 10:00 AM 2008 EST -" Maintainer: Benji Fisher PhD <benji@member.AMS.org> -" Version: 1.13.2, for Vim 6.3+ -" URL: http://www.vim.org/script.php?script_id=39 - -" Documentation: -" The documentation is in a separate file, matchit.txt . - -" Credits: -" Vim editor by Bram Moolenaar (Thanks, Bram!) -" Original script and design by Raul Segura Acevedo -" Support for comments by Douglas Potts -" Support for back references and other improvements by Benji Fisher -" Support for many languages by Johannes Zellner -" Suggestions for improvement, bug reports, and support for additional -" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark -" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. - -" Debugging: -" If you'd like to try the built-in debugging commands... -" :MatchDebug to activate debugging for the current buffer -" This saves the values of several key script variables as buffer-local -" variables. See the MatchDebug() function, below, for details. - -" TODO: I should think about multi-line patterns for b:match_words. -" This would require an option: how many lines to scan (default 1). -" This would be useful for Python, maybe also for *ML. -" TODO: Maybe I should add a menu so that people will actually use some of -" the features that I have implemented. -" TODO: Eliminate the MultiMatch function. Add yet another argument to -" Match_wrapper() instead. -" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' -" TODO: Make backrefs safer by using '\V' (very no-magic). -" TODO: Add a level of indirection, so that custom % scripts can use my -" work but extend it. - -" allow user to prevent loading -" and prevent duplicate loading -if exists("loaded_matchit") || &cp - finish +" Load the matchit package. +" For those users who were loading the matchit plugin from here. +if 1 + packadd matchit endif -let loaded_matchit = 1 -let s:last_mps = "" -let s:last_words = ":" - -let s:save_cpo = &cpo -set cpo&vim - -nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR> -nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR> -vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv`` -vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv`` -onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR> -onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR> - -" Analogues of [{ and ]} using matching patterns: -nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR> -nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR> -vmap [% <Esc>[%m'gv`` -vmap ]% <Esc>]%m'gv`` -" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv`` -" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv`` -onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR> -onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR> - -" text object: -vmap a% <Esc>[%v]% - -" Auto-complete mappings: (not yet "ready for prime time") -" TODO Read :help write-plugin for the "right" way to let the user -" specify a key binding. -" let g:match_auto = '<C-]>' -" let g:match_autoCR = '<C-CR>' -" if exists("g:match_auto") -" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls' -" endif -" if exists("g:match_autoCR") -" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>' -" endif -" if exists("g:match_gthhoh") -" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' -" endif " gthhoh = "Get the heck out of here!" - -let s:notslash = '\\\@<!\%(\\\\\)*' - -function! s:Match_wrapper(word, forward, mode) range - " In s:CleanUp(), :execute "set" restore_options . - let restore_options = (&ic ? " " : " no") . "ignorecase" - if exists("b:match_ignorecase") - let &ignorecase = b:match_ignorecase - endif - let restore_options = " ve=" . &ve . restore_options - set ve= - " If this function was called from Visual mode, make sure that the cursor - " is at the correct end of the Visual range: - if a:mode == "v" - execute "normal! gv\<Esc>" - endif - " In s:CleanUp(), we may need to check whether the cursor moved forward. - let startline = line(".") - let startcol = col(".") - " Use default behavior if called with a count. - if v:count - exe "normal! " . v:count . "%" - return s:CleanUp(restore_options, a:mode, startline, startcol) - end - - " First step: if not already done, set the script variables - " s:do_BR flag for whether there are backrefs - " s:pat parsed version of b:match_words - " s:all regexp based on s:pat and the default groups - " - if !exists("b:match_words") || b:match_words == "" - let match_words = "" - " Allow b:match_words = "GetVimMatchWords()" . - elseif b:match_words =~ ":" - let match_words = b:match_words - else - execute "let match_words =" b:match_words - endif -" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! - if (match_words != s:last_words) || (&mps != s:last_mps) || - \ exists("b:match_debug") - let s:last_words = match_words - let s:last_mps = &mps - " The next several lines were here before - " BF started messing with this script. - " quote the special chars in 'matchpairs', replace [,:] with \| and then - " append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif) - " let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+', - " \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>' - let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' - " s:all = pattern with all the keywords - let match_words = match_words . (strlen(match_words) ? "," : "") . default - if match_words !~ s:notslash . '\\\d' - let s:do_BR = 0 - let s:pat = match_words - else - let s:do_BR = 1 - let s:pat = s:ParseWords(match_words) - endif - let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g') - let s:all = '\%(' . s:all . '\)' - " let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)' - if exists("b:match_debug") - let b:match_pat = s:pat - endif - endif - - " Second step: set the following local variables: - " matchline = line on which the cursor started - " curcol = number of characters before match - " prefix = regexp for start of line to start of match - " suffix = regexp for end of match to end of line - " Require match to end on or after the cursor and prefer it to - " start on or before the cursor. - let matchline = getline(startline) - if a:word != '' - " word given - if a:word !~ s:all - echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE - return s:CleanUp(restore_options, a:mode, startline, startcol) - endif - let matchline = a:word - let curcol = 0 - let prefix = '^\%(' - let suffix = '\)$' - " Now the case when "word" is not given - else " Find the match that ends on or after the cursor and set curcol. - let regexp = s:Wholematch(matchline, s:all, startcol-1) - let curcol = match(matchline, regexp) - " If there is no match, give up. - if curcol == -1 - return s:CleanUp(restore_options, a:mode, startline, startcol) - endif - let endcol = matchend(matchline, regexp) - let suf = strlen(matchline) - endcol - let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(') - let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$') - endif - if exists("b:match_debug") - let b:match_match = matchstr(matchline, regexp) - let b:match_col = curcol+1 - endif - - " Third step: Find the group and single word that match, and the original - " (backref) versions of these. Then, resolve the backrefs. - " Set the following local variable: - " group = colon-separated list of patterns, one of which matches - " = ini:mid:fin or ini:fin - " - " Reconstruct the version with unresolved backrefs. - let patBR = substitute(match_words.',', - \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') - let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g') - " Now, set group and groupBR to the matching group: 'if:endif' or - " 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns - " group . "," . groupBR, and we pick it apart. - let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) - let i = matchend(group, s:notslash . ",") - let groupBR = strpart(group, i) - let group = strpart(group, 0, i-1) - " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix - if s:do_BR " Do the hard part: resolve those backrefs! - let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) - endif - if exists("b:match_debug") - let b:match_wholeBR = groupBR - let i = matchend(groupBR, s:notslash . ":") - let b:match_iniBR = strpart(groupBR, 0, i-1) - endif - - " Fourth step: Set the arguments for searchpair(). - let i = matchend(group, s:notslash . ":") - let j = matchend(group, '.*' . s:notslash . ":") - let ini = strpart(group, 0, i-1) - let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g') - let fin = strpart(group, j) - "Un-escape the remaining , and : characters. - let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - " searchpair() requires that these patterns avoid \(\) groups. - let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g') - let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g') - let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g') - " Set mid. This is optimized for readability, not micro-efficiency! - if a:forward && matchline =~ prefix . fin . suffix - \ || !a:forward && matchline =~ prefix . ini . suffix - let mid = "" - endif - " Set flag. This is optimized for readability, not micro-efficiency! - if a:forward && matchline =~ prefix . fin . suffix - \ || !a:forward && matchline !~ prefix . ini . suffix - let flag = "bW" - else - let flag = "W" - endif - " Set skip. - if exists("b:match_skip") - let skip = b:match_skip - elseif exists("b:match_comment") " backwards compatibility and testing! - let skip = "r:" . b:match_comment - else - let skip = 's:comment\|string' - endif - let skip = s:ParseSkip(skip) - if exists("b:match_debug") - let b:match_ini = ini - let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin - endif - - " Fifth step: actually start moving the cursor and call searchpair(). - " Later, :execute restore_cursor to get to the original screen. - let restore_cursor = virtcol(".") . "|" - normal! g0 - let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor - normal! H - let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - execute restore_cursor - call cursor(0, curcol + 1) - " normal! 0 - " if curcol - " execute "normal!" . curcol . "l" - " endif - if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) - let skip = "0" - else - execute "if " . skip . "| let skip = '0' | endif" - endif - let sp_return = searchpair(ini, mid, fin, flag, skip) - let final_position = "call cursor(" . line(".") . "," . col(".") . ")" - " Restore cursor position and original screen. - execute restore_cursor - normal! m' - if sp_return > 0 - execute final_position - endif - return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin) -endfun - -" Restore options and do some special handling for Operator-pending mode. -" The optional argument is the tail of the matching group. -fun! s:CleanUp(options, mode, startline, startcol, ...) - execute "set" a:options - " Open folds, if appropriate. - if a:mode != "o" - if &foldopen =~ "percent" - normal! zv - endif - " In Operator-pending mode, we want to include the whole match - " (for example, d%). - " This is only a problem if we end up moving in the forward direction. - elseif (a:startline < line(".")) || - \ (a:startline == line(".") && a:startcol < col(".")) - if a:0 - " Check whether the match is a single character. If not, move to the - " end of the match. - let matchline = getline(".") - let currcol = col(".") - let regexp = s:Wholematch(matchline, a:1, currcol-1) - let endcol = matchend(matchline, regexp) - if endcol > currcol " This is NOT off by one! - execute "normal!" . (endcol - currcol) . "l" - endif - endif " a:0 - endif " a:mode != "o" && etc. - return 0 -endfun - -" Example (simplified HTML patterns): if -" a:groupBR = '<\(\k\+\)>:</\1>' -" a:prefix = '^.\{3}\(' -" a:group = '<\(\k\+\)>:</\(\k\+\)>' -" a:suffix = '\).\{2}$' -" a:matchline = "123<tag>12" or "123</tag>12" -" then extract "tag" from a:matchline and return "<tag>:</tag>" . -fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline) - if a:matchline !~ a:prefix . - \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix - return a:group - endif - let i = matchend(a:groupBR, s:notslash . ':') - let ini = strpart(a:groupBR, 0, i-1) - let tailBR = strpart(a:groupBR, i) - let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix, - \ a:groupBR) - let i = matchend(word, s:notslash . ":") - let wordBR = strpart(word, i) - let word = strpart(word, 0, i-1) - " Now, a:matchline =~ a:prefix . word . a:suffix - if wordBR != ini - let table = s:Resolve(ini, wordBR, "table") - else - " let table = "----------" - let table = "" - let d = 0 - while d < 10 - if tailBR =~ s:notslash . '\\' . d - " let table[d] = d - let table = table . d - else - let table = table . "-" - endif - let d = d + 1 - endwhile - endif - let d = 9 - while d - if table[d] != "-" - let backref = substitute(a:matchline, a:prefix.word.a:suffix, - \ '\'.table[d], "") - " Are there any other characters that should be escaped? - let backref = escape(backref, '*,:') - execute s:Ref(ini, d, "start", "len") - let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) - let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, - \ escape(backref, '\\&'), 'g') - endif - let d = d-1 - endwhile - if exists("b:match_debug") - if s:do_BR - let b:match_table = table - let b:match_word = word - else - let b:match_table = "" - let b:match_word = "" - endif - endif - return ini . ":" . tailBR -endfun - -" Input a comma-separated list of groups with backrefs, such as -" a:groups = '\(foo\):end\1,\(bar\):end\1' -" and return a comma-separated list of groups with backrefs replaced: -" return '\(foo\):end\(foo\),\(bar\):end\(bar\)' -fun! s:ParseWords(groups) - let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g') - let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g') - let parsed = "" - while groups =~ '[^,:]' - let i = matchend(groups, s:notslash . ':') - let j = matchend(groups, s:notslash . ',') - let ini = strpart(groups, 0, i-1) - let tail = strpart(groups, i, j-i-1) . ":" - let groups = strpart(groups, j) - let parsed = parsed . ini - let i = matchend(tail, s:notslash . ':') - while i != -1 - " In 'if:else:endif', ini='if' and word='else' and then word='endif'. - let word = strpart(tail, 0, i-1) - let tail = strpart(tail, i) - let i = matchend(tail, s:notslash . ':') - let parsed = parsed . ":" . s:Resolve(ini, word, "word") - endwhile " Now, tail has been used up. - let parsed = parsed . "," - endwhile " groups =~ '[^,:]' - let parsed = substitute(parsed, ',$', '', '') - return parsed -endfun - -" TODO I think this can be simplified and/or made more efficient. -" TODO What should I do if a:start is out of range? -" Return a regexp that matches all of a:string, such that -" matchstr(a:string, regexp) represents the match for a:pat that starts -" as close to a:start as possible, before being preferred to after, and -" ends after a:start . -" Usage: -" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1) -" let i = match(getline("."), regexp) -" let j = matchend(getline("."), regexp) -" let match = matchstr(getline("."), regexp) -fun! s:Wholematch(string, pat, start) - let group = '\%(' . a:pat . '\)' - let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^') - let len = strlen(a:string) - let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$') - if a:string !~ prefix . group . suffix - let prefix = '' - endif - return prefix . group . suffix -endfun - -" No extra arguments: s:Ref(string, d) will -" find the d'th occurrence of '\(' and return it, along with everything up -" to and including the matching '\)'. -" One argument: s:Ref(string, d, "start") returns the index of the start -" of the d'th '\(' and any other argument returns the length of the group. -" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be -" executed, having the effect of -" :let foo = s:Ref(string, d, "start") -" :let bar = s:Ref(string, d, "len") -fun! s:Ref(string, d, ...) - let len = strlen(a:string) - if a:d == 0 - let start = 0 - else - let cnt = a:d - let match = a:string - while cnt - let cnt = cnt - 1 - let index = matchend(match, s:notslash . '\\(') - if index == -1 - return "" - endif - let match = strpart(match, index) - endwhile - let start = len - strlen(match) - if a:0 == 1 && a:1 == "start" - return start - 2 - endif - let cnt = 1 - while cnt - let index = matchend(match, s:notslash . '\\(\|\\)') - 1 - if index == -2 - return "" - endif - " Increment if an open, decrement if a ')': - let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')' - " let cnt = stridx('0(', match[index]) + cnt - let match = strpart(match, index+1) - endwhile - let start = start - 2 - let len = len - start - strlen(match) - endif - if a:0 == 1 - return len - elseif a:0 == 2 - return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len - else - return strpart(a:string, start, len) - endif -endfun - -" Count the number of disjoint copies of pattern in string. -" If the pattern is a literal string and contains no '0' or '1' characters -" then s:Count(string, pattern, '0', '1') should be faster than -" s:Count(string, pattern). -fun! s:Count(string, pattern, ...) - let pat = escape(a:pattern, '\\') - if a:0 > 1 - let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g") - let foo = substitute(a:string, pat, a:2, "g") - let foo = substitute(foo, '[^' . a:2 . ']', "", "g") - return strlen(foo) - endif - let result = 0 - let foo = a:string - let index = matchend(foo, pat) - while index != -1 - let result = result + 1 - let foo = strpart(foo, index) - let index = matchend(foo, pat) - endwhile - return result -endfun - -" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where -" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first -" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this -" indicates that all other instances of '\1' in target are to be replaced -" by '\3'. The hard part is dealing with nesting... -" Note that ":" is an illegal character for source and target, -" unless it is preceded by "\". -fun! s:Resolve(source, target, output) - let word = a:target - let i = matchend(word, s:notslash . '\\\d') - 1 - let table = "----------" - while i != -2 " There are back references to be replaced. - let d = word[i] - let backref = s:Ref(a:source, d) - " The idea is to replace '\d' with backref. Before we do this, - " replace any \(\) groups in backref with :1, :2, ... if they - " correspond to the first, second, ... group already inserted - " into backref. Later, replace :1 with \1 and so on. The group - " number w+b within backref corresponds to the group number - " s within a:source. - " w = number of '\(' in word before the current one - let w = s:Count( - \ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1') - let b = 1 " number of the current '\(' in backref - let s = d " number of the current '\(' in a:source - while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1') - \ && s < 10 - if table[s] == "-" - if w + b < 10 - " let table[s] = w + b - let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1) - endif - let b = b + 1 - let s = s + 1 - else - execute s:Ref(backref, b, "start", "len") - let ref = strpart(backref, start, len) - let backref = strpart(backref, 0, start) . ":". table[s] - \ . strpart(backref, start+len) - let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1') - endif - endwhile - let word = strpart(word, 0, i-1) . backref . strpart(word, i+1) - let i = matchend(word, s:notslash . '\\\d') - 1 - endwhile - let word = substitute(word, s:notslash . '\zs:', '\\', 'g') - if a:output == "table" - return table - elseif a:output == "word" - return word - else - return table . word - endif -endfun - -" Assume a:comma = ",". Then the format for a:patterns and a:1 is -" a:patterns = "<pat1>,<pat2>,..." -" a:1 = "<alt1>,<alt2>,..." -" If <patn> is the first pattern that matches a:string then return <patn> -" if no optional arguments are given; return <patn>,<altn> if a:1 is given. -fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...) - let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma) - let i = matchend(tail, s:notslash . a:comma) - if a:0 - let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma) - let j = matchend(alttail, s:notslash . a:comma) - endif - let current = strpart(tail, 0, i-1) - if a:branch == "" - let currpat = current - else - let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') - endif - while a:string !~ a:prefix . currpat . a:suffix - let tail = strpart(tail, i) - let i = matchend(tail, s:notslash . a:comma) - if i == -1 - return -1 - endif - let current = strpart(tail, 0, i-1) - if a:branch == "" - let currpat = current - else - let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') - endif - if a:0 - let alttail = strpart(alttail, j) - let j = matchend(alttail, s:notslash . a:comma) - endif - endwhile - if a:0 - let current = current . a:comma . strpart(alttail, 0, j-1) - endif - return current -endfun - -" Call this function to turn on debugging information. Every time the main -" script is run, buffer variables will be saved. These can be used directly -" or viewed using the menu items below. -if !exists(":MatchDebug") - command! -nargs=0 MatchDebug call s:Match_debug() -endif - -fun! s:Match_debug() - let b:match_debug = 1 " Save debugging information. - " pat = all of b:match_words with backrefs parsed - amenu &Matchit.&pat :echo b:match_pat<CR> - " match = bit of text that is recognized as a match - amenu &Matchit.&match :echo b:match_match<CR> - " curcol = cursor column of the start of the matching text - amenu &Matchit.&curcol :echo b:match_col<CR> - " wholeBR = matching group, original version - amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR> - " iniBR = 'if' piece, original version - amenu &Matchit.ini&BR :echo b:match_iniBR<CR> - " ini = 'if' piece, with all backrefs resolved from match - amenu &Matchit.&ini :echo b:match_ini<CR> - " tail = 'else\|endif' piece, with all backrefs resolved from match - amenu &Matchit.&tail :echo b:match_tail<CR> - " fin = 'endif' piece, with all backrefs resolved from match - amenu &Matchit.&word :echo b:match_word<CR> - " '\'.d in ini refers to the same thing as '\'.table[d] in word. - amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR> -endfun - -" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW" -" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W". -" Return a "mark" for the original position, so that -" let m = MultiMatch("bW", "n") ... execute m -" will return to the original position. If there is a problem, do not -" move the cursor and return "", unless a count is given, in which case -" go up or down as many levels as possible and again return "". -" TODO This relies on the same patterns as % matching. It might be a good -" idea to give it its own matching patterns. -fun! s:MultiMatch(spflag, mode) - if !exists("b:match_words") || b:match_words == "" - return "" - end - let restore_options = (&ic ? "" : "no") . "ignorecase" - if exists("b:match_ignorecase") - let &ignorecase = b:match_ignorecase - endif - let startline = line(".") - let startcol = col(".") - - " First step: if not already done, set the script variables - " s:do_BR flag for whether there are backrefs - " s:pat parsed version of b:match_words - " s:all regexp based on s:pat and the default groups - " This part is copied and slightly modified from s:Match_wrapper(). - let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' - " Allow b:match_words = "GetVimMatchWords()" . - if b:match_words =~ ":" - let match_words = b:match_words - else - execute "let match_words =" b:match_words - endif - if (match_words != s:last_words) || (&mps != s:last_mps) || - \ exists("b:match_debug") - let s:last_words = match_words - let s:last_mps = &mps - if match_words !~ s:notslash . '\\\d' - let s:do_BR = 0 - let s:pat = match_words - else - let s:do_BR = 1 - let s:pat = s:ParseWords(match_words) - endif - let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default, - \ '[,:]\+','\\|','g') . '\)' - if exists("b:match_debug") - let b:match_pat = s:pat - endif - endif - - " Second step: figure out the patterns for searchpair() - " and save the screen, cursor position, and 'ignorecase'. - " - TODO: A lot of this is copied from s:Match_wrapper(). - " - maybe even more functionality should be split off - " - into separate functions! - let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default - let open = substitute(s:pat . cdefault, - \ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g') - let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '') - let close = substitute(s:pat . cdefault, - \ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g') - let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)' - if exists("b:match_skip") - let skip = b:match_skip - elseif exists("b:match_comment") " backwards compatibility and testing! - let skip = "r:" . b:match_comment - else - let skip = 's:comment\|string' - endif - let skip = s:ParseSkip(skip) - " let restore_cursor = line(".") . "G" . virtcol(".") . "|" - " normal! H - " let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - let restore_cursor = virtcol(".") . "|" - normal! g0 - let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor - normal! H - let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - execute restore_cursor - - " Third step: call searchpair(). - " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. - let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') - let openpat = substitute(openpat, ',', '\\|', 'g') - let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') - let closepat = substitute(closepat, ',', '\\|', 'g') - if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) - let skip = '0' - else - execute "if " . skip . "| let skip = '0' | endif" - endif - mark ' - let level = v:count1 - while level - if searchpair(openpat, '', closepat, a:spflag, skip) < 1 - call s:CleanUp(restore_options, a:mode, startline, startcol) - return "" - endif - let level = level - 1 - endwhile - - " Restore options and return a string to restore the original position. - call s:CleanUp(restore_options, a:mode, startline, startcol) - return restore_cursor -endfun - -" Search backwards for "if" or "while" or "<tag>" or ... -" and return "endif" or "endwhile" or "</tag>" or ... . -" For now, this uses b:match_words and the same script variables -" as s:Match_wrapper() . Later, it may get its own patterns, -" either from a buffer variable or passed as arguments. -" fun! s:Autocomplete() -" echo "autocomplete not yet implemented :-(" -" if !exists("b:match_words") || b:match_words == "" -" return "" -" end -" let startpos = s:MultiMatch("bW") -" -" if startpos == "" -" return "" -" endif -" " - TODO: figure out whether 'if' or '<tag>' matched, and construct -" " - the appropriate closing. -" let matchline = getline(".") -" let curcol = col(".") - 1 -" " - TODO: Change the s:all argument if there is a new set of match pats. -" let regexp = s:Wholematch(matchline, s:all, curcol) -" let suf = strlen(matchline) - matchend(matchline, regexp) -" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(') -" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$') -" " Reconstruct the version with unresolved backrefs. -" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g') -" let patBR = substitute(patBR, ':\{2,}', ':', "g") -" " Now, set group and groupBR to the matching group: 'if:endif' or -" " 'while:endwhile' or whatever. -" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) -" let i = matchend(group, s:notslash . ",") -" let groupBR = strpart(group, i) -" let group = strpart(group, 0, i-1) -" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix -" if s:do_BR -" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) -" endif -" " let g:group = group -" -" " - TODO: Construct the closing from group. -" let fake = "end" . expand("<cword>") -" execute startpos -" return fake -" endfun - -" Close all open structures. "Get the heck out of here!" -" fun! s:Gthhoh() -" let close = s:Autocomplete() -" while strlen(close) -" put=close -" let close = s:Autocomplete() -" endwhile -" endfun - -" Parse special strings as typical skip arguments for searchpair(): -" s:foo becomes (current syntax item) =~ foo -" S:foo becomes (current syntax item) !~ foo -" r:foo becomes (line before cursor) =~ foo -" R:foo becomes (line before cursor) !~ foo -fun! s:ParseSkip(str) - let skip = a:str - if skip[1] == ":" - if skip[0] == "s" - let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . - \ strpart(skip,2) . "'" - elseif skip[0] == "S" - let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" . - \ strpart(skip,2) . "'" - elseif skip[0] == "r" - let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'" - elseif skip[0] == "R" - let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'" - endif - endif - return skip -endfun - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim:sts=2:sw=2: diff --git a/runtime/macros/shellmenu.vim b/runtime/macros/shellmenu.vim index 6175d1d9a6..4eb72a556a 100644 --- a/runtime/macros/shellmenu.vim +++ b/runtime/macros/shellmenu.vim @@ -1,94 +1,3 @@ -" When you're writing shell scripts and you are in doubt which test to use, -" which shell environment variables are defined, what the syntax of the case -" statement is, and you need to invoke 'man sh'? -" -" Your problems are over now! -" -" Attached is a Vim script file for turning gvim into a shell script editor. -" It may also be used as an example how to use menus in Vim. -" -" Written by: Lennart Schultz <les@dmi.min.dk> - -imenu Stmts.for for in do doneki kk0elli -imenu Stmts.case case in ) ;; esacbki k0elli -imenu Stmts.if if then fiki kk0elli -imenu Stmts.if-else if then else fiki kki kk0elli -imenu Stmts.elif elif then ki kk0elli -imenu Stmts.while while do doneki kk0elli -imenu Stmts.break break -imenu Stmts.continue continue -imenu Stmts.function () { }ki k0i -imenu Stmts.return return -imenu Stmts.return-true return 0 -imenu Stmts.return-false return 1 -imenu Stmts.exit exit -imenu Stmts.shift shift -imenu Stmts.trap trap -imenu Test.existence [ -e ]hi -imenu Test.existence - file [ -f ]hi -imenu Test.existence - file (not empty) [ -s ]hi -imenu Test.existence - directory [ -d ]hi -imenu Test.existence - executable [ -x ]hi -imenu Test.existence - readable [ -r ]hi -imenu Test.existence - writable [ -w ]hi -imenu Test.String is empty [ x = "x$" ]hhi -imenu Test.String is not empty [ x != "x$" ]hhi -imenu Test.Strings is equal [ "" = "" ]hhhhhhhi -imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi -imenu Test.Values is greater than [ -gt ]hhhhhhi -imenu Test.Values is greater equal [ -ge ]hhhhhhi -imenu Test.Values is equal [ -eq ]hhhhhhi -imenu Test.Values is not equal [ -ne ]hhhhhhi -imenu Test.Values is less than [ -lt ]hhhhhhi -imenu Test.Values is less equal [ -le ]hhhhhhi -imenu ParmSub.Substitute word if parm not set ${:-}hhi -imenu ParmSub.Set parm to word if not set ${:=}hhi -imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi -imenu ParmSub.If parm not set print word and exit ${:?}hhi -imenu SpShVars.Number of positional parameters ${#} -imenu SpShVars.All positional parameters (quoted spaces) ${*} -imenu SpShVars.All positional parameters (unquoted spaces) ${@} -imenu SpShVars.Flags set ${-} -imenu SpShVars.Return code of last command ${?} -imenu SpShVars.Process number of this shell ${$} -imenu SpShVars.Process number of last background command ${!} -imenu Environ.HOME ${HOME} -imenu Environ.PATH ${PATH} -imenu Environ.CDPATH ${CDPATH} -imenu Environ.MAIL ${MAIL} -imenu Environ.MAILCHECK ${MAILCHECK} -imenu Environ.PS1 ${PS1} -imenu Environ.PS2 ${PS2} -imenu Environ.IFS ${IFS} -imenu Environ.SHACCT ${SHACCT} -imenu Environ.SHELL ${SHELL} -imenu Environ.LC_CTYPE ${LC_CTYPE} -imenu Environ.LC_MESSAGES ${LC_MESSAGES} -imenu Builtins.cd cd -imenu Builtins.echo echo -imenu Builtins.eval eval -imenu Builtins.exec exec -imenu Builtins.export export -imenu Builtins.getopts getopts -imenu Builtins.hash hash -imenu Builtins.newgrp newgrp -imenu Builtins.pwd pwd -imenu Builtins.read read -imenu Builtins.readonly readonly -imenu Builtins.return return -imenu Builtins.times times -imenu Builtins.type type -imenu Builtins.umask umask -imenu Builtins.wait wait -imenu Set.set set -imenu Set.unset unset -imenu Set.mark modified or modified variables set -a -imenu Set.exit when command returns non-zero exit code set -e -imenu Set.Disable file name generation set -f -imenu Set.remember function commands set -h -imenu Set.All keyword arguments are placed in the environment set -k -imenu Set.Read commands but do not execute them set -n -imenu Set.Exit after reading and executing one command set -t -imenu Set.Treat unset variables as an error when substituting set -u -imenu Set.Print shell input lines as they are read set -v -imenu Set.Print commands and their arguments as they are executed set -x +" Load the shellmenu package. +" For those users who were loading the shellmenu plugin from here. +packadd shellmenu diff --git a/runtime/macros/swapmous.vim b/runtime/macros/swapmous.vim index 8b85be050b..5884d83473 100644 --- a/runtime/macros/swapmous.vim +++ b/runtime/macros/swapmous.vim @@ -1,22 +1,3 @@ -" These macros swap the left and right mouse buttons (for left handed) -" Don't forget to do ":set mouse=a" or the mouse won't work at all -noremap <LeftMouse> <RightMouse> -noremap <2-LeftMouse> <2-RightMouse> -noremap <3-LeftMouse> <3-RightMouse> -noremap <4-LeftMouse> <4-RightMouse> -noremap <LeftDrag> <RightDrag> -noremap <LeftRelease> <RightRelease> -noremap <RightMouse> <LeftMouse> -noremap <2-RightMouse> <2-LeftMouse> -noremap <3-RightMouse> <3-LeftMouse> -noremap <4-RightMouse> <4-LeftMouse> -noremap <RightDrag> <LeftDrag> -noremap <RightRelease> <LeftRelease> -noremap g<LeftMouse> <C-RightMouse> -noremap g<RightMouse> <C-LeftMouse> -noremap! <LeftMouse> <RightMouse> -noremap! <LeftDrag> <RightDrag> -noremap! <LeftRelease> <RightRelease> -noremap! <RightMouse> <LeftMouse> -noremap! <RightDrag> <LeftDrag> -noremap! <RightRelease> <LeftRelease> +" Load the swapmouse package. +" For those users who were loading the swapmous plugin from here. +packadd swapmouse diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index b78fdfd601..3d76b4240e 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -1,6 +1,6 @@ " Script to define the syntax menu in synmenu.vim " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2013 Jul 28 +" Last Change: 2018 May 17 " This is used by "make menu" in the src directory. edit <sfile>:p:h/synmenu.vim @@ -69,11 +69,13 @@ SynMenu AB.Applix\ ELF:elf SynMenu AB.APT\ config:aptconf SynMenu AB.Arc\ Macro\ Language:aml SynMenu AB.Arch\ inventory:arch +SynMenu AB.Arduino:arduino SynMenu AB.ART:art SynMenu AB.Ascii\ Doc:asciidoc SynMenu AB.ASP\ with\ VBScript:aspvbs SynMenu AB.ASP\ with\ Perl:aspperl SynMenu AB.Assembly.680x0:asm68k +SynMenu AB.Assembly.AVR:avra SynMenu AB.Assembly.Flat:fasm SynMenu AB.Assembly.GNU:asm SynMenu AB.Assembly.GNU\ H-8300:asmh8300 @@ -89,6 +91,7 @@ SynMenu AB.ASN\.1:asn SynMenu AB.Asterisk\ config:asterisk SynMenu AB.Asterisk\ voicemail\ config:asteriskvm SynMenu AB.Atlas:atlas +SynMenu AB.Autodoc:autodoc SynMenu AB.AutoHotKey:autohotkey SynMenu AB.AutoIt:autoit SynMenu AB.Automake:automake @@ -103,6 +106,7 @@ SynMenu AB.Basic.IBasic:ibasic SynMenu AB.Basic.QBasic:basic SynMenu AB.Basic.Visual\ Basic:vb SynMenu AB.Bazaar\ commit\ file:bzr +SynMenu AB.Bazel:bzl SynMenu AB.BC\ calculator:bc SynMenu AB.BDF\ font:bdf SynMenu AB.BibTeX.Bibliography\ database:bib @@ -132,6 +136,7 @@ SynMenu C.Clever:cl SynMenu C.Clipper:clipper SynMenu C.Clojure:clojure SynMenu C.Cmake:cmake +SynMenu C.Cmod:cmod SynMenu C.Cmusrc:cmusrc SynMenu C.Cobol:cobol SynMenu C.Coco/R:coco @@ -158,6 +163,7 @@ SynMenu DE.D:d SynMenu DE.Datascript:datascript SynMenu DE.Debian.Debian\ ChangeLog:debchangelog SynMenu DE.Debian.Debian\ Control:debcontrol +SynMenu DE.Debian.Debian\ Copyright:debcopyright SynMenu DE.Debian.Debian\ Sources\.list:debsources SynMenu DE.Denyhosts:denyhosts SynMenu DE.Desktop:desktop @@ -166,17 +172,20 @@ SynMenu DE.Dictd\ config:dictdconf SynMenu DE.Diff:diff SynMenu DE.Digital\ Command\ Lang:dcl SynMenu DE.Dircolors:dircolors +SynMenu DE.Dirpager:dirpager SynMenu DE.Django\ template:django SynMenu DE.DNS/BIND\ zone:bindzone SynMenu DE.Dnsmasq\ config:dnsmasq SynMenu DE.DocBook.auto-detect:docbk SynMenu DE.DocBook.SGML:docbksgml SynMenu DE.DocBook.XML:docbkxml +SynMenu DE.Dockerfile:dockerfile SynMenu DE.Dot:dot SynMenu DE.Doxygen.C\ with\ doxygen:c.doxygen SynMenu DE.Doxygen.C++\ with\ doxygen:cpp.doxygen SynMenu DE.Doxygen.IDL\ with\ doxygen:idl.doxygen SynMenu DE.Doxygen.Java\ with\ doxygen:java.doxygen +SynMenu DE.Doxygen.DataScript\ with\ doxygen:datascript.doxygen SynMenu DE.Dracula:dracula SynMenu DE.DSSSL:dsl SynMenu DE.DTD:dtd @@ -198,6 +207,8 @@ SynMenu DE.ESQL-C:esqlc SynMenu DE.Essbase\ script:csc SynMenu DE.Esterel:esterel SynMenu DE.Eterm\ config:eterm +SynMenu DE.Euphoria\ 3:euphoria3 +SynMenu DE.Euphoria\ 4:euphoria4 SynMenu DE.Eviews:eviews SynMenu DE.Exim\ conf:exim SynMenu DE.Expect:expect @@ -230,6 +241,8 @@ SynMenu FG.Git.Send\ Email:gitsendemail SynMenu FG.Gitolite:gitolite SynMenu FG.Gkrellmrc:gkrellmrc SynMenu FG.Gnash:gnash +SynMenu FG.Go:go +SynMenu FG.Godoc:godoc SynMenu FG.GP:gp SynMenu FG.GPG:gpg SynMenu FG.Grof:gprof @@ -276,12 +289,14 @@ SynMenu HIJK.Inittab:inittab SynMenu HIJK.Inno\ setup:iss SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ dat:upstreamdat SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ log:upstreamlog +SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ rpt:upstreamrpt SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log:upstreaminstalllog SynMenu HIJK.Innovation\ Data\ Processing.Usserver\ log:usserverlog SynMenu HIJK.Innovation\ Data\ Processing.USW2KAgt\ log:usw2kagtlog SynMenu HIJK.InstallShield\ script:ishd SynMenu HIJK.Interactive\ Data\ Lang:idlang SynMenu HIJK.IPfilter:ipfilter +SynMenu HIJK.J:j SynMenu HIJK.JAL:jal SynMenu HIJK.JAM:jam SynMenu HIJK.Jargon:jargon @@ -293,9 +308,11 @@ SynMenu HIJK.JavaScript:javascript SynMenu HIJK.Jess:jess SynMenu HIJK.Jgraph:jgraph SynMenu HIJK.Jovial:jovial +SynMenu HIJK.JSON:json SynMenu HIJK.Kconfig:kconfig SynMenu HIJK.KDE\ script:kscript SynMenu HIJK.Kimwitu++:kwt +SynMenu HIJK.Kivy:kivy SynMenu HIJK.KixTart:kix SynMenu L.Lace:lace @@ -304,6 +321,7 @@ SynMenu L.Latte:latte SynMenu L.Ld\ script:ld SynMenu L.LDAP.LDIF:ldif SynMenu L.LDAP.Configuration:ldapconf +SynMenu L.Less:less SynMenu L.Lex:lex SynMenu L.LFTP\ config:lftp SynMenu L.Libao:libao @@ -339,6 +357,7 @@ SynMenu M.Man\ page:man SynMenu M.Man\.conf:manconf SynMenu M.Maple\ V:maple SynMenu M.Markdown:markdown +SynMenu M.Markdown\ with\ R\ statements:rmd SynMenu M.Mason:mason SynMenu M.Mathematica:mma SynMenu M.Matlab:matlab @@ -348,6 +367,7 @@ SynMenu M.Messages\ (/var/log):messages SynMenu M.Metafont:mf SynMenu M.MetaPost:mp SynMenu M.MGL:mgl +SynMenu M.MIX:mix SynMenu M.MMIX:mmix SynMenu M.Modconf:modconf SynMenu M.Model:model @@ -355,6 +375,7 @@ SynMenu M.Modsim\ III:modsim3 SynMenu M.Modula\ 2:modula2 SynMenu M.Modula\ 3:modula3 SynMenu M.Monk:monk +SynMenu M.Motorola\ S-Record:srec SynMenu M.Mplayer\ config:mplayerconf SynMenu M.MOO:moo SynMenu M.Mrxvtrc:mrxvtrc @@ -367,12 +388,15 @@ SynMenu M.MS-DOS/Windows.Registry:registry SynMenu M.MS-DOS/Windows.Resource\ file:rc SynMenu M.Msql:msql SynMenu M.MuPAD:mupad +SynMenu M.Murphi:murphi SynMenu M.MUSHcode:mush SynMenu M.Muttrc:muttrc +SynMenu NO.N1QL:n1ql SynMenu NO.Nanorc:nanorc SynMenu NO.Nastran\ input/DMAP:nastran SynMenu NO.Natural:natural +SynMenu NO.NeoMutt\ setup\ files:neomuttrc SynMenu NO.Netrc:netrc SynMenu NO.Ninja:ninja SynMenu NO.Novell\ NCF\ batch:ncf @@ -460,14 +484,18 @@ SynMenu R.RockLinux\ package\ desc\.:desc SynMenu R.Rpcgen:rpcgen SynMenu R.RPL/2:rpl SynMenu R.ReStructuredText:rst +SynMenu M.ReStructuredText\ with\ R\ statements:rrst SynMenu R.RTF:rtf SynMenu R.Ruby:ruby +SynMenu R.Rust:rust SynMenu S-Sm.S-Lang:slang SynMenu S-Sm.Samba\ config:samba SynMenu S-Sm.SAS:sas SynMenu S-Sm.Sass:sass SynMenu S-Sm.Sather:sather +SynMenu S-Sm.Sbt:sbt +SynMenu S-Sm.Scala:scala SynMenu S-Sm.Scheme:scheme SynMenu S-Sm.Scilab:scilab SynMenu S-Sm.Screen\ RC:screen @@ -545,6 +573,8 @@ SynMenu Sn-Sy.Sudoers:sudoers SynMenu Sn-Sy.SVG:svg SynMenu Sn-Sy.Symbian\ meta-makefile:mmp SynMenu Sn-Sy.Sysctl\.conf:sysctl +SynMenu Sn-Sy.Systemd:systemd +SynMenu Sn-Sy.SystemVerilog:systemverilog SynMenu T.TADS:tads SynMenu T.Tags:tags @@ -559,6 +589,7 @@ SynMenu T.TealInfo:tli SynMenu T.Telix\ Salt:tsalt SynMenu T.Termcap/Printcap:ptcap SynMenu T.Terminfo:terminfo +SynMenu T.Tera\ Term:teraterm SynMenu T.TeX.TeX/LaTeX:tex SynMenu T.TeX.plain\ TeX:plaintex SynMenu T.TeX.Initex:initex @@ -568,6 +599,7 @@ SynMenu T.TeX.Texinfo:texinfo SynMenu T.TF\ mud\ client:tf SynMenu T.Tidy\ configuration:tidy SynMenu T.Tilde:tilde +SynMenu T.Tmux\ configuration:tmux SynMenu T.TPP:tpp SynMenu T.Trasys\ input:trasys SynMenu T.Treetop:treetop @@ -585,6 +617,7 @@ SynMenu UV.Updatedb\.conf:updatedb SynMenu UV.Upstart:upstart SynMenu UV.Valgrind:valgrind SynMenu UV.Vera:vera +SynMenu UV.Verbose\ TAP\ Output:tap SynMenu UV.Verilog-AMS\ HDL:verilogams SynMenu UV.Verilog\ HDL:verilog SynMenu UV.Vgrindefs:vgrindefs @@ -596,6 +629,7 @@ SynMenu UV.Virata\ config:virata SynMenu UV.Visual\ Basic:vb SynMenu UV.VOS\ CM\ macro:voscm SynMenu UV.VRML:vrml +SynMenu UV.Vroom:vroom SynMenu UV.VSE\ JCL:vsejcl SynMenu WXYZ.WEB.CWEB:cweb diff --git a/runtime/menu.vim b/runtime/menu.vim index 7b2be977fc..f7cb052741 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 May 22 +" Last Change: 2018 May 17 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -17,7 +17,7 @@ if !exists("did_install_default_menus") let did_install_default_menus = 1 -if (exists("v:lang") || &langmenu != "") +if exists("v:lang") || &langmenu != "" " Try to find a menu translation file for the current language. if &langmenu != "" if &langmenu =~ "none" @@ -80,6 +80,9 @@ if has("gui_macvim") an <silent> 9998.350 Window.Select\ Previous\ Tab :tabprevious<CR> an 9998.360 Window.-SEP2- <Nop> an <silent> 9998.370 Window.Bring\ All\ To\ Front <Nop> + an <silent> 9998.380 Window.Stay\ in\ Front <Nop> + an <silent> 9998.390 Window.Stay\ in\ Back <Nop> + an <silent> 9998.400 Window.Stay\ Level\ Normal <Nop> endif " Help menu @@ -90,7 +93,7 @@ if has("gui_macvim") endif an 9999.10 &Help.&Overview<Tab><F1> :help<CR> an 9999.20 &Help.&User\ Manual :help usr_toc<CR> -an 9999.30 &Help.&How-to\ links :help how-to<CR> +an 9999.30 &Help.&How-To\ Links :help how-to<CR> an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR> an 9999.45 &Help.-sep1- <Nop> an 9999.50 &Help.&Credits :help credits<CR> @@ -148,7 +151,7 @@ an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR> if has("diff") an 10.400 &File.-SEP2- <Nop> - an 10.410 &File.Split\ &Diff\ with\.\.\. :browse vert diffsplit<CR> + an 10.410 &File.Split\ &Diff\ With\.\.\. :browse vert diffsplit<CR> an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR> endif @@ -197,7 +200,7 @@ nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p inoremenu &Edit.Put\ &After<Tab>]p <C-O>]p -if has("win32") || has("win16") +if has("win32") vnoremenu 20.390 &Edit.&Delete<Tab>x x endif noremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG :<C-U>call <SID>SelectAll()<CR> @@ -205,7 +208,7 @@ inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>S cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR> an 20.405 &Edit.-SEP2- <Nop> -if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") +if has("win32") || has("gui_gtk") || has("gui_kde") || has("gui_motif") an 20.410 &Edit.&Find\.\.\. :promptfind<CR> vunmenu &Edit.&Find\.\.\. vnoremenu <silent> &Edit.&Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR> @@ -233,7 +236,7 @@ an 20.435 &Edit.Startup\ &Settings :call <SID>EditVimrc()<CR> fun! s:EditVimrc() if $MYVIMRC != '' let fname = $MYVIMRC - elseif has("win32") || has("dos32") || has("dos16") || has("os2") + elseif has("win32") if $HOME != '' let fname = $HOME . "/_vimrc" else @@ -259,25 +262,25 @@ endfun " Edit/Global Settings an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight<Tab>:set\ hls! :set hls! hls?<CR> -an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignore-case<Tab>:set\ ic! :set ic! ic?<CR> -an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showmatch<Tab>:set\ sm! :set sm! sm?<CR> - -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 1\ :set so=1<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 2\ :set so=2<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 3\ :set so=3<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 4\ :set so=4<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 5\ :set so=5<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 7\ :set so=7<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 10\ :set so=10<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 100\ :set so=100<CR> +an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignoring\ Case<Tab>:set\ ic! :set ic! ic?<CR> +an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! :set sm! sm?<CR> + +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 1\ :set so=1<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 2\ :set so=2<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 3\ :set so=3<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 4\ :set so=4<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 5\ :set so=5<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 7\ :set so=7<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 10\ :set so=10<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 100\ :set so=100<CR> an 20.440.130.40 &Edit.&Global\ Settings.&Virtual\ Edit.Never :set ve=<CR> an 20.440.130.50 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ Selection :set ve=block<CR> -an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ mode :set ve=insert<CR> +an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ Mode :set ve=insert<CR> an 20.440.130.70 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ and\ Insert :set ve=block,insert<CR> an 20.440.130.80 &Edit.&Global\ Settings.&Virtual\ Edit.Always :set ve=all<CR> an 20.440.140 &Edit.&Global\ Settings.Toggle\ Insert\ &Mode<Tab>:set\ im! :set im!<CR> -an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatible<Tab>:set\ cp! :set cp!<CR> +an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! :set cp!<CR> an <silent> 20.440.150 &Edit.&Global\ Settings.Search\ &Path\.\.\. :call <SID>SearchP()<CR> an <silent> 20.440.160 &Edit.&Global\ Settings.Ta&g\ Files\.\.\. :call <SID>TagFiles()<CR> " @@ -321,13 +324,13 @@ endfun " Boolean options an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu! :set nu! nu?<CR> -an 20.440.105 &Edit.F&ile\ Settings.Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR> +an 20.440.105 &Edit.F&ile\ Settings.Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR> an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list! :set list! list?<CR> -an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrap<Tab>:set\ wrap! :set wrap! wrap?<CR> -an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rap\ at\ word<Tab>:set\ lbr! :set lbr! lbr?<CR> -an 20.440.160 &Edit.F&ile\ Settings.Toggle\ &expand-tab<Tab>:set\ et! :set et! et?<CR> -an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &auto-indent<Tab>:set\ ai! :set ai! ai?<CR> -an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-indenting<Tab>:set\ cin! :set cin! cin?<CR> +an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrapping<Tab>:set\ wrap! :set wrap! wrap?<CR> +an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! :set lbr! lbr?<CR> +an 20.440.160 &Edit.F&ile\ Settings.Toggle\ Tab\ &Expanding<Tab>:set\ et! :set et! et?<CR> +an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &Auto\ Indenting<Tab>:set\ ai! :set ai! ai?<CR> +an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-Style\ Indenting<Tab>:set\ cin! :set cin! cin?<CR> " other options an 20.440.600 &Edit.F&ile\ Settings.-SEP2- <Nop> @@ -356,7 +359,7 @@ fun! s:TextWidth() " Remove leading zeros to avoid it being used as an octal number. " But keep a zero by itself. let tw = substitute(n, "^0*", "", "") - let &tw = tw == '' ? 0 : tw + let &tw = tw == '' ? 0 : tw endif endfun @@ -384,51 +387,65 @@ fun! s:FileFormat() endif endfun +let s:did_setup_color_schemes = 0 " Setup the Edit.Color Scheme submenu +func! s:SetupColorSchemes() abort + if s:did_setup_color_schemes + return + endif + let s:did_setup_color_schemes = 1 -" get NL separated string with file names -let s:n = globpath(&runtimepath, "colors/*.vim") + let n = globpath(&runtimepath, "colors/*.vim", 1, 1) -" split at NL, Ignore case for VMS and windows, sort on name -let s:names = sort(map(split(s:n, "\n"), 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1) + " Ignore case for VMS and windows, sort on name + let names = sort(map(n, 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1) -" define all the submenu entries -let s:idx = 100 -for s:name in s:names - exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>" - let s:idx = s:idx + 10 -endfor -unlet s:name s:names s:n s:idx + " define all the submenu entries + let idx = 100 + for name in names + exe "an 20.450." . idx . ' &Edit.C&olor\ Scheme.' . name . " :colors " . name . "<CR>" + let idx = idx + 10 + endfor + silent! aunmenu &Edit.Show\ C&olor\ Schemes\ in\ Menu +endfun +if exists("do_no_lazyload_menus") + call s:SetupColorSchemes() +else + an <silent> 20.450 &Edit.Show\ C&olor\ Schemes\ in\ Menu :call <SID>SetupColorSchemes()<CR> +endif " Setup the Edit.Keymap submenu if has("keymap") - let s:n = globpath(&runtimepath, "keymap/*.vim") - if s:n != "" - let s:idx = 100 - an 20.460.90 &Edit.&Keymap.None :set keymap=<CR> - while strlen(s:n) > 0 - let s:i = stridx(s:n, "\n") - if s:i < 0 - let s:name = s:n - let s:n = "" - else - let s:name = strpart(s:n, 0, s:i) - let s:n = strpart(s:n, s:i + 1, 19999) - endif - " Ignore case for VMS and windows - let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '') - exe "an 20.460." . s:idx . ' &Edit.&Keymap.' . s:name . " :set keymap=" . s:name . "<CR>" - unlet s:name - unlet s:i - let s:idx = s:idx + 10 - endwhile - unlet s:idx + let s:did_setup_keymaps = 0 + + func! s:SetupKeymaps() abort + if s:did_setup_keymaps + return + endif + let s:did_setup_keymaps = 1 + + let n = globpath(&runtimepath, "keymap/*.vim", 1, 1) + if !empty(n) + let idx = 100 + an 20.460.90 &Edit.&Keymap.None :set keymap=<CR> + for name in n + " Ignore case for VMS and windows + let name = substitute(name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '') + exe "an 20.460." . idx . ' &Edit.&Keymap.' . name . " :set keymap=" . name . "<CR>" + let idx = idx + 10 + endfor + endif + silent! aunmenu &Edit.Show\ &Keymaps\ in\ Menu + endfun + if exists("do_no_lazyload_menus") + call s:SetupKeymaps() + else + an <silent> 20.460 &Edit.Show\ &Keymaps\ in\ Menu :call <SID>SetupKeymaps()<CR> endif - unlet s:n endif -if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") +if has("win32") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR> elseif has("gui_macvim") an 20.470 &Edit.-SEP4- <Nop> @@ -436,7 +453,7 @@ elseif has("gui_macvim") an 20.475.20 &Edit.Font.-SEP5- <Nop> an 20.475.30 &Edit.Font.Bigger <Nop> an 20.475.40 &Edit.Font.Smaller <Nop> - an 20.480 &Edit.Special\ Characters\.\.\. <Nop> + an 20.480 &Edit.Emoji\ &&\ Symbols <Nop> endif " Programming menu @@ -448,10 +465,10 @@ if !exists("g:ctags_command") endif endif -an 40.300 &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]> -vunmenu &Tools.&Jump\ to\ this\ tag<Tab>g^] -vnoremenu &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]> -an 40.310 &Tools.Jump\ &back<Tab>^T <C-T> +an 40.300 &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> +vunmenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] +vnoremenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> +an 40.310 &Tools.Jump\ &Back<Tab>^T <C-T> an 40.320 &Tools.Build\ &Tags\ File :exe "!" . g:ctags_command<CR> if has("folding") || has("spell") @@ -462,17 +479,17 @@ endif if has("spell") an 40.335.110 &Tools.&Spelling.&Spell\ Check\ On :set spell<CR> an 40.335.120 &Tools.&Spelling.Spell\ Check\ &Off :set nospell<CR> - an 40.335.130 &Tools.&Spelling.To\ &Next\ error<Tab>]s ]s - an 40.335.130 &Tools.&Spelling.To\ &Previous\ error<Tab>[s [s + an 40.335.130 &Tools.&Spelling.To\ &Next\ Error<Tab>]s ]s + an 40.335.130 &Tools.&Spelling.To\ &Previous\ Error<Tab>[s [s an 40.335.140 &Tools.&Spelling.Suggest\ &Corrections<Tab>z= z= - an 40.335.150 &Tools.&Spelling.&Repeat\ correction<Tab>:spellrepall :spellrepall<CR> + an 40.335.150 &Tools.&Spelling.&Repeat\ Correction<Tab>:spellrepall :spellrepall<CR> an 40.335.200 &Tools.&Spelling.-SEP1- <Nop> - an 40.335.210 &Tools.&Spelling.Set\ language\ to\ "en" :set spl=en spell<CR> - an 40.335.220 &Tools.&Spelling.Set\ language\ to\ "en_au" :set spl=en_au spell<CR> - an 40.335.230 &Tools.&Spelling.Set\ language\ to\ "en_ca" :set spl=en_ca spell<CR> - an 40.335.240 &Tools.&Spelling.Set\ language\ to\ "en_gb" :set spl=en_gb spell<CR> - an 40.335.250 &Tools.&Spelling.Set\ language\ to\ "en_nz" :set spl=en_nz spell<CR> - an 40.335.260 &Tools.&Spelling.Set\ language\ to\ "en_us" :set spl=en_us spell<CR> + an 40.335.210 &Tools.&Spelling.Set\ Language\ to\ "en" :set spl=en spell<CR> + an 40.335.220 &Tools.&Spelling.Set\ Language\ to\ "en_au" :set spl=en_au spell<CR> + an 40.335.230 &Tools.&Spelling.Set\ Language\ to\ "en_ca" :set spl=en_ca spell<CR> + an 40.335.240 &Tools.&Spelling.Set\ Language\ to\ "en_gb" :set spl=en_gb spell<CR> + an 40.335.250 &Tools.&Spelling.Set\ Language\ to\ "en_nz" :set spl=en_nz spell<CR> + an 40.335.260 &Tools.&Spelling.Set\ Language\ to\ "en_us" :set spl=en_us spell<CR> an <silent> 40.335.270 &Tools.&Spelling.&Find\ More\ Languages :call <SID>SpellLang()<CR> let s:undo_spellang = ['aun &Tools.&Spelling.&Find\ More\ Languages'] @@ -489,14 +506,14 @@ if has("spell") endif if !exists("g:menutrans_set_lang_to") - let g:menutrans_set_lang_to = 'Set language to' + let g:menutrans_set_lang_to = 'Set Language to' endif let found = 0 - let s = globpath(&rtp, "spell/*." . enc . ".spl") - if s != "" + let s = globpath(&runtimepath, "spell/*." . enc . ".spl", 1, 1) + if !empty(s) let n = 300 - for f in split(s, "\n") + for f in s let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "") if nm != "en" && nm !~ '/' let _nm = nm @@ -526,14 +543,14 @@ endif " Tools.Fold Menu if has("folding") " open close folds - an 40.340.110 &Tools.&Folding.&Enable/Disable\ folds<Tab>zi zi + an 40.340.110 &Tools.&Folding.&Enable/Disable\ Folds<Tab>zi zi an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv zv - an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx zMzx - inoremenu 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx <C-O>zM<C-O>zx - an 40.340.130 &Tools.&Folding.C&lose\ more\ folds<Tab>zm zm - an 40.340.140 &Tools.&Folding.&Close\ all\ folds<Tab>zM zM - an 40.340.150 &Tools.&Folding.O&pen\ more\ folds<Tab>zr zr - an 40.340.160 &Tools.&Folding.&Open\ all\ folds<Tab>zR zR + an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx zMzx + inoremenu 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx <C-O>zM<C-O>zx + an 40.340.130 &Tools.&Folding.C&lose\ More\ Folds<Tab>zm zm + an 40.340.140 &Tools.&Folding.&Close\ All\ Folds<Tab>zM zM + an 40.340.150 &Tools.&Folding.O&pen\ More\ Folds<Tab>zr zr + an 40.340.160 &Tools.&Folding.&Open\ All\ Folds<Tab>zR zR " fold method an 40.340.200 &Tools.&Folding.-SEP1- <Nop> an 40.340.210 &Tools.&Folding.Fold\ Met&hod.M&anual :set fdm=manual<CR> @@ -548,14 +565,14 @@ if has("folding") an 40.340.240 &Tools.&Folding.Delete\ &All\ Folds<Tab>zD zD " moving around in folds an 40.340.300 &Tools.&Folding.-SEP2- <Nop> - an 40.340.310.10 &Tools.&Folding.Fold\ col&umn\ width.\ &0\ :set fdc=0<CR> - an 40.340.310.20 &Tools.&Folding.Fold\ col&umn\ width.\ &2\ :set fdc=2<CR> - an 40.340.310.30 &Tools.&Folding.Fold\ col&umn\ width.\ &3\ :set fdc=3<CR> - an 40.340.310.40 &Tools.&Folding.Fold\ col&umn\ width.\ &4\ :set fdc=4<CR> - an 40.340.310.50 &Tools.&Folding.Fold\ col&umn\ width.\ &5\ :set fdc=5<CR> - an 40.340.310.60 &Tools.&Folding.Fold\ col&umn\ width.\ &6\ :set fdc=6<CR> - an 40.340.310.70 &Tools.&Folding.Fold\ col&umn\ width.\ &7\ :set fdc=7<CR> - an 40.340.310.80 &Tools.&Folding.Fold\ col&umn\ width.\ &8\ :set fdc=8<CR> + an 40.340.310.10 &Tools.&Folding.Fold\ Col&umn\ Width.\ &0\ :set fdc=0<CR> + an 40.340.310.20 &Tools.&Folding.Fold\ Col&umn\ Width.\ &2\ :set fdc=2<CR> + an 40.340.310.30 &Tools.&Folding.Fold\ Col&umn\ Width.\ &3\ :set fdc=3<CR> + an 40.340.310.40 &Tools.&Folding.Fold\ Col&umn\ Width.\ &4\ :set fdc=4<CR> + an 40.340.310.50 &Tools.&Folding.Fold\ Col&umn\ Width.\ &5\ :set fdc=5<CR> + an 40.340.310.60 &Tools.&Folding.Fold\ Col&umn\ Width.\ &6\ :set fdc=6<CR> + an 40.340.310.70 &Tools.&Folding.Fold\ Col&umn\ Width.\ &7\ :set fdc=7<CR> + an 40.340.310.80 &Tools.&Folding.Fold\ Col&umn\ Width.\ &8\ :set fdc=8<CR> endif " has folding if has("diff") @@ -583,7 +600,7 @@ an 40.430.70 &Tools.Error\ &Window.&Close<Tab>:cclose :cclose<CR> an 40.520 &Tools.-SEP3- <Nop> an <silent> 40.530 &Tools.&Convert\ to\ HEX<Tab>:%!xxd \ :call <SID>XxdConv()<CR> -an <silent> 40.540 &Tools.Conve&rt\ back<Tab>:%!xxd\ -r +an <silent> 40.540 &Tools.Conve&rt\ Back<Tab>:%!xxd\ -r \ :call <SID>XxdBack()<CR> " Use a function to do the conversion, so that it also works with 'insertmode' @@ -618,7 +635,7 @@ endfun func! s:XxdFind() if !exists("g:xxdprogram") " On the PC xxd may not be in the path but in the install directory - if (has("win32") || has("dos32")) && !executable("xxd") + if has("win32") && !executable("xxd") let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe" else let g:xxdprogram = "xxd" @@ -626,27 +643,46 @@ func! s:XxdFind() endif endfun +let s:did_setup_compilers = 0 + " Setup the Tools.Compiler submenu -let s:n = globpath(&runtimepath, "compiler/*.vim") -let s:idx = 100 -while strlen(s:n) > 0 - let s:i = stridx(s:n, "\n") - if s:i < 0 - let s:name = s:n - let s:n = "" - else - let s:name = strpart(s:n, 0, s:i) - let s:n = strpart(s:n, s:i + 1, 19999) +func! s:SetupCompilers() abort + if s:did_setup_compilers + return endif - " Ignore case for VMS and windows - let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '') - exe "an 30.440." . s:idx . ' &Tools.Se&T\ Compiler.' . s:name . " :compiler " . s:name . "<CR>" - unlet s:name - unlet s:i - let s:idx = s:idx + 10 -endwhile -unlet s:n -unlet s:idx + let s:did_setup_compilers = 1 + + let n = globpath(&runtimepath, "compiler/*.vim", 1, 1) + let idx = 100 + for name in n + " Ignore case for VMS and windows + let name = substitute(name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '') + exe "an 30.440." . idx . ' &Tools.Se&t\ Compiler.' . name . " :compiler " . name . "<CR>" + let idx = idx + 10 + endfor + silent! aunmenu &Tools.Show\ Compiler\ Se&ttings\ in\ Menu +endfun +if exists("do_no_lazyload_menus") + call s:SetupCompilers() +else + an <silent> 30.440 &Tools.Show\ Compiler\ Se&ttings\ in\ Menu :call <SID>SetupCompilers()<CR> +endif + +" Load ColorScheme, Compiler Setting and Keymap menus when idle. +if !exists("do_no_lazyload_menus") + func! s:SetupLazyloadMenus() + call s:SetupColorSchemes() + call s:SetupCompilers() + if has("keymap") + call s:SetupKeymaps() + endif + endfunc + augroup SetupLazyloadMenus + au! + au CursorHold,CursorHoldI * call <SID>SetupLazyloadMenus() | au! SetupLazyloadMenus + augroup END +endif + if !exists("no_buffers_menu") @@ -883,8 +919,8 @@ an 70.345 &Window.Close\ &Other(s)<Tab>^Wo :confirm only<CR> an 70.350 &Window.-SEP2- <Nop> an 70.355 &Window.Move\ &To.&Top<Tab>^WK <C-W>K an 70.355 &Window.Move\ &To.&Bottom<Tab>^WJ <C-W>J -an 70.355 &Window.Move\ &To.&Left\ side<Tab>^WH <C-W>H -an 70.355 &Window.Move\ &To.&Right\ side<Tab>^WL <C-W>L +an 70.355 &Window.Move\ &To.&Left\ Side<Tab>^WH <C-W>H +an 70.355 &Window.Move\ &To.&Right\ Side<Tab>^WL <C-W>L an 70.360 &Window.Rotate\ &Up<Tab>^WR <C-W>R an 70.362 &Window.Rotate\ &Down<Tab>^Wr <C-W>r an 70.365 &Window.-SEP3- <Nop> @@ -968,7 +1004,10 @@ if has("spell") let s:suglist = spellsuggest(w, 10) endif if len(s:suglist) > 0 - let s:changeitem = 'change\ "' . escape(w, ' .'). '"\ to' + if !exists("g:menutrans_spell_change_ARG_to") + let g:menutrans_spell_change_ARG_to = 'Change\ "%s"\ to' + endif + let s:changeitem = printf(g:menutrans_spell_change_ARG_to, escape(w, ' .')) let s:fromword = w let pri = 1 " set 'cpo' to include the <CR> @@ -980,10 +1019,16 @@ if has("spell") let pri += 1 endfor - let s:additem = 'add\ "' . escape(w, ' .') . '"\ to\ word\ list' + if !exists("g:menutrans_spell_add_ARG_to_word_list") + let g:menutrans_spell_add_ARG_to_word_list = 'Add\ "%s"\ to\ Word\ List' + endif + let s:additem = printf(g:menutrans_spell_add_ARG_to_word_list, escape(w, ' .')) exe 'anoremenu 1.6 PopUp.' . s:additem . ' :spellgood ' . w . '<CR>' - let s:ignoreitem = 'ignore\ "' . escape(w, ' .') . '"' + if !exists("g:menutrans_spell_ignore_ARG") + let g:menutrans_spell_ignore_ARG = 'Ignore\ "%s"' + endif + let s:ignoreitem = printf(g:menutrans_spell_ignore_ARG, escape(w, ' .')) exe 'anoremenu 1.7 PopUp.' . s:ignoreitem . ' :spellgood! ' . w . '<CR>' anoremenu 1.8 PopUp.-SpellSep- : @@ -1130,7 +1175,7 @@ endif " !exists("did_install_default_menus") if !exists("did_install_syntax_menu") an 50.212 &Syntax.&Manual :syn manual<CR> an 50.214 &Syntax.A&utomatic :syn on<CR> - an <silent> 50.216 &Syntax.on/off\ for\ &This\ file :call <SID>SynOnOff()<CR> + an <silent> 50.216 &Syntax.On/Off\ for\ &This\ File :call <SID>SynOnOff()<CR> if !exists("*s:SynOnOff") fun s:SynOnOff() if has("syntax_items") @@ -1158,14 +1203,14 @@ if (exists("did_load_filetypes") || exists("syntax_on")) if exists("do_syntax_sel_menu") runtime! synmenu.vim else - an 50.10 &Syntax.&Show\ filetypes\ in\ menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ filetypes\ in\ menu<CR> + an <silent> 50.10 &Syntax.&Show\ File\ Types\ in\ Menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ File\ Types\ in\ Menu<CR> an 50.195 &Syntax.-SEP1- <Nop> endif an 50.210 &Syntax.&Off :syn off<CR> an 50.700 &Syntax.-SEP3- <Nop> -an 50.710 &Syntax.Co&lor\ test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR> -an 50.720 &Syntax.&Highlight\ test :runtime syntax/hitest.vim<CR> +an 50.710 &Syntax.Co&lor\ Test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR> +an 50.720 &Syntax.&Highlight\ Test :runtime syntax/hitest.vim<CR> an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR> endif " !exists("did_install_syntax_menu") @@ -1208,9 +1253,9 @@ if has("gui_macvim") macm Edit.Font.Show\ Fonts action=orderFrontFontPanel: macm Edit.Font.Bigger key=<D-=> action=fontSizeUp: macm Edit.Font.Smaller key=<D--> action=fontSizeDown: - macm Edit.Special\ Characters\.\.\. key=<D-M-t> action=orderFrontCharacterPalette: + macm Edit.Emoji\ &&\ Symbols key=<D-C-Space> action=orderFrontCharacterPalette: - macm Tools.Spelling.To\ Next\ error<Tab>]s key=<D-;> + macm Tools.Spelling.To\ Next\ Error<Tab>]s key=<D-;> macm Tools.Spelling.Suggest\ Corrections<Tab>z= key=<D-:> macm Tools.Make<Tab>:make key=<D-b> macm Tools.List\ Errors<Tab>:cl key=<D-l> @@ -1227,6 +1272,9 @@ if has("gui_macvim") macm Window.Select\ Next\ Tab key=<D-}> macm Window.Select\ Previous\ Tab key=<D-{> macm Window.Bring\ All\ To\ Front action=arrangeInFront: + macm Window.Stay\ in\ Front action=stayInFront: + macm Window.Stay\ in\ Back action=stayInBack: + macm Window.Stay\ Level\ Normal action=stayLevelNormal: macm Help.MacVim\ Help key=<D-?> macm Help.MacVim\ Website action=openWebsite: diff --git a/runtime/mswin.vim b/runtime/mswin.vim index ca280d227c..da869a9fc7 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,7 +1,7 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2012 Jul 25 +" Last change: 2017 Oct 28 " bail out if this isn't wanted (mrsvim.vim uses this). if exists("g:skip_loading_mswin") && g:skip_loading_mswin @@ -23,20 +23,22 @@ set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap <BS> d -" CTRL-X and SHIFT-Del are Cut -vnoremap <C-X> "+x -vnoremap <S-Del> "+x +if has("clipboard") + " CTRL-X and SHIFT-Del are Cut + vnoremap <C-X> "+x + vnoremap <S-Del> "+x -" CTRL-C and CTRL-Insert are Copy -vnoremap <C-C> "+y -vnoremap <C-Insert> "+y + " CTRL-C and CTRL-Insert are Copy + vnoremap <C-C> "+y + vnoremap <C-Insert> "+y -" CTRL-V and SHIFT-Insert are Paste -map <C-V> "+gP -map <S-Insert> "+gP + " CTRL-V and SHIFT-Insert are Paste + map <C-V> "+gP + map <S-Insert> "+gP -cmap <C-V> <C-R>+ -cmap <S-Insert> <C-R>+ + cmap <C-V> <C-R>+ + cmap <S-Insert> <C-R>+ +endif " Pasting blockwise and linewise selections is not possible in Insert and " Visual mode without the +virtualedit feature. They are pasted as if they @@ -44,8 +46,10 @@ cmap <S-Insert> <C-R>+ " Uses the paste.vim autoload script. " Use CTRL-G u to have CTRL-Z only undo the paste. -exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i'] -exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v'] +if 1 + exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i'] + exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v'] +endif imap <S-Insert> <C-V> vmap <S-Insert> <C-V> @@ -99,6 +103,19 @@ inoremap <C-F4> <C-O><C-W>c cnoremap <C-F4> <C-C><C-W>c onoremap <C-F4> <C-C><C-W>c +if has("gui") + " CTRL-F is the search dialog + noremap <expr> <C-F> has("gui_running") ? ":promptfind\<CR>" : "/" + inoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-O>:promptfind\<CR>" : "\<C-\>\<C-O>/" + cnoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-C>:promptfind\<CR>" : "\<C-\>\<C-O>/" + + " CTRL-H is the replace dialog, + " but in console, it might be backspace, so don't map it there + nnoremap <expr> <C-H> has("gui_running") ? ":promptrepl\<CR>" : "\<C-H>" + inoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-O>:promptrepl\<CR>" : "\<C-H>" + cnoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-C>:promptrepl\<CR>" : "\<C-H>" +endif + " restore 'cpoptions' set cpo& if 1 diff --git a/runtime/optwin.vim b/runtime/optwin.vim index de51e280ef..1089f51a4c 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,20 +1,17 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Apr 01 +" Last Change: 2018 May 15 " If there already is an option window, jump to that one. -if bufwinnr("option-window") > 0 - let s:thiswin = winnr() - while 1 - if @% == "option-window" +let buf = bufnr('option-window') +if buf >= 0 + let winids = win_findbuf(buf) + if len(winids) > 0 + if win_gotoid(winids[0]) == 1 finish endif - wincmd w - if s:thiswin == winnr() - break - endif - endwhile + endif endif " Make sure the '<' flag is not included in 'cpoptions', otherwise <CR> would @@ -125,11 +122,13 @@ fun! <SID>Update(lnum, line, local, thiswin) endfun " Reset 'title' and 'icon' to make it work faster. +" Reset 'undolevels' to avoid undo'ing until the buffer is empty. let s:old_title = &title let s:old_icon = &icon let s:old_sc = &sc let s:old_ru = &ru -set notitle noicon nosc noru +let s:old_ul = &ul +set notitle noicon nosc noru ul=-1 " If the current window is a help window, try finding a non-help window. " Relies on syntax highlighting to be switched on. @@ -141,15 +140,15 @@ while exists("b:current_syntax") && b:current_syntax == "help" endif endwhile -" Open the window -new option-window +" Open the window. $OPTWIN_CMD is set to "tab" for ":tab options". +exe $OPTWIN_CMD . ' new option-window' setlocal ts=15 tw=0 noro buftype=nofile " Insert help and a "set" command for each option. call append(0, '" Each "set" line shows the current value of an option (on the left).') call append(1, '" Hit <CR> on a "set" line to execute it.') call append(2, '" A boolean option will be toggled.') -call append(3, '" For other options you can edit the value.') +call append(3, '" For other options you can edit the value before hitting <CR>.') call append(4, '" Hit <CR> on a help line to open a help window on this option.') call append(5, '" Hit <CR> on an index line to jump there.') call append(6, '" Hit <Space> on a "set" line to refresh it.') @@ -228,6 +227,8 @@ else endif call append("$", "runtimepath\tlist of directories used for runtime files and plugins") call <SID>OptionG("rtp", &rtp) +call append("$", "packpath\tlist of directories used for plugin packages") +call <SID>OptionG("pp", &pp) call append("$", "helpfile\tname of the main help file") call <SID>OptionG("hf", &hf) @@ -289,6 +290,10 @@ call append("$", " \tset tl=" . &tl) call append("$", "tags\tlist of file names to search for tags") call append("$", "\t(global or local to buffer)") call <SID>OptionG("tag", &tag) +call append("$", "tagcase\thow to handle case when searching in tags files:") +call append("$", "\t\"followic\" to follow 'ignorecase', \"ignore\" or \"match\"") +call append("$", "\t(global or local to buffer)") +call <SID>OptionG("tc", &tc) call append("$", "tagrelative\tfile names in a tags file are relative to the tags file") call <SID>BinOptionG("tr", &tr) call append("$", "tagstack\ta :tag command will use the tagstack") @@ -320,7 +325,8 @@ call <SID>OptionL("scr") call append("$", "scrolloff\tnumber of screen lines to show around the cursor") call append("$", " \tset so=" . &so) call append("$", "wrap\tlong lines wrap") -call <SID>BinOptionG("wrap", &wrap) +call append("$", "\t(local to window)") +call <SID>BinOptionL("wrap") call append("$", "linebreak\twrap long lines at a character in 'breakat'") call append("$", "\t(local to window)") call <SID>BinOptionL("lbr") @@ -406,6 +412,10 @@ call append("$", "highlight\twhich highlighting to use for various occasions") call <SID>OptionG("hl", &hl) call append("$", "hlsearch\thighlight all matches for the last used search pattern") call <SID>BinOptionG("hls", &hls) +if has("termguicolors") + call append("$", "termguicolors\tuse GUI colors for the terminal") + call <SID>BinOptionG("tgc", &tgc) +endif if has("syntax") call append("$", "cursorcolumn\thighlight the screen column of the cursor") call append("$", "\t(local to window)") @@ -496,6 +506,21 @@ if has("cursorbind") call append("$", "\t(local to window)") call <SID>BinOptionL("crb") endif +if has("terminal") + call append("$", "termwinsize\tsize of a terminal window") + call append("$", "\t(local to window)") + call <SID>OptionL("tws") + call append("$", "termwinkey\tkey that precedes Vim commands in a terminal window") + call append("$", "\t(local to window)") + call <SID>OptionL("twk") + call append("$", "termwinscroll\tmax number of lines to keep for scrollback in a terminal window") + call append("$", "\t(local to window)") + call <SID>OptionL("twsl") + if exists("&winptydll") + call append("$", "winptydll\tname of the winpty dynamic library") + call <SID>OptionG("winptydll", &winptydll) + endif +endif call <SID>Header("multiple tab pages") @@ -530,7 +555,7 @@ call append("$", "scrolljump\tminimal number of lines to scroll at a time") call append("$", " \tset sj=" . &sj) call append("$", "ttyscroll\tmaximum number of lines to use scrolling instead of redrawing") call append("$", " \tset tsl=" . &tsl) -if has("gui") || has("msdos") || has("win32") +if has("gui") || has("win32") call append("$", "guicursor\tspecifies what the cursor looks like in different modes") call <SID>OptionG("gcr", &gcr) endif @@ -606,6 +631,10 @@ if has("gui") call append("$", "guiheadroom\troom (in pixels) left above/below the window") call append("$", " \tset ghr=" . &ghr) endif + if has("directx") + call append("$", "renderoptions\toptions for text rendering") + call <SID>OptionG("rop", &rop) + endif call append("$", "guipty\tuse a pseudo-tty for I/O to external commands") call <SID>BinOptionG("guipty", &guipty) if has("browse") @@ -624,11 +653,19 @@ if has("gui") endif call append("$", "linespace\tnumber of pixel lines to use between characters") call append("$", " \tset lsp=" . &lsp) - if has("balloon_eval") + call append("$", "columnspace\tnumber of pixel columns to use between characters") + call append("$", " \tset csp=" . &csp) + if has("balloon_eval") || has("balloon_eval_term") call append("$", "balloondelay\tdelay in milliseconds before a balloon may pop up") call append("$", " \tset bdlay=" . &bdlay) - call append("$", "ballooneval\twhether the balloon evaluation is to be used") - call <SID>BinOptionG("beval", &beval) + if has("balloon_eval") + call append("$", "ballooneval\tuse balloon evaluation in the GUI") + call <SID>BinOptionG("beval", &beval) + endif + if has("balloon_eval_term") + call append("$", "balloonevalterm\tuse balloon evaluation in the terminal") + call <SID>BinOptionG("bevalterm", &beval) + endif if has("eval") call append("$", "balloonexpr\texpression to show in balloon eval") call append("$", " \tset bexpr=" . &bexpr) @@ -641,12 +678,18 @@ if has("gui") if has("gui_macvim") call append("$", "transparency\ttransparency of the text background as a percent") call append("$", " \tset transparency=" . &transp) + call append("$", "blurradius\tblur effect of the transparent background") + call append("$", " \tset blurradius=" . &blur) call append("$", "fullscreen\tdisplay vim in fullscreen mode") call <SID>BinOptionG("fullscreen", &fullscreen) call append("$", "fuoptions\tcontrol how fullscreen mode should behave") call <SID>OptionG("fuoptions", &fuoptions) + call append("$", "macligatures\tdisplay ligatures") + call <SID>BinOptionG("macligatures", &macligatures) call append("$", "macmeta\tuse option as meta key") call append("$", "\t(local to buffer)") + call append("$", "macthinstrokes\tuse thin strokes") + call <SID>BinOptionG("macthinstrokes", &macthinstrokes) call <SID>BinOptionL("mmta") endif endif @@ -712,6 +755,8 @@ call append("$", "errorbells\tring the bell for error messages") call <SID>BinOptionG("eb", &eb) call append("$", "visualbell\tuse a visual bell instead of beeping") call <SID>BinOptionG("vb", &vb) +call append("$", "belloff\tdo not ring the bell for these reasons") +call <SID>OptionG("belloff", &belloff) if has("multi_lang") call append("$", "helplang\tlist of preferred languages for finding help") call <SID>OptionG("hlg", &hlg) @@ -735,7 +780,12 @@ call <SID>OptionG("km", &km) call <SID>Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") -call append("$", " \tset ul=" . &ul) +call append("$", "\t(global or local to buffer)") +call append("$", " \tset ul=" . s:old_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") @@ -777,6 +827,8 @@ if has("insert_expand") call <SID>OptionG("cot", &cot) call append("$", "pumheight\tmaximum height of the popup menu") call <SID>OptionG("ph", &ph) + call append("$", "pumwidth\tminimum width of the popup menu") + call <SID>OptionG("pw", &pw) call append("$", "completefunc\tuser defined function for Insert mode completion") call append("$", "\t(local to buffer)") call <SID>OptionL("cfu") @@ -794,7 +846,7 @@ call append("$", "infercase\tadjust case of a keyword completion match") call append("$", "\t(local to buffer)") call <SID>BinOptionL("inf") if has("digraphs") - call append("$", "digraph\tenable entering digraps with c1 <BS> c2") + call append("$", "digraph\tenable entering digraphs with c1 <BS> c2") call <SID>BinOptionG("dg", &dg) endif call append("$", "tildeop\tthe \"~\" command behaves like an operator") @@ -913,7 +965,7 @@ if has("folding") call append("$", "foldmarker\tmarkers used when 'foldmethod' is \"marker\"") call append("$", "\t(local to window)") call <SID>OptionL("fmr") - call append("$", "foldnestmax\tmaximum fold depth for when 'foldmethod is \"indent\" or \"syntax\"") + call append("$", "foldnestmax\tmaximum fold depth for when 'foldmethod' is \"indent\" or \"syntax\"") call append("$", "\t(local to window)") call <SID>OptionL("fdn") endif @@ -960,6 +1012,9 @@ call <SID>BinOptionL("bin") call append("$", "endofline\tlast line in the file has an end-of-line") call append("$", "\t(local to buffer)") call <SID>BinOptionL("eol") +call append("$", "fixendofline\tfixes missing end-of-line at end of text file") +call append("$", "\t(local to buffer)") +call <SID>BinOptionL("fixeol") if has("multi_byte") call append("$", "bomb\tprepend a Byte Order Mark to the file") call append("$", "\t(local to buffer)") @@ -984,6 +1039,7 @@ call <SID>BinOptionG("bk", &bk) call append("$", "backupskip\tpatterns that specify for which files a backup is not made") call append("$", " \tset bsk=" . &bsk) call append("$", "backupcopy\twhether to make the backup as a copy or rename the existing file") +call append("$", "\t(global or local to buffer)") call append("$", " \tset bkc=" . &bkc) call append("$", "backupdir\tlist of directories to put backup files in") call <SID>OptionG("bdir", &bdir) @@ -1002,11 +1058,9 @@ call append("$", "patchmode\tkeep oldest version of a file; specifies file name call <SID>OptionG("pm", &pm) call append("$", "fsync\tforcibly sync the file to disk after writing it") call <SID>BinOptionG("fs", &fs) -if !has("msdos") - call append("$", "shortname\tuse 8.3 file names") - call append("$", "\t(local to buffer)") - call <SID>BinOptionL("sn") -endif +call append("$", "shortname\tuse 8.3 file names") +call append("$", "\t(local to buffer)") +call <SID>BinOptionL("sn") call append("$", "cryptmethod\tencryption method for file writing: zip or blowfish") call append("$", "\t(local to buffer)") call <SID>OptionL("cm") @@ -1068,10 +1122,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") @@ -1123,23 +1173,20 @@ if has("quickfix") call <SID>OptionG("gp", &gp) call append("$", "grepformat\tlist of formats for output of 'grepprg'") call <SID>OptionG("gfm", &gfm) + call append("$", "makeencoding\tencoding of the \":make\" and \":grep\" output") + call append("$", "\t(global or local to buffer)") + call <SID>OptionG("menc", &menc) endif -if has("msdos") || has("os2") || has("win16") || has("win32") || has("osfiletype") +if has("win32") || has("osfiletype") call <SID>Header("system specific") - if has("msdos") - call append("$", "bioskey\tcall the BIOS to get a keyoard character") - call <SID>BinOptionG("biosk", &biosk) - call append("$", "conskey\tuse direct console I/O to get a keyboard character") - call <SID>BinOptionG("consk", &consk) - endif if has("osfiletype") call append("$", "osfiletype\tOS-specific information about the type of file") call append("$", "\t(local to buffer)") call <SID>OptionL("oft") endif - if has("msdos") || has("os2") || has("win16") || has("win32") + if has("win32") call append("$", "shellslash\tuse forward slashes in file names; for Unix-like shells") call <SID>BinOptionG("ssl", &ssl) endif @@ -1195,12 +1242,14 @@ if has("arabic") call <SID>BinOptionG("tbidi", &tbidi) endif if has("keymap") - call append("$", "keymap\tname of a keyboard mappping") + call append("$", "keymap\tname of a keyboard mapping") call <SID>OptionL("kmp") endif if has("langmap") - call append("$", "langmap\ttranslate characters for Normal mode") + call append("$", "langmap\tlist of characters that are translated in Normal mode") call <SID>OptionG("lmap", &lmap) + call append("$", "langremap\tapply 'langmap' to mapped characters") + call <SID>BinOptionG("lrm", &lrm) endif if has("xim") call append("$", "imdisable\twhen set never use IM; overrules following IM options") @@ -1209,6 +1258,8 @@ endif call append("$", "iminsert\tin Insert mode: 1: use :lmap; 2: use IM; 0: neither") call append("$", "\t(local to window)") call <SID>OptionL("imi") +call append("$", "imstyle\tinput method style, 0: on-the-spot, 1: over-the-spot") +call <SID>OptionG("imst", &imst) call append("$", "imsearch\tentering a search pattern: 1: use :lmap; 2: use IM; 0: neither") call append("$", "\t(local to window)") call <SID>OptionL("ims") @@ -1246,6 +1297,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 @@ -1287,6 +1340,8 @@ endif if has("viminfo") call append("$", "viminfo\tlist that specifies what to write in the viminfo file") call <SID>OptionG("vi", &vi) + call append("$", "viminfofile\tfile name used for the viminfo file") + call <SID>OptionG("vif", &vif) endif if has("quickfix") call append("$", "bufhidden\twhat happens with a buffer when it's no longer in a window") @@ -1301,10 +1356,57 @@ call append("$", "\t(local to buffer)") call <SID>BinOptionL("bl") call append("$", "debug\tset to \"msg\" to see all error messages") call append("$", " \tset debug=" . &debug) +if has("signs") + call append("$", "signcolumn\twhether to show the signcolumn") + call append("$", "\t(local to window)") + call <SID>OptionL("scl") +endif if has("mzscheme") call append("$", "mzquantum\tinterval in milliseconds between polls for MzScheme threads") call append("$", " \tset mzq=" . &mzq) endif +if exists("&luadll") + call append("$", "luadll\tname of the Lua dynamic library") + call <SID>OptionG("luadll", &luadll) +endif +if exists("&perldll") + call append("$", "perldll\tname of the Perl dynamic library") + call <SID>OptionG("perldll", &perldll) +endif +if has('pythonx') + call append("$", "pyxversion\twhether to use Python 2 or 3") + call append("$", " \tset pyx=" . &wd) +endif +if exists("&pythondll") + call append("$", "pythondll\tname of the Python 2 dynamic library") + call <SID>OptionG("pythondll", &pythondll) +endif +if exists("&pythonhome") + call append("$", "pythonhome\tname of the Python 2 home directory") + call <SID>OptionG("pythonhome", &pythonhome) +endif +if exists("&pythonthreedll") + call append("$", "pythonthreedll\tname of the Python 3 dynamic library") + call <SID>OptionG("pythonthreedll", &pythonthreedll) +endif +if exists("&pythonthreehome") + call append("$", "pythonthreehome\tname of the Python 3 home directory") + call <SID>OptionG("pythonthreehome", &pythonthreehome) +endif +if exists("&rubydll") + call append("$", "rubydll\tname of the Ruby dynamic library") + call <SID>OptionG("rubydll", &rubydll) +endif +if exists("&tcldll") + call append("$", "tcldll\tname of the Tcl dynamic library") + call <SID>OptionG("tcldll", &tcldll) +endif +if exists("&mzschemedll") + call append("$", "mzschemedll\tname of the Tcl dynamic library") + call <SID>OptionG("mzschemedll", &mzschemedll) + call append("$", "mzschemegcdll\tname of the Tcl GC dynamic library") + call <SID>OptionG("mzschemegcdll", &mzschemegcdll) +endif set cpo&vim @@ -1361,6 +1463,7 @@ let &icon = s:old_icon let &ru = s:old_ru let &sc = s:old_sc let &cpo = s:cpo_save -unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum +let &ul = s:old_ul +unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum s:old_ul " vim: ts=8 sw=2 sts=2 diff --git a/runtime/pack/dist/opt/dvorak/dvorak/disable.vim b/runtime/pack/dist/opt/dvorak/dvorak/disable.vim new file mode 100644 index 0000000000..1e9b0702ff --- /dev/null +++ b/runtime/pack/dist/opt/dvorak/dvorak/disable.vim @@ -0,0 +1,72 @@ +" Back to Qwerty keyboard after using Dvorak. + +iunmap a +iunmap b +iunmap c +iunmap d +iunmap e +iunmap f +iunmap g +iunmap h +iunmap i +iunmap j +iunmap k +iunmap l +iunmap m +iunmap n +iunmap o +iunmap p +iunmap q +iunmap r +iunmap s +iunmap t +iunmap u +iunmap v +iunmap w +iunmap x +iunmap y +iunmap z +iunmap ; +iunmap ' +iunmap " +iunmap , +iunmap . +iunmap / +iunmap A +iunmap B +iunmap C +iunmap D +iunmap E +iunmap F +iunmap G +iunmap H +iunmap I +iunmap J +iunmap K +iunmap L +iunmap M +iunmap N +iunmap O +iunmap P +iunmap Q +iunmap R +iunmap S +iunmap T +iunmap U +iunmap V +iunmap W +iunmap X +iunmap Y +iunmap Z +iunmap < +iunmap > +iunmap ? +iunmap : +iunmap [ +iunmap ] +iunmap { +iunmap } +iunmap - +iunmap _ +iunmap = +iunmap + diff --git a/runtime/pack/dist/opt/dvorak/dvorak/enable.vim b/runtime/pack/dist/opt/dvorak/dvorak/enable.vim new file mode 100644 index 0000000000..8ff363fe97 --- /dev/null +++ b/runtime/pack/dist/opt/dvorak/dvorak/enable.vim @@ -0,0 +1,77 @@ +" Dvorak keyboard, only in Insert mode. +" +" Change "inoremap" to "map!" to also use in Ex mode. +" Also change disable.vim then: "iunmap" to "unmap!". +" +" You may want to add a list of map's too. + +inoremap a a +inoremap b x +inoremap c j +inoremap d e +inoremap e . +inoremap f u +inoremap g i +inoremap h d +inoremap i c +inoremap j h +inoremap k t +inoremap l n +inoremap m m +inoremap n b +inoremap o r +inoremap p l +inoremap q ' +inoremap r p +inoremap s o +inoremap t y +inoremap u g +inoremap v k +inoremap w , +inoremap x q +inoremap y f +inoremap z ; +inoremap ; s +inoremap ' - +inoremap " _ +inoremap , w +inoremap . v +inoremap / z +inoremap A A +inoremap B X +inoremap C J +inoremap D E +inoremap E > +inoremap F U +inoremap G I +inoremap H D +inoremap I C +inoremap J H +inoremap K T +inoremap L N +inoremap M M +inoremap N B +inoremap O R +inoremap P L +inoremap Q " +inoremap R P +inoremap S O +inoremap T Y +inoremap U G +inoremap V K +inoremap W < +inoremap X Q +inoremap Y F +inoremap Z : +inoremap < W +inoremap > V +inoremap ? Z +inoremap : S +inoremap [ / +inoremap ] = +inoremap { ? +inoremap } + +inoremap - [ +inoremap _ { +inoremap = ] +inoremap + } diff --git a/runtime/pack/dist/opt/dvorak/plugin/dvorak.vim b/runtime/pack/dist/opt/dvorak/plugin/dvorak.vim new file mode 100644 index 0000000000..c8d5d5c79f --- /dev/null +++ b/runtime/pack/dist/opt/dvorak/plugin/dvorak.vim @@ -0,0 +1,16 @@ +" When using a dvorak keyboard this file may be of help to you. +" These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>. +" What they do is that the most often used keys, like hjkl, are put in a more +" easy to use position. +" It may take some time to learn using this. + +if exists("g:loaded_dvorak_plugin") + finish +endif +let g:loaded_dvorak_plugin = 1 + +" Key to go into dvorak mode: +map ,d :runtime dvorak/enable.vim<CR> + +" Key to get out of dvorak mode: +map ,q :runtime dvorak/disable.vim<CR> diff --git a/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim b/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim new file mode 100644 index 0000000000..d9877a0591 --- /dev/null +++ b/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim @@ -0,0 +1,114 @@ +" Vim Plugin: Edit the file with an existing Vim if possible +" Maintainer: Bram Moolenaar +" Last Change: 2016 Mar 28 + +" To use add ":packadd! editexisting" in your vimrc file. + +" This plugin serves two purposes: +" 1. On startup, if we were invoked with one file name argument and the file +" is not modified then try to find another Vim instance that is editing +" this file. If there is one then bring it to the foreground and exit. +" 2. When a file is edited and a swap file exists for it, try finding that +" other Vim and bring it to the foreground. Requires Vim 7, because it +" uses the SwapExists autocommand event. + +" Function that finds the Vim instance that is editing "filename" and brings +" it to the foreground. +func s:EditElsewhere(filename) + let fname_esc = substitute(a:filename, "'", "''", "g") + + let servers = serverlist() + while servers != '' + " Get next server name in "servername"; remove it from "servers". + let i = match(servers, "\n") + if i == -1 + let servername = servers + let servers = '' + else + let servername = strpart(servers, 0, i) + let servers = strpart(servers, i + 1) + endif + + " Skip ourselves. + if servername ==? v:servername + continue + endif + + " Check if this server is editing our file. + if remote_expr(servername, "bufloaded('" . fname_esc . "')") + " Yes, bring it to the foreground. + if has("win32") + call remote_foreground(servername) + endif + call remote_expr(servername, "foreground()") + + if remote_expr(servername, "exists('*EditExisting')") + " Make sure the file is visible in a window (not hidden). + " If v:swapcommand exists and is set, send it to the server. + if exists("v:swapcommand") + let c = substitute(v:swapcommand, "'", "''", "g") + call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')") + else + call remote_expr(servername, "EditExisting('" . fname_esc . "', '')") + endif + endif + + if !(has('vim_starting') && has('gui_running') && has('gui_win32')) + " Tell the user what is happening. Not when the GUI is starting + " though, it would result in a message box. + echomsg "File is being edited by " . servername + sleep 2 + endif + return 'q' + endif + endwhile + return '' +endfunc + +" When the plugin is loaded and there is one file name argument: Find another +" Vim server that is editing this file right now. +if argc() == 1 && !&modified + if s:EditElsewhere(expand("%:p")) == 'q' + quit + endif +endif + +" Setup for handling the situation that an existing swap file is found. +try + au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p")) +catch + " Without SwapExists we don't do anything for ":edit" commands +endtry + +" Function used on the server to make the file visible and possibly execute a +" command. +func! EditExisting(fname, command) + " Get the window number of the file in the current tab page. + let winnr = bufwinnr(a:fname) + if winnr <= 0 + " Not found, look in other tab pages. + let bufnr = bufnr(a:fname) + for i in range(tabpagenr('$')) + if index(tabpagebuflist(i + 1), bufnr) >= 0 + " Make this tab page the current one and find the window number. + exe 'tabnext ' . (i + 1) + let winnr = bufwinnr(a:fname) + break + endif + endfor + endif + + if winnr > 0 + exe winnr . "wincmd w" + elseif exists('*fnameescape') + exe "split " . fnameescape(a:fname) + else + exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") + endif + + if a:command != '' + exe "normal! " . a:command + endif + + redraw +endfunc diff --git a/runtime/pack/dist/opt/justify/plugin/justify.vim b/runtime/pack/dist/opt/justify/plugin/justify.vim new file mode 100644 index 0000000000..4ef3bf95fa --- /dev/null +++ b/runtime/pack/dist/opt/justify/plugin/justify.vim @@ -0,0 +1,316 @@ +" Function to left and right align text. +" +" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk> +" Created: 980806 14:13 (or around that time anyway) +" Revised: 001103 00:36 (See "Revisions" below) + + +" function Justify( [ textwidth [, maxspaces [, indent] ] ] ) +" +" Justify() will left and right align a line by filling in an +" appropriate amount of spaces. Extra spaces are added to existing +" spaces starting from the right side of the line. As an example, the +" following documentation has been justified. +" +" The function takes the following arguments: + +" textwidth argument +" ------------------ +" If not specified, the value of the 'textwidth' option is used. If +" 'textwidth' is zero a value of 80 is used. +" +" Additionally the arguments 'tw' and '' are accepted. The value of +" 'textwidth' will be used. These are handy, if you just want to specify +" the maxspaces argument. + +" maxspaces argument +" ------------------ +" If specified, alignment will only be done, if the longest space run +" after alignment is no longer than maxspaces. +" +" An argument of '' is accepted, should the user like to specify all +" arguments. +" +" To aid user defined commands, negative values are accepted aswell. +" Using a negative value specifies the default behaviour: any length of +" space runs will be used to justify the text. + +" indent argument +" --------------- +" This argument specifies how a line should be indented. The default is +" to keep the current indentation. +" +" Negative values: Keep current amount of leading whitespace. +" Positive values: Indent all lines with leading whitespace using this +" amount of whitespace. +" +" Note that the value 0, needs to be quoted as a string. This value +" leads to a left flushed text. +" +" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be +" added. In this case, if the value of indent is positive, the amount of +" whitespace to be added will be multiplied by the value of the +" 'shiftwidth' and 'tabstop' settings. If these units are used, the +" argument must be given as a string, eg. Justify('','','2sw'). +" +" If the values of 'sw' or 'tw' are negative, they are treated as if +" they were 0, which means that the text is flushed left. There is no +" check if a negative number prefix is used to change the sign of a +" negative 'sw' or 'ts' value. +" +" As with the other arguments, '' may be used to get the default +" behaviour. + + +" Notes: +" +" If the line, adjusted for space runs and leading/trailing whitespace, +" is wider than the used textwidth, the line will be left untouched (no +" whitespace removed). This should be equivalent to the behaviour of +" :left, :right and :center. +" +" If the resulting line is shorter than the used textwidth it is left +" untouched. +" +" All space runs in the line are truncated before the alignment is +" carried out. +" +" If you have set 'noexpandtab', :retab! is used to replace space runs +" with whitespace using the value of 'tabstop'. This should be +" conformant with :left, :right and :center. +" +" If joinspaces is set, an extra space is added after '.', '?' and '!'. +" If 'cpooptions' include 'j', extra space is only added after '.'. +" (This may on occasion conflict with maxspaces.) + + +" Related mappings: +" +" Mappings that will align text using the current text width, using at +" most four spaces in a space run and keeping current indentation. +nmap _j :%call Justify('tw',4)<CR> +vmap _j :call Justify('tw',4)<CR> +" +" Mappings that will remove space runs and format lines (might be useful +" prior to aligning the text). +nmap ,gq :%s/\s\+/ /g<CR>gq1G +vmap ,gq :s/\s\+/ /g<CR>gvgq + + +" User defined command: +" +" The following is an ex command that works as a shortcut to the Justify +" function. Arguments to Justify() can be added after the command. +com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>) +" +" The following commands are all equivalent: +" +" 1. Simplest use of Justify(): +" :call Justify() +" :Justify +" +" 2. The _j mapping above via the ex command: +" :%Justify tw 4 +" +" 3. Justify visualised text at 72nd column while indenting all +" previously indented text two shiftwidths +" :'<,'>call Justify(72,'','2sw') +" :'<,'>Justify 72 -1 2sw +" +" This documentation has been justified using the following command: +":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" / + +" Revisions: +" 001103: If 'joinspaces' was set, calculations could be wrong. +" Tabs at start of line could also lead to errors. +" Use setline() instead of "exec 's/foo/bar/' - safer. +" Cleaned up the code a bit. +" +" Todo: Convert maps to the new script specific form + +" Error function +function! Justify_error(message) + echohl Error + echo "Justify([tw, [maxspaces [, indent]]]): " . a:message + echohl None +endfunction + + +" Now for the real thing +function! Justify(...) range + + if a:0 > 3 + call Justify_error("Too many arguments (max 3)") + return 1 + endif + + " Set textwidth (accept 'tw' and '' as arguments) + if a:0 >= 1 + if a:1 =~ '^\(tw\)\=$' + let tw = &tw + elseif a:1 =~ '^\d\+$' + let tw = a:1 + else + call Justify_error("tw must be a number (>0), '' or 'tw'") + return 2 + endif + else + let tw = &tw + endif + if tw == 0 + let tw = 80 + endif + + " Set maximum number of spaces between WORDs + if a:0 >= 2 + if a:2 == '' + let maxspaces = tw + elseif a:2 =~ '^-\d\+$' + let maxspaces = tw + elseif a:2 =~ '^\d\+$' + let maxspaces = a:2 + else + call Justify_error("maxspaces must be a number or ''") + return 3 + endif + else + let maxspaces = tw + endif + if maxspaces <= 1 + call Justify_error("maxspaces should be larger than 1") + return 4 + endif + + " Set the indentation style (accept sw and ts units) + let indent_fix = '' + if a:0 >= 3 + if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = -1 + elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = 0 + elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = substitute(a:3, '\D', '', 'g') + elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$' + let indent = 1 + else + call Justify_error("indent: a number with 'sw'/'ts' unit") + return 5 + endif + if indent >= 0 + while indent > 0 + let indent_fix = indent_fix . ' ' + let indent = indent - 1 + endwhile + let indent_sw = 0 + if a:3 =~ '\(shiftwidth\|sw\)' + let indent_sw = &sw + elseif a:3 =~ '\(tabstop\|ts\)' + let indent_sw = &ts + endif + let indent_fix2 = '' + while indent_sw > 0 + let indent_fix2 = indent_fix2 . indent_fix + let indent_sw = indent_sw - 1 + endwhile + let indent_fix = indent_fix2 + endif + else + let indent = -1 + endif + + " Avoid substitution reports + let save_report = &report + set report=1000000 + + " Check 'joinspaces' and 'cpo' + if &js == 1 + if &cpo =~ 'j' + let join_str = '\(\. \)' + else + let join_str = '\([.!?!] \)' + endif + endif + + let cur = a:firstline + while cur <= a:lastline + + let str_orig = getline(cur) + let save_et = &et + set et + exec cur . "retab" + let &et = save_et + let str = getline(cur) + + let indent_str = indent_fix + let indent_n = strlen(indent_str) + " Shall we remember the current indentation + if indent < 0 + let indent_orig = matchstr(str_orig, '^\s*') + if strlen(indent_orig) > 0 + let indent_str = indent_orig + let indent_n = strlen(matchstr(str, '^\s*')) + endif + endif + + " Trim trailing, leading and running whitespace + let str = substitute(str, '\s\+$', '', '') + let str = substitute(str, '^\s\+', '', '') + let str = substitute(str, '\s\+', ' ', 'g') + let str_n = strdisplaywidth(str) + + " Possible addition of space after punctuation + if exists("join_str") + let str = substitute(str, join_str, '\1 ', 'g') + endif + let join_n = strdisplaywidth(str) - str_n + + " Can extraspaces be added? + " Note that str_n may be less than strlen(str) [joinspaces above] + if strdisplaywidth(str) <= tw - indent_n && str_n > 0 + " How many spaces should be added + let s_add = tw - str_n - indent_n - join_n + let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n + let s_dup = s_add / s_nr + let s_mod = s_add % s_nr + + " Test if the changed line fits with tw + if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw + + " Duplicate spaces + while s_dup > 0 + let str = substitute(str, '\( \+\)', ' \1', 'g') + let s_dup = s_dup - 1 + endwhile + + " Add extra spaces from the end + while s_mod > 0 + let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '') + let s_mod = s_mod - 1 + endwhile + + " Indent the line + if indent_n > 0 + let str = substitute(str, '^', indent_str, '' ) + endif + + " Replace the line + call setline(cur, str) + + " Convert to whitespace + if &et == 0 + exec cur . 'retab!' + endif + + endif " Change of line + endif " Possible change + + let cur = cur + 1 + endwhile + + norm ^ + + let &report = save_report + +endfunction + +" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai diff --git a/runtime/macros/matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt similarity index 98% rename from runtime/macros/matchit.txt rename to runtime/pack/dist/opt/matchit/doc/matchit.txt index 8a3a96e260..935370fd40 100644 --- a/runtime/macros/matchit.txt +++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt @@ -4,7 +4,7 @@ For instructions on installing this file, type :help matchit-install inside Vim. -For Vim version 6.3. Last change: 2007 Aug 29 +For Vim version 6.3. Last change: 2016 Mar 28 VIM REFERENCE MANUAL by Benji Fisher @@ -152,13 +152,10 @@ setting |b:match_skip|. ============================================================================== 2. Activation *matchit-activate* -You can use this script as a plugin, by copying it to your plugin directory. -See |add-global-plugin| for instructions. You can also add a line to your -|vimrc| file, such as > - :source $VIMRUNTIME/macros/matchit.vim -or > - :runtime macros/matchit.vim -Either way, the script should start working the next time you start up Vim. +To use the matchit plugin add this line to your |vimrc|: > + packadd! matchit + +The script should start working the next time you start Vim. (Earlier versions of the script did nothing unless a |buffer-variable| named |b:match_words| was defined. Even earlier versions contained autocommands diff --git a/runtime/pack/dist/opt/matchit/doc/tags b/runtime/pack/dist/opt/matchit/doc/tags new file mode 100644 index 0000000000..4ccdc8721c --- /dev/null +++ b/runtime/pack/dist/opt/matchit/doc/tags @@ -0,0 +1,50 @@ +:MatchDebug matchit.txt /*:MatchDebug* +MatchError matchit.txt /*MatchError* +[% matchit.txt /*[%* +]% matchit.txt /*]%* +b:match_col matchit.txt /*b:match_col* +b:match_debug matchit.txt /*b:match_debug* +b:match_ignorecase matchit.txt /*b:match_ignorecase* +b:match_ini matchit.txt /*b:match_ini* +b:match_iniBR matchit.txt /*b:match_iniBR* +b:match_match matchit.txt /*b:match_match* +b:match_pat matchit.txt /*b:match_pat* +b:match_skip matchit.txt /*b:match_skip* +b:match_table matchit.txt /*b:match_table* +b:match_tail matchit.txt /*b:match_tail* +b:match_wholeBR matchit.txt /*b:match_wholeBR* +b:match_word matchit.txt /*b:match_word* +b:match_words matchit.txt /*b:match_words* +g% matchit.txt /*g%* +matchit matchit.txt /*matchit* +matchit-% matchit.txt /*matchit-%* +matchit-\1 matchit.txt /*matchit-\\1* +matchit-activate matchit.txt /*matchit-activate* +matchit-backref matchit.txt /*matchit-backref* +matchit-bugs matchit.txt /*matchit-bugs* +matchit-choose matchit.txt /*matchit-choose* +matchit-configure matchit.txt /*matchit-configure* +matchit-debug matchit.txt /*matchit-debug* +matchit-details matchit.txt /*matchit-details* +matchit-highlight matchit.txt /*matchit-highlight* +matchit-hl matchit.txt /*matchit-hl* +matchit-intro matchit.txt /*matchit-intro* +matchit-languages matchit.txt /*matchit-languages* +matchit-modes matchit.txt /*matchit-modes* +matchit-newlang matchit.txt /*matchit-newlang* +matchit-o_% matchit.txt /*matchit-o_%* +matchit-parse matchit.txt /*matchit-parse* +matchit-s:notend matchit.txt /*matchit-s:notend* +matchit-s:sol matchit.txt /*matchit-s:sol* +matchit-spaces matchit.txt /*matchit-spaces* +matchit-troubleshoot matchit.txt /*matchit-troubleshoot* +matchit-v_% matchit.txt /*matchit-v_%* +matchit.txt matchit.txt /*matchit.txt* +matchit.vim matchit.txt /*matchit.vim* +o_[% matchit.txt /*o_[%* +o_]% matchit.txt /*o_]%* +o_g% matchit.txt /*o_g%* +v_[% matchit.txt /*v_[%* +v_]% matchit.txt /*v_]%* +v_a% matchit.txt /*v_a%* +v_g% matchit.txt /*v_g%* diff --git a/runtime/pack/dist/opt/matchit/plugin/matchit.vim b/runtime/pack/dist/opt/matchit/plugin/matchit.vim new file mode 100644 index 0000000000..4c9b84592c --- /dev/null +++ b/runtime/pack/dist/opt/matchit/plugin/matchit.vim @@ -0,0 +1,823 @@ +" matchit.vim: (global plugin) Extended "%" matching +" Last Change: 2017 March 26 +" Maintainer: Benji Fisher PhD <benji@member.AMS.org> +" Version: 1.13.3, for Vim 6.3+ +" Fix from Fernando Torres included. +" Improvement from Ken Takata included. +" URL: http://www.vim.org/script.php?script_id=39 + +" Documentation: +" The documentation is in a separate file, matchit.txt . + +" Credits: +" Vim editor by Bram Moolenaar (Thanks, Bram!) +" Original script and design by Raul Segura Acevedo +" Support for comments by Douglas Potts +" Support for back references and other improvements by Benji Fisher +" Support for many languages by Johannes Zellner +" Suggestions for improvement, bug reports, and support for additional +" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark +" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. + +" Debugging: +" If you'd like to try the built-in debugging commands... +" :MatchDebug to activate debugging for the current buffer +" This saves the values of several key script variables as buffer-local +" variables. See the MatchDebug() function, below, for details. + +" TODO: I should think about multi-line patterns for b:match_words. +" This would require an option: how many lines to scan (default 1). +" This would be useful for Python, maybe also for *ML. +" TODO: Maybe I should add a menu so that people will actually use some of +" the features that I have implemented. +" TODO: Eliminate the MultiMatch function. Add yet another argument to +" Match_wrapper() instead. +" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' +" TODO: Make backrefs safer by using '\V' (very no-magic). +" TODO: Add a level of indirection, so that custom % scripts can use my +" work but extend it. + +" allow user to prevent loading +" and prevent duplicate loading +if exists("loaded_matchit") || &cp + finish +endif +let loaded_matchit = 1 +let s:last_mps = "" +let s:last_words = ":" +let s:patBR = "" + +let s:save_cpo = &cpo +set cpo&vim + +nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR> +nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR> +vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv`` +vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv`` +onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR> +onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR> + +" Analogues of [{ and ]} using matching patterns: +nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR> +nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR> +vmap [% <Esc>[%m'gv`` +vmap ]% <Esc>]%m'gv`` +" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv`` +" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv`` +onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR> +onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR> + +" text object: +vmap a% <Esc>[%v]% + +" Auto-complete mappings: (not yet "ready for prime time") +" TODO Read :help write-plugin for the "right" way to let the user +" specify a key binding. +" let g:match_auto = '<C-]>' +" let g:match_autoCR = '<C-CR>' +" if exists("g:match_auto") +" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls' +" endif +" if exists("g:match_autoCR") +" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>' +" endif +" if exists("g:match_gthhoh") +" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' +" endif " gthhoh = "Get the heck out of here!" + +let s:notslash = '\\\@<!\%(\\\\\)*' + +function! s:Match_wrapper(word, forward, mode) range + " In s:CleanUp(), :execute "set" restore_options . + let restore_options = "" + if exists("b:match_ignorecase") && b:match_ignorecase != &ic + let restore_options .= (&ic ? " " : " no") . "ignorecase" + let &ignorecase = b:match_ignorecase + endif + if &ve != '' + let restore_options = " ve=" . &ve . restore_options + set ve= + endif + " If this function was called from Visual mode, make sure that the cursor + " is at the correct end of the Visual range: + if a:mode == "v" + execute "normal! gv\<Esc>" + endif + " In s:CleanUp(), we may need to check whether the cursor moved forward. + let startline = line(".") + let startcol = col(".") + " Use default behavior if called with a count. + if v:count + exe "normal! " . v:count . "%" + return s:CleanUp(restore_options, a:mode, startline, startcol) + end + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + " + if !exists("b:match_words") || b:match_words == "" + let match_words = "" + " Allow b:match_words = "GetVimMatchWords()" . + elseif b:match_words =~ ":" + let match_words = b:match_words + else + execute "let match_words =" b:match_words + endif +" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! + if (match_words != s:last_words) || (&mps != s:last_mps) + \ || exists("b:match_debug") + let s:last_mps = &mps + " The next several lines were here before + " BF started messing with this script. + " quote the special chars in 'matchpairs', replace [,:] with \| and then + " append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif) + " let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+', + " \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>' + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' + " s:all = pattern with all the keywords + let match_words = match_words . (strlen(match_words) ? "," : "") . default + let s:last_words = match_words + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g') + let s:all = '\%(' . s:all . '\)' + " let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + " Reconstruct the version with unresolved backrefs. + let s:patBR = substitute(match_words.',', + \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g') + endif + + " Second step: set the following local variables: + " matchline = line on which the cursor started + " curcol = number of characters before match + " prefix = regexp for start of line to start of match + " suffix = regexp for end of match to end of line + " Require match to end on or after the cursor and prefer it to + " start on or before the cursor. + let matchline = getline(startline) + if a:word != '' + " word given + if a:word !~ s:all + echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE + return s:CleanUp(restore_options, a:mode, startline, startcol) + endif + let matchline = a:word + let curcol = 0 + let prefix = '^\%(' + let suffix = '\)$' + " Now the case when "word" is not given + else " Find the match that ends on or after the cursor and set curcol. + let regexp = s:Wholematch(matchline, s:all, startcol-1) + let curcol = match(matchline, regexp) + " If there is no match, give up. + if curcol == -1 + return s:CleanUp(restore_options, a:mode, startline, startcol) + endif + let endcol = matchend(matchline, regexp) + let suf = strlen(matchline) - endcol + let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(') + let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$') + endif + if exists("b:match_debug") + let b:match_match = matchstr(matchline, regexp) + let b:match_col = curcol+1 + endif + + " Third step: Find the group and single word that match, and the original + " (backref) versions of these. Then, resolve the backrefs. + " Set the following local variable: + " group = colon-separated list of patterns, one of which matches + " = ini:mid:fin or ini:fin + " + " Now, set group and groupBR to the matching group: 'if:endif' or + " 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns + " group . "," . groupBR, and we pick it apart. + let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, s:patBR) + let i = matchend(group, s:notslash . ",") + let groupBR = strpart(group, i) + let group = strpart(group, 0, i-1) + " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix + if s:do_BR " Do the hard part: resolve those backrefs! + let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) + endif + if exists("b:match_debug") + let b:match_wholeBR = groupBR + let i = matchend(groupBR, s:notslash . ":") + let b:match_iniBR = strpart(groupBR, 0, i-1) + endif + + " Fourth step: Set the arguments for searchpair(). + let i = matchend(group, s:notslash . ":") + let j = matchend(group, '.*' . s:notslash . ":") + let ini = strpart(group, 0, i-1) + let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g') + let fin = strpart(group, j) + "Un-escape the remaining , and : characters. + let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + " searchpair() requires that these patterns avoid \(\) groups. + let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g') + let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g') + let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g') + " Set mid. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline =~ prefix . ini . suffix + let mid = "" + endif + " Set flag. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline !~ prefix . ini . suffix + let flag = "bW" + else + let flag = "W" + endif + " Set skip. + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + if exists("b:match_debug") + let b:match_ini = ini + let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin + endif + + " Fifth step: actually start moving the cursor and call searchpair(). + " Later, :execute restore_cursor to get to the original screen. + let restore_cursor = virtcol(".") . "|" + normal! g0 + let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + call cursor(0, curcol + 1) + " normal! 0 + " if curcol + " execute "normal!" . curcol . "l" + " endif + if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) + let skip = "0" + else + execute "if " . skip . "| let skip = '0' | endif" + endif + let sp_return = searchpair(ini, mid, fin, flag, skip) + let final_position = "call cursor(" . line(".") . "," . col(".") . ")" + " Restore cursor position and original screen. + execute restore_cursor + normal! m' + if sp_return > 0 + execute final_position + endif + return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin) +endfun + +" Restore options and do some special handling for Operator-pending mode. +" The optional argument is the tail of the matching group. +fun! s:CleanUp(options, mode, startline, startcol, ...) + if strlen(a:options) + execute "set" a:options + endif + " Open folds, if appropriate. + if a:mode != "o" + if &foldopen =~ "percent" + normal! zv + endif + " In Operator-pending mode, we want to include the whole match + " (for example, d%). + " This is only a problem if we end up moving in the forward direction. + elseif (a:startline < line(".")) || + \ (a:startline == line(".") && a:startcol < col(".")) + if a:0 + " Check whether the match is a single character. If not, move to the + " end of the match. + let matchline = getline(".") + let currcol = col(".") + let regexp = s:Wholematch(matchline, a:1, currcol-1) + let endcol = matchend(matchline, regexp) + if endcol > currcol " This is NOT off by one! + call cursor(0, endcol) + endif + endif " a:0 + endif " a:mode != "o" && etc. + return 0 +endfun + +" Example (simplified HTML patterns): if +" a:groupBR = '<\(\k\+\)>:</\1>' +" a:prefix = '^.\{3}\(' +" a:group = '<\(\k\+\)>:</\(\k\+\)>' +" a:suffix = '\).\{2}$' +" a:matchline = "123<tag>12" or "123</tag>12" +" then extract "tag" from a:matchline and return "<tag>:</tag>" . +fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline) + if a:matchline !~ a:prefix . + \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix + return a:group + endif + let i = matchend(a:groupBR, s:notslash . ':') + let ini = strpart(a:groupBR, 0, i-1) + let tailBR = strpart(a:groupBR, i) + let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix, + \ a:groupBR) + let i = matchend(word, s:notslash . ":") + let wordBR = strpart(word, i) + let word = strpart(word, 0, i-1) + " Now, a:matchline =~ a:prefix . word . a:suffix + if wordBR != ini + let table = s:Resolve(ini, wordBR, "table") + else + " let table = "----------" + let table = "" + let d = 0 + while d < 10 + if tailBR =~ s:notslash . '\\' . d + " let table[d] = d + let table = table . d + else + let table = table . "-" + endif + let d = d + 1 + endwhile + endif + let d = 9 + while d + if table[d] != "-" + let backref = substitute(a:matchline, a:prefix.word.a:suffix, + \ '\'.table[d], "") + " Are there any other characters that should be escaped? + let backref = escape(backref, '*,:') + execute s:Ref(ini, d, "start", "len") + let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) + let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, + \ escape(backref, '\\&'), 'g') + endif + let d = d-1 + endwhile + if exists("b:match_debug") + if s:do_BR + let b:match_table = table + let b:match_word = word + else + let b:match_table = "" + let b:match_word = "" + endif + endif + return ini . ":" . tailBR +endfun + +" Input a comma-separated list of groups with backrefs, such as +" a:groups = '\(foo\):end\1,\(bar\):end\1' +" and return a comma-separated list of groups with backrefs replaced: +" return '\(foo\):end\(foo\),\(bar\):end\(bar\)' +fun! s:ParseWords(groups) + let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g') + let parsed = "" + while groups =~ '[^,:]' + let i = matchend(groups, s:notslash . ':') + let j = matchend(groups, s:notslash . ',') + let ini = strpart(groups, 0, i-1) + let tail = strpart(groups, i, j-i-1) . ":" + let groups = strpart(groups, j) + let parsed = parsed . ini + let i = matchend(tail, s:notslash . ':') + while i != -1 + " In 'if:else:endif', ini='if' and word='else' and then word='endif'. + let word = strpart(tail, 0, i-1) + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . ':') + let parsed = parsed . ":" . s:Resolve(ini, word, "word") + endwhile " Now, tail has been used up. + let parsed = parsed . "," + endwhile " groups =~ '[^,:]' + let parsed = substitute(parsed, ',$', '', '') + return parsed +endfun + +" TODO I think this can be simplified and/or made more efficient. +" TODO What should I do if a:start is out of range? +" Return a regexp that matches all of a:string, such that +" matchstr(a:string, regexp) represents the match for a:pat that starts +" as close to a:start as possible, before being preferred to after, and +" ends after a:start . +" Usage: +" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1) +" let i = match(getline("."), regexp) +" let j = matchend(getline("."), regexp) +" let match = matchstr(getline("."), regexp) +fun! s:Wholematch(string, pat, start) + let group = '\%(' . a:pat . '\)' + let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^') + let len = strlen(a:string) + let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$') + if a:string !~ prefix . group . suffix + let prefix = '' + endif + return prefix . group . suffix +endfun + +" No extra arguments: s:Ref(string, d) will +" find the d'th occurrence of '\(' and return it, along with everything up +" to and including the matching '\)'. +" One argument: s:Ref(string, d, "start") returns the index of the start +" of the d'th '\(' and any other argument returns the length of the group. +" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be +" executed, having the effect of +" :let foo = s:Ref(string, d, "start") +" :let bar = s:Ref(string, d, "len") +fun! s:Ref(string, d, ...) + let len = strlen(a:string) + if a:d == 0 + let start = 0 + else + let cnt = a:d + let match = a:string + while cnt + let cnt = cnt - 1 + let index = matchend(match, s:notslash . '\\(') + if index == -1 + return "" + endif + let match = strpart(match, index) + endwhile + let start = len - strlen(match) + if a:0 == 1 && a:1 == "start" + return start - 2 + endif + let cnt = 1 + while cnt + let index = matchend(match, s:notslash . '\\(\|\\)') - 1 + if index == -2 + return "" + endif + " Increment if an open, decrement if a ')': + let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')' + " let cnt = stridx('0(', match[index]) + cnt + let match = strpart(match, index+1) + endwhile + let start = start - 2 + let len = len - start - strlen(match) + endif + if a:0 == 1 + return len + elseif a:0 == 2 + return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len + else + return strpart(a:string, start, len) + endif +endfun + +" Count the number of disjoint copies of pattern in string. +" If the pattern is a literal string and contains no '0' or '1' characters +" then s:Count(string, pattern, '0', '1') should be faster than +" s:Count(string, pattern). +fun! s:Count(string, pattern, ...) + let pat = escape(a:pattern, '\\') + if a:0 > 1 + let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g") + let foo = substitute(a:string, pat, a:2, "g") + let foo = substitute(foo, '[^' . a:2 . ']', "", "g") + return strlen(foo) + endif + let result = 0 + let foo = a:string + let index = matchend(foo, pat) + while index != -1 + let result = result + 1 + let foo = strpart(foo, index) + let index = matchend(foo, pat) + endwhile + return result +endfun + +" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where +" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first +" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this +" indicates that all other instances of '\1' in target are to be replaced +" by '\3'. The hard part is dealing with nesting... +" Note that ":" is an illegal character for source and target, +" unless it is preceded by "\". +fun! s:Resolve(source, target, output) + let word = a:target + let i = matchend(word, s:notslash . '\\\d') - 1 + let table = "----------" + while i != -2 " There are back references to be replaced. + let d = word[i] + let backref = s:Ref(a:source, d) + " The idea is to replace '\d' with backref. Before we do this, + " replace any \(\) groups in backref with :1, :2, ... if they + " correspond to the first, second, ... group already inserted + " into backref. Later, replace :1 with \1 and so on. The group + " number w+b within backref corresponds to the group number + " s within a:source. + " w = number of '\(' in word before the current one + let w = s:Count( + \ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1') + let b = 1 " number of the current '\(' in backref + let s = d " number of the current '\(' in a:source + while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1') + \ && s < 10 + if table[s] == "-" + if w + b < 10 + " let table[s] = w + b + let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1) + endif + let b = b + 1 + let s = s + 1 + else + execute s:Ref(backref, b, "start", "len") + let ref = strpart(backref, start, len) + let backref = strpart(backref, 0, start) . ":". table[s] + \ . strpart(backref, start+len) + let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1') + endif + endwhile + let word = strpart(word, 0, i-1) . backref . strpart(word, i+1) + let i = matchend(word, s:notslash . '\\\d') - 1 + endwhile + let word = substitute(word, s:notslash . '\zs:', '\\', 'g') + if a:output == "table" + return table + elseif a:output == "word" + return word + else + return table . word + endif +endfun + +" Assume a:comma = ",". Then the format for a:patterns and a:1 is +" a:patterns = "<pat1>,<pat2>,..." +" a:1 = "<alt1>,<alt2>,..." +" If <patn> is the first pattern that matches a:string then return <patn> +" if no optional arguments are given; return <patn>,<altn> if a:1 is given. +fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...) + let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma) + let i = matchend(tail, s:notslash . a:comma) + if a:0 + let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma) + let j = matchend(alttail, s:notslash . a:comma) + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + while a:string !~ a:prefix . currpat . a:suffix + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . a:comma) + if i == -1 + return -1 + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + if a:0 + let alttail = strpart(alttail, j) + let j = matchend(alttail, s:notslash . a:comma) + endif + endwhile + if a:0 + let current = current . a:comma . strpart(alttail, 0, j-1) + endif + return current +endfun + +" Call this function to turn on debugging information. Every time the main +" script is run, buffer variables will be saved. These can be used directly +" or viewed using the menu items below. +if !exists(":MatchDebug") + command! -nargs=0 MatchDebug call s:Match_debug() +endif + +fun! s:Match_debug() + let b:match_debug = 1 " Save debugging information. + " pat = all of b:match_words with backrefs parsed + amenu &Matchit.&pat :echo b:match_pat<CR> + " match = bit of text that is recognized as a match + amenu &Matchit.&match :echo b:match_match<CR> + " curcol = cursor column of the start of the matching text + amenu &Matchit.&curcol :echo b:match_col<CR> + " wholeBR = matching group, original version + amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR> + " iniBR = 'if' piece, original version + amenu &Matchit.ini&BR :echo b:match_iniBR<CR> + " ini = 'if' piece, with all backrefs resolved from match + amenu &Matchit.&ini :echo b:match_ini<CR> + " tail = 'else\|endif' piece, with all backrefs resolved from match + amenu &Matchit.&tail :echo b:match_tail<CR> + " fin = 'endif' piece, with all backrefs resolved from match + amenu &Matchit.&word :echo b:match_word<CR> + " '\'.d in ini refers to the same thing as '\'.table[d] in word. + amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR> +endfun + +" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW" +" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W". +" Return a "mark" for the original position, so that +" let m = MultiMatch("bW", "n") ... execute m +" will return to the original position. If there is a problem, do not +" move the cursor and return "", unless a count is given, in which case +" go up or down as many levels as possible and again return "". +" TODO This relies on the same patterns as % matching. It might be a good +" idea to give it its own matching patterns. +fun! s:MultiMatch(spflag, mode) + if !exists("b:match_words") || b:match_words == "" + return "" + end + let restore_options = "" + if exists("b:match_ignorecase") && b:match_ignorecase != &ic + let restore_options .= (&ic ? " " : " no") . "ignorecase" + let &ignorecase = b:match_ignorecase + endif + let startline = line(".") + let startcol = col(".") + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + " This part is copied and slightly modified from s:Match_wrapper(). + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' + " Allow b:match_words = "GetVimMatchWords()" . + if b:match_words =~ ":" + let match_words = b:match_words + else + execute "let match_words =" b:match_words + endif + if (match_words != s:last_words) || (&mps != s:last_mps) || + \ exists("b:match_debug") + let s:last_words = match_words + let s:last_mps = &mps + let match_words = match_words . (strlen(match_words) ? "," : "") . default + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = '\%(' . substitute(s:pat . (strlen(s:pat) ? "," : "") . default, + \ '[,:]\+', '\\|', 'g') . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + endif + + " Second step: figure out the patterns for searchpair() + " and save the screen, cursor position, and 'ignorecase'. + " - TODO: A lot of this is copied from s:Match_wrapper(). + " - maybe even more functionality should be split off + " - into separate functions! + let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default + let open = substitute(s:pat . cdefault, + \ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g') + let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '') + let close = substitute(s:pat . cdefault, + \ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g') + let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)' + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + " let restore_cursor = line(".") . "G" . virtcol(".") . "|" + " normal! H + " let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + let restore_cursor = virtcol(".") . "|" + normal! g0 + let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + + " Third step: call searchpair(). + " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. + let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') + let openpat = substitute(openpat, ',', '\\|', 'g') + let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') + let closepat = substitute(closepat, ',', '\\|', 'g') + if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) + let skip = '0' + else + execute "if " . skip . "| let skip = '0' | endif" + endif + mark ' + let level = v:count1 + while level + if searchpair(openpat, '', closepat, a:spflag, skip) < 1 + call s:CleanUp(restore_options, a:mode, startline, startcol) + return "" + endif + let level = level - 1 + endwhile + + " Restore options and return a string to restore the original position. + call s:CleanUp(restore_options, a:mode, startline, startcol) + return restore_cursor +endfun + +" Search backwards for "if" or "while" or "<tag>" or ... +" and return "endif" or "endwhile" or "</tag>" or ... . +" For now, this uses b:match_words and the same script variables +" as s:Match_wrapper() . Later, it may get its own patterns, +" either from a buffer variable or passed as arguments. +" fun! s:Autocomplete() +" echo "autocomplete not yet implemented :-(" +" if !exists("b:match_words") || b:match_words == "" +" return "" +" end +" let startpos = s:MultiMatch("bW") +" +" if startpos == "" +" return "" +" endif +" " - TODO: figure out whether 'if' or '<tag>' matched, and construct +" " - the appropriate closing. +" let matchline = getline(".") +" let curcol = col(".") - 1 +" " - TODO: Change the s:all argument if there is a new set of match pats. +" let regexp = s:Wholematch(matchline, s:all, curcol) +" let suf = strlen(matchline) - matchend(matchline, regexp) +" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(') +" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$') +" " Reconstruct the version with unresolved backrefs. +" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g') +" let patBR = substitute(patBR, ':\{2,}', ':', "g") +" " Now, set group and groupBR to the matching group: 'if:endif' or +" " 'while:endwhile' or whatever. +" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) +" let i = matchend(group, s:notslash . ",") +" let groupBR = strpart(group, i) +" let group = strpart(group, 0, i-1) +" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix +" if s:do_BR +" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) +" endif +" " let g:group = group +" +" " - TODO: Construct the closing from group. +" let fake = "end" . expand("<cword>") +" execute startpos +" return fake +" endfun + +" Close all open structures. "Get the heck out of here!" +" fun! s:Gthhoh() +" let close = s:Autocomplete() +" while strlen(close) +" put=close +" let close = s:Autocomplete() +" endwhile +" endfun + +" Parse special strings as typical skip arguments for searchpair(): +" s:foo becomes (current syntax item) =~ foo +" S:foo becomes (current syntax item) !~ foo +" r:foo becomes (line before cursor) =~ foo +" R:foo becomes (line before cursor) !~ foo +fun! s:ParseSkip(str) + let skip = a:str + if skip[1] == ":" + if skip[0] == "s" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "S" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "r" + let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'" + elseif skip[0] == "R" + let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'" + endif + endif + return skip +endfun + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:sts=2:sw=2: diff --git a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim new file mode 100644 index 0000000000..6175d1d9a6 --- /dev/null +++ b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim @@ -0,0 +1,94 @@ +" When you're writing shell scripts and you are in doubt which test to use, +" which shell environment variables are defined, what the syntax of the case +" statement is, and you need to invoke 'man sh'? +" +" Your problems are over now! +" +" Attached is a Vim script file for turning gvim into a shell script editor. +" It may also be used as an example how to use menus in Vim. +" +" Written by: Lennart Schultz <les@dmi.min.dk> + +imenu Stmts.for for in do doneki kk0elli +imenu Stmts.case case in ) ;; esacbki k0elli +imenu Stmts.if if then fiki kk0elli +imenu Stmts.if-else if then else fiki kki kk0elli +imenu Stmts.elif elif then ki kk0elli +imenu Stmts.while while do doneki kk0elli +imenu Stmts.break break +imenu Stmts.continue continue +imenu Stmts.function () { }ki k0i +imenu Stmts.return return +imenu Stmts.return-true return 0 +imenu Stmts.return-false return 1 +imenu Stmts.exit exit +imenu Stmts.shift shift +imenu Stmts.trap trap +imenu Test.existence [ -e ]hi +imenu Test.existence - file [ -f ]hi +imenu Test.existence - file (not empty) [ -s ]hi +imenu Test.existence - directory [ -d ]hi +imenu Test.existence - executable [ -x ]hi +imenu Test.existence - readable [ -r ]hi +imenu Test.existence - writable [ -w ]hi +imenu Test.String is empty [ x = "x$" ]hhi +imenu Test.String is not empty [ x != "x$" ]hhi +imenu Test.Strings is equal [ "" = "" ]hhhhhhhi +imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi +imenu Test.Values is greater than [ -gt ]hhhhhhi +imenu Test.Values is greater equal [ -ge ]hhhhhhi +imenu Test.Values is equal [ -eq ]hhhhhhi +imenu Test.Values is not equal [ -ne ]hhhhhhi +imenu Test.Values is less than [ -lt ]hhhhhhi +imenu Test.Values is less equal [ -le ]hhhhhhi +imenu ParmSub.Substitute word if parm not set ${:-}hhi +imenu ParmSub.Set parm to word if not set ${:=}hhi +imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi +imenu ParmSub.If parm not set print word and exit ${:?}hhi +imenu SpShVars.Number of positional parameters ${#} +imenu SpShVars.All positional parameters (quoted spaces) ${*} +imenu SpShVars.All positional parameters (unquoted spaces) ${@} +imenu SpShVars.Flags set ${-} +imenu SpShVars.Return code of last command ${?} +imenu SpShVars.Process number of this shell ${$} +imenu SpShVars.Process number of last background command ${!} +imenu Environ.HOME ${HOME} +imenu Environ.PATH ${PATH} +imenu Environ.CDPATH ${CDPATH} +imenu Environ.MAIL ${MAIL} +imenu Environ.MAILCHECK ${MAILCHECK} +imenu Environ.PS1 ${PS1} +imenu Environ.PS2 ${PS2} +imenu Environ.IFS ${IFS} +imenu Environ.SHACCT ${SHACCT} +imenu Environ.SHELL ${SHELL} +imenu Environ.LC_CTYPE ${LC_CTYPE} +imenu Environ.LC_MESSAGES ${LC_MESSAGES} +imenu Builtins.cd cd +imenu Builtins.echo echo +imenu Builtins.eval eval +imenu Builtins.exec exec +imenu Builtins.export export +imenu Builtins.getopts getopts +imenu Builtins.hash hash +imenu Builtins.newgrp newgrp +imenu Builtins.pwd pwd +imenu Builtins.read read +imenu Builtins.readonly readonly +imenu Builtins.return return +imenu Builtins.times times +imenu Builtins.type type +imenu Builtins.umask umask +imenu Builtins.wait wait +imenu Set.set set +imenu Set.unset unset +imenu Set.mark modified or modified variables set -a +imenu Set.exit when command returns non-zero exit code set -e +imenu Set.Disable file name generation set -f +imenu Set.remember function commands set -h +imenu Set.All keyword arguments are placed in the environment set -k +imenu Set.Read commands but do not execute them set -n +imenu Set.Exit after reading and executing one command set -t +imenu Set.Treat unset variables as an error when substituting set -u +imenu Set.Print shell input lines as they are read set -v +imenu Set.Print commands and their arguments as they are executed set -x diff --git a/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim b/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim new file mode 100644 index 0000000000..8b85be050b --- /dev/null +++ b/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim @@ -0,0 +1,22 @@ +" These macros swap the left and right mouse buttons (for left handed) +" Don't forget to do ":set mouse=a" or the mouse won't work at all +noremap <LeftMouse> <RightMouse> +noremap <2-LeftMouse> <2-RightMouse> +noremap <3-LeftMouse> <3-RightMouse> +noremap <4-LeftMouse> <4-RightMouse> +noremap <LeftDrag> <RightDrag> +noremap <LeftRelease> <RightRelease> +noremap <RightMouse> <LeftMouse> +noremap <2-RightMouse> <2-LeftMouse> +noremap <3-RightMouse> <3-LeftMouse> +noremap <4-RightMouse> <4-LeftMouse> +noremap <RightDrag> <LeftDrag> +noremap <RightRelease> <LeftRelease> +noremap g<LeftMouse> <C-RightMouse> +noremap g<RightMouse> <C-LeftMouse> +noremap! <LeftMouse> <RightMouse> +noremap! <LeftDrag> <RightDrag> +noremap! <LeftRelease> <RightRelease> +noremap! <RightMouse> <LeftMouse> +noremap! <RightDrag> <LeftDrag> +noremap! <RightRelease> <LeftRelease> diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim new file mode 100644 index 0000000000..a01f3f1c78 --- /dev/null +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -0,0 +1,882 @@ +" Debugger plugin using gdb. +" +" Author: Bram Moolenaar +" Copyright: Vim license applies, see ":help license" +" Last Update: 2018 Jun 3 +" +" WORK IN PROGRESS - Only the basics work +" Note: On MS-Windows you need a recent version of gdb. The one included with +" MingW is too old (7.6.1). +" I used version 7.12 from http://www.equation.com/servlet/equation.cmd?fa=gdb +" +" There are two ways to run gdb: +" - In a terminal window; used if possible, does not work on MS-Windows +" Not used when g:termdebug_use_prompt is set to 1. +" - Using a "prompt" buffer; may use a terminal window for the program +" +" For both the current window is used to view source code and shows the +" current statement from gdb. +" +" USING A TERMINAL WINDOW +" +" Opens two visible terminal windows: +" 1. runs a pty for the debugged program, as with ":term NONE" +" 2. runs gdb, passing the pty of the debugged program +" A third terminal window is hidden, it is used for communication with gdb. +" +" USING A PROMPT BUFFER +" +" Opens a window with a prompt buffer to communicate with gdb. +" Gdb is run as a job with callbacks for I/O. +" On Unix another terminal window is opened to run the debugged program +" On MS-Windows a separate console is opened to run the debugged program +" +" The communication with gdb uses GDB/MI. See: +" https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html + +" In case this gets sourced twice. +if exists(':Termdebug') + finish +endif + +" Need either the +terminal feature or +channel and the prompt buffer. +" The terminal feature does not work with gdb on win32. +if has('terminal') && !has('win32') + let s:way = 'terminal' +elseif has('channel') && exists('*prompt_setprompt') + let s:way = 'prompt' +else + if has('terminal') + let s:err = 'Cannot debug, missing prompt buffer support' + else + let s:err = 'Cannot debug, +channel feature is not supported' + endif + command -nargs=* -complete=file -bang Termdebug echoerr s:err + command -nargs=+ -complete=file -bang TermdebugCommand echoerr s:err + finish +endif + +" The command that starts debugging, e.g. ":Termdebug vim". +" To end type "quit" in the gdb window. +command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, <f-args>) +command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>) + +" Name of the gdb command, defaults to "gdb". +if !exists('termdebugger') + let termdebugger = 'gdb' +endif + +let s:pc_id = 12 +let s:break_id = 13 +let s:stopped = 1 + +if &background == 'light' + hi default debugPC term=reverse ctermbg=lightblue guibg=lightblue +else + hi default debugPC term=reverse ctermbg=darkblue guibg=darkblue +endif +hi default debugBreakpoint term=reverse ctermbg=red guibg=red + +func s:StartDebug(bang, ...) + " First argument is the command to debug, second core file or process ID. + call s:StartDebug_internal({'gdb_args': a:000, 'bang': a:bang}) +endfunc + +func s:StartDebugCommand(bang, ...) + " First argument is the command to debug, rest are run arguments. + call s:StartDebug_internal({'gdb_args': [a:1], 'proc_args': a:000[1:], 'bang': a:bang}) +endfunc + +func s:StartDebug_internal(dict) + if exists('s:gdbwin') + echoerr 'Terminal debugger already running' + return + endif + let s:ptywin = 0 + + " Uncomment this line to write logging in "debuglog". + " call ch_logfile('debuglog', 'w') + + let s:sourcewin = win_getid(winnr()) + let s:startsigncolumn = &signcolumn + + let s:save_columns = 0 + if exists('g:termdebug_wide') + if &columns < g:termdebug_wide + let s:save_columns = &columns + let &columns = g:termdebug_wide + endif + let s:vertical = 1 + else + let s:vertical = 0 + endif + + " Override using a terminal window by setting g:termdebug_use_prompt to 1. + let use_prompt = exists('g:termdebug_use_prompt') && g:termdebug_use_prompt + if has('terminal') && !has('win32') && !use_prompt + let s:way = 'terminal' + else + let s:way = 'prompt' + endif + + if s:way == 'prompt' + call s:StartDebug_prompt(a:dict) + else + call s:StartDebug_term(a:dict) + endif +endfunc + +func s:StartDebug_term(dict) + " Open a terminal window without a job, to run the debugged program in. + let s:ptybuf = term_start('NONE', { + \ 'term_name': 'debugged program', + \ 'vertical': s:vertical, + \ }) + if s:ptybuf == 0 + echoerr 'Failed to open the program terminal window' + return + endif + let pty = job_info(term_getjob(s:ptybuf))['tty_out'] + let s:ptywin = win_getid(winnr()) + if s:vertical + " Assuming the source code window will get a signcolumn, use two more + " columns for that, thus one less for the terminal window. + exe (&columns / 2 - 1) . "wincmd |" + endif + + " Create a hidden terminal window to communicate with gdb + let s:commbuf = term_start('NONE', { + \ 'term_name': 'gdb communication', + \ 'out_cb': function('s:CommOutput'), + \ 'hidden': 1, + \ }) + if s:commbuf == 0 + echoerr 'Failed to open the communication terminal window' + exe 'bwipe! ' . s:ptybuf + return + endif + let commpty = job_info(term_getjob(s:commbuf))['tty_out'] + + " Open a terminal window to run the debugger. + " Add -quiet to avoid the intro message causing a hit-enter prompt. + let gdb_args = get(a:dict, 'gdb_args', []) + let proc_args = get(a:dict, 'proc_args', []) + + let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args + call ch_log('executing "' . join(cmd) . '"') + let s:gdbbuf = term_start(cmd, { + \ 'exit_cb': function('s:EndTermDebug'), + \ 'term_finish': 'close', + \ }) + if s:gdbbuf == 0 + echoerr 'Failed to open the gdb terminal window' + exe 'bwipe! ' . s:ptybuf + exe 'bwipe! ' . s:commbuf + return + endif + let s:gdbwin = win_getid(winnr()) + + " Set arguments to be run + if len(proc_args) + call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r") + endif + + " Connect gdb to the communication pty, using the GDB/MI interface + call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") + + " Wait for the response to show up, users may not notice the error and wonder + " why the debugger doesn't work. + let try_count = 0 + while 1 + let response = '' + for lnum in range(1,200) + if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi ' + let response = term_getline(s:gdbbuf, lnum + 1) + if response =~ 'Undefined command' + echoerr 'Sorry, your gdb is too old, gdb 7.12 is required' + exe 'bwipe! ' . s:ptybuf + exe 'bwipe! ' . s:commbuf + return + endif + if response =~ 'New UI allocated' + " Success! + break + endif + endif + endfor + if response =~ 'New UI allocated' + break + endif + let try_count += 1 + if try_count > 100 + echoerr 'Cannot check if your gdb works, continuing anyway' + break + endif + sleep 10m + endwhile + + " Interpret commands while the target is running. This should usualy only be + " exec-interrupt, since many commands don't work properly while the target is + " running. + call s:SendCommand('-gdb-set mi-async on') + " Older gdb uses a different command. + call s:SendCommand('-gdb-set target-async on') + + " Disable pagination, it causes everything to stop at the gdb + " "Type <return> to continue" prompt. + call s:SendCommand('set pagination off') + + call s:StartDebugCommon(a:dict) +endfunc + +func s:StartDebug_prompt(dict) + " Open a window with a prompt buffer to run gdb in. + if s:vertical + vertical new + else + new + endif + let s:gdbwin = win_getid(winnr()) + let s:promptbuf = bufnr('') + call prompt_setprompt(s:promptbuf, 'gdb> ') + set buftype=prompt + file gdb + call prompt_setcallback(s:promptbuf, function('s:PromptCallback')) + call prompt_setinterrupt(s:promptbuf, function('s:PromptInterrupt')) + + if s:vertical + " Assuming the source code window will get a signcolumn, use two more + " columns for that, thus one less for the terminal window. + exe (&columns / 2 - 1) . "wincmd |" + endif + + " Add -quiet to avoid the intro message causing a hit-enter prompt. + let gdb_args = get(a:dict, 'gdb_args', []) + let proc_args = get(a:dict, 'proc_args', []) + + let cmd = [g:termdebugger, '-quiet', '--interpreter=mi2'] + gdb_args + call ch_log('executing "' . join(cmd) . '"') + + let s:gdbjob = job_start(cmd, { + \ 'exit_cb': function('s:EndPromptDebug'), + \ 'out_cb': function('s:GdbOutCallback'), + \ }) + if job_status(s:gdbjob) != "run" + echoerr 'Failed to start gdb' + exe 'bwipe! ' . s:promptbuf + return + endif + let s:gdb_channel = job_getchannel(s:gdbjob) + + " Interpret commands while the target is running. This should usualy only + " be exec-interrupt, since many commands don't work properly while the + " target is running. + call s:SendCommand('-gdb-set mi-async on') + " Older gdb uses a different command. + call s:SendCommand('-gdb-set target-async on') + + let s:ptybuf = 0 + if has('win32') + " MS-Windows: run in a new console window for maximum compatibility + call s:SendCommand('set new-console on') + elseif has('terminal') + " Unix: Run the debugged program in a terminal window. Open it below the + " gdb window. + belowright let s:ptybuf = term_start('NONE', { + \ 'term_name': 'debugged program', + \ }) + if s:ptybuf == 0 + echoerr 'Failed to open the program terminal window' + call job_stop(s:gdbjob) + return + endif + let s:ptywin = win_getid(winnr()) + let pty = job_info(term_getjob(s:ptybuf))['tty_out'] + call s:SendCommand('tty ' . pty) + + " Since GDB runs in a prompt window, the environment has not been set to + " match a terminal window, need to do that now. + call s:SendCommand('set env TERM = xterm-color') + call s:SendCommand('set env ROWS = ' . winheight(s:ptywin)) + call s:SendCommand('set env LINES = ' . winheight(s:ptywin)) + call s:SendCommand('set env COLUMNS = ' . winwidth(s:ptywin)) + call s:SendCommand('set env COLORS = ' . &t_Co) + call s:SendCommand('set env VIM_TERMINAL = ' . v:version) + else + " TODO: open a new terminal get get the tty name, pass on to gdb + call s:SendCommand('show inferior-tty') + endif + call s:SendCommand('set print pretty on') + call s:SendCommand('set breakpoint pending on') + " Disable pagination, it causes everything to stop at the gdb + call s:SendCommand('set pagination off') + + " Set arguments to be run + if len(proc_args) + call s:SendCommand('set args ' . join(proc_args)) + endif + + call s:StartDebugCommon(a:dict) + startinsert +endfunc + +func s:StartDebugCommon(dict) + " Sign used to highlight the line where the program has stopped. + " There can be only one. + sign define debugPC linehl=debugPC + + " Sign used to indicate a breakpoint. + " Can be used multiple times. + sign define debugBreakpoint text=>> texthl=debugBreakpoint + + " Install debugger commands in the text window. + call win_gotoid(s:sourcewin) + call s:InstallCommands() + call win_gotoid(s:gdbwin) + + " Enable showing a balloon with eval info + if has("balloon_eval") || has("balloon_eval_term") + set balloonexpr=TermDebugBalloonExpr() + if has("balloon_eval") + set ballooneval + endif + if has("balloon_eval_term") + set balloonevalterm + endif + endif + + let s:breakpoints = {} + + augroup TermDebug + au BufRead * call s:BufRead() + au BufUnload * call s:BufUnloaded() + augroup END + + " Run the command if the bang attribute was given and got to the debug + " window. + if get(a:dict, 'bang', 0) + call s:SendCommand('-exec-run') + call win_gotoid(s:ptywin) + endif +endfunc + +" Send a command to gdb. "cmd" is the string without line terminator. +func s:SendCommand(cmd) + call ch_log('sending to gdb: ' . a:cmd) + if s:way == 'prompt' + call ch_sendraw(s:gdb_channel, a:cmd . "\n") + else + call term_sendkeys(s:commbuf, a:cmd . "\r") + endif +endfunc + +" This is global so that a user can create their mappings with this. +func TermDebugSendCommand(cmd) + if s:way == 'prompt' + call ch_sendraw(s:gdb_channel, a:cmd . "\n") + else + let do_continue = 0 + if !s:stopped + let do_continue = 1 + call s:SendCommand('-exec-interrupt') + sleep 10m + endif + call term_sendkeys(s:gdbbuf, a:cmd . "\r") + if do_continue + Continue + endif + endif +endfunc + +" Function called when entering a line in the prompt buffer. +func s:PromptCallback(text) + call s:SendCommand(a:text) +endfunc + +" Function called when pressing CTRL-C in the prompt buffer. +func s:PromptInterrupt() + call ch_log('Interrupting gdb') + call job_stop(s:gdbjob, 'int') +endfunc + +" Function called when gdb outputs text. +func s:GdbOutCallback(channel, text) + call ch_log('received from gdb: ' . a:text) + + " Drop the gdb prompt, we have our own. + " Drop status and echo'd commands. + if a:text == '(gdb) ' || a:text == '^done' || a:text[0] == '&' || a:text[0] == '=' + return + endif + if a:text =~ '^^error,msg=' + let text = s:DecodeMessage(a:text[11:]) + if exists('s:evalexpr') && text =~ 'A syntax error in expression, near\|No symbol .* in current context' + " Silently drop evaluation errors. + unlet s:evalexpr + return + endif + elseif a:text[0] == '~' + let text = s:DecodeMessage(a:text[1:]) + else + call s:CommOutput(a:channel, a:text) + return + endif + + let curwinid = win_getid(winnr()) + call win_gotoid(s:gdbwin) + + " Add the output above the current prompt. + call append(line('$') - 1, text) + set nomodified + + call win_gotoid(curwinid) +endfunc + +" Decode a message from gdb. quotedText starts with a ", return the text up +" to the next ", unescaping characters. +func s:DecodeMessage(quotedText) + if a:quotedText[0] != '"' + echoerr 'DecodeMessage(): missing quote' + return + endif + let result = '' + let i = 1 + while a:quotedText[i] != '"' && i < len(a:quotedText) + if a:quotedText[i] == '\' + let i += 1 + if a:quotedText[i] == 'n' + " drop \n + let i += 1 + continue + endif + endif + let result .= a:quotedText[i] + let i += 1 + endwhile + return result +endfunc + +func s:EndTermDebug(job, status) + exe 'bwipe! ' . s:commbuf + unlet s:gdbwin + + call s:EndDebugCommon() +endfunc + +func s:EndDebugCommon() + let curwinid = win_getid(winnr()) + + if exists('s:ptybuf') && s:ptybuf + exe 'bwipe! ' . s:ptybuf + endif + + call win_gotoid(s:sourcewin) + let &signcolumn = s:startsigncolumn + call s:DeleteCommands() + + call win_gotoid(curwinid) + + if s:save_columns > 0 + let &columns = s:save_columns + endif + + if has("balloon_eval") || has("balloon_eval_term") + set balloonexpr= + if has("balloon_eval") + set noballooneval + endif + if has("balloon_eval_term") + set noballoonevalterm + endif + endif + + au! TermDebug +endfunc + +func s:EndPromptDebug(job, status) + let curwinid = win_getid(winnr()) + call win_gotoid(s:gdbwin) + close + if curwinid != s:gdbwin + call win_gotoid(curwinid) + endif + + call s:EndDebugCommon() + unlet s:gdbwin + call ch_log("Returning from EndPromptDebug()") +endfunc + +" Handle a message received from gdb on the GDB/MI interface. +func s:CommOutput(chan, msg) + let msgs = split(a:msg, "\r") + + for msg in msgs + " remove prefixed NL + if msg[0] == "\n" + let msg = msg[1:] + endif + if msg != '' + if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)' + call s:HandleCursor(msg) + elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,' + call s:HandleNewBreakpoint(msg) + elseif msg =~ '^=breakpoint-deleted,' + call s:HandleBreakpointDelete(msg) + elseif msg =~ '^\^done,value=' + call s:HandleEvaluate(msg) + elseif msg =~ '^\^error,msg=' + call s:HandleError(msg) + endif + endif + endfor +endfunc + +" Install commands in the current window to control the debugger. +func s:InstallCommands() + command Break call s:SetBreakpoint() + command Clear call s:ClearBreakpoint() + command Step call s:SendCommand('-exec-step') + command Over call s:SendCommand('-exec-next') + command Finish call s:SendCommand('-exec-finish') + command -nargs=* Run call s:Run(<q-args>) + command -nargs=* Arguments call s:SendCommand('-exec-arguments ' . <q-args>) + command Stop call s:SendCommand('-exec-interrupt') + + " using -exec-continue results in CTRL-C in gdb window not working + if s:way == 'prompt' + command Continue call s:SendCommand('continue') + else + command Continue call term_sendkeys(s:gdbbuf, "continue\r") + endif + + command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>) + command Gdb call win_gotoid(s:gdbwin) + command Program call win_gotoid(s:ptywin) + command Source call s:GotoSourcewinOrCreateIt() + command Winbar call s:InstallWinbar() + + " TODO: can the K mapping be restored? + nnoremap K :Evaluate<CR> + + if has('menu') && &mouse != '' + call s:InstallWinbar() + + if !exists('g:termdebug_popup') || g:termdebug_popup != 0 + let s:saved_mousemodel = &mousemodel + let &mousemodel = 'popup_setpos' + an 1.200 PopUp.-SEP3- <Nop> + an 1.210 PopUp.Set\ breakpoint :Break<CR> + an 1.220 PopUp.Clear\ breakpoint :Clear<CR> + an 1.230 PopUp.Evaluate :Evaluate<CR> + endif + endif +endfunc + +let s:winbar_winids = [] + +" Install the window toolbar in the current window. +func s:InstallWinbar() + if has('menu') && &mouse != '' + nnoremenu WinBar.Step :Step<CR> + nnoremenu WinBar.Next :Over<CR> + nnoremenu WinBar.Finish :Finish<CR> + nnoremenu WinBar.Cont :Continue<CR> + nnoremenu WinBar.Stop :Stop<CR> + nnoremenu WinBar.Eval :Evaluate<CR> + call add(s:winbar_winids, win_getid(winnr())) + endif +endfunc + +" Delete installed debugger commands in the current window. +func s:DeleteCommands() + delcommand Break + delcommand Clear + delcommand Step + delcommand Over + delcommand Finish + delcommand Run + delcommand Arguments + delcommand Stop + delcommand Continue + delcommand Evaluate + delcommand Gdb + delcommand Program + delcommand Source + delcommand Winbar + + nunmap K + + if has('menu') + " Remove the WinBar entries from all windows where it was added. + let curwinid = win_getid(winnr()) + for winid in s:winbar_winids + if win_gotoid(winid) + aunmenu WinBar.Step + aunmenu WinBar.Next + aunmenu WinBar.Finish + aunmenu WinBar.Cont + aunmenu WinBar.Stop + aunmenu WinBar.Eval + endif + endfor + call win_gotoid(curwinid) + let s:winbar_winids = [] + + if exists('s:saved_mousemodel') + let &mousemodel = s:saved_mousemodel + unlet s:saved_mousemodel + aunmenu PopUp.-SEP3- + aunmenu PopUp.Set\ breakpoint + aunmenu PopUp.Clear\ breakpoint + aunmenu PopUp.Evaluate + endif + endif + + exe 'sign unplace ' . s:pc_id + for key in keys(s:breakpoints) + exe 'sign unplace ' . (s:break_id + key) + endfor + sign undefine debugPC + sign undefine debugBreakpoint + unlet s:breakpoints +endfunc + +" :Break - Set a breakpoint at the cursor position. +func s:SetBreakpoint() + " Setting a breakpoint may not work while the program is running. + " Interrupt to make it work. + let do_continue = 0 + if !s:stopped + let do_continue = 1 + if s:way == 'prompt' + " Need to send a signal to get the UI to listen. Strangely this is only + " needed once. + call job_stop(s:gdbjob, 'int') + else + call s:SendCommand('-exec-interrupt') + endif + sleep 10m + endif + call s:SendCommand('-break-insert --source ' + \ . fnameescape(expand('%:p')) . ' --line ' . line('.')) + if do_continue + call s:SendCommand('-exec-continue') + endif +endfunc + +" :Clear - Delete a breakpoint at the cursor position. +func s:ClearBreakpoint() + let fname = fnameescape(expand('%:p')) + let lnum = line('.') + for [key, val] in items(s:breakpoints) + if val['fname'] == fname && val['lnum'] == lnum + call s:SendCommand('-break-delete ' . key) + " Assume this always wors, the reply is simply "^done". + exe 'sign unplace ' . (s:break_id + key) + unlet s:breakpoints[key] + break + endif + endfor +endfunc + +func s:Run(args) + if a:args != '' + call s:SendCommand('-exec-arguments ' . a:args) + endif + call s:SendCommand('-exec-run') +endfunc + +func s:SendEval(expr) + call s:SendCommand('-data-evaluate-expression "' . a:expr . '"') + let s:evalexpr = a:expr +endfunc + +" :Evaluate - evaluate what is under the cursor +func s:Evaluate(range, arg) + if a:arg != '' + let expr = a:arg + elseif a:range == 2 + let pos = getcurpos() + let reg = getreg('v', 1, 1) + let regt = getregtype('v') + normal! gv"vy + let expr = @v + call setpos('.', pos) + call setreg('v', reg, regt) + else + let expr = expand('<cexpr>') + endif + let s:ignoreEvalError = 0 + call s:SendEval(expr) +endfunc + +let s:ignoreEvalError = 0 +let s:evalFromBalloonExpr = 0 + +" Handle the result of data-evaluate-expression +func s:HandleEvaluate(msg) + let value = substitute(a:msg, '.*value="\(.*\)"', '\1', '') + let value = substitute(value, '\\"', '"', 'g') + if s:evalFromBalloonExpr + if s:evalFromBalloonExprResult == '' + let s:evalFromBalloonExprResult = s:evalexpr . ': ' . value + else + let s:evalFromBalloonExprResult .= ' = ' . value + endif + call balloon_show(s:evalFromBalloonExprResult) + else + echomsg '"' . s:evalexpr . '": ' . value + endif + + if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$' + " Looks like a pointer, also display what it points to. + let s:ignoreEvalError = 1 + call s:SendEval('*' . s:evalexpr) + else + let s:evalFromBalloonExpr = 0 + endif +endfunc + +" Show a balloon with information of the variable under the mouse pointer, +" if there is any. +func TermDebugBalloonExpr() + if v:beval_winid != s:sourcewin + return + endif + if !s:stopped + " Only evaluate when stopped, otherwise setting a breakpoint using the + " mouse triggers a balloon. + return + endif + let s:evalFromBalloonExpr = 1 + let s:evalFromBalloonExprResult = '' + let s:ignoreEvalError = 1 + call s:SendEval(v:beval_text) + return '' +endfunc + +" Handle an error. +func s:HandleError(msg) + if s:ignoreEvalError + " Result of s:SendEval() failed, ignore. + let s:ignoreEvalError = 0 + let s:evalFromBalloonExpr = 0 + return + endif + echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '') +endfunc + +func s:GotoSourcewinOrCreateIt() + if !win_gotoid(s:sourcewin) + new + let s:sourcewin = win_getid(winnr()) + call s:InstallWinbar() + endif +endfunc + +" Handle stopping and running message from gdb. +" Will update the sign that shows the current position. +func s:HandleCursor(msg) + let wid = win_getid(winnr()) + + if a:msg =~ '^\*stopped' + let s:stopped = 1 + elseif a:msg =~ '^\*running' + let s:stopped = 0 + endif + + call s:GotoSourcewinOrCreateIt() + + let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') + if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) + let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') + if lnum =~ '^[0-9]*$' + if expand('%:p') != fnamemodify(fname, ':p') + if &modified + " TODO: find existing window + exe 'split ' . fnameescape(fname) + let s:sourcewin = win_getid(winnr()) + call s:InstallWinbar() + else + exe 'edit ' . fnameescape(fname) + endif + endif + exe lnum + exe 'sign unplace ' . s:pc_id + exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname + setlocal signcolumn=yes + endif + else + exe 'sign unplace ' . s:pc_id + endif + + call win_gotoid(wid) +endfunc + +" Handle setting a breakpoint +" Will update the sign that shows the breakpoint +func s:HandleNewBreakpoint(msg) + let nr = substitute(a:msg, '.*number="\([0-9]\)*\".*', '\1', '') + 0 + if nr == 0 + return + endif + + if has_key(s:breakpoints, nr) + let entry = s:breakpoints[nr] + else + let entry = {} + let s:breakpoints[nr] = entry + endif + + let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') + let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') + let entry['fname'] = fname + let entry['lnum'] = lnum + + if bufloaded(fname) + call s:PlaceSign(nr, entry) + endif +endfunc + +func s:PlaceSign(nr, entry) + exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint file=' . a:entry['fname'] + let a:entry['placed'] = 1 +endfunc + +" Handle deleting a breakpoint +" Will remove the sign that shows the breakpoint +func s:HandleBreakpointDelete(msg) + let nr = substitute(a:msg, '.*id="\([0-9]*\)\".*', '\1', '') + 0 + if nr == 0 + return + endif + if has_key(s:breakpoints, nr) + let entry = s:breakpoints[nr] + if has_key(entry, 'placed') + exe 'sign unplace ' . (s:break_id + nr) + unlet entry['placed'] + endif + unlet s:breakpoints[nr] + endif +endfunc + +" Handle a BufRead autocommand event: place any signs. +func s:BufRead() + let fname = expand('<afile>:p') + for [nr, entry] in items(s:breakpoints) + if entry['fname'] == fname + call s:PlaceSign(nr, entry) + endif + endfor +endfunc + +" Handle a BufUnloaded autocommand event: unplace any signs. +func s:BufUnloaded() + let fname = expand('<afile>:p') + for [nr, entry] in items(s:breakpoints) + if entry['fname'] == fname + let entry['placed'] = 0 + endif + endfor +endfunc + diff --git a/runtime/plugin/README.txt b/runtime/plugin/README.txt index 37e22e57c0..68f285e1cd 100644 --- a/runtime/plugin/README.txt +++ b/runtime/plugin/README.txt @@ -5,6 +5,7 @@ Look in the file for hints on how it can be disabled without deleting it. getscriptPlugin.vim get latest version of Vim scripts gzip.vim edit compressed files +logiPat.vim logical operators on patterns matchparen.vim highlight paren matching the one under the cursor netrwPlugin.vim edit files over a network and browse (remote) directories rrhelper.vim used for --remote-wait editing diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim index edef149537..5e13b92d1e 100644 --- a/runtime/plugin/gzip.vim +++ b/runtime/plugin/gzip.vim @@ -1,6 +1,6 @@ " Vim plugin for editing compressed files. " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2010 Mar 10 +" Last Change: 2016 Oct 30 " Exit quickly when: " - this plugin was already loaded @@ -20,25 +20,33 @@ augroup gzip " " Set binary mode before reading the file. " Use "gzip -d", gunzip isn't always available. - autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz setlocal bin + autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz,*.zst setlocal bin autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") autocmd BufReadPost,FileReadPost *.lzma call gzip#read("lzma -d") autocmd BufReadPost,FileReadPost *.xz call gzip#read("xz -d") + autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d") + autocmd BufReadPost,FileReadPost *.zst call gzip#read("zstd -d --rm") autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") autocmd BufWritePost,FileWritePost *.lzma call gzip#write("lzma -z") autocmd BufWritePost,FileWritePost *.xz call gzip#write("xz -z") + autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip") + autocmd BufWritePost,FileWritePost *.zst call gzip#write("zstd --rm") autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") autocmd FileAppendPre *.Z call gzip#appre("uncompress") autocmd FileAppendPre *.lzma call gzip#appre("lzma -d") autocmd FileAppendPre *.xz call gzip#appre("xz -d") + autocmd FileAppendPre *.lz call gzip#appre("lzip -d") + autocmd FileAppendPre *.zst call gzip#appre("zstd -d --rm") autocmd FileAppendPost *.gz call gzip#write("gzip") autocmd FileAppendPost *.bz2 call gzip#write("bzip2") autocmd FileAppendPost *.Z call gzip#write("compress -f") autocmd FileAppendPost *.lzma call gzip#write("lzma -z") autocmd FileAppendPost *.xz call gzip#write("xz -z") + autocmd FileAppendPost *.lz call gzip#write("lzip") + autocmd FileAppendPost *.zst call gzip#write("zstd --rm") augroup END diff --git a/runtime/plugin/logiPat.vim b/runtime/plugin/logiPat.vim new file mode 100644 index 0000000000..47fabe954d --- /dev/null +++ b/runtime/plugin/logiPat.vim @@ -0,0 +1,339 @@ +" LogiPat: Boolean logical pattern matcher +" Author: Charles E. Campbell +" Date: Apr 04, 2016 +" Version: 4 +" Purpose: to do Boolean-logic based regular expression pattern matching +" Copyright: Copyright (C) 1999-2011 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like most anything else that's free, +" LogiPat.vim is provided *as is* and comes with no warranty +" of any kind, either expressed or implied. By using this +" plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. +" +" Usage: {{{1 +" :LogiPat ... +" +" Boolean logic supported: +" () grouping operators +" ! not the following pattern +" | logical or +" & logical and +" "..pattern.." +" Example: {{{1 +" :LogiPat !("january"|"february") +" would match all strings not containing the strings january +" or february +" GetLatestVimScripts: 1290 1 :AutoInstall: LogiPat.vim +" +" Behold, you will conceive in your womb, and bring forth a son, {{{1 +" and will call his name Jesus. He will be great, and will be +" called the Son of the Most High. The Lord God will give him the +" throne of his father, David, and he will reign over the house of +" Jacob forever. There will be no end to his kingdom. (Luke 1:31-33 WEB) + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("loaded_logiPat") + finish +endif +let g:loaded_logiPat = "v4" +let s:keepcpo = &cpo +set cpo&vim +"DechoRemOn + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=* LogiPat call LogiPat(<q-args>,1) +sil! com -nargs=* LP call LogiPat(<q-args>,1) +sil! com -nargs=* LPR call LogiPat(<q-args>,1,"r") +com! -nargs=+ LPE echomsg LogiPat(<q-args>) +com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>" +sil! com -nargs=+ LPF let s:LogiPatFlags="<args>" + +" ===================================================================== +" Functions: {{{1 + +" --------------------------------------------------------------------- +" LogiPat: this function interprets the boolean-logic pattern {{{2 +fun! LogiPat(pat,...) +" call Dfunc("LogiPat(pat<".a:pat.">)") + + " LogiPat(pat,dosearch) + if a:0 > 0 + let dosearch= a:1 + else + let dosearch= 0 + endif + if a:0 >= 3 + let s:LogiPatFlags= a:3 + endif + + let s:npatstack = 0 + let s:nopstack = 0 + let s:preclvl = 0 + let expr = a:pat + + " Lexer/Parser + while expr != "" +" call Decho("expr<".expr.">") + + if expr =~ '^"' + " push a Pattern; accept "" as a single " in the pattern + let expr = substitute(expr,'^\s*"','','') + let pat = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\1','') + let pat = substitute(pat,'""','"','g') + let expr = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\2','') + let expr = substitute(expr,'^\s*','','') +" call Decho("pat<".pat."> expr<".expr.">") + + call s:LP_PatPush('.*'.pat.'.*') + + elseif expr =~ '^[!()|&]' + " push an operator + let op = strpart(expr,0,1) + let expr = strpart(expr,strlen(op)) + " allow for those who can't resist doubling their and/or operators + if op =~ '[|&]' && expr[0] == op + let expr = strpart(expr,strlen(op)) + endif + call s:LP_OpPush(op) + + elseif expr =~ '^\s' + " skip whitespace + let expr= strpart(expr,1) + + else + echoerr "operator<".strpart(expr,0,1)."> not supported (yet)" + let expr= strpart(expr,1) + endif + + endwhile + + " Final Execution + call s:LP_OpPush('Z') + + let result= s:LP_PatPop(1) +" call Decho("result=".result) + + " sanity checks and cleanup + if s:npatstack > 0 + echoerr s:npatstack." patterns left on stack!" + let s:npatstack= 0 + endif + if s:nopstack > 0 + echoerr s:nopstack." operators left on stack!" + let s:nopstack= 0 + endif + + " perform the indicated search + if dosearch + if exists("s:LogiPatFlags") && s:LogiPatFlags != "" +" call Decho("search(result<".result."> LogiPatFlags<".s:LogiPatFlags.">)") + call search(result,s:LogiPatFlags) + else +" call Decho("search(result<".result.">)") + call search(result) + endif + let @/= result + endif + +" call Dret("LogiPat ".result) + return result +endfun + +" --------------------------------------------------------------------- +" s:String: Vim6.4 doesn't have string() {{{2 +func! s:String(str) + return "'".escape(a:str, '"')."'" +endfunc + +" --------------------------------------------------------------------- +" LP_PatPush: {{{2 +fun! s:LP_PatPush(pat) +" call Dfunc("LP_PatPush(pat<".a:pat.">)") + let s:npatstack = s:npatstack + 1 + let s:patstack_{s:npatstack} = a:pat +" call s:StackLook("patpush") "Decho +" call Dret("LP_PatPush : npatstack=".s:npatstack) +endfun + +" --------------------------------------------------------------------- +" LP_PatPop: pop a number/variable from LogiPat's pattern stack {{{2 +fun! s:LP_PatPop(lookup) +" call Dfunc("LP_PatPop(lookup=".a:lookup.")") + if s:npatstack > 0 + let ret = s:patstack_{s:npatstack} + let s:npatstack = s:npatstack - 1 + else + let ret= "---error---" + echoerr "(LogiPat) invalid expression" + endif +" call s:StackLook("patpop") "Decho +" call Dret("LP_PatPop ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_OpPush: {{{2 +fun! s:LP_OpPush(op) +" call Dfunc("LP_OpPush(op<".a:op.">)") + + " determine new operator's precedence level + if a:op == '(' + let s:preclvl= s:preclvl + 10 + let preclvl = s:preclvl + elseif a:op == ')' + let s:preclvl= s:preclvl - 10 + if s:preclvl < 0 + let s:preclvl= 0 + echoerr "too many )s" + endif + let preclvl= s:preclvl + elseif a:op =~ '|' + let preclvl= s:preclvl + 2 + elseif a:op =~ '&' + let preclvl= s:preclvl + 4 + elseif a:op == '!' + let preclvl= s:preclvl + 6 + elseif a:op == 'Z' + let preclvl= -1 + else + echoerr "expr<".expr."> not supported (yet)" + let preclvl= s:preclvl + endif +" call Decho("new operator<".a:op."> preclvl=".preclvl) + + " execute higher-precdence operators +" call Decho("execute higher-precedence operators") + call s:LP_Execute(preclvl) + + " push new operator onto operator-stack +" call Decho("push new operator<".a:op."> onto stack with preclvl=".preclvl." at nopstack=".(s:nopstack+1)) + if a:op =~ '!' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + elseif a:op =~ '|' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + elseif a:op == '&' + let s:nopstack = s:nopstack + 1 + let s:opprec_{s:nopstack} = preclvl + let s:opstack_{s:nopstack} = a:op + endif + +" call s:StackLook("oppush") "Decho +" call Dret("LP_OpPush : s:preclvl=".s:preclvl) +endfun + +" --------------------------------------------------------------------- +" LP_Execute: execute operators from opstack using pattern stack {{{2 +fun! s:LP_Execute(preclvl) +" call Dfunc("LP_Execute(preclvl=".a:preclvl.") npatstack=".s:npatstack." nopstack=".s:nopstack) + + " execute all higher precedence operators + while s:nopstack > 0 && a:preclvl < s:opprec_{s:nopstack} + let op= s:opstack_{s:nopstack} +" call Decho("op<".op."> nop=".s:nopstack." [preclvl=".a:preclvl."] < [opprec_".s:nopstack."=".s:opprec_{s:nopstack}."]") + + let s:nopstack = s:nopstack - 1 + + if op == '!' + let n1= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_Not(n1)) + + elseif op == '|' + let n1= s:LP_PatPop(1) + let n2= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_Or(n2,n1)) + + elseif op =~ '&' + let n1= s:LP_PatPop(1) + let n2= s:LP_PatPop(1) + call s:LP_PatPush(s:LP_And(n2,n1)) + endif + +" call s:StackLook("execute") "Decho + endwhile + +" call Dret("LP_Execute") +endfun + +" --------------------------------------------------------------------- +" LP_Not: writes a logical-not for a pattern {{{2 +fun! s:LP_Not(pat) +" call Dfunc("LP_Not(pat<".a:pat.">)") + if a:pat =~ '^\.\*' && a:pat =~ '\.\*$' + let pat= substitute(a:pat,'^\.\*\(.*\)\.\*$','\1','') + let ret= '^\%(\%('.pat.'\)\@!.\)*$' + else + let ret= '^\%(\%('.a:pat.'\)\@!.\)*$' + endif +" call Dret("LP_Not ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_Or: writes a logical-or branch using two patterns {{{2 +fun! s:LP_Or(pat1,pat2) +" call Dfunc("LP_Or(pat1<".a:pat1."> pat2<".a:pat2.">)") + let ret= '\%('.a:pat1.'\|'.a:pat2.'\)' +" call Dret("LP_Or ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" LP_And: writes a logical-and concat using two patterns {{{2 +fun! s:LP_And(pat1,pat2) +" call Dfunc("LP_And(pat1<".a:pat1."> pat2<".a:pat2.">)") + let ret= '\%('.a:pat1.'\&'.a:pat2.'\)' +" call Dret("LP_And ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" StackLook: {{{2 +fun! s:StackLook(description) +" call Dfunc("StackLook(description<".a:description.">)") + let iop = 1 + let ifp = 1 +" call Decho("Pattern Operator") + + " print both pattern and operator + while ifp <= s:npatstack && iop <= s:nopstack + let fp = s:patstack_{ifp} + let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')' + let fplen= strlen(fp) + if fplen < 30 + let fp= fp.strpart(" ",1,30-fplen) + endif +" call Decho(fp.op) + let ifp = ifp + 1 + let iop = iop + 1 + endwhile + + " print just pattern + while ifp <= s:npatstack + let fp = s:patstack_{ifp} +" call Decho(fp) + let ifp = ifp + 1 + endwhile + + " print just operator + while iop <= s:nopstack + let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')' +" call Decho(" ".op) + let iop = iop + 1 + endwhile +" call Dret("StackLook") +endfun + +" --------------------------------------------------------------------- +" Cleanup And Modeline: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" vim: ts=4 fdm=marker diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim new file mode 100644 index 0000000000..dd0d1e8bce --- /dev/null +++ b/runtime/plugin/manpager.vim @@ -0,0 +1,30 @@ +" Vim plugin for using Vim as manpager. +" Maintainer: Enno Nagel <ennonagel+vim@gmail.com> +" Last Change: 2018 Feb 04 + +command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER + +function! s:ManPager() + set nocompatible + if exists('+viminfofile') + set viminfofile=NONE + endif + set noswapfile + + setlocal ft=man + runtime ftplugin/man.vim + setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable + + " Emulate 'col -b' + silent keepj keepp %s/\v(.)\b\ze\1?//ge + + " Remove empty lines above the header + call cursor(1, 1) + let n = search(".*(.*)", "c") + if n > 1 + exe "1," . n-1 . "d" + endif + setlocal nomodified readonly + + syntax on +endfunction diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 817ce62b28..4f68fd87bc 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jul 19 +" Last Change: 2017 Sep 30 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -55,14 +55,19 @@ function! s:Highlight_Matching_Pair() let before = 0 let text = getline(c_lnum) - let c = text[c_col - 1] + let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)') + if empty(matches) + let [c_before, c] = ['', ''] + else + let [c_before, c] = matches[1:2] + endif let plist = split(&matchpairs, '.\zs[:,]') let i = index(plist, c) if i < 0 " not found, in Insert mode try character before the cursor if c_col > 1 && (mode() == 'i' || mode() == 'R') - let before = 1 - let c = text[c_col - 2] + let before = strlen(c_before) + let c = c_before let i = index(plist, c) endif if i < 0 @@ -98,10 +103,17 @@ function! s:Highlight_Matching_Pair() call cursor(c_lnum, c_col - before) endif - " When not in a string or comment ignore matches inside them. + " Build an expression that detects whether the current cursor position is in + " certain syntax types (string, comment, etc.), for use as searchpairpos()'s + " skip argument. " We match "escape" for special items, such as lispEscapeSpecial. - let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"' + let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' . + \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))' + " If executing the expression determines that the cursor is currently in + " one of the syntax types, then we want searchpairpos() to find the pair + " within those syntax types (i.e., not skip). Otherwise, the cursor is + " outside of the syntax types and s_skip should keep its value so we skip any + " matching pair inside the syntax types. execute 'if' s_skip '| let s_skip = 0 | endif' " Limit the search to lines visible in the window. @@ -174,9 +186,23 @@ function! s:Highlight_Matching_Pair() endfunction " Define commands that will disable and enable the plugin. -command! NoMatchParen windo silent! call matchdelete(3) | unlet! g:loaded_matchparen | - \ au! matchparen -command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved +command! DoMatchParen call s:DoMatchParen() +command! NoMatchParen call s:NoMatchParen() + +func! s:NoMatchParen() + let w = winnr() + noau windo silent! call matchdelete(3) + unlet! g:loaded_matchparen + exe "noau ". w . "wincmd w" + au! matchparen +endfunc + +func! s:DoMatchParen() + runtime plugin/matchparen.vim + let w = winnr() + silent windo doau CursorMoved + exe "noau ". w . "wincmd w" +endfunc let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index e3e79ddea8..28e1c3ecf8 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,6 +1,6 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION -" Date: Jan 22, 2014 +" Date: Feb 08, 2016 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 @@ -20,19 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v152" -if v:version < 702 - echohl WarningMsg - echo "***warning*** you need vim version 7.2 for this version of netrw" - echohl None - finish -endif -if v:version < 703 || (v:version == 703 && !has("patch465")) - echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.3.465 or later" - echohl Normal - finish -endif +let g:loaded_netrwPlugin = "v156" let s:keepcpo = &cpo set cpo&vim "DechoRemOn @@ -54,23 +42,23 @@ augroup END " Network Browsing Reading Writing: {{{2 augroup Network au! - au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>")) - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) - au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) - au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) - try - au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) - catch /^Vim\%((\a\+)\)\=:E216/ - au SourcePre ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) + au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) + au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) + au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) + try + au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) + catch /^Vim\%((\a\+)\)\=:E216/ + au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) endtry augroup END " Commands: :Nread, :Nwrite, :NetUserPass {{{2 -com! -count=1 -nargs=* Nread call netrw#SavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#RestorePosn() -com! -range=% -nargs=* Nwrite call netrw#SavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#RestorePosn() +com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos) +com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos) com! -nargs=* NetUserPass call NetUserPass(<f-args>) -com! -nargs=* Nsource call netrw#SavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#RestorePosn() +com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos) com! -nargs=? Ntree call netrw#SetTreetop(<q-args>) " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2 @@ -81,18 +69,32 @@ com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<cou com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>) com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>) com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>) -com! -nargs=* -bar -complete=dir Lexplore call netrw#Lexplore(<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(<count>,<bang>0,<q-args>) " Commands: NetrwSettings {{{2 com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings() com! -bang NetrwClean call netrw#Clean(<bang>0) " Maps: -if !exists("g:netrw_nogx") && maparg('gx','n') == "" - if !hasmapto('<Plug>NetrwBrowseX') - nmap <unique> gx <Plug>NetrwBrowseX +if !exists("g:netrw_nogx") + if maparg('gx','n') == "" + if !hasmapto('<Plug>NetrwBrowseX') + nmap <unique> gx <Plug>NetrwBrowseX + endif + nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr> + endif + if maparg('gx','v') == "" + if !hasmapto('<Plug>NetrwBrowseXVis') + vmap <unique> gx <Plug>NetrwBrowseXVis + endif + vno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr> + endif +endif +if exists("g:netrw_usetab") && g:netrw_usetab + if maparg('<c-tab>','n') == "" + nmap <unique> <c-tab> <Plug>NetrwShrink endif - nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cfile>"),0)<cr> + nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr> endif " --------------------------------------------------------------------- @@ -119,7 +121,7 @@ fun! s:LocalBrowse(dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)") if a:dirname != '' && isdirectory(a:dirname) sil! call netrw#LocalBrowseCheck(a:dirname) - if exists("w:netrw_bannercnt") + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt endif endif @@ -127,15 +129,19 @@ fun! s:LocalBrowse(dirname) elseif isdirectory(a:dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") " call Dredir("LocalBrowse ft last set: ","verbose set ft") +" call Decho("(s:LocalBrowse) COMBAK#23: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) sil! call netrw#LocalBrowseCheck(a:dirname) - if exists("w:netrw_bannercnt") +" call Decho("(s:LocalBrowse) COMBAK#24: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt +" call Decho("(s:LocalBrowse) COMBAK#25: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) endif else " not a directory, ignore it " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") endif +" call Decho("(s:LocalBrowse) COMBAK#26: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) " call Dret("s:LocalBrowse") endfun diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim index 034cbe225a..6d9e6bd540 100644 --- a/runtime/plugin/tarPlugin.vim +++ b/runtime/plugin/tarPlugin.vim @@ -40,6 +40,7 @@ augroup tar au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>")) au BufReadCmd *.tgz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tbz call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>")) au BufReadCmd *.txz call tar#Browse(expand("<amatch>")) diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim index eb47b1a7c3..b438dea811 100644 --- a/runtime/plugin/tohtml.vim +++ b/runtime/plugin/tohtml.vim @@ -1,6 +1,6 @@ " Vim plugin for converting a syntax highlighted file to HTML. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jul 08 +" Last Change: 2015 Sep 08 " " The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and " $VIMRUNTIME/syntax/2html.vim @@ -67,20 +67,24 @@ if exists('g:loaded_2html_plugin') finish endif -let g:loaded_2html_plugin = 'vim7.4_v1' +let g:loaded_2html_plugin = 'vim7.4_v2' " " Changelog: {{{ -" 7.4_v1 (this version): Fix modeline mangling for new "Vim:" format, and +" 7.4_v2 (this version): Fix error raised when converting a diff containing +" an empty buffer. Jan Stocker: allow g:html_font to +" take a list so it is easier to specfiy fallback +" fonts in the generated CSS. +" 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and " also for version-specific modelines like "vim>703:". " " 7.3 updates: {{{ -" 7.3_v14 (ad6996a23e3e): Allow suppressing line number anchors using +" 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using " g:html_line_ids=0. Allow customizing " important IDs (like line IDs and fold IDs) using " g:html_id_expr evalutated when the buffer conversion " is started. -" 7.3_v13 (2eb30f341e8d): Keep foldmethod at manual in the generated file and +" 7.3_v13 (Vim 7.3.1088): Keep foldmethod at manual in the generated file and " insert modeline to set it to manual. " Fix bug: diff mode with 2 unsaved buffers creates a " duplicate of one buffer instead of including both. @@ -91,7 +95,7 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " Fix XML validation error: &nsbp; not part of XML. " Allow TOhtml to chain together with other commands " using |. -" 7.3_v12 (9910cbff5f16): Fix modeline mangling to also work for when multiple +" 7.3_v12 (Vim 7.3.0616): Fix modeline mangling to also work for when multiple " highlight groups make up the start-of-modeline text. " Improve render time of page with uncopyable regions " by not using one-input-per-char. Change name of @@ -117,23 +121,23 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " http://groups.google.com/d/topic/vim_dev/B6FSGfq9VoI/discussion. " This patch has not yet been included in Vim, thus " these changes are removed in the next version. -" 7.3_v10 (fd09a9c8468e): Fix error E684 when converting a range wholly inside +" 7.3_v10 (Vim 7.3.0227): Fix error E684 when converting a range wholly inside " multiple nested folds with dynamic folding on. " Also fix problem with foldtext in this situation. -" 7.3_v9 (0877b8d6370e): Add html_pre_wrap option active with html_use_css +" 7.3_v9 (Vim 7.3.0170): Add html_pre_wrap option active with html_use_css " and without html_no_pre, default value same as " 'wrap' option, (Andy Spencer). Don't use " 'fileencoding' for converted document encoding if " 'buftype' indicates a special buffer which isn't " written. -" 7.3_v8 (85c5a72551e2): Add html_expand_tabs option to allow leaving tab +" 7.3_v8 (Vim 7.3.0100): Add html_expand_tabs option to allow leaving tab " characters in generated output (Andy Spencer). " Escape text that looks like a modeline so Vim " doesn't use anything in the converted HTML as a " modeline. Bugfixes: Fix folding when a fold starts " before the conversion range. Remove fold column when " there are no folds. -" 7.3_v7 (840c3cadb842): see betas released on vim_dev below: +" 7.3_v7 (Vim 7-3-0063): see betas released on vim_dev below: " 7.3_v7b3: Fixed bug, convert Unicode to UTF-8 all the way. " 7.3_v7b2: Remove automatic detection of encodings that are not " supported by all major browsers according to @@ -147,23 +151,22 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " charset, and make sure the 'fenc' of the generated " file matches its indicated charset. Add charsets for " all of Vim's natively supported encodings. -" 7.3_v6 (0d3f0e3d289b): Really fix bug with 'nowrapscan', 'magic' and other +" 7.3_v6 (Vim 7.3.0000): Really fix bug with 'nowrapscan', 'magic' and other " user settings interfering with diff mode generation, " trailing whitespace (e.g. line number column) when " using html_no_pre, and bugs when using " html_hover_unfold. " 7.3_v5 ( unreleased ): Fix bug with 'nowrapscan' and also with out-of-sync " folds in diff mode when first line was folded. -" 7.3_v4 (7e008c174cc3): Bugfixes, especially for xhtml markup, and diff mode -" 7.3_v3 (a29075150aee): Refactor option handling and make html_use_css +" 7.3_v4 (Vim 7.3.0000): Bugfixes, especially for xhtml markup, and diff mode +" 7.3_v3 (Vim 7.3.0000): Refactor option handling and make html_use_css " default to true when not set to anything. Use strict " doctypes where possible. Rename use_xhtml option to " html_use_xhtml for consistency. Use .xhtml extension " when using this option. Add meta tag for settings. -" 7.3_v2 (80229a724a11): Fix syntax highlighting in diff mode to use both the +" 7.3_v2 (Vim 7.3.0000): Fix syntax highlighting in diff mode to use both the " diff colors and the normal syntax colors -" 7.3_v1 (e7751177126b): Add conceal support and meta tags in output -" Pre-v1 baseline: Mercurial changeset 3c9324c0800e +" 7.3_v1 (Vim 7.3.0000): Add conceal support and meta tags in output "}}} "}}} diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim index 59279774ca..d7473a0296 100644 --- a/runtime/plugin/vimballPlugin.vim +++ b/runtime/plugin/vimballPlugin.vim @@ -1,6 +1,6 @@ " vimballPlugin : construct a file containing both paths and files -" Author: Charles E. Campbell, Jr. -" Copyright: (c) 2004-2010 by Charles E. Campbell, Jr. +" Author: Charles E. Campbell +" Copyright: (c) 2004-2014 by Charles E. Campbell " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -16,22 +16,25 @@ if &cp || exists("g:loaded_vimballPlugin") finish endif -let g:loaded_vimballPlugin = "v35" +let g:loaded_vimballPlugin = "v37" let s:keepcpo = &cpo set cpo&vim " ------------------------------------------------------------------------------ " Public Interface: {{{1 -com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) -com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) -com! -na=0 VimballList call vimball#Vimball(0) -com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() -au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") -au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif -au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif -au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") -au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif -au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif +com! -range -complete=file -nargs=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) +com! -nargs=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) +com! -nargs=0 VimballList call vimball#Vimball(0) +com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() +augroup Vimball + au! + au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif + au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif +augroup END " ===================================================================== " Restoration And Modelines: {{{1 diff --git a/runtime/plugin/zipPlugin.vim b/runtime/plugin/zipPlugin.vim index e9bd0dc4bd..c04d5344b1 100644 --- a/runtime/plugin/zipPlugin.vim +++ b/runtime/plugin/zipPlugin.vim @@ -1,9 +1,9 @@ " zipPlugin.vim: Handles browsing zipfiles " PLUGIN PORTION -" Date: Jun 07, 2013 +" Date: Sep 13, 2016 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -20,14 +20,14 @@ if &cp || exists("g:loaded_zipPlugin") finish endif -let g:loaded_zipPlugin = "v27" +let g:loaded_zipPlugin = "v28" let s:keepcpo = &cpo set cpo&vim " --------------------------------------------------------------------- " Options: {{{1 if !exists("g:zipPlugin_ext") - let g:zipPlugin_ext= '*.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip,*.oxt,*.kmz,*.wsz,*.xap,*.docx,*.docm,*.dotx,*.dotm,*.potx,*.potm,*.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsx,*.xlsm,*.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx' + let g:zipPlugin_ext='*.apk,*.celzip,*.crtx,*.docm,*.docx,*.dotm,*.dotx,*.ear,*.epub,*.gcsx,*.glox,*.gqsx,*.ja,*.jar,*.kmz,*.oxt,*.potm,*.potx,*.ppam,*.ppsm,*.ppsx,*.pptm,*.pptx,*.sldx,*.thmx,*.vdw,*.war,*.wsz,*.xap,*.xlam,*.xlam,*.xlsb,*.xlsm,*.xlsx,*.xltm,*.xltx,*.xpi,*.zip' endif " --------------------------------------------------------------------- diff --git a/runtime/rgb.txt b/runtime/rgb.txt index 5bc2baa3d6..eeaadbe9f2 100644 --- a/runtime/rgb.txt +++ b/runtime/rgb.txt @@ -1,4 +1,3 @@ -! $XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp $ 255 250 250 snow 248 248 255 ghost white 248 248 255 GhostWhite @@ -58,6 +57,14 @@ 119 136 153 LightSlateGrey 190 190 190 gray 190 190 190 grey +190 190 190 x11 gray +190 190 190 X11Gray +190 190 190 x11 grey +190 190 190 X11Grey +128 128 128 web gray +128 128 128 WebGray +128 128 128 web grey +128 128 128 WebGrey 211 211 211 light grey 211 211 211 LightGrey 211 211 211 light gray @@ -106,6 +113,7 @@ 72 209 204 MediumTurquoise 64 224 208 turquoise 0 255 255 cyan + 0 255 255 aqua 224 255 255 light cyan 224 255 255 LightCyan 95 158 160 cadet blue @@ -132,6 +140,11 @@ 124 252 0 lawn green 124 252 0 LawnGreen 0 255 0 green + 0 255 0 lime + 0 255 0 x11 green + 0 255 0 X11Green + 0 128 0 web green + 0 128 0 WebGreen 127 255 0 chartreuse 0 250 154 medium spring green 0 250 154 MediumSpringGreen @@ -203,11 +216,16 @@ 219 112 147 pale violet red 219 112 147 PaleVioletRed 176 48 96 maroon +176 48 96 x11 maroon +176 48 96 X11Maroon +128 0 0 web maroon +128 0 0 WebMaroon 199 21 133 medium violet red 199 21 133 MediumVioletRed 208 32 144 violet red 208 32 144 VioletRed 255 0 255 magenta +255 0 255 fuchsia 238 130 238 violet 221 160 221 plum 218 112 214 orchid @@ -220,6 +238,10 @@ 138 43 226 blue violet 138 43 226 BlueViolet 160 32 240 purple +160 32 240 x11 purple +160 32 240 X11Purple +128 0 128 web purple +128 0 128 WebPurple 147 112 219 medium purple 147 112 219 MediumPurple 216 191 216 thistle @@ -751,3 +773,10 @@ 139 0 0 DarkRed 144 238 144 light green 144 238 144 LightGreen +220 20 60 crimson + 75 0 130 indigo +128 128 0 olive +102 51 153 rebecca purple +102 51 153 RebeccaPurple +192 192 192 silver + 0 128 128 teal diff --git a/runtime/scripts.vim b/runtime/scripts.vim index 251e4c8f08..ab66c0c0a1 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,11 +1,15 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2013 May 24 +" Last change: 2018 Feb 03 " 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 " the file contents. The autocommand is in $VIMRUNTIME/filetype.vim. +" +" Note that the pattern matches are done with =~# to avoid the value of the +" 'ignorecase' option making a difference. Where case is to be ignored use +" =~? instead. Do not use =~ anywhere. " Only do the rest when the FileType autocommand has not been triggered yet. @@ -28,12 +32,12 @@ set cpo&vim let s:line1 = getline(1) -if s:line1 =~ "^#!" +if s:line1 =~# "^#!" " A script that starts with "#!". " Check for a line like "#!/usr/bin/env VAR=val bash". Turn it into " "#!/usr/bin/bash" to make matching easier. - if s:line1 =~ '^#!\s*\S*\<env\s' + if s:line1 =~# '^#!\s*\S*\<env\s' let s:line1 = substitute(s:line1, '\S\+=\S\+', '', 'g') let s:line1 = substitute(s:line1, '\<env\s\+', '', '') endif @@ -44,11 +48,11 @@ if s:line1 =~ "^#!" " "#!/usr/bin/env perl [path/args]" " If there is no path use the first word: "#!perl [path/args]". " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]". - if s:line1 =~ '^#!\s*\a:[/\\]' + if s:line1 =~# '^#!\s*\a:[/\\]' let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '') - elseif s:line1 =~ '^#!.*\<env\>' + elseif s:line1 =~# '^#!.*\<env\>' let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '') - elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' + elseif s:line1 =~# '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '') else let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '') @@ -56,106 +60,126 @@ if s:line1 =~ "^#!" " tcl scripts may have #!/bin/sh in the first line and "exec wish" in the " third line. Suggested by Steven Atkinson. - if getline(3) =~ '^exec wish' + if getline(3) =~# '^exec wish' let s:name = 'wish' endif " Bourne-like shell scripts: bash bash2 ksh ksh93 sh - if s:name =~ '^\(bash\d*\|\|ksh\d*\|sh\)\>' - call SetFileTypeSH(s:line1) " defined in filetype.vim + if s:name =~# '^\(bash\d*\|\|ksh\d*\|sh\)\>' + call dist#ft#SetFileTypeSH(s:line1) " defined in filetype.vim " csh scripts - elseif s:name =~ '^csh\>' + elseif s:name =~# '^csh\>' if exists("g:filetype_csh") - call SetFileTypeShell(g:filetype_csh) + call dist#ft#SetFileTypeShell(g:filetype_csh) else - call SetFileTypeShell("csh") + call dist#ft#SetFileTypeShell("csh") endif " tcsh scripts - elseif s:name =~ '^tcsh\>' - call SetFileTypeShell("tcsh") + elseif s:name =~# '^tcsh\>' + call dist#ft#SetFileTypeShell("tcsh") " Z shell scripts - elseif s:name =~ '^zsh\>' + elseif s:name =~# '^zsh\>' set ft=zsh " TCL scripts - elseif s:name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' + elseif s:name =~# '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' set ft=tcl " Expect scripts - elseif s:name =~ '^expect\>' + elseif s:name =~# '^expect\>' set ft=expect " Gnuplot scripts - elseif s:name =~ '^gnuplot\>' + elseif s:name =~# '^gnuplot\>' set ft=gnuplot " Makefiles - elseif s:name =~ 'make\>' + elseif s:name =~# 'make\>' set ft=make + " Pike + elseif s:name =~# '^pike\%(\>\|[0-9]\)' + set ft=pike + " Lua - elseif s:name =~ 'lua' + elseif s:name =~# 'lua' set ft=lua " Perl 6 - elseif s:name =~ 'perl6' + elseif s:name =~# 'perl6' set ft=perl6 " Perl - elseif s:name =~ 'perl' + elseif s:name =~# 'perl' set ft=perl " PHP - elseif s:name =~ 'php' + elseif s:name =~# 'php' set ft=php " Python - elseif s:name =~ 'python' + elseif s:name =~# 'python' set ft=python " Groovy - elseif s:name =~ '^groovy\>' + elseif s:name =~# '^groovy\>' set ft=groovy " Ruby - elseif s:name =~ 'ruby' + elseif s:name =~# 'ruby' set ft=ruby + " JavaScript + elseif s:name =~# 'node\(js\)\=\>\|js\>' || s:name =~# 'rhino\>' + set ft=javascript + " BC calculator - elseif s:name =~ '^bc\>' + elseif s:name =~# '^bc\>' set ft=bc " sed - elseif s:name =~ 'sed\>' + elseif s:name =~# 'sed\>' set ft=sed " OCaml-scripts - elseif s:name =~ 'ocaml' + elseif s:name =~# 'ocaml' set ft=ocaml " Awk scripts - elseif s:name =~ 'awk\>' + elseif s:name =~# 'awk\>' set ft=awk " Website MetaLanguage - elseif s:name =~ 'wml' + elseif s:name =~# 'wml' set ft=wml " Scheme scripts - elseif s:name =~ 'scheme' + elseif s:name =~# 'scheme' set ft=scheme " CFEngine scripts - elseif s:name =~ 'cfengine' + elseif s:name =~# 'cfengine' set ft=cfengine " Erlang scripts - elseif s:name =~ 'escript' + elseif s:name =~# 'escript' set ft=erlang + " Haskell + elseif s:name =~# 'haskell' + set ft=haskell + + " Scala + elseif s:name =~# 'scala\>' + set ft=scala + + " Clojure + elseif s:name =~# 'clojure' + set ft=clojure + endif unlet s:name @@ -168,28 +192,28 @@ else let s:line5 = getline(5) " Bourne-like shell scripts: sh ksh bash bash2 - if s:line1 =~ '^:$' - call SetFileTypeSH(s:line1) " defined in filetype.vim + if s:line1 =~# '^:$' + call dist#ft#SetFileTypeSH(s:line1) " defined in filetype.vim " Z shell scripts - elseif s:line1 =~ '^#compdef\>' || s:line1 =~ '^#autoload\>' || - \ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~ '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' + elseif s:line1 =~# '^#compdef\>' || s:line1 =~# '^#autoload\>' || + \ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~# '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' set ft=zsh " ELM Mail files - elseif s:line1 =~ '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' + elseif s:line1 =~# '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' set ft=mail " Mason - elseif s:line1 =~ '^<[%&].*>' + elseif s:line1 =~# '^<[%&].*>' set ft=mason " Vim scripts (must have '" vim' as the first line to trigger this) - elseif s:line1 =~ '^" *[vV]im$' + elseif s:line1 =~# '^" *[vV]im$' set ft=vim " MOO - elseif s:line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' + elseif s:line1 =~# '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' set ft=moo " Diff file: @@ -203,29 +227,29 @@ else " - "=== ", "--- ", "+++ " (bzr diff, common case) " - "=== (removed|added|renamed|modified)" (bzr diff, alternative) " - "# HG changeset patch" in first line (Mercurial export format) - elseif s:line1 =~ '^\(diff\>\|Only in \|\d\+\(,\d\+\)\=[cda]\d\+\>\|# It was generated by makepatch \|Index:\s\+\f\+\r\=$\|===== \f\+ \d\+\.\d\+ vs edited\|==== //\f\+#\d\+\|# HG changeset patch\)' - \ || (s:line1 =~ '^--- ' && s:line2 =~ '^+++ ') - \ || (s:line1 =~ '^\* looking for ' && s:line2 =~ '^\* comparing to ') - \ || (s:line1 =~ '^\*\*\* ' && s:line2 =~ '^--- ') - \ || (s:line1 =~ '^=== ' && ((s:line2 =~ '^=\{66\}' && s:line3 =~ '^--- ' && s:line4 =~ '^+++') || (s:line2 =~ '^--- ' && s:line3 =~ '^+++ '))) - \ || (s:line1 =~ '^=== \(removed\|added\|renamed\|modified\)') + elseif s:line1 =~# '^\(diff\>\|Only in \|\d\+\(,\d\+\)\=[cda]\d\+\>\|# It was generated by makepatch \|Index:\s\+\f\+\r\=$\|===== \f\+ \d\+\.\d\+ vs edited\|==== //\f\+#\d\+\|# HG changeset patch\)' + \ || (s:line1 =~# '^--- ' && s:line2 =~# '^+++ ') + \ || (s:line1 =~# '^\* looking for ' && s:line2 =~# '^\* comparing to ') + \ || (s:line1 =~# '^\*\*\* ' && s:line2 =~# '^--- ') + \ || (s:line1 =~# '^=== ' && ((s:line2 =~# '^=\{66\}' && s:line3 =~# '^--- ' && s:line4 =~# '^+++') || (s:line2 =~# '^--- ' && s:line3 =~# '^+++ '))) + \ || (s:line1 =~# '^=== \(removed\|added\|renamed\|modified\)') set ft=diff " PostScript Files (must have %!PS as the first line, like a2ps output) - elseif s:line1 =~ '^%![ \t]*PS' + elseif s:line1 =~# '^%![ \t]*PS' set ft=postscr " M4 scripts: Guess there is a line that starts with "dnl". - elseif s:line1 =~ '^\s*dnl\>' - \ || s:line2 =~ '^\s*dnl\>' - \ || s:line3 =~ '^\s*dnl\>' - \ || s:line4 =~ '^\s*dnl\>' - \ || s:line5 =~ '^\s*dnl\>' + elseif s:line1 =~# '^\s*dnl\>' + \ || s:line2 =~# '^\s*dnl\>' + \ || s:line3 =~# '^\s*dnl\>' + \ || s:line4 =~# '^\s*dnl\>' + \ || s:line5 =~# '^\s*dnl\>' set ft=m4 " AmigaDos scripts elseif $TERM == "amiga" - \ && (s:line1 =~ "^;" || s:line1 =~ '^\.[bB][rR][aA]') + \ && (s:line1 =~# "^;" || s:line1 =~? '^\.bra') set ft=amiga " SiCAD scripts (must have procn or procd as the first line to trigger this) @@ -233,108 +257,113 @@ else set ft=sicad " Purify log files start with "**** Purify" - elseif s:line1 =~ '^\*\*\*\* Purify' + elseif s:line1 =~# '^\*\*\*\* Purify' set ft=purifylog " XML - elseif s:line1 =~ '<?\s*xml.*?>' + elseif s:line1 =~# '<?\s*xml.*?>' set ft=xml " XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN") - elseif s:line1 =~ '\<DTD\s\+XHTML\s' + elseif s:line1 =~# '\<DTD\s\+XHTML\s' 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 - elseif s:line1 =~ '^%PDF-' + elseif s:line1 =~# '^%PDF-' set ft=pdf " XXD output - elseif s:line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' + elseif s:line1 =~# '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' set ft=xxd " RCS/CVS log output - elseif s:line1 =~ '^RCS file:' || s:line2 =~ '^RCS file:' + elseif s:line1 =~# '^RCS file:' || s:line2 =~# '^RCS file:' set ft=rcslog " CVS commit - elseif s:line2 =~ '^CVS:' || getline("$") =~ '^CVS: ' + elseif s:line2 =~# '^CVS:' || getline("$") =~# '^CVS: ' set ft=cvs " Prescribe - elseif s:line1 =~ '^!R!' + elseif s:line1 =~# '^!R!' set ft=prescribe " Send-pr - elseif s:line1 =~ '^SEND-PR:' + elseif s:line1 =~# '^SEND-PR:' set ft=sendpr " SNNS files - elseif s:line1 =~ '^SNNS network definition file' + elseif s:line1 =~# '^SNNS network definition file' set ft=snnsnet - elseif s:line1 =~ '^SNNS pattern definition file' + elseif s:line1 =~# '^SNNS pattern definition file' set ft=snnspat - elseif s:line1 =~ '^SNNS result file' + elseif s:line1 =~# '^SNNS result file' set ft=snnsres " Virata - elseif s:line1 =~ '^%.\{-}[Vv]irata' - \ || s:line2 =~ '^%.\{-}[Vv]irata' - \ || s:line3 =~ '^%.\{-}[Vv]irata' - \ || s:line4 =~ '^%.\{-}[Vv]irata' - \ || s:line5 =~ '^%.\{-}[Vv]irata' + elseif s:line1 =~# '^%.\{-}[Vv]irata' + \ || s:line2 =~# '^%.\{-}[Vv]irata' + \ || s:line3 =~# '^%.\{-}[Vv]irata' + \ || s:line4 =~# '^%.\{-}[Vv]irata' + \ || s:line5 =~# '^%.\{-}[Vv]irata' set ft=virata " Strace - elseif s:line1 =~ '^\(\[pid \d\+\] \)\=[0-9:.]* *execve(' || s:line1 =~ '^__libc_start_main' + elseif s:line1 =~# '[0-9:.]* *execve(' || s:line1 =~# '^__libc_start_main' set ft=strace " VSE JCL - elseif s:line1 =~ '^\* $$ JOB\>' || s:line1 =~ '^// *JOB\>' + elseif s:line1 =~# '^\* $$ JOB\>' || s:line1 =~# '^// *JOB\>' set ft=vsejcl " TAK and SINDA - elseif s:line4 =~ 'K & K Associates' || s:line2 =~ 'TAK 2000' + elseif s:line4 =~# 'K & K Associates' || s:line2 =~# 'TAK 2000' set ft=takout - elseif s:line3 =~ 'S Y S T E M S I M P R O V E D ' + elseif s:line3 =~# 'S Y S T E M S I M P R O V E D ' set ft=sindaout - elseif getline(6) =~ 'Run Date: ' + elseif getline(6) =~# 'Run Date: ' set ft=takcmp - elseif getline(9) =~ 'Node File 1' + elseif getline(9) =~# 'Node File 1' set ft=sindacmp " DNS zone files - elseif s:line1.s:line2.s:line3.s:line4 =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' + elseif s:line1.s:line2.s:line3.s:line4 =~# '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' set ft=bindzone " BAAN - elseif s:line1 =~ '|\*\{1,80}' && s:line2 =~ 'VRC ' - \ || s:line2 =~ '|\*\{1,80}' && s:line3 =~ 'VRC ' + elseif s:line1 =~# '|\*\{1,80}' && s:line2 =~# 'VRC ' + \ || s:line2 =~# '|\*\{1,80}' && s:line3 =~# 'VRC ' set ft=baan " Valgrind - elseif s:line1 =~ '^==\d\+== valgrind' || s:line3 =~ '^==\d\+== Using valgrind' + elseif s:line1 =~# '^==\d\+== valgrind' || s:line3 =~# '^==\d\+== Using valgrind' set ft=valgrind + " Go docs + elseif s:line1 =~# '^PACKAGE DOCUMENTATION$' + set ft=godoc + " Renderman Interface Bytestream - elseif s:line1 =~ '^##RenderMan' + elseif s:line1 =~# '^##RenderMan' set ft=rib " Scheme scripts - elseif s:line1 =~ 'exec\s\+\S*scheme' || s:line2 =~ 'exec\s\+\S*scheme' + elseif s:line1 =~# 'exec\s\+\S*scheme' || s:line2 =~# 'exec\s\+\S*scheme' set ft=scheme " Git output - elseif s:line1 =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' + elseif s:line1 =~# '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' set ft=git " Gprof (gnu profiler) elseif s:line1 == 'Flat profile:' \ && s:line2 == '' - \ && s:line3 =~ '^Each sample counts as .* seconds.$' + \ && s:line3 =~# '^Each sample counts as .* seconds.$' set ft=gprof " Erlang terms @@ -345,18 +374,18 @@ else " CVS diff else let s:lnum = 1 - while getline(s:lnum) =~ "^? " && s:lnum < line("$") + while getline(s:lnum) =~# "^? " && s:lnum < line("$") let s:lnum += 1 endwhile - if getline(s:lnum) =~ '^Index:\s\+\f\+$' + if getline(s:lnum) =~# '^Index:\s\+\f\+$' set ft=diff " locale input files: Formal Definitions of Cultural Conventions " filename must be like en_US, fr_FR@euro or en_US.UTF-8 - elseif expand("%") =~ '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_' + elseif expand("%") =~# '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_' let s:lnum = 1 while s:lnum < 100 && s:lnum < line("$") - if getline(s:lnum) =~ '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' + if getline(s:lnum) =~# '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' setf fdcc break endif diff --git a/runtime/spell/README_en.txt b/runtime/spell/README_en.txt index 52c27440d0..39443a2a45 100644 --- a/runtime/spell/README_en.txt +++ b/runtime/spell/README_en.txt @@ -1,73 +1,89 @@ en_US -20040623 release. --- -This dictionary is based on a subset of the original -English wordlist created by Kevin Atkinson for Pspell -and Aspell and thus is covered by his original -LGPL license. The affix file is a heavily modified -version of the original english.aff file which was -released as part of Geoff Kuenning's Ispell and as -such is covered by his BSD license. +en_US Hunspell Dictionary +Version 2015.08.24 +Mon Aug 24 16:39:36 2015 -0400 [79c892e] +http://wordlist.sourceforge.net -Thanks to both authors for there wonderful work. +README file for English Hunspell dictionaries derived from SCOWL. +These dictionaries are created using the speller/make-hunspell-dict +script in SCOWL. -=================================================== -en_AU: -This dictionary was based on the en_GB Myspell dictionary -which in turn was initially based on a subset of the -original English wordlist created by Kevin Atkinson for -Pspell and Aspell and thus is covered by his original -LGPL licence. +The following dictionaries are available: -The credit for this en_AU dictionary goes to: + en_US (American) + en_CA (Canadian) + en_GB-ise (British with "ise" spelling) + en_GB-ize (British with "ize" spelling) -Kelvin Eldridge (maintainer) -Jean Hollis Weber -David Wilson + en_US-large + en_CA-large + en_GB-large (with both "ise" and "ize" spelling) -- Words incorrect in Australian English removed -- a list from the previously removed words with corrected spelling was added -- a list of major rivers was added -- a list of place names was added -- a list of Australian mammals was added -- a list of Aboriginal/Koori words commonly used was added +The normal (non-large) dictionaries correspond to SCOWL size 60 and, +to encourage consistent spelling, generally only include one spelling +variant for a word. The large dictionaries correspond to SCOWL size +70 and may include multiple spelling for a word when both variants are +considered almost equal. Also, the general quality of the larger +dictionaries may also be less as they are not as carefully checked for +errors as the normal dictionaries. -A total of 119,267 words are now recognized -by the dictionary. +To get an idea of the difference in size, here are 25 random words +only found in the large dictionary for American English: -Of course, special thanks go to the editors of the -en_GB dictionary (David Bartlett, Brian Kelk and -Andrew Brown) which provided the starting point -for this dictionary. + Bermejo Freyr's Guenevere Hatshepsut Nottinghamshire arrestment + crassitudes crural dogwatches errorless fetial flaxseeds godroon + incretion jalapeño's kelpie kishkes neuroglias pietisms pullulation + stemwinder stenoses syce thalassic zees -The affix file is currently a duplicate of the en_AU.aff -created completely from scratch by David Bartlett and -Andrew Brown, based on the published -rules for MySpell and is also provided under the LGPL. +The en_US and en_CA are the official dictionaries for Hunspell. The +en_GB and large dictionaries are made available on an experimental +basis. If you find them useful please send me a quick email at +kevina@gnu.org. -If you find omissions or bugs or have new words to -add to the dictionary, please contact the en_AU -maintainer at: +If none of these dictionaries suite you (for example, maybe you want +the larger dictionary but only use spelling of a word) additional +dictionaries can be generated at http://app.aspell.net/create or by +modifying speller/make-hunspell-dict in SCOWL. Please do let me know +if you end up publishing a customized dictionary. - "Kelvin" <audictionary@onlineconnections.com.au> +If a word is not found in the dictionary or a word is there you think +shouldn't be, you can lookup the word up at http://app.aspell.net/lookup +to help determine why that is. +General comments on these list can be sent directly to me at +kevina@gnu.org or to the wordlist-devel mailing lists +(https://lists.sourceforge.net/lists/listinfo/wordlist-devel). If you +have specific issues with any of these dictionaries please file a bug +report at https://github.com/kevina/wordlist/issues. +IMPORTANT CHANGES FROM 2015.02.15: -=================================================== -en_CA: -The dictionary file was created using the "final" English and Canadian SCOWL (Spell Checker Oriented Word Lists) wordlists available at Kevin's Word Lists Page (http://wordlist.sourceforge.net). Lists with the suffixes 10, 20, 35, 50, 65 and 65 were used. Lists with the suffixes 70, 80 and 95 were excluded. Copyright information for SCOWL and the wordlists used in creating it is reproduced below. +The dictionaries are now in UTF-8 format instead of ISO-8859-1. This +was required to handle smart quotes correctly. -The affix file is identical to the MySpell English (United States) affix file. It is a heavily modified version of the original english.aff file which was released as part of Geoff Kuenning's Ispell and as such is covered by his BSD license. +ADDITIONAL NOTES: ---- +The NOSUGGEST flag was added to certain taboo words. While I made an +honest attempt to flag the strongest taboo words with the NOSUGGEST +flag, I MAKE NO GUARANTEE THAT I FLAGGED EVERY POSSIBLE TABOO WORD. +The list was originally derived from Németh László, however I removed +some words which, while being considered taboo by some dictionaries, +are not really considered swear words in today's society. + +COPYRIGHT, SOURCES, and CREDITS: -COPYRIGHT, SOURCES, and CREDITS from SCOWL readme file: +The English dictionaries come directly from SCOWL +and is thus under the same copyright of SCOWL. The affix file is +a heavily modified version of the original english.aff file which was +released as part of Geoff Kuenning's Ispell and as such is covered by +his BSD license. Part of SCOWL is also based on Ispell thus the +Ispell copyright is included with the SCOWL copyright. -The collective work is Copyright 2000 by Kevin Atkinson as well as any -of the copyrights mentioned below: +The collective work is Copyright 2000-2015 by Kevin Atkinson as well +as any of the copyrights mentioned below: - Copyright 2000 by Kevin Atkinson + Copyright 2000-2015 by Kevin Atkinson Permission to use, copy, modify, distribute and sell these word lists, the associated scripts, the output created from the scripts, @@ -115,7 +131,7 @@ Public Domain: Date: Sat, 08 Jul 2000 20:27:21 +0100 From: Brian Kelk <Brian.Kelk@cl.cam.ac.uk> -> I was wondering what the copyright status of your "UK English + > I was wondering what the copyright status of your "UK English > Wordlist With Frequency Classification" word list as it seems to > be lacking any copyright notice. @@ -174,8 +190,12 @@ Inflections database, is under the following copyright: any associated documentation shall at all times remain with Princeton University and LICENSEE agrees to preserve same. -The 50 level includes Brian's frequency class 1, words appearing in -at least 5 of 12 of the dictionaries as indicated in the 12Dicts +The 40 level includes words from Alan's 3esl list found in version 4.0 +of his 12dicts package. Like his other stuff the 3esl list is also in the +public domain. + +The 50 level includes Brian's frequency class 1, words appearing +in at least 5 of 12 of the dictionaries as indicated in the 12Dicts package, and uppercase words in at least 4 of the previous 12 dictionaries. A decent number of proper names is also included: The top 1000 male, female, and Last names from the 1990 Census report; a @@ -186,66 +206,76 @@ other word lists is included. The name files form the Census report is a government document which I don't think can be copyrighted. -The name list from Alan Beale is also derived from the linux words -list, which is derived from the DEC list. He also added a bunch of -miscellaneous names to the list, which he released to the Public Domain. - -The DEC Word list doesn't have a formal name. It is labeled as "FILE: -english.words; VERSION: DEC-SRC-92-04-05" and was put together by Jorge -Stolfi <stolfi@src.dec.com> DEC Systems Research Center. The DEC Word -list has the following copyright statement: - - (NON-)COPYRIGHT STATUS - - To the best of my knowledge, all the files I used to build these - wordlists were available for public distribution and use, at least - for non-commercial purposes. I have confirmed this assumption with - the authors of the lists, whenever they were known. - - Therefore, it is safe to assume that the wordlists in this package - can also be freely copied, distributed, modified, and used for - personal, educational, and research purposes. (Use of these files in - commercial products may require written permission from DEC and/or - the authors of the original lists.) - - Whenever you distribute any of these wordlists, please distribute - also the accompanying README file. If you distribute a modified - copy of one of these wordlists, please include the original README - file with a note explaining your modifications. Your users will - surely appreciate that. - - (NO-)WARRANTY DISCLAIMER - - These files, like the original wordlists on which they are based, - are still very incomplete, uneven, and inconsistent, and probably - contain many errors. They are offered "as is" without any warranty - of correctness or fitness for any particular purpose. Neither I nor - my employer can be held responsible for any losses or damages that - may result from their use. - -However since this Word List is used in the linux.words package which -the author claims is free of any copyright I assume it is OK to use -for most purposes. If you want to use this in a commercial project -and this concerns you the information from the DEC word list can -easily be removed without much sacrifice in quality as only the name -lists were used. - The file special-jargon.50 uses common.lst and word.lst from the "Unofficial Jargon File Word Lists" which is derived from "The Jargon File". All of which is in the Public Domain. This file also contain a few extra UNIX terms which are found in the file "unix-terms" in the special/ directory. -The 60 level includes Brian's frequency class 0 and all words -appearing in at least 2 of the 12 dictionaries as indicated by the -12Dicts package. A large number of names are also included: The 4,946 -female names and 3,897 male names from the MWords package and the -files "computer.names", "misc.names", and "org.names" from the DEC -package. +The 55 level includes words from Alan's 2of4brif list found in version +4.0 of his 12dicts package. Like his other stuff the 2of4brif is also +in the public domain. + +The 60 level includes all words appearing in at least 2 of the 12 +dictionaries as indicated by the 12Dicts package. + +The 70 level includes Brian's frequency class 0 and the 74,550 common +dictionary words from the MWords package. The common dictionary words, +like those from the 12Dicts package, have had all likely inflections +added. The 70 level also included the 5desk list from version 4.0 of +the 12Dics package which is in the public domain. + +The 80 level includes the ENABLE word list, all the lists in the +ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics +Dictionary" (UKACD), the list of signature words from the YAWL package, +and the 10,196 places list from the MWords package. + +The ENABLE package, mainted by M\Cooper <thegrendel@theriver.com>, +is in the Public Domain: + + The ENABLE master word list, WORD.LST, is herewith formally released + into the Public Domain. Anyone is free to use it or distribute it in + any manner they see fit. No fee or registration is required for its + use nor are "contributions" solicited (if you feel you absolutely + must contribute something for your own peace of mind, the authors of + the ENABLE list ask that you make a donation on their behalf to your + favorite charity). This word list is our gift to the Scrabble + community, as an alternate to "official" word lists. Game designers + may feel free to incorporate the WORD.LST into their games. Please + mention the source and credit us as originators of the list. Note + that if you, as a game designer, use the WORD.LST in your product, + you may still copyright and protect your product, but you may *not* + legally copyright or in any way restrict redistribution of the + WORD.LST portion of your product. This *may* under law restrict your + rights to restrict your users' rights, but that is only fair. + +UKACD, by J Ross Beresford <ross@bryson.demon.co.uk>, is under the +following copyright: + + Copyright (c) J Ross Beresford 1993-1999. All Rights Reserved. + + The following restriction is placed on the use of this publication: + if The UK Advanced Cryptics Dictionary is used in a software package + or redistributed in any form, the copyright notice must be + prominently displayed and the text of this document must be included + verbatim. + + There are no other restrictions: I would like to see the list + distributed as widely as possible. + +The 95 level includes the 354,984 single words, 256,772 compound +words, 4,946 female names and the 3,897 male names, and 21,986 names +from the MWords package, ABLE.LST from the ENABLE Supplement, and some +additional words found in my part-of-speech database that were not +found anywhere else. + +Accent information was taken from UKACD. -The 65 level includes words found in the Ispell "medium" word list. -The Ispell word lists are under the same copyright of Ispell itself -which is: +My VARCON package was used to create the American, British, and +Canadian word list. + +Since the original word lists used in the VARCON package came +from the Ispell distribution they are under the Ispell copyright: Copyright 1993, Geoff Kuenning, Granada Hills, CA All rights reserved. @@ -263,10 +293,7 @@ which is: such. Binary redistributions based on modified source code must be clearly marked as modified versions in the documentation and/or other materials provided with the distribution. - 4. All advertising materials mentioning features or use of this software - must display the following acknowledgment: - This product includes software developed by Geoff Kuenning and - other unpaid contributors. + (clause 4 removed with permission from Geoff Kuenning) 5. The name of Geoff Kuenning may not be used to endorse or promote products derived from this software without specific prior written permission. @@ -284,13 +311,281 @@ which is: ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -The 70 level includes the 74,550 common dictionary words and the 21,986 names -list from the MWords package. The common dictionary words, like those -from the 12Dicts package, have had all likely inflections added. +Build Date: Mon Aug 24 16:41:56 EDT 2015 +Wordlist Command: mk-list --accents=strip en_US 60 +=================================================== +en_AU: +This dictionary was based on the en_GB Myspell dictionary +which in turn was initially based on a subset of the +original English wordlist created by Kevin Atkinson for +Pspell and Aspell and thus is covered by his original +LGPL licence. + +The credit for this en_AU dictionary goes to: + +Kelvin Eldridge (maintainer) +Jean Hollis Weber +David Wilson + +- Words incorrect in Australian English removed +- a list from the previously removed words with corrected spelling was added +- a list of major rivers was added +- a list of place names was added +- a list of Australian mammals was added +- a list of Aboriginal/Koori words commonly used was added + +A total of 119,267 words are now recognized +by the dictionary. + +Of course, special thanks go to the editors of the +en_GB dictionary (David Bartlett, Brian Kelk and +Andrew Brown) which provided the starting point +for this dictionary. + +The affix file is currently a duplicate of the en_AU.aff +created completely from scratch by David Bartlett and +Andrew Brown, based on the published +rules for MySpell and is also provided under the LGPL. + +If you find omissions or bugs or have new words to +add to the dictionary, please contact the en_AU +maintainer at: + + "Kelvin" <audictionary@onlineconnections.com.au> + + + +=================================================== +en_CA: +en_CA Hunspell Dictionary +Version 2015.08.24 +Mon Aug 24 16:39:36 2015 -0400 [79c892e] +http://wordlist.sourceforge.net + +README file for English Hunspell dictionaries derived from SCOWL. + +These dictionaries are created using the speller/make-hunspell-dict +script in SCOWL. + +The following dictionaries are available: + + en_US (American) + en_CA (Canadian) + en_GB-ise (British with "ise" spelling) + en_GB-ize (British with "ize" spelling) + + en_US-large + en_CA-large + en_GB-large (with both "ise" and "ize" spelling) + +The normal (non-large) dictionaries correspond to SCOWL size 60 and, +to encourage consistent spelling, generally only include one spelling +variant for a word. The large dictionaries correspond to SCOWL size +70 and may include multiple spelling for a word when both variants are +considered almost equal. Also, the general quality of the larger +dictionaries may also be less as they are not as carefully checked for +errors as the normal dictionaries. + +To get an idea of the difference in size, here are 25 random words +only found in the large dictionary for American English: + + Bermejo Freyr's Guenevere Hatshepsut Nottinghamshire arrestment + crassitudes crural dogwatches errorless fetial flaxseeds godroon + incretion jalapeño's kelpie kishkes neuroglias pietisms pullulation + stemwinder stenoses syce thalassic zees + +The en_US and en_CA are the official dictionaries for Hunspell. The +en_GB and large dictionaries are made available on an experimental +basis. If you find them useful please send me a quick email at +kevina@gnu.org. + +If none of these dictionaries suite you (for example, maybe you want +the larger dictionary but only use spelling of a word) additional +dictionaries can be generated at http://app.aspell.net/create or by +modifying speller/make-hunspell-dict in SCOWL. Please do let me know +if you end up publishing a customized dictionary. + +If a word is not found in the dictionary or a word is there you think +shouldn't be, you can lookup the word up at http://app.aspell.net/lookup +to help determine why that is. + +General comments on these list can be sent directly to me at +kevina@gnu.org or to the wordlist-devel mailing lists +(https://lists.sourceforge.net/lists/listinfo/wordlist-devel). If you +have specific issues with any of these dictionaries please file a bug +report at https://github.com/kevina/wordlist/issues. + +IMPORTANT CHANGES FROM 2015.02.15: + +The dictionaries are now in UTF-8 format instead of ISO-8859-1. This +was required to handle smart quotes correctly. + +ADDITIONAL NOTES: + +The NOSUGGEST flag was added to certain taboo words. While I made an +honest attempt to flag the strongest taboo words with the NOSUGGEST +flag, I MAKE NO GUARANTEE THAT I FLAGGED EVERY POSSIBLE TABOO WORD. +The list was originally derived from Németh László, however I removed +some words which, while being considered taboo by some dictionaries, +are not really considered swear words in today's society. + +COPYRIGHT, SOURCES, and CREDITS: + +The English dictionaries come directly from SCOWL +and is thus under the same copyright of SCOWL. The affix file is +a heavily modified version of the original english.aff file which was +released as part of Geoff Kuenning's Ispell and as such is covered by +his BSD license. Part of SCOWL is also based on Ispell thus the +Ispell copyright is included with the SCOWL copyright. + +The collective work is Copyright 2000-2015 by Kevin Atkinson as well +as any of the copyrights mentioned below: + + Copyright 2000-2015 by Kevin Atkinson + + Permission to use, copy, modify, distribute and sell these word + lists, the associated scripts, the output created from the scripts, + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appears in all copies and + that both that copyright notice and this permission notice appear in + supporting documentation. Kevin Atkinson makes no representations + about the suitability of this array for any purpose. It is provided + "as is" without express or implied warranty. + +Alan Beale <biljir@pobox.com> also deserves special credit as he has, +in addition to providing the 12Dicts package and being a major +contributor to the ENABLE word list, given me an incredible amount of +feedback and created a number of special lists (those found in the +Supplement) in order to help improve the overall quality of SCOWL. + +The 10 level includes the 1000 most common English words (according to +the Moby (TM) Words II [MWords] package), a subset of the 1000 most +common words on the Internet (again, according to Moby Words II), and +frequently class 16 from Brian Kelk's "UK English Wordlist +with Frequency Classification". + +The MWords package was explicitly placed in the public domain: + + The Moby lexicon project is complete and has + been place into the public domain. Use, sell, + rework, excerpt and use in any way on any platform. + + Placing this material on internal or public servers is + also encouraged. The compiler is not aware of any + export restrictions so freely distribute world-wide. + + You can verify the public domain status by contacting + + Grady Ward + 3449 Martha Ct. + Arcata, CA 95521-4884 + + grady@netcom.com + grady@northcoast.com + +The "UK English Wordlist With Frequency Classification" is also in the +Public Domain: + + Date: Sat, 08 Jul 2000 20:27:21 +0100 + From: Brian Kelk <Brian.Kelk@cl.cam.ac.uk> + + > I was wondering what the copyright status of your "UK English + > Wordlist With Frequency Classification" word list as it seems to + > be lacking any copyright notice. + + There were many many sources in total, but any text marked + "copyright" was avoided. Locally-written documentation was one + source. An earlier version of the list resided in a filespace called + PUBLIC on the University mainframe, because it was considered public + domain. + + Date: Tue, 11 Jul 2000 19:31:34 +0100 + + > So are you saying your word list is also in the public domain? + + That is the intention. + +The 20 level includes frequency classes 7-15 from Brian's word list. + +The 35 level includes frequency classes 2-6 and words appearing in at +least 11 of 12 dictionaries as indicated in the 12Dicts package. All +words from the 12Dicts package have had likely inflections added via +my inflection database. + +The 12Dicts package and Supplement is in the Public Domain. + +The WordNet database, which was used in the creation of the +Inflections database, is under the following copyright: + + This software and database is being provided to you, the LICENSEE, + by Princeton University under the following license. By obtaining, + using and/or copying this software and database, you agree that you + have read, understood, and will comply with these terms and + conditions.: + + Permission to use, copy, modify and distribute this software and + database and its documentation for any purpose and without fee or + royalty is hereby granted, provided that you agree to comply with + the following copyright notice and statements, including the + disclaimer, and that the same appear on ALL copies of the software, + database and documentation, including modifications that you make + for internal use or for distribution. + + WordNet 1.6 Copyright 1997 by Princeton University. All rights + reserved. + + THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON + UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON + UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- + ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE + LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY + THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + + The name of Princeton University or Princeton may not be used in + advertising or publicity pertaining to distribution of the software + and/or database. Title to copyright in this software, database and + any associated documentation shall at all times remain with + Princeton University and LICENSEE agrees to preserve same. + +The 40 level includes words from Alan's 3esl list found in version 4.0 +of his 12dicts package. Like his other stuff the 3esl list is also in the +public domain. + +The 50 level includes Brian's frequency class 1, words appearing +in at least 5 of 12 of the dictionaries as indicated in the 12Dicts +package, and uppercase words in at least 4 of the previous 12 +dictionaries. A decent number of proper names is also included: The +top 1000 male, female, and Last names from the 1990 Census report; a +list of names sent to me by Alan Beale; and a few names that I added +myself. Finally a small list of abbreviations not commonly found in +other word lists is included. + +The name files form the Census report is a government document which I +don't think can be copyrighted. + +The file special-jargon.50 uses common.lst and word.lst from the +"Unofficial Jargon File Word Lists" which is derived from "The Jargon +File". All of which is in the Public Domain. This file also contain +a few extra UNIX terms which are found in the file "unix-terms" in the +special/ directory. + +The 55 level includes words from Alan's 2of4brif list found in version +4.0 of his 12dicts package. Like his other stuff the 2of4brif is also +in the public domain. + +The 60 level includes all words appearing in at least 2 of the 12 +dictionaries as indicated by the 12Dicts package. + +The 70 level includes Brian's frequency class 0 and the 74,550 common +dictionary words from the MWords package. The common dictionary words, +like those from the 12Dicts package, have had all likely inflections +added. The 70 level also included the 5desk list from version 4.0 of +the 12Dics package which is in the public domain. The 80 level includes the ENABLE word list, all the lists in the ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics -Dictionary" (UKACD), the list of signature words in from YAWL package, +Dictionary" (UKACD), the list of signature words from the YAWL package, and the 10,196 places list from the MWords package. The ENABLE package, mainted by M\Cooper <thegrendel@theriver.com>, @@ -326,65 +621,11797 @@ following copyright: There are no other restrictions: I would like to see the list distributed as widely as possible. -The 95 level includes the 354,984 single words and 256,772 compound -words from the MWords package, ABLE.LST from the ENABLE Supplement, -and some additional words found in my part-of-speech database that -were not found anywhere else. +The 95 level includes the 354,984 single words, 256,772 compound +words, 4,946 female names and the 3,897 male names, and 21,986 names +from the MWords package, ABLE.LST from the ENABLE Supplement, and some +additional words found in my part-of-speech database that were not +found anywhere else. Accent information was taken from UKACD. My VARCON package was used to create the American, British, and Canadian word list. -Since the original word lists used in the VARCON package came from -the Ispell distribution they are under the Ispell copyright. +Since the original word lists used in the VARCON package came +from the Ispell distribution they are under the Ispell copyright: -The variant word lists were created from a list of variants found in -the 12dicts supplement package as well as a list of variants I created -myself. + Copyright 1993, Geoff Kuenning, Granada Hills, CA + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All modifications to the source code must be clearly marked as + such. Binary redistributions based on modified source code + must be clearly marked as modified versions in the documentation + and/or other materials provided with the distribution. + (clause 4 removed with permission from Geoff Kuenning) + 5. The name of Geoff Kuenning may not be used to endorse or promote + products derived from this software without specific prior + written permission. + THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS + IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEOFF + KUENNING OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +Build Date: Mon Aug 24 16:41:58 EDT 2015 +Wordlist Command: mk-list --accents=strip en_CA 60 =================================================== en_GB: -This dictionary was initially based on a subset of the -original English wordlist created by Kevin Atkinson for -Pspell and Aspell and thus is covered by his original +This dictionary was initially based on a subset of the +original English wordlist created by Kevin Atkinson for +Pspell and Aspell and thus is covered by his original LGPL licence. It has been extensively updated by David Bartlett, Brian Kelk and Andrew Brown: -- numerous Americanism have been removed -- numerous American spellings have been corrected -- missing words have been added -- many errors have been corrected -- compound hyphenated words have been added where appropriate +- Numerous Americanism have been removed; +- Numerous American spellings have been corrected; +- Missing words have been added; +- Many errors have been corrected; +- Compound hyphenated words have been added where appropriate. -Valuable inputs to this process were received from many other +Valuable inputs to this process were received from many other people - far too numerous to name. Serious thanks to you all for your greatly appreciated help. -This word list is intended to be a good representation of -current modern British English and thus it should be a good -basis for Commonwealth English in most countries of the world +This wordlist is intended to be a good representation of +current modern British English and thus it should be a good +basis for Commonwealth English in most countries of the world outside North America. The affix file has been created completely from scratch -by David Bartlett and Andrew Brown, based on the published +by David Bartlett and Andrew Brown, based on the published rules for MySpell and is also provided under the LGPL. -In creating the affix rules an attempt has been made to +In creating the affix rules an attempt has been made to reproduce the most general rules for English word formation, rather than merely use it as a means to compress the size of the dictionary. It is hoped that this will facilitate future localisation to other variants of English. -Please let David Bartlett <dwb@openoffice.org> know of any -errors that you find. +--- + +This is a locally hosted copy of the English dictionaries with fixed dash handling and new ligature and phonetic suggestion support extension: +http://extensions.openoffice.org/en/node/3785 + +Original version of the en_GB dictionary: +http://www.openoffice.org/issues/show_bug.cgi/id=72145 + +OpenOffice.org patch and morphological extension. + +The morphological extension based on Wordlist POS and AGID data +created by Kevin Atkinson and released on http://wordlist.sourceforge.net. + +Other fixes: + +OOo Issue 48060 - add numbers with affixes by COMPOUNDRULE (1st, 111th, 1990s etc.) +OOo Issue 29112, 55498 - add NOSUGGEST flags to taboo words +New REP items (better suggestions for accented words and a few mistakes) +OOo Issue 63541 - remove *dessicated + +2008-12-18 nemeth AT OOo + +--- -The current release is R 1.18, 11/04/05 +MARCO A.G.PINTO: +Since the dictionary hasn't been updated for many years, +I decided to fork it in order to add new words and fixes. + +I even added words such as common names of software and hardware. + +I grabbed Mozilla's version since it wasn't obfuscated. Alexandro Colorado and I +tried to unmunch the OpenOffice version but all we got was garbage. + +The dictionary icon in the Extension Manager was designed by Pedro Marques. + +The sources used to verify the spelling of the words I included in the dictionary: +1) Oxford Dictionaries; +2) Collins Dictionary; +3) Macmillan Dictionary; +4) Wiktionary (used with caution); +5) Wikipedia (used with caution); +6) Physical dictionaries + +Main difficulties developing this dictionary: +1) Proper names; +2) Possessive forms; +3) Plurals. + +Please let Marco A.G.Pinto know of any errors that you find: +E-mail: marcoagpinto@mail.telepac.pt + Site: http://marcoagpinto.cidadevirtual.pt/proofingtoolgui.html + + +V2.00 - 25-AUG-2013 +------------------- +Added the words: +1) Thunderbird +2) Firefox +3) LibreOffice +4) Ubuntu +5) Amiga (from Commodore) +6) mIRC +7) Facebook +8) ChanServ +9) NickServ +10) IRC +11) PhD (+plural) +12) Ph.D. +13) screenshot (+plural) +14) PowerPC +15) internship (+plural) +16) D-day +17) Wikipedia +18) committer (+plural) +19) anymore +20) GitHub +21) Blu-ray (+plural) +22) airplane (+plural) +23) unsubscribe + + +V2.01 - 31-AUG-2013 +------------------- +Added the words: +24) cyberterrorist (+plural) +25) cyberterrorism +26) DVD-RW +27) DVD-RAM +28) DVD+RW +29) cyberattack (+plural) +30) encyclopedia (+plural) +31) spyware +32) adware +33) malware +34) Trojan (First letter capitalized - Oxford Dictionary) +35) Freeware +36) rootkit (+plural) +37) keylogger (+plural) +38) keylogging +39) subprogram (+plural) +40) webcam (+plural) +41) antivirus +42) Coca-Cola +43) fuckable +44) fuckability +45) NSA +46) GnuPG +47) melancholiac +48) scammer (+plural) +49) XML +50) movie (+plural) (Oxford Dictionary says it is chiefly North American) +51) YouTube +52) cyberwar (+plural) + + +V2.02 - 4-SEP-2013 +------------------- +Added the words: +53) aargh +54) ABC (+plural) +55) admin +56) ADSL +57) JPEG +58) megapixel (+plural) +59) PDF +60) HDD +61) FPU +62) boing +63) google +64) Google (capitalized-company) +65) IDE +66) fallback +67) re-establish +68) MUFON +69) transborder (+plural) +70) leveraging +71) geek (+plural) +72) bestseller (+plural) +73) playlist (+plural +ing) +74) PowerPoint +75) DALnet +76) meetup (Oxford Dictionary says it is chiefly North American) +77) traineeship (Fix - it was only inserted in plural) +78) phishing +79) phisher (+plural) +80) botnet (+plural) +81) guestbook +82) widescreen (fix - it was inserted wide-screen) +83) shortcut (+plural) +84) retrocession +85) hardcover (Oxford Dictionary says it is chiefly North American) +86) Bryon (name of person) +87) Aleister (name of person) +88) teleport +89) teleportation +90) etheric +91) telepath +92) trustable +93) contactee (+plural) +94) chakra (+plural) +95) Adamski (name of person) +96) diapers (Added plural) +97) Pleiades (place in the universe) +98) PGP +99) lineman +100) linemen +101) videography +102) videographer +103) HDMI +104) mentoring +105) mentored (merged to mentor+ed) +106) anytime +107) skywatch (+er +ers +er's) +108) statewide +109) caseload +110) experiencer (+plural) +111) experienceable +112) blog (+plural) +113) blogging +114) blogged +115) blogger +116) crimeware +117) multisession +118) cyberstalking +119) cyberstalker (+plural) +120) PCMCIA +121) failover +122) placeholder (+plural) +123) showstopper (+plural) +124) showstopping +125) API +126) SeaMonkey +127) markup +128) watchdogging +129) watchdogged +130) cockapoo +131) Elohim (name) +132) undine (+plural) +133) Plutonian +134) technostructure +135) uncommercial +136) uncompetitively +137) uncompetitiveness +138) uncomplicatedly +139) uncomplicatedness +140) graphitic +141) blacklead +142) ufological +143) UEFA + + +V2.03 - 13-SEP-2013 +------------------- +144) Merged uncompetitiveness and uncompetitively into uncompetitive. +145) e-book (+plural) +146) e-business +147) e-card (+plural) +148) e-crime (+plural) +149) e-criminal (plural) +150) infomediary +151) infomercial (Oxford Dictionary says it is chiefly North American) +152) infonaut +153) SQL +154) cybercafe +155) cyberbullying +156) cyberbully +157) microcontroller +158) microcircuitry +159) PDFs (plural) +160) AGP +161) BIOS (computer) +162) bio (+plural) -> (Oxford Dictionary->informal->a biography) +163) biofuel +164) biodata +165) biodefence +166) biodiesel +167) bioconversion +168) biocomputer +169) biocomputing +170) bioclimatic +171) biochip +172) dpi +173) BitTorrent +174) spellcheck (+ er) +175) GPS +176) GIF +177) MPEG +178) NGO +179) NTSC +180) psychotomimetic +181) OLED +182) biocircuit +183) subwoofer +184) stereophonically +185) stereophony +186) subclinical +187) electro-oculography +188) electro-oculographic +189) electrochemistry +190) electrochemist +191) triplexed (added +ed to triplex) +192) sextodecimo (+plural) +193) thermography +194) thermographic +195) thermogram (+plural) +196) thermograph +197) infrared +198) fetus (+plural) +199) unhatched +200) unharmful (added +un to harmful) +201) open-source +202) gigabit (+plural) +203) gigaflop (+plural) +204) giganotosaurus +205) gigantism +206) polyploid (+plural) +207) polyploidy +208) intracellularly (added ly to intracellular) +209) daughterboard +210) daughtercard +211) transmissivity (+plural) +212) complementarities (plural) +213) RNA +214) polysaccharide (singular) +215) bioplastic +216) agonist +217) agonism +218) app (+plural) +219) Xanax +220) X-rated +221) subtotalling +222) subtotalled +223) derivational +224) Bergström (Swedish name) +225) 104+105 (placed in individual words due to a bug in the .AFF) + + +V2.04 - 20-SEP-2013 +------------------- +226) spoofer (merged into spoof) +227) spoofery +228) spoofable +229) PayPal +230) distro (+plural) +231) geoinformation +232) geolocation +233) geolocate +234) favicon +235) gameplay +236) webmaster (+plural) +237) holler (+ ed) +238) chemtrail (+plural) +239) Günther (name) +240) twopenn'orth (John Wilcock from the Mozilla ML) +241) reinstallation +242) Alexandro (name) +243) URLs (plural) +244) discombobulate (+ed - Ian Neal from the Mozilla ML) +245) discombobulation (Ian Neal from the Mozilla ML) +246) Asturias +247) Asturian +248) LanguageTool (software) +249) UI (Oxford: User Interface) +250) pootle +251) pootling +252) counterclaim (+ed) +253) sublicense (+ed) +254) double-click (+ed +ing) +255) Pootle (capitalised, for the utility) +256) toolbar (+plural) +257) joypad +258) PNP +259) nanomaterial +260) nanoscale +261) virtualise (+s +d +ing) +262) virtualisation (+plural) +263) voicemail +264) steadier (added un) +265) steadiest (added un) +266) sci-fi (Oxford Dictionary: informal) +267) namespace +268) online (both on-line and online exist) +269) webmail +270) hardcover (removed, because in en_GB is hardback, thanks Ian Neal) +271) likelihoods (merged into likelihood with an s code) +272) postnuptial +273) Coloradan (relating Colorado: noun and adjective: Oxford) +274) LaVey (name) +275) Belial (name) +276) Rhadamanthus (name) +277) Sarpedon (name) +278) Pelops (name) +279) sociopath (+plural +ic +y) +280) schizo-affective +281) walk-through +282) unsexy (+ier + iest) +283) handheld +284) filename (+plural) +285) unhide (added un to hide) +286) overlayer (merged into overlay +plural) +287) overinsured +288) overinsurance +289) overkeen +290) overhit (+s +ing) +291) Chiu (name) +292) squawfish (+plural) +292) podcast (+able +er +ing) +293) autocorrect (+s +ed) +294) autocomplete (+s +ed) +295) waka +296) watercraft +297) spacecrafts (added plural - Oxford) +298) weatherboards (added plural - Oxford) +299) firewall (added +ed +ing) +300) firestorm (+plural) + + +V2.05 - 7-OCT-2013 +------------------ +301) GPU (+plural) +302) AMD (hardware company) +303) wireframe +304) leverages (with s) +305) tooltip (+plural) +306) hyperlink (+plural +ed) +307) wirelessly (merged into wireless) +308) ultraconservatism +309) ultramicroscope +310) ultramicroscopic +311) enigmatical +312) enharmonically (merged into enharmonic) +313) René (name) +314) Kant's +315) Kantian +316) Kantianism +317) Confucianist +318) Azrael (name) +319) exemplarily (merged into exemplary) +320) exemplarity +321) wholistic (+ally) (Oxford: variant spelling of holistic) +322) homeopathy (Oxford: also homoeopathy) +323) homeopathic (+ally) +324) homeopathist +325) Ashtar (name) +326) teleporting (added "ing" to "teleport") +327) Dreamtime +328) Patricia (name) +329) Patrícia (name with accent in "i") +330) videographics +331) megastar (informal) +332) songcraft +333) fado (+plural Oxford: Portuguese song) +334) divagate (+s +ed) +335) divagation +336) biopharmaceutics +337) WinZip (software) +338) WinRAR (software) +339) NTFS (file system for Windows) +340) UDF (file system) +341) subfolder (+plural) +342) Ubuntu's (added the ') +343) USB +344) smartphone (+plural) +345) rescript (added re into script) +346) OpenGL +347) GPL +348) LGPL +349) shutdown +350) uninstall (+s +ing +ed +er) +351) fundraise (+s +er +ing) +352) googled (merged into google) +353) pyjamaed (merged into pyjama) +354) hackerspace +355) miscreation (merged mis into creation) +356) quinary +357) senary +358) septenary +359) octonary +360) nonary +361) denary +362) duodenary +363) juvenilia +364) megastore +365) lightsabre (+Plural Oxford: from Star Wars) +366) ultracold +367) cerebrospinal +368) midbrain +369) hindbrain +370) brainstem +371) pluripotent +372) microcephaly (+lic) +373) microcephalous +374) hippocampus +375) hippocampi +376) clavicular +377) megastardom (informal) + + +V2.06 - 1-NOV-2013 +------------------ +378) ongoingness (merged into ongoing) +379) hacktivist (+plural) +380) hacktivism +381) cybercrime (+plural) +382) cybercriminal (+plural) +383) leakers (plural) +384) NSA's (added the 's) +385) infringers (plural) +386) username +387) Moodle +388) breathalyse +389) unappropriated +390) defalcator (+plural) +391) imponderably (merged into imponderable) +392) imponderability +393) forecasted (merged into forecast) +394) salvific (Oxford: adjective, Theology) +395) dualist +396) dualistic (+ally) +397) infographic +398) cybernaut +399) prepayable (merged into prepay) +400) prepayability (merged into prepay) +401) monoecious +402) monoecy +403) passerine (+plural) +404) Google's (added the 's) +405) subedit (+s +ed +ing) +406) subeditor +407) overhitting (merged into overhit) +408) countback +409) volleyer (merged into volley) +410) standalone (removed - According to Oxford is: stand-alone) +411) stroganoff +412) timeshare (+s +ed) +413) submodify (+er +ies +ing +tion) +414) timeline (+plural) +415) trainspotter (+plural) +416) trainspotting +417) burka +418) Brezhnev (Russian name) +419) Gorbachev (Russian name) +420) preset (+s) +421) Wicca +422) Wiccan +423) archangelic (merged into archangel) +424) angelology +425) typologist (merged into typology) +426) Wi-Fi +427) WC +428) wiki (yes, it exists in Oxford) +429) Wikipedian +430) LinkedIn (Business Social Network) +431) interlinkage +432) monotype +433) spiritlessly (merged into spiritless) +434) spiritlessness (merged into spiritless) +435) spiritism +436) spiritist +437) spiritistic +438) (merged spirit's into spirit) +439) bestselling +440) subterraneous +441) subterraneously (merged into subterraneous) +442) subterminal +443) viscousness (merged into viscous) +444) imperatrix +445) imperatrices +446) Metallica (+'s - the heavy metal band) +447) SMS (+plural +ing +ed) +448) MMS (+plural +ing +ed) +449) infowar +450) wipeable (merged into wipe) +451) multiplayer +452) (merged multitasking into multitask) +453) multitasked (merged into multitask) +454) multitasker (merged into multitask) +455) petabyte (+plural) +456) Bluetooth (+ed) +457) terabyte (+plural) +458) metadata +459) metafile +460) netiquette +461) DSL +462) listenership +463) videoconference (+ing) +464) narrowcast (+ed +ing +er) +465) cypherpunk (+plural) +466) MSN +467) viewport +468) Hezbollah +469) unibody (+plural) +470) escargot +471) yogurt (+plural) +472) knifepoint +473) guerrilla (fix: it had plural only and 's) +474) teacherly +475) varicella +476) herpesvirus +477) postnatally (merged into postnatal) +478) echoer (merged into echo) +479) echoey (merged into echo) +480) echoless (merged into echo) +481) (merged echo's into echo) +482) (merged echoic into echo) +483) Transifex +484) biogeochemical +485) biogeochemist +486) biogeochemistry +487) centremost +488) workpiece +489) WordPad +490) netbook (+plural) +491) Atlantean +492) Tir-na-nog +493) Hadean +494) Edenic (merged into Eden) +495) Midgard +496) Gehenna +497) Perseus +498) Andromeda +499) Pegasus +500) originalism +501) pastiched (merged into pastiche) +502) choirman +503) choirmen +504) conservatoire +505) hindwing +506) something's (Oxford - something's behalf - merged into something) +507) Croats (merged into Croat) +508) Bahamian +509) Qatari +510) Belorussia +511) Rwandese +512) Mongols (plural) +513) mongol (+plural - both in lower case - offensive - Down’s syndrome) +514) counterterrorism +515) counterterrorist +516) countermine (+ing) +517) pepperminty +518) duckwalk (+ed) +519) Fátima (name) +520) Fatima (name without accent) +521) fatidic +522) Nostradamus (name) +523) monocrat (+ic) +524) monocracy (+plural) +525) omnicompetent +526) omnicompetence +527) omnisexual +528) omnisexuality +529) ureteric +530) ureteral +531) vinculum +532) vincular +533) amygdala +534) amygdalae +535) BCG +536) hyperkeratosis +537) monolingually (merged into monolingual) +538) monoglot +539) polyglottal +540) polyglottic +541) polyglottism +542) mentoring + mentored (merged to mentor - The .AFF had no bug after all) +543) Afrotropical +544) unholier (merged into unholy) +545) unholiest (merged into unholy) +546) unholiness (merged into unholy) + + +V2.07 - 27-NOV-2013 +------------------- +547) newsfeed +548) telerecording +549) televiewer +550) televiewing +551) radiogenic (+ally) +552) sRGB +553) RGB +554) tech (Oxford - informal) +555) infotech +556) bandolero (+plural) +557) honeytrap +558) gangboard +559) gangsta (Oxford - black slang) +560) bottlescrew +561) shrimper (+plural) +562) longline +563) prawner (merged into prawn) +564) wanna (Oxford - informal - want to; want a) +565) Wankie +566) wanky (Oxford - British vulgar slang) +567) kbyte (+plural) +568) maxwell (if in lower case it is a physics measure) +569) bushelful (+plural) +570) kilometric (merged into kilometre) +571) fibreless (merged into fibre) +572) midline +573) inbox +574) linkbait +575) pseudorandom +576) pseudorandomly (merged into pseudorandom) +577) pseudoscience +578) pseudoscientific +579) pseudoscientist +580) parapsychological +581) parapsychologically (merged into parapsychological) +582) parapsychic +583) psychometrist (merged into psychometry) +584) psychometrician +585) demonology (plural + demonological + demonologist) +586) vampirism +587) quickstepping (merged into quickstep) +588) quickstepped (merged into quickstep) +589) Solomonic (merged into Solomon) +590) millenary (+plural) +591) Floréal +592) Amazonia +593) timeout +594) undelete (+ed +ing) +595) screenable (merged into screen) +596) screenful (merged into screen) +597) preselection +598) preselective +599) techie (+plural - Oxford: informal) +600) techy (Oxford: informal) +601) chargrill (+ed) +602) technicals (added plural) +603) knockout +604) speedball +605) decametre (+ic) +606) decigram +607) decigramme +608) magnifico (Oxford: informal) +609) magnificoes (Oxford: informal) +610) postpositive (+vely) +611) intentionalism +612) grottoed (merged into grotto) +613) preadolescent +614) preambular +615) summariness (merged into summary) +616) summational +617) summative +618) Zeuxis (Oxford: Greek painter) +619) zettabyte +620) rollerball +621) autoroute +622) backstreets (plural) +623) downfold +624) masterdom +625) masterhood +626) masterless (merged into master) +627) zinced (merged into zinc) +628) cobaltic (merged into cobalt) +629) cobaltous +630) combust +631) combustor +632) multithreaded +633) multithreading +634) netizen (+plural - Oxford: informal) +635) Photoshop (Oxford: +s +ing +ed) +636) rangefinder +637) microcapsule +638) colonoscope +639) colonoscopy (+plural) +640) hypnotherapist (+plural) +641) abductee (+plural) +642) ET (+plural) +643) Harzan (name of person) +644) Denise (name of person) +645) celeb (+plural - Oxford: informal) +646) CEO (added +s and 's) +647) CNN (added 's) +648) scats (merged plural into scat) +649) synchronicity +650) Sananda (name of person) +651) micropyle +652) spermatozoid (+plural) + + +V2.08 - 1-JAN-2014 +------------------ +653) Ilachinski (name of person) +654) journaling (fix: it had two ll) +655) journaled (fix: it had two ll) +656) weathergirl +657) greyscale +658) rollback +659) pushback +660) patball +661) blowout +662) debut (+ed +ing) +663) debutante +664) proaction +665) proactively (merged into proactive) +666) proactivity +667) MUFON's (added 's) +668) intension (+al +ally) +669) conjecturable (merged into conjecture) +670) hypercorrect +671) hypercorrection +672) reduplicative +673) redwing +674) underwing (+plural) +675) nymphal (merged into nymph) +676) nymphean +677) Persephone (name) +678) myriapod +679) pictography +680) hieroglyphical +681) hieroglyphically (merged into hieroglyphical) +682) interlanguage +683) correlativity +684) predicability +685) sulphadiazine +686) biopharmaceutical (+plural) +687) dealmaker +688) dealmaking +689) subclause +690) dischargeable (merged into chargeable) +691) disciplic +692) discipular +693) tachistoscope +694) tachistoscopic (merged into tachistoscope) +695) tachistoscopically (merged into tachistoscope) +696) Dropbox +697) headhunt (+er +ing) +698) VCRs (plural) +699) videocassette +700) stuntwoman +701) stuntwomen +702) Steadicam +703) filmstrip +704) shirtsleeved (merged into shirtsleeve) +705) warez (Oxford: informal) +706) cybersex +707) cybershop (+s +ing +ed) +708) cybersecurity +709) cyberphobia +710) cyberphobe +711) cyberphobic +712) cyberneticist +713) multivalve +714) doomy +715) doomier (merged into doomy) +716) doomily (merged into doomy) +717) doominess (merged into doomy) +718) doomiest (merged into doomy) +719) satanically (merged into satanic) +720) monolatry +721) monolater +722) monolatrist +723) monolatrous +724) picnicky (merged into picnic) +725) fastball +726) curveball +727) fetal +728) EPROM +729) Perl +730) shovelware +731) prosthetically (merged into prosthetic) +732) microsurgeon +733) microsurgical +734) bistoury (+plural) +735) vaselined +736) OpenPGP +737) alienability +738) survivorship +739) refrigeratory +740) desiccative (merged into desiccate) +741) replaced spongelike with sponge-like (Fix - Oxford) +742) oystering (merged into oyster) +743) cephalopod +744) milreis (currency) +745) cruzado (currency) (+plural) +746) kwanza (currency) (+plural) +747) dobra (currency) +748) bitcoin (+plural) +749) spreadsheeting (merged into spreadsheet) +750) DDoS +751) bloggable (merged into blog) +752) hectarage +753) megalitre +754) Svedberg +755) petaflop +756) iPhone +757) iPad +758) criminalistics +759) triable +760) sequestrable (merged into sequestrate) +761) sequestrator +762) sociolegal +763) orthomolecular +764) cryopreserve +765) cryopreservation (merged into cryopreserve) +766) allogeneic +766) thrombose (fixed thromboses + added ed) +767) immunotherapy +768) shadowgraph +769) radiograph +770) microphysics +771) microphysical +772) ionizable (merged into ionize) +773) intramolecular +774) intramolecularly (merged into intramolecular) +775) superspace +776) metamaterial (+plural) +777) isoelectronic +778) seventhly +779) UVA +780) radioscopic (merged into radioscopy) +781) antigravity +782) spacewalk (+er) +783) Geminis (plural - merged into Gemini) +784) Geminian +785) xenology +786) xenologist +787) cockfight (+s +ing) +788) neuroticism +789) megalomanic +790) anaclitic +791) megalomaniacal +792) megaflop (+plural) +793) kilocalorie +794) multigym +795) powerlifting +796) powerlifter +797) kettlebell +798) translunar +799) checkbox (+plural) +800) duplexity +801) preagricultural +802) admins (plural) +803) housefather +804) housemother +805) mainstreamed (merged into mainstream) +806) merged mainstreamer into mainstream +807) remediate +809) remediation (merged into remediate) +810) biopiracy +811) sublittoral +812) biogeography +813) biogeographic (merged into biogeography) +814) biogeographer +815) biogeographically +816) biogeographical +817) excretive (merged into excrete) +818) hyperparasite +819) hyperparasitic (merged into hyperparasite) +820) hyperparasitism +821) acellular +822) charcuterie (+plural) +823) chiffonade +824) piri-piri +825) crispbread +826) fricasseed (merged into fricassee) +827) tsukemono (+plural) +828) feijoada +829) tourtière +830) macaronies (fixed - plural) +831) fourchette +832) quadratus +833) quadrati +834) submandibular +835) rectus +836) recti +837) umbilically (merged into umbilical) +838) preflighting (merged into preflight) +839) gyropilot +840) mainsheet +841) helmsmanship +842) unnavigability +843) coachroof +844) waypoint (+plural) +845) ASUS + + +V2.09 - 1-FEB-2014 +------------------- +846) payday +847) MySpell +848) Alexandro's (added the 's) +849) neuropathy +850) neuropathic +851) stomatitis +852) malarious +853) remittent +854) haemodialysis +855) haemodialyses +856) inhalator +857) cataplexy +858) cataplectic +859) heartworm +860) encephalopathies (merged into encephalopathy) +861) bluetongue +862) endemism +863) exospheric (merged into exosphere) +864) polyphonist (merged into polyphony) +865) polyphonous +866) unsettlement (merged into unsettle) +867) spiderman (Oxford: informal) +868) spidermen (Oxford: informal) +869) airbrick +870) stringboard +871) icehouse +872) portcullised (merged into portcullis) +873) sexfoil +874) isometry +875) lunette +876) tympan +877) catchline +878) countermark +879) printability +880) sterilely (merged into sterile) +881) frogspawn +882) behaviouralism +883) behaviouralist +884) tartare +885) fishcake +886) pâtés (merged plural and removed the 's into the singular form) +887) dragonfish (+plural) +888) stonefish (+plural) +889) Quechua (+plural) +890) Quechuan +891) Bolognese +892) bolognese (lower case) +893) bolognaise +894) heteronym (+ic) +895) heteronymous +896) ungeared +897) ungenial (merged into genial) +898) ungenerousness +899) ungifted (merged into gifted) +900) unfussily (merged into unfussy) +901) Hunspell +902) ungainsayable +903) doubleton +904) causalgia +905) vesical +906) cryptogenic +907) ultrasonography +908) ultrasonographic (merged into ultrasonography) +909) tonometer +910) moonset +911) intercalary +912) Ramadan +913) overstimulation +914) psychomotor +915) psychosomatically (merged into psychosomatic) +916) hyperactively (merged into hyperactive) +917) hyperkinetic +918) hyperkinesis +919) captcha +920) APIs (plural) +921) iTunes +922) iPhones (plural) +923) iPads (plural) +924) iOS +925) hydroculture +926) perlite +927) hydrography +928) hydrographer +929) hydrographic +930) hydrographical +931) hydrographically +932) underframe +933) underminer (merged into undermine) +934) megacity (+plural) +935) mudbank +936) geospatial +937) postiche +938) sideburn (fixed: the speller only had plural) +939) upswept +940) reuptake (merged into uptake) +941) DEFCON (and defcon - Oxford: US armed forces) +942) shipbroker +943) furcula +944) furcular +945) furculae +946) springtail (+plural) +947) mealworm +948) viviparity +949) viviparously +950) plantable (merged into plant) +951) plantlet (+plural) +952) floriculture +953) floricultural (merged into floriculture) +954) floriculturist (merged into floriculture) +955) diaspore +956) diasporic (merged into diaspora) +957) tetanic (+ally) +958) Kalashnikov +959) alkane (+plural) +960) heterocyclic +961) benzenoid +962) semimetal +963) semimetallic (merged into semimetal) +964) betaine +965) bicyclic +966) astrochemistry +967) astrochemical +968) astrochemist +969) magnetopause +970) nanoscopic +971) nanostructure +972) nanotech +973) nanotube +974) nanorobot +975) EEPROM +976) chipmaker +977) bitstream +978) Bitstream (Oxford: trademark in the US) +979) superheterodyne +980) radiogoniometer +981) overscan +982) multitrack (+ed) +983) nanobot +984) bioelectronics +985) intercellular +986) heteromerous +987) neurosciences (plural) +988) biostatistical +989) biostatistician +990) pornification +991) pornify +992) laserdisc +993) genlock +994) S-VHS +995) chrominance +996) videocast +997) defrag (+s +ing +ed) +998) ultraportable +999) defragment (+ion +er) +1000) PDA +1001) webspace +1002) cybercrook (+plural) +1003) bootable +1004) preload (+ing) +1005) RTF +1005) GPRS +1006) SOSs (plural) +1007) chatline +1008) welcomely (merged into welcome) +1009) welcomeness (merged into welcome) +1010) welcomer (merged into welcome) +1011) welcomingly (merged into welcome) +1012) terroristic (merged into terrorist) +1013) terroristically +1014) instrumentalism +1015) superbug +1016) hantavirus +1017) herpesviruses (plural) +1018) herpetic +1019) leucoma +1020) headmasterly (merged into headmaster) +1021) schoolwork +1022) playschool +1023) schooldays +1024) encyclopedism +1025) encyclopedist +1026) encyclopedic +1027) exocentric +1028) endocentric +1029) psycholinguist (added singular) +1030) grimoire +1031) psychotronics +1032) Raelian (+plural) +1033) attunement +1034) attritional (merged into attrition) +1035) attornment +1036) subsoiling (merged into subsoil) +1037) fishmeal +1038) charro (+plural) +1039) horsebean +1040) pigman +1041) pigmen +1042) slaughterman +1043) agriproduct +1044) arboriculture +1045) arboricultural (merged into arboriculture) +1046) arboriculturist (merged into arboriculture) +1047) vermiculture +1048) nitrochalk +1049) unreactive (merged into reactive) +1050) bronzy +1051) bronzer (merged into bronze) +1052) reliefs (plural) +1053) superalloy +1054) metallographic (merged into metallography) +1055) metallographically +1056) silversmithing (merged into silversmith) +1057) tinplate (+ed) +1058) EURIBOR +1059) Euromarket +1060) Eurocurrency (+plural) +1061) sexer (merged into sex) +1062) aristo (+plural - Oxford: informal term for aristocrat) +1063) toymakers (plural - merged into toymaker) +1064) toymaker's (merged into toymaker) +1065) rainswept +1066) acidophil (+plural +ic) +1067) basophil (+plural + merged ic into it) +1068) monocyte (+plural) +1069) glutamine +1070) chipset (+plural) +1071) HD +1072) ATA +1073) SATA +1074) AmigaOS +1075) Amigas (plural) +1076) archboard +1077) flatboat (+plural) +1078) keelboat (+plural) +1079) webinar (+plural) +1080) duodecimo (+plural) +1081) barmy (+ier +iest + ily +iness) +1082) barmbrack +1083) cushiony (merged into cushion) +1084) whoopers (plural) +1085) fireback (+plural) +1086) airgun (+plural) +1087) airheaded (Oxford: informal - merged into airhead) +1088) warplane (+plural) +1089) warpaint +1090) Cheyennes (plural) +1091) checklist (+plural) +1092) cafetière +1093) caffeinated +1094) cuppa (+plural - Oxford: informal) +1095) atriums (plural) +1096) basilican +1097) cartonnage +1098) cartophily +1099) cartophilist (+plural) +1100) Johan (name of person) +1101) virtuosic +1102) tessitura +1103) countertenor (+plural) +1104) antiretroviral (+plural) +1105) Prussia +1106) Prussian (+plural) +1107) countryfied (Oxford: also countrified) +1108) antiterror +1109) antiterrorist +1110) antitoxic +1111) micro-organism (Fix/deleted: it is microorganism) +1112) microorganism (+plural) +1113) micropayment (+plural) +1114) micronutrient (+plural) +1115) nanowire (+plural) +1116) nanobacterium +1117) nanobacteria +1118) nanobots (plural) +1119) nanoparticle (+plural) +1120) nanorobots (plural) +1121) nanotubes (plural) +1122) wordlessness (merged into wordless) +1123) wordlist +1124) contrafactive +1125) contrafactual +1126) contralateral +1127) contraposition +1128) multiplatform +1129) CSS +1130) yup +1131) yep +1132) XHTML +1133) SVGA +1134) namespaces (plural) +1135) sumptuary +1136) adminicle +1137) adminicular +1138) procurers (plural) +1139) paraplegic's (added the 's) +1140) victimhood +1141) camgirl +1142) unawakened (merged into awakened) +1143) gainly (Oxford: archaic) +1144) Ofcom (Oxford: abbreviation in the UK - Office of Communications) +1145) Facebook's (added the 's) +1146) giveaway (+plural) +1147) cheerleading +1148) telltale (+plural) +1149) zoospore (+plural) +1150) swarmer (+plural) +1151) hatchling (+plural) +1152) intercostal (+ly) +1153) radiolarian (+plural) +1154) ammonoid (+plural) +1155) allometry (+ic) +1156) dorsoventral (+ly) +1157) embryologic (merged into embryology) +1158) embryologically +1159) Pspell +1160) Aspell +1161) throwdown +1162) bodybuilder (+plural) +1163) bodybuilding +1164) bodyboard (+plural) +1165) bodyboarder (+plural) +1166) bodyboarding +1167) knowledgeability (merged into knowledge) +1168) knowledgable +1169) trichotomy (+plural) +1170) trichotomous +1171) tricker (merged into trick) +1172) trickish +1173) pixilated +1174) pixillated (other way of writing the above) +1175) glitchy (merged into glitch) +1176) cashback +1177) casuarina (+plural) +1178) MacOS +1179) overviewed (merged into overview) +1180) overviewing (merged into overview) +1181) overvaluation +1182) overwater (+ed +ing) +1183) overwear +1184) overwhelmingness +1185) overwind (+ing) +1186) overwound +1187) Bitrex (Oxford: trademark) +1188) bitonal +1189) bitonality +1190) hoo-ha (Oxford: British informal) +1191) synergist (+plural + ally) +1192) synfuel (+plural) +1193) aryl +1194) chromoly +1195) chromogenic +1196) haemophilic (+plural) +1197) antiscorbutic (+plural) +1198) antisense +1199) antirrhinum (+plural) + + +V2.10 - 1-MAR-2014 +------------------ +1200) POS +1201) Wikipedia's (added the ') +1202) PDAs (plural) +1203) FireWire +1204) mic (+plural - Oxford: short for microphone) +1205) deniability +1206) deniably (merged into deniable) +1207) remanent +1208) remanence +1209) coercivity +1210) CD-RW (+plural) +1211) onboard +1212) NAND +1213) modding+modded+modder (merged into mod) +1214) defragmenting (merged into defragment) +1215) DVD-ROM (+plural) +1216) CD-ROMs (plural) +1217) offline +1218) jeep (+plural) +1219) minidisc (+plural) +1220) predate (+ed) +1221) Boole (name + 's) +1222) phenotypic (merged into phenotype) +1223) phenotypical +1224) phenotypically (merged into phenotypical) +1225) triploid (+plural) +1226) tetraploid (+plural) +1227) tetraploidy +1228) hexaploid +1229) hexaploidy +1230) sparrowhawk (+plural) +1231) whinchat (+plural) +1232) transgender (+ed +ing) +1233) homophobe (added singular, by fixing plural) +1234) intersexual +1235) intersexuality +1236) show's (added 's) +1237) battleaxes (plural) +1238) battlebus (+plural - Oxford: British informal) +1239) battlecruiser (+plural +'s) +1240) echinus +1241) echinoid (+plural) +1242) scriptoriums (plural of scriptorium) +1243) scriptoria (also plural of scriptorium) +1244) iMac +1245) cameraperson +1246) camerawork +1247) noir (+plural) +1248) noirish +1249) screwball (+plural +er) +1250) venesection +1251) gamelan +1252) gamepad (+plural) +1253) gamekeeping +1254) gamesman +1255) gamefowl +1256) catchlight (+plural) +1257) x86 +1258) x64 +1259) UTF-8 +1260) PureBasic +1261) Algarve (famous city in Portugal) +1262) calculuses (added plural) +1263) Calcuttan +1264) caldarium +1265) caldaria (plural of caldarium) +1266) man-at-arms +1267) men-at-arms (plural) +1268) horsebox (+plural) +1269) horsebeans (plural) +1270) cornetto +1271) cornetti (plural of cornetto) +1272) cornett (+plural) +1273) cornetfish (+plural) +1274) cornerwise +1275) cornerman +1276) cornermen (plural of cornerman) +1277) Missourian +1278) eww (informal: exclamation) +1279) untypical (+ally) +1280) counter-jumper +1281) counter-offer (+plural) +1282) plumed (merged into plume) +1283) plume-like (fixed plumelike) +1284) plumbous +1285) blackleaded (merged into blacklead) +1286) duotone (+plural) +1287) duopolies (plural of duopoly) +1288) duology (+plural) +1289) underwork (+ed) +1290) alley-oop +1291) underpainting +1292) underperform (+s +ing) +1293) underperformance +1294) underplant (+s +ed) +1295) arbovirus (+plural) +1296) antibiosis +1297) bioenergy +1298) bioengineer (+s +ed) +1299) bioethical +1300) bioethicist (+plural) +1301) xenograft (+s) +1302) allograft (+s) +1303) homograft (+s) +1304) chemotaxis +1305) chemotactic +1306) secretor (+s) +1307) secretory +1308) meningioma (+plural) +1309) meningiomata (another plural of meningioma) +1310) meningitic +1311) flavivirus (+plural) +1312) seropositive +1313) seropositivity +1314) seronegative +1315) seronegativity +1316) seroprevalence +1317) SSD (+plural +'s) +1318) IOPS +1319) mSATA +1320) Z80 +1321) tablier +1322) handcraft (+ed) +1323) candleholder (+plural) +1324) beadwork +1325) Polokwane (town in northern South Africa) +1326) Polonnaruwa (town in NE Sri Lanka) +1327) reptoid (+plural) +1328) poltroonery +1329) counteragent (+plural) +1330) counterblast +1331) counterbore (+plural) +1332) countercharge (+plural) +1333) countercheck (+plural) +1334) south-western +1335) wingbeat (+plural) +1336) sailplane (+plural) +1337) reimagine (+ed) +1338) groundbreaking +1339) groundbreaker (+plural) +1340) Shaolin +1341) teammate (+plural - fixed: team-mate) +1342) ninjutsu +1343) aikido +1344) McAfee +1345) cyber +1346) apparat (Oxford: chiefly historical) +1347) Mandela's (added the 's) +1348) Obama (name of person + 's) +1349) Snowden (name of person + 's) +1350) MasterCard +1351) Moodle's (added the 's) +1352) workflow (+plural) +1353) 720p +1354) 1080i +1355) 1080p +1356) artemisia (+plural) +1357) santolina (+plural) +1358) bloodroots (added plural) +1359) Emily (name + 's) +1360) H.264 +1361) Corel +1362) brushstroke (+plural) +1363) 1024x768 +1364) 1366x768 +1365) 800x600 +1366) 640x480 +1367) 320x240 +1368) 1280x720 +1369) 1920x1080 +1370) 1280x720p +1371) 1920x1080i +1372) 1920x1080p +1373) nasogastric +1374) nasopharynx +1375) nasopharyngeal +1376) mucosae (plural of mucosa) +1377) mucosal +1378) stroma +1379) stromata (plural of stroma) +1380) stromatoporoid (+plural) +1381) edaphosaurus (+plural) +1382) opacify (+s +ed +ing +er) +1383) oesophaguses (another plural of oesophagus) +1384) signifieds +1385) signifiers +1386) signifié (another term for signified) +1387) Harris (added 's) +1388) signifiant +1389) middleware +1390) choirgirl (+plural +'s) +1391) choisya (+plural) +1392) cowbane +1393) Nathel (name) +1394) eyehole (+plural) +1395) eyeline +1396) eyeliner (+plural) +1397) eyepatch +1398) fisheye +1399) fishbowl +1400) railroad (+plural +ing +ed) +1401) railman +1402) railmen (plural of railman) +1403) Horwich (name) +1404) railwayana +1405) raiments (plural) +1406) couchette (+plural) +1407) couchant +1408) addorsed +1409) coudé +1410) testee (+plural) +1411) fundus +1412) fundi (plural of fundus) +1413) funebrial +1414) micropipette (+plural) +1415) micropig (+plural) +1416) microphotograph (+s +ic +y) +1417) microphagous +1418) microphagic +1419) phytochemical (+plural) +1420) phytochrome +1421) phytogenetic +1422) phytogeography +1423) phytolith (+plural) +1424) lumens (plural) +1425) biogenic +1426) biogenesis +1427) biogenetic +1428) biogas +1429) high-pass +1430) sthenic +1431) veratrum (+plural) +1432) veratrine +1433) chimichanga (+plural) +1434) chimichurri +1435) burrito (+plural) +1436) drop-down +1437) pull-in +1438) cafe (+plural) +1439) brassard (+plural) +1440) brass-necked +1441) glissandos (plural, there is also glissandi) +1442) glissé (+plural) +1443) glitterati (Oxford: informal) +1444) Bollywood +1445) bollworm (+plural) +1446) sprayings (plural) +1447) horntail (+plural) +1448) Hornung (name of person) +1449) cracksman +1450) cracksmen +1451) cracknel (+plural) +1452) bucatini +1453) clementine (+plural - both lowercase - the fruit) +1454) cheesemonger (+plural) +1455) cheesewood +1456) cheffing + cheffed (merged into chef) + + +V2.11 - 1-APR-2014 +------------------ +1457) curriculum vitae +1458) curricula vitae (plural of curriculum vitae) +1459) multiparty +1460) polyphase +1461) polyphasic +1462) multiplatinum +1463) multiplay +1464) fabulate (+ion) +1465) fabulator +1466) fabulist (+plural +') +1467) autochange (+er) +1468) airbag (+plural) +1469) airband +1470) airbed +1471) airboat +1472) airbricks (added plural) +1473) stairlift (+plural) +1474) stairhead +1475) rundown +1476) staithe (+plural) +1477) double-ender +1478) notes inégales +1479) touchscreen (+plural) +1480) touchpoint (+plural) +1481) touchpad +1482) touchless +1483) toucher (+plural) +1484) faceplates (added plural) +1485) facetiae +1486) epigraphic (merged into epigraphy) +1487) epigraphically (merged into epigraphy) +1488) epigraphist (merged into epigraphy) +1489) epigrammatically +1490) trachoma +1491) trachomatous +1492) acetogenic +1493) biofilm (+plural) +1494) bioenergetics +1495) bioelectric +1496) bioelectrical +1497) supramolecular +1498) phospholipid (+plural) +1499) proteinase (+plural) +1500) proteoglycan (+plural) +1501) sulfate (+plural - another form of sulphate) +1502) alkene (+plural) +1503) alicyclic (+plural) +1504) cyclohexane +1505) involutes (+plural) +1506) parapodium +1507) parapodia (plural of parapodium) (+parapodial) +1508) polychaete (+plural) +1509) bryozoan (+plural) +1510) pustulate (+ing +ion) +1511) pussyfooter (+plural) +1512) pussycat (+plural) +1513) pussy-whip (+ed - Oxford: vulgar slang) +1514) multifold +1515) New Ager (+plural) +1516) New Ageism +1517) New Age +1518) groundbait (+ing) +1519) ground-to-air +1520) crosstrees +1521) flexitarian (+plural) +1522) nightlife +1523) ragweed +1524) bottlebrush (+plural) +1525) multi-agency +1526) multiaxial +1527) biohazard (+plural) +1528) bioindicator (+plural) +1529) seabird (+plural) +1530) murrelet (+plural) +1531) steelhead +1532) eutectoid +1533) user-friendly (added +ier +est +ness) +1534) user-hostile +1535) darknet +1536) backlight (+ed +ing) +1537) backlift +1538) backline +1539) backlink (+plural) +1540) cellmate +1541) Whitemoor (name) +1542) Sundberg (name) +1543) multiculturalist +1544) multiculturally +1545) multidirectional +1546) multifaith +1547) multifactorial +1548) electrocoagulation +1549) electrocautery +1550) aeromedical +1551) aeromagnetic +1552) aerolite (+plural) +1553) aerogramme +1554) aerogel (+plural) +1555) aeroelasticity +1556) aeroelastic +1557) under-read +1558) speedo (+plural - Oxford: short informal for speedometer) +1559) Speedos (Oxford: trademark Men’s brief, tight swimming trunks) +1560) speedballs (added plural) +1561) punchball +1562) Saughton (name) +1563) methamphetamine +1564) methanal +1565) flocculant (+plural) +1566) whistle-blowing +1567) telescreen +1568) Morrisons (name) +1569) long-stay +1570) multicore +1571) binational +1572) binate +1573) cross-compiler +1574) autoresponder +1575) autorotate +1576) autorotation (+plural) +1577) autosave (+ing +ed) +1578) autoroutes (added plural) +1579) autoshaping +1580) Comanches (added plural) +1581) Lakota (+plural) +1582) anti-ageing +1583) anti-American +1584) anti-British +1585) anti-capitalist +1586) anti-capitalism +1587) anti-Christian +1588) anti-constitutional +1589) anti-corruption +1590) anti-democratic +1591) anti-emetic +1592) anti-feminist +1593) anti-feminism +1594) anti-fraud +1595) anti-gay +1596) right-click +1597) cybernauts (added plural) +1598) cyberculture +1599) cyberespionage +1600) backchannel (+plural) +1601) backcast (+plural) +1602) left-click +1603) Hilberg (name +') +1604) unfeasible (+bly) +1605) unfeasibility +1606) unfavourite (merged into favourite) +1607) misconfigure (+ed) +1608) bitmapping + bitmapped (merged into bitmap) +1609) CCD +1610) Williard (name) +1611) neonatologist +1612) neonatology +1613) neonicotinoid (+plural) +1614) pyrethroid (+plural) +1615) neopaganism +1616) neopagan (+plural) +1617) neophobia +1618) neophobic +1619) neontology +1620) neontological +1621) catabolism +1622) catabolic +1622) catabolize (+ing) +1623) biosynthesis +1624) biosynthetic +1625) metaphysician (+plural) +1626) metaplasia +1627) metaplastic +1628) by-blow +1629) Mendelssohn (added 's) +1630) goop +1630) goopy (+ness +er +est) +1631) goosander (+plural) +1632) waterbird (+plural) +1633) waterbed (+plural) +1634) footboard (+plural) +1635) alright +1636) footbrake (+plural) +1637) rpm +1638) footgear +1639) footle +1640) facade (also façade) +1641) footmark (added singular) +1642) tobyman + tobymen +1643) Witherington (name) +1644) Higton (name) +1645) ottocento +1646) mulattos (plural) +1647) vice anglais +1648) magnesian +1649) ultrabasic +1650) volcanicity +1651) geopark +1652) geomorphologist (merged into geomorphology) +1653) catastrophism +1654) catastrophist +1655) uniformitarianism +1656) gralloch +1657) superhelix +1658) superhelices +1659) superhelical +1660) superheavyweight +1661) superheavy +1662) supergroup +1663) supergravity +1664) superstring (+plural) +1665) supersymmetry (+ic) +1666) supertax +1667) supertwist +1668) LCD's (added the 's) +1669) multibillion +1670) multibuy (+plural) +1671) telepathist (merged into telepathy) +1672) telepathise (merged into telepathy) +1673) empath +1674) clairaudience +1675) clairaudient +1676) apozem (+plural - Oxford: archaic) +1677) electuary (+plural - Oxford: archaic) +1678) qubit (+plural) +1679) autodialler + autodials + autodialling + autodialled (merged into autodial) +1680) autocue (fix: It only accepted uppercase - in Oxford it is in lowercase) +1681) filmgoer (+plural) +1682) somatically +1683) microinject (+ed +ing) +1684) microinjection +1685) postdoctoral +1686) mutagenesis +1687) mutagenicity +1688) blastoderm +1689) syncytium +1690) syncytia +1691) syncytial +1692) plasmodium +1693) plasmodia +1694) plasmodial +1695) trophoblast (+plural +ic) +1696) trisomy (+plural) +1697) monosomy (+ic) +1698) Wacker (name) +1699) dystopias (plural) +1700) dystopian (+plural) +1701) dystopic +1702) Vorticist (+plural) +1703) Vorticism +1704) Bloomsbury +1705) Dadaism +1706) Dadaist (+ic) +1707) vortical +1708) vortically +1709) vorticose +1710) vorticular +1711) vorticella (+plural) +1712) araneid (+plural) +1713) wickiup +1714) wicketkeeper (+plural) +1715) wicketkeeping +1716) supersize (+s +ing +ed) +1717) supersensitive +1718) unaspirated +1719) forma (+plural) +1720) formae (another plural of forma) +1721) overleap (+s +ed) +1722) overleapt +1723) overlarge +1724) beget (+s +ing +er +est) +1725) foredune (+plural) +1726) embayment (+plural) +1727) longshore +1728) longship (+plural) +1729) longlist (+plural) +1730) shortlist (+s +ed) +1731) shortlistee (+plural) +1732) shorthold +1733) thug-like +1734) shorthair (+plural) +1735) short-tempered + + +V2.12 - 1-MAY-2014 +------------------ +1736) hurrahed + hurrahing (merged into hurrah) +1737) extrados +1738) intrados +1739) voussoir (+plural) +1740) Lillie (name) +1741) Udmurt +1742) Votyak (former term for the language Udmurt) +1743) Casio (+'s - company) +1744) W +1745) Windows XP +1746) status quo +1747) deadlight (+plural) +1748) deadeye (+plural) +1749) greenie (+plural) +1750) whinge (+s +ing +ed) +1751) whingeing (another form of the previous one) +1752) stonechat (+plural) +1753) wheatear (+plural) +1754) figbird (+plural) +1755) forktail (+plural) +1756) sunbird (+plural) +1757) downcurved +1758) leafbird (+plural) +1759) bulbul (+plural) +1760) drongo (+plural) +1761) drongoes (another plural of the previous one) +1762) bee-eater (+plural) +1763) bee-stung +1764) sunblind (+plural) +1765) sunbittern (+plural) +1766) antbird (+plural) +1767) hoatzin (+plural) +1768) manakin (+plural) +1769) cotinga (+plural) +1770) Neotropical +1771) neotropics +1772) fernbird (+plural) +1773) fernbrake +1774) ferox +1775) butterfish (+plural) +1776) butterflying + butterflied (merged into butterfly) +1777) superfamily (+plural) +1778) superfecundation +1779) superfetation +1780) ecdysis +1781) ecdysial +1782) clavate +1783) thalli +1784) thallus +1785) thallophytes (plural) +1786) cyanophyte (+plural) +1787) dysenteric (merged into dysentery) +1788) dysfunctionality +1789) dysgraphia +1790) dysgraphic +1791) transracial +1792) wildwood +1793) redshank (+plural) +1794) oystercatcher (+plural) +1795) turnstones (plural) +1796) transsexuality +1797) transputers (plural) +1798) chipmakers (plural) +1799) photonics +1800) photonegative +1801) photomultipliers (plural) +1802) photonic +1803) echograph +1804) echogram (+plural) +1805) echocardiograph (+y +ic) +1806) auscultatory +1807) cervicitis +1808) vaginosis +1809) preterm +1810) backmarker (+plural) +1811) backlot (+plural) +1812) backload (+plural) +1813) dropside (+plural) +1814) dropseed +1815) buttonbush (+plural) +1816) Lesley (name) +1817) hatband (+plural) +1818) hatbox (+plural) +1819) weighbridges (plural) +1820) backstroker (+plural) +1821) downhillers (plural) +1822) downhole +1823) doodah (Oxford: informal) +1824) doodly-squat (another term for diddly-squat) +1825) plenish (+ed) +1826) pleiotropy +1827) euroland +1828) eurozone +1829) Eurotrash +1830) Eurosceptic +1831) Eurosceptical +1832) Europoort +1833) Europhobe +1834) Europhile +1835) Europop +1836) Eurovision +1837) Athenaeum +1838) inunction +1839) linoleate +1840) oleate +1841) OLEDs (plural) +1842) peaberry (+plural) +1843) bibelot (+plural) +1844) grotesques (plural) +1845) elementals (plural) +1846) elementalism +1847) uncombined +1848) thaumaturge (+ic +ist +y) +1849) thaumaturgical +1850) mage (+plural) +1851) divinatory +1852) demonolatry +1853) candomblé +1854) Umbanda +1855) macumba +1856) maculate (+ed +ion) +1857) gouache (+plural) +1857) aquarelle (+plural) +1858) pegmatite (+plural) +1859) spessartine +1860) pyrope +1861) grossular +1862) almandine +1863) carnotite +1864) vanadate +1865) autunite +1866) uraninite +1867) vanadinite +1868) columbium +1869) Alentejo (name of region in Portugal) +1870) Galicia (name of region in Spain) +1871) Galician +1872) Callisto (name) +1873) callop (+plural) +1874) mulloway +1875) fingerlings (plural) +1876) parr +1877) smolt (+plural) +1878) amphipod (+plural) +1879) filmset (+ing +er) +1880) filmography (+plural) +1881) filmstrips (plural) +1882) filopodium +1883) filopodia (plural of filopodium) +1884) filopodial (merged into filopodia) +1885) pseudopodium +1886) pseudonymity +1887) pseudonymously +1888) pseudopods (plural) +1889) spermatidal +1890) biorhythmic (merged into biorhythm) +1891) biosafety +1892) biosecurity +1893) bioscientist (merged into bioscience) +1894) axoneme (+plural +axonemal) +1895) microtubule (+plural) +1896) microvascular +1897) cytoskeleton +1898) cytoskeletal +1899) abiotic +1900) abiogenesis +1901) abiogenic +1902) sinters (plural +ed +ing) +1903) flocculent +1904) flocculence +1905) haploidy (merged into haploid) +1906) autosome (+plural) +1907) autosomal +1908) Josh (name) +1909) cryonic (+s +ally) +1910) cryopreserved (merged into cryopreserve) +1911) autotransplant (+s +ion +ed) +1912) splenic +1913) bacilliform +1914) trinomial (+plural) +1915) superspecies +1916) downtrend +1917) downturned (merged into downturn) +1918) dot-com (+plural +er) +1919) dot-org +1920) dot-bomb (+plural) +1921) bloggers (plural) +1922) cyberspying +1923) cybersphere +1924) cyberslacker (+plural) +1925) cyberslacking +1926) bloatware +1927) gigapixel (+plural) +1928) bookmarklet +1929) clickjacking +1930) clickstream (+plural) +1931) client-server +1932) clientele +1933) upscale (+s +ed +ing) +1934) downrate (+ed) +1935) downmarket +1936) downlight (+s +er +ing) +1937) ludic +1938) schoolteaching +1939) Madison (added the 's) +1940) schoolmasterly (merged into schoolmaster) +1941) schoolmastering (merged into schoolmaster) +1942) bookselling +1943) bookplate (+plural) +1944) floorman +1945) floormen +1946) floorpan +1947) underbody (+plural) +1948) underboss (Oxford: informal) +1949) underbridge (+plural) +1950) overbridge (+plural) +1951) overbreed (+plural) +1952) overbred (past and past participle of the previous word) +1953) overboot (+plural) +1954) overboldly (merged into overbold) +1955) overboldness (merged into overbold) +1956) oversail (+plural +ing) +1957) euro (+plural) +1958) freewheel (+ed +ing) +1959) entresol +1960) pointe +1961) entropically +1962) entrustment (merged into entrust) +1963) entropion +1964) trichiasis +1965) luxate (+ed +ing +ion) +1966) dysplasia +1967) dysplastic +1968) adenoma (+plural) +1969) adenomata (another plural form of the previous word) +1970) herpetofauna (+al) +1971) bifid +1972) ampulla +1973) ampullae (plural of the previous word) +1974) autograft (+plural) +1975) conjunctival (merged into conjunctiva) +1976) autographic (merged into autograph) +1977) autography (merged into autograph) +1978) autoharp +1979) autohypnosis +1980) autointoxication +1981) flameout (+plural) +1982) flameproof +1983) flamethrower +1984) investigable +1985) investable (merged into invest) +1986) investible (merged into invest) +1987) canonicals (added plural) +1988) replaced salt-water with saltwater (fix) +1989) saltwort +1990) comfrey (+plural) +1991) canoness (+plural) +1992) archiepiscopacy (+plural) +1993) archiepiscopate +1994) Eurocommunism +1995) Eurocommunist +1996) Gramsci (+'s - name) +1997) eurocreep (Oxford: informal) +1998) Eurodollar (+plural) +1999) Eurocrat (+plural) +2000) Eurobond (+plural) +2001) Euro-MP (+plural) +2002) coalhouse +2003) coalfish (+plural) +2004) arenosol (+plural) +2005) arenavirus (+plural) +2006) adenovirus (+plural) +2007) adenoviral +2008) corynebacterium +2009) corynebacteria (plural of previous word) +2010) coryphée (+plural) +2011) ballboy (+plural) +2012) dogshore (+plural) +2013) autofocusing (merged into autofocus) +2014) autofill +2015) autoecology +2016) rallycross +2017) milord (+'s - word of the day in Oxford Dictionary) +2018) milometer +2019) mileometer (another word for the previous word) +2020) close-ratio +2021) jink (+ed +s +ing) +2022) ju-jutsu (another way of writing it) +2023) kung fu +2024) unvalidated +2025) unvaccinated +2026) aeromodelling +2027) aeromodeller +2028) angiogenesis +2029) dermatome (+plural) +2030) tragus +2031) tragi (plural of previous word) +2032) friarbird (+plural) +2033) raptor (+plural) +2034) gravlax +2035) gravadlax (another way of writing the previous word) +2036) caviar (also caviare) +2037) cavewoman +2038) cavewomen +2039) unfriend (+ed +ing) +2040) unfollow (+ed +ing) +2041) underway (also "under way") +2042) homeowner (+plural) +2043) teenybopper (+plural) +2044) teenybop +2045) teenaged (merged into teenage) +2046) teensy +2047) teensier + teensiest (merged into teensy) +2048) overpack (+s +ed) +2049) overnighted + overnights + overnighter (merged into overnight) +2050) overmuch +2051) overmighty +2052) overman (+s +ed +ing) +2053) overlordship +2054) overlooker (+plural) +2055) overlong +2056) overlock (+ed) +2057) overlocker (+plural) +2058) mudstone +2059) afferents (added plural) +2060) cholinergic +2061) fairwater +2062) dockage +2063) fah (Oxford: also fa) +2064) soybean (+plural) +2065) satanize + satanise (both possible - +s +ed) +2066) shitted (merged into shit) +2067) shat (Oxford: past participle shitted or shit or shat) +2068) autocephalous +2069) coachwood (+plural) +2070) coachwhip +2071) bird-like +2072) bipedality +2073) EuroMillions +2074) biphasic +2075) blackbuck (+plural) +2076) brushtail +2077) brushback (+plural) +2078) brush-turkey (+plural) +2079) Seychellois (place) +2080) Byelorussia (place - also Belorussia) +2081) bellyboard (+s +er +ing) +2082) bellyflop (+s +ed +ing) +2083) bellyband +2084) breasthook (+plural) +2085) breastfeeds (plural) +2086) breastpin (+plural) +2087) breaststroker (+plural) +2088) breastsummer +2089) biotecture +2090) bioterrorism +2091) bioterrorist +2092) biotherapy (+plural) +2093) agriproducts (plural) +2094) agriscience (+ist) +2095) agritourism +2096) destock (+ing) +2097) telecom (+plural - both in lower case) +2098) telecomputer (+plural) +2099) telecomputing +2100) debacle (+plural) +2101) deattribute (+ed) +2102) deattribution +2103) conservatoires (added plural) +2104) deathtrap +2105) death-or-glory +2106) death-dealing +2107) death-obsessed +2108) cupholder +2109) box-shifter (+plural) +2110) boxboard +2111) anti-tank +2112) bumboat (+plural) +2113) bumfluff +2114) Antichrists (added plural) +2115) animatronic (+plural) +2116) anime (Japanese cartoons) +2117) manga (Japanese cartoons) +2118) manfulness +2119) quadragenarian +2120) quadplex +2121) Eid (Muslim festival) +2122) Azania (name of place) +2123) Azanian +2124) azeotrope (+s +ic) +2125) fusel oil (+plural) +2126) monocoque +2127) polyclonal +2128) analyte (+plural) +2129) circumcircle (+plural) +2130) incircle +2131) incipit (+plural) +2132) universalist (+plural) +2133) Quaker (+plural) +2134) Quakerish +2135) Quakerism + + +V2.13 - 1-JUN-2014 +------------------ +2136) iPod (+plural) +2137) hoody (+plural) +2138) hoodie (+plural) (another form of the previous word) +2139) operant (+plural) +2140) operantly (merged into operant) +2141) pneumonectomy (+plural) +2142) pneumonic +2143) bronchopneumonia +2144) pneumonoultramicroscopicsilicovolcanoconiosis +2145) pruritus + pruritic +2146) bulla +2147) bullae (plural of previous word) +2148) sacs (added plural) +2149) sac-like +2150) aneurysmal (merged into aneurysm) +2151) subarachnoid +2152) subantarctic +2153) subagency (+plural) +2154) subagent (+plural) +2155) subadult (+plural) +2156) never-changing +2157) never-dying +2158) never-failing +2159) candlenut (+plural) +2160) Portlaoise (name) +2161) Portlaoighise (another form for the previous word) +2162) galangal +2163) lemongrass +2164) lemonwood +2165) candleberry (+plural) +2166) subacid +2167) greenbottle (+plural - Oxford: A metallic green fly) +2168) canola +2169) Bayer (name of company) +2170) UFO's (added the 's) +2171) Schratt (name) +2172) cyberbullying (merged into cyberbully) +2173) cyberbullies (plural - merged into cyberbully) +2174) cybercast (+s +ing) +2175) cyberchondriac (+plural) +2176) cyberchondria +2177) cyberphobics (added plural) +2178) constitutionalism +2179) statism +2180) statist (+plural) +2181) cardiological +2182) cardiographer + cardiography (merged into cardiograph) +2183) bootloader +2184) bootlick (+ing) +2185) disenchantingly +2186) disempower (+s +ing +ed +ment) +2187) disembarrass (+ed +ing +ment) +2188) diseconomy (+plural) +2189) initialling (merged into initial) +2190) retrievability +2191) laddish (+ness) +2192) mis-sell + mis-selling + mis-sold +2193) misallocate (+s +ed +ing +tion) +2194) misandry +2195) misanthropical +2196) misapprehensive +2197) imperceptive +2198) imperator + imperatorial +2199) bioarchaeology +2200) bioarchaeological +2201) bioarchaeologist +2202) bioactive +2203) bioactivity +2204) monolayer (added singular) +2205) multilinguals (added plural) +2206) scaleless (merged into scale) +2207) endothermal +2208) endotoxin (+plural) +2209) exotoxin (+plural) +2210) tiki (+plural) +2211) removed "informations" since it is a singular word only +2212) blagueur (rare) +2213) vestiary (+plural) +2214) cruciate +2215) interphase +2216) metaphase +2217) radiobiology +2218) radiobiological + radiobiologically +2219) radiobiologist (+plural) +2220) repairability +2221) multimodal +2222) multimeter (added plural) +2223) cryobiology + cryobiologist +2224) cryobiological +2225) andropause + andropausal +2226) terraform (+ing) +2227) terraformer (+plural) +2228) airscrew (+plural) +2229) triplanes (added plural) +2230) airside +2231) buff-tip +2232) dialectology + dialectological + dialectologist +2233) diatheses (plural of diathesis) +2234) sterol (+plural) +2235) sphingolipid (+plural) +2236) condonation (merged into condone) +2237) neo-Nazi (+plural) +2238) neo-Nazism +2239) neo-Marxist (+plural) +2240) neo-Marxism +2241) neo-liberal (+plural) +2242) neo-liberalism +2243) communalism +2244) communalist (+plural +ic) +2245) neocolonial +2246) neocolonialist (+plural) +2247) neoconservative (+plural) +2248) neoconservatism +2249) neocortices (plural of neocortex) +2250) neocortical +2251) neurologic (merged into neurology) +2252) neurolinguistic (+plural) +2253) analphabetic +2254) aspheric (+ally) +2255) aspherical +2256) fluxional +2257) fluxion (+plural) +2258) fluxgate +2259) demagnetizer +2260) demagnetiser +2261) chaology (+ist) +2262) semi-classical +2263) semi-conservative +2264) reinstalment +2265) Gerrit (software) +2266) occultation (merged into occult) +2267) occultist (+plural) +2268) occultness (merged into occult) +2269) contactless +2270) contact-breaker +2271) gnomon (+plural) +2272) (merged gnomonic into gnomon) +2273) Arminian (+plural) +2274) Arminianism +2275) popery +2276) Popemobile +2277) jokester +2278) jokesmith (+plural) +2279) biggies (added plural) +2280) Bigfoot +2281) Bigfeet (plural of previous word) +2282) bigeneric +2283) falcate +2284) emerald-cut +2285) dustheap +2286) dustcoat (+plural) +2287) dustcarts (added plural) +2288) barney (+plural) +2289) bunfight (+plural) +2290) backstabbings (added plural) +2291) Milroy (name) +2292) bungarotoxin +2293) neurotoxin (+plural) +2294) neurotoxic +2295) neurotoxicity +2296) neurotoxicology +2297) neurotrophic +2298) neurotypical +2299) user-definable +2300) user-generated +2301) unlikeable (merged into likeable) +2302) unliberated +2303) unlet (merged into let) +2304) unlearnedly +2305) unlay (+ing) +2306) unlaid (past and past participle of previous word) +2307) sensorimotor +2308) sensorineural +2309) sensorily (merged into sensory) +2310) subclavian +2311) semi-retired +2312) semi-opera (+plural) +2313) semi-modal +2314) semi-liquid (+plural) +2315) semi-invalid +2316) semi-lethal +2317) semi-fluid +2318) semi-finalist (+plural) +2319) semi-double +2320) semi-documentary (+plural) +2321) clock-watch (+ing +er) +2322) clockmakers (added plural) +2323) clockmaking +2324) chronographic (merged into chronograph) +2325) chronobiology +2326) chronobiologist (+plural) +2327) viewports (added plural) +2328) viewscreen +2329) hi-fi (+plural - fix: made it lowercase like in Oxford) +2330) hi-res (Oxford: informal) +2331) high-res (Oxford: informal - another form of the previous word) +2332) biopharma (+plural) +2333) unmunch (+s +ed +ing) +2334) focaccia +2335) Mailänder (name) +2336) backwards-compatible +2337) backward-compatible +2338) bottom-dwelling +2339) bottom-dweller (+plural) + + +V2.14 - 1-JUL-2014 +------------------ +2340) hard-code (+ed) +2341) autocorrecting (merged into autocorrect) +2342) autarchy (+ic +plural +al) +2343) autarky (same as the previous word - +plural +ic) +2344) marcasite +2345) microcrystalline +2346) microcredit +2347) irredeemability +2348) irrecusable +2349) bullseyes (added plural) +2350) bullshot +2351) inter-agency +2352) inter-allied +2353) inter-class +2354) interactant +2355) interactionism +2356) interactionist +2357) interarticular +2358) interatomic +2359) interbed (+ed) +2360) mudstones (added plural) +2361) shakuhachi (+plural) +2362) flat-top (+plural) +2363) flatbed +2364) formational (merged into formation) +2365) endpaper (added singular) +2366) electrotyper (added singular) +2367) electrotherapeutic +2368) electrotherapeutical +2369) electrosurgery +2370) electrosurgical +2371) electrotechnology +2372) electrotechnic (+s) +2373) electrotechnical +2374) electrothermal +2375) toolkit +2376) drop-dead +2377) englacial +2378) enginery +2379) gearhead (+plural) +2380) notchy (+ier +est) +2381) telemark (+ing) +2382) triclinic +2383) tricot +2384) catteries (added plural) +2385) diphtherial (merged into diphtheria) +2386) diphtheritic +2387) porphyria +2388) neuropathies (added plural) +2389) neuropath (+plural) (+ merged ic into it) +2390) acetylcholine +2391) Alzheimer (+ 's) +2392) alyssum (+plural) +2393) Solaris (OS) +2394) Arial (font) +2395) Verisign (+'s - company name) +2396) DNS +2397) Symantec (+'s - company name) +2398) courseware +2399) coursebook (+plural) +2400) blipvert (+plural) +2401) offshores + offshored (merged into offshore) +2402) eBay (+er) +2403) shovelboard +2404) shovelhead (shark) +2405) bonnethead (shark) +2406) blackfish (+plural) +2407) blackfly (+plural) +2408) astroturfing +2409) astrophotography +2410) astrophotographer (+plural) +2411) astrophotographic +2412) breakbeat (+plural) +2413) breakdance (+ing +er +ed) +2414) PCI +2415) HDDs (added plural) +2416) headquarter (added singular + ed) +2417) OEMs (added plural) +2418) Gb +2419) NAS +2420) drive's (added the 's) +2421) MMX +2422) cacheing (it can also be written caching) +2423) cacheable (merged into cache) +2424) cacheless (merged into cache) +2425) uncached +2426) rebrand (+ing) +2427) webcast (+plural +ing +er) +2428) videoconferences (added plural) +2429) videogram (+plural) +2430) headnotes (added plural) +2431) accretive +2432) amassment (+plural) +2433) bodger (+plural - Oxford: British informal) +2434) 'gainst (Oxford: short for against) +2435) unsex (+ed +s) +2436) epicene +2437) stepdad (+plural - Oxford: informal) +2438) stepfamily (+plural) +2439) stepmum (+plural - Oxford: informal) +2440) Stepford (name) +2441) robotically +2442) robotisation +2443) sh*tless (merged into sh*t - Oxford: vulgar slang) +2444) sh*thouse (Oxford: vulgar slang) +2445) sh*thead (Oxford: vulgar slang) +2446) sh*tface (Oxford: vulgar slang) +2447) shi*hole (Oxford: vulgar slang) +2448) trafficless (merged into traffic) +2449) downslope (+plural) +2450) eyeballed + eyeballing (merged into eyeball) +2451) brachycephalic +2452) brachycephaly +2453) registrant (+plural) +2454) registrarship +2455) rheumatology (+ist) +2456) rheumatological +2457) francophones (added plural) +2458) simple-mindedness (merged into simple-minded) +2459) uncompounded +2460) uncompanionable +2461) uncommunicated +2462) undeciphered +2463) undecided (+s +ly - merged into a new word) +2464) shilly-shally (+s +ing +ed +ier) +2465) shilly-shallyer (previous word can also have this form) +2466) precoital (+ally) +2467) precolonial +2468) preconcert (+ed) +2469) preconsciousness (merged into preconscious) +2470) precycling +2471) showbizzy (merged into showbiz) +2472) showband (+plural) +2473) bandmate +2474) bandleader (+plural) +2475) banditti (another plural of bandit) +2476) arse (+ed - Oxford: vulgar slang) +2477) interceders (added plural) +2478) interdental +2479) intercut (+s +ing) +2480) intercultural +2481) interculturalism +2482) intercross (+plural +ing) +2483) intercostals (added plural) +2484) intercool (+ed +er) +2485) intercontinentally +2486) intercommunity +2487) intercommunion +2488) anthropomorphize +2489) anthropomorphise (another form of the previous word) +2490) antinomians (added plural) +2491) antinomianism +2492) catechetics +2493) catechesis +2494) catchily + catchiness (merged into catchy) +2495) Chiu's (name - added the 's) +2496) examinee (added singular) +2497) backflip (+plural) +2498) backflow +2499) ATX +2500) reaccept (+ed) +2501) reacceptance +2502) reabsorption +2503) re-sort (+ing) +2504) compostable (merged into compost) +2505) composter (merged into compost) +2506) budstick (+plural) +2507) budwood +2508) budworm (+plural) +2509) earworm (+plural) +2510) silviculture (+al +ist) +2511) agro-industry (+plural +al) +2512) foodgrain (+plural) +2513) agronomical +2514) agronomically +2515) agrobiology +2516) agrobiological +2517) agrobiologist +2518) agroecosystem (+plural) +2519) algicide (+plural) +2520) aeroponic (+s) +2521) aeroponically +2522) aerophone (+plural) +2523) gyroplane (+plural) +2524) fixed-wing +2525) crowdsource (+ed +ing) +2526) crowdfunding +2527) crowdfunded +2528) creatives (added plural) +2529) Johnson's (added the 's) +2530) astrobiology +2531) astrobiological +2532) astrobiologist (+plural) +2533) archipelagoes (Oxford: another way of archipelagos) +2534) circumnavigator +2535) subalpine +2536) treeline +2537) boreal + Boreal +2538) geotechnic (+s) +2539) geotechnical +2540) geothermally (merged into geothermal) +2541) cataclysmically +2542) Phoenician (+plural) +2543) Phoenicia +2544) bc ("Before Christ" in dates, can also be written in lower case) +2545) cross-post (+ing) +2546) cross-point +2547) rebreathe (+ed) +2548) rebreather (+plural) +2549) rebuildable (merged into rebuild) +2550) rebuilder (+plural) +2551) pumpkinseed (+plural) +2552) amberjack +2553) boxfish (+plural) +2554) trunkfish (+plural) +2555) brickyards (added plural) +2556) bricolage (+plural) +2557) genomics (added plural, suggested by the IRC nick on Mozilla wsmwk) +2558) proteomic (+plural) +2559) biomarker (+plural) +2560) microarray (+plural) +2561) proteome (+plural) +2562) bioinformatic (+plural) +2563) biographee (+plural) +2564) Lepidoptera + lepidoptera +2565) lepidopteran (+plural) +2566) lepidopterous +2567) decor (+plural) +2568) cliche (+plural) +2569) texted + texting + texter + textless (merged into text) +2570) merged self-consciousness into self-conscious +2571) check-ins (added plural) +2572) pissy (Oxford: vulgar slang) +2573) low-cut +2574) firefighter (+plural) +2575) firefight (+plural) +2576) firefighting (merged into firefight) +2577) firefish (+plural) +2578) fireguard +2579) firelit +2580) firelock (+plural) +2581) blowouts (added plural) +2582) blowlamp +2583) blown-up +2584) blowing-up +2585) blowhole (+plural) +2586) blowfishes (added plural - Oxford: it can also be blowfish) +2587) blowback +2588) karateka (+plural) +2589) judoka (+plural) +2590) sensei (karate teacher) +2591) break-fall +2592) break-off +2593) karate-chop +2594) off-message +2595) off-patent +2596) off-pitch +2597) off-plan +2598) 4x4 (+plural - vehicles) +2599) protestor (+plural - Oxford: another way for protester) +2600) Proteus (a God + satellite) +2601) penistone +2602) telepaths (added plural) +2603) teleost (+plural) +2604) paddlefish (+plural) +2605) garfish (+plural) +2606) bowfin (+plural) +2607) infraclass (+plural) +2608) ruche (+plural +ed +ing) +2609) dolman (+plural) +2610) batwing +2611) storylines (added plural) +2612) hairband (+plural) +2613) batwoman +2614) batwomen +2615) megalopolitan (+plural) +2616) megalosaurus (+plural) +2617) iguanodon (+plural) +2618) carnosaur (+plural) +2619) infraorder (+plural) +2620) decapod (+plural) +2621) allée (+plural) +2622) averment (+plural) +2623) gratifier (merged into gratify) +2624) assuagement (merged into assuage) +2625) sangfroid +2626) unflashy (merged into flashy) +2627) ugly-looking +2628) ill-smelling +2629) ill-shaped +2630) ill-prepared +2631) ill-proportioned +2632) masturbator +2633) mastoiditis +2634) otitis +2635) otoscope +2636) otoscopic +2637) otoscopically +2638) uncultivable +2639) uncured +2640) uncurtained +2641) uncustomary +2642) undead +2643) undebatable +2644) undecidable +2645) undecidability +2646) facades (added plural) +2647) wodge (+plural) +2648) gloop (+y) +2649) herby (+ier +iest) +2650) bakeware +2651) swigger (+plural) +2652) citrusy +2653) citrussy (another way of the previous word - merged into citrus) +2654) swifty (+plural) +2655) swiftie (another way of previous word) +2656) enchantedly +2657) enchainment (merged into enchain) + + +V2.15 - 1-AUG-2014 +------------------ +2658) Cordova (name) +2659) upsize (+ing) +2660) downshift (+s +ing) +2661) righto (Oxford: informal) +2662) righty-ho (Oxford: another way of the previous word) +2663) burbot (+plural) +2664) non-black +2665) non-biodegradable +2666) non-biological +2667) non-capital +2668) non-chemical +2669) non-Christian +2670) non-Catholic +2671) portrayers (added plural) +2672) filmdom (+'s) +2673) portrayable (merged into portray) +2674) autochrome +2675) over-simplistic +2676) over-sentimental +2677) nonsensicality +2678) Nonya +2679) noob (+plural Oxford: informal) +2680) cancelbot (+plural) +2681) backloaded (merged into backload) +2682) backlist (+plural) +2683) gilet (+plural) +2684) blaxploitation +2685) bardolatry +2686) bardolater (+plural) +2687) bardolator (+plural Oxford: another way of the previous word) +2688) florilegium (+plural) +2689) florilegia (another plural of the previous word) +2690) floriferous +2691) aide-memoire +2692) aides-memoire + aides-memoires (both plural of previous word) +2693) breveted + breveting (merged into brevet) + (Oxford says: brevets, breveting or brevetting, breveted or brevetted) +2694) compendiously + compendiousness (merged into compendious) +2695) addictively +2696) audiobook (+plural) +2697) audiogram (+plural) +2698) LP (+plural) +2699) boomy + boomier + boomiest + boominess +2700) boomers (added plural) +2701) bicolour (+ed) +2702) bicultural +2703) biculturalism +2704) areolate +2705) papule (+plural) +2706) papulae (another plural form of previous word) +2707) papular +2708) papulose +2709) papulous +2710) cholerically +2711) counterproductive +2712) counterproliferation +2713) counterpunch (+s +ed +ing) +2714) counterpuncher (+plural) +2715) counterrotate (+ing +ion) +2716) countershading +2717) countershaded +2718) counterstatement (+plural) +2719) countersubject +2720) counterterrorists (added plural) +2721) runaround +2722) juvenility +2723) juvenescence +2724) juvenescent +2725) ovotestis +2726) ovotestes (plural of previous word) +2727) ovoviviparous +2728) ovoviviparity +2729) coroneted (fix: coronetted and merged into coronet) +2730) bagwash +2731) bagworm (+plural) +2732) porkling +2733) cowhand +2734) Mb +2735) SecurDisc +2736) securable + securement + secureness (merged into secure) +2737) unthreatening +2738) unthreatened +2739) unthinkingness (merged into unthinking) +2740) unthinkability +2741) unthought +2742) unthread (+ed +ing) +2743) unthrifty + unthriftiness + unthriftily +2744) unthrone (+s +ed) +2745) Melbourne's (added the 's) +2746) DPhil (another way for PhD) +2747) nobble (+ing +ed) +2748) nobbler (+plural) +2749) bribable (merged into bribe) +2750) sawlog (+plural) +2751) peelers (added plural) +2752) bloodwort +2753) bloodwood (+plural) +2754) coastland (+plural) +2755) coasteering +2756) tuberculoid +2757) Hansen's (added the 's) +2758) lepromatous +2759) leprosarium (+plural) +2760) chemo (Oxford: informal) +2761) chemoattractant (+plural) +2762) granuloma (+plural) +2763) granulomata (another plural of previous word) +2764) granulomatous +2765) lurgy (+plural) +2766) bizarrerie (+plural) +2767) protogynous +2768) protogyny +2769) prolificacy +2770) geitonogamy +2771) geitonogamous +2772) xenogamy +2773) xenogamous +2774) autogamy +2775) autogamous +2776) agamospermy +2777) agamospermous +2778) unfertilized (ize) +2779) unfertilised (ise) +2780) enucleate (+ed +ion) +2781) protoplast (+plural) +2782) protoplanet +2783) protostar (+plural) +2784) circumlunar +2785) gibbosity +2786) Rushdie (name) +2787) Levinson (name) +2788) Patton (name) +2789) Naber (name) +2790) Moore’s (added the 's) +2791) narrational +2792) sidecar (+plural) +2793) indiscrete +2794) tonner +2795) doddle +2796) incidently +2797) imagesetter (+plural) +2798) imager (+plural) +2799) image-maker (+plural) +2800) dealmakers (added plural) +2801) dealign (+ed +ing +ment) +2802) dealfish (+plural) +2803) deal-breaker +2804) cardholder (added singular) +2805) B-movie (+plural) +2806) B-film (+plural) +2807) b'day (Oxford: informal - another short word for birthday) +2808) visuomotor +2809) visuospatial +2810) deistical +2811) carbon-14 +2812) carbo-load (+ing) +2813) spiderweb (+s +ed +ing) +2814) Kasparov (name) +2815) Abdullah (name) +2816) childmind +2817) childbed +2818) childminder (added singular + 's) +2819) childminding +2820) paraphrasable +2821) paraphrastic +2822) deverbal (+plural) +2823) primordium +2824) primordia (plural of previous word) +2825) autoradiograph (+s +ed +ic +y) +2826) acentric +2827) dicentric +2828) biotech (Oxford: short for biotechnology) +2829) morphologic + morphologist (merged into morphology) +2830) morphogenetic +2831) morphogenic +2832) morpholine +2833) basicity +2834) chromous +2835) chromospheric (merged into chromosphere) +2836) plage (+plural) +2837) plagiaristic +2838) morphometry (+ic) +2839) morphometrically +2840) morphometrics +2841) neuroimaging +2842) neurohormone (+plural) +2843) vasopressin +2844) procoagulant (+plural) +2845) glycoprotein (+plural) +2846) ecdysone +2847) synchronic +2848) synchronically +2849) Darwin's (added the 's) +2850) evolutional (+ly) +2851) evolutive +2852) complementarily (merged into complementary) +2853) semiosis +2854) personhood +2855) acrolect (+plural +al) +2856) syntagmatic (+s) +2857) syntagmatically +2858) syntagm (+plural) +2859) syntagmas (another plural of syntagm) +2860) syntagmata (another plural of syntagm) +2861) cognitivist (+plural) +2862) cognitivism +2863) functionalist (+plural) +2864) electrophysiology (+ist) +2865) electrophysiological (+ly) +2866) electroplax +2867) electroplaque (another way of the previous word) +2868) electropolish (+ed +ing) +2869) nitinol +2870) stent (+plural) +2871) stenotypes (added plural) +2872) stenotypist (+plural) +2873) stenothermal +2874) Princeton (name) +2875) steepled (merged into steeple) +2876) steeplechasers (added plural) +2877) bookman +2878) bookmen (plural of previous word) +2879) booklouse +2880) booklice (plural of previous word) +2881) bookland +2882) bumf +2883) bumph (another way of previous word) +2884) bumboy (Oxford: vulgar slang) +2885) bumbledom +2886) bumbag (+plural - Oxford: informal) +2887) bum-sucking (Oxford: vulgar slang) +2888) bum-sucker (Oxford: vulgar slang) +2889) bum-bailiff (+plural) +2890) crookery +2891) cronyism +2892) croneyism (another way of previous word) +2893) depositaries (added plural) +2894) redeposition +2895) upwelling +2896) multistage +2897) multitalented +2898) dequeueing (another way of dequeuing) +2899) defriend +2900) unsecure +2901) unsectarian +2902) unseaworthiness +2903) utopians (added plural) +2904) decontrols (added +s) +2905) decontaminant +2906) deconstructionism +2907) deconstructionist (+plural) +2908) postmodern (fix: removed post-modern) +2909) postmodify (+s +ing +ed +tion +er) +2910) postorbital (+plural) +2911) postmodernism (fix: removed post-modernism) +2912) postmodernist (fix: removed post-modernist) +2913) postmodernity +2914) postdoctoral (fix: removed post-doctoral) +2915) postcolonial (fix: removed post-colonial) +2916) fix: removed post-office as actually it is "post office" +2917) dreck (+y) +2918) dreckish +2919) savvy (+er +est +s +ing +ed) +2920) salaryman +2921) salarymen (plural of previous word) +2922) untether (+s +ed +ing) +2923) reframe (+s +ed) +2924) GMOs (added plural) +2925) sext (+ing +er) +2926) selfie (+plural) +2927) selfy (another way of the previous word) +2928) tagger (+plural) +2929) tagetes +2930) fulminant +2931) haemoptysis +2932) telepathize (IZE - +s +ed +ing) +2933) cryptocrystalline +2934) cryptocurrency (+plural) +2935) cryptogam (+s) +2936) cryptogamic +2937) orthoepy (+ic) +2938) orthoepist +2939) orthogenesis +2940) orthogenesist +2941) orthogenetic +2942) orthogenetically +2943) myosin +2944) actin +2945) antiparallel +2946) palaeopathology +2947) palaeopathological +2948) palaeopathologist (+plural) +2949) playsuit +2950) playscheme (+plural) +2951) after-school +2952) aftercare (fix: removed after-care) +2953) afterdamp +2954) afterworld +2955) aftersun +2956) bergamot +2957) inswing (+ing +er) +2958) insurrectionary +2959) underage (fix: removed under-age) +2960) underactive +2961) put-you-up +2962) cragsman +2963) cragsmen (plural of previous word) +2964) wisecracker (+plural) +2965) campfire (fix: removed camp-fire) +2966) campsite (fix: removed camp-site) +2967) Caesar's (added the 's) +2968) bedload +2969) wordlists (added plural) +2970) bedjacket +2971) bedight +2972) bedhead (+plural) +2973) lustrate (+ed +ion) +2974) lustral +2975) contemporarily (merged into contemporary) +2976) Moldovan (+plural) +2977) Andorran (+plural) +2978) NW (North-west) +2979) Azerbaijani (+plural) +2980) acetaldehyde +2981) bailor +2982) bailment +2983) recognisance (added singular) +2984) distraint +2985) disquisitional (merged into disquisition) +2986) disputatiousness (merged into disputatious) +2987) preadaptation (+plural) +2988) preadapt (+ed) +2989) theropod (+plural) +2990) cowbird (+plural) +2991) preachiness +2992) pre-vocational +2993) pre-wash +2994) pre-shrunk +2995) pre-shrink +2996) pre-sell +2997) pre-Roman +2998) pre-release +2999) pre-scientific +3000) pre-service +3001) pre-tension (+s) +3002) punctum +3003) puncta (plural of previous word) +3004) biomechanics +3005) biomechanical +3006) biomechanically +3007) biomechanist +3008) phagocytic (merged into phagocyte) +3009) degranulate (+ion) +3010) neutrophil (+plural) +3011) prostaglandin (+plural) +3012) reticuloendothelial +3013) mononuclear +3014) histologic (merged into histology) +3015) monomorphic +3016) monomorphism +3017) monomorphous +3018) lysozyme +3019) ferritin +3020) ferrimagnetic +3021) ferrimagnetism +3022) rhizosphere +3023) translocate (+s +ing +ed +ion) +3024) transmarine +3025) transman +3026) transmen (plural of previous word) +3027) transmembrane +3028) transmigrant (+plural) +3029) Pilates +3030) Pilate (name) +3031) pilastered (merged into pilaster) +3032) dentil (+plural) +3033) pyrolysed (merged into pyrolyse) +3034) spellchecks + spellchecked + spellchecking (merged into spellcheck) +3035) unpowered +3036) unpractical +3037) unpracticality +3038) unpossessed +3039) unpolitical +3040) unpolitic +3041) unpointed +3042) unpoetic +3043) unpoetical +3044) unpoetically +3045) Prometheus (name) +3046) unplumbable +3047) unacademic +3048) Unabomber (name) +3049) unabating +3050) unscalable +3051) unscaleable (another way of previous word) +3052) unsay (+s +ing) +3053) unsatisfyingly +3054) unsatisfactoriness +3055) unsanctified +3056) unsalaried +3057) biosignature +3058) downwash +3059) airstream (+plural) +3060) landside +3061) airmobile +3062) airmanship +3063) divulgation (+plural) +3064) divulgence +3065) Diwali +3066) Divali (another way of previous word) +3067) Lakshmi (name) +3068) Lakshadweep (name) +3069) long-termism +3070) long-windedly +3071) longboard +3072) longdog +3073) goldendoodle (+plural) +3074) labradoodle (+plural) +3075) cockapoos (added plural) +3076) colourpoint +3077) Himalayan +3078) Birman +3079) Clermont-Ferrand (name) +3080) Auvergne (name) +3081) derivate (+plural) +3082) butyric (acid) +3083) Grammy + Grammies + Grammys (annual awards) +3084) heartbreaker (+plural) +3085) hyperacidity +3086) pyrosis +3087) calcific (merged into calcify) +3088) myxoma (+plural) +3089) myxomata (another plural of previous word) +3090) myxomatous +3091) bartholinitis +3092) asthmatically +3093) autohypnotic +3094) colectomy (+plural) +3095) chlamydial (merged into chlamydia) +3096) bronchospasm +3097) balanitis +3098) erythema (+al) +3099) erythematous +3100) chancroid (+plural) +3102) trichomoniasis +3103) candidiasis +3104) neutropenia +3105) neutropenic +3106) thrombocytopenia +3107) anticonvulsant (+plural) +3108) diazepam +3109) temazepam (fix: removed tamazepam) +3110) nitrazepam +3111) nitpicky (merged into nitpick) +3112) nitid +3113) Niterói (Oxford: industrial port on Brazil) +3114) Folkestone (fix: removed Folkstone) +3115) barbican (+plural) +3116) Ragusa (name) +3117) ragworm +3118) lugworm (+plural) +3119) gapers (added plural) +3120) geoduck (+plural) +3121) geoengineering +3122) smily (another way of the word smiley) (+er +est) +3123) smileys (added plural - notice also smilies) +3124) gallberry (+plural) +3125) inkberry (+plural) +3126) inkhorn +3127) narratological +3128) narratologist (merged into narratology) +3129) narrativity +3130) eucatastrophe +3131) euchologion +3132) euchology (another way of the previous word) +3133) euchromatin +3134) euchromatic +3135) telomere (+plural +ic) +3136) telomerase +3137) cross-curricular +3138) cross-cultural +3139) cross-court +3140) forehanded (merged info forehand) +3141) forehock +3142) tapas +3143) tundish +3144) alloxan +3145) fenugreek +3146) diphtheroid +3147) blastomycosis +3148) granulocyte (+plural) +3149) ectomorph (+plural) +3150) ectoparasite (+plural) +3151) carboxylase +3152) cat-sit (+er +ers +ing) +3153) cat-bear +3154) -> 12) Ph.D. (removed one entry since it was there twice. Thanks, Filiep) +3155) groupset (+plural) +3156) beaconfish (+plural) +3157) characin (+plural) +3158) killifish (+plural) +3159) toothcarp +3160) topminnow (+plural) +3161) topman +3162) topmen (plural of previous word) +3163) toplessness +3164) Templar (+plural) +3165) withering +3166) withers (merged into wither) +3167) witherite +3168) analytics (merged into analytic) +3169) braincase +3170) sagittal (+ly) +3171) condyle (+plural) +3172) tibias (another plural of tibia) +3173) tibial (merged into tibia) +3174) medullary (merged into medulla) +3175) osteotomy (+plural) +3176) osteospermum (+plural) +3177) osteosarcoma (+plural) +3178) osteosarcomata (another plural way of previous word) +3179) osteoblast (+plural +ic) +3180) osteoarthritic +3181) LTR +3182) uncheck (+s +ing +ed) +3183) unselect (+s +ing +ed) +3184) unsentimentally (merged into unsentimental) +3185) unsensational (+ally) +3186) unseparated +3187) unserious +3188) unserviceability +3189) unsewn +3190) Macbeth (name) +3191) Ethelred's (added the 's) +3192) Gmail + gmail +3193) SETI +3194) doughboy (+plural) +3195) croquembouche +3196) choux +3197) loudmouth (+s - Fixed: loud-mouth) +3198) loud-mouthed (Oxford, it has a "-") +3199) loudhailer (+plural) +3200) biochips (added plural) +3201) biocircuits (added plural) +3202) high-security +3203) infirmarer +3204) infixed + infixing (merged into infix) +3205) septics (added plural) +3206) septically +3207) septicity +3208) embolus +3209) emboli (plural of previous word) +3210) cavitary +3211) cavernulous +3212) vermiculate (+ed) +3213) vermicular +3214) vermicide (+plural) +3215) vermicomposting +3216) vermicomposter +3217) esparto (+plural) +3218) espial +3119) leftish +3120) malcontents (added plural) +3121) Malbec +3122) Labrusca +3123) labradorite +3124) plagioclase +3125) aluminosilicate (+plural) +3126) muscovite (added lower case too) +3127) euhedral +3128) biotite +3129) titanite +3130) monazite +3131) xenotime +3132) chlorite (+ic) +3133) slaty (merged into slate) +3134) epidote +3135) chalcopyrite +3136) tetrahedrite +3137) electrum +3138) pyrargyrite +3139) pyrrhotite +3140) goethite +3141) kaolinite +3142) wurtzite +3143) ferberite +3144) tungstate +3145) tunesmith (+plural Oxford: informal) +3146) tunelessness (merged into tuneless) +3147) tuneage (Oxford: informal) +3148) Zhangjiakou (name of city in China) +3149) Kevin's (added the 's) +3150) non-compete +3151) non-communist +3152) barracouta (+plural) +3153) clownfish (+plural) +3154) damselfish (+plural) +3155) ghee +3156) Ghaznavid (+plural) +3157) Edwy (+'s - name) +3158) Antiochus (name) +3159) antinovel (+plural) +3160) disrelish +3161) louche (+ness) +3162) motorsailer +3163) motormouth (+ed) +3164) incentivize (+ed) +3165) incentivise (+ed - ize/ise) +3166) immunosuppressive (+plural) +3167) IMO (Oxford: informal: In My Opinion) +3168) blogosphere +3169) bloggy (+ier +est) +3170) blogroll +3171) liposome (+plural) +3172) liposculpture +3173) lipoprotein (+plural) +3174) lipopolysaccharide (+plural) +3175) aldosterone +3176) folate +3177) Cenozoic +3178) Cainozoic (another way of previous word) +3179) terebratulid (+plural) +3180) pedicle (+plural) +3181) pedicel (+plural) +3182) pedicellate +3183) intervertebral +3184) congruencies (added plural to congruency) +3185) quadrics (added plural) +3186) bilocation +3187) OBE (+plural) +3188) psoriatic +3189) whoever's (added the 's) +3190) multicellularity +3191) organismal (merged into organism) +3192) ODF +3193) copyleft (+ed) +3194) copyhold +3195) copyholder (+plural) +3196) copy-edit (+s +ed +ing) +3197) preamplifier (+plural - Fix: removed pre-amplifier) +3198) preamplify (+s +ing +ed) +3199) EQ +3200) epyllion +3201) epyllia (plural of previous word) +3202) unexcitable +3203) unexcitability +3204) unexaggerated +3205) uneventfulness (merged into uneventful) +3206) unevangelical +3207) equanimous +3208) Redditch (name of city) +3209) brutalism +3210) brutalist +3211) DDR +3212) backsight (+plural) +3213) kickflip (+plural) +3214) heelflip (+plural) +3215) frontside +3216) bodysurf (+er +ers +ing) +3217) bodyworker (+plural - merged into bodywork) +3218) thicknesses (added plural) +3219) thickheaded (fix: removed thick-headed) (added +ness) +3220) curation (merged into curate) +3221) cinephile (+plural) +3222) cinephilia +3223) cinematograph (+plural) +3224) cinematheque (+plural) +3225) Rohmer (name) +3226) summarization (-ize) +3227) summarisation (-ise) +3228) CVs (added plural) +3229) catechetical +3230) Christianity's (added the 's) +3231) catechetically +3232) anticlericalism +3233) warfarin +3234) taipan (+plural) +3235) workwear +3236) Adolf (+'s) +3237) MPLA +3238) UNITA +3239) Angolan (+plural +'s) +3240) Peter's (added upper case as name +'s) +3241) peterman +3242) petermen (plural of previous word) +3243) petersham +3244) grosgrain +3245) fieldfare (+plural) +3246) redwings (added plural) +3247) Zhu (name) +3248) Yuanzhang (name) +3249) minesweeping +3250) mineshafts (added plural) +3251) mineworker (added singular) +3252) Hohenzollern (name) +3253) hogweed (+plural) +3254) hognut +3255) Eminem (+'s - name) +3256) Elvira's (added 's - name) +3257) Elsa (+'s - name) +3258) Elisa (+'s - name) +3259) Elanor (+'s - name) +3260) Edison's (added 's - name) +3261) Egyptian's (added 's - name) +3262) Edwin's (added 's - name) +3263) Edwina's (added 's - name) +3264) Eleanor's (added 's - name) +3265) Eloise's (added 's - name) +3266) Eloy (+'s - name) +3267) Elias's (added 's - name) +3268) Emilia (+'s - name) +3269) Ernesto (+'s - name) +3270) Esmeralda (+'s - name) +3271) Evangelina (+'s - name) +3272) FBI's (added 's) +3273) Fernandez (+'s - name) +3274) Fernando's (added 's - name) +3275) Fiona (+'s - name) +3276) Firefox's (added 's) +3277) Flintstones (name) +3278) Florence's (added 's - name) +3279) Fitzgerald's (added 's - name) +3280) Fisher (+'s - name) +3281) Fischer's (added 's - name) +3282) Francesca's (added 's - name) +3283) Francis's (added 's - name) +3284) Francisca (+'s - name) +3285) Franks (+'s - name) +3286) Putin (+'s - name) +3287) Python (+'s - name) +3288) QWERTY (added upper case and removed lower case) +3289) AZERTY +3290) Rachael (+'s - name) +3291) Ramirez (+'s - name) +3292) Rambo (+'s - name) +3293) Coke (+plural + 's - the drink) +3294) Catholic + Catholic's (already had plural) +3295) Latinos (added plural - Oxford: Chiefly North American) +3296) KO + KO's + KO'ing + KO'd +3297) US (+'s - Country: United States in upper case) +3298) eclair (+s +'s) +3299) RTL + + +V2.16 - 1-SEP-2014 +------------------ +3300) Pinto (+'s - my name) +3301) add-on's (added the 's) +3302) Sagan (+'s - name) +3303) Steckling (name) +3304) Adamski's (added the 's - name) +3305) Ruppelt (+'s - name) +3306) Keyhoe (name) +3307) exoplanet (+plural) +3308) extrapyramidal +3309) antipsychotic (+plural) +3310) neuroleptic (+plural) +3311) benzodiazepine (+plural) +3312) benzocaine +3313) colposcope (+y) +3314) cytologically +3315) interspecific (+ally) +3316) bronchogenic +3317) amuck (other way of amock) +3318) amoebiasis +3319) superconscious (+ness +ly) +3320) unitive +3321) weakliness +3322) softie (added singular) +3323) softphone +3324) softshell (+plural) +3325) circumvallation (+plural) +3326) castellation (+plural) +3327) stats (Oxford: short for statistics) +3328) statoscope +3329) altimetry (+ic) +3330) innovational (merged into innovation) +3331) neoteric (+plural) +3332) Catullus (name) +3333) Vincenzo (name) +3334) Bellinis (added plural - Oxford: name + cocktail) +3335) catchfly (+plural) +3336) earthfall (+plural) +3337) foreshock (+plural) +3338) microseism (+plural +ic) +3339) microsite (+plural) +3340) biocompatible +3341) biocompatibility +3342) biocomputers (added plural) +3343) scopolamine +3344) hyoscyamine +3345) sexualize (+ion +ed -IZE) +3346) sexualise (+ion +ed -ISE) +3347) pansexual (+plural) +3348) pansexuality +3349) panspermia +3350) Cretans (added plural - Kevin Atkinson wordlist 60) +3351) Byzantines (added plural) +3352) Micmac (+plural - Kevin Atkinson wordlist 60) +3353) aberrational (merged into aberration - Kevin Atkinson wordlist 60) +3354) anywise (Kevin Atkinson wordlist 60) +3355) armloads (added plural - Kevin Atkinson wordlist 60) +3356) backchat (Oxford: informal - Kevin Atkinson wordlist 60) +3357) zappy (+ier +iest Oxford: informal - Kevin Atkinson wordlist 60) +3358) Zarathustra +3359) Zarathustrian (+plural) +3360) ZAPU +3361) zeitgeist (+y - added lower case) +3362) whited (Kevin Atkinson wordlist 60) +3363) whensoever (Kevin Atkinson wordlist 60) +3364) whencesoever +3365) utilizable + utilizer (merged into utilize - Kevin Atkinson wordlist 60) +3366) 3365 + derivates with -ISE +3367) untasted (Kevin Atkinson wordlist 60) +3368) unrated (Kevin Atkinson wordlist 60) +3369) thingy (+plural - Kevin Atkinson wordlist 60) +3370) thingummy (+plural - Oxford: informal) +3371) taildragger (+plural) +3372) tailwheel +3373) unstick (+s +ing) +3374) unstimulating +3375) superglue (+s +ing +ed - Kevin Atkinson wordlist 60) +3376) superglueing (another way of previous word - ing) +3377) Lucifer's (added the 's) +3378) Cain's (added the 's) +3379) supergroups (added plural) +3380) supercoil (+s +ed +ing) +3381) osmolarity +3382) supergene (+plural) +3383) supergalaxy (+plural) +3384) supercluster (+plural) +3385) supercollider (+plural) +3386) superconduct (+ive) +3387) antiferromagnetic +3388) antiglobalization (-IZE) +3389) antiglobalisation (-ISE) +3390) counterparty (+plural) +3391) counterplot (+s +ing +ed) +3392) swansongs (added plural - Kevin Atkinson wordlist 60) +3393) syndicalists (added plural - Kevin Atkinson wordlist 60) +3394) Trotskyism +3395) Trotskyist (+plural) +3396) Trotskyite (+plural) +3397) Stalinism +3398) Stalinists (added plural) +3399) recomposition +3400) 8-bit +3401) 16-bit +3402) 24-bit +3403) 32-bit +3404) 64-bit +3405) recommitment (merged into recommit) +3406) hypermutable +3407) hypermutation +3408) microsatellite (+plural) +3409) microreader (+plural) +3410) microprint (+ing) +3411) microform (+plural) +3412) microfungus +3413) microfungi (plural of previous word) +3414) microfossil (added singular) +3415) microflora +3416) microfauna +3417) microevolution +3418) microevolutionary +3419) macroevolution +3420) macroevolutionary +3421) microenterprise +3422) microelectromechanical +3423) microcyte (+plural +ic) +3424) Arabic (removed duplicate - PTG V3 build 64+) +3425) Atlantic (removed duplicate - PTG V3 build 64+) +3426) Lucy (removed duplicate - PTG V3 build 64+) +3427) ElGamal (cryptography) +3428) Elgamal (name of who created 3427) +3429) cryptosystem (+'s +plural) +3430) DES (+'s - cryptography) +3431) DSA (cryptography) +3432) TLS (cryptography) +3433) Diffie-Hellman (cryptography) +3434) VPNs (added plural) +3435) cryptanalysts (added plural) +3436) cryptanalytical +3437) AES (cryptography) +3438) Lagrange's (added 's) +3439) cryotherapy +3440) brachytherapy +3441) prostatectomy (+plural) +3442) photodynamic +3443) adjuvant (+plural) +3444) anorectal +3445) windproof +3446) dermabrasion +3447) sclerotherapy +3448) dermatoglyphics +3449) internegative (+plural) +3450) documentarian (+plural) +3451) documentarist (+plural) +3452) documentalist (+plural) +3453) toxophilite (+plural - Oxford: word of the day) +3454) pandanus +3455) pandan (another way of previous word) +3456) photomontage (+plural) +3457) photomosaic +3458) gluons (added plural) +3459) pions (added plural) +3460) antiquark (+plural) +3461) kaon (+plural) +3462) Easter (removed duplicate - PTG V3 build 64+) +3463) yogic +3464) asana (+plural) +3465) pranayama +3466) ashtanga +3467) astanga (another way of previous word) +3468) e-cigarette (+plural) +3469) cig (+plural - Oxford: informal for cigar) +3470) burley +3471) chromodynamics +3472) QCD (Oxford: short for quantum chromodynamics) +3473) backwind (+plural) +3474) forepart (+plural) +3475) voluted (merged to volute) +3476) volupté +3477) cristobalite +3478) suaver + suavest (merged into suave) +3479) suaveness (merged into suave) +3480) Rimbaud (+'s - name - Kevin Atkinson wordlist 50) +3481) Ringo (+'s - name - Kevin Atkinson wordlist 50) +3482) bluethroat (+plural) +3483) oxpecker (+plural) +3484) dunnock (+plural) +3485) credentialism +3486) camelback +3487) purslane +3488) glutathione +3489) cysteine +3490) glutamic +3491) asparagine +3492) histidine +3493) proline +3494) proliferous +3495) prolly (Oxford: informal of "probably") +3496) pleonastic +3497) pleonastically +3498) antistrophe (+plural) +3499) stanzaed (merged into stanza) +3500) stanzaic +3501) tailpiece (+plural - Kevin Atkinson wordlist 60) +3502) thumbprints (added plural - Kevin Atkinson wordlist 60) +3503) underclasses (added plural - Kevin Atkinson wordlist 60) +3504) Riefenstahl (+'s - name - Kevin Atkinson wordlist 50) +3505) Ragnarök +3506) Prozac (+'s - Kevin Atkinson wordlist 50) +3507) Karloff (+'s - name - Kevin Atkinson wordlist 50) +3508) Kasparov's (added +'s - name - Kevin Atkinson wordlist 50) +3509) KKK (+'s - Ku Klux Klan - Kevin Atkinson wordlist 50) +3510) Islamism (+'s - Kevin Atkinson wordlist 50) +3511) Islamist (Kevin Atkinson wordlist 50) +3512) Invar (+'s - Kevin Atkinson wordlist 50) +3513) Ingrid (+'s - name - Kevin Atkinson wordlist 50) +3514) highlandman +3515) highlandmen (plural of previous word) +3516) Aymara (+plural) +3517) Ayrshires (added plural - animal breed) +3518) Aboriginals + aboriginals (added the 's) +3519) ethnomusicologist (+plural) +3520) ethnomusicologic +3521) ethnomusicological +3522) ethnomusicology +3523) intranet (fix: + added plural - changed to lower case) +3524) Parkinson (+'s - name) +3525) workaholism +3526) timepass +3527) watchmaking +3528) saddlers (added plural) +3529) saddlery (+plural) +3530) decompilations (added plural) +3531) cross-assembler (+plural) +3532) antitype (+plural) +3533) demerge (+ed +er) +3534) Demerol +3535) sloshy (+ier +iest) +3536) captivatingly +3537) captchas (added plural) +3538) abandonware +3539) freeware (fix: changed to lower case) +3540) entrepreneurially (merged into entrepreneurial) +3541) entrepreneurialism +3542) gunsight (+plural) +3543) gunslinger (+plural - Oxford: informal) +3544) gunslinging (Oxford: informal) +3545) gunstock (+plural) +3546) cannoneer (+plural) +3547) cannonry +3548) anti-piracy +3549) anti-racists (added plural) +3550) blockheaded (merged into blockhead) +3551) blockish +3552) supervillain (+plural) +3553) sysop (+plural - Oxford: informal - A system operator) +3554) sysadmin (+plural - Oxford: informal - A system administrator) +3555) CRC +3556) choccy (+plural - Oxford: informal) +3557) G7 +3558) G8 +3559) G2B +3560) drippy (removed duplicate - PTG V3 build 64+) +3561) OSes (added plural) +3562) sexennial +3563) sexcentenary (+plural) +3564) sexagesimal (+plural +ly) +3565) unpicks (merged into unpick - Kevin Atkinson wordlist 60) +3566) viewership (+'s - Kevin Atkinson wordlist 60) +3567) vitriolically (Kevin Atkinson wordlist 60) +3568) walkies (merged into walkie - Kevin Atkinson wordlist 60) +3569) wanker (+plural - Oxford: vulgar slang - Kevin Atkinson wordlist 60) +3570) weepily + weepiness (merged into weepy) +3571) weepie (Kevin Atkinson wordlist 60) +3572) whatshername + whatsername (Kevin Atkinson wordlist 60) +3573) whatshisname + whatsisname (Kevin Atkinson wordlist 60) +3574) wheatmeal (Kevin Atkinson wordlist 60) +3575) wheatish +3576) wheatgrass +3577) wheatgerm +3578) borage +3579) echinacea +3580) ginkgos (another plural form of ginkgo) +3581) cocobolo (+plural) +3582) hardwoods (added plural) +3583) tablemate +3584) penne +3585) tortelli +3586) gnocchi +3587) woodworms (added plural - Kevin Atkinson wordlist 60) +3588) OpenSSL (cryptography) +3589) https +3590) subdomain (+s +'s) +3591) ChatZilla (+'s) +3592) Bugzilla (+'s) +3593) XULRunner (+'s) +3594) Instantbird +3595) rheme (+plural) +3596) gonna (Oxford: informal) +3597) subcritical +3598) subcostal +3599) amygdaloid +3600) ventromedial (+ly) +3601) trigeminal +3602) endothelium +3603) undersurface +3604) mesoderm (+al) +3605) mesogastrium +3606) mesogastria (plural of previous word) +3607) epigastrium +3608) epigastria (plural of previous word) +3609) hypogastrium +3610) hypogastria (plural of previous word) +3611) epifluorescence +3612) epifauna (+al) +3613) botanicals (added plural) +3614) funguses (Oxford: another plural of fungus) +3615) pelecypod (+plural) +3616) lamellibranch +3617) lamellibranchs (plural of previous word) +3618) wholefood (+plural - Kevin Atkinson wordlist 60) +3619) weekenders (added plural - Kevin Atkinson wordlist 60) +3620) wog (+plural - Oxford: offensive - Kevin Atkinson wordlist 60) +3621) woggle (+plural) +3622) neckwear +3623) necrobiosis +3624) necrobiotic +3625) Gregorio (+'s - name - Kevin Atkinson wordlist 50) +3626) Guantánamo (+'s - added accent - name - Kevin Atkinson wordlist 50) +3627) Hammarskjöld (+'s - added accent - name - Kevin Atkinson wordlist 50) +3628) Hayworth (+'s - name - Kevin Atkinson wordlist 50) +3629) Margolin (+'s - name) +3630) l10n +3631) i18n +3632) glocalization (-ize) +3633) glocalisation (-ise) +3634) localizable (-ize) +3635) localisable (-ise) +3636) logogram (+plural) +3637) foreseeably (merged into foreseeable) +3638) destructors (added plural) +3639) prepend + prepends + prepending + prepended +3640) tuple (+plural) +3641) ISO's + ISOs (added +'s +s) +3642) metrology (+ist) +3643) metrological +3644) somatosensory +3645) paraphilia (+plural) +3646) paraphiliac (+plural) +3647) asexuals (added plural) +3648) subgenre (+plural) +3649) standout (+plural) +3650) psychosexual (+ally) +3651) psychophysiologist (+plural - merged into psychophysiology) +3652) neuropsychology (+ist +ists) +3653) neuropsychological +3654) electrodermal +3655) CIA's (added the 's) +3656) cryptomeria (+plural) +3657) cryptonym (+plural) +3658) cryptorchid (+plural) +3659) cryptorchidism +3660) spermatic +3661) suprarenal +3662) midlife (fixed mid-life) +3663) Harleys (motorcycle) +3664) Harley-Davidson (+'s) +3665) flathead (+plural) +3666) teardrop (+plural +'s - fixed: tear-drop) +3667) knucklehead (+s +ed - Oxford: informal) +3668) motorhome (+plural) +3669) pushrod (+plural) +3670) Cadillac's (added the 's) +3671) drivetrain (+plural) +3672) sportster (+plural) +3673) crankpin (+plural) +3674) Porsche (name) +3675) unsourced +3676) woody (removed duplicate - PTG V3 build 64+) +3677) wonderful (removed duplicate - PTG V3 build 64+) +3678) Branson (+'s - name) +3679) Bramah (+'s - name) +3680) Keble (+'s - name) +3681) scholasticism +3682) scholarliness +3683) Confucians (added plural) +3684) quietism +3685) shamanic +3686) shamanist (+plural) +3687) shamanize (+ed - ize) +3688) shamanise (+ed - ise) +3689) archpriest (+plural) +3690) archosaur (+plural) +3691) basilosaurus +3692) deinstall (+s +ing +ed +er +ion +ions) +3693) deinstal (+s - another way of previous word) +3694) hot-swap (+ed +ing +able) +3695) blokeish (+ness) +3696) cochoa (+plural) +3697) barbet (+plural) +3698) tinkerbird (+plural) +3699) greenbul (+plural) +3700) hornbill (+plural) +3701) hornbook (+plural) +3702) deliration +3703) Delian (+plural) +3704) Delos (island) +3705) paralogy +3706) paralogous +3707) paralogism (+plural) +3708) speciate (+ed +ing +ion) +3709) centromere (+plural) +3710) centromeric +3711) centuple (+ed +ing) +3712) centrum (+plural) +3713) centra (another plural way of previous word) +3714) discoverability +3715) Chevy's (added the 's) +3716) thermite +3717) cutlassfish (+plural) +3718) Porsche (added 's + plural) +3719) cetology (+ist +ists) +3720) orca (+plural) +3721) Payne (+'s - name) +3722) Patagonia (name of place) +3723) Patagonian (+plural) +3724) non-humans (added plural) +3725) axonal (merged into axon) +3726) capsid (+plural) +3727) dendritic (+ally) +3728) Palaeolithic (fix: now starts with upper case) +3729) mutualism (+plural) +3730) mutualist (+plural +ic +ically) +3731) perioperative +3732) bruxism +3733) assistive +3734) wikis (added plural) +3735) odt +3736) docx +3737) pdf (added also in lower case) +3738) OpenDocument +3739) mouseover (+plural) +3740) goaty (merged into goat) +3741) goatish +3742) ballotine (+plural) +3743) galantine (+plural) +3744) terrines (added plural) +3745) saltimbocca +3746) zipx +3747) brill +3748) gratin +3749) ovenproof +3750) monkfish (+plural) +3751) anglerfish (+plural) +3752) Bokmål (language) +3753) mash-up +3754) ID + ID's + ID'ing + ID'd (Oxford: don't confuse with "id" in lower case) +3755) downloader (+plural) +3756) downmost +3757) supercell (+plural) +3758) turbocharge + turbocharging + turbocharged (merged into one entry) +3759) turboboost +3760) crashworthy (+ness) +3761) afterdeck +3762) foresheet (+plural) +3763) Paki (+plural - Oxford: offensive, used in GB) +3764) Lillee (+'s - name) +3765) Bradman (+'s - name) +3766) Dryopithecus +3767) cryptobiotic +3768) cryptobiosis +3769) saccharide (+plural) +3770) defat (+s +ed +ing) +3771) defeasance (+plural) +3772) defeasible +3773) defeatedly (merged into defeated) +3774) defeminize (+ed +ing - IZE) +3775) defeminise (+ed +ing - ISE) +3776) Apelles (+'s - name) +3777) mesmerize (+s +r +ing +ed - IZE) +3778) mesmerically (merged into mesmeric) +3779) unpersuadable +3780) unperson (+plural) +3781) unperfumed +3782) unpersuaded +3783) unphysical +3784) unphilosophic (+ally) +3785) unphilosophical +3786) unphysiological +3787) unphysiologic (+ally) +3788) unpicturesque +3789) unpigmented +3790) exfoliate (+s +ed +ing) +3791) exfoliant (+plural) +3792) Ardennes (name of place) +3793) unamplified +3794) unamiable +3795) unamended +3796) zing + zed (removed duplicate - PTG V3 build 64+) +3797) z's + zs (Z - can be either in upper or lower case) +3798) unambivalent (+ly) +3799) ready (removed duplicate - PTG V3 build 64+) +3800) unambitiousness +3801) unambiguity +3802) weaponed (merged into weapon) +3803) weaponless (merged into weapon - Kevin Atkinson wordlist 50) +3804) whitefish + whitefishes + whitefish's (Kevin Atkinson wordlist 50) +3805) wheresoever (Kevin Atkinson wordlist 50) +3806) weeper (+s +'s - Kevin Atkinson wordlist 50) +3807) weenier + weeniest (merged into weeny) +3808) unskilful (+ly +ness) +3809) unready +3810) unreadably +3811) unreachableness +3812) unreachably +3813) unratified +3814) preseason (+plural) +3815) preselector +3816) preselections (added plural) +3817) unquotable (merged into unquote) +3818) unquiet (+ly +ness) +3819) unsuspected (+ly - Kevin Atkinson wordlist 50) +3820) jackrabbit jackrabbit's jackrabbits (Kevin Atkinson wordlist 50) +3821) amazon (added also lower case because of some animal names) +3822) Amazonas (name of state in Brazil) +3823) Trekkie (+'s +plural - Oxford: informal - another way of Trekker) +3824) trelliswork (fixed: trellis-work) +3825) Tharp (+'s - name - Kevin Atkinson wordlist 50) +3826) Sumerians (added plural) +3827) sudoku +3828) sudoriferous +3829) ecoterrorism +3830) ecoterrorist (+plural) +3831) ecosphere +3832) bioregionalism +3833) bioregionalist (+plural) +3834) biodynamic (+plural) +3835) bioenergetic (added plural) +3836) bioethanol +3837) biotransformation +3838) biotype (+plural) +3839) biowarfare +3840) bioweapon (+plural) +3841) firepower (fixed: fire-power) +3842) fireship (+plural) +3843) Cmdre (Oxford: abbreviation of Commodore) +3844) Cmdr (Oxford: abbreviation of Commander) +3845) Bdr (Oxford: abbreviation of Bombardier) +3846) aircraftman +3847) aircraftmen (plural of previous word) +3848) aircraftwoman +3849) aircraftwomen (plural of previous word) +3850) airdrop (+s +ing +ed) +3851) combfish (+plural) +3852) nannygai (+plural) +3853) redfish (+plural) +3854) rockfish (+plural) +3855) scorpionfish (+plural) +3856) calvary (added lower case too - Oxford: when used as noun) +3857) parasail (+ing) +3858) ballgirl (+plural) +3859) backcourt (+plural) +3860) foredawn +3861) multilateralism +3862) multilateralist (added singular) +3863) unheroic (+ally) +3864) unheretical +3865) unheedingly +3866) unheedful +3867) unhedged +3868) unhearing +3869) unhealthiness +3870) untaken +3871) untalkative +3872) talkboard (+plural) +3873) talkback +3874) talkathon (+plural - Oxford: informal) +3875) over-talkative (+ness) +3876) overabundant (fix: over-abundant) +3877) overabundance (fix: over-abundance) +3878) overabundantly +3879) overachievement (merged into overachieve) +3880) DirectX +3881) XP (therefore removed "Windows XP") +3882) AVCHD +3883) BD-R (+plural) +3884) BD-RE (+plural) +3885) M-DISC (+'s) +3886) LightScribe +3887) CD-R (+plural) +3888) pre-plan (+ed) +3889) BD-ROM (+plural) +3890) BD-XL +3891) BDXL +3892) H.265 +3893) DivX +3894) divx (also in lower case) + + +V2.17 - 1-OCT-2014 +------------------ +3895) toolbar's (added the 's) +3896) advisors (added plural) +3897) adviser (+plural +'s) +3898) kookily (merged into kooky) +3899) yawp (+ed +er +ers) +3900) yay (Oxford: informal) +3901) Darth (+'s - name from Star Wars) +3902) glam (+s +ing +ed) +3903) nothosaur (+plural) +3904) semiaquatic +3905) plesiosaur (+plural) +3906) ichthyosaur (+plural) +3907) ichthyosaurus (another way of previous word) +3908) ichthyophagous +3909) ichthyophagy +3910) ichthyornis +3911) nerve-racking +3912) nerve-wracking (another way of previous word) +3913) nervure (+plural) +3914) fangirl (+plural - Oxford: informal) +3915) fanboy (+plural - Oxford: informal) +3916) Bielefeld (name of city in Germany) +3917) georgette (added lower case) +3918) buckskinned (merged into buckskin) +3919) parfleche (+plural) +3920) musquash (another way for muskrat) +3921) byssus (+plural) +3922) byssi (another plural of previous word) +3923) byssinosis +3924) epidemiologic +3925) atopy (+ic) +3926) sarcoidosis +3927) colorectal +3928) absorbance (+plural) +3929) quinoa +3930) SIM (+plural) +3931) Nohl (+'s - name) +3932) sandboxing + sandboxed (merged into sandbox) +3933) Karsten (+'s - name) +3934) GSM + gsm +3935) telco (+plural) +3936) echocardiogram (+plural) +3937) angiogram (+plural) +3938) mesentery (+plural +ic) +3939) innominate +3940) exteriorize (+ed +ion - IZE) +3941) exteriorise (+ed +ion - ISE) +3942) Peigan (+plural) +3943) Piegan (+plural - another way of previous word) +3944) Blackfeet (plural of Blackfoot) +3945) whitehead (+plural) +3946) whitefront (+plural) +3947) waterfowling +3948) waterfowler (+plural) +3949) watergate (also lower case for gate) +3950) waterhen (+plural) +3951) tardigrade (+plural) +3952) onychophoran (+plural) +3953) Taiping (Kevin Atkinson wordlist 50) +3954) Swammerdam (+'s - name - Kevin Atkinson wordlist 50) +3955) sunbed (added singular) +3956) sunbelt (fix: changed to lower case) +3957) sunbow (+plural) +3958) vitalism +3959) casuistical (+ally) +3960) homebuyer (+plural) +3961) homebuilder (+plural) +3962) homebuilding +3963) homeobox +3964) homoeobox (another way of previous word) +3965) homeopath (+plural - another way of homoeopath) +3966) prescribers (added plural) +3967) prescribable +3968) integrationist (+plural) +3969) allopathy +3970) allopathic +3971) allopathist (+plural) +3972) reiki +3973) reimportation +3974) reimposition +3975) idol-worshipping +3976) idocrase +3977) Jiangxi (name of place) +3978) Kiangsi (another way of previous word) +3979) Qing +3980) Ch'ing (another way of previous word) +3981) mafic +3982) retiré (Ballet) +3983) retiree (+plural) +3984) retirer (+plural) +3985) overtype (+ing) +3986) overweeningly (merged into overweening) +3987) rufous +3988) bettong (+plural) +3989) potoroo (+plural) +3990) bandicoot (+plural) +3991) roadkill (+plural) +3992) bilby (+plural) +3993) numbat (+plural) +3994) woylie (+plural) +3995) aardwolf +3996) aardwolves (plural of previous word) +3997) Århus (name of place - another word for Aarhus) +3998) Barranquilla (name of place) +3999) barramundi (+plural) +4000) fireguards (added plural) +4001) firebreak (+plural) +4002) firebrick (+plural) +4003) firebrat (+plural) +4004) firebomb (+ derivates - fixed: fire-bomb) +4005) fireblight +4006) fireballer +4007) fireballing +4008) blockwork +4009) blockship (+plural) +4010) blockboard +4011) Shandong (another way of Shantung) +4012) shandies (plural of shandy) +4013) aguardiente +4014) agroterrorism +4015) agroterrorist +4016) agrostology +4017) Hitchcock's (name - added the 's) +4018) botanize (+ing - IZE) +4019) botanise (+ing - ISE) +4020) wireline +4021) wireframes (added plural) +4022) chatbot (+plural) +4023) immersive +4024) barcode (+s +ed) +4025) MP (+plural) +4026) mp (lower case) +4027) barchan (+plural) +4028) barcarolle (another way of barcarole) +4029) barbule (+plural) +4030) Sumer (name of place) +4031) Sumbawa (name of place) +4032) Sudra (+plural - Kevin Atkinson wordlist 50) +4033) sudorific (+plural) +4034) depuration +4035) depurate (+ed) +4036) depurative (+plural) +4037) depurator (+plural) +4038) depthless (+ly) +4039) stomachic (+plural) +4040) febrifuge +4041) ophthalmia +4042) pyrexia +4043) sigil (+plural) +4044) sightworthy +4045) Tangiers (another way of Tangier - Kevin Atkinson wordlist 50) +4046) Tarantino (+'s - name - Kevin Atkinson wordlist 50) +4047) Terry (+'s - name - Kevin Atkinson wordlist 50) +4048) paraesthesia (+plural) +4049) paraesthesiae (another plural of previous word) +4050) paradrop (+s +ing +ed) +4051) atomism +4052) atomist (+plural) +4053) moderns (added plural) +4054) moderatorship (+plural) +4055) RSS +4056) drawdown (+plural) +4057) drawcard (+plural) +4058) drawbar (+plural) +4059) drawcord (+plural) +4060) zipless (Oxford: informal) +4061) wearability +4062) pre-order (+plural) +4063) pre-prepare (+ed) +4064) neurodegenerative +4065) neurocomputer (+plural) +4066) neuroeconomics +4067) neurofibril (+plural) +4068) neurofibrillary +4069) supranuclear +4070) supraorbital +4071) foramen +4072) foramina (plural of previous word) +4073) argyrophilic +4074) suprasegmental (+plural) +4075) phrenic +4076) supremacism +4077) miniscule (another way of minuscule) +4078) neo-fascist (+plural) +4079) neo-Gothic +4080) neo-Latin +4081) neo-impressionism +4082) neo-impressionist (+plural) +4083) neo-Georgian +4084) neo-Darwinian +4085) neo-Darwinism +4086) neo-Darwinist +4087) neo-Confucianism +4088) neo-Confucian +4089) blissed (merged into bliss) +4090) gazania (+plural) +4091) bluegum +4092) stringybark +4093) stringpiece +4094) mallee (+plural) +4095) tad (Oxford: informal) +4096) tacticity +4097) configurational (merged into configuration) +4098) associationism +4099) associationist (+plural) +4100) epidemiologic (merged into epidemiology) +4101) colosseum (+plural - fixed: lower case - another word for coliseum) +4102) clearwing +4103) peacemonger (+ing +ed) +4104) peacekeeper (added singular) +4105) InterCity (trademark) +4106) intercolonial +4107) intercolumniation +4108) intercolumnar +4109) astragal (+plural) +4110) astragalus +4111) astragali (plural of previous word) +4112) antherozoid (+plural) +4113) gametophyte +4114) gametophytic (merged into gametophyte) +4115) microspore (+plural) +4116) megaspore (+plural) +4117) megastores (added plural) +4118) megastars (added plural) +4119) megastructure (+plural) +4120) Wright's (added 's) +4121) wretcheder (merged into wretched) +4122) wretchedest +4123) arteriovenous +4124) parenchyma (+al) +4125) parenchymatous +4126) sawfish (+plural) +4127) sawlike +4128) crowberry (+plural) +4129) cordgrass +4130) benzoin +4131) unorganized +4132) benzoic (acid) +4133) stereochemistry +4134) stereochemical (+ally) +4135) epoxide (+plural) +4136) catechol +4137) norepinephrine +4138) fluorochrome (+plural) +4139) fluoropolymer +4140) tetrafluoroethylene +4141) waitressing (merged into waitress) +4142) busbar (+plural) +4143) busby (+plural) +4144) semibreve (+plural) +4145) semibold +4146) semidemisemiquaver +4147) hemidemisemiquaver (+plural - another way of previous word) +4148) hemicylindrical +4149) hemicycle (+plural) +4150) azulejo (+plural) +4151) archivolt (+plural) +4152) entablement +4153) architectonically (merged into architectonic) +4154) annulet (+plural) +4155) policymaker (+plural - Fixed: policy-maker) +4156) policymaking (fixed: policy-making) +4157) policier +4158) Melville's (added the 's) +4159) counterscarp (+plural) +4160) countershaft (+plural) +4161) artiodactyl (+plural) +4162) bioluminescence +4163) bioluminescent +4164) biomagnetism +4165) biomaterial +4166) biomathematics +4167) biome (+plural) +4168) transgene (+plural) +4169) introgression +4170) backcross (+s +ed +ing) +4171) cultivar (+plural) +4172) cultigen (+plural) +4173) bifacial +4174) biface (+plural) +4175) uniface +4176) tricycling (merged into tricycle) +4177) tricyclist (+plural) +4178) petroglyphs (added plural) +4179) ghostwrite (+derivates - fixed: ghost-write) +4180) ghostwritten (fixed: ghost-written) +4181) speechifies + speechifying + speechified + speechifier (merged into speechify) +4182) speechification +4183) speedwriting +4184) speedwriter (+plural) +4185) Magdalenian +4186) Aurignacian +4187) defloration +4188) deflocculate (+ed) +4189) deflocculation +4190) deflesh (+ed) +4191) arsehole (+plural +ed - Oxford: vulgar slang) +4192) arsenates (added plural) +4193) selenates (added plural) +4194) selenide (+plural) +4195) machinability +4196) weldability (merged into weld) +4197) weldable (merged into weld) +4198) weldmesh +4199) corkwood (+plural) +4200) Graeco-Roman +4201) Greco-Roman (another way of previous word) +4202) paperbark (+plural) +4203) paperboy (fixed: paper-boy) +4204) papergirl (fixed: paper-girl) +4205) paperknife +4206) paperknives (plural of previous word) +4207) papermaking +4208) papermaker +4209) paperchase +4210) paperboard +4211) oldspeak +4212) Oldowan +4213) Epidaurus (ancient Greek city) +4214) epicycloidal (merged into epicycloid) +4215) epicycloids (added plural) +4216) hypocycloid (+al) +4217) commissure (+plural) +4218) legalist (+plural) +4219) legalistically (merged into legalistic) +4220) Carcassonne +4221) Carchemish (city) +4222) chiliastic +4223) chiliarch (+plural - chiliarchs) +4224) bowsers (added plural) +4225) bowshot +4226) bowstrung (past and past participle of bowstring) +4227) fletchers (added plural) +4228) pickerelweed +4229) pickelhaube +4230) orebody (+plural) +4231) noise-maker (removed - American word) +4232) noisette (+plural) +4233) noisomeness (merged into noisome) +4234) Nok +4235) Osbert (name - Osbert Guy Stanhope Crawford) +4236) Stanhope (name - Osbert Guy Stanhope Crawford) +4237) Belgic +4238) encash (+ed +able +ment) +4239) consortiums (another plural of consortium) +4240) conspecific (+plural) +4241) conspecificity +4242) spatterware +4243) spatterdash (+plural) +4244) allseed +4245) zugzwang +4246) myxoedema +4247) filariasis +4248) geotag (+s +ing +ed) +4249) geotaxis +4250) geotactic +4251) geotropism +4252) geotropic +4253) megapode (+plural) +4254) ensiform +4255) geosyncline (+plural) +4256) bioclast (+s +ic) +4257) biocide (+s +idal) +4258) antifouling +4259) alprazolam +4260) depredator (+plural) +4261) depredatory +4262) lo-fi +4263) low-fi (another way of previous word) +4264) bokeh +4265) lo-res +4266) low-res (another way of previous word) +4267) dojo (+plural) +4268) ippon (+plural) +4269) bushido (now in lower case according to Oxford) +4270) bushmeat +4271) clifftop (+plural) +4272) geoid +4273) eukaryotic +4274) biosocial +4275) biometeorology +4276) autostereoscopic +4277) taskbar +4278) gamification +4279) gamify (+plural +ing +ed) +4280) gamgee +4281) gametogenesis +4282) gametogenic +4283) gametogeny +4284) systematist (+plural) +4285) autorotated (merged into autorotate) +4286) cyphel +4287) fire-brick (removed: it is firebrick) +4288) coleopteran (+plural) +4289) coleopterous +4290) dermestid +4291) dermatophytosis +4292) dermatophytoses (plural of previous word) +4293) dermatosis +4294) dermatoses (plural of previous word) +4295) hypermetropia +4296) hypermnesia +4297) hyperon (+plural) +4298) parasitoid (+plural) +4299) biopharming +4300) biophilia +4301) biopolymer (+plural) +4302) geeked + geeking (merged into geek) +4303) geekdom +4304) geekish +4305) geeky (+ier +iest +ness) +4306) geekery (Oxford: informal) +4307) geekspeak (Oxford: informal) +4308) chappie (+plural - Oxford: informal) +4309) eyeshadow (fix: eye-shadow) +4310) eyeshot +4311) eyestalk +4312) eyestripe (+plural) +4313) unpatterned +4314) unpatrolled +4315) unpatriotically +4316) unpatched +4317) unpassable +4318) unpardonableness +4319) unpacker (+plural) +4320) unornamented +4321) unoriginality +4322) unoriginally +4323) unordinary +4324) unoiled +4325) unoffending +4326) unobscured +4327) unobjective +4328) unoaked +4329) unnoticeably +4330) unnamable (another way for unnameable) +4331) unnail (+ed) +4332) unmusicality +4333) unmusicalness (merged into unmusical) +4334) unmutilated +4335) unmurmuring (+ly) +4336) unmuffle (+ed) +4337) unmothered +4338) unmotherly +4339) unmoral +4340) unmorality +4341) unpeople (+s +ing) +4342) unpeg (+s +ing +ed) +4343) unpatented +4344) untouchability +4345) untouristed +4346) untowardness (merged into untoward) +4347) untransferable +4348) untranslatability +4349) untraversable +4350) untrendy (Oxford: informal) +4351) untrusting +4352) untuck (+ed) +4353) unknowingness (merged into unknowing) +4354) sideward (added singular) +4355) sidewall +4356) sideswipe (fixed: side-swipe) +4357) sidestroke (fixed: side-stroke) +4358) starchitect +4359) columnated +4360) starchitecture +4361) decretal (+plural) +4362) Decretum +4363) decubitus +4364) codebreaking +4365) codebreakers (added plural) +4366) codependence +4367) beatbox (+plural +er +ing) +4368) bandoneon +4369) bandpasses (added plural) +4370) photodiode (+plural) +4371) photodegrade +4372) photodegradation +4373) photodetector (+plural) +4374) photodissociation +4375) photoelectron (added singular) +4376) photoemission +4377) photoemissive +4378) photoemitter +4379) photoessay (+plural) +4380) photofit (+plural) +4381) photogram (+plural) +4382) landmines (added plural) +4383) shoreside +4384) shoreweed +4385) shorelark (+plural) +4386) bellbird (+plural) +4387) honeyeater (+plural) +4388) honeyguide (+plural) +4389) honeypot (+plural) +4390) honeysucker (+plural) +4391) honeywort +4392) snowberry (+plural) +4393) snowblade (+s +ing +er) +4394) snowblink +4395) granodiorite +4396) plutonic + Plutonic +4397) biostratigraphy +4398) biosurgery +4399) biosolids +4400) biosimilar (+plural) +4401) biospheric (merged into biosphere) +4402) biofuels (added plural) +4403) bioflavonoid (+plural) +4404) biometrical +4405) biometrician (+plural) +4406) ectoparasitic (merged into ectoparasite) +4407) microhabitat (+plural) +4408) study's (added the 's) +4409) anthropogenically (merged into anthropogenic) +4410) timescale (fixed: time-scale) +4411) spermatid (+plural +al) +4412) spermatocyte (+plural) +4413) spermatogonium +4414) spermatogonia (plural of previous word) +4415) seminiferous +4416) semiochemical (+plural) +4417) semiological +4418) elenchus +4419) elenchi (plural of previous word) +4420) alienee (+plural) +4421) aliform +4422) encephalon +4423) encephalography +4424) encephalograph +4425) encephalogram (+plural) +4426) myoclonus +4427) myoclonic +4428) capitular +4429) glomerulus +4430) glomeruli (plural of previous word) +4431) glomerular +4432) nephron (+plural) +4433) nephrotoxic +4434) nephrotoxicity +4435) nephrotoxin (+plural) +4436) vancomycin +4437) virality +4438) somewhen (Oxford: informal) +4439) somite (+plural) +4440) dichromatism +4441) dichromatic +4442) cephalothorax +4443) holotype (+plural) +4444) syntype (+plural) +4445) fishcakes (added plural) +4446) amatriciana +4447) amaurosis +4448) amaurotic +4449) foo (foo fighter) +4450) geoscience (+plural) +4451) geoscientist (+plural) +4452) botty (+plural) +4453) Swabia (place in Germany) +4454) Swabian +4455) clamant +4456) dragonet (+plural) +4457) bigeye (fish) +4458) bluefin (fish) +4459) yellowfin (fish) +4460) catalufa (+plural) +4461) catalyser +4462) APU +4463) dumbshow (+plural) +4464) dumbphone (+plural) +4465) dumbo (+plural - Oxford: informal) +4466) vetchling (+plural) +4467) buckthorn +4468) buckyball (+plural) +4469) nanomaterials (added plural) +4470) nanogram +4471) ng (Oxford: abbreviation of previous word) +4472) oxidase (+plural) +4473) pharaoh (+plural - changed to lower case - upper case only if name) +4474) abubble +4475) idiotype (+plural) + + +V2.18 - 1-NOV-2014 +------------------ +4476) mothercraft +4477) mainboard (+plural) +4478) maincrop +4479) tricuspid +4480) unicuspid +4481) fivestones +4482) fivesome +4483) Flathead (+plural - upper case - Kevin Atkinson wordlist 60) +4484) bioturbation +4485) pilgriming + pilgrimed (merged into pilgrim) +4486) pilgrimize (-IZE) +4487) pilgrimise (-ISE) +4488) rubescent +4489) evacuant +4490) Salvadorean (+plural +'s - Kevin Atkinson wordlist 60) +4491) statant +4492) Zarathustra's (added +'s - Kevin Atkinson wordlist 60) +4493) adventurist (+plural - Kevin Atkinson wordlist 60) +4494) acquiree (+plural) +4495) acquirer (+plural - Kevin Atkinson wordlist 60) +4496) answerphone (+plural - Kevin Atkinson wordlist 60) +4497) bulleted (merged into bullet) +4498) bedchambers (added plural - Kevin Atkinson wordlist 60) +4499) biodegrade (+s +ed +ing +ion - Kevin Atkinson wordlist 60) +4500) blobfish (+plural) +4501) binman (Oxford: informal - Kevin Atkinson wordlist 60) +4502) binmen (plural of previous word - Kevin Atkinson wordlist 60) +4503) blowlamps (added plural - Kevin Atkinson wordlist 60) +4504) breathalyses (added plural - Kevin Atkinson wordlist 60) +4505) cellmates (added plural - Kevin Atkinson wordlist 60) +4506) chatlines (added plural - Kevin Atkinson wordlist 60) +4507) chirpily + chirpiness (merged into chirpy - Kevin Atkinson wordlist 60) +4508) computerate (Oxford: informal - Kevin Atkinson wordlist 60) +4509) comfortless (merged into comfort - Kevin Atkinson wordlist 60) +4510) conchie (+plural - Oxford: informal - Kevin Atkinson wordlist 60) +4511) cookhouse (+plural - Kevin Atkinson wordlist 60) +4512) crabwise (Kevin Atkinson wordlist 60) +4513) crepuscular (Kevin Atkinson wordlist 60) +4514) cripes (Oxford: informal - Kevin Atkinson wordlist 60) +4515) criollo (+plural) +4516) cuboids (added plural - Kevin Atkinson wordlist 60) +4517) cuboidal (merged into cuboid) +4518) demonically (Kevin Atkinson wordlist 60) +4519) deselection (+plural - Kevin Atkinson wordlist 60) +4520) immunoblotting +4521) electrophorese +4522) electrophoretic + electrophoretically +4523) electrometer (+ic) +4524) electrometry +4525) electromyogram (+plural) +4526) multipolar +4527) multipolarity +4528) multipole +4529) unipolarity +4530) unipotent +4531) unironed +4532) uniserial +4533) unisexual (+ly) +4534) unisexuality +4535) unironic (+ly) +4536) UNISON +4537) unissued +4538) deep-discount +4539) supercalifragilisticexpialidocious (Oxford: informal) +4540) supercalifragilistic (another way of previous word) +4541) superbugs (added plural) +4542) autorickshaw (+plural) +4543) e-billing +4544) e-cash +4545) e-edition +4546) e-dating +4547) e-fit +4548) overclock (+ed +ing +s) +4549) overclocker (+plural +'s) +4550) overcheck (+plural) +4551) overcautiously + overcautiousness (merged into overcautious) +4552) overcaution +4553) overclass +4554) overcompensatingly +4555) overcompensatory +4556) overcommits (added plural) +4557) descale (+s +ing +ed - Kevin Atkinson wordlist 60) +4558) descaler (+plural) +4559) euryapsid (+plural) +4560) darkie (+plural - Kevin Atkinson wordlist 60) +4561) decathlete (+plural - Kevin Atkinson wordlist 60) +4562) dickhead (+plural - Kevin Atkinson wordlist 60) +4563) doodahs (added plural - Kevin Atkinson wordlist 60) +4564) doolally (Oxford: informal - Kevin Atkinson wordlist 60) +4565) doomster (+plural - Kevin Atkinson wordlist 60) +4566) doomwatch (+er +ers) +4567) draughtboard (+plural - Kevin Atkinson wordlist 60) +4568) ecolodge (+plural) +4569) ecofreak (+plural) +4570) ecofeminism +4571) ecofeminist (+plural) +4572) educationist (+plural - Kevin Atkinson wordlist 60) +4573) endgames (added plural - Kevin Atkinson wordlist 60) +4574) consecrator +4575) consecratory +4576) emblematical +4577) emblematically (Kevin Atkinson wordlist 60) +4578) emblematist +4579) dozier+doziest+dozily+doziness (merged into dozy - Kevin Atkinson wordlist 60) +4580) ecu (+plural - Kevin Atkinson wordlist 60) +4581) diaconate +4582) premodify (+s +ing +ed +ion +er) +4583) premonish (+ing) +4584) Petersburg (name) +4585) entryphone (+plural - Kevin Atkinson wordlist 60) +4586) extrajudicial (Kevin Atkinson wordlist 60) +4587) extrajudicially (merged into extrajudicial) +4588) selfhood +4589) continuants (added plural) +4590) cacuminal +4591) coarticulation (+plural) +4592) silicify (+s +ing +ed +ion) +4593) extraordinaire (Kevin Atkinson wordlist 60) +4594) extranet (+plural) +4595) extramusical +4596) fab (+s +ing +ed) +4597) fatsos (added plural - Kevin Atkinson wordlist 60) +4598) fitment (added singular - Kevin Atkinson wordlist 60) +4599) fluvial (Kevin Atkinson wordlist 60) +4600) fuckhead (+plural - Kevin Atkinson wordlist 60) +4601) fuckwit (Oxford: vulgar slang) +4602) fucoxanthin +4603) carotenoid (+plural) +4604) lutein +4605) ZX (ZX Spectrum - computer from the 1980s) +4606) exabyte (+plural) +4607) EB (abbreviation of previous word) +4608) yottabyte (+plural) +4609) YB (abbreviation of previous word) +4610) zettabytes (added plural) +4611) ZB (abbreviation of previous word) +4612) Amiga's (added the 's) +4613) lower-level +4614) higher-level +4615) akasha (+ic) +4616) inbreathe (+ed +ing) +4617) fracking +4618) commenters (added plural) +4619) bynames (added plural) +4620) bye-byes (added plural) +4621) goodliness (merged into goodly) +4622) mailshots (added plural) +4623) backbend (+plural) +4624) jawless (merged into jaw) +4625) hagfish (+plural) +4626) beardfish (+plural) +4627) clade (+plural) +4628) taxon +4629) taxa (plural of previous word) +4630) avoision +4631) kyu (martial arts) +4632) dan (martial arts) +4633) budo (martial arts) +4634) bokken (martial arts) +4635) kyudo (martial arts) +4636) kendo (martial arts) +4637) lamers (added plural) +4635) 2D +4636) 3D +4637) galactically (merged into galactic) +4638) galactagogue (+plural) +4639) prolactin +4640) oxytocin +4641) oxytocic +4642) monoamine (+plural) +4643) monamine (+plural - another way of previous word) +4644) neuropeptide (+plural) +4645) neuropathological +4646) neuropathologist (+plural) +4647) neuroma (+plural) +4648) neuromata (another plural of previous word) +4649) geriatrician (+plural) +4650) defervescence +4651) anastomose (added singular +ing +ed) +4652) arthroplasty +4653) vegetal +4654) aepyornis +4655) calcination (merged into calcine) +4656) dimercaprol +4657) dimerous +4658) meerkat (+plural) +4659) tamarin (+plural) +4660) mara (+plural) +4661) suricate (+plural) +4662) Bannockburn (place) +4663) Mozillian (+'s +plural) +4664) annock +4665) bendy (+ier iest +ness) +4666) funfairs (added plural - Kevin Atkinson wordlist 60) +4667) goodie (another way of goody) +4668) ganja (Kevin Atkinson wordlist 60) +4669) charas +4670) spliff (+plural) +4671) afebrile +4672) Eddington (+'s - name) +4673) dyskinesia (+plural) +4674) dyspraxia +4675) dysregulation +4676) bariatrics +4677) bronchodilator (+plural) +4678) bronchodilation +4679) pharmacodynamic (+plural) +4680) zonation (+plural) +4681) nomenclator +4682) nomenclatural +4683) monotypic +4684) monovalent +4685) nonagon +4686) gasman (Kevin Atkinson wordlist 60) +4687) gasmen (plural of previous word - Kevin Atkinson wordlist 60) +4688) gaslighting (merged into gaslight) +4689) gaslit +4690) gasometers (added plural - Kevin Atkinson wordlist 60) +4691) bionomic (+plural) +4692) anticathode (+plural) +4693) anticholinergic (+plural) +4694) misdial (+s +ing +ed) +4695) misdescribe (+s +ed +ion) +4696) misdoubt (+s +ed) +4697) compand (+s +er +ing +ed) +4698) datacomms +4699) datacoms (another way of previous word) +4700) dataveillance +4701) case-sensitive +4702) backstamp (+plural) +4703) backstay (+plural) +4704) donkeyman +4705) donkeymen (plural of previous word) +4706) bathymeter (+plural +ic) +4707) bathymetry +4708) scaleable (another way of scalable) +4709) intercrop (+s +ing +ed) +4710) intercorrelation (+plural) +4711) intercorrelate +4712) baseload +4713) baselessly +4714) baseborn +4715) subcell (Collins) +4716) subcellular (Collins) +4717) supralunar (Collins) +4718) supratemporal (Collins) +4719) hepatocellular (Collins) +4720) gluteals (added plural) +4721) gastrocnemius +4722) gastrocnemii (plural of previous word) +4723) soleus +4724) appendicular +4725) scute (+plural) +4726) allosaurus (+plural) +4727) allopurinol +4728) colchicine +4729) disarticulate (+ion) +4730) flexicuffs (Macmillan) +4731) plasticuffs (Macmillan) +4732) PCIe +4733) RJ45 +4734) blackboy (+plural) +4735) mistle (mistle thrush) +4736) broadbill (+plural) +4737) Arabism +4738) Arabist (+plural) +4739) arabinose +4740) galactose +4741) xylose +4742) mannose +4743) fibrinogen +4744) extravascular +4745) intravascular (+ly) +4746) extravasate (+ed) +4747) petechia +4748) petechiae (plural of previous word) +4749) petcock +4750) petasus +4751) undersheriff (fixed: under-sheriff) +4752) underset (+s +ing) +4753) unviable +4754) unviability +4755) unviolated +4756) Eliot's (added the 's) +4757) unvitiated +4758) unwaged +4759) unwaisted +4760) hashtag (+plural) +4761) cliched (merged into cliche) +4762) gotcha (Oxford: informal) +4763) gotcher (Oxford: informal - another way of previous word) +4764) gossypol +4765) cottonweed (+plural) +4766) oligotrophy (+ic) +4767) eutrophic +4768) lapis +4769) UTF-16 +4770) UTF-32 +4771) 1D +4772) unvented +4773) unvaryingness +4774) meningococcus +4775) meningococci (plural of previous word) +4776) meningococcal +4777) serogroup (Collins) +4778) anti-war (fixed antiwar) +4779) anti-Western +4780) anti-tetanus +4781) anorgasmia +4782) activewear +4783) Diana's (added the 's) +4784) misestimate (+ed) +4785) misestimation (+plural) +4786) QuickTime +4787) trackpad +4788) ringtone (+plural) +4789) Netflix (company) +4790) podcasts (added plural) +4791) waifish +4792) waiflike +4793) retroelement (+plural) +4794) bivalents (added plural) +4795) non-disjunction +4796) spermatogenesis +4797) spermatophore (+plural) +4798) oviposit (+s +ing +ed) +4799) oviparity +4800) asphyxial +4801) asphyxiant (+plural) +4802) diverticular +4803) diverticulum +4804) diverticula (plural of previous word) +4805) axilla +4806) axillae (plural of previous word) +4807) aviating + aviated (merged into aviate) +4808) prosoma +4809) tagma +4810) tagmata (plural of previous word) +4811) antivivisection +4812) antivivisectionism +4813) gangstas (added plural - Kevin Atkinson wordlist 60) +4814) counterchange (+s +ed +ing) +4815) counterclaims (added plural) +4816) counterculture (fixed: counter-culture) +4817) countercultural +4818) counterdemonstration (+plural) +4819) Blairism +4820) Blairite (+plural) +4821) church (added also lower case) +4822) churchy + churchier + churchiest +4823) chuppah + chuppa +4824) chuppot (plural of previous word) +4825) chupacabra (+plural +'s) +4826) Gawd + gawd (Oxford: informal - Kevin Atkinson wordlist 60) +4827) geddit (Oxford: informal - Kevin Atkinson wordlist 60) +4828) gasholder (+plural - Kevin Atkinson wordlist 60) +4829) sunseeker (+plural - Oxford: informal) +4830) Jain (+plural) +4831) jailbreaker (merged into jailbreak) +4832) detainers (added plural) +4833) gigawatts (added plural - Kevin Atkinson wordlist 60) +4834) GW (abbreviation of previous word) +4835) gigaton (+plural) +4836) gigatonne (+plural - another way of previous word) +4837) godawful (Kevin Atkinson wordlist 60) +4838) goddammit (Collins - informal) +4839) godlessly (merged into godless - Kevin Atkinson wordlist 60) +4840) giros (added plural - Kevin Atkinson wordlist 60) +4841) groupware (+'s - Kevin Atkinson wordlist 60) +4842) Debian +4843) versioned + versioning + versional (merged into version) +4844) diehard (fixed: die-hard) +4845) versicoloured +4846) verset (+plural) +4847) triolet (+plural) +4848) sestina (+plural) +4849) villanelle (+plural) +4850) rondel (+plural) +4851) pantoum (+plural) +4852) pantryman +4853) pantrymen (plural of previous word) +4854) groundburst (Collins) +4855) adaptationism +4856) adaptationist +4857) adaptably +4858) Emmy (+plural - the awards) +4859) greenflies (added plural - Kevin Atkinson wordlist 60) +4860) gymslip (+plural - Kevin Atkinson wordlist 60) +4861) hairsprays (added plural - Kevin Atkinson wordlist 60) +4862) colourist (+plural) +4863) colourway (+plural) +4864) colouristic (+ally) +4865) watercolourist (+plural - merged into watercolour) +4866) watercock (+plural) +4867) waterdog (+plural) +4868) cottonmouth (+plural) +4869) deergrass +4870) dotterel (+plural) +4871) dottily (merged into dotty) +4872) Crockford (+'s) +4873) Avesta +4874) Vedic +4875) Kubuntu (+'s) +4876) ESA (+'s) +4877) ESC +4878) escabeche +4879) escalade +4880) rockwork (Collins) +4881) rocketeer (+plural) +4882) aerobrake (+ing) +4883) aerobicist (+plural) +4884) aerobiology +4885) neurophysiological +4886) neurophysiologist (+plural) +4887) atherogenic +4888) atherogenesis +4889) pathophysiology +4890) pathophysiologic +4891) pathophysiological +4892) pathophysiologically +4893) pathophysiologist +4894) colonoscopes (added plural) +4895) autotransformers (added plural) +4896) autotoxin (+plural) +4897) autotoxic +4898) allogenic +4899) catastrophists (added plural) +4900) tailplanes (added plural) +4901) tailspinning (merged into tailspin) +4902) tailspun (past of tailspin) +4903) tailwater (+plural) +4904) fishable (merged into fish) +4905) hemimetabolous +4906) hemimetabolic +4907) DLL (+plural) +4908) aerophagy + + +V2.19 - 1-DEC-2014 +------------------ +4909) Zuckerberg (+'s - name) +4910) XL +4911) XXL +4912) Facebooking (+ed +er +ers - merged into Facebook) +4913) convocational +4914) convolutional (merged into convolution) +4915) denticle (+plural) +4916) reticulary (Collins - another way for reticulate) +4917) cephalopods (added plural) +4918) crinoid (+plural) +4919) brachiopod (+plural) +4920) conodont (+plural) +4921) intracompany (Collins) +4922) agglutinogen (+plural) +4923) downdrift +4924) downcut (+s +ing) +4925) upcurve (+ed - Collins + Oxford) +4926) upcycle (+ed) +4927) upcast +4928) faceworker +4929) homeworking (merged into homework) +4930) homewrecker (+plural) +4931) teleworker (+plural - Macmillan) +4932) jack-o'-lantern (+plural) +4933) jackanapes +4934) goosefoot (+plural) +4935) sumpweed (Collins) +4936) sandbagger (+plural) +4937) shopfront (+plural) +4938) shopaholic (+plural) +4939) shopfitter (+plural) +4940) shopfitting +4941) boutiquey (Oxford: informal) +4942) Baphomet (Collins) +4943) baphometic (Collins) +4944) Mendes (name) +4945) Judaeo-Christian (Collins) +4946) magus +4947) Szandor (name) +4948) cosmopolite (+plural) +4949) cosmopolitanize (+ed -IZE) +4050) cosmopolitanise (+ed -ISE) +4051) spacewalks (added plural) +4052) spaceplane (+plural) +4053) spacefaring +4054) Lilith (+'s - name) +4055) Samael (+'s - name) +4056) clubmate (+plural) +4057) curtilage (+plural) +4058) circumstantiality +4059) disburden +4060) disbud (+s +ing +ed) +4061) disbenefit (+plural) +4062) disbound +4063) basketmaker (+plural) +4064) basketmaking +4065) gadgeteer (+plural) +4066) gadgety +4067) cabbalistic +4068) cabbalist (+plural) +4069) cabbalism +4070) Kabbalah + Kabbala + Cabbala + Qabalah +4071) Kabbalism +4072) Kabbalist (+plural) +4073) Kabbalistic +4074) Hasidism + Chasidism + Chassidism + Hassidism +4075) copyread (+ing +er) +4076) hardbody (+plural +ed) +4077) Hardecanute (+'s - name) +4078) bentonite +4079) citrine +4080) ricking + ricked (merged into rick) +4081) cowfish (+plural) +4082) diffusivities (added plural) +4083) cal (Oxford: small calorie, abbreviation) +4084) Cal (Oxford: large calorie, abbreviation) +4085) multispectral +4086) BTC (Oxford: abbreviation of bitcoin) +4087) backbiting +4088) deracinate (+ed) +4089) train's (added the 's) +4090) decoct (+ed +ing) +4091) decocture +4092) dibasic +4093) monobasic +4094) diamine (+plural) +4095) triaxial +4096) triatomic +4097) triathlete (+plural) +4098) deadeners (added plural) +4099) copperas +4100) spadefoot (+plural) +4101) spadefish (+plural) +4102) spadille +4103) cribellum +4104) cribella (plural of previous word) +4105) cribellate +4106) chelicerate (+plural) +4107) lexicology +4108) lexicological + lexicologically +4109) pomodoro +4110) unobvious (Collins) +4111) recompress (+s +ed +ing +ion) +4112) redistributor (+plural) +4113) hyphenator (+plural) +4114) refactor (+s +ed +ing) +4115) misdistribution (Collins) +4116) maldistribution +4117) maldistributed +4118) distributary (+plural) +4119) dogwatch (+plural) +4120) dogstail +4121) dogskin +4122) dogsbodies + dogsbodying (merged into dogsbody) +4123) austenite (+ic) +4124) Ozzies (added plural) +4125) microstructure (+plural +al) +4126) cementite +4127) pearlite +4128) contactor (+plural) +4129) elastomers (added plural) +4130) elastomeric +4131) nitro (Oxford: Short for nitroglycerine) +4132) polyolefin (Collins) +4133) gapping +4134) hypotaxis +4135) hypotactic +4136) parataxis +4137) paratactic (+ally) +4138) phasor (+plural) +4139) phasic +4140) reactance +4141) acetanilide +4142) orcein +4143) cocreate (Collins) +4144) Cota-Robles (name) +4145) DSLR (+s +'s) +4146) HDSLR (+s +'s) +4147) SDK (Collins) +4148) FreeBSD +4149) AutoCAD (+'s) +4150) CAD (in upper case - Oxford: short for Computer-aided design) +4151) cadaverousness (merged into cadaverous) +4152) CADCAM +4153) androecium +4154) androecia (plural of previous word) +4155) androecial +4156) gynoecium +4157) gynoecia (plural of previous word) +4158) gynocentric +4159) unallowable +4160) unallied +4161) unalive +4162) unalarmed +4163) unaired +4164) unaggressive +4165) unaesthetic +4166) unadvisedly +4167) unadjacent +4168) unaddressed +4169) IRCop (+plural) +4170) moldavite (Collins) +4171) Jaban (+'s - name) +4172) Joseph's (added the 's) +4173) starships (added plural) +4174) Anunnaki +4175) Lyra +4176) Sheran (+'s - name) +4177) relink (+ed +ing) +4178) reliquiae +4179) relist (+ed +ing) +4180) relleno (+plural) +4181) tortious (+ly) +4182) licensors (added plural) +4183) RTFM (Oxford: vulgar slang) +4184) Thunderbird's (added the 's) +4185) personas (added plural) +4186) Los (Los Angeles - city) +4187) neuroanatomical +4188) neuroanatomist (+plural) +4189) neurochemistry +4190) neurochemist +4191) neurochemical +4192) nephrology +4193) nephrological +4194) nephrologist (+plural) +4195) interventional (merged into intervention) +4196) subcortical +4197) putamen (+plural) +4198) putamina (another plural of previous word) +4199) nondevelopment (Collins) +4200) subdevelopment (Collins) +4201) antidevelopment (Collins) +4202) predevelopment (Collins) +4203) neurohormonal (Collins) +4204) military's (added the 's) +4205) gizmo (+s +'s) +4206) gismo (+s +'s - another way of previous word) +4207) antimilitarism (Collins) +4208) militaries (added plural) +4209) Clausewitz (+'s - name) +4210) antimilitarist (+plural - Collins) +4211) hairgrip (+plural - Kevin Atkinson wordlist 60) +4212) bikeable +4213) bikable (another way of previous word) +4214) BMX +4215) boneshaker (+plural - Oxford: informal) +4216) pushbike (+plural - Oxford: informal - Fixed: push-bike) +4217) pushful (+ly +ness) +4218) pushpit +4219) lectionary (+plural) +4220) commination (+plural) +4221) comminatory +4222) grotty (+ier +iest +ness - Kevin Atkinson wordlist 60) +4223) polenta +4224) carpaccio +4225) Carpaccio (name) +4226) footy (Oxford: informal - Kevin Atkinson wordlist 60) +4227) footie (another way of previous word - Kevin Atkinson wordlist 60) +4228) footslog (+s +ing +ed +er +ers) +4229) fleapit (+plural - Kevin Atkinson wordlist 60) +4230) glaive (+plural) +4231) whoremaster (+plural) +4232) gangmaster (+plural) +4233) spymaster (+plural) +4234) workmaster (Collins) +4235) weaponeer (+ing - Collins) +4236) ironmaster (+plural) +4237) goldfield (+plural - Kevin Atkinson wordlist 60) +4238) headcase (+plural - Oxford: informal - Kevin Atkinson wordlist 60) +4239) headcam +4240) headbutt (+ed +ing) +4241) headbanging +4242) headbanger (+plural) +4243) headage +4244) suckler (+plural) +4245) unweaned +4246) unweary +4247) unwedded (+ness - another way of unwed) +4248) unweighted +4249) unwept +4250) unwhipped +4251) unwinnable +4252) unwisdom +4253) unwired +4254) unwinking (+ly) +4255) helipad (+plural - Kevin Atkinson wordlist 60) +4256) holism (Kevin Atkinson wordlist 60) +4257) holist (+plural) +4258) serialism +4259) serialist (+plural) +4260) atonalism +4261) atonalist (+plural) +4262) jeeze + geez (another way of jeez - Oxford: informal) +4263) wearables (added plural) +4264) millennials (added plural) +4265) Jehovah's (added the 's) +4266) millenarianist (+plural) +4267) millenarians (added plural) +4268) apocalyptically +4269) eschatological +4270) eschatologist (+plural) +4271) unmediated +4272) unmelodic +4273) unmelted +4274) unmemorably (merged into unmemorable) +4275) unmercifulness (merged into unmerciful) +4276) unmetalled +4277) unmetered +4278) unmetrical +4279) unmethodically (merged into unmethodical) +4280) unmilitary +4281) unmindfully +4282) unmindfulness +4283) unmissed +4284) unmistaken +4285) unmitigatedly +4286) bombardon (+plural) +4287) saxhorn (+plural) +4288) sedum (+plural) +4289) bellflowers (added plural) +4290) untrusty (Collins) +4291) counterstyle (Collins) +4292) unthorough (Collins) +4293) uninstallation (+plural) +4294) hoick (+s +ing +ed - Kevin Atkinson wordlist 60) +4295) hoofers (added plural - Kevin Atkinson wordlist 60) +4296) hetero (+s +'s - Kevin Atkinson wordlist 60) +4297) hotpots (added plural - Kevin Atkinson wordlist 60) +4298) interwar (Kevin Atkinson wordlist 60) +4299) ironwood (added singular - Kevin Atkinson wordlist 60) +4300) jerrycan (+plural - Kevin Atkinson wordlist 60) +4301) jerrican (+plural - another way of previous word) +4302) leucotomy (+plural - Kevin Atkinson wordlist 60) +4303) lexis (changed to lower case - Oxford) +4304) lexigram (+plural) +4305) errorless (merged into error) +4306) catchweight +4307) listenable (Kevin Atkinson wordlist 60) +4308) listenability +4309) linkman + linkmen (Kevin Atkinson wordlist 60) +4310) lughole (+plural - Kevin Atkinson wordlist 60) +4311) lulus (added plural - Kevin Atkinson wordlist 60) +4312) lumpectomy (+plural - Kevin Atkinson wordlist 60) +4313) meteorologically +4314) unbearableness +4315) unbeautiful (+ly) +4316) unbefitting (+ly +ness) +4317) unbeholden +4318) irreligion +4319) irreligionist +4320) irreligiously +4321) irreligiousness +4322) irremissible +4323) irremovability +4324) irremovably +4325) irreplaceably +4326) irreproachability +4327) irreproducible +4328) bcc (Blind carbon copy - used in e-mails) +4329) b.c.c. (another way of previous word) +4330) aberdevine (Collins) +4331) siskin (Collins) +4332) uninstal (+s - Oxford: another way in British for uninstall) +4333) prolongedly +4334) prolusion +4335) phonecard (+plural) +4336) collet +4337) photocard (Collins) +4338) photocall (+plural) +4339) phonematic (Collins - another way of phonemic) +4340) battlespace (Collins) +4341) counterbored (merged into counterbore) +4342) bolthole (+plural) +4343) necrophile +4344) necrophilic +4345) necrophilism +4346) necrophilist +4347) necrophobia +4348) theurgy +4349) theurgic +4350) theurgical +4351) theurgist (+plural) +4352) Wiccans (added plural) +4353) rosacea +4354) asthenia +4355) asthenic +4356) cellulitis +4357) barotrauma +4358) necrose (+ed) +4359) necropsies (plural of necropsy) +4360) PayPal's (added the 's) +4361) majeure (force majeure) +4362) benchwork +4363) dogfood (+ing) +4364) outgun (+s +ing +ed) +4365) Dakota's (added the 's) +4366) Hutterite (+plural) +4367) cytophotometry (+ic) +4368) cytophotometer (+plural) +4369) macronuclear (Collins) +4370) conjugant (Collins) +4371) conjurator (Collins) +4372) conjugality +4373) unconjugal (Collins) +4374) sexercise (Collins) +4375) sexennium (+plural) +4376) sexennia (another plural of previous word) +4377) cinquefoil +4378) sexologic (Collins) +4379) sexological +4380) uncontainable +4381) unconstructive +4382) muscleman + musclemen (Kevin Atkinson wordlist 60) +4383) muscly (+ier +iest - Kevin Atkinson wordlist 60) +4384) weanlings (added plural) +4385) unwatchful +4386) unwatered +4387) myxomatosis (Kevin Atkinson wordlist 60) +4388) naturism (Kevin Atkinson wordlist 60) +4389) naturists (add plural - Kevin Atkinson wordlist 60) +4390) non-official +4391) nosebags (add plural - Kevin Atkinson wordlist 60) +4392) nosepiece +4393) noshery (+plural) +4394) nosocomial +4395) electroreception +4396) electroreceptor +4397) planktic +4398) planktonic +4399) foraminifer (+plural) +4400) foraminifera (another plural of previous word) +4401) foraminiferal +4402) foraminiferan (+plural) +4403) foraminiferous +4404) zooxanthella +4405) zooxanthellae (plural of previous word) +4406) zooxanthellate +4407) SCOWL (+'s) +4408) readme + README (Collins) +4409) rechipping +4410) officialese (Kevin Atkinson wordlist 60) +4411) oilcan (+plural - Kevin Atkinson wordlist 60) +4412) oilbird (+plural) +4413) goatsucker (+plural) +4414) nightjar (+plural) +4415) chirr (+ing +ed) +4416) churr (+ing +ed - another way of previous word) +4417) chiropteran (+plural) +4418) cardiothoracic +4419) cardiorespiratory +4420) sequela +4421) sequelae (plural of previous word) +4422) sepulture +4423) orangish +4424) orangewood (Collins) +4425) outperformance +4426) outworker (+plural - Kevin Atkinson wordlist 60) +4427) outworld (+er +ers) +4428) oxtails (added plural - Kevin Atkinson wordlist 60) +4429) paintball (+s +er +ers +ing) +4430) paparazzo (Kevin Atkinson wordlist 60) +4431) phat (Kevin Atkinson wordlist 60) +4432) Picasso (name) +4433) Picassoesque +4434) picaro (+plural) +4435) pinewood (+plural - Kevin Atkinson wordlist 60) +4436) pitheads (added plural - Kevin Atkinson wordlist 60) +4437) playschools (added plural - Kevin Atkinson wordlist 60) +4438) playmaker (+plural) +4439) playmaking +4440) racegoer (added singular) +4441) racecard (+plural) +4442) poppets (added plural - Kevin Atkinson wordlist 60) +4443) postmenopausal (Kevin Atkinson wordlist 60) +4444) precast (+s +ing) +4445) adenomatous +4446) psychoanalytically (Kevin Atkinson wordlist 60) +4447) bibliotherapy +4448) punchbag (+plural - Kevin Atkinson wordlist 60) +4449) headguard (+plural) +4450) quick-fire +4451) quietist (+plural +ic) +4452) ragga +4453) railcard (+plural - Kevin Atkinson wordlist 60) +4454) railbus (+plural) +4455) railcar (+plural) +4456) springless +4457) springlet (+plural) +4458) hornbeams (added plural) +4459) junglefowl +4460) backstory (+plural) +4461) bandfish (+plural) +4462) agrestic +4463) agrichemical (+plural - another way of agrochemical) +4464) apatosaurus +4465) brachiosaurus +4466) diplodocus +4467) daybook (+plural) +4468) dayboat +4469) daysailor +4470) bifold +4471) windslab (+plural) +4472) dynode (+plural) +4473) defervesce (+ed) +4474) defibrillation +4475) defibrillate (+ed +ion) +4476) discographer (+plural) +4477) discoid (+al) +4478) venter (+plural) +4479) ventail +4480) coeternal (+ally) +4481) fluoroscopy +4482) fluoroquinolone +4483) non-pregnant +4484) sulfacetamide +4485) microsurgeons (added plural) +4486) colossuses (another plural of colossus) +4487) maldevelopment +4488) cicatrize (+s +ed +ing +ion -IZE-) +4489) cicatrise (+s +ed +ing +ion -ISE-) +4490) cicatricial +4491) novelly (merged into novel) +4492) lesbigay (+plural - Oxford: informal) +4493) lesbo (+plural - Oxford: informal offensive) +4494) Lesbos (Island in Greece) +4495) Sprachgefühl +4496) eggcorn +4497) advocaat +4498) caipirinha (+plural) +4499) cachaca +4500) chincherinchee (+plural) +4501) chinaberry (+plural) +4502) cranesbill (+plural) +4503) abutilon +4504) clivia (+s +'s) +4505) beddable (Oxford: informal) +4506) fanciable (Oxford: informal) +4507) culverin (+plural) +4508) localism (added singular) +4509) localist (+plural) +4510) bacteraemia +4511) untagging +4512) freemium +4513) freeride (+ing) +4514) biathlete (+plural) +4515) fieldcraft +4516) fairlead (+plural) +4517) Bel (another word for Baal) +4518) Dione (name) +4519) Enceladus (name) +4520) mucocutaneous (Collins) +4521) bpm (abbreviation: beats per minute) +4522) BPhil +4523) caravanners (added plural) +4524) caravanette (+plural) +4525) coatigan +4526) all-knowing +4527) supranationality +4528) supramundane +4529) subnuclear +4530) subnormality +4531) suboptimally (merged into suboptimal) +4532) subordinary (+plural) +4533) subnetwork +4534) submunition (+plural) +4535) submultiple (+plural) +4536) submucosa +4537) submucosae (plural of previous word) +4538) gradable +4539) gradability +4540) cross-beam (+plural) +4541) cross-border +4542) cross-colour +4543) cross-contaminate (+ed +ing) +4544) cross-connection (+plural) +4545) cross-correlate (+ed) +4546) cross-correlation (+plural) +4547) i-mode +4548) I-beam (+plural) +4549) I-chun (variant of Yichun) +4550) Yichun (city in China) +4551) demos +4552) demoi (plural of previous word) +4553) demotivation +4554) goateed (merged into goatee) +4555) swallow-tailed +4556) developable +4557) devein (+ed) +4558) ethnologic (merged into ethnology) +4559) ethnologically +4560) folkloristic +4561) folklife +4562) theanthropic +4563) guncotton +4564) tagliatelle +4565) capellini +4566) fettucine + fettucini (there are three words for this, one was already in) +4567) fettuccine (fix: removed plural, since this is already a plural word) + + +V2.20 - 1-JAN-2015 +------------------ +4568) scramjet (+plural) +4569) neurofeedback (Collins) +4570) astrochemists (added plural) +4571) astrocompass +4572) m (abbreviation) +4573) ratbag (+plural - Kevin Atkinson wordlist 60) +4574) Rottweiler (+plural - but uppercase - Kevin Atkinson wordlist 60) +4575) rotters (added plural - Kevin Atkinson wordlist 60) +4576) roughcast (Kevin Atkinson wordlist 60) +4577) rowlock (+plural - Kevin Atkinson wordlist 60) +4578) schoolkid (+plural - Kevin Atkinson wordlist 60) +4579) exteroceptor (+plural) +4580) interoceptor (+plural) +4581) chemoceptors (+plural - Collins) +4582) proprioceptor (+plural) +4583) propshaft +4584) proprioceptively +4585) bayside +4586) earthnut +4587) pignut (+plural) +4588) androcracy (+plural) +4589) androcratic +4590) androcentric +4591) androcentrism +4592) partridgeberry (+plural) +4593) anabiosis +4594) anabiotic +4595) chlorosis +4596) chloroses (plural of previous word) +4597) chlorotic +4598) aleurone +4599) acropetal (+ally) +4600) basipetal (+ally) +4601) taproot (+plural) +4602) tapster (+plural) +4603) digestif (added singular) +4604) predigestion +4605) ptyalin +4606) Carnivora (plural noun) +4607) extendability +4608) extendable +4609) multiscreen (Collins) +4610) multirange (Collins) +4611) nonequilibrium (Collins) +4612) OODA (loop - military) +4613) differentia +4614) differentiae (plural of previous word) +4615) ecotourism (+'s) +4616) ecotour (+plural) +4617) ecotourist (+plural) +4618) ecotoxicology +4619) ecotoxicological +4620) ecotoxicologist +4621) nontarget (Collins) +4622) ecotown (+plural) +4623) arcology (+plural) +4624) bioremediation +4625) bioregion (+plural) +4626) bioregional +4627) cropland (+plural) +4628) autoxidation +4629) autoxidize (+s +ing - IZE) +4630) autoxidise (+s +ing - ISE) +4631) autotype (+s) +4632) autogenesis (Collins) +4633) autogeny (Collins: another way of previous word) +4634) autogenetic (Collins) +4635) electrogenesis (Collins) +4636) Valium +4637) Librium +4638) Orbison (+'s - name) +4639) intrathecal (+ally) +4640) intraspecific +4641) genet (+plural) +4642) antechapel +4643) bioplay +4644) bioplasm (+ic - Collins) +4645) emoticon (+plural) +4646) emotionalist (+plural) +4647) subnational (Collins) +4648) anti-government +4649) nongovernment (Collins) +4650) nongovernmental (Collins) +4651) supergovernment (Collins) +4652) governmentalism (Collins) +4653) incrementalism +4654) incrementalist (+plural) +4655) inadaptive (Collins) +4656) adaption (+plural) +4657) preadaptive (Collins) +4658) adaptogen (+plural) +4659) balneology +4660) balneological +4661) balneologist (+plural) +4662) balneotherapy +4663) caramelization (-IZE) +4664) caramelisation (-ISE) +4665) carambola (+plural) +4666) eggfruit (Collins) +4667) satsuma (+plural) +4668) Satsuma (name of province) +4669) blackberried (merged into blackberry) +4670) hackberry (+plural) +4671) hackathon (+plural - Oxford: informal) +4672) incurvate (+ed) +4673) incurvation (+plural) +4674) railbed (Collins) +4675) railage +4676) railless +4677) bogie (+plural) +4678) bogland +4679) Achill (island) +4680) deuterons (added plural) +4681) photosystem (+plural) +4682) phototherapy +4683) phototransistor +4684) phototropism +4685) phototropic +4686) phototaxis +4687) phototaxes (plural of previous word) +4688) phototactic +4689) heliotropism +4690) heliotropic +4691) shitwork (Oxford: vulgar slang) +4692) wetware +4693) disincorporate (+ing) +4694) disinfest (+ing +ion) +4695) disintermediate (+ed +ion) +4696) disinvent (+ed) +4697) disinvite (+ed +ing) +4698) disinvoltura +4699) disjoins + disjoined (merged into disjoin) +4700) ubuntu (+'s - also allow lower case) +4701) permalink (+plural) +4702) permaculture +4703) permadeath +4704) foldback (Collins) +4705) readvance (Collins) +4706) readapt (+s +ing +ed +ion) +4707) readerly +4708) undersense (Collins) +4709) letterset +4710) intersex (+plural) +4711) interspace (+s +ed) +4712) interspinal +4713) interspinous +4714) interstadial +4715) intersegmental (+ally) +4716) Peterson (+'s - name) +4717) Jespersen (+'s - name) +4718) petrogeny +4719) petrogenesis (another way of the previous word) +4720) countercurrent (+plural) +4721) counterfactual (+plural) +4722) firebug (fixed: fire-bug and added plural) +4723) firepit +4724) firedog (+plural) +4725) palazzo (+plural) +4726) palazzi (another plural way of the previous word) +4727) palea +4728) paleae (plural of previous word) +4729) extrorse +4730) introrse +4731) introspect +4732) anadromous +4733) catadromous +4734) intrigant +4735) colourable +4736) cryptococcosis +4737) cryptococcal +4738) coolth +4739) CoolMax (trademark) +4740) bombazine +4741) breathability +4742) Pennsylvanian (+plural) +4743) chetrum (+plural - currency) +4744) afghani (+plural - currency) +4745) avoparcin +4746) enterovirus (+plural) +4747) rhinovirus (+plural) +4748) picornavirus (+plural) +4749) coronavirus (+plural) +4750) VS (Veterinary Surgeon) +4751) vs (Versus) +4752) vroom (+ed) +4753) min +4754) secs (added plural) +4755) SECAM +4756) offshoring +4757) vegetatively +4758) vegetativeness +4759) sargassum +4760) clubroot +4761) nightclubber (+plural - merged into nightclub) +4762) mentorship (Collins) +4763) ballgown (+plural) +4764) videographers (added plural) +4765) post-tension +4766) extensometer (+plural) +4767) floodwater (+plural) +4768) floorcloth (+plural) +4769) posthospital (Collins) +4770) posttreatment (Collins) +4771) twerk (+s +ing) +4772) choreology +4773) choreologist +4774) onesie (+plural) +4775) descriptivist (+plural) +4776) phenomenalism +4777) phenomenalist +4778) phenomenalistic +4779) physicalism +4780) physicalist +4781) physicalistic +4782) mentalism +4783) mentalistic +4784) neonomian (+plural - Collins) +4785) neonomianism (Collins) +4786) techno +4787) soundscape (+plural) +4788) Thomas's (added the 's) +4789) semiquaver (added singular) +4790) semiquinone (+plural) +4791) phototoxicity (Collins) +4792) superoxide +4793) superorder +4794) supernaturalist (+plural) +4795) supernormality +4796) superordinates (added plural) +4797) superplastic +4798) superplasticity +4799) supersale (Collins) +4800) superreal (Collins) +4801) supermale (Collins) +4802) supersalt (Collins) +4803) superjet (Collins) +4804) supersell (+er - Collins) +4805) superfusion +4806) superfood (+plural) +4807) superfluidity +4808) superfluid (+plural) +4809) superfatted +4810) auriculate +4811) auriculotherapy +4812) allopath +4813) catmint (+'s) +4814) catlick (Oxford: informal) +4815) circumvallate (+ed +ing) +4816) play's (added the 's) +4817) venography +4818) venographic +4819) venographically +4820) extravasation (merged into extravasate) +4821) vasculature +4822) cross-promotion +4823) cross-promote (+ed) +4824) cross-question (+ing +ed) +4825) home-cooked +4826) seedeater (fixed: seed-eater) +4827) bowerbird (+plural) +4828) brassfounder (+plural - Collins) +4829) coppernob (+plural - Oxford: informal) +4830) flybridge +4831) skybridge (Collins) +4832) fly-by (+plural "fly-bys") +4833) arm-wrestling +4834) arm-wrestle +4835) audax (+plural) +4836) valorousness (merged into valorous) +4837) venturous (+ness) +4838) temerarious (+ness) +4839) mesothelioma (+plural) +4840) mesotherapy +4841) mesothorax +4842) mesothoracic +4843) metathorax +4844) metathoracic +4845) interneural (Collins) +4846) stereoregular (Collins) +4847) stereometry +4848) stereological (+ally - Collins) +4849) stereogram (+plural) +4850) stereocamera (+plural) +4851) stereognosis +4852) stereognostic +4853) thermic +4854) interneuron +4855) interneurone (another way of previous word) +4856) interneuronal +4857) internode (+plural) +4858) depaint (Collins) +4859) dependingly (Collins) +4860) depravingly (Collins) +4861) depravation (merged into deprave - Collins) +4862) depreciatory +4863) Németh (+'s - name) +4864) László (+'s - name) +4865) cryptonymous +4866) monorchid (+plural) +4867) monorchidism +4868) cathodoluminescence +4869) anisotropically +4870) undrained +4871) metagenesis +4872) metagenetic +4873) metageneses (plural of metagenesis - Collins) +4874) muniment (+plural) +4875) alienage +4876) spondylolysis (Collins) +4877) agammaglobulinaemia +4878) agammaglobulinemia (another way of previous word) +4879) antepartum +4880) intrapartum (Collins) +4881) intrasexual (Collins) +4882) bicephalous +4883) electronica +4884) craniofacial +4885) craniology +4886) craniological +4887) craniologist (+plural) +4888) overexcitable +4889) overexcitement +4890) Napster (+'s - software) +4891) scattergun +4892) scattershot +4893) scatty (+ier +iest +ly +ness - Oxford: informal) +4894) impactful +4895) frameable + frameless (merged into frame) +4896) Xeon +4897) Centrino +4898) vPro +4899) Itanium (+'s) +4900) microclimate (+s +ic) +4901) microclimatically +4902) micropower +4903) microprobe (+plural) +4904) macrocephalic +4905) macrocephalous (another way of previous word) +4906) macrocephaly +4907) cerebrovascular +4908) intracranial (+ly) +4909) intractableness +4910) intradermal (+ly) +4911) micropropagation +4912) micropterous +4913) microRNA +4914) microscooter (+plural) +4915) yo-yos (added plural) +4916) yo-yoing, yo-yoed (verb - merged into yo-yo) +4917) yo-yoes (verb) +4918) foldable (merged into fold) +4919) microampere (Collins) +4920) Thomist (+plural) +4921) Thomistic +4922) covenantal +4923) covenantor (+plural +'s) +4924) scorelines (added plural - Kevin Atkinson wordlist 60) +4925) scorekeeping +4926) scrutineer (added singular - Kevin Atkinson wordlist 60) +4927) shambolic (+ally - Kevin Atkinson wordlist 60) +4928) sharpish (Kevin Atkinson wordlist 60) +4929) shebeen (+plural - Kevin Atkinson wordlist 60) +4930) sheetlike (Collins - Kevin Atkinson wordlist 60) +4931) shitload (Oxford: vulgar slang - Kevin Atkinson wordlist 60) +4932) shit-faced (Oxford: vulgar slang - Kevin Atkinson wordlist 60) +4933) bristlebird (+plural) +4934) birdling (+plural) +4935) shh (Kevin Atkinson wordlist 60) +4936) sh (another way of previous word) +4937) acupoint (+plural) +4938) aromatherapeutic +4939) showerproof (+ed +ing) +4940) circlip (+plural) +4941) desuperheater (+plural) +4942) Interweb +4943) intervocalically +4944) obstruent (+plural) +4945) sonorant (+plural) +4946) atonic +4947) atony +4948) homorganic +4949) homophile (+plural) +4050) servery (+plural - Kevin Atkinson wordlist 60) +4051) smoocher (+plural - merged into smooch) +4052) smoochy (+ier +iest) +4053) weirdo (+plural +'s - Kevin Atkinson wordlist 40) +4054) Mbit (Collins) +4055) XMP +4056) SNR (signal-to-noise ratio) +4057) THz +4058) skinful (Kevin Atkinson wordlist 60) +4059) skinfold (+plural) +4060) subscapular (Collins) +4061) smokily (merged into smoky) +4062) smokey (another way of smoky - Kevin Atkinson wordlist 60) +4063) snog (+s +ing +ed +er +ers - Kevin Atkinson wordlist 60) +4064) softback (+plural - Kevin Atkinson wordlist 60) +4065) unremitted (+ly - Collins) +4066) slutty +4067) sluttishness (merged into sluttish) +4068) softcover (Kevin Atkinson wordlist 60) +4069) songwriting (Kevin Atkinson wordlist 60) +4070) sprog (+s +ing +ed - Kevin Atkinson wordlist 60) +4071) spiv (+plural - Kevin Atkinson wordlist 60) +4072) spivvish +4073) spivvy (+ier +iest) +4074) splake +4075) splanchnopleure +4076) endoblast (+ic - Collins) +4077) splashback (+plural) +4078) splashboard (+plural) +4079) splatterpunk (+plural) +4080) spleenwort (+plural) +4081) polypody (+plural) +4082) bryophyte (+plural) +4083) trichome (+plural) +4084) trichology +4085) trichological +4086) trichologist (+plural) +4087) stallholder (added singular - Kevin Atkinson wordlist 60) +4088) stallage +4089) pontage (Collins) +4090) lastage (Collins) +4091) arborist +4092) eyebright +4093) arrowgrass +4094) barrenwort (+plural) +4095) bioadhesive (+plural) +4096) buccal +4097) gingiva +4098) gingivae (plural of previous word) +4099) radula +4100) radulae (plural of previous word) +4101) radular +4102) graminivorous +4103) grammalogue +4104) anteverted +4105) anteroposterior +4106) anterolateral +4107) anterograde +4108) Atkins's (added the 's) +4109) churchianity (Collins) +4110) hiya (Oxford: informal) +4111) HIV-negative +4112) HIV-positive +4113) acidimetry (+ic) +4114) acidimetrical +4115) acidimetrically +4116) conjunctional +4117) amphibologies (added plural) +4118) statementing + statemented (Kevin Atkinson wordlist 60) +4119) stationmasters (added plural - Kevin Atkinson wordlist 60) +4120) Lankan (+plural - Sri Lanka) +4121) sundress (+plural - Kevin Atkinson wordlist 60) +4122) sundrops +4123) suntrap (+plural - Kevin Atkinson wordlist 60) +4124) summat (Kevin Atkinson wordlist 60) +4125) suppertime (Collins - Kevin Atkinson wordlist 60) +4126) supremos (added plural troppy +4127) confederal +4128) collectorate +4129) centrism +4130) strikebound (Collins - Kevin Atkinson wordlist 60) +4131) sweatsuit (+plural - Kevin Atkinson wordlist 60) +4132) succubi (plural of succubus - Kevin Atkinson wordlist 60) +4133) stripey (another way of stripy - Kevin Atkinson wordlist 60) +4134) stripier +4135) stripiest +4136) strivers (added plural) +4137) lamish (Collins) +4138) spambot (+plural - Collins) +4139) spammie (Collins) +4140) pregnable +4141) preglacial +4142) pregnability (Collins) +4143) pregrowth (Collins) +4144) preguide (Collins) +4145) prehension +4146) prehistorian (+plural) +4147) prehuman (+plural) +4148) brainbox (+plural - Oxford: informal) +4149) troppy (+ier +iest +ly +ness - Kevin Atkinson wordlist 60) +4150) strophanthin +4151) analeptic (+plural) +4152) meperidine +4153) prolepsis +4154) prolepses (plural of previous word) +4155) proleptic +4156) propertyless (Collins) +4157) Avernus (lake in Italy) +4158) stunners (added plural - Kevin Atkinson wordlist 60) +4159) stunsail (+plural) +4160) tarty (+ier +iest +ly +ness) +4161) tarweed (+plural) +4162) forb (+plural) +4163) betatrons (added plural) +4164) thermopiles (added plural) +4165) chromakey +4166) tatami (+s +'s - Kevin Atkinson wordlist 60) +4167) clapperboard +4168) telesales (Kevin Atkinson wordlist 60) +4169) telerecordings (added plural) +4170) telework +4171) televisually (merged into televisual) +4172) keypal (+plural - Oxford: informal) +4173) penfriend (+plural) +4174) twinset (+plural - Kevin Atkinson wordlist 60) +4175) zookeeper (+plural +'s - Kevin Atkinson wordlist 60) +4176) zloties (added plural - Kevin Atkinson wordlist 60) +4177) zlotys (another plural of previous word) +4178) zine (+plural - Kevin Atkinson wordlist 60) +4179) ya (Kevin Atkinson wordlist 60) +4180) Y2K (year 2000) +4181) clickable +4182) clickbait +4183) wordsmith (+plural - Kevin Atkinson wordlist 60) +4184) vapourware +4185) overhype (+ed) +4186) bibliolater (+plural) +4187) bibliomancy +4188) Ching (I Ching) +4189) ching +4190) bibliomania +4191) bibliomaniac (+'s) +4192) bibliophilic +4193) bibliophily +4194) bibliopole (+plural) +4195) bibliometric (+plural) +4196) bibliomane (+plural) +4197) wing-like +4198) downstroke +4199) downswing (+plural) +4200) waybill (+s +'s - Kevin Atkinson wordlist 60) +4201) watchable (Kevin Atkinson wordlist 60) +4202) watchability +4203) weedkiller (+plural - Kevin Atkinson wordlist 60) +4204) weedicide (+plural) +4205) weedgrown +4206) weebill (+plural) +4207) apostlebird (+plural) +4208) currawong (+plural) +4209) weeder (+plural) +4210) weedless (merged into weed - Kevin Atkinson wordlist 60) +4211) warm-blooded (+ness) +4212) warmblood (+plural) +4213) vulturine +4214) vulturish +4215) vulturous (Kevin Atkinson wordlist 60) +4216) boobook (+plural) +4217) blackpoll (+plural) +4218) watchstrap (+plural - Collins - Kevin Atkinson wordlist 60) +4219) voicelessness (merged into voiceless - Kevin Atkinson wordlist 60) +4220) vigesimal (Kevin Atkinson wordlist 60) +4221) centesimal (+ly) +4222) vincible (Kevin Atkinson wordlist 60) +4223) vincibility +4224) urogenital (Kevin Atkinson wordlist 60) +4225) urography +4226) urogram (+plural) +4227) urodynamic (+plural) +4228) varix +4229) varices (plural of previous word) +4230) endocarditis +4231) endocarditic +4232) unsmart (Collins) + + +V2.21 - 1-FEB-2015 +------------------ +4233) Crowley's (added the 's) +4234) recursivity (+plural - Wiktionary) +4235) recursiveness (Wiktionary) +4236) she-male (+plural) +4237) pseudocode (+plural +ed - Wiktionary) +4238) pseudocopulation +4239) scumbag (+plural - Oxford: informal) +4240) heterosocial (Collins) +4241) heterosociality (Collins) +4242) homosocial (Collins) +4243) homosociality (Collins) +4244) homosexualist (+plural - Collins) +4245) homosex (Collins) +4246) heteropteran (+plural) +4247) heteropterous +4248) limewash (+plural +ing +ed) +4249) limescale +4250) BMWs (added plural) +4251) limepit +4252) Robben (name of island) +4253) Bornholm (name of island) +4254) born-free (+plural) +4255) Bornean +4256) quoll (+plural) +4257) monkery (Oxford: derogatory) +4258) zealotry +4259) deseed (+ed) +4260) deseeder (+plural) +4261) terotechnology +4262) terotechnological +4263) terotechnologist (+plural) +4264) microtechnology +4265) microtechnological +4266) waveguide (+plural) +4267) Adidas (+'s - name) +4268) geotechnology (Collins) +4269) femtosecond (+plural) +4270) fs (abbreviation of previous word) +4271) femtocell +4272) unfought (Collins) +4273) unforked (Collins) +4274) unforgivingness (Collins) +4275) refigure (Collins - +plural +ing +ed - Wiktionary) +4276) refire (Collins - +plural +ing +ed - Wiktionary) +4277) dentary (+plural) +4278) readd (Collins - +plural +ing +ed - Wiktionary) +4279) rebottle (Collins - +plural +ing +ed +er +ers - Wiktionary) +4280) hypertrophic (merged into hypertrophy) +4281) Barbie (+plural +'s - name) +4282) guidable +4283) cutscene (+plural) +4284) whatsit (+plural - Kevin Atkinson wordlist 60) +4285) whee (Kevin Atkinson wordlist 60) +4286) horseshed +4287) Fenimore (+'s - name) +4288) coopery (+plural) +4289) peridot (+plural) +4290) peridium +4291) peridia (plural of previous word) +4292) galea +4293) galeae (plural of previous word) +4294) low-carb (Oxford: informal) +4295) low-class +4296) yonks (Kevin Atkinson wordlist 60) +4297) Zinfandel (+'s +plural) +4298) zonal (+ly) +4299) rack-and-pinion +4300) fishplate (+plural - fixed: fish-plate) +4301) bodyshell (+plural) +4302) switchable (merged into switch - Kevin Atkinson wordlist 40) +4303) postdoc (+plural - Kevin Atkinson wordlist 40) +4304) postcolonialism +4305) postcolonialist +4306) postcoded (merged into postcode) +4307) mailboat (+plural) +4308) Percy's (added the 's) +4309) postwoman +4310) postwomen (plural of previous word) +4311) Boulogne (+'s - name) +4312) synovial +4313) flexion +4314) flection (another way of previous word) +4315) dorsiflex (+plural +ing +ed +ion) +4316) electromyograph +4317) electromyography +4318) chemoprevention (Collins) +4319) Palomar (+'s - name) +4320) serine +4321) bugbane (+plural) +4322) squawroot (+plural) +4323) tidemark (+plural) +4324) tideline (+plural) +4325) saltings (added plural) +4326) geodata +4327) neoclassicist (+plural) +4328) neorealism +4329) neorealist (+plural) +4330) academicism +4331) academism (another way of previous word) +4332) academicals (added plural) +4333) Picasso's (added the 's) +4334) iconology +4335) iconological +4336) iconolatry +4337) deconstruct (+plural +ing +ed +ive) +4338) outsized (merged into outsize) +4339) should've +4340) corporatize (+plural +ed +ing +ion - IZE) +4341) corporatise (+plural +ed +ing +ion - ISE) +4342) hereditament (+plural) +4343) hereditarily + hereditariness (merged into hereditary) +4344) hereditarian (+plural) +4345) hereditarianism +4346) nanotechnological +4347) nanotechnologist (+plural) +4348) neurovascular (Collins) +4349) nanocomposite (+plural) +4350) undersize +4351) undershrub (+plural) +4352) kneeled (another past of kneel) +4353) kneehole +4354) knee-highs (added plural) +4355) cerebroside (+plural) +4356) workup (+plural) +4357) jackstay +4358) Tobruk (+'s - name of place) +4359) woosh (+plural +ing +ed - another way of whoosh) +4360) Jacinto (+'s - name) +4361) starboarding (merged into starboard) +4362) bioprospecting +4363) bioprospector (+plural) +4364) Kamchatka (+'s - name) +4365) flamethrowers (added plural) +4366) laserdiscs (added plural) +4367) Betacam (trademark) +4368) Betamax (trademark) +4369) PlayStation (+plural) +4370) breakfront +4371) Easton (+'s - name) +4372) geochronological +4373) geochronologist (+plural) +4374) declivitous +4375) bluntish (Collins) +4376) subchapter (+plural - Collins) +4377) cosupervisor (+plural - Wiktionary) +4378) supervoltage (+plural) +4379) cosupervision (Wiktionary) +4380) cosupervise (+plural +ing +ed - Wiktionary) +4381) resect (+ed +able) +4382) resectional +4383) resectionist +4384) microbiologically (Collins) +4385) microbiologic (Collins) +4386) Cmd. (abbreviation - UK - Command Paper - 4th series) +4387) Cmnd. (abbreviation - UK - Command Paper - 5th series) +4388) handgrip (+plural) +4389) cyanoacrylate (+plural) +4390) photostimulation (+plural - Wiktionary) +4391) chromophore (+plural) +4392) chromophoric +4393) chromoplast (+plural) +4394) exoatmospheric +4395) exobiological +4396) exobiologist (+plural) +4397) ethnolinguistics +4398) ethnolinguist (+plural) +4399) ethnohistory +4400) ethnohistorian (+plural) +4401) ethnohistoric +4402) ethnohistorical +4403) ethnoscience +4404) ethogram (+plural) +4405) twinflower (+plural) +4406) townland (+plural) +4407) chronometry +4408) chronometrical +4409) chronometrically +4410) chronotherapy +4411) chronostratigraphy (+ic) +4412) substage +4413) subspecific +4414) subsonically +4415) deflagration +4416) ketones (added plural) +4417) ketonic +4418) ferrocene (+plural) +4419) ferroconcrete +4420) ferroelectrics (added plural) +4421) ferroelectricity +4422) ferromagnetism +4423) Zeeman (Zeeman effect) +4424) atomicities (added plural) +4425) multiagent (+plural - Wiktionary) +4426) non-typical +4427) non-transparency +4428) non-U (Oxford: informal) +4429) non-urban +4430) non-use +4431) non-validity +4432) non-variable +4433) non-vintage +4434) non-word (added singular) +4435) irregardless (Oxford: informal) +4436) irrefutability +4437) refutability (Collins) +4438) regalism +4439) regalist (+plural) +4440) canonry (+plural) +4441) Bastogne (name of place) +4442) Junagarh (name of place) +4443) flaunching +4444) leadwork (+plural - Collins) +4445) flat-woven +4446) flat-weave +4447) dhurrie (+plural) +4448) durrie (+plural - another way of previous word) +4449) awardee (+plural) +4450) Waterville (name of place) +4451) award-winning +4452) traumatization (-IZE) +4453) traumatisation (-ISE) +4454) traumatism +4455) multicentre (Collins) +4456) multicentral (Collins) +4457) crossmatch (+plural +ing +ed) +4458) posttransfusion (Collins) +4459) eponymously (merged into eponymous) +4460) Lanchester (+'s - name) +4461) routinism +4462) routinist (+plural) +4463) routineness (merged into routine) +4464) streamlet (+plural) +4465) Zealander (added singular) +4466) psychosurgery +4467) psychosurgical +4468) radiochemist (+plural) +4469) bohrium +4470) permeance (+plural) +4471) electropositive +4472) electronegativity (+plural) +4473) electrophilic +4474) electrophile (+plural) +4475) nucleonic (+plural) +4476) nucleophilic +4477) nucleophile (+plural) +4478) nucleoplasm +4479) nucleoprotein (+plural) +4480) nucleosome (+plural) +4481) nucleosomal +4482) overprescribe (+s +ing +ed +ion) +4483) titanically +4484) Cicciolina (+'s - name) +4485) pornocracy (Collins) +4486) voguishly + voguishness (merged into voguish - Collins) +4487) prenominal (+ly - Collins) +4488) curricula vitae (removed since it was two words) +4489) curriculum vitae (removed since it was two words) +4490) curriculums (another plural way of curriculum) +4491) gradience +4492) ethnomethodological +4493) ethnomethodologist (+plural) +4494) avunculate +4495) queendom +4496) queenless +4497) queenlike +4498) queenship +4499) filamented (merged into filament) +4500) microelectrode (+plural - Collins) +4501) astrometry (+ic) +4502) Gaia (+'s - name) +4503) Gaian (+plural) +4504) ethicality +4505) primitivist (+plural) +4506) supervisee (+plural - Collins) +4507) re-enacts + re-enacted + re-enacting (merged into re-enact) +4508) re-enactment (+plural) +4509) re-enactor (+plural) +4510) handlist (+plural) +4511) Barack (name) +4512) McKinsey (+'s - name) +4513) NGOs (added plural) +4514) Croatians (added plural) +4515) Armenians (added plural) +4516) Assyrians (added plural) +4517) Encaenia +4518) succulently (merged into succulent) +4519) imbibition +4520) shadowland (+plural) +4521) shadowgraphs (added plural) +4522) radiographs (added plural) +4523) radiographed (added ed) +4524) radiographically +4525) radioimmunoassay +4526) radioisotopic +4527) andrology +4528) andrologist +4529) areology +4530) areological +4531) areologist (+plural) +4532) areole (+plural) +4533) glochid (+plural) +4534) discommodious +4535) discommodity +4536) sassy (+ier +iest +ly +ness - Oxford: informal) +4537) WWI (World War I) +4538) NYC (New York City) +4539) bushbuck (+plural) +4540) waterbuck (+plural) +4541) bonobo (+plural) +4542) capuchin (+plural) +4543) Capuchin (+plural - upper case - Franciscan order) +4544) Pio (+'s - name) +4545) stigmatist +4546) Francesco's (added the 's) +4547) sublanguage (+plural) +4548) sublateral +4549) subkingdom (+plural) +4550) Milton's (added the 's) +4551) subjunctively +4552) sublate (+plural +ed +ing +ion) +4553) egomaniacal +4554) egosurf (+plural +ed +ing - Oxford: informal) +4555) Baikal (+'s - name of lake) +4556) Baykal (+'s - another way of the previous word) +4557) Bresenham (+'s - name) +4558) milfoil (+plural) +4559) allamanda (+plural) +4560) plumeria (+plural) +4561) voiceful +4562) voice-activated +4563) glassmaking (fixed: glass-making) +4564) glassmaker (+plural) +4565) glasspaper (fixed: glass-paper) +4566) fiddleback +4567) saddleback (+plural +ed) +4568) birdlife (Collins) +4569) xix + XIX (Roman numeral - 19) +4570) Cyanobacteria (upper case) +4571) cyanobacteria (lower case) +4572) cyanobacterial +4573) stromatolite (+plural) +4574) apeman +4575) apemen (plural of previous word) +4576) coelurosaur (+plural) +4577) integumental +4578) integumentary +4579) reconstructable +4580) reconstructive +4581) reconstructor +4582) Egyptological +4583) Egyptologist (+plural) +4584) Tutankhamun (another way of Tutankhamen) +4585) centrefire +4586) varnisher (+plural) +4587) sealers (added plural) +4588) photocomposition +4589) photocurrent +4590) photodegradable +4591) lookism +4592) lookist +4593) essentialism +4594) Jesuitical (+ly) +4595) south-west (fixed: south-West) +4596) south-east (fixed: south-East) +4597) north-east (fixed: north-East) +4598) north-eastern (fixed: north-Eastern) +4599) north-west (fixed: north-West) +4600) north-western (fixed: north-Western) +4601) south-eastern (fixed: south-Eastern) +4602) southwardly (merged into southward) +4603) fatling +4604) Gatlings (added plural - Gatling gun) +4605) stowable (Collins) +4606) outlands (added plural) +4607) photochromic +4608) photochromism +4609) viologen (+plural) +4610) photo-oxidation +4611) irradiance +4612) anti-magnetic +4613) tweeze (+plural +ed +ing) +4614) tweezer (added singular) +4615) post-date (+plural +ed +ing - fixed: postdate) +4616) hybridity +4617) Ludwig's (added the 's) +4618) rotifers (added plural) +4619) multicell (+ed - Collins) +4620) telson (+plural) +4621) setiferous (Collins) +4622) setigerous (Collins - another way of previous word) +4623) Telstar (+'s - name of satellite) +4624) Ishtar (+'s - name) +4625) Qataris (added plural) +4626) VM (+plural - Virtual Machine - Wiktionary) +4627) V-mail +4628) ATMs (added plural) +4629) automagically (Oxford: informal) +4630) autologous +4631) decompensation +4632) decompensated +4633) hepatoma (+plural) +4634) hepatomata (another plural of previous word) +4635) hepatopancreas +4636) mouthpart (+plural) +4637) foregut (+plural) +4638) vitellogenin +4639) xenobiotic (+plural) +4640) recompilable (Wiktionary) +4641) compilatory (Collins) +4642) recompact (+plural +ing +ed - Wiktionary) +4643) GUIs (added plural - Wiktionary) +4644) burnoose (removed as it was American) +4645) burnous (British way of previous word) +4646) buttonhook (+plural) +4647) downfield +4648) Bukowski (+'s - name) +4649) Xbox (+plural - video game console - Wiktionary) +4650) Matroska +4651) FLAC (+'s) +4652) HEVC (+'s) +4653) MP3s (added plural) +4654) WAV (upper case) +4655) wav (lower case) +4656) terascale (Wiktionary) +4657) teraflop (+plural) +4658) electronvolt (+plural) +4659) eV (abbreviation of previous word) +4660) electro-oculogram +4661) electro-optic (+plural) +4662) electro-optical +4663) agarose +4664) MBA's + MBAs (merged into MBA) +4665) daywork (+er +ers) +4666) parasitize (+plural +ed +ing +ion - IZE) +4667) parasitize (+plural +ed +ing +ion - ISE) +4668) Rothstein (+'s - name) +4669) greenling (+plural) +4670) greenmailer (+plural) +4671) Garner (+'s - name) +4672) Greenaway (+'s - name) +4673) Pietro (name) +4674) annexationist (+plural) +4675) Zululand (name of place) +4676) KwaZulu-Natal (name of place) +4677) Indo-European +4678) Proto-Indo-European +4679) Indic +4680) indican +4681) bilirubin +4682) perimenopause +4683) perimenopausal +4684) undescended +4685) anaphylaxis +4686) telemedicine +4687) psychophysiological +4688) psychodynamic (+plural) +4689) psychodynamically +4690) antipyretic (+plural) +4691) hyperthermia +4692) hyperthermic +4693) bootloaders (added plural - Wiktionary) +4694) UEFI (Wiktionary) +4695) EFI +4696) sportsperson (+plural) +4697) sportspeople (another plural of previous word) +4698) sportswomanship +4699) sportswriter (+plural) +4700) doubletons (added plural) +4701) dumortierite +4702) hydroxyapatite +4703) hydrometric +4704) winemaking +4705) streamflow (+plural) +4706) snowpack (+plural) +4707) snowmobiling + snowmobiled + er + ers (merged into snowmobile) +4708) groomer (+plural - merged into groom) +4709) snowcat (+plural) +4710) heli-ski (+ing +er +ers) +4711) vrooming (merged into vroom) +4712) Vince's (added the 's) +4713) Neale (name) +4714) frequentative +4715) benefactive (+plural) +4716) grammaticalize (+ed +ion - IZE) +4717) grammaticalise (+ed +ion - ISE) +4718) Walkman (+plural) +4719) Walkmen (another plural of previous word) +4720) microchipping + microchipped (merged into microchip) +4721) woodchip (+plural) +4722) Collingwood (+'s - name) +4723) pavers (added plural) +4724) teahouse (+plural) +4725) Teagarden (+'s - name) +4726) contradance (+plural) +4727) coffee-houses (removed - Oxford: it has no hyphen, two words) +4728) Megan (+'s - name) +4829) megamouth (+'s) +4830) megaphonic (merged into megaphone) +4831) Babygro (+plural - trademark) +4832) babyishly + babyishness (merged into babyish) +4833) girly (another way of girlie + plural) +4834) malaguetta (+plural) +4835) malagueta (+plural - another way of the previous word) +4836) metasomatism +4837) metasomatic +4838) metasomatize (+ed - IZE) +4839) metasomatize (+ed - ISE) +4840) emplaced (merged into emplace) +4841) pluton (+plural) +4842) plutocratically +4943) backport (+plural +ing +ed - Wiktionary) +4944) demoscene (Collins) +4945) autosuggestion +4946) completist (+plural) +4947) autostereoscopy +4948) autosaves (merged into autosave) +4949) haplotype (+plural) +4950) cardio (Oxford: mass noun informal) +4951) goalball +4952) Paralympic (+plural) +4953) Paralympian (+plural) +4954) goalhanger (+plural) +4955) Kristine (name) +4956) Hawaiian's (added the 's) +4957) pseudosciences (added plural) +4958) pseudoscientists (added plural) +4959) Scientologist (+plural) +4960) symbology +4961) hagiology +4962) hagiological +4963) hagiologist (+plural) +4964) demonize (+plural +ed +ing - IZE) +4965) demonise (+plural +ed +ing - ISE) +4966) demonization ( - IZE) +4967) demonisation ( - ISE) +4968) infographics (added plural) +4969) infolded +4970) infomania +4971) infomaniac (+plural) +4972) infomediaries (added plural) +4973) infomercial (removed since it is chiefly American) +4974) infonauts (added plural) +4975) Rhode's (added the 's) +4976) subplot (fixed: sub-plot) +4977) subparallel +4978) subphylum +4979) Eutheria +4980) eutherian (+plural) +4981) lamella +4982) lamellae (plural of previous word) +4983) lamellar +4984) lamellate +4985) lamelliform +4986) lamellose +4987) pHs (added plural) +4988) cuvette (+plural) +4989) acetylcholinesterase +4990) cryoglobulin (+plural) +4991) glucoside (+plural +ic) +4992) geomatic (+plural) +4993) palaeomagnetism +4994) palaeomagnetic +4995) declinism +4996) Pitchford (+'s - name) +4997) footplates (added plural) +4998) diesel-electrics (added plural) +4999) batfish (+plural) +5000) bitterling (+plural) +5001) exoskeletal +5002) exfoliate (+plural +ing +ed +ion) +5003) exfoliative +5004) exfoliator (+plural) +5005) anticellulite (Collins) +5006) endoskeleton (+plural) +5007) endoskeletal +5008) endoscopically +5009) endoscopist (+plural) +5010) gastroscope (+plural +ic) +5011) gastroscopy +5012) bronchoscope (+plural) +5013) bronchoscopy +5014) pneumothorax +5015) reinflate (+plural +ed +ing +ion) +5016) reinflatable +5017) reinforcers (added plural) +5018) rebar +5019) positioner (+plural) +5020) declarant (+plural +'s) +5021) transexual (+plural +'s - another way of transsexual) +5022) noncultivated (Collins) +5023) Rackham (+'s - name) +5024) summiteer (+plural) +5025) orienteer (+plural +ed +ing) +5026) backcrawl +5027) dilophosaurus +5028) earthstar +5029) earthshine +5030) earthlight +5031) earthslip (+plural) +5032) multiplicate (Collins) +5033) multipartite +5034) metazoan (+plural) +5035) sexpartite +5036) partite +5037) slaveholder (+plural) +5038) slaveholding (+plural) +5039) genuflector (+plural) +5040) stomper (+plural) +5041) stompy (+ier +iest) +5042) synth (+plural - Oxford: informal) +5043) synthy +5044) goth (added lower case) +5045) emo (+plural) +5046) emocore (another way of the previous word) +5047) deflexed +5048) inflexed +5049) hypoallergenic (fixed: hypo-allergenic) +5050) cosmeceutical (+plural) +5051) glycolic +5052) glycollic +5053) retinol +5054) Strawson (+'s - name) +5055) squillion (+plural - Oxford: informal) +5056) squillionaire (+plural - Oxford: informal) +5057) squinancywort +5058) greenweed +5059) candytuft (+plural) +5060) coralberry (+plural) +5061) narcissuses (plural of narcissus) +5062) narcissi (another plural of narcissus) +5063) narcolepsy +5064) narcoleptics (added plural) +5065) hyperreal +5066) hyperrealism +5067) hyperrealist +5068) hyperrealistic +5069) hyperreality +5070) phantasmagorical +5071) stum (+plural +ing +ed) +5072) washtub (+plural) +5073) twin-tub (+plural) +5074) twirly (+ier +iest) +5075) gumshield (+plural) +5076) Flagler (+'s - name) +5077) flagitious (+ly +ness) +5078) suppositious (+ly +ness) +5079) confessant (+'s +plural) +5080) skilfish (+plural) +5081) skijoring +5082) skijorer (+plural) +5083) clingstone (+plural) +5084) clingfish (+plural) +5085) beachy (+ier +iest +ness) +5086) creamware +5087) objectivism +5088) objectivist (+plural) +5089) objectivistic +5090) Bayes (+'s - name) +5091) Jaynes (+'s - name) +5092) deerhound (+plural) +5093) saluki (+plural) +5094) Ibizan (Ibizan hound) +5095) Tartarus (+'s - name) +5096) Tartarean +5097) Ixion (+'s - name) +5098) Hera (+'s - name) +5099) Cronus (+'s - name) +5100) Kronos (+'s - name) +5101) Gaea (+'s - name - another way of Gaia) +5102) busway (+plural) +5103) Jakarta's (added the 's) +5104) premiere (+plural +ed +ing) +5105) Pusan (name) +5106) bedsock (+plural) +5107) copywriting +5108) signwriter (+plural) +5109) signwriting +5110) vinyls (added plural) +5111) housepainter (+plural - Collins) +5112) blowbacks (added plural) +5113) unendingness (merged into unending) +5114) trackway (+plural) +5115) souterrain (+plural) +5116) Epipalaeolithic +5117) epiphenomenal +5118) epinician +5119) unendowed +5120) unenergetic +5121) unengaged +5122) unenjoyable +5123) un-English +5124) unenlightenment +5125) ectoderm (+al) +5126) endoderm (+al) +5127) tetrapods (added plural) +5128) spastically +5129) spasticity +5130) overactive (fixed: over-active) +5131) overactivity (fixed: over-activity) +5132) Kayla (added 's - name) +5133) holier-than-thou +5134) Dalai (name: Dalai Lama) +5135) Hornblower's (added the 's - name) +5136) holystoning + holystoned (merged into holystone) +5137) hatemonger (+plural) +5138) POWs (added plural - Wiktionary) +5139) Euclid's (added 's - name) +5140) multiparity (Collins) +5141) multiparous +5142) aeroshell +5143) headliner (+plural - merged into headline) +5144) indie (+plural) +5145) metalhead (+plural - Oxford: informal) +5146) headbanger's (added the 's) +5147) popster (+'s +plural - Oxford: informal) +5148) frontman +5149) frontmen (plural of previous word) +5150) folkie (+'s +plural - Oxford: informal) +5151) melodicism +5152) Seeger (+'s - name) +5153) nonissue (Collins) +5154) Junoesque +5155) humoresque (+plural) +5156) Sinbad (+'s - another way of Sindbad) +5157) Dillingham (name) +5158) Gordonstoun (+'s - name) +5159) Junr (abbreviation in names) +5160) juneberry (+plural) +5161) liana (+plural) +5162) liane (+plural - another way of the previous word) +5163) antifeedant (+plural) +5164) bioassay (+plural) +5165) UCLA (+'s - University of California in Los Angeles) +5166) physico-chemical +5167) extropy +5168) extropian (+plural) +5169) transhumanism +5170) transhumanist +5171) Fukuyama (name) +5172) world-view (removed: it is two words in Oxford) +5173) balk (+plural +ed) +5174) Maddock (+'s - name) +5175) transhistorical +5176) alchemic (merged into alchemy) +5177) alchemize (+s +ed +ing - IZE) +5178) alchemise (+s +ed +ing - ISE) +5179) ultrafast (Collins) +5180) ultrafastidious (Collins) +5181) ultrafiltration +5182) ultradian +5183) ultracritical +5184) fermionic (Collins) +5185) ultracentrifuged (merged into ultracentrifuge) +5186) ultracentrifugal +5187) ultracentrifugation +5188) overthrust (+ing) +5189) fluorometer (+plural) +5190) fluorometric +5191) fluorometrically +5192) fluorometry +5193) misconstruction (+plural) +5194) construction's (fix: removed it - it had dictionary codes) +5195) intersubjective (+ly) +5196) intersubjectivity +5197) intertextuality +5198) intertextual +5199) intertextually +5200) dialogic +5201) dialogical +5202) sourcebook (+plural) +5203) Matilda's (added the 's - name) +5204) workshopping + workshopped (merged into workshop) +5205) Jonah's (added the 's - name) +5206) monologic +5207) monological +5208) monologize (+plural +ing +ed - IZE) +5209) monologise (+plural +ing +ed - ISE) +5210) worksite (+plural) +5211) tenace (+plural) +5212) breadstick (+plural) +5213) breadwinning +5214) SWOT (SWOT analysis) +5215) shapewear +5216) trigraph (+plural) +5217) adverbials (added plural) +5218) j (letter) +5219) w (letter) +5220) graphemes (added plural) +5221) graphemic (+plural) +5222) graphemically +5223) misperceiving +5224) misperception (+plural) +5225) enlace (+ed) +5226) autochromes (added plural) +5227) microaerophilic +5228) microaerophile (+plural) +5229) recombinants (added plural) +5230) unswollen (Collins) +5231) DNase +5232) RNase +5233) resuspend (+plural +ed +ing +ion) +5234) triturate (+plural +ed +ing +ion) +5235) triturator (+plural) +5236) triumphally (merged into triumphal) +5237) triumphalists (added plural) +5238) zander +5239) marshalship +5240) wing-tip (fixed: removed since in Oxford it is two words) +5241) wingsuit +5242) airboats (added plural) +5243) AdWords (Google AdWords) +5244) ECTS (European Credit Transfer Scheme) +5245) plug-compatible +5246) plugboard (+plural) +5247) autosuggestion (fixed: auto-suggestion) +5248) autotune +5249) JPG (upper case) +5250) jpg (lower case) +5251) autoxidized (merged into autoxidize - IZE) +5252) autoxidised (merged into autoxidise - ISE) +5253) Transylvanian +5254) transwoman +5255) transwomen (plural of previous word) +5256) appropriacy (+plural) +5257) Wiktionary +5258) auditorial +5259) Deems (+'s - name) +5260) deemster (+plural) +5261) houseroom +5262) abdominoplasty (+plural) +5263) mammaplasty (+plural - Collins) +5264) mammoplasty (+plural - Collins - another way of previous word) +5265) extracorporeal +5266) lithotripsy +5267) lithotripter (+plural) +5268) lithotriptor (+plural - another way of previous word) +5269) lithotriptic +5270) facelifts (added plural) +5271) injectables (added plural) +5272) Botox (+ed - trademark) +5273) antipruritic (+plural) +5274) nonsteroidal (Collins) +5275) nonaspirin (Collins) +5276) antitussive +5277) premedication +5278) premaxillary +5279) prematch +5280) premaster (+plural +ing +ed) +5281) prelusive +5282) prem (+plural) +5283) hypothermal +5284) hypothermic +5285) zoophobia +5286) bacteriophobia +5287) cyberphobic's (added the ´s) +5288) cyberphobes (added plural) +5290) computerphobia (Collins) +5291) realpolitik (fix: it was in upper case) +5292) Talleyrand (+'s - name) +5293) fuehrer (+plural +'s - another way for führer) +5294) faunal +5295) faunistic +5296) fraternalism (+'s) +5297) pledgee +5298) Kelk (name) +5299) aerosphere +5300) aesthetician (+plural +'s) +5301) badware +5302) von (now in lower case - fixed: Von) +5303) baculovirus (+plural) +5304) baculum +5305) bacula (plural of previous word) +5306) ctenoid +5307) aviculture +5308) avicultural +5309) aviculturalist (+plural) +5310) aviculturist (+plural) +5311) cubital +5312) cubitus +5313) kilobase (+plural) +5314) hydrogel (+plural) +5315) hydrofracturing +5316) hydrofluorocarbon (+plural) +5317) HFC (+plural - abbreviation of previous word) +5318) irrigator (+plural) +5319) megalitres (added plural) +5320) tympanic +5321) petrosal (+plural) +5322) semilunar +5323) semi-literate +5324) semi-literacy +5325) Malayalam +5326) MiB (Wikipedia) +5327) KiB (Wikipedia) +5328) GiB (Wikipedia) +5329) TiB (Wikipedia) +5330) PiB (Wikipedia) +5331) EiB (Wikipedia) +5332) ZiB (Wikipedia) +5333) YiB (Wikipedia) +5334) unsharp + unsharpness +5335) draughtproof (+ing) +5336) testiculate +5337) eel-like +5338) eely +5339) underprepared +5340) underpopulation +5341) midtowns + midtown's (removed: American) +5342) teriyaki +5343) butternut (+plural) +5344) movie (+plural - removed: chiefly American) +5345) groovily + grooviness (merged into groovy) +5346) dharma +5347) cherubically +5348) fifty-fifty +5349) figgy (+ier +iest) +5350) fightbacks (added plural) +5351) Tynecastle (+'s - name) +5352) fighter-bomber (+plural) +5353) frontlet (+plural) +5354) depigment (+ed) +5355) depigmentation +5356) vitiligo +5357) leucoderma +5358) catenative (+plural) +5359) non-finite +5360) prepose (+s +ing +ed) +5361) backshift +5362) unsurveyed +5363) subpopulation (Collins) +5364) unsusceptible +5365) unsusceptibility +5366) Westbury (+'s - name) +5367) theming (merged into theme) +5368) urbanist (+plural) +5369) inliers (added plural) +5370) Cimmerian (+plural +'s) +5371) orogeny (+plural) +5372) orogenesis +5373) orogenic +5374) orogen (+plural) +5375) ultrastructure (Collins) +5376) ultrastructural (Collins) +5377) Proterozoic +5378) Precambrian +5379) Archaean +5380) Priscoan +5381) prismatically +5382) starburst (+plural) +5383) blocky (+ier +iest) +5384) aragonitic (Collins) +5385) unsprayed +5386) unstabler + unstablest + unstableness (merged into unstable) +5387) microarchitecture (+plural - Wiktionary) +5388) Celeron (Intel) +5389) i3 (Intel) +5390) i5 (Intel) +5391) i7 (Intel) +5392) LGA (Intel) +5393) Broadwell (+'s - name) +5394) Haswell (+'s - name) +5395) Krzanich (+'s - name) +5396) Skylake (+'s - name) +5397) transcriptome (+plural) +5398) cybrid (Collins) +5399) shoaled + shoaling (merged into shoal) +5400) boneyard (Oxford: informal) +5401) nuthouse (Oxford: informal) +5402) hypochondriacal +5403) pedicular (Collins) +5404) immunocompromised +5405) humoral +5406) bloodlust (fixed: blood-lust) +5407) upthrust (+s +ing +ed) +5408) bloodletting (fixed: blood-letting) +5409) Elaine's (added the 's - name) +5410) alphafetoprotein +5411) unconjugated (Collins) +5412) immunohistochemistry (Collins) +5413) orthotic (+plural) +5414) orthotist (+plural) +5415) POP3 +5416) POP +5417) RFC +5418) brainwork +5419) brainily (merged into brainy) +5420) caseloads (added plural) +5421) gromwell (+plural) +5422) odiferous (another way of odoriferous) +5423) Anubis (+'s - name) +5424) cupholders (added plural) +5425) telecourse (+plural - Collins) +5426) baserunner (+plural - Collins) +5427) angiographer (+plural) +5428) angiographic +5429) angiographically +5430) angioneurotic +5431) angiotensin +5432) hydrocortisone +5433) glucocorticoid (+plural) +5434) agonists (added plural) +5435) univalents (added plural) +5436) nonhomologous (Collins) +5437) Hansard (+plural +'s) +5438) denotative +5439) reverberantly +5440) reverberative +5441) reverberator +5442) reverberatory +5443) filmic +5444) film-going +5445) fade-up +5446) fade-out (+plural) +5447) fade-in (+plural) +5448) docusoap (+plural) +5449) film-maker's (added the 's) +5450) featurette (+plural) +5451) chromakeys + chromakeying + chromakeyed (merged into chromakey) +5452) beleaguerment +5453) transport's (added the 's) +5454) adversarially (merged into adversarial) +5455) adverbials (added plural) +5456) commissarial +5457) fantasist +5458) incubi (plural of incubus) +5459) linguistician (+plural) +5460) metamathematics +5461) metamathematician (+plural) +5462) Las (Las Vegas) +5463) dimmable +5464) dimmish +4565) concious (fix: removed, it doesn't exist) +4566) conciousness (fix: removed, it doesn't exist) +4567) subdiscipline (+plural - Collins) +4568) subfield (+plural - Collins) +4569) subduct (+plural +ing +ed) +4570) subeditorial (fixed: sub-editorial) +4571) subeditor (+plural +'s - fixed: sub-editor) +4572) subeditorship (Collins) +4573) netsplit (+plural +ing +ed - IRC - Wiktionary) +4574) biennale (+plural) +4575) documentalist's (added the 's) +4576) ornamentalism +4577) ornamentalist (+plural) +4578) dextrous (+ly +ness - another way of dexterous) +4579) dextral +4580) dextrality +4581) dextrally +4582) apertural +4583) regionalize (+ed +ion -IZE) +4584) regionalise (+ed +ion -ISE) +4585) methodic +4586) lodgepole (lodgepole pine) +4587) patrology +4588) patronal +4589) farouche +4590) barouche (+plural) +4591) Romanic +4592) Vulcanian +4593) Cappadocia +4594) Cappadocian (+plural) +4595) cappellacci +4596) Diego's (added the 's - name) +4597) breadhead (+plural - Oxford: informal) +4598) jackfruit +4599) centuples (added plural) +4600) centrosome (+plural) + + +V2.22 - 1-MAR-2015 +------------------ +4601) reupload (+s +ing +ed - Wiktionary) +4602) Purim +4603) purificatory +4604) Hecate (+'s - name) +4605) Selene (+'s - name) +4606) Endymion (+'s - name) +4607) enduro (+plural) +4608) karts (added plural) +4609) karting (merged into kart) +4610) autotest (+plural - Collins) +4611) heathlands (added plural) +4612) euphrasia +4613) sabadilla +4614) smartwatch (+plural) +4615) Engelmann (+'s - name) +4616) blackbutt (+plural) +4617) cordwood +4618) signage +4619) overleveraged +4620) DVR (+plural) +4621) newsfeeds (added plural) +4622) aggregator (+plural) +4623) cladogram (+plural) +4624) cladogenesis +4625) cladogenetic +4626) co-evolution +4627) co-evolutionary +4628) co-evolve (+s +ing +ed) +4629) countertransference +4630) buttercream +4631) candyfloss +4632) eco-warrior (+plural) +4633) phenology +4634) phenological +4635) triglycerides (added plural) +4636) squalene +4637) glycerides (added plural) +4638) hydrocephalic +4639) hydrocephaly +4640) sonography + sonograph + sonographic +4641) Matangi (+'s - name) +4642) synchromesh +4643) diachroneity +4644) diachronically +4645) diachronistic +4646) diachrony +4647) ammonite (added singular) +4648) inserters (added plural) +4649) insertable +4650) turnable (Collins) +4651) mujahideen + mujahedin + mujahidin +4652) semivowel (fixed: semi-vowel) +4653) unmatch (+s +ing +ed - Wiktionary) +4654) unmatchably +4655) uncatchable +4656) Osiris (+'s - name) +4657) Osirian +4658) Horus (+'s - name) +4659) hosannah (another way of hosanna) +4660) taskforce +4661) pisciculture +4662) piscicultural +4663) pisciculturist +4664) Piscean (+plural) +4665) Andromedae +4666) Andromache (+'s - name) +4667) Neoptolemus (+'s - name) +4668) Priam (+'s - name) +4669) Hecuba (+'s - name) +4670) Troilus (+'s - name) +4671) Cressida (+'s - name) +4672) Calchas (+'s - name) +4673) frontwoman +4674) frontwomen (plural of previous word) +4675) kick-turn (+plural) +4676) lipslide (+plural) +4677) fakie (+plural) +4678) unproblematical +4679) unproblematically +4680) progressivist (+plural) +4681) degressive +4682) concessive +4683) bifunctional +4684) functionalistic (Collins) +4685) non-formal +4686) non-fluent +4687) transformative +4688) transformationally +4689) transfixion +4690) transferware +4691) underlease +4692) underinvest (+s +ing +ed) +4693) monogrammatic +4694) sonogram (+plural) +4695) to-dos (added plural - Collins) +4696) tiramisu +4697) cock-a-doodle-doo +4698) cockaded (merged into cockade) +4699) unswayed +4700) home-loving +4701) BFI (abbreviation: British Film Institute) +4702) adland +4703) Adlerian (+plural) +4704) Freudians (added plural) +4705) Freudianism +4706) placeman (added singular) +4707) unobstructive (Collins) +4708) unobserving (Collins) +4709) inconsequentiality (+plural) +4710) inconsequentialness +4711) soundbox +4712) charango (+plural) +4713) roadless (merged into road) +4714) clearways (added plural) +4715) KDE's (added the 's) +4716) extended-play +4717) EP +4718) shaly (+ier +iest) +4719) shaley (another way of previous word) +4720) outsail (+s +ing +ed) +4721) wiretap (+s +ing +ed) +4722) wiretapper (+plural) +4723) bivalence +4724) quo (status quo) +4725) ROI (abbreviation: Return On Investment) +4726) skyrocket (+s +ing +ed - fixed: sky-rocket) +4727) skysail (+plural) +4728) Brooklyn (+'s - name of city) +4729) snowscape (+plural) +4730) roadmap (removed: Oxford says it is two words) +4731) Citrix (+'s - name of company - Wikipedia) +4732) SEO +4733) relatable +4734) relatability +4735) eco-tax (+plural) +4736) ecotone (+plural) +4737) ecotonal +4738) antiepileptic (Collins) +4739) antianxiety (Collins) +4740) unmedicated (Collins) +4741) non-relative +4742) non-selective +4743) non-combative +4744) e-learning +4745) Aquitaine (+'s - name) +4746) hawklike +4747) waterlog (+s +ing +ed) +4748) Carolingians (added plural) +4749) genotoxic (Collins) +4750) carbon-neutral +4751) biocoenosis +4752) biocoenoses (plural of previous word) +4753) elevational +4754) facies +4755) antialiasing +4756) antifungal (Collins) +4757) antiballistic +4758) antibubble +4759) pharma (+plural) +4760) anovulant (+plural) +4761) calmative (+plural) +4762) tricyclic (+plural) +4763) bioavailability +4764) bioavailable +4765) monocyclic +4766) membered +4767) memberless +4768) leptin +4769) parvovirus (+plural) +4770) leptospirosis +4771) postulatory +4772) posturers (added plural) +4773) kleptocrat (+plural) +4774) kleptocracy (+plural) +4775) kleptocratic +4776) kleptoparasite (+plural) +4776) kleptoparasitic +4777) kleptoparasitism +4778) libitum (ad libitum) +4779) unsized +4780) unrevised +4781) unrevoked +4782) unreversed +4783) unrestored +4784) bling + blingy + blingier + blingiest +4785) bling-bling (another way of previous word) +4786) burkas (added plural) +4787) burkha (+plural - another way of previous word) +4788) burqa (+plural - another way of previous word) +4789) chadors (added plural) +4790) headscarves (added plural) +4791) crowdfund (+plural) +4792) deleverage (+s +ed +ing - Wiktionary) +4793) delexical +4794) earbud (+plural) +4795) earbash (+ing - Oxford: informal) +4796) emoji (+plural) +4797) geocache (+s +ing +ed +er) +4798) googles + googling (merged into google) +4799) googleable +4800) googlable (another way of previous word) +4801) weblog (+plural + er) +4802) underwire (+s +ed) +4803) pat-down +4804) Islamophobia +4805) Islamophobe +4806) Islamophobic +4807) Islamists (added plural) +4808) Wikileaks (+'s - Wikipedia) +4809) Oxfordian (+plural) +4810) unfermented +4811) unrented (Collins) +4812) unparented (Collins) +4813) untormented (Collins) +4814) unaugmented (Collins) +4815) teleplay (+plural) +4816) telepresence +4817) televiewers (added plural) +4818) monocrystalline +4819) sugarbird (+plural) +4820) flockmaster +4821) teleports + teleported (merged into teleport) +4822) gyroscopically +4823) ISS (Collins - abbreviation: International Space Station) +4824) spacewalking + spacewalked (merged into spacewalk) +4825) spacefarer (+plural) +4826) film-making +4827) archaebacterium +4828) archaebacteria (plural of previous word) +4829) eubacterium +4830) eubacteria (plural of previous word) +4831) biliously (merged into bilious) +4832) trilinear +4833) affectless +4834) affectlessness +4835) immunosuppression +4836) immunosuppressant (+plural) +4837) immunosuppressed +4838) immunosorbent +4839) quantitation (+plural) +4840) quantitate (+ed) +4841) monochord (+plural) +4842) pentachord +4843) subdominant +4844) ISPs (added plural) +4845) subduable +4846) subduer +4847) Belford (+'s - name of place) +4848) seamount (+plural) +4849) seamfree +4850) seamers (added plural) +4851) puckery +4852) pintuck (+plural) +4853) hangup (+plural - removed since Oxford says it is two words) +4854) hyperlinking (merged into hyperlink) +4855) Hitlers (added plural) +4856) Hitlerian +4857) Hitlerism +4858) Hitlerite (+plural) +4859) Megachiroptera +4860) megachiropteran (+plural) +4861) multiyear (Collins) +4862) bancassurance +4863) bankassurance (another way of previous word) +4864) bancassurer (+plural) +4865) Allianz (+'s - name) +4866) Kieran (name) +4867) banausic +4868) haricot (+plural) +4869) contrarian (+plural) +4870) contrarianism +4871) quinquagenarian +4872) majoritarian (+plural) +4873) majoritarianism +4874) Gibraltarian (+plural) +4875) Raith's (added the 's - name) +4876) bioprivacy (Collins) +4877) Obamacare +4878) apices (another plural of apex) +4879) apetalous +4880) stipule (+plural) +4881) stipular +4882) unsubmerged (Collins) +4883) Brookes (+'s - name) +4884) Bodleian (Bodleian Library) +4885) Ashmolean (Ashmolean Museum) +4886) Sheldonian (Sheldonian Theatre) +4887) sculpturesque +4888) freewheels (added plural) +4889) freewheeler +4890) passible +4891) passibility +4892) Athanasius (+'s - name) +4893) discarnate +4894) Eileen's (added the 's - name) +4895) Platonism +4896) Platonist (+plural) +4897) logicism +4898) intuitionists (added plural) +4899) intuitionism +4900) intuitionalism (another way of previous word) +4901) compresence +4902) compresent +4903) immoralism +4904) immoralist +4905) Thrasymachus (+'s - name - Wikipedia) +4906) absurdism +4907) Chaplin's (added the 's - name) +4908) absurdist (+plural) +4909) Cartesians (added plural) +4910) Descartes's (added the 's - name) +4911) Cartesianism +4912) defeasibility +4913) defeasibly +4914) counterclaiming (merged into counterclaim) +4915) multithread +4916) Timberlake (name) +4917) offstage (fixed: off-stage) +4918) onstage (fixed: on-stage) +4919) lovelock (+plural) +4920) lovelily +4921) jubbly +4922) vestiture (+plural) +4923) excommunicator (+plural) +4924) excommunicatory +4925) ex-con (+plural - Oxford: informal) +4926) bilboes +4927) pathognomonic +4928) Holmes's (added the 's - name) +4929) shrink-wrap (+s +ing +ed) +4930) break-bulk +4931) multitaskers (added plural) +4932) multitasks (merged into multitask) +4933) multitouch +4934) multituberculate (+plural) +4935) monotreme (+plural) +4936) condylarth (+plural) +4937) condyloma (+plural) +4938) condylomata (another plural of previous word) +4939) condylomatous +4940) CVA (abbreviation: cerebrovascular accident) +4941) STDs (added plural) +4942) reverb (+plural) +4943) handclap (+plural +ing) +4944) popish (+ly) +4945) trad (Oxford: informal) +4946) theremin (+plural) +4947) cinnarizine (Collins) +4948) cyclizine (Collins) +4949) promethazine +4950) amoxycillin +4951) amoxicillin (another way of previous word) +4952) ampicillin +4953) erythromycin +4954) dishwashing +4955) dishy (+ier +iest) +4956) telegenic +4957) telefilm (+plural) +4958) Gucci's (added the 's - name) +4959) clinginess (merged into clingy) +4960) annoyingness +4961) balibuntal +4962) trampette (Collins) +4963) solanaceous +4964) bioacoustics +4965) James's (added the 's - name) +4966) bioaccumulate (+s +ing +ed +ion) +4967) Lucas's (added the 's - name) +4968) sapiens (Homo sapiens) +4969) assibilate (+ed +ion) +4970) rhotic +4971) rhoticity +4972) postvocalic +4973) tics (added plural) +4974) pic (+plural - Oxford: informal) +4975) digicam (+plural) +4976) digipak +4977) untruly (Kevin Atkinson wordlist 60) +4978) unremarked (Kevin Atkinson wordlist 60) +4979) unshaped (Kevin Atkinson wordlist 60) +4980) unposed +4981) mustardy +4982) chorography +4983) chorographer (+plural) +4984) chorographic +4985) geostrategic +4986) geostrategy +4987) Africanism +4988) Africanist +4989) Africanize (+s +ed +ing +ion -IZE) +4990) Africanise (+s +ed +ing +ion -ISE) +4991) bezoar (+plural) +4992) lungworm (+plural) +4993) furunculosis +4994) interdigital +4995) OCRs + OCRing + OCRed (merged into OCR - Wiktionary) +4996) versicle (+plural) +4997) responsory (+plural) +4998) graduals (added plural) +4999) gradiometer +5000) altazimuth +5001) gradualistic +5002) dragline (+plural) +5003) bucketwheel (+plural) +5004) dozers (added plural) +5005) deckhouse (+plural) +5006) shotted +5007) lionfish (+plural - Collins) +5008) triggerfish (+plural) +5009) amidship (added singular) +5010) baggywrinkle +5011) overemployment (Collins) +5012) foozle (+s +ing +ed - Oxford: informal) +5013) forewing (+plural) +5014) beeswing +5015) haltere (+plural) +5016) imaginal +5017) instar (+plural) +5018) hindwings (added plural) +5019) alisphenoid (+plural) +5020) glenoid +5021) fossa +5022) glenohumeral +5023) hyperextend (+s +ing +ed +ion) +5024) dystonia +5025) dystonic +5026) embolization (-IZE) +5027) embolisation (-ISE) +5028) thrombolysis +5029) thrombolytic +5030) ischaemia +5031) ischaemic +5032) autolysis +5033) autolytic +5034) lysosome (+plural) +5035) lysosomal +5036) angulate (+s +ing +ed) +5037) angulation (+plural) +5038) cerebriform (Collins) +5039) Pott (+'s - name) +5040) calcalkaline +5041) laurustinus +5042) desex (+s +ing +ed) +5043) deservingness +5044) lolcat (+plural) +5045) mash-ups (added plural) +5046) Chekhov's (added 's - name) +5047) masjid (+plural) +5048) gurdwara (+plural) +5049) microloan (+plural - Collins) +5050) muggle (+plural - Oxford: informal) +5051) multiverse (+plural) +5052) meme (+plural) +5053) memetic +5054) declass (+ed) +5055) cosplay (+s +ing +ed +er +ers) +5056) COSPAR (abbreviation: Committee on Space Research) +5057) meh (Oxford: informal) +5058) orc (+plural) +5059) orcish +5060) hobbit (added plural +'s) +5061) Gandalf (+'s - name - Wikipedia) +5062) Frodo (+'s - name - Wikipedia) +5063) Tolkien (+'s - name) +5064) Tolkienesque +5065) overshare (+s +ing +ed +er +ers) +5066) grassquit (+plural) +5067) bananaquit (+plural) +5068) soulmate (+plural) +5069) Rastafarian (+plural) +5070) Rastafarianism +5071) Anthropocene +5072) wish-list (removed - Oxford says it is two words) +5073) webisode (+plural) +5074) vuvuzela (+plural) +5075) unfriends (merged into unfriend) +5076) usernames (added plural) +5077) handhelds (added plural) +5078) lammergeier +5079) lammergeyer (another way of previous word) +5080) Fraktur +5081) thunderbird (+plural +'s - lower case - mythical bird) +5082) thickheads (added plural) +5083) Asgard (+'s - name) +5084) Camelopardalis (name of place) +5085) Centaurus (name of place) +5086) aquarobics +5087) divemaster (+plural) +5088) freestyling + freestyled + freestyler + freestylers (merged into freestyle) +5089) biscotti +5090) codebase (+plural - Wiktionary) +5091) postmortem (fixed: post-mortem) +5092) codeless (Collins) +5093) undebated (Collins) +5094) firebase +5095) winery (added singular) +5096) wineskins (added plural) +5097) unshrunk +5098) Winesap (+plural) +5099) nock (+s +ing +ed) +5100) keyserver (+plural - Wiktionary) +5101) QA (abbreviation: Quality assurance) +5102) passphrase (+plural - Wiktionary) +5103) GnuPG's (added the 's) +5104) PostScript (trademark) +5105) Fri (abbreviation: Friday) +5106) Jun (abbreviation: June) +5107) Jul (abbreviation: July) +5108) Sep (abbreviation: September) + + +V2.23 - 1-APR-2015 +------------------ +5109) Aintree (name) +5110) ainhum +5111) cholelithiasis +5112) cholecystitis +5113) pancreatitis +5114) cardiomyopathy +5115) pericardial +5116) mammal-like +5117) mammalogy (+ist +ists) +5118) Merriam's (added the 's - name) +5119) supinate (+s +ing +ed +ion) +5120) pronate (+s +ing +ed +ion) +5121) pronator (+plural) +5122) metacentres (added plural) +5123) acrocentric (Collins) +5124) submetacentric (Collins) +5125) Malory (+'s - name) +5126) malperformance +5127) loti (currency) +5128) maloti (plural of previous word) +5129) Lothario (+plural) +5130) butterbur (+'s - Collins) +5131) institute's (added the 's) +5132) extremophile (+plural) +5133) archaebacterial +5134) toxigenicity (Collins) +5135) botulinum (botulinum toxin) +5136) variola +5137) variolar +5138) variolous +5139) Mather (name) +5140) Smoot (+'s - name) +5141) RISC +5142) click-through (+plural) +5143) clientelism +5144) followee (+plural) +5145) aggressivity (Collins) +5146) ballistically +5147) hydroforming (Collins) +5148) SourceForge (+'s) +5149) logon (+plural) +5150) logouts (added plural) +5151) logoff (+plural) +5152) newfound +5153) Harington (name) +5154) sightlessness +5155) Arkansans (added plural - Kevin Atkinson wordlist 60) +5156) Axis (The Axis - alliance of Germany and Italy WWII - Kevin wordlist 60) +5157) Bayamón (name of city - Kevin Atkinson wordlist 60) +5158) Camelots (added plural - Kevin Atkinson wordlist 60) +5159) Carib (+plural) +5160) Devonians (added plural) +5161) cockboat +5162) backwinding + backwinded (merged into backwind) +5163) ripstop +5164) longstop +5165) half-centuries (added plural) +5166) Barclays (+'s - name - Wikipedia) +5167) peggy (+plural - slang) +5168) Peggy (+'s - name) +5169) Chekhovian (Kevin Atkinson wordlist 60) +5170) Comoran (Kevin Atkinson wordlist 60) +5171) Darwinist (+plural - Kevin Atkinson wordlist 60) +5172) Fräulein (Kevin Atkinson wordlist 60) +5173) Galaxy (The Galaxy - uppercase - Kevin Atkinson wordlist 60) +5174) Greenlandic (Kevin Atkinson wordlist 60) +5175) gorgon's (added the 's) +5176) multiheaded (Collins) +5177) Grozny (+'s - name - Kevin Atkinson wordlist 60) +5178) Ivorian (+plural - Kevin Atkinson wordlist 60) +5179) Nepalis (added plural - Kevin Atkinson wordlist 60) +5180) Gurkhali +5181) Gorkhali (another way of previous word) +5182) Vallejo's (added the 's - name) +5183) vallecula +5184) valleculae (plural of previous word) +5185) Nibelungenlied +5186) Nibelung (+plural) +5187) Nibelungen (another plural of previous word) +5188) Burgundians (added plural) +5189) Cassidy (+'s - name - Wikipedia) +5190) Longmire (+'s - name - Wikipedia) +5191) Eurocard (Wikipedia) +5192) lightwork (+er +ers - Wiktionary) +5193) Kenney (name - Wikipedia) +5194) Medina's (added the 's - name) +5195) exclusivism +5196) exclusivist (+plural) +5197) excogitate (+s +ing +ed +ion) +5198) antidisestablishmentarian (+plural) +5199) exceptionalism +5200) ecclesial +5201) interreligious (Collins) +5202) penates +5203) penannular +5204) zoomorphic +5205) zoomorphism +5206) biomorphs (added plural) +5207) biomorph's (added the 's) +5208) biomorphic +5209) Dawkins (+'s - name) +5210) Aristotelians (added plural) +5211) Sacrobosco (+'s - name - Wikipedia) +5212) Paracelsus (+'s - name) +5213) MKV + mkv +5214) AVI +5215) FLV +5216) MK3D + mk3d +5217) MKA + mka +5218) MKS +5219) streamable (Wiktionary) +5220) Matroska's (added the 's) +5221) MOV +5222) Vorbis (+'s - Wikipedia) +5223) ogg + Ogg +5224) oga +5225) WMA +5226) AAC +5227) ambisonic (+plural) +5228) DirectShow (+'s - Wikipedia) +5229) Netherhampton (name) +5230) Phillips's (added the 's - name) +5231) touch-sensitive +5232) microchannel (+plural - Wiktionary) +5233) photoresist (+plural) +5234) photolithography +5235) photolitho (another way of previous word) +5236) photolithographic +5237) photolithographically +5238) microminiature (Collins) +5239) oligonucleotide (+plural) +5240) polynucleotide (+plural) +5241) polynuclear +5242) Woburn (+'s - name) +5243) acrylamide +5244) toxicant (+plural) +5245) immunogenetic (+plural - Collins) +5246) immunogenetical (Collins) +5247) browntop +5248) androsterone +5249) oestradiol +5250) oestrogenic +5251) progestin (+plural) +5252) translocations (added plural) +5253) mistranslate +5254) quadrate (+plural) +5255) trabecula +5256) trabeculae (plural of previous word) +5257) trabecular +5258) trabeculate +5259) intergrowth (+plural) +5260) intergrow +5261) intergrew (past of previous word) +5262) intergrown (past participle of intergrow) +5263) limonite (+ic) +5264) pseudomorph (+plural +ic) +5265) pseudomorphism +5266) pseudomorphous +5267) Charron (name - Wikipedia) +5268) Theophrastus (+'s - name) +5269) Heraclitus (+'s - name) +5270) Parmenides (+'s - name) +5271) Bentham (name) +5272) Kircher (+'s - name - Wikipedia) +5273) Cetacea +5274) Odontoceti +5275) odontocete (+plural) +5276) Mysticeti +5277) mysticete (+plural) +5278) rorqual (+plural) +5279) Bryde (+'s - name - Wikipedia) +5280) Hywel (name - Wikipedia) +5281) Antin (+'s - name - Wikipedia) +5282) medusa (lowercase - +plural) +5283) medusae (lowercase - another plural of previous word) +5284) planula +5285) planulae (plural of previous word) +5286) apoptosis +5287) apoptotic +5288) radioiodine (Collins) +5289) gastrocolic +5290) apoprotein (+plural) +5291) waterborne (fixed: water-borne) +5292) firstborn (fixed: first-born + added 's) +5393) aposematic +5394) aposematism +5395) herbarium +5396) herbaria (plural of previous word) +5397) angiospermous +5398) gymnospermous +5399) monocot (+plural) +5400) dicot (+plural) +5401) dicrotic +5402) phosphodiesterase +5403) methotrexate +5404) HPV (abbreviation: Human papillomavirus) +5405) kindergartener (+plural - Kevin Atkinson wordlist 40) +5406) Fulghum (+'s - name - Wikipedia) +5407) Audra (+'s - name - Wikipedia) +5408) overparted +5409) Leonardo's (added the 's - name) +5410) overpaint (+s +ing +ed) +5411) Baconian (+plural) +5412) inductivism +5413) inductivist (+'s +plural) +5414) consequentialism +5415) consequentialist (+plural) +5416) utilitarians (added plural) +5417) Bosphorus (another way for Bosporus) +5418) deontology +5419) deontological +5420) deontologist (+plural) +5421) PHP (+'s) +5422) php (lower case) +5423) CGI +5424) Ibsen's (added the 's - name) +5425) Gerhart (+'s - name) +5426) Crébillon (name - Wikipedia) +5427) Henrik (+'s - name) +5428) Flaubert (+'s - name) +5429) flaunter +5430) flaunty +5431) Pouncey (+'s - name - Wikipedia) +5432) Byblos (+'s - name) +5433) phospholipase +5434) linolenic (linolenic acid) +5435) chitosan (Collins) +5436) oropharynx +5437) oropharynges + oropharynxes (plural ways of previous word) +5438) oropharyngeal +5439) fungiform +5440) vallate (Collins) +5441) adventitia +5442) adventitial +5443) Adventism +5444) Pentecostals (added plural + changed to upper case) +5445) Pentecostalism +5446) acceptation (+plural) +5447) Riegl (+'s - name - Wikipedia) +5448) Venkova (name - Wikipedia) +5449) admass +5450) Lifford (name) +5451) ambisexual (+ly) +5452) cufflink (+plural) +5453) Paula (+'s - name) +5454) monobrow (+ed - Oxford: informal) +5455) Hayek (+'s - name) +5456) Darger (+'s - name - Wikipedia) +5457) anomalistic +5458) ascidian (+plural) +5459) Cloney (+'s - name - Wikipedia) +5460) Walney (+'s - name - Wikipedia) +5461) razorfish (+plural) +5462) APC (abbreviation: Armoured Personnel Carrier) +5463) Bukrin (name) +5464) Otway (+'s - name) +5465) Amfreville (name) +5466) defenceman +5467) defencemen (plural of previous word) +5468) commodification +5469) Killarney (+'s - name) +5470) peloton (+plural) +5471) bittersweet (fixed: bitter-sweet) +5472) bittersweetness (fixed: bitter-sweetness) +5473) blueliner +5474) multisensory +5475) Bayern (name) +5476) Hašek (+'s - name - Wikipedia) +5477) multiplet (+plural) +5478) diborane +5479) boride (+plural) +5480) borane (+plural) +5481) intermetallic (Collins) +5482) nanostructures (added plural) +5483) nanostructured (merged into nanostructure - Wiktionary) +5484) silicide (+plural) +5485) hepatocyte (+plural) +5486) immunoglobulin (+plural) +5487) cellularity +5488) pleomorphism +5489) pleomorphic +5490) eosinophilic +5491) mucinous +5492) eosinophil (+plural) +5493) chargee +5494) chargeback (+plural) +5495) velodrome (+plural) +5496) McGlynn (+'s - name - Wikipedia) +5497) Daytona (+'s - name) +5498) McRae (+'s - name - Wikipedia) +5499) Nemechek (+'s - name - Wikipedia) +5500) dayside +5501) nightside +5502) astrobleme (+plural) +5503) Pentecost +5504) polyacrylamide +5505) ethidium (ethidium bromide) +5506) Timor (+'s - country) +5507) Timorese +5508) timocracy (+plural) +5509) bacchanalian (in lower case it has other meaning) +5510) archegonium +5511) archegonia (plural of previous word) +5512) Leopold's (added the 's - name) +5513) archducal +5514) archduchy (+plural) +5515) Stringfield (+'s - name - Wikipedia) +5516) Lumberton (+'s - name - Wikipedia) +5517) Revenna (name - Wikipedia) +5518) exopolitics (Wiktionary) +5519) Moulton (+'s - name - Wikipedia) +5520) Marden (+'s - name - Wikipedia) +5521) Westrum (+'s - name - Wikipedia) +5522) Isadora (+'s - name) +5523) adoptee (+plural) +5524) Zawadski (name) +5525) Gavron (+'s - name - Wikipedia) +5526) chromatid (+plural) +5527) anaphase +5528) telophase +5529) prophase +5530) tankage +5531) Gunnar's (added the 's - name) +5532) birdshot +5533) Garda +5534) Gardai (plural of previous word) +5535) Moyross (name - Wikipedia) +5536) unjaded (Collins) +5537) over-bright +5538) glowy (+ier +iest - Oxford: informal) +5539) gloxinia (+plural) +5540) achimenes +5541) cohosh +5542) folic (folic acid) +5543) pteroylglutamic (pteroylglutamic acid) +5544) pterosaur (added singular) +5545) chalicothere (+plural) +5546) glucagon +5547) fluctuant +5548) interpretability +5549) bacteriostat (+plural) +5550) bacteriostasis +5551) bacteriostatic +5552) bacteriostatically +5553) sterilant (+plural) +5554) Vincentian (+plural) +5555) Lazarist (+plural) +5556) Perryville (+'s - name - Wikipedia) +5557) isethionic (isethionic acid) +5558) isethionate +5559) isentropic +5560) Chalmers (+'s - name - Wikipedia) +5561) microelectronically (Collins) +5562) electropolar (Collins) +5563) Hershey's (added the 's - name) +5564) Simson (+'s - name - Wikipedia) +5565) Pathan (+plural) +5566) Chaldean (+plural) +5567) Anatolians (added plural) +5568) napoleon (+plural - allow lower case) +5569) neologist (+plural) +5570) neologize (+s +ing +ed - IZE) +5571) neologise (+s +ing +ed - ISE) +5572) sonics +5573) spaceport (+plural) +5574) Kourou (+'s - name) +5575) nullifidian +5576) uglily +5577) uglify (+s +ing +ed +ion +ly) +5578) streetscape (+plural) +5579) Trowbridge (+'s - name) +5580) Molesworth (+'s - name - Wikipedia) +5581) Nicholls (+'s - name - Wikipedia) +5582) Eindhoven (+'s - name) +5583) Bluefields (+'s - name) +5584) Belém (+'s - name of city) +5585) belemnite (+plural) +5586) Flandrian +5587) auriferous +5588) downwelling (+plural) +5589) upwellings (added plural) +5590) nearshore (+s +ing +ed) +5591) solitarily (merged into solitary) +5592) limitary +5593) limitative +5594) textualist (+plural) +5595) textualism +5596) Latham (+'s - name - Wikipedia) +5597) Humphreys (+'s - name - Wikipedia) +5598) osmotically +5599) Eliza (+'s - name) +5600) Hoberman (+'s - name - Wikipedia) +5601) semipermeable +5602) hydrocolloid (+plural) +5603) subprocess (+plural - Wiktionary) +5604) Dwayne (name - Wikipedia) +5605) updatable +5606) Rappaport (+'s - name - Wikipedia) +5607) upcycling + upcycles (merged into upcycle) +5608) Sheldrick (+'s - name - Wikipedia) +5609) upcoast +5610) upcasts (added plural) +5611) upcase (+s +ed) +5612) downcase (+s +ed) +5613) Westerman (+'s - name - Wikipedia) +5614) Scart + SCART +5615) roll-outs (added plural) +5616) Oberth (+'s - name - Wikipedia) +5617) Emme (+'s - name - Wikipedia) +5618) ESR +5619) Jacklyn (name - Wikipedia) +5620) GCC (+'s) +5621) mudflap (+plural) +5622) misexplanation (+plural - Wiktionary) +5623) misexplain (+s +ing +ed - Wiktionary) +5624) Beatty (+'s - name) +5625) Delphine (+'s - name - Wikipedia) +5626) misqualify (+s +ing +ed - Wiktionary) +5627) cocreates + cocreating + cocreated (merged into cocreate - Wiktionary) +5628) cocreator (+plural - Wiktionary) +5629) cocreation (Wiktionary) +5630) subclauses (added plural) +5631) standard's (added the 's) +5632) vert (+plural) +5633) Tallis (+'s - name) +5634) Flodden (name) +5635) Moreton (+'s - name) +5636) Suffolks (added plural) +5637) Pius (+'s - name) +5638) Wulfsige (name - Wikipedia) +5639) Bardstown (+'s - name - Wikipedia) +5640) Asser (+'s - name - Wikipedia) +5641) Dermot (+'s - name - Wikipedia) +5642) gramophonic +5643) dropout (+plural) +5644) trimerous +5645) pentamerous +5646) tetramerous +5647) cotoneaster +5648) rowan (+plural - in lower case - rowan tree) +5649) broadleaf +5650) whitebeam (+plural) +5651) agapanthus +5652) pelargonium (+plural) +5653) goosegrass +5654) bedstraws (added plural) +5655) Bedu (another term for Bedouin) +5656) McHale (+'s - name - Wikipedia) +5657) Aegon (+'s - name - Wikipedia) +5658) pochard (+plural) +5659) Pocahontas (+'s - name) +5660) Aragon (+'s - name) +5661) Zara (+'s - name - Wikipedia) +5662) crappie (+plural) +5663) flappy (+ier +iest) +5664) giftware +5665) Pattaya (+'s - name) +5666) Chemnitz (+'s - name) +5667) Austerlitz (+'s - name) +5668) Meara (name) +5669) anemophilous +5670) anemophily +5671) hydrophilous +5672) hydrophily +5673) hydrophobicity +5674) intermembrane (Collins) +5675) Zenobia (+'s - name) +5676) cymbidium (+plural) +5677) boneset +5678) knitbone +5679) intarsia +5680) Hendrick (+'s - name - Wikipedia) +5681) panstick +5682) denitrify (+s +ing +ed +ion) +5683) bioreactor (+plural) +5684) wasabi +5685) cruciferous +5686) somniferous +5687) melliferous +5688) umbellifer (+plural) +5689) umbelliferous +5690) bottlescrews (added plural) +5691) forestay +5692) staysail (+plural) +5693) turnbuckle (+plural) +5694) Cowell (+'s - name - Wikipedia) +5695) turnround (another way of turnaround) +5696) Landon (+'s - name) +5697) yuan (allow lower case too - not name in lower case) +5698) Baudot (+'s - name - Wikipedia) +5699) Baudrillard (+'s - name) +5700) Saavedra (+'s - name - Wikipedia) + + +V2.24 - 1-MAY-2015 +------------------ +5701) Hopson (+'s - name - Wikipedia) +5702) Coolaney (name - Wikipedia) +5703) Barkley (name - Wikipedia) +5704) hydroid (+plural) +5705) polypoid +5706) theca +5707) thecae (plural of previous word) +5708) thecate +5709) dinoflagellate (+plural) +5710) jobseeker (+'s +plural) +5711) wreaker +5712) Frederica (+'s - name - Wikipedia) +5713) Krista (+'s - name - Wikipedia) +5714) agoraphobe (+plural) +5715) Heworth (name - Wikipedia) +5716) Crothers (+'s - name - Wikipedia) +5717) anorgasmic +5718) anorthosite +5719) uncirculated +5720) Dante's (added the 's - name) +5721) baht (currency of Thailand) +5722) gossamery +5723) Friel (+'s - name - Wikipedia) +5724) grume (+plural) +5725) Duchamp (+'s - name) +5726) balmoral (+plural) +5727) Balmoral (+'s - name) +5728) bluchers +5729) cachectic +5730) cachexia +5731) dyspnoea +5732) cyanosis +5733) cyanotic +5734) lymphadenopathy +5735) splenomegaly +5736) sarcoid (+plural) +5737) immunocompetent +5738) immunocompetence +5739) autoconfigure (+s +ing +ed +ion - Wiktionary) +5740) ultra-thin +5741) Brookhaven (+'s - name) +5742) Brooklands (+'s - name) +5743) Newlands (+'s - name) +5744) interfix (+plural +ing +ed - Wiktionary) +5745) Theodoric (+'s - name) +5746) Ostrogoth (+plural) +5747) Ostrogothic +5748) Goths (added plural) +5749) goths (added plural - lower case) +5750) Crimeans (added plural) +5751) Visigothic +5752) Justinian (+'s - name) +5753) Dalmatia (+'s - name) +5754) Dalmatian (+plural - fix: now in upper case) +5755) Doberman (removed: Chiefly American) +5756) Dobermann (+plural) +5757) Pomeranian (+plural) +5758) Akita (+plural) +5759) Raby (+'s - name - Wikipedia) +5760) Akkadian (+plural) +5761) Akkad (+'s - name) +5762) Dakotas (added plural) +5763) Siouan +5764) undefeatable +5765) Kimble (+'s - name - Wikipedia) +5766) inkjet (inkjet printer) +5767) draftsman +5768) draftsmen (plural of previous word) +5768) egosurfer (+plural - merged into egosurf - Wiktionary) +5769) themself +5770) Themistocles (+'s - name) +5771) Ki-moon (+'s - name) +5772) Bevan (+'s - name) +5773) bevatron (+plural) +5774) radiotherapeutic +5775) repopulation (merged into repopulate) +5776) Liguria (name of place) +5777) Ligurian (+plural) +5778) Surya +5779) appealable +5780) reviewable +5781) reviewal +5782) incompletion +5783) Montaigne's (added the 's - name) +5784) inexhaustibility +5785) Bessey (+'s - name - Wikipedia) +5786) incomputable +5787) agrimony (+plural) +5788) chokecherry +5789) nandina +5790) Afrocentric (Kevin Atkinson wordlist 60) +5791) Afrocentrism +5792) Afrocentrist (+plural) +5793) Barthes (+'s - name - Kevin Atkinson wordlist 60) +5794) bartend (+plural +ing +ed) +5795) parascend (+ing +er +ers) +5796) waterski (+s +ing +ed +er +ers) +5797) Windermere (+'s - name) +5798) ringbone +5799) ringbolt +5800) ringback +5801) ringbark (+s +ing +ed) +5802) ploughland +5803) Pembrokeshire's (added the 's - name) +5804) thorned + thornless (merged into thorn) +5805) thornlike +5806) thornproof +5807) Thorn (+'s - name) +5808) Glenhead (name - Wikipedia) +5809) Cockett (name - Wikipedia) +5810) overstorey (+plural) +5811) overstress (+s +ing +ed) +5812) overnutrition (Collins) +5813) commodify (+plural +ing +ed) +5814) ACW (abbreviation: aircraftwoman) +5815) passcode +5816) correctitude +5817) Overdale (name - Wikipedia) +5818) Pleasington (name - Wikipedia) +5819) Fulford (name - Wikipedia) +5820) Rosenallis (name - Wikipedia) +5821) Butterworth (+'s - name - Wikipedia) +5822) ca (abbreviation) +5823) CA (abbreviation) +5824) washland +5825) Heligoland (+'s - name) +5826) heliocentrically +5827) Copernicus's (added the 's - name) +5828) Shermer (+'s - name - Wikipedia) +5829) Nicolaus (+'s - name) +5830) geocentrism +5831) geobotany +5832) geobotanical +5833) geobotanist (+plural) +5834) phytosociology (Collins) +5835) arctic (also in lower case for other use) +5836) nipplewort +5837) lungwort +5838) lunisolar +5839) geodynamical (Collins) +5840) semimajor (semimajor axis) +5841) semimetals (added plural) +5842) metalloids (added plural) +5843) butanol +5844) thymol +5845) fusel (fusel oil) +5846) fuseway (+plural) +5847) fuscous +5848) McCann (+'s - name - Wikipedia) +5849) Eamon (+'s - name) +5850) ruckus +5851) Kattegat (name) +5852) katsura (+plural) +5853) crenulate (+ed) +5854) crenulation (+plural) +5855) papillated (Collins) +5856) denticulate (+ed) +5857) unretouched (Collins) +5858) ornithoid (Collins) +5859) Guardi (+'s - name) +5860) Kaczorowski (+'s - name - Wikipedia) +5861) Redgrave (+'s - name) +5862) IDs (added plural - Wiktionary) +5863) mins (added plural - Wiktionary) +5864) PMC (abbreviation - Collins) +5865) Schenk (+'s - name - Wikipedia) +5866) Afrikanerdom +5867) Broederbond (+'s) +5868) life-force (removed since Oxford says it is two words) +5869) autoreverse (Collins) +5870) autocrime (+plural - Collins) +5871) 3DES (cryptography - Wiktionary) +5872) IEC (International Electrotechnical Commission - Wiktionary) +5873) Framingham (+'s - name) +5874) Mahdia (+'s - name - Wikipedia) +5875) rulemaking +5876) Zoloft (medicament - Wikipedia) +5877) Paxil (medicament - Wikipedia) +5878) antiulcer (Collins) +5879) polyneuropathy +5880) Ecstasy (the drug - upper case - Kevin Atkinson wordlist 60) +5881) Victorianism (Kevin Atkinson wordlist 60) +5882) Forster's (added the 's - name) +5883) Ecuadorean (+plural - another way of Ecuadorian) +5884) ectotherm (+plural +ic) +5885) ectothermy +5886) endotherm (+plural) +5887) endothermy +5888) hominoid (+plural) +5889) frugivore (+plural) +5890) frugivorous +5891) nectarivorous +5892) Iban +5893) IBAN (+plural - abbreviation: International Bank Account Number) +5894) BIC (+plural - abbreviation: Bank Identifier Code - Wiktionary) +5895) outshoot +5896) outshot (past of previous word) +5897) subacute +5898) haematogenous +5899) extrasystole (+plural) +5900) counterirritant (+plural) +5901) counterirritation +5902) antilogy (+plural) +5903) antilog (added singular) +5904) anti-lock +5905) Lexus (+'s - name of car - Wikipedia) +5906) outdrink (+s +ing) +5907) outdrank (past of previous word) +5908) outdrunk (past participle of word before previous word) +5909) outdrive (+s +ing) +5910) outdrove (past of previous word) +5911) outdriven (past participle of word before previous word) +5912) Carrington (+'s - name) +5913) Beckmann (+'s - name) +5914) McClintock (+'s - name) +5915) McCullers (+'s - name) +5916) McEnroe (+'s - name) +5917) substring (+plural - Wiktionary) +5918) awk (+plural - Oxford: informal) +5919) Gloria's (added the 's - name) +5920) logistician (+plural - Wiktionary) +5921) pseudoword (+plural - Wiktionary) +5922) phonotactic (+plural) +5923) associability +5924) Cayley (+'s - name) +5925) associateships (added plural) +5926) vocables (added plural) +5927) trigram (+plural) +5928) bigram (+plural) +5929) phonogram (+plural) +5930) encipherment +5931) doornails (added plural) +5932) Ebbinghaus (+'s - name - Wikipedia) +5933) housebuilder (+plural) +5934) Halstead (+'s - name - Wikipedia) +5935) forcemeat +5936) power-hungry +5937) Douglas's (added the 's - name) +5938) Menelaus (+'s - name) +5939) Spyckerelle (name of friend) +5940) Filiep (name of friend) +5941) piecrust (piecrust table) +5942) Christie's (added the 's - name) +5943) buy-back (+plural) +5944) Charlie's (added the 's - name) +5945) shrimping (merged into shrimp) +5946) Padstow (name - Wikipedia) +5947) FY (abbreviation: British: Financial Year) +5948) FX +5949) FWIW (Oxford: informal: For What It's Worth) +5950) fuzzy-wuzzy (+plural - Oxford: informal and offensive) +5951) Heckmann (+'s - name - Wikipedia) +5952) bassline (+plural) +5953) mellophone +5954) Etherington (+'s - name - Wikipedia) +5955) lynchpin (+plural - another way of linchpin) +5956) Allcock (+'s - name - Wikipedia) +5957) preplan (+s +ing +ed - Collins) +5958) chamade (Collins) +5959) prepolymer (+plural) +5960) siloxane (+plural) +5961) silane (+plural) +5962) penetrant (+plural) +5963) berk (+plural - Kevin Atkinson wordlist 60) +5964) billhook (+plural - Kevin Atkinson wordlist 60) +5965) Rawiri (name - Wikipedia) +5966) billfish (+plural) +5967) mesopelagic +5968) benthos +5969) benthic +5970) satrapy (+plural) +5971) Persepolis (+'s - name) +5972) perseverate (+s +ing +ed +ion) +5973) Bitterman (+'s - name - Wikipedia) +5974) stressless (merged into stress) +5975) stressor (+plural) +5976) STRESS (computer programming language) +5977) underdress (+s +ing +ed) +5978) incandesce (+s +ing +ed) +5979) Soay (+'s - name) +5980) soaraway +5981) Ryanair (+'s - name - Wikipedia) +5982) soapily (merged into soapy) +5983) Rennie (+'s - name) +5984) countertrade +5985) countervalue +5986) counterweigh (+s +ing +ed) +5987) Zazzo (+'s - name - Wikipedia) +5988) Tynan (name - Wikipedia) +5989) Mephisto (+'s - name - Wikipedia) +5990) Mephistophelian +5991) Mephistophelean +5992) Cynewulf (+'s - name) +5993) Bentham (added the 's - name) +5994) retranslate (+s +ing +ed) +5995) retranslation (+plural) +5996) Teilhard (+'s - name) +5997) Loeb (+'s - name - Wikipedia) +5998) amu (abbreviation: Atomic mass unit) +5999) bigha (+plural) +6000) Warminster (+'s - name - Wikipedia) +6001) Durnford (+'s - name - Wikipedia) +6002) Darell (name - Wikipedia) +6003) Ancaster (+'s - name - Wikipedia) +6004) Waterval (name - Wikipedia) +6005) Balla (+'s - name - Wikipedia) +6006) Malton (+'s - name - Wikipedia) +6007) Croke (+'s - name - Wikipedia) +6008) Moorhead (+'s - name) +6009) Clemente (+'s - name) +6010) sophomoric +6011) Salford's (added the 's - name) +6012) skint (Oxford: informal) +6013) Hemphill (+'s - name - Wikipedia) +6014) skintight +6015) Cassie (+'s - name - Wikipedia) +6016) hued + hueless (merged into hue) +6017) kung + fu (kung fu) +6018) buckbean (+plural) +6019) bogbean (+plural - another way of previous word) +6020) cloudberry (+plural) +6021) Grahamstown (+'s - name - Wikipedia) +6022) airburst (+plural) +6023) flip-flopping + flip-flopped (merged into flip-flop) +6024) frack (+s +ing +ed +er +ers) +6025) hazmat (+plural) +6026) overthink (+s +ing) +6027) overthought (past participle of previous word) +6028) paraglider (+plural) +6029) paraglide (+s +ing +ed) +6030) paywall (+s +ed) +6031) photobomb (+s +ing +ed +er +ers) +6032) fave (+plural - Oxford: informal) +6033) plastique +6034) polyamory +6035) polyamorist +6036) polyamorous +6037) remortgage (+s +ing +ed) +6038) reorg (+plural - Oxford: informal) +6039) Vinson (+'s - name) +6040) satay +6041) scrunchier + scrunchiest + scrunchy +6042) scrunchie (+plural) +6043) slumdog (+plural - Wiktionary) +6044) spams (merged into spam) +6045) stoners (added plural) +6046) truthiness (Oxford: informal) +6047) Colbert's (added the 's - name) +6048) twerked (merged into twerk) +6049) widescreens (added plural) +6050) DMCA (abbreviation: Digital Millennium Copyright Act) +6051) DHSS (abbreviation: Department of Health and Social Security) +6052) Affero (GNU Affero General Public License) +6053) AGPL +6054) Stallman (+'s - name - Wikipedia) +6055) Stallmann (+'s - name - Wikipedia) +6056) relicense (+s +ing +ed) +6057) Hibbard (+'s - name - Wikipedia) +6058) Geraldton (+'s - name) +6059) demi-glace (another way of demi-glaze) +6060) Hippolyta (+'s - name - Wikipedia) +6061) Engberg (+'s - name - Wikipedia) +6062) Aldiss (+'s - name) +6063) Carnell (+'s - name - Wikipedia) +6064) Stubbs (+'s - name - Wikipedia) +6065) Buckland (+'s - name) +6066) globe-like +6067) globoid +6068) globose +6069) perinuclear +6070) microfilament (+plural) +6071) poliovirus (+plural) +6072) echovirus (+plural) +6073) Coxsackie (Coxsackie virus) +6074) Kaposi (+'s - name) +6075) cytomegalovirus +6076) anoxia +6077) anoxic +6078) toxoplasmosis +6079) Harrison's (added the 's - name) +6080) unsubjugated +6081) unsubdued +6082) unstylish +6083) unstuffed +6084) Coogan (+'s - name - Wikipedia) +6085) unstudiedly +6086) Armani (+'s - name) +6087) unstring (+s +ing) +6088) unpressed +6089) prestressed +6090) prestressing +6091) unpresuming +6092) Pollyanna (+plural) +6093) Pollyannaish +6094) Pollyannaism +6095) Mattson (+'s - name - Wikipedia) +6096) unpresentable +6097) Lyotard (+'s - name) +6098) unprescribed +6099) unpreparedness +6100) Harbor (name: Pearl Harbor) +6101) unpremeditatedly +6102) Ullmann (+'s - name - Wikipedia) +6103) UN's (added the 's - United Nations) +6104) unprintably +6105) Carson's (added the 's - name) +6106) Millie's (added the 's - name) +6107) Alexandra (+'s - name - Wikipedia) +6108) ataraxy +6109) ataraxia (another way of previous word) +6110) ataractic +6111) ataraxic +6112) chiromancy +6113) cartomancy +6114) archaeoastronomy +6115) antitumour +6116) archaea +6117) archaean (+plural - in lower case - biology related) +6118) predawn +6119) Marvin's (added the 's - name) +6120) Harrigan (+'s - name - Wikipedia) +6121) Goldie (+'s - name - Wikipedia) +6122) sporophyte (+plural) +6123) sporophytic +6124) sporangium +6125) sporangia (plural of previous word) +6126) sporangial +6127) avgas +6128) dustproof (Collins) +6129) Bingley (+'s - name - Wikipedia) +6130) Malmesbury (name - Wikipedia) +6131) rebirth (+s +ing +ed +er +ers) +6132) meshwork +6133) mesial (+ly) +6134) crus +6135) crura (plural of previous word) +6136) neoplasia +6137) cingulum +6138) cingula (plural of previous word) +6140) cingulate +6141) commissural +6142) acetabulum +6143) acetabula +6144) cheekpiece (+plural) +6145) Frederickson (+'s - name - Wikipedia) +6146) Gonubie (name - Wikipedia) +6147) lytic +6148) lytically +6149) Sudetenland (name) +6150) Baltistan (+'s - name) +6151) Karakoram +6152) karaka +6153) fescue (+plural) +6154) orchardist (+plural) +6155) rootstocks (added plural) +6156) poisonwood (Collins) +6157) rootsy (+ier +iest) +6158) rootworm (+plural) +6159) nerd's (added the 's) +6160) nerdiness +6161) nerdish +6162) nerdishness +6163) Mahoney (+'s - name - Wikipedia) +6164) Pasadena (+'s - name) +6165) technobabble (Oxford: informal) +6166) Pekar (+'s - name - Wikipedia) +6167) teratogen (+plural +ic) +6168) teratogenicity +6169) teratological +6170) teratologist (+plural) +6171) zeaxanthin +6172) chloroplastic (Collins) +6173) helotage +6174) helotism +6175) helotry +6176) Messenia (+'s - name - Wikipedia) +6177) unfree +6178) unfreedom +6179) Keane's (added the 's - name) +6180) condoners (added plural) +6181) undersow (+s +ing +ed) +6182) undersown (past participle of previous word) +6183) understaffing +6184) engrailed +6185) invected +6186) keyer (+plural) +6187) keyless +6188) Everman (+'s - name - Wikipedia) +6189) Bharati (+'s - name - Wikipedia) +6190) Durga (+'s - name) +6191) Waterberg (name - Wikipedia) +6192) Durey (+'s - name) +6194) Saint-Tropez (+'s - name) +6195) revalorization (Collins -IZE) +6196) revalorisation (Collins -ISE) +6197) Ainsley (+'s - name - Wikipedia) +6198) Matsuyama (name) +6199) matsuri +6200) scablands +6201) Mengele (+'s - name - Wikipedia) +6202) Neuburg (name - Wikipedia) +6203) clientship +6204) clanship +6205) mafia (+plural - lower case - generic Mafia) +6206) Lucian's (added the 's - name) +6207) contrabandist (+plural) +6208) contrabasses (added plural) +6209) autocatalysis +6210) autocatalyst (+plural) +6211) autocatalytic +6212) reprography +6213) reprographer (+plural) +6214) reprographic +6215) cosmography (+plural) +6216) cosmographer (+plural) +6217) cosmographic +6218) cosmographical +6219) Strieber (+'s - name - Wikipedia) +6220) Randle (+'s - name - Wikipedia) +6221) Symington (+'s - name - Wikipedia) +6222) Hellyer (+'s - name - Wikipedia) +6223) landrace (+plural) +6224) admix (+s +ing +ed) +6225) landrail +6226) landplane (+plural) +6227) Corsham (+'s - name - Wikipedia) +6228) lordship (+plural - also in lower case) +6229) signorial (Collins) +6230) signoria (Collins) +6231) Denbigh (name - Wikipedia) +6232) malar +6233) zygomatic (zygomatic bone) +6234) hyperpigmentation +6235) erythematosus (lupus erythematosus) +6236) dermatomyositis +6237) scleroderma +6238) polymyositis +6239) carnitine (Collins) +6240) polymyalgia +6241) rheumatica (polymyalgia rheumatica) +6242) arthralgia +6243) vasculitis +6244) vasculitides (plural of previous word) +6245) myalgia +6246) myalgic +6247) resplendency +6248) demurrable +6249) demurrer (+plural) +6250) potentiate (+plural) +6251) cannabinoid (+plural) +6252) tetrahydrocannabinol +6253) digoxin +6254) glycoside (+plural) +6255) elastin +6256) UTC (Collins - abbreviation: Universal Time Coordinated) +6257) CET (abbreviation: Central European Time) +6258) bimillenary (+plural) +6259) unimodal +6260) extravert (another way for extrovert) +6261) extraversion (another way for extroversion) +6262) underserved +6263) undersecretary (+plural) +6264) frontbencher (+plural) +6265) snubbers (added plural) +6266) clubber (+plural - Oxford: informal) +6267) clozapine +6268) myocarditis +6269) carphology +6270) Elvington (name - Wikipedia) +6271) Lakenheath (+'s - name - Wikipedia) +6272) drysuit (+plural) +6273) Balharry (+'s - name - Wikipedia) +6274) spinneys (added plural) +6275) Schoharie (name - Wikipedia) +6276) maquette (+plural) +6277) Schutte (+'s - name - Wikipedia) +6278) Puget (+'s - name - Wikipedia) +6279) Mapuche (+plural) +6280) Araucanian (+plural) +6281) Gaeltacht (name) +6282) Ramsden (+'s - name - Wikipedia) +6283) Xcode (+'s - Wikipedia) +6284) freeboots + freebooting + freebooted (merged into freeboot) +6285) Blackthorne (+'s - name - Wikipedia) + + +V2.25 - 1-JUN-2015 +------------------ +6286) lux +6287) lx (abbreviation of previous word) +6288) illuminance (+plural) +6289) fluoxetine +6290) luminaire (+plural) +6291) chromaticity +6292) nestlings (added plural) +6293) winkler (+plural) +6294) Breydon (+'s - name - Wikipedia) +6295) Netherfield (name - Wikipedia) +6296) Bintley (name - Wikipedia) +6297) Kircubbin (name - Wikipedia) +6298) trail's (added the 's) +6299) Rossendale (+'s - name - Wikipedia) +6300) Gillian (+'s - name - Wikipedia) +6301) sheepshead +6302) waymark (+s +ing +ed +er +ers) +6303) Hawkshead (name - Wikipedia) +6304) Sperrin (name - Wikipedia) +6305) Evette (+'s - name - Wikipedia) +6306) Donnie (+'s - name - Wikipedia) +6307) Maddy (+'s - name - Wikipedia) +6308) surtout +6309) Wilder (+'s - name - Wikipedia) +6310) Cassady (+'s - name - Wikipedia) +6311) Wootton (+'s - name - Wikipedia) +6312) Marisol (+'s - name - Wikipedia) +6313) Mencken (+'s - name - Wikipedia) +6314) Denpasar (+'s - name - Wikipedia) +6315) Tybee (+'s - name - Wikipedia) +6316) Kurtz (+'s - name - Wikipedia) +6317) Smithville (+'s - name - Wikipedia) +6318) Dothan (+'s - name - Wikipedia) +6319) Fogg (+'s - name - Wikipedia) +6320) Flintoff's (added the 's - name) +6321) batsmanship +6322) batrachian +6323) anuran (+plural) +6324) branchia +6325) branchiae (plural of previous word) +6326) branchial +6327) Janvier (+'s - name - Wikipedia) +6328) unjointed +6329) craniate (+plural) +6330) out-group (+plural) +6331) cephalochordate (+plural) +6332) urochordate (+plural) +6333) tunicate (+plural +ed) +6334) plumose +6335) glabrous +6336) labellum +6337) labella (plural of previous word) +6338) diapause (+ing) +6339) diapedesis +6340) Waller (+'s - name - Wikipedia) +6341) polymorphonuclear +6342) leucocyte (+plural +ic) +6343) immunoreactive (Collins) +6344) phagocytosis +6345) phagocytize (+s +ing +ed - IZE) +6346) phagocytize (+s +ing +ed - ISE) +6347) phagocytose (+ed) +6348) neutrophilic +6349) chronobiologist's (added the 's) +6350) outpaces (added plural) +6351) Arber (+'s - name - Wikipedia) +6352) Columba (name) +6353) Columbae +6354) outmuscle (+s +ing +ed) +6355) outbreed (+ing) +6356) outbred (past and past participle of previous word) +6357) carnivalesque +6358) weblogging (Collins) +6359) orgiastically +6360) orgulous +6361) orgasmically +6362) orgastic +6363) orgastically +6364) vaginismus +6365) vaginoplasty +6366) biohacking +6367) biohacker (+plural) +6368) Gerstein (+'s - name - Wikipedia) +6369) bioaccumulations (added plural) +6370) metabolizes + metabolizing + metabolized (merged into metabolize - IZE) +6371) metabolizable (IZE) +6372) metabolisable (ISE) +6373) metabolizer (+plural - IZE) +6374) metaboliser (+plural - ISE) +6375) evaginate +6376) evagination (+plural) +6377) evert (+s +ing +ed) +6378) eversible +6379) eversion +6380) adenohypophysis (Collins) +6381) adenohypophyses (Collins - plural of previous word) +6382) nuchal +6383) trapezius +6384) trapezii (plural of previous word) +6385) spinose +6386) spinous (another way of previous word) +6387) subnatural (Collins) +6388) subsale (Collins) +6389) subsocial (Collins) +6390) substyle (Collins) +6391) suprarational (Collins) +6392) seminatural (Collins) +6393) supernature (Collins) +6394) supravitally (Collins) +6395) Edentata +6396) Xenarthra (another way of previous word) +6397) xenarthran (+plural) +6398) polyphyletic +6399) paraphyletic +6400) edentate (+plural) +6401) sloths (added plural) +6402) sabretooth +6403) Pleistocene +6404) australopithecine (+plural) +6405) Pliocene +6406) unconformably +6407) Wiens (name - Wikipedia) +6408) Moine (name - Wikipedia) +6409) Permian +6410) Lindisfarne (+'s - name) +6411) ammoniacal +6412) semelparous (Collins) +6413) cupro-nickel +6414) cupule (+plural) +6415) uniaxial (+ly) +6416) encapsidate (+s +ing +ed +ion) +6417) isotopically +6418) isotopy +6419) triton (+plural +'s) +6420) Triton (+'s - name) +6421) overmedicate (Collins) +6422) overmedication (Collins) +6423) overprocess (Collins) +6424) overpromote (Collins) +6425) overcredulous (Collins) +6426) overedit (Collins) +6427) overtedious (Collins) +6428) Declan (+'s - name - Wikipedia) +6429) electroclash (Collins) +6430) Kandy (name - Wikipedia) +6431) Mandy (+'s - name - Wikipedia) +6432) Nandi (+'s - name - Wikipedia) +6433) bandy-bandy (+plural) +6434) Zack (+'s - name - Wikipedia) +6425) Phobos (name) +6426) Brixton (+'s - name - Wikipedia) +6427) Bettman (+'s - name - Wikipedia) +6428) Schlemiel (+s - name - Wikipedia) +6429) Ursa (Ursa Major) +6430) uroscopy +6431) Theophilus (+'s - name - Wikipedia) +6432) urostyle +6433) kinesis +6434) kineses (plural of previous word) +6435) kinesiology +6436) kinesiological +6437) kinesiologist (+plural) +6438) Samarra (+'s - name - Wikipedia) +6439) symplast (+ic) +6440) plasmodesma +6441) plasmodesmata (plural of previous word) +6442) adpressed +6443) sclerite (+plural) +6444) dolphinarium (+plural) +6445) dolphinaria (another plural of previous word) +6446) bottlenose (dolphin + whale) +6447) bottle-nosed (dolphin + whale) +6448) armamentarium +6449) armamentaria (plural of previous word) +6450) interneurons (plural of interneuron) +6451) interneurones (plural of interneurone - another way of previous word) +6452) Gurley (+'s - name - Wikipedia) +6453) homonymic +6454) homonymous +6455) homonymy +6456) polysemy +6457) polysemic +6458) polysemous +6459) anonym (+plural) +6460) Oguibe (+'s - name - Wikipedia) +6461) thunderbox (fixed: thunder-box) +6462) Max (+'s - name - Wikipedia) +6463) Turnbull (+'s - name - Wikipedia) +6464) thunderbug (+plural) +6465) Newbridge (name - Wikipedia) +6466) McNally (+'s - name - Wikipedia) +6467) McCaffrey (+'s - name - Wikipedia) +6468) Queally (+'s - name - Wikipedia) +6469) thunderousness +6470) Gilmartin (+'s - name - Wikipedia) +6471) thunderhead (+plural) +6472) thunderfly (+plural) +6473) aftersales +6474) hotlines (added plural) +6475) hotlink (+plural +ing - Wiktionary) +6476) hotlist +6477) apolune +6478) perilune +6479) manoeuvrer (+plural) +6480) Maugham (+'s - name - Wikipedia) +6481) chlorophyte (+plural) +6482) rhodophyte (+plural) +6483) monophyly (Collins) +6484) adnate +6485) connate +6486) calathea (+plural) +6487) beefwood +6488) stocktake (+r +ers) +6489) RAAF (abbreviation for: Royal Australian Air Force) +6490) Mochizuki (+'s - name - Wikipedia) +6491) Eratosthenes's (added the 's - name) +6492) compositeness (merged into composite) +6493) Andie (+'s - name - Wikipedia) +6494) Annabelle (+'s - name - Wikipedia) +6495) Resnick (+'s - name - Wikipedia) +6496) Muthesius (name - Wikipedia) +6497) workboat (+plural) +6498) refloat (+s +ing +ed) +6499) reflexologist (+plural) +6500) reflexible +6501) reflexibility +6502) Zeiss (+'s - name) +6503) Leica (+'s - name - Wikipedia) +6504) Pentax (+'s - name - Wikipedia) +6505) Benoni (+'s - name - Wikipedia) +6506) zeitgeber (+plural) +6507) zein +6508) Evans-Pritchard (+'s - name) +6509) evaporable +6510) hydroperoxide (Collins) +6511) anthracene +6512) pyrene +6513) alizarin +6514) Kossa (+'s - name - Wikipedia) +6515) Raes (name - Wikipedia) +6516) unimolecular +6517) Stern-Volmer (Stern-Volmer relationship: Wikipedia) +6518) unseduced (Collins) +6519) Giuliani (+'s - name - Wikipedia) +6520) unimposingly +6521) Ana (+'s - name - Wikipedia) +6522) biryani + biriyani + biriani (Indian dish) +6523) birthwort (+plural) +6524) birthweight +6525) haematocrit +6526) intraoperative +6527) spectate (+s +ing +ed) +6528) spectatorial +6529) spectatorship +6530) spectinomycin +6531) biogeneric (+plural) +6532) Coughlin (+'s - name - Wikipedia) +6533) equivalency +6534) Bahamians (added plural) +6535) Cameroonian (+plural) +6536) Mariel (+'s - name - Wikipedia) +6537) Savimbi (+'s - name - Wikipedia) +6538) McKenna (+'s - name - Wikipedia) +6539) Robichaud (+'s - name - Wikipedia) +6540) plugger (+plural) +6541) Chuckie (+'s - name - Wikipedia) +6542) Francophile (+plural) +6543) Lennox (+'s - name - Wikipedia) +6544) Sandhurst (+'s - name - Wikipedia) +6545) Anglophilia +6546) Breitinger (+'s - name - Wikipedia) +6547) flatbread +6548) flatbug +6549) Nuttall (+'s - name - Wikipedia) +6550) flyest +6551) flyness +6552) ferruginous +6553) Mery (+'s - name of friend) +6554) Eckard (+'s - name - Wikipedia) +6555) Berberich (+'s - name - Wikipedia) +6556) MS-DOS +6557) bootmaker (+plural) +6558) Brighouse (+'s - name - Wikipedia) +6559) Gupta (+'s - name - Wikipedia) +6560) Sharam (+'s - name - Wikipedia) +6561) bootlicker (+plural - Oxford: informal) +6562) Bloomberg (+'s - name - Wikipedia) +6563) Babs (+'s - name - Wikipedia) +6564) necklet (+plural) +6565) Lismore (+'s - name - Wikipedia) +6566) Netto (+'s - name - Wikipedia) +6567) surjection (+plural) +6568) surjective +6569) permutational +6570) Tattersall (+'s - name - Wikipedia) +6571) Petrov (+'s - name - Wikipedia) +6572) out-half +6573) Mullingar (+'s - name - Wikipedia) +6574) monophyletic +6575) endosymbiosis +6576) endosymbiont (+plural) +6577) endosymbiotic +6578) phototroph (+ic) +6579) anthozoan (+plural) +6580) anthophilous +6581) Anthozoa +6582) Cnidaria +6583) Ctenophora +6584) Placozoa +6585) Echiura +6586) echiuran (+plural) +6587) echiuroid (+plural) +6588) respirometer (+plural) +6589) polarographic +6590) potentiometry (+ic) +6591) Polaroid (+plural - Oxford: trademark) +6592) Jeana (name - Wikipedia) +6593) doublure +6594) Borobudur (+'s - name - Wikipedia) +6595) photogravure (+plural) +6596) Gornik (+'s - name - Wikipedia) +6597) calotype +6598) Lacock (name - Wikipedia) +6599) Ezekiel's (added the 's - name) +6600) Antiguan +6601) antihypertensive +6602) antidiabetic (Collins) +6603) hypotension +6604) multisystem (Collins) +6605) obtention +6606) hypostyle +6607) Ramses (+'s - name - Wikipedia) +6608) Karnak (+'s - name - Wikipedia) +6609) Serlio (+'s - name - Wikipedia) +6610) Iphigenia (+'s - name - Wikipedia) +6611) tetrastyle +6612) porticos (another plural of portico) +6613) hexastyle (+plural) +6614) octastyle +6615) Bernini (+'s - name - Wikipedia) +6616) octavalent +6617) octarchy (+plural) +6618) Gaurav (+'s - name - Wikipedia) +6619) Jamil (+'s - name - Wikipedia) +6620) Joel's (added the 's - name - Wikipedia) +6621) Arriaga (+'s - name - Wikipedia) +6622) Burney (+'s - name - Wikipedia) +6623) Lynette (+'s - name - Wikipedia) +6624) piquet +6625) wagonette + waggonette (+plural) +6626) Rivington (name - Wikipedia) +6627) Harwood (+'s - name - Wikipedia) +6628) Newbould (+'s - name - Wikipedia) +6629) wagonload (+plural) +6630) Lupe (+'s - name - Wikipedia) +6631) wagoner + waggoner (+'s +plural) +6632) Fairburn (+'s - name - Wikipedia) +6633) wagon-lit +6634) wagons-lits (plural of previous word) +6635) Arlette (name - Wikipedia) +6636) Paulette (+'s - name - Wikipedia) +6637) Claudette (+'s - name - Wikipedia) + + +V2.26 - 1-JUL-2015 +------------------ +6638) understeer (+s +ing +ed) +6639) oversteer (+s +ing +ed) +6640) WAP +6641) druggy +6642) Tomaselli (+'s - name - Wikipedia) +6643) Parello (+'s - name - Wikipedia) +6644) Dulwich (+'s - name - Wikipedia) +6645) drugget +6646) drug-related +6647) drug-free +6648) Liam (+'s - name - Wikipedia) +6649) Nadelmann (+'s - name - Wikipedia) +6650) Dewhurst (+'s - name - Wikipedia) +6651) Haider (+'s - name - Wikipedia) +6652) Ravenscroft (+'s - name - Wikipedia) +6653) Ede (+'s - name - Wikipedia) +6654) Aguila (+'s - name - Wikipedia) +6655) Bowker (+'s - name - Wikipedia) +6656) dribbly +6657) hyaline +6658) disodium (Collins) +6659) intranuclear (Collins) +6660) svn (lower case) +6661) SVN (upper case) +6662) tarball (+plural - Wiktionary) +6663) gzip (+s +ing +ed - Wiktionary) +6664) Walfield (name - Wikipedia) +6665) Gillmor (+'s - name - Wikipedia) +6666) Pescetti (+'s - name - Wikipedia) +6667) Galoppini (name - Wikipedia) +6668) Beaussier (name - Wikipedia) +6669) Valk (+'s - name - Wikipedia) +6670) CMS (abbreviation: Content Management System) +6671) Henschel (+'s - name - Wikipedia) +6672) Yutaka (+'s - name - Wikipedia) +6673) Philipp (+'s - name - Wikipedia) +6674) Kewisch (+'s - name - Wikipedia) +6675) stargate (+plural - Wiktionary) +6676) teleporter (+plural - Wiktionary) +6677) Redfern (+'s - name - Wikipedia) +6678) Hopkinsville (+'s - name - Wikipedia) +6679) CST (abbreviation: Central Standard Time) +6680) Lynne (+'s - name - Wikipedia) +6681) DipEd +6682) classily +6683) clastic +6684) fissility +6685) decompaction (+plural - Wiktionary) +6686) interlayers (added plural) +6687) sconces (added plural) +6688) scombroid (+plural) +6689) ciguatera +6690) parrotfish (+plural) +6691) parrotbill (+plural) +6692) vegetational +6693) acridine +6694) ammoniated +6695) valerian (+plural - in lower case if not a name) +6696) campanula (+plural) +6697) cannabinol +6698) photoproduct (+plural) +6699) photoprotein +6700) photorealist +6701) photorealistic +6702) anamorphosis +6703) anamorphoses (plural of previous word) +6704) eccentrical (Collins) +6705) gesso +6706) gessoes (plural of previous word) +6707) glass-like +6708) didymium +6709) Pyrex (trademark) +6710) Jena (+'s - name) +6711) cullet +6712) Flemings (added plural) +6713) Bretons (added plural) +6714) Celts (added plural) +6715) Galicians (added plural) +6716) Catalans (added plural) +6717) Asturians (added plural) +6718) Pyrenees +6719) Pyrenean +6720) carbamate (+plural) +6721) organophosphate (+plural) +6722) organochlorine (+plural) +6723) disruptors (added plural) +6724) arbitral +6725) riskless +6726) Shleifer (+'s - name - Wikipedia) +6727) risk-neutral +6728) chargehand (+plural) +6729) Kuster (+'s - name - Wikipedia) +6730) lampstand (Collins) +6731) Auriga (name in space) +6732) MacPherson (+'s - name - Wikipedia) +6733) moxibustion +6734) adaptogenic +6735) Yoda (+'s - name - Wikipedia) +6736) therapeutical +6737) therapeutist (+plural) +6738) glucosamine +6739) nicotinamide +6740) nicotinic (nicotinic acid) +6741) catabolite (+plural) +6742) catachresis +6743) catachreses (plural of previous word) +6744) catachrestic +6745) continuative (+plural) +6746) basilect (+plural +'s) +6747) acrolect's (added the 's) +6748) basilectal +6749) idiolects (added plural) +6750) eggcorns (added plural) +6751) Coren (+'s - name - Wikipedia) +6752) antepenult +6753) penult +6754) boustrophedon +6755) Gellibrand (+'s - name - Wikipedia) +6756) declinational +6757) declaw (+s +ing +ed) +6758) enzootic +6759) epizootic +6760) epizoic +6761) epizoite (+plural) +6762) nutcase (+plural - Oxford: informal) +6763) Lachman (+'s - name - Wikipedia) +6764) Lawrie (+'s - name - Wikipedia) +6765) dispiritingly +6766) Balanchine (+'s - name - Wikipedia) +6767) suffixal (Collins) +6768) suffixion (Collins) +6769) aspectual +6770) aspecting + aspected (merged into aspect) +6771) trine (+plural) +6772) Dorotheus (name - Wikipedia) +6773) midheaven +6774) Torrington (+'s - name - Wikipedia) +6775) beachside +6776) Suttons (name - Wikipedia) +6777) Redcliffe (+'s - name - Wikipedia) +6778) Klandasan (name - Wikipedia) +6779) meathead (+plural - Oxford: informal) +6780) Hitchman (+'s - name - Wikipedia) +6781) Clegg (+'s - name - Wikipedia) +6782) Rodwell (+'s - name - Wikipedia) +6783) Guiley (+'s - name - Wikipedia) +6784) NDE (+plural - Wiktionary - Abbreviation: near-death experience) +6785) dromos +6786) dromoi (plural of previous word) +6787) Bactrian (Bactrian camel) +6788) bacteroid (+plural) +6789) Bactria (name of place) +6790) semiformal +6791) semiweekly +6792) semirural (Collins) +6793) semierect (Collins) +6794) semilethal (Collins) +6795) semifeudal (Collins) +6796) semivocal (Collins) +6797) semideaf (Collins) +6798) semiraw (Collins) +6799) semioval (Collins) +6800) Ashtaroth (+'s - name - Wikipedia) +6801) totemism +6802) totemist (+plural) +6803) totemistic +6804) Gotham (+'s - name - Wikipedia) +6805) Lacan (+'s - name - Wikipedia) +6806) Lacanian (+plural) +6807) Lacanianism +6808) Havelock (+'s - name - Wikipedia) +6809) Bergenfield (+'s - name - Wikipedia) +6810) uprose +6811) uninterruptible +6812) uninterruptedness +6813) uninterestingness +6814) psychobabble +6815) untestable +6816) unrequested +6817) unintellectual +6818) MacDiarmid (+'s - name - Wikipedia) +6819) Kerala (+'s - name - Wikipedia) +6820) arrondissement (+plural) +6821) Chen's (added the 's - name) +6822) judiciary's (added the 's) +6823) arriviste (+plural) +6824) Thackeray (+'s - name - Wikipedia) +6825) arrivisme +6826) midfielders (added plural) +6827) Bullen (+'s - name - Wikipedia) +6828) yielder (+plural) +6829) Yiddishism +6830) Yiddishist (+plural) +6831) anaphylactic +6832) camwood +6833) Camus (+'s - name - Wikipedia) +6834) layshaft (+plural) +6835) driveshaft (+plural) +6836) swingarm (Collins) +6837) Hinkley (+'s - name - Wikipedia) +6838) GTA (Wiktionary) +6839) demerges + demerging (merged into demerge) +6840) demeritorious +6841) Piaget (+'s - name - Wikipedia) +6842) electricals (added plural) +6843) photoelectricity +6844) gas-cooled +6845) Torness (name - Wikipedia) +6846) comminuted +6847) orthopaedist (+plural) +6848) trochanteric (Collins) +6849) trochanteral (Collins) +6850) triacetate +6851) macrolanguage (+plural - Wiktionary) +6852) macrolinguistics (Collins) +6853) protolanguage (+plural) +6854) paralanguage +6855) code-switch (+s +ing +ed) +6856) unilingual +6857) unilingualism +6858) unilingually +6859) Quebecer (+plural) +6860) Ogunquit (+'s - name - Wikipedia) +6861) quebracho (+plural) +6862) bluegums (added plural) +6863) agroforestry +6864) florals (added plural) +6865) selfing + selfed (merged into self) +6866) Brahmana (+plural) +6867) branks (Collins) +6868) araneous (Collins) +6869) rankish (Collins) +6870) rankless (Collins) +6871) rankism (Collins) +6872) crankish (Collins) +6873) Bruegel + Breughel + Brueghel (name) +6874) Cree (+plural - Kevin Atkinson wordlist 60) +6875) dayan +6876) dayanim (plural of previous word) +6877) Frunze (+'s - name - Kevin Atkinson wordlist 60) +6878) Bresson (+'s - name - Wikipedia) +6879) fountainhead (+plural) +6880) Guamanian (+plural - Kevin Atkinson wordlist 60) +6881) Qur'an + Quran (another way of Koran) +6882) Koranic + Qur'anic + Quranic +6883) Lydians (added plural - Kevin Atkinson wordlist 60) +6884) Mede (+plural) +6885) Chicagoland (+plural +'s) +6886) Imola (+'s - name - Wikipedia) +6887) hand-pick (+ed) +6888) Handan (+'s - name - Wikipedia) +6889) hand-painted +6890) Romina (+'s - name - Wikipedia) +6891) fritillary (+plural) +6892) Silverton (+'s - name - Wikipedia) +6893) Tretikov (+'s - name - Wikipedia) +6894) Wikimedia (+'s - name - Wikipedia) +6895) Solapur (+'s - name - Wikipedia) +6896) Akshaya (+'s - name - Wikipedia) +6897) Iyengar (+'s - name - Wikipedia) +6898) triggers (merged into trigger) +6899) added "re" to trigger + triggers + triggering + triggered (Wiktionary) +6900) pinboard (+plural) +6901) Breightmet (name - Wikipedia) +6902) dev (+plural - Wiktionary: abbreviation of developer) +6903) devkit (+plural - Wiktionary) +6904) annulate (+ed) +6905) annulation (+plural) +6906) seta +6907) setae (plural of previous word) +6908) setaceous +6909) setal +6910) clayware (Collins) +6911) epidermoid +6912) gastrula +6913) gastrulae (plural of previous word) +6914) gastrulation +6915) Cottesloe (+'s - name - Wikipedia) +6916) Bonnybridge (name - Wikipedia) +6917) Grangemouth (+'s - name - Wikipedia) +6918) Beckton +6919) printworks +6920) Boroughbridge (name - Wikipedia) +6921) flashover (+plural) +6922) oversaturated (Collins) +6923) teleoperation +6924) teleoperate (+s +ing +ed) +6925) teleoperator +6926) chatterbot (+plural) +6927) Ramona (+'s - name - Wikipedia) +6928) cyberporn +6929) Danni (+'s - name - Wikipedia) +6930) cyberpet (+plural) +6931) Leonard (added the 's - name) +6932) Lolita (+plural) +6933) literality +6934) literalize (-IZE) +6935) literalise (-ISE) +6936) literalist (+plural) +6937) scientism +6938) scientistic +6939) pettifoggery +6940) barratry +6941) barrator (+plural) +6942) barratrous +6943) cusk-eel (+plural) +6944) gorgonian (+plural) +6945) pipefish (+plural) +6946) pipeclay (+s +ing +ed) +6947) trishaw (+plural) +6948) Sharath (+'s - name - Wikipedia) +6949) Penang (+'s - name - Wikipedia) +6950) shophouse (+plural) +6951) Lovett (+'s - name - Wikipedia) +6952) shopman +6953) shopmen (plural of previous word) +6954) shopworker (+plural) +6955) Burnham (+'s - name - Wikipedia) +6956) obstructor (+plural) +6957) Kingsford (+'s - name - Wikipedia) +6958) Jens (+'s - name - Wikipedia) +6959) postglacial +6960) peatland (+plural) +6961) ActiveX +6962) autorecovery (Google) +6963) autorecover (Google) +6964) anonymise (+s +ing +ed - ISE) +6965) anonymize (+s +ing +ed - IZE) +6966) anonymization (-IZE) +6967) anonymisation (-ISE) +6968) Keaton (+'s - name - Wikipedia) +6969) Kinsella (+'s - name - Wikipedia) +6970) Al-Anon +6971) Groff (+'s - name - Wikipedia) +6972) immunotoxic (Collins) +6973) aflatoxin (+plural) +6974) groundnuts (added plural) +6975) groundmass +6976) phenocryst (+plural) +6977) xenocryst (+plural +ic) +6978) apomixis +6979) apomictic +6980) facultative +6981) facultatively +6982) auxotroph (+plural +ic) +6983) thiamin (another way of thiamine) +6984) autocrine +6985) paracrine +6986) chemosensory +6987) sensillum +6988) sensilla (plural of previous word) +6989) campaniform (Collins) +6990) palp (+plural) +6991) palpi (another plural of previous word) +6992) palpus (another way of palp) +6993) palpal +6994) palpability +6995) multicentric +6996) mammographic +6997) deuteranopia +6998) bryology +6999) bryological +7000) bryologist (+plural) +7001) Ruud (+'s - name - Wikipedia) +7002) bryony (+plural) +7003) coralroot (+plural) +7004) thimbleberry (+plural) +7005) bittercress +7006) fireweed +7007) waterweed +7008) silverweed +7009) willowherb +7010) rosebay +7011) Scythia (name) +7012) Scythian (+plural) +7013) Sarmatia (name) +7014) Sarmatian +7015) Ossete (+plural) +7016) Ossetic +7017) Ossetia (name) +7018) Ossetian (+plural) +7019) Chechens (added plural) +7020) Levi's (added the 's - name) +7021) Hannah's (added the 's - name) +7022) browbeater (+plural) +7023) Wolfowitz (+'s - name - Wikipedia) +7024) Broward (name of place) +7025) chaffweed +7026) buffo (+plural) +7027) CRM (abbreviation: Customer Relationship Management) +7028) Paterson (+'s - name - Wikipedia) +7029) croakily +7030) Maggie's (added the 's - name) +7031) okey-dokey +7032) okey-doke (another way of previous word) +7033) Protista +7034) protist (+plural) +7035) protistan (+plural) +7036) protistology +7037) unwalled +7038) embryogenesis +7039) embryogenic +7040) embryogeny +7041) explant (+plural +ed) +7042) explantation +7043) concrescence +7044) concrescent +7045) intermedium +7046) intermedia (plural of previous word) +7047) griot (+plural) +7048) oilstone +7049) cheese-skipper +7050) cheese-cutter (+plural) +7051) cheese-paring +7052) Kidman (+'s - name - Wikipedia) +7053) Sheehan (+'s - name - Wikipedia) +7054) meany (another way of meanie) +7055) capitulum +7056) capitula (plural of previous word) +7057) coracoid +7058) CNS (abbreviation: Central Nervous System) +7059) cnidarian (+plural) +7060) nematocyst (+plural) +7061) lancelet (+plural) +7062) notochord (+plural) + + +V2.27 - 1-AUG-2015 +------------------ +7063) Uriarte (+'s - name - Wikipedia) +7064) Traynor (+'s - name - Wikipedia) +7065) dreamwork +7066) Hergenröther (+'s - name - Wikipedia) +7067) Ralph (+'s - name - Wikipedia) +7068) far-distant +7069) far-ranging +7070) Verdana +7071) unextended (Collins) +7072) blobby (+ier +iest) +7073) luderick +7074) Luddites (added plural) +7075) Luddism +7076) Ludditism +7077) pressroom (Collins) +7078) dominators (added plural) +7079) gynarchy (+plural) +7080) Augustine's (added the 's - name) +7081) emmet +7082) mitogen (+plural +ic) +7083) vasoconstriction +7084) vasoconstrictive +7085) vasoconstrictor (+plural) +7086) antidiuretic (antidiuretic hormone) +7087) antidiarrhoeal +7088) anti-emetics (added plural) +7089) inhabitability +7090) ultrarapid (Collins) +7091) ultracompetent (Collins) +7092) multispeed (Collins) +7093) superspeed (Collins) +7094) ultrasafe (Collins) +7095) outspeed (Collins) +7096) counterterror (Collins) +7097) counterthreat (Collins) +7098) counterthrust (Collins) +7099) countereffort (Collins) +7100) counterreformer (Collins) +7101) ultisol (+plural) +7102) oxisol (+plural) +7103) epicentral +7104) transcurrent +7105) rockslide (+plural) +7106) icefall (+plural) +7107) Perry (+'s - name - Wikipedia) +7108) snowshoers (added plural) +7109) après-ski (+ing) +7110) Zermatt (+'s - name - Wikipedia) +7111) barrique (+plural) +7112) cedary (Collins) +7113) unprioritized (Wiktionary: -IZE) +7114) unprioritised (Wiktionary: -ISE) +7115) PDT (abbreviation: Pacific Daylight Time) +7116) daymare (+plural) +7117) daypack (+plural) +7118) daysacks (added plural) +7119) flyblow +7120) flyback +7121) Damietta (+'s - name - Wikipedia) +7122) referentiality +7123) Watten (+'s - name - Wikipedia) +7124) Derrida (+'s - name - Wikipedia) +7125) Stancanelli (name - Wikipedia) +7126) Appiah (+'s - name - Wikipedia) +7127) gastroenterology +7128) gastroenterological +7129) gastroenterologist (+plural) +7130) dysphagia +7131) dysarthria +7132) contrabassoon +7133) endometrium +7134) endometrial +7135) endometriosis +7136) endolymph +7137) endoglossic +7138) exoglossic +7139) agrammatism +7140) agranulocytosis +7141) epiphanic +7142) Azilian +7143) Chalcolithic +7144) Acheulian +7145) agonistic +7146) agonistically +7147) welfarism +7148) welfarist +7149) Bretton (+'s - name - Wikipedia) +7150) Beveridge (+'s - name - Wikipedia) +7151) Metrotown (+'s - name - Wikipedia) +7152) Burnaby (+'s - name - Wikipedia) +7153) Rideau (+'s - name - Wikipedia) +7154) Manulife (+'s - name - Wikipedia) +7155) Ripon (+'s - name - Wikipedia) +7156) Wakefield's (added the 's - name - Wikipedia) +7157) Southwell (+'s - name - Wikipedia) +7158) Devonport (+'s - name - Wikipedia) +7159) Stonehouse (+'s - name - Wikipedia) +7160) Teesside (+'s - name - Wikipedia) +7161) Sarum (+'s - name - Wikipedia) +7162) Sandwell (+'s - name - Wikipedia) +7163) Asaph (+'s - name - Wikipedia) +7164) Ilkley (+'s - name - Wikipedia) +7165) Shipley (+'s - name - Wikipedia) +7166) Herne (+'s - name - Wikipedia) +7167) Carnforth (+'s - name - Wikipedia) +7168) Heysham (+'s - name - Wikipedia) +7169) Otley (+'s - name - Wikipedia) +7170) Harpenden (+'s - name - Wikipedia) +7171) Pendlebury (+'s - name - Wikipedia) +7172) Swinton (+'s - name - Wikipedia) +7173) Hetton-le-Hole (name - Wikipedia) +7174) Houghton-le-Spring (+'s - name - Wikipedia) +7175) Castleford (+'s - name - Wikipedia) +7176) Ossett (+'s - name - Wikipedia) +7177) Pontefract (+'s - name - Wikipedia) +7178) Alresford (+'s - name - Wikipedia) +7179) Tameside (+'s - name - Wikipedia) +7180) Cottingham (+'s - name - Wikipedia) +7181) Brechin (+'s - name - Wikipedia) +7182) Dunkeld (+'s - name - Wikipedia) +7183) Letchworth (+'s - name - Wikipedia) +7184) Earley (+'s - name - Wikipedia) +7185) Woodley (+'s - name - Wikipedia) +7186) Ashgate (+'s - name - Wikipedia) +7187) Kirkwall (+'s - name - Wikipedia) +7188) credentialed + credentialing (merged into credential) +7189) irreverential +7190) Alfie (+'s - name - Wikipedia) +7191) irresponsive +7192) irresponsiveness +7193) non-Aboriginal +7194) non-achiever (+plural) +7195) dehydrocholesterol +7196) cholecalciferol +7197) IU (abbreviation: International Unit) +7198) decimetric +7199) centimetric (Collins) +7200) clast (+plural) +7201) clathrate (+plural) +7202) Blackmore (+'s - name - Wikipedia) +7203) buckytube (+plural) +7204) electrolytical +7205) electroluminescence +7206) immunoassays (added plural) +7207) Menindee (name - Wikipedia) +7208) Macalister (+'s - name - Wikipedia) +7209) Avebury (+'s - name - Wikipedia) +7210) Slieve (name - Wikipedia) +7211) encage (+s +ing +ed) +7212) CFOs (added plural) +7213) antivenene (another way for antivenin) +7214) antivenom (+plural) +7215) Somersby (+'s - name - Wikipedia) +7216) Brownwood (+'s - name - Wikipedia) +7217) Britt (+'s - name - Wikipedia) +7218) antitypical +7219) Prynne (+'s - name - Wikipedia) +7220) anti-inflammatory +7221) antiparasitic (Collins) +7222) anti-intellectual (+plural) +7223) anti-infective +7224) alarmism +7225) Caton (+'s - name - Wikipedia) +7226) unscriptural +7227) salvationist +7228) Salvationist (+plural) +7229) salvationism +7230) Luther's (added the 's - name - Wikipedia) +7231) consubstantial +7232) consubstantiality +7233) Tillard (+'s - name - Wikipedia) +7234) Christology +7235) Christological +7236) Christologically +7237) Bonhoeffer (+'s - name - Wikipedia) +7238) Mariology +7239) Mariological +7240) Mariologist (+plural) +7241) Montfort (+'s - name - Wikipedia) +7242) Cranmer (+'s - name - Wikipedia) +7243) upvote (+s +ing +ed) +7244) downvote (+s +ing +ed) +7245) raptorial +7246) raptorially +7247) avifauna +7248) avifaunal +7249) biomaterials (added plural) +7250) Hampden (+'s - name - Wikipedia) +7251) grapeseed (grapeseed oil) +7252) oaked +7253) monographic +7254) Gifford's (added the 's - name) +7255) Patricia's (added the 's - name) +7256) Jenkins's (added the 's - name) +7257) historiographic +7258) historiographically +7259) situationally +7260) Kildavin (name - Wikipedia) +7261) Stanmore (+'s - name - Wikipedia) +7262) Howth (+'s - name - Wikipedia) +7263) situates (merged into situate) +7264) dumpsite (Collins) +7265) Eudora (+'s - name - Wikipedia) +7266) Pepsi (+plural - Wiktionary) +7267) prefetch (+s +ing +ed) +7268) prefigurative +7269) prefigurement +7270) prefigurations (added plural) +7271) anymore (removed since it is chiefly North American) +7272) blocklist (+plural - Wiktionary) +7273) censorware (Wiktionary) +7274) killfile (+s +ing +ed - Wiktionary) +7275) squee (+s +ing +ed - Oxford: informal) +7276) squeegeed (merged into squeegee) +7277) brookweed +7278) loosestrife +7279) alstroemeria +7280) waltzer (+plural) +7281) dogdom +7282) doggish +7283) doglike +7284) hottie (+plural) +7285) hotty (another way of previous word) +7286) Pavarotti (+'s - name - Wikipedia) +7287) hotters (added plural) +7288) dorsum +7289) dorsa (plural of previous word) +7290) dorsolateral +7291) dorsolaterally +7292) cuticular +7293) abaxial +7294) adaxial +7295) micrographs (added plural) +7296) micrographic +7297) micrographics +7298) microgranite +7299) hydroxyproline (Collins) +7300) microgeneration +7301) microgenerate +7302) co-founders (added plural) +7303) co-found (+ed +ing) +7304) co-education +7305) co-educational +7306) homopolar +7307) tocopherol (+plural) +7308) synergetic +7309) synergic +7310) metaphorist (Collins) +7311) euroterminal (Collins) +7312) starshine (Collins) +7313) anaphrodisiac (+plural) +7314) decalcify (+s +ing +ed) +7315) decalcifier +7316) decalcification +7317) remineralize (+s +ing +ed -IZE) +7318) remineralise (+s +ing +ed -ISE) +7319) remineralization (-IZE) +7320) remineralisation (-ISE) +7321) osteoclast (+plural +ic) +7322) resorb (+s +ing +ed) +7323) resonation +7324) rhetor (+plural) +7325) interactional +7326) retroact (+s +ing +ed) +7327) retroaction +7328) scrollwork +7329) coachroofs (added plural) +7330) redrill (+s +ing +ed - Wiktionary) +7331) foredecks (added plural) +7332) soundcheck (+plural) +7333) soundbar (+plural) +7334) soundalike (+plural) +7335) neep (+plural) +7336) Soundex +7337) soundhole (+plural) +7338) soundclash +7339) dance-off (+plural) +7340) dancercise (-ISE) +7341) dancercize (-IZE) +7342) Discman (Collins) +7343) alveolate +7344) conjunctivae (another plural of conjunctiva) +7345) pericarditis +7346) lymphangitis +7347) subspecialist (+plural - Wiktionary) +7348) non-functioning +7349) non-gendered +7350) non-genetic +7351) non-genetically +7352) non-hostile +7353) biobank (+plural) +7354) biobibliography (+plural) +7355) hydrobiology +7356) biocentrism +7357) biocentric +7358) biocentrist (+plural) +7359) cosmopolis +7360) Heliopolis (name) +7361) spangly (+ier +iest) +7362) blackface +7363) demassify (+s +ing +ed +ion) +7364) dematerialize (+s +ing +ed +ion -IZE) +7365) dematerialise (+s +ing +ed +ion -ISE) +7366) attestable +7367) attestor (+plural) +7368) preparer (+plural) +7369) carboxylic (carboxylic acid) +7370) ethanoic (ethanoic acid) +7371) methanoic (methanoic acid) +7372) methanogenesis +7373) Horace's (added the 's - name - Wikipedia) +7374) badger-baiting +7375) beagler (+plural) +7376) lurchers (added plural) +7377) Higham (+'s - name - Wikipedia) +7378) underfeed (+ing) +7379) droid (+plural) +7380) Bharat (+'s - name) +7381) Bharatanatyam +7382) Bhavnagar (+'s - name) +7383) Antalya (+'s - name) +7384) pharmacotherapy +7385) clonidine (Collins) +7386) reserpine +7387) hydralazine (Collins) +7388) Edith's (added the 's - name - Wikipedia) +7389) firewall's (added the 's) +7390) BSE (Abbreviation: Bovine Spongiform Encephalopathy) +7391) spongiform +7392) redwater +7393) babesiosis +7394) piroplasmosis +7395) pirogue (+plural) +7396) pirk (+plural) +7397) cardoon (+plural) +7398) Calc (OpenOffice/LibreOffice) +7399) chit-chat (+s +ing +ed) +7400) Danielle (+'s - name - Wikipedia) +7401) nitty-gritty (Oxford: informal) +7402) nitrox +7403) Machmeter +7404) Canopus (name in space) +7405) Nibiru (+'s - name of Planet X - Wikipedia) +7406) Aldebaran (name in space) +7407) arctophile (+plural) +7408) arctophilia +7409) arctophilist +7410) arctophily +7411) peckish (Oxford: informal) +7412) Pecksniffian +7413) Dodge (+'s - name - Wikipedia) +7414) pecorino (+plural) +7415) non-medical +7416) EU (added the 's - abbreviation of European Union) +7417) Eu (chemical element) +7418) kidology (Oxford: informal) +7419) iridology +7420) iridologist (+plural) +7421) naturopathy +7422) naturopath (+plural) +7423) naturopathic +7424) naturopathically + + +V2.28 - 1-SEP-2015 +------------------ +7425) sloganeer (+plural +ing) +7426) shutdowns (added plural) +7427) slogger (+plural) +7428) Dyson (+'s - name - Wikipedia) +7429) Bronson (+'s - name - Wikipedia) +7430) escargots (added plural) +7431) Otago (+'s - name - Wikipedia) +7432) Margot (+'s - name - Wikipedia) +7433) escapologist (+plural) +7434) ASBO (+plural) +7435) guardee (Oxford: informal) +7436) Denbigh's (added the 's - name - Wikipedia) +7437) Demosthenes +7438) Demosthenic +7439) Dillon's (added the 's - name - Wikipedia) +7440) antiscience (Collins) +7441) technophile (added singular) +7442) technophilia +7443) technophilic +7444) technophobe (+plural) +7445) technopreneur (+plural) +7446) technopreneurial +7447) technospeak +7448) inboxes (added plural) +7449) newspeak +7450) textspeak +7451) forepeak (+plural) +7452) bobsleigh (fixed: bob-sleigh) +7453) Rudman (+'s - name - Wikipedia) +7454) Oxfam +7455) coevality +7456) citriculture +7457) fruticulture (Wiktionary) +7458) orphanism (Collins) +7459) Zephaniah (+'s - name) +7460) suspire +7461) suspiration +7462) subsumable +7463) subsumption +7464) potentiated (merged into potentiate) +7465) biologics (added plural) +7466) monotherapy +7467) diplopia +7468) photophobia +7469) photophobic +7470) uveitis +7471) exophthalmos + exophthalmus + exophthalmia +7472) hepatomegaly +7473) oncologic (Collins) +7474) vomeronasal (Collins) +7475) chemoreceptor (+plural) +7476) chemoreception +7477) bugless (Wiktionary) +7478) unpublish (+s +ing +ed - Wiktionary) +7479) relearnt +7480) epitope (+plural) +7481) epitomic +7482) epitomist +7483) epithelia (plural of epithelium) +7484) mesothelium +7485) mesothelia (plural of previous word) +7486) mesothelial +7487) antrum +7488) antra (plural of previous word) +7489) rhinoplasty (+plural +ic) +7490) gastrostomy (+plural) +7491) cystectomy (+plural) +7492) tetraplegic's (added the 's) +7493) clitoridectomy (+plural) +7494) craniotomy (+plural) +7495) drachmae (another plural of drachma) +7496) Draco (+'s - name) +7497) draconic +7498) Bram (+'s - name - Wikipedia) +7499) mortadella +7500) expellee (+plural) +7501) expeller (+plural) +7502) changelog (+plural - Wiktionary) +7503) OpenSolaris +7504) OpenBSD +7505) autocompletion (Wiktionary) +7506) autodiscovery (Wiktionary) +7507) autodetect (+s +ing +ed - Wiktionary) +7508) autodetection (Wiktionary) +7509) autofit (+s +ing +ed - Wiktionary) +7510) autoformat (+s +ing +ed - Wiktionary) +7511) BSOD (abbreviation: blue screen of death - Wikipedia) +7512) enqueuing + enqueueing +7513) enprint (+plural) +7514) autowind (+s +ing +er +ers) +7515) autowound (past of previous word) +7516) electroconvulsive +7517) electrochemists (added plural) +7518) Hagelstein (+'s - name - Wikipedia) +7519) Borazon (Oxford: trademark) +7520) elastase +7521) eldritch +7522) Eleatic (+plural) +7523) Zeno (+'s - name) +7524) Xenophanes (+'s - name) +7525) Bonapartism +7526) Bonapartist +7527) crowd-pleaser (+plural) +7528) Pelagius (name) +7529) Pelagian (+plural) +7530) Pelagianism +7531) airplane (removed - Chiefly American - GB is: aeroplane) +7532) microglia +7533) microglial +7534) gliosis (Collins) +7535) perivascular +7536) leptomeninges +7537) leptomeningeal +7538) backmost +7539) sternway +7540) cross-link (+s +ing +ed) +7541) cross-linkage +7542) psyllium +7543) psychrophile (+plural) +7544) psychrophilic +7545) thermophile (+plural) +7546) thermophilic +7547) pneumonitis +7548) pneumogastric +7549) pneumoencephalography (+ic) +7550) giantism +7551) acromegaly (+ic) +7552) polycystic +7553) anovulation (Collins) +7554) diverticulosis +7555) divertissement (+plural) +7556) Surtees (+'s - name) +7557) Montreal's (added the 's - name) +7558) Mandelson (+'s - name - Wikipedia) +7559) Criswell (+'s - name - Wikipedia) +7560) scintillatingly +7561) scintigram (+plural) +7562) revaccinate (+s +ing +ed +ion) +7563) Glaister (+'s - name - Wikipedia) +7564) Beckenham (+'s - name - Wikipedia) +7565) elicitor (+plural) +7566) emmenagogue (+plural) +7567) vermifuge +7568) abortifacient +7569) AZT (Oxford: trademark) +7570) ghostbuster (+plural) +7571) speech-writer (+plural) +7572) affordably +7573) lordless +7574) disafforest (+s +ing +ed +ion) +7575) Tweedy (+'s - name - Wikipedia) +7576) Hughes's (added the 's - name - Wikipedia) +7577) disaffirm (+s +ing +ed +ion) +7578) reaggregate (Collins) +7579) unhandled +7580) unhandsome +7581) unhang +7582) unhung (past of previous word) +7583) unhappen +7584) unsearched +7585) unrevealed +7586) SDRAM (Wiktionary) +7587) VRAM (Wiktionary) +7588) NVRAM (+plural - Wiktionary) +7589) RAMs (added plural - Wiktionary) +7590) ROMs (added plural - Wiktionary) +7591) initialism (+plural) +7592) initiand (+plural) +7593) macrodiagonal (Collins) +7594) macrocopy (+plural - Collins) +7595) macrodome (Collins) +7596) antenatally +7597) rostering + rostered (merged into roster) +7598) Kramer's (added the 's - name - Wikipedia) +7599) Melba's (added the 's - name - Wikipedia) +7600) canterbury (+plural - noun - don't confuse with the name) +7601) armoire (+plural) +7602) ropework (Collins) +7603) Tenebrae +7604) Brozman (+'s - name - Wikipedia) +7605) CWO (abbreviation: Chief Warrant Officer) +7606) Cwmbran (+'s - name - Wikipedia) +7607) babyfather (+plural) +7608) baby-faced +7609) baby-doll +7610) patchouli +7611) ylang-ylang +7612) ilang-ilang (another way of previous word) +7613) Yizkor (+plural) +7614) Yishuv +7615) Betjeman (+'s - name) +7616) twitterer (+plural) +7617) twittery +7618) flitter (+s +ing +ed) +7619) twittish +7620) twistor +7621) eigenfrequency (+plural) +7622) Sangiovese +7623) chaptalization (-IZE) +7624) chaptalisation (-ISE) +7625) chaptalize (+s +ing +ed -IZE) +7626) chaptalise (+s +ing +ed -ISE) +7627) Chaplinesque +7628) cryptozoology +7629) cryptozoological +7630) cryptozoologist (+plural) +7631) cryptosporidium +7632) cryptosporidia +7633) coccidia +7634) coccidian +7635) toxoplasma +7636) utero (in utero) +7637) goldeneye (+plural) +7638) alveolars (added plural) +7639) circumcisers (added plural) + + +V2.29 - 1-OCT-2015 +------------------ +7640) Emmental + Emmenthal +7641) Brie +7642) ciabatta (+plural) +7643) flatbreads (added plural) +7644) pita (removed as it was American) +7645) pitta (+plural - it is a bread and a bird) +7646) bap (+plural) +7647) Redditor (+plural) +7648) Reddit +7649) subreddit (+plural) +7650) manspreading +7651) MacGyver (+'s - name) +7652) Brexit + Brixit +7653) awestricken (another way of awestruck) +7654) stagehand (fixed: stage-hand) +7655) CVT (abbreviation: Continuously Variable Transmission) +7656) Europass (European Union site) +7657) anything's (added the 's) +7658) everything's (added the 's) +7659) how'd (Wiktionary) +7660) how're (Wiktionary) +7661) can't've (Wiktionary) +7662) couldn't've (Wiktionary) +7663) how've (Wiktionary) +7664) might've (Wiktionary) +7665) mightn't've (Wiktionary) +7666) nothing's (added the 's) +7667) shouldn't've (Wiktionary) +7668) there're (Wiktionary) +7669) this'd (Wiktionary) +7670) wouldn't've (Wiktionary) +7671) arses + arsing (merged into arse) +7672) half-arse (+ing +ed) +7673) anxiolytic (+plural) +7674) antiepileptics (added plural - Wiktionary) +7675) clonazepam +7676) hydrocodone (+plural - Wiktionary) +7677) MAOI +7678) naproxen +7679) oxycodone +7680) SSRI +7681) sublingual (+ally) +7682) ADHD (abbreviation: Attention deficit hyperactivity disorder) +7683) BPD +7684) CBT (abbreviation: Cognitive behavioural therapy) +7685) cyclothymia +7686) cyclothymic +7687) dysmorphia +7688) dysmorphic +7689) dysphoria +7690) dysphoric +7691) dysthymia +7692) dysthymic +7693) NPD +7694) suicidality +7695) backtick (+plural) +7696) configurability (Google) +7697) display's (added the 's) +7698) ECMAScript (+'s - Wiktionary) +7699) microSD (Wikipedia) +7700) programmatically +7701) symlink (+s +ing +ed) +7702) throbber (+plural) +7703) untick (+s +ing +ed - Wiktionary) +7704) transclude (+s +ing +ed - Wiktionary) +7705) wiki's (added the 's) +7706) blog's (added the 's) +7707) blogger's (added the 's) +7708) griefing + griefed (merged into grief - Wiktionary) +7709) griefer (+plural +'s) +7710) hiragana +7711) kana +7712) kanji +7713) katakana +7714) classism +7715) classist (+plural) +7716) heteronormative +7717) heteronormativity +7718) heterophobe (+plural - Wiktionary) +7719) Hopkins's (added the 's - name - Wikipedia) +7720) heterophobia (Wiktionary) +7721) heterophobic (Wiktionary) +7722) heterosexism +7723) heterosexist +7724) intersectionality +7725) intersectional +7726) intersectionalism (Wiktionary) +7727) misandrist (+plural) +7728) patriarchically +7729) transphobe (+plural - Wiktionary) +7730) transphobia +7731) transphobic +7732) aromantic (+plural) +7733) aromanticism (Wiktionary) +7734) demisexual (+plural + ity - Wiktionary) +7735) demisexuality (Wiktionary) +7736) heteroflexible (Collins) +7737) agender +7738) teen's (added the 's - Wikipedia) +7739) androgyne (+plural) +7740) androgynously +7741) bi-gender +7742) bi-gendered +7743) cis +7744) substituent (+plural) +7745) methoxyl +7746) cisgender +7747) cisgendered +7748) gender-fluid +7749) genderqueer (+plural) +7750) trans +7751) autotune (+s +ing +ed +er +ers - merged into autotune) +7752) cancellable (Collins) +7753) miscategorise (+s +ing +ed - Wiktionary) +7754) epilation +7755) epilate (+s +ing +ed) +7756) epilator (+plural) +7757) isopropyl +7758) sequitur (+plural - non sequitur) +7759) trinary (Collins) +7760) unfulfillable +7761) unfulfilling +7762) veganism +7763) fruitarian (+plural) +7764) fruitarianism +7765) non-American +7766) unpair (+s +ing +ed - Wiktionary) +7767) linting (merged into lint - Collins) +7768) genericise (+s +ing +ed - Wiktionary) +7769) geneticize (-IZE) +7770) geneticise (-ISE) +7771) geneticism +7772) repolarization +7773) repolish (+s +ing +ed) +7774) reanalyse (+s +ing +ed) +7775) intraindividual (Wiktionary) +7776) denaturation +7777) photovoltage (Wiktionary) +7778) oftenness +7779) Oftel + OFTEL +7780) superphylum (Collins) +7781) Asteroidea +7782) Ophiuroidea +7783) crossopterygian (+plural) +7784) burrfish (+plural) +7785) catfight (+s +ing) +7786) Felix's (added the 's - name) +7787) baddy (another way of baddie) +7788) Darnley (+'s - name) +7789) azidothymidine +7790) zidovudine +7791) thymidine +7792) nucleoside (+plural) +7793) miscreate (+s +ing +ed) +7794) miscreative +7795) Germain (+'s - name - Wikipedia) +7796) that've (Wiktionary) +7797) there've (Wiktionary) +7798) which've (Wiktionary) +7799) unsupportive +8800) kibibit (+plural - IEC - Wikipedia) +8801) mebibit (+plural - IEC - Wikipedia) +8802) gibibit (+plural - IEC - Wikipedia) +8803) tebibit (+plural - IEC - Wikipedia) +8804) pebibit (+plural - IEC - Wikipedia) +8805) exbibit (+plural - IEC - Wikipedia) +8806) zebibit (+plural - IEC - Wikipedia) +8807) yobibit (+plural - IEC - Wikipedia) +8808) kibibyte (+plural - IEC - Wikipedia) +8809) mebibyte (+plural - IEC - Wikipedia) +8810) gibibyte (+plural - IEC - Wikipedia) +8811) tebibyte (+plural - IEC - Wikipedia) +8812) pebibyte (+plural - IEC - Wikipedia) +8813) exbibyte (+plural - IEC - Wikipedia) +8814) zebibyte (+plural - IEC - Wikipedia) +8815) yobibyte (+plural - IEC - Wikipedia) +8816) anonymiser (+plural - Wiktionary) +8817) backtrace (+s +ing +ed - Wiktionary) +8818) bashism (+plural - Wiktionary) +8819) bi-endian (Wiktionary) +8820) big-endian +8821) little-endian +8822) bytecode (+plural - Wiktionary) +8823) misprice (+s +ing +ed) +8824) noncallable +8825) classful (Wiktionary) +8826) cron +8827) draggability (Wiktionary) +8828) draggable (Wiktionary) +8829) daemonize (+s +ing +ed - Wiktionary) +8830) diff (+s +ing +ed) +8831) endian +8832) idempotence +8833) ‎idempotency +8834) metasyntactic (Wiktionary) +8835) nullable +8836) opcode (+plural) +8837) pageable (Wiktionary) +8838) parallelize (+s +ing +ed +ion -IZE) +8839) parallelise (+s +ing +ed +ion -ISE) +8840) performant (Wiktionary) +8841) procuracy (+plural) +8842) proxying + proxied (merged into proxy - Wiktionary) +8843) stateful +8844) Marston (+'s - name - Wikipedia) +8845) bedplate +8846) templating + templated (Wiktionary) +8847) tokenisation (Wiktionary) +8848) tokeniser (+plural - Wiktionary) +8849) webmail's (added the 's) +8850) unmount (+s +ing +ed) +8851) noninfringement (Collins) +8852) nonrefoulement +8853) refoulement +8854) unmourned +8855) unwarned +8856) unwatchable +8857) resurrectable +8858) paralexia +8859) paralexic +8860) audiotaping + audiotaped (merged into audiotape) +8861) Lenin's (added the 's - name - Wikipedia) +8862) presentism +8863) presentist +8864) presentimental +8865) presentness +8866) presentor +8867) fleuron (+plural) +8868) mouchette +8869) mouchard +8870) psycho-educational +8871) psycho-aesthetic (+plural) +8872) psychicist +8873) psychist +8874) psychicism +8875) unprovided +8876) unprovability +8877) unproud +8878) unprotrusive +8879) unprotesting +8880) unprotestingly +8881) unresting +8882) unrestingly +8883) unrestorable +8884) CLI (abbreviation: Command Line Interface) +8885) Ci (abbreviation: Curie) +8886) CI (abbreviation: several meanings) +8887) minify (+s +ing +ed +ion) +8888) transpile (+s +ing +ed +er +ers - Wiktionary) +8889) transcompile (+s +ing +ed - Wiktionary) +8890) setup (setup file - Collins) +8891) technocentric +8892) technocomplex +8893) technocratically +8894) managerialism +8895) managerialist +8896) technofear +8897) technofreak +8898) technographer +8899) technography +8900) technologism +8901) technomaniac +8902) technomania +8903) technomic +8904) technopark +8905) technopolis +8906) technopolitan +8907) technoscience +8908) technoscientist +8909) technosphere +8910) technostress +8911) technostructures (added plural) +8912) technotronic + technetronic +8913) combatting + combatted (another way of combating and combated) +8914) cross-hair (removed, Oxford says it is two words) +8915) debounce (+s +ing +ed - Wiktionary) +8916) yuck + yuk (Oxford: informal) +8917) gyro (+plural) +8918) repo (+plural - source code repository - Wiktionary) +8919) unopinionated +8920) useable (another way of usable) +8921) unicity +8922) thusly (Oxford: informal) +8923) spandex +8924) buildable (Collins) +8925) buildability (Wiktionary) +8926) primatial +8927) dilatancy +8928) sulphonate (+plural +ing +ed +ion) +8929) sulfonamide (+plural - another way of sulphonamide) +8930) lovebird (+plural - fixed: love-bird) +8931) she-god +8932) she-goat +8933) she-friend +8934) she-dog +8935) she-devil +8936) she-dragon +8937) she-cat +8938) she-ass +8939) Jacopo (+'s - name) +8940) caryopsis +8941) caryopses (plural of previous word) +8942) digitate +8943) digitation +8944) behaviouralists (added plural) +8945) underbred +8946) bioterrorists (added plural) +8947) ironworking +8948) glasswork (+plural - Collins) +8949) Whitehouse (+'s - name - Wikipedia) +8950) Serenity (+'s - name - Wikipedia) +8951) serenities (plural of serenity) +8952) Pinochet (+'s - name - Wikipedia) + + +V2.30 - 1-NOV-2015 +------------------ +8953) affordance +8954) roofline (+plural) +8955) ideating + ideated (merged into ideate) +8956) repurpose (+s +ing +ed) +8957) collotype (+plural) +8958) Jones's (added the 's - name - Wikipedia) +8959) biosensor (+plural) +8960) radiotracer +8961) microsphere (+plural) +8962) radiotoxicity +8963) radiotoxic +8964) radiothorium +8965) radiothermal +8966) radiotherapeutically +8967) radiotelex +8968) radioteletype +8969) radiotelemetry +8970) radiotelegraphically +8971) radiosurgery +8972) radiosurgical +8973) radiostrontium +8974) radiosterilized +8975) radiosterilization +8976) radiostereometric +8977) radiosondage +8978) radiosity +8979) radiosensitizer +8980) radiosensitizing +8981) radiosensitization +8982) radiosensitize +8983) radiosensitivity +8984) radiosensitive (+ness) +8985) radioscanning +8986) radioresistant +8987) radioreceptor +8988) radiolabelled +8989) radioland +8990) radiolaria +8991) Sipuncula +8992) sipunculan (+plural) +8993) sipunculid (+plural) +8994) Sipunculus +8995) Coverley (+'s - name - Wikipedia) +8996) Harvey's (added the 's - name - Wikipedia) +8997) colourblock (+ing +ed) +8998) tankini (+plural) +8999) tankodrome +8000) tankette +9001) tankbuster (Oxford: informal) +9002) airgraph +9003) encaustic +9004) Gogh (+'s - name - Wikipedia) +9005) pastegrain +9006) pasteboard-like +9007) headbay +9008) headborough +9009) headcams (added plural) +9010) headbutts (added plural) +9011) Fairfax's (added the 's - name - Wikipedia) +9012) royalism +9013) parliamentarianism +9014) Aquarian (+plural) +9015) libra +9016) librae (plural of previous word) +9017) libidinally +9018) object-libido +9019) libertyless +9020) LIBOR +9021) amylose +9022) crystallizable (-IZE) +9023) crystallisable (-ISE) +9024) unbranched (Collins) +9025) amylopectin +9026) valproic (valproic acid) +9027) Antisthenes (name) +9028) trisectors (added plural) +9029) conchoid +9030) Nicomedes (+'s - name - Wikipedia) +9031) pappus +9032) pappi (plural of previous word) +9033) pappose +9034) Pappus (+'s - name - Wikipedia) +9035) pappy (+plural) +9036) poppyseeds (added plural) +9037) poppywort +9038) popsock (+plural) +9039) Steckling’s (added the 's - name) +9040) Clancarty (+'s - name - Wikipedia) +9041) co-trimoxazole +9042) doxycycline +9043) minocycline +9044) ciprofloxacin (Collins) +9045) sulphamethoxazole + sulfamethoxazole +9046) trimethoprim +9047) trimeter (+plural) +9048) trimetric +9049) trimetrical +9050) trisyllables (added plural) +9051) trisyllabic +9052) accentualist +9053) accentuality +9054) accentor (+plural) +9055) waxbill (+plural) +9056) congeneric +9057) congenerous +9058) primogenital +9059) primogenitary +9060) primogenitive +9061) co-ally (+ed) +9062) co-belligerent (+plural) +9063) co-belligerence +9064) co-branded +9065) co-branding +9066) co-conspirator (+plural) +9067) co-chair (+plural) +9068) co-counselling +9069) Balliol (+'s - name - Wikipedia) +9070) Whitworth +9071) Pitt (+'s - name - Wikipedia) +9072) Pitressin +9073) pitpan (+plural) +9074) touchlines (added plural) +9075) bookaholic (Oxford: informal) +9076) blogrolls (added plural) +9077) noseband +9078) cavesson (+plural) +9079) biostratigrapher (+plural) +9080) biostratigraphic +9081) biostratigraphical +9082) biostratigraphically +9083) macrofossil +9084) macrofungus +9085) macrogametocyte +9086) macrogamete +9087) flagellar +9088) epaxial +9089) unwellness +9090) aitchbone +9091) aitchless +9092) anterogradely +9093) claustrum +9094) claustra +9095) lentiform (lentiform nucleus) +9096) buccinator (+plural) +9097) Bucephalus (name) +9098) anacreontic (+plural) +9099) Anacreon (+'s - name - Wikipedia) +9100) essayistic +9101) recontinuance +9102) recontinue +9103) reconvalescence +9104) reconvalescent +9105) thicko (+plural - Oxford: informal) +9106) thicknesser (+plural) +9107) Castro's (added the 's - name - Wikipedia) +9108) IQs (added plural) +9109) intellectualistic +9110) intellectualist (+plural) +9111) voluntarist +9112) voluntaristic +9113) dogmatise (+s +ing +ed - ISE) +9114) dogmatize (+s +ing +ed - IZE) +9115) dognap (+s +ing +ed +er +ers) +9116) dogology +9117) dogship +9118) dogsleep +9119) dogstones +9120) televisionary (+plural) +9121) broadleaves +9122) broadloomed +9123) duplet (+plural) +9124) Burtenshaw (+'s - name - Wikipedia) +9125) unship (+s +ing +ed) +9126) unshockable +9127) unshockability +9128) unshrinkable +9129) unshrinkability +9130) unshrinkingly +9131) speargun +9132) spearfish (+plural +ing) +9133) lumpfish (+plural) +9134) lumpsucker (+plural) +9135) featherback (+plural) +9136) knifefish (+plural) +9137) jammer (+plural) +9138) woodturning +9139) woodturner (+plural) +9140) woodswallow (+plural) +9141) corella (+plural) +9142) wattlebird (+plural) +9143) geckoes (another plural of gecko) +9144) redox +9145) stibine (Collins) +9146) arsewipe (Oxford: slang) +9147) arsenopyrite +9148) wolframite +9149) axinite (Collins) +9150) apophyllite +9151) heulandite (Collins) +9152) sperrylite (Collins) +9153) thaumasite (Collins) +9154) fezzes (added plural) +9155) fezzed (merged into fez) +9156) blousy (+ier +iest - Collins) +9157) incommensurables (added plural) +9158) incommensurability +9159) incommensurably +9160) workpeople +9161) shewn (Collins) +9162) workperson +9163) workwoman +9164) workwise +9165) Forby (+'s - name - Wikipedia) +9166) componentry +9167) cuirass (+plural) +9168) chiliarch's (added the 's) +9169) supergiant (+plural) +9170) WordPress (+'s - name - Wikipedia) +9171) Verizon (+'s - name - Wikipedia) +9172) Comcast (+'s - name - Wikipedia) +9173) underappreciate (+ed +ion) +9174) tachyon (+plural) +9175) bosonic +9176) supergalactic +9177) transmural +9178) superfuse (+ed +ing) +9179) superfruit +9180) superfortress +9181) superforce +9182) superflux +9183) superfluorescent +9184) floristic (+plural) +9185) floristically +9186) barrenly +9187) barrelhead (+plural) +9188) barrelfish (+plural) +9189) achillea +9190) euphorbia (+plural) +9191) cistus +9192) lavatera +9193) buddleia +9194) accessorial +9195) possessory +9196) digresser (+plural) +9197) dihedrals (added plural) +9198) reflectional + reflexional +9199) reflectionless +9200) reflectogram (+plural) +9201) reflectography +9202) reflectograph +9203) reflectogramme +9204) coetaneous +9205) Castilian (+plural) +9206) pastureland (+plural) +9207) shrubland (+plural - Collins) +9208) cinematographically +9209) Dumont's (added the 's - name - Wikipedia) +9210) Bertolucci (+'s - name) +9211) ICANN (+'s - name - Wikipedia) +9212) DNSSEC (+'s - Wikipedia) +9213) WHOIS (Wikipedia) +9214) headrail (+plural) +9215) Kieran's (added the 's - name - Wikipedia) +9216) Euro-wasp +9217) Eurobank +9218) eurocredit (Collins) +9219) Eurocentrist +9220) IMF (+'s - Oxford: abbreviation: International Monetary Fund) + + +V2.31 - 1-DEC-2015 +------------------ +9221) Euroclear +9222) Euroconnector +9223) Euroconvertible +9224) blackcap (+plural) +9225) gonolek (+plural) +9226) shoebill (+plural) +9227) shoeboxes (added plural) +9228) cornmill +9229) ropemaker +9230) ropemanship +9231) ropesight +9232) campanulate +9233) umbo (+plural) +9234) umbones (another plural of previous word) +9235) umbonal +9236) umbonate +9237) invagination (+plural) +9238) invaginate (+ed) +9239) chondrocyte (+plural) +9240) chondrocranium +9241) tessera +9242) tesserae (plural of previous word) +9243) tesseral +9244) colourman +9245) outcross (+s +ing +ed) +9246) outcrying +9247) dependents (added plural) +9248) periodogram +9249) periodograph +9250) periodology +9251) endodontics (Collins) +9252) criminogenic +9253) reconvict (+s +ing +ed +ion) +9254) recopper +9255) reconvoke +9256) reconveyance +9257) reconvertible +9258) reconverge +9259) reconvention +9260) counterpetition (Collins) +9261) reconsult +9262) reconstructiveness +9263) reconstructionary +9264) reconstructional +9265) teleprocessing (Collins) +9266) tiddly (+ier +iest - Oxford: informal) +9267) Tippex + Tipp-Ex (British trademark) +9268) trendsetters (added plural) +9269) disrate (+s +ing +ed) +9270) snakefish (+plural) +9271) lizardfish (+plural) +9272) Gradle (+'s - name - Wikipedia) +9273) Percival (+'s - name - Wikipedia) +9274) Burnage (+'s - name - Wikipedia) +9275) Wexler (+'s - name - Wikipedia) +9276) picturable +9277) Thorson (+'s - name - Wikipedia) +9278) Fass (+'s - name - Wikipedia) +9279) zooplankton +9280) york (+s +ing +ed) +9281) zeolite (+plural +ic) +9282) zeroth +9283) zestfulness +9284) zesty (+ier +iest) +9285) wunderkind (+plural) +9286) wunderkinder (another plural of previous word) +9287) xylene +9288) trichloroethylene +9289) yaks (added plural) +9290) subwindow (+plural - Wiktionary) +9291) multiwindow (+ed) +9292) multiwire +9293) subindex (+plural - Collins) +9294) sub-idea +9295) subindustry (+plural - Collins) +9296) subimpose +9297) subincandescent +9298) subincision +9299) subinfeud +9300) subinfeudation + subenfeudation +9301) subinfeudatory +9302) subfeudatory + subfeudatary +9303) subfeudation +9304) subfertile +9305) subfertility +9306) subfauna +9307) subfactor +9308) subface +9309) subevergreen +9310) suberyl +9311) suberous +9312) suberose +9313) corky (+ier +iest) +9314) subproject (+plural - Collins) +9315) subpubic (Collins) +9316) analysation +9317) analysandum +9318) re-experience +9319) restenosis +9320) fibromuscular (Wiktionary) +9321) endarterectomy (+plural) +9322) cholecystectomy (+plural) +9323) laparoscopy (+plural) +9324) laparoscope +9325) laparoscopic +9326) laparoscopically +9327) laparotomy (+plural) +9328) splenectomy (+plural) +9329) asplenia (Wiktionary) +9330) Excel (+'s - Wikipedia) +9331) O'Farrell (+'s - name - Wikipedia) +9332) Kerensa (name - Wikipedia) +9333) XUL (Wiktionary: XML user interface language) +9334) changeset (+plural - Wiktionary) +9335) Daniel's (added the 's - name - Wikipedia) +9336) IIRC (Wiktionary: informal - If I remember correctly, if I recall correctly) +9337) Stehmann (name - Wikipedia) +9338) theophoric + theophorous +9339) toponymy + toponymics (Collins) +9340) topophilia (Collins) +9341) tapless +9342) tappable +9343) Ginsburg (+'s - name) +9344) panax +9345) underlet (+s +ing) +9346) quickset +9347) Odette (+'s - name) +9348) Debrett (+'s - name) +9349) Rhett (+'s - name - Wikipedia) +9350) comms +9351) commove (+s +ing +ed - Wiktionary) +9352) aidful +9353) unclearly +9354) unclearness +9355) uncleared +9356) sandfly (+plural) +9357) Wickepin (+'s - name - Wikipedia) +9358) Winton (+'s - name - Wikipedia) +9359) Surman (+'s - name - Wikipedia) +9360) Berna (+'s - name - Wikipedia) +9361) Birk (+'s - name - Wikipedia) +9362) Witts (+'s - name - Wikipedia) +9363) Balrog (+'s - name - Wikipedia) +9364) Cloke (+'s - name - Wikipedia) +9365) xvi's (added the 's) +9366) cybersquatter (+plural) +9367) cybersurf +9368) cybertheft +9369) cyberthreat (+plural) +9370) cyberwarfare +9371) cyberwarrior (+plural) +9372) cyberworld +9373) cybrarian (+plural) +9374) Oshii (+'s - name - Wikipedia) +9375) Floyd's (added the 's - name - Wikipedia) +9376) Gilmour (+'s - name - Wikipedia) +9377) uninvested (Collins) +9378) Ezrin (+'s - name - Wikipedia) +9379) maximalist (+plural) +9380) maximalism +9381) rejectionist (+plural) +9382) ISIS (+'s - name of terrorist group - Wikipedia) +9383) EMI (+'s - name - Wikipedia) +9384) scenography +9385) scenographic +9386) Isis (added the 's - name - Wikipedia) +9387) Scenopegia +9388) Everly (+'s - name - Wikipedia) +9389) bandmates (added plural) +9390) freak-out (Oxford: informal) +9391) freakily +9392) freakiness +9393) weakish +9394) isospin +9395) axisymmetric +9396) apothem (+plural) +9397) coplanarity +9398) nonradiative (Wiktionary) +9399) degradability +9400) degradative +9401) ethylbenzene +9402) nitrobenzene +9403) nitrobacterium +9404) nitrify (+s +ing +ed) +9405) Cortana (+'s - name - Wikipedia) +9406) Ginnie (+'s - name - Wikipedia) +9407) Qualcomm (+'s - name - Wikipedia) +9408) datacard (Collins) +9409) databus (Collins) +9410) undogmatic +9411) undoable (Oxford: informal) +9412) undiversified +9413) undistracted +9414) undisputedly +9415) undissociated +9416) cycloaddition (+plural) +9417) interpolar (Collins) +9418) meristem (+plural) +9419) meristematic +9420) periderm +9421) peridermal +9422) phellogen +9423) Diemen (+'s - name) +9424) aerostatics +9425) macromutation +9426) micromutation +9427) micromotor +9428) micromorphology +9429) micromorphological +9430) micromorph (+plural) +9431) micromolar +9432) micromole (+plural) +9433) micromodule +9434) micromodelling + micromodeling +9435) micromodel +9436) microminiaturization + microminiaturisation +9437) photoelectronics +9438) Chambers (+'s - name - Wikipedia) +9439) photoelectromagnetic + photomagnetoelectric +9440) photomask +9441) pellicle +9442) pellicular +9443) interceptive +9444) multilayered (+ness) +9445) macrospore +9446) heterosporous (Collins) +9447) Protoctista +9448) protoctist (+plural) +9449) prokaryote + procaryote +9450) prokaryotic +9451) homologues (added plural) +9452) extrametrical (Collins) +9453) riffage +9454) illuminati +9455) Illuminati +9456) illuminism +9457) illuminist (+plural) +9458) catechumen (+plural) +9459) Eucharistical +9460) Euboea (name of place) +9461) eubacterial +9462) thunderless (Collins) +9463) pleximetry +9464) pleximeter +9465) plexor + plessor +9466) obturator (+plural) +9467) arthroscopy +9468) debridement +9469) debride (+ed) +9470) micro-environment (+plural) +9471) autecology +9472) autecological +9473) caatinga +9474) acetobacter +9475) mycotoxin (+plural) +9476) osteoderm (+plural) +9477) osteodontokeratic +9478) osteodermal +9479) osteodentine +9480) osteodystrophic +9481) osteodystrophy +9482) hyperparathyroidism +9483) hyperparathyroid +9484) hyperparasites (added plural) +9485) hyperphagia +9486) hypersomnia (Collins) +9487) hypersomnolence (Collins) +9488) postinflammatory +9489) postinfectious +9490) postinfection +9491) postillation +9492) postilioned +9493) buckhound (+plural) +9494) staghound (+plural) +9495) elkhound (+plural) +9496) Anglosphere +9497) Anglophony + Anglophonie +9498) Francophonie +9499) Francophonia +9500) disintegrative +9501) disintegrator (+plural) +9502) microcapsules (added plural) +9503) sprayable +9504) droppable +9505) starchitects (added plural) +9506) Baez (+'s - name) +9507) sexvirate +9508) sexuparous +9509) sexuate (+ed) +9510) Mondrian's (added the 's - name - Wikipedia) +9511) naloxone +9512) naltrexone +9513) oxycodone's (added the 's) +9514) opioids (added plural) +9515) radiopaque + radio-opaque +9516) radiopacity +9517) psionic (+plural) +9518) psionically +9519) psilothrum +9520) psilophyte +9521) psilomelane +9522) psilocybin +9523) serotonergic +9524) serotype (+plural) +9525) serotypic +9526) pneumococcus +9527) pneumococci (plural of previous word) +9528) pneumococcal +9529) basophilia +9530) nunchaku (+plural) +9531) Zyrian +9532) zythum +9533) hippogriff + hippogryph (+plural of both) +9534) manticore (+plural) +9535) mantic +9536) geomantical + geomantic + + +V2.32 - 1-JAN-2016 +------------------ +9537) Horatian +9538) explicator +9539) explicatory +9540) Palladian +9541) Palladianism +9542) Piccadilly +9543) Orcadian (+plural) +9544) Trumland (name) +9545) Caithness (+'s - name - Wikipedia) +9546) Rousay (+'s - name - Wikipedia) +9547) Shapinsay (+'s - name - Wikipedia) +9548) Oddie (+'s - name - Wikipedia) +9549) Govan (+'s - name - Wikipedia) +9550) Diane's (added the 's - name - Wikipedia) +9551) Lynch (+'s - name - Wikipedia) +9552) Selwyn's (added the 's - name - Wikipedia) +9553) Camilla's (added the 's - name - Wikipedia) +9554) overanalysis +9555) overanalyse (+s +ing +ed) +9556) diegesis +9557) diegeses (plural of previous word) +9558) diegetic +9559) Harring (+'s - name - Wikipedia) +9560) dieffenbachia (+plural) +9561) horticulturalist (+plural) +9562) unreviewed +9563) Wikipedians (added plural) +9564) unversioned (Wiktionary) +9565) autoconfirm (+s +ing +ed +ion - Wiktionary) +9566) vandalistic +9567) vandalistically +9568) HTML's (added the 's + uppercase - Wikipedia) +9569) wikiquette (Wiktionary) +9570) reasonability +9571) cherry-pick (+s +ing +ed) +9572) Reagle (+'s - name - Wikipedia) +9573) BlackBerry (+s +ing +ed) +9574) wolfberry (+plural) +9575) bloodletter +9576) bloodish +9577) bloodshedder +9578) tear-stained +9579) bloodshedding +9580) blepharitis +9581) keratitis +9582) iritis +9583) atherosclerotic +9584) atheroma +9585) atheromatous +9586) distensibility +9587) distensible +9588) haemodynamic +9589) haemodynamically +9590) haemodynamics +9591) photoreceptors (added plural) +9592) electromedical +9593) ferrites (added plural) +9594) ferritic +9595) martensite (+ic) +9596) martempering +9597) martempered +9598) martellato +9599) Martello (+plural) +9600) Napoleonism +9601) Napoleonically +9602) Napoleonist +9603) outrightly +9604) cutie (+plural - Oxford: informal) +9605) Marilyn's (added the 's - name - Wikipedia) +9606) geniculate +9607) antennule (+plural) +9608) concavo-convex +9609) prosome +9610) copepod (+plural) +9611) mantid (+plural) +9612) prothorax +9613) prothoracic +9614) prothonotaryship +9615) protonotary + prothonotary (+plural of both) +9616) protonosphere +9617) geocorona +9618) geocoronal +9619) geocratic +9620) geocyclic +9621) cadastral +9622) occurrent +9623) Washingtonian (+plural) +9624) Washingtonologist +9625) IPs (added plural - Wiktionary) +9626) homepage's (added the 's - Wikipedia) +9627) telepathing + telepathed (merged into telepath - Wiktionary) +9628) interdimensional (Wiktionary) +9629) Carrolton (name of place - Wikipedia) +9630) Galactica (+'s - name of TV series - Wikipedia) +9631) Okrand (+'s - name - Wikipedia) +9632) Ragnar (+'s - name - Wikipedia) +9633) Redbeard (+'s - name - Wikipedia) +9634) Kristy (+'s - name - Wikipedia) +9635) Schulman (+'s - name - Wikipedia) +9636) adverted + adverting (merged into advert) +9637) aftertaste (fixed: after-taste) +9638) albedos (added plural) +9639) aldehydes (added plural) +9640) Angelus + angelus +9641) Angelou (+'s - name - Wikipedia) +9642) Corbin (+'s - name - Wikipedia) +9643) apostolate (+plural) +9644) charism (+plural) +9645) constraining (merged into constrain) +9646) Smithers (+'s - name - Wikipedia) +9647) Dostoyevsky (+'s - name - Wikipedia) +9648) fusionist (+plural) +9649) fusionism +9650) Greenock (+'s - name - Wikipedia) +9651) Crawfurd (+'s - name - Wikipedia) +9652) Gourock (+'s - name - Wikipedia) +9653) greenlet +9654) greenless +9655) Greenlandman +9656) Greenlandish +9657) Greenlander (+plural) +9658) greenlandite + greenlandit +9659) mezzotint (+s +ing +ed +er +ers) +9660) Morland (+'s - name - Wikipedia) +9661) Glenn's (added the 's - name - Wikipedia) +9662) STI (+plural - Abbreviation: sexually transmitted infection) +9663) papillomavirus +9664) protozoal +9665) protozoon (joined with protozoon's) +9666) ureaplasma (+plural) +9667) mycoplasma (+plural) +9668) mycoplasmata (another plural of previous word) +9669) metronidazole +9670) polyisoprene +9671) isoprene +9672) presymptomatic (Collins) +9673) Salvarsan +9674) arsphenamine +9675) apple-cart (removed, Oxford says it is two words) +9676) auricula (+plural) +9677) avens +9678) Ayurveda +9679) Ayurvedic +9680) backbeat (+plural) +9681) balustraded +9682) baptize (+s +ing +ed - IZE) +9683) birching + birched (merged into birch) +9684) biscuity +9685) blackshirt (+plural - added lowercase) +9686) Jabotinsky (+'s - name - Wikipedia) +9687) Lisa's (added the 's - name - Wikipedia) +9688) Clarkson (+'s - name - Wikipedia) +9689) Dara (+'s - name - Wikipedia) +9690) Christiansen's (added the 's - name - Wikipedia) +9691) kick-boxing +9692) nutraceutical (+plural) +9693) neurobiological +9694) neurobiologist (+plural) +9695) neurobiochemistry +9696) neurobics +9697) neurobehavioural +9698) psychopharmacology +9699) psychopharmacological +9700) psychopharmacologist (+plural) +9701) Enigmail (+'s - name of Mozilla add-on) +9702) misenter (+s +ing +ed - Wiktionary) +9703) Canute (+'s - name - Wikipedia) +9704) rewrap (+s +ing +ed) +9705) logfile (+plural - Wiktionary) +9706) Josie (+'s - name - Wikipedia) +9707) posey (+ier +iest - Oxford: informal) +9708) mag (+plural - Oxford: informal) +9709) mimeo +9710) Berrigan (+'s - name - Wikipedia) +9711) detachability +9712) performative (+plural) +9713) performativity +9714) constative (+plural) +9715) polysiloxane +9716) phenylmethyl (Collins) +9717) GUI's (added the 's - Wikipedia) +9718) rebuffer (+s +ing +ed - Wiktionary) +9719) upsample (+s +ing +ed - Wiktionary) +9720) blockiness (Collins) +9721) Netflix’s (added the 's) +9722) downsample (+s +ing +ed - Wiktionary) +9723) choosable (Wiktionary) +9724) bootboy (+plural) +9725) bootie (added singular) +9726) outsole (+plural) +9727) Thinsulate (Oxford: trademark) +9728) minibreak (+plural) +9729) NASCAR (abbreviation: National Association for Stock Car Auto Racing) +9730) minicell +9731) minicar (+plural) +9732) minichain +9733) minichromosome +9734) minicircle +9735) kinetoplast (+plural) +9736) kinetoscope (+plural) +9737) Leysdown (Wikipedia - name of place) +9738) unrefuted +9739) microscopists (added plural) +9740) photocycle +9741) reorganizational +9742) reorganizationist +9743) reovirus +9744) enteric +9745) ante-mortem +9746) mediastinum +9747) mediastina (plural of previous word) +9748) mediastinal +9749) mediastinoscopy +9750) prereform +9751) postreform (Wiktionary) +9752) tragical +9753) bathypelagic +9754) octopod (+plural) +9755) blastocyst (+plural) +9756) blastula +9757) blastulae (plural of previous word) +9758) denticulation (+plural) +9759) septal +9760) atrioventricular +9761) endocardial +9762) parapophysis +9763) parapolitical +9764) parapolar +9765) parapod +9766) iOS's (added the 's - Wikipedia) +9767) polyamine +9768) polyamidation +9769) polyamide (+plural) +9770) adipic (adipic acid) +9771) adipoceration +9772) adipocere +9773) hypotensive +9774) normotensive +9775) vagus +9776) vagi (plural of previous word) +9777) ventifact (+plural) +9778) erraticism +9779) speech-making +9780) speech-maker (+plural) +9781) countermark (added +s +ing +ed) +9782) sublibrary (+plural - Wiktionary) +9783) subrectangular (Wiktionary) +9784) subsensible (Collins) +9785) suboption (+plural - Wiktionary) +9786) suborganization (+plural - Collins - IZE) +9787) suborganisation (+plural - Collins - ISE) +9788) suboval +9789) subovoid +9790) suboptimum +9791) suboperation (+plural - Wiktionary) +9792) Ascher (+'s - name - Wikipedia) +9793) Plohman (name - Wikipedia) +9794) Gervase (+'s - name - Wikipedia) +9795) Phipps (+'s - name - Wikipedia) +9796) PEP (+plural +'s - abbreviation: Political and Economic Planning) +9797) penectomy +9798) orchiectomy (+plural - Collins) +9799) orchidectomy (+plural - Collins) +9800) curette (+s +ing +ed) +9801) electrodesiccation +9802) osteotome (+plural) +9803) cerumen +9804) zoster (herpes zoster) +9805) photosensitivity +9806) urticaria +9807) omeprazole +9808) bing +9809) Bing (Microsoft) +9810) OneDrive (Microsoft) +9811) Silverlight (Microsoft) +9812) subparagraph (+plural - Collins) +9813) sublicensee (+plural - Wiktionary) +9814) sublicenses (added plural) +9815) Satya (+'s - name - Wikipedia) +9816) Nadella (+'s - name - Wikipedia) +9817) MSDN (Microsoft) +9818) Altair (+'s - name - Wikipedia) +9819) Bellevue (+'s - name - Wikipedia) +9820) rebrands + rebranded (merged into rebrand) +9821) Gates (+'s - name - Wikipedia) +9822) Ballmer (+'s - name - Wikipedia) +9823) Gartner (+'s - name - Wikipedia) +9824) CE +9825) Ce +9826) Klawe (+'s - name - Wikipedia) +9827) Moody (+'s - name - Wikipedia) +9828) write-down (+plural) +9829) TCO (abbreviation: Total cost of Ownership) +9830) videocasts (added plural) +9831) Issaquah (+'s - name - Wikipedia) +9832) anglicized + anglicised (fixed: it was in uppercase) +9833) Gilman (+'s - name - Wikipedia) +9834) regauge (+s +ing +ed) +9835) Sammamish (+'s - name - Wikipedia) +9836) regelate (+ed +ion) +9837) calorifically +9838) smokelessly +9839) tostada + tostado (+plural of both) +9840) tosylate (+plural) +9841) nonactivated (Collins) +9842) adrenergic +9843) histaminic +9844) muscarinic +9845) hyperreactivity (Collins) +9846) submucosal +9847) muscularis +9848) tunica +9849) tunicae (plural of previous word) +9850) insectile +9851) insectarium + insectary (+plural of both) +9852) avicularium +9853) avicularia (plural of previous word) +9854) Earlybird (Mozilla) +9855) woodman + woodmen +9856) woodsmoke +9857) workless (+ness) +9858) Wordsworthiana +9859) workpieces (added plural) +9860) bowie (+plural) +9861) bradycardia +9862) caliper (+plural) +9863) caparisoned +9864) carabiniere +9865) carabinieri (plural of previous word) +9866) carboxyl + carboxy +9867) casuals (added plural) +9868) catheterization (-IZE) +9869) catheterisation (-ISE) +9870) bacteriuria +9871) prostatitis +9872) pyelonephritis +9873) pyelonephritic +9874) pyuria +9875) haematuria +9876) cedarwood (Collins) +9877) ceilidhs (added plural) +9878) celeriac +9879) VLC (+'s - name of software) +9880) bidimensional (Wiktionary) +9881) tridimensional (Collins) +9882) four-dimensional +9883) coromandel +9884) lacquerware +9885) lacquerwork +9886) japan (+s +ing +ed - noun + verb) +9887) Jap (+plural - offensive - short for Japanese - Wiktionary) +9888) arse-licking (vulgar slang) +9889) arse-licker (vulgar slang) +9890) postlanding (Collins) +9891) beanfeast (+plural) +9892) believingly +9893) freezingly (Collins) +9894) bobbish (Collins - slang) +9895) breaktime (Collins) +9896) nanofibre (+plural) +9897) oxysulphide +9898) cashpoint (+plural) +9899) classmanship +9900) clicket (Collins) +9901) clubbable +9902) clubbability +9903) costermonger (+plural) +9904) cream-crackered +9905) decenary + decinary + decennary +9906) declinatory +9907) eyeable +9908) faceache (Oxford: informal) +9909) fandabidozi (Collins) +9910) Fenian (+plural) +9911) Fenianism +9912) fibrescope (+plural) +9913) flasket (Collins) +9914) flaysome (Collins) +9915) flyman +9916) flymen (plural of previous word) +9917) foretop (+plural) +9918) forjudge + forejudge +9919) formularise (+s +ing +ed) +9920) forspeak (Collins) +9921) freeload (+s +ing +ed +er +ers) +9922) fundholder (added singular) +9923) garibaldi (+plural) +9924) gastropub (+plural) +9925) gemminess +9926) gyratory (+plural) +9927) elevatory +9928) incubatory +9929) modificatory +9930) pulsatory +9931) clarificatory +9932) denigratory +9933) Obi (+'s - name - Wikipedia) +9934) Obi-Wan (+'s - name - Wikipedia) +9935) Kenobi (+'s - name - Wikipedia) +9936) Anakin (+'s - name - Wikipedia) +9937) Skywalker (+'s - name - Wikipedia) +9938) Jedi (+plural +'s) +9939) Sith (+'s - name - Wikipedia) +9940) McCallum (+'s - name - Wikipedia) +9941) Ewan (+'s - name - Wikipedia) +9942) Portman (+'s - name - Wikipedia) +9943) McDiarmid (+'s - name - Wikipedia) +9944) Lucasfilm (+'s - name - Wikipedia) +9945) workprint +9946) lightsaber (+plural) +9947) Coruscant (+'s - name - Wikipedia) +9948) Palpatine (+'s - name - Wikipedia) +9949) Padmé (+'s - name - Wikipedia) +9950) Colton (+'s - name - Wikipedia) +9951) Chewbacca (+'s - name - Wikipedia) +9952) Kamino (+'s - name - Wikipedia) +9953) refilm (+s +ing +ed - Wiktionary) +9954) animatic (+plural) +9955) pre-visualize + previsualise + previsualize +9956) Shepperton (+'s - name - Wikipedia) +9957) Elstree (+'s - name - Wikipedia) +9958) armlock (+plural) +9959) Gillard (+'s - name - Wikipedia) +9960) Oldman (+'s - name - Wikipedia) +9961) Smithee (+'s - name - Wikipedia) +9962) Grauman (+'s - name - Wikipedia) +9963) Rosenbaum (+'s - name - Wikipedia) +9964) outgross (+s +ing +ed) +9965) Narnia (+'s - name - Wikipedia) +9966) Elsey (+'s - name - Wikipedia) +9967) Gooley (+'s - name - Wikipedia) +9968) Razzie (+'s - name - Wikipedia) +9969) Windu (+'s - name - Wikipedia) +9970) Sidious (+'s - name - Wikipedia) +9971) Leia (+'s - name - Wikipedia) +9972) Han (+'s - name - Wikipedia) +9973) Jaina (+'s - name - Wikipedia) +9974) provene +9975) Bridger (+'s - name - Wikipedia) +9976) Katarn (+'s - name - Wikipedia) +9977) Qui-Gon (+'s - name - Wikipedia) +9978) Organa (+'s - name - Wikipedia) +9979) Jacen (+'s - name - Wikipedia) +9980) unlogical (Wiktionary) +9981) Twichell (+'s - name - Wikipedia) +9982) Corso (+'s - name - Wikipedia) +9983) McKinnon (+'s - name - Wikipedia) +9984) Tomkins (+'s - name - Wikipedia) +9985) Puckett (+'s - name - Wikipedia) +9986) Elmwood (+'s - name - Wikipedia) +9987) Medford (+'s - name - Wikipedia) +9988) Georgie (+'s - name - Wikipedia) +9989) Pedrick (+'s - name - Wikipedia) +9990) Bucksch (name - Wikipedia) +9991) Koelmeyer (name - Wikipedia) +9992) Grandon (+'s - name - Wikipedia) +9993) rammelly + rambly +9994) Fernhout (name - Wikipedia) +9995) xlsx +9996) UX (abbreviation: user experience) +9997) uxoricide +9998) uxoricidal +9999) uxoriously +10000) uxoriousness +10001) uxorilocal +10002) matrilocal +10003) matrilocality =================================================== en_NZ: I. Copyright diff --git a/runtime/spell/br/main.aap b/runtime/spell/br/main.aap index 75035be037..8f6040e063 100644 --- a/runtime/spell/br/main.aap +++ b/runtime/spell/br/main.aap @@ -25,16 +25,16 @@ $SPELLDIR/br.utf-8.spl : $FILES # # Fetching the files from OpenOffice.org. # -OODIR = http://extensions.libreoffice.org/extension-center/an-drouizig-breton-spellchecker/releases/0.11/ -:attr {fetch = $OODIR/%file%} dict-br-0.11.oxt +OODIR = http://extensions.libreoffice.org/extension-center/an-drouizig-breton-spellchecker/releases/0.13/ +:attr {fetch = $OODIR/%file%} difazier-an-drouizig-0_13.oxt # The files don't depend on the .zip file so that we can delete it. # Only download the zip file if the targets don't exist. br_FR.aff br_FR.dic: {buildcheck=} :assertpkg unzip patch - :fetch dict-br-0.11.oxt - :sys $UNZIP dict-br-0.11.oxt - :delete dict-br-0.11.oxt + :fetch difazier-an-drouizig-0_13.oxt + :sys $UNZIP difazier-an-drouizig-0_13.oxt + :delete difazier-an-drouizig-0_13.oxt :copy dictionaries/br_FR.aff br_FR.aff :copy dictionaries/br_FR.dic br_FR.dic # The br_FR.aff file contains a BOM, remove it. @@ -65,12 +65,12 @@ diff: check: :assertpkg unzip diff - :fetch dict-br-0.11.oxt + :fetch difazier-an-drouizig-0_13.oxt :mkdir tmp :cd tmp @try: @import stat - :sys $UNZIP ../dict-br-0.11.oxt + :sys $UNZIP ../difazier-an-drouizig-0_13.oxt :sys {force} diff ../dictionaries/br_FR.aff br_FR.aff >d @if os.stat('d')[stat.ST_SIZE] > 0: :copy br_FR.aff ../br_FR.new.aff @@ -80,7 +80,7 @@ check: @finally: :cd .. :delete {r}{f}{q} tmp - :delete dict-br-0.11.oxt + :delete difazier-an-drouizig-0_13.oxt # vim: set sts=4 sw=4 : diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl index b0735c61b9..a303b75e65 100644 Binary files a/runtime/spell/en.ascii.spl and b/runtime/spell/en.ascii.spl differ diff --git a/runtime/spell/en.ascii.sug b/runtime/spell/en.ascii.sug index cede5c7b52..22d27e213a 100644 Binary files a/runtime/spell/en.ascii.sug and b/runtime/spell/en.ascii.sug differ diff --git a/runtime/spell/en.latin1.spl b/runtime/spell/en.latin1.spl index d24b79024a..5ee18bd817 100644 Binary files a/runtime/spell/en.latin1.spl and b/runtime/spell/en.latin1.spl differ diff --git a/runtime/spell/en.latin1.sug b/runtime/spell/en.latin1.sug index e4800bf467..4a883be19d 100644 Binary files a/runtime/spell/en.latin1.sug and b/runtime/spell/en.latin1.sug differ diff --git a/runtime/spell/en.utf-8.spl b/runtime/spell/en.utf-8.spl index 1a39de145c..e4b1e1cce7 100644 Binary files a/runtime/spell/en.utf-8.spl and b/runtime/spell/en.utf-8.spl differ diff --git a/runtime/spell/en.utf-8.sug b/runtime/spell/en.utf-8.sug index 1add0c6b0c..103ebfc8d5 100644 Binary files a/runtime/spell/en.utf-8.sug and b/runtime/spell/en.utf-8.sug differ diff --git a/runtime/spell/en/en_AU.diff b/runtime/spell/en/en_AU.diff index 5dddb4797c..96a52a32c9 100644 --- a/runtime/spell/en/en_AU.diff +++ b/runtime/spell/en/en_AU.diff @@ -1,5 +1,5 @@ -*** en_AU.orig.aff Fri Apr 15 13:20:36 2005 ---- en_AU.aff Wed Jan 11 11:10:45 2006 +*** en_AU.orig.aff 2010-05-15 13:03:47.000000000 +0200 +--- en_AU.aff 2016-01-09 13:15:38.426627871 +0100 *************** *** 7,9 **** SET ISO8859-1 @@ -16,7 +16,7 @@ ! MIDWORD ' ! ! RARE ? -! BAD ! +! BAD % ! ! MAP 9 ! MAP a @@ -148,7 +148,8 @@ ! REP 24 *************** -*** 34,53 **** +*** 33,53 **** + REP ght t PFX A Y 2 ! PFX A 0 re [^e] ! PFX A 0 re- e @@ -169,7 +170,25 @@ PFX E Y 1 ! PFX E 0 dis . PFX F Y 5 ---- 172,191 ---- +--- 171,208 ---- + REP ght t ++ ++ # This is disabled, because if Vim does not support NOCOMPOUNDSUGS giving ++ # suggestions is extremely slow. ++ ## ordinal numbers ++ #COMPOUNDMIN 1 ++ ## only in compounds: 1th, 2th, 3th ++ #ONLYINCOMPOUND , ++ ## compound rules: ++ ## 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) ++ ## 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) ++ #COMPOUNDRULE 2 ++ #COMPOUNDRULE (*:) ++ #COMPOUNDRULE (*{} ++ #NOCOMPOUNDSUGS ++ ++ # WORDCHARS 0123456789 ++ PFX A Y 2 ! PFX A 0 re [^e] ! PFX A 0 re- e @@ -587,7 +606,7 @@ SFX T y iest [^aeiou]y ! SFX T 0 er [aeiou]y SFX T 0 est [aeiou]y ---- 195,589 ---- +--- 212,606 ---- PFX F 0 col l ! PFX F 0 con [^abehilmopru]. PFX K Y 1 @@ -1671,7 +1690,7 @@ ! SFX 3 0 ist's [aeioubp]y ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] ---- 596,1305 ---- +--- 613,1322 ---- SFX R Y 72 ! SFX R 0 r e ! SFX R 0 rs e @@ -2382,21 +2401,31 @@ ! ! # a few more for consistency ! COMMON five six seven eight nine ten hundred thousand -*** en_AU.orig.dic Fri Apr 15 13:20:36 2005 ---- en_AU.dic Wed Mar 8 13:14:30 2006 +*** en_AU.orig.dic 2010-05-15 13:03:48.000000000 +0200 +--- en_AU.dic 2016-01-08 23:03:18.342461841 +0100 *************** *** 1,2 **** ! 45654 AA ---- 1,2 ---- +--- 1,12 ---- ! 45653 +! 0th +! 1st +! 2nd +! 3rd +! 4th +! 5th +! 6th +! 7th +! 8th +! 9th AA *************** *** 912,914 **** Alaska/M ! al/AY albacore/MS ---- 912,914 ---- +--- 922,924 ---- Alaska/M ! really albacore/MS @@ -2405,10 +2434,10 @@ bozo/SM - b/pb bpi ---- 4885,4886 ---- +--- 4895,4896 ---- *************** *** 4921,4922 **** ---- 4920,4922 ---- +--- 4930,4932 ---- Brahms + Bram/M braid/DGS @@ -2417,22 +2446,22 @@ cad/ZSM - c/aE CAE ---- 5753,5754 ---- +--- 5763,5764 ---- *************** *** 8535,8537 **** coniferous - conj conjectural ---- 8534,8535 ---- +--- 8544,8545 ---- *************** *** 8544,8545 **** ---- 8542,8544 ---- +--- 8552,8554 ---- conjunctiva/MS + conj. conjunctive/S *************** *** 10288,10289 **** ---- 10287,10291 ---- +--- 10297,10301 ---- dB/M + dBi + dBm @@ -2443,10 +2472,10 @@ DNA - d/o DOB ---- 11783,11784 ---- +--- 11793,11794 ---- *************** *** 12468,12469 **** ---- 12469,12471 ---- +--- 12479,12481 ---- Dutch/5m + Farsi Dutchwomen/M @@ -2455,19 +2484,19 @@ dystrophy/M - e ea ---- 12518,12519 ---- +--- 12528,12529 ---- *************** *** 12792,12794 **** e.g. - e.g.. egad ---- 12793,12794 ---- +--- 12803,12804 ---- *************** *** 13779,13781 **** estuary/MS ! et ETA ---- 13779,13782 ---- +--- 13789,13792 ---- estuary/MS ! et cetera ! et al. @@ -2477,7 +2506,7 @@ fjord/SM ! f/K flab/2zZM ---- 15297,15299 ---- +--- 15307,15309 ---- fjord/SM ! pref flab/2zZM @@ -2486,19 +2515,19 @@ FYI - g/7 gabardine/SM ---- 16481,16482 ---- +--- 16491,16492 ---- *************** *** 18599,18601 **** HDTV - h/E headache/SM ---- 18599,18600 ---- +--- 18609,18610 ---- *************** *** 19214,19216 **** Hobbes ! hobbit hobble/RGSD ---- 19213,19215 ---- +--- 19223,19225 ---- Hobbes ! hobbit/MS hobble/RGSD @@ -2507,34 +2536,34 @@ jive/DSMG - j/k jnr. ---- 21790,21791 ---- +--- 21800,21801 ---- *************** *** 22125,22127 **** kcal - k/E Keane ---- 22123,22124 ---- +--- 22133,22134 ---- *************** *** 22606,22608 **** Kyushu/M - l/3 label/AGaSD ---- 22603,22604 ---- +--- 22613,22614 ---- *************** *** 22885,22887 **** lass/SM - last-ditch lasted/e ---- 22881,22882 ---- +--- 22891,22892 ---- *************** *** 22890,22892 **** last/kJYDSG - last-minute lasts/e ---- 22885,22886 ---- +--- 22895,22896 ---- *************** *** 26417,26418 **** ---- 26411,26413 ---- +--- 26421,26423 ---- Moolawatana + Moolenaar/M Moomba @@ -2545,7 +2574,7 @@ nationhood/M ! nation/M nationwide ---- 27183,27187 ---- +--- 27193,27197 ---- nationals/4 ! national/sQq3SZ nationhood/M @@ -2553,7 +2582,7 @@ nationwide *************** *** 27194,27195 **** ---- 27189,27192 ---- +--- 27199,27202 ---- nativity/MS + natively + nativeness @@ -2563,28 +2592,28 @@ nuzzle/SDG - n/xvuNVn Nyah ---- 28362,28363 ---- +--- 28372,28373 ---- *************** *** 29464,29466 **** oz - o/z Ozark/MS ---- 29460,29461 ---- +--- 29470,29471 ---- *************** *** 31035,31037 **** Pk - p/KF pl. ---- 31030,31031 ---- +--- 31040,31041 ---- *************** *** 31288,31289 **** ---- 31282,31284 ---- +--- 31292,31294 ---- pneumonia/MS + pneumonic PO *************** *** 31460,31461 **** ---- 31455,31457 ---- +--- 31465,31467 ---- pompom/MS + pompon/M pomposity/MS @@ -2593,25 +2622,25 @@ pyx/S - q Qatar ---- 32861,32862 ---- +--- 32871,32872 ---- *************** *** 33378,33380 **** razzmatazz - r/d Rd/M ---- 33373,33374 ---- +--- 33383,33384 ---- *************** *** 34979,34981 **** RSPCA - rte rub-a-dub ---- 34973,34974 ---- +--- 34983,34984 ---- *************** *** 36012,36014 **** sec. ! s/eca secant/MS ---- 36005,36007 ---- +--- 36015,36017 ---- sec. ! outs secant/MS @@ -2620,7 +2649,7 @@ Szechwan/M ! t/7k Ta ---- 40235,40237 ---- +--- 40245,40247 ---- Szechwan/M ! tingly Ta @@ -2629,10 +2658,10 @@ Tyson/M - u ubiquitousness ---- 42609,42610 ---- +--- 42619,42620 ---- *************** *** 42990,42991 **** ---- 42982,42984 ---- +--- 42992,42994 ---- unscrupulous + searchable unsearchable @@ -2641,13 +2670,13 @@ Uzi/M - v vacancy/MS ---- 43245,43246 ---- +--- 43255,43256 ---- *************** *** 43749,43751 **** Vilnius/M ! vim/M vinaigrette/MS ---- 43741,43744 ---- +--- 43751,43754 ---- Vilnius/M ! Vim/M ! vim/? @@ -2657,24 +2686,28 @@ yippee - y/K YMCA ---- 45487,45488 ---- +--- 45497,45498 ---- *************** *** 45586,45588 **** zap/SGRD - z/d Zealanders ---- 45578,45579 ---- +--- 45588,45589 ---- *************** *** 45655 **** ---- 45646,45656 ---- +--- 45656,45670 ---- zymurgy/S + nd -+ the the/! -+ and and/! -+ a a/! -+ a an/! -+ an a/! -+ an an/! + PayPal + Google + TCP\/IP ++ a a/% ++ a an/% ++ a the/% ++ an a/% ++ an an/% ++ an the/% ++ and and/% ++ the a/% ++ the an/% ++ the the/% diff --git a/runtime/spell/en/en_CA.diff b/runtime/spell/en/en_CA.diff index d9995710b1..7b3f003b77 100644 --- a/runtime/spell/en/en_CA.diff +++ b/runtime/spell/en/en_CA.diff @@ -1,459 +1,238 @@ -*** en_CA.orig.aff Fri Apr 15 13:20:36 2005 ---- en_CA.aff Wed Jan 11 22:03:23 2006 -*************** -*** 3,4 **** ---- 3,141 ---- +*** en_CA.orig.aff 2015-12-30 18:18:20.076952127 +0100 +--- en_CA.aff 2016-01-09 13:15:51.306488848 +0100 +*************** +*** 2,18 **** + TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' +! ICONV 1 +! ICONV ’ ' + NOSUGGEST ! -+ FOL -+ LOW -+ UPP -+ -+ MIDWORD ' -+ -+ RARE ? -+ BAD ! -+ -+ MAP 9 -+ MAP a -+ MAP e -+ MAP i -+ MAP o -+ MAP u -+ MAP n -+ MAP c -+ MAP y -+ MAP s -+ -+ # This comes from Aspell en_phonet.dat, version 1.1, 2000-01-07 -+ -+ SAL AH(AEIOUY)-^ *H -+ SAL AR(AEIOUY)-^ *R -+ SAL A(HR)^ * -+ SAL A^ * -+ SAL AH(AEIOUY)- H -+ SAL AR(AEIOUY)- R -+ SAL A(HR) _ -+ SAL ^ * -+ SAL ^ * -+ SAL BB- _ -+ SAL B B -+ SAL CQ- _ -+ SAL CIA X -+ SAL CH X -+ SAL C(EIY)- S -+ SAL CK K -+ SAL COUGH^ KF -+ SAL CC< C -+ SAL C K -+ SAL DG(EIY) K -+ SAL DD- _ -+ SAL D T -+ SAL < E -+ SAL EH(AEIOUY)-^ *H -+ SAL ER(AEIOUY)-^ *R -+ SAL E(HR)^ * -+ SAL ENOUGH^$ *NF -+ SAL E^ * -+ SAL EH(AEIOUY)- H -+ SAL ER(AEIOUY)- R -+ SAL E(HR) _ -+ SAL FF- _ -+ SAL F F -+ SAL GN^ N -+ SAL GN$ N -+ SAL GNS$ NS -+ SAL GNED$ N -+ SAL GH(AEIOUY)- K -+ SAL GH _ -+ SAL GG9 K -+ SAL G K -+ SAL H H -+ SAL IH(AEIOUY)-^ *H -+ SAL IR(AEIOUY)-^ *R -+ SAL I(HR)^ * -+ SAL I^ * -+ SAL ING6 N -+ SAL IH(AEIOUY)- H -+ SAL IR(AEIOUY)- R -+ SAL I(HR) _ -+ SAL J K -+ SAL KN^ N -+ SAL KK- _ -+ SAL K K -+ SAL LAUGH^ LF -+ SAL LL- _ -+ SAL L L -+ SAL MB$ M -+ SAL MM M -+ SAL M M -+ SAL NN- _ -+ SAL N N -+ SAL OH(AEIOUY)-^ *H -+ SAL OR(AEIOUY)-^ *R -+ SAL O(HR)^ * -+ SAL O^ * -+ SAL OH(AEIOUY)- H -+ SAL OR(AEIOUY)- R -+ SAL O(HR) _ -+ SAL PH F -+ SAL PN^ N -+ SAL PP- _ -+ SAL P P -+ SAL Q K -+ SAL RH^ R -+ SAL ROUGH^ RF -+ SAL RR- _ -+ SAL R R -+ SAL SCH(EOU)- SK -+ SAL SC(IEY)- S -+ SAL SH X -+ SAL SI(AO)- X -+ SAL SS- _ -+ SAL S S -+ SAL TI(AO)- X -+ SAL TH @ -+ SAL TCH-- _ -+ SAL TOUGH^ TF -+ SAL TT- _ -+ SAL T T -+ SAL UH(AEIOUY)-^ *H -+ SAL UR(AEIOUY)-^ *R -+ SAL U(HR)^ * -+ SAL U^ * -+ SAL UH(AEIOUY)- H -+ SAL UR(AEIOUY)- R -+ SAL U(HR) _ -+ SAL V^ W -+ SAL V F -+ SAL WR^ R -+ SAL WH^ W -+ SAL W(AEIOU)- W -+ SAL X^ S -+ SAL X KS -+ SAL Y(AEIOU)- Y -+ SAL ZZ- _ -+ SAL Z S -+ -+ # When soundfolding "th" is turned into "@". When this is mistyped as "ht" it -+ # soundfolds to "ht". This difference is too big, thus use REP items to lower -+ # the score. -+ REPSAL 2 -+ REPSAL ht @ -+ REPSAL @ ht -+ - PFX A Y 1 -*************** -*** 30,33 **** - SFX N e ion e -! SFX N y ication y -! SFX N 0 en [^ey] +! # ordinal numbers +! COMPOUNDMIN 1 +! # only in compounds: 1th, 2th, 3th +! ONLYINCOMPOUND c +! # compound rules: +! # 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) +! # 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) +! COMPOUNDRULE 2 +! COMPOUNDRULE n*1t +! COMPOUNDRULE n*mp +! WORDCHARS 0123456789 ---- 167,170 ---- - SFX N e ion e -! SFX N y ication y -! SFX N 0 en [^ey] +--- 2,161 ---- + TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' +! +! # ICONV 1 +! # ICONV ’ ' +! + NOSUGGEST ! -*************** -*** 40,42 **** - SFX H y ieth y -! SFX H 0 th [^y] +! FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ +! LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ +! UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ +! +! MIDWORD ' +! +! RARE ? +! BAD % +! +! MAP 9 +! MAP aàáâãäå +! MAP eèéêë +! MAP iìíîï +! MAP oòóôõö +! MAP uùúûü +! MAP nñ +! MAP cç +! MAP yÿý +! MAP sß +! +! # This comes from Aspell en_phonet.dat, version 1.1, 2000-01-07 +! +! SAL AH(AEIOUY)-^ *H +! SAL AR(AEIOUY)-^ *R +! SAL A(HR)^ * +! SAL A^ * +! SAL AH(AEIOUY)- H +! SAL AR(AEIOUY)- R +! SAL A(HR) _ +! SAL À^ * +! SAL Å^ * +! SAL BB- _ +! SAL B B +! SAL CQ- _ +! SAL CIA X +! SAL CH X +! SAL C(EIY)- S +! SAL CK K +! SAL COUGH^ KF +! SAL CC< C +! SAL C K +! SAL DG(EIY) K +! SAL DD- _ +! SAL D T +! SAL É< E +! SAL EH(AEIOUY)-^ *H +! SAL ER(AEIOUY)-^ *R +! SAL E(HR)^ * +! SAL ENOUGH^$ *NF +! SAL E^ * +! SAL EH(AEIOUY)- H +! SAL ER(AEIOUY)- R +! SAL E(HR) _ +! SAL FF- _ +! SAL F F +! SAL GN^ N +! SAL GN$ N +! SAL GNS$ NS +! SAL GNED$ N +! SAL GH(AEIOUY)- K +! SAL GH _ +! SAL GG9 K +! SAL G K +! SAL H H +! SAL IH(AEIOUY)-^ *H +! SAL IR(AEIOUY)-^ *R +! SAL I(HR)^ * +! SAL I^ * +! SAL ING6 N +! SAL IH(AEIOUY)- H +! SAL IR(AEIOUY)- R +! SAL I(HR) _ +! SAL J K +! SAL KN^ N +! SAL KK- _ +! SAL K K +! SAL LAUGH^ LF +! SAL LL- _ +! SAL L L +! SAL MB$ M +! SAL MM M +! SAL M M +! SAL NN- _ +! SAL N N +! SAL OH(AEIOUY)-^ *H +! SAL OR(AEIOUY)-^ *R +! SAL O(HR)^ * +! SAL O^ * +! SAL OH(AEIOUY)- H +! SAL OR(AEIOUY)- R +! SAL O(HR) _ +! SAL PH F +! SAL PN^ N +! SAL PP- _ +! SAL P P +! SAL Q K +! SAL RH^ R +! SAL ROUGH^ RF +! SAL RR- _ +! SAL R R +! SAL SCH(EOU)- SK +! SAL SC(IEY)- S +! SAL SH X +! SAL SI(AO)- X +! SAL SS- _ +! SAL S S +! SAL TI(AO)- X +! SAL TH @ +! SAL TCH-- _ +! SAL TOUGH^ TF +! SAL TT- _ +! SAL T T +! SAL UH(AEIOUY)-^ *H +! SAL UR(AEIOUY)-^ *R +! SAL U(HR)^ * +! SAL U^ * +! SAL UH(AEIOUY)- H +! SAL UR(AEIOUY)- R +! SAL U(HR) _ +! SAL V^ W +! SAL V F +! SAL WR^ R +! SAL WH^ W +! SAL W(AEIOU)- W +! SAL X^ S +! SAL X KS +! SAL Y(AEIOU)- Y +! SAL ZZ- _ +! SAL Z S +! +! # When soundfolding "th" is turned into "@". When this is mistyped as "ht" it +! # soundfolds to "ht". This difference is too big, thus use REP items to lower +! # the score. +! REPSAL 2 +! REPSAL ht @ +! REPSAL @ ht +! +! # This is disabled, because if Vim does not support NOCOMPOUNDSUGS giving +! # suggestions is extremely slow. +! ## ordinal numbers +! #COMPOUNDMIN 1 +! ## only in compounds: 1th, 2th, 3th +! #ONLYINCOMPOUND c +! ## compound rules: +! ## 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) +! ## 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) +! #COMPOUNDRULE 2 +! #COMPOUNDRULE n*1t +! #COMPOUNDRULE n*mp +! #NOCOMPOUNDSUGS +! +! # WORDCHARS 0123456789 ---- 177,179 ---- - SFX H y ieth y -! SFX H 0 th [^y] - -*************** -*** 47,49 **** - SFX G e ing e -! SFX G 0 ing [^e] - ---- 184,186 ---- - SFX G e ing e -! SFX G 0 ing [^e] - -*** en_CA.orig.dic Sat Apr 16 14:40:06 2005 ---- en_CA.dic Wed Mar 8 13:14:35 2006 -*************** -*** 46,48 **** - R/G -- S - easternmost ---- 46,47 ---- -*************** -*** 59,66 **** - a -! b/KGDT - Emmey/M - baggagemen -! c/EAS - antimalarial/S -- d/AMV - enveloper/M ---- 58,65 ---- - a -! probing -! probed - Emmey/M - baggagemen -! recs - antimalarial/S - enveloper/M -*************** -*** 68,98 **** - Balearic/M -! e/FDSM -! f/BVXT - Karamazov/M -! g/VXB -! h/VEMS -! i - Braille/DSGM -- j/FTV - transceiver/MS -! k/FGISE - promising/YU -! l/XTJGV - Emmet/M -! m/XG -! n/FKT -! o - xviii - fitting/PSY -! p/KRT -! q -! r/GVTJ -! s/FK - fatting -! t/BGXTJ - Franciska/M - oedipal -! u -! v/VTK -! w/JXTGV - youths ---- 67,94 ---- - Balearic/M -! fens - Karamazov/M -! gens - Braille/DSGM - transceiver/MS -! inking -! disking -! conking -! inks -! disks -! conks - promising/YU -! lings - Emmet/M -! ming -! pron - xviii - fitting/PSY -! cons - fatting -! tings - Franciska/M - oedipal -! vive -! wens -! wings - youths -*************** -*** 100,103 **** - x -! y/F -! z/JGT - crumby/RT ---- 96,98 ---- - x -! zings - crumby/RT -*************** -*** 714,715 **** ---- 709,711 ---- - silty/RT -+ conj. - conjectural/Y -*************** -*** 3145,3146 **** ---- 3141,3143 ---- - semester/MS -+ etc. - etch/GZSRDJ -*************** -*** 6190,6191 **** ---- 6187,6190 ---- - Paula/M -+ coned -+ cone/MS - coneflower/M -*************** -*** 7022,7024 **** - DA -- DB - DC ---- 7021,7022 ---- -*************** -*** 7395,7397 **** - rec -! red/YPS - Eamon/M ---- 7393,7395 ---- - rec -! red/YPSM - Eamon/M -*************** -*** 8388,8390 **** - slotting -- ON - OR ---- 8386,8387 ---- -*************** -*** 9125,9127 **** - perchance -- rte - hastiness/MS ---- 9122,9123 ---- -*************** -*** 10603,10604 **** ---- 10599,10603 ---- - dB/M -+ dBi -+ dBm -+ dBd - Hewet/M -*************** -*** 10615,10617 **** - Garold/M -- db - tollhouse/M ---- 10614,10615 ---- -*************** -*** 11017,11019 **** - hr -- ht - MCI/M ---- 11015,11016 ---- -*************** -*** 11609,11611 **** - demureness/SM -! nd/A - MIA ---- 11606,11608 ---- - demureness/SM -! nd - MIA -*************** -*** 13669,13671 **** - engross/LDRSG -! hobbit - certainty/MUS ---- 13666,13668 ---- - engross/LDRSG -! hobbit/MS - certainty/MUS -*************** -*** 14434,14435 **** ---- 14431,14433 ---- - pompom/MS -+ pompon/M - Devland/M -*************** -*** 19265,19267 **** - bloodstone/M -! cetera/S - storm/SGZRDM ---- 19263,19265 ---- - bloodstone/M -! et cetera/S - storm/SGZRDM -*************** -*** 20162,20164 **** - Hansel/M -! ring/GZJDRM - Hansen/M ---- 20160,20162 ---- - Hansel/M -! ring/GZJDRMS - Hansen/M -*************** -*** 26960,26965 **** - Wisenheimer/M -! disc/GDM - horticulturist/SM - isotropically -! dish/DG - disburser/M ---- 26958,26963 ---- - Wisenheimer/M -! disc/GDMS - horticulturist/SM - isotropically -! dish/DGMS - disburser/M -*************** -*** 28157,28158 **** ---- 28155,28157 ---- - pneumonia/MS -+ pneumonic - Socratic/S -*************** -*** 34999,35001 **** - claque/MS -- etc - Chad/M ---- 34998,34999 ---- -*************** -*** 36707,36708 **** ---- 36705,36707 ---- - Moody/M -+ Moolenaar/M - Bresenham/M -*************** -*** 40455,40457 **** - proneness/MS -! transl - Conchita/M ---- 40454,40456 ---- - proneness/MS -! transl. - Conchita/M -*************** -*** 50272,50273 **** ---- 50271,50273 ---- - Dutch/M -+ Farsi - Sharon/M -*************** -*** 52565,52567 **** - hatchery/MS -! vim/SM - compatriot/MS ---- 52565,52568 ---- - hatchery/MS -! Vim/SM -! vim/? - compatriot/MS -*************** -*** 53490,53491 **** ---- 53491,53493 ---- - unsearchable -+ searchable - felicitous/IY -*************** -*** 62341 **** ---- 62343,62354 ---- - data/M -+ et al. -+ the the/! -+ and and/! -+ a a/! -+ a an/! -+ an a/! -+ an an/! -+ PayPal -+ Google -+ e.g. -+ TCP\/IP +*** en_CA.orig.dic 2015-12-30 18:20:47.803358258 +0100 +--- en_CA.dic 2016-01-08 23:03:52.562085247 +0100 +*************** +*** 1,25 **** + 48929 +! 0/nm +! 0th/pt +! 1/n1 +! 1st/p +! 1th/tc +! 2/nm +! 2nd/p +! 2th/tc +! 3/nm +! 3rd/p +! 3th/tc +! 4/nm +! 4th/pt +! 5/nm +! 5th/pt +! 6/nm +! 6th/pt +! 7/nm +! 7th/pt +! 8/nm +! 8th/pt +! 9/nm +! 9th/pt + A/SM +--- 1,12 ---- + 48929 +! 0th +! 1st +! 2nd +! 3rd +! 4th +! 5th +! 6th +! 7th +! 8th +! 9th + A/SM +*************** +*** 48930 **** +--- 48917,48927 ---- + zymurgy/M ++ a a/% ++ a an/% ++ a the/% ++ an a/% ++ an an/% ++ an the/% ++ and and/% ++ the a/% ++ the an/% ++ the the/% diff --git a/runtime/spell/en/en_GB.diff b/runtime/spell/en/en_GB.diff index dabb74b1c4..4c1c042d3f 100644 --- a/runtime/spell/en/en_GB.diff +++ b/runtime/spell/en/en_GB.diff @@ -1,29 +1,28 @@ -*** en_GB.orig.aff Sun Jul 3 17:53:13 2005 ---- en_GB.aff Wed Jan 11 22:03:27 2006 -*************** -*** 8,9 **** ---- 8,147 ---- - TRY esianrtolcdugmfphbyvkw-'.zqjxSNRTLCGDMFPHBEAUYOIVKWZQJX -+ -+ FOL -+ LOW -+ UPP +*** en_GB.orig.aff 2015-12-30 18:49:37.568638905 +0100 +--- en_GB.aff 2016-01-09 13:15:56.490432894 +0100 +*************** +*** 20,21 **** +--- 20,158 ---- + ++ FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ ++ LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ ++ UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ + + MIDWORD ' + + RARE ? -+ BAD ! ++ BAD % + + MAP 9 -+ MAP a -+ MAP e -+ MAP i -+ MAP o -+ MAP u -+ MAP n -+ MAP c -+ MAP y -+ MAP s ++ MAP aàáâãäå ++ MAP eèéêë ++ MAP iìíîï ++ MAP oòóôõö ++ MAP uùúûü ++ MAP nñ ++ MAP cç ++ MAP yÿý ++ MAP sß + + # This comes from Aspell en_phonet.dat, version 1.1, 2000-01-07 + @@ -34,8 +33,8 @@ + SAL AH(AEIOUY)- H + SAL AR(AEIOUY)- R + SAL A(HR) _ -+ SAL ^ * -+ SAL ^ * ++ SAL À^ * ++ SAL Å^ * + SAL BB- _ + SAL B B + SAL CQ- _ @@ -49,7 +48,7 @@ + SAL DG(EIY) K + SAL DD- _ + SAL D T -+ SAL < E ++ SAL É< E + SAL EH(AEIOUY)-^ *H + SAL ER(AEIOUY)-^ *R + SAL E(HR)^ * @@ -144,2430 +143,72 @@ + REP 27 *************** -*** 37,56 **** - PFX A Y 2 -! PFX A 0 re [^e] -! PFX A 0 re- e - PFX a Y 1 -! PFX a 0 mis . - PFX I Y 4 -! PFX I 0 il l -! PFX I 0 ir r -! PFX I 0 im [bmp] -! PFX I 0 in [^blmpr] - PFX c Y 1 -! PFX c 0 over . - PFX U Y 1 -! PFX U 0 un . - PFX C Y 2 -! PFX C 0 de [^e] -! PFX C 0 de- e - PFX E Y 1 -! PFX E 0 dis . - PFX F Y 5 ---- 175,194 ---- +*** 49,50 **** +--- 186,203 ---- + ++ # This is disabled, because if Vim does not support NOCOMPOUNDSUGS giving ++ # suggestions is extremely slow. ++ ## ordinal numbers ++ #COMPOUNDMIN 1 ++ ## only in compounds: 1th, 2th, 3th ++ #ONLYINCOMPOUND , ++ ## compound rules: ++ ## 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) ++ ## 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) ++ #COMPOUNDRULE 2 ++ #COMPOUNDRULE (*:) ++ #COMPOUNDRULE (*{} ++ #NOCOMPOUNDSUGS ++ ++ # WORDCHARS 0123456789 ++ PFX A Y 2 -! PFX A 0 re [^e] -! PFX A 0 re- e - PFX a Y 1 -! PFX a 0 mis . - PFX I Y 4 -! PFX I 0 il l -! PFX I 0 ir r -! PFX I 0 im [bmp] -! PFX I 0 in [^blmpr] - PFX c Y 1 -! PFX c 0 over . - PFX U Y 1 -! PFX U 0 un . - PFX C Y 2 -! PFX C 0 de [^e] -! PFX C 0 de- e - PFX E Y 1 -! PFX E 0 dis . - PFX F Y 5 -*************** -*** 60,454 **** - PFX F 0 col l -! PFX F 0 con [^abehilmopru]. - PFX K Y 1 -! PFX K 0 pre . - PFX e Y 1 -! PFX e 0 out . - PFX f Y 2 -! PFX f 0 under [^r] -! PFX f 0 under- r - PFX O Y 1 -! PFX O 0 non- . - PFX 4 Y 1 -! PFX 4 0 trans . - SFX V Y 15 -! SFX V 0 tive [aio] -! SFX V b ptive b -! SFX V d sive d -! SFX V be ptive be -! SFX V e tive ce -! SFX V de sive de -! SFX V ke cative ke -! SFX V e ptive me -! SFX V e ive [st]e -! SFX V e ative [^bcdkmst]e -! SFX V 0 lative [aeiou]l -! SFX V 0 ative [^aeiou]l -! SFX V 0 ive [st] -! SFX V y icative y -! SFX V 0 ative [^abdeilosty] - SFX v Y 15 -! SFX v 0 tively [aio] -! SFX v b ptively b -! SFX v d sively d -! SFX v be ptively be -! SFX v e tively ce -! SFX v de sively de -! SFX v ke catively ke -! SFX v e ptively me -! SFX v e ively [st]e -! SFX v e atively [^bcdkmst]e -! SFX v 0 latively [aeiou]l -! SFX v 0 atively [^aeiou]l -! SFX v 0 ively [st] -! SFX v y icatively y -! SFX v 0 atively [^abdeilosty] - SFX u Y 15 -! SFX u 0 tiveness [aio] -! SFX u b ptiveness b -! SFX u d siveness d -! SFX u be ptiveness be -! SFX u e tiveness ce -! SFX u de siveness de -! SFX u ke cativeness ke -! SFX u e ptiveness me -! SFX u e iveness [st]e -! SFX u e ativeness [^bcdkmst]e -! SFX u 0 lativeness [aeiou]l -! SFX u 0 ativeness [^aeiou]l -! SFX u 0 iveness [st] -! SFX u y icativeness y -! SFX u 0 ativeness [^abdeilosty] - SFX N Y 26 -! SFX N b ption b -! SFX N d sion d -! SFX N be ption be -! SFX N e tion ce -! SFX N de sion de -! SFX N ke cation ke -! SFX N e ption ume -! SFX N e mation [^u]me -! SFX N e ion [^o]se -! SFX N e ition ose -! SFX N e ation [iou]te -! SFX N e ion [^iou]te -! SFX N e ation [^bcdkmst]e -! SFX N el ulsion el -! SFX N 0 lation [aiou]l -! SFX N 0 ation [^aeiou]l -! SFX N 0 mation [aeiou]m -! SFX N 0 ation [^aeiou]m -! SFX N er ration er -! SFX N 0 ation [^e]r -! SFX N 0 ion [sx] -! SFX N t ssion mit -! SFX N 0 ion [^m]it -! SFX N 0 ation [^i]t -! SFX N y ication y -! SFX N 0 ation [^bdelmrstxy] - SFX n Y 28 -! SFX n 0 tion a -! SFX n e tion ce -! SFX n ke cation ke -! SFX n e ation [iou]te -! SFX n e ion [^iou]te -! SFX n e ation [^ckt]e -! SFX n el ulsion el -! SFX n 0 lation [aiou]l -! SFX n 0 ation [^aeiou]l -! SFX n er ration er -! SFX n 0 ation [^e]r -! SFX n y ation py -! SFX n y ication [^p]y -! SFX n 0 ation [^aelry] -! SFX n 0 tions a -! SFX n e tions ce -! SFX n ke cations ke -! SFX n e ations [iou]te -! SFX n e ions [^iou]te -! SFX n e ations [^ckt]e -! SFX n el ulsions el -! SFX n 0 lations [aiou]l -! SFX n 0 ations [^aeiou]l -! SFX n er rations er -! SFX n 0 ations [^e]r -! SFX n y ations py -! SFX n y ications [^p]y -! SFX n 0 ations [^aelry] - SFX X Y 26 -! SFX X b ptions b -! SFX X d sions d -! SFX X be ptions be -! SFX X e tions ce -! SFX X ke cations ke -! SFX X de sions de -! SFX X e ptions ume -! SFX X e mations [^u]me -! SFX X e ions [^o]se -! SFX X e itions ose -! SFX X e ations [iou]te -! SFX X e ions [^iou]te -! SFX X e ations [^bcdkmst]e -! SFX X el ulsions el -! SFX X 0 lations [aiou]l -! SFX X 0 ations [^aeiou]l -! SFX X 0 mations [aeiou]m -! SFX X 0 ations [^aeiou]m -! SFX X er rations er -! SFX X 0 ations [^e]r -! SFX X 0 ions [sx] -! SFX X t ssions mit -! SFX X 0 ions [^m]it -! SFX X 0 ations [^i]t -! SFX X y ications y -! SFX X 0 ations [^bdelmrstxy] - SFX x Y 40 -! SFX x b ptional b -! SFX x d sional d -! SFX x be ptional be -! SFX x e tional ce -! SFX x ke cational ke -! SFX x de sional de -! SFX x e ional [^o]se -! SFX x e itional ose -! SFX x e ional te -! SFX x e ational [^bcdkst]e -! SFX x el ulsional el -! SFX x 0 lational [aiou]l -! SFX x 0 ational [^aeiou]l -! SFX x er rational er -! SFX x 0 ational [^e]r -! SFX x 0 ional [sx] -! SFX x 0 ional [^n]t -! SFX x 0 ational nt -! SFX x y icational y -! SFX x 0 ational [^bdelrstxy] -! SFX x b ptionally b -! SFX x d sionally d -! SFX x be ptionally be -! SFX x e tionally ce -! SFX x ke cationally ke -! SFX x de sionally de -! SFX x e ionally [^o]se -! SFX x e itionally ose -! SFX x e ionally te -! SFX x e ationally [^bcdkst]e -! SFX x el ulsionally el -! SFX x 0 lationally [aiou]l -! SFX x 0 ationally [^aeiou]l -! SFX x er rationally er -! SFX x 0 ationally [^e]r -! SFX x 0 ionally [sx] -! SFX x 0 ionally [^n]t -! SFX x 0 ationally nt -! SFX x y icationally y -! SFX x 0 ationally [^bdelrstxy] - SFX H N 13 -! SFX H y ieth y -! SFX H ree ird ree -! SFX H ve fth ve -! SFX H e th [^ev]e -! SFX H 0 h t -! SFX H 0 th [^ety] -! SFX H y ieths y -! SFX H ree irds ree -! SFX H ve fths ve -! SFX H e ths [^ev]e -! SFX H 0 hs t -! SFX H 0 ths [^ety] -! SFX H 0 fold . - SFX Y Y 9 -! SFX Y 0 ally ic -! SFX Y 0 ly [^i]c -! SFX Y e y [^aeiou]le -! SFX Y 0 ly [aeiou]le -! SFX Y 0 ly [^l]e -! SFX Y 0 y [^aeiou]l -! SFX Y y ily [^aeiou]y -! SFX Y 0 ly [aeiou][ly] -! SFX Y 0 ly [^cely] - SFX G Y 24 -! SFX G e ing [^eioy]e -! SFX G 0 ing [eoy]e -! SFX G ie ying ie -! SFX G 0 bing [^aeio][aeiou]b -! SFX G 0 king [^aeio][aeiou]c -! SFX G 0 ding [^aeio][aeiou]d -! SFX G 0 fing [^aeio][aeiou]f -! SFX G 0 ging [^aeio][aeiou]g -! SFX G 0 king [^aeio][aeiou]k -! SFX G 0 ling [^aeio][eiou]l -! SFX G 0 ing [aeio][eiou]l -! SFX G 0 ling [^aeo]al -! SFX G 0 ing [aeo]al -! SFX G 0 ming [^aeio][aeiou]m -! SFX G 0 ning [^aeio][aeiou]n -! SFX G 0 ping [^aeio][aeiou]p -! SFX G 0 ring [^aeio][aeiou]r -! SFX G 0 sing [^aeio][aeiou]s -! SFX G 0 ting [^aeio][aeiou]t -! SFX G 0 ving [^aeio][aeiou]v -! SFX G 0 zing [^aeio][aeiou]z -! SFX G 0 ing [aeio][aeiou][bcdfgkmnprstvz] -! SFX G 0 ing [^aeiou][bcdfgklmnprstvz] -! SFX G 0 ing [^ebcdfgklmnprstvz] - SFX J Y 25 -! SFX J e ings [^eioy]e -! SFX J 0 ings [eoy]e -! SFX J ie yings ie -! SFX J 0 bings [^aeio][aeiou]b -! SFX J 0 king [^aeio][aeiou]c -! SFX J 0 dings [^aeio][aeiou]d -! SFX J 0 fings [^aeio][aeiou]f -! SFX J 0 gings [^aeio][aeiou]g -! SFX J 0 kings [^aeio][aeiou]k -! SFX J 0 lings [^aeio][eiou]l -! SFX J 0 ings [aeio][eiou]l -! SFX J 0 lings [^aeo]al -! SFX J 0 ings [aeo]al -! SFX J 0 mings [^aeio][aeiou]m -! SFX J 0 nings [^aeio][aiou]n -! SFX J 0 pings [^aeio][aeiou]p -! SFX J 0 rings [^aeio][aiou]r -! SFX J 0 sings [^aeio][aeiou]s -! SFX J 0 tings [^aeio][aiou]t -! SFX J 0 vings [^aeio][aeiou]v -! SFX J 0 zings [^aeio][aeiou]z -! SFX J 0 ings [^aeio]e[nrt] -! SFX J 0 ings [aeio][aeiou][bcdfgkmnprstvz] -! SFX J 0 ings [^aeiou][bcdfgklmnprstvz] -! SFX J 0 ings [^ebcdfgklmnprstvz] - SFX k Y 8 -! SFX k e ingly [^eioy]e -! SFX k 0 ingly [eoy]e -! SFX k ie yingly ie -! SFX k 0 kingly [^aeio][aeiou]c -! SFX k 0 lingly [^aeio][aeiou]l -! SFX k 0 ingly [aeio][aeiou][cl] -! SFX k 0 ingly [^aeiou][cl] -! SFX k 0 ingly [^ecl] - SFX D Y 25 -! SFX D 0 d [^e]e -! SFX D e d ee -! SFX D 0 bed [^aeio][aeiou]b -! SFX D 0 ked [^aeio][aeiou]c -! SFX D 0 ded [^aeio][aeiou]d -! SFX D 0 fed [^aeio][aeiou]f -! SFX D 0 ged [^aeio][aeiou]g -! SFX D 0 ked [^aeio][aeiou]k -! SFX D 0 led [^aeio][eiou]l -! SFX D 0 ed [aeio][eiou]l -! SFX D 0 led [^aeo]al -! SFX D 0 ed [aeo]al -! SFX D 0 med [^aeio][aeiou]m -! SFX D 0 ned [^aeio][aeiou]n -! SFX D 0 ped [^aeio][aeiou]p -! SFX D 0 red [^aeio][aeiou]r -! SFX D 0 sed [^aeio][aeiou]s -! SFX D 0 ted [^aeio][aeiou]t -! SFX D 0 ved [^aeio][aeiou]v -! SFX D 0 zed [^aeio][aeiou]z -! SFX D y ied [^aeiou]y -! SFX D 0 ed [aeiou]y -! SFX D 0 ed [aeio][aeiou][bcdfgkmnprstvz] -! SFX D 0 ed [^aeiou][bcdfgklmnprstvz] -! SFX D 0 ed [^ebcdfgklmnprstvyz] - SFX d Y 16 -! SFX d 0 d e -! SFX d 0 ked [^aeio][aeiou]c -! SFX d 0 led [^aeio][aeiou]l -! SFX d y ied [^aeiou]y -! SFX d 0 ed [aeiou]y -! SFX d 0 ed [aeio][aeiou][cl] -! SFX d 0 ed [^aeiou][cl] -! SFX d 0 ed [^ecly] -! SFX d e ing [^eioy]e -! SFX d 0 ing [eoy]e -! SFX d ie ying ie -! SFX d 0 king [^aeio][aeiou]c -! SFX d 0 ling [^aeio][aeiou]l -! SFX d 0 ing [aeio][aeiou][cl] -! SFX d 0 ing [^aeiou][cl] -! SFX d 0 ing [^ecl] - SFX h Y 22 -! SFX h 0 dly e -! SFX h 0 bedly [^aeio][aeiou]b -! SFX h 0 kedly [^aeio][aeiou]c -! SFX h 0 dedly [^aeio][aeiou]d -! SFX h 0 fedly [^aeio][aeiou]f -! SFX h 0 gedly [^aeio][aeiou]g -! SFX h 0 kedly [^aeio][aeiou]k -! SFX h 0 ledly [^aeio][aeiou]l -! SFX h 0 medly [^aeio][aeiou]m -! SFX h 0 nedly [^aeio][aiou]n -! SFX h 0 pedly [^aeio][aeiou]p -! SFX h 0 redly [^aeio][aiou]r -! SFX h 0 sedly [^aeio][aeiou]s -! SFX h 0 tedly [^aeio][aiou]t -! SFX h 0 vedly [^aeio][aeiou]v -! SFX h 0 zedly [^aeio][aeiou]z -! SFX h 0 edly [^aeio]e[nrt] -! SFX h y iedly [^aeiou]y -! SFX h 0 edly [aeiou]y -! SFX h 0 edly [aeio][aeiou][bcdfgklmnprstvz] -! SFX h 0 edly [^aeiou][bcdfgklmnprstvz] -! SFX h 0 edly [^ebcdfgklmnprstvyz] - SFX i Y 22 -! SFX i 0 dness e -! SFX i 0 bedness [^aeio][aeiou]b -! SFX i 0 kedness [^aeio][aeiou]c -! SFX i 0 dedness [^aeio][aeiou]d -! SFX i 0 fedness [^aeio][aeiou]f -! SFX i 0 gedness [^aeio][aeiou]g -! SFX i 0 kedness [^aeio][aeiou]k -! SFX i 0 ledness [^aeio][aeiou]l -! SFX i 0 medness [^aeio][aeiou]m -! SFX i 0 nedness [^aeio][aiou]n -! SFX i 0 pedness [^aeio][aeiou]p -! SFX i 0 redness [^aeio][aiou]r -! SFX i 0 sedness [^aeio][aeiou]s -! SFX i 0 tedness [^aeio][aiou]t -! SFX i 0 vedness [^aeio][aeiou]v -! SFX i 0 zedness [^aeio][aeiou]z -! SFX i 0 edness [^aeio]e[nrt] -! SFX i y iedness [^aeiou]y -! SFX i 0 edness [aeiou]y -! SFX i 0 edness [aeio][aeiou][bcdfgklmnprstvz] -! SFX i 0 edness [^aeiou][bcdfgklmnprstvz] -! SFX i 0 edness [^ebcdfgklmnprstvyz] - SFX T Y 42 -! SFX T 0 r e - SFX T 0 st e -! SFX T 0 ber [^aeio][aeiou]b - SFX T 0 best [^aeio][aeiou]b -! SFX T 0 ker [^aeio][aeiou]c - SFX T 0 kest [^aeio][aeiou]c -! SFX T 0 der [^aeio][aeiou]d - SFX T 0 dest [^aeio][aeiou]d -! SFX T 0 fer [^aeio][aeiou]f - SFX T 0 fest [^aeio][aeiou]f -! SFX T 0 ger [^aeio][aeiou]g - SFX T 0 gest [^aeio][aeiou]g -! SFX T 0 ker [^aeio][aeiou]k - SFX T 0 kest [^aeio][aeiou]k -! SFX T 0 ler [^aeio][aeiou]l - SFX T 0 lest [^aeio][aeiou]l -! SFX T 0 mer [^aeio][aeiou]m - SFX T 0 mest [^aeio][aeiou]m -! SFX T 0 ner [^aeio][aeiou]n - SFX T 0 nest [^aeio][aeiou]n -! SFX T 0 per [^aeio][aeiou]p - SFX T 0 pest [^aeio][aeiou]p -! SFX T 0 rer [^aeio][aeiou]r - SFX T 0 rest [^aeio][aeiou]r -! SFX T 0 ser [^aeio][aeiou]s - SFX T 0 sest [^aeio][aeiou]s -! SFX T 0 ter [^aeio][aeiou]t - SFX T 0 test [^aeio][aeiou]t -! SFX T 0 ver [^aeio][aeiou]v - SFX T 0 vest [^aeio][aeiou]v -! SFX T 0 zer [^aeio][aeiou]z - SFX T 0 zest [^aeio][aeiou]z -! SFX T y ier [^aeiou]y - SFX T y iest [^aeiou]y -! SFX T 0 er [aeiou]y - SFX T 0 est [aeiou]y ---- 198,592 ---- - PFX F 0 col l -! PFX F 0 con [^abehilmopru]. - PFX K Y 1 -! PFX K 0 pre . - PFX e Y 1 -! PFX e 0 out . - PFX f Y 2 -! PFX f 0 under [^r] -! PFX f 0 under- r - PFX O Y 1 -! PFX O 0 non- . - PFX 4 Y 1 -! PFX 4 0 trans . - SFX V Y 15 -! SFX V 0 tive [aio] -! SFX V b ptive b -! SFX V d sive d -! SFX V be ptive be -! SFX V e tive ce -! SFX V de sive de -! SFX V ke cative ke -! SFX V e ptive me -! SFX V e ive [st]e -! SFX V e ative [^bcdkmst]e -! SFX V 0 lative [aeiou]l -! SFX V 0 ative [^aeiou]l -! SFX V 0 ive [st] -! SFX V y icative y -! SFX V 0 ative [^abdeilosty] - SFX v Y 15 -! SFX v 0 tively [aio] -! SFX v b ptively b -! SFX v d sively d -! SFX v be ptively be -! SFX v e tively ce -! SFX v de sively de -! SFX v ke catively ke -! SFX v e ptively me -! SFX v e ively [st]e -! SFX v e atively [^bcdkmst]e -! SFX v 0 latively [aeiou]l -! SFX v 0 atively [^aeiou]l -! SFX v 0 ively [st] -! SFX v y icatively y -! SFX v 0 atively [^abdeilosty] - SFX u Y 15 -! SFX u 0 tiveness [aio] -! SFX u b ptiveness b -! SFX u d siveness d -! SFX u be ptiveness be -! SFX u e tiveness ce -! SFX u de siveness de -! SFX u ke cativeness ke -! SFX u e ptiveness me -! SFX u e iveness [st]e -! SFX u e ativeness [^bcdkmst]e -! SFX u 0 lativeness [aeiou]l -! SFX u 0 ativeness [^aeiou]l -! SFX u 0 iveness [st] -! SFX u y icativeness y -! SFX u 0 ativeness [^abdeilosty] - SFX N Y 26 -! SFX N b ption b -! SFX N d sion d -! SFX N be ption be -! SFX N e tion ce -! SFX N de sion de -! SFX N ke cation ke -! SFX N e ption ume -! SFX N e mation [^u]me -! SFX N e ion [^o]se -! SFX N e ition ose -! SFX N e ation [iou]te -! SFX N e ion [^iou]te -! SFX N e ation [^bcdkmst]e -! SFX N el ulsion el -! SFX N 0 lation [aiou]l -! SFX N 0 ation [^aeiou]l -! SFX N 0 mation [aeiou]m -! SFX N 0 ation [^aeiou]m -! SFX N er ration er -! SFX N 0 ation [^e]r -! SFX N 0 ion [sx] -! SFX N t ssion mit -! SFX N 0 ion [^m]it -! SFX N 0 ation [^i]t -! SFX N y ication y -! SFX N 0 ation [^bdelmrstxy] - SFX n Y 28 -! SFX n 0 tion a -! SFX n e tion ce -! SFX n ke cation ke -! SFX n e ation [iou]te -! SFX n e ion [^iou]te -! SFX n e ation [^ckt]e -! SFX n el ulsion el -! SFX n 0 lation [aiou]l -! SFX n 0 ation [^aeiou]l -! SFX n er ration er -! SFX n 0 ation [^e]r -! SFX n y ation py -! SFX n y ication [^p]y -! SFX n 0 ation [^aelry] -! SFX n 0 tions a -! SFX n e tions ce -! SFX n ke cations ke -! SFX n e ations [iou]te -! SFX n e ions [^iou]te -! SFX n e ations [^ckt]e -! SFX n el ulsions el -! SFX n 0 lations [aiou]l -! SFX n 0 ations [^aeiou]l -! SFX n er rations er -! SFX n 0 ations [^e]r -! SFX n y ations py -! SFX n y ications [^p]y -! SFX n 0 ations [^aelry] - SFX X Y 26 -! SFX X b ptions b -! SFX X d sions d -! SFX X be ptions be -! SFX X e tions ce -! SFX X ke cations ke -! SFX X de sions de -! SFX X e ptions ume -! SFX X e mations [^u]me -! SFX X e ions [^o]se -! SFX X e itions ose -! SFX X e ations [iou]te -! SFX X e ions [^iou]te -! SFX X e ations [^bcdkmst]e -! SFX X el ulsions el -! SFX X 0 lations [aiou]l -! SFX X 0 ations [^aeiou]l -! SFX X 0 mations [aeiou]m -! SFX X 0 ations [^aeiou]m -! SFX X er rations er -! SFX X 0 ations [^e]r -! SFX X 0 ions [sx] -! SFX X t ssions mit -! SFX X 0 ions [^m]it -! SFX X 0 ations [^i]t -! SFX X y ications y -! SFX X 0 ations [^bdelmrstxy] - SFX x Y 40 -! SFX x b ptional b -! SFX x d sional d -! SFX x be ptional be -! SFX x e tional ce -! SFX x ke cational ke -! SFX x de sional de -! SFX x e ional [^o]se -! SFX x e itional ose -! SFX x e ional te -! SFX x e ational [^bcdkst]e -! SFX x el ulsional el -! SFX x 0 lational [aiou]l -! SFX x 0 ational [^aeiou]l -! SFX x er rational er -! SFX x 0 ational [^e]r -! SFX x 0 ional [sx] -! SFX x 0 ional [^n]t -! SFX x 0 ational nt -! SFX x y icational y -! SFX x 0 ational [^bdelrstxy] -! SFX x b ptionally b -! SFX x d sionally d -! SFX x be ptionally be -! SFX x e tionally ce -! SFX x ke cationally ke -! SFX x de sionally de -! SFX x e ionally [^o]se -! SFX x e itionally ose -! SFX x e ionally te -! SFX x e ationally [^bcdkst]e -! SFX x el ulsionally el -! SFX x 0 lationally [aiou]l -! SFX x 0 ationally [^aeiou]l -! SFX x er rationally er -! SFX x 0 ationally [^e]r -! SFX x 0 ionally [sx] -! SFX x 0 ionally [^n]t -! SFX x 0 ationally nt -! SFX x y icationally y -! SFX x 0 ationally [^bdelrstxy] - SFX H N 13 -! SFX H y ieth y -! SFX H ree ird ree -! SFX H ve fth ve -! SFX H e th [^ev]e -! SFX H 0 h t -! SFX H 0 th [^ety] -! SFX H y ieths y -! SFX H ree irds ree -! SFX H ve fths ve -! SFX H e ths [^ev]e -! SFX H 0 hs t -! SFX H 0 ths [^ety] -! SFX H 0 fold . - SFX Y Y 9 -! SFX Y 0 ally ic -! SFX Y 0 ly [^i]c -! SFX Y e y [^aeiou]le -! SFX Y 0 ly [aeiou]le -! SFX Y 0 ly [^l]e -! SFX Y 0 y [^aeiou]l -! SFX Y y ily [^aeiou]y -! SFX Y 0 ly [aeiou][ly] -! SFX Y 0 ly [^cely] - SFX G Y 24 -! SFX G e ing [^eioy]e -! SFX G 0 ing [eoy]e -! SFX G ie ying ie -! SFX G 0 bing [^aeio][aeiou]b -! SFX G 0 king [^aeio][aeiou]c -! SFX G 0 ding [^aeio][aeiou]d -! SFX G 0 fing [^aeio][aeiou]f -! SFX G 0 ging [^aeio][aeiou]g -! SFX G 0 king [^aeio][aeiou]k -! SFX G 0 ling [^aeio][eiou]l -! SFX G 0 ing [aeio][eiou]l -! SFX G 0 ling [^aeo]al -! SFX G 0 ing [aeo]al -! SFX G 0 ming [^aeio][aeiou]m -! SFX G 0 ning [^aeio][aeiou]n -! SFX G 0 ping [^aeio][aeiou]p -! SFX G 0 ring [^aeio][aeiou]r -! SFX G 0 sing [^aeio][aeiou]s -! SFX G 0 ting [^aeio][aeiou]t -! SFX G 0 ving [^aeio][aeiou]v -! SFX G 0 zing [^aeio][aeiou]z -! SFX G 0 ing [aeio][aeiou][bcdfgkmnprstvz] -! SFX G 0 ing [^aeiou][bcdfgklmnprstvz] -! SFX G 0 ing [^ebcdfgklmnprstvz] - SFX J Y 25 -! SFX J e ings [^eioy]e -! SFX J 0 ings [eoy]e -! SFX J ie yings ie -! SFX J 0 bings [^aeio][aeiou]b -! SFX J 0 king [^aeio][aeiou]c -! SFX J 0 dings [^aeio][aeiou]d -! SFX J 0 fings [^aeio][aeiou]f -! SFX J 0 gings [^aeio][aeiou]g -! SFX J 0 kings [^aeio][aeiou]k -! SFX J 0 lings [^aeio][eiou]l -! SFX J 0 ings [aeio][eiou]l -! SFX J 0 lings [^aeo]al -! SFX J 0 ings [aeo]al -! SFX J 0 mings [^aeio][aeiou]m -! SFX J 0 nings [^aeio][aiou]n -! SFX J 0 pings [^aeio][aeiou]p -! SFX J 0 rings [^aeio][aiou]r -! SFX J 0 sings [^aeio][aeiou]s -! SFX J 0 tings [^aeio][aiou]t -! SFX J 0 vings [^aeio][aeiou]v -! SFX J 0 zings [^aeio][aeiou]z -! SFX J 0 ings [^aeio]e[nrt] -! SFX J 0 ings [aeio][aeiou][bcdfgkmnprstvz] -! SFX J 0 ings [^aeiou][bcdfgklmnprstvz] -! SFX J 0 ings [^ebcdfgklmnprstvz] - SFX k Y 8 -! SFX k e ingly [^eioy]e -! SFX k 0 ingly [eoy]e -! SFX k ie yingly ie -! SFX k 0 kingly [^aeio][aeiou]c -! SFX k 0 lingly [^aeio][aeiou]l -! SFX k 0 ingly [aeio][aeiou][cl] -! SFX k 0 ingly [^aeiou][cl] -! SFX k 0 ingly [^ecl] - SFX D Y 25 -! SFX D 0 d [^e]e -! SFX D e d ee -! SFX D 0 bed [^aeio][aeiou]b -! SFX D 0 ked [^aeio][aeiou]c -! SFX D 0 ded [^aeio][aeiou]d -! SFX D 0 fed [^aeio][aeiou]f -! SFX D 0 ged [^aeio][aeiou]g -! SFX D 0 ked [^aeio][aeiou]k -! SFX D 0 led [^aeio][eiou]l -! SFX D 0 ed [aeio][eiou]l -! SFX D 0 led [^aeo]al -! SFX D 0 ed [aeo]al -! SFX D 0 med [^aeio][aeiou]m -! SFX D 0 ned [^aeio][aeiou]n -! SFX D 0 ped [^aeio][aeiou]p -! SFX D 0 red [^aeio][aeiou]r -! SFX D 0 sed [^aeio][aeiou]s -! SFX D 0 ted [^aeio][aeiou]t -! SFX D 0 ved [^aeio][aeiou]v -! SFX D 0 zed [^aeio][aeiou]z -! SFX D y ied [^aeiou]y -! SFX D 0 ed [aeiou]y -! SFX D 0 ed [aeio][aeiou][bcdfgkmnprstvz] -! SFX D 0 ed [^aeiou][bcdfgklmnprstvz] -! SFX D 0 ed [^ebcdfgklmnprstvyz] - SFX d Y 16 -! SFX d 0 d e -! SFX d 0 ked [^aeio][aeiou]c -! SFX d 0 led [^aeio][aeiou]l -! SFX d y ied [^aeiou]y -! SFX d 0 ed [aeiou]y -! SFX d 0 ed [aeio][aeiou][cl] -! SFX d 0 ed [^aeiou][cl] -! SFX d 0 ed [^ecly] -! SFX d e ing [^eioy]e -! SFX d 0 ing [eoy]e -! SFX d ie ying ie -! SFX d 0 king [^aeio][aeiou]c -! SFX d 0 ling [^aeio][aeiou]l -! SFX d 0 ing [aeio][aeiou][cl] -! SFX d 0 ing [^aeiou][cl] -! SFX d 0 ing [^ecl] - SFX h Y 22 -! SFX h 0 dly e -! SFX h 0 bedly [^aeio][aeiou]b -! SFX h 0 kedly [^aeio][aeiou]c -! SFX h 0 dedly [^aeio][aeiou]d -! SFX h 0 fedly [^aeio][aeiou]f -! SFX h 0 gedly [^aeio][aeiou]g -! SFX h 0 kedly [^aeio][aeiou]k -! SFX h 0 ledly [^aeio][aeiou]l -! SFX h 0 medly [^aeio][aeiou]m -! SFX h 0 nedly [^aeio][aiou]n -! SFX h 0 pedly [^aeio][aeiou]p -! SFX h 0 redly [^aeio][aiou]r -! SFX h 0 sedly [^aeio][aeiou]s -! SFX h 0 tedly [^aeio][aiou]t -! SFX h 0 vedly [^aeio][aeiou]v -! SFX h 0 zedly [^aeio][aeiou]z -! SFX h 0 edly [^aeio]e[nrt] -! SFX h y iedly [^aeiou]y -! SFX h 0 edly [aeiou]y -! SFX h 0 edly [aeio][aeiou][bcdfgklmnprstvz] -! SFX h 0 edly [^aeiou][bcdfgklmnprstvz] -! SFX h 0 edly [^ebcdfgklmnprstvyz] - SFX i Y 22 -! SFX i 0 dness e -! SFX i 0 bedness [^aeio][aeiou]b -! SFX i 0 kedness [^aeio][aeiou]c -! SFX i 0 dedness [^aeio][aeiou]d -! SFX i 0 fedness [^aeio][aeiou]f -! SFX i 0 gedness [^aeio][aeiou]g -! SFX i 0 kedness [^aeio][aeiou]k -! SFX i 0 ledness [^aeio][aeiou]l -! SFX i 0 medness [^aeio][aeiou]m -! SFX i 0 nedness [^aeio][aiou]n -! SFX i 0 pedness [^aeio][aeiou]p -! SFX i 0 redness [^aeio][aiou]r -! SFX i 0 sedness [^aeio][aeiou]s -! SFX i 0 tedness [^aeio][aiou]t -! SFX i 0 vedness [^aeio][aeiou]v -! SFX i 0 zedness [^aeio][aeiou]z -! SFX i 0 edness [^aeio]e[nrt] -! SFX i y iedness [^aeiou]y -! SFX i 0 edness [aeiou]y -! SFX i 0 edness [aeio][aeiou][bcdfgklmnprstvz] -! SFX i 0 edness [^aeiou][bcdfgklmnprstvz] -! SFX i 0 edness [^ebcdfgklmnprstvyz] - SFX T Y 42 -! SFX T 0 r e - SFX T 0 st e -! SFX T 0 ber [^aeio][aeiou]b - SFX T 0 best [^aeio][aeiou]b -! SFX T 0 ker [^aeio][aeiou]c - SFX T 0 kest [^aeio][aeiou]c -! SFX T 0 der [^aeio][aeiou]d - SFX T 0 dest [^aeio][aeiou]d -! SFX T 0 fer [^aeio][aeiou]f - SFX T 0 fest [^aeio][aeiou]f -! SFX T 0 ger [^aeio][aeiou]g - SFX T 0 gest [^aeio][aeiou]g -! SFX T 0 ker [^aeio][aeiou]k - SFX T 0 kest [^aeio][aeiou]k -! SFX T 0 ler [^aeio][aeiou]l - SFX T 0 lest [^aeio][aeiou]l -! SFX T 0 mer [^aeio][aeiou]m - SFX T 0 mest [^aeio][aeiou]m -! SFX T 0 ner [^aeio][aeiou]n - SFX T 0 nest [^aeio][aeiou]n -! SFX T 0 per [^aeio][aeiou]p - SFX T 0 pest [^aeio][aeiou]p -! SFX T 0 rer [^aeio][aeiou]r - SFX T 0 rest [^aeio][aeiou]r -! SFX T 0 ser [^aeio][aeiou]s - SFX T 0 sest [^aeio][aeiou]s -! SFX T 0 ter [^aeio][aeiou]t - SFX T 0 test [^aeio][aeiou]t -! SFX T 0 ver [^aeio][aeiou]v - SFX T 0 vest [^aeio][aeiou]v -! SFX T 0 zer [^aeio][aeiou]z - SFX T 0 zest [^aeio][aeiou]z -! SFX T y ier [^aeiou]y - SFX T y iest [^aeiou]y -! SFX T 0 er [aeiou]y - SFX T 0 est [aeiou]y -*************** -*** 461,1150 **** - SFX R Y 72 -! SFX R 0 r e -! SFX R 0 rs e -! SFX R 0 ber [^aeio][aeiou]b -! SFX R 0 bers [^aeio][aeiou]b -! SFX R 0 ker [^aeio][aeiou]c -! SFX R 0 kers [^aeio][aeiou]c -! SFX R 0 der [^aeio][aeiou]d -! SFX R 0 ders [^aeio][aeiou]d -! SFX R 0 fer [^aeio][aeiou]f -! SFX R 0 fers [^aeio][aeiou]f -! SFX R 0 ger [^aeio][aeiou]g -! SFX R 0 gers [^aeio][aeiou]g -! SFX R 0 ker [^aeio][aeiou]k -! SFX R 0 kers [^aeio][aeiou]k -! SFX R 0 ler [^aeio][eiou]l -! SFX R 0 er [aeio][eiou]l -! SFX R 0 ler [^aeo]al -! SFX R 0 er [aeo]al -! SFX R 0 lers [^aeio][eiou]l -! SFX R 0 ers [aeio][eiou]l -! SFX R 0 lers [^aeo]al -! SFX R 0 ers [aeo]al -! SFX R 0 mer [^aeio][aeiou]m -! SFX R 0 mers [^aeio][aeiou]m -! SFX R 0 ner [^aeio][aeiou]n -! SFX R 0 ners [^aeio][aeiou]n -! SFX R 0 per [^aeio][aeiou]p -! SFX R 0 pers [^aeio][aeiou]p -! SFX R 0 rer [^aeio][aeiou]r -! SFX R 0 rers [^aeio][aeiou]r -! SFX R 0 ser [^aeio][aeiou]s -! SFX R 0 sers [^aeio][aeiou]s -! SFX R 0 ter [^aeio][aeiou]t -! SFX R 0 ters [^aeio][aeiou]t -! SFX R 0 ver [^aeio][aeiou]v -! SFX R 0 vers [^aeio][aeiou]v -! SFX R 0 zer [^aeio][aeiou]z -! SFX R 0 zers [^aeio][aeiou]z -! SFX R y ier [^aeiou]y -! SFX R y iers [^aeiou]y -! SFX R 0 er [aeiou]y -! SFX R 0 ers [aeiou]y -! SFX R 0 er [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 ers [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 er [^aeiou][bcdfgklmnprstvz] -! SFX R 0 ers [^aeiou][bcdfgklmnprstvz] -! SFX R 0 er [^ebcdfgklmnprstvyz] -! SFX R 0 ers [^ebcdfgklmnprstvyz] -! SFX R 0 r's e -! SFX R 0 ber's [^aeio][aeiou]b -! SFX R 0 ker's [^aeio][aeiou]c -! SFX R 0 der's [^aeio][aeiou]d -! SFX R 0 fer's [^aeio][aeiou]f -! SFX R 0 ger's [^aeio][aeiou]g -! SFX R 0 ker's [^aeio][aeiou]k -! SFX R 0 ler's [^aeio][eiou]l -! SFX R 0 er's [aeio][eiou]l -! SFX R 0 ler's [^aeo]al -! SFX R 0 er's [aeo]al -! SFX R 0 mer's [^aeio][aeiou]m -! SFX R 0 ner's [^aeio][aeiou]n -! SFX R 0 per's [^aeio][aeiou]p -! SFX R 0 rer's [^aeio][aeiou]r -! SFX R 0 ser's [^aeio][aeiou]s -! SFX R 0 ter's [^aeio][aeiou]t -! SFX R 0 ver's [^aeio][aeiou]v -! SFX R 0 zer's [^aeio][aeiou]z -! SFX R y ier's [^aeiou]y -! SFX R 0 er's [aeiou]y -! SFX R 0 er's [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 er's [^aeiou][bcdfgklmnprstvz] -! SFX R 0 er's [^ebcdfgklmnprstvyz] - SFX r Y 24 -! SFX r 0 r e -! SFX r 0 ler [^aeio][aeiou]l -! SFX r 0 ker [^aeio][aeiou]c -! SFX r y ier [^aeiou]y -! SFX r 0 er [aeiou]y -! SFX r 0 er [aeio][aeiou][cl] -! SFX r 0 er [^aeiou][cl] -! SFX r 0 er [^ecly] -! SFX r 0 rs e -! SFX r 0 lers [^aeio][aeiou]l -! SFX r 0 kers [^aeio][aeiou]c -! SFX r y iers [^aeiou]y -! SFX r 0 ers [aeiou]y -! SFX r 0 ers [aeio][aeiou][cl] -! SFX r 0 ers [^aeiou][cl] -! SFX r 0 ers [^ecly] -! SFX r 0 r's e -! SFX r 0 ler's [^aeio][aeiou]l -! SFX r 0 ker's [^aeio][aeiou]c -! SFX r y ier's [^aeiou]y -! SFX r 0 er's [aeiou]y -! SFX r 0 er's [aeio][aeiou][cl] -! SFX r 0 er's [^aeiou][cl] -! SFX r 0 er's [^ecly] - SFX S Y 9 -! SFX S y ies [^aeiou]y -! SFX S 0 s [aeiou]y -! SFX S 0 es [sxz] -! SFX S 0 es [cs]h -! SFX S 0 s [^cs]h -! SFX S 0 s [ae]u -! SFX S 0 x [ae]u -! SFX S 0 s [^ae]u - SFX S 0 s [^hsuxyz] - SFX P Y 6 -! SFX P y iness [^aeiou]y -! SFX P 0 ness [aeiou]y -! SFX P 0 ness [^y] -! SFX P y iness's [^aeiou]y -! SFX P 0 ness's [aeiou]y -! SFX P 0 ness's [^y] - SFX m Y 20 -! SFX m 0 sman [bdknmt] -! SFX m 0 sman [aeiou][bdklmnt]e -! SFX m 0 man [^aeiou][bdklmnt]e -! SFX m 0 man [^bdklmnt]e -! SFX m 0 man [^bdeknmt] -! SFX m 0 smen [bdknmt] -! SFX m 0 smen [aeiou][bdklmnt]e -! SFX m 0 men [^aeiou][bdklmnt]e -! SFX m 0 men [^bdklmnt]e -! SFX m 0 men [^bdeknmt] -! SFX m 0 sman's [bdknmt] -! SFX m 0 sman's [aeiou][bdklmnt]e -! SFX m 0 man's [^aeiou][bdklmnt]e -! SFX m 0 man's [^bdklmnt]e -! SFX m 0 man's [^bdeknmt] -! SFX m 0 smen's [bdknmt] -! SFX m 0 smen's [aeiou][bdklmnt]e -! SFX m 0 men's [^aeiou][bdklmnt]e -! SFX m 0 men's [^bdklmnt]e -! SFX m 0 men's [^bdeknmt] - SFX 5 Y 15 -! SFX 5 0 swoman [bdknmt] -! SFX 5 0 swoman [aeiou][bdklmnt]e -! SFX 5 0 woman [^aeiou][bdklmnt]e -! SFX 5 0 woman [^bdklmnt]e -! SFX 5 0 woman [^bdeknmt] -! SFX 5 0 swomen [bdknmt] -! SFX 5 0 swomen [aeiou][bdklmnt]e -! SFX 5 0 women [^aeiou][bdklmnt]e -! SFX 5 0 women [^bdklmnt]e -! SFX 5 0 women [^bdeknmt] -! SFX 5 0 swoman's [bdknmt] -! SFX 5 0 swoman's [aeiou][bdklmnt]e -! SFX 5 0 woman's [^aeiou][bdklmnt]e -! SFX 5 0 woman's [^bdklmnt]e -! SFX 5 0 woman's [^bdeknmt] - SFX 6 Y 3 -! SFX 6 y iful [^aeiou]y -! SFX 6 0 ful [aeiou]y -! SFX 6 0 ful [^y] - SFX j Y 3 -! SFX j y ifully [^aeiou]y -! SFX j 0 fully [aeiou]y -! SFX j 0 fully [^y] - SFX p Y 5 -! SFX p y iless [^aeiou]y -! SFX p 0 less [aeiou]y -! SFX p 0 ess ll -! SFX p 0 less [^l]l -! SFX p 0 less [^ly] - SFX Q Y 44 -! SFX Q 0 tise a -! SFX Q e ise [^l]e -! SFX Q le ilise [^aeiou]le -! SFX Q e ise [aeiou]le -! SFX Q um ise um -! SFX Q 0 ise [^u]m -! SFX Q s se is -! SFX Q 0 ise [^i]s -! SFX Q y ise [^aeiou]y -! SFX Q 0 ise [aeiou]y -! SFX Q 0 ise [^aemsy] -! SFX Q 0 tises a -! SFX Q e ises [^l]e -! SFX Q le ilises [^aeiou]le -! SFX Q e ises [aeiou]le -! SFX Q um ises um -! SFX Q 0 ises [^u]m -! SFX Q s ses is -! SFX Q 0 ises [^i]s -! SFX Q y ises [^aeiou]y -! SFX Q 0 ises [aeiou]y -! SFX Q 0 ises [^aemsy] -! SFX Q 0 tised a -! SFX Q e ised [^l]e -! SFX Q le ilised [^aeiou]le -! SFX Q e ised [aeiou]le -! SFX Q um ised um -! SFX Q 0 ised [^u]m -! SFX Q s sed is -! SFX Q 0 ised [^i]s -! SFX Q y ised [^aeiou]y -! SFX Q 0 ised [aeiou]y -! SFX Q 0 ised [^aemsy] -! SFX Q 0 tising a -! SFX Q e ising [^l]e -! SFX Q le ilising [^aeiou]le -! SFX Q e ising [aeiou]le -! SFX Q um ising um -! SFX Q 0 ising [^u]m -! SFX Q s sing is -! SFX Q 0 ising [^i]s -! SFX Q y ising [^aeiou]y -! SFX Q 0 ising [aeiou]y -! SFX Q 0 ising [^aemsy] - SFX 8 Y 44 -! SFX 8 0 tize a -! SFX 8 e ize [^l]e -! SFX 8 le ilize [^aeiou]le -! SFX 8 e ize [aeiou]le -! SFX 8 um ize um -! SFX 8 0 ize [^u]m -! SFX 8 s ze is -! SFX 8 0 ize [^i]s -! SFX 8 y ize [^aeiou]y -! SFX 8 0 ize [aeiou]y -! SFX 8 0 ize [^aemsy] -! SFX 8 0 tizes a -! SFX 8 e izes [^l]e -! SFX 8 le ilizes [^aeiou]le -! SFX 8 e izes [aeiou]le -! SFX 8 um izes um -! SFX 8 0 izes [^u]m -! SFX 8 s zes is -! SFX 8 0 izes [^i]s -! SFX 8 y izes [^aeiou]y -! SFX 8 0 izes [aeiou]y -! SFX 8 0 izes [^aemsy] -! SFX 8 0 tized a -! SFX 8 e ized [^l]e -! SFX 8 le ilized [^aeiou]le -! SFX 8 e ized [aeiou]le -! SFX 8 um ized um -! SFX 8 0 ized [^u]m -! SFX 8 s zed is -! SFX 8 0 ized [^i]s -! SFX 8 y ized [^aeiou]y -! SFX 8 0 ized [aeiou]y -! SFX 8 0 ized [^aemsy] -! SFX 8 0 tizing a -! SFX 8 e izing [^l]e -! SFX 8 le ilizing [^aeiou]le -! SFX 8 e izing [aeiou]le -! SFX 8 um izing um -! SFX 8 0 izing [^u]m -! SFX 8 s zing is -! SFX 8 0 izing [^i]s -! SFX 8 y izing [^aeiou]y -! SFX 8 0 izing [aeiou]y -! SFX 8 0 izing [^aemsy] - SFX q Y 22 -! SFX q 0 tisation a -! SFX q e isation [^l]e -! SFX q le ilisation [^aeiou]le -! SFX q e isation [aeiou]le -! SFX q um isation um -! SFX q 0 isation [^u]m -! SFX q s sation is -! SFX q 0 isation [^i]s -! SFX q y isation [^aeiou]y -! SFX q 0 isation [aeiou]y -! SFX q 0 isation [^aemsy] -! SFX q 0 tisations a -! SFX q e isations [^l]e -! SFX q le ilisations [^aeiou]le -! SFX q e isations [aeiou]le -! SFX q um isations um -! SFX q 0 isations [^u]m -! SFX q s sations is -! SFX q 0 isations [^i]s -! SFX q y isations [^aeiou]y -! SFX q 0 isations [aeiou]y -! SFX q 0 isations [^aemsy] - SFX - Y 22 -! SFX - 0 tization a -! SFX - e ization [^l]e -! SFX - le ilization [^aeiou]le -! SFX - e ization [aeiou]le -! SFX - um ization um -! SFX - 0 ization [^u]m -! SFX - s zation is -! SFX - 0 ization [^i]s -! SFX - y ization [^aeiou]y -! SFX - 0 ization [aeiou]y -! SFX - 0 ization [^aemsy] -! SFX - 0 tizations a -! SFX - e izations [^l]e -! SFX - le ilizations [^aeiou]le -! SFX - e izations [aeiou]le -! SFX - um izations um -! SFX - 0 izations [^u]m -! SFX - s zations is -! SFX - 0 izations [^i]s -! SFX - y izations [^aeiou]y -! SFX - 0 izations [aeiou]y -! SFX - 0 izations [^aemsy] - SFX s Y 33 -! SFX s 0 tiser a -! SFX s e iser [^l]e -! SFX s le iliser [^aeiou]le -! SFX s e iser [aeiou]le -! SFX s um iser um -! SFX s 0 iser [^u]m -! SFX s s ser is -! SFX s 0 iser [^i]s -! SFX s y iser [^aeiou]y -! SFX s 0 iser [aeiou]y -! SFX s 0 iser [^aemsy] -! SFX s 0 tisers a -! SFX s e isers [^l]e -! SFX s le ilisers [^aeiou]le -! SFX s e isers [aeiou]le -! SFX s um isers um -! SFX s 0 isers [^u]m -! SFX s s sers is -! SFX s 0 isers [^i]s -! SFX s y isers [^aeiou]y -! SFX s 0 isers [aeiou]y -! SFX s 0 isers [^aemsy] -! SFX s 0 tiser's a -! SFX s e iser's [^l]e -! SFX s le iliser's [^aeiou]le -! SFX s e iser's [aeiou]le -! SFX s um iser's um -! SFX s 0 iser's [^u]m -! SFX s s ser's is -! SFX s 0 iser's [^i]s -! SFX s y iser's [^aeiou]y -! SFX s 0 iser's [aeiou]y -! SFX s 0 iser's [^aemsy] - SFX 9 Y 33 -! SFX 9 0 tizer a -! SFX 9 e izer [^l]e -! SFX 9 le ilizer [^aeiou]le -! SFX 9 e izer [aeiou]le -! SFX 9 um izer um -! SFX 9 0 izer [^u]m -! SFX 9 s zer is -! SFX 9 0 izer [^i]s -! SFX 9 y izer [^aeiou]y -! SFX 9 0 izer [aeiou]y -! SFX 9 0 izer [^aemsy] -! SFX 9 0 tizers a -! SFX 9 e izers [^l]e -! SFX 9 le ilizers [^aeiou]le -! SFX 9 e izers [aeiou]le -! SFX 9 um izers um -! SFX 9 0 izers [^u]m -! SFX 9 s zers is -! SFX 9 0 izers [^i]s -! SFX 9 y izers [^aeiou]y -! SFX 9 0 izers [aeiou]y -! SFX 9 0 izers [^aemsy] -! SFX 9 0 tizer's a -! SFX 9 e izer's [^l]e -! SFX 9 le ilizer's [^aeiou]le -! SFX 9 e izer's [aeiou]le -! SFX 9 um izer's um -! SFX 9 0 izer's [^u]m -! SFX 9 s zer's is -! SFX 9 0 izer's [^i]s -! SFX 9 y izer's [^aeiou]y -! SFX 9 0 izer's [aeiou]y -! SFX 9 0 izer's [^aemsy] - SFX t Y 22 -! SFX t 0 tisable a -! SFX t e isable [^l]e -! SFX t le ilisable [^aeiou]le -! SFX t e isable [aeiou]le -! SFX t um isable um -! SFX t 0 isable [^u]m -! SFX t s sable is -! SFX t 0 isable [^i]s -! SFX t y isable [^aeiou]y -! SFX t 0 isable [aeiou]y -! SFX t 0 isable [^aemsy] -! SFX t 0 tisability a -! SFX t e isability [^l]e -! SFX t le ilisability [^aeiou]le -! SFX t e isability [aeiou]le -! SFX t um isability um -! SFX t 0 isability [^u]m -! SFX t s sability is -! SFX t 0 isability [^i]s -! SFX t y isability [^aeiou]y -! SFX t 0 isability [aeiou]y -! SFX t 0 isability [^aemsy] - SFX + Y 22 -! SFX + 0 tizable a -! SFX + e izable [^l]e -! SFX + le ilizable [^aeiou]le -! SFX + e izable [aeiou]le -! SFX + um izable um -! SFX + 0 izable [^u]m -! SFX + s zable is -! SFX + 0 izable [^i]s -! SFX + y izable [^aeiou]y -! SFX + 0 izable [aeiou]y -! SFX + 0 izable [^aemsy] -! SFX + 0 tizability a -! SFX + e izability [^l]e -! SFX + le ilizability [^aeiou]le -! SFX + e izability [aeiou]le -! SFX + um izability um -! SFX + 0 izability [^u]m -! SFX + s zability is -! SFX + 0 izability [^i]s -! SFX + y izability [^aeiou]y -! SFX + 0 izability [aeiou]y -! SFX + 0 izability [^aemsy] - SFX M Y 1 -! SFX M 0 's . - SFX B Y 48 -! SFX B e able [^acegilotu]e -! SFX B 0 able [acegilou]e -! SFX B te ble ate -! SFX B e able [^a]te -! SFX B 0 bable [^aeio][aeiou]b -! SFX B 0 kable [^aeio][aeiou]c -! SFX B 0 dable [^aeio][aeiou]d -! SFX B 0 fable [^aeio][aeiou]f -! SFX B 0 gable [^aeio][aeiou]g -! SFX B 0 kable [^aeio][aeiou]k -! SFX B 0 lable [^aeio][aeiou]l -! SFX B 0 mable [^aeio][aeiou]m -! SFX B 0 nable [^aeio][aeiou]n -! SFX B 0 pable [^aeio][aeiou]p -! SFX B 0 rable [^aeio][aeiou]r -! SFX B 0 sable [^aeio][aeiou]s -! SFX B 0 table [^aeio][aeiou]t -! SFX B 0 vable [^aeio][aeiou]v -! SFX B 0 zable [^aeio][aeiou]z -! SFX B 0 able [aeio][aeiou][bcdfgklmnprstvz] -! SFX B 0 able [^aeiou][bcdfgklmnprstvz] -! SFX B y iable [^aeiou]y -! SFX B 0 able [aeiou]y -! SFX B 0 able [^ebcdfgklmnprstvzy] -! SFX B e ability [^acegilotu]e -! SFX B 0 ability [acegilou]e -! SFX B te bility ate -! SFX B e ability [^a]te -! SFX B 0 bability [^aeio][aeiou]b -! SFX B 0 kability [^aeio][aeiou]c -! SFX B 0 dability [^aeio][aeiou]d -! SFX B 0 fability [^aeio][aeiou]f -! SFX B 0 gability [^aeio][aeiou]g -! SFX B 0 kability [^aeio][aeiou]k -! SFX B 0 lability [^aeio][aeiou]l -! SFX B 0 mability [^aeio][aeiou]m -! SFX B 0 nability [^aeio][aeiou]n -! SFX B 0 pability [^aeio][aeiou]p -! SFX B 0 rability [^aeio][aeiou]r -! SFX B 0 sability [^aeio][aeiou]s -! SFX B 0 tability [^aeio][aeiou]t -! SFX B 0 vability [^aeio][aeiou]v -! SFX B 0 zability [^aeio][aeiou]z -! SFX B 0 ability [aeio][aeiou][bcdfgklmnprstvz] -! SFX B 0 ability [^aeiou][bcdfgklmnprstvz] -! SFX B y iability [^aeiou]y -! SFX B 0 ability [aeiou]y -! SFX B 0 ability [^ebcdfgklmnprstvzy] - SFX 7 Y 9 -! SFX 7 e able [acegilou]e -! SFX 7 0 able [^acegilou]e -! SFX 7 0 kable [^aeio][aeiou]c -! SFX 7 0 lable [^aeio][aeiou]l -! SFX 7 0 able [aeio][aeiou][cl] -! SFX 7 0 able [^aeiou][cl] -! SFX 7 y iable [^aeiou]y -! SFX 7 0 able [aeiou]y -! SFX 7 0 able [^cely] - SFX g Y 9 -! SFX g e ability [^acegilou]e -! SFX g 0 ability [acegilou]e -! SFX g 0 kability [^aeio][aeiou]c -! SFX g 0 lability [^aeio][aeiou]l -! SFX g 0 ability [aeio][aeiou][cl] -! SFX g 0 ability [^aeiou][cl] -! SFX g y iability [^aeiou]y -! SFX g 0 ability [aeiou]y -! SFX g 0 ability [^cely] - SFX l Y 9 -! SFX l e ably [^acegilou]e -! SFX l 0 ably [acegilou]e -! SFX l 0 kably [^aeio][aeiou]c -! SFX l 0 lably [^aeio][aeiou]l -! SFX l 0 ably [aeio][aeiou][cl] -! SFX l 0 ably [^aeiou][cl] -! SFX l y iably [^aeiou]y -! SFX l 0 ably [aeiou]y -! SFX l 0 ably [^cely] - SFX b Y 3 -! SFX b e ible [^aeiou]e -! SFX b 0 ible [aeiou]e -! SFX b 0 ible [^e] - SFX L Y 12 -! SFX L 0 ament m -! SFX L y iment [^aeiou]y -! SFX L 0 ment [aeiou]y -! SFX L 0 ment [^my] -! SFX L 0 aments m -! SFX L y iments [^aeiou]y -! SFX L 0 ments [aeiou]y -! SFX L 0 ments [^my] -! SFX L 0 ament's m -! SFX L y iment's [^aeiou]y -! SFX L 0 ment's [aeiou]y -! SFX L 0 ment's [^my] - SFX Z Y 22 -! SFX Z e y [^aeiouy]e -! SFX Z 0 y [aeiouy]e -! SFX Z 0 ey [aiouy] -! SFX Z 0 by [^aeio][aeiou]b -! SFX Z 0 ky [^aeio][aeiou]c -! SFX Z 0 dy [^aeio][aeiou]d -! SFX Z 0 fy [^aeio][aeiou]f -! SFX Z 0 gy [^aeio][aeiou]g -! SFX Z 0 ky [^aeio][aeiou]k -! SFX Z 0 ly [^aeio][aeiou]l -! SFX Z 0 my [^aeio][aeiou]m -! SFX Z 0 ny [^aeio][aiou]n -! SFX Z 0 py [^aeio][aeiou]p -! SFX Z 0 ry [^aeio][aiou]r -! SFX Z 0 sy [^aeio][aeiou]s -! SFX Z 0 ty [^aeio][aiou]t -! SFX Z 0 vy [^aeio][aeiou]v -! SFX Z 0 zy [^aeio][aeiou]z -! SFX Z 0 y [^aeio]e[nrt] -! SFX Z 0 y [aeio][aeiou][bcdfgklmnprstvz] -! SFX Z 0 y [^aeiou][bcdfgklmnprstvz] -! SFX Z 0 y [^aebcdfgiklmnoprstuvyz] - SFX 2 Y 21 -! SFX 2 e iness [^aeiouy]e -! SFX 2 0 iness [aeiouy]e -! SFX 2 0 biness [^aeio][aeiou]b -! SFX 2 0 kiness [^aeio][aeiou]c -! SFX 2 0 diness [^aeio][aeiou]d -! SFX 2 0 finess [^aeio][aeiou]f -! SFX 2 0 giness [^aeio][aeiou]g -! SFX 2 0 kiness [^aeio][aeiou]k -! SFX 2 0 liness [^aeio][aeiou]l -! SFX 2 0 miness [^aeio][aeiou]m -! SFX 2 0 niness [^aeio][aiou]n -! SFX 2 0 piness [^aeio][aeiou]p -! SFX 2 0 riness [^aeio][aiou]r -! SFX 2 0 siness [^aeio][aeiou]s -! SFX 2 0 tiness [^aeio][aiou]t -! SFX 2 0 viness [^aeio][aeiou]v -! SFX 2 0 ziness [^aeio][aeiou]z -! SFX 2 0 iness [^aeio]e[nrt] -! SFX 2 0 iness [aeio][aeiou][bcdfgklmnprstvz] -! SFX 2 0 iness [^aeiou][bcdfgklmnprstvz] -! SFX 2 0 iness [^ebcdfgklmnprstvz] - SFX z Y 24 -! SFX z e ily [^aeiouy]e -! SFX z 0 ily [aeiouy]e -! SFX z 0 ily [aiou]y -! SFX z ey ily ey -! SFX z y ily [^aeiou]y -! SFX z 0 bily [^aeio][aeiou]b -! SFX z 0 kily [^aeio][aeiou]c -! SFX z 0 dily [^aeio][aeiou]d -! SFX z 0 fily [^aeio][aeiou]f -! SFX z 0 gily [^aeio][aeiou]g -! SFX z 0 kily [^aeio][aeiou]k -! SFX z 0 lily [^aeio][aeiou]l -! SFX z 0 mily [^aeio][aeiou]m -! SFX z 0 nily [^aeio][aiou]n -! SFX z 0 pily [^aeio][aeiou]p -! SFX z 0 rily [^aeio][aiou]r -! SFX z 0 sily [^aeio][aeiou]s -! SFX z 0 tily [^aeio][aiou]t -! SFX z 0 vily [^aeio][aeiou]v -! SFX z 0 zily [^aeio][aeiou]z -! SFX z 0 ily [^aeio]e[nrt] -! SFX z 0 ily [aeio][aeiou][bcdfgklmnprstvyz] -! SFX z 0 ily [^aeiou][bcdfgklmnprstvyz] -! SFX z 0 ily [^ebcdfgklmnprstvyz] - SFX y Y 15 -! SFX y e ory te -! SFX y e atory [mr]e -! SFX y e ary se -! SFX y 0 ry [^mrst]e -! SFX y 0 ory [^aeous]t -! SFX y 0 ry [aeous]t -! SFX y 0 ery h -! SFX y 0 atory [^i]m -! SFX y im matory im -! SFX y 0 ory s -! SFX y 0 ary ion -! SFX y 0 ry [^i]on -! SFX y 0 nery [aiu]n -! SFX y 0 ry [^aiou]n -! SFX y 0 ry [^ehmstn] - SFX O Y 12 -! SFX O 0 l a -! SFX O e al [^bcgv]e -! SFX O e ial [bcgv]e -! SFX O 0 ial [bcrx] -! SFX O um al um -! SFX O 0 al [^u]m -! SFX O y al ty -! SFX O y ial [^t]y -! SFX O 0 ual [px]t -! SFX O 0 tal [iu]t -! SFX O 0 al [^ipux]t -! SFX O 0 al [^aebcrtxmy] - SFX o Y 12 -! SFX o 0 lly a -! SFX o e ally [^bcgv]e -! SFX o e ially [bcgv]e -! SFX o 0 ially [bcrx] -! SFX o um ally um -! SFX o 0 ally [^u]m -! SFX o y ally ty -! SFX o y ially [^t]y -! SFX o 0 ually [px]t -! SFX o 0 tally [iu]t -! SFX o 0 ally [^ipux]t -! SFX o 0 ally [^aebcrtxmy] - SFX W Y 21 -! SFX W ce tific ce -! SFX W e atic me -! SFX W se tic se -! SFX W le ic ble -! SFX W e ic [^b]le -! SFX W e ic [^clms]e -! SFX W 0 lic [ay]l -! SFX W 0 ic [^ay]l -! SFX W us ic us -! SFX W 0 tic [^u]s -! SFX W er ric er -! SFX W 0 ic [^e]r -! SFX W 0 atic [aeiou]m -! SFX W 0 ic [^aeiou]m -! SFX W 0 tic ma -! SFX W a ic [^m]a -! SFX W y etic thy -! SFX W y ic [^t]hy -! SFX W y tic sy -! SFX W y ic [^hs]y -! SFX W 0 ic [^aelmrsy] - SFX w Y 9 -! SFX w e ical e -! SFX w er rical er -! SFX w 0 ical [^e]r -! SFX w 0 atical [aeiou]m -! SFX w 0 ical [^aeiou]m -! SFX w 0 tical ma -! SFX w a ical [^m]a -! SFX w y ical y -! SFX w 0 ical [^aemry] - SFX 1 Y 9 -! SFX 1 e ically e -! SFX 1 er rically er -! SFX 1 0 ically [^e]r -! SFX 1 0 atically [aeiou]m -! SFX 1 0 ically [^aeiou]m -! SFX 1 0 tically ma -! SFX 1 a ically [^m]a -! SFX 1 y ically y -! SFX 1 0 ically [^aemry] - SFX 3 Y 21 -! SFX 3 e ist [^aceiou]e -! SFX 3 ce tist ce -! SFX 3 0 ist [aeiou]e -! SFX 3 y ist [^aeioubp]y -! SFX 3 0 ist [aeioubp]y -! SFX 3 o ist o -! SFX 3 0 ists [^eoy] -! SFX 3 e ists [^aceiou]e -! SFX 3 ce tists ce -! SFX 3 0 ists [aeiou]e -! SFX 3 y ists [^aeioubp]y -! SFX 3 0 ists [aeioubp]y -! SFX 3 o ists o -! SFX 3 0 ists [^eoy] -! SFX 3 e ist's [^aceiou]e -! SFX 3 ce tist's ce -! SFX 3 0 ist's [aeiou]e -! SFX 3 y ist's [^aeioubp]y -! SFX 3 0 ist's [aeioubp]y -! SFX 3 o ist's o -! SFX 3 0 ist's [^eoy] ---- 599,1288 ---- - SFX R Y 72 -! SFX R 0 r e -! SFX R 0 rs e -! SFX R 0 ber [^aeio][aeiou]b -! SFX R 0 bers [^aeio][aeiou]b -! SFX R 0 ker [^aeio][aeiou]c -! SFX R 0 kers [^aeio][aeiou]c -! SFX R 0 der [^aeio][aeiou]d -! SFX R 0 ders [^aeio][aeiou]d -! SFX R 0 fer [^aeio][aeiou]f -! SFX R 0 fers [^aeio][aeiou]f -! SFX R 0 ger [^aeio][aeiou]g -! SFX R 0 gers [^aeio][aeiou]g -! SFX R 0 ker [^aeio][aeiou]k -! SFX R 0 kers [^aeio][aeiou]k -! SFX R 0 ler [^aeio][eiou]l -! SFX R 0 er [aeio][eiou]l -! SFX R 0 ler [^aeo]al -! SFX R 0 er [aeo]al -! SFX R 0 lers [^aeio][eiou]l -! SFX R 0 ers [aeio][eiou]l -! SFX R 0 lers [^aeo]al -! SFX R 0 ers [aeo]al -! SFX R 0 mer [^aeio][aeiou]m -! SFX R 0 mers [^aeio][aeiou]m -! SFX R 0 ner [^aeio][aeiou]n -! SFX R 0 ners [^aeio][aeiou]n -! SFX R 0 per [^aeio][aeiou]p -! SFX R 0 pers [^aeio][aeiou]p -! SFX R 0 rer [^aeio][aeiou]r -! SFX R 0 rers [^aeio][aeiou]r -! SFX R 0 ser [^aeio][aeiou]s -! SFX R 0 sers [^aeio][aeiou]s -! SFX R 0 ter [^aeio][aeiou]t -! SFX R 0 ters [^aeio][aeiou]t -! SFX R 0 ver [^aeio][aeiou]v -! SFX R 0 vers [^aeio][aeiou]v -! SFX R 0 zer [^aeio][aeiou]z -! SFX R 0 zers [^aeio][aeiou]z -! SFX R y ier [^aeiou]y -! SFX R y iers [^aeiou]y -! SFX R 0 er [aeiou]y -! SFX R 0 ers [aeiou]y -! SFX R 0 er [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 ers [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 er [^aeiou][bcdfgklmnprstvz] -! SFX R 0 ers [^aeiou][bcdfgklmnprstvz] -! SFX R 0 er [^ebcdfgklmnprstvyz] -! SFX R 0 ers [^ebcdfgklmnprstvyz] -! SFX R 0 r's e -! SFX R 0 ber's [^aeio][aeiou]b -! SFX R 0 ker's [^aeio][aeiou]c -! SFX R 0 der's [^aeio][aeiou]d -! SFX R 0 fer's [^aeio][aeiou]f -! SFX R 0 ger's [^aeio][aeiou]g -! SFX R 0 ker's [^aeio][aeiou]k -! SFX R 0 ler's [^aeio][eiou]l -! SFX R 0 er's [aeio][eiou]l -! SFX R 0 ler's [^aeo]al -! SFX R 0 er's [aeo]al -! SFX R 0 mer's [^aeio][aeiou]m -! SFX R 0 ner's [^aeio][aeiou]n -! SFX R 0 per's [^aeio][aeiou]p -! SFX R 0 rer's [^aeio][aeiou]r -! SFX R 0 ser's [^aeio][aeiou]s -! SFX R 0 ter's [^aeio][aeiou]t -! SFX R 0 ver's [^aeio][aeiou]v -! SFX R 0 zer's [^aeio][aeiou]z -! SFX R y ier's [^aeiou]y -! SFX R 0 er's [aeiou]y -! SFX R 0 er's [aeio][aeiou][bcdfgkmnprstvz] -! SFX R 0 er's [^aeiou][bcdfgklmnprstvz] -! SFX R 0 er's [^ebcdfgklmnprstvyz] - SFX r Y 24 -! SFX r 0 r e -! SFX r 0 ler [^aeio][aeiou]l -! SFX r 0 ker [^aeio][aeiou]c -! SFX r y ier [^aeiou]y -! SFX r 0 er [aeiou]y -! SFX r 0 er [aeio][aeiou][cl] -! SFX r 0 er [^aeiou][cl] -! SFX r 0 er [^ecly] -! SFX r 0 rs e -! SFX r 0 lers [^aeio][aeiou]l -! SFX r 0 kers [^aeio][aeiou]c -! SFX r y iers [^aeiou]y -! SFX r 0 ers [aeiou]y -! SFX r 0 ers [aeio][aeiou][cl] -! SFX r 0 ers [^aeiou][cl] -! SFX r 0 ers [^ecly] -! SFX r 0 r's e -! SFX r 0 ler's [^aeio][aeiou]l -! SFX r 0 ker's [^aeio][aeiou]c -! SFX r y ier's [^aeiou]y -! SFX r 0 er's [aeiou]y -! SFX r 0 er's [aeio][aeiou][cl] -! SFX r 0 er's [^aeiou][cl] -! SFX r 0 er's [^ecly] - SFX S Y 9 -! SFX S y ies [^aeiou]y -! SFX S 0 s [aeiou]y -! SFX S 0 es [sxz] -! SFX S 0 es [cs]h -! SFX S 0 s [^cs]h -! SFX S 0 s [ae]u -! SFX S 0 x [ae]u -! SFX S 0 s [^ae]u - SFX S 0 s [^hsuxyz] - SFX P Y 6 -! SFX P y iness [^aeiou]y -! SFX P 0 ness [aeiou]y -! SFX P 0 ness [^y] -! SFX P y iness's [^aeiou]y -! SFX P 0 ness's [aeiou]y -! SFX P 0 ness's [^y] - SFX m Y 20 -! SFX m 0 sman [bdknmt] -! SFX m 0 sman [aeiou][bdklmnt]e -! SFX m 0 man [^aeiou][bdklmnt]e -! SFX m 0 man [^bdklmnt]e -! SFX m 0 man [^bdeknmt] -! SFX m 0 smen [bdknmt] -! SFX m 0 smen [aeiou][bdklmnt]e -! SFX m 0 men [^aeiou][bdklmnt]e -! SFX m 0 men [^bdklmnt]e -! SFX m 0 men [^bdeknmt] -! SFX m 0 sman's [bdknmt] -! SFX m 0 sman's [aeiou][bdklmnt]e -! SFX m 0 man's [^aeiou][bdklmnt]e -! SFX m 0 man's [^bdklmnt]e -! SFX m 0 man's [^bdeknmt] -! SFX m 0 smen's [bdknmt] -! SFX m 0 smen's [aeiou][bdklmnt]e -! SFX m 0 men's [^aeiou][bdklmnt]e -! SFX m 0 men's [^bdklmnt]e -! SFX m 0 men's [^bdeknmt] - SFX 5 Y 15 -! SFX 5 0 swoman [bdknmt] -! SFX 5 0 swoman [aeiou][bdklmnt]e -! SFX 5 0 woman [^aeiou][bdklmnt]e -! SFX 5 0 woman [^bdklmnt]e -! SFX 5 0 woman [^bdeknmt] -! SFX 5 0 swomen [bdknmt] -! SFX 5 0 swomen [aeiou][bdklmnt]e -! SFX 5 0 women [^aeiou][bdklmnt]e -! SFX 5 0 women [^bdklmnt]e -! SFX 5 0 women [^bdeknmt] -! SFX 5 0 swoman's [bdknmt] -! SFX 5 0 swoman's [aeiou][bdklmnt]e -! SFX 5 0 woman's [^aeiou][bdklmnt]e -! SFX 5 0 woman's [^bdklmnt]e -! SFX 5 0 woman's [^bdeknmt] - SFX 6 Y 3 -! SFX 6 y iful [^aeiou]y -! SFX 6 0 ful [aeiou]y -! SFX 6 0 ful [^y] - SFX j Y 3 -! SFX j y ifully [^aeiou]y -! SFX j 0 fully [aeiou]y -! SFX j 0 fully [^y] - SFX p Y 5 -! SFX p y iless [^aeiou]y -! SFX p 0 less [aeiou]y -! SFX p 0 ess ll -! SFX p 0 less [^l]l -! SFX p 0 less [^ly] - SFX Q Y 44 -! SFX Q 0 tise a -! SFX Q e ise [^l]e -! SFX Q le ilise [^aeiou]le -! SFX Q e ise [aeiou]le -! SFX Q um ise um -! SFX Q 0 ise [^u]m -! SFX Q s se is -! SFX Q 0 ise [^i]s -! SFX Q y ise [^aeiou]y -! SFX Q 0 ise [aeiou]y -! SFX Q 0 ise [^aemsy] -! SFX Q 0 tises a -! SFX Q e ises [^l]e -! SFX Q le ilises [^aeiou]le -! SFX Q e ises [aeiou]le -! SFX Q um ises um -! SFX Q 0 ises [^u]m -! SFX Q s ses is -! SFX Q 0 ises [^i]s -! SFX Q y ises [^aeiou]y -! SFX Q 0 ises [aeiou]y -! SFX Q 0 ises [^aemsy] -! SFX Q 0 tised a -! SFX Q e ised [^l]e -! SFX Q le ilised [^aeiou]le -! SFX Q e ised [aeiou]le -! SFX Q um ised um -! SFX Q 0 ised [^u]m -! SFX Q s sed is -! SFX Q 0 ised [^i]s -! SFX Q y ised [^aeiou]y -! SFX Q 0 ised [aeiou]y -! SFX Q 0 ised [^aemsy] -! SFX Q 0 tising a -! SFX Q e ising [^l]e -! SFX Q le ilising [^aeiou]le -! SFX Q e ising [aeiou]le -! SFX Q um ising um -! SFX Q 0 ising [^u]m -! SFX Q s sing is -! SFX Q 0 ising [^i]s -! SFX Q y ising [^aeiou]y -! SFX Q 0 ising [aeiou]y -! SFX Q 0 ising [^aemsy] - SFX 8 Y 44 -! SFX 8 0 tize a -! SFX 8 e ize [^l]e -! SFX 8 le ilize [^aeiou]le -! SFX 8 e ize [aeiou]le -! SFX 8 um ize um -! SFX 8 0 ize [^u]m -! SFX 8 s ze is -! SFX 8 0 ize [^i]s -! SFX 8 y ize [^aeiou]y -! SFX 8 0 ize [aeiou]y -! SFX 8 0 ize [^aemsy] -! SFX 8 0 tizes a -! SFX 8 e izes [^l]e -! SFX 8 le ilizes [^aeiou]le -! SFX 8 e izes [aeiou]le -! SFX 8 um izes um -! SFX 8 0 izes [^u]m -! SFX 8 s zes is -! SFX 8 0 izes [^i]s -! SFX 8 y izes [^aeiou]y -! SFX 8 0 izes [aeiou]y -! SFX 8 0 izes [^aemsy] -! SFX 8 0 tized a -! SFX 8 e ized [^l]e -! SFX 8 le ilized [^aeiou]le -! SFX 8 e ized [aeiou]le -! SFX 8 um ized um -! SFX 8 0 ized [^u]m -! SFX 8 s zed is -! SFX 8 0 ized [^i]s -! SFX 8 y ized [^aeiou]y -! SFX 8 0 ized [aeiou]y -! SFX 8 0 ized [^aemsy] -! SFX 8 0 tizing a -! SFX 8 e izing [^l]e -! SFX 8 le ilizing [^aeiou]le -! SFX 8 e izing [aeiou]le -! SFX 8 um izing um -! SFX 8 0 izing [^u]m -! SFX 8 s zing is -! SFX 8 0 izing [^i]s -! SFX 8 y izing [^aeiou]y -! SFX 8 0 izing [aeiou]y -! SFX 8 0 izing [^aemsy] - SFX q Y 22 -! SFX q 0 tisation a -! SFX q e isation [^l]e -! SFX q le ilisation [^aeiou]le -! SFX q e isation [aeiou]le -! SFX q um isation um -! SFX q 0 isation [^u]m -! SFX q s sation is -! SFX q 0 isation [^i]s -! SFX q y isation [^aeiou]y -! SFX q 0 isation [aeiou]y -! SFX q 0 isation [^aemsy] -! SFX q 0 tisations a -! SFX q e isations [^l]e -! SFX q le ilisations [^aeiou]le -! SFX q e isations [aeiou]le -! SFX q um isations um -! SFX q 0 isations [^u]m -! SFX q s sations is -! SFX q 0 isations [^i]s -! SFX q y isations [^aeiou]y -! SFX q 0 isations [aeiou]y -! SFX q 0 isations [^aemsy] - SFX - Y 22 -! SFX - 0 tization a -! SFX - e ization [^l]e -! SFX - le ilization [^aeiou]le -! SFX - e ization [aeiou]le -! SFX - um ization um -! SFX - 0 ization [^u]m -! SFX - s zation is -! SFX - 0 ization [^i]s -! SFX - y ization [^aeiou]y -! SFX - 0 ization [aeiou]y -! SFX - 0 ization [^aemsy] -! SFX - 0 tizations a -! SFX - e izations [^l]e -! SFX - le ilizations [^aeiou]le -! SFX - e izations [aeiou]le -! SFX - um izations um -! SFX - 0 izations [^u]m -! SFX - s zations is -! SFX - 0 izations [^i]s -! SFX - y izations [^aeiou]y -! SFX - 0 izations [aeiou]y -! SFX - 0 izations [^aemsy] - SFX s Y 33 -! SFX s 0 tiser a -! SFX s e iser [^l]e -! SFX s le iliser [^aeiou]le -! SFX s e iser [aeiou]le -! SFX s um iser um -! SFX s 0 iser [^u]m -! SFX s s ser is -! SFX s 0 iser [^i]s -! SFX s y iser [^aeiou]y -! SFX s 0 iser [aeiou]y -! SFX s 0 iser [^aemsy] -! SFX s 0 tisers a -! SFX s e isers [^l]e -! SFX s le ilisers [^aeiou]le -! SFX s e isers [aeiou]le -! SFX s um isers um -! SFX s 0 isers [^u]m -! SFX s s sers is -! SFX s 0 isers [^i]s -! SFX s y isers [^aeiou]y -! SFX s 0 isers [aeiou]y -! SFX s 0 isers [^aemsy] -! SFX s 0 tiser's a -! SFX s e iser's [^l]e -! SFX s le iliser's [^aeiou]le -! SFX s e iser's [aeiou]le -! SFX s um iser's um -! SFX s 0 iser's [^u]m -! SFX s s ser's is -! SFX s 0 iser's [^i]s -! SFX s y iser's [^aeiou]y -! SFX s 0 iser's [aeiou]y -! SFX s 0 iser's [^aemsy] - SFX 9 Y 33 -! SFX 9 0 tizer a -! SFX 9 e izer [^l]e -! SFX 9 le ilizer [^aeiou]le -! SFX 9 e izer [aeiou]le -! SFX 9 um izer um -! SFX 9 0 izer [^u]m -! SFX 9 s zer is -! SFX 9 0 izer [^i]s -! SFX 9 y izer [^aeiou]y -! SFX 9 0 izer [aeiou]y -! SFX 9 0 izer [^aemsy] -! SFX 9 0 tizers a -! SFX 9 e izers [^l]e -! SFX 9 le ilizers [^aeiou]le -! SFX 9 e izers [aeiou]le -! SFX 9 um izers um -! SFX 9 0 izers [^u]m -! SFX 9 s zers is -! SFX 9 0 izers [^i]s -! SFX 9 y izers [^aeiou]y -! SFX 9 0 izers [aeiou]y -! SFX 9 0 izers [^aemsy] -! SFX 9 0 tizer's a -! SFX 9 e izer's [^l]e -! SFX 9 le ilizer's [^aeiou]le -! SFX 9 e izer's [aeiou]le -! SFX 9 um izer's um -! SFX 9 0 izer's [^u]m -! SFX 9 s zer's is -! SFX 9 0 izer's [^i]s -! SFX 9 y izer's [^aeiou]y -! SFX 9 0 izer's [aeiou]y -! SFX 9 0 izer's [^aemsy] - SFX t Y 22 -! SFX t 0 tisable a -! SFX t e isable [^l]e -! SFX t le ilisable [^aeiou]le -! SFX t e isable [aeiou]le -! SFX t um isable um -! SFX t 0 isable [^u]m -! SFX t s sable is -! SFX t 0 isable [^i]s -! SFX t y isable [^aeiou]y -! SFX t 0 isable [aeiou]y -! SFX t 0 isable [^aemsy] -! SFX t 0 tisability a -! SFX t e isability [^l]e -! SFX t le ilisability [^aeiou]le -! SFX t e isability [aeiou]le -! SFX t um isability um -! SFX t 0 isability [^u]m -! SFX t s sability is -! SFX t 0 isability [^i]s -! SFX t y isability [^aeiou]y -! SFX t 0 isability [aeiou]y -! SFX t 0 isability [^aemsy] - SFX + Y 22 -! SFX + 0 tizable a -! SFX + e izable [^l]e -! SFX + le ilizable [^aeiou]le -! SFX + e izable [aeiou]le -! SFX + um izable um -! SFX + 0 izable [^u]m -! SFX + s zable is -! SFX + 0 izable [^i]s -! SFX + y izable [^aeiou]y -! SFX + 0 izable [aeiou]y -! SFX + 0 izable [^aemsy] -! SFX + 0 tizability a -! SFX + e izability [^l]e -! SFX + le ilizability [^aeiou]le -! SFX + e izability [aeiou]le -! SFX + um izability um -! SFX + 0 izability [^u]m -! SFX + s zability is -! SFX + 0 izability [^i]s -! SFX + y izability [^aeiou]y -! SFX + 0 izability [aeiou]y -! SFX + 0 izability [^aemsy] - SFX M Y 1 -! SFX M 0 's . - SFX B Y 48 -! SFX B e able [^acegilotu]e -! SFX B 0 able [acegilou]e -! SFX B te ble ate -! SFX B e able [^a]te -! SFX B 0 bable [^aeio][aeiou]b -! SFX B 0 kable [^aeio][aeiou]c -! SFX B 0 dable [^aeio][aeiou]d -! SFX B 0 fable [^aeio][aeiou]f -! SFX B 0 gable [^aeio][aeiou]g -! SFX B 0 kable [^aeio][aeiou]k -! SFX B 0 lable [^aeio][aeiou]l -! SFX B 0 mable [^aeio][aeiou]m -! SFX B 0 nable [^aeio][aeiou]n -! SFX B 0 pable [^aeio][aeiou]p -! SFX B 0 rable [^aeio][aeiou]r -! SFX B 0 sable [^aeio][aeiou]s -! SFX B 0 table [^aeio][aeiou]t -! SFX B 0 vable [^aeio][aeiou]v -! SFX B 0 zable [^aeio][aeiou]z -! SFX B 0 able [aeio][aeiou][bcdfgklmnprstvz] -! SFX B 0 able [^aeiou][bcdfgklmnprstvz] -! SFX B y iable [^aeiou]y -! SFX B 0 able [aeiou]y -! SFX B 0 able [^ebcdfgklmnprstvzy] -! SFX B e ability [^acegilotu]e -! SFX B 0 ability [acegilou]e -! SFX B te bility ate -! SFX B e ability [^a]te -! SFX B 0 bability [^aeio][aeiou]b -! SFX B 0 kability [^aeio][aeiou]c -! SFX B 0 dability [^aeio][aeiou]d -! SFX B 0 fability [^aeio][aeiou]f -! SFX B 0 gability [^aeio][aeiou]g -! SFX B 0 kability [^aeio][aeiou]k -! SFX B 0 lability [^aeio][aeiou]l -! SFX B 0 mability [^aeio][aeiou]m -! SFX B 0 nability [^aeio][aeiou]n -! SFX B 0 pability [^aeio][aeiou]p -! SFX B 0 rability [^aeio][aeiou]r -! SFX B 0 sability [^aeio][aeiou]s -! SFX B 0 tability [^aeio][aeiou]t -! SFX B 0 vability [^aeio][aeiou]v -! SFX B 0 zability [^aeio][aeiou]z -! SFX B 0 ability [aeio][aeiou][bcdfgklmnprstvz] -! SFX B 0 ability [^aeiou][bcdfgklmnprstvz] -! SFX B y iability [^aeiou]y -! SFX B 0 ability [aeiou]y -! SFX B 0 ability [^ebcdfgklmnprstvzy] - SFX 7 Y 9 -! SFX 7 e able [acegilou]e -! SFX 7 0 able [^acegilou]e -! SFX 7 0 kable [^aeio][aeiou]c -! SFX 7 0 lable [^aeio][aeiou]l -! SFX 7 0 able [aeio][aeiou][cl] -! SFX 7 0 able [^aeiou][cl] -! SFX 7 y iable [^aeiou]y -! SFX 7 0 able [aeiou]y -! SFX 7 0 able [^cely] - SFX g Y 9 -! SFX g e ability [^acegilou]e -! SFX g 0 ability [acegilou]e -! SFX g 0 kability [^aeio][aeiou]c -! SFX g 0 lability [^aeio][aeiou]l -! SFX g 0 ability [aeio][aeiou][cl] -! SFX g 0 ability [^aeiou][cl] -! SFX g y iability [^aeiou]y -! SFX g 0 ability [aeiou]y -! SFX g 0 ability [^cely] - SFX l Y 9 -! SFX l e ably [^acegilou]e -! SFX l 0 ably [acegilou]e -! SFX l 0 kably [^aeio][aeiou]c -! SFX l 0 lably [^aeio][aeiou]l -! SFX l 0 ably [aeio][aeiou][cl] -! SFX l 0 ably [^aeiou][cl] -! SFX l y iably [^aeiou]y -! SFX l 0 ably [aeiou]y -! SFX l 0 ably [^cely] - SFX b Y 3 -! SFX b e ible [^aeiou]e -! SFX b 0 ible [aeiou]e -! SFX b 0 ible [^e] - SFX L Y 12 -! SFX L 0 ament m -! SFX L y iment [^aeiou]y -! SFX L 0 ment [aeiou]y -! SFX L 0 ment [^my] -! SFX L 0 aments m -! SFX L y iments [^aeiou]y -! SFX L 0 ments [aeiou]y -! SFX L 0 ments [^my] -! SFX L 0 ament's m -! SFX L y iment's [^aeiou]y -! SFX L 0 ment's [aeiou]y -! SFX L 0 ment's [^my] - SFX Z Y 22 -! SFX Z e y [^aeiouy]e -! SFX Z 0 y [aeiouy]e -! SFX Z 0 ey [aiouy] -! SFX Z 0 by [^aeio][aeiou]b -! SFX Z 0 ky [^aeio][aeiou]c -! SFX Z 0 dy [^aeio][aeiou]d -! SFX Z 0 fy [^aeio][aeiou]f -! SFX Z 0 gy [^aeio][aeiou]g -! SFX Z 0 ky [^aeio][aeiou]k -! SFX Z 0 ly [^aeio][aeiou]l -! SFX Z 0 my [^aeio][aeiou]m -! SFX Z 0 ny [^aeio][aiou]n -! SFX Z 0 py [^aeio][aeiou]p -! SFX Z 0 ry [^aeio][aiou]r -! SFX Z 0 sy [^aeio][aeiou]s -! SFX Z 0 ty [^aeio][aiou]t -! SFX Z 0 vy [^aeio][aeiou]v -! SFX Z 0 zy [^aeio][aeiou]z -! SFX Z 0 y [^aeio]e[nrt] -! SFX Z 0 y [aeio][aeiou][bcdfgklmnprstvz] -! SFX Z 0 y [^aeiou][bcdfgklmnprstvz] -! SFX Z 0 y [^aebcdfgiklmnoprstuvyz] - SFX 2 Y 21 -! SFX 2 e iness [^aeiouy]e -! SFX 2 0 iness [aeiouy]e -! SFX 2 0 biness [^aeio][aeiou]b -! SFX 2 0 kiness [^aeio][aeiou]c -! SFX 2 0 diness [^aeio][aeiou]d -! SFX 2 0 finess [^aeio][aeiou]f -! SFX 2 0 giness [^aeio][aeiou]g -! SFX 2 0 kiness [^aeio][aeiou]k -! SFX 2 0 liness [^aeio][aeiou]l -! SFX 2 0 miness [^aeio][aeiou]m -! SFX 2 0 niness [^aeio][aiou]n -! SFX 2 0 piness [^aeio][aeiou]p -! SFX 2 0 riness [^aeio][aiou]r -! SFX 2 0 siness [^aeio][aeiou]s -! SFX 2 0 tiness [^aeio][aiou]t -! SFX 2 0 viness [^aeio][aeiou]v -! SFX 2 0 ziness [^aeio][aeiou]z -! SFX 2 0 iness [^aeio]e[nrt] -! SFX 2 0 iness [aeio][aeiou][bcdfgklmnprstvz] -! SFX 2 0 iness [^aeiou][bcdfgklmnprstvz] -! SFX 2 0 iness [^ebcdfgklmnprstvz] - SFX z Y 24 -! SFX z e ily [^aeiouy]e -! SFX z 0 ily [aeiouy]e -! SFX z 0 ily [aiou]y -! SFX z ey ily ey -! SFX z y ily [^aeiou]y -! SFX z 0 bily [^aeio][aeiou]b -! SFX z 0 kily [^aeio][aeiou]c -! SFX z 0 dily [^aeio][aeiou]d -! SFX z 0 fily [^aeio][aeiou]f -! SFX z 0 gily [^aeio][aeiou]g -! SFX z 0 kily [^aeio][aeiou]k -! SFX z 0 lily [^aeio][aeiou]l -! SFX z 0 mily [^aeio][aeiou]m -! SFX z 0 nily [^aeio][aiou]n -! SFX z 0 pily [^aeio][aeiou]p -! SFX z 0 rily [^aeio][aiou]r -! SFX z 0 sily [^aeio][aeiou]s -! SFX z 0 tily [^aeio][aiou]t -! SFX z 0 vily [^aeio][aeiou]v -! SFX z 0 zily [^aeio][aeiou]z -! SFX z 0 ily [^aeio]e[nrt] -! SFX z 0 ily [aeio][aeiou][bcdfgklmnprstvyz] -! SFX z 0 ily [^aeiou][bcdfgklmnprstvyz] -! SFX z 0 ily [^ebcdfgklmnprstvyz] - SFX y Y 15 -! SFX y e ory te -! SFX y e atory [mr]e -! SFX y e ary se -! SFX y 0 ry [^mrst]e -! SFX y 0 ory [^aeous]t -! SFX y 0 ry [aeous]t -! SFX y 0 ery h -! SFX y 0 atory [^i]m -! SFX y im matory im -! SFX y 0 ory s -! SFX y 0 ary ion -! SFX y 0 ry [^i]on -! SFX y 0 nery [aiu]n -! SFX y 0 ry [^aiou]n -! SFX y 0 ry [^ehmstn] - SFX O Y 12 -! SFX O 0 l a -! SFX O e al [^bcgv]e -! SFX O e ial [bcgv]e -! SFX O 0 ial [bcrx] -! SFX O um al um -! SFX O 0 al [^u]m -! SFX O y al ty -! SFX O y ial [^t]y -! SFX O 0 ual [px]t -! SFX O 0 tal [iu]t -! SFX O 0 al [^ipux]t -! SFX O 0 al [^aebcrtxmy] - SFX o Y 12 -! SFX o 0 lly a -! SFX o e ally [^bcgv]e -! SFX o e ially [bcgv]e -! SFX o 0 ially [bcrx] -! SFX o um ally um -! SFX o 0 ally [^u]m -! SFX o y ally ty -! SFX o y ially [^t]y -! SFX o 0 ually [px]t -! SFX o 0 tally [iu]t -! SFX o 0 ally [^ipux]t -! SFX o 0 ally [^aebcrtxmy] - SFX W Y 21 -! SFX W ce tific ce -! SFX W e atic me -! SFX W se tic se -! SFX W le ic ble -! SFX W e ic [^b]le -! SFX W e ic [^clms]e -! SFX W 0 lic [ay]l -! SFX W 0 ic [^ay]l -! SFX W us ic us -! SFX W 0 tic [^u]s -! SFX W er ric er -! SFX W 0 ic [^e]r -! SFX W 0 atic [aeiou]m -! SFX W 0 ic [^aeiou]m -! SFX W 0 tic ma -! SFX W a ic [^m]a -! SFX W y etic thy -! SFX W y ic [^t]hy -! SFX W y tic sy -! SFX W y ic [^hs]y -! SFX W 0 ic [^aelmrsy] - SFX w Y 9 -! SFX w e ical e -! SFX w er rical er -! SFX w 0 ical [^e]r -! SFX w 0 atical [aeiou]m -! SFX w 0 ical [^aeiou]m -! SFX w 0 tical ma -! SFX w a ical [^m]a -! SFX w y ical y -! SFX w 0 ical [^aemry] - SFX 1 Y 9 -! SFX 1 e ically e -! SFX 1 er rically er -! SFX 1 0 ically [^e]r -! SFX 1 0 atically [aeiou]m -! SFX 1 0 ically [^aeiou]m -! SFX 1 0 tically ma -! SFX 1 a ically [^m]a -! SFX 1 y ically y -! SFX 1 0 ically [^aemry] - SFX 3 Y 21 -! SFX 3 e ist [^aceiou]e -! SFX 3 ce tist ce -! SFX 3 0 ist [aeiou]e -! SFX 3 y ist [^aeioubp]y -! SFX 3 0 ist [aeioubp]y -! SFX 3 o ist o -! SFX 3 0 ists [^eoy] -! SFX 3 e ists [^aceiou]e -! SFX 3 ce tists ce -! SFX 3 0 ists [aeiou]e -! SFX 3 y ists [^aeioubp]y -! SFX 3 0 ists [aeioubp]y -! SFX 3 o ists o -! SFX 3 0 ists [^eoy] -! SFX 3 e ist's [^aceiou]e -! SFX 3 ce tist's ce -! SFX 3 0 ist's [aeiou]e -! SFX 3 y ist's [^aeioubp]y -! SFX 3 0 ist's [aeioubp]y -! SFX 3 o ist's o -! SFX 3 0 ist's [^eoy] -*** en_GB.orig.dic Sun Jul 3 18:05:07 2005 ---- en_GB.dic Wed Mar 8 13:14:37 2006 -*************** -*** 630,632 **** - Byrne/M -- c/nN - cab/GMDXVSN ---- 630,631 ---- -*************** -*** 2588,2590 **** - KwaZulu -- l/3 - lab/oMS ---- 2587,2588 ---- -*************** -*** 5221,5223 **** - Ajax -- al/AFC - Alabamian/M ---- 5219,5220 ---- -*************** -*** 6256,6258 **** - czarist -- d/to - damaged/U ---- 6253,6254 ---- -*************** -*** 8168,8170 **** - Natasha/M -! nation/M - navigable/P ---- 8164,8166 ---- - Natasha/M -! nation/MS - navigable/P -*************** -*** 9959,9961 **** - Uzbekistan/M -- v - vacation/M ---- 9955,9956 ---- -*************** -*** 11546,11548 **** - DZ -- e - each ---- 11541,11542 ---- -*************** -*** 13189,13191 **** - mythology/SQM31w -- n/NnxVvu - nacho/S ---- 13183,13184 ---- -*************** -*** 16038,16040 **** - Catholics -! cation/MW - catnap/DMSG ---- 16031,16033 ---- - Catholics -! cation/MWS - catnap/DMSG -*************** -*** 16954,16956 **** - eyewash/SM -- f/F7 - fabricator/SM ---- 16947,16948 ---- -*************** -*** 17874,17877 **** - lass/MS -- last-ditch -- last-minute - latchkey/SM ---- 17866,17867 ---- -*************** -*** 22365,22367 **** - futuristic/S -- g/7 - gabbiness/S ---- 22355,22356 ---- -*************** -*** 22692,22694 **** - HMS -! hobbit - hobnob/DGS ---- 22681,22683 ---- - HMS -! hobbit/MS - hobnob/DGS -*************** -*** 23909,23911 **** - ozone/M -- p/AYFI - p.a. ---- 23898,23899 ---- -*************** -*** 24558,24560 **** - Rt. -- rte - Ru/M ---- 24546,24547 ---- -*************** -*** 25697,25699 **** - xylem/SM -- y/K - Yamaha/M ---- 25684,25685 ---- -*************** -*** 27778,27780 **** - gyrfalcon/MS -- h/E - habitual/YP ---- 27764,27765 ---- -*************** -*** 29532,29534 **** - pyrotechny/Ww -- q - QoS ---- 29517,29518 ---- -*************** -*** 30776,30778 **** - villein/SM -! vim/M - vindaloo/S ---- 30760,30763 ---- - villein/SM -! vim/? -! Vim/M - vindaloo/S -*************** -*** 30956,30958 **** - YWCA -- z/d - Zamia ---- 30941,30942 ---- -*************** -*** 34732,34734 **** - quizzes -- r/sd - rabbet/SMd ---- 34716,34717 ---- -*************** -*** 37265,37266 **** ---- 37248,37250 ---- - dBi -+ dBd - dBW -*************** -*** 37691,37693 **** - establishment/A -- et - eternity/SM ---- 37675,37676 ---- -*************** -*** 39974,39976 **** - rustproof/GD -! s/ko7 - Sabine/M ---- 39957,39959 ---- - rustproof/GD -! singly - Sabine/M -*************** -*** 41153,41155 **** - zymurgy/S -- - Aachen/M ---- 41136,41137 ---- -*************** -*** 41473,41475 **** - azalea/MS -- b/pb - Baal/M ---- 41455,41456 ---- -*************** -*** 43612,43614 **** - justnesses -- k/k - kabob's ---- 43593,43594 ---- -*************** -*** 45690,45692 **** - syringe/SMGD -- t/7k - Tabasco/M ---- 45670,45671 ---- -*************** -*** 46281 **** ---- 46260,46278 ---- - Zurich/M -+ conj. -+ pompon -+ natively -+ nd -+ Bram/M -+ et al. -+ et cetera -+ Moolenaar/M -+ pneumonic -+ the the/! -+ and and/! -+ a a/! -+ a an/! -+ an a/! -+ an an/! -+ PayPal -+ Google -+ TCP\/IP +*** en_GB.orig.dic 2015-12-30 18:49:42.360587040 +0100 +--- en_GB.dic 2016-01-08 23:03:35.510272903 +0100 +*************** +*** 1,2 **** +--- 1,12 ---- + 56453 ++ 0th ++ 1st ++ 2nd ++ 3rd ++ 4th ++ 5th ++ 6th ++ 7th ++ 8th ++ 9th + 'gainst +*************** +*** 3615,3617 **** + autosuggestion +- autosuggestion + autotest/S +--- 3625,3626 ---- +*************** +*** 9325,9327 **** + Church +- church + Church-of-England +--- 9334,9335 ---- +*************** +*** 22885,22887 **** + hand-painted +- hand-pick/D + hand-pick/GSD +--- 22893,22894 ---- +*************** +*** 56454 **** +--- 56461,56471 ---- + émigré/S ++ a a/% ++ a an/% ++ a the/% ++ an a/% ++ an an/% ++ an the/% ++ and and/% ++ the a/% ++ the an/% ++ the the/% diff --git a/runtime/spell/en/en_NZ.diff b/runtime/spell/en/en_NZ.diff index 3652d99c9e..8e6d1b55bb 100644 --- a/runtime/spell/en/en_NZ.diff +++ b/runtime/spell/en/en_NZ.diff @@ -1,5 +1,5 @@ -*** en_NZ.orig.aff Fri Apr 15 13:20:36 2005 ---- en_NZ.aff Wed Jan 11 22:03:30 2006 +*** en_NZ.orig.aff 2010-05-15 13:03:47.000000000 +0200 +--- en_NZ.aff 2016-01-09 13:16:01.734376292 +0100 *************** *** 7,9 **** SET ISO8859-1 @@ -16,7 +16,7 @@ ! MIDWORD ' ! ! RARE ? -! BAD ! +! BAD % ! ! MAP 9 ! MAP a @@ -148,7 +148,8 @@ ! REP 66 *************** -*** 76,95 **** +*** 75,95 **** + REP ura aru PFX A Y 2 ! PFX A 0 re [^e] ! PFX A 0 re- e @@ -169,7 +170,25 @@ PFX E Y 1 ! PFX E 0 dis . PFX F Y 5 ---- 214,233 ---- +--- 213,250 ---- + REP ura aru ++ ++ # This is disabled, because if Vim does not support NOCOMPOUNDSUGS giving ++ # suggestions is extremely slow. ++ ## ordinal numbers ++ #COMPOUNDMIN 1 ++ ## only in compounds: 1th, 2th, 3th ++ #ONLYINCOMPOUND , ++ ## compound rules: ++ ## 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) ++ ## 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) ++ #COMPOUNDRULE 2 ++ #COMPOUNDRULE (*:) ++ #COMPOUNDRULE (*{} ++ #NOCOMPOUNDSUGS ++ ++ # WORDCHARS 0123456789 ++ PFX A Y 2 ! PFX A 0 re [^e] ! PFX A 0 re- e @@ -587,7 +606,7 @@ SFX T y iest [^aeiou]y ! SFX T 0 er [aeiou]y SFX T 0 est [aeiou]y ---- 237,631 ---- +--- 254,648 ---- PFX F 0 col l ! PFX F 0 con [^abehilmopru]. PFX K Y 1 @@ -1672,7 +1691,7 @@ ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] \ No newline at end of file ---- 638,1323 ---- +--- 655,1340 ---- SFX R Y 72 ! SFX R 0 r e ! SFX R 0 rs e @@ -2359,30 +2378,45 @@ ! SFX 3 0 ist's [aeioubp]y ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] -*** en_NZ.orig.dic Fri Apr 15 13:20:36 2005 ---- en_NZ.dic Wed Mar 8 13:14:40 2006 +*** en_NZ.orig.dic 2010-05-15 13:03:48.000000000 +0200 +--- en_NZ.dic 2016-01-08 23:04:05.825939282 +0100 +*************** +*** 1,2 **** +--- 1,12 ---- + 47141 ++ 0th ++ 1st ++ 2nd ++ 3rd ++ 4th ++ 5th ++ 6th ++ 7th ++ 8th ++ 9th + 3GPP *************** *** 4,6 **** 2ZB - A a/o ---- 4,5 ---- +--- 14,15 ---- *************** *** 927,929 **** Al-Zawahiri - al/FAC Al/M ---- 926,927 ---- +--- 936,937 ---- *************** *** 2941,2944 **** B.Sc. - bless - bible baa/GSD ---- 2939,2940 ---- +--- 2949,2950 ---- *************** *** 4974,4975 **** ---- 4970,4972 ---- +--- 4980,4982 ---- Brampton/M + Bram/M bran/SDGM @@ -2391,7 +2425,7 @@ C.Lit. ! cation/SM Ca/y ---- 5704,5706 ---- +--- 5714,5716 ---- C.Lit. ! cation/MWS Ca/y @@ -2400,10 +2434,10 @@ Cathy - cation/MW catkin/SM ---- 6447,6448 ---- +--- 6457,6458 ---- *************** *** 8589,8590 **** ---- 8585,8587 ---- +--- 8595,8597 ---- coniferous + conj. conjectural @@ -2412,16 +2446,16 @@ red's - dally dab/TSGD ---- 10150,10151 ---- +--- 10160,10161 ---- *************** *** 10360,10361 **** ---- 10356,10358 ---- +--- 10366,10368 ---- dBm + dBd DBMS *************** *** 12535,12536 **** ---- 12532,12534 ---- +--- 12542,12544 ---- Dutchwomen/M + Farsi duteous/Y @@ -2430,13 +2464,13 @@ duvet/SM - duxes DVD/MS ---- 12540,12541 ---- +--- 12550,12551 ---- *************** *** 13901,13903 **** estuary/MS ! et ETA ---- 13898,13901 ---- +--- 13908,13911 ---- estuary/MS ! et cetera ! et al. @@ -2447,13 +2481,13 @@ - fable - fist/MS fa/M ---- 14529,14530 ---- +--- 14539,14540 ---- *************** *** 15323,15325 **** fissure/DSMG ! fist/6GD fistfight/MS ---- 15319,15321 ---- +--- 15329,15331 ---- fissure/DSMG ! fist/6GDMS fistfight/MS @@ -2462,44 +2496,44 @@ g's - gable gist/MS ---- 16602,16603 ---- +--- 16612,16613 ---- *************** *** 16797,16799 **** Garvey - Gary/M gas-permeable ---- 16792,16793 ---- +--- 16802,16803 ---- *************** *** 18177,18179 **** gyroscope/SWM - dish ha ---- 18171,18172 ---- +--- 18181,18182 ---- *************** *** 22321,22323 **** K-factor - disk/MS kabob's ---- 22314,22315 ---- +--- 22324,22325 ---- *************** *** 23129,23132 **** lassoer/M - last-ditch - last-minute last/YSDGkJ ---- 23121,23122 ---- +--- 23131,23132 ---- *************** *** 26396,26398 **** Missy ! mist/CDRGS mistakable/U ---- 26386,26388 ---- +--- 26396,26398 ---- Missy ! mist/CDRGSM mistakable/U *************** *** 26745,26746 **** ---- 26735,26737 ---- +--- 26745,26747 ---- Moog + Moolenaar/M moon/MGpDS @@ -2508,7 +2542,7 @@ mozzarella/SM - MP3 mpg ---- 27009,27010 ---- +--- 27019,27020 ---- *************** *** 27365,27372 **** N'Djamena @@ -2519,7 +2553,7 @@ - national - nationally Na/M ---- 27355,27359 ---- +--- 27365,27369 ---- N'Djamena ! native/SP natively @@ -2530,7 +2564,7 @@ Nathaniel/M ! nation/M national/sQ3Sq ---- 27494,27496 ---- +--- 27504,27506 ---- Nathaniel/M ! nation/MS national/sQ3Sq @@ -2539,7 +2573,7 @@ nationwide - native/SP nativity/SM ---- 27508,27509 ---- +--- 27518,27519 ---- *************** *** 29852,29857 **** P.O. @@ -2548,16 +2582,16 @@ - imply - comply pa/oM ---- 29838,29839 ---- +--- 29848,29849 ---- *************** *** 31702,31703 **** ---- 31684,31686 ---- +--- 31694,31696 ---- pneumonia/MS + pneumonic PO *************** *** 31885,31886 **** ---- 31868,31870 ---- +--- 31878,31880 ---- pompom/SM + pompon/M pomposity/SM @@ -2566,30 +2600,30 @@ qwertys - r/d Ra ---- 33545,33546 ---- +--- 33555,33556 ---- *************** *** 35456,35458 **** rt - rte Ru/M ---- 35439,35440 ---- +--- 35449,35450 ---- *************** *** 35619,35622 **** singly - sable - sally/DSG SA ---- 35601,35602 ---- +--- 35611,35612 ---- *************** *** 40763,40766 **** T's - mist/MS - overt Ta ---- 40743,40744 ---- +--- 40753,40754 ---- *************** *** 43574,43575 **** ---- 43552,43554 ---- +--- 43562,43564 ---- unsearchable + searchable unseeing/Y @@ -2598,7 +2632,7 @@ Vilnius/M ! vim/M vinaigrette/MS ---- 44313,44316 ---- +--- 44323,44326 ---- Vilnius/M ! Vim/M ! vim/? @@ -2608,88 +2642,92 @@ y'all - prey/M yacht/M5SmGD ---- 45886,45887 ---- +--- 45896,45897 ---- *************** *** 46152,46154 **** zymurgy/S - font/SM ---- 46131,46132 ---- +--- 46141,46142 ---- *************** *** 46198,46200 **** rata/M - kaka/M waka/M ---- 46176,46177 ---- +--- 46186,46187 ---- *************** *** 46216,46218 **** jandal/MS - Swanndri/M hoon/MS ---- 46193,46194 ---- +--- 46203,46204 ---- *************** *** 46242,46244 **** Invercargill/M - Te Alexandra/M ---- 46218,46219 ---- +--- 46228,46229 ---- *************** *** 46261,46263 **** Kawerau/M - Kerikeri/M Lyttelton/M ---- 46236,46237 ---- +--- 46246,46247 ---- *************** *** 46491,46493 **** Waianakarua - Hakatere Swin ---- 46465,46466 ---- +--- 46475,46476 ---- *************** *** 46690,46692 **** Omarama/M - Wairarapa/M Kilda/M ---- 46663,46664 ---- +--- 46673,46674 ---- *************** *** 46711,46713 **** Wellsford/M - Akaroa/M Avonhead/M ---- 46683,46684 ---- +--- 46693,46694 ---- *************** *** 46838,46840 **** Ballantyne's - DB Monteith's ---- 46809,46810 ---- +--- 46819,46820 ---- *************** *** 46920,46922 **** Egmont/M - Waitaki/M katipo/M ---- 46890,46891 ---- +--- 46900,46901 ---- *************** *** 46956,46958 **** Sunnyside/M - Wairau/M Waikoropupu ---- 46925,46926 ---- +--- 46935,46936 ---- *************** *** 47141,47142 **** Burkina ! Faso/M \ No newline at end of file ---- 47109,47120 ---- +--- 47119,47134 ---- Burkina ! Faso/M ! nd -! the the/! -! and and/! -! a a/! -! a an/! -! an a/! -! an an/! ! PayPal ! Google ! TCP\/IP +! a a/% +! a an/% +! a the/% +! an a/% +! an an/% +! an the/% +! and and/% +! the a/% +! the an/% +! the the/% diff --git a/runtime/spell/en/en_US.diff b/runtime/spell/en/en_US.diff index ee0b3fecc3..7419f19ffa 100644 --- a/runtime/spell/en/en_US.diff +++ b/runtime/spell/en/en_US.diff @@ -1,598 +1,243 @@ -*** en_US.orig.aff Fri Apr 15 13:20:36 2005 ---- en_US.aff Wed Jan 11 22:03:34 2006 -*************** -*** 3,4 **** ---- 3,141 ---- - -+ FOL -+ LOW -+ UPP -+ -+ MIDWORD ' -+ -+ RARE ? -+ BAD ! -+ -+ MAP 9 -+ MAP a -+ MAP e -+ MAP i -+ MAP o -+ MAP u -+ MAP n -+ MAP c -+ MAP y -+ MAP s -+ -+ # This comes from Aspell en_phonet.dat, version 1.1, 2000-01-07 -+ -+ SAL AH(AEIOUY)-^ *H -+ SAL AR(AEIOUY)-^ *R -+ SAL A(HR)^ * -+ SAL A^ * -+ SAL AH(AEIOUY)- H -+ SAL AR(AEIOUY)- R -+ SAL A(HR) _ -+ SAL ^ * -+ SAL ^ * -+ SAL BB- _ -+ SAL B B -+ SAL CQ- _ -+ SAL CIA X -+ SAL CH X -+ SAL C(EIY)- S -+ SAL CK K -+ SAL COUGH^ KF -+ SAL CC< C -+ SAL C K -+ SAL DG(EIY) K -+ SAL DD- _ -+ SAL D T -+ SAL < E -+ SAL EH(AEIOUY)-^ *H -+ SAL ER(AEIOUY)-^ *R -+ SAL E(HR)^ * -+ SAL ENOUGH^$ *NF -+ SAL E^ * -+ SAL EH(AEIOUY)- H -+ SAL ER(AEIOUY)- R -+ SAL E(HR) _ -+ SAL FF- _ -+ SAL F F -+ SAL GN^ N -+ SAL GN$ N -+ SAL GNS$ NS -+ SAL GNED$ N -+ SAL GH(AEIOUY)- K -+ SAL GH _ -+ SAL GG9 K -+ SAL G K -+ SAL H H -+ SAL IH(AEIOUY)-^ *H -+ SAL IR(AEIOUY)-^ *R -+ SAL I(HR)^ * -+ SAL I^ * -+ SAL ING6 N -+ SAL IH(AEIOUY)- H -+ SAL IR(AEIOUY)- R -+ SAL I(HR) _ -+ SAL J K -+ SAL KN^ N -+ SAL KK- _ -+ SAL K K -+ SAL LAUGH^ LF -+ SAL LL- _ -+ SAL L L -+ SAL MB$ M -+ SAL MM M -+ SAL M M -+ SAL NN- _ -+ SAL N N -+ SAL OH(AEIOUY)-^ *H -+ SAL OR(AEIOUY)-^ *R -+ SAL O(HR)^ * -+ SAL O^ * -+ SAL OH(AEIOUY)- H -+ SAL OR(AEIOUY)- R -+ SAL O(HR) _ -+ SAL PH F -+ SAL PN^ N -+ SAL PP- _ -+ SAL P P -+ SAL Q K -+ SAL RH^ R -+ SAL ROUGH^ RF -+ SAL RR- _ -+ SAL R R -+ SAL SCH(EOU)- SK -+ SAL SC(IEY)- S -+ SAL SH X -+ SAL SI(AO)- X -+ SAL SS- _ -+ SAL S S -+ SAL TI(AO)- X -+ SAL TH @ -+ SAL TCH-- _ -+ SAL TOUGH^ TF -+ SAL TT- _ -+ SAL T T -+ SAL UH(AEIOUY)-^ *H -+ SAL UR(AEIOUY)-^ *R -+ SAL U(HR)^ * -+ SAL U^ * -+ SAL UH(AEIOUY)- H -+ SAL UR(AEIOUY)- R -+ SAL U(HR) _ -+ SAL V^ W -+ SAL V F -+ SAL WR^ R -+ SAL WH^ W -+ SAL W(AEIOU)- W -+ SAL X^ S -+ SAL X KS -+ SAL Y(AEIOU)- Y -+ SAL ZZ- _ -+ SAL Z S -+ -+ # When soundfolding "th" is turned into "@". When this is mistyped as "ht" it -+ # soundfolds to "ht". This difference is too big, thus use REP items to lower -+ # the score. -+ REPSAL 2 -+ REPSAL ht @ -+ REPSAL @ ht -+ - PFX A Y 1 -*************** -*** 30,33 **** - SFX N e ion e -! SFX N y ication y -! SFX N 0 en [^ey] - ---- 167,170 ---- - SFX N e ion e -! SFX N y ication y -! SFX N 0 en [^ey] - -*************** -*** 40,42 **** - SFX H y ieth y -! SFX H 0 th [^y] - ---- 177,179 ---- - SFX H y ieth y -! SFX H 0 th [^y] - -*************** -*** 47,49 **** - SFX G e ing e -! SFX G 0 ing [^e] +*** en_US.orig.aff 2015-12-30 18:55:30.352821552 +0100 +--- en_US.aff 2016-01-09 13:16:31.514054846 +0100 +*************** +*** 1,18 **** + SET UTF8 + TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' +! ICONV 1 +! ICONV ’ ' + NOSUGGEST ! ---- 184,186 ---- - SFX G e ing e -! SFX G 0 ing [^e] +! # ordinal numbers +! COMPOUNDMIN 1 +! # only in compounds: 1th, 2th, 3th +! ONLYINCOMPOUND c +! # compound rules: +! # 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) +! # 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) +! COMPOUNDRULE 2 +! COMPOUNDRULE n*1t +! COMPOUNDRULE n*mp +! WORDCHARS 0123456789 -*************** -*** 99,101 **** +--- 1,164 ---- ++ # Affix file for US English MySpell dictionary + SET UTF8 + TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' +! +! FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ +! LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ +! UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ +! +! MIDWORD ' +! +! RARE ? +! BAD % +! +! MAP 9 +! MAP aàáâãäå +! MAP eèéêë +! MAP iìíîï +! MAP oòóôõö +! MAP uùúûü +! MAP nñ +! MAP cç +! MAP yÿý +! MAP sß +! +! # This comes from Aspell en_phonet.dat, version 1.1, 2000-01-07 +! +! SAL AH(AEIOUY)-^ *H +! SAL AR(AEIOUY)-^ *R +! SAL A(HR)^ * +! SAL A^ * +! SAL AH(AEIOUY)- H +! SAL AR(AEIOUY)- R +! SAL A(HR) _ +! SAL À^ * +! SAL Å^ * +! SAL BB- _ +! SAL B B +! SAL CQ- _ +! SAL CIA X +! SAL CH X +! SAL C(EIY)- S +! SAL CK K +! SAL COUGH^ KF +! SAL CC< C +! SAL C K +! SAL DG(EIY) K +! SAL DD- _ +! SAL D T +! SAL É< E +! SAL EH(AEIOUY)-^ *H +! SAL ER(AEIOUY)-^ *R +! SAL E(HR)^ * +! SAL ENOUGH^$ *NF +! SAL E^ * +! SAL EH(AEIOUY)- H +! SAL ER(AEIOUY)- R +! SAL E(HR) _ +! SAL FF- _ +! SAL F F +! SAL GN^ N +! SAL GN$ N +! SAL GNS$ NS +! SAL GNED$ N +! SAL GH(AEIOUY)- K +! SAL GH _ +! SAL GG9 K +! SAL G K +! SAL H H +! SAL IH(AEIOUY)-^ *H +! SAL IR(AEIOUY)-^ *R +! SAL I(HR)^ * +! SAL I^ * +! SAL ING6 N +! SAL IH(AEIOUY)- H +! SAL IR(AEIOUY)- R +! SAL I(HR) _ +! SAL J K +! SAL KN^ N +! SAL KK- _ +! SAL K K +! SAL LAUGH^ LF +! SAL LL- _ +! SAL L L +! SAL MB$ M +! SAL MM M +! SAL M M +! SAL NN- _ +! SAL N N +! SAL OH(AEIOUY)-^ *H +! SAL OR(AEIOUY)-^ *R +! SAL O(HR)^ * +! SAL O^ * +! SAL OH(AEIOUY)- H +! SAL OR(AEIOUY)- R +! SAL O(HR) _ +! SAL PH F +! SAL PN^ N +! SAL PP- _ +! SAL P P +! SAL Q K +! SAL RH^ R +! SAL ROUGH^ RF +! SAL RR- _ +! SAL R R +! SAL SCH(EOU)- SK +! SAL SC(IEY)- S +! SAL SH X +! SAL SI(AO)- X +! SAL SS- _ +! SAL S S +! SAL TI(AO)- X +! SAL TH @ +! SAL TCH-- _ +! SAL TOUGH^ TF +! SAL TT- _ +! SAL T T +! SAL UH(AEIOUY)-^ *H +! SAL UR(AEIOUY)-^ *R +! SAL U(HR)^ * +! SAL U^ * +! SAL UH(AEIOUY)- H +! SAL UR(AEIOUY)- R +! SAL U(HR) _ +! SAL V^ W +! SAL V F +! SAL WR^ R +! SAL WH^ W +! SAL W(AEIOU)- W +! SAL X^ S +! SAL X KS +! SAL Y(AEIOU)- Y +! SAL ZZ- _ +! SAL Z S +! +! # When soundfolding "th" is turned into "@". When this is mistyped as "ht" it +! # soundfolds to "ht". This difference is too big, thus use REP items to lower +! # the score. +! REPSAL 2 +! REPSAL ht @ +! REPSAL @ ht +! +! # ICONV 1 +! # ICONV ’ ' +! + NOSUGGEST ! -! REP 88 - REP a ei ---- 236,238 ---- +! # This is disabled, because if Vim does not support NOCOMPOUNDSUGS giving +! # suggestions is extremely slow. +! # This is disabled, because without NOCOMPOUNDSUGS support giving suggestions +! # is extremely slow. +! ## ordinal numbers +! #COMPOUNDMIN 1 +! ## only in compounds: 1th, 2th, 3th +! #ONLYINCOMPOUND c +! ## compound rules: +! ## 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.) +! ## 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.) +! #COMPOUNDRULE 2 +! #COMPOUNDRULE n*1t +! #COMPOUNDRULE n*mp +! #NOCOMPOUNDSUGS +! +! # WORDCHARS 0123456789 -! REP 91 - REP a ei -*************** -*** 137,138 **** ---- 274,277 ---- - REP uy i -+ REP y ie -+ REP ie y - REP i ee -*************** -*** 174,175 **** ---- 313,315 ---- - REP ew ue -+ REP uf ough - REP uff ough -*************** -*** 188 **** ---- 328,332 ---- - REP shun cion -+ REP an_a a -+ REP an_a an -+ REP a_an a -+ REP a_an an -*** en_US.orig.dic Fri Apr 15 13:20:36 2005 ---- en_US.dic Wed Mar 8 13:14:43 2006 -*************** -*** 1,2 **** -! 62076 - a ---- 1,2 ---- -! 62078 - a -*************** -*** 5944,5946 **** - bk -! b/KGD - Bk/M ---- 5944,5947 ---- - bk -! probing -! probed - Bk/M -*************** -*** 9007,9009 **** - Cazzie/M -- c/B - CB ---- 9008,9009 ---- -*************** -*** 9233,9235 **** - cetacean/S -- cetera/S - Cetus/M ---- 9233,9234 ---- -*************** -*** 11575,11576 **** ---- 11574,11577 ---- - conduit/MS -+ coned -+ cone/MS - coneflower/M -*************** -*** 11712,11713 **** ---- 11713,11715 ---- - coniferous -+ conj. - conjectural/Y -*************** -*** 14038,14043 **** - dazzling/Y -- db -- DB - dbl - dB/M - DBMS ---- 14040,14046 ---- - dazzling/Y - dbl - dB/M -+ dBi -+ dBm -+ dBd - DBMS -*************** -*** 15464,15466 **** - dingbat/MS -! ding/GD - dinghy/SM ---- 15467,15469 ---- - dingbat/MS -! ding/GDS - dinghy/SM -*************** -*** 15690,15692 **** - dishevelment/MS -! dish/GD - dishonest ---- 15693,15695 ---- - dishevelment/MS -! dish/GDMS - dishonest -*************** -*** 15973,15975 **** - djellaba/S -- d/JGVX - Djibouti/M ---- 15976,15977 ---- -*************** -*** 16911,16912 **** ---- 16913,16915 ---- - dusty/RPT -+ Farsi - Dutch/M -*************** -*** 17357,17359 **** - EFL -- e/FMDS - Efrain/M ---- 17360,17361 ---- -*************** -*** 18780,18782 **** - estuary/SM -! et - ET ---- 18782,18785 ---- - estuary/SM -! et cetera/S -! et al. - ET -*************** -*** 18785,18787 **** - eta/SM -! etc - etcetera/SM ---- 18788,18790 ---- - eta/SM -! etc. - etcetera/SM -*************** -*** 20559,20561 **** - Fiori/M -- f/IRAC - firearm/SM ---- 20562,20563 ---- -*************** -*** 24402,24404 **** - guzzler/M -! g/VBX - Gwalior/M ---- 24404,24406 ---- - guzzler/M -! gens - Gwalior/M -*************** -*** 25473,25475 **** - hemp/MNS -- h/EMS - hemstitch/DSMG ---- 25475,25476 ---- -*************** -*** 25963,25965 **** - hobbing -! hobbit - hobbler/M ---- 25964,25966 ---- - hobbing -! hobbit/MS - hobbler/M -*************** -*** 26524,26526 **** - HST -- ht - HTML ---- 26525,26526 ---- -*************** -*** 26942,26944 **** - Hz -- i - I ---- 26942,26943 ---- -*************** -*** 29627,29629 **** - Jezebel/MS -- j/F - JFK/M ---- 29626,29627 ---- -*************** -*** 30578,30580 **** - keyword/SM -! k/FGEIS - kg ---- 30576,30583 ---- - keyword/SM -! inking -! disking -! conking -! inks -! disks -! conks - kg -*************** -*** 32694,32696 **** - Lizzy/M -! l/JGVXT - Ljubljana/M ---- 32697,32699 ---- - Lizzy/M -! lings - Ljubljana/M -*************** -*** 34456,34458 **** - mash/JGZMSRD -! m/ASK - masked/U ---- 34459,34462 ---- - mash/JGZMSRD -! rems -! prom/S - masked/U -*************** -*** 34746,34747 **** ---- 34750,34753 ---- - Mb -+ Mbyte -+ Mbit - MB -*************** -*** 36605,36606 **** ---- 36611,36613 ---- - Moog -+ Moolenaar/M - moo/GSD -*************** -*** 38871,38873 **** - NSF -- n/T - NT ---- 38878,38879 ---- -*************** -*** 39011,39013 **** - NZ -- o - O ---- 39017,39018 ---- -*************** -*** 39532,39534 **** - om/XN -- ON - onanism/M ---- 39537,39538 ---- -*************** -*** 42508,42510 **** - pinfeather/SM -! ping/GDRM - pinheaded/P ---- 42512,42514 ---- - pinfeather/SM -! ping/GDRMS - pinheaded/P -*************** -*** 42983,42984 **** ---- 42987,42989 ---- - pneumonia/MS -+ pneumonic - PO -*************** -*** 43216,43218 **** - pompom/SM -! pompon's - pomposity/MS ---- 43221,43223 ---- - pompom/SM -! pompon/M - pomposity/MS -*************** -*** 44940,44942 **** - PX -- p/XTGJ - Pygmalion/M ---- 44945,44946 ---- -*************** -*** 44983,44985 **** - pyx/MDSG -- q - Q ---- 44987,44988 ---- -*************** -*** 46507,46509 **** - Renault/MS -- rend - renderer/M ---- 46510,46511 ---- -*************** -*** 47258,47260 **** - ringer/M -! ring/GZJDRM - ringing/Y ---- 47260,47262 ---- - ringer/M -! ring/GZJDRMS - ringing/Y -*************** -*** 47857,47862 **** - rt -- rte - Rte - RTFM -- r/TGVJ - Rubaiyat/M ---- 47859,47862 ---- -*************** -*** 48085,48087 **** - Ryun/M -- S - SA ---- 48085,48086 ---- -*************** -*** 54450,54452 **** - swung -! s/XJBG - sybarite/MS ---- 54449,54451 ---- - swung -! sings - sybarite/MS -*************** -*** 56906,56908 **** - transit/SGVMD -! transl - translatability/M ---- 56905,56907 ---- - transit/SGVMD -! transl. - translatability/M -*************** -*** 57728,57730 **** - TX -! t/XTJBG - Tybalt/M ---- 57727,57729 ---- - TX -! tings - Tybalt/M -*************** -*** 57809,57811 **** - Tzeltal/M -- u - U ---- 57808,57809 ---- -*************** -*** 58494,58495 **** ---- 58492,58494 ---- - unsearchable -+ searchable - unseasonal -*************** -*** 59072,59074 **** - vast/PTSYR -! v/ASV - VAT ---- 59071,59073 ---- - vast/PTSYR -! revs - VAT -*************** -*** 59538,59540 **** - vi/MDR -! vim/MS - vinaigrette/MS ---- 59537,59540 ---- - vi/MDR -! Vim/MS -! vim/? - vinaigrette/MS -*************** -*** 61534,61536 **** - WWW -! w/XTJGV - WY ---- 61534,61537 ---- - WWW -! wens -! wings - WY -*************** -*** 61750,61752 **** - yew/SM -- y/F - Yggdrasil/M ---- 61751,61752 ---- -*************** -*** 62058,62060 **** - Zsigmondy/M -! z/TGJ - Zubenelgenubi/M ---- 62058,62060 ---- - Zsigmondy/M -! zings - Zubenelgenubi/M -*************** -*** 62077 **** ---- 62077,62092 ---- - zymurgy/S -+ nd -+ the the/! -+ and and/! -+ a a/! -+ an an/! -+ a an/! -+ an a/! -+ the a/! -+ the an/! -+ a the/! -+ an the/! -+ PayPal -+ Google -+ e.g. -+ TCP\/IP +*** en_US.orig.dic 2015-12-30 18:55:58.928512408 +0100 +--- en_US.dic 2016-01-08 23:04:15.241835664 +0100 +*************** +*** 1,25 **** + 48756 +! 0/nm +! 0th/pt +! 1/n1 +! 1st/p +! 1th/tc +! 2/nm +! 2nd/p +! 2th/tc +! 3/nm +! 3rd/p +! 3th/tc +! 4/nm +! 4th/pt +! 5/nm +! 5th/pt +! 6/nm +! 6th/pt +! 7/nm +! 7th/pt +! 8/nm +! 8th/pt +! 9/nm +! 9th/pt + A/SM +--- 1,12 ---- + 48756 +! 0th +! 1st +! 2nd +! 3rd +! 4th +! 5th +! 6th +! 7th +! 8th +! 9th + A/SM +*************** +*** 48757 **** +--- 48744,48754 ---- + zymurgy/M ++ a a/% ++ a an/% ++ a the/% ++ an a/% ++ an an/% ++ an the/% ++ and and/% ++ the a/% ++ the an/% ++ the the/% diff --git a/runtime/spell/en/main.aap b/runtime/spell/en/main.aap index 9e4b98ea75..09ae228be6 100644 --- a/runtime/spell/en/main.aap +++ b/runtime/spell/en/main.aap @@ -30,7 +30,7 @@ $SPELLDIR/en.ascii.spl : $FILES :sys $VIM -u NONE -e -c "mkspell! -ascii $SPELLDIR/en en_US en_AU en_CA en_GB en_NZ" -c q -../README_en.txt: README_en_US.txt README_en_AU.txt +../README_en.txt: README_en_US.txt README_en_AU.txt README_en_CA.txt README_en_GB.txt README_en_NZ.txt :print en_US >!$target :cat README_en_US.txt | :eval re.sub('\r', '', stdin) >>$target :print =================================================== >>$target @@ -48,6 +48,14 @@ $SPELLDIR/en.ascii.spl : $FILES # # Fetching the files from OpenOffice.org. +# THIS URL NO LONGER WORKS. +# +# Files for en_US, en_CA and en_GB can be obtained from: +# github.com/marcoagpinto/aoo-mozilla-en-dict +# Unfortunately, giving suggestions becomes terribly slow with these. +# TODO: find out why suggestions are slow and fix that. +# +# For now we use the older libraries. # OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries :attr {fetch = $OODIR/%file%} en_US.zip en_CA.zip en_NZ.zip @@ -117,7 +125,7 @@ en_NZ.aff en_NZ.dic: {buildcheck=} :sys patch <en_NZ.diff -# Generate diff files, so that others can get the OpenOffice files and apply +# Generate diff files, so that others can get the original files and apply # the diffs to get the Vim versions. diff: diff --git a/runtime/spell/ro/main.aap b/runtime/spell/ro/main.aap index c07e2712cf..8f2379dc32 100644 --- a/runtime/spell/ro/main.aap +++ b/runtime/spell/ro/main.aap @@ -9,35 +9,43 @@ SPELLDIR = .. FILES = ro_RO.aff ro_RO.dic -all: $SPELLDIR/ro.iso-8859-2.spl $SPELLDIR/ro.utf-8.spl \ - $SPELLDIR/ro.cp1250.spl ../README_ro.txt - -$SPELLDIR/ro.iso-8859-2.spl : $FILES - :sys env LANG=ro_RO.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q +all: $SPELLDIR/ro.utf-8.spl \ + $SPELLDIR/ro.iso-8859-2.spl \ + $SPELLDIR/ro.cp1250.spl \ + ../README_ro.txt $SPELLDIR/ro.utf-8.spl : $FILES - :sys env LANG=ro_RO.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q + :sys env LANG=ro_RO.utf8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q +# Note: this generates conversion errors, because not all characters can be +# represented in iso-8859-2. +$SPELLDIR/ro.iso-8859-2.spl : $FILES + :sys env LANG=ro_RO.iso88592 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q + +# Note: this generates conversion errors, because not all characters can be +# represented in cp1250. $SPELLDIR/ro.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/ro ro_RO" -c q -../README_ro.txt: README_ro_RO.txt +../README_ro.txt: README :copy $source $target # # Fetching the files from OpenOffice.org. # -OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries -:attr {fetch = $OODIR/%file%} ro_RO.zip +#OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +OODIR = http://sourceforge.net/projects/rospell/files/Romanian%20dictionaries/dict-3.3.10 +ZIPFILE = ro_RO.3.3.10.zip +:attr {fetch = $OODIR/%file%} $ZIPFILE # The files don't depend on the .zip file so that we can delete it. # Only download the zip file if the targets don't exist. # This is a bit tricky, since the file name includes the date. ro_RO.aff ro_RO.dic: {buildcheck=} :assertpkg unzip patch - :fetch ro_RO.zip - :sys $UNZIP ro_RO.zip - :delete ro_RO.zip + :fetch $ZIPFILE + :sys $UNZIP $ZIPFILE + :delete $ZIPFILE @if not os.path.exists('ro_RO.orig.aff'): :copy ro_RO.aff ro_RO.orig.aff @if not os.path.exists('ro_RO.orig.dic'): @@ -60,12 +68,12 @@ diff: check: :assertpkg unzip diff - :fetch ro_RO.zip + :fetch $ZIPFILE :mkdir tmp :cd tmp @try: @import stat - :sys $UNZIP ../ro_RO.zip + :sys $UNZIP ../$ZIPFILE :sys {force} diff ../ro_RO.orig.aff ro_RO.aff >d @if os.stat('d')[stat.ST_SIZE] > 0: :copy ro_RO.aff ../ro_RO.new.aff @@ -75,7 +83,19 @@ check: @finally: :cd .. :delete {r}{f}{q} tmp - :delete ro_RO.zip - + :delete $ZIPFILE + +# Remove all the downloaded and generated files. +clean: + :delete ro_RO.aff + :delete ro_RO.dic + :delete ro_RO.orig.aff + :delete ro_RO.orig.dic + :delete ro_RO-ante1993.aff + :delete ro_RO-ante1993.dic + :delete COPYING.GPL + :delete COPYING.LGPL + :delete COPYING.MPL + :delete README # vim: set sts=4 sw=4 : diff --git a/runtime/spell/ro/ro_RO.diff b/runtime/spell/ro/ro_RO.diff index 5477030ab4..2c18228720 100644 --- a/runtime/spell/ro/ro_RO.diff +++ b/runtime/spell/ro/ro_RO.diff @@ -1,42 +1,34 @@ -*** ro_RO.orig.aff Wed Aug 31 20:34:38 2005 ---- ro_RO.aff Wed Aug 31 20:39:57 2005 +*** ro_RO.orig.aff 2014-08-29 16:29:21.162457824 +0200 +--- ro_RO.aff 2014-09-19 15:29:52.354413307 +0200 *************** -*** 3,4 **** ---- 3,8 ---- +*** 3,5 **** + TRY iaăâșțîertolncusmpdbgfzvhjxkwyqACDM +! KEY qwertyuiop|asdfghjkl|zxcvbnm -+ FOL -+ LOW -+ UPP -+ - PFX E Y 1 -*************** -*** 12,15 **** - SFX L 0 l u -! SFX L 0 le [^cg] i -! SFX L 0 i [cg] i - SFX L 0 le e ---- 16,19 ---- - SFX L 0 l u -! SFX L 0 le [^cg]i -! SFX L 0 i [cg]i - SFX L 0 le e -*************** -*** 18,20 **** - SFX U 0 a re -! SFX U 0 i [^i] ii - ---- 22,24 ---- - SFX U 0 a re -! SFX U 0 i [^i]ii +--- 3,9 ---- + TRY iaăâșțîertolncusmpdbgfzvhjxkwyqACDM +! # KEY qwertyuiop|asdfghjkl|zxcvbnm +! +! # ignore extra field (specifies type of word?) +! IGNOREEXTRA +! *************** -*** 38,41 **** - SFX I 0 ului [^ua] -! SFX I a ii [gc] a -! SFX I a ei [^cg] a - ---- 42,45 ---- - SFX I 0 ului [^ua] -! SFX I a ii [gc]a -! SFX I a ei [^cg]a - +*** 1546,1553 **** + SFX q 0 ilor . adj. m. pl. dat. +! SFX q 0 ă +! SFX q 0 a +! SFX q 0 ei +! SFX q 0 e +! SFX q 0 ele +! SFX q 0 elor + PFX q Y 1 +--- 1550,1557 ---- + SFX q 0 ilor . adj. m. pl. dat. +! SFX q 0 ă . +! SFX q 0 a . +! SFX q 0 ei . +! SFX q 0 e . +! SFX q 0 ele . +! SFX q 0 elor . + PFX q Y 1 diff --git a/runtime/spell/sr/main.aap b/runtime/spell/sr/main.aap new file mode 100644 index 0000000000..87af4bcc52 --- /dev/null +++ b/runtime/spell/sr/main.aap @@ -0,0 +1,142 @@ +# Aap recipe for Serbian Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = sr_RS.aff sr_RS.dic + 'sr_RS@latin.aff' 'sr_RS@latin.dic' + +all: $SPELLDIR/sr.utf-8.spl $SPELLDIR/'sr@latin.utf-8.spl' ../README_sr.txt + +# Original files will be in the subfolder hunspell-sr after unpacking: +# sr.dic original cyrillic dictionary +# sr.aff original cyrillic affix file +# sr-Latn.dic original latin dictionary file +# sr-Latn.aff original latin affix file +# Just before using the dictionary files, the right ones are copied to +# sr_RS.aff +# sr_RS.dic +# and +# sr_RS@latin.aff +# sr_RS@latin.dic + +$SPELLDIR/sr.utf-8.spl : $FILES + :sys env LANG=sr_RS.UTF-8 + $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr sr_RS" -c q + +$SPELLDIR/"sr@latin.utf-8.spl" : $FILES + :sys env LANG=sr_RS@latin.UTF-8 + $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr@latin sr_RS@latin" -c q + +../README_sr.txt : hunspell-sr/README_sr.txt README_sr_RS.txt + :cat README_sr_RS.txt >!$target + :print >>$target + :print ============================================================== >>$target + :print Следи оригинална README датотека: >>$target + :print >>$target + :cat hunspell-sr/README_sr.txt >>$target + +# +# Used to fetch the files. +# +ZIPFILE = http://devbase.net/dict-sr/hunspell-sr-20130715.zip + +:attr {fetch = $ZIPFILE} sr_RS.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +sr_RS.aff sr_RS.dic: {buildcheck=} + :assertpkg unzip patch + :fetch sr_RS.zip + :sys $UNZIP sr_RS.zip + :delete sr_RS.zip + @if not os.path.exists('sr_RS.orig.aff'): + :copy hunspell-sr/sr.aff sr_RS.orig.aff + @if not os.path.exists('sr_RS.orig.dic'): + :copy hunspell-sr/sr.dic sr_RS.orig.dic + @if os.path.exists('sr_RS.diff'): + :sys patch <sr_RS.diff + :copy sr_RS.orig.aff sr_RS.aff + :copy sr_RS.orig.dic sr_RS.dic + + # Remove the 3 misspelled words and update the word count +# :sys $VIM -u NONE -e -c "set enc=utf-8" +# -c "e sr_RS.orig.dic" +# -c "%g/ажуриранје/d" +# -c "%g/вишнја/d" +# -c "%g/вишнјевац/d" +# -c "%s/263909/263906/e" +# -c "w! sr_RS.dic" +# -c q + +sr_RS@latin.aff sr_RS@latin.dic: {buildcheck=} + :assertpkg unzip patch + :fetch sr_RS.zip + :sys $UNZIP sr_RS.zip + :delete sr_RS.zip + @if not os.path.exists('sr_RS@latin.orig.aff'): + :copy hunspell-sr/sr-Latn.aff 'sr_RS@latin.orig.aff' + @if not os.path.exists('sr_RS@latin.orig.dic'): + :copy hunspell-sr/sr-Latn.dic 'sr_RS@latin.orig.dic' + @if os.path.exists('sr_RS@latin.diff'): + :sys patch <'sr_RS@latin.diff' + :copy 'sr_RS@latin.orig.aff' 'sr_RS@latin.aff' + :copy 'sr_RS@latin.orig.dic' 'sr_RS@latin.dic' + + + # Remove the 3 duplicated words and update the word count +# :sys $VIM -u NONE -e -c "set enc=utf-8" +# -c "e sr_RS@latin.orig.dic" +# -c "%g/\v(ažuriranje)(\_.*\1)@=/d" +# -c "%g/\v(višnja)(\_.*\1)@=/d" +# -c "%g/\v(višnjevac)(\_.*\1)@=/d" +# -c "%s/263909/263906/e" +# -c "w! sr_RS@latin.dic" +# -c q + +# Generate diff files, so that others can get the files and apply +# the diffs to get the Vim versions. +diff: + :assertpkg diff + :sys {force} diff -a -C 1 sr_RS.orig.aff sr_RS.aff >sr_RS.diff + :sys {force} diff -a -C 1 sr_RS.orig.dic sr_RS.dic >>sr_RS.diff + :sys {force} diff -a -C 1 'sr_RS@latin.orig.aff' 'sr_RS@latin.aff' >'sr_RS@latin.diff' + :sys {force} diff -a -C 1 'sr_RS@latin.orig.dic' 'sr_RS@latin.dic' >>'sr_RS@latin.diff' + +# Delete all the unpacked and generated files, including the "orig" files. +clean: + :delete {force} sr_RS.zip sr_RS.dic + sr_RS.orig.aff sr_RS.orig.dic + sr_RS.aff + 'sr_RS@latin.dic' 'sr_RS@latin.aff' + 'sr_RS@latin.orig.aff' 'sr_RS@latin.orig.dic' + :sys rm -f -r hunspell-sr/ + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. +# +#check: +# :assertpkg unzip diff +# :fetch fr_FR.zip +# :mkdir tmp +# :cd tmp +# @try: +# @import stat +# :sys $UNZIP ../fr_FR.zip +# :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d +# @if os.stat('d')[stat.ST_SIZE] > 0: +# :copy fr_FR.aff ../fr_FR.new.aff +# :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d +# @if os.stat('d')[stat.ST_SIZE] > 0: +# :copy fr_FR.dic ../fr_FR.new.dic +# @finally: +# :cd .. +# :delete {r}{f}{q} tmp +# :delete fr_FR.zip + + +vim: set sts=4 sw=4 : diff --git a/runtime/spell/sr/sr_RS.diff b/runtime/spell/sr/sr_RS.diff new file mode 100644 index 0000000000..0be9ff0e58 --- /dev/null +++ b/runtime/spell/sr/sr_RS.diff @@ -0,0 +1,68 @@ +*** sr_RS.orig.aff Fri Feb 23 20:04:41 2018 +--- sr_RS.aff Fri Feb 23 18:18:48 2018 +*************** +*** 1,10 **** +! SET UTF-8 + +! LANG sr +! TRY аиоенртсвумклпјдгзбшчцхћњљжфђџАИОЕНРТСВУМКЛПЈДГЗБШЧЦХЋЊЉЖФЂЏ +! KEY љњертжуиопшђж|асдфгхјклчћ|зџцвбнм|жшђ|ћшч|жчђ|ђћж|зж|љањседрфтгжхуј|јиколпч|азсџдцфвгбх|хнјмк +! +! MAP 4 +! MAP цћ +! MAP цч + MAP зж +--- 1,5 ---- +! SET utf-8 + +! MAP 3 +! MAP цћч + MAP зж +*************** +*** 12,14 **** + +! REP 8 + REP дј ђ +--- 7,11 ---- + +! MIDWORD -’ +! +! REP 4 + REP дј ђ +*************** +*** 17,28 **** + REP дж џ +- REP ц с # Ако хоћу да откуцам слово „С“ могу се залетети за ознаком на тастатури и уписати „Ц“ (C) +- REP п р # Ако хоћу да откуцам слово „В“ могу се залетети за ознаком и уписати „Б“ (B) +- REP џ х # Ако хоћу да откуцам слово „Р“ могу се залетети за ознаком и уписати „П“ (P) +- REP х н # Ако хоћу да откуцам слово „Х“ могу се залетети за ознаком и уписати „Џ“ (X) +- # Ако хоћу да откуцам слово „В“ могу се залетети за ознаком и уписати „Б“ (B) (покривено KEY паром „в - б“) +- +- ICONV 3 +- ICONV ҵ тц +- ICONV ҥ нг +- ICONV ӕ ае + +--- 14,15 ---- +*** sr_RS.orig.dic Fri Feb 23 20:04:42 2018 +--- sr_RS.dic Fri Feb 23 20:04:46 2018 +*************** +*** 1,2 **** +! 263909 + а +--- 1,2 ---- +! 263906 + а +*************** +*** 882,884 **** + ажурираних +- ажуриранје + ажурирано +--- 882,883 ---- +*************** +*** 22177,22180 **** + вишку +- вишнја +- вишнјевац + Вишну +--- 22176,22177 ---- diff --git a/runtime/spell/sr/sr_RS@latin.diff b/runtime/spell/sr/sr_RS@latin.diff new file mode 100644 index 0000000000..5ff1836fa9 --- /dev/null +++ b/runtime/spell/sr/sr_RS@latin.diff @@ -0,0 +1,66 @@ +*** sr_RS@latin.orig.aff Fri Feb 23 20:08:28 2018 +--- sr_RS@latin.aff Fri Feb 23 18:18:48 2018 +*************** +*** 1,10 **** +! SET UTF-8 + +! LANG sr-Latn +! TRY aioenrtsvumklpjdgzbščchćnjljžfđdžAIOENRTSVUMKLPJDGZBŠČCHĆNJLJŽFĐDŽ +! KEY qwertyuiopšđž|asdfghjklčć|zxcvbnm|žšđ|ćšč|žčđ|đćž|zy|qawsedrftgyhuj|jikolpč|azsxdcfvgbh|hnjmk +! +! MAP 4 +! MAP cć +! MAP cč + MAP zž +--- 1,5 ---- +! SET utf-8 + +! MAP 3 +! MAP cćč + MAP zž +*************** +*** 12,20 **** + +! REP 1 +! REP dj đ + +! ICONV fi fi +! ICONV fl fl +! ICONV st st +! ICONV ij ij +! ICONV œ oe +--- 7,14 ---- + +! MIDWORD -’ + +! REP 4 +! REP dj đ +! REP fl fl +! REP ff ff +! REP fi fi +*** sr_RS@latin.orig.dic Fri Feb 23 20:08:28 2018 +--- sr_RS@latin.dic Fri Feb 23 20:08:53 2018 +*************** +*** 1,2 **** +! 263909 + a +--- 1,2 ---- +! 263906 + a +*************** +*** 882,884 **** + ažuriranih +- ažuriranje + ažurirano +--- 882,883 ---- +*************** +*** 22177,22184 **** + višku +- višnja +- višnjevac + Višnu + višnja + višnjama + višnjare + višnje +--- 22176,22181 ---- diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index be88f1c539..ec4c48b3da 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -2,7 +2,7 @@ " This file is normally sourced from menu.vim. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2013 Jun 24 +" Last Change: 2017 Oct 28 " Define the SetSyn function, used for the Syntax menu entries. " Set 'filetype' and also 'syntax' if it is manually selected. @@ -56,46 +56,50 @@ an 50.10.270 &Syntax.AB.Applix\ ELF :cal SetSyn("elf")<CR> an 50.10.280 &Syntax.AB.APT\ config :cal SetSyn("aptconf")<CR> an 50.10.290 &Syntax.AB.Arc\ Macro\ Language :cal SetSyn("aml")<CR> an 50.10.300 &Syntax.AB.Arch\ inventory :cal SetSyn("arch")<CR> -an 50.10.310 &Syntax.AB.ART :cal SetSyn("art")<CR> -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.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> -an 50.10.390 &Syntax.AB.Assembly.Intel\ IA-64 :cal SetSyn("ia64")<CR> -an 50.10.400 &Syntax.AB.Assembly.Microsoft :cal SetSyn("masm")<CR> -an 50.10.410 &Syntax.AB.Assembly.Netwide :cal SetSyn("nasm")<CR> -an 50.10.420 &Syntax.AB.Assembly.PIC :cal SetSyn("pic")<CR> -an 50.10.430 &Syntax.AB.Assembly.Turbo :cal SetSyn("tasm")<CR> -an 50.10.440 &Syntax.AB.Assembly.VAX\ Macro\ Assembly :cal SetSyn("vmasm")<CR> -an 50.10.450 &Syntax.AB.Assembly.Z-80 :cal SetSyn("z8a")<CR> -an 50.10.460 &Syntax.AB.Assembly.xa\ 6502\ cross\ assember :cal SetSyn("a65")<CR> -an 50.10.470 &Syntax.AB.ASN\.1 :cal SetSyn("asn")<CR> -an 50.10.480 &Syntax.AB.Asterisk\ config :cal SetSyn("asterisk")<CR> -an 50.10.490 &Syntax.AB.Asterisk\ voicemail\ config :cal SetSyn("asteriskvm")<CR> -an 50.10.500 &Syntax.AB.Atlas :cal SetSyn("atlas")<CR> -an 50.10.510 &Syntax.AB.AutoHotKey :cal SetSyn("autohotkey")<CR> -an 50.10.520 &Syntax.AB.AutoIt :cal SetSyn("autoit")<CR> -an 50.10.530 &Syntax.AB.Automake :cal SetSyn("automake")<CR> -an 50.10.540 &Syntax.AB.Avenue :cal SetSyn("ave")<CR> -an 50.10.550 &Syntax.AB.Awk :cal SetSyn("awk")<CR> -an 50.10.560 &Syntax.AB.AYacc :cal SetSyn("ayacc")<CR> -an 50.10.580 &Syntax.AB.B :cal SetSyn("b")<CR> -an 50.10.590 &Syntax.AB.Baan :cal SetSyn("baan")<CR> -an 50.10.600 &Syntax.AB.Basic.FreeBasic :cal SetSyn("freebasic")<CR> -an 50.10.610 &Syntax.AB.Basic.IBasic :cal SetSyn("ibasic")<CR> -an 50.10.620 &Syntax.AB.Basic.QBasic :cal SetSyn("basic")<CR> -an 50.10.630 &Syntax.AB.Basic.Visual\ Basic :cal SetSyn("vb")<CR> -an 50.10.640 &Syntax.AB.Bazaar\ commit\ file :cal SetSyn("bzr")<CR> -an 50.10.650 &Syntax.AB.BC\ calculator :cal SetSyn("bc")<CR> -an 50.10.660 &Syntax.AB.BDF\ font :cal SetSyn("bdf")<CR> -an 50.10.670 &Syntax.AB.BibTeX.Bibliography\ database :cal SetSyn("bib")<CR> -an 50.10.680 &Syntax.AB.BibTeX.Bibliography\ Style :cal SetSyn("bst")<CR> -an 50.10.690 &Syntax.AB.BIND.BIND\ config :cal SetSyn("named")<CR> -an 50.10.700 &Syntax.AB.BIND.BIND\ zone :cal SetSyn("bindzone")<CR> -an 50.10.710 &Syntax.AB.Blank :cal SetSyn("blank")<CR> +an 50.10.310 &Syntax.AB.Arduino :cal SetSyn("arduino")<CR> +an 50.10.320 &Syntax.AB.ART :cal SetSyn("art")<CR> +an 50.10.330 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR> +an 50.10.340 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR> +an 50.10.350 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR> +an 50.10.360 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR> +an 50.10.370 &Syntax.AB.Assembly.AVR :cal SetSyn("avra")<CR> +an 50.10.380 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR> +an 50.10.390 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR> +an 50.10.400 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR> +an 50.10.410 &Syntax.AB.Assembly.Intel\ IA-64 :cal SetSyn("ia64")<CR> +an 50.10.420 &Syntax.AB.Assembly.Microsoft :cal SetSyn("masm")<CR> +an 50.10.430 &Syntax.AB.Assembly.Netwide :cal SetSyn("nasm")<CR> +an 50.10.440 &Syntax.AB.Assembly.PIC :cal SetSyn("pic")<CR> +an 50.10.450 &Syntax.AB.Assembly.Turbo :cal SetSyn("tasm")<CR> +an 50.10.460 &Syntax.AB.Assembly.VAX\ Macro\ Assembly :cal SetSyn("vmasm")<CR> +an 50.10.470 &Syntax.AB.Assembly.Z-80 :cal SetSyn("z8a")<CR> +an 50.10.480 &Syntax.AB.Assembly.xa\ 6502\ cross\ assember :cal SetSyn("a65")<CR> +an 50.10.490 &Syntax.AB.ASN\.1 :cal SetSyn("asn")<CR> +an 50.10.500 &Syntax.AB.Asterisk\ config :cal SetSyn("asterisk")<CR> +an 50.10.510 &Syntax.AB.Asterisk\ voicemail\ config :cal SetSyn("asteriskvm")<CR> +an 50.10.520 &Syntax.AB.Atlas :cal SetSyn("atlas")<CR> +an 50.10.530 &Syntax.AB.Autodoc :cal SetSyn("autodoc")<CR> +an 50.10.540 &Syntax.AB.AutoHotKey :cal SetSyn("autohotkey")<CR> +an 50.10.550 &Syntax.AB.AutoIt :cal SetSyn("autoit")<CR> +an 50.10.560 &Syntax.AB.Automake :cal SetSyn("automake")<CR> +an 50.10.570 &Syntax.AB.Avenue :cal SetSyn("ave")<CR> +an 50.10.580 &Syntax.AB.Awk :cal SetSyn("awk")<CR> +an 50.10.590 &Syntax.AB.AYacc :cal SetSyn("ayacc")<CR> +an 50.10.610 &Syntax.AB.B :cal SetSyn("b")<CR> +an 50.10.620 &Syntax.AB.Baan :cal SetSyn("baan")<CR> +an 50.10.630 &Syntax.AB.Basic.FreeBasic :cal SetSyn("freebasic")<CR> +an 50.10.640 &Syntax.AB.Basic.IBasic :cal SetSyn("ibasic")<CR> +an 50.10.650 &Syntax.AB.Basic.QBasic :cal SetSyn("basic")<CR> +an 50.10.660 &Syntax.AB.Basic.Visual\ Basic :cal SetSyn("vb")<CR> +an 50.10.670 &Syntax.AB.Bazaar\ commit\ file :cal SetSyn("bzr")<CR> +an 50.10.680 &Syntax.AB.Bazel :cal SetSyn("bzl")<CR> +an 50.10.690 &Syntax.AB.BC\ calculator :cal SetSyn("bc")<CR> +an 50.10.700 &Syntax.AB.BDF\ font :cal SetSyn("bdf")<CR> +an 50.10.710 &Syntax.AB.BibTeX.Bibliography\ database :cal SetSyn("bib")<CR> +an 50.10.720 &Syntax.AB.BibTeX.Bibliography\ Style :cal SetSyn("bst")<CR> +an 50.10.730 &Syntax.AB.BIND.BIND\ config :cal SetSyn("named")<CR> +an 50.10.740 &Syntax.AB.BIND.BIND\ zone :cal SetSyn("bindzone")<CR> +an 50.10.750 &Syntax.AB.Blank :cal SetSyn("blank")<CR> an 50.20.100 &Syntax.C.C :cal SetSyn("c")<CR> an 50.20.110 &Syntax.C.C++ :cal SetSyn("cpp")<CR> an 50.20.120 &Syntax.C.C# :cal SetSyn("cs")<CR> @@ -117,74 +121,81 @@ an 50.20.270 &Syntax.C.Clever :cal SetSyn("cl")<CR> an 50.20.280 &Syntax.C.Clipper :cal SetSyn("clipper")<CR> an 50.20.290 &Syntax.C.Clojure :cal SetSyn("clojure")<CR> an 50.20.300 &Syntax.C.Cmake :cal SetSyn("cmake")<CR> -an 50.20.310 &Syntax.C.Cmusrc :cal SetSyn("cmusrc")<CR> -an 50.20.320 &Syntax.C.Cobol :cal SetSyn("cobol")<CR> -an 50.20.330 &Syntax.C.Coco/R :cal SetSyn("coco")<CR> -an 50.20.340 &Syntax.C.Cold\ Fusion :cal SetSyn("cf")<CR> -an 50.20.350 &Syntax.C.Conary\ Recipe :cal SetSyn("conaryrecipe")<CR> -an 50.20.360 &Syntax.C.Config.Cfg\ Config\ file :cal SetSyn("cfg")<CR> -an 50.20.370 &Syntax.C.Config.Configure\.in :cal SetSyn("config")<CR> -an 50.20.380 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR> -an 50.20.390 &Syntax.C.CRM114 :cal SetSyn("crm")<CR> -an 50.20.400 &Syntax.C.Crontab :cal SetSyn("crontab")<CR> -an 50.20.410 &Syntax.C.CSDL :cal SetSyn("csdl")<CR> -an 50.20.420 &Syntax.C.CSP :cal SetSyn("csp")<CR> -an 50.20.430 &Syntax.C.Ctrl-H :cal SetSyn("ctrlh")<CR> -an 50.20.440 &Syntax.C.Cucumber :cal SetSyn("cucumber")<CR> -an 50.20.450 &Syntax.C.CUDA :cal SetSyn("cuda")<CR> -an 50.20.460 &Syntax.C.CUPL.CUPL :cal SetSyn("cupl")<CR> -an 50.20.470 &Syntax.C.CUPL.Simulation :cal SetSyn("cuplsim")<CR> -an 50.20.480 &Syntax.C.CVS.commit\ file :cal SetSyn("cvs")<CR> -an 50.20.490 &Syntax.C.CVS.cvsrc :cal SetSyn("cvsrc")<CR> -an 50.20.500 &Syntax.C.Cyn++ :cal SetSyn("cynpp")<CR> -an 50.20.510 &Syntax.C.Cynlib :cal SetSyn("cynlib")<CR> +an 50.20.310 &Syntax.C.Cmod :cal SetSyn("cmod")<CR> +an 50.20.320 &Syntax.C.Cmusrc :cal SetSyn("cmusrc")<CR> +an 50.20.330 &Syntax.C.Cobol :cal SetSyn("cobol")<CR> +an 50.20.340 &Syntax.C.Coco/R :cal SetSyn("coco")<CR> +an 50.20.350 &Syntax.C.Cold\ Fusion :cal SetSyn("cf")<CR> +an 50.20.360 &Syntax.C.Conary\ Recipe :cal SetSyn("conaryrecipe")<CR> +an 50.20.370 &Syntax.C.Config.Cfg\ Config\ file :cal SetSyn("cfg")<CR> +an 50.20.380 &Syntax.C.Config.Configure\.in :cal SetSyn("config")<CR> +an 50.20.390 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR> +an 50.20.400 &Syntax.C.CRM114 :cal SetSyn("crm")<CR> +an 50.20.410 &Syntax.C.Crontab :cal SetSyn("crontab")<CR> +an 50.20.420 &Syntax.C.CSDL :cal SetSyn("csdl")<CR> +an 50.20.430 &Syntax.C.CSP :cal SetSyn("csp")<CR> +an 50.20.440 &Syntax.C.Ctrl-H :cal SetSyn("ctrlh")<CR> +an 50.20.450 &Syntax.C.Cucumber :cal SetSyn("cucumber")<CR> +an 50.20.460 &Syntax.C.CUDA :cal SetSyn("cuda")<CR> +an 50.20.470 &Syntax.C.CUPL.CUPL :cal SetSyn("cupl")<CR> +an 50.20.480 &Syntax.C.CUPL.Simulation :cal SetSyn("cuplsim")<CR> +an 50.20.490 &Syntax.C.CVS.commit\ file :cal SetSyn("cvs")<CR> +an 50.20.500 &Syntax.C.CVS.cvsrc :cal SetSyn("cvsrc")<CR> +an 50.20.510 &Syntax.C.Cyn++ :cal SetSyn("cynpp")<CR> +an 50.20.520 &Syntax.C.Cynlib :cal SetSyn("cynlib")<CR> an 50.30.100 &Syntax.DE.D :cal SetSyn("d")<CR> an 50.30.110 &Syntax.DE.Datascript :cal SetSyn("datascript")<CR> an 50.30.120 &Syntax.DE.Debian.Debian\ ChangeLog :cal SetSyn("debchangelog")<CR> an 50.30.130 &Syntax.DE.Debian.Debian\ Control :cal SetSyn("debcontrol")<CR> -an 50.30.140 &Syntax.DE.Debian.Debian\ Sources\.list :cal SetSyn("debsources")<CR> -an 50.30.150 &Syntax.DE.Denyhosts :cal SetSyn("denyhosts")<CR> -an 50.30.160 &Syntax.DE.Desktop :cal SetSyn("desktop")<CR> -an 50.30.170 &Syntax.DE.Dict\ config :cal SetSyn("dictconf")<CR> -an 50.30.180 &Syntax.DE.Dictd\ config :cal SetSyn("dictdconf")<CR> -an 50.30.190 &Syntax.DE.Diff :cal SetSyn("diff")<CR> -an 50.30.200 &Syntax.DE.Digital\ Command\ Lang :cal SetSyn("dcl")<CR> -an 50.30.210 &Syntax.DE.Dircolors :cal SetSyn("dircolors")<CR> -an 50.30.220 &Syntax.DE.Django\ template :cal SetSyn("django")<CR> -an 50.30.230 &Syntax.DE.DNS/BIND\ zone :cal SetSyn("bindzone")<CR> -an 50.30.240 &Syntax.DE.Dnsmasq\ config :cal SetSyn("dnsmasq")<CR> -an 50.30.250 &Syntax.DE.DocBook.auto-detect :cal SetSyn("docbk")<CR> -an 50.30.260 &Syntax.DE.DocBook.SGML :cal SetSyn("docbksgml")<CR> -an 50.30.270 &Syntax.DE.DocBook.XML :cal SetSyn("docbkxml")<CR> -an 50.30.280 &Syntax.DE.Dot :cal SetSyn("dot")<CR> -an 50.30.290 &Syntax.DE.Doxygen.C\ with\ doxygen :cal SetSyn("c.doxygen")<CR> -an 50.30.300 &Syntax.DE.Doxygen.C++\ with\ doxygen :cal SetSyn("cpp.doxygen")<CR> -an 50.30.310 &Syntax.DE.Doxygen.IDL\ with\ doxygen :cal SetSyn("idl.doxygen")<CR> -an 50.30.320 &Syntax.DE.Doxygen.Java\ with\ doxygen :cal SetSyn("java.doxygen")<CR> -an 50.30.330 &Syntax.DE.Dracula :cal SetSyn("dracula")<CR> -an 50.30.340 &Syntax.DE.DSSSL :cal SetSyn("dsl")<CR> -an 50.30.350 &Syntax.DE.DTD :cal SetSyn("dtd")<CR> -an 50.30.360 &Syntax.DE.DTML\ (Zope) :cal SetSyn("dtml")<CR> -an 50.30.370 &Syntax.DE.DTrace :cal SetSyn("dtrace")<CR> -an 50.30.380 &Syntax.DE.Dts/dtsi :cal SetSyn("dts")<CR> -an 50.30.390 &Syntax.DE.Dylan.Dylan :cal SetSyn("dylan")<CR> -an 50.30.400 &Syntax.DE.Dylan.Dylan\ interface :cal SetSyn("dylanintr")<CR> -an 50.30.410 &Syntax.DE.Dylan.Dylan\ lid :cal SetSyn("dylanlid")<CR> -an 50.30.430 &Syntax.DE.EDIF :cal SetSyn("edif")<CR> -an 50.30.440 &Syntax.DE.Eiffel :cal SetSyn("eiffel")<CR> -an 50.30.450 &Syntax.DE.Elinks\ config :cal SetSyn("elinks")<CR> -an 50.30.460 &Syntax.DE.Elm\ filter\ rules :cal SetSyn("elmfilt")<CR> -an 50.30.470 &Syntax.DE.Embedix\ Component\ Description :cal SetSyn("ecd")<CR> -an 50.30.480 &Syntax.DE.ERicsson\ LANGuage :cal SetSyn("erlang")<CR> -an 50.30.490 &Syntax.DE.ESMTP\ rc :cal SetSyn("esmtprc")<CR> -an 50.30.500 &Syntax.DE.ESQL-C :cal SetSyn("esqlc")<CR> -an 50.30.510 &Syntax.DE.Essbase\ script :cal SetSyn("csc")<CR> -an 50.30.520 &Syntax.DE.Esterel :cal SetSyn("esterel")<CR> -an 50.30.530 &Syntax.DE.Eterm\ config :cal SetSyn("eterm")<CR> -an 50.30.540 &Syntax.DE.Eviews :cal SetSyn("eviews")<CR> -an 50.30.550 &Syntax.DE.Exim\ conf :cal SetSyn("exim")<CR> -an 50.30.560 &Syntax.DE.Expect :cal SetSyn("expect")<CR> -an 50.30.570 &Syntax.DE.Exports :cal SetSyn("exports")<CR> +an 50.30.140 &Syntax.DE.Debian.Debian\ Copyright :cal SetSyn("debcopyright")<CR> +an 50.30.150 &Syntax.DE.Debian.Debian\ Sources\.list :cal SetSyn("debsources")<CR> +an 50.30.160 &Syntax.DE.Denyhosts :cal SetSyn("denyhosts")<CR> +an 50.30.170 &Syntax.DE.Desktop :cal SetSyn("desktop")<CR> +an 50.30.180 &Syntax.DE.Dict\ config :cal SetSyn("dictconf")<CR> +an 50.30.190 &Syntax.DE.Dictd\ config :cal SetSyn("dictdconf")<CR> +an 50.30.200 &Syntax.DE.Diff :cal SetSyn("diff")<CR> +an 50.30.210 &Syntax.DE.Digital\ Command\ Lang :cal SetSyn("dcl")<CR> +an 50.30.220 &Syntax.DE.Dircolors :cal SetSyn("dircolors")<CR> +an 50.30.230 &Syntax.DE.Dirpager :cal SetSyn("dirpager")<CR> +an 50.30.240 &Syntax.DE.Django\ template :cal SetSyn("django")<CR> +an 50.30.250 &Syntax.DE.DNS/BIND\ zone :cal SetSyn("bindzone")<CR> +an 50.30.260 &Syntax.DE.Dnsmasq\ config :cal SetSyn("dnsmasq")<CR> +an 50.30.270 &Syntax.DE.DocBook.auto-detect :cal SetSyn("docbk")<CR> +an 50.30.280 &Syntax.DE.DocBook.SGML :cal SetSyn("docbksgml")<CR> +an 50.30.290 &Syntax.DE.DocBook.XML :cal SetSyn("docbkxml")<CR> +an 50.30.300 &Syntax.DE.Dockerfile :cal SetSyn("dockerfile")<CR> +an 50.30.310 &Syntax.DE.Dot :cal SetSyn("dot")<CR> +an 50.30.320 &Syntax.DE.Doxygen.C\ with\ doxygen :cal SetSyn("c.doxygen")<CR> +an 50.30.330 &Syntax.DE.Doxygen.C++\ with\ doxygen :cal SetSyn("cpp.doxygen")<CR> +an 50.30.340 &Syntax.DE.Doxygen.IDL\ with\ doxygen :cal SetSyn("idl.doxygen")<CR> +an 50.30.350 &Syntax.DE.Doxygen.Java\ with\ doxygen :cal SetSyn("java.doxygen")<CR> +an 50.30.360 &Syntax.DE.Doxygen.DataScript\ with\ doxygen :cal SetSyn("datascript.doxygen")<CR> +an 50.30.370 &Syntax.DE.Dracula :cal SetSyn("dracula")<CR> +an 50.30.380 &Syntax.DE.DSSSL :cal SetSyn("dsl")<CR> +an 50.30.390 &Syntax.DE.DTD :cal SetSyn("dtd")<CR> +an 50.30.400 &Syntax.DE.DTML\ (Zope) :cal SetSyn("dtml")<CR> +an 50.30.410 &Syntax.DE.DTrace :cal SetSyn("dtrace")<CR> +an 50.30.420 &Syntax.DE.Dts/dtsi :cal SetSyn("dts")<CR> +an 50.30.430 &Syntax.DE.Dylan.Dylan :cal SetSyn("dylan")<CR> +an 50.30.440 &Syntax.DE.Dylan.Dylan\ interface :cal SetSyn("dylanintr")<CR> +an 50.30.450 &Syntax.DE.Dylan.Dylan\ lid :cal SetSyn("dylanlid")<CR> +an 50.30.470 &Syntax.DE.EDIF :cal SetSyn("edif")<CR> +an 50.30.480 &Syntax.DE.Eiffel :cal SetSyn("eiffel")<CR> +an 50.30.490 &Syntax.DE.Elinks\ config :cal SetSyn("elinks")<CR> +an 50.30.500 &Syntax.DE.Elm\ filter\ rules :cal SetSyn("elmfilt")<CR> +an 50.30.510 &Syntax.DE.Embedix\ Component\ Description :cal SetSyn("ecd")<CR> +an 50.30.520 &Syntax.DE.ERicsson\ LANGuage :cal SetSyn("erlang")<CR> +an 50.30.530 &Syntax.DE.ESMTP\ rc :cal SetSyn("esmtprc")<CR> +an 50.30.540 &Syntax.DE.ESQL-C :cal SetSyn("esqlc")<CR> +an 50.30.550 &Syntax.DE.Essbase\ script :cal SetSyn("csc")<CR> +an 50.30.560 &Syntax.DE.Esterel :cal SetSyn("esterel")<CR> +an 50.30.570 &Syntax.DE.Eterm\ config :cal SetSyn("eterm")<CR> +an 50.30.580 &Syntax.DE.Euphoria\ 3 :cal SetSyn("euphoria3")<CR> +an 50.30.590 &Syntax.DE.Euphoria\ 4 :cal SetSyn("euphoria4")<CR> +an 50.30.600 &Syntax.DE.Eviews :cal SetSyn("eviews")<CR> +an 50.30.610 &Syntax.DE.Exim\ conf :cal SetSyn("exim")<CR> +an 50.30.620 &Syntax.DE.Expect :cal SetSyn("expect")<CR> +an 50.30.630 &Syntax.DE.Exports :cal SetSyn("exports")<CR> an 50.40.100 &Syntax.FG.Falcon :cal SetSyn("falcon")<CR> an 50.40.110 &Syntax.FG.Fantom :cal SetSyn("fan")<CR> an 50.40.120 &Syntax.FG.Fetchmail :cal SetSyn("fetchmail")<CR> @@ -211,18 +222,20 @@ an 50.40.330 &Syntax.FG.Git.Send\ Email :cal SetSyn("gitsendemail")<CR> an 50.40.340 &Syntax.FG.Gitolite :cal SetSyn("gitolite")<CR> an 50.40.350 &Syntax.FG.Gkrellmrc :cal SetSyn("gkrellmrc")<CR> an 50.40.360 &Syntax.FG.Gnash :cal SetSyn("gnash")<CR> -an 50.40.370 &Syntax.FG.GP :cal SetSyn("gp")<CR> -an 50.40.380 &Syntax.FG.GPG :cal SetSyn("gpg")<CR> -an 50.40.390 &Syntax.FG.Grof :cal SetSyn("gprof")<CR> -an 50.40.400 &Syntax.FG.Group\ file :cal SetSyn("group")<CR> -an 50.40.410 &Syntax.FG.Grub :cal SetSyn("grub")<CR> -an 50.40.420 &Syntax.FG.GNU\ Server\ Pages :cal SetSyn("gsp")<CR> -an 50.40.430 &Syntax.FG.GNUplot :cal SetSyn("gnuplot")<CR> -an 50.40.440 &Syntax.FG.GrADS\ scripts :cal SetSyn("grads")<CR> -an 50.40.450 &Syntax.FG.Gretl :cal SetSyn("gretl")<CR> -an 50.40.460 &Syntax.FG.Groff :cal SetSyn("groff")<CR> -an 50.40.470 &Syntax.FG.Groovy :cal SetSyn("groovy")<CR> -an 50.40.480 &Syntax.FG.GTKrc :cal SetSyn("gtkrc")<CR> +an 50.40.370 &Syntax.FG.Go :cal SetSyn("go")<CR> +an 50.40.380 &Syntax.FG.Godoc :cal SetSyn("godoc")<CR> +an 50.40.390 &Syntax.FG.GP :cal SetSyn("gp")<CR> +an 50.40.400 &Syntax.FG.GPG :cal SetSyn("gpg")<CR> +an 50.40.410 &Syntax.FG.Grof :cal SetSyn("gprof")<CR> +an 50.40.420 &Syntax.FG.Group\ file :cal SetSyn("group")<CR> +an 50.40.430 &Syntax.FG.Grub :cal SetSyn("grub")<CR> +an 50.40.440 &Syntax.FG.GNU\ Server\ Pages :cal SetSyn("gsp")<CR> +an 50.40.450 &Syntax.FG.GNUplot :cal SetSyn("gnuplot")<CR> +an 50.40.460 &Syntax.FG.GrADS\ scripts :cal SetSyn("grads")<CR> +an 50.40.470 &Syntax.FG.Gretl :cal SetSyn("gretl")<CR> +an 50.40.480 &Syntax.FG.Groff :cal SetSyn("groff")<CR> +an 50.40.490 &Syntax.FG.Groovy :cal SetSyn("groovy")<CR> +an 50.40.500 &Syntax.FG.GTKrc :cal SetSyn("gtkrc")<CR> an 50.50.100 &Syntax.HIJK.Haml :cal SetSyn("haml")<CR> an 50.50.110 &Syntax.HIJK.Hamster :cal SetSyn("hamster")<CR> an 50.50.120 &Syntax.HIJK.Haskell.Haskell :cal SetSyn("haskell")<CR> @@ -256,55 +269,60 @@ an 50.50.400 &Syntax.HIJK.Inittab :cal SetSyn("inittab")<CR> an 50.50.410 &Syntax.HIJK.Inno\ setup :cal SetSyn("iss")<CR> an 50.50.420 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ dat :cal SetSyn("upstreamdat")<CR> an 50.50.430 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ log :cal SetSyn("upstreamlog")<CR> -an 50.50.440 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log :cal SetSyn("upstreaminstalllog")<CR> -an 50.50.450 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn("usserverlog")<CR> -an 50.50.460 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn("usw2kagtlog")<CR> -an 50.50.470 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd")<CR> -an 50.50.480 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang")<CR> -an 50.50.490 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter")<CR> -an 50.50.510 &Syntax.HIJK.JAL :cal SetSyn("jal")<CR> -an 50.50.520 &Syntax.HIJK.JAM :cal SetSyn("jam")<CR> -an 50.50.530 &Syntax.HIJK.Jargon :cal SetSyn("jargon")<CR> -an 50.50.540 &Syntax.HIJK.Java.Java :cal SetSyn("java")<CR> -an 50.50.550 &Syntax.HIJK.Java.JavaCC :cal SetSyn("javacc")<CR> -an 50.50.560 &Syntax.HIJK.Java.Java\ Server\ Pages :cal SetSyn("jsp")<CR> -an 50.50.570 &Syntax.HIJK.Java.Java\ Properties :cal SetSyn("jproperties")<CR> -an 50.50.580 &Syntax.HIJK.JavaScript :cal SetSyn("javascript")<CR> -an 50.50.590 &Syntax.HIJK.Jess :cal SetSyn("jess")<CR> -an 50.50.600 &Syntax.HIJK.Jgraph :cal SetSyn("jgraph")<CR> -an 50.50.610 &Syntax.HIJK.Jovial :cal SetSyn("jovial")<CR> -an 50.50.630 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig")<CR> -an 50.50.640 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript")<CR> -an 50.50.650 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt")<CR> -an 50.50.660 &Syntax.HIJK.KixTart :cal SetSyn("kix")<CR> +an 50.50.440 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ rpt :cal SetSyn("upstreamrpt")<CR> +an 50.50.450 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log :cal SetSyn("upstreaminstalllog")<CR> +an 50.50.460 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn("usserverlog")<CR> +an 50.50.470 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn("usw2kagtlog")<CR> +an 50.50.480 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd")<CR> +an 50.50.490 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang")<CR> +an 50.50.500 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter")<CR> +an 50.50.520 &Syntax.HIJK.J :cal SetSyn("j")<CR> +an 50.50.530 &Syntax.HIJK.JAL :cal SetSyn("jal")<CR> +an 50.50.540 &Syntax.HIJK.JAM :cal SetSyn("jam")<CR> +an 50.50.550 &Syntax.HIJK.Jargon :cal SetSyn("jargon")<CR> +an 50.50.560 &Syntax.HIJK.Java.Java :cal SetSyn("java")<CR> +an 50.50.570 &Syntax.HIJK.Java.JavaCC :cal SetSyn("javacc")<CR> +an 50.50.580 &Syntax.HIJK.Java.Java\ Server\ Pages :cal SetSyn("jsp")<CR> +an 50.50.590 &Syntax.HIJK.Java.Java\ Properties :cal SetSyn("jproperties")<CR> +an 50.50.600 &Syntax.HIJK.JavaScript :cal SetSyn("javascript")<CR> +an 50.50.610 &Syntax.HIJK.Jess :cal SetSyn("jess")<CR> +an 50.50.620 &Syntax.HIJK.Jgraph :cal SetSyn("jgraph")<CR> +an 50.50.630 &Syntax.HIJK.Jovial :cal SetSyn("jovial")<CR> +an 50.50.640 &Syntax.HIJK.JSON :cal SetSyn("json")<CR> +an 50.50.660 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig")<CR> +an 50.50.670 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript")<CR> +an 50.50.680 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt")<CR> +an 50.50.690 &Syntax.HIJK.Kivy :cal SetSyn("kivy")<CR> +an 50.50.700 &Syntax.HIJK.KixTart :cal SetSyn("kix")<CR> an 50.60.100 &Syntax.L.Lace :cal SetSyn("lace")<CR> an 50.60.110 &Syntax.L.LamdaProlog :cal SetSyn("lprolog")<CR> an 50.60.120 &Syntax.L.Latte :cal SetSyn("latte")<CR> an 50.60.130 &Syntax.L.Ld\ script :cal SetSyn("ld")<CR> an 50.60.140 &Syntax.L.LDAP.LDIF :cal SetSyn("ldif")<CR> an 50.60.150 &Syntax.L.LDAP.Configuration :cal SetSyn("ldapconf")<CR> -an 50.60.160 &Syntax.L.Lex :cal SetSyn("lex")<CR> -an 50.60.170 &Syntax.L.LFTP\ config :cal SetSyn("lftp")<CR> -an 50.60.180 &Syntax.L.Libao :cal SetSyn("libao")<CR> -an 50.60.190 &Syntax.L.LifeLines\ script :cal SetSyn("lifelines")<CR> -an 50.60.200 &Syntax.L.Lilo :cal SetSyn("lilo")<CR> -an 50.60.210 &Syntax.L.Limits\ config :cal SetSyn("limits")<CR> -an 50.60.220 &Syntax.L.Linden\ scripting :cal SetSyn("lsl")<CR> -an 50.60.230 &Syntax.L.Liquid :cal SetSyn("liquid")<CR> -an 50.60.240 &Syntax.L.Lisp :cal SetSyn("lisp")<CR> -an 50.60.250 &Syntax.L.Lite :cal SetSyn("lite")<CR> -an 50.60.260 &Syntax.L.LiteStep\ RC :cal SetSyn("litestep")<CR> -an 50.60.270 &Syntax.L.Locale\ Input :cal SetSyn("fdcc")<CR> -an 50.60.280 &Syntax.L.Login\.access :cal SetSyn("loginaccess")<CR> -an 50.60.290 &Syntax.L.Login\.defs :cal SetSyn("logindefs")<CR> -an 50.60.300 &Syntax.L.Logtalk :cal SetSyn("logtalk")<CR> -an 50.60.310 &Syntax.L.LOTOS :cal SetSyn("lotos")<CR> -an 50.60.320 &Syntax.L.LotusScript :cal SetSyn("lscript")<CR> -an 50.60.330 &Syntax.L.Lout :cal SetSyn("lout")<CR> -an 50.60.340 &Syntax.L.LPC :cal SetSyn("lpc")<CR> -an 50.60.350 &Syntax.L.Lua :cal SetSyn("lua")<CR> -an 50.60.360 &Syntax.L.Lynx\ Style :cal SetSyn("lss")<CR> -an 50.60.370 &Syntax.L.Lynx\ config :cal SetSyn("lynx")<CR> +an 50.60.160 &Syntax.L.Less :cal SetSyn("less")<CR> +an 50.60.170 &Syntax.L.Lex :cal SetSyn("lex")<CR> +an 50.60.180 &Syntax.L.LFTP\ config :cal SetSyn("lftp")<CR> +an 50.60.190 &Syntax.L.Libao :cal SetSyn("libao")<CR> +an 50.60.200 &Syntax.L.LifeLines\ script :cal SetSyn("lifelines")<CR> +an 50.60.210 &Syntax.L.Lilo :cal SetSyn("lilo")<CR> +an 50.60.220 &Syntax.L.Limits\ config :cal SetSyn("limits")<CR> +an 50.60.230 &Syntax.L.Linden\ scripting :cal SetSyn("lsl")<CR> +an 50.60.240 &Syntax.L.Liquid :cal SetSyn("liquid")<CR> +an 50.60.250 &Syntax.L.Lisp :cal SetSyn("lisp")<CR> +an 50.60.260 &Syntax.L.Lite :cal SetSyn("lite")<CR> +an 50.60.270 &Syntax.L.LiteStep\ RC :cal SetSyn("litestep")<CR> +an 50.60.280 &Syntax.L.Locale\ Input :cal SetSyn("fdcc")<CR> +an 50.60.290 &Syntax.L.Login\.access :cal SetSyn("loginaccess")<CR> +an 50.60.300 &Syntax.L.Login\.defs :cal SetSyn("logindefs")<CR> +an 50.60.310 &Syntax.L.Logtalk :cal SetSyn("logtalk")<CR> +an 50.60.320 &Syntax.L.LOTOS :cal SetSyn("lotos")<CR> +an 50.60.330 &Syntax.L.LotusScript :cal SetSyn("lscript")<CR> +an 50.60.340 &Syntax.L.Lout :cal SetSyn("lout")<CR> +an 50.60.350 &Syntax.L.LPC :cal SetSyn("lpc")<CR> +an 50.60.360 &Syntax.L.Lua :cal SetSyn("lua")<CR> +an 50.60.370 &Syntax.L.Lynx\ Style :cal SetSyn("lss")<CR> +an 50.60.380 &Syntax.L.Lynx\ config :cal SetSyn("lynx")<CR> an 50.70.100 &Syntax.M.M4 :cal SetSyn("m4")<CR> an 50.70.110 &Syntax.M.MaGic\ Point :cal SetSyn("mgp")<CR> an 50.70.120 &Syntax.M.Mail :cal SetSyn("mail")<CR> @@ -317,54 +335,60 @@ an 50.70.180 &Syntax.M.Man\ page :cal SetSyn("man")<CR> an 50.70.190 &Syntax.M.Man\.conf :cal SetSyn("manconf")<CR> an 50.70.200 &Syntax.M.Maple\ V :cal SetSyn("maple")<CR> an 50.70.210 &Syntax.M.Markdown :cal SetSyn("markdown")<CR> -an 50.70.220 &Syntax.M.Mason :cal SetSyn("mason")<CR> -an 50.70.230 &Syntax.M.Mathematica :cal SetSyn("mma")<CR> -an 50.70.240 &Syntax.M.Matlab :cal SetSyn("matlab")<CR> -an 50.70.250 &Syntax.M.Maxima :cal SetSyn("maxima")<CR> -an 50.70.260 &Syntax.M.MEL\ (for\ Maya) :cal SetSyn("mel")<CR> -an 50.70.270 &Syntax.M.Messages\ (/var/log) :cal SetSyn("messages")<CR> -an 50.70.280 &Syntax.M.Metafont :cal SetSyn("mf")<CR> -an 50.70.290 &Syntax.M.MetaPost :cal SetSyn("mp")<CR> -an 50.70.300 &Syntax.M.MGL :cal SetSyn("mgl")<CR> -an 50.70.310 &Syntax.M.MMIX :cal SetSyn("mmix")<CR> -an 50.70.320 &Syntax.M.Modconf :cal SetSyn("modconf")<CR> -an 50.70.330 &Syntax.M.Model :cal SetSyn("model")<CR> -an 50.70.340 &Syntax.M.Modsim\ III :cal SetSyn("modsim3")<CR> -an 50.70.350 &Syntax.M.Modula\ 2 :cal SetSyn("modula2")<CR> -an 50.70.360 &Syntax.M.Modula\ 3 :cal SetSyn("modula3")<CR> -an 50.70.370 &Syntax.M.Monk :cal SetSyn("monk")<CR> -an 50.70.380 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR> -an 50.70.390 &Syntax.M.MOO :cal SetSyn("moo")<CR> -an 50.70.400 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR> -an 50.70.410 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR> -an 50.70.420 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR> -an 50.70.430 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR> -an 50.70.440 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR> -an 50.70.450 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR> -an 50.70.460 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR> -an 50.70.470 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR> -an 50.70.480 &Syntax.M.Msql :cal SetSyn("msql")<CR> -an 50.70.490 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR> -an 50.70.500 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR> -an 50.70.510 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR> -an 50.80.100 &Syntax.NO.Nanorc :cal SetSyn("nanorc")<CR> -an 50.80.110 &Syntax.NO.Nastran\ input/DMAP :cal SetSyn("nastran")<CR> -an 50.80.120 &Syntax.NO.Natural :cal SetSyn("natural")<CR> -an 50.80.130 &Syntax.NO.Netrc :cal SetSyn("netrc")<CR> -an 50.80.140 &Syntax.NO.Ninja :cal SetSyn("ninja")<CR> -an 50.80.150 &Syntax.NO.Novell\ NCF\ batch :cal SetSyn("ncf")<CR> -an 50.80.160 &Syntax.NO.Not\ Quite\ C\ (LEGO) :cal SetSyn("nqc")<CR> -an 50.80.170 &Syntax.NO.Nroff :cal SetSyn("nroff")<CR> -an 50.80.180 &Syntax.NO.NSIS\ script :cal SetSyn("nsis")<CR> -an 50.80.200 &Syntax.NO.Obj\ 3D\ wavefront :cal SetSyn("obj")<CR> -an 50.80.210 &Syntax.NO.Objective\ C :cal SetSyn("objc")<CR> -an 50.80.220 &Syntax.NO.Objective\ C++ :cal SetSyn("objcpp")<CR> -an 50.80.230 &Syntax.NO.OCAML :cal SetSyn("ocaml")<CR> -an 50.80.240 &Syntax.NO.Occam :cal SetSyn("occam")<CR> -an 50.80.250 &Syntax.NO.Omnimark :cal SetSyn("omnimark")<CR> -an 50.80.260 &Syntax.NO.OpenROAD :cal SetSyn("openroad")<CR> -an 50.80.270 &Syntax.NO.Open\ Psion\ Lang :cal SetSyn("opl")<CR> -an 50.80.280 &Syntax.NO.Oracle\ config :cal SetSyn("ora")<CR> +an 50.70.220 &Syntax.M.Markdown\ with\ R\ statements :cal SetSyn("rmd")<CR> +an 50.70.230 &Syntax.M.Mason :cal SetSyn("mason")<CR> +an 50.70.240 &Syntax.M.Mathematica :cal SetSyn("mma")<CR> +an 50.70.250 &Syntax.M.Matlab :cal SetSyn("matlab")<CR> +an 50.70.260 &Syntax.M.Maxima :cal SetSyn("maxima")<CR> +an 50.70.270 &Syntax.M.MEL\ (for\ Maya) :cal SetSyn("mel")<CR> +an 50.70.280 &Syntax.M.Messages\ (/var/log) :cal SetSyn("messages")<CR> +an 50.70.290 &Syntax.M.Metafont :cal SetSyn("mf")<CR> +an 50.70.300 &Syntax.M.MetaPost :cal SetSyn("mp")<CR> +an 50.70.310 &Syntax.M.MGL :cal SetSyn("mgl")<CR> +an 50.70.320 &Syntax.M.MIX :cal SetSyn("mix")<CR> +an 50.70.330 &Syntax.M.MMIX :cal SetSyn("mmix")<CR> +an 50.70.340 &Syntax.M.Modconf :cal SetSyn("modconf")<CR> +an 50.70.350 &Syntax.M.Model :cal SetSyn("model")<CR> +an 50.70.360 &Syntax.M.Modsim\ III :cal SetSyn("modsim3")<CR> +an 50.70.370 &Syntax.M.Modula\ 2 :cal SetSyn("modula2")<CR> +an 50.70.380 &Syntax.M.Modula\ 3 :cal SetSyn("modula3")<CR> +an 50.70.390 &Syntax.M.Monk :cal SetSyn("monk")<CR> +an 50.70.400 &Syntax.M.Motorola\ S-Record :cal SetSyn("srec")<CR> +an 50.70.410 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR> +an 50.70.420 &Syntax.M.MOO :cal SetSyn("moo")<CR> +an 50.70.430 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR> +an 50.70.440 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR> +an 50.70.450 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR> +an 50.70.460 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR> +an 50.70.470 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR> +an 50.70.480 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR> +an 50.70.490 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR> +an 50.70.500 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR> +an 50.70.510 &Syntax.M.Msql :cal SetSyn("msql")<CR> +an 50.70.520 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR> +an 50.70.530 &Syntax.M.Murphi :cal SetSyn("murphi")<CR> +an 50.70.540 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR> +an 50.70.550 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR> +an 50.80.100 &Syntax.NO.N1QL :cal SetSyn("n1ql")<CR> +an 50.80.110 &Syntax.NO.Nanorc :cal SetSyn("nanorc")<CR> +an 50.80.120 &Syntax.NO.Nastran\ input/DMAP :cal SetSyn("nastran")<CR> +an 50.80.130 &Syntax.NO.Natural :cal SetSyn("natural")<CR> +an 50.80.140 &Syntax.NO.NeoMutt\ setup\ files :cal SetSyn("neomuttrc")<CR> +an 50.80.150 &Syntax.NO.Netrc :cal SetSyn("netrc")<CR> +an 50.80.160 &Syntax.NO.Ninja :cal SetSyn("ninja")<CR> +an 50.80.170 &Syntax.NO.Novell\ NCF\ batch :cal SetSyn("ncf")<CR> +an 50.80.180 &Syntax.NO.Not\ Quite\ C\ (LEGO) :cal SetSyn("nqc")<CR> +an 50.80.190 &Syntax.NO.Nroff :cal SetSyn("nroff")<CR> +an 50.80.200 &Syntax.NO.NSIS\ script :cal SetSyn("nsis")<CR> +an 50.80.220 &Syntax.NO.Obj\ 3D\ wavefront :cal SetSyn("obj")<CR> +an 50.80.230 &Syntax.NO.Objective\ C :cal SetSyn("objc")<CR> +an 50.80.240 &Syntax.NO.Objective\ C++ :cal SetSyn("objcpp")<CR> +an 50.80.250 &Syntax.NO.OCAML :cal SetSyn("ocaml")<CR> +an 50.80.260 &Syntax.NO.Occam :cal SetSyn("occam")<CR> +an 50.80.270 &Syntax.NO.Omnimark :cal SetSyn("omnimark")<CR> +an 50.80.280 &Syntax.NO.OpenROAD :cal SetSyn("openroad")<CR> +an 50.80.290 &Syntax.NO.Open\ Psion\ Lang :cal SetSyn("opl")<CR> +an 50.80.300 &Syntax.NO.Oracle\ config :cal SetSyn("ora")<CR> an 50.90.100 &Syntax.PQ.Packet\ filter\ conf :cal SetSyn("pf")<CR> an 50.90.110 &Syntax.PQ.Palm\ resource\ compiler :cal SetSyn("pilrc")<CR> an 50.90.120 &Syntax.PQ.Pam\ config :cal SetSyn("pamconf")<CR> @@ -435,179 +459,189 @@ an 50.100.300 &Syntax.R.RockLinux\ package\ desc\. :cal SetSyn("desc")<CR> an 50.100.310 &Syntax.R.Rpcgen :cal SetSyn("rpcgen")<CR> an 50.100.320 &Syntax.R.RPL/2 :cal SetSyn("rpl")<CR> an 50.100.330 &Syntax.R.ReStructuredText :cal SetSyn("rst")<CR> -an 50.100.340 &Syntax.R.RTF :cal SetSyn("rtf")<CR> -an 50.100.350 &Syntax.R.Ruby :cal SetSyn("ruby")<CR> -an 50.110.100 &Syntax.S-Sm.S-Lang :cal SetSyn("slang")<CR> -an 50.110.110 &Syntax.S-Sm.Samba\ config :cal SetSyn("samba")<CR> -an 50.110.120 &Syntax.S-Sm.SAS :cal SetSyn("sas")<CR> -an 50.110.130 &Syntax.S-Sm.Sass :cal SetSyn("sass")<CR> -an 50.110.140 &Syntax.S-Sm.Sather :cal SetSyn("sather")<CR> -an 50.110.150 &Syntax.S-Sm.Scheme :cal SetSyn("scheme")<CR> -an 50.110.160 &Syntax.S-Sm.Scilab :cal SetSyn("scilab")<CR> -an 50.110.170 &Syntax.S-Sm.Screen\ RC :cal SetSyn("screen")<CR> -an 50.110.180 &Syntax.S-Sm.SCSS :cal SetSyn("scss")<CR> -an 50.110.190 &Syntax.S-Sm.SDC\ Synopsys\ Design\ Constraints :cal SetSyn("sdc")<CR> -an 50.110.200 &Syntax.S-Sm.SDL :cal SetSyn("sdl")<CR> -an 50.110.210 &Syntax.S-Sm.Sed :cal SetSyn("sed")<CR> -an 50.110.220 &Syntax.S-Sm.Sendmail\.cf :cal SetSyn("sm")<CR> -an 50.110.230 &Syntax.S-Sm.Send-pr :cal SetSyn("sendpr")<CR> -an 50.110.240 &Syntax.S-Sm.Sensors\.conf :cal SetSyn("sensors")<CR> -an 50.110.250 &Syntax.S-Sm.Service\ Location\ config :cal SetSyn("slpconf")<CR> -an 50.110.260 &Syntax.S-Sm.Service\ Location\ registration :cal SetSyn("slpreg")<CR> -an 50.110.270 &Syntax.S-Sm.Service\ Location\ SPI :cal SetSyn("slpspi")<CR> -an 50.110.280 &Syntax.S-Sm.Services :cal SetSyn("services")<CR> -an 50.110.290 &Syntax.S-Sm.Setserial\ config :cal SetSyn("setserial")<CR> -an 50.110.300 &Syntax.S-Sm.SGML.SGML\ catalog :cal SetSyn("catalog")<CR> -an 50.110.310 &Syntax.S-Sm.SGML.SGML\ DTD :cal SetSyn("sgml")<CR> -an 50.110.320 &Syntax.S-Sm.SGML.SGML\ Declaration :cal SetSyn("sgmldecl")<CR> -an 50.110.330 &Syntax.S-Sm.SGML.SGML-linuxdoc :cal SetSyn("sgmllnx")<CR> -an 50.110.340 &Syntax.S-Sm.Shell\ script.sh\ and\ ksh :cal SetSyn("sh")<CR> -an 50.110.350 &Syntax.S-Sm.Shell\ script.csh :cal SetSyn("csh")<CR> -an 50.110.360 &Syntax.S-Sm.Shell\ script.tcsh :cal SetSyn("tcsh")<CR> -an 50.110.370 &Syntax.S-Sm.Shell\ script.zsh :cal SetSyn("zsh")<CR> -an 50.110.380 &Syntax.S-Sm.SiCAD :cal SetSyn("sicad")<CR> -an 50.110.390 &Syntax.S-Sm.Sieve :cal SetSyn("sieve")<CR> -an 50.110.400 &Syntax.S-Sm.Simula :cal SetSyn("simula")<CR> -an 50.110.410 &Syntax.S-Sm.Sinda.Sinda\ compare :cal SetSyn("sindacmp")<CR> -an 50.110.420 &Syntax.S-Sm.Sinda.Sinda\ input :cal SetSyn("sinda")<CR> -an 50.110.430 &Syntax.S-Sm.Sinda.Sinda\ output :cal SetSyn("sindaout")<CR> -an 50.110.440 &Syntax.S-Sm.SiSU :cal SetSyn("sisu")<CR> -an 50.110.450 &Syntax.S-Sm.SKILL.SKILL :cal SetSyn("skill")<CR> -an 50.110.460 &Syntax.S-Sm.SKILL.SKILL\ for\ Diva :cal SetSyn("diva")<CR> -an 50.110.470 &Syntax.S-Sm.Slice :cal SetSyn("slice")<CR> -an 50.110.480 &Syntax.S-Sm.SLRN.Slrn\ rc :cal SetSyn("slrnrc")<CR> -an 50.110.490 &Syntax.S-Sm.SLRN.Slrn\ score :cal SetSyn("slrnsc")<CR> -an 50.110.500 &Syntax.S-Sm.SmallTalk :cal SetSyn("st")<CR> -an 50.110.510 &Syntax.S-Sm.Smarty\ Templates :cal SetSyn("smarty")<CR> -an 50.110.520 &Syntax.S-Sm.SMIL :cal SetSyn("smil")<CR> -an 50.110.530 &Syntax.S-Sm.SMITH :cal SetSyn("smith")<CR> -an 50.120.100 &Syntax.Sn-Sy.SNMP\ MIB :cal SetSyn("mib")<CR> -an 50.120.110 &Syntax.Sn-Sy.SNNS.SNNS\ network :cal SetSyn("snnsnet")<CR> -an 50.120.120 &Syntax.Sn-Sy.SNNS.SNNS\ pattern :cal SetSyn("snnspat")<CR> -an 50.120.130 &Syntax.Sn-Sy.SNNS.SNNS\ result :cal SetSyn("snnsres")<CR> -an 50.120.140 &Syntax.Sn-Sy.Snobol4 :cal SetSyn("snobol4")<CR> -an 50.120.150 &Syntax.Sn-Sy.Snort\ Configuration :cal SetSyn("hog")<CR> -an 50.120.160 &Syntax.Sn-Sy.SPEC\ (Linux\ RPM) :cal SetSyn("spec")<CR> -an 50.120.170 &Syntax.Sn-Sy.Specman :cal SetSyn("specman")<CR> -an 50.120.180 &Syntax.Sn-Sy.Spice :cal SetSyn("spice")<CR> -an 50.120.190 &Syntax.Sn-Sy.Spyce :cal SetSyn("spyce")<CR> -an 50.120.200 &Syntax.Sn-Sy.Speedup :cal SetSyn("spup")<CR> -an 50.120.210 &Syntax.Sn-Sy.Splint :cal SetSyn("splint")<CR> -an 50.120.220 &Syntax.Sn-Sy.Squid\ config :cal SetSyn("squid")<CR> -an 50.120.230 &Syntax.Sn-Sy.SQL.SAP\ HANA :cal SetSyn("sqlhana")<CR> -an 50.120.240 &Syntax.Sn-Sy.SQL.ESQL-C :cal SetSyn("esqlc")<CR> -an 50.120.250 &Syntax.Sn-Sy.SQL.MySQL :cal SetSyn("mysql")<CR> -an 50.120.260 &Syntax.Sn-Sy.SQL.PL/SQL :cal SetSyn("plsql")<CR> -an 50.120.270 &Syntax.Sn-Sy.SQL.SQL\ Anywhere :cal SetSyn("sqlanywhere")<CR> -an 50.120.280 &Syntax.Sn-Sy.SQL.SQL\ (automatic) :cal SetSyn("sql")<CR> -an 50.120.290 &Syntax.Sn-Sy.SQL.SQL\ (Oracle) :cal SetSyn("sqloracle")<CR> -an 50.120.300 &Syntax.Sn-Sy.SQL.SQL\ Forms :cal SetSyn("sqlforms")<CR> -an 50.120.310 &Syntax.Sn-Sy.SQL.SQLJ :cal SetSyn("sqlj")<CR> -an 50.120.320 &Syntax.Sn-Sy.SQL.SQL-Informix :cal SetSyn("sqlinformix")<CR> -an 50.120.330 &Syntax.Sn-Sy.SQR :cal SetSyn("sqr")<CR> -an 50.120.340 &Syntax.Sn-Sy.Ssh.ssh_config :cal SetSyn("sshconfig")<CR> -an 50.120.350 &Syntax.Sn-Sy.Ssh.sshd_config :cal SetSyn("sshdconfig")<CR> -an 50.120.360 &Syntax.Sn-Sy.Standard\ ML :cal SetSyn("sml")<CR> -an 50.120.370 &Syntax.Sn-Sy.Stata.SMCL :cal SetSyn("smcl")<CR> -an 50.120.380 &Syntax.Sn-Sy.Stata.Stata :cal SetSyn("stata")<CR> -an 50.120.390 &Syntax.Sn-Sy.Stored\ Procedures :cal SetSyn("stp")<CR> -an 50.120.400 &Syntax.Sn-Sy.Strace :cal SetSyn("strace")<CR> -an 50.120.410 &Syntax.Sn-Sy.Streaming\ descriptor\ file :cal SetSyn("sd")<CR> -an 50.120.420 &Syntax.Sn-Sy.Subversion\ commit :cal SetSyn("svn")<CR> -an 50.120.430 &Syntax.Sn-Sy.Sudoers :cal SetSyn("sudoers")<CR> -an 50.120.440 &Syntax.Sn-Sy.SVG :cal SetSyn("svg")<CR> -an 50.120.450 &Syntax.Sn-Sy.Symbian\ meta-makefile :cal SetSyn("mmp")<CR> -an 50.120.460 &Syntax.Sn-Sy.Sysctl\.conf :cal SetSyn("sysctl")<CR> -an 50.130.100 &Syntax.T.TADS :cal SetSyn("tads")<CR> -an 50.130.110 &Syntax.T.Tags :cal SetSyn("tags")<CR> -an 50.130.120 &Syntax.T.TAK.TAK\ compare :cal SetSyn("takcmp")<CR> -an 50.130.130 &Syntax.T.TAK.TAK\ input :cal SetSyn("tak")<CR> -an 50.130.140 &Syntax.T.TAK.TAK\ output :cal SetSyn("takout")<CR> -an 50.130.150 &Syntax.T.Tar\ listing :cal SetSyn("tar")<CR> -an 50.130.160 &Syntax.T.Task\ data :cal SetSyn("taskdata")<CR> -an 50.130.170 &Syntax.T.Task\ 42\ edit :cal SetSyn("taskedit")<CR> -an 50.130.180 &Syntax.T.Tcl/Tk :cal SetSyn("tcl")<CR> -an 50.130.190 &Syntax.T.TealInfo :cal SetSyn("tli")<CR> -an 50.130.200 &Syntax.T.Telix\ Salt :cal SetSyn("tsalt")<CR> -an 50.130.210 &Syntax.T.Termcap/Printcap :cal SetSyn("ptcap")<CR> -an 50.130.220 &Syntax.T.Terminfo :cal SetSyn("terminfo")<CR> -an 50.130.230 &Syntax.T.TeX.TeX/LaTeX :cal SetSyn("tex")<CR> -an 50.130.240 &Syntax.T.TeX.plain\ TeX :cal SetSyn("plaintex")<CR> -an 50.130.250 &Syntax.T.TeX.Initex :cal SetSyn("initex")<CR> -an 50.130.260 &Syntax.T.TeX.ConTeXt :cal SetSyn("context")<CR> -an 50.130.270 &Syntax.T.TeX.TeX\ configuration :cal SetSyn("texmf")<CR> -an 50.130.280 &Syntax.T.TeX.Texinfo :cal SetSyn("texinfo")<CR> -an 50.130.290 &Syntax.T.TF\ mud\ client :cal SetSyn("tf")<CR> -an 50.130.300 &Syntax.T.Tidy\ configuration :cal SetSyn("tidy")<CR> -an 50.130.310 &Syntax.T.Tilde :cal SetSyn("tilde")<CR> -an 50.130.320 &Syntax.T.TPP :cal SetSyn("tpp")<CR> -an 50.130.330 &Syntax.T.Trasys\ input :cal SetSyn("trasys")<CR> -an 50.130.340 &Syntax.T.Treetop :cal SetSyn("treetop")<CR> -an 50.130.350 &Syntax.T.Trustees :cal SetSyn("trustees")<CR> -an 50.130.360 &Syntax.T.TSS.Command\ Line :cal SetSyn("tsscl")<CR> -an 50.130.370 &Syntax.T.TSS.Geometry :cal SetSyn("tssgm")<CR> -an 50.130.380 &Syntax.T.TSS.Optics :cal SetSyn("tssop")<CR> -an 50.140.100 &Syntax.UV.Udev\ config :cal SetSyn("udevconf")<CR> -an 50.140.110 &Syntax.UV.Udev\ permissions :cal SetSyn("udevperm")<CR> -an 50.140.120 &Syntax.UV.Udev\ rules :cal SetSyn("udevrules")<CR> -an 50.140.130 &Syntax.UV.UIT/UIL :cal SetSyn("uil")<CR> -an 50.140.140 &Syntax.UV.UnrealScript :cal SetSyn("uc")<CR> -an 50.140.150 &Syntax.UV.Updatedb\.conf :cal SetSyn("updatedb")<CR> -an 50.140.160 &Syntax.UV.Upstart :cal SetSyn("upstart")<CR> -an 50.140.180 &Syntax.UV.Valgrind :cal SetSyn("valgrind")<CR> -an 50.140.190 &Syntax.UV.Vera :cal SetSyn("vera")<CR> -an 50.140.200 &Syntax.UV.Verilog-AMS\ HDL :cal SetSyn("verilogams")<CR> -an 50.140.210 &Syntax.UV.Verilog\ HDL :cal SetSyn("verilog")<CR> -an 50.140.220 &Syntax.UV.Vgrindefs :cal SetSyn("vgrindefs")<CR> -an 50.140.230 &Syntax.UV.VHDL :cal SetSyn("vhdl")<CR> -an 50.140.240 &Syntax.UV.Vim.Vim\ help\ file :cal SetSyn("help")<CR> -an 50.140.250 &Syntax.UV.Vim.Vim\ script :cal SetSyn("vim")<CR> -an 50.140.260 &Syntax.UV.Vim.Viminfo\ file :cal SetSyn("viminfo")<CR> -an 50.140.270 &Syntax.UV.Virata\ config :cal SetSyn("virata")<CR> -an 50.140.280 &Syntax.UV.Visual\ Basic :cal SetSyn("vb")<CR> -an 50.140.290 &Syntax.UV.VOS\ CM\ macro :cal SetSyn("voscm")<CR> -an 50.140.300 &Syntax.UV.VRML :cal SetSyn("vrml")<CR> -an 50.140.310 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl")<CR> -an 50.150.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb")<CR> -an 50.150.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web")<CR> -an 50.150.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change")<CR> -an 50.150.130 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro")<CR> -an 50.150.140 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml")<CR> -an 50.150.160 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff")<CR> -an 50.150.180 &Syntax.WXYZ.Wget\ config :cal SetSyn("wget")<CR> -an 50.150.190 &Syntax.WXYZ.Whitespace\ (add) :cal SetSyn("whitespace")<CR> -an 50.150.200 &Syntax.WXYZ.WildPackets\ EtherPeek\ Decoder :cal SetSyn("dcd")<CR> -an 50.150.210 &Syntax.WXYZ.WinBatch/Webbatch :cal SetSyn("winbatch")<CR> -an 50.150.220 &Syntax.WXYZ.Windows\ Scripting\ Host :cal SetSyn("wsh")<CR> -an 50.150.230 &Syntax.WXYZ.WSML :cal SetSyn("wsml")<CR> -an 50.150.240 &Syntax.WXYZ.WvDial :cal SetSyn("wvdial")<CR> -an 50.150.260 &Syntax.WXYZ.X\ Keyboard\ Extension :cal SetSyn("xkb")<CR> -an 50.150.270 &Syntax.WXYZ.X\ Pixmap :cal SetSyn("xpm")<CR> -an 50.150.280 &Syntax.WXYZ.X\ Pixmap\ (2) :cal SetSyn("xpm2")<CR> -an 50.150.290 &Syntax.WXYZ.X\ resources :cal SetSyn("xdefaults")<CR> -an 50.150.300 &Syntax.WXYZ.XBL :cal SetSyn("xbl")<CR> -an 50.150.310 &Syntax.WXYZ.Xinetd\.conf :cal SetSyn("xinetd")<CR> -an 50.150.320 &Syntax.WXYZ.Xmodmap :cal SetSyn("xmodmap")<CR> -an 50.150.330 &Syntax.WXYZ.Xmath :cal SetSyn("xmath")<CR> -an 50.150.340 &Syntax.WXYZ.XML :cal SetSyn("xml")<CR> -an 50.150.350 &Syntax.WXYZ.XML\ Schema\ (XSD) :cal SetSyn("xsd")<CR> -an 50.150.360 &Syntax.WXYZ.XQuery :cal SetSyn("xquery")<CR> -an 50.150.370 &Syntax.WXYZ.Xslt :cal SetSyn("xslt")<CR> -an 50.150.380 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf")<CR> -an 50.150.400 &Syntax.WXYZ.YAML :cal SetSyn("yaml")<CR> -an 50.150.410 &Syntax.WXYZ.Yacc :cal SetSyn("yacc")<CR> -an 50.150.430 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR> +an 50.110.100 &Syntax.M.ReStructuredText\ with\ R\ statements :cal SetSyn("rrst")<CR> +an 50.120.100 &Syntax.R.RTF :cal SetSyn("rtf")<CR> +an 50.120.110 &Syntax.R.Ruby :cal SetSyn("ruby")<CR> +an 50.120.120 &Syntax.R.Rust :cal SetSyn("rust")<CR> +an 50.130.100 &Syntax.S-Sm.S-Lang :cal SetSyn("slang")<CR> +an 50.130.110 &Syntax.S-Sm.Samba\ config :cal SetSyn("samba")<CR> +an 50.130.120 &Syntax.S-Sm.SAS :cal SetSyn("sas")<CR> +an 50.130.130 &Syntax.S-Sm.Sass :cal SetSyn("sass")<CR> +an 50.130.140 &Syntax.S-Sm.Sather :cal SetSyn("sather")<CR> +an 50.130.150 &Syntax.S-Sm.Sbt :cal SetSyn("sbt")<CR> +an 50.130.160 &Syntax.S-Sm.Scala :cal SetSyn("scala")<CR> +an 50.130.170 &Syntax.S-Sm.Scheme :cal SetSyn("scheme")<CR> +an 50.130.180 &Syntax.S-Sm.Scilab :cal SetSyn("scilab")<CR> +an 50.130.190 &Syntax.S-Sm.Screen\ RC :cal SetSyn("screen")<CR> +an 50.130.200 &Syntax.S-Sm.SCSS :cal SetSyn("scss")<CR> +an 50.130.210 &Syntax.S-Sm.SDC\ Synopsys\ Design\ Constraints :cal SetSyn("sdc")<CR> +an 50.130.220 &Syntax.S-Sm.SDL :cal SetSyn("sdl")<CR> +an 50.130.230 &Syntax.S-Sm.Sed :cal SetSyn("sed")<CR> +an 50.130.240 &Syntax.S-Sm.Sendmail\.cf :cal SetSyn("sm")<CR> +an 50.130.250 &Syntax.S-Sm.Send-pr :cal SetSyn("sendpr")<CR> +an 50.130.260 &Syntax.S-Sm.Sensors\.conf :cal SetSyn("sensors")<CR> +an 50.130.270 &Syntax.S-Sm.Service\ Location\ config :cal SetSyn("slpconf")<CR> +an 50.130.280 &Syntax.S-Sm.Service\ Location\ registration :cal SetSyn("slpreg")<CR> +an 50.130.290 &Syntax.S-Sm.Service\ Location\ SPI :cal SetSyn("slpspi")<CR> +an 50.130.300 &Syntax.S-Sm.Services :cal SetSyn("services")<CR> +an 50.130.310 &Syntax.S-Sm.Setserial\ config :cal SetSyn("setserial")<CR> +an 50.130.320 &Syntax.S-Sm.SGML.SGML\ catalog :cal SetSyn("catalog")<CR> +an 50.130.330 &Syntax.S-Sm.SGML.SGML\ DTD :cal SetSyn("sgml")<CR> +an 50.130.340 &Syntax.S-Sm.SGML.SGML\ Declaration :cal SetSyn("sgmldecl")<CR> +an 50.130.350 &Syntax.S-Sm.SGML.SGML-linuxdoc :cal SetSyn("sgmllnx")<CR> +an 50.130.360 &Syntax.S-Sm.Shell\ script.sh\ and\ ksh :cal SetSyn("sh")<CR> +an 50.130.370 &Syntax.S-Sm.Shell\ script.csh :cal SetSyn("csh")<CR> +an 50.130.380 &Syntax.S-Sm.Shell\ script.tcsh :cal SetSyn("tcsh")<CR> +an 50.130.390 &Syntax.S-Sm.Shell\ script.zsh :cal SetSyn("zsh")<CR> +an 50.130.400 &Syntax.S-Sm.SiCAD :cal SetSyn("sicad")<CR> +an 50.130.410 &Syntax.S-Sm.Sieve :cal SetSyn("sieve")<CR> +an 50.130.420 &Syntax.S-Sm.Simula :cal SetSyn("simula")<CR> +an 50.130.430 &Syntax.S-Sm.Sinda.Sinda\ compare :cal SetSyn("sindacmp")<CR> +an 50.130.440 &Syntax.S-Sm.Sinda.Sinda\ input :cal SetSyn("sinda")<CR> +an 50.130.450 &Syntax.S-Sm.Sinda.Sinda\ output :cal SetSyn("sindaout")<CR> +an 50.130.460 &Syntax.S-Sm.SiSU :cal SetSyn("sisu")<CR> +an 50.130.470 &Syntax.S-Sm.SKILL.SKILL :cal SetSyn("skill")<CR> +an 50.130.480 &Syntax.S-Sm.SKILL.SKILL\ for\ Diva :cal SetSyn("diva")<CR> +an 50.130.490 &Syntax.S-Sm.Slice :cal SetSyn("slice")<CR> +an 50.130.500 &Syntax.S-Sm.SLRN.Slrn\ rc :cal SetSyn("slrnrc")<CR> +an 50.130.510 &Syntax.S-Sm.SLRN.Slrn\ score :cal SetSyn("slrnsc")<CR> +an 50.130.520 &Syntax.S-Sm.SmallTalk :cal SetSyn("st")<CR> +an 50.130.530 &Syntax.S-Sm.Smarty\ Templates :cal SetSyn("smarty")<CR> +an 50.130.540 &Syntax.S-Sm.SMIL :cal SetSyn("smil")<CR> +an 50.130.550 &Syntax.S-Sm.SMITH :cal SetSyn("smith")<CR> +an 50.140.100 &Syntax.Sn-Sy.SNMP\ MIB :cal SetSyn("mib")<CR> +an 50.140.110 &Syntax.Sn-Sy.SNNS.SNNS\ network :cal SetSyn("snnsnet")<CR> +an 50.140.120 &Syntax.Sn-Sy.SNNS.SNNS\ pattern :cal SetSyn("snnspat")<CR> +an 50.140.130 &Syntax.Sn-Sy.SNNS.SNNS\ result :cal SetSyn("snnsres")<CR> +an 50.140.140 &Syntax.Sn-Sy.Snobol4 :cal SetSyn("snobol4")<CR> +an 50.140.150 &Syntax.Sn-Sy.Snort\ Configuration :cal SetSyn("hog")<CR> +an 50.140.160 &Syntax.Sn-Sy.SPEC\ (Linux\ RPM) :cal SetSyn("spec")<CR> +an 50.140.170 &Syntax.Sn-Sy.Specman :cal SetSyn("specman")<CR> +an 50.140.180 &Syntax.Sn-Sy.Spice :cal SetSyn("spice")<CR> +an 50.140.190 &Syntax.Sn-Sy.Spyce :cal SetSyn("spyce")<CR> +an 50.140.200 &Syntax.Sn-Sy.Speedup :cal SetSyn("spup")<CR> +an 50.140.210 &Syntax.Sn-Sy.Splint :cal SetSyn("splint")<CR> +an 50.140.220 &Syntax.Sn-Sy.Squid\ config :cal SetSyn("squid")<CR> +an 50.140.230 &Syntax.Sn-Sy.SQL.SAP\ HANA :cal SetSyn("sqlhana")<CR> +an 50.140.240 &Syntax.Sn-Sy.SQL.ESQL-C :cal SetSyn("esqlc")<CR> +an 50.140.250 &Syntax.Sn-Sy.SQL.MySQL :cal SetSyn("mysql")<CR> +an 50.140.260 &Syntax.Sn-Sy.SQL.PL/SQL :cal SetSyn("plsql")<CR> +an 50.140.270 &Syntax.Sn-Sy.SQL.SQL\ Anywhere :cal SetSyn("sqlanywhere")<CR> +an 50.140.280 &Syntax.Sn-Sy.SQL.SQL\ (automatic) :cal SetSyn("sql")<CR> +an 50.140.290 &Syntax.Sn-Sy.SQL.SQL\ (Oracle) :cal SetSyn("sqloracle")<CR> +an 50.140.300 &Syntax.Sn-Sy.SQL.SQL\ Forms :cal SetSyn("sqlforms")<CR> +an 50.140.310 &Syntax.Sn-Sy.SQL.SQLJ :cal SetSyn("sqlj")<CR> +an 50.140.320 &Syntax.Sn-Sy.SQL.SQL-Informix :cal SetSyn("sqlinformix")<CR> +an 50.140.330 &Syntax.Sn-Sy.SQR :cal SetSyn("sqr")<CR> +an 50.140.340 &Syntax.Sn-Sy.Ssh.ssh_config :cal SetSyn("sshconfig")<CR> +an 50.140.350 &Syntax.Sn-Sy.Ssh.sshd_config :cal SetSyn("sshdconfig")<CR> +an 50.140.360 &Syntax.Sn-Sy.Standard\ ML :cal SetSyn("sml")<CR> +an 50.140.370 &Syntax.Sn-Sy.Stata.SMCL :cal SetSyn("smcl")<CR> +an 50.140.380 &Syntax.Sn-Sy.Stata.Stata :cal SetSyn("stata")<CR> +an 50.140.390 &Syntax.Sn-Sy.Stored\ Procedures :cal SetSyn("stp")<CR> +an 50.140.400 &Syntax.Sn-Sy.Strace :cal SetSyn("strace")<CR> +an 50.140.410 &Syntax.Sn-Sy.Streaming\ descriptor\ file :cal SetSyn("sd")<CR> +an 50.140.420 &Syntax.Sn-Sy.Subversion\ commit :cal SetSyn("svn")<CR> +an 50.140.430 &Syntax.Sn-Sy.Sudoers :cal SetSyn("sudoers")<CR> +an 50.140.440 &Syntax.Sn-Sy.SVG :cal SetSyn("svg")<CR> +an 50.140.450 &Syntax.Sn-Sy.Symbian\ meta-makefile :cal SetSyn("mmp")<CR> +an 50.140.460 &Syntax.Sn-Sy.Sysctl\.conf :cal SetSyn("sysctl")<CR> +an 50.140.470 &Syntax.Sn-Sy.Systemd :cal SetSyn("systemd")<CR> +an 50.140.480 &Syntax.Sn-Sy.SystemVerilog :cal SetSyn("systemverilog")<CR> +an 50.150.100 &Syntax.T.TADS :cal SetSyn("tads")<CR> +an 50.150.110 &Syntax.T.Tags :cal SetSyn("tags")<CR> +an 50.150.120 &Syntax.T.TAK.TAK\ compare :cal SetSyn("takcmp")<CR> +an 50.150.130 &Syntax.T.TAK.TAK\ input :cal SetSyn("tak")<CR> +an 50.150.140 &Syntax.T.TAK.TAK\ output :cal SetSyn("takout")<CR> +an 50.150.150 &Syntax.T.Tar\ listing :cal SetSyn("tar")<CR> +an 50.150.160 &Syntax.T.Task\ data :cal SetSyn("taskdata")<CR> +an 50.150.170 &Syntax.T.Task\ 42\ edit :cal SetSyn("taskedit")<CR> +an 50.150.180 &Syntax.T.Tcl/Tk :cal SetSyn("tcl")<CR> +an 50.150.190 &Syntax.T.TealInfo :cal SetSyn("tli")<CR> +an 50.150.200 &Syntax.T.Telix\ Salt :cal SetSyn("tsalt")<CR> +an 50.150.210 &Syntax.T.Termcap/Printcap :cal SetSyn("ptcap")<CR> +an 50.150.220 &Syntax.T.Terminfo :cal SetSyn("terminfo")<CR> +an 50.150.230 &Syntax.T.Tera\ Term :cal SetSyn("teraterm")<CR> +an 50.150.240 &Syntax.T.TeX.TeX/LaTeX :cal SetSyn("tex")<CR> +an 50.150.250 &Syntax.T.TeX.plain\ TeX :cal SetSyn("plaintex")<CR> +an 50.150.260 &Syntax.T.TeX.Initex :cal SetSyn("initex")<CR> +an 50.150.270 &Syntax.T.TeX.ConTeXt :cal SetSyn("context")<CR> +an 50.150.280 &Syntax.T.TeX.TeX\ configuration :cal SetSyn("texmf")<CR> +an 50.150.290 &Syntax.T.TeX.Texinfo :cal SetSyn("texinfo")<CR> +an 50.150.300 &Syntax.T.TF\ mud\ client :cal SetSyn("tf")<CR> +an 50.150.310 &Syntax.T.Tidy\ configuration :cal SetSyn("tidy")<CR> +an 50.150.320 &Syntax.T.Tilde :cal SetSyn("tilde")<CR> +an 50.150.330 &Syntax.T.Tmux\ configuration :cal SetSyn("tmux")<CR> +an 50.150.340 &Syntax.T.TPP :cal SetSyn("tpp")<CR> +an 50.150.350 &Syntax.T.Trasys\ input :cal SetSyn("trasys")<CR> +an 50.150.360 &Syntax.T.Treetop :cal SetSyn("treetop")<CR> +an 50.150.370 &Syntax.T.Trustees :cal SetSyn("trustees")<CR> +an 50.150.380 &Syntax.T.TSS.Command\ Line :cal SetSyn("tsscl")<CR> +an 50.150.390 &Syntax.T.TSS.Geometry :cal SetSyn("tssgm")<CR> +an 50.150.400 &Syntax.T.TSS.Optics :cal SetSyn("tssop")<CR> +an 50.160.100 &Syntax.UV.Udev\ config :cal SetSyn("udevconf")<CR> +an 50.160.110 &Syntax.UV.Udev\ permissions :cal SetSyn("udevperm")<CR> +an 50.160.120 &Syntax.UV.Udev\ rules :cal SetSyn("udevrules")<CR> +an 50.160.130 &Syntax.UV.UIT/UIL :cal SetSyn("uil")<CR> +an 50.160.140 &Syntax.UV.UnrealScript :cal SetSyn("uc")<CR> +an 50.160.150 &Syntax.UV.Updatedb\.conf :cal SetSyn("updatedb")<CR> +an 50.160.160 &Syntax.UV.Upstart :cal SetSyn("upstart")<CR> +an 50.160.180 &Syntax.UV.Valgrind :cal SetSyn("valgrind")<CR> +an 50.160.190 &Syntax.UV.Vera :cal SetSyn("vera")<CR> +an 50.160.200 &Syntax.UV.Verbose\ TAP\ Output :cal SetSyn("tap")<CR> +an 50.160.210 &Syntax.UV.Verilog-AMS\ HDL :cal SetSyn("verilogams")<CR> +an 50.160.220 &Syntax.UV.Verilog\ HDL :cal SetSyn("verilog")<CR> +an 50.160.230 &Syntax.UV.Vgrindefs :cal SetSyn("vgrindefs")<CR> +an 50.160.240 &Syntax.UV.VHDL :cal SetSyn("vhdl")<CR> +an 50.160.250 &Syntax.UV.Vim.Vim\ help\ file :cal SetSyn("help")<CR> +an 50.160.260 &Syntax.UV.Vim.Vim\ script :cal SetSyn("vim")<CR> +an 50.160.270 &Syntax.UV.Vim.Viminfo\ file :cal SetSyn("viminfo")<CR> +an 50.160.280 &Syntax.UV.Virata\ config :cal SetSyn("virata")<CR> +an 50.160.290 &Syntax.UV.Visual\ Basic :cal SetSyn("vb")<CR> +an 50.160.300 &Syntax.UV.VOS\ CM\ macro :cal SetSyn("voscm")<CR> +an 50.160.310 &Syntax.UV.VRML :cal SetSyn("vrml")<CR> +an 50.160.320 &Syntax.UV.Vroom :cal SetSyn("vroom")<CR> +an 50.160.330 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl")<CR> +an 50.170.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb")<CR> +an 50.170.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web")<CR> +an 50.170.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change")<CR> +an 50.170.130 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro")<CR> +an 50.170.140 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml")<CR> +an 50.170.160 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff")<CR> +an 50.170.180 &Syntax.WXYZ.Wget\ config :cal SetSyn("wget")<CR> +an 50.170.190 &Syntax.WXYZ.Whitespace\ (add) :cal SetSyn("whitespace")<CR> +an 50.170.200 &Syntax.WXYZ.WildPackets\ EtherPeek\ Decoder :cal SetSyn("dcd")<CR> +an 50.170.210 &Syntax.WXYZ.WinBatch/Webbatch :cal SetSyn("winbatch")<CR> +an 50.170.220 &Syntax.WXYZ.Windows\ Scripting\ Host :cal SetSyn("wsh")<CR> +an 50.170.230 &Syntax.WXYZ.WSML :cal SetSyn("wsml")<CR> +an 50.170.240 &Syntax.WXYZ.WvDial :cal SetSyn("wvdial")<CR> +an 50.170.260 &Syntax.WXYZ.X\ Keyboard\ Extension :cal SetSyn("xkb")<CR> +an 50.170.270 &Syntax.WXYZ.X\ Pixmap :cal SetSyn("xpm")<CR> +an 50.170.280 &Syntax.WXYZ.X\ Pixmap\ (2) :cal SetSyn("xpm2")<CR> +an 50.170.290 &Syntax.WXYZ.X\ resources :cal SetSyn("xdefaults")<CR> +an 50.170.300 &Syntax.WXYZ.XBL :cal SetSyn("xbl")<CR> +an 50.170.310 &Syntax.WXYZ.Xinetd\.conf :cal SetSyn("xinetd")<CR> +an 50.170.320 &Syntax.WXYZ.Xmodmap :cal SetSyn("xmodmap")<CR> +an 50.170.330 &Syntax.WXYZ.Xmath :cal SetSyn("xmath")<CR> +an 50.170.340 &Syntax.WXYZ.XML :cal SetSyn("xml")<CR> +an 50.170.350 &Syntax.WXYZ.XML\ Schema\ (XSD) :cal SetSyn("xsd")<CR> +an 50.170.360 &Syntax.WXYZ.XQuery :cal SetSyn("xquery")<CR> +an 50.170.370 &Syntax.WXYZ.Xslt :cal SetSyn("xslt")<CR> +an 50.170.380 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf")<CR> +an 50.170.400 &Syntax.WXYZ.YAML :cal SetSyn("yaml")<CR> +an 50.170.410 &Syntax.WXYZ.Yacc :cal SetSyn("yacc")<CR> +an 50.170.430 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR> " The End Of The Syntax Menu an 50.195 &Syntax.-SEP1- <Nop> -an <silent> 50.200 &Syntax.Set\ '&syntax'\ only :call <SID>Setsynonly()<CR> +an <silent> 50.200 &Syntax.Set\ '&syntax'\ Only :call <SID>Setsynonly()<CR> fun! s:Setsynonly() let s:syntax_menu_synonly = 1 endfun -an <silent> 50.202 &Syntax.Set\ '&filetype'\ too :call <SID>Nosynonly()<CR> +an <silent> 50.202 &Syntax.Set\ '&filetype'\ Too :call <SID>Nosynonly()<CR> fun! s:Nosynonly() if exists("s:syntax_menu_synonly") unlet s:syntax_menu_synonly diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index 187b1be1b0..67a888d4d7 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jul 08 +" Last Change: 2015 Sep 08 " " Additional contributors: " @@ -26,7 +26,11 @@ let s:end=line('$') " Font if exists("g:html_font") - let s:htmlfont = "'". g:html_font . "', monospace" + if type(g:html_font) == type([]) + let s:htmlfont = "'". join(g:html_font,"','") . "', monospace" + else + let s:htmlfont = "'". g:html_font . "', monospace" + endif else let s:htmlfont = "monospace" endif @@ -1713,7 +1717,7 @@ endif " Add hyperlinks " TODO: add option to not do this? Maybe just make the color the same as the " text highlight group normally is? -%s+\(https\=://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\|"\)+<a href="\1">\1</a>\2+ge +%s+\(\%(https\=\|ftp\)://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\|"\)+<a href="\1">\1</a>\2+ge " The DTD if s:settings.use_xhtml diff --git a/runtime/syntax/a2ps.vim b/runtime/syntax/a2ps.vim index 2a87d62f90..afe3af1eed 100644 --- a/runtime/syntax/a2ps.vim +++ b/runtime/syntax/a2ps.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: a2ps(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: a2ps(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/a65.vim b/runtime/syntax/a65.vim index 94198e6a42..b232e826cd 100644 --- a/runtime/syntax/a65.vim +++ b/runtime/syntax/a65.vim @@ -1,13 +1,10 @@ " Vim syntax file " Language: xa 6502 cross assembler " Maintainer: Clemens Kirchgatterer <clemens@1541.org> -" Last Change: 2014 Jan 05 +" Last Change: 2016 Aug 31 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -138,29 +135,19 @@ syn match a65End excludenl /end$/ contained syn match a65Continue "\\$" contained " 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_a65_syntax_inits") - if version < 508 - let did_a65_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink a65Section Special - HiLink a65Address Special - HiLink a65Comment Comment - HiLink a65PreProc PreProc - HiLink a65Number Number - HiLink a65String String - HiLink a65Type Statement - HiLink a65Opcode Type - HiLink a65PC Error - HiLink a65Todo Todo - HiLink a65HiLo Number - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link a65Section Special +hi def link a65Address Special +hi def link a65Comment Comment +hi def link a65PreProc PreProc +hi def link a65Number Number +hi def link a65String String +hi def link a65Type Statement +hi def link a65Opcode Type +hi def link a65PC Error +hi def link a65Todo Todo +hi def link a65HiLo Number + let b:current_syntax = "a65" diff --git a/runtime/syntax/abap.vim b/runtime/syntax/abap.vim index 1d1f6afd0d..c2857a5f30 100644 --- a/runtime/syntax/abap.vim +++ b/runtime/syntax/abap.vim @@ -5,11 +5,8 @@ " Last Change: 2013 Jun 13 " Comment: Thanks to EPI-USE Labs for all your assistance. :) -" For version < 6.0: Clear all syntax items -" For version >= 6.0: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -43,11 +40,7 @@ syn match abapStringEscape contained "``" syn match abapNumber "\-\=\<\d\+\>" syn region abapHex matchgroup=abapHex start="X'" end="'" -if version >= 600 - setlocal iskeyword=48-57,_,A-Z,a-z,/ -else - set iskeyword=48-57,_,A-Z,a-z,/ -endif +setlocal iskeyword=48-57,_,A-Z,a-z,/ syn match abapNamespace "\</\w\+/" @@ -175,38 +168,28 @@ syn keyword abapTodo contained TODO NOTE syn match abapTodo "\#EC\W\+\w\+" " 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_abap_syntax_inits") - if version < 508 - let did_abap_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink abapError Error - HiLink abapComment Comment - HiLink abapInclude Include - HiLink abapStatement Statement - HiLink abapComplexStatement Statement - HiLink abapSpecial Special - HiLink abapNamespace Special - HiLink abapSpecialTables Special - HiLink abapSymbolOperator abapOperator - HiLink abapOperator Operator - HiLink abapCharString String - HiLink abapString String - HiLink abapFloat Float - HiLink abapTypes Type - HiLink abapSymbol Structure - HiLink abapStructure Structure - HiLink abapField Variable - HiLink abapNumber Number - HiLink abapHex Number - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link abapError Error +hi def link abapComment Comment +hi def link abapInclude Include +hi def link abapStatement Statement +hi def link abapComplexStatement Statement +hi def link abapSpecial Special +hi def link abapNamespace Special +hi def link abapSpecialTables Special +hi def link abapSymbolOperator abapOperator +hi def link abapOperator Operator +hi def link abapCharString String +hi def link abapString String +hi def link abapFloat Float +hi def link abapTypes Type +hi def link abapSymbol Structure +hi def link abapStructure Structure +hi def link abapField Variable +hi def link abapNumber Number +hi def link abapHex Number + let b:current_syntax = "abap" diff --git a/runtime/syntax/abaqus.vim b/runtime/syntax/abaqus.vim index cf4b0828fa..db2717f818 100644 --- a/runtime/syntax/abaqus.vim +++ b/runtime/syntax/abaqus.vim @@ -4,11 +4,8 @@ " Last Change: 2002 Feb 24 " Remark: Huge improvement in folding performance--see filetype plugin -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -25,24 +22,14 @@ syn match abaqusValue "=\s*[^,]*"lc=1 contained display syn match abaqusBadLine "^\s\+\*.*" display " 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_abaqus_syn_inits") - if version < 508 - let did_abaqus_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink abaqusComment Comment - HiLink abaqusKeyword Statement - HiLink abaqusParameter Identifier - HiLink abaqusValue Constant - HiLink abaqusBadLine Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link abaqusComment Comment +hi def link abaqusKeyword Statement +hi def link abaqusParameter Identifier +hi def link abaqusValue Constant +hi def link abaqusBadLine Error + let b:current_syntax = "abaqus" diff --git a/runtime/syntax/abc.vim b/runtime/syntax/abc.vim index 3dc098e730..1a7b3bf4be 100644 --- a/runtime/syntax/abc.vim +++ b/runtime/syntax/abc.vim @@ -4,11 +4,8 @@ " URL: http://perun.hscs.wmin.ac.uk/~jra/vim/syntax/abc.vim " Last Change: 27th April 2001 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -36,28 +33,18 @@ syn match abcComment "%.*$" " 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_abc_syn_inits") - if version < 508 - let did_abc_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link abcComment Comment +hi def link abcHeadField Type +hi def link abcBodyField Special +hi def link abcBar Statement +hi def link abcTuple Statement +hi def link abcBroken Statement +hi def link abcTie Statement +hi def link abcGuitarChord Identifier +hi def link abcNote Constant - HiLink abcComment Comment - HiLink abcHeadField Type - HiLink abcBodyField Special - HiLink abcBar Statement - HiLink abcTuple Statement - HiLink abcBroken Statement - HiLink abcTie Statement - HiLink abcGuitarChord Identifier - HiLink abcNote Constant - - delcommand HiLink -endif let b:current_syntax = "abc" diff --git a/runtime/syntax/abel.vim b/runtime/syntax/abel.vim index 05e8dac913..67d7e4f786 100644 --- a/runtime/syntax/abel.vim +++ b/runtime/syntax/abel.vim @@ -3,11 +3,8 @@ " Maintainer: John Cook <johncook3@gmail.com> " Last Change: 2011 Dec 27 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -123,48 +120,38 @@ endif syn sync minlines=1 " 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_abel_syn_inits") - if version < 508 - let did_abel_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink abelHeader abelStatement - HiLink abelSection abelStatement - HiLink abelDeclaration abelStatement - HiLink abelLogicalOperator abelOperator - HiLink abelRangeOperator abelOperator - HiLink abelAlternateOperator abelOperator - HiLink abelArithmeticOperator abelOperator - HiLink abelRelationalOperator abelOperator - HiLink abelAssignmentOperator abelOperator - HiLink abelTruthTableOperator abelOperator - HiLink abelSpecifier abelStatement - HiLink abelOperator abelStatement - HiLink abelStatement Statement - HiLink abelIdentifier Identifier - HiLink abelTypeId abelType - HiLink abelTypeIdChar abelType - HiLink abelType Type - HiLink abelNumber abelString - HiLink abelString String - HiLink abelConstant Constant - HiLink abelComment Comment - HiLink abelExtension abelSpecial - HiLink abelSpecialChar abelSpecial - HiLink abelTypeIdEnd abelSpecial - HiLink abelSpecial Special - HiLink abelDirective PreProc - HiLink abelTodo Todo - HiLink abelError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link abelHeader abelStatement +hi def link abelSection abelStatement +hi def link abelDeclaration abelStatement +hi def link abelLogicalOperator abelOperator +hi def link abelRangeOperator abelOperator +hi def link abelAlternateOperator abelOperator +hi def link abelArithmeticOperator abelOperator +hi def link abelRelationalOperator abelOperator +hi def link abelAssignmentOperator abelOperator +hi def link abelTruthTableOperator abelOperator +hi def link abelSpecifier abelStatement +hi def link abelOperator abelStatement +hi def link abelStatement Statement +hi def link abelIdentifier Identifier +hi def link abelTypeId abelType +hi def link abelTypeIdChar abelType +hi def link abelType Type +hi def link abelNumber abelString +hi def link abelString String +hi def link abelConstant Constant +hi def link abelComment Comment +hi def link abelExtension abelSpecial +hi def link abelSpecialChar abelSpecial +hi def link abelTypeIdEnd abelSpecial +hi def link abelSpecial Special +hi def link abelDirective PreProc +hi def link abelTodo Todo +hi def link abelError Error + let b:current_syntax = "abel" diff --git a/runtime/syntax/acedb.vim b/runtime/syntax/acedb.vim index 114e4aba9e..2c2cd701b7 100644 --- a/runtime/syntax/acedb.vim +++ b/runtime/syntax/acedb.vim @@ -7,11 +7,8 @@ " Syntax file to handle all $ACEDB/wspec/*.wrm files, primarily models.wrm " AceDB software is available from http://www.acedb.org -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -86,35 +83,25 @@ syn region acedbString start=/"/ end=/"/ skip=/\\"/ oneline " Rest of syntax highlighting rules start here " 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_acedb_syn_inits") - if version < 508 - let did_acedb_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink acedbMagic Special - HiLink acedbHyb Special - HiLink acedbType Type - HiLink acedbOption Type - HiLink acedbSubclass Type - HiLink acedbSubtag Include - HiLink acedbFlag Include - HiLink acedbTag Include - HiLink acedbClass Todo - HiLink acedbHelp Todo - HiLink acedbXref Identifier - HiLink acedbModifier Label - HiLink acedbComment Comment - HiLink acedbBlock ModeMsg - HiLink acedbNumber Number - HiLink acedbString String +hi def link acedbMagic Special +hi def link acedbHyb Special +hi def link acedbType Type +hi def link acedbOption Type +hi def link acedbSubclass Type +hi def link acedbSubtag Include +hi def link acedbFlag Include +hi def link acedbTag Include +hi def link acedbClass Todo +hi def link acedbHelp Todo +hi def link acedbXref Identifier +hi def link acedbModifier Label +hi def link acedbComment Comment +hi def link acedbBlock ModeMsg +hi def link acedbNumber Number +hi def link acedbString String - delcommand HiLink -endif let b:current_syntax = "acedb" diff --git a/runtime/syntax/aflex.vim b/runtime/syntax/aflex.vim index 592c98e4f3..aa8b5f84fe 100644 --- a/runtime/syntax/aflex.vim +++ b/runtime/syntax/aflex.vim @@ -7,21 +7,14 @@ " Comment: Replaced sourcing c.vim file by ada.vim and rename lex* " in aflex* -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the Ada syntax to start with -if version < 600 - so <sfile>:p:h/ada.vim -else - runtime! syntax/ada.vim - unlet b:current_syntax -endif +runtime! syntax/ada.vim +unlet b:current_syntax " --- AfLex stuff --- @@ -69,31 +62,20 @@ syn sync match aflexSyncPat groupthere aflexPatBlock "^<$" syn sync match aflexSyncPat groupthere aflexPatBlock "^%%$" " 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_aflex_syntax_inits") - if version < 508 - let did_aflex_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink aflexSlashQuote aflexPat - HiLink aflexBrace aflexPat - HiLink aflexAbbrvComment aflexPatComment - - HiLink aflexAbbrv SpecialChar - HiLink aflexAbbrvRegExp Macro - HiLink aflexCFunctions Function - HiLink aflexMorePat SpecialChar - HiLink aflexPat Function - HiLink aflexPatComment Comment - HiLink aflexPatString Function - HiLink aflexPatTag Special - HiLink aflexSep Delimiter - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link aflexSlashQuote aflexPat +hi def link aflexBrace aflexPat +hi def link aflexAbbrvComment aflexPatComment + +hi def link aflexAbbrv SpecialChar +hi def link aflexAbbrvRegExp Macro +hi def link aflexCFunctions Function +hi def link aflexMorePat SpecialChar +hi def link aflexPat Function +hi def link aflexPatComment Comment +hi def link aflexPatString Function +hi def link aflexPatTag Special +hi def link aflexSep Delimiter let b:current_syntax = "aflex" diff --git a/runtime/syntax/ahdl.vim b/runtime/syntax/ahdl.vim index b1417c374d..664bd3837d 100644 --- a/runtime/syntax/ahdl.vim +++ b/runtime/syntax/ahdl.vim @@ -3,11 +3,8 @@ " Maintainer: John Cook <john.cook@kla-tencor.com> " Last Change: 2001 Apr 25 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -66,29 +63,19 @@ syn match ahdlSpecialChar "[\[\]().,;]" syn sync minlines=1 " 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_ahdl_syn_inits") - if version < 508 - let did_ahdl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink ahdlNumber ahdlString - HiLink ahdlMegafunction ahdlIdentifier - HiLink ahdlSpecialChar SpecialChar - HiLink ahdlKeyword Statement - HiLink ahdlString String - HiLink ahdlComment Comment - HiLink ahdlIdentifier Identifier - HiLink ahdlOperator Operator - HiLink ahdlTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link ahdlNumber ahdlString +hi def link ahdlMegafunction ahdlIdentifier +hi def link ahdlSpecialChar SpecialChar +hi def link ahdlKeyword Statement +hi def link ahdlString String +hi def link ahdlComment Comment +hi def link ahdlIdentifier Identifier +hi def link ahdlOperator Operator +hi def link ahdlTodo Todo + let b:current_syntax = "ahdl" " vim:ts=8 diff --git a/runtime/syntax/alsaconf.vim b/runtime/syntax/alsaconf.vim index 8fd51f0ac4..143fcc0a2e 100644 --- a/runtime/syntax/alsaconf.vim +++ b/runtime/syntax/alsaconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: alsaconf(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: alsaconf(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/amiga.vim b/runtime/syntax/amiga.vim index e70f995f68..eab9f66169 100644 --- a/runtime/syntax/amiga.vim +++ b/runtime/syntax/amiga.vim @@ -1,15 +1,12 @@ " Vim syntax file " Language: AmigaDos -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 11, 2006 -" Version: 6 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 9 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_AMIGA + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -72,30 +69,20 @@ syn match amiComment ";.*$" contains=amiCommentGroup syn sync lines=50 " 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_amiga_syn_inits") - if version < 508 - let did_amiga_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink amiAlias Type - HiLink amiComment Comment - HiLink amiDev Type - HiLink amiEcho String - HiLink amiElse Statement - HiLink amiError Error - HiLink amiKey Statement - HiLink amiNumber Number - HiLink amiString String - HiLink amiTest Special - - delcommand HiLink -endif +if !exists("skip_amiga_syntax_inits") + + hi def link amiAlias Type + hi def link amiComment Comment + hi def link amiDev Type + hi def link amiEcho String + hi def link amiElse Statement + hi def link amiError Error + hi def link amiKey Statement + hi def link amiNumber Number + hi def link amiString String + hi def link amiTest Special +endif let b:current_syntax = "amiga" " vim:ts=15 diff --git a/runtime/syntax/aml.vim b/runtime/syntax/aml.vim index 7cb16f1c1f..46621edbe9 100644 --- a/runtime/syntax/aml.vim +++ b/runtime/syntax/aml.vim @@ -9,11 +9,8 @@ " of [], in order to avoid -read highlighted, " or [quote] strings highlighted -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -123,35 +120,25 @@ syn region amlSkip matchgroup=amlOutput start="&typ" end="$" contains=amlVar syn region amlSkip matchgroup=amlOutput start="&type" end="$" contains=amlVar " 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_aml_syntax_inits") - if version < 508 - let did_aml_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink amlComment Comment - HiLink amlNumber Number - HiLink amlQuote String - HiLink amlVar Identifier - HiLink amlVar2 Identifier - HiLink amlFunction PreProc - HiLink amlDir Statement - HiLink amlDir2 Statement - HiLink amlDirSym Statement - HiLink amlOutput Statement - HiLink amlArcCmd ModeMsg - HiLink amlFormedCmd amlArcCmd - HiLink amlTabCmd amlArcCmd - HiLink amlInfoCmd amlArcCmd - HiLink amlVtrCmd amlArcCmd - HiLink amlFormed amlArcCmd - HiLink amlTab amlArcCmd - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link amlComment Comment +hi def link amlNumber Number +hi def link amlQuote String +hi def link amlVar Identifier +hi def link amlVar2 Identifier +hi def link amlFunction PreProc +hi def link amlDir Statement +hi def link amlDir2 Statement +hi def link amlDirSym Statement +hi def link amlOutput Statement +hi def link amlArcCmd ModeMsg +hi def link amlFormedCmd amlArcCmd +hi def link amlTabCmd amlArcCmd +hi def link amlInfoCmd amlArcCmd +hi def link amlVtrCmd amlArcCmd +hi def link amlFormed amlArcCmd +hi def link amlTab amlArcCmd + let b:current_syntax = "aml" diff --git a/runtime/syntax/ampl.vim b/runtime/syntax/ampl.vim index 7f4dfa9942..ad78f7d729 100644 --- a/runtime/syntax/ampl.vim +++ b/runtime/syntax/ampl.vim @@ -3,9 +3,8 @@ " Last Change: 2003 May 11 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -115,33 +114,24 @@ syn keyword amplTodo contained TODO FIXME XXX -if version >= 508 || !exists("did_ampl_syntax_inits") - if version < 508 - let did_ampl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " The default methods for highlighting. Can be overridden later. - HiLink amplEntityKeyword Keyword - HiLink amplType Type - HiLink amplStatement Statement - HiLink amplOperators Operator - HiLink amplBasicOperators Operator - HiLink amplConditional Conditional - HiLink amplRepeat Repeat - HiLink amplStrings String - HiLink amplNumerics Number - HiLink amplSetFunction Function - HiLink amplBuiltInFunction Function - HiLink amplRandomGenerator Function - HiLink amplComment Comment - HiLink amplDotSuffix Special - HiLink amplPiecewise Special +" The default methods for highlighting. Can be overridden later. +hi def link amplEntityKeyword Keyword +hi def link amplType Type +hi def link amplStatement Statement +hi def link amplOperators Operator +hi def link amplBasicOperators Operator +hi def link amplConditional Conditional +hi def link amplRepeat Repeat +hi def link amplStrings String +hi def link amplNumerics Number +hi def link amplSetFunction Function +hi def link amplBuiltInFunction Function +hi def link amplRandomGenerator Function +hi def link amplComment Comment +hi def link amplDotSuffix Special +hi def link amplPiecewise Special - delcommand HiLink -endif let b:current_syntax = "ampl" diff --git a/runtime/syntax/antlr.vim b/runtime/syntax/antlr.vim index 19000293fb..9b0b061ae1 100644 --- a/runtime/syntax/antlr.vim +++ b/runtime/syntax/antlr.vim @@ -4,11 +4,8 @@ " LastChange: 02 May 2001 " Original: Comes from JavaCC.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,12 +15,8 @@ endif " Those files usually have the extension *.jj " source the java.vim file -if version < 600 - so <sfile>:p:h/java.vim -else - runtime! syntax/java.vim - unlet b:current_syntax -endif +runtime! syntax/java.vim +unlet b:current_syntax "remove catching errors caused by wrong parenthesis (does not work in antlr "files) (first define them in case they have not been defined in java) @@ -53,17 +46,8 @@ syn match antlrSep "[|:]\|\.\." syn keyword antlrActionToken TOKEN SKIP MORE SPECIAL_TOKEN syn keyword antlrError DEBUG IGNORE_IN_BNF -if version >= 508 || !exists("did_antlr_syntax_inits") - if version < 508 - let did_antlr_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink antlrSep Statement - HiLink antlrPackages Statement - delcommand HiLink -endif +hi def link antlrSep Statement +hi def link antlrPackages Statement let b:current_syntax = "antlr" diff --git a/runtime/syntax/apache.vim b/runtime/syntax/apache.vim index 85cda4095a..e2315db0d7 100644 --- a/runtime/syntax/apache.vim +++ b/runtime/syntax/apache.vim @@ -9,13 +9,9 @@ " make it really linewise? " + add `display' where appropriate -" Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case ignore @@ -178,37 +174,28 @@ syn match apacheSection "<\/\=\(<IfVersion\)[^>]*>" contains=apacheAnything syn keyword apacheDeclaration VirtualDocumentRoot VirtualDocumentRootIP VirtualScriptAlias VirtualScriptAliasIP " Define the default highlighting -if version >= 508 || !exists("did_apache_syntax_inits") - if version < 508 - let did_apache_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink apacheAllowOverride apacheDeclaration - HiLink apacheAllowOverrideValue apacheOption - HiLink apacheAuthType apacheDeclaration - HiLink apacheAuthTypeValue apacheOption - HiLink apacheOptionOption apacheOption - HiLink apacheDeclaration Function - HiLink apacheAnything apacheOption - HiLink apacheOption Number - HiLink apacheComment Comment - HiLink apacheFixme Todo - HiLink apacheLimitSectionKeyword apacheLimitSection - HiLink apacheLimitSection apacheSection - HiLink apacheSection Label - HiLink apacheMethodOption Type - HiLink apacheAllowDeny Include - HiLink apacheAllowDenyValue Identifier - HiLink apacheOrder Special - HiLink apacheOrderValue String - HiLink apacheString String - HiLink apacheError Error - HiLink apacheUserID Number +hi def link apacheAllowOverride apacheDeclaration +hi def link apacheAllowOverrideValue apacheOption +hi def link apacheAuthType apacheDeclaration +hi def link apacheAuthTypeValue apacheOption +hi def link apacheOptionOption apacheOption +hi def link apacheDeclaration Function +hi def link apacheAnything apacheOption +hi def link apacheOption Number +hi def link apacheComment Comment +hi def link apacheFixme Todo +hi def link apacheLimitSectionKeyword apacheLimitSection +hi def link apacheLimitSection apacheSection +hi def link apacheSection Label +hi def link apacheMethodOption Type +hi def link apacheAllowDeny Include +hi def link apacheAllowDenyValue Identifier +hi def link apacheOrder Special +hi def link apacheOrderValue String +hi def link apacheString String +hi def link apacheError Error +hi def link apacheUserID Number - delcommand HiLink -endif let b:current_syntax = "apache" diff --git a/runtime/syntax/apachestyle.vim b/runtime/syntax/apachestyle.vim index 375fc70a9c..bd5c89d30f 100644 --- a/runtime/syntax/apachestyle.vim +++ b/runtime/syntax/apachestyle.vim @@ -1,8 +1,10 @@ " Vim syntax file " Language: Apache-Style configuration files (proftpd.conf/apache.conf/..) -" Maintainer: Christian Hammers <ch@westend.com> -" URL: none +" Maintainer: Ben RUBSON <ben.rubson@gmail.com> +" Former Maintainer: Christian Hammers <ch@westend.com> " ChangeLog: +" 2017-12-17,ch +" correctly detect comments " 2001-05-04,ch " adopted Vim 6.0 syntax style " 1999-10-28,ch @@ -20,18 +22,15 @@ " </SubSection> " </Section> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif syn case ignore -syn match apComment /^\s*#.*$/ syn match apOption /^\s*[^ \t#<=]*/ +syn match apComment /^\s*#.*$/ "syn match apLastValue /[^ \t<=#]*$/ contains=apComment ugly " tags @@ -41,25 +40,15 @@ syn match apTagOption contained / [-\/_\.:*a-zA-Z0-9]\+/ms=s+1 syn match apTagError contained /[^>]</ms=s+1 " 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_apachestyle_syn_inits") - if version < 508 - let did_apachestyle_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink apComment Comment - HiLink apOption Keyword - "HiLink apLastValue Identifier ugly? - HiLink apTag Special - HiLink apTagOption Identifier - HiLink apTagError Error +hi def link apComment Comment +hi def link apOption Keyword +"hi def link apLastValue Identifier ugly? +hi def link apTag Special +hi def link apTagOption Identifier +hi def link apTagError Error - delcommand HiLink -endif let b:current_syntax = "apachestyle" " vim: ts=8 diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim index 0607ca10f5..8cb14321e2 100644 --- a/runtime/syntax/aptconf.vim +++ b/runtime/syntax/aptconf.vim @@ -1,14 +1,11 @@ " Vim syntax file " Language: APT config file " Maintainer: Yann Amar <quidame@poivron.org> -" Last Change: 2013 Apr 12 +" Last Change: 2015 Dec 22 -" For version 5.x: Clear all syntax items -" For version 6.x and 7.x: Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif let main_syntax = 'aptconf' @@ -38,22 +35,22 @@ setlocal iskeyword+=/,-,.,_,+ " Incomplete keywords will be treated differently than completely bad strings: syn keyword aptconfGroupIncomplete - \ a[cquire] a[ptitude] d[ebtags] d[ebug] d[ir] d[pkg] d[select] - \ o[rderlist] p[ackagemanager] p[kgcachegen] q[uiet] r[pm] - \ u[nattended-upgrade] + \ a[cquire] a[dequate] a[ptitude] a[ptlistbugs] d[ebtags] d[ebug] + \ d[ir] d[pkg] d[select] o[rderlist] p[ackagemanager] p[kgcachegen] + \ q[uiet] r[pm] s[ynaptic] u[nattended-upgrade] w[hatmaps] " Only the following keywords can be used at toplevel (to begin an option): syn keyword aptconfGroup - \ acquire apt aptitude debtags debug dir dpkg dselect - \ orderlist packagemanager pkgcachegen quiet rpm - \ unattended-upgrade + \ acquire adequate apt aptitude aptlistbugs debtags debug + \ dir dpkg dselect orderlist packagemanager pkgcachegen + \ quiet rpm synaptic unattended-upgrade whatmaps " Possible options for each group: " Acquire: {{{ syn keyword aptconfAcquire contained - \ cdrom Check-Valid-Until CompressionTypes ForceHash ftp gpgv - \ GzipIndexes http https Languages Max-ValidTime Min-ValidTime PDiffs - \ Queue-Mode Retries Source-Symlinks + \ cdrom Check-Valid-Until CompressionTypes ForceHash ForceIPv4 + \ ForceIPv6 ftp gpgv GzipIndexes http https Languages Max-ValidTime + \ Min-ValidTime PDiffs Queue-Mode Retries Source-Symlinks syn keyword aptconfAcquireCDROM contained \ AutoDetect CdromOnly Mount UMount @@ -62,14 +59,15 @@ syn keyword aptconfAcquireCompressionTypes contained \ bz2 lzma gz Order syn keyword aptconfAcquireFTP contained - \ Passive Proxy ProxyLogin Timeout + \ ForceExtended Passive Proxy ProxyLogin Timeout syn keyword aptconfAcquireHTTP contained \ AllowRedirect Dl-Limit Max-Age No-Cache No-Store Pipeline-Depth - \ Proxy Timeout User-Agent + \ Proxy ProxyAutoDetect Proxy-Auto-Detect Timeout User-Agent syn keyword aptconfAcquireHTTPS contained - \ CaInfo CaPath CrlFile IssuerCert SslCert SslForceVersion SslKey + \ AllowRedirect CaInfo CaPath CrlFile Dl-Limit IssuerCert Max-Age + \ No-Cache No-Store Proxy SslCert SslForceVersion SslKey Timeout \ Verify-Host Verify-Peer syn keyword aptconfAcquireMaxValidTime contained @@ -83,14 +81,21 @@ syn cluster aptconfAcquire_ contains=aptconfAcquire, \ aptconfAcquireHTTP,aptconfAcquireHTTPS,aptconfAcquireMaxValidTime, \ aptconfAcquirePDiffs " }}} +" Adequate: {{{ +syn keyword aptconfAdequate contained + \ Enabled + +syn cluster aptconfAdequate_ contains=aptconfAdequate +" }}} " Apt: {{{ syn keyword aptconfApt contained \ Architecture Architectures Archive Authentication AutoRemove - \ Build-Essential Cache Cache-Grow Cache-Limit Cache-Start CDROM - \ Changelogs Clean-Installed Compressor Default-Release - \ Force-LoopBreak Get Ignore-Hold Immediate-Configure + \ Build-Essential Build-Profiles Cache Cache-Grow Cache-Limit + \ Cache-Start CDROM Changelogs Clean-Installed Compressor + \ Default-Release Force-LoopBreak Get Ignore-Hold Immediate-Configure \ Install-Recommends Install-Suggests Keep-Fds List-Cleanup - \ NeverAutoRemove Never-MarkAuto-Sections Periodic Status-Fd Update + \ Move-Autobit-Sections NeverAutoRemove Never-MarkAuto-Sections + \ Periodic Status-Fd Update VersionedKernelPackages syn keyword aptconfAptAuthentication contained \ TrustCDROM @@ -124,11 +129,12 @@ syn keyword aptconfAptGet contained syn keyword aptconfAptPeriodic contained \ AutocleanInterval BackupArchiveInterval BackupLevel - \ Download-Upgradeable-Packages MaxAge MaxSize MinAge - \ Unattended-Upgrade Update-Package-Lists Verbose + \ Download-Upgradeable-Packages Download-Upgradeable-Packages-Debdelta + \ Enable MaxAge MaxSize MinAge Unattended-Upgrade Update-Package-Lists + \ Verbose syn keyword aptconfAptUpdate contained - \ Pre-Invoke Post-Invoke Post-Invoke-Success + \ List-Refresh Pre-Invoke Post-Invoke Post-Invoke-Success syn cluster aptconfApt_ contains=aptconfApt, \ aptconfAptAuthentication,aptconfAptAutoRemove,aptconfAptCache, @@ -240,6 +246,12 @@ syn cluster aptconfAptitude_ contains=aptconfAptitude, \ aptconfAptitudeUIKeyBindings,aptconfAptitudeUIStyles, \ aptconfAptitudeUIStylesElements " }}} +" AptListbugs: {{{ +syn keyword aptconfAptListbugs contained + \ IgnoreRegexp Severities + +syn cluster aptconfAptListbugs_ contains=aptconfAptListbugs +" }}} " DebTags: {{{ syn keyword aptconfDebTags contained \ Vocabulary @@ -251,7 +263,8 @@ syn keyword aptconfDebug contained \ Acquire aptcdrom BuildDeps Hashes IdentCdrom Nolocking \ pkgAcquire pkgAutoRemove pkgCacheGen pkgDepCache pkgDPkgPM \ pkgDPkgProgressReporting pkgInitialize pkgOrderList - \ pkgPackageManager pkgPolicy pkgProblemResolver sourceList + \ pkgPackageManager pkgPolicy pkgProblemResolver RunScripts + \ sourceList syn keyword aptconfDebugAcquire contained \ cdrom Ftp gpgv Http Https netrc @@ -295,7 +308,7 @@ syn keyword aptconfDirMedia contained \ MountPath syn keyword aptconfDirState contained - \ cdroms extended_states Lists mirrors status + \ cdroms extended_states Lists mirrors preferences status syn cluster aptconfDir_ contains=aptconfDir, \ aptconfDirAptitude,aptconfDirBin,aptconfDirCache,aptconfDirEtc, @@ -303,15 +316,16 @@ syn cluster aptconfDir_ contains=aptconfDir, " }}} " DPkg: {{{ syn keyword aptconfDPkg contained - \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN MaxArgs - \ MaxBytes NoTriggers options Pre-Install-Pkgs Pre-Invoke Post-Invoke + \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN + \ MaxArgBytes MaxArgs MaxBytes NoTriggers options + \ Pre-Install-Pkgs Pre-Invoke Post-Invoke \ Run-Directory StopOnError Tools TriggersPending syn keyword aptconfDPkgTools contained - \ Options Version + \ adequate InfoFD Options Version syn cluster aptconfDPkg_ contains=aptconfDPkg, - \ aptconfDPkgOrderList,aptconfDPkgOrderListScore,aptconfDPkgTools + \ aptconfDPkgTools " }}} " DSelect: {{{ syn keyword aptconfDSelect contained @@ -353,23 +367,59 @@ syn keyword aptconfRpm contained syn cluster aptconfRpm_ contains=aptconfRpm " }}} -" Unattened Upgrade: {{{ +" Synaptic: {{{ +syn keyword aptconfSynaptic contained + \ AskQuitOnProceed AskRelated AutoCleanCache CleanCache DefaultDistro + \ delAction delHistory Download-Only ftpProxy ftpProxyPort httpProxy + \ httpProxyPort Install-Recommends LastSearchType Maximized noProxy + \ OneClickOnStatusActions ShowAllPkgInfoInMain showWelcomeDialog + \ ToolbarState undoStackSize update upgradeType useProxy UseStatusColors + \ UseTerminal useUserFont useUserTerminalFont ViewMode + \ availVerColumnPos availVerColumnVisible componentColumnPos + \ componentColumnVisible descrColumnPos descrColumnVisible + \ downloadSizeColumnPos downloadSizeColumnVisible hpanedPos + \ instVerColumnPos instVerColumnVisible instSizeColumnPos + \ instSizeColumnVisible nameColumnPos nameColumnVisible + \ sectionColumnPos sectionColumnVisible statusColumnPos + \ statusColumnVisible supportedColumnPos supportedColumnVisible + \ vpanedPos windowWidth windowHeight windowX windowY closeZvt + \ color-available color-available-locked color-broken color-downgrade + \ color-install color-installed-locked color-installed-outdated + \ color-installed-updated color-new color-purge color-reinstall + \ color-remove color-upgrade + +syn keyword aptconfSynapticUpdate contained + \ last type + +syn cluster aptconfSynaptic_ contains=aptconfSynaptic, + \ aptconfSynapticUpdate +" }}} +" Unattended Upgrade: {{{ syn keyword aptconfUnattendedUpgrade contained - \ AutoFixInterruptedDpkg Automatic-Reboot InstallOnShutdown Mail - \ MailOnlyOnError MinimalSteps Origins-Pattern Package-Blacklist + \ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time + \ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError + \ MinimalSteps Origins-Pattern Package-Blacklist \ Remove-Unused-Dependencies syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade " }}} +" Whatmaps: {{{ +syn keyword aptconfWhatmaps contained + \ Enable-Restart Security-Update-Origins + +syn cluster aptconfWhatmaps_ contains=aptconfWhatmaps +" }}} syn case match " Now put all the keywords (and 'valid' options) in a single cluster: syn cluster aptconfOptions contains=aptconfRegexpOpt, - \ @aptconfAcquire_,@aptconfApt_,@aptconfAptitude_,@aptconfDebTags_, - \ @aptconfDebug_,@aptconfDir_,@aptconfDPkg_,@aptconfDSelect_, - \ @aptconfOrderList_,@aptconfPackageManager_,@aptconfPkgCacheGen_, - \ @aptconfQuiet_,@aptconfRpm_,@aptconfUnattendedUpgrade_ + \ @aptconfAcquire_,@aptconfAdequate_,@aptconfApt_,@aptconfAptitude_, + \ @aptconfAptListbugs_,@aptconfDebTags_,@aptconfDebug_,@aptconfDir_, + \ @aptconfDPkg_,@aptconfDSelect_,@aptconfOrderList_, + \ @aptconfPackageManager_,@aptconfPkgCacheGen_,@aptconfQuiet_, + \ @aptconfRpm_,@aptconfSynaptic_,@aptconfUnattendedUpgrade_, + \ @aptconfWhatmaps_ " Syntax: syn match aptconfSemiColon ';' @@ -382,8 +432,11 @@ syn region aptconfInclude matchgroup=aptconfOperator start='::' end='::\|\s'me= " Basic Syntax Errors: XXX avoid to generate false positives !!! " -" * Invalid comment format (seems to not cause errors, but...): -syn match aptconfAsError display '^#.*' +" * Undocumented inline comment. Since it is currently largely used, and does +" not seem to cause trouble ('apt-config dump' never complains when # is used +" the same way than //) it has been moved to aptconfComment group. But it +" still needs to be defined here (i.e. before #clear and #include directives) +syn match aptconfComment '#.*' contains=@aptconfCommentSpecial " " * When a semicolon is missing after a double-quoted string: " There are some cases (for example in the Dir group of options, but not only) @@ -445,6 +498,8 @@ hi def link aptconfAcquireHTTPS aptconfOption hi def link aptconfAcquireMaxValidTime aptconfOption hi def link aptconfAcquirePDiffs aptconfOption +hi def link aptconfAdequate aptconfOption + hi def link aptconfApt aptconfOption hi def link aptconfAptAuthentication aptconfOption hi def link aptconfAptAutoRemove aptconfOption @@ -471,6 +526,8 @@ hi def link aptconfAptitudeUIKeyBindings aptconfOption hi def link aptconfAptitudeUIStyles aptconfOption hi def link aptconfAptitudeUIStylesElements aptconfOption +hi def link aptconfAptListbugs aptconfOption + hi def link aptconfDebTags aptconfOption hi def link aptconfDebug aptconfOption @@ -504,8 +561,13 @@ hi def link aptconfQuiet aptconfOption hi def link aptconfRpm aptconfOption +hi def link aptconfSynaptic aptconfOption +hi def link aptconfSynapticUpdate aptconfOption + hi def link aptconfUnattendedUpgrade aptconfOption +hi def link aptconfWhatmaps aptconfOption + let b:current_syntax = "aptconf" let &cpo = s:cpo_save diff --git a/runtime/syntax/arch.vim b/runtime/syntax/arch.vim index fa9c3f02c3..f9d095e443 100644 --- a/runtime/syntax/arch.vim +++ b/runtime/syntax/arch.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: GNU Arch inventory file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: GNU Arch inventory file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/arduino.vim b/runtime/syntax/arduino.vim index 14299a441a..4a4ef82072 100644 --- a/runtime/syntax/arduino.vim +++ b/runtime/syntax/arduino.vim @@ -10,20 +10,13 @@ " Thanks to Rik, Erik Nomitch, Adam Obeng and Graeme Cross for helpful feedback! -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - so <sfile>:p:h/cpp.vim -else - runtime! syntax/cpp.vim -endif +runtime! syntax/cpp.vim syn keyword arduinoConstant HIGH LOW INPUT OUTPUT syn keyword arduinoConstant DEC BIN HEX OCT BYTE diff --git a/runtime/syntax/asciidoc.vim b/runtime/syntax/asciidoc.vim index 1303db7cf2..ccb079e06b 100644 --- a/runtime/syntax/asciidoc.vim +++ b/runtime/syntax/asciidoc.vim @@ -5,6 +5,7 @@ " URL: http://asciidoc.org/ " Licence: GPL (http://www.gnu.org) " Remarks: Vim 6 or greater +" Last Update: 2014 Aug 29 (see Issue 240) " Limitations: " " - Nested quoted text formatting is highlighted according to the outer @@ -155,7 +156,8 @@ hi def link asciidocQuotedAttributeList Special hi def link asciidocQuotedBold Special hi def link asciidocQuotedDoubleQuoted Label hi def link asciidocQuotedEmphasized2 Type -hi def link asciidocQuotedEmphasized Type +hi asciidocQuotedEmphasizedItalic term=italic cterm=italic gui=italic +hi def link asciidocQuotedEmphasized asciidocQuotedEmphasizedItalic hi def link asciidocQuotedMonospaced2 Identifier hi def link asciidocQuotedMonospaced Identifier hi def link asciidocQuotedSingleQuoted Label diff --git a/runtime/syntax/asm.vim b/runtime/syntax/asm.vim index e5f16c5bdc..492e3e8e92 100644 --- a/runtime/syntax/asm.vim +++ b/runtime/syntax/asm.vim @@ -7,11 +7,8 @@ " Thanks to Ori Avtalion for feedback on the comment markers! -" For version 5.x: Clear all syntax items -" For version 6.0 and later: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -103,37 +100,27 @@ syn match asmDirective "\.[A-Za-z][0-9A-Za-z-_]*" syn case match " 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_asm_syntax_inits") - if version < 508 - let did_asm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink asmSection Special - HiLink asmLabel Label - HiLink asmComment Comment - HiLink asmTodo Todo - HiLink asmDirective Statement - - HiLink asmInclude Include - HiLink asmCond PreCondit - HiLink asmMacro Macro - - HiLink hexNumber Number - HiLink decNumber Number - HiLink octNumber Number - HiLink binNumber Number - - HiLink asmIdentifier Identifier - HiLink asmType Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link asmSection Special +hi def link asmLabel Label +hi def link asmComment Comment +hi def link asmTodo Todo +hi def link asmDirective Statement + +hi def link asmInclude Include +hi def link asmCond PreCondit +hi def link asmMacro Macro + +hi def link hexNumber Number +hi def link decNumber Number +hi def link octNumber Number +hi def link binNumber Number + +hi def link asmIdentifier Identifier +hi def link asmType Type + let b:current_syntax = "asm" diff --git a/runtime/syntax/asm68k.vim b/runtime/syntax/asm68k.vim index 8463e487e1..e13dfe6389 100644 --- a/runtime/syntax/asm68k.vim +++ b/runtime/syntax/asm68k.vim @@ -8,11 +8,8 @@ " Feel free to contribute... " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -328,63 +325,53 @@ syn match asm68kDirective "\<XREF\(\.S\)\=\s" syn case match " 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_asm68k_syntax_inits") - if version < 508 - let did_asm68k_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - " Comment Constant Error Identifier PreProc Special Statement Todo Type - " - " Constant Boolean Character Number String - " Identifier Function - " PreProc Define Include Macro PreCondit - " Special Debug Delimiter SpecialChar SpecialComment Tag - " Statement Conditional Exception Keyword Label Operator Repeat - " Type StorageClass Structure Typedef - - HiLink asm68kComment Comment - HiLink asm68kTodo Todo - - HiLink hexNumber Number " Constant - HiLink octNumber Number " Constant - HiLink binNumber Number " Constant - HiLink decNumber Number " Constant - HiLink floatNumber Number " Constant - HiLink floatExponent Number " Constant - HiLink floatE SpecialChar " Statement - "HiLink floatE Number " Constant - - HiLink asm68kImmediate SpecialChar " Statement - "HiLink asm68kSymbol Constant - - HiLink asm68kString String " Constant - HiLink asm68kCharError Error - HiLink asm68kStringError Error - - HiLink asm68kReg Identifier - HiLink asm68kOperator Identifier - - HiLink asm68kInclude Include " PreProc - HiLink asm68kMacro Macro " PreProc - HiLink asm68kMacroParam Keyword " Statement - - HiLink asm68kDirective Special - HiLink asm68kPreCond Special - - - HiLink asm68kOpcode Statement - HiLink asm68kCond Conditional " Statement - HiLink asm68kRepeat Repeat " Statement - - HiLink asm68kLabel Type - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +" Comment Constant Error Identifier PreProc Special Statement Todo Type +" +" Constant Boolean Character Number String +" Identifier Function +" PreProc Define Include Macro PreCondit +" Special Debug Delimiter SpecialChar SpecialComment Tag +" Statement Conditional Exception Keyword Label Operator Repeat +" Type StorageClass Structure Typedef + +hi def link asm68kComment Comment +hi def link asm68kTodo Todo + +hi def link hexNumber Number " Constant +hi def link octNumber Number " Constant +hi def link binNumber Number " Constant +hi def link decNumber Number " Constant +hi def link floatNumber Number " Constant +hi def link floatExponent Number " Constant +hi def link floatE SpecialChar " Statement +"hi def link floatE Number " Constant + +hi def link asm68kImmediate SpecialChar " Statement +"hi def link asm68kSymbol Constant + +hi def link asm68kString String " Constant +hi def link asm68kCharError Error +hi def link asm68kStringError Error + +hi def link asm68kReg Identifier +hi def link asm68kOperator Identifier + +hi def link asm68kInclude Include " PreProc +hi def link asm68kMacro Macro " PreProc +hi def link asm68kMacroParam Keyword " Statement + +hi def link asm68kDirective Special +hi def link asm68kPreCond Special + + +hi def link asm68kOpcode Statement +hi def link asm68kCond Conditional " Statement +hi def link asm68kRepeat Repeat " Statement + +hi def link asm68kLabel Type let b:current_syntax = "asm68k" diff --git a/runtime/syntax/asmh8300.vim b/runtime/syntax/asmh8300.vim index 48699d89c5..8560fb7ae4 100644 --- a/runtime/syntax/asmh8300.vim +++ b/runtime/syntax/asmh8300.vim @@ -3,11 +3,8 @@ " Maintainer: Kevin Dahlhausen <kdahlhaus@yahoo.com> " Last Change: 2002 Sep 19 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -52,33 +49,19 @@ syn case match " Read the general asm syntax -if version < 600 - source <sfile>:p:h/asm.vim -else - runtime! syntax/asm.vim -endif +runtime! syntax/asm.vim " 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_hitachi_syntax_inits") - if version < 508 - let did_hitachi_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink asmOpcode Statement - HiLink asmRegister Identifier +hi def link asmOpcode Statement +hi def link asmRegister Identifier - " My default-color overrides: - "hi asmOpcode ctermfg=yellow - "hi asmReg ctermfg=lightmagenta +" My default-color overrides: +"hi asmOpcode ctermfg=yellow +"hi asmReg ctermfg=lightmagenta - delcommand HiLink -endif let b:current_syntax = "asmh8300" diff --git a/runtime/syntax/asn.vim b/runtime/syntax/asn.vim index 28c8efba95..e90c7e079c 100644 --- a/runtime/syntax/asn.vim +++ b/runtime/syntax/asn.vim @@ -4,11 +4,8 @@ " URL: http://www.fleiner.com/vim/syntax/asn.vim " Last Change: 2012 Oct 05 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -50,34 +47,24 @@ syn match asnBraces "[{}]" syn sync ccomment asnComment " 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_asn_syn_inits") - if version < 508 - let did_asn_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink asnDefinition Function - HiLink asnBraces Function - HiLink asnStructure Statement - HiLink asnBoolValue Boolean - HiLink asnSpecial Special - HiLink asnString String - HiLink asnCharacter Character - HiLink asnSpecialCharacter asnSpecial - HiLink asnNumber asnValue - HiLink asnComment Comment - HiLink asnLineComment asnComment - HiLink asnType Type - HiLink asnTypeInfo PreProc - HiLink asnValue Number - HiLink asnExternal Include - HiLink asnTagModifier Function - HiLink asnFieldOption Type - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link asnDefinition Function +hi def link asnBraces Function +hi def link asnStructure Statement +hi def link asnBoolValue Boolean +hi def link asnSpecial Special +hi def link asnString String +hi def link asnCharacter Character +hi def link asnSpecialCharacter asnSpecial +hi def link asnNumber asnValue +hi def link asnComment Comment +hi def link asnLineComment asnComment +hi def link asnType Type +hi def link asnTypeInfo PreProc +hi def link asnValue Number +hi def link asnExternal Include +hi def link asnTagModifier Function +hi def link asnFieldOption Type let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/syntax/aspperl.vim b/runtime/syntax/aspperl.vim index 0f7ef46872..5a9abedb19 100644 --- a/runtime/syntax/aspperl.vim +++ b/runtime/syntax/aspperl.vim @@ -4,11 +4,8 @@ " URL: http://nim.dhs.org/~edh/aspperl.vim " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -16,14 +13,9 @@ if !exists("main_syntax") let main_syntax = 'perlscript' endif -if version < 600 - so <sfile>:p:h/html.vim - syn include @AspPerlScript <sfile>:p:h/perl.vim -else - runtime! syntax/html.vim - unlet b:current_syntax - syn include @AspPerlScript syntax/perl.vim -endif +runtime! syntax/html.vim +unlet b:current_syntax +syn include @AspPerlScript syntax/perl.vim syn cluster htmlPreproc add=AspPerlScriptInsideHtmlTags diff --git a/runtime/syntax/aspvbs.vim b/runtime/syntax/aspvbs.vim index 07c129e463..8b4443b4bd 100644 --- a/runtime/syntax/aspvbs.vim +++ b/runtime/syntax/aspvbs.vim @@ -11,10 +11,8 @@ " Thanks to Dean Hall <hall@apt7.com> for testing the use of classes in " VBScripts which I've been too scared to do. -" 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 @@ -22,11 +20,7 @@ if !exists("main_syntax") let main_syntax = 'aspvbs' endif -if version < 600 - source <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim unlet b:current_syntax syn cluster htmlPreProc add=AspVBScriptInsideHtmlTags @@ -163,31 +157,21 @@ syn sync match htmlHighlight grouphere htmlTag "%>" " 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_aspvbs_syn_inits") - if version < 508 - let did_aspvbs_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - "HiLink AspVBScript Special - HiLink AspVBSLineNumber Comment - HiLink AspVBSNumber Number - HiLink AspVBSError Error - HiLink AspVBSStatement Statement - HiLink AspVBSString String - HiLink AspVBSComment Comment - HiLink AspVBSTodo Todo - HiLink AspVBSFunction Identifier - HiLink AspVBSMethods PreProc - HiLink AspVBSEvents Special - HiLink AspVBSTypeSpecifier Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +"hi def link AspVBScript Special +hi def link AspVBSLineNumber Comment +hi def link AspVBSNumber Number +hi def link AspVBSError Error +hi def link AspVBSStatement Statement +hi def link AspVBSString String +hi def link AspVBSComment Comment +hi def link AspVBSTodo Todo +hi def link AspVBSFunction Identifier +hi def link AspVBSMethods PreProc +hi def link AspVBSEvents Special +hi def link AspVBSTypeSpecifier Type + let b:current_syntax = "aspvbs" diff --git a/runtime/syntax/asterisk.vim b/runtime/syntax/asterisk.vim index 58e867d42a..4a922d3f11 100644 --- a/runtime/syntax/asterisk.vim +++ b/runtime/syntax/asterisk.vim @@ -1,13 +1,13 @@ " Vim syntax file " Language: Asterisk config file -" Maintainer: brc007 +" Maintainer: Jean Aunis <jean.aunis@yahoo.fr> +" Previous Maintainer: brc007 " Updated for 1.2 by Tilghman Lesher (Corydon76) -" Last Change: 2006 Mar 20 +" Last Change: 2015 Feb 27 " version 0.4 -" -if version < 600 - syntax clear -elseif exists("b:current_syntax") + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -17,18 +17,19 @@ syn sync fromstart syn keyword asteriskTodo TODO contained syn match asteriskComment ";.*" contains=asteriskTodo syn match asteriskContext "\[.\{-}\]" -syn match asteriskExten "^\s*exten\s*=>\?\s*[^,]\+" contains=asteriskPattern +syn match asteriskExten "^\s*\zsexten\s*=>\?\s*[^,]\+\ze," contains=asteriskPattern nextgroup=asteriskPriority +syn match asteriskExten "^\s*\zssame\s*=>\?\s*\ze" nextgroup=asteriskPriority syn match asteriskExten "^\s*\(register\|channel\|ignorepat\|include\|\(no\)\?load\)\s*=>\?" syn match asteriskPattern "_\(\[[[:alnum:]#*\-]\+\]\|[[:alnum:]#*]\)*\.\?" contained syn match asteriskPattern "[^A-Za-z0-9,]\zs[[:alnum:]#*]\+\ze" contained syn match asteriskApp ",\zs[a-zA-Z]\+\ze$" syn match asteriskApp ",\zs[a-zA-Z]\+\ze(" " Digits plus oldlabel (newlabel) -syn match asteriskPriority ",\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel " oldlabel plus digits (newlabel) -syn match asteriskPriority ",\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel " s or n plus digits (newlabel) -syn match asteriskPriority ",\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel syn match asteriskLabel "(\zs[[:alpha:]][[:alnum:]]*\ze)" contained syn match asteriskError "^\s*#\s*[[:alnum:]]*" syn match asteriskInclude "^\s*#\s*\(include\|exec\)\s.*" @@ -55,42 +56,33 @@ syn match asteriskSetting "^port\s*=\s*\d\{1,5}\s*$" contains=aste syn match asteriskSetting "^host\s*=\s*\(dynamic\|\(\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)\|\([[:alnum:]][[:alnum:]\-\.]*\.[[:alpha:]]{2,10}\)\)" contains=asteriskIP,asteriskHostname " 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_conf_syntax_inits") - if version < 508 - let did_conf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link asteriskComment Comment +hi def link asteriskExten String +hi def link asteriskContext Preproc +hi def link asteriskPattern Type +hi def link asteriskApp Statement +hi def link asteriskInclude Preproc +hi def link asteriskIncludeBad Error +hi def link asteriskPriority Preproc +hi def link asteriskLabel Type +hi def link asteriskVar String +hi def link asteriskVarLen Function +hi def link asteriskExp Type +hi def link asteriskCodecsPermit Preproc +hi def link asteriskCodecs String +hi def link asteriskType Statement +hi def link asteriskTypeType Type +hi def link asteriskAuth String +hi def link asteriskAuthType Type +hi def link asteriskIPRange Identifier +hi def link asteriskIP Identifier +hi def link asteriskPort Identifier +hi def link asteriskHostname Identifier +hi def link asteriskSetting Statement +hi def link asteriskError Error - HiLink asteriskComment Comment - HiLink asteriskExten String - HiLink asteriskContext Preproc - HiLink asteriskPattern Type - HiLink asteriskApp Statement - HiLink asteriskInclude Preproc - HiLink asteriskIncludeBad Error - HiLink asteriskPriority Preproc - HiLink asteriskLabel Type - HiLink asteriskVar String - HiLink asteriskVarLen Function - HiLink asteriskExp Type - HiLink asteriskCodecsPermit Preproc - HiLink asteriskCodecs String - HiLink asteriskType Statement - HiLink asteriskTypeType Type - HiLink asteriskAuth String - HiLink asteriskAuthType Type - HiLink asteriskIPRange Identifier - HiLink asteriskIP Identifier - HiLink asteriskPort Identifier - HiLink asteriskHostname Identifier - HiLink asteriskSetting Statement - HiLink asteriskError Error - delcommand HiLink -endif let b:current_syntax = "asterisk" " vim: ts=8 sw=2 diff --git a/runtime/syntax/asteriskvm.vim b/runtime/syntax/asteriskvm.vim index a6c9dba418..fa55af5451 100644 --- a/runtime/syntax/asteriskvm.vim +++ b/runtime/syntax/asteriskvm.vim @@ -3,10 +3,9 @@ " Maintainer: Tilghman Lesher (Corydon76) " Last Change: 2006 Mar 21 " version 0.2 -" -if version < 600 - syntax clear -elseif exists("b:current_syntax") + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -33,28 +32,18 @@ syn match mailboxEmail ",\zs[^@=,]*@[[:alnum:]\-\.]\+\.[[:alpha syn match comma "[,|]" contained " 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_conf_syntax_inits") - if version < 508 - let did_conf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink asteriskvmComment Comment - HiLink asteriskvmContext Identifier - HiLink asteriskvmZone Type - HiLink zoneName String - HiLink zoneDef String - HiLink asteriskvmSetting Type - HiLink asteriskvmSettingBool Type - - HiLink asteriskvmMailbox Statement - HiLink mailboxEmail String - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link asteriskvmComment Comment +hi def link asteriskvmContext Identifier +hi def link asteriskvmZone Type +hi def link zoneName String +hi def link zoneDef String +hi def link asteriskvmSetting Type +hi def link asteriskvmSettingBool Type + +hi def link asteriskvmMailbox Statement +hi def link mailboxEmail String let b:current_syntax = "asteriskvm" diff --git a/runtime/syntax/atlas.vim b/runtime/syntax/atlas.vim index b8fe4356b5..1cdceab4ce 100644 --- a/runtime/syntax/atlas.vim +++ b/runtime/syntax/atlas.vim @@ -3,11 +3,8 @@ " Maintainer: Inaki Saez <jisaez@sfe.indra.es> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -61,37 +58,27 @@ syn sync maxlines=100 " 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_atlas_syntax_inits") - if version < 508 - let did_atlas_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink atlasConditional Conditional - HiLink atlasRepeat Repeat - HiLink atlasStatement Statement - HiLink atlasNumber Number - HiLink atlasHexNumber Number - HiLink atlasOctalNumber Number - HiLink atlasBinNumber Number - HiLink atlasDecimalNumber Float - HiLink atlasFormatString String - HiLink atlasString String - HiLink atlasComment Comment - HiLink atlasComment2 Comment - HiLink atlasInclude Include - HiLink atlasDefine Macro - HiLink atlasReserved PreCondit - HiLink atlasStorageClass StorageClass - HiLink atlasIdentifier NONE - HiLink atlasSpecial Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link atlasConditional Conditional +hi def link atlasRepeat Repeat +hi def link atlasStatement Statement +hi def link atlasNumber Number +hi def link atlasHexNumber Number +hi def link atlasOctalNumber Number +hi def link atlasBinNumber Number +hi def link atlasDecimalNumber Float +hi def link atlasFormatString String +hi def link atlasString String +hi def link atlasComment Comment +hi def link atlasComment2 Comment +hi def link atlasInclude Include +hi def link atlasDefine Macro +hi def link atlasReserved PreCondit +hi def link atlasStorageClass StorageClass +hi def link atlasIdentifier NONE +hi def link atlasSpecial Special + let b:current_syntax = "atlas" diff --git a/runtime/syntax/autodoc.vim b/runtime/syntax/autodoc.vim new file mode 100644 index 0000000000..67a627e46c --- /dev/null +++ b/runtime/syntax/autodoc.vim @@ -0,0 +1,101 @@ +" Vim syntax file +" Language: Autodoc +" Maintainer: Stephen R. van den Berg <srb@cuci.nl> +" Last Change: 2018 Jan 23 +" Version: 2.9 +" Remark: Included by pike.vim, cmod.vim and optionally c.vim +" Remark: In order to make c.vim use it, set: c_autodoc + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn case match + +" A bunch of useful autodoc keywords +syn keyword autodocStatement contained appears belongs global +syn keyword autodocStatement contained decl directive inherit +syn keyword autodocStatement contained deprecated obsolete bugs +syn keyword autodocStatement contained copyright example fixme note param returns +syn keyword autodocStatement contained seealso thanks throws constant +syn keyword autodocStatement contained member index elem +syn keyword autodocStatement contained value type item + +syn keyword autodocRegion contained enum mapping code multiset array +syn keyword autodocRegion contained int string section mixed ol ul dl +syn keyword autodocRegion contained class module namespace +syn keyword autodocRegion contained endenum endmapping endcode endmultiset +syn keyword autodocRegion contained endarray endint endstring endsection +syn keyword autodocRegion contained endmixed endol endul enddl +syn keyword autodocRegion contained endclass endmodule endnamespace + +syn keyword autodocIgnore contained ignore endignore + +syn keyword autodocStatAcc contained b i u tt url pre sub sup +syn keyword autodocStatAcc contained ref rfc xml dl expr image + +syn keyword autodocTodo contained TODO FIXME XXX + +syn match autodocLineStart display "\(//\|/\?\*\)\@2<=!" +syn match autodocWords "[^!@{}[\]]\+" display contains=@Spell + +syn match autodocLink "@\[[^[\]]\+]"hs=s+2,he=e-1 display contains=autodocLead +syn match autodocAtStmt "@[a-z]\+\%(\s\|$\)\@="hs=s+1 display contains=autodocStatement,autodocIgnore,autodocLead,autodocRegion + +" Due to limitations of the matching algorithm, we cannot highlight +" nested autodocNStmtAcc structures correctly +syn region autodocNStmtAcc start="@[a-z]\+{" end="@}" contains=autodocStatAcc,autodocLead keepend + +syn match autodocUrl contained display ".\+" +syn region autodocAtUrlAcc start="{"ms=s+1 end="@}"he=e-1,me=e-2 contained display contains=autodocUrl,autodocLead keepend +syn region autodocNUrlAcc start="@url{" end="@}" contains=autodocStatAcc,autodocAtUrlAcc,autodocLead transparent + +syn match autodocSpecial "@@" display +syn match autodocLead "@" display contained + +"when wanted, highlight trailing white space +if exists("c_space_errors") + if !exists("c_no_trail_space_error") + syn match autodocSpaceError display excludenl "\s\+$" + endif + if !exists("c_no_tab_space_error") + syn match autodocSpaceError display " \+\t"me=e-1 + endif +endif + +if exists("c_minlines") + let b:c_minlines = c_minlines +else + if !exists("c_no_if0") + let b:c_minlines = 50 " #if 0 constructs can be long + else + let b:c_minlines = 15 " mostly for () constructs + endif +endif +exec "syn sync ccomment autodocComment minlines=" . b:c_minlines + +" Define the default highlighting. +" Only used when an item doesn't have highlighting yet +hi def link autodocStatement Statement +hi def link autodocStatAcc Statement +hi def link autodocRegion Structure +hi def link autodocAtStmt Error +hi def link autodocNStmtAcc Identifier +hi def link autodocLink Type +hi def link autodocTodo Todo +hi def link autodocSpaceError Error +hi def link autodocLineStart SpecialComment +hi def link autodocSpecial SpecialChar +hi def link autodocUrl Underlined +hi def link autodocLead Statement +hi def link autodocIgnore Delimiter + +let b:current_syntax = "autodoc" + +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: ts=8 diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim index 42d4cfdfe4..c6a68f7a21 100644 --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -1,7 +1,10 @@ " Vim syntax file " Language: AutoHotkey script file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-06-22 +" Maintainer: Michael Wong +" https://github.com/mmikeww/autohotkey.vim +" Latest Revision: 2017-04-03 +" Previous Maintainers: SungHyun Nam <goweol@gmail.com> +" Nikolai Weibull <now@bitwi.se> if exists("b:current_syntax") finish @@ -16,68 +19,11 @@ syn keyword autohotkeyTodo \ contained \ TODO FIXME XXX NOTE -syn cluster autohotkeyCommentGroup - \ contains= - \ autohotkeyTodo, - \ @Spell - -syn match autohotkeyComment - \ display - \ contains=@autohotkeyCommentGroup - \ '`\@<!;.*$' - -syn region autohotkeyComment - \ contains=@autohotkeyCommentGroup - \ matchgroup=autohotkeyCommentStart - \ start='/\*' - \ end='\*/' - +" only these chars are valid as escape sequences: ,%`;nrbtvaf +" https://autohotkey.com/docs/commands/_EscapeChar.htm syn match autohotkeyEscape \ display - \ '`.' - -syn match autohotkeyHotkey - \ contains=autohotkeyKey, - \ autohotkeyHotkeyDelimiter - \ display - \ '^.\{-}::' - -syn match autohotkeyKey - \ contained - \ display - \ '^.\{-}' - -syn match autohotkeyDelimiter - \ contained - \ display - \ '::' - -syn match autohotkeyHotstringDefinition - \ contains=autohotkeyHotstring, - \ autohotkeyHotstringDelimiter - \ display - \ '^:\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\)*:.\{-}::' - -syn match autohotkeyHotstring - \ contained - \ display - \ '.\{-}' - -syn match autohotkeyHotstringDelimiter - \ contained - \ display - \ '::' - -syn match autohotkeyHotstringDelimiter - \ contains=autohotkeyHotstringOptions - \ contained - \ display - \ ':\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\):' - -syn match autohotkeyHotstringOptions - \ contained - \ display - \ '\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\)' + \ '`[,%`;nrbtvaf]' syn region autohotkeyString \ display @@ -87,39 +33,46 @@ syn region autohotkeyString \ end=+"+ \ contains=autohotkeyEscape -syn region autohotkeyVariable +syn match autohotkeyVariable \ display \ oneline \ contains=autohotkeyBuiltinVariable - \ matchgroup=autohotkeyVariableDelimiter - \ start="%" - \ end="%" \ keepend + \ '%\S\{-}%' syn keyword autohotkeyBuiltinVariable \ A_Space A_Tab - \ A_WorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_LineNumber - \ A_LineFile A_AhkVersion A_AhkPAth A_IsCompiled A_ExitReason - \ A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YWeek A_Hour A_Min + \ A_WorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_ScriptHwnd A_LineNumber + \ A_LineFile A_ThisFunc A_ThisLabel A_AhkVersion A_AhkPath A_IsUnicode A_IsCompiled A_ExitReason + \ A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YDay A_YWeek A_Hour A_Min + \ A_Mon A_Year A_MDay A_NumBatchLines \ A_Sec A_MSec A_Now A_NowUTC A_TickCount - \ A_IsSuspended A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed - \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_STringCaseSense - \ A_FormatInteger A_FormatFloat A_KeyDelay A_WinDelay A_ControlDelay - \ A_MouseDelay A_DefaultMouseSpeed A_IconHidden A_IconTip A_IconFile + \ A_IsSuspended A_IsPaused A_IsCritical A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed + \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_StringCaseSense + \ A_FileEncoding A_FormatInteger A_FormatFloat A_KeyDelay A_WinDelay A_ControlDelay + \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDelayDuration + \ A_KeyDelayPlay A_KeyDelayPlayDuration A_MouseDelayPlay + \ A_MouseDelay A_DefaultMouseSpeed A_RegView A_IconHidden A_IconTip A_IconFile + \ A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu \ A_IconNumber - \ A_TimeIdle A_TimeIdlePhysical + \ A_TimeIdle A_TimeIdlePhysical A_DefaultGui A_DefaultListView A_DefaultTreeView \ A_Gui A_GuiControl A_GuiWidth A_GuiHeight A_GuiX A_GuiY A_GuiEvent \ A_GuiControlEvent A_EventInfo \ A_ThisMenuItem A_ThisMenu A_ThisMenuItemPos A_ThisHotkey A_PriorHotkey - \ A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar + \ A_PriorKey A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar \ ComSpec A_Temp A_OSType A_OSVersion A_Language A_ComputerName A_UserName + \ A_Is64BitOS A_PtrSize \ A_WinDir A_ProgramFiles ProgramFiles A_AppData A_AppDataCommon A_Desktop \ A_DesktopCommon A_StartMenu A_StartMenuCommon A_Programs \ A_ProgramsCommon A_Startup A_StartupCommon A_MyDocuments A_IsAdmin - \ A_ScreenWidth A_ScreenHeight A_IPAddress1 A_IPAddress2 A_IPAddress3 + \ A_ScreenWidth A_ScreenHeight A_ScreenDPI A_IPAddress1 A_IPAddress2 A_IPAddress3 \ A_IPAddress4 \ A_Cursor A_CaretX A_CaretY Clipboard ClipboardAll ErrorLevel A_LastError \ A_Index A_LoopFileName A_LoopRegName A_LoopReadLine A_LoopField + \ A_LoopFileExt A_LoopFileFullPath A_LoopFileLongPath A_LoopFileShortPath + \ A_LoopFileShortName A_LoopFileDir A_LoopFileTimeModified A_LoopFileTimeCreated + \ A_LoopFileTimeAccessed A_LoopFileAttrib A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB + \ A_LoopRegType A_LoopRegKey A_LoopRegSubKey A_LoopRegTimeModified syn match autohotkeyBuiltinVariable \ contained @@ -129,7 +82,7 @@ syn match autohotkeyBuiltinVariable syn keyword autohotkeyCommand \ ClipWait EnvGet EnvSet EnvUpdate \ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir - \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib + \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib FileEncoding \ FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall \ FileMove FileMoveDir FileReadLine FileRead FileRecycle FileRecycleEmpty \ FileRemoveDir FileSelectFolder FileSelectFile FileSetAttrib FileSetTime @@ -152,7 +105,8 @@ syn keyword autohotkeyCommand \ SoundSetWaveVolume \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos \ StringLeft StringRight StringLower StringUpper StringMid StringReplace - \ StringSplit StringTrimLeft StringTrimRight + \ StringSplit StringTrimLeft StringTrimRight StringLen + \ StrSplit StrReplace Throw \ Control ControlClick ControlFocus ControlGet ControlGetFocus \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw \ ControlSetText Menu PostMessage SendMessage SetControlDelay @@ -163,22 +117,30 @@ syn keyword autohotkeyCommand \ WinGetText WinGetTitle WinHide WinKill WinMaximize WinMinimize \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose + \ SetCapsLockState SetNumLockState SetScrollLockState syn keyword autohotkeyFunction - \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr + \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan - \ FileExist GetKeyState + \ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback + \ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen + \ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet + \ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject + \ Format Exception syn keyword autohotkeyStatement \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return - \ Suspend Reload + \ Suspend Reload new class extends syn keyword autohotkeyRepeat \ Loop syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else + \ IfWinExist IfWinNotExist IfWinActive IfWinNotActive + \ IfNotEqual IfLessOrEqual IfGreaterOrEqual + \ while until for in try catch finally syn match autohotkeyPreProcStart \ nextgroup= @@ -198,6 +160,7 @@ syn keyword autohotkeyPreProc \ HotkeyInterval HotKeyModifierTimeout \ Hotstring \ IfWinActive IfWinNotActive IfWinExist IfWinNotExist + \ If IfTimeout \ MaxHotkeysPerInterval MaxThreads MaxThreadsBuffer MaxThreadsPerHotkey \ UseHook InstallKeybdHook InstallMouseHook \ KeyHistory @@ -211,9 +174,13 @@ syn keyword autohotkeyPreProc \ MaxMem \ NoEnv \ Persistent + \ LTrim + \ InputLevel + \ MenuMaskKey + \ Warn syn keyword autohotkeyMatchClass - \ ahk_group ahk_class ahk_id ahk_pid + \ ahk_group ahk_class ahk_id ahk_pid ahk_exe syn match autohotkeyNumbers \ display @@ -241,11 +208,74 @@ syn match autohotkeyFloat syn keyword autohotkeyType \ local \ global + \ static + \ byref syn keyword autohotkeyBoolean \ true \ false +syn match autohotkeyHotkey + \ contains=autohotkeyKey, + \ autohotkeyHotkeyDelimiter + \ display + \ '^\s*\S*\%( Up\)\?::' + +syn match autohotkeyKey + \ contained + \ display + \ '^.\{-}' + +syn match autohotkeyDelimiter + \ contained + \ display + \ '::' + +" allowable hotstring options: +" https://autohotkey.com/docs/Hotstrings.htm +syn match autohotkeyHotstringDefinition + \ contains=autohotkeyHotstring, + \ autohotkeyHotstringDelimiter + \ display + \ '^\s*:\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:.\{-}::' + +syn match autohotkeyHotstring + \ contained + \ display + \ '.\{-}' + +syn match autohotkeyHotstringDelimiter + \ contained + \ display + \ '::' + +syn match autohotkeyHotstringDelimiter + \ contains=autohotkeyHotstringOptions + \ contained + \ display + \ ':\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:' + +syn match autohotkeyHotstringOptions + \ contained + \ display + \ '\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*' + +syn cluster autohotkeyCommentGroup + \ contains= + \ autohotkeyTodo, + \ @Spell + +syn match autohotkeyComment + \ display + \ contains=@autohotkeyCommentGroup + \ '\%(^;\|\s\+;\).*$' + +syn region autohotkeyComment + \ contains=@autohotkeyCommentGroup + \ matchgroup=autohotkeyCommentStart + \ start='^\s*/\*' + \ end='^\s*\*/' + " TODO: Shouldn't we look for g:, b:, variables before defaulting to " something? if exists("g:autohotkey_syntax_sync_minlines") diff --git a/runtime/syntax/automake.vim b/runtime/syntax/automake.vim index eea2a9f38c..2a215a9e04 100644 --- a/runtime/syntax/automake.vim +++ b/runtime/syntax/automake.vim @@ -18,18 +18,12 @@ " EXTRA_SOURCES. " Standard syntax initialization -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif " Read the Makefile syntax to start with -if version < 600 - source <sfile>:p:h/make.vim -else - runtime! syntax/make.vim -endif +runtime! syntax/make.vim syn match automakePrimary "^\w\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*\ze+\==" syn match automakePrimary "^TESTS\s*\ze+\=="me=e-1 @@ -59,34 +53,24 @@ syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIde syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution " 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_automake_syntax_inits") - if version < 508 - let did_automake_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink automakePrimary Statement - HiLink automakeSecondary Type - HiLink automakeExtra Special - HiLink automakeOptions Special - HiLink automakeClean Special - HiLink automakeSubdirs Statement - HiLink automakeConditional PreProc - HiLink automakeSubst PreProc - HiLink automakeComment1 makeComment - HiLink automakeComment2 makeComment - HiLink automakeMakeError makeError - HiLink automakeBadSubst makeError - HiLink automakeMakeDString makeDString - HiLink automakeMakeSString makeSString - HiLink automakeMakeBString makeBString +hi def link automakePrimary Statement +hi def link automakeSecondary Type +hi def link automakeExtra Special +hi def link automakeOptions Special +hi def link automakeClean Special +hi def link automakeSubdirs Statement +hi def link automakeConditional PreProc +hi def link automakeSubst PreProc +hi def link automakeComment1 makeComment +hi def link automakeComment2 makeComment +hi def link automakeMakeError makeError +hi def link automakeBadSubst makeError +hi def link automakeMakeDString makeDString +hi def link automakeMakeSString makeSString +hi def link automakeMakeBString makeBString - delcommand HiLink -endif let b:current_syntax = "automake" diff --git a/runtime/syntax/ave.vim b/runtime/syntax/ave.vim index 2a0a9d85af..e63e7d2c30 100644 --- a/runtime/syntax/ave.vim +++ b/runtime/syntax/ave.vim @@ -11,11 +11,8 @@ " I use some technologies to automatically load avenue scripts " into ArcView. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -37,7 +34,7 @@ syn match aveNumber "[+-]\=\<[0-9]\+\>" " Operator syn keyword aveOperator or and max min xor mod by -" 'not' is a kind of a problem: Its an Operator as well as a method +" 'not' is a kind of a problem: It's an Operator as well as a method " 'not' is only marked as an Operator if not applied as method syn match aveOperator "[^\.]not[^a-zA-Z]" @@ -59,34 +56,24 @@ syn match aveTypos "==" syn match aveTypos "!=" " 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_ave_syn_inits") - if version < 508 - let did_ave_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting+yet - HiLink aveStatement Statement +hi def link aveStatement Statement - HiLink aveString String - HiLink aveNumber Number +hi def link aveString String +hi def link aveNumber Number - HiLink aveFixVariables Special - HiLink aveVariables Identifier - HiLink globalVariables Special - HiLink aveConst Special +hi def link aveFixVariables Special +hi def link aveVariables Identifier +hi def link globalVariables Special +hi def link aveConst Special - HiLink aveClassMethods Function +hi def link aveClassMethods Function - HiLink aveOperator Operator - HiLink aveComment Comment +hi def link aveOperator Operator +hi def link aveComment Comment - HiLink aveTypos Error +hi def link aveTypos Error - delcommand HiLink -endif let b:current_syntax = "ave" diff --git a/runtime/syntax/avra.vim b/runtime/syntax/avra.vim new file mode 100644 index 0000000000..0e02bd8397 --- /dev/null +++ b/runtime/syntax/avra.vim @@ -0,0 +1,71 @@ +" Vim syntax file +" Language: AVR Assembler (AVRA) +" AVRA Home: http://avra.sourceforge.net/index.html +" AVRA Version: 1.3.0 +" Last Update: 2016 Oct 7 +" Maintainer: Marius Ghita <mhitza@gmail.com> + +let s:cpo_save = &cpo +set cpo&vim + +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 diff --git a/runtime/syntax/awk.vim b/runtime/syntax/awk.vim index f80a582226..7c0682ce9f 100644 --- a/runtime/syntax/awk.vim +++ b/runtime/syntax/awk.vim @@ -1,13 +1,15 @@ " Vim syntax file " Language: awk, nawk, gawk, mawk " Maintainer: Antonio Colombo <azc100@gmail.com> -" Last Change: 2012 May 18 +" Last Change: 2016 Sep 05 -" 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 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) @@ -17,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 @@ -33,46 +32,61 @@ set cpo&vim syn keyword awkStatement break continue delete exit syn keyword awkStatement function getline next syn keyword awkStatement print printf return -" GAWK ref. p. 117 -syn keyword awkStatement nextfile -" AWK ref. p. 42, GAWK ref. p. 142-166 -syn keyword awkFunction atan2 close cos exp fflush int log rand sin sqrt srand -syn keyword awkFunction gsub index length match split sprintf sub -syn keyword awkFunction substr system -" GAWK ref. p. 142-166 -syn keyword awkFunction asort gensub mktime strftime strtonum systime +" 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 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 syn keyword awkFunction tolower toupper -syn keyword awkFunction and or xor compl lshift rshift -syn keyword awkFunction dcgettext bindtextdomain +" Input Output Functions +syn keyword awkFunction close fflush system +" Time Functions +syn keyword awkFunction mktime strftime systime +" Bit Manipulation Functions +syn keyword awkFunction and compl lshift or rshift xor +" 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 -" AWK ref. p. 36 -syn keyword awkVariables ARGC ARGV FILENAME FNR FS NF NR -syn keyword awkVariables OFMT OFS ORS RLENGTH RS RSTART SUBSEP -" GAWK ref. p. 120-126 -syn keyword awkVariables ARGIND BINMODE CONVFMT ENVIRON ERRNO -syn keyword awkVariables FIELDWIDTHS IGNORECASE LINT PROCINFO -syn keyword awkVariables RT RLENGTH TEXTDOMAIN +syn keyword awkPatterns BEGIN END BEGINFILE ENDFILE -syn keyword awkRepeat do +" GAWK ref. Chapter 7 +" Built-in Variables That Control awk +syn keyword awkVariables BINMODE CONVFMT FIELDWIDTHS FPAT FS +syn keyword awkVariables IGNORECASE LINT OFMT OFS ORS PREC +syn keyword awkVariables ROUNDMODE RS SUBSEP TEXTDOMAIN +" Built-in Variables That Convey Information +syn keyword awkVariables ARGC ARGV ARGIND ENVIRON ERRNO FILENAME +syn keyword awkVariables FNR NF FUNCTAB NR PROCINFO RLENGTH RSTART +syn keyword awkVariables RT SYMTAB + +" Arithmetic operators: +, and - take care of ++, and -- +syn match awkOperator "+\|-\|\*\|/\|%\|=" +syn match awkOperator "+=\|-=\|\*=\|/=\|%=" +syn match awkOperator "\^\|\^=" " 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 @@ -114,19 +128,14 @@ syn case match "syn match awkIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" -" Arithmetic operators: +, and - take care of ++, and -- -"syn match awkOperator "+\|-\|\*\|/\|%\|=" -"syn match awkOperator "+=\|-=\|\*=\|/=\|%=" -"syn match awkOperator "^\|^=" - " Comparison expressions. -"syn match awkExpression "==\|>=\|=>\|<=\|=<\|\!=" -"syn match awkExpression "\~\|\!\~" -"syn match awkExpression "?\|:" -"syn keyword awkExpression in +syn match awkExpression "==\|>=\|=>\|<=\|=<\|\!=" +syn match awkExpression "\~\|\!\~" +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. @@ -156,63 +165,41 @@ 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. +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" diff --git a/runtime/syntax/ayacc.vim b/runtime/syntax/ayacc.vim index fedd0e80a0..6fb6aec85d 100644 --- a/runtime/syntax/ayacc.vim +++ b/runtime/syntax/ayacc.vim @@ -6,21 +6,14 @@ " Comment: Replaced sourcing c.vim file by ada.vim and rename yacc* " in ayacc* -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the Ada syntax to start with -if version < 600 - so <sfile>:p:h/ada.vim -else - runtime! syntax/ada.vim - unlet b:current_syntax -endif +runtime! syntax/ada.vim +unlet b:current_syntax let s:cpo_save = &cpo set cpo&vim @@ -54,35 +47,26 @@ syn match ayaccSep "^[ \t]*%}" syn match ayaccCurlyError "[{}]" syn region ayaccAction matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup -if version >= 508 || !exists("did_ayacc_syntax_inits") - if version < 508 - let did_ayacc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " Internal ayacc highlighting links - HiLink ayaccBrkt ayaccStmt - HiLink ayaccKey ayaccStmt - HiLink ayaccOper ayaccStmt - HiLink ayaccUnionStart ayaccKey +" Internal ayacc highlighting links +hi def link ayaccBrkt ayaccStmt +hi def link ayaccKey ayaccStmt +hi def link ayaccOper ayaccStmt +hi def link ayaccUnionStart ayaccKey - " External ayacc highlighting links - HiLink ayaccCurly Delimiter - HiLink ayaccCurlyError Error - HiLink ayaccDefinition Function - HiLink ayaccDelim Function - HiLink ayaccKeyActn Special - HiLink ayaccSectionSep Todo - HiLink ayaccSep Delimiter - HiLink ayaccStmt Statement - HiLink ayaccType Type +" External ayacc highlighting links +hi def link ayaccCurly Delimiter +hi def link ayaccCurlyError Error +hi def link ayaccDefinition Function +hi def link ayaccDelim Function +hi def link ayaccKeyActn Special +hi def link ayaccSectionSep Todo +hi def link ayaccSep Delimiter +hi def link ayaccStmt Statement +hi def link ayaccType Type - " since Bram doesn't like my Delimiter :| - HiLink Delimiter Type - delcommand HiLink -endif +" since Bram doesn't like my Delimiter :| +hi def link Delimiter Type let b:current_syntax = "ayacc" diff --git a/runtime/syntax/b.vim b/runtime/syntax/b.vim index b470ab9ef3..01532be75d 100644 --- a/runtime/syntax/b.vim +++ b/runtime/syntax/b.vim @@ -5,11 +5,8 @@ " LastChange: 8 Dec 2007 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -69,58 +66,48 @@ syn region bPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error syn sync ccomment bComment minlines=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_b_syntax_inits") - if version < 508 - let did_b_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink bLabel Label - HiLink bUserLabel Label - HiLink bConditional Conditional - HiLink bRepeat Repeat - HiLink bLogic Special - HiLink bCharacter Character - HiLink bSpecialCharacter bSpecial - HiLink bNumber Number - HiLink bFloat Float - HiLink bOctalError bError - HiLink bParenError bError -" HiLink bInParen bError - HiLink bCommentError bError - HiLink bBoolean Identifier - HiLink bConstant Identifier - HiLink bGuard Identifier - HiLink bOperator Operator - HiLink bKeywords Operator - HiLink bOps Identifier - HiLink bStructure Structure - HiLink bStorageClass StorageClass - HiLink bInclude Include - HiLink bPreProc PreProc - HiLink bDefine Macro - HiLink bIncluded bString - HiLink bError Error - HiLink bStatement Statement - HiLink bPreCondit PreCondit - HiLink bType Type - HiLink bCommentError bError - HiLink bCommentString bString - HiLink bComment2String bString - HiLink bCommentSkip bComment - HiLink bString String - HiLink bComment Comment - HiLink bSpecial SpecialChar - HiLink bTodo Todo - "hi link bIdentifier Identifier - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + + +" The default methods for highlighting. Can be overridden later +hi def link bLabel Label +hi def link bUserLabel Label +hi def link bConditional Conditional +hi def link bRepeat Repeat +hi def link bLogic Special +hi def link bCharacter Character +hi def link bSpecialCharacter bSpecial +hi def link bNumber Number +hi def link bFloat Float +hi def link bOctalError bError +hi def link bParenError bError +" hi def link bInParen bError +hi def link bCommentError bError +hi def link bBoolean Identifier +hi def link bConstant Identifier +hi def link bGuard Identifier +hi def link bOperator Operator +hi def link bKeywords Operator +hi def link bOps Identifier +hi def link bStructure Structure +hi def link bStorageClass StorageClass +hi def link bInclude Include +hi def link bPreProc PreProc +hi def link bDefine Macro +hi def link bIncluded bString +hi def link bError Error +hi def link bStatement Statement +hi def link bPreCondit PreCondit +hi def link bType Type +hi def link bCommentError bError +hi def link bCommentString bString +hi def link bComment2String bString +hi def link bCommentSkip bComment +hi def link bString String +hi def link bComment Comment +hi def link bSpecial SpecialChar +hi def link bTodo Todo +"hi link bIdentifier Identifier let b:current_syntax = "b" diff --git a/runtime/syntax/baan.vim b/runtime/syntax/baan.vim index 5009218b60..9a42a43918 100644 --- a/runtime/syntax/baan.vim +++ b/runtime/syntax/baan.vim @@ -4,15 +4,8 @@ " Originally owned by: Erwin Smit / Her van de Vliert " Last change: v1.17 2006/04/26 10:40:18 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -" -if version < 600 - syntax clear - if exists("baan_fold") - unlet baan_fold - endif -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -1894,40 +1887,30 @@ syn keyword baanBshell bclm.productidlicensed syn keyword baanBshell bclm.set.desktop " 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_baan_syn_inits") - if version < 508 - let did_baan_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink baanConditional Conditional - HiLink baan3gl Statement - HiLink baan3glpre PreProc - HiLink baan4gl Statement - HiLink baan4glh Statement - HiLink baansql Statement - HiLink baansqlh Statement - HiLink baanDalHook Statement - HiLink baanNumber Number - HiLink baanString String - HiLink baanOpenStringError Error - HiLink baanConstant Constant - HiLink baanComment Comment - HiLink baanCommenth Comment - HiLink baanUncommented Comment - HiLink baanDLLUsage Comment - HiLink baanFunUsage Comment - HiLink baanIdentifier Normal - HiLink baanBshell Function - HiLink baanType Type - HiLink baanStorageClass StorageClass +hi def link baanConditional Conditional +hi def link baan3gl Statement +hi def link baan3glpre PreProc +hi def link baan4gl Statement +hi def link baan4glh Statement +hi def link baansql Statement +hi def link baansqlh Statement +hi def link baanDalHook Statement +hi def link baanNumber Number +hi def link baanString String +hi def link baanOpenStringError Error +hi def link baanConstant Constant +hi def link baanComment Comment +hi def link baanCommenth Comment +hi def link baanUncommented Comment +hi def link baanDLLUsage Comment +hi def link baanFunUsage Comment +hi def link baanIdentifier Normal +hi def link baanBshell Function +hi def link baanType Type +hi def link baanStorageClass StorageClass - delcommand HiLink -endif let b:current_syntax = "baan" diff --git a/runtime/syntax/basic.vim b/runtime/syntax/basic.vim index c72032da27..488ddc0ec4 100644 --- a/runtime/syntax/basic.vim +++ b/runtime/syntax/basic.vim @@ -8,11 +8,8 @@ " This syntax file not a complete implementation yet. Send suggestions to the " maintainer. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -143,34 +140,24 @@ syn match basicFilenumber "#\d\+" syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR" " 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_basic_syntax_inits") - if version < 508 - let did_basic_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink basicLabel Label - HiLink basicConditional Conditional - HiLink basicRepeat Repeat - HiLink basicLineNumber Comment - HiLink basicNumber Number - HiLink basicError Error - HiLink basicStatement Statement - HiLink basicString String - HiLink basicComment Comment - HiLink basicSpecial Special - HiLink basicTodo Todo - HiLink basicFunction Identifier - HiLink basicTypeSpecifier Type - HiLink basicFilenumber basicTypeSpecifier - "hi basicMathsOperator term=bold cterm=bold gui=bold +hi def link basicLabel Label +hi def link basicConditional Conditional +hi def link basicRepeat Repeat +hi def link basicLineNumber Comment +hi def link basicNumber Number +hi def link basicError Error +hi def link basicStatement Statement +hi def link basicString String +hi def link basicComment Comment +hi def link basicSpecial Special +hi def link basicTodo Todo +hi def link basicFunction Identifier +hi def link basicTypeSpecifier Type +hi def link basicFilenumber basicTypeSpecifier +"hi basicMathsOperator term=bold cterm=bold gui=bold - delcommand HiLink -endif let b:current_syntax = "basic" diff --git a/runtime/syntax/bc.vim b/runtime/syntax/bc.vim index 965afc35b1..4cd9d6388a 100644 --- a/runtime/syntax/bc.vim +++ b/runtime/syntax/bc.vim @@ -5,11 +5,8 @@ " (Dominique Pelle added @Spell) " Available on: www.gjh.sk/~vlado/bc.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -53,27 +50,17 @@ syn match bcParenError ")" syn case match " 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_bc_syntax_inits") - if version < 508 - let did_bc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink bcKeyword Statement - HiLink bcType Type - HiLink bcConstant Constant - HiLink bcNumber Number - HiLink bcComment Comment - HiLink bcString String - HiLink bcSpecialChar SpecialChar - HiLink bcParenError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link bcKeyword Statement +hi def link bcType Type +hi def link bcConstant Constant +hi def link bcNumber Number +hi def link bcComment Comment +hi def link bcString String +hi def link bcSpecialChar SpecialChar +hi def link bcParenError Error + let b:current_syntax = "bc" " vim: ts=8 diff --git a/runtime/syntax/bdf.vim b/runtime/syntax/bdf.vim index d0c73eb601..cc1a337569 100644 --- a/runtime/syntax/bdf.vim +++ b/runtime/syntax/bdf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: BDF font definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: BDF font definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/bib.vim b/runtime/syntax/bib.vim index f84d5ca95a..ac8dcda678 100644 --- a/runtime/syntax/bib.vim +++ b/runtime/syntax/bib.vim @@ -2,17 +2,14 @@ " Language: BibTeX (bibliographic database format for (La)TeX) " Maintainer: Bernd Feige <Bernd.Feige@gmx.net> " Filenames: *.bib -" Last Change: 2014 Mar 26 +" Last Change: 2017 Sep 29 " Thanks to those who pointed out problems with this file or supplied fixes! " Initialization " ============== -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -35,14 +32,46 @@ syn keyword bibEntryKw contained crossref edition editor howpublished syn keyword bibEntryKw contained institution journal key month note syn keyword bibEntryKw contained number organization pages publisher syn keyword bibEntryKw contained school series title type volume year + +" biblatex keywords, cf. http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf +syn keyword bibType contained mvbook bookinbook suppbook collection mvcollection suppcollection +syn keyword bibType contained online patent periodical suppperiodical mvproceedings reference +syn keyword bibType contained mvreference inreference report set thesis xdata customa customb +syn keyword bibType contained customc customd custome customf electronic www artwork audio bibnote +syn keyword bibType contained commentary image jurisdiction legislation legal letter movie music +syn keyword bibType contained performance review software standard video + +syn keyword bibEntryKw contained abstract isbn issn keywords url +syn keyword bibEntryKw contained addendum afterwordannotation annotation annotator authortype +syn keyword bibEntryKw contained bookauthor bookpagination booksubtitle booktitleaddon +syn keyword bibEntryKw contained commentator date doi editora editorb editorc editortype +syn keyword bibEntryKw contained editoratype editorbtype editorctype eid entrysubtype +syn keyword bibEntryKw contained eprint eprintclass eprinttype eventdate eventtitle +syn keyword bibEntryKw contained eventtitleaddon file foreword holder indextitle +syn keyword bibEntryKw contained introduction isan ismn isrn issue issuesubtitle +syn keyword bibEntryKw contained issuetitle iswc journalsubtitle journaltitle label +syn keyword bibEntryKw contained language library location mainsubtitle maintitle +syn keyword bibEntryKw contained maintitleaddon nameaddon origdate origlanguage +syn keyword bibEntryKw contained origlocation origpublisher origtitle pagetotal +syn keyword bibEntryKw contained pagination part pubstate reprinttitle shortauthor +syn keyword bibEntryKw contained shorteditor shorthand shorthandintro shortjournal +syn keyword bibEntryKw contained shortseries shorttitle subtitle titleaddon translator +syn keyword bibEntryKw contained urldate venue version volumes entryset execute gender +syn keyword bibEntryKw contained langid langidopts ids indexsorttitle options presort +syn keyword bibEntryKw contained related relatedoptions relatedtype relatedstring +syn keyword bibEntryKw contained sortkey sortname sortshorthand sorttitle sortyear xdata +syn keyword bibEntryKw contained xref namea nameb namec nameatype namebtype namectype +syn keyword bibEntryKw contained lista listb listc listd liste listf usera userb userc +syn keyword bibEntryKw contained userd usere userf verba verbb verbc archiveprefix pdf +syn keyword bibEntryKw contained primaryclass + " Non-standard: -syn keyword bibNSEntryKw contained abstract isbn issn keywords url " AMS mref http://www.ams.org/mref syn keyword bibNSEntryKw contained mrclass mrnumber mrreviewer fjournal coden " Clusters " ======== -syn cluster bibVarContents contains=bibUnescapedSpecial,bibBrace,bibParen +syn cluster bibVarContents contains=bibUnescapedSpecial,bibBrace,bibParen,bibMath " This cluster is empty but things can be added externally: "syn cluster bibCommentContents @@ -52,19 +81,18 @@ syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1 syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField syn match bibVariable contained /[^{}," \t=]/ syn region bibComment start=/./ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry +syn region bibMath contained start=/\(\\\)\@<!\$/ end=/\$/ skip=/\(\\\$\)/ syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents syn region bibField contained start="\S\+\s*=\s*" end=/[}),]/me=e-1 contains=bibEntryKw,bibNSEntryKw,bibBrace,bibParen,bibQuote,bibVariable -syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField +syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField,bibComment3 " Actually, 5.8 <= Vim < 6.0 would ignore the `fold' keyword anyway, but Vim<5.8 would produce " an error, so we explicitly distinguish versions with and without folding functionality: -if version < 600 - syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent contains=bibType,bibEntryData nextgroup=bibComment -else - syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment -endif +syn region bibEntry start=/@\S\+\s*[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment syn region bibComment2 start=/@Comment\s*[{(]/ end=/^\s*[})]/me=e-1 contains=@bibCommentContents nextgroup=bibEntry +" biblatex style comments inside a bibEntry +syn match bibComment3 "%.*" " Synchronization " =============== @@ -75,25 +103,17 @@ syn sync minlines=50 " Highlighting defaults " ===================== " 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_bib_syn_inits") - if version < 508 - let did_bib_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink bibType Identifier - HiLink bibEntryKw Statement - HiLink bibNSEntryKw PreProc - HiLink bibKey Special - HiLink bibVariable Constant - HiLink bibUnescapedSpecial Error - HiLink bibComment Comment - HiLink bibComment2 Comment - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link bibType Identifier +hi def link bibEntryKw Statement +hi def link bibNSEntryKw PreProc +hi def link bibKey Special +hi def link bibVariable Constant +hi def link bibUnescapedSpecial Error +hi def link bibComment Comment +hi def link bibComment2 Comment +hi def link bibComment3 Comment let b:current_syntax = "bib" diff --git a/runtime/syntax/bindzone.vim b/runtime/syntax/bindzone.vim index d599a85db2..df3c789d98 100644 --- a/runtime/syntax/bindzone.vim +++ b/runtime/syntax/bindzone.vim @@ -9,11 +9,8 @@ " " $Id: bindzone.vim 12 2011-07-16 21:09:57Z julian $ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -70,40 +67,30 @@ syn region zoneParen contained start="(" end=")" contains=zoneSerial, syn match zoneComment /;.*/ " 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_bind_zone_syn_inits") - if version < 508 - let did_bind_zone_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink zoneDirective Macro - - HiLink zoneUnknown Error - - HiLink zoneOrigin Statement - HiLink zoneOwnerName Statement - HiLink zoneDomain Identifier - - HiLink zoneSpecial Special - HiLink zoneTTL Constant - HiLink zoneClass Include - HiLink zoneRRType Type - - HiLink zoneIPAddr Number - HiLink zoneIP6Addr Number - HiLink zoneText String - HiLink zoneNumber Number - HiLink zoneSerial Special - - HiLink zoneErrParen Error - HiLink zoneComment Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link zoneDirective Macro + +hi def link zoneUnknown Error + +hi def link zoneOrigin Statement +hi def link zoneOwnerName Statement +hi def link zoneDomain Identifier + +hi def link zoneSpecial Special +hi def link zoneTTL Constant +hi def link zoneClass Include +hi def link zoneRRType Type + +hi def link zoneIPAddr Number +hi def link zoneIP6Addr Number +hi def link zoneText String +hi def link zoneNumber Number +hi def link zoneSerial Special + +hi def link zoneErrParen Error +hi def link zoneComment Comment + let b:current_syntax = "bindzone" diff --git a/runtime/syntax/blank.vim b/runtime/syntax/blank.vim index 60251c966c..6d2e3fd7bd 100644 --- a/runtime/syntax/blank.vim +++ b/runtime/syntax/blank.vim @@ -3,11 +3,8 @@ " Maintainer: Rafal M. Sulejman <unefunge@friko2.onet.pl> " Last change: 2011 Dec 28 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -28,22 +25,12 @@ syn match blankNumber "\[[0-9]\+\]" syn case match " 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_blank_syntax_inits") - if version < 508 - let did_blank_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink blankInstruction Statement - HiLink blankNumber Number - HiLink blankString String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link blankInstruction Statement +hi def link blankNumber Number +hi def link blankString String + let b:current_syntax = "blank" diff --git a/runtime/syntax/bst.vim b/runtime/syntax/bst.vim index e7836d7811..5ebef16460 100644 --- a/runtime/syntax/bst.vim +++ b/runtime/syntax/bst.vim @@ -4,21 +4,12 @@ " Filenames: *.bst " $Id: bst.vim,v 1.2 2007/05/05 18:24:42 vimboss Exp $ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version < 600 - command -nargs=1 SetIsk set iskeyword=<args> -else - command -nargs=1 SetIsk setlocal iskeyword=<args> -endif -SetIsk 48-57,#,$,',.,A-Z,a-z -delcommand SetIsk +setlocal iskeyword=48-57,#,$,',.,A-Z,a-z syn case ignore @@ -62,27 +53,17 @@ syn keyword bstField title type syn keyword bstField volume year " 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_bst_syn_inits") - if version < 508 - let did_bst_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink bstComment Comment - HiLink bstString String - HiLink bstCommand PreProc - HiLink bstBuiltIn Statement - HiLink bstField Special - HiLink bstNumber Number - HiLink bstType Type - HiLink bstIdentifier Identifier - HiLink bstError Error - delcommand HiLink -endif +hi def link bstComment Comment +hi def link bstString String +hi def link bstCommand PreProc +hi def link bstBuiltIn Statement +hi def link bstField Special +hi def link bstNumber Number +hi def link bstType Type +hi def link bstIdentifier Identifier +hi def link bstError Error let b:current_syntax = "bst" diff --git a/runtime/syntax/btm.vim b/runtime/syntax/btm.vim index 4fd5b2db99..4f9253ff9f 100644 --- a/runtime/syntax/btm.vim +++ b/runtime/syntax/btm.vim @@ -11,11 +11,8 @@ "//- After unary operators like "defined" can assume token type. "// Should there be more of these? -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -184,45 +181,35 @@ syn keyword btmCommand unlock unset ver verify vol syn keyword btmCommand vscrput y " 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_btm_syntax_inits") - if version < 508 - let did_btm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink btmLabel Special - HiLink btmLabelMark Special - HiLink btmCmdDivider Special - HiLink btmConditional btmStatement - HiLink btmDotBoolOp btmStatement - HiLink btmRepeat btmStatement - HiLink btmEchoCommand btmStatement - HiLink btmEchoParam btmStatement - HiLink btmStatement Statement - HiLink btmTodo Todo - HiLink btmString String - HiLink btmNumber Number - HiLink btmComment Comment - HiLink btmArgument Identifier - HiLink btmVariable Identifier - HiLink btmEcho String - HiLink btmBIFMatch btmStatement - HiLink btmBuiltInFunc btmStatement - HiLink btmBuiltInVar btmStatement - HiLink btmSpecialVar btmStatement - HiLink btmCommand btmStatement - - "optional highlighting - "HiLink btmShowTab Error - "HiLink btmShowTabc Error - "hiLink btmIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link btmLabel Special +hi def link btmLabelMark Special +hi def link btmCmdDivider Special +hi def link btmConditional btmStatement +hi def link btmDotBoolOp btmStatement +hi def link btmRepeat btmStatement +hi def link btmEchoCommand btmStatement +hi def link btmEchoParam btmStatement +hi def link btmStatement Statement +hi def link btmTodo Todo +hi def link btmString String +hi def link btmNumber Number +hi def link btmComment Comment +hi def link btmArgument Identifier +hi def link btmVariable Identifier +hi def link btmEcho String +hi def link btmBIFMatch btmStatement +hi def link btmBuiltInFunc btmStatement +hi def link btmBuiltInVar btmStatement +hi def link btmSpecialVar btmStatement +hi def link btmCommand btmStatement + +"optional highlighting +"hi def link btmShowTab Error +"hi def link btmShowTabc Error +"hi def link btmIdentifier Identifier + let b:current_syntax = "btm" diff --git a/runtime/syntax/bzl.vim b/runtime/syntax/bzl.vim new file mode 100644 index 0000000000..b0ee9454ff --- /dev/null +++ b/runtime/syntax/bzl.vim @@ -0,0 +1,16 @@ +" Vim syntax file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +if exists('b:current_syntax') + finish +endif + + +runtime! syntax/python.vim + +let b:current_syntax = 'bzl' + +syn region bzlRule start='^\w\+($' end='^)\n*' transparent fold +syn region bzlList start='\[' end='\]' transparent fold diff --git a/runtime/syntax/bzr.vim b/runtime/syntax/bzr.vim index ef5445bf45..43178b8a1a 100644 --- a/runtime/syntax/bzr.vim +++ b/runtime/syntax/bzr.vim @@ -11,11 +11,8 @@ " Gioele Barabucci " for idea of diff highlighting -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif @@ -40,24 +37,14 @@ syn sync clear syn sync match bzrSync grouphere bzrRegion "^-\{14} This line and the following will be ignored -\{14}$"me=s-1 " 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_bzr_syn_inits") - if version <= 508 - let did_bzr_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink bzrRemoved Constant - HiLink bzrAdded Identifier - HiLink bzrModified Special - HiLink bzrRenamed Special - HiLink bzrUnchanged Special - HiLink bzrUnknown Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet. + +hi def link bzrRemoved Constant +hi def link bzrAdded Identifier +hi def link bzrModified Special +hi def link bzrRenamed Special +hi def link bzrUnchanged Special +hi def link bzrUnknown Special + let b:current_syntax = "bzr" diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index d991540488..72e71755c3 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 May 26 +" Last Change: 2016 Nov 18 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -13,6 +13,14 @@ set cpo&vim let s:ft = matchstr(&ft, '^\([^.]\)\+') +" Optional embedded Autodoc parsing +" To enable it add: let g:c_autodoc = 1 +" to your .vimrc +if exists("c_autodoc") + syn include @cAutodoc <sfile>:p:h/autodoc.vim + unlet b:current_syntax +endif + " A bunch of useful C keywords syn keyword cStatement goto break return continue asm syn keyword cLabel case default @@ -35,28 +43,37 @@ syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" if !exists("c_no_utf") syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" endif -if exists("c_no_cformat") - syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend - " cCppString: same as cString, but ends at end of line - if !exists("cpp_no_cpp11") " ISO C++11 - syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - else - syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - endif - syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip - syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip -else + +if !exists("c_no_cformat") + " Highlight % items in strings. if !exists("c_no_c99") " ISO C99 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained else syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained endif syn match cFormat display "%%" contained +endif + +" cCppString: same as cString, but ends at end of line +if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat") + " ISO C++11 + syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat") + " ISO C99 + syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +else + " older C or C++ + syn match cFormat display "%%" contained syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend - " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif +syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip + +syn cluster cStringGroup contains=cCppString,cCppSkip + syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial if exists("c_gnu") @@ -70,7 +87,8 @@ syn match cSpecialCharacter display "L\='\\\o\{1,3}'" syn match cSpecialCharacter display "'\\x\x\{1,2}'" syn match cSpecialCharacter display "L'\\x\x\+'" -if !exists("c_no_c11") " ISO C11 +if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) + " ISO C11 or ISO C++ 11 if exists("c_no_cformat") syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend else @@ -102,24 +120,24 @@ endif " This should be before cErrInParen to avoid problems with #define ({ xxx }) if exists("c_curly_error") syn match cCurlyError "}" - syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold + syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold else syn region cBlock start="{" end="}" transparent fold endif -"catch errors caused by wrong parenthesis and brackets -" also accept <% for {, %> for }, <: for [ and :> for ] (C99) +" Catch errors caused by wrong parenthesis and brackets. +" Also accept <% for {, %> for }, <: for [ and :> for ] (C99) " But avoid matching <::. syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom if exists("c_no_curly_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "^^<%\|^%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -127,13 +145,13 @@ if exists("c_no_curly_error") endif elseif exists("c_no_bracket_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "<%\|%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -141,19 +159,19 @@ elseif exists("c_no_bracket_error") endif else if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "[\]{}]\|<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell endif " cCppBracket: same as cParen but ends at end-of-line; used in cDefine syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell @@ -238,6 +256,10 @@ if !exists("c_no_c99") " ISO C99 syn keyword cType _Bool bool _Complex complex _Imaginary imaginary syn keyword cType int8_t int16_t int32_t int64_t syn keyword cType uint8_t uint16_t uint32_t uint64_t + if !exists("c_no_bsd") + " These are BSD specific. + syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t + endif syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t @@ -254,7 +276,7 @@ syn keyword cStorageClass static register auto volatile extern const if exists("c_gnu") syn keyword cStorageClass inline __attribute__ endif -if !exists("c_no_c99") +if !exists("c_no_c99") && s:ft !=# 'cpp' syn keyword cStorageClass inline restrict endif if !exists("c_no_c11") @@ -281,7 +303,7 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX if !exists("c_no_c99") - syn keyword cConstant __func__ + syn keyword cConstant __func__ __VA_ARGS__ syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX @@ -325,6 +347,8 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") " POSIX 2001 syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ + " non-POSIX signals + syn keyword cConstant SIGWINCH SIGINFO " Add POSIX errors as well syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT @@ -342,11 +366,11 @@ if !exists("c_no_c99") " ISO C99 endif " Accept %: for # (C99) -syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError -syn match cPreConditMatch display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" +syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError +syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>" if !exists("c_no_if0") syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip - syn region cCppOutWrapper start="^\s*\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold + syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse if !exists("c_no_if0_fold") syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold @@ -354,7 +378,7 @@ if !exists("c_no_if0") syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell endif syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit - syn region cCppInWrapper start="^\s*\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold + syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit if !exists("c_no_if0_fold") syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold @@ -367,29 +391,41 @@ if !exists("c_no_if0") endif syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ syn match cIncluded display contained "<[^>]*>" -syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded +syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded "syn match cLineSkip "\\$" syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock -syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell -syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell +syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell +syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell + +" Optional embedded Autodoc parsing +if exists("c_autodoc") + syn match cAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cAutodoc containedin=cComment,cCommentL + syn cluster cCommentGroup add=cAutodocReal + syn cluster cPreProcGroup add=cAutodocReal +endif " Highlight User Labels syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString if s:ft ==# 'c' || exists("cpp_no_cpp11") - syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell + syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup endif " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' syn cluster cLabelGroup contains=cUserLabel -syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup -syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup -syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup -syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +syn match cUserCont display "^\s*\zs\I\i*\s*:$" contains=@cLabelGroup +syn match cUserCont display ";\s*\zs\I\i*\s*:$" contains=@cLabelGroup +if s:ft ==# 'cpp' + syn match cUserCont display "^\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup + syn match cUserCont display ";\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +else + syn match cUserCont display "^\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup + syn match cUserCont display ";\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +endif syn match cUserLabel display "\I\i*" contained " Avoid recognizing most bitfields as labels -syn match cBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType -syn match cBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType +syn match cBitField display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType +syn match cBitField display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType if exists("c_minlines") let b:c_minlines = c_minlines @@ -456,8 +492,7 @@ hi def link cTodo Todo hi def link cBadContinuation Error hi def link cCppOutSkip cCppOutIf2 hi def link cCppInElse2 cCppOutIf2 -hi def link cCppOutIf2 cCppOut2 " Old syntax group for #if 0 body -hi def link cCppOut2 cCppOut " Old syntax group for #if of #if 0 +hi def link cCppOutIf2 cCppOut hi def link cCppOut Comment let b:current_syntax = "c" diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim index 4130bac894..8af47d4042 100644 --- a/runtime/syntax/cabal.vim +++ b/runtime/syntax/cabal.vim @@ -1,8 +1,22 @@ " Vim syntax file -" Language: Haskell Cabal Build file -" Maintainer: Vincent Berthoux <twinside@gmail.com> -" File Types: .cabal -" Last Change: 2010 May 18 +" Language: Haskell Cabal Build file +" Author: Vincent Berthoux <twinside@gmail.com> +" Maintainer: Marcin Szamotulski <profunctor@pm.me> +" Previous Maintainer: Vincent Berthoux <twinside@gmail.com> +" File Types: .cabal +" Last Change: 15 May 2018 +" v1.5: Incorporated changes from +" https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim +" Use `syn keyword` instead of `syn match`. +" Added cabalStatementRegion to limit matches of keywords, which fixes +" the highlighting of description's value. +" Added cabalVersionRegion to limit the scope of cabalVersionOperator +" and cabalVersion matches. +" Added cabalLanguage keyword. +" Added calbalTitle, cabalAuthor and cabalMaintainer syntax groups. +" Added ! and ^>= operators (calbal 2.0) +" Added build-type keywords +" v1.4: Add benchmark support, thanks to Simon Meier " v1.3: Updated to the last version of cabal " Added more highlighting for cabal function, true/false " and version number. Also added missing comment highlighting. @@ -18,115 +32,210 @@ " v1.0: Cabal syntax in vimball format " (thanks to Magnus Therning) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -syn keyword cabalCategory Library library Executable executable Flag flag -syn keyword cabalCategory source-repository Source-Repository - -syn keyword cabalConditional if else -syn match cabalOperator "&&\|||\|!\|==\|>=\|<=" -syn keyword cabalFunction os arche impl flag -syn match cabalComment /--.*$/ -syn match cabalVersion "\d\+\(.\(\d\)\+\)\+" - -syn match cabalTruth "\ctrue" -syn match cabalTruth "\cfalse" - -syn match cabalCompiler "\cghc" -syn match cabalCompiler "\cnhc" -syn match cabalCompiler "\cyhc" -syn match cabalCompiler "\chugs" -syn match cabalCompiler "\chbc" -syn match cabalCompiler "\chelium" -syn match cabalCompiler "\cjhc" -syn match cabalCompiler "\clhc" - - -syn match cabalStatement "\cauthor" -syn match cabalStatement "\cbranch" -syn match cabalStatement "\cbug-reports" -syn match cabalStatement "\cbuild-depends" -syn match cabalStatement "\cbuild-tools" -syn match cabalStatement "\cbuild-type" -syn match cabalStatement "\cbuildable" -syn match cabalStatement "\cc-sources" -syn match cabalStatement "\ccabal-version" -syn match cabalStatement "\ccategory" -syn match cabalStatement "\ccc-options" -syn match cabalStatement "\ccopyright" -syn match cabalStatement "\ccpp-options" -syn match cabalStatement "\cdata-dir" -syn match cabalStatement "\cdata-files" -syn match cabalStatement "\cdefault" -syn match cabalStatement "\cdescription" -syn match cabalStatement "\cexecutable" -syn match cabalStatement "\cexposed-modules" -syn match cabalStatement "\cexposed" -syn match cabalStatement "\cextensions" -syn match cabalStatement "\cextra-lib-dirs" -syn match cabalStatement "\cextra-libraries" -syn match cabalStatement "\cextra-source-files" -syn match cabalStatement "\cextra-tmp-files" -syn match cabalStatement "\cfor example" -syn match cabalStatement "\cframeworks" -syn match cabalStatement "\cghc-options" -syn match cabalStatement "\cghc-prof-options" -syn match cabalStatement "\cghc-shared-options" -syn match cabalStatement "\chomepage" -syn match cabalStatement "\chs-source-dirs" -syn match cabalStatement "\chugs-options" -syn match cabalStatement "\cinclude-dirs" -syn match cabalStatement "\cincludes" -syn match cabalStatement "\cinstall-includes" -syn match cabalStatement "\cld-options" -syn match cabalStatement "\clicense-file" -syn match cabalStatement "\clicense" -syn match cabalStatement "\clocation" -syn match cabalStatement "\cmain-is" -syn match cabalStatement "\cmaintainer" -syn match cabalStatement "\cmodule" -syn match cabalStatement "\cname" -syn match cabalStatement "\cnhc98-options" -syn match cabalStatement "\cother-modules" -syn match cabalStatement "\cpackage-url" -syn match cabalStatement "\cpkgconfig-depends" -syn match cabalStatement "\cstability" -syn match cabalStatement "\csubdir" -syn match cabalStatement "\csynopsis" -syn match cabalStatement "\ctag" -syn match cabalStatement "\ctested-with" -syn match cabalStatement "\ctype" -syn match cabalStatement "\cversion" +" this file uses line continuation +let s:cpo_save = &cpo +set cpo&vim + +" set iskeyword for this syntax script +syn iskeyword @,48-57,192-255,- + +" Case sensitive matches +syn case match + +syn keyword cabalConditional if else +syn keyword cabalFunction os arche impl flag +syn match cabalComment /--.*$/ + +" Case insensitive matches +syn case ignore + +syn keyword cabalCategory contained + \ executable + \ library + \ benchmark + \ test-suite + \ source-repository + \ flag + \ custom-setup +syn match cabalCategoryTitle contained /[^{]*\ze{\?/ +syn match cabalCategoryRegion + \ contains=cabalCategory,cabalCategoryTitle + \ nextgroup=cabalCategory skipwhite + \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\)\+\s*\%(.*$\|$\)/ +syn keyword cabalTruth true false + +" cabalStatementRegion which limits the scope of cabalStatement keywords, this +" way they are not highlighted in description. +syn region cabalStatementRegion start=+^\s*\(--\)\@<!\k\+\s*:+ end=+:+ +syn keyword cabalStatement contained containedin=cabalStatementRegion + \ default-language + \ default-extensions + \ author + \ branch + \ bug-reports + \ build-depends + \ build-tools + \ build-type + \ buildable + \ c-sources + \ cabal-version + \ category + \ cc-options + \ copyright + \ cpp-options + \ data-dir + \ data-files + \ default + \ description + \ executable + \ exposed-modules + \ exposed + \ extensions + \ extra-tmp-files + \ extra-doc-files + \ extra-lib-dirs + \ extra-libraries + \ extra-source-files + \ exta-tmp-files + \ for example + \ frameworks + \ ghc-options + \ ghc-prof-options + \ ghc-shared-options + \ homepage + \ hs-source-dirs + \ hugs-options + \ include-dirs + \ includes + \ install-includes + \ ld-options + \ license + \ license-file + \ location + \ main-is + \ maintainer + \ manual + \ module + \ name + \ nhc98-options + \ other-extensions + \ other-modules + \ package-url + \ pkgconfig-depends + \ setup-depends + \ stability + \ subdir + \ synopsis + \ tag + \ tested-with + \ type + \ version + \ virtual-modules + +" operators and version operators +syn match cabalOperator /&&\|||\|!/ +syn match cabalVersionOperator contained + \ /!\|==\|\^\?>=\|<=\|<\|>/ +" match version: `[%]\@<!` is to exclude `%20` in http addresses. +syn match cabalVersion contained + \ /[%$_-]\@<!\<\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ +" cabalVersionRegion which limits the scope of cabalVersion pattern. +syn match cabalVersionRegionA + \ contains=cabalVersionOperator,cabalVersion + \ keepend + \ /\%(==\|\^\?>=\|<=\|<\|>\)\s*\d\+\%(\.\d\+\)*\%(\.\*\)\?\>/ +" version inside `version: ...` +syn match cabalVersionRegionB + \ contains=cabalStatementRegion,cabalVersionOperator,cabalVersion + \ /^\s*\%(cabal-\)\?version\s*:.*$/ + +syn keyword cabalLanguage Haskell98 Haskell2010 + +" title region +syn match cabalName contained /:\@<=.*/ +syn match cabalNameRegion + \ contains=cabalStatementRegion,cabalName + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*name\s*:.*$/ + +" author region +syn match cabalAuthor contained /:\@<=.*/ +syn match cabalAuthorRegion + \ contains=cabalStatementRegion,cabalStatement,cabalAuthor + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*author\s*:.*$/ + +" maintainer region +syn match cabalMaintainer contained /:\@<=.*/ +syn match cabalMaintainerRegion + \ contains=cabalStatementRegion,cabalStatement,cabalMaintainer + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*maintainer\s*:.*$/ + +" license region +syn match cabalLicense contained /:\@<=.*/ +syn match cabalLicenseRegion + \ contains=cabalStatementRegion,cabalStatement,cabalLicense + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*license\s*:.*$/ + +" license-file region +syn match cabalLicenseFile contained /:\@<=.*/ +syn match cabalLicenseFileRegion + \ contains=cabalStatementRegion,cabalStatement,cabalLicenseFile + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*license-file\s*:.*$/ + +" tested-with region with compilers and versions +syn keyword cabalCompiler contained ghc nhc yhc hugs hbc helium jhc lhc +syn match cabalTestedWithRegion + \ contains=cabalStatementRegion,cabalStatement,cabalCompiler,cabalVersionRegionA + \ nextgroup=cabalStatementRegion + \ oneline + \ /^\c\s*tested-with\s*:.*$/ + +" build type keywords +syn keyword cabalBuildType contained + \ simple custom configure +syn match cabalBuildTypeRegion + \ contains=cabalStatementRegion,cabalStatement,cabalBuildType + \ nextgroup=cabalStatementRegion + \ /^\c\s*build-type\s*:.*$/ " 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_cabal_syn_inits") - if version < 508 - let did_cabal_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink cabalVersion Number - HiLink cabalTruth Boolean - HiLink cabalComment Comment - HiLink cabalStatement Statement - HiLink cabalCategory Type - HiLink cabalFunction Function - HiLink cabalConditional Conditional - HiLink cabalOperator Operator - HiLink cabalCompiler Constant - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link cabalName Title +hi def link cabalAuthor Normal +hi def link cabalMaintainer Normal +hi def link cabalCategoryTitle Title +hi def link cabalLicense Normal +hi def link cabalLicenseFile Normal +hi def link cabalBuildType Keyword +hi def link cabalVersion Number +hi def link cabalTruth Boolean +hi def link cabalComment Comment +hi def link cabalStatement Statement +hi def link cabalLanguage Type +hi def link cabalCategory Type +hi def link cabalFunction Function +hi def link cabalConditional Conditional +hi def link cabalOperator Operator +hi def link cabalVersionOperator Operator +hi def link cabalCompiler Constant let b:current_syntax = "cabal" +let &cpo = s:cpo_save +unlet! s:cpo_save + " vim: ts=8 diff --git a/runtime/syntax/calendar.vim b/runtime/syntax/calendar.vim index 588b41a4b8..4250109019 100644 --- a/runtime/syntax/calendar.vim +++ b/runtime/syntax/calendar.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: calendar(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: calendar(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cdl.vim b/runtime/syntax/cdl.vim index 69f124bddf..2a458d4ada 100644 Binary files a/runtime/syntax/cdl.vim and b/runtime/syntax/cdl.vim differ diff --git a/runtime/syntax/cdrdaoconf.vim b/runtime/syntax/cdrdaoconf.vim index 5058c23a24..0fa65103fb 100644 --- a/runtime/syntax/cdrdaoconf.vim +++ b/runtime/syntax/cdrdaoconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cdrdao(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-09-02 +" Language: cdrdao(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-09-02 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cdrtoc.vim b/runtime/syntax/cdrtoc.vim index fa752dbfb8..866784d7c2 100644 --- a/runtime/syntax/cdrtoc.vim +++ b/runtime/syntax/cdrtoc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cdrdao(1) TOC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-05-10 +" Language: cdrdao(1) TOC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-05-10 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cf.vim b/runtime/syntax/cf.vim index 63d976d9ce..04f9f5967b 100644 --- a/runtime/syntax/cf.vim +++ b/runtime/syntax/cf.vim @@ -1,440 +1,1018 @@ " Vim syntax file -" Language: CFML -" Maintainer: Toby Woodwark (toby.woodwark+vim@gmail.com) -" Last Change: 2010-03-02 -" Filenames: *.cfc *.cfm -" Version: Adobe ColdFusion 9 -" Usage: This file contains both syntax definitions -" and a list of known builtin tags, functions and keywords. -" Refs - -" http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS8f0cc78011fffa71866534d11cdad96e4e-8000.html -" http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17324-8000.html -" TODO: -" Support the limited array literal and struct literal syntax in CF8+. -" Highlight namespaced tags fom cfimport. -" Complete CF9+ cfscript support. -" Railo support. -" Options: -" d_noinclude_html - set to prevent HTML highlighting. Use this if you are not working on HTML. - -" Quit if a syntax file is already loaded. +" +" Language: CFML (ColdFusion) +" Author: Ernst M. van der Linden <ernst.vanderlinden@ernestoz.com> +" License: The MIT License (MIT) +" +" Maintainer: Ernst M. van der Linden <ernst.vanderlinden@ernestoz.com> +" URL: https://github.com/ernstvanderlinden/vim-coldfusion +" Last Change: 2017 Nov 28 +" +" Filenames: *.cfc *.cfm + +" Quit when a syntax file was already loaded. if exists("b:current_syntax") finish endif -if exists("d_noinclude_html") - " Define alternatives to the HTML syntax file. - - " Copied from html.vim - the rules for matching a CF tag match those for HTML/SGML. - " CFML syntax is more permissive when it comes to superfluous <> chars. - syn region htmlString contained start=+"+ end=+"+ contains=@htmlPreproc - syn region htmlString contained start=+'+ end=+'+ contains=@htmlPreproc - syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=@htmlPreproc - " Hacked htmlTag so that it only matches cf tags and not random <> chars. - syn region htmlEndTag start=+</cf+ end=+>+ contains=htmlTagN,htmlTagError - syn region htmlTag start=+<\s*cf[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,@htmlPreproc,@htmlArgCluster - syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,@htmlTagNameCluster - syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,@htmlTagNameCluster - syn match htmlTagError contained "[^>]<"ms=s+1 -else - " Use all the stuff from the HTML syntax file. - " This means eg HTML comments are highlighted as comments, even if they include cf tags. - runtime! syntax/html.vim -endif - -syn sync fromstart -syn sync maxlines=200 -syn case ignore - -" Scopes and keywords. -syn keyword cfScope contained cgi cffile cookie request caller this thistag -syn keyword cfScope contained cfcatch variables application server session client form url local -syn keyword cfScope contained arguments super cfhttp attributes error -syn keyword cfBool contained yes no true false - -" Operator strings. -" ColdFusion <=7: -syn keyword cfOperator contained xor eqv and or lt le lte gt ge gte equal eq neq not is mod contains -syn match cfOperatorMatch contained "+" -syn match cfOperatorMatch contained "\-" -syn match cfOperatorMatch contained "[\*\/\\\^\&][\+\-\*\/\\\^\&]\@!" -syn match cfOperatorMatch contained "\<\(not\_s\+\)\?equal\>" -syn match cfOperatorMatch contained "\<does\_s\+not\_s\+contain\>" -syn match cfOperatorMatch contained "\<\(greater\|less\)\_s\+than\(\_s\+or\_s\+equal\_s\+to\)\?\>" -" ColdFusion 8: -syn keyword cfOperator contained imp -syn match cfOperatorMatch contained "[?%:!]" -syn match cfOperatorMatch contained "[\+\-\*\/\&]=" -syn match cfOperatorMatch contained "++" -syn match cfOperatorMatch contained "--" -syn match cfOperatorMatch contained "&&" -syn match cfOperatorMatch contained "||" - -syn cluster cfOperatorCluster contains=cfOperator,cfOperatorMatch - -" Custom tags called with the <cf_xxx> syntax. -syn match cfCustomTagName contained "\<cf_[a-zA-Z0-9_]\+\>" -" (TODO match namespaced tags imported using cfimport, similarly.) - -" Tag names. -" ColdFusion <=7: -syn keyword cfTagName contained cfabort cfapplet cfapplication cfargument cfassociate -syn keyword cfTagName contained cfbreak cfcache cfcalendar cfcase cfcatch -syn keyword cfTagName contained cfchart cfchartdata cfchartseries cfcol cfcollection -syn keyword cfTagName contained cfcomponent cfcontent cfcookie cfdefaultcase cfdirectory -syn keyword cfTagName contained cfdocument cfdocumentitem cfdocumentsection cfdump cfelse -syn keyword cfTagName contained cfelseif cferror cfexecute cfexit cffile cfflush cfform -syn keyword cfTagName contained cfformgroup cfformitem cfftp cffunction -syn keyword cfTagName contained cfgrid cfgridcolumn cfgridrow cfgridupdate cfheader -syn keyword cfTagName contained cfhtmlhead cfhttp cfhttpparam cfif cfimport -syn keyword cfTagName contained cfinclude cfindex cfinput cfinsert cfinvoke cfinvokeargument -syn keyword cfTagName contained cfldap cflocation cflock cflog cflogin cfloginuser cflogout -syn keyword cfTagName contained cfloop cfmail cfmailparam cfmailpart cfmodule -syn keyword cfTagName contained cfNTauthenticate cfobject cfobjectcache cfoutput cfparam -syn keyword cfTagName contained cfpop cfprocessingdirective cfprocparam cfprocresult -syn keyword cfTagName contained cfproperty cfquery cfqueryparam cfregistry cfreport -syn keyword cfTagName contained cfreportparam cfrethrow cfreturn cfsavecontent cfschedule -syn keyword cfTagName contained cfscript cfsearch cfselect cfservletparam cfset -syn keyword cfTagName contained cfsetting cfsilent cfslider cfstoredproc cfswitch cftable -syn keyword cfTagName contained cftextarea cftextinput cfthrow cftimer cftrace cftransaction -syn keyword cfTagName contained cftree cftreeitem cftry cfupdate cfwddx cfxml -" ColdFusion 8: -syn keyword cfTagName contained cfajaximport cfajaxproxy cfdbinfo cfdiv cfexchangecalendar -syn keyword cfTagName contained cfexchangeconnection cfexchangecontact cfexchangefilter -syn keyword cfTagName contained cfexchangemail cfexchangetask cffeed -syn keyword cfTagName contained cfinterface cflayout cflayoutarea cfmenu cfmenuitem -syn keyword cfTagName contained cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod -syn keyword cfTagName contained cfpresentation cfpresentationslide cfpresenter cfprint -syn keyword cfTagName contained cfsprydataset cfthread cftooltip cfwindow cfzip cfzipparam -" ColdFusion 9: -syn keyword cfTagName contained cfcontinue cffileupload cffinally -syn keyword cfTagName contained cfimage cfimap -syn keyword cfTagName contained cfmap cfmapitem cfmediaplayer cfmessagebox -syn keyword cfTagName contained cfprocparam cfprogressbar -syn keyword cfTagName contained cfsharepoint cfspreadsheet - -" Tag attributes. -" XXX Not updated for ColdFusion 8/9. -" These are becoming a headache to maintain, so might be removed. -syn keyword cfArg contained abort accept access accessible action addnewline addtoken -syn keyword cfArg contained agentname align appendkey appletsource application -syn keyword cfArg contained applicationtimeout applicationtoken archive -syn keyword cfArg contained argumentcollection arguments asciiextensionlist -syn keyword cfArg contained attachmentpath attributecollection attributes autowidth -syn keyword cfArg contained backgroundvisible basetag bcc bgcolor bind bindingname -syn keyword cfArg contained blockfactor body bold border branch cachedafter cachedwithin -syn keyword cfArg contained casesensitive category categorytree cc cfsqltype charset -syn keyword cfArg contained chartheight chartwidth checked class clientmanagement -syn keyword cfArg contained clientstorage codebase colheaderalign colheaderbold -syn keyword cfArg contained colheaderfont colheaderfontsize colheaderitalic colheaders -syn keyword cfArg contained colheadertextcolor collection colorlist colspacing columns -syn keyword cfArg contained completepath component condition connection contentid -syn keyword cfArg contained context contextbytes contexthighlightbegin -syn keyword cfArg contained contexthighlightend contextpassages cookiedomain criteria -syn keyword cfArg contained custom1 custom2 custom3 custom4 data dataalign -syn keyword cfArg contained databackgroundcolor datacollection datasource daynames -syn keyword cfArg contained dbname dbserver dbtype dbvarname debug default delete -syn keyword cfArg contained deletebutton deletefile delimiter delimiters description -syn keyword cfArg contained destination detail directory disabled display displayname -syn keyword cfArg contained disposition dn domain editable enablecab enablecfoutputonly -syn keyword cfArg contained enabled encoded encryption enctype enddate endrange endtime -syn keyword cfArg contained entry errorcode exception existing expand expires expireurl -syn keyword cfArg contained expression extendedinfo extends extensions external -syn keyword cfArg contained failifexists failto file filefield filename filter -syn keyword cfArg contained firstdayofweek firstrowasheaders fixnewline font fontbold -syn keyword cfArg contained fontembed fontitalic fontsize foregroundcolor format -syn keyword cfArg contained formfields formula from generateuniquefilenames getasbinary -syn keyword cfArg contained grid griddataalign gridlines groovecolor group -syn keyword cfArg contained groupcasesensitive header headeralign headerbold headerfont -syn keyword cfArg contained headerfontsize headeritalic headerlines headertextcolor -syn keyword cfArg contained height highlighthref hint href hrefkey hscroll hspace html -syn keyword cfArg contained htmltable id idletimeout img imgopen imgstyle index inline -syn keyword cfArg contained input insert insertbutton interval isolation italic item -syn keyword cfArg contained itemcolumn key keyonly label labelformat language list -syn keyword cfArg contained listgroups locale localfile log loginstorage lookandfeel -syn keyword cfArg contained mailerid mailto marginbottom marginleft marginright -syn keyword cfArg contained margintop markersize markerstyle mask max maxlength maxrows -syn keyword cfArg contained message messagenumber method mimeattach mimetype min mode -syn keyword cfArg contained modifytype monthnames multipart multiple name nameconflict -syn keyword cfArg contained namespace new newdirectory notsupported null numberformat -syn keyword cfArg contained object omit onblur onchange onclick onerror onfocus -syn keyword cfArg contained onkeydown onkeyup onload onmousedown onmouseup onreset -syn keyword cfArg contained onsubmit onvalidate operation orderby orientation output -syn keyword cfArg contained outputfile overwrite ownerpassword pageencoding pageheight -syn keyword cfArg contained pagetype pagewidth paintstyle param_1 param_2 param_3 -syn keyword cfArg contained param_4 param_5 param_6 param_7 param_8 param_9 parent -syn keyword cfArg contained parrent passive passthrough password path pattern -syn keyword cfArg contained permissions picturebar pieslicestyle port porttypename -syn keyword cfArg contained prefix preloader preservedata previouscriteria procedure -syn keyword cfArg contained protocol provider providerdsn proxybypass proxypassword -syn keyword cfArg contained proxyport proxyserver proxyuser publish query queryasroot -syn keyword cfArg contained queryposition range rebind recurse redirect referral -syn keyword cfArg contained refreshlabel remotefile replyto report requesttimeout -syn keyword cfArg contained required reset resoleurl resolveurl result resultset -syn keyword cfArg contained retrycount returnasbinary returncode returntype -syn keyword cfArg contained returnvariable roles rotated rowheaderalign rowheaderbold -syn keyword cfArg contained rowheaderfont rowheaderfontsize rowheaderitalic rowheaders -syn keyword cfArg contained rowheadertextcolor rowheaderwidth rowheight scale scalefrom -syn keyword cfArg contained scaleto scope scriptprotect scriptsrc secure securitycontext -syn keyword cfArg contained select selectcolor selected selecteddate selectedindex -syn keyword cfArg contained selectmode separator seriescolor serieslabel seriesplacement -syn keyword cfArg contained server serviceport serviceportname sessionmanagement -syn keyword cfArg contained sessiontimeout setclientcookies setcookie setdomaincookies -syn keyword cfArg contained show3d showborder showdebugoutput showerror showlegend -syn keyword cfArg contained showmarkers showxgridlines showygridlines size skin sort -syn keyword cfArg contained sortascendingbutton sortcontrol sortdescendingbutton -syn keyword cfArg contained sortxaxis source spoolenable sql src srcfile start startdate -syn keyword cfArg contained startrange startrow starttime status statuscode statustext -syn keyword cfArg contained step stoponerror style subject suggestions -syn keyword cfArg contained suppresswhitespace tablename tableowner tablequalifier -syn keyword cfArg contained taglib target task template text textcolor textqualifier -syn keyword cfArg contained throwonerror throwonerror throwonfailure throwontimeout -syn keyword cfArg contained timeout timespan tipbgcolor tipstyle title to tooltip -syn keyword cfArg contained toplevelvariable transfermode type uid unit url urlpath -syn keyword cfArg contained useragent username userpassword usetimezoneinfo validate -syn keyword cfArg contained validateat value valuecolumn values valuesdelimiter -syn keyword cfArg contained valuesdisplay var variable vertical visible vscroll vspace -syn keyword cfArg contained webservice width wmode wraptext wsdlfile xaxistitle -syn keyword cfArg contained xaxistype xoffset yaxistitle yaxistype yoffset - -" Functions. -" ColdFusion <=7: -syn keyword cfFunctionName contained ACos ASin Abs AddSOAPRequestHeader AddSOAPResponseHeader -syn keyword cfFunctionName contained ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ArrayInsertAt -syn keyword cfFunctionName contained ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArrayNew -syn keyword cfFunctionName contained ArrayPrepend ArrayResize ArraySet ArraySort ArraySum -syn keyword cfFunctionName contained ArraySwap ArrayToList Asc Atn AuthenticatedContext -syn keyword cfFunctionName contained AuthenticatedUser BinaryDecode BinaryEncode BitAnd -syn keyword cfFunctionName contained BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN -syn keyword cfFunctionName contained BitSHRN BitXor CJustify Ceiling CharsetDecode CharsetEncode -syn keyword cfFunctionName contained Chr Compare CompareNoCase Cos CreateDate CreateDateTime -syn keyword cfFunctionName contained CreateODBCDate CreateODBCDateTime CreateODBCTime -syn keyword cfFunctionName contained CreateObject CreateTime CreateTimeSpan CreateUUID DE DateAdd -syn keyword cfFunctionName contained DateCompare DateConvert DateDiff DateFormat DatePart Day -syn keyword cfFunctionName contained DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear -syn keyword cfFunctionName contained DecimalFormat DecrementValue Decrypt DecryptBinary -syn keyword cfFunctionName contained DeleteClientVariable DirectoryExists DollarFormat Duplicate -syn keyword cfFunctionName contained Encrypt EncryptBinary Evaluate Exp ExpandPath FileExists -syn keyword cfFunctionName contained Find FindNoCase FindOneOf FirstDayOfMonth Fix FormatBaseN -syn keyword cfFunctionName contained GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList -syn keyword cfFunctionName contained GetBaseTemplatePath GetClientVariablesList GetContextRoot -syn keyword cfFunctionName contained GetCurrentTemplatePath GetDirectoryFromPath GetEncoding -syn keyword cfFunctionName contained GetException GetFileFromPath GetFunctionList -syn keyword cfFunctionName contained GetGatewayHelper GetHttpRequestData GetHttpTimeString -syn keyword cfFunctionName contained GetLocalHostIP -syn keyword cfFunctionName contained GetLocale GetLocaleDisplayName GetMetaData GetMetricData -syn keyword cfFunctionName contained GetPageContext GetProfileSections GetProfileString -syn keyword cfFunctionName contained GetSOAPRequest GetSOAPRequestHeader GetSOAPResponse -syn keyword cfFunctionName contained GetSOAPResponseHeader GetTempDirectory GetTempFile -syn keyword cfFunctionName contained GetTickCount GetTimeZoneInfo GetToken -syn keyword cfFunctionName contained HTMLCodeFormat HTMLEditFormat Hash Hour IIf IncrementValue -syn keyword cfFunctionName contained InputBaseN Insert Int IsArray IsAuthenticated IsAuthorized -syn keyword cfFunctionName contained IsBinary IsBoolean IsCustomFunction IsDate IsDebugMode -syn keyword cfFunctionName contained IsDefined -syn keyword cfFunctionName contained IsLeapYear IsLocalHost IsNumeric -syn keyword cfFunctionName contained IsNumericDate IsObject IsProtected IsQuery IsSOAPRequest -syn keyword cfFunctionName contained IsSimpleValue IsStruct IsUserInRole IsValid IsWDDX IsXML -syn keyword cfFunctionName contained IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot -syn keyword cfFunctionName contained JSStringFormat JavaCast LCase LJustify LSCurrencyFormat -syn keyword cfFunctionName contained LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate -syn keyword cfFunctionName contained LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime -syn keyword cfFunctionName contained LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Left -syn keyword cfFunctionName contained Len ListAppend ListChangeDelims ListContains -syn keyword cfFunctionName contained ListContainsNoCase ListDeleteAt ListFind ListFindNoCase -syn keyword cfFunctionName contained ListFirst ListGetAt ListInsertAt ListLast ListLen -syn keyword cfFunctionName contained ListPrepend ListQualify ListRest ListSetAt ListSort -syn keyword cfFunctionName contained ListToArray ListValueCount ListValueCountNoCase Log Log10 -syn keyword cfFunctionName contained Max Mid Min Minute Month MonthAsString Now NumberFormat -syn keyword cfFunctionName contained ParagraphFormat ParseDateTime Pi -syn keyword cfFunctionName contained PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow -syn keyword cfFunctionName contained QueryNew QuerySetCell QuotedValueList REFind REFindNoCase -syn keyword cfFunctionName contained REReplace REReplaceNoCase RJustify RTrim Rand RandRange -syn keyword cfFunctionName contained Randomize ReleaseComObject RemoveChars RepeatString Replace -syn keyword cfFunctionName contained ReplaceList ReplaceNoCase Reverse Right Round Second -syn keyword cfFunctionName contained SendGatewayMessage SetEncoding SetLocale SetProfileString -syn keyword cfFunctionName contained SetVariable Sgn Sin SpanExcluding SpanIncluding Sqr StripCR -syn keyword cfFunctionName contained StructAppend StructClear StructCopy StructCount StructDelete -syn keyword cfFunctionName contained StructFind StructFindKey StructFindValue StructGet -syn keyword cfFunctionName contained StructInsert StructIsEmpty StructKeyArray StructKeyExists -syn keyword cfFunctionName contained StructKeyList StructNew StructSort StructUpdate Tan -syn keyword cfFunctionName contained TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase -syn keyword cfFunctionName contained URLDecode URLEncodedFormat URLSessionFormat Val ValueList -syn keyword cfFunctionName contained Week Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat -syn keyword cfFunctionName contained XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform -syn keyword cfFunctionName contained XmlValidate Year YesNoFormat -" ColdFusion 8: -syn keyword cfFunctionName contained AjaxLink AjaxOnLoad ArrayIsDefined BinaryDecode BinaryEncode CharsetDecode CharsetEncode -syn keyword cfFunctionName contained DecryptBinary DeserializeJSON DotNetToCFType EncryptBinary FileClose FileCopy FileDelete -syn keyword cfFunctionName contained FileIsEOF FileMove FileOpen FileRead FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute -syn keyword cfFunctionName contained FileSetLastModified FileWrite GenerateSecretKey GetGatewayHelper GetAuthUser GetComponentMetaData -syn keyword cfFunctionName contained GetContextRoot GetEncoding GetFileInfo GetLocaleDisplayName GetLocalHostIP GetMetaData -syn keyword cfFunctionName contained GetPageContext GetPrinterInfo GetProfileSections GetReadableImageFormats GetSOAPRequest -syn keyword cfFunctionName contained GetSOAPRequestHeader GetSOAPResponse GetSOAPResponseHeader GetUserRoles GetWriteableImageFormats -syn keyword cfFunctionName contained ImageAddBorder ImageBlur ImageClearRect ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect -syn keyword cfFunctionName contained ImageDrawCubicCurve ImageDrawPoint ImageDrawLine ImageDrawLines ImageDrawOval -syn keyword cfFunctionName contained ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob -syn keyword cfFunctionName contained ImageGetBufferedImage ImageGetEXIFMetadata ImageGetEXIFTag ImageGetHeight ImageGetIPTCMetadata -syn keyword cfFunctionName contained ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay -syn keyword cfFunctionName contained ImagePaste ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit -" ColdFusion 9: -syn keyword cfFunctionName contained ApplicationStop ArrayContains ArrayDelete ArrayFind ArrayFindNoCase IsSpreadsheetFile -syn keyword cfFunctionName contained IsSpreadsheetObject FileSkipBytes Location ObjectLoad SpreadsheetFormatColumn -syn keyword cfFunctionName contained SpreadsheetFormatColumns SpreadsheetFormatRow SpreadsheetFormatRows SpreadsheetGetCellComment -syn keyword cfFunctionName contained CacheGetAllIds CacheGetMetadata CacheGetProperties CacheGet CachePut ObjectSave ORMClearSession -syn keyword cfFunctionName contained ORMCloseSession ORMEvictQueries ORMEvictCollection SpreadsheetGetCellFormula SpreadsheetGetCellValue -syn keyword cfFunctionName contained SpreadsheetInfo SpreadsheetMergeCells SpreadsheetNew CacheRemove CacheSetProperties DirectoryCreate -syn keyword cfFunctionName contained DirectoryDelete DirectoryExists ORMEvictEntity ORMEvictQueries ORMExecuteQuery ORMFlush -syn keyword cfFunctionName contained ORMGetSession SpreadsheetRead SpreadsheetReadBinary SpreadsheetSetActiveSheetNumber -syn keyword cfFunctionName contained SpreadsheetSetCellComment SpreadsheetSetCellFormula DirectoryList DirectoryRename EntityDelete -syn keyword cfFunctionName contained EntityLoad EntityLoadByExample ORMGetSessionFactory ORMReload ObjectEquals SpreadsheetAddColumn -syn keyword cfFunctionName contained SpreadsheetAddFreezePane SpreadsheetSetCellValue SpreadsheetSetActiveSheet SpreadsheetSetFooter -syn keyword cfFunctionName contained SpreadsheetSetHeader SpreadsheetSetColumnWidth EntityLoadByPK EntityMerge EntityNew EntityReload -syn keyword cfFunctionName contained EntitySave SpreadsheetAddImage SpreadsheetAddInfo SpreadsheetAddRow SpreadsheetAddRows -syn keyword cfFunctionName contained SpreadsheetAddSplitPane SpreadsheetShiftColumns SpreadsheetShiftRows SpreadsheetSetRowHeight -syn keyword cfFunctionName contained SpreadsheetWrite Trace FileDelete FileSeek FileWriteLine GetFunctionCalledName GetVFSMetaData IsIPv6 -syn keyword cfFunctionName contained IsNull SpreadsheetCreateSheet SpreadsheetDeleteColumn SpreadsheetDeleteColumns SpreadsheetDeleteRow -syn keyword cfFunctionName contained SpreadsheetDeleteRows SpreadsheetFormatCell TransactionCommit TransactionRollback -syn keyword cfFunctionName contained TransactionSetSavePoint ThreadTerminate ThreadJoin Throw Writedump Writelog - -" Deprecated or obsoleted tags and functions. -syn keyword cfDeprecatedTag contained cfauthenticate cfimpersonate cfgraph cfgraphdata -syn keyword cfDeprecatedTag contained cfservlet cfservletparam cftextinput -syn keyword cfDeprecatedTag contained cfinternaladminsecurity cfnewinternaladminsecurity -syn keyword cfDeprecatedFunction contained GetK2ServerDocCount GetK2ServerDocCountLimit GetTemplatePath -syn keyword cfDeprecatedFunction contained IsK2ServerABroker IsK2ServerDocCountExceeded IsK2ServerOnline -syn keyword cfDeprecatedFunction contained ParameterExists AuthenticatedContext AuthenticatedUser -syn keyword cfDeprecatedFunction contained isAuthenticated isAuthorized isProtected - -" Add to the HTML clusters. -syn cluster htmlTagNameCluster add=cfTagName,cfCustomTagName,cfDeprecatedTag -syn cluster htmlArgCluster add=cfArg,cfHashRegion,cfScope -syn cluster htmlPreproc add=cfHashRegion - -syn cluster cfExpressionCluster contains=cfFunctionName,cfScope,@cfOperatorCluster,cfScriptStringD,cfScriptStringS,cfScriptNumber,cfBool,cfComment - -" Evaluation; skip strings ( this helps with cases like nested IIf() ) -" containedin to add to the TOP of cfOutputRegion. -syn region cfHashRegion start=+#+ skip=+"[^"]*"\|'[^']*'+ end=+#+ contained containedin=cfOutputRegion contains=@cfExpressionCluster,cfScriptParenError - -" Hashmarks are significant inside cfoutput tags. -" cfoutput tags may be nested indefinitely. -syn region cfOutputRegion matchgroup=NONE transparent start=+<cfoutput>+ end=+</cfoutput>+ contains=TOP - -" <cfset>, <cfif>, <cfelseif>, <cfreturn> are analogous to hashmarks (implicit -" evaluation) and have 'var' -syn region cfSetRegion start="<cfset\>" start="<cfreturn\>" start="<cfelseif\>" start="<cfif\>" end='>' keepend contains=@cfExpressionCluster,cfSetLHSRegion,cfSetTagEnd,cfScriptStatement -syn region cfSetLHSRegion contained start="<cfreturn" start="<cfelseif" start="<cfif" start="<cfset" end="." keepend contains=cfTagName,htmlTag -syn match cfSetTagEnd contained '>' - -" CF comments: similar to SGML comments, but can be nested. -syn region cfComment start='<!---' end='--->' contains=cfCommentTodo,cfComment -syn keyword cfCommentTodo contained TODO FIXME XXX TBD WTF - -" CFscript -" TODO better support for new component/function def syntax -" TODO better support for 'new' -" TODO highlight metadata (@ ...) inside comments. -syn match cfScriptLineComment contained "\/\/.*$" contains=cfCommentTodo -syn region cfScriptComment contained start="/\*" end="\*/" contains=cfCommentTodo -syn match cfScriptBraces contained "[{}]" -syn keyword cfScriptStatement contained return var -" in CF, quotes are escaped by doubling -syn region cfScriptStringD contained start=+"+ skip=+\\\\\|""+ end=+"+ extend contains=@htmlPreproc,cfHashRegion -syn region cfScriptStringS contained start=+'+ skip=+\\\\\|''+ end=+'+ extend contains=@htmlPreproc,cfHashRegion -syn match cfScriptNumber contained "\<\d\+\>" -syn keyword cfScriptConditional contained if else -syn keyword cfScriptRepeat contained while for in -syn keyword cfScriptBranch contained break switch case default try catch continue finally -syn keyword cfScriptKeyword contained function -" argumentCollection is a special argument to function calls -syn keyword cfScriptSpecial contained argumentcollection -" ColdFusion 9: -syn keyword cfScriptStatement contained new import -" CFscript equivalents of some tags -syn keyword cfScriptKeyword contained abort component exit import include -syn keyword cfScriptKeyword contained interface param pageencoding property rethrow thread transaction -" function/component syntax -syn keyword cfScriptSpecial contained required extends - - -syn cluster cfScriptCluster contains=cfScriptParen,cfScriptLineComment,cfScriptComment,cfScriptStringD,cfScriptStringS,cfScriptFunction,cfScriptNumber,cfScriptRegexpString,cfScriptBoolean,cfScriptBraces,cfHashRegion,cfFunctionName,cfDeprecatedFunction,cfScope,@cfOperatorCluster,cfScriptConditional,cfScriptRepeat,cfScriptBranch,@cfExpressionCluster,cfScriptStatement,cfScriptSpecial,cfScriptKeyword - -" Errors caused by wrong parenthesis; skip strings -syn region cfScriptParen contained transparent skip=+"[^"]*"\|'[^']*'+ start=+(+ end=+)+ contains=@cfScriptCluster -syn match cfScrParenError contained +)+ - -syn region cfscriptBlock matchgroup=NONE start="<cfscript>" end="<\/cfscript>"me=s-1 keepend contains=@cfScriptCluster,cfscriptTag,cfScrParenError -syn region cfscriptTag contained start='<cfscript' end='>' keepend contains=cfTagName,htmlTag - -" CFML -syn cluster cfmlCluster contains=cfComment,@htmlTagNameCluster,@htmlPreproc,cfSetRegion,cfscriptBlock,cfOutputRegion - -" cfquery = sql syntax -if exists("b:current_syntax") - unlet b:current_syntax -endif -syn include @cfSql $VIMRUNTIME/syntax/sql.vim -unlet b:current_syntax -syn region cfqueryTag contained start=+<cfquery+ end=+>+ keepend contains=cfTagName,htmlTag -syn region cfSqlregion start=+<cfquery\_[^>]*>+ keepend end=+</cfquery>+me=s-1 matchgroup=NONE contains=@cfSql,cfComment,@htmlTagNameCluster,cfqueryTag,cfHashRegion - -" Define the highlighting. -command -nargs=+ CfHiLink hi def link <args> - -if exists("d_noinclude_html") - " The default html-style highlighting copied from html.vim. - CfHiLink htmlTag Function - CfHiLink htmlEndTag Identifier - CfHiLink htmlArg Type - CfHiLink htmlTagName htmlStatement - CfHiLink htmlValue String - CfHiLink htmlPreProc PreProc - CfHiLink htmlString String - CfHiLink htmlStatement Statement - CfHiLink htmlValue String - CfHiLink htmlTagError htmlError - CfHiLink htmlError Error -endif - -CfHiLink cfTagName Statement -CfHiLink cfCustomTagName Statement -CfHiLink cfArg Type -CfHiLink cfFunctionName Function -CfHiLink cfHashRegion PreProc -CfHiLink cfComment Comment -CfHiLink cfCommentTodo Todo -CfHiLink cfOperator Operator -CfHiLink cfOperatorMatch Operator -CfHiLink cfScope Title -CfHiLink cfBool Constant - -CfHiLink cfscriptBlock Special -CfHiLink cfscriptTag htmlTag -CfHiLink cfSetRegion PreProc -CfHiLink cfSetLHSRegion htmlTag -CfHiLink cfSetTagEnd htmlTag - -CfHiLink cfScriptLineComment Comment -CfHiLink cfScriptComment Comment -CfHiLink cfScriptStringS String -CfHiLink cfScriptStringD String -CfHiLink cfScriptNumber cfScriptValue -CfHiLink cfScriptConditional Conditional -CfHiLink cfScriptRepeat Repeat -CfHiLink cfScriptBranch Conditional -CfHiLink cfScriptSpecial Type -CfHiLink cfScriptStatement Statement -CfHiLink cfScriptBraces Function -CfHiLink cfScriptKeyword Function -CfHiLink cfScriptError Error -CfHiLink cfDeprecatedTag Error -CfHiLink cfDeprecatedFunction Error -CfHiLink cfScrParenError cfScriptError - -CfHiLink cfqueryTag htmlTag - -delcommand CfHiLink - -let b:current_syntax = "cf" - -" vim: nowrap sw=2 ts=8 noet +" Using line continuation here. +let s:cpo_save=&cpo +set cpo-=C + +sy sync fromstart +" 20171126: disabled as we have fast computers now. +"sy sync maxlines=2000 +sy case ignore + +" INCLUDES {{{ +sy include @sqlSyntax $VIMRUNTIME/syntax/sql.vim +" 20161010: Disabled include html highlighting as it contains huge keywords +" regex, so it will have impact on performance. Use own simple SGML tag +" coloring instead. +"runtime! syntax/html.vim +" / INCLUDES }}} + +" NUMBER {{{ +sy match cfmlNumber + \ "\v<\d+>" +" / NUMBER }}} + +" EQUAL SIGN {{{ +sy match cfmlEqualSign + \ "\v\=" +" / EQUAL SIGN }}} + +" BOOLEAN {{{ +sy match cfmlBoolean + \ "\v<(true|false)>" +" / BOOLEAN }}} + +" HASH SURROUNDED {{{ +sy region cfmlHashSurround + \ keepend + \ oneline + \ start="#" + \ end="#" + \ skip="##" + \ contains= + \@cfmlOperator, + \@cfmlPunctuation, + \cfmlBoolean, + \cfmlCoreKeyword, + \cfmlCoreScope, + \cfmlCustomKeyword, + \cfmlCustomScope, + \cfmlEqualSign, + \cfmlFunctionName, + \cfmlNumber +" / HASH SURROUNDED }}} + +" OPERATOR {{{ + +" OPERATOR - ARITHMETIC {{{ +" +7 -7 +" ++i --i +" i++ i-- +" + - * / % +" += -= *= /= %= +" ^ mod +sy match cfmlArithmeticOperator + \ "\v + \(\+|-)\ze\d + \|(\+\+|--)\ze\w + \|\w\zs(\+\+|--) + \|(\s( + \(\+|-|\*|\/|\%){1}\={,1} + \|\^ + \|mod + \)\s) + \" +" / OPERATOR - ARITHMETIC }}} + +" OPERATOR - BOOLEAN {{{ +" not and or xor eqv imp +" ! && || +sy match cfmlBooleanOperator + \ "\v\s + \(not|and|or|xor|eqv|imp + \|\!|\&\&|\|\| + \)(\s|\)) + \|\s\!\ze\w + \" +" / OPERATOR - BOOLEAN }}} + +" OPERATOR - DECISION {{{ +"is|equal|eq +"is not|not equal|neq +"contains|does not contain +"greater than|gt +"less than|lt +"greater than or equal to|gte|ge +"less than or equal to|lte|le +"==|!=|>|<|>=|<= +sy match cfmlDecisionOperator + \ "\v\s + \(is|equal|eq + \|is not|not equal|neq + \|contains|does not contain + \|greater than|gt + \|less than|lt + \|greater than or equal to|gte|ge + \|less than or equal to|lte|le + \|(!|\<|\>|\=){1}\= + \|\< + \|\> + \)\s" +" / OPERATOR - DECISION }}} + +" OPERATOR - STRING {{{ +" & +" &= +sy match cfmlStringOperator + \ "\v\s\&\={,1}\s" +" / OPERATOR - STRING }}} + +" OPERATOR - TERNARY {{{ +" ? : +sy match cfmlTernaryOperator + \ "\v\s + \\?|\: + \\s" +" / OPERATOR - TERNARY }}} + +sy cluster cfmlOperator + \ contains= + \cfmlArithmeticOperator, + \cfmlBooleanOperator, + \cfmlDecisionOperator, + \cfmlStringOperator, + \cfmlTernaryOperator +" / OPERATOR }}} + +" PARENTHESIS {{{ +sy cluster cfmlParenthesisRegionContains + \ contains= + \@cfmlAttribute, + \@cfmlComment, + \@cfmlFlowStatement, + \@cfmlOperator, + \@cfmlPunctuation, + \cfmlBoolean, + \cfmlBrace, + \cfmlCoreKeyword, + \cfmlCoreScope, + \cfmlCustomKeyword, + \cfmlCustomScope, + \cfmlEqualSign, + \cfmlFunctionName, + \cfmlNumber, + \cfmlStorageKeyword, + \cfmlStorageType + +sy region cfmlParenthesisRegion1 + \ extend + \ matchgroup=cfmlParenthesis1 + \ transparent + \ start=/(/ + \ end=/)/ + \ contains= + \cfmlParenthesisRegion2, + \@cfmlParenthesisRegionContains +sy region cfmlParenthesisRegion2 + \ matchgroup=cfmlParenthesis2 + \ transparent + \ start=/(/ + \ end=/)/ + \ contains= + \cfmlParenthesisRegion3, + \@cfmlParenthesisRegionContains +sy region cfmlParenthesisRegion3 + \ matchgroup=cfmlParenthesis3 + \ transparent + \ start=/(/ + \ end=/)/ + \ contains= + \cfmlParenthesisRegion1, + \@cfmlParenthesisRegionContains +sy cluster cfmlParenthesisRegion + \ contains= + \cfmlParenthesisRegion1, + \cfmlParenthesisRegion2, + \cfmlParenthesisRegion3 +" / PARENTHESIS }}} + +" BRACE {{{ +sy match cfmlBrace + \ "{\|}" + +sy region cfmlBraceRegion + \ extend + \ fold + \ keepend + \ transparent + \ start="{" + \ end="}" +" / BRACE }}} + +" PUNCTUATION {{{ + +" PUNCTUATION - BRACKET {{{ +sy match cfmlBracket + \ "\(\[\|\]\)" + \ contained +" / PUNCTUATION - BRACKET }}} + +" PUNCTUATION - CHAR {{{ +sy match cfmlComma "," +sy match cfmlDot "\." +sy match cfmlSemiColon ";" + +" / PUNCTUATION - CHAR }}} + +" PUNCTUATION - QUOTE {{{ +sy region cfmlSingleQuotedValue + \ matchgroup=cfmlSingleQuote + \ start=/'/ + \ skip=/''/ + \ end=/'/ + \ contains= + \cfmlHashSurround + +sy region cfmlDoubleQuotedValue + \ matchgroup=cfmlDoubleQuote + \ start=/"/ + \ skip=/""/ + \ end=/"/ + \ contains= + \cfmlHashSurround + +sy cluster cfmlQuotedValue + \ contains= + \cfmlDoubleQuotedValue, + \cfmlSingleQuotedValue + +sy cluster cfmlQuote + \ contains= + \cfmlDoubleQuote, + \cfmlSingleQuote +" / PUNCTUATION - QUOTE }}} + +sy cluster cfmlPunctuation + \ contains= + \@cfmlQuote, + \@cfmlQuotedValue, + \cfmlBracket, + \cfmlComma, + \cfmlDot, + \cfmlSemiColon + +" / PUNCTUATION }}} + +" TAG START AND END {{{ +" tag start +" <cf...> +" s^^ e +sy region cfmlTagStart + \ keepend + \ transparent + \ start="\c<cf_*" + \ end=">" +\ contains= + \@cfmlAttribute, + \@cfmlComment, + \@cfmlOperator, + \@cfmlParenthesisRegion, + \@cfmlPunctuation, + \@cfmlQuote, + \@cfmlQuotedValue, + \cfmlAttrEqualSign, + \cfmlBoolean, + \cfmlBrace, + \cfmlCoreKeyword, + \cfmlCoreScope, + \cfmlCustomKeyword, + \cfmlCustomScope, + \cfmlEqualSign, + \cfmlFunctionName, + \cfmlNumber, + \cfmlStorageKeyword, + \cfmlStorageType, + \cfmlTagBracket, + \cfmlTagName + +" tag end +" </cf...> +" s^^^ e +sy match cfmlTagEnd + \ transparent + \ "\c</cf_*[^>]*>" + \ contains= + \cfmlTagBracket, + \cfmlTagName + +" tag bracket +" </...> +" ^^ ^ +sy match cfmlTagBracket + \ contained + \ "\(<\|>\|\/\)" + +" tag name +" <cf...> +" s^^^e +sy match cfmlTagName + \ contained + \ "\v<\/*\zs\ccf\w*" +" / TAG START AND END }}} + +" ATTRIBUTE NAME AND VALUE {{{ +sy match cfmlAttrName + \ contained + \ "\v(var\s)@<!\w+\ze\s*\=([^\=])+" + +sy match cfmlAttrValue + \ contained + \ "\v(\=\"*)\zs\s*\w*" + +sy match cfmlAttrEqualSign + \ contained + \ "\v\=" + +sy cluster cfmlAttribute +\ contains= + \@cfmlQuotedValue, + \cfmlAttrEqualSign, + \cfmlAttrName, + \cfmlAttrValue, + \cfmlCoreKeyword, + \cfmlCoreScope +" / ATTRIBUTE NAME AND VALUE }}} + +" TAG REGION AND FOLDING {{{ + +" CFCOMPONENT REGION AND FOLD {{{ +" <cfcomponent +" s^^^^^^^^^^^ +" </cfcomponent> +" ^^^^^^^^^^^^^e +sy region cfmlComponentTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfcomponent" + \ end="\c</cfcomponent>" + +" / CFCOMPONENT REGION AND FOLD }}} + +" CFFUNCTION REGION AND FOLD {{{ +" <cffunction +" s^^^^^^^^^^ +" </cffunction> +" ^^^^^^^^^^^^e +sy region cfmlFunctionTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cffunction" + \ end="\c</cffunction>" +" / CFFUNCTION REGION AND FOLD }}} + +" CFIF REGION AND FOLD {{{ +" <cfif +" s^^^^ +" </cfif> +" ^^^^^^e +sy region cfmlIfTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfif" + \ end="\c</cfif>" +" / CFIF REGION AND FOLD }}} + +" CFLOOP REGION AND FOLD {{{ +" <cfloop +" s^^^^^^ +" </cfloop> +" ^^^^^^^^e +sy region cfmlLoopTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfloop" + \ end="\c</cfloop>" +" / CFLOOP REGION AND FOLD }}} + +" CFOUTPUT REGION AND FOLD {{{ +" <cfoutput +" s^^^^^^^^ +" </cfoutput> +" ^^^^^^^^^^e +sy region cfmlOutputTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfoutput" + \ end="\c</cfoutput>" +" / CFOUTPUT REGION AND FOLD }}} + +" CFQUERY REGION AND FOLD {{{ +" <cfquery +" s^^^^^^^ +" </cfquery> +" ^^^^^^^^^e + "\@cfmlSqlStatement, +sy region cfmlQueryTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfquery" + \ end="\c</cfquery>" + \ contains= + \@cfmlSqlStatement, + \cfmlTagStart, + \cfmlTagEnd, + \cfmlTagComment +" / CFQUERY REGION AND FOLD }}} + +" SAVECONTENT REGION AND FOLD {{{ +" <savecontent +" s^^^^^^^^^^^ +" </savecontent> +" ^^^^^^^^^^^^^e +sy region cfmlSavecontentTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfsavecontent" + \ end="\c</cfsavecontent>" +" / SAVECONTENT REGION AND FOLD }}} + +" CFSCRIPT REGION AND FOLD {{{ +" <cfscript> +" s^^^^^^^^^ +" </cfscript> +" ^^^^^^^^^^e +"\cfmlCustomScope, +sy region cfmlScriptTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfscript>" + \ end="\c</cfscript>" + \ contains= + \@cfmlComment, + \@cfmlFlowStatement, + \cfmlHashSurround, + \@cfmlOperator, + \@cfmlParenthesisRegion, + \@cfmlPunctuation, + \cfmlBoolean, + \cfmlBrace, + \cfmlCoreKeyword, + \cfmlCoreScope, + \cfmlCustomKeyword, + \cfmlCustomScope, + \cfmlEqualSign, + \cfmlFunctionDefinition, + \cfmlFunctionName, + \cfmlNumber, + \cfmlOddFunction, + \cfmlStorageKeyword, + \cfmlTagEnd, + \cfmlTagStart +" / CFSCRIPT REGION AND FOLD }}} + +" CFSWITCH REGION AND FOLD {{{ +" <cfswitch +" s^^^^^^^^ +" </cfswitch> +" ^^^^^^^^^^e +sy region cfmlSwitchTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cfswitch" + \ end="\c</cfswitch>" +" / CFSWITCH REGION AND FOLD }}} + +" CFTRANSACTION REGION AND FOLD {{{ +" <cftransaction +" s^^^^^^^^^^^^^ +" </cftransaction> +" ^^^^^^^^^^^^^^^e +sy region cfmlTransactionTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cftransaction" + \ end="\c</cftransaction>" +" / CFTRANSACTION REGION AND FOLD }}} + +" CUSTOM TAG REGION AND FOLD {{{ +" <cf_...> +" s^^^ ^ +" </cf_...> +" ^^^^^ e +sy region cfmlCustomTagRegion + \ fold + \ keepend + \ transparent + \ start="\c<cf_[^>]*>" + \ end="\c</cf_[^>]*>" +" / CUSTOM TAG REGION AND FOLD }}} + +" / TAG REGION AND FOLDING }}} + +" COMMENT {{{ + +" COMMENT BLOCK {{{ +" /*...*/ +" s^ ^e +sy region cfmlCommentBlock + \ keepend + \ start="/\*" + \ end="\*/" + \ contains= + \cfmlMetaData +" / COMMENT BLOCK }}} + +" COMMENT LINE {{{ +" //... +" s^ +sy match cfmlCommentLine + \ "\/\/.*" +" / COMMENT LINE }}} + +sy cluster cfmlComment + \ contains= + \cfmlCommentBlock, + \cfmlCommentLine +" / COMMENT }}} + +" TAG COMMENT {{{ +" <!---...---> +" s^^^^ ^^^e +sy region cfmlTagComment + \ keepend + \ start="<!---" + \ end="--->" + \ contains= + \cfmlTagComment +" / TAG COMMENT }}} + +" FLOW STATEMENT {{{ +" BRANCH FLOW KEYWORD {{{ +sy keyword cfmlBranchFlowKeyword + \ break + \ continue + \ return + +" / BRANCH KEYWORD }}} + +" DECISION FLOW KEYWORD {{{ +sy keyword cfmlDecisionFlowKeyword + \ case + \ defaultcase + \ else + \ if + \ switch + +" / DECISION FLOW KEYWORD }}} + +" LOOP FLOW KEYWORD {{{ +sy keyword cfmlLoopFlowKeyword + \ do + \ for + \ in + \ while + +" / LOOP FLOW KEYWORD }}} + +" TRY FLOW KEYWORD {{{ +sy keyword cfmlTryFlowKeyword + \ catch + \ finally + \ rethrow + \ throw + \ try + +" / TRY FLOW KEYWORD }}} + +sy cluster cfmlFlowStatement + \ contains= + \cfmlBranchFlowKeyword, + \cfmlDecisionFlowKeyword, + \cfmlLoopFlowKeyword, + \cfmlTryFlowKeyword + +" / FLOW STATEMENT }}} + +" STORAGE KEYWORD {{{ +sy keyword cfmlStorageKeyword + \ var +" / STORAGE KEYWORD }}} + +" STORAGE TYPE {{{ +sy match cfmlStorageType + \ contained + \ "\v< + \(any + \|array + \|binary + \|boolean + \|date + \|numeric + \|query + \|string + \|struct + \|uuid + \|void + \|xml + \){1}\ze(\s*\=)@!" +" / STORAGE TYPE }}} + +" CORE KEYWORD {{{ +sy match cfmlCoreKeyword + \ "\v< + \(new + \|required + \)\ze\s" +" / CORE KEYWORD }}} + +" CORE SCOPE {{{ +sy match cfmlCoreScope + \ "\v< + \(application + \|arguments + \|attributes + \|caller + \|cfcatch + \|cffile + \|cfhttp + \|cgi + \|client + \|cookie + \|form + \|local + \|request + \|server + \|session + \|super + \|this + \|thisTag + \|thread + \|variables + \|url + \){1}\ze(,|\.|\[|\)|\s)" +" / CORE SCOPE }}} + +" SQL STATEMENT {{{ +sy cluster cfmlSqlStatement + \ contains= + \@cfmlParenthesisRegion, + \@cfmlQuote, + \@cfmlQuotedValue, + \@sqlSyntax, + \cfmlBoolean, + \cfmlDot, + \cfmlEqualSign, + \cfmlFunctionName, + \cfmlHashSurround, + \cfmlNumber +" / SQL STATEMENT }}} + +" TAG IN SCRIPT {{{ +sy match cfmlTagNameInScript + \ "\vcf_*\w+\s*\ze\(" +" / TAG IN SCRIPT }}} + +" METADATA {{{ +sy region cfmlMetaData + \ contained + \ keepend + \ start="@\w\+" + \ end="$" + \ contains= + \cfmlMetaDataName + +sy match cfmlMetaDataName + \ contained + \ "@\w\+" +" / METADATA }}} + +" COMPONENT DEFINITION {{{ +sy region cfmlComponentDefinition + \ start="component" + \ end="{"me=e-1 + \ contains= + \@cfmlAttribute, + \cfmlComponentKeyword + +sy match cfmlComponentKeyword + \ contained + \ "\v<component>" +" / COMPONENT DEFINITION }}} + +" INTERFACE DEFINITION {{{ +sy match cfmlInterfaceDefinition + \ "interface\s.*{"me=e-1 + \ contains= + \cfmlInterfaceKeyword + +sy match cfmlInterfaceKeyword + \ contained + \ "\v<interface>" +" / INTERFACE DEFINITION }}} + +" PROPERTY {{{ +sy region cfmlProperty + \ transparent + \ start="\v<property>" + \ end=";"me=e-1 + \ contains= + \@cfmlQuotedValue, + \cfmlAttrEqualSign, + \cfmlAttrName, + \cfmlAttrValue, + \cfmlPropertyKeyword + +sy match cfmlPropertyKeyword + \ contained + \ "\v<property>" +" / PROPERTY }}} + +" FUNCTION DEFINITION {{{ +sy match cfmlFunctionDefinition + \ "\v + \(<(public|private|package)\s){,1} + \(< + \(any + \|array + \|binary + \|boolean + \|date + \|numeric + \|query + \|string + \|struct + \|uuid + \|void + \|xml + \)\s){,1} + \<function\s\w+\s*\("me=e-1 + \ contains= + \cfmlFunctionKeyword, + \cfmlFunctionModifier, + \cfmlFunctionName, + \cfmlFunctionReturnType + +" FUNCTION KEYWORD {{{ +sy match cfmlFunctionKeyword + \ contained + \ "\v<function>" +" / FUNCTION KEYWORD }}} + +" FUNCTION MODIFIER {{{ +sy match cfmlFunctionModifier + \ contained + \ "\v< + \(public + \|private + \|package + \)>" +" / FUNCTION MODIFIER }}} + +" FUNCTION RETURN TYPE {{{ +sy match cfmlFunctionReturnType + \ contained + \ "\v + \(any + \|array + \|binary + \|boolean + \|date + \|numeric + \|query + \|string + \|struct + \|uuid + \|void + \|xml + \)" +" / FUNCTION RETURN TYPE }}} + +" FUNCTION NAME {{{ +" specific regex for core functions decreases performance +" so use the same highlighting for both function types +sy match cfmlFunctionName + \ "\v<(cf|if|elseif|throw)@!\w+\s*\ze\(" +" / FUNCTION NAME }}} + +" / FUNCTION DEFINITION }}} + +" ODD FUNCTION {{{ +sy region cfmlOddFunction + \ transparent + \ start="\v< + \(abort + \|exit + \|import + \|include + \|lock + \|pageencoding + \|param + \|savecontent + \|thread + \|transaction + \){1}" + \ end="\v(\{|;)"me=e-1 + \ contains= + \@cfmlQuotedValue, + \cfmlAttrEqualSign, + \cfmlAttrName, + \cfmlAttrValue, + \cfmlCoreKeyword, + \cfmlOddFunctionKeyword, + \cfmlCoreScope + +" ODD FUNCTION KEYWORD {{{ +sy match cfmlOddFunctionKeyword + \ contained + \ "\v< + \(abort + \|exit + \|import + \|include + \|lock + \|pageencoding + \|param + \|savecontent + \|thread + \|transaction + \)\ze(\s|$|;)" +" / ODD FUNCTION KEYWORD }}} + +" / ODD FUNCTION }}} + +" CUSTOM {{{ + +" CUSTOM KEYWORD {{{ +sy match cfmlCustomKeyword + \ contained + \ "\v< + \(customKeyword1 + \|customKeyword2 + \|customKeyword3 + \)>" +" / CUSTOM KEYWORD }}} + +" CUSTOM SCOPE {{{ +sy match cfmlCustomScope + \ contained + \ "\v< + \(prc + \|rc + \|event + \|(\w+Service) + \){1}\ze(\.|\[)" +" / CUSTOM SCOPE }}} + +" / CUSTOM }}} + +" SGML TAG START AND END {{{ +" SGML tag start +" <...> +" s^^^e +sy region cfmlSGMLTagStart + \ keepend + \ transparent + \ start="\v(\<cf)@!\zs\<\w+" + \ end=">" + \ contains= + \@cfmlAttribute, + \@cfmlComment, + \@cfmlOperator, + \@cfmlParenthesisRegion, + \@cfmlPunctuation, + \@cfmlQuote, + \@cfmlQuotedValue, + \cfmlAttrEqualSign, + \cfmlBoolean, + \cfmlBrace, + \cfmlCoreKeyword, + \cfmlCoreScope, + \cfmlCustomKeyword, + \cfmlCustomScope, + \cfmlEqualSign, + \cfmlFunctionName, + \cfmlNumber, + \cfmlStorageKeyword, + \cfmlStorageType, + \cfmlTagBracket, + \cfmlSGMLTagName + +" SGML tag end +" </...> +" s^^^^e +sy match cfmlSGMLTagEnd + \ transparent + \ "\v(\<\/cf)@!\zs\<\/\w+\>" + \ contains= + \cfmlTagBracket, + \cfmlSGMLTagName + +" SGML tag name +" <...> +" s^^^e +sy match cfmlSGMLTagName + \ contained + \ "\v(\<\/*)\zs\w+" + +" / SGML TAG START AND END }}} + +" HIGHLIGHTING {{{ + +hi link cfmlNumber Number +hi link cfmlBoolean Boolean +hi link cfmlEqualSign Keyword +" HASH SURROUND +hi link cfmlHash PreProc +hi link cfmlHashSurround PreProc +" OPERATOR +hi link cfmlArithmeticOperator Function +hi link cfmlBooleanOperator Function +hi link cfmlDecisionOperator Function +hi link cfmlStringOperator Function +hi link cfmlTernaryOperator Function +" PARENTHESIS +hi link cfmlParenthesis1 Statement +hi link cfmlParenthesis2 String +hi link cfmlParenthesis3 Delimiter +" BRACE +hi link cfmlBrace PreProc +" PUNCTUATION - BRACKET +hi link cfmlBracket Statement +" PUNCTUATION - CHAR +hi link cfmlComma Comment +hi link cfmlDot Comment +hi link cfmlSemiColon Comment +" PUNCTUATION - QUOTE +hi link cfmlDoubleQuote String +hi link cfmlDoubleQuotedValue String +hi link cfmlSingleQuote String +hi link cfmlSingleQuotedValue String +" TAG START AND END +hi link cfmlTagName Function +hi link cfmlTagBracket Comment +" ATTRIBUTE NAME AND VALUE +hi link cfmlAttrName Type +hi link cfmlAttrValue Special +" COMMENT +hi link cfmlCommentBlock Comment +hi link cfmlCommentLine Comment +hi link cfmlTagComment Comment +" FLOW STATEMENT +hi link cfmlDecisionFlowKeyword Conditional +hi link cfmlLoopFlowKeyword Repeat +hi link cfmlTryFlowKeyword Exception +hi link cfmlBranchFlowKeyword Keyword +" STORAGE KEYWORD +hi link cfmlStorageKeyword Keyword +" STORAGE TYPE +hi link cfmlStorageType Keyword +" CORE KEYWORD +hi link cfmlCoreKeyword PreProc +" CORE SCOPE +hi link cfmlCoreScope Keyword +" TAG IN SCRIPT +hi link cfmlTagNameInScript Function +" METADATA +" meta data value = cfmlMetaData +hi link cfmlMetaData String +hi link cfmlMetaDataName Type +" COMPONENT DEFINITION +hi link cfmlComponentKeyword Keyword +" INTERFACE DEFINITION +hi link cfmlInterfaceKeyword Keyword +" PROPERTY +hi link cfmlPropertyKeyword Keyword +" FUNCTION DEFINITION +hi link cfmlFunctionKeyword Keyword +hi link cfmlFunctionModifier Keyword +hi link cfmlFunctionReturnType Keyword +hi link cfmlFunctionName Function +" ODD FUNCTION +hi link cfmlOddFunctionKeyword Function +" CUSTOM +hi link cfmlCustomKeyword Keyword +hi link cfmlCustomScope Structure +" SGML TAG +hi link cfmlSGMLTagName Ignore + +" / HIGHLIGHTING }}} + +let b:current_syntax = "cfml" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/cfg.vim b/runtime/syntax/cfg.vim index b82fb26fc0..a50297d418 100644 --- a/runtime/syntax/cfg.vim +++ b/runtime/syntax/cfg.vim @@ -3,11 +3,8 @@ " Maintainer: Igor N. Prischepoff (igor@tyumbit.ru, pri_igor@mail.ru) " Last change: 2012 Aug 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists ("b:current_syntax") +" quit when a syntax file was already loaded +if exists ("b:current_syntax") finish endif @@ -36,25 +33,16 @@ syn match CfgComment ";.*" syn match CfgComment "\/\/.*" " Define the default hightlighting. -" 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_cfg_syn_inits") - if version < 508 - let did_cfg_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink CfgOnOff Label - HiLink CfgComment Comment - HiLink CfgSection Type - HiLink CfgString String - HiLink CfgParams Keyword - HiLink CfgValues Constant - HiLink CfgDirectory Directory - HiLink UncPath Directory - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link CfgOnOff Label +hi def link CfgComment Comment +hi def link CfgSection Type +hi def link CfgString String +hi def link CfgParams Keyword +hi def link CfgValues Constant +hi def link CfgDirectory Directory +hi def link UncPath Directory + + let b:current_syntax = "cfg" " vim:ts=8 diff --git a/runtime/syntax/ch.vim b/runtime/syntax/ch.vim index add7395093..61f475bc99 100644 --- a/runtime/syntax/ch.vim +++ b/runtime/syntax/ch.vim @@ -8,21 +8,14 @@ " Ch is a C/C++ interpreter with many high level extensions " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - so <sfile>:p:h/c.vim -else - runtime! syntax/c.vim - unlet b:current_syntax -endif +runtime! syntax/c.vim +unlet b:current_syntax " Ch extentions @@ -33,20 +26,12 @@ syn keyword chStructure class syn keyword chType string_t array " Default highlighting -if version >= 508 || !exists("did_ch_syntax_inits") - if version < 508 - let did_ch_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink chAccess chStatement - HiLink chExceptions Exception - HiLink chStatement Statement - HiLink chType Type - HiLink chStructure Structure - delcommand HiLink -endif + +hi def link chAccess chStatement +hi def link chExceptions Exception +hi def link chStatement Statement +hi def link chType Type +hi def link chStructure Structure let b:current_syntax = "ch" diff --git a/runtime/syntax/change.vim b/runtime/syntax/change.vim index e9bf88b9d6..a92767e903 100644 --- a/runtime/syntax/change.vim +++ b/runtime/syntax/change.vim @@ -7,11 +7,8 @@ " in the articles by Donald E. Knuth and Silvio Levy cited in "web.vim" and " "cweb.vim" respectively. -" 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 @@ -21,21 +18,11 @@ syn region changeFromMaterial start="^@x.*$"ms=e+1 end="^@y.*$"me=s-1 syn region changeToMaterial start="^@y.*$"ms=e+1 end="^@z.*$"me=s-1 " 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_change_syntax_inits") - if version < 508 - let did_change_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink changeFromMaterial String - HiLink changeToMaterial Statement - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link changeFromMaterial String +hi def link changeToMaterial Statement + let b:current_syntax = "change" diff --git a/runtime/syntax/changelog.vim b/runtime/syntax/changelog.vim index 33d31ba466..cf9021ef05 100644 --- a/runtime/syntax/changelog.vim +++ b/runtime/syntax/changelog.vim @@ -4,11 +4,8 @@ " Maintainer: Corinna Vinschen <vinschen@redhat.com> " Last Change: June 1, 2003 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -28,17 +25,12 @@ endif syn match changelogText "^\s.*$" contains=changelogMail,changelogNumber,changelogMonth,changelogDay,changelogError syn match changelogHeader "^\S.*$" contains=changelogNumber,changelogMonth,changelogDay,changelogMail -if version < 600 - syn region changelogFiles start="^\s\+[+*]\s" end=":\s" end="^$" contains=changelogBullet,changelogColon,changelogError keepend - syn region changelogFiles start="^\s\+[([]" end=":\s" end="^$" contains=changelogBullet,changelogColon,changelogError keepend - syn match changelogColon contained ":\s" -else - syn region changelogFiles start="^\s\+[+*]\s" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend - syn region changelogFiles start="^\s\+[([]" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend - syn match changelogFuncs contained "(.\{-})" extend - syn match changelogFuncs contained "\[.\{-}]" extend - syn match changelogColon contained ":" -endif +syn region changelogFiles start="^\s\+[+*]\s" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend +syn region changelogFiles start="^\s\+[([]" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend +syn match changelogFuncs contained "(.\{-})" extend +syn match changelogFuncs contained "\[.\{-}]" extend +syn match changelogColon contained ":" + syn match changelogBullet contained "^\s\+[+*]\s" contains=changelogError syn match changelogMail contained "<[A-Za-z0-9\._:+-]\+@[A-Za-z0-9\._-]\+>" syn keyword changelogMonth contained jan feb mar apr may jun jul aug sep oct nov dec @@ -46,32 +38,20 @@ syn keyword changelogDay contained mon tue wed thu fri sat sun syn match changelogNumber contained "[.-]*[0-9]\+" " 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_changelog_syntax_inits") - if version < 508 - let did_changelog_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link changelogText Normal +hi def link changelogBullet Type +hi def link changelogColon Type +hi def link changelogFiles Comment +hi def link changelogFuncs Comment +hi def link changelogHeader Statement +hi def link changelogMail Special +hi def link changelogNumber Number +hi def link changelogMonth Number +hi def link changelogDay Number +hi def link changelogError Folded - HiLink changelogText Normal - HiLink changelogBullet Type - HiLink changelogColon Type - HiLink changelogFiles Comment - if version >= 600 - HiLink changelogFuncs Comment - endif - HiLink changelogHeader Statement - HiLink changelogMail Special - HiLink changelogNumber Number - HiLink changelogMonth Number - HiLink changelogDay Number - HiLink changelogError Folded - - delcommand HiLink -endif let b:current_syntax = "changelog" diff --git a/runtime/syntax/chaskell.vim b/runtime/syntax/chaskell.vim index 3f764d0e8a..4b1e8c53be 100644 --- a/runtime/syntax/chaskell.vim +++ b/runtime/syntax/chaskell.vim @@ -9,10 +9,6 @@ let b:hs_chs=1 " Include standard Haskell highlighting -if version < 600 - source <sfile>:p:h/haskell.vim -else - runtime! syntax/haskell.vim -endif +runtime! syntax/haskell.vim " vim: ts=8 diff --git a/runtime/syntax/cheetah.vim b/runtime/syntax/cheetah.vim index 7eb17567cf..9567ecbbca 100644 --- a/runtime/syntax/cheetah.vim +++ b/runtime/syntax/cheetah.vim @@ -8,11 +8,8 @@ " PSP-style tags: <% .. %> (obsoleted feature) " doc-strings and header comments (rarely used feature) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -36,25 +33,15 @@ syn match cheetahComment "##.*$" display syn region cheetahMultiLineComment start="#\*" end="\*#" " 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_cheetah_syn_inits") - if version < 508 - let did_cheetah_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink cheetahPlaceHolder Identifier - HiLink cheetahDirective PreCondit - HiLink cheetahKeyword Define - HiLink cheetahContinuation Special - HiLink cheetahComment Comment - HiLink cheetahMultiLineComment Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link cheetahPlaceHolder Identifier +hi def link cheetahDirective PreCondit +hi def link cheetahKeyword Define +hi def link cheetahContinuation Special +hi def link cheetahComment Comment +hi def link cheetahMultiLineComment Comment + let b:current_syntax = "cheetah" diff --git a/runtime/syntax/chicken.vim b/runtime/syntax/chicken.vim new file mode 100644 index 0000000000..c3f949f823 --- /dev/null +++ b/runtime/syntax/chicken.vim @@ -0,0 +1,77 @@ +" Vim syntax file +" Language: Scheme (CHICKEN) +" Last Change: 2018-02-05 +" Author: Evan Hanson <evhan@foldling.org> +" Maintainer: Evan Hanson <evhan@foldling.org> +" URL: https://foldling.org/vim/syntax/chicken.vim +" Notes: This is supplemental syntax, to be loaded after the core Scheme +" syntax file (syntax/scheme.vim). Enable it by setting b:is_chicken=1 +" and filetype=scheme. + +" Only to be used on top of the Scheme syntax. +if !exists('b:did_scheme_syntax') + finish +endif + +" Lighten parentheses. +hi! def link schemeParentheses Comment + +" foo#bar +syn match schemeExtraSyntax /[^ #'`\t\n()\[\]"|;]\+#[^ '`\t\n()\[\]"|;]\+/ + +" ##foo#bar +syn match schemeExtraSyntax /##[^ '`\t\n()\[\]"|;]\+/ + +" Heredocs. +syn region schemeString start=/#<[<#]\s*\z(.*\)/ end=/^\z1$/ + +" Keywords. +syn match schemeKeyword /#[!:][a-zA-Z0-9!$%&*+-./:<=>?@^_~#]\+/ +syn match schemeKeyword /[a-zA-Z0-9!$%&*+-./:<=>?@^_~#]\+:\>/ + +" C/C++ syntax. +let s:c = globpath(&rtp, 'syntax/cpp.vim', 0, 1) +if len(s:c) + exe 'syn include @c ' s:c[0] + syn region c matchgroup=schemeComment start=/#>/ end=/<#/ contains=@c +endif + +syn keyword schemeSyntax define-record + +syn keyword schemeLibrarySyntax declare +syn keyword schemeLibrarySyntax module +syn keyword schemeLibrarySyntax reexport +syn keyword schemeLibrarySyntax require-library + +syn keyword schemeTypeSyntax --> +syn keyword schemeTypeSyntax -> +syn keyword schemeTypeSyntax : +syn keyword schemeTypeSyntax assume +syn keyword schemeTypeSyntax compiler-typecase +syn keyword schemeTypeSyntax define-specialization +syn keyword schemeTypeSyntax define-type +syn keyword schemeTypeSyntax the + +syn keyword schemeExtraSyntax and-let* +syn keyword schemeExtraSyntax match +syn keyword schemeExtraSyntax match-lambda +syn keyword schemeExtraSyntax match-lambda* + +syn keyword schemeSpecialSyntax define-compiler-syntax +syn keyword schemeSpecialSyntax define-constant +syn keyword schemeSpecialSyntax define-external +syn keyword schemeSpecialSyntax define-inline +syn keyword schemeSpecialSyntax foreign-code +syn keyword schemeSpecialSyntax foreign-declare +syn keyword schemeSpecialSyntax foreign-lambda +syn keyword schemeSpecialSyntax foreign-lambda* +syn keyword schemeSpecialSyntax foreign-primitive +syn keyword schemeSpecialSyntax foreign-safe-lambda +syn keyword schemeSpecialSyntax foreign-safe-lambda* +syn keyword schemeSpecialSyntax foreign-value + +syn keyword schemeSyntaxSyntax begin-for-syntax +syn keyword schemeSyntaxSyntax define-for-syntax +syn keyword schemeSyntaxSyntax er-macro-transformer +syn keyword schemeSyntaxSyntax ir-macro-transformer +syn keyword schemeSyntaxSyntax require-library-for-syntax diff --git a/runtime/syntax/chill.vim b/runtime/syntax/chill.vim index ca00cd95e8..f3c66c2b4d 100644 --- a/runtime/syntax/chill.vim +++ b/runtime/syntax/chill.vim @@ -11,11 +11,8 @@ " & Communications LTd.) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -124,67 +121,57 @@ endif exec "syn sync ccomment chillComment minlines=" . chill_minlines " 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_ch_syntax_inits") - if version < 508 - let did_ch_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink chillLabel Label - HiLink chillUserLabel Label - HiLink chillConditional Conditional - " hi chillConditional term=bold ctermfg=red guifg=red gui=bold - - HiLink chillRepeat Repeat - HiLink chillProcess Repeat - HiLink chillSignal Repeat - HiLink chillCharacter Character - HiLink chillSpecialCharacter chillSpecial - HiLink chillNumber Number - HiLink chillFloat Float - HiLink chillOctalError chillError - HiLink chillParenError chillError - HiLink chillInParen chillError - HiLink chillCommentError chillError - HiLink chillSpaceError chillError - HiLink chillOperator Operator - HiLink chillStructure Structure - HiLink chillBlock Operator - HiLink chillScope Operator - "hi chillEDML term=underline ctermfg=DarkRed guifg=Red - HiLink chillEDML PreProc - "hi chillBoolConst term=bold ctermfg=brown guifg=brown - HiLink chillBoolConst Constant - "hi chillLogical term=bold ctermfg=brown guifg=brown - HiLink chillLogical Constant - HiLink chillStorageClass StorageClass - HiLink chillInclude Include - HiLink chillPreProc PreProc - HiLink chillDefine Macro - HiLink chillIncluded chillString - HiLink chillError Error - HiLink chillStatement Statement - HiLink chillPreCondit PreCondit - HiLink chillType Type - HiLink chillCommentError chillError - HiLink chillCommentString chillString - HiLink chillComment2String chillString - HiLink chillCommentSkip chillComment - HiLink chillString String - HiLink chillComment Comment - " hi chillComment term=None ctermfg=lightblue guifg=lightblue - HiLink chillSpecial SpecialChar - HiLink chillTodo Todo - HiLink chillBlock Statement - "HiLink chillIdentifier Identifier - HiLink chillBracket Delimiter - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link chillLabel Label +hi def link chillUserLabel Label +hi def link chillConditional Conditional +" hi def link chillConditional term=bold ctermfg=red guifg=red gui=bold + +hi def link chillRepeat Repeat +hi def link chillProcess Repeat +hi def link chillSignal Repeat +hi def link chillCharacter Character +hi def link chillSpecialCharacter chillSpecial +hi def link chillNumber Number +hi def link chillFloat Float +hi def link chillOctalError chillError +hi def link chillParenError chillError +hi def link chillInParen chillError +hi def link chillCommentError chillError +hi def link chillSpaceError chillError +hi def link chillOperator Operator +hi def link chillStructure Structure +hi def link chillBlock Operator +hi def link chillScope Operator +"hi def link chillEDML term=underline ctermfg=DarkRed guifg=Red +hi def link chillEDML PreProc +"hi def link chillBoolConst term=bold ctermfg=brown guifg=brown +hi def link chillBoolConst Constant +"hi def link chillLogical term=bold ctermfg=brown guifg=brown +hi def link chillLogical Constant +hi def link chillStorageClass StorageClass +hi def link chillInclude Include +hi def link chillPreProc PreProc +hi def link chillDefine Macro +hi def link chillIncluded chillString +hi def link chillError Error +hi def link chillStatement Statement +hi def link chillPreCondit PreCondit +hi def link chillType Type +hi def link chillCommentError chillError +hi def link chillCommentString chillString +hi def link chillComment2String chillString +hi def link chillCommentSkip chillComment +hi def link chillString String +hi def link chillComment Comment +" hi def link chillComment term=None ctermfg=lightblue guifg=lightblue +hi def link chillSpecial SpecialChar +hi def link chillTodo Todo +hi def link chillBlock Statement +"hi def link chillIdentifier Identifier +hi def link chillBracket Delimiter + let b:current_syntax = "chill" diff --git a/runtime/syntax/cl.vim b/runtime/syntax/cl.vim index 41c045fb09..b765682547 100644 --- a/runtime/syntax/cl.vim +++ b/runtime/syntax/cl.vim @@ -10,19 +10,12 @@ " Version: 6 " Last Change: Mar 06 2013 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,- -else - set iskeyword=@,48-57,_,- -endif +setlocal iskeyword=@,48-57,_,- syn case ignore @@ -75,40 +68,30 @@ syn keyword clFunction asc asize chr name random slen srandom day getarg getcgi syn keyword clStatement clear clear_eol clear_eos close copy create unique with where empty define define ldefine delay_form delete escape exit_block exit_do exit_process field fork format get getfile getnext getprev goto head join maintain message no_join on_eop on_key on_exit on_delete openin openout openapp pause popenin popenout popenio print put range read redisplay refresh restart_block screen select sleep text unlock write and not or do " 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_cl_syntax_inits") - if version < 508 - let did_cl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink clifError Error - HiLink clSpaceError Error - HiLink clWhile Repeat - HiLink clConditional Conditional - HiLink clDebug Debug - HiLink clNeedsWork Todo - HiLink clTodo Todo - HiLink clComment Comment - HiLink clProcedure Procedure - HiLink clBreak Procedure - HiLink clInclude Include - HiLink clSetOption Statement - HiLink clSet Identifier - HiLink clPreProc PreProc - HiLink clOperator Operator - HiLink clNumber Number - HiLink clString String - HiLink clQuote Delimiter - HiLink clReserved Identifier - HiLink clFunction Function - HiLink clStatement Statement - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link clifError Error +hi def link clSpaceError Error +hi def link clWhile Repeat +hi def link clConditional Conditional +hi def link clDebug Debug +hi def link clNeedsWork Todo +hi def link clTodo Todo +hi def link clComment Comment +hi def link clProcedure Procedure +hi def link clBreak Procedure +hi def link clInclude Include +hi def link clSetOption Statement +hi def link clSet Identifier +hi def link clPreProc PreProc +hi def link clOperator Operator +hi def link clNumber Number +hi def link clString String +hi def link clQuote Delimiter +hi def link clReserved Identifier +hi def link clFunction Function +hi def link clStatement Statement + let b:current_syntax = "cl" diff --git a/runtime/syntax/clean.vim b/runtime/syntax/clean.vim index ea95aa209e..70bf654fb7 100644 --- a/runtime/syntax/clean.vim +++ b/runtime/syntax/clean.vim @@ -4,11 +4,8 @@ " Co-Author: Arthur van Leeuwen <arthurvl@sci.kun.nl> " Last Change: 2013 Oct 15 by Jurriën Stutterheim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -52,49 +49,39 @@ syn match cleanFuncTypeDef "\([a-zA-Z].*\|(\=[-~@#$%^?!+*<>\/|&=:]\+)\=\)\s*\(in " 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_clean_syntax_init") - if version < 508 - let did_clean_syntax_init = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - " Comments - HiLink cleanComment Comment - " Constants and denotations - HiLink cleanStringDenot String - HiLink cleanCharDenot Character - HiLink cleanIntegerDenot Number - HiLink cleanBoolDenot Boolean - HiLink cleanRealDenot Float - " Identifiers - " Statements - HiLink cleanTypeClass Keyword - HiLink cleanConditional Conditional - HiLink cleanLabel Label - HiLink cleanKeyword Keyword - " Generic Preprocessing - HiLink cleanIncludeKeyword Include - HiLink cleanModuleSystem PreProc - " Type - HiLink cleanBasicType Type - HiLink cleanSpecialType Type - HiLink cleanFuncTypeDef Typedef - " Special - HiLink cleanSpecial Special - HiLink cleanList Special - HiLink cleanArray Special - HiLink cleanRecord Special - HiLink cleanTuple Special - " Error - " Todo - HiLink cleanTodo Todo + " Comments + hi def link cleanComment Comment + " Constants and denotations + hi def link cleanStringDenot String + hi def link cleanCharDenot Character + hi def link cleanIntegerDenot Number + hi def link cleanBoolDenot Boolean + hi def link cleanRealDenot Float + " Identifiers + " Statements + hi def link cleanTypeClass Keyword + hi def link cleanConditional Conditional + hi def link cleanLabel Label + hi def link cleanKeyword Keyword + " Generic Preprocessing + hi def link cleanIncludeKeyword Include + hi def link cleanModuleSystem PreProc + " Type + hi def link cleanBasicType Type + hi def link cleanSpecialType Type + hi def link cleanFuncTypeDef Typedef + " Special + hi def link cleanSpecial Special + hi def link cleanList Special + hi def link cleanArray Special + hi def link cleanRecord Special + hi def link cleanTuple Special + " Error + " Todo + hi def link cleanTodo Todo - delcommand HiLink -endif let b:current_syntax = "clean" diff --git a/runtime/syntax/clipper.vim b/runtime/syntax/clipper.vim index 1a10a2dca2..203f9f05e0 100644 --- a/runtime/syntax/clipper.vim +++ b/runtime/syntax/clipper.vim @@ -4,11 +4,8 @@ " Some things based on c.vim by Bram Moolenaar and pascal.vim by Mario Eusebio " Last Change: 2011 Dec 29 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -114,32 +111,22 @@ syntax match clipperComment "^\*.*" " 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_clipper_syntax_inits") - if version < 508 - let did_clipper_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink clipperConditional Conditional - HiLink clipperRepeat Repeat - HiLink clipperNumber Number - HiLink clipperInclude Include - HiLink clipperComment Comment - HiLink clipperOperator Operator - HiLink clipperStorageClass StorageClass - HiLink clipperStatement Statement - HiLink clipperString String - HiLink clipperFunction Function - HiLink clipperLineContinuation Special - HiLink clipperDelimiters Delimiter - HiLink clipperUserVariable Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link clipperConditional Conditional +hi def link clipperRepeat Repeat +hi def link clipperNumber Number +hi def link clipperInclude Include +hi def link clipperComment Comment +hi def link clipperOperator Operator +hi def link clipperStorageClass StorageClass +hi def link clipperStatement Statement +hi def link clipperString String +hi def link clipperFunction Function +hi def link clipperLineContinuation Special +hi def link clipperDelimiters Delimiter +hi def link clipperUserVariable Identifier + let b:current_syntax = "clipper" diff --git a/runtime/syntax/clojure.vim b/runtime/syntax/clojure.vim index 4dc1cde05c..2b48146b5a 100644 --- a/runtime/syntax/clojure.vim +++ b/runtime/syntax/clojure.vim @@ -1,37 +1,68 @@ " Vim syntax file -" Language: Clojure -" Authors: Toralf Wittner <toralf.wittner@gmail.com> -" modified by Meikel Brandmeyer <mb@kotka.de> -" URL: http://kotka.de/projects/clojure/vimclojure.html +" Language: Clojure +" Authors: Toralf Wittner <toralf.wittner@gmail.com> +" modified by Meikel Brandmeyer <mb@kotka.de> +" URL: http://kotka.de/projects/clojure/vimclojure.html " -" Contributors: Joel Holdbrooks <cjholdbrooks@gmail.com> (Regexp support, bug fixes) +" Contributors: Joel Holdbrooks <cjholdbrooks@gmail.com> (Regexp support, bug fixes) " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:current_syntax") finish endif +let s:cpo_sav = &cpo +set cpo&vim + if has("folding") && exists("g:clojure_fold") && g:clojure_fold > 0 setlocal foldmethod=syntax endif " -*- KEYWORDS -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj -" Clojure version 1.6.0 -syntax keyword clojureConstant nil -syntax keyword clojureBoolean false true -syntax keyword clojureSpecial . catch clojure.core/fn clojure.core/let clojure.core/loop def do finally fn if let loop monitor-enter monitor-exit new quote recur set! throw try var -syntax keyword clojureException catch finally throw try -syntax keyword clojureCond case clojure.core/case clojure.core/cond clojure.core/cond-> clojure.core/cond->> clojure.core/condp clojure.core/if-let clojure.core/if-not clojure.core/if-some clojure.core/when clojure.core/when-first clojure.core/when-let clojure.core/when-not clojure.core/when-some cond cond-> cond->> condp if-let if-not if-some when when-first when-let when-not when-some -syntax keyword clojureRepeat clojure.core/doseq clojure.core/dotimes clojure.core/while doseq dotimes while -syntax keyword clojureDefine clojure.core/definline clojure.core/definterface clojure.core/defmacro clojure.core/defmethod clojure.core/defmulti clojure.core/defn clojure.core/defn- clojure.core/defonce clojure.core/defprotocol clojure.core/defrecord clojure.core/defstruct clojure.core/deftype definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype -syntax keyword clojureMacro -> ->> .. amap and areduce as-> assert binding bound-fn clojure.core/-> clojure.core/->> clojure.core/.. clojure.core/amap clojure.core/and clojure.core/areduce clojure.core/as-> clojure.core/assert clojure.core/binding clojure.core/bound-fn clojure.core/comment clojure.core/declare clojure.core/delay clojure.core/dosync clojure.core/doto clojure.core/extend-protocol clojure.core/extend-type clojure.core/for clojure.core/future clojure.core/gen-class clojure.core/gen-interface clojure.core/import clojure.core/io! clojure.core/lazy-cat clojure.core/lazy-seq clojure.core/letfn clojure.core/locking clojure.core/memfn clojure.core/ns clojure.core/or clojure.core/proxy clojure.core/proxy-super clojure.core/pvalues clojure.core/refer-clojure clojure.core/reify clojure.core/some-> clojure.core/some->> clojure.core/sync clojure.core/time clojure.core/with-bindings clojure.core/with-in-str clojure.core/with-loading-context clojure.core/with-local-vars clojure.core/with-open clojure.core/with-out-str clojure.core/with-precision clojure.core/with-redefs comment declare delay dosync doto extend-protocol extend-type for future gen-class gen-interface import io! lazy-cat lazy-seq letfn locking memfn ns or proxy proxy-super pvalues refer-clojure reify some-> some->> sync time with-bindings with-in-str with-loading-context with-local-vars with-open with-out-str with-precision with-redefs -syntax keyword clojureFunc * *' + +' - -' ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods / < <= = == > >= accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root ancestors apply array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn* bound? butlast byte byte-array bytes cast char char-array char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version clojure.core/* clojure.core/*' clojure.core/+ clojure.core/+' clojure.core/- clojure.core/-' clojure.core/->ArrayChunk clojure.core/->Vec clojure.core/->VecNode clojure.core/->VecSeq clojure.core/-cache-protocol-fn clojure.core/-reset-methods clojure.core// clojure.core/< clojure.core/<= clojure.core/= clojure.core/== clojure.core/> clojure.core/>= clojure.core/accessor clojure.core/aclone clojure.core/add-classpath clojure.core/add-watch clojure.core/agent clojure.core/agent-error clojure.core/agent-errors clojure.core/aget clojure.core/alength clojure.core/alias clojure.core/all-ns clojure.core/alter clojure.core/alter-meta! clojure.core/alter-var-root clojure.core/ancestors clojure.core/apply clojure.core/array-map clojure.core/aset clojure.core/aset-boolean clojure.core/aset-byte clojure.core/aset-char clojure.core/aset-double clojure.core/aset-float clojure.core/aset-int clojure.core/aset-long clojure.core/aset-short clojure.core/assoc clojure.core/assoc! clojure.core/assoc-in clojure.core/associative? clojure.core/atom clojure.core/await clojure.core/await-for clojure.core/await1 clojure.core/bases clojure.core/bean clojure.core/bigdec clojure.core/bigint clojure.core/biginteger clojure.core/bit-and clojure.core/bit-and-not clojure.core/bit-clear clojure.core/bit-flip clojure.core/bit-not clojure.core/bit-or clojure.core/bit-set clojure.core/bit-shift-left clojure.core/bit-shift-right clojure.core/bit-test clojure.core/bit-xor clojure.core/boolean clojure.core/boolean-array clojure.core/booleans clojure.core/bound-fn* clojure.core/bound? clojure.core/butlast clojure.core/byte clojure.core/byte-array clojure.core/bytes clojure.core/cast clojure.core/char clojure.core/char-array clojure.core/char? clojure.core/chars clojure.core/chunk clojure.core/chunk-append clojure.core/chunk-buffer clojure.core/chunk-cons clojure.core/chunk-first clojure.core/chunk-next clojure.core/chunk-rest clojure.core/chunked-seq? clojure.core/class clojure.core/class? clojure.core/clear-agent-errors clojure.core/clojure-version clojure.core/coll? clojure.core/commute clojure.core/comp clojure.core/comparator clojure.core/compare clojure.core/compare-and-set! clojure.core/compile clojure.core/complement clojure.core/concat clojure.core/conj clojure.core/conj! clojure.core/cons clojure.core/constantly clojure.core/construct-proxy clojure.core/contains? clojure.core/count clojure.core/counted? clojure.core/create-ns clojure.core/create-struct clojure.core/cycle clojure.core/dec clojure.core/dec' clojure.core/decimal? clojure.core/delay? clojure.core/deliver clojure.core/denominator clojure.core/deref clojure.core/derive clojure.core/descendants clojure.core/destructure clojure.core/disj clojure.core/disj! clojure.core/dissoc clojure.core/dissoc! clojure.core/distinct clojure.core/distinct? clojure.core/doall clojure.core/dorun clojure.core/double clojure.core/double-array clojure.core/doubles clojure.core/drop clojure.core/drop-last clojure.core/drop-while clojure.core/empty clojure.core/empty? clojure.core/ensure clojure.core/enumeration-seq clojure.core/error-handler clojure.core/error-mode clojure.core/eval clojure.core/even? clojure.core/every-pred clojure.core/every? clojure.core/ex-data clojure.core/ex-info clojure.core/extend clojure.core/extenders clojure.core/extends? clojure.core/false? clojure.core/ffirst clojure.core/file-seq clojure.core/filter clojure.core/filterv clojure.core/find clojure.core/find-keyword clojure.core/find-ns clojure.core/find-protocol-impl clojure.core/find-protocol-method clojure.core/find-var clojure.core/first clojure.core/flatten clojure.core/float clojure.core/float-array clojure.core/float? clojure.core/floats clojure.core/flush clojure.core/fn? clojure.core/fnext clojure.core/fnil clojure.core/force clojure.core/format clojure.core/frequencies clojure.core/future-call clojure.core/future-cancel clojure.core/future-cancelled? clojure.core/future-done? clojure.core/future? clojure.core/gensym clojure.core/get clojure.core/get-in clojure.core/get-method clojure.core/get-proxy-class clojure.core/get-thread-bindings clojure.core/get-validator clojure.core/group-by clojure.core/hash clojure.core/hash-combine clojure.core/hash-map clojure.core/hash-ordered-coll clojure.core/hash-set clojure.core/hash-unordered-coll clojure.core/identical? clojure.core/identity clojure.core/ifn? clojure.core/in-ns clojure.core/inc clojure.core/inc' clojure.core/init-proxy clojure.core/instance? clojure.core/int clojure.core/int-array clojure.core/integer? clojure.core/interleave clojure.core/intern clojure.core/interpose clojure.core/into clojure.core/into-array clojure.core/ints clojure.core/isa? clojure.core/iterate clojure.core/iterator-seq clojure.core/juxt clojure.core/keep clojure.core/keep-indexed clojure.core/key clojure.core/keys clojure.core/keyword clojure.core/keyword? clojure.core/last clojure.core/line-seq clojure.core/list clojure.core/list* clojure.core/list? clojure.core/load clojure.core/load-file clojure.core/load-reader clojure.core/load-string clojure.core/loaded-libs clojure.core/long clojure.core/long-array clojure.core/longs clojure.core/macroexpand clojure.core/macroexpand-1 clojure.core/make-array clojure.core/make-hierarchy clojure.core/map clojure.core/map-indexed clojure.core/map? clojure.core/mapcat clojure.core/mapv clojure.core/max clojure.core/max-key clojure.core/memoize clojure.core/merge clojure.core/merge-with clojure.core/meta clojure.core/method-sig clojure.core/methods clojure.core/min clojure.core/min-key clojure.core/mix-collection-hash clojure.core/mod clojure.core/munge clojure.core/name clojure.core/namespace clojure.core/namespace-munge clojure.core/neg? clojure.core/newline clojure.core/next clojure.core/nfirst clojure.core/nil? clojure.core/nnext clojure.core/not clojure.core/not-any? clojure.core/not-empty clojure.core/not-every? clojure.core/not= clojure.core/ns-aliases clojure.core/ns-imports clojure.core/ns-interns clojure.core/ns-map clojure.core/ns-name clojure.core/ns-publics clojure.core/ns-refers clojure.core/ns-resolve clojure.core/ns-unalias clojure.core/ns-unmap clojure.core/nth clojure.core/nthnext clojure.core/nthrest clojure.core/num clojure.core/number? clojure.core/numerator clojure.core/object-array clojure.core/odd? clojure.core/parents clojure.core/partial clojure.core/partition clojure.core/partition-all clojure.core/partition-by clojure.core/pcalls clojure.core/peek clojure.core/persistent! clojure.core/pmap clojure.core/pop clojure.core/pop! clojure.core/pop-thread-bindings clojure.core/pos? clojure.core/pr clojure.core/pr-str clojure.core/prefer-method clojure.core/prefers clojure.core/print clojure.core/print-ctor clojure.core/print-dup clojure.core/print-method clojure.core/print-simple clojure.core/print-str clojure.core/printf clojure.core/println clojure.core/println-str clojure.core/prn clojure.core/prn-str clojure.core/promise clojure.core/proxy-call-with-super clojure.core/proxy-mappings clojure.core/proxy-name clojure.core/push-thread-bindings clojure.core/quot clojure.core/rand clojure.core/rand-int clojure.core/rand-nth clojure.core/range clojure.core/ratio? clojure.core/rational? clojure.core/rationalize clojure.core/re-find clojure.core/re-groups clojure.core/re-matcher clojure.core/re-matches clojure.core/re-pattern clojure.core/re-seq clojure.core/read clojure.core/read-line clojure.core/read-string clojure.core/realized? clojure.core/record? clojure.core/reduce clojure.core/reduce-kv clojure.core/reduced clojure.core/reduced? clojure.core/reductions clojure.core/ref clojure.core/ref-history-count clojure.core/ref-max-history clojure.core/ref-min-history clojure.core/ref-set clojure.core/refer clojure.core/release-pending-sends clojure.core/rem clojure.core/remove clojure.core/remove-all-methods clojure.core/remove-method clojure.core/remove-ns clojure.core/remove-watch clojure.core/repeat clojure.core/repeatedly clojure.core/replace clojure.core/replicate clojure.core/require clojure.core/reset! clojure.core/reset-meta! clojure.core/resolve clojure.core/rest clojure.core/restart-agent clojure.core/resultset-seq clojure.core/reverse clojure.core/reversible? clojure.core/rseq clojure.core/rsubseq clojure.core/satisfies? clojure.core/second clojure.core/select-keys clojure.core/send clojure.core/send-off clojure.core/send-via clojure.core/seq clojure.core/seq? clojure.core/seque clojure.core/sequence clojure.core/sequential? clojure.core/set clojure.core/set-agent-send-executor! clojure.core/set-agent-send-off-executor! clojure.core/set-error-handler! clojure.core/set-error-mode! clojure.core/set-validator! clojure.core/set? clojure.core/short clojure.core/short-array clojure.core/shorts clojure.core/shuffle clojure.core/shutdown-agents clojure.core/slurp clojure.core/some clojure.core/some-fn clojure.core/some? clojure.core/sort clojure.core/sort-by clojure.core/sorted-map clojure.core/sorted-map-by clojure.core/sorted-set clojure.core/sorted-set-by clojure.core/sorted? clojure.core/special-symbol? clojure.core/spit clojure.core/split-at clojure.core/split-with clojure.core/str clojure.core/string? clojure.core/struct clojure.core/struct-map clojure.core/subs clojure.core/subseq clojure.core/subvec clojure.core/supers clojure.core/swap! clojure.core/symbol clojure.core/symbol? clojure.core/take clojure.core/take-last clojure.core/take-nth clojure.core/take-while clojure.core/test clojure.core/the-ns clojure.core/thread-bound? clojure.core/to-array clojure.core/to-array-2d clojure.core/trampoline clojure.core/transient clojure.core/tree-seq clojure.core/true? clojure.core/type clojure.core/unchecked-add clojure.core/unchecked-add-int clojure.core/unchecked-byte clojure.core/unchecked-char clojure.core/unchecked-dec clojure.core/unchecked-dec-int clojure.core/unchecked-divide-int clojure.core/unchecked-double clojure.core/unchecked-float clojure.core/unchecked-inc clojure.core/unchecked-inc-int clojure.core/unchecked-int clojure.core/unchecked-long clojure.core/unchecked-multiply clojure.core/unchecked-multiply-int clojure.core/unchecked-negate clojure.core/unchecked-negate-int clojure.core/unchecked-remainder-int clojure.core/unchecked-short clojure.core/unchecked-subtract clojure.core/unchecked-subtract-int clojure.core/underive clojure.core/unsigned-bit-shift-right clojure.core/update-in clojure.core/update-proxy clojure.core/use clojure.core/val clojure.core/vals clojure.core/var-get clojure.core/var-set clojure.core/var? clojure.core/vary-meta clojure.core/vec clojure.core/vector clojure.core/vector-of clojure.core/vector? clojure.core/with-bindings* clojure.core/with-meta clojure.core/with-redefs-fn clojure.core/xml-seq clojure.core/zero? clojure.core/zipmap coll? commute comp comparator compare compare-and-set! compile complement concat conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn? fnext fnil force format frequencies future-call future-cancel future-cancelled? future-done? future? gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-ordered-coll hash-set hash-unordered-coll identical? identity ifn? in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last line-seq list list* list? load load-file load-reader load-string loaded-libs long long-array longs macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memoize merge merge-with meta method-sig methods min min-key mix-collection-hash mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy-call-with-super proxy-mappings proxy-name push-thread-bindings quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? record? reduce reduce-kv reduced reduced? reductions ref ref-history-count ref-max-history ref-min-history ref-set refer release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off send-via seq seq? seque sequence sequential? set set-agent-send-executor! set-agent-send-off-executor! set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn some? sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? take take-last take-nth take-while test the-ns thread-bound? to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unsigned-bit-shift-right update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? with-bindings* with-meta with-redefs-fn xml-seq zero? zipmap -syntax keyword clojureVariable *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *default-data-reader-fn* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* EMPTY-NODE char-escape-string char-name-string clojure.core/*1 clojure.core/*2 clojure.core/*3 clojure.core/*agent* clojure.core/*allow-unresolved-vars* clojure.core/*assert* clojure.core/*clojure-version* clojure.core/*command-line-args* clojure.core/*compile-files* clojure.core/*compile-path* clojure.core/*compiler-options* clojure.core/*data-readers* clojure.core/*default-data-reader-fn* clojure.core/*e clojure.core/*err* clojure.core/*file* clojure.core/*flush-on-newline* clojure.core/*fn-loader* clojure.core/*in* clojure.core/*math-context* clojure.core/*ns* clojure.core/*out* clojure.core/*print-dup* clojure.core/*print-length* clojure.core/*print-level* clojure.core/*print-meta* clojure.core/*print-readably* clojure.core/*read-eval* clojure.core/*source-path* clojure.core/*unchecked-math* clojure.core/*use-context-classloader* clojure.core/*verbose-defrecords* clojure.core/*warn-on-reflection* clojure.core/EMPTY-NODE clojure.core/char-escape-string clojure.core/char-name-string clojure.core/default-data-readers clojure.core/primitives-classnames clojure.core/unquote clojure.core/unquote-splicing default-data-readers primitives-classnames unquote unquote-splicing +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj +" Clojure version 1.8.0 +let s:clojure_syntax_keywords = { + \ 'clojureBoolean': ["false","true"] + \ , 'clojureCond': ["case","clojure.core/case","clojure.core/cond","clojure.core/cond->","clojure.core/cond->>","clojure.core/condp","clojure.core/if-let","clojure.core/if-not","clojure.core/if-some","clojure.core/when","clojure.core/when-first","clojure.core/when-let","clojure.core/when-not","clojure.core/when-some","cond","cond->","cond->>","condp","if-let","if-not","if-some","when","when-first","when-let","when-not","when-some"] + \ , 'clojureConstant': ["nil"] + \ , 'clojureDefine': ["clojure.core/definline","clojure.core/definterface","clojure.core/defmacro","clojure.core/defmethod","clojure.core/defmulti","clojure.core/defn","clojure.core/defn-","clojure.core/defonce","clojure.core/defprotocol","clojure.core/defrecord","clojure.core/defstruct","clojure.core/deftype","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype"] + \ , 'clojureException': ["catch","finally","throw","try"] + \ , 'clojureFunc': ["*","*'","+","+'","-","-'","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","/","<","<=","=","==",">",">=","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","ancestors","apply","array-map","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn*","bound?","butlast","byte","byte-array","bytes","cast","cat","char","char-array","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","clojure.core/*","clojure.core/*'","clojure.core/+","clojure.core/+'","clojure.core/-","clojure.core/-'","clojure.core/->ArrayChunk","clojure.core/->Eduction","clojure.core/->Vec","clojure.core/->VecNode","clojure.core/->VecSeq","clojure.core/-cache-protocol-fn","clojure.core/-reset-methods","clojure.core//","clojure.core/<","clojure.core/<=","clojure.core/=","clojure.core/==","clojure.core/>","clojure.core/>=","clojure.core/Throwable->map","clojure.core/accessor","clojure.core/aclone","clojure.core/add-classpath","clojure.core/add-watch","clojure.core/agent","clojure.core/agent-error","clojure.core/agent-errors","clojure.core/aget","clojure.core/alength","clojure.core/alias","clojure.core/all-ns","clojure.core/alter","clojure.core/alter-meta!","clojure.core/alter-var-root","clojure.core/ancestors","clojure.core/apply","clojure.core/array-map","clojure.core/aset","clojure.core/aset-boolean","clojure.core/aset-byte","clojure.core/aset-char","clojure.core/aset-double","clojure.core/aset-float","clojure.core/aset-int","clojure.core/aset-long","clojure.core/aset-short","clojure.core/assoc","clojure.core/assoc!","clojure.core/assoc-in","clojure.core/associative?","clojure.core/atom","clojure.core/await","clojure.core/await-for","clojure.core/await1","clojure.core/bases","clojure.core/bean","clojure.core/bigdec","clojure.core/bigint","clojure.core/biginteger","clojure.core/bit-and","clojure.core/bit-and-not","clojure.core/bit-clear","clojure.core/bit-flip","clojure.core/bit-not","clojure.core/bit-or","clojure.core/bit-set","clojure.core/bit-shift-left","clojure.core/bit-shift-right","clojure.core/bit-test","clojure.core/bit-xor","clojure.core/boolean","clojure.core/boolean-array","clojure.core/booleans","clojure.core/bound-fn*","clojure.core/bound?","clojure.core/butlast","clojure.core/byte","clojure.core/byte-array","clojure.core/bytes","clojure.core/cast","clojure.core/cat","clojure.core/char","clojure.core/char-array","clojure.core/char?","clojure.core/chars","clojure.core/chunk","clojure.core/chunk-append","clojure.core/chunk-buffer","clojure.core/chunk-cons","clojure.core/chunk-first","clojure.core/chunk-next","clojure.core/chunk-rest","clojure.core/chunked-seq?","clojure.core/class","clojure.core/class?","clojure.core/clear-agent-errors","clojure.core/clojure-version","clojure.core/coll?","clojure.core/commute","clojure.core/comp","clojure.core/comparator","clojure.core/compare","clojure.core/compare-and-set!","clojure.core/compile","clojure.core/complement","clojure.core/completing","clojure.core/concat","clojure.core/conj","clojure.core/conj!","clojure.core/cons","clojure.core/constantly","clojure.core/construct-proxy","clojure.core/contains?","clojure.core/count","clojure.core/counted?","clojure.core/create-ns","clojure.core/create-struct","clojure.core/cycle","clojure.core/dec","clojure.core/dec'","clojure.core/decimal?","clojure.core/dedupe","clojure.core/delay?","clojure.core/deliver","clojure.core/denominator","clojure.core/deref","clojure.core/derive","clojure.core/descendants","clojure.core/destructure","clojure.core/disj","clojure.core/disj!","clojure.core/dissoc","clojure.core/dissoc!","clojure.core/distinct","clojure.core/distinct?","clojure.core/doall","clojure.core/dorun","clojure.core/double","clojure.core/double-array","clojure.core/doubles","clojure.core/drop","clojure.core/drop-last","clojure.core/drop-while","clojure.core/eduction","clojure.core/empty","clojure.core/empty?","clojure.core/ensure","clojure.core/ensure-reduced","clojure.core/enumeration-seq","clojure.core/error-handler","clojure.core/error-mode","clojure.core/eval","clojure.core/even?","clojure.core/every-pred","clojure.core/every?","clojure.core/ex-data","clojure.core/ex-info","clojure.core/extend","clojure.core/extenders","clojure.core/extends?","clojure.core/false?","clojure.core/ffirst","clojure.core/file-seq","clojure.core/filter","clojure.core/filterv","clojure.core/find","clojure.core/find-keyword","clojure.core/find-ns","clojure.core/find-protocol-impl","clojure.core/find-protocol-method","clojure.core/find-var","clojure.core/first","clojure.core/flatten","clojure.core/float","clojure.core/float-array","clojure.core/float?","clojure.core/floats","clojure.core/flush","clojure.core/fn?","clojure.core/fnext","clojure.core/fnil","clojure.core/force","clojure.core/format","clojure.core/frequencies","clojure.core/future-call","clojure.core/future-cancel","clojure.core/future-cancelled?","clojure.core/future-done?","clojure.core/future?","clojure.core/gensym","clojure.core/get","clojure.core/get-in","clojure.core/get-method","clojure.core/get-proxy-class","clojure.core/get-thread-bindings","clojure.core/get-validator","clojure.core/group-by","clojure.core/hash","clojure.core/hash-combine","clojure.core/hash-map","clojure.core/hash-ordered-coll","clojure.core/hash-set","clojure.core/hash-unordered-coll","clojure.core/identical?","clojure.core/identity","clojure.core/ifn?","clojure.core/in-ns","clojure.core/inc","clojure.core/inc'","clojure.core/init-proxy","clojure.core/instance?","clojure.core/int","clojure.core/int-array","clojure.core/integer?","clojure.core/interleave","clojure.core/intern","clojure.core/interpose","clojure.core/into","clojure.core/into-array","clojure.core/ints","clojure.core/isa?","clojure.core/iterate","clojure.core/iterator-seq","clojure.core/juxt","clojure.core/keep","clojure.core/keep-indexed","clojure.core/key","clojure.core/keys","clojure.core/keyword","clojure.core/keyword?","clojure.core/last","clojure.core/line-seq","clojure.core/list","clojure.core/list*","clojure.core/list?","clojure.core/load","clojure.core/load-file","clojure.core/load-reader","clojure.core/load-string","clojure.core/loaded-libs","clojure.core/long","clojure.core/long-array","clojure.core/longs","clojure.core/macroexpand","clojure.core/macroexpand-1","clojure.core/make-array","clojure.core/make-hierarchy","clojure.core/map","clojure.core/map-entry?","clojure.core/map-indexed","clojure.core/map?","clojure.core/mapcat","clojure.core/mapv","clojure.core/max","clojure.core/max-key","clojure.core/memoize","clojure.core/merge","clojure.core/merge-with","clojure.core/meta","clojure.core/method-sig","clojure.core/methods","clojure.core/min","clojure.core/min-key","clojure.core/mix-collection-hash","clojure.core/mod","clojure.core/munge","clojure.core/name","clojure.core/namespace","clojure.core/namespace-munge","clojure.core/neg?","clojure.core/newline","clojure.core/next","clojure.core/nfirst","clojure.core/nil?","clojure.core/nnext","clojure.core/not","clojure.core/not-any?","clojure.core/not-empty","clojure.core/not-every?","clojure.core/not=","clojure.core/ns-aliases","clojure.core/ns-imports","clojure.core/ns-interns","clojure.core/ns-map","clojure.core/ns-name","clojure.core/ns-publics","clojure.core/ns-refers","clojure.core/ns-resolve","clojure.core/ns-unalias","clojure.core/ns-unmap","clojure.core/nth","clojure.core/nthnext","clojure.core/nthrest","clojure.core/num","clojure.core/number?","clojure.core/numerator","clojure.core/object-array","clojure.core/odd?","clojure.core/parents","clojure.core/partial","clojure.core/partition","clojure.core/partition-all","clojure.core/partition-by","clojure.core/pcalls","clojure.core/peek","clojure.core/persistent!","clojure.core/pmap","clojure.core/pop","clojure.core/pop!","clojure.core/pop-thread-bindings","clojure.core/pos?","clojure.core/pr","clojure.core/pr-str","clojure.core/prefer-method","clojure.core/prefers","clojure.core/print","clojure.core/print-ctor","clojure.core/print-dup","clojure.core/print-method","clojure.core/print-simple","clojure.core/print-str","clojure.core/printf","clojure.core/println","clojure.core/println-str","clojure.core/prn","clojure.core/prn-str","clojure.core/promise","clojure.core/proxy-call-with-super","clojure.core/proxy-mappings","clojure.core/proxy-name","clojure.core/push-thread-bindings","clojure.core/quot","clojure.core/rand","clojure.core/rand-int","clojure.core/rand-nth","clojure.core/random-sample","clojure.core/range","clojure.core/ratio?","clojure.core/rational?","clojure.core/rationalize","clojure.core/re-find","clojure.core/re-groups","clojure.core/re-matcher","clojure.core/re-matches","clojure.core/re-pattern","clojure.core/re-seq","clojure.core/read","clojure.core/read-line","clojure.core/read-string","clojure.core/reader-conditional","clojure.core/reader-conditional?","clojure.core/realized?","clojure.core/record?","clojure.core/reduce","clojure.core/reduce-kv","clojure.core/reduced","clojure.core/reduced?","clojure.core/reductions","clojure.core/ref","clojure.core/ref-history-count","clojure.core/ref-max-history","clojure.core/ref-min-history","clojure.core/ref-set","clojure.core/refer","clojure.core/release-pending-sends","clojure.core/rem","clojure.core/remove","clojure.core/remove-all-methods","clojure.core/remove-method","clojure.core/remove-ns","clojure.core/remove-watch","clojure.core/repeat","clojure.core/repeatedly","clojure.core/replace","clojure.core/replicate","clojure.core/require","clojure.core/reset!","clojure.core/reset-meta!","clojure.core/resolve","clojure.core/rest","clojure.core/restart-agent","clojure.core/resultset-seq","clojure.core/reverse","clojure.core/reversible?","clojure.core/rseq","clojure.core/rsubseq","clojure.core/run!","clojure.core/satisfies?","clojure.core/second","clojure.core/select-keys","clojure.core/send","clojure.core/send-off","clojure.core/send-via","clojure.core/seq","clojure.core/seq?","clojure.core/seque","clojure.core/sequence","clojure.core/sequential?","clojure.core/set","clojure.core/set-agent-send-executor!","clojure.core/set-agent-send-off-executor!","clojure.core/set-error-handler!","clojure.core/set-error-mode!","clojure.core/set-validator!","clojure.core/set?","clojure.core/short","clojure.core/short-array","clojure.core/shorts","clojure.core/shuffle","clojure.core/shutdown-agents","clojure.core/slurp","clojure.core/some","clojure.core/some-fn","clojure.core/some?","clojure.core/sort","clojure.core/sort-by","clojure.core/sorted-map","clojure.core/sorted-map-by","clojure.core/sorted-set","clojure.core/sorted-set-by","clojure.core/sorted?","clojure.core/special-symbol?","clojure.core/spit","clojure.core/split-at","clojure.core/split-with","clojure.core/str","clojure.core/string?","clojure.core/struct","clojure.core/struct-map","clojure.core/subs","clojure.core/subseq","clojure.core/subvec","clojure.core/supers","clojure.core/swap!","clojure.core/symbol","clojure.core/symbol?","clojure.core/tagged-literal","clojure.core/tagged-literal?","clojure.core/take","clojure.core/take-last","clojure.core/take-nth","clojure.core/take-while","clojure.core/test","clojure.core/the-ns","clojure.core/thread-bound?","clojure.core/to-array","clojure.core/to-array-2d","clojure.core/trampoline","clojure.core/transduce","clojure.core/transient","clojure.core/tree-seq","clojure.core/true?","clojure.core/type","clojure.core/unchecked-add","clojure.core/unchecked-add-int","clojure.core/unchecked-byte","clojure.core/unchecked-char","clojure.core/unchecked-dec","clojure.core/unchecked-dec-int","clojure.core/unchecked-divide-int","clojure.core/unchecked-double","clojure.core/unchecked-float","clojure.core/unchecked-inc","clojure.core/unchecked-inc-int","clojure.core/unchecked-int","clojure.core/unchecked-long","clojure.core/unchecked-multiply","clojure.core/unchecked-multiply-int","clojure.core/unchecked-negate","clojure.core/unchecked-negate-int","clojure.core/unchecked-remainder-int","clojure.core/unchecked-short","clojure.core/unchecked-subtract","clojure.core/unchecked-subtract-int","clojure.core/underive","clojure.core/unreduced","clojure.core/unsigned-bit-shift-right","clojure.core/update","clojure.core/update-in","clojure.core/update-proxy","clojure.core/use","clojure.core/val","clojure.core/vals","clojure.core/var-get","clojure.core/var-set","clojure.core/var?","clojure.core/vary-meta","clojure.core/vec","clojure.core/vector","clojure.core/vector-of","clojure.core/vector?","clojure.core/volatile!","clojure.core/volatile?","clojure.core/vreset!","clojure.core/with-bindings*","clojure.core/with-meta","clojure.core/with-redefs-fn","clojure.core/xml-seq","clojure.core/zero?","clojure.core/zipmap","coll?","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","dedupe","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","double","double-array","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn?","fnext","fnil","force","format","frequencies","future-call","future-cancel","future-cancelled?","future-done?","future?","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","identical?","identity","ifn?","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","long","long-array","longs","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy-call-with-super","proxy-mappings","proxy-name","push-thread-bindings","quot","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","use","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","with-bindings*","with-meta","with-redefs-fn","xml-seq","zero?","zipmap"] + \ , 'clojureMacro': ["->","->>","..","amap","and","areduce","as->","assert","binding","bound-fn","clojure.core/->","clojure.core/->>","clojure.core/..","clojure.core/amap","clojure.core/and","clojure.core/areduce","clojure.core/as->","clojure.core/assert","clojure.core/binding","clojure.core/bound-fn","clojure.core/comment","clojure.core/declare","clojure.core/delay","clojure.core/dosync","clojure.core/doto","clojure.core/extend-protocol","clojure.core/extend-type","clojure.core/for","clojure.core/future","clojure.core/gen-class","clojure.core/gen-interface","clojure.core/import","clojure.core/io!","clojure.core/lazy-cat","clojure.core/lazy-seq","clojure.core/letfn","clojure.core/locking","clojure.core/memfn","clojure.core/ns","clojure.core/or","clojure.core/proxy","clojure.core/proxy-super","clojure.core/pvalues","clojure.core/refer-clojure","clojure.core/reify","clojure.core/some->","clojure.core/some->>","clojure.core/sync","clojure.core/time","clojure.core/vswap!","clojure.core/with-bindings","clojure.core/with-in-str","clojure.core/with-loading-context","clojure.core/with-local-vars","clojure.core/with-open","clojure.core/with-out-str","clojure.core/with-precision","clojure.core/with-redefs","comment","declare","delay","dosync","doto","extend-protocol","extend-type","for","future","gen-class","gen-interface","import","io!","lazy-cat","lazy-seq","letfn","locking","memfn","ns","or","proxy","proxy-super","pvalues","refer-clojure","reify","some->","some->>","sync","time","vswap!","with-bindings","with-in-str","with-loading-context","with-local-vars","with-open","with-out-str","with-precision","with-redefs"] + \ , 'clojureRepeat': ["clojure.core/doseq","clojure.core/dotimes","clojure.core/while","doseq","dotimes","while"] + \ , 'clojureSpecial': [".","clojure.core/fn","clojure.core/let","clojure.core/loop","def","do","fn","if","let","loop","monitor-enter","monitor-exit","new","quote","recur","set!","var"] + \ , 'clojureVariable': ["*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","EMPTY-NODE","char-escape-string","char-name-string","clojure.core/*1","clojure.core/*2","clojure.core/*3","clojure.core/*agent*","clojure.core/*allow-unresolved-vars*","clojure.core/*assert*","clojure.core/*clojure-version*","clojure.core/*command-line-args*","clojure.core/*compile-files*","clojure.core/*compile-path*","clojure.core/*compiler-options*","clojure.core/*data-readers*","clojure.core/*default-data-reader-fn*","clojure.core/*e","clojure.core/*err*","clojure.core/*file*","clojure.core/*flush-on-newline*","clojure.core/*fn-loader*","clojure.core/*in*","clojure.core/*math-context*","clojure.core/*ns*","clojure.core/*out*","clojure.core/*print-dup*","clojure.core/*print-length*","clojure.core/*print-level*","clojure.core/*print-meta*","clojure.core/*print-readably*","clojure.core/*read-eval*","clojure.core/*source-path*","clojure.core/*suppress-read*","clojure.core/*unchecked-math*","clojure.core/*use-context-classloader*","clojure.core/*verbose-defrecords*","clojure.core/*warn-on-reflection*","clojure.core/EMPTY-NODE","clojure.core/char-escape-string","clojure.core/char-name-string","clojure.core/default-data-readers","clojure.core/primitives-classnames","clojure.core/unquote","clojure.core/unquote-splicing","default-data-readers","primitives-classnames","unquote","unquote-splicing"] + \ } + +function! s:syntax_keyword(dict) + for key in keys(a:dict) + execute 'syntax keyword' key join(a:dict[key], ' ') + endfor +endfunction + +if exists('b:clojure_syntax_without_core_keywords') && b:clojure_syntax_without_core_keywords + " Only match language specials and primitives + for s:key in ['clojureBoolean', 'clojureConstant', 'clojureException', 'clojureSpecial'] + execute 'syntax keyword' s:key join(s:clojure_syntax_keywords[s:key], ' ') + endfor +else + call s:syntax_keyword(s:clojure_syntax_keywords) +endif + +if exists('g:clojure_syntax_keywords') + call s:syntax_keyword(g:clojure_syntax_keywords) +endif + +if exists('b:clojure_syntax_keywords') + call s:syntax_keyword(b:clojure_syntax_keywords) +endif + +unlet! s:key +delfunction s:syntax_keyword " Keywords are symbols: " static Pattern symbolPat = Pattern.compile("[:]?([\\D&&[^/]].*/)?([\\D&&[^/]][^/]*)"); @@ -43,7 +74,7 @@ syntax match clojureKeyword "\v<:{1,2}%([^ \n\r\t()\[\]{}";@^`~\\%/]+/)*[^ \n\r\ syntax match clojureStringEscape "\v\\%([\\btnfr"]|u\x{4}|[0-3]\o{2}|\o{1,2})" contained -syntax region clojureString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell +syntax region clojureString matchgroup=clojureStringDelimiter start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell syntax match clojureCharacter "\\." syntax match clojureCharacter "\\o\%([0-3]\o\{2\}\|\o\{1,2\}\)" @@ -77,7 +108,7 @@ syntax match clojureMeta "\^" syntax match clojureDeref "@" syntax match clojureDispatch "\v#[\^'=<_]?" -" Clojure permits no more than 20 params. +" Clojure permits no more than 20 anonymous params. syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?" syntax match clojureRegexpEscape "\v\\%([\\tnrfae.()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display @@ -85,27 +116,27 @@ syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained " -*- CHARACTER PROPERTY CLASSES -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj -" Java version 1.7.0_51 +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj +" Java version 1.8.0_92 syntax match clojureRegexpPosixCharClass "\v\\[pP]\{%(Cntrl|A%(l%(pha|num)|SCII)|Space|Graph|Upper|P%(rint|unct)|Blank|XDigit|Digit|Lower)\}" contained display syntax match clojureRegexpJavaCharClass "\v\\[pP]\{java%(Whitespace|JavaIdentifier%(Part|Start)|SpaceChar|Mirrored|TitleCase|I%(SOControl|de%(ographic|ntifierIgnorable))|D%(efined|igit)|U%(pperCase|nicodeIdentifier%(Part|Start))|L%(etter%(OrDigit)?|owerCase)|Alphabetic)\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|titlecase|blank|digit|control)\}" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|join%(control|_control)|titlecase|blank|digit|control)\}" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP][NSCMZPL]" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{%(N[dlo]?|P[dcifeos]?|C[ncfos]?|M[nce]?|Z[lsp]?|S[mcko]?|L[muCDlto]?)\}" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{%(Is|gc\=|general_category\=)?%(N[dlo]?|P[dcifeos]?|C[ncfos]?|M[nce]?|Z[lsp]?|S[mcko]?|L[muCDlto]?)\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(Is|sc\=|script\=)%(l%(epc%(ha)?|y%([dc]i%(an)?)|a%(t%(n|in)|na|oo?)|i%(n%(b|ear_b)|mbu?|su))|vaii?|d%(srt|e%(seret|va%(nagari)?))|g%(lag%(olitic)?|eor%(gian)?|oth%(ic)?|re%(k|ek)|u%(j%(arati|r)|r%(u|mukhi)))|u%(gar%(itic)?|nknown)|a%(r%(ab%(ic)?|m%([ni]|enian))|v%(st|estan))|e%(thi%(opic)?|gyp%(tian_hieroglyphs)?)|z%(inh|yyy|zzz)|r%(un%(ic|r)|ejang|jng)|m%(a%(nd%(aic)?|layalam)|lym|y%(anmar|mr)|tei|ong%(olian)?|eetei_mayek)|c%(a%(n%(adian_aboriginal|s)|ri%(an)?)|y%(priot|r%(l|illic))|prt|uneiform|o%(pt%(ic)?|mmon)|h%(er%(okee)?|am))|i%(n%(scriptional_pa%(rthian|hlavi)|herited)|mperial_aramaic|tal)|b%(eng%(ali)?|a%(t%(ak|k)|li%(nese)?|mum?)|ra%(i%(lle)?|h%(mi)?)|opo%(mofo)?|u%(gi%(nese)?|h%(d|id)))|o%(g%(am|ham)|r%(iya|kh|ya)|sma%(nya)?|l%(d_%(south_arabian|persian|italic|turkic)|ck|_chiki))|p%(rti|h%(oenician|li|ag%(s_pa)?|nx))|k%(h%(m%(r|er)|ar%(oshthi)?)|nda|a%(li|n%(a|nada)|takana|yah_li|ithi)|thi)|yi%(ii)?|t%(elu%(gu)?|i%(finagh|b%(t|etan))|ha%(i|a%(na)?)|a%(i_%(le|tham|viet)|g%(alog|b%(anwa)?)|vt|l[ue]|m%(il|l))|fng|glg)|x%(peo|sux)|n%(ew_tai_lue|koo?)|h%(ira%(gana)?|an%([io]|unoo|g%(ul)?)?|ebr%(ew)?)|java%(nese)?|s%(inh%(ala)?|ha%(vian|w)|a%(ur%(ashtra)?|m%(r|aritan)|rb)|y%(r%(c|iac)|lo%(ti_nagri)?)|und%(anese)?))\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(In|blk\=|block\=)%(javanese|h%(a%(lfwidth%( and fullwidth forms|andfullwidthforms|_and_fullwidth_forms)|n%(unoo|gul%(compatibilityjamo|syllables|jamo%(extended\-[ab])?|_%(syllables|jamo%(_extended_[ab])?|compatibility_jamo)| %(syllables|compatibility jamo|jamo%( extended\-[ab])?))))|i%(ragana|gh%( %(private use surrogates|surrogates)|_%(private_use_surrogates|surrogates)|surrogates|privateusesurrogates))|ebrew)|i%(pa%([ _]extensions|extensions)|deographic%( description characters|_description_characters|descriptioncharacters)|nscriptional%(%([ _]pa%(rthian|hlavi))|pa%(rthian|hlavi))|mperial%(aramaic|[_ ]aramaic))|l%(e%(tterlike%([_ ]symbols|symbols)|pcha)|ow%([_ ]surrogates|surrogates)|i%(mbu|near%(_b_%(ideograms|syllabary)|b%(ideograms|syllabary)| b %(ideograms|syllabary))|su)|a%(tin%(extended%(additional|\-[dacb])| extended%( additional|\-[dacb])|\-1%(supplement| supplement)|_%(extended_%([dcb]|a%(dditional)?)|1_supplement))|o)|y[cd]ian)|b%(u%(ginese|hid)|ra%(hmi|ille%(patterns|[_ ]patterns))|o%(x%([ _]drawing|drawing)|pomofo%([ _]extended|extended)?)|lock%([ _]elements|elements)|yzantine%( musical symbols|musicalsymbols|_musical_symbols)|engali|a%(linese|mum%(supplement|[ _]supplement)?|tak|sic%([ _]latin|latin)))|e%(gyptian%([ _]hieroglyphs|hieroglyphs)|moticons|nclosed%( %(cjk letters and months|ideographic supplement|alphanumeric%( supplement|s))|cjklettersandmonths|_%(ideographic_supplement|alphanumeric%(_supplement|s)|cjk_letters_and_months)|alphanumerics%(upplement)?|ideographicsupplement)|thiopic%(supplement|_%(supplement|extended%(_a)?)| %(supplement|extended%(\-a)?)|extended%(\-a)?)?)|k%(h%(aroshthi|mer%([_ ]symbols|symbols)?)|a%(takana%(_phonetic_extensions|phoneticextensions| phonetic extensions)?|n%(gxi%([_ ]radicals|radicals)|a%(supplement|[ _]supplement)|bun|nada)|ithi|yah%([ _]li|li)))|r%(u%(nic|mi%(numeralsymbols| numeral symbols|_numeral_symbols))|ejang)|n%(umber%(forms|[ _]forms)|ko|ew%(_tai_lue|tailue| tai lue))|m%(iscellaneous%(technical|symbols%(and%(pictographs|arrows))?|mathematicalsymbols\-[ab]| %(technical|mathematical symbols\-[ab]|symbols%( and %(pictographs|arrows))?)|_%(technical|symbols%(_and_%(pictographs|arrows))?|mathematical_symbols_[ab]))|usical%([_ ]symbols|symbols)|eetei%(mayek|[_ ]mayek)|a%(ndaic|hjong%([ _]tiles|tiles)|layalam|thematical%(alphanumericsymbols| %(alphanumeric symbols|operators)|_%(alphanumeric_symbols|operators)|operators))|yanmar%(extended\-a|_extended_a| extended\-a)?|o%(difier%(_tone_letters| tone letters|toneletters)|ngolian))|d%(e%(seret|vanagari%([ _]extended|extended)?)|ingbats|omino%([ _]tiles|tiles))|yi%(syllables|%([_ ]%(syllables|radicals))|radicals|jing%(hexagramsymbols| hexagram symbols|_hexagram_symbols))|s%(havian|mall%( form variants|formvariants|_form_variants)|p%(acing%(_modifier_letters| modifier letters|modifierletters)|ecials)|a%(maritan|urashtra)|u%(p%(erscripts%(_and_subscripts|andsubscripts| and subscripts)|plementa%(ry%(_private_use_area_[ab]|privateusearea\-[ab]| private use area\-[ab])|l%(_%(arrows_[ab]|mathematical_operators|punctuation)| %(mathematical operators|punctuation|arrows\-[ab])|mathematicaloperators|punctuation|arrows\-[ab])))|rrogates_area|ndanese)|inhala|y%(riac|loti%([_ ]nagri|nagri)))|p%(h%(o%(enician|netic%( extensions%( supplement)?|extensions%(supplement)?|_extensions%(_supplement)?))|a%(istos%([ _]disc|disc)|gs[_\-]pa))|laying%(cards|[_ ]cards)|rivate%(usearea| use area|_use_area))|o%(smanya|l%([ _]chiki|d%( %(south arabian|persian|italic|turkic)|southarabian|_%(south_arabian|persian|italic|turkic)|persian|italic|turkic)|chiki)|riya|ptical%( character recognition|_character_recognition|characterrecognition)|gham)|g%(u%(jarati|rmukhi)|othic|lagolitic|e%(o%(rgian%(supplement|[ _]supplement)?|metric%(shapes|[ _]shapes))|neral%([_ ]punctuation|punctuation))|reek%( %(and coptic|extended)|andcoptic|_extended|extended)?)|c%(o%(ntrol%(pictures|[ _]pictures)|m%(bining%(diacriticalmarks%(supplement|forsymbols)?|halfmarks| %(diacritical marks%( %(supplement|for symbols))?|half marks|marks for symbols)|marksforsymbols|_%(marks_for_symbols|half_marks|diacritical_marks%(_supplement)?))|mon%(_indic_number_forms|indicnumberforms| indic number forms))|ptic|unting%( rod numerals|_rod_numerals|rodnumerals))|y%(rillic%(extended\-[ab]|_%(extended_[ab]|supplementary)|supplement%(ary)?| %(extended\-[ab]|supplement%(ary)?))?|priot%(syllabary|[ _]syllabary))|u%(rrency%([_ ]symbols|symbols)|neiform%(_numbers_and_punctuation|numbersandpunctuation| numbers and punctuation)?)|arian|h%(erokee|am)|jk%(s%(ymbolsandpunctuation|trokes)|compatibility%(forms|ideographs%(supplement)?)?|radicalssupplement| %(compatibility%( %(ideographs%( supplement)?|forms))?|radicals supplement|unified ideographs%( extension [dacb])?|s%(ymbols and punctuation|trokes))|_%(s%(trokes|ymbols_and_punctuation)|radicals_supplement|compatibility%(_%(forms|ideographs%(_supplement)?))?|unified_ideographs%(_extension_[dacb])?)|unifiedideographs%(extension[dacb])?))|t%(i%(betan|finagh)|elugu|a%(mil|i%(xuanjingsymbols|_%(le|xuan_jing_symbols|tham|viet)|le| %(xuan jing symbols|le|tham|viet)|tham|viet)|g%(alog|s|banwa))|ransport%( and map symbols|_and_map_symbols|andmapsymbols)|ha%(i|ana))|a%(l%(chemical%([_ ]symbols|symbols)|phabetic%( presentation forms|_presentation_forms|presentationforms))|ncient%(_%(greek_%(musical_notation|numbers)|symbols)|greek%(numbers|musicalnotation)| %(greek %(numbers|musical notation)|symbols)|symbols)|egean%(numbers|[ _]numbers)|vestan|r%(abic%( %(supplement|presentation forms\-[ab])|supplement|_%(presentation_forms_[ab]|supplement)|presentationforms\-[ab])?|menian|rows))|u%(garitic|nified%(canadianaboriginalsyllabics%(extended)?|_canadian_aboriginal_syllabics%(_extended)?| canadian aboriginal syllabics%( extended)?))|v%(a%(i|riation%( selectors%( supplement)?|selectors%(supplement)?|_selectors%(_supplement)?))|e%(rtical%(forms|[ _]forms)|dic%([ _]extensions|extensions))))\}" contained display - -syntax match clojureRegexpPredefinedCharClass "\v%(\\[dDsSwW]|\.)" contained display -syntax cluster clojureRegexpCharPropertyClasses contains=clojureRegexpPosixCharClass,clojureRegexpJavaCharClass,clojureRegexpUnicodeCharClass -syntax cluster clojureRegexpCharClasses contains=clojureRegexpPredefinedCharClass,clojureRegexpCharClass,@clojureRegexpCharPropertyClasses -syntax region clojureRegexpCharClass start="\[" skip=/\\\\\|\\]/ end="]" contained contains=clojureRegexpPredefinedCharClass,@clojureRegexpCharPropertyClasses -syntax match clojureRegexpBoundary "\\[bBAGZz]" contained display -syntax match clojureRegexpBoundary "[$^]" contained display -syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display -syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display -syntax match clojureRegexpOr "|" contained display -syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-z]+\>)" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(Is|sc\=|script\=)%(l%(epc%(ha)?|y%([dc]i%(an)?)|a%(t%(n|in)|na|oo?)|i%(n%(b|ear_b)|mbu?|su))|p%(rti|lrd|h%(oenician|li|ag%(s_pa)?|nx))|vaii?|d%(srt|e%(seret|va%(nagari)?))|g%(lag%(olitic)?|eor%(gian)?|oth%(ic)?|re%(k|ek)|u%(j%(arati|r)|r%(u|mukhi)))|u%(gar%(itic)?|nknown)|a%(r%(ab%(ic)?|m%([ni]|enian))|v%(st|estan))|e%(thi%(opic)?|gyp%(tian_hieroglyphs)?)|z%(inh|yyy|zzz)|r%(un%(ic|r)|ejang|jng)|s%(inh%(ala)?|h%(rd|a%(vian|rada|w))|a%(ur%(ashtra)?|m%(r|aritan)|rb)|y%(r%(c|iac)|lo%(ti_nagri)?)|und%(anese)?|ora%(_sompeng)?)|i%(n%(scriptional_pa%(rthian|hlavi)|herited)|mperial_aramaic|tal)|b%(eng%(ali)?|a%(t%(ak|k)|li%(nese)?|mum?)|ra%(i%(lle)?|h%(mi)?)|opo%(mofo)?|u%(gi%(nese)?|h%(d|id)))|o%(g%(am|ham)|r%(iya|kh|ya)|sma%(nya)?|l%(d_%(south_arabian|persian|italic|turkic)|ck|_chiki))|k%(h%(m%(r|er)|ar%(oshthi)?)|nda|a%(li|n%(a|nada)|takana|yah_li|ithi)|thi)|m%(a%(nd%(aic)?|layalam)|lym|y%(anmar|mr)|tei|e%(r%(c|o%(itic_%(hieroglyphs|cursive))?)|etei_mayek)|ong%(olian)?|iao)|yi%(ii)?|x%(peo|sux)|n%(ew_tai_lue|koo?)|h%(ira%(gana)?|an%([io]|unoo|g%(ul)?)?|ebr%(ew)?)|c%(y%(priot|r%(l|illic))|a%(km|n%(adian_aboriginal|s)|ri%(an)?)|prt|h%(er%(okee)?|a%(m|kma))|uneiform|o%(pt%(ic)?|mmon))|t%(elu%(gu)?|i%(finagh|b%(t|etan))|ha%(i|a%(na)?)|a%(i_%(le|tham|viet)|g%(alog|b%(anwa)?)|vt|kri?|l[ue]|m%(il|l))|fng|glg)|java%(nese)?)\}" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(In|blk\=|block\=)%(javanese|h%(a%(lfwidth%( and fullwidth forms|andfullwidthforms|_and_fullwidth_forms)|n%(unoo|gul%(compatibilityjamo|syllables|jamo%(extended\-[ab])?|_%(syllables|jamo%(_extended_[ab])?|compatibility_jamo)| %(syllables|compatibility jamo|jamo%( extended\-[ab])?))))|i%(ragana|gh%( %(private use surrogates|surrogates)|_%(private_use_surrogates|surrogates)|surrogates|privateusesurrogates))|ebrew)|i%(pa%([ _]extensions|extensions)|deographic%( description characters|_description_characters|descriptioncharacters)|nscriptional%(%([ _]pa%(rthian|hlavi))|pa%(rthian|hlavi))|mperial%(aramaic|[_ ]aramaic))|l%(e%(tterlike%([_ ]symbols|symbols)|pcha)|ow%([_ ]surrogates|surrogates)|i%(mbu|near%(_b_%(ideograms|syllabary)|b%(ideograms|syllabary)| b %(ideograms|syllabary))|su)|a%(tin%(extended%(additional|\-[dacb])| extended%( additional|\-[dacb])|\-1%(supplement| supplement)|_%(extended_%([dcb]|a%(dditional)?)|1_supplement))|o)|y[cd]ian)|b%(u%(ginese|hid)|ra%(hmi|ille%(patterns|[_ ]patterns))|o%(x%([ _]drawing|drawing)|pomofo%([ _]extended|extended)?)|lock%([ _]elements|elements)|yzantine%( musical symbols|musicalsymbols|_musical_symbols)|engali|a%(linese|mum%(supplement|[ _]supplement)?|tak|sic%([ _]latin|latin)))|e%(gyptian%([ _]hieroglyphs|hieroglyphs)|moticons|nclosed%( %(cjk letters and months|ideographic supplement|alphanumeric%( supplement|s))|cjklettersandmonths|_%(ideographic_supplement|alphanumeric%(_supplement|s)|cjk_letters_and_months)|alphanumerics%(upplement)?|ideographicsupplement)|thiopic%(supplement|_%(supplement|extended%(_a)?)| %(supplement|extended%(\-a)?)|extended%(\-a)?)?)|k%(h%(aroshthi|mer%([_ ]symbols|symbols)?)|a%(takana%(_phonetic_extensions|phoneticextensions| phonetic extensions)?|n%(gxi%([_ ]radicals|radicals)|a%(supplement|[ _]supplement)|bun|nada)|ithi|yah%([ _]li|li)))|m%(i%(ao|scellaneous%(technical|symbols%(and%(pictographs|arrows))?|mathematicalsymbols\-[ab]| %(technical|mathematical symbols\-[ab]|symbols%( and %(pictographs|arrows))?)|_%(technical|symbols%(_and_%(pictographs|arrows))?|mathematical_symbols_[ab])))|usical%([_ ]symbols|symbols)|e%(etei%(mayek%(extensions)?|_mayek%(_extensions)?| mayek%( extensions)?)|roitic%(hieroglyphs|%([_ ]%(hieroglyphs|cursive))|cursive))|a%(ndaic|hjong%([ _]tiles|tiles)|layalam|thematical%(alphanumericsymbols| %(alphanumeric symbols|operators)|_%(alphanumeric_symbols|operators)|operators))|yanmar%(extended\-a|_extended_a| extended\-a)?|o%(difier%(_tone_letters| tone letters|toneletters)|ngolian))|r%(u%(nic|mi%(numeralsymbols| numeral symbols|_numeral_symbols))|ejang)|n%(umber%(forms|[ _]forms)|ko|ew%(_tai_lue|tailue| tai lue))|c%(o%(ntrol%(pictures|[ _]pictures)|m%(bining%(diacriticalmarks%(supplement|forsymbols)?|halfmarks| %(diacritical marks%( %(supplement|for symbols))?|half marks|marks for symbols)|marksforsymbols|_%(marks_for_symbols|half_marks|diacritical_marks%(_supplement)?))|mon%(_indic_number_forms|indicnumberforms| indic number forms))|ptic|unting%( rod numerals|_rod_numerals|rodnumerals))|y%(rillic%(extended\-[ab]|_%(extended_[ab]|supplementary)|supplement%(ary)?| %(extended\-[ab]|supplement%(ary)?))?|priot%(syllabary|[ _]syllabary))|u%(rrency%([_ ]symbols|symbols)|neiform%(_numbers_and_punctuation|numbersandpunctuation| numbers and punctuation)?)|h%(a%(m|kma)|erokee)|arian|jk%(s%(ymbolsandpunctuation|trokes)|compatibility%(forms|ideographs%(supplement)?)?|radicalssupplement| %(compatibility%( %(ideographs%( supplement)?|forms))?|radicals supplement|unified ideographs%( extension [dacb])?|s%(ymbols and punctuation|trokes))|_%(s%(trokes|ymbols_and_punctuation)|radicals_supplement|compatibility%(_%(forms|ideographs%(_supplement)?))?|unified_ideographs%(_extension_[dacb])?)|unifiedideographs%(extension[dacb])?))|d%(e%(seret|vanagari%([ _]extended|extended)?)|ingbats|omino%([ _]tiles|tiles))|yi%(syllables|%([_ ]%(syllables|radicals))|radicals|jing%(hexagramsymbols| hexagram symbols|_hexagram_symbols))|s%(mall%( form variants|formvariants|_form_variants)|p%(acing%(_modifier_letters| modifier letters|modifierletters)|ecials)|ora%(sompeng|[ _]sompeng)|ha%(vian|rada)|a%(maritan|urashtra)|inhala|y%(riac|loti%([_ ]nagri|nagri))|u%(ndanese%(supplement|[ _]supplement)?|p%(erscripts%(_and_subscripts|andsubscripts| and subscripts)|plementa%(ry%(_private_use_area_[ab]|privateusearea\-[ab]| private use area\-[ab])|l%(_%(arrows_[ab]|mathematical_operators|punctuation)| %(mathematical operators|punctuation|arrows\-[ab])|mathematicaloperators|punctuation|arrows\-[ab])))|rrogates_area))|p%(h%(o%(enician|netic%( extensions%( supplement)?|extensions%(supplement)?|_extensions%(_supplement)?))|a%(istos%([ _]disc|disc)|gs[_\-]pa))|laying%(cards|[_ ]cards)|rivate%(usearea| use area|_use_area))|o%(smanya|l%([ _]chiki|d%( %(south arabian|persian|italic|turkic)|southarabian|_%(south_arabian|persian|italic|turkic)|persian|italic|turkic)|chiki)|riya|ptical%( character recognition|_character_recognition|characterrecognition)|gham)|g%(u%(jarati|rmukhi)|othic|lagolitic|e%(o%(rgian%(supplement|[ _]supplement)?|metric%(shapes|[ _]shapes))|neral%([_ ]punctuation|punctuation))|reek%( %(and coptic|extended)|andcoptic|_extended|extended)?)|t%(i%(betan|finagh)|elugu|ransport%( and map symbols|_and_map_symbols|andmapsymbols)|a%(mil|kri|i%(xuanjingsymbols|_%(le|xuan_jing_symbols|tham|viet)|le| %(xuan jing symbols|le|tham|viet)|tham|viet)|g%(alog|s|banwa))|ha%(i|ana))|a%(l%(chemical%([_ ]symbols|symbols)|phabetic%( presentation forms|_presentation_forms|presentationforms))|r%(menian|abic%(extended\-a|mathematicalalphabeticsymbols|supplement|_%(presentation_forms_[ab]|supplement|extended_a|mathematical_alphabetic_symbols)| %(extended\-a|mathematical alphabetic symbols|supplement|presentation forms\-[ab])|presentationforms\-[ab])?|rows)|ncient%(_%(greek_%(musical_notation|numbers)|symbols)|greek%(numbers|musicalnotation)| %(greek %(numbers|musical notation)|symbols)|symbols)|egean%(numbers|[ _]numbers)|vestan)|u%(garitic|nified%(canadianaboriginalsyllabics%(extended)?|_canadian_aboriginal_syllabics%(_extended)?| canadian aboriginal syllabics%( extended)?))|v%(a%(i|riation%( selectors%( supplement)?|selectors%(supplement)?|_selectors%(_supplement)?))|e%(rtical%(forms|[ _]forms)|dic%([ _]extensions|extensions))))\}" contained display + +syntax match clojureRegexpPredefinedCharClass "\v%(\\[dDsSwW]|\.)" contained display +syntax cluster clojureRegexpCharPropertyClasses contains=clojureRegexpPosixCharClass,clojureRegexpJavaCharClass,clojureRegexpUnicodeCharClass +syntax cluster clojureRegexpCharClasses contains=clojureRegexpPredefinedCharClass,clojureRegexpCharClass,@clojureRegexpCharPropertyClasses +syntax region clojureRegexpCharClass start="\[" skip=/\\\\\|\\]/ end="]" contained contains=clojureRegexpPredefinedCharClass,@clojureRegexpCharPropertyClasses +syntax match clojureRegexpBoundary "\\[bBAGZz]" contained display +syntax match clojureRegexpBoundary "[$^]" contained display +syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display +syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display +syntax match clojureRegexpOr "|" contained display +syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-z]+\>)" contained display " Mode modifiers, mode-modified spans, lookaround, regular and atomic " grouping, and named-capturing. @@ -123,66 +154,70 @@ syntax match clojureComment ";.*$" contains=clojureCommentTodo,@Spell syntax match clojureComment "#!.*$" " -*- TOP CLUSTER -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj syntax cluster clojureTop contains=@Spell,clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVarArg,clojureVariable,clojureVector -syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=@clojureTop fold -syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=@clojureTop fold -syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=@clojureTop fold +syntax region clojureSexp matchgroup=clojureParen start="(" end=")" contains=@clojureTop fold +syntax region clojureVector matchgroup=clojureParen start="\[" end="]" contains=@clojureTop fold +syntax region clojureMap matchgroup=clojureParen start="{" end="}" contains=@clojureTop fold " Highlight superfluous closing parens, brackets and braces. syntax match clojureError "]\|}\|)" syntax sync fromstart -highlight default link clojureConstant Constant -highlight default link clojureBoolean Boolean -highlight default link clojureCharacter Character -highlight default link clojureKeyword Keyword -highlight default link clojureNumber Number -highlight default link clojureString String -highlight default link clojureStringEscape Character - -highlight default link clojureRegexp Constant -highlight default link clojureRegexpEscape Character -highlight default link clojureRegexpCharClass SpecialChar -highlight default link clojureRegexpPosixCharClass clojureRegexpCharClass -highlight default link clojureRegexpJavaCharClass clojureRegexpCharClass -highlight default link clojureRegexpUnicodeCharClass clojureRegexpCharClass -highlight default link clojureRegexpPredefinedCharClass clojureRegexpCharClass -highlight default link clojureRegexpBoundary SpecialChar -highlight default link clojureRegexpQuantifier SpecialChar -highlight default link clojureRegexpMod SpecialChar -highlight default link clojureRegexpOr SpecialChar -highlight default link clojureRegexpBackRef SpecialChar -highlight default link clojureRegexpGroup clojureRegexp -highlight default link clojureRegexpQuoted clojureString -highlight default link clojureRegexpQuote clojureRegexpBoundary - -highlight default link clojureVariable Identifier -highlight default link clojureCond Conditional -highlight default link clojureDefine Define -highlight default link clojureException Exception -highlight default link clojureFunc Function -highlight default link clojureMacro Macro -highlight default link clojureRepeat Repeat - -highlight default link clojureSpecial Special -highlight default link clojureVarArg Special -highlight default link clojureQuote SpecialChar -highlight default link clojureUnquote SpecialChar -highlight default link clojureMeta SpecialChar -highlight default link clojureDeref SpecialChar -highlight default link clojureAnonArg SpecialChar -highlight default link clojureDispatch SpecialChar - -highlight default link clojureComment Comment -highlight default link clojureCommentTodo Todo - -highlight default link clojureError Error - -highlight default link clojureParen Delimiter +highlight default link clojureConstant Constant +highlight default link clojureBoolean Boolean +highlight default link clojureCharacter Character +highlight default link clojureKeyword Keyword +highlight default link clojureNumber Number +highlight default link clojureString String +highlight default link clojureStringDelimiter String +highlight default link clojureStringEscape Character + +highlight default link clojureRegexp Constant +highlight default link clojureRegexpEscape Character +highlight default link clojureRegexpCharClass SpecialChar +highlight default link clojureRegexpPosixCharClass clojureRegexpCharClass +highlight default link clojureRegexpJavaCharClass clojureRegexpCharClass +highlight default link clojureRegexpUnicodeCharClass clojureRegexpCharClass +highlight default link clojureRegexpPredefinedCharClass clojureRegexpCharClass +highlight default link clojureRegexpBoundary SpecialChar +highlight default link clojureRegexpQuantifier SpecialChar +highlight default link clojureRegexpMod SpecialChar +highlight default link clojureRegexpOr SpecialChar +highlight default link clojureRegexpBackRef SpecialChar +highlight default link clojureRegexpGroup clojureRegexp +highlight default link clojureRegexpQuoted clojureString +highlight default link clojureRegexpQuote clojureRegexpBoundary + +highlight default link clojureVariable Identifier +highlight default link clojureCond Conditional +highlight default link clojureDefine Define +highlight default link clojureException Exception +highlight default link clojureFunc Function +highlight default link clojureMacro Macro +highlight default link clojureRepeat Repeat + +highlight default link clojureSpecial Special +highlight default link clojureVarArg Special +highlight default link clojureQuote SpecialChar +highlight default link clojureUnquote SpecialChar +highlight default link clojureMeta SpecialChar +highlight default link clojureDeref SpecialChar +highlight default link clojureAnonArg SpecialChar +highlight default link clojureDispatch SpecialChar + +highlight default link clojureComment Comment +highlight default link clojureCommentTodo Todo + +highlight default link clojureError Error + +highlight default link clojureParen Delimiter let b:current_syntax = "clojure" -" vim:sts=8:sw=8:ts=8:noet:smc=0 +let &cpo = s:cpo_sav +unlet! s:cpo_sav + +" vim:sts=8:sw=8:ts=8:noet diff --git a/runtime/syntax/cmake.vim b/runtime/syntax/cmake.vim index 8e54d511e0..4cc21da8fe 100644 --- a/runtime/syntax/cmake.vim +++ b/runtime/syntax/cmake.vim @@ -2,21 +2,18 @@ " Program: CMake - Cross-Platform Makefile Generator " Module: $RCSfile: cmake-syntax.vim,v $ " Language: CMake +" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com> +" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> " Author: Andy Cedilnik <andy.cedilnik@kitware.com> -" Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: 2012 Jun 01 -" (Dominique Pelle added @Spell) +" Last Change: 2015 Dec 17 " Version: $Revision: 1.10 $ " " Licence: The CMake license applies to this file. See " http://www.cmake.org/HTML/Copyright.html " This implies that distribution with Vim is allowed -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo @@ -31,9 +28,9 @@ syn region cmakeVariableValue start=/\${/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo syn region cmakeEnvironment start=/\$ENV{/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo -syn region cmakeString start=/"/ end=/"/ +syn region cmakeString start=/"/ end=/"/ \ contains=CONTAINED,cmakeTodo,cmakeOperators -syn region cmakeArguments start=/(/ end=/)/ +syn region cmakeArguments start=/(/ end=/)/ \ contains=ALLBUT,cmakeArguments,cmakeTodo syn keyword cmakeSystemVariables \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 @@ -44,40 +41,30 @@ syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_ \ nextgroup=cmakeArguments " The keywords are generated as: cmake --help-command-list | tr "\n" " " -syn keyword cmakeStatement +syn keyword cmakeStatement \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ nextgroup=cmakeArguments -syn keyword cmakeTodo - \ TODO FIXME XXX +syn keyword cmakeTodo + \ TODO FIXME XXX \ contained " 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_cmake_syntax_inits") - if version < 508 - let did_cmake_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink cmakeStatement Statement - HiLink cmakeComment Comment - HiLink cmakeString String - HiLink cmakeVariableValue Type - HiLink cmakeRegistry Underlined - HiLink cmakeArguments Identifier - HiLink cmakeArgument Constant - HiLink cmakeEnvironment Special - HiLink cmakeOperators Operator - HiLink cmakeMacro PreProc - HiLink cmakeError Error - HiLink cmakeTodo TODO - HiLink cmakeEscaped Special +hi def link cmakeStatement Statement +hi def link cmakeComment Comment +hi def link cmakeString String +hi def link cmakeVariableValue Type +hi def link cmakeRegistry Underlined +hi def link cmakeArguments Identifier +hi def link cmakeArgument Constant +hi def link cmakeEnvironment Special +hi def link cmakeOperators Operator +hi def link cmakeMacro PreProc +hi def link cmakeError Error +hi def link cmakeTodo TODO +hi def link cmakeEscaped Special - delcommand HiLink -endif let b:current_syntax = "cmake" diff --git a/runtime/syntax/cmod.vim b/runtime/syntax/cmod.vim new file mode 100644 index 0000000000..ea37682ff6 --- /dev/null +++ b/runtime/syntax/cmod.vim @@ -0,0 +1,144 @@ +" Vim syntax file +" Language: Cmod +" Current Maintainer: Stephen R. van den Berg <srb@cuci.nl> +" Last Change: 2018 Jan 23 +" Version: 2.9 +" Remark: Is used to edit Cmod files for Pike development. +" Remark: Includes a highlighter for any embedded Autodoc format. + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Read the C syntax to start with +runtime! syntax/c.vim +unlet b:current_syntax + +if !exists("c_autodoc") + " For embedded Autodoc documentation + syn include @cmodAutodoc <sfile>:p:h/autodoc.vim + unlet b:current_syntax +endif + +" Supports rotating amongst several same-level preprocessor conditionals +packadd! matchit +let b:match_words = "({:}\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>" + +" Cmod extensions +syn keyword cmodStatement __INIT INIT EXIT GC_RECURSE GC_CHECK +syn keyword cmodStatement EXTRA OPTIMIZE RETURN +syn keyword cmodStatement ADD_EFUN ADD_EFUN2 ADD_FUNCTION +syn keyword cmodStatement MK_STRING MK_STRING_SVALUE CONSTANT_STRLEN + +syn keyword cmodStatement SET_SVAL pop_n_elems pop_stack +syn keyword cmodStatement SIMPLE_ARG_TYPE_ERROR Pike_sp Pike_fp MKPCHARP +syn keyword cmodStatement SET_SVAL_TYPE REF_MAKE_CONST_STRING INC_PCHARP +syn keyword cmodStatement PTR_FROM_INT INHERIT_FROM_PTR +syn keyword cmodStatement DECLARE_CYCLIC BEGIN_CYCLIC END_CYCLIC +syn keyword cmodStatement UPDATE_LOCATION UNSAFE_IS_ZERO SAFE_IS_ZERO +syn keyword cmodStatement MKPCHARP_STR APPLY_MASTER current_storage +syn keyword cmodStatement PIKE_MAP_VARIABLE size_shift +syn keyword cmodStatement THREADS_ALLOW THREADS_DISALLOW + +syn keyword cmodStatement add_integer_constant ref_push_object +syn keyword cmodStatement push_string apply_svalue free_svalue +syn keyword cmodStatement get_inherit_storage get_storage +syn keyword cmodStatement make_shared_binary_string push_int64 +syn keyword cmodStatement begin_shared_string end_shared_string +syn keyword cmodStatement add_ref fast_clone_object clone_object +syn keyword cmodStatement push_undefined push_int ref_push_string +syn keyword cmodStatement free_string push_ulongest free_object +syn keyword cmodStatement convert_stack_top_to_bignum push_array +syn keyword cmodStatement push_object reduce_stack_top_bignum +syn keyword cmodStatement push_static_text apply_current +syn keyword cmodStatement assign_svalue free_program destruct_object +syn keyword cmodStatement start_new_program low_inherit stack_swap +syn keyword cmodStatement generic_error_program end_program +syn keyword cmodStatement free_array apply_external copy_mapping +syn keyword cmodStatement push_constant_text ref_push_mapping +syn keyword cmodStatement mapping_insert mapping_string_insert_string +syn keyword cmodStatement f_aggregate_mapping f_aggregate apply +syn keyword cmodStatement push_mapping push_svalue low_mapping_lookup +syn keyword cmodStatement assign_svalues_no_free f_add +syn keyword cmodStatement push_empty_string stack_dup assign_lvalue +syn keyword cmodStatement low_mapping_string_lookup allocate_mapping +syn keyword cmodStatement copy_shared_string make_shared_binary_string0 +syn keyword cmodStatement f_call_function f_index f_utf8_to_string +syn keyword cmodStatement finish_string_builder init_string_builder +syn keyword cmodStatement reset_string_builder free_string_builder +syn keyword cmodStatement string_builder_putchar get_all_args +syn keyword cmodStatement add_shared_strings check_all_args +syn keyword cmodStatement do_inherit add_string_constant +syn keyword cmodStatement add_program_constant set_init_callback +syn keyword cmodStatement simple_mapping_string_lookup +syn keyword cmodStatement f_sprintf push_text string_has_null +syn keyword cmodStatement end_and_resize_shared_string + +syn keyword cmodStatement args sp + +syn keyword cmodStatement free + +syn keyword cmodConstant ID_PROTECTED ID_FINAL PIKE_DEBUG +syn keyword cmodConstant NUMBER_NUMBER +syn keyword cmodConstant PIKE_T_INT PIKE_T_STRING PIKE_T_ARRAY +syn keyword cmodConstant PIKE_T_MULTISET PIKE_T_OBJECT PIKE_T_MAPPING +syn keyword cmodConstant NUMBER_UNDEFINED PIKE_T_PROGRAM PIKE_T_FUNCTION +syn keyword cmodConstant T_OBJECT T_STRING T_ARRAY T_MAPPING + +syn keyword cmodException SET_ONERROR UNSET_ONERROR ONERROR +syn keyword cmodException CALL_AND_UNSET_ONERROR + +syn keyword cmodDebug Pike_fatal Pike_error check_stack + +syn keyword cmodAccess public protected private INHERIT +syn keyword cmodAccess CTYPE CVAR PIKEVAR PIKEFUN + +syn keyword cmodModifier efun export flags optflags optfunc +syn keyword cmodModifier type rawtype errname name c_name prototype +syn keyword cmodModifier program_flags gc_trivial PMOD_EXPORT +syn keyword cmodModifier ATTRIBUTE noclone noinline +syn keyword cmodModifier tOr tFuncV tInt tMix tVoid tStr tMap tPrg +syn keyword cmodModifier tSetvar tArr tMult tMultiset +syn keyword cmodModifier tArray tMapping tString tSetvar tVar + +syn keyword cmodType bool mapping string multiset array mixed +syn keyword cmodType object function program auto svalue +syn keyword cmodType bignum longest zero pike_string +syn keyword cmodType this this_program THIS INT_TYPE INT64 INT32 +syn keyword cmodType p_wchar2 PCHARP p_wchar1 p_wchar0 MP_INT + +syn keyword cmodOperator _destruct create __hash _sizeof _indices _values +syn keyword cmodOperator _is_type _sprintf _equal _m_delete _get_iterator +syn keyword cmodOperator _search _types _serialize _deserialize +syn keyword cmodOperator _size_object _random _sqrt TYPEOF SUBTYPEOF +syn keyword cmodOperator LIKELY UNLIKELY + +syn keyword cmodStructure DECLARATIONS PIKECLASS DECLARE_STORAGE + +if !exists("c_autodoc") + syn match cmodAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cmodAutodoc containedin=cComment,cCommentL + syn cluster cCommentGroup add=cmodAutodocReal + syn cluster cPreProcGroup add=cmodAutodocReal +endif + +" Default highlighting +hi def link cmodAccess Statement +hi def link cmodOperator Operator +hi def link cmodStatement Statement +hi def link cmodConstant Constant +hi def link cmodModifier Type +hi def link cmodType Type +hi def link cmodStorageClass StorageClass +hi def link cmodStructure Structure +hi def link cmodException Exception +hi def link cmodDebug Debug + +let b:current_syntax = "cmod" + +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: ts=8 diff --git a/runtime/syntax/cmusrc.vim b/runtime/syntax/cmusrc.vim index e36a69c698..b821affd57 100644 --- a/runtime/syntax/cmusrc.vim +++ b/runtime/syntax/cmusrc.vim @@ -1,6 +1,6 @@ " Vim syntax file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cobol.vim b/runtime/syntax/cobol.vim index 5315e75211..2d481bba0b 100644 --- a/runtime/syntax/cobol.vim +++ b/runtime/syntax/cobol.vim @@ -1,25 +1,18 @@ " Vim syntax file -" Language: COBOL -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Language: COBOL +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " (formerly Davyd Ondrejko <vondraco@columbus.rr.com>) " (formerly Sitaram Chamarty <sitaram@diac.com> and -" James Mitchell <james_mitchell@acm.org>) -" $Id: cobol.vim,v 1.2 2007/05/05 18:23:43 vimboss Exp $ - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" James Mitchell <james_mitchell@acm.org>) +" Last Change: 2015 Feb 13 + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " MOST important - else most of the keywords wont work! -if version < 600 - set isk=@,48-57,- -else - setlocal isk=@,48-57,- -endif +setlocal isk=@,48-57,- syn case ignore @@ -145,7 +138,7 @@ syn match cobolString /'[^']*\('\|$\)/ syn match cobolIndicator "\%7c[D-]" contained if exists("cobol_legacy_code") - syn region cobolCondFlow contains=ALLBUT,cobolLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend + syn region cobolCondFlow contains=ALLBUT,cobolLine,cobolBadLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend endif " many legacy sources have junk in columns 1-6: must be before others @@ -157,52 +150,42 @@ else endif " 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_cobol_syntax_inits") - if version < 508 - let did_cobol_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink cobolBAD Error - HiLink cobolBadID Error - HiLink cobolBadLine Error - if exists("g:cobol_legacy_code") - HiLink cobolMarker Comment - else - HiLink cobolMarker Error - endif - HiLink cobolCALLs Function - HiLink cobolComment Comment - HiLink cobolKeys Comment - HiLink cobolAreaB Special - HiLink cobolCompiler PreProc - HiLink cobolCondFlow Special - HiLink cobolCopy PreProc - HiLink cobolDeclA cobolDecl - HiLink cobolDecl Type - HiLink cobolExtras Special - HiLink cobolGoTo Special - HiLink cobolConstant Constant - HiLink cobolNumber Constant - HiLink cobolPic Constant - HiLink cobolReserved Statement - HiLink cobolDivision Label - HiLink cobolSection Label - HiLink cobolParagraph Label - HiLink cobolDivisionName Keyword - HiLink cobolSectionName Keyword - HiLink cobolParagraphName Keyword - HiLink cobolString Constant - HiLink cobolTodo Todo - HiLink cobolWatch Special - HiLink cobolIndicator Special - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link cobolBAD Error +hi def link cobolBadID Error +hi def link cobolBadLine Error +if exists("g:cobol_legacy_code") + hi def link cobolMarker Comment +else + hi def link cobolMarker Error endif +hi def link cobolCALLs Function +hi def link cobolComment Comment +hi def link cobolKeys Comment +hi def link cobolAreaB Special +hi def link cobolCompiler PreProc +hi def link cobolCondFlow Special +hi def link cobolCopy PreProc +hi def link cobolDeclA cobolDecl +hi def link cobolDecl Type +hi def link cobolExtras Special +hi def link cobolGoTo Special +hi def link cobolConstant Constant +hi def link cobolNumber Constant +hi def link cobolPic Constant +hi def link cobolReserved Statement +hi def link cobolDivision Label +hi def link cobolSection Label +hi def link cobolParagraph Label +hi def link cobolDivisionName Keyword +hi def link cobolSectionName Keyword +hi def link cobolParagraphName Keyword +hi def link cobolString Constant +hi def link cobolTodo Todo +hi def link cobolWatch Special +hi def link cobolIndicator Special + let b:current_syntax = "cobol" diff --git a/runtime/syntax/coco.vim b/runtime/syntax/coco.vim index 4094a55303..ae32348bcb 100644 --- a/runtime/syntax/coco.vim +++ b/runtime/syntax/coco.vim @@ -5,9 +5,8 @@ " Remark: Coco/R syntax partially implemented. " License: Vim license -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/config.vim b/runtime/syntax/config.vim index 20ca19ced0..3636ed4130 100644 --- a/runtime/syntax/config.vim +++ b/runtime/syntax/config.vim @@ -1,56 +1,53 @@ " Vim syntax file " Language: configure.in script: M4 with sh -" Maintainer: Christian Hammesr <ch@lathspell.westend.com> -" Last Change: 2008 Sep 03 +" Former Maintainer: Christian Hammesr <ch@lathspell.westend.com> +" Last Change: 2018 Feb 03 +" (patch from Yngve Inntjore Levinsen to detect AC_MSG) +" (patch from Khym Chanur to add @Spell) +" (patch from James McCoy to fix paren matching) " Well, I actually even do not know much about m4. This explains why there " is probably very much missing here, yet ! -" But I missed a good hilighting when editing my GNU autoconf/automake +" But I missed good highlighting when editing my GNU autoconf/automake " script, so I wrote this quick and dirty patch. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " define the config syntax syn match configdelimiter "[()\[\];,]" syn match configoperator "[=|&\*\+\<\>]" -syn match configcomment "\(dnl.*\)\|\(#.*\)" +syn match configcomment "\(dnl.*\)\|\(#.*\)" contains=configDnl,@Spell syn match configfunction "\<[A-Z_][A-Z0-9_]*\>" syn match confignumber "[-+]\=\<\d\+\(\.\d*\)\=\>" +syn keyword configDnl dnl contained syn keyword configkeyword if then else fi test for in do done syn keyword configspecial cat rm eval -syn region configstring start=+"+ skip=+\\"+ end=+"+ -syn region configstring start=+'+ skip=+\\'+ end=+'+ -syn region configstring start=+`+ skip=+\\'+ end=+`+ + +" This shortens the script, see syn-ext-match.. +syn region configstring start=+\z(["'`]\)+ skip=+\\\z1+ end=+\z1+ contains=@Spell + +" Anything inside AC_MSG_TYPE([...]) and AC_MSG_TYPE(...) is a string. +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell " 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_config_syntax_inits") - if version < 508 - let did_config_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink configdelimiter Delimiter - HiLink configoperator Operator - HiLink configcomment Comment - HiLink configfunction Function - HiLink confignumber Number - HiLink configkeyword Keyword - HiLink configspecial Special - HiLink configstring String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link configdelimiter Delimiter +hi def link configoperator Operator +hi def link configcomment Comment +hi def link configDnl Comment +hi def link configfunction Function +hi def link confignumber Number +hi def link configkeyword Keyword +hi def link configspecial Special +hi def link configstring String +hi def link configmsg String + let b:current_syntax = "config" diff --git a/runtime/syntax/context.vim b/runtime/syntax/context.vim index 225cc6efc2..b29f256baa 100644 --- a/runtime/syntax/context.vim +++ b/runtime/syntax/context.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: ConTeXt typesetting engine -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-08-10 +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 16 if exists("b:current_syntax") finish @@ -13,65 +14,93 @@ unlet b:current_syntax let s:cpo_save = &cpo set cpo&vim -if !exists('g:context_include') - let g:context_include = ['mp', 'javascript', 'xml'] +" Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. +let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) + +" For backward compatibility (g:context_include used to be a List) +if type(s:context_include) ==# type([]) + let g:context_metapost = (index(s:context_include, 'mp') != -1) + let s:context_include = filter( + \ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'}, + \ { k,_ -> index(s:context_include, k) != -1 } + \ ) endif +syn iskeyword @,48-57,a-z,A-Z,192-255 + syn spell toplevel -syn match contextBlockDelim display '\\\%(start\|stop\)\a\+' - \ contains=@NoSpell +" ConTeXt options, i.e., [...] blocks +syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell + +" Highlight braces +syn match contextDelimiter '[{}]' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\z(\A\)' end='\z1' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\={' end='}' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\type\=<<' end='>>' +" Comments +syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo +syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo + +syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell + +syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' syn region contextEscaped matchgroup=contextPreProc \ start='\\start\z(\a*\%(typing\|typen\)\)' \ end='\\stop\z1' contains=plaintexComment keepend -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\\h\+Type{' end='}' -syn region contextEscaped display matchgroup=contextPreProc - \ start='\\Typed\h\+{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' syn match contextBuiltin display contains=@NoSpell - \ '\\\%(unprotect\|protect\|unexpanded\)' + \ '\\\%(unprotect\|protect\|unexpanded\)\>' -syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\).*$' +syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>' \ contains=@NoSpell -if index(g:context_include, 'mp') != -1 +if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + let b:mp_metafun_macros = 1 " Highlight MetaFun keywords syn include @mpTop syntax/mp.vim unlet b:current_syntax - syn region contextMPGraphic transparent matchgroup=contextBlockDelim - \ start='\\start\z(\a*MPgraphic\|MP\%(page\|inclusions\|run\)\).*' + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$' + \ end='\\stop\z1' + \ contains=@mpTop,@NoSpell + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$' \ end='\\stop\z1' - \ contains=@mpTop + \ contains=@mpTop,@NoSpell endif -" TODO: also need to implement this for \\typeC or something along those -" lines. -function! s:include_syntax(name, group) - if index(g:context_include, a:name) != -1 - execute 'syn include @' . a:name . 'Top' 'syntax/' . a:name . '.vim' - unlet b:current_syntax - execute 'syn region context' . a:group . 'Code' - \ 'transparent matchgroup=contextBlockDelim' - \ 'start=+\\start' . a:group . '+ end=+\\stop' . a:group . '+' - \ 'contains=@' . a:name . 'Top' - endif -endfunction - -call s:include_syntax('c', 'C') -call s:include_syntax('ruby', 'Ruby') -call s:include_syntax('javascript', 'JS') -call s:include_syntax('xml', 'XML') - -syn match contextSectioning '\\chapter\>' contains=@NoSpell -syn match contextSectioning '\\\%(sub\)*section\>' contains=@NoSpell +if get(b:, 'context_lua', get(g:, 'context_lua', 1)) + syn include @luaTop syntax/lua.vim + unlet b:current_syntax + + syn region contextLuaCode matchgroup=contextBlockDelim + \ start='\\startluacode\>' + \ end='\\stopluacode\>' keepend + \ contains=@luaTop,@NoSpell + + syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\=" + \ nextgroup=contextBeginEndLua skipwhite skipempty + \ contains=initexComment + syn region contextBeginEndLua matchgroup=contextSpecial + \ start="{" end="}" skip="\\[{}]" + \ contained contains=@luaTop,@NoSpell +endif + +for synname in keys(s:context_include) + execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim' + unlet b:current_syntax + execute 'syn region context' . s:context_include[synname] . 'Code' + \ 'matchgroup=contextBlockDelim' + \ 'start=+\\start' . s:context_include[synname] . '+' + \ 'end=+\\stop' . s:context_include[synname] . '+' + \ 'contains=@' . synname . 'Top,@NoSpell' +endfor + +syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' + \ contains=@NoSpell syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|' \ contains=@NoSpell @@ -92,15 +121,19 @@ syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' \ contains=@NoSpell +hi def link contextOptions Typedef +hi def link contextComment Comment hi def link contextBlockDelim Keyword hi def link contextBuiltin Keyword hi def link contextDelimiter Delimiter +hi def link contextEscaped String hi def link contextPreProc PreProc hi def link contextSectioning PreProc hi def link contextSpecial Special hi def link contextType Type hi def link contextStyle contextType hi def link contextFont contextType +hi def link contextDirectLua Keyword let b:current_syntax = "context" diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 04fc73342c..5a478fb77d 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -1,29 +1,23 @@ " Vim syntax file " Language: C++ -" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim) +" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> -" Last Change: 2014 May 14 +" Last Change: 2016 Oct 28 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - so <sfile>:p:h/c.vim -else - runtime! syntax/c.vim - unlet b:current_syntax -endif +runtime! syntax/c.vim +unlet b:current_syntax " C++ extensions syn keyword cppStatement new delete this friend using syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t +syn keyword cppModifier inline virtual explicit export +syn keyword cppType bool wchar_t syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq @@ -32,41 +26,51 @@ syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" syn keyword cppStorageClass mutable syn keyword cppStructure class typename template namespace syn keyword cppBoolean true false +syn keyword cppConstant __cplusplus " C++ 11 extensions if !exists("cpp_no_cpp11") - syn keyword cppType override final + syn keyword cppModifier override final + syn keyword cppType nullptr_t auto syn keyword cppExceptions noexcept - syn keyword cppStorageClass constexpr decltype + syn keyword cppStorageClass constexpr decltype thread_local syn keyword cppConstant nullptr - syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT + syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE + syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE + syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE + syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE + syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE + syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell +endif + +" C++ 14 extensions +if !exists("cpp_no_cpp14") + syn case ignore + syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>" + syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" + syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>" + syn case match endif " The minimum and maximum operators in GNU C++ syn match cppMinMax "[<>]?" " Default highlighting -if version >= 508 || !exists("did_cpp_syntax_inits") - if version < 508 - let did_cpp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink cppAccess cppStatement - HiLink cppCast cppStatement - HiLink cppExceptions Exception - HiLink cppOperator Operator - HiLink cppStatement Statement - HiLink cppType Type - HiLink cppStorageClass StorageClass - HiLink cppStructure Structure - HiLink cppBoolean Boolean - HiLink cppConstant Constant - HiLink cppRawDelimiter Delimiter - HiLink cppRawString String - delcommand HiLink -endif +hi def link cppAccess cppStatement +hi def link cppCast cppStatement +hi def link cppExceptions Exception +hi def link cppOperator Operator +hi def link cppStatement Statement +hi def link cppModifier Type +hi def link cppType Type +hi def link cppStorageClass StorageClass +hi def link cppStructure Structure +hi def link cppBoolean Boolean +hi def link cppConstant Constant +hi def link cppRawStringDelimiter Delimiter +hi def link cppRawString String +hi def link cppNumber Number let b:current_syntax = "cpp" diff --git a/runtime/syntax/crm.vim b/runtime/syntax/crm.vim index 17b67d44f0..5285de3e23 100644 --- a/runtime/syntax/crm.vim +++ b/runtime/syntax/crm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: CRM114 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: CRM114 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/crontab.vim b/runtime/syntax/crontab.vim index 36d75c4d13..5e38ffaafe 100644 --- a/runtime/syntax/crontab.vim +++ b/runtime/syntax/crontab.vim @@ -5,19 +5,22 @@ " License: This file can be redistribued and/or modified under the same terms " as Vim itself. " Filenames: /tmp/crontab.* used by "crontab -e" -" Last Change: 2012-05-16 +" Last Change: 2015-01-20 " " crontab line format: " Minutes Hours Days Months Days_of_Week Commands # comments -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif +syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite + +syntax match crontabVar "^\s*\k\w*\s*="me=e-1 + +syntax case ignore + syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained @@ -32,46 +35,32 @@ syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains syntax match crontabCmnt "^\s*#.*" contains=@Spell syntax match crontabPercent "[^\\]%.*"lc=1 contained -syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite +" Define the default highlighting. +" Only when an item doesn't have highlighting yet -syntax match crontabVar "^\s*\k\w*\s*="me=e-1 +hi def link crontabMin Number +hi def link crontabHr PreProc +hi def link crontabDay Type -" 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_crontab_syn_inits") - if version < 508 - let did_crontab_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink crontabMin Number - HiLink crontabHr PreProc - HiLink crontabDay Type - - HiLink crontabMnth Number - HiLink crontabMnth12 Number - HiLink crontabMnthS Number - HiLink crontabMnthN Number - - HiLink crontabDow PreProc - HiLink crontabDow7 PreProc - HiLink crontabDowS PreProc - HiLink crontabDowN PreProc - - HiLink crontabNick Special - HiLink crontabVar Identifier - HiLink crontabPercent Special +hi def link crontabMnth Number +hi def link crontabMnth12 Number +hi def link crontabMnthS Number +hi def link crontabMnthN Number + +hi def link crontabDow PreProc +hi def link crontabDow7 PreProc +hi def link crontabDowS PreProc +hi def link crontabDowN PreProc + +hi def link crontabNick Special +hi def link crontabVar Identifier +hi def link crontabPercent Special " comment out next line for to suppress unix commands coloring. - HiLink crontabCmd Statement +hi def link crontabCmd Statement - HiLink crontabCmnt Comment +hi def link crontabCmnt Comment - delcommand HiLink -endif let b:current_syntax = "crontab" diff --git a/runtime/syntax/cs.vim b/runtime/syntax/cs.vim index 2ba629f921..111bc85dfe 100644 --- a/runtime/syntax/cs.vim +++ b/runtime/syntax/cs.vim @@ -1,10 +1,12 @@ " Vim syntax file -" Language: C# -" Maintainer: Anduin Withers <awithers@anduin.com> +" Language: C# +" Maintainer: Nick Jensen <nickspoon@gmail.com> +" Former Maintainer: Anduin Withers <awithers@anduin.com> " Former Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Fri Aug 14 13:56:37 PDT 2009 -" Filenames: *.cs -" $Id: cs.vim,v 1.4 2006/05/03 21:20:02 vimboss Exp $ +" Last Change: 2018-05-02 +" Filenames: *.cs +" License: Vim (see :h license) +" Repository: https://github.com/nickspoons/vim-cs " " REFERENCES: " [1] ECMA TC39: C# Language Specification (WD13Oct01.doc) @@ -17,11 +19,8 @@ let s:cs_cpo_save = &cpo set cpo&vim -" type -syn keyword csType bool byte char decimal double float int long object sbyte short string uint ulong ushort void -" storage -syn keyword csStorage class delegate enum interface namespace struct -" repeat / condition / label +syn keyword csType bool byte char decimal double float int long object sbyte short string T uint ulong ushort var void dynamic +syn keyword csStorage delegate enum interface namespace struct syn keyword csRepeat break continue do for foreach goto return while syn keyword csConditional else if switch syn keyword csLabel case default @@ -29,21 +28,16 @@ syn keyword csLabel case default syn match csOperatorError display +::+ " user labels (see [1] 8.6 Statements) syn match csLabel display +^\s*\I\i*\s*:\([^:]\)\@=+ -" modifier syn keyword csModifier abstract const extern internal override private protected public readonly sealed static virtual volatile -" constant syn keyword csConstant false null true -" exception -syn keyword csException try catch finally throw +syn keyword csException try catch finally throw when +syn keyword csLinq ascending by descending equals from group in into join let on orderby select where +syn keyword csAsync async await -" TODO: -syn keyword csUnspecifiedStatement as base checked event fixed in is lock new operator out params ref sizeof stackalloc this typeof unchecked unsafe using -" TODO: +syn keyword csUnspecifiedStatement as base checked event fixed get in is lock nameof operator out params ref set sizeof stackalloc this typeof unchecked unsafe using syn keyword csUnsupportedStatement add remove value -" TODO: syn keyword csUnspecifiedKeyword explicit implicit - " Contextual Keywords syn match csContextualStatement /\<yield[[:space:]\n]\+\(return\|break\)/me=s+5 syn match csContextualStatement /\<partial[[:space:]\n]\+\(class\|struct\|interface\)/me=s+7 @@ -56,7 +50,7 @@ syn match csContextualStatement /\<where\>[^:]\+:/me=s+5 " " TODO: include strings ? " -syn keyword csTodo contained TODO FIXME XXX NOTE +syn keyword csTodo contained TODO FIXME XXX NOTE HACK syn region csComment start="/\*" end="\*/" contains=@csCommentHook,csTodo,@Spell syn match csComment "//.*$" contains=@csCommentHook,csTodo,@Spell @@ -89,8 +83,15 @@ syn region csPreCondit \ skip="\\$" end="$" contains=csComment keepend syn region csRegion matchgroup=csPreCondit start="^\s*#\s*region.*$" \ end="^\s*#\s*endregion" transparent fold contains=TOP +syn region csSummary start="^\s*/// <summary" end="^\(\s*///\)\@!" transparent fold keepend +syn region csClassType start="\(@\)\@<!class\>"hs=s+6 end="[:\n{]"he=e-1 contains=csClass +syn region csNewType start="\(@\)\@<!new\>"hs=s+4 end="[\(\<{\[]"he=e-1 contains=csNew contains=csNewType +syn region csIsType start="\v (is|as) "hs=s+4 end="\v[A-Za-z0-9]+" oneline contains=csIsAs +syn keyword csNew new contained +syn keyword csClass class contained +syn keyword csIsAs is as " Strings and constants syn match csSpecialError contained "\\." @@ -113,7 +114,11 @@ syn match csNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" " The default highlighting. hi def link csType Type +hi def link csNewType Type +hi def link csClassType Type +hi def link csIsType Type hi def link csStorage StorageClass +hi def link csClass StorageClass hi def link csRepeat Repeat hi def link csConditional Conditional hi def link csLabel Label @@ -123,8 +128,13 @@ hi def link csException Exception hi def link csUnspecifiedStatement Statement hi def link csUnsupportedStatement Statement hi def link csUnspecifiedKeyword Keyword +hi def link csNew Statement +hi def link csLinq Statement +hi def link csIsAs Keyword +hi def link csAsync Keyword hi def link csContextualStatement Statement hi def link csOperatorError Error +hi def link csInterfaceDeclaration Include hi def link csTodo Todo hi def link csComment Comment diff --git a/runtime/syntax/csc.vim b/runtime/syntax/csc.vim index 5493b17f5f..6e5d8b9f37 100644 --- a/runtime/syntax/csc.vim +++ b/runtime/syntax/csc.vim @@ -3,11 +3,8 @@ " Maintainer: Raul Segura Acevedo <raulseguraaceved@netscape.net> " Last change: 2011 Dec 25 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -145,7 +142,7 @@ sy match cscBPMacro contained "!" sy match cscBPW "!\s*\a*" contains=cscBPmacro " when wanted, highlighting lhs members or erros in asignments (may lag the editing) -if version >= 600 && exists("csc_asignment") +if exists("csc_asignment") sy match cscEqError '\("[^"]*"\s*\|[^][\t !%()*+,--/:;<=>{}~]\+\s*\|->\s*\)*=\([^=]\@=\|$\)' sy region cscFormula transparent matchgroup=cscVarName start='\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\s*=\([^=]\@=\|\n\)' skip='"[^"]*"' end=';' contains=ALLBUT,cscFormula,cscFormulaIn,cscBPMacro,cscCondition sy region cscFormulaIn matchgroup=cscVarName transparent start='\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\(->\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\)*\s*=\([^=]\@=\|$\)' skip='"[^"]*"' end=';' contains=ALLBUT,cscFormula,cscFormulaIn,cscBPMacro,cscCondition contained @@ -158,44 +155,34 @@ endif exec "sy sync ccomment cscComment minlines=" . csc_minlines " 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_csc_syntax_inits") - if version < 508 - let did_csc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi cscVarName term=bold ctermfg=9 gui=bold guifg=blue + +hi def link cscNumber Number +hi def link cscOctal Number +hi def link cscFloat Float +hi def link cscParenE Error +hi def link cscCommentE Error +hi def link cscSpaceE Error +hi def link cscError Error +hi def link cscString String +hi def link cscComment Comment +hi def link cscTodo Todo +hi def link cscStatement Statement +hi def link cscIfError Error +hi def link cscEqError Error +hi def link cscFunction Statement +hi def link cscCondition Statement +hi def link cscWarn WarningMsg + +hi def link cscComE Error +hi def link cscCom Statement +hi def link cscComW WarningMsg + +hi def link cscBPMacro Identifier +hi def link cscBPW WarningMsg - hi cscVarName term=bold ctermfg=9 gui=bold guifg=blue - - HiLink cscNumber Number - HiLink cscOctal Number - HiLink cscFloat Float - HiLink cscParenE Error - HiLink cscCommentE Error - HiLink cscSpaceE Error - HiLink cscError Error - HiLink cscString String - HiLink cscComment Comment - HiLink cscTodo Todo - HiLink cscStatement Statement - HiLink cscIfError Error - HiLink cscEqError Error - HiLink cscFunction Statement - HiLink cscCondition Statement - HiLink cscWarn WarningMsg - - HiLink cscComE Error - HiLink cscCom Statement - HiLink cscComW WarningMsg - - HiLink cscBPMacro Identifier - HiLink cscBPW WarningMsg - - delcommand HiLink -endif let b:current_syntax = "csc" diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim index 39603fa158..c134aa7ef3 100644 --- a/runtime/syntax/csh.vim +++ b/runtime/syntax/csh.vim @@ -1,15 +1,12 @@ " Vim syntax file " Language: C-shell (csh) -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Version: 10 -" Last Change: Sep 11, 2006 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 13 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -100,59 +97,45 @@ syn match cshNumber "-\=\<\d\+\>" "syn match cshIdentifier "\<[a-zA-Z._][a-zA-Z0-9._]*\>" " Shell Input Redirection (Here Documents) -if version < 600 - syn region cshHereDoc matchgroup=cshRedir start="<<-\=\s*\**END[a-zA-Z_0-9]*\**" matchgroup=cshRedir end="^END[a-zA-Z_0-9]*$" - syn region cshHereDoc matchgroup=cshRedir start="<<-\=\s*\**EOF\**" matchgroup=cshRedir end="^EOF$" -else - syn region cshHereDoc matchgroup=cshRedir start="<<-\=\s*\**\z(\h\w*\)\**" matchgroup=cshRedir end="^\z1$" -endif +syn region cshHereDoc matchgroup=cshRedir start="<<-\=\s*\**\z(\h\w*\)\**" matchgroup=cshRedir end="^\z1$" " 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_csh_syntax_inits") - if version < 508 - let did_csh_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink cshArgv cshVariables - HiLink cshBckQuote cshCommand - HiLink cshDblQuote cshString - HiLink cshExtVar cshVariables - HiLink cshHereDoc cshString - HiLink cshNoEndlineBQ cshNoEndline - HiLink cshNoEndlineDQ cshNoEndline - HiLink cshNoEndlineSQ cshNoEndline - HiLink cshQtyWord cshVariables - HiLink cshRedir cshOperator - HiLink cshSelector cshVariables - HiLink cshSetStmt cshStatement - HiLink cshSetVariables cshVariables - HiLink cshSnglQuote cshString - HiLink cshSubst cshVariables - - HiLink cshCommand Statement - HiLink cshComment Comment - HiLink cshConditional Conditional - HiLink cshIdentifier Error - HiLink cshModifier Special - HiLink cshNoEndline Error - HiLink cshNumber Number - HiLink cshOperator Operator - HiLink cshRedir Statement - HiLink cshRepeat Repeat - HiLink cshShellVariables Special - HiLink cshSpecial Special - HiLink cshStatement Statement - HiLink cshString String - HiLink cshSubstError Error - HiLink cshTodo Todo - HiLink cshVariables Type - - delcommand HiLink +if !exists("skip_csh_syntax_inits") + + hi def link cshArgv cshVariables + hi def link cshBckQuote cshCommand + hi def link cshDblQuote cshString + hi def link cshExtVar cshVariables + hi def link cshHereDoc cshString + hi def link cshNoEndlineBQ cshNoEndline + hi def link cshNoEndlineDQ cshNoEndline + hi def link cshNoEndlineSQ cshNoEndline + hi def link cshQtyWord cshVariables + hi def link cshRedir cshOperator + hi def link cshSelector cshVariables + hi def link cshSetStmt cshStatement + hi def link cshSetVariables cshVariables + hi def link cshSnglQuote cshString + hi def link cshSubst cshVariables + + hi def link cshCommand Statement + hi def link cshComment Comment + hi def link cshConditional Conditional + hi def link cshIdentifier Error + hi def link cshModifier Special + hi def link cshNoEndline Error + hi def link cshNumber Number + hi def link cshOperator Operator + hi def link cshRedir Statement + hi def link cshRepeat Repeat + hi def link cshShellVariables Special + hi def link cshSpecial Special + hi def link cshStatement Statement + hi def link cshString String + hi def link cshSubstError Error + hi def link cshTodo Todo + hi def link cshVariables Type + endif let b:current_syntax = "csh" diff --git a/runtime/syntax/csp.vim b/runtime/syntax/csp.vim index bd6213efd9..8001b1fe7e 100644 --- a/runtime/syntax/csp.vim +++ b/runtime/syntax/csp.vim @@ -15,11 +15,8 @@ " - The additional syntax for the RT-Tester (pseudo-comments) " should be optional. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -149,46 +146,36 @@ syn match cspSdlRttComment "pragma\s\+SDL_MATCH\s\+" nextgroup=cspRttPragmaSdlAr syn sync lines=250 " 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_csp_syn_inits") - if version < 508 - let did_csp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - " (For vim version <=5.7, the command groups are defined in - " $VIMRUNTIME/syntax/synload.vim ) - HiLink cspComment Comment - HiLink cspNumber Number - HiLink cspConditional Conditional - HiLink cspOperator Delimiter - HiLink cspKeyword Keyword - HiLink cspReserved SpecialChar - HiLink cspInclude Error - HiLink cspIncludeKeyword Include - HiLink cspIncludeArg Include - HiLink cspAssert PreCondit - HiLink cspType Type - HiLink cspProcess Function - HiLink cspTodo Todo - HiLink cspOldRttComment Define - HiLink cspRttPragmaKeyword Define - HiLink cspSdlRttComment Define - HiLink cspRttPragmaArg Define - HiLink cspRttPragmaSdlArg Define - HiLink cspRttPragmaSdlName Default - HiLink cspRttPragmaSdlTailArg Define - HiLink cspRttPragmaSdlTransName Default - HiLink cspRttPragmaSdlTransTailArg Define - HiLink cspReservedIdentifier Error - " (Currently unused vim method: Debug) - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +" (For vim version <=5.7, the command groups are defined in +" $VIMRUNTIME/syntax/synload.vim ) +hi def link cspComment Comment +hi def link cspNumber Number +hi def link cspConditional Conditional +hi def link cspOperator Delimiter +hi def link cspKeyword Keyword +hi def link cspReserved SpecialChar +hi def link cspInclude Error +hi def link cspIncludeKeyword Include +hi def link cspIncludeArg Include +hi def link cspAssert PreCondit +hi def link cspType Type +hi def link cspProcess Function +hi def link cspTodo Todo +hi def link cspOldRttComment Define +hi def link cspRttPragmaKeyword Define +hi def link cspSdlRttComment Define +hi def link cspRttPragmaArg Define +hi def link cspRttPragmaSdlArg Define +hi def link cspRttPragmaSdlName Default +hi def link cspRttPragmaSdlTailArg Define +hi def link cspRttPragmaSdlTransName Default +hi def link cspRttPragmaSdlTransTailArg Define +hi def link cspReservedIdentifier Error +" (Currently unused vim method: Debug) + let b:current_syntax = "csp" diff --git a/runtime/syntax/css.vim b/runtime/syntax/css.vim index c6fc6a7ae2..ecdbc1795c 100644 --- a/runtime/syntax/css.vim +++ b/runtime/syntax/css.vim @@ -4,16 +4,14 @@ " Claudio Fleiner <claudio@fleiner.com> (Maintainer) " Yeti (Add full CSS2, HTML4 support) " Nikolai Weibull (Add CSS2 support) -" Maintainer: Jules Wang <w.jq0722@gmail.com> " URL: https://github.com/JulesWang/css.vim -" Last Change: 2013 Nov.27 +" Maintainer: Jules Wang <w.jq0722@gmail.com> +" Last Change: 2018 Feb. 27 +" cssClassName updated by Ryuichi Hayashida Jan 2016 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif let main_syntax = 'css' @@ -26,18 +24,19 @@ set cpo&vim syn case ignore -" All HTML4 tags -syn keyword cssTagName abbr acronym address applet area a b base -syn keyword cssTagName basefont bdo big blockquote body br button -syn keyword cssTagName caption center cite code col colgroup dd del -syn keyword cssTagName dfn dir div dl dt em fieldset font form frame -syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i -syn keyword cssTagName iframe img input ins isindex kbd label legend li -syn keyword cssTagName link map menu meta noframes noscript ol optgroup -syn keyword cssTagName option p param pre q s samp script select small -syn keyword cssTagName span strike strong style sub sup table tbody td -syn keyword cssTagName textarea tfoot th thead title tr tt ul u var +" HTML4 tags +syn keyword cssTagName abbr address area a b base +syn keyword cssTagName bdo blockquote body br button +syn keyword cssTagName caption cite code col colgroup dd del +syn keyword cssTagName dfn div dl dt em fieldset form +syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i +syn keyword cssTagName iframe input ins isindex kbd label legend li +syn keyword cssTagName link map menu meta noscript ol optgroup +syn keyword cssTagName option p param pre q s samp script small +syn keyword cssTagName span strong sub sup tbody td +syn keyword cssTagName textarea tfoot th thead title tr ul u var syn keyword cssTagName object svg +syn match cssTagName /\<select\>\|\<style\>\|\<table\>/ " 34 HTML5 tags syn keyword cssTagName article aside audio bdi canvas command data @@ -47,8 +46,8 @@ syn keyword cssTagName output progress rt rp ruby section syn keyword cssTagName source summary time track video wbr " Tags not supported in HTML5 -syn keyword cssDeprecated acronym applet basefont big center dir -syn keyword cssDeprecated font frame frameset noframes strike tt +" acronym applet basefont big center dir +" font frame frameset noframes strike tt syn match cssTagName "\*" @@ -58,7 +57,7 @@ syn match cssSelectorOp2 "[~|^$*]\?=" contained syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ " .class and #id -syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot +syn match cssClassName "\.-\=[A-Za-z_][A-Za-z0-9_-]*" contains=cssClassNameDot syn match cssClassNameDot contained '\.' try @@ -70,61 +69,11 @@ endtry " digits syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators -syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)" contains=cssUnitDecorators -syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)" contains=cssUnitDecorators -syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)" contains=cssUnitDecorators -syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)" contains=cssUnitDecorators - - -syn match cssIncludeKeyword /@\(-[a-z]+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained -" @media -syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock -syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl -syn keyword cssMediaKeyword only not and contained -syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssTagName,cssClassName,cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,cssAttributeSelector fold -syn match cssMediaComma "," skipwhite skipnl contained - -" Reference: http://www.w3.org/TR/css3-mediaqueries/ -syn keyword cssMediaProp contained width height orientation scan grid -syn match cssMediaProp contained /\(\(device\)-\)\=aspect-ratio/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/ -syn keyword cssMediaAttr contained portrait landscape progressive interlace - -" @page -" http://www.w3.org/TR/css3-page/ -syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl -syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl -syn region cssPageWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssPageMargin,cssPageProp,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks -syn match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl -syn keyword cssPageProp contained content size -" http://www.w3.org/TR/CSS2/page.html#break-inside -syn keyword cssPageProp contained orphans widows - -" @keyframe -" http://www.w3.org/TR/css3-animations/#keyframes -syn match cssKeyFrame "@\(-[a-z]+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent -syn region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector -syn match cssKeyFrameSelector /\(\d*%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition - -" @import -syn region cssInclude start=/@import\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType -syn region cssInclude start=/@charset\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword -syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword - -" @font-face -" http://www.w3.org/TR/css3-fonts/#at-font-face-rule -syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl -syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr -"syn match cssFontDescriptorProp contained "\<\(unicode-range\|unit-per-em\|panose-1\|cap-height\|x-height\|definition-src\)\>" -"syn keyword cssFontDescriptorProp contained src stemv stemh slope ascent descent widths bbox baseline centerline mathline topline -syn keyword cssFontDescriptorProp contained src -syn match cssFontDescriptorProp contained "\<unicode-range\>" -syn keyword cssFontDescriptorAttr contained all -syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend -syn match cssUnicodeRange contained "U+[0-9A-Fa-f?]\+" -syn match cssUnicodeRange contained "U+\x\+-\x\+" +syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators +syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=%" contains=cssUnitDecorators +syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators +syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators +syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators " The 16 basic color names syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow @@ -133,26 +82,26 @@ syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon na syn keyword cssColor contained aliceblue antiquewhite aquamarine azure syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan -syn match cssColor contained /dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)/ -syn match cssColor contained /dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)/ -syn match cssColor contained /darkslate\(blue\|gray\|grey\)/ -syn match cssColor contained /dark\(turquoise\|violet\)/ +syn match cssColor contained /\<dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)\>/ +syn match cssColor contained /\<dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)\>/ +syn match cssColor contained /\<darkslate\(blue\|gray\|grey\)\>/ +syn match cssColor contained /\<dark\(turquoise\|violet\)\>/ syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen syn keyword cssColor contained lemonchiffon limegreen linen magenta -syn match cssColor contained /light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)/ -syn match cssColor contained /light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)/ -syn match cssColor contained /light\(slategray\|slategrey\|steelblue\)/ -syn match cssColor contained /medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)/ -syn match cssColor contained /medium\(slateblue\|springgreen\|turquoise\|violetred\)/ +syn match cssColor contained /\<light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)\>/ +syn match cssColor contained /\<light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)\>/ +syn match cssColor contained /\<light\(slategray\|slategrey\|steelblue\)\>/ +syn match cssColor contained /\<medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)\>/ +syn match cssColor contained /\<medium\(slateblue\|springgreen\|turquoise\|violetred\)\>/ syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite syn keyword cssColor contained oldlace olivedrab orange orangered orchid -syn match cssColor contained /pale\(goldenrod\|green\|turquoise\|violetred\)/ +syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/ syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue -syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown -syn keyword cssColor contained seagreen seashell sienna skyblue slateblue +syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon +syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan syn keyword cssColor contained thistle tomato turquoise violet wheat syn keyword cssColor contained whitesmoke yellowgreen @@ -167,11 +116,13 @@ syn case ignore syn match cssImportant contained "!\s*important\>" syn match cssColor contained "\<transparent\>" +syn match cssColor contained "\<currentColor\>" syn match cssColor contained "\<white\>" -syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators -syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{3,4\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{6\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators -syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" oneline extend +syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\)\=\gradient\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma @@ -196,6 +147,9 @@ syn keyword cssAnimationAttr contained forwards backwards both " animation-play-state attributes syn keyword cssAnimationAttr contained running paused + +" animation-iteration-count attributes +syn keyword cssAnimationAttr contained infinite "------------------------------------------------ " CSS Backgrounds and Borders Module Level 3 " http://www.w3.org/TR/css3-background/ @@ -209,7 +163,6 @@ syn keyword cssBackgroundAttr contained left center right top bottom " background-repeat attributes syn match cssBackgroundAttr contained "\<no-repeat\>" syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>" -syn keyword cssBackgroundAttr contained space round " background-size attributes syn keyword cssBackgroundAttr contained cover contain @@ -221,7 +174,7 @@ syn match cssBorderProp contained "\<box-decoration-break\>" syn match cssBorderProp contained "\<box-shadow\>" " border-image attributes -syn keyword cssBorderAttr contained stretch round space fill +syn keyword cssBorderAttr contained stretch round fill " border-style attributes syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset @@ -249,46 +202,45 @@ syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>" syn keyword cssDimensionProp contained height syn keyword cssDimensionProp contained width -" shadow and sizing are in other property groups -syn match cssFlexibleBoxProp contained "\<box-\(align\|direction\|flex\|ordinal-group\|orient\|pack\|shadow\|sizing\)\>" -syn keyword cssFlexibleBoxAttr contained start end baseline -syn keyword cssFlexibleBoxAttr contained reverse -syn keyword cssFlexibleBoxAttr contained single mulitple -syn keyword cssFlexibleBoxAttr contained horizontal -syn match cssFlexibleBoxAttr contained "\<vertical\(-align\)\@!\>" "escape vertical-align -syn match cssFlexibleBoxAttr contained "\<\(inline\|block\)-axis\>" +" CSS Flexible Box Layout Module Level 1 +" http://www.w3.org/TR/css3-flexbox/ +" CSS Box Alignment Module Level 3 +" http://www.w3.org/TR/css-align-3/ +syn match cssFlexibleBoxProp contained "\<flex\(-\(direction\|wrap\|flow\|grow\|shrink\|basis\)\)\=\>" +syn match cssFlexibleBoxProp contained "\<\(align\|justify\)\(-\(items\|self\|content\)\)\=\>" +syn keyword cssFlexibleBoxProp contained order + +syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>" +syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center +syn match cssFlexibleBoxAttr contained "\<flex\(-\(start\|end\)\)\=\>" +syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\)\)\=\>" " CSS Fonts Module Level 3 " http://www.w3.org/TR/css-fonts-3/ syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>" + " font attributes syn keyword cssFontAttr contained icon menu caption -syn match cssFontAttr contained "\<small-\(caps\|caption\)\>" syn match cssFontAttr contained "\<message-box\>" syn match cssFontAttr contained "\<status-bar\>" syn keyword cssFontAttr contained larger smaller syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>" - +syn match cssFontAttr contained "\<small-\(caps\|caption\)\>" " font-family attributes syn match cssFontAttr contained "\<\(sans-\)\=serif\>" -syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Unicode Verdana Webdings Wingdings York Zapf +syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Verdana Webdings Wingdings York Zapf syn keyword cssFontAttr contained cursive fantasy monospace - " font-feature-settings attributes syn keyword cssFontAttr contained on off - " font-stretch attributes syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>" - " font-style attributes syn keyword cssFontAttr contained italic oblique - -" font-variant-caps attributes -syn match cssFontAttr contained "\<\(all-\)\=\(small-\|petite-\|titling-\)caps\>" -syn keyword cssFontAttr contained unicase - +" font-synthesis attributes +syn keyword cssFontAttr contained weight style " font-weight attributes syn keyword cssFontAttr contained bold bolder lighter +" TODO: font-variant-* attributes "------------------------------------------------ " Webkit specific property/attributes @@ -302,12 +254,16 @@ syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>" syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>" syn keyword cssMultiColumnProp contained columns syn keyword cssMultiColumnAttr contained balance medium -syn keyword cssMultiColumnAttr contained always avoid left right page column -syn match cssMultiColumnAttr contained "\<avoid-\(page\|column\)\>" +syn keyword cssMultiColumnAttr contained always left right page column +syn match cssMultiColumnAttr contained "\<avoid\(-\(page\|column\)\)\=\>" " http://www.w3.org/TR/css3-break/#page-break syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>" +" http://www.w3.org/TR/SVG11/interact.html +syn match cssInteractProp contained "\<pointer-events\>" +syn match cssInteractAttr contained "\<\(visible\)\=\(Painted\|Fill\|Stroke\)\=\>" + " TODO find following items in w3c docs. syn keyword cssGeneratedContentProp contained quotes crop syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>" @@ -315,7 +271,12 @@ syn match cssGeneratedContentProp contained "\<move-to\>" syn match cssGeneratedContentProp contained "\<page-policy\>" syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>" -syn match cssGridProp contained "\<grid-\(columns\|rows\)\>" +" https://www.w3.org/TR/css-grid-1/ +syn match cssGridProp contained "\<grid\>" +syn match cssGridProp contained "\<grid\(-\(template\|auto\)\)\=\(-\(columns\|rows\|areas\)\)\>" +syn match cssGridProp contained "\<grid-\(column\|row\)\(-\(start\|end\|gap\)\)\=\>" +syn match cssGridProp contained "\<grid-\(area\|gap\)\>" +syn match cssGridProp contained "\<grid-auto-flow\>" syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>" @@ -329,14 +290,14 @@ syn keyword cssListAttr contained inside outside syn keyword cssPositioningProp contained bottom clear clip display float left syn keyword cssPositioningProp contained position right top visibility syn match cssPositioningProp contained "\<z-index\>" -syn keyword cssPositioningAttr contained block compact +syn keyword cssPositioningAttr contained block compact grid syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>" syn keyword cssPositioningAttr contained left right both syn match cssPositioningAttr contained "\<list-item\>" -syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\)\)\=\>" -syn keyword cssPositioningAttr contained static relative absolute fixed +syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\|grid\|flex\)\)\=\>" +syn keyword cssPositioningAttr contained static relative absolute fixed subgrid -syn keyword cssPrintAttr contained landscape portrait crop cross always avoid +syn keyword cssPrintAttr contained landscape portrait crop cross always syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>" syn keyword cssTableAttr contained fixed collapse separate show hide once always @@ -409,17 +370,20 @@ syn keyword cssUIAttr contained both horizontal vertical syn match cssUIProp contained "\<text-overflow\>" syn keyword cssUIAttr contained clip ellipsis -" Already highlighted Props: font content +syn match cssUIProp contained "\<image-rendering\>" +syn keyword cssUIAttr contained pixellated +syn match cssUIAttr contained "\<crisp-edges\>" + "------------------------------------------------ " Webkit/iOS specific attributes -syn match cssUIAttr contained '\(preserve-3d\)' +syn match cssUIAttr contained '\<preserve-3d\>' " IE specific attributes -syn match cssIEUIAttr contained '\(bicubic\)' +syn match cssIEUIAttr contained '\<bicubic\>' " Webkit/iOS specific properties -syn match cssUIProp contained '\(tap-highlight-color\|user-select\|touch-callout\)' +syn match cssUIProp contained '\<tap-highlight-color\|user-select\|touch-callout\>' " IE specific properties -syn match cssIEUIProp contained '\(interpolation-mode\|zoom\|filter\)' +syn match cssIEUIProp contained '\<interpolation-mode\|zoom\|filter\>' " Webkit/Firebox specific properties/attributes syn keyword cssUIProp contained appearance @@ -444,11 +408,25 @@ syn keyword cssAuralAttr contained male female child code digits continuous " mobile text syn match cssMobileTextProp contained "\<text-size-adjust\>" - +syn keyword cssMediaProp contained width height orientation scan grid +syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/ +syn keyword cssMediaAttr contained portrait landscape progressive interlace +syn match cssKeyFrameProp /\d*%\|from\|to/ contained nextgroup=cssDefinition +syn match cssPageMarginProp /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition +syn keyword cssPageProp contained content size +syn keyword cssPageProp contained orphans widows +syn keyword cssFontDescriptorProp contained src +syn match cssFontDescriptorProp contained "\<unicode-range\>" +" unicode-range attributes +syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+" +syn match cssFontDescriptorAttr contained "U+\x\+-\x\+" syn match cssBraces contained "[{}]" syn match cssError contained "{@<>" -syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks keepend fold +syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold syn match cssBraceError "}" syn match cssAttrComma "," @@ -466,6 +444,9 @@ syn match cssPseudoClassId contained "\<selection\>" syn match cssPseudoClassId contained "\<focus\(-inner\)\=\>" syn match cssPseudoClassId contained "\<\(input-\)\=placeholder\>" +" Misc highlight groups +syntax match cssUnitDecorators /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained +syntax match cssNoise contained /\(:\|;\|\/\)/ " Comment syn region cssComment start="/\*" end="\*/" contains=@Spell fold @@ -477,7 +458,7 @@ syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEsc syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ " Vendor Prefix -syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)" +syn match cssVendor contained "-\(webkit\|moz\|o\|ms\)-" " Various CSS Hack characters " In earlier versions of IE (6 and 7), one can prefix property names @@ -487,17 +468,41 @@ syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)" " http://www.paulirish.com/2009/browser-specific-css-hacks/ syn match cssHacks contained /\(_\|*\)/ -" Misc highlight groups -syntax match cssUnitDecorators /\(#\|-\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained -syntax match cssNoise contained /\(:\|;\|\/\)/ - " Attr Enhance " Some keywords are both Prop and Attr, so we have to handle them -syn region cssAttrRegion start=/:/ end=/;/ contained keepend contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise +syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise " Hack for transition -" The 'transition' Prop has Props after ':'. -syn region cssAttrRegion start=/transition\s*:/ end=/;/ contained keepend contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise +" 'transition' has Props after ':'. +syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise + +syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/ contained + +syn keyword cssAtRuleLogical only not and contained + +" @media +" Reference: http://www.w3.org/TR/css3-mediaqueries/ +syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment nextgroup=cssDefinition +syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained + +" @page +" http://www.w3.org/TR/css3-page/ +syn region cssAtRule start=/@page\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssPagePseudo,cssComment nextgroup=cssDefinition +syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl +" @keyframe +" http://www.w3.org/TR/css3-animations/#keyframes +syn region cssAtRule start=/@\(-[a-z]\+-\)\=keyframes\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssVendor,cssComment nextgroup=cssDefinition + +syn region cssAtRule start=/@import\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword,cssURL,cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssMediaType +syn region cssAtRule start=/@charset\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword +syn region cssAtRule start=/@namespace\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword + +" @font-face +" http://www.w3.org/TR/css3-fonts/#at-font-face-rule +syn match cssAtRule "@font-face\>" nextgroup=cssFontDescriptorBlock +" @supports +" https://www.w3.org/TR/css3-conditional/#at-supports +syn region cssAtRule start=/@supports\>/ end=/\ze{/ skipwhite skipnl contains=cssAtRuleLogical,cssAttrRegion,css.*Prop,cssValue.*,cssVendor,cssAtKeyword,cssComment nextgroup=cssDefinition if main_syntax == "css" @@ -505,139 +510,126 @@ if main_syntax == "css" endif " 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_css_syn_inits") - if version < 508 - let did_css_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink cssComment Comment - HiLink cssVendor Comment - HiLink cssHacks Comment - HiLink cssTagName Statement - HiLink cssDeprecated Error - HiLink cssSelectorOp Special - HiLink cssSelectorOp2 Special - HiLink cssAttrComma Special - - HiLink cssAnimationProp cssProp - HiLink cssBackgroundProp cssProp - HiLink cssBorderProp cssProp - HiLink cssBoxProp cssProp - HiLink cssColorProp cssProp - HiLink cssContentForPagedMediaProp cssProp - HiLink cssDimensionProp cssProp - HiLink cssFlexibleBoxProp cssProp - HiLink cssFontProp cssProp - HiLink cssGeneratedContentProp cssProp - HiLink cssGridProp cssProp - HiLink cssHyerlinkProp cssProp - HiLink cssLineboxProp cssProp - HiLink cssListProp cssProp - HiLink cssMarqueeProp cssProp - HiLink cssMultiColumnProp cssProp - HiLink cssPagedMediaProp cssProp - HiLink cssPositioningProp cssProp - HiLink cssPrintProp cssProp - HiLink cssRubyProp cssProp - HiLink cssSpeechProp cssProp - HiLink cssTableProp cssProp - HiLink cssTextProp cssProp - HiLink cssTransformProp cssProp - HiLink cssTransitionProp cssProp - HiLink cssUIProp cssProp - HiLink cssIEUIProp cssProp - HiLink cssAuralProp cssProp - HiLink cssRenderProp cssProp - HiLink cssMobileTextProp cssProp - - HiLink cssAnimationAttr cssAttr - HiLink cssBackgroundAttr cssAttr - HiLink cssBorderAttr cssAttr - HiLink cssBoxAttr cssAttr - HiLink cssContentForPagedMediaAttr cssAttr - HiLink cssDimensionAttr cssAttr - HiLink cssFlexibleBoxAttr cssAttr - HiLink cssFontAttr cssAttr - HiLink cssGeneratedContentAttr cssAttr - HiLink cssGridAttr cssAttr - HiLink cssHyerlinkAttr cssAttr - HiLink cssLineboxAttr cssAttr - HiLink cssListAttr cssAttr - HiLink cssMarginAttr cssAttr - HiLink cssMarqueeAttr cssAttr - HiLink cssMultiColumnAttr cssAttr - HiLink cssPaddingAttr cssAttr - HiLink cssPagedMediaAttr cssAttr - HiLink cssPositioningAttr cssAttr - HiLink cssGradientAttr cssAttr - HiLink cssPrintAttr cssAttr - HiLink cssRubyAttr cssAttr - HiLink cssSpeechAttr cssAttr - HiLink cssTableAttr cssAttr - HiLink cssTextAttr cssAttr - HiLink cssTransformAttr cssAttr - HiLink cssTransitionAttr cssAttr - HiLink cssUIAttr cssAttr - HiLink cssIEUIAttr cssAttr - HiLink cssAuralAttr cssAttr - HiLink cssRenderAttr cssAttr - HiLink cssCommonAttr cssAttr - - HiLink cssPseudoClassId PreProc - HiLink cssPseudoClassLang Constant - HiLink cssValueLength Number - HiLink cssValueInteger Number - HiLink cssValueNumber Number - HiLink cssValueAngle Number - HiLink cssValueTime Number - HiLink cssValueFrequency Number - HiLink cssFunction Constant - HiLink cssURL String - HiLink cssFunctionName Function - HiLink cssFunctionComma Function - HiLink cssColor Constant - HiLink cssIdentifier Function - HiLink cssInclude Include - HiLink cssIncludeKeyword atKeyword - HiLink cssImportant Special - HiLink cssBraces Function - HiLink cssBraceError Error - HiLink cssError Error - HiLink cssUnicodeEscape Special - HiLink cssStringQQ String - HiLink cssStringQ String - HiLink cssAttributeSelector String - HiLink cssMedia atKeyword - HiLink cssMediaType Special - HiLink cssMediaComma Normal - HiLink cssMediaKeyword Statement - HiLink cssMediaProp cssProp - HiLink cssMediaAttr cssAttr - HiLink cssPage atKeyword - HiLink cssPagePseudo PreProc - HiLink cssPageMargin atKeyword - HiLink cssPageProp cssProp - HiLink cssKeyFrame atKeyword - HiLink cssKeyFrameSelector Constant - HiLink cssFontDescriptor Special - HiLink cssFontDescriptorFunction Constant - HiLink cssFontDescriptorProp cssProp - HiLink cssFontDescriptorAttr cssAttr - HiLink cssUnicodeRange Constant - HiLink cssClassName Function - HiLink cssClassNameDot Function - HiLink cssProp StorageClass - HiLink cssAttr Constant - HiLink cssUnitDecorators Number - HiLink cssNoise Noise - HiLink atKeyword Comment - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link cssComment Comment +hi def link cssVendor Comment +hi def link cssHacks Comment +hi def link cssTagName Statement +hi def link cssDeprecated Error +hi def link cssSelectorOp Special +hi def link cssSelectorOp2 Special +hi def link cssAttrComma Special + +hi def link cssAnimationProp cssProp +hi def link cssBackgroundProp cssProp +hi def link cssBorderProp cssProp +hi def link cssBoxProp cssProp +hi def link cssColorProp cssProp +hi def link cssContentForPagedMediaProp cssProp +hi def link cssDimensionProp cssProp +hi def link cssFlexibleBoxProp cssProp +hi def link cssFontProp cssProp +hi def link cssGeneratedContentProp cssProp +hi def link cssGridProp cssProp +hi def link cssHyerlinkProp cssProp +hi def link cssInteractProp cssProp +hi def link cssLineboxProp cssProp +hi def link cssListProp cssProp +hi def link cssMarqueeProp cssProp +hi def link cssMultiColumnProp cssProp +hi def link cssPagedMediaProp cssProp +hi def link cssPositioningProp cssProp +hi def link cssPrintProp cssProp +hi def link cssRubyProp cssProp +hi def link cssSpeechProp cssProp +hi def link cssTableProp cssProp +hi def link cssTextProp cssProp +hi def link cssTransformProp cssProp +hi def link cssTransitionProp cssProp +hi def link cssUIProp cssProp +hi def link cssIEUIProp cssProp +hi def link cssAuralProp cssProp +hi def link cssRenderProp cssProp +hi def link cssMobileTextProp cssProp + +hi def link cssAnimationAttr cssAttr +hi def link cssBackgroundAttr cssAttr +hi def link cssBorderAttr cssAttr +hi def link cssBoxAttr cssAttr +hi def link cssContentForPagedMediaAttr cssAttr +hi def link cssDimensionAttr cssAttr +hi def link cssFlexibleBoxAttr cssAttr +hi def link cssFontAttr cssAttr +hi def link cssGeneratedContentAttr cssAttr +hi def link cssGridAttr cssAttr +hi def link cssHyerlinkAttr cssAttr +hi def link cssInteractAttr cssAttr +hi def link cssLineboxAttr cssAttr +hi def link cssListAttr cssAttr +hi def link cssMarginAttr cssAttr +hi def link cssMarqueeAttr cssAttr +hi def link cssMultiColumnAttr cssAttr +hi def link cssPaddingAttr cssAttr +hi def link cssPagedMediaAttr cssAttr +hi def link cssPositioningAttr cssAttr +hi def link cssGradientAttr cssAttr +hi def link cssPrintAttr cssAttr +hi def link cssRubyAttr cssAttr +hi def link cssSpeechAttr cssAttr +hi def link cssTableAttr cssAttr +hi def link cssTextAttr cssAttr +hi def link cssTransformAttr cssAttr +hi def link cssTransitionAttr cssAttr +hi def link cssUIAttr cssAttr +hi def link cssIEUIAttr cssAttr +hi def link cssAuralAttr cssAttr +hi def link cssRenderAttr cssAttr +hi def link cssCommonAttr cssAttr + +hi def link cssPseudoClassId PreProc +hi def link cssPseudoClassLang Constant +hi def link cssValueLength Number +hi def link cssValueInteger Number +hi def link cssValueNumber Number +hi def link cssValueAngle Number +hi def link cssValueTime Number +hi def link cssValueFrequency Number +hi def link cssFunction Constant +hi def link cssURL String +hi def link cssFunctionName Function +hi def link cssFunctionComma Function +hi def link cssColor Constant +hi def link cssIdentifier Function +hi def link cssAtRule Include +hi def link cssAtKeyword PreProc +hi def link cssImportant Special +hi def link cssBraces Function +hi def link cssBraceError Error +hi def link cssError Error +hi def link cssUnicodeEscape Special +hi def link cssStringQQ String +hi def link cssStringQ String +hi def link cssAttributeSelector String +hi def link cssMediaType Special +hi def link cssMediaComma Normal +hi def link cssAtRuleLogical Statement +hi def link cssMediaProp cssProp +hi def link cssMediaAttr cssAttr +hi def link cssPagePseudo PreProc +hi def link cssPageMarginProp cssAtKeyword +hi def link cssPageProp cssProp +hi def link cssKeyFrameProp Constant +hi def link cssFontDescriptor Special +hi def link cssFontDescriptorProp cssProp +hi def link cssFontDescriptorAttr cssAttr +hi def link cssUnicodeRange Constant +hi def link cssClassName Function +hi def link cssClassNameDot Function +hi def link cssProp StorageClass +hi def link cssAttr Constant +hi def link cssUnitDecorators Number +hi def link cssNoise Noise let b:current_syntax = "css" diff --git a/runtime/syntax/cterm.vim b/runtime/syntax/cterm.vim index 139a0d5e17..1b6cb2893f 100644 --- a/runtime/syntax/cterm.vim +++ b/runtime/syntax/cterm.vim @@ -4,11 +4,8 @@ " Last Change: 2002 Apr 13 " Version Info: @(#)cterm.vim 1.7 97/12/15 09:23:14 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -142,48 +139,38 @@ syn match ctermCharacter "'[^\\]'" syn match ctermSpecialCharacter "'\\.'" " 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_cterm_syntax_inits") - if version < 508 - let did_cterm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ctermStatement Statement - HiLink ctermFunction Statement - HiLink ctermStrFunction Statement - HiLink ctermIntFunction Statement - HiLink ctermLabel Statement - HiLink ctermConditional Statement - HiLink ctermRepeat Statement - HiLink ctermLibFunc UserDefFunc - HiLink ctermType Type - HiLink ctermFuncArg PreCondit - - HiLink ctermPreVarRO PreCondit - HiLink ctermPreVarRW PreConditBold - HiLink ctermVar Type - - HiLink ctermComment Comment - - HiLink ctermCharacter SpecialChar - HiLink ctermSpecial Special - HiLink ctermSpecialCharacter SpecialChar - HiLink ctermSymbols Special - HiLink ctermString String - HiLink ctermTodo Todo - HiLink ctermOperator Statement - HiLink ctermNumber Number - - " redefine the colors - "hi PreConditBold term=bold ctermfg=1 cterm=bold guifg=Purple gui=bold - "hi Special term=bold ctermfg=6 guifg=SlateBlue gui=underline - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link ctermStatement Statement +hi def link ctermFunction Statement +hi def link ctermStrFunction Statement +hi def link ctermIntFunction Statement +hi def link ctermLabel Statement +hi def link ctermConditional Statement +hi def link ctermRepeat Statement +hi def link ctermLibFunc UserDefFunc +hi def link ctermType Type +hi def link ctermFuncArg PreCondit + +hi def link ctermPreVarRO PreCondit +hi def link ctermPreVarRW PreConditBold +hi def link ctermVar Type + +hi def link ctermComment Comment + +hi def link ctermCharacter SpecialChar +hi def link ctermSpecial Special +hi def link ctermSpecialCharacter SpecialChar +hi def link ctermSymbols Special +hi def link ctermString String +hi def link ctermTodo Todo +hi def link ctermOperator Statement +hi def link ctermNumber Number + +" redefine the colors +"hi PreConditBold term=bold ctermfg=1 cterm=bold guifg=Purple gui=bold +"hi Special term=bold ctermfg=6 guifg=SlateBlue gui=underline + let b:current_syntax = "cterm" diff --git a/runtime/syntax/cuda.vim b/runtime/syntax/cuda.vim index 77930e3fd4..13d70e343a 100644 --- a/runtime/syntax/cuda.vim +++ b/runtime/syntax/cuda.vim @@ -1,22 +1,15 @@ " Vim syntax file " Language: CUDA (NVIDIA Compute Unified Device Architecture) " Maintainer: Timothy B. Terriberry <tterribe@users.sourceforge.net> -" Last Change: 2007 Oct 13 +" Last Change: 2018 Feb 06 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -" Read the C syntax to start with -if version < 600 - source <sfile>:p:h/c.vim -else - runtime! syntax/c.vim -endif +" Read the C++ syntax to start with +runtime! syntax/cpp.vim " CUDA extentions syn keyword cudaStorageClass __device__ __global__ __host__ diff --git a/runtime/syntax/cupl.vim b/runtime/syntax/cupl.vim index 545d873af2..5b93b0db93 100644 --- a/runtime/syntax/cupl.vim +++ b/runtime/syntax/cupl.vim @@ -3,11 +3,8 @@ " Maintainer: John Cook <johncook3@gmail.com> " Last Change: 2011 Dec 27 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -95,39 +92,29 @@ syn region cuplComment start=+/\*+ end=+\*/+ contains=cuplNumber,cuplTodo syn sync minlines=1 " 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_cupl_syn_inits") - if version < 508 - let did_cupl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink cuplHeader cuplStatement - HiLink cuplLogicalOperator cuplOperator - HiLink cuplRangeOperator cuplOperator - HiLink cuplArithmeticOperator cuplOperator - HiLink cuplAssignmentOperator cuplOperator - HiLink cuplEqualityOperator cuplOperator - HiLink cuplTruthTableOperator cuplOperator - HiLink cuplOperator cuplStatement - HiLink cuplFunction cuplStatement - HiLink cuplStatement Statement - HiLink cuplNumberRange cuplNumber - HiLink cuplNumber cuplString - HiLink cuplString String - HiLink cuplComment Comment - HiLink cuplExtension cuplSpecial - HiLink cuplSpecialChar cuplSpecial - HiLink cuplSpecial Special - HiLink cuplDirective PreProc - HiLink cuplTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link cuplHeader cuplStatement +hi def link cuplLogicalOperator cuplOperator +hi def link cuplRangeOperator cuplOperator +hi def link cuplArithmeticOperator cuplOperator +hi def link cuplAssignmentOperator cuplOperator +hi def link cuplEqualityOperator cuplOperator +hi def link cuplTruthTableOperator cuplOperator +hi def link cuplOperator cuplStatement +hi def link cuplFunction cuplStatement +hi def link cuplStatement Statement +hi def link cuplNumberRange cuplNumber +hi def link cuplNumber cuplString +hi def link cuplString String +hi def link cuplComment Comment +hi def link cuplExtension cuplSpecial +hi def link cuplSpecialChar cuplSpecial +hi def link cuplSpecial Special +hi def link cuplDirective PreProc +hi def link cuplTodo Todo + let b:current_syntax = "cupl" diff --git a/runtime/syntax/cuplsim.vim b/runtime/syntax/cuplsim.vim index 18a30ce256..36eb4c3555 100644 --- a/runtime/syntax/cuplsim.vim +++ b/runtime/syntax/cuplsim.vim @@ -3,21 +3,14 @@ " Maintainer: John Cook <john.cook@kla-tencor.com> " Last Change: 2001 Apr 25 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the CUPL syntax to start with -if version < 600 - source <sfile>:p:h/cupl.vim -else - runtime! syntax/cupl.vim - unlet b:current_syntax -endif +runtime! syntax/cupl.vim +unlet b:current_syntax " omit definition-specific stuff syn clear cuplStatement @@ -53,28 +46,18 @@ syn match cuplsimOutput +"\x\+"+ syn sync minlines=1 " 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_cuplsim_syn_inits") - if version < 508 - let did_cuplsim_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " append to the highlighting links in cupl.vim - " The default highlighting. - HiLink cuplsimOrder cuplStatement - HiLink cuplsimBase cuplStatement - HiLink cuplsimBaseType cuplStatement - HiLink cuplsimVectors cuplStatement - HiLink cuplsimStimulus cuplNumber - HiLink cuplsimOutput cuplNumber - HiLink cuplsimOrderFormat cuplNumber +" Only when an item doesn't have highlighting yet + +" append to the highlighting links in cupl.vim +" The default highlighting. +hi def link cuplsimOrder cuplStatement +hi def link cuplsimBase cuplStatement +hi def link cuplsimBaseType cuplStatement +hi def link cuplsimVectors cuplStatement +hi def link cuplsimStimulus cuplNumber +hi def link cuplsimOutput cuplNumber +hi def link cuplsimOrderFormat cuplNumber - delcommand HiLink -endif let b:current_syntax = "cuplsim" " vim:ts=8 diff --git a/runtime/syntax/cvs.vim b/runtime/syntax/cvs.vim index 94b2a809eb..3eac191637 100644 --- a/runtime/syntax/cvs.vim +++ b/runtime/syntax/cvs.vim @@ -4,11 +4,8 @@ " URL: http://www.zotikos.com/downloads/cvs.vim " Last Change: Sat Nov 24 23:25:11 CET 2001 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,24 +17,14 @@ syn region cvsCom start="Committing in" end="$" contains=cvsDir contained extend syn match cvsDir contained "\S\+$" " 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_cvs_syn_inits") - if version < 508 - let did_cvs_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink cvsLine Comment - HiLink cvsDir cvsFile - HiLink cvsFile Constant - HiLink cvsFiles cvsCom - HiLink cvsTag cvsCom - HiLink cvsCom Statement +hi def link cvsLine Comment +hi def link cvsDir cvsFile +hi def link cvsFile Constant +hi def link cvsFiles cvsCom +hi def link cvsTag cvsCom +hi def link cvsCom Statement - delcommand HiLink -endif let b:current_syntax = "cvs" diff --git a/runtime/syntax/cvsrc.vim b/runtime/syntax/cvsrc.vim index 6c2c4eea04..9522de6436 100644 --- a/runtime/syntax/cvsrc.vim +++ b/runtime/syntax/cvsrc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cvs(1) RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: cvs(1) RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cweb.vim b/runtime/syntax/cweb.vim index 39b593d2be..4e06b3646d 100644 --- a/runtime/syntax/cweb.vim +++ b/runtime/syntax/cweb.vim @@ -13,11 +13,8 @@ " TODO: names, and leaves C/C++ comments as such. (On the other hand, " TODO: switching to TeX mode in C/C++ comments might be colour overkill.) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -25,12 +22,8 @@ endif " level in the CWEB syntax, e.g., in the preamble. In general, a CWEB source " code can be seen as a normal TeX document with some C/C++ material " interspersed in certain defined regions. -if version < 600 - source <sfile>:p:h/tex.vim -else - runtime! syntax/tex.vim - unlet b:current_syntax -endif +runtime! syntax/tex.vim +unlet b:current_syntax " Read the C/C++ syntax too; C/C++ syntax items are treated as such in the " C/C++ section of a CWEB chunk or in inner C/C++ context in "|...|" groups. @@ -63,20 +56,10 @@ syntax region webRestrictedTeX start="@[\^\.:t=q]" end="@>" oneline syntax match webIgnoredStuff "@@" " 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_cweb_syntax_inits") - if version < 508 - let did_cweb_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink webRestrictedTeX String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link webRestrictedTeX String + let b:current_syntax = "cweb" diff --git a/runtime/syntax/cynlib.vim b/runtime/syntax/cynlib.vim index a9985074d6..24ad2a2e31 100644 --- a/runtime/syntax/cynlib.vim +++ b/runtime/syntax/cynlib.vim @@ -15,22 +15,15 @@ " Remove any old syntax stuff hanging around -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C++ syntax to start with - this includes the C syntax -if version < 600 - source <sfile>:p:h/cpp.vim -else - runtime! syntax/cpp.vim -endif +runtime! syntax/cpp.vim unlet b:current_syntax " Cynlib extensions @@ -69,23 +62,13 @@ syn match cynlibOperator "<<=" syn keyword cynlibType In Out InST OutST Int Uint Const Cynclock " 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_cynlib_syntax_inits") - if version < 508 - let did_cynlib_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink cynlibOperator Operator - HiLink cynlibMacro Statement - HiLink cynlibFunction Statement - HiLink cynlibppMacro Statement - HiLink cynlibType Type +hi def link cynlibOperator Operator +hi def link cynlibMacro Statement +hi def link cynlibFunction Statement +hi def link cynlibppMacro Statement +hi def link cynlibType Type - delcommand HiLink -endif let b:current_syntax = "cynlib" diff --git a/runtime/syntax/cynpp.vim b/runtime/syntax/cynpp.vim index b984bace35..3064b11a63 100644 --- a/runtime/syntax/cynpp.vim +++ b/runtime/syntax/cynpp.vim @@ -19,21 +19,13 @@ -" Remove any old syntax stuff hanging around -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the Cynlib syntax to start with - this includes the C++ syntax -if version < 600 - source <sfile>:p:h/cynlib.vim -else - runtime! syntax/cynlib.vim -endif +runtime! syntax/cynlib.vim unlet b:current_syntax @@ -49,20 +41,10 @@ syn keyword cynppMacro Thread EndThread syn keyword cynppMacro Instantiate " 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_cynpp_syntax_inits") - if version < 508 - let did_cynpp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink cLabel Label - HiLink cynppMacro Statement +hi def link cLabel Label +hi def link cynppMacro Statement - delcommand HiLink -endif let b:current_syntax = "cynpp" diff --git a/runtime/syntax/d.vim b/runtime/syntax/d.vim index 52c83bf913..fdac98c437 100644 --- a/runtime/syntax/d.vim +++ b/runtime/syntax/d.vim @@ -1,9 +1,9 @@ -" Vim syntax file for the D programming language (version 1.076 and 2.063). +" Vim syntax file for the D programming language (version 1.076 and 2.069). " " Language: D " Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com> -" Last Change: 2013 October 5 -" Version: 0.26 +" Last Change: 2016 Feb 2 +" Version: 0.28 " " Contributors: " - Jason Mills: original Maintainer @@ -15,6 +15,7 @@ " - Steven N. Oliver " - Sohgo Takeuchi " - Robert Clipsham +" - Petar Kirov " " Please submit bugs/comments/suggestions to the github repo: " https://github.com/JesseKPhillips/d.vim @@ -114,17 +115,19 @@ syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction +syn keyword dTraitsIdentifier contained isOverrideFunction isTemplate syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember -syn keyword dTraitsIdentifier contained identifier getAttributes getMember -syn keyword dTraitsIdentifier contained getOverloads getProtection -syn keyword dTraitsIdentifier contained getVirtualFunctions -syn keyword dTraitsIdentifier contained getVirtualMethods parent -syn keyword dTraitsIdentifier contained classInstanceSize allMembers +syn keyword dTraitsIdentifier contained identifier getAliasThis +syn keyword dTraitsIdentifier contained getAttributes getFunctionAttributes getMember +syn keyword dTraitsIdentifier contained getOverloads getPointerBitmap getProtection +syn keyword dTraitsIdentifier contained getVirtualFunctions getVirtualIndex +syn keyword dTraitsIdentifier contained getVirtualMethods getUnitTests +syn keyword dTraitsIdentifier contained parent classInstanceSize allMembers syn keyword dTraitsIdentifier contained derivedMembers isSame compiles -syn keyword dPragmaIdentifier contained lib msg startaddress GNU_asm -syn keyword dExternIdentifier contained Windows Pascal Java System D +syn keyword dPragmaIdentifier contained inline lib mangle msg startaddress GNU_asm +syn keyword dExternIdentifier contained C C++ D Windows Pascal System Objective-C syn keyword dAttribute contained safe trusted system -syn keyword dAttribute contained property disable +syn keyword dAttribute contained property disable nogc syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64 @@ -134,7 +137,7 @@ syn keyword dVersionIdentifier contained Cygwin MinGW syn keyword dVersionIdentifier contained LittleEndian BigEndian syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64 syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC -syn keyword dVersionIdentifier contained unittest none all +syn keyword dVersionIdentifier contained unittest assert none all syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment @@ -168,10 +171,10 @@ syn match dExternal "\<extern\>" syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier " Make import a region to prevent highlighting keywords -syn region dImport start="import\_s" end=";" contains=dExternal,@dComment +syn region dImport start="\<import\_s" end=";" contains=dExternal,@dComment " Make module a region to prevent highlighting keywords -syn region dImport start="module\_s" end=";" contains=dExternal,@dComment +syn region dImport start="\<module\_s" end=";" contains=dExternal,@dComment " dTokens is used by the token string highlighting syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean @@ -246,13 +249,17 @@ syn match dUnicode "\\u\d\{4\}" " String. " -syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell +syn match dFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained +syn match dFormat display "%%" contained + +syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dFormat,dEscSequence,@Spell syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell + " Nesting delimited string contents " syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell @@ -276,8 +283,8 @@ syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString " Token strings " -syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens -syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens +syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens,dFormat +syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens,dFormat syn cluster dTokens add=dTokenString @@ -357,6 +364,7 @@ hi def link dString String hi def link dHexString String hi def link dCharacter Character hi def link dEscSequence SpecialChar +hi def link dFormat SpecialChar hi def link dSpecialCharError Error hi def link dOctalError Error hi def link dOperator Operator diff --git a/runtime/syntax/datascript.vim b/runtime/syntax/datascript.vim index 2b4ec513b4..7b686a144e 100644 --- a/runtime/syntax/datascript.vim +++ b/runtime/syntax/datascript.vim @@ -1,15 +1,15 @@ " Vim syntax file -" Language: Datascript +" Language: DataScript " Maintainer: Dominique Pelle <dominique.pelle@gmail.com> -" Last Change: 2014 Feb 26 +" Last Change: 2015 Jul 30 " " DataScript is a formal language for modelling binary datatypes, " bitstreams or file formats. For more information, see: -" http://datascript.berlios.de/DataScriptLanguageOverview.html +" +" http://dstools.sourceforge.net/DataScriptLanguageOverview.html -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo @@ -19,6 +19,8 @@ syn keyword dsPackage import package syn keyword dsType bit bool string syn keyword dsType int int8 int16 int32 int64 syn keyword dsType uint8 uint16 uint32 uint64 +syn keyword dsType varint16 varint32 varint64 +syn keyword dsType varuint16 varuint32 varuint64 syn keyword dsType leint16 leint32 leint64 syn keyword dsType leuint16 leuint32 leuint64 syn keyword dsEndian little big @@ -32,7 +34,8 @@ syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in syn keyword dsStorageClass const syn keyword dsTodo contained TODO FIXME XXX syn keyword dsSql sql sql_table sql_database sql_pragma sql_index -syn keyword dsSql sql_integer sql_metadata sql_key foreign_key +syn keyword dsSql sql_integer sql_metadata sql_key sql_virtual +syn keyword dsSql using reference_key foreign_key to " dsCommentGroup allows adding matches for special things in comments. syn cluster dsCommentGroup contains=dsTodo @@ -61,6 +64,8 @@ syn region dsComment syn region dsString \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell +syn sync ccomment dsComment + " Define the default highlighting. hi def link dsType Type hi def link dsEndian StorageClass diff --git a/runtime/syntax/dcd.vim b/runtime/syntax/dcd.vim index a566745fbe..058d272375 100644 --- a/runtime/syntax/dcd.vim +++ b/runtime/syntax/dcd.vim @@ -3,11 +3,8 @@ " Maintainer: Christopher Shinn <christopher@lucent.com> " Last Change: 2003 Apr 25 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -40,25 +37,15 @@ syn keyword dcdSpecial PRV1 PRV2 PRV3 PRV4 PRV5 PRV6 PRV7 PRV8 syn region dcdComment start="\*" end="\;" " 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_dcd_syntax_inits") - if version < 508 - let did_dcd_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink dcdFunction Identifier - HiLink dcdLabel Constant - HiLink dcdConditional Conditional - HiLink dcdDisplay Type - HiLink dcdStatement Statement - HiLink dcdSpecial Special - HiLink dcdComment Comment +hi def link dcdFunction Identifier +hi def link dcdLabel Constant +hi def link dcdConditional Conditional +hi def link dcdDisplay Type +hi def link dcdStatement Statement +hi def link dcdSpecial Special +hi def link dcdComment Comment - delcommand HiLink -endif let b:current_syntax = "dcd" diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim index b051b08cf1..2258ff6a3e 100644 --- a/runtime/syntax/dcl.vim +++ b/runtime/syntax/dcl.vim @@ -1,22 +1,19 @@ " Vim syntax file " Language: DCL (Digital Command Language - vms) -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 11, 2006 -" Version: 6 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 11 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version < 600 - set iskeyword=$,@,48-57,_ -else +if !has("patch-7.4.1142") setlocal iskeyword=$,@,48-57,_ +else + syn iskeyword $,@,48-57,_ endif syn case ignore @@ -114,49 +111,40 @@ syn region dclFuncList matchgroup=Delimiter start="(" matchgroup=Delimiter end= syn match dclError ")" " 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_dcl_syntax_inits") - if version < 508 - let did_dcl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dclLogOper dclError - HiLink dclLogical dclOper - HiLink dclLogSep dclSep - - HiLink dclAssign Operator - HiLink dclCmdProc Special - HiLink dclCmdProcStart Operator - HiLink dclComment Comment - HiLink dclContinue Statement - HiLink dclDevice Identifier - HiLink dclDirPath Identifier - HiLink dclDirPath Identifier - HiLink dclDirSep Delimiter - HiLink dclError Error - HiLink dclExe Statement - HiLink dclFilename NONE - HiLink dclGotoLabel Label - HiLink dclInstr Statement - HiLink dclLexical Function - HiLink dclMdfy Type - HiLink dclMdfyBrkt Delimiter - HiLink dclMdfySep Delimiter - HiLink dclMdfySet Type - HiLink dclMdfySetString String - HiLink dclNumber Number - HiLink dclOper Operator - HiLink dclParam Special - HiLink dclSep Delimiter - HiLink dclStart Delimiter - HiLink dclString String - HiLink dclTodo Todo - - delcommand HiLink +if !exists("skip_dcl_syntax_inits") + + hi def link dclLogOper dclError + hi def link dclLogical dclOper + hi def link dclLogSep dclSep + + hi def link dclAssign Operator + hi def link dclCmdProc Special + hi def link dclCmdProcStart Operator + hi def link dclComment Comment + hi def link dclContinue Statement + hi def link dclDevice Identifier + hi def link dclDirPath Identifier + hi def link dclDirPath Identifier + hi def link dclDirSep Delimiter + hi def link dclError Error + hi def link dclExe Statement + hi def link dclFilename NONE + hi def link dclGotoLabel Label + hi def link dclInstr Statement + hi def link dclLexical Function + hi def link dclMdfy Type + hi def link dclMdfyBrkt Delimiter + hi def link dclMdfySep Delimiter + hi def link dclMdfySet Type + hi def link dclMdfySetString String + hi def link dclNumber Number + hi def link dclOper Operator + hi def link dclParam Special + hi def link dclSep Delimiter + hi def link dclStart Delimiter + hi def link dclString String + hi def link dclTodo Todo + endif let b:current_syntax = "dcl" diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 6206fa388c..fa89046f92 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -1,25 +1,27 @@ " Vim syntax file " Language: Debian changelog files -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2014 Jul 11 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debchangelog.vim +" Last Change: 2018 May 03 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists('b:current_syntax') finish endif " Case doesn't matter for us syn case ignore +let urgency='urgency=\(low\|medium\|high\|critical\)\( [^[:space:],][^,]*\)\=' +let binNMU='binary-only=yes' + " Define some common expressions we can use later on syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " -syn match debchangelogUrgency contained "; urgency=\(low\|medium\|high\|critical\|emergency\)\( \S.*\)\=" -syn match debchangelogTarget contained "\v %(frozen|unstable|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile)|wheezy-backports|%(devel|lucid|precise|trusty|utopic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' +exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic)%(-%(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\+\)*" @@ -27,33 +29,23 @@ syn match debchangelogEmail contained "[_=[:alnum:].+-]\+@[[:alnum:]./\-]\+" syn match debchangelogEmail contained "<.\{-}>" " Define the entries that make up the changelog -syn region debchangelogHeader start="^[^ ]" end="$" contains=debchangelogName,debchangelogUrgency,debchangelogTarget,debchangelogVersion oneline +syn region debchangelogHeader start="^[^ ]" end="$" contains=debchangelogName,debchangelogFirstKV,debchangelogOtherKV,debchangelogTarget,debchangelogVersion,debchangelogBinNMU oneline syn region debchangelogFooter start="^ [^ ]" end="$" contains=debchangelogEmail oneline syn region debchangelogEntry start="^ " end="$" contains=debchangelogCloses,debchangelogLP oneline " Associate our matches and regions with pretty colours -if version >= 508 || !exists("did_debchangelog_syn_inits") - if version < 508 - let did_debchangelog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink debchangelogHeader Error - HiLink debchangelogFooter Identifier - HiLink debchangelogEntry Normal - HiLink debchangelogCloses Statement - HiLink debchangelogLP Statement - HiLink debchangelogUrgency Identifier - HiLink debchangelogName Comment - HiLink debchangelogVersion Identifier - HiLink debchangelogTarget Identifier - HiLink debchangelogEmail Special - - delcommand HiLink -endif - -let b:current_syntax = "debchangelog" +hi def link debchangelogHeader Error +hi def link debchangelogFooter Identifier +hi def link debchangelogEntry Normal +hi def link debchangelogCloses Statement +hi def link debchangelogLP Statement +hi def link debchangelogFirstKV Identifier +hi def link debchangelogOtherKV Identifier +hi def link debchangelogName Comment +hi def link debchangelogVersion Identifier +hi def link debchangelogTarget Identifier +hi def link debchangelogEmail Special + +let b:current_syntax = 'debchangelog' " vim: ts=8 sw=2 diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim index 5d9d45d025..3504780445 100644 --- a/runtime/syntax/debcontrol.vim +++ b/runtime/syntax/debcontrol.vim @@ -1,15 +1,13 @@ " Vim syntax file " Language: Debian control files -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2014 May 01 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debcontrol.vim +" Last Change: 2018 Jan 28 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debcontrol.vim " Standard syntax initialization -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists('b:current_syntax') finish endif @@ -19,38 +17,66 @@ set cpo&vim " Should match case except for the keys of each field syn case match +syn iskeyword @,48-57,-,/ + " Everything that is not explicitly matched by the rules below syn match debcontrolElse "^.*$" " Common seperators -syn match debControlComma ", *" -syn match debControlSpace " " - -let s:kernels = '\%(linux\|hurd\|kfreebsd\|knetbsd\|kopensolaris\|netbsd\)' -let s:archs = '\%(alpha\|amd64\|armeb\|armel\|armhf\|arm64\|avr32\|hppa\|i386' - \ . '\|ia64\|lpia\|m32r\|m68k\|mipsel\|mips\|powerpcspe\|powerpc\|ppc64el' - \ . '\|ppc64\|s390x\|s390\|sh3eb\|sh3\|sh4eb\|sh4\|sh\|sparc64\|sparc\|x32\)' -let s:pairs = 'hurd-i386\|kfreebsd-i386\|kfreebsd-amd64\|knetbsd-i386\|kopensolaris-i386\|netbsd-alpha\|netbsd-i386' +syn match debControlComma ",[ \t]*" +syn match debControlSpace "[ \t]" + +let s:kernels = ['linux', 'hurd', 'kfreebsd', 'knetbsd', 'kopensolaris', 'netbsd'] +let s:archs = [ + \ 'alpha', 'amd64', 'armeb', 'armel', 'armhf', 'arm64', 'avr32', 'hppa' + \, 'i386', 'ia64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips' + \, 'powerpcspe', 'powerpc', 'ppc64el', 'ppc64', 's390x', 's390', 'sh3eb' + \, 'sh3', 'sh4eb', 'sh4', 'sh', 'sparc64', 'sparc', 'x32' + \ ] +let s:pairs = [ + \ 'hurd-i386', 'kfreebsd-i386', 'kfreebsd-amd64', 'knetbsd-i386' + \, 'kopensolaris-i386', 'netbsd-alpha', 'netbsd-i386' + \ ] " Define some common expressions we can use later on -exe 'syn match debcontrolArchitecture contained "\%(all\|'. s:kernels .'-any\|\%(any-\)\='. s:archs .'\|'. s:pairs .'\|any\)"' +syn keyword debcontrolArchitecture contained all any +exe 'syn keyword debcontrolArchitecture contained '. join(map(s:kernels, {k,v -> v .'-any'})) +exe 'syn keyword debcontrolArchitecture contained '. join(map(s:archs, {k,v -> 'any-'.v})) +exe 'syn keyword debcontrolArchitecture contained '. join(s:archs) +exe 'syn keyword debcontrolArchitecture contained '. join(s:pairs) unlet s:kernels s:archs s:pairs -syn match debcontrolMultiArch contained "\%(no\|foreign\|allowed\|same\)" +let s:sections = [ + \ 'admin', 'cli-mono', 'comm', 'database', 'debian-installer', 'debug' + \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded' + \, 'fonts', 'games', 'gnome', 'gnustep', 'gnu-r', 'golang', 'graphics' + \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection' + \, 'java\%(script\)\=', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' + \, 'localization', 'mail', 'math', 'metapackages', 'misc', 'net' + \, 'news', 'ocaml', 'oldlibs', 'otherosfs', 'perl', 'php', 'python' + \, 'ruby', 'rust', 'science', 'shells', 'sound', 'text', 'tex' + \, 'utils', 'vcs', 'video', 'web', 'x11', 'xfce', 'zope' + \ ] + +syn keyword debcontrolMultiArch contained no foreign allowed same syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+" -syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)" -syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|introspection|java|kde|kernel|libs|libdevel|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)" -syn match debcontrolPackageType contained "u\?deb" +syn keyword debcontrolPriority contained extra important optional required standard +exe 'syn match debcontrolSection contained "\%(\%(contrib\|non-free\|non-US/main\|non-US/contrib\|non-US/non-free\|restricted\|universe\|multiverse\)/\)\=\%('.join(s:sections, '\|').'\)"' +syn keyword debcontrolPackageType contained udeb deb syn match debcontrolVariable contained "\${.\{-}}" -syn match debcontrolDmUpload contained "\cyes" +syn keyword debcontrolDmUpload contained yes +syn keyword debcontrolYesNo contained yes no +syn match debcontrolR3 contained "\<\%(no\|binary-targets\|[[:graph:]]\+/[[:graph:]]\+\%( \+[[:graph:]]\+/[[:graph:]]\+\)*\)\>" + +unlet s:sections " A URL (using the domain name definitions from RFC 1034 and 1738), right now " only enforce protocol and some sanity on the server/path part; syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$" -syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$" +syn match debcontrolVcsGit contained "\v%(git|https?)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$" " An email address syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" @@ -61,64 +87,55 @@ syn match debcontrolComment "^#.*$" contains=@Spell syn case ignore -" List of all legal keys -syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Multi-Arch\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|\%(XC-\)\=Package-Type\): *" - -syn match debcontrolDeprecatedKey contained "^\%(\%(XS-\)\=DM-Upload-Allowed\): *" +" Handle all fields from deb-src-control(5) " Fields for which we do strict syntax checking -syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline -syn region debcontrolStrictField start="^Multi-Arch" end="$" contains=debcontrolKey,debcontrolMultiArch oneline -syn region debcontrolStrictField start="^\(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline -syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline -syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline -syn region debcontrolStrictField start="^\%(XC-\)\=Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline -syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolDeprecatedKey,debcontrolDmUpload oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Architecture: *" end="$" contains=debcontrolArchitecture,debcontrolSpace oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Multi-Arch: *" end="$" contains=debcontrolMultiArch oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Package\|Source\): *" end="$" contains=debcontrolName oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Priority: *" end="$" contains=debcontrolPriority oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Section: *" end="$" contains=debcontrolSection oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XC-\)\=Package-Type: *" end="$" contains=debcontrolPackageType oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Homepage: *" end="$" contains=debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\): *" end="$" contains=debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Svn: *" end="$" contains=debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Cvs: *" end="$" contains=debcontrolVcsCvs oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Git: *" end="$" contains=debcontrolVcsGit oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Rules-Requires-Root: *" end="$" contains=debcontrolR3 oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Build-\)\=Essential: *" end="$" contains=debcontrolYesNo oneline + +syn region debcontrolStrictField matchgroup=debcontrolDeprecatedKey start="^\%(XS-\)\=DM-Upload-Allowed: *" end="$" contains=debcontrolDmUpload oneline " Catch-all for the other legal fields -syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline -syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment -syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell +syn region debcontrolField matchgroup=debcontrolKey start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\|\%(XS-\)\=Testsuite\%(-Triggers\)\=\|Build-Profiles\|Tag\|Subarchitecture\|Kernel-Version\|Installer-Menu-Item\): " end="$" contains=debcontrolVariable,debcontrolEmail oneline +syn region debcontrolMultiField matchgroup=debcontrolKey start="^\%(Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Breaks\|Enhances\|Replaces\|Conflicts\|Provides\|Built-Using\|Uploaders\|X[SBC]\{0,3\}\%(Private-\)\=-[-a-zA-Z0-9]\+\): *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment +syn region debcontrolMultiFieldSpell matchgroup=debcontrolKey start="^Description: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell " Associate our matches and regions with pretty colours -if version >= 508 || !exists("did_debcontrol_syn_inits") - if version < 508 - let did_debcontrol_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink debcontrolKey Keyword - HiLink debcontrolField Normal - HiLink debcontrolStrictField Error - HiLink debcontrolDeprecatedKey Error - HiLink debcontrolMultiField Normal - HiLink debcontrolArchitecture Normal - HiLink debcontrolMultiArch Normal - HiLink debcontrolName Normal - HiLink debcontrolPriority Normal - HiLink debcontrolSection Normal - HiLink debcontrolPackageType Normal - HiLink debcontrolVariable Identifier - HiLink debcontrolEmail Identifier - HiLink debcontrolVcsSvn Identifier - HiLink debcontrolVcsCvs Identifier - HiLink debcontrolVcsGit Identifier - HiLink debcontrolHTTPUrl Identifier - HiLink debcontrolDmUpload Identifier - HiLink debcontrolComment Comment - HiLink debcontrolElse Special - - delcommand HiLink -endif - -let b:current_syntax = "debcontrol" +hi def link debcontrolKey Keyword +hi def link debcontrolField Normal +hi def link debcontrolStrictField Error +hi def link debcontrolDeprecatedKey Error +hi def link debcontrolMultiField Normal +hi def link debcontrolArchitecture Normal +hi def link debcontrolMultiArch Normal +hi def link debcontrolName Normal +hi def link debcontrolPriority Normal +hi def link debcontrolSection Normal +hi def link debcontrolPackageType Normal +hi def link debcontrolVariable Identifier +hi def link debcontrolEmail Identifier +hi def link debcontrolVcsSvn Identifier +hi def link debcontrolVcsCvs Identifier +hi def link debcontrolVcsGit Identifier +hi def link debcontrolHTTPUrl Identifier +hi def link debcontrolDmUpload Identifier +hi def link debcontrolYesNo Identifier +hi def link debcontrolR3 Identifier +hi def link debcontrolComment Comment +hi def link debcontrolElse Special + +let b:current_syntax = 'debcontrol' let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/syntax/debcopyright.vim b/runtime/syntax/debcopyright.vim new file mode 100644 index 0000000000..c85ca372d0 --- /dev/null +++ b/runtime/syntax/debcopyright.vim @@ -0,0 +1,33 @@ +" Vim syntax file +" Language: Debian copyright file +" Maintainer: Debian Vim Maintainers +" Last Change: 2018 Feb 05 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debcopyright.vim + +" Standard syntax initialization +if exists('b:current_syntax') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn case match + +syn match debcopyrightUrl "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$" +syn match debcopyrightKey "^\%(Format\|Upstream-Name\|Upstream-Contact\|Disclaimer\|Source\|Comment\|Files\|Copyright\|License\): *" +syn match debcopyrightEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+" +syn match debcopyrightEmail "<.\{-}>" +syn match debcopyrightComment "^#.*$" contains=@Spell + +hi def link debcopyrightUrl Identifier +hi def link debcopyrightKey Keyword +hi def link debcopyrightEmail Identifier +hi def link debcopyrightComment Comment + +let b:current_syntax = 'debcopyright' + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ts=8 sw=2 diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index e877b06ae4..c7960c161b 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -1,14 +1,12 @@ " Vim syntax file " Language: Debian sources.list -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl> -" Last Change: 2014 Jul 11 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debsources.vim +" Last Change: 2018 May 03 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists('b:current_syntax') finish endif @@ -21,15 +19,36 @@ syn match debsourcesKeyword /\(deb-src\|deb\|main\|contrib\|non-free\|res " Match comments syn match debsourcesComment /#.*/ contains=@Spell +let s:cpo = &cpo +set cpo-=C +let s:supported = [ + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', + \ 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', + \ + \ 'trusty', 'xenial', 'artful', 'bionic', 'cosmic', 'devel' + \ ] +let s:unsupported = [ + \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', + \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', + \ + \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', + \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', + \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', + \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty' + \ ] +let &cpo=s:cpo + " Match uri's -syn match debsourcesUri +\(http://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++ -syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\(squeeze\|wheezy\|jessie\|\(old\)\=stable\|testing\|unstable\|sid\|rc-buggy\|experimental\|devel\|lucid\|precise\|trusty\|utopic\)\([-[:alnum:]_./]*\)+ +syn match debsourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+' +exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+' +exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+' " Associate our matches and regions with pretty colours -hi def link debsourcesLine Error -hi def link debsourcesKeyword Statement -hi def link debsourcesDistrKeyword Type -hi def link debsourcesComment Comment -hi def link debsourcesUri Constant +hi def link debsourcesLine Error +hi def link debsourcesKeyword Statement +hi def link debsourcesDistrKeyword Type +hi def link debsourcesUnsupportedDistrKeyword WarningMsg +hi def link debsourcesComment Comment +hi def link debsourcesUri Constant -let b:current_syntax = "debsources" +let b:current_syntax = 'debsources' diff --git a/runtime/syntax/def.vim b/runtime/syntax/def.vim index 5efb41bc43..a17714c41e 100644 --- a/runtime/syntax/def.vim +++ b/runtime/syntax/def.vim @@ -5,11 +5,8 @@ " Last Change: $Date: 2007/10/02 13:51:24 $ " $Revision: 1.2 $ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -32,25 +29,15 @@ syn match defNumber "0x\x\+" " 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_def_syntax_inits") - if version < 508 - let did_def_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink defComment Comment - HiLink defKeyword Keyword - HiLink defStorage StorageClass - HiLink defString String - HiLink defNumber Number - HiLink defOrdinal Operator - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link defComment Comment +hi def link defKeyword Keyword +hi def link defStorage StorageClass +hi def link defString String +hi def link defNumber Number +hi def link defOrdinal Operator + let b:current_syntax = "def" diff --git a/runtime/syntax/denyhosts.vim b/runtime/syntax/denyhosts.vim index 0ec09ba13e..f32faab168 100644 --- a/runtime/syntax/denyhosts.vim +++ b/runtime/syntax/denyhosts.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: denyhosts configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-25 +" Language: denyhosts configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/desc.vim b/runtime/syntax/desc.vim index ca47176ff7..84b9cd0f34 100644 --- a/runtime/syntax/desc.vim +++ b/runtime/syntax/desc.vim @@ -3,11 +3,8 @@ " Maintainer: René Rebe <rene@exactcode.de>, Piotr Esden-Tempski <esden@rocklinux.org> " Last Change: 2006 Aug 14 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -63,40 +60,29 @@ syn region descTagRegion start=/^\[\(F\|FLAG\)\]/ end=/$/ contains=descTag,descF syn region descTagRegion start=/^\[\(L\|LICENSE\)\]/ end=/$/ contains=descTag,descLicense -" For version 5.7 and earlier: only when not done already -" Define the default highlighting. -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_desc_syntax_inits") - if version < 508 - let did_desc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink descFlag Identifier - HiLink descLicense Identifier - HiLink descCategory Identifier - - HiLink descTag Type - HiLink descUrl Underlined - HiLink descEmail Underlined - - " priority tag colors - HiLink descInstallX Boolean - HiLink descInstallO Type - HiLink descDash Operator - HiLink descDigit Number - HiLink descCompilePriority Number - - " download tag colors - HiLink descSum Number - HiLink descTarball Underlined - - " tag region colors - HiLink descText Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link descFlag Identifier +hi def link descLicense Identifier +hi def link descCategory Identifier + +hi def link descTag Type +hi def link descUrl Underlined +hi def link descEmail Underlined + +" priority tag colors +hi def link descInstallX Boolean +hi def link descInstallO Type +hi def link descDash Operator +hi def link descDigit Number +hi def link descCompilePriority Number + +" download tag colors +hi def link descSum Number +hi def link descTarball Underlined + +" tag region colors +hi def link descText Comment + let b:current_syntax = "desc" diff --git a/runtime/syntax/desktop.vim b/runtime/syntax/desktop.vim index 5b71e51192..915107887a 100644 --- a/runtime/syntax/desktop.vim +++ b/runtime/syntax/desktop.vim @@ -3,14 +3,12 @@ " 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 -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -53,8 +51,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 @@ -78,41 +76,31 @@ syn match dtALocale /\[.\{-}\]\s*=\@=/ containedin=ALL " 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_desktop_syntax_inits") - if version < 508 - let did_dosini_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dtGroup Special - HiLink dtComment Comment - HiLink dtDelim String - - HiLink dtLocaleKey Type - HiLink dtLocaleName Identifier - HiLink dtXLocale Identifier - HiLink dtALocale Identifier - - HiLink dtNumericKey Type - - HiLink dtBooleanKey Type - HiLink dtBooleanValue Constant - - HiLink dtStringKey Type - - HiLink dtExecKey Type - HiLink dtExecParam Special - HiLink dtTypeKey Type - HiLink dtTypeValue Constant - HiLink dtNotStLabel Type - HiLink dtXAddKey Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dtGroup Special +hi def link dtComment Comment +hi def link dtDelim String + +hi def link dtLocaleKey Type +hi def link dtLocaleName Identifier +hi def link dtXLocale Identifier +hi def link dtALocale Identifier + +hi def link dtNumericKey Type + +hi def link dtBooleanKey Type +hi def link dtBooleanValue Constant + +hi def link dtStringKey Type + +hi def link dtExecKey Type +hi def link dtExecParam Special +hi def link dtTypeKey Type +hi def link dtTypeValue Constant +hi def link dtNotStLabel Type +hi def link dtXAddKey Type + let b:current_syntax = "desktop" diff --git a/runtime/syntax/dictconf.vim b/runtime/syntax/dictconf.vim index e7fa476975..c762808c89 100644 --- a/runtime/syntax/dictconf.vim +++ b/runtime/syntax/dictconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/dictdconf.vim b/runtime/syntax/dictdconf.vim index 44bf6f8bad..ecf5fd346f 100644 --- a/runtime/syntax/dictdconf.vim +++ b/runtime/syntax/dictdconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index aa5be3f6fe..b656cd97a6 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -2,7 +2,7 @@ " Language: Diff (context or unified) " Maintainer: Bram Moolenaar <Bram@vim.org> " Translations by Jakson Alves de Aquino. -" Last Change: 2013 Oct 06 +" Last Change: 2016 Apr 02 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -18,6 +18,9 @@ syn match diffIsA "^File .* is a .* while file .* is a .*" syn match diffNoEOL "^\\ No newline at end of file .*" syn match diffCommon "^Common subdirectories: .*" +" Disable the translations by setting diff_translations to zero. +if !exists("diff_translations") || diff_translations + " ca syn match diffOnly "^Només a .*" syn match diffIdentical "^Els fitxers .* i .* són idèntics$" @@ -120,13 +123,17 @@ syn match diffNoEOL "^\\ Non hai un salto de liña na fin da liña" syn match diffCommon "^Subdirectorios comúns: .* e .*" " he -syn match diffOnly "^.*-ב קר אצמנ .*" -syn match diffIdentical "^םיהז םניה .*-ו .* םיצבקה$" -syn match diffDiffer "^הזמ הז םינוש `.*'-ו `.*' םיצבקה$" -syn match diffBDiffer "^הזמ הז םינוש `.*'-ו `.*' םיירניב םיצבק$" -syn match diffIsA "^.* .*-ל .* .* תוושהל ןתינ אל$" -syn match diffNoEOL "^\\ ץבוקה ףוסב השדח-הרוש ות רסח" -syn match diffCommon "^.*-ו .* :תוהז תויקית-תת$" +" ^.* are expansive patterns for long lines, so disabled unless we can match +" some specific hebrew chars +if search('\%u05d5\|\%u05d1', 'nw', '', 100) + syn match diffOnly "^.*-ב קר אצמנ .*" + syn match diffIdentical "^םיהז םניה .*-ו .* םיצבקה$" + syn match diffDiffer "^הזמ הז םינוש `.*'-ו `.*' םיצבקה$" + syn match diffBDiffer "^הזמ הז םינוש `.*'-ו `.*' םיירניב םיצבק$" + syn match diffIsA "^.* .*-ל .* .* תוושהל ןתינ אל$" + syn match diffNoEOL "^\\ ץבוקה ףוסב השד.-הרוש ות רס." + syn match diffCommon "^.*-ו .* :תוהז תויקית-תת$" +endif " hr syn match diffOnly "^Samo u .*" @@ -320,6 +327,8 @@ syn match diffIsA "^檔案 .* 是.*而檔案 .* 是.*" syn match diffNoEOL "^\\ 檔案末沒有 newline 字元" syn match diffCommon "^.* 和 .* 有共同的副目錄$" +endif + syn match diffRemoved "^-.*" syn match diffRemoved "^<.*" @@ -333,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\>.*" @@ -343,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 diff --git a/runtime/syntax/dircolors.vim b/runtime/syntax/dircolors.vim index c94d720644..24bc31ff7e 100644 --- a/runtime/syntax/dircolors.vim +++ b/runtime/syntax/dircolors.vim @@ -2,7 +2,7 @@ " Language: dircolors(1) input file " Maintainer: Jan Larres <jan@majutsushi.net> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2013-08-17 +" Latest Revision: 2018-02-19 if exists("b:current_syntax") finish @@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier highlight default link dircolorsEscape Special function! s:set_guicolors() abort - let s:guicolors = {} - - let s:guicolors[0] = "Black" - let s:guicolors[1] = "DarkRed" - let s:guicolors[2] = "DarkGreen" - let s:guicolors[3] = "DarkYellow" - let s:guicolors[4] = "DarkBlue" - let s:guicolors[5] = "DarkMagenta" - let s:guicolors[6] = "DarkCyan" - let s:guicolors[7] = "Gray" - let s:guicolors[8] = "DarkGray" - let s:guicolors[9] = "Red" - let s:guicolors[10] = "Green" - let s:guicolors[11] = "Yellow" - let s:guicolors[12] = "Blue" - let s:guicolors[13] = "Magenta" - let s:guicolors[14] = "Cyan" - let s:guicolors[15] = "White" + let s:termguicolors = {} + + let s:termguicolors[0] = "Black" + let s:termguicolors[1] = "DarkRed" + let s:termguicolors[2] = "DarkGreen" + let s:termguicolors[3] = "DarkYellow" + let s:termguicolors[4] = "DarkBlue" + let s:termguicolors[5] = "DarkMagenta" + let s:termguicolors[6] = "DarkCyan" + let s:termguicolors[7] = "Gray" + let s:termguicolors[8] = "DarkGray" + let s:termguicolors[9] = "Red" + let s:termguicolors[10] = "Green" + let s:termguicolors[11] = "Yellow" + let s:termguicolors[12] = "Blue" + let s:termguicolors[13] = "Magenta" + let s:termguicolors[14] = "Cyan" + let s:termguicolors[15] = "White" let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"] @@ -70,7 +70,7 @@ function! s:set_guicolors() abort for r in xterm_palette for g in xterm_palette for b in xterm_palette - let s:guicolors[cur_col] = '#' . r . g . b + let s:termguicolors[cur_col] = '#' . r . g . b let cur_col += 1 endfor endfor @@ -78,14 +78,14 @@ function! s:set_guicolors() abort for i in range(24) let g = i * 0xa + 8 - let s:guicolors[i + 232] = '#' . g . g . g + let s:termguicolors[i + 232] = '#' . g . g . g endfor endfunction function! s:get_hi_str(color, place) abort if a:color >= 0 && a:color <= 255 if has('gui_running') - return ' gui' . a:place . '=' . s:guicolors[a:color] + return ' gui' . a:place . '=' . s:termguicolors[a:color] elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 return ' cterm' . a:place . '=' . a:color endif @@ -135,6 +135,12 @@ function! s:preview_color(linenr) abort elseif item >= 40 && item <= 47 " ANSI SGR background color let hi_str .= s:get_hi_str(item - 40, 'bg') + elseif item >= 90 && item <= 97 + " ANSI SGR+8 foreground color (xterm 16-color support) + let hi_str .= s:get_hi_str(item - 82, 'fg') + elseif item >= 100 && item <= 107 + " ANSI SGR+8 background color (xterm 16-color support) + let hi_str .= s:get_hi_str(item - 92, 'bg') elseif item == 38 " Foreground for terminals with 88/256 color support let color = s:get_256color(colors) diff --git a/runtime/syntax/diva.vim b/runtime/syntax/diva.vim index 78668fd85a..127a0b4663 100644 --- a/runtime/syntax/diva.vim +++ b/runtime/syntax/diva.vim @@ -11,11 +11,7 @@ " Don't remove any old syntax stuff hanging around! We need stuff " from skill.vim. if !exists("did_skill_syntax_inits") - if version < 600 - so <sfile>:p:h/skill.vim - else - runtime! syntax/skill.vim - endif + runtime! syntax/skill.vim endif syn keyword divaDRCKeywords area enc notch ovlp sep width @@ -81,29 +77,19 @@ syn match divaGeomFunctions "(geom\u\a\+\(45\|90\)\=\>"hs=s+1 syn match divaGeomFunctions "\<geom\u\a\+\(45\|90\)\=("he=e-1 " 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_diva_syntax_inits") - if version < 508 - let did_diva_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink divaDRCKeywords Statement - HiLink divaMeasKeywords Statement - HiLink divaCtrlFunctions Conditional - HiLink divaExtFunctions Function - HiLink divaDRCFunctions Function - HiLink divaFunctions Function - HiLink divaLayerFunctions Function - HiLink divaChkFunctions Function - HiLink divaLVSFunctions Function - HiLink divaGeomFunctions Function +hi def link divaDRCKeywords Statement +hi def link divaMeasKeywords Statement +hi def link divaCtrlFunctions Conditional +hi def link divaExtFunctions Function +hi def link divaDRCFunctions Function +hi def link divaFunctions Function +hi def link divaLayerFunctions Function +hi def link divaChkFunctions Function +hi def link divaLVSFunctions Function +hi def link divaGeomFunctions Function - delcommand HiLink -endif let b:current_syntax = "diva" diff --git a/runtime/syntax/django.vim b/runtime/syntax/django.vim index da315ac302..d3ca4de0e2 100644 --- a/runtime/syntax/django.vim +++ b/runtime/syntax/django.vim @@ -3,11 +3,8 @@ " Maintainer: Dave Hodder <dmh@dmh.org.uk> " Last Change: 2014 Jul 13 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -68,29 +65,19 @@ syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomm syn region djangoComBlock start="{#" end="#}" contains=djangoTodo " 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_django_syn_inits") - if version < 508 - let did_django_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink djangoTagBlock PreProc - HiLink djangoVarBlock PreProc - HiLink djangoStatement Statement - HiLink djangoFilter Identifier - HiLink djangoArgument Constant - HiLink djangoTagError Error - HiLink djangoVarError Error - HiLink djangoError Error - HiLink djangoComment Comment - HiLink djangoComBlock Comment - HiLink djangoTodo Todo +hi def link djangoTagBlock PreProc +hi def link djangoVarBlock PreProc +hi def link djangoStatement Statement +hi def link djangoFilter Identifier +hi def link djangoArgument Constant +hi def link djangoTagError Error +hi def link djangoVarError Error +hi def link djangoError Error +hi def link djangoComment Comment +hi def link djangoComBlock Comment +hi def link djangoTodo Todo - delcommand HiLink -endif let b:current_syntax = "django" diff --git a/runtime/syntax/dnsmasq.vim b/runtime/syntax/dnsmasq.vim index 2a31aed77f..a4cc8b577b 100644 --- a/runtime/syntax/dnsmasq.vim +++ b/runtime/syntax/dnsmasq.vim @@ -4,8 +4,8 @@ " :3s+-foo++g " Description: highlight dnsmasq configuration files " File: runtime/syntax/dnsmasq.vim -" Version: 2.70 -" Last Change: 2014 Apr 30 +" Version: 2.76 +" Last Change: 2015 Sep 27 " Modeline: vim: ts=8:sw=2:sts=2: " " License: VIM License @@ -20,10 +20,8 @@ " endif " -" For version 5.x: Clear all syntax items -if v:version < 600 - syntax clear -elseif exists("b:current_syntax") || &compatible +" quit when a syntax file was already loaded +if exists("b:current_syntax") || &compatible finish endif @@ -131,10 +129,12 @@ syn match DnsmasqKeyword "^\s*dhcp-sequential-ip\>" syn match DnsmasqKeyword "^\s*dhcp-subscrid\>" syn match DnsmasqKeyword "^\s*dhcp-userclass\>" syn match DnsmasqKeyword "^\s*dhcp-vendorclass\>" +syn match DnsmasqKeyword "^\s*dhcp-hostsdir\>" syn match DnsmasqKeyword "^\s*dns-rr\>" syn match DnsmasqKeyword "^\s*dnssec\>" syn match DnsmasqKeyword "^\s*dnssec-check-unsigned\>" syn match DnsmasqKeyword "^\s*dnssec-no-timecheck\>" +syn match DnsmasqKeyword "^\s*dnssec-timestamp\>" syn match DnsmasqKeyword "^\s*dns-forward-max\>" syn match DnsmasqKeyword "^\s*domain\>" syn match DnsmasqKeyword "^\s*domain-needed\>" @@ -150,6 +150,7 @@ syn match DnsmasqKeyword "^\s*host-record\>" syn match DnsmasqKeyword "^\s*interface\>" syn match DnsmasqKeyword "^\s*interface-name\>" syn match DnsmasqKeyword "^\s*ipset\>" +syn match DnsmasqKeyword "^\s*ignore-address\>" syn match DnsmasqKeyword "^\s*keep-in-foreground\>" syn match DnsmasqKeyword "^\s*leasefile-ro\>" syn match DnsmasqKeyword "^\s*listen-address\>" @@ -164,6 +165,7 @@ syn match DnsmasqKeyword "^\s*log-facility\>" syn match DnsmasqKeyword "^\s*log-queries\>" syn match DnsmasqKeyword "^\s*max-ttl\>" syn match DnsmasqKeyword "^\s*max-cache-ttl\>" +syn match DnsmasqKeyword "^\s*min-cache-ttl\>" syn match DnsmasqKeyword "^\s*min-port\>" syn match DnsmasqKeyword "^\s*mx-host\>" syn match DnsmasqKeyword "^\s*mx-target\>" @@ -204,6 +206,7 @@ syn match DnsmasqKeyword "^\s*test\>" syn match DnsmasqKeyword "^\s*tftp-max\>" syn match DnsmasqKeyword "^\s*tftp-lowercase\>" syn match DnsmasqKeyword "^\s*tftp-no-blocksize\>" +syn match DnsmasqKeyword "^\s*tftp-no-fail\>" syn match DnsmasqKeyword "^\s*tftp-port-range\>" syn match DnsmasqKeyword "^\s*tftp-root\>" syn match DnsmasqKeyword "^\s*tftp-secure\>" diff --git a/runtime/syntax/docbk.vim b/runtime/syntax/docbk.vim index fc679eecaf..809f2894e6 100644 --- a/runtime/syntax/docbk.vim +++ b/runtime/syntax/docbk.vim @@ -13,11 +13,8 @@ " http://www.open-oasis.org/docbook/ " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -174,26 +171,15 @@ syn region docbkRemark start="<comment>"lc=9 end="</comment>"me=e-10 contains=x syn region docbkCite start="<citation>"lc=10 end="</citation>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend " 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_docbk_syn_inits") - if version < 508 - let did_docbk_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - hi DocbkBold term=bold cterm=bold gui=bold - else - command -nargs=+ HiLink hi def link <args> - hi def DocbkBold term=bold cterm=bold gui=bold - endif +" Only when an item doesn't have highlighting yet +hi def DocbkBold term=bold cterm=bold gui=bold - HiLink docbkKeyword Statement - HiLink docbkRegion DocbkBold - HiLink docbkTitle Title - HiLink docbkRemark Comment - HiLink docbkCite Constant +hi def link docbkKeyword Statement +hi def link docbkRegion DocbkBold +hi def link docbkTitle Title +hi def link docbkRemark Comment +hi def link docbkCite Constant - delcommand HiLink -endif let b:current_syntax = "docbk" diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim new file mode 100644 index 0000000000..15b66925e5 --- /dev/null +++ b/runtime/syntax/dockerfile.vim @@ -0,0 +1,24 @@ +" dockerfile.vim - Syntax highlighting for Dockerfiles +" Maintainer: Honza Pokorny <https://honza.ca> +" Version: 0.6 +" Last Change: 2016 Aug 9 +" License: BSD + + +if exists("b:current_syntax") + finish +endif + +let b:current_syntax = "dockerfile" + +syntax case ignore + +syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\s/ + +syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/ + +syntax match dockerfileComment "\v^\s*#.*$" + +hi def link dockerfileString String +hi def link dockerfileKeyword Keyword +hi def link dockerfileComment Comment diff --git a/runtime/syntax/dosbatch.vim b/runtime/syntax/dosbatch.vim index d9b1aa6703..249e6f7c46 100644 --- a/runtime/syntax/dosbatch.vim +++ b/runtime/syntax/dosbatch.vim @@ -9,11 +9,8 @@ " dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default] " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -111,49 +108,39 @@ syn keyword dosbatchImplicit sort start subst time title tree type ver verify syn keyword dosbatchImplicit vol xcopy " 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_dosbatch_syntax_inits") - if version < 508 - let did_dosbatch_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dosbatchTodo Todo - - HiLink dosbatchStatement Statement - HiLink dosbatchCommands dosbatchStatement - HiLink dosbatchLabel Label - HiLink dosbatchConditional Conditional - HiLink dosbatchRepeat Repeat - - HiLink dosbatchOperator Operator - HiLink dosbatchEchoOperator dosbatchOperator - HiLink dosbatchIfOperator dosbatchOperator - - HiLink dosbatchArgument Identifier - HiLink dosbatchIdentifier Identifier - HiLink dosbatchVariable dosbatchIdentifier - - HiLink dosbatchSpecialChar SpecialChar - HiLink dosbatchString String - HiLink dosbatchNumber Number - HiLink dosbatchInteger dosbatchNumber - HiLink dosbatchHex dosbatchNumber - HiLink dosbatchBinary dosbatchNumber - HiLink dosbatchOctal dosbatchNumber - - HiLink dosbatchComment Comment - HiLink dosbatchImplicit Function - - HiLink dosbatchSwitch Special - - HiLink dosbatchCmd PreProc - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dosbatchTodo Todo + +hi def link dosbatchStatement Statement +hi def link dosbatchCommands dosbatchStatement +hi def link dosbatchLabel Label +hi def link dosbatchConditional Conditional +hi def link dosbatchRepeat Repeat + +hi def link dosbatchOperator Operator +hi def link dosbatchEchoOperator dosbatchOperator +hi def link dosbatchIfOperator dosbatchOperator + +hi def link dosbatchArgument Identifier +hi def link dosbatchIdentifier Identifier +hi def link dosbatchVariable dosbatchIdentifier + +hi def link dosbatchSpecialChar SpecialChar +hi def link dosbatchString String +hi def link dosbatchNumber Number +hi def link dosbatchInteger dosbatchNumber +hi def link dosbatchHex dosbatchNumber +hi def link dosbatchBinary dosbatchNumber +hi def link dosbatchOctal dosbatchNumber + +hi def link dosbatchComment Comment +hi def link dosbatchImplicit Function + +hi def link dosbatchSwitch Special + +hi def link dosbatchCmd PreProc + let b:current_syntax = "dosbatch" diff --git a/runtime/syntax/dosini.vim b/runtime/syntax/dosini.vim index e474f21116..ccc5e86f1b 100644 --- a/runtime/syntax/dosini.vim +++ b/runtime/syntax/dosini.vim @@ -9,11 +9,8 @@ " Last Change: 2011 Nov 8 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -28,23 +25,13 @@ syn region dosiniHeader start="^\s*\[" end="\]" syn match dosiniComment "^[#;].*$" " 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_dosini_syntax_inits") - if version < 508 - let did_dosini_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dosiniNumber Number - HiLink dosiniHeader Special - HiLink dosiniComment Comment - HiLink dosiniLabel Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dosiniNumber Number +hi def link dosiniHeader Special +hi def link dosiniComment Comment +hi def link dosiniLabel Type + let b:current_syntax = "dosini" diff --git a/runtime/syntax/dot.vim b/runtime/syntax/dot.vim index 4cc6f4f21d..0fdd6ea080 100644 --- a/runtime/syntax/dot.vim +++ b/runtime/syntax/dot.vim @@ -6,11 +6,8 @@ " Last Change: 2011 May 17 - improved identifier matching + two new keywords " 2001 May 04 - initial version -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -74,36 +71,26 @@ syn sync minlines=50 syn sync maxlines=500 " 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_dot_syntax_inits") - if version < 508 - let did_dot_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dotParErr Error - HiLink dotBraceErr Error - HiLink dotBrackErr Error - - HiLink dotComment Comment - HiLink dotTodo Todo - - HiLink dotParEncl Keyword - HiLink dotBrackEncl Keyword - HiLink dotBraceEncl Keyword - - HiLink dotKeyword Keyword - HiLink dotType Type - HiLink dotKeyChar Keyword - - HiLink dotString String - HiLink dotIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dotParErr Error +hi def link dotBraceErr Error +hi def link dotBrackErr Error + +hi def link dotComment Comment +hi def link dotTodo Todo + +hi def link dotParEncl Keyword +hi def link dotBrackEncl Keyword +hi def link dotBraceEncl Keyword + +hi def link dotKeyword Keyword +hi def link dotType Type +hi def link dotKeyChar Keyword + +hi def link dotString String +hi def link dotIdentifier Identifier + let b:current_syntax = "dot" diff --git a/runtime/syntax/doxygen.vim b/runtime/syntax/doxygen.vim index cadbf54dc5..adc0c41dd6 100644 --- a/runtime/syntax/doxygen.vim +++ b/runtime/syntax/doxygen.vim @@ -2,10 +2,10 @@ " Language: doxygen on top of c, cpp, idl, java, php " Maintainer: Michael Geddes <vimmer@frog.wheelycreek.net> " Author: Michael Geddes -" Last Change: Jan 2009 (\tparam by Domnique Pelle, Aug 2013) -" Version: 1.23 +" Last Change: November 2017 (\throws by Candy Gumdrop) +" Version: 1.27 " -" Copyright 2004-2008 Michael Geddes +" Copyright 2004-2017 Michael Geddes " Please feel free to use, modify & distribute all or part of this script, " providing this copyright message remains. " I would appreciate being acknowledged in any derived scripts, and would @@ -58,52 +58,76 @@ try " " C/C++ Style line comments - syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend fold containedin=phpRegion - syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenComment2 fold containedin=phpRegion + syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+ containedin=phpRegion + syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion + syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+ + syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion + + syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO,doxygenLeadingWhite keepend fold containedin=phpRegion + syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenLeadingLWhite,doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenCommentWhite2 fold containedin=phpRegion syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion + syn region doxygenComment start=+/\*@\ze[{}]+ end=+\*/+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion " Single line brief followed by multiline comment. + syn match doxygenCommentWhite2 +\_s*\ze/\*\(\*/\)\@![*!]+ contained nextgroup=doxygenComment2 syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl " Skip empty lines at the start for when comments start on the 2nd/3rd line. - syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkip skipwhite skipnl - syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,,doxygenStartSkip skipwhite skipnl + syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl + syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl " Match the Starting pattern (effectively creating the start of a BNF) if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief - syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl - syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial skipwhite + syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl + syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial + syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeaingLWhite,doxygenPrevL,doxygenBriefL,doxygenSpecial " Match the first sentence as a brief comment if ! exists('g:doxygen_end_punctuation') let g:doxygen_end_punctuation='[.]' endif - exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueComment,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody' + exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueCommentWhite,doxygenLeadingWhite,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody' syn match doxygenBriefEndComment +\*/+ contained exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend' syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite else - syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl - syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial skipwhite + syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl + syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeadingLWhite,doxygenPrevL,doxygenLine,doxygenSpecial + syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial syn region doxygenLine start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@<]+ start=+\<+ end='$' contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend syn match doxygenPrevL +<+ contained nextgroup=doxygenLine,doxygenSpecial skipwhite endif " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. - syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl + syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl + " Match an [@\]brief so that it moves to body-mode. + " + " + " syn match doxygenBriefLine contained + syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite + " syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained + syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained + + + +" end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ +"syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenContinueCommentWhite,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend matchgroup=xxx +syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ skipwhite keepend matchgroup=xxx +" syn region doxygenBriefLine matchgroup=xxxy contained start=+\<\k.\++ skip=+^\s*\k+ end=+end+ skipwhite keepend +"doxygenFindBriefSpecial, + "" syn region doxygenSpecialMultilineDesc start=+.\++ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend - syn region doxygenBriefLine contained start=+\<\k+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ contains=doxygenContinueComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend " Match a '<' for applying a comment to the previous element. - syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkip skipwhite + syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkipWhite skipwhite if exists("c_comment_strings") " These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s @@ -122,10 +146,11 @@ endif "syn region doxygenBodyBit contained start=+$+ " The main body of a doxygen comment. - syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueComment,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell + syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueCommentWhite,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell " These allow the skipping of comment continuation '*' characters. - syn match doxygenContinueComment contained +^\s*\*/\@!\s*+ + syn match doxygenContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenContinueComment + syn match doxygenContinueComment contained +\*/\@!+ " Catch a Brief comment without punctuation - flag it as an error but " make sure the end comment is picked up also. @@ -134,27 +159,19 @@ endif " Skip empty lines at the start for when comments start on the 2nd/3rd line. if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief - syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl - syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl + syn match doxygenStartSkipWhite +^\s*\ze\*/\@!+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl + "syn match doxygenStartSkipWhite +^\s*\ze\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl else - syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl - syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl + syn match doxygenStartSkipWhite +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl + syn match doxygenStartSkipWhite +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl endif - " Match an [@\]brief so that it moves to body-mode. - " - " - " syn match doxygenBriefLine contained - syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite - syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained - - " Create the single word matching special identifiers. fun! s:DxyCreateSmallSpecial( kword, name ) let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@<!\([-0-9A-Za-z_%=+*/!~>|#]\+[-0-9A-Za-z_%=+*/!~>|]\@!\|\\[\\<>&.]@\|[.,][0-9a-zA-Z_]\@=\|::\|([^)]*)\|&[0-9a-zA-Z]\{2,7};\)\+' - exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueComment,doxygen'.a:name.'Word' + exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueCommentWhite,doxygen'.a:name.'Word' exe 'syn match doxygen'.a:name.'Word contained "\_s\@<='.mx.'" contains=doxygenHtmlSpecial,@Spell keepend' endfun call s:DxyCreateSmallSpecial('p', 'Code') @@ -179,40 +196,42 @@ endif " Match parameters and retvals (highlighting the first word as special). syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite - syn keyword doxygenParam contained param tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite + syn keyword doxygenParam contained param nextgroup=doxygenParamName,doxygenParamDirection skipwhite + syn keyword doxygenTParam contained tparam nextgroup=doxygenParamName skipwhite syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite - syn keyword doxygenRetval contained retval throw exception nextgroup=doxygenParamName skipwhite + syn keyword doxygenRetval contained retval throw throws exception nextgroup=doxygenParamName skipwhite " Match one line identifiers. syn keyword doxygenOther contained addindex anchor \ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer - \ example htmlonly image include ingroup internal latexonly line + \ example htmlonly image include includelineno ingroup internal latexonly line \ overload relates relatesalso sa skip skipline \ until verbinclude version addtogroup htmlinclude copydoc dotfile \ xmlonly endxmlonly - \ nextgroup=doxygenSpecialOnelineDesc + \ nextgroup=doxygenSpecialOnelineDesc copybrief copydetails copyright dir extends + \ implements - syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell + syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell syn match doxygenCodeRegionSpecial contained +[\\@]\(endcode\>\)\@=+ - syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell + syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell syn match doxygenVerbatimRegionSpecial contained +[\\@]\(endverbatim\>\)\@=+ - if exists('b:current_syntax') + if exists('b:current_syntax') let b:doxygen_syntax_save=b:current_syntax unlet b:current_syntax endif syn include @Dotx syntax/dot.vim - if exists('b:doxygen_syntax_save') + if exists('b:doxygen_syntax_save') let b:current_syntax=b:doxygen_syntax_save unlet b:doxygen_syntax_save else unlet b:current_syntax endif - syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueComment,@NoSpell,@Dotx + syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueCommentWhite,@NoSpell,@Dotx syn match doxygenDotRegionSpecial contained +[\\@]\(enddot\>\)\@=+ " Match single line identifiers. @@ -223,13 +242,13 @@ endif syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc - syn keyword doxygenOther contained arg author date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc + syn keyword doxygenOther contained arg author authors date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc " Handle \link, \endlink, highlighting the link-to and the link text bits separately. - syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueComment,doxygenLinkError,doxygenEndlinkSpecial + syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueCommentWhite,doxygenLinkError,doxygenEndlinkSpecial syn match doxygenEndlinkSpecial contained +[\\@]\zeendlink\>+ syn match doxygenLinkWord "[_a-zA-Z:#()][_a-z0-9A-Z:#()]*\>" contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment @@ -249,7 +268,7 @@ endif " Handle section syn keyword doxygenOther defgroup section subsection subsubsection weakgroup contained skipwhite nextgroup=doxygenSpecialIdent - syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueComment + syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueCommentWhite syn match doxygenSpecialIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenSpecialSectionDesc " Does the one-line description for the one-line type identifiers. @@ -259,8 +278,12 @@ endif " Handle the multiline description for the multiline type identifiers. " Continue until an 'empty' line (can contain a '*' continuation) or until the " next whole-line @ command \ command. - syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueComment,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend - syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite + syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend + +" syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite + syn match doxygenSpecialContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenSpecialContinueComment + syn match doxygenSpecialContinueComment contained +\*/\@!+ + " Handle special cases 'bold' and 'group' syn keyword doxygenBold contained bold nextgroup=doxygenSpecialHeading @@ -287,7 +310,7 @@ endif " Supported HTML subset. Not perfect, but okay. syn case ignore - syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueComment,doxygenHtmlVar + syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueCommentWhite,doxygenHtmlVar syn keyword doxygenHtmlCmd contained b i em strong u img a br p center code dfn dl dd dt hr h1 h2 h3 li ol ul pre small sub sup table tt var caption nextgroup=doxygenHtmlVar skipwhite syn keyword doxygenHtmlVar contained src alt longdesc name height width usemap ismap href type nextgroup=doxygenHtmlEqu skipwhite syn match doxygenHtmlEqu contained +=+ nextgroup=doxygenHtmlExpr skipwhite @@ -297,7 +320,7 @@ endif syn cluster doxygenHtmlGroup contains=doxygenHtmlCode,doxygenHtmlBold,doxygenHtmlUnderline,doxygenHtmlItalic,doxygenHtmlSpecial,doxygenHtmlTag,doxygenHtmlLink - syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueComment + syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueCommentWhite " Html Support syn region doxygenHtmlLink contained start=+<[aA]\>\s*\(\n\s*\*\s*\)\=\(\(name\|href\)=\("[^"]*"\|'[^']*'\)\)\=\s*>+ end=+</[aA]>+me=e-4 contains=@doxygenHtmlTop hi link doxygenHtmlLink Underlined @@ -342,7 +365,7 @@ endif syn cluster rcGroup add=doxygen.* let s:my_syncolor=0 - if !exists(':SynColor') + if !exists(':SynColor') command -nargs=+ SynColor hi def <args> let s:my_syncolor=1 endif @@ -468,6 +491,8 @@ endif call s:Doxygen_Hilights() + syn match doxygenLeadingWhite +\(^\s*\*\)\@<=\s*+ contained + " This is still a proposal, but won't do any harm. aug doxygengroup au! @@ -482,6 +507,7 @@ endif SynLink doxygenOtherTODO Todo SynLink doxygenOtherWARN Todo SynLink doxygenOtherBUG Todo + SynLink doxygenLeadingLWhite doxygenBody SynLink doxygenErrorSpecial Error SynLink doxygenErrorEnd Error @@ -516,7 +542,10 @@ endif SynLink doxygenBriefL doxygenBrief SynLink doxygenBriefLine doxygenBrief SynLink doxygenHeaderLine doxygenSpecialHeading - SynLink doxygenStartSkip doxygenContinueComment + SynLink doxygenCommentWhite Normal + SynLink doxygenCommentWhite2 doxygenCommentWhite + SynLink doxygenContinueCommentWhite doxygenCommentWhite + SynLink doxygenStartSkipWhite doxygenContinueCommentWhite SynLink doxygenLinkWord doxygenParamName SynLink doxygenLinkRest doxygenSpecialMultilineDesc SynLink doxygenHyperLink doxygenLinkWord @@ -590,5 +619,5 @@ finally let &cpo = s:cpo_save unlet s:cpo_save endtry - +let suppress_doxygen=1 " vim:et sw=2 sts=2 diff --git a/runtime/syntax/dracula.vim b/runtime/syntax/dracula.vim index 6a3806028e..a373dc200c 100644 --- a/runtime/syntax/dracula.vim +++ b/runtime/syntax/dracula.vim @@ -8,11 +8,8 @@ " the purposes of Design Rule Checking, Layout vs. Schematic " verification, and Layout Parameter Extraction. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -61,24 +58,14 @@ syn match draculaPreProc "^#.*" syn sync lines=50 " 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_dracula_syn_inits") - if version < 508 - let did_dracula_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink draculaIdentifier Identifier - HiLink draculaStatement Statement - HiLink draculaType Type - HiLink draculaComment Comment - HiLink draculaPreProc PreProc +hi def link draculaIdentifier Identifier +hi def link draculaStatement Statement +hi def link draculaType Type +hi def link draculaComment Comment +hi def link draculaPreProc PreProc - delcommand HiLink -endif let b:current_syntax = "dracula" diff --git a/runtime/syntax/dtd.vim b/runtime/syntax/dtd.vim index 001dbbddd3..ae0bd1288e 100644 --- a/runtime/syntax/dtd.vim +++ b/runtime/syntax/dtd.vim @@ -126,41 +126,31 @@ syn keyword dtdTodo contained TODO FIXME XXX syn sync lines=250 " 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_dtd_syn_inits") - if version < 508 - let did_dtd_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink dtdFunction Function - HiLink dtdTag Normal - HiLink dtdType Type - HiLink dtdAttrType dtdType - HiLink dtdAttrDef dtdType - HiLink dtdConstant Constant - HiLink dtdString dtdConstant - HiLink dtdEnum dtdConstant - HiLink dtdCard dtdFunction - - HiLink dtdEntity Statement - HiLink dtdEntityPunct dtdType - HiLink dtdParamEntityInst dtdConstant - HiLink dtdParamEntityPunct dtdType - HiLink dtdParamEntityDecl dtdType - HiLink dtdParamEntityDPunct dtdComment - - HiLink dtdComment Comment - HiLink dtdTagName Statement - HiLink dtdError Error - HiLink dtdTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link dtdFunction Function +hi def link dtdTag Normal +hi def link dtdType Type +hi def link dtdAttrType dtdType +hi def link dtdAttrDef dtdType +hi def link dtdConstant Constant +hi def link dtdString dtdConstant +hi def link dtdEnum dtdConstant +hi def link dtdCard dtdFunction + +hi def link dtdEntity Statement +hi def link dtdEntityPunct dtdType +hi def link dtdParamEntityInst dtdConstant +hi def link dtdParamEntityPunct dtdType +hi def link dtdParamEntityDecl dtdType +hi def link dtdParamEntityDPunct dtdComment + +hi def link dtdComment Comment +hi def link dtdTagName Statement +hi def link dtdError Error +hi def link dtdTodo Todo + let &cpo = s:dtd_cpo_save unlet s:dtd_cpo_save diff --git a/runtime/syntax/dtml.vim b/runtime/syntax/dtml.vim index 7de722aabd..cb09de8091 100644 --- a/runtime/syntax/dtml.vim +++ b/runtime/syntax/dtml.vim @@ -9,20 +9,13 @@ " hacked out of the Zope Quick Reference in case someone finds something " sensible to do with them. I certainly haven't. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " First load the HTML syntax -if version < 600 - source <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim syn case match @@ -196,25 +189,15 @@ syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagNa syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,dtmlIsTag,dtmlAttribute,dtmlMethod,@htmlTagNameCluster " 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_dtml_syntax_inits") - if version < 508 - let did_dtml_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dtmlIsTag PreProc - HiLink dtmlAttribute Identifier - HiLink dtmlMethod Function - HiLink dtmlComment Comment - HiLink dtmlTODO Todo - HiLink dtmlSpecialChar Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dtmlIsTag PreProc +hi def link dtmlAttribute Identifier +hi def link dtmlMethod Function +hi def link dtmlComment Comment +hi def link dtmlTODO Todo +hi def link dtmlSpecialChar Special + let b:current_syntax = "dtml" diff --git a/runtime/syntax/dtrace.vim b/runtime/syntax/dtrace.vim index 2f2d6e2cc7..392fa1c1c9 100644 --- a/runtime/syntax/dtrace.vim +++ b/runtime/syntax/dtrace.vim @@ -10,19 +10,14 @@ " http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdtrace/common/dt_lex.l " http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdtrace/common/dt_grammar.y -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - so <sfile>:p:h/c.vim -else - runtime! syntax/c.vim - unlet b:current_syntax -endif +runtime! syntax/c.vim +unlet b:current_syntax syn clear cCommentL " dtrace doesn't support // style comments diff --git a/runtime/syntax/dylan.vim b/runtime/syntax/dylan.vim index 14262d53d6..345e932e60 100644 --- a/runtime/syntax/dylan.vim +++ b/runtime/syntax/dylan.vim @@ -8,21 +8,14 @@ " syntax files. " Part 1: Syntax definition -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif syn case ignore -if version < 600 - set lisp -else - setlocal lisp -endif +setlocal lisp " Highlight special characters (those that have backslashes) differently syn match dylanSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" @@ -67,42 +60,32 @@ syn region dylanPrecondit start="^\s*#\s*\(if\>\|else\>\|endif\>\)" skip="\\$" syn region dylanHeader start="^[Mm]odule:" end="^$" " 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_dylan_syntax_inits") - if version < 508 - let did_dylan_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink dylanBlock PreProc - HiLink dylanBoolean Boolean - HiLink dylanCharacter Character - HiLink dylanClass Structure - HiLink dylanClassMods StorageClass - HiLink dylanComment Comment - HiLink dylanConditional Conditional - HiLink dylanConstant Constant - HiLink dylanException Exception - HiLink dylanHeader Macro - HiLink dylanImport Include - HiLink dylanLabel Label - HiLink dylanMiscMods StorageClass - HiLink dylanNumber Number - HiLink dylanOther Keyword - HiLink dylanOperator Operator - HiLink dylanParamDefs Keyword - HiLink dylanPrecondit PreCondit - HiLink dylanRepeat Repeat - HiLink dylanSimpleDefs Keyword - HiLink dylanStatement Macro - HiLink dylanString String - HiLink dylanVariable Identifier +hi def link dylanBlock PreProc +hi def link dylanBoolean Boolean +hi def link dylanCharacter Character +hi def link dylanClass Structure +hi def link dylanClassMods StorageClass +hi def link dylanComment Comment +hi def link dylanConditional Conditional +hi def link dylanConstant Constant +hi def link dylanException Exception +hi def link dylanHeader Macro +hi def link dylanImport Include +hi def link dylanLabel Label +hi def link dylanMiscMods StorageClass +hi def link dylanNumber Number +hi def link dylanOther Keyword +hi def link dylanOperator Operator +hi def link dylanParamDefs Keyword +hi def link dylanPrecondit PreCondit +hi def link dylanRepeat Repeat +hi def link dylanSimpleDefs Keyword +hi def link dylanStatement Macro +hi def link dylanString String +hi def link dylanVariable Identifier - delcommand HiLink -endif let b:current_syntax = "dylan" diff --git a/runtime/syntax/dylanintr.vim b/runtime/syntax/dylanintr.vim index 11ef816681..692db34985 100644 --- a/runtime/syntax/dylanintr.vim +++ b/runtime/syntax/dylanintr.vim @@ -4,11 +4,8 @@ " Last Change: Fri Sep 29 13:53:27 PDT 2000 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -26,26 +23,16 @@ syn match dylanintrInclude "^\s*#\s*include\>\s*["<]" contains=intrIncluded "syn keyword intrMods pointer struct " 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_dylan_intr_syntax_inits") - if version < 508 - let did_dylan_intr_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dylanintrInfo Special - HiLink dylanintrInterface Operator - HiLink dylanintrMods Type - HiLink dylanintrClass StorageClass - HiLink dylanintrType Type - HiLink dylanintrIncluded String - HiLink dylanintrInclude Include - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dylanintrInfo Special +hi def link dylanintrInterface Operator +hi def link dylanintrMods Type +hi def link dylanintrClass StorageClass +hi def link dylanintrType Type +hi def link dylanintrIncluded String +hi def link dylanintrInclude Include + let b:current_syntax = "dylanintr" diff --git a/runtime/syntax/dylanlid.vim b/runtime/syntax/dylanlid.vim index ec7b40114c..dae0bf94b1 100644 --- a/runtime/syntax/dylanlid.vim +++ b/runtime/syntax/dylanlid.vim @@ -5,11 +5,8 @@ " Last Change: Fri Sep 29 13:50:20 PDT 2000 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -21,21 +18,11 @@ syn region dylanlidEntry matchgroup=Statement start=":%" end="$" oneline syn sync lines=50 " 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_dylan_lid_syntax_inits") - if version < 508 - let did_dylan_lid_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink dylanlidInfo Type - HiLink dylanlidEntry String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link dylanlidInfo Type +hi def link dylanlidEntry String + let b:current_syntax = "dylanlid" diff --git a/runtime/syntax/ecd.vim b/runtime/syntax/ecd.vim index fff7a4b883..1276f2bd9d 100644 --- a/runtime/syntax/ecd.vim +++ b/runtime/syntax/ecd.vim @@ -8,10 +8,8 @@ " This syntax file was derived from apachestyle.vim " by Christian Hammers <ch@westend.com> -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -31,26 +29,16 @@ syn match ecdTagN contained +<[/\s]*[-a-zA-Z0-9_]\++ms=s+1 syn match ecdTagError contained "[^>]<"ms=s+1 " 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_ecd_syn_inits") - if version < 508 - let did_ecd_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ecdComment Comment - HiLink ecdAttr Type - HiLink ecdAttrN Statement - HiLink ecdAttrV Value - HiLink ecdTag Function - HiLink ecdTagN Statement - HiLink ecdTagError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link ecdComment Comment +hi def link ecdAttr Type +hi def link ecdAttrN Statement +hi def link ecdAttrV Value +hi def link ecdTag Function +hi def link ecdTagN Statement +hi def link ecdTagError Error + let b:current_syntax = "ecd" " vim: ts=8 diff --git a/runtime/syntax/edif.vim b/runtime/syntax/edif.vim index 0c17834947..002c9f89e1 100644 --- a/runtime/syntax/edif.vim +++ b/runtime/syntax/edif.vim @@ -8,18 +8,12 @@ " IEC 61690-1 (EDIF Version 3 0 0) " IEC 61690-2 (EDIF Version 4 0 0) -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=48-57,-,+,A-Z,a-z,_,& -else - set iskeyword=A-Z,a-z,_,& -endif +setlocal iskeyword=48-57,-,+,A-Z,a-z,_,& syn region edifList matchgroup=Delimiter start="(" end=")" contains=edifList,edifKeyword,edifString,edifNumber @@ -37,28 +31,15 @@ syn match edifKeyword "(\@<=\s*[a-zA-Z&][a-zA-Z_0-9]*\>" contained syn match edifError ")" " synchronization -if version < 600 - syntax sync maxlines=250 -else - syntax sync fromstart -endif +syntax sync fromstart " Define the default highlighting. -if version >= 508 || !exists("did_edif_syntax_inits") - if version < 508 - let did_edif_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink edifInString SpecialChar - HiLink edifKeyword Keyword - HiLink edifNumber Number - HiLink edifInStringError edifError - HiLink edifError Error - HiLink edifString String - delcommand HiLink -endif +hi def link edifInString SpecialChar +hi def link edifKeyword Keyword +hi def link edifNumber Number +hi def link edifInStringError edifError +hi def link edifError Error +hi def link edifString String let b:current_syntax = "edif" diff --git a/runtime/syntax/eiffel.vim b/runtime/syntax/eiffel.vim index a91f85d03e..c6634871cc 100644 --- a/runtime/syntax/eiffel.vim +++ b/runtime/syntax/eiffel.vim @@ -5,11 +5,8 @@ " Contributions from: Thilo Six " " URL: https://github.com/eiffelhub/vim-eiffel -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -141,68 +138,58 @@ endif syn sync lines=40 " 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_eiffel_syntax_inits") - if version < 508 - let did_eiffel_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink eiffelKeyword Statement - HiLink eiffelProperty Statement - HiLink eiffelInheritClause Statement - HiLink eiffelStatement Statement - HiLink eiffelDeclaration Statement - HiLink eiffelAssertion Statement - HiLink eiffelDebug Statement - HiLink eiffelException Statement - HiLink eiffelGenericCreate Statement +hi def link eiffelKeyword Statement +hi def link eiffelProperty Statement +hi def link eiffelInheritClause Statement +hi def link eiffelStatement Statement +hi def link eiffelDeclaration Statement +hi def link eiffelAssertion Statement +hi def link eiffelDebug Statement +hi def link eiffelException Statement +hi def link eiffelGenericCreate Statement - HiLink eiffelAgent Statement - HiLink eiffelConvert Statement +hi def link eiffelAgent Statement +hi def link eiffelConvert Statement - HiLink eiffelTopStruct PreProc +hi def link eiffelTopStruct PreProc - HiLink eiffelAll Special - HiLink eiffelAnchored Special - HiLink eiffelBitType Special +hi def link eiffelAll Special +hi def link eiffelAnchored Special +hi def link eiffelBitType Special - HiLink eiffelBool Boolean - HiLink eiffelString String - HiLink eiffelCharacter Character - HiLink eiffelClassName Type - HiLink eiffelNumber Number +hi def link eiffelBool Boolean +hi def link eiffelString String +hi def link eiffelCharacter Character +hi def link eiffelClassName Type +hi def link eiffelNumber Number - HiLink eiffelStringEscape Special +hi def link eiffelStringEscape Special - HiLink eiffelOperator Special - HiLink eiffelArray Special - HiLink eiffelExport Special - HiLink eiffelCreation Special - HiLink eiffelBrackets Special - HiLink eiffelGeneric Special - HiLink eiffelGenericDecl Special - HiLink eiffelConstraint Special - HiLink eiffelCreate Special +hi def link eiffelOperator Special +hi def link eiffelArray Special +hi def link eiffelExport Special +hi def link eiffelCreation Special +hi def link eiffelBrackets Special +hi def link eiffelGeneric Special +hi def link eiffelGenericDecl Special +hi def link eiffelConstraint Special +hi def link eiffelCreate Special - HiLink eiffelPredefined Constant +hi def link eiffelPredefined Constant - HiLink eiffelComment Comment +hi def link eiffelComment Comment - HiLink eiffelError Error - HiLink eiffelBadConstant Error - HiLink eiffelStringError Error - HiLink eiffelParenError Error - HiLink eiffelBracketError Error +hi def link eiffelError Error +hi def link eiffelBadConstant Error +hi def link eiffelStringError Error +hi def link eiffelParenError Error +hi def link eiffelBracketError Error - HiLink eiffelTodo Todo +hi def link eiffelTodo Todo - delcommand HiLink -endif let b:current_syntax = "eiffel" diff --git a/runtime/syntax/elf.vim b/runtime/syntax/elf.vim index 621e063ff8..e695dbc79a 100644 --- a/runtime/syntax/elf.vim +++ b/runtime/syntax/elf.vim @@ -10,11 +10,8 @@ " This is the Applix Inc., Macro and Builder programming language. " It has nothing in common with the binary format called ELF. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -63,32 +60,22 @@ syn match elfParens "[\[\]()]" syn match elfPunct "[,;]" " 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_elf_syn_inits") - if version < 508 - let did_elf_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later. - HiLink elfComment Comment - HiLink elfPPCom Include - HiLink elfKeyword Keyword - HiLink elfSpecial Special - HiLink elfEnvironment Special - HiLink elfBraceError Error - HiLink elfConditional Conditional - HiLink elfMacro Function - HiLink elfNumber Number - HiLink elfString String - HiLink elfParens Delimiter - HiLink elfPunct Delimiter - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later. +hi def link elfComment Comment +hi def link elfPPCom Include +hi def link elfKeyword Keyword +hi def link elfSpecial Special +hi def link elfEnvironment Special +hi def link elfBraceError Error +hi def link elfConditional Conditional +hi def link elfMacro Function +hi def link elfNumber Number +hi def link elfString String +hi def link elfParens Delimiter +hi def link elfPunct Delimiter + let b:current_syntax = "elf" diff --git a/runtime/syntax/elinks.vim b/runtime/syntax/elinks.vim index b4d9e02ef6..98252a24d3 100644 --- a/runtime/syntax/elinks.vim +++ b/runtime/syntax/elinks.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: elinks(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: elinks(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/elmfilt.vim b/runtime/syntax/elmfilt.vim index 0afa1694cf..ec97af038d 100644 --- a/runtime/syntax/elmfilt.vim +++ b/runtime/syntax/elmfilt.vim @@ -1,15 +1,12 @@ " Vim syntax file " Language: Elm Filter rules -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 11, 2006 -" Version: 5 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 8 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -38,32 +35,23 @@ syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" con syn match elmfiltSpaceError contained "\s.*$" " 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_elmfilt_syntax_inits") - if version < 508 - let did_elmfilt_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +if !exists("skip_elmfilt_syntax_inits") + + hi def link elmfiltAction Statement + hi def link elmfiltArg Special + hi def link elmfiltComment Comment + hi def link elmfiltCond Statement + hi def link elmfiltIf Statement + hi def link elmfiltMatch Special + hi def link elmfiltMatchError Error + hi def link elmfiltNumber Number + hi def link elmfiltOper Operator + hi def link elmfiltOperKey Type + hi def link elmfiltParenError Error + hi def link elmfiltSpaceError Error + hi def link elmfiltString String + hi def link elmfiltThenError Error - HiLink elmfiltAction Statement - HiLink elmfiltArg Special - HiLink elmfiltComment Comment - HiLink elmfiltCond Statement - HiLink elmfiltIf Statement - HiLink elmfiltMatch Special - HiLink elmfiltMatchError Error - HiLink elmfiltNumber Number - HiLink elmfiltOper Operator - HiLink elmfiltOperKey Type - HiLink elmfiltParenError Error - HiLink elmfiltSpaceError Error - HiLink elmfiltString String - HiLink elmfiltThenError Error - - delcommand HiLink endif let b:current_syntax = "elmfilt" diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim index 02597e75f3..870fcca106 100644 --- a/runtime/syntax/erlang.vim +++ b/runtime/syntax/erlang.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Erlang (http://www.erlang.org) " Maintainer: Csaba Hoch <csaba.hoch@gmail.com> -" Last Update: 2013-Jul-25 +" Contributor: Adam Rutkowski <hq@mtod.org> +" Last Update: 2017-Mar-05 " License: Vim license -" URL: https://github.com/hcs42/vim-erlang +" URL: https://github.com/vim-erlang/vim-erlang-runtime " Acknowledgements: This script was originally created by Kresimir Marzic [1]. " The script was then revamped by Csaba Hoch [2]. During the revamp, the new @@ -28,11 +29,8 @@ " " syn keyword erlangAttribute myattr1 myattr2 contained -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -42,16 +40,13 @@ set cpo&vim " Case sensitive syn case match -if version >= 600 - setlocal iskeyword+=$,@-@ -endif +setlocal iskeyword+=$,@-@ " Comments syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlangTodo syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained syn match erlangCommentAnnotation /`[^']*'/ contained syn keyword erlangTodo TODO FIXME XXX contained -syn match erlangShebang '^#!.*' " Numbers (minimum base is 2, maximum is 36.) syn match erlangNumberInteger '\<\d\+\>' @@ -61,12 +56,12 @@ syn match erlangNumberFloat '\<\d\+\.\d\+\%([eE][+-]\=\d\+\)\=\>' " Strings, atoms, characters syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier -syn match erlangStringModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained -syn match erlangQuotedAtomModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained +syn match erlangStringModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\|\~\%([ni~]\|\%(-\=\d\+\|\*\)\=\.\=\%(\*\|\d\+\)\=\%(\..\)\=[tl]*[cfegswpWPBX#bx+]\)' contained +syn match erlangQuotedAtomModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)' " Operators, separators -syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' +syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|=>\|:=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' syn keyword erlangOperator div rem or xor bor bxor bsl bsr and band not bnot andalso orelse syn match erlangBracket '{\|}\|\[\|]\||\|||' syn match erlangPipe '|' @@ -77,14 +72,19 @@ syn match erlangAtom '\<\l[[:alnum:]_@]*' contains=erlangBoolean syn keyword erlangBoolean true false contained syn match erlangLocalFuncCall '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangBIF syn match erlangLocalFuncRef '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' -syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment -syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment +syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment,erlangVariable +syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment,erlangVariable -" Variables, macros, records +" Variables, macros, records, maps syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*' syn match erlangMacro '??\=[[:alnum:]_@]\+' syn match erlangMacro '\%(-define(\)\@<=[[:alnum:]_@]\+' +syn match erlangMap '#' syn match erlangRecord '#\s*\l[[:alnum:]_@]*' +syn region erlangQuotedRecord start=/#\s*'/ end=/'/ contains=erlangQuotedAtomModifier + +" Shebang (this line has to be after the ErlangMap) +syn match erlangShebang '^#!.*' " Bitstrings syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\%(\%(\s\|\n\|%.*\n\)*-\%(\s\|\n\|%.*\n\)*\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\)*' contains=erlangComment @@ -99,7 +99,7 @@ syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|endif syn match erlangType '^\s*-\%(\s\|\n\|%.*\n\)*\%(spec\|type\|opaque\|callback\)\>' contains=erlangComment " Keywords -syn keyword erlangKeyword after begin case catch cond end fun if let of query +syn keyword erlangKeyword after begin case catch cond end fun if let of syn keyword erlangKeyword receive when try " Build-in-functions (BIFs) @@ -147,116 +147,109 @@ let b:erlang_syntax_synced = 1 let s:old_style = (exists("g:erlang_old_style_highlight") && \g:erlang_old_style_highlight == 1) -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_erlang_inits") - if version < 508 - let did_erlang_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " Comments - HiLink erlangComment Comment - HiLink erlangCommentAnnotation Special - HiLink erlangTodo Todo - HiLink erlangShebang Comment - - " Numbers - HiLink erlangNumberInteger Number - HiLink erlangNumberFloat Float - - " Strings, atoms, characters - HiLink erlangString String - - if s:old_style - HiLink erlangQuotedAtom Type - else - HiLink erlangQuotedAtom String - endif - - HiLink erlangStringModifier Special - HiLink erlangQuotedAtomModifier Special - HiLink erlangModifier Special - - " Operators, separators - HiLink erlangOperator Operator - HiLink erlangRightArrow Operator - if s:old_style - HiLink erlangBracket Normal - HiLink erlangPipe Normal - else - HiLink erlangBracket Delimiter - HiLink erlangPipe Delimiter - endif - - " Atoms, functions, variables, macros - if s:old_style - HiLink erlangAtom Normal - HiLink erlangLocalFuncCall Normal - HiLink erlangLocalFuncRef Normal - HiLink erlangGlobalFuncCall Function - HiLink erlangGlobalFuncRef Function - HiLink erlangVariable Normal - HiLink erlangMacro Normal - HiLink erlangRecord Normal - else - HiLink erlangAtom String - HiLink erlangLocalFuncCall Normal - HiLink erlangLocalFuncRef Normal - HiLink erlangGlobalFuncCall Normal - HiLink erlangGlobalFuncRef Normal - HiLink erlangVariable Identifier - HiLink erlangMacro Macro - HiLink erlangRecord Structure - endif - - " Bitstrings - if !s:old_style - HiLink erlangBitType Type - endif - - " Constants and Directives - if s:old_style - HiLink erlangAttribute Type - HiLink erlangMacroDef Type - HiLink erlangUnknownAttribute Normal - HiLink erlangInclude Type - HiLink erlangRecordDef Type - HiLink erlangDefine Type - HiLink erlangPreCondit Type - HiLink erlangType Type - else - HiLink erlangAttribute Keyword - HiLink erlangMacroDef Macro - HiLink erlangUnknownAttribute Normal - HiLink erlangInclude Include - HiLink erlangRecordDef Keyword - HiLink erlangDefine Define - HiLink erlangPreCondit PreCondit - HiLink erlangType Type - endif - - " Keywords - HiLink erlangKeyword Keyword - - " Build-in-functions (BIFs) - HiLink erlangBIF Function - - if s:old_style - HiLink erlangBoolean Statement - HiLink erlangExtra Statement - HiLink erlangSignal Statement - else - HiLink erlangBoolean Boolean - HiLink erlangExtra Statement - HiLink erlangSignal Statement - endif - - delcommand HiLink + +" Comments +hi def link erlangComment Comment +hi def link erlangCommentAnnotation Special +hi def link erlangTodo Todo +hi def link erlangShebang Comment + +" Numbers +hi def link erlangNumberInteger Number +hi def link erlangNumberFloat Float + +" Strings, atoms, characters +hi def link erlangString String + +if s:old_style +hi def link erlangQuotedAtom Type +else +hi def link erlangQuotedAtom String +endif + +hi def link erlangStringModifier Special +hi def link erlangQuotedAtomModifier Special +hi def link erlangModifier Special + +" Operators, separators +hi def link erlangOperator Operator +hi def link erlangRightArrow Operator +if s:old_style +hi def link erlangBracket Normal +hi def link erlangPipe Normal +else +hi def link erlangBracket Delimiter +hi def link erlangPipe Delimiter +endif + +" Atoms, functions, variables, macros +if s:old_style +hi def link erlangAtom Normal +hi def link erlangLocalFuncCall Normal +hi def link erlangLocalFuncRef Normal +hi def link erlangGlobalFuncCall Function +hi def link erlangGlobalFuncRef Function +hi def link erlangVariable Normal +hi def link erlangMacro Normal +hi def link erlangRecord Normal +hi def link erlangQuotedRecord Normal +hi def link erlangMap Normal +else +hi def link erlangAtom String +hi def link erlangLocalFuncCall Normal +hi def link erlangLocalFuncRef Normal +hi def link erlangGlobalFuncCall Normal +hi def link erlangGlobalFuncRef Normal +hi def link erlangVariable Identifier +hi def link erlangMacro Macro +hi def link erlangRecord Structure +hi def link erlangQuotedRecord Structure +hi def link erlangMap Structure +endif + +" Bitstrings +if !s:old_style +hi def link erlangBitType Type +endif + +" Constants and Directives +if s:old_style +hi def link erlangAttribute Type +hi def link erlangMacroDef Type +hi def link erlangUnknownAttribute Normal +hi def link erlangInclude Type +hi def link erlangRecordDef Type +hi def link erlangDefine Type +hi def link erlangPreCondit Type +hi def link erlangType Type +else +hi def link erlangAttribute Keyword +hi def link erlangMacroDef Macro +hi def link erlangUnknownAttribute Normal +hi def link erlangInclude Include +hi def link erlangRecordDef Keyword +hi def link erlangDefine Define +hi def link erlangPreCondit PreCondit +hi def link erlangType Type endif +" Keywords +hi def link erlangKeyword Keyword + +" Build-in-functions (BIFs) +hi def link erlangBIF Function + +if s:old_style +hi def link erlangBoolean Statement +hi def link erlangExtra Statement +hi def link erlangSignal Statement +else +hi def link erlangBoolean Boolean +hi def link erlangExtra Statement +hi def link erlangSignal Statement +endif + + let b:current_syntax = "erlang" let &cpo = s:cpo_save diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim index c20b086ba5..4e175bcc25 100644 --- a/runtime/syntax/eruby.vim +++ b/runtime/syntax/eruby.vim @@ -22,7 +22,7 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' diff --git a/runtime/syntax/esmtprc.vim b/runtime/syntax/esmtprc.vim index b22b1a1416..81f074b59c 100644 --- a/runtime/syntax/esmtprc.vim +++ b/runtime/syntax/esmtprc.vim @@ -3,11 +3,8 @@ " Maintainer: Kornel Kielczewski <kornel@gazeta.pl> " Last Change: 16 Feb 2005 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/esqlc.vim b/runtime/syntax/esqlc.vim index 6ad167a7e6..792e5d37f3 100644 --- a/runtime/syntax/esqlc.vim +++ b/runtime/syntax/esqlc.vim @@ -3,20 +3,13 @@ " Maintainer: Jonathan A. George <jageorge@tel.gte.com> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C++ syntax to start with -if version < 600 - source <sfile>:p:h/cpp.vim -else - runtime! syntax/cpp.vim -endif +runtime! syntax/cpp.vim " ESQL-C extentions @@ -52,24 +45,14 @@ syntax keyword esqlcStatement rename revoke rollback savepoint select set syntax keyword esqlcStatement truncate update " 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_esqlc_syntax_inits") - if version < 508 - let did_esqlc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink esqlcOperator Operator - HiLink esqlcStatement Statement - HiLink esqlcKeyword esqlcSpecial - HiLink esqlcSpecial Special - HiLink esqlcPreProc PreProc +hi def link esqlcOperator Operator +hi def link esqlcStatement Statement +hi def link esqlcKeyword esqlcSpecial +hi def link esqlcSpecial Special +hi def link esqlcPreProc PreProc - delcommand HiLink -endif let b:current_syntax = "esqlc" diff --git a/runtime/syntax/esterel.vim b/runtime/syntax/esterel.vim index d853e75208..b0105216d7 100644 --- a/runtime/syntax/esterel.vim +++ b/runtime/syntax/esterel.vim @@ -6,11 +6,8 @@ " Last Change: Tue May 6 13:29:56 CEST 2008 " Version: 0.8 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -65,26 +62,17 @@ syn match esterelNone "\<else\s\+if\>$" syn match esterelNone "\<else\s\+if\>\s" " Class Linking -if version >= 508 || !exists("did_esterel_syntax_inits") - if version < 508 - let did_esterel_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink esterelStatement Statement - HiLink esterelType Type - HiLink esterelComment Comment - HiLink esterelBoolean Number - HiLink esterelExpressions Number - HiLink esterelIO String - HiLink esterelOperator Type - HiLink esterelSysCall Type - HiLink esterelFunctions Type - HiLink esterelSpecial Special +hi def link esterelStatement Statement +hi def link esterelType Type +hi def link esterelComment Comment +hi def link esterelBoolean Number +hi def link esterelExpressions Number +hi def link esterelIO String +hi def link esterelOperator Type +hi def link esterelSysCall Type +hi def link esterelFunctions Type +hi def link esterelSpecial Special - delcommand HiLink -endif let b:current_syntax = "esterel" diff --git a/runtime/syntax/eterm.vim b/runtime/syntax/eterm.vim index f6c50a20cb..9b43cb255f 100644 --- a/runtime/syntax/eterm.vim +++ b/runtime/syntax/eterm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: eterm(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-21 +" Language: eterm(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-21 if exists("b:current_syntax") finish diff --git a/runtime/syntax/euphoria3.vim b/runtime/syntax/euphoria3.vim index 1254b96247..ece14027ba 100644 --- a/runtime/syntax/euphoria3.vim +++ b/runtime/syntax/euphoria3.vim @@ -5,10 +5,8 @@ " Remark: Euphoria has two syntax files, euphoria3.vim and euphoria4.vim; " For details see :help ft-euphoria-syntax -" Quit if a (custom) syntax file was already loaded (compatible with Vim 5.8): -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/euphoria4.vim b/runtime/syntax/euphoria4.vim index 53f5cea917..5e668a7d67 100644 --- a/runtime/syntax/euphoria4.vim +++ b/runtime/syntax/euphoria4.vim @@ -5,10 +5,8 @@ " Remark: Euphoria has two syntax files, euphoria3.vim and euphoria4.vim; " For details see :help ft-euphoria-syntax -" Quit if a (custom) syntax file was already loaded (compatible with Vim 5.8): -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/eviews.vim b/runtime/syntax/eviews.vim index aa65fda3ff..03cfb25e60 100644 --- a/runtime/syntax/eviews.vim +++ b/runtime/syntax/eviews.vim @@ -4,19 +4,12 @@ " Last Change: 2006 Apr 30 " Filenames: *.prg " URL: http://uosis.mif.vu.lt/~zemlys/vim-syntax/eviews.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,. -else - set iskeyword=@,48-57,_,. -endif +setlocal iskeyword=@,48-57,_,. syn case match @@ -69,35 +62,25 @@ syn match eCurlyError /[)\]]/ contained syn match eParenError /[\]}]/ contained " 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_r_syn_inits") - if version < 508 - let did_r_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink eComment Comment - HiLink eConstant Identifier - HiLink eStringId Identifier - HiLink eCommand Type - HiLink eString String - HiLink eNumber Number - HiLink eBoolean Boolean - HiLink eFloat Float - HiLink eConditional Conditional - HiLink eProgLang Statement - HiLink eOVP Statement - HiLink eStdCmd Statement - HiLink eIdentifier Normal - HiLink eDelimiter Delimiter - HiLink eError Error - HiLink eBraceError Error - HiLink eCurlyError Error - HiLink eParenError Error - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link eComment Comment +hi def link eConstant Identifier +hi def link eStringId Identifier +hi def link eCommand Type +hi def link eString String +hi def link eNumber Number +hi def link eBoolean Boolean +hi def link eFloat Float +hi def link eConditional Conditional +hi def link eProgLang Statement +hi def link eOVP Statement +hi def link eStdCmd Statement +hi def link eIdentifier Normal +hi def link eDelimiter Delimiter +hi def link eError Error +hi def link eBraceError Error +hi def link eCurlyError Error +hi def link eParenError Error let b:current_syntax="eviews" diff --git a/runtime/syntax/exim.vim b/runtime/syntax/exim.vim index ff8066f8af..4edc0d7948 100644 --- a/runtime/syntax/exim.vim +++ b/runtime/syntax/exim.vim @@ -6,12 +6,9 @@ " URL: http://trific.ath.cx/Ftp/vim/syntax/exim.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case match @@ -91,27 +88,18 @@ syn keyword eximKeyword server_prompts server_condition client_send syn keyword eximKeyword server_secret client_name client_secret " Define the default highlighting -if version >= 508 || !exists("did_exim_syntax_inits") - if version < 508 - let did_exim_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink eximComment Comment - HiLink eximFixme Todo - HiLink eximEnd Keyword - HiLink eximNumber Number - HiLink eximDriverName Constant - HiLink eximConstant Constant - HiLink eximTime Constant - HiLink eximKeyword Type - HiLink eximSpecialChar Special - HiLink eximMacroName Preproc - HiLink eximTransport Identifier +hi def link eximComment Comment +hi def link eximFixme Todo +hi def link eximEnd Keyword +hi def link eximNumber Number +hi def link eximDriverName Constant +hi def link eximConstant Constant +hi def link eximTime Constant +hi def link eximKeyword Type +hi def link eximSpecialChar Special +hi def link eximMacroName Preproc +hi def link eximTransport Identifier - delcommand HiLink -endif let b:current_syntax = "exim" diff --git a/runtime/syntax/expect.vim b/runtime/syntax/expect.vim index 6ff7d4142c..75cbd3eddf 100644 --- a/runtime/syntax/expect.vim +++ b/runtime/syntax/expect.vim @@ -4,11 +4,8 @@ " Last Change: 2012 Jun 01 " (Dominique Pelle added @Spell) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -81,35 +78,25 @@ syn match expectComment "#.*$" contains=@Spell,expectTodo syn match expectSharpBang "\%^#!.*" " 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_expect_syntax_inits") - if version < 508 - let did_expect_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink expectSharpBang PreProc - HiLink expectVariables Special - HiLink expectCommand Function - HiLink expectStatement Statement - HiLink expectConditional Conditional - HiLink expectRepeat Repeat - HiLink expectExpectOpts Keyword - HiLink expectOutVar Special - HiLink expectSpecial Special - HiLink expectNumber Number - - HiLink expectString String - - HiLink expectComment Comment - HiLink expectTodo Todo - "HiLink expectIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link expectSharpBang PreProc +hi def link expectVariables Special +hi def link expectCommand Function +hi def link expectStatement Statement +hi def link expectConditional Conditional +hi def link expectRepeat Repeat +hi def link expectExpectOpts Keyword +hi def link expectOutVar Special +hi def link expectSpecial Special +hi def link expectNumber Number + +hi def link expectString String + +hi def link expectComment Comment +hi def link expectTodo Todo +"hi def link expectIdentifier Identifier + let b:current_syntax = "expect" diff --git a/runtime/syntax/exports.vim b/runtime/syntax/exports.vim index 40b4b8806d..55efbb1e50 100644 --- a/runtime/syntax/exports.vim +++ b/runtime/syntax/exports.vim @@ -1,16 +1,13 @@ " Vim syntax file " Language: exports -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 06, 2005 -" Version: 4 +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 7 " Notes: This file includes both SysV and BSD 'isms -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_EXPORTS -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -39,31 +36,22 @@ syn match exportsSeparator "[,:]" syn match exportsComment "^\s*#.*$" contains=@Spell " 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_exports_syntax_inits") - if version < 508 - let did_exports_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +if !exists("skip_exports_syntax_inits") - HiLink exportsKeyOptSet exportsKeySettings - HiLink exportsOptSet exportsSettings + hi def link exportsKeyOptSet exportsKeySettings + hi def link exportsOptSet exportsSettings - HiLink exportsComment Comment - HiLink exportsKeyOptions Type - HiLink exportsKeySettings Keyword - HiLink exportsOptions Constant - HiLink exportsSeparator Constant - HiLink exportsSettings Constant + hi def link exportsComment Comment + hi def link exportsKeyOptions Type + hi def link exportsKeySettings Keyword + hi def link exportsOptions Constant + hi def link exportsSeparator Constant + hi def link exportsSettings Constant - HiLink exportsOptError Error - HiLink exportsOptSetError Error - HiLink exportsSetError Error + hi def link exportsOptError Error + hi def link exportsOptSetError Error + hi def link exportsSetError Error - delcommand HiLink endif let b:current_syntax = "exports" diff --git a/runtime/syntax/falcon.vim b/runtime/syntax/falcon.vim index 1f6fefa9ff..e022c7a54a 100644 --- a/runtime/syntax/falcon.vim +++ b/runtime/syntax/falcon.vim @@ -163,34 +163,32 @@ syn sync minlines=10 maxlines=100 " Define the default highlighting if !exists("did_falcon_syn_inits") - command -nargs=+ HiLink hi def link <args> - - HiLink falconKeyword Keyword - HiLink falconCommentString String - HiLink falconTodo Todo - HiLink falconConditional Keyword - HiLink falconRepeat Repeat - HiLink falconcommentSkip Comment - HiLink falconComment Comment - HiLink falconCommentL Comment - HiLink falconConst Constant - HiLink falconConstants Constant - HiLink falconOperator Operator - HiLink falconSymbol Normal - HiLink falconSpaceError Error - HiLink falconHexadecimal Number - HiLink falconOctal Number - HiLink falconIntLiteral Number - HiLink falconFloatLiteral Float - HiLink falconStringEscape Special - HiLink falconStringDelimiter Delimiter - HiLink falconString String - HiLink falconBool Constant - HiLink falconSharpBang PreProc - HiLink falconInclude Include - HiLink falconSymbol Constant - HiLink falconSymbolOther Delimiter - delcommand HiLink + + hi def link falconKeyword Keyword + hi def link falconCommentString String + hi def link falconTodo Todo + hi def link falconConditional Keyword + hi def link falconRepeat Repeat + hi def link falconcommentSkip Comment + hi def link falconComment Comment + hi def link falconCommentL Comment + hi def link falconConst Constant + hi def link falconConstants Constant + hi def link falconOperator Operator + hi def link falconSymbol Normal + hi def link falconSpaceError Error + hi def link falconHexadecimal Number + hi def link falconOctal Number + hi def link falconIntLiteral Number + hi def link falconFloatLiteral Float + hi def link falconStringEscape Special + hi def link falconStringDelimiter Delimiter + hi def link falconString String + hi def link falconBool Constant + hi def link falconSharpBang PreProc + hi def link falconInclude Include + hi def link falconSymbol Constant + hi def link falconSymbolOther Delimiter endif let b:current_syntax = "falcon" diff --git a/runtime/syntax/fasm.vim b/runtime/syntax/fasm.vim index 696e05b4ca..172ba7c9b6 100644 --- a/runtime/syntax/fasm.vim +++ b/runtime/syntax/fasm.vim @@ -6,9 +6,8 @@ " FASM Home: http://flatassembler.net/ " FASM Version: 1.56 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/fdcc.vim b/runtime/syntax/fdcc.vim index 38717ebfb8..f7b296b9c6 100644 --- a/runtime/syntax/fdcc.vim +++ b/runtime/syntax/fdcc.vim @@ -4,11 +4,8 @@ " Last Change: 2004 May 16 " Remarks: FDCC (Formal Definitions of Cultural Conventions) see ISO TR 14652 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -58,56 +55,46 @@ syn region fdccBlank matchgroup=fdccLCName start=/^LC_NAME$/ end=/^END LC_NAME$/ syn region fdccBlank matchgroup=fdccLCAddress start=/^LC_ADDRESS$/ end=/^END LC_ADDRESS$/ contains=fdccKeywordAddress,fdccString,fdccComment,fdccNumber -" 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_fdcc_syn_inits") - if version < 508 - let did_fdcc_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink fdccBlank Blank - - HiLink fdccTodo Todo - HiLink fdccComment Comment - HiLink fdccVariable Type - - HiLink fdccLCIdentification Statement - HiLink fdccLCCtype Statement - HiLink fdccLCCollate Statement - HiLink fdccLCMonetary Statement - HiLink fdccLCNumeric Statement - HiLink fdccLCTime Statement - HiLink fdccLCMessages Statement - HiLink fdccLCPaper Statement - HiLink fdccLCTelephone Statement - HiLink fdccLCMeasurement Statement - HiLink fdccLCName Statement - HiLink fdccLCAddress Statement - - HiLink fdccUnicodeInValid Error - HiLink fdccUnicodeValid String - HiLink fdccString String - HiLink fdccNumber Blank - - HiLink fdccKeywordIdentification fdccKeyword - HiLink fdccKeywordCtype fdccKeyword - HiLink fdccKeywordCollate fdccKeyword - HiLink fdccKeywordMonetary fdccKeyword - HiLink fdccKeywordNumeric fdccKeyword - HiLink fdccKeywordTime fdccKeyword - HiLink fdccKeywordMessages fdccKeyword - HiLink fdccKeywordPaper fdccKeyword - HiLink fdccKeywordTelephone fdccKeyword - HiLink fdccKeywordMeasurement fdccKeyword - HiLink fdccKeywordName fdccKeyword - HiLink fdccKeywordAddress fdccKeyword - HiLink fdccKeyword Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link fdccBlank Blank + +hi def link fdccTodo Todo +hi def link fdccComment Comment +hi def link fdccVariable Type + +hi def link fdccLCIdentification Statement +hi def link fdccLCCtype Statement +hi def link fdccLCCollate Statement +hi def link fdccLCMonetary Statement +hi def link fdccLCNumeric Statement +hi def link fdccLCTime Statement +hi def link fdccLCMessages Statement +hi def link fdccLCPaper Statement +hi def link fdccLCTelephone Statement +hi def link fdccLCMeasurement Statement +hi def link fdccLCName Statement +hi def link fdccLCAddress Statement + +hi def link fdccUnicodeInValid Error +hi def link fdccUnicodeValid String +hi def link fdccString String +hi def link fdccNumber Blank + +hi def link fdccKeywordIdentification fdccKeyword +hi def link fdccKeywordCtype fdccKeyword +hi def link fdccKeywordCollate fdccKeyword +hi def link fdccKeywordMonetary fdccKeyword +hi def link fdccKeywordNumeric fdccKeyword +hi def link fdccKeywordTime fdccKeyword +hi def link fdccKeywordMessages fdccKeyword +hi def link fdccKeywordPaper fdccKeyword +hi def link fdccKeywordTelephone fdccKeyword +hi def link fdccKeywordMeasurement fdccKeyword +hi def link fdccKeywordName fdccKeyword +hi def link fdccKeywordAddress fdccKeyword +hi def link fdccKeyword Identifier + let b:current_syntax = "fdcc" diff --git a/runtime/syntax/fetchmail.vim b/runtime/syntax/fetchmail.vim index 89de1ff80d..7a421050d0 100644 --- a/runtime/syntax/fetchmail.vim +++ b/runtime/syntax/fetchmail.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: fetchmail(1) RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: fetchmail(1) RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/fgl.vim b/runtime/syntax/fgl.vim index 1b2fe19a88..1b75d137b6 100644 --- a/runtime/syntax/fgl.vim +++ b/runtime/syntax/fgl.vim @@ -7,11 +7,8 @@ " - Conditionally allow case insensitive keywords (Julian Bridle) " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -119,28 +116,18 @@ syn match fglSpecial "--@" syn sync ccomment fglComment " 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_fgl_syntax_inits") - if version < 508 - let did_fgl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink fglComment Comment - "HiLink fglKeyword fglSpecial - HiLink fglKeyword fglStatement - HiLink fglNumber Number - HiLink fglOperator fglStatement - HiLink fglSpecial Special - HiLink fglStatement Statement - HiLink fglString String - HiLink fglType Type +hi def link fglComment Comment +"hi def link fglKeyword fglSpecial +hi def link fglKeyword fglStatement +hi def link fglNumber Number +hi def link fglOperator fglStatement +hi def link fglSpecial Special +hi def link fglStatement Statement +hi def link fglString String +hi def link fglType Type - delcommand HiLink -endif let b:current_syntax = "fgl" diff --git a/runtime/syntax/flexwiki.vim b/runtime/syntax/flexwiki.vim index 34f893d927..6b15ab2d90 100644 --- a/runtime/syntax/flexwiki.vim +++ b/runtime/syntax/flexwiki.vim @@ -14,10 +14,8 @@ " regexes, which use a different syntax than Vim (fewer \s). " The primary test case is FlexWiki\FormattingRules.wiki -" Quit if syntax file is already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/focexec.vim b/runtime/syntax/focexec.vim index 8be1b65cc4..a75aed47cb 100644 --- a/runtime/syntax/focexec.vim +++ b/runtime/syntax/focexec.vim @@ -11,11 +11,8 @@ " I think some of these things should get different hilights - " should MODIFY commands look different than TABLE? -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -69,32 +66,22 @@ syn match focexecNumber "\<\d\+\.\d*\>" syn match focexecComment "-\*.*" " 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_focexec_syntax_inits") - if version < 508 - let did_focexec_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink focexecString1 String - HiLink focexecString2 String - HiLink focexecNumber Number - HiLink focexecComment Comment - HiLink focexecTable Keyword - HiLink focexecModify Keyword - HiLink focexecNormal Keyword - HiLink focexecSet Keyword - HiLink focexecDash Keyword - HiLink focexecFileDef Keyword - HiLink focexecJoin Keyword - HiLink focexecAmperVar Identifier - HiLink focexecFuse Function +hi def link focexecString1 String +hi def link focexecString2 String +hi def link focexecNumber Number +hi def link focexecComment Comment +hi def link focexecTable Keyword +hi def link focexecModify Keyword +hi def link focexecNormal Keyword +hi def link focexecSet Keyword +hi def link focexecDash Keyword +hi def link focexecFileDef Keyword +hi def link focexecJoin Keyword +hi def link focexecAmperVar Identifier +hi def link focexecFuse Function - delcommand HiLink -endif let b:current_syntax = "focexec" diff --git a/runtime/syntax/form.vim b/runtime/syntax/form.vim index 19a47ed6b9..b8cb87c905 100644 --- a/runtime/syntax/form.vim +++ b/runtime/syntax/form.vim @@ -11,11 +11,8 @@ " This syntax file is still in development. Please send suggestions " to the maintainer. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -109,49 +106,39 @@ syn match formDirective "^\=\.[a-zA-z][a-zA-Z0-9]*\>" syn sync ccomment formComment minlines=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_form_syn_inits") - if version < 508 - let did_form_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink formConditional Conditional - HiLink formNumber Number - HiLink formStatement Statement - HiLink formComment Comment - HiLink formPreProc PreProc - HiLink formDirective PreProc - HiLink formType Type - HiLink formString String - HiLink formNestedString String - HiLink formReserved Error - HiLink formTodo Todo - HiLink formSpecial SpecialChar - - if !exists("form_enhanced_color") - HiLink formHeaderStatement Statement - else - " enhanced color mode - HiLink formHeaderStatement HeaderStatement - " dark and a light background for local types - if &background == "dark" - hi HeaderStatement term=underline ctermfg=LightGreen guifg=LightGreen gui=bold - else - hi HeaderStatement term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold - endif - " change slightly the default for dark gvim - if has("gui_running") && &background == "dark" - hi Conditional guifg=LightBlue gui=bold - hi Statement guifg=LightYellow - endif - endif - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link formConditional Conditional +hi def link formNumber Number +hi def link formStatement Statement +hi def link formComment Comment +hi def link formPreProc PreProc +hi def link formDirective PreProc +hi def link formType Type +hi def link formString String +hi def link formNestedString String +hi def link formReserved Error +hi def link formTodo Todo +hi def link formSpecial SpecialChar + +if !exists("form_enhanced_color") +hi def link formHeaderStatement Statement +else +" enhanced color mode +hi def link formHeaderStatement HeaderStatement +" dark and a light background for local types +if &background == "dark" +hi HeaderStatement term=underline ctermfg=LightGreen guifg=LightGreen gui=bold +else +hi HeaderStatement term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold endif +" change slightly the default for dark gvim +if has("gui_running") && &background == "dark" +hi Conditional guifg=LightBlue gui=bold +hi Statement guifg=LightYellow +endif +endif + let b:current_syntax = "form" diff --git a/runtime/syntax/forth.vim b/runtime/syntax/forth.vim index 99e9400b95..a1912461e6 100644 --- a/runtime/syntax/forth.vim +++ b/runtime/syntax/forth.vim @@ -1,90 +1,13 @@ " Vim syntax file " Language: FORTH -" Maintainer: Christian V. J. Brssow <cvjb@cvjb.de> -" Last Change: So 27 Mai 2012 15:56:28 CEST +" Current Maintainer: Johan Kotlinski <kotlinski@gmail.com> +" Previous Maintainer: Christian V. J. Brssow <cvjb@cvjb.de> +" Last Change: 2018-03-29 " Filenames: *.fs,*.ft -" URL: http://www.cvjb.de/comp/vim/forth.vim - -" $Id: forth.vim,v 1.14 2012/05/27 15:57:22 bruessow Exp $ - -" The list of keywords is incomplete, compared with the official ANS -" wordlist. If you use this language, please improve it, and send me -" the patches. -" -" Before sending me patches, please download the newest version of this file -" from http://www.cvjb.de/comp/vim/forth.vim or http://www.vim.org/ (search -" for forth.vim). - -" Many Thanks to... -" -" 2012-05-13: -" Dominique Pell <dominique dot pelle at gmail dot com> for sending the -" patch to allow spellchecking of strings, comments, ... -" -" 2012-01-07: -" Thilo Six <T.Six at gmx dot de> send a patch for cpoptions. -" See the discussion at http://thread.gmane.org/gmane.editors.vim.devel/32151 -" -" 2009-06-28: -" Josh Grams send a patch to allow the parenthesis comments at the -" beginning of a line. That patch also fixed a typo in one of the -" comments. -" -" 2008-02-09: -" Shawn K. Quinn <sjquinn at speakeasy dot net> send a big patch with -" new words commonly used in Forth programs or defined by GNU Forth. -" -" 2007-07-11: -" Benjamin Krill <ben at codiert dot org> send me a patch -" to highlight space errors. -" You can toggle this feature on through setting the -" flag forth_space_errors in you vimrc. If you have switched it on, -" you can turn off highlighting of trailing spaces in comments by -" setting forth_no_trail_space_error in your vimrc. If you do not want -" the highlighting of a tabulator following a space in comments, you -" can turn this off by setting forth_no_tab_space_error. -" -" 2006-05-25: -" Bill McCarthy <WJMc@...> and Ilya Sher <ilya-vim@...> -" Who found a bug in the ccomment line in 2004!!! -" I'm really very sorry, that it has taken two years to fix that -" in the official version of this file. Shame on me. -" I think my face will be red the next ten years... -" -" 2006-05-21: -" Thomas E. Vaughan <tevaugha at ball dot com> send me a patch -" for the parenthesis comment word, so words with a trailing -" parenthesis will not start the highlighting for such comments. -" -" 2003-05-10: -" Andrew Gaul <andrew at gaul.org> send me a patch for -" forthOperators. -" -" 2003-04-03: -" Ron Aaron <ron at ronware dot org> made updates for an -" improved Win32Forth support. -" -" 2002-04-22: -" Charles Shattuck <charley at forth dot org> helped me to settle up with the -" binary and hex number highlighting. -" -" 2002-04-20: -" Charles Shattuck <charley at forth dot org> send me some code for correctly -" highlighting char and [char] followed by an opening paren. He also added -" some words for operators, conditionals, and definitions; and added the -" highlighting for s" and c". -" -" 2000-03-28: -" John Providenza <john at probo dot com> made improvements for the -" highlighting of strings, and added the code for highlighting hex numbers. -" - - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" URL: https://github.com/jkotlinski/forth.vim + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -104,11 +27,7 @@ syn match forthTodo contained 'Copyright\(\s([Cc])\)\=\(\s[0-9]\{2,4}\)\=' " Characters allowed in keywords " I don't know if 128-255 are allowed in ANS-FORTH -if version >= 600 - setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 -else - set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 -endif +setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 " when wanted, highlight trailing white space if exists("forth_space_errors") @@ -136,7 +55,10 @@ syn keyword forthOperators F~REL F~ABS F~ syn keyword forthOperators 0< 0<= 0<> 0= 0> 0>= < <= <> = > >= U< U<= syn keyword forthOperators U> U>= D0< D0<= D0<> D0= D0> D0>= D< D<= D<> syn keyword forthOperators D= D> D>= DU< DU<= DU> DU>= WITHIN ?NEGATE -syn keyword forthOperators ?DNEGATE +syn keyword forthOperators ?DNEGATE TRUE FALSE + +" various words that take an input and do something with it +syn keyword forthFunction . U. .R U.R " stack manipulations syn keyword forthStack DROP NIP DUP OVER TUCK SWAP ROT -ROT ?DUP PICK ROLL @@ -148,7 +70,7 @@ syn keyword forthRstack 4>R 4R> 4R@ 4RDROP syn keyword forthFStack FDROP FNIP FDUP FOVER FTUCK FSWAP FROT " stack pointer manipulations -syn keyword forthSP SP@ SP! FP@ FP! RP@ RP! LP@ LP! +syn keyword forthSP SP@ SP! FP@ FP! RP@ RP! LP@ LP! DEPTH " address operations syn keyword forthMemory @ ! +! C@ C! 2@ 2! F@ F! SF@ SF! DF@ DF! @@ -157,7 +79,7 @@ syn keyword forthAdrArith FLOAT+ FLOAT FALIGN FALIGNED SFLOATS SFLOAT+ syn keyword forthAdrArith SFALIGN SFALIGNED DFLOATS DFLOAT+ DFALIGN DFALIGNED syn keyword forthAdrArith MAXALIGN MAXALIGNED CFALIGN CFALIGNED syn keyword forthAdrArith ADDRESS-UNIT-BITS ALLOT ALLOCATE HERE -syn keyword forthMemBlks MOVE ERASE CMOVE CMOVE> FILL BLANK +syn keyword forthMemBlks MOVE ERASE CMOVE CMOVE> FILL BLANK UNUSED " conditionals syn keyword forthCond IF ELSE ENDIF THEN CASE OF ENDOF ENDCASE ?DUP-IF @@ -166,7 +88,7 @@ syn keyword forthCond ?DUP-0=-IF AHEAD CS-PICK CS-ROLL CATCH THROW WITHIN " iterations syn keyword forthLoop BEGIN WHILE REPEAT UNTIL AGAIN syn keyword forthLoop ?DO LOOP I J K +DO U+DO -DO U-DO DO +LOOP -LOOP -syn keyword forthLoop UNLOOP LEAVE ?LEAVE EXIT DONE FOR NEXT +syn keyword forthLoop UNLOOP LEAVE ?LEAVE EXIT DONE FOR NEXT RECURSE " new words syn match forthClassDef '\<:class\s*[^ \t]\+\>' @@ -181,8 +103,8 @@ syn keyword forthDefine COMPILE-ONLY COMPILE RESTRICT INTERPRET POSTPONE EXECUTE syn keyword forthDefine LITERAL CREATE-INTERPRET/COMPILE INTERPRETATION> syn keyword forthDefine <INTERPRETATION COMPILATION> <COMPILATION ] LASTXT syn keyword forthDefine COMP' POSTPONE, FIND-NAME NAME>INT NAME?INT NAME>COMP -syn keyword forthDefine NAME>STRING STATE C; CVARIABLE -syn keyword forthDefine , 2, F, C, +syn keyword forthDefine NAME>STRING STATE C; CVARIABLE BUFFER: MARKER +syn keyword forthDefine , 2, F, C, COMPILE, syn match forthDefine "\[IFDEF]" syn match forthDefine "\[IFUNDEF]" syn match forthDefine "\[THEN]" @@ -203,6 +125,7 @@ syn match forthDefine "'" syn match forthDefine '\<\[\>' syn match forthDefine "\[']" syn match forthDefine '\[COMPILE]' +syn match forthDefine '\[CHAR]' " debugging syn keyword forthDebug PRINTDEBUGDATA PRINTDEBUGLINE @@ -213,7 +136,7 @@ syn keyword forthAssembler ASSEMBLER CODE END-CODE ;CODE FLUSH-ICACHE C, " basic character operations syn keyword forthCharOps (.) CHAR EXPECT FIND WORD TYPE -TRAILING EMIT KEY -syn keyword forthCharOps KEY? TIB CR +syn keyword forthCharOps KEY? TIB CR BL COUNT SPACE SPACES " recognize 'char (' or '[char] (' correctly, so it doesn't " highlight everything after the paren as a comment till a closing ')' syn match forthCharOps '\<char\s\S\s' @@ -223,12 +146,15 @@ syn region forthCharOps start=+."\s+ skip=+\\"+ end=+"+ " char-number conversion syn keyword forthConversion <<# <# # #> #>> #S (NUMBER) (NUMBER?) CONVERT D>F syn keyword forthConversion D>S DIGIT DPL F>D HLD HOLD NUMBER S>D SIGN >NUMBER -syn keyword forthConversion F>S S>F +syn keyword forthConversion F>S S>F HOLDS " interpreter, wordbook, compiler syn keyword forthForth (LOCAL) BYE COLD ABORT >BODY >NEXT >LINK CFA >VIEW HERE syn keyword forthForth PAD WORDS VIEW VIEW> N>LINK NAME> LINK> L>NAME FORGET syn keyword forthForth BODY> ASSERT( ASSERT0( ASSERT1( ASSERT2( ASSERT3( ) +syn keyword forthForth >IN ACCEPT ENVIRONMENT? EVALUATE QUIT SOURCE ACTION-OF +syn keyword forthForth DEFER! DEFER@ PARSE PARSE-NAME REFILL RESTORE-INPUT +syn keyword forthForth SAVE-INPUT SOURCE-ID syn region forthForth start=+ABORT"\s+ skip=+\\"+ end=+"+ " vocabularies @@ -243,16 +169,17 @@ syn keyword forthFileWords KEY?-FILE WRITE-FILE WRITE-LINE EMIT-FILE syn keyword forthFileWords FLUSH-FILE FILE-STATUS FILE-POSITION syn keyword forthFileWords REPOSITION-FILE FILE-SIZE RESIZE-FILE syn keyword forthFileWords SLURP-FILE SLURP-FID STDIN STDOUT STDERR +syn keyword forthFileWords INCLUDE-FILE INCLUDED REQUIRED syn keyword forthBlocks OPEN-BLOCKS USE LOAD --> BLOCK-OFFSET syn keyword forthBlocks GET-BLOCK-FID BLOCK-POSITION LIST SCR BLOCK syn keyword forthBlocks BUFER EMPTY-BUFFERS EMPTY-BUFFER UPDATE UPDATED? syn keyword forthBlocks SAVE-BUFFERS SAVE-BUFFER FLUSH THRU +LOAD +THRU -syn keyword forthBlocks BLOCK-INCLUDED +syn keyword forthBlocks BLOCK-INCLUDED BLK " numbers syn keyword forthMath DECIMAL HEX BASE -syn match forthInteger '\<-\=[0-9.]*[0-9.]\+\>' -syn match forthInteger '\<&-\=[0-9.]*[0-9.]\+\>' +syn match forthInteger '\<-\=[0-9]\+.\=\>' +syn match forthInteger '\<&-\=[0-9]\+.\=\>' " recognize hex and binary numbers, the '$' and '%' notation is for gforth syn match forthInteger '\<\$\x*\x\+\>' " *1* --- dont't mess syn match forthInteger '\<\x*\d\x*\>' " *2* --- this order! @@ -260,28 +187,29 @@ syn match forthInteger '\<%[0-1]*[0-1]\+\>' syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe]\d\+\>' syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe][-+]\d\+\>' -" XXX If you find this overkill you can remove it. This has to come after the +" XXX If you find this overkill you can remove it. this has to come after the " highlighting for numbers otherwise it has no effect. syn region forthComment start='0 \[if\]' end='\[endif\]' end='\[then\]' contains=forthTodo " Strings -syn region forthString start=+\.*\"+ end=+"+ end=+$+ contains=@Spell +syn region forthString start=+\.*\"+ end=+"+ end=+$+ " XXX -syn region forthString start=+s\"+ end=+"+ end=+$+ contains=@Spell -syn region forthString start=+c\"+ end=+"+ end=+$+ contains=@Spell +syn region forthString start=+s\"+ end=+"+ end=+$+ +syn region forthString start=+s\\\"+ end=+"+ end=+$+ +syn region forthString start=+c\"+ end=+"+ end=+$+ " Comments -syn match forthComment '\\\s.*$' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='\\S\s' end='.*' contains=@Spell,forthTodo,forthSpaceError -syn match forthComment '\.(\s[^)]*)' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='\(^\|\s\)\zs(\s' skip='\\)' end=')' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='/\*' end='\*/' contains=@Spell,forthTodo,forthSpaceError +syn match forthComment '\\\s.*$' contains=forthTodo,forthSpaceError +syn region forthComment start='\\S\s' end='.*' contains=forthTodo,forthSpaceError +syn match forthComment '\.(\s[^)]*)' contains=forthTodo,forthSpaceError +syn region forthComment start='\(^\|\s\)\zs(\s' skip='\\)' end=')' contains=forthTodo,forthSpaceError +syn region forthComment start='/\*' end='\*/' contains=forthTodo,forthSpaceError " Include files syn match forthInclude '^INCLUDE\s\+\k\+' -syn match forthInclude '^require\s\+\k\+' -syn match forthInclude '^fload\s\+' -syn match forthInclude '^needs\s\+' +syn match forthInclude '^REQUIRE\s\+\k\+' +syn match forthInclude '^FLOAD\s\+' +syn match forthInclude '^NEEDS\s\+' " Locals definitions syn region forthLocals start='{\s' start='{$' end='\s}' end='^}' @@ -289,56 +217,43 @@ syn match forthLocals '{ }' " otherwise, at least two spaces between syn region forthDeprecated start='locals|' end='|' " 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_forth_syn_inits") - if version < 508 - let did_forth_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later. - HiLink forthTodo Todo - HiLink forthOperators Operator - HiLink forthMath Number - HiLink forthInteger Number - HiLink forthFloat Float - HiLink forthStack Special - HiLink forthRstack Special - HiLink forthFStack Special - HiLink forthSP Special - HiLink forthMemory Function - HiLink forthAdrArith Function - HiLink forthMemBlks Function - HiLink forthCond Conditional - HiLink forthLoop Repeat - HiLink forthColonDef Define - HiLink forthEndOfColonDef Define - HiLink forthDefine Define - HiLink forthDebug Debug - HiLink forthAssembler Include - HiLink forthCharOps Character - HiLink forthConversion String - HiLink forthForth Statement - HiLink forthVocs Statement - HiLink forthString String - HiLink forthComment Comment - HiLink forthClassDef Define - HiLink forthEndOfClassDef Define - HiLink forthObjectDef Define - HiLink forthEndOfObjectDef Define - HiLink forthInclude Include - HiLink forthLocals Type " nothing else uses type and locals must stand out - HiLink forthDeprecated Error " if you must, change to Type - HiLink forthFileMode Function - HiLink forthFileWords Statement - HiLink forthBlocks Statement - HiLink forthSpaceError Error - - delcommand HiLink -endif +hi def link forthTodo Todo +hi def link forthOperators Operator +hi def link forthMath Number +hi def link forthInteger Number +hi def link forthFloat Float +hi def link forthStack Special +hi def link forthRstack Special +hi def link forthFStack Special +hi def link forthSP Special +hi def link forthMemory Function +hi def link forthAdrArith Function +hi def link forthMemBlks Function +hi def link forthCond Conditional +hi def link forthLoop Repeat +hi def link forthColonDef Define +hi def link forthEndOfColonDef Define +hi def link forthDefine Define +hi def link forthDebug Debug +hi def link forthAssembler Include +hi def link forthCharOps Character +hi def link forthConversion String +hi def link forthForth Statement +hi def link forthVocs Statement +hi def link forthString String +hi def link forthComment Comment +hi def link forthClassDef Define +hi def link forthEndOfClassDef Define +hi def link forthObjectDef Define +hi def link forthEndOfObjectDef Define +hi def link forthInclude Include +hi def link forthLocals Type " nothing else uses type and locals must stand out +hi def link forthDeprecated Error " if you must, change to Type +hi def link forthFileMode Function +hi def link forthFunction Function +hi def link forthFileWords Statement +hi def link forthBlocks Statement +hi def link forthSpaceError Error let b:current_syntax = "forth" diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index df33793bb2..4c26e78f16 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,15 +1,17 @@ " Vim syntax file -" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77) -" Version: 0.94 -" Last Change: 2012 June 18 -" Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/> +" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) +" Version: 100 +" Last Change: 2016 Oct. 29 +" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> " Usage: For instructions, do :help fortran-syntax from Vim " Credits: -" Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and -" Preben Guldberg. Useful suggestions were made by: Andrej Panjkov, -" Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, +" Version 0.1 (April 2000) for Fortran 95 was based on the Fortran 77 syntax file by +" Mario Eusebio and Preben Guldberg. Since then, useful suggestions and contributions +" have been made, in chronological order, by: +" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, " Walter Dieudonn, Alexander Wagner, Roman Bertle, Charles Rendleman, -" Andrew Griffiths, Joe Krahn, and Hendrik Merx. +" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann, +" Stefano Zaghi, Vishnu V. Krishnan and Judical Grasset if exists("b:current_syntax") finish @@ -19,8 +21,8 @@ let s:cpo_save = &cpo set cpo&vim " Choose fortran_dialect using the priority: -" source file directive > buffer-local value > global value > default -" try using directive in first three lines of file +" source file directive > buffer-local value > global value > file extension +" first try using directive in first three lines of file let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3) if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>' let b:fortran_dialect = "F" @@ -51,6 +53,12 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form for all fortran files let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else " Modern fortran still allows both free and fixed source form. " Assume fixed source form unless signs of free source form @@ -67,8 +75,8 @@ if !exists("b:fortran_fixed_source") while s:ln <= s:lmax let s:test = strpart(getline(s:ln),0,5) if s:test !~ '^[Cc*]' && s:test !~ '^ *[!#]' && s:test =~ '[^ 0-9\t]' && s:test !~ '^[ 0-9]*\t' - let b:fortran_fixed_source = 0 - break + let b:fortran_fixed_source = 0 + break endif let s:ln = s:ln + 1 endwhile @@ -101,6 +109,7 @@ syn match fortranUnitHeader "\<subroutine\>" syn keyword fortranCall call syn match fortranUnitHeader "\<function\>" syn match fortranUnitHeader "\<program\>" +syn match fortranUnitHeader "\<block\>" syn keyword fortranKeyword return stop syn keyword fortranConditional else then syn match fortranConditional "\<if\>" @@ -201,6 +210,7 @@ syn match fortranStorageClass "\<kind\s*="me=s+4 syn match fortranStorageClass "\<len\s*="me=s+3 syn match fortranUnitHeader "\<module\>" +syn match fortranUnitHeader "\<submodule\>" syn keyword fortranUnitHeader use only contains syn keyword fortranUnitHeader result operator assignment syn match fortranUnitHeader "\<interface\>" @@ -224,8 +234,10 @@ syn match fortranIntrinsic "\<kind\>\s*[(,]"me=s+4 syn match fortranUnitHeader "\<end\s*function" syn match fortranUnitHeader "\<end\s*interface" syn match fortranUnitHeader "\<end\s*module" +syn match fortranUnitHeader "\<end\s*submodule" syn match fortranUnitHeader "\<end\s*program" syn match fortranUnitHeader "\<end\s*subroutine" +syn match fortranUnitHeader "\<end\s*block" syn match fortranRepeat "\<end\s*do" syn match fortranConditional "\<end\s*where" syn match fortranConditional "\<select\s*case" @@ -260,6 +272,7 @@ syn match fortranRepeat "\<end\s*forall" syn keyword fortranIntrinsic null cpu_time syn match fortranType "\<elemental\>" syn match fortranType "\<pure\>" +syn match fortranType "\<impure\>" if exists("fortran_more_precise") syn match fortranConstructName "\(\<end\s*forall\s\+\)\@<=\a\w*\>" endif @@ -279,8 +292,9 @@ if b:fortran_dialect == "f08" syn keyword fortranReadWrite flush wait syn keyword fortranIO decimal round iomsg - syn keyword fortranType asynchronous nopass non_overridable pass protected volatile abstract extends import + syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import syn keyword fortranType non_intrinsic value bind deferred generic final enumerator + syn match fortranType "\<abstract\>" syn match fortranType "\<class\>" syn match fortranType "\<associate\>" syn match fortranType "\<end\s*associate" @@ -298,6 +312,42 @@ if b:fortran_dialect == "f08" syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image syn keyword fortranIO newunit syn keyword fortranType contiguous + syn keyword fortranRepeat concurrent + +" CUDA fortran + syn match fortranTypeCUDA "\<attributes\>" + syn keyword fortranTypeCUDA host global device value + syn keyword fortranTypeCUDA shared constant pinned texture + syn keyword fortranTypeCUDA dim1 dim2 dim3 dim4 + syn keyword fortranTypeCUDA cudadeviceprop cuda_count_kind cuda_stream_kind + syn keyword fortranTypeCUDA cudaEvent cudaFuncAttributes cudaArrayPtr + syn keyword fortranTypeCUDA cudaSymbol cudaChannelFormatDesc cudaPitchedPtr + syn keyword fortranTypeCUDA cudaExtent cudaMemcpy3DParms + syn keyword fortranTypeCUDA cudaFuncCachePreferNone cudaFuncCachePreferShared + syn keyword fortranTypeCUDA cudaFuncCachePreferL1 cudaLimitStackSize + syn keyword fortranTypeCUDA cudaLimitPrintfSize cudaLimitMallocHeapSize + syn keyword fortranTypeCUDA cudaSharedMemBankSizeDefault cudaSharedMemBankSizeFourByte cudaSharedMemBankSizeEightByte + syn keyword fortranTypeCUDA cudaEventDefault cudaEventBlockingSync cudaEventDisableTiming + syn keyword fortranTypeCUDA cudaMemcpyHostToDevice cudaMemcpyDeviceToHost + syn keyword fortranTypeCUDA cudaMemcpyDeviceToDevice + syn keyword fortranTypeCUDA cudaErrorNotReady cudaSuccess cudaErrorInvalidValue + syn keyword fortranTypeCUDA c_devptr + + syn match fortranStringCUDA "blockidx%[xyz]" + syn match fortranStringCUDA "blockdim%[xyz]" + syn match fortranStringCUDA "griddim%[xyz]" + syn match fortranStringCUDA "threadidx%[xyz]" + + syn keyword fortranIntrinsicCUDA warpsize syncthreads syncthreads_and syncthreads_count syncthreads_or threadfence threadfence_block threadfence_system gpu_time allthreads anythread ballot + syn keyword fortranIntrinsicCUDA atomicadd atomicsub atomicmax atomicmin atomicand atomicor atomicxor atomicexch atomicinc atomicdec atomiccas sizeof __shfl __shfl_up __shfl_down __shfl_xor + syn keyword fortranIntrinsicCUDA cudaChooseDevice cudaDeviceGetCacheConfig cudaDeviceGetLimit cudaDeviceGetSharedMemConfig cudaDeviceReset cudaDeviceSetCacheConfig cudaDeviceSetLimit cudaDeviceSetSharedMemConfig cudaDeviceSynchronize cudaGetDevice cudaGetDeviceCount cudaGetDeviceProperties cudaSetDevice cudaSetDeviceFlags cudaSetValidDevices + syn keyword fortranIntrinsicCUDA cudaThreadExit cudaThreadSynchronize cudaGetLastError cudaGetErrorString cudaPeekAtLastError cudaStreamCreate cudaStreamDestroy cudaStreamQuery cudaStreamSynchronize cudaStreamWaitEvent cudaEventCreate cudaEventCreateWithFlags cudaEventDestroy cudaEventElapsedTime cudaEventQuery cudaEventRecord cudaEventSynchronize + syn keyword fortranIntrinsicCUDA cudaFuncGetAttributes cudaFuncSetCacheConfig cudaFuncSetSharedMemConfig cudaSetDoubleForDevice cudaSetDoubleForHost cudaFree cudaFreeArray cudaFreeHost cudaGetSymbolAddress cudaGetSymbolSize + syn keyword fortranIntrinsicCUDA cudaHostAlloc cudaHostGetDevicePointer cudaHostGetFlags cudaHostRegister cudaHostUnregister cudaMalloc cudaMallocArray cudaMallocHost cudaMallocPitch cudaMalloc3D cudaMalloc3DArray + syn keyword fortranIntrinsicCUDA cudaMemcpy cudaMemcpyArraytoArray cudaMemcpyAsync cudaMemcpyFromArray cudaMemcpyFromSymbol cudaMemcpyFromSymbolAsync cudaMemcpyPeer cudaMemcpyPeerAsync cudaMemcpyToArray cudaMemcpyToSymbol cudaMemcpyToSymbolAsync cudaMemcpy2D cudaMemcpy2DArrayToArray cudaMemcpy2DAsync cudaMemcpy2DFromArray cudaMemcpy2DToArray cudaMemcpy3D cudaMemcpy3DAsync + syn keyword fortranIntrinsicCUDA cudaMemGetInfo cudaMemset cudaMemset2D cudaMemset3D cudaDeviceCanAccessPeer cudaDeviceDisablePeerAccess cudaDeviceEnablePeerAccess cudaPointerGetAttributes cudaDriverGetVersion cudaRuntimeGetVersion + + syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none endif syn cluster fortranCommentGroup contains=fortranTodo @@ -318,6 +368,7 @@ else endif syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell +syn match fortranOpenMP excludenl "^\s*!\$\(OMP\)\=&\=\s.*$" "cpp is often used with Fortran syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*" @@ -341,20 +392,24 @@ if exists("fortran_fold") if (b:fortran_fixed_source == 1) syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule + syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram - syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock - syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock - syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction + syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface else syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule + syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram - syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock - syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock - syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\s*[!#].*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction + syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface endif if exists("fortran_fold_conditionals") @@ -362,12 +417,12 @@ if exists("fortran_fold") syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData - syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData + syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData else syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData - syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData - syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData + syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData + syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData endif endif @@ -453,6 +508,11 @@ else hi! def link fortranConditionalR fortranConditional endif +" CUDA +hi def link fortranIntrinsicCUDA fortranIntrinsic +hi def link fortranTypeCUDA fortranType +hi def link fortranStringCUDA fortranString + hi def link fortranFormatSpec Identifier hi def link fortranFloat Float hi def link fortranPreCondit PreCondit @@ -460,6 +520,7 @@ hi def link cIncluded fortranString hi def link cInclude Include hi def link cPreProc PreProc hi def link cPreCondit PreCondit +hi def link fortranOpenMP PreProc hi def link fortranParenError Error hi def link fortranComment Comment hi def link fortranSerialNumber Todo diff --git a/runtime/syntax/foxpro.vim b/runtime/syntax/foxpro.vim index ca5d7e2f9d..795859eac9 100644 --- a/runtime/syntax/foxpro.vim +++ b/runtime/syntax/foxpro.vim @@ -13,9 +13,8 @@ " corrected highlighting of comments at end of line (&&) " " -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -691,37 +690,27 @@ syn match foxproParenErr ")" syn sync minlines=1 maxlines=3 " 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_foxpro_syn_inits") - if version < 508 - let did_foxpro_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink foxproSpecial Special - HiLink foxproAtSymbol Special - HiLink foxproAtCmd Statement - HiLink foxproPreProc PreProc - HiLink foxproFunc Identifier - HiLink foxproCmd Statement - HiLink foxproEnBlk Type - HiLink foxproSysVar String - HiLink foxproString String - HiLink foxproConst Constant - HiLink foxproNumber Number - HiLink foxproFloat Float - HiLink foxproComment Comment - HiLink foxproParenErr Error - HiLink foxproCBConst PreProc - HiLink foxproCBField Special - HiLink foxproCBVar Identifier - HiLink foxproCBWin Special - HiLink foxproCBObject Identifier +hi def link foxproSpecial Special +hi def link foxproAtSymbol Special +hi def link foxproAtCmd Statement +hi def link foxproPreProc PreProc +hi def link foxproFunc Identifier +hi def link foxproCmd Statement +hi def link foxproEnBlk Type +hi def link foxproSysVar String +hi def link foxproString String +hi def link foxproConst Constant +hi def link foxproNumber Number +hi def link foxproFloat Float +hi def link foxproComment Comment +hi def link foxproParenErr Error +hi def link foxproCBConst PreProc +hi def link foxproCBField Special +hi def link foxproCBVar Identifier +hi def link foxproCBWin Special +hi def link foxproCBObject Identifier - delcommand HiLink -endif let b:current_syntax = "foxpro" diff --git a/runtime/syntax/framescript.vim b/runtime/syntax/framescript.vim index 39d75e8826..8b16d048a0 100644 --- a/runtime/syntax/framescript.vim +++ b/runtime/syntax/framescript.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: FrameScript v4.0 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-02-22 +" Language: FrameScript v4.0 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-02-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/fstab.vim b/runtime/syntax/fstab.vim index 3006d21fea..56237c0770 100644 --- a/runtime/syntax/fstab.vim +++ b/runtime/syntax/fstab.vim @@ -2,8 +2,8 @@ " Language: fstab file " Maintainer: Radu Dineiu <radu.dineiu@gmail.com> " URL: https://raw.github.com/rid9/vim-fstab/master/fstab.vim -" Last Change: 2013 May 21 -" Version: 1.0 +" Last Change: 2017 Nov 09 +" Version: 1.2 " " Credits: " David Necas (Yeti) <yeti@physics.muni.cz> @@ -19,9 +19,8 @@ " let fstab_unknown_device_errors = 0 " do not highlight unknown devices as errors -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -39,10 +38,14 @@ syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts devtmpfs sysfs usbfs syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID +syn keyword fsDeviceKeyword contained PARTLABEL nextgroup=fsDevicePARTLABEL +syn keyword fsDeviceKeyword contained PARTUUID nextgroup=fsDevicePARTUUID syn keyword fsDeviceKeyword contained sshfs nextgroup=fsDeviceSshfs syn match fsDeviceKeyword contained /^[a-zA-Z0-9.\-]\+\ze:/ syn match fsDeviceLabel contained /=[^ \t]\+/hs=s+1 contains=fsOperator syn match fsDeviceUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator +syn match fsDevicePARTLABEL contained /=[^ \t]\+/hs=s+1 contains=fsOperator +syn match fsDevicePARTUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator syn match fsDeviceSshfs contained /#[_=[:alnum:]\.\/+-]\+@[a-z0-9._-]\+\a\{2}:[^ \t]\+/hs=s+1 contains=fsOperator " Mount Point @@ -65,7 +68,7 @@ syn match fsOptionsString /[a-zA-Z0-9_-]\+/ syn keyword fsOptionsYesNo yes no syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck syn keyword fsOptionsSize 512 1024 2048 -syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand nosuid nosymfollow nouser owner rbind rdonly remount ro rq rw suid suiddir supermount sw sync union update user users xx +syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx syn match fsOptionsGeneral /_netdev/ " Options: adfs @@ -138,7 +141,7 @@ syn match fsOptionsKeywords contained /\<\%(dir\|file\|\)_umask=/ nextgroup=fsOp syn match fsOptionsKeywords contained /\<\%(session\|part\)=/ nextgroup=fsOptionsNumber " Options: ffs -syn keyword fsOptionsKeyWords contained softdep +syn keyword fsOptionsKeyWords contained noperm softdep " Options: hpfs syn match fsOptionsKeywords contained /\<case=/ nextgroup=fsOptionsHpfsCase @@ -229,66 +232,57 @@ syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster " Whole line comments syn match fsCommentLine /^#.*$/ contains=@Spell -if version >= 508 || !exists("did_config_syntax_inits") - if version < 508 - let did_config_syntax_inits = 1 - command! -nargs=+ HiLink hi link <args> - else - command! -nargs=+ HiLink hi def link <args> - endif - - HiLink fsOperator Operator - HiLink fsComment Comment - HiLink fsCommentLine Comment - - HiLink fsTypeKeyword Type - HiLink fsDeviceKeyword Identifier - HiLink fsDeviceLabel String - HiLink fsDeviceUUID String - HiLink fsDeviceSshfs String - HiLink fsFreqPassNumber Number - - if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1 - HiLink fsTypeUnknown Error - endif - - if !exists('fstab_unknown_device_errors') || fstab_unknown_device_errors == 1 - HiLink fsDeviceError Error - endif - - HiLink fsMountPointError Error - HiLink fsMountPointKeyword Keyword - HiLink fsFreqPassError Error - - HiLink fsOptionsGeneral Type - HiLink fsOptionsKeywords Keyword - HiLink fsOptionsNumber Number - HiLink fsOptionsNumberOctal Number - HiLink fsOptionsString String - HiLink fsOptionsSize Number - HiLink fsOptionsExt2Check String - HiLink fsOptionsExt2Errors String - HiLink fsOptionsExt3Journal String - HiLink fsOptionsExt3Data String - HiLink fsOptionsExt4Journal String - HiLink fsOptionsExt4Data String - HiLink fsOptionsExt4Barrier Number - HiLink fsOptionsFatCheck String - HiLink fsOptionsConv String - HiLink fsOptionsFatType Number - HiLink fsOptionsYesNo String - HiLink fsOptionsHpfsCase String - HiLink fsOptionsIsoMap String - HiLink fsOptionsReiserHash String - HiLink fsOptionsSshYesNoAsk String - HiLink fsOptionsUfsType String - HiLink fsOptionsUfsError String - - HiLink fsOptionsVfatShortname String - - delcommand HiLink +hi def link fsOperator Operator +hi def link fsComment Comment +hi def link fsCommentLine Comment + +hi def link fsTypeKeyword Type +hi def link fsDeviceKeyword Identifier +hi def link fsDeviceLabel String +hi def link fsDeviceUUID String +hi def link fsDevicePARTLABEL String +hi def link fsDevicePARTUUID String +hi def link fsDeviceSshfs String +hi def link fsFreqPassNumber Number + +if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1 + hi def link fsTypeUnknown Error endif +if !exists('fstab_unknown_device_errors') || fstab_unknown_device_errors == 1 + hi def link fsDeviceError Error +endif + +hi def link fsMountPointError Error +hi def link fsMountPointKeyword Keyword +hi def link fsFreqPassError Error + +hi def link fsOptionsGeneral Type +hi def link fsOptionsKeywords Keyword +hi def link fsOptionsNumber Number +hi def link fsOptionsNumberOctal Number +hi def link fsOptionsString String +hi def link fsOptionsSize Number +hi def link fsOptionsExt2Check String +hi def link fsOptionsExt2Errors String +hi def link fsOptionsExt3Journal String +hi def link fsOptionsExt3Data String +hi def link fsOptionsExt4Journal String +hi def link fsOptionsExt4Data String +hi def link fsOptionsExt4Barrier Number +hi def link fsOptionsFatCheck String +hi def link fsOptionsConv String +hi def link fsOptionsFatType Number +hi def link fsOptionsYesNo String +hi def link fsOptionsHpfsCase String +hi def link fsOptionsIsoMap String +hi def link fsOptionsReiserHash String +hi def link fsOptionsSshYesNoAsk String +hi def link fsOptionsUfsType String +hi def link fsOptionsUfsError String + +hi def link fsOptionsVfatShortname String + let b:current_syntax = "fstab" let &cpo = s:cpo_save diff --git a/runtime/syntax/fvwm2m4.vim b/runtime/syntax/fvwm2m4.vim index 243da18fa7..e296273e31 100644 --- a/runtime/syntax/fvwm2m4.vim +++ b/runtime/syntax/fvwm2m4.vim @@ -5,12 +5,9 @@ " URI: http://physics.muni.cz/~yeti/download/syntax/fvwmm4.vim " Setup -if version >= 600 - if exists('b:current_syntax') - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists('b:current_syntax') + finish endif " Let included files know they are included @@ -19,19 +16,11 @@ if !exists('main_syntax') endif " Include M4 syntax -if version >= 600 - runtime! syntax/m4.vim -else - so <sfile>:p:h/m4.vim -endif +runtime! syntax/m4.vim unlet b:current_syntax " Include Fvwm2 syntax (Fvwm1 doesn't have M4 preprocessor) -if version >= 600 - runtime! syntax/fvwm.vim -else - so <sfile>:p:h/fvwm.vim -endif +runtime! syntax/fvwm.vim unlet b:current_syntax " That's all! diff --git a/runtime/syntax/gdb.vim b/runtime/syntax/gdb.vim index 64e89cce7f..25a21d184e 100644 --- a/runtime/syntax/gdb.vim +++ b/runtime/syntax/gdb.vim @@ -4,11 +4,8 @@ " URL: http://www.fleiner.com/vim/syntax/gdb.vim " Last Change: 2012 Oct 05 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -87,27 +84,17 @@ endif exec "syn sync ccomment gdbComment minlines=" . gdb_minlines " 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_gdb_syn_inits") - if version < 508 - let did_gdb_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink gdbFuncDef Function - HiLink gdbComment Comment - HiLink gdbStatement Statement - HiLink gdbString String - HiLink gdbCharacter Character - HiLink gdbVariable Identifier - HiLink gdbSet Constant - HiLink gdbInfo Type - HiLink gdbDocument Special - HiLink gdbNumber Number - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link gdbFuncDef Function +hi def link gdbComment Comment +hi def link gdbStatement Statement +hi def link gdbString String +hi def link gdbCharacter Character +hi def link gdbVariable Identifier +hi def link gdbSet Constant +hi def link gdbInfo Type +hi def link gdbDocument Special +hi def link gdbNumber Number let b:current_syntax = "gdb" diff --git a/runtime/syntax/gdmo.vim b/runtime/syntax/gdmo.vim index 86c6d5c76c..009f402ffa 100644 --- a/runtime/syntax/gdmo.vim +++ b/runtime/syntax/gdmo.vim @@ -5,11 +5,8 @@ " URL: http://classicalprogrammer.wikidot.com/local--files/vim-syntax-file-for-gdmo/gdmo.vim " Last change: 8th June, 2011 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -64,32 +61,22 @@ syn match gdmoBraces "[{}]" syn sync ccomment gdmoComment " 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_gdmo_syntax_inits") - if version < 508 - let did_gdmo_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink gdmoCategory Structure - HiLink gdmoRelationship Macro - HiLink gdmoDefinition Statement - HiLink gdmoReference Type - HiLink gdmoExtension Operator - HiLink gdmoBraces Function - HiLink gdmoSpecial Special - HiLink gdmoString String - HiLink gdmoCharacter Character - HiLink gdmoSpecialCharacter gdmoSpecial - HiLink gdmoComment Comment - HiLink gdmoLineComment gdmoComment - HiLink gdmoType Type +hi def link gdmoCategory Structure +hi def link gdmoRelationship Macro +hi def link gdmoDefinition Statement +hi def link gdmoReference Type +hi def link gdmoExtension Operator +hi def link gdmoBraces Function +hi def link gdmoSpecial Special +hi def link gdmoString String +hi def link gdmoCharacter Character +hi def link gdmoSpecialCharacter gdmoSpecial +hi def link gdmoComment Comment +hi def link gdmoLineComment gdmoComment +hi def link gdmoType Type - delcommand HiLink -endif let b:current_syntax = "gdmo" diff --git a/runtime/syntax/gedcom.vim b/runtime/syntax/gedcom.vim index 98851cc942..cd09e0fa22 100644 --- a/runtime/syntax/gedcom.vim +++ b/runtime/syntax/gedcom.vim @@ -3,11 +3,8 @@ " Maintainer: Paul Johnson (pjcj@transeda.com) " Version 1.059 - 23rd December 1999 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -41,26 +38,16 @@ syntax match gedcom_date "\d\{1,2}\s\+\(jan\|feb\|mar\|apr\|may\|jun\|jul\|aug\| syntax match gedcom_date ".*" contained " 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_gedcom_syntax_inits") - if version < 508 - let did_gedcom_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink gedcom_record Statement - HiLink gedcom_id Comment - HiLink gedcom_ii PreProc - HiLink gedcom_in Type - HiLink gedcom_name PreProc - HiLink gedcom_cname Type - HiLink gedcom_surname Identifier - HiLink gedcom_date Constant +hi def link gedcom_record Statement +hi def link gedcom_id Comment +hi def link gedcom_ii PreProc +hi def link gedcom_in Type +hi def link gedcom_name PreProc +hi def link gedcom_cname Type +hi def link gedcom_surname Identifier +hi def link gedcom_date Constant - delcommand HiLink -endif let b:current_syntax = "gedcom" diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim index b0315a9465..5e0642fbcc 100644 --- a/runtime/syntax/gitcommit.vim +++ b/runtime/syntax/gitcommit.vim @@ -2,7 +2,7 @@ " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish @@ -39,9 +39,10 @@ syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold -syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite -syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite -syn match gitcommitUnmergedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite + +syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite +syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite +syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow diff --git a/runtime/syntax/gitolite.vim b/runtime/syntax/gitolite.vim index 718aad0de9..3a6da26cc6 100644 --- a/runtime/syntax/gitolite.vim +++ b/runtime/syntax/gitolite.vim @@ -1,8 +1,10 @@ " Vim syntax file " Language: gitolite configuration -" URL: https://github.com/tmatilai/gitolite.vim -" Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi> -" Last Change: 2011-12-25 +" URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/syntax/gitolite.vim +" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/syntax/gitolite.vim) +" Maintainer: Sitaram Chamarty <sitaramc@gmail.com> +" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>) +" Last Change: 2017 Oct 05 if exists("b:current_syntax") finish @@ -11,74 +13,80 @@ endif let s:cpo_save = &cpo set cpo&vim -" Comment -syn match gitoliteComment "\(^\|\s\)#.*" contains=gitoliteTodo -syn keyword gitoliteTodo TODO FIXME XXX NOT contained - -" Groups, users and repos -syn match gitoliteGroupDef "\(^\s*\)\@<=@[^=]\{-1,}\(\s*=\)\@=" contains=gitoliteSpaceError,gitoliteUserError nextgroup=gitoliteGroupDefSep -syn match gitoliteGroupDefSep "\s*=" contained nextgroup=gitoliteRepoLine -syn match gitoliteRepoDef "^\s*repo\s" nextgroup=gitoliteRepoLine - -syn match gitoliteRepoLine ".*" contained transparent contains=gitoliteGroup,gitoliteWildRepo,gitoliteCreator,gitoliteExtCmdHelper,gitoliteRepoError,gitoliteComment -syn match gitoliteUserLine ".*" contained transparent contains=gitoliteGroup,gitolitePreProc,gitoliteUserError,gitoliteComment - -syn match gitoliteWildRepo "[ \t=]\@<=[^ \t]*[\\^$|()[\]*?{},][^ \t]*" contained contains=gitoliteCreator,gitoliteRepoError -syn match gitoliteGroup "[ \t=]\@<=@[^ \t]\+" contained contains=gitoliteUserError - -syn keyword gitoliteCreator CREATER CREATOR contained -syn keyword gitolitePreProc CREATER CREATOR READERS WRITERS contained - -syn match gitoliteExtCmdHelper "[ \t=]\@<=EXTCMD/" contained nextgroup=gitoliteExtCmd -syn match gitoliteExtCmd "rsync\(\s\|$\)" contained - -" Illegal characters -syn match gitoliteRepoError "[^ \t0-9a-zA-Z._@+/\\^$|()[\]*?{},-]\+" contained -syn match gitoliteUserError "[^ \t0-9a-zA-Z._@+-]\+" contained -syn match gitoliteSpaceError "\s\+" contained - -" Permission -syn match gitoliteKeyword "^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\)[ \t=]\@=" nextgroup=gitoliteRefex -syn match gitoliteKeyword "^\s*-[ \t=]\@=" nextgroup=gitoliteDenyRefex -syn match gitoliteRefex "[^=]*="he=e-1 contained contains=gitoliteSpecialRefex,gitoliteGroup nextgroup=gitoliteUserLine -syn match gitoliteDenyRefex "[^=]*="he=e-1 contained contains=gitoliteSpecialRefex,gitoliteGroup nextgroup=gitoliteDenyUsers -syn match gitoliteSpecialRefex "\sNAME/"he=e-1 contained -syn match gitoliteSpecialRefex "/USER/"hs=s+1,he=e-1 contained -syn match gitoliteDenyUsers ".*" contained contains=gitoliteUserError,gitoliteComment - -" Configuration -syn match gitoliteKeyword "^\s*config\s\+" nextgroup=gitoliteConfVariable -syn match gitoliteConfVariable "[^=]*" contained - -" Include -syn match gitoliteInclude "^\s*\(include\|subconf\)\s" - -" String -syn region gitoliteString start=+"+ end=+"+ oneline - -" Define the default highlighting -hi def link gitoliteComment Comment -hi def link gitoliteTodo Todo -hi def link gitoliteGroupDef gitoliteGroup -hi def link gitoliteGroup Identifier -hi def link gitoliteWildRepo Special -hi def link gitoliteRepoError gitoliteError -hi def link gitoliteUserError gitoliteError -hi def link gitoliteSpaceError gitoliteError -hi def link gitoliteError Error -hi def link gitoliteCreator gitolitePreProc -hi def link gitolitePreProc PreProc -hi def link gitoliteExtCmdHelper PreProc -hi def link gitoliteExtCmd Special -hi def link gitoliteRepoDef Type -hi def link gitoliteKeyword Keyword -hi def link gitoliteRefex String -hi def link gitoliteDenyRefex gitoliteRefex -hi def link gitoliteSpecialRefex PreProc -hi def link gitoliteDenyUsers WarningMsg -hi def link gitoliteConfVariable Identifier -hi def link gitoliteInclude Include -hi def link gitoliteString String +" this seems to be the best way, for now. +syntax sync fromstart + +" ---- common stuff + +syn match gitoliteGroup '@\S\+' + +syn match gitoliteComment '#.*' contains=gitoliteTodo +syn keyword gitoliteTodo TODO FIXME XXX NOT contained + +" ---- main section + +" catch template-data syntax appearing outside template-data section +syn match gitoliteRepoError '^\s*repo.*=' +syn match gitoliteRepoError '^\s*\S\+\s*=' " this gets overridden later when first word is a perm, don't worry + +" normal gitolite group and repo lines +syn match gitoliteGroupLine '^\s*@\S\+\s*=\s*\S.*$' contains=gitoliteGroup,gitoliteComment +syn match gitoliteRepoLine '^\s*repo\s\+[^=]*$' contains=gitoliteRepo,gitoliteGroup,gitoliteComment +syn keyword gitoliteRepo repo contained + +syn keyword gitoliteSpecialRepo CREATOR + +" normal gitolite rule lines +syn match gitoliteRuleLine '^\s*\(-\|C\|R\|RW+\?C\?D\?\)\s[^#]*' contains=gitoliteRule,gitoliteCreateRule,gitoliteDenyRule,gitoliteRefex,gitoliteUsers,gitoliteGroup +syn match gitoliteRule '\(^\s*\)\@<=\(-\|C\|R\|RW+\?C\?D\?\)\s\@=' contained +syn match gitoliteRefex '\(^\s*\(-\|R\|RW+\?C\?D\?\)\s\+\)\@<=\S.\{-}\(\s*=\)\@=' contains=gitoliteSpecialRefex +syn match gitoliteSpecialRefex 'NAME/' +syn match gitoliteSpecialRefex '/USER/' +syn match gitoliteCreateRule '\(^\s*C\s.*=\s*\)\@<=\S[^#]*[^# ]' contained contains=gitoliteGroup +syn match gitoliteDenyRule '\(^\s*-\s.*=\s*\)\@<=\S[^#]*[^# ]' contained + +" normal gitolite config (and similar) lines +syn match gitoliteConfigLine '^\s*\(config\|option\|include\|subconf\)\s[^#]*' contains=gitoliteConfigKW,gitoliteConfigKey,gitoliteConfigVal,gitoliteComment +syn keyword gitoliteConfigKW config option include subconf contained +syn match gitoliteConfigKey '\(\(config\|option\)\s\+\)\@<=[^ =]*' contained +syn match gitoliteConfigVal '\(=\s*\)\@<=\S.*' contained + +" ---- template-data section + +syn region gitoliteTemplateLine matchgroup=PreProc start='^=begin template-data$' end='^=end$' contains=gitoliteTplRepoLine,gitoliteTplRoleLine,gitoliteGroup,gitoliteComment,gitoliteTplError + +syn match gitoliteTplRepoLine '^\s*repo\s\+\S.*=.*' contained contains=gitoliteTplRepo,gitoliteTplTemplates,gitoliteGroup +syn keyword gitoliteTplRepo repo contained +syn match gitoliteTplTemplates '\(=\s*\)\@<=\S.*' contained contains=gitoliteGroup,gitoliteComment + +syn match gitoliteTplRoleLine '^\s*\S\+\s*=\s*.*' contained contains=gitoliteTplRole,gitoliteGroup,gitoliteComment +syn match gitoliteTplRole '\S\+\s*='he=e-1 contained + +" catch normal gitolite rules appearing in template-data section +syn match gitoliteTplError '^\s*repo[^=]*$' contained +syn match gitoliteTplError '^\s*\(-\|R\|RW+\?C\?D\?\)\s'he=e-1 contained +syn match gitoliteTplError '^\s*\(config\|option\|include\|subconf\)\s'he=e-1 contained +syn match gitoliteTplError '^\s*@\S\+\s*=' contained contains=NONE + +hi def link gitoliteGroup Identifier +hi def link gitoliteComment Comment +hi def link gitoliteTodo ToDo +hi def link gitoliteRepoError Error +hi def link gitoliteGroupLine PreProc +hi def link gitoliteRepo Keyword +hi def link gitoliteSpecialRepo PreProc +hi def link gitoliteRule Keyword +hi def link gitoliteCreateRule PreProc +hi def link gitoliteDenyRule WarningMsg +hi def link gitoliteRefex Constant +hi def link gitoliteSpecialRefex PreProc +hi def link gitoliteConfigKW Keyword +hi def link gitoliteConfigKey Identifier +hi def link gitoliteConfigVal String +hi def link gitoliteTplRepo Keyword +hi def link gitoliteTplTemplates Constant +hi def link gitoliteTplRole Constant +hi def link gitoliteTplError Error let b:current_syntax = "gitolite" diff --git a/runtime/syntax/gitrebase.vim b/runtime/syntax/gitrebase.vim index a7460280d3..a944c14dd7 100644 --- a/runtime/syntax/gitrebase.vim +++ b/runtime/syntax/gitrebase.vim @@ -2,7 +2,7 @@ " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: git-rebase-todo -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish @@ -18,6 +18,7 @@ syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite +syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSummary ".*" contains=gitrebaseHash contained syn match gitrebaseCommand ".*" contained syn match gitrebaseComment "^#.*" contains=gitrebaseHash @@ -31,6 +32,7 @@ hi def link gitrebaseEdit PreProc hi def link gitrebaseSquash Type hi def link gitrebaseFixup Special hi def link gitrebaseExec Function +hi def link gitrebaseDrop Comment hi def link gitrebaseSummary String hi def link gitrebaseComment Comment hi def link gitrebaseSquashError Error diff --git a/runtime/syntax/gitsendemail.vim b/runtime/syntax/gitsendemail.vim index 8b938116fa..8fdf6839c8 100644 --- a/runtime/syntax/gitsendemail.vim +++ b/runtime/syntax/gitsendemail.vim @@ -1,14 +1,18 @@ " Vim syntax file " Language: git send-email message " Maintainer: Tim Pope -" Filenames: *.msg.[0-9]* (first line is "From ... # This line is ignored.") -" Last Change: 2010 May 21 +" Filenames: .gitsendemail.* +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish endif runtime! syntax/mail.vim +unlet! b:current_syntax +syn include @gitsendemailDiff syntax/diff.vim +syn region gitsendemailDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^-- %/ fold contains=@gitsendemailDiff + syn case match syn match gitsendemailComment "\%^From.*#.*" diff --git a/runtime/syntax/gkrellmrc.vim b/runtime/syntax/gkrellmrc.vim index 6ce1238416..f005ca2dc8 100644 --- a/runtime/syntax/gkrellmrc.vim +++ b/runtime/syntax/gkrellmrc.vim @@ -6,19 +6,12 @@ " URL: http://trific.ath.cx/Ftp/vim/syntax/gkrellmrc.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -if version >= 600 - setlocal iskeyword=_,-,a-z,A-Z,48-57 -else - set iskeyword=_,-,a-z,A-Z,48-57 -endif +setlocal iskeyword=_,-,a-z,A-Z,48-57 syn case match @@ -55,37 +48,28 @@ syn keyword gkrellmrcStyleCmd StyleMeter StyleChart StylePanel syn keyword gkrellmrcStyleItem textcolor alt_textcolor font alt_font transparency border label_position margin margins left_margin right_margin top_margin bottom_margin krell_depth krell_yoff krell_x_hot krell_expand krell_left_margin krell_right_margin " Define the default highlighting -if version >= 508 || !exists("did_gtkrc_syntax_inits") - if version < 508 - let did_gtkrc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink gkrellmrcComment Comment - HiLink gkrellmrcFixme Todo +hi def link gkrellmrcComment Comment +hi def link gkrellmrcFixme Todo - HiLink gkrellmrcString gkrellmrcConstant - HiLink gkrellmrcNumber gkrellmrcConstant - HiLink gkrellmrcRGBColor gkrellmrcConstant - HiLink gkrellmrcExpandMode gkrellmrcConstant - HiLink gkrellmrcConstant Constant +hi def link gkrellmrcString gkrellmrcConstant +hi def link gkrellmrcNumber gkrellmrcConstant +hi def link gkrellmrcRGBColor gkrellmrcConstant +hi def link gkrellmrcExpandMode gkrellmrcConstant +hi def link gkrellmrcConstant Constant - HiLink gkrellmrcMeterName gkrellmrcClass - HiLink gkrellmrcChartName gkrellmrcClass - HiLink gkrellmrcSpecialClassName gkrellmrcClass - HiLink gkrellmrcClass Type +hi def link gkrellmrcMeterName gkrellmrcClass +hi def link gkrellmrcChartName gkrellmrcClass +hi def link gkrellmrcSpecialClassName gkrellmrcClass +hi def link gkrellmrcClass Type - HiLink gkrellmrcGlobal gkrellmrcItem - HiLink gkrellmrcBuiltinExt gkrellmrcItem - HiLink gkrellmrcStyleItem gkrellmrcItem - HiLink gkrellmrcItem Function +hi def link gkrellmrcGlobal gkrellmrcItem +hi def link gkrellmrcBuiltinExt gkrellmrcItem +hi def link gkrellmrcStyleItem gkrellmrcItem +hi def link gkrellmrcItem Function - HiLink gkrellmrcSetCmd Special - HiLink gkrellmrcStyleCmd Statement +hi def link gkrellmrcSetCmd Special +hi def link gkrellmrcStyleCmd Statement - delcommand HiLink -endif let b:current_syntax = "gkrellmrc" diff --git a/runtime/syntax/gnash.vim b/runtime/syntax/gnash.vim index f9e2b519a5..cce522dd86 100644 --- a/runtime/syntax/gnash.vim +++ b/runtime/syntax/gnash.vim @@ -15,11 +15,8 @@ " Vim is Charityware, see ":help Uganda" " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") || &compatible +" quit when a syntax file was already loaded +if exists("b:current_syntax") || &compatible finish endif diff --git a/runtime/syntax/gnuplot.vim b/runtime/syntax/gnuplot.vim index 5a381c7cd6..7777cc9e46 100644 --- a/runtime/syntax/gnuplot.vim +++ b/runtime/syntax/gnuplot.vim @@ -1,197 +1,543 @@ " Vim syntax file -" Language: gnuplot 3.8i.0 -" Maintainer: John Hoelzel johnh51@users.sourceforge.net -" Last Change: Mon May 26 02:33:33 UTC 2003 -" Filenames: *.gpi *.gih scripts: #!*gnuplot -" URL: http://johnh51.get.to/vim/syntax/gnuplot.vim -" - -" thanks to "David Necas (Yeti)" <yeti@physics.muni.cz> for heads up - working on more changes . -" *.gpi = GnuPlot Input - what I use because there is no other guideline. jeh 11/2000 -" *.gih = makes using cut/pasting from gnuplot.gih easier ... -" #!*gnuplot = for Linux bash shell scripts of gnuplot commands. -" emacs used a suffix of '<gp?>' -" gnuplot demo files show no preference. -" I will post mail and newsgroup comments on a standard suffix in 'URL' directory. - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif +" Language: gnuplot 4.7.0 +" Maintainer: Josh Wainwright <wainwright DOT ja AT gmail DOT com> +" Last Maintainer: Andrew Rasmussen andyras@users.sourceforge.net +" Original Maintainer: John Hoelzel johnh51@users.sourceforge.net +" Last Change: 2015-08-25 +" Filenames: *.gnu *.plt *.gpi *.gih *.gp *.gnuplot scripts: #!*gnuplot +" URL: http://www.vim.org/scripts/script.php?script_id=4873 +" Original URL: http://johnh51.get.to/vim/syntax/gnuplot.vim + +" thanks to "David Necas (Yeti)" <yeti@physics.muni.cz> + +" credit also to Jim Eberle <jim.eberle@fastnlight.com> +" for the script http://www.vim.org/scripts/script.php?script_id=1737 " some shortened names to make demo files look clean... jeh. 11/2000 " demos -> 3.8i ... jeh. 5/2003 - a work in progress... +" added current commands, keywords, variables, todos, macros... amr 2014-02-24 + +" For vim version 5.x: Clear all syntax items +" For vim version 6.x: Quit when a syntax file was already loaded + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" ---- Special characters ---- " + +" no harm in just matching any \[char] within double quotes, right? +syn match gnuplotSpecial "\\." contained +" syn match gnuplotSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[a-z\\]" contained + +" measurements in the units in, cm and pt are special +syn match gnuplotUnit "[0-9]+in" +syn match gnuplotUnit "[0-9]+cm" +syn match gnuplotUnit "[0-9]+pt" + +" external (shell) commands are special +syn region gnuplotExternal start="!" end="$" + +" ---- Comments ---- " + +syn region gnuplotComment start="#" end="$" contains=gnuplotTodo + +" ---- Constants ---- " -" commands +" strings +syn region gnuplotString start=+"+ skip=+\\"+ end=+"+ contains=gnuplotSpecial +syn region gnuplotString start="'" end="'" -syn keyword gnuplotStatement cd call clear exit set unset plot splot help -syn keyword gnuplotStatement load pause quit fit rep[lot] if -syn keyword gnuplotStatement FIT_LIMIT FIT_MAXITER FIT_START_LAMBDA -syn keyword gnuplotStatement FIT_LAMBDA_FACTOR FIT_LOG FIT_SCRIPT -syn keyword gnuplotStatement print pwd reread reset save show test ! functions var -syn keyword gnuplotConditional if -" if is cond + stmt - ok? +" built-in variables +syn keyword gnuplotNumber GNUTERM GPVAL_TERM GPVAL_TERMOPTIONS GPVAL_SPLOT +syn keyword gnuplotNumber GPVAL_OUTPUT GPVAL_ENCODING GPVAL_VERSION +syn keyword gnuplotNumber GPVAL_PATCHLEVEL GPVAL_COMPILE_OPTIONS +syn keyword gnuplotNumber GPVAL_MULTIPLOT GPVAL_PLOT GPVAL_VIEW_ZSCALE +syn keyword gnuplotNumber GPVAL_TERMINALS GPVAL_pi GPVAL_NaN +syn keyword gnuplotNumber GPVAL_ERRNO GPVAL_ERRMSG GPVAL_PWD +syn keyword gnuplotNumber pi NaN GPVAL_LAST_PLOT GPVAL_TERM_WINDOWID +syn keyword gnuplotNumber GPVAL_X_MIN GPVAL_X_MAX GPVAL_X_LOG +syn keyword gnuplotNumber GPVAL_DATA_X_MIN GPVAL_DATA_X_MAX GPVAL_Y_MIN +syn keyword gnuplotNumber GPVAL_Y_MAX GPVAL_Y_LOG GPVAL_DATA_Y_MIN +syn keyword gnuplotNumber GPVAL_DATA_Y_MAX GPVAL_X2_MIN GPVAL_X2_MAX +syn keyword gnuplotNumber GPVAL_X2_LOG GPVAL_DATA_X2_MIN GPVAL_DATA_X2_MAX +syn keyword gnuplotNumber GPVAL_Y2_MIN GPVAL_Y2_MAX GPVAL_Y2_LOG +syn keyword gnuplotNumber GPVAL_DATA_Y2_MIN GPVAL_DATA_Y2_MAX GPVAL_Z_MIN +syn keyword gnuplotNumber GPVAL_Z_MAX GPVAL_Z_LOG GPVAL_DATA_Z_MIN +syn keyword gnuplotNumber GPVAL_DATA_Z_MAX GPVAL_CB_MIN GPVAL_CB_MAX +syn keyword gnuplotNumber GPVAL_CB_LOG GPVAL_DATA_CB_MIN GPVAL_DATA_CB_MAX +syn keyword gnuplotNumber GPVAL_T_MIN GPVAL_T_MAX GPVAL_T_LOG GPVAL_U_MIN +syn keyword gnuplotNumber GPVAL_U_MAX GPVAL_U_LOG GPVAL_V_MIN GPVAL_V_MAX +syn keyword gnuplotNumber GPVAL_V_LOG GPVAL_R_MIN GPVAL_R_LOG +syn keyword gnuplotNumber GPVAL_TERM_XMIN GPVAL_TERM_XMAX GPVAL_TERM_YMIN +syn keyword gnuplotNumber GPVAL_TERM_YMAX GPVAL_TERM_XSIZE +syn keyword gnuplotNumber GPVAL_TERM_YSIZE GPVAL_VIEW_MAP GPVAL_VIEW_ROT_X +syn keyword gnuplotNumber GPVAL_VIEW_ROT_Z GPVAL_VIEW_SCALE -" numbers fm c.vim +" function name variables +syn match gnuplotNumber "GPFUN_[a-zA-Z_]*" -" integer number, or floating point number without a dot and with "f". +" stats variables +syn keyword gnuplotNumber STATS_records STATS_outofrange STATS_invalid +syn keyword gnuplotNumber STATS_blank STATS_blocks STATS_columns STATS_min +syn keyword gnuplotNumber STATS_max STATS_index_min STATS_index_max +syn keyword gnuplotNumber STATS_lo_quartile STATS_median STATS_up_quartile +syn keyword gnuplotNumber STATS_mean STATS_stddev STATS_sum STATS_sumsq +syn keyword gnuplotNumber STATS_correlation STATS_slope STATS_intercept +syn keyword gnuplotNumber STATS_sumxy STATS_pos_min_y STATS_pos_max_y +syn keyword gnuplotNumber STATS_mean STATS_stddev STATS_mean_x STATS_sum_x +syn keyword gnuplotNumber STATS_stddev_x STATS_sumsq_x STATS_min_x +syn keyword gnuplotNumber STATS_max_x STATS_median_x STATS_lo_quartile_x +syn keyword gnuplotNumber STATS_up_quartile_x STATS_index_min_x +syn keyword gnuplotNumber STATS_index_max_x STATS_mean_y STATS_stddev_y +syn keyword gnuplotNumber STATS_sum_y STATS_sumsq_y STATS_min_y +syn keyword gnuplotNumber STATS_max_y STATS_median_y STATS_lo_quartile_y +syn keyword gnuplotNumber STATS_up_quartile_y STATS_index_min_y +syn keyword gnuplotNumber STATS_index_max_y STATS_correlation STATS_sumxy + +" deprecated fit variables +syn keyword gnuplotError FIT_LIMIT FIT_MAXITER FIT_START_LAMBDA +syn keyword gnuplotError FIT_LAMBDA_FACTOR FIT_LOG FIT_SCRIPT + +" numbers, from c.vim + +" integer number, or floating point number without a dot and with "f". syn case ignore syn match gnuplotNumber "\<[0-9]\+\(u\=l\=\|lu\|f\)\>" -" floating point number, with dot, optional exponent + +" floating point number, with dot, optional exponent syn match gnuplotFloat "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=[fl]\=\>" -" floating point number, starting with a dot, optional exponent + +" floating point number, starting with a dot, optional exponent syn match gnuplotFloat "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=[fl]\=\>" -" floating point number, without dot, with exponent + +" floating point number, without dot, with exponent syn match gnuplotFloat "\<[0-9]\+e[-+]\=[0-9]\+[fl]\=\>" -" hex number + +" hex number syn match gnuplotNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>" syn case match -" flag an octal number with wrong digits by not hilighting + +" flag an octal number with wrong digits by not highlighting syn match gnuplotOctalError "\<0[0-7]*[89]" -" plot args - -syn keyword gnuplotType u[sing] tit[le] notit[le] wi[th] steps fs[teps] -syn keyword gnuplotType title notitle t -syn keyword gnuplotType with w -syn keyword gnuplotType li[nes] l -" t - too much? w - too much? l - too much? -syn keyword gnuplotType linespoints via - -" funcs - -syn keyword gnuplotFunc abs acos acosh arg asin asinh atan atanh atan2 -syn keyword gnuplotFunc besj0 besj1 besy0 besy1 -syn keyword gnuplotFunc ceil column cos cosh erf erfc exp floor gamma -syn keyword gnuplotFunc ibeta inverf igamma imag invnorm int lgamma -syn keyword gnuplotFunc log log10 norm rand real sgn sin sinh sqrt tan -syn keyword gnuplotFunc lambertw -syn keyword gnuplotFunc tanh valid -syn keyword gnuplotFunc tm_hour tm_mday tm_min tm_mon tm_sec -syn keyword gnuplotFunc tm_wday tm_yday tm_year - -" set vars - -syn keyword gnuplotType xdata timefmt grid noytics ytics fs -syn keyword gnuplotType logscale time notime mxtics nomxtics style mcbtics -syn keyword gnuplotType nologscale -syn keyword gnuplotType axes x1y2 unique acs[plines] -syn keyword gnuplotType size origin multiplot xtics xr[ange] yr[ange] square nosquare ratio noratio -syn keyword gnuplotType binary matrix index every thru sm[ooth] -syn keyword gnuplotType all angles degrees radians -syn keyword gnuplotType arrow noarrow autoscale noautoscale arrowstyle -" autoscale args = x y xy z t ymin ... - too much? -" needs code to: using title vs autoscale t -syn keyword gnuplotType x y z zcb -syn keyword gnuplotType linear cubicspline bspline order level[s] -syn keyword gnuplotType auto disc[rete] incr[emental] from to head nohead -syn keyword gnuplotType graph base both nosurface table out[put] data -syn keyword gnuplotType bar border noborder boxwidth -syn keyword gnuplotType clabel noclabel clip noclip cntrp[aram] -syn keyword gnuplotType contour nocontour -syn keyword gnuplotType dgrid3d nodgrid3d dummy encoding format -" set encoding args not included - yet. -syn keyword gnuplotType function grid nogrid hidden[3d] nohidden[3d] isosample[s] key nokey -syn keyword gnuplotType historysize nohistorysize -syn keyword gnuplotType defaults offset nooffset trianglepattern undefined noundefined altdiagonal bentover noaltdiagonal nobentover -syn keyword gnuplotType left right top bottom outside below samplen spacing width height box nobox linestyle ls linetype lt linewidth lw -syn keyword gnuplotType Left Right autotitles noautotitles enhanced noenhanced -syn keyword gnuplotType isosamples -syn keyword gnuplotType label nolabel logscale nolog[scale] missing center font locale -syn keyword gnuplotType mapping margin bmargin lmargin rmargin tmargin spherical cylindrical cartesian -syn keyword gnuplotType linestyle nolinestyle linetype lt linewidth lw pointtype pt pointsize ps -syn keyword gnuplotType mouse nomouse -syn keyword gnuplotType nooffsets data candlesticks financebars linespoints lp vector nosurface -syn keyword gnuplotType term[inal] linux aed767 aed512 gpic -syn keyword gnuplotType regis tek410x tek40 vttek kc-tek40xx -syn keyword gnuplotType km-tek40xx selanar bitgraph xlib x11 X11 -" x11 args -syn keyword gnuplotType aifm cgm dumb fig gif small large size nofontlist winword6 corel dxf emf -syn keyword gnuplotType hpgl -" syn keyword gnuplotType transparent hp2623a hp2648 hp500c pcl5 why jeh -syn keyword gnuplotType hp2623a hp2648 hp500c pcl5 -syn match gnuplotType "\<transparent\>" -syn keyword gnuplotType hpljii hpdj hppj imagen mif pbm png svg -syn keyword gnuplotType postscript enhanced_postscript qms table -" postscript editing values? -syn keyword gnuplotType tgif tkcanvas epson-180dpi epson-60dpi -syn keyword gnuplotType epson-lx800 nec-cp6 okidata starc -syn keyword gnuplotType tandy-60dpi latex emtex pslatex pstex epslatex -syn keyword gnuplotType eepic tpic pstricks texdraw mf metafont mpost mp -syn keyword gnuplotType timestamp notimestamp -syn keyword gnuplotType variables version -syn keyword gnuplotType x2data y2data ydata zdata -syn keyword gnuplotType reverse writeback noreverse nowriteback -syn keyword gnuplotType axis mirror autofreq nomirror rotate autofreq norotate -syn keyword gnuplotType update -syn keyword gnuplotType multiplot nomultiplot mytics -syn keyword gnuplotType nomytics mztics nomztics mx2tics nomx2tics -syn keyword gnuplotType my2tics nomy2tics offsets origin output -syn keyword gnuplotType para[metric] nopara[metric] pointsize polar nopolar -syn keyword gnuplotType zrange x2range y2range rrange cbrange -syn keyword gnuplotType trange urange vrange sample[s] size -syn keyword gnuplotType bezier boxerrorbars boxes bargraph bar[s] -syn keyword gnuplotType boxxy[errorbars] csplines dots fsteps histeps impulses -syn keyword gnuplotType line[s] linesp[oints] points poiinttype sbezier splines steps -" w lt lw ls = optional -syn keyword gnuplotType vectors xerr[orbars] xyerr[orbars] yerr[orbars] financebars candlesticks vector -syn keyword gnuplotType errorb[ars] surface -syn keyword gnuplotType filledcurve[s] pm3d x1 x2 y1 y2 xy closed -syn keyword gnuplotType at pi front -syn keyword gnuplotType errorlines xerrorlines yerrorlines xyerrorlines -syn keyword gnuplotType tics ticslevel ticscale time timefmt view -syn keyword gnuplotType xdata xdtics noxdtics ydtics noydtics -syn keyword gnuplotType zdtics nozdtics x2dtics nox2dtics y2dtics noy2dtics -syn keyword gnuplotType xlab[el] ylab[el] zlab[el] cblab[el] x2label y2label xmtics -syn keyword gnuplotType xmtics noxmtics ymtics noymtics zmtics nozmtics -syn keyword gnuplotType x2mtics nox2mtics y2mtics noy2mtics -syn keyword gnuplotType cbdtics nocbdtics cbmtics nocbmtics cbtics nocbtics -syn keyword gnuplotType xtics noxtics ytics noytics -syn keyword gnuplotType ztics noztics x2tics nox2tics -syn keyword gnuplotType y2tics noy2tics zero nozero zeroaxis nozeroaxis -syn keyword gnuplotType xzeroaxis noxzeroaxis yzeroaxis noyzeroaxis -syn keyword gnuplotType x2zeroaxis nox2zeroaxis y2zeroaxis noy2zeroaxis -syn keyword gnuplotType angles one two fill empty solid pattern -syn keyword gnuplotType default -syn keyword gnuplotType scansautomatic flush b[egin] noftriangles implicit -" b too much? - used in demo -syn keyword gnuplotType palette positive negative ps_allcF nops_allcF maxcolors -syn keyword gnuplotType push fontfile pop -syn keyword gnuplotType rgbformulae defined file color model gradient colornames -syn keyword gnuplotType RGB HSV CMY YIQ XYZ -syn keyword gnuplotType colorbox vertical horizontal user bdefault -syn keyword gnuplotType loadpath fontpath decimalsign in out - -" comments + strings -syn region gnuplotComment start="#" end="$" -syn region gnuplotComment start=+"+ skip=+\\"+ end=+"+ -syn region gnuplotComment start=+'+ end=+'+ - -" 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_gnuplot_syntax_inits") - if version < 508 - let did_gnuplot_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink gnuplotStatement Statement - HiLink gnuplotConditional Conditional - HiLink gnuplotNumber Number - HiLink gnuplotFloat Float - HiLink gnuplotOctalError Error - HiLink gnuplotFunc Type - HiLink gnuplotType Type - HiLink gnuplotComment Comment - - delcommand HiLink -endif +" ---- Identifiers: Functions ---- " + +" numerical functions +syn keyword gnuplotFunc abs acos acosh airy arg asin asinh atan atan2 +syn keyword gnuplotFunc atanh EllipticK EllipticE EllipticPi besj0 besj1 +syn keyword gnuplotFunc besy0 besy1 ceil cos cosh erf erfc exp expint +syn keyword gnuplotFunc floor gamma ibeta inverf igamma imag invnorm int +syn keyword gnuplotFunc lambertw lgamma log log10 norm rand real sgn sin +syn keyword gnuplotFunc sin sinh sqrt tan tanh voigt + +" string functions +syn keyword gnuplotFunc gprintf sprintf strlen strstrt substr strftime +syn keyword gnuplotFunc strptime system word words + +" other functions +syn keyword gnuplotFunc column columnhead columnheader defined exists +syn keyword gnuplotFunc hsv2rgb stringcolumn timecolumn tm_hour tm_mday +syn keyword gnuplotFunc tm_min tm_mon tm_sec tm_wday tm_yday tm_year +syn keyword gnuplotFunc time valid value + +" ---- Statements ---- " + +" common (builtin) variable names +syn keyword gnuplotKeyword x y t u v z s + +" conditionals +syn keyword gnuplotConditional if else + +" repeats +syn keyword gnuplotRepeat do for while + +" operators +syn match gnuplotOperator "[-+*/^|&?:]" +syn match gnuplotOperator "\*\*" +syn match gnuplotOperator "&&" +syn match gnuplotOperator "||" + +" Keywords + +" keywords for 'fit' command +syn keyword gnuplotKeyword via z x:z x:z:s x:y:z:s +syn keyword gnuplotKeyword x:y:t:z:s x:y:t:u:z:s x:y:t:u:v:z:s + +" keywords for 'plot' command +" 'axes' keyword +syn keyword gnuplotKeyword axes x1y1 x1y2 x2y1 x2y2 +" 'binary' keyword +syn keyword gnuplotKeyword binary matrix general array record format endian +syn keyword gnuplotKeyword filetype avs edf png scan transpose dx dy dz +syn keyword gnuplotKeyword flipx flipy flipz origin center rotate using +syn keyword gnuplotKeyword perpendicular skip every +" datafile keywords +syn keyword gnuplotKeyword binary nonuniform matrix index every using +syn keyword gnuplotKeyword smooth volatile noautoscale every index +" 'smooth' keywords +syn keyword gnuplotKeyword unique frequency cumulative cnormal kdensity +syn keyword gnuplotKeyword csplines acsplines bezer sbezier +" deprecated 'thru' keyword +syn keyword gnuplotError thru +" 'using' keyword +syn keyword gnuplotKeyword using u xticlabels yticlabels zticlabels +syn keyword gnuplotKeyword x2ticlabels y2ticlabels xtic ytic ztic +" 'errorbars' keywords +syn keyword gnuplotKeyword errorbars xerrorbars yerrorbars xyerrorbars +" 'errorlines' keywords +syn keyword gnuplotKeyword errorlines xerrorlines yerrorlines xyerrorlines +" 'title' keywords +syn keyword gnuplotKeyword title t tit notitle columnheader at beginning +syn keyword gnuplotKeyword end +" 'with' keywords +syn keyword gnuplotKeyword with w linestyle ls linetype lt linewidth +syn keyword gnuplotKeyword lw linecolor lc pointtype pt pointsize ps +syn keyword gnuplotKeyword fill fs nohidden3d nocontours nosurface palette +" styles for 'with' +syn keyword gnuplotKeyword lines l points p linespoints lp surface dots +syn keyword gnuplotKeyword impulses labels vectors steps fsteps histeps +syn keyword gnuplotKeyword errorbars errorlines financebars xerrorbars +syn keyword gnuplotKeyword xerrorlines xyerrorbars yerrorbars yerrorlines +syn keyword gnuplotKeyword boxes boxerrorbars boxxyerrorbars boxplot +syn keyword gnuplotKeyword candlesticks circles ellipses filledcurves +syn keyword gnuplotKeyword histogram image rgbimage rgbalpha pm3d variable + +" keywords for 'save' command +syn keyword gnuplotKeyword save functions func variables all var terminal +syn keyword gnuplotKeyword term set + +" keywords for 'set/show' command +" set angles +syn keyword gnuplotKeyword angles degrees deg radians rad +" set arrow +syn keyword gnuplotKeyword arrow from to rto length angle arrowstyle as +syn keyword gnuplotKeyword nohead head backhead heads size filled empty +syn keyword gnuplotKeyword nofilled front back linestyle linetype linewidth +" set autoscale +" TODO regexp here +syn keyword gnuplotKeyword autoscale x y z cb x2 y2 zy min max fixmin +syn keyword gnuplotKeyword fixmax fix keepfix noextend +" set bars +syn keyword gnuplotKeyword bars small large fullwidth front back +" set bind +syn keyword gnuplotKeyword bind +" set margins +" TODO regexp +syn keyword gnuplotKeyword margin bmargin lmargin rmargin tmargin +" set border +syn keyword gnuplotKeyword border front back +" set boxwidth +syn keyword gnuplotKeyword boxwidth absolute relative +" deprecated set clabel +syn keyword gnuplotError clabel +" set clip +syn keyword gnuplotKeyword clip points one two +" set cntrlabel +syn keyword gnuplotKeyword cntrlabel format font start interval onecolor +" set cntrparam +syn keyword gnuplotKeyword cntrparam linear cubicspline bspline points +syn keyword gnuplotKeyword order levels auto discrete incremental +" set colorbox +syn keyword gnuplotKeyword colorbox vertical horizontal default user origin +syn keyword gnuplotKeyword size front back noborder bdefault border +" show colornames +syn keyword gnuplotKeyword colornames +" set contour +syn keyword gnuplotKeyword contour base surface both +" set datafile +syn keyword gnuplotKeyword datafile fortran nofpe_trap missing separator +syn keyword gnuplotKeyword whitespace tab comma commentschars binary +" set decimalsign +syn keyword gnuplotKeyword decimalsign locale +" set dgrid3d +syn keyword gnuplotKeyword dgrid3d splines qnorm gauss cauchy exp box hann +syn keyword gnuplotKeyword kdensity +" set dummy +syn keyword gnuplotKeyword dummy +" set encoding +syn keyword gnuplotKeyword encoding default iso_8859_1 iso_8859_15 +syn keyword gnuplotKeyword iso_8859_2 iso_8859_9 koi8r koi8u cp437 cp850 +syn keyword gnuplotKeyword cp852 cp950 cp1250 cp1251 cp1254 sjis utf8 +" set fit +syn keyword gnuplotKeyword fit logfile default quiet noquiet results brief +syn keyword gnuplotKeyword verbose errorvariables noerrorvariables +syn keyword gnuplotKeyword errorscaling noerrorscaling prescale noprescale +syn keyword gnuplotKeyword maxiter none limit limit_abs start-lambda script +syn keyword gnuplotKeyword lambda-factor +" set fontpath +syn keyword gnuplotKeyword fontpath +" set format +syn keyword gnuplotKeyword format +" show functions +syn keyword gnuplotKeyword functions +" set grid +syn keyword gnuplotKeyword grid polar layerdefault xtics ytics ztics x2tics +syn keyword gnuplotKeyword y2tics cbtics mxtics mytics mztics mx2tics +syn keyword gnuplotKeyword my2tics mcbtics xmtics ymtics zmtics x2mtics +syn keyword gnuplotKeyword y2mtics cbmtics noxtics noytics noztics nox2tics +syn keyword gnuplotKeyword noy2tics nocbtics nomxtics nomytics nomztics +syn keyword gnuplotKeyword nomx2tics nomy2tics nomcbtics +" set hidden3d +syn keyword gnuplotKeyword hidden3d offset trianglepattern undefined +syn keyword gnuplotKeyword altdiagonal noaltdiagonal bentover nobentover +syn keyword gnuplotKeyword noundefined +" set historysize +syn keyword gnuplotKeyword historysize +" set isosamples +syn keyword gnuplotKeyword isosamples +" set key +syn keyword gnuplotKeyword key on off inside outside at left right center +syn keyword gnuplotKeyword top bottom vertical horizontal Left Right +syn keyword gnuplotKeyword opaque noopaque reverse noreverse invert maxrows +syn keyword gnuplotKeyword noinvert samplen spacing width height autotitle +syn keyword gnuplotKeyword noautotitle title enhanced noenhanced font +syn keyword gnuplotKeyword textcolor box nobox linetype linewidth maxcols +" set label +syn keyword gnuplotKeyword label left center right rotate norotate by font +syn keyword gnuplotKeyword front back textcolor point nopoint offset boxed +syn keyword gnuplotKeyword hypertext +" set linetype +syn keyword gnuplotKeyword linetype +" set link +syn keyword gnuplotKeyword link via inverse +" set loadpath +syn keyword gnuplotKeyword loadpath +" set locale +syn keyword gnuplotKeyword locale +" set logscale +syn keyword gnuplotKeyword logscale log +" set macros +syn keyword gnuplotKeyword macros +" set mapping +syn keyword gnuplotKeyword mapping cartesian spherical cylindrical +" set mouse +syn keyword gnuplotKeyword mouse doubleclick nodoubleclick zoomcoordinates +syn keyword gnuplotKeyword nozoomcoordinates ruler noruler at polardistance +syn keyword gnuplotKeyword nopolardistance deg tan format clipboardformat +syn keyword gnuplotKeyword mouseformat labels nolabels zoomjump nozoomjump +syn keyword gnuplotKeyword verbose noverbose +" set multiplot +syn keyword gnuplotKeyword multiplot title font layout rowsfirst downwards +syn keyword gnuplotKeyword downwards upwards scale offset +" set object +syn keyword gnuplotKeyword object behind fillcolor fc fs rectangle ellipse +syn keyword gnuplotKeyword circle polygon at center size units xy xx yy to +syn keyword gnuplotKeyword from +" set offsets +syn keyword gnuplotKeyword offsets +" set origin +syn keyword gnuplotKeyword origin +" set output +syn keyword gnuplotKeyword output +" set parametric +syn keyword gnuplotKeyword parametric +" show plot +syn keyword gnuplotKeyword plot add2history +" set pm3d +syn keyword gnuplotKeyword hidden3d interpolate scansautomatic scansforward +syn keyword gnuplotKeyword scansbackward depthorder flush begin center end +syn keyword gnuplotKeyword ftriangles noftriangles clip1in clip4in mean map +syn keyword gnuplotKeyword corners2color geomean harmean rms median min max +syn keyword gnuplotKeyword c1 c2 c3 c4 pm3d at nohidden3d implicit explicit +" set palette +syn keyword gnuplotKeyword palette gray color gamma rgbformulae defined +syn keyword gnuplotKeyword file functions cubehelix start cycles saturation +syn keyword gnuplotKeyword model RGB HSV CMY YIQ XYZ positive negative +syn keyword gnuplotKeyword nops_allcF ps_allcF maxcolors float int gradient +syn keyword gnuplotKeyword fit2rgbformulae rgbformulae +" set pointintervalbox +syn keyword gnuplotKeyword pointintervalbox +" set pointsize +syn keyword gnuplotKeyword pointsize +" set polar +syn keyword gnuplotKeyword polar +" set print +syn keyword gnuplotKeyword print append +" set psdir +syn keyword gnuplotKeyword psdir +" set raxis +syn keyword gnuplotKeyword raxis rrange rtics +" set samples +syn keyword gnuplotKeyword samples +" set size +syn keyword gnuplotKeyword size square nosquare ratio noratio +" set style +syn keyword gnuplotKeyword style arrow auto back border boxplot +syn keyword gnuplotKeyword candlesticks circle clustered columnstacked data +syn keyword gnuplotKeyword default ellipse empty fill[ed] financebars +syn keyword gnuplotKeyword fraction front function gap graph head[s] +syn keyword gnuplotKeyword histogram increment labels lc line linecolor +syn keyword gnuplotKeyword linetype linewidth lt lw noborder nofilled +syn keyword gnuplotKeyword nohead nooutliers nowedge off opaque outliers +syn keyword gnuplotKeyword palette pattern pi pointinterval pointsize +syn keyword gnuplotKeyword pointtype ps pt radius range rectangle +syn keyword gnuplotKeyword rowstacked screen separation size solid sorted +syn keyword gnuplotKeyword textbox transparent units unsorted userstyles +syn keyword gnuplotKeyword wedge x x2 xx xy yy +" set surface +syn keyword gnuplotKeyword surface implicit explicit +" set table +syn keyword gnuplotKeyword table +" set terminal (list of terminals) +syn keyword gnuplotKeyword terminal term push pop aed512 aed767 aifm aqua +syn keyword gnuplotKeyword be cairo cairolatex canvas cgm context corel +syn keyword gnuplotKeyword debug dumb dxf dxy800a eepic emf emxvga epscairo +syn keyword gnuplotKeyword epslatex epson_180dpi excl fig ggi gif gpic hpgl +syn keyword gnuplotKeyword grass hp2623a hp2648 hp500c hpljii hppj imagen +syn keyword gnuplotKeyword jpeg kyo latex linux lua mf mif mp next openstep +syn keyword gnuplotKeyword pbm pdf pdfcairo pm png pngcairo postscript +syn keyword gnuplotKeyword pslatex pstex pstricks qms qt regis sun svg svga +syn keyword gnuplotKeyword tek40 tek410x texdraw tgif tikz tkcanvas tpic +syn keyword gnuplotKeyword vgagl vws vx384 windows wx wxt x11 xlib +" keywords for 'set terminal' +syn keyword gnuplotKeyword color monochrome dashlength dl eps pdf fontscale +syn keyword gnuplotKeyword standalone blacktext colortext colourtext header +syn keyword gnuplotKeyword noheader mono color solid dashed notransparent +syn keyword gnuplotKeyword crop crop background input rounded butt square +syn keyword gnuplotKeyword size fsize standalone name jsdir defaultsize +syn keyword gnuplotKeyword timestamp notimestamp colour mitered beveled +syn keyword gnuplotKeyword round squared palfuncparam blacktext nec_cp6 +syn keyword gnuplotKeyword mppoints inlineimages externalimages defaultfont +syn keyword gnuplotKeyword aspect feed nofeed rotate small tiny standalone +syn keyword gnuplotKeyword oldstyle newstyle level1 leveldefault level3 +syn keyword gnuplotKeyword background nobackground solid clip noclip +syn keyword gnuplotKeyword colortext colourtext epson_60dpi epson_lx800 +syn keyword gnuplotKeyword okidata starc tandy_60dpi dpu414 nec_cp6 draft +syn keyword gnuplotKeyword medium large normal landscape portrait big +syn keyword gnuplotKeyword inches pointsmax textspecial texthidden +syn keyword gnuplotKeyword thickness depth version acceleration giant +syn keyword gnuplotKeyword delay loop optimize nooptimize pspoints +syn keyword gnuplotKeyword FNT9X17 FNT13X25 interlace nointerlace courier +syn keyword gnuplotKeyword originreset nooriginreset gparrows nogparrows +syn keyword gnuplotKeyword picenvironment nopicenvironment tightboundingbox +syn keyword gnuplotKeyword notightboundingbox charsize gppoints nogppoints +syn keyword gnuplotKeyword fontscale textscale fulldoc nofulldoc standalone +syn keyword gnuplotKeyword preamble header tikzplot tikzarrows notikzarrows +syn keyword gnuplotKeyword cmykimages externalimages noexternalimages +syn keyword gnuplotKeyword polyline vectors magnification psnfss nopsnfss +syn keyword gnuplotKeyword psnfss-version7 prologues a4paper amstex fname +syn keyword gnuplotKeyword fsize server persist widelines interlace +syn keyword gnuplotKeyword truecolor notruecolor defaultplex simplex duplex +syn keyword gnuplotKeyword nofontfiles adobeglyphnames noadobeglyphnames +syn keyword gnuplotKeyword nostandalone metric textrigid animate nopspoints +syn keyword gnuplotKeyword hpdj FNT5X9 roman emtex rgbimages bitmap +syn keyword gnuplotKeyword nobitmap providevars nointerlace add delete +syn keyword gnuplotKeyword auxfile hacktext unit raise palfuncparam +syn keyword gnuplotKeyword noauxfile nohacktext nounit noraise ctrl noctrl +syn keyword gnuplotKeyword close widget fixed dynamic tek40xx vttek +syn keyword gnuplotKeyword kc-tek40xx km-tek40xx bitgraph perltk +syn keyword gnuplotKeyword interactive red green blue interpolate mode +syn keyword gnuplotKeyword position ctrlq replotonresize position noctrlq +syn keyword gnuplotKeyword noreplotonresize +" set termoption +syn keyword gnuplotKeyword termoption font fontscale solid dashed +" set tics +syn keyword gnuplotKeyword tics add axis border mirror nomirror in out +syn keyword gnuplotKeyword scale rotate norotate by offset nooffset left +syn keyword gnuplotKeyword autojustify format font textcolor right center +" deprecated set ticslevel +syn keyword gnuplotError ticslevel ticscale +" set timestamp +syn keyword gnuplotKeyword timestamp top bottom offset font +" set timefmt +syn keyword gnuplotKeyword timefmt +" set title +syn keyword gnuplotKeyword title offset font textcolor tc +" set ranges +syn keyword gnuplotKeyword trange urange vrange +" show variables +syn keyword gnuplotKeyword variables +" show version +syn keyword gnuplotKeyword version +" set view +syn keyword gnuplotKeyword view map equal noequal xy xyz +" set x2data +syn keyword gnuplotKeyword xdata ydata zdata x2data y2data cbdata xdtics +syn keyword gnuplotKeyword ydtics zdtics x2dtics y2dtics cbdtics xzeroaxis +syn keyword gnuplotKeyword yzeroaxis zzeroaxis x2zeroaxis y2zeroaxis +syn keyword gnuplotKeyword cbzeroaxis time geographic +" set label +syn keyword gnuplotKeyword xlabel ylabel zlabel x2label y2label cblabel +syn keyword gnuplotKeyword offset font textcolor by parallel +" set range +syn keyword gnuplotKeyword xrange yrange zrange x2range y2range cbrange +" set xyplane +syn keyword gnuplotKeyword xyplane +" set zeroaxis +" set zero +syn keyword gnuplotKeyword zero +" set zeroaxis +syn keyword gnuplotKeyword zeroaxis + +" keywords for 'stats' command +syn keyword gnuplotKeyword nooutput + +" keywords for 'test' command +syn keyword gnuplotKeyword terminal palette rgb rbg grb gbr brg bgr + +" ---- Macros ---- " + +syn region gnuplotMacro start="@" end=" " + +" ---- Todos ---- " + +syn keyword gnuplotTodo contained TODO FIXME XXX + +" ---- Types: gnuplot commands ---- " + +" I set the commands as Types to distinguish them visually from keywords for the +" commands. This comes at the end of the syntax file because some commands +" are redundant with keywords. It's probably too much trouble to go and +" create special regions for each redundant keyword/command pair, which means +" that some keywords (e.g. 'p') will be highlighted as commands. + +syn keyword gnuplotStatement cd call clear evaluate exit fit help history +syn keyword gnuplotStatement load lower pause plot p print pwd quit raise +syn keyword gnuplotStatement refresh replot rep reread reset save set show +syn keyword gnuplotStatement shell splot spstats stats system test undefine +syn keyword gnuplotStatement unset update + +" ---- Define the default highlighting ---- " +" Only when an item doesn't have highlighting yet + +" ---- Comments ---- " +hi def link gnuplotComment Comment + +" ---- Constants ---- " +hi def link gnuplotString String +hi def link gnuplotNumber Number +hi def link gnuplotFloat Float + +" ---- Identifiers ---- " +hi def link gnuplotIdentifier Identifier + +" ---- Statements ---- " +hi def link gnuplotConditional Conditional +hi def link gnuplotRepeat Repeat +hi def link gnuplotKeyword Keyword +hi def link gnuplotOperator Operator + +" ---- PreProcs ---- " +hi def link gnuplotMacro Macro + +" ---- Types ---- " +hi def link gnuplotStatement Type +hi def link gnuplotFunc Identifier + +" ---- Specials ---- " +hi def link gnuplotSpecial Special +hi def link gnuplotUnit Special +hi def link gnuplotExternal Special + +" ---- Errors ---- " +hi def link gnuplotError Error +hi def link gnuplotOctalError Error + +" ---- Todos ---- " +hi def link gnuplotTodo Todo + let b:current_syntax = "gnuplot" diff --git a/runtime/syntax/go.vim b/runtime/syntax/go.vim new file mode 100644 index 0000000000..e78f8cf27c --- /dev/null +++ b/runtime/syntax/go.vim @@ -0,0 +1,208 @@ +" Vim syntax file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +" Options: +" There are some options for customizing the highlighting; the recommended +" settings are the default values, but you can write: +" let OPTION_NAME = 0 +" in your ~/.vimrc file to disable particular options. You can also write: +" let OPTION_NAME = 1 +" to enable particular options. At present, all options default to on. +" +" - g:go_highlight_array_whitespace_error +" Highlights white space after "[]". +" - g:go_highlight_chan_whitespace_error +" Highlights white space around the communications operator that don't +" follow the standard style. +" - g:go_highlight_extra_types +" Highlights commonly used library types (io.Reader, etc.). +" - g:go_highlight_space_tab_error +" Highlights instances of tabs following spaces. +" - g:go_highlight_trailing_whitespace_error +" Highlights trailing white space. + +" Quit when a (custom) syntax file was already loaded +if exists('b:current_syntax') + finish +endif + +if !exists('g:go_highlight_array_whitespace_error') + let g:go_highlight_array_whitespace_error = 1 +endif +if !exists('g:go_highlight_chan_whitespace_error') + let g:go_highlight_chan_whitespace_error = 1 +endif +if !exists('g:go_highlight_extra_types') + let g:go_highlight_extra_types = 1 +endif +if !exists('g:go_highlight_space_tab_error') + let g:go_highlight_space_tab_error = 1 +endif +if !exists('g:go_highlight_trailing_whitespace_error') + let g:go_highlight_trailing_whitespace_error = 1 +endif + +syn case match + +syn keyword goDirective package import +syn keyword goDeclaration var const type +syn keyword goDeclType struct interface + +hi def link goDirective Statement +hi def link goDeclaration Keyword +hi def link goDeclType Keyword + +" Keywords within functions +syn keyword goStatement defer go goto return break continue fallthrough +syn keyword goConditional if else switch select +syn keyword goLabel case default +syn keyword goRepeat for range + +hi def link goStatement Statement +hi def link goConditional Conditional +hi def link goLabel Label +hi def link goRepeat Repeat + +" Predefined types +syn keyword goType chan map bool string error +syn keyword goSignedInts int int8 int16 int32 int64 rune +syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr +syn keyword goFloats float32 float64 +syn keyword goComplexes complex64 complex128 + +hi def link goType Type +hi def link goSignedInts Type +hi def link goUnsignedInts Type +hi def link goFloats Type +hi def link goComplexes Type + +" Treat func specially: it's a declaration at the start of a line, but a type +" elsewhere. Order matters here. +syn match goType /\<func\>/ +syn match goDeclaration /^func\>/ + +" Predefined functions and values +syn keyword goBuiltins append cap close complex copy delete imag len +syn keyword goBuiltins make new panic print println real recover +syn keyword goConstants iota true false nil + +hi def link goBuiltins Keyword +hi def link goConstants Keyword + +" Comments; their contents +syn keyword goTodo contained TODO FIXME XXX BUG +syn cluster goCommentGroup contains=goTodo +syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell +syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell + +hi def link goComment Comment +hi def link goTodo Todo + +" Go escapes +syn match goEscapeOctal display contained "\\[0-7]\{3}" +syn match goEscapeC display contained +\\[abfnrtv\\'"]+ +syn match goEscapeX display contained "\\x\x\{2}" +syn match goEscapeU display contained "\\u\x\{4}" +syn match goEscapeBigU display contained "\\U\x\{8}" +syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link goEscapeOctal goSpecialString +hi def link goEscapeC goSpecialString +hi def link goEscapeX goSpecialString +hi def link goEscapeU goSpecialString +hi def link goEscapeBigU goSpecialString +hi def link goSpecialString Special +hi def link goEscapeError Error + +" Strings and their contents +syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError +syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup +syn region goRawString start=+`+ end=+`+ + +hi def link goString String +hi def link goRawString String + +" Characters; their contents +syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU +syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup + +hi def link goCharacter Character + +" Regions +syn region goBlock start="{" end="}" transparent fold +syn region goParen start='(' end=')' transparent + +" Integers +syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>" +syn match goHexadecimalInt "\<0x\x\+\>" +syn match goOctalInt "\<0\o\+\>" +syn match goOctalError "\<0\o*[89]\d*\>" + +hi def link goDecimalInt Integer +hi def link goHexadecimalInt Integer +hi def link goOctalInt Integer +hi def link Integer Number + +" Floating point +syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\d\+[Ee][-+]\d\+\>" + +hi def link goFloat Float + +" Imaginary literals +syn match goImaginary "\<\d\+i\>" +syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>" + +hi def link goImaginary Number + +" Spaces after "[]" +if go_highlight_array_whitespace_error != 0 + syn match goSpaceError display "\(\[\]\)\@<=\s\+" +endif + +" Spacing errors around the 'chan' keyword +if go_highlight_chan_whitespace_error != 0 + " receive-only annotation on chan type + syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@=" + " send-only annotation on chan type + syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@=" + " value-ignoring receives in a few contexts + syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+" +endif + +" Extra types commonly seen +if go_highlight_extra_types != 0 + syn match goExtraType /\<bytes\.\(Buffer\)\>/ + syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/ + syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/ + syn match goExtraType /\<unsafe\.Pointer\>/ +endif + +" Space-tab error +if go_highlight_space_tab_error != 0 + syn match goSpaceError display " \+\t"me=e-1 +endif + +" Trailing white space error +if go_highlight_trailing_whitespace_error != 0 + syn match goSpaceError display excludenl "\s\+$" +endif + +hi def link goExtraType Type +hi def link goSpaceError Error + +" Search backwards for a global declaration to start processing the syntax. +"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ + +" There's a bug in the implementation of grouphere. For now, use the +" following as a more expensive/less precise workaround. +syn sync minlines=500 + +let b:current_syntax = 'go' + +" vim: sw=2 sts=2 et diff --git a/runtime/syntax/godoc.vim b/runtime/syntax/godoc.vim new file mode 100644 index 0000000000..0603f51c83 --- /dev/null +++ b/runtime/syntax/godoc.vim @@ -0,0 +1,19 @@ +" Vim syntax file +" Language: Godoc (generated documentation for go) +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('b:current_syntax') + finish +endif + +syn case match +syn match godocTitle "^\([A-Z][A-Z ]*\)$" + + +hi def link godocTitle Title + + +let b:current_syntax = 'godoc' + +" vim: sw=2 sts=2 et diff --git a/runtime/syntax/gp.vim b/runtime/syntax/gp.vim index f46a465215..aecf7df48b 100644 --- a/runtime/syntax/gp.vim +++ b/runtime/syntax/gp.vim @@ -4,9 +4,8 @@ " Last change: 2012 Jan 08 " URL: http://pari.math.u-bordeaux.fr -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -59,33 +58,24 @@ syntax region gpParen transparent start='(' end=')' contains=ALLBUT,gpParenErro syntax match gpParenError ")" syntax match gpInParen contained "[{}]" -if version >= 508 || !exists("did_gp_syn_inits") - if version < 508 - let did_gp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink gpConditional Conditional - HiLink gpRepeat Repeat - HiLink gpError Error - HiLink gpParenError gpError - HiLink gpInParen gpError - HiLink gpStatement Statement - HiLink gpString String - HiLink gpComment Comment - HiLink gpInterface Type - HiLink gpInput Type - HiLink gpInterfaceKey Statement - HiLink gpFunction Function - HiLink gpScope Type - " contained ones - HiLink gpSpecial Special - HiLink gpTodo Todo - HiLink gpArgs Type - delcommand HiLink -endif +hi def link gpConditional Conditional +hi def link gpRepeat Repeat +hi def link gpError Error +hi def link gpParenError gpError +hi def link gpInParen gpError +hi def link gpStatement Statement +hi def link gpString String +hi def link gpComment Comment +hi def link gpInterface Type +hi def link gpInput Type +hi def link gpInterfaceKey Statement +hi def link gpFunction Function +hi def link gpScope Type +" contained ones +hi def link gpSpecial Special +hi def link gpTodo Todo +hi def link gpArgs Type let b:current_syntax = "gp" let &cpo = s:cpo_save diff --git a/runtime/syntax/gpg.vim b/runtime/syntax/gpg.vim index cde21ee563..46e2099994 100644 --- a/runtime/syntax/gpg.vim +++ b/runtime/syntax/gpg.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: gpg(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-14 +" Language: gpg(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-10-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/grads.vim b/runtime/syntax/grads.vim index 0b88549d40..50be14bb22 100644 --- a/runtime/syntax/grads.vim +++ b/runtime/syntax/grads.vim @@ -7,11 +7,8 @@ " This syntax file defines highlighting for only very few features of " the GrADS scripting language. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -53,34 +50,24 @@ syn match gradsComment "\*.*" " syn match gradsTypos "!=" " 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 hgs highlighting+yet -if version >= 508 || !exists("did_gs_syn_inits") - if version < 508 - let did_gs_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't hgs highlighting+yet - HiLink gradsStatement Statement +hi def link gradsStatement Statement - HiLink gradsString String - HiLink gradsNumber Number +hi def link gradsString String +hi def link gradsNumber Number - HiLink gradsFixVariables Special - HiLink gradsVariables Identifier - HiLink gradsglobalVariables Special - HiLink gradsConst Special +hi def link gradsFixVariables Special +hi def link gradsVariables Identifier +hi def link gradsglobalVariables Special +hi def link gradsConst Special - HiLink gradsClassMethods Function +hi def link gradsClassMethods Function - HiLink gradsOperator Operator - HiLink gradsComment Comment +hi def link gradsOperator Operator +hi def link gradsComment Comment - HiLink gradsTypos Error +hi def link gradsTypos Error - delcommand HiLink -endif let b:current_syntax = "grads" diff --git a/runtime/syntax/gretl.vim b/runtime/syntax/gretl.vim index 37299b894a..671142a9ea 100644 --- a/runtime/syntax/gretl.vim +++ b/runtime/syntax/gretl.vim @@ -4,20 +4,13 @@ " Last Change: 2006 Apr 30 " Filenames: *.inp *.gretl " URL: http://uosis.mif.vu.lt/~zemlys/vim-syntax/gretl.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,. -else - set iskeyword=@,48-57,_,. -endif +setlocal iskeyword=@,48-57,_,. syn case match @@ -68,34 +61,24 @@ syn match gBCend /\*)/ syn region gBlockComment matchgroup=gCommentStart start="(\*" end="\*)" " 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_r_syn_inits") - if version < 508 - let did_r_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink gComment Comment - HiLink gCommentStart Comment - HiLink gBlockComment Comment - HiLink gString String - HiLink gNumber Number - HiLink gBoolean Boolean - HiLink gFloat Float - HiLink gCommands Repeat - HiLink gGenrFunc Type - HiLink gDelimiter Delimiter - HiLink gError Error - HiLink gBraceError Error - HiLink gCurlyError Error - HiLink gParenError Error - HiLink gIdentifier Normal - HiLink gVariable Identifier - HiLink gArrow Repeat - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link gComment Comment +hi def link gCommentStart Comment +hi def link gBlockComment Comment +hi def link gString String +hi def link gNumber Number +hi def link gBoolean Boolean +hi def link gFloat Float +hi def link gCommands Repeat +hi def link gGenrFunc Type +hi def link gDelimiter Delimiter +hi def link gError Error +hi def link gBraceError Error +hi def link gCurlyError Error +hi def link gParenError Error +hi def link gIdentifier Normal +hi def link gVariable Identifier +hi def link gArrow Repeat let b:current_syntax="gretl" diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index 2056bd16d0..2245b79d04 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -2,9 +2,9 @@ " Language: Groovy " Original Author: Alessio Pace <billy.corgan@tiscali.it> " Maintainer: Tobias Rapp <yahuxo@gmx.de> -" Version: 0.1.13 +" Version: 0.1.16 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2013 Apr 24 +" Last Change: 2016 May 23 " THE ORIGINAL AUTHOR'S NOTES: " @@ -44,11 +44,9 @@ " Let me know if you like it or send me patches, so that I can improve it " when I have time -" Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif " we define it here so that included files can test for it @@ -58,13 +56,6 @@ endif let s:cpo_save = &cpo set cpo&vim -" don't use standard HiLink, it will not work with included syntax files -if version < 508 - command! -nargs=+ GroovyHiLink hi link <args> -else - command! -nargs=+ GroovyHiLink hi def link <args> -endif - " ########################## " Java stuff taken from java.vim " some characters that cannot be in a groovy program (outside a string) @@ -144,9 +135,9 @@ if exists("groovy_highlight_groovy_lang_ids") || exists("groovy_highlight_groovy syn keyword groovyJavaLangObject clone equals finalize getClass hashCode syn keyword groovyJavaLangObject notify notifyAll toString wait - GroovyHiLink groovyLangClass groovyConstant - GroovyHiLink groovyJavaLangClass groovyExternal - GroovyHiLink groovyJavaLangObject groovyConstant + hi def link groovyLangClass groovyConstant + hi def link groovyJavaLangClass groovyExternal + hi def link groovyJavaLangObject groovyConstant syn cluster groovyTop add=groovyJavaLangObject,groovyJavaLangClass,groovyLangClass syn cluster groovyClasses add=groovyJavaLangClass,groovyLangClass endif @@ -157,7 +148,7 @@ syn match groovyOperator "\.\." syn match groovyOperator "<\{2,3}" syn match groovyOperator ">\{2,3}" syn match groovyOperator "->" -syn match groovyExternal '^#!.*[/\\]groovy\>' +syn match groovyLineComment '^\%1l#!.*' " Shebang line syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>" " Groovy JDK stuff @@ -220,10 +211,9 @@ syn region groovyComment start="/\*" end="\*/" contains=@groovyCommen syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1 syn match groovyCommentStar contained "^\s*\*$" syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell -syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell -GroovyHiLink groovyCommentString groovyString -GroovyHiLink groovyComment2String groovyString -GroovyHiLink groovyCommentCharacter groovyCharacter +hi def link groovyCommentString groovyString +hi def link groovyComment2String groovyString +hi def link groovyCommentCharacter groovyCharacter syn cluster groovyTop add=groovyComment,groovyLineComment @@ -256,17 +246,20 @@ 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 -GroovyHiLink groovyELExpr Identifier +hi def link groovyELExpr Identifier " TODO: better matching. I am waiting to understand how it really works in groovy " syn region groovyClosureParamsBraces start=+|+ end=+|+ contains=groovyClosureParams " syn match groovyClosureParams "[ a-zA-Z0-9_*]\+" contained -" GroovyHiLink groovyClosureParams Identifier +" hi def link groovyClosureParams Identifier " next line disabled, it can cause a crash for a long line "syn match groovyStringError +"\([^"\\]\|\\.\)*$+ @@ -327,23 +320,21 @@ if exists("groovy_highlight_debug") syn cluster groovyTop add=groovyDebug - if version >= 508 || !exists("did_c_syn_inits") - GroovyHiLink groovyDebug Debug - GroovyHiLink groovyDebugString DebugString - GroovyHiLink groovyDebugStringError groovyError - GroovyHiLink groovyDebugType DebugType - GroovyHiLink groovyDebugBoolean DebugBoolean - GroovyHiLink groovyDebugNumber Debug - GroovyHiLink groovyDebugSpecial DebugSpecial - GroovyHiLink groovyDebugSpecialCharacter DebugSpecial - GroovyHiLink groovyDebugCharacter DebugString - GroovyHiLink groovyDebugParen Debug - - GroovyHiLink DebugString String - GroovyHiLink DebugSpecial Special - GroovyHiLink DebugBoolean Boolean - GroovyHiLink DebugType Type - endif + hi def link groovyDebug Debug + hi def link groovyDebugString DebugString + hi def link groovyDebugStringError groovyError + hi def link groovyDebugType DebugType + hi def link groovyDebugBoolean DebugBoolean + hi def link groovyDebugNumber Debug + hi def link groovyDebugSpecial DebugSpecial + hi def link groovyDebugSpecialCharacter DebugSpecial + hi def link groovyDebugCharacter DebugString + hi def link groovyDebugParen Debug + + hi def link DebugString String + hi def link DebugSpecial Special + hi def link DebugBoolean Boolean + hi def link DebugType Type endif " Match all Exception classes @@ -377,7 +368,7 @@ exec "syn sync ccomment groovyComment minlines=" . groovy_minlines if exists("groovy_mark_braces_in_parens_as_errors") syn match groovyInParen contained "[{}]" - GroovyHiLink groovyInParen groovyError + hi def link groovyInParen groovyError syn cluster groovyTop add=groovyInParen endif @@ -386,7 +377,7 @@ syn region groovyParenT transparent matchgroup=groovyParen start="(" end=")" syn region groovyParenT1 transparent matchgroup=groovyParen1 start="(" end=")" contains=@groovyTop,groovyParenT2 contained syn region groovyParenT2 transparent matchgroup=groovyParen2 start="(" end=")" contains=@groovyTop,groovyParenT contained syn match groovyParenError ")" -GroovyHiLink groovyParenError groovyError +hi def link groovyParenError groovyError " catch errors caused by wrong square parenthesis syn region groovyParenT transparent matchgroup=groovyParen start="\[" end="\]" contains=@groovyTop,groovyParenT1 @@ -396,61 +387,54 @@ syn match groovyParenError "\]" " ############################### " java.vim default highlighting -if version >= 508 || !exists("did_groovy_syn_inits") - if version < 508 - let did_groovy_syn_inits = 1 - endif - GroovyHiLink groovyFuncDef Function - GroovyHiLink groovyBraces Function - GroovyHiLink groovyBranch Conditional - GroovyHiLink groovyUserLabelRef groovyUserLabel - GroovyHiLink groovyLabel Label - GroovyHiLink groovyUserLabel Label - GroovyHiLink groovyConditional Conditional - GroovyHiLink groovyRepeat Repeat - GroovyHiLink groovyExceptions Exception - GroovyHiLink groovyAssert Statement - GroovyHiLink groovyStorageClass StorageClass - GroovyHiLink groovyMethodDecl groovyStorageClass - GroovyHiLink groovyClassDecl groovyStorageClass - GroovyHiLink groovyScopeDecl groovyStorageClass - GroovyHiLink groovyBoolean Boolean - GroovyHiLink groovySpecial Special - GroovyHiLink groovySpecialError Error - GroovyHiLink groovySpecialCharError Error - GroovyHiLink groovyString String - GroovyHiLink groovyRegexChar String - GroovyHiLink groovyCharacter Character - GroovyHiLink groovySpecialChar SpecialChar - GroovyHiLink groovyNumber Number - GroovyHiLink groovyError Error - GroovyHiLink groovyStringError Error - GroovyHiLink groovyStatement Statement - GroovyHiLink groovyOperator Operator - GroovyHiLink groovyComment Comment - GroovyHiLink groovyDocComment Comment - GroovyHiLink groovyLineComment Comment - GroovyHiLink groovyConstant Constant - GroovyHiLink groovyTypedef Typedef - GroovyHiLink groovyTodo Todo - - GroovyHiLink groovyCommentTitle SpecialComment - GroovyHiLink groovyDocTags Special - GroovyHiLink groovyDocParam Function - GroovyHiLink groovyCommentStar groovyComment - - GroovyHiLink groovyType Type - GroovyHiLink groovyExternal Include - - GroovyHiLink htmlComment Special - GroovyHiLink htmlCommentPart Special - GroovyHiLink groovySpaceError Error - GroovyHiLink groovyJDKBuiltin Special - GroovyHiLink groovyJDKOperOverl Operator - GroovyHiLink groovyJDKMethods Function -endif - -delcommand GroovyHiLink +hi def link groovyFuncDef Function +hi def link groovyBraces Function +hi def link groovyBranch Conditional +hi def link groovyUserLabelRef groovyUserLabel +hi def link groovyLabel Label +hi def link groovyUserLabel Label +hi def link groovyConditional Conditional +hi def link groovyRepeat Repeat +hi def link groovyExceptions Exception +hi def link groovyAssert Statement +hi def link groovyStorageClass StorageClass +hi def link groovyMethodDecl groovyStorageClass +hi def link groovyClassDecl groovyStorageClass +hi def link groovyScopeDecl groovyStorageClass +hi def link groovyBoolean Boolean +hi def link groovySpecial Special +hi def link groovySpecialError Error +hi def link groovySpecialCharError Error +hi def link groovyString String +hi def link groovyRegexChar String +hi def link groovyCharacter Character +hi def link groovySpecialChar SpecialChar +hi def link groovyNumber Number +hi def link groovyError Error +hi def link groovyStringError Error +hi def link groovyStatement Statement +hi def link groovyOperator Operator +hi def link groovyComment Comment +hi def link groovyDocComment Comment +hi def link groovyLineComment Comment +hi def link groovyConstant Constant +hi def link groovyTypedef Typedef +hi def link groovyTodo Todo + +hi def link groovyCommentTitle SpecialComment +hi def link groovyDocTags Special +hi def link groovyDocParam Function +hi def link groovyCommentStar groovyComment + +hi def link groovyType Type +hi def link groovyExternal Include + +hi def link htmlComment Special +hi def link htmlCommentPart Special +hi def link groovySpaceError Error +hi def link groovyJDKBuiltin Special +hi def link groovyJDKOperOverl Operator +hi def link groovyJDKMethods Function let b:current_syntax = "groovy" diff --git a/runtime/syntax/group.vim b/runtime/syntax/group.vim index ab2d56d6a5..f62a4a1d69 100644 --- a/runtime/syntax/group.vim +++ b/runtime/syntax/group.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: group(5) user group file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2012-08-05 +" Language: group(5) user group file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2012-08-05 if exists("b:current_syntax") finish diff --git a/runtime/syntax/grub.vim b/runtime/syntax/grub.vim index f63449db0e..3743ae3643 100644 --- a/runtime/syntax/grub.vim +++ b/runtime/syntax/grub.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: grub(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: grub(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/gsp.vim b/runtime/syntax/gsp.vim index e7b1b1632f..6270b2af64 100644 --- a/runtime/syntax/gsp.vim +++ b/runtime/syntax/gsp.vim @@ -5,11 +5,8 @@ " Filenames: *.gsp " URL: http://www.constructicon.com/~nharward/vim/syntax/gsp.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,21 +15,13 @@ if !exists("main_syntax") endif " Source HTML syntax -if version < 600 - source <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim unlet b:current_syntax syn case match " Include Java syntax -if version < 600 - syn include @gspJava <sfile>:p:h/java.vim -else - syn include @gspJava syntax/java.vim -endif +syn include @gspJava syntax/java.vim let s:cpo_save = &cpo set cpo&vim diff --git a/runtime/syntax/gtkrc.vim b/runtime/syntax/gtkrc.vim index 57054a21d3..9c1bc2abb8 100644 --- a/runtime/syntax/gtkrc.vim +++ b/runtime/syntax/gtkrc.vim @@ -6,19 +6,12 @@ " URL: http://trific.ath.cx/Ftp/vim/syntax/gtkrc.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -if version >= 600 - setlocal iskeyword=_,-,a-z,A-Z,48-57 -else - set iskeyword=_,-,a-z,A-Z,48-57 -endif +setlocal iskeyword=_,-,a-z,A-Z,48-57 syn case match @@ -86,57 +79,48 @@ syn sync minlines=50 syn sync match gtkrcSyncClass groupthere NONE "^\s*class\>" " Define the default highlighting -if version >= 508 || !exists("did_gtkrc_syntax_inits") - if version < 508 - let did_gtkrc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink gtkrcComment Comment - HiLink gtkrcFixme Todo - - HiLink gtkrcInclude Preproc - - HiLink gtkrcACString gtkrcString - HiLink gtkrcBString gtkrcString - HiLink gtkrcString String - HiLink gtkrcNumber Number - HiLink gtkrcStateName gtkrcConstant - HiLink gtkrcPriorityName gtkrcConstant - HiLink gtkrcTextDirName gtkrcConstant - HiLink gtkrcSettingsName Function - HiLink gtkrcStockName Function - HiLink gtkrcConstant Constant - - HiLink gtkrcPathSpecial gtkrcSpecial - HiLink gtkrcWPathSpecial gtkrcSpecial - HiLink gtkrcRGBColor gtkrcSpecial - HiLink gtkrcKeyMod gtkrcSpecial - HiLink gtkrcSpecial Special - - HiLink gtkrcTop gtkrcKeyword - HiLink gtkrcPathSet gtkrcKeyword - HiLink gtkrcStyleKeyword gtkrcKeyword - HiLink gtkrcFunction gtkrcKeyword - HiLink gtkrcBind gtkrcKeyword - HiLink gtkrcKeyword Keyword - - HiLink gtkrcClassNameGnome gtkrcGtkClass - HiLink gtkrcClassName gtkrcGtkClass - HiLink gtkrcFunctionName gtkrcGtkClass - HiLink gtkrcGtkClass Type - - HiLink gtkrcImage gtkrcOtherword - HiLink gtkrcOtherword Function - - HiLink gtkrcParenError gtkrcError - HiLink gtkrcBraceError gtkrcError - HiLink gtkrcBracketError gtkrcError - HiLink gtkrcError Error - - delcommand HiLink -endif + +hi def link gtkrcComment Comment +hi def link gtkrcFixme Todo + +hi def link gtkrcInclude Preproc + +hi def link gtkrcACString gtkrcString +hi def link gtkrcBString gtkrcString +hi def link gtkrcString String +hi def link gtkrcNumber Number +hi def link gtkrcStateName gtkrcConstant +hi def link gtkrcPriorityName gtkrcConstant +hi def link gtkrcTextDirName gtkrcConstant +hi def link gtkrcSettingsName Function +hi def link gtkrcStockName Function +hi def link gtkrcConstant Constant + +hi def link gtkrcPathSpecial gtkrcSpecial +hi def link gtkrcWPathSpecial gtkrcSpecial +hi def link gtkrcRGBColor gtkrcSpecial +hi def link gtkrcKeyMod gtkrcSpecial +hi def link gtkrcSpecial Special + +hi def link gtkrcTop gtkrcKeyword +hi def link gtkrcPathSet gtkrcKeyword +hi def link gtkrcStyleKeyword gtkrcKeyword +hi def link gtkrcFunction gtkrcKeyword +hi def link gtkrcBind gtkrcKeyword +hi def link gtkrcKeyword Keyword + +hi def link gtkrcClassNameGnome gtkrcGtkClass +hi def link gtkrcClassName gtkrcGtkClass +hi def link gtkrcFunctionName gtkrcGtkClass +hi def link gtkrcGtkClass Type + +hi def link gtkrcImage gtkrcOtherword +hi def link gtkrcOtherword Function + +hi def link gtkrcParenError gtkrcError +hi def link gtkrcBraceError gtkrcError +hi def link gtkrcBracketError gtkrcError +hi def link gtkrcError Error + let b:current_syntax = "gtkrc" diff --git a/runtime/syntax/haml.vim b/runtime/syntax/haml.vim index bf7a073633..5369695c22 100644 --- a/runtime/syntax/haml.vim +++ b/runtime/syntax/haml.vim @@ -2,7 +2,7 @@ " Language: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.haml -" Last Change: 2010 Aug 09 +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish @@ -67,7 +67,7 @@ syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascri syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop -syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend +syn region hamlJavascriptBlock start="^\z(\s*\)%script\%((type=[\"']text/javascript[\"'])\)\=\s*$" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend syn match hamlError "\$" contained diff --git a/runtime/syntax/hamster.vim b/runtime/syntax/hamster.vim index bd52300ca0..64d9598a71 100644 --- a/runtime/syntax/hamster.vim +++ b/runtime/syntax/hamster.vim @@ -12,10 +12,8 @@ " for news and mail, a build-in script language, the GUI allows translation to " other languages, it can be used in a network and that's not all features... " -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -358,24 +356,14 @@ syn cluster hamsterComment contains=hamsterHashComment syn sync ccomment hamsterHashComment " 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_hamster_syn_inits") - if version < 508 - let did_hamster_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink hamsterHashComment Comment - HiLink hamsterSpecial Special - HiLink hamsterStatement Statement - HiLink hamsterString String - HiLink hamsterFunction Function +hi def link hamsterHashComment Comment +hi def link hamsterSpecial Special +hi def link hamsterStatement Statement +hi def link hamsterString String +hi def link hamsterFunction Function - delcommand HiLink -endif let b:current_syntax = "hamster" diff --git a/runtime/syntax/haskell.vim b/runtime/syntax/haskell.vim index 8afca048cc..e5128a12ab 100644 --- a/runtime/syntax/haskell.vim +++ b/runtime/syntax/haskell.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Haskell " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> -" Last Change: 2008 Dec 15 +" Last Change: 2018 Mar 29 by Marcin Szamotulski " Original Author: John Williams <jrw@pobox.com> " " Thanks to Ryan Crumley for suggestions and John Meacham for @@ -32,16 +32,14 @@ " to attribution of work. " 2008 Dec 15: Added comments as contained element in import statements -" Remove any old syntax stuff hanging around -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 " (Qualified) identifiers (no default highlighting) -syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" -syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" +syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell +syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell " Infix operators--most punctuation characters and any (qualified) identifier " enclosed in `backquotes`. An operator starting with : is a constructor, @@ -58,18 +56,18 @@ syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}" syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" syn match hsSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)" syn match hsSpecialCharError contained "\\&\|'''\+" -syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar +syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@NoSpell syn match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError -syn match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" -syn match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" +syn match hsNumber "\v<[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*>|<0[oO]_*%(_*[0-7])*>|<0[bB]_*[01]%(_*[01])*>" +syn match hsFloat "\v<[0-9]%(_*[0-9])*\.[0-9]%(_*[0-9])*%(_*[eE][-+]?[0-9]%(_*[0-9])*)?>|<[0-9]%(_*[0-9])*_*[eE][-+]?[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*\.[0-9a-fA-F]%(_*[0-9a-fA-F])*%(_*[pP][-+]?[0-9]%(_*[0-9])*)?>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*_*[pP][-+]?[0-9]%(_*[0-9])*>" -" Keyword definitions. These must be patters instead of keywords +" Keyword definitions. These must be patterns instead of keywords " because otherwise they would match as keywords at the start of a " "literate" comment (see lhs.vim). syn match hsModule "\<module\>" -syn match hsImport "\<import\>.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment -syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" +syn match hsImport "\<import\>.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment,@NoSpell +syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" contains=@NoSpell syn match hsInfix "\<\(infix\|infixl\|infixr\)\>" syn match hsStructure "\<\(class\|data\|deriving\|instance\|default\|where\)\>" syn match hsTypedef "\<\(type\|newtype\)\>" @@ -99,8 +97,8 @@ endif " Comments -syn match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" -syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment +syn match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=@Spell +syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment,@Spell syn region hsPragma start="{-#" end="#-}" " C Preprocessor directives. Shamelessly ripped from c.vim and trimmed @@ -127,67 +125,57 @@ syntax match cCommentStartError display "/\*"me=e-1 contained syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained " 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_hs_syntax_inits") - if version < 508 - let did_hs_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink hsModule hsStructure - HiLink hsImport Include - HiLink hsImportMod hsImport - HiLink hsInfix PreProc - HiLink hsStructure Structure - HiLink hsStatement Statement - HiLink hsConditional Conditional - HiLink hsSpecialChar SpecialChar - HiLink hsTypedef Typedef - HiLink hsVarSym hsOperator - HiLink hsConSym hsOperator - HiLink hsOperator Operator - if exists("hs_highlight_delimiters") - " Some people find this highlighting distracting. - HiLink hsDelimiter Delimiter - endif - HiLink hsSpecialCharError Error - HiLink hsString String - HiLink hsCharacter Character - HiLink hsNumber Number - HiLink hsFloat Float - HiLink hsConditional Conditional - HiLink hsLiterateComment hsComment - HiLink hsBlockComment hsComment - HiLink hsLineComment hsComment - HiLink hsComment Comment - HiLink hsPragma SpecialComment - HiLink hsBoolean Boolean - HiLink hsType Type - HiLink hsMaybe hsEnumConst - HiLink hsOrdering hsEnumConst - HiLink hsEnumConst Constant - HiLink hsDebug Debug - - HiLink cCppString hsString - HiLink cCommentStart hsComment - HiLink cCommentError hsError - HiLink cCommentStartError hsError - HiLink cInclude Include - HiLink cPreProc PreProc - HiLink cDefine Macro - HiLink cIncluded hsString - HiLink cError Error - HiLink cPreCondit PreCondit - HiLink cComment Comment - HiLink cCppSkip cCppOut - HiLink cCppOut2 cCppOut - HiLink cCppOut Comment - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link hsModule hsStructure +hi def link hsImport Include +hi def link hsImportMod hsImport +hi def link hsInfix PreProc +hi def link hsStructure Structure +hi def link hsStatement Statement +hi def link hsConditional Conditional +hi def link hsSpecialChar SpecialChar +hi def link hsTypedef Typedef +hi def link hsVarSym hsOperator +hi def link hsConSym hsOperator +hi def link hsOperator Operator +if exists("hs_highlight_delimiters") +" Some people find this highlighting distracting. +hi def link hsDelimiter Delimiter endif +hi def link hsSpecialCharError Error +hi def link hsString String +hi def link hsCharacter Character +hi def link hsNumber Number +hi def link hsFloat Float +hi def link hsConditional Conditional +hi def link hsLiterateComment hsComment +hi def link hsBlockComment hsComment +hi def link hsLineComment hsComment +hi def link hsComment Comment +hi def link hsPragma SpecialComment +hi def link hsBoolean Boolean +hi def link hsType Type +hi def link hsMaybe hsEnumConst +hi def link hsOrdering hsEnumConst +hi def link hsEnumConst Constant +hi def link hsDebug Debug + +hi def link cCppString hsString +hi def link cCommentStart hsComment +hi def link cCommentError hsError +hi def link cCommentStartError hsError +hi def link cInclude Include +hi def link cPreProc PreProc +hi def link cDefine Macro +hi def link cIncluded hsString +hi def link cError Error +hi def link cPreCondit PreCondit +hi def link cComment Comment +hi def link cCppSkip cCppOut +hi def link cCppOut2 cCppOut +hi def link cCppOut Comment + let b:current_syntax = "haskell" diff --git a/runtime/syntax/haste.vim b/runtime/syntax/haste.vim index b889c5c594..79e9f5ec56 100644 --- a/runtime/syntax/haste.vim +++ b/runtime/syntax/haste.vim @@ -12,11 +12,8 @@ if exists("b:current_syntax") finish endif -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/hastepreproc.vim b/runtime/syntax/hastepreproc.vim index 3fcb8ddd31..f08bf3fbf3 100644 --- a/runtime/syntax/hastepreproc.vim +++ b/runtime/syntax/hastepreproc.vim @@ -5,24 +5,13 @@ " files " Version: 0.5 -" HASTE +" quit when a syntax file was already loaded if exists("b:current_syntax") - finish -endif -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") finish endif -" Read the C syntax to start with -if version < 600 - so <sfile>:p:h/haste.vim -else - runtime! syntax/haste.vim - unlet b:current_syntax -endif +" Read the haste syntax to start with +runtime! syntax/haste.vim +unlet b:current_syntax " case is significant syn case match diff --git a/runtime/syntax/hb.vim b/runtime/syntax/hb.vim index d4de3ff1e1..7bff1df9fb 100644 --- a/runtime/syntax/hb.vim +++ b/runtime/syntax/hb.vim @@ -4,11 +4,8 @@ " URL: http://bachue.com/hb/vim/syntax/hb.vim " Last Change: 2012 Jan 08 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -63,31 +60,21 @@ syn region HBText matchgroup=HBDirectiveKeyword start=/^:\(set\|out\)\s*\S\+.*$/ syn match HBComment "^#.*$" " 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_hb_syntax_inits") - if version < 508 - let did_hb_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink HBhtmlString String - HiLink HBhtmlTagN Function - HiLink htmlSpecialChar String - - HiLink HBInvalidLine Error - HiLink HBFoobar Comment - hi HBFileName guibg=lightgray guifg=black - HiLink HBDirectiveError Error - HiLink HBDirectiveBlockEnd HBDirectiveKeyword - hi HBDirectiveKeyword guibg=lightgray guifg=darkgreen - HiLink HBComment Comment - HiLink HBhtmlTagSk Statement - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link HBhtmlString String +hi def link HBhtmlTagN Function +hi def link htmlSpecialChar String + +hi def link HBInvalidLine Error +hi def link HBFoobar Comment +hi HBFileName guibg=lightgray guifg=black +hi def link HBDirectiveError Error +hi def link HBDirectiveBlockEnd HBDirectiveKeyword +hi HBDirectiveKeyword guibg=lightgray guifg=darkgreen +hi def link HBComment Comment +hi def link HBhtmlTagSk Statement + syn sync match Normal grouphere NONE "^:\s*$" syn sync match Normal grouphere NONE "^:\s*lib\s\+[^ \t]\+$" diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim index 3368b1ddc5..693a113735 100644 --- a/runtime/syntax/help.vim +++ b/runtime/syntax/help.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Vim help file " Maintainer: Bram Moolenaar (Bram@vim.org) -" Last Change: 2014 Feb 12 +" Last Change: 2017 Oct 19 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -45,6 +45,7 @@ syn match helpVim "VIM 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") @@ -53,10 +54,13 @@ else syn match helpIgnore "." contained endif syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes: +syn keyword helpWarning WARNING WARNING: Warning: +syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated: syn match helpSpecial "\<N\>" syn match helpSpecial "\<N\.$"me=e-1 syn match helpSpecial "\<N\.\s"me=e-2 syn match helpSpecial "(N\>"ms=s+1 + syn match helpSpecial "\[N]" " avoid highlighting N N in help.txt syn match helpSpecial "N N"he=s+1 @@ -82,6 +86,9 @@ syn match helpSpecial "\[arguments]" syn match helpSpecial "\[ident]" syn match helpSpecial "\[addr]" syn match helpSpecial "\[group]" +" Don't highlight [converted] and others that do not have a tag +syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]" + syn match helpSpecial "CTRL-." syn match helpSpecial "CTRL-Break" syn match helpSpecial "CTRL-PageUp" @@ -168,6 +175,8 @@ hi def link helpOption Type hi def link helpNotVi Special hi def link helpSpecial Special hi def link helpNote Todo +hi def link helpWarning Todo +hi def link helpDeprecated Todo hi def link helpComment Comment hi def link helpConstant Constant diff --git a/runtime/syntax/hercules.vim b/runtime/syntax/hercules.vim index 02d8e9bb78..d305707662 100644 --- a/runtime/syntax/hercules.vim +++ b/runtime/syntax/hercules.vim @@ -7,11 +7,8 @@ " that an IC's physical design matches its logical design and " satisfies manufacturing rules. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -101,32 +98,21 @@ syn match herculesOutput "error\s*=\s*(.*)" syn sync lines=100 " 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_hercules_syntax_inits") - if version < 508 - let did_hercules_syntax_inits = 1 - " Default methods for highlighting. - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink herculesStatement Statement - HiLink herculesType Type - HiLink herculesComment Comment - HiLink herculesPreProc PreProc - HiLink herculesTodo Todo - HiLink herculesOutput Include - HiLink herculesCmdCmnt Identifier - HiLink herculesNumber Number - HiLink herculesBraceError herculesError - HiLink herculesCurlyError herculesError - HiLink herculesParenError herculesError - HiLink herculesError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link herculesStatement Statement +hi def link herculesType Type +hi def link herculesComment Comment +hi def link herculesPreProc PreProc +hi def link herculesTodo Todo +hi def link herculesOutput Include +hi def link herculesCmdCmnt Identifier +hi def link herculesNumber Number +hi def link herculesBraceError herculesError +hi def link herculesCurlyError herculesError +hi def link herculesParenError herculesError +hi def link herculesError Error + let b:current_syntax = "hercules" diff --git a/runtime/syntax/hex.vim b/runtime/syntax/hex.vim index 40c655395f..35edf08e9f 100644 --- a/runtime/syntax/hex.vim +++ b/runtime/syntax/hex.vim @@ -1,56 +1,88 @@ " Vim syntax file -" Language: Intel hex MCS51 -" Maintainer: Sams Ricahrd <sams@ping.at> -" Last Change: 2003 Apr 25 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Language: Intel HEX +" Maintainer: Markus Heidelberg <markus.heidelberg@web.de> +" Previous version: Sams Ricahrd <sams@ping.at> +" Last Change: 2015 Feb 24 + +" Each record (line) is built as follows: +" +" field digits states +" +" +----------+ +" | start | 1 (':') hexRecStart +" +----------+ +" | count | 2 hexDataByteCount +" +----------+ +" | address | 4 hexNoAddress, hexDataAddress, (hexAddressFieldUnknown) +" +----------+ +" | type | 2 hexRecType, (hexRecTypeUnknown) +" +----------+ +" | data | 0..510 hexDataOdd, hexDataEven, hexExtendedAddress, hexStartAddress, (hexDataFieldUnknown, hexDataUnexpected) +" +----------+ +" | checksum | 2 hexChecksum +" +----------+ +" +" States in parentheses in the upper format description indicate that they +" should not appear in a valid file. + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -syn case ignore +syn match hexRecStart "^:" + +syn match hexDataByteCount "^:[0-9a-fA-F]\{2}" contains=hexRecStart nextgroup=hexAddress + +syn match hexAddress "[0-9a-fA-F]\{4}" transparent contained nextgroup=hexRecTypeUnknown,hexRecType +" The address field groups include the record type field in the last 2 +" characters, the proper match for highlighting follows below. +syn match hexAddressFieldUnknown "^:[0-9a-fA-F]\{8}" contains=hexDataByteCount nextgroup=hexDataFieldUnknown,hexChecksum +syn match hexDataAddress "^:[0-9a-fA-F]\{6}00" contains=hexDataByteCount nextgroup=hexDataOdd,hexChecksum +syn match hexNoAddress "^:[0-9a-fA-F]\{6}01" contains=hexDataByteCount nextgroup=hexDataUnexpected,hexChecksum +syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[24]" contains=hexDataByteCount nextgroup=hexExtendedAddress +syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[35]" contains=hexDataByteCount nextgroup=hexStartAddress + +syn match hexRecTypeUnknown "[0-9a-fA-F]\{2}" contained +syn match hexRecType "0[0-5]" contained -" storage types +syn match hexDataFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=hexDataFieldUnknown,hexChecksum +" alternating highlight per byte for easier reading +syn match hexDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=hexDataEven,hexChecksum +syn match hexDataEven "[0-9a-fA-F]\{2}" contained nextgroup=hexDataOdd,hexChecksum +" data bytes which should not exist +syn match hexDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=hexDataUnexpected,hexChecksum +" Data digit pair regex usage also results in only highlighting the checksum +" if the number of data characters is even. -syn match hexChecksum "[0-9a-fA-F]\{2}$" -syn match hexAdress "^:[0-9a-fA-F]\{6}" contains=hexDataByteCount -syn match hexRecType "^:[0-9a-fA-F]\{8}" contains=hexAdress -syn match hexDataByteCount contained "^:[0-9a-fA-F]\{2}" contains=hexStart -syn match hexStart contained "^:" -syn match hexExtAdrRec "^:02000002[0-9a-fA-F]\{4}" contains=hexSpecRec -syn match hexExtLinAdrRec "^:02000004[0-9a-fA-F]\{4}" contains=hexSpecRec -syn match hexSpecRec contained "^:0[02]00000[124]" contains=hexStart -syn match hexEOF "^:00000001" contains=hexStart +" special data fields +syn match hexExtendedAddress "[0-9a-fA-F]\{4}" contained nextgroup=hexDataUnexpected,hexChecksum +syn match hexStartAddress "[0-9a-fA-F]\{8}" contained nextgroup=hexDataUnexpected,hexChecksum -syn case match +syn match hexChecksum "[0-9a-fA-F]\{2}$" contained + +" Folding Data Records below an Extended Segment/Linear Address Record +syn region hexExtAdrBlock start="^:[0-9a-fA-F]\{7}[24]" skip="^:[0-9a-fA-F]\{7}0" end="^:"me=s-1 fold transparent " 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_hex_syntax_inits") - if version < 508 - let did_hex_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink hexStart SpecialKey - HiLink hexDataByteCount Constant - HiLink hexAdress Comment - HiLink hexRecType WarningMsg - HiLink hexChecksum Search - HiLink hexExtAdrRec hexAdress - HiLink hexEOF hexSpecRec - HiLink hexExtLinAdrRec hexAdress - HiLink hexSpecRec DiffAdd - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link hexRecStart hexRecType +hi def link hexDataByteCount Constant +hi def hexAddressFieldUnknown term=italic cterm=italic gui=italic +hi def link hexDataAddress Comment +hi def link hexNoAddress DiffAdd +hi def link hexRecTypeUnknown hexRecType +hi def link hexRecType WarningMsg +hi def hexDataFieldUnknown term=italic cterm=italic gui=italic +hi def hexDataOdd term=bold cterm=bold gui=bold +hi def hexDataEven term=NONE cterm=NONE gui=NONE +hi def link hexDataUnexpected Error +hi def link hexExtendedAddress hexDataAddress +hi def link hexStartAddress hexDataAddress +hi def link hexChecksum DiffChange + let b:current_syntax = "hex" diff --git a/runtime/syntax/hog.vim b/runtime/syntax/hog.vim index 7f01d7fc11..7206815202 100644 --- a/runtime/syntax/hog.vim +++ b/runtime/syntax/hog.vim @@ -1,350 +1,199 @@ -" Snort syntax file -" Language: Snort Configuration File (see: http://www.snort.org) -" Maintainer: Phil Wood, cornett@arpa.net -" Last Change: $Date: 2004/06/13 17:41:17 $ -" Filenames: *.hog *.rules snort.conf vision.conf -" URL: http://home.lanl.gov/cpw/vim/syntax/hog.vim -" Snort Version: 1.8 By Martin Roesch (roesch@clark.net, www.snort.org) -" TODO include all 1.8 syntax - -" For version 5.x: Clear all syntax items -if version < 600 - syntax clear -elseif exists("b:current_syntax") -" For version 6.x: Quit when a syntax file was already loaded - finish +" Vim syntax file +" Language: hog (Snort.conf + .rules) +" Maintainer: Victor Roemer, <vroemer@badsec.org>. +" Last Change: 2015 Oct 24 -> Rename syntax items from Snort -> Hog +" 2012 Oct 24 -> Originalish release + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -syn match hogComment +\s\#[^\-:.%#=*].*$+lc=1 contains=hogTodo,hogCommentString -syn region hogCommentString contained oneline start='\S\s\+\#+'ms=s+1 end='\#' - -syn match hogJunk "\<\a\+|\s\+$" -syn match hogNumber contained "\<\d\+\>" -syn region hogText contained oneline start='\S' end=',' skipwhite -syn region hogTexts contained oneline start='\S' end=';' skipwhite - -" Environment Variables -" ===================== -"syn match hogEnvvar contained "[\!]\=\$\I\i*" -"syn match hogEnvvar contained "[\!]\=\${\I\i*}" -syn match hogEnvvar contained "\$\I\i*" -syn match hogEnvvar contained "[\!]\=\${\I\i*}" - - -" String handling lifted from vim.vim written by Dr. Charles E. Campbell, Jr. -" Try to catch strings, if nothing else matches (therefore it must precede the others!) -" vmEscapeBrace handles ["] []"] (ie. stays as string) -syn region hogEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\^\=\]\=" skip="\\\\\|\\\]" end="\]"me=e-1 -syn match hogPatSep contained "\\[|()]" -syn match hogNotPatSep contained "\\\\" -syn region hogString oneline start=+[^:a-zA-Z\->!\\]"+hs=e+1 skip=+\\\\\|\\"+ end=+"\s*;+he=s-1 contains=hogEscapeBrace,hogPatSep,hogNotPatSep oneline -""syn region hogString oneline start=+[^:a-zA-Z>!\\]'+lc=1 skip=+\\\\\|\\'+ end=+'+ contains=hogEscapeBrace,vimPatSep,hogNotPatSep -"syn region hogString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="[^\\]+\s*[^a-zA-Z0-9.]"lc=1 skip="\\\\\|\\+" end="+" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn match hogString contained +"[^"]*\\$+ skipnl nextgroup=hogStringCont -"syn match hogStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ - - -" Beginners - Patterns that involve ^ -" -syn match hogLineComment +^[ \t]*#.*$+ contains=hogTodo,hogCommentString,hogCommentTitle -syn match hogCommentTitle '#\s*\u\a*\(\s\+\u\a*\)*:'ms=s+1 contained -syn keyword hogTodo contained TODO - -" Rule keywords -syn match hogARPCOpt contained "\d\+,\*,\*" -syn match hogARPCOpt contained "\d\+,\d\+,\*" -syn match hogARPCOpt contained "\d\+,\*,\d\+" -syn match hogARPCOpt contained "\d\+,\d\+,\d" -syn match hogATAGOpt contained "session" -syn match hogATAGOpt contained "host" -syn match hogATAGOpt contained "dst" -syn match hogATAGOpt contained "src" -syn match hogATAGOpt contained "seconds" -syn match hogATAGOpt contained "packets" -syn match hogATAGOpt contained "bytes" -syn keyword hogARespOpt contained rst_snd rst_rcv rst_all skipwhite -syn keyword hogARespOpt contained icmp_net icmp_host icmp_port icmp_all skipwhite -syn keyword hogAReactOpt contained block warn msg skipwhite -syn match hogAReactOpt contained "proxy\d\+" skipwhite -syn keyword hogAFOpt contained logto content_list skipwhite -syn keyword hogAIPOptVal contained eol nop ts sec lsrr lsrre satid ssrr rr skipwhite -syn keyword hogARefGrps contained arachnids skipwhite -syn keyword hogARefGrps contained bugtraq skipwhite -syn keyword hogARefGrps contained cve skipwhite -syn keyword hogSessionVal contained printable all skipwhite -syn match hogAFlagOpt contained "[0FSRPAUfsrpau21]\+" skipwhite -syn match hogAFragOpt contained "[DRMdrm]\+" skipwhite -" -" Output syslog options -" Facilities -syn keyword hogSysFac contained LOG_AUTH LOG_AUTHPRIV LOG_DAEMON LOG_LOCAL0 -syn keyword hogSysFac contained LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 -syn keyword hogSysFac contained LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_USER -" Priorities -syn keyword hogSysPri contained LOG_EMERG ALERT LOG_CRIT LOG_ERR -syn keyword hogSysPri contained LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG -" Options -syn keyword hogSysOpt contained LOG_CONS LOG_NDELAY LOG_PERROR -syn keyword hogSysOpt contained LOG_PID -" RuleTypes -syn keyword hogRuleType contained log pass alert activate dynamic - -" Output log_database arguments and parameters -" Type of database followed by , -" syn keyword hogDBSQL contained mysql postgresql unixodbc -" Parameters param=constant -" are just various constants assigned to parameter names - -" Output log_database arguments and parameters -" Type of database followed by , -syn keyword hogDBType contained alert log -syn keyword hogDBSRV contained mysql postgresql unixodbc -" Parameters param=constant -" are just various constants assigned to parameter names -syn keyword hogDBParam contained dbname host port user password sensor_name - -" Output xml arguments and parameters -" xml args -syn keyword hogXMLArg contained log alert -syn keyword hogXMLParam contained file protocol host port cert key ca server sanitize encoding detail -" -" hog rule handler '(.*)' -syn region hogAOpt contained oneline start="rpc" end=":"me=e-1 nextgroup=hogARPCOptGrp skipwhite -syn region hogARPCOptGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogARPCOpt skipwhite - -syn region hogAOpt contained oneline start="tag" end=":"me=e-1 nextgroup=hogATAGOptGrp skipwhite -syn region hogATAGOptGrp contained oneline start="."hs=s+1 skip="," end=";"me=e-1 contains=hogATAGOpt,hogNumber skipwhite -" -syn region hogAOpt contained oneline start="nocase\|sameip" end=";"me=e-1 skipwhite oneline keepend -" -syn region hogAOpt contained start="resp" end=":"me=e-1 nextgroup=hogARespOpts skipwhite -syn region hogARespOpts contained oneline start="." end="[,;]" contains=hogARespOpt skipwhite nextgroup=hogARespOpts -" -syn region hogAOpt contained start="react" end=":"me=e-1 nextgroup=hogAReactOpts skipwhite -syn region hogAReactOpts contained oneline start="." end="[,;]" contains=hogAReactOpt skipwhite nextgroup=hogAReactOpts - -syn region hogAOpt contained oneline start="depth\|seq\|ttl\|ack\|icmp_seq\|activates\|activated_by\|dsize\|icode\|icmp_id\|count\|itype\|tos\|id\|offset" end=":"me=e-1 nextgroup=hogANOptGrp skipwhite -syn region hogANOptGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogNumber skipwhite oneline keepend - -syn region hogAOpt contained oneline start="classtype" end=":"me=e-1 nextgroup=hogAFileGrp skipwhite - -syn region hogAOpt contained oneline start="regex\|msg\|content" end=":"me=e-1 nextgroup=hogAStrGrp skipwhite -"syn region hogAStrGrp contained oneline start=+:\s*"+hs=s+1 skip="\\;" end=+"\s*;+he=s-1 contains=hogString skipwhite oneline keepend -syn region hogAStrGrp contained oneline start=+:\s*"\|:"+hs=s+1 skip="\\;" end=+"\s*;+he=s-1 contains=hogString skipwhite oneline keepend - -syn region hogAOpt contained oneline start="logto\|content-list" end=":"me=e-1 nextgroup=hogAFileGrp skipwhite -syn region hogAFileGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogFileName skipwhite - -syn region hogAOpt contained oneline start="reference" end=":"me=e-1 nextgroup=hogARefGrp skipwhite -syn region hogARefGrp contained oneline start="."hs=s+1 end=","me=e-1 contains=hogARefGrps nextgroup=hogARefName skipwhite -syn region hogARefName contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogString,hogFileName,hogNumber skipwhite - -syn region hogAOpt contained oneline start="flags" end=":"he=s-1 nextgroup=hogAFlagOpt skipwhite oneline keepend - -syn region hogAOpt contained oneline start="fragbits" end=":"he=s-1 nextgroup=hogAFlagOpt skipwhite oneline keepend - -syn region hogAOpt contained oneline start="ipopts" end=":"he=s-1 nextgroup=hogAIPOptVal skipwhite oneline keepend - -"syn region hogAOpt contained oneline start="." end=":"he=s-1 contains=hogAFOpt nextgroup=hogFileName skipwhite - -syn region hogAOpt contained oneline start="session" end=":"he=s-1 nextgroup=hogSessionVal skipwhite - -syn match nothing "$" -syn region hogRules oneline contains=nothing start='$' end="$" -syn region hogRules oneline contains=hogRule start='('ms=s+1 end=")\s*$" skipwhite -syn region hogRule contained oneline start="." skip="\\;" end=";"he=s-1 contains=hogAOpts, skipwhite keepend -"syn region hogAOpts contained oneline start="." end="[;]"he=s-1 contains=hogAOpt skipwhite -syn region hogAOpts contained oneline start="." end="[;]"me=e-1 contains=hogAOpt skipwhite - - -" ruletype command -syn keyword hogRTypeStart skipwhite ruletype nextgroup=hogRuleName skipwhite -syn region hogRuleName contained start="." end="\s" contains=hogFileName nextgroup=hogRTypeRegion -" type ruletype sub type -syn region hogRtypeRegion contained start="{" end="}" nextgroup=hogRTypeStart -syn keyword hogRTypeStart skipwhite type nextgroup=hogRuleTypes skipwhite -syn region hogRuleTypes contained start="." end="\s" contains=hogRuleType nextgroup=hogOutStart - - -" var command -syn keyword hogVarStart skipwhite var nextgroup=hogVarIdent skipwhite -syn region hogVarIdent contained start="."hs=e+1 end="\s\+"he=s-1 contains=hogEnvvar nextgroup=hogVarRegion skipwhite -syn region hogVarRegion contained oneline start="." contains=hogIPaddr,hogEnvvar,hogNumber,hogString,hogFileName end="$"he=s-1 keepend skipwhite - -" config command -syn keyword hogConfigStart config skipwhite nextgroup=hogConfigType -syn match hogConfigType contained "\<classification\>" nextgroup=hogConfigTypeRegion skipwhite -syn region hogConfigTypeRegion contained oneline start=":"ms=s+1 end="$" contains=hogNumber,hogText keepend skipwhite - - -" include command -syn keyword hogIncStart include skipwhite nextgroup=hogIncRegion -syn region hogIncRegion contained oneline start="\>" contains=hogFileName,hogEnvvar end="$" keepend - -" preprocessor command -" http_decode, minfrag, portscan[-ignorehosts] -syn keyword hogPPrStart preprocessor skipwhite nextgroup=hogPPr -syn match hogPPr contained "\<spade\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-homenet\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-threshlearn\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt2\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt3\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-survey\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<defrag\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<telnet_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<rpc_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<bo\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<stream\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<stream2\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<stream3\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<http_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<minfrag\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<portscan[-ignorehosts]*\>" nextgroup=hogPPrRegion skipwhite -syn region hogPPrRegion contained oneline start="$" end="$" keepend -syn region hogPPrRegion contained oneline start=":" end="$" contains=hogNumber,hogIPaddr,hogEnvvar,hogFileName keepend -syn keyword hogStreamArgs contained timeout ports maxbytes -syn region hogStreamRegion contained oneline start=":" end="$" contains=hogStreamArgs,hogNumber - -" output command -syn keyword hogOutStart output nextgroup=hogOut skipwhite -" -" alert_syslog -syn match hogOut contained "\<alert_syslog\>" nextgroup=hogSyslogRegion skipwhite -syn region hogSyslogRegion contained start=":" end="$" contains=hogSysFac,hogSysPri,hogSysOpt,hogEnvvar oneline skipwhite keepend -" -" alert_fast (full,smb,unixsock, and tcpdump) -syn match hogOut contained "\<alert_fast\|alert_full\|alert_smb\|alert_unixsock\|log_tcpdump\>" nextgroup=hogLogFileRegion skipwhite -syn region hogLogFileRegion contained start=":" end="$" contains=hogFileName,hogEnvvar oneline skipwhite keepend -" -" database -syn match hogOut contained "\<database\>" nextgroup=hogDBTypes skipwhite -syn region hogDBTypes contained start=":" end="," contains=hogDBType,hogEnvvar nextgroup=hogDBSRVs skipwhite -syn region hogDBSRVs contained start="\s\+" end="," contains=hogDBSRV nextgroup=hogDBParams skipwhite -syn region hogDBParams contained start="." end="="me=e-1 contains=hogDBParam nextgroup=hogDBValues -syn region hogDBValues contained start="." end="\>" contains=hogNumber,hogEnvvar,hogAscii nextgroup=hogDBParams oneline skipwhite -syn match hogAscii contained "\<\a\+" -" -" log_tcpdump -syn match hogOut contained "\<log_tcpdump\>" nextgroup=hogLogRegion skipwhite -syn region hogLogRegion oneline start=":" skipwhite end="$" contains=hogEnvvar,hogFileName keepend -" -" xml -syn keyword hogXMLTrans contained http https tcp iap -syn match hogOut contained "\<xml\>" nextgroup=hogXMLRegion skipwhite -syn region hogXMLRegion contained start=":" end="," contains=hogXMLArg,hogEnvvar nextgroup=hogXMLParams skipwhite -"syn region hogXMLParams contained start="." end="="me=e-1 contains=hogXMLProto nextgroup=hogXMLProtos -"syn region hogXMLProtos contained start="." end="\>" contains=hogXMLTrans nextgroup=hogXMLParams -syn region hogXMLParams contained start="." end="="me=e-1 contains=hogXMLParam nextgroup=hogXMLValue -syn region hogXMLValue contained start="." end="\>" contains=hogNumber,hogIPaddr,hogEnvvar,hogAscii,hogFileName nextgroup=hogXMLParams oneline skipwhite keepend -" -" Filename -syn match hogFileName contained "[-./[:alnum:]_~]\+" -syn match hogFileName contained "[-./[:alnum:]_~]\+" -" IP address -syn match hogIPaddr "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" -syn match hogIPaddr "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,2}\>" - -syn keyword hogProto tcp TCP ICMP icmp udp UDP - -" hog alert address port pairs -" hog IPaddresses -syn match hogIPaddrAndPort contained "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,2}\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\<any\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\$\I\i*" nextgroup=hogPort skipwhite -syn match hogIPaddrAndPort contained "\${\I\i*}" nextgroup=hogPort skipwhite -"syn match hogPort contained "[\!]\=[\:]\=\d\+L\=\>" skipwhite -syn match hogPort contained "[\:]\=\d\+\>" -syn match hogPort contained "[\!]\=\<any\>" skipwhite -syn match hogPort contained "[\!]\=\d\+L\=:\d\+L\=\>" skipwhite - -" action commands -syn keyword hog7Functions activate skipwhite nextgroup=hogActRegion -syn keyword hog7Functions dynamic skipwhite nextgroup=hogActRegion -syn keyword hogActStart alert skipwhite nextgroup=hogActRegion -syn keyword hogActStart log skipwhite nextgroup=hogActRegion -syn keyword hogActStart pass skipwhite nextgroup=hogActRegion - -syn region hogActRegion contained oneline start="tcp\|TCP\|udp\|UDP\|icmp\|ICMP" end="\s\+"me=s-1 nextgroup=hogActSource oneline keepend skipwhite -syn region hogActSource contained oneline contains=hogIPaddrAndPort start="\s\+"ms=e+1 end="->\|<>"me=e-2 oneline keepend skipwhite nextgroup=hogActDest -syn region hogActDest contained oneline contains=hogIPaddrAndPort start="->\|<>" end="$" oneline keepend -syn region hogActDest contained oneline contains=hogIPaddrAndPort start="->\|<>" end="("me=e-1 oneline keepend skipwhite nextgroup=hogRules - - -" ==================== -if version >= 508 || !exists("did_hog_syn_inits") - if version < 508 - let did_hog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif -" The default methods for highlighting. Can be overridden later - HiLink hogComment Comment - HiLink hogLineComment Comment - HiLink hogAscii Constant - HiLink hogCommentString Constant - HiLink hogFileName Constant - HiLink hogIPaddr Constant - HiLink hogNotPatSep Constant - HiLink hogNumber Constant - HiLink hogText Constant - HiLink hogString Constant - HiLink hogSysFac Constant - HiLink hogSysOpt Constant - HiLink hogSysPri Constant -" HiLink hogAStrGrp Error - HiLink hogJunk Error - HiLink hogEnvvar Identifier - HiLink hogIPaddrAndPort Identifier - HiLink hogVarIdent Identifier - HiLink hogATAGOpt PreProc - HiLink hogAIPOptVal PreProc - HiLink hogARespOpt PreProc - HiLink hogAReactOpt PreProc - HiLink hogAFlagOpt PreProc - HiLink hogAFragOpt PreProc - HiLink hogCommentTitle PreProc - HiLink hogDBType PreProc - HiLink hogDBSRV PreProc - HiLink hogPort PreProc - HiLink hogARefGrps PreProc - HiLink hogSessionVal PreProc - HiLink hogXMLArg PreProc - HiLink hogARPCOpt PreProc - HiLink hogPatSep Special - HiLink hog7Functions Statement - HiLink hogActStart Statement - HiLink hogIncStart Statement - HiLink hogConfigStart Statement - HiLink hogOutStart Statement - HiLink hogPPrStart Statement - HiLink hogVarStart Statement - HiLink hogRTypeStart Statement - HiLink hogTodo Todo - HiLink hogRuleType Type - HiLink hogAFOpt Type - HiLink hogANoVal Type - HiLink hogAStrOpt Type - HiLink hogANOpt Type - HiLink hogAOpt Type - HiLink hogDBParam Type - HiLink hogStreamArgs Type - HiLink hogOut Type - HiLink hogPPr Type - HiLink hogConfigType Type - HiLink hogActRegion Type - HiLink hogProto Type - HiLink hogXMLParam Type - HiLink resp Todo - HiLink cLabel Label - delcommand HiLink +setlocal iskeyword-=: +setlocal iskeyword+=- +syn case ignore + +" Hog ruletype crap +syn keyword HogRuleType ruletype nextgroup=HogRuleTypeName skipwhite +syn match HogRuleTypeName "[[:alnum:]_]\+" contained nextgroup=HogRuleTypeBody skipwhite +syn region HogRuleTypeBody start="{" end="}" contained contains=HogRuleTypeType,HogOutput fold +syn keyword HogRuleTypeType type contained + +" Hog Configurables +syn keyword HogPreproc preprocessor nextgroup=HogConfigName skipwhite +syn keyword HogConfig config nextgroup=HogConfigName skipwhite +syn keyword HogOutput output nextgroup=HogConfigName skipwhite +syn match HogConfigName "[[:alnum:]_-]\+" contained nextgroup=HogConfigOpts skipwhite +syn region HogConfigOpts start=":" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold keepend contained contains=HogSpecial,HogNumber,HogIPAddr,HogVar,HogComment + +" Event filter's and threshold's +syn region HogEvFilter start="event_filter\|threshold" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold transparent keepend contains=HogEvFilterKeyword,HogEvFilterOptions,HogComment +syn keyword HogEvFilterKeyword skipwhite event_filter threshold +syn keyword HogEvFilterOptions skipwhite type nextgroup=HogEvFilterTypes +syn keyword HogEvFilterTypes skipwhite limit threshold both contained +syn keyword HogEvFilterOptions skipwhite track nextgroup=HogEvFilterTrack +syn keyword HogEvFilterTrack skipwhite by_src by_dst contained +syn keyword HogEvFilterOptions skipwhite gen_id sig_id count seconds nextgroup=HogNumber + +" Suppressions +syn region HogEvFilter start="suppress" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold transparent keepend contains=HogSuppressKeyword,HogComment +syn keyword HogSuppressKeyword skipwhite suppress +syn keyword HogSuppressOptions skipwhite gen_id sig_id nextgroup=HogNumber +syn keyword HogSuppressOptions skipwhite track nextgroup=HogEvFilterTrack +syn keyword HogSuppressOptions skipwhite ip nextgroup=HogIPAddr + +" Attribute table +syn keyword HogAttribute attribute_table nextgroup=HogAttributeFile +syn match HogAttributeFile contained ".*$" contains=HogVar,HogAttributeType,HogComment +syn keyword HogAttributeType filename + +" Hog includes +syn keyword HogInclude include nextgroup=HogIncludeFile skipwhite +syn match HogIncludeFile ".*$" contained contains=HogVar,HogComment + +" Hog dynamic libraries +syn keyword HogDylib dynamicpreprocessor dynamicengine dynamicdetection nextgroup=HogDylibFile skipwhite +syn match HogDylibFile "\s.*$" contained contains=HogVar,HogDylibType,HogComment +syn keyword HogDylibType directory file contained + +" Variable dereferenced with '$' +syn match HogVar "\$[[:alnum:]_]\+" + +", Variables declared with 'var' +syn keyword HogVarType var nextgroup=HogVarSet skipwhite +syn match HogVarSet "[[:alnum:]_]\+" display contained nextgroup=HogVarValue skipwhite +syn match HogVarValue ".*$" contained contains=HogString,HogNumber,HogVar,HogComment + +" Variables declared with 'ipvar' +syn keyword HogIPVarType ipvar nextgroup=HogIPVarSet skipwhite +syn match HogIPVarSet "[[:alnum:]_]\+" display contained nextgroup=HogIPVarList,HogSpecial skipwhite +syn region HogIPVarList start="\[" end="]" contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot + +" Variables declared with 'portvar' +syn keyword HogPortVarType portvar nextgroup=HogPortVarSet skipwhite +syn match HogPortVarSet "[[:alnum:]_]\+" display contained nextgroup=HogPortVarList,HogPort,HogOpRange,HogOpNot,HogSpecial skipwhite +syn region HogPortVarList start="\[" end="]" contains=HogPortVarList,HogVar,HogOpNot,HogPort,HogOpRange,HogOpNot +syn match HogPort "\<\%(\d\+\|any\)\>" display contains=HogOpRange nextgroup=HogOpRange + +" Generic stuff +syn match HogIPAddr contained "\<\%(\d\{1,3}\(\.\d\{1,3}\)\{3}\|any\)\>" nextgroup=HogIPCidr +syn match HogIPAddr contained "\<\d\{1,3}\(\.\d\{1,3}\)\{3}\>" nextgroup=HogIPCidr +syn match HogIPCidr contained "\/\([0-2][0-9]\=\|3[0-2]\=\)" +syn region HogHexEsc contained start='|' end='|' oneline +syn region HogString contained start='"' end='"' extend oneline contains=HogHexEsc +syn match HogNumber contained display "\<\d\+\>" +syn match HogNumber contained display "\<\d\+\>" +syn match HogNumber contained display "0x\x\+\>" +syn keyword HogSpecial contained true false yes no default all any +syn keyword HogSpecialAny contained any +syn match HogOpNot "!" contained +syn match HogOpRange ":" contained + +" Rules +syn keyword HogRuleAction activate alert drop block dynamic log pass reject sdrop sblock skipwhite nextgroup=HogRuleProto,HogRuleBlock +syn keyword HogRuleProto ip tcp udp icmp skipwhite contained nextgroup=HogRuleSrcIP +syn match HogRuleSrcIP "\S\+" transparent skipwhite contained contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot nextgroup=HogRuleSrcPort +syn match HogRuleSrcPort "\S\+" transparent skipwhite contained contains=HogPortVarList,HogVar,HogPort,HogOpRange,HogOpNot nextgroup=HogRuleDir +syn match HogRuleDir "->\|<>" skipwhite contained nextgroup=HogRuleDstIP +syn match HogRuleDstIP "\S\+" transparent skipwhite contained contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot nextgroup=HogRuleDstPort +syn match HogRuleDstPort "\S\+" transparent skipwhite contained contains=HogPortVarList,HogVar,HogPort,HogOpRange,HogOpNot nextgroup=HogRuleBlock +syn region HogRuleBlock start="(" end=")" transparent skipwhite contained contains=HogRuleOption,HogComment fold +",HogString,HogComment,HogVar,HogOptNot +"syn region HogRuleOption start="\<gid\|sid\|rev\|depth\|offset\|distance\|within\>" end="\ze;" skipwhite contained contains=HogNumber +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP msg gid sid rev classtype priority metadata content nocase rawbytes +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP depth offset distance within http_client_body http_cookie http_raw_cookie http_header +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP http_raw_header http_method http_uri http_raw_uri http_stat_code http_stat_msg +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP fast_pattern uricontent urilen isdataat pcre pkt_data file_data base64_decode base64_data +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP byte_test byte_jump byte_extract ftpbounce asn1 cvs dce_iface dce_opnum dce_stub_data +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP sip_method sip_stat_code sip_header sip_body gtp_type gtp_info gtp_version ssl_version +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP ssl_state fragoffset ttl tos id ipopts fragbits dsize flags flow flowbits seq ack window +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP itype icode icmp_id icmp_seq rpc ip_proto sameip stream_reassemble stream_size +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP logto session resp react tag activates activated_by count replace detection_filter +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP threshold reference sd_pattern file_type file_group + +syn region HogRuleSROP start=':' end=";" transparent keepend contained contains=HogRuleChars,HogString,HogNumber +syn match HogRuleChars "\%(\k\|\.\|?\|=\|/\|%\|&\)\+" contained +syn match HogURLChars "\%(\.\|?\|=\)\+" contained + +" Hog File Type Rules +syn match HogFileType /^\s*file.*$/ transparent contains=HogFileTypeOpt,HogFileFROP +syn keyword HogFileTypeOpt skipwhite contained nextgroup=HogRuleFROP file type ver category id rev content offset msg group +syn region HogFileFROP start=':' end=";" transparent keepend contained contains=NotASemicoln +syn match NotASemiColn ".*$" contained + + +" Comments +syn keyword HogTodo XXX TODO NOTE contained +syn match HogTodo "Step\s\+#\=\d\+" contained +syn region HogComment start="#" end="$" contains=HogTodo,@Spell + +syn case match + +if !exists("hog_minlines") + let hog_minlines = 100 endif +exec "syn sync minlines=" . hog_minlines + +hi link HogRuleType Statement +hi link HogRuleTypeName Type +hi link HogRuleTypeType Keyword + +hi link HogPreproc Statement +hi link HogConfig Statement +hi link HogOutput Statement +hi link HogConfigName Type + +"hi link HogEvFilter +hi link HogEvFilterKeyword Statement +hi link HogSuppressKeyword Statement +hi link HogEvFilterTypes Constant +hi link HogEvFilterTrack Constant + +hi link HogAttribute Statement +hi link HogAttributeFile String +hi link HogAttributeType Statement + +hi link HogInclude Statement +hi link HogIncludeFile String + +hi link HogDylib Statement +hi link HogDylibType Statement +hi link HogDylibFile String + +" Variables +" var +hi link HogVar Identifier +hi link HogVarType Keyword +hi link HogVarSet Identifier +hi link HogVarValue String +" ipvar +hi link HogIPVarType Keyword +hi link HogIPVarSet Identifier +" portvar +hi link HogPortVarType Keyword +hi link HogPortVarSet Identifier +hi link HogPort Constant + +hi link HogTodo Todo +hi link HogComment Comment +hi link HogString String +hi link HogHexEsc PreProc +hi link HogNumber Number +hi link HogSpecial Constant +hi link HogSpecialAny Constant +hi link HogIPAddr Constant +hi link HogIPCidr Constant +hi link HogOpNot Operator +hi link HogOpRange Operator + +hi link HogRuleAction Statement +hi link HogRuleProto Identifier +hi link HogRuleDir Operator +hi link HogRuleOption Keyword +hi link HogRuleChars String + +hi link HogFileType HogRuleAction +hi link HogFileTypeOpt HogRuleOption +hi link NotASemiColn HogRuleChars let b:current_syntax = "hog" - -" hog: cpw=59 diff --git a/runtime/syntax/hostconf.vim b/runtime/syntax/hostconf.vim index 4fc8af0ba3..593ed72eed 100644 --- a/runtime/syntax/hostconf.vim +++ b/runtime/syntax/hostconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: host.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-25 +" Language: host.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/hostsaccess.vim b/runtime/syntax/hostsaccess.vim index 8a9f02eff5..7201816f48 100644 --- a/runtime/syntax/hostsaccess.vim +++ b/runtime/syntax/hostsaccess.vim @@ -15,12 +15,8 @@ if exists("b:current_syntax") endif " For a starter we just use conf.vim for highlighting -if version < 600 - so <sfile>:p:h/conf.vim -else - runtime! syntax/conf.vim - unlet b:current_syntax -endif +runtime! syntax/conf.vim +unlet b:current_syntax let b:current_syntax = "hostsaccess" diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim index d59126dede..991fd8af39 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -1,17 +1,17 @@ " Vim syntax file -" Language: HTML -" Maintainer: Claudio Fleiner <claudio@fleiner.com> -" URL: http://www.fleiner.com/vim/syntax/html.vim -" Last Change: 2012 Oct 05 +" Language: HTML +" Maintainer: Jorge Maldonado Ventura <jorgesumle@freakspot.net> +" Previous Maintainer: Claudio Fleiner <claudio@fleiner.com> +" Repository: https://notabug.org/jorgesumle/vim-html-syntax +" Last Change: 2017 Dec 16 +" Included patch from Jorge Maldonado Ventura to add the dialog element +" " Please check :help html.vim for some comments and a description of the options -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif let main_syntax = 'html' @@ -20,13 +20,6 @@ endif let s:cpo_save = &cpo set cpo&vim -" don't use standard HiLink, it will not work with included syntax files -if version < 508 - command! -nargs=+ HtmlHiLink hi link <args> -else - command! -nargs=+ HtmlHiLink hi def link <args> -endif - syntax spell toplevel syn case ignore @@ -53,15 +46,23 @@ syn keyword htmlTagName contained cite code dd dfn dir div dl dt font syn keyword htmlTagName contained form hr html img syn keyword htmlTagName contained input isindex kbd li link map menu syn keyword htmlTagName contained meta ol option param pre p samp span -syn keyword htmlTagName contained select small strike sub sup +syn keyword htmlTagName contained select small sub sup syn keyword htmlTagName contained table td textarea th tr tt ul var xmp syn match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" " new html 4.0 tags syn keyword htmlTagName contained abbr acronym bdo button col label -syn keyword htmlTagName contained colgroup del fieldset iframe ins legend +syn keyword htmlTagName contained colgroup fieldset iframe ins legend syn keyword htmlTagName contained object optgroup q s tbody tfoot thead +" new html 5 tags +syn keyword htmlTagName contained article aside audio bdi canvas data +syn keyword htmlTagName contained datalist details embed figcaption figure +syn keyword htmlTagName contained footer header hgroup keygen main mark +syn keyword htmlTagName contained menuitem meter nav output picture +syn keyword htmlTagName contained progress rb rp rt rtc ruby section +syn keyword htmlTagName contained slot source template time track video wbr + " legal arg names syn keyword htmlArg contained action syn keyword htmlArg contained align alink alt archive background bgcolor @@ -96,6 +97,19 @@ syn keyword htmlArg contained multiple nohref nowrap object profile readonly syn keyword htmlArg contained rules scheme scope span standby style syn keyword htmlArg contained summary tabindex valuetype version +" html 5 arg names +syn keyword htmlArg contained allowfullscreen async autocomplete autofocus +syn keyword htmlArg contained autoplay challenge contenteditable contextmenu +syn keyword htmlArg contained controls crossorigin default dialog dirname +syn keyword htmlArg contained download draggable dropzone form formaction +syn keyword htmlArg contained formenctype formmethod formnovalidate formtarget +syn keyword htmlArg contained hidden high icon inputmode keytype kind list loop +syn keyword htmlArg contained low max min minlength muted nonce novalidate open +syn keyword htmlArg contained optimum pattern placeholder poster preload +syn keyword htmlArg contained radiogroup required reversed sandbox spellcheck +syn keyword htmlArg contained sizes srcset srcdoc srclang step title translate +syn keyword htmlArg contained typemustmatch + " special characters syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};" @@ -122,6 +136,9 @@ if !exists("html_no_rendering") " rendering syn cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,javaScript,@htmlPreproc + syn region htmlStrike start="<del\>" end="</del>"me=e-6 contains=@htmlTop + syn region htmlStrike start="<strike\>" end="</strike>"me=e-9 contains=@htmlTop + syn region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic syn region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic syn region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic @@ -168,9 +185,9 @@ if main_syntax != 'java' || exists("java_javascript") " JAVA SCRIPT syn include @htmlJavaScript syntax/javascript.vim unlet b:current_syntax - syn region javaScript start=+<script\_[^>]*>+ keepend end=+</script>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc + syn region javaScript start=+<script\_[^>]*>+ keepend end=+</script\_[^>]*>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc syn region htmlScriptTag contained start=+<script+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent - HtmlHiLink htmlScriptTag htmlTag + hi def link htmlScriptTag htmlTag " html events (i.e. arguments that include javascript commands) if exists("html_extended_events") @@ -182,8 +199,8 @@ if main_syntax != 'java' || exists("java_javascript") endif syn region htmlEventSQ contained start=+'+ms=s+1 end=+'+me=s-1 contains=@htmlJavaScript syn region htmlEventDQ contained start=+"+ms=s+1 end=+"+me=s-1 contains=@htmlJavaScript - HtmlHiLink htmlEventSQ htmlEvent - HtmlHiLink htmlEventDQ htmlEvent + hi def link htmlEventSQ htmlEvent + hi def link htmlEventDQ htmlEvent " a javascript expression is used as an arg value syn region javaScriptExpression contained start=+&{+ keepend end=+};+ contains=@htmlJavaScript,@htmlPreproc @@ -193,7 +210,7 @@ if main_syntax != 'java' || exists("java_vb") " VB SCRIPT syn include @htmlVbScript syntax/vb.vim unlet b:current_syntax - syn region javaScript start=+<script \_[^>]*language *=\_[^>]*vbscript\_[^>]*>+ keepend end=+</script>+me=s-1 contains=@htmlVbScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc + syn region javaScript start=+<script \_[^>]*language *=\_[^>]*vbscript\_[^>]*>+ keepend end=+</script\_[^>]*>+me=s-1 contains=@htmlVbScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc endif syn cluster htmlJavaScript add=@htmlPreproc @@ -206,7 +223,7 @@ if main_syntax != 'java' || exists("java_css") syn region cssStyle start=+<style+ keepend end=+</style>+ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc syn match htmlCssStyleComment contained "\(<!--\|-->\)" syn region htmlCssDefinition matchgroup=htmlArg start='style="' keepend matchgroup=htmlString end='"' contains=css.*Attr,css.*Prop,cssComment,cssLength,cssColor,cssURL,cssImportant,cssError,cssString,@htmlPreproc - HtmlHiLink htmlStyleArg htmlString + hi def link htmlStyleArg htmlString endif if main_syntax == "html" @@ -220,73 +237,71 @@ if main_syntax == "html" endif " The default highlighting. -if version >= 508 || !exists("did_html_syn_inits") - if version < 508 - let did_html_syn_inits = 1 - endif - HtmlHiLink htmlTag Function - HtmlHiLink htmlEndTag Identifier - HtmlHiLink htmlArg Type - HtmlHiLink htmlTagName htmlStatement - HtmlHiLink htmlSpecialTagName Exception - HtmlHiLink htmlValue String - HtmlHiLink htmlSpecialChar Special - - if !exists("html_no_rendering") - HtmlHiLink htmlH1 Title - HtmlHiLink htmlH2 htmlH1 - HtmlHiLink htmlH3 htmlH2 - HtmlHiLink htmlH4 htmlH3 - HtmlHiLink htmlH5 htmlH4 - HtmlHiLink htmlH6 htmlH5 - HtmlHiLink htmlHead PreProc - HtmlHiLink htmlTitle Title - HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic - HtmlHiLink htmlUnderlineBold htmlBoldUnderline - HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic - HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic - HtmlHiLink htmlItalicUnderline htmlUnderlineItalic - HtmlHiLink htmlItalicBold htmlBoldItalic - HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic - HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic - HtmlHiLink htmlLink Underlined - HtmlHiLink htmlLeadingSpace None - if !exists("html_my_rendering") - hi def htmlBold term=bold cterm=bold gui=bold - hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline - hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic - hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline - hi def htmlUnderline term=underline cterm=underline gui=underline - hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline - hi def htmlItalic term=italic cterm=italic gui=italic +hi def link htmlTag Function +hi def link htmlEndTag Identifier +hi def link htmlArg Type +hi def link htmlTagName htmlStatement +hi def link htmlSpecialTagName Exception +hi def link htmlValue String +hi def link htmlSpecialChar Special + +if !exists("html_no_rendering") + hi def link htmlH1 Title + hi def link htmlH2 htmlH1 + hi def link htmlH3 htmlH2 + hi def link htmlH4 htmlH3 + hi def link htmlH5 htmlH4 + hi def link htmlH6 htmlH5 + hi def link htmlHead PreProc + hi def link htmlTitle Title + hi def link htmlBoldItalicUnderline htmlBoldUnderlineItalic + hi def link htmlUnderlineBold htmlBoldUnderline + hi def link htmlUnderlineItalicBold htmlBoldUnderlineItalic + hi def link htmlUnderlineBoldItalic htmlBoldUnderlineItalic + hi def link htmlItalicUnderline htmlUnderlineItalic + hi def link htmlItalicBold htmlBoldItalic + hi def link htmlItalicBoldUnderline htmlBoldUnderlineItalic + hi def link htmlItalicUnderlineBold htmlBoldUnderlineItalic + hi def link htmlLink Underlined + hi def link htmlLeadingSpace None + if !exists("html_my_rendering") + hi def htmlBold term=bold cterm=bold gui=bold + hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline + hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic + hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline + hi def htmlUnderline term=underline cterm=underline gui=underline + hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline + hi def htmlItalic term=italic cterm=italic gui=italic + if v:version > 800 || v:version == 800 && has("patch1038") + hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough + else + hi def htmlStrike term=underline cterm=underline gui=underline endif endif - - HtmlHiLink htmlPreStmt PreProc - HtmlHiLink htmlPreError Error - HtmlHiLink htmlPreProc PreProc - HtmlHiLink htmlPreAttr String - HtmlHiLink htmlPreProcAttrName PreProc - HtmlHiLink htmlPreProcAttrError Error - HtmlHiLink htmlSpecial Special - HtmlHiLink htmlSpecialChar Special - HtmlHiLink htmlString String - HtmlHiLink htmlStatement Statement - HtmlHiLink htmlComment Comment - HtmlHiLink htmlCommentPart Comment - HtmlHiLink htmlValue String - HtmlHiLink htmlCommentError htmlError - HtmlHiLink htmlTagError htmlError - HtmlHiLink htmlEvent javaScript - HtmlHiLink htmlError Error - - HtmlHiLink javaScript Special - HtmlHiLink javaScriptExpression javaScript - HtmlHiLink htmlCssStyleComment Comment - HtmlHiLink htmlCssDefinition Special endif -delcommand HtmlHiLink +hi def link htmlPreStmt PreProc +hi def link htmlPreError Error +hi def link htmlPreProc PreProc +hi def link htmlPreAttr String +hi def link htmlPreProcAttrName PreProc +hi def link htmlPreProcAttrError Error +hi def link htmlSpecial Special +hi def link htmlSpecialChar Special +hi def link htmlString String +hi def link htmlStatement Statement +hi def link htmlComment Comment +hi def link htmlCommentPart Comment +hi def link htmlValue String +hi def link htmlCommentError htmlError +hi def link htmlTagError htmlError +hi def link htmlEvent javaScript +hi def link htmlError Error + +hi def link javaScript Special +hi def link javaScriptExpression javaScript +hi def link htmlCssStyleComment Comment +hi def link htmlCssDefinition Special let b:current_syntax = "html" diff --git a/runtime/syntax/htmlcheetah.vim b/runtime/syntax/htmlcheetah.vim index f57df90dea..0721c76b44 100644 --- a/runtime/syntax/htmlcheetah.vim +++ b/runtime/syntax/htmlcheetah.vim @@ -3,11 +3,8 @@ " Maintainer: Max Ischenko <mfi@ukr.net> " Last Change: 2003-05-11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -15,14 +12,9 @@ if !exists("main_syntax") let main_syntax = 'html' endif -if version < 600 - so <sfile>:p:h/cheetah.vim - so <sfile>:p:h/html.vim -else - runtime! syntax/cheetah.vim - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/cheetah.vim +runtime! syntax/html.vim +unlet b:current_syntax syntax cluster htmlPreproc add=cheetahPlaceHolder syntax cluster htmlString add=cheetahPlaceHolder diff --git a/runtime/syntax/htmldjango.vim b/runtime/syntax/htmldjango.vim index 58afd1b62d..07b1c375e8 100644 --- a/runtime/syntax/htmldjango.vim +++ b/runtime/syntax/htmldjango.vim @@ -3,11 +3,8 @@ " Maintainer: Dave Hodder <dmh@dmh.org.uk> " Last Change: 2014 Jul 13 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -15,14 +12,9 @@ if !exists("main_syntax") let main_syntax = 'html' endif -if version < 600 - so <sfile>:p:h/django.vim - so <sfile>:p:h/html.vim -else - runtime! syntax/django.vim - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/django.vim +runtime! syntax/html.vim +unlet b:current_syntax syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock diff --git a/runtime/syntax/htmlm4.vim b/runtime/syntax/htmlm4.vim index 3119d2d1ad..ee1f06e5f4 100644 --- a/runtime/syntax/htmlm4.vim +++ b/runtime/syntax/htmlm4.vim @@ -4,11 +4,8 @@ " URL: http://www.fleiner.com/vim/syntax/htmlm4.vim " Last Change: 2001 Apr 30 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -17,19 +14,12 @@ if !exists("main_syntax") let main_syntax='htmlm4' endif -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim unlet b:current_syntax syn case match -if version < 600 - so <sfile>:p:h/m4.vim -else - runtime! syntax/m4.vim -endif +runtime! syntax/m4.vim + unlet b:current_syntax syn cluster htmlPreproc add=@m4Top syn cluster m4StringContents add=htmlTag,htmlEndTag diff --git a/runtime/syntax/htmlos.vim b/runtime/syntax/htmlos.vim index f31b9f6543..b54ca7a921 100644 --- a/runtime/syntax/htmlos.vim +++ b/runtime/syntax/htmlos.vim @@ -6,11 +6,8 @@ " Last Change: 2003 May 11 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,12 +15,8 @@ if !exists("main_syntax") let main_syntax = 'htmlos' endif -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/html.vim +unlet b:current_syntax syn cluster htmlPreproc add=htmlosRegion @@ -121,42 +114,32 @@ else endif " 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_htmlos_syn_inits") - if version < 508 - let did_htmlos_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink htmlosSpecialIdentifier Operator - HiLink htmlosIdentifier Identifier - HiLink htmlosStorageClass StorageClass - HiLink htmlosComment Comment - HiLink htmlosBoolean Boolean - HiLink htmlosStringSingle String - HiLink htmlosStringDouble String - HiLink htmlosNumber Number - HiLink htmlosFloat Float - HiLink htmlosFunctions Function - HiLink htmlosRepeat Repeat - HiLink htmlosConditional Conditional - HiLink htmlosLabel Label - HiLink htmlosStatement Statement - HiLink htmlosKeyword Statement - HiLink htmlosType Type - HiLink htmlosDefine Define - HiLink htmlosParent Delimiter - HiLink htmlosError Error - HiLink htmlosTodo Todo - HiLink htmlosOperator Operator - HiLink htmlosRelation Operator - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link htmlosSpecialIdentifier Operator +hi def link htmlosIdentifier Identifier +hi def link htmlosStorageClass StorageClass +hi def link htmlosComment Comment +hi def link htmlosBoolean Boolean +hi def link htmlosStringSingle String +hi def link htmlosStringDouble String +hi def link htmlosNumber Number +hi def link htmlosFloat Float +hi def link htmlosFunctions Function +hi def link htmlosRepeat Repeat +hi def link htmlosConditional Conditional +hi def link htmlosLabel Label +hi def link htmlosStatement Statement +hi def link htmlosKeyword Statement +hi def link htmlosType Type +hi def link htmlosDefine Define +hi def link htmlosParent Delimiter +hi def link htmlosError Error +hi def link htmlosTodo Todo +hi def link htmlosOperator Operator +hi def link htmlosRelation Operator + let b:current_syntax = "htmlos" if main_syntax == 'htmlos' diff --git a/runtime/syntax/ia64.vim b/runtime/syntax/ia64.vim index f0d510b945..22ce4623d9 100644 --- a/runtime/syntax/ia64.vim +++ b/runtime/syntax/ia64.vim @@ -6,11 +6,8 @@ " File Version: 0.7 " Last Change: 2006 Sep 08 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,11 +16,7 @@ endif syn case ignore " Identifier Keyword characters (defines \k) -if version >= 600 - setlocal iskeyword=@,48-57,#,$,.,:,?,@-@,_,~ -else - set iskeyword=@,48-57,#,$,.,:,?,@-@,_,~ -endif +setlocal iskeyword=@,48-57,#,$,.,:,?,@-@,_,~ syn sync minlines=5 @@ -268,43 +261,33 @@ syn match ia64data "real\([48]\|1[06]\)\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\ syn match ia64data "stringz\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>" " 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_ia64_syn_inits") - if version < 508 - let did_ia64_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - "put masm groups with our groups - HiLink masmOperator ia64operator - HiLink masmDirective ia64Directive - HiLink masmOpcode ia64Opcode - HiLink masmIdentifier ia64Identifier - HiLink masmFloat ia64Float +"put masm groups with our groups +hi def link masmOperator ia64operator +hi def link masmDirective ia64Directive +hi def link masmOpcode ia64Opcode +hi def link masmIdentifier ia64Identifier +hi def link masmFloat ia64Float - "ia64 specific stuff - HiLink ia64Label Define - HiLink ia64Comment Comment - HiLink ia64Directive Type - HiLink ia64opcode Statement - HiLink ia64registers Operator - HiLink ia64string String - HiLink ia64Hex Number - HiLink ia64Binary Number - HiLink ia64Octal Number - HiLink ia64Float Float - HiLink ia64Decimal Number - HiLink ia64Identifier Identifier - HiLink ia64data Type - HiLink ia64delimiter Delimiter - HiLink ia64operator Operator - HiLink ia64Todo Todo +"ia64 specific stuff +hi def link ia64Label Define +hi def link ia64Comment Comment +hi def link ia64Directive Type +hi def link ia64opcode Statement +hi def link ia64registers Operator +hi def link ia64string String +hi def link ia64Hex Number +hi def link ia64Binary Number +hi def link ia64Octal Number +hi def link ia64Float Float +hi def link ia64Decimal Number +hi def link ia64Identifier Identifier +hi def link ia64data Type +hi def link ia64delimiter Delimiter +hi def link ia64operator Operator +hi def link ia64Todo Todo - delcommand HiLink -endif let b:current_syntax = "ia64" diff --git a/runtime/syntax/icemenu.vim b/runtime/syntax/icemenu.vim index d3a733d579..6513287dfc 100644 --- a/runtime/syntax/icemenu.vim +++ b/runtime/syntax/icemenu.vim @@ -6,10 +6,8 @@ " Comment: Icewm is a lightweight window manager. This adds syntax " highlighting when editing your user's menu file (~/.icewm/menu). -" clear existing syntax -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/icon.vim b/runtime/syntax/icon.vim index 1a73c43d8f..179d75cd28 100644 --- a/runtime/syntax/icon.vim +++ b/runtime/syntax/icon.vim @@ -4,11 +4,8 @@ " URL: ftp://ftp.halcyon.com/pub/users/wturner/icon.vim " Last Change: 2003 May 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -157,56 +154,46 @@ exec "syn sync ccomment iconComment minlines=" . icon_minlines " 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 -if version >= 508 || !exists("did_icon_syn_inits") - if version < 508 - let did_icon_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - - " HiLink iconSpecialCharacter iconSpecial - - HiLink iconOctalError iconError - HiLink iconParenError iconError - HiLink iconInParen iconError - HiLink iconCommentError iconError - HiLink iconSpaceError iconError - HiLink iconCommentError iconError - HiLink iconIncluded iconString - HiLink iconCommentString iconString - HiLink iconComment2String iconString - HiLink iconCommentSkip iconComment - - HiLink iconUserLabel Label - HiLink iconCharacter Character - HiLink iconNumber Number - HiLink iconRadix Number - HiLink iconFloat Float - HiLink iconInclude Include - HiLink iconPreProc PreProc - HiLink iconDefine Macro - HiLink iconError Error - HiLink iconStatement Statement - HiLink iconPreCondit PreCondit - HiLink iconString String - HiLink iconCset String - HiLink iconComment Comment - HiLink iconSpecial SpecialChar - HiLink iconTodo Todo - HiLink iconStorageClass StorageClass - HiLink iconFunction Statement - HiLink iconReserved Label - HiLink iconKeyword Operator - - "HiLink iconIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting + +" The default methods for highlighting. Can be overridden later + +" hi def link iconSpecialCharacter iconSpecial + +hi def link iconOctalError iconError +hi def link iconParenError iconError +hi def link iconInParen iconError +hi def link iconCommentError iconError +hi def link iconSpaceError iconError +hi def link iconCommentError iconError +hi def link iconIncluded iconString +hi def link iconCommentString iconString +hi def link iconComment2String iconString +hi def link iconCommentSkip iconComment + +hi def link iconUserLabel Label +hi def link iconCharacter Character +hi def link iconNumber Number +hi def link iconRadix Number +hi def link iconFloat Float +hi def link iconInclude Include +hi def link iconPreProc PreProc +hi def link iconDefine Macro +hi def link iconError Error +hi def link iconStatement Statement +hi def link iconPreCondit PreCondit +hi def link iconString String +hi def link iconCset String +hi def link iconComment Comment +hi def link iconSpecial SpecialChar +hi def link iconTodo Todo +hi def link iconStorageClass StorageClass +hi def link iconFunction Statement +hi def link iconReserved Label +hi def link iconKeyword Operator + +"hi def link iconIdentifier Identifier + let b:current_syntax = "icon" diff --git a/runtime/syntax/idl.vim b/runtime/syntax/idl.vim index c51850b13a..6a4ce7e087 100644 --- a/runtime/syntax/idl.vim +++ b/runtime/syntax/idl.vim @@ -222,100 +222,98 @@ try if !exists("did_idl_syntax_inits") let did_idl_syntax_inits = 1 " The default methods for highlighting. Can be overridden later - command -nargs=+ HiLink hi def link <args> - - HiLink idlInclude Include - HiLink idlPreProc PreProc - HiLink idlPreCondit PreCondit - HiLink idlDefine Macro - HiLink idlIncluded String - HiLink idlString String - HiLink idlComment Comment - HiLink idlTodo Todo - HiLink idlLiteral Number - HiLink idlUuid Number - HiLink idlType Type - HiLink idlVariantType idlType - - HiLink idlModule Keyword - HiLink idlInterface Keyword - HiLink idlEnum Keyword - HiLink idlStruct Keyword - HiLink idlUnion Keyword - HiLink idlTypedef Keyword - HiLink idlException Keyword - HiLink idlTypedefOtherTypeQualifier keyword - - HiLink idlModuleName Typedef - HiLink idlInterfaceName Typedef - HiLink idlEnumName Typedef - HiLink idlStructName Typedef - HiLink idlUnionName Typedef - - HiLink idlBaseTypeInt idlType - HiLink idlBaseType idlType - HiLink idlSeqType idlType - HiLink idlD1 Paren - HiLink idlD2 Paren - HiLink idlD3 Paren - HiLink idlD4 Paren - "HiLink idlArraySize Paren - "HiLink idlArraySize1 Paren - HiLink idlModuleContent Paren - HiLink idlUnionContent Paren - HiLink idlStructContent Paren - HiLink idlEnumContents Paren - HiLink idlInterfaceContent Paren - - HiLink idlSimpDecl Identifier - HiLink idlROAttr StorageClass - HiLink idlAttr Keyword - HiLink idlConst StorageClass - - HiLink idlOneWayOp StorageClass - HiLink idlOp idlType - HiLink idlParmType idlType - HiLink idlOpName Function - HiLink idlOpParms SpecialComment - HiLink idlParmName Identifier - HiLink idlInheritFrom Identifier - HiLink idlAttribute SpecialComment - - HiLink idlId Constant - "HiLink idlCase Keyword - HiLink idlCaseLabel Constant - - HiLink idlErrorBracket Error - HiLink idlErrorBrace Error - HiLink idlErrorSquareBracket Error - - HiLink idlImport Keyword - HiLink idlImportString idlString - HiLink idlCoclassAttribute StorageClass - HiLink idlLibrary Keyword - HiLink idlImportlib Keyword - HiLink idlCoclass Keyword - HiLink idlLibraryName Typedef - HiLink idlCoclassName Typedef - " hi idlLibraryContent guifg=red - HiLink idlTypedefDecl Typedef - HiLink idlDefEnum Keyword - HiLink idlDefv1Enum Keyword - HiLink idlDefEnumName Typedef - HiLink idlDefEnumContents Paren - HiLink idlDefBaseTypeInt idlType - HiLink idlDefBaseType idlType - HiLink idlDefSeqType idlType - HiLink idlInterfaceSections Label + + hi def link idlInclude Include + hi def link idlPreProc PreProc + hi def link idlPreCondit PreCondit + hi def link idlDefine Macro + hi def link idlIncluded String + hi def link idlString String + hi def link idlComment Comment + hi def link idlTodo Todo + hi def link idlLiteral Number + hi def link idlUuid Number + hi def link idlType Type + hi def link idlVariantType idlType + + hi def link idlModule Keyword + hi def link idlInterface Keyword + hi def link idlEnum Keyword + hi def link idlStruct Keyword + hi def link idlUnion Keyword + hi def link idlTypedef Keyword + hi def link idlException Keyword + hi def link idlTypedefOtherTypeQualifier keyword + + hi def link idlModuleName Typedef + hi def link idlInterfaceName Typedef + hi def link idlEnumName Typedef + hi def link idlStructName Typedef + hi def link idlUnionName Typedef + + hi def link idlBaseTypeInt idlType + hi def link idlBaseType idlType + hi def link idlSeqType idlType + hi def link idlD1 Paren + hi def link idlD2 Paren + hi def link idlD3 Paren + hi def link idlD4 Paren + "hi def link idlArraySize Paren + "hi def link idlArraySize1 Paren + hi def link idlModuleContent Paren + hi def link idlUnionContent Paren + hi def link idlStructContent Paren + hi def link idlEnumContents Paren + hi def link idlInterfaceContent Paren + + hi def link idlSimpDecl Identifier + hi def link idlROAttr StorageClass + hi def link idlAttr Keyword + hi def link idlConst StorageClass + + hi def link idlOneWayOp StorageClass + hi def link idlOp idlType + hi def link idlParmType idlType + hi def link idlOpName Function + hi def link idlOpParms SpecialComment + hi def link idlParmName Identifier + hi def link idlInheritFrom Identifier + hi def link idlAttribute SpecialComment + + hi def link idlId Constant + "hi def link idlCase Keyword + hi def link idlCaseLabel Constant + + hi def link idlErrorBracket Error + hi def link idlErrorBrace Error + hi def link idlErrorSquareBracket Error + + hi def link idlImport Keyword + hi def link idlImportString idlString + hi def link idlCoclassAttribute StorageClass + hi def link idlLibrary Keyword + hi def link idlImportlib Keyword + hi def link idlCoclass Keyword + hi def link idlLibraryName Typedef + hi def link idlCoclassName Typedef + " hi def link idlLibraryContent guifg=red + hi def link idlTypedefDecl Typedef + hi def link idlDefEnum Keyword + hi def link idlDefv1Enum Keyword + hi def link idlDefEnumName Typedef + hi def link idlDefEnumContents Paren + hi def link idlDefBaseTypeInt idlType + hi def link idlDefBaseType idlType + hi def link idlDefSeqType idlType + hi def link idlInterfaceSections Label if exists("idlsyntax_showerror") if exists("idlsyntax_showerror_soft") hi default idlError guibg=#d0ffd0 else - HiLink idlError Error + hi def link idlError Error endif endif - delcommand HiLink endif let b:current_syntax = "idl" diff --git a/runtime/syntax/idlang.vim b/runtime/syntax/idlang.vim index 670d080a7d..14e976ce05 100644 --- a/runtime/syntax/idlang.vim +++ b/runtime/syntax/idlang.vim @@ -4,11 +4,8 @@ " Created by: Hermann Rochholz <Hermann.Rochholz AT gmx.de> " Remove any old syntax stuff hanging around -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -219,35 +216,25 @@ syn keyword idlangRoutine XSQ_TEST XSURFACE XVAREDIT XVOLUME XVOLUME_ROTATE syn keyword idlangRoutine XVOLUME_WRITE_IMAGE XYOUTS ZOOM ZOOM_24 " 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_idlang_syn_inits") - if version < 508 - let did_idlang_syn_inits = 1 - command -nargs=+ HiLink hi link <args> -else - command -nargs=+ HiLink hi def link <args> -endif +" Only when an item doesn't have highlighting yet + +hi def link idlangConditional Conditional +hi def link idlangRoutine Type +hi def link idlangStatement Statement +hi def link idlangContinueLine Todo +hi def link idlangRealNumber Float +hi def link idlangNumber Number +hi def link idlangString String +hi def link idlangOperator Operator +hi def link idlangComment Comment +hi def link idlangTodo Todo +hi def link idlangPreCondit Identifier +hi def link idlangDblCommaError Error +hi def link idlangStop Error +hi def link idlangStrucvar PreProc +hi def link idlangSystem Identifier +hi def link idlangKeyword Special - HiLink idlangConditional Conditional - HiLink idlangRoutine Type - HiLink idlangStatement Statement - HiLink idlangContinueLine Todo - HiLink idlangRealNumber Float - HiLink idlangNumber Number - HiLink idlangString String - HiLink idlangOperator Operator - HiLink idlangComment Comment - HiLink idlangTodo Todo - HiLink idlangPreCondit Identifier - HiLink idlangDblCommaError Error - HiLink idlangStop Error - HiLink idlangStrucvar PreProc - HiLink idlangSystem Identifier - HiLink idlangKeyword Special - - delcommand HiLink -endif let b:current_syntax = "idlang" " vim: ts=18 diff --git a/runtime/syntax/indent.vim b/runtime/syntax/indent.vim index 389101a522..ddeae67e0d 100644 --- a/runtime/syntax/indent.vim +++ b/runtime/syntax/indent.vim @@ -1,10 +1,10 @@ " Vim syntax file -" Language: indent(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-23 -" indent_is_bsd: If exists, will change somewhat to match BSD implementation +" Language: indent(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-01-23 +" indent_is_bsd: If exists, will change somewhat to match BSD implementation " -" TODO: is the deny-all (a la lilo.vim nice or no?)... +" TODO: is the deny-all (a la lilo.vim nice or no?)... " irritating to be wrong to the last char... " would be sweet if right until one char fails diff --git a/runtime/syntax/inform.vim b/runtime/syntax/inform.vim index d8ba43dcee..e3e1b3e1f0 100644 --- a/runtime/syntax/inform.vim +++ b/runtime/syntax/inform.vim @@ -4,10 +4,8 @@ " URL: http://www.gowarthomas.com/informvim " Last Change: 2006 April 20 -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -294,13 +292,8 @@ endif " Handling for different versions of VIM. -if version >= 600 - setlocal iskeyword+=$ - command -nargs=+ SynDisplay syntax <args> display -else - set iskeyword+=$ - command -nargs=+ SynDisplay syntax <args> -endif +setlocal iskeyword+=$ +command -nargs=+ SynDisplay syntax <args> display " Grammar sections. @@ -347,61 +340,52 @@ syn sync maxlines=500 delcommand SynDisplay " The default highlighting. -if version >= 508 || !exists("did_inform_syn_inits") - if version < 508 - let did_inform_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink informDefine Define - HiLink informType Type - HiLink informInclude Include - HiLink informPreCondit PreCondit - HiLink informPreProc PreProc - HiLink informGramPreProc PreProc - HiLink informAsm Special - if !exists("inform_suppress_obsolete") - HiLink informAsmObsolete informError - HiLink informKeywordObsolete informError - else - HiLink informAsmObsolete Special - HiLink informKeywordObsolete Keyword - endif - HiLink informPredicate Operator - HiLink informSysFunc Identifier - HiLink informSysConst Identifier - HiLink informConditional Conditional - HiLink informRepeat Repeat - HiLink informStatement Statement - HiLink informOperator Operator - HiLink informKeyword Keyword - HiLink informGrammar Keyword - HiLink informDictString String - HiLink informNumber Number - HiLink informError Error - HiLink informString String - HiLink informComment Comment - HiLink informAccent Special - HiLink informStringUnicode Special - HiLink informStringCode Special - HiLink informTodo Todo - if !exists("inform_highlight_simple") - HiLink informLibAttrib Identifier - HiLink informLibProp Identifier - HiLink informLibObj Identifier - HiLink informLibRoutine Identifier - HiLink informLibVariable Identifier - HiLink informLibConst Identifier - HiLink informLibAction Identifier - endif - HiLink informBadDictString informError - HiLink informBadAccent informError - HiLink informBadStrUnicode informError - delcommand HiLink +hi def link informDefine Define +hi def link informType Type +hi def link informInclude Include +hi def link informPreCondit PreCondit +hi def link informPreProc PreProc +hi def link informGramPreProc PreProc +hi def link informAsm Special +if !exists("inform_suppress_obsolete") +hi def link informAsmObsolete informError +hi def link informKeywordObsolete informError +else +hi def link informAsmObsolete Special +hi def link informKeywordObsolete Keyword endif +hi def link informPredicate Operator +hi def link informSysFunc Identifier +hi def link informSysConst Identifier +hi def link informConditional Conditional +hi def link informRepeat Repeat +hi def link informStatement Statement +hi def link informOperator Operator +hi def link informKeyword Keyword +hi def link informGrammar Keyword +hi def link informDictString String +hi def link informNumber Number +hi def link informError Error +hi def link informString String +hi def link informComment Comment +hi def link informAccent Special +hi def link informStringUnicode Special +hi def link informStringCode Special +hi def link informTodo Todo +if !exists("inform_highlight_simple") +hi def link informLibAttrib Identifier +hi def link informLibProp Identifier +hi def link informLibObj Identifier +hi def link informLibRoutine Identifier +hi def link informLibVariable Identifier +hi def link informLibConst Identifier +hi def link informLibAction Identifier +endif +hi def link informBadDictString informError +hi def link informBadAccent informError +hi def link informBadStrUnicode informError + let b:current_syntax = "inform" diff --git a/runtime/syntax/initex.vim b/runtime/syntax/initex.vim index 8f3462f5cf..564a6e0cca 100644 --- a/runtime/syntax/initex.vim +++ b/runtime/syntax/initex.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: TeX (core definition) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: TeX (core definition) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish @@ -11,7 +11,7 @@ let s:cpo_save = &cpo set cpo&vim " This follows the grouping (sort of) found at -" http://www.tug.org/utilities/plain/cseq.html#top-fam +" http: //www.tug.org/utilities/plain/cseq.html#top-fam syn keyword initexTodo TODO FIXME XXX NOTE diff --git a/runtime/syntax/inittab.vim b/runtime/syntax/inittab.vim index b7472f9e0f..82bf660105 100644 --- a/runtime/syntax/inittab.vim +++ b/runtime/syntax/inittab.vim @@ -6,12 +6,9 @@ " URL: http://physics.muni.cz/~yeti/download/syntax/inittab.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case match @@ -45,31 +42,22 @@ syn match inittabProcessPlus "+" contained nextgroup=inittabProcess,inittabError syn region inittabProcess start="/" end="$" transparent oneline contained contains=@inittabSh,inittabComment " Define the default highlighting -if version >= 508 || !exists("did_inittab_syntax_inits") - if version < 508 - let did_inittab_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink inittabComment Comment - HiLink inittabFixme Todo - HiLink inittabActionName Type - HiLink inittabError Error - HiLink inittabId Identifier - HiLink inittabRunLevels Special +hi def link inittabComment Comment +hi def link inittabFixme Todo +hi def link inittabActionName Type +hi def link inittabError Error +hi def link inittabId Identifier +hi def link inittabRunLevels Special - HiLink inittabColonProcess inittabColon - HiLink inittabColonAction inittabColon - HiLink inittabColonRunLevels inittabColon - HiLink inittabColon PreProc +hi def link inittabColonProcess inittabColon +hi def link inittabColonAction inittabColon +hi def link inittabColonRunLevels inittabColon +hi def link inittabColon PreProc - HiLink inittabShString String - HiLink inittabShOption Special - HiLink inittabShCommand Statement +hi def link inittabShString String +hi def link inittabShOption Special +hi def link inittabShCommand Statement - delcommand HiLink -endif let b:current_syntax = "inittab" diff --git a/runtime/syntax/ipfilter.vim b/runtime/syntax/ipfilter.vim index db99812852..a7b7df2bac 100644 --- a/runtime/syntax/ipfilter.vim +++ b/runtime/syntax/ipfilter.vim @@ -9,11 +9,8 @@ " not correctly identified. " Please send comments to hendrik@scholz.net -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/ishd.vim b/runtime/syntax/ishd.vim index 1c011f1b92..3c468e361f 100644 --- a/runtime/syntax/ishd.vim +++ b/runtime/syntax/ishd.vim @@ -3,11 +3,8 @@ " Maintainer: Robert M. Cortopassi <cortopar@mindspring.com> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -387,35 +384,25 @@ syn cluster ishdPreProcGroup contains=ishdPreCondit,ishdIncluded,ishdInclude,ish syn region ishdDefine start="^\s*#\s*\(define\|undef\)\>" end="$" contains=ALLBUT,@ishdPreProcGroup " 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_is_syntax_inits") - if version < 508 - let did_is_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink ishdNumber Number - HiLink ishdError Error - HiLink ishdStatement Statement - HiLink ishdString String - HiLink ishdComment Comment - HiLink ishdTodo Todo - HiLink ishdFunction Identifier - HiLink ishdConstant PreProc - HiLink ishdType Type - HiLink ishdInclude Include - HiLink ishdDefine Macro - HiLink ishdIncluded String - HiLink ishdPreCondit PreCondit - HiLink ishdHashIf0Skip ishdHashIf0 - HiLink ishdHashIf0End ishdHashIf0 - HiLink ishdHashIf0 Comment +hi def link ishdNumber Number +hi def link ishdError Error +hi def link ishdStatement Statement +hi def link ishdString String +hi def link ishdComment Comment +hi def link ishdTodo Todo +hi def link ishdFunction Identifier +hi def link ishdConstant PreProc +hi def link ishdType Type +hi def link ishdInclude Include +hi def link ishdDefine Macro +hi def link ishdIncluded String +hi def link ishdPreCondit PreCondit +hi def link ishdHashIf0Skip ishdHashIf0 +hi def link ishdHashIf0End ishdHashIf0 +hi def link ishdHashIf0 Comment - delcommand HiLink -endif let b:current_syntax = "ishd" diff --git a/runtime/syntax/iss.vim b/runtime/syntax/iss.vim index 26d9150b5a..e58c618b7f 100644 --- a/runtime/syntax/iss.vim +++ b/runtime/syntax/iss.vim @@ -9,11 +9,8 @@ " - Pascal scripting syntax is not recognized. " - Embedded double quotes confuse string matches. e.g. "asfd""asfa" -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -105,44 +102,34 @@ syn keyword issTasksFlags checkedonce dontinheritcheck exclusive restart uncheck " 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_iss_syntax_inits") - if version < 508 - let did_iss_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink issSection Special - HiLink issComment Comment - HiLink issDirective Type - HiLink issParam Type - HiLink issFolder Special - HiLink issString String - HiLink issURL Include - HiLink issPreProc PreProc - - HiLink issDirsFlags Keyword - HiLink issFilesCopyMode Keyword - HiLink issFilesAttribs Keyword - HiLink issFilesPermissions Keyword - HiLink issFilesFlags Keyword - HiLink issIconsFlags Keyword - HiLink issINIFlags Keyword - HiLink issRegRootKey Keyword - HiLink issRegValueType Keyword - HiLink issRegFlags Keyword - HiLink issRunFlags Keyword - HiLink issTypesFlags Keyword - HiLink issComponentsFlags Keyword - HiLink issInstallDeleteType Keyword - HiLink issTasksFlags Keyword - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link issSection Special +hi def link issComment Comment +hi def link issDirective Type +hi def link issParam Type +hi def link issFolder Special +hi def link issString String +hi def link issURL Include +hi def link issPreProc PreProc + +hi def link issDirsFlags Keyword +hi def link issFilesCopyMode Keyword +hi def link issFilesAttribs Keyword +hi def link issFilesPermissions Keyword +hi def link issFilesFlags Keyword +hi def link issIconsFlags Keyword +hi def link issINIFlags Keyword +hi def link issRegRootKey Keyword +hi def link issRegValueType Keyword +hi def link issRegFlags Keyword +hi def link issRunFlags Keyword +hi def link issTypesFlags Keyword +hi def link issComponentsFlags Keyword +hi def link issInstallDeleteType Keyword +hi def link issTasksFlags Keyword + let b:current_syntax = "iss" diff --git a/runtime/syntax/ist.vim b/runtime/syntax/ist.vim index 131d833cbc..e34edac272 100644 --- a/runtime/syntax/ist.vim +++ b/runtime/syntax/ist.vim @@ -3,22 +3,15 @@ " Maintainer: Peter Meszaros <pmeszaros@effice.hu> " Last Change: 2012 Jan 08 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim -if version >= 600 - setlocal iskeyword=$,@,48-57,_ -else - set iskeyword=$,@,48-57,_ -endif +setlocal iskeyword=$,@,48-57,_ syn case ignore syn keyword IstInpSpec actual arg_close arg_open encap escape @@ -45,28 +38,18 @@ syn match IstSpecial "\\\\\|{\|}\|#\|\\n" contained syn match IstTodo "DEBUG\|TODO" contained " 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_dummy_syn_inits") - if version < 508 - let did_dummy_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink IstInpSpec Type - HiLink IstOutSpec Identifier - HiLink IstString String - HiLink IstNumber Number - HiLink IstComment Comment - HiLink IstTodo Todo - HiLink IstSpecial Special - HiLink IstDoubleQuote Label - HiLink IstCharacter Label +" Only when an item doesn't have highlighting yet + +hi def link IstInpSpec Type +hi def link IstOutSpec Identifier +hi def link IstString String +hi def link IstNumber Number +hi def link IstComment Comment +hi def link IstTodo Todo +hi def link IstSpecial Special +hi def link IstDoubleQuote Label +hi def link IstCharacter Label - delcommand HiLink -endif let b:current_syntax = "ist" diff --git a/runtime/syntax/j.vim b/runtime/syntax/j.vim index bde954506e..4912942e8b 100644 --- a/runtime/syntax/j.vim +++ b/runtime/syntax/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2014-05-25 +" Last Change: 2015-01-11 if exists('b:current_syntax') finish @@ -12,7 +12,7 @@ let s:save_cpo = &cpo set cpo&vim syntax case match -syntax sync minlines=50 +syntax sync minlines=100 syntax cluster jStdlibItems contains=jStdlibNoun,jStdlibAdverb,jStdlibConjunction,jStdlibVerb syntax cluster jPrimitiveItems contains=jNoun,jAdverb,jConjunction,jVerb,jCopula @@ -23,33 +23,39 @@ syntax match jControl /\<\%(for\|goto\|label\)_\a\k*\./ " Standard library names. A few names need to be defined with ":syntax match" " because they would otherwise take precedence over the corresponding jControl " and jDefineExpression items. -syntax keyword jStdlibNoun ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FHS IF64 IFIOS IFJCDROID IFJHS IFQT IFRASPI IFUNIX IFWIN IFWINCE IFWINE IFWOW64 JB01 JBOXED JCHAR JCMPX JFL JINT JPTR JSIZES JSTR JTYPES JVERSION LF LF2 TAB UNAME UNXLIB andurl dbhelp libjqt -syntax keyword jStdlibAdverb define each every fapplylines inv inverse items leaf rows table +syntax keyword jStdlibNoun ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FHS IF64 IFIOS IFJCDROID IFJHS IFQT IFRASPI IFUNIX IFWIN IFWINCE IFWINE IFWOW64 JB01 JBOXED JCHAR JCMPX JFL JINT JPTR JSIZES JSTR JTYPES JVERSION LF LF2 TAB UNAME UNXLIB dbhelp libjqt +syntax keyword jStdlibAdverb define each every fapplylines inv inverse items leaf rows rxapply rxmerge table syntax keyword jStdlibConjunction bind cuts def on -syntax keyword jStdlibVerb AND Endian IFDEF Note OR XOR alpha17 alpha27 anddf android_exec_host andunzip apply boxopen boxxopen bx calendar cd cdcb cder cderx cdf charsub chopstring clear coclass cocreate cocurrent codestroy coerase cofind cofindv cofullname coinfo coinsert coname conames conew conl conouns conounsx copath copathnl copathnlx coreset costate cut cutLF cutopen cutpara datatype dbctx dberm dberr dbg dbjmp dblocals dblxq dblxs dbnxt dbq dbr dbret dbrr dbrrx dbrun dbs dbsig dbsq dbss dbst dbstack dbstk dbstop dbstopme dbstopnext dbstops dbtrace dbview deb debc delstring detab dfh dir dircompare dircompares dirfind dirpath dirss dirssrplc dirtree dirused dlb dltb dltbs dquote drop dropafter dropto dtb dtbs echo empty endian erase evtloop exit expand f2utf8 fappend fappends fboxname fc fcopynew fdir ferase fetch fexist fexists fgets file2url fixdotdot fliprgb fmakex foldpara foldtext fpathcreate fpathname fputs fread freadblock freadr freads frename freplace fsize fss fssrplc fstamp fstringreplace ftype fview fwrite fwritenew fwrites getargs getdate getenv getqtbin hfd hostpathsep ic install iospath isatty isotimestamp isutf8 jcwdpath joinstring jpathsep jsystemdefs list ljust load loadd mema memf memr memw nameclass namelist names nc nl pick quote require rjust rplc script scriptd setbreak show sign sminfo smoutput sort split splitnostring splitstring ss startupandroid startupconsole startupide stderr stdin stdout stringreplace symdat symget symset take takeafter taketo timespacex timestamp timex tmoutput toCRLF toHOST toJ todate todayno tolower topara toupper tsdiff tsrep tstamp type ucp ucpcount unxlib usleep utf8 uucp valdate wcsize weekday weeknumber weeksinyear winpathsep +syntax keyword jStdlibVerb AND Endian IFDEF OR XOR anddf android_exec_am android_exec_host andunzip apply boxopen boxxopen bx calendar cd cdcb cder cderx cdf charsub chopstring cleartags clear coclass cocreate cocurrent codestroy coerase cofind cofindv cofullname coinfo coinsert compare coname conames conew conl conouns conounsx copath copathnl copathnlx coreset costate cut cutLF cutopen cutpara datatype dbctx dberm dberr dbg dbjmp dblocals dblxq dblxs dbnxt dbq dbr dbret dbrr dbrrx dbrun dbs dbsig dbsq dbss dbst dbstack dbstk dbstop dbstopme dbstopnext dbstops dbtrace dbview deb debc delstring detab dfh dir dircompare dircompares dirfind dirpath dirss dirssrplc dirtree dirused dlb dltb dltbs dquote drop dropafter dropto dtb dtbs echo empty endian erase evtloop exit expand f2utf8 fappend fappends fboxname fc fcompare fcompares fcopynew fdir ferase fetch fexist fexists fgets file2url fixdotdot fliprgb fmakex foldpara foldtext fpathcreate fpathname fputs fread freadblock freadr freads frename freplace fsize fss fssrplc fstamp fstringreplace ftype fview fwrite fwritenew fwrites getalpha getargs getdate getenv getqtbin hfd hostpathsep ic install iospath isatty isotimestamp isutf8 jcwdpath joinstring jpath jpathsep jsystemdefs launch list ljust load loadd loadtags mema memf memr memw nameclass namelist names nc nl pick quote require rjust rplc rxE rxall rxcomp rxcut rxeq rxerror rxfirst rxfree rxfrom rxhandles rxin rxindex rxinfo rxmatch rxmatches rxrplc rxutf8 script scriptd scripts setalpha setbreak shell show sign sminfo smoutput sort split splitnostring splitstring ss startupandroid startupconsole startupide stderr stdin stdout stringreplace symdat symget symset ta tagcp tagopen tagselect take takeafter taketo timespacex timestamp timex tmoutput toCRLF toHOST toJ todate todayno tolower topara toupper tsdiff tsrep tstamp type ucp ucpcount unxlib usleep utf8 uucp valdate wcsize weekday weeknumber weeksinyear winpathsep xedit syntax match jStdlibNoun /\<\%(adverb\|conjunction\|dyad\|monad\|noun\|verb\)\>/ -syntax match jStdlibVerb /\<\%(assert\|break\|do\)\>\.\@!/ +syntax match jStdlibVerb /\<\%(Note\|\%(assert\|break\|do\)\.\@!\)\>/ -" Numbers. Matching J numbers is difficult. The regular expression used for -" the general case roughly embodies this grammar sketch: +" Numbers. Matching J numbers is difficult. In fact, the job cannot be done +" with regular expressions alone. Below is a sketch of the pattern used. It +" accepts most well-formed numbers and rejects most of the ill-formed ones. +" See http://www.jsoftware.com/help/dictionary/dcons.htm for reference. " -" BASE := /_?\d+(\.\d*)?([eE]_?\d+)?/ -" RATIONAL := BASE | BASE r BASE -" COMPLEX := BASE | BASE (j|a[dr]) BASE -" JNUMBER := RATIONAL | RATIONAL [px] RATIONAL | COMPLEX | COMPLEX [px] COMPLEX +" "double1" and "double2" patterns: +" (_?\d+(\.\d*)?|_\.\d+)([eE]_?\d+)? +" (_?\d+(\.\d*)?|_\.\d+|\.\d+)([eE]_?\d+)? " -" The grammar is implemented as shown in this pseudo-regexp: +" "rational1" and "rational2" patterns: +" \k<double1>(r\k<double2>)?|__? +" \k<double2>(r\k<double2>)?|__? " -" base rational complex remainder -" /\< B ( [r]B ([px]B([r]B)?)? | (j|a[dr])B ([px]B((j|a[dr])B)?)? | [px]B ((j|a[dr]|r)B)? )?/ +" "complex1" and "complex2" patterns: +" \k<rational1>((j|a[dr])\k<rational2>)? +" \k<rational2>((j|a[dr])\k<rational2>)? " -" All in all, a compromise between correctness and practicality had to be -" made. See http://www.jsoftware.com/help/dictionary/dcons.htm for reference. -syntax match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\|r\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\)\=/ -syntax match jNumber /\<_\=\d\+\%([eE]\d\+\)\=b_\=[0-9a-z]\+\%(\.[0-9a-z]\+\)\=/ -syntax match jNumber /\<__\=\>/ -syntax match jNumber /\<_\./ -syntax match jNumber /\<_\=\d\+x\>/ +" "basevalue" pattern: +" _?[0-9a-z]+(\.[0-9a-z]*)?|_?\.[0-9a-z]+ +" +" all numbers: +" \b\k<complex1>([px]\k<complex2>)?(b\k<basevalue>)?(?![0-9A-Za-z_.]) +syntax match jNumber /\<_\.[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<_\=\d\+x[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<\%(__\=r_\=\d\+\|_\=\d\+r__\=\)[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\%([px]\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\)\=\%(b\%(_\=[0-9a-z]\+\%(\.[0-9a-z]*\)\=\|_\=\.[0-9a-z]\+\)\)\=[0-9A-Za-z_.]\@!/ syntax region jString oneline start=/'/ skip=/''/ end=/'/ @@ -69,12 +75,12 @@ syntax match jConjunction /;\.\|\^:\|![.:]/ " the next line. The trick is to split the problem into two regions and link " them with "nextgroup=". The fold wrapper provides syntax folding. syntax region jNounDefineFold - \ matchgroup=NONE start=/\<\%(\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\>\)\@=/ + \ matchgroup=NONE start=/\%(\%(\%(^\s*Note\)\|\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>\)\@=/ \ keepend matchgroup=NONE end=/^\s*)\s*$/ \ contains=jNounDefineStart \ fold syntax region jNounDefineStart - \ matchgroup=jDefineExpression start=/\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\>/ + \ matchgroup=jDefineExpression start=/\%(\%(^\s*Note\)\|\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>/ \ keepend matchgroup=NONE end=/$/ \ contains=@jStdlibItems,@jPrimitiveItems,jNumber,jString,jParenGroup,jParen,jComment \ contained oneline skipempty nextgroup=jDefineEnd,jNounDefine @@ -106,7 +112,7 @@ syntax region jParenGroup \ oneline transparent syntax keyword jTodo contained TODO FIXME XXX -syntax match jComment /NB\..*$/ contains=jTodo,@Spell +syntax match jComment /\<NB\..*$/ contains=jTodo,@Spell syntax match jSharpBang /\%^#!.*$/ diff --git a/runtime/syntax/jal.vim b/runtime/syntax/jal.vim index d0ba672851..460bc01752 100644 --- a/runtime/syntax/jal.vim +++ b/runtime/syntax/jal.vim @@ -9,11 +9,8 @@ " " TODO test. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -171,77 +168,67 @@ endif " 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_jal_syn_inits") -if version < 508 - let did_jal_syn_inits = 1 - command -nargs=+ HiLink hi link <args> -else - command -nargs=+ HiLink hi def link <args> -endif +" Only when an item doesn't have highlighting yet + +hi def link jalAcces jalStatement +hi def link jalBoolean Boolean +hi def link jalBit Boolean +hi def link jalComment Comment +hi def link jalConditional Conditional +hi def link jalConstant Constant +hi def link jalDelimiter Identifier +hi def link jalDirective PreProc +hi def link jalException Exception +hi def link jalFloat Float +hi def link jalFunction Function +hi def link jalPsudoVarsKey Function +hi def link jalLabel Label +hi def link jalMatrixDelimiter Identifier +hi def link jalModifier Type +hi def link jalNumber Number +hi def link jalBinNumber Number +hi def link jalHexNumber Number +hi def link jalOperator Operator +hi def link jalPredefined Constant +hi def link jalPreProc PreProc +hi def link jalRepeat Repeat +hi def link jalStatement Statement +hi def link jalString String +hi def link jalStringEscape Special +hi def link jalStringEscapeGPC Special +hi def link jalStringError Error +hi def link jalStruct jalStatement +hi def link jalSymbolOperator jalOperator +hi def link jalTodo Todo +hi def link jalType Type +hi def link jalUnclassified Statement +hi def link jalAsm Assembler +hi def link jalError Error +hi def link jalAsmKey Statement +hi def link jalPIC Statement + +hi def link jalShowTab Error + +hi def link picTodo Todo +hi def link picComment Comment +hi def link picDirective Statement +hi def link picLabel Label +hi def link picString String + +hi def link picOpcode Keyword +hi def link picRegister Structure +hi def link picRegisterPart Special +hi def link picPinDir SPecial +hi def link picPortDir SPecial + +hi def link picASCII String +hi def link picBinary Number +hi def link picDecimal Number +hi def link picHexadecimal Number +hi def link picOctal Number + +hi def link picIdentifier Identifier - HiLink jalAcces jalStatement - HiLink jalBoolean Boolean - HiLink jalBit Boolean - HiLink jalComment Comment - HiLink jalConditional Conditional - HiLink jalConstant Constant - HiLink jalDelimiter Identifier - HiLink jalDirective PreProc - HiLink jalException Exception - HiLink jalFloat Float - HiLink jalFunction Function - HiLink jalPsudoVarsKey Function - HiLink jalLabel Label - HiLink jalMatrixDelimiter Identifier - HiLink jalModifier Type - HiLink jalNumber Number - HiLink jalBinNumber Number - HiLink jalHexNumber Number - HiLink jalOperator Operator - HiLink jalPredefined Constant - HiLink jalPreProc PreProc - HiLink jalRepeat Repeat - HiLink jalStatement Statement - HiLink jalString String - HiLink jalStringEscape Special - HiLink jalStringEscapeGPC Special - HiLink jalStringError Error - HiLink jalStruct jalStatement - HiLink jalSymbolOperator jalOperator - HiLink jalTodo Todo - HiLink jalType Type - HiLink jalUnclassified Statement - HiLink jalAsm Assembler - HiLink jalError Error - HiLink jalAsmKey Statement - HiLink jalPIC Statement - - HiLink jalShowTab Error - - HiLink picTodo Todo - HiLink picComment Comment - HiLink picDirective Statement - HiLink picLabel Label - HiLink picString String - - HiLink picOpcode Keyword - HiLink picRegister Structure - HiLink picRegisterPart Special - HiLink picPinDir SPecial - HiLink picPortDir SPecial - - HiLink picASCII String - HiLink picBinary Number - HiLink picDecimal Number - HiLink picHexadecimal Number - HiLink picOctal Number - - HiLink picIdentifier Identifier - - delcommand HiLink -endif let b:current_syntax = "jal" diff --git a/runtime/syntax/jam.vim b/runtime/syntax/jam.vim index cbd99bb9ce..fc7f49d1f0 100644 --- a/runtime/syntax/jam.vim +++ b/runtime/syntax/jam.vim @@ -3,22 +3,15 @@ " Maintainer: Ralf Lemke (ralflemk@t-online.de) " Last change: 2012 Jan 08 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim -if version >= 600 - setlocal iskeyword=@,48-57,_,- -else - set iskeyword=@,48-57,_,- -endif +setlocal iskeyword=@,48-57,_,- " A bunch of useful jam keywords syn keyword jamStatement break call dbms flush global include msg parms proc public receive return send unload vars @@ -167,88 +160,78 @@ syntax match jamCommentError "\*/" syntax match jamOperator3Error "*/" " 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_jam_syn_inits") - if version < 508 - let did_jam_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink jamCommentL jamComment - HiLink jamCommentL2 jamComment - HiLink jamOperator3Error jamError - HiLink jamConditional Conditional - HiLink jamRepeat Repeat - HiLink jamCharacter Character - HiLink jamSpecialCharacter jamSpecial - HiLink jamNumber Number - HiLink jamParenError jamError - HiLink jamErrInParen jamError - HiLink jamErrInBracket jamError - HiLink jamCommentError jamError - HiLink jamSpaceError jamError - HiLink jamSpecialError jamError - HiLink jamOperator1 jamOperator - HiLink jamOperator2 jamOperator - HiLink jamOperator3 jamOperator - HiLink jamOperator4 jamOperator - HiLink jamOperator5 jamOperator - HiLink jamOperator6 jamOperator - HiLink jamOperator7 jamOperator - HiLink jamOperator8 jamOperator - HiLink jamOperator9 jamOperator - HiLink jamOperator10 jamOperator - HiLink jamOperator11 jamOperator - HiLink jamOperator12 jamOperator - HiLink jamOperator13 jamOperator - HiLink jamOperator14 jamOperator - HiLink jamError Error - HiLink jamStatement Statement - HiLink jamPreCondit PreCondit - HiLink jamCommentError jamError - HiLink jamCommentString jamString - HiLink jamComment2String jamString - HiLink jamCommentSkip jamComment - HiLink jamString String - HiLink jamComment Comment - HiLink jamSpecial SpecialChar - HiLink jamTodo Todo - HiLink jamCppSkip jamCppOut - HiLink jamCppOut2 jamCppOut - HiLink jamCppOut Comment - HiLink jamDBState1 Identifier - HiLink jamDBState2 Identifier - HiLink jamSQLState1 jamSQL - HiLink jamSQLState2 jamSQL - HiLink jamLibFunc1 jamLibFunc - HiLink jamLibFunc2 jamLibFunc - HiLink jamLibFunc3 jamLibFunc - HiLink jamLibFunc4 jamLibFunc - HiLink jamLibFunc5 jamLibFunc - HiLink jamLibFunc6 jamLibFunc - HiLink jamLibFunc7 jamLibFunc - HiLink jamLibFunc8 jamLibFunc - HiLink jamLibFunc9 jamLibFunc - HiLink jamVariable1 jamVariablen - HiLink jamVariable2 jamVariablen - HiLink jamVariable3 jamVariablen - HiLink jamVariable4 jamVariablen - HiLink jamVariable5 jamVariablen - HiLink jamVariable6 jamVariablen - HiLink jamVariable7 jamVariablen - HiLink jamVariable8 jamVariablen - HiLink jamVariable9 jamVariablen - HiLink jamVariable10 jamVariablen - HiLink jamVariablen Constant - HiLink jamSQL Type - HiLink jamLibFunc PreProc - HiLink jamOperator Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link jamCommentL jamComment +hi def link jamCommentL2 jamComment +hi def link jamOperator3Error jamError +hi def link jamConditional Conditional +hi def link jamRepeat Repeat +hi def link jamCharacter Character +hi def link jamSpecialCharacter jamSpecial +hi def link jamNumber Number +hi def link jamParenError jamError +hi def link jamErrInParen jamError +hi def link jamErrInBracket jamError +hi def link jamCommentError jamError +hi def link jamSpaceError jamError +hi def link jamSpecialError jamError +hi def link jamOperator1 jamOperator +hi def link jamOperator2 jamOperator +hi def link jamOperator3 jamOperator +hi def link jamOperator4 jamOperator +hi def link jamOperator5 jamOperator +hi def link jamOperator6 jamOperator +hi def link jamOperator7 jamOperator +hi def link jamOperator8 jamOperator +hi def link jamOperator9 jamOperator +hi def link jamOperator10 jamOperator +hi def link jamOperator11 jamOperator +hi def link jamOperator12 jamOperator +hi def link jamOperator13 jamOperator +hi def link jamOperator14 jamOperator +hi def link jamError Error +hi def link jamStatement Statement +hi def link jamPreCondit PreCondit +hi def link jamCommentError jamError +hi def link jamCommentString jamString +hi def link jamComment2String jamString +hi def link jamCommentSkip jamComment +hi def link jamString String +hi def link jamComment Comment +hi def link jamSpecial SpecialChar +hi def link jamTodo Todo +hi def link jamCppSkip jamCppOut +hi def link jamCppOut2 jamCppOut +hi def link jamCppOut Comment +hi def link jamDBState1 Identifier +hi def link jamDBState2 Identifier +hi def link jamSQLState1 jamSQL +hi def link jamSQLState2 jamSQL +hi def link jamLibFunc1 jamLibFunc +hi def link jamLibFunc2 jamLibFunc +hi def link jamLibFunc3 jamLibFunc +hi def link jamLibFunc4 jamLibFunc +hi def link jamLibFunc5 jamLibFunc +hi def link jamLibFunc6 jamLibFunc +hi def link jamLibFunc7 jamLibFunc +hi def link jamLibFunc8 jamLibFunc +hi def link jamLibFunc9 jamLibFunc +hi def link jamVariable1 jamVariablen +hi def link jamVariable2 jamVariablen +hi def link jamVariable3 jamVariablen +hi def link jamVariable4 jamVariablen +hi def link jamVariable5 jamVariablen +hi def link jamVariable6 jamVariablen +hi def link jamVariable7 jamVariablen +hi def link jamVariable8 jamVariablen +hi def link jamVariable9 jamVariablen +hi def link jamVariable10 jamVariablen +hi def link jamVariablen Constant +hi def link jamSQL Type +hi def link jamLibFunc PreProc +hi def link jamOperator Special + let b:current_syntax = "jam" diff --git a/runtime/syntax/jargon.vim b/runtime/syntax/jargon.vim index 25a88bc981..415f2bc972 100644 --- a/runtime/syntax/jargon.vim +++ b/runtime/syntax/jargon.vim @@ -3,11 +3,8 @@ " Maintainer: <rms@poczta.onet.pl> " Last Change: 2001 May 26 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -17,20 +14,10 @@ syn match jargonUrl +\(http\|ftp\)://[^\t )"]*+ syn match jargonMark /{[^}]*}/ " 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_jargon_syntax_inits") - if version < 508 - let did_jargon_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink jargonChaptTitle Title - HiLink jargonEmailAddr Comment - HiLink jargonUrl Comment - HiLink jargonMark Label - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link jargonChaptTitle Title +hi def link jargonEmailAddr Comment +hi def link jargonUrl Comment +hi def link jargonMark Label let b:current_syntax = "jargon" diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index e5491b2612..9568e91a77 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -1,16 +1,15 @@ +scriptencoding utf-8 " Vim syntax file " Language: Java " Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/java.vim -" Last Change: 2012 Oct 05 +" Last Change: 2015 March 01 " Please check :help java.vim for comments on some of the options available. -" Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif " we define it here so that included files can test for it @@ -21,22 +20,15 @@ endif let s:cpo_save = &cpo set cpo&vim -" don't use standard HiLink, it will not work with included syntax files -if version < 508 - command! -nargs=+ JavaHiLink hi link <args> -else - command! -nargs=+ JavaHiLink hi def link <args> -endif - " some characters that cannot be in a java program (outside a string) syn match javaError "[\\@`]" -syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|[^-]->\|\*\/" +syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/" syn match javaOK "\.\.\." " use separate name so that it can be deleted in javacc.vim syn match javaError2 "#\|=<" -JavaHiLink javaError2 javaError +hi def link javaError2 javaError @@ -63,7 +55,7 @@ syn match javaTypedef "\.\s*\<class\>"ms=s+1 syn keyword javaClassDecl enum syn match javaClassDecl "^class\>" syn match javaClassDecl "[^.]\s*\<class\>"ms=s+1 -syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>" +syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>\(([^)]*)\)\=" contains=javaString syn match javaClassDecl "@interface\>" syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained @@ -79,32 +71,32 @@ if exists("java_highlight_all") || exists("java_highlight_java") || exists("ja syn keyword javaR_JavaLang NegativeArraySizeException ArrayStoreException IllegalStateException RuntimeException IndexOutOfBoundsException UnsupportedOperationException ArrayIndexOutOfBoundsException ArithmeticException ClassCastException EnumConstantNotPresentException StringIndexOutOfBoundsException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException NumberFormatException NullPointerException TypeNotPresentException SecurityException syn cluster javaTop add=javaR_JavaLang syn cluster javaClasses add=javaR_JavaLang - JavaHiLink javaR_JavaLang javaR_Java + hi def link javaR_JavaLang javaR_Java syn keyword javaC_JavaLang Process RuntimePermission StringKeySet CharacterData01 Class ThreadLocal ThreadLocalMap CharacterData0E Package Character StringCoding Long ProcessImpl ProcessEnvironment Short AssertionStatusDirectives 1PackageInfoProxy UnicodeBlock InheritableThreadLocal AbstractStringBuilder StringEnvironment ClassLoader ConditionalSpecialCasing CharacterDataPrivateUse StringBuffer StringDecoder Entry StringEntry WrappedHook StringBuilder StrictMath State ThreadGroup Runtime CharacterData02 MethodArray Object CharacterDataUndefined Integer Gate Boolean Enum Variable Subset StringEncoder Void Terminator CharsetSD IntegerCache CharacterCache Byte CharsetSE Thread SystemClassLoaderAction CharacterDataLatin1 StringValues StackTraceElement Shutdown ShortCache String ConverterSD ByteCache Lock EnclosingMethodInfo Math Float Value Double SecurityManager LongCache ProcessBuilder StringEntrySet Compiler Number UNIXProcess ConverterSE ExternalData CaseInsensitiveComparator CharacterData00 NativeLibrary syn cluster javaTop add=javaC_JavaLang syn cluster javaClasses add=javaC_JavaLang - JavaHiLink javaC_JavaLang javaC_Java + hi def link javaC_JavaLang javaC_Java syn keyword javaE_JavaLang IncompatibleClassChangeError InternalError UnknownError ClassCircularityError AssertionError ThreadDeath IllegalAccessError NoClassDefFoundError ClassFormatError UnsupportedClassVersionError NoSuchFieldError VerifyError ExceptionInInitializerError InstantiationError LinkageError NoSuchMethodError Error UnsatisfiedLinkError StackOverflowError AbstractMethodError VirtualMachineError OutOfMemoryError syn cluster javaTop add=javaE_JavaLang syn cluster javaClasses add=javaE_JavaLang - JavaHiLink javaE_JavaLang javaE_Java + hi def link javaE_JavaLang javaE_Java syn keyword javaX_JavaLang CloneNotSupportedException Exception NoSuchMethodException IllegalAccessException NoSuchFieldException Throwable InterruptedException ClassNotFoundException InstantiationException syn cluster javaTop add=javaX_JavaLang syn cluster javaClasses add=javaX_JavaLang - JavaHiLink javaX_JavaLang javaX_Java + hi def link javaX_JavaLang javaX_Java - JavaHiLink javaR_Java javaR_ - JavaHiLink javaC_Java javaC_ - JavaHiLink javaE_Java javaE_ - JavaHiLink javaX_Java javaX_ - JavaHiLink javaX_ javaExceptions - JavaHiLink javaR_ javaExceptions - JavaHiLink javaE_ javaExceptions - JavaHiLink javaC_ javaConstant + hi def link javaR_Java javaR_ + hi def link javaC_Java javaC_ + hi def link javaE_Java javaE_ + hi def link javaX_Java javaX_ + hi def link javaX_ javaExceptions + hi def link javaR_ javaExceptions + hi def link javaE_ javaExceptions + hi def link javaC_ javaConstant syn keyword javaLangObject clone equals finalize getClass hashCode syn keyword javaLangObject notify notifyAll toString wait - JavaHiLink javaLangObject javaConstant + hi def link javaLangObject javaConstant syn cluster javaTop add=javaLangObject endif @@ -121,7 +113,7 @@ if exists("java_space_errors") endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter +syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel syn keyword javaLabel default @@ -147,9 +139,9 @@ syn region javaComment start="/\*" end="\*/" contains=@javaCommentSpecial,ja syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 syn match javaCommentStar contained "^\s*\*$" syn match javaLineComment "//.*" contains=@javaCommentSpecial2,javaTodo,@Spell -JavaHiLink javaCommentString javaString -JavaHiLink javaComment2String javaString -JavaHiLink javaCommentCharacter javaCharacter +hi def link javaCommentString javaString +hi def link javaComment2String javaString +hi def link javaCommentCharacter javaCharacter syn cluster javaTop add=javaComment,javaLineComment @@ -164,7 +156,7 @@ if !exists("java_ignore_javadoc") && main_syntax != 'jsp' syntax spell default syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaTodo,@Spell - syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,@Spell,javaDocTags,javaDocSeeTag + syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle keepend end="。" end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,@Spell,javaDocTags,javaDocSeeTag syn region javaDocTags contained start="{@\(code\|link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" syn match javaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=javaDocParam @@ -188,10 +180,10 @@ syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaS syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" -syn match javaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" -syn match javaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" -syn match javaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" -syn match javaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" +syn match javaNumber "\<\(0[bB][0-1]\+\|0[0-7]*\|0[xX]\x\+\|\d\(\d\|_\d\)*\)[lL]\=\>" +syn match javaNumber "\(\<\d\(\d\|_\d\)*\.\(\d\(\d\|_\d\)*\)\=\|\.\d\(\d\|_\d\)*\)\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\=" +syn match javaNumber "\<\d\(\d\|_\d\)*[eE][-+]\=\d\(\d\|_\d\)*[fFdD]\=\>" +syn match javaNumber "\<\d\(\d\|_\d\)*\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\>" " unicode characters syn match javaSpecial "\\u\d\{4\}" @@ -200,19 +192,21 @@ syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStri if exists("java_highlight_functions") if java_highlight_functions == "indent" - syn match javaFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn region javaFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn match javaFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn region javaFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses + syn match javaFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]<>]*([^-+*/]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn match javaFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation else " This line catches method declarations at any indentation>0, but it assumes " two things: " 1. class names are always capitalized (ie: Button) " 2. method names are never capitalized (except constructors, of course) - syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses + "syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses + syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(<.*>\s\+\)\?\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^(){}]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation endif + syn match javaLambdaDef "[a-zA-Z_][a-zA-Z0-9_]*\s*->" syn match javaBraces "[{}]" - syn cluster javaTop add=javaFuncDef,javaBraces + syn cluster javaTop add=javaFuncDef,javaBraces,javaLambdaDef endif if exists("java_highlight_debug") @@ -240,43 +234,46 @@ if exists("java_highlight_debug") syn cluster javaTop add=javaDebug - if version >= 508 || !exists("did_c_syn_inits") - JavaHiLink javaDebug Debug - JavaHiLink javaDebugString DebugString - JavaHiLink javaDebugStringError javaError - JavaHiLink javaDebugType DebugType - JavaHiLink javaDebugBoolean DebugBoolean - JavaHiLink javaDebugNumber Debug - JavaHiLink javaDebugSpecial DebugSpecial - JavaHiLink javaDebugSpecialCharacter DebugSpecial - JavaHiLink javaDebugCharacter DebugString - JavaHiLink javaDebugParen Debug - - JavaHiLink DebugString String - JavaHiLink DebugSpecial Special - JavaHiLink DebugBoolean Boolean - JavaHiLink DebugType Type - endif + hi def link javaDebug Debug + hi def link javaDebugString DebugString + hi def link javaDebugStringError javaError + hi def link javaDebugType DebugType + hi def link javaDebugBoolean DebugBoolean + hi def link javaDebugNumber Debug + hi def link javaDebugSpecial DebugSpecial + hi def link javaDebugSpecialCharacter DebugSpecial + hi def link javaDebugCharacter DebugString + hi def link javaDebugParen Debug + + hi def link DebugString String + hi def link DebugSpecial Special + hi def link DebugBoolean Boolean + hi def link DebugType Type endif if exists("java_mark_braces_in_parens_as_errors") syn match javaInParen contained "[{}]" - JavaHiLink javaInParen javaError + hi def link javaInParen javaError syn cluster javaTop add=javaInParen endif " catch errors caused by wrong parenthesis -syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaParenT contained syn match javaParenError ")" " catch errors caused by wrong square parenthesis -syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="\[" end="\]" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="\[" end="\]" contains=@javaTop,javaParenT contained syn match javaParenError "\]" -JavaHiLink javaParenError javaError +hi def link javaParenError javaError + +if exists("java_highlight_functions") + syn match javaLambdaDef "([a-zA-Z0-9_<>\[\], \t]*)\s*->" + " needs to be defined after the parenthesis error catcher to work +endif if !exists("java_minlines") let java_minlines = 10 @@ -284,60 +281,54 @@ endif exec "syn sync ccomment javaComment minlines=" . java_minlines " The default highlighting. -if version >= 508 || !exists("did_java_syn_inits") - if version < 508 - let did_java_syn_inits = 1 - endif - JavaHiLink javaFuncDef Function - JavaHiLink javaVarArg Function - JavaHiLink javaBraces Function - JavaHiLink javaBranch Conditional - JavaHiLink javaUserLabelRef javaUserLabel - JavaHiLink javaLabel Label - JavaHiLink javaUserLabel Label - JavaHiLink javaConditional Conditional - JavaHiLink javaRepeat Repeat - JavaHiLink javaExceptions Exception - JavaHiLink javaAssert Statement - JavaHiLink javaStorageClass StorageClass - JavaHiLink javaMethodDecl javaStorageClass - JavaHiLink javaClassDecl javaStorageClass - JavaHiLink javaScopeDecl javaStorageClass - JavaHiLink javaBoolean Boolean - JavaHiLink javaSpecial Special - JavaHiLink javaSpecialError Error - JavaHiLink javaSpecialCharError Error - JavaHiLink javaString String - JavaHiLink javaCharacter Character - JavaHiLink javaSpecialChar SpecialChar - JavaHiLink javaNumber Number - JavaHiLink javaError Error - JavaHiLink javaStringError Error - JavaHiLink javaStatement Statement - JavaHiLink javaOperator Operator - JavaHiLink javaComment Comment - JavaHiLink javaDocComment Comment - JavaHiLink javaLineComment Comment - JavaHiLink javaConstant Constant - JavaHiLink javaTypedef Typedef - JavaHiLink javaTodo Todo - JavaHiLink javaAnnotation PreProc - - JavaHiLink javaCommentTitle SpecialComment - JavaHiLink javaDocTags Special - JavaHiLink javaDocParam Function - JavaHiLink javaDocSeeTagParam Function - JavaHiLink javaCommentStar javaComment - - JavaHiLink javaType Type - JavaHiLink javaExternal Include - - JavaHiLink htmlComment Special - JavaHiLink htmlCommentPart Special - JavaHiLink javaSpaceError Error -endif - -delcommand JavaHiLink +hi def link javaLambdaDef Function +hi def link javaFuncDef Function +hi def link javaVarArg Function +hi def link javaBraces Function +hi def link javaBranch Conditional +hi def link javaUserLabelRef javaUserLabel +hi def link javaLabel Label +hi def link javaUserLabel Label +hi def link javaConditional Conditional +hi def link javaRepeat Repeat +hi def link javaExceptions Exception +hi def link javaAssert Statement +hi def link javaStorageClass StorageClass +hi def link javaMethodDecl javaStorageClass +hi def link javaClassDecl javaStorageClass +hi def link javaScopeDecl javaStorageClass +hi def link javaBoolean Boolean +hi def link javaSpecial Special +hi def link javaSpecialError Error +hi def link javaSpecialCharError Error +hi def link javaString String +hi def link javaCharacter Character +hi def link javaSpecialChar SpecialChar +hi def link javaNumber Number +hi def link javaError Error +hi def link javaStringError Error +hi def link javaStatement Statement +hi def link javaOperator Operator +hi def link javaComment Comment +hi def link javaDocComment Comment +hi def link javaLineComment Comment +hi def link javaConstant Constant +hi def link javaTypedef Typedef +hi def link javaTodo Todo +hi def link javaAnnotation PreProc + +hi def link javaCommentTitle SpecialComment +hi def link javaDocTags Special +hi def link javaDocParam Function +hi def link javaDocSeeTagParam Function +hi def link javaCommentStar javaComment + +hi def link javaType Type +hi def link javaExternal Include + +hi def link htmlComment Special +hi def link htmlCommentPart Special +hi def link javaSpaceError Error let b:current_syntax = "java" diff --git a/runtime/syntax/javacc.vim b/runtime/syntax/javacc.vim index 5458de754e..a80572d510 100644 --- a/runtime/syntax/javacc.vim +++ b/runtime/syntax/javacc.vim @@ -7,11 +7,8 @@ " Uses java.vim, and adds a few special things for JavaCC Parser files. " Those files usually have the extension *.jj -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,11 +16,7 @@ let s:cpo_save = &cpo set cpo&vim " source the java.vim file -if version < 600 - source <sfile>:p:h/java.vim -else - runtime! syntax/java.vim -endif +runtime! syntax/java.vim unlet b:current_syntax "remove catching errors caused by wrong parenthesis (does not work in javacc @@ -58,22 +51,12 @@ syn keyword javaccActionToken TOKEN SKIP MORE SPECIAL_TOKEN syn keyword javaccError DEBUG IGNORE_IN_BNF " 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_css_syn_inits") - if version < 508 - let did_css_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink javaccSpecToken Statement - HiLink javaccActionToken Type - HiLink javaccPackages javaScopeDecl - HiLink javaccToken String - HiLink javaccError Error - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link javaccSpecToken Statement +hi def link javaccActionToken Type +hi def link javaccPackages javaScopeDecl +hi def link javaccToken String +hi def link javaccError Error let b:current_syntax = "javacc" let &cpo = s:cpo_save diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim index 1b20f987d9..a95ecacb09 100644 --- a/runtime/syntax/javascript.vim +++ b/runtime/syntax/javascript.vim @@ -9,16 +9,14 @@ " (ss) additional factoring of keywords, globals, and members " Last Change: 2012 Oct 05 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke) +" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded " tuning parameters: " unlet javaScript_fold if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + " quit when a syntax file was already loaded + if exists("b:current_syntax") finish endif let main_syntax = 'javascript' @@ -29,11 +27,6 @@ endif let s:cpo_save = &cpo set cpo&vim -" Drop fold if it set but vim doesn't support it. -if version < 600 && exists("javaScript_fold") - unlet javaScript_fold -endif - syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo @@ -45,7 +38,7 @@ syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ con syn match javaScriptSpecialCharacter "'\\.'" syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" -syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline +syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuys]\{0,2\}\s*$+ end=+/[gimuys]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline syn keyword javaScriptConditional if else switch syn keyword javaScriptRepeat while for do in @@ -87,51 +80,41 @@ if main_syntax == "javascript" endif " 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_javascript_syn_inits") - if version < 508 - let did_javascript_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink javaScriptComment Comment - HiLink javaScriptLineComment Comment - HiLink javaScriptCommentTodo Todo - HiLink javaScriptSpecial Special - HiLink javaScriptStringS String - HiLink javaScriptStringD String - HiLink javaScriptCharacter Character - HiLink javaScriptSpecialCharacter javaScriptSpecial - HiLink javaScriptNumber javaScriptValue - HiLink javaScriptConditional Conditional - HiLink javaScriptRepeat Repeat - HiLink javaScriptBranch Conditional - HiLink javaScriptOperator Operator - HiLink javaScriptType Type - HiLink javaScriptStatement Statement - HiLink javaScriptFunction Function - HiLink javaScriptBraces Function - HiLink javaScriptError Error - HiLink javaScrParenError javaScriptError - HiLink javaScriptNull Keyword - HiLink javaScriptBoolean Boolean - HiLink javaScriptRegexpString String - - HiLink javaScriptIdentifier Identifier - HiLink javaScriptLabel Label - HiLink javaScriptException Exception - HiLink javaScriptMessage Keyword - HiLink javaScriptGlobal Keyword - HiLink javaScriptMember Keyword - HiLink javaScriptDeprecated Exception - HiLink javaScriptReserved Keyword - HiLink javaScriptDebug Debug - HiLink javaScriptConstant Label - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link javaScriptComment Comment +hi def link javaScriptLineComment Comment +hi def link javaScriptCommentTodo Todo +hi def link javaScriptSpecial Special +hi def link javaScriptStringS String +hi def link javaScriptStringD String +hi def link javaScriptCharacter Character +hi def link javaScriptSpecialCharacter javaScriptSpecial +hi def link javaScriptNumber javaScriptValue +hi def link javaScriptConditional Conditional +hi def link javaScriptRepeat Repeat +hi def link javaScriptBranch Conditional +hi def link javaScriptOperator Operator +hi def link javaScriptType Type +hi def link javaScriptStatement Statement +hi def link javaScriptFunction Function +hi def link javaScriptBraces Function +hi def link javaScriptError Error +hi def link javaScrParenError javaScriptError +hi def link javaScriptNull Keyword +hi def link javaScriptBoolean Boolean +hi def link javaScriptRegexpString String + +hi def link javaScriptIdentifier Identifier +hi def link javaScriptLabel Label +hi def link javaScriptException Exception +hi def link javaScriptMessage Keyword +hi def link javaScriptGlobal Keyword +hi def link javaScriptMember Keyword +hi def link javaScriptDeprecated Exception +hi def link javaScriptReserved Keyword +hi def link javaScriptDebug Debug +hi def link javaScriptConstant Label + let b:current_syntax = "javascript" if main_syntax == 'javascript' diff --git a/runtime/syntax/jess.vim b/runtime/syntax/jess.vim index 243bab351e..67d3715a30 100644 --- a/runtime/syntax/jess.vim +++ b/runtime/syntax/jess.vim @@ -4,19 +4,12 @@ " Last change: September 14, 2000 " Based on lisp.vim by : Dr. Charles E. Campbell, Jr. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version < 600 - set iskeyword=42,43,45,47-58,60-62,64-90,97-122,_ -else - setlocal iskeyword=42,43,45,47-58,60-62,64-90,97-122,_ -endif +setlocal iskeyword=42,43,45,47-58,60-62,64-90,97-122,_ " Lists syn match jessSymbol ![^()'`,"; \t]\+! contained @@ -125,36 +118,26 @@ syn match jessComment ";.*$" syn sync lines=100 " 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_jess_syntax_inits") - if version < 508 - let did_jess_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink jessAtomNmbr jessNumber - HiLink jessAtomMark jessMark - - HiLink jessAtom Identifier - HiLink jessAtomBarSymbol Special - HiLink jessBarSymbol Special - HiLink jessComment Comment - HiLink jessConcat Statement - HiLink jessDeclaration Statement - HiLink jessFunc Statement - HiLink jessKey Type - HiLink jessMark Delimiter - HiLink jessNumber Number - HiLink jessParenError Error - HiLink jessSpecial Type - HiLink jessString String - HiLink jessVar Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link jessAtomNmbr jessNumber +hi def link jessAtomMark jessMark + +hi def link jessAtom Identifier +hi def link jessAtomBarSymbol Special +hi def link jessBarSymbol Special +hi def link jessComment Comment +hi def link jessConcat Statement +hi def link jessDeclaration Statement +hi def link jessFunc Statement +hi def link jessKey Type +hi def link jessMark Delimiter +hi def link jessNumber Number +hi def link jessParenError Error +hi def link jessSpecial Type +hi def link jessString String +hi def link jessVar Identifier + let b:current_syntax = "jess" diff --git a/runtime/syntax/jgraph.vim b/runtime/syntax/jgraph.vim index 7ecd5afaec..a29a21a73b 100644 --- a/runtime/syntax/jgraph.vim +++ b/runtime/syntax/jgraph.vim @@ -5,11 +5,8 @@ " this syntax file is not yet complete -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -36,23 +33,13 @@ syn match jgraphNumber "\-\=\.\d\+\>" " 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_jgraph_syn_inits") - if version < 508 - let did_jgraph_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink jgraphComment Comment - HiLink jgraphCmd Identifier - HiLink jgraphType Type - HiLink jgraphNumber Number - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link jgraphComment Comment +hi def link jgraphCmd Identifier +hi def link jgraphType Type +hi def link jgraphNumber Number + let b:current_syntax = "jgraph" diff --git a/runtime/syntax/jproperties.vim b/runtime/syntax/jproperties.vim index 9343bd292b..628c03097f 100644 --- a/runtime/syntax/jproperties.vim +++ b/runtime/syntax/jproperties.vim @@ -43,11 +43,8 @@ endif " ============================================================================= -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -120,28 +117,18 @@ syn match jpropertiesComment "^\s*[#!].*$" contains=jpropertiesTODO syn keyword jpropertiesTodo TODO FIXME XXX contained " 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_jproperties_syntax_inits") - if version < 508 - let did_jproperties_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink jpropertiesComment Comment - HiLink jpropertiesTodo Todo - HiLink jpropertiesIdentifier Identifier - HiLink jpropertiesString String - HiLink jpropertiesExtendString String - HiLink jpropertiesCharacter Character - HiLink jpropertiesSpecial Special - HiLink jpropertiesSpecialChar SpecialChar - HiLink jpropertiesError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link jpropertiesComment Comment +hi def link jpropertiesTodo Todo +hi def link jpropertiesIdentifier Identifier +hi def link jpropertiesString String +hi def link jpropertiesExtendString String +hi def link jpropertiesCharacter Character +hi def link jpropertiesSpecial Special +hi def link jpropertiesSpecialChar SpecialChar +hi def link jpropertiesError Error + let b:current_syntax = "jproperties" diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim index f2d880b1d0..d80af84312 100644 --- a/runtime/syntax/json.vim +++ b/runtime/syntax/json.vim @@ -1,16 +1,132 @@ " Vim syntax file -" Language: JSON -" Maintainer: David Barnett <daviebdawg+vim@gmail.com> -" Last Change: 2014 Jul 16 - -" For version 5.x: Clear all syntax items. -" For version 6.x and later: Quit when a syntax file was already loaded. -if exists('b:current_syntax') - finish +" Language: JSON +" Maintainer: Eli Parra <eli@elzr.com> +" Last Change: 2014 Aug 23 +" Version: 0.12 + +if !exists("main_syntax") + " quit when a syntax file was already loaded + if exists("b:current_syntax") + finish + endif + let main_syntax = 'json' +endif + +syntax match jsonNoise /\%(:\|,\)/ + +" NOTE that for the concealing to work your conceallevel should be set to 2 + +" Syntax: Strings +" Separated into a match and region because a region by itself is always greedy +syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString +if has('conceal') + syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained +else + syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained +endif + +" Syntax: JSON does not allow strings with single quotes, unlike JavaScript. +syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ + +" Syntax: JSON Keywords +" Separated into a match and region because a region by itself is always greedy +syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword +if has('conceal') + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained +else + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained +endif + +" Syntax: Escape sequences +syn match jsonEscape "\\["\\/bfnrt]" contained +syn match jsonEscape "\\u\x\{4}" contained + +" Syntax: Numbers +syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]" + +" ERROR WARNINGS ********************************************** +if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1) + " Syntax: Strings should always be enclosed with quotes. + syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>" + syn match jsonTripleQuotesError /"""/ + + " Syntax: An integer part of 0 followed by other digits is not allowed. + syn match jsonNumError "-\=\<0\d\.\d*\>" + + " Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1). + syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+" + + " Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file + syn match jsonCommentError "//.*" + syn match jsonCommentError "\(/\*\)\|\(\*/\)" + + " Syntax: No semicolons in JSON + syn match jsonSemicolonError ";" + + " Syntax: No trailing comma after the last element of arrays or objects + syn match jsonTrailingCommaError ",\_s*[}\]]" + + " Syntax: Watch out for missing commas between elements + syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/ + syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values + syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array + syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value +endif + +" ********************************************** END OF ERROR WARNINGS +" Allowances for JSONP: function call at the beginning of the file, +" parenthesis and semicolon at the end. +" Function name validation based on +" http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name/2008444#2008444 +syn match jsonPadding "\%^[[:blank:]\r\n]*[_$[:alpha:]][_$[:alnum:]]*[[:blank:]\r\n]*(" +syn match jsonPadding ");[[:blank:]\r\n]*\%$" + +" Syntax: Boolean +syn match jsonBoolean /\(true\|false\)\(\_s\+\ze"\)\@!/ + +" Syntax: Null +syn keyword jsonNull null + +" Syntax: Braces +syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold +syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet +hi def link jsonPadding Operator +hi def link jsonString String +hi def link jsonTest Label +hi def link jsonEscape Special +hi def link jsonNumber Number +hi def link jsonBraces Delimiter +hi def link jsonNull Function +hi def link jsonBoolean Boolean +hi def link jsonKeyword Label + +if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1) +hi def link jsonNumError Error +hi def link jsonCommentError Error +hi def link jsonSemicolonError Error +hi def link jsonTrailingCommaError Error +hi def link jsonMissingCommaError Error +hi def link jsonStringSQError Error +hi def link jsonNoQuotesError Error +hi def link jsonTripleQuotesError Error +endif +hi def link jsonQuote Quote +hi def link jsonNoise Noise + +let b:current_syntax = "json" +if main_syntax == 'json' + unlet main_syntax endif -" Use JavaScript syntax. JSON is a subset of JavaScript. -runtime! syntax/javascript.vim -unlet b:current_syntax +" Vim settings +" vim: ts=8 fdm=marker -let b:current_syntax = 'json' +" MIT License +" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra +"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +"THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +"See https://twitter.com/elzr/status/294964017926119424 diff --git a/runtime/syntax/jsp.vim b/runtime/syntax/jsp.vim index 9766657596..1c3cc35a31 100644 --- a/runtime/syntax/jsp.vim +++ b/runtime/syntax/jsp.vim @@ -6,11 +6,8 @@ " Credits : Patch by Darren Greaves (recognizes <jsp:...> tags) " Patch by Thomas Kimpton (recognizes jspExpr inside HTML tags) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,11 +16,7 @@ if !exists("main_syntax") endif " Source HTML syntax -if version < 600 - source <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim unlet b:current_syntax " Next syntax items are case-sensitive @@ -52,29 +45,19 @@ syn clear htmlTag syn region htmlTag start=+<[^/%]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,jspExpr,javaScript " 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_jsp_syn_inits") - if version < 508 - let did_jsp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " java.vim has redefined htmlComment highlighting - HiLink htmlComment Comment - HiLink htmlCommentPart Comment - " Be consistent with html highlight settings - HiLink jspComment htmlComment - HiLink jspTag htmlTag - HiLink jspDirective jspTag - HiLink jspDirName htmlTagName - HiLink jspDirArg htmlArg - HiLink jspCommand jspTag - HiLink jspCommandName htmlTagName - HiLink jspCommandArg htmlArg - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +" java.vim has redefined htmlComment highlighting +hi def link htmlComment Comment +hi def link htmlCommentPart Comment +" Be consistent with html highlight settings +hi def link jspComment htmlComment +hi def link jspTag htmlTag +hi def link jspDirective jspTag +hi def link jspDirName htmlTagName +hi def link jspDirArg htmlArg +hi def link jspCommand jspTag +hi def link jspCommandName htmlTagName +hi def link jspCommandArg htmlArg if main_syntax == 'jsp' unlet main_syntax diff --git a/runtime/syntax/kconfig.vim b/runtime/syntax/kconfig.vim index a6ceb1712a..c7a305b73c 100644 --- a/runtime/syntax/kconfig.vim +++ b/runtime/syntax/kconfig.vim @@ -1,6 +1,9 @@ " Vim syntax file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2009-05-25 +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-05-29 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-kconfig if exists("b:current_syntax") finish diff --git a/runtime/syntax/kix.vim b/runtime/syntax/kix.vim index 62dc3253e8..dd74378366 100644 --- a/runtime/syntax/kix.vim +++ b/runtime/syntax/kix.vim @@ -19,10 +19,8 @@ " Work out how to error too many "(", i.e. (() should be an error. " Similarly, "if" without "endif" and similar constructs should error. -" Clear legacy syntax rules for version 5.x, exit if already processed for version 6+ -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 @@ -130,52 +128,42 @@ syn match kixExpression "<\|>\|<=\|>=\|<>" " Default highlighting. -" Version < 5.8 set default highlight if file not already processed. -" Version >= 5.8 set default highlight only if it doesn't already have a value. -if version > 508 || !exists("did_kix_syn_inits") - if version < 508 - let did_kix_syn_inits=1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink kixDoubleString String - HiLink kixSingleString String - HiLink kixStatement Statement - HiLink kixRepeat Repeat - HiLink kixComment Comment - HiLink kixBuiltin Function - HiLink kixLocalVar Special - HiLink kixMacro Special - HiLink kixEnvVar Special - HiLink kixLabel Type - HiLink kixFunction Function - HiLink kixInteger Number - HiLink kixHex Number - HiLink kixFloat Number - HiLink kixOperator Operator - HiLink kixExpression Operator - - HiLink kixParenCloseError Error - HiLink kixBrackCloseError Error - HiLink kixStringError Error - - HiLink kixWhileError Error - HiLink kixWhileOK Conditional - HiLink kixDoError Error - HiLink kixDoOK Conditional - HiLink kixIfError Error - HiLink kixIfOK Conditional - HiLink kixSelectError Error - HiLink kixSelectOK Conditional - HiLink kixForNextError Error - HiLink kixForNextOK Conditional - HiLink kixForEachError Error - HiLink kixForEachOK Conditional - - delcommand HiLink -endif +" Set default highlight only if it doesn't already have a value. + +hi def link kixDoubleString String +hi def link kixSingleString String +hi def link kixStatement Statement +hi def link kixRepeat Repeat +hi def link kixComment Comment +hi def link kixBuiltin Function +hi def link kixLocalVar Special +hi def link kixMacro Special +hi def link kixEnvVar Special +hi def link kixLabel Type +hi def link kixFunction Function +hi def link kixInteger Number +hi def link kixHex Number +hi def link kixFloat Number +hi def link kixOperator Operator +hi def link kixExpression Operator + +hi def link kixParenCloseError Error +hi def link kixBrackCloseError Error +hi def link kixStringError Error + +hi def link kixWhileError Error +hi def link kixWhileOK Conditional +hi def link kixDoError Error +hi def link kixDoOK Conditional +hi def link kixIfError Error +hi def link kixIfOK Conditional +hi def link kixSelectError Error +hi def link kixSelectOK Conditional +hi def link kixForNextError Error +hi def link kixForNextOK Conditional +hi def link kixForEachError Error +hi def link kixForEachOK Conditional + let b:current_syntax = "kix" diff --git a/runtime/syntax/kscript.vim b/runtime/syntax/kscript.vim index cefbe39a29..e6776208d4 100644 --- a/runtime/syntax/kscript.vim +++ b/runtime/syntax/kscript.vim @@ -4,11 +4,8 @@ " URL: http://aquila.rezel.enst.fr/thomas/vim/kscript.vim " CVS: $Id: kscript.vim,v 1.1 2004/06/13 17:40:02 vimboss Exp $ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -37,33 +34,23 @@ syn region kscriptString start=+"""+ end=+"""+ syn region kscriptString start=+'''+ end=+'''+ " 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_kscript_syntax_inits") - if version < 508 - let did_kscript_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link kscriptConditional Conditional +hi def link kscriptRepeat Repeat +hi def link kscriptExceptions Statement +hi def link kscriptFunction Function +hi def link kscriptConst Constant +hi def link kscriptStatement Statement +hi def link kscriptLabel Label +hi def link kscriptStorageClass StorageClass +hi def link kscriptType Type +hi def link kscriptTodo Todo +hi def link kscriptComment Comment +hi def link kscriptString String +hi def link kscriptPreCondit PreCondit +hi def link kscriptHardCoded Statement - HiLink kscriptConditional Conditional - HiLink kscriptRepeat Repeat - HiLink kscriptExceptions Statement - HiLink kscriptFunction Function - HiLink kscriptConst Constant - HiLink kscriptStatement Statement - HiLink kscriptLabel Label - HiLink kscriptStorageClass StorageClass - HiLink kscriptType Type - HiLink kscriptTodo Todo - HiLink kscriptComment Comment - HiLink kscriptString String - HiLink kscriptPreCondit PreCondit - HiLink kscriptHardCoded Statement - - delcommand HiLink -endif let b:current_syntax = "kscript" diff --git a/runtime/syntax/kwt.vim b/runtime/syntax/kwt.vim index 4c2c9d9dc0..ecda5bb985 100644 --- a/runtime/syntax/kwt.vim +++ b/runtime/syntax/kwt.vim @@ -3,21 +3,14 @@ " Maintainer: Michael Piefel <entwurf@piefel.de> " Last Change: 2 May 2001 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C++ syntax to start with -if version < 600 - source <sfile>:p:h/cpp.vim -else - runtime! syntax/cpp.vim - unlet b:current_syntax -endif +runtime! syntax/cpp.vim +unlet b:current_syntax " kimwitu++ extentions @@ -58,27 +51,17 @@ syn region kwtUnpBody transparent keepend extend fold start="->\s*\[" start="^\ syn region kwtRewBody transparent keepend extend fold start="->\s*<" start="^\s*<" end="\s>\s\=;\=$" end="^>\s\=;\=$" " 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_kwt_syn_inits") - if version < 508 - let did_kwt_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink kwtStatement cppStatement - HiLink kwtDecl cppStatement - HiLink kwtCast cppStatement - HiLink kwtSep Delimiter - HiLink kwtViews Label - HiLink kwtPhylum Type - HiLink kwtOption PreProc - "HiLink cText Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link kwtStatement cppStatement +hi def link kwtDecl cppStatement +hi def link kwtCast cppStatement +hi def link kwtSep Delimiter +hi def link kwtViews Label +hi def link kwtPhylum Type +hi def link kwtOption PreProc +"hi def link cText Comment + syn sync lines=300 diff --git a/runtime/syntax/lace.vim b/runtime/syntax/lace.vim index 9e64eea7d1..9a83851f2b 100644 --- a/runtime/syntax/lace.vim +++ b/runtime/syntax/lace.vim @@ -9,11 +9,8 @@ " it to the maintainer at <utilities@eiffel.com> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -85,50 +82,40 @@ syn region laceParen transparent start="(" end=")" contains=ALLBUT,laceParenErr syn sync lines=40 " 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_lace_syntax_inits") - if version < 508 - let did_lace_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink laceTopStruct PreProc - - HiLink laceOptionClause Statement - HiLink laceOptionMark Constant - HiLink laceClusterProp Label - HiLink laceAdaptClassName Label - HiLink laceExternal Statement - HiLink laceCluster ModeMsg - - HiLink laceEscape Special - - HiLink laceBool Boolean - HiLink laceString String - HiLink laceCharacter Character - HiLink laceClassName Type - HiLink laceNumber Number - - HiLink laceOperator Special - HiLink laceArray Special - HiLink laceExport Special - HiLink laceCreation Special - HiLink laceBrackets Special - HiLink laceConstraint Special - - HiLink laceComment Comment - - HiLink laceError Error - HiLink laceStringError Error - HiLink laceParenError Error - HiLink laceBracketError Error - HiLink laceTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link laceTopStruct PreProc + +hi def link laceOptionClause Statement +hi def link laceOptionMark Constant +hi def link laceClusterProp Label +hi def link laceAdaptClassName Label +hi def link laceExternal Statement +hi def link laceCluster ModeMsg + +hi def link laceEscape Special + +hi def link laceBool Boolean +hi def link laceString String +hi def link laceCharacter Character +hi def link laceClassName Type +hi def link laceNumber Number + +hi def link laceOperator Special +hi def link laceArray Special +hi def link laceExport Special +hi def link laceCreation Special +hi def link laceBrackets Special +hi def link laceConstraint Special + +hi def link laceComment Comment + +hi def link laceError Error +hi def link laceStringError Error +hi def link laceParenError Error +hi def link laceBracketError Error +hi def link laceTodo Todo + let b:current_syntax = "lace" diff --git a/runtime/syntax/latte.vim b/runtime/syntax/latte.vim index e2a8729f3f..e30ae42e38 100644 --- a/runtime/syntax/latte.vim +++ b/runtime/syntax/latte.vim @@ -7,11 +7,8 @@ " I based this on the TeX and Scheme syntax files (but mostly scheme). " See http://www.latte.org for info on the language. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,11 +17,7 @@ syn match latteOther "\\{" syn match latteOther "\\}" syn match latteOther "\\\\" -if version < 600 - set iskeyword=33,43,45,48-57,63,65-90,95,97-122,_ -else - setlocal iskeyword=33,43,45,48-57,63,65-90,95,97-122,_ -endif +setlocal iskeyword=33,43,45,48-57,63,65-90,95,97-122,_ syn region latteVar matchgroup=SpecialChar start=!\\[A-Za-z_]!rs=s+1 end=![^A-Za-z0-9?!+_-]!me=e-1 contains=ALLBUT,latteNumber,latteOther syn region latteVar matchgroup=SpecialChar start=!\\[=\&][A-Za-z_]!rs=s+2 end=![^A-Za-z0-9?!+_-]!me=e-1 contains=ALLBUT,latteNumber,latteOther @@ -70,29 +63,19 @@ syn sync match matchPlace grouphere NONE "^[^ \t]" " ... i.e. synchronize on a line that starts at the left margin " 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_latte_syntax_inits") - if version < 508 - let did_latte_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink latteSyntax Statement - HiLink latteVar Function +hi def link latteSyntax Statement +hi def link latteVar Function - HiLink latteString String - HiLink latteQuote String +hi def link latteString String +hi def link latteQuote String - HiLink latteDelimiter Delimiter - HiLink latteOperator Operator +hi def link latteDelimiter Delimiter +hi def link latteOperator Operator - HiLink latteComment Comment - HiLink latteError Error +hi def link latteComment Comment +hi def link latteError Error - delcommand HiLink -endif let b:current_syntax = "latte" diff --git a/runtime/syntax/ld.vim b/runtime/syntax/ld.vim index fc12919c50..22949d9759 100644 --- a/runtime/syntax/ld.vim +++ b/runtime/syntax/ld.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/ldapconf.vim b/runtime/syntax/ldapconf.vim index 70ddaab57a..662ea203be 100644 --- a/runtime/syntax/ldapconf.vim +++ b/runtime/syntax/ldapconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: ldap.conf(5) configuration file. -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-11 +" Language: ldap.conf(5) configuration file. +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-11 if exists("b:current_syntax") finish diff --git a/runtime/syntax/ldif.vim b/runtime/syntax/ldif.vim index 9f67b57f51..576e4c023d 100644 --- a/runtime/syntax/ldif.vim +++ b/runtime/syntax/ldif.vim @@ -3,9 +3,8 @@ " Maintainer: Zak Johnson <zakj@nox.cx> " Last Change: 2003-12-30 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -21,23 +20,14 @@ syn region ldifFileValue matchgroup=ldifPunctuation start=/:< / end=/\_$/ skip syn region ldifComment start=/^#/ end=/\_$/ skip=/\n / -if version >= 508 || !exists("did_ldif_syn_inits") - if version < 508 - let did_ldif_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ldifAttribute Type - HiLink ldifOption Identifier - HiLink ldifPunctuation Normal - HiLink ldifStringValue String - HiLink ldifBase64Value Special - HiLink ldifFileValue Special - HiLink ldifComment Comment - - delcommand HiLink -endif + +hi def link ldifAttribute Type +hi def link ldifOption Identifier +hi def link ldifPunctuation Normal +hi def link ldifStringValue String +hi def link ldifBase64Value Special +hi def link ldifFileValue Special +hi def link ldifComment Comment + let b:current_syntax = "ldif" diff --git a/runtime/syntax/less.vim b/runtime/syntax/less.vim new file mode 100644 index 0000000000..5cc8c6d7bd --- /dev/null +++ b/runtime/syntax/less.vim @@ -0,0 +1,79 @@ +" Vim syntax file +" Language: less +" Maintainer: Alessandro Vioni <jenoma@gmail.com> +" URL: https://github.com/genoma/vim-less +" Last Change: 2014 November 24 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/css.vim +runtime! after/syntax/css.vim + +syn case ignore + +syn cluster lessCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp +syn cluster lessCssAttributes contains=css.*Attr,lessEndOfLineComment,lessComment,cssValue.*,cssColor,cssURL,lessDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp + +syn region lessDefinition matchgroup=cssBraces start="{" end="}" contains=TOP + +syn match lessProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=lessCssAttribute contained containedin=lessDefinition +syn match lessProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute +syn match lessProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute +syn match lessCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@lessCssAttributes,lessVariable,lessFunction,lessInterpolation +syn match lessDefault "!default\>" contained + +" less variables and media queries +syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessCssAttribute skipwhite +syn match lessMedia "@media" nextgroup=lessCssAttribute skipwhite + +" Less functions +syn match lessFunction "\<\%(escape\|e\|unit\)\>(\@=" contained +syn match lessFunction "\<\%(ceil\|floor\|percentage\|round\|sqrt\|abs\|sin\|asin\|cos\|acos\|tan\|atan\|pi\|pow\|min\|max\)\>(\@=" contained +syn match lessFunction "\<\%(rgb\|rgba\|argb\|argb\|hsl\|hsla\|hsv\|hsva\)\>(\@=" contained +syn match lessFunction "\<\%(hue\|saturation\|lightness\|red\|green\|blue\|alpha\|luma\)\>(\@=" contained +syn match lessFunction "\<\%(saturate\|desaturate\|lighten\|darken\|fadein\|fadeout\|fade\|spin\|mix\|greyscale\|contrast\)\>(\@=" contained +syn match lessFunction "\<\%(multiply\|screen\|overlay\|softlight\|hardlight\|difference\|exclusion\|average\|negation\)\>(\@=" contained + +" Less id class visualization +syn match lessIdChar "#[[:alnum:]_-]\@=" nextgroup=lessId,lessClassIdCall +syn match lessId "[[:alnum:]_-]\+" contained +syn match lessClassIdCall "[[:alnum:]_-]\+()" contained + +syn match lessClassChar "\.[[:alnum:]_-]\@=" nextgroup=lessClass,lessClassCall +syn match lessClass "[[:alnum:]_-]\+" contained +syn match lessClassCall "[[:alnum:]_-]\+()" contained + +syn match lessAmpersand "&" contains=lessIdChar,lessClassChar + +syn region lessInclude start="@import" end=";\|$" contains=lessComment,cssURL,cssUnicodeEscape,cssMediaType,cssStringQ,cssStringQQ + +syn keyword lessTodo FIXME NOTE TODO OPTIMIZE XXX contained +syn region lessComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell +syn region lessCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell +syn match lessEndOfLineComment "//.*" contains=lessComment,lessTodo,@Spell + +hi def link lessEndOfLineComment lessComment +hi def link lessCssComment lessComment +hi def link lessComment Comment +hi def link lessDefault cssImportant +hi def link lessVariable Identifier +hi def link lessFunction PreProc +hi def link lessTodo Todo +hi def link lessInclude Include +hi def link lessIdChar Special +hi def link lessClassChar Special +hi def link lessAmpersand Character +hi def link lessId Identifier +hi def link lessClass Type +hi def link lessCssAttribute PreProc +hi def link lessClassCall Type +hi def link lessClassIdCall Type +hi def link lessTagName cssTagName +hi def link lessDeprecated cssDeprecated +hi def link lessMedia cssMedia + +let b:current_syntax = "less" + +" vim:set sw=2: diff --git a/runtime/syntax/lex.vim b/runtime/syntax/lex.vim index b7aff34d6b..560aa44be3 100644 --- a/runtime/syntax/lex.vim +++ b/runtime/syntax/lex.vim @@ -1,18 +1,15 @@ " Vim syntax file " Language: Lex " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Nov 14, 2012 -" Version: 14 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Last Change: Aug 31, 2016 +" Version: 16 +" URL: http://mysite.verizon.net/astronaut/vim/index.html#SYNTAX_LEX " " Option: " lex_uses_cpp : if this variable exists, then C++ is loaded rather than C -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -122,22 +119,24 @@ syn sync match lexSyncPat groupthere lexPatBlock "^<$" syn sync match lexSyncPat groupthere lexPatBlock "^%%$" " The default highlighting. -hi def link lexAbbrvComment lexPatComment -hi def link lexAbbrvRegExp Macro -hi def link lexAbbrv SpecialChar -hi def link lexBrace lexPat -hi def link lexCFunctions Function -hi def link lexCstruct cStructure -hi def link lexMorePat SpecialChar -hi def link lexOptions PreProc -hi def link lexPatComment Comment -hi def link lexPat Function -hi def link lexPatString Function -hi def link lexPatTag Special -hi def link lexPatTagZone lexPatTag -hi def link lexSep Delimiter -hi def link lexSlashQuote lexPat -hi def link lexStartState Statement +if !exists("skip_lex_syntax_inits") + hi def link lexAbbrvComment lexPatComment + hi def link lexAbbrvRegExp Macro + hi def link lexAbbrv SpecialChar + hi def link lexBrace lexPat + hi def link lexCFunctions Function + hi def link lexCstruct cStructure + hi def link lexMorePat SpecialChar + hi def link lexOptions PreProc + hi def link lexPatComment Comment + hi def link lexPat Function + hi def link lexPatString Function + hi def link lexPatTag Special + hi def link lexPatTagZone lexPatTag + hi def link lexSep Delimiter + hi def link lexSlashQuote lexPat + hi def link lexStartState Statement +endif let b:current_syntax = "lex" diff --git a/runtime/syntax/lftp.vim b/runtime/syntax/lftp.vim index 6a8e4f9e19..20ddee5bcb 100644 --- a/runtime/syntax/lftp.vim +++ b/runtime/syntax/lftp.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: lftp(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: lftp(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/lhaskell.vim b/runtime/syntax/lhaskell.vim index 077549a0c8..0a8a076ff4 100644 --- a/runtime/syntax/lhaskell.vim +++ b/runtime/syntax/lhaskell.vim @@ -36,11 +36,8 @@ " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -84,15 +81,10 @@ endif " If user wants us to highlight TeX syntax or guess thinks it's TeX, read it. if b:lhs_markup == "tex" - if version < 600 - source <sfile>:p:h/tex.vim - set isk+=_ - else - runtime! syntax/tex.vim - unlet b:current_syntax - " Tex.vim removes "_" from 'iskeyword', but we need it for Haskell. - setlocal isk+=_ - endif + runtime! syntax/tex.vim + unlet b:current_syntax + " Tex.vim removes "_" from 'iskeyword', but we need it for Haskell. + setlocal isk+=_ syntax cluster lhsTeXContainer contains=tex.*Zone,texAbstract else syntax cluster lhsTeXContainer contains=.* @@ -100,11 +92,7 @@ endif " Literate Haskell is Haskell in between text, so at least read Haskell " highlighting -if version < 600 - syntax include @haskellTop <sfile>:p:h/haskell.vim -else - syntax include @haskellTop syntax/haskell.vim -endif +syntax include @haskellTop syntax/haskell.vim syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack containedin=@lhsTeXContainer syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,beginCodeBegin containedin=@lhsTeXContainer @@ -115,23 +103,13 @@ syntax match beginCodeBegin "^\\begin" nextgroup=beginCodeCode contained syntax region beginCodeCode matchgroup=texDelimiter start="{" end="}" " 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_tex_syntax_inits") - if version < 508 - let did_tex_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink lhsBirdTrack Comment - - HiLink beginCodeBegin texCmdName - HiLink beginCodeCode texSection - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link lhsBirdTrack Comment + +hi def link beginCodeBegin texCmdName +hi def link beginCodeCode texSection + " Restore cursor to original position, as it may have been disturbed " by the searches in our guessing code diff --git a/runtime/syntax/libao.vim b/runtime/syntax/libao.vim index 25b6e8284e..1a3bd90cc5 100644 --- a/runtime/syntax/libao.vim +++ b/runtime/syntax/libao.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: libao.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: libao.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/lifelines.vim b/runtime/syntax/lifelines.vim index f8bea015bd..ff4692888e 100644 --- a/runtime/syntax/lifelines.vim +++ b/runtime/syntax/lifelines.vim @@ -11,9 +11,8 @@ " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -110,9 +109,7 @@ syn match lifelinesNumber "-\=\<\d\+\.\d*\>" syn match lifelinesNumber "-\=\.\d\+\>" " folding using {} -if version >= 600 - syn region lifelinesFoldBlock start="{" end="}" transparent fold -endif +syn region lifelinesFoldBlock start="{" end="}" transparent fold "catch errors caused by wrong parenthesis "adapted from original c.vim written by Bram Moolenaar @@ -123,44 +120,34 @@ syn match lifelinesParenError ")" syn match lifelinesErrInParen contained "[{}]" " 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_lifelines_syn_inits") - if version < 508 - let did_lifelines_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink lifelinesConditional Conditional - HiLink lifelinesArithm Operator - HiLink lifelinesLogical Conditional - HiLink lifelinesInclude Include - HiLink lifelinesComment Comment - HiLink lifelinesStatement Statement - HiLink lifelinesUser Statement - HiLink lifelinesFunct Statement - HiLink lifelinesTable Statement - HiLink lifelinesGedcom Statement - HiLink lifelinesList Statement - HiLink lifelinesRepeat Repeat - HiLink lifelinesFam Statement - HiLink lifelinesIndi Statement - HiLink lifelinesProc Statement - HiLink lifelinesDef Statement - HiLink lifelinesString String - HiLink lifelinesSpecial Special - HiLink lifelinesNumber Number - HiLink lifelinesParenError Error - HiLink lifelinesErrInParen Error - HiLink lifelinesError Error - HiLink lifelinesTodo Todo - HiLink lifelinesDecl PreProc - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + + +hi def link lifelinesConditional Conditional +hi def link lifelinesArithm Operator +hi def link lifelinesLogical Conditional +hi def link lifelinesInclude Include +hi def link lifelinesComment Comment +hi def link lifelinesStatement Statement +hi def link lifelinesUser Statement +hi def link lifelinesFunct Statement +hi def link lifelinesTable Statement +hi def link lifelinesGedcom Statement +hi def link lifelinesList Statement +hi def link lifelinesRepeat Repeat +hi def link lifelinesFam Statement +hi def link lifelinesIndi Statement +hi def link lifelinesProc Statement +hi def link lifelinesDef Statement +hi def link lifelinesString String +hi def link lifelinesSpecial Special +hi def link lifelinesNumber Number +hi def link lifelinesParenError Error +hi def link lifelinesErrInParen Error +hi def link lifelinesError Error +hi def link lifelinesTodo Todo +hi def link lifelinesDecl PreProc + let b:current_syntax = "lifelines" diff --git a/runtime/syntax/lilo.vim b/runtime/syntax/lilo.vim index 3e9459267b..a87dafb734 100644 --- a/runtime/syntax/lilo.vim +++ b/runtime/syntax/lilo.vim @@ -5,21 +5,12 @@ " Last Change: 2010-02-03 " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -if version >= 600 - command -nargs=1 SetIsk setlocal iskeyword=<args> -else - command -nargs=1 SetIsk set iskeyword=<args> -endif -SetIsk @,48-57,.,-,_ -delcommand SetIsk +setlocal iskeyword=@,48-57,.,-,_ syn case ignore @@ -128,65 +119,56 @@ syn match liloDecNumberPListComment "#.*$" contained nextgroup=liloDecNumberPLis syn match liloAnythingComment "#.*$" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty " Define the default highlighting -if version >= 508 || !exists("did_lilo_syntax_inits") - if version < 508 - let did_lilo_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink liloEqPath liloEquals - HiLink liloEqWord liloEquals - HiLink liloEqVga liloEquals - HiLink liloEqDecNumber liloEquals - HiLink liloEqHexNumber liloEquals - HiLink liloEqNumber liloEquals - HiLink liloEqString liloEquals - HiLink liloEqAnything liloEquals - HiLink liloEquals Special - - HiLink liloError Error - - HiLink liloEqPathComment liloComment - HiLink liloEqVgaComment liloComment - HiLink liloEqDecNumberComment liloComment - HiLink liloEqHexNumberComment liloComment - HiLink liloEqStringComment liloComment - HiLink liloEqAnythingComment liloComment - HiLink liloPathComment liloComment - HiLink liloVgaComment liloComment - HiLink liloDecNumberComment liloComment - HiLink liloHexNumberComment liloComment - HiLink liloNumberComment liloComment - HiLink liloStringComment liloComment - HiLink liloAnythingComment liloComment - HiLink liloComment Comment - - HiLink liloDiskOpt liloOption - HiLink liloKernelOpt liloOption - HiLink liloImageOpt liloOption - HiLink liloOption Keyword - - HiLink liloDecNumber liloNumber - HiLink liloHexNumber liloNumber - HiLink liloDecNumberP liloNumber - HiLink liloNumber Number - HiLink liloString String - HiLink liloPath Constant - - HiLink liloSpecial Special - HiLink liloLabel Title - HiLink liloDecNumberList Special - HiLink liloDecNumberPList Special - HiLink liloAnything Normal - HiLink liloEnviron Identifier - HiLink liloVgaKeyword Identifier - HiLink liloImage Type - HiLink liloChRules Preproc - HiLink liloDisk Preproc - - delcommand HiLink -endif + +hi def link liloEqPath liloEquals +hi def link liloEqWord liloEquals +hi def link liloEqVga liloEquals +hi def link liloEqDecNumber liloEquals +hi def link liloEqHexNumber liloEquals +hi def link liloEqNumber liloEquals +hi def link liloEqString liloEquals +hi def link liloEqAnything liloEquals +hi def link liloEquals Special + +hi def link liloError Error + +hi def link liloEqPathComment liloComment +hi def link liloEqVgaComment liloComment +hi def link liloEqDecNumberComment liloComment +hi def link liloEqHexNumberComment liloComment +hi def link liloEqStringComment liloComment +hi def link liloEqAnythingComment liloComment +hi def link liloPathComment liloComment +hi def link liloVgaComment liloComment +hi def link liloDecNumberComment liloComment +hi def link liloHexNumberComment liloComment +hi def link liloNumberComment liloComment +hi def link liloStringComment liloComment +hi def link liloAnythingComment liloComment +hi def link liloComment Comment + +hi def link liloDiskOpt liloOption +hi def link liloKernelOpt liloOption +hi def link liloImageOpt liloOption +hi def link liloOption Keyword + +hi def link liloDecNumber liloNumber +hi def link liloHexNumber liloNumber +hi def link liloDecNumberP liloNumber +hi def link liloNumber Number +hi def link liloString String +hi def link liloPath Constant + +hi def link liloSpecial Special +hi def link liloLabel Title +hi def link liloDecNumberList Special +hi def link liloDecNumberPList Special +hi def link liloAnything Normal +hi def link liloEnviron Identifier +hi def link liloVgaKeyword Identifier +hi def link liloImage Type +hi def link liloChRules Preproc +hi def link liloDisk Preproc + let b:current_syntax = "lilo" diff --git a/runtime/syntax/limits.vim b/runtime/syntax/limits.vim index a6d245ae11..96bd423869 100644 --- a/runtime/syntax/limits.vim +++ b/runtime/syntax/limits.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: limits(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: limits(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim index 74ec20bb4e..b6aa04b2c7 100644 --- a/runtime/syntax/lisp.vim +++ b/runtime/syntax/lisp.vim @@ -1,28 +1,25 @@ " Vim syntax file " Language: Lisp -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Nov 16, 2010 -" Version: 22 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Feb 15, 2018 +" Version: 27 +" 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 the HyperSpec +" Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec " Clisp additions courtesy of http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/emacs/lisp.vim " --------------------------------------------------------------------- " Load Once: {{{1 -" For vim-version 5.x: Clear all syntax items -" For vim-version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +if exists("b:current_syntax") + finish endif -if version >= 600 - setlocal iskeyword=38,42,43,45,47-58,60-62,64-90,97-122,_ +if exists("g:lisp_isk") + exe "setl isk=".g:lisp_isk +elseif !has("patch-7.4.1142") + setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_ else - set iskeyword=38,42,43,45,47-58,60-62,64-90,97-122,_ + syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_ endif if exists("g:lispsyntax_ignorecase") || exists("g:lispsyntax_clisp") @@ -43,8 +40,8 @@ syn case ignore " --------------------------------------------------------------------- " Lists: {{{1 -syn match lispSymbol contained ![^()'`,"; \t]\+! -syn match lispBarSymbol contained !|..\{-}|! +syn match lispSymbol contained ![^()'`,"; \t]\+! +syn match lispBarSymbol contained !|..\{-}|! if exists("g:lisp_rainbow") && g:lisp_rainbow != 0 syn region lispParen0 matchgroup=hlLevel0 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen1 syn region lispParen1 contained matchgroup=hlLevel1 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen2 @@ -74,320 +71,320 @@ syn match lispLeadWhite contained "^\s\+" " --------------------------------------------------------------------- " Standard Lisp Functions and Macros: {{{1 -syn keyword lispFunc * find-method pprint-indent -syn keyword lispFunc ** find-package pprint-linear -syn keyword lispFunc *** find-restart pprint-logical-block -syn keyword lispFunc + find-symbol pprint-newline -syn keyword lispFunc ++ finish-output pprint-pop -syn keyword lispFunc +++ first pprint-tab -syn keyword lispFunc - fixnum pprint-tabular -syn keyword lispFunc / flet prin1 -syn keyword lispFunc // float prin1-to-string -syn keyword lispFunc /// float-digits princ -syn keyword lispFunc /= float-precision princ-to-string -syn keyword lispFunc 1+ float-radix print -syn keyword lispFunc 1- float-sign print-not-readable -syn keyword lispFunc < floating-point-inexact print-not-readable-object -syn keyword lispFunc <= floating-point-invalid-operation print-object -syn keyword lispFunc = floating-point-overflow print-unreadable-object -syn keyword lispFunc > floating-point-underflow probe-file -syn keyword lispFunc >= floatp proclaim -syn keyword lispFunc abort floor prog -syn keyword lispFunc abs fmakunbound prog* -syn keyword lispFunc access force-output prog1 -syn keyword lispFunc acons format prog2 -syn keyword lispFunc acos formatter progn -syn keyword lispFunc acosh fourth program-error -syn keyword lispFunc add-method fresh-line progv -syn keyword lispFunc adjoin fround provide -syn keyword lispFunc adjust-array ftruncate psetf -syn keyword lispFunc adjustable-array-p ftype psetq -syn keyword lispFunc allocate-instance funcall push -syn keyword lispFunc alpha-char-p function pushnew -syn keyword lispFunc alphanumericp function-keywords putprop -syn keyword lispFunc and function-lambda-expression quote -syn keyword lispFunc append functionp random -syn keyword lispFunc apply gbitp random-state -syn keyword lispFunc applyhook gcd random-state-p -syn keyword lispFunc apropos generic-function rassoc -syn keyword lispFunc apropos-list gensym rassoc-if -syn keyword lispFunc aref gentemp rassoc-if-not -syn keyword lispFunc arithmetic-error get ratio -syn keyword lispFunc arithmetic-error-operands get-decoded-time rational -syn keyword lispFunc arithmetic-error-operation get-dispatch-macro-character rationalize -syn keyword lispFunc array get-internal-real-time rationalp -syn keyword lispFunc array-dimension get-internal-run-time read -syn keyword lispFunc array-dimension-limit get-macro-character read-byte -syn keyword lispFunc array-dimensions get-output-stream-string read-char -syn keyword lispFunc array-displacement get-properties read-char-no-hang -syn keyword lispFunc array-element-type get-setf-expansion read-delimited-list -syn keyword lispFunc array-has-fill-pointer-p get-setf-method read-eval-print -syn keyword lispFunc array-in-bounds-p get-universal-time read-from-string -syn keyword lispFunc array-rank getf read-line -syn keyword lispFunc array-rank-limit gethash read-preserving-whitespace -syn keyword lispFunc array-row-major-index go read-sequence -syn keyword lispFunc array-total-size graphic-char-p reader-error -syn keyword lispFunc array-total-size-limit handler-bind readtable -syn keyword lispFunc arrayp handler-case readtable-case -syn keyword lispFunc ash hash-table readtablep -syn keyword lispFunc asin hash-table-count real -syn keyword lispFunc asinh hash-table-p realp -syn keyword lispFunc assert hash-table-rehash-size realpart -syn keyword lispFunc assoc hash-table-rehash-threshold reduce -syn keyword lispFunc assoc-if hash-table-size reinitialize-instance -syn keyword lispFunc assoc-if-not hash-table-test rem -syn keyword lispFunc atan host-namestring remf -syn keyword lispFunc atanh identity remhash -syn keyword lispFunc atom if remove -syn keyword lispFunc base-char if-exists remove-duplicates -syn keyword lispFunc base-string ignorable remove-if -syn keyword lispFunc bignum ignore remove-if-not -syn keyword lispFunc bit ignore-errors remove-method -syn keyword lispFunc bit-and imagpart remprop -syn keyword lispFunc bit-andc1 import rename-file -syn keyword lispFunc bit-andc2 in-package rename-package -syn keyword lispFunc bit-eqv in-package replace -syn keyword lispFunc bit-ior incf require -syn keyword lispFunc bit-nand initialize-instance rest -syn keyword lispFunc bit-nor inline restart -syn keyword lispFunc bit-not input-stream-p restart-bind -syn keyword lispFunc bit-orc1 inspect restart-case -syn keyword lispFunc bit-orc2 int-char restart-name -syn keyword lispFunc bit-vector integer return -syn keyword lispFunc bit-vector-p integer-decode-float return-from -syn keyword lispFunc bit-xor integer-length revappend -syn keyword lispFunc block integerp reverse -syn keyword lispFunc boole interactive-stream-p room -syn keyword lispFunc boole-1 intern rotatef -syn keyword lispFunc boole-2 internal-time-units-per-second round -syn keyword lispFunc boole-and intersection row-major-aref -syn keyword lispFunc boole-andc1 invalid-method-error rplaca -syn keyword lispFunc boole-andc2 invoke-debugger rplacd -syn keyword lispFunc boole-c1 invoke-restart safety -syn keyword lispFunc boole-c2 invoke-restart-interactively satisfies -syn keyword lispFunc boole-clr isqrt sbit -syn keyword lispFunc boole-eqv keyword scale-float -syn keyword lispFunc boole-ior keywordp schar -syn keyword lispFunc boole-nand labels search -syn keyword lispFunc boole-nor lambda second -syn keyword lispFunc boole-orc1 lambda-list-keywords sequence -syn keyword lispFunc boole-orc2 lambda-parameters-limit serious-condition -syn keyword lispFunc boole-set last set -syn keyword lispFunc boole-xor lcm set-char-bit -syn keyword lispFunc boolean ldb set-difference -syn keyword lispFunc both-case-p ldb-test set-dispatch-macro-character -syn keyword lispFunc boundp ldiff set-exclusive-or -syn keyword lispFunc break least-negative-double-float set-macro-character -syn keyword lispFunc broadcast-stream least-negative-long-float set-pprint-dispatch -syn keyword lispFunc broadcast-stream-streams least-negative-normalized-double-float set-syntax-from-char -syn keyword lispFunc built-in-class least-negative-normalized-long-float setf -syn keyword lispFunc butlast least-negative-normalized-short-float setq -syn keyword lispFunc byte least-negative-normalized-single-float seventh -syn keyword lispFunc byte-position least-negative-short-float shadow -syn keyword lispFunc byte-size least-negative-single-float shadowing-import -syn keyword lispFunc call-arguments-limit least-positive-double-float shared-initialize -syn keyword lispFunc call-method least-positive-long-float shiftf -syn keyword lispFunc call-next-method least-positive-normalized-double-float short-float -syn keyword lispFunc capitalize least-positive-normalized-long-float short-float-epsilon -syn keyword lispFunc car least-positive-normalized-short-float short-float-negative-epsilon -syn keyword lispFunc case least-positive-normalized-single-float short-site-name -syn keyword lispFunc catch least-positive-short-float signal -syn keyword lispFunc ccase least-positive-single-float signed-byte -syn keyword lispFunc cdr length signum -syn keyword lispFunc ceiling let simple-condition -syn keyword lispFunc cell-error let* simple-array -syn keyword lispFunc cell-error-name lisp simple-base-string -syn keyword lispFunc cerror lisp-implementation-type simple-bit-vector -syn keyword lispFunc change-class lisp-implementation-version simple-bit-vector-p -syn keyword lispFunc char list simple-condition-format-arguments -syn keyword lispFunc char-bit list* simple-condition-format-control -syn keyword lispFunc char-bits list-all-packages simple-error -syn keyword lispFunc char-bits-limit list-length simple-string -syn keyword lispFunc char-code listen simple-string-p -syn keyword lispFunc char-code-limit listp simple-type-error -syn keyword lispFunc char-control-bit load simple-vector -syn keyword lispFunc char-downcase load-logical-pathname-translations simple-vector-p -syn keyword lispFunc char-equal load-time-value simple-warning -syn keyword lispFunc char-font locally sin -syn keyword lispFunc char-font-limit log single-flaot-epsilon -syn keyword lispFunc char-greaterp logand single-float -syn keyword lispFunc char-hyper-bit logandc1 single-float-epsilon -syn keyword lispFunc char-int logandc2 single-float-negative-epsilon -syn keyword lispFunc char-lessp logbitp sinh -syn keyword lispFunc char-meta-bit logcount sixth -syn keyword lispFunc char-name logeqv sleep -syn keyword lispFunc char-not-equal logical-pathname slot-boundp -syn keyword lispFunc char-not-greaterp logical-pathname-translations slot-exists-p -syn keyword lispFunc char-not-lessp logior slot-makunbound -syn keyword lispFunc char-super-bit lognand slot-missing -syn keyword lispFunc char-upcase lognor slot-unbound -syn keyword lispFunc char/= lognot slot-value -syn keyword lispFunc char< logorc1 software-type -syn keyword lispFunc char<= logorc2 software-version -syn keyword lispFunc char= logtest some -syn keyword lispFunc char> logxor sort -syn keyword lispFunc char>= long-float space -syn keyword lispFunc character long-float-epsilon special -syn keyword lispFunc characterp long-float-negative-epsilon special-form-p -syn keyword lispFunc check-type long-site-name special-operator-p -syn keyword lispFunc cis loop speed -syn keyword lispFunc class loop-finish sqrt -syn keyword lispFunc class-name lower-case-p stable-sort -syn keyword lispFunc class-of machine-instance standard -syn keyword lispFunc clear-input machine-type standard-char -syn keyword lispFunc clear-output machine-version standard-char-p -syn keyword lispFunc close macro-function standard-class -syn keyword lispFunc clrhash macroexpand standard-generic-function -syn keyword lispFunc code-char macroexpand-1 standard-method -syn keyword lispFunc coerce macroexpand-l standard-object -syn keyword lispFunc commonp macrolet step -syn keyword lispFunc compilation-speed make-array storage-condition -syn keyword lispFunc compile make-array store-value -syn keyword lispFunc compile-file make-broadcast-stream stream -syn keyword lispFunc compile-file-pathname make-char stream-element-type -syn keyword lispFunc compiled-function make-concatenated-stream stream-error -syn keyword lispFunc compiled-function-p make-condition stream-error-stream -syn keyword lispFunc compiler-let make-dispatch-macro-character stream-external-format -syn keyword lispFunc compiler-macro make-echo-stream streamp -syn keyword lispFunc compiler-macro-function make-hash-table streamup -syn keyword lispFunc complement make-instance string -syn keyword lispFunc complex make-instances-obsolete string-capitalize -syn keyword lispFunc complexp make-list string-char -syn keyword lispFunc compute-applicable-methods make-load-form string-char-p -syn keyword lispFunc compute-restarts make-load-form-saving-slots string-downcase -syn keyword lispFunc concatenate make-method string-equal -syn keyword lispFunc concatenated-stream make-package string-greaterp -syn keyword lispFunc concatenated-stream-streams make-pathname string-left-trim -syn keyword lispFunc cond make-random-state string-lessp -syn keyword lispFunc condition make-sequence string-not-equal -syn keyword lispFunc conjugate make-string string-not-greaterp -syn keyword lispFunc cons make-string-input-stream string-not-lessp -syn keyword lispFunc consp make-string-output-stream string-right-strim -syn keyword lispFunc constantly make-symbol string-right-trim -syn keyword lispFunc constantp make-synonym-stream string-stream -syn keyword lispFunc continue make-two-way-stream string-trim -syn keyword lispFunc control-error makunbound string-upcase -syn keyword lispFunc copy-alist map string/= -syn keyword lispFunc copy-list map-into string< -syn keyword lispFunc copy-pprint-dispatch mapc string<= -syn keyword lispFunc copy-readtable mapcan string= -syn keyword lispFunc copy-seq mapcar string> -syn keyword lispFunc copy-structure mapcon string>= -syn keyword lispFunc copy-symbol maphash stringp -syn keyword lispFunc copy-tree mapl structure -syn keyword lispFunc cos maplist structure-class -syn keyword lispFunc cosh mask-field structure-object -syn keyword lispFunc count max style-warning -syn keyword lispFunc count-if member sublim -syn keyword lispFunc count-if-not member-if sublis -syn keyword lispFunc ctypecase member-if-not subseq -syn keyword lispFunc debug merge subsetp -syn keyword lispFunc decf merge-pathname subst -syn keyword lispFunc declaim merge-pathnames subst-if -syn keyword lispFunc declaration method subst-if-not -syn keyword lispFunc declare method-combination substitute -syn keyword lispFunc decode-float method-combination-error substitute-if -syn keyword lispFunc decode-universal-time method-qualifiers substitute-if-not -syn keyword lispFunc defclass min subtypep -syn keyword lispFunc defconstant minusp svref -syn keyword lispFunc defgeneric mismatch sxhash -syn keyword lispFunc define-compiler-macro mod symbol -syn keyword lispFunc define-condition most-negative-double-float symbol-function -syn keyword lispFunc define-method-combination most-negative-fixnum symbol-macrolet -syn keyword lispFunc define-modify-macro most-negative-long-float symbol-name -syn keyword lispFunc define-setf-expander most-negative-short-float symbol-package -syn keyword lispFunc define-setf-method most-negative-single-float symbol-plist -syn keyword lispFunc define-symbol-macro most-positive-double-float symbol-value -syn keyword lispFunc defmacro most-positive-fixnum symbolp -syn keyword lispFunc defmethod most-positive-long-float synonym-stream -syn keyword lispFunc defpackage most-positive-short-float synonym-stream-symbol -syn keyword lispFunc defparameter most-positive-single-float sys -syn keyword lispFunc defsetf muffle-warning system -syn keyword lispFunc defstruct multiple-value-bind t -syn keyword lispFunc deftype multiple-value-call tagbody -syn keyword lispFunc defun multiple-value-list tailp -syn keyword lispFunc defvar multiple-value-prog1 tan -syn keyword lispFunc delete multiple-value-seteq tanh -syn keyword lispFunc delete-duplicates multiple-value-setq tenth -syn keyword lispFunc delete-file multiple-values-limit terpri -syn keyword lispFunc delete-if name-char the -syn keyword lispFunc delete-if-not namestring third -syn keyword lispFunc delete-package nbutlast throw -syn keyword lispFunc denominator nconc time -syn keyword lispFunc deposit-field next-method-p trace -syn keyword lispFunc describe nil translate-logical-pathname -syn keyword lispFunc describe-object nintersection translate-pathname -syn keyword lispFunc destructuring-bind ninth tree-equal -syn keyword lispFunc digit-char no-applicable-method truename -syn keyword lispFunc digit-char-p no-next-method truncase -syn keyword lispFunc directory not truncate -syn keyword lispFunc directory-namestring notany two-way-stream -syn keyword lispFunc disassemble notevery two-way-stream-input-stream -syn keyword lispFunc division-by-zero notinline two-way-stream-output-stream -syn keyword lispFunc do nreconc type -syn keyword lispFunc do* nreverse type-error -syn keyword lispFunc do-all-symbols nset-difference type-error-datum -syn keyword lispFunc do-exeternal-symbols nset-exclusive-or type-error-expected-type -syn keyword lispFunc do-external-symbols nstring type-of -syn keyword lispFunc do-symbols nstring-capitalize typecase -syn keyword lispFunc documentation nstring-downcase typep -syn keyword lispFunc dolist nstring-upcase unbound-slot -syn keyword lispFunc dotimes nsublis unbound-slot-instance -syn keyword lispFunc double-float nsubst unbound-variable -syn keyword lispFunc double-float-epsilon nsubst-if undefined-function -syn keyword lispFunc double-float-negative-epsilon nsubst-if-not unexport -syn keyword lispFunc dpb nsubstitute unintern -syn keyword lispFunc dribble nsubstitute-if union -syn keyword lispFunc dynamic-extent nsubstitute-if-not unless -syn keyword lispFunc ecase nth unread -syn keyword lispFunc echo-stream nth-value unread-char -syn keyword lispFunc echo-stream-input-stream nthcdr unsigned-byte -syn keyword lispFunc echo-stream-output-stream null untrace -syn keyword lispFunc ed number unuse-package -syn keyword lispFunc eighth numberp unwind-protect -syn keyword lispFunc elt numerator update-instance-for-different-class -syn keyword lispFunc encode-universal-time nunion update-instance-for-redefined-class -syn keyword lispFunc end-of-file oddp upgraded-array-element-type -syn keyword lispFunc endp open upgraded-complex-part-type -syn keyword lispFunc enough-namestring open-stream-p upper-case-p -syn keyword lispFunc ensure-directories-exist optimize use-package -syn keyword lispFunc ensure-generic-function or use-value -syn keyword lispFunc eq otherwise user -syn keyword lispFunc eql output-stream-p user-homedir-pathname -syn keyword lispFunc equal package values -syn keyword lispFunc equalp package-error values-list -syn keyword lispFunc error package-error-package vector -syn keyword lispFunc etypecase package-name vector-pop -syn keyword lispFunc eval package-nicknames vector-push -syn keyword lispFunc eval-when package-shadowing-symbols vector-push-extend -syn keyword lispFunc evalhook package-use-list vectorp -syn keyword lispFunc evenp package-used-by-list warn -syn keyword lispFunc every packagep warning -syn keyword lispFunc exp pairlis when -syn keyword lispFunc export parse-error wild-pathname-p -syn keyword lispFunc expt parse-integer with-accessors -syn keyword lispFunc extended-char parse-namestring with-compilation-unit -syn keyword lispFunc fboundp pathname with-condition-restarts -syn keyword lispFunc fceiling pathname-device with-hash-table-iterator -syn keyword lispFunc fdefinition pathname-directory with-input-from-string -syn keyword lispFunc ffloor pathname-host with-open-file -syn keyword lispFunc fifth pathname-match-p with-open-stream -syn keyword lispFunc file-author pathname-name with-output-to-string -syn keyword lispFunc file-error pathname-type with-package-iterator -syn keyword lispFunc file-error-pathname pathname-version with-simple-restart -syn keyword lispFunc file-length pathnamep with-slots -syn keyword lispFunc file-namestring peek-char with-standard-io-syntax -syn keyword lispFunc file-position phase write -syn keyword lispFunc file-stream pi write-byte -syn keyword lispFunc file-string-length plusp write-char -syn keyword lispFunc file-write-date pop write-line -syn keyword lispFunc fill position write-sequence -syn keyword lispFunc fill-pointer position-if write-string -syn keyword lispFunc find position-if-not write-to-string -syn keyword lispFunc find-all-symbols pprint y-or-n-p -syn keyword lispFunc find-class pprint-dispatch yes-or-no-p -syn keyword lispFunc find-if pprint-exit-if-list-exhausted zerop -syn keyword lispFunc find-if-not pprint-fill +syn keyword lispFunc < find-method pprint-indent +syn keyword lispFunc <= find-package pprint-linear +syn keyword lispFunc = find-restart pprint-logical-block +syn keyword lispFunc > find-symbol pprint-newline +syn keyword lispFunc >= finish-output pprint-pop +syn keyword lispFunc - first pprint-tab +syn keyword lispFunc / fixnum pprint-tabular +syn keyword lispFunc /= flet prin1 +syn keyword lispFunc // float prin1-to-string +syn keyword lispFunc /// float-digits princ +syn keyword lispFunc * floating-point-inexact princ-to-string +syn keyword lispFunc ** floating-point-invalid-operation print +syn keyword lispFunc *** floating-point-overflow print-not-readable +syn keyword lispFunc + floating-point-underflow print-not-readable-object +syn keyword lispFunc ++ floatp print-object +syn keyword lispFunc +++ float-precision print-unreadable-object +syn keyword lispFunc 1- float-radix probe-file +syn keyword lispFunc 1+ float-sign proclaim +syn keyword lispFunc abort floor prog +syn keyword lispFunc abs fmakunbound prog* +syn keyword lispFunc access force-output prog1 +syn keyword lispFunc acons format prog2 +syn keyword lispFunc acos formatter progn +syn keyword lispFunc acosh fourth program-error +syn keyword lispFunc add-method fresh-line progv +syn keyword lispFunc adjoin fround provide +syn keyword lispFunc adjustable-array-p ftruncate psetf +syn keyword lispFunc adjust-array ftype psetq +syn keyword lispFunc allocate-instance funcall push +syn keyword lispFunc alpha-char-p function pushnew +syn keyword lispFunc alphanumericp function-keywords putprop +syn keyword lispFunc and function-lambda-expression quote +syn keyword lispFunc append functionp random +syn keyword lispFunc apply gbitp random-state +syn keyword lispFunc applyhook gcd random-state-p +syn keyword lispFunc apropos generic-function rassoc +syn keyword lispFunc apropos-list gensym rassoc-if +syn keyword lispFunc aref gentemp rassoc-if-not +syn keyword lispFunc arithmetic-error get ratio +syn keyword lispFunc arithmetic-error-operands get-decoded-time rational +syn keyword lispFunc arithmetic-error-operation get-dispatch-macro-character rationalize +syn keyword lispFunc array getf rationalp +syn keyword lispFunc array-dimension gethash read +syn keyword lispFunc array-dimension-limit get-internal-real-time read-byte +syn keyword lispFunc array-dimensions get-internal-run-time read-char +syn keyword lispFunc array-displacement get-macro-character read-char-no-hang +syn keyword lispFunc array-element-type get-output-stream-string read-delimited-list +syn keyword lispFunc array-has-fill-pointer-p get-properties reader-error +syn keyword lispFunc array-in-bounds-p get-setf-expansion read-eval-print +syn keyword lispFunc arrayp get-setf-method read-from-string +syn keyword lispFunc array-rank get-universal-time read-line +syn keyword lispFunc array-rank-limit go read-preserving-whitespace +syn keyword lispFunc array-row-major-index graphic-char-p read-sequence +syn keyword lispFunc array-total-size handler-bind readtable +syn keyword lispFunc array-total-size-limit handler-case readtable-case +syn keyword lispFunc ash hash-table readtablep +syn keyword lispFunc asin hash-table-count real +syn keyword lispFunc asinh hash-table-p realp +syn keyword lispFunc assert hash-table-rehash-size realpart +syn keyword lispFunc assoc hash-table-rehash-threshold reduce +syn keyword lispFunc assoc-if hash-table-size reinitialize-instance +syn keyword lispFunc assoc-if-not hash-table-test rem +syn keyword lispFunc atan host-namestring remf +syn keyword lispFunc atanh identity remhash +syn keyword lispFunc atom if remove +syn keyword lispFunc base-char if-exists remove-duplicates +syn keyword lispFunc base-string ignorable remove-if +syn keyword lispFunc bignum ignore remove-if-not +syn keyword lispFunc bit ignore-errors remove-method +syn keyword lispFunc bit-and imagpart remprop +syn keyword lispFunc bit-andc1 import rename-file +syn keyword lispFunc bit-andc2 incf rename-package +syn keyword lispFunc bit-eqv initialize-instance replace +syn keyword lispFunc bit-ior inline require +syn keyword lispFunc bit-nand in-package rest +syn keyword lispFunc bit-nor in-package restart +syn keyword lispFunc bit-not input-stream-p restart-bind +syn keyword lispFunc bit-orc1 inspect restart-case +syn keyword lispFunc bit-orc2 int-char restart-name +syn keyword lispFunc bit-vector integer return +syn keyword lispFunc bit-vector-p integer-decode-float return-from +syn keyword lispFunc bit-xor integer-length revappend +syn keyword lispFunc block integerp reverse +syn keyword lispFunc boole interactive-stream-p room +syn keyword lispFunc boole-1 intern rotatef +syn keyword lispFunc boole-2 internal-time-units-per-second round +syn keyword lispFunc boolean intersection row-major-aref +syn keyword lispFunc boole-and invalid-method-error rplaca +syn keyword lispFunc boole-andc1 invoke-debugger rplacd +syn keyword lispFunc boole-andc2 invoke-restart safety +syn keyword lispFunc boole-c1 invoke-restart-interactively satisfies +syn keyword lispFunc boole-c2 isqrt sbit +syn keyword lispFunc boole-clr keyword scale-float +syn keyword lispFunc boole-eqv keywordp schar +syn keyword lispFunc boole-ior labels search +syn keyword lispFunc boole-nand lambda second +syn keyword lispFunc boole-nor lambda-list-keywords sequence +syn keyword lispFunc boole-orc1 lambda-parameters-limit serious-condition +syn keyword lispFunc boole-orc2 last set +syn keyword lispFunc boole-set lcm set-char-bit +syn keyword lispFunc boole-xor ldb set-difference +syn keyword lispFunc both-case-p ldb-test set-dispatch-macro-character +syn keyword lispFunc boundp ldiff set-exclusive-or +syn keyword lispFunc break least-negative-double-float setf +syn keyword lispFunc broadcast-stream least-negative-long-float set-macro-character +syn keyword lispFunc broadcast-stream-streams least-negative-normalized-double-float set-pprint-dispatch +syn keyword lispFunc built-in-class least-negative-normalized-long-float setq +syn keyword lispFunc butlast least-negative-normalized-short-float set-syntax-from-char +syn keyword lispFunc byte least-negative-normalized-single-float seventh +syn keyword lispFunc byte-position least-negative-short-float shadow +syn keyword lispFunc byte-size least-negative-single-float shadowing-import +syn keyword lispFunc call-arguments-limit least-positive-double-float shared-initialize +syn keyword lispFunc call-method least-positive-long-float shiftf +syn keyword lispFunc call-next-method least-positive-normalized-double-float short-float +syn keyword lispFunc capitalize least-positive-normalized-long-float short-float-epsilon +syn keyword lispFunc car least-positive-normalized-short-float short-float-negative-epsilon +syn keyword lispFunc case least-positive-normalized-single-float short-site-name +syn keyword lispFunc catch least-positive-short-float signal +syn keyword lispFunc ccase least-positive-single-float signed-byte +syn keyword lispFunc cdr length signum +syn keyword lispFunc ceiling let simple-array +syn keyword lispFunc cell-error let* simple-base-string +syn keyword lispFunc cell-error-name lisp simple-bit-vector +syn keyword lispFunc cerror lisp-implementation-type simple-bit-vector-p +syn keyword lispFunc change-class lisp-implementation-version simple-condition +syn keyword lispFunc char list simple-condition-format-arguments +syn keyword lispFunc char< list* simple-condition-format-control +syn keyword lispFunc char<= list-all-packages simple-error +syn keyword lispFunc char= listen simple-string +syn keyword lispFunc char> list-length simple-string-p +syn keyword lispFunc char>= listp simple-type-error +syn keyword lispFunc char/= load simple-vector +syn keyword lispFunc character load-logical-pathname-translations simple-vector-p +syn keyword lispFunc characterp load-time-value simple-warning +syn keyword lispFunc char-bit locally sin +syn keyword lispFunc char-bits log single-flaot-epsilon +syn keyword lispFunc char-bits-limit logand single-float +syn keyword lispFunc char-code logandc1 single-float-epsilon +syn keyword lispFunc char-code-limit logandc2 single-float-negative-epsilon +syn keyword lispFunc char-control-bit logbitp sinh +syn keyword lispFunc char-downcase logcount sixth +syn keyword lispFunc char-equal logeqv sleep +syn keyword lispFunc char-font logical-pathname slot-boundp +syn keyword lispFunc char-font-limit logical-pathname-translations slot-exists-p +syn keyword lispFunc char-greaterp logior slot-makunbound +syn keyword lispFunc char-hyper-bit lognand slot-missing +syn keyword lispFunc char-int lognor slot-unbound +syn keyword lispFunc char-lessp lognot slot-value +syn keyword lispFunc char-meta-bit logorc1 software-type +syn keyword lispFunc char-name logorc2 software-version +syn keyword lispFunc char-not-equal logtest some +syn keyword lispFunc char-not-greaterp logxor sort +syn keyword lispFunc char-not-lessp long-float space +syn keyword lispFunc char-super-bit long-float-epsilon special +syn keyword lispFunc char-upcase long-float-negative-epsilon special-form-p +syn keyword lispFunc check-type long-site-name special-operator-p +syn keyword lispFunc cis loop speed +syn keyword lispFunc class loop-finish sqrt +syn keyword lispFunc class-name lower-case-p stable-sort +syn keyword lispFunc class-of machine-instance standard +syn keyword lispFunc clear-input machine-type standard-char +syn keyword lispFunc clear-output machine-version standard-char-p +syn keyword lispFunc close macroexpand standard-class +syn keyword lispFunc clrhash macroexpand-1 standard-generic-function +syn keyword lispFunc code-char macroexpand-l standard-method +syn keyword lispFunc coerce macro-function standard-object +syn keyword lispFunc commonp macrolet step +syn keyword lispFunc compilation-speed make-array storage-condition +syn keyword lispFunc compile make-array store-value +syn keyword lispFunc compiled-function make-broadcast-stream stream +syn keyword lispFunc compiled-function-p make-char stream-element-type +syn keyword lispFunc compile-file make-concatenated-stream stream-error +syn keyword lispFunc compile-file-pathname make-condition stream-error-stream +syn keyword lispFunc compiler-let make-dispatch-macro-character stream-external-format +syn keyword lispFunc compiler-macro make-echo-stream streamp +syn keyword lispFunc compiler-macro-function make-hash-table streamup +syn keyword lispFunc complement make-instance string +syn keyword lispFunc complex make-instances-obsolete string< +syn keyword lispFunc complexp make-list string<= +syn keyword lispFunc compute-applicable-methods make-load-form string= +syn keyword lispFunc compute-restarts make-load-form-saving-slots string> +syn keyword lispFunc concatenate make-method string>= +syn keyword lispFunc concatenated-stream make-package string/= +syn keyword lispFunc concatenated-stream-streams make-pathname string-capitalize +syn keyword lispFunc cond make-random-state string-char +syn keyword lispFunc condition make-sequence string-char-p +syn keyword lispFunc conjugate make-string string-downcase +syn keyword lispFunc cons make-string-input-stream string-equal +syn keyword lispFunc consp make-string-output-stream string-greaterp +syn keyword lispFunc constantly make-symbol string-left-trim +syn keyword lispFunc constantp make-synonym-stream string-lessp +syn keyword lispFunc continue make-two-way-stream string-not-equal +syn keyword lispFunc control-error makunbound string-not-greaterp +syn keyword lispFunc copy-alist map string-not-lessp +syn keyword lispFunc copy-list mapc stringp +syn keyword lispFunc copy-pprint-dispatch mapcan string-right-strim +syn keyword lispFunc copy-readtable mapcar string-right-trim +syn keyword lispFunc copy-seq mapcon string-stream +syn keyword lispFunc copy-structure maphash string-trim +syn keyword lispFunc copy-symbol map-into string-upcase +syn keyword lispFunc copy-tree mapl structure +syn keyword lispFunc cos maplist structure-class +syn keyword lispFunc cosh mask-field structure-object +syn keyword lispFunc count max style-warning +syn keyword lispFunc count-if member sublim +syn keyword lispFunc count-if-not member-if sublis +syn keyword lispFunc ctypecase member-if-not subseq +syn keyword lispFunc debug merge subsetp +syn keyword lispFunc decf merge-pathname subst +syn keyword lispFunc declaim merge-pathnames subst-if +syn keyword lispFunc declaration method subst-if-not +syn keyword lispFunc declare method-combination substitute +syn keyword lispFunc decode-float method-combination-error substitute-if +syn keyword lispFunc decode-universal-time method-qualifiers substitute-if-not +syn keyword lispFunc defclass min subtypep +syn keyword lispFunc defconstant minusp svref +syn keyword lispFunc defgeneric mismatch sxhash +syn keyword lispFunc define-compiler-macro mod symbol +syn keyword lispFunc define-condition most-negative-double-float symbol-function +syn keyword lispFunc define-method-combination most-negative-fixnum symbol-macrolet +syn keyword lispFunc define-modify-macro most-negative-long-float symbol-name +syn keyword lispFunc define-setf-expander most-negative-short-float symbolp +syn keyword lispFunc define-setf-method most-negative-single-float symbol-package +syn keyword lispFunc define-symbol-macro most-positive-double-float symbol-plist +syn keyword lispFunc defmacro most-positive-fixnum symbol-value +syn keyword lispFunc defmethod most-positive-long-float synonym-stream +syn keyword lispFunc defpackage most-positive-short-float synonym-stream-symbol +syn keyword lispFunc defparameter most-positive-single-float sys +syn keyword lispFunc defsetf muffle-warning system +syn keyword lispFunc defstruct multiple-value-bind t +syn keyword lispFunc deftype multiple-value-call tagbody +syn keyword lispFunc defun multiple-value-list tailp +syn keyword lispFunc defvar multiple-value-prog1 tan +syn keyword lispFunc delete multiple-value-seteq tanh +syn keyword lispFunc delete-duplicates multiple-value-setq tenth +syn keyword lispFunc delete-file multiple-values-limit terpri +syn keyword lispFunc delete-if name-char the +syn keyword lispFunc delete-if-not namestring third +syn keyword lispFunc delete-package nbutlast throw +syn keyword lispFunc denominator nconc time +syn keyword lispFunc deposit-field next-method-p trace +syn keyword lispFunc describe nil translate-logical-pathname +syn keyword lispFunc describe-object nintersection translate-pathname +syn keyword lispFunc destructuring-bind ninth tree-equal +syn keyword lispFunc digit-char no-applicable-method truename +syn keyword lispFunc digit-char-p no-next-method truncase +syn keyword lispFunc directory not truncate +syn keyword lispFunc directory-namestring notany two-way-stream +syn keyword lispFunc disassemble notevery two-way-stream-input-stream +syn keyword lispFunc division-by-zero notinline two-way-stream-output-stream +syn keyword lispFunc do nreconc type +syn keyword lispFunc do* nreverse typecase +syn keyword lispFunc do-all-symbols nset-difference type-error +syn keyword lispFunc documentation nset-exclusive-or type-error-datum +syn keyword lispFunc do-exeternal-symbols nstring type-error-expected-type +syn keyword lispFunc do-external-symbols nstring-capitalize type-of +syn keyword lispFunc dolist nstring-downcase typep +syn keyword lispFunc do-symbols nstring-upcase unbound-slot +syn keyword lispFunc dotimes nsublis unbound-slot-instance +syn keyword lispFunc double-float nsubst unbound-variable +syn keyword lispFunc double-float-epsilon nsubst-if undefined-function +syn keyword lispFunc double-float-negative-epsilon nsubst-if-not unexport +syn keyword lispFunc dpb nsubstitute unintern +syn keyword lispFunc dribble nsubstitute-if union +syn keyword lispFunc dynamic-extent nsubstitute-if-not unless +syn keyword lispFunc ecase nth unread +syn keyword lispFunc echo-stream nthcdr unread-char +syn keyword lispFunc echo-stream-input-stream nth-value unsigned-byte +syn keyword lispFunc echo-stream-output-stream null untrace +syn keyword lispFunc ed number unuse-package +syn keyword lispFunc eighth numberp unwind-protect +syn keyword lispFunc elt numerator update-instance-for-different-class +syn keyword lispFunc encode-universal-time nunion update-instance-for-redefined-class +syn keyword lispFunc end-of-file oddp upgraded-array-element-type +syn keyword lispFunc endp open upgraded-complex-part-type +syn keyword lispFunc enough-namestring open-stream-p upper-case-p +syn keyword lispFunc ensure-directories-exist optimize use-package +syn keyword lispFunc ensure-generic-function or user +syn keyword lispFunc eq otherwise user-homedir-pathname +syn keyword lispFunc eql output-stream-p use-value +syn keyword lispFunc equal package values +syn keyword lispFunc equalp package-error values-list +syn keyword lispFunc error package-error-package variable +syn keyword lispFunc etypecase package-name vector +syn keyword lispFunc eval package-nicknames vectorp +syn keyword lispFunc evalhook packagep vector-pop +syn keyword lispFunc eval-when package-shadowing-symbols vector-push +syn keyword lispFunc evenp package-used-by-list vector-push-extend +syn keyword lispFunc every package-use-list warn +syn keyword lispFunc exp pairlis warning +syn keyword lispFunc export parse-error when +syn keyword lispFunc expt parse-integer wild-pathname-p +syn keyword lispFunc extended-char parse-namestring with-accessors +syn keyword lispFunc fboundp pathname with-compilation-unit +syn keyword lispFunc fceiling pathname-device with-condition-restarts +syn keyword lispFunc fdefinition pathname-directory with-hash-table-iterator +syn keyword lispFunc ffloor pathname-host with-input-from-string +syn keyword lispFunc fifth pathname-match-p with-open-file +syn keyword lispFunc file-author pathname-name with-open-stream +syn keyword lispFunc file-error pathnamep with-output-to-string +syn keyword lispFunc file-error-pathname pathname-type with-package-iterator +syn keyword lispFunc file-length pathname-version with-simple-restart +syn keyword lispFunc file-namestring peek-char with-slots +syn keyword lispFunc file-position phase with-standard-io-syntax +syn keyword lispFunc file-stream pi write +syn keyword lispFunc file-string-length plusp write-byte +syn keyword lispFunc file-write-date pop write-char +syn keyword lispFunc fill position write-line +syn keyword lispFunc fill-pointer position-if write-sequence +syn keyword lispFunc find position-if-not write-string +syn keyword lispFunc find-all-symbols pprint write-to-string +syn keyword lispFunc find-class pprint-dispatch yes-or-no-p +syn keyword lispFunc find-if pprint-exit-if-list-exhausted y-or-n-p +syn keyword lispFunc find-if-not pprint-fill zerop syn match lispFunc "\<c[ad]\+r\>" if exists("g:lispsyntax_clisp") @@ -564,59 +561,55 @@ syn sync lines=100 " --------------------------------------------------------------------- " Define Highlighting: {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 - command -nargs=+ HiLink hi def link <args> +if !exists("skip_lisp_syntax_inits") - HiLink lispCommentRegion lispComment - HiLink lispAtomNmbr lispNumber - HiLink lispAtomMark lispMark - HiLink lispInStringString lispString + hi def link lispCommentRegion lispComment + hi def link lispAtomNmbr lispNumber + hi def link lispAtomMark lispMark + hi def link lispInStringString lispString - HiLink lispAtom Identifier - HiLink lispAtomBarSymbol Special - HiLink lispBarSymbol Special - HiLink lispComment Comment - HiLink lispConcat Statement - HiLink lispDecl Statement - HiLink lispFunc Statement - HiLink lispKey Type - HiLink lispMark Delimiter - HiLink lispNumber Number - HiLink lispParenError Error - HiLink lispEscapeSpecial Type - HiLink lispString String - HiLink lispTodo Todo - HiLink lispVar Statement + hi def link lispAtom Identifier + hi def link lispAtomBarSymbol Special + hi def link lispBarSymbol Special + hi def link lispComment Comment + hi def link lispConcat Statement + hi def link lispDecl Statement + hi def link lispFunc Statement + hi def link lispKey Type + hi def link lispMark Delimiter + hi def link lispNumber Number + hi def link lispParenError Error + hi def link lispEscapeSpecial Type + hi def link lispString String + hi def link lispTodo Todo + hi def link lispVar Statement if exists("g:lisp_rainbow") && g:lisp_rainbow != 0 if &bg == "dark" - hi def hlLevel0 ctermfg=red guifg=red1 - hi def hlLevel1 ctermfg=yellow guifg=orange1 - hi def hlLevel2 ctermfg=green guifg=yellow1 - hi def hlLevel3 ctermfg=cyan guifg=greenyellow - hi def hlLevel4 ctermfg=magenta guifg=green1 - hi def hlLevel5 ctermfg=red guifg=springgreen1 - hi def hlLevel6 ctermfg=yellow guifg=cyan1 - hi def hlLevel7 ctermfg=green guifg=slateblue1 - hi def hlLevel8 ctermfg=cyan guifg=magenta1 - hi def hlLevel9 ctermfg=magenta guifg=purple1 + hi def hlLevel0 ctermfg=red guifg=red1 + hi def hlLevel1 ctermfg=yellow guifg=orange1 + hi def hlLevel2 ctermfg=green guifg=yellow1 + hi def hlLevel3 ctermfg=cyan guifg=greenyellow + hi def hlLevel4 ctermfg=magenta guifg=green1 + hi def hlLevel5 ctermfg=red guifg=springgreen1 + hi def hlLevel6 ctermfg=yellow guifg=cyan1 + hi def hlLevel7 ctermfg=green guifg=slateblue1 + hi def hlLevel8 ctermfg=cyan guifg=magenta1 + hi def hlLevel9 ctermfg=magenta guifg=purple1 else - hi def hlLevel0 ctermfg=red guifg=red3 - hi def hlLevel1 ctermfg=darkyellow guifg=orangered3 - hi def hlLevel2 ctermfg=darkgreen guifg=orange2 - hi def hlLevel3 ctermfg=blue guifg=yellow3 - hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4 - hi def hlLevel5 ctermfg=red guifg=green4 - hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3 - hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4 - hi def hlLevel8 ctermfg=blue guifg=darkslateblue - hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet + hi def hlLevel0 ctermfg=red guifg=red3 + hi def hlLevel1 ctermfg=darkyellow guifg=orangered3 + hi def hlLevel2 ctermfg=darkgreen guifg=orange2 + hi def hlLevel3 ctermfg=blue guifg=yellow3 + hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4 + hi def hlLevel5 ctermfg=red guifg=green4 + hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3 + hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4 + hi def hlLevel8 ctermfg=blue guifg=darkslateblue + hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet endif endif - delcommand HiLink endif let b:current_syntax = "lisp" diff --git a/runtime/syntax/lite.vim b/runtime/syntax/lite.vim index 8abc51dea1..a8d26892d4 100644 --- a/runtime/syntax/lite.vim +++ b/runtime/syntax/lite.vim @@ -8,11 +8,8 @@ " Options lite_sql_query = 1 for SQL syntax highligthing inside strings " lite_minlines = x to sync at least x lines backwards -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -138,39 +135,29 @@ if main_syntax == 'lite' endif " 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_lite_syn_inits") - if version < 508 - let did_lite_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link liteComment Comment +hi def link liteString String +hi def link liteNumber Number +hi def link liteFloat Float +hi def link liteIdentifier Identifier +hi def link liteGlobalIdentifier Identifier +hi def link liteIntVar Identifier +hi def link liteFunctions Function +hi def link liteRepeat Repeat +hi def link liteConditional Conditional +hi def link liteStatement Statement +hi def link liteType Type +hi def link liteInclude Include +hi def link liteDefine Define +hi def link liteSpecialChar SpecialChar +hi def link liteParentError liteError +hi def link liteError Error +hi def link liteTodo Todo +hi def link liteOperator Operator +hi def link liteRelation Operator - HiLink liteComment Comment - HiLink liteString String - HiLink liteNumber Number - HiLink liteFloat Float - HiLink liteIdentifier Identifier - HiLink liteGlobalIdentifier Identifier - HiLink liteIntVar Identifier - HiLink liteFunctions Function - HiLink liteRepeat Repeat - HiLink liteConditional Conditional - HiLink liteStatement Statement - HiLink liteType Type - HiLink liteInclude Include - HiLink liteDefine Define - HiLink liteSpecialChar SpecialChar - HiLink liteParentError liteError - HiLink liteError Error - HiLink liteTodo Todo - HiLink liteOperator Operator - HiLink liteRelation Operator - - delcommand HiLink -endif let b:current_syntax = "lite" diff --git a/runtime/syntax/litestep.vim b/runtime/syntax/litestep.vim index b4c15faf65..e3d967f010 100644 --- a/runtime/syntax/litestep.vim +++ b/runtime/syntax/litestep.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: LiteStep RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-02-22 +" Language: LiteStep RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-02-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/loginaccess.vim b/runtime/syntax/loginaccess.vim index 07d60eeca0..650e067d18 100644 --- a/runtime/syntax/loginaccess.vim +++ b/runtime/syntax/loginaccess.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: login.access(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: login.access(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/logindefs.vim b/runtime/syntax/logindefs.vim index 59d18e7ef4..8cb4295eda 100644 --- a/runtime/syntax/logindefs.vim +++ b/runtime/syntax/logindefs.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: login.defs(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-11-29 +" Language: login.defs(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-11-29 if exists("b:current_syntax") finish diff --git a/runtime/syntax/logtalk.vim b/runtime/syntax/logtalk.vim index be34c7ed74..532f83d3bf 100644 --- a/runtime/syntax/logtalk.vim +++ b/runtime/syntax/logtalk.vim @@ -5,11 +5,8 @@ " Last Change: February 4, 2012 -" Quit when a syntax file was already loaded: - -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -389,59 +386,47 @@ syn sync ccomment logtalkBlockComment maxlines=50 " 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_logtalk_syn_inits") - if version < 508 - let did_logtalk_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink logtalkBlockComment Comment - HiLink logtalkLineComment Comment +hi def link logtalkBlockComment Comment +hi def link logtalkLineComment Comment - HiLink logtalkOpenEntityDir Normal - HiLink logtalkOpenEntityDirTag PreProc +hi def link logtalkOpenEntityDir Normal +hi def link logtalkOpenEntityDirTag PreProc - HiLink logtalkIfContainer PreProc - HiLink logtalkIf PreProc - HiLink logtalkElseIf PreProc - HiLink logtalkElse PreProc +hi def link logtalkIfContainer PreProc +hi def link logtalkIf PreProc +hi def link logtalkElseIf PreProc +hi def link logtalkElse PreProc - HiLink logtalkEntity Normal +hi def link logtalkEntity Normal - HiLink logtalkEntityRel Normal - HiLink logtalkEntityRelTag PreProc +hi def link logtalkEntityRel Normal +hi def link logtalkEntityRelTag PreProc - HiLink logtalkCloseEntityDir PreProc +hi def link logtalkCloseEntityDir PreProc - HiLink logtalkDir Normal - HiLink logtalkDirTag PreProc +hi def link logtalkDir Normal +hi def link logtalkDirTag PreProc - HiLink logtalkAtom String - HiLink logtalkString String - HiLink logtalkEscapeSequence SpecialChar +hi def link logtalkAtom String +hi def link logtalkString String +hi def link logtalkEscapeSequence SpecialChar - HiLink logtalkNumber Number +hi def link logtalkNumber Number - HiLink logtalkKeyword Keyword +hi def link logtalkKeyword Keyword - HiLink logtalkBuiltIn Keyword - HiLink logtalkBuiltInMethod Keyword +hi def link logtalkBuiltIn Keyword +hi def link logtalkBuiltInMethod Keyword - HiLink logtalkOperator Operator +hi def link logtalkOperator Operator - HiLink logtalkExtCall Normal - HiLink logtalkExtCallTag Operator +hi def link logtalkExtCall Normal +hi def link logtalkExtCallTag Operator - HiLink logtalkVariable Identifier +hi def link logtalkVariable Identifier - delcommand HiLink - -endif let b:current_syntax = "logtalk" diff --git a/runtime/syntax/lotos.vim b/runtime/syntax/lotos.vim index 3cd83c4d86..8262e1d9ef 100644 --- a/runtime/syntax/lotos.vim +++ b/runtime/syntax/lotos.vim @@ -7,11 +7,8 @@ " I'm not sure I understand all of the syntax highlight language, " but this file seems to do the job for standard LOTOS. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -56,26 +53,16 @@ syn keyword lotosType using syn sync lines=250 " 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_lotos_syntax_inits") - if version < 508 - let did_lotos_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink lotosStatement Statement - HiLink lotosProcess Label - HiLink lotosOperator Operator - HiLink lotosSort Function - HiLink lotosType Type - HiLink lotosComment Comment - HiLink lotosDelimiter String +hi def link lotosStatement Statement +hi def link lotosProcess Label +hi def link lotosOperator Operator +hi def link lotosSort Function +hi def link lotosType Type +hi def link lotosComment Comment +hi def link lotosDelimiter String - delcommand HiLink -endif let b:current_syntax = "lotos" diff --git a/runtime/syntax/lout.vim b/runtime/syntax/lout.vim index 9a34328ac3..30c87fce51 100644 --- a/runtime/syntax/lout.vim +++ b/runtime/syntax/lout.vim @@ -16,11 +16,8 @@ " See the discussion at http://thread.gmane.org/gmane.editors.vim.devel/32151 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -36,11 +33,7 @@ syn sync lines=1000 " Characters allowed in keywords " I don't know if 128-255 are allowed in ANS-FORHT -if version >= 600 - setlocal iskeyword=@,48-57,.,@-@,_,192-255 -else - set iskeyword=@,48-57,.,@-@,_,192-255 -endif +setlocal iskeyword=@,48-57,.,@-@,_,192-255 " Some special keywords syn keyword loutTodo contained TODO lout Lout LOUT @@ -106,44 +99,33 @@ syn region loutBoldItalic matchgroup=loutBIBraces start='@BI\s*{' matchgroup=lou syn region loutHeadings matchgroup=loutHeads start='@\(\(Title\)\|\(Caption\)\)\s*{' matchgroup=loutHeads end='}' contains=ALLBUT,loutBraceError " 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_lout_syn_inits") - if version < 508 - let did_lout_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overrriden later. - HiLink loutTodo Todo - HiLink loutDefine Define - HiLink loutEOmlDef Define - HiLink loutFunction Function - HiLink loutBraceError Error - HiLink loutNULL Special - HiLink loutComment Comment - HiLink loutSpecial Special - HiLink loutSymbols Character - HiLink loutInclude Include - HiLink loutKeyword Keyword - HiLink loutTag Tag - HiLink loutMath Number - - " HiLink Not really needed here, but I think it is more consistent. - HiLink loutMBraces loutMath - hi loutItalic term=italic cterm=italic gui=italic - HiLink loutIBraces loutItalic - hi loutBold term=bold cterm=bold gui=bold - HiLink loutBBraces loutBold - hi loutBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic - HiLink loutBIBraces loutBoldItalic - hi loutHeadings term=bold cterm=bold guifg=indianred - HiLink loutHeads loutHeadings - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overrriden later. +hi def link loutTodo Todo +hi def link loutDefine Define +hi def link loutEOmlDef Define +hi def link loutFunction Function +hi def link loutBraceError Error +hi def link loutNULL Special +hi def link loutComment Comment +hi def link loutSpecial Special +hi def link loutSymbols Character +hi def link loutInclude Include +hi def link loutKeyword Keyword +hi def link loutTag Tag +hi def link loutMath Number + +hi def link loutMBraces loutMath +hi loutItalic term=italic cterm=italic gui=italic +hi def link loutIBraces loutItalic +hi loutBold term=bold cterm=bold gui=bold +hi def link loutBBraces loutBold +hi loutBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic +hi def link loutBIBraces loutBoldItalic +hi loutHeadings term=bold cterm=bold guifg=indianred +hi def link loutHeads loutHeadings + let b:current_syntax = "lout" diff --git a/runtime/syntax/lpc.vim b/runtime/syntax/lpc.vim index e948f3d70c..7d85fce8e2 100644 --- a/runtime/syntax/lpc.vim +++ b/runtime/syntax/lpc.vim @@ -2,18 +2,15 @@ " Language: LPC " Maintainer: Shizhu Pan <poet@mudbuilder.net> " URL: http://poet.tomud.com/pub/lpc.vim.bz2 -" Last Change: 2011 Dec 10 by Thilo Six +" Last Change: 2016 Aug 31 " Comments: If you are using Vim 6.2 or later, see :h lpc.vim for " file type recognizing, if not, you had to use modeline. " Nodule: This is the start nodule. {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -360,94 +357,84 @@ endif " Nodule: Highlight links {{{1 " 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_lpc_syn_inits") - if version < 508 - let did_lpc_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link lpcModifier lpcStorageClass + +hi def link lpcQuotedFmt lpcFormat +hi def link lpcFormat lpcSpecial +hi def link lpcCppString lpcString " Cpp means + " C Pre-Processor +hi def link lpcCommentL lpcComment +hi def link lpcCommentStart lpcComment +hi def link lpcUserLabel lpcLabel +hi def link lpcSpecialCharacter lpcSpecial +hi def link lpcOctal lpcPreProc +hi def link lpcOctalZero lpcSpecial " LPC will treat octal numbers + " as decimals, programmers should + " be aware of that. +hi def link lpcEfunError lpcError +hi def link lpcKeywdError lpcError +hi def link lpcOctalError lpcError +hi def link lpcParenError lpcError +hi def link lpcErrInParen lpcError +hi def link lpcErrInBracket lpcError +hi def link lpcCommentError lpcError +hi def link lpcCommentStartError lpcError +hi def link lpcSpaceError lpcError +hi def link lpcSpecialError lpcError +hi def link lpcErrFunc lpcError - HiLink lpcModifier lpcStorageClass - - HiLink lpcQuotedFmt lpcFormat - HiLink lpcFormat lpcSpecial - HiLink lpcCppString lpcString " Cpp means - " C Pre-Processor - HiLink lpcCommentL lpcComment - HiLink lpcCommentStart lpcComment - HiLink lpcUserLabel lpcLabel - HiLink lpcSpecialCharacter lpcSpecial - HiLink lpcOctal lpcPreProc - HiLink lpcOctalZero lpcSpecial " LPC will treat octal numbers - " as decimals, programmers should - " be aware of that. - HiLink lpcEfunError lpcError - HiLink lpcKeywdError lpcError - HiLink lpcOctalError lpcError - HiLink lpcParenError lpcError - HiLink lpcErrInParen lpcError - HiLink lpcErrInBracket lpcError - HiLink lpcCommentError lpcError - HiLink lpcCommentStartError lpcError - HiLink lpcSpaceError lpcError - HiLink lpcSpecialError lpcError - HiLink lpcErrFunc lpcError - - if exists("lpc_pre_v22") - HiLink lpcOldEfuns lpc_efuns - HiLink lpcNewEfuns lpcError - else - HiLink lpcOldEfuns lpcReserved - HiLink lpcNewEfuns lpc_efuns - endif - HiLink lpc_efuns lpcFunction - - HiLink lpcReserved lpcPreProc - HiLink lpcTextString lpcString " This should be preprocessors, but - HiLink lpcArrayString lpcPreProc " let's make some difference - " between text and array - - HiLink lpcIncluded lpcString - HiLink lpcCommentString lpcString - HiLink lpcComment2String lpcString - HiLink lpcCommentSkip lpcComment - HiLink lpcCommentFunc lpcComment - - HiLink lpcCppSkip lpcCppOut - HiLink lpcCppOut2 lpcCppOut - HiLink lpcCppOut lpcComment - - " Standard type below - HiLink lpcApplies Special - HiLink lpcCharacter Character - HiLink lpcComment Comment - HiLink lpcConditional Conditional - HiLink lpcConstant Constant - HiLink lpcDefine Macro - HiLink lpcError Error - HiLink lpcFloat Float - HiLink lpcFunction Function - HiLink lpcIdentifier Identifier - HiLink lpcInclude Include - HiLink lpcLabel Label - HiLink lpcNumber Number - HiLink lpcOperator Operator - HiLink lpcPreCondit PreCondit - HiLink lpcPreProc PreProc - HiLink lpcRepeat Repeat - HiLink lpcStatement Statement - HiLink lpcStorageClass StorageClass - HiLink lpcString String - HiLink lpcStructure Structure - HiLink lpcSpecial LineNr - HiLink lpcTodo Todo - HiLink lpcType Type - - delcommand HiLink +if exists("lpc_pre_v22") + hi def link lpcOldEfuns lpc_efuns + hi def link lpcNewEfuns lpcError +else + hi def link lpcOldEfuns lpcReserved + hi def link lpcNewEfuns lpc_efuns endif +hi def link lpc_efuns lpcFunction + +hi def link lpcReserved lpcPreProc +hi def link lpcTextString lpcString " This should be preprocessors, but +hi def link lpcArrayString lpcPreProc " let's make some difference + " between text and array + +hi def link lpcIncluded lpcString +hi def link lpcCommentString lpcString +hi def link lpcComment2String lpcString +hi def link lpcCommentSkip lpcComment +hi def link lpcCommentFunc lpcComment + +hi def link lpcCppSkip lpcCppOut +hi def link lpcCppOut2 lpcCppOut +hi def link lpcCppOut lpcComment + +" Standard type below +hi def link lpcApplies Special +hi def link lpcCharacter Character +hi def link lpcComment Comment +hi def link lpcConditional Conditional +hi def link lpcConstant Constant +hi def link lpcDefine Macro +hi def link lpcError Error +hi def link lpcFloat Float +hi def link lpcFunction Function +hi def link lpcIdentifier Identifier +hi def link lpcInclude Include +hi def link lpcLabel Label +hi def link lpcNumber Number +hi def link lpcOperator Operator +hi def link lpcPreCondit PreCondit +hi def link lpcPreProc PreProc +hi def link lpcRepeat Repeat +hi def link lpcStatement Statement +hi def link lpcStorageClass StorageClass +hi def link lpcString String +hi def link lpcStructure Structure +hi def link lpcSpecial LineNr +hi def link lpcTodo Todo +hi def link lpcType Type + " Nodule: This is the end nodule. {{{1 diff --git a/runtime/syntax/lprolog.vim b/runtime/syntax/lprolog.vim index 086c00fd5d..85c3537fed 100644 --- a/runtime/syntax/lprolog.vim +++ b/runtime/syntax/lprolog.vim @@ -7,11 +7,8 @@ " 2001 Apr 26 - Upgraded for new Vim version " 2000 Jun 5 - Initial release -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -96,41 +93,31 @@ syn sync maxlines=500 " 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_lprolog_syntax_inits") - if version < 508 - let did_lprolog_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink lprologComment Comment - HiLink lprologTodo Todo - - HiLink lprologKeyword Keyword - HiLink lprologSpecial Special - HiLink lprologOperator Operator - HiLink lprologIdentifier Normal - - HiLink lprologInteger Number - HiLink lprologReal Number - HiLink lprologString String - - HiLink lprologCommentErr Error - HiLink lprologBrackErr Error - HiLink lprologParenErr Error - - HiLink lprologModuleName Special - HiLink lprologTypeName Identifier - - HiLink lprologVariable Keyword - HiLink lprologAtom Normal - HiLink lprologClause Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link lprologComment Comment +hi def link lprologTodo Todo + +hi def link lprologKeyword Keyword +hi def link lprologSpecial Special +hi def link lprologOperator Operator +hi def link lprologIdentifier Normal + +hi def link lprologInteger Number +hi def link lprologReal Number +hi def link lprologString String + +hi def link lprologCommentErr Error +hi def link lprologBrackErr Error +hi def link lprologParenErr Error + +hi def link lprologModuleName Special +hi def link lprologTypeName Identifier + +hi def link lprologVariable Keyword +hi def link lprologAtom Normal +hi def link lprologClause Type + let b:current_syntax = "lprolog" diff --git a/runtime/syntax/lscript.vim b/runtime/syntax/lscript.vim index 648a0ebeab..3c4a0fffda 100644 --- a/runtime/syntax/lscript.vim +++ b/runtime/syntax/lscript.vim @@ -9,11 +9,8 @@ " and b) I'm not so crash hot at LotusScript either. If you see any problems " feel free to email me with them. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -179,34 +176,24 @@ syn region lscriptLineNumber start="^\d" end="\s" syn match lscriptTypeSpecifier "[a-zA-Z0-9][\$%&!#]"ms=s+1 " 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_lscript_syntax_inits") - if version < 508 - let did_lscript_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - hi lscriptNotesType term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold - - HiLink lscriptNotesConst lscriptNotesType - HiLink lscriptLineNumber Comment - HiLink lscriptDatatype Type - HiLink lscriptNumber Number - HiLink lscriptError Error - HiLink lscriptStatement Statement - HiLink lscriptString String - HiLink lscriptComment Comment - HiLink lscriptTodo Todo - HiLink lscriptFunction Identifier - HiLink lscriptMethods PreProc - HiLink lscriptEvents Special - HiLink lscriptTypeSpecifier Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi lscriptNotesType term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold + +hi def link lscriptNotesConst lscriptNotesType +hi def link lscriptLineNumber Comment +hi def link lscriptDatatype Type +hi def link lscriptNumber Number +hi def link lscriptError Error +hi def link lscriptStatement Statement +hi def link lscriptString String +hi def link lscriptComment Comment +hi def link lscriptTodo Todo +hi def link lscriptFunction Identifier +hi def link lscriptMethods PreProc +hi def link lscriptEvents Special +hi def link lscriptTypeSpecifier Type + let b:current_syntax = "lscript" diff --git a/runtime/syntax/lss.vim b/runtime/syntax/lss.vim index 6620707f92..6ee717bcb4 100644 --- a/runtime/syntax/lss.vim +++ b/runtime/syntax/lss.vim @@ -3,11 +3,8 @@ " Maintainer: Scott Bigham <dsb@killerbunnies.org> " Last Change: 2004 Oct 06 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -70,64 +67,57 @@ syn case match syn match lssComment "#.*$" " 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_lss_syntax_inits") - if version < 508 - let did_lss_syntax_inits = 1 - endif - - hi def link lssComment Comment - hi def link lssElement Identifier - - hi def lssBold term=bold cterm=bold - hi def lssReverse term=reverse cterm=reverse - hi def lssUnderline term=underline cterm=underline - hi def lssStandout term=standout cterm=standout - - hi def lssRedFg ctermfg=red - hi def lssBlueFg ctermfg=blue - hi def lssGreenFg ctermfg=green - hi def lssBrownFg ctermfg=brown - hi def lssMagentaFg ctermfg=magenta - hi def lssCyanFg ctermfg=cyan - hi def lssGrayFg ctermfg=gray - if $COLORTERM == "rxvt" - " On rxvt's, bright colors are activated by setting the bold attribute. - hi def lssLightgrayFg ctermfg=gray cterm=bold - hi def lssBrightredFg ctermfg=red cterm=bold - hi def lssBrightgreenFg ctermfg=green cterm=bold - hi def lssYellowFg ctermfg=yellow cterm=bold - hi def lssBrightblueFg ctermfg=blue cterm=bold - hi def lssBrightmagentaFg ctermfg=magenta cterm=bold - hi def lssBrightcyanFg ctermfg=cyan cterm=bold - else - hi def lssLightgrayFg ctermfg=lightgray - hi def lssBrightredFg ctermfg=lightred - hi def lssBrightgreenFg ctermfg=lightgreen - hi def lssYellowFg ctermfg=yellow - hi def lssBrightblueFg ctermfg=lightblue - hi def lssBrightmagentaFg ctermfg=lightmagenta - hi def lssBrightcyanFg ctermfg=lightcyan - endif - - hi def lssRedBg ctermbg=red - hi def lssBlueBg ctermbg=blue - hi def lssGreenBg ctermbg=green - hi def lssBrownBg ctermbg=brown - hi def lssMagentaBg ctermbg=magenta - hi def lssCyanBg ctermbg=cyan - hi def lssLightgrayBg ctermbg=lightgray - hi def lssGrayBg ctermbg=gray - hi def lssBrightredBg ctermbg=lightred - hi def lssBrightgreenBg ctermbg=lightgreen - hi def lssYellowBg ctermbg=yellow - hi def lssBrightblueBg ctermbg=lightblue - hi def lssBrightmagentaBg ctermbg=lightmagenta - hi def lssBrightcyanBg ctermbg=lightcyan - hi def lssWhiteBg ctermbg=white ctermfg=black +" Only when an item doesn't have highlighting yet +hi def link lssComment Comment +hi def link lssElement Identifier + +hi def lssBold term=bold cterm=bold +hi def lssReverse term=reverse cterm=reverse +hi def lssUnderline term=underline cterm=underline +hi def lssStandout term=standout cterm=standout + +hi def lssRedFg ctermfg=red +hi def lssBlueFg ctermfg=blue +hi def lssGreenFg ctermfg=green +hi def lssBrownFg ctermfg=brown +hi def lssMagentaFg ctermfg=magenta +hi def lssCyanFg ctermfg=cyan +hi def lssGrayFg ctermfg=gray +if $COLORTERM == "rxvt" + " On rxvt's, bright colors are activated by setting the bold attribute. + hi def lssLightgrayFg ctermfg=gray cterm=bold + hi def lssBrightredFg ctermfg=red cterm=bold + hi def lssBrightgreenFg ctermfg=green cterm=bold + hi def lssYellowFg ctermfg=yellow cterm=bold + hi def lssBrightblueFg ctermfg=blue cterm=bold + hi def lssBrightmagentaFg ctermfg=magenta cterm=bold + hi def lssBrightcyanFg ctermfg=cyan cterm=bold +else + hi def lssLightgrayFg ctermfg=lightgray + hi def lssBrightredFg ctermfg=lightred + hi def lssBrightgreenFg ctermfg=lightgreen + hi def lssYellowFg ctermfg=yellow + hi def lssBrightblueFg ctermfg=lightblue + hi def lssBrightmagentaFg ctermfg=lightmagenta + hi def lssBrightcyanFg ctermfg=lightcyan endif +hi def lssRedBg ctermbg=red +hi def lssBlueBg ctermbg=blue +hi def lssGreenBg ctermbg=green +hi def lssBrownBg ctermbg=brown +hi def lssMagentaBg ctermbg=magenta +hi def lssCyanBg ctermbg=cyan +hi def lssLightgrayBg ctermbg=lightgray +hi def lssGrayBg ctermbg=gray +hi def lssBrightredBg ctermbg=lightred +hi def lssBrightgreenBg ctermbg=lightgreen +hi def lssYellowBg ctermbg=yellow +hi def lssBrightblueBg ctermbg=lightblue +hi def lssBrightmagentaBg ctermbg=lightmagenta +hi def lssBrightcyanBg ctermbg=lightcyan +hi def lssWhiteBg ctermbg=white ctermfg=black + let b:current_syntax = "lss" " vim: ts=8 diff --git a/runtime/syntax/lua.vim b/runtime/syntax/lua.vim index 3ff80b1ebe..f313c14e7a 100644 --- a/runtime/syntax/lua.vim +++ b/runtime/syntax/lua.vim @@ -7,11 +7,8 @@ " lua_subversion = 0 (4.0, 5.0) or 1 (5.1) or 2 (5.2) " default 5.2 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -325,40 +322,30 @@ elseif lua_version == 5 endif " 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_lua_syntax_inits") - if version < 508 - let did_lua_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink luaStatement Statement - HiLink luaRepeat Repeat - HiLink luaFor Repeat - HiLink luaString String - HiLink luaString2 String - HiLink luaNumber Number - HiLink luaOperator Operator - HiLink luaIn Operator - HiLink luaConstant Constant - HiLink luaCond Conditional - HiLink luaElse Conditional - HiLink luaFunction Function - HiLink luaComment Comment - HiLink luaTodo Todo - HiLink luaTable Structure - HiLink luaError Error - HiLink luaParenError Error - HiLink luaBraceError Error - HiLink luaSpecial SpecialChar - HiLink luaFunc Identifier - HiLink luaLabel Label +hi def link luaStatement Statement +hi def link luaRepeat Repeat +hi def link luaFor Repeat +hi def link luaString String +hi def link luaString2 String +hi def link luaNumber Number +hi def link luaOperator Operator +hi def link luaIn Operator +hi def link luaConstant Constant +hi def link luaCond Conditional +hi def link luaElse Conditional +hi def link luaFunction Function +hi def link luaComment Comment +hi def link luaTodo Todo +hi def link luaTable Structure +hi def link luaError Error +hi def link luaParenError Error +hi def link luaBraceError Error +hi def link luaSpecial SpecialChar +hi def link luaFunc Identifier +hi def link luaLabel Label - delcommand HiLink -endif let b:current_syntax = "lua" diff --git a/runtime/syntax/m4.vim b/runtime/syntax/m4.vim index ba7a294d14..6f229ea1ab 100644 --- a/runtime/syntax/m4.vim +++ b/runtime/syntax/m4.vim @@ -8,15 +8,12 @@ " capital letters and have at least one argument (i.e. the '(' " must be there). Let me know if this is a problem. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded +" quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") - finish -endif -" we define it here so that included files can test for it + if exists("b:current_syntax") + finish + endif + " we define it here so that included files can test for it let main_syntax='m4' endif @@ -39,30 +36,20 @@ syn region m4String start="`" end="'" contained contains=@m4Top,@m4StringConte syn cluster m4Top contains=m4Comment,m4Constants,m4Special,m4Variable,m4String,m4Paren,m4Command,m4Statement,m4Function " 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_m4_syn_inits") - if version < 508 - let did_m4_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink m4Delimiter Delimiter - HiLink m4Comment Comment - HiLink m4Function Function - HiLink m4Keyword Keyword - HiLink m4Special Special - HiLink m4String String - HiLink m4Statement Statement - HiLink m4Preproc PreProc - HiLink m4Type Type - HiLink m4Special Special - HiLink m4Variable Special - HiLink m4Constants Constant - HiLink m4Builtin Statement - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link m4Delimiter Delimiter +hi def link m4Comment Comment +hi def link m4Function Function +hi def link m4Keyword Keyword +hi def link m4Special Special +hi def link m4String String +hi def link m4Statement Statement +hi def link m4Preproc PreProc +hi def link m4Type Type +hi def link m4Special Special +hi def link m4Variable Special +hi def link m4Constants Constant +hi def link m4Builtin Statement let b:current_syntax = "m4" diff --git a/runtime/syntax/mailaliases.vim b/runtime/syntax/mailaliases.vim index 743068f66f..a5282aa074 100644 --- a/runtime/syntax/mailaliases.vim +++ b/runtime/syntax/mailaliases.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: aliases(5) local alias database file -" Maintainer: Nikolai Weibull <nikolai@bitwi.se> -" Latest Revision: 2008-04-14 +" Language: aliases(5) local alias database file +" Previous Maintainer: Nikolai Weibull <nikolai@bitwi.se> +" Latest Revision: 2008-04-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim index 6fd46aaa54..7072bab988 100644 --- a/runtime/syntax/make.vim +++ b/runtime/syntax/make.vim @@ -2,13 +2,10 @@ " Language: Makefile " Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/make.vim -" Last Change: 2012 Oct 05 +" Last Change: 2015 Feb 28 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -43,8 +40,8 @@ syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent,makeSString,makeDString syn match makeIdent "\$\$\w*" syn match makeIdent "\$[^({]" -syn match makeIdent "^ *\a\w*\s*[:+?!*]="me=e-2 -syn match makeIdent "^ *\a\w*\s*="me=e-1 +syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2 +syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1 syn match makeIdent "%" " Makefile.in variables @@ -55,11 +52,11 @@ syn match makeConfig "@[A-Za-z0-9_]\+@" syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 nextgroup=makeSource syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 nextgroup=makeSource -syn region makeTarget transparent matchgroup=makeTarget start="^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands -syn match makeTarget "^[A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget skipnl nextgroup=makeCommands,makeCommandError +syn region makeTarget transparent matchgroup=makeTarget start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands +syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget,makeComment skipnl nextgroup=makeCommands,makeCommandError -syn region makeSpecTarget transparent matchgroup=makeSpecTarget start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands -syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" contains=makeIdent skipnl nextgroup=makeCommands,makeCommandError +syn region makeSpecTarget transparent matchgroup=makeSpecTarget start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands +syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" contains=makeIdent,makeComment skipnl nextgroup=makeCommands,makeCommandError syn match makeCommandError "^\s\+\S.*" contained syn region makeCommands start=";"hs=s+1 start="^\t" end="^[^\t#]"me=e-1,re=e-1 end="^$" contained contains=makeCmdNextLine,makeSpecial,makeComment,makeIdent,makePreCondit,makeDefine,makeDString,makeSString nextgroup=makeCommandError @@ -101,40 +98,30 @@ syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Z syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}\s*$" " 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_make_syn_inits") - if version < 508 - let did_make_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink makeNextLine makeSpecial - HiLink makeCmdNextLine makeSpecial - HiLink makeSpecTarget Statement - if !exists("make_no_commands") - HiLink makeCommands Number - endif - HiLink makeImplicit Function - HiLink makeTarget Function - HiLink makeInclude Include - HiLink makePreCondit PreCondit - HiLink makeStatement Statement - HiLink makeIdent Identifier - HiLink makeSpecial Special - HiLink makeComment Comment - HiLink makeDString String - HiLink makeSString String - HiLink makeBString Function - HiLink makeError Error - HiLink makeTodo Todo - HiLink makeDefine Define - HiLink makeCommandError Error - HiLink makeConfig PreCondit - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link makeNextLine makeSpecial +hi def link makeCmdNextLine makeSpecial +hi def link makeSpecTarget Statement +if !exists("make_no_commands") +hi def link makeCommands Number endif +hi def link makeImplicit Function +hi def link makeTarget Function +hi def link makeInclude Include +hi def link makePreCondit PreCondit +hi def link makeStatement Statement +hi def link makeIdent Identifier +hi def link makeSpecial Special +hi def link makeComment Comment +hi def link makeDString String +hi def link makeSString String +hi def link makeBString Function +hi def link makeError Error +hi def link makeTodo Todo +hi def link makeDefine Define +hi def link makeCommandError Error +hi def link makeConfig PreCondit let b:current_syntax = "make" diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim index 4172a02fe1..77675c5d2f 100644 --- a/runtime/syntax/man.vim +++ b/runtime/syntax/man.vim @@ -3,32 +3,25 @@ " Maintainer: SungHyun Nam <goweol@gmail.com> " Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> " Version Info: -" Last Change: 2008 Sep 17 +" Last Change: 2015 Nov 24 " Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>: " * manSubHeading " * manSynopsis (only for sections 2 and 3) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Get the CTRL-H syntax to handle backspaced text -if version >= 600 - runtime! syntax/ctrlh.vim -else - source <sfile>:p:h/ctrlh.vim -endif +runtime! syntax/ctrlh.vim syn case ignore syn match manReference "\f\+([1-9][a-z]\=)" syn match manTitle "^\f\+([0-9]\+[a-z]\=).*" -syn match manSectionHeading "^[a-z][a-z ]*[a-z]$" -syn match manSubHeading "^\s\{3\}[a-z][a-z ]*[a-z]$" +syn match manSectionHeading "^[a-z][a-z -]*[a-z]$" +syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$" syn match manOptionDesc "^\s*[+-][a-z0-9]\S*" syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*" " syn match manHistory "^[a-z].*last change.*$" @@ -41,26 +34,16 @@ endif " 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_man_syn_inits") - if version < 508 - let did_man_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink manTitle Title - HiLink manSectionHeading Statement - HiLink manOptionDesc Constant - HiLink manLongOptionDesc Constant - HiLink manReference PreProc - HiLink manSubHeading Function - HiLink manCFuncDefinition Function +hi def link manTitle Title +hi def link manSectionHeading Statement +hi def link manOptionDesc Constant +hi def link manLongOptionDesc Constant +hi def link manReference PreProc +hi def link manSubHeading Function +hi def link manCFuncDefinition Function - delcommand HiLink -endif let b:current_syntax = "man" diff --git a/runtime/syntax/manconf.vim b/runtime/syntax/manconf.vim index 90ecc8ec17..2c17568d87 100644 --- a/runtime/syntax/manconf.vim +++ b/runtime/syntax/manconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: man.conf(5) - man configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: man.conf(5) - man configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/manual.vim b/runtime/syntax/manual.vim index 5ea373180a..c0e53fa7b4 100644 --- a/runtime/syntax/manual.vim +++ b/runtime/syntax/manual.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2008 Jan 26 +" Last Change: 2016 Feb 01 " This file is used for ":syntax manual". " It installs the Syntax autocommands, but no the FileType autocommands. @@ -16,10 +16,11 @@ endif let syntax_manual = 1 -" Remove the connection between FileType and Syntax autocommands. -if exists('#syntaxset') - au! syntaxset FileType -endif +" Overrule the connection between FileType and Syntax autocommands. This sets +" the syntax when the file type is detected, without changing the value. +augroup syntaxset + au! FileType * exe "set syntax=" . &syntax +augroup END " If the GUI is already running, may still need to install the FileType menu. " Don't do it when the 'M' flag is included in 'guioptions'. diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim index b6e4ae9243..1261ff5a47 100644 --- a/runtime/syntax/maple.vim +++ b/runtime/syntax/maple.vim @@ -1,9 +1,9 @@ " Vim syntax file " Language: Maple V (based on release 4) -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Jan 05, 2010 -" Version: 10 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 15 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE " " Package Function Selection: {{{1 " Because there are a lot of packages, and because of the potential for namespace @@ -21,19 +21,16 @@ " but only the contents of packages of Maple V Release 4, and the top-level " routines of Release 4. <Jacques Carette - carette@mcmaster.ca> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Iskeyword Effects: {{{1 -if version < 600 - set iskeyword=$,48-57,_,a-z,@-Z +if !has("patch-7.4.1142") + setl isk=$,48-57,_,a-z,@-Z else - setlocal iskeyword=$,48-57,_,a-z,@-Z + syn iskeyword $,48-57,_,a-z,@-Z endif " Package Selection: {{{1 @@ -551,81 +548,73 @@ endif " ===================================================================== " Highlighting: Define the default highlighting. {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_maplev_syntax_inits") - if version < 508 - let did_maplev_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet +if !exists("skip_maplev_syntax_inits") " Maple->Maple Links {{{2 - HiLink mvBraceError mvError - HiLink mvCurlyError mvError - HiLink mvDebug mvTodo - HiLink mvParenError mvError - HiLink mvPkg_DEtools mvPkgFunc - HiLink mvPkg_Galois mvPkgFunc - HiLink mvPkg_GaussInt mvPkgFunc - HiLink mvPkg_LREtools mvPkgFunc - HiLink mvPkg_combinat mvPkgFunc - HiLink mvPkg_combstruct mvPkgFunc - HiLink mvPkg_difforms mvPkgFunc - HiLink mvPkg_finance mvPkgFunc - HiLink mvPkg_genfunc mvPkgFunc - HiLink mvPkg_geometry mvPkgFunc - HiLink mvPkg_grobner mvPkgFunc - HiLink mvPkg_group mvPkgFunc - HiLink mvPkg_inttrans mvPkgFunc - HiLink mvPkg_liesymm mvPkgFunc - HiLink mvPkg_linalg mvPkgFunc - HiLink mvPkg_logic mvPkgFunc - HiLink mvPkg_networks mvPkgFunc - HiLink mvPkg_numapprox mvPkgFunc - HiLink mvPkg_numtheory mvPkgFunc - HiLink mvPkg_orthopoly mvPkgFunc - HiLink mvPkg_padic mvPkgFunc - HiLink mvPkg_plots mvPkgFunc - HiLink mvPkg_plottools mvPkgFunc - HiLink mvPkg_powseries mvPkgFunc - HiLink mvPkg_process mvPkgFunc - HiLink mvPkg_simplex mvPkgFunc - HiLink mvPkg_stats mvPkgFunc - HiLink mvPkg_student mvPkgFunc - HiLink mvPkg_sumtools mvPkgFunc - HiLink mvPkg_tensor mvPkgFunc - HiLink mvPkg_totorder mvPkgFunc - HiLink mvRange mvOper - HiLink mvSemiError mvError - HiLink mvDelim Delimiter + hi def link mvBraceError mvError + hi def link mvCurlyError mvError + hi def link mvDebug mvTodo + hi def link mvParenError mvError + hi def link mvPkg_DEtools mvPkgFunc + hi def link mvPkg_Galois mvPkgFunc + hi def link mvPkg_GaussInt mvPkgFunc + hi def link mvPkg_LREtools mvPkgFunc + hi def link mvPkg_combinat mvPkgFunc + hi def link mvPkg_combstruct mvPkgFunc + hi def link mvPkg_difforms mvPkgFunc + hi def link mvPkg_finance mvPkgFunc + hi def link mvPkg_genfunc mvPkgFunc + hi def link mvPkg_geometry mvPkgFunc + hi def link mvPkg_grobner mvPkgFunc + hi def link mvPkg_group mvPkgFunc + hi def link mvPkg_inttrans mvPkgFunc + hi def link mvPkg_liesymm mvPkgFunc + hi def link mvPkg_linalg mvPkgFunc + hi def link mvPkg_logic mvPkgFunc + hi def link mvPkg_networks mvPkgFunc + hi def link mvPkg_numapprox mvPkgFunc + hi def link mvPkg_numtheory mvPkgFunc + hi def link mvPkg_orthopoly mvPkgFunc + hi def link mvPkg_padic mvPkgFunc + hi def link mvPkg_plots mvPkgFunc + hi def link mvPkg_plottools mvPkgFunc + hi def link mvPkg_powseries mvPkgFunc + hi def link mvPkg_process mvPkgFunc + hi def link mvPkg_simplex mvPkgFunc + hi def link mvPkg_stats mvPkgFunc + hi def link mvPkg_student mvPkgFunc + hi def link mvPkg_sumtools mvPkgFunc + hi def link mvPkg_tensor mvPkgFunc + hi def link mvPkg_totorder mvPkgFunc + hi def link mvRange mvOper + hi def link mvSemiError mvError + hi def link mvDelim Delimiter " Maple->Standard Links {{{2 - HiLink mvAssign Delimiter - HiLink mvBool Boolean - HiLink mvComma Delimiter - HiLink mvComment Comment - HiLink mvCond Conditional - HiLink mvConstant Number - HiLink mvDelayEval Label - HiLink mvDcolon Delimiter - HiLink mvError Error - HiLink mvLibrary Statement - HiLink mvNumber Number - HiLink mvOper Operator - HiLink mvAssign Delimiter - HiLink mvPackage Type - HiLink mvPkgFunc Function - HiLink mvPktOption Special - HiLink mvRepeat Repeat - HiLink mvSpecial Special - HiLink mvStatement Statement - HiLink mvName String - HiLink mvString String - HiLink mvTodo Todo - - delcommand HiLink + hi def link mvAssign Delimiter + hi def link mvBool Boolean + hi def link mvComma Delimiter + hi def link mvComment Comment + hi def link mvCond Conditional + hi def link mvConstant Number + hi def link mvDelayEval Label + hi def link mvDcolon Delimiter + hi def link mvError Error + hi def link mvLibrary Statement + hi def link mvNumber Number + hi def link mvOper Operator + hi def link mvAssign Delimiter + hi def link mvPackage Type + hi def link mvPkgFunc Function + hi def link mvPktOption Special + hi def link mvRepeat Repeat + hi def link mvSpecial Special + hi def link mvStatement Statement + hi def link mvName String + hi def link mvString String + hi def link mvTodo Todo + endif " Current Syntax: {{{1 diff --git a/runtime/syntax/markdown.vim b/runtime/syntax/markdown.vim index 068115e92d..1955a7443e 100644 --- a/runtime/syntax/markdown.vim +++ b/runtime/syntax/markdown.vim @@ -2,7 +2,7 @@ " Language: Markdown " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.markdown -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish @@ -70,29 +70,34 @@ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained -syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart +syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline -syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart -syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart -syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart -syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart +let s:concealends = has('conceal') ? ' concealends' : '' +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends + syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend +syn match markdownFootnote "\[^[^\]]\+\]" +syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" + if main_syntax ==# 'markdown' for s:type in g:markdown_fenced_languages - exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') endfor unlet! s:type endif -syn match markdownEscape "\\[][\\`*_{}()#+.!-]" +syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]" syn match markdownError "\w\@<=_\w\@=" hi def link markdownH1 htmlH1 @@ -108,6 +113,9 @@ hi def link markdownListMarker htmlTagName hi def link markdownBlockquote Comment hi def link markdownRule PreProc +hi def link markdownFootnote Typedef +hi def link markdownFootnoteDefinition Typedef + hi def link markdownLinkText htmlLink hi def link markdownIdDeclaration Typedef hi def link markdownId Type @@ -119,8 +127,11 @@ hi def link markdownUrlDelimiter htmlTag hi def link markdownUrlTitleDelimiter Delimiter hi def link markdownItalic htmlItalic +hi def link markdownItalicDelimiter markdownItalic hi def link markdownBold htmlBold +hi def link markdownBoldDelimiter markdownBold hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownBoldItalicDelimiter markdownBoldItalic hi def link markdownCodeDelimiter Delimiter hi def link markdownEscape Special diff --git a/runtime/syntax/mason.vim b/runtime/syntax/mason.vim index 40bdb0eaa4..6789e11aef 100644 --- a/runtime/syntax/mason.vim +++ b/runtime/syntax/mason.vim @@ -13,12 +13,8 @@ " - Fix <%text> blocks to show HTML tags but ignore Mason tags. " -" Clear previous syntax settings unless this is v6 or above, in which case just -" exit without doing anything. -" -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 @@ -30,22 +26,14 @@ endif " First pull in the HTML syntax. " -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/html.vim +unlet b:current_syntax syn cluster htmlPreproc add=@masonTop " Now pull in the Perl syntax. " -if version < 600 - syn include @perlTop <sfile>:p:h/perl.vim -else - syn include @perlTop syntax/perl.vim -endif +syn include @perlTop syntax/perl.vim " It's hard to reduce down to the correct sub-set of Perl to highlight in some " of these cases so I've taken the safe option of just using perlTop in all of @@ -78,19 +66,7 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs, " Set up default highlighting. Almost all of this is done in the included " syntax files. -" -if version >= 508 || !exists("did_mason_syn_inits") - if version < 508 - let did_mason_syn_inits = 1 - com -nargs=+ HiLink hi link <args> - else - com -nargs=+ HiLink hi def link <args> - endif - - HiLink masonDoc Comment - - delc HiLink -endif +hi def link masonDoc Comment let b:current_syntax = "mason" diff --git a/runtime/syntax/master.vim b/runtime/syntax/master.vim index 40d644eef9..f89c5b2f1c 100644 --- a/runtime/syntax/master.vim +++ b/runtime/syntax/master.vim @@ -8,11 +8,8 @@ " this is a very simple syntax file - I will be improving it " add entire DEFINE syntax -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -28,22 +25,12 @@ syn region masterString start=+'+ end=+'+ syn match masterComment "\$.*" " 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_master_syntax_inits") - if version < 508 - let did_master_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink masterKeyword Keyword - HiLink masterComment Comment - HiLink masterString String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link masterKeyword Keyword +hi def link masterComment Comment +hi def link masterString String + let b:current_syntax = "master" diff --git a/runtime/syntax/matlab.vim b/runtime/syntax/matlab.vim index 3828f3e8a8..5228bb5c43 100644 --- a/runtime/syntax/matlab.vim +++ b/runtime/syntax/matlab.vim @@ -1,18 +1,17 @@ " Vim syntax file " Language: Matlab -" Maintainer: Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com +" Maintainer: Alex Burka <vim@alexburka.com> " Credits: Preben 'Peppe' Guldberg <peppe-vim@wielders.org> +" Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com " Original author: Mario Eusebio -" Last Change: Wed Jan 13 11:12:34 CET 2010 -" sinh added to matlab implicit commands +" Last Change: Mon Jan 23 2017 +" added support for cell mode " Change History: +" - now highlights cell-mode separator comments " - 'global' and 'persistent' keyword are now recognized -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -63,6 +62,7 @@ syn match matlabComment "%.*$" contains=matlabTodo,matlabTab " MT_ADDON - correctly highlights words after '...' as comments syn match matlabComment "\.\.\..*$" contains=matlabTodo,matlabTab syn region matlabMultilineComment start=+%{+ end=+%}+ contains=matlabTodo,matlabTab +syn match matlabCellComment "^%%.*$" syn keyword matlabOperator break zeros default margin round ones rand syn keyword matlabOperator ceil floor size clear zeros eye mean std cov @@ -76,49 +76,40 @@ syn match matlabError "-\=\<\d\+\.\d\+\.[^*/\\^]" syn match matlabError "-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)" " 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_matlab_syntax_inits") - if version < 508 - let did_matlab_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink matlabTransposeOperator matlabOperator - HiLink matlabOperator Operator - HiLink matlabLineContinuation Special - HiLink matlabLabel Label - HiLink matlabConditional Conditional - HiLink matlabExceptions Conditional - HiLink matlabRepeat Repeat - HiLink matlabTodo Todo - HiLink matlabString String - HiLink matlabDelimiter Identifier - HiLink matlabTransposeOther Identifier - HiLink matlabNumber Number - HiLink matlabFloat Float - HiLink matlabFunction Function - HiLink matlabError Error - HiLink matlabImplicit matlabStatement - HiLink matlabStatement Statement - HiLink matlabOO Statement - HiLink matlabSemicolon SpecialChar - HiLink matlabComment Comment - HiLink matlabMultilineComment Comment - HiLink matlabScope Type - - HiLink matlabArithmeticOperator matlabOperator - HiLink matlabRelationalOperator matlabOperator - HiLink matlabLogicalOperator matlabOperator +" Only when an item doesn't have highlighting yet + +hi def link matlabTransposeOperator matlabOperator +hi def link matlabOperator Operator +hi def link matlabLineContinuation Special +hi def link matlabLabel Label +hi def link matlabConditional Conditional +hi def link matlabExceptions Conditional +hi def link matlabRepeat Repeat +hi def link matlabTodo Todo +hi def link matlabString String +hi def link matlabDelimiter Identifier +hi def link matlabTransposeOther Identifier +hi def link matlabNumber Number +hi def link matlabFloat Float +hi def link matlabFunction Function +hi def link matlabError Error +hi def link matlabImplicit matlabStatement +hi def link matlabStatement Statement +hi def link matlabOO Statement +hi def link matlabSemicolon SpecialChar +hi def link matlabComment Comment +hi def link matlabMultilineComment Comment +hi def link matlabCellComment Todo +hi def link matlabScope Type + +hi def link matlabArithmeticOperator matlabOperator +hi def link matlabRelationalOperator matlabOperator +hi def link matlabLogicalOperator matlabOperator "optional highlighting - "HiLink matlabIdentifier Identifier - "HiLink matlabTab Error +"hi def link matlabIdentifier Identifier +"hi def link matlabTab Error - delcommand HiLink -endif let b:current_syntax = "matlab" diff --git a/runtime/syntax/maxima.vim b/runtime/syntax/maxima.vim index 27dcc18842..46e1e4ff84 100644 --- a/runtime/syntax/maxima.vim +++ b/runtime/syntax/maxima.vim @@ -6,11 +6,8 @@ " Adapted mostly from xmath.vim " Number formats adapted from r.vim " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -234,41 +231,31 @@ syn sync match maximaSyncComment grouphere maximaCommentBlock "/*" syn sync match maximaSyncComment groupthere NONE "*/" " 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_maxima_syntax_inits") - if version < 508 - let did_maxima_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink maximaBraceError maximaError - HiLink maximaCmd maximaStatement - HiLink maximaCurlyError maximaError - HiLink maximaFuncCmd maximaStatement - HiLink maximaParenError maximaError +hi def link maximaBraceError maximaError +hi def link maximaCmd maximaStatement +hi def link maximaCurlyError maximaError +hi def link maximaFuncCmd maximaStatement +hi def link maximaParenError maximaError - " The default methods for highlighting. Can be overridden later - HiLink maximaCharacter Character - HiLink maximaComma Function - HiLink maximaCommentBlock Comment - HiLink maximaConditional Conditional - HiLink maximaError Error - HiLink maximaFunc Delimiter - HiLink maximaOp Delimiter - HiLink maximaLabel PreProc - HiLink maximaNumber Number - HiLink maximaFloat Float - HiLink maximaRepeat Repeat - HiLink maximaSpecial Type - HiLink maximaSpecialChar SpecialChar - HiLink maximaStatement Statement - HiLink maximaString String - HiLink maximaTodo Todo +" The default methods for highlighting. Can be overridden later +hi def link maximaCharacter Character +hi def link maximaComma Function +hi def link maximaCommentBlock Comment +hi def link maximaConditional Conditional +hi def link maximaError Error +hi def link maximaFunc Delimiter +hi def link maximaOp Delimiter +hi def link maximaLabel PreProc +hi def link maximaNumber Number +hi def link maximaFloat Float +hi def link maximaRepeat Repeat +hi def link maximaSpecial Type +hi def link maximaSpecialChar SpecialChar +hi def link maximaStatement Statement +hi def link maximaString String +hi def link maximaTodo Todo - delcommand HiLink -endif let b:current_syntax = "maxima" diff --git a/runtime/syntax/mel.vim b/runtime/syntax/mel.vim index dab894865c..f0f1bcafd3 100644 --- a/runtime/syntax/mel.vim +++ b/runtime/syntax/mel.vim @@ -4,11 +4,8 @@ " Last Change: May 27 1999 " Based on: Bram Moolenaar <Bram@vim.org> C syntax file -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -77,45 +74,35 @@ endif exec "sy sync ccomment melComment minlines=" . mel_minlines " 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_mel_syntax_inits") - if version < 508 - let did_mel_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink melBoolean Boolean - HiLink melFunction Function - HiLink melIdentifier Identifier - HiLink melStatement Statement - HiLink melConditional Conditional - HiLink melRepeat Repeat - HiLink melLabel Label - HiLink melOperator Operator - HiLink melKeyword Keyword - HiLink melException Exception - HiLink melInclude Include - HiLink melType Type - HiLink melStorageClass StorageClass - HiLink melDebug Debug - HiLink melTodo Todo - HiLink melCharSpecial SpecialChar - HiLink melString String - HiLink melInteger Number - HiLink melFloat Float - HiLink melMatrixVector Float - HiLink melComment Comment - HiLink melError Error - HiLink melSpaceError melError - HiLink melCharError melError - HiLink melParenError melError - HiLink melInParen melError - HiLink melCommentError melError - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link melBoolean Boolean +hi def link melFunction Function +hi def link melIdentifier Identifier +hi def link melStatement Statement +hi def link melConditional Conditional +hi def link melRepeat Repeat +hi def link melLabel Label +hi def link melOperator Operator +hi def link melKeyword Keyword +hi def link melException Exception +hi def link melInclude Include +hi def link melType Type +hi def link melStorageClass StorageClass +hi def link melDebug Debug +hi def link melTodo Todo +hi def link melCharSpecial SpecialChar +hi def link melString String +hi def link melInteger Number +hi def link melFloat Float +hi def link melMatrixVector Float +hi def link melComment Comment +hi def link melError Error +hi def link melSpaceError melError +hi def link melCharError melError +hi def link melParenError melError +hi def link melInParen melError +hi def link melCommentError melError + let b:current_syntax = "mel" diff --git a/runtime/syntax/messages.vim b/runtime/syntax/messages.vim index 4648e94c13..c22e4e8d0c 100644 --- a/runtime/syntax/messages.vim +++ b/runtime/syntax/messages.vim @@ -3,6 +3,7 @@ " Maintainer: Yakov Lerner <iler.ml@gmail.com> " Latest Revision: 2008-06-29 " Changes: 2008-06-29 support for RFC3339 tuimestamps James Vega +" 2016 Jan 19: messagesDate changed by Bram if exists("b:current_syntax") finish @@ -13,7 +14,7 @@ set cpo&vim syn match messagesBegin display '^' nextgroup=messagesDate,messagesDateRFC3339 -syn match messagesDate contained display '\a\a\a [ 0-9]\d *' +syn match messagesDate contained display '[[:lower:][:upper:]][[:lower:][:upper:]][[:lower:][:upper:]] [ 0-9]\d *' \ nextgroup=messagesHour syn match messagesHour contained display '\d\d:\d\d:\d\d\s*' diff --git a/runtime/syntax/mf.vim b/runtime/syntax/mf.vim index 8bc48fee46..3589e4db3c 100644 --- a/runtime/syntax/mf.vim +++ b/runtime/syntax/mf.vim @@ -1,197 +1,295 @@ " Vim syntax file -" Language: Metafont -" Maintainer: Andreas Scherer <andreas.scherer@pobox.com> -" Last Change: April 25, 2001 - -" 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") +" Language: METAFONT +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com> +" Last Change: 2016 Oct 1 + +if exists("b:current_syntax") finish endif -" Metafont 'primitives' as defined in chapter 25 of 'The METAFONTbook' +syn iskeyword @,_ + +" METAFONT 'primitives' as defined in chapter 25 of 'The METAFONTbook' " Page 210: 'boolean expressions' -syn keyword mfBoolExp true false known unknown odd charexists not and or +syn keyword mfBoolExp and charexists false known not odd or true unknown " Page 210: 'numeric expression' -syn keyword mfNumExp normaldeviate length ASCII oct hex angle turningnumber -syn keyword mfNumExp totalweight directiontime xpart ypart xxpart xypart -syn keyword mfNumExp yxpart yypart sqrt sind cosd mlog mexp floor -syn keyword mfNumExp uniformdeviate +syn keyword mfNumExp ASCII angle cosd directiontime floor hex length +syn keyword mfNumExp mexp mlog normaldeviate oct sind sqrt totalweight +syn keyword mfNumExp turningnumber uniformdeviate xpart xxpart xypart +syn keyword mfNumExp ypart yxpart yypart " Page 211: 'internal quantities' -syn keyword mfInternal tracingtitles tracingequations tracingcapsules -syn keyword mfInternal tracingchoices tracingspecs tracingpens -syn keyword mfInternal tracingcommands tracingrestores tracingmacros -syn keyword mfInternal tracingedges tracingoutput tracingonline tracingstats -syn keyword mfInternal pausing showstopping fontmaking proofing -syn keyword mfInternal turningcheck warningcheck smoothing autorounding -syn keyword mfInternal granularity fillin year month day time -syn keyword mfInternal charcode charext charwd charht chardp charic -syn keyword mfInternal chardx chardy designsize hppp vppp xoffset yoffset -syn keyword mfInternal boundarychar +syn keyword mfInternal autorounding boundarychar charcode chardp chardx +syn keyword mfInternal chardy charext charht charic charwd day designsize +syn keyword mfInternal fillin fontmaking granularity hppp jobname month +syn keyword mfInternal pausing proofing showstopping smoothing time +syn keyword mfInternal tracingcapsules tracingchoices tracingcommands +syn keyword mfInternal tracingedges tracingequations tracingmacros +syn keyword mfInternal tracingonline tracingoutput tracingpens +syn keyword mfInternal tracingrestores tracingspecs tracingstats +syn keyword mfInternal tracingtitles turningcheck vppp warningcheck +syn keyword mfInternal xoffset year yoffset " Page 212: 'pair expressions' -syn keyword mfPairExp point of precontrol postcontrol penoffset rotated -syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled -syn keyword mfPairExp zscaled +syn keyword mfPairExp of penoffset point postcontrol precontrol rotated +syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled +syn keyword mfPairExp zscaled " Page 213: 'path expressions' -syn keyword mfPathExp makepath reverse subpath curl tension atleast -syn keyword mfPathExp controls cycle +syn keyword mfPathExp atleast controls curl cycle makepath reverse +syn keyword mfPathExp subpath tension " Page 214: 'pen expressions' -syn keyword mfPenExp nullpen pencircle makepen +syn keyword mfPenExp makepen nullpen pencircle -" Page 214: 'picutre expressions' -syn keyword mfPicExp nullpicture +" Page 214: 'picture expressions' +syn keyword mfPicExp nullpicture " Page 214: 'string expressions' -syn keyword mfStringExp jobname readstring str char decimal substring +syn keyword mfStringExp char decimal readstring str substring " Page 217: 'commands and statements' -syn keyword mfCommand end dump save interim newinternal randomseed let -syn keyword mfCommand delimiters outer everyjob show showvariable showtoken -syn keyword mfCommand showdependencies showstats message errmessage errhelp -syn keyword mfCommand batchmode nonstopmode scrollmode errorstopmode -syn keyword mfCommand addto also contour doublepath withpen withweight cull -syn keyword mfCommand keeping dropping display inwindow openwindow at from to -syn keyword mfCommand shipout special numspecial +syn keyword mfCommand addto also at batchmode contour cull delimiters +syn keyword mfCommand display doublepath dropping dump end errhelp +syn keyword mfCommand errmessage errorstopmode everyjob from interim +syn keyword mfCommand inwindow keeping let message newinternal +syn keyword mfCommand nonstopmode numspecial openwindow outer randomseed +syn keyword mfCommand save scrollmode shipout show showdependencies +syn keyword mfCommand showstats showtoken showvariable special to withpen +syn keyword mfCommand withweight " Page 56: 'types' -syn keyword mfType boolean numeric pair path pen picture string transform +syn keyword mfType boolean numeric pair path pen picture string +syn keyword mfType transform " Page 155: 'grouping' -syn keyword mfStatement begingroup endgroup +syn keyword mfStatement begingroup endgroup " Page 165: 'definitions' -syn keyword mfDefinition enddef def expr suffix text primary secondary -syn keyword mfDefinition tertiary vardef primarydef secondarydef tertiarydef +syn keyword mfDefinition def enddef expr primary primarydef secondary +syn keyword mfDefinition secondarydef suffix tertiary tertiarydef text +syn keyword mfDefinition vardef " Page 169: 'conditions and loops' -syn keyword mfCondition if fi else elseif endfor for forsuffixes forever -syn keyword mfCondition step until exitif +syn keyword mfCondition else elseif endfor exitif fi for forever +syn keyword mfCondition forsuffixes if step until " Other primitives listed in the index -syn keyword mfPrimitive charlist endinput expandafter extensible -syn keyword mfPrimitive fontdimen headerbyte inner input intersectiontimes -syn keyword mfPrimitive kern ligtable quote scantokens skipto +syn keyword mfPrimitive charlist endinput expandafter extensible fontdimen +syn keyword mfPrimitive headerbyte inner input intersectiontimes kern +syn keyword mfPrimitive ligtable quote scantokens skipto + +" Implicit suffix parameters +syn match mfSuffixParam "@#\|#@\|@" + +" These are just tags, but given their special status, we +" highlight them as variables +syn keyword mfVariable x y " Keywords defined by plain.mf (defined on pp.262-278) -if !exists("plain_mf_macros") - let plain_mf_macros = 1 " Set this to '0' if your source gets too colourful - " metapost.vim does so to turn off Metafont macros +if get(g:, "plain_mf_macros", 1) + syn keyword mfDef addto_currentpicture beginchar capsule_def + syn keyword mfDef change_width clear_pen_memory clearit clearpen + syn keyword mfDef clearxy culldraw cullit cutdraw + syn keyword mfDef define_blacker_pixels define_corrected_pixels + syn keyword mfDef define_good_x_pixels define_good_y_pixels + syn keyword mfDef define_horizontal_corrected_pixels define_pixels + syn keyword mfDef define_whole_blacker_pixels define_whole_pixels + syn keyword mfDef define_whole_vertical_blacker_pixels + syn keyword mfDef define_whole_vertical_pixels downto draw drawdot + syn keyword mfDef endchar erase exitunless fill filldraw fix_units + syn keyword mfDef flex font_coding_scheme font_extra_space + syn keyword mfDef font_identifier font_normal_shrink + syn keyword mfDef font_normal_space font_normal_stretch font_quad + syn keyword mfDef font_size font_slant font_x_height gfcorners gobble + syn keyword mfDef hide imagerules interact italcorr killtext + syn keyword mfDef loggingall lowres_fix makebox makegrid maketicks + syn keyword mfDef mode_def mode_setup nodisplays notransforms numtok + syn keyword mfDef openit penrazor pensquare penstroke pickup + syn keyword mfDef proofoffset proofrule range reflectedabout + syn keyword mfDef rotatedaround screenchars screenrule screenstrokes + syn keyword mfDef shipit showit smode stop superellipse takepower + syn keyword mfDef tracingall tracingnone undraw undrawdot unfill + syn keyword mfDef unfilldraw upto z + syn match mfDef "???" + syn keyword mfVardef bot byte ceiling counterclockwise cutoff decr dir + syn keyword mfVardef direction directionpoint grayfont hround incr + syn keyword mfVardef interpath inverse labelfont labels lft magstep + " Note: nodot is not a vardef, it is used as in makelabel.lft.nodot("5",z5) + " (METAFONT only) + syn keyword mfVardef makelabel max min nodot penlabels penpos + syn keyword mfVardef proofrulethickness round rt savepen slantfont solve + syn keyword mfVardef tensepath titlefont top unitvector vround whatever + syn match mpVardef "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>" + syn keyword mfPrimaryDef div dotprod gobbled mod + syn keyword mfSecondaryDef intersectionpoint + syn keyword mfTertiaryDef softjoin thru + syn keyword mfNewInternal blacker currentwindow displaying eps epsilon + syn keyword mfNewInternal infinity join_radius number_of_modes o_correction + syn keyword mfNewInternal pen_bot pen_lft pen_rt pen_top pixels_per_inch + syn keyword mfNewInternal screen_cols screen_rows tolerance + " Predefined constants + syn keyword mfConstant base_name base_version blankpicture ditto down + syn keyword mfConstant fullcircle halfcircle identity left lowres origin + syn keyword mfConstant penspeck proof quartercircle right rulepen smoke + syn keyword mfConstant unitpixel unitsquare up + " Other predefined variables + syn keyword mfVariable aspect_ratio currentpen extra_beginchar + syn keyword mfVariable extra_endchar currentpen_path currentpicture + syn keyword mfVariable currenttransform d extra_setup h localfont mag mode + syn keyword mfVariable mode_name w + " let statements: + syn keyword mfnumExp abs + syn keyword mfPairExp rotatedabout + syn keyword mfCommand bye relax endif -if plain_mf_macros - syn keyword mfMacro abs addto_currentpicture aspect_ratio base_name - syn keyword mfMacro base_version beginchar blacker blankpicture bot bye byte - syn keyword mfMacro capsule_def ceiling change_width clear_pen_memory clearit - syn keyword mfMacro clearpen clearxy counterclockwise culldraw cullit - syn keyword mfMacro currentpen currentpen_path currentpicture - syn keyword mfMacro currenttransform currentwindow cutdraw cutoff d decr - syn keyword mfMacro define_blacker_pixels define_corrected_pixels - syn keyword mfMacro define_good_x_pixels define_good_y_pixels - syn keyword mfMacro define_horizontal_corrected_pixels define_pixels - syn keyword mfMacro define_whole_blacker_pixels define_whole_pixels - syn keyword mfMacro define_whole_vertical_blacker_pixels - syn keyword mfMacro define_whole_vertical_pixels dir direction directionpoint - syn keyword mfMacro displaying ditto div dotprod down downto draw drawdot - syn keyword mfMacro endchar eps epsilon extra_beginchar extra_endchar - syn keyword mfMacro extra_setup erase exitunless fill filldraw fix_units flex - syn keyword mfMacro font_coding_scheme font_extra_space font_identifier - syn keyword mfMacro font_normal_shrink font_normal_space font_normal_stretch - syn keyword mfMacro font_quad font_setup font_size font_slant font_x_height - syn keyword mfMacro fullcircle generate gfcorners gobble gobbled grayfont h - syn keyword mfMacro halfcircle hide hround identity image_rules incr infinity - syn keyword mfMacro interact interpath intersectionpoint inverse italcorr - syn keyword mfMacro join_radius killtext labelfont labels left lft localfont - syn keyword mfMacro loggingall lowres lowres_fix mag magstep makebox makegrid - syn keyword mfMacro makelabel maketicks max min mod mode mode_def mode_name - syn keyword mfMacro mode_setup nodisplays notransforms number_of_modes numtok - syn keyword mfMacro o_correction openit origin pen_bot pen_lft pen_rt pen_top - syn keyword mfMacro penlabels penpos penrazor penspeck pensquare penstroke - syn keyword mfMacro pickup pixels_per_inch proof proofoffset proofrule - syn keyword mfMacro proofrulethickness quartercircle range reflectedabout - syn keyword mfMacro relax right rotatedabout rotatedaround round rt rulepen - syn keyword mfMacro savepen screenchars screen_rows screen_cols screenrule - syn keyword mfMacro screenstrokes shipit showit slantfont smode smoke softjoin - syn keyword mfMacro solve stop superellipse takepower tensepath titlefont - syn keyword mfMacro tolerance top tracingall tracingnone undraw undrawdot - syn keyword mfMacro unfill unfilldraw unitpixel unitsquare unitvector up upto - syn keyword mfMacro vround w whatever + +" By default, METAFONT loads modes.mf, too +if get(g:, "plain_mf_modes", 1) + syn keyword mfConstant APSSixMed AgfaFourZeroZero AgfaThreeFourZeroZero + syn keyword mfConstant AtariNineFive AtariNineSix AtariSLMEightZeroFour + syn keyword mfConstant AtariSMOneTwoFour CItohEightFiveOneZero + syn keyword mfConstant CItohThreeOneZero CanonBJCSixZeroZero CanonCX + syn keyword mfConstant CanonEX CanonLBPLX CanonLBPTen CanonSX ChelgraphIBX + syn keyword mfConstant CompugraphicEightSixZeroZero + syn keyword mfConstant CompugraphicNineSixZeroZero DD DEClarge DECsmall + syn keyword mfConstant DataDiscNew EightThree EpsonAction + syn keyword mfConstant EpsonLQFiveZeroZeroLo EpsonLQFiveZeroZeroMed + syn keyword mfConstant EpsonMXFX EpsonSQEightSevenZero EpsonStylusPro + syn keyword mfConstant EpsonStylusProHigh EpsonStylusProLow + syn keyword mfConstant EpsonStylusProMed FourFour GThreefax HPDeskJet + syn keyword mfConstant HPLaserJetIIISi IBMFourTwoFiveZero IBMFourTwoOneSix + syn keyword mfConstant IBMFourTwoThreeZero IBMFourZeroOneNine + syn keyword mfConstant IBMFourZeroThreeNine IBMFourZeroTwoNine + syn keyword mfConstant IBMProPrinter IBMSixOneFiveFour IBMSixSixSevenZero + syn keyword mfConstant IBMThreeEightOneTwo IBMThreeEightTwoZero + syn keyword mfConstant IBMThreeOneNineThree IBMThreeOneSevenNine + syn keyword mfConstant IBMUlfHolleberg LASevenFive LNOthreR LNOthree + syn keyword mfConstant LNZeroOne LNZeroThree LPSFourZero LPSTwoZero + syn keyword mfConstant LexmarkFourZeroThreeNine LexmarkOptraR + syn keyword mfConstant LexmarkOptraS LinotypeLThreeThreeZero + syn keyword mfConstant LinotypeOneZeroZero LinotypeOneZeroZeroLo + syn keyword mfConstant LinotypeThreeZeroZeroHi MacTrueSize NeXTprinter + syn keyword mfConstant NeXTscreen NecTwoZeroOne Newgen NineOne + syn keyword mfConstant OCESixSevenFiveZeroPS OneTwoZero OneZeroZero + syn keyword mfConstant PrintwareSevenTwoZeroIQ Prism QMSOneSevenTwoFive + syn keyword mfConstant QMSOneSevenZeroZero QMSTwoFourTwoFive RicohA + syn keyword mfConstant RicohFortyEighty RicohFourZeroEightZero RicohLP + syn keyword mfConstant SparcPrinter StarNLOneZero VAXstation VTSix + syn keyword mfConstant VarityperFiveZeroSixZeroW + syn keyword mfConstant VarityperFourThreeZeroZeroHi + syn keyword mfConstant VarityperFourThreeZeroZeroLo + syn keyword mfConstant VarityperFourTwoZeroZero VarityperSixZeroZero + syn keyword mfConstant XeroxDocutech XeroxEightSevenNineZero + syn keyword mfConstant XeroxFourZeroFiveZero XeroxNineSevenZeroZero + syn keyword mfConstant XeroxPhaserSixTwoZeroZeroDP XeroxThreeSevenZeroZero + syn keyword mfConstant Xerox_world agfafzz agfatfzz amiga aps apssixhi + syn keyword mfConstant aselect atariezf atarinf atarins atariotf bitgraph + syn keyword mfConstant bjtenex bjtzzex bjtzzl bjtzzs boise canonbjc + syn keyword mfConstant canonex canonlbp cg cgl cgnszz citohtoz corona crs + syn keyword mfConstant cthreeten cx datadisc declarge decsmall deskjet + syn keyword mfConstant docutech dover dp dpdfezzz eighthre elvira epscszz + syn keyword mfConstant epsdraft epsdrft epsdrftl epsfast epsfastl epshi + syn keyword mfConstant epslo epsmed epsmedl epson epsonact epsonfx epsonl + syn keyword mfConstant epsonlo epsonlol epsonlq epsonsq epstylus epstylwr + syn keyword mfConstant epstyplo epstypmd epstypml epstypro epswlo epswlol + syn keyword mfConstant esphi fourfour gpx gtfax gtfaxhi gtfaxl gtfaxlo + syn keyword mfConstant gtfaxlol help hifax highfax hplaser hprugged ibm_a + syn keyword mfConstant ibmd ibmega ibmegal ibmfzon ibmfztn ibmpp ibmppl + syn keyword mfConstant ibmsoff ibmteot ibmtetz ibmtont ibmtosn ibmtosnl + syn keyword mfConstant ibmvga ibx imagen imagewriter itoh itohl itohtoz + syn keyword mfConstant itohtozl iw jetiiisi kyocera laserjet laserjetfive + syn keyword mfConstant laserjetfivemp laserjetfour laserjetfourthousand + syn keyword mfConstant laserjetfourzerozerozero laserjethi laserjetlo + syn keyword mfConstant laserjettwoonezerozero + syn keyword mfConstant laserjettwoonezerozerofastres lasermaster + syn keyword mfConstant laserwriter lasf lexmarkr lexmarks lexmarku + syn keyword mfConstant linohalf linohi linolo linolttz linoone linosuper + syn keyword mfConstant linothree linothreelo linotzzh ljfive ljfivemp + syn keyword mfConstant ljfour ljfzzz ljfzzzfr ljlo ljtozz ljtozzfr lmaster + syn keyword mfConstant lnotr lnzo lps lpstz lqhires lqlores lqmed lqmedl + syn keyword mfConstant lqmedres lview lviewl lwpro macmag mactrue modes_mf + syn keyword mfConstant ncd nec nechi neclm nectzo newdd newddl nexthi + syn keyword mfConstant nextscreen nextscrn nineone nullmode ocessfz + syn keyword mfConstant okidata okidatal okifourten okifte okihi onetz + syn keyword mfConstant onezz pcprevw pcscreen phaser phaserfs phasertf + syn keyword mfConstant phasertfl phasertl pixpt printware prntware + syn keyword mfConstant proprinter qms qmsesz qmsostf qmsoszz qmstftf ricoh + syn keyword mfConstant ricoha ricohlp ricohsp sherpa sparcptr starnlt + syn keyword mfConstant starnltl styletwo stylewr stylewri stylewriter sun + syn keyword mfConstant supre swtwo toshiba ultre varityper vs vtftzz + syn keyword mfConstant vtftzzhi vtftzzlo vtfzszw vtszz xpstzz xpstzzl + syn keyword mfConstant xrxesnz xrxfzfz xrxnszz xrxtszz + syn keyword mfDef BCPL_string coding_scheme font_face_byte + syn keyword mfDef font_family landscape + syn keyword mfDef mode_extra_info mode_help mode_param + syn keyword mfNewInternal blacker_min endif " Some other basic macro names, e.g., from cmbase, logo, etc. -if !exists("other_mf_macros") - let other_mf_macros = 1 " Set this to '0' if your code gets too colourful - " metapost.vim does so to turn off Metafont macros -endif -if other_mf_macros - syn keyword mfMacro beginlogochar +if get(g:, "other_mf_macros", 1) + syn keyword mfDef beginlogochar + syn keyword mfDef font_setup + syn keyword mfPrimitive generate endif " Numeric tokens -syn match mfNumeric "[-]\=\d\+" -syn match mfNumeric "[-]\=\.\d\+" -syn match mfNumeric "[-]\=\d\+\.\d\+" +syn match mfNumeric "[-]\=\d\+" +syn match mfNumeric "[-]\=\.\d\+" +syn match mfNumeric "[-]\=\d\+\.\d\+" -" Metafont lengths -syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>" -syn match mfLength "\<[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>" -syn match mfLength "\<[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>" -syn match mfLength "\<[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>" - -" Metafont coordinates and points -syn match mfCoord "\<[xy]\d\+\>" -syn match mfPoint "\<z\d\+\>" +" METAFONT lengths +syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>" +syn match mfLength "[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=" +syn match mfLength "[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=" +syn match mfLength "[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=" " String constants -syn region mfString start=+"+ end=+"+ +syn match mfOpenString /"[^"]*/ +syn region mfString oneline keepend start=+"+ end=+"+ " Comments: -syn match mfComment "%.*$" +syn keyword mfTodoComment contained TODO FIXME XXX DEBUG NOTE +syn match mfComment "%.*$" contains=mfTodoComment,@Spell " synchronizing syn sync maxlines=50 " 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_mf_syntax_inits") - if version < 508 - let did_mf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink mfBoolExp Statement - HiLink mfNumExp Statement - HiLink mfInternal Identifier - HiLink mfPairExp Statement - HiLink mfPathExp Statement - HiLink mfPenExp Statement - HiLink mfPicExp Statement - HiLink mfStringExp Statement - HiLink mfCommand Statement - HiLink mfType Type - HiLink mfStatement Statement - HiLink mfDefinition Statement - HiLink mfCondition Conditional - HiLink mfPrimitive Statement - HiLink mfMacro Macro - HiLink mfCoord Identifier - HiLink mfPoint Identifier - HiLink mfNumeric Number - HiLink mfLength Number - HiLink mfComment Comment - HiLink mfString String - - delcommand HiLink -endif +hi def link mfBoolExp Statement +hi def link mfNumExp Statement +hi def link mfPairExp Statement +hi def link mfPathExp Statement +hi def link mfPenExp Statement +hi def link mfPicExp Statement +hi def link mfStringExp Statement +hi def link mfInternal Identifier +hi def link mfCommand Statement +hi def link mfType Type +hi def link mfStatement Statement +hi def link mfDefinition Statement +hi def link mfCondition Conditional +hi def link mfPrimitive Statement +hi def link mfDef Function +hi def link mfVardef mfDef +hi def link mfPrimaryDef mfDef +hi def link mfSecondaryDef mfDef +hi def link mfTertiaryDef mfDef +hi def link mfCoord Identifier +hi def link mfPoint Identifier +hi def link mfNumeric Number +hi def link mfLength Number +hi def link mfComment Comment +hi def link mfString String +hi def link mfOpenString Todo +hi def link mfSuffixParam Label +hi def link mfNewInternal mfInternal +hi def link mfVariable Identifier +hi def link mfConstant Constant +hi def link mfTodoComment Todo let b:current_syntax = "mf" -" vim: ts=8 +" vim:sw=2 diff --git a/runtime/syntax/mgl.vim b/runtime/syntax/mgl.vim index 55ae137f2f..f7bc617f5a 100644 --- a/runtime/syntax/mgl.vim +++ b/runtime/syntax/mgl.vim @@ -6,9 +6,8 @@ " " $Id: mgl.vim,v 1.1 2006/02/21 22:08:20 vimboss Exp $ " -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -84,43 +83,33 @@ syn keyword mglPredefined exception " 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_mgl_syn_inits") - if version < 508 - let did_mgl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink mglBoolean Boolean - HiLink mglComment Comment - HiLink mglConditional Conditional - HiLink mglConstant Constant - HiLink mglException Exception - HiLink mglFunction Function - HiLink mglLabel Label - HiLink mglMatrixDelimiter Identifier - HiLink mglNumber Number - HiLink mglHexNumber Number - HiLink mglCharacter Number - HiLink mglIpAddr Number - HiLink mglOperator Operator - HiLink mglPredefined mglFunction - HiLink mglPreProc PreProc - HiLink mglRepeat Repeat - HiLink mglStatement Statement - HiLink mglString String - HiLink mglStringEscape Special - HiLink mglStringEscapeGPC Special - HiLink mglStringError Error - HiLink mglStruct mglStatement - HiLink mglSymbolOperator mglOperator - HiLink mglType Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link mglBoolean Boolean +hi def link mglComment Comment +hi def link mglConditional Conditional +hi def link mglConstant Constant +hi def link mglException Exception +hi def link mglFunction Function +hi def link mglLabel Label +hi def link mglMatrixDelimiter Identifier +hi def link mglNumber Number +hi def link mglHexNumber Number +hi def link mglCharacter Number +hi def link mglIpAddr Number +hi def link mglOperator Operator +hi def link mglPredefined mglFunction +hi def link mglPreProc PreProc +hi def link mglRepeat Repeat +hi def link mglStatement Statement +hi def link mglString String +hi def link mglStringEscape Special +hi def link mglStringEscapeGPC Special +hi def link mglStringError Error +hi def link mglStruct mglStatement +hi def link mglSymbolOperator mglOperator +hi def link mglType Type + let b:current_syntax = "mgl" diff --git a/runtime/syntax/mgp.vim b/runtime/syntax/mgp.vim index 76b96612e2..7227804550 100644 --- a/runtime/syntax/mgp.vim +++ b/runtime/syntax/mgp.vim @@ -10,11 +10,8 @@ " SPAM is _NOT_ welcome - be ready to be reported! -" 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 @@ -48,36 +45,25 @@ syn match mgpNoDefault +^%nodefault$+ " 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_mgp_syn_inits") - let did_mgp_syn_inits = 1 - if version < 508 - let did_mgp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink mgpLineSkip Special +hi def link mgpLineSkip Special - HiLink mgpHash mgpComment - HiLink mgpPercent mgpComment - HiLink mgpComment Comment +hi def link mgpHash mgpComment +hi def link mgpPercent mgpComment +hi def link mgpComment Comment - HiLink mgpCommand Identifier +hi def link mgpCommand Identifier - HiLink mgpLine Type +hi def link mgpLine Type - HiLink mgpFile String - HiLink mgpSize Number - HiLink mgpValue Number +hi def link mgpFile String +hi def link mgpSize Number +hi def link mgpValue Number - HiLink mgpPage mgpDefine - HiLink mgpNoDefault mgpDefine - HiLink mgpDefine Define +hi def link mgpPage mgpDefine +hi def link mgpNoDefault mgpDefine +hi def link mgpDefine Define - delcommand HiLink -endif let b:current_syntax = "mgp" diff --git a/runtime/syntax/mix.vim b/runtime/syntax/mix.vim index 9ab98eacf8..564d344cc8 100644 --- a/runtime/syntax/mix.vim +++ b/runtime/syntax/mix.vim @@ -2,7 +2,7 @@ " Language: MIX (Donald Knuth's assembly language used in TAOCP) " Maintainer: Wu Yongwei <wuyongwei@gmail.com> " Filenames: *.mixal *.mix -" Last Change: 2013 Nov 13 +" Last Change: 2017-11-26 15:21:36 +0800 " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -16,7 +16,7 @@ syn case ignore " Special processing of ALF directive: implementations vary whether quotation " marks are needed -syn match mixAlfParam #\s\{1,2\}"\?[^"]\{,5\}"\?# contains=mixAlfDirective,mixString nextgroup=mixEndComment contained +syn match mixAlfParam #\s\{1,2\}"\?[^"]\{,5\}"\?# contains=mixString nextgroup=mixEndComment contained " Region for parameters syn match mixParam #[-+*/:=0-9a-z,()"]\+# contains=mixIdentifier,mixSpecial,mixNumber,mixString,mixLabel nextgroup=mixEndComment contained @@ -46,6 +46,7 @@ syn keyword mixDirective ALF nextgroup=mixAlfParam contained " Opcodes syn keyword mixOpcode NOP HLT NUM CHAR FLOT FIX nextgroup=mixEndComment contained syn keyword mixOpcode FADD FSUB FMUL FDIV FCMP MOVE ADD SUB MUL DIV IOC IN OUT JRED JBUS JMP JSJ JOV JNOV JL JE JG JLE JNE JGE SLA SRA SLAX SRAX SLC SRC nextgroup=mixParam contained skipwhite +syn keyword mixOpcode SLB SRB JAE JAO JXE JXO nextgroup=mixParam contained skipwhite syn match mixOpcode "LD[AX1-6]N\?\>" nextgroup=mixParam contained skipwhite syn match mixOpcode "ST[AX1-6JZ]\>" nextgroup=mixParam contained skipwhite @@ -58,7 +59,7 @@ syn match mixOpcode "J[AX1-6]N\?[NZP]\>" nextgroup=mixParam contained skipwhite " Switch back to being case sensitive syn case match -" Registers (only to used in comments now) +" Registers (only to be used in comments now) syn keyword mixRegister rA rX rI1 rI2 rI3 rI4 rI5 rI6 rJ contained " The default highlighting diff --git a/runtime/syntax/mma.vim b/runtime/syntax/mma.vim index c63beb1195..0683adc573 100644 --- a/runtime/syntax/mma.vim +++ b/runtime/syntax/mma.vim @@ -35,9 +35,8 @@ " fix nesting " finish populating popular symbols -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -283,47 +282,38 @@ syntax sync fromstart "set foldnestmax=1 "set foldminlines=15 -if version >= 508 || !exists("did_mma_syn_inits") - if version < 508 - let did_mma_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " NOTE - the following links are not guaranteed to - " look good under all colorschemes. You might need to - " :so $VIMRUNTIME/syntax/hitest.vim and tweak these to - " look good in yours - - - HiLink mmaComment Comment - HiLink mmaCommentStar Comment - HiLink mmaFunctionComment Comment - HiLink mmaLooseQuote Comment - HiLink mmaGenericFunction Function - HiLink mmaVariable Identifier -" HiLink mmaSymbol Identifier - HiLink mmaOperator Operator - HiLink mmaPatternOp Operator - HiLink mmaPureFunction Operator - HiLink mmaString String - HiLink mmaCommentString String - HiLink mmaUnicode String - HiLink mmaMessage Type - HiLink mmaNumber Type - HiLink mmaPattern Type - HiLink mmaError Error - HiLink mmaFixme Error - HiLink mmaPatternError Error - HiLink mmaTodo Todo - HiLink mmaemPHAsis Special - HiLink mmaFunctionTitle Special - HiLink mmaMessageType Special - HiLink mmaItem Preproc - - delcommand HiLink -endif + +" NOTE - the following links are not guaranteed to +" look good under all colorschemes. You might need to +" :so $VIMRUNTIME/syntax/hitest.vim and tweak these to +" look good in yours + + +hi def link mmaComment Comment +hi def link mmaCommentStar Comment +hi def link mmaFunctionComment Comment +hi def link mmaLooseQuote Comment +hi def link mmaGenericFunction Function +hi def link mmaVariable Identifier +" hi def link mmaSymbol Identifier +hi def link mmaOperator Operator +hi def link mmaPatternOp Operator +hi def link mmaPureFunction Operator +hi def link mmaString String +hi def link mmaCommentString String +hi def link mmaUnicode String +hi def link mmaMessage Type +hi def link mmaNumber Type +hi def link mmaPattern Type +hi def link mmaError Error +hi def link mmaFixme Error +hi def link mmaPatternError Error +hi def link mmaTodo Todo +hi def link mmaemPHAsis Special +hi def link mmaFunctionTitle Special +hi def link mmaMessageType Special +hi def link mmaItem Preproc + let b:current_syntax = "mma" diff --git a/runtime/syntax/mmix.vim b/runtime/syntax/mmix.vim index 79ca781402..39e209336e 100644 --- a/runtime/syntax/mmix.vim +++ b/runtime/syntax/mmix.vim @@ -9,9 +9,8 @@ " Limitations: Comments must start with either % or // " (preferably %, Knuth-Style) -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -119,44 +118,34 @@ syn match mmixRegister "r[A-Z]" syn keyword mmixRegister rBB rTT rWW rXX rYY rZZ " 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_mmix_syntax_inits") - if version < 508 - let did_mmix_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink mmixAt Type - HiLink mmixPseudo Type - HiLink mmixRegister Special - HiLink mmixSegments Type - - HiLink mmixLabel Special - HiLink mmixComment Comment - HiLink mmixOpcode Keyword - - HiLink hexNumber Number - HiLink decNumber Number - HiLink octNumber Number - - HiLink mmixString String - HiLink mmixChar String - - HiLink mmixType Type - HiLink mmixIdentifier Normal - HiLink mmixSpecialComment Comment - - " My default color overrides: - " hi mmixSpecialComment ctermfg=red - "hi mmixLabel ctermfg=lightcyan - " hi mmixType ctermbg=black ctermfg=brown - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link mmixAt Type +hi def link mmixPseudo Type +hi def link mmixRegister Special +hi def link mmixSegments Type + +hi def link mmixLabel Special +hi def link mmixComment Comment +hi def link mmixOpcode Keyword + +hi def link hexNumber Number +hi def link decNumber Number +hi def link octNumber Number + +hi def link mmixString String +hi def link mmixChar String + +hi def link mmixType Type +hi def link mmixIdentifier Normal +hi def link mmixSpecialComment Comment + +" My default color overrides: +" hi mmixSpecialComment ctermfg=red +"hi mmixLabel ctermfg=lightcyan +" hi mmixType ctermbg=black ctermfg=brown + let b:current_syntax = "mmix" diff --git a/runtime/syntax/mmp.vim b/runtime/syntax/mmp.vim index 0117e77925..d0b9f7cfb5 100644 --- a/runtime/syntax/mmp.vim +++ b/runtime/syntax/mmp.vim @@ -5,11 +5,8 @@ " URL: http://ronware.org/wiki/vim/mmp " Filetypes: *.mmp -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -34,8 +31,7 @@ syn match mmpNumber "0x\x\+" " 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 +" Only when an item doesn't have highlighting yet if !exists("did_mmp_syntax_inits") let did_mmp_syntax_inits=1 diff --git a/runtime/syntax/modconf.vim b/runtime/syntax/modconf.vim index 54b6593b66..76b36edcf0 100644 --- a/runtime/syntax/modconf.vim +++ b/runtime/syntax/modconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: modules.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-10-25 +" Language: modules.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-10-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/modsim3.vim b/runtime/syntax/modsim3.vim index 04e9ab9ab6..ce35033402 100644 --- a/runtime/syntax/modsim3.vim +++ b/runtime/syntax/modsim3.vim @@ -12,10 +12,8 @@ " " very basic things only (based on the modula2 and c files). -if version < 600 - " Remove any old syntax stuff hanging around - syn clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -77,31 +75,21 @@ syn region modsim3String start=+"+ end=+"+ syn match modsim3Literal "'[^']'\|''''" " 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_modsim3_syntax_inits") - if version < 508 - let did_modsim3_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink modsim3Keyword Statement - HiLink modsim3Block Statement - HiLink modsim3Comment1 Comment - HiLink modsim3Comment2 Comment - HiLink modsim3String String - HiLink modsim3Literal Character - HiLink modsim3Include Statement - HiLink modsim3Type Type - HiLink modsim3ParenError Error - HiLink modsim3Builtin Function - HiLink modsim3BuiltinNoParen Function - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link modsim3Keyword Statement +hi def link modsim3Block Statement +hi def link modsim3Comment1 Comment +hi def link modsim3Comment2 Comment +hi def link modsim3String String +hi def link modsim3Literal Character +hi def link modsim3Include Statement +hi def link modsim3Type Type +hi def link modsim3ParenError Error +hi def link modsim3Builtin Function +hi def link modsim3BuiltinNoParen Function + let b:current_syntax = "modsim3" diff --git a/runtime/syntax/modula2.vim b/runtime/syntax/modula2.vim index 3018900e80..4a14cf1f6f 100644 --- a/runtime/syntax/modula2.vim +++ b/runtime/syntax/modula2.vim @@ -4,11 +4,8 @@ " based on original work of Bram Moolenaar <Bram@vim.org> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -54,32 +51,22 @@ syn region modula2String start="'" end="'" syn region modula2Set start="{" end="}" " 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_modula2_syntax_inits") - if version < 508 - let did_modula2_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink modula2Ident Identifier - HiLink modula2StdConst Boolean - HiLink modula2Type Identifier - HiLink modula2StdFunc Identifier - HiLink modula2Header Type - HiLink modula2Keyword Statement - HiLink modula2AttKeyword PreProc - HiLink modula2Comment Comment - " The following is just a matter of taste (you want to try this instead): - " hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold - HiLink modula2Todo Todo - HiLink modula2String String - HiLink modula2Set String +hi def link modula2Ident Identifier +hi def link modula2StdConst Boolean +hi def link modula2Type Identifier +hi def link modula2StdFunc Identifier +hi def link modula2Header Type +hi def link modula2Keyword Statement +hi def link modula2AttKeyword PreProc +hi def link modula2Comment Comment +" The following is just a matter of taste (you want to try this instead): +" hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold +hi def link modula2Todo Todo +hi def link modula2String String +hi def link modula2Set String - delcommand HiLink -endif let b:current_syntax = "modula2" diff --git a/runtime/syntax/modula3.vim b/runtime/syntax/modula3.vim index d6f72afbca..d9b89ca7ce 100644 --- a/runtime/syntax/modula3.vim +++ b/runtime/syntax/modula3.vim @@ -6,11 +6,8 @@ " Basic things only... " Based on the modula 2 syntax file -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -46,24 +43,14 @@ syn region modula3String start=+"+ end=+"+ syn region modula3String start=+'+ end=+'+ " 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_modula3_syntax_inits") - if version < 508 - let did_modula3_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - " The default methods for highlighting. Can be overridden later - HiLink modula3Keyword Statement - HiLink modula3Block PreProc - HiLink modula3Comment Comment - HiLink modula3String String +" The default methods for highlighting. Can be overridden later +hi def link modula3Keyword Statement +hi def link modula3Block PreProc +hi def link modula3Comment Comment +hi def link modula3String String - delcommand HiLink -endif let b:current_syntax = "modula3" diff --git a/runtime/syntax/monk.vim b/runtime/syntax/monk.vim index afe2b56190..3af810173a 100644 --- a/runtime/syntax/monk.vim +++ b/runtime/syntax/monk.vim @@ -21,11 +21,8 @@ " Initializing: -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -60,11 +57,7 @@ syn region monkUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT " R5RS Scheme Functions and Syntax: -if version < 600 - set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ -else - setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ -endif +setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ syn keyword monkSyntax lambda and or if cond case define let let* letrec syn keyword monkSyntax begin do delay set! else => @@ -201,32 +194,22 @@ syn sync match matchPlace grouphere NONE "^[^ \t]" " ... i.e. synchronize on a line that starts at the left margin " 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_monk_syntax_inits") - if version < 508 - let did_monk_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink monkSyntax Statement - HiLink monkFunc Function - - HiLink monkString String - HiLink monkChar Character - HiLink monkNumber Number - HiLink monkBoolean Boolean - - HiLink monkDelimiter Delimiter - HiLink monkConstant Constant - - HiLink monkComment Comment - HiLink monkError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link monkSyntax Statement +hi def link monkFunc Function + +hi def link monkString String +hi def link monkChar Character +hi def link monkNumber Number +hi def link monkBoolean Boolean + +hi def link monkDelimiter Delimiter +hi def link monkConstant Constant + +hi def link monkComment Comment +hi def link monkError Error + let b:current_syntax = "monk" diff --git a/runtime/syntax/moo.vim b/runtime/syntax/moo.vim index 10c5d3b4bc..617058f8e3 100644 --- a/runtime/syntax/moo.vim +++ b/runtime/syntax/moo.vim @@ -4,8 +4,8 @@ " Last Change: 2001 Oct 06 " Note: Requires Vim 6.0 or above -" Quit when a syntax file was already loaded -if version < 600 || exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/mp.vim b/runtime/syntax/mp.vim index c0fd60b3da..a8fa36fe0a 100644 --- a/runtime/syntax/mp.vim +++ b/runtime/syntax/mp.vim @@ -1,132 +1,769 @@ " Vim syntax file -" Language: MetaPost -" Maintainer: Andreas Scherer <andreas.scherer@pobox.com> -" Last Change: April 30, 2001 - -" 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") +" Language: MetaPost +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com> +" Last Change: 2016 Oct 14 + +if exists("b:current_syntax") finish endif -let plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost -let other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither +let s:cpo_sav = &cpo +set cpo&vim + +if exists("g:plain_mf_macros") + let s:plain_mf_macros = g:plain_mf_macros +endif +if exists("g:plain_mf_modes") + let s:plain_mf_modes = g:plain_mf_modes +endif +if exists("g:other_mf_macros") + let s:other_mf_macros = g:other_mf_macros +endif + +let g:plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost +let g:plain_mf_modes = 0 " No METAFONT modes +let g:other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither -" Read the Metafont syntax to start with -if version < 600 - source <sfile>:p:h/mf.vim +" Read the METAFONT syntax to start with +runtime! syntax/mf.vim +unlet b:current_syntax " Necessary for syn include below + +" Restore the value of existing global variables +if exists("s:plain_mf_macros") + let g:plain_mf_macros = s:plain_mf_macros +else + unlet g:plain_mf_macros +endif +if exists("s:plain_mf_modes") + let g:plain_mf_modes = s:plain_mf_modes +else + unlet g:plain_mf_modes +endif +if exists("s:other_mf_macros") + let g:other_mf_macros = s:other_mf_macros else - runtime! syntax/mf.vim + unlet g:other_mf_macros endif -" MetaPost has TeX inserts for typeset labels -" verbatimtex, btex, and etex will be treated as keywords -syn match mpTeXbegin "\(verbatimtex\|btex\)" -syn match mpTeXend "etex" -syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 contains=mpTeXbegin,mpTeXend keepend +" Use TeX highlighting inside verbatimtex/btex... etex +syn include @MPTeX syntax/tex.vim +unlet b:current_syntax +" These are defined as keywords rather than using matchgroup +" in order to make them available to syntaxcomplete. +syn keyword mpTeXdelim btex etex verbatimtex contained +syn region mpTeXinsert + \ start=/\<verbatimtex\>\|\<btex\>/rs=e+1 + \ end=/\<etex\>/re=s-1 keepend + \ contains=@MPTeX,mpTeXdelim -" MetaPost primitives not found in Metafont -syn keyword mpInternal bluepart clip color dashed fontsize greenpart infont -syn keyword mpInternal linecap linejoin llcorner lrcorner miterlimit mpxbreak -syn keyword mpInternal prologues redpart setbounds tracinglostchars -syn keyword mpInternal truecorners ulcorner urcorner withcolor +" iskeyword must be set after the syn include above, because tex.vim sets `syn +" iskeyword`. Note that keywords do not contain numbers (numbers are +" subscripts) +syntax iskeyword @,_ -" Metafont primitives not found in MetaPost -syn keyword notDefined autorounding chardx chardy fillin granularity hppp -syn keyword notDefined proofing smoothing tracingedges tracingpens -syn keyword notDefined turningcheck vppp xoffset yoffset +" MetaPost primitives not found in METAFONT +syn keyword mpBoolExp bounded clipped filled stroked textual arclength +syn keyword mpNumExp arctime blackpart bluepart colormodel cyanpart +syn keyword mpNumExp fontsize greenpart greypart magentapart redpart +syn keyword mpPairExp yellowpart llcorner lrcorner ulcorner urcorner +" envelope is seemingly undocumented, but it exists since mpost 1.003. +" The syntax is: envelope <polygonal pen> of <path primary>. For example, +" path p; +" p := envelope pensquare of (up--left); +" (Thanks to Daniel H. Luecking for the example!) +syn keyword mpPathExp envelope pathpart +syn keyword mpPenExp penpart +syn keyword mpPicExp dashpart glyph infont +syn keyword mpStringExp fontpart readfrom textpart +syn keyword mpType cmykcolor color rgbcolor +" Other MetaPost primitives listed in the manual +syn keyword mpPrimitive mpxbreak within +" Internal quantities not found in METAFONT +" (Table 6 in MetaPost: A User's Manual) +syn keyword mpInternal defaultcolormodel hour minute linecap linejoin +syn keyword mpInternal miterlimit mpprocset mpversion numberprecision +syn keyword mpInternal numbersystem outputfilename outputformat +syn keyword mpInternal outputformatoptions outputtemplate prologues +syn keyword mpInternal restoreclipcolor tracinglostchars troffmode +syn keyword mpInternal truecorners +" List of commands not found in METAFONT (from MetaPost: A User's Manual) +syn keyword mpCommand clip closefrom dashed filenametemplate fontmapfile +syn keyword mpCommand fontmapline setbounds withcmykcolor withcolor +syn keyword mpCommand withgreyscale withoutcolor withpostscript +syn keyword mpCommand withprescript withrgbcolor write +" METAFONT internal variables not found in MetaPost +syn keyword notDefined autorounding chardx chardy fillin granularity +syn keyword notDefined proofing smoothing tracingedges tracingpens +syn keyword notDefined turningcheck xoffset yoffset +" Suffix defined only in METAFONT: +syn keyword notDefined nodot +" Other not implemented primitives (see MetaPost: A User's Manual, §C.1) +syn keyword notDefined cull display openwindow numspecial totalweight +syn keyword notDefined withweight " Keywords defined by plain.mp -if !exists("plain_mp_macros") - let plain_mp_macros = 1 " Set this to '0' if your source gets too colourful -endif -if plain_mp_macros - syn keyword mpMacro ahangle ahlength background bbox bboxmargin beginfig - syn keyword mpMacro beveled black blue buildcycle butt center cutafter - syn keyword mpMacro cutbefore cuttings dashpattern defaultfont defaultpen - syn keyword mpMacro defaultscale dotlabel dotlabels drawarrow drawdblarrow - syn keyword mpMacro drawoptions endfig evenly extra_beginfig extra_endfig - syn keyword mpMacro green label labeloffset mitered red rounded squared - syn keyword mpMacro thelabel white base_name base_version - syn keyword mpMacro upto downto exitunless relax gobble gobbled - syn keyword mpMacro interact loggingall tracingall tracingnone - syn keyword mpMacro eps epsilon infinity right left up down origin - syn keyword mpMacro quartercircle halfcircle fullcircle unitsquare identity - syn keyword mpMacro blankpicture withdots ditto EOF pensquare penrazor - syn keyword mpMacro penspeck whatever abs round ceiling byte dir unitvector - syn keyword mpMacro inverse counterclockwise tensepath mod div dotprod - syn keyword mpMacro takepower direction directionpoint intersectionpoint - syn keyword mpMacro softjoin incr decr reflectedabout rotatedaround - syn keyword mpMacro rotatedabout min max flex superellipse interpath - syn keyword mpMacro magstep currentpen currentpen_path currentpicture - syn keyword mpMacro fill draw filldraw drawdot unfill undraw unfilldraw - syn keyword mpMacro undrawdot erase cutdraw image pickup numeric_pickup - syn keyword mpMacro pen_lft pen_rt pen_top pen_bot savepen clearpen - syn keyword mpMacro clear_pen_memory lft rt top bot ulft urt llft lrt - syn keyword mpMacro penpos penstroke arrowhead makelabel labels penlabel - syn keyword mpMacro range numtok thru clearxy clearit clearpen pickup - syn keyword mpMacro shipit bye hide stop solve +if get(g:, "plain_mp_macros", 1) || get(g:, "mp_metafun_macros", 0) + syn keyword mpDef beginfig clear_pen_memory clearit clearpen clearpen + syn keyword mpDef clearxy colorpart cutdraw downto draw drawarrow + syn keyword mpDef drawdblarrow drawdot drawoptions endfig erase + syn keyword mpDef exitunless fill filldraw flex gobble hide interact + syn keyword mpDef label loggingall makelabel numtok penstroke pickup + syn keyword mpDef range reflectedabout rotatedaround shipit + syn keyword mpDef stop superellipse takepower tracingall tracingnone + syn keyword mpDef undraw undrawdot unfill unfilldraw upto + syn match mpDef "???" + syn keyword mpVardef arrowhead bbox bot buildcycle byte ceiling center + syn keyword mpVardef counterclockwise decr dir direction directionpoint + syn keyword mpVardef dotlabel dotlabels image incr interpath inverse + syn keyword mpVardef labels lft magstep max min penlabels penpos round + syn keyword mpVardef rt savepen solve tensepath thelabel top unitvector + syn keyword mpVardef whatever z + syn keyword mpPrimaryDef div dotprod gobbled mod + syn keyword mpSecondaryDef intersectionpoint + syn keyword mpTertiaryDef cutafter cutbefore softjoin thru + syn keyword mpNewInternal ahangle ahlength bboxmargin beveled butt defaultpen + syn keyword mpNewInternal defaultscale dotlabeldiam eps epsilon infinity + syn keyword mpNewInternal join_radius labeloffset mitered pen_bot pen_lft + syn keyword mpNewInternal pen_rt pen_top rounded squared tolerance + " Predefined constants + syn keyword mpConstant EOF background base_name base_version black + syn keyword mpConstant blankpicture blue ditto down evenly fullcircle + syn keyword mpConstant green halfcircle identity left origin penrazor + syn keyword mpConstant penspeck pensquare quartercircle red right + syn keyword mpConstant unitsquare up white withdots + " Other predefined variables + syn keyword mpVariable currentpen currentpen_path currentpicture cuttings + syn keyword mpVariable defaultfont extra_beginfig extra_endfig + syn match mpVariable /\<\%(laboff\|labxf\|labyf\)\>/ + syn match mpVariable /\<\%(laboff\|labxf\|labyf\)\.\%(lft\|rt\|bot\|top\|ulft\|urt\|llft\|lrt\)\>/ + " let statements: + syn keyword mpnumExp abs + syn keyword mpDef rotatedabout + syn keyword mpCommand bye relax + " on and off are not technically keywords, but it is nice to highlight them + " inside dashpattern(). + syn keyword mpOnOff off on contained + syn keyword mpDash dashpattern contained + syn region mpDashPattern + \ start="dashpattern\s*" + \ end=")"he=e-1 + \ contains=mfNumeric,mfLength,mpOnOff,mpDash endif " Keywords defined by mfplain.mp -if !exists("mfplain_mp_macros") - let mfplain_mp_macros = 0 " Set this to '1' to include these macro names -endif -if mfplain_mp_macros - syn keyword mpMacro beginchar blacker capsule_def change_width - syn keyword mpMacro define_blacker_pixels define_corrected_pixels - syn keyword mpMacro define_good_x_pixels define_good_y_pixels - syn keyword mpMacro define_horizontal_corrected_pixels - syn keyword mpMacro define_pixels define_whole_blacker_pixels - syn keyword mpMacro define_whole_vertical_blacker_pixels - syn keyword mpMacro define_whole_vertical_pixels endchar - syn keyword mpMacro extra_beginchar extra_endchar extra_setup - syn keyword mpMacro font_coding_scheme font_extra_space font_identifier - syn keyword mpMacro font_normal_shrink font_normal_space - syn keyword mpMacro font_normal_stretch font_quad font_size - syn keyword mpMacro font_slant font_x_height italcorr labelfont - syn keyword mpMacro makebox makegrid maketicks mode_def mode_setup - syn keyword mpMacro o_correction proofrule proofrulethickness rulepen smode - +if get(g:, "mfplain_mp_macros", 0) + syn keyword mpDef beginchar capsule_def change_width + syn keyword mpDef define_blacker_pixels define_corrected_pixels + syn keyword mpDef define_good_x_pixels define_good_y_pixels + syn keyword mpDef define_horizontal_corrected_pixels define_pixels + syn keyword mpDef define_whole_blacker_pixels define_whole_pixels + syn keyword mpDef define_whole_vertical_blacker_pixels + syn keyword mpDef define_whole_vertical_pixels endchar + syn keyword mpDef font_coding_scheme font_extra_space font_identifier + syn keyword mpDef font_normal_shrink font_normal_space + syn keyword mpDef font_normal_stretch font_quad font_size font_slant + syn keyword mpDef font_x_height italcorr labelfont lowres_fix makebox + syn keyword mpDef makegrid maketicks mode_def mode_setup proofrule + syn keyword mpDef smode + syn keyword mpVardef hround proofrulethickness vround + syn keyword mpNewInternal blacker o_correction + syn keyword mpVariable extra_beginchar extra_endchar extra_setup rulepen " plus some no-ops, also from mfplain.mp - syn keyword mpMacro cullit currenttransform gfcorners grayfont hround - syn keyword mpMacro imagerules lowres_fix nodisplays notransforms openit - syn keyword mpMacro proofoffset screenchars screenrule screenstrokes - syn keyword mpMacro showit slantfont titlefont unitpixel vround + syn keyword mpDef cull cullit gfcorners imagerules nodisplays + syn keyword mpDef notransforms openit proofoffset screenchars + syn keyword mpDef screenrule screenstrokes showit + syn keyword mpVardef grayfont slantfont titlefont + syn keyword mpVariable currenttransform + syn keyword mpConstant unitpixel + " These are not listed in the MetaPost manual, and some are ignored by + " MetaPost, but are nonetheless defined in mfplain.mp + syn keyword mpDef killtext + syn match mpVardef "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>" + syn keyword mpVariable aspect_ratio localfont mag mode mode_name + syn keyword mpVariable proofcolor + syn keyword mpConstant lowres proof smoke + syn keyword mpNewInternal autorounding bp_per_pixel granularity + syn keyword mpNewInternal number_of_modes proofing smoothing turningcheck endif -" Keywords defined by other macro packages, e.g., boxes.mp -if !exists("other_mp_macros") - let other_mp_macros = 1 " Set this to '0' if your source gets too colourful -endif -if other_mp_macros - syn keyword mpMacro circmargin defaultdx defaultdy - syn keyword mpMacro boxit boxjoin bpath circleit drawboxed drawboxes - syn keyword mpMacro drawunboxed fixpos fixsize pic +" Keywords defined by all base macro packages: +" - (r)boxes.mp +" - format.mp +" - graph.mp +" - marith.mp +" - sarith.mp +" - string.mp +" - TEX.mp +if get(g:, "other_mp_macros", 1) + " boxes and rboxes + syn keyword mpDef boxjoin drawboxed drawboxes drawunboxed + syn keyword mpNewInternal circmargin defaultdx defaultdy rbox_radius + syn keyword mpVardef boxit bpath circleit fixpos fixsize generic_declare + syn keyword mpVardef generic_redeclare generisize pic rboxit str_prefix + " format + syn keyword mpVardef Mformat format init_numbers roundd + syn keyword mpVariable Fe_base Fe_plus + syn keyword mpConstant Ten_to + " graph + syn keyword mpDef Gfor Gxyscale OUT auto begingraph endgraph gdata + syn keyword mpDef gdraw gdrawarrow gdrawdblarrow gfill plot + syn keyword mpVardef augment autogrid frame gdotlabel glabel grid itick + syn keyword mpVardef otick + syn keyword mpVardef Mreadpath setcoords setrange + syn keyword mpNewInternal Gmarks Gminlog Gpaths linear log + syn keyword mpVariable Autoform Gemarks Glmarks Gumarks + syn keyword mpConstant Gtemplate + syn match mpVariable /Gmargin\.\%(low\|high\)/ + " marith + syn keyword mpVardef Mabs Meform Mexp Mexp_str Mlog Mlog_Str Mlog_str + syn keyword mpPrimaryDef Mdiv Mmul + syn keyword mpSecondaryDef Madd Msub + syn keyword mpTertiaryDef Mleq + syn keyword mpNewInternal Mten Mzero + " sarith + syn keyword mpVardef Sabs Scvnum + syn keyword mpPrimaryDef Sdiv Smul + syn keyword mpSecondaryDef Sadd Ssub + syn keyword mpTertiaryDef Sleq Sneq + " string + syn keyword mpVardef cspan isdigit loptok + " TEX + syn keyword mpVardef TEX TEXPOST TEXPRE endif +" Up to date as of 23-Sep-2016. +if get(b:, 'mp_metafun_macros', get(g:, 'mp_metafun_macros', 0)) + " Highlight TeX keywords (for use in ConTeXt documents) + syn match mpTeXKeyword '\\[a-zA-Z@]\+' + + " These keywords have been added manually. + syn keyword mpPrimitive runscript + + " The following MetaFun keywords have been extracted automatically from + " ConTeXt source code. They include all "public" macros (where a macro is + " considered public if and only if it does not start with _, mfun_, mlib_, or + " do_, and it does not end with _), all "public" unsaved variables, and all + " `let` statements. + + " mp-abck.mpiv + syn keyword mpDef abck_grid_line anchor_box box_found boxfilloptions + syn keyword mpDef boxgridoptions boxlineoptions draw_multi_pars + syn keyword mpDef draw_multi_side draw_multi_side_path freeze_box + syn keyword mpDef initialize_box initialize_box_pos + syn keyword mpDef multi_side_draw_options show_multi_kind + syn keyword mpDef show_multi_pars + syn keyword mpVardef abck_baseline_grid abck_draw_path abck_graphic_grid + syn keyword mpVariable boxdashtype boxfilloffset boxfilltype + syn keyword mpVariable boxgriddirection boxgriddistance boxgridshift + syn keyword mpVariable boxgridtype boxgridwidth boxlineoffset + syn keyword mpVariable boxlineradius boxlinetype boxlinewidth multikind + syn keyword mpConstant context_abck + " mp-apos.mpiv + syn keyword mpDef anch_sidebars_draw boxfilloptions boxlineoptions + syn keyword mpDef connect_positions + syn keyword mpConstant context_apos + " mp-asnc.mpiv + syn keyword mpDef FlushSyncTasks ProcessSyncTask ResetSyncTasks + syn keyword mpDef SetSyncColor SetSyncThreshold SyncTask + syn keyword mpVardef PrepareSyncTasks SyncBox TheSyncColor + syn keyword mpVardef TheSyncThreshold + syn keyword mpVariable CurrentSyncClass NOfSyncPaths SyncColor + syn keyword mpVariable SyncLeftOffset SyncPaths SyncTasks SyncThreshold + syn keyword mpVariable SyncThresholdMethod SyncWidth + syn keyword mpConstant context_asnc + " mp-back.mpiv + syn keyword mpDef some_double_back some_hash + syn keyword mpVariable back_nillcolor + syn keyword mpConstant context_back + " mp-bare.mpiv + syn keyword mpVardef colordecimals rawtextext + syn keyword mpPrimaryDef infont + syn keyword mpConstant context_bare + " mp-base.mpiv + " This is essentially plain.mp with only a few keywords added + syn keyword mpNumExp graypart + syn keyword mpType graycolor greycolor + syn keyword mpConstant cyan magenta yellow + " mp-butt.mpiv + syn keyword mpDef predefinedbutton some_button + syn keyword mpConstant context_butt + " mp-char.mpiv + syn keyword mpDef flow_begin_chart flow_begin_sub_chart + syn keyword mpDef flow_chart_draw_comment flow_chart_draw_exit + syn keyword mpDef flow_chart_draw_label flow_chart_draw_text + syn keyword mpDef flow_clip_chart flow_collapse_points + syn keyword mpDef flow_connect_bottom_bottom flow_connect_bottom_left + syn keyword mpDef flow_connect_bottom_right flow_connect_bottom_top + syn keyword mpDef flow_connect_left_bottom flow_connect_left_left + syn keyword mpDef flow_connect_left_right flow_connect_left_top + syn keyword mpDef flow_connect_right_bottom flow_connect_right_left + syn keyword mpDef flow_connect_right_right flow_connect_right_top + syn keyword mpDef flow_connect_top_bottom flow_connect_top_left + syn keyword mpDef flow_connect_top_right flow_connect_top_top + syn keyword mpDef flow_draw_connection flow_draw_connection_point + syn keyword mpDef flow_draw_midpoint flow_draw_shape + syn keyword mpDef flow_draw_test_area flow_draw_test_shape + syn keyword mpDef flow_draw_test_shapes flow_end_chart + syn keyword mpDef flow_end_sub_chart flow_flush_connections + syn keyword mpDef flow_flush_picture flow_flush_pictures + syn keyword mpDef flow_flush_shape flow_flush_shapes + syn keyword mpDef flow_initialize_grid flow_new_chart flow_new_shape + syn keyword mpDef flow_scaled_to_grid flow_show_connection + syn keyword mpDef flow_show_connections flow_show_shapes + syn keyword mpDef flow_xy_offset flow_y_pos + syn keyword mpVardef flow_connection_path flow_down_on_grid + syn keyword mpVardef flow_down_to_grid flow_i_point flow_left_on_grid + syn keyword mpVardef flow_left_to_grid flow_offset + syn keyword mpVardef flow_points_initialized flow_right_on_grid + syn keyword mpVardef flow_right_to_grid flow_smooth_connection + syn keyword mpVardef flow_trim_points flow_trimmed flow_up_on_grid + syn keyword mpVardef flow_up_to_grid flow_valid_connection + syn keyword mpVardef flow_x_on_grid flow_xy_bottom flow_xy_left + syn keyword mpVardef flow_xy_on_grid flow_xy_right flow_xy_top + syn keyword mpVardef flow_y_on_grid + syn keyword mpVariable flow_arrowtip flow_chart_background_color + syn keyword mpVariable flow_chart_offset flow_comment_offset + syn keyword mpVariable flow_connection_arrow_size + syn keyword mpVariable flow_connection_dash_size + syn keyword mpVariable flow_connection_line_color + syn keyword mpVariable flow_connection_line_width + syn keyword mpVariable flow_connection_smooth_size flow_connections + syn keyword mpVariable flow_cpath flow_dash_pattern flow_dashline + syn keyword mpVariable flow_exit_offset flow_forcevalid flow_grid_height + syn keyword mpVariable flow_grid_width flow_label_offset flow_max_x + syn keyword mpVariable flow_max_y flow_peepshape flow_reverse_connection + syn keyword mpVariable flow_reverse_y flow_shape_action flow_shape_archive + syn keyword mpVariable flow_shape_decision flow_shape_down + syn keyword mpVariable flow_shape_fill_color flow_shape_height + syn keyword mpVariable flow_shape_left flow_shape_line_color + syn keyword mpVariable flow_shape_line_width flow_shape_loop + syn keyword mpVariable flow_shape_multidocument flow_shape_node + syn keyword mpVariable flow_shape_procedure flow_shape_product + syn keyword mpVariable flow_shape_right flow_shape_singledocument + syn keyword mpVariable flow_shape_subprocedure flow_shape_up + syn keyword mpVariable flow_shape_wait flow_shape_width + syn keyword mpVariable flow_show_all_points flow_show_con_points + syn keyword mpVariable flow_show_mid_points flow_showcrossing flow_smooth + syn keyword mpVariable flow_touchshape flow_xypoint flow_zfactor + syn keyword mpConstant context_flow + " mp-chem.mpiv + syn keyword mpDef chem_init_all chem_reset chem_start_structure + syn keyword mpDef chem_transformed + syn keyword mpVardef chem_ad chem_adj chem_align chem_arrow chem_au + syn keyword mpVardef chem_b chem_bb chem_bd chem_bw chem_c chem_cc + syn keyword mpVardef chem_ccd chem_cd chem_crz chem_cz chem_dash chem_db + syn keyword mpVardef chem_diff chem_dir chem_do chem_dr chem_draw + syn keyword mpVardef chem_drawarrow chem_eb chem_ed chem_ep chem_er + syn keyword mpVardef chem_es chem_et chem_fill chem_hb chem_init_some + syn keyword mpVardef chem_label chem_ldb chem_ldd chem_line chem_lr + syn keyword mpVardef chem_lrb chem_lrbd chem_lrd chem_lrh chem_lrn + syn keyword mpVardef chem_lrt chem_lrz chem_lsr chem_lsub chem_mark + syn keyword mpVardef chem_marked chem_mid chem_mids chem_midz chem_mir + syn keyword mpVardef chem_mov chem_move chem_number chem_oe chem_off + syn keyword mpVardef chem_pb chem_pe chem_r chem_r_fragment chem_rb + syn keyword mpVardef chem_rbd chem_rd chem_rdb chem_rdd chem_restore + syn keyword mpVardef chem_rh chem_rm chem_rn chem_rot chem_rr chem_rrb + syn keyword mpVardef chem_rrbd chem_rrd chem_rrh chem_rrn chem_rrt + syn keyword mpVardef chem_rrz chem_rsr chem_rsub chem_rt chem_rz chem_s + syn keyword mpVardef chem_save chem_sb chem_sd chem_set chem_sr chem_ss + syn keyword mpVardef chem_start_component chem_stop_component + syn keyword mpVardef chem_stop_structure chem_sub chem_symbol chem_tb + syn keyword mpVardef chem_text chem_z chem_zln chem_zlt chem_zn chem_zrn + syn keyword mpVardef chem_zrt chem_zt + syn keyword mpVariable chem_mark_pair chem_stack_mirror chem_stack_origin + syn keyword mpVariable chem_stack_p chem_stack_previous + syn keyword mpVariable chem_stack_rotation chem_trace_boundingbox + syn keyword mpVariable chem_trace_nesting chem_trace_text + syn keyword mpConstant context_chem + " mp-core.mpiv + syn keyword mpDef FlushSyncTasks ProcessSyncTask + syn keyword mpDef RegisterLocalTextArea RegisterPlainTextArea + syn keyword mpDef RegisterRegionTextArea RegisterTextArea + syn keyword mpDef ResetLocalTextArea ResetSyncTasks ResetTextAreas + syn keyword mpDef SaveTextAreas SetSyncColor SetSyncThreshold + syn keyword mpDef SyncTask anchor_box box_found boxfilloptions + syn keyword mpDef boxgridoptions boxlineoptions collapse_multi_pars + syn keyword mpDef draw_box draw_multi_pars draw_par freeze_box + syn keyword mpDef initialize_area initialize_area_par initialize_box + syn keyword mpDef initialize_box_pos initialize_par + syn keyword mpDef prepare_multi_pars relocate_multipars save_multipar + syn keyword mpDef set_par_line_height show_multi_pars show_par + syn keyword mpDef simplify_multi_pars sort_multi_pars + syn keyword mpVardef InsideSavedTextArea InsideSomeSavedTextArea + syn keyword mpVardef InsideSomeTextArea InsideTextArea PrepareSyncTasks + syn keyword mpVardef SyncBox TextAreaH TextAreaW TextAreaWH TextAreaX + syn keyword mpVardef TextAreaXY TextAreaY TheSyncColor TheSyncThreshold + syn keyword mpVardef baseline_grid graphic_grid multi_par_at_top + syn keyword mpVariable CurrentSyncClass NOfSavedTextAreas + syn keyword mpVariable NOfSavedTextColumns NOfSyncPaths NOfTextAreas + syn keyword mpVariable NOfTextColumns PlainTextArea RegionTextArea + syn keyword mpVariable SavedTextColumns SyncColor SyncLeftOffset SyncPaths + syn keyword mpVariable SyncTasks SyncThreshold SyncThresholdMethod + syn keyword mpVariable SyncWidth TextAreas TextColumns + syn keyword mpVariable auto_multi_par_hsize boxdashtype boxfilloffset + syn keyword mpVariable boxfilltype boxgriddirection boxgriddistance + syn keyword mpVariable boxgridshift boxgridtype boxgridwidth boxlineradius + syn keyword mpVariable boxlinetype boxlinewidth check_multi_par_chain + syn keyword mpVariable compensate_multi_par_topskip + syn keyword mpVariable enable_multi_par_fallback force_multi_par_chain + syn keyword mpVariable ignore_multi_par_page last_multi_par_shift lefthang + syn keyword mpVariable local_multi_par_area multi_column_first_page_hack + syn keyword mpVariable multi_par_pages multiloc multilocs multipar + syn keyword mpVariable multipars multiref multirefs nofmultipars + syn keyword mpVariable obey_multi_par_hang obey_multi_par_more + syn keyword mpVariable one_piece_multi_par par_hang_after par_hang_indent + syn keyword mpVariable par_indent par_left_skip par_line_height + syn keyword mpVariable par_right_skip par_start_pos par_stop_pos + syn keyword mpVariable par_strut_depth par_strut_height ppos righthang + syn keyword mpVariable snap_multi_par_tops somehang span_multi_column_pars + syn keyword mpVariable use_multi_par_region + syn keyword mpConstant context_core + syn keyword LET anchor_area anchor_par draw_area + " mp-cows.mpiv + syn keyword mpConstant context_cows cow + " mp-crop.mpiv + syn keyword mpDef page_marks_add_color page_marks_add_lines + syn keyword mpDef page_marks_add_marking page_marks_add_number + syn keyword mpVardef crop_color crop_gray crop_marks_cmyk + syn keyword mpVardef crop_marks_cmykrgb crop_marks_gray crop_marks_lines + syn keyword mpVariable crop_colors more page + syn keyword mpConstant context_crop + " mp-figs.mpiv + syn keyword mpDef naturalfigure registerfigure + syn keyword mpVardef figuredimensions figureheight figuresize + syn keyword mpVardef figurewidth + syn keyword mpConstant context_figs + " mp-fobg.mpiv + syn keyword mpDef DrawFoFrame + syn keyword mpVardef equalpaths + syn keyword mpPrimaryDef inset outset + syn keyword mpVariable FoBackground FoBackgroundColor FoFrame FoLineColor + syn keyword mpVariable FoLineStyle FoLineWidth FoSplit + syn keyword mpConstant FoAll FoBottom FoDash FoDotted FoDouble FoGroove + syn keyword mpConstant FoHidden FoInset FoLeft FoMedium FoNoColor FoNone + syn keyword mpConstant FoOutset FoRidge FoRight FoSolid FoThick FoThin + syn keyword mpConstant FoTop context_fobg + " mp-form.mpiv + syn keyword mpConstant context_form + " mp-func.mpiv + syn keyword mpDef constructedfunction constructedpairs + syn keyword mpDef constructedpath curvedfunction curvedpairs + syn keyword mpDef curvedpath function pathconnectors straightfunction + syn keyword mpDef straightpairs straightpath + syn keyword mpConstant context_func + " mp-grap.mpiv + syn keyword mpDef Gfor OUT auto begingraph circles crosses diamonds + syn keyword mpDef downtriangles endgraph gdata gdraw gdrawarrow + syn keyword mpDef gdrawdblarrow gfill graph_addto + syn keyword mpDef graph_addto_currentpicture graph_comma + syn keyword mpDef graph_coordinate_multiplication graph_draw + syn keyword mpDef graph_draw_label graph_errorbar_text graph_fill + syn keyword mpDef graph_generate_exponents + syn keyword mpDef graph_generate_label_position + syn keyword mpDef graph_generate_numbers graph_label_location + syn keyword mpDef graph_scan_mark graph_scan_marks graph_setbounds + syn keyword mpDef graph_suffix graph_tick_label + syn keyword mpDef graph_with_pen_and_color graph_withlist + syn keyword mpDef graph_xyscale lefttriangles makefunctionpath plot + syn keyword mpDef plotsymbol points rainbow righttriangles smoothpath + syn keyword mpDef squares stars uptriangles witherrorbars + syn keyword mpVardef addtopath augment autogrid constant_fit + syn keyword mpVardef constant_function det escaped_format exp + syn keyword mpVardef exponential_fit exponential_function format + syn keyword mpVardef formatted frame functionpath gaussian_fit + syn keyword mpVardef gaussian_function gdotlabel glabel graph_Feform + syn keyword mpVardef graph_Meform graph_arrowhead_extent graph_bounds + syn keyword mpVardef graph_clear_bounds + syn keyword mpVardef graph_convert_user_path_to_internal graph_cspan + syn keyword mpVardef graph_draw_arrowhead graph_error graph_errorbars + syn keyword mpVardef graph_exp graph_factor_and_exponent_to_string + syn keyword mpVardef graph_gridline_picture graph_is_null + syn keyword mpVardef graph_label_convert_user_to_internal graph_loptok + syn keyword mpVardef graph_match_exponents graph_mlog + syn keyword mpVardef graph_modified_exponent_ypart graph_pair_adjust + syn keyword mpVardef graph_picture_conversion graph_post_draw + syn keyword mpVardef graph_read_line graph_readpath graph_remap + syn keyword mpVardef graph_scan_path graph_select_exponent_mark + syn keyword mpVardef graph_select_mark graph_set_bounds + syn keyword mpVardef graph_set_default_bounds graph_shapesize + syn keyword mpVardef graph_stash_label graph_tick_mark_spacing + syn keyword mpVardef graph_unknown_pair_bbox grid isdigit itick + syn keyword mpVardef linear_fit linear_function ln logten lorentzian_fit + syn keyword mpVardef lorentzian_function otick polynomial_fit + syn keyword mpVardef polynomial_function power_law_fit + syn keyword mpVardef power_law_function powten setcoords setrange + syn keyword mpVardef sortpath strfmt tick varfmt + syn keyword mpNewInternal Mzero doubleinfinity graph_log_minimum + syn keyword mpNewInternal graph_minimum_number_of_marks largestmantissa + syn keyword mpNewInternal linear lntwo log mlogten singleinfinity + syn keyword mpVariable Autoform determinant fit_chi_squared + syn keyword mpVariable graph_errorbar_picture graph_exp_marks + syn keyword mpVariable graph_frame_pair_a graph_frame_pair_b + syn keyword mpVariable graph_lin_marks graph_log_marks graph_modified_bias + syn keyword mpVariable graph_modified_higher graph_modified_lower + syn keyword mpVariable graph_shape r_s resistance_color resistance_name + syn keyword mpConstant context_grap + " mp-grid.mpiv + syn keyword mpDef hlingrid hloggrid vlingrid vloggrid + syn keyword mpVardef hlinlabel hlintext hlogtext linlin linlinpath + syn keyword mpVardef linlog linlogpath loglin loglinpath loglog + syn keyword mpVardef loglogpath processpath vlinlabel vlintext vlogtext + syn keyword mpVariable fmt_initialize fmt_pictures fmt_precision + syn keyword mpVariable fmt_separator fmt_zerocheck grid_eps + syn keyword mpConstant context_grid + " mp-grph.mpiv + syn keyword mpDef beginfig begingraphictextfig data_mpo_file + syn keyword mpDef data_mpy_file doloadfigure draw endfig + syn keyword mpDef endgraphictextfig fill fixedplace graphictext + syn keyword mpDef loadfigure new_graphictext normalwithshade number + syn keyword mpDef old_graphictext outlinefill protectgraphicmacros + syn keyword mpDef resetfig reversefill withdrawcolor withfillcolor + syn keyword mpDef withshade + syn keyword mpVariable currentgraphictext figureshift + syn keyword mpConstant context_grph + " mp-idea.mpiv + syn keyword mpVardef bcomponent ccomponent gcomponent mcomponent + syn keyword mpVardef rcomponent somecolor ycomponent + " mp-luas.mpiv + syn keyword mpDef luacall message + syn keyword mpVardef MP lua lualist + syn keyword mpConstant context_luas + " mp-mlib.mpiv + syn keyword mpDef autoalign bitmapimage circular_shade cmyk comment + syn keyword mpDef defineshade eofill eofillup externalfigure figure + syn keyword mpDef fillup label linear_shade multitonecolor namedcolor + syn keyword mpDef nofill onlayer passarrayvariable passvariable + syn keyword mpDef plain_label register resolvedcolor scantokens + syn keyword mpDef set_circular_vector set_linear_vector shaded + syn keyword mpDef spotcolor startpassingvariable stoppassingvariable + syn keyword mpDef thelabel transparent[] usemetafunlabels + syn keyword mpDef useplainlabels withcircularshade withlinearshade + syn keyword mpDef withmask withproperties withshadecenter + syn keyword mpDef withshadecolors withshadedirection withshadedomain + syn keyword mpDef withshadefactor withshadefraction withshadeorigin + syn keyword mpDef withshaderadius withshadestep withshadetransform + syn keyword mpDef withshadevector withtransparency + syn keyword mpVardef anchored checkbounds checkedbounds + syn keyword mpVardef define_circular_shade define_linear_shade dotlabel + syn keyword mpVardef escaped_format fmttext fontsize format formatted + syn keyword mpVardef installlabel onetimefmttext onetimetextext + syn keyword mpVardef outlinetext plain_thelabel properties rawfmttext + syn keyword mpVardef rawtexbox rawtextext rule strfmt strut texbox + syn keyword mpVardef textext thefmttext thelabel thetexbox thetextext + syn keyword mpVardef tostring transparency_alternative_to_number + syn keyword mpVardef validtexbox varfmt verbatim + syn keyword mpPrimaryDef asgroup infont normalinfont shadedinto + syn keyword mpPrimaryDef shownshadecenter shownshadedirection + syn keyword mpPrimaryDef shownshadeorigin shownshadevector withshade + syn keyword mpPrimaryDef withshademethod + syn keyword mpNewInternal colorburntransparent colordodgetransparent + syn keyword mpNewInternal colortransparent darkentransparent + syn keyword mpNewInternal differencetransparent exclusiontransparent + syn keyword mpNewInternal hardlighttransparent huetransparent + syn keyword mpNewInternal lightentransparent luminositytransparent + syn keyword mpNewInternal multiplytransparent normaltransparent + syn keyword mpNewInternal overlaytransparent saturationtransparent + syn keyword mpNewInternal screentransparent shadefactor softlighttransparent + syn keyword mpNewInternal textextoffset + syn keyword mpType property transparency + syn keyword mpVariable currentoutlinetext shadeddown shadedleft + syn keyword mpVariable shadedright shadedup shadeoffset trace_shades + syn keyword mpConstant context_mlib + " mp-page.mpiv + syn keyword mpDef BoundCoverAreas BoundPageAreas Enlarged FakeRule + syn keyword mpDef FakeWord LoadPageState OverlayBox RuleColor + syn keyword mpDef SetAreaVariables SetPageArea SetPageBackPage + syn keyword mpDef SetPageCoverPage SetPageField SetPageFrontPage + syn keyword mpDef SetPageHsize SetPageHstep SetPageLocation + syn keyword mpDef SetPagePage SetPageSpine SetPageVariables + syn keyword mpDef SetPageVsize SetPageVstep StartCover StartPage + syn keyword mpDef StopCover StopPage SwapPageState innerenlarged + syn keyword mpDef llEnlarged lrEnlarged outerenlarged ulEnlarged + syn keyword mpDef urEnlarged + syn keyword mpVardef BackPageHeight BackPageWidth BackSpace BaseLineSkip + syn keyword mpVardef BodyFontSize BottomDistance BottomHeight + syn keyword mpVardef BottomSpace CoverHeight CoverWidth CurrentColumn + syn keyword mpVardef CurrentHeight CurrentWidth CutSpace EmWidth + syn keyword mpVardef ExHeight FooterDistance FooterHeight + syn keyword mpVardef FrontPageHeight FrontPageWidth HSize HeaderDistance + syn keyword mpVardef HeaderHeight InPageBody InnerEdgeDistance + syn keyword mpVardef InnerEdgeWidth InnerMarginDistance InnerMarginWidth + syn keyword mpVardef InnerSpaceWidth LastPageNumber LayoutColumnDistance + syn keyword mpVardef LayoutColumnWidth LayoutColumns LeftEdgeDistance + syn keyword mpVardef LeftEdgeWidth LeftMarginDistance LeftMarginWidth + syn keyword mpVardef LineHeight MakeupHeight MakeupWidth NOfColumns + syn keyword mpVardef NOfPages OnOddPage OnRightPage OuterEdgeDistance + syn keyword mpVardef OuterEdgeWidth OuterMarginDistance OuterMarginWidth + syn keyword mpVardef OuterSpaceWidth OverlayDepth OverlayHeight + syn keyword mpVardef OverlayLineWidth OverlayOffset OverlayWidth + syn keyword mpVardef PageDepth PageFraction PageNumber PageOffset + syn keyword mpVardef PaperBleed PaperHeight PaperWidth PrintPaperHeight + syn keyword mpVardef PrintPaperWidth RealPageNumber RightEdgeDistance + syn keyword mpVardef RightEdgeWidth RightMarginDistance RightMarginWidth + syn keyword mpVardef SpineHeight SpineWidth StrutDepth StrutHeight + syn keyword mpVardef TextHeight TextWidth TopDistance TopHeight TopSkip + syn keyword mpVardef TopSpace VSize defaultcolormodel + syn keyword mpVariable Area BackPage CoverPage CurrentLayout Field + syn keyword mpVariable FrontPage HorPos Hsize Hstep Location Page + syn keyword mpVariable PageStateAvailable RuleDepth RuleDirection + syn keyword mpVariable RuleFactor RuleH RuleHeight RuleOffset RuleOption + syn keyword mpVariable RuleThickness RuleV RuleWidth Spine VerPos Vsize + syn keyword mpVariable Vstep + syn keyword mpConstant context_page + " mp-shap.mpiv + syn keyword mpDef drawline drawshape some_shape + syn keyword mpDef start_predefined_shape_definition + syn keyword mpDef stop_predefined_shape_definition + syn keyword mpVardef drawpredefinedline drawpredefinedshape + syn keyword mpVardef some_shape_path + syn keyword mpVariable predefined_shapes predefined_shapes_xradius + syn keyword mpVariable predefined_shapes_xxradius + syn keyword mpVariable predefined_shapes_yradius + syn keyword mpVariable predefined_shapes_yyradius + syn keyword mpConstant context_shap + " mp-step.mpiv + syn keyword mpDef initialize_step_variables midbottomboundary + syn keyword mpDef midtopboundary step_begin_cell step_begin_chart + syn keyword mpDef step_cell_ali step_cell_bot step_cell_top + syn keyword mpDef step_cells step_end_cell step_end_chart + syn keyword mpDef step_text_bot step_text_mid step_text_top + syn keyword mpDef step_texts + syn keyword mpVariable cell_distance_x cell_distance_y cell_fill_color + syn keyword mpVariable cell_line_color cell_line_width cell_offset + syn keyword mpVariable chart_align chart_category chart_vertical + syn keyword mpVariable line_distance line_height line_line_color + syn keyword mpVariable line_line_width line_offset nofcells + syn keyword mpVariable text_distance_set text_fill_color text_line_color + syn keyword mpVariable text_line_width text_offset + syn keyword mpConstant context_cell + " mp-symb.mpiv + syn keyword mpDef finishglyph prepareglyph + syn keyword mpConstant lefttriangle midbar onebar righttriangle sidebar + syn keyword mpConstant sublefttriangle subrighttriangle twobar + " mp-text.mpiv + syn keyword mpDef build_parshape + syn keyword mpVardef found_point + syn keyword mpVariable trace_parshape + syn keyword mpConstant context_text + " mp-tool.mpiv + syn keyword mpCommand dump + syn keyword mpDef addbackground b_color beginglyph break centerarrow + syn keyword mpDef clearxy condition data_mpd_file detaileddraw + syn keyword mpDef detailpaths dowithpath draw drawboundary + syn keyword mpDef drawboundingbox drawcontrollines drawcontrolpoints + syn keyword mpDef drawfill draworigin drawpath drawpathonly + syn keyword mpDef drawpathwithpoints drawpoint drawpointlabels + syn keyword mpDef drawpoints drawticks drawwholepath drawxticks + syn keyword mpDef drawyticks endglyph fill finishsavingdata g_color + syn keyword mpDef inner_boundingbox job_name leftarrow loadmodule + syn keyword mpDef midarrowhead naturalizepaths newboolean newcolor + syn keyword mpDef newnumeric newpair newpath newpicture newstring + syn keyword mpDef newtransform normalcolors normaldraw normalfill + syn keyword mpDef normalwithcolor outer_boundingbox pop_boundingbox + syn keyword mpDef popboundingbox popcurrentpicture push_boundingbox + syn keyword mpDef pushboundingbox pushcurrentpicture r_color readfile + syn keyword mpDef recolor redraw refill register_dirty_chars + syn keyword mpDef remapcolor remapcolors remappedcolor reprocess + syn keyword mpDef resetarrows resetcolormap resetdrawoptions + syn keyword mpDef resolvedcolor restroke retext rightarrow savedata + syn keyword mpDef saveoptions scale_currentpicture set_ahlength + syn keyword mpDef set_grid showgrid startplaincompatibility + syn keyword mpDef startsavingdata stopplaincompatibility + syn keyword mpDef stopsavingdata stripe_path_a stripe_path_n undashed + syn keyword mpDef undrawfill untext visualizeddraw visualizedfill + syn keyword mpDef visualizepaths withcolor withgray + syn keyword mpDef xscale_currentpicture xshifted + syn keyword mpDef xyscale_currentpicture yscale_currentpicture + syn keyword mpDef yshifted + syn keyword mpVardef acos acosh anglebetween area arrowhead + syn keyword mpVardef arrowheadonpath arrowpath asciistring asin asinh + syn keyword mpVardef atan basiccolors bbheight bbwidth bcomponent + syn keyword mpVardef blackcolor bottomboundary boundingbox c_phantom + syn keyword mpVardef ccomponent center cleanstring colorcircle + syn keyword mpVardef colordecimals colordecimalslist colorlike colorpart + syn keyword mpVardef colortype complementary complemented copylist cos + syn keyword mpVardef cosh cot cotd curved ddddecimal dddecimal ddecimal + syn keyword mpVardef decorated drawarrowpath epsed exp freedotlabel + syn keyword mpVardef freelabel gcomponent getunstringed grayed greyed + syn keyword mpVardef hsvtorgb infinite innerboundingbox interpolated inv + syn keyword mpVardef invcos inverted invsin invtan laddered leftboundary + syn keyword mpVardef leftpath leftrightpath listsize listtocurves + syn keyword mpVardef listtolines ln log mcomponent new_on_grid + syn keyword mpVardef outerboundingbox paired pen_size penpoint phantom + syn keyword mpVardef pointarrow pow punked rangepath rcomponent + syn keyword mpVardef redecorated repathed rightboundary rightpath + syn keyword mpVardef rotation roundedsquare set_inner_boundingbox + syn keyword mpVardef set_outer_boundingbox setunstringed shapedlist + syn keyword mpVardef simplified sin sinh sortlist sqr straightpath tan + syn keyword mpVardef tand tanh tensecircle thefreelabel topboundary + syn keyword mpVardef tripled undecorated unitvector unspiked unstringed + syn keyword mpVardef whitecolor ycomponent + syn keyword mpPrimaryDef along blownup bottomenlarged cornered crossed + syn keyword mpPrimaryDef enlarged enlonged leftenlarged llenlarged llmoved + syn keyword mpPrimaryDef lrenlarged lrmoved on paralleled randomized + syn keyword mpPrimaryDef randomizedcontrols randomshifted rightenlarged + syn keyword mpPrimaryDef shortened sized smoothed snapped softened squeezed + syn keyword mpPrimaryDef stretched superellipsed topenlarged ulenlarged + syn keyword mpPrimaryDef ulmoved uncolored urenlarged urmoved xsized + syn keyword mpPrimaryDef xstretched xyscaled xysized ysized ystretched zmod + syn keyword mpSecondaryDef anglestriped intersection_point numberstriped + syn keyword mpSecondaryDef peepholed + syn keyword mpTertiaryDef cutends + syn keyword mpNewInternal ahdimple ahvariant anglelength anglemethod + syn keyword mpNewInternal angleoffset charscale cmykcolormodel graycolormodel + syn keyword mpNewInternal greycolormodel maxdimensions metapostversion + syn keyword mpNewInternal nocolormodel rgbcolormodel striped_normal_inner + syn keyword mpNewInternal striped_normal_outer striped_reverse_inner + syn keyword mpNewInternal striped_reverse_outer + syn keyword mpType grayscale greyscale quadruplet triplet + syn keyword mpVariable ahfactor collapse_data color_map drawoptionsfactor + syn keyword mpVariable freedotlabelsize freelabeloffset grid grid_full + syn keyword mpVariable grid_h grid_left grid_nx grid_ny grid_w grid_x + syn keyword mpVariable grid_y intersection_found originlength + syn keyword mpVariable plain_compatibility_data pointlabelfont + syn keyword mpVariable pointlabelscale refillbackground savingdata + syn keyword mpVariable savingdatadone swappointlabels ticklength tickstep + syn keyword mpConstant CRLF DQUOTE PERCENT SPACE bcircle context_tool crlf + syn keyword mpConstant darkblue darkcyan darkgray darkgreen darkmagenta + syn keyword mpConstant darkred darkyellow downtriangle dquote freesquare + syn keyword mpConstant fulldiamond fullsquare fulltriangle lcircle + syn keyword mpConstant lefttriangle lightgray llcircle lltriangle lrcircle + syn keyword mpConstant lrtriangle mpversion nocolor noline oddly + syn keyword mpConstant originpath percent rcircle righttriangle space + syn keyword mpConstant tcircle triangle ulcircle ultriangle unitcircle + syn keyword mpConstant unitdiamond unittriangle uptriangle urcircle + syn keyword mpConstant urtriangle +endif " MetaFun macros + " 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_mp_syntax_inits") - if version < 508 - let did_mp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink mpTeXinsert String - HiLink mpTeXbegin Statement - HiLink mpTeXend Statement - HiLink mpInternal mfInternal - HiLink mpMacro Macro - - delcommand HiLink -endif +hi def link mpTeXdelim mpPrimitive +hi def link mpBoolExp mfBoolExp +hi def link mpNumExp mfNumExp +hi def link mpPairExp mfPairExp +hi def link mpPathExp mfPathExp +hi def link mpPenExp mfPenExp +hi def link mpPicExp mfPicExp +hi def link mpStringExp mfStringExp +hi def link mpInternal mfInternal +hi def link mpCommand mfCommand +hi def link mpType mfType +hi def link mpPrimitive mfPrimitive +hi def link mpDef mfDef +hi def link mpVardef mpDef +hi def link mpPrimaryDef mpDef +hi def link mpSecondaryDef mpDef +hi def link mpTertiaryDef mpDef +hi def link mpNewInternal mpInternal +hi def link mpVariable mfVariable +hi def link mpConstant mfConstant +hi def link mpOnOff mpPrimitive +hi def link mpDash mpPrimitive +hi def link mpTeXKeyword Identifier let b:current_syntax = "mp" -" vim: ts=8 +let &cpo = s:cpo_sav +unlet! s:cpo_sav + +" vim:sw=2 diff --git a/runtime/syntax/mplayerconf.vim b/runtime/syntax/mplayerconf.vim index b348327f90..84ad2daf13 100644 --- a/runtime/syntax/mplayerconf.vim +++ b/runtime/syntax/mplayerconf.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: mplayer(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: mplayer(1) configuration file +" Maintainer: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-01-24 if exists("b:current_syntax") finish @@ -19,7 +20,7 @@ syn region mplayerconfComment display oneline start='#' end='$' syn keyword mplayerconfPreProc include -syn keyword mplayerconfBoolean yes no +syn keyword mplayerconfBoolean yes no true false syn match mplayerconfNumber '\<\d\+\>' @@ -68,7 +69,49 @@ syn keyword mplayerconfOption hardframedrop nomouseinput bandwidth dumpstream \ audio-delay audio-preload endpos ffourcc \ include info noautoexpand noskip o oac of \ ofps ovc skiplimit v vobsubout vobsuboutid - \ lameopts lavcopts nuvopts xvidencopts + \ lameopts lavcopts nuvopts xvidencopts a52drc + \ adapter af-add af-clr af-del af-pre + \ allow-dangerous-playlist-parsing ass + \ ass-border-color ass-bottom-margin ass-color + \ ass-font-scale ass-force-style ass-hinting + \ ass-line-spacing ass-styles ass-top-margin + \ ass-use-margins ausid bluray-angle + \ bluray-device border border-pos-x border-pos-y + \ cache-min cache-seek-min capture codecpath + \ codecs-file correct-pts crash-debug + \ doubleclick-time dvd-speed edl-backward-delay + \ edl-start-pts embeddedfonts fafmttag + \ field-dominance fontconfig force-avi-aspect + \ force-key-frames frameno-file fullscreen gamma + \ gui gui-include gui-wid heartbeat-cmd + \ heartbeat-interval hr-edl-seek + \ http-header-fields idle ignore-start + \ key-fifo-size list-properties menu-chroot + \ menu-keepdir menu-startup mixer-channel + \ monitor-orientation monitorpixelaspect + \ mouse-movements msgcharset msgcolor msglevel + \ msgmodule name noar nocache noconfig + \ noconsolecontrols nocorrect-pts nodouble + \ noedl-start-pts noencodedups + \ noflip-hebrew-commas nogui noidx noodml + \ nostop-xscreensaver nosub noterm-osd + \ osd-duration osd-fractions panscanrange + \ pausing playing-msg priority profile + \ progbar-align psprobe pvr radio referrer + \ refreshrate reuse-socket rtc rtc-device + \ rtsp-destination rtsp-port + \ rtsp-stream-over-http screenh show-profile + \ softvol softvol-max sub-paths subfont + \ term-osd-esc title tvscan udp-ip udp-master + \ udp-port udp-seek-threshold udp-slave + \ unrarexec use-filedir-conf use-filename-title + \ vf-add vf-clr vf-del vf-pre volstep volume + \ zrhdec zrydoff + +syn region mplayerconfString display oneline start=+"+ end=+"+ +syn region mplayerconfString display oneline start=+'+ end=+'+ + +syn region mplayerconfProfile display oneline start='^\s*\[' end='\]' hi def link mplayerconfTodo Todo hi def link mplayerconfComment Comment @@ -76,6 +119,8 @@ hi def link mplayerconfPreProc PreProc hi def link mplayerconfBoolean Boolean hi def link mplayerconfNumber Number hi def link mplayerconfOption Keyword +hi def link mplayerconfString String +hi def link mplayerconfProfile Special let b:current_syntax = "mplayerconf" diff --git a/runtime/syntax/msidl.vim b/runtime/syntax/msidl.vim index 79585bebc6..57eaecaa4f 100644 --- a/runtime/syntax/msidl.vim +++ b/runtime/syntax/msidl.vim @@ -3,11 +3,8 @@ " Maintainer: Vadim Zeitlin <vadim@wxwindows.org> " Last Change: 2012 Feb 12 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -56,39 +53,29 @@ syn region msidlSafeArray start="SAFEARRAY(" end=")" contains=msidlStandar syn sync lines=50 " 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_msidl_syntax_inits") - if version < 508 - let did_msidl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink msidlInclude Include - HiLink msidlPreProc PreProc - HiLink msidlPreCondit PreCondit - HiLink msidlDefine Macro - HiLink msidlIncluded String - HiLink msidlString String - HiLink msidlComment Comment - HiLink msidlTodo Todo - HiLink msidlSpecial SpecialChar - HiLink msidlLiteral Number - HiLink msidlUUID Number - - HiLink msidlImport Include - HiLink msidlEnum StorageClass - HiLink msidlStruct Structure - HiLink msidlTypedef Typedef - HiLink msidlAttribute StorageClass - - HiLink msidlStandardType Type - HiLink msidlSafeArray Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link msidlInclude Include +hi def link msidlPreProc PreProc +hi def link msidlPreCondit PreCondit +hi def link msidlDefine Macro +hi def link msidlIncluded String +hi def link msidlString String +hi def link msidlComment Comment +hi def link msidlTodo Todo +hi def link msidlSpecial SpecialChar +hi def link msidlLiteral Number +hi def link msidlUUID Number + +hi def link msidlImport Include +hi def link msidlEnum StorageClass +hi def link msidlStruct Structure +hi def link msidlTypedef Typedef +hi def link msidlAttribute StorageClass + +hi def link msidlStandardType Type +hi def link msidlSafeArray Type + let b:current_syntax = "msidl" diff --git a/runtime/syntax/msmessages.vim b/runtime/syntax/msmessages.vim index 60588571c9..5faee978b4 100644 --- a/runtime/syntax/msmessages.vim +++ b/runtime/syntax/msmessages.vim @@ -7,11 +7,8 @@ " See format description at <http://msdn2.microsoft.com/en-us/library/aa385646.aspx> " This file is based on the rc.vim and c.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/msql.vim b/runtime/syntax/msql.vim index 0716fbb1f6..60e75a7ef6 100644 --- a/runtime/syntax/msql.vim +++ b/runtime/syntax/msql.vim @@ -8,11 +8,8 @@ " Options msql_sql_query = 1 for SQL syntax highligthing inside strings " msql_minlines = x to sync at least x lines backwards -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,12 +17,8 @@ if !exists("main_syntax") let main_syntax = 'msql' endif -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/html.vim +unlet b:current_syntax syn cluster htmlPreproc add=msqlRegion @@ -57,39 +50,29 @@ else endif " 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_msql_syn_inits") - if version < 508 - let did_msql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink msqlComment Comment - HiLink msqlString String - HiLink msqlNumber Number - HiLink msqlFloat Float - HiLink msqlIdentifier Identifier - HiLink msqlGlobalIdentifier Identifier - HiLink msqlIntVar Identifier - HiLink msqlEnvVar Identifier - HiLink msqlFunctions Function - HiLink msqlRepeat Repeat - HiLink msqlConditional Conditional - HiLink msqlStatement Statement - HiLink msqlType Type - HiLink msqlInclude Include - HiLink msqlDefine Define - HiLink msqlSpecialChar SpecialChar - HiLink msqlParentError Error - HiLink msqlTodo Todo - HiLink msqlOperator Operator - HiLink msqlRelation Operator - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link msqlComment Comment +hi def link msqlString String +hi def link msqlNumber Number +hi def link msqlFloat Float +hi def link msqlIdentifier Identifier +hi def link msqlGlobalIdentifier Identifier +hi def link msqlIntVar Identifier +hi def link msqlEnvVar Identifier +hi def link msqlFunctions Function +hi def link msqlRepeat Repeat +hi def link msqlConditional Conditional +hi def link msqlStatement Statement +hi def link msqlType Type +hi def link msqlInclude Include +hi def link msqlDefine Define +hi def link msqlSpecialChar SpecialChar +hi def link msqlParentError Error +hi def link msqlTodo Todo +hi def link msqlOperator Operator +hi def link msqlRelation Operator + let b:current_syntax = "msql" diff --git a/runtime/syntax/mupad.vim b/runtime/syntax/mupad.vim index 109f880ee1..55ea9c4e43 100644 --- a/runtime/syntax/mupad.vim +++ b/runtime/syntax/mupad.vim @@ -5,11 +5,8 @@ " Date: 6/30/2004 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -268,28 +265,19 @@ syn keyword mupadIdentifier Tubular " graphics meta-documentation Attributes syn keyword mupadIdentifier objectGroupsListed -if version >= 508 || !exists("did_mupad_syntax_inits") - if version < 508 - let did_mupad_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink mupadComment Comment - HiLink mupadString String - HiLink mupadOperator Operator - HiLink mupadSpecial Special - HiLink mupadStatement Statement - HiLink mupadUnderlined Underlined - HiLink mupadConditional Conditional - HiLink mupadRepeat Repeat - HiLink mupadFunction Function - HiLink mupadType Type - HiLink mupadDefine Define - HiLink mupadIdentifier Identifier +hi def link mupadComment Comment +hi def link mupadString String +hi def link mupadOperator Operator +hi def link mupadSpecial Special +hi def link mupadStatement Statement +hi def link mupadUnderlined Underlined +hi def link mupadConditional Conditional +hi def link mupadRepeat Repeat +hi def link mupadFunction Function +hi def link mupadType Type +hi def link mupadDefine Define +hi def link mupadIdentifier Identifier - delcommand HiLink -endif " TODO More comprehensive listing. diff --git a/runtime/syntax/murphi.vim b/runtime/syntax/murphi.vim new file mode 100644 index 0000000000..b2faa8c119 --- /dev/null +++ b/runtime/syntax/murphi.vim @@ -0,0 +1,127 @@ +" Vim syntax file +" Language: Murphi model checking language +" Maintainer: Matthew Fernandez <matthew.fernandez@gmail.com> +" Last Change: 2017 Aug 27 +" Version: 2 +" Remark: Originally authored by Diego Ongaro <ongaro@cs.stanford.edu> + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Keywords are case insensitive. +" Keep these in alphabetical order. +syntax case ignore +syn keyword murphiKeyword alias +syn keyword murphiStructure array +syn keyword murphiKeyword assert +syn keyword murphiKeyword begin +syn keyword murphiType boolean +syn keyword murphiKeyword by +syn keyword murphiLabel case +syn keyword murphiKeyword clear +syn keyword murphiLabel const +syn keyword murphiRepeat do +syn keyword murphiConditional else +syn keyword murphiConditional elsif +syn keyword murphiKeyword end +syn keyword murphiKeyword endalias +syn keyword murphiRepeat endexists +syn keyword murphiRepeat endfor +syn keyword murphiRepeat endforall +syn keyword murphiKeyword endfunction +syn keyword murphiConditional endif +syn keyword murphiKeyword endprocedure +syn keyword murphiStructure endrecord +syn keyword murphiKeyword endrule +syn keyword murphiKeyword endruleset +syn keyword murphiKeyword endstartstate +syn keyword murphiConditional endswitch +syn keyword murphiRepeat endwhile +syn keyword murphiStructure enum +syn keyword murphiKeyword error +syn keyword murphiRepeat exists +syn keyword murphiBoolean false +syn keyword murphiRepeat for +syn keyword murphiRepeat forall +syn keyword murphiKeyword function +syn keyword murphiConditional if +syn keyword murphiKeyword in +syn keyword murphiKeyword interleaved +syn keyword murphiLabel invariant +syn keyword murphiFunction ismember +syn keyword murphiFunction isundefined +syn keyword murphiKeyword log +syn keyword murphiStructure of +syn keyword murphiType multiset +syn keyword murphiFunction multisetadd +syn keyword murphiFunction multisetcount +syn keyword murphiFunction multisetremove +syn keyword murphiFunction multisetremovepred +syn keyword murphiKeyword procedure +syn keyword murphiKeyword process +syn keyword murphiKeyword program +syn keyword murphiKeyword put +syn keyword murphiStructure record +syn keyword murphiKeyword return +syn keyword murphiLabel rule +syn keyword murphiLabel ruleset +syn keyword murphiType scalarset +syn keyword murphiLabel startstate +syn keyword murphiConditional switch +syn keyword murphiConditional then +syn keyword murphiRepeat to +syn keyword murphiKeyword traceuntil +syn keyword murphiBoolean true +syn keyword murphiLabel type +syn keyword murphiKeyword undefine +syn keyword murphiStructure union +syn keyword murphiLabel var +syn keyword murphiRepeat while + +syn keyword murphiTodo contained todo xxx fixme +syntax case match + +" Integers. +syn match murphiNumber "\<\d\+\>" + +" Operators and special characters. +syn match murphiOperator "[\+\-\*\/%&|=!<>:\?]\|\." +syn match murphiDelimiter "\(:[^=]\|[;,]\)" +syn match murphiSpecial "[()\[\]]" + +" Double equal sign is a common error: use one equal sign for equality testing. +syn match murphiError "==[^>]"he=e-1 +" Double && and || are errors. +syn match murphiError "&&\|||" + +" Strings. This is defined so late so that it overrides previous matches. +syn region murphiString start=+"+ end=+"+ + +" Comments. This is defined so late so that it overrides previous matches. +syn region murphiComment start="--" end="$" contains=murphiTodo +syn region murphiComment start="/\*" end="\*/" contains=murphiTodo + +" Link the rules to some groups. +hi def link murphiComment Comment +hi def link murphiString String +hi def link murphiNumber Number +hi def link murphiBoolean Boolean +hi def link murphiIdentifier Identifier +hi def link murphiFunction Function +hi def link murphiStatement Statement +hi def link murphiConditional Conditional +hi def link murphiRepeat Repeat +hi def link murphiLabel Label +hi def link murphiOperator Operator +hi def link murphiKeyword Keyword +hi def link murphiType Type +hi def link murphiStructure Structure +hi def link murphiSpecial Special +hi def link murphiDelimiter Delimiter +hi def link murphiError Error +hi def link murphiTodo Todo + +let b:current_syntax = "murphi" diff --git a/runtime/syntax/mush.vim b/runtime/syntax/mush.vim index 0645f33565..efaae50ae3 100644 --- a/runtime/syntax/mush.vim +++ b/runtime/syntax/mush.vim @@ -3,11 +3,8 @@ " Based on vim Syntax file by: Bek Oberin <gossamer@tertius.net.au> " Last Updated: Fri Nov 04 20:28:15 2005 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -185,42 +182,33 @@ syntax keyword mushAttribute use va vb vc vd ve vf vg vh vi vj vk vl vm vn syntax keyword mushAttribute vo vp vq vr vs vt vu vv vw vx vy vz -if version >= 508 || !exists("did_mush_syntax_inits") - if version < 508 - let did_mush_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink mushAttribute Constant - HiLink mushCommand Function - HiLink mushNumber Number - HiLink mushSetting PreProc - HiLink mushFunction Statement - HiLink mushVariable Identifier - HiLink mushSpecial Special - HiLink mushTodo Todo - HiLink mushFlag Special - HiLink mushIdentifier Identifier - HiLink mushDefine Macro - HiLink mushPreProc PreProc - HiLink mushPreProcGroup PreProc - HiLink mushPreCondit PreCondit - HiLink mushIncluded cString - HiLink mushInclude Include + +" The default methods for highlighting. Can be overridden later +hi def link mushAttribute Constant +hi def link mushCommand Function +hi def link mushNumber Number +hi def link mushSetting PreProc +hi def link mushFunction Statement +hi def link mushVariable Identifier +hi def link mushSpecial Special +hi def link mushTodo Todo +hi def link mushFlag Special +hi def link mushIdentifier Identifier +hi def link mushDefine Macro +hi def link mushPreProc PreProc +hi def link mushPreProcGroup PreProc +hi def link mushPreCondit PreCondit +hi def link mushIncluded cString +hi def link mushInclude Include " Comments - HiLink mushCommentStart mushComment - HiLink mushComment Comment - HiLink mushCommentString mushString +hi def link mushCommentStart mushComment +hi def link mushComment Comment +hi def link mushCommentString mushString - delcommand HiLink -endif let b:current_syntax = "mush" diff --git a/runtime/syntax/muttrc.vim b/runtime/syntax/muttrc.vim index abe9bfd76b..830664e0eb 100644 --- a/runtime/syntax/muttrc.vim +++ b/runtime/syntax/muttrc.vim @@ -2,16 +2,12 @@ " Language: Mutt setup files " Original: Preben 'Peppe' Guldberg <peppe-vim@wielders.org> " Maintainer: Kyle Wheeler <kyle-muttrc.vim@memoryhole.net> -" Last Change: 2 Feb 2012 +" Last Change: 21 May 2018 -" This file covers mutt version 1.5.21 (and most of the mercurial tip) -" Included are also a few features from 1.4.2.1 +" This file covers mutt version 1.10.0 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,11 +15,7 @@ let s:cpo_save = &cpo set cpo&vim " Set the keyword characters -if version < 600 - set isk=@,48-57,_,- -else - setlocal isk=@,48-57,_,- -endif +setlocal isk=@,48-57,_,- " handling optional variables if !exists("use_mutt_sidebar") @@ -98,7 +90,7 @@ syn match muttrcSetNumAssignment contained skipwhite /=\s*'\d\+'/hs=s+1 nextgrou " Now catch some email addresses and headers (purified version from mail.vim) syn match muttrcEmail "[a-zA-Z0-9._-]\+@[a-zA-Z0-9./-]\+" -syn match muttrcHeader "\<\%(From\|To\|C[Cc]\|B[Cc][Cc]\|Reply-To\|Subject\|Return-Path\|Received\|Date\|Replied\|Attach\)\>:\=" +syn match muttrcHeader "\<\c\%(From\|To\|C[Cc]\|B[Cc][Cc]\|Reply-To\|Subject\|Return-Path\|Received\|Date\|Replied\|Attach\)\>:\=" syn match muttrcKeySpecial contained +\%(\\[Cc'"]\|\^\|\\[01]\d\{2}\)+ syn match muttrcKey contained "\S\+" contains=muttrcKeySpecial,muttrcKeyName @@ -109,143 +101,179 @@ syn match muttrcKeyName contained "\\[trne]" syn match muttrcKeyName contained "\c<\%(BackSpace\|BackTab\|Delete\|Down\|End\|Enter\|Esc\|Home\|Insert\|Left\|PageDown\|PageUp\|Return\|Right\|Space\|Tab\|Up\)>" syn match muttrcKeyName contained "<F[0-9]\+>" -syn keyword muttrcVarBool skipwhite contained allow_8bit allow_ansi arrow_cursor ascii_chars askbcc askcc attach_split auto_tag autoedit beep beep_new nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained bounce_delivered braille_friendly check_new check_mbox_size nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained collapse_unread confirmappend confirmcreate crypt_autoencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained crypt_autopgp crypt_autosign crypt_autosmime crypt_replyencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained crypt_replysign crypt_replysignencrypted crypt_timestamp nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained crypt_use_gpgme crypt_use_pka delete_untag digest_collapse duplicate_threads nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained edit_hdrs edit_headers encode_from envelope_from fast_reply nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained fcc_clear followup_to force_name forw_decode nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained forw_decrypt forw_quote forward_decode forward_decrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained forward_quote hdrs header help hidden_host hide_limited nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained hide_missing hide_thread_subject hide_top_limited nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained hide_top_missing honor_disposition ignore_linear_white_space ignore_list_reply_to imap_check_subscribed nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained imap_list_subscribed imap_passive imap_peek imap_servernoise nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained implicit_autoview include_onlyfirst keep_flagged nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained mailcap_sanitize maildir_header_cache_verify maildir_trash nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained mark_old markers menu_move_off menu_scroll message_cache_clean meta_key nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained metoo mh_purge mime_forward_decode narrow_tree pager_stop nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_auto_decode pgp_auto_traditional pgp_autoencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_autoinline pgp_autosign pgp_check_exit nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_create_traditional pgp_ignore_subkeys pgp_long_ids nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_replyencrypt pgp_replyinline pgp_replysign nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_replysignencrypted pgp_retainable_sigs pgp_show_unusable nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pgp_strict_enc pgp_use_gpg_agent pipe_decode pipe_split nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained pop_auth_try_all pop_last print_decode print_split nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained prompt_after read_only reply_self resolve reverse_alias nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained reverse_name reverse_realname rfc2047_parameters save_address nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained save_empty save_name score sig_dashes sig_on_top nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained smart_wrap smime_ask_cert_label smime_decrypt_use_default_key nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained smime_is_default sort_re ssl_force_tls ssl_use_sslv2 nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained ssl_use_sslv3 ssl_use_tlsv1 ssl_usesystemcerts ssl_verify_dates ssl_verify_host status_on_top nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained strict_mime strict_threads suspend text_flowed thorough_search nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained thread_received tilde uncollapse_jump use_8bitmime nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained use_domain use_envelope_from use_from use_idn use_ipv6 nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained user_agent wait_key weed wrap_search write_bcc nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr - -syn keyword muttrcVarBool skipwhite contained noallow_8bit noallow_ansi noarrow_cursor noascii_chars noaskbcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noaskcc noattach_split noauto_tag noautoedit nobeep nobeep_new nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nobounce_delivered nobraille_friendly nocheck_new nocollapse_unread nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noconfirmappend noconfirmcreate nocrypt_autoencrypt nocrypt_autopgp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nocrypt_autosign nocrypt_autosmime nocrypt_replyencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nocrypt_replysign nocrypt_replysignencrypted nocrypt_timestamp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nocrypt_use_gpgme nodelete_untag nodigest_collapse noduplicate_threads nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noedit_hdrs noedit_headers noencode_from noenvelope_from nofast_reply nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nofcc_clear nofollowup_to noforce_name noforw_decode nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noforw_decrypt noforw_quote noforward_decode noforward_decrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noforward_quote nohdrs noheader nohelp nohidden_host nohide_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nohide_missing nohide_thread_subject nohide_top_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nohide_top_missing nohonor_disposition noignore_list_reply_to noimap_check_subscribed nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noimap_list_subscribed noimap_passive noimap_peek noimap_servernoise nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noimplicit_autoview noinclude_onlyfirst nokeep_flagged nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nomailcap_sanitize nomaildir_header_cache_verify nomaildir_trash nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nomark_old nomarkers nomenu_move_off nomenu_scroll nometa_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nometoo nomh_purge nomime_forward_decode nonarrow_tree nopager_stop nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_auto_decode nopgp_auto_traditional nopgp_autoencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_autoinline nopgp_autosign nopgp_check_exit nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_create_traditional nopgp_ignore_subkeys nopgp_long_ids nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_replyencrypt nopgp_replyinline nopgp_replysign nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_replysignencrypted nopgp_retainable_sigs nopgp_show_unusable nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopgp_strict_enc nopgp_use_gpg_agent nopipe_decode nopipe_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nopop_auth_try_all nopop_last noprint_decode noprint_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noprompt_after noread_only noreply_self noresolve noreverse_alias nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained noreverse_name noreverse_realname norfc2047_parameters nosave_address nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nosave_empty nosave_name noscore nosig_dashes nosig_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nosmart_wrap nosmime_ask_cert_label nosmime_decrypt_use_default_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nosmime_is_default nosort_re nossl_force_tls nossl_use_sslv2 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nossl_use_sslv3 nossl_use_tlsv1 nossl_usesystemcerts nostatus_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nostrict_threads nosuspend notext_flowed nothorough_search nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nothread_received notilde nouncollapse_jump nouse_8bitmime nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nouse_domain nouse_envelope_from nouse_from nouse_idn nouse_ipv6 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained nouser_agent nowait_key noweed nowrap_search nowrite_bcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr - -syn keyword muttrcVarBool skipwhite contained invallow_8bit invallow_ansi invarrow_cursor invascii_chars invaskbcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invaskcc invattach_split invauto_tag invautoedit invbeep invbeep_new nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invbounce_delivered invbraille_friendly invcheck_new invcollapse_unread nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invconfirmappend invconfirmcreate invcrypt_autoencrypt invcrypt_autopgp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invcrypt_autosign invcrypt_autosmime invcrypt_replyencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invcrypt_replysign invcrypt_replysignencrypted invcrypt_timestamp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invcrypt_use_gpgme invdelete_untag invdigest_collapse invduplicate_threads nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invedit_hdrs invedit_headers invencode_from invenvelope_from invfast_reply nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invfcc_clear invfollowup_to invforce_name invforw_decode nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invforw_decrypt invforw_quote invforward_decode invforward_decrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invforward_quote invhdrs invheader invhelp invhidden_host invhide_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invhide_missing invhide_thread_subject invhide_top_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invhide_top_missing invhonor_disposition invignore_list_reply_to invimap_check_subscribed nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invimap_list_subscribed invimap_passive invimap_peek invimap_servernoise nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invimplicit_autoview invinclude_onlyfirst invkeep_flagged nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invmailcap_sanitize invmaildir_header_cache_verify invmaildir_trash nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invmark_old invmarkers invmenu_move_off invmenu_scroll invmeta_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invmetoo invmh_purge invmime_forward_decode invnarrow_tree invpager_stop nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_auto_decode invpgp_auto_traditional invpgp_autoencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_autoinline invpgp_autosign invpgp_check_exit nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_create_traditional invpgp_ignore_subkeys invpgp_long_ids nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_replyencrypt invpgp_replyinline invpgp_replysign nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_replysignencrypted invpgp_retainable_sigs invpgp_show_unusable nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpgp_strict_enc invpgp_use_gpg_agent invpipe_decode invpipe_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invpop_auth_try_all invpop_last invprint_decode invprint_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invprompt_after invread_only invreply_self invresolve invreverse_alias nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invreverse_name invreverse_realname invrfc2047_parameters invsave_address nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invsave_empty invsave_name invscore invsig_dashes invsig_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invsmart_wrap invsmime_ask_cert_label invsmime_decrypt_use_default_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invsmime_is_default invsort_re invssl_force_tls invssl_use_sslv2 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invssl_use_sslv3 invssl_use_tlsv1 invssl_usesystemcerts invstatus_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invstrict_threads invsuspend invtext_flowed invthorough_search nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invthread_received invtilde invuncollapse_jump invuse_8bitmime nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invuse_domain invuse_envelope_from invuse_from invuse_idn invuse_ipv6 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarBool skipwhite contained invuser_agent invwait_key invweed invwrap_search invwrite_bcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -if use_mutt_sidebar == 1 - syn keyword muttrcVarBool skipwhite contained sidebar_visible sidebar_sort nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -endif - -syn keyword muttrcVarQuad skipwhite contained abort_nosubject abort_unmodified bounce copy nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained crypt_verify_sig delete fcc_attach forward_edit honor_followup_to nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained include mime_forward mime_forward_rest mime_fwd move nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained pgp_mime_auto pgp_verify_sig pop_delete pop_reconnect nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained postpone print quit recall reply_to ssl_starttls nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr - -syn keyword muttrcVarQuad skipwhite contained noabort_nosubject noabort_unmodified nobounce nocopy nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained nocrypt_verify_sig nodelete nofcc_attach noforward_edit nohonor_followup_to nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained noinclude nomime_forward nomime_forward_rest nomime_fwd nomove nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained nopgp_mime_auto nopgp_verify_sig nopop_delete nopop_reconnect nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained nopostpone noprint noquit norecall noreply_to nossl_starttls nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr - -syn keyword muttrcVarQuad skipwhite contained invabort_nosubject invabort_unmodified invbounce invcopy nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained invcrypt_verify_sig invdelete invfcc_attach invforward_edit invhonor_followup_to nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained invinclude invmime_forward invmime_forward_rest invmime_fwd invmove nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained invpgp_mime_auto invpgp_verify_sig invpop_delete invpop_reconnect nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarQuad skipwhite contained invpostpone invprint invquit invrecall invreply_to invssl_starttls nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr - -syn keyword muttrcVarNum skipwhite contained connect_timeout history imap_keepalive imap_pipeline_depth mail_check nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarNum skipwhite contained menu_context net_inc pager_context pager_index_lines pgp_timeout nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarNum skipwhite contained pop_checkinterval read_inc save_history score_threshold_delete nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarNum skipwhite contained score_threshold_flag score_threshold_read search_context sendmail_wait sleep_time nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarNum skipwhite contained smime_timeout ssl_min_dh_prime_bits timeout time_inc wrap wrapmargin nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarNum skipwhite contained write_inc nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -if use_mutt_sidebar == 1 - syn keyword muttrcVarNum skipwhite contained sidebar_width nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -endif +syn keyword muttrcVarBool skipwhite contained + \ allow_8bit allow_ansi arrow_cursor ascii_chars askbcc askcc attach_split + \ auto_tag autoedit beep beep_new bounce_delivered braille_friendly + \ browser_abbreviate_mailboxes change_folder_next check_mbox_size check_new + \ collapse_unread confirmappend confirmcreate crypt_autoencrypt crypt_autopgp + \ crypt_autosign crypt_autosmime crypt_confirmhook crypt_opportunistic_encrypt + \ crypt_replyencrypt crypt_replysign crypt_replysignencrypted crypt_timestamp + \ crypt_use_gpgme crypt_use_pka delete_untag digest_collapse duplicate_threads + \ edit_hdrs edit_headers encode_from envelope_from fast_reply fcc_clear + \ flag_safe followup_to force_name forw_decode forw_decrypt forw_quote + \ forward_decode forward_decrypt forward_quote hdrs header + \ header_color_partial help hidden_host hide_limited hide_missing + \ hide_thread_subject hide_top_limited hide_top_missing history_remove_dups + \ honor_disposition idn_decode idn_encode ignore_linear_white_space + \ ignore_list_reply_to imap_check_subscribed imap_list_subscribed imap_passive + \ imap_peek imap_servernoise implicit_autoview include_onlyfirst keep_flagged + \ mail_check_recent mail_check_stats mailcap_sanitize maildir_check_cur + \ maildir_header_cache_verify maildir_trash mark_old markers menu_move_off + \ menu_scroll message_cache_clean meta_key metoo mh_purge mime_forward_decode + \ mime_type_query_first narrow_tree pager_stop pgp_auto_decode + \ pgp_auto_traditional pgp_autoencrypt pgp_autoinline pgp_autosign + \ pgp_check_exit pgp_create_traditional pgp_ignore_subkeys pgp_long_ids + \ pgp_replyencrypt pgp_replyinline pgp_replysign pgp_replysignencrypted + \ pgp_retainable_sigs pgp_self_encrypt pgp_self_encrypt_as pgp_show_unusable + \ pgp_strict_enc pgp_use_gpg_agent pipe_decode pipe_split pop_auth_try_all + \ pop_last postpone_encrypt postpone_encrypt_as print_decode print_split + \ prompt_after read_only reflow_space_quotes reflow_text reflow_wrap + \ reply_self resolve resume_draft_files resume_edited_draft_files + \ reverse_alias reverse_name reverse_realname rfc2047_parameters save_address + \ save_empty save_name score sidebar_folder_indent sidebar_new_mail_only + \ sidebar_next_new_wrap sidebar_short_path sidebar_sort sidebar_visible + \ sig_dashes sig_on_top smart_wrap smime_ask_cert_label + \ smime_decrypt_use_default_key smime_is_default smime_self_encrypt + \ smime_self_encrypt_as sort_re ssl_force_tls ssl_use_sslv2 ssl_use_sslv3 + \ ssl_use_tlsv1 ssl_usesystemcerts ssl_verify_dates ssl_verify_host + \ ssl_verify_partial_chains status_on_top strict_mime strict_threads suspend + \ text_flowed thorough_search thread_received tilde ts_enabled uncollapse_jump + \ use_8bitmime use_domain use_envelope_from use_from use_idn use_ipv6 + \ uncollapse_new user_agent wait_key weed wrap_search write_bcc + \ nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarBool skipwhite contained + \ noallow_8bit noallow_ansi noarrow_cursor noascii_chars noaskbcc noaskcc + \ noattach_split noauto_tag noautoedit nobeep nobeep_new nobounce_delivered + \ nobraille_friendly nobrowser_abbreviate_mailboxes nochange_folder_next + \ nocheck_mbox_size nocheck_new nocollapse_unread noconfirmappend + \ noconfirmcreate nocrypt_autoencrypt nocrypt_autopgp nocrypt_autosign + \ nocrypt_autosmime nocrypt_confirmhook nocrypt_opportunistic_encrypt + \ nocrypt_replyencrypt nocrypt_replysign nocrypt_replysignencrypted + \ nocrypt_timestamp nocrypt_use_gpgme nocrypt_use_pka nodelete_untag + \ nodigest_collapse noduplicate_threads noedit_hdrs noedit_headers + \ noencode_from noenvelope_from nofast_reply nofcc_clear noflag_safe + \ nofollowup_to noforce_name noforw_decode noforw_decrypt noforw_quote + \ noforward_decode noforward_decrypt noforward_quote nohdrs noheader + \ noheader_color_partial nohelp nohidden_host nohide_limited nohide_missing + \ nohide_thread_subject nohide_top_limited nohide_top_missing + \ nohistory_remove_dups nohonor_disposition noidn_decode noidn_encode + \ noignore_linear_white_space noignore_list_reply_to noimap_check_subscribed + \ noimap_list_subscribed noimap_passive noimap_peek noimap_servernoise + \ noimplicit_autoview noinclude_onlyfirst nokeep_flagged nomail_check_recent + \ nomail_check_stats nomailcap_sanitize nomaildir_check_cur + \ nomaildir_header_cache_verify nomaildir_trash nomark_old nomarkers + \ nomenu_move_off nomenu_scroll nomessage_cache_clean nometa_key nometoo + \ nomh_purge nomime_forward_decode nomime_type_query_first nonarrow_tree + \ nopager_stop nopgp_auto_decode nopgp_auto_traditional nopgp_autoencrypt + \ nopgp_autoinline nopgp_autosign nopgp_check_exit nopgp_create_traditional + \ nopgp_ignore_subkeys nopgp_long_ids nopgp_replyencrypt nopgp_replyinline + \ nopgp_replysign nopgp_replysignencrypted nopgp_retainable_sigs + \ nopgp_self_encrypt nopgp_self_encrypt_as nopgp_show_unusable + \ nopgp_strict_enc nopgp_use_gpg_agent nopipe_decode nopipe_split + \ nopop_auth_try_all nopop_last nopostpone_encrypt nopostpone_encrypt_as + \ noprint_decode noprint_split noprompt_after noread_only + \ noreflow_space_quotes noreflow_text noreflow_wrap noreply_self noresolve + \ noresume_draft_files noresume_edited_draft_files noreverse_alias + \ noreverse_name noreverse_realname norfc2047_parameters nosave_address + \ nosave_empty nosave_name noscore nosidebar_folder_indent + \ nosidebar_new_mail_only nosidebar_next_new_wrap nosidebar_short_path + \ nosidebar_sort nosidebar_visible nosig_dashes nosig_on_top nosmart_wrap + \ nosmime_ask_cert_label nosmime_decrypt_use_default_key nosmime_is_default + \ nosmime_self_encrypt nosmime_self_encrypt_as nosort_re nossl_force_tls + \ nossl_use_sslv2 nossl_use_sslv3 nossl_use_tlsv1 nossl_usesystemcerts + \ nossl_verify_dates nossl_verify_host nossl_verify_partial_chains + \ nostatus_on_top nostrict_mime nostrict_threads nosuspend notext_flowed + \ nothorough_search nothread_received notilde nots_enabled nouncollapse_jump + \ nouse_8bitmime nouse_domain nouse_envelope_from nouse_from nouse_idn + \ nouse_ipv6 nouncollapse_new nouser_agent nowait_key noweed nowrap_search + \ nowrite_bcc + \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarBool skipwhite contained + \ invallow_8bit invallow_ansi invarrow_cursor invascii_chars invaskbcc + \ invaskcc invattach_split invauto_tag invautoedit invbeep invbeep_new + \ invbounce_delivered invbraille_friendly invbrowser_abbreviate_mailboxes + \ invchange_folder_next invcheck_mbox_size invcheck_new invcollapse_unread + \ invconfirmappend invconfirmcreate invcrypt_autoencrypt invcrypt_autopgp + \ invcrypt_autosign invcrypt_autosmime invcrypt_confirmhook + \ invcrypt_opportunistic_encrypt invcrypt_replyencrypt invcrypt_replysign + \ invcrypt_replysignencrypted invcrypt_timestamp invcrypt_use_gpgme + \ invcrypt_use_pka invdelete_untag invdigest_collapse invduplicate_threads + \ invedit_hdrs invedit_headers invencode_from invenvelope_from invfast_reply + \ invfcc_clear invflag_safe invfollowup_to invforce_name invforw_decode + \ invforw_decrypt invforw_quote invforward_decode invforward_decrypt + \ invforward_quote invhdrs invheader invheader_color_partial invhelp + \ invhidden_host invhide_limited invhide_missing invhide_thread_subject + \ invhide_top_limited invhide_top_missing invhistory_remove_dups + \ invhonor_disposition invidn_decode invidn_encode + \ invignore_linear_white_space invignore_list_reply_to + \ invimap_check_subscribed invimap_list_subscribed invimap_passive + \ invimap_peek invimap_servernoise invimplicit_autoview invinclude_onlyfirst + \ invkeep_flagged invmail_check_recent invmail_check_stats invmailcap_sanitize + \ invmaildir_check_cur invmaildir_header_cache_verify invmaildir_trash + \ invmark_old invmarkers invmenu_move_off invmenu_scroll + \ invmessage_cache_clean invmeta_key invmetoo invmh_purge + \ invmime_forward_decode invmime_type_query_first invnarrow_tree invpager_stop + \ invpgp_auto_decode invpgp_auto_traditional invpgp_autoencrypt + \ invpgp_autoinline invpgp_autosign invpgp_check_exit + \ invpgp_create_traditional invpgp_ignore_subkeys invpgp_long_ids + \ invpgp_replyencrypt invpgp_replyinline invpgp_replysign + \ invpgp_replysignencrypted invpgp_retainable_sigs invpgp_self_encrypt + \ invpgp_self_encrypt_as invpgp_show_unusable invpgp_strict_enc + \ invpgp_use_gpg_agent invpipe_decode invpipe_split invpop_auth_try_all + \ invpop_last invpostpone_encrypt invpostpone_encrypt_as invprint_decode + \ invprint_split invprompt_after invread_only invreflow_space_quotes + \ invreflow_text invreflow_wrap invreply_self invresolve invresume_draft_files + \ invresume_edited_draft_files invreverse_alias invreverse_name + \ invreverse_realname invrfc2047_parameters invsave_address invsave_empty + \ invsave_name invscore invsidebar_folder_indent invsidebar_new_mail_only + \ invsidebar_next_new_wrap invsidebar_short_path invsidebar_sort + \ invsidebar_visible invsig_dashes invsig_on_top invsmart_wrap + \ invsmime_ask_cert_label invsmime_decrypt_use_default_key invsmime_is_default + \ invsmime_self_encrypt invsmime_self_encrypt_as invsort_re invssl_force_tls + \ invssl_use_sslv2 invssl_use_sslv3 invssl_use_tlsv1 invssl_usesystemcerts + \ invssl_verify_dates invssl_verify_host invssl_verify_partial_chains + \ invstatus_on_top invstrict_mime invstrict_threads invsuspend invtext_flowed + \ invthorough_search invthread_received invtilde invts_enabled + \ invuncollapse_jump invuse_8bitmime invuse_domain invuse_envelope_from + \ invuse_from invuse_idn invuse_ipv6 invuncollapse_new invuser_agent + \ invwait_key invweed invwrap_search invwrite_bcc + \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarQuad skipwhite contained + \ abort_nosubject abort_unmodified abort_noattach bounce copy crypt_verify_sig + \ delete fcc_attach forward_edit honor_followup_to include mime_forward + \ mime_forward_rest mime_fwd move pgp_mime_auto pgp_verify_sig pop_delete + \ pop_reconnect postpone print quit recall reply_to ssl_starttls + \ nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarQuad skipwhite contained + \ noabort_nosubject noabort_unmodified noabort_noattach nobounce nocopy + \ nocrypt_verify_sig nodelete nofcc_attach noforward_edit nohonor_followup_to + \ noinclude nomime_forward nomime_forward_rest nomime_fwd nomove + \ nopgp_mime_auto nopgp_verify_sig nopop_delete nopop_reconnect nopostpone + \ noprint noquit norecall noreply_to nossl_starttls + \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarQuad skipwhite contained + \ invabort_nosubject invabort_unmodified invabort_noattach invbounce invcopy + \ invcrypt_verify_sig invdelete invfcc_attach invforward_edit + \ invhonor_followup_to invinclude invmime_forward invmime_forward_rest + \ invmime_fwd invmove invpgp_mime_auto invpgp_verify_sig invpop_delete + \ invpop_reconnect invpostpone invprint invquit invrecall invreply_to + \ invssl_starttls + \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr + +syn keyword muttrcVarNum skipwhite contained + \ connect_timeout error_history history imap_keepalive imap_pipeline_depth + \ imap_poll_timeout mail_check mail_check_stats_interval menu_context net_inc + \ pager_context pager_index_lines pgp_timeout pop_checkinterval read_inc + \ save_history score_threshold_delete score_threshold_flag + \ score_threshold_read search_context sendmail_wait sidebar_width sleep_time + \ smime_timeout ssl_min_dh_prime_bits time_inc timeout wrap wrap_headers + \ wrapmargin write_inc + \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr syn match muttrcFormatErrors contained /%./ @@ -289,7 +317,7 @@ syn match muttrcAliasFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\ syn match muttrcQueryFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[acent%]/ syn match muttrcQueryFormatConditionals contained /%?[e]?/ nextgroup=muttrcFormatConditionals2 " The following info was pulled from mutt_attach_fmt in recvattach.c -syn match muttrcAttachFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[CcDdefImMnQstTuX%]/ +syn match muttrcAttachFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[CcDdeFfImMnQstTuX%]/ syn match muttrcAttachFormatEscapes contained /%[>|*]./ syn match muttrcAttachFormatConditionals contained /%?[CcdDefInmMQstTuX]?/ nextgroup=muttrcFormatConditionals2 syn match muttrcFormatConditionals2 contained /[^?]*?/ @@ -313,7 +341,7 @@ syn match muttrcPGPFormatConditionals contained /%?[nkualfct]?/ syn match muttrcPGPCmdFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[pfsar%]/ syn match muttrcPGPCmdFormatConditionals contained /%?[pfsar]?/ nextgroup=muttrcFormatConditionals2 " The following info was pulled from status_format_str in status.c -syn match muttrcStatusFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[bdfFhlLmMnopPrsStuvV%]/ +syn match muttrcStatusFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[bdfFhlLmMnopPRrsStuvV%]/ syn match muttrcStatusFormatEscapes contained /%[>|*]./ syn match muttrcStatusFormatConditionals contained /%?[bdFlLmMnoptuV]?/ nextgroup=muttrcFormatConditionals2 " This matches the documentation, but directly contradicts the code @@ -349,7 +377,7 @@ syn keyword muttrcVarStr contained skipwhite query_format nextgroup=muttrcVarEqu syn match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr syn keyword muttrcVarStr contained skipwhite pgp_decode_command pgp_verify_command pgp_decrypt_command pgp_clearsign_command pgp_sign_command pgp_encrypt_sign_command pgp_encrypt_only_command pgp_import_command pgp_export_command pgp_verify_key_command pgp_list_secring_command pgp_list_pubring_command nextgroup=muttrcVarEqualsPGPCmdFmt syn match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr -syn keyword muttrcVarStr contained skipwhite status_format nextgroup=muttrcVarEqualsStatusFmt +syn keyword muttrcVarStr contained skipwhite ts_icon_format ts_status_format status_format nextgroup=muttrcVarEqualsStatusFmt syn match muttrcVarEqualsStatusFmt contained skipwhite "=" nextgroup=muttrcStatusFormatStr syn keyword muttrcVarStr contained skipwhite pgp_getkeys_command nextgroup=muttrcVarEqualsPGPGetKeysFmt syn match muttrcVarEqualsPGPGetKeysFmt contained skipwhite "=" nextgroup=muttrcPGPGetKeysFormatStr @@ -361,34 +389,29 @@ syn match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=muttrcStr syn match muttrcVPrefix contained /[?&]/ nextgroup=muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr syn match muttrcVarStr contained skipwhite 'my_[a-zA-Z0-9_]\+' nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite alias_file assumed_charset attach_charset attach_sep nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite certificate_file charset config_charset content_type nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite default_hook display_filter dotlock_program dsn_notify nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite dsn_return editor entropy_file envelope_from_address escape folder nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite forw_format forward_format from gecos_mask hdr_format nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite header_cache header_cache_compress header_cache_pagesize nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite history_file hostname imap_authenticators nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite imap_delim_chars imap_headers imap_idle imap_login imap_pass nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite imap_user indent_str indent_string ispell locale mailcap_path nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite mask mbox mbox_type message_cachedir mh_seq_flagged mh_seq_replied nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite mh_seq_unseen mixmaster msg_format pager nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite pgp_good_sign nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite pgp_mime_signature_filename nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite pgp_mime_signature_description pgp_sign_as nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite pgp_sort_keys nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite pipe_sep pop_authenticators pop_host pop_pass pop_user post_indent_str nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite post_indent_string postponed preconnect print_cmd print_command nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite query_command quote_regexp realname record reply_regexp send_charset nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite sendmail shell signature simple_search smileys smime_ca_location nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite smime_certificates smime_default_key nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite smime_encrypt_with nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite smime_keys smime_sign_as nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite smtp_url smtp_authenticators smtp_pass sort sort_alias sort_aux nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite sort_browser spam_separator spoolfile ssl_ca_certificates_file ssl_client_cert nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -syn keyword muttrcVarStr contained skipwhite status_chars tmpdir to_chars tunnel visual nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -if use_mutt_sidebar == 1 - syn keyword muttrcVarStr skipwhite contained sidebar_delim nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr -endif +syn keyword muttrcVarStr contained skipwhite + \ abort_noattach_regexp alias_file assumed_charset attach_charset attach_sep + \ attribution_locale certificate_file charset config_charset content_type + \ default_hook display_filter dotlock_program dsn_notify dsn_return editor + \ entropy_file envelope_from_address escape folder forw_format + \ forward_attribution_intro forward_attribution_trailer forward_format from gecos_mask + \ hdr_format header_cache header_cache_compress header_cache_pagesize history_file + \ hostname imap_authenticators imap_delim_chars imap_headers imap_idle imap_login + \ imap_pass imap_user indent_str indent_string ispell locale mailcap_path + \ mark_macro_prefix mask mbox mbox_type message_cachedir mh_seq_flagged mh_seq_replied + \ mh_seq_unseen mime_type_query_command mixmaster msg_format new_mail_command pager + \ pgp_default_key pgp_decryption_okay pgp_good_sign pgp_mime_signature_description + \ pgp_mime_signature_filename pgp_sign_as pgp_sort_keys pipe_sep pop_authenticators + \ pop_host pop_pass pop_user post_indent_str post_indent_string postpone_encrypt_as + \ postponed preconnect print_cmd print_command query_command quote_regexp realname + \ record reply_regexp send_charset sendmail shell sidebar_delim sidebar_delim_chars + \ sidebar_divider_char sidebar_format sidebar_indent_string sidebar_sort_method + \ signature simple_search smileys smime_ca_location smime_certificates + \ smime_default_key smime_encrypt_with smime_keys smime_sign_as smime_sign_digest_alg + \ smtp_authenticators smtp_pass smtp_url sort sort_alias sort_aux sort_browser + \ spam_separator spoolfile ssl_ca_certificates_file ssl_ciphers ssl_client_cert + \ status_chars tmpdir to_chars trash ts_icon_format ts_status_format tunnel visual + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr " Present in 1.4.2.1 (pgp_create_traditional was a bool then) syn keyword muttrcVarBool contained skipwhite imap_force_ssl noimap_force_ssl invimap_force_ssl nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr @@ -401,12 +424,12 @@ syn match muttrcMenuCommas /,/ contained syn keyword muttrcHooks contained skipwhite account-hook charset-hook iconv-hook message-hook folder-hook mbox-hook save-hook fcc-hook fcc-save-hook send-hook send2-hook reply-hook crypt-hook -syn keyword muttrcCommand auto_view alternative_order exec unalternative_order -syn keyword muttrcCommand hdr_order iconv-hook ignore mailboxes my_hdr unmailboxes -syn keyword muttrcCommand pgp-hook push score source unauto_view unhdr_order -syn keyword muttrcCommand unignore unmono unmy_hdr unscore -syn keyword muttrcCommand mime_lookup unmime_lookup ungroup -syn keyword muttrcCommand unalternative_order +syn keyword muttrcCommand skipwhite + \ alternative_order auto_view exec hdr_order iconv-hook ignore mailboxes + \ mailto_allow mime_lookup my_hdr pgp-hook push score sidebar_whitelist source + \ unalternative_order unalternative_order unauto_view ungroup unhdr_order + \ unignore unmailboxes unmailto_allow unmime_lookup unmono unmy_hdr unscore + \ unsidebar_whitelist syn keyword muttrcCommand skipwhite charset-hook nextgroup=muttrcRXString syn keyword muttrcCommand skipwhite unhook nextgroup=muttrcHooks @@ -441,7 +464,7 @@ syn match muttrcVariableInner contained "\$[a-zA-Z_-]\+" syn match muttrcEscapedVariable contained "\\\$[a-zA-Z_-]\+" syn match muttrcBadAction contained "[^<>]\+" contains=muttrcEmail -syn match muttrcFunction contained "\<\%(attach\|bounce\|copy\|delete\|display\|flag\|forward\|parent\|pipe\|postpone\|print\|recall\|resend\|save\|send\|tag\|undelete\)-message\>" +syn match muttrcFunction contained "\<\%(attach\|bounce\|copy\|delete\|display\|flag\|forward\|mark\|parent\|pipe\|postpone\|print\|purge\|recall\|resend\|root\|save\|send\|tag\|undelete\)-message\>" syn match muttrcFunction contained "\<\%(delete\|next\|previous\|read\|tag\|break\|undelete\)-thread\>" syn match muttrcFunction contained "\<link-threads\>" syn match muttrcFunction contained "\<\%(backward\|capitalize\|downcase\|forward\|kill\|upcase\)-word\>" @@ -453,10 +476,12 @@ syn match muttrcFunction contained "\<current-\%(bottom\|middle\|top\)\>" syn match muttrcFunction contained "\<decode-\%(copy\|save\)\>" syn match muttrcFunction contained "\<delete-\%(char\|pattern\|subthread\)\>" syn match muttrcFunction contained "\<display-\%(address\|toggle-weed\)\>" -syn match muttrcFunction contained "\<edit\%(-\%(bcc\|cc\|description\|encoding\|fcc\|file\|from\|headers\|mime\|reply-to\|subject\|to\|type\)\)\?\>" +syn match muttrcFunction contained "\<echo\>" +syn match muttrcFunction contained "\<edit\%(-\%(bcc\|cc\|description\|encoding\|fcc\|file\|from\|headers\|label\|mime\|reply-to\|subject\|to\|type\)\)\?\>" syn match muttrcFunction contained "\<enter-\%(command\|mask\)\>" +syn match muttrcFunction contained "\<error-history\>" syn match muttrcFunction contained "\<half-\%(up\|down\)\>" -syn match muttrcFunction contained "\<history-\%(up\|down\)\>" +syn match muttrcFunction contained "\<history-\%(up\|down\|search\)\>" syn match muttrcFunction contained "\<kill-\%(eol\|eow\|line\)\>" syn match muttrcFunction contained "\<next-\%(line\|new\%(-then-unread\)\?\|page\|subthread\|undeleted\|unread\|unread-mailbox\)\>" syn match muttrcFunction contained "\<previous-\%(line\|new\%(-then-unread\)\?\|page\|subthread\|undeleted\|unread\)\>" @@ -465,11 +490,16 @@ syn match muttrcFunction contained "\<show-\%(limit\|version\)\>" syn match muttrcFunction contained "\<sort-\%(mailbox\|reverse\)\>" syn match muttrcFunction contained "\<tag-\%(pattern\|\%(sub\)\?thread\|prefix\%(-cond\)\?\)\>" syn match muttrcFunction contained "\<end-cond\>" +syn match muttrcFunction contained "\<sidebar-\%(next\|next-new\|open\|page-down\|page-up\|prev\|prev-new\|toggle-visible\)\>" syn match muttrcFunction contained "\<toggle-\%(mailboxes\|new\|quoted\|subscribed\|unlink\|write\)\>" syn match muttrcFunction contained "\<undelete-\%(pattern\|subthread\)\>" syn match muttrcFunction contained "\<collapse-\%(parts\|thread\|all\)\>" +syn match muttrcFunction contained "\<rename-attachment\>" +syn match muttrcFunction contained "\<subjectrx\>" +syn match muttrcFunction contained "\<\%(un\)\?setenv\>" syn match muttrcFunction contained "\<view-\%(attach\|attachments\|file\|mailcap\|name\|text\)\>" syn match muttrcFunction contained "\<\%(backspace\|backward-char\|bol\|bottom\|bottom-page\|buffy-cycle\|clear-flag\|complete\%(-query\)\?\|copy-file\|create-alias\|detach-file\|eol\|exit\|extract-keys\|\%(imap-\)\?fetch-mail\|forget-passphrase\|forward-char\|group-reply\|help\|ispell\|jump\|limit\|list-reply\|mail\|mail-key\|mark-as-new\|middle-page\|new-mime\|noop\|pgp-menu\|query\|query-append\|quit\|quote-char\|read-subthread\|redraw-screen\|refresh\|rename-file\|reply\|select-new\|set-flag\|shell-escape\|skip-quoted\|sort\|subscribe\|sync-mailbox\|top\|top-page\|transpose-chars\|unsubscribe\|untag-pattern\|verify-key\|what-key\|write-fcc\)\>" +syn keyword muttrcFunction contained imap-logout-all if use_mutt_sidebar == 1 syn match muttrcFunction contained "\<sidebar-\%(prev\|next\|open\|scroll-up\|scroll-down\)" endif @@ -568,6 +598,7 @@ syn match muttrcOptPattern contained skipwhite /[.]/ nextgroup=muttrcString,mutt syn region muttrcPattern contained matchgroup=Type keepend skipwhite start=+"+ skip=+\\"+ end=+"+ contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas syn region muttrcPattern contained matchgroup=Type keepend skipwhite start=+'+ skip=+\\'+ end=+'+ contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas syn region muttrcPattern contained keepend skipwhite start=+[~](+ end=+)+ skip=+\\)+ contains=muttrcSimplePat +syn region muttrcPattern contained keepend skipwhite start=+[~][<>](+ end=+)+ skip=+\\)+ contains=muttrcSimplePat syn match muttrcPattern contained skipwhite /[~][A-Za-z]/ contains=muttrcSimplePat syn match muttrcPattern contained skipwhite /[.]/ syn region muttrcPatternInner contained keepend start=+"[~=%!(^]+ms=s+1 skip=+\\"+ end=+"+me=e-1 contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas @@ -578,7 +609,11 @@ syn match muttrcColorMatchCount contained "[0-9]\+" syn match muttrcColorMatchCountNL contained skipwhite skipnl "\s*\\$" nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL syn region muttrcColorRXPat contained start=+\s*'+ skip=+\\'+ end=+'\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL syn region muttrcColorRXPat contained start=+\s*"+ skip=+\\"+ end=+"\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL -syn keyword muttrcColorField contained attachment body bold error hdrdefault header index indicator markers message normal quoted search signature status tilde tree underline +syn keyword muttrcColorField skipwhite contained + \ attachment body bold error hdrdefault header index indicator markers message + \ normal prompt quoted search sidebar-divider sidebar-flagged sidebar-highlight + \ sidebar-indicator sidebar-new sidebar-spoolfile signature status tilde tree + \ underline syn match muttrcColorField contained "\<quoted\d\=\>" if use_mutt_sidebar == 1 syn keyword muttrcColorField contained sidebar_new @@ -634,160 +669,150 @@ syn keyword muttrcMono contained mono skipwhite nextgroup=muttrcColorField syn match muttrcMonoLine "^\s*mono\s\+\S\+" skipwhite nextgroup=muttrcMonoAttrib contains=muttrcMono " 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_muttrc_syntax_inits") - if version < 508 - let did_muttrc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink muttrcComment Comment - HiLink muttrcEscape SpecialChar - HiLink muttrcRXChars SpecialChar - HiLink muttrcString String - HiLink muttrcRXString String - HiLink muttrcRXString2 String - HiLink muttrcSpecial Special - HiLink muttrcHooks Type - HiLink muttrcGroupFlag Type - HiLink muttrcGroupDef Macro - HiLink muttrcAddrDef muttrcGroupFlag - HiLink muttrcRXDef muttrcGroupFlag - HiLink muttrcRXPat String - HiLink muttrcAliasGroupName Macro - HiLink muttrcAliasKey Identifier - HiLink muttrcUnAliasKey Identifier - HiLink muttrcAliasEncEmail Identifier - HiLink muttrcAliasParens Type - HiLink muttrcSetNumAssignment Number - HiLink muttrcSetBoolAssignment Boolean - HiLink muttrcSetQuadAssignment Boolean - HiLink muttrcSetStrAssignment String - HiLink muttrcEmail Special - HiLink muttrcVariableInner Special - HiLink muttrcEscapedVariable String - HiLink muttrcHeader Type - HiLink muttrcKeySpecial SpecialChar - HiLink muttrcKey Type - HiLink muttrcKeyName SpecialChar - HiLink muttrcVarBool Identifier - HiLink muttrcVarQuad Identifier - HiLink muttrcVarNum Identifier - HiLink muttrcVarStr Identifier - HiLink muttrcMenu Identifier - HiLink muttrcCommand Keyword - HiLink muttrcMacroDescr String - HiLink muttrcAction Macro - HiLink muttrcBadAction Error - HiLink muttrcBindFunction Error - HiLink muttrcBindMenuList Error - HiLink muttrcFunction Macro - HiLink muttrcGroupKeyword muttrcCommand - HiLink muttrcGroupLine Error - HiLink muttrcSubscribeKeyword muttrcCommand - HiLink muttrcSubscribeLine Error - HiLink muttrcListsKeyword muttrcCommand - HiLink muttrcListsLine Error - HiLink muttrcAlternateKeyword muttrcCommand - HiLink muttrcAlternatesLine Error - HiLink muttrcAttachmentsLine muttrcCommand - HiLink muttrcAttachmentsFlag Type - HiLink muttrcAttachmentsMimeType String - HiLink muttrcColorLine Error - HiLink muttrcColorContext Error - HiLink muttrcColorContextI Identifier - HiLink muttrcColorContextH Identifier - HiLink muttrcColorKeyword muttrcCommand - HiLink muttrcColorKeywordI muttrcColorKeyword - HiLink muttrcColorKeywordH muttrcColorKeyword - HiLink muttrcColorField Identifier - HiLink muttrcColor Type - HiLink muttrcColorFG Error - HiLink muttrcColorFGI Error - HiLink muttrcColorFGH Error - HiLink muttrcColorBG Error - HiLink muttrcColorBGI Error - HiLink muttrcColorBGH Error - HiLink muttrcMonoAttrib muttrcColor - HiLink muttrcMono muttrcCommand - HiLink muttrcSimplePat Identifier - HiLink muttrcSimplePatString Macro - HiLink muttrcSimplePatMetas Special - HiLink muttrcPattern Error - HiLink muttrcUnColorLine Error - HiLink muttrcUnColorKeyword muttrcCommand - HiLink muttrcUnColorIndex Identifier - HiLink muttrcShellString muttrcEscape - HiLink muttrcRXHooks muttrcCommand - HiLink muttrcRXHookNot Type - HiLink muttrcPatHooks muttrcCommand - HiLink muttrcPatHookNot Type - HiLink muttrcFormatConditionals2 Type - HiLink muttrcIndexFormatStr muttrcString - HiLink muttrcIndexFormatEscapes muttrcEscape - HiLink muttrcIndexFormatConditionals muttrcFormatConditionals2 - HiLink muttrcAliasFormatStr muttrcString - HiLink muttrcAliasFormatEscapes muttrcEscape - HiLink muttrcAttachFormatStr muttrcString - HiLink muttrcAttachFormatEscapes muttrcEscape - HiLink muttrcAttachFormatConditionals muttrcFormatConditionals2 - HiLink muttrcComposeFormatStr muttrcString - HiLink muttrcComposeFormatEscapes muttrcEscape - HiLink muttrcFolderFormatStr muttrcString - HiLink muttrcFolderFormatEscapes muttrcEscape - HiLink muttrcFolderFormatConditionals muttrcFormatConditionals2 - HiLink muttrcMixFormatStr muttrcString - HiLink muttrcMixFormatEscapes muttrcEscape - HiLink muttrcMixFormatConditionals muttrcFormatConditionals2 - HiLink muttrcPGPFormatStr muttrcString - HiLink muttrcPGPFormatEscapes muttrcEscape - HiLink muttrcPGPFormatConditionals muttrcFormatConditionals2 - HiLink muttrcPGPCmdFormatStr muttrcString - HiLink muttrcPGPCmdFormatEscapes muttrcEscape - HiLink muttrcPGPCmdFormatConditionals muttrcFormatConditionals2 - HiLink muttrcStatusFormatStr muttrcString - HiLink muttrcStatusFormatEscapes muttrcEscape - HiLink muttrcStatusFormatConditionals muttrcFormatConditionals2 - HiLink muttrcPGPGetKeysFormatStr muttrcString - HiLink muttrcPGPGetKeysFormatEscapes muttrcEscape - HiLink muttrcSmimeFormatStr muttrcString - HiLink muttrcSmimeFormatEscapes muttrcEscape - HiLink muttrcSmimeFormatConditionals muttrcFormatConditionals2 - HiLink muttrcTimeEscapes muttrcEscape - HiLink muttrcPGPTimeEscapes muttrcEscape - HiLink muttrcStrftimeEscapes Type - HiLink muttrcStrftimeFormatStr muttrcString - HiLink muttrcFormatErrors Error - - HiLink muttrcBindFunctionNL SpecialChar - HiLink muttrcBindKeyNL SpecialChar - HiLink muttrcBindMenuListNL SpecialChar - HiLink muttrcMacroDescrNL SpecialChar - HiLink muttrcMacroBodyNL SpecialChar - HiLink muttrcMacroKeyNL SpecialChar - HiLink muttrcMacroMenuListNL SpecialChar - HiLink muttrcColorMatchCountNL SpecialChar - HiLink muttrcColorNL SpecialChar - HiLink muttrcColorRXNL SpecialChar - HiLink muttrcColorBGNL SpecialChar - HiLink muttrcColorFGNL SpecialChar - HiLink muttrcAliasNameNL SpecialChar - HiLink muttrcAliasENNL SpecialChar - HiLink muttrcAliasNL SpecialChar - HiLink muttrcUnAliasNL SpecialChar - HiLink muttrcAliasGroupDefNL SpecialChar - HiLink muttrcAliasEncEmailNL SpecialChar - HiLink muttrcPatternNL SpecialChar - HiLink muttrcUnColorPatNL SpecialChar - HiLink muttrcUnColorAPNL SpecialChar - HiLink muttrcUnColorIndexNL SpecialChar - HiLink muttrcStringNL SpecialChar - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link muttrcComment Comment +hi def link muttrcEscape SpecialChar +hi def link muttrcRXChars SpecialChar +hi def link muttrcString String +hi def link muttrcRXString String +hi def link muttrcRXString2 String +hi def link muttrcSpecial Special +hi def link muttrcHooks Type +hi def link muttrcGroupFlag Type +hi def link muttrcGroupDef Macro +hi def link muttrcAddrDef muttrcGroupFlag +hi def link muttrcRXDef muttrcGroupFlag +hi def link muttrcRXPat String +hi def link muttrcAliasGroupName Macro +hi def link muttrcAliasKey Identifier +hi def link muttrcUnAliasKey Identifier +hi def link muttrcAliasEncEmail Identifier +hi def link muttrcAliasParens Type +hi def link muttrcSetNumAssignment Number +hi def link muttrcSetBoolAssignment Boolean +hi def link muttrcSetQuadAssignment Boolean +hi def link muttrcSetStrAssignment String +hi def link muttrcEmail Special +hi def link muttrcVariableInner Special +hi def link muttrcEscapedVariable String +hi def link muttrcHeader Type +hi def link muttrcKeySpecial SpecialChar +hi def link muttrcKey Type +hi def link muttrcKeyName SpecialChar +hi def link muttrcVarBool Identifier +hi def link muttrcVarQuad Identifier +hi def link muttrcVarNum Identifier +hi def link muttrcVarStr Identifier +hi def link muttrcMenu Identifier +hi def link muttrcCommand Keyword +hi def link muttrcMacroDescr String +hi def link muttrcAction Macro +hi def link muttrcBadAction Error +hi def link muttrcBindFunction Error +hi def link muttrcBindMenuList Error +hi def link muttrcFunction Macro +hi def link muttrcGroupKeyword muttrcCommand +hi def link muttrcGroupLine Error +hi def link muttrcSubscribeKeyword muttrcCommand +hi def link muttrcSubscribeLine Error +hi def link muttrcListsKeyword muttrcCommand +hi def link muttrcListsLine Error +hi def link muttrcAlternateKeyword muttrcCommand +hi def link muttrcAlternatesLine Error +hi def link muttrcAttachmentsLine muttrcCommand +hi def link muttrcAttachmentsFlag Type +hi def link muttrcAttachmentsMimeType String +hi def link muttrcColorLine Error +hi def link muttrcColorContext Error +hi def link muttrcColorContextI Identifier +hi def link muttrcColorContextH Identifier +hi def link muttrcColorKeyword muttrcCommand +hi def link muttrcColorKeywordI muttrcColorKeyword +hi def link muttrcColorKeywordH muttrcColorKeyword +hi def link muttrcColorField Identifier +hi def link muttrcColor Type +hi def link muttrcColorFG Error +hi def link muttrcColorFGI Error +hi def link muttrcColorFGH Error +hi def link muttrcColorBG Error +hi def link muttrcColorBGI Error +hi def link muttrcColorBGH Error +hi def link muttrcMonoAttrib muttrcColor +hi def link muttrcMono muttrcCommand +hi def link muttrcSimplePat Identifier +hi def link muttrcSimplePatString Macro +hi def link muttrcSimplePatMetas Special +hi def link muttrcPattern Error +hi def link muttrcUnColorLine Error +hi def link muttrcUnColorKeyword muttrcCommand +hi def link muttrcUnColorIndex Identifier +hi def link muttrcShellString muttrcEscape +hi def link muttrcRXHooks muttrcCommand +hi def link muttrcRXHookNot Type +hi def link muttrcPatHooks muttrcCommand +hi def link muttrcPatHookNot Type +hi def link muttrcFormatConditionals2 Type +hi def link muttrcIndexFormatStr muttrcString +hi def link muttrcIndexFormatEscapes muttrcEscape +hi def link muttrcIndexFormatConditionals muttrcFormatConditionals2 +hi def link muttrcAliasFormatStr muttrcString +hi def link muttrcAliasFormatEscapes muttrcEscape +hi def link muttrcAttachFormatStr muttrcString +hi def link muttrcAttachFormatEscapes muttrcEscape +hi def link muttrcAttachFormatConditionals muttrcFormatConditionals2 +hi def link muttrcComposeFormatStr muttrcString +hi def link muttrcComposeFormatEscapes muttrcEscape +hi def link muttrcFolderFormatStr muttrcString +hi def link muttrcFolderFormatEscapes muttrcEscape +hi def link muttrcFolderFormatConditionals muttrcFormatConditionals2 +hi def link muttrcMixFormatStr muttrcString +hi def link muttrcMixFormatEscapes muttrcEscape +hi def link muttrcMixFormatConditionals muttrcFormatConditionals2 +hi def link muttrcPGPFormatStr muttrcString +hi def link muttrcPGPFormatEscapes muttrcEscape +hi def link muttrcPGPFormatConditionals muttrcFormatConditionals2 +hi def link muttrcPGPCmdFormatStr muttrcString +hi def link muttrcPGPCmdFormatEscapes muttrcEscape +hi def link muttrcPGPCmdFormatConditionals muttrcFormatConditionals2 +hi def link muttrcStatusFormatStr muttrcString +hi def link muttrcStatusFormatEscapes muttrcEscape +hi def link muttrcStatusFormatConditionals muttrcFormatConditionals2 +hi def link muttrcPGPGetKeysFormatStr muttrcString +hi def link muttrcPGPGetKeysFormatEscapes muttrcEscape +hi def link muttrcSmimeFormatStr muttrcString +hi def link muttrcSmimeFormatEscapes muttrcEscape +hi def link muttrcSmimeFormatConditionals muttrcFormatConditionals2 +hi def link muttrcTimeEscapes muttrcEscape +hi def link muttrcPGPTimeEscapes muttrcEscape +hi def link muttrcStrftimeEscapes Type +hi def link muttrcStrftimeFormatStr muttrcString +hi def link muttrcFormatErrors Error + +hi def link muttrcBindFunctionNL SpecialChar +hi def link muttrcBindKeyNL SpecialChar +hi def link muttrcBindMenuListNL SpecialChar +hi def link muttrcMacroDescrNL SpecialChar +hi def link muttrcMacroBodyNL SpecialChar +hi def link muttrcMacroKeyNL SpecialChar +hi def link muttrcMacroMenuListNL SpecialChar +hi def link muttrcColorMatchCountNL SpecialChar +hi def link muttrcColorNL SpecialChar +hi def link muttrcColorRXNL SpecialChar +hi def link muttrcColorBGNL SpecialChar +hi def link muttrcColorFGNL SpecialChar +hi def link muttrcAliasNameNL SpecialChar +hi def link muttrcAliasENNL SpecialChar +hi def link muttrcAliasNL SpecialChar +hi def link muttrcUnAliasNL SpecialChar +hi def link muttrcAliasGroupDefNL SpecialChar +hi def link muttrcAliasEncEmailNL SpecialChar +hi def link muttrcPatternNL SpecialChar +hi def link muttrcUnColorPatNL SpecialChar +hi def link muttrcUnColorAPNL SpecialChar +hi def link muttrcUnColorIndexNL SpecialChar +hi def link muttrcStringNL SpecialChar + let b:current_syntax = "muttrc" diff --git a/runtime/syntax/mysql.vim b/runtime/syntax/mysql.vim index c01ecc192b..8bd7b6459a 100644 --- a/runtime/syntax/mysql.vim +++ b/runtime/syntax/mysql.vim @@ -1,16 +1,13 @@ " Vim syntax file " Language: mysql " Maintainer: Kenneth J. Pronovici <pronovic@ieee.org> -" Last Change: $LastChangedDate: 2010-04-22 09:48:02 -0500 (Thu, 22 Apr 2010) $ +" Last Change: $LastChangedDate: 2016-04-11 10:31:04 -0500 (Mon, 11 Apr 2016) $ " Filenames: *.mysql " URL: ftp://cedar-solutions.com/software/mysql.vim " Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,7 +15,7 @@ endif syn case ignore " General keywords which don't fall into other categories -syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg avg_row_length +syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg_row_length syn keyword mysqlKeyword both by syn keyword mysqlKeyword cascade change character check checksum column columns comment constraint create cross syn keyword mysqlKeyword current_date current_time current_timestamp @@ -30,7 +27,7 @@ syn keyword mysqlKeyword global grant grants group syn keyword mysqlKeyword having heap high_priority hosts hour hour_minute hour_second syn keyword mysqlKeyword identified ignore index infile inner insert insert_id into isam syn keyword mysqlKeyword join -syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long +syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long syn keyword mysqlKeyword low_priority syn keyword mysqlKeyword match max_rows middleint min_rows minute minute_second modify month myisam syn keyword mysqlKeyword natural no @@ -64,6 +61,9 @@ syn match mysqlNumber "\<0x[abcdefABCDEF0-9]*\>" " User variables syn match mysqlVariable "@\a*[A-Za-z0-9]*\([._]*[A-Za-z0-9]\)*" +" Escaped column names +syn match mysqlEscaped "`[^`]*`" + " Comments (c-style, mysql-style and modified sql-style) syn region mysqlComment start="/\*" end="\*/" syn match mysqlComment "#.*" @@ -84,14 +84,14 @@ syn sync ccomment mysqlComment " The second problem is that some of these keywords are included in " function names. For instance, year() is part of the name of the " dayofyear() function, and the dec keyword (no parenthesis) is part of -" the name of the decode() function. +" the name of the decode() function. -syn keyword mysqlType tinyint smallint mediumint int integer bigint -syn keyword mysqlType date datetime time bit bool +syn keyword mysqlType tinyint smallint mediumint int integer bigint +syn keyword mysqlType date datetime time bit bool syn keyword mysqlType tinytext mediumtext longtext text syn keyword mysqlType tinyblob mediumblob longblob blob -syn region mysqlType start="float\W" end="."me=s-1 -syn region mysqlType start="float$" end="."me=s-1 +syn region mysqlType start="float\W" end="."me=s-1 +syn region mysqlType start="float$" end="."me=s-1 syn region mysqlType start="float(" end=")" contains=mysqlNumber,mysqlVariable syn region mysqlType start="double\W" end="."me=s-1 syn region mysqlType start="double$" end="."me=s-1 @@ -139,12 +139,12 @@ syn region mysqlFlow start="if(" end=")" contains=ALL " " I'm leery of just defining keywords for functions, since according to the MySQL manual: " -" Function names do not clash with table or column names. For example, ABS is a -" valid column name. The only restriction is that for a function call, no spaces -" are allowed between the function name and the `(' that follows it. +" Function names do not clash with table or column names. For example, ABS is a +" valid column name. The only restriction is that for a function call, no spaces +" are allowed between the function name and the `(' that follows it. " -" This means that if I want to highlight function names properly, I have to use a -" region to define them, not just a keyword. This will probably cause the syntax file +" This means that if I want to highlight function names properly, I have to use a +" region to define them, not just a keyword. This will probably cause the syntax file " to load more slowly, but at least it will be 'correct'. syn region mysqlFunction start="abs(" end=")" contains=ALL @@ -154,6 +154,7 @@ syn region mysqlFunction start="ascii(" end=")" contains=ALL syn region mysqlFunction start="asin(" end=")" contains=ALL syn region mysqlFunction start="atan(" end=")" contains=ALL syn region mysqlFunction start="atan2(" end=")" contains=ALL +syn region mysqlFunction start="avg(" end=")" contains=ALL syn region mysqlFunction start="benchmark(" end=")" contains=ALL syn region mysqlFunction start="bin(" end=")" contains=ALL syn region mysqlFunction start="bit_and(" end=")" contains=ALL @@ -269,29 +270,19 @@ syn region mysqlFunction start="weekday(" end=")" contains=ALL syn region mysqlFunction start="yearweek(" end=")" contains=ALL " 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_mysql_syn_inits") - if version < 508 - let did_mysql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink mysqlKeyword Statement - HiLink mysqlSpecial Special - HiLink mysqlString String - HiLink mysqlNumber Number - HiLink mysqlVariable Identifier - HiLink mysqlComment Comment - HiLink mysqlType Type - HiLink mysqlOperator Statement - HiLink mysqlFlow Statement - HiLink mysqlFunction Function +hi def link mysqlKeyword Statement +hi def link mysqlSpecial Special +hi def link mysqlString String +hi def link mysqlNumber Number +hi def link mysqlVariable Identifier +hi def link mysqlComment Comment +hi def link mysqlType Type +hi def link mysqlOperator Statement +hi def link mysqlFlow Statement +hi def link mysqlFunction Function - delcommand HiLink -endif let b:current_syntax = "mysql" diff --git a/runtime/syntax/n1ql.vim b/runtime/syntax/n1ql.vim new file mode 100644 index 0000000000..bef65d8f64 --- /dev/null +++ b/runtime/syntax/n1ql.vim @@ -0,0 +1,434 @@ +" Vim syntax file +" Language: N1QL / Couchbase Server +" Maintainer: Eugene Ciurana <n1ql AT cime.net> +" Version: 1.0 +" Source: https://github.com/pr3d4t0r/n1ql-vim-syntax +" +" License: Vim is Charityware. n1ql.vim syntax is Charityware. +" (c) Copyright 2017 by Eugene Ciurana / pr3d4t0r. Licensed +" under the standard VIM LICENSE - Vim command :help uganda.txt +" for details. +" +" Questions, comments: <n1ql AT cime.net> +" https://ciurana.eu/pgp, https://keybase.io/pr3d4t0r +" +" vim: set fileencoding=utf-8: + + +if exists("b:current_syntax") + finish +endif + + +syn case ignore + +syn keyword n1qlSpecial DATASTORES +syn keyword n1qlSpecial DUAL +syn keyword n1qlSpecial FALSE +syn keyword n1qlSpecial INDEXES +syn keyword n1qlSpecial KEYSPACES +syn keyword n1qlSpecial MISSING +syn keyword n1qlSpecial NAMESPACES +syn keyword n1qlSpecial NULL +syn keyword n1qlSpecial TRUE + + +" +" *** keywords *** +" +syn keyword n1qlKeyword ALL +syn keyword n1qlKeyword ANY +syn keyword n1qlKeyword ASC +syn keyword n1qlKeyword BEGIN +syn keyword n1qlKeyword BETWEEN +syn keyword n1qlKeyword BREAK +syn keyword n1qlKeyword BUCKET +syn keyword n1qlKeyword CALL +syn keyword n1qlKeyword CASE +syn keyword n1qlKeyword CAST +syn keyword n1qlKeyword CLUSTER +syn keyword n1qlKeyword COLLATE +syn keyword n1qlKeyword COLLECTION +syn keyword n1qlKeyword CONNECT +syn keyword n1qlKeyword CONTINUE +syn keyword n1qlKeyword CORRELATE +syn keyword n1qlKeyword COVER +syn keyword n1qlKeyword DATABASE +syn keyword n1qlKeyword DATASET +syn keyword n1qlKeyword DATASTORE +syn keyword n1qlKeyword DECLARE +syn keyword n1qlKeyword DECREMENT +syn keyword n1qlKeyword DERIVED +syn keyword n1qlKeyword DESC +syn keyword n1qlKeyword DESCRIBE +syn keyword n1qlKeyword DO +syn keyword n1qlKeyword EACH +syn keyword n1qlKeyword ELEMENT +syn keyword n1qlKeyword ELSE +syn keyword n1qlKeyword END +syn keyword n1qlKeyword EVERY +syn keyword n1qlKeyword EXCLUDE +syn keyword n1qlKeyword EXISTS +syn keyword n1qlKeyword FETCH +syn keyword n1qlKeyword FIRST +syn keyword n1qlKeyword FLATTEN +syn keyword n1qlKeyword FOR +syn keyword n1qlKeyword FORCE +syn keyword n1qlKeyword FROM +syn keyword n1qlKeyword FUNCTION +syn keyword n1qlKeyword GROUP +syn keyword n1qlKeyword GSI +syn keyword n1qlKeyword HAVING +syn keyword n1qlKeyword IF +syn keyword n1qlKeyword IGNORE +syn keyword n1qlKeyword INCLUDE +syn keyword n1qlKeyword INCREMENT +syn keyword n1qlKeyword INDEX +syn keyword n1qlKeyword INITIAL +syn keyword n1qlKeyword INLINE +syn keyword n1qlKeyword INNER +syn keyword n1qlKeyword INTO +syn keyword n1qlKeyword KEY +syn keyword n1qlKeyword KEYS +syn keyword n1qlKeyword KEYSPACE +syn keyword n1qlKeyword KNOWN +syn keyword n1qlKeyword LAST +syn keyword n1qlKeyword LET +syn keyword n1qlKeyword LETTING +syn keyword n1qlKeyword LIMIT +syn keyword n1qlKeyword LOOP +syn keyword n1qlKeyword LSM +syn keyword n1qlKeyword MAP +syn keyword n1qlKeyword MAPPING +syn keyword n1qlKeyword MATCHED +syn keyword n1qlKeyword MATERIALIZED +syn keyword n1qlKeyword MERGE +syn keyword n1qlKeyword NAMESPACE +syn keyword n1qlKeyword NEST +syn keyword n1qlKeyword OPTION +syn keyword n1qlKeyword ORDER +syn keyword n1qlKeyword OUTER +syn keyword n1qlKeyword OVER +syn keyword n1qlKeyword PARSE +syn keyword n1qlKeyword PARTITION +syn keyword n1qlKeyword PASSWORD +syn keyword n1qlKeyword PATH +syn keyword n1qlKeyword POOL +syn keyword n1qlKeyword PRIMARY +syn keyword n1qlKeyword PRIVATE +syn keyword n1qlKeyword PRIVILEGE +syn keyword n1qlKeyword PROCEDURE +syn keyword n1qlKeyword PUBLIC +syn keyword n1qlKeyword REALM +syn keyword n1qlKeyword REDUCE +syn keyword n1qlKeyword RETURN +syn keyword n1qlKeyword RETURNING +syn keyword n1qlKeyword ROLE +syn keyword n1qlKeyword SATISFIES +syn keyword n1qlKeyword SCHEMA +syn keyword n1qlKeyword SELF +syn keyword n1qlKeyword SEMI +syn keyword n1qlKeyword SHOW +syn keyword n1qlKeyword START +syn keyword n1qlKeyword STATISTICS +syn keyword n1qlKeyword SYSTEM +syn keyword n1qlKeyword THEN +syn keyword n1qlKeyword TRANSACTION +syn keyword n1qlKeyword TRIGGER +syn keyword n1qlKeyword UNDER +syn keyword n1qlKeyword UNKNOWN +syn keyword n1qlKeyword UNSET +syn keyword n1qlKeyword USE +syn keyword n1qlKeyword USER +syn keyword n1qlKeyword USING +syn keyword n1qlKeyword VALIDATE +syn keyword n1qlKeyword VALUE +syn keyword n1qlKeyword VALUED +syn keyword n1qlKeyword VALUES +syn keyword n1qlKeyword VIEW +syn keyword n1qlKeyword WHEN +syn keyword n1qlKeyword WHERE +syn keyword n1qlKeyword WHILE +syn keyword n1qlKeyword WITHIN +syn keyword n1qlKeyword WORK + + +" +" *** functions *** +" +syn keyword n1qlOperator ABS +syn keyword n1qlOperator ACOS +syn keyword n1qlOperator ARRAY_AGG +syn keyword n1qlOperator ARRAY_APPEND +syn keyword n1qlOperator ARRAY_AVG +syn keyword n1qlOperator ARRAY_CONCAT +syn keyword n1qlOperator ARRAY_CONTAINS +syn keyword n1qlOperator ARRAY_COUNT +syn keyword n1qlOperator ARRAY_DISTINCT +syn keyword n1qlOperator ARRAY_FLATTEN +syn keyword n1qlOperator ARRAY_IFNULL +syn keyword n1qlOperator ARRAY_INSERT +syn keyword n1qlOperator ARRAY_INTERSECT +syn keyword n1qlOperator ARRAY_LENGTH +syn keyword n1qlOperator ARRAY_MAX +syn keyword n1qlOperator ARRAY_MIN +syn keyword n1qlOperator ARRAY_POSITION +syn keyword n1qlOperator ARRAY_PREPEND +syn keyword n1qlOperator ARRAY_PUT +syn keyword n1qlOperator ARRAY_RANGE +syn keyword n1qlOperator ARRAY_REMOVE +syn keyword n1qlOperator ARRAY_REPEAT +syn keyword n1qlOperator ARRAY_REPLACE +syn keyword n1qlOperator ARRAY_REVERSE +syn keyword n1qlOperator ARRAY_SORT +syn keyword n1qlOperator ARRAY_START +syn keyword n1qlOperator ARRAY_SUM +syn keyword n1qlOperator ARRAY_SYMDIFF +syn keyword n1qlOperator ARRAY_UNION +syn keyword n1qlOperator ASIN +syn keyword n1qlOperator ATAN +syn keyword n1qlOperator ATAN2 +syn keyword n1qlOperator AVG +syn keyword n1qlOperator BASE64 +syn keyword n1qlOperator BASE64_DECODE +syn keyword n1qlOperator BASE64_ENCODE +syn keyword n1qlOperator CEIL +syn keyword n1qlOperator CLOCK_LOCAL +syn keyword n1qlOperator CLOCK_STR +syn keyword n1qlOperator CLOCK_TZ +syn keyword n1qlOperator CLOCK_UTC +syn keyword n1qlOperator CLOCL_MILLIS +syn keyword n1qlOperator CONTAINS +syn keyword n1qlOperator COS +syn keyword n1qlOperator COUNT +syn keyword n1qlOperator DATE_ADD_MILLIS +syn keyword n1qlOperator DATE_ADD_STR +syn keyword n1qlOperator DATE_DIFF_MILLIS +syn keyword n1qlOperator DATE_DIFF_STR +syn keyword n1qlOperator DATE_FORMAT_STR +syn keyword n1qlOperator DATE_PART_MILLIS +syn keyword n1qlOperator DATE_PART_STR +syn keyword n1qlOperator DATE_RANGE_MILLIS +syn keyword n1qlOperator DATE_RANGE_STR +syn keyword n1qlOperator DATE_TRUC_STR +syn keyword n1qlOperator DATE_TRUNC_MILLIS +syn keyword n1qlOperator DECODE_JSON +syn keyword n1qlOperator DEGREES +syn keyword n1qlOperator DURATION_TO_STR +syn keyword n1qlOperator E +syn keyword n1qlOperator ENCODED_SIZE +syn keyword n1qlOperator ENCODE_JSON +syn keyword n1qlOperator EXP +syn keyword n1qlOperator FLOOR +syn keyword n1qlOperator GREATEST +syn keyword n1qlOperator IFINF +syn keyword n1qlOperator IFMISSING +syn keyword n1qlOperator IFMISSINGORNULL +syn keyword n1qlOperator IFNAN +syn keyword n1qlOperator IFNANORINF +syn keyword n1qlOperator IFNULL +syn keyword n1qlOperator INITCAP +syn keyword n1qlOperator ISARRAY +syn keyword n1qlOperator ISATOM +syn keyword n1qlOperator ISBOOLEAN +syn keyword n1qlOperator ISNUMBER +syn keyword n1qlOperator ISOBJECT +syn keyword n1qlOperator ISSTRING +syn keyword n1qlOperator LEAST +syn keyword n1qlOperator LENGTH +syn keyword n1qlOperator LN +syn keyword n1qlOperator LOG +syn keyword n1qlOperator LOWER +syn keyword n1qlOperator LTRIM +syn keyword n1qlOperator MAX +syn keyword n1qlOperator META +syn keyword n1qlOperator MILLIS +syn keyword n1qlOperator MILLIS_TO_LOCAL +syn keyword n1qlOperator MILLIS_TO_STR +syn keyword n1qlOperator MILLIS_TO_TZ +syn keyword n1qlOperator MILLIS_TO_UTC +syn keyword n1qlOperator MILLIS_TO_ZONE_NAME +syn keyword n1qlOperator MIN +syn keyword n1qlOperator MISSINGIF +syn keyword n1qlOperator NANIF +syn keyword n1qlOperator NEGINFIF +syn keyword n1qlOperator NOW_LOCAL +syn keyword n1qlOperator NOW_MILLIS +syn keyword n1qlOperator NOW_STR +syn keyword n1qlOperator NOW_TZ +syn keyword n1qlOperator NOW_UTC +syn keyword n1qlOperator NULLIF +syn keyword n1qlOperator OBJECT_ADD +syn keyword n1qlOperator OBJECT_CONCAT +syn keyword n1qlOperator OBJECT_INNER_PAIRS +syn keyword n1qlOperator OBJECT_INNER_VALUES +syn keyword n1qlOperator OBJECT_LENGTH +syn keyword n1qlOperator OBJECT_NAMES +syn keyword n1qlOperator OBJECT_PAIRS +syn keyword n1qlOperator OBJECT_PUT +syn keyword n1qlOperator OBJECT_REMOVE +syn keyword n1qlOperator OBJECT_RENAME +syn keyword n1qlOperator OBJECT_REPLACE +syn keyword n1qlOperator OBJECT_UNWRAP +syn keyword n1qlOperator OBJECT_VALUES +syn keyword n1qlOperator PI +syn keyword n1qlOperator POLY_LENGTH +syn keyword n1qlOperator POSINIF +syn keyword n1qlOperator POSITION +syn keyword n1qlOperator POWER +syn keyword n1qlOperator RADIANS +syn keyword n1qlOperator RANDOM +syn keyword n1qlOperator REGEXP_CONTAINS +syn keyword n1qlOperator REGEXP_LIKE +syn keyword n1qlOperator REGEXP_POSITION +syn keyword n1qlOperator REGEXP_REPLACE +syn keyword n1qlOperator REPEAT +syn keyword n1qlOperator REPLACE +syn keyword n1qlOperator REVERSE +syn keyword n1qlOperator ROUND +syn keyword n1qlOperator RTRIM +syn keyword n1qlOperator SIGN +syn keyword n1qlOperator SIN +syn keyword n1qlOperator SPLIT +syn keyword n1qlOperator SQRT +syn keyword n1qlOperator STR_TO_DURATION +syn keyword n1qlOperator STR_TO_MILLIS +syn keyword n1qlOperator STR_TO_TZ +syn keyword n1qlOperator STR_TO_UTC +syn keyword n1qlOperator STR_TO_ZONE_NAME +syn keyword n1qlOperator SUBSTR +syn keyword n1qlOperator SUFFIXES +syn keyword n1qlOperator SUM +syn keyword n1qlOperator TAN +syn keyword n1qlOperator TITLE +syn keyword n1qlOperator TOARRAY +syn keyword n1qlOperator TOATOM +syn keyword n1qlOperator TOBOOLEAN +syn keyword n1qlOperator TOKENS +syn keyword n1qlOperator TONUMBER +syn keyword n1qlOperator TOOBJECT +syn keyword n1qlOperator TOSTRING +syn keyword n1qlOperator TRIM +syn keyword n1qlOperator TRUNC +syn keyword n1qlOperator TYPE +syn keyword n1qlOperator UPPER +syn keyword n1qlOperator UUID +syn keyword n1qlOperator WEEKDAY_MILLIS +syn keyword n1qlOperator WEEKDAY_STR + + +" +" *** operators *** +" +syn keyword n1qlOperator AND +syn keyword n1qlOperator AS +syn keyword n1qlOperator BY +syn keyword n1qlOperator DISTINCT +syn keyword n1qlOperator EXCEPT +syn keyword n1qlOperator ILIKE +syn keyword n1qlOperator IN +syn keyword n1qlOperator INTERSECT +syn keyword n1qlOperator IS +syn keyword n1qlOperator JOIN +syn keyword n1qlOperator LEFT +syn keyword n1qlOperator LIKE +syn keyword n1qlOperator MINUS +syn keyword n1qlOperator NEST +syn keyword n1qlOperator NESTING +syn keyword n1qlOperator NOT +syn keyword n1qlOperator OFFSET +syn keyword n1qlOperator ON +syn keyword n1qlOperator OR +syn keyword n1qlOperator OUT +syn keyword n1qlOperator RIGHT +syn keyword n1qlOperator SOME +syn keyword n1qlOperator TO +syn keyword n1qlOperator UNION +syn keyword n1qlOperator UNIQUE +syn keyword n1qlOperator UNNEST +syn keyword n1qlOperator VIA +syn keyword n1qlOperator WITH +syn keyword n1qlOperator XOR + + +" +" *** statements *** +" +syn keyword n1qlStatement ALTER +syn keyword n1qlStatement ANALYZE +syn keyword n1qlStatement BUILD +syn keyword n1qlStatement COMMIT +syn keyword n1qlStatement CREATE +syn keyword n1qlStatement DELETE +syn keyword n1qlStatement DROP +syn keyword n1qlStatement EXECUTE +syn keyword n1qlStatement EXPLAIN +syn keyword n1qlStatement GRANT +syn keyword n1qlStatement INFER +syn keyword n1qlStatement INSERT +syn keyword n1qlStatement MERGE +syn keyword n1qlStatement PREPARE +syn keyword n1qlStatement RENAME +syn keyword n1qlStatement REVOKE +syn keyword n1qlStatement ROLLBACK +syn keyword n1qlStatement SELECT +syn keyword n1qlStatement SET +syn keyword n1qlStatement TRUNCATE +syn keyword n1qlStatement UPDATE +syn keyword n1qlStatement UPSERT + + +" +" *** types *** +" +syn keyword n1qlType ARRAY +syn keyword n1qlType BINARY +syn keyword n1qlType BOOLEAN +syn keyword n1qlType NUMBER +syn keyword n1qlType OBJECT +syn keyword n1qlType RAW +syn keyword n1qlType STRING + + +" +" *** strings and characters *** +" +syn region n1qlString start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region n1qlString start=+'+ skip=+\\\\\|\\'+ end=+'+ +syn region n1qlBucketSpec start=+`+ skip=+\\\\\|\\'+ end=+`+ + + +" +" *** numbers *** +" +syn match n1qlNumber "-\=\<\d*\.\=[0-9_]\>" + + +" +" *** comments *** +" +syn region n1qlComment start="/\*" end="\*/" contains=n1qlTODO +syn match n1qlComment "--.*$" contains=n1qlTODO +syn sync ccomment n1qlComment + + +" +" *** TODO *** +" +syn keyword n1qlTODO contained TODO FIXME XXX DEBUG NOTE + + +" +" *** enable *** +" +hi def link n1qlBucketSpec Underlined +hi def link n1qlComment Comment +hi def link n1qlKeyword Macro +hi def link n1qlOperator Function +hi def link n1qlSpecial Special +hi def link n1qlStatement Statement +hi def link n1qlString String +hi def link n1qlTODO Todo +hi def link n1qlType Type + +let b:current_syntax = "n1ql" diff --git a/runtime/syntax/named.vim b/runtime/syntax/named.vim index faec5f68e5..a5757d5eb9 100644 --- a/runtime/syntax/named.vim +++ b/runtime/syntax/named.vim @@ -11,25 +11,16 @@ " This file could do with a lot of improvements, so comments are welcome. " Please submit the named.conf (segment) with any comments. " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif syn case match -if version >= 600 - setlocal iskeyword=.,-,48-58,A-Z,a-z,_ -else - set iskeyword=.,-,48-58,A-Z,a-z,_ -endif +setlocal iskeyword=.,-,48-58,A-Z,a-z,_ -if version >= 600 - syn sync match namedSync grouphere NONE "^(zone|controls|acl|key)" -endif +syn sync match namedSync grouphere NONE "^(zone|controls|acl|key)" let s:save_cpo = &cpo set cpo-=C @@ -197,48 +188,38 @@ syn match namedEParenError contained +{+ syn match namedParenError +}\([^;]\|$\)+ " 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_named_syn_inits") - if version < 508 - let did_named_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink namedComment Comment - HiLink namedInclude Include - HiLink namedKeyword Keyword - HiLink namedIntKeyword Keyword - HiLink namedIdentifier Identifier - HiLink namedIntIdent Identifier - - HiLink namedString String - HiLink namedBool Type - HiLink namedNotBool Error - HiLink namedNumber Number - HiLink namedNotNumber Error - - HiLink namedOption namedKeyword - HiLink namedLogOption namedKeyword - HiLink namedCNOption namedKeyword - HiLink namedQSKeywords Type - HiLink namedCNKeywords Type - HiLink namedLogCategory Type - HiLink namedIPaddr Number - HiLink namedDomain Identifier - HiLink namedZoneOpt namedKeyword - HiLink namedZoneType Type - HiLink namedParenError Error - HiLink namedEParenError Error - HiLink namedIllegalDom Error - HiLink namedIPerror Error - HiLink namedSpareDot Error - HiLink namedError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link namedComment Comment +hi def link namedInclude Include +hi def link namedKeyword Keyword +hi def link namedIntKeyword Keyword +hi def link namedIdentifier Identifier +hi def link namedIntIdent Identifier + +hi def link namedString String +hi def link namedBool Type +hi def link namedNotBool Error +hi def link namedNumber Number +hi def link namedNotNumber Error + +hi def link namedOption namedKeyword +hi def link namedLogOption namedKeyword +hi def link namedCNOption namedKeyword +hi def link namedQSKeywords Type +hi def link namedCNKeywords Type +hi def link namedLogCategory Type +hi def link namedIPaddr Number +hi def link namedDomain Identifier +hi def link namedZoneOpt namedKeyword +hi def link namedZoneType Type +hi def link namedParenError Error +hi def link namedEParenError Error +hi def link namedIllegalDom Error +hi def link namedIPerror Error +hi def link namedSpareDot Error +hi def link namedError Error + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/syntax/nanorc.vim b/runtime/syntax/nanorc.vim index 2ae4961fdb..606ac7fdf1 100644 --- a/runtime/syntax/nanorc.vim +++ b/runtime/syntax/nanorc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: nanorc(5) - GNU nano configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: nanorc(5) - GNU nano configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/nasm.vim b/runtime/syntax/nasm.vim index a6ed056650..4f70a0f334 100644 --- a/runtime/syntax/nasm.vim +++ b/runtime/syntax/nasm.vim @@ -1,18 +1,17 @@ " Vim syntax file " Language: NASM - The Netwide Assembler (v0.98) -" Maintainer: Andriy Sokolov <andriy145@gmail.com> +" Maintainer: Andrii Sokolov <andriy145@gmail.com> " Original Author: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> " Former Maintainer: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> -" Last Change: 2012 Feb 7 +" Contributors: Leonard König <leonard.r.koenig@gmail.com> (C string highlighting) +" Last Change: 2017 Jan 23 " NASM Home: http://www.nasm.us/ " Setup Syntax: -" Clear old syntax settings -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 " Assembler syntax is case insensetive @@ -21,18 +20,10 @@ syn case ignore " Vim search and movement commands on identifers -if version < 600 - " Comments at start of a line inside which to skip search for indentifiers - set comments=:; - " Identifier Keyword characters (defines \k) - set iskeyword=@,48-57,#,$,.,?,@-@,_,~ -else - " Comments at start of a line inside which to skip search for indentifiers - setlocal comments=:; - " Identifier Keyword characters (defines \k) - setlocal iskeyword=@,48-57,#,$,.,?,@-@,_,~ -endif - +" Comments at start of a line inside which to skip search for indentifiers +setlocal comments=:; +" Identifier Keyword characters (defines \k) +setlocal iskeyword=@,48-57,#,$,.,?,@-@,_,~ " Comments: @@ -77,8 +68,23 @@ syn match nasmLabelError "\<\~\s*\(\k*\s*:\|\$\=\.\k*\)" " Constants: -syn match nasmStringError +["']+ +syn match nasmStringError +["'`]+ +" NASM is case sensitive here: eg. u-prefix allows for 4-digit, U-prefix for +" 8-digit Unicode characters +syn case match +" one-char escape-sequences +syn match nasmCStringEscape display contained "\\[’"‘\\\?abtnvfre]" +" hex and octal numbers +syn match nasmCStringEscape display contained "\\\(x\x\{2}\|\o\{1,3}\)" +" Unicode characters +syn match nasmCStringEscape display contained "\\\(u\x\{4}\|U\x\{8}\)" +" ISO C99 format strings (copied from cFormat in runtime/syntax/c.vim) +syn match nasmCStringFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained +syn match nasmCStringFormat display "%%" contained syn match nasmString +\("[^"]\{-}"\|'[^']\{-}'\)+ +" Highlight C escape- and format-sequences within ``-strings +syn match nasmCString +\(`[^`]\{-}`\)+ contains=nasmCStringEscape,nasmCStringFormat extend +syn case ignore syn match nasmBinNumber "\<[0-1]\+b\>" syn match nasmBinNumber "\<\~[0-1]\+b\>"lc=1 syn match nasmOctNumber "\<\o\+q\>" @@ -431,96 +437,89 @@ syn sync match nasmSync grouphere NONE "^\s*%endmacro\>" " 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_nasm_syntax_inits") - if version < 508 - let did_nasm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +" Sub Links: +hi def link nasmInMacDirective nasmDirective +hi def link nasmInMacLabel nasmLocalLabel +hi def link nasmInMacLblWarn nasmLabelWarn +hi def link nasmInMacMacro nasmMacro +hi def link nasmInMacParam nasmMacro +hi def link nasmInMacParamNum nasmDecNumber +hi def link nasmInMacPreCondit nasmPreCondit +hi def link nasmInMacPreProc nasmPreProc +hi def link nasmInPreCondit nasmPreCondit +hi def link nasmInStructure nasmStructure +hi def link nasmStructureLabel nasmStructure + +" Comment Group: +hi def link nasmComment Comment +hi def link nasmSpecialComment SpecialComment +hi def link nasmInCommentTodo Todo + +" Constant Group: +hi def link nasmString String +hi def link nasmCString String +hi def link nasmStringError Error +hi def link nasmCStringEscape SpecialChar +hi def link nasmCStringFormat SpecialChar +hi def link nasmBinNumber Number +hi def link nasmOctNumber Number +hi def link nasmDecNumber Number +hi def link nasmHexNumber Number +hi def link nasmFltNumber Float +hi def link nasmNumberError Error + +" Identifier Group: +hi def link nasmLabel Identifier +hi def link nasmLocalLabel Identifier +hi def link nasmSpecialLabel Special +hi def link nasmLabelError Error +hi def link nasmLabelWarn Todo + +" PreProc Group: +hi def link nasmPreProc PreProc +hi def link nasmDefine Define +hi def link nasmInclude Include +hi def link nasmMacro Macro +hi def link nasmPreCondit PreCondit +hi def link nasmPreProcError Error +hi def link nasmPreProcWarn Todo + +" Type Group: +hi def link nasmType Type +hi def link nasmStorage StorageClass +hi def link nasmStructure Structure +hi def link nasmTypeError Error + +" Directive Group: +hi def link nasmConstant Constant +hi def link nasmInstrModifier Operator +hi def link nasmRepeat Repeat +hi def link nasmDirective Keyword +hi def link nasmStdDirective Operator +hi def link nasmFmtDirective Keyword + +" Register Group: +hi def link nasmCtrlRegister Special +hi def link nasmDebugRegister Debug +hi def link nasmTestRegister Special +hi def link nasmRegisterError Error +hi def link nasmMemRefError Error + +" Instruction Group: +hi def link nasmStdInstruction Statement +hi def link nasmSysInstruction Statement +hi def link nasmDbgInstruction Debug +hi def link nasmFpuInstruction Statement +hi def link nasmMmxInstruction Statement +hi def link nasmSseInstruction Statement +hi def link nasmNowInstruction Statement +hi def link nasmAmdInstruction Special +hi def link nasmCrxInstruction Special +hi def link nasmUndInstruction Todo +hi def link nasmInstructnError Error - " Sub Links: - HiLink nasmInMacDirective nasmDirective - HiLink nasmInMacLabel nasmLocalLabel - HiLink nasmInMacLblWarn nasmLabelWarn - HiLink nasmInMacMacro nasmMacro - HiLink nasmInMacParam nasmMacro - HiLink nasmInMacParamNum nasmDecNumber - HiLink nasmInMacPreCondit nasmPreCondit - HiLink nasmInMacPreProc nasmPreProc - HiLink nasmInPreCondit nasmPreCondit - HiLink nasmInStructure nasmStructure - HiLink nasmStructureLabel nasmStructure - - " Comment Group: - HiLink nasmComment Comment - HiLink nasmSpecialComment SpecialComment - HiLink nasmInCommentTodo Todo - - " Constant Group: - HiLink nasmString String - HiLink nasmStringError Error - HiLink nasmBinNumber Number - HiLink nasmOctNumber Number - HiLink nasmDecNumber Number - HiLink nasmHexNumber Number - HiLink nasmFltNumber Float - HiLink nasmNumberError Error - - " Identifier Group: - HiLink nasmLabel Identifier - HiLink nasmLocalLabel Identifier - HiLink nasmSpecialLabel Special - HiLink nasmLabelError Error - HiLink nasmLabelWarn Todo - - " PreProc Group: - HiLink nasmPreProc PreProc - HiLink nasmDefine Define - HiLink nasmInclude Include - HiLink nasmMacro Macro - HiLink nasmPreCondit PreCondit - HiLink nasmPreProcError Error - HiLink nasmPreProcWarn Todo - - " Type Group: - HiLink nasmType Type - HiLink nasmStorage StorageClass - HiLink nasmStructure Structure - HiLink nasmTypeError Error - - " Directive Group: - HiLink nasmConstant Constant - HiLink nasmInstrModifier Operator - HiLink nasmRepeat Repeat - HiLink nasmDirective Keyword - HiLink nasmStdDirective Operator - HiLink nasmFmtDirective Keyword - - " Register Group: - HiLink nasmCtrlRegister Special - HiLink nasmDebugRegister Debug - HiLink nasmTestRegister Special - HiLink nasmRegisterError Error - HiLink nasmMemRefError Error - - " Instruction Group: - HiLink nasmStdInstruction Statement - HiLink nasmSysInstruction Statement - HiLink nasmDbgInstruction Debug - HiLink nasmFpuInstruction Statement - HiLink nasmMmxInstruction Statement - HiLink nasmSseInstruction Statement - HiLink nasmNowInstruction Statement - HiLink nasmAmdInstruction Special - HiLink nasmCrxInstruction Special - HiLink nasmUndInstruction Todo - HiLink nasmInstructnError Error - - delcommand HiLink -endif let b:current_syntax = "nasm" diff --git a/runtime/syntax/nastran.vim b/runtime/syntax/nastran.vim index f7927693fa..239fd6e49d 100644 --- a/runtime/syntax/nastran.vim +++ b/runtime/syntax/nastran.vim @@ -6,11 +6,8 @@ " Since DMAP shares some traits with fortran, this syntax file " is based on the fortran.vim syntax file. "---------------------------------------------------------------------- -" Remove any old syntax stuff hanging around -"syn clear -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " DMAP is not case dependent @@ -156,37 +153,28 @@ syn region nastranBulkData start=+ *[Bb][Uu][Ll][Kk] *$+ end=+^ [Ee][Nn][Dd] *[D syn keyword nastranUtilCard ECHOON ECHOOFF INCLUDE PARAM -if version >= 508 || !exists("did_nastran_syntax_inits") - if version < 508 - let did_nastran_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi link <args> - endif - " The default methods for highlighting. Can be overridden later - HiLink nastranDmapexecmod Statement - HiLink nastranDmapType Type - HiLink nastranDmapPreCondit Error - HiLink nastranDmapUtilmod PreProc - HiLink nastranDmapMatmod nastranDmapUtilmod - HiLink nastranDmapString String - HiLink nastranDmapNumber Constant - HiLink nastranDmapFloat nastranDmapNumber - HiLink nastranDmapInitTab nastranDmapNumber - HiLink nastranDmapTab nastranDmapNumber - HiLink nastranDmapLogical nastranDmapExecmod - HiLink nastranDmapImplicit Identifier - HiLink nastranDmapComment Comment - HiLink nastranDmapRepeat nastranDmapexecmod - HiLink nastranNastranCard nastranDmapPreCondit - HiLink nastranECSCard nastranDmapUtilmod - HiLink nastranFMSCard nastranNastranCard - HiLink nastranCC nastranDmapexecmod - HiLink nastranDelimiter Special - HiLink nastranBulkData nastranDmapType - HiLink nastranUtilCard nastranDmapexecmod - delcommand HiLink -endif +" The default methods for highlighting. Can be overridden later +hi def link nastranDmapexecmod Statement +hi def link nastranDmapType Type +hi def link nastranDmapPreCondit Error +hi def link nastranDmapUtilmod PreProc +hi def link nastranDmapMatmod nastranDmapUtilmod +hi def link nastranDmapString String +hi def link nastranDmapNumber Constant +hi def link nastranDmapFloat nastranDmapNumber +hi def link nastranDmapInitTab nastranDmapNumber +hi def link nastranDmapTab nastranDmapNumber +hi def link nastranDmapLogical nastranDmapExecmod +hi def link nastranDmapImplicit Identifier +hi def link nastranDmapComment Comment +hi def link nastranDmapRepeat nastranDmapexecmod +hi def link nastranNastranCard nastranDmapPreCondit +hi def link nastranECSCard nastranDmapUtilmod +hi def link nastranFMSCard nastranNastranCard +hi def link nastranCC nastranDmapexecmod +hi def link nastranDelimiter Special +hi def link nastranBulkData nastranDmapType +hi def link nastranUtilCard nastranDmapexecmod let b:current_syntax = "nastran" diff --git a/runtime/syntax/natural.vim b/runtime/syntax/natural.vim index 4fbc916be2..be529f2d85 100644 --- a/runtime/syntax/natural.vim +++ b/runtime/syntax/natural.vim @@ -6,16 +6,11 @@ " Last Changed: 2012-02-05 18:50:43 " Support: http://www.von-oppen.com/ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when this syntax file was already loaded -if v:version < 600 - syntax clear - set iskeyword+=-,*,#,+,_,/ -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish -else - setlocal iskeyword+=-,*,#,+,_,/ endif +setlocal iskeyword+=-,*,#,+,_,/ let s:cpo_save = &cpo set cpo&vim @@ -153,59 +148,50 @@ if v:version >= 600 endif -if v:version >= 508 || !exists("did_natural_syntax_inits") - if v:version < 508 - let did_natural_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " The default methods for highlighting. Can be overridden later - - " Constants - HiLink naturalFormat Constant - HiLink naturalAttribute Constant - HiLink naturalNumber Number - HiLink naturalString String - HiLink naturalBoolean Boolean - - " All kinds of keywords - HiLink naturalConditional Conditional - HiLink naturalRepeat Repeat - HiLink naturalLoop Repeat - HiLink naturalFlow Keyword - HiLink naturalError Keyword - HiLink naturalKeyword Keyword - HiLink naturalOperator Operator - HiLink naturalParGui Operator - - " Labels - HiLink naturalLabel Label - HiLink naturalRefLabel Label - - " Comments - HiLink naturalPComment Comment - HiLink naturalComment Comment - HiLink naturalTodo Todo - HiLink naturalCommentMark PreProc - - HiLink naturalInclude Include - HiLink naturalSysVar Identifier - HiLink naturalLineNo LineNr - HiLink naturalLineRef Error - HiLink naturalSpecial Special - HiLink naturalComKey Todo - - " illegal things - HiLink naturalRMKeyword Error - HiLink naturalLegalIdent Error - - HiLink naturalType Type - HiLink naturalFunction Function - HiLink naturalObjName PreProc - - delcommand HiLink -endif +" The default methods for highlighting. Can be overridden later + +" Constants +hi def link naturalFormat Constant +hi def link naturalAttribute Constant +hi def link naturalNumber Number +hi def link naturalString String +hi def link naturalBoolean Boolean + +" All kinds of keywords +hi def link naturalConditional Conditional +hi def link naturalRepeat Repeat +hi def link naturalLoop Repeat +hi def link naturalFlow Keyword +hi def link naturalError Keyword +hi def link naturalKeyword Keyword +hi def link naturalOperator Operator +hi def link naturalParGui Operator + +" Labels +hi def link naturalLabel Label +hi def link naturalRefLabel Label + +" Comments +hi def link naturalPComment Comment +hi def link naturalComment Comment +hi def link naturalTodo Todo +hi def link naturalCommentMark PreProc + +hi def link naturalInclude Include +hi def link naturalSysVar Identifier +hi def link naturalLineNo LineNr +hi def link naturalLineRef Error +hi def link naturalSpecial Special +hi def link naturalComKey Todo + +" illegal things +hi def link naturalRMKeyword Error +hi def link naturalLegalIdent Error + +hi def link naturalType Type +hi def link naturalFunction Function +hi def link naturalObjName PreProc + let b:current_syntax = "natural" diff --git a/runtime/syntax/ncf.vim b/runtime/syntax/ncf.vim index 2019c03723..0027fd4ef8 100644 --- a/runtime/syntax/ncf.vim +++ b/runtime/syntax/ncf.vim @@ -4,10 +4,8 @@ " Last Change: Tue, 04 Sep 2001 16:20:33 CDT " $Id: ncf.vim,v 1.1 2004/06/13 16:31:58 vimboss Exp $ -" Remove any old syntax stuff hanging around -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 @@ -217,42 +215,33 @@ if exists("ncf_highlight_unknowns") syn match Error "[^ \t]*" contains=ALL endif -if version >= 508 || !exists("did_ncf_syntax_inits") - if version < 508 - let did_ncf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " The default methods for highlighting. Can be overridden later - HiLink ncfCommands Statement - HiLink ncfSetCommands ncfCommands - HiLink ncfLogins ncfCommands - HiLink ncfString String - HiLink ncfContString ncfString - HiLink ncfComment Comment - HiLink ncfImplicit Type - HiLink ncfBoolean Boolean - HiLink ncfScript Identifier - HiLink ncfNumber Number - HiLink ncfIPAddr ncfNumber - HiLink ncfHexNumber ncfNumber - HiLink ncfTime ncfNumber - HiLink ncfDSTTime ncfNumber - HiLink ncfPath Constant - HiLink ncfServerName Special - HiLink ncfIPXNet ncfServerName - HiLink ncfTimeTypes Constant - HiLink ncfSetCommandsNum ncfSetCommands - HiLink ncfSetCommandsBool ncfSetCommands - HiLink ncfSetCommandsStr ncfSetCommands - HiLink ncfSetCommandsTime ncfSetCommands - HiLink ncfSetCommandsTimeDate ncfSetCommands - HiLink ncfSetCommandsBindCon ncfSetCommands +" The default methods for highlighting. Can be overridden later +hi def link ncfCommands Statement +hi def link ncfSetCommands ncfCommands +hi def link ncfLogins ncfCommands +hi def link ncfString String +hi def link ncfContString ncfString +hi def link ncfComment Comment +hi def link ncfImplicit Type +hi def link ncfBoolean Boolean +hi def link ncfScript Identifier +hi def link ncfNumber Number +hi def link ncfIPAddr ncfNumber +hi def link ncfHexNumber ncfNumber +hi def link ncfTime ncfNumber +hi def link ncfDSTTime ncfNumber +hi def link ncfPath Constant +hi def link ncfServerName Special +hi def link ncfIPXNet ncfServerName +hi def link ncfTimeTypes Constant +hi def link ncfSetCommandsNum ncfSetCommands +hi def link ncfSetCommandsBool ncfSetCommands +hi def link ncfSetCommandsStr ncfSetCommands +hi def link ncfSetCommandsTime ncfSetCommands +hi def link ncfSetCommandsTimeDate ncfSetCommands +hi def link ncfSetCommandsBindCon ncfSetCommands - delcommand HiLink -endif let b:current_syntax = "ncf" diff --git a/runtime/syntax/neomuttrc.vim b/runtime/syntax/neomuttrc.vim new file mode 100644 index 0000000000..7ff89879d9 --- /dev/null +++ b/runtime/syntax/neomuttrc.vim @@ -0,0 +1,1049 @@ +" Vim syntax file +" Language: NeoMutt setup files +" Maintainer: Guillaume Brogi <gui-gui@netcourrier.com> +" Last Change: 2018-03-25 +" Original version based on syntax/muttrc.vim + +" This file covers NeoMutt 2018-03-23 + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Set the keyword characters +setlocal isk=@,48-57,_,- + +" handling optional variables +syntax match muttrcComment "^# .*$" contains=@Spell +syntax match muttrcComment "^#[^ ].*$" +syntax match muttrcComment "^#$" +syntax match muttrcComment "[^\\]#.*$"lc=1 + +" Escape sequences (back-tick and pipe goes here too) +syntax match muttrcEscape +\\[#tnr"'Cc ]+ +syntax match muttrcEscape +[`|]+ +syntax match muttrcEscape +\\$+ + +" The variables takes the following arguments +"syn match muttrcString contained "=\s*[^ #"'`]\+"lc=1 contains=muttrcEscape +syntax region muttrcString contained keepend start=+"+ms=e skip=+\\"+ end=+"+ contains=muttrcEscape,muttrcCommand,muttrcAction,muttrcShellString +syntax region muttrcString contained keepend start=+'+ms=e skip=+\\'+ end=+'+ contains=muttrcEscape,muttrcCommand,muttrcAction +syntax match muttrcStringNL contained skipwhite skipnl "\s*\\$" nextgroup=muttrcString,muttrcStringNL + +syntax region muttrcShellString matchgroup=muttrcEscape keepend start=+`+ skip=+\\`+ end=+`+ contains=muttrcVarStr,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcCommand,muttrcVarDeprecatedStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad + +syntax match muttrcRXChars contained /[^\\][][.*?+]\+/hs=s+1 +syntax match muttrcRXChars contained /[][|()][.*?+]*/ +syntax match muttrcRXChars contained /['"]^/ms=s+1 +syntax match muttrcRXChars contained /$['"]/me=e-1 +syntax match muttrcRXChars contained /\\/ +" Why does muttrcRXString2 work with one \ when muttrcRXString requires two? +syntax region muttrcRXString contained skipwhite start=+'+ skip=+\\'+ end=+'+ contains=muttrcRXChars +syntax region muttrcRXString contained skipwhite start=+"+ skip=+\\"+ end=+"+ contains=muttrcRXChars +syntax region muttrcRXString contained skipwhite start=+[^ "'^]+ skip=+\\\s+ end=+\s+re=e-1 contains=muttrcRXChars +" For some reason, skip refuses to match backslashes here... +syntax region muttrcRXString contained matchgroup=muttrcRXChars skipwhite start=+\^+ end=+[^\\]\s+re=e-1 contains=muttrcRXChars +syntax region muttrcRXString contained matchgroup=muttrcRXChars skipwhite start=+\^+ end=+$\s+ contains=muttrcRXChars +syntax region muttrcRXString2 contained skipwhite start=+'+ skip=+\'+ end=+'+ contains=muttrcRXChars +syntax region muttrcRXString2 contained skipwhite start=+"+ skip=+\"+ end=+"+ contains=muttrcRXChars + +" these must be kept synchronized with muttrcRXString, but are intended for +" muttrcRXHooks +syntax region muttrcRXHookString contained keepend skipwhite start=+'+ skip=+\\'+ end=+'+ contains=muttrcRXString nextgroup=muttrcString,muttrcStringNL +syntax region muttrcRXHookString contained keepend skipwhite start=+"+ skip=+\\"+ end=+"+ contains=muttrcRXString nextgroup=muttrcString,muttrcStringNL +syntax region muttrcRXHookString contained keepend skipwhite start=+[^ "'^]+ skip=+\\\s+ end=+\s+re=e-1 contains=muttrcRXString nextgroup=muttrcString,muttrcStringNL +syntax region muttrcRXHookString contained keepend skipwhite start=+\^+ end=+[^\\]\s+re=e-1 contains=muttrcRXString nextgroup=muttrcString,muttrcStringNL +syntax region muttrcRXHookString contained keepend matchgroup=muttrcRXChars skipwhite start=+\^+ end=+$\s+ contains=muttrcRXString nextgroup=muttrcString,muttrcStringNL +syntax match muttrcRXHookStringNL contained skipwhite skipnl "\s*\\$" nextgroup=muttrcRXHookString,muttrcRXHookStringNL + +" these are exclusively for args lists (e.g. -rx pat pat pat ...) +syntax region muttrcRXPat contained keepend skipwhite start=+'+ skip=+\\'+ end=+'\s*+ contains=muttrcRXString nextgroup=muttrcRXPat +syntax region muttrcRXPat contained keepend skipwhite start=+"+ skip=+\\"+ end=+"\s*+ contains=muttrcRXString nextgroup=muttrcRXPat +syntax match muttrcRXPat contained /[^-'"#!]\S\+/ skipwhite contains=muttrcRXChars nextgroup=muttrcRXPat +syntax match muttrcRXDef contained "-rx\s\+" skipwhite nextgroup=muttrcRXPat + +syntax match muttrcSpecial +\(['"]\)!\1+ + +syntax match muttrcSetStrAssignment contained skipwhite /=\s*\%(\\\?\$\)\?[0-9A-Za-z_-]\+/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcVariable,muttrcEscapedVariable +syntax region muttrcSetStrAssignment contained skipwhite keepend start=+=\s*"+hs=s+1 end=+"+ skip=+\\"+ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcString +syntax region muttrcSetStrAssignment contained skipwhite keepend start=+=\s*'+hs=s+1 end=+'+ skip=+\\'+ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcString +syntax match muttrcSetBoolAssignment contained skipwhite /=\s*\\\?\$\w\+/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcVariable,muttrcEscapedVariable +syntax match muttrcSetBoolAssignment contained skipwhite /=\s*\%(yes\|no\)/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetBoolAssignment contained skipwhite /=\s*"\%(yes\|no\)"/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetBoolAssignment contained skipwhite /=\s*'\%(yes\|no\)'/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetQuadAssignment contained skipwhite /=\s*\\\?\$\w\+/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcVariable,muttrcEscapedVariable +syntax match muttrcSetQuadAssignment contained skipwhite /=\s*\%(ask-\)\?\%(yes\|no\)/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetQuadAssignment contained skipwhite /=\s*"\%(ask-\)\?\%(yes\|no\)"/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetQuadAssignment contained skipwhite /=\s*'\%(ask-\)\?\%(yes\|no\)'/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetNumAssignment contained skipwhite /=\s*\\\?\$\w\+/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr contains=muttrcVariable,muttrcEscapedVariable +syntax match muttrcSetNumAssignment contained skipwhite /=\s*\d\+/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetNumAssignment contained skipwhite /=\s*"\d\+"/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax match muttrcSetNumAssignment contained skipwhite /=\s*'\d\+'/hs=s+1 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" Now catch some email addresses and headers (purified version from mail.vim) +syntax match muttrcEmail "[a-zA-Z0-9._-]\+@[a-zA-Z0-9./-]\+" +syntax match muttrcHeader "\<\c\%(From\|To\|C[Cc]\|B[Cc][Cc]\|Reply-To\|Subject\|Return-Path\|Received\|Date\|Replied\|Attach\)\>:\=" + +syntax match muttrcKeySpecial contained +\%(\\[Cc'"]\|\^\|\\[01]\d\{2}\)+ +syntax match muttrcKey contained "\S\+" contains=muttrcKeySpecial,muttrcKeyName +syntax region muttrcKey contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=muttrcKeySpecial,muttrcKeyName +syntax region muttrcKey contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=muttrcKeySpecial,muttrcKeyName +syntax match muttrcKeyName contained "\\[trne]" +syntax match muttrcKeyName contained "\c<\%(BackSpace\|BackTab\|Delete\|Down\|End\|Enter\|Esc\|Home\|Insert\|Left\|Next\|PageDown\|PageUp\|Return\|Right\|Space\|Tab\|Up\)>" +syntax match muttrcKeyName contained "\c<F\d\+>" + +syntax match muttrcFormatErrors contained /%./ + +syntax match muttrcStrftimeEscapes contained /%[AaBbCcDdeFGgHhIjklMmnpRrSsTtUuVvWwXxYyZz+%]/ +syntax match muttrcStrftimeEscapes contained /%E[cCxXyY]/ +syntax match muttrcStrftimeEscapes contained /%O[BdeHImMSuUVwWy]/ + +syntax region muttrcIndexFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcIndexFormatEscapes,muttrcIndexFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcIndexFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcIndexFormatEscapes,muttrcIndexFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcGroupIndexFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcGroupIndexFormatEscapes,muttrcGroupIndexFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcGroupIndexFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcGroupIndexFormatEscapes,muttrcGroupIndexFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcSidebarFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcSidebarFormatEscapes,muttrcSidebarFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcSidebarFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcSidebarFormatEscapes,muttrcSidebarFormatConditionals,muttrcFormatErrors,muttrcTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcQueryFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcQueryFormatEscapes,muttrcQueryFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcAliasFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcAliasFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcAliasFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcAliasFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcAttachFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcAttachFormatEscapes,muttrcAttachFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcAttachFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcAttachFormatEscapes,muttrcAttachFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcComposeFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcComposeFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcComposeFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcComposeFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcFolderFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcFolderFormatEscapes,muttrcFolderFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcFolderFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcFolderFormatEscapes,muttrcFolderFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcMixFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcMixFormatEscapes,muttrcMixFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcMixFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcMixFormatEscapes,muttrcMixFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPGPFormatEscapes,muttrcPGPFormatConditionals,muttrcFormatErrors,muttrcPGPTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPGPFormatEscapes,muttrcPGPFormatConditionals,muttrcFormatErrors,muttrcPGPTimeEscapes nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPCmdFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPGPCmdFormatEscapes,muttrcPGPCmdFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPCmdFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPGPCmdFormatEscapes,muttrcPGPCmdFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcStatusFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcStatusFormatEscapes,muttrcStatusFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcStatusFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcStatusFormatEscapes,muttrcStatusFormatConditionals,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPGetKeysFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPGPGetKeysFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcPGPGetKeysFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPGPGetKeysFormatEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcSmimeFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcSmimeFormatEscapes,muttrcSmimeFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcSmimeFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcSmimeFormatEscapes,muttrcSmimeFormatConditionals,muttrcVariable,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcStrftimeFormatStr contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcStrftimeEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax region muttrcStrftimeFormatStr contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcStrftimeEscapes,muttrcFormatErrors nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" Format escapes and conditionals +syntax match muttrcFormatConditionals2 contained /[^?]*?/ +function! s:escapesConditionals(baseName, sequence, alignment, secondary) + exec 'syntax match muttrc' . a:baseName . 'Escapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?\%(' . a:sequence . '\|%\)/' + if a:alignment + exec 'syntax match muttrc' . a:baseName . 'Escapes contained /%[>|*]./' + endif + if a:secondary + exec 'syntax match muttrc' . a:baseName . 'Conditionals contained /%?\%(' . a:sequence . '\)?/ nextgroup=muttrcFormatConditionals2' + else + exec 'syntax match muttrc' . a:baseName . 'Conditionals contained /%?\%(' . a:sequence . '\)?/' + endif +endfunction + +" CHECKED 2018-04-18 +" Ref: index_format_str() in hdrline.c +call s:escapesConditionals('IndexFormat', '[AaBbCcDdEeFfgHIiJKLlMmNnOPqRrSsTtuvWXxYyZz(<[{]\|G[a-zA-Z]\+', 1, 1) +" Ref: alias_format_str() in addrbook.c +syntax match muttrcAliasFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[afnrt%]/ +" Ref: group_index_format_str() in browser.c +call s:escapesConditionals('GroupIndexFormat', '[CdfMNns]', 1, 1) +" Ref: sidebar_format_str() in sidebar.c +call s:escapesConditionals('SidebarFormat', '[BdFLNnSt!]', 1, 1) +" Ref: query_format_str() in query.c +call s:escapesConditionals('QueryFormat', '[acent]', 0, 1) +" Ref: attach_format_str() in recvattach.c +call s:escapesConditionals('AttachFormat', '[CcDdeFfIMmnQsTtuX]', 1, 1) +" Ref: compose_format_str() in compose.c +syntax match muttrcComposeFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[ahlv%]/ +syntax match muttrcComposeFormatEscapes contained /%[>|*]./ +" Ref: folder_format_str() in browser.c +call s:escapesConditionals('FolderFormat', '[CDdFfglmNnstu]', 1, 0) +" Ref: mix_format_str() in remailer.c +call s:escapesConditionals('MixFormat', '[acns]', 0, 0) +" Ref: status_format_str() in status.c +call s:escapesConditionals('StatusFormat', '[bdFfhLlMmnoPpRrSstuVv]', 1, 1) +" Ref: fmt_smime_command() in ncrypt/smime.c +call s:escapesConditionals('SmimeFormat', '[aCcdfiks]', 0, 1) +" Ref: crypt_format_str() in ncrypt/crypt_gpgme.c +" Ref: pgp_entry_fmt() in ncrypt/pgpkey.c +" Note: crypt_format_str() supports 'p', but pgp_entry_fmt() does not +call s:escapesConditionals('PGPFormat', '[acfklnptu[]', 0, 0) +" Ref: fmt_pgp_command() ncrypt/pgpinvoke.c +call s:escapesConditionals('PGPCmdFormat', '[afprs]', 0, 1) + +" This matches the documentation, but directly contradicts the code +" (according to the code, this should be identical to the muttrcPGPCmdFormatEscapes +syntax match muttrcPGPGetKeysFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[acfklntu[%]/ + +syntax region muttrcTimeEscapes contained start=+%{+ end=+}+ contains=muttrcStrftimeEscapes +syntax region muttrcTimeEscapes contained start=+%\[+ end=+\]+ contains=muttrcStrftimeEscapes +syntax region muttrcTimeEscapes contained start=+%(+ end=+)+ contains=muttrcStrftimeEscapes +syntax region muttrcTimeEscapes contained start=+%<+ end=+>+ contains=muttrcStrftimeEscapes +syntax region muttrcPGPTimeEscapes contained start=+%\[+ end=+\]+ contains=muttrcStrftimeEscapes + +syntax match muttrcVarEqualsAliasFmt contained skipwhite "=" nextgroup=muttrcAliasFormatStr +syntax match muttrcVarEqualsAttachFmt contained skipwhite "=" nextgroup=muttrcAttachFormatStr +syntax match muttrcVarEqualsComposeFmt contained skipwhite "=" nextgroup=muttrcComposeFormatStr +syntax match muttrcVarEqualsFolderFmt contained skipwhite "=" nextgroup=muttrcFolderFormatStr +syntax match muttrcVarEqualsGrpIdxFmt contained skipwhite "=" nextgroup=muttrcGroupIndexFormatStr +syntax match muttrcVarEqualsIdxFmt contained skipwhite "=" nextgroup=muttrcIndexFormatStr +syntax match muttrcVarEqualsMixFmt contained skipwhite "=" nextgroup=muttrcMixFormatStr +syntax match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr +syntax match muttrcVarEqualsPGPFmt contained skipwhite "=" nextgroup=muttrcPGPFormatStr +syntax match muttrcVarEqualsPGPGetKeysFmt contained skipwhite "=" nextgroup=muttrcPGPGetKeysFormatStr +syntax match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr +syntax match muttrcVarEqualsSdbFmt contained skipwhite "=" nextgroup=muttrcSidebarFormatStr +syntax match muttrcVarEqualsSmimeFmt contained skipwhite "=" nextgroup=muttrcSmimeFormatStr +syntax match muttrcVarEqualsStatusFmt contained skipwhite "=" nextgroup=muttrcStatusFormatStr +syntax match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=muttrcStrftimeFormatStr + +syntax match muttrcVPrefix contained /[?&]/ nextgroup=muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of the different screens in mutt +syntax keyword muttrcMenu contained alias attach browser compose editor generic index key_select_pgp key_select_smime mix pager pgp postpone query smime +syntax match muttrcMenuList "\S\+" contained contains=muttrcMenu +syntax match muttrcMenuCommas /,/ contained + +" CHECKED 2018-04-18 +" List of hooks in Commands in init.h +syntax keyword muttrcHooks contained skipwhite + \ account-hook append-hook close-hook crypt-hook fcc-hook fcc-save-hook + \ folder-hook iconv-hook mbox-hook message-hook open-hook pgp-hook + \ reply-hook save-hook send-hook send2-hook +syntax keyword muttrcHooks skipwhite shutdown-hook startup-hook timeout-hook nextgroup=muttrcCommand + +syntax region muttrcSpamPattern contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPattern nextgroup=muttrcString,muttrcStringNL +syntax region muttrcSpamPattern contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPattern nextgroup=muttrcString,muttrcStringNL + +syntax region muttrcNoSpamPattern contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPattern +syntax region muttrcNoSpamPattern contained skipwhite keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcPattern + +syntax match muttrcAttachmentsMimeType contained "[*a-z0-9_-]\+/[*a-z0-9._-]\+\s*" skipwhite nextgroup=muttrcAttachmentsMimeType +syntax match muttrcAttachmentsFlag contained "[+-]\%([AI]\|inline\|attachment\)\s\+" skipwhite nextgroup=muttrcAttachmentsMimeType +syntax match muttrcAttachmentsLine "^\s*\%(un\)\?attachments\s\+" skipwhite nextgroup=muttrcAttachmentsFlag + +syntax match muttrcUnHighlightSpace contained "\%(\s\+\|\\$\)" + +syntax keyword muttrcAsterisk contained * +syntax keyword muttrcListsKeyword lists skipwhite nextgroup=muttrcGroupDef,muttrcComment +syntax keyword muttrcListsKeyword unlists skipwhite nextgroup=muttrcAsterisk,muttrcComment + +syntax keyword muttrcSubscribeKeyword subscribe nextgroup=muttrcGroupDef,muttrcComment +syntax keyword muttrcSubscribeKeyword unsubscribe nextgroup=muttrcAsterisk,muttrcComment + +syntax keyword muttrcAlternateKeyword contained alternates unalternates +syntax region muttrcAlternatesLine keepend start=+^\s*\%(un\)\?alternates\s+ skip=+\\$+ end=+$+ contains=muttrcAlternateKeyword,muttrcGroupDef,muttrcRXPat,muttrcUnHighlightSpace,muttrcComment + +" muttrcVariable includes a prefix because partial strings are considered +" valid. +syntax match muttrcVariable contained "\\\@<![a-zA-Z_-]*\$[a-zA-Z_-]\+" contains=muttrcVariableInner +syntax match muttrcVariableInner contained "\$[a-zA-Z_-]\+" +syntax match muttrcEscapedVariable contained "\\\$[a-zA-Z_-]\+" + +syntax match muttrcBadAction contained "[^<>]\+" contains=muttrcEmail +syntax match muttrcAction contained "<[^>]\{-}>" contains=muttrcBadAction,muttrcFunction,muttrcKeyName + +" First, functions that take regular expressions: +syntax match muttrcRXHookNot contained /!\s*/ skipwhite nextgroup=muttrcRXHookString,muttrcRXHookStringNL +syntax match muttrcRXHooks /\<\%(account\|append\|close\|crypt\|folder\|mbox\|open\|pgp\)-hook\>/ skipwhite nextgroup=muttrcRXHookNot,muttrcRXHookString,muttrcRXHookStringNL + +" Now, functions that take patterns +syntax match muttrcPatHookNot contained /!\s*/ skipwhite nextgroup=muttrcPattern +syntax match muttrcPatHooks /\<\%(charset\|iconv\)-hook\>/ skipwhite nextgroup=muttrcPatHookNot,muttrcPattern +syntax match muttrcPatHooks /\<\%(message\|reply\|send\|send2\|save\|fcc\|fcc-save\)-hook\>/ skipwhite nextgroup=muttrcPatHookNot,muttrcOptPattern + +syntax match muttrcBindFunction contained /\S\+\>/ skipwhite contains=muttrcFunction +syntax match muttrcBindFunctionNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcBindFunction,muttrcBindFunctionNL +syntax match muttrcBindKey contained /\S\+/ skipwhite contains=muttrcKey nextgroup=muttrcBindFunction,muttrcBindFunctionNL +syntax match muttrcBindKeyNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcBindKey,muttrcBindKeyNL +syntax match muttrcBindMenuList contained /\S\+/ skipwhite contains=muttrcMenu,muttrcMenuCommas nextgroup=muttrcBindKey,muttrcBindKeyNL +syntax match muttrcBindMenuListNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcBindMenuList,muttrcBindMenuListNL + +syntax region muttrcMacroDescr contained keepend skipwhite start=+\s*\S+ms=e skip=+\\ + end=+ \|$+me=s +syntax region muttrcMacroDescr contained keepend skipwhite start=+'+ms=e skip=+\\'+ end=+'+me=s +syntax region muttrcMacroDescr contained keepend skipwhite start=+"+ms=e skip=+\\"+ end=+"+me=s +syntax match muttrcMacroDescrNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcMacroDescr,muttrcMacroDescrNL +syntax region muttrcMacroBody contained skipwhite start="\S" skip='\\ \|\\$' end=' \|$' contains=muttrcEscape,muttrcSet,muttrcUnset,muttrcReset,muttrcToggle,muttrcCommand,muttrcAction nextgroup=muttrcMacroDescr,muttrcMacroDescrNL +syntax region muttrcMacroBody matchgroup=Type contained skipwhite start=+'+ms=e skip=+\\'+ end=+'\|\%(\%(\\\\\)\@<!$\)+me=s contains=muttrcEscape,muttrcSet,muttrcUnset,muttrcReset,muttrcToggle,muttrcSpam,muttrcNoSpam,muttrcCommand,muttrcAction,muttrcVariable nextgroup=muttrcMacroDescr,muttrcMacroDescrNL +syntax region muttrcMacroBody matchgroup=Type contained skipwhite start=+"+ms=e skip=+\\"+ end=+"\|\%(\%(\\\\\)\@<!$\)+me=s contains=muttrcEscape,muttrcSet,muttrcUnset,muttrcReset,muttrcToggle,muttrcSpam,muttrcNoSpam,muttrcCommand,muttrcAction,muttrcVariable nextgroup=muttrcMacroDescr,muttrcMacroDescrNL +syntax match muttrcMacroBodyNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcMacroBody,muttrcMacroBodyNL +syntax match muttrcMacroKey contained /\S\+/ skipwhite contains=muttrcKey nextgroup=muttrcMacroBody,muttrcMacroBodyNL +syntax match muttrcMacroKeyNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcMacroKey,muttrcMacroKeyNL +syntax match muttrcMacroMenuList contained /\S\+/ skipwhite contains=muttrcMenu,muttrcMenuCommas nextgroup=muttrcMacroKey,muttrcMacroKeyNL +syntax match muttrcMacroMenuListNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcMacroMenuList,muttrcMacroMenuListNL + +syntax match muttrcAddrContent contained "[a-zA-Z0-9._-]\+@[a-zA-Z0-9./-]\+\s*" skipwhite contains=muttrcEmail nextgroup=muttrcAddrContent +syntax region muttrcAddrContent contained start=+'+ end=+'\s*+ skip=+\\'+ skipwhite contains=muttrcEmail nextgroup=muttrcAddrContent +syntax region muttrcAddrContent contained start=+"+ end=+"\s*+ skip=+\\"+ skipwhite contains=muttrcEmail nextgroup=muttrcAddrContent +syntax match muttrcAddrDef contained "-addr\s\+" skipwhite nextgroup=muttrcAddrContent + +syntax match muttrcGroupFlag contained "-group" +syntax region muttrcGroupDef contained start="-group\s\+" skip="\\$" end="\s" skipwhite keepend contains=muttrcGroupFlag,muttrcUnHighlightSpace + +syntax keyword muttrcGroupKeyword contained group ungroup +syntax region muttrcGroupLine keepend start=+^\s*\%(un\)\?group\s+ skip=+\\$+ end=+$+ contains=muttrcGroupKeyword,muttrcGroupDef,muttrcAddrDef,muttrcRXDef,muttrcUnHighlightSpace,muttrcComment + +syntax match muttrcAliasGroupName contained /\w\+/ skipwhite nextgroup=muttrcAliasGroupDef,muttrcAliasKey,muttrcAliasNL +syntax match muttrcAliasGroupDefNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcAliasGroupName,muttrcAliasGroupDefNL +syntax match muttrcAliasGroupDef contained /\s*-group/ skipwhite nextgroup=muttrcAliasGroupName,muttrcAliasGroupDefNL contains=muttrcGroupFlag +syntax match muttrcAliasComma contained /,/ skipwhite nextgroup=muttrcAliasEmail,muttrcAliasEncEmail,muttrcAliasNameNoParens,muttrcAliasENNL +syntax match muttrcAliasEmail contained /\S\+@\S\+/ contains=muttrcEmail nextgroup=muttrcAliasName,muttrcAliasNameNL skipwhite +syntax match muttrcAliasEncEmail contained /<[^>]\+>/ contains=muttrcEmail nextgroup=muttrcAliasComma +syntax match muttrcAliasEncEmailNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcAliasEncEmail,muttrcAliasEncEmailNL +syntax match muttrcAliasNameNoParens contained /[^<(@]\+\s\+/ nextgroup=muttrcAliasEncEmail,muttrcAliasEncEmailNL +syntax region muttrcAliasName contained matchgroup=Type start=/(/ end=/)/ skipwhite +syntax match muttrcAliasNameNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcAliasName,muttrcAliasNameNL +syntax match muttrcAliasENNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcAliasEmail,muttrcAliasEncEmail,muttrcAliasNameNoParens,muttrcAliasENNL +syntax match muttrcAliasKey contained /\s*[^- \t]\S\+/ skipwhite nextgroup=muttrcAliasEmail,muttrcAliasEncEmail,muttrcAliasNameNoParens,muttrcAliasENNL +syntax match muttrcAliasNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcAliasGroupDef,muttrcAliasKey,muttrcAliasNL + +syntax match muttrcUnAliasKey contained "\s*\w\+\s*" skipwhite nextgroup=muttrcUnAliasKey,muttrcUnAliasNL +syntax match muttrcUnAliasNL contained /\s*\\$/ skipwhite skipnl nextgroup=muttrcUnAliasKey,muttrcUnAliasNL + +syntax match muttrcSimplePat contained "!\?\^\?[~][ADEFgGklNOpPQRSTuUvV=$]" +syntax match muttrcSimplePat contained "!\?\^\?[~][mnXz]\s*\%([<>-][0-9]\+[kM]\?\|[0-9]\+[kM]\?[-]\%([0-9]\+[kM]\?\)\?\)" +syntax match muttrcSimplePat contained "!\?\^\?[~][dr]\s*\%(\%(-\?[0-9]\{1,2}\%(/[0-9]\{1,2}\%(/[0-9]\{2}\%([0-9]\{2}\)\?\)\?\)\?\%([+*-][0-9]\+[ymwd]\)*\)\|\%(\%([0-9]\{1,2}\%(/[0-9]\{1,2}\%(/[0-9]\{2}\%([0-9]\{2}\)\?\)\?\)\?\%([+*-][0-9]\+[ymwd]\)*\)-\%([0-9]\{1,2}\%(/[0-9]\{1,2}\%(/[0-9]\{2}\%([0-9]\{2}\)\?\)\?\)\?\%([+*-][0-9]\+[ymwd]\)\?\)\?\)\|\%([<>=][0-9]\+[ymwd]\)\|\%(`[^`]\+`\)\|\%(\$[a-zA-Z0-9_-]\+\)\)" contains=muttrcShellString,muttrcVariable +syntax match muttrcSimplePat contained "!\?\^\?[~][bBcCefhHiLstxy]\s*" nextgroup=muttrcSimplePatRXContainer +syntax match muttrcSimplePat contained "!\?\^\?[%][bBcCefhHiLstxy]\s*" nextgroup=muttrcSimplePatString +syntax match muttrcSimplePat contained "!\?\^\?[=][bcCefhHiLstxy]\s*" nextgroup=muttrcSimplePatString +syntax region muttrcSimplePat contained keepend start=+!\?\^\?[~](+ end=+)+ contains=muttrcSimplePat +"syn match muttrcSimplePat contained /'[^~=%][^']*/ contains=muttrcRXString +syntax region muttrcSimplePatString contained keepend start=+"+ end=+"+ skip=+\\"+ +syntax region muttrcSimplePatString contained keepend start=+'+ end=+'+ skip=+\\'+ +syntax region muttrcSimplePatString contained keepend start=+[^ "']+ skip=+\\ + end=+\s+re=e-1 +syntax region muttrcSimplePatRXContainer contained keepend start=+"+ end=+"+ skip=+\\"+ contains=muttrcRXString +syntax region muttrcSimplePatRXContainer contained keepend start=+'+ end=+'+ skip=+\\'+ contains=muttrcRXString +syntax region muttrcSimplePatRXContainer contained keepend start=+[^ "']+ skip=+\\ + end=+\s+re=e-1 contains=muttrcRXString +syntax match muttrcSimplePatMetas contained /[(|)]/ + +syntax match muttrcOptSimplePat contained skipwhite /[~=%!(^].*/ contains=muttrcSimplePat,muttrcSimplePatMetas +syntax match muttrcOptSimplePat contained skipwhite /[^~=%!(^].*/ contains=muttrcRXString +syntax region muttrcOptPattern contained matchgroup=Type keepend start=+"+ skip=+\\"+ end=+"+ contains=muttrcOptSimplePat,muttrcUnHighlightSpace nextgroup=muttrcString,muttrcStringNL +syntax region muttrcOptPattern contained matchgroup=Type keepend skipwhite start=+'+ skip=+\\'+ end=+'+ contains=muttrcOptSimplePat,muttrcUnHighlightSpace nextgroup=muttrcString,muttrcStringNL +syntax region muttrcOptPattern contained keepend skipwhite start=+[~](+ end=+)+ skip=+\\)+ contains=muttrcSimplePat nextgroup=muttrcString,muttrcStringNL +syntax match muttrcOptPattern contained skipwhite /[~][A-Za-z]/ contains=muttrcSimplePat nextgroup=muttrcString,muttrcStringNL +syntax match muttrcOptPattern contained skipwhite /[.]/ nextgroup=muttrcString,muttrcStringNL +" Keep muttrcPattern and muttrcOptPattern synchronized +syntax region muttrcPattern contained matchgroup=Type keepend skipwhite start=+"+ skip=+\\"+ end=+"+ contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas +syntax region muttrcPattern contained matchgroup=Type keepend skipwhite start=+'+ skip=+\\'+ end=+'+ contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas +syntax region muttrcPattern contained keepend skipwhite start=+[~](+ end=+)+ skip=+\\)+ contains=muttrcSimplePat +syntax match muttrcPattern contained skipwhite /[~][A-Za-z]/ contains=muttrcSimplePat +syntax match muttrcPattern contained skipwhite /[.]/ +syntax region muttrcPatternInner contained keepend start=+"[~=%!(^]+ms=s+1 skip=+\\"+ end=+"+me=e-1 contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas +syntax region muttrcPatternInner contained keepend start=+'[~=%!(^]+ms=s+1 skip=+\\'+ end=+'+me=e-1 contains=muttrcSimplePat,muttrcUnHighlightSpace,muttrcSimplePatMetas + +" Colour definitions takes object, foreground and background arguments (regexps excluded). +syntax match muttrcColorMatchCount contained "[0-9]\+" +syntax match muttrcColorMatchCountNL contained skipwhite skipnl "\s*\\$" nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL +syntax region muttrcColorRXPat contained start=+\s*'+ skip=+\\'+ end=+'\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL +syntax region muttrcColorRXPat contained start=+\s*"+ skip=+\\"+ end=+"\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL +syntax keyword muttrcColor contained black blue cyan default green magenta red white yellow +syntax keyword muttrcColor contained brightblack brightblue brightcyan brightdefault brightgreen brightmagenta brightred brightwhite brightyellow +syntax match muttrcColor contained "\<\%(bright\)\=color\d\{1,3}\>" +" Now for the structure of the color line +syntax match muttrcColorRXNL contained skipnl "\s*\\$" nextgroup=muttrcColorRXPat,muttrcColorRXNL +syntax match muttrcColorBG contained /\s*[$]\?\w\+/ contains=muttrcColor,muttrcVariable,muttrcUnHighlightSpace nextgroup=muttrcColorRXPat,muttrcColorRXNL +syntax match muttrcColorBGNL contained skipnl "\s*\\$" nextgroup=muttrcColorBG,muttrcColorBGNL +syntax match muttrcColorFG contained /\s*[$]\?\w\+/ contains=muttrcColor,muttrcVariable,muttrcUnHighlightSpace nextgroup=muttrcColorBG,muttrcColorBGNL +syntax match muttrcColorFGNL contained skipnl "\s*\\$" nextgroup=muttrcColorFG,muttrcColorFGNL +syntax match muttrcColorContext contained /\s*[$]\?\w\+/ contains=muttrcColorField,muttrcVariable,muttrcUnHighlightSpace,muttrcColorCompose nextgroup=muttrcColorFG,muttrcColorFGNL +syntax match muttrcColorNL contained skipnl "\s*\\$" nextgroup=muttrcColorContext,muttrcColorNL,muttrcColorCompose +syntax match muttrcColorKeyword contained /^\s*color\s\+/ nextgroup=muttrcColorContext,muttrcColorNL,muttrcColorCompose +" And now color's brother: +syntax region muttrcUnColorPatterns contained skipwhite start=+\s*'+ end=+'+ skip=+\\'+ contains=muttrcPattern nextgroup=muttrcUnColorPatterns,muttrcUnColorPatNL +syntax region muttrcUnColorPatterns contained skipwhite start=+\s*"+ end=+"+ skip=+\\"+ contains=muttrcPattern nextgroup=muttrcUnColorPatterns,muttrcUnColorPatNL +syntax match muttrcUnColorPatterns contained skipwhite /\s*[^'"\s]\S\*/ contains=muttrcPattern nextgroup=muttrcUnColorPatterns,muttrcUnColorPatNL +syntax match muttrcUnColorPatNL contained skipwhite skipnl /\s*\\$/ nextgroup=muttrcUnColorPatterns,muttrcUnColorPatNL +syntax match muttrcUnColorAll contained skipwhite /[*]/ +syntax match muttrcUnColorAPNL contained skipwhite skipnl /\s*\\$/ nextgroup=muttrcUnColorPatterns,muttrcUnColorAll,muttrcUnColorAPNL +syntax match muttrcUnColorIndex contained skipwhite /\s*index\s\+/ nextgroup=muttrcUnColorPatterns,muttrcUnColorAll,muttrcUnColorAPNL +syntax match muttrcUnColorIndexNL contained skipwhite skipnl /\s*\\$/ nextgroup=muttrcUnColorIndex,muttrcUnColorIndexNL +syntax match muttrcUnColorKeyword contained skipwhite /^\s*uncolor\s\+/ nextgroup=muttrcUnColorIndex,muttrcUnColorIndexNL +syntax region muttrcUnColorLine keepend start=+^\s*uncolor\s+ skip=+\\$+ end=+$+ contains=muttrcUnColorKeyword,muttrcComment,muttrcUnHighlightSpace + +syntax keyword muttrcMonoAttrib contained bold none normal reverse standout underline +syntax keyword muttrcMono contained mono skipwhite nextgroup=muttrcColorField,muttrcColorCompose +syntax match muttrcMonoLine "^\s*mono\s\+\S\+" skipwhite nextgroup=muttrcMonoAttrib contains=muttrcMono + +" CHECKED 2018-04-18 +" List of fields in Fields in color.c +syntax keyword muttrcColorField skipwhite contained + \ attachment attach_headers body bold error hdrdefault header index + \ index_author index_collapsed index_date index_flags index_label + \ index_number index_size index_subject index_tag index_tags indicator + \ markers message normal progress prompt quoted search sidebar_divider + \ sidebar_flagged sidebar_highlight sidebar_indicator sidebar_new + \ sidebar_ordinary sidebar_spoolfile signature status tilde tree underline + \ nextgroup=muttrcColor +syntax match muttrcColorField contained "\<quoted\d\=\>" + +syntax match muttrcColorCompose skipwhite contained /\s*compose\s*/ nextgroup=muttrcColorComposeField + +" CHECKED 2018-04-18 +" List of fields in ComposeFields in color.c +syntax keyword muttrcColorComposeField skipwhite contained + \ header security_both security_encrypt security_none security_sign + \ nextgroup=muttrcColorFG,muttrcColorFGNL +syntax region muttrcColorLine keepend start=/^\s*color\s\+/ skip=+\\$+ end=+$+ contains=muttrcColorKeyword,muttrcComment,muttrcUnHighlightSpace + + +function! s:boolQuadGen(type, vars, deprecated) + let l:novars = copy(a:vars) + call map(l:novars, '"no" . v:val') + let l:invvars = copy(a:vars) + call map(l:invvars, '"inv" . v:val') + + let l:orig_type = copy(a:type) + if a:deprecated + let l:type = 'Deprecated' . a:type + else + let l:type = a:type + endif + + exec 'syntax keyword muttrcVar' . l:type . ' skipwhite contained ' . join(a:vars) . ' nextgroup=muttrcSet' . l:orig_type . 'Assignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr' + exec 'syntax keyword muttrcVar' . l:type . ' skipwhite contained ' . join(l:novars) . ' nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr' + exec 'syntax keyword muttrcVar' . l:type . ' skipwhite contained ' . join(l:invvars) . ' nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr' +endfunction + +" CHECKED 2018-04-18 +" List of DT_BOOL in MuttVars in init.h +call s:boolQuadGen('Bool', [ + \ 'allow_8bit', 'allow_ansi', 'arrow_cursor', 'ascii_chars', 'askbcc', + \ 'askcc', 'ask_follow_up', 'ask_x_comment_to', 'attach_split', 'autoedit', + \ 'auto_tag', 'beep', 'beep_new', 'bounce_delivered', 'braille_friendly', + \ 'change_folder_next', 'check_mbox_size', 'check_new', 'collapse_all', + \ 'collapse_flagged', 'collapse_unread', 'confirmappend', 'confirmcreate', + \ 'crypt_autoencrypt', 'crypt_autopgp', 'crypt_autosign', 'crypt_autosmime', + \ 'crypt_confirmhook', 'crypt_opportunistic_encrypt', 'crypt_replyencrypt', + \ 'crypt_replysign', 'crypt_replysignencrypted', 'crypt_timestamp', + \ 'crypt_use_gpgme', 'crypt_use_pka', 'delete_untag', 'digest_collapse', + \ 'duplicate_threads', 'edit_headers', 'encode_from', 'fast_reply', + \ 'fcc_clear', 'flag_safe', 'followup_to', 'force_name', 'forward_decode', + \ 'forward_decrypt', 'forward_quote', 'forward_references', 'hdrs', + \ 'header', 'header_cache_compress', 'header_color_partial', 'help', + \ 'hidden_host', 'hide_limited', 'hide_missing', 'hide_thread_subject', + \ 'hide_top_limited', 'hide_top_missing', 'history_remove_dups', + \ 'honor_disposition', 'idn_decode', 'idn_encode', 'ignore_list_reply_to', + \ 'imap_check_subscribed', 'imap_idle', 'imap_list_subscribed', + \ 'imap_passive', 'imap_peek', 'imap_servernoise', 'implicit_autoview', + \ 'include_onlyfirst', 'keep_flagged', 'mailcap_sanitize', + \ 'maildir_check_cur', 'maildir_header_cache_verify', 'maildir_trash', + \ 'mail_check_recent', 'mail_check_stats', 'markers', 'mark_old', + \ 'menu_move_off', 'menu_scroll', 'message_cache_clean', 'meta_key', + \ 'metoo', 'mh_purge', 'mime_forward_decode', 'mime_subject', + \ 'mime_type_query_first', 'narrow_tree', 'nm_record', 'nntp_listgroup', + \ 'nntp_load_description', 'pager_stop', 'pgp_autoinline', + \ 'pgp_auto_decode', 'pgp_check_exit', 'pgp_ignore_subkeys', 'pgp_long_ids', + \ 'pgp_replyinline', 'pgp_retainable_sigs', 'pgp_self_encrypt', + \ 'pgp_show_unusable', 'pgp_strict_enc', 'pgp_use_gpg_agent', 'pipe_decode', + \ 'pipe_split', 'pop_auth_try_all', 'pop_last', 'postpone_encrypt', + \ 'print_decode', 'print_split', 'prompt_after', 'read_only', + \ 'reflow_space_quotes', 'reflow_text', 'reply_self', 'reply_with_xorig', + \ 'resolve', 'resume_draft_files', 'resume_edited_draft_files', + \ 'reverse_alias', 'reverse_name', 'reverse_realname', 'rfc2047_parameters', + \ 'save_address', 'save_empty', 'save_name', 'save_unsubscribed', 'score', + \ 'show_new_news', 'show_only_unread', 'sidebar_folder_indent', + \ 'sidebar_new_mail_only', 'sidebar_next_new_wrap', 'sidebar_on_right', + \ 'sidebar_short_path', 'sidebar_visible', 'sig_dashes', 'sig_on_top', + \ 'smart_wrap', 'smime_ask_cert_label', 'smime_decrypt_use_default_key', + \ 'smime_is_default', 'smime_self_encrypt', 'sort_re', 'ssl_force_tls', + \ 'ssl_usesystemcerts', 'ssl_use_sslv2', 'ssl_use_sslv3', 'ssl_use_tlsv1', + \ 'ssl_use_tlsv1_1', 'ssl_use_tlsv1_2', 'ssl_verify_dates', + \ 'ssl_verify_host', 'ssl_verify_partial_chains', 'status_on_top', + \ 'strict_threads', 'suspend', 'text_flowed', 'thorough_search', + \ 'thread_received', 'tilde', 'ts_enabled', 'uncollapse_jump', + \ 'uncollapse_new', 'user_agent', 'use_8bitmime', 'use_domain', + \ 'use_envelope_from', 'use_from', 'use_ipv6', 'virtual_spoolfile', + \ 'wait_key', 'weed', 'wrap_search', 'write_bcc', 'x_comment_to' + \ ], 0) + +" CHECKED 2018-04-18 +" Deprecated Bools +" List of DT_SYNONYM synonyms of Bools in MuttVars in init.h +call s:boolQuadGen('Bool', [ + \ 'edit_hdrs', 'envelope_from', 'forw_decode', 'forw_decrypt', + \ 'forw_quote', 'ignore_linear_white_space', 'pgp_autoencrypt', + \ 'pgp_autosign', 'pgp_auto_traditional', 'pgp_create_traditional', + \ 'pgp_replyencrypt', 'pgp_replysign', 'pgp_replysignencrypted', + \ 'xterm_set_titles' + \ ], 1) + +" CHECKED 2018-04-18 +" List of DT_QUAD in MuttVars in init.h +call s:boolQuadGen('Quad', [ + \ 'abort_noattach', 'abort_nosubject', 'abort_unmodified', 'bounce', + \ 'catchup_newsgroup', 'copy', 'crypt_verify_sig', 'delete', 'fcc_attach', + \ 'followup_to_poster', 'forward_edit', 'honor_followup_to', 'include', + \ 'mime_forward', 'mime_forward_rest', 'move', 'pgp_mime_auto', + \ 'pop_delete', 'pop_reconnect', 'postpone', 'post_moderated', 'print', + \ 'quit', 'recall', 'reply_to', 'ssl_starttls' + \ ], 0) + +" CHECKED 2018-04-18 +" Deprecated Quads +" List of DT_SYNONYM synonyms of Quads in MuttVars in init.h +call s:boolQuadGen('Quad', [ + \ 'mime_fwd', 'pgp_encrypt_self', 'pgp_verify_sig', 'smime_encrypt_self' + \ ], 1) + +" CHECKED 2018-04-18 +" List of DT_NUMBER in MuttVars in init.h +syntax keyword muttrcVarNum skipwhite contained + \ connect_timeout debug_level history imap_keepalive imap_pipeline_depth + \ imap_poll_timeout mail_check mail_check_stats_interval menu_context + \ net_inc nm_db_limit nm_open_timeout nm_query_window_current_position + \ nm_query_window_duration nntp_context nntp_poll pager_context + \ pager_index_lines pgp_timeout pop_checkinterval read_inc reflow_wrap + \ save_history score_threshold_delete score_threshold_flag + \ score_threshold_read search_context sendmail_wait sidebar_component_depth + \ sidebar_width skip_quoted_offset sleep_time smime_timeout + \ ssl_min_dh_prime_bits timeout time_inc wrap wrap_headers write_inc + \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax keyword muttrcVarDeprecatedNum contained skipwhite + \ wrapmargin + \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of DT_STRING in MuttVars in init.h +" Special cases first, and all the rest at the end +" Formats themselves must be updated in their respective groups +" See s:escapesConditionals +syntax match muttrcVarStr contained skipwhite 'my_[a-zA-Z0-9_]\+' nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax keyword muttrcVarStr contained skipwhite alias_format nextgroup=muttrcVarEqualsAliasFmt +syntax keyword muttrcVarStr contained skipwhite attach_format nextgroup=muttrcVarEqualsAttachFmt +syntax keyword muttrcVarStr contained skipwhite compose_format nextgroup=muttrcVarEqualsComposeFmt +syntax keyword muttrcVarStr contained skipwhite folder_format vfolder_format nextgroup=muttrcVarEqualsFolderFmt +syntax keyword muttrcVarStr contained skipwhite attribution index_format message_format pager_format nextgroup=muttrcVarEqualsIdxFmt +" Deprecated format +syntax keyword muttrcVarDeprecatedStr contained skipwhite hdr_format msg_format nextgroup=muttrcVarEqualsIdxFmt +syntax keyword muttrcVarStr contained skipwhite mix_entry_format nextgroup=muttrcVarEqualsMixFmt +syntax keyword muttrcVarStr contained skipwhite + \ pgp_clearsign_command pgp_decode_command pgp_decrypt_command + \ pgp_encrypt_only_command pgp_encrypt_sign_command pgp_export_command + \ pgp_import_command pgp_list_pubring_command pgp_list_secring_command + \ pgp_sign_command pgp_verify_command pgp_verify_key_command + \ nextgroup=muttrcVarEqualsPGPCmdFmt +syntax keyword muttrcVarStr contained skipwhite pgp_entry_format nextgroup=muttrcVarEqualsPGPFmt +syntax keyword muttrcVarStr contained skipwhite pgp_getkeys_command nextgroup=muttrcVarEqualsPGPGetKeysFmt +syntax keyword muttrcVarStr contained skipwhite query_format nextgroup=muttrcVarEqualsQueryFmt +syntax keyword muttrcVarStr contained skipwhite + \ smime_decrypt_command smime_encrypt_command smime_get_cert_command + \ smime_get_cert_email_command smime_get_signer_cert_command + \ smime_import_cert_command smime_pk7out_command smime_sign_command + \ smime_verify_command smime_verify_opaque_command + \ nextgroup=muttrcVarEqualsSmimeFmt +syntax keyword muttrcVarStr contained skipwhite ts_icon_format ts_status_format status_format nextgroup=muttrcVarEqualsStatusFmt +" Deprecated format +syntax keyword muttrcVarDeprecatedStr contained skipwhite xterm_icon xterm_title nextgroup=muttrcVarEqualsStatusFmt +syntax keyword muttrcVarStr contained skipwhite date_format nextgroup=muttrcVarEqualsStrftimeFmt +syntax keyword muttrcVarStr contained skipwhite group_index_format nextgroup=muttrcVarEqualsGrpIdxFmt +syntax keyword muttrcVarStr contained skipwhite sidebar_format nextgroup=muttrcVarEqualsSdbFmt +syntax keyword muttrcVarStr contained skipwhite + \ assumed_charset attach_charset attach_sep attribution_locale charset + \ config_charset content_type default_hook dsn_notify dsn_return + \ empty_subject escape forward_attribution_intro forward_attribution_trailer + \ forward_format header_cache_pagesize hidden_tags hostname + \ imap_authenticators imap_delim_chars imap_headers imap_login imap_pass + \ imap_user indent_string mailcap_path mark_macro_prefix mh_seq_flagged + \ mh_seq_replied mh_seq_unseen mime_type_query_command newsgroups_charset + \ news_server nm_default_uri nm_exclude_tags nm_query_type + \ nm_query_window_current_search nm_query_window_timebase nm_record_tags + \ nm_unread_tag nntp_authenticators nntp_pass nntp_user pgp_default_key + \ pgp_sign_as pipe_sep pop_authenticators pop_host pop_pass pop_user + \ postpone_encrypt_as post_indent_string preconnect realname send_charset + \ show_multipart_alternative sidebar_delim_chars sidebar_divider_char + \ sidebar_indent_string simple_search smime_default_key smime_encrypt_with + \ smime_sign_as smime_sign_digest_alg smtp_authenticators smtp_pass smtp_url + \ spam_separator ssl_ciphers tunnel + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" Deprecated strings +syntax keyword muttrcVarDeprecatedStr contained skipwhite + \ forw_format indent_str pgp_self_encrypt_as post_indent_str + \ smime_self_encrypt_as + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of DT_ADDRESS +syntax keyword muttrcVarStr contained skipwhite envelope_from_address from nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of DT_HCACHE +syntax keyword muttrcVarStr contained skipwhite header_cache_backend nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of DT_MAGIC +syntax keyword muttrcVarStr contained skipwhite mbox_type nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of DT_MBTABLE +syntax keyword muttrcVarStr contained skipwhite flag_chars from_chars status_chars to_chars nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of DT_PATH +syntax keyword muttrcVarStr contained skipwhite + \ alias_file certificate_file debug_file display_filter editor entropy_file + \ folder header_cache history_file inews ispell mbox message_cachedir mixmaster + \ new_mail_command news_cache_dir newsrc pager postponed print_command + \ query_command record sendmail shell signature smime_ca_location + \ smime_certificates smime_keys spoolfile ssl_ca_certificates_file + \ ssl_client_cert tmpdir trash visual + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of DT_REGEX +syntax keyword muttrcVarStr contained skipwhite + \ abort_noattach_regex gecos_mask mask pgp_decryption_okay pgp_good_sign + \ quote_regex reply_regex smileys + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of deprecated DT_PATH +syntax keyword muttrcVarDeprecatedStr contained skipwhite print_cmd nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of deprecated DT_REGEX +syntax keyword muttrcVarDeprecatedStr contained skipwhite abort_noattach_regexp attach_keyword quote_regexp reply_regexp nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of DT_SORT +syntax keyword muttrcVarStr contained skipwhite + \ pgp_sort_keys sidebar_sort_method sort sort_alias sort_aux sort_browser + \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 +" List of commands in Commands in init.h +" Remember to remove hooks, they have already been dealt with +syntax keyword muttrcCommand skipwhite charset-hook nextgroup=muttrcRXString +syntax keyword muttrcCommand skipwhite unhook nextgroup=muttrcHooks +syntax keyword muttrcCommand skipwhite spam nextgroup=muttrcSpamPattern +syntax keyword muttrcCommand skipwhite nospam nextgroup=muttrcNoSpamPattern +syntax keyword muttrcCommand skipwhite bind nextgroup=muttrcBindMenuList,muttrcBindMenuListNL +syntax keyword muttrcCommand skipwhite macro nextgroup=muttrcMacroMenuList,muttrcMacroMenuListNL +syntax keyword muttrcCommand skipwhite alias nextgroup=muttrcAliasGroupDef,muttrcAliasKey,muttrcAliasNL +syntax keyword muttrcCommand skipwhite unalias nextgroup=muttrcUnAliasKey,muttrcUnAliasNL +syntax keyword muttrcCommand skipwhite set unset reset toggle nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax keyword muttrcCommand skipwhite exec nextgroup=muttrcFunction +syntax keyword muttrcCommand skipwhite + \ alternative_order attachments auto_view finish hdr_order ifdef ifndef + \ ignore lua lua-source mailboxes mailto_allow mime_lookup my_hdr push score + \ setenv sidebar_whitelist source subjectrx subscribe-to tag-formats + \ tag-transforms unalternative_order unattachments unauto_view uncolor + \ unhdr_order unignore unmailboxes unmailto_allow unmime_lookup unmono + \ unmy_hdr unscore unsetenv unsidebar_whitelist unsubjectrx unsubscribe-from + \ unvirtual-mailboxes virtual-mailboxes + +" CHECKED 2018-04-18 +" List of functions in functions.h +syntax match muttrcFunction contained "\<accept\>" +syntax match muttrcFunction contained "\<append\>" +syntax match muttrcFunction contained "\<attach-file\>" +syntax match muttrcFunction contained "\<attach-key\>" +syntax match muttrcFunction contained "\<attach-message\>" +syntax match muttrcFunction contained "\<attach-news-message\>" +syntax match muttrcFunction contained "\<backspace\>" +syntax match muttrcFunction contained "\<backward-char\>" +syntax match muttrcFunction contained "\<backward-word\>" +syntax match muttrcFunction contained "\<bol\>" +syntax match muttrcFunction contained "\<bottom-page\>" +syntax match muttrcFunction contained "\<bottom\>" +syntax match muttrcFunction contained "\<bounce-message\>" +syntax match muttrcFunction contained "\<break-thread\>" +syntax match muttrcFunction contained "\<buffy-cycle\>" +syntax match muttrcFunction contained "\<buffy-list\>" +syntax match muttrcFunction contained "\<capitalize-word\>" +syntax match muttrcFunction contained "\<catchup\>" +syntax match muttrcFunction contained "\<chain-next\>" +syntax match muttrcFunction contained "\<chain-prev\>" +syntax match muttrcFunction contained "\<change-dir\>" +syntax match muttrcFunction contained "\<change-folder-readonly\>" +syntax match muttrcFunction contained "\<change-folder\>" +syntax match muttrcFunction contained "\<change-newsgroup-readonly\>" +syntax match muttrcFunction contained "\<change-newsgroup\>" +syntax match muttrcFunction contained "\<change-vfolder\>" +syntax match muttrcFunction contained "\<check-new\>" +syntax match muttrcFunction contained "\<check-traditional-pgp\>" +syntax match muttrcFunction contained "\<clear-flag\>" +syntax match muttrcFunction contained "\<collapse-all\>" +syntax match muttrcFunction contained "\<collapse-parts\>" +syntax match muttrcFunction contained "\<collapse-thread\>" +syntax match muttrcFunction contained "\<complete-query\>" +syntax match muttrcFunction contained "\<complete\>" +syntax match muttrcFunction contained "\<compose-to-sender\>" +syntax match muttrcFunction contained "\<copy-file\>" +syntax match muttrcFunction contained "\<copy-message\>" +syntax match muttrcFunction contained "\<create-alias\>" +syntax match muttrcFunction contained "\<create-mailbox\>" +syntax match muttrcFunction contained "\<current-bottom\>" +syntax match muttrcFunction contained "\<current-middle\>" +syntax match muttrcFunction contained "\<current-top\>" +syntax match muttrcFunction contained "\<decode-copy\>" +syntax match muttrcFunction contained "\<decode-save\>" +syntax match muttrcFunction contained "\<decrypt-copy\>" +syntax match muttrcFunction contained "\<decrypt-save\>" +syntax match muttrcFunction contained "\<delete-char\>" +syntax match muttrcFunction contained "\<delete-entry\>" +syntax match muttrcFunction contained "\<delete-mailbox\>" +syntax match muttrcFunction contained "\<delete-message\>" +syntax match muttrcFunction contained "\<delete-pattern\>" +syntax match muttrcFunction contained "\<delete-subthread\>" +syntax match muttrcFunction contained "\<delete-thread\>" +syntax match muttrcFunction contained "\<delete\>" +syntax match muttrcFunction contained "\<detach-file\>" +syntax match muttrcFunction contained "\<display-address\>" +syntax match muttrcFunction contained "\<display-filename\>" +syntax match muttrcFunction contained "\<display-message\>" +syntax match muttrcFunction contained "\<display-toggle-weed\>" +syntax match muttrcFunction contained "\<downcase-word\>" +syntax match muttrcFunction contained "\<edit-bcc\>" +syntax match muttrcFunction contained "\<edit-cc\>" +syntax match muttrcFunction contained "\<edit-description\>" +syntax match muttrcFunction contained "\<edit-encoding\>" +syntax match muttrcFunction contained "\<edit-fcc\>" +syntax match muttrcFunction contained "\<edit-file\>" +syntax match muttrcFunction contained "\<edit-followup-to\>" +syntax match muttrcFunction contained "\<edit-from\>" +syntax match muttrcFunction contained "\<edit-headers\>" +syntax match muttrcFunction contained "\<edit-label\>" +syntax match muttrcFunction contained "\<edit-message\>" +syntax match muttrcFunction contained "\<edit-mime\>" +syntax match muttrcFunction contained "\<edit-newsgroups\>" +syntax match muttrcFunction contained "\<edit-or-view-raw-message\>" +syntax match muttrcFunction contained "\<edit-raw-message\>" +syntax match muttrcFunction contained "\<edit-reply-to\>" +syntax match muttrcFunction contained "\<edit-subject\>" +syntax match muttrcFunction contained "\<edit-to\>" +syntax match muttrcFunction contained "\<edit-type\>" +syntax match muttrcFunction contained "\<edit-x-comment-to\>" +syntax match muttrcFunction contained "\<edit\>" +syntax match muttrcFunction contained "\<end-cond\>" +syntax match muttrcFunction contained "\<enter-command\>" +syntax match muttrcFunction contained "\<enter-mask\>" +syntax match muttrcFunction contained "\<entire-thread\>" +syntax match muttrcFunction contained "\<eol\>" +syntax match muttrcFunction contained "\<exit\>" +syntax match muttrcFunction contained "\<extract-keys\>" +syntax match muttrcFunction contained "\<fetch-mail\>" +syntax match muttrcFunction contained "\<filter-entry\>" +syntax match muttrcFunction contained "\<first-entry\>" +syntax match muttrcFunction contained "\<flag-message\>" +syntax match muttrcFunction contained "\<followup-message\>" +syntax match muttrcFunction contained "\<forget-passphrase\>" +syntax match muttrcFunction contained "\<forward-char\>" +syntax match muttrcFunction contained "\<forward-message\>" +syntax match muttrcFunction contained "\<forward-to-group\>" +syntax match muttrcFunction contained "\<forward-word\>" +syntax match muttrcFunction contained "\<get-attachment\>" +syntax match muttrcFunction contained "\<get-children\>" +syntax match muttrcFunction contained "\<get-message\>" +syntax match muttrcFunction contained "\<get-parent\>" +syntax match muttrcFunction contained "\<goto-folder\>" +syntax match muttrcFunction contained "\<goto-parent\>" +syntax match muttrcFunction contained "\<group-reply\>" +syntax match muttrcFunction contained "\<half-down\>" +syntax match muttrcFunction contained "\<half-up\>" +syntax match muttrcFunction contained "\<help\>" +syntax match muttrcFunction contained "\<history-down\>" +syntax match muttrcFunction contained "\<history-search\>" +syntax match muttrcFunction contained "\<history-up\>" +syntax match muttrcFunction contained "\<imap-fetch-mail\>" +syntax match muttrcFunction contained "\<imap-logout-all\>" +syntax match muttrcFunction contained "\<insert\>" +syntax match muttrcFunction contained "\<ispell\>" +syntax match muttrcFunction contained "\<jump\>" +syntax match muttrcFunction contained "\<kill-eol\>" +syntax match muttrcFunction contained "\<kill-eow\>" +syntax match muttrcFunction contained "\<kill-line\>" +syntax match muttrcFunction contained "\<kill-word\>" +syntax match muttrcFunction contained "\<last-entry\>" +syntax match muttrcFunction contained "\<limit-current-thread\>" +syntax match muttrcFunction contained "\<limit\>" +syntax match muttrcFunction contained "\<link-threads\>" +syntax match muttrcFunction contained "\<list-reply\>" +syntax match muttrcFunction contained "\<mail-key\>" +syntax match muttrcFunction contained "\<mail\>" +syntax match muttrcFunction contained "\<mark-as-new\>" +syntax match muttrcFunction contained "\<mark-message\>" +syntax match muttrcFunction contained "\<middle-page\>" +syntax match muttrcFunction contained "\<mix\>" +syntax match muttrcFunction contained "\<modify-labels-then-hide\>" +syntax match muttrcFunction contained "\<modify-labels\>" +syntax match muttrcFunction contained "\<modify-tags-then-hide\>" +syntax match muttrcFunction contained "\<modify-tags\>" +syntax match muttrcFunction contained "\<new-mime\>" +syntax match muttrcFunction contained "\<next-entry\>" +syntax match muttrcFunction contained "\<next-line\>" +syntax match muttrcFunction contained "\<next-new-then-unread\>" +syntax match muttrcFunction contained "\<next-new\>" +syntax match muttrcFunction contained "\<next-page\>" +syntax match muttrcFunction contained "\<next-subthread\>" +syntax match muttrcFunction contained "\<next-thread\>" +syntax match muttrcFunction contained "\<next-undeleted\>" +syntax match muttrcFunction contained "\<next-unread-mailbox\>" +syntax match muttrcFunction contained "\<next-unread\>" +syntax match muttrcFunction contained "\<noop\>" +syntax match muttrcFunction contained "\<parent-message\>" +syntax match muttrcFunction contained "\<pgp-menu\>" +syntax match muttrcFunction contained "\<pipe-entry\>" +syntax match muttrcFunction contained "\<pipe-message\>" +syntax match muttrcFunction contained "\<post-message\>" +syntax match muttrcFunction contained "\<postpone-message\>" +syntax match muttrcFunction contained "\<previous-entry\>" +syntax match muttrcFunction contained "\<previous-line\>" +syntax match muttrcFunction contained "\<previous-new-then-unread\>" +syntax match muttrcFunction contained "\<previous-new\>" +syntax match muttrcFunction contained "\<previous-page\>" +syntax match muttrcFunction contained "\<previous-subthread\>" +syntax match muttrcFunction contained "\<previous-thread\>" +syntax match muttrcFunction contained "\<previous-undeleted\>" +syntax match muttrcFunction contained "\<previous-unread\>" +syntax match muttrcFunction contained "\<print-entry\>" +syntax match muttrcFunction contained "\<print-message\>" +syntax match muttrcFunction contained "\<purge-message\>" +syntax match muttrcFunction contained "\<purge-thread\>" +syntax match muttrcFunction contained "\<quasi-delete\>" +syntax match muttrcFunction contained "\<query-append\>" +syntax match muttrcFunction contained "\<query\>" +syntax match muttrcFunction contained "\<quit\>" +syntax match muttrcFunction contained "\<quote-char\>" +syntax match muttrcFunction contained "\<read-subthread\>" +syntax match muttrcFunction contained "\<read-thread\>" +syntax match muttrcFunction contained "\<recall-message\>" +syntax match muttrcFunction contained "\<reconstruct-thread\>" +syntax match muttrcFunction contained "\<redraw-screen\>" +syntax match muttrcFunction contained "\<refresh\>" +syntax match muttrcFunction contained "\<reload-active\>" +syntax match muttrcFunction contained "\<rename-attachment\>" +syntax match muttrcFunction contained "\<rename-file\>" +syntax match muttrcFunction contained "\<rename-mailbox\>" +syntax match muttrcFunction contained "\<reply\>" +syntax match muttrcFunction contained "\<resend-message\>" +syntax match muttrcFunction contained "\<root-message\>" +syntax match muttrcFunction contained "\<save-entry\>" +syntax match muttrcFunction contained "\<save-message\>" +syntax match muttrcFunction contained "\<search-next\>" +syntax match muttrcFunction contained "\<search-opposite\>" +syntax match muttrcFunction contained "\<search-reverse\>" +syntax match muttrcFunction contained "\<search-toggle\>" +syntax match muttrcFunction contained "\<search\>" +syntax match muttrcFunction contained "\<select-entry\>" +syntax match muttrcFunction contained "\<select-new\>" +syntax match muttrcFunction contained "\<send-message\>" +syntax match muttrcFunction contained "\<set-flag\>" +syntax match muttrcFunction contained "\<shell-escape\>" +syntax match muttrcFunction contained "\<show-limit\>" +syntax match muttrcFunction contained "\<show-log-messages\>" +syntax match muttrcFunction contained "\<show-version\>" +syntax match muttrcFunction contained "\<sidebar-next-new\>" +syntax match muttrcFunction contained "\<sidebar-next\>" +syntax match muttrcFunction contained "\<sidebar-open\>" +syntax match muttrcFunction contained "\<sidebar-page-down\>" +syntax match muttrcFunction contained "\<sidebar-page-up\>" +syntax match muttrcFunction contained "\<sidebar-prev-new\>" +syntax match muttrcFunction contained "\<sidebar-prev\>" +syntax match muttrcFunction contained "\<sidebar-toggle-virtual\>" +syntax match muttrcFunction contained "\<sidebar-toggle-visible\>" +syntax match muttrcFunction contained "\<skip-quoted\>" +syntax match muttrcFunction contained "\<smime-menu\>" +syntax match muttrcFunction contained "\<sort-mailbox\>" +syntax match muttrcFunction contained "\<sort-reverse\>" +syntax match muttrcFunction contained "\<sort\>" +syntax match muttrcFunction contained "\<subscribe-pattern\>" +syntax match muttrcFunction contained "\<subscribe\>" +syntax match muttrcFunction contained "\<sync-mailbox\>" +syntax match muttrcFunction contained "\<tag-entry\>" +syntax match muttrcFunction contained "\<tag-message\>" +syntax match muttrcFunction contained "\<tag-pattern\>" +syntax match muttrcFunction contained "\<tag-prefix-cond\>" +syntax match muttrcFunction contained "\<tag-prefix\>" +syntax match muttrcFunction contained "\<tag-subthread\>" +syntax match muttrcFunction contained "\<tag-thread\>" +syntax match muttrcFunction contained "\<toggle-disposition\>" +syntax match muttrcFunction contained "\<toggle-mailboxes\>" +syntax match muttrcFunction contained "\<toggle-new\>" +syntax match muttrcFunction contained "\<toggle-quoted\>" +syntax match muttrcFunction contained "\<toggle-read\>" +syntax match muttrcFunction contained "\<toggle-recode\>" +syntax match muttrcFunction contained "\<toggle-subscribed\>" +syntax match muttrcFunction contained "\<toggle-unlink\>" +syntax match muttrcFunction contained "\<toggle-write\>" +syntax match muttrcFunction contained "\<top-page\>" +syntax match muttrcFunction contained "\<top\>" +syntax match muttrcFunction contained "\<transpose-chars\>" +syntax match muttrcFunction contained "\<uncatchup\>" +syntax match muttrcFunction contained "\<undelete-entry\>" +syntax match muttrcFunction contained "\<undelete-message\>" +syntax match muttrcFunction contained "\<undelete-pattern\>" +syntax match muttrcFunction contained "\<undelete-subthread\>" +syntax match muttrcFunction contained "\<undelete-thread\>" +syntax match muttrcFunction contained "\<unsubscribe-pattern\>" +syntax match muttrcFunction contained "\<unsubscribe\>" +syntax match muttrcFunction contained "\<untag-pattern\>" +syntax match muttrcFunction contained "\<upcase-word\>" +syntax match muttrcFunction contained "\<update-encoding\>" +syntax match muttrcFunction contained "\<verify-key\>" +syntax match muttrcFunction contained "\<vfolder-from-query\>" +syntax match muttrcFunction contained "\<vfolder-window-backward\>" +syntax match muttrcFunction contained "\<vfolder-window-forward\>" +syntax match muttrcFunction contained "\<view-attachments\>" +syntax match muttrcFunction contained "\<view-attach\>" +syntax match muttrcFunction contained "\<view-file\>" +syntax match muttrcFunction contained "\<view-mailcap\>" +syntax match muttrcFunction contained "\<view-name\>" +syntax match muttrcFunction contained "\<view-raw-message\>" +syntax match muttrcFunction contained "\<view-text\>" +syntax match muttrcFunction contained "\<what-key\>" +syntax match muttrcFunction contained "\<write-fcc\>" + + + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet + +highlight def link muttrcComment Comment +highlight def link muttrcEscape SpecialChar +highlight def link muttrcRXChars SpecialChar +highlight def link muttrcString String +highlight def link muttrcRXString String +highlight def link muttrcRXString2 String +highlight def link muttrcSpecial Special +highlight def link muttrcHooks Type +highlight def link muttrcGroupFlag Type +highlight def link muttrcGroupDef Macro +highlight def link muttrcAddrDef muttrcGroupFlag +highlight def link muttrcRXDef muttrcGroupFlag +highlight def link muttrcRXPat String +highlight def link muttrcAliasGroupName Macro +highlight def link muttrcAliasKey Identifier +highlight def link muttrcUnAliasKey Identifier +highlight def link muttrcAliasEncEmail Identifier +highlight def link muttrcAliasParens Type +highlight def link muttrcSetNumAssignment Number +highlight def link muttrcSetBoolAssignment Boolean +highlight def link muttrcSetQuadAssignment Boolean +highlight def link muttrcSetStrAssignment String +highlight def link muttrcEmail Special +highlight def link muttrcVariableInner Special +highlight def link muttrcEscapedVariable String +highlight def link muttrcHeader Type +highlight def link muttrcKeySpecial SpecialChar +highlight def link muttrcKey Type +highlight def link muttrcKeyName SpecialChar +highlight def link muttrcVarBool Identifier +highlight def link muttrcVarQuad Identifier +highlight def link muttrcVarNum Identifier +highlight def link muttrcVarStr Identifier +highlight def link muttrcMenu Identifier +highlight def link muttrcCommand Keyword +highlight def link muttrcMacroDescr String +highlight def link muttrcAction Macro +highlight def link muttrcBadAction Error +highlight def link muttrcBindFunction Error +highlight def link muttrcBindMenuList Error +highlight def link muttrcFunction Macro +highlight def link muttrcGroupKeyword muttrcCommand +highlight def link muttrcGroupLine Error +highlight def link muttrcSubscribeKeyword muttrcCommand +highlight def link muttrcSubscribeLine Error +highlight def link muttrcListsKeyword muttrcCommand +highlight def link muttrcListsLine Error +highlight def link muttrcAlternateKeyword muttrcCommand +highlight def link muttrcAlternatesLine Error +highlight def link muttrcAttachmentsLine muttrcCommand +highlight def link muttrcAttachmentsFlag Type +highlight def link muttrcAttachmentsMimeType String +highlight def link muttrcColorLine Error +highlight def link muttrcColorContext Error +highlight def link muttrcColorContextI Identifier +highlight def link muttrcColorContextH Identifier +highlight def link muttrcColorKeyword muttrcCommand +highlight def link muttrcColorField Identifier +highlight def link muttrcColorCompose Identifier +highlight def link muttrcColorComposeField Identifier +highlight def link muttrcColor Type +highlight def link muttrcColorFG Error +highlight def link muttrcColorFGI Error +highlight def link muttrcColorFGH Error +highlight def link muttrcColorBG Error +highlight def link muttrcColorBGI Error +highlight def link muttrcColorBGH Error +highlight def link muttrcMonoAttrib muttrcColor +highlight def link muttrcMono muttrcCommand +highlight def link muttrcSimplePat Identifier +highlight def link muttrcSimplePatString Macro +highlight def link muttrcSimplePatMetas Special +highlight def link muttrcPattern Error +highlight def link muttrcUnColorLine Error +highlight def link muttrcUnColorKeyword muttrcCommand +highlight def link muttrcUnColorIndex Identifier +highlight def link muttrcShellString muttrcEscape +highlight def link muttrcRXHooks muttrcCommand +highlight def link muttrcRXHookNot Type +highlight def link muttrcPatHooks muttrcCommand +highlight def link muttrcPatHookNot Type +highlight def link muttrcFormatConditionals2 Type +highlight def link muttrcIndexFormatStr muttrcString +highlight def link muttrcIndexFormatEscapes muttrcEscape +highlight def link muttrcIndexFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcAliasFormatStr muttrcString +highlight def link muttrcAliasFormatEscapes muttrcEscape +highlight def link muttrcAttachFormatStr muttrcString +highlight def link muttrcAttachFormatEscapes muttrcEscape +highlight def link muttrcAttachFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcComposeFormatStr muttrcString +highlight def link muttrcComposeFormatEscapes muttrcEscape +highlight def link muttrcFolderFormatStr muttrcString +highlight def link muttrcFolderFormatEscapes muttrcEscape +highlight def link muttrcFolderFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcMixFormatStr muttrcString +highlight def link muttrcMixFormatEscapes muttrcEscape +highlight def link muttrcMixFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcPGPFormatStr muttrcString +highlight def link muttrcPGPFormatEscapes muttrcEscape +highlight def link muttrcPGPFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcPGPCmdFormatStr muttrcString +highlight def link muttrcPGPCmdFormatEscapes muttrcEscape +highlight def link muttrcPGPCmdFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcStatusFormatStr muttrcString +highlight def link muttrcStatusFormatEscapes muttrcEscape +highlight def link muttrcStatusFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcPGPGetKeysFormatStr muttrcString +highlight def link muttrcPGPGetKeysFormatEscapes muttrcEscape +highlight def link muttrcSmimeFormatStr muttrcString +highlight def link muttrcSmimeFormatEscapes muttrcEscape +highlight def link muttrcSmimeFormatConditionals muttrcFormatConditionals2 +highlight def link muttrcTimeEscapes muttrcEscape +highlight def link muttrcPGPTimeEscapes muttrcEscape +highlight def link muttrcStrftimeEscapes Type +highlight def link muttrcStrftimeFormatStr muttrcString +highlight def link muttrcFormatErrors Error + +highlight def link muttrcBindFunctionNL SpecialChar +highlight def link muttrcBindKeyNL SpecialChar +highlight def link muttrcBindMenuListNL SpecialChar +highlight def link muttrcMacroDescrNL SpecialChar +highlight def link muttrcMacroBodyNL SpecialChar +highlight def link muttrcMacroKeyNL SpecialChar +highlight def link muttrcMacroMenuListNL SpecialChar +highlight def link muttrcColorMatchCountNL SpecialChar +highlight def link muttrcColorNL SpecialChar +highlight def link muttrcColorRXNL SpecialChar +highlight def link muttrcColorBGNL SpecialChar +highlight def link muttrcColorFGNL SpecialChar +highlight def link muttrcAliasNameNL SpecialChar +highlight def link muttrcAliasENNL SpecialChar +highlight def link muttrcAliasNL SpecialChar +highlight def link muttrcUnAliasNL SpecialChar +highlight def link muttrcAliasGroupDefNL SpecialChar +highlight def link muttrcAliasEncEmailNL SpecialChar +highlight def link muttrcPatternNL SpecialChar +highlight def link muttrcUnColorPatNL SpecialChar +highlight def link muttrcUnColorAPNL SpecialChar +highlight def link muttrcUnColorIndexNL SpecialChar +highlight def link muttrcStringNL SpecialChar + +highlight def link muttrcVarDeprecatedBool Error +highlight def link muttrcVarDeprecatedQuad Error +highlight def link muttrcVarDeprecatedStr Error + + +let b:current_syntax = "neomuttrc" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ts=8 noet tw=100 sw=8 sts=0 ft=vim isk+=- diff --git a/runtime/syntax/netrc.vim b/runtime/syntax/netrc.vim index 9f15d16637..4d068a1b76 100644 --- a/runtime/syntax/netrc.vim +++ b/runtime/syntax/netrc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: netrc(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-03 +" Language: netrc(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-01-03 if exists("b:current_syntax") finish diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index 16e3c90c44..c4d3cf5fda 100644 --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -1,13 +1,9 @@ -" Language : Netrw Remote-Directory Listing Syntax -" Maintainer : Charles E. Campbell, Jr. -" Last change: Mar 07, 2014 -" Version : 18 +" Language : Netrw Listing Syntax +" Maintainer : Charles E. Campbell +" Last change: Oct 31, 2016 +" Version : 20 NOT RELEASED " --------------------------------------------------------------------- - -" Syntax Clearing: {{{1 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -16,15 +12,18 @@ endif syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe -syn match netrwPlain "\(\S\+ \)*\S\+" contains=@NoSpell +syn match netrwPlain "\(\S\+ \)*\S\+" contains=netrwLink,@NoSpell syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell -"syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwExe "\%(\S\+ \)*\S*[^~]\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell +if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4') syn match netrwTreeBar "^\%([-+|│] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup +else +syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup +endif syn match netrwTreeBarSpace " " contained syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained @@ -44,32 +43,39 @@ syn match netrwList ".*$" contained contains=netrwComma,@NoSpell syn match netrwComma "," contained syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd,netrwQHTopic,@NoSpell keepend contained syn match netrwHelpCmd "\S\+\ze:" contained skipwhite contains=@NoSpell nextgroup=netrwCmdSep -syn match netrwQHTopic "-\a\+-" contained skipwhite +syn match netrwQHTopic "([a-zA-Z &]\+)" contained skipwhite syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote syn match netrwCmdNote ".\{-}\ze " contained contains=@NoSpell syn match netrwVersion "(netrw.*)" contained contains=@NoSpell +syn match netrwLink "-->" contained skipwhite " ----------------------------- " Special filetype highlighting {{{1 " ----------------------------- -if exists("g:netrw_special_syntax") && netrw_special_syntax - syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell - syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell +if exists("g:netrw_special_syntax") && g:netrw_special_syntax + if exists("+suffixes") && &suffixes != "" + let suflist= join(split(&suffixes,',')) + let suflist= escape(substitute(suflist," ",'\\|','g'),'.~') + exe "syn match netrwSpecFile '\\(\\S\\+ \\)*\\S*\\(".suflist."\\)\\>' contains=netrwTreeBar,@NoSpell" + endif + syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell + syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell if has("unix") - syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell + syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell endif - syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell - syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell - syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\)" contains=netrwTreeBar,@NoSpell - syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell - syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell - syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell - syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell + syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell + syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell + syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\|docx\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell + syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwPix "\c\(\S\+ \)*\S*\.\%(bmp\|fits\=\|gif\|je\=pg\|pcx\|ppc\|pgm\|png\|ppm\|psd\|rgb\|tif\|xbm\|xcf\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell + syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell + syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell endif " --------------------------------------------------------------------- @@ -95,23 +101,45 @@ if !exists("did_drchip_netrwlist_syntax") hi default link netrwComma netrwComment hi default link netrwHide netrwComment hi default link netrwMarkFile TabLineSel + hi default link netrwLink Special " special syntax highlighting (see :he g:netrw_special_syntax) - hi default link netrwBak NonText - hi default link netrwCompress Folded hi default link netrwCoreDump WarningMsg hi default link netrwData DiffChange hi default link netrwHdr netrwPlain hi default link netrwLex netrwPlain hi default link netrwLib DiffChange hi default link netrwMakefile DiffChange - hi default link netrwObj Folded - hi default link netrwTilde Folded - hi default link netrwTmp Folded - hi default link netrwTags Folded hi default link netrwYacc netrwPlain + hi default link netrwPix Special + + hi default link netrwBak netrwGray + hi default link netrwCompress netrwGray + hi default link netrwSpecFile netrwGray + hi default link netrwObj netrwGray + hi default link netrwTags netrwGray + hi default link netrwTilde netrwGray + hi default link netrwTmp netrwGray endif + " set up netrwGray to be understated (but not Ignore'd or Conceal'd, as those + " can be hard/impossible to read). Users may override this in a colorscheme by + " specifying netrwGray highlighting. + redir => s:netrwgray + sil hi netrwGray + redir END + if s:netrwgray !~ 'guifg' + if has("gui") && has("gui_running") + if &bg == "dark" + exe "hi netrwGray gui=NONE guifg=gray30" + else + exe "hi netrwGray gui=NONE guifg=gray70" + endif + else + hi link netrwGray Folded + endif + endif + " Current Syntax: {{{1 let b:current_syntax = "netrwlist" " --------------------------------------------------------------------- diff --git a/runtime/syntax/ninja.vim b/runtime/syntax/ninja.vim index f34588f60c..a53567e585 100644 --- a/runtime/syntax/ninja.vim +++ b/runtime/syntax/ninja.vim @@ -1,16 +1,16 @@ " ninja build file syntax. " Language: ninja build file as described at -" http://martine.github.com/ninja/manual.html -" Version: 1.4 -" Last Change: 2014/05/13 +" http://ninja-build.org/manual.html +" Version: 1.5 +" Last Change: 2018/04/05 " Maintainer: Nicolas Weber <nicolasweber@gmx.de> -" Version 1.4 of this script is in the upstream vim repository and will be +" Version 1.5 of this script is in the upstream vim repository and will be " included in the next vim release. If you change this, please send your change " upstream. " ninja lexer and parser are at -" https://github.com/martine/ninja/blob/master/src/lexer.in.cc -" https://github.com/martine/ninja/blob/master/src/manifest_parser.cc +" https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc +" https://github.com/ninja-build/ninja/blob/master/src/manifest_parser.cc if exists("b:current_syntax") finish @@ -21,7 +21,10 @@ set cpo&vim syn case match -syn match ninjaComment /#.*/ contains=@Spell +" Comments are only matched when the # is at the beginning of the line (with +" optional whitespace), as long as the prior line didn't end with a $ +" continuation. +syn match ninjaComment /\(\$\n\)\@<!\_^\s*#.*$/ contains=@Spell " Toplevel statements are the ones listed here and " toplevel variable assignments (ident '=' value). @@ -38,12 +41,13 @@ syn match ninjaKeyword "^subninja\>" " limited set of magic variables, 'build' allows general " let assignments. " manifest_parser.cc, ParseRule() -syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent -syn keyword ninjaRuleCommand contained command deps depfile description generator +syn region ninjaRule start="^rule" end="^\ze\S" contains=TOP transparent +syn keyword ninjaRuleCommand contained containedin=ninjaRule command + \ deps depfile description generator \ pool restat rspfile rspfile_content -syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent -syn keyword ninjaPoolCommand contained depth +syn region ninjaPool start="^pool" end="^\ze\S" contains=TOP transparent +syn keyword ninjaPoolCommand contained containedin=ninjaPool depth " Strings are parsed as follows: " lexer.in.cc, ReadEvalString() diff --git a/runtime/syntax/nqc.vim b/runtime/syntax/nqc.vim index 0a3cd6bc73..d09c106f98 100644 --- a/runtime/syntax/nqc.vim +++ b/runtime/syntax/nqc.vim @@ -6,11 +6,8 @@ " URL: http://www.enotes.de/twiki/pub/Home/LegoMindstorms/nqc.vim " Filenames: .nqc -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -326,52 +323,42 @@ endif exec "syn sync ccomment nqcComment minlines=" . nqc_minlines " 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_nqc_syn_inits") - if version < 508 - let did_nqc_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link nqcLabel Label +hi def link nqcConditional Conditional +hi def link nqcRepeat Repeat +hi def link nqcCharacter Character +hi def link nqcNumber Number +hi def link nqcFloat Float +hi def link nqcFunction Function +hi def link nqcParenError nqcError +hi def link nqcErrInParen nqcError +hi def link nqcErrInBracket nqcError +hi def link nqcCommentL nqcComment +hi def link nqcCommentStart nqcComment +hi def link nqcCommentError nqcError +hi def link nqcCommentStartError nqcError +hi def link nqcSpaceError nqcError +hi def link nqcStorageClass StorageClass +hi def link nqcInclude Include +hi def link nqcPreProc PreProc +hi def link nqcDefine Macro +hi def link nqcIncluded String +hi def link nqcError Error +hi def link nqcStatement Statement +hi def link nqcEvents Statement +hi def link nqcPreCondit PreCondit +hi def link nqcType Type +hi def link nqcConstant Constant +hi def link nqcCommentSkip nqcComment +hi def link nqcComment Comment +hi def link nqcTodo Todo +hi def link nqcCppSkip nqcCppOut +hi def link nqcCppOut2 nqcCppOut +hi def link nqcCppOut Comment - " The default methods for highlighting. Can be overridden later - HiLink nqcLabel Label - HiLink nqcConditional Conditional - HiLink nqcRepeat Repeat - HiLink nqcCharacter Character - HiLink nqcNumber Number - HiLink nqcFloat Float - HiLink nqcFunction Function - HiLink nqcParenError nqcError - HiLink nqcErrInParen nqcError - HiLink nqcErrInBracket nqcError - HiLink nqcCommentL nqcComment - HiLink nqcCommentStart nqcComment - HiLink nqcCommentError nqcError - HiLink nqcCommentStartError nqcError - HiLink nqcSpaceError nqcError - HiLink nqcStorageClass StorageClass - HiLink nqcInclude Include - HiLink nqcPreProc PreProc - HiLink nqcDefine Macro - HiLink nqcIncluded String - HiLink nqcError Error - HiLink nqcStatement Statement - HiLink nqcEvents Statement - HiLink nqcPreCondit PreCondit - HiLink nqcType Type - HiLink nqcConstant Constant - HiLink nqcCommentSkip nqcComment - HiLink nqcComment Comment - HiLink nqcTodo Todo - HiLink nqcCppSkip nqcCppOut - HiLink nqcCppOut2 nqcCppOut - HiLink nqcCppOut Comment - - delcommand HiLink -endif let b:current_syntax = "nqc" diff --git a/runtime/syntax/nroff.vim b/runtime/syntax/nroff.vim index 280ba9e7d9..3a8cf95856 100644 --- a/runtime/syntax/nroff.vim +++ b/runtime/syntax/nroff.vim @@ -22,12 +22,9 @@ " " {{{1 Start syntax highlighting. " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded +" quit when a syntax file was already loaded " -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -197,65 +194,53 @@ syn keyword nroffTodo TODO XXX FIXME contained " " 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 +" Only when an item doesn't have highlighting yet " -if version >= 508 || !exists("did_nroff_syn_inits") - - if version < 508 - let did_nroff_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink nroffEscChar nroffSpecialChar - HiLink nroffEscCharAr nroffSpecialChar - HiLink nroffSpecialChar SpecialChar - HiLink nroffSpace Delimiter - - HiLink nroffEscRegArg2 nroffEscRegArg - HiLink nroffEscRegArg nroffIdent - - HiLink nroffEscArg2 nroffEscArg - HiLink nroffEscPar nroffEscape - - HiLink nroffEscRegPar nroffEscape - HiLink nroffEscArg nroffEscape - HiLink nroffSize nroffEscape - HiLink nroffEscape Preproc - - HiLink nroffIgnore Comment - HiLink nroffComment Comment - HiLink nroffTodo Todo - - HiLink nroffReqLeader nroffRequest - HiLink nroffReqName nroffRequest - HiLink nroffRequest Statement - HiLink nroffCond PreCondit - HiLink nroffDefIdent nroffIdent - HiLink nroffIdent Identifier - - HiLink nroffEquation PreProc - HiLink nroffTable PreProc - HiLink nroffPicture PreProc - HiLink nroffRefer PreProc - HiLink nroffGrap PreProc - HiLink nroffGremlin PreProc - - HiLink nroffNumber Number - HiLink nroffBadChar nroffError - HiLink nroffSpaceError nroffError - HiLink nroffError Error - - HiLink nroffPreserve String - HiLink nroffString String - HiLink nroffDefinition String - HiLink nroffDefSpecial Special - - delcommand HiLink -endif +hi def link nroffEscChar nroffSpecialChar +hi def link nroffEscCharAr nroffSpecialChar +hi def link nroffSpecialChar SpecialChar +hi def link nroffSpace Delimiter + +hi def link nroffEscRegArg2 nroffEscRegArg +hi def link nroffEscRegArg nroffIdent + +hi def link nroffEscArg2 nroffEscArg +hi def link nroffEscPar nroffEscape + +hi def link nroffEscRegPar nroffEscape +hi def link nroffEscArg nroffEscape +hi def link nroffSize nroffEscape +hi def link nroffEscape Preproc + +hi def link nroffIgnore Comment +hi def link nroffComment Comment +hi def link nroffTodo Todo + +hi def link nroffReqLeader nroffRequest +hi def link nroffReqName nroffRequest +hi def link nroffRequest Statement +hi def link nroffCond PreCondit +hi def link nroffDefIdent nroffIdent +hi def link nroffIdent Identifier + +hi def link nroffEquation PreProc +hi def link nroffTable PreProc +hi def link nroffPicture PreProc +hi def link nroffRefer PreProc +hi def link nroffGrap PreProc +hi def link nroffGremlin PreProc + +hi def link nroffNumber Number +hi def link nroffBadChar nroffError +hi def link nroffSpaceError nroffError +hi def link nroffError Error + +hi def link nroffPreserve String +hi def link nroffString String +hi def link nroffDefinition String +hi def link nroffDefSpecial Special + let b:current_syntax = "nroff" diff --git a/runtime/syntax/nsis.vim b/runtime/syntax/nsis.vim index d6d803714e..f6d5cab6a8 100644 --- a/runtime/syntax/nsis.vim +++ b/runtime/syntax/nsis.vim @@ -1,55 +1,72 @@ " Vim syntax file -" Language: NSIS script, for version of NSIS 1.91 and later -" Maintainer: Alex Jakushev <Alex.Jakushev@kemek.lt> -" Last Change: 2004 May 12 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Language: NSIS script, for version of NSIS 3.03 and later +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-nsis +" Previous Maintainer: Alex Jakushev <Alex.Jakushev@kemek.lt> +" Last Change: 2018-02-07 + +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif +let s:cpo_save = &cpo +set cpo&vim + syn case ignore -"COMMENTS +"Pseudo definitions +syn match nsisLine nextgroup=@nsisPseudoStatement skipwhite "^" +syn cluster nsisPseudoStatement contains=nsisFirstComment,nsisLocalLabel,nsisGlobalLabel +syn cluster nsisPseudoStatement add=nsisDefine,nsisPreCondit,nsisMacro,nsisInclude,nsisSystem +syn cluster nsisPseudoStatement add=nsisAttribute,nsisCompiler,nsisVersionInfo,nsisInstruction,nsisStatement + +"COMMENTS (4.1) syn keyword nsisTodo todo attention note fixme readme -syn region nsisComment start=";" end="$" contains=nsisTodo -syn region nsisComment start="#" end="$" contains=nsisTodo - -"LABELS -syn match nsisLocalLabel "\a\S\{-}:" -syn match nsisGlobalLabel "\.\S\{-1,}:" - -"PREPROCESSOR -syn match nsisPreprocSubst "${.\{-}}" -syn match nsisDefine "!define\>" -syn match nsisDefine "!undef\>" -syn match nsisPreCondit "!ifdef\>" -syn match nsisPreCondit "!ifndef\>" -syn match nsisPreCondit "!endif\>" -syn match nsisPreCondit "!else\>" -syn match nsisMacro "!macro\>" -syn match nsisMacro "!macroend\>" -syn match nsisMacro "!insertmacro\>" - -"COMPILER UTILITY -syn match nsisInclude "!include\>" -syn match nsisSystem "!cd\>" -syn match nsisSystem "!system\>" -syn match nsisSystem "!packhdr\>" - -"VARIABLES +syn region nsisComment start="[;#]" end="$" contains=nsisTodo,nsisLineContinuation,@Spell oneline +syn region nsisComment start=".\@1<=/\*" end="\*/" contains=nsisTodo,@Spell +syn region nsisFirstComment start="/\*" end="\*/" contained contains=nsisTodo,@Spell skipwhite + \ nextgroup=@nsisPseudoStatement + +syn match nsisLineContinuation "\\$" + +"STRINGS (4.1) +syn region nsisString start=/"/ end=/"/ contains=@nsisStringItems,@Spell +syn region nsisString start=/'/ end=/'/ contains=@nsisStringItems,@Spell +syn region nsisString start=/`/ end=/`/ contains=@nsisStringItems,@Spell + +syn cluster nsisStringItems contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar,nsisUserVar,nsisSysVar,nsisRegistry,nsisLineContinuation + +"NUMBERS (4.1) +syn match nsisNumber "\<[1-9]\d*\>" +syn match nsisNumber "\<0x\x\+\>" +syn match nsisNumber "\<0\o*\>" + +"STRING REPLACEMENT (5.4, 4.9.15.2, 5.3.1) +syn region nsisPreprocSubst start="\${" end="}" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar +syn region nsisPreprocLangStr start="\$(" end=")" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar +syn region nsisPreprocEnvVar start="\$%" end="%" contains=nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar + +"VARIABLES (4.2.2) syn match nsisUserVar "$\d" syn match nsisUserVar "$R\d" syn match nsisSysVar "$INSTDIR" syn match nsisSysVar "$OUTDIR" syn match nsisSysVar "$CMDLINE" +syn match nsisSysVar "$LANGUAGE" +"CONSTANTS (4.2.3) syn match nsisSysVar "$PROGRAMFILES" +syn match nsisSysVar "$PROGRAMFILES32" +syn match nsisSysVar "$PROGRAMFILES64" +syn match nsisSysVar "$COMMONFILES" +syn match nsisSysVar "$COMMONFILES32" +syn match nsisSysVar "$COMMONFILES64" syn match nsisSysVar "$DESKTOP" syn match nsisSysVar "$EXEDIR" +syn match nsisSysVar "$EXEFILE" +syn match nsisSysVar "$EXEPATH" +syn match nsisSysVar "${NSISDIR}" syn match nsisSysVar "$WINDIR" syn match nsisSysVar "$SYSDIR" syn match nsisSysVar "$TEMP" @@ -57,215 +74,609 @@ syn match nsisSysVar "$STARTMENU" syn match nsisSysVar "$SMPROGRAMS" syn match nsisSysVar "$SMSTARTUP" syn match nsisSysVar "$QUICKLAUNCH" +syn match nsisSysVar "$DOCUMENTS" +syn match nsisSysVar "$SENDTO" +syn match nsisSysVar "$RECENT" +syn match nsisSysVar "$FAVORITES" +syn match nsisSysVar "$MUSIC" +syn match nsisSysVar "$PICTURES" +syn match nsisSysVar "$VIDEOS" +syn match nsisSysVar "$NETHOOD" +syn match nsisSysVar "$FONTS" +syn match nsisSysVar "$TEMPLATES" +syn match nsisSysVar "$APPDATA" +syn match nsisSysVar "$LOCALAPPDATA" +syn match nsisSysVar "$PRINTHOOD" +syn match nsisSysVar "$INTERNET_CACHE" +syn match nsisSysVar "$COOKIES" +syn match nsisSysVar "$HISTORY" +syn match nsisSysVar "$PROFILE" +syn match nsisSysVar "$ADMINTOOLS" +syn match nsisSysVar "$RESOURCES" +syn match nsisSysVar "$RESOURCES_LOCALIZED" +syn match nsisSysVar "$CDBURN_AREA" syn match nsisSysVar "$HWNDPARENT" +syn match nsisSysVar "$PLUGINSDIR" syn match nsisSysVar "$\\r" syn match nsisSysVar "$\\n" +syn match nsisSysVar "$\\t" syn match nsisSysVar "$\$" +syn match nsisSysVar "$\\["'`]" -"STRINGS -syn region nsisString start=/"/ skip=/'\|`/ end=/"/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry -syn region nsisString start=/'/ skip=/"\|`/ end=/'/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry -syn region nsisString start=/`/ skip=/"\|'/ end=/`/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry +"LABELS (4.3) +syn match nsisLocalLabel contained "[^-+!$0-9;#. \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)" +syn match nsisGlobalLabel contained "\.[^-+!$0-9;# \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)" "CONSTANTS -syn keyword nsisBoolean true false on off - -syn keyword nsisAttribOptions hide show nevershow auto force try ifnewer normal silent silentlog -syn keyword nsisAttribOptions smooth colored SET CUR END RO none listonly textonly both current all -syn keyword nsisAttribOptions zlib bzip2 lzma - -syn match nsisAttribOptions '\/NOCUSTOM' -syn match nsisAttribOptions '\/CUSTOMSTRING' -syn match nsisAttribOptions '\/COMPONENTSONLYONCUSTOM' -syn match nsisAttribOptions '\/windows' -syn match nsisAttribOptions '\/r' -syn match nsisAttribOptions '\/oname' -syn match nsisAttribOptions '\/REBOOTOK' -syn match nsisAttribOptions '\/SILENT' -syn match nsisAttribOptions '\/FILESONLY' -syn match nsisAttribOptions '\/SHORT' - -syn keyword nsisExecShell SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED - -syn keyword nsisRegistry HKCR HKLM HKCU HKU HKCC HKDD HKPD -syn keyword nsisRegistry HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS -syn keyword nsisRegistry HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA - -syn keyword nsisFileAttrib NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY -syn keyword nsisFileAttrib FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN -syn keyword nsisFileAttrib FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM -syn keyword nsisFileAttrib FILE_ATTRIBUTE_TEMPORARY - -syn keyword nsisMessageBox MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL -syn keyword nsisMessageBox MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP -syn keyword nsisMessageBox MB_TOPMOST MB_SETFOREGROUND MB_RIGHT -syn keyword nsisMessageBox MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4 -syn keyword nsisMessageBox IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES - -syn match nsisNumber "\<[^0]\d*\>" -syn match nsisNumber "\<0x\x\+\>" -syn match nsisNumber "\<0\o*\>" +syn keyword nsisBoolean contained true false +syn keyword nsisOnOff contained on off + +syn keyword nsisRegistry contained HKCR HKLM HKCU HKU HKCC HKDD HKPD SHCTX +syn keyword nsisRegistry contained HKCR32 HKCR64 HKCU32 HKCU64 HKLM32 HKLM64 +syn keyword nsisRegistry contained HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS +syn keyword nsisRegistry contained HKEY_CLASSES_ROOT32 HKEY_CLASSES_ROOT64 +syn keyword nsisRegistry contained HKEY_CURRENT_USER32 HKEY_CURRENT_USER64 +syn keyword nsisRegistry contained HKEY_LOCAL_MACHINE32 HKEY_LOCAL_MACHINE64 +syn keyword nsisRegistry contained HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA +syn keyword nsisRegistry contained SHELL_CONTEXT + + +" common options +syn cluster nsisAnyOpt contains=nsisComment,nsisLineContinuation,nsisPreprocSubst,nsisPreprocLangStr,nsisPreprocEnvVar,nsisUserVar,nsisSysVar,nsisString,nsisNumber +syn region nsisBooleanOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBoolean +syn region nsisOnOffOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisOnOff +syn region nsisLangOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLangKwd +syn match nsisLangKwd contained "/LANG\>" +syn region nsisFontOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFontKwd +syn match nsisFontKwd contained "/\%(ITALIC\|UNDERLINE\|STRIKE\)\>" + +"STATEMENTS - pages (4.5) +syn keyword nsisStatement contained Page UninstPage nextgroup=nsisPageOpt skipwhite +syn region nsisPageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPageKwd +syn keyword nsisPageKwd contained custom license components directory instfiles uninstConfirm +syn match nsisPageKwd contained "/ENABLECANCEL\>" + +syn keyword nsisStatement contained PageEx nextgroup=nsisPageExOpt skipwhite +syn region nsisPageExOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPageExKwd +syn match nsisPageExKwd contained "\<\%(un\.\)\?\%(custom\|license\|components\|directory\|instfiles\|uninstConfirm\)\>" + +syn keyword nsisStatement contained PageExEnd PageCallbacks + +"STATEMENTS - sections (4.6.1) +syn keyword nsisStatement contained AddSize SectionEnd SectionGroupEnd + +syn keyword nsisStatement contained Section nextgroup=nsisSectionOpt skipwhite +syn region nsisSectionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionKwd +syn match nsisSectionKwd contained "/o\>" + +syn keyword nsisStatement contained SectionIn nextgroup=nsisSectionInOpt skipwhite +syn region nsisSectionInOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionInKwd +syn keyword nsisSectionInKwd contained RO + +syn keyword nsisStatement contained SectionGroup nextgroup=nsisSectionGroupOpt skipwhite +syn region nsisSectionGroupOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionGroupKwd +syn match nsisSectionGroupKwd contained "/e\>" + +"STATEMENTS - functions (4.7.1) +syn keyword nsisStatement contained Function FunctionEnd + + +"STATEMENTS - LogicLib.nsh +syn match nsisStatement "${If}" +syn match nsisStatement "${IfNot}" +syn match nsisStatement "${Unless}" +syn match nsisStatement "${ElseIf}" +syn match nsisStatement "${ElseIfNot}" +syn match nsisStatement "${ElseUnless}" +syn match nsisStatement "${Else}" +syn match nsisStatement "${EndIf}" +syn match nsisStatement "${EndUnless}" +syn match nsisStatement "${AndIf}" +syn match nsisStatement "${AndIfNot}" +syn match nsisStatement "${AndUnless}" +syn match nsisStatement "${OrIf}" +syn match nsisStatement "${OrIfNot}" +syn match nsisStatement "${OrUnless}" +syn match nsisStatement "${IfThen}" +syn match nsisStatement "${IfNotThen}" +syn match nsisStatement "${||\?}" nextgroup=@nsisPseudoStatement skipwhite +syn match nsisStatement "${IfCmd}" nextgroup=@nsisPseudoStatement skipwhite +syn match nsisStatement "${Select}" +syn match nsisStatement "${Case}" +syn match nsisStatement "${Case[2-5]}" +syn match nsisStatement "${CaseElse}" +syn match nsisStatement "${Default}" +syn match nsisStatement "${EndSelect}" +syn match nsisStatement "${Switch}" +syn match nsisStatement "${EndSwitch}" +syn match nsisStatement "${Break}" +syn match nsisStatement "${Do}" +syn match nsisStatement "${DoWhile}" +syn match nsisStatement "${DoUntil}" +syn match nsisStatement "${ExitDo}" +syn match nsisStatement "${Continue}" +syn match nsisStatement "${Loop}" +syn match nsisStatement "${LoopWhile}" +syn match nsisStatement "${LoopUntil}" +syn match nsisStatement "${For}" +syn match nsisStatement "${ForEach}" +syn match nsisStatement "${ExitFor}" +syn match nsisStatement "${Next}" +"STATEMENTS - Memento.nsh +syn match nsisStatement "${MementoSection}" +syn match nsisStatement "${MementoSectionEnd}" + + +"USER VARIABLES (4.2.1) +syn keyword nsisInstruction contained Var nextgroup=nsisVarOpt skipwhite +syn region nsisVarOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisVarKwd +syn match nsisVarKwd contained "/GLOBAL\>" + +"INSTALLER ATTRIBUTES (4.8.1) +syn keyword nsisAttribute contained Caption ChangeUI CheckBitmap CompletedText ComponentText +syn keyword nsisAttribute contained DetailsButtonText DirText DirVar +syn keyword nsisAttribute contained FileErrorText Icon InstallButtonText +syn keyword nsisAttribute contained InstallDir InstProgressFlags +syn keyword nsisAttribute contained LicenseData LicenseText +syn keyword nsisAttribute contained MiscButtonText Name OutFile +syn keyword nsisAttribute contained SpaceTexts SubCaption UninstallButtonText UninstallCaption +syn keyword nsisAttribute contained UninstallIcon UninstallSubCaption UninstallText + +syn keyword nsisAttribute contained AddBrandingImage nextgroup=nsisAddBrandingImageOpt skipwhite +syn region nsisAddBrandingImageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAddBrandingImageKwd +syn keyword nsisAddBrandingImageKwd contained left right top bottom width height + +syn keyword nsisAttribute contained nextgroup=nsisBooleanOpt skipwhite + \ AllowRootDirInstall AutoCloseWindow + +syn keyword nsisAttribute contained BGFont nextgroup=nsisFontOpt skipwhite + +syn keyword nsisAttribute contained BGGradient nextgroup=nsisBGGradientOpt skipwhite +syn region nsisBGGradientOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBGGradientKwd +syn keyword nsisBGGradientKwd contained off + +syn keyword nsisAttribute contained BrandingText nextgroup=nsisBrandingTextOpt skipwhite +syn region nsisBrandingTextOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisBrandingTextKwd +syn match nsisBrandingTextKwd contained "/TRIM\%(LEFT\|RIGHT\|CENTER\)\>" + +syn keyword nsisAttribute contained CRCCheck nextgroup=nsisCRCCheckOpt skipwhite +syn region nsisCRCCheckOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCRCCheckKwd +syn keyword nsisCRCCheckKwd contained on off force + +syn keyword nsisAttribute contained DirVerify nextgroup=nsisDirVerifyOpt skipwhite +syn region nsisDirVerifyOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDirVerifyKwd +syn keyword nsisDirVerifyKwd contained auto leave + +syn keyword nsisAttribute contained InstallColors nextgroup=nsisInstallColorsOpt skipwhite +syn region nsisInstallColorsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisInstallColorsKwd +syn match nsisInstallColorsKwd contained "/windows\>" + +syn keyword nsisAttribute contained InstallDirRegKey nextgroup=nsisRegistryOpt skipwhite + +syn keyword nsisAttribute contained InstType nextgroup=nsisInstTypeOpt skipwhite +syn region nsisInstTypeOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisInstTypeKwd +syn match nsisInstTypeKwd contained "/\%(NOCUSTOM\|CUSTOMSTRING\|COMPONENTSONLYONCUSTOM\)\>" + +syn keyword nsisAttribute contained LicenseBkColor nextgroup=nsisLicenseBkColorOpt skipwhite +syn region nsisLicenseBkColorOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLicenseBkColorKwd +syn match nsisLicenseBkColorKwd contained "/\%(gray\|windows\)\>" + +syn keyword nsisAttribute contained LicenseForceSelection nextgroup=nsisLicenseForceSelectionOpt skipwhite +syn region nsisLicenseForceSelectionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLicenseForceSelectionKwd +syn keyword nsisLicenseForceSelectionKwd contained checkbox radiobuttons off + +syn keyword nsisAttribute contained ManifestDPIAware nextgroup=nsisManifestDPIAwareOpt skipwhite +syn region nsisManifestDPIAwareOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestDPIAwareKwd +syn keyword nsisManifestDPIAwareKwd contained notset true false + +syn keyword nsisAttribute contained ManifestSupportedOS nextgroup=nsisManifestSupportedOSOpt skipwhite +syn region nsisManifestSupportedOSOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestSupportedOSKwd +syn match nsisManifestSupportedOSKwd contained "\<\%(none\|all\|WinVista\|Win7\|Win8\|Win8\.1\|Win10\)\>" + +syn keyword nsisAttribute contained RequestExecutionLevel nextgroup=nsisRequestExecutionLevelOpt skipwhite +syn region nsisRequestExecutionLevelOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRequestExecutionLevelKwd +syn keyword nsisRequestExecutionLevelKwd contained none user highest admin + +syn keyword nsisAttribute contained SetFont nextgroup=nsisLangOpt skipwhite + +syn keyword nsisAttribute contained nextgroup=nsisShowInstDetailsOpt skipwhite + \ ShowInstDetails ShowUninstDetails +syn region nsisShowInstDetailsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisShowInstDetailsKwd +syn keyword nsisShowInstDetailsKwd contained hide show nevershow + +syn keyword nsisAttribute contained SilentInstall nextgroup=nsisSilentInstallOpt skipwhite +syn region nsisSilentInstallOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSilentInstallKwd +syn keyword nsisSilentInstallKwd contained normal silent silentlog + +syn keyword nsisAttribute contained SilentUnInstall nextgroup=nsisSilentUnInstallOpt skipwhite +syn region nsisSilentUnInstallOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSilentUnInstallKwd +syn keyword nsisSilentUnInstallKwd contained normal silent + +syn keyword nsisAttribute contained nextgroup=nsisOnOffOpt skipwhite + \ WindowIcon XPStyle + +"COMPILER FLAGS (4.8.2) +syn keyword nsisCompiler contained nextgroup=nsisOnOffOpt skipwhite + \ AllowSkipFiles SetDatablockOptimize SetDateSave + +syn keyword nsisCompiler contained FileBufSize SetCompressorDictSize + +syn keyword nsisCompiler contained SetCompress nextgroup=nsisSetCompressOpt skipwhite +syn region nsisSetCompressOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCompressKwd +syn keyword nsisSetCompressKwd contained auto force off + +syn keyword nsisCompiler contained SetCompressor nextgroup=nsisSetCompressorOpt skipwhite +syn region nsisSetCompressorOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCompressorKwd +syn keyword nsisSetCompressorKwd contained zlib bzip2 lzma +syn match nsisSetCompressorKwd contained "/\%(SOLID\|FINAL\)" + +syn keyword nsisCompiler contained SetOverwrite nextgroup=nsisSetOverwriteOpt skipwhite +syn region nsisSetOverwriteOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetOverwriteKwd +syn keyword nsisSetOverwriteKwd contained on off try ifnewer ifdiff lastused + +syn keyword nsisCompiler contained Unicode nextgroup=nsisBooleanOpt skipwhite + +"VERSION INFORMATION (4.8.3) +syn keyword nsisVersionInfo contained VIAddVersionKey nextgroup=nsisLangOpt skipwhite + +syn keyword nsisVersionInfo contained VIProductVersion VIFileVersion + + +"FUNCTIONS - basic (4.9.1) +syn keyword nsisInstruction contained Delete Rename nextgroup=nsisDeleteOpt skipwhite +syn region nsisDeleteOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDeleteKwd +syn match nsisDeleteKwd contained "/REBOOTOK\>" + +syn keyword nsisInstruction contained Exec ExecWait SetOutPath + +syn keyword nsisInstruction contained ExecShell ExecShellWait nextgroup=nsisExecShellOpt skipwhite +syn region nsisExecShellOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisExecShellKwd +syn keyword nsisExecShellKwd contained SW_SHOWDEFAULT SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_HIDE +syn match nsisExecShellKwd contained "/INVOKEIDLIST\>" + +syn keyword nsisInstruction contained File nextgroup=nsisFileOpt skipwhite +syn region nsisFileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileKwd +syn match nsisFileKwd contained "/\%(nonfatal\|[arx]\|oname\)\>" + +syn keyword nsisInstruction contained ReserveFile nextgroup=nsisReserveFileOpt skipwhite +syn region nsisReserveFileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisReserveFileKwd +syn match nsisReserveFileKwd contained "/\%(nonfatal\|[rx]\|plugin\)\>" + +syn keyword nsisInstruction contained RMDir nextgroup=nsisRMDirOpt skipwhite +syn region nsisRMDirOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRMDirKwd +syn match nsisRMDirKwd contained "/\%(REBOOTOK\|r\)\>" -"INSTALLER ATTRIBUTES - General installer configuration -syn keyword nsisAttribute OutFile Name Caption SubCaption BrandingText Icon -syn keyword nsisAttribute WindowIcon BGGradient SilentInstall SilentUnInstall -syn keyword nsisAttribute CRCCheck MiscButtonText InstallButtonText FileErrorText +"FUNCTIONS - registry & ini (4.9.2) +syn keyword nsisInstruction contained DeleteINISec DeleteINIStr FlushINI ReadINIStr WriteINIStr +syn keyword nsisInstruction contained ExpandEnvStrings ReadEnvStr -"INSTALLER ATTRIBUTES - Install directory configuration -syn keyword nsisAttribute InstallDir InstallDirRegKey +syn keyword nsisInstruction contained DeleteRegKey nextgroup=nsisDeleteRegKeyOpt skipwhite +syn region nsisDeleteRegKeyOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDeleteRegKeyKwd,nsisRegistry +syn match nsisDeleteRegKeyKwd contained "/ifempty\>" -"INSTALLER ATTRIBUTES - License page configuration -syn keyword nsisAttribute LicenseText LicenseData +syn keyword nsisInstruction contained nextgroup=nsisRegistryOpt skipwhite + \ DeleteRegValue EnumRegKey EnumRegValue ReadRegDWORD ReadRegStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr +syn region nsisRegistryOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRegistry -"INSTALLER ATTRIBUTES - Component page configuration -syn keyword nsisAttribute ComponentText InstType EnabledBitmap DisabledBitmap SpaceTexts +syn keyword nsisInstruction contained WriteRegMultiStr nextgroup=nsisWriteRegMultiStrOpt skipwhite +syn region nsisWriteRegMultiStrOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRegistry,nsisWriteRegMultiStrKwd +syn match nsisWriteRegMultiStrKwd contained "/REGEDIT5\>" -"INSTALLER ATTRIBUTES - Directory page configuration -syn keyword nsisAttribute DirShow DirText AllowRootDirInstall +syn keyword nsisInstruction contained SetRegView nextgroup=nsisSetRegViewOpt skipwhite +syn region nsisSetRegViewOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetRegViewKwd +syn keyword nsisSetRegViewKwd contained default lastused -"INSTALLER ATTRIBUTES - Install page configuration -syn keyword nsisAttribute InstallColors InstProgressFlags AutoCloseWindow -syn keyword nsisAttribute ShowInstDetails DetailsButtonText CompletedText +"FUNCTIONS - general purpose (4.9.3) +syn keyword nsisInstruction contained CallInstDLL CreateDirectory GetDLLVersion +syn keyword nsisInstruction contained GetDLLVersionLocal GetFileTime GetFileTimeLocal +syn keyword nsisInstruction contained GetTempFileName SearchPath RegDLL UnRegDLL -"INSTALLER ATTRIBUTES - Uninstall configuration -syn keyword nsisAttribute UninstallText UninstallIcon UninstallCaption -syn keyword nsisAttribute UninstallSubCaption ShowUninstDetails UninstallButtonText +syn keyword nsisInstruction contained CopyFiles nextgroup=nsisCopyFilesOpt skipwhite +syn region nsisCopyFilesOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCopyFilesKwd +syn match nsisCopyFilesKwd contained "/\%(SILENT\|FILESONLY\)\>" -"COMPILER ATTRIBUTES -syn keyword nsisCompiler SetOverwrite SetCompress SetCompressor SetDatablockOptimize SetDateSave +syn keyword nsisInstruction contained CreateShortcut nextgroup=nsisCreateShortcutOpt skipwhite +syn region nsisCreateShortcutOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCreateShortcutKwd +syn match nsisCreateShortcutKwd contained "/NoWorkingDir\>" +syn keyword nsisInstruction contained GetFullPathName nextgroup=nsisGetFullPathNameOpt skipwhite +syn region nsisGetFullPathNameOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisGetFullPathNameKwd +syn match nsisGetFullPathNameKwd contained "/SHORT\>" -"FUNCTIONS - general purpose -syn keyword nsisInstruction SetOutPath File Exec ExecWait ExecShell -syn keyword nsisInstruction Rename Delete RMDir +syn keyword nsisInstruction contained SetFileAttributes nextgroup=nsisSetFileAttributesOpt skipwhite +syn region nsisSetFileAttributesOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileAttrib +syn keyword nsisFileAttrib contained NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM +syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_TEMPORARY -"FUNCTIONS - registry & ini -syn keyword nsisInstruction WriteRegStr WriteRegExpandStr WriteRegDWORD WriteRegBin -syn keyword nsisInstruction WriteINIStr ReadRegStr ReadRegDWORD ReadINIStr ReadEnvStr -syn keyword nsisInstruction ExpandEnvStrings DeleteRegValue DeleteRegKey EnumRegKey -syn keyword nsisInstruction EnumRegValue DeleteINISec DeleteINIStr +"FUNCTIONS - Flow Control (4.9.4) +syn keyword nsisInstruction contained Abort Call ClearErrors GetCurrentAddress +syn keyword nsisInstruction contained GetFunctionAddress GetLabelAddress Goto +syn keyword nsisInstruction contained IfAbort IfErrors IfFileExists IfRebootFlag IfSilent +syn keyword nsisInstruction contained IntCmp IntCmpU Int64Cmp Int64CmpU IntPtrCmp IntPtrCmpU +syn keyword nsisInstruction contained Return Quit SetErrors StrCmp StrCmpS -"FUNCTIONS - general purpose, advanced -syn keyword nsisInstruction CreateDirectory CopyFiles SetFileAttributes CreateShortCut -syn keyword nsisInstruction GetFullPathName SearchPath GetTempFileName CallInstDLL -syn keyword nsisInstruction RegDLL UnRegDLL GetDLLVersion GetDLLVersionLocal -syn keyword nsisInstruction GetFileTime GetFileTimeLocal +syn keyword nsisInstruction contained MessageBox nextgroup=nsisMessageBoxOpt skipwhite +syn region nsisMessageBoxOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisMessageBox +syn keyword nsisMessageBox contained MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL +syn keyword nsisMessageBox contained MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP MB_USERICON +syn keyword nsisMessageBox contained MB_TOPMOST MB_SETFOREGROUND MB_RIGHT MB_RTLREADING +syn keyword nsisMessageBox contained MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4 +syn keyword nsisMessageBox contained IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES +syn match nsisMessageBox contained "/SD\>" -"FUNCTIONS - Branching, flow control, error checking, user interaction, etc instructions -syn keyword nsisInstruction Goto Call Return IfErrors ClearErrors SetErrors FindWindow -syn keyword nsisInstruction SendMessage IsWindow IfFileExists MessageBox StrCmp -syn keyword nsisInstruction IntCmp IntCmpU Abort Quit GetFunctionAddress GetLabelAddress -syn keyword nsisInstruction GetCurrentAddress +"FUNCTIONS - File and directory i/o instructions (4.9.5) +syn keyword nsisInstruction contained FileClose FileOpen FileRead FileReadUTF16LE +syn keyword nsisInstruction contained FileReadByte FileReadWord FileSeek FileWrite +syn keyword nsisInstruction contained FileWriteByte FileWriteWord +syn keyword nsisInstruction contained FindClose FindFirst FindNext -"FUNCTIONS - File and directory i/o instructions -syn keyword nsisInstruction FindFirst FindNext FindClose FileOpen FileClose FileRead -syn keyword nsisInstruction FileWrite FileReadByte FileWriteByte FileSeek +syn keyword nsisInstruction contained FileWriteUTF16LE nextgroup=nsisFileWriteUTF16LEOpt skipwhite +syn region nsisFileWriteUTF16LEOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisFileWriteUTF16LEKwd +syn match nsisFileWriteUTF16LEKwd contained "/BOM\>" -"FUNCTIONS - Misc instructions -syn keyword nsisInstruction SetDetailsView SetDetailsPrint SetAutoClose DetailPrint -syn keyword nsisInstruction Sleep BringToFront HideWindow SetShellVarContext +"FUNCTIONS - Uninstaller instructions (4.9.6) +syn keyword nsisInstruction contained WriteUninstaller -"FUNCTIONS - String manipulation support -syn keyword nsisInstruction StrCpy StrLen +"FUNCTIONS - Misc instructions (4.9.7) +syn keyword nsisInstruction contained GetErrorLevel GetInstDirError InitPluginsDir Nop +syn keyword nsisInstruction contained SetErrorLevel Sleep -"FUNCTIONS - Stack support -syn keyword nsisInstruction Push Pop Exch +syn keyword nsisInstruction contained SetShellVarContext nextgroup=nsisSetShellVarContextOpt skipwhite +syn region nsisSetShellVarContextOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetShellVarContextKwd +syn keyword nsisSetShellVarContextKwd contained current all -"FUNCTIONS - Integer manipulation support -syn keyword nsisInstruction IntOp IntFmt +"FUNCTIONS - String manipulation support (4.9.8) +syn keyword nsisInstruction contained StrCpy StrLen -"FUNCTIONS - Rebooting support -syn keyword nsisInstruction Reboot IfRebootFlag SetRebootFlag +"FUNCTIONS - Stack support (4.9.9) +syn keyword nsisInstruction contained Exch Push Pop -"FUNCTIONS - Uninstaller instructions -syn keyword nsisInstruction WriteUninstaller +"FUNCTIONS - Integer manipulation support (4.9.10) +syn keyword nsisInstruction contained IntFmt Int64Fmt IntOp IntPtrOp -"FUNCTIONS - Install logging instructions -syn keyword nsisInstruction LogSet LogText +"FUNCTIONS - Rebooting support (4.9.11) +syn keyword nsisInstruction contained Reboot SetRebootFlag -"FUNCTIONS - Section management instructions -syn keyword nsisInstruction SectionSetFlags SectionGetFlags SectionSetText -syn keyword nsisInstruction SectionGetText +"FUNCTIONS - Install logging instructions (4.9.12) +syn keyword nsisInstruction contained LogSet nextgroup=nsisOnOffOpt skipwhite +syn keyword nsisInstruction contained LogText +"FUNCTIONS - Section management instructions (4.9.13) +syn keyword nsisInstruction contained SectionSetFlags SectionGetFlags SectionSetText +syn keyword nsisInstruction contained SectionGetText SectionSetInstTypes SectionGetInstTypes +syn keyword nsisInstruction contained SectionSetSize SectionGetSize SetCurInstType GetCurInstType +syn keyword nsisInstruction contained InstTypeSetText InstTypeGetText -"SPECIAL FUNCTIONS - install +"FUNCTIONS - User Interface Instructions (4.9.14) +syn keyword nsisInstruction contained BringToFront DetailPrint EnableWindow +syn keyword nsisInstruction contained FindWindow GetDlgItem HideWindow IsWindow +syn keyword nsisInstruction contained ShowWindow + +syn keyword nsisInstruction contained CreateFont nextgroup=nsisFontOpt skipwhite + +syn keyword nsisInstruction contained nextgroup=nsisBooleanOpt skipwhite + \ LockWindow SetAutoClose + +syn keyword nsisInstruction contained SendMessage nextgroup=nsisSendMessageOpt skipwhite +syn region nsisSendMessageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSendMessageKwd +syn match nsisSendMessageKwd contained "/TIMEOUT\>" + +syn keyword nsisInstruction contained SetBrandingImage nextgroup=nsisSetBrandingImageOpt skipwhite +syn region nsisSetBrandingImageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetBrandingImageKwd +syn match nsisSetBrandingImageKwd contained "/\%(IMGID\|RESIZETOFIT\)\>" + +syn keyword nsisInstruction contained SetDetailsView nextgroup=nsisSetDetailsViewOpt skipwhite +syn region nsisSetDetailsViewOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetDetailsViewKwd +syn keyword nsisSetDetailsViewKwd contained show hide + +syn keyword nsisInstruction contained SetDetailsPrint nextgroup=nsisSetDetailsPrintOpt skipwhite +syn region nsisSetDetailsPrintOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetDetailsPrintKwd +syn keyword nsisSetDetailsPrintKwd contained none listonly textonly both lastused + +syn keyword nsisInstruction contained SetCtlColors nextgroup=nsisSetCtlColorsOpt skipwhite +syn region nsisSetCtlColorsOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetCtlColorsKwd +syn match nsisSetCtlColorsKwd contained "/BRANDING\>" + +syn keyword nsisInstruction contained SetSilent nextgroup=nsisSetSilentOpt skipwhite +syn region nsisSetSilentOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSetSilentKwd +syn keyword nsisSetSilentKwd contained silent normal + + +"FUNCTIONS - Multiple Languages Instructions (4.9.15) +syn keyword nsisInstruction contained LoadLanguageFile LangString LicenseLangString + + +"SPECIAL FUNCTIONS - install (4.7.2.1) +syn match nsisCallback "\.onGUIInit" syn match nsisCallback "\.onInit" -syn match nsisCallback "\.onUserAbort" -syn match nsisCallback "\.onInstSuccess" syn match nsisCallback "\.onInstFailed" -syn match nsisCallback "\.onVerifyInstDir" -syn match nsisCallback "\.onNextPage" -syn match nsisCallback "\.onPrevPage" +syn match nsisCallback "\.onInstSuccess" +syn match nsisCallback "\.onGUIEnd" +syn match nsisCallback "\.onMouseOverSection" +syn match nsisCallback "\.onRebootFailed" syn match nsisCallback "\.onSelChange" +syn match nsisCallback "\.onUserAbort" +syn match nsisCallback "\.onVerifyInstDir" -"SPECIAL FUNCTIONS - uninstall +"SPECIAL FUNCTIONS - uninstall (4.7.2.2) +syn match nsisCallback "un\.onGUIInit" syn match nsisCallback "un\.onInit" +syn match nsisCallback "un\.onUninstFailed" +syn match nsisCallback "un\.onUninstSuccess" +syn match nsisCallback "un\.onGUIEnd" +syn match nsisCallback "un\.onRebootFailed" +syn match nsisCallback "un\.onSelChange" syn match nsisCallback "un\.onUserAbort" -syn match nsisCallback "un\.onInstSuccess" -syn match nsisCallback "un\.onInstFailed" -syn match nsisCallback "un\.onVerifyInstDir" -syn match nsisCallback "un\.onNextPage" -"STATEMENTS - sections -syn keyword nsisStatement Section SectionIn SectionEnd SectionDivider -syn keyword nsisStatement AddSize +"COMPILER UTILITY (5.1) +syn match nsisInclude contained "!include\>" nextgroup=nsisIncludeOpt skipwhite +syn region nsisIncludeOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisIncludeKwd +syn match nsisIncludeKwd contained "/\%(NONFATAL\|CHARSET\)\>" + +syn match nsisSystem contained "!addincludedir\>" + +syn match nsisSystem contained "!addplugindir\>" nextgroup=nsisAddplugindirOpt skipwhite +syn region nsisAddplugindirOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAddplugindirKwd +syn match nsisAddplugindirKwd contained "/\%(x86-ansi\|x86-unicode\)\>" + +syn match nsisSystem contained "!appendfile\>" nextgroup=nsisAppendfileOpt skipwhite +syn region nsisAppendfileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisAppendfileKwd +syn match nsisAppendfileKwd contained "/\%(CHARSET\|RawNL\)\>" + +syn match nsisSystem contained "!cd\>" + +syn match nsisSystem contained "!delfile\>" nextgroup=nsisDelfileOpt skipwhite +syn region nsisDelfileOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDelfileKwd +syn match nsisDelfileKwd contained "/nonfatal\>" + +syn match nsisSystem contained "!echo\>" +syn match nsisSystem contained "!error\>" +syn match nsisSystem contained "!execute\>" +syn match nsisSystem contained "!makensis\>" +syn match nsisSystem contained "!packhdr\>" +syn match nsisSystem contained "!finalize\>" +syn match nsisSystem contained "!system\>" +syn match nsisSystem contained "!tempfile\>" +syn match nsisSystem contained "!getdllversion\>" +syn match nsisSystem contained "!gettlbversion\>" +syn match nsisSystem contained "!warning\>" -"STATEMENTS - functions -syn keyword nsisStatement Function FunctionEnd +syn match nsisSystem contained "!pragma\>" nextgroup=nsisPragmaOpt skipwhite +syn region nsisPragmaOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPragmaKwd +syn keyword nsisPragmaKwd contained enable disable default push pop -"STATEMENTS - pages -syn keyword nsisStatement Page UninstPage PageEx PageExEnc PageCallbacks +syn match nsisSystem contained "!verbose\>" nextgroup=nsisVerboseOpt skipwhite +syn region nsisVerboseOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisVerboseKwd +syn keyword nsisVerboseKwd contained push pop +"PREPROCESSOR (5.4) +syn match nsisDefine contained "!define\>" nextgroup=nsisDefineOpt skipwhite +syn region nsisDefineOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDefineKwd +syn match nsisDefineKwd contained "/\%(ifndef\|redef\|date\|utcdate\|math\|file\)\>" + +syn match nsisDefine contained "!undef\>" +syn match nsisPreCondit contained "!ifdef\>" +syn match nsisPreCondit contained "!ifndef\>" + +syn match nsisPreCondit contained "!if\>" nextgroup=nsisIfOpt skipwhite +syn region nsisIfOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisIfKwd +syn match nsisIfKwd contained "/FileExists\>" + +syn match nsisPreCondit contained "!ifmacrodef\>" +syn match nsisPreCondit contained "!ifmacrondef\>" +syn match nsisPreCondit contained "!else\>" +syn match nsisPreCondit contained "!endif\>" +syn match nsisMacro contained "!insertmacro\>" +syn match nsisMacro contained "!macro\>" +syn match nsisMacro contained "!macroend\>" +syn match nsisMacro contained "!macroundef\>" + +syn match nsisMacro contained "!searchparse\>" nextgroup=nsisSearchparseOpt skipwhite +syn region nsisSearchparseOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSearchparseKwd +syn match nsisSearchparseKwd contained "/\%(ignorecase\|noerrors\|file\)\>" + +syn match nsisMacro contained "!searchreplace\>" nextgroup=nsisSearchreplaceOpt skipwhite +syn region nsisSearchreplaceOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSearchreplaceKwd +syn match nsisSearchreplaceKwd contained "/ignorecase\>" -"ERROR -syn keyword nsisError UninstallExeName " 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_nsis_syn_inits") - - if version < 508 - let did_nsys_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - - HiLink nsisInstruction Function - HiLink nsisComment Comment - HiLink nsisLocalLabel Label - HiLink nsisGlobalLabel Label - HiLink nsisStatement Statement - HiLink nsisString String - HiLink nsisBoolean Boolean - HiLink nsisAttribOptions Constant - HiLink nsisExecShell Constant - HiLink nsisFileAttrib Constant - HiLink nsisMessageBox Constant - HiLink nsisRegistry Identifier - HiLink nsisNumber Number - HiLink nsisError Error - HiLink nsisUserVar Identifier - HiLink nsisSysVar Identifier - HiLink nsisAttribute Type - HiLink nsisCompiler Type - HiLink nsisTodo Todo - HiLink nsisCallback Operator - " preprocessor commands - HiLink nsisPreprocSubst PreProc - HiLink nsisDefine Define - HiLink nsisMacro Macro - HiLink nsisPreCondit PreCondit - HiLink nsisInclude Include - HiLink nsisSystem PreProc - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link nsisInstruction Function +hi def link nsisComment Comment +hi def link nsisFirstComment Comment +hi def link nsisLocalLabel Label +hi def link nsisGlobalLabel Label +hi def link nsisStatement Statement +hi def link nsisString String +hi def link nsisBoolean Boolean +hi def link nsisOnOff Boolean +hi def link nsisFontKwd Constant +hi def link nsisLangKwd Constant +hi def link nsisPageKwd Constant +hi def link nsisPageExKwd Constant +hi def link nsisSectionKwd Constant +hi def link nsisSectionInKwd Constant +hi def link nsisSectionGroupKwd Constant +hi def link nsisVarKwd Constant +hi def link nsisAddBrandingImageKwd Constant +hi def link nsisBGGradientKwd Constant +hi def link nsisBrandingTextKwd Constant +hi def link nsisCRCCheckKwd Constant +hi def link nsisDirVerifyKwd Constant +hi def link nsisInstallColorsKwd Constant +hi def link nsisInstTypeKwd Constant +hi def link nsisLicenseBkColorKwd Constant +hi def link nsisLicenseForceSelectionKwd Constant +hi def link nsisManifestDPIAwareKwd Constant +hi def link nsisManifestSupportedOSKwd Constant +hi def link nsisRequestExecutionLevelKwd Constant +hi def link nsisShowInstDetailsKwd Constant +hi def link nsisSilentInstallKwd Constant +hi def link nsisSilentUnInstallKwd Constant +hi def link nsisSetCompressKwd Constant +hi def link nsisSetCompressorKwd Constant +hi def link nsisSetOverwriteKwd Constant +hi def link nsisDeleteKwd Constant +hi def link nsisExecShellKwd Constant +hi def link nsisFileKwd Constant +hi def link nsisReserveFileKwd Constant +hi def link nsisRMDirKwd Constant +hi def link nsisDeleteRegKeyKwd Constant +hi def link nsisWriteRegMultiStrKwd Constant +hi def link nsisSetRegViewKwd Constant +hi def link nsisCopyFilesKwd Constant +hi def link nsisCreateShortcutKwd Constant +hi def link nsisGetFullPathNameKwd Constant +hi def link nsisFileAttrib Constant +hi def link nsisMessageBox Constant +hi def link nsisFileWriteUTF16LEKwd Constant +hi def link nsisSetShellVarContextKwd Constant +hi def link nsisSendMessageKwd Constant +hi def link nsisSetBrandingImageKwd Constant +hi def link nsisSetDetailsViewKwd Constant +hi def link nsisSetDetailsPrintKwd Constant +hi def link nsisSetCtlColorsKwd Constant +hi def link nsisSetSilentKwd Constant +hi def link nsisRegistry Identifier +hi def link nsisNumber Number +hi def link nsisError Error +hi def link nsisUserVar Identifier +hi def link nsisSysVar Identifier +hi def link nsisAttribute Type +hi def link nsisCompiler Type +hi def link nsisVersionInfo Type +hi def link nsisTodo Todo +hi def link nsisCallback Identifier +" preprocessor commands +hi def link nsisPreprocSubst PreProc +hi def link nsisPreprocLangStr PreProc +hi def link nsisPreprocEnvVar PreProc +hi def link nsisDefine Define +hi def link nsisMacro Macro +hi def link nsisPreCondit PreCondit +hi def link nsisInclude Include +hi def link nsisSystem PreProc +hi def link nsisLineContinuation Special +hi def link nsisIncludeKwd Constant +hi def link nsisAddplugindirKwd Constant +hi def link nsisAppendfileKwd Constant +hi def link nsisDelfileKwd Constant +hi def link nsisPragmaKwd Constant +hi def link nsisVerboseKwd Constant +hi def link nsisDefineKwd Constant +hi def link nsisIfKwd Constant +hi def link nsisSearchparseKwd Constant +hi def link nsisSearchreplaceKwd Constant + let b:current_syntax = "nsis" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/obj.vim b/runtime/syntax/obj.vim index 66cd6c2bde..df4dbca5d7 100644 --- a/runtime/syntax/obj.vim +++ b/runtime/syntax/obj.vim @@ -4,11 +4,8 @@ " File Types: .obj (used in 3D) " Last Change: 2010 May 18 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -62,34 +59,24 @@ syn match objInt "\d\+" syn match objIndex "\d\+\/\d*\/\d*" " 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_cabal_syn_inits") - if version < 508 - let did_cabal_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink objError Error - HiLink objComment Comment - HiLink objInclude PreProc - HiLink objFloat Float - HiLink objInt Number - HiLink objGroup Structure - HiLink objIndex Constant - HiLink objMaterial Label +hi def link objError Error +hi def link objComment Comment +hi def link objInclude PreProc +hi def link objFloat Float +hi def link objInt Number +hi def link objGroup Structure +hi def link objIndex Constant +hi def link objMaterial Label - HiLink objVertex Keyword - HiLink objNormale Keyword - HiLink objVertice Keyword - HiLink objFace Keyword - HiLink objKeywords Keyword +hi def link objVertex Keyword +hi def link objNormale Keyword +hi def link objVertice Keyword +hi def link objFace Keyword +hi def link objKeywords Keyword - delcommand HiLink -endif let b:current_syntax = "obj" diff --git a/runtime/syntax/objc.vim b/runtime/syntax/objc.vim index 1f61e50b8d..9d7b20ecd0 100644 --- a/runtime/syntax/objc.vim +++ b/runtime/syntax/objc.vim @@ -1,8 +1,7 @@ " Vim syntax file " Language: Objective-C -" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com> -" Last Change: 2013 Jun 13 -" Remark: Modern Objective-C Edition +" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> +" Last Change: 2015 Dec 14 """ Preparation for loading ObjC stuff if exists("b:current_syntax") @@ -25,14 +24,14 @@ syn keyword objcUsefulTerm nil Nil NO YES " Preprocessor Directives syn region objcImported display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn match objcImported display contained "<[^>]*>" +syn match objcImported display contained "\(<\h[-a-zA-Z0-9_/]*\.h>\|<[a-z0-9]\+>\)" syn match objcImport display "^\s*\(%:\|#\)\s*import\>\s*["<]" contains=objcImported " ObjC Compiler Directives syn match objcObjDef display /@interface\>\|@implementation\>\|@end\>\|@class\>/ syn match objcProtocol display /@protocol\>\|@optional\>\|@required\>/ syn match objcProperty display /@property\>\|@synthesize\>\|@dynamic\>/ -syn match objcIvarScope display /@private\>\|@protected\>\|@public\>/ +syn match objcIvarScope display /@private\>\|@protected\>\|@public\>\|@package\>/ syn match objcInternalRep display /@selector\>\|@encode\>/ syn match objcException display /@try\>\|@throw\>\|@catch\|@finally\>/ syn match objcThread display /@synchronized\>/ @@ -56,6 +55,17 @@ syn keyword objcTollFreeBridgeQualifier __bridge __bridge_retained __bridge_tran " ObjC Type Qualifiers for Remote Messaging syn match objcRemoteMessagingQualifier display contained /\((\s*oneway\s\+\|(\s*in\s\+\|(\s*out\s\+\|(\s*inout\s\+\|(\s*bycopy\s\+\(in\(out\)\?\|out\)\?\|(\s*byref\s\+\(in\(out\)\?\|out\)\?\)/hs=s+1 +" ObjC Storage Classes +syn keyword objcStorageClass _Nullable _Nonnull _Null_unspecified +syn keyword objcStorageClass __nullable __nonnull __null_unspecified +syn keyword objcStorageClass nullable nonnull null_unspecified + +" ObjC type specifier +syn keyword objcTypeSpecifier __kindof __covariant + +" ObjC Type Infomation Parameters +syn keyword objcTypeInfoParams ObjectType KeyType + " shorthand syn cluster objcTypeQualifier contains=objcBlocksQualifier,objcObjectLifetimeQualifier,objcTollFreeBridgeQualifier,objcRemoteMessagingQualifier @@ -75,17 +85,24 @@ syn keyword objcDeclPropAccessorType readonly readwrite contained syn keyword objcDeclPropAssignSemantics assign retain copy contained syn keyword objcDeclPropAtomicity nonatomic contained syn keyword objcDeclPropARC strong weak contained -syn region objcDeclProp display transparent keepend start=/@property\s*(/ end=/)/ contains=objcProperty,objcDeclPropAccessorName,objcDeclPropAccessorType,objcDeclPropAssignSemantics,objcDeclPropAtomicity,objcDeclPropARC +syn match objcDeclPropNullable /\((\|\s\)nullable\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn match objcDeclPropNonnull /\((\|\s\)nonnull\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn match objcDeclPropNullUnspecified /\((\|\s\)null_unspecified\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn keyword objcDeclProcNullResettable null_resettable contained +syn region objcDeclProp display transparent keepend start=/@property\s*(/ end=/)/ contains=objcProperty,objcDeclPropAccessorName,objcDeclPropAccessorType,objcDeclPropAssignSemantics,objcDeclPropAtomicity,objcDeclPropARC,objcDeclPropNullable,objcDeclPropNonnull,objcDeclPropNullUnspecified,objcDeclProcNullResettable " To distinguish colons in methods and dictionaries from those in C's labels. syn match objcColon display /^\s*\h\w*\s*\:\(\s\|.\)/me=e-1,he=e-1 " To distinguish a protocol list from system header files -syn match objcProtocolList display /<\h\w*\(\s*,\s*\h\w*\)*>/ contains=objcPrincipalType,cType,Type +syn match objcProtocolList display /<\h\w*\(\s*,\s*\h\w*\)*>/ contains=objcPrincipalType,cType,Type,objcType,objcTypeInfoParams + +" Type info for collection classes +syn match objcTypeInfo display /<\h\w*\s*<\(\h\w*\s*\**\|\h\w*\)>>/ contains=objcPrincipalType,cType,Type,objcType,objcTypeInfoParams " shorthand syn cluster objcCEntities contains=cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,cStatement,cLabel,cConditional,cRepeat -syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,objcModuleImport,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro +syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,objcModuleImport,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro,objcTypeInfo " Objective-C Message Expressions syn region objcMethodCall start=/\[/ end=/\]/ contains=objcMethodCall,objcBlocks,@objcObjCEntities,@objcCEntities @@ -114,13 +131,17 @@ syn keyword objcEnum NSSortOptions syn keyword objcEnumValue NSSortConcurrent NSSortStable syn keyword objcEnumValue NSNotFound syn keyword objcMacro NSIntegerMax NSIntegerMin NSUIntegerMax +syn keyword objcMacro NS_INLINE NS_BLOCKS_AVAILABLE NS_NONATOMIC_IOSONLY NS_FORMAT_FUNCTION NS_FORMAT_ARGUMENT NS_RETURNS_RETAINED NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_AUTOMATED_REFCOUNT_UNAVAILABLE NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE NS_REQUIRES_PROPERTY_DEFINITIONS NS_REPLACES_RECEIVER NS_RELEASES_ARGUMENT NS_VALID_UNTIL_END_OF_SCOPE NS_ROOT_CLASS NS_REQUIRES_SUPER NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION NS_DESIGNATED_INITIALIZER NS_REQUIRES_NIL_TERMINATION +syn keyword objcEnum NSQualityOfService +syn keyword objcEnumValue NSQualityOfServiceUserInteractive NSQualityOfServiceUserInitiated NSQualityOfServiceUtility NSQualityOfServiceBackground NSQualityOfServiceDefault " NSRange.h syn keyword objcType NSRange NSRangePointer " NSGeometry.h -syn keyword objcType NSPoint NSPointPointer NSPointArray NSSize NSSizePointer NSSizeArray NSRect NSRectPointer NSRectArray +syn keyword objcType NSPoint NSPointPointer NSPointArray NSSize NSSizePointer NSSizeArray NSRect NSRectPointer NSRectArray NSEdgeInsets syn keyword objcEnum NSRectEdge syn keyword objcEnumValue NSMinXEdge NSMinYEdge NSMaxXEdge NSMaxYEdge -syn keyword objcConstVar NSZeroPoint NSZeroSize NSZeroRect +syn keyword objcEnumValue NSRectEdgeMinX NSRectEdgeMinY NSRectEdgeMaxX NSRectEdgeMaxY +syn keyword objcConstVar NSZeroPoint NSZeroSize NSZeroRect NSEdgeInsetsZero syn keyword cType CGFloat CGPoint CGSize CGRect syn keyword objcEnum NSAlignmentOptions syn keyword objcEnumValue NSAlignMinXInward NSAlignMinYInward NSAlignMaxXInward NSAlignMaxYInward NSAlignWidthInward NSAlignHeightInward NSAlignMinXOutward NSAlignMinYOutward NSAlignMaxXOutward NSAlignMaxYOutward NSAlignWidthOutward NSAlignHeightOutward NSAlignMinXNearest NSAlignMinYNearest NSAlignMaxXNearest NSAlignMaxYNearest NSAlignWidthNearest NSAlignHeightNearest NSAlignRectFlipped NSAlignAllEdgesInward NSAlignAllEdgesOutward NSAlignAllEdgesNearest @@ -130,6 +151,7 @@ syn keyword objcEnum NSRoundingMode syn keyword objcEnumValue NSRoundPlain NSRoundDown NSRoundUp NSRoundBankers syn keyword objcEnum NSCalculationError syn keyword objcEnumValue NSCalculationNoError NSCalculationLossOfPrecision NSCalculationUnderflow NSCalculationOverflow NSCalculationDivideByZero +syn keyword objcConstVar NSDecimalMaxSize NSDecimalNoScale " NSDate.h syn match objcClass /NSDate\s*\*/me=s+6,he=s+6 syn keyword objcType NSTimeInterval @@ -137,11 +159,13 @@ syn keyword objcNotificationValue NSSystemClockDidChangeNotification syn keyword objcMacro NSTimeIntervalSince1970 " NSZone.h syn match objcType /NSZone\s*\*/me=s+6,he=s+6 +syn keyword objcEnumValue NSScannedOption NSCollectorDisabledOption " NSError.h syn match objcClass /NSError\s*\*/me=s+7,he=s+7 syn keyword objcConstVar NSCocoaErrorDomain NSPOSIXErrorDomain NSOSStatusErrorDomain NSMachErrorDomain NSUnderlyingErrorKey NSLocalizedDescriptionKey NSLocalizedFailureReasonErrorKey NSLocalizedRecoverySuggestionErrorKey NSLocalizedRecoveryOptionsErrorKey NSRecoveryAttempterErrorKey NSHelpAnchorErrorKey NSStringEncodingErrorKey NSURLErrorKey NSFilePathErrorKey " NSException.h syn match objcClass /NSException\s*\*/me=s+11,he=s+11 +syn match objcClass /NSAssertionHandler\s*\*/me=s+18,he=s+18 syn keyword objcType NSUncaughtExceptionHandler syn keyword objcConstVar NSGenericException NSRangeException NSInvalidArgumentException NSInternalInconsistencyException NSMallocException NSObjectInaccessibleException NSObjectNotAvailableException NSDestinationInvalidException NSPortTimeoutException NSInvalidSendPortException NSInvalidReceivePortException NSPortSendException NSPortReceiveException NSOldStyleException " NSNotification.h @@ -153,6 +177,8 @@ syn keyword objcConstVar NSLocalNotificationCenterType syn keyword objcEnum NSNotificationSuspensionBehavior syn keyword objcEnumValue NSNotificationSuspensionBehaviorDrop NSNotificationSuspensionBehaviorCoalesce NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorDeliverImmediately syn keyword objcEnumValue NSNotificationDeliverImmediately NSNotificationPostToAllSessions +syn keyword objcEnum NSDistributedNotificationOptions +syn keyword objcEnumValue NSDistributedNotificationDeliverImmediately NSDistributedNotificationPostToAllSessions " NSNotificationQueue.h syn match objcClass /NSNotificationQueue\s*\*/me=s+19,he=s+19 syn keyword objcEnum NSPostingStyle @@ -161,11 +187,15 @@ syn keyword objcEnum NSNotificationCoalescing syn keyword objcEnumValue NSNotificationNoCoalescing NSNotificationCoalescingOnName NSNotificationCoalescingOnSender " NSEnumerator.h syn match objcClass /NSEnumerator\s*\*/me=s+12,he=s+12 +syn match objcClass /NSEnumerator<.*>\s*\*/me=s+12,he=s+12 contains=objcTypeInfoParams +syn keyword objcType NSFastEnumerationState " NSIndexSet.h syn match objcClass /NSIndexSet\s*\*/me=s+10,he=s+10 syn match objcClass /NSMutableIndexSet\s*\*/me=s+17,he=s+17 " NSCharecterSet.h syn match objcClass /NSCharacterSet\s*\*/me=s+14,he=s+14 +syn match objcClass /NSMutableCharacterSet\s*\*/me=s+21,he=s+21 +syn keyword objcConstVar NSOpenStepUnicodeReservedBase " NSURL.h syn match objcClass /NSURL\s*\*/me=s+5,he=s+5 syn keyword objcEnum NSURLBookmarkCreationOptions @@ -174,11 +204,11 @@ syn keyword objcEnum NSURLBookmarkResolutionOptions syn keyword objcEnumValue NSURLBookmarkResolutionWithoutUI NSURLBookmarkResolutionWithoutMounting NSURLBookmarkResolutionWithSecurityScope syn keyword objcType NSURLBookmarkFileCreationOptions syn keyword objcConstVar NSURLFileScheme NSURLKeysOfUnsetValuesKey -syn keyword objcConstVar NSURLNameKey NSURLLocalizedNameKey NSURLIsRegularFileKey NSURLIsDirectoryKey NSURLIsSymbolicLinkKey NSURLIsVolumeKey NSURLIsPackageKey NSURLIsSystemImmutableKey NSURLIsUserImmutableKey NSURLIsHiddenKey NSURLHasHiddenExtensionKey NSURLCreationDateKey NSURLContentAccessDateKey NSURLContentModificationDateKey NSURLAttributeModificationDateKey NSURLLinkCountKey NSURLParentDirectoryURLKey NSURLVolumeURLKey NSURLTypeIdentifierKey NSURLLocalizedTypeDescriptionKey NSURLLabelNumberKey NSURLLabelColorKey NSURLLocalizedLabelKey NSURLEffectiveIconKey NSURLCustomIconKey NSURLFileResourceIdentifierKey NSURLVolumeIdentifierKey NSURLPreferredIOBlockSizeKey NSURLIsReadableKey NSURLIsWritableKey NSURLIsExecutableKey NSURLFileSecurityKey NSURLIsExcludedFromBackupKey NSURLPathKey NSURLIsMountTriggerKey NSURLFileResourceTypeKey -syn keyword objcConstVar NSURLFileResourceTypeNamedPipe NSURLFileResourceTypeCharacterSpecial NSURLFileResourceTypeDirectory NSURLFileResourceTypeBlockSpecial NSURLFileResourceTypeRegular NSURLFileResourceTypeSymbolicLink NSURLFileResourceTypeSocket NSURLFileResourceTypeUnknown -syn keyword objcConstVar NSURLFileSizeKey NSURLFileAllocatedSizeKey NSURLTotalFileSizeKey NSURLTotalFileAllocatedSizeKey NSURLIsAliasFileKey +syn keyword objcConstVar NSURLNameKey NSURLLocalizedNameKey NSURLIsRegularFileKey NSURLIsDirectoryKey NSURLIsSymbolicLinkKey NSURLIsVolumeKey NSURLIsPackageKey NSURLIsApplicationKey NSURLApplicationIsScriptableKey NSURLIsSystemImmutableKey NSURLIsUserImmutableKey NSURLIsHiddenKey NSURLHasHiddenExtensionKey NSURLCreationDateKey NSURLContentAccessDateKey NSURLContentModificationDateKey NSURLAttributeModificationDateKey NSURLLinkCountKey NSURLParentDirectoryURLKey NSURLVolumeURLKey NSURLTypeIdentifierKey NSURLLocalizedTypeDescriptionKey NSURLLabelNumberKey NSURLLabelColorKey NSURLLocalizedLabelKey NSURLEffectiveIconKey NSURLCustomIconKey NSURLFileResourceIdentifierKey NSURLVolumeIdentifierKey NSURLPreferredIOBlockSizeKey NSURLIsReadableKey NSURLIsWritableKey NSURLIsExecutableKey NSURLFileSecurityKey NSURLIsExcludedFromBackupKey NSURLTagNamesKey NSURLPathKey NSURLIsMountTriggerKey NSURLGenerationIdentifierKey NSURLDocumentIdentifierKey NSURLAddedToDirectoryDateKey NSURLQuarantinePropertiesKey NSURLFileResourceTypeKey +syn keyword objcConstVar NSURLFileResourceTypeNamedPipe NSURLFileResourceTypeCharacterSpecial NSURLFileResourceTypeDirectory NSURLFileResourceTypeBlockSpecial NSURLFileResourceTypeRegular NSURLFileResourceTypeSymbolicLink NSURLFileResourceTypeSocket NSURLFileResourceTypeUnknown NSURLThumbnailDictionaryKey NSURLThumbnailKey NSThumbnail1024x1024SizeKey +syn keyword objcConstVar NSURLFileSizeKey NSURLFileAllocatedSizeKey NSURLTotalFileSizeKey NSURLTotalFileAllocatedSizeKey NSURLIsAliasFileKey NSURLFileProtectionKey NSURLFileProtectionNone NSURLFileProtectionComplete NSURLFileProtectionCompleteUnlessOpen NSURLFileProtectionCompleteUntilFirstUserAuthentication syn keyword objcConstVar NSURLVolumeLocalizedFormatDescriptionKey NSURLVolumeTotalCapacityKey NSURLVolumeAvailableCapacityKey NSURLVolumeResourceCountKey NSURLVolumeSupportsPersistentIDsKey NSURLVolumeSupportsSymbolicLinksKey NSURLVolumeSupportsHardLinksKey NSURLVolumeSupportsJournalingKey NSURLVolumeIsJournalingKey NSURLVolumeSupportsSparseFilesKey NSURLVolumeSupportsZeroRunsKey NSURLVolumeSupportsCaseSensitiveNamesKey NSURLVolumeSupportsCasePreservedNamesKey NSURLVolumeSupportsRootDirectoryDatesKey NSURLVolumeSupportsVolumeSizesKey NSURLVolumeSupportsRenamingKey NSURLVolumeSupportsAdvisoryFileLockingKey NSURLVolumeSupportsExtendedSecurityKey NSURLVolumeIsBrowsableKey NSURLVolumeMaximumFileSizeKey NSURLVolumeIsEjectableKey NSURLVolumeIsRemovableKey NSURLVolumeIsInternalKey NSURLVolumeIsAutomountedKey NSURLVolumeIsLocalKey NSURLVolumeIsReadOnlyKey NSURLVolumeCreationDateKey NSURLVolumeURLForRemountingKey NSURLVolumeUUIDStringKey NSURLVolumeNameKey NSURLVolumeLocalizedNameKey -syn keyword objcConstVar NSURLIsUbiquitousItemKey NSURLUbiquitousItemHasUnresolvedConflictsKey NSURLUbiquitousItemIsDownloadedKey NSURLUbiquitousItemIsDownloadingKey NSURLUbiquitousItemIsUploadedKey NSURLUbiquitousItemIsUploadingKey NSURLUbiquitousItemPercentDownloadedKey NSURLUbiquitousItemPercentUploadedKey +syn keyword objcConstVar NSURLIsUbiquitousItemKey NSURLUbiquitousItemHasUnresolvedConflictsKey NSURLUbiquitousItemIsDownloadedKey NSURLUbiquitousItemIsDownloadingKey NSURLUbiquitousItemIsUploadedKey NSURLUbiquitousItemIsUploadingKey NSURLUbiquitousItemPercentDownloadedKey NSURLUbiquitousItemPercentUploadedKey NSURLUbiquitousItemDownloadingStatusKey NSURLUbiquitousItemDownloadingErrorKey NSURLUbiquitousItemUploadingErrorKey NSURLUbiquitousItemDownloadRequestedKey NSURLUbiquitousItemContainerDisplayNameKey NSURLUbiquitousItemDownloadingStatusNotDownloaded NSURLUbiquitousItemDownloadingStatusDownloaded NSURLUbiquitousItemDownloadingStatusCurrent """""""""""" " NSString.h syn match objcClass /NSString\s*\*/me=s+8,he=s+8 @@ -189,11 +219,14 @@ syn keyword objcMacro NSMaximumStringLength syn keyword objcEnum NSStringCompareOptions syn keyword objcEnumValue NSCaseInsensitiveSearch NSLiteralSearch NSBackwardsSearch NSAnchoredSearch NSNumericSearch NSDiacriticInsensitiveSearch NSWidthInsensitiveSearch NSForcedOrderingSearch NSRegularExpressionSearch syn keyword objcEnum NSStringEncoding +syn keyword objcEnumValue NSProprietaryStringEncoding syn keyword objcEnumValue NSASCIIStringEncoding NSNEXTSTEPStringEncoding NSJapaneseEUCStringEncoding NSUTF8StringEncoding NSISOLatin1StringEncoding NSSymbolStringEncoding NSNonLossyASCIIStringEncoding NSShiftJISStringEncoding NSISOLatin2StringEncoding NSUnicodeStringEncoding NSWindowsCP1251StringEncoding NSWindowsCP1252StringEncoding NSWindowsCP1253StringEncoding NSWindowsCP1254StringEncoding NSWindowsCP1250StringEncoding NSISO2022JPStringEncoding NSMacOSRomanStringEncoding NSUTF16StringEncoding NSUTF16BigEndianStringEncoding NSUTF16LittleEndianStringEncoding NSUTF32StringEncoding NSUTF32BigEndianStringEncoding NSUTF32LittleEndianStringEncoding syn keyword objcEnum NSStringEncodingConversionOptions syn keyword objcEnumValue NSStringEncodingConversionAllowLossy NSStringEncodingConversionExternalRepresentation syn keyword objcEnum NSStringEnumerationOptions syn keyword objcEnumValue NSStringEnumerationByLines NSStringEnumerationByParagraphs NSStringEnumerationByComposedCharacterSequences NSStringEnumerationByWords NSStringEnumerationBySentences NSStringEnumerationReverse NSStringEnumerationSubstringNotRequired NSStringEnumerationLocalized +syn keyword objcConstVar NSStringTransformLatinToKatakana NSStringTransformLatinToHiragana NSStringTransformLatinToHangul NSStringTransformLatinToArabic NSStringTransformLatinToHebrew NSStringTransformLatinToThai NSStringTransformLatinToCyrillic NSStringTransformLatinToGreek NSStringTransformToLatin NSStringTransformMandarinToLatin NSStringTransformHiraganaToKatakana NSStringTransformFullwidthToHalfwidth NSStringTransformToXMLHex NSStringTransformToUnicodeName NSStringTransformStripCombiningMarks NSStringTransformStripDiacritics +syn keyword objcConstVar NSStringEncodingDetectionSuggestedEncodingsKey NSStringEncodingDetectionDisallowedEncodingsKey NSStringEncodingDetectionUseOnlySuggestedEncodingsKey NSStringEncodingDetectionAllowLossyKey NSStringEncodingDetectionFromWindowsKey NSStringEncodingDetectionLossySubstitutionKey NSStringEncodingDetectionLikelyLanguageKey " NSAttributedString.h syn match objcClass /NSAttributedString\s*\*/me=s+18,he=s+18 syn match objcClass /NSMutableAttributedString\s*\*/me=s+25,he=s+25 @@ -215,21 +248,32 @@ syn keyword objcEnum NSDataWritingOptions syn keyword objcEnumValue NSDataWritingAtomic NSDataWritingWithoutOverwriting NSDataWritingFileProtectionNone NSDataWritingFileProtectionComplete NSDataWritingFileProtectionCompleteUnlessOpen NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication NSDataWritingFileProtectionMask NSAtomicWrite syn keyword objcEnum NSDataSearchOptions syn keyword objcEnumValue NSDataSearchBackwards NSDataSearchAnchored +syn keyword objcEnum NSDataBase64EncodingOptions NSDataBase64DecodingOptions +syn keyword objcEnumValue NSDataBase64Encoding64CharacterLineLength NSDataBase64Encoding76CharacterLineLength NSDataBase64EncodingEndLineWithCarriageReturn NSDataBase64EncodingEndLineWithLineFeed NSDataBase64DecodingIgnoreUnknownCharacters " NSArray.h syn match objcClass /NSArray\s*\*/me=s+7,he=s+7 +syn match objcClass /NSArray<.*>\s*\*/me=s+7,he=s+7 contains=objcTypeInfoParams syn match objcClass /NSMutableArray\s*\*/me=s+14,he=s+14 +syn match objcClass /NSMutableArray<.*>\s*\*/me=s+14,he=s+14 contains=objcTypeInfoParams syn keyword objcEnum NSBinarySearchingOptions syn keyword objcEnumValue NSBinarySearchingFirstEqual NSBinarySearchingLastEqual NSBinarySearchingInsertionIndex " NSDictionary.h syn match objcClass /NSDictionary\s*\*/me=s+12,he=s+12 +syn match objcClass /NSDictionary<.*>\s*\*/me=s+12,he=s+12 contains=objcTypeInfoParams syn match objcClass /NSMutableDictionary\s*\*/me=s+19,he=s+19 +syn match objcClass /NSMutableDictionary<.*>\s*\*/me=s+19,he=s+19 contains=objcTypeInfoParams " NSSet.h syn match objcClass /NSSet\s*\*/me=s+5,me=s+5 +syn match objcClass /NSSet<.*>\s*\*/me=s+5,me=s+5 contains=objcTypeInfoParams syn match objcClass /NSMutableSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSMutableSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams syn match objcClass /NSCountedSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSCountedSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams " NSOrderedSet.h syn match objcClass /NSOrderedSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSOrderedSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams syn match objcClass /NSMutableOrderedSet\s*\*/me=s+19,me=s+19 +syn match objcClass /NSMutableOrderedSet<.*>\s*\*/me=s+19,me=s+19 """"""""""""""""""" " NSPathUtilities.h syn keyword objcEnum NSSearchPathDirectory @@ -238,9 +282,15 @@ syn keyword objcEnum NSSearchPathDomainMask syn keyword objcEnumValue NSUserDomainMask NSLocalDomainMask NSNetworkDomainMask NSSystemDomainMask NSAllDomainsMask " NSFileManger.h syn match objcClass /NSFileManager\s*\*/me=s+13,he=s+13 -syn match objcClass /NSDirectoryEnumerator\s*\*/me=s+21,he=s+21 +syn match objcClass /NSDirectoryEnumerator\s*\*/me=s+21,he=s+21 contains=objcTypeInfoParams +syn match objcClass /NSDirectoryEnumerator<.*>\s*\*/me=s+21,he=s+21 syn keyword objcEnum NSVolumeEnumerationOptions syn keyword objcEnumValue NSVolumeEnumerationSkipHiddenVolumes NSVolumeEnumerationProduceFileReferenceURLs +syn keyword objcEnum NSURLRelationship +syn keyword objcEnumValue NSURLRelationshipContains NSURLRelationshipSame NSURLRelationshipOther +syn keyword objcEnum NSFileManagerUnmountOptions +syn keyword objcEnumValue NSFileManagerUnmountAllPartitionsAndEjectDisk NSFileManagerUnmountWithoutUI +syn keyword objcConstVar NSFileManagerUnmountDissentingProcessIdentifierErrorKey syn keyword objcEnum NSDirectoryEnumerationOptions syn keyword objcEnumValue NSDirectoryEnumerationSkipsSubdirectoryDescendants NSDirectoryEnumerationSkipsPackageDescendants NSDirectoryEnumerationSkipsHiddenFiles syn keyword objcEnum NSFileManagerItemReplacementOptions @@ -261,10 +311,12 @@ syn keyword objcNotificationValue NSCurrentLocaleDidChangeNotification syn keyword objcConstVar NSLocaleIdentifier NSLocaleLanguageCode NSLocaleCountryCode NSLocaleScriptCode NSLocaleVariantCode NSLocaleExemplarCharacterSet NSLocaleCalendar NSLocaleCollationIdentifier NSLocaleUsesMetricSystem NSLocaleMeasurementSystem NSLocaleDecimalSeparator NSLocaleGroupingSeparator NSLocaleCurrencySymbol NSLocaleCurrencyCode NSLocaleCollatorIdentifier NSLocaleQuotationBeginDelimiterKey NSLocaleQuotationEndDelimiterKey NSLocaleAlternateQuotationBeginDelimiterKey NSLocaleAlternateQuotationEndDelimiterKey NSGregorianCalendar NSBuddhistCalendar NSChineseCalendar NSHebrewCalendar NSIslamicCalendar NSIslamicCivilCalendar NSJapaneseCalendar NSRepublicOfChinaCalendar NSPersianCalendar NSIndianCalendar NSISO8601Calendar " NSFormatter.h syn match objcClass /NSFormatter\s*\*/me=s+11,he=s+11 +syn keyword objcEnum NSFormattingContext NSFormattingUnitStyle +syn keyword objcEnumValue NSFormattingContextUnknown NSFormattingContextDynamic NSFormattingContextStandalone NSFormattingContextListItem NSFormattingContextBeginningOfSentence NSFormattingContextMiddleOfSentence NSFormattingUnitStyleShort NSFormattingUnitStyleMedium NSFormattingUnitStyleLong " NSNumberFormatter.h syn match objcClass /NSNumberFormatter\s*\*/me=s+17,he=s+17 syn keyword objcEnum NSNumberFormatterStyle -syn keyword objcEnumValue NSNumberFormatterNoStyle NSNumberFormatterDecimalStyle NSNumberFormatterCurrencyStyle NSNumberFormatterPercentStyle NSNumberFormatterScientificStyle NSNumberFormatterSpellOutStyle +syn keyword objcEnumValue NSNumberFormatterNoStyle NSNumberFormatterDecimalStyle NSNumberFormatterCurrencyStyle NSNumberFormatterPercentStyle NSNumberFormatterScientificStyle NSNumberFormatterSpellOutStyle NSNumberFormatterOrdinalStyle NSNumberFormatterCurrencyISOCodeStyle NSNumberFormatterCurrencyPluralStyle NSNumberFormatterCurrencyAccountingStyle syn keyword objcEnum NSNumberFormatterBehavior syn keyword objcEnumValue NSNumberFormatterBehaviorDefault NSNumberFormatterBehavior10_0 NSNumberFormatterBehavior10_4 syn keyword objcEnum NSNumberFormatterPadPosition @@ -279,10 +331,15 @@ syn keyword objcEnum NSDateFormatterBehavior syn keyword objcEnumValue NSDateFormatterBehaviorDefault NSDateFormatterBehavior10_0 NSDateFormatterBehavior10_4 " NSCalendar.h syn match objcClass /NSCalendar\s*\*/me=s+10,he=s+10 +syn keyword objcConstVar NSCalendarIdentifierGregorian NSCalendarIdentifierBuddhist NSCalendarIdentifierChinese NSCalendarIdentifierCoptic NSCalendarIdentifierEthiopicAmeteMihret NSCalendarIdentifierEthiopicAmeteAlem NSCalendarIdentifierHebrew NSCalendarIdentifierISO8601 NSCalendarIdentifierIndian NSCalendarIdentifierIslamic NSCalendarIdentifierIslamicCivil NSCalendarIdentifierJapanese NSCalendarIdentifierPersian NSCalendarIdentifierRepublicOfChina NSCalendarIdentifierIslamicTabular NSCalendarIdentifierIslamicUmmAlQura syn keyword objcEnum NSCalendarUnit +syn keyword objcEnumValue NSCalendarUnitEra NSCalendarUnitYear NSCalendarUnitMonth NSCalendarUnitDay NSCalendarUnitHour NSCalendarUnitMinute NSCalendarUnitSecond NSCalendarUnitWeekday NSCalendarUnitWeekdayOrdinal NSCalendarUnitQuarter NSCalendarUnitWeekOfMonth NSCalendarUnitWeekOfYear NSCalendarUnitYearForWeekOfYear NSCalendarUnitNanosecond NSCalendarUnitCalendar NSCalendarUnitTimeZone syn keyword objcEnumValue NSEraCalendarUnit NSYearCalendarUnit NSMonthCalendarUnit NSDayCalendarUnit NSHourCalendarUnit NSMinuteCalendarUnit NSSecondCalendarUnit NSWeekCalendarUnit NSWeekdayCalendarUnit NSWeekdayOrdinalCalendarUnit NSQuarterCalendarUnit NSWeekOfMonthCalendarUnit NSWeekOfYearCalendarUnit NSYearForWeekOfYearCalendarUnit NSCalendarCalendarUnit NSTimeZoneCalendarUnit -syn keyword objcEnumValue NSWrapCalendarComponents NSUndefinedDateComponent +syn keyword objcEnumValue NSWrapCalendarComponents NSUndefinedDateComponent NSDateComponentUndefined syn match objcClass /NSDateComponents\s*\*/me=s+16,he=s+16 +syn keyword objcEnum NSCalendarOptions +syn keyword objcEnumValue NSCalendarWrapComponents NSCalendarMatchStrictly NSCalendarSearchBackwards NSCalendarMatchPreviousTimePreservingSmallerUnits NSCalendarMatchNextTimePreservingSmallerUnits NSCalendarMatchNextTime NSCalendarMatchFirst NSCalendarMatchLast +syn keyword objcConstVar NSCalendarDayChangedNotification " NSTimeZone.h syn match objcClass /NSTimeZone\s*\*/me=s+10,he=s+10 syn keyword objcEnum NSTimeZoneNameStyle @@ -299,6 +356,7 @@ syn keyword objcExceptionValue NSInconsistentArchiveException syn match objcClass /NSKeyedArchiver\s*\*/me=s+15,he=s+15 syn match objcClass /NSKeyedUnarchiver\s*\*/me=s+17,he=s+17 syn keyword objcExceptionValue NSInvalidArchiveOperationException NSInvalidUnarchiveOperationException +syn keyword objcConstVar NSKeyedArchiveRootObjectKey """""""""""""""""" " NSPropertyList.h syn keyword objcEnum NSPropertyListMutabilityOptions @@ -313,11 +371,16 @@ syn keyword objcNotificationValue NSUserDefaultsDidChangeNotification " NSBundle.h syn match objcClass /NSBundle\s*\*/me=s+8,he=s+8 syn keyword objcEnumValue NSBundleExecutableArchitectureI386 NSBundleExecutableArchitecturePPC NSBundleExecutableArchitectureX86_64 NSBundleExecutableArchitecturePPC64 -syn keyword objcNotificationValue NSBundleDidLoadNotification NSLoadedClasses +syn keyword objcNotificationValue NSBundleDidLoadNotification NSLoadedClasses NSBundleResourceRequestLowDiskSpaceNotification +syn keyword objcConstVar NSBundleResourceRequestLoadingPriorityUrgent """"""""""""""""" " NSProcessInfo.h syn match objcClass /NSProcessInfo\s*\*/me=s+13,he=s+13 syn keyword objcEnumValue NSWindowsNTOperatingSystem NSWindows95OperatingSystem NSSolarisOperatingSystem NSHPUXOperatingSystem NSMACHOperatingSystem NSSunOSOperatingSystem NSOSF1OperatingSystem +syn keyword objcType NSOperatingSystemVersion +syn keyword objcEnum NSActivityOptions NSProcessInfoThermalState +syn keyword objcEnumValue NSActivityIdleDisplaySleepDisabled NSActivityIdleSystemSleepDisabled NSActivitySuddenTerminationDisabled NSActivityAutomaticTerminationDisabled NSActivityUserInitiated NSActivityUserInitiatedAllowingIdleSystemSleep NSActivityBackground NSActivityLatencyCritical NSProcessInfoThermalStateNominal NSProcessInfoThermalStateFair NSProcessInfoThermalStateSerious NSProcessInfoThermalStateCritical +syn keyword objcNotificationValue NSProcessInfoThermalStateDidChangeNotification NSProcessInfoPowerStateDidChangeNotification " NSTask.h syn match objcClass /NSTask\s*\*/me=s+6,he=s+6 syn keyword objcEnum NSTaskTerminationReason @@ -352,6 +415,7 @@ syn match objcClass /NSPort\s*\*/me=s+6,he=s+6 syn keyword objcType NSSocketNativeHandle syn keyword objcNotificationValue NSPortDidBecomeInvalidNotification syn match objcClass /NSMachPort\s*\*/me=s+10,he=s+10 +syn keyword objcEnum NSMachPortOptions syn keyword objcEnumValue NSMachPortDeallocateNone NSMachPortDeallocateSendRight NSMachPortDeallocateReceiveRight syn match objcClass /NSMessagePort\s*\*/me=s+13,he=s+13 syn match objcClass /NSSocketPort\s*\*/me=s+12,he=s+12 @@ -386,6 +450,31 @@ syn match objcClass /NSProxy\s*\*/me=s+7,he=s+7 " NSObject.h syn match objcClass /NSObject\s*\*/me=s+8,he=s+8 + +" NSCache.h +syn match objcClass /NSCache\s*\*/me=s+7,he=s+7 +syn match objcClass /NSCache<.*>\s*\*/me=s+7,he=s+7 contains=objcTypeInfoParams +" NSHashTable.h +syn match objcClass /NSHashTable\s*\*/me=s+11,he=s+11 +syn match objcClass /NSHashTable<.*>\s*\*/me=s+11,he=s+11 contains=objcTypeInfoParams +syn keyword objcConstVar NSHashTableStrongMemory NSHashTableZeroingWeakMemory NSHashTableCopyIn NSHashTableObjectPointerPersonality NSHashTableWeakMemory +syn keyword objcType NSHashTableOptions NSHashEnumerator NSHashTableCallBacks +syn keyword objcConstVar NSIntegerHashCallBacks NSNonOwnedPointerHashCallBacks NSNonRetainedObjectHashCallBacks NSObjectHashCallBacks NSOwnedObjectIdentityHashCallBacks NSOwnedPointerHashCallBacks NSPointerToStructHashCallBacks NSOwnedObjectIdentityHashCallBacks NSOwnedObjectIdentityHashCallBacks NSIntHashCallBacks +" NSMapTable.h +syn match objcClass /NSMapTable\s*\*/me=s+10,he=s+10 +syn match objcClass /NSMapTable<.*>\s*\*/me=s+10,he=s+10 contains=objcTypeInfoParams +syn keyword objcConstVar NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks +syn keyword objcConstVar NSMapTableStrongMemory NSMapTableZeroingWeakMemory NSMapTableCopyIn NSMapTableObjectPointerPersonality NSMapTableWeakMemory +syn keyword objcType NSMapTableOptions NSMapEnumerator NSMapTableKeyCallBacks NSMapTableValueCallBacks +syn keyword objcMacro NSNotAnIntMapKey NSNotAnIntegerMapKey NSNotAPointerMapKey +syn keyword objcConstVar NSIntegerMapKeyCallBacks NSNonOwnedPointerMapKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks NSNonRetainedObjectMapKeyCallBacks NSObjectMapKeyCallBacks NSOwnedPointerMapKeyCallBacks NSIntMapKeyCallBacks NSIntegerMapValueCallBacks NSNonOwnedPointerMapValueCallBacks NSObjectMapValueCallBacks NSNonRetainedObjectMapValueCallBacks NSOwnedPointerMapValueCallBacks NSIntMapValueCallBacks + +" NSPointerFunctions.h +syn match objcClass /NSPointerFunctions\s*\*/me=s+18,he=s+18 +syn keyword objcEnum NSPointerFunctionsOptions +syn keyword objcEnumValue NSPointerFunctionsStrongMemory NSPointerFunctionsZeroingWeakMemory NSPointerFunctionsOpaqueMemory NSPointerFunctionsMallocMemory NSPointerFunctionsMachVirtualMemory NSPointerFunctionsWeakMemory NSPointerFunctionsObjectPersonality NSPointerFunctionsOpaquePersonality NSPointerFunctionsObjectPointerPersonality NSPointerFunctionsCStringPersonality NSPointerFunctionsStructPersonality NSPointerFunctionsIntegerPersonality NSPointerFunctionsCopyIn + + """ Default Highlighting hi def link objcPreProcMacro cConstant hi def link objcPrincipalType cType @@ -408,6 +497,7 @@ hi def link objcBlocksQualifier cStorageClass hi def link objcObjectLifetimeQualifier cStorageClass hi def link objcTollFreeBridgeQualifier cStorageClass hi def link objcRemoteMessagingQualifier cStorageClass +hi def link objcStorageClass cStorageClass hi def link objcFastEnumKeyword cStatement hi def link objcLiteralSyntaxNumber cNumber hi def link objcLiteralSyntaxChar cCharacter @@ -418,16 +508,22 @@ hi def link objcDeclPropAccessorType cConstant hi def link objcDeclPropAssignSemantics cConstant hi def link objcDeclPropAtomicity cConstant hi def link objcDeclPropARC cConstant +hi def link objcDeclPropNullable cConstant +hi def link objcDeclPropNonnull cConstant +hi def link objcDeclPropNullUnspecified cConstant +hi def link objcDeclProcNullResettable cConstant hi def link objcInstanceMethod Function hi def link objcClassMethod Function hi def link objcType cType hi def link objcClass cType +hi def link objcTypeSpecifier cType hi def link objcMacro cConstant hi def link objcEnum cType hi def link objcEnumValue cConstant hi def link objcExceptionValue cConstant hi def link objcNotificationValue cConstant hi def link objcConstVar cConstant +hi def link objcTypeInfoParams Identifier """ Final step let b:current_syntax = "objc" diff --git a/runtime/syntax/objcpp.vim b/runtime/syntax/objcpp.vim index e80eed900d..f11e307444 100644 --- a/runtime/syntax/objcpp.vim +++ b/runtime/syntax/objcpp.vim @@ -4,23 +4,15 @@ " Ex-Maintainer: Anthony Hodsdon <ahodsdon@fastmail.fm> " Last Change: 2007 Oct 29 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read in C++ and ObjC syntax files -if version < 600 - so <sfile>:p:h/cpp.vim - so <sfile>:p:h/objc.vim -else - runtime! syntax/cpp.vim - unlet b:current_syntax - runtime! syntax/objc.vim -endif +runtime! syntax/cpp.vim +unlet b:current_syntax +runtime! syntax/objc.vim syn keyword objCppNonStructure class template namespace transparent contained syn keyword objCppNonStatement new delete friend using transparent contained diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim index 24116f0e02..68c1feddae 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -13,11 +13,8 @@ " can be distinguished from begin/end, which is used for indentation, " and folding. (David Baelde) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") && b:current_syntax == "ocaml" +" quit when a syntax file was already loaded +if exists("b:current_syntax") && b:current_syntax == "ocaml" finish endif @@ -253,78 +250,68 @@ syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>" syn sync match ocamlSigSync groupthere ocamlSig "\<end\>" " 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_ocaml_syntax_inits") - if version < 508 - let did_ocaml_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ocamlBraceErr Error - HiLink ocamlBrackErr Error - HiLink ocamlParenErr Error - HiLink ocamlArrErr Error - - HiLink ocamlCommentErr Error - - HiLink ocamlCountErr Error - HiLink ocamlDoErr Error - HiLink ocamlDoneErr Error - HiLink ocamlEndErr Error - HiLink ocamlThenErr Error - - HiLink ocamlCharErr Error - - HiLink ocamlErr Error - - HiLink ocamlComment Comment - - HiLink ocamlModPath Include - HiLink ocamlObject Include - HiLink ocamlModule Include - HiLink ocamlModParam1 Include - HiLink ocamlModType Include - HiLink ocamlMPRestr3 Include - HiLink ocamlFullMod Include - HiLink ocamlModTypeRestr Include - HiLink ocamlWith Include - HiLink ocamlMTDef Include - - HiLink ocamlScript Include - - HiLink ocamlConstructor Constant - - HiLink ocamlVal Keyword - HiLink ocamlModPreRHS Keyword - HiLink ocamlMPRestr2 Keyword - HiLink ocamlKeyword Keyword - HiLink ocamlMethod Include - HiLink ocamlFunDef Keyword - HiLink ocamlRefAssign Keyword - HiLink ocamlKeyChar Keyword - HiLink ocamlAnyVar Keyword - HiLink ocamlTopStop Keyword - HiLink ocamlOperator Keyword - - HiLink ocamlBoolean Boolean - HiLink ocamlCharacter Character - HiLink ocamlNumber Number - HiLink ocamlFloat Float - HiLink ocamlString String - - HiLink ocamlLabel Identifier - - HiLink ocamlType Type - - HiLink ocamlTodo Todo - - HiLink ocamlEncl Keyword - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link ocamlBraceErr Error +hi def link ocamlBrackErr Error +hi def link ocamlParenErr Error +hi def link ocamlArrErr Error + +hi def link ocamlCommentErr Error + +hi def link ocamlCountErr Error +hi def link ocamlDoErr Error +hi def link ocamlDoneErr Error +hi def link ocamlEndErr Error +hi def link ocamlThenErr Error + +hi def link ocamlCharErr Error + +hi def link ocamlErr Error + +hi def link ocamlComment Comment + +hi def link ocamlModPath Include +hi def link ocamlObject Include +hi def link ocamlModule Include +hi def link ocamlModParam1 Include +hi def link ocamlModType Include +hi def link ocamlMPRestr3 Include +hi def link ocamlFullMod Include +hi def link ocamlModTypeRestr Include +hi def link ocamlWith Include +hi def link ocamlMTDef Include + +hi def link ocamlScript Include + +hi def link ocamlConstructor Constant + +hi def link ocamlVal Keyword +hi def link ocamlModPreRHS Keyword +hi def link ocamlMPRestr2 Keyword +hi def link ocamlKeyword Keyword +hi def link ocamlMethod Include +hi def link ocamlFunDef Keyword +hi def link ocamlRefAssign Keyword +hi def link ocamlKeyChar Keyword +hi def link ocamlAnyVar Keyword +hi def link ocamlTopStop Keyword +hi def link ocamlOperator Keyword + +hi def link ocamlBoolean Boolean +hi def link ocamlCharacter Character +hi def link ocamlNumber Number +hi def link ocamlFloat Float +hi def link ocamlString String + +hi def link ocamlLabel Identifier + +hi def link ocamlType Type + +hi def link ocamlTodo Todo + +hi def link ocamlEncl Keyword + let b:current_syntax = "ocaml" diff --git a/runtime/syntax/occam.vim b/runtime/syntax/occam.vim index 1c84bf00f6..01d139bd09 100644 --- a/runtime/syntax/occam.vim +++ b/runtime/syntax/occam.vim @@ -4,9 +4,8 @@ " Maintainer: Mario Schweigler <ms44@kent.ac.uk> " Last Change: 24 May 2003 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -86,41 +85,32 @@ syn match occamCDString /<\|>\|=\|(\|)/ contained syn region occamCDirective start=/#\(USE\|INCLUDE\|PRAGMA\|DEFINE\|UNDEFINE\|UNDEF\|IF\|ELIF\|ELSE\|ENDIF\|WARNING\|ERROR\|RELAX\)\>/ end=/$/ contains=occamString,occamComment,occamCDString -if version >= 508 || !exists("did_occam_syn_inits") - if version < 508 - let did_occam_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink occamType Type - HiLink occamKeyword Keyword - HiLink occamComment Comment - HiLink occamCommentTitle PreProc - HiLink occamTodo Todo - HiLink occamNote Todo - HiLink occamString String - HiLink occamCharString String - HiLink occamNumber Number - HiLink occamCDirective PreProc - HiLink occamCDString String - HiLink occamPPIdentifier PreProc - HiLink occamBoolean Boolean - HiLink occamSpecialChar SpecialChar - HiLink occamChar Character - HiLink occamStructure Structure - HiLink occamIdentifier Identifier - HiLink occamConstant Constant - HiLink occamOperator Operator - HiLink occamFunction Ignore - HiLink occamRepeat Repeat - HiLink occamConditional Conditional - HiLink occamBrackets Type - HiLink occamParantheses Delimiter - - delcommand HiLink -endif + +hi def link occamType Type +hi def link occamKeyword Keyword +hi def link occamComment Comment +hi def link occamCommentTitle PreProc +hi def link occamTodo Todo +hi def link occamNote Todo +hi def link occamString String +hi def link occamCharString String +hi def link occamNumber Number +hi def link occamCDirective PreProc +hi def link occamCDString String +hi def link occamPPIdentifier PreProc +hi def link occamBoolean Boolean +hi def link occamSpecialChar SpecialChar +hi def link occamChar Character +hi def link occamStructure Structure +hi def link occamIdentifier Identifier +hi def link occamConstant Constant +hi def link occamOperator Operator +hi def link occamFunction Ignore +hi def link occamRepeat Repeat +hi def link occamConditional Conditional +hi def link occamBrackets Type +hi def link occamParantheses Delimiter + let b:current_syntax = "occam" diff --git a/runtime/syntax/omnimark.vim b/runtime/syntax/omnimark.vim index 698b3c09fb..6294945ffb 100644 --- a/runtime/syntax/omnimark.vim +++ b/runtime/syntax/omnimark.vim @@ -3,19 +3,12 @@ " Maintainer: Paul Terray <mailto:terray@4dconcept.fr> " Last Change: 11 Oct 2000 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version < 600 - set iskeyword=@,48-57,_,128-167,224-235,- -else - setlocal iskeyword=@,48-57,_,128-167,224-235,- -endif +setlocal iskeyword=@,48-57,_,128-167,224-235,- syn keyword omnimarkKeywords ACTIVATE AGAIN syn keyword omnimarkKeywords CATCH CLEAR CLOSE COPY COPY-CLEAR CROSS-TRANSLATE @@ -96,26 +89,16 @@ syn match omnimarkEscape contained +%[0-9][0-9]#+ syn sync minlines=2000 " 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_omnimark_syntax_inits") - if version < 508 - let did_omnimark_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink omnimarkCommands Statement - HiLink omnimarkKeywords Identifier - HiLink omnimarkString String - HiLink omnimarkPatterns Macro -" HiLink omnimarkNumber Number - HiLink omnimarkComment Comment - HiLink omnimarkEscape Special +hi def link omnimarkCommands Statement +hi def link omnimarkKeywords Identifier +hi def link omnimarkString String +hi def link omnimarkPatterns Macro +" hi def link omnimarkNumber Number +hi def link omnimarkComment Comment +hi def link omnimarkEscape Special - delcommand HiLink -endif let b:current_syntax = "omnimark" diff --git a/runtime/syntax/openroad.vim b/runtime/syntax/openroad.vim index 3f9a78d552..e09f233647 100644 --- a/runtime/syntax/openroad.vim +++ b/runtime/syntax/openroad.vim @@ -3,12 +3,8 @@ " Maintainer: Luis Moreno <lmoreno@eresmas.net> " Last change: 2001 Jun 12 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -" -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -235,32 +231,22 @@ else endif " 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 +" Only when an item doesn't have highlighting yet " -if version >= 508 || !exists("did_openroad_syntax_inits") - if version < 508 - let did_openroad_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink openroadKeyword Statement - HiLink openroadNumber Number - HiLink openroadString String - HiLink openroadComment Comment - HiLink openroadOperator Operator - HiLink openroadType Type - HiLink openroadFunc Special - HiLink openroadClass Type - HiLink openroadEvent Statement - HiLink openroadConst Constant - HiLink openroadVar Identifier - HiLink openroadIdent Identifier - HiLink openroadTodo Todo +hi def link openroadKeyword Statement +hi def link openroadNumber Number +hi def link openroadString String +hi def link openroadComment Comment +hi def link openroadOperator Operator +hi def link openroadType Type +hi def link openroadFunc Special +hi def link openroadClass Type +hi def link openroadEvent Statement +hi def link openroadConst Constant +hi def link openroadVar Identifier +hi def link openroadIdent Identifier +hi def link openroadTodo Todo - delcommand HiLink -endif let b:current_syntax = "openroad" diff --git a/runtime/syntax/opl.vim b/runtime/syntax/opl.vim index 1b07e3596c..8b66a5b345 100644 --- a/runtime/syntax/opl.vim +++ b/runtime/syntax/opl.vim @@ -6,11 +6,8 @@ " Open Psion Language... (EPOC16/EPOC32) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -75,25 +72,15 @@ syn region OPLComment start="REM[\t ]" end="$" syn match OPLMathsOperator "-\|=\|[:<>+\*^/\\]" " 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_OPL_syntax_inits") - if version < 508 - let did_OPL_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink OPLStatement Statement - HiLink OPLNumber Number - HiLink OPLString String - HiLink OPLComment Comment - HiLink OPLMathsOperator Conditional -" HiLink OPLError Error +hi def link OPLStatement Statement +hi def link OPLNumber Number +hi def link OPLString String +hi def link OPLComment Comment +hi def link OPLMathsOperator Conditional +" hi def link OPLError Error - delcommand HiLink -endif let b:current_syntax = "opl" diff --git a/runtime/syntax/ora.vim b/runtime/syntax/ora.vim index bf5d3220a0..99034793f2 100644 --- a/runtime/syntax/ora.vim +++ b/runtime/syntax/ora.vim @@ -11,10 +11,8 @@ " sqlnet-ora and tnsnames.ora; since will not cause(?) problems " is easier to follow separately each file's keywords) -" Remove any old syntax stuff hanging around, if needed -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 @@ -437,35 +435,23 @@ syn cluster oraAll add=oraValue,oraModifier,oraString,oraSpecial,oraComment "============================================================================== " 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_ora_syn_inits") - - if version < 508 - let did_ora_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink oraKeyword Statement "usual keywords - HiLink oraKeywordGroup Type "keywords which group other keywords - HiLink oraKeywordPref oraKeywordGroup "keywords which act as prefixes - HiLink oraKeywordObs Todo "obsolete keywords - HiLink oraKeywordUnd PreProc "undocumented keywords - HiLink oraKeywordUndObs oraKeywordObs "undocumented obsolete keywords - HiLink oraValue Identifier "values, like true or false - HiLink oraModifier oraValue "modifies values - HiLink oraString String "strings - - HiLink oraSpecial Special "special characters - HiLink oraError Error "errors - HiLink oraParenError oraError "errors caused by mismatching parantheses - - HiLink oraComment Comment "comments - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link oraKeyword Statement "usual keywords +hi def link oraKeywordGroup Type "keywords which group other keywords +hi def link oraKeywordPref oraKeywordGroup "keywords which act as prefixes +hi def link oraKeywordObs Todo "obsolete keywords +hi def link oraKeywordUnd PreProc "undocumented keywords +hi def link oraKeywordUndObs oraKeywordObs "undocumented obsolete keywords +hi def link oraValue Identifier "values, like true or false +hi def link oraModifier oraValue "modifies values +hi def link oraString String "strings + +hi def link oraSpecial Special "special characters +hi def link oraError Error "errors +hi def link oraParenError oraError "errors caused by mismatching parantheses + +hi def link oraComment Comment "comments diff --git a/runtime/syntax/pamconf.vim b/runtime/syntax/pamconf.vim index e3c8ba87fd..10d667bdf5 100644 --- a/runtime/syntax/pamconf.vim +++ b/runtime/syntax/pamconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: pam(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Language: pam(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-08-03 if exists("b:current_syntax") diff --git a/runtime/syntax/papp.vim b/runtime/syntax/papp.vim index d86dce603f..5b65f05cf4 100644 --- a/runtime/syntax/papp.vim +++ b/runtime/syntax/papp.vim @@ -14,41 +14,24 @@ " pod is, btw, allowed everywhere, which is actually wrong :( -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " source is basically xml, with included html (this is common) and perl bits -if version < 600 - so <sfile>:p:h/xml.vim -else - runtime! syntax/xml.vim -endif +runtime! syntax/xml.vim unlet b:current_syntax if exists("papp_include_html") - if version < 600 - syn include @PAppHtml <sfile>:p:h/html.vim - else - syn include @PAppHtml syntax/html.vim - endif + syn include @PAppHtml syntax/html.vim unlet b:current_syntax syntax spell default " added by Bram endif -if version < 600 - syn include @PAppPerl <sfile>:p:h/perl.vim -else - syn include @PAppPerl syntax/perl.vim -endif +syn include @PAppPerl syntax/perl.vim -if v:version >= 600 - syn cluster xmlFoldCluster add=papp_perl,papp_xperl,papp_phtml,papp_pxml,papp_perlPOD -endif +syn cluster xmlFoldCluster add=papp_perl,papp_xperl,papp_phtml,papp_pxml,papp_perlPOD " preprocessor commands syn region papp_prep matchgroup=papp_prep start="^#\s*\(if\|elsif\)" end="$" keepend contains=@perlExpr contained diff --git a/runtime/syntax/pascal.vim b/runtime/syntax/pascal.vim index d2b6060acc..2a58ee43f6 100644 --- a/runtime/syntax/pascal.vim +++ b/runtime/syntax/pascal.vim @@ -12,11 +12,8 @@ " Austin Ziegler <austin@halostatue.ca>, " Markus Koenig <markus@stber-koenig.de> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -320,52 +317,42 @@ if !exists("pascal_traditional") endif " 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_pascal_syn_inits") - if version < 508 - let did_pascal_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link pascalAcces pascalStatement +hi def link pascalBoolean Boolean +hi def link pascalComment Comment +hi def link pascalConditional Conditional +hi def link pascalConstant Constant +hi def link pascalDelimiter Identifier +hi def link pascalDirective pascalStatement +hi def link pascalException Exception +hi def link pascalFloat Float +hi def link pascalFunction Function +hi def link pascalLabel Label +hi def link pascalMatrixDelimiter Identifier +hi def link pascalModifier Type +hi def link pascalNumber Number +hi def link pascalOperator Operator +hi def link pascalPredefined pascalStatement +hi def link pascalPreProc PreProc +hi def link pascalRepeat Repeat +hi def link pascalSpaceError Error +hi def link pascalStatement Statement +hi def link pascalString String +hi def link pascalStringEscape Special +hi def link pascalStringEscapeGPC Special +hi def link pascalStringError Error +hi def link pascalStruct pascalStatement +hi def link pascalSymbolOperator pascalOperator +hi def link pascalTodo Todo +hi def link pascalType Type +hi def link pascalUnclassified pascalStatement +" hi def link pascalAsm Assembler +hi def link pascalError Error +hi def link pascalAsmKey pascalStatement +hi def link pascalShowTab Error - HiLink pascalAcces pascalStatement - HiLink pascalBoolean Boolean - HiLink pascalComment Comment - HiLink pascalConditional Conditional - HiLink pascalConstant Constant - HiLink pascalDelimiter Identifier - HiLink pascalDirective pascalStatement - HiLink pascalException Exception - HiLink pascalFloat Float - HiLink pascalFunction Function - HiLink pascalLabel Label - HiLink pascalMatrixDelimiter Identifier - HiLink pascalModifier Type - HiLink pascalNumber Number - HiLink pascalOperator Operator - HiLink pascalPredefined pascalStatement - HiLink pascalPreProc PreProc - HiLink pascalRepeat Repeat - HiLink pascalSpaceError Error - HiLink pascalStatement Statement - HiLink pascalString String - HiLink pascalStringEscape Special - HiLink pascalStringEscapeGPC Special - HiLink pascalStringError Error - HiLink pascalStruct pascalStatement - HiLink pascalSymbolOperator pascalOperator - HiLink pascalTodo Todo - HiLink pascalType Type - HiLink pascalUnclassified pascalStatement - " HiLink pascalAsm Assembler - HiLink pascalError Error - HiLink pascalAsmKey pascalStatement - HiLink pascalShowTab Error - - delcommand HiLink -endif let b:current_syntax = "pascal" diff --git a/runtime/syntax/passwd.vim b/runtime/syntax/passwd.vim index cdaed58cc0..ad90202b06 100644 --- a/runtime/syntax/passwd.vim +++ b/runtime/syntax/passwd.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: passwd(5) password file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-10-03 +" Language: passwd(5) password file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-10-03 if exists("b:current_syntax") finish diff --git a/runtime/syntax/pcap.vim b/runtime/syntax/pcap.vim index 17d0d42c0b..e0eed633c1 100644 --- a/runtime/syntax/pcap.vim +++ b/runtime/syntax/pcap.vim @@ -4,20 +4,13 @@ " Modified by Bram " Last Change: 2003 May 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif "define keywords -if version < 600 - set isk=@,46-57,_,-,#,=,192-255 -else - setlocal isk=@,46-57,_,-,#,=,192-255 -endif +setlocal isk=@,46-57,_,-,#,=,192-255 "first all the bad guys syn match pcapBad '^.\+$' "define any line as bad @@ -43,22 +36,12 @@ syn sync minlines=50 " 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_pcap_syntax_inits") - if version < 508 - let did_pcap_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink pcapBad WarningMsg - HiLink pcapBadword WarningMsg - HiLink pcapComment Comment +hi def link pcapBad WarningMsg +hi def link pcapBadword WarningMsg +hi def link pcapComment Comment - delcommand HiLink -endif let b:current_syntax = "pcap" diff --git a/runtime/syntax/pccts.vim b/runtime/syntax/pccts.vim index 8341f5bd43..780035798b 100644 --- a/runtime/syntax/pccts.vim +++ b/runtime/syntax/pccts.vim @@ -3,20 +3,13 @@ " Maintainer: Scott Bigham <dsb@killerbunnies.org> " Last Change: 10 Aug 1999 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C++ syntax to start with -if version < 600 - syn include @cppTopLevel <sfile>:p:h/cpp.vim -else - syn include @cppTopLevel syntax/cpp.vim -endif +syn include @cppTopLevel syntax/cpp.vim syn region pcctsAction matchgroup=pcctsDelim start="<<" end=">>?\=" contains=@cppTopLevel,pcctsRuleRef @@ -72,34 +65,24 @@ syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\s*\[[^] syn sync match pcctsSyncRule grouphere pcctsRule "\<[a-z][A-Za-z0-9_]*\>\(\s*\[[^]]*\]\)\=\s*>\s*\[[^]]*\]\s*:" " 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_pccts_syntax_inits") - if version < 508 - let did_pccts_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink pcctsDelim Special - HiLink pcctsTokenName Identifier - HiLink pcctsRuleName Statement - HiLink pcctsLabelHack Label - HiLink pcctsDirective PreProc - HiLink pcctsString String - HiLink pcctsComment Comment - HiLink pcctsClass Statement - HiLink pcctsClassName Identifier - HiLink pcctsException Statement - HiLink pcctsExceptionHandler Keyword - HiLink pcctsExceptionRuleRef pcctsDelim - HiLink pcctsExceptionID Identifier - HiLink pcctsRuleRef Identifier - HiLink pcctsSpecialChar SpecialChar - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link pcctsDelim Special +hi def link pcctsTokenName Identifier +hi def link pcctsRuleName Statement +hi def link pcctsLabelHack Label +hi def link pcctsDirective PreProc +hi def link pcctsString String +hi def link pcctsComment Comment +hi def link pcctsClass Statement +hi def link pcctsClassName Identifier +hi def link pcctsException Statement +hi def link pcctsExceptionHandler Keyword +hi def link pcctsExceptionRuleRef pcctsDelim +hi def link pcctsExceptionID Identifier +hi def link pcctsRuleRef Identifier +hi def link pcctsSpecialChar SpecialChar + let b:current_syntax = "pccts" diff --git a/runtime/syntax/perl.vim b/runtime/syntax/perl.vim index c09373a5cd..6ab6cd83a2 100644 --- a/runtime/syntax/perl.vim +++ b/runtime/syntax/perl.vim @@ -435,121 +435,119 @@ else syn sync minlines=0 endif -command -nargs=+ HiLink hi def link <args> " NOTE: If you're linking new highlight groups to perlString, please also put " them into b:match_skip in ftplugin/perl.vim. " The default highlighting. -HiLink perlSharpBang PreProc -HiLink perlControl PreProc -HiLink perlInclude Include -HiLink perlSpecial Special -HiLink perlString String -HiLink perlCharacter Character -HiLink perlNumber Number -HiLink perlFloat Float -HiLink perlType Type -HiLink perlIdentifier Identifier -HiLink perlLabel Label -HiLink perlStatement Statement -HiLink perlConditional Conditional -HiLink perlRepeat Repeat -HiLink perlOperator Operator -HiLink perlFunction Keyword -HiLink perlSubName Function -HiLink perlSubPrototype Type -HiLink perlSubAttributes PreProc -HiLink perlSubAttributesCont perlSubAttributes -HiLink perlComment Comment -HiLink perlTodo Todo +hi def link perlSharpBang PreProc +hi def link perlControl PreProc +hi def link perlInclude Include +hi def link perlSpecial Special +hi def link perlString String +hi def link perlCharacter Character +hi def link perlNumber Number +hi def link perlFloat Float +hi def link perlType Type +hi def link perlIdentifier Identifier +hi def link perlLabel Label +hi def link perlStatement Statement +hi def link perlConditional Conditional +hi def link perlRepeat Repeat +hi def link perlOperator Operator +hi def link perlFunction Keyword +hi def link perlSubName Function +hi def link perlSubPrototype Type +hi def link perlSubAttributes PreProc +hi def link perlSubAttributesCont perlSubAttributes +hi def link perlComment Comment +hi def link perlTodo Todo if exists("perl_string_as_statement") - HiLink perlStringStartEnd perlStatement + hi def link perlStringStartEnd perlStatement else - HiLink perlStringStartEnd perlString + hi def link perlStringStartEnd perlString endif -HiLink perlVStringV perlStringStartEnd -HiLink perlList perlStatement -HiLink perlMisc perlStatement -HiLink perlVarPlain perlIdentifier -HiLink perlVarPlain2 perlIdentifier -HiLink perlArrow perlIdentifier -HiLink perlFiledescRead perlIdentifier -HiLink perlFiledescStatement perlIdentifier -HiLink perlVarSimpleMember perlIdentifier -HiLink perlVarSimpleMemberName perlString -HiLink perlVarNotInMatches perlIdentifier -HiLink perlVarSlash perlIdentifier -HiLink perlQQ perlString -HiLink perlHereDoc perlString -HiLink perlStringUnexpanded perlString -HiLink perlSubstitutionSQ perlString -HiLink perlSubstitutionGQQ perlString -HiLink perlTranslationGQ perlString -HiLink perlMatch perlString -HiLink perlMatchStartEnd perlStatement -HiLink perlFormatName perlIdentifier -HiLink perlFormatField perlString -HiLink perlPackageDecl perlType -HiLink perlStorageClass perlType -HiLink perlPackageRef perlType -HiLink perlStatementPackage perlStatement -HiLink perlStatementStorage perlStatement -HiLink perlStatementControl perlStatement -HiLink perlStatementScalar perlStatement -HiLink perlStatementRegexp perlStatement -HiLink perlStatementNumeric perlStatement -HiLink perlStatementList perlStatement -HiLink perlStatementHash perlStatement -HiLink perlStatementIOfunc perlStatement -HiLink perlStatementFiledesc perlStatement -HiLink perlStatementVector perlStatement -HiLink perlStatementFiles perlStatement -HiLink perlStatementFlow perlStatement -HiLink perlStatementInclude perlStatement -HiLink perlStatementProc perlStatement -HiLink perlStatementSocket perlStatement -HiLink perlStatementIPC perlStatement -HiLink perlStatementNetwork perlStatement -HiLink perlStatementPword perlStatement -HiLink perlStatementTime perlStatement -HiLink perlStatementMisc perlStatement -HiLink perlStatementIndirObj perlStatement -HiLink perlFunctionName perlIdentifier -HiLink perlMethod perlIdentifier -HiLink perlFunctionPRef perlType -HiLink perlPOD perlComment -HiLink perlShellCommand perlString -HiLink perlSpecialAscii perlSpecial -HiLink perlSpecialDollar perlSpecial -HiLink perlSpecialString perlSpecial -HiLink perlSpecialStringU perlSpecial -HiLink perlSpecialMatch perlSpecial -HiLink perlDATA perlComment +hi def link perlVStringV perlStringStartEnd +hi def link perlList perlStatement +hi def link perlMisc perlStatement +hi def link perlVarPlain perlIdentifier +hi def link perlVarPlain2 perlIdentifier +hi def link perlArrow perlIdentifier +hi def link perlFiledescRead perlIdentifier +hi def link perlFiledescStatement perlIdentifier +hi def link perlVarSimpleMember perlIdentifier +hi def link perlVarSimpleMemberName perlString +hi def link perlVarNotInMatches perlIdentifier +hi def link perlVarSlash perlIdentifier +hi def link perlQQ perlString +hi def link perlHereDoc perlString +hi def link perlStringUnexpanded perlString +hi def link perlSubstitutionSQ perlString +hi def link perlSubstitutionGQQ perlString +hi def link perlTranslationGQ perlString +hi def link perlMatch perlString +hi def link perlMatchStartEnd perlStatement +hi def link perlFormatName perlIdentifier +hi def link perlFormatField perlString +hi def link perlPackageDecl perlType +hi def link perlStorageClass perlType +hi def link perlPackageRef perlType +hi def link perlStatementPackage perlStatement +hi def link perlStatementStorage perlStatement +hi def link perlStatementControl perlStatement +hi def link perlStatementScalar perlStatement +hi def link perlStatementRegexp perlStatement +hi def link perlStatementNumeric perlStatement +hi def link perlStatementList perlStatement +hi def link perlStatementHash perlStatement +hi def link perlStatementIOfunc perlStatement +hi def link perlStatementFiledesc perlStatement +hi def link perlStatementVector perlStatement +hi def link perlStatementFiles perlStatement +hi def link perlStatementFlow perlStatement +hi def link perlStatementInclude perlStatement +hi def link perlStatementProc perlStatement +hi def link perlStatementSocket perlStatement +hi def link perlStatementIPC perlStatement +hi def link perlStatementNetwork perlStatement +hi def link perlStatementPword perlStatement +hi def link perlStatementTime perlStatement +hi def link perlStatementMisc perlStatement +hi def link perlStatementIndirObj perlStatement +hi def link perlFunctionName perlIdentifier +hi def link perlMethod perlIdentifier +hi def link perlFunctionPRef perlType +hi def link perlPOD perlComment +hi def link perlShellCommand perlString +hi def link perlSpecialAscii perlSpecial +hi def link perlSpecialDollar perlSpecial +hi def link perlSpecialString perlSpecial +hi def link perlSpecialStringU perlSpecial +hi def link perlSpecialMatch perlSpecial +hi def link perlDATA perlComment " NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part), " I had to remove the transparent property from the following regions " in order to get them to highlight correctly. Feel free to remove " these and reinstate the transparent property if you know how. -HiLink perlParensSQ perlString -HiLink perlBracketsSQ perlString -HiLink perlBracesSQ perlString -HiLink perlAnglesSQ perlString +hi def link perlParensSQ perlString +hi def link perlBracketsSQ perlString +hi def link perlBracesSQ perlString +hi def link perlAnglesSQ perlString -HiLink perlParensDQ perlString -HiLink perlBracketsDQ perlString -HiLink perlBracesDQ perlString -HiLink perlAnglesDQ perlString +hi def link perlParensDQ perlString +hi def link perlBracketsDQ perlString +hi def link perlBracesDQ perlString +hi def link perlAnglesDQ perlString -HiLink perlSpecialStringU2 perlString +hi def link perlSpecialStringU2 perlString " Possible errors -HiLink perlNotEmptyLine Error -HiLink perlElseIfError Error -HiLink perlSubPrototypeError Error -HiLink perlSubError Error +hi def link perlNotEmptyLine Error +hi def link perlElseIfError Error +hi def link perlSubPrototypeError Error +hi def link perlSubError Error -delcommand HiLink " Syncing to speed up processing " diff --git a/runtime/syntax/perl6.vim b/runtime/syntax/perl6.vim index 3d82ced89f..3bcd9ff0e9 100644 --- a/runtime/syntax/perl6.vim +++ b/runtime/syntax/perl6.vim @@ -61,11 +61,8 @@ " unlet perl6_extended_q " unlet perl6_extended_all -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo @@ -2063,176 +2060,166 @@ syn region p6PodFormatFrench \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma " 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_perl6_syntax_inits") - if version < 508 - let did_perl6_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link p6EscOctOld p6Error +hi def link p6PackageTwigil p6Twigil +hi def link p6StringAngle p6String +hi def link p6StringFrench p6String +hi def link p6StringAngles p6String +hi def link p6StringSQ p6String +hi def link p6StringDQ p6String +hi def link p6StringQ p6String +hi def link p6RxStringSQ p6String +hi def link p6RxStringDQ p6String +hi def link p6Substitution p6String +hi def link p6Transliteration p6String +hi def link p6StringAuto p6String +hi def link p6StringP5Auto p6String +hi def link p6Key p6String +hi def link p6Match p6String +hi def link p6RegexBlock p6String +hi def link p6RxP5CharClass p6String +hi def link p6RxP5QuoteMeta p6String +hi def link p6RxCharClass p6String +hi def link p6RxQuoteWords p6String +hi def link p6ReduceOp p6Operator +hi def link p6ReverseCrossOp p6Operator +hi def link p6HyperOp p6Operator +hi def link p6QuoteQ p6Operator +hi def link p6RxRange p6StringSpecial +hi def link p6RxAnchor p6StringSpecial +hi def link p6RxP5Anchor p6StringSpecial +hi def link p6CodePoint p6StringSpecial +hi def link p6RxMeta p6StringSpecial +hi def link p6RxP5Range p6StringSpecial +hi def link p6RxP5CPId p6StringSpecial +hi def link p6RxP5Posix p6StringSpecial +hi def link p6RxP5Mod p6StringSpecial +hi def link p6RxP5HexSeq p6StringSpecial +hi def link p6RxP5OctSeq p6StringSpecial +hi def link p6RxP5WriteRefId p6StringSpecial +hi def link p6HexSequence p6StringSpecial +hi def link p6OctSequence p6StringSpecial +hi def link p6RxP5Named p6StringSpecial +hi def link p6RxP5PropId p6StringSpecial +hi def link p6RxP5Quantifier p6StringSpecial +hi def link p6RxP5CountId p6StringSpecial +hi def link p6RxP5Verb p6StringSpecial +hi def link p6Escape p6StringSpecial2 +hi def link p6EscNull p6StringSpecial2 +hi def link p6EscHash p6StringSpecial2 +hi def link p6EscQQ p6StringSpecial2 +hi def link p6EscQuote p6StringSpecial2 +hi def link p6EscDoubleQuote p6StringSpecial2 +hi def link p6EscBackTick p6StringSpecial2 +hi def link p6EscForwardSlash p6StringSpecial2 +hi def link p6EscVerticalBar p6StringSpecial2 +hi def link p6EscExclamation p6StringSpecial2 +hi def link p6EscDollar p6StringSpecial2 +hi def link p6EscOpenCurly p6StringSpecial2 +hi def link p6EscCloseCurly p6StringSpecial2 +hi def link p6EscCloseBracket p6StringSpecial2 +hi def link p6EscCloseAngle p6StringSpecial2 +hi def link p6EscCloseFrench p6StringSpecial2 +hi def link p6EscBackSlash p6StringSpecial2 +hi def link p6RxEscape p6StringSpecial2 +hi def link p6RxCapture p6StringSpecial2 +hi def link p6RxAlternation p6StringSpecial2 +hi def link p6RxP5 p6StringSpecial2 +hi def link p6RxP5ReadRef p6StringSpecial2 +hi def link p6RxP5Oct p6StringSpecial2 +hi def link p6RxP5Hex p6StringSpecial2 +hi def link p6RxP5EscMeta p6StringSpecial2 +hi def link p6RxP5Meta p6StringSpecial2 +hi def link p6RxP5Escape p6StringSpecial2 +hi def link p6RxP5CodePoint p6StringSpecial2 +hi def link p6RxP5WriteRef p6StringSpecial2 +hi def link p6RxP5Prop p6StringSpecial2 + +hi def link p6Property Tag +hi def link p6Attention Todo +hi def link p6Type Type +hi def link p6Error Error +hi def link p6BlockLabel Label +hi def link p6Float Float +hi def link p6Normal Normal +hi def link p6Package Normal +hi def link p6PackageScope Normal +hi def link p6Number Number +hi def link p6VersionNum Number +hi def link p6String String +hi def link p6Repeat Repeat +hi def link p6Keyword Keyword +hi def link p6Pragma Keyword +hi def link p6Module Keyword +hi def link p6DeclareRoutine Keyword +hi def link p6VarStorage Special +hi def link p6FlowControl Special +hi def link p6NumberBase Special +hi def link p6Twigil Special +hi def link p6StringSpecial2 Special +hi def link p6VersionDot Special +hi def link p6Comment Comment +hi def link p6Include Include +hi def link p6Shebang PreProc +hi def link p6ClosureTrait PreProc +hi def link p6Routine Function +hi def link p6Operator Operator +hi def link p6Version Operator +hi def link p6Context Operator +hi def link p6Quote Delimiter +hi def link p6TypeConstraint PreCondit +hi def link p6Exception Exception +hi def link p6Placeholder Identifier +hi def link p6Variable Identifier +hi def link p6VarSlash Identifier +hi def link p6VarNum Identifier +hi def link p6VarExclam Identifier +hi def link p6VarMatch Identifier +hi def link p6VarName Identifier +hi def link p6MatchVar Identifier +hi def link p6RxP5ReadRefId Identifier +hi def link p6RxP5ModDef Identifier +hi def link p6RxP5ModName Identifier +hi def link p6Conditional Conditional +hi def link p6StringSpecial SpecialChar + +hi def link p6PodAbbr p6Pod +hi def link p6PodAbbrEOF p6Pod +hi def link p6PodAbbrNoCode p6Pod +hi def link p6PodAbbrCode p6PodCode +hi def link p6PodPara p6Pod +hi def link p6PodParaEOF p6Pod +hi def link p6PodParaNoCode p6Pod +hi def link p6PodParaCode p6PodCode +hi def link p6PodDelim p6Pod +hi def link p6PodDelimEOF p6Pod +hi def link p6PodDelimNoCode p6Pod +hi def link p6PodDelimCode p6PodCode +hi def link p6PodImplicitCode p6PodCode +hi def link p6PodExtraConfig p6PodPrefix +hi def link p6PodVerticalBar p6PodFormatCode +hi def link p6PodColon p6PodFormatCode +hi def link p6PodSemicolon p6PodFormatCode +hi def link p6PodComma p6PodFormatCode +hi def link p6PodFormatOne p6PodFormat +hi def link p6PodFormatTwo p6PodFormat +hi def link p6PodFormatThree p6PodFormat +hi def link p6PodFormatFrench p6PodFormat + +hi def link p6PodType Type +hi def link p6PodConfigOption String +hi def link p6PodCode PreProc +hi def link p6Pod Comment +hi def link p6PodComment Comment +hi def link p6PodAutoQuote Operator +hi def link p6PodConfigOperator Operator +hi def link p6PodPrefix Statement +hi def link p6PodName Identifier +hi def link p6PodFormatCode SpecialChar +hi def link p6PodFormat SpecialComment - HiLink p6EscOctOld p6Error - HiLink p6PackageTwigil p6Twigil - HiLink p6StringAngle p6String - HiLink p6StringFrench p6String - HiLink p6StringAngles p6String - HiLink p6StringSQ p6String - HiLink p6StringDQ p6String - HiLink p6StringQ p6String - HiLink p6RxStringSQ p6String - HiLink p6RxStringDQ p6String - HiLink p6Substitution p6String - HiLink p6Transliteration p6String - HiLink p6StringAuto p6String - HiLink p6StringP5Auto p6String - HiLink p6Key p6String - HiLink p6Match p6String - HiLink p6RegexBlock p6String - HiLink p6RxP5CharClass p6String - HiLink p6RxP5QuoteMeta p6String - HiLink p6RxCharClass p6String - HiLink p6RxQuoteWords p6String - HiLink p6ReduceOp p6Operator - HiLink p6ReverseCrossOp p6Operator - HiLink p6HyperOp p6Operator - HiLink p6QuoteQ p6Operator - HiLink p6RxRange p6StringSpecial - HiLink p6RxAnchor p6StringSpecial - HiLink p6RxP5Anchor p6StringSpecial - HiLink p6CodePoint p6StringSpecial - HiLink p6RxMeta p6StringSpecial - HiLink p6RxP5Range p6StringSpecial - HiLink p6RxP5CPId p6StringSpecial - HiLink p6RxP5Posix p6StringSpecial - HiLink p6RxP5Mod p6StringSpecial - HiLink p6RxP5HexSeq p6StringSpecial - HiLink p6RxP5OctSeq p6StringSpecial - HiLink p6RxP5WriteRefId p6StringSpecial - HiLink p6HexSequence p6StringSpecial - HiLink p6OctSequence p6StringSpecial - HiLink p6RxP5Named p6StringSpecial - HiLink p6RxP5PropId p6StringSpecial - HiLink p6RxP5Quantifier p6StringSpecial - HiLink p6RxP5CountId p6StringSpecial - HiLink p6RxP5Verb p6StringSpecial - HiLink p6Escape p6StringSpecial2 - HiLink p6EscNull p6StringSpecial2 - HiLink p6EscHash p6StringSpecial2 - HiLink p6EscQQ p6StringSpecial2 - HiLink p6EscQuote p6StringSpecial2 - HiLink p6EscDoubleQuote p6StringSpecial2 - HiLink p6EscBackTick p6StringSpecial2 - HiLink p6EscForwardSlash p6StringSpecial2 - HiLink p6EscVerticalBar p6StringSpecial2 - HiLink p6EscExclamation p6StringSpecial2 - HiLink p6EscDollar p6StringSpecial2 - HiLink p6EscOpenCurly p6StringSpecial2 - HiLink p6EscCloseCurly p6StringSpecial2 - HiLink p6EscCloseBracket p6StringSpecial2 - HiLink p6EscCloseAngle p6StringSpecial2 - HiLink p6EscCloseFrench p6StringSpecial2 - HiLink p6EscBackSlash p6StringSpecial2 - HiLink p6RxEscape p6StringSpecial2 - HiLink p6RxCapture p6StringSpecial2 - HiLink p6RxAlternation p6StringSpecial2 - HiLink p6RxP5 p6StringSpecial2 - HiLink p6RxP5ReadRef p6StringSpecial2 - HiLink p6RxP5Oct p6StringSpecial2 - HiLink p6RxP5Hex p6StringSpecial2 - HiLink p6RxP5EscMeta p6StringSpecial2 - HiLink p6RxP5Meta p6StringSpecial2 - HiLink p6RxP5Escape p6StringSpecial2 - HiLink p6RxP5CodePoint p6StringSpecial2 - HiLink p6RxP5WriteRef p6StringSpecial2 - HiLink p6RxP5Prop p6StringSpecial2 - - HiLink p6Property Tag - HiLink p6Attention Todo - HiLink p6Type Type - HiLink p6Error Error - HiLink p6BlockLabel Label - HiLink p6Float Float - HiLink p6Normal Normal - HiLink p6Package Normal - HiLink p6PackageScope Normal - HiLink p6Number Number - HiLink p6VersionNum Number - HiLink p6String String - HiLink p6Repeat Repeat - HiLink p6Keyword Keyword - HiLink p6Pragma Keyword - HiLink p6Module Keyword - HiLink p6DeclareRoutine Keyword - HiLink p6VarStorage Special - HiLink p6FlowControl Special - HiLink p6NumberBase Special - HiLink p6Twigil Special - HiLink p6StringSpecial2 Special - HiLink p6VersionDot Special - HiLink p6Comment Comment - HiLink p6Include Include - HiLink p6Shebang PreProc - HiLink p6ClosureTrait PreProc - HiLink p6Routine Function - HiLink p6Operator Operator - HiLink p6Version Operator - HiLink p6Context Operator - HiLink p6Quote Delimiter - HiLink p6TypeConstraint PreCondit - HiLink p6Exception Exception - HiLink p6Placeholder Identifier - HiLink p6Variable Identifier - HiLink p6VarSlash Identifier - HiLink p6VarNum Identifier - HiLink p6VarExclam Identifier - HiLink p6VarMatch Identifier - HiLink p6VarName Identifier - HiLink p6MatchVar Identifier - HiLink p6RxP5ReadRefId Identifier - HiLink p6RxP5ModDef Identifier - HiLink p6RxP5ModName Identifier - HiLink p6Conditional Conditional - HiLink p6StringSpecial SpecialChar - - HiLink p6PodAbbr p6Pod - HiLink p6PodAbbrEOF p6Pod - HiLink p6PodAbbrNoCode p6Pod - HiLink p6PodAbbrCode p6PodCode - HiLink p6PodPara p6Pod - HiLink p6PodParaEOF p6Pod - HiLink p6PodParaNoCode p6Pod - HiLink p6PodParaCode p6PodCode - HiLink p6PodDelim p6Pod - HiLink p6PodDelimEOF p6Pod - HiLink p6PodDelimNoCode p6Pod - HiLink p6PodDelimCode p6PodCode - HiLink p6PodImplicitCode p6PodCode - HiLink p6PodExtraConfig p6PodPrefix - HiLink p6PodVerticalBar p6PodFormatCode - HiLink p6PodColon p6PodFormatCode - HiLink p6PodSemicolon p6PodFormatCode - HiLink p6PodComma p6PodFormatCode - HiLink p6PodFormatOne p6PodFormat - HiLink p6PodFormatTwo p6PodFormat - HiLink p6PodFormatThree p6PodFormat - HiLink p6PodFormatFrench p6PodFormat - - HiLink p6PodType Type - HiLink p6PodConfigOption String - HiLink p6PodCode PreProc - HiLink p6Pod Comment - HiLink p6PodComment Comment - HiLink p6PodAutoQuote Operator - HiLink p6PodConfigOperator Operator - HiLink p6PodPrefix Statement - HiLink p6PodName Identifier - HiLink p6PodFormatCode SpecialChar - HiLink p6PodFormat SpecialComment - - delcommand HiLink -endif " Syncing to speed up processing "syn sync match p6SyncPod groupthere p6PodAbbrRegion "^=\K\k*\>" diff --git a/runtime/syntax/pf.vim b/runtime/syntax/pf.vim index 1a8f34bbba..81add10e7e 100644 --- a/runtime/syntax/pf.vim +++ b/runtime/syntax/pf.vim @@ -2,30 +2,22 @@ " Language: OpenBSD packet filter configuration (pf.conf) " Original Author: Camiel Dobbelaar <cd@sentia.nl> " Maintainer: Lauri Tirkkonen <lotheac@iki.fi> -" Last Change: 2013 Apr 02 +" Last Change: 2016 Jul 06 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif setlocal foldmethod=syntax +syn iskeyword @,48-57,_,-,+ syn sync fromstart syn cluster pfNotLS contains=pfTodo,pfVarAssign -syn keyword pfCmd altq anchor antispoof binat nat pass -syn keyword pfCmd queue rdr scrub table set -syn keyword pfService auth bgp domain finger ftp http https ident -syn keyword pfService imap irc isakmp kerberos mail nameserver nfs -syn keyword pfService nntp ntp pop3 portmap pptp rpcbind rsync smtp -syn keyword pfService snmp snmptrap socks ssh sunrpc syslog telnet -syn keyword pfService tftp www +syn keyword pfCmd anchor antispoof block include match pass queue +syn keyword pfCmd queue set table +syn match pfCmd /^\s*load\sanchor\>/ syn keyword pfTodo TODO XXX contained syn keyword pfWildAddr all any -syn match pfCmd /block\s/ syn match pfComment /#.*$/ contains=pfTodo syn match pfCont /\\$/ syn match pfErrClose /}/ @@ -34,43 +26,81 @@ syn match pfIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/ syn match pfIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/ syn match pfNetmask /\/\d\+/ syn match pfNum /[a-zA-Z0-9_:.]\@<!\d\+[a-zA-Z0-9_:.]\@!/ -syn match pfTable /<\s*[a-zA-Z][a-zA-Z0-9_]*\s*>/ +syn match pfTable /<\s*[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*\s*>/ syn match pfVar /$[a-zA-Z][a-zA-Z0-9_]*/ syn match pfVarAssign /^\s*[a-zA-Z][a-zA-Z0-9_]*\s*=/me=e-1 syn region pfFold1 start=/^#\{1}>/ end=/^#\{1,3}>/me=s-1 transparent fold syn region pfFold2 start=/^#\{2}>/ end=/^#\{2,3}>/me=s-1 transparent fold syn region pfFold3 start=/^#\{3}>/ end=/^#\{3}>/me=s-1 transparent fold syn region pfList start=/{/ end=/}/ transparent contains=ALLBUT,pfErrClose,@pfNotLS -syn region pfString start=/"/ end=/"/ transparent contains=ALLBUT,pfString,@pfNotLS -syn region pfString start=/'/ end=/'/ transparent contains=ALLBUT,pfString,@pfNotLS +syn region pfString start=/"/ skip=/\\"/ end=/"/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar +syn region pfString start=/'/ skip=/\\'/ end=/'/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar -" 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_c_syn_inits") - if version < 508 - let did_c_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +syn keyword pfService 802-11-iapp Microsoft-SQL-Monitor +syn keyword pfService Microsoft-SQL-Server NeXTStep NextStep +syn keyword pfService afpovertcp afs3-bos afs3-callback afs3-errors +syn keyword pfService afs3-fileserver afs3-kaserver afs3-prserver +syn keyword pfService afs3-rmtsys afs3-update afs3-vlserver +syn keyword pfService afs3-volser amt-redir-tcp amt-redir-tls +syn keyword pfService amt-soap-http amt-soap-https asf-rmcp at-echo +syn keyword pfService at-nbp at-rtmp at-zis auth authentication +syn keyword pfService bfd-control bfd-echo bftp bgp bgpd biff bootpc +syn keyword pfService bootps canna cddb cddbp chargen chat cmd +syn keyword pfService cmip-agent cmip-man comsat conference +syn keyword pfService conserver courier csnet-ns cso-ns cvspserver +syn keyword pfService daap datametrics daytime dhcpd-sync +syn keyword pfService dhcpv6-client dhcpv6-server discard domain +syn keyword pfService echo efs eklogin ekshell ekshell2 epmap eppc +syn keyword pfService exec finger ftp ftp-data git gopher hostname +syn keyword pfService hostnames hprop http https hunt hylafax iapp +syn keyword pfService icb ident imap imap2 imap3 imaps ingreslock +syn keyword pfService ipp iprop ipsec-msft ipsec-nat-t ipx irc +syn keyword pfService isakmp iscsi isisd iso-tsap kauth kdc kerberos +syn keyword pfService kerberos-adm kerberos-iv kerberos-sec +syn keyword pfService kerberos_master kf kip klogin kpasswd kpop +syn keyword pfService krb524 krb_prop krbupdate krcmd kreg kshell kx +syn keyword pfService l2tp ldap ldaps ldp link login mail mdns +syn keyword pfService mdnsresponder microsoft-ds ms-sql-m ms-sql-s +syn keyword pfService msa msp mtp mysql name nameserver netbios-dgm +syn keyword pfService netbios-ns netbios-ssn netnews netplan netrjs +syn keyword pfService netstat netwall newdate nextstep nfs nfsd +syn keyword pfService nicname nnsp nntp ntalk ntp null openwebnet +syn keyword pfService ospf6d ospfapi ospfd photuris pop2 pop3 pop3pw +syn keyword pfService pop3s poppassd portmap postgresql postoffice +syn keyword pfService pptp presence printer prospero prospero-np +syn keyword pfService puppet pwdgen qotd quote radacct radius +syn keyword pfService radius-acct rdp readnews remotefs resource rfb +syn keyword pfService rfe rfs rfs_server ripd ripng rje rkinit rlp +syn keyword pfService routed router rpc rpcbind rsync rtelnet rtsp +syn keyword pfService sa-msg-port sane-port sftp shell sieve silc +syn keyword pfService sink sip smtp smtps smux snmp snmp-trap +syn keyword pfService snmptrap snpp socks source spamd spamd-cfg +syn keyword pfService spamd-sync spooler spop3 ssdp ssh submission +syn keyword pfService sunrpc supdup supfiledbg supfilesrv support +syn keyword pfService svn svrloc swat syslog syslog-tls systat +syn keyword pfService tacacs tacas+ talk tap tcpmux telnet tempo +syn keyword pfService tftp time timed timeserver timserver tsap +syn keyword pfService ttylink ttytst ub-dns-control ulistserv untp +syn keyword pfService usenet users uucp uucp-path uucpd vnc vxlan +syn keyword pfService wais webster who whod whois www x400 x400-snd +syn keyword pfService xcept xdmcp xmpp-bosh xmpp-client xmpp-server +syn keyword pfService z3950 zabbix-agent zabbix-trapper zebra +syn keyword pfService zebrasrv - HiLink pfCmd Statement - HiLink pfComment Comment - HiLink pfCont Statement - HiLink pfErrClose Error - HiLink pfIPv4 Type - HiLink pfIPv6 Type - HiLink pfNetmask Constant - HiLink pfNum Constant - HiLink pfService Constant - HiLink pfTable Identifier - HiLink pfTodo Todo - HiLink pfVar Identifier - HiLink pfVarAssign Identifier - HiLink pfWildAddr Type - - delcommand HiLink -endif +hi def link pfCmd Statement +hi def link pfComment Comment +hi def link pfCont Statement +hi def link pfErrClose Error +hi def link pfIPv4 Type +hi def link pfIPv6 Type +hi def link pfNetmask Constant +hi def link pfNum Constant +hi def link pfService Constant +hi def link pfString String +hi def link pfTable Identifier +hi def link pfTodo Todo +hi def link pfVar Identifier +hi def link pfVarAssign Identifier +hi def link pfWildAddr Type let b:current_syntax = "pf" diff --git a/runtime/syntax/pfmain.vim b/runtime/syntax/pfmain.vim index a0904457a2..af58da70ef 100644 --- a/runtime/syntax/pfmain.vim +++ b/runtime/syntax/pfmain.vim @@ -1,23 +1,18 @@ " Vim syntax file " Language: Postfix main.cf configuration " Maintainer: KELEMEN Peter <Peter dot Kelemen at cern dot ch> -" Last Update: Hong Xu -" Last Change: 2011 May 14 +" Last Updates: Anton Shestakov, Hong Xu +" Last Change: 2015 Feb 10 " Version: 0.40 " URL: http://cern.ch/fuji/vim/syntax/pfmain.vim -" Comment: Based on Postfix 2.9 defaults. +" Comment: Based on Postfix 2.12/3.0 postconf.5.html. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,- -else - set iskeyword=@,48-57,_,- -endif +setlocal iskeyword=@,48-57,_,- syntax case match syntax sync minlines=1 @@ -41,6 +36,7 @@ syntax keyword pfmainConf address_verify_relayhost syntax keyword pfmainConf address_verify_sender syntax keyword pfmainConf address_verify_sender_dependent_default_transport_maps syntax keyword pfmainConf address_verify_sender_dependent_relayhost_maps +syntax keyword pfmainConf address_verify_sender_ttl syntax keyword pfmainConf address_verify_service_name syntax keyword pfmainConf address_verify_transport_maps syntax keyword pfmainConf address_verify_virtual_transport @@ -52,6 +48,7 @@ syntax keyword pfmainConf allow_min_user syntax keyword pfmainConf allow_percent_hack syntax keyword pfmainConf allow_untrusted_routing syntax keyword pfmainConf alternate_config_directories +syntax keyword pfmainConf always_add_missing_headers syntax keyword pfmainConf always_bcc syntax keyword pfmainConf anvil_rate_time_unit syntax keyword pfmainConf anvil_status_update_time @@ -61,6 +58,7 @@ syntax keyword pfmainConf application_event_drain_time syntax keyword pfmainConf authorized_flush_users syntax keyword pfmainConf authorized_mailq_users syntax keyword pfmainConf authorized_submit_users +syntax keyword pfmainConf authorized_verp_clients syntax keyword pfmainConf backwards_bounce_logfile_compatibility syntax keyword pfmainConf berkeley_db_create_buffer_size syntax keyword pfmainConf berkeley_db_read_buffer_size @@ -81,7 +79,9 @@ syntax keyword pfmainConf command_directory syntax keyword pfmainConf command_execution_directory syntax keyword pfmainConf command_expansion_filter syntax keyword pfmainConf command_time_limit +syntax keyword pfmainConf compatibility_level syntax keyword pfmainConf config_directory +syntax keyword pfmainConf confirm_delay_cleared syntax keyword pfmainConf connection_cache_protocol_timeout syntax keyword pfmainConf connection_cache_service_name syntax keyword pfmainConf connection_cache_status_update_time @@ -89,14 +89,17 @@ syntax keyword pfmainConf connection_cache_ttl_limit syntax keyword pfmainConf content_filter syntax keyword pfmainConf cyrus_sasl_config_path syntax keyword pfmainConf daemon_directory +syntax keyword pfmainConf daemon_table_open_error_is_fatal syntax keyword pfmainConf daemon_timeout syntax keyword pfmainConf data_directory syntax keyword pfmainConf debug_peer_level syntax keyword pfmainConf debug_peer_list +syntax keyword pfmainConf debugger_command syntax keyword pfmainConf default_database_type syntax keyword pfmainConf default_delivery_slot_cost syntax keyword pfmainConf default_delivery_slot_discount syntax keyword pfmainConf default_delivery_slot_loan +syntax keyword pfmainConf default_delivery_status_filter syntax keyword pfmainConf default_destination_concurrency_failed_cohort_limit syntax keyword pfmainConf default_destination_concurrency_limit syntax keyword pfmainConf default_destination_concurrency_negative_feedback @@ -137,6 +140,7 @@ syntax keyword pfmainConf duplicate_filter_limit syntax keyword pfmainConf empty_address_default_transport_maps_lookup_key syntax keyword pfmainConf empty_address_recipient syntax keyword pfmainConf empty_address_relayhost_maps_lookup_key +syntax keyword pfmainConf enable_errors_to syntax keyword pfmainConf enable_long_queue_ids syntax keyword pfmainConf enable_original_recipient syntax keyword pfmainConf error_notice_recipient @@ -144,6 +148,8 @@ syntax keyword pfmainConf error_service_name syntax keyword pfmainConf execution_directory_expansion_filter syntax keyword pfmainConf expand_owner_alias syntax keyword pfmainConf export_environment +syntax keyword pfmainConf extract_recipient_limit +syntax keyword pfmainConf fallback_relay syntax keyword pfmainConf fallback_transport syntax keyword pfmainConf fallback_transport_maps syntax keyword pfmainConf fast_flush_domains @@ -177,25 +183,33 @@ syntax keyword pfmainConf ipc_idle syntax keyword pfmainConf ipc_timeout syntax keyword pfmainConf ipc_ttl syntax keyword pfmainConf line_length_limit +syntax keyword pfmainConf lmdb_map_size syntax keyword pfmainConf lmtp_address_preference +syntax keyword pfmainConf lmtp_address_verify_target +syntax keyword pfmainConf lmtp_assume_final syntax keyword pfmainConf lmtp_bind_address syntax keyword pfmainConf lmtp_bind_address6 syntax keyword pfmainConf lmtp_body_checks +syntax keyword pfmainConf lmtp_cache_connection syntax keyword pfmainConf lmtp_cname_overrides_servername syntax keyword pfmainConf lmtp_connect_timeout syntax keyword pfmainConf lmtp_connection_cache_destinations syntax keyword pfmainConf lmtp_connection_cache_on_demand syntax keyword pfmainConf lmtp_connection_cache_time_limit +syntax keyword pfmainConf lmtp_connection_reuse_count_limit syntax keyword pfmainConf lmtp_connection_reuse_time_limit syntax keyword pfmainConf lmtp_data_done_timeout syntax keyword pfmainConf lmtp_data_init_timeout syntax keyword pfmainConf lmtp_data_xfer_timeout syntax keyword pfmainConf lmtp_defer_if_no_mx_address_found +syntax keyword pfmainConf lmtp_delivery_status_filter syntax keyword pfmainConf lmtp_destination_concurrency_limit syntax keyword pfmainConf lmtp_destination_recipient_limit syntax keyword pfmainConf lmtp_discard_lhlo_keyword_address_maps syntax keyword pfmainConf lmtp_discard_lhlo_keywords +syntax keyword pfmainConf lmtp_dns_reply_filter syntax keyword pfmainConf lmtp_dns_resolver_options +syntax keyword pfmainConf lmtp_dns_support_level syntax keyword pfmainConf lmtp_enforce_tls syntax keyword pfmainConf lmtp_generic_maps syntax keyword pfmainConf lmtp_header_checks @@ -230,9 +244,11 @@ syntax keyword pfmainConf lmtp_sasl_security_options syntax keyword pfmainConf lmtp_sasl_tls_security_options syntax keyword pfmainConf lmtp_sasl_tls_verified_security_options syntax keyword pfmainConf lmtp_sasl_type +syntax keyword pfmainConf lmtp_send_dummy_mail_auth syntax keyword pfmainConf lmtp_send_xforward_command syntax keyword pfmainConf lmtp_sender_dependent_authentication syntax keyword pfmainConf lmtp_skip_5xx_greeting +syntax keyword pfmainConf lmtp_skip_quit_response syntax keyword pfmainConf lmtp_starttls_timeout syntax keyword pfmainConf lmtp_tcp_port syntax keyword pfmainConf lmtp_tls_CAfile @@ -248,6 +264,7 @@ syntax keyword pfmainConf lmtp_tls_enforce_peername syntax keyword pfmainConf lmtp_tls_exclude_ciphers syntax keyword pfmainConf lmtp_tls_fingerprint_cert_match syntax keyword pfmainConf lmtp_tls_fingerprint_digest +syntax keyword pfmainConf lmtp_tls_force_insecure_host_tlsa_lookup syntax keyword pfmainConf lmtp_tls_key_file syntax keyword pfmainConf lmtp_tls_loglevel syntax keyword pfmainConf lmtp_tls_mandatory_ciphers @@ -262,10 +279,12 @@ syntax keyword pfmainConf lmtp_tls_secure_cert_match syntax keyword pfmainConf lmtp_tls_security_level syntax keyword pfmainConf lmtp_tls_session_cache_database syntax keyword pfmainConf lmtp_tls_session_cache_timeout +syntax keyword pfmainConf lmtp_tls_trust_anchor_file syntax keyword pfmainConf lmtp_tls_verify_cert_match syntax keyword pfmainConf lmtp_use_tls syntax keyword pfmainConf lmtp_xforward_timeout syntax keyword pfmainConf local_command_shell +syntax keyword pfmainConf local_delivery_status_filter syntax keyword pfmainConf local_destination_concurrency_limit syntax keyword pfmainConf local_destination_recipient_limit syntax keyword pfmainConf local_header_rewrite_clients @@ -287,17 +306,19 @@ syntax keyword pfmainConf mailq_path syntax keyword pfmainConf manpage_directory syntax keyword pfmainConf maps_rbl_domains syntax keyword pfmainConf maps_rbl_reject_code -syntax keyword pfmainConf master_service_disable syntax keyword pfmainConf masquerade_classes syntax keyword pfmainConf masquerade_domains syntax keyword pfmainConf masquerade_exceptions +syntax keyword pfmainConf master_service_disable syntax keyword pfmainConf max_idle syntax keyword pfmainConf max_use syntax keyword pfmainConf maximal_backoff_time syntax keyword pfmainConf maximal_queue_lifetime +syntax keyword pfmainConf message_drop_headers syntax keyword pfmainConf message_reject_characters syntax keyword pfmainConf message_size_limit syntax keyword pfmainConf message_strip_characters +syntax keyword pfmainConf meta_directory syntax keyword pfmainConf milter_command_timeout syntax keyword pfmainConf milter_connect_macros syntax keyword pfmainConf milter_connect_timeout @@ -335,10 +356,12 @@ syntax keyword pfmainConf newaliases_path syntax keyword pfmainConf non_fqdn_reject_code syntax keyword pfmainConf non_smtpd_milters syntax keyword pfmainConf notify_classes +syntax keyword pfmainConf nullmx_reject_code syntax keyword pfmainConf owner_request_special syntax keyword pfmainConf parent_domain_matches_subdomains syntax keyword pfmainConf permit_mx_backup_networks syntax keyword pfmainConf pickup_service_name +syntax keyword pfmainConf pipe_delivery_status_filter syntax keyword pfmainConf plaintext_reject_code syntax keyword pfmainConf postmulti_control_commands syntax keyword pfmainConf postmulti_start_commands @@ -362,7 +385,9 @@ syntax keyword pfmainConf postscreen_dnsbl_action syntax keyword pfmainConf postscreen_dnsbl_reply_map syntax keyword pfmainConf postscreen_dnsbl_sites syntax keyword pfmainConf postscreen_dnsbl_threshold +syntax keyword pfmainConf postscreen_dnsbl_timeout syntax keyword pfmainConf postscreen_dnsbl_ttl +syntax keyword pfmainConf postscreen_dnsbl_whitelist_threshold syntax keyword pfmainConf postscreen_enforce_tls syntax keyword pfmainConf postscreen_expansion_filter syntax keyword pfmainConf postscreen_forbidden_commands @@ -381,6 +406,8 @@ syntax keyword pfmainConf postscreen_post_queue_limit syntax keyword pfmainConf postscreen_pre_queue_limit syntax keyword pfmainConf postscreen_reject_footer syntax keyword pfmainConf postscreen_tls_security_level +syntax keyword pfmainConf postscreen_upstream_proxy_protocol +syntax keyword pfmainConf postscreen_upstream_proxy_timeout syntax keyword pfmainConf postscreen_use_tls syntax keyword pfmainConf postscreen_watchdog_timeout syntax keyword pfmainConf postscreen_whitelist_interfaces @@ -395,7 +422,9 @@ syntax keyword pfmainConf proxy_write_maps syntax keyword pfmainConf proxymap_service_name syntax keyword pfmainConf proxywrite_service_name syntax keyword pfmainConf qmgr_clog_warn_time +syntax keyword pfmainConf qmgr_daemon_timeout syntax keyword pfmainConf qmgr_fudge_factor +syntax keyword pfmainConf qmgr_ipc_timeout syntax keyword pfmainConf qmgr_message_active_limit syntax keyword pfmainConf qmgr_message_recipient_limit syntax keyword pfmainConf qmgr_message_recipient_minimum @@ -435,17 +464,21 @@ syntax keyword pfmainConf resolve_numeric_domain syntax keyword pfmainConf rewrite_service_name syntax keyword pfmainConf sample_directory syntax keyword pfmainConf send_cyrus_sasl_authzid +syntax keyword pfmainConf sender_based_routing syntax keyword pfmainConf sender_bcc_maps syntax keyword pfmainConf sender_canonical_classes syntax keyword pfmainConf sender_canonical_maps syntax keyword pfmainConf sender_dependent_default_transport_maps syntax keyword pfmainConf sender_dependent_relayhost_maps +syntax keyword pfmainConf sendmail_fix_line_endings syntax keyword pfmainConf sendmail_path syntax keyword pfmainConf service_throttle_time syntax keyword pfmainConf setgid_group +syntax keyword pfmainConf shlib_directory syntax keyword pfmainConf show_user_unknown_table_name syntax keyword pfmainConf showq_service_name syntax keyword pfmainConf smtp_address_preference +syntax keyword pfmainConf smtp_address_verify_target syntax keyword pfmainConf smtp_always_send_ehlo syntax keyword pfmainConf smtp_bind_address syntax keyword pfmainConf smtp_bind_address6 @@ -455,16 +488,20 @@ syntax keyword pfmainConf smtp_connect_timeout syntax keyword pfmainConf smtp_connection_cache_destinations syntax keyword pfmainConf smtp_connection_cache_on_demand syntax keyword pfmainConf smtp_connection_cache_time_limit +syntax keyword pfmainConf smtp_connection_reuse_count_limit syntax keyword pfmainConf smtp_connection_reuse_time_limit syntax keyword pfmainConf smtp_data_done_timeout syntax keyword pfmainConf smtp_data_init_timeout syntax keyword pfmainConf smtp_data_xfer_timeout syntax keyword pfmainConf smtp_defer_if_no_mx_address_found +syntax keyword pfmainConf smtp_delivery_status_filter syntax keyword pfmainConf smtp_destination_concurrency_limit syntax keyword pfmainConf smtp_destination_recipient_limit syntax keyword pfmainConf smtp_discard_ehlo_keyword_address_maps syntax keyword pfmainConf smtp_discard_ehlo_keywords +syntax keyword pfmainConf smtp_dns_reply_filter syntax keyword pfmainConf smtp_dns_resolver_options +syntax keyword pfmainConf smtp_dns_support_level syntax keyword pfmainConf smtp_enforce_tls syntax keyword pfmainConf smtp_fallback_relay syntax keyword pfmainConf smtp_generic_maps @@ -479,6 +516,7 @@ syntax keyword pfmainConf smtp_mx_address_limit syntax keyword pfmainConf smtp_mx_session_limit syntax keyword pfmainConf smtp_nested_header_checks syntax keyword pfmainConf smtp_never_send_ehlo +syntax keyword pfmainConf smtp_per_record_deadline syntax keyword pfmainConf smtp_pix_workaround_delay_time syntax keyword pfmainConf smtp_pix_workaround_maps syntax keyword pfmainConf smtp_pix_workaround_threshold_time @@ -500,8 +538,10 @@ syntax keyword pfmainConf smtp_sasl_security_options syntax keyword pfmainConf smtp_sasl_tls_security_options syntax keyword pfmainConf smtp_sasl_tls_verified_security_options syntax keyword pfmainConf smtp_sasl_type +syntax keyword pfmainConf smtp_send_dummy_mail_auth syntax keyword pfmainConf smtp_send_xforward_command syntax keyword pfmainConf smtp_sender_dependent_authentication +syntax keyword pfmainConf smtp_skip_4xx_greeting syntax keyword pfmainConf smtp_skip_5xx_greeting syntax keyword pfmainConf smtp_skip_quit_response syntax keyword pfmainConf smtp_starttls_timeout @@ -519,6 +559,7 @@ syntax keyword pfmainConf smtp_tls_enforce_peername syntax keyword pfmainConf smtp_tls_exclude_ciphers syntax keyword pfmainConf smtp_tls_fingerprint_cert_match syntax keyword pfmainConf smtp_tls_fingerprint_digest +syntax keyword pfmainConf smtp_tls_force_insecure_host_tlsa_lookup syntax keyword pfmainConf smtp_tls_key_file syntax keyword pfmainConf smtp_tls_loglevel syntax keyword pfmainConf smtp_tls_mandatory_ciphers @@ -533,7 +574,9 @@ syntax keyword pfmainConf smtp_tls_secure_cert_match syntax keyword pfmainConf smtp_tls_security_level syntax keyword pfmainConf smtp_tls_session_cache_database syntax keyword pfmainConf smtp_tls_session_cache_timeout +syntax keyword pfmainConf smtp_tls_trust_anchor_file syntax keyword pfmainConf smtp_tls_verify_cert_match +syntax keyword pfmainConf smtp_tls_wrappermode syntax keyword pfmainConf smtp_use_tls syntax keyword pfmainConf smtp_xforward_timeout syntax keyword pfmainConf smtpd_authorized_verp_clients @@ -554,6 +597,7 @@ syntax keyword pfmainConf smtpd_delay_open_until_valid_rcpt syntax keyword pfmainConf smtpd_delay_reject syntax keyword pfmainConf smtpd_discard_ehlo_keyword_address_maps syntax keyword pfmainConf smtpd_discard_ehlo_keywords +syntax keyword pfmainConf smtpd_dns_reply_filter syntax keyword pfmainConf smtpd_end_of_data_restrictions syntax keyword pfmainConf smtpd_enforce_tls syntax keyword pfmainConf smtpd_error_sleep_time @@ -565,14 +609,19 @@ syntax keyword pfmainConf smtpd_helo_required syntax keyword pfmainConf smtpd_helo_restrictions syntax keyword pfmainConf smtpd_history_flush_threshold syntax keyword pfmainConf smtpd_junk_command_limit +syntax keyword pfmainConf smtpd_log_access_permit_actions syntax keyword pfmainConf smtpd_milters syntax keyword pfmainConf smtpd_noop_commands syntax keyword pfmainConf smtpd_null_access_lookup_key syntax keyword pfmainConf smtpd_peername_lookup syntax keyword pfmainConf smtpd_per_record_deadline +syntax keyword pfmainConf smtpd_policy_service_default_action syntax keyword pfmainConf smtpd_policy_service_max_idle syntax keyword pfmainConf smtpd_policy_service_max_ttl +syntax keyword pfmainConf smtpd_policy_service_request_limit +syntax keyword pfmainConf smtpd_policy_service_retry_delay syntax keyword pfmainConf smtpd_policy_service_timeout +syntax keyword pfmainConf smtpd_policy_service_try_limit syntax keyword pfmainConf smtpd_proxy_ehlo syntax keyword pfmainConf smtpd_proxy_filter syntax keyword pfmainConf smtpd_proxy_options @@ -583,13 +632,16 @@ syntax keyword pfmainConf smtpd_recipient_restrictions syntax keyword pfmainConf smtpd_reject_footer syntax keyword pfmainConf smtpd_reject_unlisted_recipient syntax keyword pfmainConf smtpd_reject_unlisted_sender +syntax keyword pfmainConf smtpd_relay_restrictions syntax keyword pfmainConf smtpd_restriction_classes +syntax keyword pfmainConf smtpd_sasl_application_name syntax keyword pfmainConf smtpd_sasl_auth_enable syntax keyword pfmainConf smtpd_sasl_authenticated_header syntax keyword pfmainConf smtpd_sasl_exceptions_networks syntax keyword pfmainConf smtpd_sasl_local_domain syntax keyword pfmainConf smtpd_sasl_path syntax keyword pfmainConf smtpd_sasl_security_options +syntax keyword pfmainConf smtpd_sasl_service syntax keyword pfmainConf smtpd_sasl_tls_security_options syntax keyword pfmainConf smtpd_sasl_type syntax keyword pfmainConf smtpd_sender_login_maps @@ -628,21 +680,21 @@ syntax keyword pfmainConf smtpd_tls_security_level syntax keyword pfmainConf smtpd_tls_session_cache_database syntax keyword pfmainConf smtpd_tls_session_cache_timeout syntax keyword pfmainConf smtpd_tls_wrappermode +syntax keyword pfmainConf smtpd_upstream_proxy_protocol +syntax keyword pfmainConf smtpd_upstream_proxy_timeout syntax keyword pfmainConf smtpd_use_tls +syntax keyword pfmainConf smtputf8_autodetect_classes +syntax keyword pfmainConf smtputf8_enable syntax keyword pfmainConf soft_bounce syntax keyword pfmainConf stale_lock_time syntax keyword pfmainConf stress syntax keyword pfmainConf strict_7bit_headers syntax keyword pfmainConf strict_8bitmime syntax keyword pfmainConf strict_8bitmime_body -syntax keyword pfmainConf strict_mime_encoding_domain -syntax keyword pfmainConf strict_rfc821_envelopes -syntax keyword pfmainConf strict_7bit_headers -syntax keyword pfmainConf strict_8bitmime -syntax keyword pfmainConf strict_8bitmime_body syntax keyword pfmainConf strict_mailbox_ownership syntax keyword pfmainConf strict_mime_encoding_domain syntax keyword pfmainConf strict_rfc821_envelopes +syntax keyword pfmainConf strict_smtputf8 syntax keyword pfmainConf sun_mailtool_compatibility syntax keyword pfmainConf swap_bangpath syntax keyword pfmainConf syslog_facility @@ -650,11 +702,15 @@ syntax keyword pfmainConf syslog_name syntax keyword pfmainConf tcp_windowsize syntax keyword pfmainConf tls_append_default_CA syntax keyword pfmainConf tls_daemon_random_bytes +syntax keyword pfmainConf tls_dane_digest_agility +syntax keyword pfmainConf tls_dane_digests +syntax keyword pfmainConf tls_dane_trust_anchor_digest_enable syntax keyword pfmainConf tls_disable_workarounds syntax keyword pfmainConf tls_eecdh_strong_curve syntax keyword pfmainConf tls_eecdh_ultra_curve syntax keyword pfmainConf tls_export_cipherlist syntax keyword pfmainConf tls_high_cipherlist +syntax keyword pfmainConf tls_legacy_public_key_fingerprints syntax keyword pfmainConf tls_low_cipherlist syntax keyword pfmainConf tls_medium_cipherlist syntax keyword pfmainConf tls_null_cipherlist @@ -664,6 +720,10 @@ syntax keyword pfmainConf tls_random_exchange_name syntax keyword pfmainConf tls_random_prng_update_period syntax keyword pfmainConf tls_random_reseed_period syntax keyword pfmainConf tls_random_source +syntax keyword pfmainConf tls_session_ticket_cipher +syntax keyword pfmainConf tls_ssl_options +syntax keyword pfmainConf tls_wildcard_matches_multiple_labels +syntax keyword pfmainConf tlsmgr_service_name syntax keyword pfmainConf tlsproxy_enforce_tls syntax keyword pfmainConf tlsproxy_service_name syntax keyword pfmainConf tlsproxy_tls_CAfile @@ -711,6 +771,7 @@ syntax keyword pfmainConf transport_recipient_limit syntax keyword pfmainConf transport_recipient_refill_delay syntax keyword pfmainConf transport_recipient_refill_limit syntax keyword pfmainConf transport_retry_time +syntax keyword pfmainConf transport_time_limit syntax keyword pfmainConf trigger_timeout syntax keyword pfmainConf undisclosed_recipients_header syntax keyword pfmainConf unknown_address_reject_code @@ -731,10 +792,12 @@ syntax keyword pfmainConf unverified_sender_reject_code syntax keyword pfmainConf unverified_sender_reject_reason syntax keyword pfmainConf unverified_sender_tempfail_action syntax keyword pfmainConf verp_delimiter_filter +syntax keyword pfmainConf virtual_alias_address_length_limit syntax keyword pfmainConf virtual_alias_domains syntax keyword pfmainConf virtual_alias_expansion_limit syntax keyword pfmainConf virtual_alias_maps syntax keyword pfmainConf virtual_alias_recursion_limit +syntax keyword pfmainConf virtual_delivery_status_filter syntax keyword pfmainConf virtual_destination_concurrency_limit syntax keyword pfmainConf virtual_destination_recipient_limit syntax keyword pfmainConf virtual_gid_maps @@ -743,6 +806,7 @@ syntax keyword pfmainConf virtual_mailbox_domains syntax keyword pfmainConf virtual_mailbox_limit syntax keyword pfmainConf virtual_mailbox_lock syntax keyword pfmainConf virtual_mailbox_maps +syntax keyword pfmainConf virtual_maps syntax keyword pfmainConf virtual_minimum_uid syntax keyword pfmainConf virtual_transport syntax keyword pfmainConf virtual_uid_maps @@ -765,6 +829,7 @@ syntax match pfmainRef "$\<address_verify_relayhost\>" syntax match pfmainRef "$\<address_verify_sender\>" syntax match pfmainRef "$\<address_verify_sender_dependent_default_transport_maps\>" syntax match pfmainRef "$\<address_verify_sender_dependent_relayhost_maps\>" +syntax match pfmainRef "$\<address_verify_sender_ttl\>" syntax match pfmainRef "$\<address_verify_service_name\>" syntax match pfmainRef "$\<address_verify_transport_maps\>" syntax match pfmainRef "$\<address_verify_virtual_transport\>" @@ -776,6 +841,7 @@ syntax match pfmainRef "$\<allow_min_user\>" syntax match pfmainRef "$\<allow_percent_hack\>" syntax match pfmainRef "$\<allow_untrusted_routing\>" syntax match pfmainRef "$\<alternate_config_directories\>" +syntax match pfmainRef "$\<always_add_missing_headers\>" syntax match pfmainRef "$\<always_bcc\>" syntax match pfmainRef "$\<anvil_rate_time_unit\>" syntax match pfmainRef "$\<anvil_status_update_time\>" @@ -785,6 +851,7 @@ syntax match pfmainRef "$\<application_event_drain_time\>" syntax match pfmainRef "$\<authorized_flush_users\>" syntax match pfmainRef "$\<authorized_mailq_users\>" syntax match pfmainRef "$\<authorized_submit_users\>" +syntax match pfmainRef "$\<authorized_verp_clients\>" syntax match pfmainRef "$\<backwards_bounce_logfile_compatibility\>" syntax match pfmainRef "$\<berkeley_db_create_buffer_size\>" syntax match pfmainRef "$\<berkeley_db_read_buffer_size\>" @@ -805,7 +872,9 @@ syntax match pfmainRef "$\<command_directory\>" syntax match pfmainRef "$\<command_execution_directory\>" syntax match pfmainRef "$\<command_expansion_filter\>" syntax match pfmainRef "$\<command_time_limit\>" +syntax match pfmainRef "$\<compatibility_level\>" syntax match pfmainRef "$\<config_directory\>" +syntax match pfmainRef "$\<confirm_delay_cleared\>" syntax match pfmainRef "$\<connection_cache_protocol_timeout\>" syntax match pfmainRef "$\<connection_cache_service_name\>" syntax match pfmainRef "$\<connection_cache_status_update_time\>" @@ -813,14 +882,17 @@ syntax match pfmainRef "$\<connection_cache_ttl_limit\>" syntax match pfmainRef "$\<content_filter\>" syntax match pfmainRef "$\<cyrus_sasl_config_path\>" syntax match pfmainRef "$\<daemon_directory\>" +syntax match pfmainRef "$\<daemon_table_open_error_is_fatal\>" syntax match pfmainRef "$\<daemon_timeout\>" syntax match pfmainRef "$\<data_directory\>" syntax match pfmainRef "$\<debug_peer_level\>" syntax match pfmainRef "$\<debug_peer_list\>" +syntax match pfmainRef "$\<debugger_command\>" syntax match pfmainRef "$\<default_database_type\>" syntax match pfmainRef "$\<default_delivery_slot_cost\>" syntax match pfmainRef "$\<default_delivery_slot_discount\>" syntax match pfmainRef "$\<default_delivery_slot_loan\>" +syntax match pfmainRef "$\<default_delivery_status_filter\>" syntax match pfmainRef "$\<default_destination_concurrency_failed_cohort_limit\>" syntax match pfmainRef "$\<default_destination_concurrency_limit\>" syntax match pfmainRef "$\<default_destination_concurrency_negative_feedback\>" @@ -861,6 +933,7 @@ syntax match pfmainRef "$\<duplicate_filter_limit\>" syntax match pfmainRef "$\<empty_address_default_transport_maps_lookup_key\>" syntax match pfmainRef "$\<empty_address_recipient\>" syntax match pfmainRef "$\<empty_address_relayhost_maps_lookup_key\>" +syntax match pfmainRef "$\<enable_errors_to\>" syntax match pfmainRef "$\<enable_long_queue_ids\>" syntax match pfmainRef "$\<enable_original_recipient\>" syntax match pfmainRef "$\<error_notice_recipient\>" @@ -868,6 +941,8 @@ syntax match pfmainRef "$\<error_service_name\>" syntax match pfmainRef "$\<execution_directory_expansion_filter\>" syntax match pfmainRef "$\<expand_owner_alias\>" syntax match pfmainRef "$\<export_environment\>" +syntax match pfmainRef "$\<extract_recipient_limit\>" +syntax match pfmainRef "$\<fallback_relay\>" syntax match pfmainRef "$\<fallback_transport\>" syntax match pfmainRef "$\<fallback_transport_maps\>" syntax match pfmainRef "$\<fast_flush_domains\>" @@ -901,25 +976,33 @@ syntax match pfmainRef "$\<ipc_idle\>" syntax match pfmainRef "$\<ipc_timeout\>" syntax match pfmainRef "$\<ipc_ttl\>" syntax match pfmainRef "$\<line_length_limit\>" +syntax match pfmainRef "$\<lmdb_map_size\>" syntax match pfmainRef "$\<lmtp_address_preference\>" +syntax match pfmainRef "$\<lmtp_address_verify_target\>" +syntax match pfmainRef "$\<lmtp_assume_final\>" syntax match pfmainRef "$\<lmtp_bind_address\>" syntax match pfmainRef "$\<lmtp_bind_address6\>" syntax match pfmainRef "$\<lmtp_body_checks\>" +syntax match pfmainRef "$\<lmtp_cache_connection\>" syntax match pfmainRef "$\<lmtp_cname_overrides_servername\>" syntax match pfmainRef "$\<lmtp_connect_timeout\>" syntax match pfmainRef "$\<lmtp_connection_cache_destinations\>" syntax match pfmainRef "$\<lmtp_connection_cache_on_demand\>" syntax match pfmainRef "$\<lmtp_connection_cache_time_limit\>" +syntax match pfmainRef "$\<lmtp_connection_reuse_count_limit\>" syntax match pfmainRef "$\<lmtp_connection_reuse_time_limit\>" syntax match pfmainRef "$\<lmtp_data_done_timeout\>" syntax match pfmainRef "$\<lmtp_data_init_timeout\>" syntax match pfmainRef "$\<lmtp_data_xfer_timeout\>" syntax match pfmainRef "$\<lmtp_defer_if_no_mx_address_found\>" +syntax match pfmainRef "$\<lmtp_delivery_status_filter\>" syntax match pfmainRef "$\<lmtp_destination_concurrency_limit\>" syntax match pfmainRef "$\<lmtp_destination_recipient_limit\>" syntax match pfmainRef "$\<lmtp_discard_lhlo_keyword_address_maps\>" syntax match pfmainRef "$\<lmtp_discard_lhlo_keywords\>" +syntax match pfmainRef "$\<lmtp_dns_reply_filter\>" syntax match pfmainRef "$\<lmtp_dns_resolver_options\>" +syntax match pfmainRef "$\<lmtp_dns_support_level\>" syntax match pfmainRef "$\<lmtp_enforce_tls\>" syntax match pfmainRef "$\<lmtp_generic_maps\>" syntax match pfmainRef "$\<lmtp_header_checks\>" @@ -954,9 +1037,11 @@ syntax match pfmainRef "$\<lmtp_sasl_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_tls_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_tls_verified_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_type\>" +syntax match pfmainRef "$\<lmtp_send_dummy_mail_auth\>" syntax match pfmainRef "$\<lmtp_send_xforward_command\>" syntax match pfmainRef "$\<lmtp_sender_dependent_authentication\>" syntax match pfmainRef "$\<lmtp_skip_5xx_greeting\>" +syntax match pfmainRef "$\<lmtp_skip_quit_response\>" syntax match pfmainRef "$\<lmtp_starttls_timeout\>" syntax match pfmainRef "$\<lmtp_tcp_port\>" syntax match pfmainRef "$\<lmtp_tls_CAfile\>" @@ -972,6 +1057,7 @@ syntax match pfmainRef "$\<lmtp_tls_enforce_peername\>" syntax match pfmainRef "$\<lmtp_tls_exclude_ciphers\>" syntax match pfmainRef "$\<lmtp_tls_fingerprint_cert_match\>" syntax match pfmainRef "$\<lmtp_tls_fingerprint_digest\>" +syntax match pfmainRef "$\<lmtp_tls_force_insecure_host_tlsa_lookup\>" syntax match pfmainRef "$\<lmtp_tls_key_file\>" syntax match pfmainRef "$\<lmtp_tls_loglevel\>" syntax match pfmainRef "$\<lmtp_tls_mandatory_ciphers\>" @@ -982,11 +1068,16 @@ syntax match pfmainRef "$\<lmtp_tls_per_site\>" syntax match pfmainRef "$\<lmtp_tls_policy_maps\>" syntax match pfmainRef "$\<lmtp_tls_protocols\>" syntax match pfmainRef "$\<lmtp_tls_scert_verifydepth\>" +syntax match pfmainRef "$\<lmtp_tls_secure_cert_match\>" +syntax match pfmainRef "$\<lmtp_tls_security_level\>" +syntax match pfmainRef "$\<lmtp_tls_session_cache_database\>" syntax match pfmainRef "$\<lmtp_tls_session_cache_timeout\>" +syntax match pfmainRef "$\<lmtp_tls_trust_anchor_file\>" syntax match pfmainRef "$\<lmtp_tls_verify_cert_match\>" syntax match pfmainRef "$\<lmtp_use_tls\>" syntax match pfmainRef "$\<lmtp_xforward_timeout\>" syntax match pfmainRef "$\<local_command_shell\>" +syntax match pfmainRef "$\<local_delivery_status_filter\>" syntax match pfmainRef "$\<local_destination_concurrency_limit\>" syntax match pfmainRef "$\<local_destination_recipient_limit\>" syntax match pfmainRef "$\<local_header_rewrite_clients\>" @@ -1008,17 +1099,19 @@ syntax match pfmainRef "$\<mailq_path\>" syntax match pfmainRef "$\<manpage_directory\>" syntax match pfmainRef "$\<maps_rbl_domains\>" syntax match pfmainRef "$\<maps_rbl_reject_code\>" -syntax match pfmainRef "$\<master_service_disable\>" syntax match pfmainRef "$\<masquerade_classes\>" syntax match pfmainRef "$\<masquerade_domains\>" syntax match pfmainRef "$\<masquerade_exceptions\>" +syntax match pfmainRef "$\<master_service_disable\>" syntax match pfmainRef "$\<max_idle\>" syntax match pfmainRef "$\<max_use\>" syntax match pfmainRef "$\<maximal_backoff_time\>" syntax match pfmainRef "$\<maximal_queue_lifetime\>" +syntax match pfmainRef "$\<message_drop_headers\>" syntax match pfmainRef "$\<message_reject_characters\>" syntax match pfmainRef "$\<message_size_limit\>" syntax match pfmainRef "$\<message_strip_characters\>" +syntax match pfmainRef "$\<meta_directory\>" syntax match pfmainRef "$\<milter_command_timeout\>" syntax match pfmainRef "$\<milter_connect_macros\>" syntax match pfmainRef "$\<milter_connect_timeout\>" @@ -1056,10 +1149,12 @@ syntax match pfmainRef "$\<newaliases_path\>" syntax match pfmainRef "$\<non_fqdn_reject_code\>" syntax match pfmainRef "$\<non_smtpd_milters\>" syntax match pfmainRef "$\<notify_classes\>" +syntax match pfmainRef "$\<nullmx_reject_code\>" syntax match pfmainRef "$\<owner_request_special\>" syntax match pfmainRef "$\<parent_domain_matches_subdomains\>" syntax match pfmainRef "$\<permit_mx_backup_networks\>" syntax match pfmainRef "$\<pickup_service_name\>" +syntax match pfmainRef "$\<pipe_delivery_status_filter\>" syntax match pfmainRef "$\<plaintext_reject_code\>" syntax match pfmainRef "$\<postmulti_control_commands\>" syntax match pfmainRef "$\<postmulti_start_commands\>" @@ -1083,7 +1178,9 @@ syntax match pfmainRef "$\<postscreen_dnsbl_action\>" syntax match pfmainRef "$\<postscreen_dnsbl_reply_map\>" syntax match pfmainRef "$\<postscreen_dnsbl_sites\>" syntax match pfmainRef "$\<postscreen_dnsbl_threshold\>" +syntax match pfmainRef "$\<postscreen_dnsbl_timeout\>" syntax match pfmainRef "$\<postscreen_dnsbl_ttl\>" +syntax match pfmainRef "$\<postscreen_dnsbl_whitelist_threshold\>" syntax match pfmainRef "$\<postscreen_enforce_tls\>" syntax match pfmainRef "$\<postscreen_expansion_filter\>" syntax match pfmainRef "$\<postscreen_forbidden_commands\>" @@ -1102,9 +1199,8 @@ syntax match pfmainRef "$\<postscreen_post_queue_limit\>" syntax match pfmainRef "$\<postscreen_pre_queue_limit\>" syntax match pfmainRef "$\<postscreen_reject_footer\>" syntax match pfmainRef "$\<postscreen_tls_security_level\>" -syntax match pfmainRef "$\<lmtp_tls_secure_cert_match\>" -syntax match pfmainRef "$\<lmtp_tls_security_level\>" -syntax match pfmainRef "$\<lmtp_tls_session_cache_database\>" +syntax match pfmainRef "$\<postscreen_upstream_proxy_protocol\>" +syntax match pfmainRef "$\<postscreen_upstream_proxy_timeout\>" syntax match pfmainRef "$\<postscreen_use_tls\>" syntax match pfmainRef "$\<postscreen_watchdog_timeout\>" syntax match pfmainRef "$\<postscreen_whitelist_interfaces\>" @@ -1119,7 +1215,9 @@ syntax match pfmainRef "$\<proxy_write_maps\>" syntax match pfmainRef "$\<proxymap_service_name\>" syntax match pfmainRef "$\<proxywrite_service_name\>" syntax match pfmainRef "$\<qmgr_clog_warn_time\>" +syntax match pfmainRef "$\<qmgr_daemon_timeout\>" syntax match pfmainRef "$\<qmgr_fudge_factor\>" +syntax match pfmainRef "$\<qmgr_ipc_timeout\>" syntax match pfmainRef "$\<qmgr_message_active_limit\>" syntax match pfmainRef "$\<qmgr_message_recipient_limit\>" syntax match pfmainRef "$\<qmgr_message_recipient_minimum\>" @@ -1159,17 +1257,21 @@ syntax match pfmainRef "$\<resolve_numeric_domain\>" syntax match pfmainRef "$\<rewrite_service_name\>" syntax match pfmainRef "$\<sample_directory\>" syntax match pfmainRef "$\<send_cyrus_sasl_authzid\>" +syntax match pfmainRef "$\<sender_based_routing\>" syntax match pfmainRef "$\<sender_bcc_maps\>" syntax match pfmainRef "$\<sender_canonical_classes\>" syntax match pfmainRef "$\<sender_canonical_maps\>" syntax match pfmainRef "$\<sender_dependent_default_transport_maps\>" syntax match pfmainRef "$\<sender_dependent_relayhost_maps\>" +syntax match pfmainRef "$\<sendmail_fix_line_endings\>" syntax match pfmainRef "$\<sendmail_path\>" syntax match pfmainRef "$\<service_throttle_time\>" syntax match pfmainRef "$\<setgid_group\>" +syntax match pfmainRef "$\<shlib_directory\>" syntax match pfmainRef "$\<show_user_unknown_table_name\>" syntax match pfmainRef "$\<showq_service_name\>" syntax match pfmainRef "$\<smtp_address_preference\>" +syntax match pfmainRef "$\<smtp_address_verify_target\>" syntax match pfmainRef "$\<smtp_always_send_ehlo\>" syntax match pfmainRef "$\<smtp_bind_address\>" syntax match pfmainRef "$\<smtp_bind_address6\>" @@ -1179,16 +1281,20 @@ syntax match pfmainRef "$\<smtp_connect_timeout\>" syntax match pfmainRef "$\<smtp_connection_cache_destinations\>" syntax match pfmainRef "$\<smtp_connection_cache_on_demand\>" syntax match pfmainRef "$\<smtp_connection_cache_time_limit\>" +syntax match pfmainRef "$\<smtp_connection_reuse_count_limit\>" syntax match pfmainRef "$\<smtp_connection_reuse_time_limit\>" syntax match pfmainRef "$\<smtp_data_done_timeout\>" syntax match pfmainRef "$\<smtp_data_init_timeout\>" syntax match pfmainRef "$\<smtp_data_xfer_timeout\>" syntax match pfmainRef "$\<smtp_defer_if_no_mx_address_found\>" +syntax match pfmainRef "$\<smtp_delivery_status_filter\>" syntax match pfmainRef "$\<smtp_destination_concurrency_limit\>" syntax match pfmainRef "$\<smtp_destination_recipient_limit\>" syntax match pfmainRef "$\<smtp_discard_ehlo_keyword_address_maps\>" syntax match pfmainRef "$\<smtp_discard_ehlo_keywords\>" +syntax match pfmainRef "$\<smtp_dns_reply_filter\>" syntax match pfmainRef "$\<smtp_dns_resolver_options\>" +syntax match pfmainRef "$\<smtp_dns_support_level\>" syntax match pfmainRef "$\<smtp_enforce_tls\>" syntax match pfmainRef "$\<smtp_fallback_relay\>" syntax match pfmainRef "$\<smtp_generic_maps\>" @@ -1203,6 +1309,7 @@ syntax match pfmainRef "$\<smtp_mx_address_limit\>" syntax match pfmainRef "$\<smtp_mx_session_limit\>" syntax match pfmainRef "$\<smtp_nested_header_checks\>" syntax match pfmainRef "$\<smtp_never_send_ehlo\>" +syntax match pfmainRef "$\<smtp_per_record_deadline\>" syntax match pfmainRef "$\<smtp_pix_workaround_delay_time\>" syntax match pfmainRef "$\<smtp_pix_workaround_maps\>" syntax match pfmainRef "$\<smtp_pix_workaround_threshold_time\>" @@ -1224,8 +1331,10 @@ syntax match pfmainRef "$\<smtp_sasl_security_options\>" syntax match pfmainRef "$\<smtp_sasl_tls_security_options\>" syntax match pfmainRef "$\<smtp_sasl_tls_verified_security_options\>" syntax match pfmainRef "$\<smtp_sasl_type\>" +syntax match pfmainRef "$\<smtp_send_dummy_mail_auth\>" syntax match pfmainRef "$\<smtp_send_xforward_command\>" syntax match pfmainRef "$\<smtp_sender_dependent_authentication\>" +syntax match pfmainRef "$\<smtp_skip_4xx_greeting\>" syntax match pfmainRef "$\<smtp_skip_5xx_greeting\>" syntax match pfmainRef "$\<smtp_skip_quit_response\>" syntax match pfmainRef "$\<smtp_starttls_timeout\>" @@ -1243,6 +1352,7 @@ syntax match pfmainRef "$\<smtp_tls_enforce_peername\>" syntax match pfmainRef "$\<smtp_tls_exclude_ciphers\>" syntax match pfmainRef "$\<smtp_tls_fingerprint_cert_match\>" syntax match pfmainRef "$\<smtp_tls_fingerprint_digest\>" +syntax match pfmainRef "$\<smtp_tls_force_insecure_host_tlsa_lookup\>" syntax match pfmainRef "$\<smtp_tls_key_file\>" syntax match pfmainRef "$\<smtp_tls_loglevel\>" syntax match pfmainRef "$\<smtp_tls_mandatory_ciphers\>" @@ -1257,7 +1367,9 @@ syntax match pfmainRef "$\<smtp_tls_secure_cert_match\>" syntax match pfmainRef "$\<smtp_tls_security_level\>" syntax match pfmainRef "$\<smtp_tls_session_cache_database\>" syntax match pfmainRef "$\<smtp_tls_session_cache_timeout\>" +syntax match pfmainRef "$\<smtp_tls_trust_anchor_file\>" syntax match pfmainRef "$\<smtp_tls_verify_cert_match\>" +syntax match pfmainRef "$\<smtp_tls_wrappermode\>" syntax match pfmainRef "$\<smtp_use_tls\>" syntax match pfmainRef "$\<smtp_xforward_timeout\>" syntax match pfmainRef "$\<smtpd_authorized_verp_clients\>" @@ -1278,6 +1390,7 @@ syntax match pfmainRef "$\<smtpd_delay_open_until_valid_rcpt\>" syntax match pfmainRef "$\<smtpd_delay_reject\>" syntax match pfmainRef "$\<smtpd_discard_ehlo_keyword_address_maps\>" syntax match pfmainRef "$\<smtpd_discard_ehlo_keywords\>" +syntax match pfmainRef "$\<smtpd_dns_reply_filter\>" syntax match pfmainRef "$\<smtpd_end_of_data_restrictions\>" syntax match pfmainRef "$\<smtpd_enforce_tls\>" syntax match pfmainRef "$\<smtpd_error_sleep_time\>" @@ -1289,14 +1402,19 @@ syntax match pfmainRef "$\<smtpd_helo_required\>" syntax match pfmainRef "$\<smtpd_helo_restrictions\>" syntax match pfmainRef "$\<smtpd_history_flush_threshold\>" syntax match pfmainRef "$\<smtpd_junk_command_limit\>" +syntax match pfmainRef "$\<smtpd_log_access_permit_actions\>" syntax match pfmainRef "$\<smtpd_milters\>" syntax match pfmainRef "$\<smtpd_noop_commands\>" syntax match pfmainRef "$\<smtpd_null_access_lookup_key\>" syntax match pfmainRef "$\<smtpd_peername_lookup\>" syntax match pfmainRef "$\<smtpd_per_record_deadline\>" +syntax match pfmainRef "$\<smtpd_policy_service_default_action\>" syntax match pfmainRef "$\<smtpd_policy_service_max_idle\>" syntax match pfmainRef "$\<smtpd_policy_service_max_ttl\>" +syntax match pfmainRef "$\<smtpd_policy_service_request_limit\>" +syntax match pfmainRef "$\<smtpd_policy_service_retry_delay\>" syntax match pfmainRef "$\<smtpd_policy_service_timeout\>" +syntax match pfmainRef "$\<smtpd_policy_service_try_limit\>" syntax match pfmainRef "$\<smtpd_proxy_ehlo\>" syntax match pfmainRef "$\<smtpd_proxy_filter\>" syntax match pfmainRef "$\<smtpd_proxy_options\>" @@ -1307,13 +1425,16 @@ syntax match pfmainRef "$\<smtpd_recipient_restrictions\>" syntax match pfmainRef "$\<smtpd_reject_footer\>" syntax match pfmainRef "$\<smtpd_reject_unlisted_recipient\>" syntax match pfmainRef "$\<smtpd_reject_unlisted_sender\>" +syntax match pfmainRef "$\<smtpd_relay_restrictions\>" syntax match pfmainRef "$\<smtpd_restriction_classes\>" +syntax match pfmainRef "$\<smtpd_sasl_application_name\>" syntax match pfmainRef "$\<smtpd_sasl_auth_enable\>" syntax match pfmainRef "$\<smtpd_sasl_authenticated_header\>" syntax match pfmainRef "$\<smtpd_sasl_exceptions_networks\>" syntax match pfmainRef "$\<smtpd_sasl_local_domain\>" syntax match pfmainRef "$\<smtpd_sasl_path\>" syntax match pfmainRef "$\<smtpd_sasl_security_options\>" +syntax match pfmainRef "$\<smtpd_sasl_service\>" syntax match pfmainRef "$\<smtpd_sasl_tls_security_options\>" syntax match pfmainRef "$\<smtpd_sasl_type\>" syntax match pfmainRef "$\<smtpd_sender_login_maps\>" @@ -1352,21 +1473,21 @@ syntax match pfmainRef "$\<smtpd_tls_security_level\>" syntax match pfmainRef "$\<smtpd_tls_session_cache_database\>" syntax match pfmainRef "$\<smtpd_tls_session_cache_timeout\>" syntax match pfmainRef "$\<smtpd_tls_wrappermode\>" +syntax match pfmainRef "$\<smtpd_upstream_proxy_protocol\>" +syntax match pfmainRef "$\<smtpd_upstream_proxy_timeout\>" syntax match pfmainRef "$\<smtpd_use_tls\>" +syntax match pfmainRef "$\<smtputf8_autodetect_classes\>" +syntax match pfmainRef "$\<smtputf8_enable\>" syntax match pfmainRef "$\<soft_bounce\>" syntax match pfmainRef "$\<stale_lock_time\>" syntax match pfmainRef "$\<stress\>" syntax match pfmainRef "$\<strict_7bit_headers\>" syntax match pfmainRef "$\<strict_8bitmime\>" syntax match pfmainRef "$\<strict_8bitmime_body\>" -syntax match pfmainRef "$\<strict_mime_encoding_domain\>" -syntax match pfmainRef "$\<strict_rfc821_envelopes\>" -syntax match pfmainRef "$\<strict_7bit_headers\>" -syntax match pfmainRef "$\<strict_8bitmime\>" -syntax match pfmainRef "$\<strict_8bitmime_body\>" syntax match pfmainRef "$\<strict_mailbox_ownership\>" syntax match pfmainRef "$\<strict_mime_encoding_domain\>" syntax match pfmainRef "$\<strict_rfc821_envelopes\>" +syntax match pfmainRef "$\<strict_smtputf8\>" syntax match pfmainRef "$\<sun_mailtool_compatibility\>" syntax match pfmainRef "$\<swap_bangpath\>" syntax match pfmainRef "$\<syslog_facility\>" @@ -1374,11 +1495,15 @@ syntax match pfmainRef "$\<syslog_name\>" syntax match pfmainRef "$\<tcp_windowsize\>" syntax match pfmainRef "$\<tls_append_default_CA\>" syntax match pfmainRef "$\<tls_daemon_random_bytes\>" +syntax match pfmainRef "$\<tls_dane_digest_agility\>" +syntax match pfmainRef "$\<tls_dane_digests\>" +syntax match pfmainRef "$\<tls_dane_trust_anchor_digest_enable\>" syntax match pfmainRef "$\<tls_disable_workarounds\>" syntax match pfmainRef "$\<tls_eecdh_strong_curve\>" syntax match pfmainRef "$\<tls_eecdh_ultra_curve\>" syntax match pfmainRef "$\<tls_export_cipherlist\>" syntax match pfmainRef "$\<tls_high_cipherlist\>" +syntax match pfmainRef "$\<tls_legacy_public_key_fingerprints\>" syntax match pfmainRef "$\<tls_low_cipherlist\>" syntax match pfmainRef "$\<tls_medium_cipherlist\>" syntax match pfmainRef "$\<tls_null_cipherlist\>" @@ -1388,6 +1513,10 @@ syntax match pfmainRef "$\<tls_random_exchange_name\>" syntax match pfmainRef "$\<tls_random_prng_update_period\>" syntax match pfmainRef "$\<tls_random_reseed_period\>" syntax match pfmainRef "$\<tls_random_source\>" +syntax match pfmainRef "$\<tls_session_ticket_cipher\>" +syntax match pfmainRef "$\<tls_ssl_options\>" +syntax match pfmainRef "$\<tls_wildcard_matches_multiple_labels\>" +syntax match pfmainRef "$\<tlsmgr_service_name\>" syntax match pfmainRef "$\<tlsproxy_enforce_tls\>" syntax match pfmainRef "$\<tlsproxy_service_name\>" syntax match pfmainRef "$\<tlsproxy_tls_CAfile\>" @@ -1435,6 +1564,7 @@ syntax match pfmainRef "$\<transport_recipient_limit\>" syntax match pfmainRef "$\<transport_recipient_refill_delay\>" syntax match pfmainRef "$\<transport_recipient_refill_limit\>" syntax match pfmainRef "$\<transport_retry_time\>" +syntax match pfmainRef "$\<transport_time_limit\>" syntax match pfmainRef "$\<trigger_timeout\>" syntax match pfmainRef "$\<undisclosed_recipients_header\>" syntax match pfmainRef "$\<unknown_address_reject_code\>" @@ -1455,10 +1585,12 @@ syntax match pfmainRef "$\<unverified_sender_reject_code\>" syntax match pfmainRef "$\<unverified_sender_reject_reason\>" syntax match pfmainRef "$\<unverified_sender_tempfail_action\>" syntax match pfmainRef "$\<verp_delimiter_filter\>" +syntax match pfmainRef "$\<virtual_alias_address_length_limit\>" syntax match pfmainRef "$\<virtual_alias_domains\>" syntax match pfmainRef "$\<virtual_alias_expansion_limit\>" syntax match pfmainRef "$\<virtual_alias_maps\>" syntax match pfmainRef "$\<virtual_alias_recursion_limit\>" +syntax match pfmainRef "$\<virtual_delivery_status_filter\>" syntax match pfmainRef "$\<virtual_destination_concurrency_limit\>" syntax match pfmainRef "$\<virtual_destination_recipient_limit\>" syntax match pfmainRef "$\<virtual_gid_maps\>" @@ -1467,39 +1599,62 @@ syntax match pfmainRef "$\<virtual_mailbox_domains\>" syntax match pfmainRef "$\<virtual_mailbox_limit\>" syntax match pfmainRef "$\<virtual_mailbox_lock\>" syntax match pfmainRef "$\<virtual_mailbox_maps\>" +syntax match pfmainRef "$\<virtual_maps\>" syntax match pfmainRef "$\<virtual_minimum_uid\>" syntax match pfmainRef "$\<virtual_transport\>" syntax match pfmainRef "$\<virtual_uid_maps\>" +syntax keyword pfmainWord accept syntax keyword pfmainWord all +syntax keyword pfmainWord always syntax keyword pfmainWord check_address_map syntax keyword pfmainWord check_ccert_access +syntax keyword pfmainWord check_client_a_access syntax keyword pfmainWord check_client_access +syntax keyword pfmainWord check_client_mx_access +syntax keyword pfmainWord check_client_ns_access syntax keyword pfmainWord check_etrn_access +syntax keyword pfmainWord check_helo_a_access syntax keyword pfmainWord check_helo_access syntax keyword pfmainWord check_helo_mx_access syntax keyword pfmainWord check_helo_ns_access syntax keyword pfmainWord check_policy_service +syntax keyword pfmainWord check_recipient_a_access syntax keyword pfmainWord check_recipient_access syntax keyword pfmainWord check_recipient_maps syntax keyword pfmainWord check_recipient_mx_access syntax keyword pfmainWord check_recipient_ns_access syntax keyword pfmainWord check_relay_domains +syntax keyword pfmainWord check_reverse_client_hostname_a_access +syntax keyword pfmainWord check_reverse_client_hostname_access +syntax keyword pfmainWord check_reverse_client_hostname_mx_access +syntax keyword pfmainWord check_reverse_client_hostname_ns_access +syntax keyword pfmainWord check_sasl_access +syntax keyword pfmainWord check_sender_a_access syntax keyword pfmainWord check_sender_access syntax keyword pfmainWord check_sender_mx_access syntax keyword pfmainWord check_sender_ns_access syntax keyword pfmainWord class syntax keyword pfmainWord client_address syntax keyword pfmainWord client_port +syntax keyword pfmainWord dane +syntax keyword pfmainWord dane-only +syntax keyword pfmainWord defer syntax keyword pfmainWord defer_if_permit syntax keyword pfmainWord defer_if_reject +syntax keyword pfmainWord defer_unauth_destination +syntax keyword pfmainWord disabled syntax keyword pfmainWord dns +syntax keyword pfmainWord dnssec syntax keyword pfmainWord drop syntax keyword pfmainWord dunno +syntax keyword pfmainWord enabled +syntax keyword pfmainWord encrypt syntax keyword pfmainWord enforce syntax keyword pfmainWord envelope_recipient syntax keyword pfmainWord envelope_sender syntax keyword pfmainWord export +syntax keyword pfmainWord fingerprint syntax keyword pfmainWord header_recipient syntax keyword pfmainWord header_sender syntax keyword pfmainWord high @@ -1509,22 +1664,37 @@ syntax keyword pfmainWord ipv4 syntax keyword pfmainWord ipv6 syntax keyword pfmainWord localtime syntax keyword pfmainWord low +syntax keyword pfmainWord may +syntax keyword pfmainWord maybe syntax keyword pfmainWord medium syntax keyword pfmainWord native +syntax keyword pfmainWord never +syntax keyword pfmainWord no_address_mappings +syntax keyword pfmainWord no_header_body_checks +syntax keyword pfmainWord no_header_reply +syntax keyword pfmainWord no_milters +syntax keyword pfmainWord no_unknown_recipient_checks +syntax keyword pfmainWord none syntax keyword pfmainWord null +syntax keyword pfmainWord off +syntax keyword pfmainWord on syntax keyword pfmainWord permit syntax keyword pfmainWord permit_auth_destination +syntax keyword pfmainWord permit_dnswl_client syntax keyword pfmainWord permit_inet_interfaces syntax keyword pfmainWord permit_mx_backup syntax keyword pfmainWord permit_mynetworks syntax keyword pfmainWord permit_naked_ip_address +syntax keyword pfmainWord permit_rhswl_client syntax keyword pfmainWord permit_sasl_authenticated syntax keyword pfmainWord permit_tls_all_clientcerts syntax keyword pfmainWord permit_tls_clientcerts +syntax keyword pfmainWord quarantine syntax keyword pfmainWord reject syntax keyword pfmainWord reject_authenticated_sender_login_mismatch syntax keyword pfmainWord reject_invalid_helo_hostname syntax keyword pfmainWord reject_invalid_hostname +syntax keyword pfmainWord reject_known_sender_login_mismatch syntax keyword pfmainWord reject_maps_rbl syntax keyword pfmainWord reject_multi_recipient_bounce syntax keyword pfmainWord reject_non_fqdn_helo_hostname @@ -1537,10 +1707,12 @@ syntax keyword pfmainWord reject_rbl_client syntax keyword pfmainWord reject_rhsbl_client syntax keyword pfmainWord reject_rhsbl_helo syntax keyword pfmainWord reject_rhsbl_recipient +syntax keyword pfmainWord reject_rhsbl_reverse_client syntax keyword pfmainWord reject_rhsbl_sender syntax keyword pfmainWord reject_sender_login_mismatch syntax keyword pfmainWord reject_unauth_destination syntax keyword pfmainWord reject_unauth_pipelining +syntax keyword pfmainWord reject_unauthenticated_sender_login_mismatch syntax keyword pfmainWord reject_unknown_address syntax keyword pfmainWord reject_unknown_client syntax keyword pfmainWord reject_unknown_client_hostname @@ -1554,11 +1726,15 @@ syntax keyword pfmainWord reject_unlisted_recipient syntax keyword pfmainWord reject_unlisted_sender syntax keyword pfmainWord reject_unverified_recipient syntax keyword pfmainWord reject_unverified_sender +syntax keyword pfmainWord secure +syntax keyword pfmainWord server_name syntax keyword pfmainWord sleep syntax keyword pfmainWord smtpd_access_maps -syntax keyword pfmainWord server_name syntax keyword pfmainWord speed_adjust +syntax keyword pfmainWord strong syntax keyword pfmainWord subnet +syntax keyword pfmainWord tempfail +syntax keyword pfmainWord ultra syntax keyword pfmainWord warn_if_reject syntax keyword pfmainWord CRYPTOPRO_TLSEXT_BUG syntax keyword pfmainWord DONT_INSERT_EMPTY_FRAGMENTS @@ -1574,7 +1750,7 @@ syntax keyword pfmainWord TLS_BLOCK_PADDING_BUG syntax keyword pfmainWord TLS_D5_BUG syntax keyword pfmainWord TLS_ROLLBACK_BUG -syntax keyword pfmainDict btree cidr environ hash nis pcre proxy regexp sdbm sdbm static tcp unix +syntax keyword pfmainDict btree cidr environ hash nis pcre proxy regexp sdbm static tcp unix syntax keyword pfmainQueueDir incoming active deferred corrupt hold syntax keyword pfmainTransport smtp lmtp unix local relay uucp virtual syntax keyword pfmainLock fcntl flock dotlock @@ -1588,56 +1764,71 @@ syntax match pfmainVariable "\$\w\+" contains=pfmainRef syntax match pfmainSpecial "\<alias\>" syntax match pfmainSpecial "\<canonical\>" +syntax match pfmainSpecial "\<forward\>" +syntax match pfmainSpecial "\<generic\>" +syntax match pfmainSpecial "\<include\>" +syntax match pfmainSpecial "\<virtual\>" + +syntax match pfmainSpecial "\<delay_dotcrlf\>" +syntax match pfmainSpecial "\<disable_esmtp\>" + +syntax match pfmainSpecial "\<res_defnames\>" +syntax match pfmainSpecial "\<res_dnsrch\>" + syntax match pfmainSpecial "\<command\>" syntax match pfmainSpecial "\<file\>" -syntax match pfmainSpecial "\<forward\>" + +syntax match pfmainSpecial "\<forward_secrecy\>" +syntax match pfmainSpecial "\<mutual_auth\>" +syntax match pfmainSpecial "\<noactive\>" syntax match pfmainSpecial "\<noanonymous\>" +syntax match pfmainSpecial "\<nodictionary\>" syntax match pfmainSpecial "\<noplaintext\>" + +syntax match pfmainSpecial "\<bounce\>" +syntax match pfmainSpecial "\<2bounce\>" +syntax match pfmainSpecial "\<data\>" +syntax match pfmainSpecial "\<delay\>" +syntax match pfmainSpecial "\<policy\>" +syntax match pfmainSpecial "\<protocol\>" syntax match pfmainSpecial "\<resource\>" syntax match pfmainSpecial "\<software\>" -syntax match pfmainSpecial "\<bounce\>" syntax match pfmainSpecial "\<cleanup\>" syntax match pfmainSpecial "\<cyrus\>" -syntax match pfmainSpecial "\<defer\>" syntax match pfmainSpecial "\<error\>" syntax match pfmainSpecial "\<flush\>" +syntax match pfmainSpecial "\<notify\>" syntax match pfmainSpecial "\<pickup\>" syntax match pfmainSpecial "\<postdrop\>" syntax match pfmainSpecial "\<qmgr\>" +syntax match pfmainSpecial "\<qmqpd\>" syntax match pfmainSpecial "\<rewrite\>" syntax match pfmainSpecial "\<scache\>" +syntax match pfmainSpecial "\<sendmail\>" syntax match pfmainSpecial "\<showq\>" +syntax match pfmainSpecial "\<smtpd\>" syntax match pfmainSpecial "\<trace\>" syntax match pfmainSpecial "\<verify\>" -if version >= 508 || !exists("pfmain_syntax_init") - if version < 508 - let pfmain_syntax_init = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink pfmainConf Statement - HiLink pfmainRef PreProc - HiLink pfmainWord identifier +hi def link pfmainConf Statement +hi def link pfmainRef PreProc +hi def link pfmainWord identifier - HiLink pfmainDict Type - HiLink pfmainQueueDir Constant - HiLink pfmainTransport Constant - HiLink pfmainLock Constant - HiLink pfmainAnswer Constant +hi def link pfmainDict Type +hi def link pfmainQueueDir Constant +hi def link pfmainTransport Constant +hi def link pfmainLock Constant +hi def link pfmainAnswer Constant - HiLink pfmainComment Comment - HiLink pfmainNumber Number - HiLink pfmainTime Number - HiLink pfmainIP Number - HiLink pfmainVariable Error - HiLink pfmainSpecial Special +hi def link pfmainComment Comment +hi def link pfmainNumber Number +hi def link pfmainTime Number +hi def link pfmainIP Number +hi def link pfmainVariable Error +hi def link pfmainSpecial Special - delcommand HiLink -endif let b:current_syntax = "pfmain" diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index f27d923400..ef89a9e850 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,42 +1,38 @@ " Vim syntax file -" Language: php PHP 3/4/5 +" Language: php PHP 3/4/5/7 " Maintainer: Jason Woofenden <jason@jasonwoof.com> -" Last Change: Aug 28, 2013 -" URL: https://gitorious.org/jasonwoof/vim-syntax/blobs/master/php.vim +" Last Change: May 12, 2018 +" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com> " Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " -" Note: If you are using a colour terminal with dark background, you will probably find -" the 'elflord' colorscheme is much better for PHP's syntax than the default -" colourscheme, because elflord's colours will better highlight the break-points -" (Statements) in your code. +" Note: If you are using a colour terminal with dark background, you will +" probably find the 'elflord' colorscheme is much better for PHP's syntax +" than the default colourscheme, because elflord's colours will better +" highlight the break-points (Statements) in your code. " -" Options: php_sql_query = 1 for SQL syntax highlighting inside strings -" php_htmlInStrings = 1 for HTML syntax highlighting inside strings -" php_baselib = 1 for highlighting baselib functions -" php_asp_tags = 1 for highlighting ASP-style short tags -" php_parent_error_close = 1 for highlighting parent error ] or ) -" php_parent_error_open = 1 for skipping an php end tag, if there exists an open ( or [ without a closing one -" php_oldStyle = 1 for using old colorstyle -" php_noShortTags = 1 don't sync <? ?> as php -" php_folding = 1 for folding classes and functions -" php_folding = 2 for folding all { } regions -" php_sync_method = x -" x=-1 to sync by search ( default ) -" x>0 to sync at least x lines backwards -" x=0 to sync from start -" -" Added by Peter Hodge On June 9, 2006: -" php_special_functions = 1|0 to highlight functions with abnormal behaviour -" php_alt_comparisons = 1|0 to highlight comparison operators in an alternate colour -" php_alt_assignByReference = 1|0 to highlight '= &' in an alternate colour -" -" Note: these all default to 1 (On), so you would set them to '0' to turn them off. -" E.g., in your .vimrc or _vimrc file: -" let php_special_functions = 0 -" let php_alt_comparisons = 0 -" let php_alt_assignByReference = 0 -" Unletting these variables will revert back to their default (On). +" Options: +" Set to anything to enable: +" php_sql_query SQL syntax highlighting inside strings +" php_htmlInStrings HTML syntax highlighting inside strings +" php_baselib highlighting baselib functions +" php_asp_tags highlighting ASP-style short tags +" php_parent_error_close highlighting parent error ] or ) +" php_parent_error_open skipping an php end tag, if there exists +" an open ( or [ without a closing one +" php_oldStyle use old colorstyle +" php_noShortTags don't sync <? ?> as php +" Set to a specific value: +" php_folding = 1 fold classes and functions +" php_folding = 2 fold all { } regions +" php_sync_method = x where x is an integer: +" -1 sync by search ( default ) +" >0 sync at least x lines backwards +" 0 sync from start +" Set to 0 to _disable_: (Added by Peter Hodge On June 9, 2006) +" php_special_functions = 0 highlight functions with abnormal behaviour +" php_alt_comparisons = 0 comparison operators in an alternate colour +" php_alt_assignByReference = 0 '= &' in an alternate colour " " " Note: @@ -55,11 +51,8 @@ " ii) Same problem if you are setting php_folding = 2 with a closing " } inside an string on the first line of this string. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -67,16 +60,8 @@ if !exists("main_syntax") let main_syntax = 'php' endif -if version < 600 - unlet! php_folding - if exists("php_sync_method") && !php_sync_method - let php_sync_method=-1 - endif - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/html.vim +unlet b:current_syntax " accept old options if !exists("php_sync_method") @@ -94,11 +79,7 @@ endif syn cluster htmlPreproc add=phpRegion,phpRegionAsp,phpRegionSc -if version < 600 - syn include @sqlTop <sfile>:p:h/sql.vim -else - syn include @sqlTop syntax/sql.vim -endif +syn include @sqlTop syntax/sql.vim syn sync clear unlet b:current_syntax syn cluster sqlTop remove=sqlString,sqlComment @@ -120,192 +101,196 @@ syn case match syn keyword phpEnvVar GATEWAY_INTERFACE SERVER_NAME SERVER_SOFTWARE SERVER_PROTOCOL REQUEST_METHOD QUERY_STRING DOCUMENT_ROOT HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ENCODING HTTP_ACCEPT_LANGUAGE HTTP_CONNECTION HTTP_HOST HTTP_REFERER HTTP_USER_AGENT REMOTE_ADDR REMOTE_PORT SCRIPT_FILENAME SERVER_ADMIN SERVER_PORT SERVER_SIGNATURE PATH_TRANSLATED SCRIPT_NAME REQUEST_URI contained " Internal Variables -syn keyword phpIntVar GLOBALS PHP_ERRMSG PHP_SELF HTTP_GET_VARS HTTP_POST_VARS HTTP_COOKIE_VARS HTTP_POST_FILES HTTP_ENV_VARS HTTP_SERVER_VARS HTTP_SESSION_VARS HTTP_RAW_POST_DATA HTTP_STATE_VARS _GET _POST _COOKIE _FILES _SERVER _ENV _SERVER _REQUEST _SESSION contained +syn keyword phpIntVar GLOBALS PHP_ERRMSG PHP_SELF HTTP_GET_VARS HTTP_POST_VARS HTTP_COOKIE_VARS HTTP_POST_FILES HTTP_ENV_VARS HTTP_SERVER_VARS HTTP_SESSION_VARS HTTP_RAW_POST_DATA HTTP_STATE_VARS _GET _POST _COOKIE _FILES _SERVER _ENV _SERVER _REQUEST _SESSION contained " Constants -syn keyword phpCoreConstant PHP_VERSION PHP_OS DEFAULT_INCLUDE_PATH PEAR_INSTALL_DIR PEAR_EXTENSION_DIR PHP_EXTENSION_DIR PHP_BINDIR PHP_LIBDIR PHP_DATADIR PHP_SYSCONFDIR PHP_LOCALSTATEDIR PHP_CONFIG_FILE_PATH PHP_OUTPUT_HANDLER_START PHP_OUTPUT_HANDLER_CONT PHP_OUTPUT_HANDLER_END E_ERROR E_WARNING E_PARSE E_NOTICE E_CORE_ERROR E_CORE_WARNING E_COMPILE_ERROR E_COMPILE_WARNING E_USER_ERROR E_USER_WARNING E_USER_NOTICE E_ALL contained +syn keyword phpCoreConstant PHP_VERSION PHP_OS DEFAULT_INCLUDE_PATH PEAR_INSTALL_DIR PEAR_EXTENSION_DIR PHP_EXTENSION_DIR PHP_BINDIR PHP_LIBDIR PHP_DATADIR PHP_SYSCONFDIR PHP_LOCALSTATEDIR PHP_CONFIG_FILE_PATH PHP_OUTPUT_HANDLER_START PHP_OUTPUT_HANDLER_CONT PHP_OUTPUT_HANDLER_END contained + +" Predefined constants +" Generated by: curl -q http://php.net/manual/en/errorfunc.constants.php | grep -oP 'E_\w+' | sort -u +syn keyword phpCoreConstant E_ALL E_COMPILE_ERROR E_COMPILE_WARNING E_CORE_ERROR E_CORE_WARNING E_DEPRECATED E_ERROR E_NOTICE E_PARSE E_RECOVERABLE_ERROR E_STRICT E_USER_DEPRECATED E_USER_ERROR E_USER_NOTICE E_USER_WARNING E_WARNING contained syn case ignore -syn keyword phpConstant __LINE__ __FILE__ __FUNCTION__ __METHOD__ __CLASS__ __DIR__ __NAMESPACE__ contained +syn keyword phpConstant __LINE__ __FILE__ __FUNCTION__ __METHOD__ __CLASS__ __DIR__ __NAMESPACE__ __TRAIT__ contained " Function and Methods ripped from php_manual_de.tar.gz Jan 2003 -syn keyword phpFunctions apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_note apache_request_headers apache_response_headers apache_setenv ascii2ebcdic ebcdic2ascii getallheaders virtual contained -syn keyword phpFunctions array_change_key_case array_chunk array_combine array_count_values array_diff_assoc array_diff_uassoc array_diff array_fill array_filter array_flip array_intersect_assoc array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_unique array_unshift array_values array_walk array arsort asort compact count current each end extract in_array key krsort ksort list natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained -syn keyword phpFunctions aspell_check aspell_new aspell_suggest contained -syn keyword phpFunctions bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub contained -syn keyword phpFunctions bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite contained -syn keyword phpFunctions cal_days_in_month cal_from_jd cal_info cal_to_jd easter_date easter_days frenchtojd gregoriantojd jddayofweek jdmonthname jdtofrench jdtogregorian jdtojewish jdtojulian jdtounix jewishtojd juliantojd unixtojd contained -syn keyword phpFunctions ccvs_add ccvs_auth ccvs_command ccvs_count ccvs_delete ccvs_done ccvs_init ccvs_lookup ccvs_new ccvs_report ccvs_return ccvs_reverse ccvs_sale ccvs_status ccvs_textvalue ccvs_void contained -syn keyword phpFunctions call_user_method_array call_user_method class_exists get_class_methods get_class_vars get_class get_declared_classes get_object_vars get_parent_class is_a is_subclass_of method_exists contained -syn keyword phpFunctions com VARIANT com_addref com_get com_invoke com_isenum com_load_typelib com_load com_propget com_propput com_propset com_release com_set contained -syn keyword phpFunctions cpdf_add_annotation cpdf_add_outline cpdf_arc cpdf_begin_text cpdf_circle cpdf_clip cpdf_close cpdf_closepath_fill_stroke cpdf_closepath_stroke cpdf_closepath cpdf_continue_text cpdf_curveto cpdf_end_text cpdf_fill_stroke cpdf_fill cpdf_finalize_page cpdf_finalize cpdf_global_set_document_limits cpdf_import_jpeg cpdf_lineto cpdf_moveto cpdf_newpath cpdf_open cpdf_output_buffer cpdf_page_init cpdf_place_inline_image cpdf_rect cpdf_restore cpdf_rlineto cpdf_rmoveto cpdf_rotate_text cpdf_rotate cpdf_save_to_file cpdf_save cpdf_scale cpdf_set_action_url cpdf_set_char_spacing cpdf_set_creator cpdf_set_current_page cpdf_set_font_directories cpdf_set_font_map_file cpdf_set_font cpdf_set_horiz_scaling cpdf_set_keywords cpdf_set_leading cpdf_set_page_animation cpdf_set_subject cpdf_set_text_matrix cpdf_set_text_pos cpdf_set_text_rendering cpdf_set_text_rise cpdf_set_title cpdf_set_viewer_preferences cpdf_set_word_spacing cpdf_setdash cpdf_setflat cpdf_setgray_fill cpdf_setgray_stroke cpdf_setgray cpdf_setlinecap cpdf_setlinejoin cpdf_setlinewidth cpdf_setmiterlimit cpdf_setrgbcolor_fill cpdf_setrgbcolor_stroke cpdf_setrgbcolor cpdf_show_xy cpdf_show cpdf_stringwidth cpdf_stroke cpdf_text cpdf_translate contained -syn keyword phpFunctions crack_check crack_closedict crack_getlastmessage crack_opendict contained -syn keyword phpFunctions ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_graph ctype_lower ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit contained -syn keyword phpFunctions curl_close curl_errno curl_error curl_exec curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_setopt curl_version contained -syn keyword phpFunctions cybercash_base64_decode cybercash_base64_encode cybercash_decr cybercash_encr contained -syn keyword phpFunctions cyrus_authenticate cyrus_bind cyrus_close cyrus_connect cyrus_query cyrus_unbind contained -syn keyword phpFunctions checkdate date getdate gettimeofday gmdate gmmktime gmstrftime localtime microtime mktime strftime strtotime time contained -syn keyword phpFunctions dba_close dba_delete dba_exists dba_fetch dba_firstkey dba_handlers dba_insert dba_key_split dba_list dba_nextkey dba_open dba_optimize dba_popen dba_replace dba_sync contained -syn keyword phpFunctions dbase_add_record dbase_close dbase_create dbase_delete_record dbase_get_header_info dbase_get_record_with_names dbase_get_record dbase_numfields dbase_numrecords dbase_open dbase_pack dbase_replace_record contained -syn keyword phpFunctions dblist dbmclose dbmdelete dbmexists dbmfetch dbmfirstkey dbminsert dbmnextkey dbmopen dbmreplace contained -syn keyword phpFunctions dbplus_add dbplus_aql dbplus_chdir dbplus_close dbplus_curr dbplus_errcode dbplus_errno dbplus_find dbplus_first dbplus_flush dbplus_freealllocks dbplus_freelock dbplus_freerlocks dbplus_getlock dbplus_getunique dbplus_info dbplus_last dbplus_lockrel dbplus_next dbplus_open dbplus_prev dbplus_rchperm dbplus_rcreate dbplus_rcrtexact dbplus_rcrtlike dbplus_resolve dbplus_restorepos dbplus_rkeys dbplus_ropen dbplus_rquery dbplus_rrename dbplus_rsecindex dbplus_runlink dbplus_rzap dbplus_savepos dbplus_setindex dbplus_setindexbynumber dbplus_sql dbplus_tcl dbplus_tremove dbplus_undo dbplus_undoprepare dbplus_unlockrel dbplus_unselect dbplus_update dbplus_xlockrel dbplus_xunlockrel contained -syn keyword phpFunctions dbx_close dbx_compare dbx_connect dbx_error dbx_escape_string dbx_fetch_row dbx_query dbx_sort contained -syn keyword phpFunctions dio_close dio_fcntl dio_open dio_read dio_seek dio_stat dio_tcsetattr dio_truncate dio_write contained -syn keyword phpFunctions chdir chroot dir closedir getcwd opendir readdir rewinddir scandir contained -syn keyword phpFunctions domxml_new_doc domxml_open_file domxml_open_mem domxml_version domxml_xmltree domxml_xslt_stylesheet_doc domxml_xslt_stylesheet_file domxml_xslt_stylesheet xpath_eval_expression xpath_eval xpath_new_context xptr_eval xptr_new_context contained -syn keyword phpMethods name specified value create_attribute create_cdata_section create_comment create_element_ns create_element create_entity_reference create_processing_instruction create_text_node doctype document_element dump_file dump_mem get_element_by_id get_elements_by_tagname html_dump_mem xinclude entities internal_subset name notations public_id system_id get_attribute_node get_attribute get_elements_by_tagname has_attribute remove_attribute set_attribute tagname add_namespace append_child append_sibling attributes child_nodes clone_node dump_node first_child get_content has_attributes has_child_nodes insert_before is_blank_node last_child next_sibling node_name node_type node_value owner_document parent_node prefix previous_sibling remove_child replace_child replace_node set_content set_name set_namespace unlink_node data target process result_dump_file result_dump_mem contained -syn keyword phpFunctions dotnet_load contained -syn keyword phpFunctions debug_backtrace debug_print_backtrace error_log error_reporting restore_error_handler set_error_handler trigger_error user_error contained -syn keyword phpFunctions escapeshellarg escapeshellcmd exec passthru proc_close proc_get_status proc_nice proc_open proc_terminate shell_exec system contained -syn keyword phpFunctions fam_cancel_monitor fam_close fam_monitor_collection fam_monitor_directory fam_monitor_file fam_next_event fam_open fam_pending fam_resume_monitor fam_suspend_monitor contained -syn keyword phpFunctions fbsql_affected_rows fbsql_autocommit fbsql_change_user fbsql_close fbsql_commit fbsql_connect fbsql_create_blob fbsql_create_clob fbsql_create_db fbsql_data_seek fbsql_database_password fbsql_database fbsql_db_query fbsql_db_status fbsql_drop_db fbsql_errno fbsql_error fbsql_fetch_array fbsql_fetch_assoc fbsql_fetch_field fbsql_fetch_lengths fbsql_fetch_object fbsql_fetch_row fbsql_field_flags fbsql_field_len fbsql_field_name fbsql_field_seek fbsql_field_table fbsql_field_type fbsql_free_result fbsql_get_autostart_info fbsql_hostname fbsql_insert_id fbsql_list_dbs fbsql_list_fields fbsql_list_tables fbsql_next_result fbsql_num_fields fbsql_num_rows fbsql_password fbsql_pconnect fbsql_query fbsql_read_blob fbsql_read_clob fbsql_result fbsql_rollback fbsql_select_db fbsql_set_lob_mode fbsql_set_transaction fbsql_start_db fbsql_stop_db fbsql_tablename fbsql_username fbsql_warnings contained -syn keyword phpFunctions fdf_add_doc_javascript fdf_add_template fdf_close fdf_create fdf_enum_values fdf_errno fdf_error fdf_get_ap fdf_get_attachment fdf_get_encoding fdf_get_file fdf_get_flags fdf_get_opt fdf_get_status fdf_get_value fdf_get_version fdf_header fdf_next_field_name fdf_open_string fdf_open fdf_remove_item fdf_save_string fdf_save fdf_set_ap fdf_set_encoding fdf_set_file fdf_set_flags fdf_set_javascript_action fdf_set_opt fdf_set_status fdf_set_submit_form_action fdf_set_target_frame fdf_set_value fdf_set_version contained -syn keyword phpFunctions filepro_fieldcount filepro_fieldname filepro_fieldtype filepro_fieldwidth filepro_retrieve filepro_rowcount filepro contained -syn keyword phpFunctions basename chgrp chmod chown clearstatcache copy delete dirname disk_free_space disk_total_space diskfreespace fclose feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents file fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype flock fnmatch fopen fpassthru fputs fread fscanf fseek fstat ftell ftruncate fwrite glob is_dir is_executable is_file is_link is_readable is_uploaded_file is_writable is_writeable link linkinfo lstat mkdir move_uploaded_file parse_ini_file pathinfo pclose popen readfile readlink realpath rename rewind rmdir set_file_buffer stat symlink tempnam tmpfile touch umask unlink contained -syn keyword phpFunctions fribidi_log2vis contained -syn keyword phpFunctions ftp_alloc ftp_cdup ftp_chdir ftp_chmod ftp_close ftp_connect ftp_delete ftp_exec ftp_fget ftp_fput ftp_get_option ftp_get ftp_login ftp_mdtm ftp_mkdir ftp_nb_continue ftp_nb_fget ftp_nb_fput ftp_nb_get ftp_nb_put ftp_nlist ftp_pasv ftp_put ftp_pwd ftp_quit ftp_raw ftp_rawlist ftp_rename ftp_rmdir ftp_set_option ftp_site ftp_size ftp_ssl_connect ftp_systype contained -syn keyword phpFunctions call_user_func_array call_user_func create_function func_get_arg func_get_args func_num_args function_exists get_defined_functions register_shutdown_function register_tick_function unregister_tick_function contained -syn keyword phpFunctions bind_textdomain_codeset bindtextdomain dcgettext dcngettext dgettext dngettext gettext ngettext textdomain contained -syn keyword phpFunctions gmp_abs gmp_add gmp_and gmp_clrbit gmp_cmp gmp_com gmp_div_q gmp_div_qr gmp_div_r gmp_div gmp_divexact gmp_fact gmp_gcd gmp_gcdext gmp_hamdist gmp_init gmp_intval gmp_invert gmp_jacobi gmp_legendre gmp_mod gmp_mul gmp_neg gmp_or gmp_perfect_square gmp_popcount gmp_pow gmp_powm gmp_prob_prime gmp_random gmp_scan0 gmp_scan1 gmp_setbit gmp_sign gmp_sqrt gmp_sqrtrem gmp_sqrtrm gmp_strval gmp_sub gmp_xor contained -syn keyword phpFunctions header headers_list headers_sent setcookie contained -syn keyword phpFunctions hw_api_attribute hwapi_hgcsp hw_api_content hw_api_object contained -syn keyword phpMethods key langdepvalue value values checkin checkout children mimetype read content copy dbstat dcstat dstanchors dstofsrcanchors count reason find ftstat hwstat identify info insert insertanchor insertcollection insertdocument link lock move assign attreditable count insert remove title value object objectbyanchor parents description type remove replace setcommitedversion srcanchors srcsofdst unlock user userlist contained -syn keyword phpFunctions hw_Array2Objrec hw_changeobject hw_Children hw_ChildrenObj hw_Close hw_Connect hw_connection_info hw_cp hw_Deleteobject hw_DocByAnchor hw_DocByAnchorObj hw_Document_Attributes hw_Document_BodyTag hw_Document_Content hw_Document_SetContent hw_Document_Size hw_dummy hw_EditText hw_Error hw_ErrorMsg hw_Free_Document hw_GetAnchors hw_GetAnchorsObj hw_GetAndLock hw_GetChildColl hw_GetChildCollObj hw_GetChildDocColl hw_GetChildDocCollObj hw_GetObject hw_GetObjectByQuery hw_GetObjectByQueryColl hw_GetObjectByQueryCollObj hw_GetObjectByQueryObj hw_GetParents hw_GetParentsObj hw_getrellink hw_GetRemote hw_getremotechildren hw_GetSrcByDestObj hw_GetText hw_getusername hw_Identify hw_InCollections hw_Info hw_InsColl hw_InsDoc hw_insertanchors hw_InsertDocument hw_InsertObject hw_mapid hw_Modifyobject hw_mv hw_New_Document hw_objrec2array hw_Output_Document hw_pConnect hw_PipeDocument hw_Root hw_setlinkroot hw_stat hw_Unlock hw_Who contained -syn keyword phpFunctions ibase_add_user ibase_affected_rows ibase_blob_add ibase_blob_cancel ibase_blob_close ibase_blob_create ibase_blob_echo ibase_blob_get ibase_blob_import ibase_blob_info ibase_blob_open ibase_close ibase_commit_ret ibase_commit ibase_connect ibase_delete_user ibase_drop_db ibase_errcode ibase_errmsg ibase_execute ibase_fetch_assoc ibase_fetch_object ibase_fetch_row ibase_field_info ibase_free_event_handler ibase_free_query ibase_free_result ibase_gen_id ibase_modify_user ibase_name_result ibase_num_fields ibase_num_params ibase_param_info ibase_pconnect ibase_prepare ibase_query ibase_rollback_ret ibase_rollback ibase_set_event_handler ibase_timefmt ibase_trans ibase_wait_event contained -syn keyword phpFunctions iconv_get_encoding iconv_mime_decode_headers iconv_mime_decode iconv_mime_encode iconv_set_encoding iconv_strlen iconv_strpos iconv_strrpos iconv_substr iconv ob_iconv_handler contained -syn keyword phpFunctions ifx_affected_rows ifx_blobinfile_mode ifx_byteasvarchar ifx_close ifx_connect ifx_copy_blob ifx_create_blob ifx_create_char ifx_do ifx_error ifx_errormsg ifx_fetch_row ifx_fieldproperties ifx_fieldtypes ifx_free_blob ifx_free_char ifx_free_result ifx_get_blob ifx_get_char ifx_getsqlca ifx_htmltbl_result ifx_nullformat ifx_num_fields ifx_num_rows ifx_pconnect ifx_prepare ifx_query ifx_textasvarchar ifx_update_blob ifx_update_char ifxus_close_slob ifxus_create_slob ifxus_free_slob ifxus_open_slob ifxus_read_slob ifxus_seek_slob ifxus_tell_slob ifxus_write_slob contained -syn keyword phpFunctions exif_imagetype exif_read_data exif_thumbnail gd_info getimagesize image_type_to_mime_type image2wbmp imagealphablending imageantialias imagearc imagechar imagecharup imagecolorallocate imagecolorallocatealpha imagecolorat imagecolorclosest imagecolorclosestalpha imagecolorclosesthwb imagecolordeallocate imagecolorexact imagecolorexactalpha imagecolormatch imagecolorresolve imagecolorresolvealpha imagecolorset imagecolorsforindex imagecolorstotal imagecolortransparent imagecopy imagecopymerge imagecopymergegray imagecopyresampled imagecopyresized imagecreate imagecreatefromgd2 imagecreatefromgd2part imagecreatefromgd imagecreatefromgif imagecreatefromjpeg imagecreatefrompng imagecreatefromstring imagecreatefromwbmp imagecreatefromxbm imagecreatefromxpm imagecreatetruecolor imagedashedline imagedestroy imageellipse imagefill imagefilledarc imagefilledellipse imagefilledpolygon imagefilledrectangle imagefilltoborder imagefontheight imagefontwidth imageftbbox imagefttext imagegammacorrect imagegd2 imagegd imagegif imageinterlace imageistruecolor imagejpeg imageline imageloadfont imagepalettecopy imagepng imagepolygon imagepsbbox imagepscopyfont imagepsencodefont imagepsextendfont imagepsfreefont imagepsloadfont imagepsslantfont imagepstext imagerectangle imagerotate imagesavealpha imagesetbrush imagesetpixel imagesetstyle imagesetthickness imagesettile imagestring imagestringup imagesx imagesy imagetruecolortopalette imagettfbbox imagettftext imagetypes imagewbmp iptcembed iptcparse jpeg2wbmp png2wbmp read_exif_data contained -syn keyword phpFunctions imap_8bit imap_alerts imap_append imap_base64 imap_binary imap_body imap_bodystruct imap_check imap_clearflag_full imap_close imap_createmailbox imap_delete imap_deletemailbox imap_errors imap_expunge imap_fetch_overview imap_fetchbody imap_fetchheader imap_fetchstructure imap_get_quota imap_get_quotaroot imap_getacl imap_getmailboxes imap_getsubscribed imap_header imap_headerinfo imap_headers imap_last_error imap_list imap_listmailbox imap_listscan imap_listsubscribed imap_lsub imap_mail_compose imap_mail_copy imap_mail_move imap_mail imap_mailboxmsginfo imap_mime_header_decode imap_msgno imap_num_msg imap_num_recent imap_open imap_ping imap_qprint imap_renamemailbox imap_reopen imap_rfc822_parse_adrlist imap_rfc822_parse_headers imap_rfc822_write_address imap_scanmailbox imap_search imap_set_quota imap_setacl imap_setflag_full imap_sort imap_status imap_subscribe imap_thread imap_timeout imap_uid imap_undelete imap_unsubscribe imap_utf7_decode imap_utf7_encode imap_utf8 contained -syn keyword phpFunctions assert_options assert dl extension_loaded get_cfg_var get_current_user get_defined_constants get_extension_funcs get_include_path get_included_files get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_required_files getenv getlastmod getmygid getmyinode getmypid getmyuid getopt getrusage ini_alter ini_get_all ini_get ini_restore ini_set main memory_get_usage php_ini_scanned_files php_logo_guid php_sapi_name php_uname phpcredits phpinfo phpversion putenv restore_include_path set_include_path set_magic_quotes_runtime set_time_limit version_compare zend_logo_guid zend_version contained -syn keyword phpFunctions ingres_autocommit ingres_close ingres_commit ingres_connect ingres_fetch_array ingres_fetch_object ingres_fetch_row ingres_field_length ingres_field_name ingres_field_nullable ingres_field_precision ingres_field_scale ingres_field_type ingres_num_fields ingres_num_rows ingres_pconnect ingres_query ingres_rollback contained -syn keyword phpFunctions ircg_channel_mode ircg_disconnect ircg_fetch_error_msg ircg_get_username ircg_html_encode ircg_ignore_add ircg_ignore_del ircg_is_conn_alive ircg_join ircg_kick ircg_lookup_format_messages ircg_msg ircg_nick ircg_nickname_escape ircg_nickname_unescape ircg_notice ircg_part ircg_pconnect ircg_register_format_messages ircg_set_current ircg_set_file ircg_set_on_die ircg_topic ircg_whois contained -syn keyword phpFunctions java_last_exception_clear java_last_exception_get contained -syn keyword phpFunctions json_decode json_encode json_last_error contained -syn keyword phpFunctions ldap_8859_to_t61 ldap_add ldap_bind ldap_close ldap_compare ldap_connect ldap_count_entries ldap_delete ldap_dn2ufn ldap_err2str ldap_errno ldap_error ldap_explode_dn ldap_first_attribute ldap_first_entry ldap_first_reference ldap_free_result ldap_get_attributes ldap_get_dn ldap_get_entries ldap_get_option ldap_get_values_len ldap_get_values ldap_list ldap_mod_add ldap_mod_del ldap_mod_replace ldap_modify ldap_next_attribute ldap_next_entry ldap_next_reference ldap_parse_reference ldap_parse_result ldap_read ldap_rename ldap_search ldap_set_option ldap_set_rebind_proc ldap_sort ldap_start_tls ldap_t61_to_8859 ldap_unbind contained -syn keyword phpFunctions lzf_compress lzf_decompress lzf_optimized_for contained -syn keyword phpFunctions ezmlm_hash mail contained -syn keyword phpFunctions mailparse_determine_best_xfer_encoding mailparse_msg_create mailparse_msg_extract_part_file mailparse_msg_extract_part mailparse_msg_free mailparse_msg_get_part_data mailparse_msg_get_part mailparse_msg_get_structure mailparse_msg_parse_file mailparse_msg_parse mailparse_rfc822_parse_addresses mailparse_stream_encode mailparse_uudecode_all contained -syn keyword phpFunctions abs acos acosh asin asinh atan2 atan atanh base_convert bindec ceil cos cosh decbin dechex decoct deg2rad exp expm1 floor fmod getrandmax hexdec hypot is_finite is_infinite is_nan lcg_value log10 log1p log max min mt_getrandmax mt_rand mt_srand octdec pi pow rad2deg rand round sin sinh sqrt srand tan tanh contained -syn keyword phpFunctions mb_convert_case mb_convert_encoding mb_convert_kana mb_convert_variables mb_decode_mimeheader mb_decode_numericentity mb_detect_encoding mb_detect_order mb_encode_mimeheader mb_encode_numericentity mb_ereg_match mb_ereg_replace mb_ereg_search_getpos mb_ereg_search_getregs mb_ereg_search_init mb_ereg_search_pos mb_ereg_search_regs mb_ereg_search_setpos mb_ereg_search mb_ereg mb_eregi_replace mb_eregi mb_get_info mb_http_input mb_http_output mb_internal_encoding mb_language mb_output_handler mb_parse_str mb_preferred_mime_name mb_regex_encoding mb_regex_set_options mb_send_mail mb_split mb_strcut mb_strimwidth mb_strlen mb_strpos mb_strrpos mb_strtolower mb_strtoupper mb_strwidth mb_substitute_character mb_substr_count mb_substr contained -syn keyword phpFunctions mcal_append_event mcal_close mcal_create_calendar mcal_date_compare mcal_date_valid mcal_day_of_week mcal_day_of_year mcal_days_in_month mcal_delete_calendar mcal_delete_event mcal_event_add_attribute mcal_event_init mcal_event_set_alarm mcal_event_set_category mcal_event_set_class mcal_event_set_description mcal_event_set_end mcal_event_set_recur_daily mcal_event_set_recur_monthly_mday mcal_event_set_recur_monthly_wday mcal_event_set_recur_none mcal_event_set_recur_weekly mcal_event_set_recur_yearly mcal_event_set_start mcal_event_set_title mcal_expunge mcal_fetch_current_stream_event mcal_fetch_event mcal_is_leap_year mcal_list_alarms mcal_list_events mcal_next_recurrence mcal_open mcal_popen mcal_rename_calendar mcal_reopen mcal_snooze mcal_store_event mcal_time_valid mcal_week_of_year contained -syn keyword phpFunctions mcrypt_cbc mcrypt_cfb mcrypt_create_iv mcrypt_decrypt mcrypt_ecb mcrypt_enc_get_algorithms_name mcrypt_enc_get_block_size mcrypt_enc_get_iv_size mcrypt_enc_get_key_size mcrypt_enc_get_modes_name mcrypt_enc_get_supported_key_sizes mcrypt_enc_is_block_algorithm_mode mcrypt_enc_is_block_algorithm mcrypt_enc_is_block_mode mcrypt_enc_self_test mcrypt_encrypt mcrypt_generic_deinit mcrypt_generic_end mcrypt_generic_init mcrypt_generic mcrypt_get_block_size mcrypt_get_cipher_name mcrypt_get_iv_size mcrypt_get_key_size mcrypt_list_algorithms mcrypt_list_modes mcrypt_module_close mcrypt_module_get_algo_block_size mcrypt_module_get_algo_key_size mcrypt_module_get_supported_key_sizes mcrypt_module_is_block_algorithm_mode mcrypt_module_is_block_algorithm mcrypt_module_is_block_mode mcrypt_module_open mcrypt_module_self_test mcrypt_ofb mdecrypt_generic contained -syn keyword phpFunctions mcve_adduser mcve_adduserarg mcve_bt mcve_checkstatus mcve_chkpwd mcve_chngpwd mcve_completeauthorizations mcve_connect mcve_connectionerror mcve_deleteresponse mcve_deletetrans mcve_deleteusersetup mcve_deluser mcve_destroyconn mcve_destroyengine mcve_disableuser mcve_edituser mcve_enableuser mcve_force mcve_getcell mcve_getcellbynum mcve_getcommadelimited mcve_getheader mcve_getuserarg mcve_getuserparam mcve_gft mcve_gl mcve_gut mcve_initconn mcve_initengine mcve_initusersetup mcve_iscommadelimited mcve_liststats mcve_listusers mcve_maxconntimeout mcve_monitor mcve_numcolumns mcve_numrows mcve_override mcve_parsecommadelimited mcve_ping mcve_preauth mcve_preauthcompletion mcve_qc mcve_responseparam mcve_return mcve_returncode mcve_returnstatus mcve_sale mcve_setblocking mcve_setdropfile mcve_setip mcve_setssl_files mcve_setssl mcve_settimeout mcve_settle mcve_text_avs mcve_text_code mcve_text_cv mcve_transactionauth mcve_transactionavs mcve_transactionbatch mcve_transactioncv mcve_transactionid mcve_transactionitem mcve_transactionssent mcve_transactiontext mcve_transinqueue mcve_transnew mcve_transparam mcve_transsend mcve_ub mcve_uwait mcve_verifyconnection mcve_verifysslcert mcve_void contained -syn keyword phpFunctions mhash_count mhash_get_block_size mhash_get_hash_name mhash_keygen_s2k mhash contained -syn keyword phpFunctions mime_content_type contained -syn keyword phpFunctions ming_setcubicthreshold ming_setscale ming_useswfversion SWFAction SWFBitmap swfbutton_keypress SWFbutton SWFDisplayItem SWFFill SWFFont SWFGradient SWFMorph SWFMovie SWFShape SWFSprite SWFText SWFTextField contained -syn keyword phpMethods getHeight getWidth addAction addShape setAction setdown setHit setOver setUp addColor move moveTo multColor remove Rotate rotateTo scale scaleTo setDepth setName setRatio skewX skewXTo skewY skewYTo moveTo rotateTo scaleTo skewXTo skewYTo getwidth addEntry getshape1 getshape2 add nextframe output remove save setbackground setdimension setframes setrate streammp3 addFill drawCurve drawCurveTo drawLine drawLineTo movePen movePenTo setLeftFill setLine setRightFill add nextframe remove setframes addString getWidth moveTo setColor setFont setHeight setSpacing addstring align setbounds setcolor setFont setHeight setindentation setLeftMargin setLineSpacing setMargins setname setrightMargin contained -syn keyword phpFunctions connection_aborted connection_status connection_timeout constant define defined die eval exit get_browser highlight_file highlight_string ignore_user_abort pack show_source sleep uniqid unpack usleep contained -syn keyword phpFunctions udm_add_search_limit udm_alloc_agent udm_api_version udm_cat_list udm_cat_path udm_check_charset udm_check_stored udm_clear_search_limits udm_close_stored udm_crc32 udm_errno udm_error udm_find udm_free_agent udm_free_ispell_data udm_free_res udm_get_doc_count udm_get_res_field udm_get_res_param udm_load_ispell_data udm_open_stored udm_set_agent_param contained -syn keyword phpFunctions msession_connect msession_count msession_create msession_destroy msession_disconnect msession_find msession_get_array msession_get msession_getdata msession_inc msession_list msession_listvar msession_lock msession_plugin msession_randstr msession_set_array msession_set msession_setdata msession_timeout msession_uniq msession_unlock contained -syn keyword phpFunctions msql_affected_rows msql_close msql_connect msql_create_db msql_createdb msql_data_seek msql_dbname msql_drop_db msql_dropdb msql_error msql_fetch_array msql_fetch_field msql_fetch_object msql_fetch_row msql_field_seek msql_fieldflags msql_fieldlen msql_fieldname msql_fieldtable msql_fieldtype msql_free_result msql_freeresult msql_list_dbs msql_list_fields msql_list_tables msql_listdbs msql_listfields msql_listtables msql_num_fields msql_num_rows msql_numfields msql_numrows msql_pconnect msql_query msql_regcase msql_result msql_select_db msql_selectdb msql_tablename msql contained -syn keyword phpFunctions mssql_bind mssql_close mssql_connect mssql_data_seek mssql_execute mssql_fetch_array mssql_fetch_assoc mssql_fetch_batch mssql_fetch_field mssql_fetch_object mssql_fetch_row mssql_field_length mssql_field_name mssql_field_seek mssql_field_type mssql_free_result mssql_free_statement mssql_get_last_message mssql_guid_string mssql_init mssql_min_error_severity mssql_min_message_severity mssql_next_result mssql_num_fields mssql_num_rows mssql_pconnect mssql_query mssql_result mssql_rows_affected mssql_select_db contained -syn keyword phpFunctions muscat_close muscat_get muscat_give muscat_setup_net muscat_setup contained -syn keyword phpFunctions mysql_affected_rows mysql_change_user mysql_client_encoding mysql_close mysql_connect mysql_create_db mysql_data_seek mysql_db_name mysql_db_query mysql_drop_db mysql_errno mysql_error mysql_escape_string mysql_fetch_array mysql_fetch_assoc mysql_fetch_field mysql_fetch_lengths mysql_fetch_object mysql_fetch_row mysql_field_flags mysql_field_len mysql_field_name mysql_field_seek mysql_field_table mysql_field_type mysql_free_result mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql_insert_id mysql_list_dbs mysql_list_fields mysql_list_processes mysql_list_tables mysql_num_fields mysql_num_rows mysql_pconnect mysql_ping mysql_query mysql_real_escape_string mysql_result mysql_select_db mysql_stat mysql_tablename mysql_thread_id mysql_unbuffered_query contained -syn keyword phpFunctions mysqli_affected_rows mysqli_autocommit mysqli_bind_param mysqli_bind_result mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect mysqli_data_seek mysqli_debug mysqli_disable_reads_from_master mysqli_disable_rpl_parse mysqli_dump_debug_info mysqli_enable_reads_from_master mysqli_enable_rpl_parse mysqli_errno mysqli_error mysqli_execute mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_fetch mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_client_info mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_master_query mysqli_num_fields mysqli_num_rows mysqli_options mysqli_param_count mysqli_ping mysqli_prepare_result mysqli_prepare mysqli_profiler mysqli_query mysqli_read_query_result mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reload mysqli_rollback mysqli_rpl_parse_enabled mysqli_rpl_probe mysqli_rpl_query_type mysqli_select_db mysqli_send_long_data mysqli_send_query mysqli_slave_query mysqli_ssl_set mysqli_stat mysqli_stmt_affected_rows mysqli_stmt_close mysqli_stmt_errno mysqli_stmt_error mysqli_stmt_store_result mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count contained -syn keyword phpFunctions ncurses_addch ncurses_addchnstr ncurses_addchstr ncurses_addnstr ncurses_addstr ncurses_assume_default_colors ncurses_attroff ncurses_attron ncurses_attrset ncurses_baudrate ncurses_beep ncurses_bkgd ncurses_bkgdset ncurses_border ncurses_bottom_panel ncurses_can_change_color ncurses_cbreak ncurses_clear ncurses_clrtobot ncurses_clrtoeol ncurses_color_content ncurses_color_set ncurses_curs_set ncurses_def_prog_mode ncurses_def_shell_mode ncurses_define_key ncurses_del_panel ncurses_delay_output ncurses_delch ncurses_deleteln ncurses_delwin ncurses_doupdate ncurses_echo ncurses_echochar ncurses_end ncurses_erase ncurses_erasechar ncurses_filter ncurses_flash ncurses_flushinp ncurses_getch ncurses_getmaxyx ncurses_getmouse ncurses_getyx ncurses_halfdelay ncurses_has_colors ncurses_has_ic ncurses_has_il ncurses_has_key ncurses_hide_panel ncurses_hline ncurses_inch ncurses_init_color ncurses_init_pair ncurses_init ncurses_insch ncurses_insdelln ncurses_insertln ncurses_insstr ncurses_instr ncurses_isendwin ncurses_keyok ncurses_keypad ncurses_killchar ncurses_longname ncurses_meta ncurses_mouse_trafo ncurses_mouseinterval ncurses_mousemask ncurses_move_panel ncurses_move ncurses_mvaddch ncurses_mvaddchnstr ncurses_mvaddchstr ncurses_mvaddnstr ncurses_mvaddstr ncurses_mvcur ncurses_mvdelch ncurses_mvgetch ncurses_mvhline ncurses_mvinch ncurses_mvvline ncurses_mvwaddstr ncurses_napms ncurses_new_panel ncurses_newpad ncurses_newwin ncurses_nl ncurses_nocbreak ncurses_noecho ncurses_nonl ncurses_noqiflush ncurses_noraw ncurses_pair_content ncurses_panel_above ncurses_panel_below ncurses_panel_window ncurses_pnoutrefresh ncurses_prefresh ncurses_putp ncurses_qiflush ncurses_raw ncurses_refresh ncurses_replace_panel ncurses_reset_prog_mode ncurses_reset_shell_mode ncurses_resetty ncurses_savetty ncurses_scr_dump ncurses_scr_init ncurses_scr_restore ncurses_scr_set ncurses_scrl ncurses_show_panel ncurses_slk_attr ncurses_slk_attroff ncurses_slk_attron ncurses_slk_attrset ncurses_slk_clear ncurses_slk_color ncurses_slk_init ncurses_slk_noutrefresh ncurses_slk_refresh ncurses_slk_restore ncurses_slk_set ncurses_slk_touch ncurses_standend ncurses_standout ncurses_start_color ncurses_termattrs ncurses_termname ncurses_timeout ncurses_top_panel ncurses_typeahead ncurses_ungetch ncurses_ungetmouse ncurses_update_panels ncurses_use_default_colors ncurses_use_env ncurses_use_extended_names ncurses_vidattr ncurses_vline ncurses_waddch ncurses_waddstr ncurses_wattroff ncurses_wattron ncurses_wattrset ncurses_wborder ncurses_wclear ncurses_wcolor_set ncurses_werase ncurses_wgetch ncurses_whline ncurses_wmouse_trafo ncurses_wmove ncurses_wnoutrefresh ncurses_wrefresh ncurses_wstandend ncurses_wstandout ncurses_wvline contained -syn keyword phpFunctions checkdnsrr closelog debugger_off debugger_on define_syslog_variables dns_check_record dns_get_mx dns_get_record fsockopen gethostbyaddr gethostbyname gethostbynamel getmxrr getprotobyname getprotobynumber getservbyname getservbyport ip2long long2ip openlog pfsockopen socket_get_status socket_set_blocking socket_set_timeout syslog contained -syn keyword phpFunctions yp_all yp_cat yp_err_string yp_errno yp_first yp_get_default_domain yp_master yp_match yp_next yp_order contained -syn keyword phpFunctions notes_body notes_copy_db notes_create_db notes_create_note notes_drop_db notes_find_note notes_header_info notes_list_msgs notes_mark_read notes_mark_unread notes_nav_create notes_search notes_unread notes_version contained -syn keyword phpFunctions nsapi_request_headers nsapi_response_headers nsapi_virtual contained -syn keyword phpFunctions aggregate_info aggregate_methods_by_list aggregate_methods_by_regexp aggregate_methods aggregate_properties_by_list aggregate_properties_by_regexp aggregate_properties aggregate aggregation_info deaggregate contained -syn keyword phpFunctions ocibindbyname ocicancel ocicloselob ocicollappend ocicollassign ocicollassignelem ocicollgetelem ocicollmax ocicollsize ocicolltrim ocicolumnisnull ocicolumnname ocicolumnprecision ocicolumnscale ocicolumnsize ocicolumntype ocicolumntyperaw ocicommit ocidefinebyname ocierror ociexecute ocifetch ocifetchinto ocifetchstatement ocifreecollection ocifreecursor ocifreedesc ocifreestatement ociinternaldebug ociloadlob ocilogoff ocilogon ocinewcollection ocinewcursor ocinewdescriptor ocinlogon ocinumcols ociparse ociplogon ociresult ocirollback ocirowcount ocisavelob ocisavelobfile ociserverversion ocisetprefetch ocistatementtype ociwritelobtofile ociwritetemporarylob contained -syn keyword phpFunctions odbc_autocommit odbc_binmode odbc_close_all odbc_close odbc_columnprivileges odbc_columns odbc_commit odbc_connect odbc_cursor odbc_data_source odbc_do odbc_error odbc_errormsg odbc_exec odbc_execute odbc_fetch_array odbc_fetch_into odbc_fetch_object odbc_fetch_row odbc_field_len odbc_field_name odbc_field_num odbc_field_precision odbc_field_scale odbc_field_type odbc_foreignkeys odbc_free_result odbc_gettypeinfo odbc_longreadlen odbc_next_result odbc_num_fields odbc_num_rows odbc_pconnect odbc_prepare odbc_primarykeys odbc_procedurecolumns odbc_procedures odbc_result_all odbc_result odbc_rollback odbc_setoption odbc_specialcolumns odbc_statistics odbc_tableprivileges odbc_tables contained -syn keyword phpFunctions openssl_csr_export_to_file openssl_csr_export openssl_csr_new openssl_csr_sign openssl_error_string openssl_free_key openssl_get_privatekey openssl_get_publickey openssl_open openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export_to_file openssl_pkey_export openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_seal openssl_sign openssl_verify openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export_to_file openssl_x509_export openssl_x509_free openssl_x509_parse openssl_x509_read contained -syn keyword phpFunctions ora_bind ora_close ora_columnname ora_columnsize ora_columntype ora_commit ora_commitoff ora_commiton ora_do ora_error ora_errorcode ora_exec ora_fetch_into ora_fetch ora_getcolumn ora_logoff ora_logon ora_numcols ora_numrows ora_open ora_parse ora_plogon ora_rollback contained -syn keyword phpFunctions flush ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_get_status ob_gzhandler ob_implicit_flush ob_list_handlers ob_start output_add_rewrite_var output_reset_rewrite_vars contained -syn keyword phpFunctions overload contained -syn keyword phpFunctions ovrimos_close ovrimos_commit ovrimos_connect ovrimos_cursor ovrimos_exec ovrimos_execute ovrimos_fetch_into ovrimos_fetch_row ovrimos_field_len ovrimos_field_name ovrimos_field_num ovrimos_field_type ovrimos_free_result ovrimos_longreadlen ovrimos_num_fields ovrimos_num_rows ovrimos_prepare ovrimos_result_all ovrimos_result ovrimos_rollback contained -syn keyword phpFunctions pcntl_exec pcntl_fork pcntl_signal pcntl_waitpid pcntl_wexitstatus pcntl_wifexited pcntl_wifsignaled pcntl_wifstopped pcntl_wstopsig pcntl_wtermsig contained -syn keyword phpFunctions preg_grep preg_match_all preg_match preg_quote preg_replace_callback preg_replace preg_split contained -syn keyword phpFunctions pdf_add_annotation pdf_add_bookmark pdf_add_launchlink pdf_add_locallink pdf_add_note pdf_add_outline pdf_add_pdflink pdf_add_thumbnail pdf_add_weblink pdf_arc pdf_arcn pdf_attach_file pdf_begin_page pdf_begin_pattern pdf_begin_template pdf_circle pdf_clip pdf_close_image pdf_close_pdi_page pdf_close_pdi pdf_close pdf_closepath_fill_stroke pdf_closepath_stroke pdf_closepath pdf_concat pdf_continue_text pdf_curveto pdf_delete pdf_end_page pdf_end_pattern pdf_end_template pdf_endpath pdf_fill_stroke pdf_fill pdf_findfont pdf_get_buffer pdf_get_font pdf_get_fontname pdf_get_fontsize pdf_get_image_height pdf_get_image_width pdf_get_majorversion pdf_get_minorversion pdf_get_parameter pdf_get_pdi_parameter pdf_get_pdi_value pdf_get_value pdf_initgraphics pdf_lineto pdf_makespotcolor pdf_moveto pdf_new pdf_open_CCITT pdf_open_file pdf_open_gif pdf_open_image_file pdf_open_image pdf_open_jpeg pdf_open_memory_image pdf_open_pdi_page pdf_open_pdi pdf_open_png pdf_open_tiff pdf_open pdf_place_image pdf_place_pdi_page pdf_rect pdf_restore pdf_rotate pdf_save pdf_scale pdf_set_border_color pdf_set_border_dash pdf_set_border_style pdf_set_char_spacing pdf_set_duration pdf_set_font pdf_set_horiz_scaling pdf_set_info_author pdf_set_info_creator pdf_set_info_keywords pdf_set_info_subject pdf_set_info_title pdf_set_info pdf_set_leading pdf_set_parameter pdf_set_text_matrix pdf_set_text_pos pdf_set_text_rendering pdf_set_text_rise pdf_set_value pdf_set_word_spacing pdf_setcolor pdf_setdash pdf_setflat pdf_setfont pdf_setgray_fill pdf_setgray_stroke pdf_setgray pdf_setlinecap pdf_setlinejoin pdf_setlinewidth pdf_setmatrix pdf_setmiterlimit pdf_setpolydash pdf_setrgbcolor_fill pdf_setrgbcolor_stroke pdf_setrgbcolor pdf_show_boxed pdf_show_xy pdf_show pdf_skew pdf_stringwidth pdf_stroke pdf_translate contained -syn keyword phpFunctions pfpro_cleanup pfpro_init pfpro_process_raw pfpro_process pfpro_version contained -syn keyword phpFunctions pg_affected_rows pg_cancel_query pg_client_encoding pg_close pg_connect pg_connection_busy pg_connection_reset pg_connection_status pg_convert pg_copy_from pg_copy_to pg_dbname pg_delete pg_end_copy pg_escape_bytea pg_escape_string pg_fetch_all pg_fetch_array pg_fetch_assoc pg_fetch_object pg_fetch_result pg_fetch_row pg_field_is_null pg_field_name pg_field_num pg_field_prtlen pg_field_size pg_field_type pg_free_result pg_get_notify pg_get_pid pg_get_result pg_host pg_insert pg_last_error pg_last_notice pg_last_oid pg_lo_close pg_lo_create pg_lo_export pg_lo_import pg_lo_open pg_lo_read_all pg_lo_read pg_lo_seek pg_lo_tell pg_lo_unlink pg_lo_write pg_meta_data pg_num_fields pg_num_rows pg_options pg_pconnect pg_ping pg_port pg_put_line pg_query pg_result_error pg_result_seek pg_result_status pg_select pg_send_query pg_set_client_encoding pg_trace pg_tty pg_unescape_bytea pg_untrace pg_update contained -syn keyword phpFunctions posix_ctermid posix_get_last_error posix_getcwd posix_getegid posix_geteuid posix_getgid posix_getgrgid posix_getgrnam posix_getgroups posix_getlogin posix_getpgid posix_getpgrp posix_getpid posix_getppid posix_getpwnam posix_getpwuid posix_getrlimit posix_getsid posix_getuid posix_isatty posix_kill posix_mkfifo posix_setegid posix_seteuid posix_setgid posix_setpgid posix_setsid posix_setuid posix_strerror posix_times posix_ttyname posix_uname contained -syn keyword phpFunctions printer_abort printer_close printer_create_brush printer_create_dc printer_create_font printer_create_pen printer_delete_brush printer_delete_dc printer_delete_font printer_delete_pen printer_draw_bmp printer_draw_chord printer_draw_elipse printer_draw_line printer_draw_pie printer_draw_rectangle printer_draw_roundrect printer_draw_text printer_end_doc printer_end_page printer_get_option printer_list printer_logical_fontheight printer_open printer_select_brush printer_select_font printer_select_pen printer_set_option printer_start_doc printer_start_page printer_write contained -syn keyword phpFunctions pspell_add_to_personal pspell_add_to_session pspell_check pspell_clear_session pspell_config_create pspell_config_ignore pspell_config_mode pspell_config_personal pspell_config_repl pspell_config_runtogether pspell_config_save_repl pspell_new_config pspell_new_personal pspell_new pspell_save_wordlist pspell_store_replacement pspell_suggest contained -syn keyword phpFunctions qdom_error qdom_tree contained -syn keyword phpFunctions readline_add_history readline_clear_history readline_completion_function readline_info readline_list_history readline_read_history readline_write_history readline contained -syn keyword phpFunctions recode_file recode_string recode contained -syn keyword phpFunctions ereg_replace ereg eregi_replace eregi split spliti sql_regcase contained -syn keyword phpFunctions ftok msg_get_queue msg_receive msg_remove_queue msg_send msg_set_queue msg_stat_queue sem_acquire sem_get sem_release sem_remove shm_attach shm_detach shm_get_var shm_put_var shm_remove_var shm_remove contained -syn keyword phpFunctions sesam_affected_rows sesam_commit sesam_connect sesam_diagnostic sesam_disconnect sesam_errormsg sesam_execimm sesam_fetch_array sesam_fetch_result sesam_fetch_row sesam_field_array sesam_field_name sesam_free_result sesam_num_fields sesam_query sesam_rollback sesam_seek_row sesam_settransaction contained -syn keyword phpFunctions session_cache_expire session_cache_limiter session_decode session_destroy session_encode session_get_cookie_params session_id session_is_registered session_module_name session_name session_regenerate_id session_register session_save_path session_set_cookie_params session_set_save_handler session_start session_unregister session_unset session_write_close contained -syn keyword phpFunctions shmop_close shmop_delete shmop_open shmop_read shmop_size shmop_write contained -syn keyword phpFunctions snmp_get_quick_print snmp_set_quick_print snmpget snmprealwalk snmpset snmpwalk snmpwalkoid contained -syn keyword phpFunctions socket_accept socket_bind socket_clear_error socket_close socket_connect socket_create_listen socket_create_pair socket_create socket_get_option socket_getpeername socket_getsockname socket_iovec_add socket_iovec_alloc socket_iovec_delete socket_iovec_fetch socket_iovec_free socket_iovec_set socket_last_error socket_listen socket_read socket_readv socket_recv socket_recvfrom socket_recvmsg socket_select socket_send socket_sendmsg socket_sendto socket_set_block socket_set_nonblock socket_set_option socket_shutdown socket_strerror socket_write socket_writev contained -syn keyword phpFunctions sqlite_array_query sqlite_busy_timeout sqlite_changes sqlite_close sqlite_column sqlite_create_aggregate sqlite_create_function sqlite_current sqlite_error_string sqlite_escape_string sqlite_fetch_array sqlite_fetch_single sqlite_fetch_string sqlite_field_name sqlite_has_more sqlite_last_error sqlite_last_insert_rowid sqlite_libencoding sqlite_libversion sqlite_next sqlite_num_fields sqlite_num_rows sqlite_open sqlite_popen sqlite_query sqlite_rewind sqlite_seek sqlite_udf_decode_binary sqlite_udf_encode_binary sqlite_unbuffered_query contained -syn keyword phpFunctions stream_context_create stream_context_get_options stream_context_set_option stream_context_set_params stream_copy_to_stream stream_filter_append stream_filter_prepend stream_filter_register stream_get_contents stream_get_filters stream_get_line stream_get_meta_data stream_get_transports stream_get_wrappers stream_register_wrapper stream_select stream_set_blocking stream_set_timeout stream_set_write_buffer stream_socket_accept stream_socket_client stream_socket_get_name stream_socket_recvfrom stream_socket_sendto stream_socket_server stream_wrapper_register contained -syn keyword phpFunctions addcslashes addslashes bin2hex chop chr chunk_split convert_cyr_string count_chars crc32 crypt explode fprintf get_html_translation_table hebrev hebrevc html_entity_decode htmlentities htmlspecialchars implode join levenshtein localeconv ltrim md5_file md5 metaphone money_format nl_langinfo nl2br number_format ord parse_str print printf quoted_printable_decode quotemeta rtrim setlocale sha1_file sha1 similar_text soundex sprintf sscanf str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpos strrchr strrev strripos strrpos strspn strstr strtok strtolower strtoupper strtr substr_compare substr_count substr_replace substr trim ucfirst ucwords vprintf vsprintf wordwrap contained -syn keyword phpFunctions swf_actiongeturl swf_actiongotoframe swf_actiongotolabel swf_actionnextframe swf_actionplay swf_actionprevframe swf_actionsettarget swf_actionstop swf_actiontogglequality swf_actionwaitforframe swf_addbuttonrecord swf_addcolor swf_closefile swf_definebitmap swf_definefont swf_defineline swf_definepoly swf_definerect swf_definetext swf_endbutton swf_enddoaction swf_endshape swf_endsymbol swf_fontsize swf_fontslant swf_fonttracking swf_getbitmapinfo swf_getfontinfo swf_getframe swf_labelframe swf_lookat swf_modifyobject swf_mulcolor swf_nextid swf_oncondition swf_openfile swf_ortho2 swf_ortho swf_perspective swf_placeobject swf_polarview swf_popmatrix swf_posround swf_pushmatrix swf_removeobject swf_rotate swf_scale swf_setfont swf_setframe swf_shapearc swf_shapecurveto3 swf_shapecurveto swf_shapefillbitmapclip swf_shapefillbitmaptile swf_shapefilloff swf_shapefillsolid swf_shapelinesolid swf_shapelineto swf_shapemoveto swf_showframe swf_startbutton swf_startdoaction swf_startshape swf_startsymbol swf_textwidth swf_translate swf_viewport contained -syn keyword phpFunctions sybase_affected_rows sybase_close sybase_connect sybase_data_seek sybase_deadlock_retry_count sybase_fetch_array sybase_fetch_assoc sybase_fetch_field sybase_fetch_object sybase_fetch_row sybase_field_seek sybase_free_result sybase_get_last_message sybase_min_client_severity sybase_min_error_severity sybase_min_message_severity sybase_min_server_severity sybase_num_fields sybase_num_rows sybase_pconnect sybase_query sybase_result sybase_select_db sybase_set_message_handler sybase_unbuffered_query contained -syn keyword phpFunctions tidy_access_count tidy_clean_repair tidy_config_count tidy_diagnose tidy_error_count tidy_get_body tidy_get_config tidy_get_error_buffer tidy_get_head tidy_get_html_ver tidy_get_html tidy_get_output tidy_get_release tidy_get_root tidy_get_status tidy_getopt tidy_is_xhtml tidy_load_config tidy_parse_file tidy_parse_string tidy_repair_file tidy_repair_string tidy_reset_config tidy_save_config tidy_set_encoding tidy_setopt tidy_warning_count contained -syn keyword phpMethods attributes children get_attr get_nodes has_children has_siblings is_asp is_comment is_html is_jsp is_jste is_text is_xhtml is_xml next prev tidy_node contained -syn keyword phpFunctions token_get_all token_name contained -syn keyword phpFunctions base64_decode base64_encode get_meta_tags http_build_query parse_url rawurldecode rawurlencode urldecode urlencode contained -syn keyword phpFunctions doubleval empty floatval get_defined_vars get_resource_type gettype import_request_variables intval is_array is_bool is_callable is_double is_float is_int is_integer is_long is_null is_numeric is_object is_real is_resource is_scalar is_string isset print_r serialize settype strval unserialize unset var_dump var_export contained -syn keyword phpFunctions vpopmail_add_alias_domain_ex vpopmail_add_alias_domain vpopmail_add_domain_ex vpopmail_add_domain vpopmail_add_user vpopmail_alias_add vpopmail_alias_del_domain vpopmail_alias_del vpopmail_alias_get_all vpopmail_alias_get vpopmail_auth_user vpopmail_del_domain_ex vpopmail_del_domain vpopmail_del_user vpopmail_error vpopmail_passwd vpopmail_set_user_quota contained -syn keyword phpFunctions w32api_deftype w32api_init_dtype w32api_invoke_function w32api_register_function w32api_set_call_method contained -syn keyword phpFunctions wddx_add_vars wddx_deserialize wddx_packet_end wddx_packet_start wddx_serialize_value wddx_serialize_vars contained -syn keyword phpFunctions utf8_decode utf8_encode xml_error_string xml_get_current_byte_index xml_get_current_column_number xml_get_current_line_number xml_get_error_code xml_parse_into_struct xml_parse xml_parser_create_ns xml_parser_create xml_parser_free xml_parser_get_option xml_parser_set_option xml_set_character_data_handler xml_set_default_handler xml_set_element_handler xml_set_end_namespace_decl_handler xml_set_external_entity_ref_handler xml_set_notation_decl_handler xml_set_object xml_set_processing_instruction_handler xml_set_start_namespace_decl_handler xml_set_unparsed_entity_decl_handler contained -syn keyword phpFunctions xmlrpc_decode_request xmlrpc_decode xmlrpc_encode_request xmlrpc_encode xmlrpc_get_type xmlrpc_parse_method_descriptions xmlrpc_server_add_introspection_data xmlrpc_server_call_method xmlrpc_server_create xmlrpc_server_destroy xmlrpc_server_register_introspection_callback xmlrpc_server_register_method xmlrpc_set_type contained -syn keyword phpFunctions xslt_create xslt_errno xslt_error xslt_free xslt_output_process xslt_set_base xslt_set_encoding xslt_set_error_handler xslt_set_log xslt_set_sax_handler xslt_set_sax_handlers xslt_set_scheme_handler xslt_set_scheme_handlers contained -syn keyword phpFunctions yaz_addinfo yaz_ccl_conf yaz_ccl_parse yaz_close yaz_connect yaz_database yaz_element yaz_errno yaz_error yaz_es_result yaz_get_option yaz_hits yaz_itemorder yaz_present yaz_range yaz_record yaz_scan_result yaz_scan yaz_schema yaz_search yaz_set_option yaz_sort yaz_syntax yaz_wait contained -syn keyword phpFunctions zip_close zip_entry_close zip_entry_compressedsize zip_entry_compressionmethod zip_entry_filesize zip_entry_name zip_entry_open zip_entry_read zip_open zip_read contained -syn keyword phpFunctions gzclose gzcompress gzdeflate gzencode gzeof gzfile gzgetc gzgets gzgetss gzinflate gzopen gzpassthru gzputs gzread gzrewind gzseek gztell gzuncompress gzwrite readgzfile zlib_get_coding_type contained +syn keyword phpFunctions apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_note apache_request_headers apache_response_headers apache_setenv ascii2ebcdic ebcdic2ascii getallheaders virtual contained +syn keyword phpFunctions array_change_key_case array_chunk array_column array_combine array_count_values array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_diff array_fill_keys array_fill array_filter array_flip array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_replace_recursive array_replace array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_uintersect_assoc array_uintersect_uassoc array_uintersect array_unique array_unshift array_values array_walk_recursive array_walk arsort asort count current each end in_array key_exists key krsort ksort natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained +syn keyword phpFunctions aspell_check aspell_new aspell_suggest contained +syn keyword phpFunctions bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub contained +syn keyword phpFunctions bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite contained +syn keyword phpFunctions cal_days_in_month cal_from_jd cal_info cal_to_jd easter_date easter_days frenchtojd gregoriantojd jddayofweek jdmonthname jdtofrench jdtogregorian jdtojewish jdtojulian jdtounix jewishtojd juliantojd unixtojd contained +syn keyword phpFunctions ccvs_add ccvs_auth ccvs_command ccvs_count ccvs_delete ccvs_done ccvs_init ccvs_lookup ccvs_new ccvs_report ccvs_return ccvs_reverse ccvs_sale ccvs_status ccvs_textvalue ccvs_void contained +syn keyword phpFunctions call_user_method_array call_user_method class_exists get_class_methods get_class_vars get_class get_declared_classes get_object_vars get_parent_class is_a is_subclass_of method_exists contained +syn keyword phpFunctions com VARIANT com_addref com_get com_invoke com_isenum com_load_typelib com_load com_propget com_propput com_propset com_release com_set contained +syn keyword phpFunctions cpdf_add_annotation cpdf_add_outline cpdf_arc cpdf_begin_text cpdf_circle cpdf_clip cpdf_close cpdf_closepath_fill_stroke cpdf_closepath_stroke cpdf_closepath cpdf_continue_text cpdf_curveto cpdf_end_text cpdf_fill_stroke cpdf_fill cpdf_finalize_page cpdf_finalize cpdf_global_set_document_limits cpdf_import_jpeg cpdf_lineto cpdf_moveto cpdf_newpath cpdf_open cpdf_output_buffer cpdf_page_init cpdf_place_inline_image cpdf_rect cpdf_restore cpdf_rlineto cpdf_rmoveto cpdf_rotate_text cpdf_rotate cpdf_save_to_file cpdf_save cpdf_scale cpdf_set_action_url cpdf_set_char_spacing cpdf_set_creator cpdf_set_current_page cpdf_set_font_directories cpdf_set_font_map_file cpdf_set_font cpdf_set_horiz_scaling cpdf_set_keywords cpdf_set_leading cpdf_set_page_animation cpdf_set_subject cpdf_set_text_matrix cpdf_set_text_pos cpdf_set_text_rendering cpdf_set_text_rise cpdf_set_title cpdf_set_viewer_preferences cpdf_set_word_spacing cpdf_setdash cpdf_setflat cpdf_setgray_fill cpdf_setgray_stroke cpdf_setgray cpdf_setlinecap cpdf_setlinejoin cpdf_setlinewidth cpdf_setmiterlimit cpdf_setrgbcolor_fill cpdf_setrgbcolor_stroke cpdf_setrgbcolor cpdf_show_xy cpdf_show cpdf_stringwidth cpdf_stroke cpdf_text cpdf_translate contained +syn keyword phpFunctions crack_check crack_closedict crack_getlastmessage crack_opendict contained +syn keyword phpFunctions ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_graph ctype_lower ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit contained +syn keyword phpFunctions curl_close curl_errno curl_error curl_exec curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_setopt curl_version contained +syn keyword phpFunctions cybercash_base64_decode cybercash_base64_encode cybercash_decr cybercash_encr contained +syn keyword phpFunctions cyrus_authenticate cyrus_bind cyrus_close cyrus_connect cyrus_query cyrus_unbind contained +syn keyword phpFunctions checkdate date getdate gettimeofday gmdate gmmktime gmstrftime localtime microtime mktime strftime strtotime time contained +syn keyword phpFunctions dba_close dba_delete dba_exists dba_fetch dba_firstkey dba_handlers dba_insert dba_key_split dba_list dba_nextkey dba_open dba_optimize dba_popen dba_replace dba_sync contained +syn keyword phpFunctions dbase_add_record dbase_close dbase_create dbase_delete_record dbase_get_header_info dbase_get_record_with_names dbase_get_record dbase_numfields dbase_numrecords dbase_open dbase_pack dbase_replace_record contained +syn keyword phpFunctions dblist dbmclose dbmdelete dbmexists dbmfetch dbmfirstkey dbminsert dbmnextkey dbmopen dbmreplace contained +syn keyword phpFunctions dbplus_add dbplus_aql dbplus_chdir dbplus_close dbplus_curr dbplus_errcode dbplus_errno dbplus_find dbplus_first dbplus_flush dbplus_freealllocks dbplus_freelock dbplus_freerlocks dbplus_getlock dbplus_getunique dbplus_info dbplus_last dbplus_lockrel dbplus_next dbplus_open dbplus_prev dbplus_rchperm dbplus_rcreate dbplus_rcrtexact dbplus_rcrtlike dbplus_resolve dbplus_restorepos dbplus_rkeys dbplus_ropen dbplus_rquery dbplus_rrename dbplus_rsecindex dbplus_runlink dbplus_rzap dbplus_savepos dbplus_setindex dbplus_setindexbynumber dbplus_sql dbplus_tcl dbplus_tremove dbplus_undo dbplus_undoprepare dbplus_unlockrel dbplus_unselect dbplus_update dbplus_xlockrel dbplus_xunlockrel contained +syn keyword phpFunctions dbx_close dbx_compare dbx_connect dbx_error dbx_escape_string dbx_fetch_row dbx_query dbx_sort contained +syn keyword phpFunctions dio_close dio_fcntl dio_open dio_read dio_seek dio_stat dio_tcsetattr dio_truncate dio_write contained +syn keyword phpFunctions chdir chroot dir closedir getcwd opendir readdir rewinddir scandir contained +syn keyword phpFunctions domxml_new_doc domxml_open_file domxml_open_mem domxml_version domxml_xmltree domxml_xslt_stylesheet_doc domxml_xslt_stylesheet_file domxml_xslt_stylesheet xpath_eval_expression xpath_eval xpath_new_context xptr_eval xptr_new_context contained +syn keyword phpMethods name specified value create_attribute create_cdata_section create_comment create_element_ns create_element create_entity_reference create_processing_instruction create_text_node doctype document_element dump_file dump_mem get_element_by_id get_elements_by_tagname html_dump_mem xinclude entities internal_subset name notations public_id system_id get_attribute_node get_attribute get_elements_by_tagname has_attribute remove_attribute set_attribute tagname add_namespace append_child append_sibling attributes child_nodes clone_node dump_node first_child get_content has_attributes has_child_nodes insert_before is_blank_node last_child next_sibling node_name node_type node_value owner_document parent_node prefix previous_sibling remove_child replace_child replace_node set_content set_name set_namespace unlink_node data target process result_dump_file result_dump_mem contained +syn keyword phpFunctions dotnet_load contained +syn keyword phpFunctions debug_backtrace debug_print_backtrace error_log error_reporting restore_error_handler set_error_handler trigger_error user_error contained +syn keyword phpFunctions escapeshellarg escapeshellcmd exec passthru proc_close proc_get_status proc_nice proc_open proc_terminate shell_exec system contained +syn keyword phpFunctions fam_cancel_monitor fam_close fam_monitor_collection fam_monitor_directory fam_monitor_file fam_next_event fam_open fam_pending fam_resume_monitor fam_suspend_monitor contained +syn keyword phpFunctions fbsql_affected_rows fbsql_autocommit fbsql_change_user fbsql_close fbsql_commit fbsql_connect fbsql_create_blob fbsql_create_clob fbsql_create_db fbsql_data_seek fbsql_database_password fbsql_database fbsql_db_query fbsql_db_status fbsql_drop_db fbsql_errno fbsql_error fbsql_fetch_array fbsql_fetch_assoc fbsql_fetch_field fbsql_fetch_lengths fbsql_fetch_object fbsql_fetch_row fbsql_field_flags fbsql_field_len fbsql_field_name fbsql_field_seek fbsql_field_table fbsql_field_type fbsql_free_result fbsql_get_autostart_info fbsql_hostname fbsql_insert_id fbsql_list_dbs fbsql_list_fields fbsql_list_tables fbsql_next_result fbsql_num_fields fbsql_num_rows fbsql_password fbsql_pconnect fbsql_query fbsql_read_blob fbsql_read_clob fbsql_result fbsql_rollback fbsql_select_db fbsql_set_lob_mode fbsql_set_transaction fbsql_start_db fbsql_stop_db fbsql_tablename fbsql_username fbsql_warnings contained +syn keyword phpFunctions fdf_add_doc_javascript fdf_add_template fdf_close fdf_create fdf_enum_values fdf_errno fdf_error fdf_get_ap fdf_get_attachment fdf_get_encoding fdf_get_file fdf_get_flags fdf_get_opt fdf_get_status fdf_get_value fdf_get_version fdf_header fdf_next_field_name fdf_open_string fdf_open fdf_remove_item fdf_save_string fdf_save fdf_set_ap fdf_set_encoding fdf_set_file fdf_set_flags fdf_set_javascript_action fdf_set_opt fdf_set_status fdf_set_submit_form_action fdf_set_target_frame fdf_set_value fdf_set_version contained +syn keyword phpFunctions filepro_fieldcount filepro_fieldname filepro_fieldtype filepro_fieldwidth filepro_retrieve filepro_rowcount filepro contained +syn keyword phpFunctions basename chgrp chmod chown clearstatcache copy delete dirname disk_free_space disk_total_space diskfreespace fclose feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents file fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype flock fnmatch fopen fpassthru fputs fread fscanf fseek fstat ftell ftruncate fwrite glob is_dir is_executable is_file is_link is_readable is_uploaded_file is_writable is_writeable link linkinfo lstat mkdir move_uploaded_file parse_ini_file pathinfo pclose popen readfile readlink realpath rename rewind rmdir set_file_buffer stat symlink tempnam tmpfile touch umask unlink contained +syn keyword phpFunctions fribidi_log2vis contained +syn keyword phpFunctions ftp_alloc ftp_cdup ftp_chdir ftp_chmod ftp_close ftp_connect ftp_delete ftp_exec ftp_fget ftp_fput ftp_get_option ftp_get ftp_login ftp_mdtm ftp_mkdir ftp_nb_continue ftp_nb_fget ftp_nb_fput ftp_nb_get ftp_nb_put ftp_nlist ftp_pasv ftp_put ftp_pwd ftp_quit ftp_raw ftp_rawlist ftp_rename ftp_rmdir ftp_set_option ftp_site ftp_size ftp_ssl_connect ftp_systype contained +syn keyword phpFunctions call_user_func_array call_user_func create_function func_get_arg func_get_args func_num_args function_exists get_defined_functions register_shutdown_function register_tick_function unregister_tick_function contained +syn keyword phpFunctions bind_textdomain_codeset bindtextdomain dcgettext dcngettext dgettext dngettext gettext ngettext textdomain contained +syn keyword phpFunctions gmp_abs gmp_add gmp_and gmp_clrbit gmp_cmp gmp_com gmp_div_q gmp_div_qr gmp_div_r gmp_div gmp_divexact gmp_fact gmp_gcd gmp_gcdext gmp_hamdist gmp_init gmp_intval gmp_invert gmp_jacobi gmp_legendre gmp_mod gmp_mul gmp_neg gmp_or gmp_perfect_square gmp_popcount gmp_pow gmp_powm gmp_prob_prime gmp_random gmp_scan0 gmp_scan1 gmp_setbit gmp_sign gmp_sqrt gmp_sqrtrem gmp_sqrtrm gmp_strval gmp_sub gmp_xor contained +syn keyword phpFunctions header headers_list headers_sent setcookie contained +syn keyword phpFunctions hw_api_attribute hwapi_hgcsp hw_api_content hw_api_object contained +syn keyword phpMethods key langdepvalue value values checkin checkout children mimetype read content copy dbstat dcstat dstanchors dstofsrcanchors count reason find ftstat hwstat identify info insert insertanchor insertcollection insertdocument link lock move assign attreditable count insert remove title value object objectbyanchor parents description type remove replace setcommitedversion srcanchors srcsofdst unlock user userlist contained +syn keyword phpFunctions hw_Array2Objrec hw_changeobject hw_Children hw_ChildrenObj hw_Close hw_Connect hw_connection_info hw_cp hw_Deleteobject hw_DocByAnchor hw_DocByAnchorObj hw_Document_Attributes hw_Document_BodyTag hw_Document_Content hw_Document_SetContent hw_Document_Size hw_dummy hw_EditText hw_Error hw_ErrorMsg hw_Free_Document hw_GetAnchors hw_GetAnchorsObj hw_GetAndLock hw_GetChildColl hw_GetChildCollObj hw_GetChildDocColl hw_GetChildDocCollObj hw_GetObject hw_GetObjectByQuery hw_GetObjectByQueryColl hw_GetObjectByQueryCollObj hw_GetObjectByQueryObj hw_GetParents hw_GetParentsObj hw_getrellink hw_GetRemote hw_getremotechildren hw_GetSrcByDestObj hw_GetText hw_getusername hw_Identify hw_InCollections hw_Info hw_InsColl hw_InsDoc hw_insertanchors hw_InsertDocument hw_InsertObject hw_mapid hw_Modifyobject hw_mv hw_New_Document hw_objrec2array hw_Output_Document hw_pConnect hw_PipeDocument hw_Root hw_setlinkroot hw_stat hw_Unlock hw_Who contained +syn keyword phpFunctions ibase_add_user ibase_affected_rows ibase_blob_add ibase_blob_cancel ibase_blob_close ibase_blob_create ibase_blob_echo ibase_blob_get ibase_blob_import ibase_blob_info ibase_blob_open ibase_close ibase_commit_ret ibase_commit ibase_connect ibase_delete_user ibase_drop_db ibase_errcode ibase_errmsg ibase_execute ibase_fetch_assoc ibase_fetch_object ibase_fetch_row ibase_field_info ibase_free_event_handler ibase_free_query ibase_free_result ibase_gen_id ibase_modify_user ibase_name_result ibase_num_fields ibase_num_params ibase_param_info ibase_pconnect ibase_prepare ibase_query ibase_rollback_ret ibase_rollback ibase_set_event_handler ibase_timefmt ibase_trans ibase_wait_event contained +syn keyword phpFunctions iconv_get_encoding iconv_mime_decode_headers iconv_mime_decode iconv_mime_encode iconv_set_encoding iconv_strlen iconv_strpos iconv_strrpos iconv_substr iconv ob_iconv_handler contained +syn keyword phpFunctions ifx_affected_rows ifx_blobinfile_mode ifx_byteasvarchar ifx_close ifx_connect ifx_copy_blob ifx_create_blob ifx_create_char ifx_do ifx_error ifx_errormsg ifx_fetch_row ifx_fieldproperties ifx_fieldtypes ifx_free_blob ifx_free_char ifx_free_result ifx_get_blob ifx_get_char ifx_getsqlca ifx_htmltbl_result ifx_nullformat ifx_num_fields ifx_num_rows ifx_pconnect ifx_prepare ifx_query ifx_textasvarchar ifx_update_blob ifx_update_char ifxus_close_slob ifxus_create_slob ifxus_free_slob ifxus_open_slob ifxus_read_slob ifxus_seek_slob ifxus_tell_slob ifxus_write_slob contained +syn keyword phpFunctions exif_imagetype exif_read_data exif_thumbnail gd_info getimagesize image_type_to_mime_type image2wbmp imagealphablending imageantialias imagearc imagechar imagecharup imagecolorallocate imagecolorallocatealpha imagecolorat imagecolorclosest imagecolorclosestalpha imagecolorclosesthwb imagecolordeallocate imagecolorexact imagecolorexactalpha imagecolormatch imagecolorresolve imagecolorresolvealpha imagecolorset imagecolorsforindex imagecolorstotal imagecolortransparent imagecopy imagecopymerge imagecopymergegray imagecopyresampled imagecopyresized imagecreate imagecreatefromgd2 imagecreatefromgd2part imagecreatefromgd imagecreatefromgif imagecreatefromjpeg imagecreatefrompng imagecreatefromstring imagecreatefromwbmp imagecreatefromxbm imagecreatefromxpm imagecreatetruecolor imagedashedline imagedestroy imageellipse imagefill imagefilledarc imagefilledellipse imagefilledpolygon imagefilledrectangle imagefilltoborder imagefontheight imagefontwidth imageftbbox imagefttext imagegammacorrect imagegd2 imagegd imagegif imageinterlace imageistruecolor imagejpeg imageline imageloadfont imagepalettecopy imagepng imagepolygon imagepsbbox imagepscopyfont imagepsencodefont imagepsextendfont imagepsfreefont imagepsloadfont imagepsslantfont imagepstext imagerectangle imagerotate imagesavealpha imagesetbrush imagesetpixel imagesetstyle imagesetthickness imagesettile imagestring imagestringup imagesx imagesy imagetruecolortopalette imagettfbbox imagettftext imagetypes imagewbmp iptcembed iptcparse jpeg2wbmp png2wbmp read_exif_data contained +syn keyword phpFunctions imap_8bit imap_alerts imap_append imap_base64 imap_binary imap_body imap_bodystruct imap_check imap_clearflag_full imap_close imap_createmailbox imap_delete imap_deletemailbox imap_errors imap_expunge imap_fetch_overview imap_fetchbody imap_fetchheader imap_fetchstructure imap_get_quota imap_get_quotaroot imap_getacl imap_getmailboxes imap_getsubscribed imap_header imap_headerinfo imap_headers imap_last_error imap_list imap_listmailbox imap_listscan imap_listsubscribed imap_lsub imap_mail_compose imap_mail_copy imap_mail_move imap_mail imap_mailboxmsginfo imap_mime_header_decode imap_msgno imap_num_msg imap_num_recent imap_open imap_ping imap_qprint imap_renamemailbox imap_reopen imap_rfc822_parse_adrlist imap_rfc822_parse_headers imap_rfc822_write_address imap_scanmailbox imap_search imap_set_quota imap_setacl imap_setflag_full imap_sort imap_status imap_subscribe imap_thread imap_timeout imap_uid imap_undelete imap_unsubscribe imap_utf7_decode imap_utf7_encode imap_utf8 contained +syn keyword phpFunctions assert_options assert dl extension_loaded get_cfg_var get_current_user get_defined_constants get_extension_funcs get_include_path get_included_files get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_required_files getenv getlastmod getmygid getmyinode getmypid getmyuid getopt getrusage ini_alter ini_get_all ini_get ini_restore ini_set main memory_get_usage php_ini_scanned_files php_logo_guid php_sapi_name php_uname phpcredits phpinfo phpversion putenv restore_include_path set_include_path set_magic_quotes_runtime set_time_limit version_compare zend_logo_guid zend_version contained +syn keyword phpFunctions ingres_autocommit ingres_close ingres_commit ingres_connect ingres_fetch_array ingres_fetch_object ingres_fetch_row ingres_field_length ingres_field_name ingres_field_nullable ingres_field_precision ingres_field_scale ingres_field_type ingres_num_fields ingres_num_rows ingres_pconnect ingres_query ingres_rollback contained +syn keyword phpFunctions ircg_channel_mode ircg_disconnect ircg_fetch_error_msg ircg_get_username ircg_html_encode ircg_ignore_add ircg_ignore_del ircg_is_conn_alive ircg_join ircg_kick ircg_lookup_format_messages ircg_msg ircg_nick ircg_nickname_escape ircg_nickname_unescape ircg_notice ircg_part ircg_pconnect ircg_register_format_messages ircg_set_current ircg_set_file ircg_set_on_die ircg_topic ircg_whois contained +syn keyword phpFunctions java_last_exception_clear java_last_exception_get contained +syn keyword phpFunctions json_decode json_encode json_last_error contained +syn keyword phpFunctions ldap_8859_to_t61 ldap_add ldap_bind ldap_close ldap_compare ldap_connect ldap_count_entries ldap_delete ldap_dn2ufn ldap_err2str ldap_errno ldap_error ldap_explode_dn ldap_first_attribute ldap_first_entry ldap_first_reference ldap_free_result ldap_get_attributes ldap_get_dn ldap_get_entries ldap_get_option ldap_get_values_len ldap_get_values ldap_list ldap_mod_add ldap_mod_del ldap_mod_replace ldap_modify ldap_next_attribute ldap_next_entry ldap_next_reference ldap_parse_reference ldap_parse_result ldap_read ldap_rename ldap_search ldap_set_option ldap_set_rebind_proc ldap_sort ldap_start_tls ldap_t61_to_8859 ldap_unbind contained +syn keyword phpFunctions lzf_compress lzf_decompress lzf_optimized_for contained +syn keyword phpFunctions ezmlm_hash mail contained +syn keyword phpFunctions mailparse_determine_best_xfer_encoding mailparse_msg_create mailparse_msg_extract_part_file mailparse_msg_extract_part mailparse_msg_free mailparse_msg_get_part_data mailparse_msg_get_part mailparse_msg_get_structure mailparse_msg_parse_file mailparse_msg_parse mailparse_rfc822_parse_addresses mailparse_stream_encode mailparse_uudecode_all contained +syn keyword phpFunctions abs acos acosh asin asinh atan2 atan atanh base_convert bindec ceil cos cosh decbin dechex decoct deg2rad exp expm1 floor fmod getrandmax hexdec hypot is_finite is_infinite is_nan lcg_value log10 log1p log max min mt_getrandmax mt_rand mt_srand octdec pi pow rad2deg rand round sin sinh sqrt srand tan tanh contained +syn keyword phpFunctions mb_convert_case mb_convert_encoding mb_convert_kana mb_convert_variables mb_decode_mimeheader mb_decode_numericentity mb_detect_encoding mb_detect_order mb_encode_mimeheader mb_encode_numericentity mb_ereg_match mb_ereg_replace mb_ereg_search_getpos mb_ereg_search_getregs mb_ereg_search_init mb_ereg_search_pos mb_ereg_search_regs mb_ereg_search_setpos mb_ereg_search mb_ereg mb_eregi_replace mb_eregi mb_get_info mb_http_input mb_http_output mb_internal_encoding mb_language mb_output_handler mb_parse_str mb_preferred_mime_name mb_regex_encoding mb_regex_set_options mb_send_mail mb_split mb_strcut mb_strimwidth mb_strlen mb_strpos mb_strrpos mb_strtolower mb_strtoupper mb_strwidth mb_substitute_character mb_substr_count mb_substr contained +syn keyword phpFunctions mcal_append_event mcal_close mcal_create_calendar mcal_date_compare mcal_date_valid mcal_day_of_week mcal_day_of_year mcal_days_in_month mcal_delete_calendar mcal_delete_event mcal_event_add_attribute mcal_event_init mcal_event_set_alarm mcal_event_set_category mcal_event_set_class mcal_event_set_description mcal_event_set_end mcal_event_set_recur_daily mcal_event_set_recur_monthly_mday mcal_event_set_recur_monthly_wday mcal_event_set_recur_none mcal_event_set_recur_weekly mcal_event_set_recur_yearly mcal_event_set_start mcal_event_set_title mcal_expunge mcal_fetch_current_stream_event mcal_fetch_event mcal_is_leap_year mcal_list_alarms mcal_list_events mcal_next_recurrence mcal_open mcal_popen mcal_rename_calendar mcal_reopen mcal_snooze mcal_store_event mcal_time_valid mcal_week_of_year contained +syn keyword phpFunctions mcrypt_cbc mcrypt_cfb mcrypt_create_iv mcrypt_decrypt mcrypt_ecb mcrypt_enc_get_algorithms_name mcrypt_enc_get_block_size mcrypt_enc_get_iv_size mcrypt_enc_get_key_size mcrypt_enc_get_modes_name mcrypt_enc_get_supported_key_sizes mcrypt_enc_is_block_algorithm_mode mcrypt_enc_is_block_algorithm mcrypt_enc_is_block_mode mcrypt_enc_self_test mcrypt_encrypt mcrypt_generic_deinit mcrypt_generic_end mcrypt_generic_init mcrypt_generic mcrypt_get_block_size mcrypt_get_cipher_name mcrypt_get_iv_size mcrypt_get_key_size mcrypt_list_algorithms mcrypt_list_modes mcrypt_module_close mcrypt_module_get_algo_block_size mcrypt_module_get_algo_key_size mcrypt_module_get_supported_key_sizes mcrypt_module_is_block_algorithm_mode mcrypt_module_is_block_algorithm mcrypt_module_is_block_mode mcrypt_module_open mcrypt_module_self_test mcrypt_ofb mdecrypt_generic contained +syn keyword phpFunctions mcve_adduser mcve_adduserarg mcve_bt mcve_checkstatus mcve_chkpwd mcve_chngpwd mcve_completeauthorizations mcve_connect mcve_connectionerror mcve_deleteresponse mcve_deletetrans mcve_deleteusersetup mcve_deluser mcve_destroyconn mcve_destroyengine mcve_disableuser mcve_edituser mcve_enableuser mcve_force mcve_getcell mcve_getcellbynum mcve_getcommadelimited mcve_getheader mcve_getuserarg mcve_getuserparam mcve_gft mcve_gl mcve_gut mcve_initconn mcve_initengine mcve_initusersetup mcve_iscommadelimited mcve_liststats mcve_listusers mcve_maxconntimeout mcve_monitor mcve_numcolumns mcve_numrows mcve_override mcve_parsecommadelimited mcve_ping mcve_preauth mcve_preauthcompletion mcve_qc mcve_responseparam mcve_return mcve_returncode mcve_returnstatus mcve_sale mcve_setblocking mcve_setdropfile mcve_setip mcve_setssl_files mcve_setssl mcve_settimeout mcve_settle mcve_text_avs mcve_text_code mcve_text_cv mcve_transactionauth mcve_transactionavs mcve_transactionbatch mcve_transactioncv mcve_transactionid mcve_transactionitem mcve_transactionssent mcve_transactiontext mcve_transinqueue mcve_transnew mcve_transparam mcve_transsend mcve_ub mcve_uwait mcve_verifyconnection mcve_verifysslcert mcve_void contained +syn keyword phpFunctions mhash_count mhash_get_block_size mhash_get_hash_name mhash_keygen_s2k mhash contained +syn keyword phpFunctions mime_content_type contained +syn keyword phpFunctions ming_setcubicthreshold ming_setscale ming_useswfversion SWFAction SWFBitmap swfbutton_keypress SWFbutton SWFDisplayItem SWFFill SWFFont SWFGradient SWFMorph SWFMovie SWFShape SWFSprite SWFText SWFTextField contained +syn keyword phpMethods getHeight getWidth addAction addShape setAction setdown setHit setOver setUp addColor move moveTo multColor remove Rotate rotateTo scale scaleTo setDepth setName setRatio skewX skewXTo skewY skewYTo moveTo rotateTo scaleTo skewXTo skewYTo getwidth addEntry getshape1 getshape2 add nextframe output remove save setbackground setdimension setframes setrate streammp3 addFill drawCurve drawCurveTo drawLine drawLineTo movePen movePenTo setLeftFill setLine setRightFill add nextframe remove setframes addString getWidth moveTo setColor setFont setHeight setSpacing addstring align setbounds setcolor setFont setHeight setindentation setLeftMargin setLineSpacing setMargins setname setrightMargin contained +syn keyword phpFunctions connection_aborted connection_status connection_timeout constant define defined die eval exit get_browser highlight_file highlight_string ignore_user_abort pack show_source sleep uniqid unpack usleep contained +syn keyword phpFunctions udm_add_search_limit udm_alloc_agent udm_api_version udm_cat_list udm_cat_path udm_check_charset udm_check_stored udm_clear_search_limits udm_close_stored udm_crc32 udm_errno udm_error udm_find udm_free_agent udm_free_ispell_data udm_free_res udm_get_doc_count udm_get_res_field udm_get_res_param udm_load_ispell_data udm_open_stored udm_set_agent_param contained +syn keyword phpFunctions msession_connect msession_count msession_create msession_destroy msession_disconnect msession_find msession_get_array msession_get msession_getdata msession_inc msession_list msession_listvar msession_lock msession_plugin msession_randstr msession_set_array msession_set msession_setdata msession_timeout msession_uniq msession_unlock contained +syn keyword phpFunctions msql_affected_rows msql_close msql_connect msql_create_db msql_createdb msql_data_seek msql_dbname msql_drop_db msql_dropdb msql_error msql_fetch_array msql_fetch_field msql_fetch_object msql_fetch_row msql_field_seek msql_fieldflags msql_fieldlen msql_fieldname msql_fieldtable msql_fieldtype msql_free_result msql_freeresult msql_list_dbs msql_list_fields msql_list_tables msql_listdbs msql_listfields msql_listtables msql_num_fields msql_num_rows msql_numfields msql_numrows msql_pconnect msql_query msql_regcase msql_result msql_select_db msql_selectdb msql_tablename msql contained +syn keyword phpFunctions mssql_bind mssql_close mssql_connect mssql_data_seek mssql_execute mssql_fetch_array mssql_fetch_assoc mssql_fetch_batch mssql_fetch_field mssql_fetch_object mssql_fetch_row mssql_field_length mssql_field_name mssql_field_seek mssql_field_type mssql_free_result mssql_free_statement mssql_get_last_message mssql_guid_string mssql_init mssql_min_error_severity mssql_min_message_severity mssql_next_result mssql_num_fields mssql_num_rows mssql_pconnect mssql_query mssql_result mssql_rows_affected mssql_select_db contained +syn keyword phpFunctions muscat_close muscat_get muscat_give muscat_setup_net muscat_setup contained +syn keyword phpFunctions mysql_affected_rows mysql_change_user mysql_client_encoding mysql_close mysql_connect mysql_create_db mysql_data_seek mysql_db_name mysql_db_query mysql_drop_db mysql_errno mysql_error mysql_escape_string mysql_fetch_array mysql_fetch_assoc mysql_fetch_field mysql_fetch_lengths mysql_fetch_object mysql_fetch_row mysql_field_flags mysql_field_len mysql_field_name mysql_field_seek mysql_field_table mysql_field_type mysql_free_result mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql_insert_id mysql_list_dbs mysql_list_fields mysql_list_processes mysql_list_tables mysql_num_fields mysql_num_rows mysql_pconnect mysql_ping mysql_query mysql_real_escape_string mysql_result mysql_select_db mysql_stat mysql_tablename mysql_thread_id mysql_unbuffered_query contained +syn keyword phpFunctions mysqli_affected_rows mysqli_autocommit mysqli_bind_param mysqli_bind_result mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect mysqli_data_seek mysqli_debug mysqli_disable_reads_from_master mysqli_disable_rpl_parse mysqli_dump_debug_info mysqli_enable_reads_from_master mysqli_enable_rpl_parse mysqli_errno mysqli_error mysqli_execute mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_fetch mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_client_info mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_master_query mysqli_num_fields mysqli_num_rows mysqli_options mysqli_param_count mysqli_ping mysqli_prepare_result mysqli_prepare mysqli_profiler mysqli_query mysqli_read_query_result mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reload mysqli_rollback mysqli_rpl_parse_enabled mysqli_rpl_probe mysqli_rpl_query_type mysqli_select_db mysqli_send_long_data mysqli_send_query mysqli_slave_query mysqli_ssl_set mysqli_stat mysqli_stmt_affected_rows mysqli_stmt_close mysqli_stmt_errno mysqli_stmt_error mysqli_stmt_store_result mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count contained +syn keyword phpFunctions ncurses_addch ncurses_addchnstr ncurses_addchstr ncurses_addnstr ncurses_addstr ncurses_assume_default_colors ncurses_attroff ncurses_attron ncurses_attrset ncurses_baudrate ncurses_beep ncurses_bkgd ncurses_bkgdset ncurses_border ncurses_bottom_panel ncurses_can_change_color ncurses_cbreak ncurses_clear ncurses_clrtobot ncurses_clrtoeol ncurses_color_content ncurses_color_set ncurses_curs_set ncurses_def_prog_mode ncurses_def_shell_mode ncurses_define_key ncurses_del_panel ncurses_delay_output ncurses_delch ncurses_deleteln ncurses_delwin ncurses_doupdate ncurses_echo ncurses_echochar ncurses_end ncurses_erase ncurses_erasechar ncurses_filter ncurses_flash ncurses_flushinp ncurses_getch ncurses_getmaxyx ncurses_getmouse ncurses_getyx ncurses_halfdelay ncurses_has_colors ncurses_has_ic ncurses_has_il ncurses_has_key ncurses_hide_panel ncurses_hline ncurses_inch ncurses_init_color ncurses_init_pair ncurses_init ncurses_insch ncurses_insdelln ncurses_insertln ncurses_insstr ncurses_instr ncurses_isendwin ncurses_keyok ncurses_keypad ncurses_killchar ncurses_longname ncurses_meta ncurses_mouse_trafo ncurses_mouseinterval ncurses_mousemask ncurses_move_panel ncurses_move ncurses_mvaddch ncurses_mvaddchnstr ncurses_mvaddchstr ncurses_mvaddnstr ncurses_mvaddstr ncurses_mvcur ncurses_mvdelch ncurses_mvgetch ncurses_mvhline ncurses_mvinch ncurses_mvvline ncurses_mvwaddstr ncurses_napms ncurses_new_panel ncurses_newpad ncurses_newwin ncurses_nl ncurses_nocbreak ncurses_noecho ncurses_nonl ncurses_noqiflush ncurses_noraw ncurses_pair_content ncurses_panel_above ncurses_panel_below ncurses_panel_window ncurses_pnoutrefresh ncurses_prefresh ncurses_putp ncurses_qiflush ncurses_raw ncurses_refresh ncurses_replace_panel ncurses_reset_prog_mode ncurses_reset_shell_mode ncurses_resetty ncurses_savetty ncurses_scr_dump ncurses_scr_init ncurses_scr_restore ncurses_scr_set ncurses_scrl ncurses_show_panel ncurses_slk_attr ncurses_slk_attroff ncurses_slk_attron ncurses_slk_attrset ncurses_slk_clear ncurses_slk_color ncurses_slk_init ncurses_slk_noutrefresh ncurses_slk_refresh ncurses_slk_restore ncurses_slk_set ncurses_slk_touch ncurses_standend ncurses_standout ncurses_start_color ncurses_termattrs ncurses_termname ncurses_timeout ncurses_top_panel ncurses_typeahead ncurses_ungetch ncurses_ungetmouse ncurses_update_panels ncurses_use_default_colors ncurses_use_env ncurses_use_extended_names ncurses_vidattr ncurses_vline ncurses_waddch ncurses_waddstr ncurses_wattroff ncurses_wattron ncurses_wattrset ncurses_wborder ncurses_wclear ncurses_wcolor_set ncurses_werase ncurses_wgetch ncurses_whline ncurses_wmouse_trafo ncurses_wmove ncurses_wnoutrefresh ncurses_wrefresh ncurses_wstandend ncurses_wstandout ncurses_wvline contained +syn keyword phpFunctions checkdnsrr closelog debugger_off debugger_on define_syslog_variables dns_check_record dns_get_mx dns_get_record fsockopen gethostbyaddr gethostbyname gethostbynamel getmxrr getprotobyname getprotobynumber getservbyname getservbyport ip2long long2ip openlog pfsockopen socket_get_status socket_set_blocking socket_set_timeout syslog contained +syn keyword phpFunctions yp_all yp_cat yp_err_string yp_errno yp_first yp_get_default_domain yp_master yp_match yp_next yp_order contained +syn keyword phpFunctions notes_body notes_copy_db notes_create_db notes_create_note notes_drop_db notes_find_note notes_header_info notes_list_msgs notes_mark_read notes_mark_unread notes_nav_create notes_search notes_unread notes_version contained +syn keyword phpFunctions nsapi_request_headers nsapi_response_headers nsapi_virtual contained +syn keyword phpFunctions aggregate_info aggregate_methods_by_list aggregate_methods_by_regexp aggregate_methods aggregate_properties_by_list aggregate_properties_by_regexp aggregate_properties aggregate aggregation_info deaggregate contained +syn keyword phpFunctions ocibindbyname ocicancel ocicloselob ocicollappend ocicollassign ocicollassignelem ocicollgetelem ocicollmax ocicollsize ocicolltrim ocicolumnisnull ocicolumnname ocicolumnprecision ocicolumnscale ocicolumnsize ocicolumntype ocicolumntyperaw ocicommit ocidefinebyname ocierror ociexecute ocifetch ocifetchinto ocifetchstatement ocifreecollection ocifreecursor ocifreedesc ocifreestatement ociinternaldebug ociloadlob ocilogoff ocilogon ocinewcollection ocinewcursor ocinewdescriptor ocinlogon ocinumcols ociparse ociplogon ociresult ocirollback ocirowcount ocisavelob ocisavelobfile ociserverversion ocisetprefetch ocistatementtype ociwritelobtofile ociwritetemporarylob contained +syn keyword phpFunctions odbc_autocommit odbc_binmode odbc_close_all odbc_close odbc_columnprivileges odbc_columns odbc_commit odbc_connect odbc_cursor odbc_data_source odbc_do odbc_error odbc_errormsg odbc_exec odbc_execute odbc_fetch_array odbc_fetch_into odbc_fetch_object odbc_fetch_row odbc_field_len odbc_field_name odbc_field_num odbc_field_precision odbc_field_scale odbc_field_type odbc_foreignkeys odbc_free_result odbc_gettypeinfo odbc_longreadlen odbc_next_result odbc_num_fields odbc_num_rows odbc_pconnect odbc_prepare odbc_primarykeys odbc_procedurecolumns odbc_procedures odbc_result_all odbc_result odbc_rollback odbc_setoption odbc_specialcolumns odbc_statistics odbc_tableprivileges odbc_tables contained +syn keyword phpFunctions openssl_cipher_iv_length openssl_csr_export_to_file openssl_csr_export openssl_csr_get_public_key openssl_csr_get_subject openssl_csr_new openssl_csr_sign openssl_decrypt openssl_dh_compute_key openssl_digest openssl_encrypt openssl_error_string openssl_free_key openssl_get_cert_locations openssl_get_cipher_methods openssl_get_md_methods openssl_get_privatekey openssl_get_publickey openssl_open openssl_pbkdf2 openssl_pkcs12_export_to_file openssl_pkcs12_export openssl_pkcs12_read openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export_to_file openssl_pkey_export openssl_pkey_free openssl_pkey_get_details openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_random_pseudo_bytes openssl_seal openssl_sign openssl_spki_export_challenge openssl_spki_export openssl_spki_new openssl_spki_verify openssl_verify openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export_to_file openssl_x509_export openssl_x509_fingerprint openssl_x509_free openssl_x509_parse openssl_x509_read contained +syn keyword phpFunctions ora_bind ora_close ora_columnname ora_columnsize ora_columntype ora_commit ora_commitoff ora_commiton ora_do ora_error ora_errorcode ora_exec ora_fetch_into ora_fetch ora_getcolumn ora_logoff ora_logon ora_numcols ora_numrows ora_open ora_parse ora_plogon ora_rollback contained +syn keyword phpFunctions flush ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_get_status ob_gzhandler ob_implicit_flush ob_list_handlers ob_start output_add_rewrite_var output_reset_rewrite_vars contained +syn keyword phpFunctions overload contained +syn keyword phpFunctions ovrimos_close ovrimos_commit ovrimos_connect ovrimos_cursor ovrimos_exec ovrimos_execute ovrimos_fetch_into ovrimos_fetch_row ovrimos_field_len ovrimos_field_name ovrimos_field_num ovrimos_field_type ovrimos_free_result ovrimos_longreadlen ovrimos_num_fields ovrimos_num_rows ovrimos_prepare ovrimos_result_all ovrimos_result ovrimos_rollback contained +syn keyword phpFunctions pcntl_exec pcntl_fork pcntl_signal pcntl_waitpid pcntl_wexitstatus pcntl_wifexited pcntl_wifsignaled pcntl_wifstopped pcntl_wstopsig pcntl_wtermsig contained +syn keyword phpFunctions preg_grep preg_match_all preg_match preg_quote preg_replace_callback preg_replace preg_split contained +syn keyword phpFunctions pdf_add_annotation pdf_add_bookmark pdf_add_launchlink pdf_add_locallink pdf_add_note pdf_add_outline pdf_add_pdflink pdf_add_thumbnail pdf_add_weblink pdf_arc pdf_arcn pdf_attach_file pdf_begin_page pdf_begin_pattern pdf_begin_template pdf_circle pdf_clip pdf_close_image pdf_close_pdi_page pdf_close_pdi pdf_close pdf_closepath_fill_stroke pdf_closepath_stroke pdf_closepath pdf_concat pdf_continue_text pdf_curveto pdf_delete pdf_end_page pdf_end_pattern pdf_end_template pdf_endpath pdf_fill_stroke pdf_fill pdf_findfont pdf_get_buffer pdf_get_font pdf_get_fontname pdf_get_fontsize pdf_get_image_height pdf_get_image_width pdf_get_majorversion pdf_get_minorversion pdf_get_parameter pdf_get_pdi_parameter pdf_get_pdi_value pdf_get_value pdf_initgraphics pdf_lineto pdf_makespotcolor pdf_moveto pdf_new pdf_open_CCITT pdf_open_file pdf_open_gif pdf_open_image_file pdf_open_image pdf_open_jpeg pdf_open_memory_image pdf_open_pdi_page pdf_open_pdi pdf_open_png pdf_open_tiff pdf_open pdf_place_image pdf_place_pdi_page pdf_rect pdf_restore pdf_rotate pdf_save pdf_scale pdf_set_border_color pdf_set_border_dash pdf_set_border_style pdf_set_char_spacing pdf_set_duration pdf_set_font pdf_set_horiz_scaling pdf_set_info_author pdf_set_info_creator pdf_set_info_keywords pdf_set_info_subject pdf_set_info_title pdf_set_info pdf_set_leading pdf_set_parameter pdf_set_text_matrix pdf_set_text_pos pdf_set_text_rendering pdf_set_text_rise pdf_set_value pdf_set_word_spacing pdf_setcolor pdf_setdash pdf_setflat pdf_setfont pdf_setgray_fill pdf_setgray_stroke pdf_setgray pdf_setlinecap pdf_setlinejoin pdf_setlinewidth pdf_setmatrix pdf_setmiterlimit pdf_setpolydash pdf_setrgbcolor_fill pdf_setrgbcolor_stroke pdf_setrgbcolor pdf_show_boxed pdf_show_xy pdf_show pdf_skew pdf_stringwidth pdf_stroke pdf_translate contained +syn keyword phpFunctions pfpro_cleanup pfpro_init pfpro_process_raw pfpro_process pfpro_version contained +syn keyword phpFunctions pg_affected_rows pg_cancel_query pg_client_encoding pg_close pg_connect pg_connection_busy pg_connection_reset pg_connection_status pg_convert pg_copy_from pg_copy_to pg_dbname pg_delete pg_end_copy pg_escape_bytea pg_escape_string pg_fetch_all pg_fetch_array pg_fetch_assoc pg_fetch_object pg_fetch_result pg_fetch_row pg_field_is_null pg_field_name pg_field_num pg_field_prtlen pg_field_size pg_field_type pg_free_result pg_get_notify pg_get_pid pg_get_result pg_host pg_insert pg_last_error pg_last_notice pg_last_oid pg_lo_close pg_lo_create pg_lo_export pg_lo_import pg_lo_open pg_lo_read_all pg_lo_read pg_lo_seek pg_lo_tell pg_lo_unlink pg_lo_write pg_meta_data pg_num_fields pg_num_rows pg_options pg_pconnect pg_ping pg_port pg_put_line pg_query pg_result_error pg_result_seek pg_result_status pg_select pg_send_query pg_set_client_encoding pg_trace pg_tty pg_unescape_bytea pg_untrace pg_update contained +syn keyword phpFunctions posix_ctermid posix_get_last_error posix_getcwd posix_getegid posix_geteuid posix_getgid posix_getgrgid posix_getgrnam posix_getgroups posix_getlogin posix_getpgid posix_getpgrp posix_getpid posix_getppid posix_getpwnam posix_getpwuid posix_getrlimit posix_getsid posix_getuid posix_isatty posix_kill posix_mkfifo posix_setegid posix_seteuid posix_setgid posix_setpgid posix_setsid posix_setuid posix_strerror posix_times posix_ttyname posix_uname contained +syn keyword phpFunctions printer_abort printer_close printer_create_brush printer_create_dc printer_create_font printer_create_pen printer_delete_brush printer_delete_dc printer_delete_font printer_delete_pen printer_draw_bmp printer_draw_chord printer_draw_elipse printer_draw_line printer_draw_pie printer_draw_rectangle printer_draw_roundrect printer_draw_text printer_end_doc printer_end_page printer_get_option printer_list printer_logical_fontheight printer_open printer_select_brush printer_select_font printer_select_pen printer_set_option printer_start_doc printer_start_page printer_write contained +syn keyword phpFunctions pspell_add_to_personal pspell_add_to_session pspell_check pspell_clear_session pspell_config_create pspell_config_ignore pspell_config_mode pspell_config_personal pspell_config_repl pspell_config_runtogether pspell_config_save_repl pspell_new_config pspell_new_personal pspell_new pspell_save_wordlist pspell_store_replacement pspell_suggest contained +syn keyword phpFunctions qdom_error qdom_tree contained +syn keyword phpFunctions readline_add_history readline_clear_history readline_completion_function readline_info readline_list_history readline_read_history readline_write_history readline contained +syn keyword phpFunctions recode_file recode_string recode contained +syn keyword phpFunctions ereg_replace ereg eregi_replace eregi split spliti sql_regcase contained +syn keyword phpFunctions ftok msg_get_queue msg_receive msg_remove_queue msg_send msg_set_queue msg_stat_queue sem_acquire sem_get sem_release sem_remove shm_attach shm_detach shm_get_var shm_put_var shm_remove_var shm_remove contained +syn keyword phpFunctions sesam_affected_rows sesam_commit sesam_connect sesam_diagnostic sesam_disconnect sesam_errormsg sesam_execimm sesam_fetch_array sesam_fetch_result sesam_fetch_row sesam_field_array sesam_field_name sesam_free_result sesam_num_fields sesam_query sesam_rollback sesam_seek_row sesam_settransaction contained +syn keyword phpFunctions session_cache_expire session_cache_limiter session_decode session_destroy session_encode session_get_cookie_params session_id session_is_registered session_module_name session_name session_regenerate_id session_register session_save_path session_set_cookie_params session_set_save_handler session_start session_unregister session_unset session_write_close contained +syn keyword phpFunctions shmop_close shmop_delete shmop_open shmop_read shmop_size shmop_write contained +syn keyword phpFunctions snmp_get_quick_print snmp_set_quick_print snmpget snmprealwalk snmpset snmpwalk snmpwalkoid contained +syn keyword phpFunctions socket_accept socket_bind socket_clear_error socket_close socket_connect socket_create_listen socket_create_pair socket_create socket_get_option socket_getpeername socket_getsockname socket_iovec_add socket_iovec_alloc socket_iovec_delete socket_iovec_fetch socket_iovec_free socket_iovec_set socket_last_error socket_listen socket_read socket_readv socket_recv socket_recvfrom socket_recvmsg socket_select socket_send socket_sendmsg socket_sendto socket_set_block socket_set_nonblock socket_set_option socket_shutdown socket_strerror socket_write socket_writev contained +syn keyword phpFunctions sqlite_array_query sqlite_busy_timeout sqlite_changes sqlite_close sqlite_column sqlite_create_aggregate sqlite_create_function sqlite_current sqlite_error_string sqlite_escape_string sqlite_fetch_array sqlite_fetch_single sqlite_fetch_string sqlite_field_name sqlite_has_more sqlite_last_error sqlite_last_insert_rowid sqlite_libencoding sqlite_libversion sqlite_next sqlite_num_fields sqlite_num_rows sqlite_open sqlite_popen sqlite_query sqlite_rewind sqlite_seek sqlite_udf_decode_binary sqlite_udf_encode_binary sqlite_unbuffered_query contained +syn keyword phpFunctions stream_context_create stream_context_get_options stream_context_set_option stream_context_set_params stream_copy_to_stream stream_filter_append stream_filter_prepend stream_filter_register stream_get_contents stream_get_filters stream_get_line stream_get_meta_data stream_get_transports stream_get_wrappers stream_register_wrapper stream_select stream_set_blocking stream_set_timeout stream_set_write_buffer stream_socket_accept stream_socket_client stream_socket_get_name stream_socket_recvfrom stream_socket_sendto stream_socket_server stream_wrapper_register contained +syn keyword phpFunctions addcslashes addslashes bin2hex chop chr chunk_split convert_cyr_string count_chars crc32 crypt explode fprintf get_html_translation_table hebrev hebrevc html_entity_decode htmlentities htmlspecialchars implode join levenshtein localeconv ltrim md5_file md5 metaphone money_format nl_langinfo nl2br number_format ord parse_str print printf quoted_printable_decode quotemeta rtrim setlocale sha1_file sha1 similar_text soundex sprintf sscanf str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpos strrchr strrev strripos strrpos strspn strstr strtok strtolower strtoupper strtr substr_compare substr_count substr_replace substr trim ucfirst ucwords vprintf vsprintf wordwrap contained +syn keyword phpFunctions swf_actiongeturl swf_actiongotoframe swf_actiongotolabel swf_actionnextframe swf_actionplay swf_actionprevframe swf_actionsettarget swf_actionstop swf_actiontogglequality swf_actionwaitforframe swf_addbuttonrecord swf_addcolor swf_closefile swf_definebitmap swf_definefont swf_defineline swf_definepoly swf_definerect swf_definetext swf_endbutton swf_enddoaction swf_endshape swf_endsymbol swf_fontsize swf_fontslant swf_fonttracking swf_getbitmapinfo swf_getfontinfo swf_getframe swf_labelframe swf_lookat swf_modifyobject swf_mulcolor swf_nextid swf_oncondition swf_openfile swf_ortho2 swf_ortho swf_perspective swf_placeobject swf_polarview swf_popmatrix swf_posround swf_pushmatrix swf_removeobject swf_rotate swf_scale swf_setfont swf_setframe swf_shapearc swf_shapecurveto3 swf_shapecurveto swf_shapefillbitmapclip swf_shapefillbitmaptile swf_shapefilloff swf_shapefillsolid swf_shapelinesolid swf_shapelineto swf_shapemoveto swf_showframe swf_startbutton swf_startdoaction swf_startshape swf_startsymbol swf_textwidth swf_translate swf_viewport contained +syn keyword phpFunctions sybase_affected_rows sybase_close sybase_connect sybase_data_seek sybase_deadlock_retry_count sybase_fetch_array sybase_fetch_assoc sybase_fetch_field sybase_fetch_object sybase_fetch_row sybase_field_seek sybase_free_result sybase_get_last_message sybase_min_client_severity sybase_min_error_severity sybase_min_message_severity sybase_min_server_severity sybase_num_fields sybase_num_rows sybase_pconnect sybase_query sybase_result sybase_select_db sybase_set_message_handler sybase_unbuffered_query contained +syn keyword phpFunctions tidy_access_count tidy_clean_repair tidy_config_count tidy_diagnose tidy_error_count tidy_get_body tidy_get_config tidy_get_error_buffer tidy_get_head tidy_get_html_ver tidy_get_html tidy_get_output tidy_get_release tidy_get_root tidy_get_status tidy_getopt tidy_is_xhtml tidy_load_config tidy_parse_file tidy_parse_string tidy_repair_file tidy_repair_string tidy_reset_config tidy_save_config tidy_set_encoding tidy_setopt tidy_warning_count contained +syn keyword phpMethods attributes children get_attr get_nodes has_children has_siblings is_asp is_comment is_html is_jsp is_jste is_text is_xhtml is_xml next prev tidy_node contained +syn keyword phpFunctions token_get_all token_name contained +syn keyword phpFunctions base64_decode base64_encode get_meta_tags http_build_query parse_url rawurldecode rawurlencode urldecode urlencode contained +syn keyword phpFunctions doubleval empty floatval get_defined_vars get_resource_type gettype import_request_variables intval is_array is_bool is_callable is_double is_float is_int is_integer is_long is_null is_numeric is_object is_real is_resource is_scalar is_string isset print_r serialize settype strval unserialize unset var_dump var_export contained +syn keyword phpFunctions vpopmail_add_alias_domain_ex vpopmail_add_alias_domain vpopmail_add_domain_ex vpopmail_add_domain vpopmail_add_user vpopmail_alias_add vpopmail_alias_del_domain vpopmail_alias_del vpopmail_alias_get_all vpopmail_alias_get vpopmail_auth_user vpopmail_del_domain_ex vpopmail_del_domain vpopmail_del_user vpopmail_error vpopmail_passwd vpopmail_set_user_quota contained +syn keyword phpFunctions w32api_deftype w32api_init_dtype w32api_invoke_function w32api_register_function w32api_set_call_method contained +syn keyword phpFunctions wddx_add_vars wddx_deserialize wddx_packet_end wddx_packet_start wddx_serialize_value wddx_serialize_vars contained +syn keyword phpFunctions utf8_decode utf8_encode xml_error_string xml_get_current_byte_index xml_get_current_column_number xml_get_current_line_number xml_get_error_code xml_parse_into_struct xml_parse xml_parser_create_ns xml_parser_create xml_parser_free xml_parser_get_option xml_parser_set_option xml_set_character_data_handler xml_set_default_handler xml_set_element_handler xml_set_end_namespace_decl_handler xml_set_external_entity_ref_handler xml_set_notation_decl_handler xml_set_object xml_set_processing_instruction_handler xml_set_start_namespace_decl_handler xml_set_unparsed_entity_decl_handler contained +syn keyword phpFunctions xmlrpc_decode_request xmlrpc_decode xmlrpc_encode_request xmlrpc_encode xmlrpc_get_type xmlrpc_parse_method_descriptions xmlrpc_server_add_introspection_data xmlrpc_server_call_method xmlrpc_server_create xmlrpc_server_destroy xmlrpc_server_register_introspection_callback xmlrpc_server_register_method xmlrpc_set_type contained +syn keyword phpFunctions xslt_create xslt_errno xslt_error xslt_free xslt_output_process xslt_set_base xslt_set_encoding xslt_set_error_handler xslt_set_log xslt_set_sax_handler xslt_set_sax_handlers xslt_set_scheme_handler xslt_set_scheme_handlers contained +syn keyword phpFunctions yaz_addinfo yaz_ccl_conf yaz_ccl_parse yaz_close yaz_connect yaz_database yaz_element yaz_errno yaz_error yaz_es_result yaz_get_option yaz_hits yaz_itemorder yaz_present yaz_range yaz_record yaz_scan_result yaz_scan yaz_schema yaz_search yaz_set_option yaz_sort yaz_syntax yaz_wait contained +syn keyword phpFunctions zip_close zip_entry_close zip_entry_compressedsize zip_entry_compressionmethod zip_entry_filesize zip_entry_name zip_entry_open zip_entry_read zip_open zip_read contained +syn keyword phpFunctions gzclose gzcompress gzdeflate gzencode gzeof gzfile gzgetc gzgets gzgetss gzinflate gzopen gzpassthru gzputs gzread gzrewind gzseek gztell gzuncompress gzwrite readgzfile zlib_get_coding_type contained if exists( "php_baselib" ) - syn keyword phpMethods query next_record num_rows affected_rows nf f p np num_fields haltmsg seek link_id query_id metadata table_names nextid connect halt free register unregister is_registered delete url purl self_url pself_url hidden_session add_query padd_query reimport_get_vars reimport_post_vars reimport_cookie_vars set_container set_tokenname release_token put_headers get_id get_id put_id freeze thaw gc reimport_any_vars start url purl login_if is_authenticated auth_preauth auth_loginform auth_validatelogin auth_refreshlogin auth_registerform auth_doregister start check have_perm permsum perm_invalid contained - syn keyword phpFunctions page_open page_close sess_load sess_save contained + syn keyword phpMethods query next_record num_rows affected_rows nf f p np num_fields haltmsg seek link_id query_id metadata table_names nextid connect halt free register unregister is_registered delete url purl self_url pself_url hidden_session add_query padd_query reimport_get_vars reimport_post_vars reimport_cookie_vars set_container set_tokenname release_token put_headers get_id get_id put_id freeze thaw gc reimport_any_vars start url purl login_if is_authenticated auth_preauth auth_loginform auth_validatelogin auth_refreshlogin auth_registerform auth_doregister start check have_perm permsum perm_invalid contained + syn keyword phpFunctions page_open page_close sess_load sess_save contained endif " Conditional -syn keyword phpConditional declare else enddeclare endswitch elseif endif if switch contained +syn keyword phpConditional declare else enddeclare endswitch elseif endif if switch contained " Repeat -syn keyword phpRepeat as do endfor endforeach endwhile for foreach while contained +syn keyword phpRepeat as do endfor endforeach endwhile for foreach while contained " Repeat -syn keyword phpLabel case default switch contained +syn keyword phpLabel case default switch contained " Statement -syn keyword phpStatement return break continue exit goto contained +syn keyword phpStatement return break continue exit goto yield contained " Keyword -syn keyword phpKeyword var const contained +syn keyword phpKeyword var const contained " Type -syn keyword phpType bool[ean] int[eger] real double float string array object NULL contained +syn keyword phpType void bool boolean int integer real double float string array object NULL callable iterable contained " Structure -syn keyword phpStructure namespace extends implements instanceof parent self contained +syn keyword phpStructure namespace extends implements instanceof parent self contained " Operator syn match phpOperator "[-=+%^&|*!.~?:]" contained display -syn match phpOperator "[-+*/%^&|.]=" contained display -syn match phpOperator "/[^*/]"me=e-1 contained display -syn match phpOperator "\$" contained display +syn match phpOperator "[-+*/%^&|.]=" contained display +syn match phpOperator "/[^*/]"me=e-1 contained display +syn match phpOperator "\$" contained display syn match phpOperator "&&\|\<and\>" contained display syn match phpOperator "||\|\<x\=or\>" contained display syn match phpRelation "[!=<>]=" contained display -syn match phpRelation "[<>]" contained display -syn match phpMemberSelector "->" contained display -syn match phpVarSelector "\$" contained display +syn match phpRelation "[<>]" contained display +syn match phpMemberSelector "->" contained display +syn match phpVarSelector "\$" contained display " Identifier -syn match phpIdentifier "$\h\w*" contained contains=phpEnvVar,phpIntVar,phpVarSelector display -syn match phpIdentifierSimply "${\h\w*}" contains=phpOperator,phpParent contained display -syn region phpIdentifierComplex matchgroup=phpParent start="{\$"rs=e-1 end="}" contains=phpIdentifier,phpMemberSelector,phpVarSelector,phpIdentifierComplexP contained extend -syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contains=@phpClInside contained +syn match phpIdentifier "$\h\w*" contained contains=phpEnvVar,phpIntVar,phpVarSelector display +syn match phpIdentifierSimply "${\h\w*}" contains=phpOperator,phpParent contained display +syn region phpIdentifierComplex matchgroup=phpParent start="{\$"rs=e-1 end="}" contains=phpIdentifier,phpMemberSelector,phpVarSelector,phpIdentifierComplexP contained extend +syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contains=@phpClInside contained " Interpolated indentifiers (inside strings) syn match phpBrackets "[][}{]" contained display " errors - syn match phpInterpSimpleError "\[[^]]*\]" contained display " fallback (if nothing else matches) + syn match phpInterpSimpleError "\[[^]]*\]" contained display " fallback (if nothing else matches) syn match phpInterpSimpleError "->[^a-zA-Z_]" contained display " make sure these stay above the correct DollarCurlies so they don't take priority - syn match phpInterpBogusDollarCurley "${[^}]*}" contained display " fallback (if nothing else matches) + syn match phpInterpBogusDollarCurley "${[^}]*}" contained display " fallback (if nothing else matches) syn match phpinterpSimpleBracketsInner "\w\+" contained syn match phpInterpSimpleBrackets "\[\h\w*]" contained contains=phpBrackets,phpInterpSimpleBracketsInner syn match phpInterpSimpleBrackets "\[\d\+]" contained contains=phpBrackets,phpInterpSimpleBracketsInner @@ -313,7 +298,7 @@ syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contai syn match phpInterpSimple "\$\h\w*\(\[[^]]*\]\|->\h\w*\)\?" contained contains=phpInterpSimpleBrackets,phpIdentifier,phpInterpSimpleError,phpMethods,phpMemberSelector display syn match phpInterpVarname "\h\w*" contained syn match phpInterpMethodName "\h\w*" contained " default color - syn match phpInterpSimpleCurly "\${\h\w*}" contains=phpInterpVarname contained extend + syn match phpInterpSimpleCurly "\${\h\w*}" contains=phpInterpVarname contained extend syn region phpInterpDollarCurley1Helper matchgroup=phpParent start="{" end="\[" contains=phpInterpVarname contained syn region phpInterpDollarCurly1 matchgroup=phpParent start="\${\h\w*\["rs=s+1 end="]}" contains=phpInterpDollarCurley1Helper,@phpClConst contained extend @@ -333,28 +318,27 @@ syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contai syn match phpMethodsVar "->\h\w*" contained contains=phpMethods,phpMemberSelector display " Include -syn keyword phpInclude include require include_once require_once use contained +syn keyword phpInclude include require include_once require_once use contained -" Peter Hodge - added 'clone' keyword " Define syn keyword phpDefine new clone contained " Boolean -syn keyword phpBoolean true false contained +syn keyword phpBoolean true false contained " Number syn match phpNumber "-\=\<\d\+\>" contained display -syn match phpNumber "\<0x\x\{1,8}\>" contained display +syn match phpNumber "\<0x\x\{1,8}\>" contained display " Float -syn match phpFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display +syn match phpFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display " Backslash escapes syn case match " for double quotes and heredoc - syn match phpBackslashSequences "\\[fnrtv\\\"$]" contained display - syn match phpBackslashSequences "\\\d\{1,3}" contained contains=phpOctalError display - syn match phpBackslashSequences "\\x\x\{1,2}" contained display + syn match phpBackslashSequences "\\[fnrtv\\\"$]" contained display + syn match phpBackslashSequences "\\\d\{1,3}" contained contains=phpOctalError display + syn match phpBackslashSequences "\\x\x\{1,2}" contained display " additional sequence for double quotes only syn match phpBackslashDoubleQuote "\\[\"]" contained display " for single quotes only @@ -363,66 +347,57 @@ syn match phpFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display " Error -syn match phpOctalError "[89]" contained display +syn match phpOctalError "[89]" contained display if exists("php_parent_error_close") - syn match phpParentError "[)\]}]" contained display + syn match phpParentError "[)\]}]" contained display endif " Todo -syn keyword phpTodo todo fixme xxx contained +syn keyword phpTodo todo fixme xxx contained " Comment if exists("php_parent_error_open") - syn region phpComment start="/\*" end="\*/" contained contains=phpTodo + syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell else - syn region phpComment start="/\*" end="\*/" contained contains=phpTodo extend -endif -if version >= 600 - syn match phpComment "#.\{-}\(?>\|$\)\@=" contained contains=phpTodo - syn match phpComment "//.\{-}\(?>\|$\)\@=" contained contains=phpTodo -else - syn match phpComment "#.\{-}$" contained contains=phpTodo - syn match phpComment "#.\{-}?>"me=e-2 contained contains=phpTodo - syn match phpComment "//.\{-}$" contained contains=phpTodo - syn match phpComment "//.\{-}?>"me=e-2 contained contains=phpTodo + syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell extend endif +syn match phpComment "#.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell +syn match phpComment "//.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell " String if exists("php_parent_error_open") - syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained keepend - syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend - syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend + syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble,@Spell contained keepend + syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend + syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote,@Spell contained keepend else - syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained extend keepend - syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend - syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend extend + syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble,@Spell contained extend keepend + syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend + syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote,@Spell contained keepend extend endif " HereDoc and NowDoc -if version >= 600 - syn case match +syn case match - " HereDoc - syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar keepend extend +" HereDoc +syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend " including HTML,JavaScript,SQL even if not enabled via options - syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar keepend extend - syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar keepend extend - syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar keepend extend +syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend +syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend +syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend - " NowDoc - syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\z1\(;\=$\)\@=" contained keepend extend +" NowDoc +syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\z1\(;\=$\)\@=" contained contains=@Spell keepend extend " including HTML,JavaScript,SQL even if not enabled via options - syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop keepend extend - syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop keepend extend - syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript keepend extend - syn case ignore -endif +syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,@Spell keepend extend +syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,@Spell keepend extend +syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,@Spell keepend extend +syn case ignore " Parent if exists("php_parent_error_close") || exists("php_parent_error_open") - syn match phpParent "[{}]" contained - syn region phpParent matchgroup=Delimiter start="(" end=")" contained contains=@phpClInside transparent - syn region phpParent matchgroup=Delimiter start="\[" end="\]" contained contains=@phpClInside transparent + syn match phpParent "[{}]" contained + syn region phpParent matchgroup=Delimiter start="(" end=")" contained contains=@phpClInside transparent + syn region phpParent matchgroup=Delimiter start="\[" end="\]" contained contains=@phpClInside transparent if !exists("php_parent_error_close") syn match phpParent "[\])]" contained endif @@ -430,83 +405,72 @@ else syn match phpParent "[({[\]})]" contained endif -syn cluster phpClConst contains=phpFunctions,phpIdentifier,phpConditional,phpRepeat,phpStatement,phpOperator,phpRelation,phpStringSingle,phpStringDouble,phpBacktick,phpNumber,phpFloat,phpKeyword,phpType,phpBoolean,phpStructure,phpMethodsVar,phpConstant,phpCoreConstant,phpException +syn cluster phpClConst contains=phpFunctions,phpIdentifier,phpConditional,phpRepeat,phpStatement,phpOperator,phpRelation,phpStringSingle,phpStringDouble,phpBacktick,phpNumber,phpFloat,phpKeyword,phpType,phpBoolean,phpStructure,phpMethodsVar,phpConstant,phpCoreConstant,phpException syn cluster phpClInside contains=@phpClConst,phpComment,phpLabel,phpParent,phpParentError,phpInclude,phpHereDoc,phpNowDoc syn cluster phpClFunction contains=@phpClInside,phpDefine,phpParentError,phpStorageClass -syn cluster phpClTop contains=@phpClFunction,phpFoldFunction,phpFoldClass,phpFoldInterface,phpFoldTry,phpFoldCatch +syn cluster phpClTop contains=@phpClFunction,phpFoldFunction,phpFoldClass,phpFoldInterface,phpFoldTry,phpFoldCatch " Php Region if exists("php_parent_error_open") if exists("php_noShortTags") - syn region phpRegion matchgroup=Delimiter start="<?php" end="?>" contains=@phpClTop + syn region phpRegion matchgroup=Delimiter start="<?php" end="?>" contains=@phpClTop else - syn region phpRegion matchgroup=Delimiter start="<?\(php\)\=" end="?>" contains=@phpClTop + syn region phpRegion matchgroup=Delimiter start="<?\(php\)\=" end="?>" contains=@phpClTop endif - syn region phpRegionSc matchgroup=Delimiter start=+<script language="php">+ end=+</script>+ contains=@phpClTop + syn region phpRegionSc matchgroup=Delimiter start=+<script language="php">+ end=+</script>+ contains=@phpClTop if exists("php_asp_tags") - syn region phpRegionAsp matchgroup=Delimiter start="<%\(=\)\=" end="%>" contains=@phpClTop + syn region phpRegionAsp matchgroup=Delimiter start="<%\(=\)\=" end="%>" contains=@phpClTop endif else if exists("php_noShortTags") - syn region phpRegion matchgroup=Delimiter start="<?php" end="?>" contains=@phpClTop keepend + syn region phpRegion matchgroup=Delimiter start="<?php" end="?>" contains=@phpClTop keepend else - syn region phpRegion matchgroup=Delimiter start="<?\(php\)\=" end="?>" contains=@phpClTop keepend + syn region phpRegion matchgroup=Delimiter start="<?\(php\)\=" end="?>" contains=@phpClTop keepend endif - syn region phpRegionSc matchgroup=Delimiter start=+<script language="php">+ end=+</script>+ contains=@phpClTop keepend + syn region phpRegionSc matchgroup=Delimiter start=+<script language="php">+ end=+</script>+ contains=@phpClTop keepend if exists("php_asp_tags") - syn region phpRegionAsp matchgroup=Delimiter start="<%\(=\)\=" end="%>" contains=@phpClTop keepend + syn region phpRegionAsp matchgroup=Delimiter start="<%\(=\)\=" end="%>" contains=@phpClTop keepend endif endif " Fold if exists("php_folding") && php_folding==1 " match one line constructs here and skip them at folding - syn keyword phpSCKeyword abstract final private protected public static contained - syn keyword phpFCKeyword function contained - syn keyword phpStorageClass global contained - syn match phpDefine "\(\s\|^\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\(\s\+.*[;}]\)\@=" contained contains=phpSCKeyword - syn match phpStructure "\(\s\|^\)\(abstract\s\+\|final\s\+\)*class\(\s\+.*}\)\@=" contained - syn match phpStructure "\(\s\|^\)interface\(\s\+.*}\)\@=" contained - syn match phpException "\(\s\|^\)try\(\s\+.*}\)\@=" contained - syn match phpException "\(\s\|^\)catch\(\s\+.*}\)\@=" contained - - set foldmethod=syntax - syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop - syn region phpFoldFunction matchgroup=Storageclass start="^\z(\s*\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\s\([^};]*$\)\@="rs=e-9 matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldHtmlInside,phpFCKeyword contained transparent fold extend - syn region phpFoldFunction matchgroup=Define start="^function\s\([^};]*$\)\@=" matchgroup=Delimiter end="^}" contains=@phpClFunction,phpFoldHtmlInside contained transparent fold extend - syn region phpFoldClass matchgroup=Structure start="^\z(\s*\)\(abstract\s\+\|final\s\+\)*class\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction,phpSCKeyword contained transparent fold extend - syn region phpFoldInterface matchgroup=Structure start="^\z(\s*\)interface\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend - syn region phpFoldCatch matchgroup=Exception start="^\z(\s*\)catch\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend - syn region phpFoldTry matchgroup=Exception start="^\z(\s*\)try\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend -elseif exists("php_folding") && php_folding==2 - syn keyword phpDefine function contained - syn keyword phpStructure abstract class interface contained - syn keyword phpException catch throw try contained - syn keyword phpStorageClass final global private protected public static contained + syn keyword phpSCKeyword abstract final private protected public static contained + syn keyword phpFCKeyword function contained + syn keyword phpStorageClass global contained + syn match phpDefine "\(\s\|^\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\(\s\+.*[;}]\)\@=" contained contains=phpSCKeyword + syn match phpStructure "\(\s\|^\)\(abstract\s\+\|final\s\+\)*\(trait\|class\)\(\s\+.*}\)\@=" contained + syn match phpStructure "\(\s\|^\)interface\(\s\+.*}\)\@=" contained + syn match phpException "\(\s\|^\)try\(\s\+.*}\)\@=" contained + syn match phpException "\(\s\|^\)catch\(\s\+.*}\)\@=" contained + syn match phpException "\(\s\|^\)finally\(\s\+.*}\)\@=" contained set foldmethod=syntax - syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop - syn region phpParent matchgroup=Delimiter start="{" end="}" contained contains=@phpClFunction,phpFoldHtmlInside transparent fold + syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop + syn region phpFoldFunction matchgroup=Storageclass start="^\z(\s*\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\s\([^};]*$\)\@="rs=e-9 matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldHtmlInside,phpFCKeyword contained transparent fold extend + syn region phpFoldFunction matchgroup=Define start="^function\s\([^};]*$\)\@=" matchgroup=Delimiter end="^}" contains=@phpClFunction,phpFoldHtmlInside contained transparent fold extend + syn region phpFoldClass matchgroup=Structure start="^\z(\s*\)\(abstract\s\+\|final\s\+\)*\(trait\|class\)\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction,phpSCKeyword contained transparent fold extend + syn region phpFoldInterface matchgroup=Structure start="^\z(\s*\)interface\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend + syn region phpFoldCatch matchgroup=Exception start="^\z(\s*\)catch\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend + syn region phpFoldTry matchgroup=Exception start="^\z(\s*\)try\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend else - syn keyword phpDefine function contained - syn keyword phpStructure abstract class interface contained - syn keyword phpException catch throw try contained - syn keyword phpStorageClass final global private protected public static contained + syn keyword phpDefine function contained + syn keyword phpStructure abstract class trait interface contained + syn keyword phpException catch throw try finally contained + syn keyword phpStorageClass final global private protected public static contained + if exists("php_folding") && php_folding==2 + set foldmethod=syntax + syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop + syn region phpParent matchgroup=Delimiter start="{" end="}" contained contains=@phpClFunction,phpFoldHtmlInside transparent fold + endif endif -" TODO: fold on "trait". For now just make sure it gets colored: -syn keyword phpStructure trait - " ================================================================ " Peter Hodge - June 9, 2006 " Some of these changes (highlighting isset/unset/echo etc) are not so " critical, but they make things more colourful. :-) -" highlight constant E_STRICT -syntax case match -syntax keyword phpCoreConstant E_STRICT contained -syntax case ignore - " different syntax highlighting for 'echo', 'print', 'switch', 'die' and 'list' keywords " to better indicate what they are. syntax keyword phpDefine echo print contained @@ -516,11 +480,11 @@ syntax keyword phpStatement die contained " Highlighting for PHP5's user-definable magic class methods syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier - \ __construct __destruct __call __toString __sleep __wakeup __set __get __unset __isset __clone __set_state + \ __construct __destruct __call __callStatic __get __set __isset __unset __sleep __wakeup __toString __invoke __set_state __clone __debugInfo " Highlighting for __autoload slightly different from line above syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier,phpMethodsVar \ __autoload -highlight link phpSpecialFunction phpOperator +hi def link phpSpecialFunction phpOperator " Highlighting for PHP5's built-in classes " - built-in classes harvested from get_declared_classes() in 5.1.4 @@ -543,42 +507,42 @@ syntax keyword phpClasses containedin=ALLBUT,phpComment,phpStringDouble,phpStrin \ DOMCharacterData DOMAttr DOMElement DOMText DOMComment DOMTypeinfo DOMUserDataHandler \ DOMLocator DOMConfiguration DOMCdataSection DOMDocumentType DOMNotation DOMEntity \ DOMEntityReference DOMProcessingInstruction DOMStringExtend DOMXPath -highlight link phpClasses phpFunctions +hi def link phpClasses phpFunctions " Highlighting for PHP5's built-in interfaces " - built-in classes harvested from get_declared_interfaces() in 5.1.4 syntax keyword phpInterfaces containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier,phpMethodsVar \ Iterator IteratorAggregate RecursiveIterator OuterIterator SeekableIterator \ Traversable ArrayAccess Serializable Countable SplObserver SplSubject Reflector -highlight link phpInterfaces phpConstant +hi def link phpInterfaces phpConstant " option defaults: if ! exists('php_special_functions') - let php_special_functions = 1 + let php_special_functions = 1 endif if ! exists('php_alt_comparisons') - let php_alt_comparisons = 1 + let php_alt_comparisons = 1 endif if ! exists('php_alt_assignByReference') - let php_alt_assignByReference = 1 + let php_alt_assignByReference = 1 endif if php_special_functions - " Highlighting for PHP built-in functions which exhibit special behaviours - " - isset()/unset()/empty() are not real functions. - " - compact()/extract() directly manipulate variables in the local scope where - " regular functions would not be able to. - " - eval() is the token 'make_your_code_twice_as_complex()' function for PHP. - " - user_error()/trigger_error() can be overloaded by set_error_handler and also - " have the capacity to terminate your script when type is E_USER_ERROR. - syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle + " Highlighting for PHP built-in functions which exhibit special behaviours + " - isset()/unset()/empty() are not real functions. + " - compact()/extract() directly manipulate variables in the local scope where + " regular functions would not be able to. + " - eval() is the token 'make_your_code_twice_as_complex()' function for PHP. + " - user_error()/trigger_error() can be overloaded by set_error_handler and also + " have the capacity to terminate your script when type is E_USER_ERROR. + syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle \ user_error trigger_error isset unset eval extract compact empty endif if php_alt_assignByReference - " special highlighting for '=&' operator - syntax match phpAssignByRef /=\s*&/ containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle - highlight link phpAssignByRef Type + " special highlighting for '=&' operator + syntax match phpAssignByRef /=\s*&/ containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle + hi def link phpAssignByRef Type endif if php_alt_comparisons @@ -590,7 +554,7 @@ if php_alt_comparisons syntax case ignore syntax keyword phpComparison instanceof contained containedin=phpRegion - hi link phpComparison Statement + hi def link phpComparison Statement endif " ================================================================ @@ -616,88 +580,78 @@ else exec "syn sync fromstart" endif -syntax match phpDocCustomTags "@[a-zA-Z]*\(\s\+\|\n\|\r\)" containedin=phpComment -syntax region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpComment -syntax match phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|tutorial\|uses\|var\|version\|contributor\|modified\|filename\|description\|filesource\|throws\)\(\s\+\)\?" containedin=phpComment -syntax match phpDocTodo "@\(todo\|fixme\|xxx\)\(\s\+\)\?" containedin=phpComment +syntax match phpDocCustomTags "@[a-zA-Z]*\(\s\+\|\n\|\r\)" containedin=phpComment +syntax region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpComment +syntax match phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|tutorial\|uses\|var\|version\|contributor\|modified\|filename\|description\|filesource\|throws\)\(\s\+\)\?" containedin=phpComment +syntax match phpDocTodo "@\(todo\|fixme\|xxx\)\(\s\+\)\?" containedin=phpComment " 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_php_syn_inits") - if version < 508 - let did_php_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink phpConstant Constant - HiLink phpCoreConstant Constant - HiLink phpComment Comment - HiLink phpDocTags PreProc - HiLink phpDocCustomTags Type - HiLink phpException Exception - HiLink phpBoolean Boolean - HiLink phpStorageClass StorageClass - HiLink phpSCKeyword StorageClass - HiLink phpFCKeyword Define - HiLink phpStructure Structure - HiLink phpStringSingle String - HiLink phpStringDouble String - HiLink phpBacktick String - HiLink phpNumber Number - HiLink phpFloat Float - HiLink phpMethods Function - HiLink phpFunctions Function - HiLink phpBaselib Function - HiLink phpRepeat Repeat - HiLink phpConditional Conditional - HiLink phpLabel Label - HiLink phpStatement Statement - HiLink phpKeyword Statement - HiLink phpType Type - HiLink phpInclude Include - HiLink phpDefine Define - HiLink phpBackslashSequences SpecialChar - HiLink phpBackslashDoubleQuote SpecialChar - HiLink phpBackslashSingleQuote SpecialChar - HiLink phpParent Delimiter - HiLink phpBrackets Delimiter - HiLink phpIdentifierConst Delimiter - HiLink phpParentError Error - HiLink phpOctalError Error - HiLink phpInterpSimpleError Error - HiLink phpInterpBogusDollarCurley Error - HiLink phpInterpDollarCurly1 Error - HiLink phpInterpDollarCurly2 Error - HiLink phpInterpSimpleBracketsInner String - HiLink phpInterpSimpleCurly Delimiter - HiLink phpInterpVarname Identifier - HiLink phpTodo Todo - HiLink phpDocTodo Todo - HiLink phpMemberSelector Structure - if exists("php_oldStyle") - hi phpIntVar guifg=Red ctermfg=DarkRed - hi phpEnvVar guifg=Red ctermfg=DarkRed - hi phpOperator guifg=SeaGreen ctermfg=DarkGreen - hi phpVarSelector guifg=SeaGreen ctermfg=DarkGreen - hi phpRelation guifg=SeaGreen ctermfg=DarkGreen - hi phpIdentifier guifg=DarkGray ctermfg=Brown - hi phpIdentifierSimply guifg=DarkGray ctermfg=Brown - else - HiLink phpIntVar Identifier - HiLink phpEnvVar Identifier - HiLink phpOperator Operator - HiLink phpVarSelector Operator - HiLink phpRelation Operator - HiLink phpIdentifier Identifier - HiLink phpIdentifierSimply Identifier - endif - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link phpConstant Constant +hi def link phpCoreConstant Constant +hi def link phpComment Comment +hi def link phpDocTags PreProc +hi def link phpDocCustomTags Type +hi def link phpException Exception +hi def link phpBoolean Boolean +hi def link phpStorageClass StorageClass +hi def link phpSCKeyword StorageClass +hi def link phpFCKeyword Define +hi def link phpStructure Structure +hi def link phpStringSingle String +hi def link phpStringDouble String +hi def link phpBacktick String +hi def link phpNumber Number +hi def link phpFloat Float +hi def link phpMethods Function +hi def link phpFunctions Function +hi def link phpBaselib Function +hi def link phpRepeat Repeat +hi def link phpConditional Conditional +hi def link phpLabel Label +hi def link phpStatement Statement +hi def link phpKeyword Statement +hi def link phpType Type +hi def link phpInclude Include +hi def link phpDefine Define +hi def link phpBackslashSequences SpecialChar +hi def link phpBackslashDoubleQuote SpecialChar +hi def link phpBackslashSingleQuote SpecialChar +hi def link phpParent Delimiter +hi def link phpBrackets Delimiter +hi def link phpIdentifierConst Delimiter +hi def link phpParentError Error +hi def link phpOctalError Error +hi def link phpInterpSimpleError Error +hi def link phpInterpBogusDollarCurley Error +hi def link phpInterpDollarCurly1 Error +hi def link phpInterpDollarCurly2 Error +hi def link phpInterpSimpleBracketsInner String +hi def link phpInterpSimpleCurly Delimiter +hi def link phpInterpVarname Identifier +hi def link phpTodo Todo +hi def link phpDocTodo Todo +hi def link phpMemberSelector Structure +if exists("php_oldStyle") + hi def phpIntVar guifg=Red ctermfg=DarkRed + hi def phpEnvVar guifg=Red ctermfg=DarkRed + hi def phpOperator guifg=SeaGreen ctermfg=DarkGreen + hi def phpVarSelector guifg=SeaGreen ctermfg=DarkGreen + hi def phpRelation guifg=SeaGreen ctermfg=DarkGreen + hi def phpIdentifier guifg=DarkGray ctermfg=Brown + hi def phpIdentifierSimply guifg=DarkGray ctermfg=Brown +else + hi def link phpIntVar Identifier + hi def link phpEnvVar Identifier + hi def link phpOperator Operator + hi def link phpVarSelector Operator + hi def link phpRelation Operator + hi def link phpIdentifier Identifier + hi def link phpIdentifierSimply Identifier endif + let b:current_syntax = "php" if main_syntax == 'php' diff --git a/runtime/syntax/pic.vim b/runtime/syntax/pic.vim index adc964ea96..bcb01f4dbd 100644 --- a/runtime/syntax/pic.vim +++ b/runtime/syntax/pic.vim @@ -5,11 +5,8 @@ " URL: http://galeb.etf.bg.ac.yu/~alexa/vim/syntax/pic.vim " Revision: 1.01 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -91,36 +88,26 @@ syn match picDirective "#\=DEFINE" " 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_pic16f84_syntax_inits") - if version < 508 - let did_pic16f84_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink picTodo Todo - HiLink picComment Comment - HiLink picDirective Statement - HiLink picLabel Label - HiLink picString String - - "HiLink picOpcode Keyword - "HiLink picRegister Structure - "HiLink picRegisterPart Special - - HiLink picASCII String - HiLink picBinary Number - HiLink picDecimal Number - HiLink picHexadecimal Number - HiLink picOctal Number - - HiLink picIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link picTodo Todo +hi def link picComment Comment +hi def link picDirective Statement +hi def link picLabel Label +hi def link picString String + +"hi def link picOpcode Keyword +"hi def link picRegister Structure +"hi def link picRegisterPart Special + +hi def link picASCII String +hi def link picBinary Number +hi def link picDecimal Number +hi def link picHexadecimal Number +hi def link picOctal Number + +hi def link picIdentifier Identifier + let b:current_syntax = "pic" diff --git a/runtime/syntax/pike.vim b/runtime/syntax/pike.vim index efbafd5d82..2c34cb4f38 100644 --- a/runtime/syntax/pike.vim +++ b/runtime/syntax/pike.vim @@ -1,62 +1,184 @@ " Vim syntax file -" Language: Pike -" Maintainer: Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> -" Last Change: 2001 May 10 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Language: Pike +" Maintainer: Stephen R. van den Berg <srb@cuci.nl> +" Maintainer of previous implementation: Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> +" Last Change: 2018 Jan 28 +" Version: 2.9 +" Remark: Derived from the C-syntax; fixed several bugs in the C-syntax +" Remark: and extended it with the Pike syntax. +" Remark: Includes a highlighter for all Pike types of parenthesis errors. +" Remark: Includes a highlighter for SQL on multiline strings. +" Remark: Includes a highlighter for any embedded Autodoc format. + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") finish endif -" A bunch of useful C keywords -syn keyword pikeStatement goto break return continue -syn keyword pikeLabel case default -syn keyword pikeConditional if else switch -syn keyword pikeRepeat while for foreach do -syn keyword pikeStatement gauge destruct lambda inherit import typeof -syn keyword pikeException catch -syn keyword pikeType inline nomask private protected public static +let s:cpo_save = &cpo +set cpo&vim + +" For multiline strings, try formatting them as SQL +syn include @pikeSQL <sfile>:p:h/sqloracle.vim +unlet b:current_syntax + +" For embedded Autodoc documentation (WIP) +syn include @pikeAutodoc <sfile>:p:h/autodoc.vim +unlet b:current_syntax + +syn case match + +" Supports array, multiset, mapping multi-character delimiter matching +" Supports rotating amongst several same-level preprocessor conditionals +packadd! matchit +let b:match_words = "({:}\\@1<=),(\\[:]\\@1<=),(<:>\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>" + +" A bunch of useful Pike keywords +syn keyword pikeDebug gauge backtrace describe_backtrace werror _Static_assert static_assert +syn keyword pikeException error catch throw +syn keyword pikeLabel case default break return continue +syn keyword pikeConditional if else switch +syn keyword pikeRepeat while for foreach do +syn keyword pikePredef RegGetKeyNames RegGetValue RegGetValues +syn keyword pikePredef __automap__ __empty_program +syn keyword pikePredef __handle_sprintf_format __parse_pike_type _disable_threads +syn keyword pikePredef _do_call_outs _exit _gdb_breakpoint +syn keyword pikePredef abs access acos acosh add_constant alarm all_constants +syn keyword pikePredef array_sscanf asin asinh atan atan2 atanh atexit +syn keyword pikePredef basetype call_function call_out call_out_info cd ceil +syn keyword pikePredef combine_path combine_path_nt +syn keyword pikePredef combine_path_unix compile copy_value cos cosh cpp crypt +syn keyword pikePredef ctime decode_value delay encode_value encode_value_canonic +syn keyword pikePredef enumerate errno exece exit exp file_stat file_truncate +syn keyword pikePredef filesystem_stat find_call_out floor fork function_name +syn keyword pikePredef function_object function_program gc +syn keyword pikePredef get_active_compilation_handler get_active_error_handler +syn keyword pikePredef get_all_groups get_all_users get_dir get_groups_for_user +syn keyword pikePredef get_iterator get_profiling_info get_weak_flag getcwd +syn keyword pikePredef getgrgid getgrnam gethrdtime gethrtime gethrvtime getpid +syn keyword pikePredef getpwnam getpwuid getxattr glob gmtime has_index has_prefix +syn keyword pikePredef has_suffix has_value hash hash_7_0 hash_7_4 hash_8_0 +syn keyword pikePredef hash_value kill limit listxattr load_module localtime +syn keyword pikePredef log lower_case master max min mkdir mktime mv +syn keyword pikePredef object_program pow query_num_arg random_seed +syn keyword pikePredef remove_call_out removexattr replace_master rm round +syn keyword pikePredef set_priority set_weak_flag setxattr sgn signal signame +syn keyword pikePredef signum sin sinh sleep sort sprintf sqrt sscanf strerror +syn keyword pikePredef string_filter_non_unicode string_to_unicode string_to_utf8 +syn keyword pikePredef tan tanh time trace types ualarm unicode_to_string +syn keyword pikePredef upper_case utf8_to_string version -syn keyword pikeTodo contained TODO FIXME XXX +syn keyword pikePredef write lock try_lock +syn keyword pikePredef MutexKey Timestamp Date Time TimeTZ Interval Inet Range +syn keyword pikePredef Null null inf nan + +syn keyword pikeTodo contained TODO FIXME XXX + +" Match parengroups: allows for highlighting indices of mappings and +" highlighting semicolons that are out of place due to a paren imbalance +syn cluster pikePreShort contains=pikeDefine,pikePreProc,pikeCppOutWrapper,pikeCppInWrapper,pikePreCondit,pikePreConditMatch +syn cluster pikeExprGroup contains=pikeMappIndex,@pikeStmt,pikeNest,@pikeBadGroup,pikeSoftCast +syn match pikeWord transparent contained /[^()'"[\]{},;:]\+/ contains=ALLBUT,@pikePreProcGroup,@pikeExprGroup +syn match pikeFirstWord transparent display contained /^\s*#[^()'"[\]{},;:]\+/ contains=@pikePreShort +syn cluster pikeMappElm contains=pikeMappIndex,@pikeStmt +syn cluster pikeStmt contains=pikeFirstWord,pikeCharacter,pikeString,pikeMlString,pikeWord,pikeNest +syn cluster pikeBadGroup contains=pikeBadPClose,pikeBadAClose,pikeBadBClose,pikeBadSPClose,pikeBadSAClose,pikeBadSBClose,pikeBadSClose,pikeBadSPAClose,pikeBadSBAClose +syn match pikeBadPClose display contained "[}\]]" +syn match pikeBadAClose display contained "[)\]]" +syn match pikeBadBClose display contained "[)}]" +syn match pikeBadSPClose display contained "[;}\]]" +syn match pikeBadSAClose display contained "[;)\]]" +syn match pikeBadSPAClose display contained "[;\]]" +syn match pikeBadSBAClose display contained "[;}]" +syn match pikeBadSClose display contained "[;)}\]]" +syn region pikeNest transparent start="(\@1<!{" end="}" contains=@pikeStmt,pikeUserLabel,pikeBadAClose +syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<!([[{<]\@!" end=")" contains=@pikeStmt,pikeBadSPClose +syn region pikeNest transparent start="\%(\<for\%(each\)\?\s\?\)\@8<=(" end=")" contains=@pikeStmt,pikeBadPClose +syn region pikeNest transparent start="(\@1<!\[" end="]" contains=@pikeStmt,pikeBadSBClose +syn region pikeNest transparent start="(\zs\[" end="])" contains=@pikeMappElm,pikeBadSBAClose +" For some reason specifying a matchgroup on the pikeNest below makes it +" override the shorter variant; consider it a kludge, no idea why it works +syn region pikeNest transparent matchgroup=pikeSoftCast start=%(\zs\[[ \t\v\r\n.a-zA-Z0-9_():,|]\+])\@!% end=")" contains=@pikeStmt +syn region pikeNest transparent start="(\zs{" end="})" contains=@pikeStmt,pikeBadSPAClose +syn region pikeNest transparent start="(\zs<" end=">)" contains=@pikeStmt,pikeBadSPClose keepend + +" It's easy to accidentally add a space after a backslash that was intended +" for line continuation. Some compilers allow it, which makes it +" unpredictable and should be avoided. +syn match pikeBadContinuation contained "\\\s\+$" + +" pikeCommentGroup allows adding matches for special things in comments +syn cluster pikeCommentGroup contains=pikeTodo,pikeBadContinuation " String and Character constants " Highlight special characters (those which have a backslash) differently -syn match pikeSpecial contained "\\[0-7][0-7][0-7]\=\|\\." -syn region pikeString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial -syn match pikeCharacter "'[^\\]'" -syn match pikeSpecialCharacter "'\\.'" -syn match pikeSpecialCharacter "'\\[0-7][0-7]'" -syn match pikeSpecialCharacter "'\\[0-7][0-7][0-7]'" - -" Compound data types -syn region pikeCompoundType start='({' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='})' -syn region pikeCompoundType start='(\[' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='\])' -syn region pikeCompoundType start='(<' contains=pikeString,pikeCompoundType,pikeNumber,pikeFloat end='>)' - -"catch errors caused by wrong parenthesis -syn region pikeParen transparent start='([^{[<(]' end=')' contains=ALLBUT,pikeParenError,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField -syn match pikeParenError ")" -syn match pikeInParen contained "[^(][{}][^)]" +syn match pikeSpecial display contained "\\\%(x\x*\|d\d*\|\o\+\|u\x\{4}\|U\x\{8}\|[abefnrtv]\|$\)" + +" ISO C11 or ISO C++ 11 +if !exists("c_no_cformat") + " Highlight % items in strings. + syn match pikeFormat display "%\%(\d\+\$\)\=[-+' #0*]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjzt]\|ll\|hh\)\=\%([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained + syn match pikeFormat display "%%" contained + syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,pikeFormat,@Spell keepend + syn region pikeMlString start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeFormat,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend +else + syn region pikeString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=pikeSpecial,pikeDelimiterDQ,@Spell + syn region pikeMlString transparent start=+#"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeSpecial,pikeDelimiterDQ,@Spell,pikeEmbeddedString keepend +endif + +" Use SQL-syntax highlighting in multiline string if it starts with +" a standard SQL keyword +syn case ignore +" FIXME Use explicit newline match to cover up a bug in the regexp engine +" If the kludge is not used, the match will only start unless at least a space +" follows the initial doublequote on the first line (or the keyword is on +" the first line). +syn region pikeEmbeddedString contained start=+\%(#"\n\?\)\@2<=\_s*\%(SELECT\|INSERT\|UPDATE\|DELETE\|WITH\|CREATE\|DROP\|ALTER\)\>+ skip=+\\\\\|\\"+ end=+[\\#]\@1<!"+ contains=@pikeSQL,pikeBindings keepend +syn case match + +syn match pikeBindings display contained ":\@1<!:\I\i*" + +syn match pikeCharacter "'[^\\']'" contains=pikeDelimiterSQ +syn match pikeCharacter "'[^']*'" contains=pikeSpecial,pikeDelimiterSQ +syn match pikeSpecialError "'\\[^'\"?\\abefnrtv]'" +syn match pikeDelimiterDQ display +"+ contained +syn match pikeDelimiterSQ display +'+ contained + +"when wanted, highlight trailing white space +if exists("c_space_errors") + if !exists("c_no_trail_space_error") + syn match pikeSpaceError display excludenl "\s\+$" + endif + if !exists("c_no_tab_space_error") + syn match pikeSpaceError display " \+\ze\t" + endif +endif "integer number, or floating point number without a dot and with "f". syn case ignore -syn match pikeNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" +syn match pikeNumbers display transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctalError,pikeOctal +" Same, but without octal error (for comments) +syn match pikeNumbersCom display contained transparent "\<\d\|\.\d" contains=pikeNumber,pikeFloat,pikeOctal +syn match pikeNumber display contained "\<\d\+\%(u\=l\{0,2}\|ll\=u\)\>" +"hex number +syn match pikeNumber display contained "\<0x\x\+\%(u\=l\{0,2}\|ll\=u\)\>" +" Flag the first zero of an octal number as something special +syn match pikeOctal display contained "\<0\o\+\%(u\=l\{0,2}\|ll\=u\)\>" contains=pikeOctalZero +syn match pikeOctalZero display contained "\<0" "floating point number, with dot, optional exponent -syn match pikeFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" +syn match pikeFloat display contained "\<\d\+\%(f\|\.[0-9.]\@!\d*\%(e[-+]\=\d\+\)\=[fl]\=\)" "floating point number, starting with a dot, optional exponent -syn match pikeFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" +syn match pikeFloat display contained "[0-9.]\@1<!\.\d\+\%(e[-+]\=\d\+\)\=[fl]\=\>" "floating point number, without dot, with exponent -syn match pikeFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" -"hex number -syn match pikeNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>" -"syn match pikeIdentifier "\<[a-z_][a-z0-9_]*\>" -syn case match +syn match pikeFloat display contained "\<\d\+e[-+]\=\d\+[fl]\=\>" + +"hexadecimal floating point number, two variants, with exponent +syn match pikeFloat display contained "\<0x\%(\x\+\.\?\|\x*\.\x\+\)p[-+]\=\d\+[fl]\=\>" + " flag an octal number with wrong digits -syn match pikeOctalError "\<0[0-7]*[89]" +syn match pikeOctalError display contained "\<0\o*[89]\d*" +syn case match if exists("c_comment_strings") " A comment can contain pikeString, pikeCharacter and pikeNumber. @@ -64,92 +186,201 @@ if exists("c_comment_strings") " need to use a special type of pikeString: pikeCommentString, which also ends on " "*/", and sees a "*" at the start of the line as comment again. " Unfortunately this doesn't very well work for // type of comments :-( - syntax match pikeCommentSkip contained "^\s*\*\($\|\s\+\)" - syntax region pikeCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=pikeSpecial,pikeCommentSkip - syntax region pikeComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial - syntax region pikeComment start="/\*" end="\*/" contains=pikeTodo,pikeCommentString,pikeCharacter,pikeNumber,pikeFloat - syntax match pikeComment "//.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber - syntax match pikeComment "#\!.*" contains=pikeTodo,pikeComment2String,pikeCharacter,pikeNumber + syn match pikeCommentSkip contained "^\s*\*\%($\|\s\+\)" + syn region pikeCommentString contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\ze\*/+ contains=pikeSpecial,pikeCommentSkip + syn region pikeComment2String contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=pikeSpecial + syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeComment2String,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord + if exists("c_no_comment_fold") + " Use "extend" here to have preprocessor lines not terminate halfway a + " comment. + syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord + else + syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeCommentString,pikeCharacter,pikeNumbersCom,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord + endif else - syn region pikeComment start="/\*" end="\*/" contains=pikeTodo - syn match pikeComment "//.*" contains=pikeTodo - syn match pikeComment "#!.*" contains=pikeTodo + syn region pikeCommentL start="//" skip="\\$" end="$" keepend contains=@pikeCommentGroup,pikeSpaceError,@Spell containedin=pikeWord,pikeFirstWord + if exists("c_no_comment_fold") + syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell extend containedin=pikeWord,pikeFirstWord + else + syn region pikeComment matchgroup=pikeCommentStart start="/\*" end="\*/" contains=@pikeCommentGroup,pikeCommentStartError,pikeSpaceError,@Spell fold extend containedin=pikeWord,pikeFirstWord + endif endif -syntax match pikeCommentError "\*/" +" keep a // comment separately, it terminates a preproc. conditional +syn match pikeCommentError display "\*/" +syn match pikeCommentStartError display "/\ze\*" contained -syn keyword pikeOperator sizeof -syn keyword pikeType int string void float mapping array multiset mixed -syn keyword pikeType program object function +syn keyword pikeOperator sizeof +syn keyword pikeOperator typeof _typeof _refs +syn keyword pikeOperator zero_type intp stringp arrayp mappingp multisetp +syn keyword pikeOperator objectp functionp programp callablep destructedp +syn keyword pikeOperator object_variablep undefinedp +syn keyword pikeOperator allocate equal +syn keyword pikeOperator aggregate aggregate_mapping aggregate_multiset +syn keyword pikeOperator map filter search replace reverse column rows +syn keyword pikeOperator indices values mkmapping mkmultiset m_delete sort +syn keyword pikeOperator m_delete destruct +syn keyword pikeOperator create _destruct _sprintf cast _encode _decode +syn keyword pikeOperator __hash _sizeof _values _indices __INIT _equal +syn keyword pikeOperator _is_type _m_delete _get_iterator _search +syn keyword pikeOperator _serialize _deserialize _sqrt _types _random +syn keyword pikeOperator _size_object -syn region pikePreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=pikeComment,pikeString,pikeCharacter,pikeNumber,pikeCommentError -syn region pikeIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn match pikeIncluded contained "<[^>]*>" -syn match pikeInclude "^\s*#\s*include\>\s*["<]" contains=pikeIncluded -"syn match pikeLineSkip "\\$" -syn region pikeDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen -syn region pikePreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,pikePreCondit,pikeIncluded,pikeInclude,pikeDefine,pikeInParen +syn keyword pikeType int void +syn keyword pikeType float +syn keyword pikeType bool string array mapping multiset mixed +syn keyword pikeType object function program auto -" Highlight User Labels -syn region pikeMulti transparent start='?' end=':' contains=ALLBUT,pikeIncluded,pikeSpecial,pikeTodo,pikeUserLabel,pikeBitField -" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' -syn match pikeUserLabel "^\s*\I\i*\s*:$" -syn match pikeUserLabel ";\s*\I\i*\s*:$"ms=s+1 -syn match pikeUserLabel "^\s*\I\i*\s*:[^:]"me=e-1 -syn match pikeUserLabel ";\s*\I\i*\s*:[^:]"ms=s+1,me=e-1 +syn keyword pikeType this this_object this_program +syn keyword pikeType sprintf_args sprintf_format sprintf_result +syn keyword pikeType strict_sprintf_format -" Avoid recognizing most bitfields as labels -syn match pikeBitField "^\s*\I\i*\s*:\s*[1-9]"me=e-1 -syn match pikeBitField ";\s*\I\i*\s*:\s*[1-9]"me=e-1 +syn keyword pikeStructure class enum typedef inherit import +syn keyword pikeTypedef typedef +syn keyword pikeStorageClass private protected public constant final variant +syn keyword pikeStorageClass optional inline extern static __deprecated__ lambda -syn sync ccomment pikeComment minlines=10 +syn keyword pikeConstant __LINE__ __FILE__ __DIR__ __DATE__ __TIME__ +syn keyword pikeConstant __AUTO_BIGNUM__ __NT__ +syn keyword pikeConstant __BUILD__ __COUNTER__ _MAJOR__ __MINOR__ __VERSION__ +syn keyword pikeConstant __REAL_BUILD__ _REAL_MAJOR__ __REAL_MINOR__ +syn keyword pikeConstant __REAL_VERSION__ __PIKE__ UNDEFINED -" 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_pike_syntax_inits") - if version < 508 - let did_pike_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> +" These should actually only be parsed in preprocessor conditionals +syn keyword pikeCppOperator contained defined constant efun _Pragma + +syn keyword pikeBoolean true false + +syn match pikeCppPrefix display "^\s*\zs#\s*[a-z]\+" contained +syn region pikePreCondit start="^\s*#\s*\%(if\%(n\?def\)\?\|el\%(se\)\?if\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix +syn match pikePreConditMatch display "^\s*\zs#\s*\%(else\|endif\)\>" +if !exists("c_no_if0") + syn cluster pikeCppOutInGroup contains=pikeCppInIf,pikeCppInElse,pikeCppInElse2,pikeCppOutIf,pikeCppOutIf2,pikeCppOutElse,pikeCppInSkip,pikeCppOutSkip + syn region pikeCppOutWrapper start="^\s*\zs#\s*if\s\+0\+\s*\%($\|//\|/\*\|&\)" end=".\@=\|$" contains=pikeCppOutIf,pikeCppOutElse,@NoSpell fold + syn region pikeCppOutIf contained start="0\+" matchgroup=pikeCppOutWrapper end="^\s*#\s*endif\>" contains=pikeCppOutIf2,pikeCppOutElse + if !exists("c_no_if0_fold") + syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell fold else - command -nargs=+ HiLink hi def link <args> + syn region pikeCppOutIf2 contained matchgroup=pikeCppOutWrapper start="0\+" end="^\ze\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0\+\s*\%($\|//\|/\*\|&\)\)\@!\|endif\>\)" contains=pikeSpaceError,pikeCppOutSkip,@Spell endif + syn region pikeCppOutElse contained matchgroup=pikeCppOutWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit + syn region pikeCppInWrapper start="^\s*\zs#\s*if\s\+0*[1-9]\d*\s*\%($\|//\|/\*\||\)" end=".\@=\|$" contains=pikeCppInIf,pikeCppInElse fold + syn region pikeCppInIf contained matchgroup=pikeCppInWrapper start="\d\+" end="^\s*#\s*endif\>" contains=TOP,pikePreCondit + if !exists("c_no_if0_fold") + syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 fold + else + syn region pikeCppInElse contained start="^\s*#\s*\%(else\>\|el\%(se\)\?if\s\+\%(0*[1-9]\d*\s*\%($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=pikeCppInIf contains=pikeCppInElse2 + endif + syn region pikeCppInElse2 contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(else\|el\%(se\)\?if\)\%([^/]\|/[^/*]\)*" end="^\ze\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip,@Spell + syn region pikeCppOutSkip contained start="^\s*#\s*if\%(n\?def\)\?\>" skip="\\$" end="^\s*#\s*endif\>" contains=pikeSpaceError,pikeCppOutSkip + syn region pikeCppInSkip contained matchgroup=pikeCppInWrapper start="^\s*#\s*\%(if\s\+\%(\d\+\s*\%($\|//\|/\*\||\|&\)\)\@!\|ifn\?def\>\)" skip="\\$" end="^\s*#\s*endif\>" containedin=pikeCppOutElse,pikeCppInIf,pikeCppInSkip contains=TOP,pikePreProc +endif +syn region pikeIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=pikeDelimiterDQ keepend +syn match pikeIncluded display contained "<[^>]*>" +syn match pikeInclude display "^\s*\zs#\s*include\>\s*["<]" contains=pikeIncluded +syn cluster pikePreProcGroup contains=pikeIncluded,pikeInclude,pikeEmbeddedString,pikeCppOutWrapper,pikeCppInWrapper,@pikeCppOutInGroup,pikeFormat,pikeMlString,pikeCommentStartError,@pikeBadGroup,pikeWord +syn region pikeDefine start="^\s*\zs#\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend contains=@pikeStmt,@pikeBadGroup +syn region pikePreProc start="^\s*\zs#\s*\%(pragma\|charset\|pike\|require\|string\|line\|warning\|error\)\>" skip="\\$" end="$" transparent keepend contains=pikeString,pikeCharacter,pikeNumbers,pikeCommentError,pikeSpaceError,pikeCppOperator,pikeCppPrefix,@Spell,pikeConstant - HiLink pikeLabel Label - HiLink pikeUserLabel Label - HiLink pikeConditional Conditional - HiLink pikeRepeat Repeat - HiLink pikeCharacter Character - HiLink pikeSpecialCharacter pikeSpecial - HiLink pikeNumber Number - HiLink pikeFloat Float - HiLink pikeOctalError pikeError - HiLink pikeParenError pikeError - HiLink pikeInParen pikeError - HiLink pikeCommentError pikeError - HiLink pikeOperator Operator - HiLink pikeInclude Include - HiLink pikePreProc PreProc - HiLink pikeDefine Macro - HiLink pikeIncluded pikeString - HiLink pikeError Error - HiLink pikeStatement Statement - HiLink pikePreCondit PreCondit - HiLink pikeType Type - HiLink pikeCommentError pikeError - HiLink pikeCommentString pikeString - HiLink pikeComment2String pikeString - HiLink pikeCommentSkip pikeComment - HiLink pikeString String - HiLink pikeComment Comment - HiLink pikeSpecial SpecialChar - HiLink pikeTodo Todo - HiLink pikeException pikeStatement - HiLink pikeCompoundType Constant - "HiLink pikeIdentifier Identifier - - delcommand HiLink +syn match pikeAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@pikeAutodoc containedin=pikeComment,pikeCommentL +syn cluster pikeCommentGroup add=pikeAutodocReal +syn cluster pikePreProcGroup add=pikeAutodocReal + +" Highlight User Labels +" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' +syn match pikeUserLabel display "\%(^\|[{};]\)\zs\I\i*\s*\ze:\%([^:]\|$\)" contained contains=NONE +syn match pikeUserLabel display "\%(\<\%(break\|continue\)\_s\+\)\@10<=\I\i*" contained contains=NONE +syn match pikeUserLabel display "\%(\<case\)\@5<=\s\+[^<()[\]{},;:]\+\ze::\@!" contained contains=pikeDelimiterDQ,pikeDelimiterSQ + +syn match pikeMappIndex display contained "[^<()[\]{},;:]\+\ze::\@!" contains=pikeDelimiterDQ,pikeDelimiterSQ +syn match pikeSoftCast display contained "\[[ \t\v\r\n.a-zA-Z0-9_():,|\+]" contains=NONE + +if exists("c_minlines") + let b:c_minlines = c_minlines +else + if !exists("c_no_if0") + let b:c_minlines = 400 " #if 0 constructs can be long + else + let b:c_minlines = 200 " mostly for multiline strings + endif endif +exec "syn sync ccomment pikeComment minlines=" . b:c_minlines +syn sync match pikeMlStringSync grouphere pikeMlString +^[^"#]\+#\"+ +syn sync match pikeAutodocSync grouphere pikeCommentL "^\s*//!" + +" Define the default highlighting. +" Only used when an item doesn't have highlighting yet +hi def link pikeFormat SpecialChar +hi def link pikeMlString String +hi def link pikeCommentL Comment +hi def link pikeCommentStart Comment +hi def link pikeLabel Label +hi def link pikeUserLabel Identifier +hi def link pikeConditional Conditional +hi def link pikeRepeat Repeat +hi def link pikeCharacter Character +hi def link pikeDelimiterDQ Delimiter +hi def link pikeDelimiterSQ Delimiter +hi def link pikeNumber Number +hi def link pikeOctal Number +hi def link pikeOctalZero PreProc " link this to Error if you want +hi def link pikeFloat Float +hi def link pikeOctalError Error +hi def link pikeCommentError Error +hi def link pikeCommentStartError Error +hi def link pikeSpaceError Error +hi def link pikeSpecialError Error +hi def link pikeOperator Operator +hi def link pikeCppOperator Operator +hi def link pikeStructure Structure +hi def link pikeTypedef Typedef +hi def link pikeStorageClass StorageClass +hi def link pikeInclude Include +hi def link pikeCppPrefix PreCondit +hi def link pikePreProc PreProc +hi def link pikeDefine Macro +hi def link pikeIncluded String +hi def link pikeError Error +hi def link pikeDebug Debug +hi def link pikeException Exception +hi def link pikeStatement Statement +hi def link pikeType Type +hi def link pikeConstant Constant +hi def link pikeBoolean Boolean +hi def link pikeCommentString String +hi def link pikeComment2String String +hi def link pikeCommentSkip Comment +hi def link pikeString String +hi def link pikeComment Comment +hi def link pikeSpecial SpecialChar +hi def link pikeTodo Todo +hi def link pikeBadContinuation Error + +hi def link pikeCppInWrapper PreCondit +hi def link pikeCppOutWrapper PreCondit +hi def link pikePreConditMatch PreCondit + +hi def link pikeCppOutSkip Comment +hi def link pikeCppInElse2 Comment +hi def link pikeCppOutIf2 Comment +hi def link pikeCppOut Comment + +hi def link pikePredef Statement +hi def link pikeBindings Identifier +hi def link pikeMappIndex Identifier +hi def link pikeSoftCast Type +hi def link pikeBadGroup Error +hi def link pikeBadPClose Error +hi def link pikeBadAClose Error +hi def link pikeBadBClose Error +hi def link pikeBadSPClose Error +hi def link pikeBadSAClose Error +hi def link pikeBadSBClose Error +hi def link pikeBadSPAClose Error +hi def link pikeBadSBAClose Error +hi def link pikeBadSClose Error let b:current_syntax = "pike" +let &cpo = s:cpo_save +unlet s:cpo_save " vim: ts=8 diff --git a/runtime/syntax/pilrc.vim b/runtime/syntax/pilrc.vim index 86d5611589..f0e5f9bbc7 100644 --- a/runtime/syntax/pilrc.vim +++ b/runtime/syntax/pilrc.vim @@ -4,10 +4,8 @@ " Last change: 2003 May 11 " Available on: http://www.schau.com/pilrcvim/pilrc.vim -" Remove any old syntax -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 @@ -119,30 +117,20 @@ syn region pilrcInclude start="public class" end="}" syn sync ccomment pilrcComment -if version >= 508 || !exists("did_pilrc_syntax_inits") - if version < 508 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - let did_pilrc_syntax_inits = 1 - - " The default methods for highlighting - HiLink pilrcKeyword Statement - HiLink pilrcType Type - HiLink pilrcError Error - HiLink pilrcCountry SpecialChar - HiLink pilrcLanguage SpecialChar - HiLink pilrcString SpecialChar - HiLink pilrcNumber Number - HiLink pilrcComment Comment - HiLink pilrcConstant Constant - HiLink pilrcFunction Function - HiLink pilrcInclude SpecialChar - HiLink pilrcIdentifier Number - - delcommand HiLink -endif + +" The default methods for highlighting +hi def link pilrcKeyword Statement +hi def link pilrcType Type +hi def link pilrcError Error +hi def link pilrcCountry SpecialChar +hi def link pilrcLanguage SpecialChar +hi def link pilrcString SpecialChar +hi def link pilrcNumber Number +hi def link pilrcComment Comment +hi def link pilrcConstant Constant +hi def link pilrcFunction Function +hi def link pilrcInclude SpecialChar +hi def link pilrcIdentifier Number + let b:current_syntax = "pilrc" diff --git a/runtime/syntax/pine.vim b/runtime/syntax/pine.vim index 4c64b9bbc7..aadf50be15 100644 --- a/runtime/syntax/pine.vim +++ b/runtime/syntax/pine.vim @@ -3,19 +3,12 @@ " Maintainer: David Pascoe <pascoedj@spamcop.net> " Last Change: Thu Feb 27 10:18:48 WST 2003, update for pine 4.53 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,128-167,224-235,- -else - set iskeyword=@,48-57,_,128-167,224-235,- -endif +setlocal iskeyword=@,48-57,_,128-167,224-235,- syn keyword pineConfig addrbook-sort-rule syn keyword pineConfig address-book @@ -351,21 +344,11 @@ syn keyword pineOption vertical-folder-list syn match pineComment "^#.*$" " 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_pine_syn_inits") - if version < 508 - let did_pine_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink pineConfig Type - HiLink pineComment Comment - HiLink pineOption Macro - delcommand HiLink -endif +hi def link pineConfig Type +hi def link pineComment Comment +hi def link pineOption Macro let b:current_syntax = "pine" diff --git a/runtime/syntax/pinfo.vim b/runtime/syntax/pinfo.vim index bf4126e59a..cb9e60ebb3 100644 --- a/runtime/syntax/pinfo.vim +++ b/runtime/syntax/pinfo.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: pinfo(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: pinfo(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/plaintex.vim b/runtime/syntax/plaintex.vim index 7020c68e9b..5cb49a0bfc 100644 --- a/runtime/syntax/plaintex.vim +++ b/runtime/syntax/plaintex.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: TeX (plain.tex format) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-10-26 +" Language: TeX (plain.tex format) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-10-26 if exists("b:current_syntax") finish diff --git a/runtime/syntax/pli.vim b/runtime/syntax/pli.vim index f8d7e51cf3..a274cc40bf 100644 --- a/runtime/syntax/pli.vim +++ b/runtime/syntax/pli.vim @@ -3,9 +3,8 @@ " using keywords from http://www.kednos.com/pli/docs/reference_manual/6291pro_contents.html " 2012-11-13 Alan Thompson -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -222,57 +221,46 @@ endif syn sync minlines=10 maxlines=100 " Define the default highlighting. -" For version 5.x and earlier, only when not done already. -" For version 5.8 and later, only when and item doesn't have highlighting -" yet. -if version >= 508 || !exists("did_pl1_syn_inits") - if version < 508 - let did_pl1_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when and item doesn't have highlighting yet. - HiLink pl1Attribute Macro - HiLink pl1BlockError Error - HiLink pl1BooleanLiteral Boolean - HiLink pl1CharLiteral Character - HiLink pl1Comment Comment - HiLink pl1CommentL Comment - HiLink pl1Conditional Conditional - HiLink pl1Error Error - HiLink pl1ErrInBracket Error - HiLink pl1ErrInBlock Error - HiLink pl1ErrInParen Error - HiLink pl1Exception Function - HiLink pl1FloatLiteral Float - HiLink pl1Function Function - HiLink pl1Garbage Error - HiLink pl1HostIdentifier Label - HiLink pl1Identifier Normal - HiLink pl1IntLiteral Number - HiLink pl1Operator Operator - HiLink pl1Paren Normal - HiLink pl1ParenError Error - HiLink pl1SpaceError Error - HiLink pl1Pseudo PreProc - HiLink pl1PreProc PreProc - HiLink pl1PreProcSym PreProc - HiLink pl1Keyword Keyword - HiLink pl1Other Keyword - HiLink pl1Repeat Repeat - HiLink pl1Statement Keyword - HiLink pl1Storage StorageClass - HiLink pl1StringError Error - HiLink pl1StringLiteral String - HiLink pl1CommentString String - HiLink pl1Comment2String String - HiLink pl1Symbol Normal - HiLink pl1Trigger Function - HiLink pl1TypeAttribute StorageClass - HiLink pl1Todo Todo +hi def link pl1Attribute Macro +hi def link pl1BlockError Error +hi def link pl1BooleanLiteral Boolean +hi def link pl1CharLiteral Character +hi def link pl1Comment Comment +hi def link pl1CommentL Comment +hi def link pl1Conditional Conditional +hi def link pl1Error Error +hi def link pl1ErrInBracket Error +hi def link pl1ErrInBlock Error +hi def link pl1ErrInParen Error +hi def link pl1Exception Function +hi def link pl1FloatLiteral Float +hi def link pl1Function Function +hi def link pl1Garbage Error +hi def link pl1HostIdentifier Label +hi def link pl1Identifier Normal +hi def link pl1IntLiteral Number +hi def link pl1Operator Operator +hi def link pl1Paren Normal +hi def link pl1ParenError Error +hi def link pl1SpaceError Error +hi def link pl1Pseudo PreProc +hi def link pl1PreProc PreProc +hi def link pl1PreProcSym PreProc +hi def link pl1Keyword Keyword +hi def link pl1Other Keyword +hi def link pl1Repeat Repeat +hi def link pl1Statement Keyword +hi def link pl1Storage StorageClass +hi def link pl1StringError Error +hi def link pl1StringLiteral String +hi def link pl1CommentString String +hi def link pl1Comment2String String +hi def link pl1Symbol Normal +hi def link pl1Trigger Function +hi def link pl1TypeAttribute StorageClass +hi def link pl1Todo Todo - delcommand HiLink -endif let b:current_syntax = "pl1" diff --git a/runtime/syntax/plm.vim b/runtime/syntax/plm.vim index bf7c32fd1c..c6618adacb 100644 --- a/runtime/syntax/plm.vim +++ b/runtime/syntax/plm.vim @@ -3,11 +3,8 @@ " Maintainer: Philippe Coulonges <cphil@cphil.net> " Last change: 2003 May 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -103,43 +100,33 @@ syn keyword plm386w16BuiltIn SETD SKIPD SKIPRD syn sync lines=50 " 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_plm_syntax_inits") - if version < 508 - let did_plm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later -" HiLink plmLabel Label -" HiLink plmConditional Conditional -" HiLink plmRepeat Repeat - HiLink plmTodo Todo - HiLink plmNumber Number - HiLink plmOperator Operator - HiLink plmDelimiter Operator - "HiLink plmShowTab Error - "HiLink plmShowTabc Error - HiLink plmIdentifier Identifier - HiLink plmBuiltIn Statement - HiLink plm286BuiltIn Statement - HiLink plm386BuiltIn Statement - HiLink plm386w16BuiltIn Statement - HiLink plmReserved Statement - HiLink plm386Reserved Statement - HiLink plmPreProc PreProc - HiLink plmCommentError plmError - HiLink plmCommentString plmString - HiLink plmComment2String plmString - HiLink plmCommentSkip plmComment - HiLink plmString String - HiLink plmComment Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +" hi def link plmLabel Label +" hi def link plmConditional Conditional +" hi def link plmRepeat Repeat +hi def link plmTodo Todo +hi def link plmNumber Number +hi def link plmOperator Operator +hi def link plmDelimiter Operator +"hi def link plmShowTab Error +"hi def link plmShowTabc Error +hi def link plmIdentifier Identifier +hi def link plmBuiltIn Statement +hi def link plm286BuiltIn Statement +hi def link plm386BuiltIn Statement +hi def link plm386w16BuiltIn Statement +hi def link plmReserved Statement +hi def link plm386Reserved Statement +hi def link plmPreProc PreProc +hi def link plmCommentError plmError +hi def link plmCommentString plmString +hi def link plmComment2String plmString +hi def link plmCommentSkip plmComment +hi def link plmString String +hi def link plmComment Comment + let b:current_syntax = "plm" diff --git a/runtime/syntax/plp.vim b/runtime/syntax/plp.vim index f59702d3b5..48dc4b249e 100644 --- a/runtime/syntax/plp.vim +++ b/runtime/syntax/plp.vim @@ -7,11 +7,8 @@ " Add to filetype.vim the following line (without quote sign): " au BufNewFile,BufRead *.plp setf plp -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,14 +16,9 @@ if !exists("main_syntax") let main_syntax = 'perlscript' endif -if version < 600 - so <sfile>:p:h/html.vim - syn include @PLPperl <sfile>:p:h/perl.vim -else - runtime! syntax/html.vim - unlet b:current_syntax - syn include @PLPperl syntax/perl.vim -endif +runtime! syntax/html.vim +unlet b:current_syntax +syn include @PLPperl syntax/perl.vim syn cluster htmlPreproc add=PLPperlblock diff --git a/runtime/syntax/plsql.vim b/runtime/syntax/plsql.vim index 6e513660f8..1868c9cb16 100644 --- a/runtime/syntax/plsql.vim +++ b/runtime/syntax/plsql.vim @@ -9,11 +9,8 @@ " Austin Ziegler (austin at halostatue dot ca) " Added 8i+ features. " -" For version 5.x, clear all syntax items. -" For version 6.x, quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -223,54 +220,44 @@ endif syn sync minlines=10 maxlines=100 " Define the default highlighting. -" For version 5.x 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_plsql_syn_inits") - if version < 508 - let did_plsql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet. - HiLink plsqlAttribute Macro - HiLink plsqlBlockError Error - HiLink plsqlBooleanLiteral Boolean - HiLink plsqlCharLiteral Character - HiLink plsqlComment Comment - HiLink plsqlCommentL Comment - HiLink plsqlConditional Conditional - HiLink plsqlError Error - HiLink plsqlErrInBracket Error - HiLink plsqlErrInBlock Error - HiLink plsqlErrInParen Error - HiLink plsqlException Function - HiLink plsqlFloatLiteral Float - HiLink plsqlFunction Function - HiLink plsqlGarbage Error - HiLink plsqlHostIdentifier Label - HiLink plsqlIdentifier Normal - HiLink plsqlIntLiteral Number - HiLink plsqlOperator Operator - HiLink plsqlParen Normal - HiLink plsqlParenError Error - HiLink plsqlSpaceError Error - HiLink plsqlPseudo PreProc - HiLink plsqlKeyword Keyword - HiLink plsqlRepeat Repeat - HiLink plsqlStorage StorageClass - HiLink plsqlSQLKeyword Function - HiLink plsqlStringError Error - HiLink plsqlStringLiteral String - HiLink plsqlCommentString String - HiLink plsqlComment2String String - HiLink plsqlSymbol Normal - HiLink plsqlTrigger Function - HiLink plsqlTypeAttribute StorageClass - HiLink plsqlTodo Todo +hi def link plsqlAttribute Macro +hi def link plsqlBlockError Error +hi def link plsqlBooleanLiteral Boolean +hi def link plsqlCharLiteral Character +hi def link plsqlComment Comment +hi def link plsqlCommentL Comment +hi def link plsqlConditional Conditional +hi def link plsqlError Error +hi def link plsqlErrInBracket Error +hi def link plsqlErrInBlock Error +hi def link plsqlErrInParen Error +hi def link plsqlException Function +hi def link plsqlFloatLiteral Float +hi def link plsqlFunction Function +hi def link plsqlGarbage Error +hi def link plsqlHostIdentifier Label +hi def link plsqlIdentifier Normal +hi def link plsqlIntLiteral Number +hi def link plsqlOperator Operator +hi def link plsqlParen Normal +hi def link plsqlParenError Error +hi def link plsqlSpaceError Error +hi def link plsqlPseudo PreProc +hi def link plsqlKeyword Keyword +hi def link plsqlRepeat Repeat +hi def link plsqlStorage StorageClass +hi def link plsqlSQLKeyword Function +hi def link plsqlStringError Error +hi def link plsqlStringLiteral String +hi def link plsqlCommentString String +hi def link plsqlComment2String String +hi def link plsqlSymbol Normal +hi def link plsqlTrigger Function +hi def link plsqlTypeAttribute StorageClass +hi def link plsqlTodo Todo - delcommand HiLink -endif let b:current_syntax = "plsql" diff --git a/runtime/syntax/po.vim b/runtime/syntax/po.vim index c09b960357..15d09b18bd 100644 --- a/runtime/syntax/po.vim +++ b/runtime/syntax/po.vim @@ -1,16 +1,13 @@ " Vim syntax file " Language: po (gettext) " Maintainer: Dwayne Bailey <dwayne@translate.org.za> -" Last Change: 2012 Apr 30 +" Last Change: 2015 Jun 07 " Contributors: Dwayne Bailey (Most advanced syntax highlighting) " Leonardo Fontenelle (Spell checking) " Nam SungHyun <namsh@kldp.org> (Original maintainer) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo @@ -52,6 +49,9 @@ syn match poCommentTranslator "^# .*$" contains=poCopyrightUnset syn match poCommentAutomatic "^#\..*$" syn match poCommentSources "^#:.*$" syn match poCommentFlags "^#,.*$" contains=poFlagFuzzy +syn match poDiffOld '\(^#| "[^{]*+}\|{+[^}]*+}\|{+[^}]*\|"$\)' contained +syn match poDiffNew '\(^#| "[^{]*-}\|{-[^}]*-}\|{-[^}]*\|"$\)' contained +syn match poCommentDiff "^#|.*$" contains=poDiffOld,poDiffNew " Translations (also includes header fields as they appear in a translation msgstr) syn region poCommentKDE start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained @@ -79,58 +79,51 @@ syn match poAcceleratorStr contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 c syn match poVariable contained "%\d" " 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_po_syn_inits") - if version < 508 - let did_po_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink poCommentSources PreProc - HiLink poComment Comment - HiLink poCommentAutomatic Comment - HiLink poCommentTranslator Comment - HiLink poCommentFlags Special - HiLink poCopyrightUnset Todo - HiLink poFlagFuzzy Todo - HiLink poObsolete Comment - - HiLink poStatementMsgid Statement - HiLink poStatementMsgstr Statement - HiLink poStatementMsgidplural Statement - HiLink poStatementMsgCTxt Statement - HiLink poPluralCaseN Constant - - HiLink poStringCTxt Comment - HiLink poStringID String - HiLink poStringSTR String - HiLink poCommentKDE Comment - HiLink poCommentKDEError Error - HiLink poPluralKDE Comment - HiLink poPluralKDEError Error - HiLink poHeaderItem Identifier - HiLink poHeaderUndefined Todo - HiLink poKDEdesktopFile Identifier - - HiLink poHtml Identifier - HiLink poHtmlNot String - HiLink poHtmlTranslatables String - HiLink poLineBreak String - - HiLink poFormat poSpecial - HiLink poSpecial Special - HiLink poAcceleratorId Special - HiLink poAcceleratorStr Special - HiLink poVariable Special - - HiLink poMsguniqError Special - HiLink poMsguniqErrorMarkers Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link poCommentSources PreProc +hi def link poComment Comment +hi def link poCommentAutomatic Comment +hi def link poCommentTranslator Comment +hi def link poCommentFlags Special +hi def link poCommentDiff Comment +hi def link poCopyrightUnset Todo +hi def link poFlagFuzzy Todo +hi def link poDiffOld Todo +hi def link poDiffNew Special +hi def link poObsolete Comment + +hi def link poStatementMsgid Statement +hi def link poStatementMsgstr Statement +hi def link poStatementMsgidplural Statement +hi def link poStatementMsgCTxt Statement +hi def link poPluralCaseN Constant + +hi def link poStringCTxt Comment +hi def link poStringID String +hi def link poStringSTR String +hi def link poCommentKDE Comment +hi def link poCommentKDEError Error +hi def link poPluralKDE Comment +hi def link poPluralKDEError Error +hi def link poHeaderItem Identifier +hi def link poHeaderUndefined Todo +hi def link poKDEdesktopFile Identifier + +hi def link poHtml Identifier +hi def link poHtmlNot String +hi def link poHtmlTranslatables String +hi def link poLineBreak String + +hi def link poFormat poSpecial +hi def link poSpecial Special +hi def link poAcceleratorId Special +hi def link poAcceleratorStr Special +hi def link poVariable Special + +hi def link poMsguniqError Special +hi def link poMsguniqErrorMarkers Comment + let b:current_syntax = "po" diff --git a/runtime/syntax/pod.vim b/runtime/syntax/pod.vim index b9f2e0854f..7c65a8433f 100644 --- a/runtime/syntax/pod.vim +++ b/runtime/syntax/pod.vim @@ -19,11 +19,8 @@ " Remove any old syntax stuff hanging around (this is suppressed " automatically by ":syn include" if necessary). -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -67,28 +64,18 @@ syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell " 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_pod_syntax_inits") - if version < 508 - let did_pod_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link podCommand Statement +hi def link podCmdText String +hi def link podOverIndent Number +hi def link podForKeywd Identifier +hi def link podFormat Identifier +hi def link podVerbatimLine PreProc +hi def link podSpecial Identifier +hi def link podEscape String +hi def link podEscape2 Number - HiLink podCommand Statement - HiLink podCmdText String - HiLink podOverIndent Number - HiLink podForKeywd Identifier - HiLink podFormat Identifier - HiLink podVerbatimLine PreProc - HiLink podSpecial Identifier - HiLink podEscape String - HiLink podEscape2 Number - - delcommand HiLink -endif if exists("perl_pod_spellcheck_headings") " Spell-check headings diff --git a/runtime/syntax/postscr.vim b/runtime/syntax/postscr.vim index fddfe4c947..00418f577d 100644 --- a/runtime/syntax/postscr.vim +++ b/runtime/syntax/postscr.vim @@ -13,11 +13,8 @@ " postscr_encodings - highlight encoding names (there are a lot) " postscr_andornot_binary - highlight and, or, and not as binary operators (not logical) " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -25,11 +22,7 @@ endif syn case match " Keyword characters - all 7-bit ASCII bar PS delimiters and ws -if version >= 600 - setlocal iskeyword=33-127,^(,^),^<,^>,^[,^],^{,^},^/,^% -else - set iskeyword=33-127,^(,^),^<,^>,^[,^],^{,^},^/,^% -endif +setlocal iskeyword=33-127,^(,^),^<,^>,^[,^],^{,^},^/,^% " Yer trusty old TODO highlghter! syn keyword postscrTodo contained TODO @@ -730,68 +723,58 @@ if exists("postscr_ghostscript") endif " GhostScript highlighting " 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_postscr_syntax_inits") - if version < 508 - let did_postscr_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink postscrComment Comment - - HiLink postscrConstant Constant - HiLink postscrString String - HiLink postscrASCIIString postscrString - HiLink postscrHexString postscrString - HiLink postscrASCII85String postscrString - HiLink postscrNumber Number - HiLink postscrInteger postscrNumber - HiLink postscrHex postscrNumber - HiLink postscrRadix postscrNumber - HiLink postscrFloat Float - HiLink postscrBoolean Boolean - - HiLink postscrIdentifier Identifier - HiLink postscrProcedure Function - - HiLink postscrName Statement - HiLink postscrConditional Conditional - HiLink postscrRepeat Repeat - HiLink postscrL2Repeat postscrRepeat - HiLink postscrOperator Operator - HiLink postscrL1Operator postscrOperator - HiLink postscrL2Operator postscrOperator - HiLink postscrL3Operator postscrOperator - HiLink postscrMathOperator postscrOperator - HiLink postscrLogicalOperator postscrOperator - HiLink postscrBinaryOperator postscrOperator - - HiLink postscrDSCComment SpecialComment - HiLink postscrSpecialChar SpecialChar - - HiLink postscrTodo Todo - - HiLink postscrError Error - HiLink postscrSpecialCharError postscrError - HiLink postscrASCII85CharError postscrError - HiLink postscrHexCharError postscrError - HiLink postscrASCIIStringError postscrError - HiLink postscrIdentifierError postscrError - - if exists("postscr_ghostscript") - HiLink postscrGSOperator postscrOperator - HiLink postscrGSMathOperator postscrMathOperator - else - HiLink postscrGSOperator postscrError - HiLink postscrGSMathOperator postscrError - endif - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +hi def link postscrComment Comment + +hi def link postscrConstant Constant +hi def link postscrString String +hi def link postscrASCIIString postscrString +hi def link postscrHexString postscrString +hi def link postscrASCII85String postscrString +hi def link postscrNumber Number +hi def link postscrInteger postscrNumber +hi def link postscrHex postscrNumber +hi def link postscrRadix postscrNumber +hi def link postscrFloat Float +hi def link postscrBoolean Boolean + +hi def link postscrIdentifier Identifier +hi def link postscrProcedure Function + +hi def link postscrName Statement +hi def link postscrConditional Conditional +hi def link postscrRepeat Repeat +hi def link postscrL2Repeat postscrRepeat +hi def link postscrOperator Operator +hi def link postscrL1Operator postscrOperator +hi def link postscrL2Operator postscrOperator +hi def link postscrL3Operator postscrOperator +hi def link postscrMathOperator postscrOperator +hi def link postscrLogicalOperator postscrOperator +hi def link postscrBinaryOperator postscrOperator + +hi def link postscrDSCComment SpecialComment +hi def link postscrSpecialChar SpecialChar + +hi def link postscrTodo Todo + +hi def link postscrError Error +hi def link postscrSpecialCharError postscrError +hi def link postscrASCII85CharError postscrError +hi def link postscrHexCharError postscrError +hi def link postscrASCIIStringError postscrError +hi def link postscrIdentifierError postscrError + +if exists("postscr_ghostscript") +hi def link postscrGSOperator postscrOperator +hi def link postscrGSMathOperator postscrMathOperator +else +hi def link postscrGSOperator postscrError +hi def link postscrGSMathOperator postscrError endif + let b:current_syntax = "postscr" " vim: ts=8 diff --git a/runtime/syntax/pov.vim b/runtime/syntax/pov.vim index 4c1fd9624a..8595bcb151 100644 --- a/runtime/syntax/pov.vim +++ b/runtime/syntax/pov.vim @@ -5,14 +5,8 @@ " Required Vim Version: 6.0 " Setup -if version >= 600 - " Quit when a syntax file was already loaded - if exists("b:current_syntax") - finish - endif -else - " Croak when an old Vim is sourcing us. - echo "Sorry, but this syntax file relies on Vim 6 features. Either upgrade Vim or use a version of " . expand("<sfile>:t:r") . " syntax file appropriate for Vim " . version/100 . "." . version %100 . "." +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/povini.vim b/runtime/syntax/povini.vim index 726fe1fc74..ac1f87875e 100644 --- a/runtime/syntax/povini.vim +++ b/runtime/syntax/povini.vim @@ -5,14 +5,8 @@ " Required Vim Version: 6.0 " Setup -if version >= 600 - " Quit when a syntax file was already loaded - if exists("b:current_syntax") - finish - endif -else - " Croak when an old Vim is sourcing us. - echo "Sorry, but this syntax file relies on Vim 6 features. Either upgrade Vim or usea version of " . expand("<sfile>:t:r") . " syntax file appropriate for Vim " . version/100 . "." . version %100 . "." +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/ppd.vim b/runtime/syntax/ppd.vim index 192f70c05d..da67e1f39f 100644 --- a/runtime/syntax/ppd.vim +++ b/runtime/syntax/ppd.vim @@ -3,11 +3,8 @@ " Maintainer: Bjoern Jacke <bjacke@suse.de> " Last Change: 2001-10-06 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -21,27 +18,17 @@ syn match ppdGUIText "/.*:" syn match ppdContraints "^*UIConstraints:" " 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_ahdl_syn_inits") - if version < 508 - let did_ahdl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - - HiLink ppdComment Comment - HiLink ppdDefine Statement - HiLink ppdUI Function - HiLink ppdUIGroup Function - HiLink ppdDef String - HiLink ppdGUIText Type - HiLink ppdContraints Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + + +hi def link ppdComment Comment +hi def link ppdDefine Statement +hi def link ppdUI Function +hi def link ppdUIGroup Function +hi def link ppdDef String +hi def link ppdGUIText Type +hi def link ppdContraints Special + let b:current_syntax = "ppd" diff --git a/runtime/syntax/ppwiz.vim b/runtime/syntax/ppwiz.vim index d3d7b3a17a..514f8f36cc 100644 --- a/runtime/syntax/ppwiz.vim +++ b/runtime/syntax/ppwiz.vim @@ -6,11 +6,8 @@ " Filename: ppwiz.vim " Remove old syntax stuff -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -63,33 +60,23 @@ syn match ppwizInteger "\d\+" contained syn cluster ppwizArgVal add=ppwizString,ppwizInteger " 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_ppwiz_syn_inits") - if version < 508 - let did_ppwiz_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink ppwizSpecial Special - HiLink ppwizEqual ppwizSpecial - HiLink ppwizOperator ppwizSpecial - HiLink ppwizComment Comment - HiLink ppwizDef PreProc - HiLink ppwizMacro Statement - HiLink ppwizArg Identifier - HiLink ppwizStdVar Identifier - HiLink ppwizRexxVar Identifier - HiLink ppwizString Constant - HiLink ppwizInteger Constant - HiLink ppwizCont ppwizSpecial - HiLink ppwizError Error - HiLink ppwizHTML Type +hi def link ppwizSpecial Special +hi def link ppwizEqual ppwizSpecial +hi def link ppwizOperator ppwizSpecial +hi def link ppwizComment Comment +hi def link ppwizDef PreProc +hi def link ppwizMacro Statement +hi def link ppwizArg Identifier +hi def link ppwizStdVar Identifier +hi def link ppwizRexxVar Identifier +hi def link ppwizString Constant +hi def link ppwizInteger Constant +hi def link ppwizCont ppwizSpecial +hi def link ppwizError Error +hi def link ppwizHTML Type - delcommand HiLink -endif let b:current_syntax = "ppwiz" diff --git a/runtime/syntax/prescribe.vim b/runtime/syntax/prescribe.vim index d89ee35253..cd5ddbeedd 100644 --- a/runtime/syntax/prescribe.vim +++ b/runtime/syntax/prescribe.vim @@ -4,11 +4,8 @@ " URL: http://www.hampft.de/vim/syntax/prescribe.vim " Last Change: 2005 Mar 04 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -44,25 +41,15 @@ syn region prescribeString start=+'+ end=+'+ skip=+\\'+ syn region prescribeComment start=+CMNT+ end=+;+ " 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_prescribe_syn_inits") - if version < 508 - let did_prescribe_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink prescribeSpecial PreProc - HiLink prescribeStatement Statement - HiLink prescribeNumber Number - HiLink prescribeCSETArg String - HiLink prescribeFRPOArg String - HiLink prescribeComment Comment +hi def link prescribeSpecial PreProc +hi def link prescribeStatement Statement +hi def link prescribeNumber Number +hi def link prescribeCSETArg String +hi def link prescribeFRPOArg String +hi def link prescribeComment Comment - delcommand HiLink -endif let b:current_syntax = "prescribe" diff --git a/runtime/syntax/procmail.vim b/runtime/syntax/procmail.vim index c2ffa39883..93f50fe9ef 100644 --- a/runtime/syntax/procmail.vim +++ b/runtime/syntax/procmail.vim @@ -4,11 +4,8 @@ " Last Change: 2003 Aug 14 " Author: Sonia Heimann -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -33,34 +30,24 @@ syn region procmailActionNested start=+^\s*{+ end=+^\s*}+ contains=procmailRecip syn region procmailRecipe start=+^\s*:.*$+ end=+^\s*\($\|}\)+me=e-1 contains=procmailComment,procmailCondition,procmailActionFolder,procmailActionVariable,procmailActionForward,procmailActionPipe,procmailActionNested,procmailVarDeclRegion " 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_procmail_syntax_inits") - if version < 508 - let did_procmail_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink procmailComment Comment - HiLink procmailTodo Todo +hi def link procmailComment Comment +hi def link procmailTodo Todo - HiLink procmailRecipe Statement - "HiLink procmailCondition Statement +hi def link procmailRecipe Statement +"hi def link procmailCondition Statement - HiLink procmailActionFolder procmailAction - HiLink procmailActionVariable procmailAction - HiLink procmailActionForward procmailAction - HiLink procmailActionPipe procmailAction - HiLink procmailAction Function - HiLink procmailVar Identifier - HiLink procmailVarDecl Identifier +hi def link procmailActionFolder procmailAction +hi def link procmailActionVariable procmailAction +hi def link procmailActionForward procmailAction +hi def link procmailActionPipe procmailAction +hi def link procmailAction Function +hi def link procmailVar Identifier +hi def link procmailVarDecl Identifier - HiLink procmailString String +hi def link procmailString String - delcommand HiLink -endif let b:current_syntax = "procmail" diff --git a/runtime/syntax/progress.vim b/runtime/syntax/progress.vim index 85a54a6505..5e7cfef299 100644 --- a/runtime/syntax/progress.vim +++ b/runtime/syntax/progress.vim @@ -11,22 +11,15 @@ " Version: 13 " Last Change: Nov 11 2012 -" For version 5.x: Clear all syntax item -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim -if version >= 600 - setlocal iskeyword=@,48-57,_,-,!,#,$,% -else - set iskeyword=@,48-57,_,-,!,#,$,% -endif +setlocal iskeyword=@,48-57,_,-,!,#,$,% " The Progress editor doesn't cope with tabs very well. set expandtab @@ -282,44 +275,34 @@ syn keyword ProgressType char[acter] int[eger] int64 dec[imal] log[ical] da[te] syn sync lines=800 " 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_progress_syntax_inits") - if version < 508 - let did_progress_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - " The default methods for highlighting. Can be overridden later. - HiLink ProgressByte Number - HiLink ProgressCase Repeat - HiLink ProgressComment Comment - HiLink ProgressConditional Conditional - HiLink ProgressDebug Debug - HiLink ProgressDo Repeat - HiLink ProgressEndError Error - HiLink ProgressFor Repeat - HiLink ProgressFunction Procedure - HiLink ProgressIdentifier Identifier - HiLink ProgressInclude Include - HiLink ProgressMatrixDelimiter Identifier - HiLink ProgressNumber Number - HiLink ProgressOperator Operator - HiLink ProgressPreProc PreProc - HiLink ProgressProcedure Procedure - HiLink ProgressQuote Delimiter - HiLink ProgressRepeat Repeat - HiLink ProgressReserved Statement - HiLink ProgressSpaceError Error - HiLink ProgressString String - HiLink ProgressTodo Todo - HiLink ProgressType Statement - HiLink ProgressShowTab Error +" The default methods for highlighting. Can be overridden later. +hi def link ProgressByte Number +hi def link ProgressCase Repeat +hi def link ProgressComment Comment +hi def link ProgressConditional Conditional +hi def link ProgressDebug Debug +hi def link ProgressDo Repeat +hi def link ProgressEndError Error +hi def link ProgressFor Repeat +hi def link ProgressFunction Procedure +hi def link ProgressIdentifier Identifier +hi def link ProgressInclude Include +hi def link ProgressMatrixDelimiter Identifier +hi def link ProgressNumber Number +hi def link ProgressOperator Operator +hi def link ProgressPreProc PreProc +hi def link ProgressProcedure Procedure +hi def link ProgressQuote Delimiter +hi def link ProgressRepeat Repeat +hi def link ProgressReserved Statement +hi def link ProgressSpaceError Error +hi def link ProgressString String +hi def link ProgressTodo Todo +hi def link ProgressType Statement +hi def link ProgressShowTab Error - delcommand HiLink -endif let b:current_syntax = "progress" diff --git a/runtime/syntax/prolog.vim b/runtime/syntax/prolog.vim index f5f0e673ec..3b09bb3548 100644 --- a/runtime/syntax/prolog.vim +++ b/runtime/syntax/prolog.vim @@ -1,17 +1,17 @@ " Vim syntax file " Language: PROLOG -" Maintainers: Thomas Koehler <jean-luc@picard.franken.de> -" Last Change: 2013 May 23 +" Maintainer: Thomas Koehler <jean-luc@picard.franken.de> +" Please be aware: I'm often slow to answer email due to a high +" non-computer related workload (sometimes 4-8 weeks) +" Last Change: 2016 September 6 " URL: http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/prolog.vim " There are two sets of highlighting in here: " If the "prolog_highlighting_clean" variable exists, it is rather sparse. " Otherwise you get more highlighting. -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -78,46 +78,36 @@ syn sync maxlines=50 " 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_prolog_syn_inits") - if version < 508 - let did_prolog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink prologComment Comment - HiLink prologCComment Comment - HiLink prologCharCode Special - - if exists ("prolog_highlighting_clean") - - HiLink prologKeyword Statement - HiLink prologClauseHead Statement - HiLink prologClause Normal - - else - - HiLink prologKeyword Keyword - HiLink prologClauseHead Constant - HiLink prologClause Normal - HiLink prologQuestion PreProc - HiLink prologSpecialCharacter Special - HiLink prologNumber Number - HiLink prologAsIs Normal - HiLink prologCommentError Error - HiLink prologAtom String - HiLink prologString String - HiLink prologOperator Operator - - endif - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link prologComment Comment +hi def link prologCComment Comment +hi def link prologCharCode Special + +if exists ("prolog_highlighting_clean") + +hi def link prologKeyword Statement +hi def link prologClauseHead Statement +hi def link prologClause Normal + +else + +hi def link prologKeyword Keyword +hi def link prologClauseHead Constant +hi def link prologClause Normal +hi def link prologQuestion PreProc +hi def link prologSpecialCharacter Special +hi def link prologNumber Number +hi def link prologAsIs Normal +hi def link prologCommentError Error +hi def link prologAtom String +hi def link prologString String +hi def link prologOperator Operator + endif + let b:current_syntax = "prolog" " vim: ts=8 diff --git a/runtime/syntax/promela.vim b/runtime/syntax/promela.vim index e812bc2749..add4514561 100644 --- a/runtime/syntax/promela.vim +++ b/runtime/syntax/promela.vim @@ -5,11 +5,8 @@ " Last Change: Thu Aug 7 21:22:48 CEST 2008 " Version: 0.5 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/proto.vim b/runtime/syntax/proto.vim index 4d6a77e84a..4615e0ca0e 100644 --- a/runtime/syntax/proto.vim +++ b/runtime/syntax/proto.vim @@ -22,9 +22,8 @@ " " http://code.google.com/p/protobuf/ -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/protocols.vim b/runtime/syntax/protocols.vim index 1dc109caf6..f31ca5a4b7 100644 --- a/runtime/syntax/protocols.vim +++ b/runtime/syntax/protocols.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: protocols(5) - Internet protocols definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: protocols(5) - Internet protocols definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/psf.vim b/runtime/syntax/psf.vim index 2b376f94cc..0971fe96bf 100644 --- a/runtime/syntax/psf.vim +++ b/runtime/syntax/psf.vim @@ -4,10 +4,8 @@ " Maintainer: Rex Barzee <rex_barzee@hp.com> " Last change: 25 Apr 2001 -if version < 600 - " Remove any old syntax stuff hanging around - syn clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -73,27 +71,17 @@ syn match psfComment "#.*$" " 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_psf_syntax_inits") - if version < 508 - let did_psf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink psfObject Statement - HiLink psfAttrib Type - HiLink psfQuotString String - HiLink psfObjTag Identifier - HiLink psfAttAbbrev PreProc - HiLink psfObjTags Identifier - - HiLink psfComment Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link psfObject Statement +hi def link psfAttrib Type +hi def link psfQuotString String +hi def link psfObjTag Identifier +hi def link psfAttAbbrev PreProc +hi def link psfObjTags Identifier + +hi def link psfComment Comment + " Long descriptions and copyrights confuse the syntax highlighting, so " force vim to backup at least 100 lines before the top visible line diff --git a/runtime/syntax/ptcap.vim b/runtime/syntax/ptcap.vim index 45590cf61b..1ebeb5227b 100644 --- a/runtime/syntax/ptcap.vim +++ b/runtime/syntax/ptcap.vim @@ -4,11 +4,8 @@ " URL: http://folk.uio.no/hakonrk/vim/syntax/ptcap.vim " Last Change: 2001 May 15 -" 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 @@ -73,34 +70,25 @@ syn region ptcapField start=":" skip="[^\\]\(\\\\\)*\\$" end="[^\\]\(\\\\\)* syn region ptcapString matchgroup=ptcapOperator start="=" skip="[^\\]\(\\\\\)*\\:" matchgroup=ptcapDelimiter end=":"me=e-1 matchgroup=NONE end="[^\\]\(\\\\\)*[^\\]$" end="^$" contains=ptcapEscapedChar,ptcapLineCont keepend contained syn region ptcapComment start="^\s*#" end="$" contains=ptcapLeadBlank -if version >= 508 || !exists("did_ptcap_syntax_inits") - if version < 508 - let did_ptcap_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ptcapComment Comment - HiLink ptcapDelimiter Delimiter - " The highlighting of "ptcapEntry" should always be overridden by - " its contents, so I use Todo highlighting to indicate that there - " is work to be done with the syntax file if you can see it :-) - HiLink ptcapEntry Todo - HiLink ptcapError Error - HiLink ptcapEscapedChar SpecialChar - HiLink ptcapField Type - HiLink ptcapLeadBlank NONE - HiLink ptcapLineCont Special - HiLink ptcapNames Label - HiLink ptcapNumber NONE - HiLink ptcapNumberError Error - HiLink ptcapOperator Operator - HiLink ptcapSpecialCap Type - HiLink ptcapString NONE - - delcommand HiLink -endif + +hi def link ptcapComment Comment +hi def link ptcapDelimiter Delimiter +" The highlighting of "ptcapEntry" should always be overridden by +" its contents, so I use Todo highlighting to indicate that there +" is work to be done with the syntax file if you can see it :-) +hi def link ptcapEntry Todo +hi def link ptcapError Error +hi def link ptcapEscapedChar SpecialChar +hi def link ptcapField Type +hi def link ptcapLeadBlank NONE +hi def link ptcapLineCont Special +hi def link ptcapNames Label +hi def link ptcapNumber NONE +hi def link ptcapNumberError Error +hi def link ptcapOperator Operator +hi def link ptcapSpecialCap Type +hi def link ptcapString NONE + let b:current_syntax = "ptcap" diff --git a/runtime/syntax/purifylog.vim b/runtime/syntax/purifylog.vim index 8bcfb4b006..2143d9fe28 100644 --- a/runtime/syntax/purifylog.vim +++ b/runtime/syntax/purifylog.vim @@ -3,11 +3,8 @@ " Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> " Last Change: 2003 May 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -57,62 +54,52 @@ syn match purifyLogZPR "^ZPR:.*$" syn match purifyLogZPW "^ZPW:.*$" " 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_purifyLog_syntax_inits") - if version < 508 - let did_purifyLog_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink purifyLogFIU purifyLogInformational - HiLink purifyLogMAF purifyLogInformational - HiLink purifyLogMIU purifyLogInformational - HiLink purifyLogSIG purifyLogInformational - HiLink purifyLogWPF purifyLogInformational - HiLink purifyLogWPM purifyLogInformational - HiLink purifyLogWPN purifyLogInformational - HiLink purifyLogWPR purifyLogInformational - HiLink purifyLogWPW purifyLogInformational - HiLink purifyLogWPX purifyLogInformational +hi def link purifyLogFIU purifyLogInformational +hi def link purifyLogMAF purifyLogInformational +hi def link purifyLogMIU purifyLogInformational +hi def link purifyLogSIG purifyLogInformational +hi def link purifyLogWPF purifyLogInformational +hi def link purifyLogWPM purifyLogInformational +hi def link purifyLogWPN purifyLogInformational +hi def link purifyLogWPR purifyLogInformational +hi def link purifyLogWPW purifyLogInformational +hi def link purifyLogWPX purifyLogInformational - HiLink purifyLogABR purifyLogWarning - HiLink purifyLogBSR purifyLogWarning - HiLink purifyLogBSW purifyLogWarning - HiLink purifyLogFMR purifyLogWarning - HiLink purifyLogMLK purifyLogWarning - HiLink purifyLogMSE purifyLogWarning - HiLink purifyLogPAR purifyLogWarning - HiLink purifyLogPLK purifyLogWarning - HiLink purifyLogSBR purifyLogWarning - HiLink purifyLogSOF purifyLogWarning - HiLink purifyLogUMC purifyLogWarning - HiLink purifyLogUMR purifyLogWarning +hi def link purifyLogABR purifyLogWarning +hi def link purifyLogBSR purifyLogWarning +hi def link purifyLogBSW purifyLogWarning +hi def link purifyLogFMR purifyLogWarning +hi def link purifyLogMLK purifyLogWarning +hi def link purifyLogMSE purifyLogWarning +hi def link purifyLogPAR purifyLogWarning +hi def link purifyLogPLK purifyLogWarning +hi def link purifyLogSBR purifyLogWarning +hi def link purifyLogSOF purifyLogWarning +hi def link purifyLogUMC purifyLogWarning +hi def link purifyLogUMR purifyLogWarning - HiLink purifyLogABW purifyLogCorrupting - HiLink purifyLogBRK purifyLogCorrupting - HiLink purifyLogFMW purifyLogCorrupting - HiLink purifyLogFNH purifyLogCorrupting - HiLink purifyLogFUM purifyLogCorrupting - HiLink purifyLogMRE purifyLogCorrupting - HiLink purifyLogSBW purifyLogCorrupting +hi def link purifyLogABW purifyLogCorrupting +hi def link purifyLogBRK purifyLogCorrupting +hi def link purifyLogFMW purifyLogCorrupting +hi def link purifyLogFNH purifyLogCorrupting +hi def link purifyLogFUM purifyLogCorrupting +hi def link purifyLogMRE purifyLogCorrupting +hi def link purifyLogSBW purifyLogCorrupting - HiLink purifyLogCOR purifyLogFatal - HiLink purifyLogNPR purifyLogFatal - HiLink purifyLogNPW purifyLogFatal - HiLink purifyLogZPR purifyLogFatal - HiLink purifyLogZPW purifyLogFatal +hi def link purifyLogCOR purifyLogFatal +hi def link purifyLogNPR purifyLogFatal +hi def link purifyLogNPW purifyLogFatal +hi def link purifyLogZPR purifyLogFatal +hi def link purifyLogZPW purifyLogFatal - HiLink purifyLogHeader Comment - HiLink purifyLogInformational PreProc - HiLink purifyLogWarning Type - HiLink purifyLogCorrupting Error - HiLink purifyLogFatal Error +hi def link purifyLogHeader Comment +hi def link purifyLogInformational PreProc +hi def link purifyLogWarning Type +hi def link purifyLogCorrupting Error +hi def link purifyLogFatal Error - delcommand HiLink -endif let b:current_syntax = "purifylog" diff --git a/runtime/syntax/pyrex.vim b/runtime/syntax/pyrex.vim index 7dc9b955b0..b860658975 100644 --- a/runtime/syntax/pyrex.vim +++ b/runtime/syntax/pyrex.vim @@ -4,21 +4,14 @@ " URL: http://marcobari.altervista.org/pyrex_vim.html " Last Change: 2009 Nov 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the Python syntax to start with -if version < 600 - so <sfile>:p:h/python.vim -else - runtime! syntax/python.vim - unlet b:current_syntax -endif +runtime! syntax/python.vim +unlet b:current_syntax " Pyrex extentions syn keyword pyrexStatement cdef typedef ctypedef sizeof @@ -44,24 +37,15 @@ syn match pythonInclude "from" syn match pyrexForFrom "\(for[^:]*\)\@<=from" " Default highlighting -if version >= 508 || !exists("did_pyrex_syntax_inits") - if version < 508 - let did_pyrex_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink pyrexStatement Statement - HiLink pyrexType Type - HiLink pyrexStructure Structure - HiLink pyrexInclude PreCondit - HiLink pyrexAccess pyrexStatement - if exists("python_highlight_builtins") || exists("pyrex_highlight_builtins") - HiLink pyrexBuiltin Function - endif - HiLink pyrexForFrom Statement - - delcommand HiLink +hi def link pyrexStatement Statement +hi def link pyrexType Type +hi def link pyrexStructure Structure +hi def link pyrexInclude PreCondit +hi def link pyrexAccess pyrexStatement +if exists("python_highlight_builtins") || exists("pyrex_highlight_builtins") +hi def link pyrexBuiltin Function endif +hi def link pyrexForFrom Statement + let b:current_syntax = "pyrex" diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index a4ffcd4240..23666a1473 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,9 +1,8 @@ " Vim syntax file " Language: Python -" Maintainer: Neil Schemenauer <nas@python.ca> -" Last Change: 2014 Jul 16 -" Credits: Zvezdan Petkovic <zpetkovic@acm.org> -" Neil Schemenauer <nas@python.ca> +" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> +" Last Change: 2016 Oct 29 +" Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " " This version is a major rewrite by Zvezdan Petkovic. @@ -37,11 +36,8 @@ " let python_highlight_all = 1 " -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif @@ -50,28 +46,53 @@ endif let s:cpo_save = &cpo set cpo&vim +if exists("python_no_doctest_highlight") + let python_no_doctest_code_highlight = 1 +endif + +if exists("python_highlight_all") + if exists("python_no_builtin_highlight") + unlet python_no_builtin_highlight + endif + if exists("python_no_doctest_code_highlight") + unlet python_no_doctest_code_highlight + endif + if exists("python_no_doctest_highlight") + unlet python_no_doctest_highlight + endif + if exists("python_no_exception_highlight") + unlet python_no_exception_highlight + endif + if exists("python_no_number_highlight") + unlet python_no_number_highlight + endif + let python_space_error_highlight = 1 +endif + " Keep Python keywords in alphabetical order inside groups for easy " comparison with the table in the 'Python Language Reference' -" http://docs.python.org/reference/lexical_analysis.html#keywords. +" https://docs.python.org/2/reference/lexical_analysis.html#keywords, +" https://docs.python.org/3/reference/lexical_analysis.html#keywords. " Groups are in the order presented in NAMING CONVENTIONS in syntax.txt. " Exceptions come last at the end of each group (class and def below). " " Keywords 'with' and 'as' are new in Python 2.6 " (use 'from __future__ import with_statement' in Python 2.5). " -" Some compromises had to be made to support both Python 3.0 and 2.6. -" We include Python 3.0 features, but when a definition is duplicated, +" Some compromises had to be made to support both Python 3 and 2. +" We include Python 3 features, but when a definition is duplicated, " the last definition takes precedence. " -" - 'False', 'None', and 'True' are keywords in Python 3.0 but they are -" built-ins in 2.6 and will be highlighted as built-ins below. -" - 'exec' is a built-in in Python 3.0 and will be highlighted as +" - 'False', 'None', and 'True' are keywords in Python 3 but they are +" built-ins in 2 and will be highlighted as built-ins below. +" - 'exec' is a built-in in Python 3 and will be highlighted as " built-in below. -" - 'nonlocal' is a keyword in Python 3.0 and will be highlighted. -" - 'print' is a built-in in Python 3.0 and will be highlighted as -" built-in below (use 'from __future__ import print_function' in 2.6) +" - 'nonlocal' is a keyword in Python 3 and will be highlighted. +" - 'print' is a built-in in Python 3 and will be highlighted as +" built-in below (use 'from __future__ import print_function' in 2) +" - async and await were added in Python 3.5 and are soft keywords. " -syn keyword pythonStatement False, None, True +syn keyword pythonStatement False None True syn keyword pythonStatement as assert break continue del exec global syn keyword pythonStatement lambda nonlocal pass print return with yield syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite @@ -80,31 +101,49 @@ syn keyword pythonRepeat for while syn keyword pythonOperator and in is not or syn keyword pythonException except finally raise try syn keyword pythonInclude from import +syn keyword pythonAsync async await " Decorators (new in Python 2.4) -syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite -" The zero-length non-grouping match before the function name is -" extremely important in pythonFunction. Without it, everything is -" interpreted as a function inside the contained environment of -" doctests. " A dot must be allowed because of @MyClass.myfunc decorators. -syn match pythonFunction - \ "\%(\%(def\s\|class\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained +syn match pythonDecorator "@" display contained +syn match pythonDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDecorator + +" Python 3.5 introduced the use of the same symbol for matrix multiplication: +" https://www.python.org/dev/peps/pep-0465/. We now have to exclude the +" symbol from highlighting when used in that context. +" Single line multiplication. +syn match pythonMatrixMultiply + \ "\%(\w\|[])]\)\s*@" + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ transparent +" Multiplication continued on the next line after backslash. +syn match pythonMatrixMultiply + \ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@" + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ transparent +" Multiplication in a parenthesized expression over multiple lines with @ at +" the start of each continued line; very similar to decorators and complex. +syn match pythonMatrixMultiply + \ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*" + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ transparent + +syn match pythonFunction "\h\w*" display contained syn match pythonComment "#.*$" contains=pythonTodo,@Spell syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained " Triple-quoted strings can contain doctests. -syn region pythonString +syn region pythonString matchgroup=pythonQuotes \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1" \ contains=pythonEscape,@Spell -syn region pythonString +syn region pythonString matchgroup=pythonTripleQuotes \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend \ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell -syn region pythonRawString +syn region pythonRawString matchgroup=pythonQuotes \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1" \ contains=@Spell -syn region pythonRawString +syn region pythonRawString matchgroup=pythonTripleQuotes \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend \ contains=pythonSpaceError,pythonDoctest,@Spell @@ -113,28 +152,9 @@ syn match pythonEscape "\\\o\{1,3}" contained syn match pythonEscape "\\x\x\{2}" contained syn match pythonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained " Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/ -syn match pythonEscape "\\N{.\{-}}" contained +syn match pythonEscape "\\N{\a\+\%(\s\a\+\)*}" contained syn match pythonEscape "\\$" -if exists("python_highlight_all") - if exists("python_no_builtin_highlight") - unlet python_no_builtin_highlight - endif - if exists("python_no_doctest_code_highlight") - unlet python_no_doctest_code_highlight - endif - if exists("python_no_doctest_highlight") - unlet python_no_doctest_highlight - endif - if exists("python_no_exception_highlight") - unlet python_no_exception_highlight - endif - if exists("python_no_number_highlight") - unlet python_no_number_highlight - endif - let python_space_error_highlight = 1 -endif - " It is very important to understand all details before changing the " regular expressions below or their order. " The word boundaries are *not* the floating-point number boundaries @@ -148,7 +168,8 @@ endif " - 08e0 or 08j are highlighted, " " and so on, as specified in the 'Python Language Reference'. -" http://docs.python.org/reference/lexical_analysis.html#numeric-literals +" https://docs.python.org/2/reference/lexical_analysis.html#numeric-literals +" https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals if !exists("python_no_number_highlight") " numbers (including longs and complex) syn match pythonNumber "\<0[oO]\=\o\+[Ll]\=\>" @@ -160,54 +181,62 @@ if !exists("python_no_number_highlight") syn match pythonNumber \ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@=" syn match pythonNumber - \ "\%(^\|\W\)\@<=\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" + \ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" endif " Group the built-ins in the order in the 'Python Library Reference' for " easier comparison. -" http://docs.python.org/library/constants.html -" http://docs.python.org/library/functions.html -" http://docs.python.org/library/functions.html#non-essential-built-in-functions +" https://docs.python.org/2/library/constants.html +" https://docs.python.org/3/library/constants.html +" http://docs.python.org/2/library/functions.html +" http://docs.python.org/3/library/functions.html +" http://docs.python.org/2/library/functions.html#non-essential-built-in-functions +" http://docs.python.org/3/library/functions.html#non-essential-built-in-functions " Python built-in functions are in alphabetical order. if !exists("python_no_builtin_highlight") " built-in constants - " 'False', 'True', and 'None' are also reserved words in Python 3.0 + " 'False', 'True', and 'None' are also reserved words in Python 3 syn keyword pythonBuiltin False True None syn keyword pythonBuiltin NotImplemented Ellipsis __debug__ " built-in functions - syn keyword pythonBuiltin abs all any bin bool chr classmethod - syn keyword pythonBuiltin compile complex delattr dict dir divmod - syn keyword pythonBuiltin enumerate eval filter float format + syn keyword pythonBuiltin abs all any bin bool bytearray callable chr + syn keyword pythonBuiltin classmethod compile complex delattr dict dir + syn keyword pythonBuiltin divmod enumerate eval filter float format syn keyword pythonBuiltin frozenset getattr globals hasattr hash syn keyword pythonBuiltin help hex id input int isinstance syn keyword pythonBuiltin issubclass iter len list locals map max - syn keyword pythonBuiltin min next object oct open ord pow print - syn keyword pythonBuiltin property range repr reversed round set + syn keyword pythonBuiltin memoryview min next object oct open ord pow + syn keyword pythonBuiltin print property range repr reversed round set syn keyword pythonBuiltin setattr slice sorted staticmethod str syn keyword pythonBuiltin sum super tuple type vars zip __import__ - " Python 2.6 only - syn keyword pythonBuiltin basestring callable cmp execfile file + " Python 2 only + syn keyword pythonBuiltin basestring cmp execfile file syn keyword pythonBuiltin long raw_input reduce reload unichr syn keyword pythonBuiltin unicode xrange - " Python 3.0 only - syn keyword pythonBuiltin ascii bytearray bytes exec memoryview - " non-essential built-in functions; Python 2.6 only + " Python 3 only + syn keyword pythonBuiltin ascii bytes exec + " non-essential built-in functions; Python 2 only syn keyword pythonBuiltin apply buffer coerce intern + " avoid highlighting attributes as builtins + syn match pythonAttribute /\.\h\w*/hs=s+1 + \ contains=ALLBUT,pythonBuiltin,pythonFunction,pythonAsync + \ transparent endif " From the 'Python Library Reference' class hierarchy at the bottom. -" http://docs.python.org/library/exceptions.html +" http://docs.python.org/2/library/exceptions.html +" http://docs.python.org/3/library/exceptions.html if !exists("python_no_exception_highlight") - " builtin base exceptions (only used as base classes for other exceptions) + " builtin base exceptions (used mostly as base classes for other exceptions) syn keyword pythonExceptions BaseException Exception - syn keyword pythonExceptions ArithmeticError EnvironmentError + syn keyword pythonExceptions ArithmeticError BufferError syn keyword pythonExceptions LookupError - " builtin base exception removed in Python 3.0 - syn keyword pythonExceptions StandardError + " builtin base exceptions removed in Python 3 + syn keyword pythonExceptions EnvironmentError StandardError " builtin exceptions (actually raised) - syn keyword pythonExceptions AssertionError AttributeError BufferError + syn keyword pythonExceptions AssertionError AttributeError syn keyword pythonExceptions EOFError FloatingPointError GeneratorExit - syn keyword pythonExceptions IOError ImportError IndentationError + syn keyword pythonExceptions ImportError IndentationError syn keyword pythonExceptions IndexError KeyError KeyboardInterrupt syn keyword pythonExceptions MemoryError NameError NotImplementedError syn keyword pythonExceptions OSError OverflowError ReferenceError @@ -215,13 +244,27 @@ if !exists("python_no_exception_highlight") syn keyword pythonExceptions SystemError SystemExit TabError TypeError syn keyword pythonExceptions UnboundLocalError UnicodeError syn keyword pythonExceptions UnicodeDecodeError UnicodeEncodeError - syn keyword pythonExceptions UnicodeTranslateError ValueError VMSError - syn keyword pythonExceptions WindowsError ZeroDivisionError + syn keyword pythonExceptions UnicodeTranslateError ValueError + syn keyword pythonExceptions ZeroDivisionError + " builtin OS exceptions in Python 3 + syn keyword pythonExceptions BlockingIOError BrokenPipeError + syn keyword pythonExceptions ChildProcessError ConnectionAbortedError + syn keyword pythonExceptions ConnectionError ConnectionRefusedError + syn keyword pythonExceptions ConnectionResetError FileExistsError + syn keyword pythonExceptions FileNotFoundError InterruptedError + syn keyword pythonExceptions IsADirectoryError NotADirectoryError + syn keyword pythonExceptions PermissionError ProcessLookupError + syn keyword pythonExceptions RecursionError StopAsyncIteration + syn keyword pythonExceptions TimeoutError + " builtin exceptions deprecated/removed in Python 3 + syn keyword pythonExceptions IOError VMSError WindowsError " builtin warnings syn keyword pythonExceptions BytesWarning DeprecationWarning FutureWarning syn keyword pythonExceptions ImportWarning PendingDeprecationWarning syn keyword pythonExceptions RuntimeWarning SyntaxWarning UnicodeWarning syn keyword pythonExceptions UserWarning Warning + " builtin warnings in Python 3 + syn keyword pythonExceptions ResourceWarning endif if exists("python_space_error_highlight") @@ -239,7 +282,7 @@ if !exists("python_no_doctest_highlight") if !exists("python_no_doctest_code_highlight") syn region pythonDoctest \ start="^\s*>>>\s" end="^\s*$" - \ contained contains=ALLBUT,pythonDoctest,@Spell + \ contained contains=ALLBUT,pythonDoctest,pythonFunction,@Spell syn region pythonDoctestValue \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$" \ contained @@ -251,48 +294,41 @@ if !exists("python_no_doctest_highlight") endif " Sync at the beginning of class, function, or method definition. -syn sync match pythonSync grouphere NONE "^\s*\%(def\|class\)\s\+\h\w*\s*(" - -if version >= 508 || !exists("did_python_syn_inits") - if version <= 508 - let did_python_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +syn sync match pythonSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]" - " The default highlight links. Can be overridden later. - HiLink pythonStatement Statement - HiLink pythonConditional Conditional - HiLink pythonRepeat Repeat - HiLink pythonOperator Operator - HiLink pythonException Exception - HiLink pythonInclude Include - HiLink pythonDecorator Define - HiLink pythonFunction Function - HiLink pythonComment Comment - HiLink pythonTodo Todo - HiLink pythonString String - HiLink pythonRawString String - HiLink pythonEscape Special - if !exists("python_no_number_highlight") - HiLink pythonNumber Number - endif - if !exists("python_no_builtin_highlight") - HiLink pythonBuiltin Function - endif - if !exists("python_no_exception_highlight") - HiLink pythonExceptions Structure - endif - if exists("python_space_error_highlight") - HiLink pythonSpaceError Error - endif - if !exists("python_no_doctest_highlight") - HiLink pythonDoctest Special - HiLink pythonDoctestValue Define - endif - - delcommand HiLink +" The default highlight links. Can be overridden later. +hi def link pythonStatement Statement +hi def link pythonConditional Conditional +hi def link pythonRepeat Repeat +hi def link pythonOperator Operator +hi def link pythonException Exception +hi def link pythonInclude Include +hi def link pythonAsync Statement +hi def link pythonDecorator Define +hi def link pythonDecoratorName Function +hi def link pythonFunction Function +hi def link pythonComment Comment +hi def link pythonTodo Todo +hi def link pythonString String +hi def link pythonRawString String +hi def link pythonQuotes String +hi def link pythonTripleQuotes pythonQuotes +hi def link pythonEscape Special +if !exists("python_no_number_highlight") + hi def link pythonNumber Number +endif +if !exists("python_no_builtin_highlight") + hi def link pythonBuiltin Function +endif +if !exists("python_no_exception_highlight") + hi def link pythonExceptions Structure +endif +if exists("python_space_error_highlight") + hi def link pythonSpaceError Error +endif +if !exists("python_no_doctest_highlight") + hi def link pythonDoctest Special + hi def link pythonDoctestValue Define endif let b:current_syntax = "python" diff --git a/runtime/syntax/quake.vim b/runtime/syntax/quake.vim index 3a9b68d6f3..7db53106ad 100644 --- a/runtime/syntax/quake.vim +++ b/runtime/syntax/quake.vim @@ -1,11 +1,11 @@ " Vim syntax file -" Language: Quake[1-3] configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: Quake[1-3] configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 " quake_is_quake1 - the syntax is to be used for quake1 configs " quake_is_quake2 - the syntax is to be used for quake2 configs " quake_is_quake3 - the syntax is to be used for quake3 configs -" Credits: Tomasz Kalkosinski wrote the original quake3Colors stuff +" Credits: Tomasz Kalkosinski wrote the original quake3Colors stuff if exists("b:current_syntax") finish diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index 85a6eaa2ae..45ff498b3b 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -3,44 +3,158 @@ " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> " Tom Payne <tom@tompayne.org> -" Last Change: Wed Jul 09, 2014 10:29PM +" Contributor: Johannes Ranke <jranke@uni-bremen.de> +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Apr 08, 2017 07:01PM " Filenames: *.R *.r *.Rhistory *.Rt -" -" NOTE: The highlighting of R functions is defined in the -" r-plugin/functions.vim, which is part of vim-r-plugin2: -" http://www.vim.org/scripts/script.php?script_id=2628 +" +" NOTE: The highlighting of R functions might be defined in +" runtime files created by a filetype plugin, if installed. " " CONFIGURATION: -" syntax folding can be turned on by +" Syntax folding can be turned on by " " let r_syntax_folding = 1 " +" ROxygen highlighting can be turned off by +" +" let r_syntax_hl_roxygen = 0 +" " Some lines of code were borrowed from Zhuojun Chen. if exists("b:current_syntax") finish endif -setlocal iskeyword=@,48-57,_,. +if has("patch-7.4.1142") + syn iskeyword @,48-57,_,. +else + setlocal iskeyword=@,48-57,_,. +endif + +" The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017. +if exists("g:r_hl_roxygen") + let g:r_syntax_hl_roxygen = g:r_hl_roxygen +endif +if exists("g:r_syn_minlines") + let g:r_syntax_minlines = g:r_syn_minlines +endif -if exists("g:r_syntax_folding") +if exists("g:r_syntax_folding") && g:r_syntax_folding setlocal foldmethod=syntax endif +if !exists("g:r_syntax_hl_roxygen") + let g:r_syntax_hl_roxygen = 1 +endif syn case match " Comment syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" -syn match rComment contains=@Spell,rCommentTodo "#.*" +syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" " Roxygen -syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" -syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" -syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" -syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)" -syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" -syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)" -syn match rOComment contains=@Spell,rOKeyword "#'.*" +if g:r_syntax_hl_roxygen + " A roxygen block can start at the beginning of a file (first version) and + " after a blank line (second version). It ends when a line that does not + " contain a roxygen comment. In the following comments, any line containing + " a roxygen comment marker (one or two hash signs # followed by a single + " quote ' and preceded only by whitespace) is called a roxygen line. A + " roxygen line containing only a roxygen comment marker, optionally followed + " by whitespace is called an empty roxygen line. + + " First we match all roxygen blocks as containing only a title. In case an + " empty roxygen line ending the title or a tag is found, this will be + " overriden later by the definitions of rOBlock. + syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag + syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag + + " When a roxygen block has a title and additional content, the title + " consists of one or more roxygen lines (as little as possible are matched), + " followed either by an empty roxygen line + syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + + " or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @). + syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + + " If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title + syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + + " A title as part of a block is always at the beginning of the block, i.e. + " either at the start of a file or after a completely empty line. + syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitleTag contained "@title" + + syn match rOCommentKey "#\{1,2}'" contained + syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold + + " rOTag list generated from the lists in + " https://github.com/klutometis/roxygen/R/rd.R and + " https://github.com/klutometis/roxygen/R/namespace.R + " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/ + " Plus we need the @include tag + + " rd.R + syn match rOTag contained "@aliases" + syn match rOTag contained "@author" + syn match rOTag contained "@backref" + syn match rOTag contained "@concept" + syn match rOTag contained "@describeIn" + syn match rOTag contained "@description" + syn match rOTag contained "@details" + syn match rOTag contained "@docType" + syn match rOTag contained "@encoding" + syn match rOTag contained "@evalRd" + syn match rOTag contained "@example" + syn match rOTag contained "@examples" + syn match rOTag contained "@family" + syn match rOTag contained "@field" + syn match rOTag contained "@format" + syn match rOTag contained "@inherit" + syn match rOTag contained "@inheritParams" + syn match rOTag contained "@inheritDotParams" + syn match rOTag contained "@inheritSection" + syn match rOTag contained "@keywords" + syn match rOTag contained "@method" + syn match rOTag contained "@name" + syn match rOTag contained "@md" + syn match rOTag contained "@noMd" + syn match rOTag contained "@noRd" + syn match rOTag contained "@note" + syn match rOTag contained "@param" + syn match rOTag contained "@rdname" + syn match rOTag contained "@rawRd" + syn match rOTag contained "@references" + syn match rOTag contained "@return" + syn match rOTag contained "@section" + syn match rOTag contained "@seealso" + syn match rOTag contained "@slot" + syn match rOTag contained "@source" + syn match rOTag contained "@template" + syn match rOTag contained "@templateVar" + syn match rOTag contained "@title" + syn match rOTag contained "@usage" + " namespace.R + syn match rOTag contained "@export" + syn match rOTag contained "@exportClass" + syn match rOTag contained "@exportMethod" + syn match rOTag contained "@exportPattern" + syn match rOTag contained "@import" + syn match rOTag contained "@importClassesFrom" + syn match rOTag contained "@importFrom" + syn match rOTag contained "@importMethodsFrom" + syn match rOTag contained "@rawNamespace" + syn match rOTag contained "@S3method" + syn match rOTag contained "@useDynLib" + " other + syn match rOTag contained "@include" +endif if &filetype == "rhelp" @@ -79,12 +193,12 @@ syn keyword rRepeat for in repeat while syn keyword rConstant T F LETTERS letters month.abb month.name pi syn keyword rConstant R.version.string -syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_ +syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_ " Constants syn keyword rConstant NULL syn keyword rBoolean FALSE TRUE -syn keyword rNumber NA Inf NaN +syn keyword rNumber NA Inf NaN " integer syn match rInteger "\<\d\+L" @@ -93,7 +207,7 @@ syn match rInteger "\<\d\+[Ee]+\=\d\+L" " number with no fractional part or exponent syn match rNumber "\<\d\+\>" -" hexadecimal number +" hexadecimal number syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+" " floating point number with integer and fractional parts and optional exponent @@ -111,17 +225,19 @@ syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i" syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i" syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" +syn match rAssign '=' syn match rOperator "&" syn match rOperator '-' syn match rOperator '\*' syn match rOperator '+' -syn match rOperator '=' if &filetype != "rmd" && &filetype != "rrst" syn match rOperator "[|!<>^~/:]" else syn match rOperator "[|!<>^~`/:]" endif syn match rOperator "%\{2}\|%\S\{-}%" +syn match rOperator '\([!><]\)\@<==' +syn match rOperator '==' syn match rOpError '\*\{3}' syn match rOpError '//' syn match rOpError '&&&' @@ -129,8 +245,8 @@ syn match rOpError '|||' syn match rOpError '<<' syn match rOpError '>>' -syn match rArrow "<\{1,2}-" -syn match rArrow "->\{1,2}" +syn match rAssign "<\{1,2}-" +syn match rAssign "->\{1,2}" " Special syn match rDelimiter "[,;:]" @@ -151,9 +267,29 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -" Source list of R functions. The list is produced by the Vim-R-plugin -" http://www.vim.org/scripts/script.php?script_id=2628 -runtime r-plugin/functions.vim +" Use Nvim-R to highlight functions dynamically if it is installed +if !exists("g:r_syntax_fun_pattern") + let s:ff = split(substitute(globpath(&rtp, "R/functions.vim"), "functions.vim", "", "g"), "\n") + if len(s:ff) > 0 + let g:r_syntax_fun_pattern = 0 + else + let g:r_syntax_fun_pattern = 1 + endif +endif + +" Only use Nvim-R to highlight functions if they should not be highlighted +" according to a generic pattern +if g:r_syntax_fun_pattern == 1 + syn match rFunction '[0-9a-zA-Z_\.]\+\s*\ze(' +else + if !exists("g:R_hi_fun") + let g:R_hi_fun = 1 + endif + if g:R_hi_fun + " Nvim-R: + runtime R/functions.vim + endif +endif syn match rDollar display contained "\$" syn match rDollar display contained "@" @@ -171,7 +307,7 @@ if &filetype == "rhelp" endif " Type -syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame +syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame " Name of object with spaces if &filetype != "rmd" && &filetype != "rrst" @@ -179,18 +315,23 @@ if &filetype != "rmd" && &filetype != "rrst" endif if &filetype == "rhelp" - syn match rhPreProc "^#ifdef.*" - syn match rhPreProc "^#endif.*" + syn match rhPreProc "^#ifdef.*" + syn match rhPreProc "^#endif.*" syn match rhSection "\\dontrun\>" endif +if exists("r_syntax_minlines") + exe "syn sync minlines=" . r_syntax_minlines +else + syn sync minlines=40 +endif + " Define the default highlighting. -hi def link rArrow Statement +hi def link rAssign Statement hi def link rBoolean Boolean hi def link rBraceError Error hi def link rComment Comment hi def link rCommentTodo Todo -hi def link rOComment Comment hi def link rComplex Number hi def link rConditional Conditional hi def link rConstant Constant @@ -204,7 +345,7 @@ hi def link rHelpIdent Identifier hi def link rhPreProc PreProc hi def link rhSection PreCondit hi def link rInteger Number -hi def link rLstElmt Normal +hi def link rLstElmt Normal hi def link rNameWSpace Normal hi def link rNumber Number hi def link rOperator Operator @@ -217,7 +358,16 @@ hi def link rStatement Statement hi def link rString String hi def link rStrError Error hi def link rType Type -hi def link rOKeyword Title +if g:r_syntax_hl_roxygen + hi def link rOTitleTag Operator + hi def link rOTag Operator + hi def link rOTitleBlock Title + hi def link rOBlock Comment + hi def link rOBlockNoTitle Comment + hi def link rOTitle Title + hi def link rOCommentKey Comment + hi def link rOExamples SpecialComment +endif let b:current_syntax="r" diff --git a/runtime/syntax/racc.vim b/runtime/syntax/racc.vim index d412227cbd..2d4c176eb7 100644 --- a/runtime/syntax/racc.vim +++ b/runtime/syntax/racc.vim @@ -1,7 +1,7 @@ " Vim default file -" Language: Racc input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-06-22 +" Language: Racc input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-06-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/radiance.vim b/runtime/syntax/radiance.vim index 461b708f0e..c49e339a28 100644 --- a/runtime/syntax/radiance.vim +++ b/runtime/syntax/radiance.vim @@ -18,20 +18,13 @@ " comments, external command names and the null-modifier "void". -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " all printing characters except '#' and '!' are valid in names. -if version >= 600 - setlocal iskeyword=\",$-~ -else - set iskeyword=\",$-~ -endif +setlocal iskeyword=\",$-~ " The null-modifier syn keyword radianceKeyword void @@ -130,29 +123,19 @@ syn keyword radianceTodo contained TODO XXX syn match radianceComment "#.*$" contains=radianceTodo " 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_radiance_syn_inits") - if version < 508 - let did_radiance_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink radianceKeyword Keyword - HiLink radianceExtraType Type - HiLink radianceSurfType Type - HiLink radianceLightType Type - HiLink radianceMatType Type - HiLink radiancePatType Type - HiLink radianceTexType Type - HiLink radianceMixType Type - HiLink radianceComment Comment - HiLink radianceCommand Function - HiLink radianceID String - HiLink radianceTodo Todo - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link radianceKeyword Keyword +hi def link radianceExtraType Type +hi def link radianceSurfType Type +hi def link radianceLightType Type +hi def link radianceMatType Type +hi def link radiancePatType Type +hi def link radianceTexType Type +hi def link radianceMixType Type +hi def link radianceComment Comment +hi def link radianceCommand Function +hi def link radianceID String +hi def link radianceTodo Todo let b:current_syntax = "radiance" diff --git a/runtime/syntax/ratpoison.vim b/runtime/syntax/ratpoison.vim index 9fc59bec0d..af8676c43d 100644 --- a/runtime/syntax/ratpoison.vim +++ b/runtime/syntax/ratpoison.vim @@ -5,11 +5,8 @@ " Last Change: 2011 Apr 11 " Previous Maintainer: Doug Kearns <djkea2@gus.gscit.monash.edu.au> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -247,33 +244,23 @@ syn match ratpoisonVoidCommand "^\s*\zsvsplit\ze\s*$" syn match ratpoisonVoidCommand "^\s*\zswindows\ze\s*$" " 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_ratpoison_syn_inits") - if version < 508 - let did_ratpoison_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink ratpoisonBooleanArg Boolean - HiLink ratpoisonCommandArg Keyword - HiLink ratpoisonComment Comment - HiLink ratpoisonDefCommand Identifier - HiLink ratpoisonGravityArg Constant - HiLink ratpoisonKeySeqArg Special - HiLink ratpoisonNumberArg Number - HiLink ratpoisonSetArg Keyword - HiLink ratpoisonStringCommand Identifier - HiLink ratpoisonTodo Todo - HiLink ratpoisonVoidCommand Identifier - HiLink ratpoisonWinFmtArg Special - HiLink ratpoisonWinNameArg Constant - HiLink ratpoisonWinListArg Constant +hi def link ratpoisonBooleanArg Boolean +hi def link ratpoisonCommandArg Keyword +hi def link ratpoisonComment Comment +hi def link ratpoisonDefCommand Identifier +hi def link ratpoisonGravityArg Constant +hi def link ratpoisonKeySeqArg Special +hi def link ratpoisonNumberArg Number +hi def link ratpoisonSetArg Keyword +hi def link ratpoisonStringCommand Identifier +hi def link ratpoisonTodo Todo +hi def link ratpoisonVoidCommand Identifier +hi def link ratpoisonWinFmtArg Special +hi def link ratpoisonWinNameArg Constant +hi def link ratpoisonWinListArg Constant - delcommand HiLink -endif let b:current_syntax = "ratpoison" diff --git a/runtime/syntax/rc.vim b/runtime/syntax/rc.vim index c3feb97816..4c6856bc83 100644 --- a/runtime/syntax/rc.vim +++ b/runtime/syntax/rc.vim @@ -1,15 +1,15 @@ " Vim syntax file " Language: M$ Resource files (*.rc) -" Maintainer: Heiko Erhardt <Heiko.Erhardt@munich.netsurf.de> -" Last Change: 2001 May 09 +" Maintainer: Christian Brabandt +" Last Change: 2015-05-29 +" Repository: https://github.com/chrisbra/vim-rc-syntax +" License: Vim (see :h license) +" Previous Maintainer: Heiko Erhardt <Heiko.Erhardt@munich.netsurf.de> " This file is based on the c.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -21,7 +21,7 @@ syn keyword rcMainObject MENU ACCELERATORS TOOLBAR DIALOG syn keyword rcMainObject STRINGTABLE MESSAGETABLE RCDATA DLGINIT DESIGNINFO syn keyword rcSubObject POPUP MENUITEM SEPARATOR -syn keyword rcSubObject CONTROL LTEXT CTEXT EDITTEXT +syn keyword rcSubObject CONTROL LTEXT CTEXT RTEXT EDITTEXT syn keyword rcSubObject BUTTON PUSHBUTTON DEFPUSHBUTTON GROUPBOX LISTBOX COMBOBOX syn keyword rcSubObject FILEVERSION PRODUCTVERSION FILEFLAGSMASK FILEFLAGS FILEOS syn keyword rcSubObject FILETYPE FILESUBTYPE @@ -145,55 +145,45 @@ syn region rcPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|erro syn sync ccomment rcComment minlines=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_rc_syntax_inits") - if version < 508 - let did_rc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink rcCharacter Character - HiLink rcSpecialCharacter rcSpecial - HiLink rcNumber Number - HiLink rcFloat Float - HiLink rcOctalError rcError - HiLink rcParenError rcError - HiLink rcInParen rcError - HiLink rcCommentError rcError - HiLink rcInclude Include - HiLink rcPreProc PreProc - HiLink rcDefine Macro - HiLink rcIncluded rcString - HiLink rcError Error - HiLink rcPreCondit PreCondit - HiLink rcCommentString rcString - HiLink rcComment2String rcString - HiLink rcCommentSkip rcComment - HiLink rcString String - HiLink rcComment Comment - HiLink rcSpecial SpecialChar - HiLink rcTodo Todo - - HiLink rcAttribute rcCommonAttribute - HiLink rcStdId rcStatement - HiLink rcStatement Statement - - " Default color overrides - hi def rcLanguage term=reverse ctermbg=Red ctermfg=Yellow guibg=Red guifg=Yellow - hi def rcMainObject term=underline ctermfg=Blue guifg=Blue - hi def rcSubObject ctermfg=Green guifg=Green - hi def rcCaptionParam term=underline ctermfg=DarkGreen guifg=Green - hi def rcParam ctermfg=DarkGreen guifg=DarkGreen - hi def rcStatement ctermfg=DarkGreen guifg=DarkGreen - hi def rcCommonAttribute ctermfg=Brown guifg=Brown - - "HiLink rcIdentifier Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link rcCharacter Character +hi def link rcSpecialCharacter rcSpecial +hi def link rcNumber Number +hi def link rcFloat Float +hi def link rcOctalError rcError +hi def link rcParenError rcError +hi def link rcInParen rcError +hi def link rcCommentError rcError +hi def link rcInclude Include +hi def link rcPreProc PreProc +hi def link rcDefine Macro +hi def link rcIncluded rcString +hi def link rcError Error +hi def link rcPreCondit PreCondit +hi def link rcCommentString rcString +hi def link rcComment2String rcString +hi def link rcCommentSkip rcComment +hi def link rcString String +hi def link rcComment Comment +hi def link rcSpecial SpecialChar +hi def link rcTodo Todo + +hi def link rcAttribute rcCommonAttribute +hi def link rcStdId rcStatement +hi def link rcStatement Statement + +" Default color overrides +hi def rcLanguage term=reverse ctermbg=Red ctermfg=Yellow guibg=Red guifg=Yellow +hi def rcMainObject term=underline ctermfg=Blue guifg=Blue +hi def rcSubObject ctermfg=Green guifg=Green +hi def rcCaptionParam term=underline ctermfg=DarkGreen guifg=Green +hi def rcParam ctermfg=DarkGreen guifg=DarkGreen +hi def rcStatement ctermfg=DarkGreen guifg=DarkGreen +hi def rcCommonAttribute ctermfg=Brown guifg=Brown + +"hi def link rcIdentifier Identifier + let b:current_syntax = "rc" diff --git a/runtime/syntax/rcs.vim b/runtime/syntax/rcs.vim index e45d5fdbb6..5a34802ada 100644 --- a/runtime/syntax/rcs.vim +++ b/runtime/syntax/rcs.vim @@ -9,11 +9,8 @@ " Options: " rcs_folding = 1 For folding strings -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif @@ -52,25 +49,15 @@ else endif " 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_rcs_syn_inits") - if version <= 508 - let did_rcs_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet. - HiLink rcsKeyword Keyword - HiLink rcsNumber Identifier - HiLink rcsString String - HiLink rcsTextStr String - HiLink rcsSpecial Special - HiLink rcsDiffLines Special - HiLink rcsEOFError Error +hi def link rcsKeyword Keyword +hi def link rcsNumber Identifier +hi def link rcsString String +hi def link rcsTextStr String +hi def link rcsSpecial Special +hi def link rcsDiffLines Special +hi def link rcsEOFError Error - delcommand HiLink -endif let b:current_syntax = "rcs" diff --git a/runtime/syntax/rcslog.vim b/runtime/syntax/rcslog.vim index acacfa124b..18f4593c77 100644 --- a/runtime/syntax/rcslog.vim +++ b/runtime/syntax/rcslog.vim @@ -3,11 +3,8 @@ " Maintainer: Joe Karthauser <joe@freebsd.org> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -16,22 +13,12 @@ syn match rcslogFile "^RCS file:.*" syn match rcslogDate "^date: .*$" " 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_rcslog_syntax_inits") - if version < 508 - let did_rcslog_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink rcslogFile Type - HiLink rcslogRevision Constant - HiLink rcslogDate Identifier +hi def link rcslogFile Type +hi def link rcslogRevision Constant +hi def link rcslogDate Identifier - delcommand HiLink -endif let b:current_syntax = "rcslog" diff --git a/runtime/syntax/readline.vim b/runtime/syntax/readline.vim index 091722e5e5..7aa28d2b9a 100644 --- a/runtime/syntax/readline.vim +++ b/runtime/syntax/readline.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: readline(3) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2012-04-25 +" Language: readline(3) configuration file +" Maintainer: Daniel Moch <daniel@danielmoch.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2017-12-25 " readline_has_bash - if defined add support for bash specific " settings/functions @@ -150,6 +151,9 @@ syn keyword readlineVariable contained \ skipwhite \ comment-begin \ isearch-terminators + \ vi-cmd-mode-string + \ vi-ins-mode-string + \ emacs-mode-string syn keyword readlineVariable contained \ nextgroup=readlineNumber diff --git a/runtime/syntax/rebol.vim b/runtime/syntax/rebol.vim index e6395758f3..a5d50c4ab1 100644 --- a/runtime/syntax/rebol.vim +++ b/runtime/syntax/rebol.vim @@ -6,11 +6,8 @@ " URL: http://www.eandem.co.uk/mrw/vim " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,11 +15,7 @@ endif syn case ignore " As per current users documentation -if version < 600 - set isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ -else - setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ -endif +setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ " Yer TODO highlighter syn keyword rebolTodo contained TODO @@ -145,65 +138,55 @@ syn keyword rebolConstant none " 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_rebol_syntax_inits") - if version < 508 - let did_rebol_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link rebolTodo Todo + +hi def link rebolStatement Statement +hi def link rebolLabel Label +hi def link rebolConditional Conditional +hi def link rebolRepeat Repeat + +hi def link rebolOperator Operator +hi def link rebolLogicOperator rebolOperator +hi def link rebolLogicFunction rebolLogicOperator +hi def link rebolMathOperator rebolOperator +hi def link rebolMathFunction rebolMathOperator +hi def link rebolBinaryOperator rebolOperator +hi def link rebolBinaryFunction rebolBinaryOperator + +hi def link rebolType Type +hi def link rebolTypeFunction rebolOperator + +hi def link rebolWord Identifier +hi def link rebolWordPath rebolWord +hi def link rebolFunction Function + +hi def link rebolCharacter Character +hi def link rebolSpecialCharacter SpecialChar +hi def link rebolString String + +hi def link rebolNumber Number +hi def link rebolInteger rebolNumber +hi def link rebolDecimal rebolNumber +hi def link rebolTime rebolNumber +hi def link rebolDate rebolNumber +hi def link rebolMoney rebolNumber +hi def link rebolBinary rebolNumber +hi def link rebolEmail rebolString +hi def link rebolFile rebolString +hi def link rebolURL rebolString +hi def link rebolIssue rebolNumber +hi def link rebolTuple rebolNumber +hi def link rebolFloat Float +hi def link rebolBoolean Boolean + +hi def link rebolConstant Constant + +hi def link rebolComment Comment + +hi def link rebolError Error - HiLink rebolTodo Todo - - HiLink rebolStatement Statement - HiLink rebolLabel Label - HiLink rebolConditional Conditional - HiLink rebolRepeat Repeat - - HiLink rebolOperator Operator - HiLink rebolLogicOperator rebolOperator - HiLink rebolLogicFunction rebolLogicOperator - HiLink rebolMathOperator rebolOperator - HiLink rebolMathFunction rebolMathOperator - HiLink rebolBinaryOperator rebolOperator - HiLink rebolBinaryFunction rebolBinaryOperator - - HiLink rebolType Type - HiLink rebolTypeFunction rebolOperator - - HiLink rebolWord Identifier - HiLink rebolWordPath rebolWord - HiLink rebolFunction Function - - HiLink rebolCharacter Character - HiLink rebolSpecialCharacter SpecialChar - HiLink rebolString String - - HiLink rebolNumber Number - HiLink rebolInteger rebolNumber - HiLink rebolDecimal rebolNumber - HiLink rebolTime rebolNumber - HiLink rebolDate rebolNumber - HiLink rebolMoney rebolNumber - HiLink rebolBinary rebolNumber - HiLink rebolEmail rebolString - HiLink rebolFile rebolString - HiLink rebolURL rebolString - HiLink rebolIssue rebolNumber - HiLink rebolTuple rebolNumber - HiLink rebolFloat Float - HiLink rebolBoolean Boolean - - HiLink rebolConstant Constant - - HiLink rebolComment Comment - - HiLink rebolError Error - - delcommand HiLink -endif if exists("my_rebol_file") if file_readable(expand(my_rebol_file)) diff --git a/runtime/syntax/redif.vim b/runtime/syntax/redif.vim index 1b83c07790..9fa9064a86 100644 --- a/runtime/syntax/redif.vim +++ b/runtime/syntax/redif.vim @@ -7,10 +7,8 @@ " File Extension: rdf " Note: The ReDIF format is used by RePEc. -" To be compatible with Vim 5.8 use: -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/registry.vim b/runtime/syntax/registry.vim index e9ff8fcaba..67b5e49bcb 100644 --- a/runtime/syntax/registry.vim +++ b/runtime/syntax/registry.vim @@ -1,15 +1,13 @@ " Vim syntax file " Language: Windows Registry export with regedit (*.reg) -" Maintainer: Dominique Stphan (dominique@mggen.com) -" URL: http://www.mggen.com/vim/syntax/registry.zip -" Last change: 2004 Apr 23 +" Maintainer: Dominique Stéphan (dominique@mggen.com) +" URL: http://www.mggen.com/vim/syntax/registry.zip (doesn't work) +" Last change: 2014 Oct 31 +" Included patch from Alexander A. Ulitin " clear any unwanted syntax defs -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -17,7 +15,7 @@ endif syn case ignore " Head of regedit .reg files, it's REGEDIT4 on Win9#/NT -syn match registryHead "^REGEDIT[0-9]*$" +syn match registryHead "^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$" " Comment syn match registryComment "^;.*$" @@ -58,7 +56,7 @@ syn region registryRemove start="\[\-" end="\]" contains=registryHKEY,registryGU " Subkey syn match registrySubKey "^\".*\"=" " Default value -syn match registrySubKey "^\@=" +syn match registrySubKey "^@=" " Numbers @@ -84,29 +82,20 @@ syn match registryHex "^\s*\([0-9a-fA-F]\{2},\)\{0,999}\([0-9a-fA-F]\{2}\|\\\)$ " Dword (32 bits) syn match registryDword "dword:[0-9a-fA-F]\{8}$" contains=registrySpecial -if version >= 508 || !exists("did_registry_syntax_inits") - if version < 508 - let did_registry_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif " The default methods for highlighting. Can be overridden later - HiLink registryComment Comment - HiLink registryHead Constant - HiLink registryHKEY Constant - HiLink registryPath Special - HiLink registryRemove PreProc - HiLink registryGUID Identifier - HiLink registrySpecial Special - HiLink registrySubKey Type - HiLink registryString String - HiLink registryHex Number - HiLink registryDword Number - - delcommand HiLink -endif +hi def link registryComment Comment +hi def link registryHead Constant +hi def link registryHKEY Constant +hi def link registryPath Special +hi def link registryRemove PreProc +hi def link registryGUID Identifier +hi def link registrySpecial Special +hi def link registrySubKey Type +hi def link registryString String +hi def link registryHex Number +hi def link registryDword Number + let b:current_syntax = "registry" diff --git a/runtime/syntax/remind.vim b/runtime/syntax/remind.vim index 93a7178479..9e7ff22e14 100644 --- a/runtime/syntax/remind.vim +++ b/runtime/syntax/remind.vim @@ -1,17 +1,20 @@ " Vim syntax file " Language: Remind -" Maintainer: Davide Alberani <alberanid@libero.it> -" Last Change: 18 Sep 2009 -" Version: 0.5 -" URL: http://erlug.linux.it/~da/vim/syntax/remind.vim +" Maintainer: Davide Alberani <da@erlug.linux.it> +" Last Change: 02 Nov 2015 +" Version: 0.7 +" URL: http://ismito.it/vim/syntax/remind.vim " -" remind is a sophisticated reminder service -" you can download remind from: -" http://www.roaringpenguin.com/penguin/open_source_remind.php +" Remind is a sophisticated calendar and alarm program. +" You can download remind from: +" https://www.roaringpenguin.com/products/remind +" +" Changelog +" version 0.7: updated email and link +" version 0.6: added THROUGH keyword (courtesy of Ben Orchard) -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -19,7 +22,7 @@ endif syn case ignore syn keyword remindCommands REM OMIT SET FSET UNSET -syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED +syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED THROUGH syn keyword remindTag PRIORITY TAG syn keyword remindTimed AT DURATION syn keyword remindMove ONCE SKIP BEFORE AFTER @@ -44,35 +47,26 @@ syn match remindDates "'[0-9]\{4}[/-][0-9]\{1,2}[/-][0-9]\{1,2}\(@[0-9]\{1,2}[: syn match remindWarning display excludenl "\S\s\+$"ms=s+1 -if version >= 508 || !exists("did_remind_syn_inits") - if version < 508 - let did_remind_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink remindCommands Function - HiLink remindExpiry Repeat - HiLink remindTag Label - HiLink remindTimed Statement - HiLink remindMove Statement - HiLink remindSpecial Include - HiLink remindRun Function - HiLink remindConditional Conditional - HiLink remindComment Comment - HiLink remindTimes String - HiLink remindString String - HiLink remindDebug Debug - HiLink remindVar Identifier - HiLink remindSubst Constant - HiLink remindAdvanceNumber Number - HiLink remindDateSeparators Comment - HiLink remindDates String - HiLink remindWarning Error +hi def link remindCommands Function +hi def link remindExpiry Repeat +hi def link remindTag Label +hi def link remindTimed Statement +hi def link remindMove Statement +hi def link remindSpecial Include +hi def link remindRun Function +hi def link remindConditional Conditional +hi def link remindComment Comment +hi def link remindTimes String +hi def link remindString String +hi def link remindDebug Debug +hi def link remindVar Identifier +hi def link remindSubst Constant +hi def link remindAdvanceNumber Number +hi def link remindDateSeparators Comment +hi def link remindDates String +hi def link remindWarning Error - delcommand HiLink -endif let b:current_syntax = "remind" diff --git a/runtime/syntax/resolv.vim b/runtime/syntax/resolv.vim index 06d6885c1c..a879116a5f 100644 --- a/runtime/syntax/resolv.vim +++ b/runtime/syntax/resolv.vim @@ -9,9 +9,8 @@ " David Necas (Yeti) <yeti@physics.muni.cz> " Stefano Zacchiroli <zack@debian.org> -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -50,38 +49,29 @@ syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contai " Additional errors syn match resolvError /^search .\{257,}/ -if version >= 508 || !exists("did_config_syntax_inits") - if version < 508 - let did_config_syntax_inits = 1 - command! -nargs=+ HiLink hi link <args> - else - command! -nargs=+ HiLink hi def link <args> - endif - - HiLink resolvIP Number - HiLink resolvIPNetmask Number - HiLink resolvHostname String - HiLink resolvOption String - - HiLink resolvIPNameserver Number - HiLink resolvHostnameSearch String - HiLink resolvIPNetmaskSortList Number - - HiLink resolvNameServer Identifier - HiLink resolvLwserver Identifier - HiLink resolvDomain Identifier - HiLink resolvSearch Identifier - HiLink resolvSortList Identifier - HiLink resolvOptions Identifier - - HiLink resolvComment Comment - HiLink resolvOperator Operator - HiLink resolvError Error - HiLink resolvIPError Error - HiLink resolvIPSpecial Special - - delcommand HiLink -endif + +hi def link resolvIP Number +hi def link resolvIPNetmask Number +hi def link resolvHostname String +hi def link resolvOption String + +hi def link resolvIPNameserver Number +hi def link resolvHostnameSearch String +hi def link resolvIPNetmaskSortList Number + +hi def link resolvNameServer Identifier +hi def link resolvLwserver Identifier +hi def link resolvDomain Identifier +hi def link resolvSearch Identifier +hi def link resolvSortList Identifier +hi def link resolvOptions Identifier + +hi def link resolvComment Comment +hi def link resolvOperator Operator +hi def link resolvError Error +hi def link resolvIPError Error +hi def link resolvIPSpecial Special + let b:current_syntax = "resolv" diff --git a/runtime/syntax/reva.vim b/runtime/syntax/reva.vim index 03dfc9d4c3..f605992190 100644 --- a/runtime/syntax/reva.vim +++ b/runtime/syntax/reva.vim @@ -7,13 +7,8 @@ " Filetypes: *.rf *.frt " NOTE: You should also have the ftplugin/reva.vim file to set 'isk' -" For version 5.x: Clear all syntax items and don't load -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear - echo "Reva syntax file requires version 6.0 or later of vim!" - finish -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/rexx.vim b/runtime/syntax/rexx.vim index ef698a5351..360fc8ff9f 100644 --- a/runtime/syntax/rexx.vim +++ b/runtime/syntax/rexx.vim @@ -6,11 +6,8 @@ " Special Thanks to Dan Sharp <dwsharp@hotmail.com> and Rony G. Flatscher " <Rony.Flatscher@wu-wien.ac.at> for comments and additions -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -244,87 +241,77 @@ syn sync linecont "\(,\|-\ze-\@!\)\ze\s*\(--.*\|\/\*.*\)*$" exec "syn sync fromstart" " 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_rexx_syn_inits") - if version < 508 - let did_rexx_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " make binary and hex strings stand out - hi rexxStringConstant term=bold,underline ctermfg=5 cterm=bold guifg=darkMagenta gui=bold - - HiLink rexxLabel2 Function - HiLink doLoopSelectLabelRegion rexxKeyword - HiLink endIterateLeaveLabelRegion rexxKeyword - HiLink rexxLoopKeywords rexxKeyword " Todo - - HiLink rexxNumber Normal "DiffChange -" HiLink rexxIdentifier DiffChange - - HiLink rexxRegularCallSignal Statement - HiLink rexxExceptionHandling Statement - - HiLink rexxLabel Function - HiLink rexxCharacter Character - HiLink rexxParenError rexxError - HiLink rexxInParen rexxError - HiLink rexxCommentError rexxError - HiLink rexxError Error - HiLink rexxKeyword Statement - HiLink rexxKeywordStatements Statement - - HiLink rexxFunction Function - HiLink rexxString String - HiLink rexxComment Comment - HiLink rexxTodo Todo - HiLink rexxSpecialVariable Special - HiLink rexxConditional rexxKeyword - - HiLink rexxOperator Operator - HiLink rexxMessageOperator rexxOperator - HiLink rexxLineComment Comment - - HiLink rexxLineContinue WildMenu - - HiLink rexxDirective rexxKeyword - HiLink rexxClassDirective Type - HiLink rexxMethodDirective rexxFunction - HiLink rexxAttributeDirective rexxFunction - HiLink rexxRequiresDirective Include - HiLink rexxRoutineDirective rexxFunction +" Only when an item doesn't have highlighting yet + +" make binary and hex strings stand out +hi rexxStringConstant term=bold,underline ctermfg=5 cterm=bold guifg=darkMagenta gui=bold + +hi def link rexxLabel2 Function +hi def link doLoopSelectLabelRegion rexxKeyword +hi def link endIterateLeaveLabelRegion rexxKeyword +hi def link rexxLoopKeywords rexxKeyword " Todo + +hi def link rexxNumber Normal "DiffChange +" hi def link rexxIdentifier DiffChange + +hi def link rexxRegularCallSignal Statement +hi def link rexxExceptionHandling Statement + +hi def link rexxLabel Function +hi def link rexxCharacter Character +hi def link rexxParenError rexxError +hi def link rexxInParen rexxError +hi def link rexxCommentError rexxError +hi def link rexxError Error +hi def link rexxKeyword Statement +hi def link rexxKeywordStatements Statement + +hi def link rexxFunction Function +hi def link rexxString String +hi def link rexxComment Comment +hi def link rexxTodo Todo +hi def link rexxSpecialVariable Special +hi def link rexxConditional rexxKeyword + +hi def link rexxOperator Operator +hi def link rexxMessageOperator rexxOperator +hi def link rexxLineComment Comment + +hi def link rexxLineContinue WildMenu + +hi def link rexxDirective rexxKeyword +hi def link rexxClassDirective Type +hi def link rexxMethodDirective rexxFunction +hi def link rexxAttributeDirective rexxFunction +hi def link rexxRequiresDirective Include +hi def link rexxRoutineDirective rexxFunction " rgf, 2012-09-09 - HiLink rexxOptionsDirective rexxFunction - HiLink rexxOptionsDirective2 rexxOptionsDirective - HiLink rexxOptionsDirective3 Normal " rexxOptionsDirective +hi def link rexxOptionsDirective rexxFunction +hi def link rexxOptionsDirective2 rexxOptionsDirective +hi def link rexxOptionsDirective3 Normal " rexxOptionsDirective - HiLink rexxConstantDirective rexxFunction +hi def link rexxConstantDirective rexxFunction - HiLink rexxConst Constant - HiLink rexxTypeSpecifier Type - HiLink rexxBuiltinClass rexxTypeSpecifier +hi def link rexxConst Constant +hi def link rexxTypeSpecifier Type +hi def link rexxBuiltinClass rexxTypeSpecifier - HiLink rexxEnvironmentSymbol rexxConst - HiLink rexxMessage rexxFunction +hi def link rexxEnvironmentSymbol rexxConst +hi def link rexxMessage rexxFunction - HiLink rexxParse rexxKeyword - HiLink rexxParse2 rexxParse +hi def link rexxParse rexxKeyword +hi def link rexxParse2 rexxParse - HiLink rexxGuard rexxKeyword - HiLink rexxTrace rexxKeyword +hi def link rexxGuard rexxKeyword +hi def link rexxTrace rexxKeyword - HiLink rexxRaise rexxKeyword - HiLink rexxRaise2 rexxRaise +hi def link rexxRaise rexxKeyword +hi def link rexxRaise2 rexxRaise - HiLink rexxForward rexxKeyword - HiLink rexxForward2 rexxForward +hi def link rexxForward rexxKeyword +hi def link rexxForward2 rexxForward - delcommand HiLink -endif let b:current_syntax = "rexx" diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index 32c91add48..8cac585bb0 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -2,26 +2,21 @@ " Language: R Help File " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: Wed Jul 09, 2014 10:28PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Jun 28, 2016 08:53AM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. " - There is no Latex markup in equations " - Thanks to Will Gray for finding and fixing a bug -" - No support for \if, \ifelse and \out as I don't understand -" them and have no examples at hand (help welcome). -" - No support for \var tag within quoted string (dito) +" - No support for \var tag within quoted string " Version Clears: {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x and 7.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif -setlocal iskeyword=@,48-57,_,. +scriptencoding utf-8 syn case match @@ -29,9 +24,11 @@ syn case match syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink +syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}" + " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @R syntax/r.vim @@ -69,76 +66,115 @@ syn match rhelpDelimiter "\\cr" syn match rhelpDelimiter "\\tab " " Keywords {{{1 -syn match rhelpKeyword "\\R" -syn match rhelpKeyword "\\ldots" +syn match rhelpKeyword "\\R\>" +syn match rhelpKeyword "\\ldots\>" +syn match rhelpKeyword "\\sspace\>" syn match rhelpKeyword "--" syn match rhelpKeyword "---" -syn match rhelpKeyword "<" -syn match rhelpKeyword ">" -syn match rhelpKeyword "\\ge" -syn match rhelpKeyword "\\le" -syn match rhelpKeyword "\\alpha" -syn match rhelpKeyword "\\beta" -syn match rhelpKeyword "\\gamma" -syn match rhelpKeyword "\\delta" -syn match rhelpKeyword "\\epsilon" -syn match rhelpKeyword "\\zeta" -syn match rhelpKeyword "\\eta" -syn match rhelpKeyword "\\theta" -syn match rhelpKeyword "\\iota" -syn match rhelpKeyword "\\kappa" -syn match rhelpKeyword "\\lambda" -syn match rhelpKeyword "\\mu" -syn match rhelpKeyword "\\nu" -syn match rhelpKeyword "\\xi" -syn match rhelpKeyword "\\omicron" -syn match rhelpKeyword "\\pi" -syn match rhelpKeyword "\\rho" -syn match rhelpKeyword "\\sigma" -syn match rhelpKeyword "\\tau" -syn match rhelpKeyword "\\upsilon" -syn match rhelpKeyword "\\phi" -syn match rhelpKeyword "\\chi" -syn match rhelpKeyword "\\psi" -syn match rhelpKeyword "\\omega" -syn match rhelpKeyword "\\Alpha" -syn match rhelpKeyword "\\Beta" -syn match rhelpKeyword "\\Gamma" -syn match rhelpKeyword "\\Delta" -syn match rhelpKeyword "\\Epsilon" -syn match rhelpKeyword "\\Zeta" -syn match rhelpKeyword "\\Eta" -syn match rhelpKeyword "\\Theta" -syn match rhelpKeyword "\\Iota" -syn match rhelpKeyword "\\Kappa" -syn match rhelpKeyword "\\Lambda" -syn match rhelpKeyword "\\Mu" -syn match rhelpKeyword "\\Nu" -syn match rhelpKeyword "\\Xi" -syn match rhelpKeyword "\\Omicron" -syn match rhelpKeyword "\\Pi" -syn match rhelpKeyword "\\Rho" -syn match rhelpKeyword "\\Sigma" -syn match rhelpKeyword "\\Tau" -syn match rhelpKeyword "\\Upsilon" -syn match rhelpKeyword "\\Phi" -syn match rhelpKeyword "\\Chi" -syn match rhelpKeyword "\\Psi" -syn match rhelpKeyword "\\Omega" -" Links {{{1 -syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend -syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend -syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend +" Condition Keywords {{{2 +syn match rhelpKeyword "\\if\>" +syn match rhelpKeyword "\\ifelse\>" +syn match rhelpKeyword "\\out\>" +" Examples of usage: +" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}} +" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{α}}{alpha}} -" Verbatim like {{{1 -if v:version > 703 - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +" Keywords and operators valid only if in math mode {{{2 +syn match rhelpMathOp "<" contained +syn match rhelpMathOp ">" contained +syn match rhelpMathOp "+" contained +syn match rhelpMathOp "-" contained +syn match rhelpMathOp "=" contained + +" Conceal function based on syntax/tex.vim {{{2 +if exists("g:tex_conceal") + let s:tex_conceal = g:tex_conceal else - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment + let s:tex_conceal = 'gm' endif +function s:HideSymbol(pat, cchar, hide) + if a:hide + exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar + else + exe "syn match rhelpMathSymb '" . a:pat . "' contained" + endif +endfunction + +" Math symbols {{{2 +if s:tex_conceal =~ 'm' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\infty\>', '∞', s:hd) +call s:HideSymbol('\\ge\>', '≥', s:hd) +call s:HideSymbol('\\le\>', '≤', s:hd) +call s:HideSymbol('\\prod\>', '∏', s:hd) +call s:HideSymbol('\\sum\>', '∑', s:hd) +syn match rhelpMathSymb "\\sqrt\>" contained + +" Greek letters {{{2 +if s:tex_conceal =~ 'g' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\alpha\>', 'α', s:hd) +call s:HideSymbol('\\beta\>', 'β', s:hd) +call s:HideSymbol('\\gamma\>', 'γ', s:hd) +call s:HideSymbol('\\delta\>', 'δ', s:hd) +call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd) +call s:HideSymbol('\\zeta\>', 'ζ', s:hd) +call s:HideSymbol('\\eta\>', 'η', s:hd) +call s:HideSymbol('\\theta\>', 'θ', s:hd) +call s:HideSymbol('\\iota\>', 'ι', s:hd) +call s:HideSymbol('\\kappa\>', 'κ', s:hd) +call s:HideSymbol('\\lambda\>', 'λ', s:hd) +call s:HideSymbol('\\mu\>', 'μ', s:hd) +call s:HideSymbol('\\nu\>', 'ν', s:hd) +call s:HideSymbol('\\xi\>', 'ξ', s:hd) +call s:HideSymbol('\\pi\>', 'π', s:hd) +call s:HideSymbol('\\rho\>', 'ρ', s:hd) +call s:HideSymbol('\\sigma\>', 'σ', s:hd) +call s:HideSymbol('\\tau\>', 'τ', s:hd) +call s:HideSymbol('\\upsilon\>', 'υ', s:hd) +call s:HideSymbol('\\phi\>', 'ϕ', s:hd) +call s:HideSymbol('\\chi\>', 'χ', s:hd) +call s:HideSymbol('\\psi\>', 'ψ', s:hd) +call s:HideSymbol('\\omega\>', 'ω', s:hd) +call s:HideSymbol('\\Gamma\>', 'Γ', s:hd) +call s:HideSymbol('\\Delta\>', 'Δ', s:hd) +call s:HideSymbol('\\Theta\>', 'Θ', s:hd) +call s:HideSymbol('\\Lambda\>', 'Λ', s:hd) +call s:HideSymbol('\\Xi\>', 'Ξ', s:hd) +call s:HideSymbol('\\Pi\>', 'Π', s:hd) +call s:HideSymbol('\\Sigma\>', 'Σ', s:hd) +call s:HideSymbol('\\Upsilon\>', 'Υ', s:hd) +call s:HideSymbol('\\Phi\>', 'Φ', s:hd) +call s:HideSymbol('\\Psi\>', 'Ψ', s:hd) +call s:HideSymbol('\\Omega\>', 'Ω', s:hd) +delfunction s:HideSymbol +" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta', +" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed +" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although +" they do not make valid LaTeX code (e.g. Α versus \Alpha). + +" Links {{{1 +syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend + +" Verbatim like {{{1 +syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment + +" Equation {{{1 +syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend +syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend " Type Styles {{{1 syn match rhelpType "\\emph\>" @@ -148,12 +184,9 @@ syn match rhelpType "\\sQuote\>" syn match rhelpType "\\dQuote\>" syn match rhelpType "\\preformatted\>" syn match rhelpType "\\kbd\>" -syn match rhelpType "\\eqn\>" -syn match rhelpType "\\deqn\>" syn match rhelpType "\\file\>" syn match rhelpType "\\email\>" -syn match rhelpType "\\url\>" -syn match rhelpType "\\href\>" +syn match rhelpType "\\enc\>" syn match rhelpType "\\var\>" syn match rhelpType "\\env\>" syn match rhelpType "\\option\>" @@ -163,6 +196,7 @@ syn match rhelpType "\\renewcommand\>" syn match rhelpType "\\dfn\>" syn match rhelpType "\\cite\>" syn match rhelpType "\\acronym\>" +syn match rhelpType "\\doi\>" " rhelp sections {{{1 syn match rhelpSection "\\encoding\>" @@ -202,9 +236,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}" syn match rhelpComment /%.*$/ " Error {{{1 -syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim +syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation syn match rhelpError /[)\]}]/ syn match rhelpBraceError /[)}]/ contained syn match rhelpCurlyError /[)\]]/ contained @@ -213,36 +247,27 @@ syn match rhelpParenError /[\]}]/ contained syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{" " Define the default highlighting {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_rhelp_syntax_inits") - if version < 508 - let did_rhelp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink rhelpVerbatim String - HiLink rhelpDelimiter Delimiter - HiLink rhelpIdentifier Identifier - HiLink rhelpString String - HiLink rhelpCodeSpecial Special - HiLink rhelpKeyword Keyword - HiLink rhelpDots Keyword - HiLink rhelpLink Underlined - HiLink rhelpType Type - HiLink rhelpSection PreCondit - HiLink rhelpError Error - HiLink rhelpBraceError Error - HiLink rhelpCurlyError Error - HiLink rhelpParenError Error - HiLink rhelpPreProc PreProc - HiLink rhelpDelimiter Delimiter - HiLink rhelpComment Comment - HiLink rhelpRComment Comment - HiLink rhelpSpecialChar SpecialChar - delcommand HiLink -endif +hi def link rhelpVerbatim String +hi def link rhelpDelimiter Delimiter +hi def link rhelpIdentifier Identifier +hi def link rhelpString String +hi def link rhelpCodeSpecial Special +hi def link rhelpKeyword Keyword +hi def link rhelpDots Keyword +hi def link rhelpLink Underlined +hi def link rhelpType Type +hi def link rhelpSection PreCondit +hi def link rhelpError Error +hi def link rhelpBraceError Error +hi def link rhelpCurlyError Error +hi def link rhelpParenError Error +hi def link rhelpPreProc PreProc +hi def link rhelpDelimiter Delimiter +hi def link rhelpComment Comment +hi def link rhelpRComment Comment +hi def link rhelpSpecialChar SpecialChar +hi def link rhelpMathSymb Special +hi def link rhelpMathOp Operator let b:current_syntax = "rhelp" diff --git a/runtime/syntax/rib.vim b/runtime/syntax/rib.vim index 6b9f2b0bd4..0ee607122f 100644 --- a/runtime/syntax/rib.vim +++ b/runtime/syntax/rib.vim @@ -4,10 +4,8 @@ " Last Change: 2003 May 11 " -" Remove any old syntax stuff hanging around -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 @@ -46,26 +44,17 @@ syn match ribFloat display contained "[-]\=\.\d\+\(e[-+]\=\d\+\)\=\>" syn match ribFloat display contained "[-]\=\d\+e[-+]\d\+\>" syn case match -if version >= 508 || !exists("did_rib_syntax_inits") - if version < 508 - let did_rib_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink ribStructure Structure - HiLink ribCommand Statement +hi def link ribStructure Structure +hi def link ribCommand Statement - HiLink ribStructureComment SpecialComment - HiLink ribLineComment Comment +hi def link ribStructureComment SpecialComment +hi def link ribLineComment Comment - HiLink ribString String - HiLink ribNumber Number - HiLink ribFloat Float +hi def link ribString String +hi def link ribNumber Number +hi def link ribFloat Float - delcommand HiLink -end let b:current_syntax = "rib" diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 6f1b847453..05435354ad 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,19 +1,26 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Jan 28, 2017 10:06PM " " CONFIGURATION: -" To highlight chunk headers as R code, put in your vimrc: +" To highlight chunk headers as R code, put in your vimrc (e.g. .config/nvim/init.vim): " let rmd_syn_hl_chunk = 1 +" +" For highlighting pandoc extensions to markdown like citations and TeX and +" many other advanced features like folding of markdown sections, it is +" recommended to install the vim-pandoc filetype plugin as well as the +" vim-pandoc-syntax filetype plugin from https://github.com/vim-pandoc. +" +" TODO: +" - Provide highlighting for rmarkdown parameters in yaml header -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif -" load all of pandoc info +" load all of pandoc info, e.g. from +" https://github.com/vim-pandoc/vim-pandoc-syntax runtime syntax/pandoc.vim if exists("b:current_syntax") let rmdIsPandoc = 1 @@ -24,28 +31,54 @@ else if exists("b:current_syntax") unlet b:current_syntax endif -endif -" load all of the r syntax highlighting rules into @R -syntax include @R syntax/r.vim -if exists("b:current_syntax") - unlet b:current_syntax + " load all of the yaml syntax highlighting rules into @yaml + syntax include @yaml syntax/yaml.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif + + " highlight yaml block commonly used for front matter + syntax region rmdYamlBlock matchgroup=rmdYamlBlockDelim start="^---" matchgroup=rmdYamlBlockDelim end="^---" contains=@yaml keepend fold endif -if exists("g:rmd_syn_hl_chunk") - " highlight R code inside chunk header - syntax match rmdChunkDelim "^[ \t]*```{r" contained - syntax match rmdChunkDelim "}$" contained +if !exists("g:rmd_syn_langs") + let g:rmd_syn_langs = ["r"] else - syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained + let s:hasr = 0 + for s:lng in g:rmd_syn_langs + if s:lng == "r" + let s:hasr = 1 + endif + endfor + if s:hasr == 0 + let g:rmd_syn_langs += ["r"] + endif endif -syntax match rmdChunkDelim "^[ \t]*```$" contained -syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold + +for s:lng in g:rmd_syn_langs + exe 'syntax include @' . toupper(s:lng) . ' syntax/'. s:lng . '.vim' + if exists("b:current_syntax") + unlet b:current_syntax + endif + exe 'syntax region rmd' . toupper(s:lng) . 'Chunk start="^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" end="^[ \t]*```$" contains=@' . toupper(s:lng) . ',rmd' . toupper(s:lng) . 'ChunkDelim keepend fold' + + if exists("g:rmd_syn_hl_chunk") && s:lng == "r" + " highlight R code inside chunk header + syntax match rmdRChunkDelim "^[ \t]*```{r" contained + syntax match rmdRChunkDelim "}$" contained + else + exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" contained' + endif + exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```$" contained' +endfor + " also match and syntax highlight in-line R code -syntax match rmdEndInline "`" contained -syntax match rmdBeginInline "`r " contained -syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend +syntax region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend +" I was not able to highlight rmdrInline inside a pandocLaTeXCommand, although +" highlighting works within pandocLaTeXRegion and yamlFlowString. +syntax cluster texMathZoneGroup add=rmdrInline " match slidify special marker syntax match rmdSlidifySpecial "\*\*\*" @@ -65,21 +98,24 @@ if rmdIsPandoc == 0 " Region syntax match rmdLaTeXRegDelim "\$\$" contained syntax match rmdLaTeXRegDelim "\$\$latex$" contained - syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend - syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend + syntax match rmdLaTeXSt "\\[a-zA-Z]\+" + syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXRegDelim keepend + syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXRegDelim keepend + hi def link rmdBlockQuote Comment hi def link rmdLaTeXSt Statement hi def link rmdLaTeXInlDelim Special hi def link rmdLaTeXRegDelim Special endif -setlocal iskeyword=@,48-57,_,. - -syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r" +for s:lng in g:rmd_syn_langs + exe 'syn sync match rmd' . toupper(s:lng) . 'SyncChunk grouphere rmd' . toupper(s:lng) . 'Chunk /^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\)/' +endfor -hi def link rmdChunkDelim Special -hi def link rmdBeginInline Special -hi def link rmdEndInline Special -hi def link rmdBlockQuote Comment +hi def link rmdYamlBlockDelim Delim +for s:lng in g:rmd_syn_langs + exe 'hi def link rmd' . toupper(s:lng) . 'ChunkDelim Special' +endfor +hi def link rmdInlineDelim Special hi def link rmdSlidifySpecial Special let b:current_syntax = "rmd" diff --git a/runtime/syntax/rnc.vim b/runtime/syntax/rnc.vim index 8436c88755..7d3907e991 100644 --- a/runtime/syntax/rnc.vim +++ b/runtime/syntax/rnc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Relax NG compact syntax -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: Relax NG compact syntax +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/rnoweb.vim b/runtime/syntax/rnoweb.vim index 7d42395b5c..665acc53e2 100644 --- a/runtime/syntax/rnoweb.vim +++ b/runtime/syntax/rnoweb.vim @@ -1,20 +1,14 @@ " Vim syntax file " Language: R noweb Files " Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: 2009 May 05 -" Version: 0.9 -" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $ +" Last Change: Sat Feb 06, 2016 06:47AM +" Version: 0.9.1 " Remarks: - This file is inspired by the proposal of -" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> -" http://www.ime.usp.br/~feferraz/en/sweavevim.html +" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> +" http://www.ime.usp.br/~feferraz/en/sweavevim.html " -" Version Clears: {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x and 7.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -26,21 +20,22 @@ unlet b:current_syntax syn cluster texMatchGroup add=@rnoweb syn cluster texMathMatchGroup add=rnowebSexpr +syn cluster texMathZoneGroup add=rnowebSexpr syn cluster texEnvGroup add=@rnoweb syn cluster texFoldGroup add=@rnoweb -syn cluster texDocGroup add=@rnoweb -syn cluster texPartGroup add=@rnoweb -syn cluster texChapterGroup add=@rnoweb -syn cluster texSectionGroup add=@rnoweb -syn cluster texSubSectionGroup add=@rnoweb -syn cluster texSubSubSectionGroup add=@rnoweb -syn cluster texParaGroup add=@rnoweb +syn cluster texDocGroup add=@rnoweb +syn cluster texPartGroup add=@rnoweb +syn cluster texChapterGroup add=@rnoweb +syn cluster texSectionGroup add=@rnoweb +syn cluster texSubSectionGroup add=@rnoweb +syn cluster texSubSubSectionGroup add=@rnoweb +syn cluster texParaGroup add=@rnoweb " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @rnowebR syntax/r.vim syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend syn match rnowebChunkReference "^<<.*>>$" contained -syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR +syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained " Sweave options command {{{1 syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}" diff --git a/runtime/syntax/robots.vim b/runtime/syntax/robots.vim index 066628bb3c..396bf52b25 100644 --- a/runtime/syntax/robots.vim +++ b/runtime/syntax/robots.vim @@ -5,11 +5,8 @@ " URL: http://www.mggen.com/vim/syntax/robots.zip " Last change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -41,26 +38,17 @@ syn match robotsUrl "http[s]\=://\S*" syn match robotsMail "\S*@\S*" syn region robotsString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ -if version >= 508 || !exists("did_robos_syntax_inits") - if version < 508 - let did_robots_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink robotsComment Comment - HiLink robotsAgent Type - HiLink robotsDisallow Statement - HiLink robotsLine Special - HiLink robotsStar Operator - HiLink robotsDelimiter Delimiter - HiLink robotsUrl String - HiLink robotsMail String - HiLink robotsString String - - delcommand HiLink -endif + +hi def link robotsComment Comment +hi def link robotsAgent Type +hi def link robotsDisallow Statement +hi def link robotsLine Special +hi def link robotsStar Operator +hi def link robotsDelimiter Delimiter +hi def link robotsUrl String +hi def link robotsMail String +hi def link robotsString String + let b:current_syntax = "robots" diff --git a/runtime/syntax/rpcgen.vim b/runtime/syntax/rpcgen.vim index 548f8c807f..08183d43a4 100644 --- a/runtime/syntax/rpcgen.vim +++ b/runtime/syntax/rpcgen.vim @@ -1,24 +1,16 @@ " Vim syntax file " Language: rpcgen -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 06, 2005 -" Version: 8 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 12 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_RPCGEN + +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - source <sfile>:p:h/c.vim -else - runtime! syntax/c.vim -endif +runtime! syntax/c.vim syn keyword rpcProgram program skipnl skipwhite nextgroup=rpcProgName syn match rpcProgName contained "\<\i\I*\>" skipnl skipwhite nextgroup=rpcProgZone @@ -32,30 +24,21 @@ syn match rpcProgNmbrErr contained "=\s*0x[^23]\x*"ms=s+1 syn match rpcPassThru "^\s*%.*$" " 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_rpcgen_syntax_inits") - if version < 508 - let did_rpcgen_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink rpcProgName rpcName - HiLink rpcProgram rpcStatement - HiLink rpcVersName rpcName - HiLink rpcVersion rpcStatement - - HiLink rpcDecl cType - HiLink rpcPassThru cComment - - HiLink rpcName Special - HiLink rpcProcNmbr Delimiter - HiLink rpcProgNmbrErr Error - HiLink rpcStatement Statement - - delcommand HiLink +if !exists("skip_rpcgen_syntax_inits") + + hi def link rpcProgName rpcName + hi def link rpcProgram rpcStatement + hi def link rpcVersName rpcName + hi def link rpcVersion rpcStatement + + hi def link rpcDecl cType + hi def link rpcPassThru cComment + + hi def link rpcName Special + hi def link rpcProcNmbr Delimiter + hi def link rpcProgNmbrErr Error + hi def link rpcStatement Statement + endif let b:current_syntax = "rpcgen" diff --git a/runtime/syntax/rpl.vim b/runtime/syntax/rpl.vim index 6457803a06..f339f7ae6e 100644 --- a/runtime/syntax/rpl.vim +++ b/runtime/syntax/rpl.vim @@ -6,11 +6,8 @@ " URL: http://www.makalis.fr/~bertrand/rpl2/download/vim/indent/rpl.vim " Credits: Nothing -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -417,77 +414,67 @@ syntax region rplString start=+\(^\|\s\+\)"+ end=+"\ze\($\|\s\+\)+ contains=rplS syntax match rplTab "\t" transparent " 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_rpl_syntax_inits") - if version < 508 - let did_rpl_syntax_inits = 1 - command -nargs=+ HiLink highlight link <args> - else - command -nargs=+ HiLink highlight default link <args> - endif - - " The default highlighting. - - HiLink rplControl Statement - HiLink rplStatement Statement - HiLink rplAlgConditional Conditional - HiLink rplConditional Repeat - HiLink rplConditionalError Error - HiLink rplRepeat Repeat - HiLink rplCycle Repeat - HiLink rplUntil Repeat - HiLink rplIntrinsic Special - HiLink rplStorage StorageClass - HiLink rplStorageExpr StorageClass - HiLink rplStorageError Error - HiLink rplReadWrite rplIntrinsic - - HiLink rplOperator Operator - - HiLink rplList Special - HiLink rplArray Special - HiLink rplConstant Identifier - HiLink rplExpr Type - - HiLink rplString String - HiLink rplStringGuilles String - HiLink rplStringAntislash String - - HiLink rplBinary Boolean - HiLink rplOctal Boolean - HiLink rplDecimal Boolean - HiLink rplHexadecimal Boolean - HiLink rplInteger Number - HiLink rplFloat Float - HiLink rplComplex Float - HiLink rplBoolean Identifier - - HiLink rplObsolete Todo - - HiLink rplPreCondit PreCondit - HiLink rplInclude Include - HiLink rplIncluded rplString - HiLink rplInclude Include - HiLink rplExecPath Include - HiLink rplPreProc PreProc - HiLink rplComment Comment - HiLink rplCommentLine Comment - HiLink rplCommentString Comment - HiLink rplSubDelimitor rplStorage - HiLink rplCommentError Error - HiLink rplParenError Error - HiLink rplSubError Error - HiLink rplArrayError Error - HiLink rplListError Error - HiLink rplTab Error - HiLink rplBinaryError Error - HiLink rplOctalError Error - HiLink rplDecimalError Error - HiLink rplHexadecimalError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. + +hi def link rplControl Statement +hi def link rplStatement Statement +hi def link rplAlgConditional Conditional +hi def link rplConditional Repeat +hi def link rplConditionalError Error +hi def link rplRepeat Repeat +hi def link rplCycle Repeat +hi def link rplUntil Repeat +hi def link rplIntrinsic Special +hi def link rplStorage StorageClass +hi def link rplStorageExpr StorageClass +hi def link rplStorageError Error +hi def link rplReadWrite rplIntrinsic + +hi def link rplOperator Operator + +hi def link rplList Special +hi def link rplArray Special +hi def link rplConstant Identifier +hi def link rplExpr Type + +hi def link rplString String +hi def link rplStringGuilles String +hi def link rplStringAntislash String + +hi def link rplBinary Boolean +hi def link rplOctal Boolean +hi def link rplDecimal Boolean +hi def link rplHexadecimal Boolean +hi def link rplInteger Number +hi def link rplFloat Float +hi def link rplComplex Float +hi def link rplBoolean Identifier + +hi def link rplObsolete Todo + +hi def link rplPreCondit PreCondit +hi def link rplInclude Include +hi def link rplIncluded rplString +hi def link rplInclude Include +hi def link rplExecPath Include +hi def link rplPreProc PreProc +hi def link rplComment Comment +hi def link rplCommentLine Comment +hi def link rplCommentString Comment +hi def link rplSubDelimitor rplStorage +hi def link rplCommentError Error +hi def link rplParenError Error +hi def link rplSubError Error +hi def link rplArrayError Error +hi def link rplListError Error +hi def link rplTab Error +hi def link rplBinaryError Error +hi def link rplOctalError Error +hi def link rplDecimalError Error +hi def link rplHexadecimalError Error + let b:current_syntax = "rpl" diff --git a/runtime/syntax/rrst.vim b/runtime/syntax/rrst.vim index 4667b3a2c1..b643af3285 100644 --- a/runtime/syntax/rrst.vim +++ b/runtime/syntax/rrst.vim @@ -1,16 +1,14 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Jun 28, 2016 08:53AM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: " let rrst_syn_hl_chunk = 1 -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -21,8 +19,6 @@ unlet b:current_syntax " load all of the r syntax highlighting rules into @R syntax include @R syntax/r.vim -setlocal iskeyword=@,48-57,_,. - " highlight R chunks if exists("g:rrst_syn_hl_chunk") " highlight R code inside chunk header diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index 425d225113..232d2a7de3 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -1,7 +1,9 @@ " Vim syntax file -" Language: reStructuredText documentation format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2013-11-26 +" Language: reStructuredText documentation format +" Maintainer: Marshall Ward <marshall.ward@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Website: https://github.com/marshallward/vim-restructuredtext +" Latest Revision: 2016-08-18 if exists("b:current_syntax") finish @@ -12,8 +14,6 @@ set cpo&vim syn case ignore -syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" - syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, @@ -47,7 +47,7 @@ syn match rstSimpleTableLines contained display syn cluster rstDirectives contains=rstFootnote,rstCitation, \ rstHyperlinkTarget,rstExDirective -syn match rstExplicitMarkup '^\.\.\_s' +syn match rstExplicitMarkup '^\s*\.\.\_s' \ nextgroup=@rstDirectives,rstComment,rstSubstitutionDefinition let s:ReferenceName = '[[:alnum:]]\+\%([_.-][[:alnum:]]\+\)*' @@ -80,7 +80,7 @@ syn region rstHyperlinkTarget matchgroup=rstDirective execute 'syn region rstExDirective contained matchgroup=rstDirective' . \ ' start=+' . s:ReferenceName . '::\_s+' . \ ' skip=+^$+' . - \ ' end=+^\s\@!+ contains=@rstCruft' + \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock' execute 'syn match rstSubstitutionDefinition contained' . \ ' /|' . s:ReferenceName . '|\_s\+/ nextgroup=@rstDirectives' @@ -90,7 +90,7 @@ function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_righ \ ' start=+' . a:char_left . '\zs' . a:start . \ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' . \ a:middle . - \ ' end=+\S' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+' + \ ' end=+\S' . a:end . '\ze\%($\|\s\|[''"’)\]}>/:.,;!?\\-]\)+' endfunction function! s:DefineInlineMarkup(name, start, middle, end) @@ -99,11 +99,13 @@ function! s:DefineInlineMarkup(name, start, middle, end) \ "" call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'") - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '’', '’') + " TODO: Additional Unicode Pd, Po, Pi, Pf, Ps characters call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|[/:]\)', '') @@ -122,6 +124,8 @@ call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') +syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" + " TODO: Can’t remember why these two can’t be defined like the ones above. execute 'syn match rstFootnoteReference contains=@NoSpell' . \ ' +\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]_+' @@ -136,24 +140,33 @@ syn match rstStandaloneHyperlink contains=@NoSpell \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" syn region rstCodeBlock contained matchgroup=rstDirective - \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s+ + \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s\+\w*\_s*\n\ze\z(\s\+\)+ \ skip=+^$+ - \ end=+^\s\@!+ + \ end=+^\z1\@!+ \ contains=@NoSpell syn cluster rstDirectives add=rstCodeBlock if !exists('g:rst_syntax_code_list') - let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', 'python', 'perl'] + let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', + \ 'python', 'perl', 'sh'] endif for code in g:rst_syntax_code_list unlet! b:current_syntax + " guard against setting 'isk' option which might cause problems (issue #108) + let prior_isk = &l:iskeyword exe 'syn include @rst'.code.' syntax/'.code.'.vim' - exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold ' - \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\s*$# ' - \.'skip=#^$# ' - \.'end=#^\s\@!# contains=@NoSpell,@rst'.code.' keepend' + exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold' + \.' start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)#' + \.' skip=#^$#' + \.' end=#^\z1\@!#' + \.' contains=@NoSpell,@rst'.code exe 'syn cluster rstDirectives add=rstDirective'.code + " reset 'isk' setting, if it has been changed + if &l:iskeyword !=# prior_isk + let &l:iskeyword = prior_isk + endif + unlet! prior_isk endfor " TODO: Use better syncing. @@ -176,10 +189,8 @@ hi def link rstHyperlinkTarget String hi def link rstExDirective String hi def link rstSubstitutionDefinition rstDirective hi def link rstDelimiter Delimiter -" TODO: I dunno... -hi def rstEmphasis term=italic cterm=italic gui=italic -hi def link rstStrongEmphasis Special -"term=bold cterm=bold gui=bold +hi def rstEmphasis ctermfg=13 term=italic cterm=italic gui=italic +hi def rstStrongEmphasis ctermfg=1 term=bold cterm=bold gui=bold hi def link rstInterpretedTextOrHyperlinkReference Identifier hi def link rstInlineLiteral String hi def link rstSubstitutionReference PreProc diff --git a/runtime/syntax/rtf.vim b/runtime/syntax/rtf.vim index 8f5ea71a36..c856f9ffcf 100644 --- a/runtime/syntax/rtf.vim +++ b/runtime/syntax/rtf.vim @@ -13,11 +13,8 @@ " TODO: render underline, italic, bold -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -52,35 +49,25 @@ syn match rtfBlue "\\blue[0-9][0-9]*" syn match rtfFootNote "[#$K+]{\\footnote.*}" contains=rtfControlWord,rtfNewControlWord " 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_rtf_syntax_inits") - if version < 508 - let did_rtf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - - HiLink rtfControlWord Statement - HiLink rtfNewControlWord Special - HiLink rtfControlSymbol Constant - HiLink rtfCharacter Character - HiLink rtfUnicodeCharacter SpecialChar - HiLink rtfFootNote Comment - - " Define colors for the syntax file - hi rtfRed term=underline cterm=underline ctermfg=DarkRed gui=underline guifg=DarkRed - hi rtfGreen term=underline cterm=underline ctermfg=DarkGreen gui=underline guifg=DarkGreen - hi rtfBlue term=underline cterm=underline ctermfg=DarkBlue gui=underline guifg=DarkBlue - - HiLink rtfRed rtfRed - HiLink rtfGreen rtfGreen - HiLink rtfBlue rtfBlue - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + + +hi def link rtfControlWord Statement +hi def link rtfNewControlWord Special +hi def link rtfControlSymbol Constant +hi def link rtfCharacter Character +hi def link rtfUnicodeCharacter SpecialChar +hi def link rtfFootNote Comment + +" Define colors for the syntax file +hi rtfRed term=underline cterm=underline ctermfg=DarkRed gui=underline guifg=DarkRed +hi rtfGreen term=underline cterm=underline ctermfg=DarkGreen gui=underline guifg=DarkGreen +hi rtfBlue term=underline cterm=underline ctermfg=DarkBlue gui=underline guifg=DarkBlue + +hi def link rtfRed rtfRed +hi def link rtfGreen rtfGreen +hi def link rtfBlue rtfBlue + let b:current_syntax = "rtf" diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim index 28f553decb..ca7f51b1ea 100644 --- a/runtime/syntax/ruby.vim +++ b/runtime/syntax/ruby.vim @@ -9,16 +9,45 @@ " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) " ---------------------------------------------------------------------------- +" Prelude {{{1 if exists("b:current_syntax") finish endif +" this file uses line continuations +let s:cpo_sav = &cpo +set cpo&vim + +" Folding Config {{{1 if has("folding") && exists("ruby_fold") setlocal foldmethod=syntax endif +let s:foldable_groups = split( + \ get( + \ b:, + \ 'ruby_foldable_groups', + \ get(g:, 'ruby_foldable_groups', 'ALL') + \ ) + \ ) + +function! s:foldable(...) abort + if index(s:foldable_groups, 'ALL') > -1 + return 1 + endif + + for l:i in a:000 + if index(s:foldable_groups, l:i) > -1 + return 1 + endif + endfor + + return 0 +endfunction " }}} + syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo +" Whitespace Errors {{{1 if exists("ruby_space_errors") if !exists("ruby_no_trail_space_error") syn match rubySpaceError display excludenl "\s\+$" @@ -28,14 +57,14 @@ if exists("ruby_space_errors") endif endif -" Operators +" Operators {{{1 if exists("ruby_operators") - syn match rubyOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::" + syn match rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@1<!>\|\*\*\|\.\.\.\|\.\.\|::" syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=" - syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop + syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@2<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop endif -" Expression Substitution and Backslash Notation +" Expression Substitution and Backslash Notation {{{1 syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn match rubyQuoteEscape "\\[\\']" contained display @@ -45,18 +74,19 @@ syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained con syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained -syn region rubyNoInterpolation start="\\#{" end="}" contained +syn region rubyNoInterpolation start="\\#{" end="}" contained syn match rubyNoInterpolation "\\#{" display contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained syn match rubyNoInterpolation "\\#\$\W" display contained -syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE +syn match rubyDelimiterEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained +" Regular Expression Metacharacters {{{1 " These are mostly Oniguruma ready syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial @@ -79,36 +109,40 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolati syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment -" Numbers and ASCII Codes -syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display -syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display -syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display +" Numbers and ASCII Codes {{{1 +syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@1<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>" display +syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display +syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display -" Identifiers +" Identifiers {{{1 syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent -syn match rubyConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@!" +syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display -syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display +syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)" -syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" -syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" -syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" -syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" -syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1 -syn match rubySymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1 -syn match rubySymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 -syn match rubySymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,he=e-1 -syn region rubySymbol start="[]})\"':]\@<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold -syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold +syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" +syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" +syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" +syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" + +if s:foldable(':') + syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold + syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold +else + syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape + syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial +endif + +syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=" syn match rubyBlockParameter "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contained -syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter +syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" oneline display contains=rubyBlockParameter syn match rubyInvalidVariable "$[^ A-Za-z_-]" syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]# @@ -117,93 +151,187 @@ syn match rubyPredefinedVariable "$_\>" display syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display -syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!" -syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!" -syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!" -syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!" - -" Normal Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold - -" Generalized Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold - -" Normal String and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial,@Spell fold -syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,@Spell fold -syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold - -" Generalized Single Quoted String, Symbol and Array of Strings -syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%q " end=" " skip="\\\\\|\\)" fold -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1" skip="\\\\\|\\\z1" fold -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape - -" Generalized Double Quoted String and Array of Strings and Shell Command Output +syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(ARGF\|ARGV\|ENV\|DATA\|FALSE\|NIL\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!" +syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!" + +" Normal Regular Expression {{{1 +if s:foldable('/') + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold +else + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial +endif + +" Generalized Regular Expression {{{1 +if s:foldable('%') + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold +else + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial +endif + +" Normal String {{{1 +let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : '' +exe 'syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" ' . + \ (s:foldable('%') ? 'fold' : '') . ' contains=@rubyStringSpecial' . s:spell_cluster +exe 'syn region rubyString matchgroup=rubyStringDelimiter start="''" end="''" skip="\\\\\|\\''" ' . + \ (s:foldable('%') ? 'fold' : '') . ' contains=rubyQuoteEscape' . s:spell_cluster + +" Shell Command Output {{{1 +if s:foldable('%') + syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold +else + syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial +endif + +" Generalized Single Quoted String, Symbol and Array of Strings {{{1 +if s:foldable('%') + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold +else + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" +endif + +" Generalized Double Quoted String and Array of Strings and Shell Command Output {{{1 " Note: %= is not matched here as the beginning of a double quoted string -syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx] " end=" " skip="\\\\\|\\)" contains=@rubyStringSpecial fold - -" Here Document -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop - -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend - -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend -syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend +if s:foldable('%') + syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape fold + syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold +else + syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape + syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial +endif + +" Array of Symbols {{{1 +if s:foldable('%') + " Array of Symbols + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape + + " Array of interpolated Symbols + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape fold +else + " Array of Symbols + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape + + " Array of interpolated Symbols + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape +endif + +" Here Document {{{1 +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop + +if s:foldable('<<') + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend + + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend +else + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend + + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart keepend + syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend +endif +" eRuby Config {{{1 if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 end +" Module, Class, Method and Alias Declarations {{{1 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration -syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match rubyFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 +syn match rubyFunction "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter -" Keywords +" Keywords {{{1 " Note: the following keywords have already been defined: " begin case class def do end for if module unless until while syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!" syn match rubyOperator "\<defined?" display syn match rubyKeyword "\<\%(super\|yield\)\>[?!]\@!" syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!" -syn match rubyPseudoVariable "\<\%(nil\|self\|__ENCODING__\|__FILE__\|__LINE__\|__callee__\|__method__\)\>[?!]\@!" " TODO: reorganise +syn match rubyPseudoVariable "\<\%(nil\|self\|__ENCODING__\|__dir__\|__FILE__\|__LINE__\|__callee__\|__method__\)\>[?!]\@!" " TODO: reorganise syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" -" Expensive Mode - match 'end' with the appropriate opening keyword for syntax -" based folding and special highlighting of module/class/method definitions +" Expensive Mode {{{1 +" Match 'end' with the appropriate opening keyword for syntax based folding +" and special highlighting of module/class/method definitions if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl @@ -211,23 +339,66 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl - syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold - syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold - syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold + if s:foldable('def') + syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop + endif + + if s:foldable('class') + syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop + endif + + if s:foldable('module') + syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop + endif " modifiers - syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display - syn match rubyRepeatModifier "\<\%(while\|until\)\>" display + syn match rubyLineContinuation "\\$" nextgroup=rubyConditionalModifier,rubyRepeatModifier skipwhite skipnl + syn match rubyConditionalModifier "\<\%(if\|unless\)\>" + syn match rubyRepeatModifier "\<\%(while\|until\)\>" + + if s:foldable('do') + syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop + endif - syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold " curly bracket block or hash literal - syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop fold - syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold + if s:foldable('{') + syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop + endif + + if s:foldable('[') + syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop + endif " statements without 'do' - syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold - syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold - syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold + if s:foldable('begin') + syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop + endif + + if s:foldable('case') + syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop + endif + + if s:foldable('if') + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold + else + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop + endif syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression @@ -237,7 +408,12 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") " statements with optional 'do' syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop - syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold + + if s:foldable('for') + syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold + else + syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine + endif if !exists("ruby_minlines") let ruby_minlines = 500 @@ -252,7 +428,7 @@ else syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!" endif -" Special Methods +" Special Methods {{{1 if !exists("ruby_no_special_methods") syn keyword rubyAccess public protected private public_class_method private_class_method public_constant private_constant module_function " attr is a common variable name @@ -263,40 +439,40 @@ if !exists("ruby_no_special_methods") syn keyword rubyException raise fail catch throw " false positive with 'include?' syn match rubyInclude "\<include\>[?!]\@!" - syn keyword rubyInclude autoload extend load prepend require require_relative + syn keyword rubyInclude autoload extend load prepend refine require require_relative using syn keyword rubyKeyword callcc caller lambda proc endif -" Comments and Documentation +" Comments and Documentation {{{1 syn match rubySharpBang "\%^#!.*" display -syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX todo contained +syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell -if !exists("ruby_no_comment_fold") - syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend +if !exists("ruby_no_comment_fold") && s:foldable('#') + syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold else syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell endif +" Keyword Nobbling {{{1 " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE - -syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE -syn match rubyKeywordAsMethod "\<\%(if\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE - -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|prepend\|private\|proc\|protected\)\>" transparent contains=NONE -syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|require_relative\|raise\|throw\|trap\)\>" transparent contains=NONE - -" __END__ Directive -syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold +syn match rubyKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%([_[:lower:]][_[:alnum:]]*\|\<\%(BEGIN\|END\)\>\)" transparent contains=NONE +syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*[?!]" transparent contains=NONE + +" More Symbols {{{1 +syn match rubySymbol "\%([{(,]\_s*\)\zs\l\w*[!?]\=::\@!"he=e-1 +syn match rubySymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 +syn match rubySymbol "\%([{(,]\_s*\)\zs[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 +syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1 + +" __END__ Directive {{{1 +if s:foldable('__END__') + syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold +else + syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" +endif +" Default Highlighting {{{1 hi def link rubyClass rubyDefine hi def link rubyModule rubyDefine hi def link rubyMethodExceptional rubyDefine @@ -336,6 +512,7 @@ hi def link rubyAccess Statement hi def link rubyAttribute Statement hi def link rubyEval Statement hi def link rubyPseudoVariable Constant +hi def link rubyCapitalizedMethod rubyLocalVariableOrMethod hi def link rubyComment Comment hi def link rubyData Comment @@ -349,7 +526,7 @@ hi def link rubyInterpolationDelimiter Delimiter hi def link rubyNoInterpolation rubyString hi def link rubySharpBang PreProc hi def link rubyRegexpDelimiter rubyStringDelimiter -hi def link rubySymbolDelimiter rubyStringDelimiter +hi def link rubySymbolDelimiter rubySymbol hi def link rubyStringDelimiter Delimiter hi def link rubyHeredoc rubyString hi def link rubyString String @@ -366,6 +543,10 @@ hi def link rubyInvalidVariable Error hi def link rubyError Error hi def link rubySpaceError rubyError +" Postscript {{{1 let b:current_syntax = "ruby" -" vim: nowrap sw=2 sts=2 ts=8 noet: +let &cpo = s:cpo_sav +unlet! s:cpo_sav + +" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: diff --git a/runtime/syntax/rust.vim b/runtime/syntax/rust.vim new file mode 100644 index 0000000000..57343301e0 --- /dev/null +++ b/runtime/syntax/rust.vim @@ -0,0 +1,295 @@ +" Vim syntax file +" Language: Rust +" Maintainer: Patrick Walton <pcwalton@mozilla.com> +" Maintainer: Ben Blum <bblum@cs.cmu.edu> +" Maintainer: Chris Morgan <me@chrismorgan.info> +" Last Change: Feb 24, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Syntax definitions {{{1 +" Basic keywords {{{2 +syn keyword rustConditional match if else +syn keyword rustRepeat for loop while +syn keyword rustTypedef type nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustStructure struct enum nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustUnion union nextgroup=rustIdentifier skipwhite skipempty contained +syn match rustUnionContextual /\<union\_s\+\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*/ transparent contains=rustUnion +syn keyword rustOperator as + +syn match rustAssert "\<assert\(\w\)*!" contained +syn match rustPanic "\<panic\(\w\)*!" contained +syn keyword rustKeyword break +syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty +syn keyword rustKeyword continue +syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty +syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty +syn keyword rustKeyword in impl let +syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty +syn keyword rustKeyword return +syn keyword rustSuper super +syn keyword rustKeyword unsafe where +syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty +" FIXME: Scoped impl's name is also fallen in this category +syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustStorage move mut ref static const +syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/ + +syn keyword rustInvalidBareKeyword crate + +syn keyword rustPubScopeCrate crate contained +syn match rustPubScopeDelim /[()]/ contained +syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent + +syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty +" This is to get the `bar` part of `extern crate "foo" as bar;` highlighting. +syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator +syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty + +syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained +syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained + +syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained +" Ideally we'd have syntax rules set up to match arbitrary expressions. Since +" we don't, we'll just define temporary contained rules to handle balancing +" delimiters. +syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent +syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent +" {} are handled by rustFoldBraces + +syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount +syn match rustMacroRepeatCount ".\?[*+]" contained +syn match rustMacroVariable "$\w\+" + +" Reserved (but not yet used) keywords {{{2 +syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro + +" Built-in types {{{2 +syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32 +syn keyword rustType f64 i8 i16 i32 i64 i128 str Self + +" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2 +" This section is just straight transformation of the contents of the prelude, +" to make it easy to update. + +" Reexported core operators {{{3 +syn keyword rustTrait Copy Send Sized Sync +syn keyword rustTrait Drop Fn FnMut FnOnce + +" Reexported functions {{{3 +" There’s no point in highlighting these; when one writes drop( or drop::< it +" gets the same highlighting anyway, and if someone writes `let drop = …;` we +" don’t really want *that* drop to be highlighted. +"syn keyword rustFunction drop + +" Reexported types and traits {{{3 +syn keyword rustTrait Box +syn keyword rustTrait ToOwned +syn keyword rustTrait Clone +syn keyword rustTrait PartialEq PartialOrd Eq Ord +syn keyword rustTrait AsRef AsMut Into From +syn keyword rustTrait Default +syn keyword rustTrait Iterator Extend IntoIterator +syn keyword rustTrait DoubleEndedIterator ExactSizeIterator +syn keyword rustEnum Option +syn keyword rustEnumVariant Some None +syn keyword rustEnum Result +syn keyword rustEnumVariant Ok Err +syn keyword rustTrait SliceConcatExt +syn keyword rustTrait String ToString +syn keyword rustTrait Vec + +" Other syntax {{{2 +syn keyword rustSelf self +syn keyword rustBoolean true false + +" If foo::bar changes to foo.bar, change this ("::" to "\."). +" If foo::bar changes to Foo::bar, change this (first "\w" to "\u"). +syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3 +syn match rustModPathSep "::" + +syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1 +syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>(); + +" This is merely a convention; note also the use of [A-Z], restricting it to +" latin identifiers rather than the full Unicode uppercase. I have not used +" [:upper:] as it depends upon 'noignorecase' +"syn match rustCapsIdent display "[A-Z]\w\(\w\)*" + +syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?" +" This one isn't *quite* right, as we could have binary-& with a reference +syn match rustSigil display /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +" This isn't actually correct; a closure with no arguments can be `|| { }`. +" Last, because the & in && isn't a sigil +syn match rustOperator display "&&\|||" +" This is rustArrowCharacter rather than rustArrow for the sake of matchparen, +" so it skips the ->; see http://stackoverflow.com/a/30309949 for details. +syn match rustArrowCharacter display "->" +syn match rustQuestionMark display "?\([a-zA-Z]\+\)\@!" + +syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic +syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic + +syn match rustEscapeError display contained /\\./ +syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ +syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/ +syn match rustStringContinuation display contained /\\\n\s*/ +syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation +syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell +syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell + +syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError +syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait +" This list comes from src/libsyntax/ext/deriving/mod.rs +" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). +syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy + +" Number literals +syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" + +" Special case for numbers of the form "1." which are float literals, unless followed by +" an identifier, which makes them integer literals with a method call or field access, +" or by another ".", which makes them integer literals followed by the ".." token. +" (This must go first so the others take precedence.) +syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\|\.\)\@!" +" To mark a number as a normal float, it must have at least one of the three things integral values don't have: +" a decimal point and more numbers; an exponent; and a type suffix. +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)" + +" For the benefit of delimitMate +syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\x\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime +syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate +syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime + +"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting +syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" +syn match rustLabel display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*:" +syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ +" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). +syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ +syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode +syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid + +syn match rustShebang /\%^#![^[].*/ +syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDocError start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell contained +syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell +syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell +syn region rustCommentBlockDocError matchgroup=rustCommentBlockDocError start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained +syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent +syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent +syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent +" FIXME: this is a really ugly and not fully correct implementation. Most +" importantly, a case like ``/* */*`` should have the final ``*`` not being in +" a comment, but in practice at present it leaves comments open two levels +" deep. But as long as you stay away from that particular case, I *believe* +" the highlighting is correct. Due to the way Vim's syntax engine works +" (greedy for start matches, unlike Rust's tokeniser which is searching for +" the earliest-starting match, start or end), I believe this cannot be solved. +" Oh you who would fix it, don't bother with things like duplicating the Block +" rules and putting ``\*\@<!`` at the start of them; it makes it worse, as +" then you must deal with cases like ``/*/**/*/``. And don't try making it +" worse with ``\%(/\@<!\*\)\@<!``, either... + +syn keyword rustTodo contained TODO FIXME XXX NB NOTE + +" Folding rules {{{2 +" Trivial folding rules to begin with. +" FIXME: use the AST to make really good folding +syn region rustFoldBraces start="{" end="}" transparent fold + +" Default highlighting {{{1 +hi def link rustDecNumber rustNumber +hi def link rustHexNumber rustNumber +hi def link rustOctNumber rustNumber +hi def link rustBinNumber rustNumber +hi def link rustIdentifierPrime rustIdentifier +hi def link rustTrait rustType +hi def link rustDeriveTrait rustTrait + +hi def link rustMacroRepeatCount rustMacroRepeatDelimiters +hi def link rustMacroRepeatDelimiters Macro +hi def link rustMacroVariable Define +hi def link rustSigil StorageClass +hi def link rustEscape Special +hi def link rustEscapeUnicode rustEscape +hi def link rustEscapeError Error +hi def link rustStringContinuation Special +hi def link rustString String +hi def link rustCharacterInvalid Error +hi def link rustCharacterInvalidUnicode rustCharacterInvalid +hi def link rustCharacter Character +hi def link rustNumber Number +hi def link rustBoolean Boolean +hi def link rustEnum rustType +hi def link rustEnumVariant rustConstant +hi def link rustConstant Constant +hi def link rustSelf Constant +hi def link rustFloat Float +hi def link rustArrowCharacter rustOperator +hi def link rustOperator Operator +hi def link rustKeyword Keyword +hi def link rustTypedef Keyword " More precise is Typedef, but it doesn't feel right for Rust +hi def link rustStructure Keyword " More precise is Structure +hi def link rustUnion rustStructure +hi def link rustPubScopeDelim Delimiter +hi def link rustPubScopeCrate rustKeyword +hi def link rustSuper rustKeyword +hi def link rustReservedKeyword Error +hi def link rustRepeat Conditional +hi def link rustConditional Conditional +hi def link rustIdentifier Identifier +hi def link rustCapsIdent rustIdentifier +hi def link rustModPath Include +hi def link rustModPathSep Delimiter +hi def link rustFunction Function +hi def link rustFuncName Function +hi def link rustFuncCall Function +hi def link rustShebang Comment +hi def link rustCommentLine Comment +hi def link rustCommentLineDoc SpecialComment +hi def link rustCommentLineDocError Error +hi def link rustCommentBlock rustCommentLine +hi def link rustCommentBlockDoc rustCommentLineDoc +hi def link rustCommentBlockDocError Error +hi def link rustAssert PreCondit +hi def link rustPanic PreCondit +hi def link rustMacro Macro +hi def link rustType Type +hi def link rustTodo Todo +hi def link rustAttribute PreProc +hi def link rustDerive PreProc +hi def link rustDefault StorageClass +hi def link rustStorage StorageClass +hi def link rustObsoleteStorage Error +hi def link rustLifetime Special +hi def link rustLabel Label +hi def link rustInvalidBareKeyword Error +hi def link rustExternCrate rustKeyword +hi def link rustObsoleteExternMod Error +hi def link rustBoxPlacementParens Delimiter +hi def link rustQuestionMark Special + +" Other Suggestions: +" hi rustAttribute ctermfg=cyan +" hi rustDerive ctermfg=cyan +" hi rustAssert ctermfg=yellow +" hi rustPanic ctermfg=red +" hi rustMacro ctermfg=magenta + +syn sync minlines=200 +syn sync maxlines=500 + +let b:current_syntax = "rust" diff --git a/runtime/syntax/samba.vim b/runtime/syntax/samba.vim index dae4040ec5..e096436626 100644 --- a/runtime/syntax/samba.vim +++ b/runtime/syntax/samba.vim @@ -8,11 +8,8 @@ " " Don't forget to run your config file through testparm(1)! -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -107,24 +104,14 @@ syn keyword sambaKeyword contained shutdown signing special spnego syn keyword sambaKeyword contained store unknown unwriteable " 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_samba_syn_inits") - if version < 508 - let did_samba_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink sambaParameter Normal - HiLink sambaKeyword Type - HiLink sambaSection Statement - HiLink sambaMacro PreProc - HiLink sambaComment Comment - HiLink sambaContinue Operator - HiLink sambaBoolean Constant - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link sambaParameter Normal +hi def link sambaKeyword Type +hi def link sambaSection Statement +hi def link sambaMacro PreProc +hi def link sambaComment Comment +hi def link sambaContinue Operator +hi def link sambaBoolean Constant let b:current_syntax = "samba" diff --git a/runtime/syntax/sas.vim b/runtime/syntax/sas.vim index dc70e1fd90..82ffe605ce 100644 --- a/runtime/syntax/sas.vim +++ b/runtime/syntax/sas.vim @@ -1,279 +1,259 @@ " Vim syntax file -" Language: SAS -" Maintainer: James Kidd <james.kidd@covance.com> -" Last Change: 2012 Apr 20 -" Corrected bug causing some keywords to appear as strings instead -" 18 Jul 2008 by Paulo Tanimoto <ptanimoto@gmail.com> -" Fixed comments with * taking multiple lines. -" Fixed highlighting of macro keywords. -" Added words to cases that didn't fit anywhere. -" 02 Jun 2003 -" Added highlighting for additional keywords and such; -" Attempted to match SAS default syntax colors; -" Changed syncing so it doesn't lose colors on large blocks; -" Much thanks to Bob Heckel for knowledgeable tweaking. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif - -syn case ignore - -syn region sasString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region sasString start=+'+ skip=+\\\\\|\\"+ end=+'+ - -" Want region from 'cards;' to ';' to be captured (Bob Heckel) -syn region sasCards start="^\s*CARDS.*" end="^\s*;\s*$" -syn region sasCards start="^\s*DATALINES.*" end="^\s*;\s*$" - -syn match sasNumber "-\=\<\d*\.\=[0-9_]\>" - -" Block comment -syn region sasComment start="/\*" end="\*/" contains=sasTodo - -" Ignore misleading //JCL SYNTAX... (Bob Heckel) -syn region sasComment start="[^/][^/]/\*" end="\*/" contains=sasTodo - -" Previous code for comments was written by Bob Heckel -" Comments with * may take multiple lines (Paulo Tanimoto) -syn region sasComment start=";\s*\*"hs=s+1 end=";" contains=sasTodo - -" Comments with * starting after a semicolon (Paulo Tanimoto) -syn region sasComment start="^\s*\*" end=";" contains=sasTodo - -" This line defines macro variables in code. HiLink at end of file -" defines the color scheme. Begin region with ampersand and end with -" any non-word character offset by -1; put ampersand in the skip list -" just in case it is used to concatenate macro variable values. - -" Thanks to ronald hllwarth for this fix to an intra-versioning -" problem with this little feature +" Language: SAS +" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com> +" Original Maintainer: James Kidd <james.kidd@covance.com> +" Version: 3.0.0 +" Last Change: Mar 10, 2017 +" +" 2017 Mar 7 +" +" Upgrade version number to 3.0. Improvements include: +" - Improve sync speed +" - Largely enhance precision +" - Update keywords in the latest SAS (as of Mar 2017) +" - Add syntaxes for date/time constants +" - Add syntax for data lines +" - Add (back) syntax for TODO in comments +" +" 2017 Feb 9 +" +" Add syntax folding +" +" 2016 Oct 10 +" +" Add highlighting for functions +" +" 2016 Sep 14 +" +" Change the implementation of syntaxing +" macro function names so that macro parameters same +" as SAS keywords won't be highlighted +" (Thank Joug Raw for the suggestion) +" Add section highlighting: +" - Use /** and **/ to define a section +" - It functions the same as a comment but +" with different highlighting +" +" 2016 Jun 14 +" +" Major changes so upgrade version number to 2.0 +" Overhaul the entire script (again). Improvements include: +" - Higher precision +" - Faster synchronization +" - Separate color for control statements +" - Highlight hash and java objects +" - Highlight macro variables in double quoted strings +" - Update all syntaxes based on SAS 9.4 +" - Add complete SAS/GRAPH and SAS/STAT procedure syntaxes +" - Add Proc TEMPLATE and GTL syntaxes +" - Add complete DS2 syntaxes +" - Add basic IML syntaxes +" - Many other improvements and bug fixes +" Drop support for VIM version < 600 if version < 600 - syn region sasMacroVar start="\&" skip="[_&]" end="\W"he=e-1 -else " for the older Vim's just do it their way ... - syn region sasMacroVar start="&" skip="[_&]" end="\W"he=e-1 + syntax clear +elseif exists('b:current_syntax') + finish endif +let s:cpo_save = &cpo +set cpo&vim -" I dont think specific PROCs need to be listed if use this line (Bob Heckel). -syn match sasProc "^\s*PROC \w\+" -syn keyword sasStep RUN QUIT DATA - - -" Base SAS Procs - version 8.1 - -syn keyword sasConditional DO ELSE END IF THEN UNTIL WHILE - -syn keyword sasStatement ABORT ARRAY ATTRIB BY CALL CARDS CARDS4 CATNAME -syn keyword sasStatement CONTINUE DATALINES DATALINES4 DELETE DISPLAY -syn keyword sasStatement DM DROP ENDSAS ERROR FILE FILENAME FOOTNOTE -syn keyword sasStatement FORMAT GOTO INFILE INFORMAT INPUT KEEP -syn keyword sasStatement LABEL LEAVE LENGTH LIBNAME LINK LIST LOSTCARD -syn keyword sasStatement MERGE MISSING MODIFY OPTIONS OUTPUT PAGE -syn keyword sasStatement PUT REDIRECT REMOVE RENAME REPLACE RETAIN -syn keyword sasStatement RETURN SELECT SET SKIP STARTSAS STOP TITLE -syn keyword sasStatement UPDATE WAITSAS WHERE WINDOW X SYSTASK - -" Keywords that are used in Proc SQL -" I left them as statements because SAS's enhanced editor highlights -" them the same as normal statements used in data steps (Jim Kidd) - -syn keyword sasStatement ADD AND ALTER AS CASCADE CHECK CREATE -syn keyword sasStatement DELETE DESCRIBE DISTINCT DROP FOREIGN -syn keyword sasStatement FROM GROUP HAVING INDEX INSERT INTO IN -syn keyword sasStatement KEY LIKE MESSAGE MODIFY MSGTYPE NOT -syn keyword sasStatement NULL ON OR ORDER PRIMARY REFERENCES -syn keyword sasStatement RESET RESTRICT SELECT SET TABLE -syn keyword sasStatement UNIQUE UPDATE VALIDATE VIEW WHERE - -" Match declarations have to appear one per line (Paulo Tanimoto) -syn match sasStatement "FOOTNOTE\d" -syn match sasStatement "TITLE\d" - -" Match declarations have to appear one per line (Paulo Tanimoto) -syn match sasMacro "%BQUOTE" -syn match sasMacro "%NRBQUOTE" -syn match sasMacro "%CMPRES" -syn match sasMacro "%QCMPRES" -syn match sasMacro "%COMPSTOR" -syn match sasMacro "%DATATYP" -syn match sasMacro "%DISPLAY" -syn match sasMacro "%DO" -syn match sasMacro "%ELSE" -syn match sasMacro "%END" -syn match sasMacro "%EVAL" -syn match sasMacro "%GLOBAL" -syn match sasMacro "%GOTO" -syn match sasMacro "%IF" -syn match sasMacro "%INDEX" -syn match sasMacro "%INPUT" -syn match sasMacro "%KEYDEF" -syn match sasMacro "%LABEL" -syn match sasMacro "%LEFT" -syn match sasMacro "%LENGTH" -syn match sasMacro "%LET" -syn match sasMacro "%LOCAL" -syn match sasMacro "%LOWCASE" -syn match sasMacro "%MACRO" -syn match sasMacro "%MEND" -syn match sasMacro "%NRBQUOTE" -syn match sasMacro "%NRQUOTE" -syn match sasMacro "%NRSTR" -syn match sasMacro "%PUT" -syn match sasMacro "%QCMPRES" -syn match sasMacro "%QLEFT" -syn match sasMacro "%QLOWCASE" -syn match sasMacro "%QSCAN" -syn match sasMacro "%QSUBSTR" -syn match sasMacro "%QSYSFUNC" -syn match sasMacro "%QTRIM" -syn match sasMacro "%QUOTE" -syn match sasMacro "%QUPCASE" -syn match sasMacro "%SCAN" -syn match sasMacro "%STR" -syn match sasMacro "%SUBSTR" -syn match sasMacro "%SUPERQ" -syn match sasMacro "%SYSCALL" -syn match sasMacro "%SYSEVALF" -syn match sasMacro "%SYSEXEC" -syn match sasMacro "%SYSFUNC" -syn match sasMacro "%SYSGET" -syn match sasMacro "%SYSLPUT" -syn match sasMacro "%SYSPROD" -syn match sasMacro "%SYSRC" -syn match sasMacro "%SYSRPUT" -syn match sasMacro "%THEN" -syn match sasMacro "%TO" -syn match sasMacro "%TRIM" -syn match sasMacro "%UNQUOTE" -syn match sasMacro "%UNTIL" -syn match sasMacro "%UPCASE" -syn match sasMacro "%VERIFY" -syn match sasMacro "%WHILE" -syn match sasMacro "%WINDOW" - -" SAS Functions - -syn keyword sasFunction ABS ADDR AIRY ARCOS ARSIN ATAN ATTRC ATTRN -syn keyword sasFunction BAND BETAINV BLSHIFT BNOT BOR BRSHIFT BXOR -syn keyword sasFunction BYTE CDF CEIL CEXIST CINV CLOSE CNONCT COLLATE -syn keyword sasFunction COMPBL COMPOUND COMPRESS COS COSH CSS CUROBS -syn keyword sasFunction CV DACCDB DACCDBSL DACCSL DACCSYD DACCTAB -syn keyword sasFunction DAIRY DATE DATEJUL DATEPART DATETIME DAY -syn keyword sasFunction DCLOSE DEPDB DEPDBSL DEPDBSL DEPSL DEPSL -syn keyword sasFunction DEPSYD DEPSYD DEPTAB DEPTAB DEQUOTE DHMS -syn keyword sasFunction DIF DIGAMMA DIM DINFO DNUM DOPEN DOPTNAME -syn keyword sasFunction DOPTNUM DREAD DROPNOTE DSNAME ERF ERFC EXIST -syn keyword sasFunction EXP FAPPEND FCLOSE FCOL FDELETE FETCH FETCHOBS -syn keyword sasFunction FEXIST FGET FILEEXIST FILENAME FILEREF FINFO -syn keyword sasFunction FINV FIPNAME FIPNAMEL FIPSTATE FLOOR FNONCT -syn keyword sasFunction FNOTE FOPEN FOPTNAME FOPTNUM FPOINT FPOS -syn keyword sasFunction FPUT FREAD FREWIND FRLEN FSEP FUZZ FWRITE -syn keyword sasFunction GAMINV GAMMA GETOPTION GETVARC GETVARN HBOUND -syn keyword sasFunction HMS HOSTHELP HOUR IBESSEL INDEX INDEXC -syn keyword sasFunction INDEXW INPUT INPUTC INPUTN INT INTCK INTNX -syn keyword sasFunction INTRR IRR JBESSEL JULDATE KURTOSIS LAG LBOUND -syn keyword sasFunction LEFT LENGTH LGAMMA LIBNAME LIBREF LOG LOG10 -syn keyword sasFunction LOG2 LOGPDF LOGPMF LOGSDF LOWCASE MAX MDY -syn keyword sasFunction MEAN MIN MINUTE MOD MONTH MOPEN MORT N -syn keyword sasFunction NETPV NMISS NORMAL NOTE NPV OPEN ORDINAL -syn keyword sasFunction PATHNAME PDF PEEK PEEKC PMF POINT POISSON POKE -syn keyword sasFunction PROBBETA PROBBNML PROBCHI PROBF PROBGAM -syn keyword sasFunction PROBHYPR PROBIT PROBNEGB PROBNORM PROBT PUT -syn keyword sasFunction PUTC PUTN QTR QUOTE RANBIN RANCAU RANEXP -syn keyword sasFunction RANGAM RANGE RANK RANNOR RANPOI RANTBL RANTRI -syn keyword sasFunction RANUNI REPEAT RESOLVE REVERSE REWIND RIGHT -syn keyword sasFunction ROUND SAVING SCAN SDF SECOND SIGN SIN SINH -syn keyword sasFunction SKEWNESS SOUNDEX SPEDIS SQRT STD STDERR STFIPS -syn keyword sasFunction STNAME STNAMEL SUBSTR SUM SYMGET SYSGET SYSMSG -syn keyword sasFunction SYSPROD SYSRC SYSTEM TAN TANH TIME TIMEPART -syn keyword sasFunction TINV TNONCT TODAY TRANSLATE TRANWRD TRIGAMMA -syn keyword sasFunction TRIM TRIMN TRUNC UNIFORM UPCASE USS VAR -syn keyword sasFunction VARFMT VARINFMT VARLABEL VARLEN VARNAME -syn keyword sasFunction VARNUM VARRAY VARRAYX VARTYPE VERIFY VFORMAT -syn keyword sasFunction VFORMATD VFORMATDX VFORMATN VFORMATNX VFORMATW -syn keyword sasFunction VFORMATWX VFORMATX VINARRAY VINARRAYX VINFORMAT -syn keyword sasFunction VINFORMATD VINFORMATDX VINFORMATN VINFORMATNX -syn keyword sasFunction VINFORMATW VINFORMATWX VINFORMATX VLABEL -syn keyword sasFunction VLABELX VLENGTH VLENGTHX VNAME VNAMEX VTYPE -syn keyword sasFunction VTYPEX WEEKDAY YEAR YYQ ZIPFIPS ZIPNAME ZIPNAMEL -syn keyword sasFunction ZIPSTATE - -" Handy settings for using vim with log files -syn keyword sasLogMsg NOTE -syn keyword sasWarnMsg WARNING -syn keyword sasErrMsg ERROR - -" Always contained in a comment (Bob Heckel) -syn keyword sasTodo TODO TBD FIXME contained - -" These don't fit anywhere else (Bob Heckel). -" Added others that were missing. -syn keyword sasUnderscore _ALL_ _AUTOMATIC_ _CHARACTER_ _INFILE_ _N_ _NAME_ _NULL_ _NUMERIC_ _USER_ _WEBOUT_ - -" End of SAS Functions - -" 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_sas_syntax_inits") - if version < 508 - let did_sas_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " Default sas enhanced editor color syntax - hi sComment term=bold cterm=NONE ctermfg=Green ctermbg=Black gui=NONE guifg=DarkGreen guibg=White - hi sCard term=bold cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Black guibg=LightYellow - hi sDate_Time term=NONE cterm=bold ctermfg=Green ctermbg=Black gui=bold guifg=SeaGreen guibg=White - hi sKeyword term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=NONE guifg=Blue guibg=White - hi sFmtInfmt term=NONE cterm=NONE ctermfg=LightGreen ctermbg=Black gui=NONE guifg=SeaGreen guibg=White - hi sString term=NONE cterm=NONE ctermfg=Magenta ctermbg=Black gui=NONE guifg=Purple guibg=White - hi sText term=NONE cterm=NONE ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White - hi sNumber term=NONE cterm=bold ctermfg=Green ctermbg=Black gui=bold guifg=SeaGreen guibg=White - hi sProc term=NONE cterm=bold ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White - hi sSection term=NONE cterm=bold ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White - hi mDefine term=NONE cterm=bold ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White - hi mKeyword term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=NONE guifg=Blue guibg=White - hi mReference term=NONE cterm=bold ctermfg=White ctermbg=Black gui=bold guifg=Blue guibg=White - hi mSection term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White - hi mText term=NONE cterm=NONE ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White - -" Colors that closely match SAS log colors for default color scheme - hi lError term=NONE cterm=NONE ctermfg=Red ctermbg=Black gui=none guifg=Red guibg=White - hi lWarning term=NONE cterm=NONE ctermfg=Green ctermbg=Black gui=none guifg=Green guibg=White - hi lNote term=NONE cterm=NONE ctermfg=Cyan ctermbg=Black gui=none guifg=Blue guibg=White - - - " Special hilighting for the SAS proc section +syn case ignore - HiLink sasComment sComment - HiLink sasConditional sKeyword - HiLink sasStep sSection - HiLink sasFunction sKeyword - HiLink sasMacro mKeyword - HiLink sasMacroVar NonText - HiLink sasNumber sNumber - HiLink sasStatement sKeyword - HiLink sasString sString - HiLink sasProc sProc - " (Bob Heckel) - HiLink sasTodo Todo - HiLink sasErrMsg lError - HiLink sasWarnMsg lWarning - HiLink sasLogMsg lNote - HiLink sasCards sCard - " (Bob Heckel) - HiLink sasUnderscore PreProc - delcommand HiLink -endif +" Basic SAS syntaxes +syn keyword sasOperator and eq ge gt in le lt ne not of or +syn keyword sasReserved _all_ _automatic_ _char_ _character_ _data_ _infile_ _last_ _n_ _name_ _null_ _num_ _numeric_ _temporary_ _user_ _webout_ +" Strings +syn region sasString start=+'+ skip=+''+ end=+'+ contains=@Spell +syn region sasString start=+"+ skip=+""+ end=+"+ contains=sasMacroVariable,@Spell +" Constants +syn match sasNumber /\v<\d+%(\.\d+)=%(>|e[\-+]=\d+>)/ display +syn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=:\d{2}:\d{2}%(:\d{2})=%(am|pm)\1dt>/ display +syn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=\1d>/ display +syn match sasDateTime /\v(['"])\d{2}:\d{2}%(:\d{2})=%(am|pm)\1t>/ display +" Comments +syn keyword sasTodo todo tbd fixme contained +syn region sasComment start='/\*' end='\*/' contains=sasTodo +syn region sasComment start='\v%(^|;)\s*\zs\%=\*' end=';'me=s-1 contains=sasTodo +syn region sasSectLbl matchgroup=sasSectLblEnds start='/\*\*\s*' end='\s*\*\*/' concealends +" Macros +syn match sasMacroVariable '\v\&+\w+%(\.\w+)=' display +syn match sasMacroReserved '\v\%%(abort|by|copy|display|do|else|end|global|goto|if|include|input|let|list|local|macro|mend|put|return|run|symdel|syscall|sysexec|syslput|sysrput|then|to|until|window|while)>' display +syn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%\w+\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction +syn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%q=sysfunc\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction,sasDataStepFunction +" Syntax cluster for basic SAS syntaxes +syn cluster sasBasicSyntax contains=sasOperator,sasReserved,sasNumber,sasDateTime,sasString,sasComment,sasMacroReserved,sasMacroFunction,sasMacroVariable,sasSectLbl + +" Formats +syn match sasFormat '\v\$\w+\.' display contained +syn match sasFormat '\v<\w+\.%(\d+>)=' display contained +syn region sasFormatContext start='.' end=';'me=s-1 contained contains=@sasBasicSyntax,sasFormat + +" Define global statements that can be accessed out of data step or procedures +syn keyword sasGlobalStatementKeyword catname dm endsas filename footnote footnote1 footnote2 footnote3 footnote4 footnote5 footnote6 footnote7 footnote8 footnote9 footnote10 missing libname lock ods options page quit resetline run sasfile skip sysecho title title1 title2 title3 title4 title5 title6 title7 title8 title9 title10 contained +syn keyword sasGlobalStatementODSKeyword chtml csvall docbook document escapechar epub epub2 epub3 exclude excel graphics html html3 html5 htmlcss imode listing markup output package path pcl pdf preferences phtml powerpoint printer proclabel proctitle ps results rtf select show tagsets trace usegopt verify wml contained +syn match sasGlobalStatement '\v%(^|;)\s*\zs\h\w*>' display transparent contains=sasGlobalStatementKeyword +syn match sasGlobalStatement '\v%(^|;)\s*\zsods>' display transparent contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty + +" Data step statements, 9.4 +syn keyword sasDataStepFunctionName abs addr addrlong airy allcomb allperm anyalnum anyalpha anycntrl anydigit anyfirst anygraph anylower anyname anyprint anypunct anyspace anyupper anyxdigit arcos arcosh arsin arsinh artanh atan atan2 attrc attrn band beta betainv blackclprc blackptprc blkshclprc blkshptprc blshift bnot bor brshift bxor byte cat catq cats catt catx cdf ceil ceilz cexist char choosec choosen cinv close cmiss cnonct coalesce coalescec collate comb compare compbl compfuzz compged complev compound compress constant convx convxp cos cosh cot count countc countw csc css cumipmt cumprinc curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datdif date datejul datepart datetime day dclose dcreate depdb depdbsl depsl depsyd deptab dequote deviance dhms dif digamma dim dinfo divide dnum dopen doptname doptnum dosubl dread dropnote dsname dsncatlgd dur durp effrate envlen erf erfc euclid exist exp fact fappend fclose fcol fcopy fdelete fetch fetchobs fexist fget fileexist filename fileref finance find findc findw finfo finv fipname fipnamel fipstate first floor floorz fmtinfo fnonct fnote fopen foptname foptnum fpoint fpos fput fread frewind frlen fsep fuzz fwrite gaminv gamma garkhclprc garkhptprc gcd geodist geomean geomeanz getoption getvarc getvarn graycode harmean harmeanz hbound hms holiday holidayck holidaycount holidayname holidaynx holidayny holidaytest hour htmldecode htmlencode ibessel ifc ifn index indexc indexw input inputc inputn int intcindex intck intcycle intfit intfmt intget intindex intnx intrr intseas intshift inttest intz iorcmsg ipmt iqr irr jbessel juldate juldate7 kurtosis lag largest lbound lcm lcomb left length lengthc lengthm lengthn lexcomb lexcombi lexperk lexperm lfact lgamma libname libref log log1px log10 log2 logbeta logcdf logistic logpdf logsdf lowcase lperm lpnorm mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modexist module modulec modulen modz month mopen mort msplint mvalid contained +syn keyword sasDataStepFunctionName n netpv nliteral nmiss nomrate normal notalnum notalpha notcntrl notdigit note notfirst notgraph notlower notname notprint notpunct notspace notupper notxdigit npv nvalid nwkdom open ordinal pathname pctl pdf peek peekc peekclong peeklong perm pmt point poisson ppmt probbeta probbnml probbnrm probchi probf probgam probhypr probit probmc probnegb probnorm probt propcase prxchange prxmatch prxparen prxparse prxposn ptrlongadd put putc putn pvp qtr quantile quote ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni rename repeat resolve reverse rewind right rms round rounde roundz saving savings scan sdf sec second sha256 sha256hex sha256hmachex sign sin sinh skewness sleep smallest soapweb soapwebmeta soapwipservice soapwipsrs soapws soapwsmeta soundex spedis sqrt squantile std stderr stfips stname stnamel strip subpad substr substrn sum sumabs symexist symget symglobl symlocal sysexist sysget sysmsg sysparm sysprocessid sysprocessname sysprod sysrc system tan tanh time timepart timevalue tinv tnonct today translate transtrn tranwrd trigamma trim trimn trunc tso typeof tzoneid tzonename tzoneoff tzones2u tzoneu2s uniform upcase urldecode urlencode uss uuidgen var varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vtype vtypex vvalue vvaluex week weekday whichc whichn wto year yieldp yrdif yyq zipcity zipcitydistance zipfips zipname zipnamel zipstate contained +syn keyword sasDataStepCallRoutineName allcomb allcombi allperm cats catt catx compcost execute graycode is8601_convert label lexcomb lexcombi lexperk lexperm logistic missing module poke pokelong prxchange prxdebug prxfree prxnext prxposn prxsubstr ranbin rancau rancomb ranexp rangam rannor ranperk ranperm ranpoi rantbl rantri ranuni scan set sleep softmax sortc sortn stdize streaminit symput symputx system tanh tso vname vnext wto contained +syn region sasDataStepFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction +syn region sasDataStepFunctionFormatContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction,sasFormat +syn match sasDataStepFunction '\v<\w+\ze\(' contained contains=sasDataStepFunctionName,sasDataStepCallRoutineName nextgroup=sasDataStepFunctionContext +syn match sasDataStepFunction '\v%(input|put)\ze\(' contained contains=sasDataStepFunctionName nextgroup=sasDataStepFunctionFormatContext +syn keyword sasDataStepHashMethodName add check clear definedata definedone definekey delete do_over equals find find_next find_prev first has_next has_prev last next output prev ref remove removedup replace replacedup reset_dup setcur sum sumdup contained +syn region sasDataStepHashMethodContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction +syn match sasDataStepHashMethod '\v\.\w+\ze\(' contained contains=sasDataStepHashMethodName nextgroup=sasDataStepHashMethodContext +syn keyword sasDataStepHashAttributeName item_size num_items contained +syn match sasDataStepHashAttribute '\v\.\w+>\ze\_[^(]' display contained contains=sasDataStepHashAttributeName +syn keyword sasDataStepControl continue do end go goto if leave link otherwise over return select to until when while contained +syn keyword sasDataStepControl else then contained nextgroup=sasDataStepStatementKeyword skipwhite skipnl skipempty +syn keyword sasDataStepHashOperator _new_ contained +syn keyword sasDataStepStatementKeyword abort array attrib by call cards cards4 datalines datalines4 dcl declare delete describe display drop error execute file format infile informat input keep label length lines lines4 list lostcard merge modify output put putlog redirect remove rename replace retain set stop update where window contained +syn keyword sasDataStepStatementHashKeyword hash hiter javaobj contained +syn match sasDataStepStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDataStepStatementKeyword,sasGlobalStatementKeyword +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(dcl|declare)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataStepStatementHashKeyword skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(format|informat|input|put)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(cards|datalines|lines)4=\s*;' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataLine skipwhite skipnl skipempty +syn region sasDataLine start='^' end='^;'me=s-1 contained +syn region sasDataStep matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsdata>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,@sasDataStepSyntax +syn cluster sasDataStepSyntax contains=sasDataStepFunction,sasDataStepHashOperator,sasDataStepHashAttribute,sasDataStepHashMethod,sasDataStepControl,sasDataStepStatement + +" Procedures, base SAS, 9.4 +syn keyword sasProcStatementKeyword abort age append array attrib audit block break by calid cdfplot change checkbox class classlev column compute contents copy create datarow dbencoding define delete deletefunc deletesubr delimiter device dialog dur endcomp exact exchange exclude explore fin fmtlib fontfile fontpath format formats freq function getnames guessingrows hbar hdfs histogram holidur holifin holistart holivar id idlabel informat inset invalue item key keylabel keyword label line link listfunc listsubr mapmiss mapreduce mean menu messages meta modify opentype outargs outdur outfin output outstart pageby partial picture pie pig plot ppplot printer probplot profile prompter qqplot radiobox ranks rbreak rbutton rebuild record remove rename repair report roptions save select selection separator source star start statistics struct submenu subroutine sum sumby table tables test text trantab truetype type1 types value var vbar ways weight where with write contained +syn match sasProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcStatementKeyword,sasGlobalStatementKeyword +syn match sasProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasProcStatement '\v%(^|;)\s*\zs%(format|informat)>' display contained contains=sasProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc%(\s+\h\w*)=>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement +syn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(catalog|chart|datasets|document|plot)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement + +" Procedures, SAS/GRAPH, 9.4 +syn keyword sasGraphProcStatementKeyword add area axis bar block bubble2 byline cc ccopy cdef cdelete chart cmap choro copy delete device dial donut exclude flow format fs goptions gout grid group hbar hbar3d hbullet hslider htrafficlight id igout label legend list modify move nobyline note pattern pie pie3d plot plot2 preview prism quit rename replay select scatter speedometer star surface symbol tc tcopy tdef tdelete template tile toggle treplay vbar vbar3d vtrafficlight vbullet vslider where contained +syn match sasGraphProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasGraphProcStatementKeyword,sasGlobalStatementKeyword +syn match sasGraphProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasGraphProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(g3d|g3grid|ganno|gcontour|gdevice|geocode|gfont|ginside|goptions|gproject|greduce|gremove|mapimport)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement +syn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(gareabar|gbarline|gchart|gkpi|gmap|gplot|gradar|greplay|gslide|gtile)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement + +" Procedures, SAS/STAT, 14.1 +syn keyword sasAnalyticalProcStatementKeyword absorb add array assess baseline bayes beginnodata bivar bootstrap bounds by cdfplot cells class cluster code compute condition contrast control coordinates copy cosan cov covtest coxreg der design determ deviance direct directions domain effect effectplot effpart em endnodata equality estimate exact exactoptions factor factors fcs filter fitindex format freq fwdlink gender grid group grow hazardratio height hyperprior id impjoint inset insetgroup invar invlink ippplot lincon lineqs lismod lmtests location logistic loglin lpredplot lsmeans lsmestimate manova matings matrix mcmc mean means missmodel mnar model modelaverage modeleffects monotone mstruct mtest multreg name nlincon nloptions oddsratio onecorr onesamplefreq onesamplemeans onewayanova outfiles output paired pairedfreq pairedmeans parameters parent parms partial partition path pathdiagram pcov performance plot population poststrata power preddist predict predpplot priors process probmodel profile prune pvar ram random ratio reference refit refmodel renameparm repeated replicate repweights response restore restrict retain reweight ridge rmsstd roc roccontrast rules samplesize samplingunit seed size scale score selection show simtests simulate slice std stderr store strata structeq supplementary table tables test testclass testfreq testfunc testid time transform treatments trend twosamplefreq twosamplemeans towsamplesurvival twosamplewilcoxon uds units univar var variance varnames weight where with zeromodel contained +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasAnalyticalProcStatementKeyword,sasGlobalStatementKeyword +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasAnalyticalProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(aceclus|adaptivereg|bchoice|boxplot|calis|cancorr|candisc|cluster|corresp|discrim|distance|factor|fastclus|fmm|freq|gam|gampl|gee|genmod|glimmix|glmmod|glmpower|glmselect|hpcandisc|hpfmm|hpgenselect|hplmixed|hplogistic|hpmixed|hpnlmod|hppls|hpprincomp|hpquantselect|hpreg|hpsplit|iclifetest|icphreg|inbreed|irt|kde|krige2d|lattice|lifereg|lifetest|loess|logistic|mcmc|mds|mi|mianalyze|mixed|modeclus|multtest|nested|nlin|nlmixed|npar1way|orthoreg|phreg|plm|pls|power|princomp|prinqual|probit|quantlife|quantreg|quantselect|robustreg|rsreg|score|seqdesign|seqtest|sim2d|simnormal|spp|stdize|stdrate|stepdisc|surveyfreq|surveyimpute|surveylogistic|surveymeans|surveyphreg|surveyreg|surveyselect|tpspline|transreg|tree|ttest|varclus|varcomp|variogram)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement +syn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(anova|arima|catmod|factex|glm|model|optex|plan|reg)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement + +" Procedures, ODS graphics, 9.4 +syn keyword sasODSGraphicsProcStatementKeyword band block bubble by colaxis compare dattrvar density dot dropline dynamic ellipse ellipseparm format fringe gradlegend hbar hbarbasic hbarparm hbox heatmap heatmapparm highlow histogram hline inset keylegend label lineparm loess matrix needle parent panelby pbspline plot polygon refline reg rowaxis scatter series spline step style styleattrs symbolchar symbolimage text vbar vbarbasic vbarparm vbox vector vline waterfall where xaxis x2axis yaxis y2axis yaxistable contained +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasODSGraphicsProcStatementKeyword,sasGlobalStatementKeyword +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasODSGraphicsProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasODSGraphicsProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(sgdesign|sgpanel|sgplot|sgrender|sgscatter)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasODSGraphicsProcStatement + +" Proc TEMPLATE, 9.4 +syn keyword sasProcTemplateClause as into +syn keyword sasProcTemplateStatementKeyword block break cellstyle class close column compute continue define delete delstream do done dynamic edit else end eval flush footer header import iterate link list mvar ndent next nmvar notes open path put putl putlog putq putstream putvars replace set source stop style test text text2 text3 translate trigger unblock unset xdent contained +syn keyword sasProcTemplateStatementComplexKeyword cellvalue column crosstabs event footer header statgraph style table tagset contained +syn keyword sasProcTemplateGTLStatementKeyword axislegend axistable bandplot barchart barchartparm begingraph beginpolygon beginpolyline bihistogram3dparm blockplot boxplot boxplotparm bubbleplot continuouslegend contourplotparm dendrogram discretelegend drawarrow drawimage drawline drawoval drawrectangle drawtext dropline ellipse ellipseparm endgraph endinnermargin endlayout endpolygon endpolyline endsidebar entry entryfootnote entrytitle fringeplot heatmap heatmapparm highlowplot histogram histogramparm innermargin layout legenditem legendtextitems linechart lineparm loessplot mergedlegend modelband needleplot pbsplineplot polygonplot referenceline regressionplot scatterplot seriesplot sidebar stepplot surfaceplotparm symbolchar symbolimage textplot vectorplot waterfallchart contained +syn keyword sasProcTemplateGTLComplexKeyword datalattice datapanel globallegend gridded lattice overlay overlayequated overlay3d region contained +syn match sasProcTemplateStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcTemplateStatementKeyword,sasProcTemplateGTLStatementKeyword,sasGlobalStatementKeyword +syn match sasProcTemplateStatement '\v%(^|;)\s*\zsdefine>' display contained contains=sasProcTemplateStatementKeyword nextgroup=sasProcTemplateStatementComplexKeyword skipwhite skipnl skipempty +syn match sasProcTemplateStatement '\v%(^|;)\s*\zslayout>' display contained contains=sasProcTemplateGTLStatementKeyword nextgroup=sasProcTemplateGTLComplexKeyword skipwhite skipnl skipempty +syn match sasProcTemplateStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasProcTemplate matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+template>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcTemplateClause,sasProcTemplateStatement + +" Proc SQL, 9.4 +syn keyword sasProcSQLFunctionName avg count css cv freq max mean median min n nmiss prt range std stderr sum sumwgt t uss var contained +syn region sasProcSQLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasProcSQLFunction +syn match sasProcSQLFunction '\v<\w+\ze\(' contained contains=sasProcSQLFunctionName,sasDataStepFunctionName nextgroup=sasProcSQLFunctionContext +syn keyword sasProcSQLClause add asc between by calculated cascade case check connection constraint cross desc distinct drop else end escape except exists foreign from full group having in inner intersect into is join key left libname like modify natural newline notrim null on order outer primary references restrict right separated set then to trimmed union unique user using values when where contained +syn keyword sasProcSQLClause as contained nextgroup=sasProcSQLStatementKeyword skipwhite skipnl skipempty +syn keyword sasProcSQLStatementKeyword connect delete disconnect execute insert reset select update validate contained +syn keyword sasProcSQLStatementComplexKeyword alter create describe drop contained nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty +syn keyword sasProcSQLStatementNextKeyword index table view contained +syn match sasProcSQLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcSQLStatementKeyword,sasGlobalStatementKeyword +syn match sasProcSQLStatement '\v%(^|;)\s*\zs%(alter|create|describe|drop)>' display contained contains=sasProcSQLStatementComplexKeyword nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty +syn match sasProcSQLStatement '\v%(^|;)\s*\zsvalidate>' display contained contains=sasProcSQLStatementKeyword nextgroup=sasProcSQLStatementKeyword,sasProcSQLStatementComplexKeyword skipwhite skipnl skipempty +syn match sasProcSQLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasProcSQL matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+sql>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcSQLFunction,sasProcSQLClause,sasProcSQLStatement + +" SAS/DS2, 9.4 +syn keyword sasDS2FunctionName abs anyalnum anyalpha anycntrl anydigit anyfirst anygraph anylower anyname anyprint anypunct anyspace anyupper anyxdigit arcos arcosh arsin arsinh artanh atan atan2 band beta betainv blackclprc blackptprc blkshclprc blkshptprc blshift bnot bor brshift bxor byte cat cats catt catx ceil ceilz choosec choosen cmp cmpt coalesce coalescec comb compare compbl compfuzz compound compress constant convx convxp cos cosh count countc countw css cumipmt cumprinc cv datdif date datejul datepart datetime day dequote deviance dhms dif digamma dim divide dur durp effrate erf erfc exp fact find findc findw floor floorz fmtinfo fuzz gaminv gamma garkhclprc garkhptprc gcd geodist geomean geomeanz harmean harmeanz hbound hms holiday hour index indexc indexw inputc inputn int intcindex intck intcycle intdt intfit intget intindex intnest intnx intrr intseas intshift inttest intts intz ipmt iqr irr juldate juldate7 kcount kstrcat kstrip kupdate kupdates kurtosis lag largest lbound lcm left length lengthc lengthm lengthn lgamma log logbeta log10 log1px log2 lowcase mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modz month mort n ndims netpv nmiss nomrate notalnum notalpha notcntrl notdigit notfirst notgraph notlower notname notprint notpunct notspace notupper notxdigit npv null nwkdom ordinal pctl perm pmt poisson power ppmt probbeta probbnml probbnrm probchi probdf probf probgam probhypr probit probmc probmed probnegb probnorm probt prxchange prxmatch prxparse prxposn put pvp qtr quote ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni repeat reverse right rms round rounde roundz savings scan sec second sha256hex sha256hmachex sign sin sinh skewness sleep smallest sqlexec sqrt std stderr streaminit strip substr substrn sum sumabs tan tanh time timepart timevalue tinv to_date to_double to_time to_timestamp today translate transtrn tranwrd trigamma trim trimn trunc uniform upcase uss uuidgen var verify vformat vinarray vinformat vlabel vlength vname vtype week weekday whichc whichn year yieldp yrdif yyq contained +syn region sasDS2FunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDS2Function +syn match sasDS2Function '\v<\w+\ze\(' contained contains=sasDS2FunctionName nextgroup=sasDS2FunctionContext +syn keyword sasDS2Control continue data dcl declare do drop else end enddata endpackage endthread from go goto if leave method otherwise package point return select then thread to until when while contained +syn keyword sasDS2StatementKeyword array by forward keep merge output put rename retain set stop vararray varlist contained +syn keyword sasDS2StatementComplexKeyword package thread contained +syn match sasDS2Statement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDS2StatementKeyword,sasGlobalStatementKeyword +syn match sasDS2Statement '\v%(^|;)\s*\zs%(dcl|declare|drop)>' display contained contains=sasDS2StatementKeyword nextgroup=sasDS2StatementComplexKeyword skipwhite skipnl skipempty +syn match sasDS2Statement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasDS2 matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+ds2>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDS2Function,sasDS2Control,sasDS2Statement + +" SAS/IML, 14.1 +syn keyword sasIMLFunctionName abs all allcomb allperm any apply armasim bin blankstr block branks bspline btran byte char choose col colvec concat contents convexit corr corr2cov countmiss countn countunique cov cov2corr covlag cshape cusum cuprod cv cvexhull datasets design designf det diag dif dimension distance do duration echelon eigval eigvec element exp expmatrix expandgrid fft forward froot full gasetup geomean ginv hadamard half hankel harmean hdir hermite homogen i ifft insert int inv invupdt isempty isskipped j jroot kurtosis lag length loc log logabsdet mad magic mahalanobis max mean median min mod moduleic modulein name ncol ndx2sub nleng norm normal nrow num opscal orpol parentname palette polyroot prod product pv quartile rancomb randdirichlet randfun randmultinomial randmvt randnormal randwishart ranperk ranperm range rank ranktie rates ratio remove repeat root row rowcat rowcatc rowvec rsubstr sample setdif shape shapecol skewness solve sparse splinev spot sqrsym sqrt sqrvech ssq standard std storage sub2ndx substr sum sweep symsqr t toeplitz trace trisolv type uniform union unique uniqueby value var vecdiag vech xmult xsect yield contained +syn keyword sasIMLCallRoutineName appcort armacov armalik bar box change comport delete eigen execute exportdatasettor exportmatrixtor farmacov farmafit farmalik farmasim fdif gaend gagetmem gagetval gainit gareeval garegen gasetcro gasetmut gasetobj gasetsel gblkvp gblkvpd gclose gdelete gdraw gdrawl geneig ggrid ginclude gopen gpie gpiexy gpoint gpoly gport gportpop gportstk gscale gscript gset gshow gsorth gstart gstop gstrlen gtext gvtext gwindow gxaxis gyaxis heatmapcont heatmapdisc histogram importdatasetfromr importmatrixfromr ipf itsolver kalcvf kalcvs kaldff kaldfs lav lcp lms lp lpsolve lts lupdt marg maxqform mcd milpsolve modulei mve nlpcg nlpdd nlpfdd nlpfea nlphqn nlplm nlpnms nlpnra nlpnrr nlpqn nlpqua nlptr ode odsgraph ortvec pgraf push qntl qr quad queue randgen randseed rdodt rupdt rename rupdt rzlind scatter seq seqscale seqshift seqscale seqshift series solvelin sort sortndx sound spline splinec svd tabulate tpspline tpsplnev tsbaysea tsdecomp tsmlocar tsmlomar tsmulmar tspears tspred tsroot tstvcar tsunimar valset varmacov varmalik varmasim vnormal vtsroot wavft wavget wavift wavprint wavthrsh contained +syn region sasIMLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasIMLFunction +syn match sasIMLFunction '\v<\w+\ze\(' contained contains=sasIMLFunctionName,sasDataStepFunction nextgroup=sasIMLFunctionContext +syn keyword sasIMLControl abort by do else end finish goto if link pause quit resume return run start stop then to until while contained +syn keyword sasIMLStatementKeyword append call close closefile create delete display edit file find force free index infile input list load mattrib print purge read remove replace reset save setin setout show sort store summary use window contained +syn match sasIMLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasIMLStatementKeyword,sasGlobalStatementKeyword +syn match sasIMLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasIML matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+iml>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasIMLFunction,sasIMLControl,sasIMLStatement + +" Macro definition +syn region sasMacro start='\v\%macro>' end='\v\%mend>' fold keepend contains=@sasBasicSyntax,@sasDataStepSyntax,sasDataStep,sasProc,sasODSGraphicsProc,sasGraphProc,sasAnalyticalProc,sasProcTemplate,sasProcSQL,sasDS2,sasIML + +" Define default highlighting +hi def link sasComment Comment +hi def link sasTodo Delimiter +hi def link sasSectLbl Title +hi def link sasSectLblEnds Comment +hi def link sasNumber Number +hi def link sasDateTime Constant +hi def link sasString String +hi def link sasDataStepControl Keyword +hi def link sasProcTemplateClause Keyword +hi def link sasProcSQLClause Keyword +hi def link sasDS2Control Keyword +hi def link sasIMLControl Keyword +hi def link sasOperator Operator +hi def link sasGlobalStatementKeyword Statement +hi def link sasGlobalStatementODSKeyword Statement +hi def link sasSectionKeyword Statement +hi def link sasDataStepFunctionName Function +hi def link sasDataStepCallRoutineName Function +hi def link sasDataStepStatementKeyword Statement +hi def link sasDataStepStatementHashKeyword Statement +hi def link sasDataStepHashOperator Operator +hi def link sasDataStepHashMethodName Function +hi def link sasDataStepHashAttributeName Identifier +hi def link sasProcStatementKeyword Statement +hi def link sasODSGraphicsProcStatementKeyword Statement +hi def link sasGraphProcStatementKeyword Statement +hi def link sasAnalyticalProcStatementKeyword Statement +hi def link sasProcTemplateStatementKeyword Statement +hi def link sasProcTemplateStatementComplexKeyword Statement +hi def link sasProcTemplateGTLStatementKeyword Statement +hi def link sasProcTemplateGTLComplexKeyword Statement +hi def link sasProcSQLFunctionName Function +hi def link sasProcSQLStatementKeyword Statement +hi def link sasProcSQLStatementComplexKeyword Statement +hi def link sasProcSQLStatementNextKeyword Statement +hi def link sasDS2FunctionName Function +hi def link sasDS2StatementKeyword Statement +hi def link sasIMLFunctionName Function +hi def link sasIMLCallRoutineName Function +hi def link sasIMLStatementKeyword Statement +hi def link sasMacroReserved PreProc +hi def link sasMacroVariable Define +hi def link sasMacroFunctionName Define +hi def link sasDataLine SpecialChar +hi def link sasFormat SpecialChar +hi def link sasReserved Special " Syncronize from beginning to keep large blocks from losing " syntax coloring while moving through code. @@ -281,4 +261,5 @@ syn sync fromstart let b:current_syntax = "sas" -" vim: ts=8 +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/sass.vim b/runtime/syntax/sass.vim index 2ea0722696..d075c8736e 100644 --- a/runtime/syntax/sass.vim +++ b/runtime/syntax/sass.vim @@ -2,7 +2,7 @@ " Language: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.sass -" Last Change: 2013 May 30 +" Last Change: 2016 Aug 29 if exists("b:current_syntax") finish @@ -13,7 +13,7 @@ runtime! syntax/css.vim syn case ignore syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp -syn cluster sassCssAttributes contains=css.*Attr,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp +syn cluster sassCssAttributes contains=css.*Attr,sassEndOfLineComment,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP @@ -58,6 +58,9 @@ syn match sassAmpersand "&" " TODO: Attribute namespaces " TODO: Arithmetic (including strings and concatenation) +syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators +syn keyword sassMediaOperators and not only contained +syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction @@ -67,7 +70,9 @@ syn keyword sassFor from to through in contained syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell +syn match sassEndOfLineComment "//.*" contains=sassComment,sassTodo,@Spell +hi def link sassEndOfLineComment sassComment hi def link sassCssComment sassComment hi def link sassComment Comment hi def link sassDefault cssImportant @@ -80,6 +85,9 @@ hi def link sassExtend PreProc hi def link sassFunctionDecl PreProc hi def link sassReturn PreProc hi def link sassTodo Todo +hi def link sassCharset PreProc +hi def link sassMedia PreProc +hi def link sassMediaOperators PreProc hi def link sassInclude Include hi def link sassDebug sassControl hi def link sassWarn sassControl diff --git a/runtime/syntax/sather.vim b/runtime/syntax/sather.vim index 759591bf84..de8bdade67 100644 --- a/runtime/syntax/sather.vim +++ b/runtime/syntax/sather.vim @@ -9,11 +9,8 @@ " Homepage: http://www.icsi.berkeley.edu/~sather " Sather files use .sa as suffix -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -61,44 +58,34 @@ syn match satherComment "--.*" contains=satherComment2String,satherCharacter syn sync ccomment satherComment " 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_sather_syn_inits") - if version < 508 - let did_sather_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink satherBranch satherStatement - HiLink satherLabel satherStatement - HiLink satherConditional satherStatement - HiLink satherSynchronize satherStatement - HiLink satherRepeat satherStatement - HiLink satherExceptions satherStatement - HiLink satherStorageClass satherDeclarative - HiLink satherMethodDecl satherDeclarative - HiLink satherClassDecl satherDeclarative - HiLink satherScopeDecl satherDeclarative - HiLink satherBoolValue satherValue - HiLink satherSpecial satherValue - HiLink satherString satherValue - HiLink satherCharacter satherValue - HiLink satherSpecialCharacter satherValue - HiLink satherNumber satherValue - HiLink satherStatement Statement - HiLink satherOperator Statement - HiLink satherComment Comment - HiLink satherType Type - HiLink satherValue String - HiLink satherString String - HiLink satherSpecial String - HiLink satherCharacter String - HiLink satherDeclarative Type - HiLink satherExternal PreCondit - delcommand HiLink -endif +hi def link satherBranch satherStatement +hi def link satherLabel satherStatement +hi def link satherConditional satherStatement +hi def link satherSynchronize satherStatement +hi def link satherRepeat satherStatement +hi def link satherExceptions satherStatement +hi def link satherStorageClass satherDeclarative +hi def link satherMethodDecl satherDeclarative +hi def link satherClassDecl satherDeclarative +hi def link satherScopeDecl satherDeclarative +hi def link satherBoolValue satherValue +hi def link satherSpecial satherValue +hi def link satherString satherValue +hi def link satherCharacter satherValue +hi def link satherSpecialCharacter satherValue +hi def link satherNumber satherValue +hi def link satherStatement Statement +hi def link satherOperator Statement +hi def link satherComment Comment +hi def link satherType Type +hi def link satherValue String +hi def link satherString String +hi def link satherSpecial String +hi def link satherCharacter String +hi def link satherDeclarative Type +hi def link satherExternal PreCondit let b:current_syntax = "sather" diff --git a/runtime/syntax/sbt.vim b/runtime/syntax/sbt.vim new file mode 100644 index 0000000000..cbf73beafe --- /dev/null +++ b/runtime/syntax/sbt.vim @@ -0,0 +1,32 @@ +" Vim syntax file +" Language: sbt +" Maintainer: Steven Dobay <stevendobay at protonmail.com> +" Last Change: 2017.04.30 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/scala.vim + +syn region sbtString start="\"[^"]" skip="\\\"" end="\"" contains=sbtStringEscape +syn match sbtStringEscape "\\u[0-9a-fA-F]\{4}" contained +syn match sbtStringEscape "\\[nrfvb\\\"]" contained + +syn match sbtIdentitifer "^\S\+\ze\s*\(:=\|++=\|+=\|<<=\|<+=\)" +syn match sbtBeginningSeq "^[Ss]eq\>" + +syn match sbtSpecial "\(:=\|++=\|+=\|<<=\|<+=\)" + +syn match sbtLineComment "//.*" +syn region sbtComment start="/\*" end="\*/" +syn region sbtDocComment start="/\*\*" end="\*/" keepend + +hi link sbtString String +hi link sbtIdentitifer Keyword +hi link sbtBeginningSeq Keyword +hi link sbtSpecial Special +hi link sbtComment Comment +hi link sbtLineComment Comment +hi link sbtDocComment Comment + diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim new file mode 100644 index 0000000000..c5a175fd77 --- /dev/null +++ b/runtime/syntax/scala.vim @@ -0,0 +1,232 @@ +" Vim syntax file +" Language: Scala +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Same as Vim +" Last Change: 20 May 2016 +" ---------------------------------------------------------------------------- + +if !exists('main_syntax') + " quit when a syntax file was already loaded + if exists("b:current_syntax") + finish + endif + let main_syntax = 'scala' +endif + +scriptencoding utf-8 + +let b:current_syntax = "scala" + +" Allows for embedding, see #59; main_syntax convention instead? Refactor TOP +" +" The @Spell here is a weird hack, it means *exclude* if the first group is +" TOP. Otherwise we get spelling errors highlighted on code elements that +" match scalaBlock, even with `syn spell notoplevel`. +function! s:ContainedGroup() + try + silent syn list @scala + return '@scala,@NoSpell' + catch /E392/ + return 'TOP,@Spell' + endtry +endfunction + +unlet! b:current_syntax + +syn case match +syn sync minlines=200 maxlines=1000 + +syn keyword scalaKeyword catch do else final finally for forSome if +syn keyword scalaKeyword match return throw try while yield macro +syn keyword scalaKeyword class trait object extends with nextgroup=scalaInstanceDeclaration skipwhite +syn keyword scalaKeyword case nextgroup=scalaKeyword,scalaCaseFollowing skipwhite +syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite +syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite +hi link scalaKeyword Keyword + +exe 'syn region scalaBlock start=/{/ end=/}/ contains=' . s:ContainedGroup() . ' fold' + +syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome +hi link scalaAkkaSpecialWord PreProc + +syn keyword scalatestSpecialWord shouldBe +syn match scalatestShouldDSLA /^\s\+\zsit should/ +syn match scalatestShouldDSLB /\<should\>/ +hi link scalatestSpecialWord PreProc +hi link scalatestShouldDSLA PreProc +hi link scalatestShouldDSLB PreProc + +syn match scalaSymbol /'[_A-Za-z0-9$]\+/ +hi link scalaSymbol Number + +syn match scalaChar /'.'/ +syn match scalaChar /'\\[\\"'ntbrf]'/ contains=scalaEscapedChar +syn match scalaChar /'\\u[A-Fa-f0-9]\{4}'/ contains=scalaUnicodeChar +syn match scalaEscapedChar /\\[\\"'ntbrf]/ +syn match scalaUnicodeChar /\\u[A-Fa-f0-9]\{4}/ +hi link scalaChar Character +hi link scalaEscapedChar Function +hi link scalaUnicodeChar Special + +syn match scalaOperator "||" +syn match scalaOperator "&&" +syn match scalaOperator "|" +syn match scalaOperator "&" +hi link scalaOperator Special + +syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList +syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition +syn match scalaVariableDeclarationList /\s*,\s*/ contained nextgroup=scalaNameDefinition +syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration +hi link scalaNameDefinition Function + +syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaInstanceHash +syn match scalaInstanceDeclaration /`[^`]\+`/ contained +syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration +hi link scalaInstanceDeclaration Special +hi link scalaInstanceHash Type + +syn match scalaUnimplemented /???/ +hi link scalaUnimplemented ERROR + +syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/ +hi link scalaCapitalWord Special + +" Handle type declarations specially +syn region scalaTypeStatement matchgroup=Keyword start=/\<type\_s\+\ze/ end=/$/ contains=scalaTypeTypeDeclaration,scalaSquareBrackets,scalaTypeTypeEquals,scalaTypeStatement + +" Ugh... duplication of all the scalaType* stuff to handle special highlighting +" of `type X =` declarations +syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals contains=scalaRoundBrackets skipwhite +syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite +syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite +syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite +syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite +syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite +syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite +hi link scalaTypeTypeDeclaration Type +hi link scalaTypeTypeExtension Keyword +hi link scalaTypeTypePostDeclaration Special +hi link scalaTypeTypePostExtension Keyword + +syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite +syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite +syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite +syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite +hi link scalaTypeDeclaration Type +hi link scalaTypeExtension Keyword +hi link scalaTypePostExtension Keyword + +syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration contains=scalaRoundBrackets +syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration +hi link scalaTypeAnnotation Normal + +syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained +syn match scalaCaseFollowing /`[^`]\+`/ contained +hi link scalaCaseFollowing Special + +syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super +hi link scalaKeywordModifier Function + +syn keyword scalaSpecial this true false ne eq +syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite +syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" +syn match scalaSpecial /`[^`]\+`/ " Backtick literals +hi link scalaSpecial PreProc + +syn keyword scalaExternal package import +hi link scalaExternal Include + +syn match scalaStringEmbeddedQuote /\\"/ contained +syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar +hi link scalaString String +hi link scalaStringEmbeddedQuote String + +syn region scalaIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\ze\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar +hi link scalaIString String +hi link scalaTripleIString String + +syn match scalaInterpolation /\$[a-zA-Z0-9_$]\+/ contained +exe 'syn region scalaInterpolationB matchgroup=scalaInterpolationBoundary start=/\${/ end=/}/ contained contains=' . s:ContainedGroup() +hi link scalaInterpolation Function +hi link scalaInterpolationB Normal + +syn region scalaFString matchgroup=scalaInterpolationBrackets start=/f"/ skip=/\\"/ end=/"/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar +syn match scalaFInterpolation /\$[a-zA-Z0-9_$]\+\(%[-A-Za-z0-9\.]\+\)\?/ contained +exe 'syn region scalaFInterpolationB matchgroup=scalaInterpolationBoundary start=/${/ end=/}\(%[-A-Za-z0-9\.]\+\)\?/ contained contains=' . s:ContainedGroup() +hi link scalaFString String +hi link scalaFInterpolation Function +hi link scalaFInterpolationB Normal + +syn region scalaTripleString start=/"""/ end=/"""\%([^"]\|$\)/ contains=scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleFString matchgroup=scalaInterpolationBrackets start=/f"""/ end=/"""\%([^"]\|$\)/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar +hi link scalaTripleString String +hi link scalaTripleFString String + +hi link scalaInterpolationBrackets Special +hi link scalaInterpolationBoundary Function + +syn match scalaNumber /\<0[dDfFlL]\?\>/ " Just a bare 0 +syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala +syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/ " Hex number +syn match scalaNumber /\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\=/ " exponential notation 1 +syn match scalaNumber /\<\d\+[eE][-+]\=\d\+[fFdD]\=\>/ " exponential notation 2 +syn match scalaNumber /\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>/ " exponential notation 3 +hi link scalaNumber Number + +syn region scalaRoundBrackets start="(" end=")" skipwhite contained contains=scalaTypeDeclaration,scalaSquareBrackets,scalaRoundBrackets + +syn region scalaSquareBrackets matchgroup=scalaSquareBracketsBrackets start="\[" end="\]" skipwhite nextgroup=scalaTypeExtension contains=scalaTypeDeclaration,scalaSquareBrackets,scalaTypeOperator,scalaTypeAnnotationParameter +syn match scalaTypeOperator /[-+=:<>]\+/ contained +syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained +hi link scalaSquareBracketsBrackets Type +hi link scalaTypeOperator Keyword +hi link scalaTypeAnnotationParameter Function + +syn match scalaShebang "\%^#!.*" display +syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold +syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained +syn match scalaParameterAnnotation "\%(@tparam\|@param\|@see\)" nextgroup=scalaParamAnnotationValue skipwhite contained +syn match scalaParamAnnotationValue /[.`_A-Za-z0-9$]\+/ contained +syn region scalaDocLinks start="\[\[" end="\]\]" contained +syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained +syn match scalaTodo "\vTODO|FIXME|XXX" contained +hi link scalaShebang Comment +hi link scalaMultilineComment Comment +hi link scalaDocLinks Function +hi link scalaParameterAnnotation Function +hi link scalaParamAnnotationValue Keyword +hi link scalaCommentAnnotation Function +hi link scalaCommentCodeBlockBrackets String +hi link scalaCommentCodeBlock String +hi link scalaTodo Todo + +syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/ +hi link scalaAnnotation PreProc + +syn match scalaTrailingComment "//.*$" contains=scalaTodo,@Spell +hi link scalaTrailingComment Comment + +syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing +syn match scalaAkkaFSM /stay\_s\+using/ +syn match scalaAkkaFSM /^\s*stay\s*$/ +syn match scalaAkkaFSM /when\ze([^)]*)/ +syn match scalaAkkaFSM /startWith\ze([^)]*)/ +syn match scalaAkkaFSM /initialize\ze()/ +syn match scalaAkkaFSM /onTransition/ +syn match scalaAkkaFSM /onTermination/ +syn match scalaAkkaFSM /whenUnhandled/ +syn match scalaAkkaFSMGotoUsing /\<using\>/ +syn match scalaAkkaFSMGotoUsing /\<goto\>/ +hi link scalaAkkaFSM PreProc +hi link scalaAkkaFSMGotoUsing PreProc + +let b:current_syntax = 'scala' + +if main_syntax ==# 'scala' + unlet main_syntax +endif + +" vim:set sw=2 sts=2 ts=8 et: diff --git a/runtime/syntax/scheme.vim b/runtime/syntax/scheme.vim index a210b0c720..e209729f57 100644 --- a/runtime/syntax/scheme.vim +++ b/runtime/syntax/scheme.vim @@ -1,330 +1,464 @@ " Vim syntax file -" Language: Scheme (R5RS + some R6RS extras) -" Last Change: 2012 May 13 -" Maintainer: Sergey Khorev <sergey.khorev@gmail.com> -" Original author: Dirk van Deun <dirk@igwe.vub.ac.be> - -" This script incorrectly recognizes some junk input as numerals: -" parsing the complete system of Scheme numerals using the pattern -" language is practically impossible: I did a lax approximation. - -" MzScheme extensions can be activated with setting is_mzscheme variable - -" Suggestions and bug reports are solicited by the author. - -" Initializing: - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Language: Scheme (R7RS) +" Last Change: 2018-01-06 +" Author: Evan Hanson <evhan@foldling.org> +" Maintainer: Evan Hanson <evhan@foldling.org> +" Previous Author: Dirk van Deun <dirk@igwe.vub.ac.be> +" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com> +" URL: https://foldling.org/vim/syntax/scheme.vim + +if exists('b:current_syntax') finish endif -let s:cpo_save = &cpo +let s:cpo = &cpo set cpo&vim -syn case ignore +syn match schemeParentheses "[^ '`\t\n()\[\]";]\+" +syn match schemeParentheses "[)\]]" -" Fascist highlighting: everything that doesn't fit the rules is an error... +syn match schemeIdentifier /[^ '`\t\n()\[\]"|;][^ '`\t\n()\[\]"|;]*/ -syn match schemeError ![^ \t()\[\]";]*! -syn match schemeError ")" +syn region schemeQuote matchgroup=schemeData start=/'[`']*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeQuote matchgroup=schemeData start=/'['`]*"/ skip=/\\[\\"]/ end=/"/ +syn region schemeQuote matchgroup=schemeData start=/'['`]*|/ skip=/\\[\\|]/ end=/|/ +syn region schemeQuote matchgroup=schemeData start=/'['`]*#\?(/ end=/)/ contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -" Quoted and backquoted stuff +syn region schemeQuasiquote matchgroup=schemeData start=/`['`]*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeQuasiquote matchgroup=schemeData start=/`['`]*#\?(/ end=/)/ contains=ALLBUT,schemeQuote,schemeQuoteForm,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn region schemeUnquote matchgroup=schemeParentheses start=/,/ end=/[ `'\t\n\[\]()";]/me=e-1 contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,@/ end=/[ `'\t\n\[\]()";]/me=e-1 contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,(/ end=/)/ contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,@(/ end=/)/ contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster -syn region schemeQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn region schemeQuoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster +syn region schemeQuasiquoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -syn region schemeStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn region schemeString start=/\(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/ +syn region schemeSymbol start=/\(\\\)\@<!|/ skip=/\\[\\|]/ end=/|/ -" Popular Scheme extension: -" using [] as well as () -syn region schemeStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn match schemeNumber /\(#[dbeio]\)*[+\-]*\([0-9]\+\|inf.0\|nan.0\)\(\/\|\.\)\?[0-9+\-@\ilns]*\>/ +syn match schemeNumber /#x[+\-]*[0-9a-fA-F]\+\>/ -syn region schemeUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn match schemeBoolean /#t\(rue\)\?/ +syn match schemeBoolean /#f\(alse\)\?/ -syn region schemeUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL -syn region schemeUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL +syn match schemeCharacter /#\\.[^ `'\t\n\[\]()]*/ +syn match schemeCharacter /#\\x[0-9a-fA-F]\+/ -syn region schemeUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn match schemeComment /;.*$/ -syn region schemeUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL -syn region schemeUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL +syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment -syn region schemeUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc +syn region schemeForm matchgroup=schemeParentheses start="(" end=")" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster +syn region schemeForm matchgroup=schemeParentheses start="\[" end="\]" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster -" R5RS Scheme Functions and Syntax: +syn region schemeVector matchgroup=schemeData start="#(" end=")" contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster +syn region schemeVector matchgroup=schemeData start="#[fsu]\d\+(" end=")" contains=schemeNumber,schemeComment,schemeDatumComment -if version < 600 - set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ +if exists('g:is_chicken') || exists('b:is_chicken') + syn region schemeImport matchgroup=schemeImport start="\(([ \t\n]*\)\@<=\(import\|import-syntax\|use\|require-extension\)\(-for-syntax\)\?\>" end=")"me=e-1 contained contains=schemeImportForm,schemeIdentifier,schemeComment,schemeDatumComment else - setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ -endif - -syn keyword schemeSyntax lambda and or if cond case define let let* letrec -syn keyword schemeSyntax begin do delay set! else => -syn keyword schemeSyntax quote quasiquote unquote unquote-splicing -syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules -" R6RS -syn keyword schemeSyntax define-record-type fields protocol - -syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car! -syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr -syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr -syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr -syn keyword schemeFunc cddaar cddadr cdddar cddddr null? list? list length -syn keyword schemeFunc append reverse list-ref memq memv member assq assv assoc -syn keyword schemeFunc symbol? symbol->string string->symbol number? complex? -syn keyword schemeFunc real? rational? integer? exact? inexact? = < > <= >= -syn keyword schemeFunc zero? positive? negative? odd? even? max min + * - / abs -syn keyword schemeFunc quotient remainder modulo gcd lcm numerator denominator -syn keyword schemeFunc floor ceiling truncate round rationalize exp log sin cos -syn keyword schemeFunc tan asin acos atan sqrt expt make-rectangular make-polar -syn keyword schemeFunc real-part imag-part magnitude angle exact->inexact -syn keyword schemeFunc inexact->exact number->string string->number char=? -syn keyword schemeFunc char-ci=? char<? char-ci<? char>? char-ci>? char<=? -syn keyword schemeFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char? -syn keyword schemeFunc char-numeric? char-whitespace? char-upper-case? -syn keyword schemeFunc char-lower-case? -syn keyword schemeFunc char->integer integer->char char-upcase char-downcase -syn keyword schemeFunc string? make-string string string-length string-ref -syn keyword schemeFunc string-set! string=? string-ci=? string<? string-ci<? -syn keyword schemeFunc string>? string-ci>? string<=? string-ci<=? string>=? -syn keyword schemeFunc string-ci>=? substring string-append vector? make-vector -syn keyword schemeFunc vector vector-length vector-ref vector-set! procedure? -syn keyword schemeFunc apply map for-each call-with-current-continuation -syn keyword schemeFunc call-with-input-file call-with-output-file input-port? -syn keyword schemeFunc output-port? current-input-port current-output-port -syn keyword schemeFunc open-input-file open-output-file close-input-port -syn keyword schemeFunc close-output-port eof-object? read read-char peek-char -syn keyword schemeFunc write display newline write-char call/cc -syn keyword schemeFunc list-tail string->list list->string string-copy -syn keyword schemeFunc string-fill! vector->list list->vector vector-fill! -syn keyword schemeFunc force with-input-from-file with-output-to-file -syn keyword schemeFunc char-ready? load transcript-on transcript-off eval -syn keyword schemeFunc dynamic-wind port? values call-with-values -syn keyword schemeFunc scheme-report-environment null-environment -syn keyword schemeFunc interaction-environment -" R6RS -syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable -syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set! -syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update! -syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys -syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function -syn keyword schemeFunc hashtable-mutable? equal-hash string-hash string-ci-hash symbol-hash -syn keyword schemeFunc find for-all exists filter partition fold-left fold-right -syn keyword schemeFunc remp remove remv remq memp assp cons* - -" ... so that a single + or -, inside a quoted context, would not be -" interpreted as a number (outside such contexts, it's a schemeFunc) - -syn match schemeDelimiter !\.[ \t\[\]()";]!me=e-1 -syn match schemeDelimiter !\.$! -" ... and a single dot is not a number but a delimiter - -" This keeps all other stuff unhighlighted, except *stuff* and <stuff>: - -syn match schemeOther ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*, -syn match schemeError ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -syn match schemeOther "\.\.\." -syn match schemeError !\.\.\.[^ \t\[\]()";]\+! -" ... a special identifier - -syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*[ \t\[\]()";],me=e-1 -syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*$, -syn match schemeError ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1 -syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$, -syn match schemeError ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -" Non-quoted lists, and strings: - -syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL -syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL - -syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL -syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL - -" Simple literals: -syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+ contains=@Spell - -" Comments: - -syn match schemeComment ";.*$" contains=@Spell - - -" Writing out the complete description of Scheme numerals without -" using variables is a day's work for a trained secretary... - -syn match schemeOther ![+-][ \t\[\]()";]!me=e-1 -syn match schemeOther ![+-]$! -" -" This is a useful lax approximation: -syn match schemeNumber "[-#+.]\=[0-9][-#+/0-9a-f@i.boxesfdl]*" -syn match schemeError ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*! - -syn match schemeBoolean "#[tf]" -syn match schemeError !#[tf][^ \t\[\]()";]\+! - -syn match schemeCharacter "#\\" -syn match schemeCharacter "#\\." -syn match schemeError !#\\.[^ \t\[\]()";]\+! -syn match schemeCharacter "#\\space" -syn match schemeError !#\\space[^ \t\[\]()";]\+! -syn match schemeCharacter "#\\newline" -syn match schemeError !#\\newline[^ \t\[\]()";]\+! - -" R6RS -syn match schemeCharacter "#\\x[0-9a-fA-F]\+" - - -if exists("b:is_mzscheme") || exists("is_mzscheme") - " MzScheme extensions - " multiline comment - syn region schemeComment start="#|" end="|#" contains=@Spell - - " #%xxx are the special MzScheme identifiers - syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - " anything limited by |'s is identifier - syn match schemeOther "|[^|]\+|" - - syn match schemeCharacter "#\\\%(return\|tab\)" - - " Modules require stmt - syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename - " modules provide stmt - syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except - " Other from MzScheme - syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case - syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum - syn keyword schemeExtSyntax datum->syntax-object - syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0 - syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature - syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export - syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax - - syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker - syn keyword schemeExtFunc use-standard-linker use-standard-compiler - syn keyword schemeExtFunc find-executable-path append-object-suffix append-extension-suffix - syn keyword schemeExtFunc current-library-collection-paths current-extension-compiler-flags make-parameter - syn keyword schemeExtFunc current-directory build-path normalize-path current-extension-linker-flags - syn keyword schemeExtFunc file-exists? directory-exists? delete-directory/files delete-directory delete-file - syn keyword schemeExtFunc system compile-file system-library-subpath getenv putenv current-standard-link-libraries - syn keyword schemeExtFunc remove* file-size find-files fold-files directory-list shell-execute split-path - syn keyword schemeExtFunc current-error-port process/ports process printf fprintf open-input-string open-output-string - syn keyword schemeExtFunc get-output-string - " exceptions - syn keyword schemeExtFunc exn exn:application:arity exn:application:continuation exn:application:fprintf:mismatch - syn keyword schemeExtFunc exn:application:mismatch exn:application:type exn:application:mismatch exn:break exn:i/o:filesystem exn:i/o:port - syn keyword schemeExtFunc exn:i/o:port:closed exn:i/o:tcp exn:i/o:udp exn:misc exn:misc:application exn:misc:unsupported exn:module exn:read - syn keyword schemeExtFunc exn:read:non-char exn:special-comment exn:syntax exn:thread exn:user exn:variable exn:application:mismatch - syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch? - syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed? - syn keyword schemeExtFunc exn:i/o:tcp? exn:i/o:udp? exn:misc? exn:misc:application? exn:misc:unsupported? exn:module? exn:read? exn:read:non-char? - syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch? - " Command-line parsing - syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each - - " syntax quoting, unquoting and quasiquotation - syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,@(" end=")" contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,\[" end="\]" contains=ALL - 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 + syn region schemeImport matchgroup=schemeImport start="\(([ \t\n]*\)\@<=\(import\)\>" end=")"me=e-1 contained contains=schemeImportForm,schemeIdentifier,schemeComment,schemeDatumComment endif - -if exists("b:is_chicken") || exists("is_chicken") - " multiline comment - syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=@Spell,schemeMultilineComment - - syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - - syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec - syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library - syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension - syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record - syn keyword schemeExtSyntax pointer tag-pointer tagged-pointer? define-foreign-type - syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv - syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax - syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno - - " here-string - syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ contains=@Spell - - if filereadable(expand("<sfile>:p:h")."/cpp.vim") - unlet! b:current_syntax - syn include @ChickenC <sfile>:p:h/cpp.vim - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-parse\s*#<<\z(.*\)$+hs=s+13 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse/spec "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-parse/spec\s*#<<\z(.*\)$+hs=s+18 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>?+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>!+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC - endif - - " suggested by Alex Queiroz - syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ contains=@Spell -endif - -" Synchronization and the wrapping up... - -syn sync match matchPlace grouphere NONE "^[^ \t]" -" ... i.e. synchronize on a line that starts at the left margin - -" 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_scheme_syntax_inits") - if version < 508 - let did_scheme_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink schemeSyntax Statement - HiLink schemeFunc Function - - HiLink schemeString String - HiLink schemeCharacter Character - HiLink schemeNumber Number - HiLink schemeBoolean Boolean - - HiLink schemeDelimiter Delimiter - HiLink schemeConstant Constant - - HiLink schemeComment Comment - HiLink schemeMultilineComment Comment - HiLink schemeError Error - - HiLink schemeExtSyntax Type - HiLink schemeExtFunc PreProc - delcommand HiLink +syn match schemeImportKeyword "\(([ \t\n]*\)\@<=\(except\|only\|prefix\|rename\|srfi\)\>" +syn region schemeImportForm matchgroup=schemeParentheses start="(" end=")" contained contains=schemeIdentifier,schemeComment,schemeDatumComment,@schemeImportCluster +syn cluster schemeImportCluster contains=schemeImportForm,schemeImportKeyword + +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*"/ skip=/\\[\\"]/ end=/"/ +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*|/ skip=/\\[\\|]/ end=/|/ +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*\(#\([usf]\d\+\)\?\)\?(/ end=/)/ contains=schemeDatumCommentForm +syn region schemeDatumCommentForm start="(" end=")" contained contains=schemeDatumCommentForm + +syn cluster schemeSyntaxCluster contains=schemeFunction,schemeKeyword,schemeSyntax,schemeExtraSyntax,schemeLibrarySyntax,schemeSyntaxSyntax + +syn keyword schemeLibrarySyntax define-library +syn keyword schemeLibrarySyntax export +syn keyword schemeLibrarySyntax include +syn keyword schemeLibrarySyntax include-ci +syn keyword schemeLibrarySyntax include-library-declarations +syn keyword schemeLibrarySyntax library +syn keyword schemeLibrarySyntax cond-expand + +syn keyword schemeSyntaxSyntax define-syntax +syn keyword schemeSyntaxSyntax let-syntax +syn keyword schemeSyntaxSyntax letrec-syntax +syn keyword schemeSyntaxSyntax syntax-rules + +syn keyword schemeSyntax => +syn keyword schemeSyntax and +syn keyword schemeSyntax begin +syn keyword schemeSyntax case +syn keyword schemeSyntax case-lambda +syn keyword schemeSyntax cond +syn keyword schemeSyntax define +syn keyword schemeSyntax define-record-type +syn keyword schemeSyntax define-values +syn keyword schemeSyntax delay +syn keyword schemeSyntax delay-force +syn keyword schemeSyntax do +syn keyword schemeSyntax else +syn keyword schemeSyntax guard +syn keyword schemeSyntax if +syn keyword schemeSyntax lambda +syn keyword schemeSyntax let +syn keyword schemeSyntax let* +syn keyword schemeSyntax let*-values +syn keyword schemeSyntax let-values +syn keyword schemeSyntax letrec +syn keyword schemeSyntax letrec* +syn keyword schemeSyntax or +syn keyword schemeSyntax parameterize +syn keyword schemeSyntax quasiquote +syn keyword schemeSyntax quote +syn keyword schemeSyntax set! +syn keyword schemeSyntax unless +syn keyword schemeSyntax unquote +syn keyword schemeSyntax unquote-splicing +syn keyword schemeSyntax when + +syn keyword schemeFunction * +syn keyword schemeFunction + +syn keyword schemeFunction - +syn keyword schemeFunction / +syn keyword schemeFunction < +syn keyword schemeFunction <= +syn keyword schemeFunction = +syn keyword schemeFunction > +syn keyword schemeFunction >= +syn keyword schemeFunction abs +syn keyword schemeFunction acos +syn keyword schemeFunction acos +syn keyword schemeFunction angle +syn keyword schemeFunction append +syn keyword schemeFunction apply +syn keyword schemeFunction asin +syn keyword schemeFunction assoc +syn keyword schemeFunction assq +syn keyword schemeFunction assv +syn keyword schemeFunction atan +syn keyword schemeFunction binary-port? +syn keyword schemeFunction boolean=? +syn keyword schemeFunction boolean? +syn keyword schemeFunction bytevector +syn keyword schemeFunction bytevector-append +syn keyword schemeFunction bytevector-append +syn keyword schemeFunction bytevector-copy +syn keyword schemeFunction bytevector-copy! +syn keyword schemeFunction bytevector-length +syn keyword schemeFunction bytevector-u8-ref +syn keyword schemeFunction bytevector-u8-set! +syn keyword schemeFunction bytevector? +syn keyword schemeFunction caaaar +syn keyword schemeFunction caaadr +syn keyword schemeFunction caaar +syn keyword schemeFunction caadar +syn keyword schemeFunction caaddr +syn keyword schemeFunction caadr +syn keyword schemeFunction caar +syn keyword schemeFunction cadaar +syn keyword schemeFunction cadadr +syn keyword schemeFunction cadar +syn keyword schemeFunction caddar +syn keyword schemeFunction cadddr +syn keyword schemeFunction caddr +syn keyword schemeFunction cadr +syn keyword schemeFunction call-with-current-continuation +syn keyword schemeFunction call-with-input-file +syn keyword schemeFunction call-with-output-file +syn keyword schemeFunction call-with-port +syn keyword schemeFunction call-with-values +syn keyword schemeFunction call/cc +syn keyword schemeFunction car +syn keyword schemeFunction cdaaar +syn keyword schemeFunction cdaadr +syn keyword schemeFunction cdaar +syn keyword schemeFunction cdadar +syn keyword schemeFunction cdaddr +syn keyword schemeFunction cdadr +syn keyword schemeFunction cdar +syn keyword schemeFunction cddaar +syn keyword schemeFunction cddadr +syn keyword schemeFunction cddar +syn keyword schemeFunction cdddar +syn keyword schemeFunction cddddr +syn keyword schemeFunction cdddr +syn keyword schemeFunction cddr +syn keyword schemeFunction cdr +syn keyword schemeFunction ceiling +syn keyword schemeFunction char->integer +syn keyword schemeFunction char-alphabetic? +syn keyword schemeFunction char-ci<=? +syn keyword schemeFunction char-ci<? +syn keyword schemeFunction char-ci=? +syn keyword schemeFunction char-ci>=? +syn keyword schemeFunction char-ci>? +syn keyword schemeFunction char-downcase +syn keyword schemeFunction char-foldcase +syn keyword schemeFunction char-lower-case? +syn keyword schemeFunction char-numeric? +syn keyword schemeFunction char-ready? +syn keyword schemeFunction char-upcase +syn keyword schemeFunction char-upper-case? +syn keyword schemeFunction char-whitespace? +syn keyword schemeFunction char<=? +syn keyword schemeFunction char<? +syn keyword schemeFunction char=? +syn keyword schemeFunction char>=? +syn keyword schemeFunction char>? +syn keyword schemeFunction char? +syn keyword schemeFunction close-input-port +syn keyword schemeFunction close-output-port +syn keyword schemeFunction close-port +syn keyword schemeFunction command-line +syn keyword schemeFunction complex? +syn keyword schemeFunction cons +syn keyword schemeFunction cos +syn keyword schemeFunction current-error-port +syn keyword schemeFunction current-input-port +syn keyword schemeFunction current-jiffy +syn keyword schemeFunction current-output-port +syn keyword schemeFunction current-second +syn keyword schemeFunction delete-file +syn keyword schemeFunction denominator +syn keyword schemeFunction digit-value +syn keyword schemeFunction display +syn keyword schemeFunction dynamic-wind +syn keyword schemeFunction emergency-exit +syn keyword schemeFunction environment +syn keyword schemeFunction eof-object +syn keyword schemeFunction eof-object? +syn keyword schemeFunction eq? +syn keyword schemeFunction equal? +syn keyword schemeFunction eqv? +syn keyword schemeFunction error +syn keyword schemeFunction error-object-irritants +syn keyword schemeFunction error-object-message +syn keyword schemeFunction error-object? +syn keyword schemeFunction eval +syn keyword schemeFunction even? +syn keyword schemeFunction exact +syn keyword schemeFunction exact->inexact +syn keyword schemeFunction exact-integer-sqrt +syn keyword schemeFunction exact-integer? +syn keyword schemeFunction exact? +syn keyword schemeFunction exit +syn keyword schemeFunction exp +syn keyword schemeFunction expt +syn keyword schemeFunction features +syn keyword schemeFunction file-error? +syn keyword schemeFunction file-exists? +syn keyword schemeFunction finite? +syn keyword schemeFunction floor +syn keyword schemeFunction floor-quotient +syn keyword schemeFunction floor-remainder +syn keyword schemeFunction floor/ +syn keyword schemeFunction flush-output-port +syn keyword schemeFunction for-each +syn keyword schemeFunction force +syn keyword schemeFunction gcd +syn keyword schemeFunction get-environment-variable +syn keyword schemeFunction get-environment-variables +syn keyword schemeFunction get-output-bytevector +syn keyword schemeFunction get-output-string +syn keyword schemeFunction imag-part +syn keyword schemeFunction inexact +syn keyword schemeFunction inexact->exact +syn keyword schemeFunction inexact? +syn keyword schemeFunction infinite? +syn keyword schemeFunction input-port-open? +syn keyword schemeFunction input-port? +syn keyword schemeFunction integer->char +syn keyword schemeFunction integer? +syn keyword schemeFunction interaction-environment +syn keyword schemeFunction jiffies-per-second +syn keyword schemeFunction lcm +syn keyword schemeFunction length +syn keyword schemeFunction list +syn keyword schemeFunction list->string +syn keyword schemeFunction list->vector +syn keyword schemeFunction list-copy +syn keyword schemeFunction list-ref +syn keyword schemeFunction list-set! +syn keyword schemeFunction list-tail +syn keyword schemeFunction list? +syn keyword schemeFunction load +syn keyword schemeFunction log +syn keyword schemeFunction magnitude +syn keyword schemeFunction make-bytevector +syn keyword schemeFunction make-list +syn keyword schemeFunction make-parameter +syn keyword schemeFunction make-polar +syn keyword schemeFunction make-promise +syn keyword schemeFunction make-rectangular +syn keyword schemeFunction make-string +syn keyword schemeFunction make-vector +syn keyword schemeFunction map +syn keyword schemeFunction max +syn keyword schemeFunction member +syn keyword schemeFunction memq +syn keyword schemeFunction memv +syn keyword schemeFunction min +syn keyword schemeFunction modulo +syn keyword schemeFunction nan? +syn keyword schemeFunction negative? +syn keyword schemeFunction newline +syn keyword schemeFunction not +syn keyword schemeFunction null-environment +syn keyword schemeFunction null? +syn keyword schemeFunction number->string +syn keyword schemeFunction number? +syn keyword schemeFunction numerator +syn keyword schemeFunction odd? +syn keyword schemeFunction open-binary-input-file +syn keyword schemeFunction open-binary-output-file +syn keyword schemeFunction open-input-bytevector +syn keyword schemeFunction open-input-file +syn keyword schemeFunction open-input-string +syn keyword schemeFunction open-output-bytevector +syn keyword schemeFunction open-output-file +syn keyword schemeFunction open-output-string +syn keyword schemeFunction output-port-open? +syn keyword schemeFunction output-port? +syn keyword schemeFunction pair? +syn keyword schemeFunction peek-char +syn keyword schemeFunction peek-u8 +syn keyword schemeFunction port? +syn keyword schemeFunction positive? +syn keyword schemeFunction procedure? +syn keyword schemeFunction promise? +syn keyword schemeFunction quotient +syn keyword schemeFunction raise +syn keyword schemeFunction raise-continuable +syn keyword schemeFunction rational? +syn keyword schemeFunction rationalize +syn keyword schemeFunction read +syn keyword schemeFunction read-bytevector +syn keyword schemeFunction read-bytevector! +syn keyword schemeFunction read-char +syn keyword schemeFunction read-error? +syn keyword schemeFunction read-line +syn keyword schemeFunction read-string +syn keyword schemeFunction read-u8 +syn keyword schemeFunction real-part +syn keyword schemeFunction real? +syn keyword schemeFunction remainder +syn keyword schemeFunction reverse +syn keyword schemeFunction round +syn keyword schemeFunction scheme-report-environment +syn keyword schemeFunction set-car! +syn keyword schemeFunction set-cdr! +syn keyword schemeFunction sin +syn keyword schemeFunction sqrt +syn keyword schemeFunction square +syn keyword schemeFunction string +syn keyword schemeFunction string->list +syn keyword schemeFunction string->number +syn keyword schemeFunction string->symbol +syn keyword schemeFunction string->utf8 +syn keyword schemeFunction string->vector +syn keyword schemeFunction string-append +syn keyword schemeFunction string-ci<=? +syn keyword schemeFunction string-ci<? +syn keyword schemeFunction string-ci=? +syn keyword schemeFunction string-ci>=? +syn keyword schemeFunction string-ci>? +syn keyword schemeFunction string-copy +syn keyword schemeFunction string-copy! +syn keyword schemeFunction string-downcase +syn keyword schemeFunction string-fill! +syn keyword schemeFunction string-foldcase +syn keyword schemeFunction string-for-each +syn keyword schemeFunction string-length +syn keyword schemeFunction string-map +syn keyword schemeFunction string-ref +syn keyword schemeFunction string-set! +syn keyword schemeFunction string-upcase +syn keyword schemeFunction string<=? +syn keyword schemeFunction string<? +syn keyword schemeFunction string=? +syn keyword schemeFunction string>=? +syn keyword schemeFunction string>? +syn keyword schemeFunction string? +syn keyword schemeFunction substring +syn keyword schemeFunction symbol->string +syn keyword schemeFunction symbol=? +syn keyword schemeFunction symbol? +syn keyword schemeFunction syntax-error +syn keyword schemeFunction tan +syn keyword schemeFunction textual-port? +syn keyword schemeFunction transcript-off +syn keyword schemeFunction transcript-on +syn keyword schemeFunction truncate +syn keyword schemeFunction truncate-quotient +syn keyword schemeFunction truncate-remainder +syn keyword schemeFunction truncate/ +syn keyword schemeFunction u8-ready? +syn keyword schemeFunction utf8->string +syn keyword schemeFunction values +syn keyword schemeFunction vector +syn keyword schemeFunction vector->list +syn keyword schemeFunction vector->string +syn keyword schemeFunction vector-append +syn keyword schemeFunction vector-copy +syn keyword schemeFunction vector-copy! +syn keyword schemeFunction vector-fill! +syn keyword schemeFunction vector-for-each +syn keyword schemeFunction vector-length +syn keyword schemeFunction vector-map +syn keyword schemeFunction vector-ref +syn keyword schemeFunction vector-set! +syn keyword schemeFunction vector? +syn keyword schemeFunction with-exception-handler +syn keyword schemeFunction with-input-from-file +syn keyword schemeFunction with-output-to-file +syn keyword schemeFunction write +syn keyword schemeFunction write-bytevector +syn keyword schemeFunction write-char +syn keyword schemeFunction write-shared +syn keyword schemeFunction write-simple +syn keyword schemeFunction write-string +syn keyword schemeFunction write-u8 +syn keyword schemeFunction zero? + +hi def link schemeBoolean Boolean +hi def link schemeCharacter Character +hi def link schemeComment Comment +hi def link schemeConstant Constant +hi def link schemeData Delimiter +hi def link schemeDatumComment Comment +hi def link schemeDatumCommentForm Comment +hi def link schemeDelimiter Delimiter +hi def link schemeError Error +hi def link schemeExtraSyntax Underlined +hi def link schemeFunction Function +hi def link schemeIdentifier Normal +hi def link schemeImport PreProc +hi def link schemeImportKeyword PreProc +hi def link schemeKeyword Type +hi def link schemeLibrarySyntax PreProc +hi def link schemeMultilineComment Comment +hi def link schemeNumber Number +hi def link schemeParentheses Normal +hi def link schemeQuasiquote Delimiter +hi def link schemeQuote Delimiter +hi def link schemeSpecialSyntax Special +hi def link schemeString String +hi def link schemeSymbol Normal +hi def link schemeSyntax Statement +hi def link schemeSyntaxSyntax PreProc +hi def link schemeTypeSyntax Type + +let b:did_scheme_syntax = 1 + +if exists('b:is_chicken') || exists('g:is_chicken') + exe 'ru! syntax/chicken.vim' endif -let b:current_syntax = "scheme" - -let &cpo = s:cpo_save -unlet s:cpo_save +unlet b:did_scheme_syntax +let b:current_syntax = 'scheme' +let &cpo = s:cpo +unlet s:cpo diff --git a/runtime/syntax/scilab.vim b/runtime/syntax/scilab.vim index 1bfc003678..03e123b058 100644 --- a/runtime/syntax/scilab.vim +++ b/runtime/syntax/scilab.vim @@ -9,11 +9,8 @@ " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -66,49 +63,39 @@ syn match scilabOverload "%[A-Za-z0-9?!_#$]\+_[A-Za-z0-9?!_#$]\+" " 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_scilab_syntax_inits") - if version < 508 - let did_scilab_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink scilabStatement Statement - HiLink scilabFunction Keyword - HiLink scilabPredicate Keyword - HiLink scilabKeyword Keyword - HiLink scilabDebug Debug - HiLink scilabRepeat Repeat - HiLink scilabConditional Conditional - HiLink scilabMultiplex Conditional - - HiLink scilabConstant Constant - HiLink scilabBoolean Boolean - - HiLink scilabDelimiter Delimiter - HiLink scilabMlistAccess Delimiter - HiLink scilabComparison Operator - HiLink scilabLogical Operator - HiLink scilabAssignment Operator - HiLink scilabArithmetic Operator - HiLink scilabRange Operator - HiLink scilabLineContinuation Underlined - HiLink scilabTransposition Operator - - HiLink scilabTodo Todo - HiLink scilabComment Comment - - HiLink scilabNumber Number - HiLink scilabString String - - HiLink scilabIdentifier Identifier - HiLink scilabOverload Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link scilabStatement Statement +hi def link scilabFunction Keyword +hi def link scilabPredicate Keyword +hi def link scilabKeyword Keyword +hi def link scilabDebug Debug +hi def link scilabRepeat Repeat +hi def link scilabConditional Conditional +hi def link scilabMultiplex Conditional + +hi def link scilabConstant Constant +hi def link scilabBoolean Boolean + +hi def link scilabDelimiter Delimiter +hi def link scilabMlistAccess Delimiter +hi def link scilabComparison Operator +hi def link scilabLogical Operator +hi def link scilabAssignment Operator +hi def link scilabArithmetic Operator +hi def link scilabRange Operator +hi def link scilabLineContinuation Underlined +hi def link scilabTransposition Operator + +hi def link scilabTodo Todo +hi def link scilabComment Comment + +hi def link scilabNumber Number +hi def link scilabString String + +hi def link scilabIdentifier Identifier +hi def link scilabOverload Special + let b:current_syntax = "scilab" diff --git a/runtime/syntax/screen.vim b/runtime/syntax/screen.vim index 71b3d3efba..d576d29b7a 100644 --- a/runtime/syntax/screen.vim +++ b/runtime/syntax/screen.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: screen(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-03 +" Language: screen(1) configuration file +" Maintainer: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-09-24 if exists("b:current_syntax") finish @@ -76,12 +77,16 @@ syn keyword screenCommands \ break \ breaktype \ bufferfile + \ bumpleft + \ bumpright \ c1 \ caption \ chacl \ charset \ chdir + \ cjkwidth \ clear + \ collapse \ colon \ command \ compacthist @@ -104,6 +109,7 @@ syn keyword screenCommands \ deflogin \ defmode \ defmonitor + \ defmousetrack \ defnonblock \ defobuflimit \ defscrollback @@ -113,6 +119,7 @@ syn keyword screenCommands \ defutf8 \ defwrap \ defwritelock + \ defzombie \ detach \ digraph \ dinfo @@ -126,7 +133,9 @@ syn keyword screenCommands \ fit \ flow \ focus + \ focusminsize \ gr + \ group \ hardcopy \ hardcopy_append \ hardcopydir @@ -155,6 +164,7 @@ syn keyword screenCommands \ maxwin \ meta \ monitor + \ mousetrack \ msgminwait \ msgwait \ multiuser @@ -182,6 +192,7 @@ syn keyword screenCommands \ register \ remove \ removebuf + \ rendition \ reset \ resize \ screen @@ -197,6 +208,7 @@ syn keyword screenCommands \ sleep \ slowpaste \ sorendition + \ sort \ source \ split \ startup_message @@ -210,6 +222,7 @@ syn keyword screenCommands \ time \ title \ umask + \ unbindall \ unsetenv \ utf8 \ vbell @@ -228,6 +241,7 @@ syn keyword screenCommands \ xon \ zmodem \ zombie + \ zombie_timeout hi def link screenEscape Special hi def link screenComment Comment diff --git a/runtime/syntax/sd.vim b/runtime/syntax/sd.vim index 7fa0e04492..b497ba5eaa 100644 --- a/runtime/syntax/sd.vim +++ b/runtime/syntax/sd.vim @@ -5,9 +5,8 @@ " URL: http://netstudent.polito.it/vim_syntax/ " Last Change: 2012 Feb 03 by Thilo Six -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -51,29 +50,20 @@ syn keyword sdSpecial TRUE FALSE NULL syn keyword sdDelimiter STREAM STREAM_END syn match sdError /^search .\{257,}/ -if version >= 508 || !exists("did_config_syntax_inits") - if version < 508 - let did_config_syntax_inits = 1 - command! -nargs=+ HiLink hi link <args> - else - command! -nargs=+ HiLink hi def link <args> - endif - HiLink sdIP Number - HiLink sdHostname Type - HiLink sdEncoding Identifier - HiLink sdCoding Identifier - HiLink sdSource Identifier - HiLink sdComment Comment - HiLink sdIPError Error - HiLink sdError Error - HiLink sdStatement Statement - HiLink sdIPSpecial Special - HiLink sdSpecial Special - HiLink sdDelimiter Delimiter +hi def link sdIP Number +hi def link sdHostname Type +hi def link sdEncoding Identifier +hi def link sdCoding Identifier +hi def link sdSource Identifier +hi def link sdComment Comment +hi def link sdIPError Error +hi def link sdError Error +hi def link sdStatement Statement +hi def link sdIPSpecial Special +hi def link sdSpecial Special +hi def link sdDelimiter Delimiter - delcommand HiLink -endif let b:current_syntax = "sd" diff --git a/runtime/syntax/sdl.vim b/runtime/syntax/sdl.vim index b524b72266..7df38d1955 100644 --- a/runtime/syntax/sdl.vim +++ b/runtime/syntax/sdl.vim @@ -3,11 +3,8 @@ " Maintainer: Michael Piefel <entwurf@piefel.de> " Last Change: 2 May 2001 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -129,38 +126,27 @@ syn keyword sdlType STRING OBJECT IDENTIFIER NULL syn sync ccomment sdlComment " 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_sdl_syn_inits") - if version < 508 - let did_sdl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - command -nargs=+ Hi hi <args> - else - command -nargs=+ HiLink hi def link <args> - command -nargs=+ Hi hi def <args> - endif - - HiLink sdlException Label - HiLink sdlConditional sdlStatement - HiLink sdlVirtual sdlStatement - HiLink sdlExported sdlFlag - HiLink sdlCommentError sdlError - HiLink sdlOperator Operator - HiLink sdlStructure sdlType - Hi sdlStatement term=bold ctermfg=4 guifg=Blue - Hi sdlFlag term=bold ctermfg=4 guifg=Blue gui=italic - Hi sdlNewState term=italic ctermfg=2 guifg=Magenta gui=underline - Hi sdlInput term=bold guifg=Red - HiLink sdlType Type - HiLink sdlString String - HiLink sdlComment Comment - HiLink sdlSpecial Special - HiLink sdlError Error - - delcommand HiLink - delcommand Hi -endif +" Only when an item doesn't have highlighting yet +command -nargs=+ Hi hi def <args> + +hi def link sdlException Label +hi def link sdlConditional sdlStatement +hi def link sdlVirtual sdlStatement +hi def link sdlExported sdlFlag +hi def link sdlCommentError sdlError +hi def link sdlOperator Operator +hi def link sdlStructure sdlType +Hi sdlStatement term=bold ctermfg=4 guifg=Blue +Hi sdlFlag term=bold ctermfg=4 guifg=Blue gui=italic +Hi sdlNewState term=italic ctermfg=2 guifg=Magenta gui=underline +Hi sdlInput term=bold guifg=Red +hi def link sdlType Type +hi def link sdlString String +hi def link sdlComment Comment +hi def link sdlSpecial Special +hi def link sdlError Error + +delcommand Hi let b:current_syntax = "sdl" diff --git a/runtime/syntax/sed.vim b/runtime/syntax/sed.vim index 42ad6d8e62..63b39db81f 100644 --- a/runtime/syntax/sed.vim +++ b/runtime/syntax/sed.vim @@ -4,11 +4,8 @@ " URL: http://folk.uio.no/hakonrk/vim/syntax/sed.vim " Last Change: 2010 May 29 -" 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 @@ -75,45 +72,36 @@ syn region sedReplacement64 matchgroup=Special start=+@\(\\\\\|\\@\)*+ skip=+[^\ " (y) does not allow any flags. To save memory, I ignore this problem. syn match sedST "[sy]" nextgroup=sedRegexp\d\+ -if version >= 508 || !exists("did_sed_syntax_inits") - if version < 508 - let did_sed_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink sedAddress Macro - HiLink sedACI NONE - HiLink sedBranch Label - HiLink sedComment Comment - HiLink sedDelete Function - HiLink sedError Error - HiLink sedFlag Type - HiLink sedFlagwrite Constant - HiLink sedFunction Function - HiLink sedLabel Label - HiLink sedLineCont Special - HiLink sedPutHoldspc Function - HiLink sedReplaceMeta Special - HiLink sedRegexpMeta Special - HiLink sedRW Constant - HiLink sedSemicolon Special - HiLink sedST Function - HiLink sedSpecial Special - HiLink sedWhitespace NONE - if exists("highlight_sedtabs") - HiLink sedTab Todo - endif - let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64 - while __sed_i <= __sed_last - exe "HiLink sedRegexp".__sed_i "Macro" - exe "HiLink sedReplacement".__sed_i "NONE" - let __sed_i = __sed_i + 1 - endwhile - - delcommand HiLink +hi def link sedAddress Macro +hi def link sedACI NONE +hi def link sedBranch Label +hi def link sedComment Comment +hi def link sedDelete Function +hi def link sedError Error +hi def link sedFlag Type +hi def link sedFlagwrite Constant +hi def link sedFunction Function +hi def link sedLabel Label +hi def link sedLineCont Special +hi def link sedPutHoldspc Function +hi def link sedReplaceMeta Special +hi def link sedRegexpMeta Special +hi def link sedRW Constant +hi def link sedSemicolon Special +hi def link sedST Function +hi def link sedSpecial Special +hi def link sedWhitespace NONE +if exists("highlight_sedtabs") +hi def link sedTab Todo endif +let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64 +while __sed_i <= __sed_last +exe "hi def link sedRegexp".__sed_i "Macro" +exe "hi def link sedReplacement".__sed_i "NONE" +let __sed_i = __sed_i + 1 +endwhile + unlet __sed_i __sed_last __sed_delimiter __sed_metacharacters diff --git a/runtime/syntax/sendpr.vim b/runtime/syntax/sendpr.vim index 6cf9395fe9..2e07802047 100644 --- a/runtime/syntax/sendpr.vim +++ b/runtime/syntax/sendpr.vim @@ -5,11 +5,8 @@ " " http://raisdorf.net/files/misc/send-pr.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/sensors.vim b/runtime/syntax/sensors.vim index 63cececc68..f8bc4c696b 100644 --- a/runtime/syntax/sensors.vim +++ b/runtime/syntax/sensors.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sensors.conf(5) - libsensors configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: sensors.conf(5) - libsensors configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/services.vim b/runtime/syntax/services.vim index 661f57a7e8..94e39ae219 100644 --- a/runtime/syntax/services.vim +++ b/runtime/syntax/services.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: services(5) - Internet network services list -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: services(5) - Internet network services list +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/setserial.vim b/runtime/syntax/setserial.vim index cdd309d7f2..967fa5f6d2 100644 --- a/runtime/syntax/setserial.vim +++ b/runtime/syntax/setserial.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: setserial(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: setserial(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/sgml.vim b/runtime/syntax/sgml.vim index c0c3643dd2..d60040c5d9 100644 --- a/runtime/syntax/sgml.vim +++ b/runtime/syntax/sgml.vim @@ -5,11 +5,8 @@ " Filenames: *.sgml,*.sgm " $Id: sgml.vim,v 1.1 2004/06/13 17:52:57 vimboss Exp $ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/sgmldecl.vim b/runtime/syntax/sgmldecl.vim index 13551b21c1..6c1cde15ae 100644 --- a/runtime/syntax/sgmldecl.vim +++ b/runtime/syntax/sgmldecl.vim @@ -5,11 +5,8 @@ " You can modify and maintain this file, in other case send comments " the maintainer email address. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo @@ -52,30 +49,20 @@ syn sync lines=250 " 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_sgmldecl_syntax_init") - if version < 508 - let did_sgmldecl_syntax_init = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sgmldeclDeclKeys Keyword - HiLink sgmldeclTypes Type - HiLink sgmldeclConst Constant - HiLink sgmldeclNConst Constant - HiLink sgmldeclString String - HiLink sgmldeclDeclBlock Normal - HiLink sgmldeclBool Boolean - HiLink sgmldeclSpecial Special - HiLink sgmldeclComment Comment - HiLink sgmldeclStatem Statement - HiLink sgmldeclVariables Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link sgmldeclDeclKeys Keyword +hi def link sgmldeclTypes Type +hi def link sgmldeclConst Constant +hi def link sgmldeclNConst Constant +hi def link sgmldeclString String +hi def link sgmldeclDeclBlock Normal +hi def link sgmldeclBool Boolean +hi def link sgmldeclSpecial Special +hi def link sgmldeclComment Comment +hi def link sgmldeclStatem Statement +hi def link sgmldeclVariables Type + let b:current_syntax = "sgmldecl" diff --git a/runtime/syntax/sgmllnx.vim b/runtime/syntax/sgmllnx.vim index 28224f601e..ccd78f494a 100644 --- a/runtime/syntax/sgmllnx.vim +++ b/runtime/syntax/sgmllnx.vim @@ -3,11 +3,8 @@ " Maintainer: SungHyun Nam <goweol@gmail.com> " Last Change: 2013 May 13 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -36,31 +33,21 @@ syn region sgmllnxComment start=+<!--+ end=+-->+ syn region sgmllnxDocType start=+<!doctype+ end=+>+ " 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_sgmllnx_syn_inits") - if version < 508 - let did_sgmllnx_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link sgmllnxTag2 Function +hi def link sgmllnxTagN2 Function +hi def link sgmllnxTag Special +hi def link sgmllnxEndTag Special +hi def link sgmllnxParen Special +hi def link sgmllnxEntity Type +hi def link sgmllnxDocEnt Type +hi def link sgmllnxTagName Statement +hi def link sgmllnxComment Comment +hi def link sgmllnxSpecial Special +hi def link sgmllnxDocType PreProc +hi def link sgmllnxTagError Error - HiLink sgmllnxTag2 Function - HiLink sgmllnxTagN2 Function - HiLink sgmllnxTag Special - HiLink sgmllnxEndTag Special - HiLink sgmllnxParen Special - HiLink sgmllnxEntity Type - HiLink sgmllnxDocEnt Type - HiLink sgmllnxTagName Statement - HiLink sgmllnxComment Comment - HiLink sgmllnxSpecial Special - HiLink sgmllnxDocType PreProc - HiLink sgmllnxTagError Error - - delcommand HiLink -endif let b:current_syntax = "sgmllnx" diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 5ca5bc641a..a8258d725f 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,46 +2,38 @@ " 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: Mar 20, 2014 -" Version: 132 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax -" For options and settings, please use: :help ft-sh-syntax -" This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) - -" For version 5.x: Clear all syntax items {{{1 -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Last Change: Mar 19, 2018 +" Version: 174 +" 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) + +" quit when a syntax file was already loaded {{{1 +if exists("b:current_syntax") finish endif -" AFAICT "." should be considered part of the iskeyword. Using iskeywords in -" syntax is dicey, so the following code permits the user to -" g:sh_isk set to a string : specify iskeyword. -" g:sh_noisk exists : don't change iskeyword -" g:sh_noisk does not exist : (default) append "." to iskeyword -if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword - exe "setl isk=".g:sh_isk -elseif !exists("g:sh_noisk") " optionally prevent appending '.' to iskeyword - setl isk+=. -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 @@ -73,6 +65,7 @@ if !exists("b:is_kornshell") && !exists("b:is_bash") endif " set up default g:sh_fold_enabled {{{1 +" ================================ if !exists("g:sh_fold_enabled") let g:sh_fold_enabled= 0 elseif g:sh_fold_enabled != 0 && !has("folding") @@ -95,29 +88,55 @@ if g:sh_fold_enabled && &fdm == "manual" setl fdm=syntax endif +" set up the syntax-highlighting 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 +" ================================= +if s:sh_fold_functions + com! -nargs=* ShFoldFunctions <args> fold +else + com! -nargs=* ShFoldFunctions <args> +endif +if s:sh_fold_heredoc + com! -nargs=* ShFoldHereDoc <args> fold +else + com! -nargs=* ShFoldHereDoc <args> +endif +if s:sh_fold_ifdofor + com! -nargs=* ShFoldIfDoFor <args> fold +else + com! -nargs=* ShFoldIfDoFor <args> +endif + " sh syntax is case sensitive {{{1 syn case match " Clusters: contains=@... clusters {{{1 "================================== syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK -if exists("b:is_kornshell") +if exists("b:is_kornshell") || exists("b:is_bash") syn cluster ErrorList add=shDTestError endif -syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement +syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange -syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq -"syn cluster shColonList contains=@shCaseList -syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOption,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial,shCmdParenRegion +syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq +syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial -syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS -syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError +syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS +syn cluster shDerefVarList contains=shDerefOff,shDerefOp,shDerefVarArray,shDerefOpError syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest -syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq +syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq if exists("b:is_kornshell") || exists("b:is_bash") syn cluster shFunctionList add=shRepeat syn cluster shFunctionList add=shDblBrace,shDblParen @@ -125,11 +144,14 @@ endif syn cluster shHereBeginList contains=@shCommandSubList syn cluster shHereList contains=shBeginHere,shHerePayload 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 shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shHereString,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo -syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet,shOption -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,shComment,shCommandSub,shDeref,shDerefSimple,shExDoubleQuote,shDoubleQuote,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq +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,shHereString,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 +syn cluster shNoZSList contains=shSpecialNoZS + " Echo: {{{1 " ==== " This one is needed INSIDE a CommandSub, so that `echo bla` be correct @@ -142,32 +164,37 @@ syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" ski " Alias: {{{1 " ===== -if exists("b:is_kornshell") || exists("b:is_bash") +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn match shStatement "\<alias\>" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="=" + + " Touch: {{{1 + " ===== + syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shComment contains=shTouchCmd,shDoubleQuote,shSingleQuote,shDeref,shDerefSimple + syn match shTouchCmd '\<touch\>' contained endif " Error Codes: {{{1 " ============ if !exists("g:sh_no_error") - syn match shDoError "\<done\>" - syn match shIfError "\<fi\>" - syn match shInError "\<in\>" - syn match shCaseError ";;" - syn match shEsacError "\<esac\>" - syn match shCurlyError "}" - syn match shParenError ")" - syn match shOK '\.\(done\|fi\|in\|esac\)' - if exists("b:is_kornshell") - syn match shDTestError "]]" + syn match shDoError "\<done\>" + syn match shIfError "\<fi\>" + syn match shInError "\<in\>" + syn match shCaseError ";;" + syn match shEsacError "\<esac\>" + syn match shCurlyError "}" + syn match shParenError ")" + syn match shOK '\.\(done\|fi\|in\|esac\)' + if exists("b:is_kornshell") || exists("b:is_bash") + syn match shDTestError "]]" endif - syn match shTestError "]" + syn match shTestError "]" endif " Options: {{{1 " ==================== -syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+" +syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+" syn match shOption "\s\zs--[^ \t$`'"|);]\+" " File Redirection Highlighted As Operators: {{{1 @@ -182,27 +209,29 @@ syn match shRedir "\d<<-\=" syn match shOperator "<<\|>>" contained syn match shOperator "[!&;|]" contained syn match shOperator "\[[[^:]\|\]]" contained -syn match shOperator "!\==" skipwhite nextgroup=shPattern +syn match shOperator "[-=/*+%]\==" skipwhite nextgroup=shPattern syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shDeref " Subshells: {{{1 " ========== -syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shMoreSpecial -syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shMoreSpecial +syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shSpecialNxt +syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shSpecialNxt " Tests: {{{1 "======= 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 match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" -syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern +syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' end="\ze['"]" contained contains=shDerefSimple,shDeref +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 match shTestDoubleQuote contained '\%(\%(\\\\\)*\\\)\@<!"[^"]*"' -syn match shTestSingleQuote contained '\\.' +syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' contains=shDeref,shDerefSimple,shDerefSpecial +syn match shTestSingleQuote contained '\\.' nextgroup=shTestSingleQuote syn match shTestSingleQuote contained "'[^']*'" if exists("b:is_kornshell") || exists("b:is_bash") - syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList - syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList + 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 " Character Class In Range: {{{1 @@ -211,22 +240,19 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum " Loops: do, if, while, until {{{1 " ====== -if s:sh_fold_ifdofor - syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn -else - syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn - syn match shForPP '\<for\>\ze\_s*((' -endif -if exists("b:is_kornshell") || exists("b:is_bash") +ShFoldIfDoFor syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList +ShFoldIfDoFor syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList +ShFoldIfDoFor syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn +ShFoldIfDoFor syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr + +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn cluster shCaseList add=shRepeat syn cluster shFunctionList add=shRepeat - syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace - syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace - syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList + syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace + syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace + if !exists("b:is_posix") + syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList + endif else syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList @@ -238,13 +264,13 @@ syn match shComma contained "," " ==== syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar -if s:sh_fold_ifdofor - syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment - syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList +if exists("b:is_bash") + ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end=";;&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment else - syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment - syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList + ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment endif +ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList + syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote if exists("b:is_bash") syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained @@ -263,7 +289,7 @@ endif " Misc: {{{1 "====== syn match shWrapLineOperator "\\$" -syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList +syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' " $() and $(()): {{{1 @@ -272,7 +298,7 @@ syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' " (ie. Posix compliant shell). /bin/ksh should work for those " systems too, however, so the following syntax will flag $(..) as " an Error under /bin/sh. By consensus of vimdev'ers! -if exists("b:is_kornshell") || exists("b:is_bash") +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList @@ -280,22 +306,22 @@ if exists("b:is_kornshell") || exists("b:is_bash") elseif !exists("g:sh_no_error") syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList endif -syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList +syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList if exists("b:is_bash") syn cluster shCommandSubList add=bashSpecialVariables,bashStatement syn cluster shCaseList add=bashAdminStatement,bashStatement syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID - syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch + syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop syn keyword bashStatement command compgen endif -if exists("b:is_kornshell") +if exists("b:is_kornshell") || exists("b:is_posix") syn cluster shCommandSubList add=kshSpecialVariables,kshStatement syn cluster shCaseList add=kshStatement syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL - syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput + syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail tput syn keyword kshStatement command setgroups setsenv endif @@ -303,35 +329,44 @@ 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") || exists("b:is_posix") + syn match shColon '^\s*\zs:' +endif " String And Character Constants: {{{1 "================================ -syn match shNumber "-\=\<\d\+\>#\=" -syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained -if exists("b:is_bash") - syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained -endif +syn match shNumber "\<\d\+\>#\=" +syn match shNumber "\<-\=\.\=\d\+\>#\=" +syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained if exists("b:is_bash") - syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial - syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial + syn match shSpecial "[^\\]\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained + syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained + syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt + syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial nextgroup=shSpecialNxt elseif !exists("g:sh_no_error") syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial endif -syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell -syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell -syn match shStringSpecial "[^[:print:] \t]" contained -syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" -"syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment -syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial -syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment -syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shMoreSpecial +syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart +syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart +syn match shStringSpecial "[^[:print:] \t]" contained +syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shBkslshSnglQuote,shBkslshDblQuote,@shNoZSList +syn match shSpecialStart "\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,shBkslshDblQuote,@shNoZSList +syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecialNoZS contained "\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecialNxt contained "\\[\\"'`$()#]" +syn region shBkslshSnglQuote contained matchgroup=shQuote start=+'+ end=+'+ contains=@Spell +syn region shBkslshDblQuote contained matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell " Comments: {{{1 "========== syn cluster shCommentGroup contains=shTodo,@Spell -syn keyword shTodo contained COMBAK FIXME TODO XXX +if exists("b:is_bash") + syn match shTodo contained "\<\%(COMBAK\|FIXME\|TODO\|XXX\)\ze:\=\>" +else + syn keyword shTodo contained COMBAK FIXME TODO XXX +endif syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup syn match shComment "\s\zs#.*$" contains=@shCommentGroup syn match shComment contained "#.*$" contains=@shCommentGroup @@ -339,62 +374,39 @@ syn match shQuickComment contained "#.*$" " Here Documents: {{{1 " ========================================= -if version < 600 - syn region shHereDoc matchgroup=shRedir01 start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir01 end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir02 start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir02 end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir03 start="<<\s*\**EOF\**" matchgroup=shRedir03 end="^EOF$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir04 start="<<-\s*\**EOF\**" matchgroup=shRedir04 end="^\s*EOF$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir05 start="<<\s*\**\.\**" matchgroup=shRedir05 end="^\.$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir06 start="<<-\s*\**\.\**" matchgroup=shRedir06 end="^\s*\.$" contains=@shDblQuoteList - -elseif s:sh_fold_heredoc - syn region shHereDoc matchgroup=shRedir07 fold start="<<\s*\z([^ \t|]*\)" matchgroup=shRedir07 end="^\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir08 fold start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir08 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir09 fold start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir09 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir10 fold start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir10 end="^\s*\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir11 fold start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir11 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir12 fold start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir12 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir13 fold start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir13 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir14 fold start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir14 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir15 fold start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir15 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir16 fold start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir16 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir17 fold start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir17 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir18 fold start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir18 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir19 fold start="<<\\\z([^ \t|]*\)" matchgroup=shRedir19 end="^\z1\s*$" - -else - syn region shHereDoc matchgroup=shRedir20 start="<<\s*\\\=\z([^ \t|]*\)" matchgroup=shRedir20 end="^\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir21 start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir21 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir22 start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir22 end="^\s*\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shRedir23 start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir23 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir24 start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir24 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir25 start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir25 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir26 start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir26 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir27 start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir27 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir28 start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir28 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir29 start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir29 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir30 start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir30 end="^\z1\s*$" - syn region shHereDoc matchgroup=shRedir31 start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir31 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shRedir32 start="<<\\\z([^ \t|]*\)" matchgroup=shRedir32 end="^\z1\s*$" -endif +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^'0-9]\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^'0-9]\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" " Here Strings: {{{1 " ============= " available for: bash; ksh (really should be ksh93 only) but not if its a posix -if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix")) - syn match shRedir "<<<" skipwhite nextgroup=shCmdParenRegion +if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("b:is_posix")) + syn match shHereString "<<<" skipwhite nextgroup=shCmdParenRegion endif " Identifiers: {{{1 "============= syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained -syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier -syn match shSetIdentifier "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote +syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shVarAssign +syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote syn region shAtExpr contained start="@(" end=")" contains=@shIdList if exists("b:is_bash") syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList -elseif exists("b:is_kornshell") +elseif exists("b:is_kornshell") || exists("b:is_posix") syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList else @@ -402,100 +414,114 @@ else endif " Functions: {{{1 -if !exists("g:is_posix") +if !exists("b:is_posix") syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo endif if exists("b:is_bash") - if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained - endif + 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 - if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained - endif + 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 " ======================== -syn match shDerefSimple "\$\%(\k\+\|\d\)" -syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray if !exists("g:sh_no_error") - syn match shDerefWordError "[^}$[]" contained + syn match shDerefWordError "[^}$[~]" contained +endif +syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList +syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray +syn match shDerefSimple "\$[-#*@!?]" nextgroup=@shNoZSList +syn match shDerefSimple "\$\$" nextgroup=@shNoZSList +syn match shDerefSimple "\${\d}" nextgroup=@shNoZSList +if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix") + syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS + syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS endif -syn match shDerefSimple "\$[-#*@!?]" -syn match shDerefSimple "\$\$" -if exists("b:is_bash") || exists("b:is_kornshell") - syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList - syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList + +" ksh: ${!var[*]} array index list syntax: {{{1 +" ======================================== +if exists("b:is_kornshell") || exists("b:is_posix") + syn region shDeref matchgroup=PreProc start="\${!" end="}" contains=@shDerefVarArray endif " bash: ${!prefix*} and ${#parameter}: {{{1 " ==================================== if exists("b:is_bash") - syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp - syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList + syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOff + syn match shDerefVar contained "{\@<=!\h\w*" nextgroup=@shDerefVarList +endif +if exists("b:is_kornshell") + syn match shDerefVar contained "{\@<=!\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList endif syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp -syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList +syn match shDerefVar contained "{\@<=\h\w*" nextgroup=@shDerefVarList +syn match shDerefVar contained '\d' nextgroup=@shDerefVarList +if exists("b:is_kornshell") || exists("b:is_posix") + syn match shDerefVar contained "{\@<=\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList +endif " sh ksh bash : ${var[... ]...} array reference: {{{1 -syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError +syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError " Special ${parameter OPERATOR word} handling: {{{1 -" sh ksh bash : ${parameter:-word} word is default value -" sh ksh bash : ${parameter:=word} assign word as default value -" sh ksh bash : ${parameter:?word} display word if parameter is null -" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing -" ksh bash : ${parameter#pattern} remove small left pattern -" ksh bash : ${parameter##pattern} remove large left pattern -" ksh bash : ${parameter%pattern} remove small right pattern -" ksh bash : ${parameter%%pattern} remove large right pattern -" bash : ${parameter^pattern} Case modification -" bash : ${parameter^^pattern} Case modification -" bash : ${parameter,pattern} Case modification -" bash : ${parameter,,pattern} Case modification +" sh ksh bash : ${parameter:-word} word is default value +" sh ksh bash : ${parameter:=word} assign word as default value +" sh ksh bash : ${parameter:?word} display word if parameter is null +" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing +" ksh bash : ${parameter#pattern} remove small left pattern +" ksh bash : ${parameter##pattern} remove large left pattern +" ksh bash : ${parameter%pattern} remove small right pattern +" ksh bash : ${parameter%%pattern} remove large right pattern +" bash : ${parameter^pattern} Case modification +" bash : ${parameter^^pattern} Case modification +" bash : ${parameter,pattern} Case modification +" bash : ${parameter,,pattern} Case modification syn cluster shDerefPatternList contains=shDerefPattern,shDerefString if !exists("g:sh_no_error") syn match shDerefOpError contained ":[[:punct:]]" endif syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList -if exists("b:is_bash") || exists("b:is_kornshell") - syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList - syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList - syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern +if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix") + syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList + syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList + syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern syn match shDerefEscape contained '\%(\\\\\)*\\.' endif if exists("b:is_bash") syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList endif -syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial +syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial syn match shDerefString contained "\\["']" nextgroup=shDerefPattern if exists("b:is_bash") " bash : ${parameter:offset} " bash : ${parameter:offset:length} - syn region shDerefOp contained start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL - syn match shDerefPOL contained ":[^}]\+" contains=@shCommandSubList + syn region shDerefOff contained start=':' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple + syn region shDerefOff contained start=':\s-' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple + syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple " bash : ${parameter//pattern/string} " 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 + syn region shDerefPSRleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright + syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' endif " Arithmetic Parenthesized Expressions: {{{1 @@ -512,9 +538,9 @@ endif " Useful ksh Keywords: {{{1 " ==================== -if exists("b:is_kornshell") || exists("b:is_bash") +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup printf r stop suspend times true type unalias whence - if exists("g:is_posix") + if exists("b:is_posix") syn keyword shStatement command else syn keyword shStatement time @@ -523,7 +549,7 @@ if exists("b:is_kornshell") || exists("b:is_bash") " Useful bash Keywords: {{{1 " ===================== if exists("b:is_bash") - syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source + syn keyword shStatement bind builtin dirs disown enable help logout popd pushd shopt source else syn keyword shStatement login newgrp endif @@ -531,13 +557,20 @@ endif " Synchronization: {{{1 " ================ -if !exists("sh_minlines") - let sh_minlines = 200 +if !exists("g:sh_minlines") + let s:sh_minlines = 200 +else + let s:sh_minlines= g:sh_minlines endif -if !exists("sh_maxlines") - let sh_maxlines = 2 * sh_minlines +if !exists("g:sh_maxlines") + let s:sh_maxlines = 2*s:sh_minlines + if s:sh_maxlines < 25 + let s:sh_maxlines= 25 + endif +else + let s:sh_maxlines= g:sh_maxlines endif -exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines +exec "syn sync minlines=" . s:sh_minlines . " maxlines=" . s:sh_maxlines syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>" syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>" syn sync match shDoSync grouphere shDo "\<do\>" @@ -551,147 +584,142 @@ syn sync match shWhileSync grouphere shRepeat "\<while\>" " Default Highlighting: {{{1 " ===================== -hi def link shArithRegion shShellVariables -hi def link shAtExpr shSetList -hi def link shBeginHere shRedir -hi def link shCaseBar shConditional -hi def link shCaseCommandSub shCommandSub -hi def link shCaseDoubleQuote shDoubleQuote -hi def link shCaseIn shConditional -hi def link shQuote shOperator -hi def link shCaseSingleQuote shSingleQuote -hi def link shCaseStart shConditional -hi def link shCmdSubRegion shShellVariables -hi def link shColon shComment -hi def link shDerefOp shOperator -hi def link shDerefPOL shDerefOp -hi def link shDerefPPS shDerefOp -hi def link shDeref shShellVariables -hi def link shDerefDelim shOperator -hi def link shDerefSimple shDeref -hi def link shDerefSpecial shDeref -hi def link shDerefString shDoubleQuote -hi def link shDerefVar shDeref -hi def link shDoubleQuote shString -hi def link shEcho shString -hi def link shEchoDelim shOperator -hi def link shEchoQuote shString -hi def link shForPP shLoop -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 -hi def link shMoreSpecial shSpecial -hi def link shOption shCommandSub -hi def link shPattern shString -hi def link shParen shArithmetic -hi def link shPosnParm shShellVariables -hi def link shQuickComment shComment -hi def link shRange shOperator -hi def link shRedir shOperator -hi def link shSetListDelim shOperator -hi def link shSetOption shOption -hi def link shSingleQuote shString -hi def link shSource shOperator -hi def link shStringSpecial shSpecial -hi def link shStringSpecial Unique -hi def link shSubShRegion shOperator -hi def link shTestOpr shConditional -hi def link shTestPattern shString -hi def link shTestDoubleQuote shString -hi def link shTestSingleQuote shString -hi def link shVariable shSetList -hi def link shWrapLineOperator shOperator +if !exists("skip_sh_syntax_inits") + 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 + hi def link shCaseCommandSub shCommandSub + hi def link shCaseDoubleQuote shDoubleQuote + hi def link shCaseIn shConditional + hi def link shQuote shOperator + hi def link shCaseSingleQuote shSingleQuote + hi def link shCaseStart shConditional + hi def link shCmdSubRegion shShellVariables + hi def link shColon shComment + hi def link shDerefOp shOperator + hi def link shDerefPOL shDerefOp + hi def link shDerefPPS shDerefOp + hi def link shDerefPSR shDerefOp + hi def link shDeref shShellVariables + hi def link shDerefDelim shOperator + hi def link shDerefSimple shDeref + hi def link shDerefSpecial shDeref + hi def link shDerefString shDoubleQuote + hi def link shDerefVar shDeref + hi def link shDoubleQuote shString + hi def link shEcho shString + hi def link shEchoDelim shOperator + hi def link shEchoQuote shString + hi def link shForPP shLoop + hi def link shFunction Function + hi def link shEmbeddedEcho shString + hi def link shEscape shCommandSub + hi def link shExDoubleQuote shDoubleQuote + hi def link shExSingleQuote shSingleQuote + hi def link shHereDoc shString + hi def link shHereString shRedir + hi def link shHerePayload shHereDoc + hi def link shLoop shStatement + hi def link shSpecialNxt shSpecial + hi def link shNoQuote shDoubleQuote + hi def link shOption shCommandSub + hi def link shPattern shString + hi def link shParen shArithmetic + hi def link shPosnParm shShellVariables + hi def link shQuickComment shComment + hi def link shRange shOperator + hi def link shRedir shOperator + hi def link shSetListDelim shOperator + hi def link shSetOption shOption + hi def link shSingleQuote shString + hi def link shSource shOperator + hi def link shStringSpecial shSpecial + hi def link shSpecialStart shSpecial + hi def link shSubShRegion shOperator + hi def link shTestOpr shConditional + hi def link shTestPattern shString + hi def link shTestDoubleQuote shString + hi def link shTestSingleQuote shString + hi def link shTouchCmd shStatement + hi def link shVariable shSetList + hi def link shWrapLineOperator shOperator -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("b:is_bash") + hi def link bashAdminStatement shStatement + hi def link bashSpecialVariables shShellVariables + hi def link bashStatement shStatement + hi def link shCharClass shSpecial + hi def link shDerefOff shDerefOp + hi def link shDerefLen shDerefOff + endif + if exists("b:is_kornshell") || exists("b:is_posix") + hi def link kshSpecialVariables shShellVariables + hi def link kshStatement shStatement + 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 - hi def link shEsacError Error - hi def link shIfError Error - hi def link shInError Error - hi def link shParenError Error - hi def link shTestError Error - if exists("b:is_kornshell") - hi def link shDTestError Error + if !exists("g:sh_no_error") + hi def link shCaseError Error + hi def link shCondError Error + hi def link shCurlyError Error + hi def link shDerefOpError Error + hi def link shDerefWordError Error + hi def link shDoError Error + hi def link shEsacError Error + hi def link shIfError Error + hi def link shInError Error + hi def link shParenError Error + hi def link shTestError Error + if exists("b:is_kornshell") || exists("b:is_posix") + hi def link shDTestError Error + endif endif -endif -hi def link shArithmetic Special -hi def link shCharClass Identifier -hi def link shSnglCase Statement -hi def link shCommandSub Special -hi def link shComment Comment -hi def link shConditional Conditional -hi def link shCtrlSeq Special -hi def link shExprRegion Delimiter -hi def link shFunctionKey Function -hi def link shFunctionName Function -hi def link shNumber Number -hi def link shOperator Operator -hi def link shRepeat Repeat -hi def link shSet Statement -hi def link shSetList Identifier -hi def link shShellVariables PreProc -hi def link shSpecial Special -hi def link shStatement Statement -hi def link shString String -hi def link shTodo Todo -hi def link shAlias Identifier -hi def link shRedir01 shRedir -hi def link shRedir02 shRedir -hi def link shRedir03 shRedir -hi def link shRedir04 shRedir -hi def link shRedir05 shRedir -hi def link shRedir06 shRedir -hi def link shRedir07 shRedir -hi def link shRedir08 shRedir -hi def link shRedir09 shRedir -hi def link shRedir10 shRedir -hi def link shRedir11 shRedir -hi def link shRedir12 shRedir -hi def link shRedir13 shRedir -hi def link shRedir14 shRedir -hi def link shRedir15 shRedir -hi def link shRedir16 shRedir -hi def link shRedir17 shRedir -hi def link shRedir18 shRedir -hi def link shRedir19 shRedir -hi def link shRedir20 shRedir -hi def link shRedir21 shRedir -hi def link shRedir22 shRedir -hi def link shRedir23 shRedir -hi def link shRedir24 shRedir -hi def link shRedir25 shRedir -hi def link shRedir26 shRedir -hi def link shRedir27 shRedir -hi def link shRedir28 shRedir -hi def link shRedir29 shRedir -hi def link shRedir30 shRedir -hi def link shRedir31 shRedir -hi def link shRedir32 shRedir + hi def link shArithmetic Special + hi def link shCharClass Identifier + hi def link shSnglCase Statement + hi def link shCommandSub Special + hi def link shComment Comment + hi def link shConditional Conditional + hi def link shCtrlSeq Special + hi def link shExprRegion Delimiter + hi def link shFunctionKey Function + hi def link shFunctionName Function + hi def link shNumber Number + hi def link shOperator Operator + hi def link shRepeat Repeat + hi def link shSet Statement + hi def link shSetList Identifier + hi def link shShellVariables PreProc + hi def link shSpecial Special + hi def link shSpecialNoZS shSpecial + hi def link shStatement Statement + hi def link shString String + hi def link shTodo Todo + hi def link shAlias Identifier + hi def link shHereDoc01 shRedir + hi def link shHereDoc02 shRedir + hi def link shHereDoc03 shRedir + hi def link shHereDoc04 shRedir + hi def link shHereDoc05 shRedir + hi def link shHereDoc06 shRedir + hi def link shHereDoc07 shRedir + hi def link shHereDoc08 shRedir + hi def link shHereDoc09 shRedir + hi def link shHereDoc10 shRedir + hi def link shHereDoc11 shRedir + hi def link shHereDoc12 shRedir + hi def link shHereDoc13 shRedir + hi def link shHereDoc14 shRedir + hi def link shHereDoc15 shRedir +endif + +" Delete shell folding commands {{{1 +" ============================= +delc ShFoldFunctions +delc ShFoldHereDoc +delc ShFoldIfDoFor " Set Current Syntax: {{{1 " =================== @@ -699,6 +727,8 @@ if exists("b:is_bash") let b:current_syntax = "bash" elseif exists("b:is_kornshell") let b:current_syntax = "ksh" +elseif exists("b:is_posix") + let b:current_syntax = "posix" else let b:current_syntax = "sh" endif diff --git a/runtime/syntax/sicad.vim b/runtime/syntax/sicad.vim index 7e32451bed..20eb14cba1 100644 --- a/runtime/syntax/sicad.vim +++ b/runtime/syntax/sicad.vim @@ -4,28 +4,17 @@ " Last Change: 2003 May 11 " URL: http://lmark.mgx.hu:81/download/vim/sicad.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " use SQL highlighting after 'sql' command -if version >= 600 - syn include @SQL syntax/sql.vim -else - syn include @SQL <sfile>:p:h/sql.vim -endif +syn include @SQL syntax/sql.vim unlet b:current_syntax " spaces are used in (auto)indents since sicad hates tabulator characters -if version >= 600 - setlocal expandtab -else - set expandtab -endif +setlocal expandtab " ignore case syn case ignore @@ -369,44 +358,32 @@ syn keyword sicadStatement zparbn zparf zparfn zparfw zparfwn syn keyword sicadStatement zparp zparpn zwinkp zwinkpn " 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_sicad_syntax_inits") - - if version < 508 - let did_sicad_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink sicadLabel PreProc - HiLink sicadLabel1 sicadLabel - HiLink sicadLabel2 sicadLabel - HiLink sicadConditional Conditional - HiLink sicadBoolean Boolean - HiLink sicadNumber Number - HiLink sicadFloat Float - HiLink sicadOperator Operator - HiLink sicadStatement Statement - HiLink sicadParameter sicadStatement - HiLink sicadGoto sicadStatement - HiLink sicadLineCont sicadStatement - HiLink sicadString String - HiLink sicadComment Comment - HiLink sicadSpecial Special - HiLink sicadIdentifier Type -" HiLink sicadIdentifier Identifier - HiLink sicadError Error - HiLink sicadParenError sicadError - HiLink sicadApostropheError sicadError - HiLink sicadStringError sicadError - HiLink sicadCommentError sicadError -" HiLink sqlStatement Special " modified highlight group in sql.vim +hi def link sicadLabel PreProc +hi def link sicadLabel1 sicadLabel +hi def link sicadLabel2 sicadLabel +hi def link sicadConditional Conditional +hi def link sicadBoolean Boolean +hi def link sicadNumber Number +hi def link sicadFloat Float +hi def link sicadOperator Operator +hi def link sicadStatement Statement +hi def link sicadParameter sicadStatement +hi def link sicadGoto sicadStatement +hi def link sicadLineCont sicadStatement +hi def link sicadString String +hi def link sicadComment Comment +hi def link sicadSpecial Special +hi def link sicadIdentifier Type +" hi def link sicadIdentifier Identifier +hi def link sicadError Error +hi def link sicadParenError sicadError +hi def link sicadApostropheError sicadError +hi def link sicadStringError sicadError +hi def link sicadCommentError sicadError +" hi def link sqlStatement Special " modified highlight group in sql.vim - delcommand HiLink - -endif let b:current_syntax = "sicad" diff --git a/runtime/syntax/sieve.vim b/runtime/syntax/sieve.vim index 4bb4417f39..35b4dfb79c 100644 --- a/runtime/syntax/sieve.vim +++ b/runtime/syntax/sieve.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Sieve filtering language input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-10-25 +" Language: Sieve filtering language input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-10-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/simula.vim b/runtime/syntax/simula.vim index e952ee26c3..82f66d049e 100644 --- a/runtime/syntax/simula.vim +++ b/runtime/syntax/simula.vim @@ -4,11 +4,8 @@ " URL: http://folk.uio.no/hakonrk/vim/syntax/simula.vim " Last Change: 2001 May 15 -" 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 @@ -58,42 +55,33 @@ syn match simulaReal "-\=\<\d\+\(\.\d\+\)\=\(&&\=[+-]\=\d\+\)\=\>" " Real starting with a `.', optional exponent syn match simulaReal "-\=\.\d\+\(&&\=[+-]\=\d\+\)\=\>" -if version >= 508 || !exists("did_simula_syntax_inits") - if version < 508 - let did_simula_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink simulaAssigned Identifier - HiLink simulaBoolean Boolean - HiLink simulaCharacter Character - HiLink simulaCharError Error - HiLink simulaComment Comment - HiLink simulaCompound Statement - HiLink simulaConditional Conditional - HiLink simulaConstant Constant - HiLink simulaFunction Function - HiLink simulaNumber Number - HiLink simulaOperator Operator - HiLink simulaReal Float - HiLink simulaReferenceType Type - HiLink simulaRepeat Repeat - HiLink simulaReserved Error - HiLink simulaSemicolon Statement - HiLink simulaSpecial Special - HiLink simulaSpecialChar SpecialChar - HiLink simulaSpecialCharErr Error - HiLink simulaStatement Statement - HiLink simulaStorageClass StorageClass - HiLink simulaString String - HiLink simulaStructure Structure - HiLink simulaTodo Todo - HiLink simulaType Type +hi def link simulaAssigned Identifier +hi def link simulaBoolean Boolean +hi def link simulaCharacter Character +hi def link simulaCharError Error +hi def link simulaComment Comment +hi def link simulaCompound Statement +hi def link simulaConditional Conditional +hi def link simulaConstant Constant +hi def link simulaFunction Function +hi def link simulaNumber Number +hi def link simulaOperator Operator +hi def link simulaReal Float +hi def link simulaReferenceType Type +hi def link simulaRepeat Repeat +hi def link simulaReserved Error +hi def link simulaSemicolon Statement +hi def link simulaSpecial Special +hi def link simulaSpecialChar SpecialChar +hi def link simulaSpecialCharErr Error +hi def link simulaStatement Statement +hi def link simulaStorageClass StorageClass +hi def link simulaString String +hi def link simulaStructure Structure +hi def link simulaTodo Todo +hi def link simulaType Type - delcommand HiLink -endif let b:current_syntax = "simula" " vim: sts=4 sw=4 ts=8 diff --git a/runtime/syntax/sinda.vim b/runtime/syntax/sinda.vim index 2bde267c2f..a6e5b45fcd 100644 --- a/runtime/syntax/sinda.vim +++ b/runtime/syntax/sinda.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -32,11 +29,7 @@ syn case ignore let fortran_free_source=1 " Load FORTRAN syntax file -if version < 600 - source <sfile>:p:h/fortran.vim -else - runtime! syntax/fortran.vim -endif +runtime! syntax/fortran.vim unlet b:current_syntax @@ -106,39 +99,29 @@ endif " 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_sinda_syntax_inits") - if version < 508 - let did_sinda_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sindaMacro Macro - HiLink sindaOptions Special - HiLink sindaRoutine Type - HiLink sindaControl Special - HiLink sindaSubRoutine Function - HiLink sindaIdentifier Identifier - - HiLink sindaFortran PreProc - HiLink sindaMotran PreProc - - HiLink sindaComment Comment - HiLink sindaHeader Typedef - HiLink sindaIncludeFile Type - HiLink sindaInteger Number - HiLink sindaFloat Float - HiLink sindaScientific Float - - HiLink sindaEndData Macro - - HiLink sindaTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link sindaMacro Macro +hi def link sindaOptions Special +hi def link sindaRoutine Type +hi def link sindaControl Special +hi def link sindaSubRoutine Function +hi def link sindaIdentifier Identifier + +hi def link sindaFortran PreProc +hi def link sindaMotran PreProc + +hi def link sindaComment Comment +hi def link sindaHeader Typedef +hi def link sindaIncludeFile Type +hi def link sindaInteger Number +hi def link sindaFloat Float +hi def link sindaScientific Float + +hi def link sindaEndData Macro + +hi def link sindaTodo Todo + let b:current_syntax = "sinda" diff --git a/runtime/syntax/sindacmp.vim b/runtime/syntax/sindacmp.vim index 87b483409a..88373eb285 100644 --- a/runtime/syntax/sindacmp.vim +++ b/runtime/syntax/sindacmp.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -45,28 +42,18 @@ syn match sindacmpFloat "-\=\<[0-9]*\.[0-9]*" " 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_sindacmp_syntax_inits") - if version < 508 - let did_sindacmp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink sindacmpTitle Type - HiLink sindacmpUnit PreProc +hi def link sindacmpTitle Type +hi def link sindacmpUnit PreProc - HiLink sindacmpLabel Statement +hi def link sindacmpLabel Statement - HiLink sindacmpHeader sindaHeader +hi def link sindacmpHeader sindaHeader - HiLink sindacmpInteger Number - HiLink sindacmpFloat Special +hi def link sindacmpInteger Number +hi def link sindacmpFloat Special - delcommand HiLink -endif let b:current_syntax = "sindacmp" diff --git a/runtime/syntax/sindaout.vim b/runtime/syntax/sindaout.vim index b557e017eb..c362f19467 100644 --- a/runtime/syntax/sindaout.vim +++ b/runtime/syntax/sindaout.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -24,11 +21,7 @@ syn case match " Load SINDA syntax file -if version < 600 - source <sfile>:p:h/sinda.vim -else - runtime! syntax/sinda.vim -endif +runtime! syntax/sinda.vim unlet b:current_syntax @@ -66,33 +59,23 @@ syn match sindaoutError "<<< Error >>>" " 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_sindaout_syntax_inits") - if version < 508 - let did_sindaout_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - hi sindaHeaderDelim ctermfg=Black ctermbg=Green guifg=Black guibg=Green - - HiLink sindaoutPos Statement - HiLink sindaoutNeg PreProc - HiLink sindaoutTitle Type - HiLink sindaoutFile sindaIncludeFile - HiLink sindaoutInteger sindaInteger - - HiLink sindaoutSectionDelim Delimiter - HiLink sindaoutSectionTitle Exception - HiLink sindaoutHeaderDelim SpecialComment - HiLink sindaoutLabel Identifier - - HiLink sindaoutError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi sindaHeaderDelim ctermfg=Black ctermbg=Green guifg=Black guibg=Green + +hi def link sindaoutPos Statement +hi def link sindaoutNeg PreProc +hi def link sindaoutTitle Type +hi def link sindaoutFile sindaIncludeFile +hi def link sindaoutInteger sindaInteger + +hi def link sindaoutSectionDelim Delimiter +hi def link sindaoutSectionTitle Exception +hi def link sindaoutHeaderDelim SpecialComment +hi def link sindaoutLabel Identifier + +hi def link sindaoutError Error + let b:current_syntax = "sindaout" diff --git a/runtime/syntax/sisu.vim b/runtime/syntax/sisu.vim index 23d73254eb..83d2a17245 100644 --- a/runtime/syntax/sisu.vim +++ b/runtime/syntax/sisu.vim @@ -1,15 +1,14 @@ " SiSU Vim syntax file -" SiSU Maintainer: Ralph Amissah <ralph@amissah.com> -" SiSU Markup: SiSU (sisu-4.0.9) -" Last Change: 2013-02-22 -" URL (sisu-4.1.0): <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD> +" SiSU Maintainer: Ralph Amissah <ralph.amissah@gmail.com> +" SiSU Markup: SiSU (sisu-5.6.7) +" Last Change: 2014-09-14 +" URL: <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD> +" <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob_plain;f=data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD> "(originally looked at Ruby Vim by Mirko Nasato) -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish -else endif let s:cpo_save = &cpo set cpo&vim @@ -23,15 +22,14 @@ if !exists("sisu_no_identifiers") syn match sisu_break contains=@NoSpell " \\\\\( \|$\)\|<br>\|<br />" syn match sisu_control contains=@NoSpell "^\(-\\\\-\|=\\\\=\|-\.\.-\|<:p[bn]>\)\s*$" syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$" + syn match sisu_marktail contains=@NoSpell "^--[+~-]#\s*$" syn match sisu_marktail "[~-]#" syn match sisu_control "\"" syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)" syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}" syn match sisu_link contains=@NoSpell "\(_\?https\?://\|\.\.\/\)\S\+" syn match sisu_link " \*\~\S\+" - syn match sisu_action "^<:insert\d\+>" - syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$" - syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$" + syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^./_-]\+\.ss[it]$" syn match sisu_structure "^:A\~$" "% "Document Sub Headers: @@ -44,6 +42,8 @@ if !exists("sisu_no_identifiers") syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s" syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|substitute\|omit\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|stamp\|promo\|ad\|manpage\|home_button_text\|home_button_image\|cover_image\|footer\):\s" syn match sisu_sub_header_notes "^\s\+:\(description\|abstract\|comment\|coverage\|relation\|source\|history\|type\|format\|prefix\|prefix_[ab]\|suffix\):\s" + syn match sisu_within_index_ignore "\S\+[:;]\(\s\+\|$\)" + syn match sisu_within_index "[:|;]\|+\d\+" "% "semantic markers: (ignore) syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]" @@ -93,17 +93,25 @@ syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_ syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" "% "Headings: -syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$" +syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-4]\|:\?[A-D]\)\~\(\S\+\|[^-]\)" end="$" "% "Block Group Text: " table syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table" " table +syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+table" end="^```\(\s\|$\)" syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$" " block, group, poem, alt -syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\1" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\(block\|group\|poem\|alt\)" end="^```\(\s\|$\)" +" box +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^box\(\.[a-z]\+\)\?{" end="^}box" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\box\(\.[a-z]\+\)\?" end="^```\(\s\|$\)" " code -syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code" +syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^code\(\.[a-z][0-9a-z_]\+\)\?{" end="^}code" +syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^```\s\+code\(\.[a-z][0-9a-z_]\+\)\?" end="^```\(\s\|$\)" +" quote +syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_contain start="^```\s\+quote" end="^```\(\s\|$\)" "% "Endnotes: " regular endnote or asterisk or plus sign endnote @@ -138,7 +146,7 @@ syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endn "% "Font Face Curly Brackets: "syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline " book index: -syn region sisu_index matchgroup=sisu_index_block start="^={" end="}" +syn region sisu_index contains=sisu_within_index_ignore,sisu_within_index matchgroup=sisu_index_block start="^={" end="}" " emphasis: syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*" " bold: @@ -246,6 +254,8 @@ hi def link sisu_index SpecialKey hi def link sisu_index_block Visual hi def link sisu_content_endnote Special hi def link sisu_control Delimiter +hi def link sisu_within_index Delimiter +hi def link sisu_within_index_ignore SpecialKey hi def link sisu_ocn Include hi def link sisu_number Number hi def link sisu_identifier Function diff --git a/runtime/syntax/skill.vim b/runtime/syntax/skill.vim index 8b960441f6..47afffc0a9 100644 --- a/runtime/syntax/skill.vim +++ b/runtime/syntax/skill.vim @@ -9,11 +9,8 @@ " database. This file also defines syntax highlighting for " certain Design Framework II interface functions. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -525,37 +522,27 @@ syn match skillCommentError "\*/" syn sync ccomment skillComment minlines=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_skill_syntax_inits") - if version < 508 - let did_skill_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink skillcdfFunctions Function - HiLink skillgeFunctions Function - HiLink skillhiFunctions Function - HiLink skillleFunctions Function - HiLink skilldbefFunctions Function - HiLink skillddFunctions Function - HiLink skillpcFunctions Function - HiLink skilltechFunctions Function - HiLink skillConstants Constant - HiLink skillFunction Function - HiLink skillKeywords Statement - HiLink skillConditional Conditional - HiLink skillRepeat Repeat - HiLink skillString String - HiLink skillTodo Todo - HiLink skillNote Todo - HiLink skillComment Comment - HiLink skillCommentError Error +hi def link skillcdfFunctions Function +hi def link skillgeFunctions Function +hi def link skillhiFunctions Function +hi def link skillleFunctions Function +hi def link skilldbefFunctions Function +hi def link skillddFunctions Function +hi def link skillpcFunctions Function +hi def link skilltechFunctions Function +hi def link skillConstants Constant +hi def link skillFunction Function +hi def link skillKeywords Statement +hi def link skillConditional Conditional +hi def link skillRepeat Repeat +hi def link skillString String +hi def link skillTodo Todo +hi def link skillNote Todo +hi def link skillComment Comment +hi def link skillCommentError Error - delcommand HiLink -endif let b:current_syntax = "skill" diff --git a/runtime/syntax/sl.vim b/runtime/syntax/sl.vim index fa3bca06dd..1f6c847353 100644 --- a/runtime/syntax/sl.vim +++ b/runtime/syntax/sl.vim @@ -3,11 +3,8 @@ " Maintainer: Dan Piponi <dan@tanelorn.demon.co.uk> " Last Change: 2001 May 09 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -75,45 +72,35 @@ syn keyword slVariable dtime dPdtime syn sync ccomment slComment minlines=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_sl_syntax_inits") - if version < 508 - let did_sl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink slLabel Label - HiLink slUserLabel Label - HiLink slConditional Conditional - HiLink slRepeat Repeat - HiLink slCharacter Character - HiLink slSpecialCharacter slSpecial - HiLink slNumber Number - HiLink slFloat Float - HiLink slParenError slError - HiLink slInParen slError - HiLink slCommentError slError - HiLink slOperator Operator - HiLink slStorageClass StorageClass - HiLink slError Error - HiLink slStatement Statement - HiLink slType Type - HiLink slCommentError slError - HiLink slCommentString slString - HiLink slComment2String slString - HiLink slCommentSkip slComment - HiLink slString String - HiLink slComment Comment - HiLink slSpecial SpecialChar - HiLink slTodo Todo - HiLink slVariable Identifier - "HiLink slIdentifier Identifier +hi def link slLabel Label +hi def link slUserLabel Label +hi def link slConditional Conditional +hi def link slRepeat Repeat +hi def link slCharacter Character +hi def link slSpecialCharacter slSpecial +hi def link slNumber Number +hi def link slFloat Float +hi def link slParenError slError +hi def link slInParen slError +hi def link slCommentError slError +hi def link slOperator Operator +hi def link slStorageClass StorageClass +hi def link slError Error +hi def link slStatement Statement +hi def link slType Type +hi def link slCommentError slError +hi def link slCommentString slString +hi def link slComment2String slString +hi def link slCommentSkip slComment +hi def link slString String +hi def link slComment Comment +hi def link slSpecial SpecialChar +hi def link slTodo Todo +hi def link slVariable Identifier +"hi def link slIdentifier Identifier - delcommand HiLink -endif let b:current_syntax = "sl" diff --git a/runtime/syntax/slang.vim b/runtime/syntax/slang.vim index 9fa89b4d61..53ede4dc5a 100644 --- a/runtime/syntax/slang.vim +++ b/runtime/syntax/slang.vim @@ -3,11 +3,8 @@ " Maintainer: Jan Hlavacek <lahvak@math.ohio-state.edu> " Last Change: 980216 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -55,47 +52,37 @@ syn keyword slangOperator sizeof syn region slangPreCondit start="^\s*#\s*\(ifdef\>\|ifndef\>\|iftrue\>\|ifnfalse\>\|iffalse\>\|ifntrue\>\|if\$\|ifn\$\|\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=cComment,slangString,slangCharacter,slangNumber " 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_slang_syntax_inits") - if version < 508 - let did_slang_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink slangDefinition Type - HiLink slangBlock slangDefinition - HiLink slangLabel Label - HiLink slangConditional Conditional - HiLink slangRepeat Repeat - HiLink slangCharacter Character - HiLink slangFloat Float - HiLink slangImaginary Float - HiLink slangDecimal slangNumber - HiLink slangOctal slangNumber - HiLink slangHex slangNumber - HiLink slangNumber Number - HiLink slangParenError Error - HiLink slangOctalError Error - HiLink slangOperator Operator - HiLink slangStructure Structure - HiLink slangInclude Include - HiLink slangPreCondit PreCondit - HiLink slangError Error - HiLink slangStatement Statement - HiLink slangType Type - HiLink slangString String - HiLink slangConstant Constant - HiLink slangRangeArray slangConstant - HiLink slangComment Comment - HiLink slangSpecial SpecialChar - HiLink slangTodo Todo - HiLink slangDelim Delimiter +hi def link slangDefinition Type +hi def link slangBlock slangDefinition +hi def link slangLabel Label +hi def link slangConditional Conditional +hi def link slangRepeat Repeat +hi def link slangCharacter Character +hi def link slangFloat Float +hi def link slangImaginary Float +hi def link slangDecimal slangNumber +hi def link slangOctal slangNumber +hi def link slangHex slangNumber +hi def link slangNumber Number +hi def link slangParenError Error +hi def link slangOctalError Error +hi def link slangOperator Operator +hi def link slangStructure Structure +hi def link slangInclude Include +hi def link slangPreCondit PreCondit +hi def link slangError Error +hi def link slangStatement Statement +hi def link slangType Type +hi def link slangString String +hi def link slangConstant Constant +hi def link slangRangeArray slangConstant +hi def link slangComment Comment +hi def link slangSpecial SpecialChar +hi def link slangTodo Todo +hi def link slangDelim Delimiter - delcommand HiLink -endif let b:current_syntax = "slang" diff --git a/runtime/syntax/slice.vim b/runtime/syntax/slice.vim index 4e2f9a8604..3a57ece913 100644 --- a/runtime/syntax/slice.vim +++ b/runtime/syntax/slice.vim @@ -3,11 +3,8 @@ " Maintainer: Morel Bodin <slice06@nym.hush.com> " Last Change: 2005 Dec 03 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -58,33 +55,23 @@ syn match sliceComment "//.*" syn sync ccomment sliceComment " 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_slice_syn_inits") - if version < 508 - let did_slice_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink sliceComment Comment - HiLink sliceConstruct Keyword - HiLink sliceType Type - HiLink sliceString String - HiLink sliceIncluded String - HiLink sliceQualifier Keyword - HiLink sliceInclude Include - HiLink sliceGuard PreProc - HiLink sliceBoolean Boolean - HiLink sliceFloat Number - HiLink sliceNumber Number - HiLink sliceOctal Number - HiLink sliceOctalZero Special - HiLink sliceNumberError Special +hi def link sliceComment Comment +hi def link sliceConstruct Keyword +hi def link sliceType Type +hi def link sliceString String +hi def link sliceIncluded String +hi def link sliceQualifier Keyword +hi def link sliceInclude Include +hi def link sliceGuard PreProc +hi def link sliceBoolean Boolean +hi def link sliceFloat Number +hi def link sliceNumber Number +hi def link sliceOctal Number +hi def link sliceOctalZero Special +hi def link sliceNumberError Special - delcommand HiLink -endif let b:current_syntax = "slice" diff --git a/runtime/syntax/slpconf.vim b/runtime/syntax/slpconf.vim index 9fe4503780..712ba90719 100644 --- a/runtime/syntax/slpconf.vim +++ b/runtime/syntax/slpconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slpreg.vim b/runtime/syntax/slpreg.vim index f3c8a7fc8e..a177b063f0 100644 --- a/runtime/syntax/slpreg.vim +++ b/runtime/syntax/slpreg.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location registration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location registration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slpspi.vim b/runtime/syntax/slpspi.vim index 8507e3de69..eaeb02a80f 100644 --- a/runtime/syntax/slpspi.vim +++ b/runtime/syntax/slpspi.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location SPI file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location SPI file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slrnrc.vim b/runtime/syntax/slrnrc.vim index 038b62e166..cf0734ae85 100644 --- a/runtime/syntax/slrnrc.vim +++ b/runtime/syntax/slrnrc.vim @@ -3,11 +3,8 @@ " Maintainer: Preben 'Peppe' Guldberg <peppe-vim@wielders.org> " Last Change: 23 April 2006 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -150,44 +147,34 @@ syn match slrnrcSetkey "^\s*setkey\>" skipwhite nextgroup=slrnrcSetkeyArt,slrn syn match slrnrcUnsetkey '^\s*unsetkey\s\+\("\)\=\(article\|group\|readline\)\>\1' skipwhite nextgroup=slrnrcKey contains=slrnrcSetkeyObj\(Str\)\= " 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_slrnrc_syntax_inits") - if version < 508 - let did_slrnrc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink slrnrcTodo Todo - HiLink slrnrcSpaceError Error - HiLink slrnrcNumber Number - HiLink slrnrcSpecKey SpecialChar - HiLink slrnrcKey String - HiLink slrnrcSpecChar SpecialChar - HiLink slrnrcString String - HiLink slrnSlangPreCondit Special - HiLink slrnrcComment Comment - HiLink slrnrcVarInt Identifier - HiLink slrnrcVarStr Identifier - HiLink slrnrcCmd slrnrcSet - HiLink slrnrcSet Operator - HiLink slrnrcColor Keyword - HiLink slrnrcColorObj Identifier - HiLink slrnrcColorVal String - HiLink slrnrcMono Keyword - HiLink slrnrcMonoObj Identifier - HiLink slrnrcMonoVal String - HiLink slrnrcFunArt Macro - HiLink slrnrcFunGroup Macro - HiLink slrnrcFunRead Macro - HiLink slrnrcSetkeyObj Identifier - HiLink slrnrcSetkey Keyword - HiLink slrnrcUnsetkey slrnrcSetkey - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link slrnrcTodo Todo +hi def link slrnrcSpaceError Error +hi def link slrnrcNumber Number +hi def link slrnrcSpecKey SpecialChar +hi def link slrnrcKey String +hi def link slrnrcSpecChar SpecialChar +hi def link slrnrcString String +hi def link slrnSlangPreCondit Special +hi def link slrnrcComment Comment +hi def link slrnrcVarInt Identifier +hi def link slrnrcVarStr Identifier +hi def link slrnrcCmd slrnrcSet +hi def link slrnrcSet Operator +hi def link slrnrcColor Keyword +hi def link slrnrcColorObj Identifier +hi def link slrnrcColorVal String +hi def link slrnrcMono Keyword +hi def link slrnrcMonoObj Identifier +hi def link slrnrcMonoVal String +hi def link slrnrcFunArt Macro +hi def link slrnrcFunGroup Macro +hi def link slrnrcFunRead Macro +hi def link slrnrcSetkeyObj Identifier +hi def link slrnrcSetkey Keyword +hi def link slrnrcUnsetkey slrnrcSetkey + let b:current_syntax = "slrnrc" diff --git a/runtime/syntax/slrnsc.vim b/runtime/syntax/slrnsc.vim index 838af6ad1c..9f51cad380 100644 --- a/runtime/syntax/slrnsc.vim +++ b/runtime/syntax/slrnsc.vim @@ -3,20 +3,13 @@ " Maintainer: Preben 'Peppe' Guldberg <peppe@wielders.org> " Last Change: 8 Oct 2004 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " characters in newsgroup names -if version < 600 - set isk=@,48-57,.,-,_,+ -else - setlocal isk=@,48-57,.,-,_,+ -endif +setlocal isk=@,48-57,.,-,_,+ syn match slrnscComment "%.*$" syn match slrnscSectionCom ".].*"lc=2 @@ -51,34 +44,24 @@ syn match slrnscScoreIdent contained "%.*" syn match slrnScoreLine "^\s*Score::\=\s\+=\=[-+]\=\d\+\s*\(%.*\)\=$" skipempty nextgroup=slrnscScoreItem contains=slrnscScore,slrnscDelim,slrnscOper,slrnscNumber,slrnscScoreIdent " 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_slrnsc_syntax_inits") - if version < 508 - let did_slrnsc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink slrnscComment Comment - HiLink slrnscSectionCom slrnscComment - HiLink slrnscGroup String - HiLink slrnscNumber Number - HiLink slrnscDate Special - HiLink slrnscDelim Delimiter - HiLink slrnscComma SpecialChar - HiLink slrnscOper SpecialChar - HiLink slrnscEsc String - HiLink slrnscSectionStd Type - HiLink slrnscSectionNot Delimiter - HiLink slrnscItem Statement - HiLink slrnscScore Keyword - HiLink slrnscScoreIdent Identifier - HiLink slrnscInclude Keyword +hi def link slrnscComment Comment +hi def link slrnscSectionCom slrnscComment +hi def link slrnscGroup String +hi def link slrnscNumber Number +hi def link slrnscDate Special +hi def link slrnscDelim Delimiter +hi def link slrnscComma SpecialChar +hi def link slrnscOper SpecialChar +hi def link slrnscEsc String +hi def link slrnscSectionStd Type +hi def link slrnscSectionNot Delimiter +hi def link slrnscItem Statement +hi def link slrnscScore Keyword +hi def link slrnscScoreIdent Identifier +hi def link slrnscInclude Keyword - delcommand HiLink -endif let b:current_syntax = "slrnsc" diff --git a/runtime/syntax/sm.vim b/runtime/syntax/sm.vim index 2f9e6d7d01..0ecc96875f 100644 --- a/runtime/syntax/sm.vim +++ b/runtime/syntax/sm.vim @@ -1,15 +1,10 @@ " Vim syntax file " Language: sendmail -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 06, 2005 -" Version: 4 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Oct 25, 2016 +" Version: 8 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM +if exists("b:current_syntax") finish endif @@ -60,36 +55,25 @@ syn match smClauseCont contained "^\t" syn region smClause matchgroup=Delimiter start="\$?." matchgroup=Delimiter end="\$\." contains=smElse,smClause,smVar,smClauseCont " 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_smil_syntax_inits") - if version < 508 - let did_smil_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink smClause Special - HiLink smClauseError Error - HiLink smComment Comment - HiLink smDefine Statement - HiLink smElse Delimiter - HiLink smHeader Statement - HiLink smHeaderSep String - HiLink smMesg Special - HiLink smPrecedence Number - HiLink smRewrite Statement - HiLink smRewriteComment Comment - HiLink smRewriteLhsToken String - HiLink smRewriteLhsUser Statement - HiLink smRewriteRhsToken String - HiLink smRuleset Preproc - HiLink smTrusted Special - HiLink smVar String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link smClause Special +hi def link smClauseError Error +hi def link smComment Comment +hi def link smDefine Statement +hi def link smElse Delimiter +hi def link smHeader Statement +hi def link smHeaderSep String +hi def link smMesg Special +hi def link smPrecedence Number +hi def link smRewrite Statement +hi def link smRewriteComment Comment +hi def link smRewriteLhsToken String +hi def link smRewriteLhsUser Statement +hi def link smRewriteRhsToken String +hi def link smRuleset Preproc +hi def link smTrusted Special +hi def link smVar String let b:current_syntax = "sm" diff --git a/runtime/syntax/smarty.vim b/runtime/syntax/smarty.vim index 6dda366ba2..a39c290abe 100644 --- a/runtime/syntax/smarty.vim +++ b/runtime/syntax/smarty.vim @@ -8,11 +8,10 @@ " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") - finish -endif + " quit when a syntax file was already loaded + if exists("b:current_syntax") + finish + endif let main_syntax = 'smarty' endif @@ -57,25 +56,16 @@ syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,ja syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,javaScript,@htmlPreproc,smartyZone -if version >= 508 || !exists("did_smarty_syn_inits") - if version < 508 - let did_smarty_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink smartyTagName Identifier - HiLink smartyProperty Constant - " if you want the text inside the braces to be colored, then - " remove the comment in from of the next statement - "HiLink smartyZone Include - HiLink smartyInFunc Function - HiLink smartyBlock Constant - HiLink smartyDot SpecialChar - HiLink smartyModifier Function - delcommand HiLink -endif +hi def link smartyTagName Identifier +hi def link smartyProperty Constant +" if you want the text inside the braces to be colored, then +" remove the comment in from of the next statement +"hi def link smartyZone Include +hi def link smartyInFunc Function +hi def link smartyBlock Constant +hi def link smartyDot SpecialChar +hi def link smartyModifier Function let b:current_syntax = "smarty" diff --git a/runtime/syntax/smcl.vim b/runtime/syntax/smcl.vim index d9afba6de5..a5baa47e96 100644 --- a/runtime/syntax/smcl.vim +++ b/runtime/syntax/smcl.vim @@ -10,9 +10,8 @@ " check for 'b:current_syntax', removed 'did_smcl_syntax_inits' " 26apr2006 changed 'stata_smcl' to 'smcl' -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/smil.vim b/runtime/syntax/smil.vim index 6b5a002868..4cf6e84710 100644 --- a/runtime/syntax/smil.vim +++ b/runtime/syntax/smil.vim @@ -7,11 +7,8 @@ " To learn more about SMIL, please refer to http://www.w3.org/AudioVideo/ " and to http://www.helio.org/products/smil/tutorial/ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -115,38 +112,28 @@ endif syn region smilComment start=+<!DOCTYPE+ keepend end=+>+ " 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_smil_syntax_inits") - if version < 508 - let did_smil_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink smilTag Function - HiLink smilEndTag Identifier - HiLink smilArg Type - HiLink smilTagName smilStatement - HiLink smilSpecialTagName Exception - HiLink smilValue Value - HiLink smilSpecialChar Special - - HiLink smilSpecial Special - HiLink smilSpecialChar Special - HiLink smilString String - HiLink smilStatement Statement - HiLink smilComment Comment - HiLink smilCommentPart Comment - HiLink smilPreProc PreProc - HiLink smilValue String - HiLink smilCommentError smilError - HiLink smilTagError smilError - HiLink smilError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link smilTag Function +hi def link smilEndTag Identifier +hi def link smilArg Type +hi def link smilTagName smilStatement +hi def link smilSpecialTagName Exception +hi def link smilValue Value +hi def link smilSpecialChar Special + +hi def link smilSpecial Special +hi def link smilSpecialChar Special +hi def link smilString String +hi def link smilStatement Statement +hi def link smilComment Comment +hi def link smilCommentPart Comment +hi def link smilPreProc PreProc +hi def link smilValue String +hi def link smilCommentError smilError +hi def link smilTagError smilError +hi def link smilError Error + let b:current_syntax = "smil" diff --git a/runtime/syntax/smith.vim b/runtime/syntax/smith.vim index e05ce69683..b045d3b963 100644 --- a/runtime/syntax/smith.vim +++ b/runtime/syntax/smith.vim @@ -3,11 +3,8 @@ " Maintainer: Rafal M. Sulejman <rms@poczta.onet.pl> " Last Change: 21.07.2000 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -28,24 +25,14 @@ syn region smithString start=+"+ skip=+\\\\\|\\"+ end=+"+ syn case match " 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_smith_syntax_inits") - if version < 508 - let did_smith_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink smithRegister Identifier - HiLink smithKeyword Keyword - HiLink smithComment Comment - HiLink smithString String - HiLink smithNumber Number - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link smithRegister Identifier +hi def link smithKeyword Keyword +hi def link smithComment Comment +hi def link smithString String +hi def link smithNumber Number + let b:current_syntax = "smith" diff --git a/runtime/syntax/sml.vim b/runtime/syntax/sml.vim index aa7d64a33a..fa4524f93d 100644 --- a/runtime/syntax/sml.vim +++ b/runtime/syntax/sml.vim @@ -8,11 +8,8 @@ " 2002 Jun 02 - Fixed small typo (MM) " 2001 Nov 20 - Fixed small highlighting bug with modules (MM) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -168,62 +165,52 @@ syn sync match smlSigSync grouphere smlSig "\<sig\>" syn sync match smlSigSync groupthere smlSig "\<end\>" " 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_sml_syntax_inits") - if version < 508 - let did_sml_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink smlBraceErr Error - HiLink smlBrackErr Error - HiLink smlParenErr Error - - HiLink smlCommentErr Error - - HiLink smlEndErr Error - HiLink smlThenErr Error - - HiLink smlCharErr Error - - HiLink smlComment Comment - - HiLink smlModPath Include - HiLink smlModule Include - HiLink smlModParam1 Include - HiLink smlModType Include - HiLink smlMPRestr3 Include - HiLink smlFullMod Include - HiLink smlModTypeRestr Include - HiLink smlWith Include - HiLink smlMTDef Include - - HiLink smlConstructor Constant - - HiLink smlModPreRHS Keyword - HiLink smlMPRestr2 Keyword - HiLink smlKeyword Keyword - HiLink smlFunDef Keyword - HiLink smlRefAssign Keyword - HiLink smlKeyChar Keyword - HiLink smlAnyVar Keyword - HiLink smlTopStop Keyword - HiLink smlOperator Keyword - - HiLink smlBoolean Boolean - HiLink smlCharacter Character - HiLink smlNumber Number - HiLink smlReal Float - HiLink smlString String - HiLink smlType Type - HiLink smlTodo Todo - HiLink smlEncl Keyword - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link smlBraceErr Error +hi def link smlBrackErr Error +hi def link smlParenErr Error + +hi def link smlCommentErr Error + +hi def link smlEndErr Error +hi def link smlThenErr Error + +hi def link smlCharErr Error + +hi def link smlComment Comment + +hi def link smlModPath Include +hi def link smlModule Include +hi def link smlModParam1 Include +hi def link smlModType Include +hi def link smlMPRestr3 Include +hi def link smlFullMod Include +hi def link smlModTypeRestr Include +hi def link smlWith Include +hi def link smlMTDef Include + +hi def link smlConstructor Constant + +hi def link smlModPreRHS Keyword +hi def link smlMPRestr2 Keyword +hi def link smlKeyword Keyword +hi def link smlFunDef Keyword +hi def link smlRefAssign Keyword +hi def link smlKeyChar Keyword +hi def link smlAnyVar Keyword +hi def link smlTopStop Keyword +hi def link smlOperator Keyword + +hi def link smlBoolean Boolean +hi def link smlCharacter Character +hi def link smlNumber Number +hi def link smlReal Float +hi def link smlString String +hi def link smlType Type +hi def link smlTodo Todo +hi def link smlEncl Keyword + let b:current_syntax = "sml" diff --git a/runtime/syntax/snnsnet.vim b/runtime/syntax/snnsnet.vim index 6b24de5634..9dc9e06e78 100644 --- a/runtime/syntax/snnsnet.vim +++ b/runtime/syntax/snnsnet.vim @@ -8,9 +8,8 @@ " SNNS http://www-ra.informatik.uni-tuebingen.de/SNNS/ " is a simulator for neural networks. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -54,23 +53,14 @@ syn match snnsnetNumbers "\d" contained syn match snnsnetComment "#.*$" contains=snnsnetTodo syn keyword snnsnetTodo TODO XXX FIXME contained -if version >= 508 || !exists("did_snnsnet_syn_inits") - if version < 508 - let did_snnsnet_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink snnsnetType Type - HiLink snnsnetComment Comment - HiLink snnsnetNumbers Number - HiLink snnsnetSection Statement - HiLink snnsnetTitle Label - HiLink snnsnetTodo Todo +hi def link snnsnetType Type +hi def link snnsnetComment Comment +hi def link snnsnetNumbers Number +hi def link snnsnetSection Statement +hi def link snnsnetTitle Label +hi def link snnsnetTodo Todo - delcommand HiLink -endif let b:current_syntax = "snnsnet" diff --git a/runtime/syntax/snnspat.vim b/runtime/syntax/snnspat.vim index 5bfa48e624..cb6e9c5bd1 100644 --- a/runtime/syntax/snnspat.vim +++ b/runtime/syntax/snnspat.vim @@ -8,9 +8,8 @@ " SNNS http://www-ra.informatik.uni-tuebingen.de/SNNS/ " is a simulator for neural networks. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -44,26 +43,17 @@ syn match snnspatNumbers "\d" contained syn match snnspatComment "#.*$" contains=snnspatTodo syn keyword snnspatTodo TODO XXX FIXME contained -if version >= 508 || !exists("did_snnspat_syn_inits") - if version < 508 - let did_snnspat_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink snnspatGen Statement - HiLink snnspatHeader Error - HiLink snnspatNoHeader Define - HiLink snnspatNumbers Number - HiLink snnspatComment Comment - HiLink snnspatError Error - HiLink snnspatTodo Todo - HiLink snnspatAccepted NONE - HiLink snnspatBrac NONE +hi def link snnspatGen Statement +hi def link snnspatHeader Error +hi def link snnspatNoHeader Define +hi def link snnspatNumbers Number +hi def link snnspatComment Comment +hi def link snnspatError Error +hi def link snnspatTodo Todo +hi def link snnspatAccepted NONE +hi def link snnspatBrac NONE - delcommand HiLink -endif let b:current_syntax = "snnspat" diff --git a/runtime/syntax/snnsres.vim b/runtime/syntax/snnsres.vim index 4c1d596009..2f19b67dbe 100644 --- a/runtime/syntax/snnsres.vim +++ b/runtime/syntax/snnsres.vim @@ -8,9 +8,8 @@ " SNNS http://www-ra.informatik.uni-tuebingen.de/SNNS/ " is a simulator for neural networks. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -37,23 +36,14 @@ syn match snnsresNumbers "\d" contained syn match snnsresComment "#.*$" contains=snnsresTodo syn keyword snnsresTodo TODO XXX FIXME contained -if version >= 508 || !exists("did_snnsres_syn_inits") - if version < 508 - let did_snnsres_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink snnsresGen Statement - HiLink snnsresHeader Statement - HiLink snnsresNoHeader Define - HiLink snnsresNumbers Number - HiLink snnsresComment Comment - HiLink snnsresTodo Todo - - delcommand HiLink -endif + +hi def link snnsresGen Statement +hi def link snnsresHeader Statement +hi def link snnsresNoHeader Define +hi def link snnsresNumbers Number +hi def link snnsresComment Comment +hi def link snnsresTodo Todo + let b:current_syntax = "snnsres" diff --git a/runtime/syntax/snobol4.vim b/runtime/syntax/snobol4.vim index 07eb63dec7..11ce2e0059 100644 --- a/runtime/syntax/snobol4.vim +++ b/runtime/syntax/snobol4.vim @@ -2,19 +2,17 @@ " Language: SNOBOL4 " Maintainer: Rafal Sulejman <rms@poczta.onet.pl> " Site: http://rms.republika.pl/vim/syntax/snobol4.vim -" Last change: 2006 may 10 +" Last change: : Thu, 25 Jan 2018 14:21:24 +0100 " Changes: +" - system variables updated for SNOBOL4 2.0+ " - strict snobol4 mode (set snobol4_strict_mode to activate) " - incorrect HL of dots in strings corrected " - incorrect HL of dot-variables in parens corrected " - one character labels weren't displayed correctly. " - nonexistent Snobol4 keywords displayed as errors. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -62,7 +60,7 @@ syn match snobol4Constant /"[^a-z"']\.[a-z][a-z0-9\-]*"/hs=s+1 syn region snobol4Goto start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError syn match snobol4Number "\<\d*\(\.\d\d*\)*\>" syn match snobol4BogusSysVar "&\w\{1,}" -syn match snobol4SysVar "&\(abort\|alphabet\|anchor\|arb\|bal\|case\|code\|dump\|errlimit\|errtext\|errtype\|fail\|fence\|fnclevel\|ftrace\|fullscan\|input\|lastno\|lcase\|maxlngth\|output\|parm\|rem\|rtntype\|stcount\|stfcount\|stlimit\|stno\|succeed\|trace\|trim\|ucase\)" +syn match snobol4SysVar "&\<\(abort\|alphabet\|anchor\|arb\|bal\|case\|code\|digits\|dump\|errlimit\|errtext\|errtype\|fail\|fence\|fnclevel\|ftrace\|fullscan\|input\|lastno\|lcase\|maxlngth\|output\|parm\|rem\|rtntype\|stcount\|stfcount\|stlimit\|stno\|succeed\|trace\|trim\|ucase\)\>" syn match snobol4ExtSysVar "&\(gtrace\|line\|file\|lastline\|lastfile\)" syn match snobol4Label "\(^\|;\)[^-\.\+ \t\*\.]\{1,}[^ \t\*\;]*" syn match snobol4Comment "\(^\|;\)\([\*\|!;#].*$\)" @@ -79,47 +77,37 @@ syn match snobol4ErrInBracket display contained "[){}]\|<%\|%>" " syn match snobol4Comment "^\#\!.*$" " 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_snobol4_syntax_inits") - if version < 508 - let did_snobol4_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink snobol4Constant Constant - HiLink snobol4Label Label - HiLink snobol4Goto Repeat - HiLink snobol4Conditional Conditional - HiLink snobol4Repeat Repeat - HiLink snobol4Number Number - HiLink snobol4Error Error - HiLink snobol4Statement PreProc - HiLink snobol4BogusStatement snobol4Error - HiLink snobol4String String - HiLink snobol4Comment Comment - HiLink snobol4Special Special - HiLink snobol4Todo Todo - HiLink snobol4Keyword Keyword - HiLink snobol4Function Function - HiLink snobol4MathsOperator Operator - HiLink snobol4ParenError snobol4Error - HiLink snobol4ErrInParen snobol4Error - HiLink snobol4ErrInBracket snobol4Error - HiLink snobol4SysVar Keyword - HiLink snobol4BogusSysVar snobol4Error - if exists("snobol4_strict_mode") - HiLink snobol4ExtSysVar WarningMsg - HiLink snobol4ExtKeyword WarningMsg - else - HiLink snobol4ExtSysVar snobol4SysVar - HiLink snobol4ExtKeyword snobol4Keyword - endif - - delcommand HiLink +hi def link snobol4Constant Constant +hi def link snobol4Label Label +hi def link snobol4Goto Repeat +hi def link snobol4Conditional Conditional +hi def link snobol4Repeat Repeat +hi def link snobol4Number Number +hi def link snobol4Error Error +hi def link snobol4Statement PreProc +hi def link snobol4BogusStatement snobol4Error +hi def link snobol4String String +hi def link snobol4Comment Comment +hi def link snobol4Special Special +hi def link snobol4Todo Todo +hi def link snobol4Keyword Keyword +hi def link snobol4Function Function +hi def link snobol4MathsOperator Operator +hi def link snobol4ParenError snobol4Error +hi def link snobol4ErrInParen snobol4Error +hi def link snobol4ErrInBracket snobol4Error +hi def link snobol4SysVar Keyword +hi def link snobol4BogusSysVar snobol4Error +if exists("snobol4_strict_mode") + hi def link snobol4ExtSysVar WarningMsg + hi def link snobol4ExtKeyword WarningMsg +else + hi def link snobol4ExtSysVar snobol4SysVar + hi def link snobol4ExtKeyword snobol4Keyword endif + let b:current_syntax = "snobol4" " vim: ts=8 diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim index 5d96b57a8a..3a7dc9e422 100644 --- a/runtime/syntax/spec.vim +++ b/runtime/syntax/spec.vim @@ -3,13 +3,10 @@ " Language: SPEC: Build/install scripts for Linux RPM packages " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014) -" Last Change: Sun Mar 2 10:33 MSK 2014 Igor Gnatenko +" Last Change: Sat Apr 9 15:30 2016 Filip Szymański -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -83,8 +80,8 @@ syn keyword specMacroNameLocal contained _arch _binary_payload _bindir _build _b "One line macros - valid in all ScriptAreas "tip: remember do include new items on specScriptArea's skip section -syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier -syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier +syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|autosetup\|autopatch\|configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier +syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier "%% Files Section %% "TODO %config valid parameters: missingok\|noreplace @@ -105,7 +102,7 @@ syn case ignore "%% PreAmble Section %% "Copyright and Serial were deprecated by License and Epoch syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier -syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier +syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier "%% Description Section %% syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment @@ -114,7 +111,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end= syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment "%% Scripts Section %% -syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 +syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 "%% Changelog Section %% syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense @@ -159,78 +156,68 @@ syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>" syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>" " 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_spec_syntax_inits") - if version < 508 - let did_spec_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - "main types color definitions - HiLink specSection Structure - HiLink specSectionMacro Macro - HiLink specWWWlink PreProc - HiLink specOpts Operator - - "yes, it's ugly, but white is sooo cool - if &background == "dark" - hi def specGlobalMacro ctermfg=white - else - HiLink specGlobalMacro Identifier - endif - - "sh colors - HiLink shComment Comment - HiLink shIf Statement - HiLink shOperator Special - HiLink shQuote1 String - HiLink shQuote2 String - HiLink shQuoteDelim Statement - - "spec colors - HiLink specBlock Function - HiLink specColon Special - HiLink specCommand Statement - HiLink specCommandOpts specOpts - HiLink specCommandSpecial Special - HiLink specComment Comment - HiLink specConfigure specCommand - HiLink specDate String - HiLink specDescriptionOpts specOpts - HiLink specEmail specWWWlink - HiLink specError Error - HiLink specFilesDirective specSectionMacro - HiLink specFilesOpts specOpts - HiLink specLicense String - HiLink specMacroNameLocal specGlobalMacro - HiLink specMacroNameOther specGlobalMacro - HiLink specManpageFile NONE - HiLink specMonth specDate - HiLink specNoNumberHilite NONE - HiLink specNumber Number - HiLink specPackageOpts specOpts - HiLink specPercent Special - HiLink specSpecialChar Special - HiLink specSpecialVariables specGlobalMacro - HiLink specSpecialVariablesNames specGlobalMacro - HiLink specTarCommand specCommand - HiLink specURL specWWWlink - HiLink specURLMacro specWWWlink - HiLink specVariables Identifier - HiLink specWeekday specDate - HiLink specListedFilesBin Statement - HiLink specListedFilesDoc Statement - HiLink specListedFilesEtc Statement - HiLink specListedFilesLib Statement - HiLink specListedFilesPrefix Statement - HiLink specListedFilesShare Statement - - delcommand HiLink +" Only when an item doesn't have highlighting yet + +"main types color definitions +hi def link specSection Structure +hi def link specSectionMacro Macro +hi def link specWWWlink PreProc +hi def link specOpts Operator + +"yes, it's ugly, but white is sooo cool +if &background == "dark" +hi def specGlobalMacro ctermfg=white +else +hi def link specGlobalMacro Identifier endif +"sh colors +hi def link shComment Comment +hi def link shIf Statement +hi def link shOperator Special +hi def link shQuote1 String +hi def link shQuote2 String +hi def link shQuoteDelim Statement + +"spec colors +hi def link specBlock Function +hi def link specColon Special +hi def link specCommand Statement +hi def link specCommandOpts specOpts +hi def link specCommandSpecial Special +hi def link specComment Comment +hi def link specConfigure specCommand +hi def link specDate String +hi def link specDescriptionOpts specOpts +hi def link specEmail specWWWlink +hi def link specError Error +hi def link specFilesDirective specSectionMacro +hi def link specFilesOpts specOpts +hi def link specLicense String +hi def link specMacroNameLocal specGlobalMacro +hi def link specMacroNameOther specGlobalMacro +hi def link specManpageFile NONE +hi def link specMonth specDate +hi def link specNoNumberHilite NONE +hi def link specNumber Number +hi def link specPackageOpts specOpts +hi def link specPercent Special +hi def link specSpecialChar Special +hi def link specSpecialVariables specGlobalMacro +hi def link specSpecialVariablesNames specGlobalMacro +hi def link specTarCommand specCommand +hi def link specURL specWWWlink +hi def link specURLMacro specWWWlink +hi def link specVariables Identifier +hi def link specWeekday specDate +hi def link specListedFilesBin Statement +hi def link specListedFilesDoc Statement +hi def link specListedFilesEtc Statement +hi def link specListedFilesLib Statement +hi def link specListedFilesPrefix Statement +hi def link specListedFilesShare Statement + + let b:current_syntax = "spec" " vim: ts=8 diff --git a/runtime/syntax/specman.vim b/runtime/syntax/specman.vim index 3fb77a2afa..79c94b7815 100644 --- a/runtime/syntax/specman.vim +++ b/runtime/syntax/specman.vim @@ -10,11 +10,8 @@ "--------------------------------------------------------- " Remove any old syntax stuff hanging around -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -137,46 +134,36 @@ syn region specmanString start=+"+ end=+"+ syn sync lines=50 " 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_specman_syn_inits") - if version < 508 - let did_specman_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " The default methods for highlighting. Can be overridden later - HiLink specmanConditional Conditional - HiLink specmanConstraint Conditional - HiLink specmanRepeat Repeat - HiLink specmanString String - HiLink specmanComment Comment - HiLink specmanConstant Macro - HiLink specmanNumber Number - HiLink specmanCompare Operator - HiLink specmanOperator Operator - HiLink specmanLogical Operator - HiLink specmanStatement Statement - HiLink specmanHDL SpecialChar - HiLink specmanMethod Function - HiLink specmanInclude Include - HiLink specmanStructure Structure - HiLink specmanBoolean Boolean - HiLink specmanFSM Label - HiLink specmanSpecial Special - HiLink specmanType Type - HiLink specmanTemporal Type - HiLink specmanFile Include - HiLink specmanPreCondit Include - HiLink specmanDefine Typedef - HiLink specmanLabel Label - HiLink specmanPacking keyword - HiLink specmanTodo Todo - HiLink specmanParenError Error - HiLink specmanErrInParen Error - HiLink specmanErrInBracket Error - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +" The default methods for highlighting. Can be overridden later +hi def link specmanConditional Conditional +hi def link specmanConstraint Conditional +hi def link specmanRepeat Repeat +hi def link specmanString String +hi def link specmanComment Comment +hi def link specmanConstant Macro +hi def link specmanNumber Number +hi def link specmanCompare Operator +hi def link specmanOperator Operator +hi def link specmanLogical Operator +hi def link specmanStatement Statement +hi def link specmanHDL SpecialChar +hi def link specmanMethod Function +hi def link specmanInclude Include +hi def link specmanStructure Structure +hi def link specmanBoolean Boolean +hi def link specmanFSM Label +hi def link specmanSpecial Special +hi def link specmanType Type +hi def link specmanTemporal Type +hi def link specmanFile Include +hi def link specmanPreCondit Include +hi def link specmanDefine Typedef +hi def link specmanLabel Label +hi def link specmanPacking keyword +hi def link specmanTodo Todo +hi def link specmanParenError Error +hi def link specmanErrInParen Error +hi def link specmanErrInBracket Error let b:current_syntax = "specman" diff --git a/runtime/syntax/spice.vim b/runtime/syntax/spice.vim index 200e1aaea4..306039bc74 100644 --- a/runtime/syntax/spice.vim +++ b/runtime/syntax/spice.vim @@ -7,11 +7,8 @@ " This is based on sh.vim by Lennart Schultz " but greatly simplified -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -53,28 +50,18 @@ syn match spiceParenError ")" syn sync minlines=50 " 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_spice_syntax_inits") - if version < 508 - let did_spice_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink spiceTodo Todo - HiLink spiceWrapLineOperator spiceOperator - HiLink spiceSinglequote spiceExpr - HiLink spiceExpr Function - HiLink spiceParenError Error - HiLink spiceStatement Statement - HiLink spiceNumber Number - HiLink spiceComment Comment - HiLink spiceOperator Operator - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link spiceTodo Todo +hi def link spiceWrapLineOperator spiceOperator +hi def link spiceSinglequote spiceExpr +hi def link spiceExpr Function +hi def link spiceParenError Error +hi def link spiceStatement Statement +hi def link spiceNumber Number +hi def link spiceComment Comment +hi def link spiceOperator Operator + let b:current_syntax = "spice" diff --git a/runtime/syntax/splint.vim b/runtime/syntax/splint.vim index dc09d8b9d6..8eba57d288 100644 --- a/runtime/syntax/splint.vim +++ b/runtime/syntax/splint.vim @@ -15,20 +15,13 @@ " in your vimrc file or filetype.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - so <sfile>:p:h/c.vim -else - runtime! syntax/c.vim -endif +runtime! syntax/c.vim " FIXME: uses and changes several clusters defined in c.vim @@ -199,61 +192,51 @@ syn cluster cPreProcGroup add=@splintAllStuff syn cluster cMultiGroup add=@splintAllStuff " 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_splint_syntax_inits") - if version < 508 - let did_splint_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink splintShortAnn splintAnnotation - HiLink splintAnnotation Comment - HiLink splintAnnError splintError - HiLink splintAnnError2 splintError - HiLink splintFlag SpecialComment - HiLink splintGlobalFlag splintError - HiLink splintSpecialAnnot splintAnnKey - HiLink splintStateAnnot splintAnnKey - HiLink splintSpecTag splintAnnKey - HiLink splintModifies splintAnnKey - HiLink splintRequires splintAnnKey - HiLink splintGlobals splintAnnKey - HiLink splintGlobitem Constant - HiLink splintGlobannot splintAnnKey - HiLink splintWarning splintAnnKey - HiLink splintModitem Constant - HiLink splintIter splintAnnKey - HiLink splintConst splintAnnKey - HiLink splintAlt splintAnnKey - HiLink splintType splintAnnKey - HiLink splintGlobalType splintAnnKey - HiLink splintMemMgm splintAnnKey - HiLink splintAlias splintAnnKey - HiLink splintExposure splintAnnKey - HiLink splintDefState splintAnnKey - HiLink splintGlobState splintAnnKey - HiLink splintNullState splintAnnKey - HiLink splintNullPred splintAnnKey - HiLink splintExit splintAnnKey - HiLink splintExec splintAnnKey - HiLink splintSef splintAnnKey - HiLink splintDecl splintAnnKey - HiLink splintCase splintAnnKey - HiLink splintBreak splintAnnKey - HiLink splintUnreach splintAnnKey - HiLink splintSpecFunc splintAnnKey - HiLink splintErrSupp splintAnnKey - HiLink splintTypeAcc splintAnnKey - HiLink splintMacro splintAnnKey - HiLink splintSpecType splintAnnKey - HiLink splintAnnKey Type - HiLink splintError Error +" Only when an item doesn't have highlighting yet + +hi def link splintShortAnn splintAnnotation +hi def link splintAnnotation Comment +hi def link splintAnnError splintError +hi def link splintAnnError2 splintError +hi def link splintFlag SpecialComment +hi def link splintGlobalFlag splintError +hi def link splintSpecialAnnot splintAnnKey +hi def link splintStateAnnot splintAnnKey +hi def link splintSpecTag splintAnnKey +hi def link splintModifies splintAnnKey +hi def link splintRequires splintAnnKey +hi def link splintGlobals splintAnnKey +hi def link splintGlobitem Constant +hi def link splintGlobannot splintAnnKey +hi def link splintWarning splintAnnKey +hi def link splintModitem Constant +hi def link splintIter splintAnnKey +hi def link splintConst splintAnnKey +hi def link splintAlt splintAnnKey +hi def link splintType splintAnnKey +hi def link splintGlobalType splintAnnKey +hi def link splintMemMgm splintAnnKey +hi def link splintAlias splintAnnKey +hi def link splintExposure splintAnnKey +hi def link splintDefState splintAnnKey +hi def link splintGlobState splintAnnKey +hi def link splintNullState splintAnnKey +hi def link splintNullPred splintAnnKey +hi def link splintExit splintAnnKey +hi def link splintExec splintAnnKey +hi def link splintSef splintAnnKey +hi def link splintDecl splintAnnKey +hi def link splintCase splintAnnKey +hi def link splintBreak splintAnnKey +hi def link splintUnreach splintAnnKey +hi def link splintSpecFunc splintAnnKey +hi def link splintErrSupp splintAnnKey +hi def link splintTypeAcc splintAnnKey +hi def link splintMacro splintAnnKey +hi def link splintSpecType splintAnnKey +hi def link splintAnnKey Type +hi def link splintError Error - delcommand HiLink -endif let b:current_syntax = "splint" diff --git a/runtime/syntax/spup.vim b/runtime/syntax/spup.vim index 07e9708eaa..e5f58be92f 100644 --- a/runtime/syntax/spup.vim +++ b/runtime/syntax/spup.vim @@ -17,11 +17,8 @@ " If you encounter problems or have questions or suggestions, mail me " Remove old syntax stuff -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -206,74 +203,64 @@ syn sync match spupSyncTitle grouphere spupTitle "^TITLE" syn sync match spupSyncUnit grouphere spupUnit "^UNIT" " 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_spup_syn_inits") - if version < 508 - let did_spup_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink spupCdi spupSection - HiLink spupConditions spupSection - HiLink spupDeclare spupSection - HiLink spupEstimation spupSection - HiLink spupExternal spupSection - HiLink spupFlowsheet spupSection - HiLink spupFunction spupSection - HiLink spupGlobal spupSection - HiLink spupHomotopy spupSection - HiLink spupMacro spupSection - HiLink spupModel spupSection - HiLink spupOperation spupSection - HiLink spupOptions spupSection - HiLink spupProcedure spupSection - HiLink spupProfiles spupSection - HiLink spupReport spupSection - HiLink spupTitle spupConstant " this is correct, truly ;) - HiLink spupUnit spupSection +hi def link spupCdi spupSection +hi def link spupConditions spupSection +hi def link spupDeclare spupSection +hi def link spupEstimation spupSection +hi def link spupExternal spupSection +hi def link spupFlowsheet spupSection +hi def link spupFunction spupSection +hi def link spupGlobal spupSection +hi def link spupHomotopy spupSection +hi def link spupMacro spupSection +hi def link spupModel spupSection +hi def link spupOperation spupSection +hi def link spupOptions spupSection +hi def link spupProcedure spupSection +hi def link spupProfiles spupSection +hi def link spupReport spupSection +hi def link spupTitle spupConstant " this is correct, truly ;) +hi def link spupUnit spupSection - HiLink spupCdiSubs spupSubs - HiLink spupConditionsSubs spupSubs - HiLink spupDeclareSubs spupSubs - HiLink spupEstimationSubs spupSubs - HiLink spupExternalSubs spupSubs - HiLink spupFlowsheetSubs spupSubs - HiLink spupFunctionSubs spupSubs - HiLink spupHomotopySubs spupSubs - HiLink spupMacroSubs spupSubs - HiLink spupModelSubs spupSubs - HiLink spupOperationSubs spupSubs - HiLink spupOptionsSubs spupSubs - HiLink spupProcedureSubs spupSubs - HiLink spupReportSubs spupSubs - HiLink spupUnitSubs spupSubs +hi def link spupCdiSubs spupSubs +hi def link spupConditionsSubs spupSubs +hi def link spupDeclareSubs spupSubs +hi def link spupEstimationSubs spupSubs +hi def link spupExternalSubs spupSubs +hi def link spupFlowsheetSubs spupSubs +hi def link spupFunctionSubs spupSubs +hi def link spupHomotopySubs spupSubs +hi def link spupMacroSubs spupSubs +hi def link spupModelSubs spupSubs +hi def link spupOperationSubs spupSubs +hi def link spupOptionsSubs spupSubs +hi def link spupProcedureSubs spupSubs +hi def link spupReportSubs spupSubs +hi def link spupUnitSubs spupSubs - HiLink spupCode Normal - HiLink spupComment Comment - HiLink spupComment2 spupComment - HiLink spupConditional Statement - HiLink spupConstant Constant - HiLink spupError Error - HiLink spupHelp Normal - HiLink spupIdentifier Identifier - HiLink spupNumber Constant - HiLink spupOperator Special - HiLink spupOpenBrace spupError - HiLink spupSection Statement - HiLink spupSpecial spupTextprocGeneric - HiLink spupStreams Type - HiLink spupString Constant - HiLink spupSubs Statement - HiLink spupSymbol Special - HiLink spupTextprocError Normal - HiLink spupTextprocGeneric PreProc - HiLink spupTypes Type +hi def link spupCode Normal +hi def link spupComment Comment +hi def link spupComment2 spupComment +hi def link spupConditional Statement +hi def link spupConstant Constant +hi def link spupError Error +hi def link spupHelp Normal +hi def link spupIdentifier Identifier +hi def link spupNumber Constant +hi def link spupOperator Special +hi def link spupOpenBrace spupError +hi def link spupSection Statement +hi def link spupSpecial spupTextprocGeneric +hi def link spupStreams Type +hi def link spupString Constant +hi def link spupSubs Statement +hi def link spupSymbol Special +hi def link spupTextprocError Normal +hi def link spupTextprocGeneric PreProc +hi def link spupTypes Type - delcommand HiLink -endif let b:current_syntax = "spup" diff --git a/runtime/syntax/spyce.vim b/runtime/syntax/spyce.vim index e76cb1a1a2..169de199dc 100644 --- a/runtime/syntax/spyce.vim +++ b/runtime/syntax/spyce.vim @@ -4,11 +4,8 @@ " URL: http://spyce.sourceforge.net " Last Change: 2009 Nov 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,13 +17,9 @@ endif " Read the HTML syntax to start with let b:did_indent = 1 " don't perform HTML indentation! let html_no_rendering = 1 " do not render <b>,<i>, etc... -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax - syntax spell default " added by Bram -endif +runtime! syntax/html.vim +unlet b:current_syntax +syntax spell default " added by Bram " include python syn include @Python <sfile>:p:h/python.vim diff --git a/runtime/syntax/sql.vim b/runtime/syntax/sql.vim index 7ba20f3446..6de3f4a5c0 100644 --- a/runtime/syntax/sql.vim +++ b/runtime/syntax/sql.vim @@ -10,11 +10,8 @@ " If the above exist, it will source the type specified. " If none exist, it will source the default sql.vim file. " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/sqlanywhere.vim b/runtime/syntax/sqlanywhere.vim index 05b05c9f4f..e91a99de65 100644 --- a/runtime/syntax/sqlanywhere.vim +++ b/runtime/syntax/sqlanywhere.vim @@ -12,11 +12,8 @@ " Updated to Adaptive Server Anywhere 9.0.1 " Updated to Adaptive Server Anywhere 9.0.0 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/sqlforms.vim b/runtime/syntax/sqlforms.vim index 055b2ae870..6077dd1e94 100644 --- a/runtime/syntax/sqlforms.vim +++ b/runtime/syntax/sqlforms.vim @@ -7,21 +7,14 @@ " " TODO Find a new maintainer who knows SQL*Forms. - " For version 5.x, clear all syntax items. - " For version 6.x, quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif syntax case ignore -if version >= 600 - setlocal iskeyword=a-z,A-Z,48-57,_,.,-,> -else - set iskeyword=a-z,A-Z,48-57,_,.,-,> -endif +setlocal iskeyword=a-z,A-Z,48-57,_,.,-,> " The SQL reserved words, defined as keywords. @@ -138,30 +131,21 @@ syntax match sqlNumber "-\=\<[0-9]*\.\=[0-9_]\>" syntax sync ccomment sqlComment -if version >= 508 || !exists("did_sqlforms_syn_inits") - if version < 508 - let did_sqlforms_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sqlComment Comment - HiLink sqlKeyword Statement - HiLink sqlNumber Number - HiLink sqlOperator Statement - HiLink sqlProcedure Statement - HiLink sqlFunction Statement - HiLink sqlSystem Identifier - HiLink sqlSpecial Special - HiLink sqlStatement Statement - HiLink sqlString String - HiLink sqlType Type - HiLink sqlCodes Identifier - HiLink sqlTriggers PreProc - - delcommand HiLink -endif + +hi def link sqlComment Comment +hi def link sqlKeyword Statement +hi def link sqlNumber Number +hi def link sqlOperator Statement +hi def link sqlProcedure Statement +hi def link sqlFunction Statement +hi def link sqlSystem Identifier +hi def link sqlSpecial Special +hi def link sqlStatement Statement +hi def link sqlString String +hi def link sqlType Type +hi def link sqlCodes Identifier +hi def link sqlTriggers PreProc + let b:current_syntax = "sqlforms" diff --git a/runtime/syntax/sqlhana.vim b/runtime/syntax/sqlhana.vim index 1410e99eb4..2e334bb56e 100644 --- a/runtime/syntax/sqlhana.vim +++ b/runtime/syntax/sqlhana.vim @@ -7,11 +7,8 @@ " Description: Updated to SAP HANA SP4 " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/sqlinformix.vim b/runtime/syntax/sqlinformix.vim index b4d023600c..e01912bc40 100644 --- a/runtime/syntax/sqlinformix.vim +++ b/runtime/syntax/sqlinformix.vim @@ -4,11 +4,8 @@ " Maintainer: Dean Hill <dhill@hotmail.com> " Last Change: 2004 Aug 30 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -154,43 +151,33 @@ syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE " 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_sql_syn_inits") - if version < 508 - let did_sql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - - " === Comment syntax group === - HiLink sqlComment Comment - - " === Constant syntax group === - HiLink sqlNumber Number - HiLink sqlBoolean Boolean - HiLink sqlString String - - " === Statment syntax group === - HiLink sqlStatement Statement - HiLink sqlConditional Conditional - HiLink sqlRepeat Repeat - HiLink sqlKeyword Keyword - HiLink sqlOperator Operator - HiLink sqlException Exception - - " === Identifier syntax group === - HiLink sqlFunction Function - - " === Type syntax group === - HiLink sqlType Type - - " === Todo syntax group === - HiLink sqlTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + + +" === Comment syntax group === +hi def link sqlComment Comment + +" === Constant syntax group === +hi def link sqlNumber Number +hi def link sqlBoolean Boolean +hi def link sqlString String + +" === Statment syntax group === +hi def link sqlStatement Statement +hi def link sqlConditional Conditional +hi def link sqlRepeat Repeat +hi def link sqlKeyword Keyword +hi def link sqlOperator Operator +hi def link sqlException Exception + +" === Identifier syntax group === +hi def link sqlFunction Function + +" === Type syntax group === +hi def link sqlType Type + +" === Todo syntax group === +hi def link sqlTodo Todo + let b:current_syntax = "sqlinformix" diff --git a/runtime/syntax/sqlj.vim b/runtime/syntax/sqlj.vim index 51398ef9c2..c901145c3c 100644 --- a/runtime/syntax/sqlj.vim +++ b/runtime/syntax/sqlj.vim @@ -8,10 +8,8 @@ " au BufNewFile,BufRead *.sqlj so $VIM/syntax/sqlj.vim -" Remove any old syntax stuff hanging around -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -76,27 +74,18 @@ syn match sqlComment "--.*" syn sync ccomment sqljComment -if version >= 508 || !exists("did_sqlj_syn_inits") - if version < 508 - let did_sqlj_syn_inits = 1 - command! -nargs=+ HiLink hi link <args> - else - command! -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later. - HiLink sqljComment Comment - HiLink sqljKeyword sqljSpecial - HiLink sqljNumber Number - HiLink sqljOperator sqljStatement - HiLink sqljSpecial Special - HiLink sqljStatement Statement - HiLink sqljString String - HiLink sqljType Type - HiLink sqljPre PreProc - - delcommand HiLink -endif + +" The default methods for highlighting. Can be overridden later. +hi def link sqljComment Comment +hi def link sqljKeyword sqljSpecial +hi def link sqljNumber Number +hi def link sqljOperator sqljStatement +hi def link sqljSpecial Special +hi def link sqljStatement Statement +hi def link sqljString String +hi def link sqljType Type +hi def link sqljPre PreProc + let b:current_syntax = "sqlj" diff --git a/runtime/syntax/sqloracle.vim b/runtime/syntax/sqloracle.vim index f9a7c19e3b..3989b1f997 100644 --- a/runtime/syntax/sqloracle.vim +++ b/runtime/syntax/sqloracle.vim @@ -1,13 +1,18 @@ " Vim syntax file -" Language: SQL, PL/SQL (Oracle 8i) -" Maintainer: Paul Moore <pf_moore AT yahoo.co.uk> -" Last Change: 2005 Dec 23 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" Language: SQL, PL/SQL (Oracle 11g) +" Maintainer: Christian Brabandt +" Repository: https://github.com/chrisbra/vim-sqloracle-syntax +" License: Vim +" Previous Maintainer: Paul Moore +" Last Change: 2018 May 13 + +" Changes: +" 02.04.2016: Support for when keyword +" 03.04.2016: Support for join related keywords +" 22.07.2016: Support Oracle Q-Quote-Syntax +" 25.07.2016: Support for Oracle N'-Quote syntax + +if exists("b:current_syntax") finish endif @@ -15,75 +20,126 @@ syn case ignore " The SQL reserved words, defined as keywords. -syn keyword sqlSpecial false null true +syn keyword sqlSpecial false null true -syn keyword sqlKeyword access add as asc begin by check cluster column -syn keyword sqlKeyword compress connect current cursor decimal default desc +syn keyword sqlKeyword access add as asc begin by case check cluster column +syn keyword sqlKeyword cache compress connect current cursor decimal default desc syn keyword sqlKeyword else elsif end exception exclusive file for from syn keyword sqlKeyword function group having identified if immediate increment -syn keyword sqlKeyword index initial into is level loop maxextents mode modify -syn keyword sqlKeyword nocompress nowait of offline on online start -syn keyword sqlKeyword successful synonym table then to trigger uid -syn keyword sqlKeyword unique user validate values view whenever -syn keyword sqlKeyword where with option order pctfree privileges procedure +syn keyword sqlKeyword index initial initrans into is level link logging loop +syn keyword sqlKeyword maxextents maxtrans mode modify monitoring +syn keyword sqlKeyword nocache nocompress nologging noparallel nowait of offline on online start +syn keyword sqlKeyword parallel successful synonym table tablespace then to trigger uid +syn keyword sqlKeyword unique user validate values view when whenever +syn keyword sqlKeyword where with option order pctfree pctused privileges procedure syn keyword sqlKeyword public resource return row rowlabel rownum rows syn keyword sqlKeyword session share size smallint type using +syn keyword sqlKeyword join cross inner outer left right syn keyword sqlOperator not and or syn keyword sqlOperator in any some all between exists syn keyword sqlOperator like escape -syn keyword sqlOperator union intersect minus -syn keyword sqlOperator prior distinct +syn keyword sqlOperator union intersect minus +syn keyword sqlOperator prior distinct syn keyword sqlOperator sysdate out -syn keyword sqlStatement alter analyze audit comment commit create -syn keyword sqlStatement delete drop execute explain grant insert lock noaudit -syn keyword sqlStatement rename revoke rollback savepoint select set -syn keyword sqlStatement truncate update +syn keyword sqlStatement analyze audit comment commit +syn keyword sqlStatement delete drop execute explain grant lock noaudit +syn keyword sqlStatement rename revoke rollback savepoint set +syn keyword sqlStatement truncate +" next ones are contained, so folding works. +syn keyword sqlStatement create update alter select insert contained syn keyword sqlType boolean char character date float integer long syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray -" Strings and characters: -syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ +" Strings: +syn region sqlString matchgroup=Quote start=+n\?"+ skip=+\\\\\|\\"+ end=+"+ +syn region sqlString matchgroup=Quote start=+n\?'+ skip=+\\\\\|\\'+ end=+'+ +syn region sqlString matchgroup=Quote start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ +syn region sqlString matchgroup=Quote start=+n\?q'<+ end=+>'+ +syn region sqlString matchgroup=Quote start=+n\?q'{+ end=+}'+ +syn region sqlString matchgroup=Quote start=+n\?q'(+ end=+)'+ +syn region sqlString matchgroup=Quote start=+n\?q'\[+ end=+]'+ " Numbers: -syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" +syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" " Comments: -syn region sqlComment start="/\*" end="\*/" contains=sqlTodo -syn match sqlComment "--.*$" contains=sqlTodo +syn region sqlComment start="/\*" end="\*/" contains=sqlTodo,@Spell fold +syn match sqlComment "--.*$" contains=sqlTodo,@Spell + +" Setup Folding: +" this is a hack, to get certain statements folded. +" the keywords create/update/alter/select/insert need to +" have contained option. +syn region sqlFold start='^\s*\zs\c\(Create\|Update\|Alter\|Select\|Insert\)' end=';$\|^$' transparent fold contains=ALL syn sync ccomment sqlComment -" Todo. -syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE +" Functions: +" (Oracle 11g) +" Aggregate Functions +syn keyword sqlFunction avg collect corr corr_s corr_k count covar_pop covar_samp cume_dist dense_rank first +syn keyword sqlFunction group_id grouping grouping_id last max median min percentile_cont percentile_disc percent_rank rank +syn keyword sqlFunction regr_slope regr_intercept regr_count regr_r2 regr_avgx regr_avgy regr_sxx regr_syy regr_sxy +syn keyword sqlFunction stats_binomial_test stats_crosstab stats_f_test stats_ks_test stats_mode stats_mw_test +syn keyword sqlFunction stats_one_way_anova stats_t_test_one stats_t_test_paired stats_t_test_indep stats_t_test_indepu +syn keyword sqlFunction stats_wsr_test stddev stddev_pop stddev_samp sum +syn keyword sqlFunction sys_xmlagg var_pop var_samp variance xmlagg +" Char Functions +syn keyword sqlFunction ascii chr concat initcap instr length lower lpad ltrim +syn keyword sqlFunction nls_initcap nls_lower nlssort nls_upper regexp_instr regexp_replace +syn keyword sqlFunction regexp_substr replace rpad rtrim soundex substr translate treat trim upper +" Comparison Functions +syn keyword sqlFunction greatest least +" Conversion Functions +syn keyword sqlFunction asciistr bin_to_num cast chartorowid compose convert +syn keyword sqlFunction decompose hextoraw numtodsinterval numtoyminterval rawtohex rawtonhex rowidtochar +syn keyword sqlFunction rowidtonchar scn_to_timestamp timestamp_to_scn to_binary_double to_binary_float +syn keyword sqlFunction to_char to_char to_char to_clob to_date to_dsinterval to_lob to_multi_byte +syn keyword sqlFunction to_nchar to_nchar to_nchar to_nclob to_number to_dsinterval to_single_byte +syn keyword sqlFunction to_timestamp to_timestamp_tz to_yminterval to_yminterval translate unistr +" DataMining Functions +syn keyword sqlFunction cluster_id cluster_probability cluster_set feature_id feature_set +syn keyword sqlFunction feature_value prediction prediction_bounds prediction_cost +syn keyword sqlFunction prediction_details prediction_probability prediction_set +" Datetime Functions +syn keyword sqlFunction add_months current_date current_timestamp dbtimezone extract +syn keyword sqlFunction from_tz last_day localtimestamp months_between new_time +syn keyword sqlFunction next_day numtodsinterval numtoyminterval round sessiontimezone +syn keyword sqlFunction sys_extract_utc sysdate systimestamp to_char to_timestamp +syn keyword sqlFunction to_timestamp_tz to_dsinterval to_yminterval trunc tz_offset +" Numeric Functions +syn keyword sqlFunction abs acos asin atan atan2 bitand ceil cos cosh exp +syn keyword sqlFunction floor ln log mod nanvl power remainder round sign +syn keyword sqlFunction sin sinh sqrt tan tanh trunc width_bucket +" NLS Functions +syn keyword sqlFunction ls_charset_decl_len nls_charset_id nls_charset_name +" Various Functions +syn keyword sqlFunction bfilename cardin coalesce collect decode dump empty_blob empty_clob +syn keyword sqlFunction lnnvl nullif nvl nvl2 ora_hash powermultiset powermultiset_by_cardinality +syn keyword sqlFunction sys_connect_by_path sys_context sys_guid sys_typeid uid user userenv vsizeality +" XML Functions +syn keyword sqlFunction appendchildxml deletexml depth extract existsnode extractvalue insertchildxml +syn keyword sqlFunction insertxmlbefore path sys_dburigen sys_xmlagg sys_xmlgen updatexml xmlagg xmlcast +syn keyword sqlFunction xmlcdata xmlcolattval xmlcomment xmlconcat xmldiff xmlelement xmlexists xmlforest +syn keyword sqlFunction xmlparse xmlpatch xmlpi xmlquery xmlroot xmlsequence xmlserialize xmltable xmltransform +" Todo: +syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE contained " 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_sql_syn_inits") - if version < 508 - let did_sql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sqlComment Comment - HiLink sqlKeyword sqlSpecial - HiLink sqlNumber Number - HiLink sqlOperator sqlStatement - HiLink sqlSpecial Special - HiLink sqlStatement Statement - HiLink sqlString String - HiLink sqlType Type - HiLink sqlTodo Todo - - delcommand HiLink -endif +hi def link Quote Special +hi def link sqlComment Comment +hi def link sqlFunction Function +hi def link sqlKeyword sqlSpecial +hi def link sqlNumber Number +hi def link sqlOperator sqlStatement +hi def link sqlSpecial Special +hi def link sqlStatement Statement +hi def link sqlString String +hi def link sqlType Type +hi def link sqlTodo Todo let b:current_syntax = "sql" - " vim: ts=8 diff --git a/runtime/syntax/sqr.vim b/runtime/syntax/sqr.vim index 8c9e7b49e4..40b48358c6 100644 --- a/runtime/syntax/sqr.vim +++ b/runtime/syntax/sqr.vim @@ -16,19 +16,12 @@ " http://lanzarotta.tripod.com/vim.html " jefflanzarotta at yahoo dot com -" For version 5.x, clear all syntax items. -" For version 6.x, quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,-,#,$,{,} -else - set iskeyword=@,48-57,_,-,#,$,{,} -endif +setlocal iskeyword=@,48-57,_,-,#,$,{,} syn case ignore @@ -220,75 +213,49 @@ syn match sqrNumber /-\=\<\d*\.\=[0-9_]\>/ syn keyword sqrTodo TODO FIXME XXX DEBUG NOTE ### syn match sqrTodo /???/ -if version >= 600 - " See also the sqrString section above for handling of ! characters - " inside of strings. (Those patterns override the ones below.) - syn match sqrComment /!\@<!!\([^!=].*\|$\)/ contains=sqrTodo - " the ! can't be preceded by another !, - " and must be followed by at least one - " character other than ! or =, or immediately - " by the end-of-line - syn match sqrComment /^!=.*/ contains=sqrTodo - syn match sqrComment /^!!.*/ contains=sqrTodo - syn match sqrError /^\s\+\zs!=.*/ - " it's an error to have "!=" preceded by - " just whitespace on the line ("!=" - " preceded by non-whitespace is treated - " as neither a comment nor an error, since - " it is often correct, i.e. - " if #count != 7 - syn match sqrError /.\+\zs!!.*/ - " a "!!" anywhere but at the beginning of - " the line is always an error -else "For versions before 6.0, same idea as above but we are limited - "to simple patterns only. Also, the sqrString patterns above - "don't seem to take precedence in v5 as they do in v6, so - "we split the last rule to ignore comments found inside of - "string literals. - syn match sqrComment /!\([^!=].*\|$\)/ contains=sqrTodo - syn match sqrComment /^!=.*/ contains=sqrTodo - syn match sqrComment /^!!.*/ contains=sqrTodo - syn match sqrError /^\s\+!=.*/ - syn match sqrError /^[^'!]\+!!/ - " flag !! on lines that don't have ! or ' - syn match sqrError /^\([^!']*'[^']*'[^!']*\)\+!!/ - " flag !! found after matched ' ' chars - " (that aren't also commented) -endif +" See also the sqrString section above for handling of ! characters +" inside of strings. (Those patterns override the ones below.) +syn match sqrComment /!\@<!!\([^!=].*\|$\)/ contains=sqrTodo +" the ! can't be preceded by another !, +" and must be followed by at least one +" character other than ! or =, or immediately +" by the end-of-line +syn match sqrComment /^!=.*/ contains=sqrTodo +syn match sqrComment /^!!.*/ contains=sqrTodo +syn match sqrError /^\s\+\zs!=.*/ +" it's an error to have "!=" preceded by +" just whitespace on the line ("!=" +" preceded by non-whitespace is treated +" as neither a comment nor an error, since +" it is often correct, i.e. +" if #count != 7 +syn match sqrError /.\+\zs!!.*/ +" a "!!" anywhere but at the beginning of +" the line is always an error " 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_sqr_syn_inits") - if version < 508 - let did_sqr_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sqrSection Statement - HiLink sqrParagraph Statement - HiLink sqrReserved Statement - HiLink sqrParameter Statement - HiLink sqrPreProc PreProc - HiLink sqrSubstVar PreProc - HiLink sqrCommand Statement - HiLink sqrParam Type - HiLink sqrFunction Special - - HiLink sqrString String - HiLink sqrStrOpen Todo - HiLink sqrNumber Number - HiLink sqrVariable Identifier - - HiLink sqrComment Comment - HiLink sqrTodo Todo - HiLink sqrError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet. + +hi def link sqrSection Statement +hi def link sqrParagraph Statement +hi def link sqrReserved Statement +hi def link sqrParameter Statement +hi def link sqrPreProc PreProc +hi def link sqrSubstVar PreProc +hi def link sqrCommand Statement +hi def link sqrParam Type +hi def link sqrFunction Special + +hi def link sqrString String +hi def link sqrStrOpen Todo +hi def link sqrNumber Number +hi def link sqrVariable Identifier + +hi def link sqrComment Comment +hi def link sqrTodo Todo +hi def link sqrError Error + let b:current_syntax = "sqr" diff --git a/runtime/syntax/squid.vim b/runtime/syntax/squid.vim index a8462bbdce..a8abd180a0 100644 --- a/runtime/syntax/squid.vim +++ b/runtime/syntax/squid.vim @@ -7,11 +7,8 @@ " Michael Dotzler <Michael.Dotzler@leoni.com> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -123,30 +120,20 @@ syn match squidRegexOpt contained "\(^\s*acl\s\+\S\+\s\+\S\+\(_regex\|_mime_type syn sync minlines=3 " 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_squid_syntax_inits") - if version < 508 - let did_squid_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink squidTodo Todo - HiLink squidComment Comment - HiLink squidTag Special - HiLink squidConf Keyword - HiLink squidOpt Constant - HiLink squidAction String - HiLink squidNumber Number - HiLink squidIP Number - HiLink squidAcl Keyword - HiLink squidStr String - HiLink squidRegexOpt Special +hi def link squidTodo Todo +hi def link squidComment Comment +hi def link squidTag Special +hi def link squidConf Keyword +hi def link squidOpt Constant +hi def link squidAction String +hi def link squidNumber Number +hi def link squidIP Number +hi def link squidAcl Keyword +hi def link squidStr String +hi def link squidRegexOpt Special - delcommand HiLink -endif let b:current_syntax = "squid" diff --git a/runtime/syntax/srec.vim b/runtime/syntax/srec.vim new file mode 100644 index 0000000000..6ac22d9062 --- /dev/null +++ b/runtime/syntax/srec.vim @@ -0,0 +1,83 @@ +" Vim syntax file +" Language: Motorola S-Record +" Maintainer: Markus Heidelberg <markus.heidelberg@web.de> +" Last Change: 2015 Feb 24 + +" Each record (line) is built as follows: +" +" field digits states +" +" +----------+ +" | start | 1 ('S') srecRecStart +" +----------+ +" | type | 1 srecRecType, (srecRecTypeUnknown) +" +----------+ +" | count | 2 srecByteCount +" +----------+ +" | address | 4/6/8 srecNoAddress, srecDataAddress, srecRecCount, srecStartAddress, (srecAddressFieldUnknown) +" +----------+ +" | data | 0..504/502/500 srecDataOdd, srecDataEven, (srecDataUnexpected) +" +----------+ +" | checksum | 2 srecChecksum +" +----------+ +" +" States in parentheses in the upper format description indicate that they +" should not appear in a valid file. + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syn match srecRecStart "^S" + +syn match srecRecTypeUnknown "^S." contains=srecRecStart +syn match srecRecType "^S[0-35-9]" contains=srecRecStart + +syn match srecByteCount "^S.[0-9a-fA-F]\{2}" contains=srecRecTypeUnknown nextgroup=srecAddressFieldUnknown,srecChecksum +syn match srecByteCount "^S[0-35-9][0-9a-fA-F]\{2}" contains=srecRecType + +syn match srecAddressFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=srecAddressFieldUnknown,srecChecksum + +syn match srecNoAddress "^S0[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S1[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S2[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S3[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecRecCount "^S5[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecRecCount "^S6[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S7[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S8[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S9[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum + +" alternating highlight per byte for easier reading +syn match srecDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=srecDataEven,srecChecksum +syn match srecDataEven "[0-9a-fA-F]\{2}" contained nextgroup=srecDataOdd,srecChecksum +" data bytes which should not exist +syn match srecDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=srecDataUnexpected,srecChecksum +" Data digit pair regex usage also results in only highlighting the checksum +" if the number of data characters is even. + +syn match srecChecksum "[0-9a-fA-F]\{2}$" contained + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link srecRecStart srecRecType +hi def link srecRecTypeUnknown srecRecType +hi def link srecRecType WarningMsg +hi def link srecByteCount Constant +hi def srecAddressFieldUnknown term=italic cterm=italic gui=italic +hi def link srecNoAddress DiffAdd +hi def link srecDataAddress Comment +hi def link srecRecCount srecNoAddress +hi def link srecStartAddress srecDataAddress +hi def srecDataOdd term=bold cterm=bold gui=bold +hi def srecDataEven term=NONE cterm=NONE gui=NONE +hi def link srecDataUnexpected Error +hi def link srecChecksum DiffChange + + +let b:current_syntax = "srec" + +" vim: ts=8 diff --git a/runtime/syntax/sshconfig.vim b/runtime/syntax/sshconfig.vim index 6d4de6c64e..755d08e768 100644 --- a/runtime/syntax/sshconfig.vim +++ b/runtime/syntax/sshconfig.vim @@ -1,25 +1,21 @@ " Vim syntax file " Language: OpenSSH client configuration file (ssh_config) " Author: David Necas (Yeti) -" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Last Change: 2012 Feb 24 -" SSH Version: 5.9p1 +" 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> +" Contributor: Dean, Adam Kenneth <adam.ken.dean@hpe.com> +" Last Change: 2016 Dec 28 +" SSH Version: 7.4p1 " " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -if version >= 600 - setlocal iskeyword=_,-,a-z,A-Z,48-57 -else - set iskeyword=_,-,a-z,A-Z,48-57 -endif +setlocal iskeyword=_,-,a-z,A-Z,48-57 " case on @@ -34,30 +30,61 @@ 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 -syn keyword sshconfigCipher 3des blowfish -syn keyword sshconfigCiphers aes128-cbc 3des-cbc blowfish blowfish-cbc cast128-cbc -syn keyword sshconfigCiphers aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr -syn keyword sshconfigCiphers arcfour arcfour128 arcfour256 cast128-cbc +syn keyword sshconfigCipher 3des blowfish + +syn keyword sshconfigCiphers 3des-cbc +syn keyword sshconfigCiphers blowfish-cbc +syn keyword sshconfigCiphers cast128-cbc +syn keyword sshconfigCiphers arcfour +syn keyword sshconfigCiphers arcfour128 +syn keyword sshconfigCiphers arcfour256 +syn keyword sshconfigCiphers aes128-cbc +syn keyword sshconfigCiphers aes192-cbc +syn keyword sshconfigCiphers aes256-cbc +syn match sshconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>" +syn keyword sshconfigCiphers aes128-ctr +syn keyword sshconfigCiphers aes192-ctr +syn keyword sshconfigCiphers aes256-ctr +syn match sshconfigCiphers "\<aes128-gcm@openssh\.com\>" +syn match sshconfigCiphers "\<aes256-gcm@openssh\.com\>" +syn match sshconfigCiphers "\<chacha20-poly1305@openssh\.com\>" -syn keyword sshconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96 -syn keyword sshconfigMAC hmac-md5-96 -syn keyword sshconfigMAC hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512 -syn keyword sshconfigMAC hmac-sha2-512-96 +syn keyword sshconfigMAC hmac-sha1 +syn keyword sshconfigMAC mac-sha1-96 +syn keyword sshconfigMAC mac-sha2-256 +syn keyword sshconfigMAC mac-sha2-512 +syn keyword sshconfigMAC mac-md5 +syn keyword sshconfigMAC mac-md5-96 +syn keyword sshconfigMAC mac-ripemd160 +syn match sshconfigMAC "\<hmac-ripemd160@openssh\.com\>" syn match sshconfigMAC "\<umac-64@openssh\.com\>" +syn match sshconfigMAC "\<umac-128@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha1-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-md5-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-md5-96-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>" +syn match sshconfigMAC "\<umac-64-etm@openssh\.com\>" +syn match sshconfigMAC "\<umac-128-etm@openssh\.com\>" -syn keyword sshconfigHostKeyAlg ssh-rsa ssh-dss -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v00@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v00@openssh\.com\>" -syn keyword sshconfigHostKeyAlg ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 +syn keyword sshconfigHostKeyAlgo ssh-ed25519 +syn match sshconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>" +syn keyword sshconfigHostKeyAlgo ssh-rsa +syn keyword sshconfigHostKeyAlgo ssh-dss +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp256 +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp384 +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp521 +syn match sshconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" syn keyword sshconfigPreferredAuth hostbased publickey password gssapi-with-mic syn keyword sshconfigPreferredAuth keyboard-interactive @@ -68,19 +95,22 @@ syn keyword sshconfigSysLogFacility DAEMON USER AUTH AUTHPRIV LOCAL0 LOCAL1 syn keyword sshconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshconfigAddressFamily inet inet6 -syn match sshconfigIPQoS "af1[1234]" -syn match sshconfigIPQoS "af2[23]" +syn match sshconfigIPQoS "af1[123]" +syn match sshconfigIPQoS "af2[123]" syn match sshconfigIPQoS "af3[123]" syn match sshconfigIPQoS "af4[123]" syn match sshconfigIPQoS "cs[0-7]" syn keyword sshconfigIPQoS ef lowdelay throughput reliability syn keyword sshconfigKbdInteractive bsdauth pam skey -syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 -syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256 -syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1 -syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1 -syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp384 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp521 +syn match sshconfigKexAlgo "\<curve25519-sha256@libssh\.org\>" syn keyword sshconfigTunnel point-to-point ethernet @@ -100,9 +130,17 @@ syn case ignore " Keywords 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 +syn keyword sshconfigKeyword CanonicalizeFallbackLocal +syn keyword sshconfigKeyword CanonicalizeHostname +syn keyword sshconfigKeyword CanonicalizeMaxDots +syn keyword sshconfigKeyword CertificateFile syn keyword sshconfigKeyword ChallengeResponseAuthentication syn keyword sshconfigKeyword CheckHostIP syn keyword sshconfigKeyword Cipher @@ -138,9 +176,13 @@ syn keyword sshconfigKeyword HostKeyAlgorithms syn keyword sshconfigKeyword HostKeyAlias syn keyword sshconfigKeyword HostName syn keyword sshconfigKeyword HostbasedAuthentication +syn keyword sshconfigKeyword HostbasedKeyTypes syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword IdentitiesOnly syn keyword sshconfigKeyword IdentityFile +syn keyword sshconfigKeyword IgnoreUnknown +syn keyword sshconfigKeyword Include +syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword KbdInteractiveAuthentication syn keyword sshconfigKeyword KbdInteractiveDevices syn keyword sshconfigKeyword KexAlgorithms @@ -148,6 +190,7 @@ syn keyword sshconfigKeyword LocalCommand syn keyword sshconfigKeyword LocalForward syn keyword sshconfigKeyword LogLevel syn keyword sshconfigKeyword MACs +syn keyword sshconfigKeyword Match syn keyword sshconfigKeyword NoHostAuthenticationForLocalhost syn keyword sshconfigKeyword NumberOfPasswordPrompts syn keyword sshconfigKeyword PKCS11Provider @@ -157,6 +200,9 @@ syn keyword sshconfigKeyword Port syn keyword sshconfigKeyword PreferredAuthentications syn keyword sshconfigKeyword Protocol syn keyword sshconfigKeyword ProxyCommand +syn keyword sshconfigKeyword ProxyJump +syn keyword sshconfigKeyword ProxyUseFDPass +syn keyword sshconfigKeyword PubkeyAcceptedKeyTypes syn keyword sshconfigKeyword PubkeyAuthentication syn keyword sshconfigKeyword RSAAuthentication syn keyword sshconfigKeyword RekeyLimit @@ -175,44 +221,37 @@ syn keyword sshconfigKeyword UseBlacklistedKeys syn keyword sshconfigKeyword UsePrivilegedPort syn keyword sshconfigKeyword User syn keyword sshconfigKeyword UserKnownHostsFile +syn keyword sshconfigKeyword UseRoaming syn keyword sshconfigKeyword VerifyHostKeyDNS syn keyword sshconfigKeyword VisualHostKey syn keyword sshconfigKeyword XAuthLocation " Define the default highlighting -if version >= 508 || !exists("did_sshconfig_syntax_inits") - if version < 508 - let did_sshconfig_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sshconfigComment Comment - HiLink sshconfigTodo Todo - HiLink sshconfigHostPort sshconfigConstant - HiLink sshconfigNumber sshconfigConstant - HiLink sshconfigConstant Constant - HiLink sshconfigYesNo sshconfigEnum - HiLink sshconfigCipher sshconfigEnum - HiLink sshconfigCiphers sshconfigEnum - HiLink sshconfigMAC sshconfigEnum - HiLink sshconfigHostKeyAlg sshconfigEnum - HiLink sshconfigLogLevel sshconfigEnum - HiLink sshconfigSysLogFacility sshconfigEnum - HiLink sshconfigAddressFamily sshconfigEnum - HiLink sshconfigIPQoS sshconfigEnum - HiLink sshconfigKbdInteractive sshconfigEnum - HiLink sshconfigKexAlgo sshconfigEnum - HiLink sshconfigTunnel sshconfigEnum - HiLink sshconfigPreferredAuth sshconfigEnum - HiLink sshconfigVar sshconfigEnum - HiLink sshconfigEnum Identifier - HiLink sshconfigSpecial Special - HiLink sshconfigKeyword Keyword - HiLink sshconfigHostSect Type - delcommand HiLink -endif + +hi def link sshconfigComment Comment +hi def link sshconfigTodo Todo +hi def link sshconfigHostPort sshconfigConstant +hi def link sshconfigNumber sshconfigConstant +hi def link sshconfigConstant Constant +hi def link sshconfigYesNo sshconfigEnum +hi def link sshconfigCipher sshconfigEnum +hi def link sshconfigCiphers sshconfigEnum +hi def link sshconfigMAC sshconfigEnum +hi def link sshconfigHostKeyAlgo sshconfigEnum +hi def link sshconfigLogLevel sshconfigEnum +hi def link sshconfigSysLogFacility sshconfigEnum +hi def link sshconfigAddressFamily sshconfigEnum +hi def link sshconfigIPQoS sshconfigEnum +hi def link sshconfigKbdInteractive sshconfigEnum +hi def link sshconfigKexAlgo sshconfigEnum +hi def link sshconfigTunnel sshconfigEnum +hi def link sshconfigPreferredAuth sshconfigEnum +hi def link sshconfigVar sshconfigEnum +hi def link sshconfigEnum Identifier +hi def link sshconfigSpecial Special +hi def link sshconfigKeyword Keyword +hi def link sshconfigHostSect Type +hi def link sshconfigMatch Type let b:current_syntax = "sshconfig" diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim index 53bc09de0d..3924aaf94a 100644 --- a/runtime/syntax/sshdconfig.vim +++ b/runtime/syntax/sshdconfig.vim @@ -1,27 +1,22 @@ " Vim syntax file " Language: OpenSSH server configuration file (sshd_config) -" Maintainer: David Necas (Yeti) -" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Modified By: Thilo Six +" Author: David Necas (Yeti) +" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de> +" Contributor: Thilo Six +" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> +" Contributor: Karsten Hopp <karsten@redhat.com> " Originally: 2009-07-09 -" Last Change: 2011 Oct 31 -" SSH Version: 5.9p1 +" Last Change: 2017 Oct 25 +" SSH Version: 7.6p1 " " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif -if version >= 600 - setlocal iskeyword=_,-,a-z,A-Z,48-57 -else - set iskeyword=_,-,a-z,A-Z,48-57 -endif +setlocal iskeyword=_,-,a-z,A-Z,48-57 " case on @@ -39,17 +34,63 @@ syn keyword sshdconfigYesNo yes no none syn keyword sshdconfigAddressFamily any inet inet6 -syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc -syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr -syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc +syn keyword sshdconfigPrivilegeSeparation sandbox + +syn keyword sshdconfigTcpForwarding local remote + +syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only + +syn keyword sshdconfigCiphers 3des-cbc +syn keyword sshdconfigCiphers blowfish-cbc +syn keyword sshdconfigCiphers cast128-cbc +syn keyword sshdconfigCiphers arcfour +syn keyword sshdconfigCiphers arcfour128 +syn keyword sshdconfigCiphers arcfour256 +syn keyword sshdconfigCiphers aes128-cbc +syn keyword sshdconfigCiphers aes192-cbc +syn keyword sshdconfigCiphers aes256-cbc +syn match sshdconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>" +syn keyword sshdconfigCiphers aes128-ctr +syn keyword sshdconfigCiphers aes192-ctr +syn keyword sshdconfigCiphers aes256-ctr +syn match sshdconfigCiphers "\<aes128-gcm@openssh\.com\>" +syn match sshdconfigCiphers "\<aes256-gcm@openssh\.com\>" +syn match sshdconfigCiphers "\<chacha20-poly1305@openssh\.com\>" -syn keyword sshdconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96 -syn keyword sshdconfigMAC hmac-md5-96 -syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512 -syn keyword sshdconfigMAC hmac-sha2-512-96 +syn keyword sshdconfigMAC hmac-sha1 +syn keyword sshdconfigMAC mac-sha1-96 +syn keyword sshdconfigMAC mac-sha2-256 +syn keyword sshdconfigMAC mac-sha2-512 +syn keyword sshdconfigMAC mac-md5 +syn keyword sshdconfigMAC mac-md5-96 +syn keyword sshdconfigMAC mac-ripemd160 +syn match sshdconfigMAC "\<hmac-ripemd160@openssh\.com\>" syn match sshdconfigMAC "\<umac-64@openssh\.com\>" +syn match sshdconfigMAC "\<umac-128@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha1-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-md5-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-md5-96-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>" +syn match sshdconfigMAC "\<umac-64-etm@openssh\.com\>" +syn match sshdconfigMAC "\<umac-128-etm@openssh\.com\>" -syn keyword sshdconfigRootLogin without-password forced-commands-only +syn keyword sshdconfigHostKeyAlgo ssh-ed25519 +syn match sshdconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>" +syn keyword sshdconfigHostKeyAlgo ssh-rsa +syn keyword sshdconfigHostKeyAlgo ssh-dss +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp256 +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp384 +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp521 +syn match sshdconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" + +syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only syn keyword sshdconfigLogLevel QUIET FATAL ERROR INFO VERBOSE syn keyword sshdconfigLogLevel DEBUG DEBUG1 DEBUG2 DEBUG3 @@ -58,18 +99,21 @@ syn keyword sshdconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshdconfigCompression delayed -syn match sshdconfigIPQoS "af1[1234]" -syn match sshdconfigIPQoS "af2[23]" +syn match sshdconfigIPQoS "af1[123]" +syn match sshdconfigIPQoS "af2[123]" syn match sshdconfigIPQoS "af3[123]" syn match sshdconfigIPQoS "af4[123]" syn match sshdconfigIPQoS "cs[0-7]" syn keyword sshdconfigIPQoS ef lowdelay throughput reliability -syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 -syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256 -syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1 -syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1 -syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp384 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp521 +syn match sshdconfigKexAlgo "\<curve25519-sha256@libssh\.org\>" syn keyword sshdconfigTunnel point-to-point ethernet @@ -99,9 +143,13 @@ syn keyword sshdconfigKeyword AcceptEnv syn keyword sshdconfigKeyword AddressFamily syn keyword sshdconfigKeyword AllowAgentForwarding syn keyword sshdconfigKeyword AllowGroups +syn keyword sshdconfigKeyword AllowStreamLocalForwarding syn keyword sshdconfigKeyword AllowTcpForwarding syn keyword sshdconfigKeyword AllowUsers +syn keyword sshdconfigKeyword AuthenticationMethods syn keyword sshdconfigKeyword AuthorizedKeysFile +syn keyword sshdconfigKeyword AuthorizedKeysCommand +syn keyword sshdconfigKeyword AuthorizedKeysCommandUser syn keyword sshdconfigKeyword AuthorizedPrincipalsFile syn keyword sshdconfigKeyword Banner syn keyword sshdconfigKeyword ChallengeResponseAuthentication @@ -113,6 +161,7 @@ syn keyword sshdconfigKeyword Compression syn keyword sshdconfigKeyword DebianBanner syn keyword sshdconfigKeyword DenyGroups syn keyword sshdconfigKeyword DenyUsers +syn keyword sshdconfigKeyword DisableForwarding syn keyword sshdconfigKeyword ForceCommand syn keyword sshdconfigKeyword GSSAPIAuthentication syn keyword sshdconfigKeyword GSSAPICleanupCredentials @@ -122,6 +171,9 @@ syn keyword sshdconfigKeyword GSSAPIStrictAcceptorCheck syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword HostCertificate syn keyword sshdconfigKeyword HostKey +syn keyword sshdconfigKeyword HostKeyAgent +syn keyword sshdconfigKeyword HostKeyAlgorithms +syn keyword sshdconfigKeyword HostbasedAcceptedKeyTypes syn keyword sshdconfigKeyword HostbasedAuthentication syn keyword sshdconfigKeyword HostbasedUsesNameFromPacketOnly syn keyword sshdconfigKeyword IPQoS @@ -147,15 +199,19 @@ syn keyword sshdconfigKeyword PermitBlacklistedKeys syn keyword sshdconfigKeyword PermitEmptyPasswords syn keyword sshdconfigKeyword PermitOpen syn keyword sshdconfigKeyword PermitRootLogin +syn keyword sshdconfigKeyword PermitTTY syn keyword sshdconfigKeyword PermitTunnel syn keyword sshdconfigKeyword PermitUserEnvironment +syn keyword sshdconfigKeyword PermitUserRC syn keyword sshdconfigKeyword PidFile syn keyword sshdconfigKeyword Port syn keyword sshdconfigKeyword PrintLastLog syn keyword sshdconfigKeyword PrintMotd syn keyword sshdconfigKeyword Protocol +syn keyword sshdconfigKeyword PubkeyAcceptedKeyTypes syn keyword sshdconfigKeyword PubkeyAuthentication syn keyword sshdconfigKeyword RSAAuthentication +syn keyword sshdconfigKeyword RekeyLimit syn keyword sshdconfigKeyword RevokedKeys syn keyword sshdconfigKeyword RhostsRSAAuthentication syn keyword sshdconfigKeyword ServerKeyBits @@ -168,7 +224,7 @@ syn keyword sshdconfigKeyword TrustedUserCAKeys syn keyword sshdconfigKeyword UseDNS syn keyword sshdconfigKeyword UseLogin syn keyword sshdconfigKeyword UsePAM -syn keyword sshdconfigKeyword UsePrivilegeSeparation +syn keyword sshdconfigKeyword VersionAddendum syn keyword sshdconfigKeyword X11DisplayOffset syn keyword sshdconfigKeyword X11Forwarding syn keyword sshdconfigKeyword X11UseLocalhost @@ -176,39 +232,34 @@ syn keyword sshdconfigKeyword XAuthLocation " Define the default highlighting -if version >= 508 || !exists("did_sshdconfig_syntax_inits") - if version < 508 - let did_sshdconfig_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sshdconfigComment Comment - HiLink sshdconfigTodo Todo - HiLink sshdconfigHostPort sshdconfigConstant - HiLink sshdconfigTime sshdconfigConstant - HiLink sshdconfigNumber sshdconfigConstant - HiLink sshdconfigConstant Constant - HiLink sshdconfigYesNo sshdconfigEnum - HiLink sshdconfigAddressFamily sshdconfigEnum - HiLink sshdconfigCipher sshdconfigEnum - HiLink sshdconfigMAC sshdconfigEnum - HiLink sshdconfigRootLogin sshdconfigEnum - HiLink sshdconfigLogLevel sshdconfigEnum - HiLink sshdconfigSysLogFacility sshdconfigEnum - HiLink sshdconfigVar sshdconfigEnum - HiLink sshdconfigCompression sshdconfigEnum - HiLink sshdconfigIPQoS sshdconfigEnum - HiLink sshdconfigKexAlgo sshdconfigEnum - HiLink sshdconfigTunnel sshdconfigEnum - HiLink sshdconfigSubsystem sshdconfigEnum - HiLink sshdconfigEnum Function - HiLink sshdconfigSpecial Special - HiLink sshdconfigKeyword Keyword - HiLink sshdconfigMatch Type - delcommand HiLink -endif + +hi def link sshdconfigComment Comment +hi def link sshdconfigTodo Todo +hi def link sshdconfigHostPort sshdconfigConstant +hi def link sshdconfigTime sshdconfigConstant +hi def link sshdconfigNumber sshdconfigConstant +hi def link sshdconfigConstant Constant +hi def link sshdconfigYesNo sshdconfigEnum +hi def link sshdconfigAddressFamily sshdconfigEnum +hi def link sshdconfigPrivilegeSeparation sshdconfigEnum +hi def link sshdconfigTcpForwarding sshdconfigEnum +hi def link sshdconfigRootLogin sshdconfigEnum +hi def link sshdconfigCiphers sshdconfigEnum +hi def link sshdconfigMAC sshdconfigEnum +hi def link sshdconfigHostKeyAlgo sshdconfigEnum +hi def link sshdconfigRootLogin sshdconfigEnum +hi def link sshdconfigLogLevel sshdconfigEnum +hi def link sshdconfigSysLogFacility sshdconfigEnum +hi def link sshdconfigVar sshdconfigEnum +hi def link sshdconfigCompression sshdconfigEnum +hi def link sshdconfigIPQoS sshdconfigEnum +hi def link sshdconfigKexAlgo sshdconfigEnum +hi def link sshdconfigTunnel sshdconfigEnum +hi def link sshdconfigSubsystem sshdconfigEnum +hi def link sshdconfigEnum Function +hi def link sshdconfigSpecial Special +hi def link sshdconfigKeyword Keyword +hi def link sshdconfigMatch Type let b:current_syntax = "sshdconfig" diff --git a/runtime/syntax/st.vim b/runtime/syntax/st.vim index 47aa07de5d..8160c7704a 100644 --- a/runtime/syntax/st.vim +++ b/runtime/syntax/st.vim @@ -3,11 +3,8 @@ " Maintainer: Arndt Hesse <hesse@self.de> " Last Change: 2012 Feb 12 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -77,30 +74,20 @@ hi link stBlockError stError syn sync minlines=50 " 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_st_syntax_inits") - if version < 508 - let did_st_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink stKeyword Statement - HiLink stMethod Statement - HiLink stComment Comment - HiLink stCharacter Constant - HiLink stString Constant - HiLink stSymbol Special - HiLink stNumber Type - HiLink stFloat Type - HiLink stError Error - HiLink stLocalVariables Identifier - HiLink stBlockVariable Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link stKeyword Statement +hi def link stMethod Statement +hi def link stComment Comment +hi def link stCharacter Constant +hi def link stString Constant +hi def link stSymbol Special +hi def link stNumber Type +hi def link stFloat Type +hi def link stError Error +hi def link stLocalVariables Identifier +hi def link stBlockVariable Identifier + let b:current_syntax = "st" diff --git a/runtime/syntax/stata.vim b/runtime/syntax/stata.vim index e1f19c84fc..29f5052ebe 100644 --- a/runtime/syntax/stata.vim +++ b/runtime/syntax/stata.vim @@ -12,9 +12,8 @@ " 26apr2006 fixed brace confusion in stataErrInParen and stataErrInBracket " fixed paren/bracket confusion in stataFuncGroup -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/stp.vim b/runtime/syntax/stp.vim index f4f0f3b615..2992d8be47 100644 --- a/runtime/syntax/stp.vim +++ b/runtime/syntax/stp.vim @@ -4,11 +4,8 @@ " URL: http://lanzarotta.tripod.com/vim/syntax/stp.vim.zip " Last Change: March 05, 2002 -" For version 5.x, clear all syntax items. -" For version 6.x, quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -131,36 +128,26 @@ syn match stpParenError ")" syn sync minlines=10 maxlines=100 " Define the default highlighting. -" For version 5.x and earlier, only when not done already. -" For version 5.8 and later, only when and item doesn't have highlighting yet. -if version >= 508 || !exists("did_stp_syn_inits") - if version < 508 - let did_stp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink stpConditional Conditional - HiLink stpComment Comment - HiLink stpKeyword Keyword - HiLink stpNumber Number - HiLink stpOperator Operator - HiLink stpSpecial Special - HiLink stpStatement Statement - HiLink stpString String - HiLink stpStringError Error - HiLink stpType Type - HiLink stpTodo Todo - HiLink stpFunction Function - HiLink stpGlobals Macro - HiLink stpParen Normal - HiLink stpParenError Error - HiLink stpSQLKeyword Function - HiLink stpRepeat Repeat - - delcommand HiLink -endif +" Only when and item doesn't have highlighting yet. + +hi def link stpConditional Conditional +hi def link stpComment Comment +hi def link stpKeyword Keyword +hi def link stpNumber Number +hi def link stpOperator Operator +hi def link stpSpecial Special +hi def link stpStatement Statement +hi def link stpString String +hi def link stpStringError Error +hi def link stpType Type +hi def link stpTodo Todo +hi def link stpFunction Function +hi def link stpGlobals Macro +hi def link stpParen Normal +hi def link stpParenError Error +hi def link stpSQLKeyword Function +hi def link stpRepeat Repeat + let b:current_syntax = "stp" diff --git a/runtime/syntax/strace.vim b/runtime/syntax/strace.vim index 80cd262efc..206c58919e 100644 --- a/runtime/syntax/strace.vim +++ b/runtime/syntax/strace.vim @@ -1,23 +1,19 @@ " Vim syntax file " This is a GENERATED FILE. Please always refer to source file at the URI below. " Language: strace output -" Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz> -" Last Change: 2002-10-10 -" URL: http://trific.ath.cx/Ftp/vim/syntax/strace.vim +" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz> +" Last Change: 2015-01-16 " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case match " Parse the line -syn match straceSpecialChar "\\\d\d\d\|\\." contained +syn match straceSpecialChar "\\\o\{1,3}\|\\." contained syn region straceString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=straceSpecialChar oneline syn match straceNumber "\W[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="lc=1 syn match straceNumber "\W0x\x\+"lc=1 @@ -36,31 +32,22 @@ syn match straceOperator "[-+=*/!%&|:,]" syn region straceComment start="/\*" end="\*/" oneline " Define the default highlighting -if version >= 508 || !exists("did_strace_syntax_inits") - if version < 508 - let did_strace_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink straceComment Comment - HiLink straceVerbosed Comment - HiLink stracePID PreProc - HiLink straceNumber Number - HiLink straceNumberRHS Type - HiLink straceOtherRHS Type - HiLink straceString String - HiLink straceConstant Function - HiLink straceEquals Type - HiLink straceSysCallEmbed straceSysCall - HiLink straceSysCall Statement - HiLink straceParenthesis Statement - HiLink straceOperator Normal - HiLink straceSpecialChar Special - HiLink straceOtherPID PreProc +hi def link straceComment Comment +hi def link straceVerbosed Comment +hi def link stracePID PreProc +hi def link straceNumber Number +hi def link straceNumberRHS Type +hi def link straceOtherRHS Type +hi def link straceString String +hi def link straceConstant Function +hi def link straceEquals Type +hi def link straceSysCallEmbed straceSysCall +hi def link straceSysCall Statement +hi def link straceParenthesis Statement +hi def link straceOperator Normal +hi def link straceSpecialChar Special +hi def link straceOtherPID PreProc - delcommand HiLink -endif let b:current_syntax = "strace" diff --git a/runtime/syntax/sudoers.vim b/runtime/syntax/sudoers.vim index fffc1cf8bb..df1eb99b42 100644 --- a/runtime/syntax/sudoers.vim +++ b/runtime/syntax/sudoers.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sudoers(5) configuration files -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-02-24 +" Language: sudoers(5) configuration files +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-02-24 if exists("b:current_syntax") finish diff --git a/runtime/syntax/svn.vim b/runtime/syntax/svn.vim index 6536d6d11c..6239790f12 100644 --- a/runtime/syntax/svn.vim +++ b/runtime/syntax/svn.vim @@ -15,11 +15,8 @@ " Myk Taylor " Stefano Zacchiroli -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif @@ -42,28 +39,18 @@ syn sync clear syn sync match svnSync grouphere svnRegion "^--.*--$"me=s-1 " 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_svn_syn_inits") - if version <= 508 - let did_svn_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet. - HiLink svnSummary Keyword - HiLink svnBlank Error +hi def link svnSummary Keyword +hi def link svnBlank Error - HiLink svnRegion Comment - HiLink svnDelimiter NonText - HiLink svnRemoved Constant - HiLink svnAdded Identifier - HiLink svnModified Special - HiLink svnProperty Special - HiLink svnRenamed Special +hi def link svnRegion Comment +hi def link svnDelimiter NonText +hi def link svnRemoved Constant +hi def link svnAdded Identifier +hi def link svnModified Special +hi def link svnProperty Special +hi def link svnRenamed Special - delcommand HiLink -endif let b:current_syntax = "svn" diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim index 48b5956b3c..ab918c645b 100644 --- a/runtime/syntax/synload.vim +++ b/runtime/syntax/synload.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Sep 25 +" Last Change: 2016 Nov 04 " This file sets up for syntax highlighting. " It is loaded from "syntax.vim" and "manual.vim". @@ -60,8 +60,8 @@ fun! s:SynSet() endfun -" Handle adding doxygen to other languages (C, C++, C#, IDL) -au Syntax c,cpp,cs,idl,php +" Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript) +au Syntax c,cpp,cs,idl,java,php,datascript \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax) \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax) \ | runtime! syntax/doxygen.vim @@ -69,8 +69,11 @@ au Syntax c,cpp,cs,idl,php " Source the user-specified syntax highlighting file -if exists("mysyntaxfile") && filereadable(expand(mysyntaxfile)) - execute "source " . mysyntaxfile +if exists("mysyntaxfile") + let s:fname = expand(mysyntaxfile) + if filereadable(s:fname) + execute "source " . fnameescape(s:fname) + endif endif " Restore 'cpoptions' diff --git a/runtime/syntax/sysctl.vim b/runtime/syntax/sysctl.vim index 748054fd73..d99ac01835 100644 --- a/runtime/syntax/sysctl.vim +++ b/runtime/syntax/sysctl.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sysctl.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-05-02 +" Language: sysctl.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-05-02 if exists("b:current_syntax") finish diff --git a/runtime/syntax/systemd.vim b/runtime/syntax/systemd.vim new file mode 100644 index 0000000000..5dfba74408 --- /dev/null +++ b/runtime/syntax/systemd.vim @@ -0,0 +1,8 @@ +" Vim syntax file +" Language: systemd.unit(5) + +if !exists('b:current_syntax') + " Looks a lot like dosini files. + runtime! syntax/dosini.vim + let b:current_syntax = 'systemd' +endif diff --git a/runtime/syntax/systemverilog.vim b/runtime/syntax/systemverilog.vim index 5bf2935078..f99ea8d889 100644 --- a/runtime/syntax/systemverilog.vim +++ b/runtime/syntax/systemverilog.vim @@ -3,21 +3,14 @@ " Maintainer: kocha <kocha.lsifrontend@gmail.com> " Last Change: 12-Aug-2013. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read in Verilog syntax files -if version < 600 - so <sfile>:p:h/verilog.vim -else - runtime! syntax/verilog.vim - unlet b:current_syntax -endif +runtime! syntax/verilog.vim +unlet b:current_syntax " IEEE1800-2005 syn keyword systemverilogStatement always_comb always_ff always_latch @@ -76,25 +69,16 @@ syn keyword systemverilogStatement implements syn keyword systemverilogStatement interconnect soft nettype " Define the default highlighting. -if version >= 508 || !exists("did_systemverilog_syn_inits") - if version < 508 - let did_systemverilog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - " The default highlighting. - HiLink systemverilogStatement Statement - HiLink systemverilogTypeDef TypeDef - HiLink systemverilogConditional Conditional - HiLink systemverilogRepeat Repeat - HiLink systemverilogLabel Label - HiLink systemverilogGlobal Define - HiLink systemverilogNumber Number +" The default highlighting. +hi def link systemverilogStatement Statement +hi def link systemverilogTypeDef TypeDef +hi def link systemverilogConditional Conditional +hi def link systemverilogRepeat Repeat +hi def link systemverilogLabel Label +hi def link systemverilogGlobal Define +hi def link systemverilogNumber Number - delcommand HiLink -endif let b:current_syntax = "systemverilog" diff --git a/runtime/syntax/tads.vim b/runtime/syntax/tads.vim index 260ff360f7..23a65b99ec 100644 --- a/runtime/syntax/tads.vim +++ b/runtime/syntax/tads.vim @@ -13,11 +13,8 @@ " Actually, should cvtstr etc. be functions?! (change tadsFunction) " Make global etc. into Identifiers, since we don't have regular variables? -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -122,57 +119,47 @@ endif execute "syn sync maxlines=" . tads_sync_dist " 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_tads_syn_inits") - if version < 508 - let did_tads_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - HiLink tadsFunctionDef Function - HiLink tadsFunction Structure - HiLink tadsClass Structure - HiLink tadsClassDef Identifier - HiLink tadsObjectDef Identifier +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +hi def link tadsFunctionDef Function +hi def link tadsFunction Structure +hi def link tadsClass Structure +hi def link tadsClassDef Identifier +hi def link tadsObjectDef Identifier " no highlight for tadsEmbedded, so it prints as normal text w/in the string - HiLink tadsOperator Operator - HiLink tadsStructure Structure - HiLink tadsTodo Todo - HiLink tadsLabel Label - HiLink tadsConditional Conditional - HiLink tadsRepeat Repeat - HiLink tadsException Exception - HiLink tadsStatement Statement - HiLink tadsStorageClass StorageClass - HiLink tadsKeyWord Keyword - HiLink tadsSpecial SpecialChar - HiLink tadsNumber Number - HiLink tadsBoolean Boolean - HiLink tadsDoubleString tadsString - HiLink tadsSingleString tadsString - - HiLink tadsOctalError tadsError - HiLink tadsCommentError tadsError - HiLink tadsBraceError tadsError - HiLink tadsInBrace tadsError - HiLink tadsError Error - - HiLink tadsInclude Include - HiLink tadsPreProc PreProc - HiLink tadsDefine Macro - HiLink tadsIncluded tadsString - HiLink tadsPreCondit PreCondit - - HiLink tadsString String - HiLink tadsComment Comment - - delcommand HiLink -endif +hi def link tadsOperator Operator +hi def link tadsStructure Structure +hi def link tadsTodo Todo +hi def link tadsLabel Label +hi def link tadsConditional Conditional +hi def link tadsRepeat Repeat +hi def link tadsException Exception +hi def link tadsStatement Statement +hi def link tadsStorageClass StorageClass +hi def link tadsKeyWord Keyword +hi def link tadsSpecial SpecialChar +hi def link tadsNumber Number +hi def link tadsBoolean Boolean +hi def link tadsDoubleString tadsString +hi def link tadsSingleString tadsString + +hi def link tadsOctalError tadsError +hi def link tadsCommentError tadsError +hi def link tadsBraceError tadsError +hi def link tadsInBrace tadsError +hi def link tadsError Error + +hi def link tadsInclude Include +hi def link tadsPreProc PreProc +hi def link tadsDefine Macro +hi def link tadsIncluded tadsString +hi def link tadsPreCondit PreCondit + +hi def link tadsString String +hi def link tadsComment Comment + let b:current_syntax = "tads" diff --git a/runtime/syntax/tags.vim b/runtime/syntax/tags.vim index 051d65aa6e..f34696d4b0 100644 --- a/runtime/syntax/tags.vim +++ b/runtime/syntax/tags.vim @@ -1,47 +1,31 @@ " Language: tags -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchip@PcampbellAfamily.Mbiz> -" Last Change: Sep 06, 2005 -" Version: 3 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Maintainer: Charles E. Campbell <NdrOchip@PcampbellAfamily.Mbiz> +" Last Change: Oct 26, 2016 +" Version: 7 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TAGS -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -syn match tagName "^[^\t]\+" skipwhite nextgroup=tagPath -syn match tagPath "[^\t]\+" contained skipwhite nextgroup=tagAddr contains=tagBaseFile +syn match tagName "^[^\t]\+" skipwhite nextgroup=tagPath +syn match tagPath "[^\t]\+" contained skipwhite nextgroup=tagAddr contains=tagBaseFile syn match tagBaseFile "[a-zA-Z_]\+[\.a-zA-Z_0-9]*\t"me=e-1 contained -syn match tagAddr "\d*" contained skipwhite nextgroup=tagComment -syn region tagAddr matchgroup=tagDelim start="/" skip="\(\\\\\)*\\/" matchgroup=tagDelim end="$\|/" oneline contained skipwhite nextgroup=tagComment -syn match tagComment ";.*$" contained contains=tagField +syn match tagAddr "\d*" contained skipwhite nextgroup=tagComment +syn region tagAddr matchgroup=tagDelim start="/" skip="\(\\\\\)*\\/" matchgroup=tagDelim end="$\|/" oneline contained skipwhite nextgroup=tagComment +syn match tagComment ";.*$" contained contains=tagField syn match tagComment "^!_TAG_.*$" -syn match tagField contained "[a-z]*:" +syn match tagField contained "[a-z]*:" " 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_drchip_tags_inits") - if version < 508 - let did_drchip_tags_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tagBaseFile PreProc - HiLink tagComment Comment - HiLink tagDelim Delimiter - HiLink tagField Number - HiLink tagName Identifier - HiLink tagPath PreProc - - delcommand HiLink +if !exists("skip_drchip_tags_inits") + hi def link tagBaseFile PreProc + hi def link tagComment Comment + hi def link tagDelim Delimiter + hi def link tagField Number + hi def link tagName Identifier + hi def link tagPath PreProc endif let b:current_syntax = "tags" - -" vim: ts=12 diff --git a/runtime/syntax/tak.vim b/runtime/syntax/tak.vim index 20186db143..7a8fceb860 100644 --- a/runtime/syntax/tak.vim +++ b/runtime/syntax/tak.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -32,11 +29,7 @@ syn case ignore let fortran_free_source=1 " Load FORTRAN syntax file -if version < 600 - source <sfile>:p:h/fortran.vim -else - runtime! syntax/fortran.vim -endif +runtime! syntax/fortran.vim unlet b:current_syntax @@ -95,40 +88,30 @@ endif " 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_tak_syntax_inits") - if version < 508 - let did_tak_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink takMacro Macro - HiLink takOptions Special - HiLink takRoutine Type - HiLink takControl Special - HiLink takSolids Special - HiLink takSolidsArg Statement - HiLink takIdentifier Identifier - - HiLink takFortran PreProc - HiLink takMotran PreProc - - HiLink takComment Comment - HiLink takHeader Typedef - HiLink takIncludeFile Type - HiLink takInteger Number - HiLink takFloat Float - HiLink takScientific Float - - HiLink takEndData Macro - - HiLink takTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link takMacro Macro +hi def link takOptions Special +hi def link takRoutine Type +hi def link takControl Special +hi def link takSolids Special +hi def link takSolidsArg Statement +hi def link takIdentifier Identifier + +hi def link takFortran PreProc +hi def link takMotran PreProc + +hi def link takComment Comment +hi def link takHeader Typedef +hi def link takIncludeFile Type +hi def link takInteger Number +hi def link takFloat Float +hi def link takScientific Float + +hi def link takEndData Macro + +hi def link takTodo Todo + let b:current_syntax = "tak" diff --git a/runtime/syntax/takcmp.vim b/runtime/syntax/takcmp.vim index a94609b325..9426e02223 100644 --- a/runtime/syntax/takcmp.vim +++ b/runtime/syntax/takcmp.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -51,30 +48,20 @@ syn case ignore " 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_takcmp_syntax_inits") - if version < 508 - let did_takcmp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink takcmpTitle Type - HiLink takcmpUnit PreProc +hi def link takcmpTitle Type +hi def link takcmpUnit PreProc - HiLink takcmpLabel Statement +hi def link takcmpLabel Statement - HiLink takcmpHeader takHeader +hi def link takcmpHeader takHeader - HiLink takcmpDate Identifier - HiLink takcmpTime Identifier - HiLink takcmpInteger Number - HiLink takcmpFloat Special +hi def link takcmpDate Identifier +hi def link takcmpTime Identifier +hi def link takcmpInteger Number +hi def link takcmpFloat Special - delcommand HiLink -endif let b:current_syntax = "takcmp" diff --git a/runtime/syntax/takout.vim b/runtime/syntax/takout.vim index 774353942a..5e5d360767 100644 --- a/runtime/syntax/takout.vim +++ b/runtime/syntax/takout.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -24,11 +21,7 @@ syn case match " Load TAK syntax file -if version < 600 - source <sfile>:p:h/tak.vim -else - runtime! syntax/tak.vim -endif +runtime! syntax/tak.vim unlet b:current_syntax @@ -70,31 +63,21 @@ syn match takoutError "<<< Error >>>" " 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_takout_syntax_inits") - if version < 508 - let did_takout_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink takoutPos Statement - HiLink takoutNeg PreProc - HiLink takoutTitle Type - HiLink takoutFile takIncludeFile - HiLink takoutInteger takInteger - - HiLink takoutSectionDelim Delimiter - HiLink takoutSectionTitle Exception - HiLink takoutHeaderDelim SpecialComment - HiLink takoutLabel Identifier - - HiLink takoutError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link takoutPos Statement +hi def link takoutNeg PreProc +hi def link takoutTitle Type +hi def link takoutFile takIncludeFile +hi def link takoutInteger takInteger + +hi def link takoutSectionDelim Delimiter +hi def link takoutSectionTitle Exception +hi def link takoutHeaderDelim SpecialComment +hi def link takoutLabel Identifier + +hi def link takoutError Error + let b:current_syntax = "takout" diff --git a/runtime/syntax/tap.vim b/runtime/syntax/tap.vim new file mode 100644 index 0000000000..db37bb8980 --- /dev/null +++ b/runtime/syntax/tap.vim @@ -0,0 +1,97 @@ +" Vim syntax file +" Language: Verbose TAP Output +" Maintainer: Rufus Cable <rufus@threebytesfull.com> +" Remark: Simple syntax highlighting for TAP output +" License: +" Copyright: (c) 2008-2013 Rufus Cable +" Last Change: 2014-12-13 + +if exists("b:current_syntax") + finish +endif + +syn match tapTestDiag /^ *#.*/ contains=tapTestTodo +syn match tapTestTime /^ *\[\d\d:\d\d:\d\d\].*/ contains=tapTestFile +syn match tapTestFile /\w\+\/[^. ]*/ contained +syn match tapTestFileWithDot /\w\+\/[^ ]*/ contained + +syn match tapTestPlan /^ *\d\+\.\.\d\+$/ + +" tapTest is a line like 'ok 1', 'not ok 2', 'ok 3 - xxxx' +syn match tapTest /^ *\(not \)\?ok \d\+.*/ contains=tapTestStatusOK,tapTestStatusNotOK,tapTestLine + +" tapTestLine is the line without the ok/not ok status - i.e. number and +" optional message +syn match tapTestLine /\d\+\( .*\|$\)/ contains=tapTestNumber,tapTestLoadMessage,tapTestTodo,tapTestSkip contained + +" turn ok/not ok messages green/red respectively +syn match tapTestStatusOK /ok/ contained +syn match tapTestStatusNotOK /not ok/ contained + +" highlight todo tests +syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev +syn match tapTestTodoRev /\<TODO\>/ contained + +" highlight skipped tests +syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag +syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained + +" look behind so "ok 123" and "not ok 124" match test number +syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained +syn match tapTestLoadMessage /\*\*\*.*\*\*\*/ contained contains=tapTestThreeStars,tapTestFileWithDot +syn match tapTestThreeStars /\*\*\*/ contained + +syn region tapTestRegion start=/^ *\(not \)\?ok.*$/me=e+1 end=/^\(\(not \)\?ok\|# Looks like you planned \|All tests successful\|Bailout called\)/me=s-1 fold transparent excludenl +syn region tapTestResultsOKRegion start=/^\(All tests successful\|Result: PASS\)/ end=/$/ +syn region tapTestResultsNotOKRegion start=/^\(# Looks like you planned \|Bailout called\|# Looks like you failed \|Result: FAIL\)/ end=/$/ +syn region tapTestResultsSummaryRegion start=/^Test Summary Report/ end=/^Files=.*$/ contains=tapTestResultsSummaryHeading,tapTestResultsSummaryNotOK + +syn region tapTestResultsSummaryHeading start=/^Test Summary Report/ end=/^-\+$/ contained +syn region tapTestResultsSummaryNotOK start=/TODO passed:/ end=/$/ contained + +syn region tapTestInstructionsRegion start=/\%1l/ end=/^$/ + +set foldtext=TAPTestLine_foldtext() +function! TAPTestLine_foldtext() + let line = getline(v:foldstart) + let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g') + return sub +endfunction + +set foldminlines=5 +set foldcolumn=2 +set foldenable +set foldmethod=syntax +syn sync fromstart + +if !exists("did_tapverboseoutput_syntax_inits") + let did_tapverboseoutput_syntax_inits = 1 + + hi tapTestStatusOK term=bold ctermfg=green guifg=Green + hi tapTestStatusNotOK term=reverse ctermfg=black ctermbg=red guifg=Black guibg=Red + hi tapTestTodo term=bold ctermfg=yellow ctermbg=black guifg=Yellow guibg=Black + hi tapTestTodoRev term=reverse ctermfg=black ctermbg=yellow guifg=Black guibg=Yellow + hi tapTestSkip term=bold ctermfg=lightblue guifg=LightBlue + hi tapTestSkipTag term=reverse ctermfg=black ctermbg=lightblue guifg=Black guibg=LightBlue + hi tapTestTime term=bold ctermfg=blue guifg=Blue + hi tapTestFile term=reverse ctermfg=black ctermbg=yellow guibg=Black guifg=Yellow + hi tapTestLoadedFile term=bold ctermfg=black ctermbg=cyan guibg=Cyan guifg=Black + hi tapTestThreeStars term=reverse ctermfg=blue guifg=Blue + hi tapTestPlan term=bold ctermfg=yellow guifg=Yellow + + hi link tapTestFileWithDot tapTestLoadedFile + hi link tapTestNumber Number + hi link tapTestDiag Comment + + hi tapTestRegion ctermbg=green + + hi tapTestResultsOKRegion ctermbg=green ctermfg=black + hi tapTestResultsNotOKRegion ctermbg=red ctermfg=black + + hi tapTestResultsSummaryHeading ctermbg=blue ctermfg=white + hi tapTestResultsSummaryNotOK ctermbg=red ctermfg=black + + hi tapTestInstructionsRegion ctermbg=lightmagenta ctermfg=black +endif + +let b:current_syntax="tapVerboseOutput" diff --git a/runtime/syntax/taskdata.vim b/runtime/syntax/taskdata.vim index b37c70cc1f..63a8284adf 100644 --- a/runtime/syntax/taskdata.vim +++ b/runtime/syntax/taskdata.vim @@ -4,11 +4,8 @@ " Updated: Wed Jul 8 19:46:20 EDT 2009 -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo diff --git a/runtime/syntax/taskedit.vim b/runtime/syntax/taskedit.vim index 170153c0ee..d33ca78650 100644 --- a/runtime/syntax/taskedit.vim +++ b/runtime/syntax/taskedit.vim @@ -4,11 +4,8 @@ " Updated: Wed Jul 8 19:46:32 EDT 2009 -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded. +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo diff --git a/runtime/syntax/tasm.vim b/runtime/syntax/tasm.vim index 2f8559610e..c9fc8186d0 100644 --- a/runtime/syntax/tasm.vim +++ b/runtime/syntax/tasm.vim @@ -3,11 +3,8 @@ " Maintaner: FooLman of United Force <foolman@bigfoot.com> " Last Change: 2012 Feb 03 by Thilo Six -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -95,32 +92,22 @@ syn match tasmOct "\<[0-7]\+O\>" syn match tasmBin "\<[01]\+B\>" " 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_tasm_syntax_inits") - if version < 508 - let did_tasm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink tasmString String - HiLink tasmDec Number - HiLink tasmHex Number - HiLink tasmOct Number - HiLink tasmBin Number - HiLink tasmInstruction Keyword - HiLink tasmCoprocInstr Keyword - HiLink tasmMMXInst Keyword - HiLink tasmDirective PreProc - HiLink tasmRegister Identifier - HiLink tasmProctype PreProc - HiLink tasmComment Comment - HiLink tasmLabel Label +hi def link tasmString String +hi def link tasmDec Number +hi def link tasmHex Number +hi def link tasmOct Number +hi def link tasmBin Number +hi def link tasmInstruction Keyword +hi def link tasmCoprocInstr Keyword +hi def link tasmMMXInst Keyword +hi def link tasmDirective PreProc +hi def link tasmRegister Identifier +hi def link tasmProctype PreProc +hi def link tasmComment Comment +hi def link tasmLabel Label - delcommand HiLink -endif let b:curret_syntax = "tasm" diff --git a/runtime/syntax/tcl.vim b/runtime/syntax/tcl.vim index 3c598267dc..04dbbd2af0 100644 --- a/runtime/syntax/tcl.vim +++ b/runtime/syntax/tcl.vim @@ -10,11 +10,8 @@ " Version: 1.14 " URL: http://bitbucket.org/taylor_venable/metasyntax/src/tip/Config/vim/syntax/tcl.vim -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -238,49 +235,39 @@ syn region tclComment start=/;\s*\#/hs=s+1 skip="\\$" end="$" contains=tclTodo "syn sync ccomment tclComment " 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_tcl_syntax_inits") - if version < 508 - let did_tcl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tcltkSwitch Special - HiLink tclExpand Special - HiLink tclLabel Label - HiLink tclConditional Conditional - HiLink tclRepeat Repeat - HiLink tclNumber Number - HiLink tclError Error - HiLink tclCommand Statement - HiLink tclProcCommand Type - HiLink tclString String - HiLink tclComment Comment - HiLink tclSpecial Special - HiLink tclTodo Todo - " Below here are the commands and their options. - HiLink tcltkCommandColor Statement - HiLink tcltkWidgetColor Structure - HiLink tclLineContinue WarningMsg +" Only when an item doesn't have highlighting yet + +hi def link tcltkSwitch Special +hi def link tclExpand Special +hi def link tclLabel Label +hi def link tclConditional Conditional +hi def link tclRepeat Repeat +hi def link tclNumber Number +hi def link tclError Error +hi def link tclCommand Statement +hi def link tclProcCommand Type +hi def link tclString String +hi def link tclComment Comment +hi def link tclSpecial Special +hi def link tclTodo Todo +" Below here are the commands and their options. +hi def link tcltkCommandColor Statement +hi def link tcltkWidgetColor Structure +hi def link tclLineContinue WarningMsg if exists('g:tcl_warn_continuation') - HiLink tclNotLineContinue ErrorMsg -endif - HiLink tcltkStringSwitch Special - HiLink tcltkArraySwitch Special - HiLink tcltkLsortSwitch Special - HiLink tcltkPackSwitch Special - HiLink tcltkPackConfSwitch Special - HiLink tcltkMaths Special - HiLink tcltkNamespaceSwitch Special - HiLink tcltkWidgetSwitch Special - HiLink tcltkPackConfColor Identifier - HiLink tclVarRef Identifier - - delcommand HiLink +hi def link tclNotLineContinue ErrorMsg endif +hi def link tcltkStringSwitch Special +hi def link tcltkArraySwitch Special +hi def link tcltkLsortSwitch Special +hi def link tcltkPackSwitch Special +hi def link tcltkPackConfSwitch Special +hi def link tcltkMaths Special +hi def link tcltkNamespaceSwitch Special +hi def link tcltkWidgetSwitch Special +hi def link tcltkPackConfColor Identifier +hi def link tclVarRef Identifier + let b:current_syntax = "tcl" diff --git a/runtime/syntax/teraterm.vim b/runtime/syntax/teraterm.vim new file mode 100644 index 0000000000..1924996738 --- /dev/null +++ b/runtime/syntax/teraterm.vim @@ -0,0 +1,139 @@ +" Vim syntax file +" Language: Tera Term Language (TTL) +" Based on Tera Term Version 4.92 +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-teraterm +" Last Change: 2016 Aug 17 +" Filenames: *.ttl +" License: VIM License + +if exists("b:current_syntax") + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +syn case ignore + +syn region ttlComment start=";" end="$" contains=@Spell +syn region ttlComment start="/\*" end="\*/" contains=@Spell +syn region ttlFirstComment start="/\*" end="\*/" contained contains=@Spell + \ nextgroup=ttlStatement,ttlFirstComment + +syn match ttlCharacter "#\%(\d\+\|\$\x\+\)\>" +syn match ttlNumber "\%(\<\d\+\|\$\x\+\)\>" +syn match ttlString "'[^']*'" contains=@Spell +syn match ttlString '"[^"]*"' contains=@Spell +syn cluster ttlConstant contains=ttlCharacter,ttlNumber,ttlString + +syn match ttlLabel ":\s*\w\{1,32}\>" + +syn keyword ttlOperator and or xor not + +syn match ttlVar "\<groupmatchstr\d\>" +syn match ttlVar "\<param\d\>" +syn keyword ttlVar inputstr matchstr paramcnt params result timeout mtimeout + + +syn match ttlLine nextgroup=ttlStatement "^" +syn match ttlStatement contained "\s*" + \ nextgroup=ttlIf,ttlElseIf,ttlConditional,ttlRepeat, + \ ttlFirstComment,ttlComment,ttlLabel,@ttlCommand + +syn cluster ttlCommand contains=ttlControlCommand,ttlCommunicationCommand, + \ ttlStringCommand,ttlFileCommand,ttlPasswordCommand, + \ ttlMiscCommand + + +syn keyword ttlIf contained nextgroup=ttlIfExpression if +syn keyword ttlElseIf contained nextgroup=ttlElseIfExpression elseif + +syn match ttlIfExpression contained "\s.*" + \ contains=@ttlConstant,ttlVar,ttlOperator,ttlComment,ttlThen, + \ @ttlCommand +syn match ttlElseIfExpression contained "\s.*" + \ contains=@ttlConstant,ttlVar,ttlOperator,ttlComment,ttlThen + +syn keyword ttlThen contained then +syn keyword ttlConditional contained else endif + +syn keyword ttlRepeat contained for next until enduntil while endwhile +syn match ttlRepeat contained + \ "\<\%(do\|loop\)\%(\s\+\%(while\|until\)\)\?\>" +syn keyword ttlControlCommand contained + \ break call continue end execcmnd exit goto include + \ mpause pause return + + +syn keyword ttlCommunicationCommand contained + \ bplusrecv bplussend callmenu changedir clearscreen + \ closett connect cygconnect disconnect dispstr + \ enablekeyb flushrecv gethostname getmodemstatus + \ gettitle kmtfinish kmtget kmtrecv kmtsend loadkeymap + \ logautoclosemode logclose loginfo logopen logpause + \ logrotate logstart logwrite quickvanrecv + \ quickvansend recvln restoresetup scprecv scpsend + \ send sendbreak sendbroadcast sendfile sendkcode + \ sendln sendlnbroadcast sendmulticast setbaud + \ setdebug setdtr setecho setmulticastname setrts + \ setsync settitle showtt testlink unlink wait + \ wait4all waitevent waitln waitn waitrecv waitregex + \ xmodemrecv xmodemsend ymodemrecv ymodemsend + \ zmodemrecv zmodemsend +syn keyword ttlStringCommand contained + \ code2str expandenv int2str regexoption sprintf + \ sprintf2 str2code str2int strcompare strconcat + \ strcopy strinsert strjoin strlen strmatch strremove + \ strreplace strscan strspecial strsplit strtrim + \ tolower toupper +syn keyword ttlFileCommand contained + \ basename dirname fileclose fileconcat filecopy + \ filecreate filedelete filelock filemarkptr fileopen + \ filereadln fileread filerename filesearch fileseek + \ fileseekback filestat filestrseek filestrseek2 + \ filetruncate fileunlock filewrite filewriteln + \ findfirst findnext findclose foldercreate + \ folderdelete foldersearch getdir getfileattr makepath + \ setdir setfileattr +syn keyword ttlPasswordCommand contained + \ delpassword getpassword ispassword passwordbox + \ setpassword +syn keyword ttlMiscCommand contained + \ beep bringupbox checksum8 checksum8file checksum16 + \ checksum16file checksum32 checksum32file closesbox + \ clipb2var crc16 crc16file crc32 crc32file exec + \ dirnamebox filenamebox getdate getenv getipv4addr + \ getipv6addr getspecialfolder gettime getttdir getver + \ ifdefined inputbox intdim listbox messagebox random + \ rotateleft rotateright setdate setdlgpos setenv + \ setexitcode settime show statusbox strdim uptime + \ var2clipb yesnobox + + +hi def link ttlCharacter Character +hi def link ttlNumber Number +hi def link ttlComment Comment +hi def link ttlFirstComment Comment +hi def link ttlString String +hi def link ttlLabel Label +hi def link ttlIf Conditional +hi def link ttlElseIf Conditional +hi def link ttlThen Conditional +hi def link ttlConditional Conditional +hi def link ttlRepeat Repeat +hi def link ttlControlCommand Keyword +hi def link ttlVar Identifier +hi def link ttlOperator Operator +hi def link ttlCommunicationCommand Keyword +hi def link ttlStringCommand Keyword +hi def link ttlFileCommand Keyword +hi def link ttlPasswordCommand Keyword +hi def link ttlMiscCommand Keyword + +let b:current_syntax = "teraterm" + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/syntax/terminfo.vim b/runtime/syntax/terminfo.vim index 0ea112ad47..2b0ab0860a 100644 --- a/runtime/syntax/terminfo.vim +++ b/runtime/syntax/terminfo.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: terminfo(5) definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: terminfo(5) definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 31114bc093..d5f900ae5c 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Mar 20, 2014 -" Version: 81 +" Last Change: Mar 30, 2018 +" Version: 109 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -40,32 +40,14 @@ " using conceal mode :help tex-conceal " Version Clears: {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:keepcpo= &cpo set cpo&vim scriptencoding utf-8 -" Define the default highlighting. {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_tex_syntax_inits") - let did_tex_syntax_inits = 1 - if version < 508 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif -endif -if exists("g:tex_no_error") && g:tex_no_error - let s:tex_no_error= 1 -endif - " by default, enable all region-based highlighting let s:tex_fast= "bcmMprsSvV" if exists("g:tex_fast") @@ -76,9 +58,6 @@ if exists("g:tex_fast") else let s:tex_fast= g:tex_fast endif - let s:tex_no_error= 1 -else - let s:tex_fast= "bcmMprsSvV" endif " let user determine which classes of concealment will be supported @@ -88,6 +67,16 @@ if !exists("g:tex_conceal") else let s:tex_conceal= g:tex_conceal endif +if !exists("g:tex_superscripts") + let s:tex_superscripts= '[0-9a-zA-W.,:;+-<>/()=]' +else + let s:tex_superscripts= g:tex_superscripts +endif +if !exists("g:tex_subscripts") + let s:tex_subscripts= '[0-9aehijklmnoprstuvx,+-/().]' +else + let s:tex_subscripts= g:tex_subscripts +endif " Determine whether or not to use "*.sty" mode {{{1 " The user may override the normal determination by setting @@ -107,61 +96,91 @@ endif " handle folding {{{1 if !exists("g:tex_fold_enabled") - let g:tex_fold_enabled= 0 + let s:tex_fold_enabled= 0 elseif g:tex_fold_enabled && !has("folding") - let g:tex_fold_enabled= 0 + let s:tex_fold_enabled= 0 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" +else + let s:tex_fold_enabled= 1 endif -if g:tex_fold_enabled && &fdm == "manual" +if s:tex_fold_enabled && &fdm == "manual" setl fdm=syntax endif +if s:tex_fold_enabled && has("folding") + com! -nargs=* TexFold <args> fold +else + com! -nargs=* TexFold <args> +endif " (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1 " but _ is the only one that causes problems. " One may override this iskeyword setting by providing " g:tex_isk if exists("g:tex_isk") - exe "setlocal isk=".g:tex_isk + if b:tex_stylish && g:tex_isk !~ '@' + let b:tex_isk= '@,'.g:tex_isk + else + let b:tex_isk= g:tex_isk + endif +elseif b:tex_stylish + let b:tex_isk="@,48-57,a-z,A-Z,192-255" else - setlocal isk=48-57,a-z,A-Z,192-255 + let b:tex_isk="48-57,a-z,A-Z,192-255" endif -if b:tex_stylish - setlocal isk+=@-@ +if v:version > 704 || (v:version == 704 && has("patch-7.4.1142")) + exe "syn iskeyword ".b:tex_isk +else + exe "setl isk=".b:tex_isk +endif +if exists("g:tex_no_error") && g:tex_no_error + let s:tex_no_error= 1 +else + let s:tex_no_error= 0 endif -if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell") - let g:tex_comment_nospell= 1 +if exists("g:tex_comment_nospell") && g:tex_comment_nospell + let s:tex_comment_nospell= 1 +else + let s:tex_comment_nospell= 0 +endif +if exists("g:tex_nospell") && g:tex_nospell + let s:tex_nospell = 1 +else + let s:tex_nospell = 0 endif " Clusters: {{{1 " -------- -syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle -if !exists("s:tex_no_error") - syn cluster texCmdGroup add=texMathError +syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,@texMathZones +if !s:tex_no_error + syn cluster texCmdGroup add=texMathError endif -syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement -syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell -syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell -syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell -if !exists("g:tex_nospell") || !g:tex_nospell - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher +syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement +syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell +syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell +syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell +if !s:tex_nospell + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell + syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher else - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption + syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher endif -syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ -syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter -if !exists("tex_no_math") - syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ - syn cluster texMatchGroup add=@texMathZones - syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 - syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone - syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle - if !exists("s:tex_no_error") - syn cluster texMathMatchGroup add=texMathError - syn cluster texMathZoneGroup add=texMathError +syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ +syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter +if !exists("g:tex_no_math") + syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ + syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ + syn cluster texMatchGroup add=@texMathZones + syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 + syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone + syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle + if !s:tex_no_error + syn cluster texMathMatchGroup add=texMathError + syn cluster texMathZoneGroup add=texMathError endif - syn cluster texMathZoneGroup add=@NoSpell + syn cluster texMathZoneGroup add=@NoSpell " following used in the \part \chapter \section \subsection \subsubsection " \paragraph \subparagraph \author \title highlighting syn cluster texDocGroup contains=texPartZone,@texPartGroup @@ -172,35 +191,39 @@ if !exists("tex_no_math") syn cluster texSubSubSectionGroup contains=texParaZone syn cluster texParaGroup contains=texSubParaZone if has("conceal") && &enc == 'utf-8' - syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol - syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol + syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol + syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol endif endif " Try to flag {} and () mismatches: {{{1 -if s:tex_fast =~ 'm' - if !exists("s:tex_no_error") - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError - syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell +if s:tex_fast =~# 'm' + if !s:tex_no_error + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell + syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup,texError + syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup,texError,@NoSpell else - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup - syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup + syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup + syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup endif - if !exists("g:tex_nospell") || !g:tex_nospell - syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell + if !s:tex_nospell + syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell else - syn region texParen start="(" end=")" contains=@texMatchGroup + syn region texParen start="(" end=")" transparent contains=@texMatchGroup endif endif -if !exists("s:tex_no_error") +if !s:tex_no_error syn match texError "[}\])]" endif -if s:tex_fast =~ 'M' - if !exists("tex_no_math") - if !exists("s:tex_no_error") +if s:tex_fast =~# 'M' + if !exists("g:tex_no_math") + if !s:tex_no_error syn match texMathError "}" contained endif - syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup + syn region texMathMatcher matchgroup=Delimiter start="{" skip="\%(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup endif endif @@ -211,7 +234,7 @@ if exists("g:tex_tex") || b:tex_stylish syn match texStatement "\\[a-zA-Z@]\+" else syn match texStatement "\\\a\+" - if !exists("s:tex_no_error") + if !s:tex_no_error syn match texError "\\\a*@[a-zA-Z@]*" endif endif @@ -219,7 +242,6 @@ endif " TeX/LaTeX delimiters: {{{1 syn match texDelimiter "&" syn match texDelimiter "\\\\" -syn match texDelimiter "[{}]" " Tex/Latex Options: {{{1 syn match texOption "[^\\]\zs#\d\+\|^#\d\+" @@ -237,21 +259,22 @@ syn match texAccent +\\[=^.\~"`']+ syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" + " \begin{}/\end{} section markers: {{{1 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName -if s:tex_fast =~ 'm' - syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment - syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell +if s:tex_fast =~# 'm' + syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment + syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@texMathZones,@NoSpell endif " \documentclass, \documentstyle, \usepackage: {{{1 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell endif " Preamble syntax-based folding support: {{{1 -if g:tex_fold_enabled && has("folding") +if s:tex_fold_enabled && has("folding") syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup endif @@ -260,7 +283,7 @@ syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatemen syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt syn match texInputCurlies "[{}]" contained -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment endif @@ -275,7 +298,7 @@ syn match texTypeStyle "\\sc\>" syn match texTypeStyle "\\tt\>" " Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1 -if s:tex_conceal !~ 'b' +if s:tex_conceal !~# 'b' syn match texTypeStyle "\\textbf\>" syn match texTypeStyle "\\textit\>" endif @@ -328,91 +351,72 @@ syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup= syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained " Sections, subsections, etc: {{{1 -if s:tex_fast =~ 'p' - if !exists("g:tex_nospell") || !g:tex_nospell - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell - endif - else - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup - endif +if s:tex_fast =~# 'p' + if !s:tex_nospell + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell + else + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup endif endif " particular support for bold and italic {{{1 -if s:tex_fast =~ 'b' - if s:tex_conceal =~ 'b' - syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup - syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup +if s:tex_fast =~# 'b' + if s:tex_conceal =~# 'b' + if !exists("g:tex_nospell") || !g:tex_nospell + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell + else + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup + endif endif endif " Bad Math (mismatched): {{{1 -if !exists("g:tex_no_math") && !exists("s:tex_no_error") - syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" - syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" +if !exists("g:tex_no_math") && !s:tex_no_error + syn match texBadMath "\\end\s*{\s*\(array\|[bBpvV]matrix\|split\|smallmatrix\)\s*}" + syn match texBadMath "\\end\s*{\s*\(displaymath\|equation\|eqnarray\|math\)\*\=\s*}" syn match texBadMath "\\[\])]" endif " Math Zones: {{{1 -if !exists("tex_no_math") +if !exists("g:tex_no_math") " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2 " Starred forms are created if starform is true. Starred " forms have syntax group and synchronization groups with a - " "S" appended. Handles: cluster, syntax, sync, and HiLink. + " "S" appended. Handles: cluster, syntax, sync, and highlighting. fun! TexNewMathZone(sfx,mathzone,starform) let grpname = "texMathZone".a:sfx let syncname = "texSyncMathZone".a:sfx - if g:tex_fold_enabled + if s:tex_fold_enabled let foldcmd= " fold" else let foldcmd= "" endif exe "syn cluster texMathZones add=".grpname - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' @@ -422,7 +426,7 @@ if !exists("tex_no_math") let grpname = "texMathZone".a:sfx.'S' let syncname = "texSyncMathZone".a:sfx.'S' exe "syn cluster texMathZones add=".grpname - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' @@ -432,39 +436,31 @@ if !exists("tex_no_math") endfun " Standard Math Zones: {{{2 - call TexNewMathZone("A","align",1) - call TexNewMathZone("B","alignat",1) - call TexNewMathZone("C","displaymath",1) - call TexNewMathZone("D","eqnarray",1) - call TexNewMathZone("E","equation",1) - call TexNewMathZone("F","flalign",1) - call TexNewMathZone("G","gather",1) - call TexNewMathZone("H","math",1) - call TexNewMathZone("I","multline",1) - call TexNewMathZone("J","subequations",0) - call TexNewMathZone("K","xalignat",1) - call TexNewMathZone("L","xxalignat",0) + call TexNewMathZone("A","displaymath",1) + call TexNewMathZone("B","eqnarray",1) + call TexNewMathZone("C","equation",1) + call TexNewMathZone("D","math",1) " Inline Math Zones: {{{2 - if s:tex_fast =~ 'M' - if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd' - syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup - syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup - syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup - syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup + if s:tex_fast =~# 'M' + if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'd' + syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup + syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup + syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup + syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend concealends contains=@texMathZoneGroup else - syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup - syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup - syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup - syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup + syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup + syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup + syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup + syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup endif - syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup + syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup endif syn match texMathOper "[_^=]" contained " Text Inside Math Zones: {{{2 - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' if !exists("g:tex_nospell") || !g:tex_nospell syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell else @@ -474,9 +470,10 @@ if !exists("tex_no_math") " \left..something.. and \right..something.. support: {{{2 syn match texMathDelimBad contained "\S" - if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm' - syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={ - syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=} + if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'm' + syn match texMathDelim contained "\\left\[" + syn match texMathDelim contained "\\left\\{" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={ + syn match texMathDelim contained "\\right\\}" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=} let s:texMathDelimList=[ \ ['<' , '<'] , \ ['>' , '>'] , @@ -491,13 +488,11 @@ if !exists("tex_no_math") \ ['\\backslash' , '\'] , \ ['\\downarrow' , '↓'] , \ ['\\Downarrow' , '⇓'] , - \ ['\\langle' , '<'] , \ ['\\lbrace' , '['] , \ ['\\lceil' , '⌈'] , \ ['\\lfloor' , '⌊'] , \ ['\\lgroup' , '⌊'] , \ ['\\lmoustache' , '⎛'] , - \ ['\\rangle' , '>'] , \ ['\\rbrace' , ']'] , \ ['\\rceil' , '⌉'] , \ ['\\rfloor' , '⌋'] , @@ -507,6 +502,15 @@ if !exists("tex_no_math") \ ['\\Uparrow' , '↑'] , \ ['\\updownarrow', '↕'] , \ ['\\Updownarrow', '⇕']] + if &ambw == "double" || exists("g:tex_usedblwidth") + let s:texMathDelimList= s:texMathDelimList + [ + \ ['\\langle' , '〈'] , + \ ['\\rangle' , '〉']] + else + let s:texMathDelimList= s:texMathDelimList + [ + \ ['\\langle' , '<'] , + \ ['\\rangle' , '>']] + endif syn match texMathDelim '\\[bB]igg\=[lr]' contained nextgroup=texMathDelimBad for texmath in s:texMathDelimList exe "syn match texMathDelim '\\\\[bB]igg\\=[lr]\\=".texmath[0]."' contained conceal cchar=".texmath[1] @@ -535,11 +539,11 @@ else syn match texSpecialChar "\\[SP@]\A"me=e-1 endif syn match texSpecialChar "\\\\" -if !exists("tex_no_math") +if !exists("g:tex_no_math") syn match texOnlyMath "[_^]" endif syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S" -if s:tex_conceal !~ 'S' +if s:tex_conceal !~# 'S' syn match texSpecialChar '\\glq\>' contained conceal cchar=‚ syn match texSpecialChar '\\grq\>' contained conceal cchar=‘ syn match texSpecialChar '\\glqq\>' contained conceal cchar=„ @@ -550,7 +554,7 @@ endif " Comments: {{{1 " Normal TeX LaTeX : %.... " Documented TeX Format: ^^A... -and- leading %s (only) -if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell +if !s:tex_comment_nospell syn cluster texCommentGroup contains=texTodo,@Spell else syn cluster texCommentGroup contains=texTodo,@NoSpell @@ -559,60 +563,57 @@ syn case ignore syn keyword texTodo contained combak fixme todo xxx syn case match if s:extfname == "dtx" - syn match texComment "\^\^A.*$" contains=@texCommentGroup - syn match texComment "^%\+" contains=@texCommentGroup + syn match texComment "\^\^A.*$" contains=@texCommentGroup + syn match texComment "^%\+" contains=@texCommentGroup else - if g:tex_fold_enabled - " allows syntax-folding of 2 or more contiguous comment lines - " single-line comments are not folded - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold - syn region texNoSpell contained fold matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - endif - else - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - endif + if s:tex_fold_enabled + " allows syntax-folding of 2 or more contiguous comment lines + " single-line comments are not folded + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~# 'c' + TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' contains=@texCommentGroup + TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell + endif + else + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~# 'c' + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell endif + endif +endif + +" %begin-include ... %end-include acts like a texDocZone for \include'd files. Permits spell checking, for example, in such files. +if !s:tex_nospell + TexFold syn region texDocZone matchgroup=texSection start='^\s*%begin-include\>' end='^\s*%end-include\>' contains=@texFoldGroup,@texDocGroup,@Spell +else + TexFold syn region texDocZone matchgroup=texSection start='^\s*%begin-include\>' end='^\s*%end-include\>' contains=@texFoldGroup,@texDocGroup endif " Separate lines used for verb` and verb# so that the end conditions {{{1 " will appropriately terminate. " If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there. -if s:tex_fast =~ 'v' +if s:tex_fast =~# 'v' if exists("g:tex_verbspell") && g:tex_verbspell syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell " listings package: syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell - if version < 600 - syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell - syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell + if b:tex_stylish + syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell else - if b:tex_stylish - syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell - else - syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell - endif + syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell endif else syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" - if version < 600 - syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" - syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" + if b:tex_stylish + syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" else - if b:tex_stylish - syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" - else - syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" - endif + syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" endif endif endif " Tex Reference Zones: {{{1 -if s:tex_fast =~ 'r' +if s:tex_fast =~# 'r' syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup @@ -620,19 +621,19 @@ if s:tex_fast =~ 'r' syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite - syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite + syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite endif syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite " Handle newcommand, newenvironment : {{{1 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl -if s:tex_fast =~ 'V' +if s:tex_fast =~# 'V' syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup endif syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl -if s:tex_fast =~ 'V' +if s:tex_fast =~# 'V' syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup @@ -657,12 +658,12 @@ syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\ syn match texString "\(``\|''\|,,\)" " makeatletter -- makeatother sections -if !exists("s:tex_no_error") - if s:tex_fast =~ 'S' +if !s:tex_no_error + if s:tex_fast =~# 'S' syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained endif syn match texStyleStatement "\\[a-zA-Z@]\+" contained - if s:tex_fast =~ 'S' + if s:tex_fast =~# 'S' syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained endif @@ -673,7 +674,7 @@ if has("conceal") && &enc == 'utf-8' " Math Symbols {{{2 " (many of these symbols were contributed by Björn Winckler) - if s:tex_conceal =~ 'm' + if s:tex_conceal =~# 'm' let s:texMathList=[ \ ['|' , '‖'], \ ['aleph' , 'ℵ'], @@ -687,6 +688,7 @@ if has("conceal") && &enc == 'utf-8' \ ['backslash' , '∖'], \ ['barwedge' , '⊼'], \ ['because' , '∵'], + \ ['beth' , 'ܒ'], \ ['between' , '≬'], \ ['bigcap' , '∩'], \ ['bigcirc' , '○'], @@ -706,6 +708,7 @@ if has("conceal") && &enc == 'utf-8' \ ['boxminus' , '⊟'], \ ['boxplus' , '⊞'], \ ['boxtimes' , '⊠'], + \ ['Box' , '☐'], \ ['bullet' , '•'], \ ['bumpeq' , '≏'], \ ['Bumpeq' , '≎'], @@ -755,6 +758,7 @@ if has("conceal") && &enc == 'utf-8' \ ['eqslantgtr' , '⪖'], \ ['eqslantless' , '⪕'], \ ['equiv' , '≡'], + \ ['eth' , 'ð'], \ ['exists' , '∃'], \ ['fallingdotseq' , '≒'], \ ['flat' , '♭'], @@ -764,6 +768,7 @@ if has("conceal") && &enc == 'utf-8' \ ['geq' , '≥'], \ ['geqq' , '≧'], \ ['gets' , '←'], + \ ['gimel' , 'ℷ'], \ ['gg' , '⟫'], \ ['gneqq' , '≩'], \ ['gtrdot' , '⋗'], @@ -774,13 +779,17 @@ if has("conceal") && &enc == 'utf-8' \ ['heartsuit' , '♡'], \ ['hookleftarrow' , '↩'], \ ['hookrightarrow' , '↪'], + \ ['iff' , '⇔'], \ ['iiint' , '∭'], \ ['iint' , '∬'], \ ['Im' , 'ℑ'], \ ['imath' , 'ɩ'], + \ ['implies' , '⇒'], \ ['in' , '∈'], \ ['infty' , '∞'], \ ['int' , '∫'], + \ ['jmath' , '𝚥'], + \ ['land' , '∧'], \ ['lceil' , '⌈'], \ ['ldots' , '…'], \ ['le' , '≤'], @@ -788,8 +797,8 @@ if has("conceal") && &enc == 'utf-8' \ ['left(' , '('], \ ['left\[' , '['], \ ['left\\{' , '{'], - \ ['leftarrow' , '⟵'], - \ ['Leftarrow' , '⟸'], + \ ['leftarrow' , '←'], + \ ['Leftarrow' , '⇐'], \ ['leftarrowtail' , '↢'], \ ['leftharpoondown', '↽'], \ ['leftharpoonup' , '↼'], @@ -807,6 +816,7 @@ if has("conceal") && &enc == 'utf-8' \ ['ll' , '≪'], \ ['lmoustache' , '╭'], \ ['lneqq' , '≨'], + \ ['lor' , '∨'], \ ['ltimes' , '⋉'], \ ['mapsto' , '↦'], \ ['measuredangle' , '∡'], @@ -833,6 +843,7 @@ if has("conceal") && &enc == 'utf-8' \ ['nless' , '≮'], \ ['nmid' , '∤'], \ ['notin' , '∉'], + \ ['nparallel' , '∦'], \ ['nprec' , '⊀'], \ ['nrightarrow' , '↛'], \ ['nRightarrow' , '⇏'], @@ -875,8 +886,8 @@ if has("conceal") && &enc == 'utf-8' \ ['right)' , ')'], \ ['right]' , ']'], \ ['right\\}' , '}'], - \ ['rightarrow' , '⟶'], - \ ['Rightarrow' , '⟹'], + \ ['rightarrow' , '→'], + \ ['Rightarrow' , '⇒'], \ ['rightarrowtail' , '↣'], \ ['rightleftharpoons', '⇌'], \ ['rightsquigarrow', '↝'], @@ -934,10 +945,12 @@ if has("conceal") && &enc == 'utf-8' \ ['trianglerighteq', '⊵'], \ ['twoheadleftarrow', '↞'], \ ['twoheadrightarrow', '↠'], + \ ['ulcorner' , '⌜'], \ ['uparrow' , '↑'], \ ['Uparrow' , '⇑'], \ ['updownarrow' , '↕'], \ ['Updownarrow' , '⇕'], + \ ['urcorner' , '⌝'], \ ['varnothing' , '∅'], \ ['vartriangle' , '∆'], \ ['vdash' , '⊢'], @@ -953,8 +966,17 @@ if has("conceal") && &enc == 'utf-8' " \ ['jmath' , 'X'] " \ ['uminus' , 'X'] " \ ['uplus' , 'X'] + if &ambw == "double" || exists("g:tex_usedblwidth") + let s:texMathList= s:texMathList + [ + \ ['right\\rangle' , '〉'], + \ ['left\\langle' , '〈']] + else + let s:texMathList= s:texMathList + [ + \ ['right\\rangle' , '>'], + \ ['left\\langle' , '<']] + endif for texmath in s:texMathList - if texmath[0] =~ '\w$' + if texmath[0] =~# '\w$' exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1] else exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1] @@ -989,10 +1011,53 @@ if has("conceal") && &enc == 'utf-8' syn match texMathSymbol '\\hat{W}' contained conceal cchar=Ŵ syn match texMathSymbol '\\hat{y}' contained conceal cchar=ŷ syn match texMathSymbol '\\hat{Y}' contained conceal cchar=Ŷ +" syn match texMathSymbol '\\bar{a}' contained conceal cchar=a̅ + + syn match texMathSymbol '\\dot{B}' contained conceal cchar=Ḃ + syn match texMathSymbol '\\dot{b}' contained conceal cchar=ḃ + syn match texMathSymbol '\\dot{D}' contained conceal cchar=Ḋ + syn match texMathSymbol '\\dot{d}' contained conceal cchar=ḋ + syn match texMathSymbol '\\dot{F}' contained conceal cchar=Ḟ + syn match texMathSymbol '\\dot{f}' contained conceal cchar=ḟ + syn match texMathSymbol '\\dot{H}' contained conceal cchar=Ḣ + syn match texMathSymbol '\\dot{h}' contained conceal cchar=ḣ + syn match texMathSymbol '\\dot{M}' contained conceal cchar=Ṁ + syn match texMathSymbol '\\dot{m}' contained conceal cchar=ṁ + syn match texMathSymbol '\\dot{N}' contained conceal cchar=Ṅ + syn match texMathSymbol '\\dot{n}' contained conceal cchar=ṅ + syn match texMathSymbol '\\dot{P}' contained conceal cchar=Ṗ + syn match texMathSymbol '\\dot{p}' contained conceal cchar=ṗ + syn match texMathSymbol '\\dot{R}' contained conceal cchar=Ṙ + syn match texMathSymbol '\\dot{r}' contained conceal cchar=ṙ + syn match texMathSymbol '\\dot{S}' contained conceal cchar=Ṡ + syn match texMathSymbol '\\dot{s}' contained conceal cchar=ṡ + syn match texMathSymbol '\\dot{T}' contained conceal cchar=Ṫ + syn match texMathSymbol '\\dot{t}' contained conceal cchar=ṫ + syn match texMathSymbol '\\dot{W}' contained conceal cchar=Ẇ + syn match texMathSymbol '\\dot{w}' contained conceal cchar=ẇ + syn match texMathSymbol '\\dot{X}' contained conceal cchar=Ẋ + syn match texMathSymbol '\\dot{x}' contained conceal cchar=ẋ + syn match texMathSymbol '\\dot{Y}' contained conceal cchar=Ẏ + syn match texMathSymbol '\\dot{y}' contained conceal cchar=ẏ + syn match texMathSymbol '\\dot{Z}' contained conceal cchar=Ż + syn match texMathSymbol '\\dot{z}' contained conceal cchar=ż + + syn match texMathSymbol '\\dot{C}' contained conceal cchar=Ċ + syn match texMathSymbol '\\dot{c}' contained conceal cchar=ċ + syn match texMathSymbol '\\dot{E}' contained conceal cchar=Ė + syn match texMathSymbol '\\dot{e}' contained conceal cchar=ė + syn match texMathSymbol '\\dot{G}' contained conceal cchar=Ġ + syn match texMathSymbol '\\dot{g}' contained conceal cchar=ġ + syn match texMathSymbol '\\dot{I}' contained conceal cchar=İ + + syn match texMathSymbol '\\dot{A}' contained conceal cchar=Ȧ + syn match texMathSymbol '\\dot{a}' contained conceal cchar=ȧ + syn match texMathSymbol '\\dot{O}' contained conceal cchar=Ȯ + syn match texMathSymbol '\\dot{o}' contained conceal cchar=ȯ endif " Greek {{{2 - if s:tex_conceal =~ 'g' + if s:tex_conceal =~# 'g' fun! s:Greek(group,pat,cchar) exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar endfun @@ -1005,7 +1070,7 @@ if has("conceal") && &enc == 'utf-8' call s:Greek('texGreek','\\zeta\>' ,'ζ') call s:Greek('texGreek','\\eta\>' ,'η') call s:Greek('texGreek','\\theta\>' ,'θ') - call s:Greek('texGreek','\\vartheta\>' ,'ϑ') + call s:Greek('texGreek','\\vartheta\>' ,'ϑ') call s:Greek('texGreek','\\kappa\>' ,'κ') call s:Greek('texGreek','\\lambda\>' ,'λ') call s:Greek('texGreek','\\mu\>' ,'μ') @@ -1016,11 +1081,11 @@ if has("conceal") && &enc == 'utf-8' call s:Greek('texGreek','\\rho\>' ,'ρ') call s:Greek('texGreek','\\varrho\>' ,'ϱ') call s:Greek('texGreek','\\sigma\>' ,'σ') - call s:Greek('texGreek','\\varsigma\>' ,'ς') + call s:Greek('texGreek','\\varsigma\>' ,'ς') call s:Greek('texGreek','\\tau\>' ,'τ') call s:Greek('texGreek','\\upsilon\>' ,'υ') - call s:Greek('texGreek','\\phi\>' ,'φ') - call s:Greek('texGreek','\\varphi\>' ,'ϕ') + call s:Greek('texGreek','\\phi\>' ,'ϕ') + call s:Greek('texGreek','\\varphi\>' ,'φ') call s:Greek('texGreek','\\chi\>' ,'χ') call s:Greek('texGreek','\\psi\>' ,'ψ') call s:Greek('texGreek','\\omega\>' ,'ω') @@ -1039,14 +1104,18 @@ if has("conceal") && &enc == 'utf-8' endif " Superscripts/Subscripts {{{2 - if s:tex_conceal =~ 's' - if s:tex_fast =~ 's' + if s:tex_conceal =~# 's' + if s:tex_fast =~# 's' syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher endif + " s:SuperSub: fun! s:SuperSub(group,leader,pat,cchar) - exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar - exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' + if a:pat =~# '^\\' || (a:leader == '\^' && a:pat =~# s:tex_superscripts) || (a:leader == '_' && a:pat =~# s:tex_subscripts) +" call Decho("SuperSub: group<".a:group."> leader<".a:leader."> pat<".a:pat."> cchar<".a:cchar.">") + exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar + exe 'syn match '.a:group."s '".a:pat ."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' + endif endfun call s:SuperSub('texSuperscript','\^','0','⁰') call s:SuperSub('texSuperscript','\^','1','¹') @@ -1125,9 +1194,21 @@ if has("conceal") && &enc == 'utf-8' call s:SuperSub('texSubscript','_','9','₉') call s:SuperSub('texSubscript','_','a','ₐ') call s:SuperSub('texSubscript','_','e','ₑ') + call s:SuperSub('texSubscript','_','h','ₕ') call s:SuperSub('texSubscript','_','i','ᵢ') + call s:SuperSub('texSubscript','_','j','ⱼ') + call s:SuperSub('texSubscript','_','k','ₖ') + call s:SuperSub('texSubscript','_','l','ₗ') + call s:SuperSub('texSubscript','_','m','ₘ') + call s:SuperSub('texSubscript','_','n','ₙ') call s:SuperSub('texSubscript','_','o','ₒ') + call s:SuperSub('texSubscript','_','p','ₚ') + call s:SuperSub('texSubscript','_','r','ᵣ') + call s:SuperSub('texSubscript','_','s','ₛ') + call s:SuperSub('texSubscript','_','t','ₜ') call s:SuperSub('texSubscript','_','u','ᵤ') + call s:SuperSub('texSubscript','_','v','ᵥ') + call s:SuperSub('texSubscript','_','x','ₓ') call s:SuperSub('texSubscript','_',',','︐') call s:SuperSub('texSubscript','_','+','₊') call s:SuperSub('texSubscript','_','-','₋') @@ -1143,14 +1224,17 @@ if has("conceal") && &enc == 'utf-8' call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ') call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ') call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ') + delfun s:SuperSub endif - " Accented characters: {{{2 - if s:tex_conceal =~ 'a' + " Accented characters and Ligatures: {{{2 + if s:tex_conceal =~# 'a' if b:tex_stylish syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 - syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 + syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 + syn match texLigature '--' + syn match texLigature '---' else fun! s:Accents(chr,...) let i= 1 @@ -1162,7 +1246,7 @@ if has("conceal") && &enc == 'utf-8' let i= i + 1 continue endif - if accent =~ '\a' + if accent =~# '\a' exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i} else exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i} @@ -1170,56 +1254,58 @@ if has("conceal") && &enc == 'utf-8' let i= i + 1 endfor endfun - " \` \' \^ \" \~ \. \= \c \H \k \r \u \v - call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ') - call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ') - call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č') - call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č') - call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď') - call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď') - call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě') - call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě') - call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ') - call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ') - call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ') - call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ') - call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ') - call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ') - call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ') - call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ') - call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ') - call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ') - call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ') - call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň') - call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň') - call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ') - call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ') - call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř') - call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř') - call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š') - call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š') - call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť') - call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť') - call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ') - call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ') - call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž') - call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž') + " \` \' \^ \" \~ \. \= \c \H \k \r \u \v + call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ') + call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ') + call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č') + call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č') + call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď') + call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď') + call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě') + call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě') + call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ') + call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ') + call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ') + call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ') + call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ') + call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ') + call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ') + call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ') + call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ') + call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ') + call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ') + call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň') + call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň') + call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ') + call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ') + call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř') + call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř') + call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š') + call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š') + call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť') + call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť') + call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ') + call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ') + call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž') + call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž') call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ',' ','ĭ',' ') " \` \' \^ \" \~ \. \= \c \H \k \r \u \v delfun s:Accents - syn match texAccent '\\aa\>' conceal cchar=å - syn match texAccent '\\AA\>' conceal cchar=Å - syn match texAccent '\\o\>' conceal cchar=ø - syn match texAccent '\\O\>' conceal cchar=Ø + syn match texAccent '\\aa\>' conceal cchar=å + syn match texAccent '\\AA\>' conceal cchar=Å + syn match texAccent '\\o\>' conceal cchar=ø + syn match texAccent '\\O\>' conceal cchar=Ø syn match texLigature '\\AE\>' conceal cchar=Æ syn match texLigature '\\ae\>' conceal cchar=æ syn match texLigature '\\oe\>' conceal cchar=œ syn match texLigature '\\OE\>' conceal cchar=Œ syn match texLigature '\\ss\>' conceal cchar=ß + syn match texLigature '--' conceal cchar=– + syn match texLigature '---' conceal cchar=— endif endif endif @@ -1236,7 +1322,7 @@ syn sync match texSyncStop groupthere NONE "%stopzone\>" " (one can't tell if a "$$" starts or stops a math zone by itself) " The following grouptheres coupled with minlines above " help improve the odds of good syncing. -if !exists("tex_no_math") +if !exists("g:tex_no_math") syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}" syn sync match texSyncMathZoneA groupthere NONE "\\end{center}" syn sync match texSyncMathZoneA groupthere NONE "\\end{description}" @@ -1249,89 +1335,91 @@ endif " --------------------------------------------------------------------- " Highlighting: {{{1 -if did_tex_syntax_inits == 1 - let did_tex_syntax_inits= 2 + +" Define the default highlighting. {{{1 +if !exists("skip_tex_syntax_inits") + " TeX highlighting groups which should share similar highlighting - if !exists("s:tex_no_error") + if !exists("g:tex_no_error") if !exists("g:tex_no_math") - HiLink texBadMath texError - HiLink texMathDelimBad texError - HiLink texMathError texError + hi def link texBadMath texError + hi def link texMathDelimBad texError + hi def link texMathError texError if !b:tex_stylish - HiLink texOnlyMath texError + hi def link texOnlyMath texError endif endif - HiLink texError Error + hi def link texError Error endif hi texBoldStyle gui=bold cterm=bold hi texItalStyle gui=italic cterm=italic hi texBoldItalStyle gui=bold,italic cterm=bold,italic hi texItalBoldStyle gui=bold,italic cterm=bold,italic - HiLink texCite texRefZone - HiLink texDefCmd texDef - HiLink texDefName texDef - HiLink texDocType texCmdName - HiLink texDocTypeArgs texCmdArgs - HiLink texInputFileOpt texCmdArgs - HiLink texInputCurlies texDelimiter - HiLink texLigature texSpecialChar - if !exists("tex_no_math") - HiLink texMathDelimSet1 texMathDelim - HiLink texMathDelimSet2 texMathDelim - HiLink texMathDelimKey texMathDelim - HiLink texMathMatcher texMath - HiLink texAccent texStatement - HiLink texGreek texStatement - HiLink texSuperscript texStatement - HiLink texSubscript texStatement - HiLink texSuperscripts texSuperscript - HiLink texSubscripts texSubscript - HiLink texMathSymbol texStatement - HiLink texMathZoneV texMath - HiLink texMathZoneW texMath - HiLink texMathZoneX texMath - HiLink texMathZoneY texMath - HiLink texMathZoneV texMath - HiLink texMathZoneZ texMath + hi def link texCite texRefZone + hi def link texDefCmd texDef + hi def link texDefName texDef + hi def link texDocType texCmdName + hi def link texDocTypeArgs texCmdArgs + hi def link texInputFileOpt texCmdArgs + hi def link texInputCurlies texDelimiter + hi def link texLigature texSpecialChar + if !exists("g:tex_no_math") + hi def link texMathDelimSet1 texMathDelim + hi def link texMathDelimSet2 texMathDelim + hi def link texMathDelimKey texMathDelim + hi def link texMathMatcher texMath + hi def link texAccent texStatement + hi def link texGreek texStatement + hi def link texSuperscript texStatement + hi def link texSubscript texStatement + hi def link texSuperscripts texSuperscript + hi def link texSubscripts texSubscript + hi def link texMathSymbol texStatement + hi def link texMathZoneV texMath + hi def link texMathZoneW texMath + hi def link texMathZoneX texMath + hi def link texMathZoneY texMath + hi def link texMathZoneV texMath + hi def link texMathZoneZ texMath endif - HiLink texBeginEnd texCmdName - HiLink texBeginEndName texSection - HiLink texSpaceCode texStatement - HiLink texStyleStatement texStatement - HiLink texTypeSize texType - HiLink texTypeStyle texType + hi def link texBeginEnd texCmdName + hi def link texBeginEndName texSection + hi def link texSpaceCode texStatement + hi def link texStyleStatement texStatement + hi def link texTypeSize texType + hi def link texTypeStyle texType " Basic TeX highlighting groups - HiLink texCmdArgs Number - HiLink texCmdName Statement - HiLink texComment Comment - HiLink texDef Statement - HiLink texDefParm Special - HiLink texDelimiter Delimiter - HiLink texInput Special - HiLink texInputFile Special - HiLink texLength Number - HiLink texMath Special - HiLink texMathDelim Statement - HiLink texMathOper Operator - HiLink texNewCmd Statement - HiLink texNewEnv Statement - HiLink texOption Number - HiLink texRefZone Special - HiLink texSection PreCondit - HiLink texSpaceCodeChar Special - HiLink texSpecialChar SpecialChar - HiLink texStatement Statement - HiLink texString String - HiLink texTodo Todo - HiLink texType Type - HiLink texZone PreCondit - - delcommand HiLink + hi def link texCmdArgs Number + hi def link texCmdName Statement + hi def link texComment Comment + hi def link texDef Statement + hi def link texDefParm Special + hi def link texDelimiter Delimiter + hi def link texInput Special + hi def link texInputFile Special + hi def link texLength Number + hi def link texMath Special + hi def link texMathDelim Statement + hi def link texMathOper Operator + hi def link texNewCmd Statement + hi def link texNewEnv Statement + hi def link texOption Number + hi def link texRefZone Special + hi def link texSection PreCondit + hi def link texSpaceCodeChar Special + hi def link texSpecialChar SpecialChar + hi def link texStatement Statement + hi def link texString String + hi def link texTodo Todo + hi def link texType Type + hi def link texZone PreCondit + endif " Cleanup: {{{1 +delc TexFold unlet s:extfname let b:current_syntax = "tex" let &cpo = s:keepcpo diff --git a/runtime/syntax/texinfo.vim b/runtime/syntax/texinfo.vim index 134fc6763c..a4b7689707 100644 --- a/runtime/syntax/texinfo.vim +++ b/runtime/syntax/texinfo.vim @@ -9,10 +9,8 @@ " since @ can have special meanings, everything is 'match'-ed and 'region'-ed " (including @ in 'iskeyword' option has unexpected effects) -" Remove any old syntax stuff hanging around, if needed -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 @@ -356,48 +354,37 @@ syn cluster texinfoReducedAll contains=texinfoSpecialChar,texinfoBrcPrmAtCmd "============================================================================== " 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_texinfo_syn_inits") - - if version < 508 - let did_texinfo_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink texinfoSpecialChar Special - HiLink texinfoHFSpecialChar Special - - HiLink texinfoError Error - HiLink texinfoIdent Identifier - HiLink texinfoAssignment Identifier - HiLink texinfoSinglePar Identifier - HiLink texinfoIndexPar Identifier - HiLink texinfoSIPar Identifier - HiLink texinfoDIEPar Identifier - HiLink texinfoTexCmd PreProc - - - HiLink texinfoAtCmd Statement "@-command - HiLink texinfoPrmAtCmd String "@-command in one line with unknown nr. of parameters - "is String because is found as a region and is 'matchgroup'-ed - "to texinfoAtCmd - HiLink texinfoBrcPrmAtCmd String "@-command with parameter(s) in braces ({}) - "is String because is found as a region and is 'matchgroup'-ed to texinfoAtCmd - HiLink texinfoMltlnAtCmdFLine texinfoAtCmd "repeated embedded First lines in @-commands - HiLink texinfoMltlnAtCmd String "@-command in multiple lines - "is String because is found as a region and is 'matchgroup'-ed to texinfoAtCmd - HiLink texinfoMltln2AtCmd PreProc "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors) - HiLink texinfoMltlnDMAtCmd PreProc "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors; used for @detailmenu, which can be included in @menu) - HiLink texinfoMltlnNAtCmd Normal "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors) - HiLink texinfoThisAtCmd Statement "@-command used in headers and footers (@this... series) - - HiLink texinfoComment Comment - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link texinfoSpecialChar Special +hi def link texinfoHFSpecialChar Special + +hi def link texinfoError Error +hi def link texinfoIdent Identifier +hi def link texinfoAssignment Identifier +hi def link texinfoSinglePar Identifier +hi def link texinfoIndexPar Identifier +hi def link texinfoSIPar Identifier +hi def link texinfoDIEPar Identifier +hi def link texinfoTexCmd PreProc + + +hi def link texinfoAtCmd Statement "@-command +hi def link texinfoPrmAtCmd String "@-command in one line with unknown nr. of parameters + "is String because is found as a region and is 'matchgroup'-ed + "to texinfoAtCmd +hi def link texinfoBrcPrmAtCmd String "@-command with parameter(s) in braces ({}) + "is String because is found as a region and is 'matchgroup'-ed to texinfoAtCmd +hi def link texinfoMltlnAtCmdFLine texinfoAtCmd "repeated embedded First lines in @-commands +hi def link texinfoMltlnAtCmd String "@-command in multiple lines + "is String because is found as a region and is 'matchgroup'-ed to texinfoAtCmd +hi def link texinfoMltln2AtCmd PreProc "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors) +hi def link texinfoMltlnDMAtCmd PreProc "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors; used for @detailmenu, which can be included in @menu) +hi def link texinfoMltlnNAtCmd Normal "@-command in multiple lines (same as texinfoMltlnAtCmd, just with other colors) +hi def link texinfoThisAtCmd Statement "@-command used in headers and footers (@this... series) + +hi def link texinfoComment Comment + let b:current_syntax = "texinfo" diff --git a/runtime/syntax/texmf.vim b/runtime/syntax/texmf.vim index 7b91168f08..d1268faff7 100644 --- a/runtime/syntax/texmf.vim +++ b/runtime/syntax/texmf.vim @@ -6,12 +6,9 @@ " URL: http://physics.muni.cz/~yeti/download/syntax/texmf.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case match @@ -45,42 +42,33 @@ syn region texmfBrace matchgroup=texmfBraceBrace start="{" end="}" contains=ALLB syn match texmfBraceError "}" " Define the default highlighting -if version >= 508 || !exists("did_texmf_syntax_inits") - if version < 508 - let did_texmf_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink texmfComment Comment - HiLink texmfTodo Todo +hi def link texmfComment Comment +hi def link texmfTodo Todo - HiLink texmfPassedParameter texmfVariable - HiLink texmfVariable Identifier +hi def link texmfPassedParameter texmfVariable +hi def link texmfVariable Identifier - HiLink texmfNumber Number - HiLink texmfString String +hi def link texmfNumber Number +hi def link texmfString String - HiLink texmfLHSStart texmfLHS - HiLink texmfLHSVariable texmfLHS - HiLink texmfLHSDot texmfLHS - HiLink texmfLHS Type +hi def link texmfLHSStart texmfLHS +hi def link texmfLHSVariable texmfLHS +hi def link texmfLHSDot texmfLHS +hi def link texmfLHS Type - HiLink texmfEquals Normal +hi def link texmfEquals Normal - HiLink texmfBraceBrace texmfDelimiter - HiLink texmfComma texmfDelimiter - HiLink texmfColons texmfDelimiter - HiLink texmfDelimiter Preproc +hi def link texmfBraceBrace texmfDelimiter +hi def link texmfComma texmfDelimiter +hi def link texmfColons texmfDelimiter +hi def link texmfDelimiter Preproc - HiLink texmfDoubleExclam Statement - HiLink texmfSpecial Special +hi def link texmfDoubleExclam Statement +hi def link texmfSpecial Special - HiLink texmfBraceError texmfError - HiLink texmfError Error +hi def link texmfBraceError texmfError +hi def link texmfError Error - delcommand HiLink -endif let b:current_syntax = "texmf" diff --git a/runtime/syntax/tf.vim b/runtime/syntax/tf.vim index 2a9a999883..47775b8637 100644 --- a/runtime/syntax/tf.vim +++ b/runtime/syntax/tf.vim @@ -9,11 +9,8 @@ " Remove any old syntax stuff hanging around -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -161,44 +158,34 @@ else endif " 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_tf_syn_inits") - if version < 508 - let did_tf_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tfComment Comment - HiLink tfString String - HiLink tfNumber Number - HiLink tfFloat Float - HiLink tfIdentifier Identifier - HiLink tfVar Identifier - HiLink tfWorld Identifier - HiLink tfReadonly Identifier - HiLink tfHook Identifier - HiLink tfFunctions Function - HiLink tfRepeat Repeat - HiLink tfConditional Conditional - HiLink tfLabel Label - HiLink tfStatement Statement - HiLink tfType Type - HiLink tfInclude Include - HiLink tfDefine Define - HiLink tfSpecialChar SpecialChar - HiLink tfSpecialCharEsc SpecialChar - HiLink tfParentError Error - HiLink tfTodo Todo - HiLink tfEndCommand Delimiter - HiLink tfJoinLines Delimiter - HiLink tfOperator Operator - HiLink tfRelation Operator - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tfComment Comment +hi def link tfString String +hi def link tfNumber Number +hi def link tfFloat Float +hi def link tfIdentifier Identifier +hi def link tfVar Identifier +hi def link tfWorld Identifier +hi def link tfReadonly Identifier +hi def link tfHook Identifier +hi def link tfFunctions Function +hi def link tfRepeat Repeat +hi def link tfConditional Conditional +hi def link tfLabel Label +hi def link tfStatement Statement +hi def link tfType Type +hi def link tfInclude Include +hi def link tfDefine Define +hi def link tfSpecialChar SpecialChar +hi def link tfSpecialCharEsc SpecialChar +hi def link tfParentError Error +hi def link tfTodo Todo +hi def link tfEndCommand Delimiter +hi def link tfJoinLines Delimiter +hi def link tfOperator Operator +hi def link tfRelation Operator + let b:current_syntax = "tf" diff --git a/runtime/syntax/tidy.vim b/runtime/syntax/tidy.vim index c24796edd1..6371cb5a86 100644 --- a/runtime/syntax/tidy.vim +++ b/runtime/syntax/tidy.vim @@ -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 - -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 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 + +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 diff --git a/runtime/syntax/tli.vim b/runtime/syntax/tli.vim index 5685a6cbf2..b96d4a2119 100644 --- a/runtime/syntax/tli.vim +++ b/runtime/syntax/tli.vim @@ -4,11 +4,8 @@ " Last Change: 2001 May 10 " Version: 1.0 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -44,27 +41,17 @@ syn match tliComment "#.*" syn case match " 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_tli_syntax_inits") - if version < 508 - let did_tli_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tliNumber Number - HiLink tliString String - HiLink tliComment Comment - HiLink tliSpecial SpecialChar - HiLink tliIdentifier Identifier - HiLink tliObject Statement - HiLink tliField Type - HiLink tliStyle PreProc - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tliNumber Number +hi def link tliString String +hi def link tliComment Comment +hi def link tliSpecial SpecialChar +hi def link tliIdentifier Identifier +hi def link tliObject Statement +hi def link tliField Type +hi def link tliStyle PreProc + let b:current_syntax = "tli" diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim new file mode 100644 index 0000000000..62c0ce521a --- /dev/null +++ b/runtime/syntax/tmux.vim @@ -0,0 +1,123 @@ +" Language: tmux(1) configuration file +" Version: 2.7 (git-e4e060f2) +" URL: https://github.com/ericpruitt/tmux.vim/ +" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> +" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) + +if exists("b:current_syntax") + finish +endif + +" Explicitly change compatiblity options to Vim's defaults because this file +" uses line continuations. +let s:original_cpo = &cpo +set cpo&vim + +let b:current_syntax = "tmux" +syntax iskeyword @,48-57,_,192-255,- +syntax case match + +syn keyword tmuxAction none any current other +syn keyword tmuxBoolean off on + +syn keyword tmuxTodo FIXME NOTE TODO XXX contained + +syn match tmuxColour /\<colour[0-9]\+/ display +syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display +syn match tmuxNumber /\<\d\+\>/ display +syn match tmuxFlags /\s-\a\+/ display +syn match tmuxVariable /\w\+=/ display +syn match tmuxVariableExpansion /\${\=\w\+}\=/ display + +syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo + +syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString +syn region tmuxString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString + +" TODO: Figure out how escaping works inside of #(...) and #{...} blocks. +syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend +syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ contained keepend +syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend + +hi def link tmuxFormatString Identifier +hi def link tmuxAction Boolean +hi def link tmuxBoolean Boolean +hi def link tmuxCommands Keyword +hi def link tmuxComment Comment +hi def link tmuxKey Special +hi def link tmuxNumber Number +hi def link tmuxFlags Identifier +hi def link tmuxOptions Function +hi def link tmuxString String +hi def link tmuxTodo Todo +hi def link tmuxVariable Identifier +hi def link tmuxVariableExpansion Identifier + +" Make the foreground of colourXXX keywords match the color they represent. +" Darker colors have their background set to white. +for s:i in range(0, 255) + let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none" + exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display" +\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg +endfor + +syn keyword tmuxOptions +\ buffer-limit command-alias default-terminal escape-time exit-empty +\ activity-action assume-paste-time base-index bell-action default-command +\ default-shell destroy-unattached detach-on-destroy +\ display-panes-active-colour display-panes-colour display-panes-time +\ display-time exit-unattached focus-events history-file history-limit +\ key-table lock-after-time lock-command message-attr message-bg +\ message-command-attr message-command-bg message-command-fg +\ message-command-style message-fg message-limit message-style mouse +\ aggressive-resize allow-rename alternate-screen automatic-rename +\ automatic-rename-format clock-mode-colour clock-mode-style force-height +\ force-width main-pane-height main-pane-width mode-attr mode-bg mode-fg +\ mode-keys mode-style monitor-activity monitor-bell monitor-silence +\ other-pane-height other-pane-width pane-active-border-bg +\ pane-active-border-fg pane-active-border-style pane-base-index +\ pane-border-bg pane-border-fg pane-border-format pane-border-status +\ pane-border-style prefix prefix2 remain-on-exit renumber-windows +\ repeat-time set-clipboard set-titles set-titles-string silence-action +\ status status-attr status-bg status-fg status-interval status-justify +\ status-keys status-left status-left-attr status-left-bg status-left-fg +\ status-left-length status-left-style status-position status-right +\ status-right-attr status-right-bg status-right-fg status-right-length +\ status-right-style status-style synchronize-panes terminal-overrides +\ update-environment user-keys visual-activity visual-bell visual-silence +\ window-active-style window-status-activity-attr window-status-activity-bg +\ window-status-activity-fg window-status-activity-style window-status-attr +\ window-status-bell-attr window-status-bell-bg window-status-bell-fg +\ window-status-bell-style window-status-bg window-status-current-attr +\ window-status-current-bg window-status-current-fg +\ window-status-current-format window-status-current-style window-status-fg +\ window-status-format window-status-last-attr window-status-last-bg +\ window-status-last-fg window-status-last-style window-status-separator +\ window-status-style window-style word-separators wrap-search xterm-keys + +syn keyword tmuxCommands +\ attach attach-session bind bind-key break-pane breakp capture-pane +\ capturep choose-buffer choose-client choose-tree clear-history clearhist +\ clock-mode command-prompt confirm confirm-before copy-mode detach +\ detach-client display display-message display-panes displayp find-window +\ findw if if-shell join-pane joinp kill-pane kill-server kill-session +\ kill-window killp has-session has killw link-window linkw list-buffers +\ list-clients list-commands list-keys list-panes list-sessions list-windows +\ load-buffer loadb lock lock-client lock-server lock-session last-pane +\ lastp lockc locks last-window last ls lsb delete-buffer deleteb lsc lscm +\ lsk lsp lsw move-pane move-window movep movew new new-session new-window +\ neww next next-layout next-window nextl paste-buffer pasteb pipe-pane +\ pipep prev previous-layout previous-window prevl refresh refresh-client +\ rename rename-session rename-window renamew resize-pane resizep +\ respawn-pane respawn-window respawnp respawnw rotate-window rotatew run +\ run-shell save-buffer saveb select-layout select-pane select-window +\ selectl selectp selectw send send-keys send-prefix set set-buffer +\ set-environment set-hook set-option set-window-option setb setenv setw +\ show show-buffer show-environment show-hooks show-messages show-options +\ show-window-options showb showenv showmsgs showw source source-file +\ split-window splitw start start-server suspend-client suspendc swap-pane +\ swap-window swapp swapw switch-client switchc unbind unbind-key +\ unlink-window unlinkw wait wait-for + +let &cpo = s:original_cpo +unlet! s:original_cpo s:bg s:i diff --git a/runtime/syntax/tpp.vim b/runtime/syntax/tpp.vim index 050a2ba78d..1244b97f08 100644 --- a/runtime/syntax/tpp.vim +++ b/runtime/syntax/tpp.vim @@ -17,11 +17,8 @@ " the latest version of this file. " SPAM is _NOT_ welcome - be ready to be reported! -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -51,11 +48,7 @@ syn region tppAbstractOption start="^--\%(author\|title\|date\|footer\)" end="$" if main_syntax != 'sh' " shell command - if version < 600 - syn include @tppShExec <sfile>:p:h/sh.vim - else - syn include @tppShExec syntax/sh.vim - endif + syn include @tppShExec syntax/sh.vim unlet b:current_syntax syn region shExec matchgroup=tppPageLocalOptionKey start='^--exec *' keepend end='$' contains=@tppShExec @@ -65,35 +58,25 @@ endif syn match tppComment "^--##.*$" " 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_tpp_syn_inits") - if version < 508 - let did_tpp_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink tppAbstractOptionKey Special - HiLink tppPageLocalOptionKey Keyword - HiLink tppPageLocalSwitchKey Keyword - HiLink tppColorOptionKey Keyword - HiLink tppTimeOptionKey Comment - HiLink tppNewPageOptionKey PreProc - HiLink tppString String - HiLink tppColor String - HiLink tppTime Number - HiLink tppComment Comment - HiLink tppAbstractOption Error - HiLink tppPageLocalOption Error - HiLink tppPageLocalSwitch Error - HiLink tppColorOption Error - HiLink tppNewPageOption Error - HiLink tppTimeOption Error +hi def link tppAbstractOptionKey Special +hi def link tppPageLocalOptionKey Keyword +hi def link tppPageLocalSwitchKey Keyword +hi def link tppColorOptionKey Keyword +hi def link tppTimeOptionKey Comment +hi def link tppNewPageOptionKey PreProc +hi def link tppString String +hi def link tppColor String +hi def link tppTime Number +hi def link tppComment Comment +hi def link tppAbstractOption Error +hi def link tppPageLocalOption Error +hi def link tppPageLocalSwitch Error +hi def link tppColorOption Error +hi def link tppNewPageOption Error +hi def link tppTimeOption Error - delcommand HiLink -endif let b:current_syntax = "tpp" diff --git a/runtime/syntax/trasys.vim b/runtime/syntax/trasys.vim index cfecc1c1fd..d52b5eeb47 100644 --- a/runtime/syntax/trasys.vim +++ b/runtime/syntax/trasys.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -21,11 +18,7 @@ endif let fortran_free_source=1 " Load FORTRAN syntax file -if version < 600 - source <sfile>:p:h/fortran.vim -else - runtime! syntax/fortran.vim -endif +runtime! syntax/fortran.vim unlet b:current_syntax @@ -136,40 +129,30 @@ syn sync match trasysSync grouphere trasysComment "^HEADER DOCUMENTATION DATA" " 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_trasys_syntax_inits") - if version < 508 - let did_trasys_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink trasysOptions Special - HiLink trasysSurface Special - HiLink trasysSurfaceType Constant - HiLink trasysSurfaceArgs Constant - HiLink trasysArgs Constant - HiLink trasysOperations Statement - HiLink trasysSubRoutine Statement - HiLink trassyPrcsrSegm PreProc - HiLink trasysIdentifier Identifier - HiLink trasysComment Comment - HiLink trasysHeader Typedef - HiLink trasysMacro Macro - HiLink trasysInteger Number - HiLink trasysFloat Float - HiLink trasysScientific Float - - HiLink trasysBlank SpecialChar - - HiLink trasysEndData Macro - - HiLink trasysTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link trasysOptions Special +hi def link trasysSurface Special +hi def link trasysSurfaceType Constant +hi def link trasysSurfaceArgs Constant +hi def link trasysArgs Constant +hi def link trasysOperations Statement +hi def link trasysSubRoutine Statement +hi def link trassyPrcsrSegm PreProc +hi def link trasysIdentifier Identifier +hi def link trasysComment Comment +hi def link trasysHeader Typedef +hi def link trasysMacro Macro +hi def link trasysInteger Number +hi def link trasysFloat Float +hi def link trasysScientific Float + +hi def link trasysBlank SpecialChar + +hi def link trasysEndData Macro + +hi def link trasysTodo Todo + let b:current_syntax = "trasys" diff --git a/runtime/syntax/treetop.vim b/runtime/syntax/treetop.vim index 921c5bea1d..60bbf26193 100644 --- a/runtime/syntax/treetop.vim +++ b/runtime/syntax/treetop.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/trustees.vim b/runtime/syntax/trustees.vim index 4bc8874772..6c58d3983d 100644 --- a/runtime/syntax/trustees.vim +++ b/runtime/syntax/trustees.vim @@ -3,9 +3,8 @@ " Maintainer: Nima Talebi <nima@it.net.au> " Last Change: 2005-10-12 -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/tsalt.vim b/runtime/syntax/tsalt.vim index 887d6b75e7..8dd2a24df9 100644 --- a/runtime/syntax/tsalt.vim +++ b/runtime/syntax/tsalt.vim @@ -4,11 +4,8 @@ " Last Change: 2012 Feb 03 by Thilo Six " Version Info: @(#)tsalt.vim 1.5 97/12/16 08:11:15 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -171,46 +168,36 @@ syn sync ccomment tsaltComment " 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_tsalt_syntax_inits") - if version < 508 - let did_tsalt_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tsaltFunction Statement - HiLink tsaltSysVar Type - "HiLink tsaltLibFunc UserDefFunc - "HiLink tsaltConstants Type - "HiLink tsaltFuncArg Type - "HiLink tsaltOperator Operator - "HiLink tsaltLabel Label - "HiLink tsaltUserLabel Label - HiLink tsaltConditional Conditional - HiLink tsaltRepeat Repeat - HiLink tsaltCharacter SpecialChar - HiLink tsaltSpecialCharacter SpecialChar - HiLink tsaltNumber Number - HiLink tsaltFloat Float - HiLink tsaltCommentError tsaltError - HiLink tsaltInclude Include - HiLink tsaltPreProc PreProc - HiLink tsaltDefine Macro - HiLink tsaltIncluded tsaltString - HiLink tsaltError Error - HiLink tsaltStatement Statement - HiLink tsaltPreCondit PreCondit - HiLink tsaltType Type - HiLink tsaltString String - HiLink tsaltComment Comment - HiLink tsaltSpecial Special - HiLink tsaltTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tsaltFunction Statement +hi def link tsaltSysVar Type +"hi def link tsaltLibFunc UserDefFunc +"hi def link tsaltConstants Type +"hi def link tsaltFuncArg Type +"hi def link tsaltOperator Operator +"hi def link tsaltLabel Label +"hi def link tsaltUserLabel Label +hi def link tsaltConditional Conditional +hi def link tsaltRepeat Repeat +hi def link tsaltCharacter SpecialChar +hi def link tsaltSpecialCharacter SpecialChar +hi def link tsaltNumber Number +hi def link tsaltFloat Float +hi def link tsaltCommentError tsaltError +hi def link tsaltInclude Include +hi def link tsaltPreProc PreProc +hi def link tsaltDefine Macro +hi def link tsaltIncluded tsaltString +hi def link tsaltError Error +hi def link tsaltStatement Statement +hi def link tsaltPreCondit PreCondit +hi def link tsaltType Type +hi def link tsaltString String +hi def link tsaltComment Comment +hi def link tsaltSpecial Special +hi def link tsaltTodo Todo + let b:current_syntax = "tsalt" diff --git a/runtime/syntax/tsscl.vim b/runtime/syntax/tsscl.vim index 3fc18c6847..fd2a5e2ba9 100644 --- a/runtime/syntax/tsscl.vim +++ b/runtime/syntax/tsscl.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -179,37 +176,27 @@ syn match tssclScientific "-\=\<[0-9]*\.[0-9]*E[-+]\=[0-9]\+\>" " 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_tsscl_syntax_inits") - if version < 508 - let did_tsscl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tssclCommand Statement - HiLink tssclKeyword Special - HiLink tssclEnd Macro - HiLink tssclUnits Special - - HiLink tssclComment Comment - HiLink tssclDirective Statement - HiLink tssclConditional Conditional - HiLink tssclContChar Macro - HiLink tssclQualifier Typedef - HiLink tssclSymbol Identifier - HiLink tssclSymbol2 Symbol - HiLink tssclString String - HiLink tssclOper Operator - - HiLink tssclInteger Number - HiLink tssclFloat Number - HiLink tssclScientific Number - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tssclCommand Statement +hi def link tssclKeyword Special +hi def link tssclEnd Macro +hi def link tssclUnits Special + +hi def link tssclComment Comment +hi def link tssclDirective Statement +hi def link tssclConditional Conditional +hi def link tssclContChar Macro +hi def link tssclQualifier Typedef +hi def link tssclSymbol Identifier +hi def link tssclSymbol2 Symbol +hi def link tssclString String +hi def link tssclOper Operator + +hi def link tssclInteger Number +hi def link tssclFloat Number +hi def link tssclScientific Number + let b:current_syntax = "tsscl" diff --git a/runtime/syntax/tssgm.vim b/runtime/syntax/tssgm.vim index b8182d48ea..8ca7962e81 100644 --- a/runtime/syntax/tssgm.vim +++ b/runtime/syntax/tssgm.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -75,35 +72,25 @@ syn match tssgmScientific "-\=\<[0-9]*\.[0-9]*E[-+]\=[0-9]\+\>" " 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_tssgm_syntax_inits") - if version < 508 - let did_tssgm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tssgmParam Statement - HiLink tssgmSurfType Type - HiLink tssgmArgs Special - HiLink tssgmDelim Typedef - HiLink tssgmEnd Macro - HiLink tssgmUnits Special - - HiLink tssgmDefault SpecialComment - HiLink tssgmComment Statement - HiLink tssgmCommentString Comment - HiLink tssgmSurfIdent Identifier - HiLink tssgmString Delimiter - - HiLink tssgmInteger Number - HiLink tssgmFloat Float - HiLink tssgmScientific Float - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tssgmParam Statement +hi def link tssgmSurfType Type +hi def link tssgmArgs Special +hi def link tssgmDelim Typedef +hi def link tssgmEnd Macro +hi def link tssgmUnits Special + +hi def link tssgmDefault SpecialComment +hi def link tssgmComment Statement +hi def link tssgmCommentString Comment +hi def link tssgmSurfIdent Identifier +hi def link tssgmString Delimiter + +hi def link tssgmInteger Number +hi def link tssgmFloat Float +hi def link tssgmScientific Float + let b:current_syntax = "tssgm" diff --git a/runtime/syntax/tssop.vim b/runtime/syntax/tssop.vim index d416df054c..6a775b2358 100644 --- a/runtime/syntax/tssop.vim +++ b/runtime/syntax/tssop.vim @@ -8,11 +8,8 @@ -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -56,30 +53,20 @@ syn match tssopScientific "-\=\<[0-9]*\.[0-9]*E[-+]\=[0-9]\+\>" " 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_tssop_syntax_inits") - if version < 508 - let did_tssop_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink tssopParam Statement - HiLink tssopProp Identifier - HiLink tssopArgs Special - - HiLink tssopComment Statement - HiLink tssopCommentString Comment - HiLink tssopPropName Typedef - - HiLink tssopInteger Number - HiLink tssopFloat Float - HiLink tssopScientific Float - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link tssopParam Statement +hi def link tssopProp Identifier +hi def link tssopArgs Special + +hi def link tssopComment Statement +hi def link tssopCommentString Comment +hi def link tssopPropName Typedef + +hi def link tssopInteger Number +hi def link tssopFloat Float +hi def link tssopScientific Float + let b:current_syntax = "tssop" diff --git a/runtime/syntax/uc.vim b/runtime/syntax/uc.vim index 7eab1d48ae..90d33396c5 100644 --- a/runtime/syntax/uc.vim +++ b/runtime/syntax/uc.vim @@ -7,11 +7,8 @@ " Please check :help uc.vim for comments on some of the options available. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -110,64 +107,54 @@ endif exec "syn sync ccomment ucComment minlines=" . uc_minlines " 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_uc_syntax_inits") - if version < 508 - let did_uc_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink ucFuncDef Conditional - HiLink ucEventDef Conditional - HiLink ucBraces Function - HiLink ucBranch Conditional - HiLink ucLabel Label - HiLink ucUserLabel Label - HiLink ucConditional Conditional - HiLink ucRepeat Repeat - HiLink ucStorageClass StorageClass - HiLink ucMethodDecl ucStorageClass - HiLink ucClassDecl ucStorageClass - HiLink ucScopeDecl ucStorageClass - HiLink ucBoolean Boolean - HiLink ucSpecial Special - HiLink ucSpecialError Error - HiLink ucSpecialCharError Error - HiLink ucString String - HiLink ucCharacter Character - HiLink ucSpecialChar SpecialChar - HiLink ucNumber Number - HiLink ucError Error - HiLink ucStringError Error - HiLink ucStatement Statement - HiLink ucOperator Operator - HiLink ucOverLoaded Operator - HiLink ucComment Comment - HiLink ucDocComment Comment - HiLink ucLineComment Comment - HiLink ucConstant ucBoolean - HiLink ucTypedef Typedef - HiLink ucTodo Todo - - HiLink ucCommentTitle SpecialComment - HiLink ucDocTags Special - HiLink ucDocParam Function - HiLink ucCommentStar ucComment - - HiLink ucType Type - HiLink ucExternal Include - - HiLink ucClassKeys Conditional - HiLink ucClassLabel Conditional - - HiLink htmlComment Special - HiLink htmlCommentPart Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link ucFuncDef Conditional +hi def link ucEventDef Conditional +hi def link ucBraces Function +hi def link ucBranch Conditional +hi def link ucLabel Label +hi def link ucUserLabel Label +hi def link ucConditional Conditional +hi def link ucRepeat Repeat +hi def link ucStorageClass StorageClass +hi def link ucMethodDecl ucStorageClass +hi def link ucClassDecl ucStorageClass +hi def link ucScopeDecl ucStorageClass +hi def link ucBoolean Boolean +hi def link ucSpecial Special +hi def link ucSpecialError Error +hi def link ucSpecialCharError Error +hi def link ucString String +hi def link ucCharacter Character +hi def link ucSpecialChar SpecialChar +hi def link ucNumber Number +hi def link ucError Error +hi def link ucStringError Error +hi def link ucStatement Statement +hi def link ucOperator Operator +hi def link ucOverLoaded Operator +hi def link ucComment Comment +hi def link ucDocComment Comment +hi def link ucLineComment Comment +hi def link ucConstant ucBoolean +hi def link ucTypedef Typedef +hi def link ucTodo Todo + +hi def link ucCommentTitle SpecialComment +hi def link ucDocTags Special +hi def link ucDocParam Function +hi def link ucCommentStar ucComment + +hi def link ucType Type +hi def link ucExternal Include + +hi def link ucClassKeys Conditional +hi def link ucClassLabel Conditional + +hi def link htmlComment Special +hi def link htmlCommentPart Special + let b:current_syntax = "uc" diff --git a/runtime/syntax/udevconf.vim b/runtime/syntax/udevconf.vim index a294604906..82fd81daf6 100644 --- a/runtime/syntax/udevconf.vim +++ b/runtime/syntax/udevconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: udev(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/udevperm.vim b/runtime/syntax/udevperm.vim index 9d3af09d07..abda0b6663 100644 --- a/runtime/syntax/udevperm.vim +++ b/runtime/syntax/udevperm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) permissions file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: udev(8) permissions file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/udevrules.vim b/runtime/syntax/udevrules.vim index b04d728865..ce156ccc13 100644 --- a/runtime/syntax/udevrules.vim +++ b/runtime/syntax/udevrules.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) rules file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-18 +" Language: udev(8) rules file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-18 if exists("b:current_syntax") finish diff --git a/runtime/syntax/uil.vim b/runtime/syntax/uil.vim index b5421bcfdb..088a0f6c86 100644 --- a/runtime/syntax/uil.vim +++ b/runtime/syntax/uil.vim @@ -1,13 +1,13 @@ " Vim syntax file " Language: Motif UIL (User Interface Language) " Maintainer: Thomas Koehler <jean-luc@picard.franken.de> -" Last Change: 2013 May 23 +" Please be aware: I'm often slow to answer email due to a high +" non-computer related workload (sometimes 4-8 weeks) +" Last Change: 2016 September 6 " URL: http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/uil.vim -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -47,37 +47,27 @@ syn region uilDefine start="^#\s*\(define\>\|undef\>\)" end="$" contains=uilLin syn sync ccomment uilComment " 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_uil_syn_inits") - if version < 508 - let did_uil_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - " The default highlighting. - HiLink uilCharacter uilString - HiLink uilSpecialCharacter uilSpecial - HiLink uilNumber uilString - HiLink uilCommentError uilError - HiLink uilInclude uilPreCondit - HiLink uilDefine uilPreCondit - HiLink uilIncluded uilString - HiLink uilSpecialFunction uilRessource - HiLink uilRessource Identifier - HiLink uilSpecialStatement Keyword - HiLink uilError Error - HiLink uilPreCondit PreCondit - HiLink uilType Type - HiLink uilString String - HiLink uilComment Comment - HiLink uilSpecial Special - HiLink uilTodo Todo +" The default highlighting. +hi def link uilCharacter uilString +hi def link uilSpecialCharacter uilSpecial +hi def link uilNumber uilString +hi def link uilCommentError uilError +hi def link uilInclude uilPreCondit +hi def link uilDefine uilPreCondit +hi def link uilIncluded uilString +hi def link uilSpecialFunction uilRessource +hi def link uilRessource Identifier +hi def link uilSpecialStatement Keyword +hi def link uilError Error +hi def link uilPreCondit PreCondit +hi def link uilType Type +hi def link uilString String +hi def link uilComment Comment +hi def link uilSpecial Special +hi def link uilTodo Todo - delcommand HiLink -endif let b:current_syntax = "uil" diff --git a/runtime/syntax/updatedb.vim b/runtime/syntax/updatedb.vim index 7c082d62df..224a7dd2c2 100644 --- a/runtime/syntax/updatedb.vim +++ b/runtime/syntax/updatedb.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: updatedb.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2009-05-25 +" Language: updatedb.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2009-05-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/upstart.vim b/runtime/syntax/upstart.vim index b3f2b9e637..140cd174e0 100644 --- a/runtime/syntax/upstart.vim +++ b/runtime/syntax/upstart.vim @@ -10,9 +10,8 @@ " It is inspired by the initng syntax file and includes sh.vim to do the " highlighting of script blocks. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/upstreamdat.vim b/runtime/syntax/upstreamdat.vim index 7be806730d..e3b415a4bc 100644 --- a/runtime/syntax/upstreamdat.vim +++ b/runtime/syntax/upstreamdat.vim @@ -1,13 +1,14 @@ " Vim syntax file " Language: Innovation Data Processing upstream.dat file " Maintainer: Rob Owens <rowens@fdrinnovation.com> -" Latest Revision: 2013-06-17 +" Latest Revision: 2013-11-27 " Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif +" Parameters: syn keyword upstreamdat_Parameter ACCEPTPCREMOTE syn keyword upstreamdat_Parameter ACCEPTREMOTE syn keyword upstreamdat_Parameter ACTION @@ -291,6 +292,14 @@ syn keyword upstreamdat_Parameter XFERECORDSIZE syn keyword upstreamdat_Parameter XFERRECSEP syn keyword upstreamdat_Parameter XFERRECUSECR +" File Specs: +syn match upstreamdat_Filespec /file spec\c \d\{1,3}.*/ + +" Comments: +syn match upstreamdat_Comment /^#.*/ + hi def link upstreamdat_Parameter Type +"hi def link upstreamdat_Filespec Underlined +hi def link upstreamdat_Comment Comment let b:current_syntax = "upstreamdat" diff --git a/runtime/syntax/upstreamrpt.vim b/runtime/syntax/upstreamrpt.vim new file mode 100644 index 0000000000..21c25633a2 --- /dev/null +++ b/runtime/syntax/upstreamrpt.vim @@ -0,0 +1,310 @@ +" Vim syntax file +" Language: Innovation Data Processing upstream.rpt file +" Maintainer: Rob Owens <rowens@fdrinnovation.com> +" Latest Revision: 2014-03-13 + +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +setlocal foldmethod=syntax + +" Parameters: +syn keyword upstreamdat_Parameter ACCEPTPCREMOTE +syn keyword upstreamdat_Parameter ACCEPTREMOTE +syn keyword upstreamdat_Parameter ACTION +syn keyword upstreamdat_Parameter ACTIVATEONENTRY +syn keyword upstreamdat_Parameter ARCHIVEBIT +syn keyword upstreamdat_Parameter ARCHIVEBIT +syn keyword upstreamdat_Parameter ASCTOEBC +syn keyword upstreamdat_Parameter ASRBACKUP +syn keyword upstreamdat_Parameter ATTENDED +syn keyword upstreamdat_Parameter AUTHORITATIVE +syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE +syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE +syn keyword upstreamdat_Parameter BACKUPPROFILE +syn keyword upstreamdat_Parameter BACKUPPROFILE2 +syn keyword upstreamdat_Parameter BACKUPREPARSEFILES +syn keyword upstreamdat_Parameter BACKUPREPARSEFILES +syn keyword upstreamdat_Parameter BACKUPVERIFY +syn keyword upstreamdat_Parameter BLANKTRUNC +syn keyword upstreamdat_Parameter CALCDASDSIZE +syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS +syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS +syn keyword upstreamdat_Parameter COMPRESSLEVEL +syn keyword upstreamdat_Parameter CONTROLFILE +syn keyword upstreamdat_Parameter DASDOVERRIDE +syn keyword upstreamdat_Parameter DATELIMIT +syn keyword upstreamdat_Parameter DATELIMIT +syn keyword upstreamdat_Parameter DAYSOLD +syn keyword upstreamdat_Parameter DAYSOLD +syn keyword upstreamdat_Parameter DELETED +syn keyword upstreamdat_Parameter DELETED +syn keyword upstreamdat_Parameter DELETEPROMPTS +syn keyword upstreamdat_Parameter DELETEPROMPTS +syn keyword upstreamdat_Parameter DESTINATION +syn keyword upstreamdat_Parameter DESTINATION +syn keyword upstreamdat_Parameter DIRDELETE +syn keyword upstreamdat_Parameter DIRECTORVMC +syn keyword upstreamdat_Parameter DIRONLYRESTOREOK +syn keyword upstreamdat_Parameter DIRSONLY +syn keyword upstreamdat_Parameter DIRSONLY +syn keyword upstreamdat_Parameter DISASTERRECOVERY +syn keyword upstreamdat_Parameter DISPLAY +syn keyword upstreamdat_Parameter DRIVEALIAS +syn keyword upstreamdat_Parameter DRIVEALIAS +syn keyword upstreamdat_Parameter DUALCOPY +syn keyword upstreamdat_Parameter DUPDAYS +syn keyword upstreamdat_Parameter DUPLICATE +syn keyword upstreamdat_Parameter EBCTOASC +syn keyword upstreamdat_Parameter ENCRYPT +syn keyword upstreamdat_Parameter ENCRYPTLEVEL +syn keyword upstreamdat_Parameter EXCLUDELISTNAME +syn keyword upstreamdat_Parameter FAILBACKUPONERROR +syn keyword upstreamdat_Parameter FAILBACKUPONERROR +syn keyword upstreamdat_Parameter FAILIFNOFILES +syn keyword upstreamdat_Parameter FAILIFNOFILES +syn keyword upstreamdat_Parameter FAILIFSKIP +syn keyword upstreamdat_Parameter FAILJOB +syn keyword upstreamdat_Parameter FAILRESTOREONERROR +syn keyword upstreamdat_Parameter FAILRESTOREONERROR +syn keyword upstreamdat_Parameter FILEDATE +syn keyword upstreamdat_Parameter FILEDATE +syn keyword upstreamdat_Parameter FILEDELETE +syn keyword upstreamdat_Parameter FILEDELETE +syn keyword upstreamdat_Parameter FILES +syn keyword upstreamdat_Parameter FILES +syn keyword upstreamdat_Parameter FILESOPENFORUPDAT +syn keyword upstreamdat_Parameter FILESOPENFORUPDAT +syn keyword upstreamdat_Parameter FILETRANSFER +syn keyword upstreamdat_Parameter GETREMOTEFILES +syn keyword upstreamdat_Parameter HARDLINKDB +syn keyword upstreamdat_Parameter HARDLINKS +syn keyword upstreamdat_Parameter HARDLINKS +syn keyword upstreamdat_Parameter HIDDENFILES +syn keyword upstreamdat_Parameter HIDDENFILES +syn keyword upstreamdat_Parameter HOLDTAPE +syn keyword upstreamdat_Parameter HOLDUSERDIRS +syn keyword upstreamdat_Parameter HOSTFILENAME +syn keyword upstreamdat_Parameter HOSTRECORD +syn keyword upstreamdat_Parameter HOSTSORT +syn keyword upstreamdat_Parameter IGNOREPLUGINSFORRESTORE +syn keyword upstreamdat_Parameter INCRDB +syn keyword upstreamdat_Parameter INCRDBARCHIVEBIT +syn keyword upstreamdat_Parameter INCRDBDELETEDFILES +syn keyword upstreamdat_Parameter INCREMENTAL +syn keyword upstreamdat_Parameter INCREMENTAL +syn keyword upstreamdat_Parameter INQOPTIONS +syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT +syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT +syn keyword upstreamdat_Parameter JOBOPTIONS +syn keyword upstreamdat_Parameter JOBRETURNCODEMAP +syn keyword upstreamdat_Parameter JOBWAITTIMELIMIT +syn keyword upstreamdat_Parameter KEEPALIVE +syn keyword upstreamdat_Parameter LANINTERFACE +syn keyword upstreamdat_Parameter LANWSNAME +syn keyword upstreamdat_Parameter LANWSPASSWORD +syn keyword upstreamdat_Parameter LASTACCESS +syn keyword upstreamdat_Parameter LASTACCESS +syn keyword upstreamdat_Parameter LATESTDATE +syn keyword upstreamdat_Parameter LATESTDATE +syn keyword upstreamdat_Parameter LATESTTIME +syn keyword upstreamdat_Parameter LATESTTIME +syn keyword upstreamdat_Parameter LATESTVERSION +syn keyword upstreamdat_Parameter LINEBLOCK +syn keyword upstreamdat_Parameter LINETRUNC +syn keyword upstreamdat_Parameter LISTENFORREMOTE +syn keyword upstreamdat_Parameter LOCALBACKUP +syn keyword upstreamdat_Parameter LOCALBACKUPDIR +syn keyword upstreamdat_Parameter LOCALBACKUPMAX +syn keyword upstreamdat_Parameter LOCALBACKUPMAXFILESIZE +syn keyword upstreamdat_Parameter LOCALBACKUPMAXSIZE +syn keyword upstreamdat_Parameter LOCALEXCLUDEFILE +syn keyword upstreamdat_Parameter LOCALPARAMETERS +syn keyword upstreamdat_Parameter LOCALPASSWORD +syn keyword upstreamdat_Parameter LOCALRESTORE +syn keyword upstreamdat_Parameter LOCALUSER +syn keyword upstreamdat_Parameter LOFS +syn keyword upstreamdat_Parameter LOGNONFATAL +syn keyword upstreamdat_Parameter MAXBACKUPFILESFAIL +syn keyword upstreamdat_Parameter MAXBACKUPTIME +syn keyword upstreamdat_Parameter MAXDUPS +syn keyword upstreamdat_Parameter MAXFILENAMESIZE +syn keyword upstreamdat_Parameter MAXKFILESIZE +syn keyword upstreamdat_Parameter MAXLOGDAYS +syn keyword upstreamdat_Parameter MAXRESTOREFILESFAIL +syn keyword upstreamdat_Parameter MAXRESTORETIME +syn keyword upstreamdat_Parameter MAXRETRY +syn keyword upstreamdat_Parameter MAXRPTDAYS +syn keyword upstreamdat_Parameter MERGE +syn keyword upstreamdat_Parameter MIGRBITS +syn keyword upstreamdat_Parameter MIGRBITS +syn keyword upstreamdat_Parameter MINCOMPRESSSIZE +syn keyword upstreamdat_Parameter MINIMIZE +syn keyword upstreamdat_Parameter MODIFYFILE +syn keyword upstreamdat_Parameter MOUNTPOINTS +syn keyword upstreamdat_Parameter MOUNTPOINTS +syn keyword upstreamdat_Parameter NDS +syn keyword upstreamdat_Parameter NDS +syn keyword upstreamdat_Parameter NEWFILECOMPARE +syn keyword upstreamdat_Parameter NFSBELOW +syn keyword upstreamdat_Parameter NODATAOK +syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL +syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL +syn keyword upstreamdat_Parameter NONFILEDATABITMAP +syn keyword upstreamdat_Parameter NONFILEDATABITMAP +syn keyword upstreamdat_Parameter NOPOINTRESTORE +syn keyword upstreamdat_Parameter NOSPECINHERITANCE +syn keyword upstreamdat_Parameter NOTIFYEVENTS +syn keyword upstreamdat_Parameter NOTIFYFAILUREATTACHMENT +syn keyword upstreamdat_Parameter NOTIFYSUCCESSATTACHMENT +syn keyword upstreamdat_Parameter NOTIFYTARGETS +syn keyword upstreamdat_Parameter NOUIDGIDNAMES +syn keyword upstreamdat_Parameter NOUIDGIDNAMES +syn keyword upstreamdat_Parameter NOVELLMIGRATE +syn keyword upstreamdat_Parameter NOVELLMIGRATE +syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT +syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT +syn keyword upstreamdat_Parameter NOVELLPROFILE +syn keyword upstreamdat_Parameter NOVELLRECALL +syn keyword upstreamdat_Parameter NTFSADDPERMISSION +syn keyword upstreamdat_Parameter NTFSADDPERMISSION +syn keyword upstreamdat_Parameter NTREGRESTORE +syn keyword upstreamdat_Parameter OSTYPE +syn keyword upstreamdat_Parameter OUTPORT +syn keyword upstreamdat_Parameter PACKFLUSHAFTERFILE +syn keyword upstreamdat_Parameter PACKRECSIZE +syn keyword upstreamdat_Parameter PARAMETER +syn keyword upstreamdat_Parameter PASSWORD +syn keyword upstreamdat_Parameter PATHNAME +syn keyword upstreamdat_Parameter PATHNAME +syn keyword upstreamdat_Parameter PERFORMBITMAP +syn keyword upstreamdat_Parameter PERFORMNUMRECORDS +syn keyword upstreamdat_Parameter PERFORMRECORDSIZE +syn keyword upstreamdat_Parameter PLUGIN +syn keyword upstreamdat_Parameter PLUGIN +syn keyword upstreamdat_Parameter PLUGINPARAMETERS +syn keyword upstreamdat_Parameter PLUGINPARAMETERS +syn keyword upstreamdat_Parameter POSTJOB +syn keyword upstreamdat_Parameter PREJOB +syn keyword upstreamdat_Parameter PRTYCLASS +syn keyword upstreamdat_Parameter PRTYLEVEL +syn keyword upstreamdat_Parameter RECALLCLEANUP +syn keyword upstreamdat_Parameter RECALLOFFLINEFILES +syn keyword upstreamdat_Parameter RECALLOFFLINEFILES +syn keyword upstreamdat_Parameter RECORDSIZE +syn keyword upstreamdat_Parameter REMOTEADDR +syn keyword upstreamdat_Parameter REMOTEAPPLPREF +syn keyword upstreamdat_Parameter REMOTEAPPLRETRY +syn keyword upstreamdat_Parameter REMOTECONNECTTYPE +syn keyword upstreamdat_Parameter REMOTEFLAGS +syn keyword upstreamdat_Parameter REMOTEIPADAPTER +syn keyword upstreamdat_Parameter REMOTELOCALPARAMETERS +syn keyword upstreamdat_Parameter REMOTELOGMODE +syn keyword upstreamdat_Parameter REMOTELUNAME +syn keyword upstreamdat_Parameter REMOTEMAXRETRIES +syn keyword upstreamdat_Parameter REMOTEMODENAME +syn keyword upstreamdat_Parameter REMOTEPARAMETERFILE +syn keyword upstreamdat_Parameter REMOTEPORT +syn keyword upstreamdat_Parameter REMOTEREQUEST +syn keyword upstreamdat_Parameter REMOTERESTART +syn keyword upstreamdat_Parameter REMOTEROUTE +syn keyword upstreamdat_Parameter REMOTETARGETNAME +syn keyword upstreamdat_Parameter REMOTETCP +syn keyword upstreamdat_Parameter REMOTETIMEOUT +syn keyword upstreamdat_Parameter REMOTETMAXRETRY +syn keyword upstreamdat_Parameter REMOTETPN +syn keyword upstreamdat_Parameter REMOTEUSAPPL +syn keyword upstreamdat_Parameter REMOTEVERIFY +syn keyword upstreamdat_Parameter REMOTEWTOCOMP +syn keyword upstreamdat_Parameter REPORTNAME +syn keyword upstreamdat_Parameter REPORTOPTIONS +syn keyword upstreamdat_Parameter RESTARTLASTFILE +syn keyword upstreamdat_Parameter RESTART +syn keyword upstreamdat_Parameter RESTARTTYPE +syn keyword upstreamdat_Parameter RESTARTVERSIONDATE +syn keyword upstreamdat_Parameter RESTOREARCHIVEBIT +syn keyword upstreamdat_Parameter RESTORECHECKPOINT +syn keyword upstreamdat_Parameter RESTOREDATELIMIT +syn keyword upstreamdat_Parameter RESTOREDATELIMIT +syn keyword upstreamdat_Parameter RESTOREFILEFAIL +syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS +syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS +syn keyword upstreamdat_Parameter RESTORESEGMENTS +syn keyword upstreamdat_Parameter RESTORESEGMENTS +syn keyword upstreamdat_Parameter RESTORETODIFFFS +syn keyword upstreamdat_Parameter RETAIN +syn keyword upstreamdat_Parameter RETAIN +syn keyword upstreamdat_Parameter ROOTENTRY +syn keyword upstreamdat_Parameter ROOTENTRY +syn keyword upstreamdat_Parameter SAN +syn keyword upstreamdat_Parameter SCHEDULENAME +syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE +syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE +syn keyword upstreamdat_Parameter SEGMENTSIZE +syn keyword upstreamdat_Parameter SEGMENTSIZE +syn keyword upstreamdat_Parameter SENDHOSTDETAILS +syn keyword upstreamdat_Parameter SINGLEFS +syn keyword upstreamdat_Parameter SIZETRC +syn keyword upstreamdat_Parameter SKIP +syn keyword upstreamdat_Parameter SKIPBACKUPSCAN +syn keyword upstreamdat_Parameter SKIPOLD +syn keyword upstreamdat_Parameter SKIPOLD +syn keyword upstreamdat_Parameter SMSTARGETSERVICENAME +syn keyword upstreamdat_Parameter SMSTSA +syn keyword upstreamdat_Parameter SOLO +syn keyword upstreamdat_Parameter SORTBACKUP +syn keyword upstreamdat_Parameter SOSDISK +syn keyword upstreamdat_Parameter SOSDISK +syn keyword upstreamdat_Parameter SOSTIMESTAMP +syn keyword upstreamdat_Parameter SOSTIMESTAMP +syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH +syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH +syn keyword upstreamdat_Parameter SPECNUMBER +syn keyword upstreamdat_Parameter SPECNUMBER +syn keyword upstreamdat_Parameter SPECTYPE +syn keyword upstreamdat_Parameter SPECTYPE +syn keyword upstreamdat_Parameter STARTTIME +syn keyword upstreamdat_Parameter STORAGETYPE +syn keyword upstreamdat_Parameter SUBDIRECTORIES +syn keyword upstreamdat_Parameter SUBDIRECTORIES +syn keyword upstreamdat_Parameter SWITCHTOTAPEMB +syn keyword upstreamdat_Parameter TCPADDRESS +syn keyword upstreamdat_Parameter TCPTIMEOUT +syn keyword upstreamdat_Parameter TIMEOVERRIDE +syn keyword upstreamdat_Parameter TRACE +syn keyword upstreamdat_Parameter TRANSLATE +syn keyword upstreamdat_Parameter ULTRACOMP +syn keyword upstreamdat_Parameter ULTREG +syn keyword upstreamdat_Parameter ULTUPD +syn keyword upstreamdat_Parameter UNCMACHINEALIAS +syn keyword upstreamdat_Parameter UNCMACHINEALIAS +syn keyword upstreamdat_Parameter USEALEBRA +syn keyword upstreamdat_Parameter USECONTROLFILE +syn keyword upstreamdat_Parameter USEGID +syn keyword upstreamdat_Parameter USERID +syn keyword upstreamdat_Parameter USEUID +syn keyword upstreamdat_Parameter USNOUIDGIDERRORS +syn keyword upstreamdat_Parameter UTF8 +syn keyword upstreamdat_Parameter VAULTNUMBER +syn keyword upstreamdat_Parameter VERSIONDATE +syn keyword upstreamdat_Parameter WRITESPARSE +syn keyword upstreamdat_Parameter XFERECORDSIZE +syn keyword upstreamdat_Parameter XFERRECSEP +syn keyword upstreamdat_Parameter XFERRECUSECR + +" File Specs: +syn match upstreamdat_Filespec /file spec\c \d\{1,3}.*/ + +" Comments: +syn match upstreamdat_Comment /^#.*/ + +" List Of Parameters: +syn region upstreamdat_Parms start="Current Parameters:" end="End Of Parameters" transparent fold + +hi def link upstreamdat_Parameter Type +"hi def link upstreamdat_Filespec Underlined +hi def link upstreamdat_Comment Comment + +let b:current_syntax = "upstreamrpt" diff --git a/runtime/syntax/usw2kagtlog.vim b/runtime/syntax/usw2kagtlog.vim index 0a34128f9b..a112340d12 100644 --- a/runtime/syntax/usw2kagtlog.vim +++ b/runtime/syntax/usw2kagtlog.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Innovation Data Processing USW2KAgt.log file " Maintainer: Rob Owens <rowens@fdrinnovation.com> -" Latest Revision: 2013-09-19 +" Latest Revision: 2014-04-01 " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -17,8 +17,12 @@ syn match usw2kagtlog_MsgI /Msg #\(Agt\|PC\|Srv\)\d\{4,5}I/ nextgroup=usw2kagtlo syn match usw2kagtlog_MsgW /Msg #\(Agt\|PC\|Srv\)\d\{4,5}W/ nextgroup=usw2kagtlog_Process skipwhite " Processes: syn region usw2kagtlog_Process start="(" end=")" contained -syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client request" -syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client\s\{0,1}\r\{0,1}\s\{1,9}request" +"syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client\s\{0,1}\r\{0,1}\s\{1,9}request" +syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client" +syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client" " IP Address: syn match usw2kagtlog_IPaddr / \d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/ " Profile: diff --git a/runtime/syntax/valgrind.vim b/runtime/syntax/valgrind.vim index 48e9564acb..d099971826 100644 --- a/runtime/syntax/valgrind.vim +++ b/runtime/syntax/valgrind.vim @@ -2,9 +2,12 @@ " Language: Valgrind Memory Debugger Output " Maintainer: Roger Luethi <rl@hellgate.ch> " Program URL: http://devel-home.kde.org/~sewardj/ -" Last Change: 2012 Apr 30 +" Last Change: 2015 Jan 27 +" Included improvement by Dominique Pelle " " Notes: mostly based on strace.vim and xml.vim +" +" Contributors: Christoph Gysin <christoph.gysin@gmail.com> " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -13,6 +16,9 @@ endif let s:keepcpo= &cpo set cpo&vim +" Lines can be long with demangled c++ functions. +setlocal synmaxcol=8000 + syn case match syn sync minlines=50 @@ -27,8 +33,8 @@ syn region valgrindRegion \ contains=valgrindPidChunk,valgrindLine syn region valgrindPidChunk - \ start=+\(^==\)\@<=+ - \ end=+\(==\)\@=+ + \ start=+^==\zs+ + \ end=+\ze==+ \ contained \ contains=valgrindPid0,valgrindPid1,valgrindPid2,valgrindPid3,valgrindPid4,valgrindPid5,valgrindPid6,valgrindPid7,valgrindPid8,valgrindPid9 \ keepend @@ -62,10 +68,11 @@ syn match valgrindSummary ".*SUMMARY:" contained syn match valgrindLoc "\s\+\(by\|at\|Address\).*$" contained \ contains=valgrindAt,valgrindAddr,valgrindFunc,valgrindBin,valgrindSrc syn match valgrindAt "at\s\@=" contained -syn match valgrindAddr "\(\W\)\@<=0x\x\+" contained -syn match valgrindFunc "\(: \)\@<=\w\+" contained -syn match valgrindBin "\((\(with\|\)in \)\@<=\S\+\()\)\@=" contained -syn match valgrindSrc "\((\)\@<=.*:\d\+\()\)\@=" contained +syn match valgrindAddr "\W\zs0x\x\+" contained + +syn match valgrindFunc ": \zs\h[a-zA-Z0-9_:\[\]()<>&*+\-,=%!|^ ]*\ze([^)]*)$" contained +syn match valgrindBin "(\(with\)\=in \zs\S\+)\@=" contained +syn match valgrindSrc "(\zs[^)]*:\d\+)\@=" contained " Define the default highlighting diff --git a/runtime/syntax/vb.vim b/runtime/syntax/vb.vim index 14f9e64850..8ddb1efac3 100644 --- a/runtime/syntax/vb.vim +++ b/runtime/syntax/vb.vim @@ -11,11 +11,8 @@ " VIM and VIM-DEV mailing lists. It is by no means complete. " Send comments, suggestions and requests to the maintainer. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -223,7 +220,7 @@ syn keyword vbStatement Explicit FileCopy For ForEach Function Get GoSub syn keyword vbStatement GoTo Gosub Implements Kill LSet Let Lib LineInput syn keyword vbStatement Load Lock Loop Mid MkDir Name Next On OnError Open syn keyword vbStatement Option Preserve Private Property Public Put RSet -syn keyword vbStatement RaiseEvent Randomize ReDim Redim Rem Reset Resume +syn keyword vbStatement RaiseEvent Randomize ReDim Redim Reset Resume syn keyword vbStatement Return RmDir SavePicture SaveSetting Seek SendKeys syn keyword vbStatement Sendkeys Set SetAttr Static Step Stop Sub Time syn keyword vbStatement Type Unload Unlock Until Wend While Width With @@ -338,40 +335,30 @@ syn match vbTypeSpecifier "[a-zA-Z0-9][\$%&!#]"ms=s+1 syn match vbTypeSpecifier "#[a-zA-Z0-9]"me=e-1 " 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_vb_syntax_inits") - if version < 508 - let did_vb_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink vbBoolean Boolean - HiLink vbLineNumber Comment - HiLink vbComment Comment - HiLink vbConditional Conditional - HiLink vbConst Constant - HiLink vbDefine Constant - HiLink vbError Error - HiLink vbFunction Identifier - HiLink vbIdentifier Identifier - HiLink vbNumber Number - HiLink vbFloat Float - HiLink vbMethods PreProc - HiLink vbOperator Operator - HiLink vbRepeat Repeat - HiLink vbString String - HiLink vbStatement Statement - HiLink vbKeyword Statement - HiLink vbEvents Special - HiLink vbTodo Todo - HiLink vbTypes Type - HiLink vbTypeSpecifier Type +hi def link vbBoolean Boolean +hi def link vbLineNumber Comment +hi def link vbComment Comment +hi def link vbConditional Conditional +hi def link vbConst Constant +hi def link vbDefine Constant +hi def link vbError Error +hi def link vbFunction Identifier +hi def link vbIdentifier Identifier +hi def link vbNumber Number +hi def link vbFloat Float +hi def link vbMethods PreProc +hi def link vbOperator Operator +hi def link vbRepeat Repeat +hi def link vbString String +hi def link vbStatement Statement +hi def link vbKeyword Statement +hi def link vbEvents Special +hi def link vbTodo Todo +hi def link vbTypes Type +hi def link vbTypeSpecifier Type - delcommand HiLink -endif let b:current_syntax = "vb" diff --git a/runtime/syntax/vera.vim b/runtime/syntax/vera.vim index b8e25cf346..b41c0a6cbf 100644 --- a/runtime/syntax/vera.vim +++ b/runtime/syntax/vera.vim @@ -10,11 +10,8 @@ " (change the value for guibg to any color you like) -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -287,74 +284,64 @@ endif exec "syn sync ccomment veraComment minlines=" . b:vera_minlines " 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_vera_syn_inits") - if version < 508 - let did_vera_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet + +hi def link veraClass Identifier +hi def link veraObject Identifier +hi def link veraUserMethod Function +hi def link veraTask Keyword +hi def link veraModifier Tag +hi def link veraDeprecated veraError +hi def link veraMethods Statement +" hi def link veraInterface Label +hi def link veraInterface Function + +hi def link veraFormat veraSpecial +hi def link veraCppString veraString +hi def link veraCommentL veraComment +hi def link veraCommentStart veraComment +hi def link veraLabel Label +hi def link veraUserLabel Label +hi def link veraConditional Conditional +hi def link veraRepeat Repeat +hi def link veraCharacter Character +hi def link veraSpecialCharacter veraSpecial +hi def link veraNumber Number +hi def link veraOctal Number +hi def link veraOctalZero PreProc " link this to Error if you want +hi def link veraFloat Float +hi def link veraOctalError veraError +hi def link veraParenError veraError +hi def link veraErrInParen veraError +hi def link veraErrInBracket veraError +hi def link veraCommentError veraError +hi def link veraCommentStartError veraError +hi def link veraSpaceError SpaceError +hi def link veraSpecialError veraError +hi def link veraOperator Operator +hi def link veraStructure Structure +hi def link veraInclude Include +hi def link veraPreProc PreProc +hi def link veraDefine Macro +hi def link veraIncluded veraString +hi def link veraError Error +hi def link veraStatement Statement +hi def link veraPreCondit PreCondit +hi def link veraType Type +" hi def link veraConstant Constant +hi def link veraConstant Keyword +hi def link veraUserConstant Constant +hi def link veraCommentString veraString +hi def link veraComment2String veraString +hi def link veraCommentSkip veraComment +hi def link veraString String +hi def link veraComment Comment +hi def link veraSpecial SpecialChar +hi def link veraTodo Todo +hi def link veraCppSkip veraCppOut +hi def link veraCppOut2 veraCppOut +hi def link veraCppOut Comment - HiLink veraClass Identifier - HiLink veraObject Identifier - HiLink veraUserMethod Function - HiLink veraTask Keyword - HiLink veraModifier Tag - HiLink veraDeprecated veraError - HiLink veraMethods Statement - " HiLink veraInterface Label - HiLink veraInterface Function - - HiLink veraFormat veraSpecial - HiLink veraCppString veraString - HiLink veraCommentL veraComment - HiLink veraCommentStart veraComment - HiLink veraLabel Label - HiLink veraUserLabel Label - HiLink veraConditional Conditional - HiLink veraRepeat Repeat - HiLink veraCharacter Character - HiLink veraSpecialCharacter veraSpecial - HiLink veraNumber Number - HiLink veraOctal Number - HiLink veraOctalZero PreProc " link this to Error if you want - HiLink veraFloat Float - HiLink veraOctalError veraError - HiLink veraParenError veraError - HiLink veraErrInParen veraError - HiLink veraErrInBracket veraError - HiLink veraCommentError veraError - HiLink veraCommentStartError veraError - HiLink veraSpaceError SpaceError - HiLink veraSpecialError veraError - HiLink veraOperator Operator - HiLink veraStructure Structure - HiLink veraInclude Include - HiLink veraPreProc PreProc - HiLink veraDefine Macro - HiLink veraIncluded veraString - HiLink veraError Error - HiLink veraStatement Statement - HiLink veraPreCondit PreCondit - HiLink veraType Type - " HiLink veraConstant Constant - HiLink veraConstant Keyword - HiLink veraUserConstant Constant - HiLink veraCommentString veraString - HiLink veraComment2String veraString - HiLink veraCommentSkip veraComment - HiLink veraString String - HiLink veraComment Comment - HiLink veraSpecial SpecialChar - HiLink veraTodo Todo - HiLink veraCppSkip veraCppOut - HiLink veraCppOut2 veraCppOut - HiLink veraCppOut Comment - - delcommand HiLink -endif let b:current_syntax = "vera" diff --git a/runtime/syntax/verilog.vim b/runtime/syntax/verilog.vim index f4d21d0739..bbaca491a7 100644 --- a/runtime/syntax/verilog.vim +++ b/runtime/syntax/verilog.vim @@ -3,22 +3,15 @@ " Maintainer: Mun Johl <Mun.Johl@emulex.com> " Last Update: Wed Jul 20 16:04:19 PDT 2011 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Set the local value of the 'iskeyword' option. " NOTE: '?' was added so that verilogNumber would be processed correctly when " '?' is the last character of the number. -if version >= 600 - setlocal iskeyword=@,48-57,63,_,192-255 -else - set iskeyword=@,48-57,63,_,192-255 -endif +setlocal iskeyword=@,48-57,63,_,192-255 " A bunch of useful Verilog keywords @@ -102,34 +95,24 @@ syn region verilogDirective start="//\s*\$s dc_script_begin\>" end="//\s*\$s syn sync minlines=50 " 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_verilog_syn_inits") - if version < 508 - let did_verilog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink verilogCharacter Character - HiLink verilogConditional Conditional - HiLink verilogRepeat Repeat - HiLink verilogString String - HiLink verilogTodo Todo - HiLink verilogComment Comment - HiLink verilogConstant Constant - HiLink verilogLabel Label - HiLink verilogNumber Number - HiLink verilogOperator Special - HiLink verilogStatement Statement - HiLink verilogGlobal Define - HiLink verilogDirective SpecialComment - HiLink verilogEscape Special - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default highlighting. +hi def link verilogCharacter Character +hi def link verilogConditional Conditional +hi def link verilogRepeat Repeat +hi def link verilogString String +hi def link verilogTodo Todo +hi def link verilogComment Comment +hi def link verilogConstant Constant +hi def link verilogLabel Label +hi def link verilogNumber Number +hi def link verilogOperator Special +hi def link verilogStatement Statement +hi def link verilogGlobal Define +hi def link verilogDirective SpecialComment +hi def link verilogEscape Special + let b:current_syntax = "verilog" diff --git a/runtime/syntax/verilogams.vim b/runtime/syntax/verilogams.vim index d16e4bffb4..7551b681a8 100644 --- a/runtime/syntax/verilogams.vim +++ b/runtime/syntax/verilogams.vim @@ -9,20 +9,13 @@ " Minor reserved keyword updates. " Last Update: Thursday September 15 15:36:03 CST 2005 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Set the local value of the 'iskeyword' option -if version >= 600 - setlocal iskeyword=@,48-57,_,192-255 -else - set iskeyword=@,48-57,_,192-255 -endif +setlocal iskeyword=@,48-57,_,192-255 " Annex B.1 'All keywords' syn keyword verilogamsStatement above abs absdelay acos acosh ac_stim @@ -113,36 +106,26 @@ syn match verilogamsEscape "\\\o\o\=\o\=" contained syn sync lines=50 " 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_verilogams_syn_inits") - if version < 508 - let did_verilogams_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - " The default highlighting. - HiLink verilogamsCharacter Character - HiLink verilogamsConditional Conditional - HiLink verilogamsRepeat Repeat - HiLink verilogamsString String - HiLink verilogamsTodo Todo - HiLink verilogamsComment Comment - HiLink verilogamsConstant Constant - HiLink verilogamsLabel Label - HiLink verilogamsNumber Number - HiLink verilogamsOperator Special - HiLink verilogamsStatement Statement - HiLink verilogamsGlobal Define - HiLink verilogamsDirective SpecialComment - HiLink verilogamsEscape Special - HiLink verilogamsType Type - HiLink verilogamsSystask Function +" The default highlighting. +hi def link verilogamsCharacter Character +hi def link verilogamsConditional Conditional +hi def link verilogamsRepeat Repeat +hi def link verilogamsString String +hi def link verilogamsTodo Todo +hi def link verilogamsComment Comment +hi def link verilogamsConstant Constant +hi def link verilogamsLabel Label +hi def link verilogamsNumber Number +hi def link verilogamsOperator Special +hi def link verilogamsStatement Statement +hi def link verilogamsGlobal Define +hi def link verilogamsDirective SpecialComment +hi def link verilogamsEscape Special +hi def link verilogamsType Type +hi def link verilogamsSystask Function - delcommand HiLink -endif let b:current_syntax = "verilogams" diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim index db51fa5034..efcb840284 100644 --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -1,203 +1,265 @@ " Vim syntax file -" Language: VHDL -" Maintainer: Daniel Kho <daniel.kho@tauhop.com> +" Language: VHDL [VHSIC (Very High Speed Integrated Circuit) Hardware Description Language] +" Maintainer: Daniel Kho <daniel.kho@tauhop.com> " Previous Maintainer: Czo <Olivier.Sirol@lip6.fr> -" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> -" Last Changed: 2012 Feb 03 by Thilo Six -" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $ +" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> +" Last Changed: 2018 May 06 by Daniel Kho -" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim -" This is not VHDL. I use the C-Preprocessor cpp to generate different binaries -" from one VHDL source file. Unfortunately there is no preprocessor for VHDL -" available. If you don't like this, please remove the following lines. -"syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+" -"syn match cDefine "^#endif" - " case is not significant -syn case ignore +syn case ignore " VHDL keywords -syn keyword vhdlStatement access after alias all assert -syn keyword vhdlStatement architecture array attribute -syn keyword vhdlStatement assume assume_guarantee -syn keyword vhdlStatement begin block body buffer bus -syn keyword vhdlStatement case component configuration constant -syn keyword vhdlStatement context cover -syn keyword vhdlStatement default disconnect downto -syn keyword vhdlStatement elsif end entity exit -syn keyword vhdlStatement file for function -syn keyword vhdlStatement fairness force -syn keyword vhdlStatement generate generic group guarded -syn keyword vhdlStatement impure in inertial inout is -syn keyword vhdlStatement label library linkage literal loop -syn keyword vhdlStatement map -syn keyword vhdlStatement new next null -syn keyword vhdlStatement of on open others out -syn keyword vhdlStatement package port postponed procedure process pure -syn keyword vhdlStatement parameter property protected -syn keyword vhdlStatement range record register reject report return -syn keyword vhdlStatement release restrict restrict_guarantee -syn keyword vhdlStatement select severity signal shared -syn keyword vhdlStatement subtype -syn keyword vhdlStatement sequence strong -syn keyword vhdlStatement then to transport type -syn keyword vhdlStatement unaffected units until use -syn keyword vhdlStatement variable -syn keyword vhdlStatement vmode vprop vunit -syn keyword vhdlStatement wait when while with -syn keyword vhdlStatement note warning error failure - -" Special match for "if" and "else" since "else if" shouldn't be highlighted. -" The right keyword is "elsif" -syn match vhdlStatement "\<\(if\|else\)\>" -syn match vhdlNone "\<else\s\+if\>$" -syn match vhdlNone "\<else\s\+if\>\s" - -" Predefined VHDL types -syn keyword vhdlType bit bit_vector -syn keyword vhdlType character boolean integer real time -syn keyword vhdlType boolean_vector integer_vector real_vector time_vector -syn keyword vhdlType string severity_level -" Predefined standard ieee VHDL types -syn keyword vhdlType positive natural signed unsigned -syn keyword vhdlType line text -syn keyword vhdlType std_logic std_logic_vector -syn keyword vhdlType std_ulogic std_ulogic_vector -" Predefined non standard VHDL types for Mentor Graphics Sys1076/QuickHDL -"syn keyword vhdlType qsim_state qsim_state_vector -"syn keyword vhdlType qsim_12state qsim_12state_vector -"syn keyword vhdlType qsim_strength -" Predefined non standard VHDL types for Alliance VLSI CAD -"syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector +syn keyword vhdlStatement access after alias all assert +syn keyword vhdlStatement architecture array attribute +syn keyword vhdlStatement assume assume_guarantee +syn keyword vhdlStatement begin block body buffer bus +syn keyword vhdlStatement case component configuration constant +syn keyword vhdlStatement context cover +syn keyword vhdlStatement default disconnect downto +syn keyword vhdlStatement elsif end entity exit +syn keyword vhdlStatement file for function +syn keyword vhdlStatement fairness force +syn keyword vhdlStatement generate generic group guarded +syn keyword vhdlStatement impure in inertial inout is +syn keyword vhdlStatement label library linkage literal loop +syn keyword vhdlStatement map +syn keyword vhdlStatement new next null +syn keyword vhdlStatement of on open others out +syn keyword vhdlStatement package port postponed procedure process pure +syn keyword vhdlStatement parameter property protected +syn keyword vhdlStatement range record register reject report return +syn keyword vhdlStatement release restrict restrict_guarantee +syn keyword vhdlStatement select severity signal shared +syn keyword vhdlStatement subtype +syn keyword vhdlStatement sequence strong +syn keyword vhdlStatement then to transport type +syn keyword vhdlStatement unaffected units until use +syn keyword vhdlStatement variable +" VHDL-2017 interface +syn keyword vhdlStatement view +syn keyword vhdlStatement vmode vprop vunit +syn keyword vhdlStatement wait when while with +syn keyword vhdlStatement note warning error failure + +" Linting of conditionals. +syn match vhdlStatement "\<\(if\|else\)\>" +syn match vhdlError "\<else\s\+if\>" + +" Types and type qualifiers +" Predefined standard VHDL types +syn match vhdlType "\<bit\>\'\=" +syn match vhdlType "\<boolean\>\'\=" +syn match vhdlType "\<natural\>\'\=" +syn match vhdlType "\<positive\>\'\=" +syn match vhdlType "\<integer\>\'\=" +syn match vhdlType "\<real\>\'\=" +syn match vhdlType "\<time\>\'\=" + +syn match vhdlType "\<bit_vector\>\'\=" +syn match vhdlType "\<boolean_vector\>\'\=" +syn match vhdlType "\<integer_vector\>\'\=" +syn match vhdlType "\<real_vector\>\'\=" +syn match vhdlType "\<time_vector\>\'\=" + +syn match vhdlType "\<character\>\'\=" +syn match vhdlType "\<string\>\'\=" +syn keyword vhdlType line text side width + +" Predefined standard IEEE VHDL types +syn match vhdlType "\<std_ulogic\>\'\=" +syn match vhdlType "\<std_logic\>\'\=" +syn match vhdlType "\<std_ulogic_vector\>\'\=" +syn match vhdlType "\<std_logic_vector\>\'\=" +syn match vhdlType "\<unresolved_signed\>\'\=" +syn match vhdlType "\<unresolved_unsigned\>\'\=" +syn match vhdlType "\<u_signed\>\'\=" +syn match vhdlType "\<u_unsigned\>\'\=" +syn match vhdlType "\<signed\>\'\=" +syn match vhdlType "\<unsigned\>\'\=" + " array attributes -syn match vhdlAttribute "\'high" -syn match vhdlAttribute "\'left" -syn match vhdlAttribute "\'length" -syn match vhdlAttribute "\'low" -syn match vhdlAttribute "\'range" -syn match vhdlAttribute "\'reverse_range" -syn match vhdlAttribute "\'right" -syn match vhdlAttribute "\'ascending" +syn match vhdlAttribute "\'high" +syn match vhdlAttribute "\'left" +syn match vhdlAttribute "\'length" +syn match vhdlAttribute "\'low" +syn match vhdlAttribute "\'range" +syn match vhdlAttribute "\'reverse_range" +syn match vhdlAttribute "\'right" +syn match vhdlAttribute "\'ascending" " block attributes -syn match vhdlAttribute "\'behaviour" -syn match vhdlAttribute "\'structure" -syn match vhdlAttribute "\'simple_name" -syn match vhdlAttribute "\'instance_name" -syn match vhdlAttribute "\'path_name" -syn match vhdlAttribute "\'foreign" +syn match vhdlAttribute "\'simple_name" +syn match vhdlAttribute "\'instance_name" +syn match vhdlAttribute "\'path_name" +syn match vhdlAttribute "\'foreign" " VHPI " signal attribute -syn match vhdlAttribute "\'active" -syn match vhdlAttribute "\'delayed" -syn match vhdlAttribute "\'event" -syn match vhdlAttribute "\'last_active" -syn match vhdlAttribute "\'last_event" -syn match vhdlAttribute "\'last_value" -syn match vhdlAttribute "\'quiet" -syn match vhdlAttribute "\'stable" -syn match vhdlAttribute "\'transaction" -syn match vhdlAttribute "\'driving" -syn match vhdlAttribute "\'driving_value" +syn match vhdlAttribute "\'active" +syn match vhdlAttribute "\'delayed" +syn match vhdlAttribute "\'event" +syn match vhdlAttribute "\'last_active" +syn match vhdlAttribute "\'last_event" +syn match vhdlAttribute "\'last_value" +syn match vhdlAttribute "\'quiet" +syn match vhdlAttribute "\'stable" +syn match vhdlAttribute "\'transaction" +syn match vhdlAttribute "\'driving" +syn match vhdlAttribute "\'driving_value" " type attributes -syn match vhdlAttribute "\'base" -syn match vhdlAttribute "\'high" -syn match vhdlAttribute "\'left" -syn match vhdlAttribute "\'leftof" -syn match vhdlAttribute "\'low" -syn match vhdlAttribute "\'pos" -syn match vhdlAttribute "\'pred" -syn match vhdlAttribute "\'rightof" -syn match vhdlAttribute "\'succ" -syn match vhdlAttribute "\'val" -syn match vhdlAttribute "\'image" -syn match vhdlAttribute "\'value" - -syn keyword vhdlBoolean true false +syn match vhdlAttribute "\'base" +syn match vhdlAttribute "\'subtype" +syn match vhdlAttribute "\'element" +syn match vhdlAttribute "\'leftof" +syn match vhdlAttribute "\'pos" +syn match vhdlAttribute "\'pred" +syn match vhdlAttribute "\'rightof" +syn match vhdlAttribute "\'succ" +syn match vhdlAttribute "\'val" +syn match vhdlAttribute "\'image" +syn match vhdlAttribute "\'value" +" VHDL-2017 interface attribute +syn match vhdlAttribute "\'converse" + +syn keyword vhdlBoolean true false " for this vector values case is significant -syn case match +syn case match " Values for standard VHDL types -syn match vhdlVector "\'[0L1HXWZU\-\?]\'" -" Values for non standard VHDL types qsim_12state for Mentor Graphics Sys1076/QuickHDL -"syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI -syn case ignore +syn match vhdlVector "\'[0L1HXWZU\-\?]\'" +syn case ignore -syn match vhdlVector "B\"[01_]\+\"" -syn match vhdlVector "O\"[0-7_]\+\"" -syn match vhdlVector "X\"[0-9a-f_]\+\"" -syn match vhdlCharacter "'.'" -syn region vhdlString start=+"+ end=+"+ +syn match vhdlVector "B\"[01_]\+\"" +syn match vhdlVector "O\"[0-7_]\+\"" +syn match vhdlVector "X\"[0-9a-f_]\+\"" +syn match vhdlCharacter "'.'" +syn region vhdlString start=+"+ end=+"+ " floating numbers -syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>" -syn match vhdlNumber "-\=\<\d\+\.\d\+\>" -syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\=" -syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>" +syn match vhdlNumber "-\=\<\d\+\.\d\+\>" +syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" " integer numbers -syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>" -syn match vhdlNumber "-\=\<\d\+\>" -syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\=" -syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>" +syn match vhdlNumber "-\=\<\d\+\>" +syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" + " operators -syn keyword vhdlOperator and nand or nor xor xnor -syn keyword vhdlOperator rol ror sla sll sra srl -syn keyword vhdlOperator mod rem abs not -syn match vhdlOperator "[&><=:+\-*\/|]" -syn match vhdlSpecial "[().,;]" +syn keyword vhdlOperator and nand or nor xor xnor +syn keyword vhdlOperator rol ror sla sll sra srl +syn keyword vhdlOperator mod rem abs not + +" Concatenation and math operators +syn match vhdlOperator "&\|+\|-\|\*\|\/" + +" Equality and comparison operators +syn match vhdlOperator "=\|\/=\|>\|<\|>=" + +" Assignment operators +syn match vhdlOperator "<=\|:=" +syn match vhdlOperator "=>" + +" VHDL-2017 concurrent signal association (spaceship) operator +syn match vhdlOperator "<=>" + +" VHDL-2008 conversion, matching equality/non-equality operators +syn match vhdlOperator "??\|?=\|?\/=\|?<\|?<=\|?>\|?>=" + +" VHDL-2008 external names +syn match vhdlOperator "<<\|>>" + +" Linting for illegal operators +" '=' +syn match vhdlError "\(=\)[<=&+\-\*\/\\]\+" +syn match vhdlError "[=&+\-\*\\]\+\(=\)" +" '>', '<' +" Allow external names: '<< ... >>' +syn match vhdlError "\(>\)[<&+\-\/\\]\+" +syn match vhdlError "[&+\-\/\\]\+\(>\)" +syn match vhdlError "\(<\)[&+\-\/\\]\+" +syn match vhdlError "[>=&+\-\/\\]\+\(<\)" +" Covers most operators +" support negative sign after operators. E.g. q<=-b; +" Supports VHDL-2017 spaceship (concurrent simple signal association). +syn match vhdlError "\(<=\)[<=&+\*\\?:]\+" +syn match vhdlError "[>=&+\-\*\\:]\+\(=>\)" +syn match vhdlError "\(&\|+\|\-\|\*\*\|\/=\|??\|?=\|?\/=\|?<=\|?>=\|>=\|:=\|=>\)[<>=&+\*\\?:]\+" +syn match vhdlError "[<>=&+\-\*\\:]\+\(&\|+\|\*\*\|\/=\|??\|?=\|?\/=\|?<\|?<=\|?>\|?>=\|>=\|<=\|:=\)" +syn match vhdlError "\(?<\|?>\)[<>&+\*\/\\?:]\+" +syn match vhdlError "\(<<\|>>\)[<>&+\*\/\\?:]\+" + +"syn match vhdlError "[?]\+\(&\|+\|\-\|\*\*\|??\|?=\|?\/=\|?<\|?<=\|?>\|?>=\|:=\|=>\)" +" '/' +syn match vhdlError "\(\/\)[<>&+\-\*\/\\?:]\+" +syn match vhdlError "[<>=&+\-\*\/\\:]\+\(\/\)" + +syn match vhdlSpecial "<>" +syn match vhdlSpecial "[().,;]" + + " time -syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" -syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" +syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" +syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" -syn keyword vhdlTodo contained TODO FIXME +syn case match +syn keyword vhdlTodo contained TODO NOTE +syn keyword vhdlFixme contained FIXME +syn case ignore -syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,@Spell -syn match vhdlComment "--.*" contains=vhdlTodo,@Spell -" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]" +syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell +syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell + +" Standard IEEE P1076.6 preprocessor directives (metacomments). +syn match vhdlPreProc "/\*\s*rtl_synthesis\s\+\(on\|off\)\s*\*/" +syn match vhdlPreProc "\(^\|\s\)--\s*rtl_synthesis\s\+\(on\|off\)\s*" +syn match vhdlPreProc "/\*\s*rtl_syn\s\+\(on\|off\)\s*\*/" +syn match vhdlPreProc "\(^\|\s\)--\s*rtl_syn\s\+\(on\|off\)\s*" + +" Industry-standard directives. These are not standard VHDL, but are commonly +" used in the industry. +syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/" +"syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*pragma\s\+translate_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/" + +syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*" +"syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+translate_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*" "Modify the following as needed. The trade-off is performance versus functionality. -syn sync minlines=200 +syn sync minlines=600 " 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_vhdl_syntax_inits") - if version < 508 - let did_vhdl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - -" HiLink cDefine PreProc - HiLink vhdlSpecial Special - HiLink vhdlStatement Statement - HiLink vhdlCharacter Character - HiLink vhdlString String - HiLink vhdlVector Number - HiLink vhdlBoolean Number - HiLink vhdlTodo Todo - HiLink vhdlComment Comment - HiLink vhdlNumber Number - HiLink vhdlTime Number - HiLink vhdlType Type - HiLink vhdlOperator Special -" HiLink vhdlGlobal Error - HiLink vhdlAttribute Type - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link vhdlSpecial Special +hi def link vhdlStatement Statement +hi def link vhdlCharacter Character +hi def link vhdlString String +hi def link vhdlVector Number +hi def link vhdlBoolean Number +hi def link vhdlTodo Todo +hi def link vhdlFixme Fixme +hi def link vhdlComment Comment +hi def link vhdlNumber Number +hi def link vhdlTime Number +hi def link vhdlType Type +hi def link vhdlOperator Operator +hi def link vhdlError Error +hi def link vhdlAttribute Special +hi def link vhdlPreProc PreProc + let b:current_syntax = "vhdl" diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index f5a447a620..c3e134468e 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,9 @@ " Vim syntax file -" Language: Vim 7.4 script +" Language: Vim 8.0 script " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Mar 20, 2014 -" Version: 7.4-27 +" Last Change: April 30, 2018 +" Version: 8.0-14 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -14,44 +15,44 @@ set cpo&vim " vimTodo: contains common special-notices for comments {{{2 " Use the vimCommentGroup cluster to add your own. +syn keyword vimTodo contained COMBAK FIXME TODO XXX syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 -syn keyword vimCommand contained a arga[dd] ar[gs] bd[elete] bN[ext] breakd[el] bufdo cabc[lear] cat[ch] cex[pr] c[hange] cla[st] cnew[er] cNf[ile] con cp[revious] cuna[bbrev] del deletep delm[arks] diffp[atch] dig[raphs] do e echon endf endw[hile] f[ile] fin[d] folddoc[losed] fu[nction] gvim helpt[ags] iabc[lear] intro k l lan lc[d] lefta[bove] lg[etfile] lla[st] lnew[er] lNf[ile] lockv[ar] ls lvimgrepa[dd] mat[ch] mk[exrc] mo n n[ext] o ownsyntax perld[o] pre[serve] promptf[ind] ptl[ast] ptr[ewind] py3do qa[ll] r[ead] redr[aw] retu[rn] rub[y] rv[iminfo] sba[ll] sbN[ext] scripte[ncoding] setf[iletype] sh[ell] sim[alt] sm[ap] sni[ff] sor[t] spelli[nfo] spr[evious] start st[op] sunmenu syn ta tabf[ind] tabnew tabr[ewind] tcld[o] tj[ump] tN tr tu[nmenu] undoj[oin] uns[ilent] ve[rsion] vimgrepa[dd] vs[plit] winc[md] wN[ext] ws[verb] x[it] xnoremenu -syn keyword vimCommand contained ab argd[elete] argu[ment] bel[owright] bo[tright] breakl[ist] b[uffer] cad cb[uffer] cf[ile] changes cl[ist] cn[ext] col[der] conf[irm] cq[uit] cw[indow] delc[ommand] deletl delp diffpu[t] dir doau ea e[dit] endfo[r] ene[w] files fini[sh] foldd[oopen] g h hi if is[earch] keepa la lan[guage] lch[dir] lex[pr] lgr[ep] lli[st] lne[xt] lo lol[der] lt[ag] lw[indow] menut mks[ession] mod[e] nbc[lose] nmapc[lear] ol[dfiles] p po[p] prev[ious] promptr[epl] ptn pts[elect] pydo q[uit] rec[over] redraws[tatus] rew[ind] rubyd[o] sal[l] sbf[irst] sbp[revious] scrip[tnames] setg[lobal] si sl sme sno[magic] so[urce] spellr[epall] sre[wind] startg[replace] stopi[nsert] sus[pend] sync tab tabfir[st] tabn[ext] tabs tclf[ile] tl[ast] tn[ext] tr[ewind] u undol[ist] up[date] vert[ical] vi[sual] w windo wp[revious] wundo xmapc[lear] xunme -syn keyword vimCommand contained abc[lear] argdo as[cii] bf[irst] bp[revious] br[ewind] buffers caddb[uffer] cc cfir[st] chd[ir] clo[se] cN[ext] colo[rscheme] con[tinue] cr[ewind] d delel deletp dep diffs[plit] di[splay] dp earlier el[se] endfun ex filet fir[st] foldo[pen] go[to] ha[rdcopy] hid[e] ij[ump] isp[lit] keepalt lad la[st] lcl[ose] lf[ile] lgrepa[dd] lmak[e] lN[ext] loadk lop[en] lua ma menut[ranslate] mksp[ell] m[ove] nb[key] noa omapc[lear] pc[lose] popu p[rint] ps[earch] ptN pu[t] pyf[ile] quita[ll] red reg[isters] ri[ght] rubyf[ile] san[dbox] sbl[ast] sbr[ewind] scs setl[ocal] sig sla[st] smenu snoreme spe spellu[ndo] st star[tinsert] sts[elect] sv[iew] syncbind tabc[lose] tabl[ast] tabN[ext] ta[g] te[aroff] tm tN[ext] try un unh[ide] v vi viu[sage] wa[ll] winp[os] wq wv[iminfo] xme xunmenu -syn keyword vimCommand contained abo[veleft] arge[dit] au bl[ast] br bro[wse] bun[load] cad[dexpr] ccl[ose] cgetb[uffer] che[ckpath] cmapc[lear] cnf com cope[n] cs de delep delf di difft[his] dj[ump] dr[op] ec elsei[f] endf[unction] exi[t] filetype fix[del] for gr[ep] h[elp] his[tory] il[ist] iuna[bbrev] keepj[umps] laddb[uffer] lat lcs lfir[st] lh[elpgrep] lmapc[lear] lnf loadkeymap lpf[ile] luado mak[e] mes mkv mz nbs[tart] noautocmd on[ly] pe popu[p] pro pta[g] ptn[ext] pw[d] py[thon] r redi[r] res[ize] rightb[elow] rundo sa[rgument] sbm[odified] sb[uffer] scscope sf[ind] sign sl[eep] sn[ext] snoremenu spelld[ump] spellw[rong] sta[g] startr[eplace] sun[hide] sw[apname] syntime tabd[o] tabm[ove] tabo[nly] tags tf[irst] tm[enu] to[pleft] ts[elect] una[bbreviate] unl ve vie[w] vmapc[lear] wh[ile] win[size] wqa[ll] x xmenu xwininfo -syn keyword vimCommand contained al[l] argg[lobal] bad[d] bm[odified] brea[k] bu bw[ipeout] caddf[ile] cd cgete[xpr] checkt[ime] cn cNf comc[lear] co[py] cscope debug d[elete] delf[unction] diffg[et] diffu[pdate] dl ds[earch] echoe[rr] em[enu] en[dif] exu[sage] fin fo[ld] fu grepa[dd] helpf[ind] i imapc[lear] j[oin] kee[pmarks] lad[dexpr] later lcscope lgetb[uffer] l[ist] lN lNf lo[adview] lp[revious] luafile ma[rk] messages mkvie[w] mzf[ile] ne noh[lsearch] o[pen] ped[it] pp[op] profd[el] ptf[irst] ptN[ext] py python3 re red[o] ret[ab] ru ru[ntime] sav[eas] sbn[ext] scrip se[t] sfir[st] sil[ent] sm[agic] sN[ext] so spe[llgood] sp[lit] star stj[ump] sunme sy t tabe[dit] tabN tabp[revious] tc[l] th[row] tn tp[revious] tu u[ndo] unlo[ckvar] verb[ose] vim[grep] vne[w] win wn[ext] w[rite] xa[ll] xnoreme y[ank] -syn keyword vimCommand contained ar argl[ocal] ba[ll] bn[ext] breaka[dd] buf c cal[l] ce[nter] cg[etfile] cl cN cnf[ile] comp[iler] cpf[ile] cstag debugg[reedy] deletel dell diffo[ff] dig dli[st] dsp[lit] echom[sg] en endt[ry] f fina[lly] foldc[lose] fun gui helpg[rep] ia in ju[mps] keepp[atterns] laddf[ile] lb[uffer] le[ft] lgete[xpr] ll lne lnf[ile] loc[kmarks] lr[ewind] lv[imgrep] marks mk mkv[imrc] mz[scheme] new nu[mber] opt[ions] pe[rl] pr prof[ile] ptj[ump] ptp[revious] py3 q -syn match vimCommand contained "\<z[-+^.=]\=" -syn keyword vimCommand contained maca[ction] macm[enu] -syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns +syn keyword vimCommand contained a arga[dd] argu[ment] bad[d] bn[ext] breakd[el] bw[ipeout] cadde[xpr] cc cf[ile] changes cla[st] cnf[ile] comp[iler] cq[uit] cw[indow] delep dell diffg[et] dig[raphs] doau ea el[se] endt[ry] f[ile] fina[lly] foldd[oopen] go[to] ha[rdcopy] hid[e] ij[ump] isp[lit] keepa l[ist] lat lcl[ose] lex[pr] lgete[xpr] lla[st] lnf[ile] lol[der] lt[ag] lw[indow] menut[ranslate] mkv[imrc] n[ext] nmapc[lear] nore omapc[lear] pa[ckadd] perld[o] prev[ious] promptr[epl] ptj[ump] pts[elect] py[thon] pyx quita[ll] redr[aw] retu[rn] rub[y] sI sIn sal[l] sba[ll] sbp[revious] scg scripte[ncoding] setg[lobal] sgI sgn sic sim[alt] sla[st] smile so[urce] spelli[nfo] sr sri sta[g] stopi[nsert] sus[pend] sync ta[g] tabe[dit] tabn[ext] tabs te[aroff] tm[enu] to[pleft] tu[nmenu] undol[ist] up[date] vi[sual] vmapc[lear] wa[ll] winp[os] ws[verb] xmapc[lear] xprop +syn keyword vimCommand contained ab argd[elete] as[cii] bd[elete] bo[tright] breakl[ist] cN[ext] caddf[ile] ccl[ose] cfdo chd[ir] cle[arjumps] co[py] con[tinue] cr[ewind] d[elete] deletel delm[arks] diffo[ff] dir dp earlier elsei[f] endw[hile] files fini[sh] folddoc[losed] gr[ep] helpc[lose] his[tory] il[ist] iuna[bbrev] keepalt la[st] later lcs lf[ile] lgr[ep] lli[st] lo[adview] lop[en] lua m[ove] mes mkvie[w] nb[key] noa nos[wapfile] on[ly] packl[oadall] po[p] pro ps[earch] ptl[ast] pu[t] pydo pyxdo r[ead] redraws[tatus] rew[ind] rubyd[o] sIc sIp san[dbox] sbf[irst] sbr[ewind] sci scs setl[ocal] sgc sgp sie sin sm[agic] sn[ext] sor[t] spellr[epall] srI srl star[tinsert] sts[elect] sv[iew] syncbind tab tabf[ind] tabnew tags tf[irst] tma[p] tp[revious] tunma[p] unh[ide] v vie[w] vne[w] wh[ile] wn[ext] wundo xme xunme +syn keyword vimCommand contained abc[lear] argdo au bel[owright] bp[revious] bro[wse] cNf[ile] cal[l] cd cfir[st] che[ckpath] clo[se] col[der] conf[irm] cs debug deletep delp diffp[atch] dj[ump] dr[op] ec em[enu] ene[w] filet fir[st] foldo[pen] grepa[dd] helpf[ind] i imapc[lear] j[oin] keepj[umps] lad[dexpr] lb[uffer] lcscope lfdo lgrepa[dd] lmak[e] loadk lp[revious] luado ma[rk] messages mod[e] nbc[lose] noautocmd nu[mber] opt[ions] pc[lose] popu[p] prof[ile] ptN[ext] ptn[ext] pw[d] pyf[ile] pyxfile rec[over] reg[isters] ri[ght] rubyf[ile] sIe sIr sav[eas] sbl[ast] sc scl scscope sf[ind] sge sgr sig sip sm[ap] sno[magic] sp[lit] spellu[ndo] src srn startg[replace] sun[hide] sw[apname] syntime tabN[ext] tabfir[st] tabo[nly] tc[l] th[row] tmapc[lear] tr[ewind] u[ndo] unl ve[rsion] vim[grep] vs[plit] win[size] wp[revious] wv[iminfo] xmenu xunmenu +syn keyword vimCommand contained abo[veleft] arge[dit] bN[ext] bf[irst] br[ewind] bufdo c[hange] cat[ch] cdo cg[etfile] checkt[ime] cmapc[lear] colo[rscheme] cope[n] cscope debugg[reedy] deletl dep diffpu[t] dl ds[earch] echoe[rr] en[dif] ex filetype fix[del] for gui helpg[rep] ia in ju[mps] keepp[atterns] laddb[uffer] lbo[ttom] ld[o] lfir[st] lh[elpgrep] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mk[exrc] mz[scheme] nbs[tart] noh[lsearch] o[pen] ownsyntax pe[rl] pp[op] profd[el] pta[g] ptp[revious] py3 python3 q[uit] red[o] res[ize] rightb[elow] rundo sIg sN[ext] sbN[ext] sbm[odified] scI scp se[t] sfir[st] sgi sh[ell] sign sir sme snoreme spe[llgood] spellw[rong] sre[wind] srp startr[eplace] sunme sy t tabc[lose] tabl[ast] tabp[revious] tcld[o] tj[ump] tn[ext] try una[bbreviate] unlo[ckvar] verb[ose] vimgrepa[dd] wN[ext] winc[md] wq x[it] xnoreme xwininfo +syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] iabc[lear] intro k lN[ext] laddf[ile] lc[d] le[ft] lg[etfile] lhi[story] lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mks[ession] mzf[ile] new nor ol[dfiles] p[rint] ped[it] pre[serve] promptf[ind] ptf[irst] ptr[ewind] py3do pythonx qa[ll] redi[r] ret[ab] ru[ntime] rv[iminfo] sIl sa[rgument] sb[uffer] sbn[ext] sce scr[iptnames] setf[iletype] sg sgl si sil[ent] sl[eep] smenu snoremenu spelld[ump] spr[evious] srg st[op] stj[ump] sunmenu syn tN[ext] tabd[o] tabm[ove] tabr[ewind] tclf[ile] tl[ast] tno[remap] ts[elect] undoj[oin] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] +syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] +syn keyword vimCommand contained ter[minal] + +syn match vimCommand contained "\<z[-+^.=]\=\>" +syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns " vimOptions are caught only when contained in a vimSet {{{2 -syn keyword vimOption contained acd ambiwidth arabicshape autowriteall backupdir bdlay binary breakat bufhidden cd ci cinw co commentstring confirm cpoptions cscoperelative csre cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs filetype fo foldlevelstart formatexpr ft gfw gtt guipty hh hkmap ic imaf iminsert includeexpr inf isident key langmap lines lmap ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe relativenumber rightleftcmd ru sbr scrolloff selection shellcmdflag shellxescape showbreak si smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tbi termencoding thesaurus titlestring tpm ttm ttytype undodir ut vfile vop wcm whichwrap wildignore winaltkeys winminwidth wmnu write -syn keyword vimOption contained ai ambw ari aw backupext beval biosk brk buflisted cdpath cin cinwords cocu compatible consk cpt cscopetag cst cursorline dex digraph ead ei equalalways eventignore fde fdt fic fillchars foldclose foldmarker formatlistpat gcr ghr guicursor guitablabel hi hkmapp icon imak ims incsearch infercase isk keymap langmenu linespace loadplugins macatsui maxcombine mef mls modelines mousehide mp nu omnifunc paragraphs penc pm printdevice printoptions quoteescape remap rl ruf sc scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartindent sol spellsuggest sr stal sua swf syntax taglength tbidi terse tildeop tl tr tty tw undofile vb vi wa wd wi wildignorecase window winwidth wmw writeany -syn keyword vimOption contained akm anti arshape awa backupskip bex bioskey browsedir buftype cedit cindent clipboard cole complete conskey crb cscopetagorder csto cwh dg dip eadirection ek equalprg ex fdi fen fileencoding fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imc imsearch inde insertmode iskeyword keymodel laststatus lisp lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt report rlc ruler scb scs sessionoptions shellquote shiftround showfulltag sidescrolloff smarttab sp spf srr startofline suffixes switchbuf ta tagrelative tbis textauto timeout tm ts ttybuiltin tx undolevels vbs viewdir wak weirdinvert wic wildmenu winfixheight wiv wop writebackup -syn keyword vimOption contained al antialias autochdir background balloondelay bexpr bk bs casemap cf cink cmdheight colorcolumn completefunc copyindent cryptmethod cscopeverbose csverb debug dict dir eb enc errorbells expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg lazyredraw lispwords ls makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re restorescreen rnu rulerformat scr sect sft shellredir shiftwidth showmatch siso smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen to tsl ttyfast uc undoreload vdir viewoptions warn wfh wig wildmode winfixwidth wiw wrap writedelay -syn keyword vimOption contained aleph ar autoindent backspace ballooneval bg bkc bsdir cb cfu cinkeys cmdwinheight columns completeopt cot cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lbr list lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly revins ro runtimepath scroll sections sh shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb wfw wildchar wildoptions winheight wm wrapmargin ws -syn keyword vimOption contained allowrevins arab autoread backup balloonexpr bh bl bsk cc ch cino cmp com concealcursor cp cscopeprg csprg cul def diff display edcompatible endofline errorformat fcl fdm fex fileformats fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lcs listchars lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchmode ph preserveindent printheader pvh redrawtime ri rs sb scrollbind secure shcf shelltemp shortmess showtabline slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tal term tf titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc wh wildcharm wim winminheight wmh wrapscan ww -syn keyword vimOption contained altkeymap arabic autowrite backupcopy bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell -syn keyword vimOption contained fullscreen fu fuoptions fuopt macmeta mmta transparency transp +syn keyword vimOption contained acd ambw arshape background ballooneval bex bl brk buftype cf cinkeys cmdwinheight com conceallevel crb cscopeverbose cuc def diffexpr ea ei ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw guicursor guitabtooltip hidden hlg imactivatefunc imi inc inex isident keymap langnoremap linespace lnr lw makeprg maxmem mfd mmd modified mousemodel msm nu omnifunc para pdev pheader preserveindent printheader pumwidth pythonthreehome readonly restorescreen rnu ruf sc scrolloff selection shellcmdflag shellxescape showbreak si sm so spellfile spr st sts swapsync syn tag tal tcldll termwinscroll tgc titlelen toolbariconsize ttimeout ttymouse tx undolevels vbs viewdir vop wd wic wildmode winheight wm wrapscan +syn keyword vimOption contained ai anti autochdir backspace balloonevalterm bexpr bo browsedir casemap cfu cino cmp comments confirm cryptmethod cspc cul define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guifont helpfile highlight hls imactivatekey iminsert include inf isk keymodel langremap lisp loadplugins lz mat maxmempattern mh mmp more mouses mzq number opendevice paragraphs penc pi previewheight printmbcharset pvh pyx redrawtime revins ro ruler scb scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tb tenc termwinsize tgst titleold top ttimeoutlen ttyscroll uc undoreload vdir viewoptions wa weirdinvert wig wildoptions winminheight wmh write +syn keyword vimOption contained akm antialias autoindent backup balloonexpr bg bomb bs cb ch cinoptions cms commentstring copyindent cscopepathcomp csprg cursorbind delcombine digraph eadirection emo equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr go guifontset helpheight history hlsearch imaf ims includeexpr infercase iskeyword keywordprg laststatus lispwords lpl ma matchpairs maxmemtot mis mmt mouse mouseshape mzquantum numberwidth operatorfunc paste perldll pm previewwindow printmbfont pvw pyxversion regexpengine ri rop rulerformat scl scs sessionoptions shellquote shiftround showfulltag sidescrolloff smartindent sol spellsuggest sr stal sua swf syntax tagcase tbi term terse thesaurus titlestring tpm ttm ttytype udf updatecount ve vif wak wfh wildchar wim winminwidth wmnu writeany +syn keyword vimOption contained al ar autoread backupcopy bdir bh breakat bsdir cc charconvert cinw co compatible cot cscopeprg csqf cursorcolumn dex dip eb emoji errorbells exrc fdm ff filetype fmr foldlevelstart formatlistpat gd gp guifontwide helplang hk ic imak imsearch incsearch insertmode isp km lazyredraw list lrm macatsui matchtime mco mkspellmem mod mousef mouset mzschemedll nuw opfunc pastetoggle pex pmbcs printdevice printoptions pw qe relativenumber rightleft rs runtimepath scr sect sft shellredir shiftwidth showmatch signcolumn smarttab sp spf srr startofline suffixes switchbuf ta taglength tbidi termbidi textauto tildeop tl tr tty tw udir updatetime verbose viminfo warn wfw wildcharm winaltkeys winptydll wmw writebackup +syn keyword vimOption contained aleph arab autowrite backupdir bdlay bin breakindent bsk ccv ci cinwords cocu complete cp cscopequickfix csre cursorline dg dir ed enc errorfile fcl fdn ffs fillchars fo foldmarker formatoptions gdefault grepformat guiheadroom hf hkmap icon imc imsf inde is isprint kmp lbr listchars ls magic maxcombine mef ml modeline mousefocus mousetime mzschemegcdll odev osfiletype patchexpr pexpr pmbfn printencoding prompt pythondll quoteescape remap rightleftcmd rtp sb scroll sections sh shellslash shm showmode siso smc spc spl ss statusline suffixesadd sws tabline tagrelative tbis termencoding textmode timeout tm ts ttybuiltin twk ul ur verbosefile viminfofile wb wh wildignore window winwidth wop writedelay +syn keyword vimOption contained allowrevins arabic autowriteall backupext belloff binary breakindentopt bt cd cin clipboard cole completefunc cpo cscoperelative cst cwh dict directory edcompatible encoding errorformat fcs fdo fic fixendofline foldclose foldmethod formatprg gfm grepprg guioptions hh hkmapp iconstring imcmdline imst indentexpr isf joinspaces kp lcs lm lsp makeef maxfuncdepth menc mls modelines mousehide mp nf oft pa patchmode pfn popt printexpr pt pythonhome rdt renderoptions rl ru sbo scrollbind secure shcf shelltemp shortmess showtabline sj smd spell splitbelow ssl stl sw sxe tabpagemax tags tbs termguicolors textwidth timeoutlen to tsl ttyfast tws undodir ut vfile virtualedit wc whichwrap wildignorecase winfixheight wiv wrap ws +syn keyword vimOption contained altkeymap arabicshape aw backupskip beval bk bri bufhidden cdpath cindent cm colorcolumn completeopt cpoptions cscopetag csto debug dictionary display ef endofline esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn gtl guipty hi hkp ignorecase imd imstatusfunc indentkeys isfname js langmap linebreak lmap luadll makeencoding maxmapdepth menuitems mm modifiable mousem mps nrformats ofu packpath path ph pp printfont pumheight pythonthreedll re report rlc rubydll sbr scrolljump sel shell shelltype shortname shq slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tagstack tc termwinkey tf title toolbar tsr ttym twsl undofile vb vi visualbell wcm wi wildmenu winfixwidth wiw wrapmargin ww +syn keyword vimOption contained ambiwidth ari awa balloondelay bevalterm bkc briopt buflisted cedit cink cmdheight columns concealcursor cpt cscopetagorder csverb deco diff dy efm eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtt guitablabel hid hl im imdisable imstyle indk isi key langmenu lines " vimOptions: These are the turn-off setting variants {{{2 -syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noendofline noerrorbells noex nofen nofk nogd nohid nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup -syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noeol noesckeys noexpandtab nofic nofkmap nogdefault nohidden nohkmapp nohls noic noignorecase noimc noimd noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows -syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk -syn keyword vimOption contained nofullscreen nofu nomacmeta nommta +syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobevalterm nobk nobreakindent nocf nocindent nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noemo noeol noesckeys noexpandtab nofic nofixeol nofoldenable nogd nohid nohkmap nohls noicon noimc noimdisable noinfercase nojoinspaces nolangremap nolinebreak nolist noloadplugins nolrm noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup +syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa noballoonevalterm nobin nobl nobri noci nocompatible nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noemoji noequalalways noet noexrc nofileignorecase nofk nofs nogdefault nohidden nohkmapp nohlsearch noignorecase noimcmdline noincsearch noinsertmode nojs nolazyredraw nolisp nolnr nolpl nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows +syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobeval nobinary nobomb nobuflisted nocin noconfirm nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noendofline noerrorbells noex nofen nofixendofline nofkmap nofsync noguipty nohk nohkp noic noim noimd noinf nois nolangnoremap nolbr " vimOptions: These are the invertible variants {{{2 -syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invendofline inverrorbells invex invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup -syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent invconsk invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible inveol invesckeys invexpandtab invfic invfkmap invgdefault invhidden invhkmapp invhls invic invignorecase invimc invimd invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws -syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbioskey invbomb invci invcompatible invconskey invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase invfoldenable invguipty invhk -syn keyword vimOption contained invfullscreen invfu invmacmeta invmmta +syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbevalterm invbk invbreakindent invcf invcindent invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invemo inveol invesckeys invexpandtab invfic invfixeol invfoldenable invgd invhid invhkmap invhls invicon invimc invimdisable invinfercase invjoinspaces invlangremap invlinebreak invlist invloadplugins invlrm invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup +syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invballoonevalterm invbin invbl invbri invci invcompatible invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible invemoji invequalalways invet invexrc invfileignorecase invfk invfs invgdefault invhidden invhkmapp invhlsearch invignorecase invimcmdline invincsearch invinsertmode invjs invlazyredraw invlisp invlnr invlpl invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws +syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbeval invbinary invbomb invbuflisted invcin invconfirm invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invendofline inverrorbells invex invfen invfixendofline invfkmap invfsync invguipty invhk invhkp invic invim invimd invinf invis invlangnoremap invlbr " termcap codes (which can also be set) {{{2 -syn keyword vimOption 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 vimOption contained t_AF t_AL t_cd t_Ce t_cm t_cs +syn keyword vimOption contained t_8b t_AB t_al t_bc t_BE t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_EI t_F2 t_F4 t_F6 t_F8 t_fs t_IE t_k1 t_k2 t_K3 t_K4 t_K5 t_K6 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_PE t_PS t_RB t_RC t_RF t_RI t_RS t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_so t_sr t_SR t_te t_Te t_ti t_ts t_Ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_VS t_WP t_WS t_xn t_xs t_ZH t_ZR +syn keyword vimOption contained t_8f t_AF t_AL t_BD t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EC t_F1 t_F3 t_F5 t_F7 t_F9 t_GP t_IS t_K1 t_k3 t_k4 t_k5 t_k6 t_k7 syn match vimOption contained "t_%1" syn match vimOption contained "t_#2" syn match vimOption contained "t_#4" @@ -61,29 +62,84 @@ syn match vimOption contained "t_&8" syn match vimOption contained "t_%i" syn match vimOption contained "t_k;" -" unsupported settings: these are supported by vi but don't do anything in vim {{{2 -syn keyword vimErrSetting contained hardtabs ht w1200 w300 w9600 +" unsupported settings: some were supported by vi but don't do anything in vim {{{2 +" others have been dropped along with msdos support +syn keyword vimErrSetting contained bioskey biosk conskey consk autoprint beautify flash graphic hardtabs mesg novice open op optimize redraw slow slowopen sourceany w300 w1200 w9600 hardtabs ht nobioskey nobiosk noconskey noconsk noautoprint nobeautify noflash nographic nohardtabs nomesg nonovice noopen noop nooptimize noredraw noslow noslowopen nosourceany now300 now1200 now9600 w1200 w300 w9600 " AutoCmd Events {{{2 syn case ignore -syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabEnter TabLeave TermChanged TermResponse TextChanged TextChangedI User UserGettingBored VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave +syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre CmdlineChanged CmdlineEnter CmdlineLeave CmdUndefined CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI DirChanged EncodingChanged ExitPre FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TerminalOpen TermResponse TextChanged TextChangedI TextChangedP TextYankPost User VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave WinNew " Highlight commonly used Groupnames {{{2 -syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo +syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -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 VisualNOS WarningMsg WildMenu +syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn case match " Function Names {{{2 -syn keyword vimFuncName contained abs and argidx atan browsedir bufloaded bufwinnr byteidxcomp changenr clearmatches complete_add copy count deepcopy diff_filler escape executable expand feedkeys filter float2nr fnameescape foldclosedend foldtextresult garbagecollect getbufvar getcmdline getcwd getfsize getline getpid getreg gettabwinvar getwinvar has hasmapto histget hlID indent inputdialog inputsave invert items len line localtime luaeval mapcheck matcharg matchlist min mzeval or prevnonblank py3eval readfile remote_expr remote_read rename reverse screenchar search searchpairpos serverlist setcmdpos setloclist setpos setreg settabwinvar sha256 shiftwidth sin sort spellbadword split str2float strchars strftime string strpart strtrans submatch synconcealed synIDattr synstack tabpagebuflist tabpagewinnr taglist tanh tolower tr type undotree virtcol wildmenumode wincol winline winrestcmd winsaveview writefile -syn keyword vimFuncName contained acos append argv atan2 bufexists bufname byte2line call char2nr col complete_check cos cscope_connection delete diff_hlID eval exists expr8 filereadable finddir floor fnamemodify foldlevel foreground get getchar getcmdpos getfontname getftime getloclist getpos getregtype getwinposx glob has_key histadd histnr hostname index inputlist inputsecret isdirectory join libcall line2byte log map match matchdelete matchstr mkdir nextnonblank pathshorten printf pyeval reltime remote_foreground remote_send repeat round screencol searchdecl searchpos setbufvar setline setmatches setqflist settabvar setwinvar shellescape simplify sinh soundfold spellsuggest sqrt str2nr strdisplaywidth stridx strlen strridx strwidth substitute synID synIDtrans system tabpagenr tagfiles tan tempname toupper trunc undofile values visualmode winbufnr winheight winnr winrestview winwidth xor -syn keyword vimFuncName contained add argc asin browse buflisted bufnr byteidx ceil cindent complete confirm cosh cursor did_filetype empty eventhandler exp extend filewritable findfile fmod foldclosed foldtext function getbufline getcharmod getcmdtype getfperm getftype getmatches getqflist gettabvar getwinposy globpath haslocaldir histdel hlexists iconv input inputrestore insert islocked keys libcallnr lispindent log10 maparg matchadd matchend max mode nr2char pow pumvisible range reltimestr remote_peek remove resolve screenattr screenrow searchpair server2client +syn keyword vimFuncName contained abs append argv assert_equalfile assert_inrange assert_report balloon_show bufexists bufnr byteidx changenr ch_close_in ch_getjob ch_open ch_sendraw clearmatches complete_check cosh deepcopy diff_hlID eventhandler exists feedkeys finddir fmod foldclosedend foreground get getchangelist getcmdline getcompletion getfperm getjumplist getpid getregtype getwininfo getwinvar has histadd hlexists indent inputlist insert isnan job_setoptions join json_encode libcallnr localtime map matchadd matchend max mzeval option_save pow py3eval readfile remote_expr remote_send repeat screenattr search searchpos setbufvar setline setqflist setwinvar simplify soundfold sqrt strchars stridx strridx substitute synIDtrans tabpagebuflist taglist term_dumpdiff term_getansicolors term_getline term_gettitle term_sendkeys term_setsize test_autochdir test_ignore_error test_null_job test_null_string timer_info timer_stop toupper trunc undotree virtcol winbufnr win_getid win_id2tabwin winnr winsaveview wordcount +syn keyword vimFuncName contained acos argc asin assert_exception assert_match assert_true balloon_split buflisted bufwinid byteidxcomp char2nr ch_evalexpr ch_info ch_read ch_setoptions col confirm count delete empty executable exp filereadable findfile fnameescape foldlevel funcref getbufinfo getchar getcmdpos getcurpos getfsize getline getpos gettabinfo getwinpos glob has_key histdel hlID index inputrestore invert items job_start js_decode keys line log maparg matchaddpos matchlist min nextnonblank or prevnonblank pyeval reltime remote_foreground remote_startserver resolve screenchar searchdecl server2client setcharsearch setloclist setreg sha256 sin spellbadword str2float strdisplaywidth string strtrans synconcealed synstack tabpagenr tan term_dumpload term_getattr term_getscrolled term_gettty term_setansicolors term_start test_feedinput test_null_channel test_null_list test_override timer_pause timer_stopall tr type uniq visualmode wincol win_gotoid win_id2win winrestcmd win_screenpos writefile +syn keyword vimFuncName contained add argidx assert_beeps assert_fails assert_notequal atan browse bufloaded bufwinnr call ch_canread ch_evalraw ch_log ch_readraw ch_status complete copy cscope_connection did_filetype escape execute expand filewritable float2nr fnamemodify foldtext function getbufline getcharmod getcmdtype getcwd getftime getloclist getqflist gettabvar getwinposx glob2regpat haslocaldir histget hostname input inputsave isdirectory job_getchannel job_status js_encode len line2byte log10 mapcheck matcharg matchstr mkdir nr2char pathshorten printf pyxeval reltimefloat remote_peek remove reverse screencol searchpair serverlist setcmdpos setmatches settabvar shellescape sinh spellsuggest str2nr strftime strlen strwidth synID system tabpagewinnr tanh term_dumpwrite term_getcursor term_getsize term_list term_setkill term_wait test_garbagecollect_now test_null_dict test_null_partial test_settime timer_start tolower trim undofile values wildmenumode win_findbuf winheight winline winrestview winwidth xor +syn keyword vimFuncName contained and arglistid assert_equal assert_false assert_notmatch atan2 browsedir bufname byte2line ceil ch_close ch_getbufnr ch_logfile ch_sendexpr cindent complete_add cos cursor diff_filler eval exepath extend filter floor foldclosed foldtextresult garbagecollect getbufvar getcharsearch getcmdwintype getfontname getftype getmatches getreg gettabwinvar getwinposy globpath hasmapto histnr iconv inputdialog inputsecret islocked job_info job_stop json_decode libcall lispindent luaeval match matchdelete matchstrpos mode option_restore perleval pumvisible range reltimestr remote_read rename round screenrow searchpairpos setbufline setfperm setpos settabwinvar shiftwidth sort split strcharpart strgetchar strpart submatch synIDattr systemlist tagfiles tempname term_getaltscreen term_getjob term_getstatus term_scrape term_setrestore test_alloc_fail "--- syntax here and above generated by mkvimvim --- " 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 @@ -98,19 +154,26 @@ if exists("g:vimsyntax_noerror") let g:vimsyn_noerror= g:vimsyntax_noerror endif +" Variable options {{{2 +if exists("g:vim_maxlines") + let s:vimsyn_maxlines= g:vim_maxlines +else + let s:vimsyn_maxlines= 60 +endif + " Numbers {{{2 " ======= syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "\<0[xX]\x\+" -syn match vimNumber "#\x\{6}" +syn match vimNumber "\%(^\|\A\)\zs#\x\{6}" " All vimCommands are contained by vimIsCommands. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd +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#_]*\>" +syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" +syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" syn keyword vimCommand contained in " Insertions And Appends: insert append {{{2 @@ -138,13 +201,13 @@ 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=vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,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' - syn region vimAugroup fold start="\<aug\%[roup]\>\s\+\h\w*" end="\<aug\%[roup]\>\s\+[eE][nN][dD]\>" contains=vimAugroupKey,vimAutoCmd,@vimAugroupList keepend +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,vimSetEqual,vimOption +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 start="\<aug\%[roup]\>\s\+\h\w*" end="\<aug\%[roup]\>\s\+[eE][nN][dD]\>" contains=vimAugroupKey,vimAutoCmd,@vimAugroupList keepend + 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 +syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror") syn match vimAugroupError "\<aug\%[roup]\>\s\+[eE][nN][dD]\>" endif @@ -152,12 +215,12 @@ syn keyword vimAugroupKey contained aug[roup] " Operators: {{{2 " ========= -" COMBAK: vimOperParen used to have "oneline" syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue -syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile -syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\(\<is\>\|\<isnot\>\)[?#]\{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 @@ -165,15 +228,15 @@ endif " Functions : Tag is provided for those who wish to highlight tagged functions {{{2 " ========= syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID -syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vimComment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimExecute,vimIf,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimHighlight,vimIsCommand,vimLet,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand +syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,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 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' - syn region vimFuncBody contained fold start="\ze(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList +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(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList + syn region vimFuncBody contained start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList endif -syn match vimFuncVar contained "a:\(\h\w*\|\d\+\)" +syn match vimFuncVar contained "a:\(\K\k*\|\d\+\)" syn match vimFuncSID contained "\c<sid>\|\<s:" syn keyword vimFuncKey contained fu[nction] syn match vimFuncBlank contained "\s\+" @@ -194,20 +257,22 @@ syn match vimSpecFileMod "\(:[phtre]\)\+" contained " ======================= syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vimCtrlChar,vimEscapeBrace,vimFilter,vimFunc,vimFuncName,vimFunction,vimFunctionError,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine syn keyword vimUserCommand contained com[mand] -syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserCommand,@vimUserCmdList -syn match vimUserAttrb contained "-n\%[args]=[01*?+]" contains=vimUserAttrbKey,vimOper -syn match vimUserAttrb contained "-com\%[plete]=" contains=vimUserAttrbKey,vimOper nextgroup=vimUserAttrbCmplt,vimUserCmdError -syn match vimUserAttrb contained "-ra\%[nge]\(=%\|=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey -syn match vimUserAttrb contained "-cou\%[nt]=\d\+" contains=vimNumber,vimOper,vimUserAttrbKey -syn match vimUserAttrb contained "-bang\=\>" contains=vimOper,vimUserAttrbKey -syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey -syn match vimUserAttrb contained "-re\%[gister]\>" contains=vimOper,vimUserAttrbKey +syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList +syn match vimUserAttrbError contained "-\a\+\ze\s" +syn match vimUserAttrb contained "-nargs=[01*?+]" contains=vimUserAttrbKey,vimOper +syn match vimUserAttrb contained "-complete=" contains=vimUserAttrbKey,vimOper nextgroup=vimUserAttrbCmplt,vimUserCmdError +syn match vimUserAttrb contained "-range\(=%\|=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-count\(=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-bang\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-buffer\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-register\>" contains=vimOper,vimUserAttrbKey if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror") syn match vimUserCmdError contained "\S\+\>" endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] -syn keyword vimUserAttrbCmplt contained augroup buffer color command compiler cscope dir environment event expression file file_in_path filetype function help highlight locale mapping menu option shellcmd sign syntax tag tag_listfiles var +syn keyword vimUserAttrbCmplt contained augroup buffer behave color command compiler cscope dir environment event expression file file_in_path filetype function help highlight history locale mapping menu option packadd shellcmd sign syntax syntime tag tag_listfiles user var syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%(#\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError @@ -236,8 +301,8 @@ syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\ syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]'+lc=1 end=+'+ +syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup +syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup @@ -249,15 +314,16 @@ 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 syn match vimCollClassErr contained "\[:.\{-\}:\]" -syn match vimCollClass contained transparent "\[:\(alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\|return\|tab\|escape\|backspace\):\]" +syn match vimCollClass contained transparent "\%#=1\[:\(alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\|return\|tab\|escape\|backspace\):\]" syn match vimSubstSubstr contained "\\z\=\d" syn match vimSubstTwoBS contained "\\\\" syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags @@ -275,7 +341,7 @@ syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimOper,vimMarkNumbe syn match vimMarkNumber "[-+]\d\+" nextgroup=vimSubst contained contains=vimOper syn match vimPlainMark contained "'[a-zA-Z0-9]" -syn match vimRegister '[^,;[{]\zs"[a-zA-Z0-9.%#:_\-/]\ze[^a-zA-Z_":0-9]' +syn match vimRegister '[^,;[{: \t]\zs"[a-zA-Z0-9.%#:_\-/]\ze[^a-zA-Z_":0-9]' syn match vimRegister '\<norm\s\+\zs"[a-zA-Z0-9]' syn match vimRegister '\<normal\s\+\zs"[a-zA-Z0-9]' syn match vimRegister '@"' @@ -295,7 +361,7 @@ syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)' 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 "[,:]" +syn match vimSetSep contained "[,:]" skipwhite nextgroup=vimCommand syn match vimSetMod contained "&vim\=\|[!&?<]\|all&" " Let {{{2 @@ -330,11 +396,11 @@ syn keyword vimMap mapc[lear] smapc[lear] syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] unm[ap] unm[ap] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs syn match vimMapLhs contained "\S\+" contains=vimNotation,vimCtrlChar skipwhite nextgroup=vimMapRhs syn match vimMapBang contained "!" skipwhite nextgroup=vimMapMod,vimMapLhs -syn match vimMapMod contained "\c<\(buffer\|expr\|\(local\)\=leader\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMapMod contained "\%#=1\c<\(buffer\|expr\|\(local\)\=leader\|nowait\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend -syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimNotation,vimCtrlChar,vimContinue skipnl nextgroup=vimMapRhsExtend +syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue syn case ignore -syn keyword vimMapModKey contained buffer expr leader localleader plug script sid silent unique +syn keyword vimMapModKey contained buffer expr leader localleader nowait plug script sid silent unique syn case match " Menus {{{2 @@ -352,27 +418,27 @@ syn match vimMenuBang "!" contained skipwhite nextgroup=@vimMenuList " Angle-Bracket Notation (tnx to Michael Geddes) {{{2 " ====================== syn case ignore -syn match vimNotation "\(\\\|<lt>\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cr\|lf\|linefeed\|return\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket -syn match vimNotation "\(\\\|<lt>\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket -syn match vimNotation "\(\\\|<lt>\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket -syn match vimNotation '\(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket -syn match vimNotation '\(\\\|<lt>\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|f-args\|lt\)>' contains=vimBracket -syn match vimNotation "\(\\\|<lt>\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cr\|lf\|linefeed\|return\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket +syn match vimNotation '\(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket +syn match vimNotation '\%#=1\(\\\|<lt>\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket +syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket syn match vimBracket contained "[\\<>]" 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]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute +syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\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 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank -" syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)[0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank +" syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\<else\s\+if\>" syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/ endif @@ -416,6 +482,11 @@ 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 @@ -424,14 +495,14 @@ syn cluster vimFuncBodyList add=vimSynType syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion 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 match vimSynKeyOpt contained "\%#=1\<\(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="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup -syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" +syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" if has("conceal") syn match vimSynMtchOpt contained "\<cchar=" nextgroup=vimSynMtchCchar syn match vimSynMtchCchar contained "\S" @@ -446,12 +517,12 @@ syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vim 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="\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 vimSynRegOpt contained "\%#=1\<\(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 syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg -syn match vimSynPatMod contained "\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" -syn match vimSynPatMod contained "\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod syn match vimSynPatMod contained "lc=\d\+" syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]" @@ -484,14 +555,14 @@ syn match vimIsCommand "<Bar>\s*\a\+" transparent contains=vimCommand,vimNotatio " ============ syn cluster vimHighlightCluster contains=vimHiLink,vimHiClear,vimHiKeyList,vimComment if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimhictermerror") - syn match vimHiCtermError contained "[^0-9]\i*" + syn match vimHiCtermError contained "\D\i*" endif syn match vimHighlight "\<hi\%[ghlight]\>" skipwhite nextgroup=vimHiBang,@vimHighlightCluster syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster syn match vimHiGroup contained "\i\+" syn case ignore -syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl +syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl syn keyword vimFgBgAttrib contained none bg background fg foreground syn case match syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib @@ -554,12 +625,12 @@ 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 ~= '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) +" 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= "lmpPr" endif @@ -574,16 +645,12 @@ if !filereadable(s:luapath) endif endfor endif -if (g:vimsyn_embed =~ 'l' && has("lua")) && filereadable(s:luapath) +if (g:vimsyn_embed =~# 'l' && has("lua")) && filereadable(s:luapath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimLuaRegion exe "syn include @vimLuaScript ".s:luapath - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'l' - syn region vimLuaRegion fold matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript - syn region vimLuaRegion fold matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript - else - syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript - syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript - endif + 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$+ @@ -601,16 +668,12 @@ if !filereadable(s:perlpath) endif endfor endif -if (g:vimsyn_embed =~ 'p' && has("perl")) && filereadable(s:perlpath) +if (g:vimsyn_embed =~# 'p' && has("perl")) && filereadable(s:perlpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPerlRegion exe "syn include @vimPerlScript ".s:perlpath - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'p' - syn region vimPerlRegion fold matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript - syn region vimPerlRegion fold matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript - else - syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript - syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript - endif + VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(\S*\)\ze\(\s*["#].*\)\=$+ end=+^\z1\ze\(\s*[#"].*\)\=$+ 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$+ @@ -628,15 +691,12 @@ if !filereadable(s:rubypath) endif endfor endif -if (g:vimsyn_embed =~ 'r' && has("ruby")) && filereadable(s:rubypath) +if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath) + syn cluster vimFuncBodyList add=vimRubyRegion unlet! b:current_syntax exe "syn include @vimRubyScript ".s:rubypath - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'r' - syn region vimRubyRegion fold matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript - else - syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript - endif - syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript + VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ 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$+ @@ -654,16 +714,14 @@ if !filereadable(s:pythonpath) endif endfor endif -if g:vimsyn_embed =~ 'P' && (has("python") || has("python3")) && filereadable(s:pythonpath) +if g:vimsyn_embed =~# 'P' && has("pythonx") && filereadable(s:pythonpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPythonRegion 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(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ 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(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ 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$+ @@ -688,16 +746,12 @@ if s:trytcl endif endfor endif - if (g:vimsyn_embed =~ 't' && has("tcl")) && filereadable(s:tclpath) + if (g:vimsyn_embed =~# 't' && has("tcl")) && filereadable(s:tclpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimTclRegion exe "syn include @vimTclScript ".s:tclpath - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 't' - syn region vimTclRegion fold matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript - syn region vimTclRegion fold matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript - else - syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript - syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript - endif + 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$+ @@ -720,18 +774,15 @@ if !filereadable(s:mzschemepath) endif endfor endif -if (g:vimsyn_embed =~ 'm' && has("mzscheme")) && filereadable(s:mzschemepath) +if (g:vimsyn_embed =~# 'm' && has("mzscheme")) && filereadable(s:mzschemepath) unlet! b:current_syntax - let iskKeep= &isk + let s:iskKeep= &isk + syn cluster vimFuncBodyList add=vimMzSchemeRegion exe "syn include @vimMzSchemeScript ".s:mzschemepath - let &isk= iskKeep - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'm' - syn region vimMzSchemeRegion fold matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript - syn region vimMzSchemeRegion fold matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript - else - syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript - syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript - endif + let &isk= s:iskKeep + unlet s: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$+ @@ -744,11 +795,7 @@ unlet s:mzschemepath if exists("g:vimsyn_minlines") exe "syn sync minlines=".g:vimsyn_minlines endif -if exists("g:vimsyn_maxlines") - exe "syn sync maxlines=".g:vimsyn_maxlines -else - syn sync maxlines=60 -endif +exe "syn sync maxlines=".s:vimsyn_maxlines syn sync linecont "^\s\+\\" syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]" @@ -756,171 +803,183 @@ syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]" " Highlighting Settings {{{2 " ==================== +if !exists("skip_vim_syntax_inits") + if !exists("g:vimsyn_noerror") + hi def link vimBehaveError vimError + hi def link vimCollClassErr vimError + hi def link vimErrSetting vimError + hi def link vimEmbedError vimError + hi def link vimFTError vimError + hi def link vimFunctionError vimError + hi def link vimFunc vimError + hi def link vimHiAttribList vimError + hi def link vimHiCtermError vimError + hi def link vimHiKeyError vimError + hi def link vimKeyCodeError vimError + hi def link vimMapModErr vimError + hi def link vimSubstFlagErr vimError + hi def link vimSynCaseError vimError + hi def link vimBufnrWarn vimWarn + endif -if !exists("g:vimsyn_noerror") - hi def link vimBehaveError vimError - hi def link vimCollClassErr vimError - hi def link vimErrSetting vimError - hi def link vimEmbedError vimError - hi def link vimFTError vimError - hi def link vimFunctionError vimError - hi def link vimFunc vimError - hi def link vimHiAttribList vimError - hi def link vimHiCtermError vimError - hi def link vimHiKeyError vimError - hi def link vimKeyCodeError vimError - hi def link vimMapModErr vimError - hi def link vimSubstFlagErr vimError - hi def link vimSynCaseError vimError - hi def link vimBufnrWarn vimWarn -endif - -hi def link vimAbb vimCommand -hi def link vimAddress vimMark -hi def link vimAugroupKey vimCommand -hi def link vimAuHighlight vimHighlight -hi def link vimAutoCmdOpt vimOption -hi def link vimAutoCmd vimCommand -hi def link vimAutoEvent Type -hi def link vimAutoSet vimCommand -hi def link vimBehaveModel vimBehave -hi def link vimBehave vimCommand -hi def link vimBracket Delimiter -hi def link vimCmplxRepeat SpecialChar -hi def link vimCommand Statement -hi def link vimComment Comment -hi def link vimCommentString vimString -hi def link vimCommentTitle PreProc -hi def link vimCondHL vimCommand -hi def link vimContinue Special -hi def link vimCtrlChar SpecialChar -hi def link vimEchoHLNone vimGroup -hi def link vimEchoHL vimCommand -hi def link vimElseIfErr Error -hi def link vimElseif vimCondHL -hi def link vimEnvvar PreProc -hi def link vimError Error -hi def link vimFBVar vimVar -hi def link vimFgBgAttrib vimHiAttrib -hi def link vimFold Folded -hi def link vimFTCmd vimCommand -hi def link vimFTOption vimSynType -hi def link vimFuncKey vimCommand -hi def link vimFuncName Function -hi def link vimFuncSID Special -hi def link vimFuncVar Identifier -hi def link vimGroupAdd vimSynOption -hi def link vimGroupName vimGroup -hi def link vimGroupRem vimSynOption -hi def link vimGroupSpecial Special -hi def link vimGroup Type -hi def link vimHiAttrib PreProc -hi def link vimHiClear vimHighlight -hi def link vimHiCtermFgBg vimHiTerm -hi def link vimHiCTerm vimHiTerm -hi def link vimHighlight vimCommand -hi def link vimHiGroup vimGroupName -hi def link vimHiGuiFgBg vimHiTerm -hi def link vimHiGuiFont vimHiTerm -hi def link vimHiGuiRgb vimNumber -hi def link vimHiGui vimHiTerm -hi def link vimHiNmbr Number -hi def link vimHiStartStop vimHiTerm -hi def link vimHiTerm Type -hi def link vimHLGroup vimGroup -hi def link vimHLMod PreProc -hi def link vimInsert vimString -hi def link vimKeyCode vimSpecFile -hi def link vimKeyword Statement -hi def link vimLet vimCommand -hi def link vimLineComment vimComment -hi def link vimMapBang vimCommand -hi def link vimMapModKey vimFuncSID -hi def link vimMapMod vimBracket -hi def link vimMap vimCommand -hi def link vimMark Number -hi def link vimMarkNumber vimNumber -hi def link vimMenuMod vimMapMod -hi def link vimMenuNameMore vimMenuName -hi def link vimMenuName PreProc -hi def link vimMtchComment vimComment -hi def link vimNorm vimCommand -hi def link vimNotation Special -hi def link vimNotFunc vimCommand -hi def link vimNotPatSep vimString -hi def link vimNumber Number -hi def link vimOperError Error -hi def link vimOper Operator -hi def link vimOption PreProc -hi def link vimParenSep Delimiter -hi def link vimPatSepErr vimPatSep -hi def link vimPatSepR vimPatSep -hi def link vimPatSep SpecialChar -hi def link vimPatSepZone vimString -hi def link vimPatSepZ vimPatSep -hi def link vimPattern Type -hi def link vimPlainMark vimMark -hi def link vimPlainRegister vimRegister -hi def link vimRegister SpecialChar -hi def link vimScriptDelim Comment -hi def link vimSearchDelim Statement -hi def link vimSearch vimString -hi def link vimSep Delimiter -hi def link vimSetMod vimOption -hi def link vimSetSep Statement -hi def link vimSetString vimString -hi def link vimSpecFile Identifier -hi def link vimSpecFileMod vimSpecFile -hi def link vimSpecial Type -hi def link vimStatement Statement -hi def link vimStringCont vimString -hi def link vimString String -hi def link vimSubst1 vimSubst -hi def link vimSubstDelim Delimiter -hi def link vimSubstFlags Special -hi def link vimSubstSubstr SpecialChar -hi def link vimSubstTwoBS vimString -hi def link vimSubst vimCommand -hi def link vimSynCaseError Error -hi def link vimSynCase Type -hi def link vimSyncC Type -hi def link vimSyncError Error -hi def link vimSyncGroupName vimGroupName -hi def link vimSyncGroup vimGroupName -hi def link vimSyncKey Type -hi def link vimSyncNone Type -hi def link vimSynContains vimSynOption -hi def link vimSynError Error -hi def link vimSynKeyContainedin vimSynContains -hi def link vimSynKeyOpt vimSynOption -hi def link vimSynMtchGrp vimSynOption -hi def link vimSynMtchOpt vimSynOption -hi def link vimSynNextgroup vimSynOption -hi def link vimSynNotPatRange vimSynRegPat -hi def link vimSynOption Special -hi def link vimSynPatRange vimString -hi def link vimSynRegOpt vimSynOption -hi def link vimSynRegPat vimString -hi def link vimSynReg Type -hi def link vimSyntax vimCommand -hi def link vimSynType vimSpecial -hi def link vimTodo Todo -hi def link vimUnmap vimMap -hi def link vimUserAttrbCmpltFunc Special -hi def link vimUserAttrbCmplt vimSpecial -hi def link vimUserAttrbKey vimOption -hi def link vimUserAttrb vimSpecial -hi def link vimUserCmdError Error -hi def link vimUserCommand vimCommand -hi def link vimUserFunc Normal -hi def link vimVar Identifier -hi def link vimWarn WarningMsg + 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 + hi def link vimAutoCmd vimCommand + hi def link vimAutoEvent Type + hi def link vimAutoSet vimCommand + hi def link vimBehaveModel vimBehave + hi def link vimBehave vimCommand + hi def link vimBracket Delimiter + hi def link vimCmplxRepeat SpecialChar + hi def link vimCommand Statement + hi def link vimComment Comment + hi def link vimCommentString vimString + hi def link vimCommentTitle PreProc + hi def link vimCondHL vimCommand + hi def link vimContinue Special + hi def link vimCtrlChar SpecialChar + hi def link vimEchoHLNone vimGroup + hi def link vimEchoHL vimCommand + hi def link vimElseIfErr Error + hi def link vimElseif vimCondHL + hi def link vimEnvvar PreProc + hi def link vimError Error + hi def link vimFBVar vimVar + hi def link vimFgBgAttrib vimHiAttrib + hi def link vimFold Folded + hi def link vimFTCmd vimCommand + hi def link vimFTOption vimSynType + hi def link vimFuncKey vimCommand + hi def link vimFuncName Function + hi def link vimFuncSID Special + hi def link vimFuncVar Identifier + hi def link vimGroupAdd vimSynOption + hi def link vimGroupName vimGroup + hi def link vimGroupRem vimSynOption + hi def link vimGroupSpecial Special + hi def link vimGroup Type + hi def link vimHiAttrib PreProc + hi def link vimHiClear vimHighlight + hi def link vimHiCtermFgBg vimHiTerm + hi def link vimHiCTerm vimHiTerm + hi def link vimHighlight vimCommand + hi def link vimHiGroup vimGroupName + hi def link vimHiGuiFgBg vimHiTerm + hi def link vimHiGuiFont vimHiTerm + hi def link vimHiGuiRgb vimNumber + hi def link vimHiGui vimHiTerm + hi def link vimHiNmbr Number + hi def link vimHiStartStop vimHiTerm + hi def link vimHiTerm Type + hi def link vimHLGroup vimGroup + 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 + hi def link vimLineComment vimComment + hi def link vimMapBang vimCommand + hi def link vimMapModKey vimFuncSID + hi def link vimMapMod vimBracket + hi def link vimMap vimCommand + hi def link vimMark Number + hi def link vimMarkNumber vimNumber + hi def link vimMenuMod vimMapMod + hi def link vimMenuNameMore vimMenuName + hi def link vimMenuName PreProc + hi def link vimMtchComment vimComment + hi def link vimNorm vimCommand + hi def link vimNotation Special + hi def link vimNotFunc vimCommand + hi def link vimNotPatSep vimString + hi def link vimNumber Number + hi def link vimOperError Error + hi def link vimOper Operator + hi def link vimOption PreProc + hi def link vimParenSep Delimiter + hi def link vimPatSepErr vimPatSep + hi def link vimPatSepR vimPatSep + hi def link vimPatSep SpecialChar + hi def link vimPatSepZone vimString + hi def link vimPatSepZ vimPatSep + hi def link vimPattern Type + hi def link vimPlainMark vimMark + hi def link vimPlainRegister vimRegister + hi def link vimRegister SpecialChar + hi def link vimScriptDelim Comment + hi def link vimSearchDelim Statement + hi def link vimSearch vimString + hi def link vimSep Delimiter + hi def link vimSetMod vimOption + hi def link vimSetSep Statement + hi def link vimSetString vimString + hi def link vimSpecFile Identifier + hi def link vimSpecFileMod vimSpecFile + hi def link vimSpecial Type + hi def link vimStatement Statement + hi def link vimStringCont vimString + hi def link vimString String + hi def link vimSubst1 vimSubst + hi def link vimSubstDelim Delimiter + hi def link vimSubstFlags Special + hi def link vimSubstSubstr SpecialChar + hi def link vimSubstTwoBS vimString + hi def link vimSubst vimCommand + hi def link vimSynCaseError Error + hi def link vimSynCase Type + hi def link vimSyncC Type + hi def link vimSyncError Error + hi def link vimSyncGroupName vimGroupName + hi def link vimSyncGroup vimGroupName + hi def link vimSyncKey Type + hi def link vimSyncNone Type + hi def link vimSynContains vimSynOption + hi def link vimSynError Error + hi def link vimSynKeyContainedin vimSynContains + hi def link vimSynKeyOpt vimSynOption + hi def link vimSynMtchGrp vimSynOption + hi def link vimSynMtchOpt vimSynOption + hi def link vimSynNextgroup vimSynOption + hi def link vimSynNotPatRange vimSynRegPat + hi def link vimSynOption Special + hi def link vimSynPatRange vimString + hi def link vimSynRegOpt vimSynOption + hi def link vimSynRegPat vimString + hi def link vimSynReg Type + hi def link vimSyntax vimCommand + hi def link vimSynType vimSpecial + hi def link vimTodo Todo + hi def link vimUnmap vimMap + 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 + hi def link vimVar Identifier + hi def link vimWarn WarningMsg +endif " Current Syntax Variable: {{{2 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 diff --git a/runtime/syntax/viminfo.vim b/runtime/syntax/viminfo.vim index 7af3b89ae0..667e1bab2a 100644 --- a/runtime/syntax/viminfo.vim +++ b/runtime/syntax/viminfo.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Vim .viminfo file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Feb 03 +" Last Change: 2016 Jun 05 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -30,11 +30,15 @@ syn match viminfoOptionName "\*\a*"ms=s+1 contained " Comments syn match viminfoComment "^#.*" +" New style lines. TODO: highlight numbers and strings. +syn match viminfoNew "^|.*" + " Define the default highlighting. " Only used when an item doesn't have highlighting yet hi def link viminfoComment Comment hi def link viminfoError Error hi def link viminfoStatement Statement +hi def link viminfoNew String let b:current_syntax = "viminfo" diff --git a/runtime/syntax/virata.vim b/runtime/syntax/virata.vim index e597b8e31c..0ed54fa899 100644 --- a/runtime/syntax/virata.vim +++ b/runtime/syntax/virata.vim @@ -13,10 +13,8 @@ " Setup Syntax: -if version < 600 - " Clear old syntax settings - syn clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Virata syntax is case insensitive (mostly) @@ -156,63 +154,53 @@ syn sync minlines=50 "for multiple region nesting " 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_virata_syntax_inits") - if version < 508 - let did_virata_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " Sub Links: - HiLink virataDefSubstError virataPreProcError - HiLink virataDefSubst virataPreProc - HiLink virataInAlter virataOperator - HiLink virataInExec virataOperator - HiLink virataInExport virataOperator - HiLink virataInImport virataOperator - HiLink virataInInstance virataOperator - HiLink virataInMake virataOperator - HiLink virataInModule virataOperator - HiLink virataInProcess virataOperator - HiLink virataInMacAddr virataHexNumber - - " Comment Group: - HiLink virataComment Comment - HiLink virataSpclComment SpecialComment - HiLink virataInCommentTodo Todo - - " Constant Group: - HiLink virataString String - HiLink virataStringError Error - HiLink virataCharacter Character - HiLink virataSpclChar Special - HiLink virataDecNumber Number - HiLink virataHexNumber Number - HiLink virataSizeNumber Number - HiLink virataNumberError Error - - " Identifier Group: - HiLink virataIdentError Error - - " PreProc Group: - HiLink virataPreProc PreProc - HiLink virataDefine Define - HiLink virataInclude Include - HiLink virataPreCondit PreCondit - HiLink virataPreProcError Error - HiLink virataPreProcWarn Todo - - " Directive Group: - HiLink virataStatement Statement - HiLink virataCfgStatement Statement - HiLink virataOperator Operator - HiLink virataDirective Keyword - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" Sub Links: +hi def link virataDefSubstError virataPreProcError +hi def link virataDefSubst virataPreProc +hi def link virataInAlter virataOperator +hi def link virataInExec virataOperator +hi def link virataInExport virataOperator +hi def link virataInImport virataOperator +hi def link virataInInstance virataOperator +hi def link virataInMake virataOperator +hi def link virataInModule virataOperator +hi def link virataInProcess virataOperator +hi def link virataInMacAddr virataHexNumber + +" Comment Group: +hi def link virataComment Comment +hi def link virataSpclComment SpecialComment +hi def link virataInCommentTodo Todo + +" Constant Group: +hi def link virataString String +hi def link virataStringError Error +hi def link virataCharacter Character +hi def link virataSpclChar Special +hi def link virataDecNumber Number +hi def link virataHexNumber Number +hi def link virataSizeNumber Number +hi def link virataNumberError Error + +" Identifier Group: +hi def link virataIdentError Error + +" PreProc Group: +hi def link virataPreProc PreProc +hi def link virataDefine Define +hi def link virataInclude Include +hi def link virataPreCondit PreCondit +hi def link virataPreProcError Error +hi def link virataPreProcWarn Todo + +" Directive Group: +hi def link virataStatement Statement +hi def link virataCfgStatement Statement +hi def link virataOperator Operator +hi def link virataDirective Keyword + let b:current_syntax = "virata" diff --git a/runtime/syntax/vmasm.vim b/runtime/syntax/vmasm.vim index 85d0441258..c5cbb1e3a2 100644 --- a/runtime/syntax/vmasm.vim +++ b/runtime/syntax/vmasm.vim @@ -6,11 +6,8 @@ " This is incomplete. Feel free to contribute... " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -196,55 +193,45 @@ syn match vmasmDirective "\.\(signed_\)\=word\>" syn case match " 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_macro_syntax_inits") - if version < 508 - let did_macro_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default methods for highlighting. Can be overridden later - " Comment Constant Error Identifier PreProc Special Statement Todo Type - " - " Constant Boolean Character Number String - " Identifier Function - " PreProc Define Include Macro PreCondit - " Special Debug Delimiter SpecialChar SpecialComment Tag - " Statement Conditional Exception Keyword Label Operator Repeat - " Type StorageClass Structure Typedef - - HiLink vmasmComment Comment - HiLink vmasmTodo Todo - - HiLink vmasmhexNumber Number " Constant - HiLink vmasmoctNumber Number " Constant - HiLink vmasmbinNumber Number " Constant - HiLink vmasmdecNumber Number " Constant - HiLink vmasmfloatNumber Number " Constant - -" HiLink vmasmString String " Constant - - HiLink vmasmReg Identifier - HiLink vmasmOperator Identifier - - HiLink vmasmInclude Include " PreProc - HiLink vmasmMacro Macro " PreProc - " HiLink vmasmMacroParam Keyword " Statement - - HiLink vmasmDirective Special - HiLink vmasmPreCond Special - - - HiLink vmasmOpcode Statement - HiLink vmasmCond Conditional " Statement - HiLink vmasmRepeat Repeat " Statement - - HiLink vmasmLabel Type - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +" The default methods for highlighting. Can be overridden later +" Comment Constant Error Identifier PreProc Special Statement Todo Type +" +" Constant Boolean Character Number String +" Identifier Function +" PreProc Define Include Macro PreCondit +" Special Debug Delimiter SpecialChar SpecialComment Tag +" Statement Conditional Exception Keyword Label Operator Repeat +" Type StorageClass Structure Typedef + +hi def link vmasmComment Comment +hi def link vmasmTodo Todo + +hi def link vmasmhexNumber Number " Constant +hi def link vmasmoctNumber Number " Constant +hi def link vmasmbinNumber Number " Constant +hi def link vmasmdecNumber Number " Constant +hi def link vmasmfloatNumber Number " Constant + +" hi def link vmasmString String " Constant + +hi def link vmasmReg Identifier +hi def link vmasmOperator Identifier + +hi def link vmasmInclude Include " PreProc +hi def link vmasmMacro Macro " PreProc +" hi def link vmasmMacroParam Keyword " Statement + +hi def link vmasmDirective Special +hi def link vmasmPreCond Special + + +hi def link vmasmOpcode Statement +hi def link vmasmCond Conditional " Statement +hi def link vmasmRepeat Repeat " Statement + +hi def link vmasmLabel Type let b:current_syntax = "vmasm" diff --git a/runtime/syntax/vrml.vim b/runtime/syntax/vrml.vim index 44814aad86..2474493c94 100644 --- a/runtime/syntax/vrml.vim +++ b/runtime/syntax/vrml.vim @@ -5,11 +5,8 @@ " Former Maintainer: Gregory Seidman <gsslist+vim@anthropohedron.net> " Last change: 2006 May 03 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -168,11 +165,9 @@ syn keyword VRMLProtos contained EXTERNPROTO PROTO IS syn keyword VRMLRoutes contained ROUTE TO -if version >= 502 "containment! - syn include @jscript $VIMRUNTIME/syntax/javascript.vim - syn region VRMLjScriptString contained start=+"\(\(javascript\)\|\(vrmlscript\)\|\(ecmascript\)\):+ms=e+1 skip=+\\\\\|\\"+ end=+"+me=e-1 contains=@jscript -endif +syn include @jscript $VIMRUNTIME/syntax/javascript.vim +syn region VRMLjScriptString contained start=+"\(\(javascript\)\|\(vrmlscript\)\|\(ecmascript\)\):+ms=e+1 skip=+\\\\\|\\"+ end=+"+me=e-1 contains=@jscript " match definitions. syn match VRMLSpecial contained "\\[0-9][0-9][0-9]\|\\." @@ -192,47 +187,35 @@ syn region VRMLInstName start="USE\>"hs=e+1 skip="USE\(,\|\s\)*" end="[A-Za-z syn keyword VRMLInstances contained DEF USE syn sync minlines=1 -if version >= 600 "FOLDS! - syn sync fromstart - "setlocal foldmethod=syntax - syn region braceFold start="{" end="}" transparent fold contains=TOP - syn region bracketFold start="\[" end="]" transparent fold contains=TOP - syn region VRMLString start=+"+ skip=+\\\\\|\\"+ end=+"+ fold contains=VRMLSpecial,VRMLjScriptString -endif +syn sync fromstart +"setlocal foldmethod=syntax +syn region braceFold start="{" end="}" transparent fold contains=TOP +syn region bracketFold start="\[" end="]" transparent fold contains=TOP +syn region VRMLString start=+"+ skip=+\\\\\|\\"+ end=+"+ fold contains=VRMLSpecial,VRMLjScriptString " 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_VRML_syntax_inits") - if version < 508 - let did_VRML_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink VRMLCharacter VRMLString - HiLink VRMLSpecialCharacter VRMLSpecial - HiLink VRMLNumber VRMLString - HiLink VRMLValues VRMLString - HiLink VRMLString String - HiLink VRMLSpecial Special - HiLink VRMLComment Comment - HiLink VRMLNodes Statement - HiLink VRMLFields Type - HiLink VRMLEvents Type - HiLink VRMLfTypes LineNr +" Only when an item doesn't have highlighting yet + +hi def link VRMLCharacter VRMLString +hi def link VRMLSpecialCharacter VRMLSpecial +hi def link VRMLNumber VRMLString +hi def link VRMLValues VRMLString +hi def link VRMLString String +hi def link VRMLSpecial Special +hi def link VRMLComment Comment +hi def link VRMLNodes Statement +hi def link VRMLFields Type +hi def link VRMLEvents Type +hi def link VRMLfTypes LineNr " hi VRMLfTypes ctermfg=6 guifg=Brown - HiLink VRMLInstances PreCondit - HiLink VRMLRoutes PreCondit - HiLink VRMLProtos PreProc - HiLink VRMLRouteNode Identifier - HiLink VRMLInstName Identifier - HiLink VRMLTypes Identifier - - delcommand HiLink -endif +hi def link VRMLInstances PreCondit +hi def link VRMLRoutes PreCondit +hi def link VRMLProtos PreProc +hi def link VRMLRouteNode Identifier +hi def link VRMLInstName Identifier +hi def link VRMLTypes Identifier + let b:current_syntax = "vrml" diff --git a/runtime/syntax/vroom.vim b/runtime/syntax/vroom.vim index 29860a8ac7..0509e30b17 100644 --- a/runtime/syntax/vroom.vim +++ b/runtime/syntax/vroom.vim @@ -1,13 +1,10 @@ " Vim syntax file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 -" For version 5.x: Clear all syntax items. -" For version 6.x and later: Quit when a syntax file was already loaded. -if v:version < 600 - syntax clear -elseif exists('b:current_syntax') +" quit when a syntax file was already loaded +if exists('b:current_syntax') finish endif diff --git a/runtime/syntax/vsejcl.vim b/runtime/syntax/vsejcl.vim index f4f00c65ea..f329836236 100644 --- a/runtime/syntax/vsejcl.vim +++ b/runtime/syntax/vsejcl.vim @@ -4,11 +4,8 @@ " URL: " Last change: 2001 May 10 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -23,26 +20,16 @@ syn match vsejclString /'.\{-}'/ syn match vsejclParms /(.\{-})/ contained " 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_vsejcl_syntax") - if version < 508 - let did_vsejcl_syntax = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink vsejclComment Comment - HiLink vsejclField Type - HiLink vsejclKeyword Statement - HiLink vsejclObject Constant - HiLink vsejclString Constant - HiLink vsejclMisc Special - HiLink vsejclParms Constant +hi def link vsejclComment Comment +hi def link vsejclField Type +hi def link vsejclKeyword Statement +hi def link vsejclObject Constant +hi def link vsejclString Constant +hi def link vsejclMisc Special +hi def link vsejclParms Constant - delcommand HiLink -endif let b:current_syntax = "vsejcl" diff --git a/runtime/syntax/wdiff.vim b/runtime/syntax/wdiff.vim index 9cd0611819..d0afadff2f 100644 --- a/runtime/syntax/wdiff.vim +++ b/runtime/syntax/wdiff.vim @@ -9,11 +9,8 @@ " SPAM is _NOT_ welcome - be ready to be reported! -" 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 @@ -23,21 +20,10 @@ syn region wdiffNew start="{+" end="+}" " 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_wdiff_syn_inits") - let did_wdiff_syn_inits = 1 - if version < 508 - let did_wdiff_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink wdiffOld Special - HiLink wdiffNew Identifier - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link wdiffOld Special +hi def link wdiffNew Identifier + let b:current_syntax = "wdiff" diff --git a/runtime/syntax/web.vim b/runtime/syntax/web.vim index f7a7fdfdc2..54eebda399 100644 --- a/runtime/syntax/web.vim +++ b/runtime/syntax/web.vim @@ -8,11 +8,8 @@ " the standard WEB distribution, available for anonymous ftp at " ftp://labrea.stanford.edu/pub/tex/web/. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,12 +17,8 @@ endif " we base this syntax file on the modern superset, CWEB. Note: This shortcut " may introduce some illegal constructs, e.g., CWEB's "@c" does _not_ start a " code section in WEB. Anyway, I'm not a WEB programmer. -if version < 600 - source <sfile>:p:h/cweb.vim -else - runtime! syntax/cweb.vim - unlet b:current_syntax -endif +runtime! syntax/cweb.vim +unlet b:current_syntax " Replace C/C++ syntax by Pascal syntax. syntax include @webIncludedC <sfile>:p:h/pascal.vim diff --git a/runtime/syntax/webmacro.vim b/runtime/syntax/webmacro.vim index 3b863f7c37..fb1fff6d3d 100644 --- a/runtime/syntax/webmacro.vim +++ b/runtime/syntax/webmacro.vim @@ -11,21 +11,16 @@ " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + " quit when a syntax file was already loaded + if exists("b:current_syntax") finish endif let main_syntax = 'webmacro' endif -if version < 600 - source <sfile>:p:h/html.vim -else - runtime! syntax/html.vim - unlet b:current_syntax -endif +runtime! syntax/html.vim +unlet b:current_syntax syn cluster htmlPreProc add=webmacroIf,webmacroUse,webmacroBraces,webmacroParse,webmacroInclude,webmacroSet,webmacroForeach,webmacroComment @@ -49,31 +44,21 @@ syn match webmacroComment "##.*$" syn match webmacroHash "[#{}\$]" contained " 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_webmacro_syn_inits") - if version < 508 - let did_webmacro_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink webmacroComment CommentTitle - HiLink webmacroVariable PreProc - HiLink webmacroIf webmacroStatement - HiLink webmacroForeach webmacroStatement - HiLink webmacroSet webmacroStatement - HiLink webmacroInclude webmacroStatement - HiLink webmacroParse webmacroStatement - HiLink webmacroStatement Function - HiLink webmacroNumber Number - HiLink webmacroBoolean Boolean - HiLink webmacroSpecial Special - HiLink webmacroString String - HiLink webmacroBracesError Error - delcommand HiLink -endif +hi def link webmacroComment CommentTitle +hi def link webmacroVariable PreProc +hi def link webmacroIf webmacroStatement +hi def link webmacroForeach webmacroStatement +hi def link webmacroSet webmacroStatement +hi def link webmacroInclude webmacroStatement +hi def link webmacroParse webmacroStatement +hi def link webmacroStatement Function +hi def link webmacroNumber Number +hi def link webmacroBoolean Boolean +hi def link webmacroSpecial Special +hi def link webmacroString String +hi def link webmacroBracesError Error let b:current_syntax = "webmacro" diff --git a/runtime/syntax/winbatch.vim b/runtime/syntax/winbatch.vim index aea2cdebcb..15ea0fc77b 100644 --- a/runtime/syntax/winbatch.vim +++ b/runtime/syntax/winbatch.vim @@ -4,11 +4,8 @@ " URL: http://www.mggen.com/vim/syntax/winbatch.zip " Last change: 2001 May 10 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -158,29 +155,19 @@ syn keyword winbatchImplicit xgetchildhwnd xgetelapsed xhex xmemcompact xmessage syn keyword winbatchImplicit xsendmessage xverifyccard yield " 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_winbatch_syntax_inits") - if version < 508 - let did_winbatch_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink winbatchLabel PreProc - HiLink winbatchCtl Operator - HiLink winbatchStatement Statement - HiLink winbatchTodo Todo - HiLink winbatchString String - HiLink winbatchVar Type - HiLink winbatchComment Comment - HiLink winbatchImplicit Special - HiLink winbatchNumber Number - HiLink winbatchConstant StorageClass +hi def link winbatchLabel PreProc +hi def link winbatchCtl Operator +hi def link winbatchStatement Statement +hi def link winbatchTodo Todo +hi def link winbatchString String +hi def link winbatchVar Type +hi def link winbatchComment Comment +hi def link winbatchImplicit Special +hi def link winbatchNumber Number +hi def link winbatchConstant StorageClass - delcommand HiLink -endif let b:current_syntax = "winbatch" diff --git a/runtime/syntax/wml.vim b/runtime/syntax/wml.vim index 5957930c8e..73bf822e40 100644 --- a/runtime/syntax/wml.vim +++ b/runtime/syntax/wml.vim @@ -16,21 +16,14 @@ " vim-package around your corner :) -" 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 " A lot of the web stuff looks like HTML so we load that first -if version < 600 - so <sfile>:p:h/html.vim -else - runtime! syntax/html.vim -endif +runtime! syntax/html.vim unlet b:current_syntax if !exists("main_syntax") @@ -108,11 +101,7 @@ syn region htmlTagName start="\<\(define-tag\|define-region\)" end="\>" cont " The perl include stuff if main_syntax != 'perl' " Perl script - if version < 600 - syn include @wmlPerlScript <sfile>:p:h/perl.vim - else - syn include @wmlPerlScript syntax/perl.vim - endif + syn include @wmlPerlScript syntax/perl.vim unlet b:current_syntax syn region perlScript start=+<perl>+ keepend end=+</perl>+ contains=@wmlPerlScript,wmlPerlTag @@ -140,33 +129,22 @@ if main_syntax == "html" endif " 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_wml_syn_inits") - let did_wml_syn_inits = 1 - if version < 508 - let did_wml_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink wmlNextLine Special - HiLink wmlUse Include - HiLink wmlUsed String - HiLink wmlBody Special - HiLink wmlDiverted Label - HiLink wmlDivert Delimiter - HiLink wmlDivertEnd Delimiter - HiLink wmlLocationId Label - HiLink wmlLocation Delimiter -" HiLink wmlLocationed Delimiter - HiLink wmlDefineName String - HiLink wmlComment Comment - HiLink wmlInclude Include - HiLink wmlSharpBang PreProc - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link wmlNextLine Special +hi def link wmlUse Include +hi def link wmlUsed String +hi def link wmlBody Special +hi def link wmlDiverted Label +hi def link wmlDivert Delimiter +hi def link wmlDivertEnd Delimiter +hi def link wmlLocationId Label +hi def link wmlLocation Delimiter +" hi def link wmlLocationed Delimiter +hi def link wmlDefineName String +hi def link wmlComment Comment +hi def link wmlInclude Include +hi def link wmlSharpBang PreProc + let b:current_syntax = "wml" diff --git a/runtime/syntax/wsml.vim b/runtime/syntax/wsml.vim index 2a92a0d548..d01294caac 100644 --- a/runtime/syntax/wsml.vim +++ b/runtime/syntax/wsml.vim @@ -4,10 +4,8 @@ " URL: none " Last Change: 2006 Apr 30 -" Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -78,47 +76,37 @@ syn match wsmlSpecial "\\u\d\{4\}" syn cluster wsmlTop add=wsmlString,wsmlCharacter,wsmlNumber,wsmlSpecial,wsmlStringError " 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_wsml_syn_inits") - if version < 508 - let did_wsml_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink wsmlHeader TypeDef - HiLink wsmlNamespace TypeDef - HiLink wsmlOntology Statement - HiLink wsmlAxiom TypeDef - HiLink wsmlService TypeDef - HiLink wsmlNFP TypeDef - HiLink wsmlTopLevel TypeDef - HiLink wsmlMediation TypeDef - HiLink wsmlBehavioral TypeDef - HiLink wsmlChoreographyPri TypeDef - HiLink wsmlChoreographySec Operator - HiLink wsmlChoreographyTer Special - HiLink wsmlString String - HiLink wsmlIdentifier Normal - HiLink wsmlSqName Normal - HiLink wsmlVariable Define - HiLink wsmlKeywordsInsideLEs Operator - HiLink wsmlOperator Operator - HiLink wsmlBrace Operator - HiLink wsmlCharacter Character - HiLink wsmlNumber Number - HiLink wsmlDataTypes Special - HiLink wsmlComment Comment - HiLink wsmlDocComment Comment - HiLink wsmlLineComment Comment - HiLink wsmlTodo Todo - HiLink wsmlFixMe Error - HiLink wsmlCommentTitle SpecialComment - HiLink wsmlCommentStar wsmlComment - endif +" Only when an item doesn't have highlighting yet +hi def link wsmlHeader TypeDef +hi def link wsmlNamespace TypeDef +hi def link wsmlOntology Statement +hi def link wsmlAxiom TypeDef +hi def link wsmlService TypeDef +hi def link wsmlNFP TypeDef +hi def link wsmlTopLevel TypeDef +hi def link wsmlMediation TypeDef +hi def link wsmlBehavioral TypeDef +hi def link wsmlChoreographyPri TypeDef +hi def link wsmlChoreographySec Operator +hi def link wsmlChoreographyTer Special +hi def link wsmlString String +hi def link wsmlIdentifier Normal +hi def link wsmlSqName Normal +hi def link wsmlVariable Define +hi def link wsmlKeywordsInsideLEs Operator +hi def link wsmlOperator Operator +hi def link wsmlBrace Operator +hi def link wsmlCharacter Character +hi def link wsmlNumber Number +hi def link wsmlDataTypes Special +hi def link wsmlComment Comment +hi def link wsmlDocComment Comment +hi def link wsmlLineComment Comment +hi def link wsmlTodo Todo +hi def link wsmlFixMe Error +hi def link wsmlCommentTitle SpecialComment +hi def link wsmlCommentStar wsmlComment -delcommand HiLink let b:current_syntax = "wsml" let b:spell_options="contained" diff --git a/runtime/syntax/xdefaults.vim b/runtime/syntax/xdefaults.vim index 5e38952a75..7da5969cde 100644 --- a/runtime/syntax/xdefaults.vim +++ b/runtime/syntax/xdefaults.vim @@ -10,11 +10,8 @@ " xrdb manual page " xrdb source: ftp://ftp.x.org/pub/R6.4/xc/programs/xrdb/xrdb.c -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -109,36 +106,26 @@ syn keyword xdefaultsSymbol contained X_RESOLUTION syn keyword xdefaultsSymbol contained Y_RESOLUTION " 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_xdefaults_syntax_inits") - if version < 508 - let did_xdefaults_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink xdefaultsLabel Type - HiLink xdefaultsValue Constant - HiLink xdefaultsComment Comment - HiLink xdefaultsCommentH xdefaultsComment - HiLink xdefaultsPreProc PreProc - HiLink xdefaultsInclude xdefaultsPreProc - HiLink xdefaultsCppSkip xdefaultsCppOut - HiLink xdefaultsCppOut2 xdefaultsCppOut - HiLink xdefaultsCppOut Comment - HiLink xdefaultsIncluded String - HiLink xdefaultsDefine Macro - HiLink xdefaultsSymbol Statement - HiLink xdefaultsSpecial Statement - HiLink xdefaultsErrorLine Error - HiLink xdefaultsCommentError Error - HiLink xdefaultsPunct Normal - HiLink xdefaultsLineEnd Special - HiLink xdefaultsTodo Todo - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet +hi def link xdefaultsLabel Type +hi def link xdefaultsValue Constant +hi def link xdefaultsComment Comment +hi def link xdefaultsCommentH xdefaultsComment +hi def link xdefaultsPreProc PreProc +hi def link xdefaultsInclude xdefaultsPreProc +hi def link xdefaultsCppSkip xdefaultsCppOut +hi def link xdefaultsCppOut2 xdefaultsCppOut +hi def link xdefaultsCppOut Comment +hi def link xdefaultsIncluded String +hi def link xdefaultsDefine Macro +hi def link xdefaultsSymbol Statement +hi def link xdefaultsSpecial Statement +hi def link xdefaultsErrorLine Error +hi def link xdefaultsCommentError Error +hi def link xdefaultsPunct Normal +hi def link xdefaultsLineEnd Special +hi def link xdefaultsTodo Todo + let b:current_syntax = "xdefaults" diff --git a/runtime/syntax/xf86conf.vim b/runtime/syntax/xf86conf.vim index 62784d2285..545eda7db0 100644 --- a/runtime/syntax/xf86conf.vim +++ b/runtime/syntax/xf86conf.vim @@ -10,12 +10,8 @@ " to force XFree86 3.x or 4.x XF86Config syntax " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - echo "Sorry, but this syntax file relies on Vim 6 features. Either upgrade Vim or usea version of " . expand("<sfile>:t:r") . " syntax file appropriate for Vim " . version/100 . "." . version %100 . "." +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/xinetd.vim b/runtime/syntax/xinetd.vim index 9010a48a1d..fab3a916ea 100644 --- a/runtime/syntax/xinetd.vim +++ b/runtime/syntax/xinetd.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/xkb.vim b/runtime/syntax/xkb.vim index ff9bfd0dae..59fc497e62 100644 --- a/runtime/syntax/xkb.vim +++ b/runtime/syntax/xkb.vim @@ -6,12 +6,9 @@ " URL: http://trific.ath.cx/Ftp/vim/syntax/xkb.vim " Setup -if version >= 600 - if exists("b:current_syntax") - finish - endif -else - syntax clear +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif syn case match @@ -50,42 +47,33 @@ syn keyword xkbTModif default hidden partial virtual syn keyword xkbSect alphanumeric_keys alternate_group function_keys keypad_keys modifier_keys xkb_compatibility xkb_geometry xkb_keycodes xkb_keymap xkb_semantics xkb_symbols xkb_types " Define the default highlighting -if version >= 508 || !exists("did_xkb_syntax_inits") - if version < 508 - let did_xkb_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink xkbModif xkbPreproc - HiLink xkbTModif xkbPreproc - HiLink xkbPreproc Preproc - - HiLink xkbIdentifier Keyword - HiLink xkbFunction Function - HiLink xkbSect Type - HiLink xkbPhysicalKey Identifier - HiLink xkbKeyword Keyword - - HiLink xkbComment Comment - HiLink xkbTodo Todo - - HiLink xkbConstant Constant - HiLink xkbString String - - HiLink xkbSpecialChar xkbSpecial - HiLink xkbSpecial Special - - HiLink xkbParenError xkbBalancingError - HiLink xkbBraceError xkbBalancingError - HiLink xkbBraketError xkbBalancingError - HiLink xkbBalancingError xkbError - HiLink xkbCommentStartError xkbCommentError - HiLink xkbCommentError xkbError - HiLink xkbError Error - - delcommand HiLink -endif + +hi def link xkbModif xkbPreproc +hi def link xkbTModif xkbPreproc +hi def link xkbPreproc Preproc + +hi def link xkbIdentifier Keyword +hi def link xkbFunction Function +hi def link xkbSect Type +hi def link xkbPhysicalKey Identifier +hi def link xkbKeyword Keyword + +hi def link xkbComment Comment +hi def link xkbTodo Todo + +hi def link xkbConstant Constant +hi def link xkbString String + +hi def link xkbSpecialChar xkbSpecial +hi def link xkbSpecial Special + +hi def link xkbParenError xkbBalancingError +hi def link xkbBraceError xkbBalancingError +hi def link xkbBraketError xkbBalancingError +hi def link xkbBalancingError xkbError +hi def link xkbCommentStartError xkbCommentError +hi def link xkbCommentError xkbError +hi def link xkbError Error + let b:current_syntax = "xkb" diff --git a/runtime/syntax/xmath.vim b/runtime/syntax/xmath.vim index 83efb08db2..22b3e85dae 100644 --- a/runtime/syntax/xmath.vim +++ b/runtime/syntax/xmath.vim @@ -1,15 +1,13 @@ " Vim syntax file " Language: xmath (a simulation tool) -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 11, 2006 -" Version: 6 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 9 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XMATH " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -194,41 +192,32 @@ syn sync match xmathSyncComment grouphere xmathCommentBlock "#{" syn sync match xmathSyncComment groupthere NONE "}#" " 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_xmath_syntax_inits") - if version < 508 - let did_xmath_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink xmathBraceError xmathError - HiLink xmathCmd xmathStatement - HiLink xmathCommentBlock xmathComment - HiLink xmathCurlyError xmathError - HiLink xmathFuncCmd xmathStatement - HiLink xmathParenError xmathError +if !exists("skip_xmath_syntax_inits") + + hi def link xmathBraceError xmathError + hi def link xmathCmd xmathStatement + hi def link xmathCommentBlock xmathComment + hi def link xmathCurlyError xmathError + hi def link xmathFuncCmd xmathStatement + hi def link xmathParenError xmathError " The default methods for highlighting. Can be overridden later - HiLink xmathCharacter Character - HiLink xmathComma Delimiter - HiLink xmathComment Comment - HiLink xmathCommentBlock Comment - HiLink xmathConditional Conditional - HiLink xmathError Error - HiLink xmathFunc Function - HiLink xmathLabel PreProc - HiLink xmathNumber Number - HiLink xmathRepeat Repeat - HiLink xmathSpecial Type - HiLink xmathSpecialChar SpecialChar - HiLink xmathStatement Statement - HiLink xmathString String - HiLink xmathTodo Todo - - delcommand HiLink + hi def link xmathCharacter Character + hi def link xmathComma Delimiter + hi def link xmathComment Comment + hi def link xmathCommentBlock Comment + hi def link xmathConditional Conditional + hi def link xmathError Error + hi def link xmathFunc Function + hi def link xmathLabel PreProc + hi def link xmathNumber Number + hi def link xmathRepeat Repeat + hi def link xmathSpecial Type + hi def link xmathSpecialChar SpecialChar + hi def link xmathStatement Statement + hi def link xmathString String + hi def link xmathTodo Todo + endif let b:current_syntax = "xmath" diff --git a/runtime/syntax/xmodmap.vim b/runtime/syntax/xmodmap.vim index 69c70c563d..28cae3eb71 100644 --- a/runtime/syntax/xmodmap.vim +++ b/runtime/syntax/xmodmap.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: xmodmap(1) definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: xmodmap(1) definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/xpm.vim b/runtime/syntax/xpm.vim index 3cbc1b54fd..0667ca28ad 100644 --- a/runtime/syntax/xpm.vim +++ b/runtime/syntax/xpm.vim @@ -1,14 +1,12 @@ " Vim syntax file " Language: X Pixmap " Maintainer: Ronald Schild <rs@scutum.de> -" Last Change: 2008 May 28 +" Last Change: 2017 Feb 01 " Version: 5.4n.1 +" Jemma Nelson added termguicolors support -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -18,7 +16,7 @@ syn keyword xpmTodo TODO FIXME XXX contained syn region xpmComment start="/\*" end="\*/" contains=xpmTodo syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmColors -if has("gui_running") +if has("gui_running") || has("termguicolors") && &termguicolors let color = "" let chars = "" @@ -123,27 +121,17 @@ endwhile unlet color chars colors cpp n i s -endif " has("gui_running") +endif " has("gui_running") || has("termguicolors") && &termguicolors " 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_xpm_syntax_inits") - if version < 508 - let did_xpm_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink xpmType Type - HiLink xpmStorageClass StorageClass - HiLink xpmTodo Todo - HiLink xpmComment Comment - HiLink xpmPixelString String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link xpmType Type +hi def link xpmStorageClass StorageClass +hi def link xpmTodo Todo +hi def link xpmComment Comment +hi def link xpmPixelString String + let b:current_syntax = "xpm" diff --git a/runtime/syntax/xpm2.vim b/runtime/syntax/xpm2.vim index 74b3c66af2..dfa6945a31 100644 --- a/runtime/syntax/xpm2.vim +++ b/runtime/syntax/xpm2.vim @@ -1,17 +1,15 @@ " Vim syntax file " Language: X Pixmap v2 " Maintainer: Steve Wall (hitched97@velnet.com) -" Last Change: 2012 Jun 01 +" Last Change: 2017 Feb 01 " (Dominique Pelle added @Spell) " Version: 5.8 +" Jemma Nelson added termguicolors support " " Made from xpm.vim by Ronald Schild <rs@scutum.de> -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -23,15 +21,9 @@ syn keyword xpm2Todo TODO FIXME XXX contained syn match xpm2Comment "\!.*$" contains=@Spell,xpm2Todo -if version < 508 - command -nargs=+ HiLink hi link <args> - command -nargs=+ Hi hi <args> -else - command -nargs=+ HiLink hi def link <args> - command -nargs=+ Hi hi def <args> -endif +command -nargs=+ Hi hi def <args> -if has("gui_running") +if has("gui_running") || has("termguicolors") && &termguicolors let color = "" let chars = "" @@ -63,7 +55,7 @@ if has("gui_running") if s !~ '/' exe 'syn match xpm2Values /' . s . '/' endif - HiLink xpm2Values Statement + hi def link xpm2Values Statement let n = 1 " n = color index @@ -112,11 +104,11 @@ if has("gui_running") " now create syntax items " highlight the color string as normal string (no pixel string) exe 'syn match xpm2Col'.n.'Def /'.s.'/ contains=xpm2Col'.n.'inDef' - exe 'HiLink xpm2Col'.n.'Def Constant' + exe 'hi def link xpm2Col'.n.'Def Constant' " but highlight the first whitespace after chars in its color exe 'syn match xpm2Col'.n.'inDef /^'.chars.'/hs=s+'.(cpp).' contained' - exe 'HiLink xpm2Col'.n.'inDef xpm2Color'.n + exe 'hi def link xpm2Col'.n.'inDef xpm2Color'.n " remove the following whitespace from chars let chars = substitute(chars, '\\s\\+$', '', '') @@ -141,24 +133,17 @@ if has("gui_running") unlet color chars colors cpp n i s -endif " has("gui_running") +endif " has("gui_running") || has("termguicolors") && &termguicolors " 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_xpm2_syntax_inits") - if version < 508 - let did_xpm2_syntax_inits = 1 - endif - - " The default highlighting. - HiLink xpm2Type Type - HiLink xpm2StorageClass StorageClass - HiLink xpm2Todo Todo - HiLink xpm2Comment Comment - HiLink xpm2PixelString String -endif -delcommand HiLink +" Only when an item doesn't have highlighting yet +" The default highlighting. +hi def link xpm2Type Type +hi def link xpm2StorageClass StorageClass +hi def link xpm2Todo Todo +hi def link xpm2Comment Comment +hi def link xpm2PixelString String + delcommand Hi let b:current_syntax = "xpm2" diff --git a/runtime/syntax/xs.vim b/runtime/syntax/xs.vim index 6fd0a468f9..d4ac9d1bc7 100644 --- a/runtime/syntax/xs.vim +++ b/runtime/syntax/xs.vim @@ -5,20 +5,13 @@ " Previous: Vincent Pit <perl@profvince.com> " Last Change: 2013-05-12 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif " Read the C syntax to start with -if version < 600 - source <sfile>:p:h/c.vim -else - runtime! syntax/c.vim -endif +runtime! syntax/c.vim let xs_superseded = 1 " mark C functions superseded by Perl replacements let xs_not_core = 1 " mark private core functions @@ -3249,29 +3242,19 @@ syn keyword xsMacro what_len_TRICKYFOLD_safe whichsig write xio_any xio_dirp syn keyword xsMacro xiv_iv xuv_uv yystype " 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_xs_syntax_inits") - if version < 508 - let did_xs_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +" Only when an item doesn't have highlighting yet - HiLink xsPrivate Error - HiLink xsSuperseded Error - HiLink xsType Type - HiLink xsString String - HiLink xsConstant Constant - HiLink xsException Exception - HiLink xsKeyword Keyword - HiLink xsFunction Function - HiLink xsVariable Identifier - HiLink xsMacro Macro +hi def link xsPrivate Error +hi def link xsSuperseded Error +hi def link xsType Type +hi def link xsString String +hi def link xsConstant Constant +hi def link xsException Exception +hi def link xsKeyword Keyword +hi def link xsFunction Function +hi def link xsVariable Identifier +hi def link xsMacro Macro - delcommand HiLink -endif let b:current_syntax = "xs" diff --git a/runtime/syntax/xxd.vim b/runtime/syntax/xxd.vim index 50594e1fcf..f3c43e816c 100644 --- a/runtime/syntax/xxd.vim +++ b/runtime/syntax/xxd.vim @@ -1,16 +1,13 @@ " Vim syntax file " Language: bin using xxd -" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 06, 2005 -" Version: 7 +" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> +" Last Change: Aug 31, 2016 +" Version: 10 " Notes: use :help xxd to see how to invoke it -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XXD -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -20,21 +17,12 @@ syn match xxdAscii " .\{,16\}\r\=$"hs=s+2 contains=xxdDot syn match xxdDot contained "[.\r]" " 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_xxd_syntax_inits") - if version < 508 - let did_xxd_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +if !exists("skip_xxd_syntax_inits") - HiLink xxdAddress Constant - HiLink xxdSep Identifier - HiLink xxdAscii Statement + hi def link xxdAddress Constant + hi def link xxdSep Identifier + hi def link xxdAscii Statement - delcommand HiLink endif let b:current_syntax = "xxd" diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim index 17a1cab6b7..01e342ee29 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,18 +1,15 @@ " Vim syntax file " Language: Yacc " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Mar 20, 2014 -" Version: 11 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" Last Change: Aug 31, 2016 +" Version: 15 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC " " Options: {{{1 " g:yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C " --------------------------------------------------------------------- " this version of syntax/yacc.vim requires 6.0 or later -if version < 600 - finish -endif if exists("b:current_syntax") syntax clear endif @@ -90,7 +87,7 @@ syn sync fromstart " --------------------------------------------------------------------- " Define the default highlighting. {{{1 -if !exists("did_yacc_syn_inits") +if !exists("skip_yacc_syn_inits") hi def link yaccBrkt yaccStmt hi def link yaccComment Comment hi def link yaccCurly Delimiter diff --git a/runtime/syntax/yaml.vim b/runtime/syntax/yaml.vim index 073dbf7418..626dc8a77f 100644 --- a/runtime/syntax/yaml.vim +++ b/runtime/syntax/yaml.vim @@ -2,7 +2,7 @@ " Language: YAML (YAML Ain't Markup Language) 1.2 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> " First author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-08 +" Latest Revision: 2015-03-28 if exists('b:current_syntax') finish @@ -11,13 +11,40 @@ endif let s:cpo_save = &cpo set cpo&vim -let s:ns_char = '\%(\%([\n\r\uFEFF \t]\)\@!\p\)' -let s:ns_word_char = '\%(\w\|-\)' -let s:ns_uri_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$,.!~*''()\[\]]\)' +" Choose the schema to use +" TODO: Validate schema +if !exists('b:yaml_schema') + if exists('g:yaml_schema') + let b:yaml_schema = g:yaml_schema + else + let b:yaml_schema = 'core' + endif +endif + +let s:ns_char = '\%([\n\r\uFEFF \t]\@!\p\)' +let s:ns_word_char = '[[:alnum:]_\-]' +let s:ns_uri_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$,.!~*''()[\]]\)' let s:ns_tag_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$.~*''()]\)' -let s:c_ns_anchor_char = '\%(\%([\n\r\uFEFF \t,\[\]{}]\)\@!\p\)' -let s:c_indicator = '[\-?:,\[\]{}#&*!|>''"%@`]' -let s:c_flow_indicator = '[,\[\]{}]' +let s:c_ns_anchor_char = '\%([\n\r\uFEFF \t,[\]{}]\@!\p\)' +let s:c_indicator = '[\-?:,[\]{}#&*!|>''"%@`]' +let s:c_flow_indicator = '[,[\]{}]' + +let s:ns_char_without_c_indicator = substitute(s:ns_char, '\v\C[\zs', '\=s:c_indicator[1:-2]', '') + +let s:_collection = '[^\@!\(\%(\\\.\|\[^\\\]]\)\+\)]' +let s:_neg_collection = '[^\(\%(\\\.\|\[^\\\]]\)\+\)]' +function s:SimplifyToAssumeAllPrintable(p) + return substitute(a:p, '\V\C\\%('.s:_collection.'\\@!\\p\\)', '[^\1]', '') +endfunction +let s:ns_char = s:SimplifyToAssumeAllPrintable(s:ns_char) +let s:ns_char_without_c_indicator = s:SimplifyToAssumeAllPrintable(s:ns_char_without_c_indicator) +let s:c_ns_anchor_char = s:SimplifyToAssumeAllPrintable(s:c_ns_anchor_char) + +function s:SimplifyAdjacentCollections(p) + return substitute(a:p, '\V\C'.s:_collection.'\\|'.s:_collection, '[\1\2]', 'g') +endfunction +let s:ns_uri_char = s:SimplifyAdjacentCollections(s:ns_uri_char) +let s:ns_tag_char = s:SimplifyAdjacentCollections(s:ns_tag_char) let s:c_verbatim_tag = '!<'.s:ns_uri_char.'\+>' let s:c_named_tag_handle = '!'.s:ns_word_char.'\+!' @@ -46,11 +73,15 @@ let s:ns_tag_prefix = s:ns_local_tag_prefix. let s:ns_plain_safe_out = s:ns_char let s:ns_plain_safe_in = '\%('.s:c_flow_indicator.'\@!'.s:ns_char.'\)' -let s:ns_plain_first_in = '\%('.s:c_indicator.'\@!'.s:ns_char.'\|[?:\-]\%('.s:ns_plain_safe_in.'\)\@=\)' -let s:ns_plain_first_out = '\%('.s:c_indicator.'\@!'.s:ns_char.'\|[?:\-]\%('.s:ns_plain_safe_out.'\)\@=\)' +let s:ns_plain_safe_in = substitute(s:ns_plain_safe_in, '\V\C\\%('.s:_collection.'\\@!'.s:_neg_collection.'\\)', '[^\1\2]', '') +let s:ns_plain_safe_in_without_colhash = substitute(s:ns_plain_safe_in, '\V\C'.s:_neg_collection, '[^\1:#]', '') +let s:ns_plain_safe_out_without_colhash = substitute(s:ns_plain_safe_out, '\V\C'.s:_neg_collection, '[^\1:#]', '') -let s:ns_plain_char_in = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_in.'\|[:#]\@!'.s:ns_plain_safe_in.'\)' -let s:ns_plain_char_out = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_out.'\|[:#]\@!'.s:ns_plain_safe_out.'\)' +let s:ns_plain_first_in = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_in.'\)\@=\)' +let s:ns_plain_first_out = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_out.'\)\@=\)' + +let s:ns_plain_char_in = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_in.'\|'.s:ns_plain_safe_in_without_colhash.'\)' +let s:ns_plain_char_out = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_out.'\|'.s:ns_plain_safe_out_without_colhash.'\)' let s:ns_plain_out = s:ns_plain_first_out . s:ns_plain_char_out.'*' let s:ns_plain_in = s:ns_plain_first_in . s:ns_plain_char_in.'*' @@ -89,9 +120,11 @@ syn match yamlSingleEscape contained "''" syn match yamlBlockScalarHeader contained '\s\+\zs[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\=' +syn cluster yamlConstant contains=yamlBool,yamlNull + syn cluster yamlFlow contains=yamlFlowString,yamlFlowMapping,yamlFlowCollection syn cluster yamlFlow add=yamlFlowMappingKey,yamlFlowMappingMerge -syn cluster yamlFlow add=yamlConstant,yamlPlainScalar,yamlFloat +syn cluster yamlFlow add=@yamlConstant,yamlPlainScalar,yamlFloat syn cluster yamlFlow add=yamlTimestamp,yamlInteger,yamlMappingKeyStart syn cluster yamlFlow add=yamlComment syn region yamlFlowMapping matchgroup=yamlFlowIndicator start='{' end='}' contains=@yamlFlow @@ -103,15 +136,15 @@ execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/' syn match yamlMappingKeyStart '?\ze\s' syn match yamlMappingKeyStart '?' contained -execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\ze\s*:/ contained '. +execute 'syn match yamlFlowMappingKey /\%#=1'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:/ contained '. \'nextgroup=yamlKeyValueDelimiter' syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlKeyValueDelimiter syn match yamlBlockCollectionItemStart '^\s*\zs-\%(\s\+-\)*\s' nextgroup=yamlBlockMappingKey,yamlBlockMappingMerge " Use the old regexp engine, the NFA engine doesn't like all the \@ items. -execute 'syn match yamlBlockMappingKey /\%#=1^\s*\zs'.s:ns_plain_out.'\ze\s*:\%(\s\|$\)/ '. +execute 'syn match yamlBlockMappingKey /\%#=1^\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ '. \'nextgroup=yamlKeyValueDelimiter' -execute 'syn match yamlBlockMappingKey /\%#=1\s*\zs'.s:ns_plain_out.'\ze\s*:\%(\s\|$\)/ contained '. +execute 'syn match yamlBlockMappingKey /\%#=1\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ contained '. \'nextgroup=yamlKeyValueDelimiter' syn match yamlBlockMappingMerge /^\s*\zs<<\ze:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter contained @@ -119,14 +152,32 @@ syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDeli syn match yamlKeyValueDelimiter /\s*:/ contained syn match yamlKeyValueDelimiter /\s*:/ contained -syn keyword yamlConstant true True TRUE false False FALSE -syn keyword yamlConstant null Null NULL -syn match yamlConstant '\<\~\>' - -syn match yamlTimestamp /\%([\[\]{}, \t]\@!\p\)\@<!\%(\d\{4}-\d\d\=-\d\d\=\%(\%([Tt]\|\s\+\)\%(\d\d\=\):\%(\d\d\):\%(\d\d\)\%(\.\%(\d*\)\)\=\%(\s*\%(Z\|[+-]\d\d\=\%(:\d\d\)\=\)\)\=\)\=\)\%([\[\]{}, \t]\@!\p\)\@!/ +syn cluster yamlScalarWithSpecials contains=yamlPlainScalar,yamlBlockMappingKey,yamlFlowMappingKey + +let s:_bounder = s:SimplifyToAssumeAllPrintable('\%([[\]{}, \t]\@!\p\)') +if b:yaml_schema is# 'json' + syn keyword yamlNull null contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true false + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(0\|-\=[1-9][0-9]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(-\=[1-9][0-9]*\%(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|0\|-\=\.inf\|\.nan\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'core' + syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true True TRUE false False FALSE contained containedin=@yamlScalarWithSpecials + exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%([+-]\=\%(0\%(b[0-1_]\+\|[0-7_]\+\|x[0-9a-fA-F_]\+\)\=\|\%([1-9][0-9_]*\%(:[0-5]\=\d\)\+\)\)\|[1-9][0-9_]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%([+-]\=\%(\%(\d[0-9_]*\)\.[0-9_]*\%([eE][+-]\=\d\+\)\=\|\.[0-9_]\+\%([eE][-+]\=[0-9]\+\)\=\|\d[0-9_]*\%(:[0-5]\=\d\)\+\.[0-9_]*\|\.\%(inf\|Inf\|INF\)\)\|\%(\.\%(nan\|NaN\|NAN\)\)\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'pyyaml' + syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true True TRUE false False FALSE yes Yes YES no No NO on On ON off Off OFF contained containedin=@yamlScalarWithSpecials + exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(\v[-+]?%(\d[0-9_]*)\.[0-9_]*%([eE][-+]\d+)?|\.[0-9_]+%([eE][-+]\d+)?|[-+]?\d[0-9_]*%(\:[0-5]?\d)+\.[0-9_]*|[-+]?\.%(inf|Inf|INF)|\.%(nan|NaN|NAN)\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(\v[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?%(0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+|[-+]?[1-9][0-9_]*%(:[0-5]?\d)+\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlTimestamp /'.s:_bounder.'\@1<!\%(\v\d\d\d\d\-\d\d\-\d\d|\d\d\d\d \-\d\d? \-\d\d?%([Tt]|[ \t]+)\d\d?\:\d\d \:\d\d %(\.\d*)?%([ \t]*%(Z|[-+]\d\d?%(\:\d\d)?))?\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'failsafe' + " Nothing +endif +unlet s:_bounder -syn match yamlInteger /\%([\[\]{}, \t]\@!\p\)\@<!\%([+-]\=\%(0\%(b[0-1_]\+\|[0-7_]\+\|x[0-9a-fA-F_]\+\)\=\|\%([1-9][0-9_]*\%(:[0-5]\=\d\)\+\)\)\|[1-9][0-9_]*\)\%([\[\]{}, \t]\@!\p\)\@!/ -syn match yamlFloat /\%([\[\]{}, \t]\@!\p\)\@<!\%([+-]\=\%(\%(\d[0-9_]*\)\.[0-9_]*\%([eE][+-]\d\+\)\=\|\.[0-9_]\+\%([eE][-+][0-9]\+\)\=\|\d[0-9_]*\%(:[0-5]\=\d\)\+\.[0-9_]*\|\.\%(inf\|Inf\|INF\)\)\|\%(\.\%(nan\|NaN\|NAN\)\)\)\%([\[\]{}, \t]\@!\p\)\@!/ execute 'syn match yamlNodeTag '.string(s:c_ns_tag_property) execute 'syn match yamlAnchor '.string(s:c_ns_anchor_property) @@ -170,6 +221,9 @@ hi def link yamlKeyValueDelimiter Special hi def link yamlConstant Constant +hi def link yamlNull yamlConstant +hi def link yamlBool yamlConstant + hi def link yamlAnchor Type hi def link yamlAlias Type hi def link yamlNodeTag Type @@ -180,8 +234,10 @@ hi def link yamlTimestamp Number let b:current_syntax = "yaml" -unlet s:ns_word_char s:ns_uri_char s:c_verbatim_tag s:c_named_tag_handle s:c_secondary_tag_handle s:c_primary_tag_handle s:c_tag_handle s:ns_tag_char s:c_ns_shorthand_tag s:c_non_specific_tag s:c_ns_tag_property s:c_ns_anchor_char s:c_ns_anchor_name s:c_ns_anchor_property s:c_ns_alias_node s:ns_char s:ns_directive_name s:ns_local_tag_prefix s:ns_global_tag_prefix s:ns_tag_prefix s:c_indicator s:ns_plain_safe_out s:c_flow_indicator s:ns_plain_safe_in s:ns_plain_first_in s:ns_plain_first_out s:ns_plain_char_in s:ns_plain_char_out s:ns_plain_out s:ns_plain_in +unlet s:ns_word_char s:ns_uri_char s:c_verbatim_tag s:c_named_tag_handle s:c_secondary_tag_handle s:c_primary_tag_handle s:c_tag_handle s:ns_tag_char s:c_ns_shorthand_tag s:c_non_specific_tag s:c_ns_tag_property s:c_ns_anchor_char s:c_ns_anchor_name s:c_ns_anchor_property s:c_ns_alias_node s:ns_char s:ns_directive_name s:ns_local_tag_prefix s:ns_global_tag_prefix s:ns_tag_prefix s:c_indicator s:ns_plain_safe_out s:c_flow_indicator s:ns_plain_safe_in s:ns_plain_first_in s:ns_plain_first_out s:ns_plain_char_in s:ns_plain_char_out s:ns_plain_out s:ns_plain_in s:ns_char_without_c_indicator s:ns_plain_safe_in_without_colhash s:ns_plain_safe_out_without_colhash +unlet s:_collection s:_neg_collection +delfunction s:SimplifyAdjacentCollections +delfunction s:SimplifyToAssumeAllPrintable let &cpo = s:cpo_save unlet s:cpo_save - diff --git a/runtime/syntax/z8a.vim b/runtime/syntax/z8a.vim index a3a8a2bbdf..6809eb98cd 100644 --- a/runtime/syntax/z8a.vim +++ b/runtime/syntax/z8a.vim @@ -3,11 +3,8 @@ " Maintainer: Milan Pikula <www@fornax.elf.stuba.sk> " Last Change: 2003 May 11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -85,30 +82,20 @@ syn match z8aComment ";.*" syn case match " 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_z8a_syntax_inits") - if version < 508 - let did_z8a_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink z8aSection Special - HiLink z8aLabel Label - HiLink z8aSpecialLabel Label - HiLink z8aComment Comment - HiLink z8aInstruction Statement - HiLink z8aSpecInst Statement - HiLink z8aInclude Include - HiLink z8aPreCondit PreCondit - HiLink z8aPreProc PreProc - HiLink z8aNumber Number - HiLink z8aString String - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet + +hi def link z8aSection Special +hi def link z8aLabel Label +hi def link z8aSpecialLabel Label +hi def link z8aComment Comment +hi def link z8aInstruction Statement +hi def link z8aSpecInst Statement +hi def link z8aInclude Include +hi def link z8aPreCondit PreCondit +hi def link z8aPreProc PreProc +hi def link z8aNumber Number +hi def link z8aString String + let b:current_syntax = "z8a" " vim: ts=8 diff --git a/runtime/syntax/zimbu.vim b/runtime/syntax/zimbu.vim index c859a2f815..1a7a485e6f 100644 --- a/runtime/syntax/zimbu.vim +++ b/runtime/syntax/zimbu.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Zimbu " Maintainer: Bram Moolenaar -" Last Change: 2012 Jun 01 +" Last Change: 2014 Nov 23 if exists("b:current_syntax") finish @@ -12,7 +12,10 @@ syn include @Ccode syntax/c.vim syn keyword zimbuTodo TODO FIXME XXX contained syn match zimbuNoBar "|" contained syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar -syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,@Spell +syn match zimbuNoBacktick "`" contained +syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick +syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell +syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell syn match zimbuChar "'\\\=.'" @@ -28,27 +31,32 @@ syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6 syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12 syn keyword zimbuBasicType fixed13 fixed14 fixed15 -syn keyword zimbuCompType string stringval cstring varstring -syn keyword zimbuCompType bytes varbytes -syn keyword zimbuCompType tuple array list dict multiDict set multiSet +syn keyword zimbuCompType string varString +syn keyword zimbuCompType byteString varByteString +syn keyword zimbuCompType tuple array list dict dictList set callback +syn keyword zimbuCompType sortedList multiDict multiDictList multiSet syn keyword zimbuCompType complex complex32 complex64 complex80 complex128 syn keyword zimbuCompType proc func def thread evalThread lock cond pipe -syn keyword zimbuType VAR ANY USE GET +syn keyword zimbuType VAR dyn type USE GET syn match zimbuType "IO.File" syn match zimbuType "IO.Stat" -syn keyword zimbuStatement IF ELSE ELSEIF WHILE REPEAT FOR IN TO STEP +syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP syn keyword zimbuStatement DO UNTIL SWITCH WITH syn keyword zimbuStatement TRY CATCH FINALLY syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF +syn keyword zimbuStatement GENERATE_ERROR +syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL -syn keyword zimbuStatement PART ALIAS CONNECT WRAP +syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP syn keyword zimbuStatement BREAK CONTINUE PROCEED -syn keyword zimbuStatement RETURN EXIT THROW +syn keyword zimbuStatement RETURN EXIT THROW DEFER syn keyword zimbuStatement IMPORT AS OPTIONS MAIN -syn keyword zimbuStatement INTERFACE MODULE ENUM BITS SHARED +syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS +syn keyword zimbuStatement SHARED STATIC +syn keyword zimbuStatement LAMBDA syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>" syn match zimbuStatement "\<CLASS\>" syn match zimbuStatement "}" @@ -61,10 +69,13 @@ syn match zimbuAttribute "@default\>" syn match zimbuAttribute "@define\>" syn match zimbuAttribute "@replace\>" syn match zimbuAttribute "@final\>" +syn match zimbuAttribute "@primitive\>" +syn match zimbuAttribute "@notOnExit\>" syn match zimbuAttribute "@private\>" syn match zimbuAttribute "@protected\>" syn match zimbuAttribute "@public\>" +syn match zimbuAttribute "@local\>" syn match zimbuAttribute "@file\>" syn match zimbuAttribute "@directory\>" syn match zimbuAttribute "@read=private\>" @@ -78,15 +89,22 @@ syn match zimbuAttribute "@items=public\>" syn match zimbuAttribute "@items=file\>" syn match zimbuAttribute "@items=directory\>" -syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET +syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT syn keyword zimbuOperator IS ISNOT ISA ISNOTA -syn keyword zimbuModule ARG CHECK E IO PROTO SYS HTTP ZC ZWT TIME THREAD +syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD -syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ +syn match zimbuImport "\.\zsPROTO" +syn match zimbuImport "\.\zsCHEADER" + +"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr +syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+ -syn region zimbuString start=+'''+ end=+'''+ +syn region zimbuLongString start=+''"+ end=+"''+ +syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter +syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair +syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK syn keyword zimbuError NULL @@ -97,12 +115,18 @@ syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1 syn match zimbuSpaceError display " \+\t" syn match zimbuSpaceError display "\t\+ " -syn match zimbuUses contained "uses([a-zA-Z_ ,]*)" +syn match zimbuUses contained "\<uses([a-zA-Z_ ,]*)" +syn match zimbuBlockgc contained "blockgc" syn match zimbuBlockComment contained " #.*" -syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockComment keepend +syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockgc,zimbuBlockComment keepend + +" Assume long strings and C regions don't take more than 200 lines. +syn sync minlines=200 -syn sync minlines=2000 +" When we find the start of a long string, without a # or " before it, we are +" sure to be inside a long string. +syn sync match zimbuLongStringSync grouphere zimbuLongString +^[^"#]*''\"+ hi def link zimbuBasicType Type hi def link zimbuCompType Type @@ -111,17 +135,23 @@ hi def link zimbuStatement Statement hi def link zimbuOperator Statement hi def link zimbuMethod PreProc hi def link zimbuModule PreProc +hi def link zimbuImport PreProc hi def link zimbuUses PreProc +hi def link zimbuBlockgc PreProc hi def link zimbuAttribute PreProc hi def link zimbuString Constant +hi def link zimbuLongString Special hi def link zimbuChar Constant hi def link zimbuFixed Constant hi def link zimbuComment Comment +hi def link zimbuCommentStart zimbuComment hi def link zimbuBlockComment Comment hi def link zimbuCblock Comment hi def link zimbuTodo Todo hi def link zimbuParam Constant +hi def link zimbuCode Statement hi def link zimbuNoBar Ignore +hi def link zimbuNoBacktick Ignore hi def link zimbuSpaceError Error hi def link zimbuError Error diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim index 79fd017ee8..3eba438aa7 100644 --- a/runtime/syntax/zsh.vim +++ b/runtime/syntax/zsh.vim @@ -1,7 +1,10 @@ " Vim syntax file -" Language: Zsh shell script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-23 +" Language: Zsh shell script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2018-05-12 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:current_syntax") finish @@ -10,19 +13,29 @@ endif let s:cpo_save = &cpo set cpo&vim -setlocal iskeyword+=- +if v:version > 704 || (v:version == 704 && has("patch1142")) + syn iskeyword @,48-57,_,192-255,#,- +else + setlocal iskeyword+=- +endif +if get(g:, 'zsh_fold_enable', 0) + setlocal foldmethod=syntax +endif syn keyword zshTodo contained TODO FIXME XXX NOTE -syn region zshComment oneline start='\%(^\|\s\)#' end='$' - \ contains=zshTodo,@Spell +syn region zshComment oneline start='\%(^\|\s\+\)#' end='$' + \ contains=zshTodo,@Spell fold + +syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!' + \ contains=zshTodo,@Spell fold syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$' syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ - \ contains=zshQuoted,@zshDerefs,@zshSubst -syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ + \ contains=zshQuoted,@zshDerefs,@zshSubst fold +syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ \ end=+'+ contains=zshQuoted @@ -30,7 +43,7 @@ syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' syn keyword zshPrecommand noglob nocorrect exec command builtin - time -syn keyword zshDelimiter do done +syn keyword zshDelimiter do done end syn keyword zshConditional if then elif else fi case in esac select @@ -42,7 +55,7 @@ syn keyword zshException always syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite -syn match zshKSHFunction contained '\k\+' +syn match zshKSHFunction contained '\w\S\+' syn match zshFunction '^\s*\k\+\ze\s*()' syn match zshOperator '||\|&&\|;\|&!\=' @@ -54,17 +67,17 @@ syn match zshRedir '|&\=' syn region zshHereDoc matchgroup=zshRedir \ start='<\@<!<<\s*\z([^<]\S*\)' \ end='^\z1\>' - \ contains=@zshSubst + \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString syn region zshHereDoc matchgroup=zshRedir \ start='<\@<!<<\s*\\\z(\S\+\)' \ end='^\z1\>' - \ contains=@zshSubst + \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString syn region zshHereDoc matchgroup=zshRedir \ start='<\@<!<<-\s*\\\=\z(\S\+\)' \ end='^\s*\z1\>' - \ contains=@zshSubst + \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString syn region zshHereDoc matchgroup=zshRedir - \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+ + \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+ \ end='^\z1\>' syn region zshHereDoc matchgroup=zshRedir \ start=+<\@<!<<-\s*\(["']\)\z(\S\+\)\1+ @@ -75,33 +88,20 @@ syn match zshVariable '\<\h\w*' contained syn match zshVariableDef '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariableDef oneline - \ start='\$\@<!\<\h\w*\[' end='\]\ze+\==' + \ start='\$\@<!\<\h\w*\[' end='\]\ze+\?=\?' \ contains=@zshSubst -syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref +syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref,zshDollarVar -if !exists("g:zsh_syntax_variables") - let s:zsh_syntax_variables = 'all' -else - let s:zsh_syntax_variables = g:zsh_syntax_variables -endif +syn match zshShortDeref '\$[!#$*@?_-]\w\@!' +syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' -if s:zsh_syntax_variables =~ 'short\|all' - syn match zshShortDeref '\$[!#$*@?_-]\w\@!' - syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' -endif +syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' +syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' +syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' -if s:zsh_syntax_variables =~ 'long\|all' - syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' - syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' - syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' -endif - -if s:zsh_syntax_variables =~ 'all' - syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' -else - syn match zshDeref transparent contains=NONE '\$[=^~]*[#+]*\h\w*\>' -endif +syn match zshDollarVar '\$\h\w*' +syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' syn match zshCommands '\%(^\|\s\)[.:]\ze\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd @@ -113,15 +113,220 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd \ functions getcap getln getopts hash history \ jobs kill let limit log logout popd print \ printf pushd pushln pwd r read readonly - \ rehash return sched set setcap setopt shift + \ rehash return sched set setcap shift \ source stat suspend test times trap true \ ttyctl type ulimit umask unalias unfunction - \ unhash unlimit unset unsetopt vared wait + \ unhash unlimit unset vared wait \ whence where which zcompile zformat zftp zle - \ zmodload zparseopts zprof zpty zregexparse - \ zsocket zstyle ztcp - -syn keyword zshTypes float integer local typeset declare + \ zmodload zparseopts zprof zpty zrecompile + \ zregexparse zsocket zstyle ztcp + +" Options, generated by: echo ${(j:\n:)options[(I)*]} | sort +" Create a list of option names from zsh source dir: +" #!/bin/zsh +" topdir=/path/to/zsh-xxx +" grep '^pindex([A-Za-z_]*)$' $topdir/Src/Doc/Zsh/optionsyo | +" while read opt +" do +" echo ${${(L)opt#pindex\(}%\)} +" done + +syn case ignore + +syn match zshOptStart /^\s*\%(\%(\%(un\)\?setopt\)\|set\s+[-+]o\)/ nextgroup=zshOption skipwhite +syn match zshOption / + \ \%(\%(\<no_\?\)\?aliases\>\)\| + \ \%(\%(\<no_\?\)\?allexport\>\)\|\%(\%(no_\?\)\?all_export\>\)\| + \ \%(\%(\<no_\?\)\?alwayslastprompt\>\)\|\%(\%(no_\?\)\?always_last_prompt\>\)\|\%(\%(no_\?\)\?always_lastprompt\>\)\| + \ \%(\%(\<no_\?\)\?alwaystoend\>\)\|\%(\%(no_\?\)\?always_to_end\>\)\| + \ \%(\%(\<no_\?\)\?appendcreate\>\)\|\%(\%(no_\?\)\?append_create\>\)\| + \ \%(\%(\<no_\?\)\?appendhistory\>\)\|\%(\%(no_\?\)\?append_history\>\)\| + \ \%(\%(\<no_\?\)\?autocd\>\)\|\%(\%(no_\?\)\?auto_cd\>\)\| + \ \%(\%(\<no_\?\)\?autocontinue\>\)\|\%(\%(no_\?\)\?auto_continue\>\)\| + \ \%(\%(\<no_\?\)\?autolist\>\)\|\%(\%(no_\?\)\?auto_list\>\)\| + \ \%(\%(\<no_\?\)\?automenu\>\)\|\%(\%(no_\?\)\?auto_menu\>\)\| + \ \%(\%(\<no_\?\)\?autonamedirs\>\)\|\%(\%(no_\?\)\?auto_name_dirs\>\)\| + \ \%(\%(\<no_\?\)\?autoparamkeys\>\)\|\%(\%(no_\?\)\?auto_param_keys\>\)\| + \ \%(\%(\<no_\?\)\?autoparamslash\>\)\|\%(\%(no_\?\)\?auto_param_slash\>\)\| + \ \%(\%(\<no_\?\)\?autopushd\>\)\|\%(\%(no_\?\)\?auto_pushd\>\)\| + \ \%(\%(\<no_\?\)\?autoremoveslash\>\)\|\%(\%(no_\?\)\?auto_remove_slash\>\)\| + \ \%(\%(\<no_\?\)\?autoresume\>\)\|\%(\%(no_\?\)\?auto_resume\>\)\| + \ \%(\%(\<no_\?\)\?badpattern\>\)\|\%(\%(no_\?\)\?bad_pattern\>\)\| + \ \%(\%(\<no_\?\)\?banghist\>\)\|\%(\%(no_\?\)\?bang_hist\>\)\| + \ \%(\%(\<no_\?\)\?bareglobqual\>\)\|\%(\%(no_\?\)\?bare_glob_qual\>\)\| + \ \%(\%(\<no_\?\)\?bashautolist\>\)\|\%(\%(no_\?\)\?bash_auto_list\>\)\| + \ \%(\%(\<no_\?\)\?bashrematch\>\)\|\%(\%(no_\?\)\?bash_rematch\>\)\| + \ \%(\%(\<no_\?\)\?beep\>\)\| + \ \%(\%(\<no_\?\)\?bgnice\>\)\|\%(\%(no_\?\)\?bg_nice\>\)\| + \ \%(\%(\<no_\?\)\?braceccl\>\)\|\%(\%(no_\?\)\?brace_ccl\>\)\| + \ \%(\%(\<no_\?\)\?braceexpand\>\)\|\%(\%(no_\?\)\?brace_expand\>\)\| + \ \%(\%(\<no_\?\)\?bsdecho\>\)\|\%(\%(no_\?\)\?bsd_echo\>\)\| + \ \%(\%(\<no_\?\)\?caseglob\>\)\|\%(\%(no_\?\)\?case_glob\>\)\| + \ \%(\%(\<no_\?\)\?casematch\>\)\|\%(\%(no_\?\)\?case_match\>\)\| + \ \%(\%(\<no_\?\)\?cbases\>\)\|\%(\%(no_\?\)\?c_bases\>\)\| + \ \%(\%(\<no_\?\)\?cdablevars\>\)\|\%(\%(no_\?\)\?cdable_vars\>\)\|\%(\%(no_\?\)\?cd_able_vars\>\)\| + \ \%(\%(\<no_\?\)\?chasedots\>\)\|\%(\%(no_\?\)\?chase_dots\>\)\| + \ \%(\%(\<no_\?\)\?chaselinks\>\)\|\%(\%(no_\?\)\?chase_links\>\)\| + \ \%(\%(\<no_\?\)\?checkjobs\>\)\|\%(\%(no_\?\)\?check_jobs\>\)\| + \ \%(\%(\<no_\?\)\?clobber\>\)\| + \ \%(\%(\<no_\?\)\?combiningchars\>\)\|\%(\%(no_\?\)\?combining_chars\>\)\| + \ \%(\%(\<no_\?\)\?completealiases\>\)\|\%(\%(no_\?\)\?complete_aliases\>\)\| + \ \%(\%(\<no_\?\)\?completeinword\>\)\|\%(\%(no_\?\)\?complete_in_word\>\)\| + \ \%(\%(\<no_\?\)\?continueonerror\>\)\|\%(\%(no_\?\)\?continue_on_error\>\)\| + \ \%(\%(\<no_\?\)\?correct\>\)\| + \ \%(\%(\<no_\?\)\?correctall\>\)\|\%(\%(no_\?\)\?correct_all\>\)\| + \ \%(\%(\<no_\?\)\?cprecedences\>\)\|\%(\%(no_\?\)\?c_precedences\>\)\| + \ \%(\%(\<no_\?\)\?cshjunkiehistory\>\)\|\%(\%(no_\?\)\?csh_junkie_history\>\)\| + \ \%(\%(\<no_\?\)\?cshjunkieloops\>\)\|\%(\%(no_\?\)\?csh_junkie_loops\>\)\| + \ \%(\%(\<no_\?\)\?cshjunkiequotes\>\)\|\%(\%(no_\?\)\?csh_junkie_quotes\>\)\| + \ \%(\%(\<no_\?\)\?csh_nullcmd\>\)\|\%(\%(no_\?\)\?csh_null_cmd\>\)\|\%(\%(no_\?\)\?cshnullcmd\>\)\|\%(\%(no_\?\)\?csh_null_cmd\>\)\| + \ \%(\%(\<no_\?\)\?cshnullglob\>\)\|\%(\%(no_\?\)\?csh_null_glob\>\)\| + \ \%(\%(\<no_\?\)\?debugbeforecmd\>\)\|\%(\%(no_\?\)\?debug_before_cmd\>\)\| + \ \%(\%(\<no_\?\)\?dotglob\>\)\|\%(\%(no_\?\)\?dot_glob\>\)\| + \ \%(\%(\<no_\?\)\?dvorak\>\)\| + \ \%(\%(\<no_\?\)\?emacs\>\)\| + \ \%(\%(\<no_\?\)\?equals\>\)\| + \ \%(\%(\<no_\?\)\?errexit\>\)\|\%(\%(no_\?\)\?err_exit\>\)\| + \ \%(\%(\<no_\?\)\?errreturn\>\)\|\%(\%(no_\?\)\?err_return\>\)\| + \ \%(\%(\<no_\?\)\?evallineno_\?\)\|\%(\%(no_\?\)\?eval_lineno_\?\)\| + \ \%(\%(\<no_\?\)\?exec\>\)\| + \ \%(\%(\<no_\?\)\?extendedglob\>\)\|\%(\%(no_\?\)\?extended_glob\>\)\| + \ \%(\%(\<no_\?\)\?extendedhistory\>\)\|\%(\%(no_\?\)\?extended_history\>\)\| + \ \%(\%(\<no_\?\)\?flowcontrol\>\)\|\%(\%(no_\?\)\?flow_control\>\)\| + \ \%(\%(\<no_\?\)\?forcefloat\>\)\|\%(\%(no_\?\)\?force_float\>\)\| + \ \%(\%(\<no_\?\)\?functionargzero\>\)\|\%(\%(no_\?\)\?function_argzero\>\)\|\%(\%(no_\?\)\?function_arg_zero\>\)\| + \ \%(\%(\<no_\?\)\?glob\>\)\| + \ \%(\%(\<no_\?\)\?globalexport\>\)\|\%(\%(no_\?\)\?global_export\>\)\| + \ \%(\%(\<no_\?\)\?globalrcs\>\)\|\%(\%(no_\?\)\?global_rcs\>\)\| + \ \%(\%(\<no_\?\)\?globassign\>\)\|\%(\%(no_\?\)\?glob_assign\>\)\| + \ \%(\%(\<no_\?\)\?globcomplete\>\)\|\%(\%(no_\?\)\?glob_complete\>\)\| + \ \%(\%(\<no_\?\)\?globdots\>\)\|\%(\%(no_\?\)\?glob_dots\>\)\| + \ \%(\%(\<no_\?\)\?glob_subst\>\)\|\%(\%(no_\?\)\?globsubst\>\)\| + \ \%(\%(\<no_\?\)\?globstarshort\>\)\|\%(\%(no_\?\)\?glob_star_short\>\)\| + \ \%(\%(\<no_\?\)\?hashall\>\)\|\%(\%(no_\?\)\?hash_all\>\)\| + \ \%(\%(\<no_\?\)\?hashcmds\>\)\|\%(\%(no_\?\)\?hash_cmds\>\)\| + \ \%(\%(\<no_\?\)\?hashdirs\>\)\|\%(\%(no_\?\)\?hash_dirs\>\)\| + \ \%(\%(\<no_\?\)\?hashexecutablesonly\>\)\|\%(\%(no_\?\)\?hash_executables_only\>\)\| + \ \%(\%(\<no_\?\)\?hashlistall\>\)\|\%(\%(no_\?\)\?hash_list_all\>\)\| + \ \%(\%(\<no_\?\)\?histallowclobber\>\)\|\%(\%(no_\?\)\?hist_allow_clobber\>\)\| + \ \%(\%(\<no_\?\)\?histappend\>\)\|\%(\%(no_\?\)\?hist_append\>\)\| + \ \%(\%(\<no_\?\)\?histbeep\>\)\|\%(\%(no_\?\)\?hist_beep\>\)\| + \ \%(\%(\<no_\?\)\?hist_expand\>\)\|\%(\%(no_\?\)\?histexpand\>\)\| + \ \%(\%(\<no_\?\)\?hist_expire_dups_first\>\)\|\%(\%(no_\?\)\?histexpiredupsfirst\>\)\| + \ \%(\%(\<no_\?\)\?histfcntllock\>\)\|\%(\%(no_\?\)\?hist_fcntl_lock\>\)\| + \ \%(\%(\<no_\?\)\?histfindnodups\>\)\|\%(\%(no_\?\)\?hist_find_no_dups\>\)\| + \ \%(\%(\<no_\?\)\?histignorealldups\>\)\|\%(\%(no_\?\)\?hist_ignore_all_dups\>\)\| + \ \%(\%(\<no_\?\)\?histignoredups\>\)\|\%(\%(no_\?\)\?hist_ignore_dups\>\)\| + \ \%(\%(\<no_\?\)\?histignorespace\>\)\|\%(\%(no_\?\)\?hist_ignore_space\>\)\| + \ \%(\%(\<no_\?\)\?histlexwords\>\)\|\%(\%(no_\?\)\?hist_lex_words\>\)\| + \ \%(\%(\<no_\?\)\?histnofunctions\>\)\|\%(\%(no_\?\)\?hist_no_functions\>\)\| + \ \%(\%(\<no_\?\)\?histnostore\>\)\|\%(\%(no_\?\)\?hist_no_store\>\)\| + \ \%(\%(\<no_\?\)\?histreduceblanks\>\)\|\%(\%(no_\?\)\?hist_reduce_blanks\>\)\| + \ \%(\%(\<no_\?\)\?histsavebycopy\>\)\|\%(\%(no_\?\)\?hist_save_by_copy\>\)\| + \ \%(\%(\<no_\?\)\?histsavenodups\>\)\|\%(\%(no_\?\)\?hist_save_no_dups\>\)\| + \ \%(\%(\<no_\?\)\?histsubstpattern\>\)\|\%(\%(no_\?\)\?hist_subst_pattern\>\)\| + \ \%(\%(\<no_\?\)\?histverify\>\)\|\%(\%(no_\?\)\?hist_verify\>\)\| + \ \%(\%(\<no_\?\)\?hup\>\)\| + \ \%(\%(\<no_\?\)\?ignorebraces\>\)\|\%(\%(no_\?\)\?ignore_braces\>\)\| + \ \%(\%(\<no_\?\)\?ignoreclosebraces\>\)\|\%(\%(no_\?\)\?ignore_close_braces\>\)\| + \ \%(\%(\<no_\?\)\?ignoreeof\>\)\|\%(\%(no_\?\)\?ignore_eof\>\)\| + \ \%(\%(\<no_\?\)\?incappendhistory\>\)\|\%(\%(no_\?\)\?inc_append_history\>\)\| + \ \%(\%(\<no_\?\)\?incappendhistorytime\>\)\|\%(\%(no_\?\)\?inc_append_history_time\>\)\| + \ \%(\%(\<no_\?\)\?interactive\>\)\| + \ \%(\%(\<no_\?\)\?interactivecomments\>\)\|\%(\%(no_\?\)\?interactive_comments\>\)\| + \ \%(\%(\<no_\?\)\?ksharrays\>\)\|\%(\%(no_\?\)\?ksh_arrays\>\)\| + \ \%(\%(\<no_\?\)\?kshautoload\>\)\|\%(\%(no_\?\)\?ksh_autoload\>\)\| + \ \%(\%(\<no_\?\)\?kshglob\>\)\|\%(\%(no_\?\)\?ksh_glob\>\)\| + \ \%(\%(\<no_\?\)\?kshoptionprint\>\)\|\%(\%(no_\?\)\?ksh_option_print\>\)\| + \ \%(\%(\<no_\?\)\?kshtypeset\>\)\|\%(\%(no_\?\)\?ksh_typeset\>\)\| + \ \%(\%(\<no_\?\)\?kshzerosubscript\>\)\|\%(\%(no_\?\)\?ksh_zero_subscript\>\)\| + \ \%(\%(\<no_\?\)\?listambiguous\>\)\|\%(\%(no_\?\)\?list_ambiguous\>\)\| + \ \%(\%(\<no_\?\)\?listbeep\>\)\|\%(\%(no_\?\)\?list_beep\>\)\| + \ \%(\%(\<no_\?\)\?listpacked\>\)\|\%(\%(no_\?\)\?list_packed\>\)\| + \ \%(\%(\<no_\?\)\?listrowsfirst\>\)\|\%(\%(no_\?\)\?list_rows_first\>\)\| + \ \%(\%(\<no_\?\)\?listtypes\>\)\|\%(\%(no_\?\)\?list_types\>\)\| + \ \%(\%(\<no_\?\)\?localloops\>\)\|\%(\%(no_\?\)\?local_loops\>\)\| + \ \%(\%(\<no_\?\)\?localoptions\>\)\|\%(\%(no_\?\)\?local_options\>\)\| + \ \%(\%(\<no_\?\)\?localpatterns\>\)\|\%(\%(no_\?\)\?local_patterns\>\)\| + \ \%(\%(\<no_\?\)\?localtraps\>\)\|\%(\%(no_\?\)\?local_traps\>\)\| + \ \%(\%(\<no_\?\)\?log\>\)\| + \ \%(\%(\<no_\?\)\?login\>\)\| + \ \%(\%(\<no_\?\)\?longlistjobs\>\)\|\%(\%(no_\?\)\?long_list_jobs\>\)\| + \ \%(\%(\<no_\?\)\?magicequalsubst\>\)\|\%(\%(no_\?\)\?magic_equal_subst\>\)\| + \ \%(\%(\<no_\?\)\?mark_dirs\>\)\| + \ \%(\%(\<no_\?\)\?mailwarn\>\)\|\%(\%(no_\?\)\?mail_warn\>\)\| + \ \%(\%(\<no_\?\)\?mailwarning\>\)\|\%(\%(no_\?\)\?mail_warning\>\)\| + \ \%(\%(\<no_\?\)\?markdirs\>\)\| + \ \%(\%(\<no_\?\)\?menucomplete\>\)\|\%(\%(no_\?\)\?menu_complete\>\)\| + \ \%(\%(\<no_\?\)\?monitor\>\)\| + \ \%(\%(\<no_\?\)\?multibyte\>\)\|\%(\%(no_\?\)\?multi_byte\>\)\| + \ \%(\%(\<no_\?\)\?multifuncdef\>\)\|\%(\%(no_\?\)\?multi_func_def\>\)\| + \ \%(\%(\<no_\?\)\?multios\>\)\|\%(\%(no_\?\)\?multi_os\>\)\| + \ \%(\%(\<no_\?\)\?nomatch\>\)\|\%(\%(no_\?\)\?no_match\>\)\| + \ \%(\%(\<no_\?\)\?notify\>\)\| + \ \%(\%(\<no_\?\)\?nullglob\>\)\|\%(\%(no_\?\)\?null_glob\>\)\| + \ \%(\%(\<no_\?\)\?numericglobsort\>\)\|\%(\%(no_\?\)\?numeric_glob_sort\>\)\| + \ \%(\%(\<no_\?\)\?octalzeroes\>\)\|\%(\%(no_\?\)\?octal_zeroes\>\)\| + \ \%(\%(\<no_\?\)\?onecmd\>\)\|\%(\%(no_\?\)\?one_cmd\>\)\| + \ \%(\%(\<no_\?\)\?overstrike\>\)\|\%(\%(no_\?\)\?over_strike\>\)\| + \ \%(\%(\<no_\?\)\?pathdirs\>\)\|\%(\%(no_\?\)\?path_dirs\>\)\| + \ \%(\%(\<no_\?\)\?pathscript\>\)\|\%(\%(no_\?\)\?path_script\>\)\| + \ \%(\%(\<no_\?\)\?physical\>\)\| + \ \%(\%(\<no_\?\)\?pipefail\>\)\|\%(\%(no_\?\)\?pipe_fail\>\)\| + \ \%(\%(\<no_\?\)\?posixaliases\>\)\|\%(\%(no_\?\)\?posix_aliases\>\)\| + \ \%(\%(\<no_\?\)\?posixargzero\>\)\|\%(\%(no_\?\)\?posix_arg_zero\>\)\|\%(\%(no_\?\)\?posix_argzero\>\)\| + \ \%(\%(\<no_\?\)\?posixbuiltins\>\)\|\%(\%(no_\?\)\?posix_builtins\>\)\| + \ \%(\%(\<no_\?\)\?posixcd\>\)\|\%(\%(no_\?\)\?posix_cd\>\)\| + \ \%(\%(\<no_\?\)\?posixidentifiers\>\)\|\%(\%(no_\?\)\?posix_identifiers\>\)\| + \ \%(\%(\<no_\?\)\?posixjobs\>\)\|\%(\%(no_\?\)\?posix_jobs\>\)\| + \ \%(\%(\<no_\?\)\?posixstrings\>\)\|\%(\%(no_\?\)\?posix_strings\>\)\| + \ \%(\%(\<no_\?\)\?posixtraps\>\)\|\%(\%(no_\?\)\?posix_traps\>\)\| + \ \%(\%(\<no_\?\)\?printeightbit\>\)\|\%(\%(no_\?\)\?print_eight_bit\>\)\| + \ \%(\%(\<no_\?\)\?printexitvalue\>\)\|\%(\%(no_\?\)\?print_exit_value\>\)\| + \ \%(\%(\<no_\?\)\?privileged\>\)\| + \ \%(\%(\<no_\?\)\?promptbang\>\)\|\%(\%(no_\?\)\?prompt_bang\>\)\| + \ \%(\%(\<no_\?\)\?promptcr\>\)\|\%(\%(no_\?\)\?prompt_cr\>\)\| + \ \%(\%(\<no_\?\)\?promptpercent\>\)\|\%(\%(no_\?\)\?prompt_percent\>\)\| + \ \%(\%(\<no_\?\)\?promptsp\>\)\|\%(\%(no_\?\)\?prompt_sp\>\)\| + \ \%(\%(\<no_\?\)\?promptsubst\>\)\|\%(\%(no_\?\)\?prompt_subst\>\)\| + \ \%(\%(\<no_\?\)\?promptvars\>\)\|\%(\%(no_\?\)\?prompt_vars\>\)\| + \ \%(\%(\<no_\?\)\?pushdignoredups\>\)\|\%(\%(no_\?\)\?pushd_ignore_dups\>\)\| + \ \%(\%(\<no_\?\)\?pushdminus\>\)\|\%(\%(no_\?\)\?pushd_minus\>\)\| + \ \%(\%(\<no_\?\)\?pushdsilent\>\)\|\%(\%(no_\?\)\?pushd_silent\>\)\| + \ \%(\%(\<no_\?\)\?pushdtohome\>\)\|\%(\%(no_\?\)\?pushd_to_home\>\)\| + \ \%(\%(\<no_\?\)\?rcexpandparam\>\)\|\%(\%(no_\?\)\?rc_expandparam\>\)\|\%(\%(no_\?\)\?rc_expand_param\>\)\| + \ \%(\%(\<no_\?\)\?rcquotes\>\)\|\%(\%(no_\?\)\?rc_quotes\>\)\| + \ \%(\%(\<no_\?\)\?rcs\>\)\| + \ \%(\%(\<no_\?\)\?recexact\>\)\|\%(\%(no_\?\)\?rec_exact\>\)\| + \ \%(\%(\<no_\?\)\?rematchpcre\>\)\|\%(\%(no_\?\)\?re_match_pcre\>\)\|\%(\%(no_\?\)\?rematch_pcre\>\)\| + \ \%(\%(\<no_\?\)\?restricted\>\)\| + \ \%(\%(\<no_\?\)\?rmstarsilent\>\)\|\%(\%(no_\?\)\?rm_star_silent\>\)\| + \ \%(\%(\<no_\?\)\?rmstarwait\>\)\|\%(\%(no_\?\)\?rm_star_wait\>\)\| + \ \%(\%(\<no_\?\)\?sharehistory\>\)\|\%(\%(no_\?\)\?share_history\>\)\| + \ \%(\%(\<no_\?\)\?shfileexpansion\>\)\|\%(\%(no_\?\)\?sh_file_expansion\>\)\| + \ \%(\%(\<no_\?\)\?shglob\>\)\|\%(\%(no_\?\)\?sh_glob\>\)\| + \ \%(\%(\<no_\?\)\?shinstdin\>\)\|\%(\%(no_\?\)\?shin_stdin\>\)\| + \ \%(\%(\<no_\?\)\?shnullcmd\>\)\|\%(\%(no_\?\)\?sh_nullcmd\>\)\| + \ \%(\%(\<no_\?\)\?shoptionletters\>\)\|\%(\%(no_\?\)\?sh_option_letters\>\)\| + \ \%(\%(\<no_\?\)\?shortloops\>\)\|\%(\%(no_\?\)\?short_loops\>\)\| + \ \%(\%(\<no_\?\)\?shwordsplit\>\)\|\%(\%(no_\?\)\?sh_word_split\>\)\| + \ \%(\%(\<no_\?\)\?singlecommand\>\)\|\%(\%(no_\?\)\?single_command\>\)\| + \ \%(\%(\<no_\?\)\?singlelinezle\>\)\|\%(\%(no_\?\)\?single_line_zle\>\)\| + \ \%(\%(\<no_\?\)\?sourcetrace\>\)\|\%(\%(no_\?\)\?source_trace\>\)\| + \ \%(\%(\<no_\?\)\?stdin\>\)\| + \ \%(\%(\<no_\?\)\?sunkeyboardhack\>\)\|\%(\%(no_\?\)\?sun_keyboard_hack\>\)\| + \ \%(\%(\<no_\?\)\?trackall\>\)\|\%(\%(no_\?\)\?track_all\>\)\| + \ \%(\%(\<no_\?\)\?transientrprompt\>\)\|\%(\%(no_\?\)\?transient_rprompt\>\)\| + \ \%(\%(\<no_\?\)\?trapsasync\>\)\|\%(\%(no_\?\)\?traps_async\>\)\| + \ \%(\%(\<no_\?\)\?typesetsilent\>\)\|\%(\%(no_\?\)\?type_set_silent\>\)\|\%(\%(no_\?\)\?typeset_silent\>\)\| + \ \%(\%(\<no_\?\)\?unset\>\)\| + \ \%(\%(\<no_\?\)\?verbose\>\)\| + \ \%(\%(\<no_\?\)\?vi\>\)\| + \ \%(\%(\<no_\?\)\?warncreateglobal\>\)\|\%(\%(no_\?\)\?warn_create_global\>\)\| + \ \%(\%(\<no_\?\)\?xtrace\>\)\| + \ \%(\%(\<no_\?\)\?zle\>\)/ nextgroup=zshOption,zshComment skipwhite contained + +syn keyword zshTypes float integer local typeset declare private readonly " XXX: this may be too much " syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' @@ -135,21 +340,23 @@ syn match zshNumber '[+-]\=\d\+\.\d\+\>' " TODO: $[...] is the same as $((...)), so add that as well. syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst syn region zshSubst matchgroup=zshSubstDelim transparent - \ start='\$(' skip='\\)' end=')' contains=TOP -syn region zshParentheses transparent start='(' skip='\\)' end=')' + \ start='\$(' skip='\\)' end=')' contains=TOP fold +syn region zshParentheses transparent start='(' skip='\\)' end=')' fold +syn region zshGlob start='(#' end=')' syn region zshMathSubst matchgroup=zshSubstDelim transparent - \ start='\$((' skip='\\)' - \ matchgroup=zshSubstDelim end='))' + \ start='\$((' skip='\\)' end='))' \ contains=zshParentheses,@zshSubst,zshNumber, - \ @zshDerefs,zshString + \ @zshDerefs,zshString keepend fold syn region zshBrackets contained transparent start='{' skip='\\}' - \ end='}' + \ end='}' fold +syn region zshBrackets transparent start='{' skip='\\}' + \ end='}' contains=TOP fold syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' - \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString + \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+ - \ end=+`+ contains=TOP,zshOldSubst + \ end=+`+ contains=TOP,zshOldSubst fold -syn sync minlines=50 +syn sync minlines=50 maxlines=90 syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)' syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>' @@ -170,35 +377,18 @@ hi def link zshKeyword Keyword hi def link zshFunction None hi def link zshKSHFunction zshFunction hi def link zshHereDoc String -if 0 - hi def link zshOperator Operator -else - hi def link zshOperator None -endif -if 1 - hi def link zshRedir Operator -else - hi def link zshRedir None -endif +hi def link zshOperator None +hi def link zshRedir Operator hi def link zshVariable None hi def link zshVariableDef zshVariable hi def link zshDereferencing PreProc -if s:zsh_syntax_variables =~ 'short\|all' - hi def link zshShortDeref zshDereferencing -else - hi def link zshShortDeref None -endif -if s:zsh_syntax_variables =~ 'long\|all' - hi def link zshLongDeref zshDereferencing -else - hi def link zshLongDeref None -endif -if s:zsh_syntax_variables =~ 'all' - hi def link zshDeref zshDereferencing -else - hi def link zshDeref None -endif +hi def link zshShortDeref zshDereferencing +hi def link zshLongDeref zshDereferencing +hi def link zshDeref zshDereferencing +hi def link zshDollarVar zshDereferencing hi def link zshCommands Keyword +hi def link zshOptStart Keyword +hi def link zshOption Constant hi def link zshTypes Type hi def link zshSwitches Special hi def link zshNumber Number @@ -206,6 +396,7 @@ hi def link zshSubst PreProc hi def link zshMathSubst zshSubst hi def link zshOldSubst zshSubst hi def link zshSubstDelim zshSubst +hi def link zshGlob zshSubst let b:current_syntax = "zsh" diff --git a/runtime/tools/blink.c b/runtime/tools/blink.c index 1ffd848edc..a782061fdd 100644 --- a/runtime/tools/blink.c +++ b/runtime/tools/blink.c @@ -6,8 +6,10 @@ */ #include <stdio.h> +#include <unistd.h> -main() + int +main(void) { while (1) { @@ -18,4 +20,5 @@ main() fflush(stdout); usleep(250000); /* off time */ } + return 0; } diff --git a/runtime/tools/ccfilter.c b/runtime/tools/ccfilter.c index 270333910f..8539e2a3dc 100644 --- a/runtime/tools/ccfilter.c +++ b/runtime/tools/ccfilter.c @@ -85,7 +85,8 @@ const char USAGE[] = int ShowUsage( char *szError ) -{ int i; +{ + int i; fprintf( stderr, USAGE ); @@ -101,7 +102,8 @@ int ShowUsage( char *szError ) return 0; } -char *echogets(char *s, int echo) { +char *echogets(char *s, int echo) +{ char * const retval=fgets(s, LINELENGTH, stdin); if (echo!=0 && retval!=NULL) { fputs(retval, stderr); @@ -307,7 +309,7 @@ int main( int argc, char *argv[] ) ok = sscanf( p, "make[%*d]: Entering directory `%[^']", BasePath ); if (verbose) - printf( "[%u]?%s\n", ok, Line ); + printf( "[%u]?%s\n", (unsigned)ok, Line ); } else { diff --git a/runtime/tools/ccfilter_README.txt b/runtime/tools/ccfilter_README.txt index 3c12a8c89b..ea989f2574 100644 --- a/runtime/tools/ccfilter_README.txt +++ b/runtime/tools/ccfilter_README.txt @@ -1,3 +1,13 @@ +READ THIS FIRST +=============== + +ccfilter is a C program to filter the output of a few compilers to a common +QuickFix format. It is provided with Vim to make quickfix useful for more +compilers. + +ccfilter WILL FAIL with long lines (more than 2047 bytes). + + COMPILING AND INSTALLING: ========================= diff --git a/runtime/tools/demoserver.py b/runtime/tools/demoserver.py new file mode 100755 index 0000000000..00fe8bfbca --- /dev/null +++ b/runtime/tools/demoserver.py @@ -0,0 +1,103 @@ +#!/usr/bin/python +# +# Server that will accept connections from a Vim channel. +# Run this server and then in Vim you can open the channel: +# :let handle = ch_open('localhost:8765') +# +# Then Vim can send requests to the server: +# :let response = ch_sendexpr(handle, 'hello!') +# +# And you can control Vim by typing a JSON message here, e.g.: +# ["ex","echo 'hi there'"] +# +# There is no prompt, just type a line and press Enter. +# To exit cleanly type "quit<Enter>". +# +# See ":help channel-demo" in Vim. +# +# This requires Python 2.6 or later. + +from __future__ import print_function +import json +import socket +import sys +import threading + +try: + # Python 3 + import socketserver +except ImportError: + # Python 2 + import SocketServer as socketserver + +thesocket = None + +class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): + + def handle(self): + print("=== socket opened ===") + global thesocket + thesocket = self.request + while True: + try: + data = self.request.recv(4096).decode('utf-8') + except socket.error: + print("=== socket error ===") + break + except IOError: + print("=== socket closed ===") + break + if data == '': + print("=== socket closed ===") + break + print("received: {0}".format(data)) + try: + decoded = json.loads(data) + except ValueError: + print("json decoding failed") + decoded = [-1, ''] + + # Send a response if the sequence number is positive. + # Negative numbers are used for "eval" responses. + if decoded[0] >= 0: + if decoded[1] == 'hello!': + response = "got it" + else: + response = "what?" + encoded = json.dumps([decoded[0], response]) + print("sending {0}".format(encoded)) + self.request.sendall(encoded.encode('utf-8')) + thesocket = None + +class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + pass + +if __name__ == "__main__": + HOST, PORT = "localhost", 8765 + + server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) + ip, port = server.server_address + + # Start a thread with the server -- that thread will then start one + # more thread for each request + server_thread = threading.Thread(target=server.serve_forever) + + # Exit the server thread when the main thread terminates + server_thread.daemon = True + server_thread.start() + print("Server loop running in thread: ", server_thread.name) + + print("Listening on port {0}".format(PORT)) + while True: + typed = sys.stdin.readline() + if "quit" in typed: + print("Goodbye!") + break + if thesocket is None: + print("No socket yet") + else: + print("sending {0}".format(typed)) + thesocket.sendall(typed.encode('utf-8')) + + server.shutdown() + server.server_close() diff --git a/runtime/tools/shtags.pl b/runtime/tools/shtags.pl index 48dcdc7476..79238fdb27 100755 --- a/runtime/tools/shtags.pl +++ b/runtime/tools/shtags.pl @@ -3,11 +3,12 @@ # shtags: create a tags file for perl scripts # # Author: Stephen Riehm -# Last Changed: 96/11/27 19:46:06 -# -# "@(#) shtags 1.1 by S. Riehm" +# Updated by: David Woodfall <dave@dawoodfall.net> +# Last Changed: 2018/04/02 # +use Getopt::Std; + # obvious... :-) sub usage { @@ -30,7 +31,7 @@ sub version # # Version information # - @id = split( ', ', 'scripts/bin/shtags, /usr/local/, LOCAL_SCRIPTS, 1.1, 96/11/27, 19:46:06' ); + @id = split( ', ', 'scripts/bin/shtags, /usr/local/, LOCAL_SCRIPTS, 1.2, 18/04/02, 07:37' ); $id[0] =~ s,.*/,,; print <<_EOVERS; $id[0]: $id[3] @@ -45,12 +46,11 @@ sub version # initialisations # ($program = $0) =~ s,.*/,,; -require 'getopts.pl'; # # parse command line # -&Getopts( "t:s:vVwx" ) || &usage(); +getopts( "t:s:vVwx" ) || &usage(); $tags_file = $opt_t || 'tags'; $explicit = $opt_x; $variable_tags = $opt_v; diff --git a/runtime/tools/unicode.vim b/runtime/tools/unicode.vim index f3c58ed35a..88c4c79609 100644 --- a/runtime/tools/unicode.vim +++ b/runtime/tools/unicode.vim @@ -32,8 +32,8 @@ func! ParseFoldProps() if line !~ '^#' && line !~ '^\s*$' let l = split(line, '\s*;\s*', 1) if len(l) != 4 - echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4' - return + echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4' + return endif call add(s:foldprops, l) endif @@ -50,8 +50,8 @@ func! ParseWidthProps() if line !~ '^#' && line !~ '^\s*$' let l = split(line, '\s*;\s*', 1) if len(l) != 2 - echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2' - return + echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2' + return endif call add(s:widthprops, l) endif @@ -72,18 +72,18 @@ func! BuildCaseTable(name, index) let n = ('0x' . p[0]) + 0 let nl = ('0x' . p[a:index]) + 0 if start >= 0 && add == nl - n && (step == 0 || n - end == step) - " continue with same range. - let step = n - end - let end = n + " continue with same range. + let step = n - end + let end = n else - if start >= 0 - " produce previous range - call Range(ranges, start, end, step, add) - endif - let start = n - let end = n - let step = 0 - let add = nl - n + if start >= 0 + " produce previous range + call Range(ranges, start, end, step, add) + endif + let start = n + let end = n + let step = 0 + let add = nl - n endif endif endfor @@ -115,18 +115,18 @@ func! BuildFoldTable() let n = ('0x' . p[0]) + 0 let nl = ('0x' . p[2]) + 0 if start >= 0 && add == nl - n && (step == 0 || n - end == step) - " continue with same range. - let step = n - end - let end = n + " continue with same range. + let step = n - end + let end = n else - if start >= 0 - " produce previous range - call Range(ranges, start, end, step, add) - endif - let start = n - let end = n - let step = 0 - let add = nl - n + if start >= 0 + " produce previous range + call Range(ranges, start, end, step, add) + endif + let start = n + let end = n + let step = 0 + let add = nl - n endif endif endfor @@ -160,15 +160,15 @@ func! BuildCombiningTable() if p[2] == 'Mn' || p[2] == 'Mc' || p[2] == 'Me' let n = ('0x' . p[0]) + 0 if start >= 0 && end + 1 == n - " continue with same range. - let end = n + " continue with same range. + let end = n else - if start >= 0 - " produce previous range - call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end)) - endif - let start = n - let end = n + if start >= 0 + " produce previous range + call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end)) + endif + let start = n + let end = n endif endif endfor @@ -197,47 +197,57 @@ func! BuildWidthTable(pattern, tableName) for p in s:widthprops if p[1][0] =~ a:pattern if p[0] =~ '\.\.' - " It is a range. we don't check for composing char then. - let rng = split(p[0], '\.\.') - if len(rng) != 2 - echoerr "Cannot parse range: '" . p[0] . "' in width table" - endif - let n = ('0x' . rng[0]) + 0 - let n_last = ('0x' . rng[1]) + 0 + " It is a range. we don't check for composing char then. + let rng = split(p[0], '\.\.') + if len(rng) != 2 + echoerr "Cannot parse range: '" . p[0] . "' in width table" + endif + let n = ('0x' . rng[0]) + 0 + let n_last = ('0x' . rng[1]) + 0 else - let n = ('0x' . p[0]) + 0 - let n_last = n + let n = ('0x' . p[0]) + 0 + let n_last = n endif " Find this char in the data table. while 1 - let dn = ('0x' . s:dataprops[dataidx][0]) + 0 - if dn >= n - break - endif - let dataidx += 1 + let dn = ('0x' . s:dataprops[dataidx][0]) + 0 + if dn >= n + break + endif + let dataidx += 1 endwhile if dn != n && n_last == n - echoerr "Cannot find character " . n . " in data table" + echoerr "Cannot find character " . n . " in data table" endif " Only use the char when it's not a composing char. " But use all chars from a range. let dp = s:dataprops[dataidx] if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me') - if start >= 0 && end + 1 == n - " continue with same range. - else - if start >= 0 - " produce previous range - call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end)) - endif - let start = n - endif - let end = n_last + if start >= 0 && end + 1 == n + " continue with same range. + else + if start >= 0 + " produce previous range + call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end)) + if a:pattern == 'A' + call add(s:ambitable, [start, end]) + else + call add(s:doubletable, [start, end]) + endif + endif + let start = n + endif + let end = n_last endif endif endfor if start >= 0 call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end)) + if a:pattern == 'A' + call add(s:ambitable, [start, end]) + else + call add(s:doubletable, [start, end]) + endif endif " New buffer to put the result in. @@ -251,7 +261,87 @@ func! BuildWidthTable(pattern, tableName) wincmd p endfunc +" Build the amoji width table in a new buffer. +func! BuildEmojiTable(pattern, tableName) + let alltokens = [] + let widthtokens = [] + let lines = map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~a:pattern'), 'matchstr(v:val,"^\\S\\+")') + for n in range(len(lines)) + let line = lines[n] + let token = split(line, '\.\.') + let first = ('0x' . token[0]) + 0 + if len(token) == 1 + let last = first + else + let last = ('0x' . token[1]) + 0 + endif + let token = [first, last] + if len(alltokens) > 0 && (token[0] - 1 == alltokens[-1][1]) + let alltokens[-1][1] = token[1] + else + call add(alltokens, token) + endif + + " Characters below 1F000 may be considered single width traditionally, + " making them double width causes problems. + if first < 0x1f000 + continue + endif + + " exclude characters that are in the "ambiguous" or "doublewidth" table + for ambi in s:ambitable + if first >= ambi[0] && first <= ambi[1] + let first = ambi[1] + 1 + endif + if last >= ambi[0] && last <= ambi[1] + let last = ambi[0] - 1 + endif + endfor + for double in s:doubletable + if first >= double[0] && first <= double[1] + let first = double[1] + 1 + endif + if last >= double[0] && last <= double[1] + let last = double[0] - 1 + endif + endfor + + if first <= last + let token = [first, last] + if len(widthtokens) > 0 && (token[0] - 1 == widthtokens[-1][1]) + let widthtokens[-1][1] = token[1] + else + call add(widthtokens, token) + endif + endif + endfor + let allranges = map(alltokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])') + let widthranges = map(widthtokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])') + + " New buffer to put the result in. + new + exe "file " . a:tableName . '_all' + call setline(1, " static struct interval " . a:tableName . "_all[] =") + call setline(2, " {") + call append('$', allranges) + call setline('$', getline('$')[:-2]) " remove last comma + call setline(line('$') + 1, " };") + wincmd p + + " New buffer to put the result in. + new + exe "file " . a:tableName . '_width' + call setline(1, " static struct interval " . a:tableName . "_width[] =") + call setline(2, " {") + call append('$', widthranges) + call setline('$', getline('$')[:-2]) " remove last comma + call setline(line('$') + 1, " };") + wincmd p +endfunc + +" Try to avoid hitting E36 +set equalalways " Edit the Unicode text file. Requires the netrw plugin. edit http://unicode.org/Public/UNIDATA/UnicodeData.txt @@ -284,7 +374,16 @@ edit http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt call ParseWidthProps() " Build the double width table. +let s:doubletable = [] call BuildWidthTable('[WF]', 'doublewidth') " Build the ambiguous width table. +let s:ambitable = [] call BuildWidthTable('A', 'ambiguous') + +" Edit the emoji text file. Requires the netrw plugin. +edit http://www.unicode.org/Public/emoji/3.0/emoji-data.txt + +" Build the emoji table. Ver. 1.0 - 6.0 +" Must come after the "ambiguous" table +call BuildEmojiTable('; Emoji\s\+# [1-6]\.[0-9]', 'emoji') diff --git a/runtime/tools/vim_vs_net.cmd b/runtime/tools/vim_vs_net.cmd index bea6353f67..335236c920 100644 --- a/runtime/tools/vim_vs_net.cmd +++ b/runtime/tools/vim_vs_net.cmd @@ -15,8 +15,7 @@ @rem :h --remote-silent for more details @rem @rem --servername VS_NET -@rem This will create a new instance of vim called VS_NET. So if you -open +@rem This will create a new instance of vim called VS_NET. So if you open @rem multiple files from VS, they will use the same instance of Vim. @rem This allows you to have multiple copies of Vim running, but you can @rem control which one has VS files in it. diff --git a/runtime/tools/xcmdsrv_client.c b/runtime/tools/xcmdsrv_client.c index a0e6211a1d..c0a60d2164 100644 --- a/runtime/tools/xcmdsrv_client.c +++ b/runtime/tools/xcmdsrv_client.c @@ -29,10 +29,8 @@ #include <X11/Intrinsic.h> #include <X11/Xatom.h> -#define __ARGS(x) x - /* Client API */ -char * sendToVim __ARGS((Display *dpy, char *name, char *cmd, int asKeys, int *code)); +char * sendToVim(Display *dpy, char *name, char *cmd, int asKeys, int *code); #ifdef MAIN /* A sample program */ @@ -70,15 +68,15 @@ main(int argc, char **argv) * Forward declarations for procedures defined later in this file: */ -static int x_error_check __ARGS((Display *dpy, XErrorEvent *error_event)); -static int AppendPropCarefully __ARGS((Display *display, - Window window, Atom property, char *value, int length)); -static Window LookupName __ARGS((Display *dpy, char *name, - int delete, char **loose)); -static int SendInit __ARGS((Display *dpy)); -static char *SendEventProc __ARGS((Display *dpy, XEvent *eventPtr, - int expect, int *code)); -static int IsSerialName __ARGS((char *name)); +static int x_error_check(Display *dpy, XErrorEvent *error_event); +static int AppendPropCarefully(Display *display, + Window window, Atom property, char *value, int length); +static Window LookupName(Display *dpy, char *name, + int delete, char **loose); +static int SendInit(Display *dpy); +static char *SendEventProc(Display *dpy, XEvent *eventPtr, + int expect, int *code); +static int IsSerialName(char *name); /* Private variables */ static Atom registryProperty = None; @@ -96,12 +94,12 @@ static int got_x_error = FALSE; */ char * -sendToVim(dpy, name, cmd, asKeys, code) - Display *dpy; /* Where to send. */ - char *name; /* Where to send. */ - char *cmd; /* What to send. */ - int asKeys; /* Interpret as keystrokes or expr ? */ - int *code; /* Return code. 0 => OK */ +sendToVim( + Display *dpy, /* Where to send. */ + char *name, /* Where to send. */ + char *cmd, /* What to send. */ + int asKeys, /* Interpret as keystrokes or expr ? */ + int *code) /* Return code. 0 => OK */ { Window w; Atom *plist; @@ -247,8 +245,7 @@ sendToVim(dpy, name, cmd, asKeys, code) */ static int -SendInit(dpy) - Display *dpy; +SendInit(Display *dpy) { XErrorHandler old_handler; @@ -291,11 +288,11 @@ SendInit(dpy) */ static Window -LookupName(dpy, name, delete, loose) - Display *dpy; /* Display whose registry to check. */ - char *name; /* Name of an interpreter. */ - int delete; /* If non-zero, delete info about name. */ - char **loose; /* Do another search matching -999 if not found +LookupName( + Display *dpy, /* Display whose registry to check. */ + char *name, /* Name of an interpreter. */ + int delete, /* If non-zero, delete info about name. */ + char **loose) /* Do another search matching -999 if not found Return result here if a match is found */ { unsigned char *regProp, *entry; @@ -398,11 +395,11 @@ LookupName(dpy, name, delete, loose) } static char * -SendEventProc(dpy, eventPtr, expected, code) - Display *dpy; - XEvent *eventPtr; /* Information about event. */ - int expected; /* The one were waiting for */ - int *code; /* Return code. 0 => OK */ +SendEventProc( + Display *dpy, + XEvent *eventPtr, /* Information about event. */ + int expected, /* The one were waiting for */ + int *code) /* Return code. 0 => OK */ { unsigned char *propInfo; unsigned char *p; @@ -537,13 +534,13 @@ SendEventProc(dpy, eventPtr, expected, code) */ static int -AppendPropCarefully(dpy, window, property, value, length) - Display *dpy; /* Display on which to operate. */ - Window window; /* Window whose property is to +AppendPropCarefully( + Display *dpy, /* Display on which to operate. */ + Window window, /* Window whose property is to * be modified. */ - Atom property; /* Name of property. */ - char *value; /* Characters to append to property. */ - int length; /* How much to append */ + Atom property, /* Name of property. */ + char *value, /* Characters to append to property. */ + int length) /* How much to append */ { XErrorHandler old_handler; @@ -562,9 +559,7 @@ AppendPropCarefully(dpy, window, property, value, length) */ /* ARGSUSED */ static int -x_error_check(dpy, error_event) - Display *dpy; - XErrorEvent *error_event; +x_error_check(Display *dpy, XErrorEvent *error_event) { got_x_error = TRUE; return 0; @@ -575,8 +570,7 @@ x_error_check(dpy, error_event) * Actually just checks if the name ends in a digit. */ static int -IsSerialName(str) - char *str; +IsSerialName(char *str) { int len = strlen(str); diff --git a/runtime/tutor/tutor b/runtime/tutor/tutor index 64a27d1c0d..a6f95211e0 100644 --- a/runtime/tutor/tutor +++ b/runtime/tutor/tutor @@ -18,7 +18,7 @@ use. That means that you need to execute the commands to learn them properly. If you only read the text, you will forget the commands! - Now, make sure that your Shift-Lock key is NOT depressed and press + Now, make sure that your Caps-Lock key is NOT depressed and press the j key enough times to move the cursor so that Lesson 1.1 completely fills the screen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.bg.utf-8 b/runtime/tutor/tutor.bg.utf-8 new file mode 100644 index 0000000000..d7ce45b3ee --- /dev/null +++ b/runtime/tutor/tutor.bg.utf-8 @@ -0,0 +1,1037 @@ +=============================================================================== += Добре дошли в самоучителя на V I M - Версия 1.7 = +=============================================================================== + + Vim е много мощен редактор с много команди, твърде много, за да бъдат + обяснени в ръководство като това. Този самоучител е създаден, за да обясни + достатъчно от тях, така че да можете да използвате Vim за всякакви цели. + + Приблизителното време, необходимо, за да направите уроците е 25-30 минути, в + зависимост от това колко време използвате за да се упражнявате. + + ВНИМАНИЕ! + Командите в уроците ще променят текста им. Запишете файла другаде, за да + се упражнявате (ако сте отворили самоучителя с "vimtutor", това вече е + направено). + + Важно е да се запомни, че този самоучител е съставен с цел да се учите + чрез употреба. Това означава да изпълнявате командите, за да ги научите + правилно. Ако просто четете текста, ще забравите командите! + + + Сега, уверете се, че клавишът CapsLock не е натиснат и натиснете клавиша + j няколко пъти, така че Урок 1.1 да да се побере на екрана. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.1: ПРИДВИЖВАНЕ НА ПОКАЗАЛЕЦА + + + ** За да преместите показалеца, натискайте клавишите h,j,k,l както е указано. ** + ^ + k Подсказка: Клавишът h е вляво и премества показалеца наляво. + < h l > Клавишът l е вдясно и премества показалеца надясно. + j Клавишът j прилича на стрелка, насочена надолу. + v + 1. Движете показалеца насам-натам по екрана, докато свикнете. + + 2. Задръжте клавиша за преместване надолу(j), докато започне да повтаря + действието си. Сега знаете как да се придвижите до следващия урок. + + 3. Използвайте клавиша за движение надолу, за да стигнете до Урок 1.2. + +Важно! Ако се окаже, че не сте сигурни какво сте въвели, натиснете <ESC>, за да + отидете в нормален режим. След това въведете желаната команда отново. + +Важно! Клавишите със стрелки би трябвало също да работят, но ако използвате + hjkl ще можете да се придвижвате по-бързо, като свикнете. Наистина! + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.2: Излизане от VIM (quit) + + + Важно!!! Преди да изпълните която и да е от стъпките по-долу, прочетете + целия урок!!! + + 1. Натиснете клавиша <ESC> (за да се уверите, че сте в нормален режим). + + 2. Напишете: :q! <ENTER>. + Така излизате от редактора без да записвате промените, които сте направили. + + 3. Върнете се тук като изпълните командата, с която пуснахте този самоучител. + Това ще да е: vimtutor <ENTER> + + 4. Ако сте сигурни, че сте запомнили стъпките от 1 до 3, изпълнете ги и + влезте отново в редактора. + +Внимание! :q! <ENTER> отхвърля всички промени, които сте направили. След + няколко урока ще се научите как да записвате промени във файл. + + 5. Придвижете показалеца надолу до Урок 1.3. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.3: ПРОМЯНА НА ТЕКСТ - ИЗТРИВАНЕ (DELETE) + + + ** Натиснете x , за да изтриете буквата под показалеца. ** + + 1. Придвижете показалеца до реда по-долу, означен със --->. + + 2. За да поправите грешките, придвижете показалеца върху буквата, + която ще триете. + + 3. Натиснете клавиша x , за да изтриете нежеланата буква. + + 4. Повтаряйте стъпки от 2 до 4 докато поправите изречението. + +---> Кккравата сскоочии връъъъзз ллуннатааа. + + 5. След като горния ред е вече поправен, можем да отидем на Урок 1.4. + +Важно! Като правите този урок, не се опитвайте да помните, учете се с правене. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.4: ПРОМЯНА НА ТЕКСТ - ВЪВЕЖДАНЕ (INSERT) + + + ** Бележка на преводача ** + В упражненията нататък ще ви се налага да въвеждате текст на български. Vim + притежава собствена система за въвеждане на не-латински букви. За да можете + да пишете български букви, докато сте в режим за въвеждане, и едновременно с + това командите ви да се въвеждат с латински букви, направете следното: + + Натиснете <ESC>, за да се уверите, че не сте в режим за въвеждане. + + Въведете ":setlocal keymap=bulgarian-phonetic" или + ":setlocal keymap=bulgarian-bds", без кавичките, в зависимост от това коя + подредба предпочитате. Забележете, че щом въведете : , те ще се появят в + дъното на екрана. Вече можете да въвеждате български букви без да ползвате + системната клавиатурна подредба. + + За да превключвате между двете подредби, докато сте в режим за въвеждане + натискайте CTRL-^ (дръжте натиснати CTRL и SHIFT и натиснете ^). + + + ** Натиснете i за да въведете текст. ** + + 1. Придвижете показалеца до първия ред долу, означен със --->. + + 2. За да направите първия ред същия като втория, придвижете показалеца върху + първата буква СЛЕД мястото, където трябва да бъде въведен текста. + + 3. Натиснете i и напишете каквото трябва да се добави. + + 4. След поправяне на всяка грешка, натискайте <ESC>, за да се върнете към + Нормален режим. Повтаряйте стъпки от 2 до 4, докато поправите изречението. + +---> Част текс липс н тзи . +---> Част от текста липсва на този ред. + + 5. След като усвоите въвеждането на текст, отидете на Урок 1.5. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.5: ПРОМЯНА НА ТЕКСТ - ДОБАВЯНЕ (APPEND) + + + ** Натиснете A (SHIFT+a) , за да добавите текст. ** + + 1. Придвижете показалеца до реда долу, означен със --->. + Няма значение на коя буква в реда се намира показалеца. + + 2. Натиснете A и добавете каквото е нужно. + + 3. След като сте добавили каквото е нужно, натиснете <ESC>, за да се върнете + в Нормален режим. + + 4. Придвижете показалеца до втория ред означен със ---> и повторете стъпки 2, + и 3, за да поправите изречението. + +---> Има текст, който липсва + Има текст, които липсва на този ред. +---> Тук също има текст, + Тук също има текст, който липсва. + + 5. След като овладеете добавянето на текст, отидете на Урок 1.6. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.6: ПРОМЯНА НА ФАЙЛ + + ** Използвайте :wq (write and quit), за да запишете файла и + излезете. ** + + Внимание! Преди да изпълните която и да е от стъпките долу, прочетете целия урок!! + + 1. Излезте от самоучителя, както направихте в Урок 1.2: :q! + Или, ако имате достъп до друг терминал, направете следното там. + + 2. На командния ред напишете следното и натиснете <ENTER>: vim tutor <ENTER> + 'vim' е командата, която стартира редактора Vim, 'tutor' е името на файла, + които искате да промените. Използвайте файл който може да бъде променян. + + 3. Въвеждайте и изтривайте текст по начините, научени в предишните уроци. + + 4. Запишете файла и излезте от Vim с: :wq <ENTER> + + 5. Ако сте излезли от vimtutor в стъпка 1, пуснете го отново и се придвижете + надолу до обобщението, което следва. + + 6. След като прочетете и разберете горните стъпки, направете ги. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1 ОБОБЩЕНИЕ + + + 1. Показалецът се премества като използвате клавишите със стрелки или с клавишите. + h (наляво) j (надолу) k (нагоре) l (надясно) + + 2. За да пуснете Vim от командния ред, напишете: vim ИМЕ-НА-ФАЙЛ <ENTER> + + 3. За да излезете от Vim, напишете: + <ESC> :q! <ENTER> за да отхвърлите всички промени. + ИЛИ напишете: <ESC> :wq <ENTER> за да запишете промените. + + 4. За да изтриете буква намираща се под показалеца, натиснете: x . + + 5. За да въведете или добавите текст, натиснете: + i въведете текста, натиснете <ESC>. Въвежда преди показалеца. + A добавете текста, натиснете <ESC>. Добавя в края на реда. + +Внимание! С натискане на <ESC> преминавате в Нормален режим или отменяте + нежелана, недописана команда. + +Сега продължете с Урок 2. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.1: КОМАНДИ ЗА ИЗТРИВАНЕ + + + ** Въведете dw , за да изтриете дума. ** + + 1. Натиснете <ESC> , за да се уверите, че сте в Нормален режим. + + 2. Придвижете показалеца до реда по-долу, означен със --->. + + 3. Придвижете показалеца до началото на думата, която трябва да бъде изтрита. + + 4. Натиснете последователно dw и думата ще изчезне. + + Забележка! Буквата d ще се появи на последния ред от екрана, когато я + натиснете. Vim ви чака да натиснете w . Ако видите друга буква, значи сте + натиснали грешен клавиш. Натиснете <ESC> и започнете отначало. + +---> Има някои думи хартия, които забава не са част от това изречение. + + 5. Повтаряйте стъпки 3 и 4, докато поправите изречението и преминете към Урок 2.2. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.2: ОЩЕ КОМАНДИ ЗА ИЗТРИВАНЕ + + + ** Въведете d$ , за да изтриете всичко до края на реда. ** + + 1. Натиснете <ESC> , за да се уверите, че сте в Нормален режим. + + 2. Придвижете показалеца до реда по-долу, означен със --->. + + 3. Придвижете показалеца до правилния ред (СЛЕД първата .). + + 4. Натиснете последователно d$ , за да изтриете всичко до края на реда. + +---> Някой е въвел края на този ред двукратно. края на този ред двукратно. + + + 5. Отидете до Урок 2.3, за да разберете какво се случва. + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.3: ЗА ОПЕРАТОРИТЕ И ДВИЖЕНИЯТА + + + Много команди, които променят текст се състоят от оператор и движение. + Форматът за командата за изтриване с оператора d (delete) е както следва. + + d движение + + Където: + d е операторът за изтриване. + движение - върху какво ще се приложи операторът (списъкът долу). + + Кратък списък с движения: + w - (word) до началото на следващата дума като се ИЗКЛЮЧВА първата ѝ буква. + e - (end of word) до края на текущата дума, ВКЛЮЧИТЕЛНО последната буква. + $ - До края на реда, ВКЛЮЧИТЕЛНО последния символ. + + Така, като въведете de ще изтриете от мястото на показалеца до края на + думата. + +Забележка! Като натиснете само клавиша за движение, ще преместите показалеца на + съответното място. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.4: ИЗПОЛЗВАНЕ НА БРОЯЧ ПРИ ДВИЖЕНИЕ + + + ** Ако въведете число преди движението, то се повтаря толкова пъти + колкото е числото. ** + + 1. Придвижете показалеца до началото на реда долу, означен със --->. + + 2. Въведете 2w , за да преместите показалеца с две думи напред. + + 3. Въведете 3e , за да преместите показалеца до края на третата дума + напред. + + 4. Въведете 0 (нула), за да отидете в началото на реда. + + 5. Повтаряйте стъпки 2 и 3 с различни числа. + +---> Това е просто ред с думи, в който можете да се движите. + + 6. Отидете на Урок 2.5. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.5: ИЗПОЛЗВАЙТЕ БРОЯЧ, ЗА ДА ТРИЕТЕ ПОВЕЧЕ + + + ** Ако въведете число преди оператор, действието се повтаря толкова пъти + колкото е числото. ** + + Както е упоменато горе, за да изтриете повече при използване на оператора за + изтриване заедно с движение, трябва да въведете числото преди движението: + d число движение + + 1. Придвижете показалеца до първата дума, изписана с ГЛАВНИ БУКВИ в реда, + означен със --->. + + 2. Въведете d2w , за да изтриете думите, написани с ГЛАВНИ БУКВИ. + + 3. Повторете стъпки 1 и 2, за да изтриете последователните + думи, изписани с големи букви с една команда. + +---> този АБВ ГДЕ ред ЖЗИЙ КЛ МНОП РСТ с думи УФХ ЦЧШ ЩЪЬЮЯ е почистен. + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.6: РАБОТА С РЕДОВЕ + + + ** Въведете dd , за да изтриете цял ред. ** + + Понеже често се налага да се трие цял ред, създателите на Vi са решили, че ще + е по-лесно да се натисне два пъти d, за да се изтрие ред. + + 1. Придвижете показалеца на втория ред в абзаца долу. + 2. Въведете dd , за да изтриете реда. + 3. Сега отидете на четвъртия ред. + 4. Въведете 2dd , за да изтриете два реда. + +---> 1) Розите са червени, +---> 2) Калта е забавление, +---> 3) Теменужките са сини, +---> 4) Аз имам кола, +---> 5) Часовниците показват часа, +---> 6) Захарта е сладка, +---> 7) Както и ти. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.7: ОТМЯНА + + + ** Натиснете u , за да отмените (undo) последната команда; U , за + отмяна на всички команди на текущия ред. ** + + 1. Придвижете показалеца до началото на реда долу , означен със ---> и го + поставете на първата грешка. + 2. Въведете x , за да изтриете първата нежелана буква. + 3. Сега натиснете u , за да отмените последната изпълнена команда. + 4. Този път поправете всички грешки като използвате командата x . + 5. Сега въведете главно U (SHIFT+U), за да върнете реда в първоначалния му вид. + 6. Сега натиснете u няколко пъти, за да отмените предишното U и командите + преди него. + 7. Сега натиснете CTRL-R (redo) (дръжте клавиша CTRL натиснат, докато натискате R), + неколкократно, за да изпълните отново командите (да отмените отмените). + +---> Пооправеете грешшките нна този реди и ги заменете с отмянаа. + + 8. Това са много полезни команди. Сега отидете на обобщението за Урок 2. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2 ОБОБЩЕНИЕ + + + 1. За да изтриете всичко от показалеца до началото на следващата дума, въведете dw + 2. За да изтриете всичко от показалеца до края на реда, въведете d$ + 3. За да изтриете цял ред, въведете dd + + 4. За да повторите движение въведете преди него число 2w + 5. Форматът за команда за промяна е: + команда [число] движение + където: + оператор - това, което трябва да се направи (заповед), например d за изтриване + [число] - незадължителен брой повторения на движението + движение - придвижване в текста, върху който се работи, например w (word), + $ (до края на реда) и т.н. + + 6. За да се придвижите до началото на ред, натиснете нула - 0 + + 7. За да отмените предишни действия, натиснете u (малка буква u) + За да отмените всички промени на един ред, въведете U (главна буква U) + За да отмените отмените, натиснете CTRL-R + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.1: КОМАНДАТА ЗА ПОСТАВЯНЕ (PUT) + + + ** Въведете p , за да поставите изтрит преди това текст след + показалеца.** + + 1. Придвижете показалеца до първия ред, означен със ---> долу. + + 2. Въведете dd , за да изтриете реда и да го запишете в регистъра на Vim. + + 3. Придвижете показалеца до реда, означен със c), НАД мястото, където трябва да + се постави изтрития ред. + + 4. Въведете p , за да поставите (put) реда под реда, на който е показалеца. + + 5. Повтаряйте стъпки от 2 до 4, за да подредите правилно редовете. + +---> d) Ти можеш ли да учиш? +---> b) Теменужките са сини, +---> c) Уменията се научават, +---> a) Розите са червени, + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.2: КОМАНДАТА ЗА ЗАМЕСТВАНЕ (REPLACE) + + + ** Въведете rx , за да заместите буквата под показалеца с x . ** + + 1. Придвижете показалеца до първия ред, означен със ---> долу. + + 2. Наместете показалеца така, че да се окаже върху първата грешка. + + 3. Въведете r и след това буквата, с която ще замествате. + + 4. Повтаряйте стъпки 2 и 3 докато първият ред стане същия като втория. + +---> Катишо тизе гад и песен, никей а нарескъл гришнета бливочи! +---> Когато този ред е писан, някой е натискал грешните клавиши! + + 5. Сега отидете на урок 3.3. + +Забележка! Помнете, че трябва да се учите, като се упражнявате, а не като се + опитвате да запомните. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.3: ОПЕРАТОРЪТ ЗА ПРОМЯНА (CHANGE) + + + ** За да промените от мястото на показалеца до края на дума, въведете ce . ** + + 1. Придвижете показалеца до първия ред долу, означен със --->. + + 2. Поставете показалеца върху з в тзии. + + 3. Въведете ce и правилния остатък от думата ( в този случай ози). + + 4. Натиснете <ESC> и отидете на следващата група букви, които трябва да се променят. + + 5. Повтаряйте стъпки 3 и 4, докато първото изречение стане същото като второто. + +---> На тзии ред иам неклико дмуи, ктоио требав да се прмнеято като се изповлза оепртореа за промяна. +---> На този ред има няколко думи, които трябва да се променят като се използва оператора за промяна. + + Забележете, че ce изтрива думата и преминавате в режим за въвеждане. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.4: ОЩЕ ПРОМЕНИ С ИЗПОЛЗВАНЕ НА c + + + ** Операторът за промяна се използва със същите движения както при триене ** + + 1. Операторът за промяна работи по същия начин като оператора за триене. + Форматът е: + + c [число] движение + + 2. Движенията са същите, например: w (word) и $ (край на ред). + + 3. Отидете на първия ред долу, отбелязан с --->. + + 4. Придвижете показалеца до първата грешка. + + 5. Въведете c$ и допишете остатъка от реда така, че да стане същия като + долния ред. След това натиснете <ESC>. + +---> Краят на този ред трябва да изглежда като долния. +---> Краят на този ред трябва да бъде поправен с командата c$. + +Забележка! Можете да използвате клавиша Backspace за поправка на грешки, докато въвеждате. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3 ОБОБЩЕНИЕ + + + 1. За да поставите изтрит преди това отнякъде текст, въведете p . + Това поставя изтрития текст СЛЕД мястото, на което се намира показалеца. + Ако сте изтрили преди това цял ред, той ще бъде поставен като следващ ред. + + 2. За да заместите буква, намираща се под показалеца, въведете r и след + това буквата, с която искате да заместите. + + 3. Операторът за промяна ви позволява да променяте текста от мястото на + показалеца до мястото, указано от съответното движение. Например, въведете + ce за да изтриете от мястото на показалеца до края на думата, или, + въведете c$ ,за да замените с нов текст до края на реда. + + 4. Форматът на оператора за промяна е: + + c [число] движение + +Сега отидете на следващия урок. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.1: МЕСТОПОЛОЖЕНИЕ НА ПОКАЗАЛЕЦА И СЪСТОЯНИЕ НА ФАЙЛА + + ** Въведете CTRL-G, за да видите къде се намирате във файла и неговото + състояние. Въведете G , за да отидете на някой ред. ** + +Внимание! Прочетете целия урок, преди да изпълните стъпките в него! + + 1. Задръжте натиснат клавиша Ctrl и натиснете g . Това действие го наричаме + CTRL-G. В дъното на екрана ще се появи съобщение с името на файла и + мястото, където се намира показалеца. Запомнете номера на реда за стъпка 3. + +Забележка: Може би виждате мястото на показалеца в долния десен ъгъл на екрана. +Това се случва, когато настройката 'ruler' е зададена (вижте :help 'ruler' ) + + 2. Натиснете G , за да отидете в края на файла. + Въведете gg , за да отидете в началото на файла. + + 3. Въведете номера на реда, на който бяхте и след това натиснете G . Това ще + ви върне на мястото където бяхте, когато натиснахте CTRL-G. + + 4. Ако вече се чувствате уверени, изпълнете стъпките от 1 до 3. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.2: КОМАНДАТА ЗА ТЪРСЕНЕ + + + ** Въведете / , последвана от фраза, за да потърсите фразата. ** + + 1. В Нормален режим въведете знака / . Забележете, че / (наклонената + черта) и показалецът се появяват в дъното на екрана, както се случва при + използването на командата : . + + 2. Сега въведете 'грешшшка' <ENTER>. Това е думата, която ще търсите. + + 3. За да търсите същата дума отново, натиснете n . + За да търсите същата дума отново, но в обратната посока, натиснете N . + + 4. За да търсите за фраза в обратната посока използвайте ? вместо / . + + 5. За да се върнете, там където сте били, натиснете CTRL-O (задръжте Ctrl + натиснат докато натискате клавиша o). Повторете, за да отидете още + по-назад. С CTRL-I пък отивате напред. + +---> "грешшшка" се се пише "грешка" грешшшка е грешка. +Внимание! Когато търсенето достигне до края на файла, то ще продължи от +началото на файла, освен ако настройката 'wrapscan' е била нулирана. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.3: ТЪРСЕНЕ НА СЪОТВЕТСТВАЩИ СКОБИ + + + ** Въведете % , за да на мерите съответната ),], или } . ** + + 1. Поставете показалеца върху някоя скоба (, [, или { в реда долу, означен със --->. + + 2. Сега Въведете символа % . + + 3. Показалецът ще се премести върху съответстващата фигурна, квадратна или + обикновена скоба. + + 4. Въведете % , за да преместите показалеца на другата съответстваща скоба. + + 5. Придвижете показалеца до друга (,),[,],{ или } скоба и вижте какво прави % . + +---> Това ( е ред за проверка с различни скоби като (, [ ] и { } в него. )) + + +Забележка! Това е много полезно при откриване на грешки в програми с несъответстващи скоби. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.4: КОМАНДАТА ЗА ЗАМЕСТВАНЕ (SUBSTITUTE) + + + ** Въведете :s/старо/ново/g за да заместите 'старо' със 'ново'. ** + + 1. Придвижете показалеца до реда долу, означен със --->. + + 2. Въведете :s/тоо/то <ENTER> . Забележете, че командата замества само + първото съвпадение с "тоо" на реда. + + 3. Сега въведете :s/тоо/то/g . Като добавите знака g (globally) това + означава, че искате да се заместят всички съвпадения, навсякъде в реда. + +---> Най-добротоо време да сте на полетоо е лятотоо. + + 4. За да заместите всяко съвпадение на дадена последователност от символи + между два реда: + Въведете :#,#s/old/new/g където #,# са числата на редовете + (първи и последен), обхватът, в който искате да + стане заместването. + Въведете :%s/old/new/g за да промените всяко съвпадение в целия файл. + Въведете :%s/old/new/gc да бъдете питани при всяко съвпадение, дали + да се замести или не. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4 ОБОБЩЕНИЕ + + + 1. CTRL-G показва къде се намирате във файл и състоянието му. + G ви отвежда до края на файла. + число G ви отвежда до съответния ред. + gg ви отвежда до първия ред. + + 2. Ако натиснете / , последвана от низ за търсене, търсите НАПРЕД. + Ако натиснете / , последвана от низ за търсене, търсите НАЗАД. + След търсене, въведете n , за да намерите следващо съвпадение с низа, + който търсите в същата посока, в която търсите или N , за да търсите в + обратната посока. + CTRL-O ви отвежда назад до старо място във файла, CTRL-I обратно до + по-нови места. + + 3. Ако натиснете % докато показалеца се намира на (,),[,],{, или }, той + отива до съответстващата скоба. + + 4. За да заместите един низ с друг, въведете :s/низ/друг + За да заместите един низ с друг навсякъде в един ред, въведете :s/низ/друг/g + За да заместите в даден обхват от редове, въведете :#,#s/низ/друг/g + За да заместите всички съвпадения във файл, въведете :%s/низ/друг/g + За да бъдете питани при всяко съвпадение, добавете 'c' :%s/низ/друг/gc + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.1: КАК ДА ИЗПЪЛНИМ ВЪНШНА КОМАНДА + + + ** Въведете :! , последвано от външна команда, за да я изпълните. ** + + 1. Въведете познатото ви вече : , за да поставите показалеца в дъното на + екрана. Това ви позволява да въвеждате команда. + + 2. Сега въведете ! (удивителен знак). Това ви позволява да изпълнявате + всякакви външни команди. + + 3. Например, след ! въведете ls и след това натиснете <ENTER>. Това ще + ви покаже списък с файловете и папките точно както ако сте в терминал. + Напишете :!dir ако ls не работи. + +Забележка: По този начин можете да изпълнявате всякакви външни команди и с аргументи. + +Забележка: Всички команди, започващи с : завършват с натискането на <ENTER> + От сега нататък няма да го споменаваме постоянно. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.2: ПОВЕЧЕ ЗА ЗАПИСВАНЕТО НА ФАЙЛОВЕ + + + ** За да запишете промените, направени в текста въведете :w ИМЕНАФАЙЛ. ** + + 1. Въведете :!dir или :!ls за да видите списък със съдържанието на + текущата папка. Вече знаете, че трябва да натиснете <ENTER> след това. + + 2. Изберете име на файла, което не съществува, например TEST. + + 3. Сега въведете :w TEST (където TEST е името на файла). + + 4. Това записва целия файл (Самоучителя за Vim) под името TEST. + За да проверите, напишете :!dir или :!ls отново и вижте съдържанието + на вашата папка. + +Забележете! Ако излезете от Vim и го пуснете отново, като напишете на командния + ред vim TEST , файлът ще бъде точно копие на самоучителя, когато + сте го записали. + + 5. Сега изтрийте файла като напишете (в MS-DOS): :!del TEST + или (в какъвто и да е Unix) :!rm TEST + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.3: ИЗБОР НА ТЕКСТ ЗА ЗАПИС + + + ** За да запишете част от файла, натиснете v , следвано от движение :w FILENAME ** + + 1. Придвижете показалеца на този ред. + + 2. Натиснете v и придвижете показалеца пет реда надолу. Забележете, че + текстът се осветява. + + 3. Натиснете : . В дъното на екрана ще се появи :'<,'> . + + 4. Напишете w TEST , където TEST е име на файл, който все още не съществува. + Уверете се, че виждате :'<,'>w TEST преди да натиснете <ENTER>. + + 5. Vim ще запише избраните редове във файла TEST. Използвайте :!dir или :!ls , + за да го видите. Не го изтривайте все още! Ще го използваме в следващия урок. + +Забележете! Като натиснете v , започвате видимо избиране (Visual selection). + Може да движите показалеца наоколо, за да направите избраното + по-голямо или по-малко. След което, можете да използвате оператор, + за да направите нещо с текста. Например, d изтрива текста. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.4: ИЗВЛИЧАНЕ И СЛИВАНЕ НА ФАЙЛОВЕ + + + ** За да вмъкнете съдържание на файл в текущия, въведете :r ИМЕНАФАЙЛ ** + + 1. Поставете показалеца над този ред. + +Важно! След като изпълните стъпка 2, ще видите текста от Урок 5.3. След това + отидете НАДОЛУ, за да видите този урок отново. + + 2. Сега извлечете файла TEST, като използвате командата :r TEST , където TEST + е името на файла, което сте използвали. Файла, който извлекохте е вмъкнат + под реда, на който се намира показалеца. + + 3. За да проверите, че файла е извлечен, отидете назад и ще забележите, че + има два урока 5.3 - оригинала и копието от извлечения файл. + +Важно! Също така можете да четете изхода от външна команда. + :r !ls прочита показаното от ls и го поставя под показалеца. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5 ОБОБЩЕНИЕ + + + 1. :!команда изпълнява външна команда. + + Някои полезни примери са: + (MS-DOS) (Unix) + :!dir :!ls - показва съдържанието на директорията, в която + се намирате. + :!del FILENAME :!rm FILENAME - изтрива файла FILENAME. + + 2. :w FILENAME записва текущия файл под името FILENAME. + + 3. v движение :w FILENAME записва видимо избраните редове във файл с име + FILENAME. + + 4. :r FILENAME извлича съдържанието на файла с име FILENAME и го вмъква под + мястото, където се намира показалеца + + 5. :r !dir чете изхода на командата dir и го поставя под мястото, на + което се намира показалеца. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.1: КОМАНДАТА ЗА ОТВАРЯНЕ (OPEN) + + + ** Натиснете o , за да отворите ред под показалеца и да преминете в + режим за въвеждане. ** + + 1. Придвижете показалеца до реда долу, означен със --->. + + 2. Натиснете клавиша o , за да отворите нов ред ПОД показалеца и да преминете + в режим за въвеждане. + + 3. Сега въведете някакъв текст и натиснете <ESC> , за да излезете от режима + за въвеждане. + +---> След като натиснете o , показалеца отива на новоотворения ред и + преминавате в режим за въвеждане. + + 4. За да отворите нов ред НАД показалеца, просто въведете главно O вместо + малко. Пробвайте това на долния ред. + +---> Отворете нов ред над този, като натиснете O , докато показалеца е на + този ред. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.2: КОМАНДАТА ЗА ДОБАВЯНЕ (APPEND) + + + ** Натиснете a , за да въведете текст СЛЕД показалеца. ** + + 1. Придвижете показалеца до началото на реда долу, означен със --->. + + 2. Натискайте e , докато показалеца отиде до края на ре . + + 3. Натиснете a (малка буква), за да добавите текст СЛЕД показалеца. + + 4. Допълнете думата както е на следващия ред. Натиснете <ESC> , за да + излезете от режима за въвеждане. + + 5. Използвайте e , за да се придвижите до следващата непълна дума и + повторете стъпки 3 и 4. + +---> Този ре ви позволява да упраж добав на тек в ред. +---> Този ред ви позволява да упражнявате добавяне на текст в ред. + +Важно! a, i и A - с всички тях отивате в режим за въвеждане. Единствената + разлика е в това, къде се въвеждат знаците. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.3: ДРУГ НАЧИН ЗА ЗАМЕСТВАНЕ + + + ** Натиснете главно R , за да заместите повече от един знак. ** + + 1. Придвижете показалеца до първия ред долу означен със --->. Придвижете + показалеца до началото на първото xxx. + + 2. Сега натиснете R и въведете числото от долния ред, така че да замести xxx . + + 3. Натиснете <ESC> , за да излезете от режима за заместване. Забележете, че + остатъка от реда остава непроменен. + + 4. Повторете стъпките, за да заместите другото xxx. + +---> Ако добавите 123 към xxx ще получите xxx. +---> Ако добавите 123 към 456 ще получите 579. + +Важно! Режимът за заместване е същия като режима за въвеждане, но всеки въведен + знак изтрива съществуващ знак. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.4: КОПИРАНЕ И ЗАМЕСТВАНЕ + + + ** Използвайте операторът y (yank), за да копирате текст и p (paste), + за да го поставите. ** + + 1. Отидете до реда, означен със ---> долу и поставете показалеца след "a)". + + 2. Преминете във режим за видимо избиране като използвате v и преместете + показалеца точно пред "първата". + + 3. Натиснете y , за да копирате (yank) осветения текст. + + 4. Преместете показалеца на края на следващия ред с j$ + + 5. Натиснете p ,за да поставите (paste) текста. След това натиснете пак <ESC> . + + 6. Използвайте режима за видимо избиране, за да изберете " точка.", вземете + го с y , отидете на края на следващия ред с j$ и поставете текста с p . + +---> a) това е първата точка. + b) + + Важно! Можете да използвате y също и като оператор. yw взима цяла дума. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.5: ЗАДАВАНЕ НА НАСТРОЙКА + + + ** Задайте настройка, та при търсене и заместване, да не се различават + големи и малки букви. ** + + 1. Търсете 'разли' като въведете /разли <ENTER> + Повторете няколко пъти като натискате n . + + 2. Задайте настройката 'ic' (Ignore case) като въведете :set ic + + 3.Сега търсете 'разли' отново като натискате n . + Забележете, че сега Разлика и РАЗЛИКА също биват намерени. + + 4. Задайте настройките 'hlsearch' (highlight search) + и 'incsearch' (incremental search): :set hls is + Тези настройки означават съответно "осветяване на намереното" + и "частично търсене". + + 5. Сега въведете отново командата за търсене и вижте какво се случва: + /разли <ENTER> + + 6. За да изключите нечувствителното към регистъра на буквите търсене, въведете + :set noic + +Забележка! За да премахнете осветяването, въведете :nohlsearch +Забележка! Ако искате да не се прави разлика между главни и малки букви само + при едно търсене, въведете \c (латинско ц) в края на низа, който + търсите: /разлика\c <ENTER> + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6 ОБОБЩЕНИЕ + + 1. Натиснете o , за да отворите нов ред ПОД показалеца и да преминете в + режим за въвеждане. + Натиснете O , за да отворите ред НАД показалеца. + + 2. Натиснете a , за да въведете текст СЛЕД показалеца. + Натиснете A , за да въведете текст след края на реда. + + 3. Командата e ви отвежда в края на дума. + + 4. Операторът y взима (yank) текст, а p го поставя (paste). + + 5. Ако въведете R , докато сте в нормален режим, преминавате в режим за + заместване, докато натиснете <ESC>. + + 6. Ако напишете ":set xxx", задавате настройката "xxx". Ето някои настройки: + 'ic' 'ignorecase' Търсенето не прави разлика между главни и малки букви + 'is' 'incsearch' Показва частични съвпадения на търсеното + 'hls' 'hlsearch' Осветява всички намерени съвпадения + Можете да ползвате кратките или дългите наименувания на настройките + + 7. Поставете "no" отпред за да изключите настройка: :set noic + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.1: КАК ДА НАМЕРИМ ПОМОЩ + + + ** Ползвайте наличната система за помощ ** + + Vim върви с изчерпателна система за помощ. За да започнете, опитайте някоя от + следните три възможности: + - натиснете клавиша <HELP> (ако имате такъв на клавиатурата си) + - натиснете клавиша <F1> (ако имате такъв на клавиатурата си) + - напишете :help <ENTER> + + Прочетете текста в прозореца за помощ, за да разберете как работи системата. + Натиснете CTRL-W CTRL-W (два пъти CTRL-W), за да прескочите от един прозорец в друг. + Въведете :q <ENTER> , за да затворите прозореца за помощ. + + Можете да намерите помощ по всякакъв въпрос, като напишете + ":help" именакоманда. Опитайте следните (не забравяйте да натискате <ENTER>): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.2: СЪЗДАЙТЕ СКРИПТ ЗА СТАРТИРАНЕ + + + ** Включване на възможностите на Vim ** + + Vim има много повече възможности от Vi, но по подразбиране повечето от тях не + са включени. За да започнете да ползвате тези възможности, трябва да + създадете файл, наречен "vimrc". + + 1. Създайте вашия файл "vimrc". В зависимост от вашата операционна система: + :e ~/.vimrc за всеки вид Unix + :e $VIM/_vimrc за MS-Windows + + 2. Сега прочетете съдържанието на примерния файл "vimrc": + :r $VIMRUNTIME/vimrc_example.vim + + 3. Запишете файла с: + :w + + Следващият път като пуснете Vim той ще осветява текста във файловете, които + отваряте в зависимост от синтаксиса им. Можете да добавите всичките си + предпочитани настройки в този файл. За повече информация, въведете + :help vimrc-intro + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.3: ДОВЪРШВАНЕ + + + ** Довършване на команди с CTRL-D и <TAB> ** + + 1. Уверете се, че Vim е в несъвместим режим: :set nocp + + 2. Вижте какви файлове има в папката ви: :!ls или :!dir + + 3. Въведете началото на команда: :e + + 4. Натиснете CTRL-D и Vim ще ви покаже команди, започващи с "e". + + 5. Натиснете <TAB> и Vim ще допълни командата до ":edit". + + 6. Сега добавете празно пространство и началото на името на съществуващ файл: + :edit FIL + + 7. Натиснете <TAB>. Vim ще допълни името (ако е единствено). + +Важно! Допълването работи за много команди. Просто натиснете CTRL-D и/или + <TAB>. Особено полезно е при намиране на помощ :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7 ОБОБЩЕНИЕ + + + 1. Напишете :help или натиснете <F1> или <Help> за да отворите помощния + прозорец. + + 2. Напишете :help cmd , за да намерите помощ за cmd . + + 3. Натиснете CTRL-W CTRL-W , за да прескочите в друг прозорец. + 4. Напишете :q , за да затворите помощния прозорец. + + 5. Създайте файл за стартиране vimrc, за да запазите предпочитаните от вас + настройки. + + 6. Когато въвеждате команда след : , натиснете CTRL-D , за да видите + възможностите за допълване. Натиснете <TAB> , за да използвате някоя от + предложените възможности за допълване. + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + С това завършва Самоучителят на Vim. Той бе предназначен да даде кратък + преглед на текстовия редактор Vim. Съвсем достатъчно, за да можете да + ползвате редактора лесно. Самоучителят е доста непълен, понеже Vim има много + повече команди. Сега прочете наръчника за потребителя: ":help user-manual". + + Препоръчваме следната книга за по-нататъшно четене: + Vim - Vi Improved - от Steve Oualline + Издател: New Riders + Това е първата книга, изцяло посветена на Vim. Особено полезна е за + начинаещи. В нея ще намерите много примери и картинки. + Вижте http://iccf-holland.org/click5.html + + Следната книга е по-стара и по-скоро за Vi отколкото за Vim, но също се препоръчва: + Learning the Vi Editor - от Linda Lamb + Издател: O'Reilly & Associates Inc. + Това е книга, която ще ви запознае с почти всичко във Vi. + Шестото издание включва и информация за Vim. + + Този самоучител е написан от Michael C. Pierce и Robert K. Ware, + Colorado School of Mines, като използва идеи предоставени от Charles Smith, + Colorado State University. E-mail: bware@mines.colorado.edu. + + Променен за Vim от Bram Moolenaar. + + Превод от Красимир Беров <berov@cpan.org>, юли 2016. + Този превод е подарък за сина ми Павел и е посветен на българските деца. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + diff --git a/runtime/tutor/tutor.cs b/runtime/tutor/tutor.cs index baaef66b36..6cbd520515 100644 --- a/runtime/tutor/tutor.cs +++ b/runtime/tutor/tutor.cs @@ -17,7 +17,7 @@ mohly b To znamen, e je poteba si pkazy vyzkouet pro jejich sprvn nauen. Pokud si jen te text, pkazy zapomene! - Nyn se pesvdte, e Shift-Lock NEN stlaen a nkolikrt stisknte + Nyn se pesvdte, e Caps-Lock NEN stlaen a nkolikrt stisknte klvesu j aby se kurzor posunul natolik, e lekce 1.1 zapln celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.cs.cp1250 b/runtime/tutor/tutor.cs.cp1250 index 93fd7b7b26..0d05bfb063 100644 --- a/runtime/tutor/tutor.cs.cp1250 +++ b/runtime/tutor/tutor.cs.cp1250 @@ -17,7 +17,7 @@ To znamen, e je poteba si pkazy vyzkouet pro jejich sprvn nauen. Pokud si jen te text, pkazy zapomene! - Nyn se pesvdte, e Shift-Lock NEN stlaen a nkolikrt stisknte + Nyn se pesvdte, e Caps-Lock NEN stlaen a nkolikrt stisknte klvesu j aby se kurzor posunul natolik, e lekce 1.1 zapln celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.cs.utf-8 b/runtime/tutor/tutor.cs.utf-8 index c880d6df53..97a195333c 100644 --- a/runtime/tutor/tutor.cs.utf-8 +++ b/runtime/tutor/tutor.cs.utf-8 @@ -17,7 +17,7 @@ To znamená, že je potřeba si příkazy vyzkoušet pro jejich správné naučení. Pokud si jen čteš text, příkazy zapomeneš! - Nyní se přesvědčte, že Shift-Lock NENÍ stlačený a několikrát stiskněte + Nyní se přesvědčte, že Caps-Lock NENÍ stlačený a několikrát stiskněte klávesu j aby se kurzor posunul natolik, že lekce 1.1 zaplní celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.de b/runtime/tutor/tutor.de index a78335a87a..f3bd86cc5a 100644 --- a/runtime/tutor/tutor.de +++ b/runtime/tutor/tutor.de @@ -1,11 +1,11 @@ =============================================================================== -= W i l l k o m m e n im V I M T u t o r - Version 1.7D = += W i l l k o m m e n im V I M T u t o r - Version 1.7.de.1 = =============================================================================== Vim ist ein sehr mchtiger Editor, der viele Befehle bereitstellt; zu viele, um alle in einem Tutor wie diesem zu erklren. Dieser Tutor ist so gestaltet, um genug Befehle vorzustellen, dass Du die Fhigkeit erlangst, - Vim mit Leichtigkeit als einen Allzweck-Editor zu benutzen. + Vim mit Leichtigkeit als einen Allzweck-Editor zu verwenden. Die Zeit fr das Durcharbeiten dieses Tutors betrgt ca. 25-30 Minuten, abhngig davon, wie viel Zeit Du mit Experimentieren verbringst. @@ -15,11 +15,11 @@ aufgerufen hast, ist dies bereits eine Kopie). Es ist wichtig, sich zu vergegenwrtigen, dass dieser Tutor fr das Anwenden - konzipiert ist. Das bedeutet, dass Du die Befehle ausfhren musst, um sie + konzipiert ist. Das bedeutet, dass Du die Befehle anwenden musst, um sie richtig zu lernen. Wenn Du nur den Text liest, vergisst Du die Befehle! - Jetzt stelle sicher, dass Deine Umstelltaste NICHT gedrckt ist und bettige - die j Taste gengend Male, um den Cursor nach unten zu bewegen, so dass + Jetzt stelle sicher, dass deine Umstelltaste NICHT gedrckt ist und bettige + die j Taste gengend Mal, um den Cursor nach unten zu bewegen, so dass Lektion 1.1 den Bildschirm vollkommen ausfllt. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.1: BEWEGEN DES CURSORS @@ -37,18 +37,18 @@ 3. Benutze die Nach-Unten-Taste, um Dich zu Lektion 1.2 zu bewegen. -Bemerkung: Immer, wenn Du Dir unsicher bist ber das, was Du getippt hast, +Anmerkung: Immer, wenn Du Dir unsicher bist ber das, was Du getippt hast, drcke <ESC> , um Dich in den Normalmodus zu begeben. Dann gib das gewnschte Kommando noch einmal ein. -Bemerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du +Anmerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du hjkl benutzt, wirst Du in der Lage sein, Dich sehr viel schneller umherzubewegen, wenn Du Dich einmal daran gewhnt hast. Wirklich! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.2: VIM BEENDEN - !! ACHTUNG: Bevor Du einen der unten aufgefhrten Schritte ausfhrst, lies + !! Hinweis: Bevor Du einen der unten aufgefhrten Schritte ausfhrst, lies diese gesamte Lektion!! 1. Drcke die <ESC> Taste (um sicherzustellen, dass Du im Normalmodus bist). @@ -63,28 +63,28 @@ Bemerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du fhre Schritte 1 bis 3 aus, um den Editor zu verlassen und wieder hineinzugelangen. -Bemerkung: :q! <ENTER> verwirft alle nderungen, die Du gemacht hast. In - einigen Lektionen lernst Du , die nderungen in einer Datei zu speichern. +Anmerkung: :q! <ENTER> verwirft alle nderungen, die Du gemacht hast. Einige + Lektionen spter lernst Du, die nderungen in einer Datei zu speichern. 5. Bewege den Cursor abwrts zu Lektion 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.3: TEXT EDITIEREN - LSCHEN - ** Drcke x um das Zeichen unter dem Cursor zu lschen. ** + ** Drcke x , um das Zeichen unter dem Cursor zu lschen. ** 1. Bewege den Cursor zu der mit ---> markierten Zeile unten. - 2. Um die Fehler zu beheben, bewege den Cursor, bis er auf dem Zeichen steht, + 2. Um die Fehler zu beheben, bewege den Cursor, bis er ber dem Zeichen steht, das gelscht werden soll. - 3. Drcke die x Taste, um das berflssige Zeichen zu lschen. + 3. Drcke die x Taste, um das unerwnschte Zeichen zu lschen. 4. Wiederhole die Schritte 2 bis 4, bis der Satz korrekt ist. ----> Die Kkuh sprangg bber deen Moond. +---> Die Kkuh sprangg bberr deen Moond. - 5. Wenn nun die Zeile korrekt ist, gehe weiter zur Lektion 1.4. + 5. Nun, da die Zeile korrekt ist, gehe weiter zur Lektion 1.4. Anmerkung: Whrend Du durch diesen Tutor gehst, versuche nicht, auswendig zu lernen, lerne vielmehr durch Anwenden. @@ -99,13 +99,13 @@ Anmerkung: W 1. Bewege den Cursor zur ersten unten stehenden mit ---> markierten Zeile. 2. Um die erste Zeile mit der zweiten gleichzumachen, bewege den Cursor auf - das erste Zeichen NACH der Stelle, wo der Text eingefgt werden soll. + das erste Zeichen NACH der Stelle, an der Text eingefgt werden soll. - 3. Drcke i und gib die notwendigen Ergnzungen ein. + 3. Drcke i und gib die ntigen Ergnzungen ein. 4. Wenn jeweils ein Fehler beseitigt ist, drcke <ESC> , um zum Normalmodus zurckzukehren. - Wiederhole die Schritte 2 bis 4, um den Satz zu korrigieren. + Wiederhole Schritte 2 bis 4, um den Satz zu korrigieren. ---> In dieser ft etwas . ---> In dieser Zeile fehlt etwas Text. @@ -120,15 +120,15 @@ Anmerkung: W ** Drcke A , um Text anzufgen. ** 1. Bewege den Cursor zur ersten unten stehenden mit ---> markierten Zeile. - Es ist gleichgltig, auf welchem Zeichen der Zeile der Cursor steht. + Dabei ist gleichgltig, auf welchem Zeichen der Zeile der Cursor steht. - 2. Drcke A und gib die ntigen Ergnzungen ein. + 2. Drcke A und gib die erforderlichen Ergnzungen ein. 3. Wenn das Anfgen abgeschlossen ist, drcke <ESC>, um in den Normalmodus zurckzukehren. 4. Bewege den Cursor zur zweiten mit ---> markierten Zeile und wiederhole - die Schritte 2 und 3, um den Satz zu korrigieren. + die Schritte 2 und 3, um den Satz zu auszubessern. ---> In dieser Zeile feh In dieser Zeile fehlt etwas Text. @@ -139,26 +139,28 @@ Anmerkung: W ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.6: EINE DATEI EDITIEREN + ** Benutze :wq , um eine Datei zu speichern und Vim zu verlassen. ** - ** Benutze :wq , um eine Datei zu speichern und Vim zu verlassen. ** - - !! ACHTUNG: Bevor Du einen der unten aufgefhrten Schritte ausfhrst, lies + !! Hinweis: Bevor Du einen der unten aufgefhrten Schritte ausfhrst, lies diese gesamte Lektion!! - 1. Verlasse den Editor so wie in Lektion 1.2: :q! + 1. Verlasse den Editor so wie in Lektion 1.2: :q! + Oder, falls du Zugriff zu einem anderen Terminal hast, fhre das + Folgende dort aus. 2. Gib dieses Kommando in die Eingabeaufforderung ein: vim tutor <ENTER> 'vim' ist der Aufruf des Editors, 'tutor' ist die zu editierende Datei. - Benutze eine Datei, die gendert werden kann. + Benutze eine Datei, die gendert werden darf. - 3. Fge Text ein oder lsche ihn, wie Du in den vorigen Lektionen gelernt - hast. + 3. Fge Text ein oder lsche ihn, wie Du in den vorangehenden Lektionen + gelernt hast. - 4. Speichere die genderte Datei und verlasse Vim mit: :wq <ENTER> + 4. Speichere die genderte Datei und verlasse Vim mit: :wq <ENTER> - 5. Starte den vimtutor neu und bewege Dich zu der folgenden Zusammenfassung. + 5. Falls Du in Schritt 1 den vimtutor beendet hast, starte vimtutor neu und + bewege dich abwrts bis zur folgenden Zusammenfassung. - 6. Nachdem Du obige Schritte gelesen und verstanden hast, fhre sie durch. + 6. Nachdem Du obige Schritte gelesen und verstanden hast: fhre sie durch. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 1 @@ -166,19 +168,18 @@ Anmerkung: W 1. Der Cursor wird mit den Pfeiltasten oder den Tasten hjkl bewegt. h (links) j (unten) k (aufwrts) l (rechts) - 2. Um Vim von der Eingabeaufforderung auszufhren, tippe: vim DATEI <ENTER> + 2. Um Vim aus der Eingabeaufforderung zu starten, tippe: vim DATEI <ENTER> 3. Um Vim zu verlassen und alle nderungen zu verwerfen, tippe: <ESC> :q! <ENTER> . - ODER tippe: <ESC> :wq <ENTER> , um die nderungen zu speichern. 4. Um das Zeichen unter dem Cursor zu lschen, tippe: x 5. Um Text einzufgen oder anzufgen, tippe: i Einzufgenden Text eingeben <ESC> Einfgen vor dem Cursor - A Anzufgenden Text eingeben <ESC> Anfgen nach dem Zeilendene + A Anzufgenden Text eingeben <ESC> Anfgen nach dem Zeilenende -Bemerkung: Drcken von <ESC> bringt Dich in den Normalmodus oder bricht ein +Anmerkung: Drcken von <ESC> bringt Dich in den Normalmodus oder bricht ein ungewolltes, erst teilweise eingegebenes Kommando ab. Nun fahre mit Lektion 2 fort. @@ -188,7 +189,7 @@ Bemerkung: Dr ** Tippe dw , um ein Wort zu lschen. ** - 1. Drcke <ESC> um sicherzustellen, dass Du im Normalmodus bist. + 1. Drcke <ESC> , um sicherzustellen, dass Du im Normalmodus bist. 2. Bewege den Cursor zu der mit ---> markierten Zeile unten. @@ -196,15 +197,15 @@ Bemerkung: Dr 4. Tippe dw , um das Wort zu entfernen. - Bemerkung: Der Buchstabe d erscheint auf der letzten Zeile des Bildschirms, - wenn Du ihn eingibst. Vim wartet darauf, da Du w eingibst. Wenn Du - ein anderes Zeichen als d siehst, hast Du etwas falsches getippt; - drcke <ESC> und beginne neu. + Anmerkung: Der Buchstabe d erscheint auf der untersten Zeile des Schirms, + wenn Du ihn eingibst. Vim wartet darauf, dass Du w eingibst. Falls Du + ein anderes Zeichen als d siehst, hast Du etwas Falsches getippt; + drcke <ESC> und beginne noch einmal. ---> Einige Wrter lustig gehren nicht Papier in diesen Satz. 5. Wiederhole die Schritte 3 und 4, bis der Satz korrekt ist und gehe - danach zur Lektion 2.2. + zur Lektion 2.2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 2.2: WEITERE LSCHKOMMANDOS @@ -217,12 +218,12 @@ Bemerkung: Dr 3. Bewege den Cursor zum Ende der korrekten Zeile (NACH dem ersten . ). - 4. Tippe d$ , um bis zum Ende der Zeile zu lschen. + 4. Tippe d$ , um bis zum Zeilenende zu lschen. ---> Jemand hat das Ende der Zeile doppelt eingegeben. doppelt eingegeben. - 5. Gehe weiter zur Lektion 2.3 , um zu verstehen, was hierbei passiert. + 5. Gehe weiter zur Lektion 2.3 , um zu verstehen, was hierbei vorgeht. @@ -240,16 +241,16 @@ Bemerkung: Dr wobei: d - der Lschoperator - Bewegung - worauf der Lschoperator angewandt wird (unten aufgelistet). + Bewegung - worauf der Lschoperator angewandt wird (unten aufgefhrt). Eine kleine Auflistung von Bewegungen: w - bis zum Beginn des nchsten Wortes OHNE dessen erstes Zeichen. e - zum Ende des aktuellen Wortes MIT dessen letztem Zeichen. - $ - zum Ende der Zeile MIT dem letzen Zeichen. + $ - zum Ende der Zeile MIT dem letzten Zeichen. Dementsprechend lscht die Eingabe von de vom Cursor an bis zum Wortende. -Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den +Anmerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den Cursor entsprechend. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 2.4: ANWENDUNG EINES ZHLERS FR EINEN BEWEGUNGSSCHRITT @@ -265,9 +266,9 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 4. Tippe 0 (Null) , um zum Anfang der Zeile zu gelangen. - 5. Wiederhole Schritte 2 und 3 mit verschiedenen Zhlern. + 5. Wiederhole Schritte 2 und 3 mit verschiedenen Nummern. - ---> Dies ist nur eine Zeile aus Wrten um sich darin herumzubewegen. + ---> Dies ist nur eine Zeile aus Wrtern, um sich darin herumzubewegen. 6. Gehe weiter zu Lektion 2.5. @@ -280,8 +281,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ** Die Eingabe einer Zahl mit einem Operator wiederholt diesen mehrfach. ** - Fr die Kombination des Lschoperators und einem Bewegungsschritt (siehe - oben) stellt man dem Bewegungsschritt einen Zhler voran, um mehr zu lschen: + In der Kombination aus Lschoperator und Bewegungsschritt (siehe oben) + stellt man, um mehr zu lschen dem Schritt einen Zhler voran: d Nummer Bewegungsschritt 1. Bewege den Cursor zum ersten Wort in GROSSBUCHSTABEN in der mit ---> @@ -289,9 +290,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 2. Tippe d2w , um die zwei Wrter in GROSSBUCHSTABEN zu lschen. - 3. Wiederhole Schritte 1 und 2 mit einem anderen Zhler, um die - darauffolgenden Wrter in GROSSBUCHSTABEN mit einem einzigen Kommando - zu lschen. + 3. Wiederhole Schritte 1 und 2 mit einem anderen Zhler, um die darauffol- + genden Wrter in GROSSBUCHSTABEN mit einem einzigen Kommando zu lschen. ---> Diese ABC DE Zeile FGHI JK LMN OP mit Wrtern ist Q RS TUV bereinigt. @@ -325,12 +325,12 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ** Tippe u , um die letzten Kommandos rckgngig zu machen ** - ** oder U um eine ganze Zeile wiederherzustellen. ** + ** oder U , um eine ganze Zeile wiederherzustellen. ** 1. Bewege den Cursor zu der mit ---> markierten Zeile unten und setze ihn auf den ersten Fehler. 2. Tippe x , um das erste unerwnschte Zeichen zu lschen. - 3. Nun tippe u um das soeben ausgefhrte Kommando rckgngig zu machen. + 3. Nun tippe u , um das soeben ausgefhrte Kommando rckgngig zu machen. 4. Jetzt behebe alle Fehler auf der Zeile mit Hilfe des x Kommandos. 5. Nun tippe ein groes U , um die Zeile in ihren Ursprungszustand wiederherzustellen. @@ -341,8 +341,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ---> Beehebe die Fehller diesser Zeile und sttelle sie mitt 'undo' wieder her. - 8. Dies sind sehr ntzliche Kommandos. - Nun gehe weiter zur Zusammenfassung von Lektion 2. + 8. Dies sind sehr ntzliche Kommandos. Nun gehe weiter zur Zusammenfassung + von Lektion 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 2 @@ -357,7 +357,7 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den wobei: Operator - gibt an, was getan werden soll, zum Beispiel d fr delete [Anzahl] - ein optionaler Zhler, um den Bewegungsschritt zu wiederholen - Bewegungsschritt - Bewegung ber den zu ndernden Text, so wie + Bewegungsschritt - Bewegung ber den zu ndernden Text, wie w (Wort), $ (zum Ende der Zeile), etc. 6. Um Dich zum Anfang der Zeile zu begeben, benutze die Null: 0 @@ -387,7 +387,7 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ---> d) Kannst Du das auch? ---> b) Veilchen sind blau, ----> c) Intelligenz ist erlernbar, +---> c) Intelligenz ist lernbar, ---> a) Rosen sind rot, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 3.2: ERSETZEN (REPLACE) @@ -403,13 +403,13 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 4. Wiederhole Schritte 2 und 3, bis die erste Zeile gleich der zweiten ist. ----> Als diese Zeite eingegoben wurde, wurden einike falsche Tasten gelippt! +---> Alf diese Zeite eingegoben wurde, wurden einike falsche Tasten gelippt! ---> Als diese Zeile eingegeben wurde, wurden einige falsche Tasten getippt! 5. Nun fahre fort mit Lektion 3.2. -Bemerkung: Erinnere Dich, dass Du durch Anwenden lernen solltest, nicht durch - Auswendiglernen. +Anmerkung: Erinnere Dich daran, dass Du durch Anwenden lernen solltest, nicht + durch Auswendiglernen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -431,7 +431,7 @@ Bemerkung: Erinnere Dich, dass Du durch Anwenden lernen solltest, nicht durch ---> Einige Wstwr dieser Zlaww lasdjlaf mit dem ndern-Operator gaaauu werden. ---> Einige Wrter dieser Zeile sollen mit dem ndern-Operator gendert werden. -Bemerke, dass ce das Wort lscht und Dich in den Eingabemodus versetzt. +Beachte, dass ce das Wort lscht und Dich in den Eingabemodus versetzt. @@ -457,7 +457,7 @@ Bemerke, dass ce das Wort l ---> Das Ende dieser Zeile soll an die zweite Zeile angeglichen werden. ---> Das Ende dieser Zeile soll mit dem c$ Kommando korrigiert werden. -Bemerkung: Du kannst die Rcktaste benutzen, um Tippfehler zu korrigieren. +Anmerkung: Du kannst die Rcktaste benutzen, um Tippfehler zu korrigieren. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 3 @@ -466,8 +466,8 @@ Bemerkung: Du kannst die R gelschten Text NACH dem Cursor an (wenn eine ganze Zeile gelscht wurde, wird diese in die Zeile unter dem Cursor eingefgt). - 2. Um das Zeichen unter dem Cursor zu ersetzen, tippe r und das an dieser - Stelle gewnschte Zeichen. + 2. Um das Zeichen unter dem Cursor zu ersetzen, tippe r und danach das + an dieser Stelle gewollte Zeichen. 3. Der nderungs- (change) Operator erlaubt, vom Cursor bis zum Ende des Bewegungsschrittes zu ndern. Tippe ce , um eine nderung vom Cursor bis @@ -484,17 +484,18 @@ Bemerkung: Du kannst die R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 4.1: CURSORPOSITION UND DATEISTATUS - ** Tippe CTRL-G , um Deine Dateiposition sowie den Dateistatus anzuzeigen. ** + ** Tippe CTRL-G , um deine Dateiposition sowie den Dateistatus anzuzeigen. ** ** Tippe G , um Dich zu einer Zeile in der Datei zu begeben. ** -Bemerkung: Lies diese gesamte Lektion, bevor Du irgendeinen Schritt ausfhrst!! +Anmerkung: Lies diese gesamte Lektion, bevor Du irgendeinen Schritt ausfhrst!! - 1. Halte die Ctrl Taste unten und drcke g . Dies nennen wir wir CTRL-G. + 1. Halte die Ctrl Taste unten und drcke g . Dies nennen wir CTRL-G. Eine Statusmeldung am Fu der Seite erscheint mit dem Dateinamen und der Position innerhalb der Datei. Merke Dir die Zeilennummer fr Schritt 3. -Bemerkung: Mglicherweise siehst Du die Cursorposition in der unteren rechten - Bildschirmecke. Dies ist Folge der 'ruler' Option (siehe :help 'ruler') +Anmerkung: Mglicherweise siehst Du die Cursorposition in der unteren rechten + Bildschirmecke. Dies ist Auswirkung der 'ruler' Option + (siehe :help 'ruler') 2. Drcke G , um Dich zum Ende der Datei zu begeben. Tippe gg , um Dich zum Anfang der Datei zu begeben. @@ -510,7 +511,7 @@ Bemerkung: M ** Tippe / gefolgt von einem Ausdruck, um nach dem Ausdruck zu suchen. ** - 1. Im Normalmodus, tippe das / Zeichen. Bemerke, dass das / und der + 1. Im Normalmodus, tippe das / Zeichen. Beachte, dass das / und der Cursor am Fu des Schirms erscheinen, so wie beim : Kommando. 2. Nun tippe 'Fehhler' <ENTER>. Dies ist das Wort, nach dem Du suchen willst. @@ -521,32 +522,32 @@ Bemerkung: M 4. Um nach einem Ausdruck rckwrts zu suchen , benutze ? statt / . 5. Um dahin zurckzukehren, von wo Du gekommen bist, drcke CTRL-O (Halte - Ctrl unten und drcke den Buchstaben o). Wiederhole dies, um weiter - zurckzugehen. CTRL-I bringt dich vorwrts. + Ctrl unten und drcke den Buchstaben o). Wiederhole dies, um noch weiter + zurckzugehen. CTRL-I geht vorwrts. ---> Fehler schreibt sich nicht "Fehhler"; Fehhler ist ein Fehler -Bemerkung: Wenn die Suche das Dateiende erreicht hat, wird sie am Anfang +Anmerkung: Wenn die Suche das Dateiende erreicht hat, wird sie am Anfang fortgesetzt, es sei denn, die 'wrapscan' Option wurde abgeschaltet. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 4.3: PASSENDE KLAMMERN FINDEN - ** Tippe % , um eine korrespondierende Klammer ),], oder } zu finden. ** + ** Tippe % , um eine gegenberliegenden Klammer ),], oder } zu finden. ** - 1. Platziere den Cursor auf irgendeines der Zeichen (, [, oder { in der unten + 1. Platziere den Cursor auf irgendeinem der Zeichen (, [, oder { in der unten stehenden Zeile, die mit ---> markiert ist. 2. Nun tippe das % Zeichen. 3. Der Cursor bewegt sich zur passenden gegenberliegenden Klammer. - 4. Tippe % , um den Cursor zur anderen passenden Klammer zu bewegen. + 4. Tippe % , um den Cursor zur passenden anderen Klammer zu bewegen. 5. Setze den Cursor auf ein anderes (,),[,],{ oder } und probiere % aus. ---> Dies ( ist eine Testzeile ( mit [ verschiedenen ] { Klammern } darin. )) -Bemerkung: Diese Funktionalitt ist sehr ntzlich bei der Fehlersuche in einem +Anmerkung: Diese Funktionalitt ist sehr ntzlich bei der Fehlersuche in einem Programmtext, in dem passende Klammern fehlen! @@ -558,18 +559,18 @@ Bemerkung: Diese Funktionalit 1. Bewege den Cursor zu der unten stehenden mit ---> markierten Zeile. - 2. Tippe :s/diee/die <ENTER> . Bemerke, dass der Befehl nur das erste + 2. Tippe :s/diee/die <ENTER> . Beachte, dass der Befehl nur das erste Vorkommen von "diee" ersetzt. 3. Nun tippe :s/diee/die/g . Das Zufgen des Flags g bedeutet, eine - globale Ersetzung ber die Zeile durchzufhren, was alle Vorkommen von - "diee" auf der Zeile ersetzt. + globale Ersetzung ber die Zeile durchzufhren, dies ersetzt alle + Vorkommen von "diee" auf der Zeile. ---> diee schnste Zeit, um diee Blumen anzuschauen, ist diee Frhlingszeit. 4. Um alle Vorkommen einer Zeichenkette innerhalb zweier Zeilen zu ndern, - tippe :#,#s/alt/neu/g wobei #,# die Zeilennummern des Zeilenbereiches - sind, in dem die Ersetzung durchgefhrt werden soll. + tippe :#,#s/alt/neu/g wobei #,# die Zeilennummern des Bereiches sind, + in dem die Ersetzung durchgefhrt werden soll. Tippe :%s/alt/neu/g um alle Vorkommen in der gesamten Datei zu ndern. Tippe :%s/alt/neu/gc um alle Vorkommen in der gesamten Datei zu finden mit einem Fragedialog, ob ersetzt werden soll oder nicht. @@ -593,9 +594,9 @@ Bemerkung: Diese Funktionalit 4. Um das erste Vorkommen von "alt" in einer Zeile durch "neu" zu ersetzen, tippe :s/alt/neu Um alle Vorkommen von "alt" in der Zeile ersetzen, tippe :s/alt/neu/g - Um Ausdrcke innerhalb zweier Zeilennummern zu ersetzen, :#,#s/alt/neu/g + Um Ausdrcke innerhalb zweier Zeilen # zu ersetzen :#,#s/alt/neu/g Um alle Vorkommen in der ganzen Datei zu ersetzen, tippe :%s/alt/neu/g - Fr eine jedmalige Besttigung, addiere 'c' (confirm) :%s/alt/neu/gc + Fr eine jedesmalige Besttigung, addiere 'c' (confirm) :%s/alt/neu/gc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.1: AUSFHREN EINES EXTERNEN KOMMANDOS @@ -608,14 +609,14 @@ Bemerkung: Diese Funktionalit 2. Nun tippe ein ! (Ausrufezeichen). Dies ermglicht Dir, ein beliebiges, externes Shellkommando auszufhren. - 3. Als Beispiel tippe ls nach dem ! und drcke <ENTER>. Dies zeigt - eine Auflistung Deines Verzeichnisses; genauso, als wenn Du auf der + 3. Als Beispiel tippe ls nach dem ! und drcke <ENTER>. Dies liefert + eine Auflistung deines Verzeichnisses; genauso, als wenn Du in der Eingabeaufforderung wrst. Oder verwende :!dir , falls ls nicht geht. -Bemerkung: Mit dieser Methode kann jedes beliebige externe Kommando +Anmerkung: Mit dieser Methode kann jedes beliebige externe Kommando ausgefhrt werden, auch mit Argumenten. -Bemerkung: Alle : Kommandos mssen durch Eingabe von <ENTER> +Anmerkung: Alle : Kommandos mssen durch Eingabe von <ENTER> abgeschlossen werden. Von jetzt an erwhnen wir dies nicht jedesmal. @@ -625,7 +626,7 @@ Bemerkung: Alle : Kommandos m ** Um am Text durchgefhrte nderungen zu speichern, tippe :w DATEINAME. ** - 1. Tippe :!dir oder :!ls , um eine Auflistung Deines Verzeichnisses zu + 1. Tippe :!dir oder :!ls , um eine Auflistung deines Verzeichnisses zu erhalten. Du weit nun bereits, dass Du danach <ENTER> eingeben musst. 2. Whle einen Dateinamen, der noch nicht existiert, z.B. TEST. @@ -633,15 +634,15 @@ Bemerkung: Alle : Kommandos m 3. Nun tippe: :w TEST (wobei TEST der gewhlte Dateiname ist). 4. Dies speichert die ganze Datei (den Vim Tutor) unter dem Namen TEST. - Um dies zu berprfen, tippe nochmals :!ls bzw. !dir, um Deinen + Um dies zu berprfen, tippe nochmals :!ls bzw. !dir, um deinen Verzeichnisinhalt zu sehen. -Bemerkung: Wrdest Du Vim jetzt beenden und danach wieder mit vim TEST +Anmerkung: Wrdest Du Vim jetzt beenden und danach wieder mit vim TEST starten, dann wre diese Datei eine exakte Kopie des Tutors zu dem Zeitpunkt, als Du ihn gespeichert hast. 5. Nun entferne die Datei durch Eingabe von (MS-DOS): :!del TEST - oder (Unix): :!rm TEST + oder (Unix): :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.3: AUSWHLEN VON TEXT ZUM SCHREIBEN @@ -650,41 +651,42 @@ Bemerkung: W 1. Bewege den Cursor zu dieser Zeile. 2. Tippe v und bewege den Cursor zum fnften Auflistungspunkt unten. - Bemerke, da der Text hervorgehoben wird. + Beachte, dass der Text hervorgehoben wird. 3. Drcke das Zeichen : . Am Fu des Schirms erscheint :'<,'> . 4. Tippe w TEST , wobei TEST ein noch nicht vorhandener Dateiname ist. - Vergewissere Dich, da Du :'<,'>w TEST siehst, bevor Du Enter drckst. + Vergewissere Dich, dass Du :'<,'>w TEST siehst, bevor Du <ENTER> drckst. 5. Vim schreibt die ausgewhlten Zeilen in die Datei TEST. Benutze :!dir oder :!ls , um sie zu sehen. Lsche sie noch nicht! Wir werden sie in der nchsten Lektion benutzen. -Bemerkung: Drcken von v startet die Visuelle Auswahl. Du kannst den Cursor - umherbewegen, um die Auswahl grer oder kleiner zu machen. Anschlieend - kann man einen Operator anwenden, um mit dem Text etwas zu tun. Zum - Beispiel lscht d den Text. +Hinweis: Drcken von v startet die Visuelle Auswahl. Du kannst den Cursor + umherbewegen, um die Auswahl zu vergrern oder zu verkleinern. Anschlieend + lsst sich ein Operator anwenden, um mit dem Text etwas zu tun. Zum Beispiel + lscht d den Text. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.4: EINLESEN UND ZUSAMMENFHREN VON DATEIEN ** Um den Inhalt einer Datei einzulesen, tippe :r DATEINAME ** - 1. Platziere den Cursor berhalb dieser Zeile. + 1. Platziere den Cursor direkt ber dieser Zeile. BEACHTE: Nachdem Du Schritt 2 ausgefhrt hast, wirst Du Text aus Lektion 5.3 - sehen. Dann bewege Dich wieder ABWRTS, um diese Lektion wiederzusehen. + sehen. Dann bewege Dich wieder ABWRTS, Lektion 5.4 wiederzusehen. - 2. Nun lies Deine Datei TEST ein indem Du das Kommando :r TEST ausfhrst, + 2. Nun lies deine Datei TEST ein indem Du das Kommando :r TEST ausfhrst, wobei TEST der von Dir verwendete Dateiname ist. Die eingelesene Datei wird unterhalb der Cursorzeile eingefgt. - 3. Um zu berprfen, dass die Datei eingelesen wurde, gehe zurck und siehe, - dass es jetzt zwei Kopien von Lektion 5.3 gibt, das Original und die - eingefgte Dateiversion. + 3. Um zu berprfen, dass die Datei eingelesen wurde, gehe zurck und + beachte, dass es jetzt zwei Kopien von Lektion 5.3 gibt, das Original und + die eingefgte Dateiversion. -Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum +Anmerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum Beispiel liest :r !ls die Ausgabe des Kommandos ls ein und platziert sie unterhalb des Cursors. @@ -720,14 +722,14 @@ Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum 1. Bewege den Cursor zu der ersten mit ---> markierten Zeile unten. - 2. Tippe o (klein geschrieben), um eine Zeile UNTERHALB des Cursos zu ffnen + 2. Tippe o (klein geschrieben), um eine Zeile UNTERHALB des Cursors zu ffnen und Dich in den Einfgemodus zu begeben. 3. Nun tippe etwas Text und drcke <ESC> , um den Einfgemodus zu verlassen. ---> Mit o wird der Cursor auf der offenen Zeile im Einfgemodus platziert. - 4. Um eine Zeile BERHALB des Cursos aufzumachen, gib einfach ein groes O + 4. Um eine Zeile BERHALB des Cursors aufzumachen, gib einfach ein groes O statt einem kleinen o ein. Versuche dies auf der unten stehenden Zeile. ---> ffne eine Zeile ber dieser mit O , wenn der Cursor auf dieser Zeile ist. @@ -755,7 +757,7 @@ Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum ---> Diese Zei bietet Gelegen , Text in einer Zeile anzuf. ---> Diese Zeile bietet Gelegenheit, Text in einer Zeile anzufgen. -Bemerkung: a, i und A gehen alle gleichermaen in den Einfgemodus; der +Anmerkung: a, i und A gehen alle gleichermaen in den Einfgemodus; der einzige Unterschied ist, wo die Zeichen eingefgt werden. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 6.3: EINE ANDERE ART DES ERSETZENS (REPLACE) @@ -767,9 +769,9 @@ Bemerkung: a, i und A gehen alle gleicherma Bewege den Cursor zum Anfang des ersten xxx . 2. Nun drcke R und tippe die Nummer, die darunter in der zweiten Zeile - steht, so das diese das xxx ersetzt. + steht, so dass diese das xxx ersetzt. - 3. Drcke <ESC> , um den Ersetzungsmodus zu verlassen. Bemerke, da der Rest + 3. Drcke <ESC> , um den Ersetzungsmodus zu verlassen. Beachte, dass der Rest der Zeile unverndert bleibt. 4. Wiederhole die Schritte, um das verbliebene xxx zu ersetzen. @@ -777,7 +779,7 @@ Bemerkung: a, i und A gehen alle gleicherma ---> Das Addieren von 123 zu xxx ergibt xxx. ---> Das Addieren von 123 zu 456 ergibt 579. -Bemerkung: Der Ersetzungsmodus ist wie der Einfgemodus, aber jedes eingetippte +Anmerkung: Der Ersetzungsmodus ist wie der Einfgemodus, aber jedes eingetippte Zeichen lscht ein vorhandenes Zeichen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -785,7 +787,7 @@ Bemerkung: Der Ersetzungsmodus ist wie der Einf ** Benutze den y Operator, um Text zu kopieren; p , um ihn einzufgen ** - 1. Gehe zu der mit ---> markierten Zeile unten, setze den Cursor hinter "a)". + 1. Gehe zu der mit ---> markierten Zeile unten; setze den Cursor hinter "a)". 2. Starte den Visuellen Modus mit v , bewege den Cursor genau vor "erste". @@ -802,11 +804,11 @@ Bemerkung: Der Ersetzungsmodus ist wie der Einf ---> a) dies ist der erste Eintrag. b) -Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. +Anmerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 6.5: OPTIONEN SETZEN - ** Setze eine Option so, dass eine Suche oder eine Ersetzung Gro- ** + ** Setze eine Option so, dass eine Suche oder Ersetzung Gro- ** ** und Kleinschreibung ignoriert ** 1. Suche nach 'ignoriere', indem Du /ignoriere eingibst. @@ -815,7 +817,7 @@ Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. 2. Setze die 'ic' (Ignore case) - Option, indem Du :set ic eingibst. 3. Nun suche wieder nach 'ignoriere', indem Du n tippst. - Bemerke, da jetzt Ignoriere und auch IGNORIERE gefunden wird. + Beachte, dass jetzt Ignoriere und auch IGNORIERE gefunden wird. 4. Setze die 'hlsearch' und 'incsearch' - Optionen: :set hls is @@ -823,14 +825,14 @@ Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. 6. Um das Ignorieren von Gro/Kleinschreibung abzuschalten, tippe: :set noic -Bemerkung: Um die Hervorhebung der Treffer zu enfernen, gib ein: :nohlsearch -Bemerkung: Um die Schreibweise fr eine einzige Suche zu ignorieren, benutze - \c im Suchausdruck: /ignoriere\c <ENTER> +Anmerkung: Um die Hervorhebung der Treffer zu entfernen, gib ein: :nohlsearch +Anmerkung: Um die Schreibweise fr eine einzige Suche zu ignorieren, benutze \c + im Suchausdruck: /ignoriere\c <ENTER> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 6 1. Tippe o , um eine Zeile UNTER dem Cursor zu ffnen und den Einfgemodus - zu starten. + zu starten Tippe O , um eine Zeile BER dem Cursor zu ffnen. 2. Tippe a , um Text NACH dem Cursor anzufgen. @@ -876,13 +878,13 @@ Bemerkung: Um die Schreibweise f Lektion 7.2: ERSTELLE EIN START-SKRIPT - ** Aktiviere die eingebauten Funktionalitten von Vim ** + ** Aktiviere die Features von Vim ** Vim besitzt viele Funktionalitten, die ber Vi hinausgehen, aber die meisten von ihnen sind standardmig deaktiviert. Um mehr Funktionalitten zu nutzen, musst Du eine "vimrc" - Datei erstellen. - 1. Starte das Editieren der "vimrc"-Datei, abhngig von Deinem System: + 1. Starte das Editieren der "vimrc"-Datei, abhngig von deinem System: :e ~/.vimrc fr Unix :e $VIM/_vimrc fr MS-Windows @@ -893,33 +895,33 @@ Bemerkung: Um die Schreibweise f :w Beim nchsten Start von Vim wird die Syntaxhervorhebung aktiviert sein. - Du kannst all Deine bevorzugten Optionen zu dieser "vimrc"-Datei zufgen. + Du kannst all deine bevorzugten Optionen zu dieser "vimrc"-Datei zufgen. Fr mehr Informationen tippe :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 7.3: VERVOLLSTNDIGEN - ** Kommandozeilenvervollstndigung mit CTRL-D and <TAB> ** + ** Kommandozeilenvervollstndigung mit CTRL-D und <TAB> ** - 1. Stelle sicher, da Vim nicht im vi-Kompatibilittsmodus ist: :set nocp + 1. Stelle sicher, dass Vim nicht im Vi-Kompatibilittsmodus ist: :set nocp 2. Siehe nach, welche Dateien im Verzeichnis existieren: :!ls oder :dir - 3. Tippe den Beginn eines Komandos: :e + 3. Tippe den Beginn eines Kommandos: :e 4. Drcke CTRL-D und Vim zeigt eine Liste mit "e" beginnender Kommandos. 5. Drcke <TAB> und Vim vervollstndigt den Kommandonamen zu ":edit". - 6. Nun fge ein Leerzeichen und den Beginn einer existierenden Datei an: + 6. Nun fge ein Leerzeichen und den Anfang einer existierenden Datei an: :edit DAT 7. Drcke <TAB>. Vim vervollstndigt den Namen (falls er eindeutig ist). -Bemerkung: Vervollstndigung funktioniert fr viele Kommandos. Versuche +Anmerkung: Vervollstndigung funktioniert fr viele Kommandos. Probiere einfach CTRL-D und <TAB>. Dies ist insbesondere ntzlich fr :help . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ZUSAMMENFASSUNG VON LEKTION 7 + ZUSAMMENFASSUNG VON LEKTION 7 1. Tippe :help oder drcke <F1> oder <Help>, um ein Hilfefenster zu ffnen. @@ -930,11 +932,11 @@ Bemerkung: Vervollst 4. Tippe :q , um das Hilfefenster zu schlieen. - 5. Erstelle ein vimrc - Startskript zur Sicherung bevorzugter Einstellungen. + 5. Erstelle ein vimrc - Startskript mit deinen bevorzugter Einstellungen. - 6. Drcke CTRL-D nach dem Tippen eines Kommandos : , um mgliche - Vervollstndigungen zu sehen. - Drcke <TAB> fr eine einzige Vervollstndigung. + 6. Drcke CTRL-D nach dem Tippen eines : Kommandos, um mgliche + Vervollstndigungen anzusehen. + Drcke <TAB> , um eine Vervollstndigung zu anzuwenden. @@ -943,13 +945,13 @@ Bemerkung: Vervollst ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Damit ist der Vim Tutor beendet. Die Intention war, einen kurzen und - bndigen berblick ber den Vim Editor zu liefern; gerade genug, um relativ + Damit ist der Vim Tutor beendet. Seine Intention war, einen kurzen und + bndigen berblick ber den Vim Editor zu geben; gerade genug, um relativ leicht mit ihm umgehen zu knnen. Der Vim Tutor hat nicht den geringsten Anspruch auf Vollstndigkeit; Vim hat noch weitaus mehr Kommandos. Lies als nchstes das User Manual: ":help user-manual". - Fr weiteres Lesen und Lernen ist folgendes Buch empfohlen : + Fr weiteres Lesen und Lernen ist folgendes Buch empfehlenswert : Vim - Vi Improved - von Steve Oualline Verlag: New Riders Das erste Buch, welches durchgngig Vim gewidmet ist. Besonders ntzlich @@ -957,7 +959,7 @@ Bemerkung: Vervollst Siehe http://iccf-holland.org/click5.html Folgendes Buch ist lter und mehr ber Vi als Vim, aber auch empfehlenswert: - Textbearbeitung mit dem vi-Editor - von Linda Lamb und Arnold Robbins + Textbearbeitung mit dem Vi-Editor - von Linda Lamb und Arnold Robbins Verlag O'Reilly - ISBN: 3897211262 In diesem Buch kann man fast alles finden, was man mit Vi tun mchte. Die sechste Ausgabe enthlt auch Informationen ber Vim. @@ -970,11 +972,11 @@ Bemerkung: Vervollst fr Einsteiger empfehlenswert. Probekapitel und die Beispielskripte sind online erhltlich. Siehe http://iccf-holland.org/click5.html - Dieses Tutorial wurde geschrieben von Michael C. Pierce and Robert K. Ware, + Dieses Tutorial wurde geschrieben von Michael C. Pierce und Robert K. Ware, Colorado School of Mines. Es benutzt Ideen, die Charles Smith, Colorado State - University, zur Verfgung stellte. E-mail: bware@mines.colorado.edu. + University, zur Verfgung stellte. E-Mail: bware@mines.colorado.edu. Bearbeitet fr Vim von Bram Moolenaar. - Deutsche bersetzung von Joachim Hofmann 2007. E-mail: Joachim.Hof@gmx.de + Deutsche bersetzung von Joachim Hofmann 2015. E-Mail: Joachim.Hof@gmx.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.de.utf-8 b/runtime/tutor/tutor.de.utf-8 index 9d5f668189..799962c8d2 100644 --- a/runtime/tutor/tutor.de.utf-8 +++ b/runtime/tutor/tutor.de.utf-8 @@ -1,11 +1,11 @@ =============================================================================== -= W i l l k o m m e n im V I M T u t o r - Version 1.7D = += W i l l k o m m e n im V I M T u t o r - Version 1.7.de.1 = =============================================================================== Vim ist ein sehr mächtiger Editor, der viele Befehle bereitstellt; zu viele, um alle in einem Tutor wie diesem zu erklären. Dieser Tutor ist so gestaltet, um genug Befehle vorzustellen, dass Du die Fähigkeit erlangst, - Vim mit Leichtigkeit als einen Allzweck-Editor zu benutzen. + Vim mit Leichtigkeit als einen Allzweck-Editor zu verwenden. Die Zeit für das Durcharbeiten dieses Tutors beträgt ca. 25-30 Minuten, abhängig davon, wie viel Zeit Du mit Experimentieren verbringst. @@ -15,11 +15,11 @@ aufgerufen hast, ist dies bereits eine Kopie). Es ist wichtig, sich zu vergegenwärtigen, dass dieser Tutor für das Anwenden - konzipiert ist. Das bedeutet, dass Du die Befehle ausführen musst, um sie + konzipiert ist. Das bedeutet, dass Du die Befehle anwenden musst, um sie richtig zu lernen. Wenn Du nur den Text liest, vergisst Du die Befehle! - Jetzt stelle sicher, dass Deine Umstelltaste NICHT gedrückt ist und betätige - die j Taste genügend Male, um den Cursor nach unten zu bewegen, so dass + Jetzt stelle sicher, dass deine Umstelltaste NICHT gedrückt ist und betätige + die j Taste genügend Mal, um den Cursor nach unten zu bewegen, so dass Lektion 1.1 den Bildschirm vollkommen ausfüllt. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.1: BEWEGEN DES CURSORS @@ -37,18 +37,18 @@ 3. Benutze die Nach-Unten-Taste, um Dich zu Lektion 1.2 zu bewegen. -Bemerkung: Immer, wenn Du Dir unsicher bist über das, was Du getippt hast, +Anmerkung: Immer, wenn Du Dir unsicher bist über das, was Du getippt hast, drücke <ESC> , um Dich in den Normalmodus zu begeben. Dann gib das gewünschte Kommando noch einmal ein. -Bemerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du +Anmerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du hjkl benutzt, wirst Du in der Lage sein, Dich sehr viel schneller umherzubewegen, wenn Du Dich einmal daran gewöhnt hast. Wirklich! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.2: VIM BEENDEN - !! ACHTUNG: Bevor Du einen der unten aufgeführten Schritte ausführst, lies + !! Hinweis: Bevor Du einen der unten aufgeführten Schritte ausführst, lies diese gesamte Lektion!! 1. Drücke die <ESC> Taste (um sicherzustellen, dass Du im Normalmodus bist). @@ -63,28 +63,28 @@ Bemerkung: Die Cursor-Tasten sollten ebenfalls funktionieren. Aber wenn Du führe Schritte 1 bis 3 aus, um den Editor zu verlassen und wieder hineinzugelangen. -Bemerkung: :q! <ENTER> verwirft alle Änderungen, die Du gemacht hast. In - einigen Lektionen lernst Du , die Änderungen in einer Datei zu speichern. +Anmerkung: :q! <ENTER> verwirft alle Änderungen, die Du gemacht hast. Einige + Lektionen später lernst Du, die Änderungen in einer Datei zu speichern. 5. Bewege den Cursor abwärts zu Lektion 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.3: TEXT EDITIEREN - LÖSCHEN - ** Drücke x um das Zeichen unter dem Cursor zu löschen. ** + ** Drücke x , um das Zeichen unter dem Cursor zu löschen. ** 1. Bewege den Cursor zu der mit ---> markierten Zeile unten. - 2. Um die Fehler zu beheben, bewege den Cursor, bis er auf dem Zeichen steht, + 2. Um die Fehler zu beheben, bewege den Cursor, bis er über dem Zeichen steht, das gelöscht werden soll. - 3. Drücke die x Taste, um das überflüssige Zeichen zu löschen. + 3. Drücke die x Taste, um das unerwünschte Zeichen zu löschen. 4. Wiederhole die Schritte 2 bis 4, bis der Satz korrekt ist. ----> Die Kkuh sprangg übber deen Moond. +---> Die Kkuh sprangg übberr deen Moond. - 5. Wenn nun die Zeile korrekt ist, gehe weiter zur Lektion 1.4. + 5. Nun, da die Zeile korrekt ist, gehe weiter zur Lektion 1.4. Anmerkung: Während Du durch diesen Tutor gehst, versuche nicht, auswendig zu lernen, lerne vielmehr durch Anwenden. @@ -99,13 +99,13 @@ Anmerkung: Während Du durch diesen Tutor gehst, versuche nicht, auswendig zu 1. Bewege den Cursor zur ersten unten stehenden mit ---> markierten Zeile. 2. Um die erste Zeile mit der zweiten gleichzumachen, bewege den Cursor auf - das erste Zeichen NACH der Stelle, wo der Text eingefügt werden soll. + das erste Zeichen NACH der Stelle, an der Text eingefügt werden soll. - 3. Drücke i und gib die notwendigen Ergänzungen ein. + 3. Drücke i und gib die nötigen Ergänzungen ein. 4. Wenn jeweils ein Fehler beseitigt ist, drücke <ESC> , um zum Normalmodus zurückzukehren. - Wiederhole die Schritte 2 bis 4, um den Satz zu korrigieren. + Wiederhole Schritte 2 bis 4, um den Satz zu korrigieren. ---> In dieser ft etwas . ---> In dieser Zeile fehlt etwas Text. @@ -120,15 +120,15 @@ Anmerkung: Während Du durch diesen Tutor gehst, versuche nicht, auswendig zu ** Drücke A , um Text anzufügen. ** 1. Bewege den Cursor zur ersten unten stehenden mit ---> markierten Zeile. - Es ist gleichgültig, auf welchem Zeichen der Zeile der Cursor steht. + Dabei ist gleichgültig, auf welchem Zeichen der Zeile der Cursor steht. - 2. Drücke A und gib die nötigen Ergänzungen ein. + 2. Drücke A und gib die erforderlichen Ergänzungen ein. 3. Wenn das Anfügen abgeschlossen ist, drücke <ESC>, um in den Normalmodus zurückzukehren. 4. Bewege den Cursor zur zweiten mit ---> markierten Zeile und wiederhole - die Schritte 2 und 3, um den Satz zu korrigieren. + die Schritte 2 und 3, um den Satz zu auszubessern. ---> In dieser Zeile feh In dieser Zeile fehlt etwas Text. @@ -139,26 +139,28 @@ Anmerkung: Während Du durch diesen Tutor gehst, versuche nicht, auswendig zu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 1.6: EINE DATEI EDITIEREN + ** Benutze :wq , um eine Datei zu speichern und Vim zu verlassen. ** - ** Benutze :wq , um eine Datei zu speichern und Vim zu verlassen. ** - - !! ACHTUNG: Bevor Du einen der unten aufgeführten Schritte ausführst, lies + !! Hinweis: Bevor Du einen der unten aufgeführten Schritte ausführst, lies diese gesamte Lektion!! - 1. Verlasse den Editor so wie in Lektion 1.2: :q! + 1. Verlasse den Editor so wie in Lektion 1.2: :q! + Oder, falls du Zugriff zu einem anderen Terminal hast, führe das + Folgende dort aus. 2. Gib dieses Kommando in die Eingabeaufforderung ein: vim tutor <ENTER> 'vim' ist der Aufruf des Editors, 'tutor' ist die zu editierende Datei. - Benutze eine Datei, die geändert werden kann. + Benutze eine Datei, die geändert werden darf. - 3. Füge Text ein oder lösche ihn, wie Du in den vorigen Lektionen gelernt - hast. + 3. Füge Text ein oder lösche ihn, wie Du in den vorangehenden Lektionen + gelernt hast. - 4. Speichere die geänderte Datei und verlasse Vim mit: :wq <ENTER> + 4. Speichere die geänderte Datei und verlasse Vim mit: :wq <ENTER> - 5. Starte den vimtutor neu und bewege Dich zu der folgenden Zusammenfassung. + 5. Falls Du in Schritt 1 den vimtutor beendet hast, starte vimtutor neu und + bewege dich abwärts bis zur folgenden Zusammenfassung. - 6. Nachdem Du obige Schritte gelesen und verstanden hast, führe sie durch. + 6. Nachdem Du obige Schritte gelesen und verstanden hast: führe sie durch. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 1 @@ -166,19 +168,18 @@ Anmerkung: Während Du durch diesen Tutor gehst, versuche nicht, auswendig zu 1. Der Cursor wird mit den Pfeiltasten oder den Tasten hjkl bewegt. h (links) j (unten) k (aufwärts) l (rechts) - 2. Um Vim von der Eingabeaufforderung auszuführen, tippe: vim DATEI <ENTER> + 2. Um Vim aus der Eingabeaufforderung zu starten, tippe: vim DATEI <ENTER> 3. Um Vim zu verlassen und alle Änderungen zu verwerfen, tippe: <ESC> :q! <ENTER> . - ODER tippe: <ESC> :wq <ENTER> , um die Änderungen zu speichern. 4. Um das Zeichen unter dem Cursor zu löschen, tippe: x 5. Um Text einzufügen oder anzufügen, tippe: i Einzufügenden Text eingeben <ESC> Einfügen vor dem Cursor - A Anzufügenden Text eingeben <ESC> Anfügen nach dem Zeilendene + A Anzufügenden Text eingeben <ESC> Anfügen nach dem Zeilenende -Bemerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein +Anmerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein ungewolltes, erst teilweise eingegebenes Kommando ab. Nun fahre mit Lektion 2 fort. @@ -188,7 +189,7 @@ Bemerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein ** Tippe dw , um ein Wort zu löschen. ** - 1. Drücke <ESC> um sicherzustellen, dass Du im Normalmodus bist. + 1. Drücke <ESC> , um sicherzustellen, dass Du im Normalmodus bist. 2. Bewege den Cursor zu der mit ---> markierten Zeile unten. @@ -196,15 +197,15 @@ Bemerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein 4. Tippe dw , um das Wort zu entfernen. - Bemerkung: Der Buchstabe d erscheint auf der letzten Zeile des Bildschirms, - wenn Du ihn eingibst. Vim wartet darauf, daß Du w eingibst. Wenn Du - ein anderes Zeichen als d siehst, hast Du etwas falsches getippt; - drücke <ESC> und beginne neu. + Anmerkung: Der Buchstabe d erscheint auf der untersten Zeile des Schirms, + wenn Du ihn eingibst. Vim wartet darauf, dass Du w eingibst. Falls Du + ein anderes Zeichen als d siehst, hast Du etwas Falsches getippt; + drücke <ESC> und beginne noch einmal. ---> Einige Wörter lustig gehören nicht Papier in diesen Satz. 5. Wiederhole die Schritte 3 und 4, bis der Satz korrekt ist und gehe - danach zur Lektion 2.2. + zur Lektion 2.2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 2.2: WEITERE LÖSCHKOMMANDOS @@ -217,12 +218,12 @@ Bemerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein 3. Bewege den Cursor zum Ende der korrekten Zeile (NACH dem ersten . ). - 4. Tippe d$ , um bis zum Ende der Zeile zu löschen. + 4. Tippe d$ , um bis zum Zeilenende zu löschen. ---> Jemand hat das Ende der Zeile doppelt eingegeben. doppelt eingegeben. - 5. Gehe weiter zur Lektion 2.3 , um zu verstehen, was hierbei passiert. + 5. Gehe weiter zur Lektion 2.3 , um zu verstehen, was hierbei vorgeht. @@ -240,16 +241,16 @@ Bemerkung: Drücken von <ESC> bringt Dich in den Normalmodus oder bricht ein wobei: d - der Löschoperator - Bewegung - worauf der Löschoperator angewandt wird (unten aufgelistet). + Bewegung - worauf der Löschoperator angewandt wird (unten aufgeführt). Eine kleine Auflistung von Bewegungen: w - bis zum Beginn des nächsten Wortes OHNE dessen erstes Zeichen. e - zum Ende des aktuellen Wortes MIT dessen letztem Zeichen. - $ - zum Ende der Zeile MIT dem letzen Zeichen. + $ - zum Ende der Zeile MIT dem letzten Zeichen. Dementsprechend löscht die Eingabe von de vom Cursor an bis zum Wortende. -Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den +Anmerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den Cursor entsprechend. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 2.4: ANWENDUNG EINES ZÄHLERS FÜR EINEN BEWEGUNGSSCHRITT @@ -265,9 +266,9 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 4. Tippe 0 (Null) , um zum Anfang der Zeile zu gelangen. - 5. Wiederhole Schritte 2 und 3 mit verschiedenen Zählern. + 5. Wiederhole Schritte 2 und 3 mit verschiedenen Nummern. - ---> Dies ist nur eine Zeile aus Wörten um sich darin herumzubewegen. + ---> Dies ist nur eine Zeile aus Wörtern, um sich darin herumzubewegen. 6. Gehe weiter zu Lektion 2.5. @@ -280,8 +281,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ** Die Eingabe einer Zahl mit einem Operator wiederholt diesen mehrfach. ** - Für die Kombination des Löschoperators und einem Bewegungsschritt (siehe - oben) stellt man dem Bewegungsschritt einen Zähler voran, um mehr zu löschen: + In der Kombination aus Löschoperator und Bewegungsschritt (siehe oben) + stellt man, um mehr zu löschen dem Schritt einen Zähler voran: d Nummer Bewegungsschritt 1. Bewege den Cursor zum ersten Wort in GROSSBUCHSTABEN in der mit ---> @@ -289,9 +290,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 2. Tippe d2w , um die zwei Wörter in GROSSBUCHSTABEN zu löschen. - 3. Wiederhole Schritte 1 und 2 mit einem anderen Zähler, um die - darauffolgenden Wörter in GROSSBUCHSTABEN mit einem einzigen Kommando - zu löschen. + 3. Wiederhole Schritte 1 und 2 mit einem anderen Zähler, um die darauffol- + genden Wörter in GROSSBUCHSTABEN mit einem einzigen Kommando zu löschen. ---> Diese ABC DE Zeile FGHI JK LMN OP mit Wörtern ist Q RS TUV bereinigt. @@ -325,12 +325,12 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ** Tippe u , um die letzten Kommandos rückgängig zu machen ** - ** oder U um eine ganze Zeile wiederherzustellen. ** + ** oder U , um eine ganze Zeile wiederherzustellen. ** 1. Bewege den Cursor zu der mit ---> markierten Zeile unten und setze ihn auf den ersten Fehler. 2. Tippe x , um das erste unerwünschte Zeichen zu löschen. - 3. Nun tippe u um das soeben ausgeführte Kommando rückgängig zu machen. + 3. Nun tippe u , um das soeben ausgeführte Kommando rückgängig zu machen. 4. Jetzt behebe alle Fehler auf der Zeile mit Hilfe des x Kommandos. 5. Nun tippe ein großes U , um die Zeile in ihren Ursprungszustand wiederherzustellen. @@ -341,8 +341,8 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ---> Beehebe die Fehller diesser Zeile und sttelle sie mitt 'undo' wieder her. - 8. Dies sind sehr nützliche Kommandos. - Nun gehe weiter zur Zusammenfassung von Lektion 2. + 8. Dies sind sehr nützliche Kommandos. Nun gehe weiter zur Zusammenfassung + von Lektion 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 2 @@ -357,7 +357,7 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den wobei: Operator - gibt an, was getan werden soll, zum Beispiel d für delete [Anzahl] - ein optionaler Zähler, um den Bewegungsschritt zu wiederholen - Bewegungsschritt - Bewegung über den zu ändernden Text, so wie + Bewegungsschritt - Bewegung über den zu ändernden Text, wie w (Wort), $ (zum Ende der Zeile), etc. 6. Um Dich zum Anfang der Zeile zu begeben, benutze die Null: 0 @@ -387,7 +387,7 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den ---> d) Kannst Du das auch? ---> b) Veilchen sind blau, ----> c) Intelligenz ist erlernbar, +---> c) Intelligenz ist lernbar, ---> a) Rosen sind rot, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 3.2: ERSETZEN (REPLACE) @@ -403,13 +403,13 @@ Bemerkung: Die Eingabe lediglich des Bewegungsteils im Normalmodus bewegt den 4. Wiederhole Schritte 2 und 3, bis die erste Zeile gleich der zweiten ist. ----> Als diese Zeite eingegoben wurde, wurden einike falsche Tasten gelippt! +---> Alf diese Zeite eingegoben wurde, wurden einike falsche Tasten gelippt! ---> Als diese Zeile eingegeben wurde, wurden einige falsche Tasten getippt! 5. Nun fahre fort mit Lektion 3.2. -Bemerkung: Erinnere Dich, dass Du durch Anwenden lernen solltest, nicht durch - Auswendiglernen. +Anmerkung: Erinnere Dich daran, dass Du durch Anwenden lernen solltest, nicht + durch Auswendiglernen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -431,7 +431,7 @@ Bemerkung: Erinnere Dich, dass Du durch Anwenden lernen solltest, nicht durch ---> Einige Wstwr dieser Zlaww lasdjlaf mit dem Ändern-Operator gaaauu werden. ---> Einige Wörter dieser Zeile sollen mit dem Ändern-Operator geändert werden. -Bemerke, dass ce das Wort löscht und Dich in den Eingabemodus versetzt. +Beachte, dass ce das Wort löscht und Dich in den Eingabemodus versetzt. @@ -457,7 +457,7 @@ Bemerke, dass ce das Wort löscht und Dich in den Eingabemodus versetzt. ---> Das Ende dieser Zeile soll an die zweite Zeile angeglichen werden. ---> Das Ende dieser Zeile soll mit dem c$ Kommando korrigiert werden. -Bemerkung: Du kannst die Rücktaste benutzen, um Tippfehler zu korrigieren. +Anmerkung: Du kannst die Rücktaste benutzen, um Tippfehler zu korrigieren. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 3 @@ -466,8 +466,8 @@ Bemerkung: Du kannst die Rücktaste benutzen, um Tippfehler zu korrigieren. gelöschten Text NACH dem Cursor an (wenn eine ganze Zeile gelöscht wurde, wird diese in die Zeile unter dem Cursor eingefügt). - 2. Um das Zeichen unter dem Cursor zu ersetzen, tippe r und das an dieser - Stelle gewünschte Zeichen. + 2. Um das Zeichen unter dem Cursor zu ersetzen, tippe r und danach das + an dieser Stelle gewollte Zeichen. 3. Der Änderungs- (change) Operator erlaubt, vom Cursor bis zum Ende des Bewegungsschrittes zu ändern. Tippe ce , um eine Änderung vom Cursor bis @@ -484,17 +484,18 @@ Bemerkung: Du kannst die Rücktaste benutzen, um Tippfehler zu korrigieren. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 4.1: CURSORPOSITION UND DATEISTATUS - ** Tippe CTRL-G , um Deine Dateiposition sowie den Dateistatus anzuzeigen. ** + ** Tippe CTRL-G , um deine Dateiposition sowie den Dateistatus anzuzeigen. ** ** Tippe G , um Dich zu einer Zeile in der Datei zu begeben. ** -Bemerkung: Lies diese gesamte Lektion, bevor Du irgendeinen Schritt ausführst!! +Anmerkung: Lies diese gesamte Lektion, bevor Du irgendeinen Schritt ausführst!! - 1. Halte die Ctrl Taste unten und drücke g . Dies nennen wir wir CTRL-G. + 1. Halte die Ctrl Taste unten und drücke g . Dies nennen wir CTRL-G. Eine Statusmeldung am Fuß der Seite erscheint mit dem Dateinamen und der Position innerhalb der Datei. Merke Dir die Zeilennummer für Schritt 3. -Bemerkung: Möglicherweise siehst Du die Cursorposition in der unteren rechten - Bildschirmecke. Dies ist Folge der 'ruler' Option (siehe :help 'ruler') +Anmerkung: Möglicherweise siehst Du die Cursorposition in der unteren rechten + Bildschirmecke. Dies ist Auswirkung der 'ruler' Option + (siehe :help 'ruler') 2. Drücke G , um Dich zum Ende der Datei zu begeben. Tippe gg , um Dich zum Anfang der Datei zu begeben. @@ -510,7 +511,7 @@ Bemerkung: Möglicherweise siehst Du die Cursorposition in der unteren rechten ** Tippe / gefolgt von einem Ausdruck, um nach dem Ausdruck zu suchen. ** - 1. Im Normalmodus, tippe das / Zeichen. Bemerke, dass das / und der + 1. Im Normalmodus, tippe das / Zeichen. Beachte, dass das / und der Cursor am Fuß des Schirms erscheinen, so wie beim : Kommando. 2. Nun tippe 'Fehhler' <ENTER>. Dies ist das Wort, nach dem Du suchen willst. @@ -521,32 +522,32 @@ Bemerkung: Möglicherweise siehst Du die Cursorposition in der unteren rechten 4. Um nach einem Ausdruck rückwärts zu suchen , benutze ? statt / . 5. Um dahin zurückzukehren, von wo Du gekommen bist, drücke CTRL-O (Halte - Ctrl unten und drücke den Buchstaben o). Wiederhole dies, um weiter - zurückzugehen. CTRL-I bringt dich vorwärts. + Ctrl unten und drücke den Buchstaben o). Wiederhole dies, um noch weiter + zurückzugehen. CTRL-I geht vorwärts. ---> Fehler schreibt sich nicht "Fehhler"; Fehhler ist ein Fehler -Bemerkung: Wenn die Suche das Dateiende erreicht hat, wird sie am Anfang +Anmerkung: Wenn die Suche das Dateiende erreicht hat, wird sie am Anfang fortgesetzt, es sei denn, die 'wrapscan' Option wurde abgeschaltet. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 4.3: PASSENDE KLAMMERN FINDEN - ** Tippe % , um eine korrespondierende Klammer ),], oder } zu finden. ** + ** Tippe % , um eine gegenüberliegenden Klammer ),], oder } zu finden. ** - 1. Platziere den Cursor auf irgendeines der Zeichen (, [, oder { in der unten + 1. Platziere den Cursor auf irgendeinem der Zeichen (, [, oder { in der unten stehenden Zeile, die mit ---> markiert ist. 2. Nun tippe das % Zeichen. 3. Der Cursor bewegt sich zur passenden gegenüberliegenden Klammer. - 4. Tippe % , um den Cursor zur anderen passenden Klammer zu bewegen. + 4. Tippe % , um den Cursor zur passenden anderen Klammer zu bewegen. 5. Setze den Cursor auf ein anderes (,),[,],{ oder } und probiere % aus. ---> Dies ( ist eine Testzeile ( mit [ verschiedenen ] { Klammern } darin. )) -Bemerkung: Diese Funktionalität ist sehr nützlich bei der Fehlersuche in einem +Anmerkung: Diese Funktionalität ist sehr nützlich bei der Fehlersuche in einem Programmtext, in dem passende Klammern fehlen! @@ -558,18 +559,18 @@ Bemerkung: Diese Funktionalität ist sehr nützlich bei der Fehlersuche in einem 1. Bewege den Cursor zu der unten stehenden mit ---> markierten Zeile. - 2. Tippe :s/diee/die <ENTER> . Bemerke, dass der Befehl nur das erste + 2. Tippe :s/diee/die <ENTER> . Beachte, dass der Befehl nur das erste Vorkommen von "diee" ersetzt. 3. Nun tippe :s/diee/die/g . Das Zufügen des Flags g bedeutet, eine - globale Ersetzung über die Zeile durchzuführen, was alle Vorkommen von - "diee" auf der Zeile ersetzt. + globale Ersetzung über die Zeile durchzuführen, dies ersetzt alle + Vorkommen von "diee" auf der Zeile. ---> diee schönste Zeit, um diee Blumen anzuschauen, ist diee Frühlingszeit. 4. Um alle Vorkommen einer Zeichenkette innerhalb zweier Zeilen zu ändern, - tippe :#,#s/alt/neu/g wobei #,# die Zeilennummern des Zeilenbereiches - sind, in dem die Ersetzung durchgeführt werden soll. + tippe :#,#s/alt/neu/g wobei #,# die Zeilennummern des Bereiches sind, + in dem die Ersetzung durchgeführt werden soll. Tippe :%s/alt/neu/g um alle Vorkommen in der gesamten Datei zu ändern. Tippe :%s/alt/neu/gc um alle Vorkommen in der gesamten Datei zu finden mit einem Fragedialog, ob ersetzt werden soll oder nicht. @@ -593,9 +594,9 @@ Bemerkung: Diese Funktionalität ist sehr nützlich bei der Fehlersuche in einem 4. Um das erste Vorkommen von "alt" in einer Zeile durch "neu" zu ersetzen, tippe :s/alt/neu Um alle Vorkommen von "alt" in der Zeile ersetzen, tippe :s/alt/neu/g - Um Ausdrücke innerhalb zweier Zeilennummern zu ersetzen, :#,#s/alt/neu/g + Um Ausdrücke innerhalb zweier Zeilen # zu ersetzen :#,#s/alt/neu/g Um alle Vorkommen in der ganzen Datei zu ersetzen, tippe :%s/alt/neu/g - Für eine jedmalige Bestätigung, addiere 'c' (confirm) :%s/alt/neu/gc + Für eine jedesmalige Bestätigung, addiere 'c' (confirm) :%s/alt/neu/gc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.1: AUSFÜHREN EINES EXTERNEN KOMMANDOS @@ -608,14 +609,14 @@ Bemerkung: Diese Funktionalität ist sehr nützlich bei der Fehlersuche in einem 2. Nun tippe ein ! (Ausrufezeichen). Dies ermöglicht Dir, ein beliebiges, externes Shellkommando auszuführen. - 3. Als Beispiel tippe ls nach dem ! und drücke <ENTER>. Dies zeigt - eine Auflistung Deines Verzeichnisses; genauso, als wenn Du auf der + 3. Als Beispiel tippe ls nach dem ! und drücke <ENTER>. Dies liefert + eine Auflistung deines Verzeichnisses; genauso, als wenn Du in der Eingabeaufforderung wärst. Oder verwende :!dir , falls ls nicht geht. -Bemerkung: Mit dieser Methode kann jedes beliebige externe Kommando +Anmerkung: Mit dieser Methode kann jedes beliebige externe Kommando ausgeführt werden, auch mit Argumenten. -Bemerkung: Alle : Kommandos müssen durch Eingabe von <ENTER> +Anmerkung: Alle : Kommandos müssen durch Eingabe von <ENTER> abgeschlossen werden. Von jetzt an erwähnen wir dies nicht jedesmal. @@ -625,7 +626,7 @@ Bemerkung: Alle : Kommandos müssen durch Eingabe von <ENTER> ** Um am Text durchgeführte Änderungen zu speichern, tippe :w DATEINAME. ** - 1. Tippe :!dir oder :!ls , um eine Auflistung Deines Verzeichnisses zu + 1. Tippe :!dir oder :!ls , um eine Auflistung deines Verzeichnisses zu erhalten. Du weißt nun bereits, dass Du danach <ENTER> eingeben musst. 2. Wähle einen Dateinamen, der noch nicht existiert, z.B. TEST. @@ -633,15 +634,15 @@ Bemerkung: Alle : Kommandos müssen durch Eingabe von <ENTER> 3. Nun tippe: :w TEST (wobei TEST der gewählte Dateiname ist). 4. Dies speichert die ganze Datei (den Vim Tutor) unter dem Namen TEST. - Um dies zu überprüfen, tippe nochmals :!ls bzw. !dir, um Deinen + Um dies zu überprüfen, tippe nochmals :!ls bzw. !dir, um deinen Verzeichnisinhalt zu sehen. -Bemerkung: Würdest Du Vim jetzt beenden und danach wieder mit vim TEST +Anmerkung: Würdest Du Vim jetzt beenden und danach wieder mit vim TEST starten, dann wäre diese Datei eine exakte Kopie des Tutors zu dem Zeitpunkt, als Du ihn gespeichert hast. 5. Nun entferne die Datei durch Eingabe von (MS-DOS): :!del TEST - oder (Unix): :!rm TEST + oder (Unix): :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.3: AUSWÄHLEN VON TEXT ZUM SCHREIBEN @@ -650,41 +651,42 @@ Bemerkung: Würdest Du Vim jetzt beenden und danach wieder mit vim TEST 1. Bewege den Cursor zu dieser Zeile. 2. Tippe v und bewege den Cursor zum fünften Auflistungspunkt unten. - Bemerke, daß der Text hervorgehoben wird. + Beachte, dass der Text hervorgehoben wird. 3. Drücke das Zeichen : . Am Fuß des Schirms erscheint :'<,'> . 4. Tippe w TEST , wobei TEST ein noch nicht vorhandener Dateiname ist. - Vergewissere Dich, daß Du :'<,'>w TEST siehst, bevor Du Enter drückst. + Vergewissere Dich, dass Du :'<,'>w TEST siehst, bevor Du <ENTER> drückst. 5. Vim schreibt die ausgewählten Zeilen in die Datei TEST. Benutze :!dir oder :!ls , um sie zu sehen. Lösche sie noch nicht! Wir werden sie in der nächsten Lektion benutzen. -Bemerkung: Drücken von v startet die Visuelle Auswahl. Du kannst den Cursor - umherbewegen, um die Auswahl größer oder kleiner zu machen. Anschließend - kann man einen Operator anwenden, um mit dem Text etwas zu tun. Zum - Beispiel löscht d den Text. +Hinweis: Drücken von v startet die Visuelle Auswahl. Du kannst den Cursor + umherbewegen, um die Auswahl zu vergrößern oder zu verkleinern. Anschließend + lässt sich ein Operator anwenden, um mit dem Text etwas zu tun. Zum Beispiel + löscht d den Text. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 5.4: EINLESEN UND ZUSAMMENFÜHREN VON DATEIEN ** Um den Inhalt einer Datei einzulesen, tippe :r DATEINAME ** - 1. Platziere den Cursor überhalb dieser Zeile. + 1. Platziere den Cursor direkt über dieser Zeile. BEACHTE: Nachdem Du Schritt 2 ausgeführt hast, wirst Du Text aus Lektion 5.3 - sehen. Dann bewege Dich wieder ABWÄRTS, um diese Lektion wiederzusehen. + sehen. Dann bewege Dich wieder ABWÄRTS, Lektion 5.4 wiederzusehen. - 2. Nun lies Deine Datei TEST ein indem Du das Kommando :r TEST ausführst, + 2. Nun lies deine Datei TEST ein indem Du das Kommando :r TEST ausführst, wobei TEST der von Dir verwendete Dateiname ist. Die eingelesene Datei wird unterhalb der Cursorzeile eingefügt. - 3. Um zu überprüfen, dass die Datei eingelesen wurde, gehe zurück und siehe, - dass es jetzt zwei Kopien von Lektion 5.3 gibt, das Original und die - eingefügte Dateiversion. + 3. Um zu überprüfen, dass die Datei eingelesen wurde, gehe zurück und + beachte, dass es jetzt zwei Kopien von Lektion 5.3 gibt, das Original und + die eingefügte Dateiversion. -Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum +Anmerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum Beispiel liest :r !ls die Ausgabe des Kommandos ls ein und platziert sie unterhalb des Cursors. @@ -720,14 +722,14 @@ Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum 1. Bewege den Cursor zu der ersten mit ---> markierten Zeile unten. - 2. Tippe o (klein geschrieben), um eine Zeile UNTERHALB des Cursos zu öffnen + 2. Tippe o (klein geschrieben), um eine Zeile UNTERHALB des Cursors zu öffnen und Dich in den Einfügemodus zu begeben. 3. Nun tippe etwas Text und drücke <ESC> , um den Einfügemodus zu verlassen. ---> Mit o wird der Cursor auf der offenen Zeile im Einfügemodus platziert. - 4. Um eine Zeile ÜBERHALB des Cursos aufzumachen, gib einfach ein großes O + 4. Um eine Zeile ÜBERHALB des Cursors aufzumachen, gib einfach ein großes O statt einem kleinen o ein. Versuche dies auf der unten stehenden Zeile. ---> Öffne eine Zeile über dieser mit O , wenn der Cursor auf dieser Zeile ist. @@ -755,7 +757,7 @@ Bemerkung: Du kannst auch die Ausgabe eines externen Kommandos einlesen. Zum ---> Diese Zei bietet Gelegen , Text in einer Zeile anzufü. ---> Diese Zeile bietet Gelegenheit, Text in einer Zeile anzufügen. -Bemerkung: a, i und A gehen alle gleichermaßen in den Einfügemodus; der +Anmerkung: a, i und A gehen alle gleichermaßen in den Einfügemodus; der einzige Unterschied ist, wo die Zeichen eingefügt werden. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 6.3: EINE ANDERE ART DES ERSETZENS (REPLACE) @@ -767,9 +769,9 @@ Bemerkung: a, i und A gehen alle gleichermaßen in den Einfügemodus; der Bewege den Cursor zum Anfang des ersten xxx . 2. Nun drücke R und tippe die Nummer, die darunter in der zweiten Zeile - steht, so das diese das xxx ersetzt. + steht, so dass diese das xxx ersetzt. - 3. Drücke <ESC> , um den Ersetzungsmodus zu verlassen. Bemerke, daß der Rest + 3. Drücke <ESC> , um den Ersetzungsmodus zu verlassen. Beachte, dass der Rest der Zeile unverändert bleibt. 4. Wiederhole die Schritte, um das verbliebene xxx zu ersetzen. @@ -777,7 +779,7 @@ Bemerkung: a, i und A gehen alle gleichermaßen in den Einfügemodus; der ---> Das Addieren von 123 zu xxx ergibt xxx. ---> Das Addieren von 123 zu 456 ergibt 579. -Bemerkung: Der Ersetzungsmodus ist wie der Einfügemodus, aber jedes eingetippte +Anmerkung: Der Ersetzungsmodus ist wie der Einfügemodus, aber jedes eingetippte Zeichen löscht ein vorhandenes Zeichen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -785,7 +787,7 @@ Bemerkung: Der Ersetzungsmodus ist wie der Einfügemodus, aber jedes eingetippte ** Benutze den y Operator, um Text zu kopieren; p , um ihn einzufügen ** - 1. Gehe zu der mit ---> markierten Zeile unten, setze den Cursor hinter "a)". + 1. Gehe zu der mit ---> markierten Zeile unten; setze den Cursor hinter "a)". 2. Starte den Visuellen Modus mit v , bewege den Cursor genau vor "erste". @@ -802,11 +804,11 @@ Bemerkung: Der Ersetzungsmodus ist wie der Einfügemodus, aber jedes eingetippte ---> a) dies ist der erste Eintrag. b) -Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. +Anmerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 6.5: OPTIONEN SETZEN - ** Setze eine Option so, dass eine Suche oder eine Ersetzung Groß- ** + ** Setze eine Option so, dass eine Suche oder Ersetzung Groß- ** ** und Kleinschreibung ignoriert ** 1. Suche nach 'ignoriere', indem Du /ignoriere eingibst. @@ -815,7 +817,7 @@ Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. 2. Setze die 'ic' (Ignore case) - Option, indem Du :set ic eingibst. 3. Nun suche wieder nach 'ignoriere', indem Du n tippst. - Bemerke, daß jetzt Ignoriere und auch IGNORIERE gefunden wird. + Beachte, dass jetzt Ignoriere und auch IGNORIERE gefunden wird. 4. Setze die 'hlsearch' und 'incsearch' - Optionen: :set hls is @@ -823,14 +825,14 @@ Bemerkung: Du kannst y auch als Operator verwenden; yw kopiert ein Wort. 6. Um das Ignorieren von Groß/Kleinschreibung abzuschalten, tippe: :set noic -Bemerkung: Um die Hervorhebung der Treffer zu enfernen, gib ein: :nohlsearch -Bemerkung: Um die Schreibweise für eine einzige Suche zu ignorieren, benutze - \c im Suchausdruck: /ignoriere\c <ENTER> +Anmerkung: Um die Hervorhebung der Treffer zu entfernen, gib ein: :nohlsearch +Anmerkung: Um die Schreibweise für eine einzige Suche zu ignorieren, benutze \c + im Suchausdruck: /ignoriere\c <ENTER> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ZUSAMMENFASSUNG VON LEKTION 6 1. Tippe o , um eine Zeile UNTER dem Cursor zu öffnen und den Einfügemodus - zu starten. + zu starten Tippe O , um eine Zeile ÜBER dem Cursor zu öffnen. 2. Tippe a , um Text NACH dem Cursor anzufügen. @@ -876,13 +878,13 @@ Bemerkung: Um die Schreibweise für eine einzige Suche zu ignorieren, benutze Lektion 7.2: ERSTELLE EIN START-SKRIPT - ** Aktiviere die eingebauten Funktionalitäten von Vim ** + ** Aktiviere die Features von Vim ** Vim besitzt viele Funktionalitäten, die über Vi hinausgehen, aber die meisten von ihnen sind standardmäßig deaktiviert. Um mehr Funktionalitäten zu nutzen, musst Du eine "vimrc" - Datei erstellen. - 1. Starte das Editieren der "vimrc"-Datei, abhängig von Deinem System: + 1. Starte das Editieren der "vimrc"-Datei, abhängig von deinem System: :e ~/.vimrc für Unix :e $VIM/_vimrc für MS-Windows @@ -893,33 +895,33 @@ Bemerkung: Um die Schreibweise für eine einzige Suche zu ignorieren, benutze :w Beim nächsten Start von Vim wird die Syntaxhervorhebung aktiviert sein. - Du kannst all Deine bevorzugten Optionen zu dieser "vimrc"-Datei zufügen. + Du kannst all deine bevorzugten Optionen zu dieser "vimrc"-Datei zufügen. Für mehr Informationen tippe :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lektion 7.3: VERVOLLSTÄNDIGEN - ** Kommandozeilenvervollständigung mit CTRL-D and <TAB> ** + ** Kommandozeilenvervollständigung mit CTRL-D und <TAB> ** - 1. Stelle sicher, daß Vim nicht im vi-Kompatibilitätsmodus ist: :set nocp + 1. Stelle sicher, dass Vim nicht im Vi-Kompatibilitätsmodus ist: :set nocp 2. Siehe nach, welche Dateien im Verzeichnis existieren: :!ls oder :dir - 3. Tippe den Beginn eines Komandos: :e + 3. Tippe den Beginn eines Kommandos: :e 4. Drücke CTRL-D und Vim zeigt eine Liste mit "e" beginnender Kommandos. 5. Drücke <TAB> und Vim vervollständigt den Kommandonamen zu ":edit". - 6. Nun füge ein Leerzeichen und den Beginn einer existierenden Datei an: + 6. Nun füge ein Leerzeichen und den Anfang einer existierenden Datei an: :edit DAT 7. Drücke <TAB>. Vim vervollständigt den Namen (falls er eindeutig ist). -Bemerkung: Vervollständigung funktioniert für viele Kommandos. Versuche +Anmerkung: Vervollständigung funktioniert für viele Kommandos. Probiere einfach CTRL-D und <TAB>. Dies ist insbesondere nützlich für :help . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ZUSAMMENFASSUNG VON LEKTION 7 + ZUSAMMENFASSUNG VON LEKTION 7 1. Tippe :help oder drücke <F1> oder <Help>, um ein Hilfefenster zu öffnen. @@ -930,11 +932,11 @@ Bemerkung: Vervollständigung funktioniert für viele Kommandos. Versuche 4. Tippe :q , um das Hilfefenster zu schließen. - 5. Erstelle ein vimrc - Startskript zur Sicherung bevorzugter Einstellungen. + 5. Erstelle ein vimrc - Startskript mit deinen bevorzugter Einstellungen. - 6. Drücke CTRL-D nach dem Tippen eines Kommandos : , um mögliche - Vervollständigungen zu sehen. - Drücke <TAB> für eine einzige Vervollständigung. + 6. Drücke CTRL-D nach dem Tippen eines : Kommandos, um mögliche + Vervollständigungen anzusehen. + Drücke <TAB> , um eine Vervollständigung zu anzuwenden. @@ -943,13 +945,13 @@ Bemerkung: Vervollständigung funktioniert für viele Kommandos. Versuche ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Damit ist der Vim Tutor beendet. Die Intention war, einen kurzen und - bündigen Überblick über den Vim Editor zu liefern; gerade genug, um relativ + Damit ist der Vim Tutor beendet. Seine Intention war, einen kurzen und + bündigen Überblick über den Vim Editor zu geben; gerade genug, um relativ leicht mit ihm umgehen zu können. Der Vim Tutor hat nicht den geringsten Anspruch auf Vollständigkeit; Vim hat noch weitaus mehr Kommandos. Lies als nächstes das User Manual: ":help user-manual". - Für weiteres Lesen und Lernen ist folgendes Buch empfohlen : + Für weiteres Lesen und Lernen ist folgendes Buch empfehlenswert : Vim - Vi Improved - von Steve Oualline Verlag: New Riders Das erste Buch, welches durchgängig Vim gewidmet ist. Besonders nützlich @@ -957,7 +959,7 @@ Bemerkung: Vervollständigung funktioniert für viele Kommandos. Versuche Siehe http://iccf-holland.org/click5.html Folgendes Buch ist älter und mehr über Vi als Vim, aber auch empfehlenswert: - Textbearbeitung mit dem vi-Editor - von Linda Lamb und Arnold Robbins + Textbearbeitung mit dem Vi-Editor - von Linda Lamb und Arnold Robbins Verlag O'Reilly - ISBN: 3897211262 In diesem Buch kann man fast alles finden, was man mit Vi tun möchte. Die sechste Ausgabe enthält auch Informationen über Vim. @@ -970,11 +972,11 @@ Bemerkung: Vervollständigung funktioniert für viele Kommandos. Versuche für Einsteiger empfehlenswert. Probekapitel und die Beispielskripte sind online erhältlich. Siehe http://iccf-holland.org/click5.html - Dieses Tutorial wurde geschrieben von Michael C. Pierce and Robert K. Ware, + Dieses Tutorial wurde geschrieben von Michael C. Pierce und Robert K. Ware, Colorado School of Mines. Es benutzt Ideen, die Charles Smith, Colorado State - University, zur Verfügung stellte. E-mail: bware@mines.colorado.edu. + University, zur Verfügung stellte. E-Mail: bware@mines.colorado.edu. Bearbeitet für Vim von Bram Moolenaar. - Deutsche Übersetzung von Joachim Hofmann 2007. E-mail: Joachim.Hof@gmx.de + Deutsche Übersetzung von Joachim Hofmann 2015. E-Mail: Joachim.Hof@gmx.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.el b/runtime/tutor/tutor.el index d402bc8add..126a391e6f 100644 --- a/runtime/tutor/tutor.el +++ b/runtime/tutor/tutor.el @@ -20,7 +20,7 @@ . , ! - , Shift-Lock + , Caps-Lock j 1.1 . diff --git a/runtime/tutor/tutor.el.cp737 b/runtime/tutor/tutor.el.cp737 index 69ceff11f3..8ef6f74541 100644 --- a/runtime/tutor/tutor.el.cp737 +++ b/runtime/tutor/tutor.el.cp737 @@ -20,7 +20,7 @@ 嫜 ៜ ੫. ᝜ 椦 壜, ᩜ! - 騘, 嫜 櫠 㡫 Shift-Lock 夘 ⤦ + 騘, 嫜 櫠 㡫 Caps-Lock 夘 ⤦ 㩫 㡫 j 㩜 ⫩ 驫 ៞ 1.1 婜 椞. diff --git a/runtime/tutor/tutor.el.utf-8 b/runtime/tutor/tutor.el.utf-8 index b6c08e15f9..b8bfbe7fe0 100644 --- a/runtime/tutor/tutor.el.utf-8 +++ b/runtime/tutor/tutor.el.utf-8 @@ -20,7 +20,7 @@ εκτελείτε τις εντολές για να τις μάθετε σωστά. Αν διαβάζετε μόνο το κείμενο, θα τις ξεχάσετε! - Τώρα, βεβαιωθείτε ότι το πλήκτρο Shift-Lock ΔΕΝ είναι πατημένο και + Τώρα, βεβαιωθείτε ότι το πλήκτρο Caps-Lock ΔΕΝ είναι πατημένο και πατήστε το πλήκτρο j αρκετές φορές για να μετακινήσετε τον δρομέα έτσι ώστε το Μάθημα 1.1 να γεμίσει πλήρως την οθόνη. diff --git a/runtime/tutor/tutor.eo b/runtime/tutor/tutor.eo index c075ec7a9f..b2e898056d 100644 --- a/runtime/tutor/tutor.eo +++ b/runtime/tutor/tutor.eo @@ -160,7 +160,7 @@ RIMARKO: Trairante la instruilon, ne provu memori, lernu per la uzo. 4. Konservu la dosieron kun anoj kaj eliru el Vim per: :wq <Enenklavo> - 5. Se vi eliris la instruilon vimtutor en pao 1, restartigu la intruilon + 5. Se vi eliris el la instruilo vimtutor en pao 1, restartigu la instruilon vimtutor kaj moviu suben al la sekvanta resumo. 6. Post kiam vi legis la suprajn paojn, kaj komprenis ilin: faru ilin. @@ -229,7 +229,7 @@ Nun da 3. Movu la kursoron e la fino de la usta linio (POST la unua . ). - 4. Tajpu d$ por forivi is la fino de la linio. + 4. Tajpu d$ por forivii is la fino de la linio. ---> Iu tajpis la finon de i tiu linio dufoje. fino de i tiu linio dufoje. @@ -670,7 +670,7 @@ RIMARKO: Se vi volus eliri el Vim kaj restartigi 3. Premu la : signon. e la fino de la ekrano :'<,'> aperos. 4. Tajpu w TESTO , kie TESTO estas dosiernomo, kiu ankora ne ekzistas. - Kontrolu, ke vi vidas :'<,'>w TESTO anta premi <Enenklavo>. + Kontrolu, ke vi vidas :'<,'>w TESTO anta ol premi <Enenklavo>. 5. Vim konservos la apartigitajn liniojn al la dosiero TESTO. Uzu :dir a :!ls por vidigi in. Ne forviu in. Ni uzos in en la sekvanta @@ -688,7 +688,7 @@ RIMARKO: Premo de v komencas Viduman apartigon. Vi povas movi la kursoron ** Por enmeti la enhavon de dosiero, tajpu :r DOSIERNOMON ** - 1. Movu la kursoron us super i tiu linio. + 1. Movu la kursoron tuj super i tiu linio. RIMARKO: Post plenumo de pao 2, vi vidos tekston el la leciono 5.3. Tiam moviu SUBEN por vidi tiun lecionon denove. @@ -741,7 +741,7 @@ RIMARKO: Vi nun povas legi la eliron de ekstera komando. Ekzemple, 2. Tajpu la minusklan literon o por malfermi linion SUB la kursoro kaj eniri la Enmetan reimon. - 3. Nun tajpu tekston kaj premu <ESK> por eliri la Enmetan reimon. + 3. Nun tajpu tekston kaj premu <ESK> por eliri el la Enmeta reimo. ---> Post tajpo de o la kursoro movias al la malfermata linio en Enmeta reimo. @@ -765,7 +765,7 @@ RIMARKO: Vi nun povas legi la eliron de ekstera komando. Ekzemple, 3. Tajpu a (minuskle) por aldoni tekston POST la kursoro. 4. Kompletigu la vorton same kiel la linio sub i. Premu <ESK> por - eliri la Enmetan reimon. + eliri el la Enmeta reimo. 5. Uzu e por movii al la sekvanta nekompleta vorto kaj ripetu paojn 3 kaj 4. @@ -789,7 +789,7 @@ RIMARKO: 2. Nun premu R kaj tajpu la nombron sub i en la dua linio, por ke i anstataigu la xxx . - 3. Premu <ESK> por foriri la Anstataigan reimon. Rimarku, ke la cetera + 3. Premu <ESK> por foriri el la Anstataiga reimo. Rimarku, ke la cetera parto de la linio restas neanata. 4. Ripetu la paojn por anstataigi la restantajn xxx. @@ -810,7 +810,7 @@ RIMARKO: Anstata 1. Iru al la linio markita per ---> sube kaj poziciu la kursoron post "a)". - 2. Komencu la Viduman reimon per v kaj movu la kursoron us anta "unua". + 2. Komencu la Viduman reimon per v kaj movu la kursoron tuj anta "unua". 3. Tajpu y por kopii la emfazitan tekston. @@ -986,6 +986,6 @@ RIMARKO: Kompletigo funkcias por multaj komandoj. Nur provu premi CTRL-D kaj Esperantigita fare de Dominique Pell, 2008-04-01 Retpoto: dominique.pelle@gmail.com - Lasta ano: 2011-11-27 + Lasta ano: 2016-07-02 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.eo.utf-8 b/runtime/tutor/tutor.eo.utf-8 index 44d7b29a37..0f08a56fea 100644 --- a/runtime/tutor/tutor.eo.utf-8 +++ b/runtime/tutor/tutor.eo.utf-8 @@ -160,7 +160,7 @@ RIMARKO: Trairante la instruilon, ne provu memori, lernu per la uzo. 4. Konservu la dosieron kun ŝanĝoj kaj eliru el Vim per: :wq <Enenklavo> - 5. Se vi eliris la instruilon vimtutor en paŝo 1, restartigu la intruilon + 5. Se vi eliris el la instruilo vimtutor en paŝo 1, restartigu la instruilon vimtutor kaj moviĝu suben al la sekvanta resumo. 6. Post kiam vi legis la suprajn paŝojn, kaj komprenis ilin: faru ilin. @@ -229,7 +229,7 @@ Nun daŭrigu al la leciono 2. 3. Movu la kursoron ĉe la fino de la ĝusta linio (POST la unua . ). - 4. Tajpu d$ por forivŝi ĝis la fino de la linio. + 4. Tajpu d$ por foriviŝi ĝis la fino de la linio. ---> Iu tajpis la finon de ĉi tiu linio dufoje. fino de ĉi tiu linio dufoje. @@ -670,7 +670,7 @@ RIMARKO: Se vi volus eliri el Vim kaj restartigi ĝin denove per vim TESTO, 3. Premu la : signon. Ĉe la fino de la ekrano :'<,'> aperos. 4. Tajpu w TESTO , kie TESTO estas dosiernomo, kiu ankoraŭ ne ekzistas. - Kontrolu, ke vi vidas :'<,'>w TESTO antaŭ premi <Enenklavo>. + Kontrolu, ke vi vidas :'<,'>w TESTO antaŭ ol premi <Enenklavo>. 5. Vim konservos la apartigitajn liniojn al la dosiero TESTO. Uzu :dir aŭ :!ls por vidigi ĝin. Ne forviŝu ĝin. Ni uzos ĝin en la sekvanta @@ -688,7 +688,7 @@ RIMARKO: Premo de v komencas Viduman apartigon. Vi povas movi la kursoron ** Por enmeti la enhavon de dosiero, tajpu :r DOSIERNOMON ** - 1. Movu la kursoron ĵus super ĉi tiu linio. + 1. Movu la kursoron tuj super ĉi tiu linio. RIMARKO: Post plenumo de paŝo 2, vi vidos tekston el la leciono 5.3. Tiam moviĝu SUBEN por vidi tiun lecionon denove. @@ -741,7 +741,7 @@ RIMARKO: Vi nun povas legi la eliron de ekstera komando. Ekzemple, 2. Tajpu la minusklan literon o por malfermi linion SUB la kursoro kaj eniri la Enmetan reĝimon. - 3. Nun tajpu tekston kaj premu <ESK> por eliri la Enmetan reĝimon. + 3. Nun tajpu tekston kaj premu <ESK> por eliri el la Enmeta reĝimo. ---> Post tajpo de o la kursoro moviĝas al la malfermata linio en Enmeta reĝimo. @@ -765,7 +765,7 @@ RIMARKO: Vi nun povas legi la eliron de ekstera komando. Ekzemple, 3. Tajpu a (minuskle) por aldoni tekston POST la kursoro. 4. Kompletigu la vorton same kiel la linio sub ĝi. Premu <ESK> por - eliri la Enmetan reĝimon. + eliri el la Enmeta reĝimo. 5. Uzu e por moviĝi al la sekvanta nekompleta vorto kaj ripetu paŝojn 3 kaj 4. @@ -789,7 +789,7 @@ RIMARKO: Ĉiu a, i kaj A iras al la sama Enmeta reĝimo, la nura malsamo 2. Nun premu R kaj tajpu la nombron sub ĝi en la dua linio, por ke ĝi anstataŭigu la xxx . - 3. Premu <ESK> por foriri la Anstataŭigan reĝimon. Rimarku, ke la cetera + 3. Premu <ESK> por foriri el la Anstataŭiga reĝimo. Rimarku, ke la cetera parto de la linio restas neŝanĝata. 4. Ripetu la paŝojn por anstataŭigi la restantajn xxx. @@ -810,7 +810,7 @@ RIMARKO: Anstataŭiga reĝimo estas same kiel Enmeta reĝimo, sed ĉiu signo 1. Iru al la linio markita per ---> sube kaj poziciu la kursoron post "a)". - 2. Komencu la Viduman reĝimon per v kaj movu la kursoron ĵus antaŭ "unua". + 2. Komencu la Viduman reĝimon per v kaj movu la kursoron tuj antaŭ "unua". 3. Tajpu y por kopii la emfazitan tekston. @@ -986,6 +986,6 @@ RIMARKO: Kompletigo funkcias por multaj komandoj. Nur provu premi CTRL-D kaj Esperantigita fare de Dominique Pellé, 2008-04-01 Retpoŝto: dominique.pelle@gmail.com - Lasta ŝanĝo: 2011-11-27 + Lasta ŝanĝo: 2016-07-02 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.es b/runtime/tutor/tutor.es index 7bd0c54f88..268c40cd95 100644 --- a/runtime/tutor/tutor.es +++ b/runtime/tutor/tutor.es @@ -478,7 +478,7 @@ Nota: 1. Ctrl-g muestra la posicin del cursor en el fichero y su estado. Mayu-G mueve el cursor al final del fichero. Un nmero de lnea - sewguido de Mayu-G mueve el cursor a la lnea con ese nmero. + seguido de Mayu-G mueve el cursor a la lnea con ese nmero. 2. Pulsando / seguido de una frase busca la frase hacia ADELANTE. Pulsando ? seguido de una frase busca la frase hacia ATRS. @@ -542,7 +542,7 @@ Nota: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Leccin 5.3: UN MANDATO DE ESCRITURA SELECTIVO - ** Para guardar parte del fuchero escriba :#,# NOMBRE_DEL_FICHERO ** + ** Para guardar parte del fichero escriba :#,# NOMBRE_DEL_FICHERO ** 1. Escriba de nuevo, una vez ms, :!dir o :!ls para obtener una lista diff --git a/runtime/tutor/tutor.es.utf-8 b/runtime/tutor/tutor.es.utf-8 index 84db8fda97..49c9cdbbf9 100644 --- a/runtime/tutor/tutor.es.utf-8 +++ b/runtime/tutor/tutor.es.utf-8 @@ -121,7 +121,7 @@ NOTA: A medida que vaya avanzando en este tutor no intente memorizar, h (izquierda) j (abajo) k (arriba) l (derecha) 2. Para acceder a Vim (desde el símbolo del sistema %) escriba: - vin FILENAME <INTRO> + vim FILENAME <INTRO> 3. Para salir de Vim escriba: <ESC> :q! <INTRO> para eliminar todos los cambios. @@ -478,7 +478,7 @@ Nota: ¡Esto es muy útil en la detección de errores en un programa con 1. Ctrl-g muestra la posición del cursor en el fichero y su estado. Mayu-G mueve el cursor al final del fichero. Un número de línea - sewguido de Mayu-G mueve el cursor a la línea con ese número. + seguido de Mayu-G mueve el cursor a la línea con ese número. 2. Pulsando / seguido de una frase busca la frase hacia ADELANTE. Pulsando ? seguido de una frase busca la frase hacia ATRÁS. diff --git a/runtime/tutor/tutor.fr b/runtime/tutor/tutor.fr index ec85235847..cdfdcd665b 100644 --- a/runtime/tutor/tutor.fr +++ b/runtime/tutor/tutor.fr @@ -61,8 +61,8 @@ NOTE : Les touches fl Ceci quitte l'diteur SANS enregistrer les changements que vous avez faits. - 3. Lorsque l'invite du shell vous sera prsente, tapez la commande qui - vous a men dans ce tutoriel. Cela pourrait tre : vimtutor <Entre> + 3. Revenez ici en tapant la commande qui vous a men ce tutoriel. + Cela pourrait tre : vimtutor <Entre> 4. Si vous avez mmoris ces tapes et tes confiant, effectuez les tapes 1 3 pour sortir puis rentrer dans l'diteur. @@ -123,7 +123,7 @@ NOTE : En avan Leon 1.5 : DITION DE TEXTE - AJOUTER - ** Appuyez A pour ajouter du text. ** + ** Appuyez A pour ajouter du texte. ** 1. Dplacez le curseur sur la premire ligne ci-dessous marque --->. Peu importe sur quel caractre se trouve le curseur sur cette ligne. @@ -154,7 +154,7 @@ NOTE : En avan !! NOTE : Lisez toute la leon avant d'excuter les instructions ci-dessous !! 1. Sortez de ce tutoriel comme vous l'avez fait dans la Leon 1.2 : :q! - Ou, si vous avez accs un autre terminal, excutez y les actions + Ou, si vous avez accs un autre terminal, excutez-y les actions qui suivent. 2. l'invite du shell, tapez cette commande : vim tutor <Entre> @@ -190,7 +190,7 @@ NOTE : En avan 5. Pour insrer ou ajouter du texte tapez : i tapez le texte insrer avant le curseur <chap> - A tapez le texte ajouter aprs le curseur <chap> + A tapez le texte ajouter en fin de ligne <chap> NOTE : Appuyer <chap> vous place en mode Normal ou annule une commande partiellement tape dont vous ne voulez plus. @@ -574,7 +574,7 @@ NOTE : Quand la recherche atteint la fin du fichier, elle reprend au d 2. Puis tapez le caractre % . - 3. Le curseur se dplacera sur la parenthse out crochet correspondant. + 3. Le curseur se dplacera sur la parenthse ou crochet correspondant. 4. Tapez % pour replacer le curseur sur la parenthse ou crochet correspondant. @@ -704,7 +704,7 @@ NOTE : Si vous quittez Vim et le red 3. Appuyez : . En bas de l'cran :'<,'> va apparatre. 4. Tapez w TEST , o TEST est un nom de fichier qui n'existe pas. - Vrifiez que vous voyez :'<,'>w TEST avant de d'appuyer sur <Entre>. + Vrifiez que vous voyez :'<,'>w TEST avant d'appuyer sur <Entre>. 5. Vim va enregistrer les lignes slectionnes dans le fichier TEST. Utilisez :!dir ou :!ls pour le voir. Ne l'effacez pas encore ! @@ -854,17 +854,17 @@ NOTE : Le mode Remplacement est comme le mode Insertion, mais tous les 5. Tapez p pour coller le texte. Puis tapez : un second <chap> . 6. Utilisez le mode Visuel pour slectionner "lment", copiez-le avec y , - dplacez-vous la fin de la ligne suivant avec j$ et collez le texte + dplacez-vous la fin de la ligne suivante avec j$ et collez le texte cet endroit avec p . ---> a) ceci est le premier lment. b) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Leon 6.4 : RGLAGE DES OPTIONS + Leon 6.5 : RGLAGE DES OPTIONS - ** Rglons une option afin que la recherche et la substitution ignore la + ** Rglons une option afin que la recherche et la substitution ignorent la casse des caractres. ** 1. Recherchez 'ignore' en tapant : /ignore <Entre> @@ -1029,10 +1029,10 @@ NOTE : Le compl des Mines du Colorado et reprend des ides fournies par Charles Smith, Universit d'tat du Colorado. E-mail : bware@mines.colorado.edu. - Modifi pour Vim par Bram Moolenar. + Modifi pour Vim par Bram Moolenaar. Traduit en franais par Adrien Beau, en avril 2001. Dernires mises jour par Dominique Pell. E-mail : dominique.pelle@gmail.com - Last Change : 2013 May 10 + Last Change : 2017 Jan 16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.fr.utf-8 b/runtime/tutor/tutor.fr.utf-8 index d07d1bafaa..0ec32879c6 100644 --- a/runtime/tutor/tutor.fr.utf-8 +++ b/runtime/tutor/tutor.fr.utf-8 @@ -61,8 +61,8 @@ NOTE : Les touches fléchées devraient également fonctionner. Mais en utilisan Ceci quitte l'éditeur SANS enregistrer les changements que vous avez faits. - 3. Lorsque l'invite du shell vous sera présentée, tapez la commande qui - vous a mené dans ce tutoriel. Cela pourrait être : vimtutor <Entrée> + 3. Revenez ici en tapant la commande qui vous a mené à ce tutoriel. + Cela pourrait être : vimtutor <Entrée> 4. Si vous avez mémorisé ces étapes et êtes confiant, effectuez les étapes 1 à 3 pour sortir puis rentrer dans l'éditeur. @@ -123,7 +123,7 @@ NOTE : En avançant dans ce cours, n'essayez pas de mémoriser, apprenez par Leçon 1.5 : ÉDITION DE TEXTE - AJOUTER - ** Appuyez A pour ajouter du text. ** + ** Appuyez A pour ajouter du texte. ** 1. Déplacez le curseur sur la première ligne ci-dessous marquée --->. Peu importe sur quel caractère se trouve le curseur sur cette ligne. @@ -154,7 +154,7 @@ NOTE : En avançant dans ce cours, n'essayez pas de mémoriser, apprenez par !! NOTE : Lisez toute la leçon avant d'exécuter les instructions ci-dessous !! 1. Sortez de ce tutoriel comme vous l'avez fait dans la Leçon 1.2 : :q! - Ou, si vous avez accès à un autre terminal, exécutez y les actions + Ou, si vous avez accès à un autre terminal, exécutez-y les actions qui suivent. 2. À l'invite du shell, tapez cette commande : vim tutor <Entrée> @@ -190,7 +190,7 @@ NOTE : En avançant dans ce cours, n'essayez pas de mémoriser, apprenez par 5. Pour insérer ou ajouter du texte tapez : i tapez le texte à insérer avant le curseur <Échap> - A tapez le texte à ajouter après le curseur <Échap> + A tapez le texte à ajouter en fin de ligne <Échap> NOTE : Appuyer <Échap> vous place en mode Normal ou annule une commande partiellement tapée dont vous ne voulez plus. @@ -574,7 +574,7 @@ NOTE : Quand la recherche atteint la fin du fichier, elle reprend au début 2. Puis tapez le caractère % . - 3. Le curseur se déplacera sur la parenthèse out crochet correspondant. + 3. Le curseur se déplacera sur la parenthèse ou crochet correspondant. 4. Tapez % pour replacer le curseur sur la parenthèse ou crochet correspondant. @@ -704,7 +704,7 @@ NOTE : Si vous quittez Vim et le redémarrez de nouveau avec le fichier TEST, 3. Appuyez : . En bas de l'écran :'<,'> va apparaître. 4. Tapez w TEST , où TEST est un nom de fichier qui n'existe pas. - Vérifiez que vous voyez :'<,'>w TEST avant de d'appuyer sur <Entrée>. + Vérifiez que vous voyez :'<,'>w TEST avant d'appuyer sur <Entrée>. 5. Vim va enregistrer les lignes sélectionnées dans le fichier TEST. Utilisez :!dir ou :!ls pour le voir. Ne l'effacez pas encore ! @@ -854,17 +854,17 @@ NOTE : Le mode Remplacement est comme le mode Insertion, mais tous les 5. Tapez p pour coller le texte. Puis tapez : un second <Échap> . 6. Utilisez le mode Visuel pour sélectionner "élément", copiez-le avec y , - déplacez-vous à la fin de la ligne suivant avec j$ et collez le texte + déplacez-vous à la fin de la ligne suivante avec j$ et collez le texte à cet endroit avec p . ---> a) ceci est le premier élément. b) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Leçon 6.4 : RÉGLAGE DES OPTIONS + Leçon 6.5 : RÉGLAGE DES OPTIONS - ** Réglons une option afin que la recherche et la substitution ignore la + ** Réglons une option afin que la recherche et la substitution ignorent la casse des caractères. ** 1. Recherchez 'ignore' en tapant : /ignore <Entrée> @@ -1029,10 +1029,10 @@ NOTE : Le complètement fonctionne pour de nombreuses commandes. Essayez des Mines du Colorado et reprend des idées fournies par Charles Smith, Université d'État du Colorado. E-mail : bware@mines.colorado.edu. - Modifié pour Vim par Bram Moolenar. + Modifié pour Vim par Bram Moolenaar. Traduit en français par Adrien Beau, en avril 2001. Dernières mises à jour par Dominique Pellé. E-mail : dominique.pelle@gmail.com - Last Change : 2013 May 10 + Last Change : 2017 Jan 16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.it b/runtime/tutor/tutor.it index 8fd13268f6..57d578fb0a 100644 --- a/runtime/tutor/tutor.it +++ b/runtime/tutor/tutor.it @@ -523,7 +523,7 @@ NOTA: La posizione del cursore si vede nell'angolo in basso a destra dello schiacciato mentre premi la lettera o). Ripeti CTRL-O per andare ancora indietro. Puoi usare CTRL-I per tornare in avanti. -NOTA: "errroore" non il modo giusto di digitare errore; errroore un errore. +---> "errroore" non il modo giusto di digitare errore; errroore un errore. NOTA: Quando la ricerca arriva a fine file, ricomincia dall'inizio del file, a meno che l'opzione 'wrapscan' sia stata disattivata. @@ -730,7 +730,7 @@ NOTA: Puoi anche leggere l'output prodotto da un comando esterno. Ad es. 4. Per aprire una linea SOPRA il cursore, batti una O maiuscola, invece che una o minuscola. Prova sulla linea qui sotto. -Apri una linea SOPRA questa battendo O mentre il cursore su questa linea. +---> Apri una linea SOPRA questa battendo O mentre il cursore su questa linea. diff --git a/runtime/tutor/tutor.it.utf-8 b/runtime/tutor/tutor.it.utf-8 index 076aac3e6a..74c8120bd1 100644 --- a/runtime/tutor/tutor.it.utf-8 +++ b/runtime/tutor/tutor.it.utf-8 @@ -523,7 +523,7 @@ NOTA: La posizione del cursore si vede nell'angolo in basso a destra dello schiacciato mentre premi la lettera o). Ripeti CTRL-O per andare ancora indietro. Puoi usare CTRL-I per tornare in avanti. -NOTA: "errroore" non è il modo giusto di digitare errore; errroore è un errore. +---> "errroore" non è il modo giusto di digitare errore; errroore è un errore. NOTA: Quando la ricerca arriva a fine file, ricomincia dall'inizio del file, a meno che l'opzione 'wrapscan' sia stata disattivata. @@ -730,7 +730,7 @@ NOTA: Puoi anche leggere l'output prodotto da un comando esterno. Ad es. 4. Per aprire una linea SOPRA il cursore, batti una O maiuscola, invece che una o minuscola. Prova sulla linea qui sotto. -Apri una linea SOPRA questa battendo O mentre il cursore è su questa linea. +---> Apri una linea SOPRA questa battendo O mentre il cursore è su questa linea. diff --git a/runtime/tutor/tutor.ja.euc b/runtime/tutor/tutor.ja.euc index 2160e00e10..8cb63f2d14 100644 --- a/runtime/tutor/tutor.ja.euc +++ b/runtime/tutor/tutor.ja.euc @@ -5,7 +5,7 @@ Vim ϡΥ塼ȥꥢˤ¿Υޥɤ ˶ϤʥǥǤΥ塼ȥꥢϡʤ Vim ǽǥ ȤƻȤʤ褦ˤʤΤ˽ʬʥޥɤˤĤ򤹤褦 - ʤäƤޤ + ˤʤäƤޤ 塼ȥꥢλΤɬפʻ֤ϡФޥɤΤˤɤ ֤ȤΤˤޤ褽2530ʬǤ @@ -16,11 +16,10 @@ Υ塼ȥꥢ뤬ȤȤdzФȤߤˤʤäƤ뤳Ȥ򡢿 ƤʤФʤޤؽˤϥޥɤºݤ˻ʤ - ʤʤΤǤʸϤɤʤСä˺Ƥޤޤ! + ʤʤΤǤʸϤɤʤСä˺Ƥޤޤ! - Capså(Shift-Lock)ƤʤȤǧ塢̤ - å1.1 ɽȤޤǡj 򲡤ƥư - 礦 + CapsåƤʤȤǧ塢̤˥å1.1 + ɽȤޤǡj 򲡤ƥưޤ礦 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ å 1.1: ΰư @@ -55,8 +54,7 @@ NOTE: 2. Τ褦˥: :q! <ENTER> ˤԽƤ¸˥ǥλޤ - 3. ץץȤФƤ顢Υ塼ȥꥢϤ٤ˤ˥ޥ - 򥿥פޤ + 3. Υ塼ȥꥢϤ٤Υޥɤ¹Ԥȡޤ Υޥɤ: vimtutor <ENTER> 4. ޤǤΥƥåפФĤʤСƥå 1 3 ޤǤ @@ -156,7 +154,7 @@ NOTE: 4. ѹե¸ޤ: :wq <ENTER> - 5. ƥå 1 vimtutuor λ vimtutor ٵưʲ + 5. ƥå 1 vimtutor λ vimtutor ٵưʲ ؿʤߤޤ礦 6. ʾΥƥåפɤ򤷤Ǥ¹Ԥޤ礦 @@ -243,7 +241,7 @@ NOTE: <ESC> d - ޥɡ ⡼ - ФƯ뤫(ʲ˵󤲤ޤ) - ڥ졼ΰ: + ⡼ΰ: w - ֤ޤñޤǡ e - ֤ޤޤʤñޤǡ $ - ֤ޤǡ @@ -707,7 +705,7 @@ NOTE: 3. v ⡼ :w FILENAME Ȥȡӥ奢Ԥե¸ 롣 - 4. :r ե̾ ˤե̾Ȥե뤬ǥޤ졢 + 4. :r ե̾ ˤե̾Ȥե뤬ǥޤ졢 ֤β롣 5. :r !dir dir ޥɤνϤ򥫡ְʲɤ߹ࡣ @@ -791,7 +789,7 @@ NOTE: 1. ---> ȼ줿Ԥذư "a)" θ֤Ƥޤ - 2. v ǥӥ奢⡼ɤ򳫻Ϥ"first"μޤǥưޤ + 2. v ǥӥ奢⡼ɤ򳫻Ϥ"first" μޤǥưޤ 3. y 򥿥פƶĴɽ줿ƥȤ yank (ԡ)ޤ @@ -904,7 +902,7 @@ NOTE: 1 ** CTRL-D <TAB> ǥޥɥ饤䴰 ** - 1. ѥ⡼ɤǤʤȤǧޤ: :set nocp + 1. ߴ⡼ɤǤʤȤǧޤ: :set nocp 2. ߤΥǥ쥯ȥ˺ߤե :!ls :!dir dzǧޤ @@ -949,7 +947,7 @@ NOTE: ˤ Vim Υ塼ȥꥢ򽪤ޤǥñˡ⽼ʬ ȤȤǤ褦ˤȡVim λijǰΤߤ褦Ȥޤ Vim ˤϤ¿ΥޥɤꡢƤ뤳ȤϤǤޤ - ʹߤϥ桼ޥ˥奢򻲾Ȥ: ":help user-manual" + ʹߤϥ桼ޥ˥奢򻲾Ȥ: ":help user-manual" ʸγؽΤˡܤޤ Vim - Vi Improved - by Steve Oualline @@ -970,8 +968,8 @@ NOTE: Modified for Vim by Bram Moolenaar. - ܸ ٹ <mattn_jp@hotmail.com> - ƽ ¼ Ϻ <koron@tka.att.ne.jp> + ܸ ٹ <mattn.jp@gmail.com> + ƽ ¼ Ϻ <koron.kaoriya@gmail.com> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vi:set ts=8 sts=4 sw=4 tw=78: diff --git a/runtime/tutor/tutor.ja.sjis b/runtime/tutor/tutor.ja.sjis index 2a6de3ad78..1e70cbc081 100644 --- a/runtime/tutor/tutor.ja.sjis +++ b/runtime/tutor/tutor.ja.sjis @@ -5,7 +5,7 @@ Vim ́Ã`[gAŐɂ͑̃R}h ɋ͂ȃGfB^[łB̃`[gÁAȂ Vim 𖜔\GfB ^[ƂĎgȂ悤ɂȂ̂ɏ\ȃR}hɂ‚Đ悤 - ȂĂ܂B + ɂȂĂ܂B `[gÂɕKvȎԂ́AoR}ĥɂǂꂾ Ԃĝɂ܂A悻2530łB @@ -16,11 +16,10 @@ ̃`[gAAgƂŊodg݂ɂȂĂ邱ƂAS ĂȂ΂Ȃ܂BwKɂ̓R}hۂɎȂ - ȂȂ̂łB͂ǂ񂾂Ȃ΁AƖYĂ܂܂!B + ȂȂ̂łB͂ǂ񂾂Ȃ΁AƖYĂ܂܂! - ACapsbN(Shift-Lock)L[ĂȂƂmFAʂ - bX1.1 S\Ƃ܂ŁAj L[ăJ[\ړ - 傤B + ACapsbNL[ĂȂƂmFAʂɃbX1.1 + S\Ƃ܂ŁAj L[ăJ[\ړ܂傤B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bX 1.1: J[\̈ړ @@ -55,8 +54,7 @@ NOTE: 2. ̂悤Ƀ^Cv: :q! <ENTER> ɂҏWeۑɃGfB^I܂B - 3. VFvvgoĂÃ`[gAn߂ׂɂɃR}h - ^Cv܂B + 3. ̃`[gAn߂ׂ̃R}hsƁAɖ߂܂B ̃R}h: vimtutor <ENTER> 4. ܂ł̃XebvoM‚Ȃ΁AXebv 1 3 ܂ł @@ -156,7 +154,7 @@ NOTE: 4. ύXt@Cɕۑ܂: :wq <ENTER> - 5. Xebv 1 vimtutuor Iꍇ vimtutor ēxNAȉ + 5. Xebv 1 vimtutor Iꍇ vimtutor ēxNAȉ v֐i݂܂傤B 6. ȏ̃Xebvǂŗłs܂傤B @@ -243,7 +241,7 @@ NOTE: <ESC> d - 폜R}hB [V - ɑ΂ē邩(ȉɋ܂)B - Iy[^̈ꕔꗗ: + [Vꗗ̈ꕔ: w - J[\ʒu󔒂܂ޒP̖܂ŁB e - J[\ʒu󔒂܂܂ȂP̖܂ŁB $ - J[\ʒus܂ŁB @@ -707,7 +705,7 @@ NOTE: 3. v [V :w FILENAME ƂƁArWAIst@Cɕۑ B - 4. :r t@C ɂt@CƂt@CfBXN捞܂A + 4. :r t@C ɂt@CƂt@CfBXN荞܂A J[\ʒủɑ}B 5. :r !dir dir R}h̏o͂J[\ʒuȉɓǂݍށB @@ -791,7 +789,7 @@ NOTE: 1. ---> ƎꂽsֈړAJ[\ "a)" ̌ɒuĂ܂B - 2. v ŃrWA[hJnA"first"̎O܂ŃJ[\ړ܂B + 2. v ŃrWA[hJnA"first" ̎O܂ŃJ[\ړ܂B 3. y ^Cvċ\ꂽeLXg yank (Rs[)܂B @@ -904,7 +902,7 @@ NOTE: 1 ** CTRL-D <TAB> ŃR}hC⊮ ** - 1. Rp`[hłȂƂmF܂: :set nocp + 1. ݊[hłȂƂmF܂: :set nocp 2. ݂̃fBNgɍ݂t@C :!ls :!dir ŊmF܂B @@ -949,7 +947,7 @@ NOTE: ɂ Vim ̃`[gAI܂BGfB^ȒPɁA[ gƂł悤ɂƁAVim ̎ŠTO̗v_݂̂`悤Ƃ܂B Vim ɂ͂ɑ̃R}hAőSĂ邱Ƃ͂ł܂B - ȍ~̓[U}jAQƂ: ":help user-manual" + ȍ~̓[U[}jAQƂ: ":help user-manual" Ȍ̊wK̂߂ɁA̖{𐄑E܂B Vim - Vi Improved - by Steve Oualline @@ -970,8 +968,8 @@ NOTE: Modified for Vim by Bram Moolenaar. - { { ׍O <mattn_jp@hotmail.com> - ďC Y <koron@tka.att.ne.jp> + { { ׍O <mattn.jp@gmail.com> + ďC Y <koron.kaoriya@gmail.com> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vi:set ts=8 sts=4 sw=4 tw=78: diff --git a/runtime/tutor/tutor.ja.utf-8 b/runtime/tutor/tutor.ja.utf-8 index 66a818ad90..fdca0eb36e 100644 --- a/runtime/tutor/tutor.ja.utf-8 +++ b/runtime/tutor/tutor.ja.utf-8 @@ -5,7 +5,7 @@ Vim は、このチュートリアルで説明するには多すぎる程のコマンドを備えた非常 に強力なエディターです。このチュートリアルは、あなたが Vim を万能エディ ターとして使いこなせるようになるのに十分なコマンドについて説明をするよう - なっています。 + になっています。 チュートリアルを完了するのに必要な時間は、覚えたコマンドを試すのにどれだ け時間を使うのかにもよりますが、およそ25から30分です。 @@ -16,11 +16,10 @@ このチュートリアルが、使うことで覚えられる仕組みになっていることを、心し ておかなければなりません。正しく学習するにはコマンドを実際に試さなければ - ならないのです。文章を読んだだけならば、きっと忘れてしまいます!。 + ならないのです。文章を読んだだけならば、きっと忘れてしまいます! - さぁ、Capsロック(Shift-Lock)キーが押されていないことを確認した後、画面に - レッスン1.1 が全部表示されるところまで、j キーを押してカーソルを移動しま - しょう。 + さぁ、Capsロックキーが押されていないことを確認した後、画面にレッスン1.1 + が全部表示されるところまで、j キーを押してカーソルを移動しましょう。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ レッスン 1.1: カーソルの移動 @@ -55,8 +54,7 @@ NOTE: カーソルキーでも移動できます。しかし hjkl に一度慣 2. 次のようにタイプ: :q! <ENTER> これにより編集した内容を保存せずにエディタが終了します。 - 3. シェルプロンプトが出てきたら、このチュートリアルを始める為ににコマンド - をタイプします。 + 3. このチュートリアルを始める為のコマンドを実行すると、ここに戻れます。 そのコマンドは: vimtutor <ENTER> 4. これまでのステップを覚え自信がついたならば、ステップ 1 から 3 までを実 @@ -156,7 +154,7 @@ NOTE: 全てのレッスンを通じて、覚えようとするのではなく 4. 変更をファイルに保存します: :wq <ENTER> - 5. ステップ 1 で vimtutuor を終了した場合は vimtutor を再度起動し、以下の + 5. ステップ 1 で vimtutor を終了した場合は vimtutor を再度起動し、以下の 要約へ進みましょう。 6. 以上のステップを読んで理解した上でこれを実行しましょう。 @@ -243,7 +241,7 @@ NOTE: <ESC> キーを押すとノーマルモードに移行します。その d - 削除コマンド。 モーション - 何に対して働きかけるか(以下に挙げます)。 - オペレータの一部一覧: + モーション一覧の一部: w - カーソル位置から空白を含む単語の末尾まで。 e - カーソル位置から空白を含まない単語の末尾まで。 $ - カーソル位置から行末まで。 @@ -707,7 +705,7 @@ NOTE: 外部コマンドの出力を読み込むことも出来ます。例え 3. v モーションで :w FILENAME とすると、ビジュアル選択行がファイルに保存さ れる。 - 4. :r ファイル名 によりファイル名というファイルがディスクより取込まれ、 + 4. :r ファイル名 によりファイル名というファイルがディスクより取り込まれ、 カーソル位置の下に挿入される。 5. :r !dir は dir コマンドの出力をカーソル位置以下に読み込む。 @@ -791,7 +789,7 @@ NOTE: 置換モードは挿入モードに似ていますが、全てのタイ 1. ---> と示された行へ移動し、カーソルを "a)" の後に置いておきます。 - 2. v でビジュアルモードを開始し、"first"の手前までカーソルを移動します。 + 2. v でビジュアルモードを開始し、"first" の手前までカーソルを移動します。 3. y をタイプして強調表示されたテキストを yank (コピー)します。 @@ -904,7 +902,7 @@ NOTE: 1つの検索コマンドだけ大文字小文字の区別をやめたい ** CTRL-D と <TAB> でコマンドラインを補完する ** - 1. コンパチモードでないことを確認します: :set nocp + 1. 互換モードでないことを確認します: :set nocp 2. 現在のディレクトリに在るファイルを :!ls か :!dir で確認します。 @@ -949,7 +947,7 @@ NOTE: 補完は多くのコマンドで動作します。そして CTRL-D と <T これにて Vim のチュートリアルを終わります。エディタを簡単に、しかも充分に 使うことができるようにと、Vim の持つ概念の要点のみを伝えようとしました。 Vim にはさらに多くのコマンドがあり、ここで全てを説明することはできません。 - 以降はユーザマニュアルを参照ください: ":help user-manual" + 以降はユーザーマニュアルを参照ください: ":help user-manual" これ以後の学習のために、次の本を推薦します。 Vim - Vi Improved - by Steve Oualline @@ -970,8 +968,8 @@ NOTE: 補完は多くのコマンドで動作します。そして CTRL-D と <T Modified for Vim by Bram Moolenaar. - 日本語訳 松本 泰弘 <mattn_jp@hotmail.com> - 監修 村岡 太郎 <koron@tka.att.ne.jp> + 日本語訳 松本 泰弘 <mattn.jp@gmail.com> + 監修 村岡 太郎 <koron.kaoriya@gmail.com> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vi:set ts=8 sts=4 sw=4 tw=78: diff --git a/runtime/tutor/tutor.lv b/runtime/tutor/tutor.lv new file mode 100644 index 0000000000..8f7ab56e33 --- /dev/null +++ b/runtime/tutor/tutor.lv @@ -0,0 +1,1009 @@ +=============================================================================== += Ī s a p a m ā c ī b a V I M - Versija 1.7 = +=============================================================================== + + Vim ir jaudīgs teksta redaktors ar pārāk daudzām komandām, lai to + aprakstītu tik īsā aprakstā kā šis. Šī pamācība ir paredzēta, lai + spētu iemācīties tik daudz, cik nepieciešams, lietojot Vim, kā plaša + pielietojuma teksta redaktoru. + + Atkarībā no tā, cik daudz laika veltīsiet eksperimentiem, + šīs pamācības aptuvenais izpildīšanas laiks ir 25 — 30 minūtes. + + UZMANĪBU: + Darbojoties ar komandām, jūs izmainīsiet šo tekstu, tāpēc izveidojiet šī + faila kopiju (ja jūs palaidāt "vimtutor" komandu, šī jau ir kopija). + + Svarīgi atcerēties, ka šo pamācību ir paredzēts izpildīt praktiski! + Ja jūs tikai lasīsiet šo tekstu, jūs komandas aizmirsīsiet! + + Tagad pārliecinieties, ka tastatūrai nav nospiesti SHIFT vai + CAPS-LOCK taustiņi un spiediet j taustiņu, līdz pilnībā redzat + + 1.1 nodarbības saturu +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.1 nodarbība: KURSORA PĀRVIETOŠANA + + ** Lai pārvietotu kursoru, spiediet taustiņus h, j, k, l ** + + Lai atcerētos, + izmantojiet vārdus: k "Kaugšup" + ^ + pa "Heisi" h < > l pa "Labi" + v + j "Jejup" + + 1. Pārvietojiet kursoru pa ekrānu tik ilgi, kamēr pierodat. + + 2. Turiet j taustiņu tik ilgi, kamēr ieslēdzas tā auto-atkārtošana. + Un dodieties uz nākamo nodarbību. + +PIEZĪME: Ja neesat pārliecināts par nospiesto taustiņu, spiediet <ESC>, + lai atgrieztos normālajā režīmā, un spiediet vajadzīgo taustiņu atkal. + +PIEZĪME: Kursora vadībai var izmantot arī bultiņu taustiņus, bet ticiet — + iemācīties vadīt ar j, k, l, h taustiņiem ir daudz parocīgāk! + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.2 nodarbība: IZIEŠANA NO VIM + + !! PIEZĪME: Pirms izpildīt šīs nodarbības soļus, izlasiet visu instrukciju! + + 1. Lai būtu drošs, ka esat normālajā režīmā, nospiediet <ESC> taustiņu. + + 2. Ievadiet komandu: :q! <ENTER>. + Ievadot šo komandu, jūs iziesiet no redaktora nesaglabājot izmaiņas. + + 3. Ja palaidāt vim komandrindā, tad pēc tam atkal to izsauciet, ievadot + vimtutor <ENTER> + + 4. Kad esat iegaumējis 1. — 3. soli, izpildiet tos, lai atgrieztos + redaktorā. + +PIEZĪME: :q! <ENTER> komanda atceļ visas failā radītās izmaiņas. Pēc dažām + nodarbībām jūs uzzināsiet, kā izmaiņas varat saglabāt. + + 5. Pārvietojiet kursoru, uz 1.3 nodarbību. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.3 nodarbība: TEKSTA REDIĢĒŠANA – DZĒŠANA + + ** Lai izdzēstu zem kursora atrodošos burtu, spiediet x ** + + 1. Pārvietojiet kursoru uz līniju ar atzīmi --->. + + 2. Lai izlabotu kļūdas, pārvietojiet kursoru uz vajadzīgo burtu. + + 3. Spiediet x taustiņu, lai izdzēstu nevajadzīgo burtu. + + 4. Atkārtojiet 2. līdz 4. soļus, līdz teksts ir pareizs. + +---> Hiiipijiiii čččauuukstiiina celllofānu. + + 5. Kad augstāk parādītā rinda ir izlabota, dodieties uz 1.4. nodarbību. + +PIEZĪME: Izpildot šo pamācību, centieties mācīties nevis domājot, + bet gan praktiski trenējot kustību atmiņu. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.4 nodarbība: TEKSTA REDIĢĒŠANA — IEVIETOŠANA + + ** Lai ievietotu tekstu, spiediet i ** + + 1. Pārvietojiet kursoru uz pirmo līniju ar atzīmi --->. + + 2. Lai ierakstītu tekstu augšējā rindā tieši tādu pašu kā apakšējā, + novietojiet kursoru tieši PĒC ievietojamā teksta. + + 3. Spiediet i un ievadiet visu nepieciešamo tekstu. + + 4. Pēc katra papildinājuma, spiediet <ESC> lai atgrieztos normālajā režīmā. + Atkārtojiet 2. līdz 4. soļus, līdz teksts ir pareizs. + +---> Šaā lnij no tksta rūkt dai buti. + Šajā līnijā no teksta trūkst daži burti. + + 5. Kad esat apguvis šīs darbības, dodieties uz 1.5. nodarbību. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.5 nodarbība: TEKSTA REDIĢĒŠANA — PIEVIENOŠANA + + ** Lai pievienotu tekstu, spiediet A ** + + 1. Pārvietojiet kursoru uz pirmo līniju ar atzīmi --->. + Nav svarīgi, uz kura šīs rindas burta atrodas kursors. + + 2. Spiediet A un pievienojiet iztrūkstošo tekstu. + + 3. Kad nepieciešamais teksts ir pievienots, spiediet <ESC>, + lai atgrieztos normālajā režīmā. + + 4. Pārvietojiet kursoru uz otro līniju ar atzīmi ---> + un atkārtojiet 2. un 3. soļus. + +---> Šajā līnijā tekstam + Šajā līnijā tekstam pietrūkst beigas. +---> Šajā līnijā t + Šajā līnijā tekstam pietrūkst beigas. + + 5. Kad esat apguvis šīs darbības, dodieties uz 1.6. nodarbību. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.6 nodarbība: FAILA SAGLABĀŠANA + + ** Lai saglabātu failu un izietu no redaktora, spiediet :wq ** + + !! PIEZĪME: Pirms izpildīt šo nodarbību, izlasiet visus tās soļus! + + 1. Pārliecinieties, ka esat pareizi izpildījis visas iepriekšējās nodarbības. + + 2. Ja neesat pārliecināts, izejiet no redaktora, kā 1.2. nodarbībā ar komandu: + :q! + + 3. Tad atkal palaidiet pamācību, un, ja nepieciešams, veiciet failā izmaiņas. + + 4. Saglabājiet faila izmaiņas, redaktorā ievadot :w tutor <ENTER> + Izejiet no redaktora, ievadot komandu :wq <ENTER> + + 5. Palaidiet atkal šo pamācību, terminālī ievadot komandu: vim tutor + Šajā komandā vārds "vim" izsauc teksta redaktoru, bet + vārds "tutor" ir faila nosaukums, kurā ir saglabāta izmainītā pamācība. + + 5. Kad esat sapratis veicamās darbības, izpildiet tās. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1. nodarbības APKOPOJUMS + + + 1. Kursoru pārvieto ar bultiņu vai arī h,j,k,l taustiņiem: + h (pa kreisi) j (lejup) k (augšup) l (pa labi) + + 2. Lai ar Vim rediģētu noteiktu failu, ievadiet komandu: vim fails <ENTER> + + 3. Lai izietu no Vim ievadiet: + <ESC> :q! <ENTER> lai pazaudētu izmaiņas. + <ESC> :wq <ENTER> lai saglabātu izmaiņas. + + 4. Lai izdzēstu burtu zem kursora, spiediet x + + 5. Lai ievietotu vai pievienotu tekstu, spiediet: + i ievadāmais teksts <ESC> lai ievietotu pirms kursora + A pievienojamais teksts <ESC> lai pievienotu rindas beigās + +PIEZĪME: <ESC> spiešana atgriezīs jūs normālajā režīmā, vai arī atcels + nepareizu vai daļēji ievadītu komandu. + +Tagad dodieties uz 2. nodarbību. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.1 nodarbība: DZĒŠANAS KOMANDAS + + + ** Lai izdzēstu vārdu, spiediet dw ** + + 1. Nospiediet <ESC> lai pārliecinātos, ka esat normālajā režīmā. + + 2. Pārvietojiet kursoru uz rindu ar atzīmi --->. + + 3. Pārvietojiet kursoru uz izdzēšamā vārda sākumu. + + 4. Ievadiet dw lai izdzēstu nepieciešamo vārdu. + +PIEZĪME: Nospiežot d, ekrāna labajā apakšējā stūrī parādīsies d burts. + Tas ir tāpēc, ka Vim gaida nākamo komandu (burtu w). + Ja jūs redzat citu burtu, vai neredzat neko, esat kaut ko izdarījis + nepareizi. Tad spiediet <ESC> un sāciet no sākuma. + +---> Šajā kuku teikumā ir tata daži lala vārdi, kuri mumu nav vajadzīgi. + + 5. Izpildiet 3. — 4. soļus, līdz teksts ir pareizs un dodieties uz 2.2. nodarbību. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.2 nodarbība: CITAS DZĒŠANAS KOMANDAS + + + ** Lai izdzēstu līdz rindas beigām, spiediet d$ ** + + 1. Nospiediet <ESC> lai pārliecinātos, ka esat normālajā režīmā. + + 2. Pārvietojiet kursoru uz rindu ar atzīmi --->. + + 3. Pārvietojiet kursoru līdz pirmā teikuma beigām (PĒC pirmā punkta). + + 4. Ievadiet d$ lai izdzēstu tekstu no kursora līdz rindas beigām. + +---> Kāds ir ievadījis teikuma beigas divreiz. ievadījis teikuma beigas divreiz. + + + 5. Dodieties uz 2.3 nodarbību, lai labāk izprastu, kā tas notiek. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.3 nodarbība: OPERATORI UN KOMANDAS + + + Daudzas tekstu mainošās komandas sastāv no operatora un kustības. + Dzēšanas komanda, kuru izsauc ar d operatoru vispārīgā gadījumā ir sekojoša: + + d kustība + + Kur: + d - ir dzēšanas operators. + kustība - ir operators, kas nosaka dzēšanas veidu. + + Biežāk izplatītās kustības ir: + w - līdz nākamā vārda sākumam, NEIESKAITOT tā pirmo burtu. + e - līdz tekošā vārda beigām, IESKAITOT pēdējo burtu. + $ - līdz rindas beigām, IESKAITOT tās pēdējo burtu. + + Piemēram, ievadot de tiks izdzēsts teksts no kursora līdz rindas beigām. + +PIEZĪME: Ievadot kustības komandu normālajā režīmā, tā pārvietos kursoru uz + norādīto vietu. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.4 nodarbība: KUSTĪBAS SKAITA IZMANTOŠANA + + + ** Pirms kustības ievadot skaitli, tā tiks atkārtota norādās reizes. ** + + 1. Pārvietojiet kursoru uz līniju ar atzīmi --->. + + 2. Ievadiet 2w lai pārvietotu kursoru par 2 vārdiem uz priekšu. + + 3. Ievadiet 3e lai pārvietotu kursoru par 3 vārdiem atpakaļ. + + 4. Ievadiet 0 (nulli), lai pārvietotu kursoru uz rindas sākumu. + + 5. Atkārtojiet 2. — 3. soļus ar dažādiem skaitļiem. + +---> Šī ir rinda ar vārdiem, kurā jūs varat pārvietoties. + + 6. Dodieties uz nodarbību 2.5. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.5 nodarbība: SKAITĻA IZMANTOŠANA DZĒŠANAI + + + ** Ievadot skaitli pirms operatora, tas tiks atkārtots norādītās reizes. ** + + Pirms augšminētajām dzēšanas un pārvietošanās darbībām + var ievadīt skaitli, lai norādītu cik reizes to izpildīt, formā: + d skaitlis kustība + + 1. Pārvietojiet kursoru uz pirmo vārdu ar LIELAJIEM BURTIEM rindā ar atzīmi --->. + + 2. Ievadiet komandu d2w lai izdzēstu divus vārdus ar LIELAJIEM BURTIEM + + 3. Atkārtojiet pirmo soli, dzēšanas komandai norādot dažādus skaitļus, + lai izdzēstu visus vārdus ar LIELAJIEM BURTIEM + +---> šajā ABC DE rindā FGHI JK LMN OP ir jāizdzēš liekie Q RS TUV vārdi + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.6 nodarbība: DARBĪBAS AR RINDĀM + + + ** Ievadiet dd lai izdzēstu visu teksta rindu. ** + + Tā kā veselas rindas izdzēšana ir izplatīta darbība, Vi dizaineri nolēma + tās dzēšanu realizēt ar dubultu d ievadīšanu. + + 1. Pārvietojiet kursoru uz otro rindu ar atzīmi ---> + 2. Ievadiet dd lai izdzēstu rindu. + 3. Pārvietojiet kursoru uz ceturto rindu. + 4. Ievadiet 2dd lai izdzēstu divas rindas. + +---> 1) Astoņi kustoņi, +---> 2) astoņi kustoņi, +---> 3) kas tos astoņus kustoņus pirks? +---> 4) Zirgs. +---> 5) Astoņi kustoņi, +---> 6) astoņi kustoņi, +---> 7) kas tos astoņus kustoņus pirks? +---> 8) Cirks. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.7 nodarbība: ATCELŠANAS KOMANDA + + + ** Lai atceltu darbību, spiediet u ** + ** Lai atceltu visas darbības tekošajā rindā, spiediet U ** + + 1. Pārvietojiet kursoru uz rindu ar atzīmi ---> un novietojiet to uz + pirmās kļūdas. + 2. Pārvietojiet kursoru un ievadiet x lai izdzēstu visus liekos burtus. + 3. Ievadiet u lai atceltu iepriekšējo komandu. + 4. Šī darbība atcels iepriekšējo darbību, kuru veicāt, ievadot x + 5. Ievadiet U lai atgrieztos sākuma stāvoklī. + 6. Ievadiet u vairākas reizes, lai atceltu U un iepriekšējās komandas. + 7. Ievadiet CTRL-R t.i.: + nospiediet CTRL un, to neatlaižot, Shift un to neatlaižot un r + vairākas reizes, lai atceltu atcelšanas darbības. + +---> Iizlabojiet kļūudas šaajā riindā, aatceliet tās un aatceliet aatcelšanu. + + 8. Šīs ir svarīgas un noderīgas iespējas. + Tagad pārejiet uz 2. nodarbības apkopojumu. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2. nodarbības APKOPOJUMS + + + 1. Lai izdzēstu vārdu, uz kura atrodas kursors, ievada: dw + 2. Lai izdzēstu rindu no kursora līdz tās beigām, ievada: d$ + 3. Lai izdzēstu visu rindu, ievada: dd + 4. Lai atkārtotu kustības darbību, pirms tās ievada skaitli, piemēram: + 2w + + 5. Lai atkārtotu izmaiņu darbību, komandu formāts ir sekojošs: + operators [skaitlis] kustība + kur: + operators - ir veicamā darbība, piemēram, d lai dzēstu + [skaitlis] - ir neobligāts darbības atkārtojumu skaits + kustība - pārvieto kursoru tik tālu, cik ir veicama darbība, piem: + w lai pārvietotos par vienu vārdu, + $ lai pārvietotos līdz rindas beigām u.tml. + + 6. Lai pārvietotos uz rindas sākumu, ievada: 0 (nulli) + + 7. Lai atceltu iepriekšējo darbību, ievada: u (mazo u) + Lai atceltu visas rindā veiktās izmaiņas, ievada: U (Shift+U) + Lai atceltu atcelšanas darbības, ievada: CTRL-R (Ctrl+Shift+r) + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 3.1 nodarbība: IEVIETOŠANAS DARBĪBA + + + ** Lai pēc kursora ievietotu iepriekš izdzēstu tekstu, spiediet p ** + + 1. Pārvietojiet kursoru uz pirmo rindu ar atzīmi ---> + + 2. Ievadiet dd lai izdzēstu visu rindu un saglabātu to reģistrā. + + 3. Pārvietojiet kursoru uz c) rindu (virs vietas, kur būtu jāievieto + dzēstā rinda). + + 4. Spiediet p lai ievietotu reģistrā saglabāto rindu. + + 5. Atkārtojiet soļus 2 līdz 4 līdz rindas ir pareizajā secībā. + +---> d) Zirgs. +---> c) kas tos astoņus kustoņus pirks? +---> b) astoņi kustoņi, +---> a) Astoņi kustoņi, + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 3.2 nodarbība: AIZVIETOŠANAS KOMANDA + + + ** Lai aizvietotu burtu ar citu, ievadiet r un nepieciešamo burtu. ** + + 1. Pārvietojiet kursoru uz pirmo rindu ar atzīmi ---> + + 2. Pārvietojiet kursoru, lai iezīmētu pirmo nepareizo burtu. + + 3. Ievadiet r un tad burtu, uz kuru iezīmēto ir nepieciešams nomainīt. + + 4. Atkārtojiet soļus 2 un 3 līdz ir pirmā rinda atbilst otrajai rindai. + +---> Iavadut šo rixdu, kuds ar nuspeedis napariizus teusteņus! +---> Ievadot šo rindu, kāds ir nospiedis nepareizus taustiņus! + + 5. Tagad dodieties uz 3.3. nodarbību. + +PIEZĪME: Atcerieties, ka jums ir jāmācās darbojoties, + nevis vienkārši mēģinot atcerēties! + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 3.3 nodarbība: IZMAIŅU DARBĪBA + + + ** Lai izmainītu tekstu līdz vārda beigām, spiediet ce ** + + 1. Pārvietojiet kursoru uz pirmo rindu ar atzīmi ---> + + 2. Novietojiet kursoru virs pirmā Š vārdā Šma. + + 3. Ievadiet ce un izlabojiet vārdu uz pareizu (šajā gad. "Šīs"). + + 4. Spiediet <ESC> un pārvietojiet kursoru uz nākamo maināmo vārdu. + + 5. Atkārtojiet soļus 3 un 4 līdz pirmā un otrā rinda ir vienādas. + +---> Šma rindas vamula nepieciešams šimahaļ, lietojot šašābiļabita darbību. +---> Šīs rindas vārdus nepieciešams izlabot, lietojot izmainīšanas darbību. + +Ievērojiet, ka pēc ce un vārda ievades jūs paliekat ievietošanas režīmā. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 3.4 nodarbība: CITAS MAINĪŠANAS DARBĪBAS AR c + + + ** Izmaiņu kustības operatoru lieto tieši tāpat kā dzēšanai. ** + + 1. Izmaiņu kustības operators darbojas tāpat kā dzēšanai. Formāts ir: + + c [skaitlis] kustība + + 2. Var lietot tos pašus kustības operatorus w (vārds) un $ (rindas beigas). + + 3. Pārvietojiet kursoru uz pirmo rindu ar atzīmi --->. + + 4. Pārvietojiet kursoru uz pirmo kļūdu. + + 5. Ievadiet c$ rakstiet nomaināmo tekstu līdz rindas beigām un spiediet <ESC>. + +---> Šī teksta beigas nepieciešams izlabot, lietojot c$ komandu. +---> Šī teksta beigas nepieciešams izlabot, lietojot c$ šari-vari-traļi-muļi. + +PIEZĪME: Lai labotu nepareizi ievadītu tekstu, spiediet <BACKSPACE> taustiņu. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 3. NODARBĪBAS APKOPOJUMS + + + 1. Lai ievietotu izdzēsto tekstu, spiediet p taustiņu. Ar to ievietosiet + dzēsto tekstu PĒC kursora. (Ja bija izdzēsta vesela rinda, tā tiks + ievietota rindā VIRS kursora.) + + 2. Lai izmainītu burtu zem kursora, spiediet r un pēc tam + jums nepieciešamo rakstzīmi. + + 3. Izmaiņu operators ļauj jums nomainīt tekstu no kursora līdz + kustības operatora norādītajai vietai. Piemēram, + ievadot ce jūs izmaināt tekstu no kursora līdz VĀRDA beigām, bet + ievadot c$ jūs nomaināt tekstu no kursora līdz RINDAS beigām. + + 4. Izmaiņu komandas formāts ir: + + c [skaitlis] kustība + +Tagad dodieties uz nākamo nodarbību. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4.1 nodarbība: KURSORA VIETA FAILĀ UN FAILA STATUSS + + ** Lai noteiktu kursora atrašanās vietu failā un faila statusu, spiediet CTRL-g + Lai pārvietotu kursoru uz noteiktu faila rindu, spiediet G ** + + PIEZĪME: Pirms pildīt šo uzdevumu, izlasiet visas tā darbības līdz beigām! + + 1. Spiediet Ctrl taustiņu, un neatlaižot to, spiediet g saīsināti CTRL-g. + Redaktora ekrāna apakšā parādīsies statusa rinda, ar faila statusu + un rindu kurā atrodas kursors, kā arī citu informāciju. + Atcerieties šo vietu, lai izpildītu 3. darbību. + +PIEZĪME: Jūs varat redzēt kursora atrašanās vietu failā vienmēr ekrāna + labajā apakšējā stūrī, ja redaktoram ir ieslēgta ruler opcija. + (Skatiet palīdzību par šo komandu, ievadot :help 'ruler') + + 2. Lai pārvietotu kursoru uz faila beigām, ievadiet G + Lai pārvietotu kursoru uz faila sākumu, ievadiet gg + + 3. Ievadiet iepriekš iegaumētās rindas numuru un tad ievadiet G + Ar šo jūs pārvietosiet kursoru atpakaļ rindā, kurā jūs sākāt + šo nodarbību. + + 4. Atkārtojiet darbības 1. — 3. tik ilgi, kamēr droši atceraties šīs komandas. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4.2 nodarbība: MEKLĒŠANAS KOMANDA + + + ** Lai meklētu tekstā, spiediet / un ievadiet meklējamo frāzi. ** + + 1. Normālajā režīmā spiediet / taustiņu. Ievērojiet, ka kursors pārvietojas + uz redaktora apakšējo rindu, līdzīgi, kā nospiežot taustiņu : + lai ievadītu dažādas komandas. + + 2. Tad ievadiet vārdu kļūūūda un spiediet <ENTER>. + Ar šo jūs izgaismosiet atrasto meklējamo redaktorā. + + 3. Lai atrastu nākošo vārdu, spiediet n taustiņu. + Lai pārvietotu kursoru uz nākamo atrasto vietu tekstā uz augšu, + ievadiet N + + 4. Lai meklētu frāzi augšupejošā virzienā / vietā lietojiet ? + + 5. Lai atgrieztos uz vietu, kurā sākāt meklēšanu, spiediet CTRL-O + (spiediet Ctrl, tad, to neatlaižot spiediet arī o). To var turpināt, + lai dotos tālāk atpakaļ, vai arī spiest CTRL-i, lai dotos uz priekšu. + +---> "kļūūūda" nav pareizs vārds; kļūda ir vienkārši kļūda. + +PIEZĪME: Ja ir atrasta pēdējā meklējamā frāze faila beigās vai sākumā, + pēc nākamā meklējuma tiks atrasta pirmā/pēdējā faila sākumā/beigās, + ja vien nav atslēgta wrapscan opcija. + +PIEZĪME: Ja vairs nevēlaties izgaismot meklējamo tekstu, spiediet / + un ievadiet nesakarīgu/neatrodamu frāzi. (VIM speciālisti parasti + piekārto savu taustiņu kombināciju šai darbībai.) + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4.3 nodarbība: SAISTĪTO IEKAVU MEKLĒŠANA + + + ** Lai atrastu saistīto ),], vai } iekavu, ievadiet % ** + + 1. Novietojiet kursoru uz iekavām (, [, { rindā ar atzīmi --->. + + 2. Ievadiet % simbolu. + + 3. Kursors pārvietosies uz izvēlētajai iekavai atbilstošo pretējo iekavu. + + 4. Ievadiet % lai pārvietotos atpakaļ uz atbilstošo pretējo iekavu. + + 5. Pārvietojiet kursoru uz cita veida iekavu (,),[,],{ or } un pārbaudiet, + kas notiek atkārtoti ievadot % + +---> Šī ir (testa rinda ar dažādām (-veida, [-veida] un {-veida} iekavām.)) + + +PIEZĪME: Šī iespēja ir ļoti noderīga, lai pārbaudītu nelīdzsvarotas iekavas + programmas kodā + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4.4 nodarbība: AIZVIETOŠANAS KOMANDA + + + ** Ievadiet :s/vecais/jaunais/g lai aizvietotu 'vecais' ar 'jaunais'. ** + + 1. Novietojiet kursoru rindā ar atzīmi --->. + + 2. Ievadiet :s/ss/s<ENTER> + Ievērojiet, ka šī komanda nomaina tikai pirmo atrasto frāzi. + + 3. Tagad ievadiet :s/ss/s/g<ENTER> + Ievērojiet, ka slēdzis g liek aizvietot frāzi visās atrastajās vietās. + +---> visslabākaiss laikss vērot ziedus ir pavassariss. + + 4. Aizvietošanas komandai var norādīt darbības diapazonu: + + ievadiet :#,#s/vecais/jaunais/g kur #,# ir diapazona sākuma un beigu rinda + ievadiet :%s/vecais/jaunais/g lai aizvietotu frāzi visā failā + ievadiet :%s/vecais/jaunais/gc lai aizvietotu visā failā ar uzaicinājumu + apstiprināt katru aizvietošanu + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4.5 nodarbība: DARBĪBAS ATKĀRTOŠANA + + ** Lai atkārtotu iepriekšējo darbību, spiediet . ** + + Atšķirībā no citiem teksta redaktoriem, Vim par vienu darbību uzskata + vairāku ievadīto komandu virkni ārpus normālā režīma (t.i. ievietošanas, + aizstāšanas u.tml.). Tas ļauj viegli atkārtot sarežģītas darbības, spiežot + . taustiņu. + + 1. Pārliecinieties, ka esat normālajā režīmā, spiežot <ESC>. + + 2. Sameklējiet pirmo skaitli rindā ar --->, ievadot: /11 + + 3. Ievadiet komandu 2sll un atgriezieties normālajā režīmā. + + 4. Lai sameklētu nākamo skaitli un atkārtotu iepriekšējo aizstāšanas darbību, + spiediet: n. + +---> ba11e ce11e ha11e le11e ka11a mu11a nu11e ra11ijs šte11e ti11s ze11is +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4. nodarbības APKOPOJUMS + + 1. CTRL-G statusa rindā parāda faila nosaukumu, statusu un kursora atrašanās + vietu + G pārvieto kursoru uz faila beigām. + skaitlis G pārvieto kursoru uz norādīto rindu. + gg pārvieto kursoru uz faila sākumu. + + 2. Ievadot / un frāzi, to meklē failā uz priekšu + Ievadot ? un frāzi, to meklē failā atpakaļ + Pēc pirmās atrastās frāzes, spiežot n sameklē nākamo frāzi tajā pašā virzienā + vai arī, spiežot N, sameklē nākamo frāzi pretējā virzienā. + CTRL-o pārvieto kursoru uz iepriekšējo izmaiņu vietu, CTRL-i uz nākamo vietu. + . atkārto iepriekšējo darbību, ko var apvienot ar meklēšanu: n. vai N. + + 3. Ja kursors atrodas uz (,),[,],{, vai }, ievadot % kursors pārvietojas uz + pretējo iekavu. + + 4. Lai aizvietotu frāzi tekošajā rindā vienreiz, ievadiet: :s/vecais/jaunais + Lai aizvietotu visas frāzes tekošajā rindā, ievadiet: :s/vecais/jaunais/g + Lai aizvietotu visas frāzes starp norādītajām rindām: :#,#s/vecais/jaunais/g + Lai aizvietotu visas frāzes failā, ievadiet: :%s/vecais/jaunais/g + Lai aizvietotu visas frāzes failā ar apstiprinājumu: :%s/vecais/jaunais/gc + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 5.1 nodarbība: KĀ IZPILDĪT ĀRĒJU KOMANDU + + + ** Ievadiet :! un pēc tam sekojošo ārējo komandu. ** + + 1. Nospiediet ierasto : lai parādītu uzaicinājumu statusa rindā + + 2. Šajā rindā ievadiet ! (izsaukuma zīmi). Tā norāda VIM, ka būs jāizpilda + ārēja (komandrindas čaulas) komanda + + 3. Pēc tam ievadiet, piemēram ls un spiediet <ENTER> + Šī komanda ekrāna apakšējā daļā parādīs failu sarakstu. + Ja lietojat Windows, ls komandas vietā ievadiet dir + +PIEZĪME: Izsaucamās komandas izpilda nospiežot <ENTER> taustiņu, kopš šī brīža + mēs to vairs īpaši neuzsvērsim. Lai aizvērtu komandas izvadīto saturu, + arī jāspiež <ENTER> taustiņš. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 5.2 nodarbība: VAIRĀK PAR FAILU SAGLABĀŠANU + + ** Lai saglabātu failu ar noteiktu nosaukumu, ievadiet :w NOSAUKUMS ** + + 1. Ievadiet :!ls (vai :!dir), lai apskatītu failu sarakstu. + Atcerieties, ka pēc komandu nosaukuma ievades jānospiež <ENTER>! + + 2. Izdomājiet jaunu faila nosaukumu, piemēram, test + + 3. Tagad ievadiet: :w test1 (kur test ir jūsu izvēlētais faila nosaukums) + + 4. Šī komanda saglabās vim pamācību failā test + Lai pārbaudītu, ievadiet :!ls vai :!dir un sameklējiet failu sarakstā + +PIEZĪME: Ja jūs iziesiet no vim un palaidīsiet to ar komandu vim test + vim atvērs jūsu saglabāto test failu. + + 5. Tagad izdzēsiet šo failu, ievadot komandu: :!rm test + Vai, ja lietojat Windows, komandu: :!del test + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 5.3 nodarbība: TEKSTA DAĻĒJA SAGLABĀŠANA + + ** Lai saglabātu tikai daļu no faila, ievadiet: v kustība :w fails ** + + 1. Pārvietojiet kursoru uz šo rindu + + 2. Spiediet v un pārvietojiet kursoru līdz piektajam punktam. + + 3. Spiediet : simbolu. Statusa rindā parādīsies :'<,'> + + 4. Ievadiet w test kur test ir izvēlētais faila nosaukums. + Pirms spiest <ENTER>, pārliecinieties, ka redzat :'<,'>w test + + 5. Vim saglabās iezīmēto tekstu failā test. + Neizdzēsiet šo failu, mēs to izmantosim nākošajā nodarbībā! + +PIEZĪME: Spiežot v VIM pārslēdzas vizuālā iezīmēšanas režīmā. Jūs varat izmantot + kursora pārvietošanas komandas, lai iezīmētu nepieciešamo tekstu. + Pēc teksta iezīmēšanas, jūs varat izmantot dažādus operatorus, lai + kaut ko darītu ar iezīmēto tekstu. Piemēram, spiežot d jūs izdzēsīsit + iezīmēto tekstu. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 5.4 nodarbība: FAILU SATURA IEGŪŠANA UN APVIENOŠANA + + ** Lai ievietotu faila saturu, ievadiet :r fails ** + + 1. Novietojiet kursoru tieši virs šīs rindas. + +PIEZĪME: Pēc 2. soļa izpildes, jūs redzēsiet tekstu no 5.3 nodarbības. + Pēc tam pārvietojiet kursoru uz leju, lai lasītu tālāk šīs + nodarbības saturu. + + 2. Iegūstiet test faila saturu, ievadot komandas :r test + kur test ir jūsu iepriekšējā nodarbībā saglabātais fails. + Ielasītā faila saturs tiek ievietots zem kursora. + + 3. Lai pārbaudītu, ka darbība ir izdevusies, pārliecinieties, ka 5.4 + nodarbības aprakstā ir saturs no 5.3 nodarbības. + +PIEZĪME: Jūs varat ievadīt saturu failā, izpildot ārēju komandu. + Piemēram, ar komandu :r !ls + jūs ievietosiet failā tekošās mapes failu sarakstu. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 5. nodarbības APKOPOJUMS + + 1. :!komanda izpilda ārēju komandu + + Daži noderīgi piemēri: + (MS-DOS) (Unix) + :!dir :!ls - parāda mapes saturu + :!del fails :!rm fails - izdzēš norādīto failu + + 2. :w fails saglabā tekošo failu failā ar norādīto nosaukumu. + + 3. v kustība :w fails saglabā vizuāli iezīmēto tekstu norādītajā failā. + + 4. :r fails ielasa faila saturu tekošajā failā zem kursora. + + 5. :r !ls ielasa izpildītās komandas atgriezto saturu failā zem kursora. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.1 nodarbība: ATVĒRŠANAS KOMANDA + + ** Ievadiet o lai ievadītu jaunu rindu virs kursora un pārietu ievades režīmā. ** + + 1. Pārvietojiet kursoru uz rindu ar atzīmi --->. + + 2. Ievadiet mazo o lai ievadītu jaunu rindu virs kursora un pārslēgtos + ievades režīmā. + + 3. Ievadiet kādu tekstu un spiediet <ESC>, lai izietu no ievades režīma. + +---> Ievadot o izveidosiet rindu virs šīs un pāriesiet ievades režīmā. + + 4. Lai izveidotu rindu ZEM kursora, ievadiet lielo O. + +---> Ievadot O izveidosiet rindu zem šīs un pāriesiet ievades režīmā. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.2 nodarbība: PIEVIENOŠANAS KOMANDA + + ** Ievadiet a lai ievietotu jaunu tekstu PĒC kursora. ** + + 1. Pārvietojiet kursoru uz pirmo rindu ar atzīmi --->. + + 2. Spiediet e līdz kursors ir pirmā nepabeigtā vārda beigās. + + 3. Ievadiet a (mazo a), lai pievienotu tekstu pēc kursora. + + 4. Ievadiet tekstu, lai abas rindas ar atzīmi ---> sakrīt. + Spiediet <ESC>, lai pārietu normālajā režīmā. + + 5. Ievadiet e, lai novietotu kursoru nākamā nepabiegtā vārda beigās, + un atkārtojiet soļus 3 un 4. + +---> Šī rin ju palīd praktiz tekst pievienoš vārd bei +---> Šī rinda jums palīdzēs praktizēties teksta pievienošanā vārdu beigās. + +PIEZĪME: No normālā režīma pāriet uz ievades režīmu ievadot a, i, A un I. + Atšķirība ir tikai tā, kur tiek uzsākta teksta ievade: a – pēc kursora, + i — pirms kursora, A — rindas beigās, I — rindas sākumā. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.3 nodarbība: VĒL VIENS AIZVIETOŠANAS VEIDS + + ** Lai aizvietotu vairāk kā vienu rakstzīmi, spiediet R ** + + 1. Pārvietojiet kursoru uz rindu ar atzīmi --->. + + 2. Pārvietojiet kursoru uz pirmo no xxx + + 3. Spiediet R un ievadiet skaitli, kas norādīts apakšējā rindā tā, + lai ievadītie cipari pārraksta xxx. + + 4. Lai izietu no aizvietošanas režīma, spiediet <ESC>. + Pārliecinieties, ka pārējais rindas saturs nav izmainīts. + + 5. Atkārtojiet 2. — 4. soļa darbības, lai līdzīgi aizvietotu pārējos xxx. + +---> Saskaitot xxx ar xxx iegūstam xxx. +---> Saskaitot 123 ar 456 iegūstam 579. + +PIEZĪME: Aizvietošanas režīms darbojas līdzīgi ievietošanas režīmam, ar + tikai ievadītās rakstzīmes aizvieto esošās. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.4 nodarbība: TEKSTA KOPĒŠANA UN IEVIETOŠANA + + ** Lai kopētu tekstu, izmantojiet y, bet lai ievietotu — p ** + + 1. Pārvietojiet kursoru uz rindu ar atzīmi ---> un novietojiet kursoru + pēc "a)" + + 2. Ieslēdziet vizuālo režīmu, spiežot v un pārvietojiet kursoru līdz + "pirmais" (to neskaitot) + + 3. Spiediet y lai iekopētu izcelto tekstu + + 4. Pārvietojiet kursoru uz nākamās rindas beigām, spiežot j$ + + 5. Spiediet p lai ievietotu nokopēto tekstu. Pēc tam spiediet <ESC> + + 6. Ierakstiet otrās rindas beigās vārdu "otrais" + + 7. Līdzīgi, lietojot v y un p, nokopējiet vārdu "simtdivdesmitpiecgadnieks", + lai iegūtu rindu: šis ir otrais simtdivdesmitpiecgadnieks. + +---> a) šis ir pirmais simtdivdesmitpiecgadnieks. + b) + + PIEZĪME: y var lietot kopā ar pārvietošanās operatoru, piemēram, + spiežot yw var nokopēt izvēlēto vārdu. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.5 nodarbība: IESTATĪJUMU MAIŅA + + ** Iestatiet meklēšana un aizstāšana, neievērojot lielos/mazos burtus ** + + 1. Sameklējiet vārdu 'neievērot', ievadot: /neievērot <ENTER> + Atkārtojiet meklēšanu, spiežot n + + 2. Iestatiet 'ic' (Neievērot lielos/mazos burtus) iestatījumu, ievadot: :set ic + + 3. Tagad sameklējiet 'neievērot' atkārtoti, spiežot n + Ievērojiet, ka tiek atrasti vārdi Neievērot un NEIEVĒROT. + + 4. Iestatiet 'hlsearch' un 'incsearch' opcijas, ievadot: :set hls is + + 5. Ievadiet atkal sekojošo komandu, un skatieties, kas notiek: /neievērot <ENTER> + + 6. Lai atceltu lielo/mazo burtu neievērošanu, ievadiet: :set noic + +PIEZĪME: Lai atceltu atrasto vietu izcelšanu, ievadiet: :nohlsearch +PIEZĪME: Ja vēlaties meklēt gan lielos, gan mazos burtus vienā meklējumā, + ievadiet papildu komandu \c + Piemēram: /neievērot\c <ENTER> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6. nodarbības APKOPOJUMS + + Lai pārietu uz ievietošanas režīmu un: + + 1. lai ievietotu jaunu rindu zem tekošās, ievadiet o + lai ievietotu jaunu rindu virs tekošās, ievadiet O + + 2. Lai ievietotu tekstu pēc kursora, ievadiet a + Lai ievietotu tekstu rindas beigās, ievadiet A + + Normālajā režīmā: + + 3. e komanda pārvieto kursoru uz vārda beigām. + + 4. y komanda nokopē tekstu, bet p komanda ievieto to. + + 5. R ieslēdz aizvietošanas režīmu, līdz tiek nospiests <ESC>. + + 6. Ievadot ":set xxx" iestata "xxx" opciju. Dažas no tām ir sekojošas: + 'ic' 'ignorecase' meklējot neievēro lielos/mazos burtus. + 'is' 'incsearch' uzreiz meklē daļēji ievadīto frāzi. + 'hls' 'hlsearch' izgaismo atrastās frāzes. + Var norādīt gan īso, gan garo opcijas nosaukumu. + + 7. Lai opciju izslēgtu, pievieno priedēkli "no". Piemēram, :set noic + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7.1 nodarbība: PALĪDZĪBAS IEGŪŠANA + + + ** Iebūvētās palīdzības izmantošana ** + + Vim ir plaša iebūvētā palīdzības sistēma. Lai sāktu to lietot, ievadiet vieno + no sekojošām komandām: + - spiediet <HELP> taustiņu (ja jūsu tastatūrā tāds pastāv) + - spiediet <F1> taustiņu (ja jūsu tastatūrai ir tāds) + - ievadiet :help <ENTER> + + Izlasiet palīdzības aprakstu, lai saprastu, kā tas darbojas. + Ievadiet CTRL-W CTRL-W lai pārslēgtos uz citu logu. + Ievadiet :q <ENTER> lai aizvērtu palīdzības logu. + + Jūs varat atrast konkrētu palīdzību par jebkuru komandu, ievadot: + ":help" komanda. Piemēram (neaizmirstiet komandas beigās nospiest <ENTER>): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7.2 nodarbība: IZVEIDOJIET SĀKŠANAS SKRIPTU + + ** Ieslēdziet Vim iespējas ** + + Vim ir daudz plašākas iespējas, nekā Vi, bet vairums no tām, + pēc noklusēšanas, nav ieslēgtas. Lai tās ieslēgtu, izveidojiet "vimrc" failu. + + 1. Atkarībā no lietotās operētājsistēmas, atveriet "vimrc" failu sekojoši: + :e ~/.vimrc Unix-veidīgā (t.sk. MacOS un Linux) + :e $VIM/_vimrc VMS-veidīgā (t.sk. MS-Windows) + + 2. Ielasiet "vimrc" šablona faila saturu, ievadot: + :r $VIMRUNTIME/vimrc_example.vim + + 3. Saglabājiet šablona saturu savā iestatījumu failā: + :w + + Kad nākamo reizi atvērsiet Vim, tajā tiks izmantota sintakses izgaismošana. + Jūs varat ievietot arī citas iestatījumu iespējas savā "vimrc" failā. + Papildu informācijai ievadiet :help vimrc-intro + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7.3 nodarbība: AUTOMĀTISKĀ PABEIGŠANA + + ** Automātisko pabeigšanu komandrindā izsauc ar CTRL-D un <TAB> ** + + 1. Pārliecinieties, ka Vim ir ar Vi nesavietojamā režīmā: :set nocp + + 2. Apskatiet tekošās mapes saturu Vim, ievadot: :!ls vai :!dir + + 3. Ievadiet komandas sākumu ar: :e + + 4. Spiediet CTRL-D un Vim parādīs visas komandas, kuras sākas ar "e". + + 5. Spiediet <TAB> un Vim automātiski pabeigs komandu uz ":edit". + + 6. Spiediet atstarpes taustiņu un sāciet ievadīt faila nosaukumu, + piemēram: :edit FIL + + 7. Spiediet <TAB> un Vim pabeigs faila nosaukumu, + ja norādītais sākums ir unikāls. + +PIEZĪME: Pabeigšana strādā dažādām komandām. + Vienkārši mēģiniet spiest CTRL-D un <TAB>. + Šī iespēja var būt īpaši noderīga, ievadot :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7. nodarbības APKOPOJUMS + + + 1. Lai atvērtu palīdzības logu, ievadiet :help vai spiediet <F1> vai <Help> + + 2. Lai atvērtu palīdzību par "komanda", ievadiet :help komanda + + 3. Lai pārslēgtos uz citu logu, spiediet: CTRL-W CTRL-W + + 4. Lai aizvērtu tekošo logu, ievadiet: :q + + 5. Izveidojiet savu "vimrc" sākšanas skriptu ar saviem iestatījumiem. + + 6. Ievadot : komanda spiediet CTRL-D, lai apskatītu iespējamos pabeigšanas + veidus. Lai pabeigtu komandu, spiediet <TAB> . + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Ar šo Vim ievads ir pabeigts. Tajā tika sniegts īss Vim redaktora apraksts, + ar kuru pietiek, lai Vim lietotu vienkāršām darbībām. + Vim iespējas ir daudz plašākas, un tajā ir daudz vairāk komandu. Lai apskatītu + tās, ievadiet: ":help user-manual". + + Tālākai apmācībai tiek rekomendētas sekojošas grāmatas: + + Vim - Vi Improved, Steve Oualline, New Riders + + Šī grāmata ir tieši par Vim, un ir ļoti ieteicama iesācējiem. + Daudzi piemēri un attēli no tās pieejami: http://iccf-holland.org/click5.html + + Otra, vecāka grāmata ir par Vi, nevis Vim, bet arī ir ļoti noderīga: + + Learning the Vi Editor, Linda Lamb, O'Reilly & Associates Inc. + + Tajā ir visplašākais Vi iespēju apraksts, grāmatas sestajā laidienā ir + aprakstītas arī Vim iespējas. + + Šīs pamācības variantu angļu valodā izveidoja: + + * Michael C. Pierce, + * Robert K. Ware, + * Charles Smith, + * Bram Moolenaar. + + Pamācību latviešu valodā tulkoja: + + * Valdis Vītoliņš + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.pt b/runtime/tutor/tutor.pt index 57b4462ef9..fe787dd1f2 100644 --- a/runtime/tutor/tutor.pt +++ b/runtime/tutor/tutor.pt @@ -1,36 +1,36 @@ =============================================================================== -= B e m V i n d o a o V I M T u t o r - Verso 1.7 pt_BR = += B e m - v i n d o ao t u t o r i a l do V I M - Verso 1.8 pt_BR = =============================================================================== Vim um poderoso editor que possui muitos comandos, tantos que seria - impossvel ensinar num tutorial como este. Este tutorial planejado para - apresentar os comandos suficientes para voc ficar habilitado a usar - facilmente o Vim como um editor de textos genrico. + impossvel ensin-los num tutorial como este, que concebido para + apresentar os comandos suficientes para permiti-lo usar facilmente o + Vim como um editor de textos genrico. - O tempo aproximado requerido para completar o tutorial de 25-30 minutos, + O tempo necessrio para completar o tutorial de cerca de 25-30 minutos, dependendo de quanto tempo gasto praticando os comandos. ATENO: - Os comandos nas lies vo modificar o texto. Utilize uma cpia deste - arquivo para praticar os comandos (se voc iniciou o "vimtutor", esta j + Os comandos nas lies modificam este texto. Faa uma cpia deste + arquivo para praticar os comandos (se usou o "vimtutor", esta j uma cpia). - importante lembrar que este tutorial planejado para ensinar atravs da + importante lembrar que este tutorial concebido para ensinar pela prtica. Isso significa que voc precisa executar os comandos para aprend-los adequadamente. Se voc somente ler o texto, esquecer os comandos! Agora, certifique-se de que sua tecla Shift-Lock (ou Caps Lock) no esteja ativada e pressione a tecla j o bastante para mover o cursor at que a - Lio 1.1 esteja completamente na tela. + Lio 1.1 aparea inteiramente na tela. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.1: MOVENDO O CURSOR + Lio 1.1: MOVER O CURSOR ** Para mover o cursor, pressione as teclas h,j,k,l conforme indicado. ** ^ - k Dica: A tecla h est esquerda e move para a esquerda. - < h l > A tecla l est direita e move para a direita. + k Dica: A tecla h est esquerda e move esquerda. + < h l > A tecla l est direita e move direita. j A tecla j se parece com uma seta para baixo. v 1. Mova o cursor pela tela at que voc se sinta confortvel. @@ -38,30 +38,29 @@ 2. Segure pressionada a tecla (j) at haver repetio. Agora voc j sabe como ir para a prxima lio. - 3. Usando a tecla j, mova at a lio 1.2. + 3. Usando a tecla j, v para a Lio 1.2. -NOTA: Se voc est inseguro sobre o que digitou, pressione <ESC> para - coloc-lo no modo Normal. Ento redigite o comando que voc queria. +NOTA: Se est inseguro sobre o que digitou, pressione <ESC> para + coloc-lo no modo Normal. Ento redigite o comando que queria. -NOTA: As teclas de cursor devem funcionar tambm. Mas usando hjkl, to logo +NOTA: As teclas de cursor funcionam tambm. Mas usando hjkl, to logo esteja acostumado, voc poder se mover muito mais rapidamente. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.2: SAINDO DO VIM + Lio 1.2: SAIR DO VIM - !! NOTA: Antes de executar qualquer dos passos abaixo, leia a lio inteira !! + !! NOTA: Antes de executar quaisquer dos passos abaixo, leia a lio inteira !! 1. Pressione <ESC> (para ter certeza de que est no modo Normal). - 2. Digite :q! <ENTER>. - Isso sai do editor SEM salvar qualquer mudana que tenha sido feita. - Se quiser salvar as alteraes e sair, digite :wq <ENTER> + 2. Digite: :q! <ENTER>. + Assim, sai do editor SEM salvar qualquer mudana feita. - 3. Repita o procedimento que lhe trouxe a este tutorial. O procedimento pode + 3. Repita o procedimento que o trouxe a este tutorial. O procedimento pode ter sido a digitao de: vimtutor <ENTER>. - 4. Se voc memorizou estes passos e est confiante, execute os passos de + 4. Se memorizou estes passos e est confiante, execute os passos de 1 a 3 para sair e reentrar no editor. NOTA: :q! <ENTER> descarta qualquer mudana. Em uma prxima lio ser @@ -70,9 +69,9 @@ NOTA: :q! <ENTER> descarta qualquer mudan 5. Desa o cursor at a Lio 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.3: EDITANDO TEXTOS - DELEO + Lio 1.3: EDITAR TEXTOS - REMOO - ** No modo Normal, pressione x para deletar o caractere sob o cursor. ** + ** Pressione x para deletar o caractere sob o cursor. ** 1. Mova o cursor para a linha abaixo marcada com --->. @@ -80,47 +79,47 @@ NOTA: :q! <ENTER> descarta qualquer mudan 2. Para corrigir os erros, mova o cursor at que ele esteja sobre o caractere a ser deletado. - 3. Pressione a tecla x para deletar o caractere indesejado. + 3. Pressione a tecla x para remover o caractere incorreto. - 4. Repita os passos 2 at 4 at que a sentena esteja correta. + 4. Repita os passos 2 at 4 at que a frase esteja correta. ---> A vvaca pullouu por ccimaa dda luuua. - 5. Agora que a sentena est correta, v para a Lio 1.4. + 5. Agora que a frase est correta, prossiga para a Lio 1.4. NOTA: Enquanto segue este tutorial, no tente memorizar, aprenda pelo uso. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.4: EDITANDO TEXTOS - INSERO + Lio 1.4: EDITAR TEXTOS - INSERO ** Pressione i para inserir texto. ** 1. Mova o cursor at a primeira linha abaixo marcada com --->. - 2. Para fazer a primeira linha ficar igual segunda, mova o cursor para + 2. Para deixar a primeira linha igual segunda, mova o cursor para o primeiro caractere DEPOIS de onde o texto dever ser inserido. 3. Pressione i e digite as adies necessrias. 4. Assim que cada erro for corrigido pressione <ESC> para retornar ao modo - Normal. Repita os passos 2 at 4 para corrigir a sentena. + Normal. Repita os passos 2 at 4 para corrigir a frase. ----> Tem text fatado desta . ----> Tem algum texto faltando desta linha. +---> Tem text fatado nesta . +---> Tem algum texto faltando nesta linha. - 5. Quando se sentir confortvel com a insero de texto, mova o cursor para - a lio 1.5. + 5. Quando se sentir vontade com a insero de texto, mova o cursor para + a Lio 1.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.5: EDITANDO TEXTO - ADICIONANDO + Lio 1.5: EDITAR TEXTO - ADICIONAR ** Pressione A para adicionar texto. ** - 1. Mova o curso para a primeira linha abaixo marcada com --->. + 1. Mova o cursor para a primeira linha abaixo marcada com --->. No importa sobre qual caractere o cursor estar na linha. 2. Pressione A e digite as adies necessrias. @@ -128,41 +127,41 @@ NOTA: Enquanto segue este tutorial, n 3. Quando adicionar o texto, pressione <ESC> para retornar ao modo Normal. 4. Mova o cursor para a segunda linha marcada ---> e repita os passos 2 e 3 - para corrigir o texto. + para corrigir a frase. ----> H algum texto faltando des - H algum texto faltando desta linha. +---> H algum texto faltando nes + H algum texto faltando nesta linha. H algum texto faltan ---> H algum texto faltando aqui. - 5. Quando se sentir confortvel adicionando texto, mova para a lio 1.6. + 5. Quando se sentir confortvel adicionando texto, v para a Lio 1.6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 1.6: EDITANDO UM ARQUIVO + Lio 1.6: EDITAR UM ARQUIVO + ** Use :wq para salvar um arquivo e sair. ** - !! NOTA: Antes de executar qualquer um dos passos abaixo, - leia esta lio completamente!! + !! NOTA: Leia toda a lio antes de executar as instrues!! 1. Saia deste tutorial como o fez na lio 1.2: :q! Ou, se tiver acesso a outro terminal, faa o seguinte nele. 2. No prompt do shell, digite esse comando: vim tutor <ENTER> - 'vim' is comando para iniciar o editor Vim e 'tutor' o nome do - arquivo que voc deseja editar. Use um arquivo que possa ser modificado. + 'vim' o comando para iniciar o editor Vim e 'tutor' o nome do + arquivo que voc quer editar. Use um arquivo que possa ser modificado. - 3. Insira e delete texto tal como aprendeu com as lies anteriores. + 3. Insira e apague texto tal como aprendeu nas lies anteriores. 4. Salve o arquivo com as mudanas e saia do Vim com: :wq <ENTER> - 5. Se voc tiver sado do vimtutor no passo 1, reinicie o vimtutor e v para - o sumrio seguinte. + 5. Se tiver sado do vimtutor no passo 1, reinicie o vimtutor e v para + o resumo seguinte. 6. Aps ler os passos acima e compreend-los, execute-os. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 1 + RESUMO DA LIO 1 1. O cursor movido usando tanto as teclas de seta quanto as teclas hjkl. h (esquerda) j (para baixo) k (para cima) l (direita) @@ -185,9 +184,9 @@ NOTA: Pressionando <ESC> voc Agora continue com a Lio 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 2.1: COMANDOS DE DELEO + Lio 2.1: COMANDOS DE REMOO - ** Digite dw para deletar at o final de uma palavra. ** + ** Digite dw para apagar uma palavra. ** 1. Pressione <ESC> para ter certeza de que est no modo Normal. @@ -198,19 +197,19 @@ Agora continue com a Li 4. Digite dw para fazer a palavra desaparecer. - NOTA: A letra d vai aparece na ltima linha da tela enquanto voc a - digita. O Vim est lhe esperando digitar um w . Se voc digitou + NOTA: A letra d vai aparecer na ltima linha da tela enquanto voc a + digita. O Vim o est esperando digitar um w . Se digitou alguma coisa errada, pressione <ESC> e comece de novo. ----> Tem a algumas oi palavras diverso que no pertencem papel a esta sentena. +---> Tem a algumas oi palavras diverso que no pertencem papel a esta frase. - 5. Repita os passos 3 ao 4 at que a sentena esteja correta e v para a + 5. Repita os passos 3 ao 4 at que a frase esteja correta e v para a Lio 2.2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 2.2: MAIS COMANDOS DE DELEO + Lio 2.2: MAIS COMANDOS DE REMOO - ** Digite d$ para deletar at o final da linha. ** + ** Digite d$ para deletar at o fim da linha. ** @@ -218,13 +217,13 @@ Agora continue com a Li 2. Mova o cursor at a linha abaixo marcada com --->. - 3. Mova o cursor at o fim da linha correta (DEPOIS do primeiro .). + 3. Mova o cursor at o fim da linha correta (DEPOIS do primeiro . ). - 4. Digite d$ para deletar at o final da linha. + 4. Digite d$ para apagar at o fim da linha. ----> Algum digitou o final desta linha duas vezes. desta linha duas vezes. +---> Algum digitou o fim desta linha duas vezes. desta linha duas vezes. - 5. V para a lio 2.3 para entender o que est acontecendo. + 5. V para a lio 2.3 para entender o funcionamento deste comando. @@ -233,30 +232,31 @@ Agora continue com a Li ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 2.3: SOBRE OPERADORES E MOVIMENTOS - Muitos comandos que mudam texto so feitos de um operador e um movimento. - O formato para um comando deletar com o operador de deleo d tem a + Muitos comandos que mudam texto so feitos de um operador e de um movimento. + O formato para um comando apagar com o operador de remoo d tem a seguinte forma: d movimento + Onde: - d - o operador deletar. - movimento - como o operador vai operar (listado abaixo). + d - o operador apagar. + movimento - o movimento sobre o qual o operador age (listado abaixo). Uma pequena lista de teclas de movimento: - w - do cursor at o fim da palavra, incluindo o espao. - e - do cursor at o fim da palavra, NO incluindo o espao. - $ - do cursor at o fim da linha. + w - at o incio da prxima palavra, excluindo seu primeiro caractere. + e - at o fim da palavra atual, incluindo seu ltimo caractere. + $ - at o fim da linha, incluindo seu ltimo caractere. - Portanto, digitando de ir deletar do cursor ao fim da palavra. + Portanto, digitar de apaga do cursor ao fim da palavra. -NOTA: Pressionando apenas a tecla de movimento enquanto em modo Normal, sem o -operador, ir mover o cursor como especificado na lista de teclas de +NOTA: Pressionar apenas a tecla de movimento em modo Normal, sem o +operador, faz o cursor se mover como especificado na lista de teclas de movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 2.4: USANDO UM CONTADOR PARA UM MOVIMENTO + Lio 2.4: USAR UM CONTADOR PARA UM MOVIMENTO - ** Digitando um nmero antes de um movimento repete-o muitas vezes. ** + ** Digitar um nmero antes de um movimento repete-o o tanto de vezes. ** 1. Mova o cursor para o comeo da linha marcada com ---> abaixo. @@ -269,7 +269,7 @@ movimento. 5. Repita os passos 2 e 3 com diferentes nmeros. ----> Esta uma linha com algumas palavras para lhe permitir fazer movimentos. +---> Esta uma linha com algumas palavras para permiti-lo fazer movimentos. 6. V para a Lio 2.5. @@ -277,22 +277,22 @@ movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 2.5: USANDO UM CONTADOR PARA DELETAR MAIS + Lio 2.5: USAR UM CONTADOR PARA APAGAR MAIS - ** Digitando um nmero com um operador repete-o esse nmero de vezes. ** + ** Digitar um nmero com um operador repete-o esse nmero de vezes. ** - Voc deve inserir um contador entre o operador de deleo e o movimento - mencionados acima para para deletar mais: + Voc deve inserir um contador entre o operador de remoo e o de movimento + mencionados acima para apagar mais: d nmero movimento - 1. Movimente o cursor para a primeira palavra com LETRAS MAISCULAS na + 1. Movimente o cursor para a primeira palavra em LETRAS MAISCULAS na linha marcada com --->. - 2. Digite d2w para deletar as duas palavras com LETRAS MAISCULAS. + 2. Digite d2w para deletar as duas palavras em LETRAS MAISCULAS. 3. Repita os passos 1 e 2 com diferentes contadores para deletar as - palavras de LETRAS MAISCULAS com um comando. + palavras em LETRAS MAISCULAS com um comando. ---> esta ABC DE linha FGHI JK LMN OP de palavras est Q RS TUV limpa. @@ -300,17 +300,17 @@ movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 2.6: OPERANDO SOBRE LINHAS + Lio 2.6: TRABALHAR COM LINHAS - ** Digite dd para deletar uma linha inteira. ** + ** Digite dd para apagar uma linha inteira. ** - Em virtude da frequncia em deletar uma linha inteira, os projetistas do Vi - decidiram que seria mais simples digitar dois d's numa linha para delet-la. + Em virtude da frequncia em deletar uma linha inteira, os desenvolvedores + do Vi decidiram que seria mais simples digitar dois d para apagar uma linha. - 1. Mova o cursor at a segunda linha na lista a baixo. - 2. Digite dd para deletar a linha. + 1. Mova o cursor at a segunda linha da frase abaixo. + 2. Digite dd para apagar a linha. 3. Agora mova at a quarta linha. - 4. Digite 2dd para deletar duas linhas. + 4. Digite 2dd para apagar duas linhas. ---> 1) Rosas so vermelhas, ---> 2) Lama divertida, @@ -318,92 +318,94 @@ movimento. ---> 4) Eu tenho um carro, ---> 5) Relgios dizem as horas, ---> 6) Acar doce, ----> 7) E assim voc. +---> 7) Assim como voc. Notas do tradutor: Lama (mud) em ingls pode significar fofoca, difamao. H rima no texto original. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 2.7: O COMANDO UNDO (DESFAZER) -** Pressione u para desfazer os ltimos comandos, U restaura linha inteira.** +** Pressione u para desfazer os ltimos comandos, U recupera a linha inteira.** 1. Mova o cursor para a linha abaixo marcada com ---> e posicione-o sobre o primeiro erro. - 2. Digite x para deletar o primeiro caractere indesejado. + 2. Digite x para deletar o primeiro caractere errado. 3. Agora, digite u para desfazer o ltimo comando executado. 4. Desta vez, corrija todos os erros na linha usando o comando x . 5. Agora, digite um U maisculo para retornar a linha ao seu estado original. 6. Digite u algumas vezes para desfazer o U e os comandos anteriores. 7. Digite CTRL-R (segurando a tecla CTRL enquanto digita R) algumas vezes - para refazer os comandos (desfazer os undo's). + para refazer os comandos (desfazer os undos). ---> Corriija os erros nnesta linha e reetorne-os com undo. - 8. Esses comandos so muito teis. Agora v para o sumrio da Lio 2. + 8. Esses comandos so muito teis. Agora v para o resumo da Lio 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 2 + RESUMO DA LIO 2 - 1. Para deletar do cursor at o fim de uma palavra digite: dw - 2. Para deletar do cursor at o fim de uma linha digite: d$ - 3. Para deletar uma linha inteira digite: dd - 4. Para repetir um movimento adicione antes um nmero: 2w + 1. Para apagar do cursor at a prxima palavra, digite: dw + 2. Para apagar do cursor at o fim de uma linha, digite: d$ + 3. Para apagar uma linha inteira, digite: dd + 4. Para repetir um movimento, adicione antes um nmero: 2w 5. O formato para um comando no modo Normal : operador [nmero] movimento onde: - operador - o que ser feito, como d para deletar - nmero - quantas vezes o comando ser repetido - movimento - movimento sobre o texto que sofrer a operao, como - w (palavra), $ (at o final da linha), etc. + operador - o que ser feito, como d para apagar + [nmero] - quantas vezes o comando ser repetido + movimento - movimento sobre o texto que receber a operao, como + w (palavra), $ (at o fim da linha), etc. + + 6. Para ir ao incio da linha, use um zero: 0 - 5. Para desfazer um ao anterior, digite: u (minsculo) - Para desfazer todas as modificaes em uma linha digite: U (maisculo) - Para desfazer o que foi desfeito digite: CTRL-R + 7. Para desfazer uma ao anterior, digite: u (minsculo) + Para desfazer todas as alteraes em uma linha, digite: U (maisculo) + Para desfazer o que foi desfeito, digite: CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 3.1: O COMANDO PUT (PR) + Lio 3.1: O COMANDO COLAR - ** Digite p para colocar a ltima deleo aps o cursor. ** + ** Digite p para colar aps o cursor o que acabou de apagar. ** - 1. Mova o cursor at a primeira linha na lista abaixo. + 1. Mova o cursor at a primeira linha marcada com --->. - 2. Digite dd para deletar a linha e guard-la no buffer do Vim. + 2. Digite dd para apagar a linha e guard-la num registro do Vim. - 3. Mova o cursor at a linha ACIMA de onde a linha deletada deve ficar. + 3. Mova o cursor at a linha c) ACIMA de onde a linha apagada deveria estar. 4. No modo Normal, digite p para inserir a linha. 5. Repita os passos 2 ao 4 para pr todas as linhas na ordem correta. - d) Voc pode aprender tambm? - b) Violetas so azuis, - c) Inteligncia se aprende, - a) Rosas so vermelhas, +---> d) Voc pode aprender tambm? +---> b) Violetas so azuis, +---> c) Inteligncia se aprende, +---> a) Rosas so vermelhas, Nota do tradutor: H rima no original. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 3.2: O COMANDO REPLACE (SUBSTITUIR) + Lio 3.2: O COMANDO SUBSTITUIR ** Digite rx para substituir o caractere sob o cursor por x . ** 1. Mova o cursor at a primeira linha abaixo marcada com --->. - 2. Mova o cursor at que ele esteja sobre o primeiro erro. + 2. Mova o cursor at que esteja sobre o primeiro erro. 3. Digite r e ento o caractere que deveria estar l. - 4. Repita os passos 2 e 3 at que a primeira linha esteja correta. + 4. Repita os passos 2 e 3 at que a primeira linha esteja igual segunda. ---> Quendo este limha foi dugitada, alguem pressioniu algumas teclas erradzs! ---> Quando esta linha foi digitada, algum pressionou algumas teclas erradas! @@ -417,43 +419,44 @@ NOTA: Lembre-se que voc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 3.3: O OPERADOR CHANGE (MUDAR) - ** Para mudar toda uma palavra ou parte dela, digite cw . ** + ** Para alterar at o fim de uma palavra, digite ce . ** 1. Mova o cursor at a primeira linha abaixo marcada com --->. 2. Posicione o cursor sobre o u em lunba. - 3. Digite cw e a palavra correta (nesse caso, digite 'inha'.) + 3. Digite ce e a palavra correta (nesse caso, digite 'inha'.) 4. Pressione <ESC> e mova para o prximo caractere a ser alterado. - 5. Repita os passos 3 e 4 at que a primeira sentena esteja igual segunda. + 5. Repita os passos 3 e 4 at que a primeira frase esteja igual segunda. ---> Essa lunba tem pwlesmfr que ocrimmm soi alteradas cup o comando change. ---> Essa linha tem palavras que precisam ser alteradas com o comando change. -Note que cw no somente substitui a palavra, mas tambm lhe coloca no modo -de insero. +Note que ce no somente substitui a palavra, mas tambm o coloca no modo +de Insero. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 3.4: MAIS MUDANAS USANDO c - ** O operador change usado com os mesmos objetos que delete. ** + ** O operador change usado com os mesmos movimentos que o delete. ** + 1. O operador change trabalha da mesma maneira que o delete. O formato : c [nmero] movimento - 2. Os movimentos tambm so os mesmos: w (palavra), $ (fim da linha), etc. + 2. Os movimentos tambm so os mesmos: w (palavra) e $ (fim da linha). 3. Mova at a primeira linha abaixo marcada com --->. 4. Mova o cursor at o primeiro erro. - 5. Digite c$ para fazer o resto da linha ficar igual segunda e pressione - <ESC>. + 5. Digite c$ e digite o resto da segunda para torn-las iguais e + pressione <ESC>. ---> O fim desta linha precisa de ajuda para ficar igual segunda. ---> O fim desta linha precisa ser corrigido usando o comando c$. @@ -461,18 +464,18 @@ de inser NOTA: Voc pode usar a tecla Backspace para corrigir erros enquanto digita. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 3 + RESUMO DA LIO 3 - 1. Para inserir um texto que j foi deletado, digite p . Isso coloca o texto + 1. Para reinserir um texto que j foi apagado, digite p . Isso coloca o texto deletado APS o cursor (se uma linha deletada ela ser inserida na linha abaixo do cursor). 2. Para substituir o caractere sob o cursor, digite r e ento o caractere - que ir substituir o original. + que substituir o original. 3. O comando change possibilita mudar do cursor at onde o movimento for. - Ex: Digite cw para mudar do cursor at o fim de uma palavra, c$ para + Ex: Digite ce para mudar do cursor at o fim de uma palavra, c$ para mudar at o fim da linha. 4. O formato para uma operao change : @@ -484,14 +487,14 @@ Agora v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 4.1: LOCALIZAO DO CURSOR E STATUS DO ARQUIVO + Lio 4.1: LOCALIZAO DO CURSOR E ESTADO DO ARQUIVO - ** Digite CTRL-G para mostrar sua localizao no arquivo e seu status. + ** Digite CTRL-G para mostrar sua localizao no arquivo e seu estado. Digite G para mover para uma linha do arquivo. ** Nota: Leia esta lio inteira antes de executar qualquer um dos passos!! - 1. Segure pressionada a tecla Ctrl e pressione g . Ns chamamos isso de + 1. Segure pressionada a tecla Ctrl e pressione g . Chamamos isso de CTRL-G. Uma mensagem aparecer no rodap da pgina com o nome do arquivo e a sua posio no arquivo. Lembre-se do nmero da linha para o Passo 3. @@ -499,54 +502,55 @@ NOTA: A posi tela. Isso acontece quando a opo 'ruler' est ativa (veja :help 'ruler' ). - 2. Pressione G para mover para o final do arquivo. - Digite gg para mover para o incio do arquivo. + 2. Pressione G para se mover at o fim do arquivo. + Digite gg para se mover at o incio do arquivo. - 3. Digite o nmero da linha em que voc estava e ento G . Isto - retornar o cursor linha em que voc estava quando pressionou CTRL-G. + 3. Digite o nmero da linha em que estava e ento G . Assim o cursor retornar + linha em que estava quando pressionou CTRL-G. - 4. Se voc estiver confiante para fazer isto, execute os passos 1 ao 3. + 4. Se estiver seguro para faz-los, execute os passos 1 a 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 4.2: O COMANDO SEARCH (PROCURA) + Lio 4.2: O COMANDO BUSCAR - ** Digite / seguido por uma string para procurar pela string. ** + ** Digite / seguido por uma frase para procurar por ela. ** 1. No modo Normal digite o caractere / . Note que ele e o cursor aparecem no rodap da tela, como ocorre com o comando : . - 2. Agora digite 'errroo' <ENTER>. Esta a palavra que voc quer procurar. + 2. Agora digite 'errroo' <ENTER>. Esta a palavra que quer procurar. - 3. Para procurar pela mesma palavra de novo, simplesmente tecle n . - Para procurar pela mesma palavra na direo oposta, tecle N . + 3. Para buscar a mesma palavra de novo, simplesmente tecle n . + Para buscar a mesma palavra na direo oposta, tecle N . - 4. Se voc quer procurar por uma string no sentido de frente para trs, use - ? em vez de / . + 4. Se quer procurar por uma frase de trs para frente, use ? em vez de / . - 5. Para voltar para onde estava, pressione CTRL-O (mantenha a tecla Ctrl - pressionada e pressione a tecla o). Repita para voltar outras posies. + 5. Para voltar aonde estava, pressione CTRL-O (mantenha a tecla Ctrl + pressionada e pressione a tecla o). Repita para voltar a outras posies. CTRL-I segue para posies mais recentes. ---> "errroo" no uma maneira de escrever erro; errroo um erro. -NOTA: Quando a busca atinge o final do arquivo ela continuar do comeo, a + +NOTA: Quando a busca atinge o fim do arquivo ela continuar do comeo, a menos que a opo 'wrapscan' esteja desativada. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 4.3: PROCURA POR CASAMENTO DE PARNTESES + Lio 4.3: BUSCA DE PARNTESES CORRESPONDENTES - ** Digite % para achar um casamento de ),], ou } . ** + ** Digite % para encontrar um ),], ou } correspondente. ** 1. Posicione o cursor em qualquer (, [, ou { na linha abaixo marcada com --->. 2. Agora digite o caractere % . - 3. O cursor deve estar no parnteses ou colchetes que casa com o primeiro. + 3. O cursor deve estar no parntese ou colchete que casa com o primeiro. - 4. Digite % para mover o cursor de volta ao primeiro colchete ou parnteses + 4. Digite % para mover o cursor de volta ao primeiro colchete ou parntese (por casamento). ----> Isto ( uma linha de teste contendo ('s, ['s ] e {'s }. )) +---> Isto ( uma linha de teste contendo (, [ ] e { }. )) -Nota: Isso muito til para corrigir um programa com parnteses no-casados! +Nota: Isso muito til para corrigir um programa com parntese no-casado! @@ -572,14 +576,17 @@ Nota: Isso digite :#,#s/velho/novo/g onde #,# so os nmeros das duas linhas. Digite :%s/velho/novo/g para mudar todas as ocorrncias no arquivo inteiro. - Digite :%/velho/novo/gc para mudar todas as ocorrncia no arquivo + Digite :%s/velho/novo/gc para mudar todas as ocorrncias no arquivo inteiro, com a opo de confirmar cada substituio. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 4 - 1. CTRL-G mostra a sua localizao no arquivo e o status do mesmo. - G move para o final do arquivo. - nmero G move para esta linha com esse nmero. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + RESUMO DA LIO 4 + + + 1. CTRL-G mostra em que ponto do arquivo est e o estado dele. + G move para o fim do arquivo. + nmero G move para a linha com esse nmero. gg move para a primeira linha. 2. Digitando / seguido por uma expresso procura FRENTE por ela. @@ -594,31 +601,32 @@ Nota: Isso 4. Para substituir: o primeiro 'velho' de uma linha por 'novo' digite :s/velho/novo - todos os 'velho's em uma linha por 'novo' digite :s/velho/novo/g + todos os 'velho' em uma linha por 'novo' digite :s/velho/novo/g expresses entre dois nmeros (#) de linhas digite :#,#s/velho/novo todas as ocorrncias no arquivo digite :%s/velho/novo/g Para confirmar cada substituio adicione 'c' :%s/velho/novo/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 5.1: COMO EXECUTAR UM COMANDO EXTERNO - ** Digite :! seguido por um comando externo para executar esse comando. ** + ** Digite :! seguido por um comando externo para execut-lo. ** 1. Digite o familiar comando : para levar o cursor ao rodap da tela. Isso - lhe permite entrar um comando. + o permite entrar um comando. - 2. Agora digite o caractere ! (ponto de exclamao). Isso lhe permite + 2. Agora digite o caractere ! (ponto de exclamao). Isso o permite executar qualquer comando do shell. 3. Como um exemplo digite ls seguindo o ! e ento tecle <ENTER>. Isto - ir mostrar uma listagem do seu diretrio, como se voc estivesse no + mostrar uma listagem do seu diretrio, como se voc estivesse no prompt do shell. Ou use :!dir se ls no funcionar. NOTA: possvel executar qualquer comando externo dessa maneira, inclusive com argumentos. NOTA: Todos os comandos : devem ser finalizados teclando-se <ENTER> - Daqui em diante no iremos mencionar isso sempre. + Daqui em diante no mencionaremos isso todas as vezes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -635,19 +643,19 @@ NOTA: Todos os comandos : devem ser finalizados teclando-se <ENTER> 3. Agora digite: :w TESTE (onde TESTE o nome que voc escolheu.) 4. Isto salva o arquivo inteiro (o Vim Tutor) com o nome TESTE. - Para verificar isso, digite :!ls de novo para ver seu diretrio + Para verificar isso, digite :!ls de novo para ver seu diretrio. -NOTA: Se voc sair do Vim e entrar de novo com o nome do arquivo TESTE, - o arquivo deve ser uma cpia exata do tutor quando voc o salvou. +NOTA: Se sair do Vim e entrar de novo com o nome do arquivo TESTE, + o arquivo deve ser uma cpia exata do tutorial quando voc o salvou. 5. Agora remova o arquivo digitando (MS-DOS): :!del TESTE ou (Unix): :!rm TESTE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 5.3: SELECIONANDO O TEXTO A SER SALVO + Lio 5.3: SELECIONAR O TEXTO A SER SALVO - ** Para salvar parte de um arquivo, digite v movimento NOMEDOARQUIVO ** + ** Para salvar parte de um arquivo, digite v movimento :w NOMEDOARQUIVO ** 1. Mova o cursor para esta linha. @@ -658,24 +666,24 @@ NOTA: Se voc da tela. 4. Digite w TESTE , sendo TESTE um nome de arquivo que no existe ainda. - Voc dever ver :'<,'>w TESTE antes de pressionar <ENTER>. + Certifique-se de ver :'<,'>w TESTE antes de pressionar <ENTER>. 5. O Vim salvar as linhas selecionadas no arquivo TESTE. Use :!dir ou - !:ls para v-lo. No o apague agora! Ns o usaremos na prxima lio. + !:ls para v-lo. No o apague ainda! Ns o usaremos na prxima lio. -NOTA: Pressionando v inicia o modo Visual de seleo. Voc pode mover o +NOTA: Pressionar v inicia o modo Visual de seleo. Voc pode mover o cursor pela tela para tornar a seleo maior ou menor. Pode, ento, usar um -operador para executar alguma ao. Por exemplo, d deleta o texto. +operador para executar alguma ao. Por exemplo, d apaga o texto. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 5.4: RECUPERANDO E JUNTANDO ARQUIVOS + Lio 5.4: RECUPERAR E UNIR ARQUIVOS ** Para inserir o contedo de um arquivo, digite :r NOMEDOARQUIVO ** 1. Posicione o cursor logo acima desta linha. -NOTA: Depois de executar o Passo 2 voc ver a lio 5.3. Ento DESA o +NOTA: Depois de executar o Passo 2 voc ver a Lio 5.3. Ento DESA o cursor para ver esta lio novamente. 2. Agora recupere o arquivo TESTE usando o comando :r TESTE onde TESTE o @@ -691,7 +699,7 @@ NOTA: Voc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 5 + RESUMO DA LIO 5 1. :!comando executa um comando externo. @@ -714,15 +722,15 @@ NOTA: Voc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 6.1: O COMANDO OPEN (ABRIR) + Lio 6.1: O COMANDO ABRIR - ** Digite o para abrir uma linha embaixo do cursor e ir para o modo de - Insero (INSERT). ** + ** Digite o para abrir uma linha em baixo do cursor e ir para o modo de + Insero. ** 1. Mova o cursor para a linha abaixo marcada com --->. - 2. Digite o (minsculo) para abrir uma linha ABAIXO do cursor e ir para o - modo de Insero (INSERT). + 2. Digite o (minsculo) para abrir uma linha ABAIXO do cursor e ir para o + modo de Insero. 3. Agora digite algum texto e pressione <ESC> para sair do modo de Insero. @@ -737,7 +745,7 @@ NOTA: Voc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 6.2: O COMANDO APPEND + Lio 6.2: O COMANDO ADICIONAR ** Digite a para inserir texto DEPOIS do cursor. ** @@ -754,13 +762,13 @@ NOTA: Voc 5. Use e para mover para a prxima palavra incompleta repita os passos 3 e 4. ----> Esta lin lhe permite pratic a adi de texto a uma linha. ----> Esta linha lhe permite praticar a adio de texto a uma linha. +---> Esta lin o permite pratic a adi de texto a uma linha. +---> Esta linha o permite praticar a adio de texto a uma linha. NOTA: a, i e A levam ao mesmo modo de Insero, a nica diferena onde os caracteres so inseridos. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lio 6.3: UMA OUTRA VERSO DO REPLACE (SUBSTITUIR) + Lio 6.3: UMA OUTRA VERSO DO SUBSTITUIR ** Digite um R maisculo para substituir mais de um caractere. ** @@ -772,7 +780,7 @@ NOTA: a, i e A levam ao mesmo modo de Inser linha, para substituir o xxx . 3. Pressione <ESC> para sair do modo de Substituio. Note que o resto da - linha permanece inalterada. + linha permanece inalterado. 4. Repita os passos para substituir os xxx restantes. @@ -780,48 +788,53 @@ NOTA: a, i e A levam ao mesmo modo de Inser ---> Adicionando 123 a 456 resulta em 579. NOTA: O modo de Substituio como o modo de Insero, mas cada caractere - digitado deleta um caractere existente. + digitado apaga um caractere existente. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 6.4: COPIAR E COLAR TEXTO ** Use o operador y para copiar texto e p para col-lo. ** - 1. V para a linha marcada com ---> abaixo e posicione o cursor aps "a)". + 1. V linha marcada com ---> abaixo e posicione o cursor aps "a)". 2. Inicie o modo Visual com v e mova o cursor para logo antes de "primeiro". 3. Digite y para copiar o texto selecionado. - 4. Mova o cursor para o final da prxima linha: j$ + 4. Mova o cursor para o fim da prxima linha: j$ - 5. Digite p par pr (colar) o texto. Ento, digite: o segundo <ESC> . + 5. Digite p para colar o texto. Ento, digite: o segundo <ESC> . 6. Use o modo Visual para selecionar " item.", copie-o com y , mova para - o fina da prxima linha com j$ e ponha (cole) o texto com p . + o fim da prxima linha com j$ e cole o texto com p . ---> a) esse o primeiro item. b) + NOTA: Voc tambm pode usar y como um operador; por exemplo, yw copia uma palavra. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 6.5: CONFIGURAR PREFERNCIAS - ** Configurar uma preferncia de modo que um search ou substitute - ignora se as letras esto em maisculas ou minsculas. ** + ** Configure uma preferncia de modo que uma busca ou substituio + ignore se as letras so maisculas ou minsculas. ** - 1. Procure por 'ignore' entrando: /ignore <ENTER> + 1. Procure por 'ignore' entrando: /ignore <ENTER> Repita vrias vezes teclando n . - 2. Configure a opo 'ic' (Ignore case) digitando: - :set ic + + 2. Configure a opo 'ic' (Ignore case) digitando: :set ic + 3. Agora procure por 'ignore' de novo teclando: n Repita vrias vezes. - 4. Configure as opes 'hlsearch' e 'incsearch': - :set hls is - 5. Agora entre com o comando search de novo, e veja o que acontece: + + 4. Configure as opes 'hlsearch' e 'incsearch': :set hls is + + 5. Agora entre com o comando buscar de novo, e veja o que acontece: /ignore - 6. Para desabilitar a desconsiderao de maisculas e minsculas: + + 6. Para desabilitar a diferenciao entre maisculas e minsculas: :set noic NOTA: Para remover o realce dos termos localizados entre: :nohlsearch @@ -829,32 +842,35 @@ NOTA: Se quiser ignorar a diferen uma pesquisa, use \c no comando: /ignore\c <ENTER> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 6 + RESUMO DA LIO 6 1. Digite o para abrir uma linha ABAIXO do cursor e iniciar o modo de Insero. Digite O para abrir uma linha ACIMA da linha onde o cursor est. 2. Digite a para adicionar texto DEPOIS do caractere onde est o cursor. - Digite A para adicionar texto ao final da linha. + Digite A para adicionar texto ao fim da linha. - 3. O comando e move o cursor para o final de uma palavra. + 3. O comando e move o cursor para o fim de uma palavra. - 4. O operador y copia texto, p pe (cola) o texto copiado. + 4. O operador y copia texto, p cola o texto copiado. 5. Digitando R entra-se no modo de Substituio at que <ESC> seja pressionado. 6. Digitando ":set xxx" modifica-se a opo "xxx". Algumas opes so: - 'ic' 'ignorecase' ignora diferena entre maisculas/minsculas - 'is' 'incsearch' realiza a busca enquanto se digita + 'ic' 'ignorecase' ignora diferena entre maisculas/minsculas + 'is' 'incsearch' realiza a busca enquanto se digita 'hls' 'hlsearch' reala todos os trechos localizados Voc tanto pode usar o nome curto quanto o nome longo da opo. + 7. Adicione o prefixo "no" para desabilitar uma opo: :set noic + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LIO 7.1: OBTENDO AJUDA - ** Usar o sistema de ajuda do prprio Vim ** + ** Use o sistema de ajuda do prprio Vim ** O Vim possui sistema de ajuda abrangente. Para comear, tente algum desses trs: @@ -863,11 +879,11 @@ NOTA: Se quiser ignorar a diferen - digite :help <ENTER> Leia o texto da ajuda para aprender como o sistema de ajuda funciona. - Digite CTRL-W CTRL-W para pular de uma janela para outra. - Digite :q <ENTER> para fechar a janela da ajuda. + Digite CTRL-W CTRL-W para pular de uma janela a outra. + Digite :q <ENTER> para fechar a janela da ajuda. - Voc pode achar ajuda sobre qualquer assunto, fornecendo um argumento para - o comando ":help". Tente isto (no esquea de pressionar <ENTER>): + Voc pode encontrar ajuda sobre qualquer assunto, fornecendo um argumento + para o comando ":help". Tente isto (no se esquea de pressionar <ENTER>): :help w :help c_CTRL-D @@ -877,7 +893,7 @@ NOTA: Se quiser ignorar a diferen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lio 7.2: CRIAR UM SCRIPT DE INICIALIZAO - ** Habilitar recursos do Vim ** + ** Habilite recursos do Vim ** O Vim tem muito mais recursos do que o Vi, mas na sua maioria eles so desabilitados por padro. Para usar mais recursos, voc tem que criar um @@ -893,7 +909,7 @@ NOTA: Se quiser ignorar a diferen 3. Salve o arquivo com: :w - Da prxima vez que o Vim for iniciado, ele ir usar realce de sintaxe. Voc + Da prxima vez que o Vim for iniciado, ele usar realce de sintaxe. Voc pode adicionar suas configuraes preferidas para esse arquivo "vimrc". Para maiores informaes, digite: :help vimrc-intro @@ -904,39 +920,40 @@ NOTA: Se quiser ignorar a diferen 1. Certifique-se de que o Vim no est no modo compatvel: :set nocp - 2. Olhe quais arquivos existem no diretrio: :!ls ou :!dir + 2. Veja quais arquivos existem no diretrio: :!ls ou :!dir 3. Digite o incio de um comando: :e - 4. Pressione CTRL-D e o Vim ir mostrar a lista dos comandos iniciados + 4. Pressione CTRL-D e o Vim mostrar a lista dos comandos iniciados com "e". - 5. Pressione <TAB> e o Vim ir completar o nome do comando para ":edit". + 5. Pressione <TAB> e o Vim completar o nome do comando para ":edit". 6. Agora, adicione um espao e o incio do nome de um arquivo existente: :edit ARQ - 7. Pressione <TAB>. O Vim ir completar o nome (se ele for nico). + 7. Pressione <TAB>. O Vim completar o nome (se ele for nico). NOTA: A completao funciona com muitos comandos. Basta pressionar CTRL-D e <TAB>. Isso especialmente til para :help . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMRIO DA LIO 7 + RESUMO DA LIO 7 1. Digite :help ou pressione <F1> ou <Help> para abrir a janela de ajuda. 2. Digite :help cmd para achar a ajuda sobre cmd . - 3. Digite CTRL-W CTRL-W para pular de uma janela para outra. + 3. Digite CTRL-W CTRL-W para pular de uma janela a outra. 4. Digite :q para fechar a janela de ajuda. 5. Crie um script de inicializao vimrc para ativar automaticamente as suas configuraes preferidas. - 6. Quando pressionando um comando : , pressione CTRL-D para ver as - possibilidade de completao. + 6. Quando pressionar um comando : , pressione CTRL-D para ver as possibilidades + de completao. Pressione <TAB> para us-la. @@ -944,8 +961,8 @@ NOTA: A completa ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Isto conclui o Vim tutor. Ele pretendeu dar uma breve apresentao do editor - Vim, somente o bastante para que voc possa usar o editor com facilidade. + Isto conclui o tutorial do Vim, uma breve apresentao do editor Vim, + somente o bastante para que voc possa usar o editor com facilidade. Ele est longe de ser completo, uma vez que o Vim possui muitos, muitos mais comandos. O prximo passo ler o manual: ":help user-manual". @@ -971,7 +988,7 @@ NOTA: A completa Colorado School of Mines, usando idias fornecidas por Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Modificado para o Vim por Bram Moolenar. + Modificado para o Vim por Bram Moolenaar. Verso 1.4 traduzida para o portugus por Marcelo Drudi Miranda, Escola Politcnica da Universidade de So Paulo. @@ -979,6 +996,9 @@ NOTA: A completa Reviso e atualizao da traduo para a verso 1.7 por Jakson Aquino, Universidade Federal do Cear: E-mail: jalvesaq@gmail.com - Last Change: 2010 Jul 27 + Nova reviso e atualizao para a verso 1.8 por Ron Gonalves, + Universidade Federal de Uberlndia. + + Last Change: 2017 Feb 11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.pt.utf-8 b/runtime/tutor/tutor.pt.utf-8 index fecbcfa630..d329e5586f 100644 --- a/runtime/tutor/tutor.pt.utf-8 +++ b/runtime/tutor/tutor.pt.utf-8 @@ -1,36 +1,36 @@ =============================================================================== -= B e m V i n d o a o V I M T u t o r - Versão 1.7 pt_BR = += B e m - v i n d o ao t u t o r i a l do V I M - Versão 1.8 pt_BR = =============================================================================== Vim é um poderoso editor que possui muitos comandos, tantos que seria - impossível ensinar num tutorial como este. Este tutorial é planejado para - apresentar os comandos suficientes para você ficar habilitado a usar - facilmente o Vim como um editor de textos genérico. + impossível ensiná-los num tutorial como este, que é concebido para + apresentar os comandos suficientes para permiti-lo usar facilmente o + Vim como um editor de textos genérico. - O tempo aproximado requerido para completar o tutorial é de 25-30 minutos, + O tempo necessário para completar o tutorial é de cerca de 25-30 minutos, dependendo de quanto tempo é gasto praticando os comandos. ATENÇÃO: - Os comandos nas lições vão modificar o texto. Utilize uma cópia deste - arquivo para praticar os comandos (se você iniciou o "vimtutor", esta já + Os comandos nas lições modificam este texto. Faça uma cópia deste + arquivo para praticar os comandos (se usou o "vimtutor", esta já é uma cópia). - É importante lembrar que este tutorial é planejado para ensinar através da + É importante lembrar que este tutorial é concebido para ensinar pela prática. Isso significa que você precisa executar os comandos para aprendê-los adequadamente. Se você somente ler o texto, esquecerá os comandos! Agora, certifique-se de que sua tecla Shift-Lock (ou Caps Lock) não esteja ativada e pressione a tecla j o bastante para mover o cursor até que a - Lição 1.1 esteja completamente na tela. + Lição 1.1 apareça inteiramente na tela. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.1: MOVENDO O CURSOR + Lição 1.1: MOVER O CURSOR ** Para mover o cursor, pressione as teclas h,j,k,l conforme indicado. ** ^ - k Dica: A tecla h está à esquerda e move para a esquerda. - < h l > A tecla l está à direita e move para a direita. + k Dica: A tecla h está à esquerda e move à esquerda. + < h l > A tecla l está à direita e move à direita. j A tecla j se parece com uma seta para baixo. v 1. Mova o cursor pela tela até que você se sinta confortável. @@ -38,30 +38,29 @@ 2. Segure pressionada a tecla (j) até haver repetição. Agora você já sabe como ir para a próxima lição. - 3. Usando a tecla j, mova até a lição 1.2. + 3. Usando a tecla j, vá para a Lição 1.2. -NOTA: Se você está inseguro sobre o que digitou, pressione <ESC> para - colocá-lo no modo Normal. Então redigite o comando que você queria. +NOTA: Se está inseguro sobre o que digitou, pressione <ESC> para + colocá-lo no modo Normal. Então redigite o comando que queria. -NOTA: As teclas de cursor devem funcionar também. Mas usando hjkl, tão logo +NOTA: As teclas de cursor funcionam também. Mas usando hjkl, tão logo esteja acostumado, você poderá se mover muito mais rapidamente. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.2: SAINDO DO VIM + Lição 1.2: SAIR DO VIM - !! NOTA: Antes de executar qualquer dos passos abaixo, leia a lição inteira !! + !! NOTA: Antes de executar quaisquer dos passos abaixo, leia a lição inteira !! 1. Pressione <ESC> (para ter certeza de que está no modo Normal). - 2. Digite :q! <ENTER>. - Isso sai do editor SEM salvar qualquer mudança que tenha sido feita. - Se quiser salvar as alterações e sair, digite :wq <ENTER> + 2. Digite: :q! <ENTER>. + Assim, sai do editor SEM salvar qualquer mudança feita. - 3. Repita o procedimento que lhe trouxe a este tutorial. O procedimento pode + 3. Repita o procedimento que o trouxe a este tutorial. O procedimento pode ter sido a digitação de: vimtutor <ENTER>. - 4. Se você memorizou estes passos e está confiante, execute os passos de + 4. Se memorizou estes passos e está confiante, execute os passos de 1 a 3 para sair e reentrar no editor. NOTA: :q! <ENTER> descarta qualquer mudança. Em uma próxima lição será @@ -70,9 +69,9 @@ NOTA: :q! <ENTER> descarta qualquer mudança. Em uma próxima lição será 5. Desça o cursor até a Lição 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.3: EDITANDO TEXTOS - DELEÇÃO + Lição 1.3: EDITAR TEXTOS - REMOÇÃO - ** No modo Normal, pressione x para deletar o caractere sob o cursor. ** + ** Pressione x para deletar o caractere sob o cursor. ** 1. Mova o cursor para a linha abaixo marcada com --->. @@ -80,47 +79,47 @@ NOTA: :q! <ENTER> descarta qualquer mudança. Em uma próxima lição será 2. Para corrigir os erros, mova o cursor até que ele esteja sobre o caractere a ser deletado. - 3. Pressione a tecla x para deletar o caractere indesejado. + 3. Pressione a tecla x para remover o caractere incorreto. - 4. Repita os passos 2 até 4 até que a sentença esteja correta. + 4. Repita os passos 2 até 4 até que a frase esteja correta. ---> A vvaca pullouu por ccimaa dda luuua. - 5. Agora que a sentença está correta, vá para a Lição 1.4. + 5. Agora que a frase está correta, prossiga para a Lição 1.4. NOTA: Enquanto segue este tutorial, não tente memorizar, aprenda pelo uso. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.4: EDITANDO TEXTOS - INSERÇÃO + Lição 1.4: EDITAR TEXTOS - INSERÇÃO ** Pressione i para inserir texto. ** 1. Mova o cursor até a primeira linha abaixo marcada com --->. - 2. Para fazer a primeira linha ficar igual à segunda, mova o cursor para + 2. Para deixar a primeira linha igual à segunda, mova o cursor para o primeiro caractere DEPOIS de onde o texto deverá ser inserido. 3. Pressione i e digite as adições necessárias. 4. Assim que cada erro for corrigido pressione <ESC> para retornar ao modo - Normal. Repita os passos 2 até 4 para corrigir a sentença. + Normal. Repita os passos 2 até 4 para corrigir a frase. ----> Tem text fatado desta . ----> Tem algum texto faltando desta linha. +---> Tem text fatado nesta . +---> Tem algum texto faltando nesta linha. - 5. Quando se sentir confortável com a inserção de texto, mova o cursor para - a lição 1.5. + 5. Quando se sentir à vontade com a inserção de texto, mova o cursor para + a Lição 1.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.5: EDITANDO TEXTO - ADICIONANDO + Lição 1.5: EDITAR TEXTO - ADICIONAR ** Pressione A para adicionar texto. ** - 1. Mova o curso para a primeira linha abaixo marcada com --->. + 1. Mova o cursor para a primeira linha abaixo marcada com --->. Não importa sobre qual caractere o cursor estará na linha. 2. Pressione A e digite as adições necessárias. @@ -128,41 +127,41 @@ NOTA: Enquanto segue este tutorial, não tente memorizar, aprenda pelo uso. 3. Quando adicionar o texto, pressione <ESC> para retornar ao modo Normal. 4. Mova o cursor para a segunda linha marcada ---> e repita os passos 2 e 3 - para corrigir o texto. + para corrigir a frase. ----> Há algum texto faltando des - Há algum texto faltando desta linha. +---> Há algum texto faltando nes + Há algum texto faltando nesta linha. Há algum texto faltan ---> Há algum texto faltando aqui. - 5. Quando se sentir confortável adicionando texto, mova para a lição 1.6. + 5. Quando se sentir confortável adicionando texto, vá para a Lição 1.6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 1.6: EDITANDO UM ARQUIVO + Lição 1.6: EDITAR UM ARQUIVO + ** Use :wq para salvar um arquivo e sair. ** - !! NOTA: Antes de executar qualquer um dos passos abaixo, - leia esta lição completamente!! + !! NOTA: Leia toda a lição antes de executar as instruções!! 1. Saia deste tutorial como o fez na lição 1.2: :q! Ou, se tiver acesso a outro terminal, faça o seguinte nele. 2. No prompt do shell, digite esse comando: vim tutor <ENTER> - 'vim' is é comando para iniciar o editor Vim e 'tutor' é o nome do - arquivo que você deseja editar. Use um arquivo que possa ser modificado. + 'vim' é o comando para iniciar o editor Vim e 'tutor' é o nome do + arquivo que você quer editar. Use um arquivo que possa ser modificado. - 3. Insira e delete texto tal como aprendeu com as lições anteriores. + 3. Insira e apague texto tal como aprendeu nas lições anteriores. 4. Salve o arquivo com as mudanças e saia do Vim com: :wq <ENTER> - 5. Se você tiver saído do vimtutor no passo 1, reinicie o vimtutor e vá para - o sumário seguinte. + 5. Se tiver saído do vimtutor no passo 1, reinicie o vimtutor e vá para + o resumo seguinte. 6. Após ler os passos acima e compreendê-los, execute-os. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 1 + RESUMO DA LIÇÃO 1 1. O cursor é movido usando tanto as teclas de seta quanto as teclas hjkl. h (esquerda) j (para baixo) k (para cima) l (direita) @@ -185,9 +184,9 @@ NOTA: Pressionando <ESC> você irá para o modo Normal ou cancelará um comando Agora continue com a Lição 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 2.1: COMANDOS DE DELEÇÃO + Lição 2.1: COMANDOS DE REMOÇÃO - ** Digite dw para deletar até o final de uma palavra. ** + ** Digite dw para apagar uma palavra. ** 1. Pressione <ESC> para ter certeza de que está no modo Normal. @@ -198,19 +197,19 @@ Agora continue com a Lição 2. 4. Digite dw para fazer a palavra desaparecer. - NOTA: A letra d vai aparece na última linha da tela enquanto você a - digita. O Vim está lhe esperando digitar um w . Se você digitou + NOTA: A letra d vai aparecer na última linha da tela enquanto você a + digita. O Vim o está esperando digitar um w . Se digitou alguma coisa errada, pressione <ESC> e comece de novo. ----> Tem a algumas oi palavras diversão que não pertencem papel a esta sentença. +---> Tem a algumas oi palavras diversão que não pertencem papel a esta frase. - 5. Repita os passos 3 ao 4 até que a sentença esteja correta e vá para a + 5. Repita os passos 3 ao 4 até que a frase esteja correta e vá para a Lição 2.2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 2.2: MAIS COMANDOS DE DELEÇÃO + Lição 2.2: MAIS COMANDOS DE REMOÇÃO - ** Digite d$ para deletar até o final da linha. ** + ** Digite d$ para deletar até o fim da linha. ** @@ -218,13 +217,13 @@ Agora continue com a Lição 2. 2. Mova o cursor até a linha abaixo marcada com --->. - 3. Mova o cursor até o fim da linha correta (DEPOIS do primeiro .). + 3. Mova o cursor até o fim da linha correta (DEPOIS do primeiro . ). - 4. Digite d$ para deletar até o final da linha. + 4. Digite d$ para apagar até o fim da linha. ----> Alguém digitou o final desta linha duas vezes. desta linha duas vezes. +---> Alguém digitou o fim desta linha duas vezes. desta linha duas vezes. - 5. Vá para a lição 2.3 para entender o que está acontecendo. + 5. Vá para a lição 2.3 para entender o funcionamento deste comando. @@ -233,30 +232,31 @@ Agora continue com a Lição 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 2.3: SOBRE OPERADORES E MOVIMENTOS - Muitos comandos que mudam texto são feitos de um operador e um movimento. - O formato para um comando deletar com o operador de deleção d tem a + Muitos comandos que mudam texto são feitos de um operador e de um movimento. + O formato para um comando apagar com o operador de remoção d tem a seguinte forma: d movimento + Onde: - d - é o operador deletar. - movimento - é como o operador vai operar (listado abaixo). + d - é o operador apagar. + movimento - é o movimento sobre o qual o operador age (listado abaixo). Uma pequena lista de teclas de movimento: - w - do cursor até o fim da palavra, incluindo o espaço. - e - do cursor até o fim da palavra, NÃO incluindo o espaço. - $ - do cursor até o fim da linha. + w - até o início da próxima palavra, excluindo seu primeiro caractere. + e - até o fim da palavra atual, incluindo seu último caractere. + $ - até o fim da linha, incluindo seu último caractere. - Portanto, digitando de irá deletar do cursor ao fim da palavra. + Portanto, digitar de apaga do cursor ao fim da palavra. -NOTA: Pressionando apenas a tecla de movimento enquanto em modo Normal, sem o -operador, irá mover o cursor como especificado na lista de teclas de +NOTA: Pressionar apenas a tecla de movimento em modo Normal, sem o +operador, faz o cursor se mover como especificado na lista de teclas de movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 2.4: USANDO UM CONTADOR PARA UM MOVIMENTO + Lição 2.4: USAR UM CONTADOR PARA UM MOVIMENTO - ** Digitando um número antes de um movimento repete-o muitas vezes. ** + ** Digitar um número antes de um movimento repete-o o tanto de vezes. ** 1. Mova o cursor para o começo da linha marcada com ---> abaixo. @@ -269,7 +269,7 @@ movimento. 5. Repita os passos 2 e 3 com diferentes números. ----> Esta é uma linha com algumas palavras para lhe permitir fazer movimentos. +---> Esta é uma linha com algumas palavras para permiti-lo fazer movimentos. 6. Vá para a Lição 2.5. @@ -277,22 +277,22 @@ movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 2.5: USANDO UM CONTADOR PARA DELETAR MAIS + Lição 2.5: USAR UM CONTADOR PARA APAGAR MAIS - ** Digitando um número com um operador repete-o esse número de vezes. ** + ** Digitar um número com um operador repete-o esse número de vezes. ** - Você deve inserir um contador entre o operador de deleção e o movimento - mencionados acima para para deletar mais: + Você deve inserir um contador entre o operador de remoção e o de movimento + mencionados acima para apagar mais: d número movimento - 1. Movimente o cursor para a primeira palavra com LETRAS MAIÚSCULAS na + 1. Movimente o cursor para a primeira palavra em LETRAS MAIÚSCULAS na linha marcada com --->. - 2. Digite d2w para deletar as duas palavras com LETRAS MAIÚSCULAS. + 2. Digite d2w para deletar as duas palavras em LETRAS MAIÚSCULAS. 3. Repita os passos 1 e 2 com diferentes contadores para deletar as - palavras de LETRAS MAIÚSCULAS com um comando. + palavras em LETRAS MAIÚSCULAS com um comando. ---> esta ABC DE linha FGHI JK LMN OP de palavras está Q RS TUV limpa. @@ -300,17 +300,17 @@ movimento. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 2.6: OPERANDO SOBRE LINHAS + Lição 2.6: TRABALHAR COM LINHAS - ** Digite dd para deletar uma linha inteira. ** + ** Digite dd para apagar uma linha inteira. ** - Em virtude da frequência em deletar uma linha inteira, os projetistas do Vi - decidiram que seria mais simples digitar dois d's numa linha para deletá-la. + Em virtude da frequência em deletar uma linha inteira, os desenvolvedores + do Vi decidiram que seria mais simples digitar dois d para apagar uma linha. - 1. Mova o cursor até a segunda linha na lista a baixo. - 2. Digite dd para deletar a linha. + 1. Mova o cursor até a segunda linha da frase abaixo. + 2. Digite dd para apagar a linha. 3. Agora mova até a quarta linha. - 4. Digite 2dd para deletar duas linhas. + 4. Digite 2dd para apagar duas linhas. ---> 1) Rosas são vermelhas, ---> 2) Lama é divertida, @@ -318,92 +318,94 @@ movimento. ---> 4) Eu tenho um carro, ---> 5) Relógios dizem as horas, ---> 6) Açúcar é doce, ----> 7) E assim é você. +---> 7) Assim como você. Notas do tradutor: Lama (mud) em inglês pode significar fofoca, difamação. Há rima no texto original. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 2.7: O COMANDO UNDO (DESFAZER) -** Pressione u para desfazer os últimos comandos, U restaura linha inteira.** +** Pressione u para desfazer os últimos comandos, U recupera a linha inteira.** 1. Mova o cursor para a linha abaixo marcada com ---> e posicione-o sobre o primeiro erro. - 2. Digite x para deletar o primeiro caractere indesejado. + 2. Digite x para deletar o primeiro caractere errado. 3. Agora, digite u para desfazer o último comando executado. 4. Desta vez, corrija todos os erros na linha usando o comando x . 5. Agora, digite um U maiúsculo para retornar a linha ao seu estado original. 6. Digite u algumas vezes para desfazer o U e os comandos anteriores. 7. Digite CTRL-R (segurando a tecla CTRL enquanto digita R) algumas vezes - para refazer os comandos (desfazer os undo's). + para refazer os comandos (desfazer os undos). ---> Corriija os erros nnesta linha e reetorne-os com undo. - 8. Esses comandos são muito úteis. Agora vá para o sumário da Lição 2. + 8. Esses comandos são muito úteis. Agora vá para o resumo da Lição 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 2 + RESUMO DA LIÇÃO 2 - 1. Para deletar do cursor até o fim de uma palavra digite: dw - 2. Para deletar do cursor até o fim de uma linha digite: d$ - 3. Para deletar uma linha inteira digite: dd - 4. Para repetir um movimento adicione antes um número: 2w + 1. Para apagar do cursor até a próxima palavra, digite: dw + 2. Para apagar do cursor até o fim de uma linha, digite: d$ + 3. Para apagar uma linha inteira, digite: dd + 4. Para repetir um movimento, adicione antes um número: 2w 5. O formato para um comando no modo Normal é: operador [número] movimento onde: - operador - é o que será feito, como d para deletar - número - é quantas vezes o comando será repetido - movimento - movimento sobre o texto que sofrerá a operação, como - w (palavra), $ (até o final da linha), etc. + operador - é o que será feito, como d para apagar + [número] - quantas vezes o comando será repetido + movimento - movimento sobre o texto que receberá a operação, como + w (palavra), $ (até o fim da linha), etc. + + 6. Para ir ao início da linha, use um zero: 0 - 5. Para desfazer um ação anterior, digite: u (minúsculo) - Para desfazer todas as modificações em uma linha digite: U (maiúsculo) - Para desfazer o que foi desfeito digite: CTRL-R + 7. Para desfazer uma ação anterior, digite: u (minúsculo) + Para desfazer todas as alterações em uma linha, digite: U (maiúsculo) + Para desfazer o que foi desfeito, digite: CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 3.1: O COMANDO PUT (PÔR) + Lição 3.1: O COMANDO COLAR - ** Digite p para colocar a última deleção após o cursor. ** + ** Digite p para colar após o cursor o que acabou de apagar. ** - 1. Mova o cursor até a primeira linha na lista abaixo. + 1. Mova o cursor até a primeira linha marcada com --->. - 2. Digite dd para deletar a linha e guardá-la no buffer do Vim. + 2. Digite dd para apagar a linha e guardá-la num registro do Vim. - 3. Mova o cursor até a linha ACIMA de onde a linha deletada deve ficar. + 3. Mova o cursor até a linha c) ACIMA de onde a linha apagada deveria estar. 4. No modo Normal, digite p para inserir a linha. 5. Repita os passos 2 ao 4 para pôr todas as linhas na ordem correta. - d) Você pode aprender também? - b) Violetas são azuis, - c) Inteligência se aprende, - a) Rosas são vermelhas, +---> d) Você pode aprender também? +---> b) Violetas são azuis, +---> c) Inteligência se aprende, +---> a) Rosas são vermelhas, Nota do tradutor: Há rima no original. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 3.2: O COMANDO REPLACE (SUBSTITUIR) + Lição 3.2: O COMANDO SUBSTITUIR ** Digite rx para substituir o caractere sob o cursor por x . ** 1. Mova o cursor até a primeira linha abaixo marcada com --->. - 2. Mova o cursor até que ele esteja sobre o primeiro erro. + 2. Mova o cursor até que esteja sobre o primeiro erro. 3. Digite r e então o caractere que deveria estar lá. - 4. Repita os passos 2 e 3 até que a primeira linha esteja correta. + 4. Repita os passos 2 e 3 até que a primeira linha esteja igual à segunda. ---> Quendo este limha foi dugitada, alguem pressioniu algumas teclas erradzs! ---> Quando esta linha foi digitada, alguém pressionou algumas teclas erradas! @@ -417,43 +419,44 @@ NOTA: Lembre-se que você deve aprender pelo uso, não pela memorização. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 3.3: O OPERADOR CHANGE (MUDAR) - ** Para mudar toda uma palavra ou parte dela, digite cw . ** + ** Para alterar até o fim de uma palavra, digite ce . ** 1. Mova o cursor até a primeira linha abaixo marcada com --->. 2. Posicione o cursor sobre o u em lunba. - 3. Digite cw e a palavra correta (nesse caso, digite 'inha'.) + 3. Digite ce e a palavra correta (nesse caso, digite 'inha'.) 4. Pressione <ESC> e mova para o próximo caractere a ser alterado. - 5. Repita os passos 3 e 4 até que a primeira sentença esteja igual à segunda. + 5. Repita os passos 3 e 4 até que a primeira frase esteja igual à segunda. ---> Essa lunba tem pwlesmfr que ocrimmm soi alteradas cup o comando change. ---> Essa linha tem palavras que precisam ser alteradas com o comando change. -Note que cw não somente substitui a palavra, mas também lhe coloca no modo -de inserção. +Note que ce não somente substitui a palavra, mas também o coloca no modo +de Inserção. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 3.4: MAIS MUDANÇAS USANDO c - ** O operador change é usado com os mesmos objetos que delete. ** + ** O operador change é usado com os mesmos movimentos que o delete. ** + 1. O operador change trabalha da mesma maneira que o delete. O formato é: c [número] movimento - 2. Os movimentos também são os mesmos: w (palavra), $ (fim da linha), etc. + 2. Os movimentos também são os mesmos: w (palavra) e $ (fim da linha). 3. Mova até a primeira linha abaixo marcada com --->. 4. Mova o cursor até o primeiro erro. - 5. Digite c$ para fazer o resto da linha ficar igual à segunda e pressione - <ESC>. + 5. Digite c$ e digite o resto da segunda linha para torná-las iguais e + pressione <ESC>. ---> O fim desta linha precisa de ajuda para ficar igual à segunda. ---> O fim desta linha precisa ser corrigido usando o comando c$. @@ -461,18 +464,18 @@ de inserção. NOTA: Você pode usar a tecla Backspace para corrigir erros enquanto digita. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 3 + RESUMO DA LIÇÃO 3 - 1. Para inserir um texto que já foi deletado, digite p . Isso coloca o texto + 1. Para reinserir um texto que já foi apagado, digite p . Isso coloca o texto deletado APÓS o cursor (se uma linha é deletada ela será inserida na linha abaixo do cursor). 2. Para substituir o caractere sob o cursor, digite r e então o caractere - que irá substituir o original. + que substituirá o original. 3. O comando change possibilita mudar do cursor até onde o movimento for. - Ex: Digite cw para mudar do cursor até o fim de uma palavra, c$ para + Ex: Digite ce para mudar do cursor até o fim de uma palavra, c$ para mudar até o fim da linha. 4. O formato para uma operação change é: @@ -484,14 +487,14 @@ Agora vá para a próxima lição. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 4.1: LOCALIZAÇÃO DO CURSOR E STATUS DO ARQUIVO + Lição 4.1: LOCALIZAÇÃO DO CURSOR E ESTADO DO ARQUIVO - ** Digite CTRL-G para mostrar sua localização no arquivo e seu status. + ** Digite CTRL-G para mostrar sua localização no arquivo e seu estado. Digite G para mover para uma linha do arquivo. ** Nota: Leia esta lição inteira antes de executar qualquer um dos passos!! - 1. Segure pressionada a tecla Ctrl e pressione g . Nós chamamos isso de + 1. Segure pressionada a tecla Ctrl e pressione g . Chamamos isso de CTRL-G. Uma mensagem aparecerá no rodapé da página com o nome do arquivo e a sua posição no arquivo. Lembre-se do número da linha para o Passo 3. @@ -499,54 +502,55 @@ NOTA: A posição do cursor pode estar visível no canto direito inferior da tela. Isso acontece quando a opção 'ruler' está ativa (veja :help 'ruler' ). - 2. Pressione G para mover para o final do arquivo. - Digite gg para mover para o início do arquivo. + 2. Pressione G para se mover até o fim do arquivo. + Digite gg para se mover até o início do arquivo. - 3. Digite o número da linha em que você estava e então G . Isto - retornará o cursor à linha em que você estava quando pressionou CTRL-G. + 3. Digite o número da linha em que estava e então G . Assim o cursor retornará + à linha em que estava quando pressionou CTRL-G. - 4. Se você estiver confiante para fazer isto, execute os passos 1 ao 3. + 4. Se estiver seguro para fazê-los, execute os passos 1 a 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 4.2: O COMANDO SEARCH (PROCURA) + Lição 4.2: O COMANDO BUSCAR - ** Digite / seguido por uma string para procurar pela string. ** + ** Digite / seguido por uma frase para procurar por ela. ** 1. No modo Normal digite o caractere / . Note que ele e o cursor aparecem no rodapé da tela, como ocorre com o comando : . - 2. Agora digite 'errroo' <ENTER>. Esta é a palavra que você quer procurar. + 2. Agora digite 'errroo' <ENTER>. Esta é a palavra que quer procurar. - 3. Para procurar pela mesma palavra de novo, simplesmente tecle n . - Para procurar pela mesma palavra na direção oposta, tecle N . + 3. Para buscar a mesma palavra de novo, simplesmente tecle n . + Para buscar a mesma palavra na direção oposta, tecle N . - 4. Se você quer procurar por uma string no sentido de frente para trás, use - ? em vez de / . + 4. Se quer procurar por uma frase de trás para frente, use ? em vez de / . - 5. Para voltar para onde estava, pressione CTRL-O (mantenha a tecla Ctrl - pressionada e pressione a tecla o). Repita para voltar outras posições. + 5. Para voltar aonde estava, pressione CTRL-O (mantenha a tecla Ctrl + pressionada e pressione a tecla o). Repita para voltar a outras posições. CTRL-I segue para posições mais recentes. ---> "errroo" não é uma maneira de escrever erro; errroo é um erro. -NOTA: Quando a busca atinge o final do arquivo ela continuará do começo, a + +NOTA: Quando a busca atinge o fim do arquivo ela continuará do começo, a menos que a opção 'wrapscan' esteja desativada. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 4.3: PROCURA POR CASAMENTO DE PARÊNTESES + Lição 4.3: BUSCA DE PARÊNTESES CORRESPONDENTES - ** Digite % para achar um casamento de ),], ou } . ** + ** Digite % para encontrar um ),], ou } correspondente. ** 1. Posicione o cursor em qualquer (, [, ou { na linha abaixo marcada com --->. 2. Agora digite o caractere % . - 3. O cursor deve estar no parênteses ou colchetes que casa com o primeiro. + 3. O cursor deve estar no parêntese ou colchete que casa com o primeiro. - 4. Digite % para mover o cursor de volta ao primeiro colchete ou parênteses + 4. Digite % para mover o cursor de volta ao primeiro colchete ou parêntese (por casamento). ----> Isto ( é uma linha de teste contendo ('s, ['s ] e {'s }. )) +---> Isto ( é uma linha de teste contendo (, [ ] e { }. )) -Nota: Isso é muito útil para corrigir um programa com parênteses não-casados! +Nota: Isso é muito útil para corrigir um programa com parêntese não-casado! @@ -572,14 +576,17 @@ Nota: Isso é muito útil para corrigir um programa com parênteses não-casados digite :#,#s/velho/novo/g onde #,# são os números das duas linhas. Digite :%s/velho/novo/g para mudar todas as ocorrências no arquivo inteiro. - Digite :%/velho/novo/gc para mudar todas as ocorrência no arquivo + Digite :%s/velho/novo/gc para mudar todas as ocorrências no arquivo inteiro, com a opção de confirmar cada substituição. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 4 - 1. CTRL-G mostra a sua localização no arquivo e o status do mesmo. - G move para o final do arquivo. - número G move para esta linha com esse número. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + RESUMO DA LIÇÃO 4 + + + 1. CTRL-G mostra em que ponto do arquivo está e o estado dele. + G move para o fim do arquivo. + número G move para a linha com esse número. gg move para a primeira linha. 2. Digitando / seguido por uma expressão procura À FRENTE por ela. @@ -594,31 +601,32 @@ Nota: Isso é muito útil para corrigir um programa com parênteses não-casados 4. Para substituir: o primeiro 'velho' de uma linha por 'novo' digite :s/velho/novo - todos os 'velho's em uma linha por 'novo' digite :s/velho/novo/g + todos os 'velho' em uma linha por 'novo' digite :s/velho/novo/g expressões entre dois números (#) de linhas digite :#,#s/velho/novo todas as ocorrências no arquivo digite :%s/velho/novo/g Para confirmar cada substituição adicione 'c' :%s/velho/novo/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 5.1: COMO EXECUTAR UM COMANDO EXTERNO - ** Digite :! seguido por um comando externo para executar esse comando. ** + ** Digite :! seguido por um comando externo para executá-lo. ** 1. Digite o familiar comando : para levar o cursor ao rodapé da tela. Isso - lhe permite entrar um comando. + o permite entrar um comando. - 2. Agora digite o caractere ! (ponto de exclamação). Isso lhe permite + 2. Agora digite o caractere ! (ponto de exclamação). Isso o permite executar qualquer comando do shell. 3. Como um exemplo digite ls seguindo o ! e então tecle <ENTER>. Isto - irá mostrar uma listagem do seu diretório, como se você estivesse no + mostrará uma listagem do seu diretório, como se você estivesse no prompt do shell. Ou use :!dir se ls não funcionar. NOTA: É possível executar qualquer comando externo dessa maneira, inclusive com argumentos. NOTA: Todos os comandos : devem ser finalizados teclando-se <ENTER> - Daqui em diante não iremos mencionar isso sempre. + Daqui em diante não mencionaremos isso todas as vezes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -635,19 +643,19 @@ NOTA: Todos os comandos : devem ser finalizados teclando-se <ENTER> 3. Agora digite: :w TESTE (onde TESTE é o nome que você escolheu.) 4. Isto salva o arquivo inteiro (o Vim Tutor) com o nome TESTE. - Para verificar isso, digite :!ls de novo para ver seu diretório + Para verificar isso, digite :!ls de novo para ver seu diretório. -NOTA: Se você sair do Vim e entrar de novo com o nome do arquivo TESTE, - o arquivo deve ser uma cópia exata do tutor quando você o salvou. +NOTA: Se sair do Vim e entrar de novo com o nome do arquivo TESTE, + o arquivo deve ser uma cópia exata do tutorial quando você o salvou. 5. Agora remova o arquivo digitando (MS-DOS): :!del TESTE ou (Unix): :!rm TESTE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 5.3: SELECIONANDO O TEXTO A SER SALVO + Lição 5.3: SELECIONAR O TEXTO A SER SALVO - ** Para salvar parte de um arquivo, digite v movimento NOMEDOARQUIVO ** + ** Para salvar parte de um arquivo, digite v movimento :w NOMEDOARQUIVO ** 1. Mova o cursor para esta linha. @@ -658,24 +666,24 @@ NOTA: Se você sair do Vim e entrar de novo com o nome do arquivo TESTE, da tela. 4. Digite w TESTE , sendo TESTE um nome de arquivo que não existe ainda. - Você deverá ver :'<,'>w TESTE antes de pressionar <ENTER>. + Certifique-se de ver :'<,'>w TESTE antes de pressionar <ENTER>. 5. O Vim salvará as linhas selecionadas no arquivo TESTE. Use :!dir ou - !:ls para vê-lo. Não o apague agora! Nós o usaremos na próxima lição. + !:ls para vê-lo. Não o apague ainda! Nós o usaremos na próxima lição. -NOTA: Pressionando v inicia o modo Visual de seleção. Você pode mover o +NOTA: Pressionar v inicia o modo Visual de seleção. Você pode mover o cursor pela tela para tornar a seleção maior ou menor. Pode, então, usar um -operador para executar alguma ação. Por exemplo, d deleta o texto. +operador para executar alguma ação. Por exemplo, d apaga o texto. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 5.4: RECUPERANDO E JUNTANDO ARQUIVOS + Lição 5.4: RECUPERAR E UNIR ARQUIVOS ** Para inserir o conteúdo de um arquivo, digite :r NOMEDOARQUIVO ** 1. Posicione o cursor logo acima desta linha. -NOTA: Depois de executar o Passo 2 você verá a lição 5.3. Então DESÇA o +NOTA: Depois de executar o Passo 2 você verá a Lição 5.3. Então DESÇA o cursor para ver esta lição novamente. 2. Agora recupere o arquivo TESTE usando o comando :r TESTE onde TESTE é o @@ -691,7 +699,7 @@ NOTA: Você também pode ler a saída de um comando externo. Por exemplo, :r !l ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 5 + RESUMO DA LIÇÃO 5 1. :!comando executa um comando externo. @@ -714,15 +722,15 @@ NOTA: Você também pode ler a saída de um comando externo. Por exemplo, :r !l ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 6.1: O COMANDO OPEN (ABRIR) + Lição 6.1: O COMANDO ABRIR - ** Digite o para abrir uma linha embaixo do cursor e ir para o modo de - Inserção (INSERT). ** + ** Digite o para abrir uma linha em baixo do cursor e ir para o modo de + Inserção. ** 1. Mova o cursor para a linha abaixo marcada com --->. - 2. Digite o (minúsculo) para abrir uma linha ABAIXO do cursor e ir para o - modo de Inserção (INSERT). + 2. Digite o (minúsculo) para abrir uma linha ABAIXO do cursor e ir para o + modo de Inserção. 3. Agora digite algum texto e pressione <ESC> para sair do modo de Inserção. @@ -737,7 +745,7 @@ NOTA: Você também pode ler a saída de um comando externo. Por exemplo, :r !l ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 6.2: O COMANDO APPEND + Lição 6.2: O COMANDO ADICIONAR ** Digite a para inserir texto DEPOIS do cursor. ** @@ -754,13 +762,13 @@ NOTA: Você também pode ler a saída de um comando externo. Por exemplo, :r !l 5. Use e para mover para a próxima palavra incompleta repita os passos 3 e 4. ----> Esta lin lhe permite pratic a adiç de texto a uma linha. ----> Esta linha lhe permite praticar a adição de texto a uma linha. +---> Esta lin o permite pratic a adiç de texto a uma linha. +---> Esta linha o permite praticar a adição de texto a uma linha. NOTA: a, i e A levam ao mesmo modo de Inserção, a única diferença é onde os caracteres são inseridos. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lição 6.3: UMA OUTRA VERSÃO DO REPLACE (SUBSTITUIR) + Lição 6.3: UMA OUTRA VERSÃO DO SUBSTITUIR ** Digite um R maiúsculo para substituir mais de um caractere. ** @@ -772,7 +780,7 @@ NOTA: a, i e A levam ao mesmo modo de Inserção, a única diferença é onde os linha, para substituir o xxx . 3. Pressione <ESC> para sair do modo de Substituição. Note que o resto da - linha permanece inalterada. + linha permanece inalterado. 4. Repita os passos para substituir os xxx restantes. @@ -780,48 +788,53 @@ NOTA: a, i e A levam ao mesmo modo de Inserção, a única diferença é onde os ---> Adicionando 123 a 456 resulta em 579. NOTA: O modo de Substituição é como o modo de Inserção, mas cada caractere - digitado deleta um caractere existente. + digitado apaga um caractere existente. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 6.4: COPIAR E COLAR TEXTO ** Use o operador y para copiar texto e p para colá-lo. ** - 1. Vá para a linha marcada com ---> abaixo e posicione o cursor após "a)". + 1. Vá à linha marcada com ---> abaixo e posicione o cursor após "a)". 2. Inicie o modo Visual com v e mova o cursor para logo antes de "primeiro". 3. Digite y para copiar o texto selecionado. - 4. Mova o cursor para o final da próxima linha: j$ + 4. Mova o cursor para o fim da próxima linha: j$ - 5. Digite p par pôr (colar) o texto. Então, digite: o segundo <ESC> . + 5. Digite p para colar o texto. Então, digite: o segundo <ESC> . 6. Use o modo Visual para selecionar " item.", copie-o com y , mova para - o fina da próxima linha com j$ e ponha (cole) o texto com p . + o fim da próxima linha com j$ e cole o texto com p . ---> a) esse é o primeiro item. b) + NOTA: Você também pode usar y como um operador; por exemplo, yw copia uma palavra. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 6.5: CONFIGURAR PREFERÊNCIAS - ** Configurar uma preferência de modo que um search ou substitute - ignora se as letras estão em maiúsculas ou minúsculas. ** + ** Configure uma preferência de modo que uma busca ou substituição + ignore se as letras são maiúsculas ou minúsculas. ** - 1. Procure por 'ignore' entrando: /ignore <ENTER> + 1. Procure por 'ignore' entrando: /ignore <ENTER> Repita várias vezes teclando n . - 2. Configure a opção 'ic' (Ignore case) digitando: - :set ic + + 2. Configure a opção 'ic' (Ignore case) digitando: :set ic + 3. Agora procure por 'ignore' de novo teclando: n Repita várias vezes. - 4. Configure as opções 'hlsearch' e 'incsearch': - :set hls is - 5. Agora entre com o comando search de novo, e veja o que acontece: + + 4. Configure as opções 'hlsearch' e 'incsearch': :set hls is + + 5. Agora entre com o comando buscar de novo, e veja o que acontece: /ignore - 6. Para desabilitar a desconsideração de maiúsculas e minúsculas: + + 6. Para desabilitar a diferenciação entre maiúsculas e minúsculas: :set noic NOTA: Para remover o realce dos termos localizados entre: :nohlsearch @@ -829,32 +842,35 @@ NOTA: Se quiser ignorar a diferença entre maiúsculas e minúsculas em apenas uma pesquisa, use \c no comando: /ignore\c <ENTER> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 6 + RESUMO DA LIÇÃO 6 1. Digite o para abrir uma linha ABAIXO do cursor e iniciar o modo de Inserção. Digite O para abrir uma linha ACIMA da linha onde o cursor está. 2. Digite a para adicionar texto DEPOIS do caractere onde está o cursor. - Digite A para adicionar texto ao final da linha. + Digite A para adicionar texto ao fim da linha. - 3. O comando e move o cursor para o final de uma palavra. + 3. O comando e move o cursor para o fim de uma palavra. - 4. O operador y copia texto, p põe (cola) o texto copiado. + 4. O operador y copia texto, p cola o texto copiado. 5. Digitando R entra-se no modo de Substituição até que <ESC> seja pressionado. 6. Digitando ":set xxx" modifica-se a opção "xxx". Algumas opções são: - 'ic' 'ignorecase' ignora diferença entre maiúsculas/minúsculas - 'is' 'incsearch' realiza a busca enquanto se digita + 'ic' 'ignorecase' ignora diferença entre maiúsculas/minúsculas + 'is' 'incsearch' realiza a busca enquanto se digita 'hls' 'hlsearch' realça todos os trechos localizados Você tanto pode usar o nome curto quanto o nome longo da opção. + 7. Adicione o prefixo "no" para desabilitar uma opção: :set noic + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LIÇÃO 7.1: OBTENDO AJUDA - ** Usar o sistema de ajuda do próprio Vim ** + ** Use o sistema de ajuda do próprio Vim ** O Vim possui sistema de ajuda abrangente. Para começar, tente algum desses três: @@ -863,11 +879,11 @@ NOTA: Se quiser ignorar a diferença entre maiúsculas e minúsculas em apenas - digite :help <ENTER> Leia o texto da ajuda para aprender como o sistema de ajuda funciona. - Digite CTRL-W CTRL-W para pular de uma janela para outra. - Digite :q <ENTER> para fechar a janela da ajuda. + Digite CTRL-W CTRL-W para pular de uma janela a outra. + Digite :q <ENTER> para fechar a janela da ajuda. - Você pode achar ajuda sobre qualquer assunto, fornecendo um argumento para - o comando ":help". Tente isto (não esqueça de pressionar <ENTER>): + Você pode encontrar ajuda sobre qualquer assunto, fornecendo um argumento + para o comando ":help". Tente isto (não se esqueça de pressionar <ENTER>): :help w :help c_CTRL-D @@ -877,7 +893,7 @@ NOTA: Se quiser ignorar a diferença entre maiúsculas e minúsculas em apenas ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lição 7.2: CRIAR UM SCRIPT DE INICIALIZAÇÃO - ** Habilitar recursos do Vim ** + ** Habilite recursos do Vim ** O Vim tem muito mais recursos do que o Vi, mas na sua maioria eles são desabilitados por padrão. Para usar mais recursos, você tem que criar um @@ -893,7 +909,7 @@ NOTA: Se quiser ignorar a diferença entre maiúsculas e minúsculas em apenas 3. Salve o arquivo com: :w - Da próxima vez que o Vim for iniciado, ele irá usar realce de sintaxe. Você + Da próxima vez que o Vim for iniciado, ele usará realce de sintaxe. Você pode adicionar suas configurações preferidas para esse arquivo "vimrc". Para maiores informações, digite: :help vimrc-intro @@ -904,39 +920,40 @@ NOTA: Se quiser ignorar a diferença entre maiúsculas e minúsculas em apenas 1. Certifique-se de que o Vim não está no modo compatível: :set nocp - 2. Olhe quais arquivos existem no diretório: :!ls ou :!dir + 2. Veja quais arquivos existem no diretório: :!ls ou :!dir 3. Digite o início de um comando: :e - 4. Pressione CTRL-D e o Vim irá mostrar a lista dos comandos iniciados + 4. Pressione CTRL-D e o Vim mostrará a lista dos comandos iniciados com "e". - 5. Pressione <TAB> e o Vim irá completar o nome do comando para ":edit". + 5. Pressione <TAB> e o Vim completará o nome do comando para ":edit". 6. Agora, adicione um espaço e o início do nome de um arquivo existente: :edit ARQ - 7. Pressione <TAB>. O Vim irá completar o nome (se ele for único). + 7. Pressione <TAB>. O Vim completará o nome (se ele for único). NOTA: A completação funciona com muitos comandos. Basta pressionar CTRL-D e <TAB>. Isso é especialmente útil para :help . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUMÁRIO DA LIÇÃO 7 + RESUMO DA LIÇÃO 7 1. Digite :help ou pressione <F1> ou <Help> para abrir a janela de ajuda. 2. Digite :help cmd para achar a ajuda sobre cmd . - 3. Digite CTRL-W CTRL-W para pular de uma janela para outra. + 3. Digite CTRL-W CTRL-W para pular de uma janela a outra. 4. Digite :q para fechar a janela de ajuda. 5. Crie um script de inicialização vimrc para ativar automaticamente as suas configurações preferidas. - 6. Quando pressionando um comando : , pressione CTRL-D para ver as - possibilidade de completação. + 6. Quando pressionar um comando : , pressione CTRL-D para ver as possibilidades + de completação. Pressione <TAB> para usá-la. @@ -944,8 +961,8 @@ NOTA: A completação funciona com muitos comandos. Basta pressionar CTRL-D e ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Isto conclui o Vim tutor. Ele pretendeu dar uma breve apresentação do editor - Vim, somente o bastante para que você possa usar o editor com facilidade. + Isto conclui o tutorial do Vim, uma breve apresentação do editor Vim, + somente o bastante para que você possa usar o editor com facilidade. Ele está longe de ser completo, uma vez que o Vim possui muitos, muitos mais comandos. O próximo passo é ler o manual: ":help user-manual". @@ -971,7 +988,7 @@ NOTA: A completação funciona com muitos comandos. Basta pressionar CTRL-D e Colorado School of Mines, usando idéias fornecidas por Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Modificado para o Vim por Bram Moolenar. + Modificado para o Vim por Bram Moolenaar. Versão 1.4 traduzida para o português por Marcelo Drudi Miranda, Escola Politécnica da Universidade de São Paulo. @@ -979,6 +996,9 @@ NOTA: A completação funciona com muitos comandos. Basta pressionar CTRL-D e Revisão e atualização da tradução para a versão 1.7 por Jakson Aquino, Universidade Federal do Ceará: E-mail: jalvesaq@gmail.com - Last Change: 2010 Jul 27 + Nova revisão e atualização para a versão 1.8 por Roní Gonçalves, + Universidade Federal de Uberlândia. + + Last Change: 2017 Feb 11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ru b/runtime/tutor/tutor.ru index 6fd74cf085..be6c1bd2f3 100644 --- a/runtime/tutor/tutor.ru +++ b/runtime/tutor/tutor.ru @@ -1,29 +1,32 @@ =============================================================================== -= VIM - 1.5 = += VIM -- 1.7 = =============================================================================== - Vim --- , , - , , - . , - Vim + + Vim -- , , + , , . + , + ̣ Vim . 25-30 - , . + , . - . , - ( "vimtutor", - ). + ! . + , ( + "vimtutor", ). , - . , , - . , - ! + . , , + . , + ! - , CapsLock - j , , 1.1 + , CapsLock , + j , , 1.1 . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.1: + 1.1: + ** h,j,k,l , . ** ^ @@ -33,802 +36,972 @@ v 1. , . - 2. `' (j) . ----> , . + 2. `' (j) Σ . + , . 3. `' 1.2. -: , , <ESC> - (Normal mode). - . +! , , <ESC> + (Normal mode). + . + +! () + . , hjkl + , . -: () - . , hjkl - , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.2: VIM + 1.2: VIM + -!! ! , , + !! ! , , !! - 1. <ESC> ( , , + 1. <ESC> ( , , (Normal mode)). 2. : :q! <ENTER>. + ( , :q! + .) + . ----> - . : - :wq <ENTER> + 3. , , + . : + vimtutor <ENTER> - 3. , , - . - vimtutor ru <ENTER> - : vim tutor.ru <ENTER> + 4. , , 1 3 + . ----> 'vim' vim, 'tutor.ru' --- , - . +! :q! <ENTER> . + . + + 5. 1.3. - 4. , , 1 3 - . - 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.3: - + 1.3: -- -** x, . ** +** x . ** - 1. , --->. + 1. , --->. 2. , , . - 3. x . + 3. x . - 4. 2--4 . + 4. 2 4 . ---> . - 5. , , 1.4. - -: , - . + 5. , , 1.4. +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.4: - + 1.4: -- - ** (Normal mode), i . ** + ** , i . ** - 1. , --->. + 1. , --->. 2. , , . - 3. i . + 3. i . 4. <ESC> . - 2--4, . + 2 4, . ----> . +---> . ---> . - 5. , . + 5. , 1.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.5: -- + ** , A . ** + + 1. , --->. + . + + 2. A . + + 3. <ESC> + . + + 4. , ---> + 2 4 . + +---> + . +---> + . + + 5. , 1.6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1 + 1.6: + + + ** :wq Vim. ** + + !! ! , , + !! + + 1. Vim, 1.2: :q! + , , + Σ. + + 2. : + vim tutor <ENTER> + `vim' -- Vim, `tutor' -- + . , . + + 3. , . + + 4. Vim : :wq <ENTER> + + 5. vimtutor 1, vimtutor + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 + 1. , hjkl. - h () j () k () l () + h () j () k () l () - 2. Vim ( % ) : - vim _ <ENTER> + 2. Vim ( ) : + vim _ <ENTER> 3. Vim : - <ESC> :q! <ENTER> . + <ESC> :q! <ENTER> . : - <ESC> :wq <ENTER> . + <ESC> :wq <ENTER> . - 4. , : x + 4. , : x 5. , : - i <ESC> + i <ESC> + : + a <ESC> -: <ESC> (Normal mode) - . +! <ESC> (Normal mode) + ף ۣ . - 2. + 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.1: + 2.1: - ** dw . ** + ** dw . ** 1. <ESC>, . - 2. , , --->. + 2. , --->. 3. , . - 4. dw , . + 4. dw . -: dw . - - , <ESC> . +! dw + . - ң , <ESC> + . ---> . 5. 3 4, 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.2: + 2.2: - ** d$ . ** + ** d$ . ** 1. <ESC>, . - 2. , , --->. + 2. , --->. - 3. ( . ). + 3. ( ). - 4. , d$ . + 4. d$ . ---> - . . - 5. , 2.3. - - - - + 5. , , 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.3: + 2.3: + + , , . + d : - `' d : + d - [] d d [] : - - (, =1). - d - . - - ( ). + d - . + - ( ). : - w - , . - e - , . + w - , . + e - , . $ - . ^ - . -: (Normal mode) - , - . +! (Normal mode) + , + . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.4: + + + ** ģ + . ** + + 1. ---> . + + 2. 2w ң . + + 3. 3e ң . + + 4. 0 () . + + 5. 2 3 . + +---> . + 6. 2.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.4: `-' + 2.5: - ** dd . ** + ** ģ + . ** + + + : + d + + 1. ---> + . + + 2. d2w . + + 3. 1 2 + . + +---> . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.6: + - , - Vim , d . + ** dd . ** + + , Vi + d. 1. , . + 2. dd . - 3. . - 4. 2dd ( `--'), - . - 1) , - 2) , ! - 3) ``'', ``'' --- ! - 4) ! - 5) ... - 6) `' - 7) . + 3. ף . + + 4. 2dd . + +---> 1) , +---> 2) , ! +---> 3) ``'', ``'' --- ! +---> 4) ! +---> 5) ... +---> 6) `' +---> 7) . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.5: `' + 2.7: `' - ** u , U - . ** + ** u , U + . ** - 1. , , ---> + 1. , --->, . - 2. x . - 3. u () . - 4. , x . - 5. U , - . - 6. u U . - 7. CTRL-R ( CTRL - R) ( ). ----> `'. + 2. x . - 8. . 2. + 3. u () . + + 4. , x . + + 5. U , + . + + 6. u U . + 7. CTRL-R (.. CTRL + R) ( ). + +---> `'. + + 8. . 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2 + 2 + + 1. : dw - 1. : dw + 2. : d$ - 2. : d$ + 3. : dd - 3. : dd + 4. : 2w - 4. : + 5. : [] [] : - - + [] - , - , d - , w (), $ ( ), .. - 5. () : u ( u) - () : U ( U) + 6. : 0 + + 7. () : u ( u) + () : U ( U) : CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.1: + 3.1: - ** p . ** + ** p ̣ . ** - 1. . + 1. , --->. - 2. dd Vim'. + 2. dd ţ Vim'. 3. , - . - - 4. p . + ̣ . - 5. 2--4, . + 4. p . - ) . - ) , - ) - ) + 5. 2 4, . +---> ) . +---> ) , +---> ) +---> ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.2: + 3.2: - ** r , . ** + ** r , . ** - 1. , , --->. + 1. , --->. 2. , . - 3. r , . + 3. r , . - 4. 2 3, . + 4. 2 3, . ---> 0 ! ---> - ! - 5. 3.2. - -: , , - . + 5. 3.3. +! , , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.3: + 3.3: - ** cw . ** + ** ce . ** - 1. , , --->. + 1. , --->. 2. `o' `'. - 3. cw ( , `'.) + 3. ce ( , `'). 4. <ESC> ( , - .) + ). - 5. 3--4 . + 5. 3 4 . ---> . ---> . - , cw , -. - + , ce , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.4: c + 3.4: c -** , . ** + ** , . ** 1. , . - : + : - [] c c [] + [] c c [] 2. : w (), $ ( ) .. - 3. , , --->. + 3. , --->. 4. . - 5. c$ , + 5. c$ , , <ESC>. ---> , . ----> c$ . +---> c$ . +! Backspace . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3 + 3 - 1. , , p . - ( , + 1. , ̣, p . + ̣ ( , ). - 2. r . + 2. r . - 3. - . , cw - , c$ . + 3. + . , ce + , c$ . 4. : - [] c c [] - - . - - - + [] c c [] + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.1: + 4.1: - ** CTRL-g - . - SHIFT-G . ** + ** CTRL-g + . G (SHIFT-G) + . ** - : !! +! ! - 1. Ctrl g . - , . + 1. Ctrl g . + , . , 3. - 2. shift-G . - - 3. , shift-G. - , , Ctrl-g. - ( , .) + 2. Shift g . - 4. , 1--3. + 3. , Shift-G. + Σ , , Ctrl-g. + 4. , 1 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.2: + 4.2: - ** / . ** + + ** / . ** 1. (Normal mode) / . , , - : . + : . - 2. '' <ENTER>. , + 2. '' <ENTER>. , . - 3. , , n . - , Shift-N . + 3. , , n . + , Shift-N . + + 4. , + ? / . - 4. , - ? / . + 5. , , Ctrl-O. + ( Ctrl o ). + . ң Ctrl-I . ----> , - . +---> "" `'; . - "" `'; . +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.3: - ** % ),] } . ** + ** % ), ] } . ** - 1. (, [ { , --->. + 1. (, [ { , --->. - 2. % . + 2. % . 3. . - 4. % . + 4. % . ---> ( , (, [ ] { } . )) -: ! - - - - - +! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.4: - ** :s///g '' ''. ** + ** :s///g '' ''. ** - 1. , , --->. + 1. , --->. - 2. :s// <ENTER> . , - . + 2. :s// <ENTER> . , + . - 3. :s///g , - . . + 3. :s///g , g + . + . ---> , , . 4. , - :#,#s///g #,# --- . - :%s///g . - + :#,#s///g #,# -- . + :%s///g . + :%s///gc + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4 - 1. Ctrl-g . - Shift-G . , Shift-G + 4 + + + 1. Ctrl-g . + Shift-G . , Shift-G . + gg . - 2. / - . - ? + 2. / + . + ? . - n + n Shift-N . - 3. % , (,),[,],{, } + 3. % , (,),[,],{, } . 4. `' `' , - :s/old/new + :s/old/new `' `' , - :s/old/new/g + :s/old/new/g , - :#,#s/old/new/g + :#,#s/old/new/g `' `' , - :%s/old/new/g + :%s/old/new/g , 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.1: + 5.1: - ** :! , . ** + ** :! , . ** - 1. : - . . + 1. : + . . - 2. ! ( ). + 2. ! ( ). , . - 3. ls ! <ENTER>. - , , - . :!dir , - . - ----> : . + 3. ls ! <ENTER>. + , , + . :!dir , ls + . ----> : , : , - <ENTER>. +! + . +! , : , + <ENTER>. . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.2: -** , , :w _. ** + ** , ģ , + :w _. ** - 1. :!dir :!ls . - , <ENTER> . + 1. :!dir :!ls + . , <ENTER>. - 2. , , TEST. + 2. , ݣ , TEST. - 3. :w TEST ( TEST --- , .) + 3. :w TEST ( TEST -- , .) - 4. ( Vim) TEST. - , :!dir . + 4. ( Vim) TEST. + , :!dir :!ls + . ----> , Vim - TEST, , - . - - 5. , :!del TEST +! Vim TEST + (.. vim TEST ), + , . + 5. , MS-DOS :!del TEST + Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.3: - ** , :#,# w _ ** - - 1. :!dir :!ls - , TEST. + ** , v + ţ :w _ ** - 2. Ctrl-g - to. ! + 1. . - 3. Ctrl-g. - ! + 2. v . , + . - 4. :#,# w TEST , #,# --- - , (, ), TEST --- . + 3. : :'<,'> . - 5. , :!dir , - . + 4. w TEST ( TEST -- , ݣ ). + <ENTER>, :'<,'>w TEST. + 5. Vim TEST. , + :!dir :!ls . , + . +! v . + . + - , , d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.4: + 5.4: - ** , :r FILENAME ** - 1. :!dir , , TEST - . + ** , :r _ ** - 2. . + 1. . -: 3 5.3. - , . +! 2 5.3. + . - 3. TEST, :r TEST , - TEST --- . + 2. TEST, :r TEST , TEST -- + . -: , - . + 3. , + , Σ 5.3: + TEST. - 4. , , - , 5.3, - . +! . , :r !ls + ls . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5 + 5 1. :! . : - :!dir --- . - :!del FILENAME --- FILENAME. + (MS-DOS) (Unix) + :!dir :!ls -- . + :!del :!rm -- . - 2. :w FILENAME - FILENAME. + 2. :w _ Vim + . - 3. :#,#w FILENAME # # FILENAME. + 3. v :w _ + . - 4. :r FILENAME FILENAME - . + 4. :r _ + . + 5. :r !dir dir . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.1: + ** o + (Insert mode) ** + 1. , --->. + 2. o ( ) , + (Insert mode). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.1: + 3. - <ESC> + . +---> o ģ . - ** o - (Insert mode) ** + 4. , O , + o . . - 1. , , --->. +---> , ţ Shift-O. - 2. o ( ) , - (Insert mode). +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.2: + + + ** a , . ** + + 1. , --->. - 3. ---> <ESC> - . + 2. e c . ----> o . + 3. a ( ) , + . ( A + .) - 4. , O, - o. . - , Shift-O, . + 4. , . <ESC> + (Insert mode). + 5. e ۣ + 3 4. +---> . +---> . +! a , i A , + , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.2: + 6.3: - ** a , . ** - 1. , , ---> , - $ (Normal mode). + ** R . ** - 2. a ( ) , - . ( A - .) + 1. , --->, + xxx. -: i , , - , <ESC>, -, , , x , , - ! + 2. R , , + xxx. - 3. . , - , , , - . + 3. <ESC> . , + Σ. ----> ----> - . -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.3: + 4. xxx. +---> 123 xxx xxx. +---> 123 456 579. - ** R , . ** +! , ģ + . - 1. , , --->. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.4: - 2. , - , ---> ( ''). - 3. R , - , . + ** y p ** ----> , . ----> , R . + 1. , --->, `)'. - 4. , <ESC> , - . + 2. v + `'. + 3. y . + 4. j$ . + 5. p . `' <ESC>. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.4: +---> ) . + ) +! yw ( y w ) + . -** , ** +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.5: - 1. '', : - / - , n + ** ** - 2. 'ic' ( ), : - :set ic + 1. `', : / <ENTER>. + , n . - 3. '', : n - , n + 2. `ic' ( ), : :set ic - 4. 'hlsearch' 'incsearch': - :set hls is + 3. `', + : n + , `' `'. - 5. , : - / + 4. `hlsearch' `incsearch': :set hls is + 5. , : + / <ENTER> + 6. ޣ : :set noic -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6 +! : :nohlsearch +! , + \ : /\c <ENTER> - 1. o - . - O , - . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6 - 2. a , . - A - . - 3. R , - <ESC> . + 1. o . + O . - 4. ":set xxx" "xxx" + 2. a . + A . + 3. e . + 4. y , p -- . + 5. R <ESC> . + 6. `:set xxx' `xxx', : + `ic' `ignorecase' + `is' `incsearch' + `hls' `hlsearch' + 7. `no' : :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 7: + 7.1: + - ** ** + ** ** Vim . - : + ң : - <HELP> ( ) - <F1> ( ) - :help <ENTER> + + . + CTRL-W CTRL-W . :q <ENTER> . - , - ":help". ( - <ENTER>): + , + `:help'. ( <ENTER>): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7.2: + - :help w - :help c_<T - :help insert-index + ** Vim ** + Vim , Vi, + . + `vimrc'. + 1. `vimrc'. + : + :e ~/.vimrc Unix + :e $VIM/_vimrc MS-Windows + 2. `vimrc': + :r $VIMRUNTIME/vimrc_example.vim + 3. `vimrc': + :w + + Vim . + , , `vimrc'. + :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 8: + 7.3: - ** Vim ** - Vim , Vi, - . , - "vimrc". + ** CTRL-D <TAB> ** - 1. "vimrc", - : + 1. , Vim : :set nocp - :edit ~/.vimrc Unix - :edit $VIM/_vimrc MS-Windows + 2. : :!ls :!dir - 2. "vimrc": + 3. : :e - :read $VIMRUNTIME/vimrc_example.vim + 4. CTRL-D Vim `e'. - 3. : + 5. <TAB> Vim `:edit'. - :write + 6. : :edit - Vim . - , , "vimrc". + 7. <TAB> Vim , . + +! . CTRL-D + <TAB>. :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 + + + 1. :help <F1>, <Help> . + + 2. :help cmd . + + 3. CTRL-W CTRL-W . + + 4. :q ( ). + + 5. `vimrc'. + + 6. : , CTRL-D + . <TAB> . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Vim. , - Vim, , - . , Vim - . : ":help user-manual". + + Vim. + Vim, , ̣ . + ̣ , Vim . + : `:help user-manual'. : - Vim - Vi Improved - : Steve Oualline - : New Riders - Vim. . - . - See http://iccf-holland.org/click5.html + Vim - Vi Improved, : Steve Oualline, : New Riders + + Vim. . + . + . http://iccf-holland.org/click5.html Vi, Vim, : - Learning the Vi Editor - : Linda Lamb - : O'Reilly & Associates Inc. - , , - Vi. Vim. + Learning the Vi Editor, : Linda Lamb, + : O'Reilly & Associates Inc. + + , ӣ, Vi. + Vim. - Michael C. Pierce Robert K. Ware, Colorado School - of Mines , Charles Smith, Colorado State + Michael C. Pierce Robert K. Ware, Colorado School of + Mines , Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Vim Bram Moolenaar. + Vim (Bram Moolenaar). + + : + <a_kissel@eudoramail.com>, 2002. + ̣ <alyoshin.s@gmail.com>, 2014. + + Translators: + Andrey Kiselev <a_kissel@eudoramail.com>, 2002. + Sergey Alyoshin <alyoshin.s@gmail.com>, 2014. - : <a_kissel@eudoramail.com>, 2002. - Translator: Andrey Kiselev <a_kissel@eudoramail.com>, 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ru.cp1251 b/runtime/tutor/tutor.ru.cp1251 index 024ca526b8..1cff3eae7d 100644 --- a/runtime/tutor/tutor.ru.cp1251 +++ b/runtime/tutor/tutor.ru.cp1251 @@ -1,29 +1,32 @@ =============================================================================== -= VIM - 1.5 = += VIM -- 1.7 = =============================================================================== - Vim --- , , - , , - . , - Vim + + Vim -- , , + , , . + , + Vim . 25-30 - , . + , . - . , - ( "vimtutor", - ). + ! . + , ( + "vimtutor", ). , - . , , - . , - ! + . , , + . , + ! - , CapsLock - j , , 1.1 + , CapsLock , + j , , 1.1 . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.1: + 1.1: + ** h,j,k,l , . ** ^ @@ -33,802 +36,972 @@ v 1. , . - 2. `' (j) . ----> , . + 2. `' (j) . + , . 3. `' 1.2. -: , , <ESC> - (Normal mode). - . +! , , <ESC> + (Normal mode). + . + +! () + . , hjkl + , . -: () - . , hjkl - , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.2: VIM + 1.2: VIM + -!! ! , , + !! ! , , !! - 1. <ESC> ( , , + 1. <ESC> ( , , (Normal mode)). 2. : :q! <ENTER>. + ( , :q! + .) + . ----> - . : - :wq <ENTER> + 3. , , + . : + vimtutor <ENTER> - 3. , , - . - vimtutor ru <ENTER> - : vim tutor.ru <ENTER> + 4. , , 1 3 + . ----> 'vim' vim, 'tutor.ru' --- , - . +! :q! <ENTER> . + . + + 5. 1.3. - 4. , , 1 3 - . - 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.3: - + 1.3: -- -** x, . ** +** x . ** - 1. , --->. + 1. , --->. 2. , , . - 3. x . + 3. x . - 4. 2--4 . + 4. 2 4 . ---> . - 5. , , 1.4. - -: , - . + 5. , , 1.4. +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.4: - + 1.4: -- - ** (Normal mode), i . ** + ** , i . ** - 1. , --->. + 1. , --->. 2. , , . - 3. i . + 3. i . 4. <ESC> . - 2--4, . + 2 4, . ----> . +---> . ---> . - 5. , . + 5. , 1.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.5: -- + ** , A . ** + + 1. , --->. + . + + 2. A . + + 3. <ESC> + . + + 4. , ---> + 2 4 . + +---> + . +---> + . + + 5. , 1.6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1 + 1.6: + + + ** :wq Vim. ** + + !! ! , , + !! + + 1. Vim, 1.2: :q! + , , + . + + 2. : + vim tutor <ENTER> + `vim' -- Vim, `tutor' -- + . , . + + 3. , . + + 4. Vim : :wq <ENTER> + + 5. vimtutor 1, vimtutor + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 + 1. , hjkl. - h () j () k () l () + h () j () k () l () - 2. Vim ( % ) : - vim _ <ENTER> + 2. Vim ( ) : + vim _ <ENTER> 3. Vim : - <ESC> :q! <ENTER> . + <ESC> :q! <ENTER> . : - <ESC> :wq <ENTER> . + <ESC> :wq <ENTER> . - 4. , : x + 4. , : x 5. , : - i <ESC> + i <ESC> + : + a <ESC> -: <ESC> (Normal mode) - . +! <ESC> (Normal mode) + . - 2. + 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.1: + 2.1: - ** dw . ** + ** dw . ** 1. <ESC>, . - 2. , , --->. + 2. , --->. 3. , . - 4. dw , . + 4. dw . -: dw . - - , <ESC> . +! dw + . - , <ESC> + . ---> . 5. 3 4, 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.2: + 2.2: - ** d$ . ** + ** d$ . ** 1. <ESC>, . - 2. , , --->. + 2. , --->. - 3. ( . ). + 3. ( ). - 4. , d$ . + 4. d$ . ---> - . . - 5. , 2.3. - - - - + 5. , , 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.3: + 2.3: + + , , . + d : - `' d : + d - [] d d [] : - - (, =1). - d - . - - ( ). + d - . + - ( ). : - w - , . - e - , . + w - , . + e - , . $ - . ^ - . -: (Normal mode) - , - . +! (Normal mode) + , + . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.4: ר + + + ** + . ** + + 1. ---> . + + 2. 2w . + + 3. 3e . + + 4. 0 () . + + 5. 2 3 . + +---> . + 6. 2.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.4: `-' + 2.5: ר - ** dd . ** + ** + . ** + + + : + d + + 1. ---> + . + + 2. d2w . + + 3. 1 2 + . + +---> . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.6: + - , - Vim , d . + ** dd . ** + + , Vi + d. 1. , . + 2. dd . - 3. . - 4. 2dd ( `--'), - . - 1) , - 2) , ! - 3) ``'', ``'' --- ! - 4) ! - 5) ... - 6) `' - 7) . + 3. . + + 4. 2dd . + +---> 1) , +---> 2) , ! +---> 3) ``'', ``'' --- ! +---> 4) ! +---> 5) ... +---> 6) `' +---> 7) . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.5: `' + 2.7: `' - ** u , U - . ** + ** u , U + . ** - 1. , , ---> + 1. , --->, . - 2. x . - 3. u () . - 4. , x . - 5. U , - . - 6. u U . - 7. CTRL-R ( CTRL - R) ( ). ----> `'. + 2. x . - 8. . 2. + 3. u () . + + 4. , x . + + 5. U , + . + + 6. u U . + 7. CTRL-R (.. CTRL + R) ( ). + +---> `'. + + 8. . 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2 + 2 + + 1. : dw - 1. : dw + 2. : d$ - 2. : d$ + 3. : dd - 3. : dd + 4. : 2w - 4. : + 5. : [] [] : - - + [] - , - , d - , w (), $ ( ), .. - 5. () : u ( u) - () : U ( U) + 6. : 0 + + 7. () : u ( u) + () : U ( U) : CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.1: + 3.1: - ** p . ** + ** p . ** - 1. . + 1. , --->. - 2. dd Vim'. + 2. dd Vim'. 3. , - . - - 4. p . + . - 5. 2--4, . + 4. p . - ) . - ) , - ) - ) + 5. 2 4, . +---> ) . +---> ) , +---> ) +---> ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.2: + 3.2: - ** r , . ** + ** r , . ** - 1. , , --->. + 1. , --->. 2. , . - 3. r , . + 3. r , . - 4. 2 3, . + 4. 2 3, . ---> 0 ! ---> - ! - 5. 3.2. - -: , , - . + 5. 3.3. +! , , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.3: + 3.3: - ** cw . ** + ** ce . ** - 1. , , --->. + 1. , --->. 2. `o' `'. - 3. cw ( , `'.) + 3. ce ( , `'). 4. <ESC> ( , - .) + ). - 5. 3--4 . + 5. 3 4 . ---> . ---> . - , cw , -. - + , ce , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.4: c + 3.4: c -** , . ** + ** , . ** 1. , . - : + Ÿ : - [] c c [] + [] c c [] 2. : w (), $ ( ) .. - 3. , , --->. + 3. , --->. 4. . - 5. c$ , + 5. c$ , , <ESC>. ---> , . ----> c$ . +---> c$ . +! Backspace . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3 + 3 - 1. , , p . - ( , + 1. , , p . + ( , ). - 2. r . + 2. r . - 3. - . , cw - , c$ . + 3. + . , ce + , c$ . 4. : - [] c c [] - - . - - - + [] c c [] + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.1: + 4.1: - ** CTRL-g - . - SHIFT-G . ** + ** CTRL-g + . G (SHIFT-G) + . ** - : !! +! ! - 1. Ctrl g . - , . + 1. Ctrl g . + , . , 3. - 2. shift-G . - - 3. , shift-G. - , , Ctrl-g. - ( , .) + 2. Shift g . - 4. , 1--3. + 3. , Shift-G. + , , Ctrl-g. + 4. , 1 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.2: + 4.2: - ** / . ** + + ** / . ** 1. (Normal mode) / . , , - : . + : . - 2. '' <ENTER>. , + 2. '' <ENTER>. , . - 3. , , n . - , Shift-N . + 3. , , n . + , Shift-N . + + 4. , + ? / . - 4. , - ? / . + 5. , , Ctrl-O. + ( Ctrl o ). + . Ctrl-I . ----> , - . +---> "" `'; . - "" `'; . +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.3: - ** % ),] } . ** + ** % ), ] } . ** - 1. (, [ { , --->. + 1. (, [ { , --->. - 2. % . + 2. % . 3. . - 4. % . + 4. % . ---> ( , (, [ ] { } . )) -: ! - - - - - +! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.4: - ** :s///g '' ''. ** + ** :s///g '' ''. ** - 1. , , --->. + 1. , --->. - 2. :s// <ENTER> . , - . + 2. :s// <ENTER> . , + . - 3. :s///g , - . . + 3. :s///g , g + . + . ---> , , . 4. , - :#,#s///g #,# --- . - :%s///g . - + :#,#s///g #,# -- . + :%s///g . + :%s///gc + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4 - 1. Ctrl-g . - Shift-G . , Shift-G + 4 + + + 1. Ctrl-g . + Shift-G . , Shift-G . + gg . - 2. / - . - ? + 2. / + Ш . + ? . - n + n Shift-N . - 3. % , (,),[,],{, } + 3. % , (,),[,],{, } . 4. `' `' , - :s/old/new + :s/old/new `' `' , - :s/old/new/g + :s/old/new/g , - :#,#s/old/new/g + :#,#s/old/new/g `' `' , - :%s/old/new/g + :%s/old/new/g , 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.1: + 5.1: - ** :! , . ** + ** :! , . ** - 1. : - . . + 1. : + . . - 2. ! ( ). + 2. ! ( ). , . - 3. ls ! <ENTER>. - , , - . :!dir , - . - ----> : . + 3. ls ! <ENTER>. + , , + . :!dir , ls + . ----> : , : , - <ENTER>. +! + . +! , : , + <ENTER>. . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.2: -** , , :w _. ** + ** , , + :w _. ** - 1. :!dir :!ls . - , <ENTER> . + 1. :!dir :!ls + . , <ENTER>. - 2. , , TEST. + 2. , , TEST. - 3. :w TEST ( TEST --- , .) + 3. :w TEST ( TEST -- , .) - 4. ( Vim) TEST. - , :!dir . + 4. ( Vim) TEST. + , :!dir :!ls + . ----> , Vim - TEST, , - . - - 5. , :!del TEST +! Vim TEST + (.. vim TEST ), + , . + 5. , MS-DOS :!del TEST + Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.3: - ** , :#,# w _ ** - - 1. :!dir :!ls - , TEST. + ** , v + :w _ ** - 2. Ctrl-g - to. ! + 1. . - 3. Ctrl-g. - ! + 2. v . , + . - 4. :#,# w TEST , #,# --- - , (, ), TEST --- . + 3. : :'<,'> . - 5. , :!dir , - . + 4. w TEST ( TEST -- , ). + <ENTER>, :'<,'>w TEST. + 5. Vim TEST. , + :!dir :!ls . , + . +! v . + . + - , , d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.4: + 5.4: - ** , :r FILENAME ** - 1. :!dir , , TEST - . + ** , :r _ ** - 2. . + 1. . -: 3 5.3. - , . +! 2 5.3. + . - 3. TEST, :r TEST , - TEST --- . + 2. TEST, :r TEST , TEST -- + . -: , - . + 3. , + , 5.3: + TEST. - 4. , , - , 5.3, - . +! . , :r !ls + ls . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5 + 5 1. :! . : - :!dir --- . - :!del FILENAME --- FILENAME. + (MS-DOS) (Unix) + :!dir :!ls -- . + :!del :!rm -- . - 2. :w FILENAME - FILENAME. + 2. :w _ Vim + . - 3. :#,#w FILENAME # # FILENAME. + 3. v :w _ + . - 4. :r FILENAME FILENAME - . + 4. :r _ + . + 5. :r !dir dir . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.1: + ** o + (Insert mode) ** + 1. , --->. + 2. o ( ) , + (Insert mode). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.1: + 3. - <ESC> + . +---> o . - ** o - (Insert mode) ** + 4. , O , + o . . - 1. , , --->. +---> , Shift-O. - 2. o ( ) , - (Insert mode). +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.2: + + + ** a , . ** + + 1. , --->. - 3. ---> <ESC> - . + 2. e c . ----> o . + 3. a ( ) , + . ( A + .) - 4. , O, - o. . - , Shift-O, . + 4. , . <ESC> + (Insert mode). + 5. e + 3 4. +---> . +---> . +! a , i A , + , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.2: + 6.3: ٨ - ** a , . ** - 1. , , ---> , - $ (Normal mode). + ** R . ** - 2. a ( ) , - . ( A - .) + 1. , --->, + xxx. -: i , , - , <ESC>, -, , , x , , - ! + 2. R , , + xxx. - 3. . , - , , , - . + 3. <ESC> . , + . ----> ----> - . -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.3: + 4. xxx. +---> 123 xxx xxx. +---> 123 456 579. - ** R , . ** +! , + . - 1. , , --->. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.4: - 2. , - , ---> ( ''). - 3. R , - , . + ** y p ** ----> , . ----> , R . + 1. , --->, `)'. - 4. , <ESC> , - . + 2. v + `'. + 3. y . + 4. j$ . + 5. p . `' <ESC>. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.4: +---> ) . + ) +! yw ( y w ) + . -** , ** +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.5: - 1. '', : - / - , n + ** ** - 2. 'ic' ( ), : - :set ic + 1. `', : / <ENTER>. + , n . - 3. '', : n - , n + 2. `ic' ( ), : :set ic - 4. 'hlsearch' 'incsearch': - :set hls is + 3. `', + : n + , `' `'. - 5. , : - / + 4. `hlsearch' `incsearch': :set hls is + 5. , : + / <ENTER> + 6. : :set noic -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6 +! : :nohlsearch +! , + \ : /\c <ENTER> - 1. o - . - O , - . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6 - 2. a , . - A - . - 3. R , - <ESC> . + 1. o . + O . - 4. ":set xxx" "xxx" + 2. a . + A . + 3. e . + 4. y , p -- . + 5. R <ESC> . + 6. `:set xxx' `xxx', : + `ic' `ignorecase' + `is' `incsearch' + `hls' `hlsearch' + 7. `no' : :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 7: + 7.1: + - ** ** + ** ** Vim . - : + : - <HELP> ( ) - <F1> ( ) - :help <ENTER> + + . + CTRL-W CTRL-W . :q <ENTER> . - , - ":help". ( - <ENTER>): + , + `:help'. ( <ENTER>): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7.2: + - :help w - :help c_<T - :help insert-index + ** Vim ** + Vim , Vi, + . + `vimrc'. + 1. `vimrc'. + : + :e ~/.vimrc Unix + :e $VIM/_vimrc MS-Windows + 2. `vimrc': + :r $VIMRUNTIME/vimrc_example.vim + 3. `vimrc': + :w + + Vim . + , , `vimrc'. + :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 8: + 7.3: - ** Vim ** - Vim , Vi, - . , - "vimrc". + ** CTRL-D <TAB> ** - 1. "vimrc", - : + 1. , Vim : :set nocp - :edit ~/.vimrc Unix - :edit $VIM/_vimrc MS-Windows + 2. : :!ls :!dir - 2. "vimrc": + 3. : :e - :read $VIMRUNTIME/vimrc_example.vim + 4. CTRL-D Vim `e'. - 3. : + 5. <TAB> Vim `:edit'. - :write + 6. : :edit - Vim . - , , "vimrc". + 7. <TAB> Vim , . + +! . CTRL-D + <TAB>. :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 + + + 1. :help <F1>, <Help> . + + 2. :help cmd . + + 3. CTRL-W CTRL-W . + + 4. :q ( ). + + 5. `vimrc'. + + 6. : , CTRL-D + . <TAB> . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Vim. , - Vim, , - . , Vim - . : ":help user-manual". + + Vim. + Vim, , . + , Vim . + : `:help user-manual'. : - Vim - Vi Improved - : Steve Oualline - : New Riders - Vim. . - . - See http://iccf-holland.org/click5.html + Vim - Vi Improved, : Steve Oualline, : New Riders + + Vim. . + . + . http://iccf-holland.org/click5.html Vi, Vim, : - Learning the Vi Editor - : Linda Lamb - : O'Reilly & Associates Inc. - , , - Vi. Vim. + Learning the Vi Editor, : Linda Lamb, + : O'Reilly & Associates Inc. + + , , Vi. + Vim. - Michael C. Pierce Robert K. Ware, Colorado School - of Mines , Charles Smith, Colorado State + Michael C. Pierce Robert K. Ware, Colorado School of + Mines , Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Vim Bram Moolenaar. + Vim (Bram Moolenaar). + + : + <a_kissel@eudoramail.com>, 2002. + <alyoshin.s@gmail.com>, 2014. + + Translators: + Andrey Kiselev <a_kissel@eudoramail.com>, 2002. + Sergey Alyoshin <alyoshin.s@gmail.com>, 2014. - : <a_kissel@eudoramail.com>, 2002. - Translator: Andrey Kiselev <a_kissel@eudoramail.com>, 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ru.utf-8 b/runtime/tutor/tutor.ru.utf-8 index c12de27d80..41151924d4 100644 --- a/runtime/tutor/tutor.ru.utf-8 +++ b/runtime/tutor/tutor.ru.utf-8 @@ -1,29 +1,32 @@ =============================================================================== -= Д о б р о п о ж а л о в а т ь в у ч е б н и к VIM - Версия 1.5 = += Д о б р о п о ж а л о в а т ь в у ч е б н и к VIM -- версия 1.7 = =============================================================================== - Vim --- это очень мощный редактор, имеющий множество команд, слишком - много для того, чтобы их все можно было описать в таком учебнике, как - этот. Этот учебник призван объяснить достаточное число команд для того, - чтобы Вы могли с легкостью использовать Vim в качестве редактора общего + + Vim -- это очень мощный редактор, имеющий множество команд, слишком много + для того, чтобы их все можно было описать в таком учебнике, как этот. + Этот учебник призван объяснить достаточное число команд для того, чтобы + вы могли с лёгкостью использовать Vim в качестве редактора общего назначения. Вам потребуется приблизительно 25-30 минут на освоение данного учебника в - зависимости от того, сколько времени Вы потратите на эксперименты. + зависимости от того, сколько времени вы потратите на эксперименты. - Команды в уроках будут модифицировать текст. Создайте копию этого файла, - чтобы попрактиковаться на ней (если Вы запустили "vimtutor", то это уже - копия). + Внимание! Командами в уроках вы будете изменять этот текст. Создайте + копию этого файла, чтобы попрактиковаться на ней (если вы запустили + "vimtutor", то это уже копия). Важно помнить, что этот учебник предназначен для обучения в процессе - использования. Это означает, что Вы должны запускать команды для того, - чтобы как следует их изучить. Если Вы просто прочитаете текст, то - забудете команды! + использования. Это означает, что вы должны запускать команды для того, + чтобы как следует их изучить. Если вы просто прочитаете этот текст, то + не запомните команды! - Теперь убедитесь в том, что клавиша CapsLock не включена и нажмите - клавишу j несколько раз, так, чтобы Урок 1.1 полностью поместился на + Теперь убедитесь в том, что клавиша CapsLock не включена, и нажмите + клавишу j несколько раз, так, чтобы Урок 1.1 полностью поместился на экране. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.1: ПЕРЕМЕЩЕНИЕ КУРСОРА + Урок 1.1: ПЕРЕМЕЩЕНИЕ КУРСОРА + ** Для перемещения курсора нажмите клавиши h,j,k,l так, как показано ниже. ** ^ @@ -33,802 +36,972 @@ v 1. Подвигайте курсор по экрану, пока не почувствуете себя уверенно. - 2. Надавите клавишу `вниз' (j) пока она не начнет повторяться. ----> Теперь Вы знаете, как перейти к следующему уроку. + 2. Надавите клавишу `вниз' (j) пока она не начнёт повторяться. + Теперь вы знаете, как перейти к следующему уроку. 3. Используя клавишу `вниз' перейдите к Уроку 1.2. -Замечание: Если вы пока не уверены в том, что набираете, нажмите <ESC> для - перехода в обычный режим (Normal mode). После этого перенаберите - требуемую команду. +Замечание! Если вы пока не уверены в том, что набираете, нажмите <ESC> для + перехода в обычный режим (Normal mode). После этого перенаберите + требуемую команду. + +Замечание! Обычные клавиши управления курсором (стрелки) также должны + работать. Однако, клавиши hjkl позволят вам перемещаться + значительно быстрее, как только вы научитесь ими пользоваться. -Замечание: Обычные клавиши управления курсором (стрелки) также должны - работать. Однако, клавиши hjkl позволят Вам перемещаться - значительно быстрее, как только Вы научитесь ими пользоваться. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.2: ЗАПУСК И ЗАВЕРШЕНИЕ РАБОТЫ С VIM + Урок 1.2: ЗАВЕРШЕНИЕ РАБОТЫ С VIM + -!! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите + !! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите урок целиком !! - 1. Нажмите клавишу <ESC> (для того, чтобы удостовериться, что Вы в обычном + 1. Нажмите клавишу <ESC> (для того, чтобы удостовериться, что вы в обычном режиме (Normal mode)). 2. Наберите: :q! <ENTER>. + (Это означает, что вы должны набрать три символа :q! и нажать клавишу + ввод.) Это позволит вам выйти из редактора БЕЗ СОХРАНЕНИЯ любых сделанных + изменений. ----> Это позволит Вам выйти из редактора БЕЗ СОХРАНЕНИЯ любых сделанных - изменений. Если Вы хотите сохранить изменения и выйти: - :wq <ENTER> + 3. Когда вы увидите приглашение командной оболочки, наберите команду, + которая привела вас в этот учебник. Это может быть: + vimtutor <ENTER> - 3. Когда Вы увидите приглашение командной оболочки, наберите команду, - которая привела Вас в этот учебник. Это может быть - vimtutor ru <ENTER> - Обычно можно использовать: vim tutor.ru <ENTER> + 4. Если вы уверены в том, что запомнили эти шаги, выполните шаги от 1 до 3 + чтобы выйти и снова запустить редактор. ----> 'vim' позволяет запустить редактор vim, 'tutor.ru' --- это файл, который - Вы будете редактировать. +Замечание! :q! <ENTER> отбрасывает любые сделанные вами изменения. Через + несколько уроков вы узнаете как сохранять изменения в файл. + + 5. Переместите курсор вниз к Уроку 1.3. - 4. Если Вы уверены в том, что запомнили эти шаги, выполните шаги от 1 до 3 - чтобы выйти снова запустить редактор. Затем переместите курсор вниз к - Уроку 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.3: РЕДАКТИРОВАНИЕ ТЕКСТА - УДАЛЕНИЕ + Урок 1.3: РЕДАКТИРОВАНИЕ ТЕКСТА -- УДАЛЕНИЕ -** Находясь в обычном режиме нажмите x, чтобы удалить символ под курсором. ** +** Находясь в обычном режиме нажмите x для удаления символа под курсором. ** - 1. Переместите курсор к строке внизу, помеченной --->. + 1. Переместите курсор к строке ниже, помеченной --->. 2. Для исправления ошибок, переместите курсор, пока он не окажется над удаляемым символом. - 3. Нажмите клавишу x для удаления требуемого символа. + 3. Нажмите клавишу x для удаления требуемого символа. - 4. Повторите шаги 2--4 пока строка не будет исправлена. + 4. Повторите шаги со 2 по 4 пока строка не будет исправлена. ---> От тттопота копытт пппыль ппо ппполю леттитт. - 5. Теперь, когда строка откорректирована, переходите к уроку 1.4. - -ЗАМЕЧАНИЕ: В ходе освоения этого учебника не пытайтесь запоминать, учите - в процессе использования. + 5. Теперь, когда строка откорректирована, переходите к Уроку 1.4. +Замечание! В ходе освоения этого учебника не пытайтесь запоминать, учите + в процессе использования. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.4: РЕДАКТИРОВАНИЕ ТЕКСТА - ВСТАВКА + Урок 1.4: РЕДАКТИРОВАНИЕ ТЕКСТА -- ВСТАВКА - ** Находясь в обычном режиме (Normal mode), нажмите i для вставки текста. ** + ** Находясь в обычном режиме, нажмите i для вставки текста. ** - 1. Переместите курсор к первой строке внизу, помеченной --->. + 1. Переместите курсор к первой строке ниже, помеченной --->. 2. Для того, чтобы сделать первую строку идентичной второй, поместите курсор на символ ПЕРЕД которым следует вставить текст. - 3. Нажмите i и наберите требуемые добавления. + 3. Нажмите i и наберите требуемые добавления. 4. После исправления всех ошибок нажмите <ESC> для возврата в обычный режим. - Повторите шаги 2--4, пока фраза не будет исправлена полностью. + Повторите шаги со 2 по 4, пока фраза не будет исправлена полностью. ----> Часть текста в строке беследно . +---> Часть текста в строке бесследно . ---> Часть текста в этой строке бесследно пропала. - 5. Когда освоите вставку текста, переходите дальше к Резюме. + 5. Когда освоите вставку текста, переходите к Уроку 1.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.5: РЕДАКТИРОВАНИЕ ТЕКСТА -- ДОБАВЛЕНИЕ + ** Находясь в обычном режиме, нажмите A для добавления текста. ** + + 1. Переместите курсор к первой строке ниже, помеченной --->. + Не имеет значения на каком символе расположен курсор на этой строке. + + 2. Нажмите A и наберите требуемые добавления. + + 3. После добавления требуемого текста нажмите <ESC> для возврата в обычный + режим. + + 4. Переместите курсор на следующую строку, помеченную ---> и повторите шаги + со 2 по 4 для исправления этой строки. + +---> Часть текста в этой строке бессле + Часть текста в этой строке бесследно пропала. +---> Здесь также не достаёт час + Здесь также не достаёт части текста. + + 5. Когда освоите добавление текста, переходите к Уроку 1.6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 1 + Урок 1.6: РЕДАКТИРОВАНИЕ ФАЙЛА + + + ** Используйте :wq для сохранения файла и выхода из Vim. ** + + !! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите + урок целиком !! + + 1. Выйдите из Vim, как вы это узнали в Уроке 1.2: :q! + Или, если у вас есть доступ к другому терминалу, можете сделать следующее + в нём. + + 2. По приглашению командной оболочки введите следующую команду: + vim tutor <ENTER> + `vim' -- команда для запуска редактора Vim, а `tutor' -- имя файла для + редактирования. Используете имя файла, который можно изменять. + + 3. Вставляйте и удаляйте текст, как вы научились в предыдущих уроках. + + 4. Сохраните файл с изменениями и выйдите из Vim выполнив: :wq <ENTER> + + 5. Если вы вышли из vimtutor на шаге 1, перезапустите vimtutor и переходите + к следующему Резюме. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + РЕЗЮМЕ УРОКА 1 + 1. Курсор перемещается либо клавишами со стрелками, либо клавишами hjkl. - h (влево) j (вниз) k (вверх) l (вправо) + h (влево) j (вниз) k (вверх) l (вправо) - 2. Для запуска Vim (из приглашения % командной оболочки) наберите: - vim ИМЯ_ФАЙЛА <ENTER> + 2. Для запуска Vim (из приглашения командной оболочки) наберите: + vim ИМЯ_ФАЙЛА <ENTER> 3. Для завершения работы с Vim наберите: - <ESC> :q! <ENTER> чтобы отказаться от сохранения изменений. + <ESC> :q! <ENTER> чтобы отказаться от сохранения изменений. Или наберите: - <ESC> :wq <ENTER> чтобы сохранить изменения. + <ESC> :wq <ENTER> чтобы сохранить изменения. - 4. Для удаления символа под курсором в обычном режиме, наберите: x + 4. Для удаления символа под курсором в обычном режиме, нажмите: x 5. Чтобы вставить текст перед курсором в обычном режиме, наберите: - i вводите текст <ESC> + i вводите вставляемый текст <ESC> + Чтобы добавить текст после курсора: + a вводите добавляемый текст <ESC> -ЗАМЕЧАНИЕ: Нажатие <ESC> переместит Вас в обычный режим (Normal mode) либо - прервет нежелательную и частично завершенную команду. +Замечание! Нажатие <ESC> переместит вас в обычный режим (Normal mode) либо + прервёт нежелательную и частично завершённую команду. -Теперь переходим к Уроку 2. +Теперь переходите к Уроку 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.1: КОМАНДЫ УДАЛЕНИЯ + Урок 2.1: КОМАНДЫ УДАЛЕНИЯ - ** Наберите dw для удаления участка текста до конца слова. ** + ** Наберите dw для удаления участка текста до конца слова. ** 1. Нажмите <ESC>, чтобы перейти в обычный режим. - 2. Переместите курсор вниз, к строке, помеченной --->. + 2. Переместите курсор вниз, к строке помеченной --->. 3. Переместите курсор в начало слова, которое следует удалить. - 4. Наберите dw , чтобы удалить это слово. + 4. Наберите dw для удаления этого слова. -ЗАМЕЧАНИЕ: Во время набора буквы dw появятся в последней строке экрана. Если - Вы что-то наберете неправильно, нажмите <ESC> и начните сначала. +Замечание! Во время набора буквы dw появятся справа в самой нижней строке + экрана. Если вы что-то наберёте неправильно, нажмите <ESC> и начните + сначала. ---> Несколько слов рафинад в этом предложении автокран излишни. 5. Повторите шаги 3 и 4, пока не исправите все ошибки и переходите к Уроку 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.2: ДОПОЛНИТЕЛЬНЫЕ КОМАНДЫ УДАЛЕНИЯ + Урок 2.2: ДОПОЛНИТЕЛЬНЫЕ КОМАНДЫ УДАЛЕНИЯ - ** Наберите d$ для удаления текста до конца строки. ** + ** Наберите d$ для удаления текста до конца строки. ** 1. Нажмите <ESC>, чтобы перейти в обычный режим. - 2. Переместите курсор вниз, к строке, помеченной --->. + 2. Переместите курсор вниз, к строке помеченной --->. - 3. Переместите курсор к концу правильной строки (ПОСЛЕ первой . ). + 3. Переместите курсор к концу правильной строки (ПОСЛЕ первой точки). - 4. Чтобы удалить остаток строки, наберите d$ . + 4. Наберите d$ для удаления остатка строки. ---> Кто-то набрал окончание этой строки дважды. окончание этой строки дважды. - 5.Чтобы лучше разобраться в этом, переходите к Уроку 2.3. - - - - + 5. Чтобы лучше разобраться в том, как это происходит, переходите к Уроку 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.3: КОМАНДЫ И ОБЪЕКТЫ + Урок 2.3: КОМАНДЫ И ОБЪЕКТЫ + + Многие команды, изменяющие текст, состоят из оператора и объекта. Формат + команды удаления с оператором d следующий: - Формат команды `удаление' d таков: + d объект - [число] d объект ИЛИ d [число] объект Здесь: - число - сколько раз исполнить команду (необязательно, по умолчанию=1). - d - команда удаления. - объект - с чем команда должна быть выполнена (перечислено ниже). + d - оператор удаления. + объект - над чем должна быть выполнена команда (перечислено ниже). Краткий список объектов: - w - от курсора до конца слова, включая завершающий пробел. - e - от курсора до конца слова, НЕ включая завершающий пробел. + w - от курсора до конца слова, включая последующий пробел. + e - от курсора до конца слова, НЕ включая последующий пробел. $ - от курсора до конца строки. ^ - от курсора до начала строки. -ЗАМЕЧАНИЕ: Простое нажатие на символ объекта в обычном режиме (Normal mode) - без дополнительных команд передвинет курсор так, как указано в - списке объектов. +Замечание! Простое нажатие на символ объекта в обычном режиме (Normal mode) + без предварительного оператора переместит курсор так, как указано + в списке объектов. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.4: ИСПОЛЬЗОВАНИЕ СЧЁТЧИКА ДЛЯ ПЕРЕМЕЩЕНИЯ + + + ** Ввод числа перед оператором перемещения приведёт к его повторению + заданное количество раз. ** + + 1. Переместите курсор к началу строки отмеченной ---> ниже. + + 2. Наберите 2w для перемещения курсора вперёд к началу второго слова. + + 3. Наберите 3e для перемещения курсора вперёд к концу третьего слова. + + 4. Наберите 0 (нуль) для перемещения к началу строки. + + 5. Повторите шаги 2 и 3 с различными числами. + +---> Обычная строка из слов для вашего перемещения по ней. + 6. Переходите к Уроку 2.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.4: ИСКЛЮЧЕНИЕ ИЗ ПРАВИЛА `КОМАНДА-ОБЪЕКТ' + Урок 2.5: ИСПОЛЬЗОВАНИЕ СЧЁТЧИКА ДЛЯ УДАЛЕНИЯ - ** Наберите dd для удаления всей строки. ** + ** Ввод числа перед оператором приведёт к его повторению + заданное количество раз. ** + + Добавьте число перед перед объектом в комбинацию оператора удаления и + перемещения указанную выше для удаления указанного количества объектов: + d число объект + + 1. Переместите курсор к первому слову из прописных букв в отмеченной ---> + строке ниже. + + 2. Наберите d2w для удаления двух слов из прописных букв. + + 3. Повторите шаги 1 и 2 с другими числами для удаления последовательных слов + из прописных букв одной командой. + +---> эта АБВ ГД строка ЕЖЗИ КЛ МНО из слов П РС ТУФ очищена. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.6: ОПЕРАЦИИ СО СТРОКАМИ + - Вследствие частого применения операции удаления всей строки, разработчики - Vim решили, что для этого проще всего просто набрать d дважды. + ** Наберите dd для удаления целой строки. ** + + В связи с частой необходимостью удаления целой строки, создатели Vi решили + для упрощения сделать возможным удаление строки набором двух d. 1. Переместите курсор вниз, ко второй строке фразы. + 2. Наберите dd для удаления строки. - 3. Теперь переместитесь к четвертой строке. - 4. Наберите 2dd (вспомните правило `число-команда-объект'), чтобы удалить - две строки. - 1) Летом я хожу на стадион, - 2) О, как внезапно кончился диван! - 3) Я болею за ``Зенит'', ``Зенит'' --- чемпион! - 4) Печально я гляжу на наше поколение! - 5) Его грядущее иль пусто иль темно... - 6) Я сижу на скамейке в ложе `Б' - 7) И играю на большой жестяной трубе. + 3. Теперь переместитесь к четвёртой строке. + + 4. Наберите 2dd для удаления двух строк. + +---> 1) Летом я хожу на стадион, +---> 2) О, как внезапно кончился диван! +---> 3) Я болею за ``Зенит'', ``Зенит'' --- чемпион! +---> 4) Печально я гляжу на наше поколение! +---> 5) Его грядущее иль пусто иль темно... +---> 6) Я сижу на скамейке в ложе `Б' +---> 7) И играю на большой жестяной трубе. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.5: КОМАНДА `ОТКАТ' + Урок 2.7: КОМАНДА `ОТМЕНА' - ** Нажмите u для отмены результата работы предыдущей команды, U для отмены - исправлений во всей строке. ** + ** Нажмите u для отмены результата работы предыдущей команды, U для отмены + исправлений во всей строке. ** - 1. Переместите курсор вниз, к строке, помеченной ---> и установите его на + 1. Переместите курсор вниз, к строке помеченной --->, и установите его на первую ошибку. - 2. Нажмите x для удаления первого неправильного символа. - 3. Теперь нажмите u для отмены (отката) последней выполненной команды. - 4. Исправьте все ошибки в строке, используя команду x . - 5. Теперь нажмите заглавную U для того, чтобы вернуть всю строку в исходное - состояние. - 6. Нажмите u несколько раз для отмены команды U и предыдущих команд. - 7. Нажмите теперь CTRL-R (удерживайте клавишу CTRL нажатой в момент нажатия - R) несколько раз для возврата команд (откат отката). ----> Испрравьте оошибки в этойй строке и вернитте их сс помощьью `отката'. + 2. Нажмите x для удаления первого неправильного символа. - 8. Это были очень полезные команды. Далее переходите к Резюме Урока 2. + 3. Теперь нажмите u для отмены (отката) последней выполненной команды. + + 4. Исправьте все ошибки в строке, используя команду x . + + 5. Теперь нажмите заглавную U для того, чтобы вернуть всю строку + в исходное состояние. + + 6. Нажмите u несколько раз для отмены команды U и предыдущих команд. + 7. Нажмите теперь CTRL-R (т.е. удерживайте клавишу CTRL нажатой в момент + нажатия клавиши R) несколько раз для возврата команд (откат отката). + +---> Испрравьте оошибки в этойй строке и вернитте их сс помощьью `отмены'. + + 8. Это были очень полезные команды. Далее переходите к Резюме Урока 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 2 + РЕЗЮМЕ УРОКА 2 + + 1. Для удаления текста от курсора до конца слова наберите: dw - 1. Для удаления текста от курсора до конца слова наберите: dw + 2. Для удаления текста от курсора до конца строки наберите: d$ - 2. Для удаления текста от курсора до конца строки наберите: d$ + 3. Для удаления всей строки наберите: dd - 3. Для удаления всей строки наберите: dd + 4. Для повтора перемещения введите количество перед командой: 2w - 4. Формат команды в обычном режиме имеет вид: + 5. Формат команды в обычном режиме имеет вид: [число] команда объект ИЛИ команда [число] объект где: - число - сколько раз повторить выполнение команды + [число] - сколько раз повторить выполнение команды, опционально команда - что выполнить, например d для удаления объект - на что должна воздействовать команда, например w (слово), $ (до конца строки), и т.д. - 5. Для отмены (отката) предшествующих действий наберите: u (строчная u) - Для отмены (отката) всех изменений в строке наберите: U (прописная U) + 6. Для перехода к началу строки используйте нуль: 0 + + 7. Для отмены (отката) предшествующих действий наберите: u (строчная u) + Для отмены (отката) всех изменений в строке наберите: U (прописная U) Для отмены отката наберите: CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.1: КОМАНДА ВСТАВКИ + Урок 3.1: КОМАНДА ВСТАВКИ - ** Наберите p для вставки последнего удаленного текста после курсора. ** + ** Наберите p для вставки последнего удалённого текста после курсора. ** - 1. Переместите курсор вниз к последней строке из набора. + 1. Переместите курсор вниз, к строке помеченной --->. - 2. Наберите dd для удаления строки и ее сохранения в буфере Vim'а. + 2. Наберите dd для удаления строки и её сохранения в буфере Vim'а. 3. Переместите курсор к строке НАД тем местом, куда следует вставить - удаленную строку. - - 4. Находясь в обычном режиме наберите p для замены строки. + удалённую строку. - 5. Повторите шаги 2--4, пока не расставите все строки в нужном порядке. + 4. Находясь в обычном режиме наберите p для вставки строки ниже курсора. - г) И лучше выдумать не мог. - б) Когда не в шутку занемог, - в) Он уважать себя заставил - а) Мой дядя самых честных правил + 5. Повторите шаги со 2 по 4, пока не расставите все строки в нужном порядке. +---> г) И лучше выдумать не мог. +---> б) Когда не в шутку занемог, +---> в) Он уважать себя заставил +---> а) Мой дядя самых честных правил ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.2: КОМАНДА ЗАМЕНЫ + Урок 3.2: КОМАНДА ЗАМЕНЫ - ** Наберите r и символ, заменяющий символ под курсором. ** + ** Наберите r и символ, заменяющий символ под курсором. ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. 2. Установите курсор так, чтобы он находился над первой ошибкой. - 3. Наберите r и затем символ, исправляющий ошибку. + 3. Наберите r и затем символ, исправляющий ошибку. - 4. Повторите шаги 2 и 3, пока первая строка не будет исправлена. + 4. Повторите шаги 2 и 3, пока первая строка не будет исправлена как вторая. ---> В момегт набтра этой чтроки кое0кто с трудом попвдал по клваишам! ---> В момент набора этой строки кое-кто с трудом попадал по клавишам! - 5. Теперь переходите к Уроку 3.2. - -ЗАМЕЧАНИЕ: Помните, что вы должны учиться в процессе работы, а не просто - запоминая. + 5. Теперь переходите к Уроку 3.3. +Замечание! Помните, что вы должны учиться в процессе работы, а не просто + запоминая. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.3: КОМАНДА ИЗМЕНЕНИЯ + Урок 3.3: КОМАНДА ИЗМЕНЕНИЯ - ** Для изменения части слова наберите cw . ** + ** Для изменения конечной части слова наберите ce . ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. 2. Расположите курсор над буквой `o' в слове `сола'. - 3. Наберите cw и исправьте слово (в данном случае, наберите `лов'.) + 3. Наберите ce и исправьте слово (в данном случае, наберите `лов'). 4. Нажмите <ESC> и переходите к следующей ошибке (к первому символу, который - надо изменить.) + надо изменить). - 5. Повторите шаги 3--4 пока первое предложение не станет идентичным второму. + 5. Повторите шаги 3 и 4 пока первое предложение не станет идентичным второму. ---> Несколько сола в эьгц строке тпгшцбь редалзкуюиесвх. ---> Несколько слов в этой строке требуют редактирования. -Обратите внимание, что cw не только заменяет слово, но и переводит вас в режим -вставки. - + Обратите внимание, что ce не только удаляет слово, но и переводит вас в + режим вставки. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.4: ПРОДОЛЖАЕМ ИЗМЕНЯТЬ С КОМАНДОЙ c + Урок 3.4: ПРОДОЛЖАЕМ ИЗМЕНЯТЬ С КОМАНДОЙ c -** Команда замены используется с теми же объектами, что и команда удаления. ** + ** Команда замены используется с теми же объектами, что и команда удаления. ** 1. Команда изменения применяется таким же образом, как и команда удаления. - Ее формат таков: + Её формат таков: - [число] c объект ИЛИ c [число] объект + [число] c объект ИЛИ c [число] объект 2. Объекты также совпадают: w (слово), $ (конец строки) и т.п. - 3. Переместите курсор вниз, к строке, помеченной --->. + 3. Переместите курсор вниз, к строке помеченной --->. 4. Перейдите к первой ошибке. - 5. Наберите c$ и отредактируйте первую строку так, чтобы она совпадала со + 5. Наберите c$ и отредактируйте первую строку так, чтобы она совпадала со второй, после чего нажмите <ESC>. ---> Конец этой строки нуждается в помощи, чтобы стать похожим на второй. ----> Конец этой строки нуждается в помощи команды c$ . +---> Конец этой строки нуждается в помощи команды c$ . +Замечание! Клавиша Backspace может использоваться для исправления при наборе. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 3 + РЕЗЮМЕ УРОКА 3 - 1. Для вставки текста, который только что был удален, наберите p . Эта - команда вставит удаленный текст ПОСЛЕ курсора (если была удалена строка, + 1. Для вставки текста, который только что был удалён, наберите p . Эта + команда вставит удалённый текст ПОСЛЕ курсора (если была удалена строка, то она будет помещена в строке под курсором). - 2. Для замены символа под курсором наберите r и затем заменяющий символ. + 2. Для замены символа под курсором наберите r и затем заменяющий символ. - 3. Команда изменения позволяет Вам изменить указанный объект от курсора до - конца этого объекта. Например, наберите cw для замены от курсора до - конца слова, c$ для изменения до конца строки. + 3. Команда изменения позволяет вам изменить указанный объект от курсора до + окончания перемещения. Например, наберите ce для замены от курсора до + конца слова, c$ для изменения до конца строки. 4. Формат команды изменения таков: - [число] c объект ИЛИ c [число] объект - -Теперь отправляйтесь к следующему уроку. - - - + [число] c объект ИЛИ c [число] объект +Теперь переходите к следующему уроку. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 4.1: ИНФОРМАЦИЯ О ФАЙЛЕ И РАСПОЛОЖЕНИЕ В НЕМ + Урок 4.1: ИНФОРМАЦИЯ О ФАЙЛЕ И РАСПОЛОЖЕНИИ В НЕМ - ** Наберите CTRL-g чтобы увидеть Ваше месторасположение в файле и информацию - о нем. - Наберите SHIFT-G для перемещения к заданной строке в файле. ** + ** Наберите CTRL-g чтобы увидеть ваше месторасположение в файле и + информацию о файле. Наберите G (SHIFT-G) для перемещения к заданной + строке в файле. ** - Замечание: Прочитайте весь урок прежде чем выполнять любые команды!! +Замечание! Прочитайте весь урок прежде чем выполнять любые команды! - 1. Удерживая клавишу Ctrl нажмите g . Внизу экрана появится строка статуса с - именем файла и номером строки, в которой Вы находитесь. Запомните номер + 1. Удерживая клавишу Ctrl нажмите g . Внизу экрана появится строка статуса + с именем файла и номером строки, в которой вы находитесь. Запомните номер строки, он потребуется на Шаге 3. - 2. Нажмите shift-G для перемещения к концу файла. - - 3. Наберите номер строки, в которой вы находились и затем shift-G. Это - вернет Вас к строке, в которой Вы были, когда в первый раз нажали Ctrl-g. - (Когда Вы будете набирать цифры, они НЕ отобразятся на экране.) + 2. Удерживая клавишу Shift нажмите g для перемещения к концу файла. - 4. Если Вы запомнили все вышесказанное, выполните шаги 1--3. + 3. Наберите номер строки, в которой вы находились и затем Shift-G. Это + вернёт вас к строке, в которой вы были, когда в первый раз нажали Ctrl-g. + 4. Если вы запомнили все вышесказанное, выполните шаги с 1 по 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 4.2: КОМАНДА ПОИСКА + Урок 4.2: КОМАНДА ПОИСКА - ** Наберите / и затем введите искомую фразу. ** + + ** Наберите / и затем введите искомую фразу. ** 1. В обычном режиме (Normal mode) наберите символ / . Обратите внимание, что он вместе с курсором появится внизу экрана, как это происходит с - командой : . + командой : . - 2. Теперь наберите 'ошшшибка' <ENTER>. Это то слово, которое Вы будете + 2. Теперь наберите 'ошшшибка' <ENTER>. Это то слово, которое вы будете искать. - 3. Для того, чтобы повторить поиск, просто нажмите n . - Для поиска этой фразы в обратном направлении, нажмите Shift-N . + 3. Для того, чтобы повторить поиск, просто нажмите n . + Для поиска этой же фразы в обратном направлении, нажмите Shift-N . + + 4. Если вы желаете сразу искать в обратном направлении, используйте + команду ? вместо / . - 4. Если Вы желаете сразу искать в обратном направлении, используйте - команду ? вместо / . + 5. Для того, чтобы вернуться туда, откуда вы начали поиск нажмите Ctrl-O. + (Удерживая нажатой клавишу Ctrl нажмите o ). Повторите несколько раз + для дальнейшего перехода. Для перехода вперёд используйте Ctrl-I . ----> Когда Вы при поиске достигнете конца файла, поиск будет продолжен с - начала. +---> "ошшшибка" это не способ написания слова `ошибка'; ошшшибка это ошибка. - "ошшшибка" это не способ произнесения слова `ошибка'; ошшшибка это ошибка. +Замечание! Если при поиске будет достигнут конц файла, то поиск будет продолжен + с начала. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 4.3: ПОИСК ПАРНЫХ СКОБОК - ** Наберите % для поиска парных ),] или } . ** + ** Наберите % для поиска парных ), ] или } . ** - 1. Поместите курсор над любой из (, [ или { в строке внизу, помеченной --->. + 1. Поместите курсор над любой из (, [ или { в строке ниже, помеченной --->. - 2. Теперь наберите символ % . + 2. Теперь наберите символ % . 3. Курсор должен перескочить на парную скобку. - 4. Наберите % для возврата курсора назад к первой скобке. + 4. Наберите % для возврата курсора назад к первой скобке. ---> Это ( строка, содержащая такие (, такие [ ] и такие { } скобки. )) -Замечание: Это очень удобно при отладке программ с пропущенными скобками! - - - - - +Замечание! Это очень удобно при отладке программ с пропущенными скобками! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 4.4: СПОСОБ ИСПРАВЛЕНИЯ ОШИБОК - ** Наберите :s/было/стало/g для замены 'было' на 'стало'. ** + ** Наберите :s/было/стало/g для замены 'было' на 'стало'. ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. - 2. Наберите :s/уводю/увожу <ENTER> . Обратите внимание на то, что эта команда - заменит только первое найденное вхождение в строке. + 2. Наберите :s/уводю/увожу <ENTER> . Обратите внимание на то, что эта + команда заменит только первое найденное вхождение в строке. - 3. Теперь наберите :s/уводю/увожу/g , означающее подстановку глобально во - всей строке. Это заменит все найденные в строке вхождения. + 3. Теперь наберите :s/уводю/увожу/g , добавленная в конце g означает + подстановку глобально во всей строке. Это заменит все найденные в строке + вхождения. ---> Я уводю к отверженным селеньям, я уводю сквозь вековечный стон, я уводю к забытым поколеньям. 4. Для замены всех вхождений последовательности символов между двумя строками, - наберите :#,#s/было/стало/g где #,# --- номера этих строк. - Наберите :%s/было/стало/g для замены всех вхождений во всем файле. - + наберите :#,#s/было/стало/g где #,# -- номера этих строк. + Наберите :%s/было/стало/g для замены всех вхождений во всем файле. + Наберите :%s/было/стало/gc для поиска всех вхождений во всем файле и + запроса подтверждения замены. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 4 - 1. Ctrl-g показывает ваше положение в файле и информацию о нем. - Shift-G перемещает Вас в конец файла. Номер, за которым следует Shift-G + РЕЗЮМЕ УРОКА 4 + + + 1. Ctrl-g показывает ваше положение в файле и информацию о нем. + Shift-G перемещает вас в конец файла. Номер, за которым следует Shift-G позволяет перейти к строке с этим номером. + gg перемещает вас к первой строке файла. - 2. Нажатие / и затем ввод строки позволяет произвести поиск этой строки - ВПЕРЕД по тексту. - Нажатие ? и затем ввод строки позволяет произвести поиск этой строки + 2. Нажатие / и затем ввод строки позволяет произвести поиск этой строки + ВПЕРЁД по тексту. + Нажатие ? и затем ввод строки позволяет произвести поиск этой строки НАЗАД по тексту. - После поиска наберите n для перехода к следующему вхождению искомой + После поиска наберите n для перехода к следующему вхождению искомой строки в том же направлении или Shift-N для перехода в противоположном направлении. - 3. Нажатие % , когда курсор находится на (,),[,],{, или } позволяет найти + 3. Нажатие % , когда курсор находится на (,),[,],{, или } позволяет найти парную скобку. 4. Для подстановки `стало' вместо первого `было' в строке, наберите - :s/old/new + :s/old/new Для подстановки `стало' вместо всех `было' в строке, наберите - :s/old/new/g + :s/old/new/g Для замены в интервале между двумя строками, наберите - :#,#s/old/new/g + :#,#s/old/new/g Для замены всех вхождений `было' на `стало' в файле, наберите - :%s/old/new/g + :%s/old/new/g Чтобы редактор каждый раз запрашивал подтверждение, добавьте 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 5.1: КАК ВЫПОЛНИТЬ ВНЕШНЮЮ КОМАНДУ + Урок 5.1: КАК ВЫПОЛНИТЬ ВНЕШНЮЮ КОМАНДУ - ** Наберите :! и затем внешнюю команду, которую следует выполнить. ** + ** Наберите :! и затем внешнюю команду, которую следует выполнить. ** - 1. Наберите уже знакомую Вам команду : для установки курсора в командную - строку редактора. Это позволит Вам ввести команду. + 1. Наберите уже знакомую вам команду : для установки курсора в командную + строку редактора. Это позволит вам ввести команду. - 2. Теперь наберите символ ! (восклицательный знак). Теперь можно исполнить + 2. Теперь наберите символ ! (восклицательный знак). Это позволит выполнить внешнюю команду, используя командную оболочку. - 3. Для примера наберите ls после ! и нажмите <ENTER>. Эта команда выведет - список файлов в текущем каталоге, точно также, как если бы Вы ввели эту - команду в приглашении оболочки. Или попробуйте :!dir , если предыдущая - команда не сработала. - ----> Замечание: Таким способом можно выполнить любую внешнюю команду. + 3. Для примера наберите ls после ! и нажмите <ENTER>. Команда выведет + список файлов в текущем каталоге, точно также, как если бы вы ввели эту + команду в приглашении оболочки. Или попробуйте :!dir , если команда ls + не сработала. ----> Замечание: Все команды, начинающиеся с : , должны завершаться нажатием - <ENTER>. +Замечание! Таким способом можно выполнить любую внешнюю команду с указанием + аргументов. +Замечание! Все команды, начинающиеся с : , должны завершаться нажатием + <ENTER>. Далее на это не всегда будет обращаться особое внимание. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 5.2: КАК ЗАПИСАТЬ ФАЙЛ -** Для сохранения изменений, произведенных в файле, наберите :w ИМЯ_ФАЙЛА. ** + ** Для сохранения изменений, произведённых в файле, + наберите :w ИМЯ_ФАЙЛА. ** - 1. Наберите :!dir или :!ls для получения списка файлов в текущем каталоге. - Как Вам уже известно, Вы должны нажать <ENTER> после ввода этих команд. + 1. Наберите :!dir или :!ls для получения списка файлов в текущем + каталоге. Как вам уже известно, после ввода команды надо нажать <ENTER>. - 2. Придумайте название для файла, которое еще не существует, например TEST. + 2. Придумайте название для файла, которое ещё не существует, например TEST. - 3. Теперь наберите :w TEST (где TEST --- это имя файла, придуманное Вами.) + 3. Теперь наберите :w TEST (где TEST -- это имя файла, придуманное вами.) - 4. Эта команда сохранит весь файл (Учебник по Vim) под именем TEST. Чтобы - удостовериться в этом, снова наберите :!dir и просмотрите каталог. + 4. Команда сохранит весь этот файл (Учебник по Vim) под именем TEST. Чтобы + удостовериться в этом, снова наберите :!dir или :!ls и просмотрите + каталог. ----> Заметьте, что если Вы выйдете из Vim и затем запустите его снова с - файлом TEST, этот файл будет точной копией учебника в тот момент, когда - Вы его сохранили. - - 5. Теперь удалите этот файл, набрав :!del TEST +Замечание! Если вы выйдете из Vim и затем запустите его снова с файлом TEST + (т.е. выполните vim TEST ), этот файл будет точной копией учебника + в тот момент, когда вы его сохранили. + 5. Теперь удалите этот файл, набрав для MS-DOS :!del TEST + для Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 5.3: ВЫБОРОЧНОЕ СОХРАНЕНИЕ - ** Для сохранения части файла, наберите :#,# w ИМЯ_ФАЙЛА ** - - 1. Еще раз наберите :!dir или :!ls для получения списка файлов в текущем - каталоге и выберите подходящее имя, например TEST. + ** Для сохранения части файла, наберите v выберите часть + и сохраните её :w ИМЯ_ФАЙЛА ** - 2. Переместите курсор к началу этой страницы и нажмите Ctrl-g для нахождения - номера строкиto. ЗАПОМНИТЕ ЭТОТ НОМЕР! + 1. Переместите курсор к этой строке. - 3. Теперь переместитесь в конец страницы и вновь наберите Ctrl-g. ЗАПОМНИТЕ - И ЭТОТ НОМЕР ТОЖЕ! + 2. Нажмите v и переместите курсор ниже к пятому шагу. Обратите внимание, + что текст подсвечен. - 4. Для сохранения ТОЛЬКО ЧАСТИ файла наберите :#,# w TEST , где #,# --- это - номера, которые Вы запомнили (начало, конец), а TEST --- имя вашего файла. + 3. Нажмите : и внизу экрана появится :'<,'> . - 5. Как и прежде, убедитесь в наличии этого файла командой :!dir , но НЕ - УДАЛЯЙТЕ его. + 4. Введите w TEST (где TEST -- имя файла, который ещё не существует). + До нажатия <ENTER>, проверьте что внизу экрана написано :'<,'>w TEST. + 5. Vim запишет выбранные строки в файл TEST. Как и прежде, убедитесь в + наличии этого файла командой :!dir или :!ls . НЕ УДАЛЯЙТЕ этот файл, он + потребуется в следующем уроке. +Замечание! Нажатие v начинает визуальный выбор. Вы можете перемещать курсор + для изменения выбора. Затем для выбранного фрагмента можно выполнить + какой-то оператор, например, удалить нажатием d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 5.4: ЧТЕНИЕ И ОБЪЕДИНЕНИЕ ФАЙЛОВ + Урок 5.4: ЧТЕНИЕ И ОБЪЕДИНЕНИЕ ФАЙЛОВ - ** Для вставки содержимого файла, наберите :r FILENAME ** - 1. Наберите :!dir для того, чтобы убедиться в том, что файл TEST все еще - существует. + ** Для вставки содержимого из файла, наберите :r ИМЯ_ФАЙЛА ** - 2. Установите курсор в верхней части этой страницы. + 1. Установите курсор над этой строкой. -Замечание: После выполнения шага 3 Вы увидите Урок 5.3. После этого - перемещайтесь ВНИЗ, снова к этому уроку. +Замечание! После выполнения Шага 2 вы увидите текст из Урока 5.3. Переместитесь + ВНИЗ по тексту до этого урока. - 3. Теперь прочитайте Ваш файл TEST, используя команду :r TEST , где - TEST --- это имя файла. + 2. Теперь прочитайте ваш файл TEST, используя команду :r TEST , где TEST -- + это имя файла. -Замечание: Прочитанный Вами файл будет вставлен в том месте, где находится - курсор. + 3. Для проверки что содержимое файла было вставлено, переместитесь по тексту + и удостоверьтесь, что теперь в нём две копии Урока 5.3: исходная и из + файла TEST. - 4. Чтобы убедиться в том, что файл прочитан, переместитесь немного назад по - тексту и заметьте, что теперь существуют две копии Урока 5.3, исходная - и полученная из файла. +Замечание! Вставить можно и вывод внешней команды. Например, :r !ls прочитает + вывод команды ls и вставит его ниже курсора. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 5 + РЕЗЮМЕ УРОКА 5 1. :!команда исполняет внешнюю команду. Некоторые полезные примеры: - :!dir --- выводит список файлов в каталоге. - :!del FILENAME --- удаляет файл FILENAME. + (MS-DOS) (Unix) + :!dir :!ls -- вывести список файлов в каталоге. + :!del ИМЯ :!rm ИМЯ -- удалить файл по имени. - 2. :w FILENAME записывает текущий редактируемый файл на диск - под именем FILENAME. + 2. :w ИМЯ_ФАЙЛА записывает текущий редактируемый в Vim файл на диск под + указанным именем. - 3. :#,#w FILENAME сохраняет строки от # до # в файл FILENAME. + 3. v перемещение :w ИМЯ_ФАЙЛА сохраняет визуально выбранные строки в файл + с указанным именем. - 4. :r FILENAME считывает с диска файл FILENAME и помещает его в текущий - файл следом за позицией курсора. + 4. :r ИМЯ_ФАЙЛА считывает с диска файл с указанным именем и помещает его + ниже курсора. + 5. :r !dir читает вывод команды dir и помещает его ниже курсора. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.1: КОМАНДА СОЗДАНИЯ + ** Наберите o чтобы создать пустую строку под курсором и перейти в режим + вставки (Insert mode) ** + 1. Переместите курсор вниз, к строке помеченной --->. + 2. Наберите o (в нижнем регистре) для того, чтобы создать пустую строку + НИЖЕ курсора и перейти в режим вставки (Insert mode). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.1: КОМАНДА СОЗДАНИЯ + 3. Теперь наберите какой-нибудь текст и нажмите <ESC> для выхода из режима + вставки. +---> После нажатия o курсор перейдёт на новую пустую строку в режиме вставки. - ** Наберите o чтобы создать пустую строку под курсором и перейти в режим - вставки (Insert mode) ** + 4. Для создания строки ВЫШЕ курсора, просто наберите заглавную O , вместо + строчной o . Попробуйте проделать это с нижеследующей строкой. - 1. Переместите курсор вниз, к строке, помеченной --->. +---> Создайте новую строку над этой, поместив на неё курсор и нажав Shift-O. - 2. Наберите o (в нижнем регистре) для того, чтобы создать пустую строку - НИЖЕ курсора и перейти в режим вставки (Insert mode). +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.2: КОМАНДА ДОБАВЛЕНИЯ + + + ** Наберите a , чтобы вставить текст ПОСЛЕ курсора. ** + + 1. Переместите курсор вниз, в начало первой строки помеченной --->. - 3. Теперь скопируйте помеченную ---> строку и нажмите <ESC> для выхода из - режима вставки. + 2. Набирайте e пока курсор не переместиться на конец cтро . ----> После нажатия o курсор перейдет на новую пустую строку в режиме вставки. + 3. Наберите a (в нижнем регистре) для добавления текста ПОСЛЕ символа, + находящегося под курсором. (Заглавная A позволяет добавить в конец + строки.) - 4. Для создания строки ВЫШЕ курсора, просто наберите заглавную O, вместо - строчной o. Попробуйте проделать это с нижеследующей строкой. -Создайте новую строку над этой, нажав Shift-O, поместив курсор на эту строку. + 4. Допишите слово так, как показано в строке ниже. Нажмите <ESC> для выхода + из режима вставки (Insert mode). + 5. Используйте e для перехода к концу следующего незавершённого слова и + повторите шаги 3 и 4. +---> Эта стро позволит вам попрактиков в добавле текста. +---> Эта строчка позволит вам попрактиковаться в добавлении текста. +Замечание! a , i и A переводят в один и тот же режим вставки, различие + только в том, где вставляются символы. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.2: КОМАНДА ДОБАВЛЕНИЯ + Урок 6.3: ЕЩЁ ОДИН СПОСОБ ЗАМЕНЫ - ** Наберите a , чтобы вставить текст ПОСЛЕ курсора. ** - 1. Переместите курсор вниз, в конец первой строки, помеченной ---> , - набрав $ в обычном режиме (Normal mode). + ** Наберите заглавную R для замены более чем одного символа. ** - 2. Наберите a (в нижнем регистре) для добавления текста ПОСЛЕ символа, - находящегося под курсором. (Заглавная A позволяет добавить в конец - строки.) + 1. Переместите курсор вниз, к первой строке помеченной --->, и в начало + первого слова xxx. -Замечание: Это позволяет избежать нажатия i , последнего символа, текста для - вставки, <ESC>, курсор-вправо, и, наконец, x , просто для того, - чтобы добавить тест в конец строки! + 2. Теперь нажмите R и введите число указанный ниже во второй строке чтобы + заменить xxx. - 3. Теперь завершите первую строку. Заметьте также, что добавление это в - точности то же самое, что и режим вставки, за исключением позиции, в - которую будет вставлен текст. + 3. Нажмите <ESC> для выхода из режима замены. Заметьте что остаток строки + не был изменён. ----> Эта строчка позволит Вам попрактиковаться ----> Эта строчка позволит Вам попрактиковаться в добавлении текста в конец - строки. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.3: ЕЩЕ ОДИН СПОСОБ ЗАМЕНЫ + 4. Повторите эти шаги для замены оставшихся xxx. +---> Добавление 123 к xxx даёт xxx. +---> Добавление 123 к 456 даёт 579. - ** Наберите заглавную R для замены более, чем одного символа. ** +Замечание! Режим замены похож на режим вставки, но каждый введённый символ + удаляет существующий. - 1. Переместите курсор вниз, к строке, помеченной --->. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.4: КОПИРОВАНИЕ И ВСТАВКА ТЕКСТА - 2. Расположите курсор в начале первого слова, отличающегося от - соответствующего в следующей строке, помеченной ---> (слово 'последней'). - 3. Теперь наберите R и замените остаток текста в первой строке, набрав - поверх старого текста так, чтобы обе строки стали одинаковыми. + ** Используйте команду y для копирования и p для вставки ** ----> Первую строку можно сравнять с последней, используя клавиши. ----> Первую строку можно сравнять с второй, используя R и набрав новый текст. + 1. Переместите курсор вниз, к первой строке помеченной --->, и после `а)'. - 4. Обратите внимание, что при нажатии <ESC> для завершения, любой - не измененный текст сохранится. + 2. Переключитесь в режим визуального выбора нажав v и переместите курсор + перед словом `первый'. + 3. Введите y для копирования подсвеченного текста. + 4. Переместите курсор в конец следующей строки комбинацией j$ . + 5. Нажмите p для вставки текста. Затем введите `второй' и нажмите <ESC>. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.4: УСТАНОВКА ПАРАМЕТРОВ +---> а) Этот элемент первый. + б) +Замечание! Также возможно использовать yw (команду y с оператором w ) для + копирования одного слова. -** Установим параметры так, чтобы игнорировать регистр при поиске или замене ** +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.5: УСТАНОВКА ПАРАМЕТРОВ - 1. Поищите слово 'игнорировать', набрав: - /игнорировать - Повторите поиск несколько раз, нажимая клавишу n + ** Установка параметра для игнорирования регистра при поиске или замене ** - 2. Включите параметр 'ic' (Игнорировать регистр), набрав: - :set ic + 1. Найдите слово `игнорировать', набрав: /игнорировать <ENTER>. + Повторите поиск несколько раз, нажимая клавишу n . - 3. Теперь снова сделайте поиск слова 'игнорировать', нажав: n - Повторите поиск несколько раз, нажимая клавишу n + 2. Установите параметр `ic' (игнорировать регистр), набрав: :set ic - 4. Включите параметры 'hlsearch' и 'incsearch': - :set hls is + 3. Теперь снова несколько раз сделайте поиск слова `игнорировать', + нажимая: n + Заметьте, что теперь находятся `Игнорировать' и `ИГНОРИРОВАТЬ'. - 5. Теперь опять введите команду поиска и посмотрите, что получится: - /игнорировать + 4. Установите параметры `hlsearch' и `incsearch': :set hls is + 5. Теперь опять введите команду поиска и посмотрите, что получится: + /игнорировать <ENTER> + 6. Для возвращения учёта регистра при поиске наберите: :set noic -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 6 +Замечание! Для отключения подсветки совпадений наберите: :nohlsearch +Замечание! Если вы хотите игнорировать регистр только для одного поиска, + используйте \с в команде поиска: /игнорировать\c <ENTER> - 1. Нажатие o создает строку НИЖЕ курсора и перемещает курсор в нее в режиме - вставки. - Нажатие заглавной O создает строку ВЫШЕ строки, в которой находится - курсор. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + РЕЗЮМЕ УРОКА 6 - 2. Наберите a для вставки текста ПОСЛЕ символа, на котором находится курсор. - Нажатие заглавной A автоматически перемещает Вас для добавления текста - в конец строки. - 3. Нажатие заглавной R переводит Вас в режим замены до тех пор, пока не - будет нажата клавиша <ESC> для завершения. + 1. Нажмите o для создания строки НИЖЕ курсора и перехода в режим вставки. + Нажмите O для создания строки ВЫШЕ курсора. - 4. Набрав ":set xxx" вы сможете включить параметр "xxx" + 2. Нажмите a для вставки текста ПОСЛЕ курсора. + Нажмите A для вставки текста в конец строки. + 3. Команда e подводит курсор к концу слова. + 4. Команда y копирует текст, p -- вставляет скопированный текст. + 5. Нажатие заглавной R переводит в режим замены до нажатия клавиши <ESC> . + 6. Наберите `:set xxx' для включения параметра `xxx', некоторые параметры: + `ic' `ignorecase' игнорирование регистра при поиске + `is' `incsearch' отображение частичных совпадений при поиске + `hls' `hlsearch' подсветка всех совпадений при поиске + 7. Добавьте `no' перед параметром для его отключения: :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 7: КОМАНДЫ ПОЛУЧЕНИЯ ВСТРОЕННОЙ СПРАВКИ + Урок 7.1: ВСТРОЕННАЯ СПРАВКА + - ** Используйте встроенную справочную систему ** + ** Используйте встроенную справочную систему ** Vim обладает мощной встроенной справочной системой. Для начала попробуйте - один из трех вариантов: + один из трёх вариантов: - нажмите клавишу <HELP> (если таковая имеется на клавиатуре) - нажмите клавишу <F1> (если таковая имеется на клавиатуре) - наберите :help <ENTER> + Прочитайте текст в окне справки для получения представления о том как + работает справка. + Нажмите CTRL-W CTRL-W для перехода от окна к окну. Наберите :q <ENTER> чтобы закрыть окно справки. - Вы можете найти справку для любого понятия или команды, просто задав - соответствующий аргумент команде ":help". Попробуйте следующее (не забудьте - нажать <ENTER>): + Вы можете найти справку для любого понятия или команды, задав соответствующий + аргумент команде `:help'. Попробуйте следующее (не забудьте нажать <ENTER>): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.2: СОЗДАНИЕ СТАРТОВОГО СЦЕНАРИЯ + - :help w - :help c_<T - :help insert-index + ** Включим возможности Vim ** + Vim имеет намного больше возможностей, чем Vi, но большинство из них по + умолчанию выключены. Для использования больших возможностей вам следует + создать файл `vimrc'. + 1. Отредактируйте новый файл `vimrc'. Его расположение зависит от + используемой системы: + :e ~/.vimrc для Unix + :e $VIM/_vimrc для MS-Windows + 2. Теперь прочитайте пример файла `vimrc': + :r $VIMRUNTIME/vimrc_example.vim + 3. Запишите созданный вами новый файл `vimrc': + :w + + Теперь при следующем запуске Vim будет включена подсветка синтаксиса. Все + настройки, предпочитаемые вами, могут быть добавлены в файл `vimrc'. + Для дальнейшей информации наберите :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 8: СОЗДАНИЕ СТАРТОВОГО СКРИПТА + Урок 7.3: ДОПОЛНЕНИЕ - ** Включим возможности Vim ** - Vim имеет намного больше возможностей, чем Vi, однако большинствао из них - выключены по умолчанию. Для того, чтобы начать использовать новые - возможности Вам следует создать файл "vimrc". + ** Командную строку можно дополнить нажав CTRL-D и <TAB> ** - 1. Отредактируйте файл "vimrc", его расположение зависит от используемой - системы: + 1. Удостоверьтесь, что Vim не в режиме совместимости: :set nocp - :edit ~/.vimrc для Unix - :edit $VIM/_vimrc для MS-Windows + 2. Посмотрите какие файлы есть в каталоге: :!ls или :!dir - 2. Теперь прочитайте пример файла "vimrc": + 3. Наберите начало команды: :e - :read $VIMRUNTIME/vimrc_example.vim + 4. Нажмите CTRL-D и Vim отобразит список команд начинающихся на `e'. - 3. Запишите файл: + 5. Нажмите <TAB> и Vim дополнит название команды до `:edit'. - :write + 6. Теперь добавьте пробел и начало существующего имени файла: :edit ФАЙ - Теперь при следующем запуске Vim будет включена подсветка синтаксиса. Все - настройки, предпочитаемые Вами, могут быть добавлены в файл "vimrc". + 7. Нажмите <TAB> и Vim дополнит имя файла, если оно уникальное. + +Замечание! Дополнение работает для многих команд. Попробуйте нажать CTRL-D и + <TAB>. Это особенно полезно для команды :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + РЕЗЮМЕ УРОКА 7 + + + 1. Наберите :help или нажмите <F1>, или <Help> для открытия окна справки. + + 2. Наберите :help cmd для поиска справки по команде. + + 3. Нажмите CTRL-W CTRL-W для перехода к другому окну. + + 4. Наберите :q для закрытия окна справки (если оно активно). + + 5. Для хранения ваших настроек создайте стартовый сценарий `vimrc'. + + 6. При наборе : команды, нажмите CTRL-D для отображения возможных + дополнений. Нажмите <TAB> для использования дополнения. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - На этом завершается Учебник Vim. Он был предназначен для того, чтобы дать - общее представление о редакторе Vim, достаточное для того, чтобы с легкостью - использовать его. Учебник далек от полноты, поскольку Vim имеет очень много - команд. Прочитайте теперь руководство пользователя: ":help user-manual". + + На этом завершается Учебник Vim. Он был предназначен дать общее представление + о редакторе Vim, достаточное для того, чтобы с лёгкостью использовать его. + Учебник далёк от полноты, поскольку Vim имеет очень много команд. Прочитайте + теперь руководство пользователя: `:help user-manual'. Для дальнейшего чтения рекомендуется книга: - Vim - Vi Improved - Автор: Steve Oualline - Издатель: New Riders - Эта книга полностью посвящена Vim. Особенно полезна новичкам. Содержит - множество примеров и иллюстраций. - Взгляните на See http://iccf-holland.org/click5.html + Vim - Vi Improved, автор: Steve Oualline, издатель: New Riders + + Эта книга полностью посвящена Vim. Особенно полезна она будет новичкам. + Содержит множество примеров и иллюстраций. + См. http://iccf-holland.org/click5.html Следующая книга более почтенного возраста и посвящена больше Vi, чем Vim, однако также рекомендуется: - Learning the Vi Editor - Автор: Linda Lamb - Издатель: O'Reilly & Associates Inc. - Это хорошая книга для того, чтобы узнать все, что только можно проделывать с - Vi. Шестое издание также включает информацию о Vim. + Learning the Vi Editor, автор: Linda Lamb, + издатель: O'Reilly & Associates Inc. + + Это хорошая книга, чтобы узнать всё, что только можно сделать в Vi. Шестое + издание также включает информацию о Vim. - Этот учебник был написан Michael C. Pierce и Robert K. Ware, Colorado School - of Mines с использованием идей, предложенных Charles Smith, Colorado State + Этот учебник написал Michael C. Pierce и Robert K. Ware, Colorado School of + Mines с использованием идей, которые предложил Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Доработано для Vim Bram Moolenaar. + Доработано для Vim Брамом Моленаром (Bram Moolenaar). + + Перевод: + Андрей Киселев <a_kissel@eudoramail.com>, 2002. + Сергей Алёшин <alyoshin.s@gmail.com>, 2014. + + Translators: + Andrey Kiselev <a_kissel@eudoramail.com>, 2002. + Sergey Alyoshin <alyoshin.s@gmail.com>, 2014. - Перевод: Андрей Киселев <a_kissel@eudoramail.com>, 2002. - Translator: Andrey Kiselev <a_kissel@eudoramail.com>, 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.sk b/runtime/tutor/tutor.sk index bae139837a..671bab91c9 100644 --- a/runtime/tutor/tutor.sk +++ b/runtime/tutor/tutor.sk @@ -18,7 +18,7 @@ pouvanm. To znamen, e je potrebn si prkazy vyska, aby bolo uenie sprvne. Ak len itas text, prkazy zabudne! - Presved sa, e Shift-Lock NIEJE stlaen a stlat klvesu + Presved sa, e Caps-Lock NIEJE stlaen a stlat klvesu j niekoko krt, aby sa kurzor posunul natoko, e lekcia 1.1 celkom zapln obrazovku. diff --git a/runtime/tutor/tutor.sk.cp1250 b/runtime/tutor/tutor.sk.cp1250 index c4e7b3d3ea..cc4675fcf0 100644 --- a/runtime/tutor/tutor.sk.cp1250 +++ b/runtime/tutor/tutor.sk.cp1250 @@ -18,7 +18,7 @@ pouvanm. To znamen, e je potrebn si prkazy vyska, aby bolo uenie sprvne. Ak len itas text, prkazy zabudne! - Presved sa, e Shift-Lock NIEJE stlaen a stlat klvesu + Presved sa, e Caps-Lock NIEJE stlaen a stlat klvesu j niekoko krt, aby sa kurzor posunul natoko, e lekcia 1.1 celkom zapln obrazovku. diff --git a/runtime/tutor/tutor.sk.utf-8 b/runtime/tutor/tutor.sk.utf-8 index 51c5b4f181..c62995dad5 100644 --- a/runtime/tutor/tutor.sk.utf-8 +++ b/runtime/tutor/tutor.sk.utf-8 @@ -18,7 +18,7 @@ používaním. To znamená, že je potrebné si príkazy vyskúšať, aby bolo učenie správne. Ak len čitas text, príkazy zabudneš! - Presvedč sa, že Shift-Lock NIEJE stlačený a stlačt klávesu + Presvedč sa, že Caps-Lock NIEJE stlačený a stlačt klávesu j niekoľko krát, aby sa kurzor posunul natoľko, že lekcia 1.1 celkom zaplní obrazovku. diff --git a/runtime/tutor/tutor.tr.iso9 b/runtime/tutor/tutor.tr.iso9 index 759e57d3e9..a0694101a8 100644 --- a/runtime/tutor/tutor.tr.iso9 +++ b/runtime/tutor/tutor.tr.iso9 @@ -18,7 +18,7 @@ anlama gelir; komutlar renmek iin doru bir ekilde altrmanz gerekir. Eer sadece yazlanlar okursanz komutlar unutursunuz. - imdi Shift-Lock tularnzn basl olmadna emin olun ve Ders 1.1'in + imdi Caps-Lock tularnzn basl olmadna emin olun ve Ders 1.1'in ekran tamamen doldurmas iin j tuuna yeterli miktarda basn. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ders 1.1: MLEC HAREKET ETTRMEK diff --git a/runtime/tutor/tutor.tr.utf-8 b/runtime/tutor/tutor.tr.utf-8 index 0e6802d405..e25c3f4640 100644 --- a/runtime/tutor/tutor.tr.utf-8 +++ b/runtime/tutor/tutor.tr.utf-8 @@ -18,7 +18,7 @@ anlama gelir; komutları öğrenmek için doğru bir şekilde çalıştırmanız gerekir. Eğer sadece yazılanları okursanız komutları unutursunuz. - Şimdi Shift-Lock tuşlarınızın basılı olmadığına emin olun ve Ders 1.1'in + Şimdi Caps-Lock tuşlarınızın basılı olmadığına emin olun ve Ders 1.1'in ekranı tamamen doldurması için j tuşuna yeterli miktarda basın. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ders 1.1: İMLECİ HAREKET ETTİRMEK diff --git a/runtime/tutor/tutor.uk.utf-8 b/runtime/tutor/tutor.uk.utf-8 new file mode 100644 index 0000000000..64982e9258 --- /dev/null +++ b/runtime/tutor/tutor.uk.utf-8 @@ -0,0 +1,976 @@ +=============================================================================== += Ласкаво простимо в уроки VIM = +=============================================================================== + + Vim дуже потужний редактор, що має багато команд. Всі команди неможливо + помістити в підручнику на зразок цього, але цих уроків достатньо, щоб + ви навчились з легкістю користуватись Vim як універсальним редактором. + + УВАГА: + Уроки цього підручника вимагають зміни тексту. Зробіть копію файлу, щоб + практикуватись на ньому. + + Важливо пам'ятати, що цей підручник має на меті навчання на практиці. + Це означає що ви маєте застосовувати команди щоб вивчити їх. Просто + прочитавши текст, ви забудете команди. + + Кнопки на клавіатурі, будемо позначати квадратними дужками: [кнопка]. + + А зараз переконайтесь, що включена англійська розкладка і не затиснутий + Caps Lock, і натисніть кнопку j щоб переміститись до першого уроку. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.1: ПЕРЕМІЩЕННЯ КУРСОРА + + + ** Щоб переміщати курсор використовуйте кнопки [h],[j],[k],[l], + як вказано на схемі: + ^ + [k] + <[h] [l]> + [j] + v + + Таке розміщення спочатку може видатись трохи дивним. Як наприклад те, що + кнопка [l] переміщує курсор вправо. Але клавіші розміщені так, щоб + мінімізувати кількість рухів. Найчастіша дія яку користувач робить з + текстовим файлом - це читає його. А при читанні прокручують текст вниз. + Тому вниз прокручує [j] - вона знаходиться якраз під вказівним пальцем + правої руки. + + Курсор можна переміщувати і класичним способом (курсорними клавішами), але + зручніше буде, якщо ви опануєте спосіб Vim. (Особливо якщо ви вже вмієте + набирати всліпу). + + 1. Попереміщуйте курсор по екрану, поки не призвичаїтесь. + + 2. Перемістіться до наступного уроку. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.2: Вихід з Vim + + +Увага! Перед тим як виконувати цей урок прочитайте його повністю. + + 1. Натисніть [ESC] (щоб впевнитись що ви в звичайному режимі). + + 2. Наберіть: :q! [ENTER]. + Це завершує роботу, відкидаючи всі зміни які ви здійснили. + + 3. Коли ви побачите привітання терміналу введіть команду яку ви використали + щоб відкрити цей підручник. Скоріш за все це було: vim tutor.txt [ENTER] + + 4. Якщо ви запам'ятали кроки з 1 по 3, виконайте їх, і переходьте до + наступного уроку. + +Зауваження: Команда :q! [ENTER] завершує роботу і відкидає всі зміни. Через + кілька уроків ви навчитесь зберігати зміни в файл. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.3:РЕДАГУВАННЯ ТЕКСТУ. ВИДАЛЕННЯ. + + + ** Натисніть [x] щоб видалити символ під курсором. ** + + 1. Перемістіть курсор до лінії нижче, яка позначена так: --->. + + 2. Щоб виправити помилки перемістіть курсор так, щоб він став над + символом який треба видалити. + + 3. Натисніть [x] щоб видалити непотрібний символ. + + 4. Повторіть кроки з другого по четвертий, поки речення не стане правильним. + +---> Ккоровва перрестрибнуууууула ччерезз мііісяццць. + + 5. Тепер, коли речення правильне, можна перейти до уроку 1.4. + +Зауваження: Протягом навчання не старайтесь запам'ятати все. + Вчіться практикою. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.4: РЕДАГУВАННЯ ТЕКСТУ. ВСТАВКА + + + ** Натисніть [i] щоб вставити текст. ** + + 1. Перемістіть курсор на перший рядок позначений: --->. + + 2. Перемістіть курсор на символ, ПІСЛЯ якого потрібно вставити текст. + + 3. Натисніть [i] і наберіть необхідні вставки. + + 4. Коли всі помилки виправлені натисніть [ESC] щоб повернутись в звичайний + режим. + +---> З прав текст. +---> З цього рядка пропав деякий текст. + + 5. Коли призвичаїтесь вставляти текст - переходьте до уроку 1.5. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.5: РЕДАГУВАННЯ ТЕКСТУ. ДОДАВАННЯ. + + + ** Натисніть [A] щоб додати текст. ** + +Увага! Тут і далі, коли мають наувазі клавішу з буквою в верхньому + регістрі, то це означає що її натискають з затиснутою [SHIFT]. + + 1. Перемістіть курсор до першої лінії внизу позначеної --->. + Не має значення над яким символом знаходиться курсор. + + 2. Натисніть [A] і введіть необхідне доповнення. + + 3. Коли додавання завершене натисніть [ESC] щоб повернутись в + звичайний режим. + + 4. Перемістіть курсор до другої лінії позначеної ---> і повторіть + кроки 2 і 3 щоб виправити речення. + +---> З цього рядка пропущ + З цього рядка пропущений текст. +---> З цього рядка також + З цього рядка також пропущений текст. + + 5. Після виконання вправ, переходьте до наступного уроку. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.6: РЕДАГУВАННЯ ФАЙЛУ + + ** Використайте :wq щоб зберегти файл і вийти.** + +Увага! Перед виконанням уроку прочитайте його повністю. + + 1. Вийдіть з цього підручника як ви робили в уроці 1.2: :q![ENTER] + Або якщо ви маєте доступ до іншого терміналу виконуйте наступні + дії в ньому. + + 2. В терміналі наберіть команду: vim НазваФайлу [ENTER] + 'vim' - команда для запуску редактора, НазваФайлу - файл який будемо + редагувати. Якщо ввести неіснуючий файл, то він створиться + + 3. Відредагуйте текст, як навчились у попередніх уроках. + + 4. Щоб зберегти зміни у файлі, і вийти з Vim наберіть: :wq [ENTER] + + 5. Якщо ви вийшли з підручника на першому кроці, то зайдіть в нього + знову і переходьте до підсумку. + + 6. Після прочитання і засвоєння попередніх кроків виконайте їх. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 1 + + + 1. Курсор керується курсорними клавішами, або клавішами [h][j][k][l] + [h] (вліво) [j] (вниз) [k] (вверх) [l] (вправо) + + 2. Щоб запустити Vim з терміналу наберіть: vim Назва файлу [ENTER] + + 3. Щоб вийти з Vim наберіть: [ESC] :q! [ENTER] щоб відкинути всі зміни. + або наберіть: [ESC] :wq [ENTER] щоб зберегти всі зміни. + + 4. Щоб видалити символ під курсором натисніть [x]. + + 5. Щоб вставити, чи доповнити текст наберіть: + [i] текст що вставляєтсья [ESC] вставиться перед курсором + [A] текст до додається [ESC] додасть текст до рядка + +Зауваження: Натискання [ESC] перенесе вас в звичайний режим, чи відмінить + не до кінця введену команду. + +Тепер переходьте до уроку 2. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.1: КОМАНДИ ВИДАЛЕННЯ + + + ** Введіть dw щоб видалити слово. ** + + 1. Натисніть [ESC], щоб переконатись що ви в звичайному режимі. + + 2. Перемістіть курсор до лінії нижче позначеної --->. + + 3. Перемістіть курсор до початку слова що має бути видалене. + + 4. Введіть dw щоб слово пропало. + + Зауваження: Буква d з'явиться в останньому рядку екрану, якщо ви її натиснули. + Vim чекає введення наступного символа. Якщо з'явилось щось інше + значить ви щось не так ввели. Натисніть [ESC] і почніть спочатку. + +---> Є деякі слова весело, які не потрібні папір в цьому реченні. + + 5. Повторюйте кроки 3 і 4 поки речення не стане правильне, а тоді переходьте + до уроку 2.2. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.2: БІЛЬШЕ КОМАНД ВИДАЛЕННЯ + + + ** Наберіть d$ щоб видалити символи від курсора до кінця рядка. ** + + 1. Натисніть [ESC] щоб переконатись що ви в звичайному режимі. + + 2. Перемістіть курсор до лінії нижче, що позначена --->. + + 3. Перемістіть курсор до кінця правильного рядка (ПІСЛЯ першої крапки). + + 4. Введіть d$ щоб видалити все до кінця рядка. + +---> Хтось надрукував кінець цього рядка двічі. кінець цього рядка двічі. + + + 5. Перейдіть до уроку 2.3 щоб розібратись в цьому детальніше. + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.3:ОПЕРАТОРИ І ПЕРЕМІЩЕННЯ + + + Багато команд що змінюють текст утворені з оператора і переміщення. + Формат команди видалення з оператором d подано нижче: + + d переміщення + + Де: + d - оператор видалення. + переміщення - з чим працює оператор (описано нижче). + + Короткий список переміщень: + w - до початку наступного слова, НЕ ВКЛЮЧАЮЧИ його перший символ. + e - до кінця поточного слова, ВКЛЮЧАЮЧИ останній символ. + $ - до кінця рядка, ВКЛЮЧАЮЧИ останній символ. + + Тому введення de видалить символи від курсора, до кінця слова. + +Зауваження: Натискання тільки переміщення в звичайному режимі відповідно + переміщує курсор. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.4: ВИКОРИСТАННЯ ЛІЧИЛЬНИКА ДЛЯ ПЕРЕМІЩЕННЯ + + + ** Введення числа перед переміщенням повторює його стільки раз. ** + + 1. Перемістіть курсор до початку рядка позначеного ---> + + 2. Введіть 2w щоб перемістити курсор на два слова вперед. + + 3. Введіть 3e щоб перемістити курсор в кінець третього слова. + + 4. Введіть 0 (нуль) щоб переміститись на початок рядка. + + 5. Повторіть кроки 2 і 3 з різними числами. + +---> А це просто рядок зі словами, серед яких можна рухати курсором. + + 6. Переходьте до уроку 2.5. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.5: БАГАТОРАЗОВЕ ВИДАЛЕННЯ + + + ** Введення числа з оператором повторює його стільки ж разів. ** + + В комбінації з оператором видалення, і переміщення з лічильника можна + видаляти потрібне число елементів. + Для цього введіть + d число переміщення + + 1. Перемістіться до першого слова в ВЕРХНЬОМУ РЕГІСТРІ в рядку + позначеному --->. + + 2. Введіть d2w щоб видалити два слова. + + 3. Повторіть кроки 1 і 2 з різними числами, щоб видалити все зайве. + +---> цей ABC DE рядок FGHI JK LMN OP слів Q RS TUV почищений. + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.6: ОПЕРАЦІЇ З РЯДКАМИ + + + ** Введіть dd щоб видалити весь рядок. ** + + Через те, що видалення всього рядка є доволі частою дією розробники Vi + вирішили що для цієї операції потрібна проста команда, як dd. + + 1. Перемістіть курсор до другого рядка в вірші нижче. + 2. Введіть dd щоб видалити рядок. + 3. Потім перемістіться до четвертого рядка. + 4. Введіть 2dd щоб видалити два рядки. + +---> 1) Троянди червоні, +---> 2) Багнюка весела, +---> 3) Волошки голубі, +---> 4) В мене є машина, +---> 5) Годинник каже час, +---> 6) Цукерки солодкі, +---> 7) Дарую тобі. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.7: ВІДКИНУТИ ЗМІНИ + + + ** Натисніть u щоб скасувати останні команди, U щоб виправити ввесь рядок. ** + + 1. Перемістіть курсор до рядка нижче позначеного ---> на місце першої помилки. + 2. Натисніть x щоб видалити непотрібний символ. + 3. Потім натисніть u щоб відмінити виправлення. + 4. Цього разу виправте всі помилки в рядку використовуючи команду x . + 5. Після цього введіть U, і відкиньте всі зміни в цілому рядку. + 6. Натисніть u кілька разів, щоб відмінити U і попередні команди. + 7. Тепер натисніть CTRL-R кілька разів, щоб повторити відмінені команди + (відмінити відміну). + +---> Вииправте помилки наа цьоому рядку і вііідмініть їх. + + 8. Тепер можна переходити до підсумків другого уроку. + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 2 + + + 1. Щоб видалити все від курсора аж до початку наступного слова введіть: dw + 2. Щоб видалити від курсора до кінця рядка: d$ + 3. Щоб видалити увесь рядок: dd + + 4. Щоб повторити переміщення, поставте перед ним число повторів: 2w + 5. Формат команди зміни: + оператор [число] переміщення + де: + оператор - що робити, як наприклад d для видалення + [число] - кількість повторів + переміщення - куди переміститись перед виконанням оператора, як + як наприклад w (слово), $ (кінець рядка), і т.і. + + 6. Щоб переміститись до початку рядка використовуйте нуль: 0 + + 7. Щоб відмінити попередню дію введіть: u (u в нижньому регістрі) + Щоб відмінити всі зміни рядка введіть: U (U в верхньому регістрі) + Щоб скасувати відміну натисніть: CTRL-R + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.1: КОМАНДА PUT + + + ** Введіть p щоб вставити перед тим видалений текст після курсору. ** + + 1. Перемістіть курсор до першої ---> лінії внизу. + + 2. Введіть dd щоб видалити рядок і зберегти його в регістрі Vim. + + 3. Перемістіть курсор до рядка в), НАД тим місцем де має бути видалений рядок. + + 4. Натисніть p щоб вставити рядок під курсором. + + 5. Повторіть кроки від 2 до 4 щоб вставити всі рядки в правильному порядку. + +---> г) всіх до кузні іззива. +---> б) а в коваля серце тепле, +---> в) а він клепче та й співа, +---> а) А в тій кузні коваль клепле, + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.2: Команда заміни + + + ** Наберіть rx щоб замінити символ під курсором на x . ** + + 1. Перемістіть курсор до першого рядка нижче, позначеного --->. + + 2. Помістіть курсор над першою помилкою. + + 3. Наберіть r а потім символ який має стояти там. + + 4. Повторіть кроки з 2 по 3 поки перший рядок не стане еквівалентним другому. + +---> Коли ця лігія набираламт. хтось наьтснкв геправмльні унопкм! +---> Коли ця лінія набиралась, хтось натиснув неправильні кнопки! + + 5. Зараз переходьте до уроку 3.3. + +Примітка: Ви маєте вчитись діями, а не простим заучуванням, пам'ятаєте? + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.3: ОПЕРАТОР ЗАМІНИ + + + ** Щоб зробити заміну до кінця слова введіть ce . ** + + 1. Перемістіть курсор до першого рядка позначеного --->. + + 2. Помістіть курсор над у в слові рукра. + + 3. Введіть ce і правильне закінчення слова (ядок в цьому випадку). + + 4. Натисніть [ESC] і переходьте до наступного символа, який потрібно замінити. + + 5. Повторюйте кроки 3 і 4 поки перше речення не стане таким самим як і друге. + +---> Цей рукра має кілька слів що потретамув заміни за допоцкщшг оператора. +---> Цей рядок має кілька слів що потребують заміни за допомогою оператора. + +Зауважте що ce видаляє слово, і поміщає вас в режим вставки. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 3.4: БІЛЬШЕ ЗМІН З c + + + ** Оператор заміни використовується з тими ж переміщеннями що і видалення. ** + + 1. Оператор заміни працює в такий же спосіб що і видалення. Формат: + + c [число] переміщення + + 2. Переміщення ті ж самі, такі як w (слово) і $ (кінець рядка). + + 3. Перемістіться до першого рядка позначеного --->. + + 4. Перемістіть курсор до першої помилки. + + 5. Наберіть c$ і решту рядка, щоб він став таким як другий і натисніть [ESC]. + +---> Кінець цього рядка потребує якихось дій щоб стати таким як кінець другого. +---> Кінець цього рядка можна виправити за допомогою команди c$. + +Примітка: Можна використовувати кнопку Backspace щоб виправляти опечатки при + наборі. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 3 + + + 1. Щоб вставити текст який був видалений наберіть p . Це вставляє + видалений текст ПІСЛЯ курсора (якщо був видалений рядок, вставка + продовжиться з рядка під курсором). + + 2. Щоб замінити символ під курсором наберіть r і необхідний символ. + + 3. Оператор заміни дозволяє робити заміну тексту від курсору, до потрібного + переміщення. Наприклад щоб замінити все від курсора до кінця слова + вводять ce . Щоб замінити закінчення рядка тиснуть c$ . + + 4. Формат заміни: + + c [число] переміщення + +Почнемо наступний урок. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.1: ПОЗИЦІЯ КУРСОРА І СТАТУС ФАЙЛУ + + ** Введіть CTRL-G щоб побачити вашу позицію в файлі, і його статус. + Введіть G щоб переміститись на потрібний рядок файлу. ** + + ПРИМІТКА: Прочитайте увесь урок перед виконанням будь-яких кроків!! + + 1. Затисніть кнопку Ctrl і натисніть g . Це називається CTRL-G. + Внизу з'явиться повідомлення з назвою файлу, і позицією в файлі. + Запам'ятайте номер рядка для кроку 3. + +ПРИМІТКА: Ви бачите позицію курсора в нижньому правому кутку екрану. + Це трапляється коли включена опція 'ruler' (читайте :help 'ruler' ) + + 2. Натисніть G щоб переміститись до кінця файлу. + Наберіть gg щоб переміститись до початку файлу. + + 3. Наберіть номер рядка де ви були а потім G. Це перенесе вас до потрібного + рядка. + + 4. Якщо ви запам'ятали три попередні кроки, то виконуйте. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.2: КОМАНДА ПОШУКУ + + + ** Введіть / (слеш) і фразу, щоб шукати її в тексті. ** + + 1. В звичайному режимі введіть символ / . Зауважте що він і курсор + з'являються в низу екрану, як і з командою : . + + 2. Тепер введіть 'очепятка' <ENTER>. Це буде словом яке ви шукатимете. + + 3. Щоб здійснити пошук цієї фрази ще раз введіть n . + Щоб шукати в протилежному напрямку введіть N . + + 4. Щоб шукати фразу в зворотньому напрямку використайте ? замість / . + + 5. Щоб переміститись назад до того місця звідки прийшли натисніть CTRL-O. + Повторіть щоб повернутись ще далі. (Це як кнопка назад в браузері) + CTRL-I переміщує вперед. + +---> "очепятка" не є способом написати опечатка; очепятка це опечатка. +Примітка: Коли пошук досягає кінця файлу він продовжує з початку, хіба що + опція 'wrapscan' була виключена. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.3: ПОШУК ПАРНИХ ДУЖОК + + + ** Введіть % щоб знайти парну ),], чи } . ** + + 1. Помістіть курсор над будь-якою (, [, чи { в рядку нижче позначеному --->. + + 2. Тепер введіть символ % . + + 3. Курсор переміститься до відповідної дужки. + + 4. Введіть % щоб перемістити курсор до іншої парної дужки. + + 5. Спробуйте з іншими дужками, і подивіться що вийде. + +---> Це ( тестовий рядок ( з такими [ такими ] і такими { дужками } в ньому. )) + + +Примітка: Це корисно при відлагоджуванні програми з неправильними дужками. + І взагалі в кожному тексті дужки мають стояти правильно! + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 4.4: КОМАНДА ЗАМІНИ + + + ** Наберіть :s/старе/нове/g щоб замінити 'старе' на 'нове'. ** + + 1. Перемістіть курсор до лінії нижче позначеної --->. + + 2. Введіть :s/(біп)/блять [ENTER] . Зауважте що ця команда змінює тільки перше + входження (біп) в рядку. + + 3. Потім наберіть :s/(біп)/блять/g . Додавання g вказує що заміни + робляться у всьому рядку глобально. + +---> люди не лю(біп), коли в слові "лю(біп)" "(біп)" заміняють на "(бiп)". + + 4. Щоб замінити кожне входження послідовності символів між двома рядками + наберіть :#,#s/старе/нове/g де #,# діапазон рядків в яких робиться + заміна. + Введіть :%s/старе/нове/g щоб змінити кожне входження у цілому файлі. + Введіть :%s/старе/нове/gc щоб замінити, кожне входження у файлі з + підтвердженням кожної заміни. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 4 + + + 1. CTRL-G виводить вашу позицію в файлі і назву файлу. + G переміщує в кінець файлу. + число G переміщує до рядка з вказаним номером. + gg переміщує до першого рядка. + + 2. Ввід / і послідовності символів шукає послідовність ПІСЛЯ курсора. + Ввід ? і послідовності символів шукає послідовність ПЕРЕД курсором. + + Після пошуку введіть n щоб знайти наступне входження в тому ж напрямку + або N щоб шукати в протилежному напрямку. + CTRL-O відносить вас до старішої позиції, CTRL-I до новішої позиції. + + 3. Ввід % коли курсор знаходиться над дужкою (,),[,],{, чи } переносить + курсор до протилежної дужки. + + 4. Щоб замінити перше входження старого слова на нове :s/старе/нове + Щоб замінити всі старі слова рядка на нові :s/старе/нове/g + Щоб замінити фрази між двома рядками :#,#s/старе/нове/g + Щоб замінити всі входження в файлі :%s/старе/нове/g + Щоб щоразу підтверджувати заміну додайте 'c' :%s/старе/нове/gc + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.1: ЯК ВИКОНАТИ ЗОВНІШНЮ КОМАНДУ + + + ** Введіть :! і зовнішню команду, щоб виконати ту команду. ** + + 1. Введіть відому команду : щоб встановити курсор в низу екрану. + Це дозволяє вводити команди командного рядка. + + 2. Тепер введіть ! (символ знаку оклику) . Це дозволить вам виконати + будь-яку зовнішню команду. + + 3. Як приклад введіть :!ls [ENTER]. Це покаже список файлів каталогу, так + так ніби ви знаходитесь в оболонці терміналу. Або використайте :!dir + якщо ви раптом знаходитесь в Windows. + +Примітка: Можна запускати будь-яку зовнішню команду таким способом, навіть з + аргументами. + +Примітка: Всі команди що починаються з : мають закінчуватись натисканням + [ENTER]. Більше на цьому не наголошуватиметься. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.2: ЩЕ ПРО ЗАПИС ФАЙЛІВ + + + ** Щоб зберегти змінений текст, введіть :w НАЗВА_ФАЙЛУ ** + + 1. Введіть :!dir чи :!ls щоб переглянути вміст вашої директорії. + Вам вже казали що після цього тиснуть [ENTER]. + + 2. Виберіть ім'я файлу яке ще не використовується, наприклад TEST. + (Взагалі то це не обов'язково, якщо вміст обраного файлу не + є цінним) + + 3. Тепер введіть: :w TEST (де TEST це назва яку ви обрали.) + + 4. Це зберігає увесь файл (підручник Vim ) під ім'ям TEST. + Щоб перевірити знову наберіть :!ls щоб побачити зміни в каталозі. + +Примітка: Якщо ви вийдете з Vim і запустите його знову командою vim TEST, + файл що ви відкриєте буде точною копією цього, коли ви його зберегли. + + 5. Зараз видаліть файл ввівши (Unix): :!rm TEST + чи (MS-DOS): :!del TEST + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.3: ВИБІР ТЕКСТУ ДЛЯ ЗАПИСУ + + + ** Щоб зберегти частину файлу, наберіть v переміщення :w НАЗВА_ФАЙЛУ ** + + 1. Перемістіть курсор до цього рядка. + + 2. Натисніть v і перемістіть курсор на п'ять пунктів нижче. Зауважте, що + текст виділяється. + + 3. Натисніть символ : . Внизу екрану з'являються символи :'<,'> . + + 4. Введіть w TEST , де TEST назва файлу що ще не використовується. + Переконайтесь що ви бачите :'<,'>w TEST перед тим як натиснути [ENTER]. + + 5. Vim запише вибрані рядки в файл TEST. Використайте :!dir чи !ls + щоб побачити це. Поки що не видаляйте його! Ми використаємо TEST в + наступному уроці. + +Зауваження: Натискання v починає режим візуального виділення. Ви можете + переміщувати курсор щоб змінити розмір вибраної частини. + Потім можна використати оператор щоб зробити щось з текстом. + Наприклад d видалить текст. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 5.4: ОТРИМАННЯ І ЗЛИТТЯ ФАЙЛІВ + + + ** Щоб вставити вміст файлу введіть :r НАЗВА_ФАЙЛУ ** + + 1. Помістіть курсор десь над цим рядком. + +Зауваження: Після виконання кроку 2 ви побачите текст з уроку 5.3. Тоді + перемістіться вниз, щоб побачити вміст цього уроку знову. + + 2. Тоді отримайте вміст вашого файлу TEST використавши команду :r TEST , + де TEST назва файлу що ви використали. + Файл що ви отримуєте поміщується під рядком курсора. + + 3. Щоб перевірити що файл вставлено, прокрутіть текст назад, і переконаєтесь + що тепер є дві копії урок 5.3, the original and the file version. + +Примітка: Також ви можете вставляти вивід зовнішньої програми. Наприклад + :r !ls читає вивід команди ls і вставляє його під курсором. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Підсумок 5 уроку + + + 1. :!команда виконує зовнішню команду. + + 2. :w НАЗВА_ФАЙЛУ записує поточний файл на диск під назвою НАЗВА_ФАЙЛУ. + + 3. v переміщення :w НАЗВА_ФАЙЛУ зберігає візуально виділену частину тексту + в файл НАЗВА_ФАЙЛУ. + + 4. :r НАЗВА_ФАЙЛУ отримує з диску файл НАЗВА_ФАЙЛУ і вставляє його під + курсором. + + 5. :r !ls читає вивід команди ls і вставляє її під поточною позицією курсора + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.1: КОМАНДА ВСТАВКИ + + + ** Введіть o щоб вставити новий рядок під курсором. ** + + 1. Перемістіть курсор на рядок нижче, позначений --->. + + 2. Натисніть o щоб вставити новий рядок ПІД курсором та перейти в + режим вставки. + + 3. Тепер введіть текст і натисніть [ESC] щоб вийти з режиму вставки. + +---> Після натискання o курсор ставиться на наступний рядок в режимі вставки. + + 4. Щоб вставити рядок НАД ABOVE курсором пишуть O в верхньому регістрі, + замість o. Спробуйте на рядку нижче. + +---> Щоб вставити рядок над цим введіть O . + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.2: КОМАНДА ДОПИСУВАННЯ + + + ** Натисніть a щоб вставити текст після курсору. ** + + 1. Перемістіть курсор до початку рядка внизу позначеного --->. + + 2. Тисніть e поки курсор не буде в кінці ря . + + 3. Натисніть a (маленьке) щоб додати текст ПІСЛЯ курсору. + + 4. Допишіть слова як рядок внизу. Натисніть [ESC] щоб вийти з режиму + вставки. + + 5. Використайте e щоб переміститись до наступного неповного слова та + to move to the next incomplete word and repeat steps 3 and 4. + +---> Цей ря дозволить вам попрактикува в дописува тексту до рядка. +---> Цей рядок дозволить вам попрактикуватись в дописуванні тексту до рядка. + +Примітка: a, i і A переходять в один і той же режим вставки, єдиною різницею + є тільки те, де вставляються символи. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.3: ІНШИЙ СПОСІБ ЗАМІНИ + + + ** Введіть велику R щоб замінити більш ніж один символ. ** + + 1. Перемістіть курсор до першого рядка внизу позначеного --->. + Перемістіть курсор до першого xxx . + + 2. Тепер натисніть R і введіть номер під ним з другого рядка, так що він + замінює xxx . + + 3. Натисніть [ESC] щоб покинути режим заміни. Зауважте, що решта рядка + залишається незмінною. + + 4. Повторіть кроки від 1 до 3 щоб замінити всі xxx на числа з другого рядка. + +---> Додавання 123 до xxx дає xxx. +---> Додавання 123 до 456 дає 579. + +Зауваження: Режим заміни подібний до режиму вставки, тільки кожен введений + символ видаляє символ який стояв на його місці. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.4: КОПІЮВАННЯ І ВСТАВКА + + + ** Використайте оператор y щоб копіювати текст і p щоб його вставити ** + + 1. Перейдіть до рядка нижче позначеного ---> і покладіть курсор після "а)". + + 2. Перейдіть в візуальний режим за допомогою клавіші v і перемістіть курсор + якраз перед словом "один". + + 3. Введіть y щоб копіювати (yank) виділений текст. + + 4. Перемістіть курсор до кінця наступного рядка: j$ + + 5. Натисніть p щоб вставити (put) текст. Тоді введіть : два [ESC] . + + 6. так само додайте третій рядочок. + +---> а) це рядок номер один + б) + + Зауваження: також можна використовувати y як оператор; + yw копіює одне слово. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.5: ВСТАНОВЛЕННЯ ОПЦІЙ + + + ** Встановити опцію так що пошук чи заміна буде ігнорувати регістр ** + + 1. Знайдіть слово 'ігнорувати' ввівши : /ігнорувати + Повторіть кілька разів натискаючи n . + + 2. Встановіть опцію ігнорування регістру 'ic' (Ignore case) ввівши: :set ic + + 3. Тепер пошукайте 'ігнорувати' знову ввівши n + Зауважте що Ігнорувати та ІГНОРУВАТИ тепер також знаходяться. + + 4. Ввімкніть 'hlsearch' (підсвітку пошуку) і 'incsearch' (інтерактивність) + командою :set hls is . + + 5. Тепер пошукайте щось знову і зауважте зміни: /ігнорувати [ENTER] + + 6. Щоб вимкнути ігнорування регістру напишіть: :set noic + +Примітка: Щоб вимкнути підсвітку співпадінь введіть: :nohlsearch +Примітка: Якщо ви хочете не брати до уваги регістр тільки під час одного пошуку + використайте ключ \c. Наприклад: /ігнорувати\c [ENTER] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 6 + + 1. Введіть о щоб додати рядок ПІД курсором і почати режим вставки. + Введіть O щоб додати рядок НАД курсором. + + 2. Введіть a щоб вставити текст ПІСЛЯ курсора. + Введіть A щоб додати текст до рядка. + + 3. Переміщення e переміщує нас до кінця слова. + + 4. Оператор y копіює текст, p вставляє його. + + 5. Введення R переносить нас в режим заміни до натискання [ESC]. + + 6. Набір ":set xxx" встановлює опцію "xxx". Деякі опції: + 'ic' 'ignorecase' ігнорувати верхній/нижній регістр при пошуку + 'is' 'incsearch' показувати співпадіння пошуку під час введення + фрази + 'hls' 'hlsearch' пісвічувати всі співпадіння + Можна одночасно використовувати і коротку і довгу форму запису опції. + + 7. Використайте префікс "no" щоб вимкнути опцію: :set noic + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.1: ОТРИМАННЯ ДОПОМОГИ + + + ** Використання вбудованої довідкової системи ** + + Vim має всеосяжну систему довідки. Щоб ознайомитись з нею спробуйте один з + таких способів: + - натисніть кнопку [HELP] (якщо така є) + - натисніть [F1] + - наберіть :help + + Прочитайте текст в вікні допомоги, щоб вияснити як вона працює. + Натисніть CTRL-W двічі щоб змінити вікно + Наберіть :q щоб закрити вікно довідки. + + Можна знайти довідку майже на будь-яку тему додаючи аргумент після команди + ":help" . Спробуйте одну з наступних (не забувайте натискати [ENTER]): + + :help w + :help c_CTRL-D + :help insert-index + :help user-manual +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.2: СТВОРЕННЯ СКРИПТА АВТОЗАПУСКУ + + + ** Ввімкнення додаткових функцій Vim ** + + Vim має набагато більше функцій ніж Vi, але більшість з них відключені за + замовчуванням. Щоб почати використання додаткових функцій потрібно створити + файл "vimrc". + + 1. Почніть редагування файлу "vimrc" . Це залежить від вашої системи: + :e ~/.vimrc для Unix + :e $VIM/_vimrc для MS-Windows + + 2. Тепер прочитайте приклад вмісту "vimrc" : + :r $VIMRUNTIME/vimrc_example.vim + + 3. Збережіть файл: + :w + + Наступного разу коли ви запустите Vim він буде використовувати підсвітку + синтаксису. Можна додати всі ваші улюблені налаштування в цей файл. Для більш + детальної інформації введіть :help vimrc-intro + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 7.3: АВТОДОПОВНЕННЯ + + + ** Автодоповнення за допомогою CTRL-D і [TAB] ** + + 1. Переконайтесь що в Vim не включена зворотня сумісність: :set nocp + + 2. Подивіться що за файли існують в каталозі: :!ls чи :!dir + + 3. Введіть початок команди: :e + + 4. Натисніть CTRL-D і Vim покаже список команд що починаються з "e". + + 5. Натисніть [TAB] і Vim доповнить команду до ":edit". + + 6. Тепер додайте пропуск і початок існуючого імені файлу: :edit FIL + + 7. Натисніть [TAB]. Vim доповнить ім'я (якщо воно унікальне). + +Зауваження: Доповнення працює для багатьох команд. Просто натискайте CTRL-D і + [TAB]. Це особливо корисно для команди :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ПІДСУМОК УРОКУ 7 + + + 1. Введіть :help або натисніть [F1] щоб відкрити вікно довідки. + + 2. Введіть :help тема щоб знайти довідку про тему . + + 3. Введіть CTRL-W CTRL-W щоб змінити вікно. + + 4. Наберіть :q щоб закрити вікно + + 5. Створіть скрипт vimrc щоб змінювати ваші налаштування при запуску. + + 6. При наборі команди що починається з двокрапки : натисніть CTRL-D + щоб побачити можливі доповнення. Натисніть [TAB] щоб побачити одне з + доповнень. + + + + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Це завершує уроки Vim . Вони були націлені щоб дати вам короткий вступ в + редактор Vim, достатній для того щоб використовувати редактор комфортно. + Ці уроки зовсім далеко від повних, бо Vim має набагато більше команд. Можна + прочитати інструкцію користувача : ":help user-manual". + + Для подальшого читання і вивчення рекомендується така книжка: + Vim - Vi Improved - by Steve Oualline + Publisher: New Riders + Особливо корисна для початківців. + Там багато прикладів і ілюстрацій. + Дивіться http://iccf-holland.org/click5.html + + Ці уроки були написані Майклом С. Пірсом та Робертом Уаром. + + Модифіковано для Vim Бремом Муленаром. + + + Переклад на українську Буник Т. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.utf-8 b/runtime/tutor/tutor.utf-8 index da28a15313..a6f95211e0 100644 --- a/runtime/tutor/tutor.utf-8 +++ b/runtime/tutor/tutor.utf-8 @@ -18,7 +18,7 @@ use. That means that you need to execute the commands to learn them properly. If you only read the text, you will forget the commands! - Now, make sure that your Shift-Lock key is NOT depressed and press + Now, make sure that your Caps-Lock key is NOT depressed and press the j key enough times to move the cursor so that Lesson 1.1 completely fills the screen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -55,8 +55,8 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to 2. Type: :q! <ENTER>. This exits the editor, DISCARDING any changes you have made. - 3. When you see the shell prompt, type the command that got you into this - tutor. That would be: vimtutor <ENTER> + 3. Get back here by executing the command that got you into this tutor. That + might be: vimtutor <ENTER> 4. If you have these steps memorized and are confident, execute steps 1 through 3 to exit and re-enter the editor. diff --git a/runtime/tutor/tutor.vim b/runtime/tutor/tutor.vim index c319e009d4..f8a54965ea 100644 --- a/runtime/tutor/tutor.vim +++ b/runtime/tutor/tutor.vim @@ -1,12 +1,12 @@ " Vim tutor support file " Author: Eduardo F. Amatria <eferna1@platea.pntic.mec.es> " Maintainer: Bram Moolenaar -" Last Change: 2014 Jun 25 +" Last Change: 2018 Apr 11 " This Vim script is used for detecting if a translation of the " tutor file exist, i.e., a tutor.xx file, where xx is the language. " If the translation does not exist, or no extension is given, -" it defaults to the english version. +" it defaults to the English version. " It is invoked by the vimtutor shell script. @@ -42,6 +42,8 @@ else let s:ext = ".cs" elseif s:lang =~ "Dutch" let s:ext = ".nl" + elseif s:lang =~ "Bulgarian" + let s:ext = ".bg" else let s:ext = "." . strpart(s:lang, 0, 2) endif diff --git a/runtime/tutor/tutor.zh.big5 b/runtime/tutor/tutor.zh.big5 index 4daad64703..9da8b1a352 100644 --- a/runtime/tutor/tutor.zh.big5 +++ b/runtime/tutor/tutor.zh.big5 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. P xuandong@sh163.net ANBOrץC 2002~0318 <linuxrat@gnuchina.org> - ھBram Molenaarͦb2002~0316骺ӫHnDANvimtutor1.4Ķ + ھBram Moolenaarͦb2002~0316骺ӫHnDANvimtutor1.4Ķ ɯŨvimtutor1.5C 2001~1115 <linuxrat@gnuchina.org> - Nvimtutor1.4Ķ浹Bram MolenaarMSven GuckesC + Nvimtutor1.4Ķ浹Bram MoolenaarMSven GuckesC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh.euc b/runtime/tutor/tutor.zh.euc index df59c32089..50852f8105 100644 --- a/runtime/tutor/tutor.zh.euc +++ b/runtime/tutor/tutor.zh.euc @@ -988,9 +988,9 @@ л xuandong@sh163.net ָ 20020318 ̩ <linuxrat@gnuchina.org> - Bram Molenaar20020316յҪ󣬽vimtutor1.4 + Bram Moolenaar20020316յҪ󣬽vimtutor1.4 vimtutor1.5 20011115 ̩ <linuxrat@gnuchina.org> - vimtutor1.4ύBram MolenaarSven Guckes + vimtutor1.4ύBram MoolenaarSven Guckes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh.utf-8 b/runtime/tutor/tutor.zh.utf-8 index 21d702051d..d1fabc236d 100644 --- a/runtime/tutor/tutor.zh.utf-8 +++ b/runtime/tutor/tutor.zh.utf-8 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. 感謝 xuandong@sh163.net 的指正,將兩處錯別字修正。 2002年03月18日 梁昌泰 <linuxrat@gnuchina.org> - 根據Bram Molenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 + 根據Bram Moolenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 版升級到vimtutor1.5。 2001年11月15日 梁昌泰 <linuxrat@gnuchina.org> - 將vimtutor1.4中譯版提交給Bram Molenaar和Sven Guckes。 + 將vimtutor1.4中譯版提交給Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh_cn.utf-8 b/runtime/tutor/tutor.zh_cn.utf-8 index 3ff031f7c5..d986ab2645 100644 --- a/runtime/tutor/tutor.zh_cn.utf-8 +++ b/runtime/tutor/tutor.zh_cn.utf-8 @@ -988,9 +988,9 @@ 感谢 xuandong@sh163.net 的指正,将两处错别字修正。 2002年03月18日 梁昌泰 <linuxrat@gnuchina.org> - 根据Bram Molenaar先生在2002年03月16日的来信要求,将vimtutor1.4中译 + 根据Bram Moolenaar先生在2002年03月16日的来信要求,将vimtutor1.4中译 版升级到vimtutor1.5。 2001年11月15日 梁昌泰 <linuxrat@gnuchina.org> - 将vimtutor1.4中译版提交给Bram Molenaar和Sven Guckes。 + 将vimtutor1.4中译版提交给Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh_tw.utf-8 b/runtime/tutor/tutor.zh_tw.utf-8 index 21d702051d..d1fabc236d 100644 --- a/runtime/tutor/tutor.zh_tw.utf-8 +++ b/runtime/tutor/tutor.zh_tw.utf-8 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. 感謝 xuandong@sh163.net 的指正,將兩處錯別字修正。 2002年03月18日 梁昌泰 <linuxrat@gnuchina.org> - 根據Bram Molenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 + 根據Bram Moolenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 版升級到vimtutor1.5。 2001年11月15日 梁昌泰 <linuxrat@gnuchina.org> - 將vimtutor1.4中譯版提交給Bram Molenaar和Sven Guckes。 + 將vimtutor1.4中譯版提交給Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/vim.desktop b/runtime/vim.desktop new file mode 100644 index 0000000000..d4ab844e76 --- /dev/null +++ b/runtime/vim.desktop @@ -0,0 +1,81 @@ +[Desktop Entry] +Name=Vim +GenericName=Text Editor +GenericName[de]=Texteditor +Comment=Edit text files +Comment[af]=Redigeer tekslêers +Comment[am]=የጽሑፍ ፋይሎች ያስተካክሉ +Comment[ar]=حرّر ملفات نصية +Comment[az]=Mətn fayllarını redaktə edin +Comment[be]=Рэдагаваньне тэкставых файлаў +Comment[bg]=Редактиране на текстови файлове +Comment[bn]=টেক্স্ট ফাইল এডিট করুন +Comment[bs]=Izmijeni tekstualne datoteke +Comment[ca]=Edita fitxers de text +Comment[cs]=Úprava textových souborů +Comment[cy]=Golygu ffeiliau testun +Comment[da]=Redigér tekstfiler +Comment[de]=Textdateien bearbeiten +Comment[el]=Επεξεργασία αρχείων κειμένου +Comment[en_CA]=Edit text files +Comment[en_GB]=Edit text files +Comment[es]=Edita archivos de texto +Comment[et]=Redigeeri tekstifaile +Comment[eu]=Editatu testu-fitxategiak +Comment[fa]=ویرایش پرونده‌های متنی +Comment[fi]=Muokkaa tekstitiedostoja +Comment[fr]=Édite des fichiers texte +Comment[ga]=Eagar comhad Téacs +Comment[gu]=લખાણ ફાઇલોમાં ફેરફાર કરો +Comment[he]=ערוך קבצי טקסט +Comment[hi]=पाठ फ़ाइलें संपादित करें +Comment[hr]=Uređivanje tekstualne datoteke +Comment[hu]=Szövegfájlok szerkesztése +Comment[id]=Edit file teks +Comment[it]=Modifica file di testo +Comment[ja]=テキストファイルを編集します +Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು +Comment[ko]=텍스트 파일을 편집합니다 +Comment[lt]=Redaguoti tekstines bylas +Comment[lv]=Rediģēt teksta failus +Comment[mk]=Уреди текстуални фајлови +Comment[ml]=വാചക രചനകള് തിരുത്തുക +Comment[mn]=Текст файл боловсруулах +Comment[mr]=गद्य फाइल संपादित करा +Comment[ms]=Edit fail teks +Comment[nb]=Rediger tekstfiler +Comment[ne]=पाठ फाइललाई संशोधन गर्नुहोस् +Comment[nl]=Tekstbestanden bewerken +Comment[nn]=Rediger tekstfiler +Comment[no]=Rediger tekstfiler +Comment[or]=ପାଠ୍ଯ ଫାଇଲଗୁଡ଼ିକୁ ସମ୍ପାଦନ କରନ୍ତୁ +Comment[pa]=ਪਾਠ ਫਾਇਲਾਂ ਸੰਪਾਦਨ +Comment[pl]=Edytor plików tekstowych +Comment[pt]=Editar ficheiros de texto +Comment[pt_BR]=Edite arquivos de texto +Comment[ro]=Editare fişiere text +Comment[ru]=Редактор текстовых файлов +Comment[sk]=Úprava textových súborov +Comment[sl]=Urejanje datotek z besedili +Comment[sq]=Përpuno files teksti +Comment[sr]=Измени текстуалне датотеке +Comment[sr@Latn]=Izmeni tekstualne datoteke +Comment[sv]=Redigera textfiler +Comment[ta]=உரை கோப்புகளை தொகுக்கவும் +Comment[th]=แก้ไขแฟ้มข้อความ +Comment[tk]=Metin faýllary editle +Comment[tr]=Metin dosyalarını düzenle +Comment[uk]=Редактор текстових файлів +Comment[vi]=Soạn thảo tập tin văn bản +Comment[wa]=Asspougnî des fitchîs tecses +Comment[zh_CN]=编辑文本文件 +Comment[zh_TW]=編輯文字檔 +TryExec=vim +Exec=vim %F +Terminal=true +Type=Application +Keywords=Text;editor; +Icon=gvim +Categories=Utility;TextEditor; +StartupNotify=false +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index 27a5cfc222..bdafda8faa 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -1,7 +1,7 @@ " An example for a vimrc file. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2014 Feb 05 +" Last change: 2016 Jul 28 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc @@ -14,71 +14,33 @@ if v:progname =~? "evim" finish endif -" Use Vim settings, rather than Vi settings (much better!). -" This must be first, because it changes other options as a side effect. -set nocompatible - -" allow backspacing over everything in insert mode -set backspace=indent,eol,start +" Get the defaults that most users want. +source $VIMRUNTIME/defaults.vim if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file (restore to previous version) - set undofile " keep an undo file (undo changes after closing) -endif -set history=50 " keep 50 lines of command line history -set ruler " show the cursor position all the time -set showcmd " display incomplete commands -set incsearch " do incremental searching - -" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries -" let &guioptions = substitute(&guioptions, "t", "", "g") - -" Don't use Ex mode, use Q for formatting -map Q gq - -" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, -" so that you can undo CTRL-U after inserting a line break. -inoremap <C-U> <C-G>u<C-U> - -" In many terminal emulators the mouse works just fine, thus enable it. -if has('mouse') - set mouse=a + if has('persistent_undo') + set undofile " keep an undo file (undo changes after closing) + endif endif -" Switch syntax highlighting on, when the terminal has colors -" Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") - syntax on + " Switch on highlighting the last used search pattern. set hlsearch endif " Only do this part when compiled with support for autocommands. if has("autocmd") - " Enable file type detection. - " Use the default filetype settings, so that mail gets 'tw' set to 72, - " 'cindent' is on in C files, etc. - " Also load indent files, to automatically do language-dependent indenting. - filetype plugin indent on - " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! - " For all text files set 'textwidth' to 78 characters. - autocmd FileType text setlocal textwidth=78 - - " When editing a file, always jump to the last known cursor position. - " Don't do it when the position is invalid or when inside an event handler - " (happens when dropping a file on gvim). - " Also don't do it when the mark is in the first line, that is the default - " position when opening a file. - autocmd BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif + " +kaoriya: disabled, it is hard to repressed. + "" For all text files set 'textwidth' to 78 characters. + "autocmd FileType text setlocal textwidth=78 augroup END @@ -88,10 +50,11 @@ else endif " has("autocmd") -" Convenient command to see the difference between the current buffer and the -" file it was loaded from, thus the changes you made. -" Only define it when not defined already. -if !exists(":DiffOrig") - command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis - \ | wincmd p | diffthis -endif +" Add optional packages. +" +" +kaoriya: disabled, it is hard to repressed. +"" The matchit plugin makes the % command work better, but it is not backwards +"" compatible. +"if has('syntax') && has('eval') +" packadd matchit +"endif diff --git a/src/GvimExt/GvimExt.reg b/src/GvimExt/GvimExt.reg index 4c67b0928b..2b8ebf08b8 100644 --- a/src/GvimExt/GvimExt.reg +++ b/src/GvimExt/GvimExt.reg @@ -15,6 +15,6 @@ REGEDIT4 [HKEY_LOCAL_MACHINE\Software\Vim\Gvim] "path"="gvim.exe" -[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.4] - "DisplayName"="Vim 7.4: Edit with Vim popup menu entry" +[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 8.1] + "DisplayName"="Vim 8.1: Edit with Vim popup menu entry" "UninstallString"="uninstal.exe" diff --git a/src/GvimExt/Make_cyg.mak b/src/GvimExt/Make_cyg.mak deleted file mode 100644 index a638688b7a..0000000000 --- a/src/GvimExt/Make_cyg.mak +++ /dev/null @@ -1,77 +0,0 @@ -# Project: gvimext -# Generates gvimext.dll with gcc. -# To be used with Cygwin. -# -# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 -# Now it is allocated dymanically by the linker by evaluating all DLLs -# already loaded in memory. The binary image contains as well information -# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29 - -# If cross-compiling set this to yes, else set it to no -CROSS = no -#CROSS = yes -# For the old MinGW 2.95 (the one you get e.g. with debian woody) -# set the following variable to yes and check if the executables are -# really named that way. -# If you have a newer MinGW or you are using cygwin set it to no and -# check also the executables -MINGWOLD = no - -# Link against the shared versions of libgcc/libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static versions instead. -STATIC_STDCPLUS=no -#STATIC_STDCPLUS=yes - -# Note: -static-libstdc++ is not available until gcc 4.5.x. -LDFLAGS += -shared -ifeq (yes, $(STATIC_STDCPLUS)) -LDFLAGS += -static-libgcc -static-libstdc++ -endif - -ifeq ($(CROSS),yes) -DEL = rm -ifeq ($(MINGWOLD),yes) -CXXFLAGS := -O2 -fvtable-thunks -else -CXXFLAGS := -O2 -endif -else -CXXFLAGS := -O2 -ifneq (sh.exe, $(SHELL)) -DEL = rm -else -DEL = del -endif -endif -CXX := $(CROSS_COMPILE)g++ -WINDRES := $(CROSS_COMPILE)windres -WINDRES_CXX = $(CXX) -WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED -LIBS := -luuid -RES := gvimext.res -DEFFILE = gvimext_ming.def -OBJ := gvimext.o - -DLL := gvimext.dll - -.PHONY: all all-before all-after clean clean-custom - -all: all-before $(DLL) all-after - -$(DLL): $(OBJ) $(RES) $(DEFFILE) - $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \ - -Wl,--enable-auto-image-base \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive \ - $^ \ - -Wl,--no-whole-archive \ - $(LIBS) - -gvimext.o: gvimext.cpp - $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@ - -$(RES): gvimext_ming.rc - $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@ - -clean: clean-custom - -$(DEL) $(OBJ) $(RES) $(DLL) diff --git a/src/GvimExt/Make_ming.mak b/src/GvimExt/Make_ming.mak index 9c383b0b1f..a6ab3ae10e 100644 --- a/src/GvimExt/Make_ming.mak +++ b/src/GvimExt/Make_ming.mak @@ -1,6 +1,6 @@ # Project: gvimext # Generates gvimext.dll with gcc. -# To be used with MingW. +# To be used with MingW and Cygwin. # # Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 # Now it is allocated dymanically by the linker by evaluating all DLLs @@ -43,11 +43,15 @@ else DEL = del endif endif +# Set the default $(WINVER) to make it work with WinXP. +ifndef WINVER +WINVER = 0x0501 +endif CXX := $(CROSS_COMPILE)g++ WINDRES := $(CROSS_COMPILE)windres WINDRES_CXX = $(CXX) WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED -LIBS := -luuid +LIBS := -luuid -lgdi32 RES := gvimext.res DEFFILE = gvimext_ming.def OBJ := gvimext.o @@ -68,7 +72,7 @@ $(DLL): $(OBJ) $(RES) $(DEFFILE) $(LIBS) gvimext.o: gvimext.cpp - $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@ + $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@ $(RES): gvimext_ming.rc $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@ diff --git a/src/GvimExt/Makefile b/src/GvimExt/Makefile index 5c598c1a29..27ff953e23 100644 --- a/src/GvimExt/Makefile +++ b/src/GvimExt/Makefile @@ -1,42 +1,80 @@ # Makefile for GvimExt, using MSVC # Options: # DEBUG=yes Build debug version (for VC7 and maybe later) +# CPUARG= /arch:IA32/AVX/etc, call from main makefile to set +# automatically from CPUNR # -TARGETOS=BOTH -APPVER=4.0 +TARGETOS = WINNT + +!ifndef APPVER +APPVER = 5.01 +!endif !if "$(DEBUG)" != "yes" NODEBUG = 1 !endif +!ifdef PROCESSOR_ARCHITECTURE +# On Windows NT +! ifndef CPU +CPU = i386 +! if !defined(PLATFORM) && defined(TARGET_CPU) +PLATFORM = $(TARGET_CPU) +! endif +! ifdef PLATFORM +! if ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") +CPU = AMD64 +! elseif ("$(PLATFORM)" != "x86") && ("$(PLATFORM)" != "X86") +! error *** ERROR Unknown target platform "$(PLATFORM)". Make aborted. +! endif +! endif +! endif +!else +CPU = i386 +!endif + !ifdef SDK_INCLUDE_DIR !include $(SDK_INCLUDE_DIR)\Win32.mak -!else +!elseif "$(USE_WIN32MAK)"=="yes" !include <Win32.mak> +!else +cc = cl +link = link +rc = rc +cflags = -nologo -c +lflags = -incremental:no -nologo +rcflags = /r +olelibsdll = ole32.lib uuid.lib oleaut32.lib user32.lib gdi32.lib advapi32.lib +!endif + +# include CPUARG +cflags = $(cflags) $(CPUARG) + +SUBSYSTEM = console +!if "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) !endif all: gvimext.dll gvimext.dll: gvimext.obj \ gvimext.res -# $(implib) /NOLOGO -machine:$(CPU) -def:gvimext.def $** -out:gvimext.lib -# $(link) $(dlllflags) -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib gvimext.lib comctl32.lib gvimext.exp - $(link) $(lflags) -dll -def:gvimext.def -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib - if exist $*.dll.manifest mt -nologo -manifest $*.dll.manifest -outputresource:$*.dll;2 + $(link) $(lflags) -dll -def:gvimext.def -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib -subsystem:$(SUBSYSTEM) + if exist $*.dll.manifest mt -nologo -manifest $*.dll.manifest -outputresource:$*.dll;2 gvimext.obj: gvimext.h .cpp.obj: - $(cc) $(cflags) -DFEAT_GETTEXT $(cvarsmt) $*.cpp + $(cc) $(cflags) -DFEAT_GETTEXT $(cvarsmt) $*.cpp gvimext.res: gvimext.rc - $(rc) $(rcflags) $(rcvars) gvimext.rc + $(rc) /nologo $(rcflags) $(rcvars) gvimext.rc clean: - - if exist gvimext.dll del gvimext.dll - - if exist gvimext.lib del gvimext.lib - - if exist gvimext.exp del gvimext.exp - - if exist gvimext.obj del gvimext.obj - - if exist gvimext.res del gvimext.res - - if exist gvimext.dll.manifest del gvimext.dll.manifest + - if exist gvimext.dll del gvimext.dll + - if exist gvimext.lib del gvimext.lib + - if exist gvimext.exp del gvimext.exp + - if exist gvimext.obj del gvimext.obj + - if exist gvimext.res del gvimext.res + - if exist gvimext.dll.manifest del gvimext.dll.manifest diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp index 70448b8d69..2b9f1ad8f7 100644 --- a/src/GvimExt/gvimext.cpp +++ b/src/GvimExt/gvimext.cpp @@ -38,7 +38,7 @@ STGMEDIUM medium; HRESULT hres = 0; UINT cbFiles = 0; -/* The buffers size used to be MAX_PATH (256 bytes), but that's not always +/* The buffers size used to be MAX_PATH (260 bytes), but that's not always * enough */ #define BUFSIZE 1100 @@ -79,19 +79,24 @@ getGvimName(char *name, int runtime) strcpy(name, searchpath((char *)"gvim.bat")); if (name[0] == 0) strcpy(name, "gvim"); // finds gvim.bat or gvim.exe - - // avoid that Vim tries to expand wildcards in the file names - strcat(name, " --literal"); } } static void -getGvimNameW(wchar_t *nameW) +getGvimInvocation(char *name, int runtime) +{ + getGvimName(name, runtime); + // avoid that Vim tries to expand wildcards in the file names + strcat(name, " --literal"); +} + + static void +getGvimInvocationW(wchar_t *nameW) { char *name; name = (char *)malloc(BUFSIZE); - getGvimName(name, 0); + getGvimInvocation(name, 0); mbstowcs(nameW, name, BUFSIZE); free(name); } @@ -123,6 +128,26 @@ getRuntimeDir(char *buf) } } +HBITMAP IconToBitmap(HICON hIcon, HBRUSH hBackground, int width, int height) +{ + HDC hDC = GetDC(NULL); + HDC hMemDC = CreateCompatibleDC(hDC); + HBITMAP hMemBmp = CreateCompatibleBitmap(hDC, width, height); + HBITMAP hResultBmp = NULL; + HGDIOBJ hOrgBMP = SelectObject(hMemDC, hMemBmp); + + DrawIconEx(hMemDC, 0, 0, hIcon, width, height, 0, hBackground, DI_NORMAL); + + hResultBmp = hMemBmp; + hMemBmp = NULL; + + SelectObject(hMemDC, hOrgBMP); + DeleteDC(hMemDC); + ReleaseDC(NULL, hDC); + DestroyIcon(hIcon); + return hResultBmp; +} + // // GETTEXT: translated messages and menu entries // @@ -133,6 +158,7 @@ getRuntimeDir(char *buf) # define VIMPACKAGE "vim" # ifndef GETTEXT_DLL # define GETTEXT_DLL "libintl.dll" +# define GETTEXT_DLL_ALT "libintl-8.dll" # endif // Dummy functions @@ -169,21 +195,40 @@ dyn_libintl_init(char *dir) {(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain}, {NULL, NULL} }; + DWORD len, len2; + LPWSTR buf = NULL; + LPWSTR buf2 = NULL; // No need to initialize twice. if (hLibintlDLL) return 1; - // Load gettext library, first try the Vim runtime directory, then search - // the path. - strcat(dir, GETTEXT_DLL); - hLibintlDLL = LoadLibrary(dir); - if (!hLibintlDLL) + // Load gettext library from $VIMRUNTIME\GvimExt{64,32} directory. + // Add the directory to $PATH temporarily. + len = GetEnvironmentVariableW(L"PATH", NULL, 0); + len2 = MAX_PATH + 1 + len; + buf = (LPWSTR)malloc(len * sizeof(WCHAR)); + buf2 = (LPWSTR)malloc(len2 * sizeof(WCHAR)); + if (buf != NULL && buf2 != NULL) { + GetEnvironmentVariableW(L"PATH", buf, len); +#ifdef _WIN64 + _snwprintf(buf2, len2, L"%S\\GvimExt64;%s", dir, buf); +#else + _snwprintf(buf2, len2, L"%S\\GvimExt32;%s", dir, buf); +#endif + SetEnvironmentVariableW(L"PATH", buf2); hLibintlDLL = LoadLibrary(GETTEXT_DLL); +#ifdef GETTEXT_DLL_ALT if (!hLibintlDLL) - return 0; + hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT); +#endif + SetEnvironmentVariableW(L"PATH", buf); } + free(buf); + free(buf2); + if (!hLibintlDLL) + return 0; // Get the addresses of the functions we need. for (i = 0; libintl_entry[i].name != NULL @@ -404,7 +449,7 @@ STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID riid, { *ppv = NULL; - // Any interface on this object is the object pointer + // any interface on this object is the object pointer if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) { @@ -448,7 +493,7 @@ STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter, // QueryInterface with IID_IShellExtInit--this is how shell extensions are // initialized. - LPCSHELLEXT pShellExt = new CShellExt(); //Create the CShellExt object + LPCSHELLEXT pShellExt = new CShellExt(); // create the CShellExt object if (NULL == pShellExt) return E_OUTOFMEMORY; @@ -469,6 +514,8 @@ CShellExt::CShellExt() m_pDataObj = NULL; inc_cRefThisDLL(); + + LoadMenuIcon(); } CShellExt::~CShellExt() @@ -477,6 +524,9 @@ CShellExt::~CShellExt() m_pDataObj->Release(); dec_cRefThisDLL(); + + if (m_hVimIconBitmap) + DeleteObject(m_hVimIconBitmap); } STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR *ppv) @@ -597,6 +647,7 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, HKEY keyhandle; bool showExisting = true; + bool showIcons = true; // Check whether "Edit with existing Vim" entries are disabled. if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, @@ -605,6 +656,9 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, if (RegQueryValueEx(keyhandle, "DisableEditWithExisting", 0, NULL, NULL, NULL) == ERROR_SUCCESS) showExisting = false; + if (RegQueryValueEx(keyhandle, "DisableContextMenuIcons", 0, NULL, + NULL, NULL) == ERROR_SUCCESS) + showIcons = false; RegCloseKey(keyhandle); } @@ -612,28 +666,33 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, if (showExisting) EnumWindows(EnumWindowsProc, (LPARAM)this); + MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; + mii.fMask = MIIM_STRING | MIIM_ID; + if (showIcons) + { + mii.fMask |= MIIM_BITMAP; + mii.hbmpItem = m_hVimIconBitmap; + } + if (cbFiles > 1) { - InsertMenu(hMenu, - indexMenu++, - MF_STRING|MF_BYPOSITION, - idCmd++, - _("Edit with &multiple Vims")); - - InsertMenu(hMenu, - indexMenu++, - MF_STRING|MF_BYPOSITION, - idCmd++, - _("Edit with single &Vim")); + mii.wID = idCmd++; + mii.dwTypeData = _("Edit with &multiple Vims"); + mii.cch = lstrlen(mii.dwTypeData); + InsertMenuItem(hMenu, indexMenu++, TRUE, &mii); + + mii.wID = idCmd++; + mii.dwTypeData = _("Edit with single &Vim"); + mii.cch = lstrlen(mii.dwTypeData); + InsertMenuItem(hMenu, indexMenu++, TRUE, &mii); if (cbFiles <= 4) { // Can edit up to 4 files in diff mode - InsertMenu(hMenu, - indexMenu++, - MF_STRING|MF_BYPOSITION, - idCmd++, - _("Diff with Vim")); + mii.wID = idCmd++; + mii.dwTypeData = _("Diff with Vim"); + mii.cch = lstrlen(mii.dwTypeData); + InsertMenuItem(hMenu, indexMenu++, TRUE, &mii); m_edit_existing_off = 3; } else @@ -642,11 +701,10 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, } else { - InsertMenu(hMenu, - indexMenu++, - MF_STRING|MF_BYPOSITION, - idCmd++, - _("Edit with &Vim")); + mii.wID = idCmd++; + mii.dwTypeData = _("Edit with &Vim"); + mii.cch = lstrlen(mii.dwTypeData); + InsertMenuItem(hMenu, indexMenu++, TRUE, &mii); m_edit_existing_off = 1; } @@ -672,11 +730,11 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, temp[BUFSIZE - 1] = '\0'; strncat(temp, title, BUFSIZE - 1 - strlen(temp)); temp[BUFSIZE - 1] = '\0'; - InsertMenu(hMenu, - indexMenu++, - MF_STRING|MF_BYPOSITION, - idCmd++, - temp); + + mii.wID = idCmd++; + mii.dwTypeData = temp; + mii.cch = lstrlen(mii.dwTypeData); + InsertMenuItem(hMenu, indexMenu++, TRUE, &mii); } // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); @@ -813,37 +871,23 @@ BOOL CALLBACK CShellExt::EnumWindowsProc(HWND hWnd, LPARAM lParam) return TRUE; // continue enumeration (otherwise this would be false) } -#ifdef WIN32 -// This symbol is not defined in older versions of the SDK or Visual C++. - -#ifndef VER_PLATFORM_WIN32_WINDOWS -# define VER_PLATFORM_WIN32_WINDOWS 1 -#endif - -static DWORD g_PlatformId; - -// -// Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or -// VER_PLATFORM_WIN32_WINDOWS (Win95). -// - static void -PlatformId(void) +BOOL CShellExt::LoadMenuIcon() { - static int done = FALSE; - - if (!done) - { - OSVERSIONINFO ovi; - - ovi.dwOSVersionInfoSize = sizeof(ovi); - GetVersionEx(&ovi); - - g_PlatformId = ovi.dwPlatformId; - done = TRUE; - } + char vimExeFile[BUFSIZE]; + getGvimName(vimExeFile, 1); + if (vimExeFile[0] == '\0') + return FALSE; + HICON hVimIcon; + if (ExtractIconEx(vimExeFile, 0, NULL, &hVimIcon, 1) == 0) + return FALSE; + m_hVimIconBitmap = IconToBitmap(hVimIcon, + GetSysColorBrush(COLOR_MENU), + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON)); + return TRUE; } -# ifndef __BORLANDC__ +#ifndef __BORLANDC__ static char * searchpath(char *name) { @@ -852,28 +896,17 @@ searchpath(char *name) // There appears to be a bug in FindExecutableA() on Windows NT. // Use FindExecutableW() instead... - PlatformId(); - if (g_PlatformId == VER_PLATFORM_WIN32_NT) - { - MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1, - (LPWSTR)widename, BUFSIZE); - if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", - (LPWSTR)location) > (HINSTANCE)32) - { - WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, - (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); - return widename; - } - } - else + MultiByteToWideChar(CP_ACP, 0, (LPCSTR)name, -1, + (LPWSTR)widename, BUFSIZE); + if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", + (LPWSTR)location) > (HINSTANCE)32) { - if (FindExecutableA((LPCTSTR)name, (LPCTSTR)"", - (LPTSTR)location) > (HINSTANCE)32) - return location; + WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, + (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); + return widename; } return (char *)""; } -# endif #endif STDMETHODIMP CShellExt::InvokeGvim(HWND hParent, @@ -893,7 +926,7 @@ STDMETHODIMP CShellExt::InvokeGvim(HWND hParent, m_szFileUserClickedOn, sizeof(m_szFileUserClickedOn)); - getGvimNameW(cmdStrW); + getGvimInvocationW(cmdStrW); wcscat(cmdStrW, L" \""); if ((wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 2) < BUFSIZE) @@ -961,7 +994,7 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent, cmdlen = BUFSIZE; cmdStrW = (wchar_t *) malloc(cmdlen * sizeof(wchar_t)); - getGvimNameW(cmdStrW); + getGvimInvocationW(cmdStrW); if (useDiff) wcscat(cmdStrW, L" -d"); diff --git a/src/GvimExt/gvimext.h b/src/GvimExt/gvimext.h index 59747c90f8..e17f2ac2c9 100644 --- a/src/GvimExt/gvimext.h +++ b/src/GvimExt/gvimext.h @@ -42,6 +42,7 @@ #include <windows.h> #include <windowsx.h> #include <shlobj.h> +#include <wchar.h> /* Accommodate old versions of VC that don't have a modern Platform SDK */ #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) @@ -110,10 +111,14 @@ typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY; class CShellExt : public IContextMenu, IShellExtInit { +private: + BOOL LoadMenuIcon(); + protected: ULONG m_cRef; LPDATAOBJECT m_pDataObj; UINT m_edit_existing_off; + HBITMAP m_hVimIconBitmap; // For some reason, this callback must be static static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); diff --git a/src/INSTALL b/src/INSTALL index aa4b6e341c..99f1047a48 100644 --- a/src/INSTALL +++ b/src/INSTALL @@ -11,7 +11,7 @@ Contents: See INSTALLami.txt for Amiga See INSTALLmac.txt for Macintosh -See INSTALLpc.txt for PC (MS-DOS, Windows 95/98/NT/XP) +See INSTALLpc.txt for PC (Windows 95/98/NT/XP/Vista/7/8/10) See INSTALLvms.txt for VMS See INSTALLx.txt for cross-compiling on Unix See ../README_390.txt for OS/390 Unix @@ -176,46 +176,7 @@ And to not search for locally installed headers and libraries at all, use: 3. OS/2 ======= -Summary: -ren Makefile Makefile.unix -ren makefile.os2 Makefile -make - -This port of Vim to OS/2 is based on the emx environment together -with GNU C. The main design goal of emx is to simplify porting Unix -software to OS/2 and DOS. Because of this, almost all the Unix defines -etc. already existing in the Vim source code could be reused. Only where -OS/2 specifics came into play were additional changes necessary. Those -places can be found by searching for "OS2" and "__EMX__" (I've tried to -keep emx-specific things separate from generic OS/2 stuff). - -Note: This OS/2 port works well for me and an additional OS/2 user on - the Vim development team (Karsten Sievert); however, since I - haven't had any other feedback from other people, that either - means no (OS/2-specific) bugs exist, or no one has yet created - a situation in which any bugs are apparent. - Report any problems or other comments to paul@wau.mis.ah.nl - (email valid up to at least September 1996, after that try - paul@wurtel.hobby.nl, paul@murphy.nl, or paulS@toecompst.nl). - Textmode/notextmode and binary mode both seem to work well. - -Prerequisites: -- To compile, you need the emx environment (at least rev. 0.9b), GCC, - some make utility (GNU make works fine). These are generally - available as (ask Archie about them): - emxrt.zip emx runtime package - emxdev.zip emx development system (without compiler) - GNU programs compiled for emx, patches and patched sources: - gnudev1.zip GNU development tools compiled for emx (part 1) - gnudev2.zip GNU development tools compiled for emx (part 2) - gnumake.zip GNU make -- Don't set a TERM environment variable; Vim defaults to os2ansi - which is available as a builtin termcap entry. Using other values - may give problems! (OS/2 ANSI emulation is quite limited.) If you - need to set TERM for other programs, you may consider putting - set term=os2ansi in the vimrc file. - -Check ../runtime/doc/os_os2.txt for additional info on running Vim. +OS/2 support was removed in patch 7.4.1008 4. Atari MiNT @@ -260,8 +221,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: @@ -316,7 +277,7 @@ directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not supports the `VPATH' + If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another diff --git a/src/INSTALLmac.txt b/src/INSTALLmac.txt index 81ad970fe8..e957682a14 100644 --- a/src/INSTALLmac.txt +++ b/src/INSTALLmac.txt @@ -3,9 +3,13 @@ INSTALLmac.txt - Installation of Vim on Macintosh This file contains instructions for compiling Vim. If you already have an executable version of Vim, you don't need this. -An alternate way of building that Benji Fisher uses can be found here: +First, make sure you've installed Xcode or CommandLineToots. If not, open a +terminal and do + + $ make --version + +A window pops up instructing you to install the developer tools. - http://macvim.swdev.org/OSX/#Developers ---------------------------------------------------------------------------- Summary @@ -30,11 +34,12 @@ MacOS Classic is no longer supported. If you really want it use Vim 6.4. You can compile vim with the standard Unix routine: cd .../src make + make test + sudo make install - This will create a working Vim.app application bundle in the src + "make" will create a working Vim.app application bundle in the src directory. You can move this bundle (the Vim.app directory) anywhere - you want. Or use this command to move it to /Applications: - make install + you want. Or use "make install" to move it to /Applications. You need at least Xcode 1.5 to compile Vim 7.0. diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 7ba2801b0a..fe1c9b790f 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -3,17 +3,21 @@ INSTALLpc.txt - Installation of Vim on PC This file contains instructions for compiling Vim. If you already have an executable version of Vim, you don't need this. -More information can be found here: (Very stale now.) - - http://mywebpage.netscape.com/sharppeople/vim/howto/ +You can find the lastest here: https://github.com/vim/vim-win32-installer +This page also has links to install support for interfaces such as Perl, +Python, Lua, etc. The file "feature.h" can be edited to match your preferences. You can skip this, then you will get the default behavior as is documented, which should be fine for most people. -With the exception of two sections (Windows 3.1 and MS-DOS), this document -assumes that you are building Vim for Win32 or later. -(Windows 95/98/Me/NT/2000/XP/2003/Vista/7) +This document assumes that you are building Vim for Win32 or later (Windows +XP/2003/Vista/7/8/10). There are also instructions for pre-XP systems, but +they might no longer work. + +The recommended way is to build a 32 bit Vim, also on 64 bit systems. You can +build a 64 bit Vim if you like, the executable will be bigger and Vim won't be +any faster, but you can edit files larger than 2 Gbyte. Contents: @@ -23,31 +27,47 @@ Contents: 4. Borland 5. Cross compiling for Win32 from a Linux machine 6. Building with Python support -7. Building with MzScheme support -8. Windows 3.1 -9. MS-DOS +7. Building with Python3 support +8. Building with Racket or MzScheme support +9. Building with Lua support +10. Building with Perl support +11. Building with Ruby support +12. Building with Tcl support +13. Building with Terminal support +14. Building with DirectX (DirectWrite) support +15. Windows 3.1 +16. MS-DOS -10. Installing after building from sources +17. Installing after building from sources -The currently preferred method is using the free Visual C++ Toolkit 2008 -|msvc-2008-express|, the produced binary runs on most MS-Windows systems. If -you need the executable to run on Windows 98 or ME, use the 2003 one -|msvc-2003-toolkit|. +The currently recommended way (that means it has been verified to work) is +using the "Visual Studio Community 2015" installation. This includes the SDK +needed to target Windows XP. But not older Windows versions (95, 98), see +|msvc-2008-express| below for that 1. Microsoft Visual C++ ======================= +We do not provide download links, since Microsoft keeps changing them. You +can search for "Visual Studio Community 2015", for example. You will need to +create a Microsoft account (it's free). + +When installing "Visual Studio Community 2015 with Update 3" make sure to +select "custom" and check "Windows XP Support for C++" and all checkboxes +under "Universal Windows App Development Tools" + + Visual Studio ------------- -Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, VS 2005, and VS 2008) -is straightforward. (These instructions should also work for VS 4 and VS 5.) +Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, VS 2005, VS 2008, +VS2010, VS2012, VS2013 and VS2015) is straightforward. (These instructions +should also work for VS 4 and VS 5.) -Using VS C++ 2008 Express is recommended, the binaries build with that run on -nearly all platforms. Binaries from later versions may not run on Windows 95 -or XP. +Using VS C++ 2008 Express is recommended if you need the binary to run on +Windows 95 or 97, see |msvc-2008-express| below. To build Vim from the command line with MSVC, use Make_mvc.mak. Visual Studio installed a batch file called vcvars32.bat, which you must @@ -81,6 +101,81 @@ These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and Ron Aaron; they have been tested. +Visual C++ 2008 Express Edition *msvc-2008-express* +------------------------------- + +Visual C++ 2008 Express Edition can be downloaded for free from: + http://www.microsoft.com/express/downloads/ +This includes the IDE and the debugger. + +To set the environment execute the msvc2008.bat script. You can then build +Vim with Make_mvc.mak. + +For building 64 bit binaries you also need to install the SDK: +"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1" +You don't need the examples and documentation. + +If you get an error that Win32.mak can't be found, you have to set the +variable SDK_INCLUDE_DIR. For example, on Windows 10, installation of MSVC +puts include files in the following directory: + set SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include + + +Visual C++ 2010 Express Edition *msvc-2010-express* +------------------------------- + +Visual C++ 2010 Express Edition can be downloaded for free from: + http://www.microsoft.com/express/vc/Default.aspx +This includes the IDE and the debugger. + +To set the environment execute the msvc2010.bat script. You can then build +Vim with Make_mvc.mak. + + +Targeting Windows XP with MSVC 2012 and later *new-msvc-windows-xp* +--------------------------------------------- + +Beginning with Visual C++ 2012, Microsoft changed the behavior of LINK.EXE +so that it targets Windows 6.0 (Vista) by default. In order to override +this, the target Windows version number needs to be passed to LINK like +follows: + LINK ... /subsystem:console,5.01 + +Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version. +Use lines like follows to target Windows XP x86 (assuming using Visual C++ +2012 under 64-bit Windows): + set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A + set INCLUDE=%WinSdk71%\Include;%INCLUDE% + set LIB=%WinSdk71%\Lib;%LIB% + set CL=/D_USING_V110_SDK71_ + nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01 + +To target Windows XP x64 instead of x86, you need to change the settings of +LIB and SUBSYSTEM_VER: + ... + set LIB=%WinSdk71%\Lib\x64;%LIB% + ... + nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.02 + +If you use Visual C++ 2015 (either Express or Community Edition), executing +msvc2015.bat will set them automatically. For x86 builds run this without +options: + msvc2015 +For x64 builds run this with the "x86_amd64" option: + msvc2015 x86_amd64 + +The following Visual C++ team blog can serve as a reference page: + http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx + + +OLDER VERSIONS + +The minimal supported version is Windows XP. Building with older compilers +might still work, but these instructions might be outdated. + +If you need the executable to run on Windows 98 or ME, use the 2003 one +|msvc-2003-toolkit|. + Visual C++ Toolkit 2003 *msvc-2003-toolkit* ----------------------- @@ -120,10 +215,10 @@ Now you can build Vim with Make_mvc.mak. Getting the Windows Platform SDK *ms-platform-sdk* -You will also need a copy of the Windows Platform SDK from - http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ -Specifically, you need the Windows Core SDK subset of the Platform SDK, -which contains the Windows headers and libraries. +You will also need a copy of the Windows Platform SDK. Specifically, you need +the Windows Core SDK subset of the Platform SDK, which contains the Windows +headers and libraries. You need to search for it, Microsoft keeps changing +the URL. Getting the .NET Framework 1.1 Runtime *dotnet-1.1-redist* @@ -166,31 +261,6 @@ Instructions for integrating the Platform SDK into VC Express: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx -Visual C++ 2008 Express Edition *msvc-2008-express* -------------------------------- - -Visual C++ 2008 Express Edition can be downloaded for free from: - http://www.microsoft.com/express/downloads/ -This includes the IDE and the debugger. - -To set the environment execute the msvc2008.bat script. You can then build -Vim with Make_mvc.mak. - -For building 64 bit binaries you also need to install the SDK: -"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1" -You don't need the examples and documentation. - - -Visual C++ 2010 Express Edition *msvc-2010-express* -------------------------------- - -Visual C++ 2010 Express Edition can be downloaded for free from: - http://www.microsoft.com/express/vc/Default.aspx -This includes the IDE and the debugger. - -To set the environment execute the msvc2010.bat script. You can then build -Vim with Make_mvc.mak. - 2. MinGW ======== @@ -204,22 +274,35 @@ at: http://www.mingw.org/ +or you can use 'MinGW-w64' compiler. + + http://mingw-w64.sourceforge.net/ + +Or a compiler provided on msys2: + + https://msys2.github.io/ + Once you have downloaded the compiler binaries, unpack them on your hard disk somewhere, and put them on your PATH. If you are on Win95/98 you can edit your AUTOEXEC.BAT file with a line like: - set PATH=C:\GCC-2.95.2\BIN;%PATH% + set PATH=C:\MinGW\bin;%PATH% or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance), -System, Advanced, and edit the environment from there. +System, Advanced, and edit the environment from there. If you use msys2 +compilers, set your installed paths (normally one of the following): + + C:\msys32\mingw32\bin (32-bit msys2, targeting 32-bit builds) + C:\msys64\mingw32\bin (64-bit msys2, targeting 32-bit builds) + C:\msys64\mingw64\bin (64-bit msys2, targeting 64-bit builds) Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window: C:\> gcc --version - 2.95.2 + gcc (GCC) 4.8.1 - C:\> make --version - GNU Make version 3.77 (...etc...) + C:\> mingw32-make --version + GNU Make 3.82.90 (...etc...) Now you are ready to rock 'n' roll. Unpack the vim sources (look on www.vim.org for exactly which version of the vim files you need). @@ -231,7 +314,7 @@ Change directory to 'vim\src': and you type: - make -f Make_ming.mak gvim.exe + mingw32-make -f Make_ming.mak gvim.exe After churning for a while, you will end up with 'gvim.exe' in the 'vim\src' directory. @@ -240,7 +323,7 @@ You should not need to do *any* editing of any files to get vim compiled this way. If, for some reason, you want the console-mode-only version of vim (this is NOT recommended on Win32, especially on '95/'98!!!), you can use: - make -f Make_ming.mak GUI=no vim.exe + mingw32-make -f Make_ming.mak GUI=no vim.exe If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX' (also free!) and compress the file (typical compression is 50%). UPX can be @@ -267,8 +350,7 @@ You need to uncomment lines in Make_ming.mak to have NLS defined. Use Make_cyg.mak with Cygwin's GCC. See http://users.skynet.be/antoine.mechelynck/vim/compile.htm -The Cygnus one many not fully work yet. -With Cygnus gcc you can use the Unix Makefile instead (you need to get the +With Cygnus gcc you should use the Unix Makefile instead (you need to get the Unix archive then). Then you get a Cygwin application (feels like Vim is running on Unix), while with Make_cyg.mak you get a Windows application (like with the other makefiles). @@ -292,9 +374,9 @@ your Linux (or other unix) box. To do this, you need to follow a few steps: http://www.mingw.org/wiki/LinuxCrossMinGW http://www.libsdl.org/extras/win32/cross/README.txt 2) Get and unpack both the Unix sources and the extra archive - 3) in 'Make_ming.mak', set 'CROSS' to 'yes' instead of 'no'. - Make further changes to 'Make_ming.mak' as you wish. - If your cross-compiler prefix differs from the predefined value, + 3) in 'Make_cyg_ming.mak', set 'CROSS' to 'yes' instead of 'no'. + Make further changes to 'Make_cyg_ming.mak' and 'Make_ming.mak' as you + wish. If your cross-compiler prefix differs from the predefined value, set 'CROSS_COMPILE' corresponding. 4) make -f Make_ming.mak gvim.exe @@ -307,6 +389,17 @@ Now you have created the Windows binary from your Linux box! Have fun... For building with MSVC 2008 the "Windows Installer" from www.python.org works fine. +When building, you need to set the following variables at least: + + PYTHON: Where Python is installed. E.g. C:\Python27 + DYNAMIC_PYTHON: Whether dynamic linking is used. Usually, set to yes. + PYTHON_VER: Python version. E.g. 27 for Python 2.7.X. + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + PYTHON=C:\Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 + (rest written by Ron Aaron: <ronaharon@yahoo.com>) Building with the mingw32 compiler, and the ActiveState ActivePython: @@ -314,25 +407,120 @@ Building with the mingw32 compiler, and the ActiveState ActivePython: After installing the ActivePython, you will have to create a 'mingw32' 'libpython20.a' to link with: - cd $PYTHON/libs - pexports python20.dll > python20.def - dlltool -d python20.def -l libpython20.a + cd $PYTHON/libs + pexports python20.dll > python20.def + dlltool -d python20.def -l libpython20.a Once that is done, edit the 'Make_ming.mak' so the PYTHON variable points to the root of the Python installation (C:\Python20, for example). If you are cross-compiling on Linux with the mingw32 setup, you need to also convert all the 'Include' files to *unix* line-endings. This bash command will do it easily: - for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil + for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil Now just do: - make -f Make_ming.mak gvim.exe + make -f Make_ming.mak gvim.exe + +And if you use msys2 to build python support (as one line): + + mingw32-make -f Make_ming.mak PYTHON=c:/msys64/mingw64 + PYTHON_HOME=c:/msys64/mingw64 + PYTHONINC=-Ic:/msys64/mingw64/include/python2.7 + DYNAMIC_PYTHON=yes + PYTHON_VER=27 + DYNAMIC_PYTHON_DLL=libpython2.7.dll + STATIC_STDCPLUS=yes + +(This is for 64-bit builds. For 32-bit builds, replace mingw64 with mingw32.) +You will end up with a Python-enabled, Win32 version. Enjoy! + + +7. Building with Python3 support +================================ + +For building with MSVC 2008 the "Windows Installer" from www.python.org +works fine. Python 3.6 is recommended. + +When building, you need to set the following variables at least: + + PYTHON3: Where Python3 is installed. E.g. C:\Python36 + DYNAMIC_PYTHON3: Whether dynamic linking is used. Usually, set to yes. + PYTHON3_VER: Python3 version. E.g. 36 for Python 3.6.X. + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + PYTHON3=C:\Python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 + + +When using msys2 and link with Python3 bundled with msys2 (as one line): + + mingw32-make -f Make_ming.mak PYTHON3=c:/msys64/mingw64 + PYTHON3_HOME=c:/msys64/mingw64 + PYTHON3INC=-Ic:/msys64/mingw64/include/python3.6m + DYNAMIC_PYTHON3=yes + PYTHON3_VER=36 + DYNAMIC_PYTHON3_DLL=libpython3.6m.dll + STATIC_STDCPLUS=yes + +(This is for 64-bit builds. For 32-bit builds, replace mingw64 with mingw32.) + + +8. Building with Racket or MzScheme support +======================================== + +1) Building with Racket support (newest) + +MzScheme and PLT Scheme names have been rebranded as Racket. Vim with Racket +support can be built with either MSVC or MinGW (or Cygwin). +Get it from https://download.racket-lang.org/ -and you will end up with a Python-enabled, Win32 version. Enjoy! +Copy lib/libracket{version}.dll to your Windows system directory. The system +directory depends on your Windows bitness and Vim bitness: + 32-bit Vim on 32-bit Windows: C:\Windows\System32 + 32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64 + 64-bit Vim on 64-bit Windows: C:\Windows\System32 +For building you need to set the following variables: -7. Building with MzScheme support -================================= + MZSCHEME: Where Racket is installed. + E.g. C:\Program Files (x86)\Racket + DYNAMIC_MZSCHEME: Whether dynamic linking is used. Usually, set to yes. + MZSCHEME_VER: Racket DLL version which is used for the file name. + See below for a list of MZSCHEME_VER. + The DLL can be found under the lib directory. E.g. + C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll + MZSCHEME_COLLECTS: (Optional) Path of the collects directory used at + runtime. Default: $(MZSCHEME)\collects + User can override this with the PLTCOLLECTS environment + variable. + +List of MZSCHEME_VER (incomplete): + + Racket ver. | MZSCHEME_VER + ========================== + 6.3 | 3m_9z0ds0 + 6.6 | 3m_a0solc + 6.8 | 3m_a1zjsw + 6.10 | 3m_a36fs8 + + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + MZSCHEME="C:\Program Files (x86)\Racket" DYNAMIC_MZSCHEME=yes + MZSCHEME_VER=3m_9z0ds0 + +Or when using MinGW (as one line): + + mingw32-make -f Make_ming.mak + MZSCHEME='C:/Program\ Files\ (x86)/Racket' DYNAMIC_MZSCHEME=yes + MZSCHEME_VER=3m_9z0ds0 + + Spaces should be escaped with '\'. + + +2) Building with MzScheme support (older) (written by Sergey Khorev <sergey.khorev@gmail.com>) @@ -367,111 +555,370 @@ After a successful build, these dlls can be freely removed, leaving them in %WINDOWS%\System32 only. -8. Windows 3.1x -=============== -make -f Make_w16.mak 16 bit, Borland C++ 5.0 +9. Building with Lua support +============================ -Warning: Be sure to use the right make.exe. It should be Borland make. +Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin). +You can use binaries from LuaBinaries: http://luabinaries.sourceforge.net/ +This also applies to when you get a Vim executable and don't build yourself, +do the part up to "Build". -You will almost certainly have to change the paths for libs and include files -in the Makefile. Look for "D:\BC5" and "ctl3dv2". You will get a number of -warnings which can be ignored ( _chmod, precompiled header files, and -"possibly incorrect assignment"). +1) Download and install LuaBinaries -The makefile should also work for BC++ 4.0 and 4.5, but may need tweaking to -remove unsupported compiler & liker options. +Go to the Download page of LuaBinaries: + http://luabinaries.sourceforge.net/download.html -For making the Win32s version, you need Microsoft Visual C++ 4.1 OR EARLIER. -In MSVC 4.2 support for Win32s was dropped! Use this command: - nmake -f Make_mvc.mak GUI=yes +Download lua-X.Y.Z_Win32_dllw4_lib.zip for x86 or +lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them both for MSVC and +MinGW. +Unpack it to a working directory. E.g. C:\projects\lua53. +Lua's header files will be installed under the include directory. -9. MS-DOS -========= +Copy luaXY.dll to your Windows system directory. The system directory depends +on your Windows bitness and Vim bitness: + 32-bit Vim on 32-bit Windows: C:\Windows\System32 + 32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64 + 64-bit Vim on 64-bit Windows: C:\Windows\System32 + +Or another option is copying luaXY.dll to the directory where gvim.exe +(or vim.exe) is. + + +2) Build + +You need to set LUA, DYNAMIC_LUA and LUA_VER. + + LUA: Where Lua's header files are installed. E.g. C:\projects\lua53. + DYNAMIC_LUA: Whether dynamic linking is used. Set to yes. + LUA_VER: Lua version. E.g. 53 for Lua 5.3.X. + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + LUA=C:\projects\lua53 DYNAMIC_LUA=yes LUA_VER=53 + +Or when using MinGW (as one line): + + mingw32-make -f Make_ming.mak + LUA=C:/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53 + + +Or when using Cygwin (as one line) (untested): + + make -f Make_cyg.mak + LUA=/cygdrive/c/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53 + + +10. Building with Perl support +============================== + +Vim with Perl support can be built with either MSVC or MinGW (or Cygwin). +You can use binaries from ActiveState (ActivePerl) or Strawberry Perl. + + http://www.activestate.com/activeperl + http://strawberryperl.com/ + +When building, you need to set the following variables: + + PERL: Where perl is installed. E.g. C:\Perl, C:\Strawberry\perl + DYNAMIC_PERL: Whether dynamic linking is used. Usually, set to yes. + PERL_VER: Perl version. E.g. 522 for Perl 5.22.X. + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + PERL=C:\Perl DYNAMIC_PERL=yes PERL_VER=522 + +Or when using MinGW (as one line): + + mingw32-make -f Make_ming.mak + PERL=C:/Perl DYNAMIC_PERL=yes PERL_VER=522 + + +11. Building with Ruby support +============================== + +Vim with Ruby support can be built with either MSVC or MinGW (or Cygwin). +Ruby doesn't provide the official Windows binaries. The most widely used +Windows binaries might be RubyInstaller. Currently Ruby 2.4 is recommended. + + http://rubyinstaller.org/ + +If you use MinGW you can easily build with RubyInstaller, but if you use MSVC +you need some tricks described below. +(Another binary distribution is ActiveScriptRuby: + http://www.artonx.org/data/asr/) + +When building, you need to set the following variables at least: + + RUBY: Where ruby is installed. E.g. C:\Ruby24 + DYNAMIC_RUBY: Whether dynamic linking is used. Usually, set to yes. + RUBY_VER: Ruby version. E.g. 24 for Ruby 2.4.X. + RUBY_API_VER_LONG: Ruby API version in a long format. + E.g. 2.4.0 for Ruby 2.4.X. + +Ruby version vs. Ruby API version: + + Ruby ver. | Ruby API ver. + ========================= + 1.8.X | 1.8 + 1.9.[1-3] | 1.9.1 + 2.0.0 | 2.0.0 + 2.X.Y | 2.X.0 + +(Ruby 1.9.0 is excluded from the table because it is an unstable version.) + + +A) Using MSVC + +If you want to link with ruby, normally you must use the same compiler as +which was used to build the ruby binary. RubyInstaller is built with MinGW, +so normally you cannot use MSVC for building Vim if you want to link with +RubyInstaller. If you use a different compiler, there are mainly two problems: +config.h and Ruby's DLL name. Here are the steps for working around them: + + 1) Download and Install RubyInstaller. + You can install RubyInstaller with the default options and directory. + E.g.: + C:\Ruby24 (32-bit) or C:\Ruby24-x64 (64-bit) + + Ruby 2.4.X is used in this example. + + 2) Download Ruby 2.4.X's source code and generate config.h: + + cd C:\projects + git clone https://github.com/ruby/ruby.git -b ruby_2_4 + cd ruby + win32\configure.bat + nmake .config.h.time -Summary: -ren Make_bc3.mak Makefile; make 16 bit, Borland C++ and Turbo C++ -ren Make_tcc.mak Makefile; make 16 bit, Turbo C -make -f Make_djg.mak 32 bit, DJGPP 2.0 -make -f Make_bc5.mak 32 bit, Borland C++ 5.x (edit it to - define DOS) + Note that ruby_2_4 is the branch name for Ruby 2.4.X's source code. + There is no need to build whole Ruby, just config.h is needed. + If you use 32-bit MSVC 2015, the config.h is generated in the + .ext\include\i386-mswin32_140 directory. + If you use 64-bit MSVC 2015, the config.h is generated in the + .ext\include\x64-mswin64_140 directory. -Warning: Be sure to use the right make.exe. Microsoft C make doesn't work; -Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak; -DJGPP/GNU make must be used for Make_djg.mak. + 3) Install the generated config.h. -The Borland C++ compiler has been used to generate the MS-DOS executable; it -should work without problems. You will probably have to change the paths for -LIBPATH and INCLUDEPATH in the start of the Makefile. You will get two -warnings which can be ignored (one about _chmod and one about precompiled -header files). + For 32-bit version: -The "spawno" library by Ralf Brown was used in order to free memory when Vim -starts a shell or other external command. Only about 200 bytes are taken from -conventional memory. When recompiling get the spawno library from Simtel, -directory "msdos/c". It is called something like "spwno413.zip". Or follow -the instructions in the Makefile to remove the library. + xcopy /s .ext\include C:\Ruby24\include\ruby-2.4.0 -The Turbo C Makefile has not been tested much lately. It is included for those -that don't have C++. You may need to make a few changes to get it to work. + For 64-bit version: -DJGPP needs to be installed properly to compile Vim; you need a lot of things -before it works. When your setup is OK, Vim should compile with just one -warning (about an argument to signal()). + xcopy /s .ext\include C:\Ruby24-x64\include\ruby-2.4.0 -Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of -the file, there are some variables you can change to make either a 32-bit -Windows exe (GUI or console mode), or a 16-bit MS-DOS version. -NOTE: multi-byte support is broken in the Borland libraries, not everything -will work properly! Esp. handling multi-byte file names. + Note that 2.4.0 is Ruby API version of Ruby 2.4.X. + You may need to close the console and reopen it to pick up the new $PATH. -If you get all kinds of strange error messages when compiling, try changing -the file format from "unix" to "dos". + 4) Build Vim. Note that you need to adjust some variables (as one line): + For 32-bit version: -10. Installing after building from sources + nmake -f Make_mvc.mak + RUBY=C:\Ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 + RUBY_MSVCRT_NAME=msvcrt + WINVER=0x501 + + For 64-bit version, replace RUBY=C:\Ruby24 with RUBY=C:\Ruby24-x64. + + If you set WINVER explicitly, it must be set to >=0x500, when building + with Ruby 2.1 or later. (Default is 0x501.) + When using this trick, you also need to set RUBY_MSVCRT_NAME to msvcrt + which is used for the Ruby's DLL name. + +B) Using MinGW + +Using MinGW is easier than using MSVC when linking with RubyInstaller. +After you install RubyInstaller, just type this (as one line): + + mingw32-make -f Make_ming.mak + RUBY=C:/Ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 + WINVER=0x501 + +For 64-bit version, replace RUBY=C:/Ruby24 with RUBY=C:/Ruby24-x64. +If you set WINVER explicitly, it must be set to >=0x500, when building with +Ruby 2.1 or later. (Default is 0x501.) + + + +12. Building with Tcl support +============================= + +Vim with Tcl support can be built with either MSVC or MinGW (or Cygwin). +You can use binaries from ActiveState (ActiveTcl). + + http://www.activestate.com/activetcl + +For MSVC 2015 use version 8.6.6 or later. +When building, you need to set the following variables: + + TCL: Where tcl is installed. E.g. C:\Tcl86 + DYNAMIC_TCL: Whether dynamic linking is used. Usually, set to yes. + TCL_VER: Tcl version in a short format. E.g. 86 for Tcl 8.6.X. + TCL_VER_LONG: Tcl version in a long format. E.g. 8.6 for Tcl 8.6.X. + +Sometimes the Tcl dll name changes. E.g. ActiveTcl 8.6.4 comes with tcl86.dll, +but ActiveTcl 8.6.6 comes with tcl86t.dll. You can set the dll name by setting +the TCL_DLL variable: + TCL_DLL=tcl86t.dll + +E.g. When using MSVC (as one line): + + nmake -f Make_mvc.mak + TCL=C:\Tcl86 DYNAMIC_TCL=yes TCL_VER=86 TCL_VER_LONG=8.6 + +Or when using MinGW (as one line): + + mingw32-make -f Make_ming.mak + TCL=C:/Tcl86 DYNAMIC_TCL=yes TCL_VER=86 TCL_VER_LONG=8.6 + + +13. Building with Terminal support +================================== + +Vim with Terminal support can be built with either MSVC, MinGW or Cygwin. +This uses the included libvterm and winpty. No extra header files or +libraries are needed for building. Just set TERMINAL to yes. + +E.g. When using MSVC: + + nmake -f Make_mvc.mak TERMINAL=yes + +Or when using MinGW: + + mingw32-make -f Make_ming.mak TERMINAL=yes + + +14. Building with DirectX (DirectWrite) support +=============================================== + +Vim with DirectX (DirectWrite) support can be built with either MSVC or MinGW. +This requires dwrite_2.h and some other header files which come with Windows +SDK 8.1 or later (or MinGW-w64), if you want to enable color emoji support. +This also requires MBYTE=yes which is enabled by default. + +A) Using MSVC + +If you use MSVC 2013 or later, Windows SDK 8.1 or later is used by default. +You just need to specify DIRECTX=yes: + + nmake -f Make_mvc.mak DIRECTX=yes + +If you use MSVC 2012 or earlier, the required header files are not available +by default. However, you can use the header files from newer SDKs with older +compilers. E.g.: + + set "INCLUDE=%INCLUDE%;C:\Program Files (x86)\Windows Kits\8.1\Include\um" + nmake -f Make_mvc.mak DIRECTX=yes + +If you don't need color emoji support, only dwrite.h is required. You can use +older compilers (e.g. VC2010) without Windows SDK 8.1. E.g.: + + nmake -f Make_mvc.mak DIRECTX=yes COLOR_EMOJI=no + +B) Using MinGW-w64 + +Just set DIRECTX to yes: + + mingw32-make -f Make_ming.mak DIRECTX=yes + + +15. Windows 3.1x +================ + +The Windows 3.1x support was removed in patch 7.4.1364. + + +16. MS-DOS +========== + +The MS-DOS support was removed in patch 7.4.1399. Only very old Vim versions +work on MS-DOS because of the limited amount of memory available. + + +17. Installing after building from sources ========================================== -[provided by Michael Soyka] +[provided by Michael Soyka, updated by Ken Takata] After you've built the Vim binaries as described above, you're ready to install Vim on your system. However, if you've obtained the Vim sources -using Mercurial or by downloading them as a unix tar file, you must first -create a "vim73" directory. If you instead downloaded the sources as +using Git, Mercurial or by downloading them as a unix tar file, you must +first create a "vim80" directory. If you instead downloaded the sources as zip files, you can skip this setup as the zip archives already have the -correct directory structure. +correct directory structure. - A. Create a Vim "runtime" subdirectory named "vim73" + A. Create a Vim "runtime" subdirectory named "vim80" ----------------------------------------------------- - If you obtained your Vim sources as zip files, you can skip this step. + If you obtained your Vim sources as zip files, you can skip this step. Otherwise, continue reading. Go to the directory that contains the Vim "src" and "runtime" - directories and create a new subdirectory named "vim73". - - Copy the "runtime" files into "vim73": - copy runtime\* vim73 + directories and create a new subdirectory named "vim80". - B. Copy the new binaries into the "vim73" directory + Copy the "runtime" files into "vim80": + copy runtime\* vim80 + + B. Copy the new binaries into the "vim80" directory ---------------------------------------------------- Regardless of how you installed the Vim sources, you need to copy the - new binaries you created above into "vim73": - - copy src\*.exe vim73 - copy src\GvimExt\gvimext.dll vim73 - copy src\xxd\xxd.exe vim73 - - C. Move the "vim73" directory into the Vim installation subdirectory + new binaries you created above into "vim80": + + copy src\*.exe vim80 + copy src\tee\tee.exe vim80 + copy src\xxd\xxd.exe vim80 + + To install the "Edit with Vim" popup menu, you need both 32-bit and 64-bit + versions of gvimext.dll. They should be copied to "vim80\GvimExt32" and + "vim80\GvimExt64" respectively. + First, build the 32-bit version, then: + + mkdir vim80\GvimExt32 + copy src\GvimExt\gvimext.dll vim80\GvimExt32 + + Next, clean the 32-bit version and build the 64-bit version, then: + + mkdir vim80\GvimExt64 + copy src\GvimExt\gvimext.dll vim80\GvimExt64 + + C. Copy gettext and iconv DLLs into the "vim80" directory + ---------------------------------------------------------- + Get gettext and iconv DLLs from the following site: + https://github.com/mlocati/gettext-iconv-windows/releases + Both 64- and 32-bit versions are needed. + Download the files gettextX.X.X.X-iconvX.XX-shared-{32,64}.zip, extract + DLLs and place them as follows: + + vim80\ + | libintl-8.dll + | libiconv-2.dll + | libgcc_s_sjlj-1.dll (only for 32-bit) + | + + GvimExt32\ + | libintl-8.dll + | libiconv-2.dll + | libgcc_s_sjlj-1.dll + | + ` GvimExt64\ + libintl-8.dll + libiconv-2.dll + + The DLLs in the "vim80" should be the same bitness with the (g)vim.exe. + + D. Move the "vim80" directory into the Vim installation subdirectory --------------------------------------------------------------------- - Move the "vim73" subdirectory into the subdirectory where you want Vim - to be installed. Typically, this subdirectory will be named "vim". - If you already have a "vim73" subdirectory in "vim", delete it first - by running its uninstal.exe program. + Move the "vim80" subdirectory into the subdirectory where you want Vim + to be installed. Typically, this subdirectory will be named "vim". + If you already have a "vim80" subdirectory in "vim", delete it first + by running its uninstal.exe program. - D. Install Vim + E. Install Vim --------------- - "cd" to your Vim installation subdirectory "vim\vim73" and run the + "cd" to your Vim installation subdirectory "vim\vim80" and run the "install.exe" program. It will ask you a number of questions about how you would like to have your Vim setup. Among these are: - You can tell it to write a "_vimrc" file with your preferences in the @@ -480,7 +927,7 @@ correct directory structure. popup menu. - You can have it create batch files, so that you can run Vim from the console or in a shell. You can select one of the directories in your - PATH or add the directory to PATH using the Windows Control Panel. + PATH or add the directory to PATH using the Windows Control Panel. - Create entries for Vim on the desktop and in the Start menu. Happy Vimming! diff --git a/src/MacVim/Actions.plist b/src/MacVim/Actions.plist index 83aa78c124..ef419e8653 100644 --- a/src/MacVim/Actions.plist +++ b/src/MacVim/Actions.plist @@ -36,6 +36,8 @@ <string></string> <key>openWebsite:</key> <string></string> + <key>openWebsiteKaoriYa:</key> + <string></string> <key>orderFrontCharacterPalette:</key> <string></string> <key>orderFrontFontPanel:</key> @@ -72,5 +74,11 @@ <string></string> <key>zoomAll:</key> <string></string> + <key>stayInFront:</key> + <string></string> + <key>stayInBack:</key> + <string></string> + <key>stayLevelNormal:</key> + <string></string> </dict> </plist> diff --git a/src/MacVim/CGSInternal/CGSConnection.h b/src/MacVim/CGSInternal/CGSConnection.h new file mode 100644 index 0000000000..8e30d78c21 --- /dev/null +++ b/src/MacVim/CGSInternal/CGSConnection.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2008 Alacatia Labs + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Joe Ranieri joe@alacatia.com + * + */ + +#pragma once + +#include "Compatability.h" + +typedef int CGSConnectionID; +static const CGSConnectionID kCGSNullConnectionID = 0; + + +CG_EXTERN_C_BEGIN + +/*! DOCUMENTATION PENDING - verify this is Leopard only! */ +CG_EXTERN CGError CGSSetLoginwindowConnection(CGSConnectionID cid) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +CG_EXTERN CGError CGSSetLoginwindowConnectionWithOptions(CGSConnectionID cid, CFDictionaryRef options) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + +/*! Enables or disables updates on a connection. The WindowServer will forcibly reenable updates after 1 second. */ +CG_EXTERN CGError CGSDisableUpdate(CGSConnectionID cid); +CG_EXTERN CGError CGSReenableUpdate(CGSConnectionID cid); + +/*! Is there a menubar associated with this connection? */ +CG_EXTERN bool CGSMenuBarExists(CGSConnectionID cid); + + + +#pragma mark notifications +/*! Registers or removes a function to get notified when a connection is created. Only gets notified for connections created in the current application. */ +typedef void (*CGSNewConnectionNotificationProc)(CGSConnectionID cid); +CG_EXTERN CGError CGSRegisterForNewConnectionNotification(CGSNewConnectionNotificationProc proc); +CG_EXTERN CGError CGSRemoveNewConnectionNotification(CGSNewConnectionNotificationProc proc); + +/*! Registers or removes a function to get notified when a connection is released. Only gets notified for connections created in the current application. */ +typedef void (*CGSConnectionDeathNotificationProc)(CGSConnectionID cid); +CG_EXTERN CGError CGSRegisterForConnectionDeathNotification(CGSConnectionDeathNotificationProc proc); +CG_EXTERN CGError CGSRemoveConnectionDeathNotification(CGSConnectionDeathNotificationProc proc); + +/*! Creates a new connection to the window server. */ +CG_EXTERN CGError CGSNewConnection(int unused, CGSConnectionID *outConnection); + +/*! Releases a CGSConnection and all CGSWindows owned by it. */ +CG_EXTERN CGError CGSReleaseConnection(CGSConnectionID cid); + +/*! Gets the default connection for this process. `CGSMainConnectionID` is just a more modern name. */ +CG_EXTERN CGSConnectionID _CGSDefaultConnection(void); +CG_EXTERN CGSConnectionID CGSMainConnectionID(void); + +/*! Gets the default connection for the current thread. */ +CG_EXTERN CGSConnectionID CGSDefaultConnectionForThread(void); + +/* Gets the `pid` that owns this CGSConnection. */ +CG_EXTERN CGError CGSConnectionGetPID(CGSConnectionID cid, pid_t *outPID); + +/*! Gets the CGSConnection for the PSN. */ +CG_EXTERN CGError CGSGetConnectionIDForPSN(CGSConnectionID cid, const ProcessSerialNumber *psn, CGSConnectionID *outOwnerCID); + +/*! Gets and sets a connection's property. */ +CG_EXTERN CGError CGSGetConnectionProperty(CGSConnectionID cid, CGSConnectionID targetCID, CFStringRef key, CFTypeRef *outValue); +CG_EXTERN CGError CGSSetConnectionProperty(CGSConnectionID cid, CGSConnectionID targetCID, CFStringRef key, CFTypeRef value); + +/*! Closes ALL connections used by the current application. Essentially, it turns it into a console application. */ +CG_EXTERN CGError CGSShutdownServerConnections(void); + +/*! Only the owner of a window can manipulate it. So, Apple has the concept of a universal owner that owns all windows and can manipulate them all. There can only be one universal owner at a time (the Dock). */ +CG_EXTERN CGError CGSSetUniversalOwner(CGSConnectionID cid); + +/*! Sets a connection to be a universal owner. This call requires `cid` be a universal connection. */ +CG_EXTERN CGError CGSSetOtherUniversalConnection(CGSConnectionID cid, CGSConnectionID otherConnection); + +CG_EXTERN_C_END diff --git a/src/MacVim/CGSInternal/CGSRegion.h b/src/MacVim/CGSInternal/CGSRegion.h new file mode 100644 index 0000000000..b275c4da0b --- /dev/null +++ b/src/MacVim/CGSInternal/CGSRegion.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2007-2008 Alacatia Labs + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Joe Ranieri joe@alacatia.com + * + */ + +#pragma once + +#pragma mark types +#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED + // on Leopard and up these are CFTypes + typedef CFTypeRef CGSRegionObj; + typedef CFTypeRef CGSRegionEnumeratorObj; +#else + // but opaque types under 10.4 + typedef int CGSRegionObj; + typedef int CGSRegionEnumeratorObj; +#endif + +CG_EXTERN_C_BEGIN + +/*! Creates a region from a `CGRect`. */ +CG_EXTERN CGError CGSNewRegionWithRect(const CGRect *rect, CGSRegionObj *outRegion); + +/*! Creates a region from a list of `CGRect`s. */ +CG_EXTERN CGError CGSNewRegionWithRectList(const CGRect *rects, int rectCount, CGSRegionObj *outRegion); + +/*! Creates a new region from a QuickDraw region. */ +CG_EXTERN CGError CGSNewRegionWithQDRgn(RgnHandle region, CGSRegionObj *outRegion); + +/*! Creates an empty region. */ +CG_EXTERN CGError CGSNewEmptyRegion(CGSRegionObj *outRegion); + +/*! Releases a region. */ +CG_EXTERN CGError CGSReleaseRegion(CGSRegionObj region); + +/*! Creates a `CGRect` from a region. */ +CG_EXTERN CGError CGSGetRegionBounds(CGSRegionObj region, CGRect *outRect); + +/*! Determines if two regions are equal. */ +CG_EXTERN bool CGSRegionsEqual(CGSRegionObj region1, CGSRegionObj region2); + +/* Created a new region by changing the origin an existing one. */ +CG_EXTERN CGError CGSOffsetRegion(CGSRegionObj region, float offsetLeft, float offsetTop, CGSRegionObj *outRegion); + +/*! Creates a new region by copying an existing one. */ +CG_EXTERN CGError CGSCopyRegion(CGSRegionObj region, CGSRegionObj *outRegion); + +/*! Creates a new region by combining two regions together. */ +CG_EXTERN CGError CGSUnionRegion(CGSRegionObj region1, CGSRegionObj region2, CGSRegionObj *outRegion); + +/*! Creates a new region by combining a region and a rect. */ +CG_EXTERN CGError CGSUnionRegionWithRect(CGSRegionObj region, CGRect *rect, CGSRegionObj *outRegion); + +/*! Creates a region by XORing two regions together. */ +CG_EXTERN CGError CGSXorRegion(CGSRegionObj region1, CGSRegionObj region2, CGSRegionObj *outRegion); + +/*! Determines if the region is empty. */ +CG_EXTERN bool CGSRegionIsEmpty(CGSRegionObj region); + +/*! Determines if the region is rectangular. */ +CG_EXTERN bool CGSRegionIsRectangular(CGSRegionObj region); + +/*! Determines if a point in a region. */ +CG_EXTERN bool CGSPointInRegion(CGSRegionObj region, const CGPoint *point); + +/*! Determines if a rect is in a region. */ +CG_EXTERN bool CGSRectInRegion(CGSRegionObj region, const CGRect *rect); + +/*! Determines if a region is inside of a region. */ +CG_EXTERN bool CGSRegionInRegion(CGSRegionObj region1, CGSRegionObj region2); + +/*! Determines if a rect intersects a region. */ +CG_EXTERN bool CGSRegionIntersectsRect(CGSRegionObj obj, const CGRect *rect); + +/*! Determines if a region intersects a region. */ +CG_EXTERN bool CGSRegionIntersectsRegion(CGSRegionObj region1, CGSRegionObj region2); + +/*! Creates a rect from the difference of two regions. */ +CG_EXTERN CGError CGSDiffRegion(CGSRegionObj region1, CGSRegionObj region2, CGSRegionObj *outRegion); + + +#pragma mark region enumerators +/*! Gets the enumerator for a region. */ +CG_EXTERN CGSRegionEnumeratorObj CGSRegionEnumerator(CGSRegionObj region); + +/*! Releases a region enumerator. */ +CG_EXTERN void CGSReleaseRegionEnumerator(CGSRegionEnumeratorObj enumerator); + +/*! Gets the next rect of a region. */ +CG_EXTERN CGRect* CGSNextRect(CGSRegionEnumeratorObj enumerator); + +CG_EXTERN_C_END diff --git a/src/MacVim/CGSInternal/CGSWindow.h b/src/MacVim/CGSInternal/CGSWindow.h new file mode 100644 index 0000000000..cc72e0b0ff --- /dev/null +++ b/src/MacVim/CGSInternal/CGSWindow.h @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2007-2008 Alacatia Labs + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Joe Ranieri joe@alacatia.com + * + */ + +#pragma once +#include "CGSConnection.h" +#include "CGSRegion.h" + +typedef int CGSWindowID; +typedef int CGSAnimationObj; +typedef struct { CGPoint localPoint; CGPoint globalPoint; } CGSWarpPoint; + +typedef enum { + kCGSSharingNone, + kCGSSharingReadOnly, + kCGSSharingReadWrite +} CGSSharingState; + +typedef enum { + kCGSOrderBelow = -1, + kCGSOrderOut, /* hides the window */ + kCGSOrderAbove, + kCGSOrderIn /* shows the window */ +} CGSWindowOrderingMode; + +typedef enum { + kCGSBackingNonRetianed, + kCGSBackingRetained, + kCGSBackingBuffered, +} CGSBackingType; + + +CG_EXTERN_C_BEGIN + +/*! Switches to the next (or previous) window in the global list. */ +CG_EXTERN CGError CGSCycleWindows(CGSConnectionID cid, CGSWindowOrderingMode order); + +/*! Gets and sets the desktop window. Not sure what happens if more than one process sets the desktop window. */ +CG_EXTERN CGError CGSDesktopWindow(CGSConnectionID cid, CGSWindowID *outWID); +CG_EXTERN CGError CGSSetDesktopWindow(CGSConnectionID cid, CGSWindowID wid); + +/*! Sets the window's title. Internally this simply calls `CGSSetWindowProperty(cid, wid, kCGSWindowTitle, title)`. */ +CG_EXTERN CGError CGSSetWindowTitle(CGSConnectionID cid, CGSWindowID wid, CFStringRef title); + +/*! Gets and sets a property for a window. */ +CG_EXTERN CGError CGSGetWindowProperty(CGSConnectionID cid, CGSWindowID wid, CFStringRef key, CFTypeRef *outValue); +CG_EXTERN CGError CGSSetWindowProperty(CGSConnectionID cid, CGSWindowID wid, CFStringRef key, CFTypeRef value); + +/*! Gets and sets the window's transparency. */ +CG_EXTERN CGError CGSGetWindowAlpha(CGSConnectionID cid, CGSWindowID wid, float *outAlpha); +CG_EXTERN CGError CGSSetWindowAlpha(CGSConnectionID cid, CGSWindowID wid, float alpha); + +/*! Sets the alpha of a group of windows over a period of time. Note that `duration` is in seconds. */ +CG_EXTERN CGError CGSSetWindowListAlpha(CGSConnectionID cid, const CGSWindowID *widList, int widCount, float alpha, float duration); + +/*! Gets and sets the `CGConnectionID` that owns this window. Only the owner can change most properties of the window. */ +CG_EXTERN CGError CGSGetWindowOwner(CGSConnectionID cid, CGSWindowID wid, CGSConnectionID *outOwner); +CG_EXTERN CGError CGSSetWindowOwner(CGSConnectionID cid, CGSWindowID wid, CGSConnectionID owner); + +/*! Sets the background color of the window. */ +CG_EXTERN CGError CGSSetWindowAutofillColor(CGSConnectionID cid, CGSWindowID wid, float red, float green, float blue); + +/*! Locks a window to the cursor, so that whenever the cursor moves, the window moves with it. There doesn't seem to be a way to unlock the window from the cursor. */ +CG_EXTERN CGError CGSLockWindowToCursor(CGSConnectionID cid, CGSWindowID wid, float offsetLeft, float offsetTop); + +/*! Sets the warp for the window. The mesh maps a local (window) point to a point on screen. */ +CG_EXTERN CGError CGSSetWindowWarp(CGSConnectionID cid, CGSWindowID wid, int warpWidth, int warpHeight, const CGSWarpPoint *warp); + +/*! Gets or sets whether the window server should auto-fill the window's background. */ +CG_EXTERN CGError CGSGetWindowAutofill(CGSConnectionID cid, CGSWindowID wid, bool *outShouldAutoFill); +CG_EXTERN CGError CGSSetWindowAutofill(CGSConnectionID cid, CGSWindowID wid, bool shouldAutoFill); + +/*! Gets the screen rect for a window. */ +CG_EXTERN CGError CGSGetScreenRectForWindow(CGSConnectionID cid, CGSWindowID wid, CGRect *outRect); + +/*! Gets and sets the window level for a window. */ +CG_EXTERN CGError CGSGetWindowLevel(CGSConnectionID cid, CGSWindowID wid, CGWindowLevel *outLevel); +CG_EXTERN CGError CGSSetWindowLevel(CGSConnectionID cid, CGSWindowID wid, CGWindowLevel level); + +/*! Gets and sets the sharing state. This determines the level of access other applications have over this window. */ +CG_EXTERN CGError CGSGetWindowSharingState(CGSConnectionID cid, CGSWindowID wid, CGSSharingState *outState); +CG_EXTERN CGError CGSSetWindowSharingState(CGSConnectionID cid, CGSWindowID wid, CGSSharingState state); + +/*! Sets whether this window is ignored in the global window cycle (Control-F4 by default). There is no Get version? */ +CG_EXTERN CGError CGSSetIgnoresCycle(CGSConnectionID cid, CGSWindowID wid, bool ignoresCycle); + +/*! Creates a graphics context for the window. */ +CG_EXTERN CGContextRef CGWindowContextCreate(CGSConnectionID cid, CGSWindowID wid, int unknown); + +/*! Sets the order of a window */ +CG_EXTERN CGError CGSOrderWindow(CGSConnectionID cid, CGSWindowID wid, CGSWindowOrderingMode mode, CGSWindowID relativeToWID); + +/*! Sets the origin (top-left) of a window */ +CG_EXTERN CGError CGSMoveWindow(CGSConnectionID cid, CGSWindowID wid, const CGPoint *origin); + +/*! Sets the origin (top-left) of a window relative to another window's origin. */ +CG_EXTERN CGError CGSSetWindowOriginRelativeToWindow(CGSConnectionID cid, CGSWindowID wid, CGSWindowID relativeToWID, float offsetX, float offsetY); + +/* Flushes a window's buffer to the screen. */ +CG_EXTERN CGError CGSFlushWindow(CGSConnectionID cid, CGSWindowID wid, CGSRegionObj flushRegion); + + +#pragma mark shadows +/*! Gets and sets the shadow information for a window. Values for `flags` are unknown. */ +CG_EXTERN CGError CGSSetWindowShadowAndRimParameters(CGSConnectionID cid, CGSWindowID wid, float standardDeviation, float density, int offsetX, int offsetY, int flags); +CG_EXTERN CGError CGSGetWindowShadowAndRimParameters(CGSConnectionID cid, CGSWindowID wid, float *outStandardDeviation, float *outDensity, int *outOffsetX, int *outOffsetY, int *outFlags); + +/*! Sets the shadow information for a window. Simply calls through to `CGSSetWindowShadowAndRimParameters` passing 1 for `flags`. */ +CG_EXTERN CGError CGSSetWindowShadowParameters(CGSConnectionID cid, CGSWindowID wid, float standardDeviation, float density, int offsetX, int offsetY); + +/*! Invalidates a window's shadow. */ +CG_EXTERN CGError CGSInvalidateWindowShadow(CGSConnectionID cid, CGSWindowID wid); + + +#pragma mark window lists +/*! Gets the number of windows the `targetCID` owns. */ +CG_EXTERN CGError CGSGetWindowCount(CGSConnectionID cid, CGSConnectionID targetCID, int *outCount); + +/*! Gets a list of windows owned by `targetCID`. */ +CG_EXTERN CGError CGSGetWindowList(CGSConnectionID cid, CGSConnectionID targetCID, int count, CGSWindowID *list, int *outCount); + +/*! Gets the number of windows owned by `targetCID` that are on screen. */ +CG_EXTERN CGError CGSGetOnScreenWindowCount(CGSConnectionID cid, CGSConnectionID targetCID, int *outCount); + +/*! Gets a list of windows oned by `targetCID` that are on screen. */ +CG_EXTERN CGError CGSGetOnScreenWindowList(CGSConnectionID cid, CGSConnectionID targetCID, int count, CGSWindowID *list, int *outCount); + + +#pragma mark window management +/*! Creates a new CGSWindow. The real window top/left is the sum of the region's top/left and the top/left parameters. */ +CG_EXTERN CGError CGSNewWindow(CGSConnectionID cid, CGSBackingType backingType, float left, float top, CGSRegionObj region, CGSWindowID *outWID); + +/*! Creates a new CGSWindow. The real window top/left is the sum of the region's top/left and the top/left parameters. */ +CG_EXTERN CGError CGSNewWindowWithOpaqueShape(CGSConnectionID cid, CGSBackingType backingType, float left, float top, CGSRegionObj region, CGSRegionObj opaqueShape, int unknown, const int *tags, int tagSize, CGSWindowID *outWID); + +/*! Releases a CGSWindow. */ +CG_EXTERN CGError CGSReleaseWindow(CGSConnectionID cid, CGSWindowID wid); + + +#pragma mark animations +/*! Creates a Dock-style genie animation that goes from `wid` to `destinationWID`. */ +CG_EXTERN CGError CGSCreateGenieWindowAnimation(CGSConnectionID cid, CGSWindowID wid, CGSWindowID destinationWID, CGSAnimationObj *outAnimation); + +/*! Creates a sheet animation that's used when the parent window is brushed metal. Oddly enough, seems to be the only one used, even if the parent window isn't metal. */ +CG_EXTERN CGError CGSCreateMetalSheetWindowAnimationWithParent(CGSConnectionID cid, CGSWindowID wid, CGSWindowID parentWID, CGSAnimationObj *outAnimation); + +/*! Sets the progress of an animation. */ +CG_EXTERN CGError CGSSetWindowAnimationProgress(CGSAnimationObj animation, float progress); + +/*! DOCUMENTATION PENDING */ +CG_EXTERN CGError CGSWindowAnimationChangeLevel(CGSAnimationObj animation, CGWindowLevel level); + +/*! DOCUMENTATION PENDING */ +CG_EXTERN CGError CGSWindowAnimationSetParent(CGSAnimationObj animation, CGSWindowID parent) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + +/*! Releases a window animation. */ +CG_EXTERN CGError CGSReleaseWindowAnimation(CGSAnimationObj animation); + + +#pragma mark window accelleration +/*! Gets the state of accelleration for the window. */ +CG_EXTERN CGError CGSWindowIsAccelerated(CGSConnectionID cid, CGSWindowID wid, bool *outIsAccelerated); + +/*! Gets and sets if this window can be accellerated. I don't know if playing with this is safe. */ +CG_EXTERN CGError CGSWindowCanAccelerate(CGSConnectionID cid, CGSWindowID wid, bool *outCanAccelerate); +CG_EXTERN CGError CGSWindowSetCanAccelerate(CGSConnectionID cid, CGSWindowID wid, bool canAccelerate); + + +#pragma mark system status items +/*! Registers or unregisters a window as a global status item (see `NSStatusItem`, `NSMenuExtra`). Once a window is registered, the window server takes care of placing it in the apropriate location. */ +CG_EXTERN CGError CGSRegisterWindowWithSystemStatusBar(CGSConnectionID cid, CGSWindowID wid, int priority); +CG_EXTERN CGError CGSUnregisterWindowWithSystemStatusBar(CGSConnectionID cid, CGSWindowID wid); + +/*! Rearranges items in the system status bar. You should call this after registering or unregistering a status item or changing the window's width. */ +CG_EXTERN CGError CGSAdjustSystemStatusBarWindows(CGSConnectionID cid); + +CG_EXTERN_C_END diff --git a/src/MacVim/CGSInternal/Compatability.h b/src/MacVim/CGSInternal/Compatability.h new file mode 100644 index 0000000000..4912d5297a --- /dev/null +++ b/src/MacVim/CGSInternal/Compatability.h @@ -0,0 +1,21 @@ +/* + * Compatability.h + * iTerm + * + * Created by Marc on 10.08.10. + * Copyright 2010 Marc Haisenko. All rights reserved. + * + */ + +#pragma once + +#include <Carbon/Carbon.h> + +#ifndef CG_EXTERN_C_BEGIN +#define CG_EXTERN_C_BEGIN +#define CG_EXTERN_C_END +#endif + +#ifndef CG_EXTERN +#define CG_EXTERN +#endif diff --git a/src/MacVim/CGSInternal/README.txt b/src/MacVim/CGSInternal/README.txt new file mode 100644 index 0000000000..34be3e1bab --- /dev/null +++ b/src/MacVim/CGSInternal/README.txt @@ -0,0 +1,4 @@ +These header files were originally taken from the iTerm2 project at +https://github.com/gnachman/iTerm2/tree/dff7c9faec90daa7f1974a57bb43d1c2d383892e/ThirdParty/CGSInternal + +iTerm2 is licensed under the GPL version 2. diff --git a/src/MacVim/Credits.rtf b/src/MacVim/Credits.rtf index b1688a027b..4caec16114 100644 --- a/src/MacVim/Credits.rtf +++ b/src/MacVim/Credits.rtf @@ -1,8 +1,8 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} \vieww9000\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \f0\b\fs24 \cf0 VIM - Vi IMproved \b0 \ @@ -31,12 +31,14 @@ Matt Tolton\ Kaoru Yoshida\ Ron Olson\ Jonathon Mah\ -\pard\pardeftab720\ql\qnatural +\pard\pardeftab720 \cf0 Kazuki Sakamoto\ Vincent Berthoux\ Nikola Kne\'9eevi\uc0\u263 \ Dmitry Vazhov\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural +{\field{\*\fldinst{HYPERLINK "http://www.cafelinear.com"}}{\fldrslt Douglas Drumond}}\ +{\field{\*\fldinst{HYPERLINK "http://joshpetrie.net"}}{\fldrslt Josh Petrie}}\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \i0 \cf0 \ ...and many others who have helped by reporting bugs etc.\ @@ -44,6 +46,8 @@ Dmitry Vazhov\ \ Thank you to {\field{\*\fldinst{HYPERLINK "http://www.positivespinmedia.com"}}{\fldrslt Positive Spin Media}} for the PSMTabBarControl Framework.\ \ +Thank you to {\field{\*\fldinst{HYPERLINK "https://whomwah.github.io/qlstephen/"}}{\fldrslt Duncan Robertson}} for the QLStephen QuickLook plugin.\ +\ Toolbar icons by {\field{\*\fldinst{HYPERLINK "http://www.mattballdesign.com/"}}{\fldrslt Matt Ball}} (free Developer Icons), {\field{\*\fldinst{HYPERLINK "http://www.jonasraskdesign.com/"}}{\fldrslt Jonas Rask}} (Danish Royalty Free icon set), and {\field{\*\fldinst{HYPERLINK "http://www.everaldo.com"}}{\fldrslt Everaldo Coelho}} (Crystal Project Icons, released under LGPL license).\ \ Revamped MacVim icon by RIC.\ diff --git a/src/MacVim/DBPrefsWindowController.h b/src/MacVim/DBPrefsWindowController.h index 74ca024f1a..20dc300744 100644 --- a/src/MacVim/DBPrefsWindowController.h +++ b/src/MacVim/DBPrefsWindowController.h @@ -42,11 +42,8 @@ #import <Cocoa/Cocoa.h> -@interface DBPrefsWindowController : NSWindowController -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060) - // 10.6 has turned delegate messages into formal protocols - <NSAnimationDelegate, NSToolbarDelegate> -#endif +@interface DBPrefsWindowController : NSWindowController<NSAnimationDelegate, + NSToolbarDelegate> { NSMutableArray *toolbarIdentifiers; NSMutableDictionary *toolbarViews; diff --git a/src/MacVim/DBPrefsWindowController.m b/src/MacVim/DBPrefsWindowController.m index ac9bf5ced7..5887ab80c1 100644 --- a/src/MacVim/DBPrefsWindowController.m +++ b/src/MacVim/DBPrefsWindowController.m @@ -2,6 +2,7 @@ // DBPrefsWindowController.m // +#import "MacVim.h" #import "DBPrefsWindowController.h" @@ -75,8 +76,8 @@ - (void)windowDidLoad // If the developer attached a window to this controller // in Interface Builder, it gets replaced with this one. NSPanel *window = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000) - styleMask:(NSTitledWindowMask | - NSClosableWindowMask) + styleMask:(NSWindowStyleMaskTitled | + NSWindowStyleMaskClosable) backing:NSBackingStoreBuffered defer:YES] autorelease]; [window setHidesOnDeactivate:NO]; @@ -349,7 +350,7 @@ - (void)crossFadeView:(NSView *)oldView withView:(NSView *)newView { [viewAnimation stopAnimation]; - if ([self shiftSlowsAnimation] && [[[self window] currentEvent] modifierFlags] & NSShiftKeyMask) + if ([self shiftSlowsAnimation] && [[[self window] currentEvent] modifierFlags] & NSEventModifierFlagShift) [viewAnimation setDuration:1.25]; else [viewAnimation setDuration:0.25]; diff --git a/src/MacVim/English.lproj/FindAndReplace.strings b/src/MacVim/English.lproj/FindAndReplace.strings new file mode 100644 index 0000000000..4feddbc7bd --- /dev/null +++ b/src/MacVim/English.lproj/FindAndReplace.strings @@ -0,0 +1,27 @@ + +/* Class = "NSPanel"; title = "Find"; ObjectID = "6"; */ +"6.title" = "Find"; + +/* Class = "NSTextFieldCell"; title = "Find:"; ObjectID = "113"; */ +"113.title" = "Find:"; + +/* Class = "NSTextFieldCell"; title = "Replace with:"; ObjectID = "114"; */ +"114.title" = "Replace with:"; + +/* Class = "NSButtonCell"; title = "Next"; ObjectID = "115"; */ +"115.title" = "Next"; + +/* Class = "NSButtonCell"; title = "Replace"; ObjectID = "116"; */ +"116.title" = "Replace"; + +/* Class = "NSButtonCell"; title = "Replace All"; ObjectID = "117"; */ +"117.title" = "Replace All"; + +/* Class = "NSButtonCell"; title = "Match whole word only"; ObjectID = "118"; */ +"118.title" = "Match whole word only"; + +/* Class = "NSButtonCell"; title = "Ignore case"; ObjectID = "119"; */ +"119.title" = "Ignore case"; + +/* Class = "NSButtonCell"; title = "Previous"; ObjectID = "120"; */ +"120.title" = "Previous"; diff --git a/src/MacVim/English.lproj/Localizable.strings b/src/MacVim/English.lproj/Localizable.strings new file mode 100644 index 0000000000..c93cc0b6ea --- /dev/null +++ b/src/MacVim/English.lproj/Localizable.strings @@ -0,0 +1,63 @@ +// MMPreferenceController.m +"Advanced" = "Advanced"; +"General" = "General"; +"Integration" = "Integration"; + +// MMAppController.m +/* Quit dialog with no changed buffers, title */ +"Are you sure you want to quit MacVim?" = "Are you sure you want to quit MacVim?"; + +/* Dialog button */ +"Cancel" = "Cancel"; + +/* File not found dialog, text */ +"Could not open file with name %@, and %d other files." = "Could not open file with name %1$@, and %2$d other files."; + +/* File not found dialog, text */ +"Could not open file with name %@." = "Could not open file with name %@."; + +/* File not found dialog, title */ +"File not found" = "File not found"; + +/* File not found dialog, title */ +"Multiple files not found" = "Multiple files not found"; + +/* Dialog button */ +"OK" = "OK"; + +/* No comment provided by engineer. */ +"Open Recent" = "Open Recent"; + +/* Plug-In menu title */ +"Plug-In" = "Plug-In"; + +/* Dialog button */ +"Quit" = "Quit"; + +/* Quit dialog with changed buffers, title */ +"Quit without saving?" = "Quit without saving?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d tabs open in MacVim. Do you want to quit anyway?" = "There are %d tabs open in MacVim. Do you want to quit anyway?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d windows open in MacVim, with a total of %d tabs. Do you want to quit anyway?" = "There are %1$d windows open in MacVim, with a total of %2$d tabs. Do you want to quit anyway?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d windows open in MacVim. Do you want to quit anyway?" = "There are %d windows open in MacVim. Do you want to quit anyway?"; + +/* Quit dialog with changed buffers, text */ +"There are modified buffers, if you quit now all changes will be lost. Quit anyway?" = "There are modified buffers, if you quit now all changes will be lost. Quit anyway?"; + +/* Unknown URL Scheme dialog, text */ +"This version of MacVim does not support \"%@\" in its URL scheme." = "This version of MacVim does not support \"%@\" in its URL scheme."; + +/* Unknown URL Scheme dialog, title */ +"Unknown URL Scheme" = "Unknown URL Scheme"; + +// MMPreferenceController.m +"Install" = "Install"; +"Update" = "Update"; +"Latest version is %@, you have %@." = "Latest version is %@, you have %@."; +"Latest version is %@. You have the latest version." = "Latest version is %@. You have the latest version."; +"Latest version is %@. It is not installed." = "Latest version is %@. It is not installed."; \ No newline at end of file diff --git a/src/MacVim/English.lproj/MainMenu.nib/classes.nib b/src/MacVim/English.lproj/MainMenu.nib/classes.nib deleted file mode 100644 index ea2e7318a7..0000000000 --- a/src/MacVim/English.lproj/MainMenu.nib/classes.nib +++ /dev/null @@ -1,50 +0,0 @@ -{ - IBClasses = ( - { - ACTIONS = {"_cycleWindows" = id; "_cycleWindowsBackwards" = id; addNewTab = id; }; - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - ACTIONS = { - fileOpen = id; - fontSizeDown = id; - fontSizeUp = id; - forceNewWindow = id; - newWindow = id; - newWindowAndActivate = id; - openWebsite = id; - orderFrontPreferencePanel = id; - selectNextWindow = id; - selectPreviousWindow = id; - showHelp = id; - showVimHelp = id; - zoomAll = id; - }; - CLASS = MMAppController; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - {CLASS = NSMenu; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = {didAdjustSubviews = RBSplitView; willAdjustSubviews = RBSplitView; }; - CLASS = NSObject; - LANGUAGE = ObjC; - }, - {CLASS = RBSplitSubview; LANGUAGE = ObjC; SUPERCLASS = NSView; }, - { - CLASS = RBSplitView; - LANGUAGE = ObjC; - OUTLETS = {delegate = id; }; - SUPERCLASS = RBSplitSubview; - }, - { - ACTIONS = {checkForUpdates = id; }; - CLASS = SUUpdater; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/English.lproj/MainMenu.nib/designable.nib b/src/MacVim/English.lproj/MainMenu.nib/designable.nib new file mode 100644 index 0000000000..1908a58f4e --- /dev/null +++ b/src/MacVim/English.lproj/MainMenu.nib/designable.nib @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <deployment version="1060" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> + <connections> + <outlet property="delegate" destination="235" id="236"/> + <outlet property="dockMenu" destination="337" id="341"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application"/> + <menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu"> + <items> + <menuItem title="MacVim" id="56"> + <menu key="submenu" title="MacVim" systemMenu="apple" id="57"> + <items> + <menuItem title="About MacVim" id="58"> + <modifierMask key="keyEquivalentModifierMask"/> + <connections> + <action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/> + </connections> + </menuItem> + <menuItem title="Check for updates…" id="255"> + <connections> + <action selector="checkForUpdates:" target="Jqk-qh-n0J" id="Wau-rL-cbn"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="196"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Preferences…" keyEquivalent="," id="129"> + <connections> + <action selector="orderFrontPreferencePanel:" target="235" id="252"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="143"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Services" id="131"> + <menu key="submenu" title="Services" systemMenu="services" id="130"/> + </menuItem> + <menuItem isSeparatorItem="YES" id="144"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Hide MacVim" keyEquivalent="h" id="134"> + <connections> + <action selector="hide:" target="-2" id="152"/> + </connections> + </menuItem> + <menuItem title="Hide Others" keyEquivalent="h" id="145"> + <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> + <connections> + <action selector="hideOtherApplications:" target="-2" id="146"/> + </connections> + </menuItem> + <menuItem title="Show All" id="150"> + <connections> + <action selector="unhideAllApplications:" target="-2" id="153"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="149"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Quit MacVim" keyEquivalent="q" id="136"> + <connections> + <action selector="terminate:" target="-2" id="139"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + <menuItem title="File" id="217"> + <menu key="submenu" title="File" id="218"> + <items> + <menuItem title="New Window" keyEquivalent="n" id="219"> + <connections> + <action selector="newWindow:" target="235" id="251"/> + </connections> + </menuItem> + <menuItem title="Open…" keyEquivalent="o" id="261"> + <connections> + <action selector="fileOpen:" target="235" id="277"/> + </connections> + </menuItem> + <menuItem title="Open Recent" id="262"> + <menu key="submenu" title="Open Recent" id="271"> + <items> + <menuItem title="Clear Menu" id="272"> + <connections> + <action selector="clearRecentDocuments:" target="-1" id="278"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + <menuItem isSeparatorItem="YES" id="263"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Close" keyEquivalent="w" id="248"> + <connections> + <action selector="performClose:" target="-1" id="249"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + <menuItem title="Edit" id="281"> + <menu key="submenu" title="Edit" id="282"> + <items> + <menuItem title="Undo" keyEquivalent="z" id="283"> + <connections> + <action selector="undo:" target="-1" id="316"/> + </connections> + </menuItem> + <menuItem title="Redo" keyEquivalent="Z" id="284"> + <connections> + <action selector="redo:" target="-1" id="317"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="285"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Cut" keyEquivalent="x" id="286"> + <connections> + <action selector="cut:" target="-1" id="318"/> + </connections> + </menuItem> + <menuItem title="Copy" keyEquivalent="c" id="287"> + <connections> + <action selector="copy:" target="-1" id="319"/> + </connections> + </menuItem> + <menuItem title="Paste" keyEquivalent="v" id="288"> + <connections> + <action selector="paste:" target="-1" id="320"/> + </connections> + </menuItem> + <menuItem title="Delete" id="290"> + <connections> + <action selector="delete:" target="-1" id="321"/> + </connections> + </menuItem> + <menuItem title="Select All" keyEquivalent="a" id="291"> + <connections> + <action selector="selectAll:" target="-1" id="322"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + <menuItem title="Window" id="309"> + <menu key="submenu" title="Window" id="310"> + <items> + <menuItem title="Minimize" keyEquivalent="m" id="311"> + <connections> + <action selector="performMiniaturize:" target="-1" id="323"/> + </connections> + </menuItem> + <menuItem title="Zoom" id="312"> + <connections> + <action selector="performZoom:" target="-1" id="324"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="313"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Bring All to Front" id="314"> + <connections> + <action selector="arrangeInFront:" target="-1" id="325"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + <menuItem title="Help" id="232"> + <menu key="submenu" title="Help" id="233"> + <items> + <menuItem title="MacVim Help" keyEquivalent="?" id="275"> + <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/> + <connections> + <action selector="showVimHelp:" target="235" id="329"/> + </connections> + </menuItem> + <menuItem title="MacVim Website" id="234"> + <connections> + <action selector="openWebsite:" target="235" id="274"/> + </connections> + </menuItem> + </items> + </menu> + </menuItem> + </items> + </menu> + <customObject id="235" userLabel="MMAppController" customClass="MMAppController"/> + <menu id="337" userLabel="DockMenu"> + <items> + <menuItem title="New Window" id="338"> + <attributedString key="attributedTitle"/> + <connections> + <action selector="newWindowAndActivate:" target="235" id="350"/> + </connections> + </menuItem> + </items> + </menu> + <customObject id="Jqk-qh-n0J" customClass="SUUpdater"/> + </objects> +</document> diff --git a/src/MacVim/English.lproj/MainMenu.nib/info.nib b/src/MacVim/English.lproj/MainMenu.nib/info.nib deleted file mode 100644 index 42126e16b3..0000000000 --- a/src/MacVim/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>84 130 356 240 0 0 1024 746 </string> - <key>IBEditorPositions</key> - <dict> - <key>29</key> - <string>84 375 281 44 0 0 1024 746 </string> - </dict> - <key>IBFramework Version</key> - <string>489.0</string> - <key>IBLastKnownRelativeProjectPath</key> - <string>../../MacVim.xcodeproj</string> - <key>IBOldestOS</key> - <integer>5</integer> - <key>IBOpenObjects</key> - <array> - <integer>29</integer> - </array> - <key>IBSystem Version</key> - <string>8S165</string> - <key>targetFramework</key> - <string>IBCocoaFramework</string> -</dict> -</plist> diff --git a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib index 9a13b8479e..2624991b25 100644 Binary files a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib and b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/src/MacVim/English.lproj/MainMenu.strings b/src/MacVim/English.lproj/MainMenu.strings new file mode 100644 index 0000000000..15d568f857 --- /dev/null +++ b/src/MacVim/English.lproj/MainMenu.strings @@ -0,0 +1,117 @@ + +/* Class = "NSMenu"; title = "MainMenu"; ObjectID = "29"; */ +"29.title" = "MainMenu"; + +/* Class = "NSMenuItem"; title = "MacVim"; ObjectID = "56"; */ +"56.title" = "MacVim"; + +/* Class = "NSMenu"; title = "MacVim"; ObjectID = "57"; */ +"57.title" = "MacVim"; + +/* Class = "NSMenuItem"; title = "About MacVim"; ObjectID = "58"; */ +"58.title" = "About MacVim"; + +/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "129"; */ +"129.title" = "Preferences…"; + +/* Class = "NSMenu"; title = "Services"; ObjectID = "130"; */ +"130.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Services"; ObjectID = "131"; */ +"131.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Hide MacVim"; ObjectID = "134"; */ +"134.title" = "Hide MacVim"; + +/* Class = "NSMenuItem"; title = "Quit MacVim"; ObjectID = "136"; */ +"136.title" = "Quit MacVim"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "145"; */ +"145.title" = "Hide Others"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "150"; */ +"150.title" = "Show All"; + +/* Class = "NSMenuItem"; title = "File"; ObjectID = "217"; */ +"217.title" = "File"; + +/* Class = "NSMenu"; title = "File"; ObjectID = "218"; */ +"218.title" = "File"; + +/* Class = "NSMenuItem"; title = "New Window"; ObjectID = "219"; */ +"219.title" = "New Window"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "232"; */ +"232.title" = "Help"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "233"; */ +"233.title" = "Help"; + +/* Class = "NSMenuItem"; title = "MacVim Website"; ObjectID = "234"; */ +"234.title" = "MacVim Website"; + +/* Class = "NSMenuItem"; title = "Close"; ObjectID = "248"; */ +"248.title" = "Close"; + +/* Class = "NSMenuItem"; title = "Check for updates…"; ObjectID = "255"; */ +"255.title" = "Check for updates…"; + +/* Class = "NSMenuItem"; title = "Open…"; ObjectID = "261"; */ +"261.title" = "Open…"; + +/* Class = "NSMenuItem"; title = "Open Recent"; ObjectID = "262"; */ +"262.title" = "Open Recent"; + +/* Class = "NSMenu"; title = "Open Recent"; ObjectID = "271"; */ +"271.title" = "Open Recent"; + +/* Class = "NSMenuItem"; title = "Clear Menu"; ObjectID = "272"; */ +"272.title" = "Clear Menu"; + +/* Class = "NSMenuItem"; title = "MacVim Help"; ObjectID = "275"; */ +"275.title" = "MacVim Help"; + +/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "281"; */ +"281.title" = "Edit"; + +/* Class = "NSMenu"; title = "Edit"; ObjectID = "282"; */ +"282.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "283"; */ +"283.title" = "Undo"; + +/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "284"; */ +"284.title" = "Redo"; + +/* Class = "NSMenuItem"; title = "Cut"; ObjectID = "286"; */ +"286.title" = "Cut"; + +/* Class = "NSMenuItem"; title = "Copy"; ObjectID = "287"; */ +"287.title" = "Copy"; + +/* Class = "NSMenuItem"; title = "Paste"; ObjectID = "288"; */ +"288.title" = "Paste"; + +/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "290"; */ +"290.title" = "Delete"; + +/* Class = "NSMenuItem"; title = "Select All"; ObjectID = "291"; */ +"291.title" = "Select All"; + +/* Class = "NSMenuItem"; title = "Window"; ObjectID = "309"; */ +"309.title" = "Window"; + +/* Class = "NSMenu"; title = "Window"; ObjectID = "310"; */ +"310.title" = "Window"; + +/* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "311"; */ +"311.title" = "Minimize"; + +/* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "312"; */ +"312.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "314"; */ +"314.title" = "Bring All to Front"; + +/* Class = "NSMenuItem"; title = "New Window"; ObjectID = "338"; */ +"338.title" = "New Window"; diff --git a/src/MacVim/English.lproj/Preferences.nib/designable.nib b/src/MacVim/English.lproj/Preferences.nib/designable.nib index 8a7b8adefa..83fcd54b7d 100644 --- a/src/MacVim/English.lproj/Preferences.nib/designable.nib +++ b/src/MacVim/English.lproj/Preferences.nib/designable.nib @@ -1,1719 +1,276 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> - <data> - <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">12A269</string> - <string key="IBDocument.InterfaceBuilderVersion">2549</string> - <string key="IBDocument.AppKitVersion">1187</string> - <string key="IBDocument.HIToolboxVersion">624.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">2549</string> - </object> - <array key="IBDocument.IntegratedClassDependencies"> - <string>NSButton</string> - <string>NSButtonCell</string> - <string>NSCustomObject</string> - <string>NSCustomView</string> - <string>NSMatrix</string> - <string>NSMenu</string> - <string>NSMenuItem</string> - <string>NSPopUpButton</string> - <string>NSPopUpButtonCell</string> - <string>NSTextField</string> - <string>NSTextFieldCell</string> - <string>NSUserDefaultsController</string> - </array> - <array key="IBDocument.PluginDependencies"> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - </array> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <array class="NSMutableArray" key="IBDocument.RootObjects" id="797097783"> - <object class="NSCustomObject" id="816709129"> - <string key="NSClassName">MMPreferenceController</string> - </object> - <object class="NSCustomObject" id="809429266"> - <string key="NSClassName">FirstResponder</string> - </object> - <object class="NSCustomObject" id="214904313"> - <string key="NSClassName">NSApplication</string> - </object> - <object class="NSUserDefaultsController" id="547503666"> - <bool key="NSSharedInstance">YES</bool> - </object> - <object class="NSCustomView" id="225936320"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">268</int> - <array class="NSMutableArray" key="NSSubviews"> - <object class="NSTextField" id="176759725"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{17, 162}, {187, 17}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="1037211080"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="550807035"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">71303168</int> - <string key="NSContents">Open files from applications:</string> - <object class="NSFont" key="NSSupport" id="398275172"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">13</double> - <int key="NSfFlags">1044</int> - </object> - <reference key="NSControlView" ref="176759725"/> - <object class="NSColor" key="NSBackgroundColor" id="821672772"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> - </object> - </object> - <object class="NSColor" key="NSTextColor" id="481736603"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlTextColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - </object> - </object> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="832513823"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{17, 253}, {187, 17}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="822012781"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="434136918"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">71303168</int> - <string key="NSContents">Open untitled window:</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="832513823"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSTextColor" ref="481736603"/> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSMatrix" id="822012781"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{209, 212}, {243, 58}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="663739951"/> - <bool key="NSEnabled">YES</bool> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - <int key="NSNumRows">3</int> - <int key="NSNumCols">1</int> - <array class="NSMutableArray" key="NSCells"> - <object class="NSButtonCell" id="281424572"> - <int key="NSCellFlags">-2080374784</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">on launch and re-activation</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="822012781"/> - <int key="NSTag">3</int> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <object class="NSButtonImageSource" key="NSAlternateImage" id="384857913"> - <string key="NSImageName">NSRadioButton</string> - </object> - <string key="NSAlternateContents"/> - <object class="NSMutableString" key="NSKeyEquivalent" id="415053684"> - <characters key="NS.bytes"/> - </object> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <object class="NSButtonCell" id="518120125"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">only when MacVim launches</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="822012781"/> - <int key="NSTag">1</int> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <reference key="NSAlternateImage" ref="384857913"/> - <reference key="NSAlternateContents" ref="415053684"/> - <reference key="NSKeyEquivalent" ref="415053684"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <object class="NSButtonCell" id="658108555"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">never</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="822012781"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <object class="NSImage" key="NSNormalImage" id="260066421"> - <int key="NSImageFlags">549453824</int> - <string key="NSSize">{18, 18}</string> - <array class="NSMutableArray" key="NSReps"> - <array> - <integer value="0"/> - <object class="NSBitmapImageRep"> - <object class="NSData" key="NSTIFFRepresentation"> - <bytes key="NS.bytes">TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw -IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ -29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 -dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA -AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG -AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ -0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ -7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ -5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ -3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD -AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns -AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ -6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ -/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ -///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl -YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA -AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD -AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu -AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgEAAAMAAAABABIAAAEB -AAMAAAABABIAAAECAAMAAAAEAAAFxgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES -AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS -AAMAAAABAAEAAAFTAAMAAAAEAAAFzodzAAcAABDoAAAF1gAAAAAACAAIAAgACAABAAEAAQABAAAQ6GFw -cGwCAAAAbW50clJHQiBYWVogB9gAAgACABEAIwAlYWNzcEFQUEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAPbWAAEAAAAA0y1hcHBsuR+jvsxNwCFjdjK72KIUegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAOclhZWgAAASwAAAAUZ1hZWgAAAUAAAAAUYlhZWgAAAVQAAAAUd3RwdAAAAWgAAAAUY2hhZAAA -AXwAAAAsclRSQwAAAagAAAAOZ1RSQwAAAbgAAAAOYlRSQwAAAcgAAAAOdmNndAAAAdgAAAYSbmRpbgAA -B+wAAAY+ZGVzYwAADiwAAABkZHNjbQAADpAAAAH+bW1vZAAAEJAAAAAoY3BydAAAELgAAAAtWFlaIAAA -AAAAAF/MAAA2wgAACVlYWVogAAAAAAAAcKYAALKbAAAm8lhZWiAAAAAAAAAmZAAAFr0AAKLaWFlaIAAA -AAAAAPNSAAEAAAABFs9zZjMyAAAAAAABDEIAAAXe///zJgAAB5IAAP2R///7ov///aMAAAPcAADAbGN1 -cnYAAAAAAAAAAQHNAABjdXJ2AAAAAAAAAAEBzQAAY3VydgAAAAAAAAABAc0AAHZjZ3QAAAAAAAAAAAAD -AQAAAgAAAQYC8AUGBgcIDAkHCw4MCw4RDwwRDRIXFBMWFhcVGRgaGBwbHRseHSAhISMjICQmJicnJigp -KiorLCwrLi8vLzAwMjMzMjQ1NjU3Njg3OTg7Ojw8PT4+Pj9AQUBCQ0NDRENFRkdGSElJSUpKS0xNTU5N -T09QUVFRUlNUUlVVVlZXV1hYWVhbXFxcXVxeXl9fYGFhYmJiY2NkZWVlZmZnZ2hoaWlqa2trbGxtbW5u -b3BwcHFxcnJzc3R0dXR2dnd4eHh5enp6e3x8fH18fn5/foCAgYGCgYODhISFhYaGh4eIiIkIiYmKiouL -jIuNjY6Oj4+QkJGRkpKTk5SUlZWWlpeXmJiZGJmZmpqbm5ycnZ2enp+foKChoaKio6OkI6SkpaWmpqen -qKipqaqqq6usrK2trq6vr7AvsLCxsbKys7O0tLW1tra3t7i4ubm6Obq6u7u8vL29vr6/v8DAwcHCQcLC -w8PExMXFxsbHx8jIyUjJycrKy8vMzM3Nzs7PTs/P0NDR0dLS09PUU9TU1dXW1tfX2NjZWNnZ2trb29zc -3Vzd3d7e39/g4OFg4eHi4uPj5OTlZOXl5ubn5+hn6Ojp6erq6+vsa+zs7e3u7u9u7+/w8PHx8nHy8vPz -9HP09PX19vb3dvf3+Pj5ePn5+vr7evv7/Pz9fP39/n3+/v//AAADBQP4BgcHBwgMCQcLDgwLDRIPCRAO -ERYTEhQUFRMWFRgUGRgbFxwbHSAfICAeISMjJCQjJSYmJygpKSgqKywsLS0uLy8uMTEyMjMyNDM1NDc2 -ODg5Ojo6Ozw9PD4/Pz9AP0FCQ0JERUVFRkZHSElJSklLS0xNTU1OTk9OUFBRUVJSU1NUU1VWVlZXVlhY -WlpbXFxdXV1eXl9gYGBhYWJiY2NkZGVmZmZoaGlpamprbGxsbW1ubm9vcHBxcHJyc3R0dHV2dnZ3eHh4 -eXh6ent6fHx9fX59f3+AgIGBgoKDg4SEhYWGhoeHiIiJiIqKi4uMjI2Njo6Pj5CQkZGSkpOTlJSVlZaW -l5eYmJmZmpqbm5ycnZ2enp+foB+goKGhoqKjo6SkpaWmpqenqKipqaqqq6usrK2trq6vr7AvsLCxsbKy -s7O0tLW1tra3t7i4ubm6urs6u7u8vL29vr6/v8DAwcHCwsPDxMTFxcbGx8fIyMnJysrLy8zMzc3Ozs/P -0NDR0dLS09PU1NVU1dXW1tfX2NjZ2dra29vc3N3d3t7f3+Dg4WDh4eLi4+Pk5OVk5eXm5ufn6Gfo6Onp -6mnq6uvr7OztbO3t7u7v7/Bv8PDx8fLy83Lz8/T09XT19fb293b39/j4+Xj5+fp5+vr7evv7/Pz9fP39 -/n3+/v9+//8AAAIEAvcEBQUFBgoHBQgLCQgKDQsIDAoNEA4NDooPDhAPEQ8SERMRE5EUFRUWFhQXGBgZ -GRgaGhqZGxwcGx0eHh4fHyAhISAiIiKhIyMkIyUkJiYnJygpKSkqKysqLC0tLS4tLy8wMDEyMjIzMzQ1 -NTU2NTc3N7c4ODk5Ojk7Ozw8PT0+Pj8+QEFBQUJBQ0NEREVFRcVGRkdHSElJSUpKS0tMTE1NTk5Ozk9P -UFBRUVJTU1NUVFTUVVVWVldWWFhZWVnZWltbW1xdXV1d3V5eX15gYGFhYeFiYmNjZGRlZWXlZmZnZ2ho -aWlqamtqbGxtbW5ub29wcHDwcXFycnNzdHR1dXZ2d3d4eHl5enp7e3x8fPx9fX5+f3+AgIGBggGCgoOD -hISFhYaGh4eIiIkIiYmKiouLjIyNjY6Oj4+QD5CQkZGSkpOTlJSVlZYVlpaXl5iYmZmampubnJydnZ6e -n5+gH6CgoaGioqOjpKSlpaamp6eoqKmpqqqrq6ysra2urq+vsLCxsbKys7O0tLW1tra3t7i4ubm6uru7 -vLy+vr+/wD/AwMHBwsLDw8TExcXGxsfHyMjJycrKy8vMzM3Nzs7Pz9DQ0dHS0tPT1NTV1dbW19fY2NnZ -2trb29zc3d3e3uDg4eHi4uTk5eXn5unp6+vt7fDw8/P29vn5/f3//wAAbmRpbgAAAAAAAAY2AACVGAAA -Vl8AAFFhAACIhgAAKTQAABaoAABQDQAAVDkAAl64AAJPXAABeFEAAwEAAAIAAAADAAYACwAQABYAJQAu -ADcATQBZAGUAgQCQAJ8AwQDSAOUBCwEgATUBSwFhAZABqAHBAfUCDwIrAmQCnwK9AtwDHAM9A18DowPG -A+oENAR/BKYEzQUdBXAFmgXEBhsGdAahBs8HLQeMB70H7ghSCLgJIAlUCYoJ9gpkCtULRwuBC7wMMgyr -DSYNog3hDiEOoQ8kD6kQLxBzELgRQxHPEl0S7hOAE8oUFRSrFUMV3RZ5FxcXZhe2GFgY/BmhGkga8Ruc -HEkc+B2oHlsfDx/FIH0hNyHyIrAjbyQwJPMltyZ+J0YoECjcKakqeStKLBws8S3HLqAveTBVMTMyEjLz -M9U0uTWgNoc3cThcOUk6ODsoPQ4+Az77P/RA7kHqQuhD6ETpRexG8Uf3SP9KCUsUTCFOQE9SUGZRe1KS -U6tUxVXhVv9YHlk/W4Vcq13SXvtgJWFSYn9jr2TgZhJnR2h8au1sKG1kbqJv4XEicmVzqXTvdjZ4yXoV -e2N8sn4Df1WAqYH/hK+GCYdliMKKIYuBjOOPrJESknuT5JVQlryZm5sMnH+d9J9qolqj1aVRps+oTqtR -rNSuWq/gsvK0frYLt5m6urxNveG/d8KnxEHF3ckZyrrMW83/0UrS8dSb1/HZn9tO3rHgZOPQ5YjnQeq5 -7Hbv9/G59UL3CPqa/jH//wAAAAAAAQADAAsAEAAWACUANwBNAFkAZQCBAJ8AsADBAOUBCwEgATUBYQGQ -AcEB2gH1AisCRwJkAp8C3AL8AxwDXwOjA8YD6gQ0BH8EzQT1BR0FcAXEBe8GGwZ0Bs8HLQdcB4wH7ghS -CLgJIAlUCYoJ9gpkCtULRwuBC7wMMgyrDSYNog3hDiEOoQ8kD6kQLxBzELgRQxHPEl0S7hOAFBUUqxVD -Fd0WeRcXF7YYWBj8GaEZ9BpIGvEbnBxJHPgdqB5bHw8fxSB9ITch8iKwIw8jbyQwJPMltyZ+J0YoECjc -KakqeStKLBws8S3HLqAveTBVMTMyEjLzM9U0uTWgNoc3cThcOUk6ODsoPBo9Dj4DPvs/9EDuQepC6EPo -ROlF7EbxR/dI/0oJSxRMIU0wTkBPUlBmUXtSklOrVMVV4Vb/WT9aYVuFXKtd0l77YCVhUmJ/Y69k4GYS -Z0dofGm0au1tZG6ib+FxInJlc6l073Y2d394yXoVfLJ+A39VgKmB/4NWhK+GCYdliMKKIYuBjOOOR4+s -kRKSe5PklVCWvJgrmZubDJx/nfSfaqJao9WlUabPqE6pzqtRrNSuWq/gsWmy8rYLt5m5Kbq6veG/d8EO -xEHF3ckZyrrMW8+j0UrS8dZF1/HZn9z/3rHiGePQ50Ho/Ox27/fzfPVC+ND8Zf//AAAAAQADAAsAFgAl -ADcATQBlAIEAnwDBAOUBCwE1AZABwQH1AisCZALcAxwDXwOjA+oENAR/BR0FcAXEBhsGdAbPBy0HjAhS -CLgJIAmKCfYKZArVC0cLvAwyDKsNJg2iDiEOoQ8kD6kQLxC4EUMRzxLuE4AUFRSrFUMV3RZ5FxcXthhY -GPwZoRpIGvEcSRz4HageWx8PH8UgfSE3IfIjbyQwJPMltyZ+J0Yo3CmpKnkrSiwcLccuoC95MFUyEjLz -M9U0uTaHN3E4XDlJOyg8Gj0OPgM++z/0QO5B6kLoQ+hE6UbxR/dI/0oJSxRMIU0wTkBPUlBmUXtSklTF -VeFW/1geWT9bhVyrXdJe+2AlYVJif2TgZhJnR2h8abRq7WwobqJv4XEicmVzqXTvd394yXoVe2N8sn4D -f1WAqYH/g1aGCYdliMKKIYuBjOOOR4+skRKSe5PklVCWvJgrmZubDJx/nfSfaqDholqj1aVRps+oTqnO -q1Gs1K5arx2v4LFptH62C7eZuSm6urxNveG/d8EOwqfEQcXdx3vJGcq6zFvN/8+j0UrS8dSb1kXX8dmf -207c/96x4GTiGePQ5YjmZOdB6PzqueuX7HbuNu8W7/fw1/G58przfPRf9UL12fZw9wj3oPg4+ND5afoB -+pr7M/vM/GX82P1L/b7+Mf8Y//8AAGRlc2MAAAAAAAAACkNvbG9yIExDRAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AABtbHVjAAAAAAAAAA8AAAAMaXRJVAAAABQAAADEZnJGUgAAAEIAAADYbmJOTwAAABIAAAEaZXNFUwAA -ABIAAAEsZmlGSQAAABAAAAE+cHRQVAAAABgAAAFOemhUVwAAAA4AAAFmamFKUAAAAA4AAAF0bmxOTAAA -ABYAAAGCZGVERQAAABAAAAGYa29LUgAAAAwAAAGoZW5VUwAAABIAAAG0c3ZTRQAAABAAAAHGZGFESwAA -ABwAAAHWemhDTgAAAAwAAAHyAEwAQwBEACAAYwBvAGwAbwByAGkAyQBjAHIAYQBuACAA4AAgAGMAcgBp -AHMAdABhAHUAeAAgAGwAaQBxAHUAaQBkAGUAcwAgAGMAbwB1AGwAZQB1AHIARgBhAHIAZwBlAC0ATABD -AEQATABDAEQAIABjAG8AbABvAHIAVgDkAHIAaQAtAEwAQwBEAEwAQwBEACAAYwBvAGwAbwByAGkAZABv -X2mCcm2yZnaYb3k6VmgwqzDpMPwAIABMAEMARABLAGwAZQB1AHIAZQBuAC0ATABDAEQARgBhAHIAYgAt -AEwAQwBEzuy37AAgAEwAQwBEAEMAbwBsAG8AcgAgAEwAQwBEAEYA5AByAGcALQBMAEMARABMAEMARAAt -AGYAYQByAHYAZQBzAGsA5gByAG1faYJyACAATABDAEQAAG1tb2QAAAAAAAAGEAAAnEUAAAAAvnORAAAA -AAAAAAAAAAAAAAAAAAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAA -AAA</bytes> - </object> - </object> - </array> - </array> - <object class="NSColor" key="NSColor" id="819646946"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MCAwAA</bytes> - </object> - </object> - <reference key="NSAlternateImage" ref="384857913"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </array> - <string key="NSCellSize">{243, 18}</string> - <string key="NSIntercellSpacing">{4, 2}</string> - <int key="NSMatrixFlags">1143472128</int> - <string key="NSCellClass">NSActionCell</string> - <object class="NSButtonCell" key="NSProtoCell" id="247936776"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Radio</string> - <reference key="NSSupport" ref="398275172"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <reference key="NSNormalImage" ref="260066421"/> - <reference key="NSAlternateImage" ref="384857913"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - <reference key="NSSelectedCell" ref="281424572"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <object class="NSColor" key="NSCellBackgroundColor" id="208863654"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - </object> - <reference key="NSFont" ref="398275172"/> - </object> - <object class="NSMatrix" id="1037211080"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{209, 141}, {243, 38}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="117328484"/> - <bool key="NSEnabled">YES</bool> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - <int key="NSNumRows">2</int> - <int key="NSNumCols">1</int> - <array class="NSMutableArray" key="NSCells"> - <object class="NSButtonCell" id="425844147"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">in a new window</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="1037211080"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <reference key="NSAlternateImage" ref="384857913"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <object class="NSButtonCell" id="27368204"> - <int key="NSCellFlags">-2080374784</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">in the current window</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="1037211080"/> - <int key="NSTag">1</int> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <object class="NSImage" key="NSNormalImage"> - <int key="NSImageFlags">549453824</int> - <string key="NSSize">{18, 18}</string> - <array class="NSMutableArray" key="NSReps"> - <array> - <integer value="0"/> - <object class="NSBitmapImageRep"> - <object class="NSData" key="NSTIFFRepresentation"> - <bytes key="NS.bytes">TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw -IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ -29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 -dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA -AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG -AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ -0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ -7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ -5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ -3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD -AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns -AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ -6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ -/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ -///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl -YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA -AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD -AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu -AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgEAAAMAAAABABIAAAEB -AAMAAAABABIAAAECAAMAAAAEAAAFxgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES -AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS -AAMAAAABAAEAAAFTAAMAAAAEAAAFzodzAAcAAAwYAAAF1gAAAAAACAAIAAgACAABAAEAAQABAAAMGGFw -cGwCAAAAbW50clJHQiBYWVogB9YABAADABMALAASYWNzcEFQUEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAPbWAAEAAAAA0y1hcHBsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAOclhZWgAAASwAAAAUZ1hZWgAAAUAAAAAUYlhZWgAAAVQAAAAUd3RwdAAAAWgAAAAUY2hhZAAA -AXwAAAAsclRSQwAAAagAAAAOZ1RSQwAAAbgAAAAOYlRSQwAAAcgAAAAOdmNndAAAAdgAAAMSbmRpbgAA -BOwAAAY+ZGVzYwAACywAAABkZHNjbQAAC5AAAAAubW1vZAAAC8AAAAAoY3BydAAAC+gAAAAtWFlaIAAA -AAAAAF1KAAA0kQAACCVYWVogAAAAAAAAdCAAALRgAAAjPVhZWiAAAAAAAAAlbAAAFyoAAKfDWFlaIAAA -AAAAAPNSAAEAAAABFs9zZjMyAAAAAAABDEIAAAXe///zJgAAB5IAAP2R///7ov///aMAAAPcAADAbGN1 -cnYAAAAAAAAAAQHNAABjdXJ2AAAAAAAAAAEBzQAAY3VydgAAAAAAAAABAc0AAHZjZ3QAAAAAAAAAAAAD -AQAAAQACBAUGBwkKCw0ODxASExQWFxgaGxweHyAiIyQmJygpKywtLzAxMjM1Njc4OTs8PT5AQUJDREZH -SElKS0xOT1BRUlNUVVZXWFlaW1xdXl9hYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gIGCg4SF -hoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnZ6foKGio6SlpqanqKmqq6ytra6vsLGysrO0tba3uLi5uru8 -vL2+v8DBwcLDxMXGxsfIycrKy8zNzs7P0NHS0tPU1dbW19jZ2drb3Nzd3t/g4eLi4+Tl5ufo6enq6+zt -7u/w8fHy8/T19vf4+fr7/P3+/v8AAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR8gISIjJCUnKCkq -Ky0uLzAxMzQ1Njc4OTo7PD0/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaWltcXV5fYGFiY2RlZmdo -aWprbG1ub3BxcnN0dXZ3d3h5ent8fH1+f4CBgoKDhIWGh4iIiYqLjI2Oj5CRkpOUlJWWl5iZmpucnZ2e -n6ChoqOkpaamp6ipqqusra6vsLCxsrO0tba3uLm5uru8vb6/wMHCw8TFx8jJysvMzc7P0NDR0tPU1dbX -2Nna29ze3+Dh4uPk5ebn6err7O3u7/Hy8/T19vf5+vv8/f7/AAIDAwQFBgcICQoKCwwNDg8QERITFBUW -FxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODg5Ojs8PT4+P0BBQkNDREVGR0hJSUpLTE1O -Tk9QUVJSU1RVVVZXWFhZWltbXF1eXl9gYWFiY2RkZWZnZ2hpaWprbGxtbm5vcHFxcnNzdHV1dnd4eHl6 -ent8fH1+fn+AgYGCg4SEhYaHiImJiouMjY6Oj5CRkpOTlJWWl5iZmZqbnJ2en6ChoqOkpaanqKmqq6yt -rq+xsrO0tba3uLq7vL2+wMHDxMbHycrMzs/R0tTW19nb3d7g4uTm6Ors7vDy9Pb4+vz+/wAAbmRpbgAA -AAAAAAY2AACXGgAAVjoAAFPKAACJ3gAAJ8IAABaoAABQDQAAVDkAAiuFAAIZmQABeFEAAwEAAAIAAAAA -AAEABgANABcAIwAxAEAAUgBlAHsAkwCrAMUA4gD/AR8BPwFhAYUBqgHQAfgCIAJLAncCpQLSAwIDMwNl -A5gDzgQFBD0EdQSvBOsFKQVnBacF6AYqBm4GtQb8B0UHkgfkCDkIkAjnCT4JmAn0ClAKrQsLC2sLygwq -DIwM8Q1XDcAOKA6SDv4PbA/bEE0QxBE7EbQSMRKwEzITuRREFNAVYBXxFocXHhfAGGIZBBmsGlQa+RuU -HC4czh1yHhQeux9jIA0gvCFoIhkizyOJJEEk+SW6JnknOygFKMspkypiKzIsASzXLawuhy9gMD4xGzH8 -MtszvzSgNYY2cjdcOEw5OTorOxs8CD0EPfU+6z/nQOFB2ELUQ9VE00XcRttH5EjxSgBLCUwdTTFOUE9v -UI9Rt1LdVAVVNlZsV6VY4FohW21ct135X09goGH0Y0tkqGYFZ19oxGova5ptCG54b/BxbnLsdG119Xd/ -eQh6knwqfcV/W4D4gpSEO4Xih4CJKorYjIqOOY/jkZuTWJUOlsyYiZpSnB6d4Z+soX+jWqUvpxOo+6rj -rMuuwLC4sra0rra0uL+60LzfvwDBHcLdxLXGhchYyi7MCs3lz7rRmtOA1WPXR9kq2xPc/97s4M/iveSn -5o3obupT7ELuLPAM8fLz0PW396H5f/tZ/T3//wAAAAEAAwALABYAJQA3AE0AZQCBAJ8AwQDlAQsBNQFh -AZABwQH1AisCZAKfAtwDHANfA6MD6gQ0BH8EzQT1BR0FcAXEBhsGdAbPBy0HXAeMB+4IUgi4CSAJVAmK -CfYKZArVC0cLgQu8DDIMqw0mDaIOIQ6hDyQPqRAvELgQ/RFDEc8SXRLuE4AUFRSrFUMV3RZ5FxcXthhY -GPwZoRpIGvEbnBxJHPgdqB5bHw8fxSB9ITch8iKwJDAk8yW3Jn4nRigQKNwpqSp5K0osHCzxLccuoC95 -MFUxMzISMvMz1TS5NaA2hzdxOFw5STo4Oyg8Gj4DPvs/9EDuQepD6ETpRexG8Uf3SP9LFEwhTTBOQE9S -UGZSklOrVMVV4Vb/WB5ZP1phW4Vcq13SXvthUmJ/Y69k4GYSZ0dofGm0au1tZG6ib+FxInJlc6l073Y2 -d396FXtjfLJ+A39VgKmB/4NWhK+GCYjCiiGLgYzjjkePrJESknuT5Ja8mCuZm5sMnH+d9J9qoOGiWqPV -pVGmz6eOqE6pzqtRrNSuWq/gsWmy8rR+tgu5Kbq6vE294b93wQ7Cp8RBxd3He8kZyrrLisxbzf/Po9FK -0vHUm9ZF1/HZn9tO3Cbc/96x4GTiGePQ5YjnQegf6Pzquex27jbv9/G583z0X/VC9wj40Pqa/GX+Mf// -AAAAAQADAAsAJQA3AE0AZQCBAJ8AwQELATUBYQGQAcEB9QIrAmQCnwLcAxwDXwOjA+oENAR/BM0FHQVw -BcQGGwZ0Bs8HLQeMB+4IUgi4CSAJign2CmQK1QtHC7wMMgyrDSYNog4hDqEPJA+pEC8QuBFDEl0S7hOA -FBUUqxVDFnkXFxe2GFgY/BpIGvEbnBxJHPgdqB8PH8UgfSE3IfIjbyQwJPMltydGKBAo3Cp5K0osHC3H -LqAveTEzMhIy8zS5NaA2hzhcOUk6ODwaPQ4+Az/0QO5C6EPoROlG8Uf3SglLFEwhTkBPUlF7UpJUxVXh -Vv9ZP1phXKtd0mAlYVJjr2TgZhJofGm0au1tZG6ib+FxInJldO92Nnd/eMl6FXyyfgN/VYCpgf+Er4YJ -h2WIwoohi4GOR4+skRKSe5PklVCWvJgrmZubDJx/nfSfaqDholqj1aVRps+oTqnOq1Gs1K2Xrlqv4LFp -svK0frYLt5m5Kbnxurq8Tb3hv3fBDsHawqfEQcUPxd3He8hKyRnKusuKzFvN/87Rz6PQdtFK0vHTxtSb -1kXXG9fx2MjZn9tO3Cbc/93Y3rHfiuBk4hni9ePQ5KzliOZk50HoH+j86drqueuX7HbtVu427xbv9/DX -8bnymvN89F/1QvYl9wj37PjQ+bX6mvt//GX9S/4x//8AAGRlc2MAAAAAAAAACkNvbG9yIExDRAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAABIAAAAcAEMAbwBsAG8AcgAgAEwAQwBE -AABtbW9kAAAAAAAABhAAAJxOAAAAAL5zkQAAAAAAAAAAAAAAAAAAAAAAdGV4dAAAAABDb3B5cmlnaHQg -QXBwbGUgQ29tcHV0ZXIsIEluYy4sIDIwMDUAAAAAA</bytes> - </object> - </object> - </array> - </array> - <reference key="NSColor" ref="819646946"/> - </object> - <reference key="NSAlternateImage" ref="384857913"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </array> - <string key="NSCellSize">{243, 18}</string> - <string key="NSIntercellSpacing">{4, 2}</string> - <int key="NSMatrixFlags">1151868928</int> - <string key="NSCellClass">NSActionCell</string> - <object class="NSButtonCell" key="NSProtoCell" id="244203214"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Radio</string> - <reference key="NSSupport" ref="398275172"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">0</int> - <object class="NSImage" key="NSNormalImage"> - <int key="NSImageFlags">549453824</int> - <string key="NSSize">{18, 18}</string> - <array class="NSMutableArray" key="NSReps"> - <array> - <integer value="0"/> - <object class="NSBitmapImageRep"> - <object class="NSData" key="NSTIFFRepresentation"> - <bytes key="NS.bytes">TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw -IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ -29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 -dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA -AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG -AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ -0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ -7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ -5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ -3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD -AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns -AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ -6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ -/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ -///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl -YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA -AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD -AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu -AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQEAAAMAAAABABIAAAEB -AAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES -AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS -AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> - </object> - </object> - </array> - </array> - <reference key="NSColor" ref="819646946"/> - </object> - <reference key="NSAlternateImage" ref="384857913"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - <int key="NSSelectedRow">1</int> - <reference key="NSSelectedCell" ref="27368204"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSCellBackgroundColor" ref="208863654"/> - <reference key="NSFont" ref="398275172"/> - </object> - <object class="NSTextField" id="193610391"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{209, 47}, {243, 58}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="633385838"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="883406409"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">4194304</int> - <string key="NSContents">This applies to files opened from the Finder (e.g. by double-clicking on a file or by dragging a file onto the MacVim dock icon) or from external programs such as Xcode. </string> - <object class="NSFont" key="NSSupport" id="26"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">11</double> - <int key="NSfFlags">3100</int> - </object> - <reference key="NSControlView" ref="193610391"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <object class="NSColor" key="NSTextColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">disabledControlTextColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes> - </object> - </object> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSButton" id="129690007"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{207, 186}, {258, 18}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="176759725"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="675317341"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Check for updates</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="129690007"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">2</int> - <object class="NSCustomResource" key="NSNormalImage" id="385062508"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSSwitch</string> - </object> - <object class="NSButtonImageSource" key="NSAlternateImage" id="426852917"> - <string key="NSImageName">NSSwitch</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="663739951"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{17, 187}, {187, 17}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="129690007"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="792298085"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">71303168</int> - <string key="NSContents">When MacVim launches:</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="663739951"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSTextColor" ref="481736603"/> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSPopUpButton" id="117328484"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{218, 109}, {229, 26}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="193610391"/> - <bool key="NSEnabled">YES</bool> - <object class="NSPopUpButtonCell" key="NSCell" id="849683822"> - <int key="NSCellFlags">-2076180416</int> - <int key="NSCellFlags2">2048</int> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="117328484"/> - <int key="NSButtonFlags">109199360</int> - <int key="NSButtonFlags2">1</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - <object class="NSMenuItem" key="NSMenuItem" id="344711749"> - <reference key="NSMenu" ref="153578709"/> - <string key="NSTitle">and set the arglist</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <int key="NSState">1</int> - <object class="NSCustomResource" key="NSOnImage" id="645469295"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuCheckmark</string> - </object> - <object class="NSCustomResource" key="NSMixedImage" id="278069911"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuMixedState</string> - </object> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="849683822"/> - </object> - <bool key="NSMenuItemRespectAlignment">YES</bool> - <object class="NSMenu" key="NSMenu" id="153578709"> - <string key="NSTitle">OtherViews</string> - <array class="NSMutableArray" key="NSMenuItems"> - <object class="NSMenuItem" id="239631101"> - <reference key="NSMenu" ref="153578709"/> - <string key="NSTitle">with a tab for each file</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">3</int> - <reference key="NSTarget" ref="849683822"/> - </object> - <object class="NSMenuItem" id="1070109604"> - <reference key="NSMenu" ref="153578709"/> - <string key="NSTitle">with a window for each file</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">4</int> - <reference key="NSTarget" ref="849683822"/> - </object> - <object class="NSMenuItem" id="7036145"> - <reference key="NSMenu" ref="153578709"/> - <string key="NSTitle">with a split for each file</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">1</int> - <reference key="NSTarget" ref="849683822"/> - </object> - <reference ref="344711749"/> - </array> - </object> - <int key="NSSelectedIndex">3</int> - <int key="NSPreferredEdge">1</int> - <bool key="NSUsesItemFromMenu">YES</bool> - <bool key="NSAltersState">YES</bool> - <int key="NSArrowPosition">2</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="633385838"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{17, 22}, {187, 17}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="1066463960"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="829992130"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">71303168</int> - <string key="NSContents">After last window closes:</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="633385838"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSTextColor" ref="481736603"/> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSPopUpButton" id="1066463960"> - <reference key="NSNextResponder" ref="225936320"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{206, 16}, {197, 26}}</string> - <reference key="NSSuperview" ref="225936320"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> - <bool key="NSEnabled">YES</bool> - <object class="NSPopUpButtonCell" key="NSCell" id="218536534"> - <int key="NSCellFlags">-2076180416</int> - <int key="NSCellFlags2">2048</int> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="1066463960"/> - <int key="NSButtonFlags">109199360</int> - <int key="NSButtonFlags2">1</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - <object class="NSMenuItem" key="NSMenuItem" id="815121592"> - <reference key="NSMenu" ref="249595117"/> - <string key="NSTitle">Keep MacVim Running</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <int key="NSState">1</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="218536534"/> - </object> - <bool key="NSMenuItemRespectAlignment">YES</bool> - <object class="NSMenu" key="NSMenu" id="249595117"> - <string key="NSTitle">OtherViews</string> - <array class="NSMutableArray" key="NSMenuItems"> - <reference ref="815121592"/> - <object class="NSMenuItem" id="754706954"> - <reference key="NSMenu" ref="249595117"/> - <string key="NSTitle">Hide MacVim</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="218536534"/> - </object> - <object class="NSMenuItem" id="657202501"> - <reference key="NSMenu" ref="249595117"/> - <string key="NSTitle">Quit MacVim</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="645469295"/> - <reference key="NSMixedImage" ref="278069911"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="218536534"/> - </object> - </array> - </object> - <int key="NSPreferredEdge">1</int> - <bool key="NSUsesItemFromMenu">YES</bool> - <bool key="NSAltersState">YES</bool> - <int key="NSArrowPosition">2</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - </array> - <string key="NSFrameSize">{483, 290}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="832513823"/> - <string key="NSClassName">NSView</string> - </object> - <object class="NSCustomView" id="836854791"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">268</int> - <array class="NSMutableArray" key="NSSubviews"> - <object class="NSButton" id="1062985527"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 50}, {388, 18}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="209959448"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="37046570"> - <int key="NSCellFlags">-2080374784</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Prefer native full-screen support (requires Mac OS X 10.7)</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="1062985527"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">2</int> - <reference key="NSNormalImage" ref="385062508"/> - <reference key="NSAlternateImage" ref="426852917"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="209959448"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 20}, {415, 28}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="485630420"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">272760832</int> - <string key="NSContents">You may want to disable this option when using multiple monitors since the native full-screen support renders secondary monitors useless.</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="209959448"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <object class="NSColor" key="NSTextColor" id="1006868929"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC41AA</bytes> - </object> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSButton" id="818542525"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 146}, {174, 18}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="536705090"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="948343868"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Draw marked text inline</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="818542525"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">2</int> - <reference key="NSNormalImage" ref="385062508"/> - <reference key="NSAlternateImage" ref="426852917"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="536705090"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 74}, {444, 70}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="1062985527"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="581527358"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">272760832</int> - <string key="NSContents">This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to "dead keys" may not work). Note that without this option the Core Text renderer will not draw marked text at all.</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="536705090"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSTextColor" ref="1006868929"/> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSButton" id="747671808"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 282}, {174, 18}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="864999293"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="266098397"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Use Core Text renderer</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="747671808"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">2</int> - <reference key="NSNormalImage" ref="385062508"/> - <reference key="NSAlternateImage" ref="426852917"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="864999293"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 252}, {449, 28}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="538640217"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="526715553"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">272760832</int> - <string key="NSContents">Selecting this option will increase rendering performance but double-tapping with three fingers to look up words will no longer work.</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="864999293"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <reference key="NSTextColor" ref="1006868929"/> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSButton" id="538640217"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 228}, {133, 18}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="202792916"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="1057999425"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Enable Quickstart</string> - <reference key="NSSupport" ref="398275172"/> - <reference key="NSControlView" ref="538640217"/> - <int key="NSButtonFlags">1211912448</int> - <int key="NSButtonFlags2">2</int> - <reference key="NSNormalImage" ref="385062508"/> - <reference key="NSAlternateImage" ref="426852917"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - <object class="NSTextField" id="202792916"> - <reference key="NSNextResponder" ref="836854791"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 170}, {449, 56}}</string> - <reference key="NSSuperview" ref="836854791"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="818542525"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="894089534"> - <int key="NSCellFlags">67108864</int> - <int key="NSCellFlags2">272760832</int> - <string key="NSContents">New windows open instantaneously with Quickstart enabled but they may not have the latest runtime files sourced. If you modify your runtime files (e.g files inside the ~/.vim directory) then you may need to disable and re-enable Quickstart to ensure that the next window you open will pick up on those changes.</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="202792916"/> - <reference key="NSBackgroundColor" ref="821672772"/> - <object class="NSColor" key="NSTextColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC41AA</bytes> - <object class="NSColorSpace" key="NSCustomColorSpace"> - <int key="NSID">2</int> - </object> - </object> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - </object> - </array> - <string key="NSFrameSize">{483, 318}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="747671808"/> - <string key="NSClassName">NSView</string> - </object> - </array> - <object class="IBObjectContainer" key="IBDocument.Objects"> - <array class="NSMutableArray" key="connectionRecords"> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">generalPreferences</string> - <reference key="source" ref="816709129"/> - <reference key="destination" ref="225936320"/> - </object> - <int key="connectionID">143</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">openInCurrentWindowSelectionChanged:</string> - <reference key="source" ref="816709129"/> - <reference key="destination" ref="1037211080"/> - </object> - <int key="connectionID">572</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">layoutPopUpButton</string> - <reference key="source" ref="816709129"/> - <reference key="destination" ref="117328484"/> - </object> - <int key="connectionID">596</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">advancedPreferences</string> - <reference key="source" ref="816709129"/> - <reference key="destination" ref="836854791"/> - </object> - <int key="connectionID">632</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickstartButtonClicked:</string> - <reference key="source" ref="809429266"/> - <reference key="destination" ref="538640217"/> - </object> - <int key="connectionID">858</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">atsuiButtonClicked:</string> - <reference key="source" ref="809429266"/> - <reference key="destination" ref="747671808"/> - </object> - <int key="connectionID">892</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">selectedTag: values.MMUntitledWindow</string> - <reference key="source" ref="822012781"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="822012781"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">selectedTag: values.MMUntitledWindow</string> - <string key="NSBinding">selectedTag</string> - <string key="NSKeyPath">values.MMUntitledWindow</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">171</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">selectedTag: values.MMOpenInCurrentWindow</string> - <reference key="source" ref="1037211080"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="1037211080"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">selectedTag: values.MMOpenInCurrentWindow</string> - <string key="NSBinding">selectedTag</string> - <string key="NSKeyPath">values.MMOpenInCurrentWindow</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">520</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.SUCheckAtStartup</string> - <reference key="source" ref="129690007"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="129690007"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">value: values.SUCheckAtStartup</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.SUCheckAtStartup</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">169</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">selectedTag: values.MMOpenLayout</string> - <reference key="source" ref="117328484"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="117328484"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">selectedTag: values.MMOpenLayout</string> - <string key="NSBinding">selectedTag</string> - <string key="NSKeyPath">values.MMOpenLayout</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">441</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">enabled: values.MMOpenInCurrentWindow</string> - <reference key="source" ref="1070109604"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="1070109604"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">enabled: values.MMOpenInCurrentWindow</string> - <string key="NSBinding">enabled</string> - <string key="NSKeyPath">values.MMOpenInCurrentWindow</string> - <object class="NSDictionary" key="NSOptions"> - <string key="NS.key.0">NSValueTransformerName</string> - <string key="NS.object.0">NSNegateBoolean</string> - </object> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">546</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.MMRenderer</string> - <reference key="source" ref="747671808"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="747671808"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">value: values.MMRenderer</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.MMRenderer</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">1000</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.MMPreloadCacheSize</string> - <reference key="source" ref="538640217"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="538640217"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">value: values.MMPreloadCacheSize</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.MMPreloadCacheSize</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">828</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">selectedIndex: values.MMLastWindowClosedBehavior</string> - <reference key="source" ref="1066463960"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="1066463960"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">selectedIndex: values.MMLastWindowClosedBehavior</string> - <string key="NSBinding">selectedIndex</string> - <string key="NSKeyPath">values.MMLastWindowClosedBehavior</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">968</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.MMUseInlineIm</string> - <reference key="source" ref="818542525"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="818542525"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">value: values.MMUseInlineIm</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.MMUseInlineIm</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">1016</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.MMNativeFullScreen</string> - <reference key="source" ref="1062985527"/> - <reference key="destination" ref="547503666"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="1062985527"/> - <reference key="NSDestination" ref="547503666"/> - <string key="NSLabel">value: values.MMNativeFullScreen</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.MMNativeFullScreen</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">1031</int> - </object> - </array> - <object class="IBMutableOrderedSet" key="objectRecords"> - <array key="orderedObjects"> - <object class="IBObjectRecord"> - <int key="objectID">0</int> - <array key="object" id="0"/> - <reference key="children" ref="797097783"/> - <nil key="parent"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-2</int> - <reference key="object" ref="816709129"/> - <reference key="parent" ref="0"/> - <string key="objectName">File's Owner</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-1</int> - <reference key="object" ref="809429266"/> - <reference key="parent" ref="0"/> - <string key="objectName">First Responder</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-3</int> - <reference key="object" ref="214904313"/> - <reference key="parent" ref="0"/> - <string key="objectName">Application</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">58</int> - <reference key="object" ref="547503666"/> - <reference key="parent" ref="0"/> - <string key="objectName">Shared Defaults</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">115</int> - <reference key="object" ref="225936320"/> - <array class="NSMutableArray" key="children"> - <reference ref="176759725"/> - <reference ref="832513823"/> - <reference ref="822012781"/> - <reference ref="1037211080"/> - <reference ref="193610391"/> - <reference ref="129690007"/> - <reference ref="663739951"/> - <reference ref="633385838"/> - <reference ref="117328484"/> - <reference ref="1066463960"/> - </array> - <reference key="parent" ref="0"/> - <string key="objectName">General</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">116</int> - <reference key="object" ref="176759725"/> - <array class="NSMutableArray" key="children"> - <reference ref="550807035"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">117</int> - <reference key="object" ref="832513823"/> - <array class="NSMutableArray" key="children"> - <reference ref="434136918"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">119</int> - <reference key="object" ref="822012781"/> - <array class="NSMutableArray" key="children"> - <reference ref="658108555"/> - <reference ref="518120125"/> - <reference ref="281424572"/> - <reference ref="247936776"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">137</int> - <reference key="object" ref="658108555"/> - <reference key="parent" ref="822012781"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">138</int> - <reference key="object" ref="518120125"/> - <reference key="parent" ref="822012781"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">139</int> - <reference key="object" ref="281424572"/> - <reference key="parent" ref="822012781"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">120</int> - <reference key="object" ref="1037211080"/> - <array class="NSMutableArray" key="children"> - <reference ref="27368204"/> - <reference ref="425844147"/> - <reference ref="244203214"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">134</int> - <reference key="object" ref="27368204"/> - <reference key="parent" ref="1037211080"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">135</int> - <reference key="object" ref="425844147"/> - <reference key="parent" ref="1037211080"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">121</int> - <reference key="object" ref="193610391"/> - <array class="NSMutableArray" key="children"> - <reference ref="883406409"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">122</int> - <reference key="object" ref="129690007"/> - <array class="NSMutableArray" key="children"> - <reference ref="675317341"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">124</int> - <reference key="object" ref="663739951"/> - <array class="NSMutableArray" key="children"> - <reference ref="792298085"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">126</int> - <reference key="object" ref="633385838"/> - <array class="NSMutableArray" key="children"> - <reference ref="829992130"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">427</int> - <reference key="object" ref="117328484"/> - <array class="NSMutableArray" key="children"> - <reference ref="849683822"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">957</int> - <reference key="object" ref="1066463960"/> - <array class="NSMutableArray" key="children"> - <reference ref="218536534"/> - </array> - <reference key="parent" ref="225936320"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">620</int> - <reference key="object" ref="836854791"/> - <array class="NSMutableArray" key="children"> - <reference ref="202792916"/> - <reference ref="538640217"/> - <reference ref="864999293"/> - <reference ref="747671808"/> - <reference ref="536705090"/> - <reference ref="818542525"/> - <reference ref="209959448"/> - <reference ref="1062985527"/> - </array> - <reference key="parent" ref="0"/> - <string key="objectName">Advanced</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">782</int> - <reference key="object" ref="747671808"/> - <array class="NSMutableArray" key="children"> - <reference ref="266098397"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">815</int> - <reference key="object" ref="864999293"/> - <array class="NSMutableArray" key="children"> - <reference ref="526715553"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">817</int> - <reference key="object" ref="538640217"/> - <array class="NSMutableArray" key="children"> - <reference ref="1057999425"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">826</int> - <reference key="object" ref="202792916"/> - <array class="NSMutableArray" key="children"> - <reference ref="894089534"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">972</int> - <reference key="object" ref="550807035"/> - <reference key="parent" ref="176759725"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">973</int> - <reference key="object" ref="434136918"/> - <reference key="parent" ref="832513823"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">974</int> - <reference key="object" ref="883406409"/> - <reference key="parent" ref="193610391"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">975</int> - <reference key="object" ref="675317341"/> - <reference key="parent" ref="129690007"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">976</int> - <reference key="object" ref="792298085"/> - <reference key="parent" ref="663739951"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">977</int> - <reference key="object" ref="829992130"/> - <reference key="parent" ref="633385838"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">978</int> - <reference key="object" ref="849683822"/> - <array class="NSMutableArray" key="children"> - <reference ref="153578709"/> - </array> - <reference key="parent" ref="117328484"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">979</int> - <reference key="object" ref="218536534"/> - <array class="NSMutableArray" key="children"> - <reference ref="249595117"/> - </array> - <reference key="parent" ref="1066463960"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">990</int> - <reference key="object" ref="266098397"/> - <reference key="parent" ref="747671808"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">991</int> - <reference key="object" ref="526715553"/> - <reference key="parent" ref="864999293"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">992</int> - <reference key="object" ref="1057999425"/> - <reference key="parent" ref="538640217"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">993</int> - <reference key="object" ref="894089534"/> - <reference key="parent" ref="202792916"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">996</int> - <reference key="object" ref="247936776"/> - <reference key="parent" ref="822012781"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">997</int> - <reference key="object" ref="244203214"/> - <reference key="parent" ref="1037211080"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">429</int> - <reference key="object" ref="153578709"/> - <array class="NSMutableArray" key="children"> - <reference ref="1070109604"/> - <reference ref="344711749"/> - <reference ref="7036145"/> - <reference ref="239631101"/> - </array> - <reference key="parent" ref="849683822"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">544</int> - <reference key="object" ref="1070109604"/> - <reference key="parent" ref="153578709"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">436</int> - <reference key="object" ref="344711749"/> - <reference key="parent" ref="153578709"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">431</int> - <reference key="object" ref="7036145"/> - <reference key="parent" ref="153578709"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">430</int> - <reference key="object" ref="239631101"/> - <reference key="parent" ref="153578709"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">959</int> - <reference key="object" ref="249595117"/> - <array class="NSMutableArray" key="children"> - <reference ref="657202501"/> - <reference ref="754706954"/> - <reference ref="815121592"/> - </array> - <reference key="parent" ref="218536534"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">962</int> - <reference key="object" ref="657202501"/> - <reference key="parent" ref="249595117"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">961</int> - <reference key="object" ref="754706954"/> - <reference key="parent" ref="249595117"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">960</int> - <reference key="object" ref="815121592"/> - <reference key="parent" ref="249595117"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1001</int> - <reference key="object" ref="536705090"/> - <array class="NSMutableArray" key="children"> - <reference ref="581527358"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1004</int> - <reference key="object" ref="581527358"/> - <reference key="parent" ref="536705090"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1013</int> - <reference key="object" ref="818542525"/> - <array class="NSMutableArray" key="children"> - <reference ref="948343868"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1014</int> - <reference key="object" ref="948343868"/> - <reference key="parent" ref="818542525"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1017</int> - <reference key="object" ref="209959448"/> - <array class="NSMutableArray" key="children"> - <reference ref="485630420"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1020</int> - <reference key="object" ref="485630420"/> - <reference key="parent" ref="209959448"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1028</int> - <reference key="object" ref="1062985527"/> - <array class="NSMutableArray" key="children"> - <reference ref="37046570"/> - </array> - <reference key="parent" ref="836854791"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1029</int> - <reference key="object" ref="37046570"/> - <reference key="parent" ref="1062985527"/> - </object> - </array> - </object> - <dictionary class="NSMutableDictionary" key="flattenedProperties"> - <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1001.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1004.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1013.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1014.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1017.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1020.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1028.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1029.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="115.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="116.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="117.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="119.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="120.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="121.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="122.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="126.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="134.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="135.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="137.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="138.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="139.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="427.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="429.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="430.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="431.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="436.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="544.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="620.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="782.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="815.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="817.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="826.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="957.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="959.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="960.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="961.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="962.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="972.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="973.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="974.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="975.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="976.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="977.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="978.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="979.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="990.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="991.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="992.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="993.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="996.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="997.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> - <nil key="activeLocalization"/> - <dictionary class="NSMutableDictionary" key="localizations"/> - <nil key="sourceID"/> - <int key="maxID">1031</int> - </object> - <object class="IBClassDescriber" key="IBDocument.Classes"> - <array class="NSMutableArray" key="referencedPartialClassDescriptions"> - <object class="IBPartialClassDescription"> - <string key="className">DBPrefsWindowController</string> - <string key="superclassName">NSWindowController</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/DBPrefsWindowController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">FirstResponder</string> - <dictionary class="NSMutableDictionary" key="actions"> - <string key="atsuiButtonClicked:">id</string> - <string key="loginShellButtonClicked:">id</string> - <string key="quickstartButtonClicked:">id</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="actionInfosByName"> - <object class="IBActionInfo" key="atsuiButtonClicked:"> - <string key="name">atsuiButtonClicked:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="loginShellButtonClicked:"> - <string key="name">loginShellButtonClicked:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="quickstartButtonClicked:"> - <string key="name">quickstartButtonClicked:</string> - <string key="candidateClassName">id</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBUserSource</string> - <string key="minorKey"/> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">MMPreferenceController</string> - <string key="superclassName">DBPrefsWindowController</string> - <object class="NSMutableDictionary" key="actions"> - <string key="NS.key.0">openInCurrentWindowSelectionChanged:</string> - <string key="NS.object.0">id</string> - </object> - <object class="NSMutableDictionary" key="actionInfosByName"> - <string key="NS.key.0">openInCurrentWindowSelectionChanged:</string> - <object class="IBActionInfo" key="NS.object.0"> - <string key="name">openInCurrentWindowSelectionChanged:</string> - <string key="candidateClassName">id</string> - </object> - </object> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="advancedPreferences">NSView</string> - <string key="generalPreferences">NSView</string> - <string key="layoutPopUpButton">NSPopUpButton</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="advancedPreferences"> - <string key="name">advancedPreferences</string> - <string key="candidateClassName">NSView</string> - </object> - <object class="IBToOneOutletInfo" key="generalPreferences"> - <string key="name">generalPreferences</string> - <string key="candidateClassName">NSView</string> - </object> - <object class="IBToOneOutletInfo" key="layoutPopUpButton"> - <string key="name">layoutPopUpButton</string> - <string key="candidateClassName">NSPopUpButton</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/MMPreferenceController.h</string> - </object> - </object> - </array> - </object> - <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> - <integer value="1050" key="NS.object.0"/> - </object> - <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <int key="IBDocument.defaultPropertyAccessControl">3</int> - <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> - <string key="NSMenuCheckmark">{11, 11}</string> - <string key="NSMenuMixedState">{10, 3}</string> - <string key="NSSwitch">{15, 15}</string> - </dictionary> - </data> -</archive> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <deployment version="1050" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="MMPreferenceController"> + <connections> + <outlet property="advancedPreferences" destination="620" id="632"/> + <outlet property="generalPreferences" destination="115" id="143"/> + <outlet property="layoutPopUpButton" destination="427" id="596"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application"/> + <userDefaultsController representsSharedInstance="YES" id="58" userLabel="Shared Defaults"/> + <customView id="115" userLabel="General"> + <rect key="frame" x="0.0" y="0.0" width="483" height="290"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <popUpButton verticalHuggingPriority="750" id="957"> + <rect key="frame" x="206" y="16" width="197" height="26"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" title="Keep MacVim Running" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="960" id="979"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + <menu key="menu" title="OtherViews" id="959"> + <items> + <menuItem title="Keep MacVim Running" state="on" id="960"/> + <menuItem title="Hide MacVim" id="961"/> + <menuItem title="Quit MacVim" id="962"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <binding destination="58" name="selectedIndex" keyPath="values.MMLastWindowClosedBehavior" id="968"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="126"> + <rect key="frame" x="17" y="22" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="After last window closes:" id="977"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <popUpButton verticalHuggingPriority="750" id="427"> + <rect key="frame" x="218" y="109" width="229" height="26"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" title="and set the arglist" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="436" id="978"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + <menu key="menu" title="OtherViews" id="429"> + <items> + <menuItem title="with a tab for each file" tag="3" id="430"/> + <menuItem title="with a window for each file" tag="4" id="544"> + <connections> + <binding destination="58" name="enabled" keyPath="values.MMOpenInCurrentWindow" id="546"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSNegateBoolean</string> + </dictionary> + </binding> + </connections> + </menuItem> + <menuItem title="with a split for each file" tag="1" id="431"/> + <menuItem title="and set the arglist" state="on" id="436"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <binding destination="58" name="selectedTag" keyPath="values.MMOpenLayout" id="441"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="124"> + <rect key="frame" x="17" y="187" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="When MacVim launches:" id="976"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="122"> + <rect key="frame" x="207" y="186" width="258" height="18"/> + <autoresizingMask key="autoresizingMask"/> + <buttonCell key="cell" type="check" title="Check for updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="975"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.SUCheckAtStartup" id="169"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="121"> + <rect key="frame" x="209" y="47" width="243" height="58"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" id="974"> + <font key="font" metaFont="smallSystem"/> + <string key="title">This applies to files opened from the Finder (e.g. by double-clicking on a file or by dragging a file onto the MacVim dock icon) or from external programs such as Xcode. </string> + <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" id="120"> + <rect key="frame" x="209" y="141" width="243" height="38"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <size key="cellSize" width="243" height="18"/> + <size key="intercellSpacing" width="4" height="2"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="997"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <cells> + <column> + <buttonCell type="radio" title="in a new window" imagePosition="left" alignment="left" inset="2" id="135"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="in the current window" imagePosition="left" alignment="left" state="on" tag="1" inset="2" id="134"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + </column> + </cells> + <connections> + <action selector="openInCurrentWindowSelectionChanged:" target="-2" id="572"/> + <binding destination="58" name="selectedTag" keyPath="values.MMOpenInCurrentWindow" id="520"/> + </connections> + </matrix> + <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="119"> + <rect key="frame" x="209" y="212" width="243" height="58"/> + <autoresizingMask key="autoresizingMask"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <size key="cellSize" width="243" height="18"/> + <size key="intercellSpacing" width="4" height="2"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="996"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <cells> + <column> + <buttonCell type="radio" title="on launch and re-activation" imagePosition="left" alignment="left" state="on" tag="3" inset="2" id="139"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="only when MacVim launches" imagePosition="left" alignment="left" tag="1" inset="2" id="138"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="never" imagePosition="left" alignment="left" inset="2" id="137"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + </column> + </cells> + <connections> + <binding destination="58" name="selectedTag" keyPath="values.MMUntitledWindow" id="171"/> + </connections> + </matrix> + <textField verticalHuggingPriority="750" id="117"> + <rect key="frame" x="17" y="253" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Open untitled window:" id="973"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="116"> + <rect key="frame" x="17" y="162" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Open files from applications:" id="972"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + </customView> + <customView id="620" userLabel="Advanced"> + <rect key="frame" x="0.0" y="0.0" width="483" height="318"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <textField verticalHuggingPriority="750" id="826"> + <rect key="frame" x="17" y="170" width="449" height="56"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="993"> + <font key="font" metaFont="smallSystem"/> + <string key="title">New windows open instantaneously with Quickstart enabled but they may not have the latest runtime files sourced. If you modify your runtime files (e.g files inside the ~/.vim directory) then you may need to disable and re-enable Quickstart to ensure that the next window you open will pick up on those changes.</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="817"> + <rect key="frame" x="18" y="228" width="133" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Enable Quickstart" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="992"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="quickstartButtonClicked:" target="-1" id="858"/> + <binding destination="58" name="value" keyPath="values.MMPreloadCacheSize" id="828"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="815"> + <rect key="frame" x="17" y="252" width="449" height="28"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="991"> + <font key="font" metaFont="smallSystem"/> + <string key="title">Selecting this option will increase rendering performance but double-tapping with three fingers to look up words will no longer work.</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="782"> + <rect key="frame" x="18" y="282" width="174" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Use Core Text renderer" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="990"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="coreTextButtonClicked:" target="-1" id="lZ0-i6-HnG"/> + <binding destination="58" name="value" keyPath="values.MMRenderer" id="1000"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="1001"> + <rect key="frame" x="17" y="74" width="444" height="70"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1004"> + <font key="font" metaFont="smallSystem"/> + <string key="title">This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to "dead keys" may not work). Note that without this option the Core Text renderer will not draw marked text at all.</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="1013"> + <rect key="frame" x="18" y="146" width="174" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Draw marked text inline" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="1014"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.MMUseInlineIm" id="1016"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="1017"> + <rect key="frame" x="17" y="20" width="415" height="28"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1020"> + <font key="font" metaFont="smallSystem"/> + <string key="title">You may want to disable this option when using multiple monitors since the native full-screen support renders secondary monitors useless.</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="1028"> + <rect key="frame" x="18" y="50" width="388" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Prefer native full-screen support (requires Mac OS X 10.7)" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="1029"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.MMNativeFullScreen" id="1031"/> + </connections> + </button> + </subviews> + </customView> + </objects> +</document> diff --git a/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib b/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib index 993915f03e..cd0271eebc 100644 Binary files a/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib and b/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/src/MacVim/English.lproj/Preferences.strings b/src/MacVim/English.lproj/Preferences.strings new file mode 100644 index 0000000000..3dd649007a --- /dev/null +++ b/src/MacVim/English.lproj/Preferences.strings @@ -0,0 +1,90 @@ + +/* Class = "NSButtonCell"; title = "in the current window"; ObjectID = "134"; */ +"134.title" = "in the current window"; + +/* Class = "NSButtonCell"; title = "in a new window"; ObjectID = "135"; */ +"135.title" = "in a new window"; + +/* Class = "NSButtonCell"; title = "never"; ObjectID = "137"; */ +"137.title" = "never"; + +/* Class = "NSButtonCell"; title = "only when MacVim launches"; ObjectID = "138"; */ +"138.title" = "only when MacVim launches"; + +/* Class = "NSButtonCell"; title = "on launch and re-activation"; ObjectID = "139"; */ +"139.title" = "on launch and re-activation"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "429"; */ +"429.title" = "OtherViews"; + +/* Class = "NSMenuItem"; title = "with a tab for each file"; ObjectID = "430"; */ +"430.title" = "with a tab for each file"; + +/* Class = "NSMenuItem"; title = "with a split for each file"; ObjectID = "431"; */ +"431.title" = "with a split for each file"; + +/* Class = "NSMenuItem"; title = "and set the arglist"; ObjectID = "436"; */ +"436.title" = "and set the arglist"; + +/* Class = "NSMenuItem"; title = "with a window for each file"; ObjectID = "544"; */ +"544.title" = "with a window for each file"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "959"; */ +"959.title" = "OtherViews"; + +/* Class = "NSMenuItem"; title = "Keep MacVim Running"; ObjectID = "960"; */ +"960.title" = "Keep MacVim Running"; + +/* Class = "NSMenuItem"; title = "Hide MacVim"; ObjectID = "961"; */ +"961.title" = "Hide MacVim"; + +/* Class = "NSMenuItem"; title = "Quit MacVim"; ObjectID = "962"; */ +"962.title" = "Quit MacVim"; + +/* Class = "NSTextFieldCell"; title = "Open files from applications:"; ObjectID = "972"; */ +"972.title" = "Open files from applications:"; + +/* Class = "NSTextFieldCell"; title = "Open untitled window:"; ObjectID = "973"; */ +"973.title" = "Open untitled window:"; + +/* Class = "NSTextFieldCell"; title = "This applies to files opened from the Finder (e.g. by double-clicking on a file or by dragging a file onto the MacVim dock icon) or from external programs such as Xcode. "; ObjectID = "974"; */ +"974.title" = "This applies to files opened from the Finder (e.g. by double-clicking on a file or by dragging a file onto the MacVim dock icon) or from external programs such as Xcode. "; + +/* Class = "NSButtonCell"; title = "Check for updates"; ObjectID = "975"; */ +"975.title" = "Check for updates"; + +/* Class = "NSTextFieldCell"; title = "When MacVim launches:"; ObjectID = "976"; */ +"976.title" = "When MacVim launches:"; + +/* Class = "NSTextFieldCell"; title = "After last window closes:"; ObjectID = "977"; */ +"977.title" = "After last window closes:"; + +/* Class = "NSButtonCell"; title = "Use Core Text renderer"; ObjectID = "990"; */ +"990.title" = "Use Core Text renderer"; + +/* Class = "NSTextFieldCell"; title = "Selecting this option will increase rendering performance but double-tapping with three fingers to look up words will no longer work."; ObjectID = "991"; */ +"991.title" = "Selecting this option will increase rendering performance but double-tapping with three fingers to look up words will no longer work."; + +/* Class = "NSButtonCell"; title = "Enable Quickstart"; ObjectID = "992"; */ +"992.title" = "Enable Quickstart"; + +/* Class = "NSTextFieldCell"; title = "New windows open instantaneously with Quickstart enabled but they may not have the latest runtime files sourced. If you modify your runtime files (e.g files inside the ~/.vim directory) then you may need to disable and re-enable Quickstart to ensure that the next window you open will pick up on those changes."; ObjectID = "993"; */ +"993.title" = "New windows open instantaneously with Quickstart enabled but they may not have the latest runtime files sourced. If you modify your runtime files (e.g files inside the ~/.vim directory) then you may need to disable and re-enable Quickstart to ensure that the next window you open will pick up on those changes."; + +/* Class = "NSButtonCell"; title = "Radio"; ObjectID = "996"; */ +"996.title" = "Radio"; + +/* Class = "NSButtonCell"; title = "Radio"; ObjectID = "997"; */ +"997.title" = "Radio"; + +/* Class = "NSTextFieldCell"; title = "This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to \"dead keys\" may not work). Note that without this option the Core Text renderer will not draw marked text at all."; ObjectID = "1004"; */ +"1004.title" = "This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to \"dead keys\" may not work). Note that without this option the Core Text renderer will not draw marked text at all."; + +/* Class = "NSButtonCell"; title = "Draw marked text inline"; ObjectID = "1014"; */ +"1014.title" = "Draw marked text inline"; + +/* Class = "NSTextFieldCell"; title = "You may want to disable this option when using multiple monitors since the native full-screen support renders secondary monitors useless."; ObjectID = "1020"; */ +"1020.title" = "You may want to disable this option when using multiple monitors since the native full-screen support renders secondary monitors useless."; + +/* Class = "NSButtonCell"; title = "Prefer native full-screen support (requires Mac OS X 10.7)"; ObjectID = "1029"; */ +"1029.title" = "Prefer native full-screen support (requires Mac OS X 10.7)"; diff --git a/src/MacVim/Info.plist b/src/MacVim/Info.plist index a65616cf26..943ffd7855 100644 --- a/src/MacVim/Info.plist +++ b/src/MacVim/Info.plist @@ -8,7 +8,6 @@ <!-- When adding support for a new file type: 1. Add entry to CFBundleDocumentTypes 2. Add entry to UTExportedTypeDeclarations below (for Quick Look) - 3. Add entry to icons/make_icons.py script (for document icon) For a list of UTIs, see http://developer.apple.com/documentation/Carbon/Conceptual/ @@ -1200,6 +1199,30 @@ <key>CFBundleTypeRole</key> <string>Editor</string> </dict> + <dict> + <key>CFBundleTypeName</key> + <string>Verilog HDL Source File</string> + <key>CFBundleTypeExtensions</key> + <array> + <string>v</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>MacVim-generic</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>Verilog HDL Header Source File</string> + <key>CFBundleTypeExtensions</key> + <array> + <string>vh</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>MacVim-generic</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> </array> <key>CFBundleExecutable</key> @@ -1207,7 +1230,7 @@ <key>CFBundleIconFile</key> <string>MacVim</string> <key>CFBundleIdentifier</key> - <string>org.vim.MacVim</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> @@ -1215,7 +1238,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>7.4</string> + <string>${VIM_SHORT_VERSION_STRING}</string> <key>CFBundleSignature</key> <string>VIMM</string> <key>CFBundleURLTypes</key> @@ -1232,7 +1255,12 @@ </dict> </array> <key>CFBundleVersion</key> - <string>73</string> + <string>20180324</string> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> <key>NSMainNibFile</key> <string>MainMenu</string> <key>NSPrincipalClass</key> @@ -1278,7 +1306,9 @@ </dict> </array> <key>SUFeedURL</key> - <string>http://b4winckler.github.com/macvim/appcast/stable.xml</string> + <string>https://raw.githubusercontent.com/splhack/macvim-kaoriya/master/latest.xml</string> + <key>SUPublicDSAKeyFile</key> + <string>dsa_pub.pem</string> <key>NSAppleScriptEnabled</key> <true/> @@ -2633,6 +2663,40 @@ </array> </dict> </dict> + <dict> + <key>UTTypeConformsTo</key> + <array> + <string>public.plain-text</string> + </array> + <key>UTTypeDescription</key> + <string>Verilog HDL Source File</string> + <key>UTTypeIdentifier</key> + <string>org.vim.v-file</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>v</string> + </array> + </dict> + </dict> + <dict> + <key>UTTypeConformsTo</key> + <array> + <string>public.plain-text</string> + </array> + <key>UTTypeDescription</key> + <string>Verilog HDL Header Source File</string> + <key>UTTypeIdentifier</key> + <string>org.vim.vh-file</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>vh</string> + </array> + </dict> + </dict> </array> </dict> </plist> diff --git a/src/MacVim/Japanese.lproj/FindAndReplace.nib/designable.nib b/src/MacVim/Japanese.lproj/FindAndReplace.nib/designable.nib new file mode 100644 index 0000000000..64dbeab860 --- /dev/null +++ b/src/MacVim/Japanese.lproj/FindAndReplace.nib/designable.nib @@ -0,0 +1,1331 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">10D573</string> + <string key="IBDocument.InterfaceBuilderVersion">762</string> + <string key="IBDocument.AppKitVersion">1038.29</string> + <string key="IBDocument.HIToolboxVersion">460.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="NS.object.0">762</string> + </object> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="7"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="597592539"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="581996982"> + <string key="NSClassName">MMFindReplaceController</string> + </object> + <object class="NSCustomObject" id="153385770"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="121505723"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSWindowTemplate" id="996380188"> + <int key="NSWindowStyleMask">3</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{196, 363}, {490, 147}}</string> + <int key="NSWTFlags">-469762048</int> + <string key="NSWindowTitle">検索</string> + <string key="NSWindowClass">NSPanel</string> + <nil key="NSViewClass"/> + <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <object class="NSView" key="NSWindowView" id="561163755"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="919469779"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{31, 110}, {74, 17}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="773341962"> + <int key="NSCellFlags">67239488</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">検索文字列:</string> + <object class="NSFont" key="NSSupport" id="602227800"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">13</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="919469779"/> + <object class="NSColor" key="NSBackgroundColor" id="874475756"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="786721035"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <object class="NSColor" key="NSColor" id="42124926"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="633177033"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{31, 82}, {74, 17}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="366236890"> + <int key="NSCellFlags">67239488</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">置換文字列:</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="633177033"/> + <reference key="NSBackgroundColor" ref="874475756"/> + <reference key="NSTextColor" ref="786721035"/> + </object> + </object> + <object class="NSButton" id="95677340"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{380, 12}, {96, 32}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="92543795"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">次へ</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="95677340"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="563611906"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{146, 12}, {96, 32}}</string> + <reference key="NSSuperview" ref="561163755"/> + <int key="NSTag">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="873978035"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">置き換え</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="563611906"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="968810803"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{14, 12}, {132, 32}}</string> + <reference key="NSSuperview" ref="561163755"/> + <int key="NSTag">3</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="64465084"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">すべてを置き換え</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="968810803"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="22019487"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{276, 52}, {168, 18}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="770542651"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">完全に一致する単語のみ</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="22019487"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <object class="NSCustomResource" key="NSNormalImage" id="179706801"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSSwitch</string> + </object> + <object class="NSButtonImageSource" key="NSAlternateImage" id="280131754"> + <string key="NSImageName">NSSwitch</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="636952233"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{108, 52}, {152, 18}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="173031210"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">大文字/小文字を無視</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="636952233"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSNormalImage" ref="179706801"/> + <reference key="NSAlternateImage" ref="280131754"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="393292933"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{284, 12}, {96, 32}}</string> + <reference key="NSSuperview" ref="561163755"/> + <int key="NSTag">1</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="625625842"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">前へ</string> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="393292933"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="437365158"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{110, 108}, {360, 22}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="616268607"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="437365158"/> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSColor" key="NSBackgroundColor" id="239288815"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="716874619"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textColor</string> + <reference key="NSColor" ref="42124926"/> + </object> + </object> + </object> + <object class="NSTextField" id="647019676"> + <reference key="NSNextResponder" ref="561163755"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{110, 80}, {360, 22}}</string> + <reference key="NSSuperview" ref="561163755"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="775256012"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="602227800"/> + <reference key="NSControlView" ref="647019676"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="239288815"/> + <reference key="NSTextColor" ref="716874619"/> + </object> + </object> + </object> + <string key="NSFrameSize">{490, 147}</string> + <reference key="NSSuperview"/> + </object> + <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> + <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">window</string> + <reference key="source" ref="581996982"/> + <reference key="destination" ref="996380188"/> + </object> + <int key="connectionID">46</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">ignoreCaseButton</string> + <reference key="source" ref="581996982"/> + <reference key="destination" ref="636952233"/> + </object> + <int key="connectionID">61</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">matchWordButton</string> + <reference key="source" ref="581996982"/> + <reference key="destination" ref="22019487"/> + </object> + <int key="connectionID">62</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">findAndReplace:</string> + <reference key="source" ref="153385770"/> + <reference key="destination" ref="95677340"/> + </object> + <int key="connectionID">63</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">findAndReplace:</string> + <reference key="source" ref="153385770"/> + <reference key="destination" ref="393292933"/> + </object> + <int key="connectionID">64</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">findAndReplace:</string> + <reference key="source" ref="153385770"/> + <reference key="destination" ref="563611906"/> + </object> + <int key="connectionID">65</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">findAndReplace:</string> + <reference key="source" ref="153385770"/> + <reference key="destination" ref="968810803"/> + </object> + <int key="connectionID">66</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">nextKeyView</string> + <reference key="source" ref="437365158"/> + <reference key="destination" ref="647019676"/> + </object> + <int key="connectionID">95</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">nextKeyView</string> + <reference key="source" ref="647019676"/> + <reference key="destination" ref="437365158"/> + </object> + <int key="connectionID">96</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">findBox</string> + <reference key="source" ref="581996982"/> + <reference key="destination" ref="437365158"/> + </object> + <int key="connectionID">97</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">replaceBox</string> + <reference key="source" ref="581996982"/> + <reference key="destination" ref="647019676"/> + </object> + <int key="connectionID">98</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <reference key="object" ref="0"/> + <reference key="children" ref="597592539"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="581996982"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="153385770"/> + <reference key="parent" ref="0"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="121505723"/> + <reference key="parent" ref="0"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6</int> + <reference key="object" ref="996380188"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="561163755"/> + </object> + <reference key="parent" ref="0"/> + <string key="objectName">Panel (Find & Replace)</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">7</int> + <reference key="object" ref="561163755"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="95677340"/> + <reference ref="968810803"/> + <reference ref="636952233"/> + <reference ref="393292933"/> + <reference ref="437365158"/> + <reference ref="647019676"/> + <reference ref="563611906"/> + <reference ref="919469779"/> + <reference ref="633177033"/> + <reference ref="22019487"/> + </object> + <reference key="parent" ref="996380188"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="919469779"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="773341962"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="633177033"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="366236890"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">16</int> + <reference key="object" ref="95677340"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="92543795"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">18</int> + <reference key="object" ref="563611906"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="873978035"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">20</int> + <reference key="object" ref="968810803"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="64465084"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">22</int> + <reference key="object" ref="22019487"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="770542651"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">24</int> + <reference key="object" ref="636952233"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="173031210"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">26</int> + <reference key="object" ref="393292933"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="625625842"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">91</int> + <reference key="object" ref="437365158"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="616268607"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">93</int> + <reference key="object" ref="647019676"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="775256012"/> + </object> + <reference key="parent" ref="561163755"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">113</int> + <reference key="object" ref="773341962"/> + <reference key="parent" ref="919469779"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">114</int> + <reference key="object" ref="366236890"/> + <reference key="parent" ref="633177033"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">115</int> + <reference key="object" ref="92543795"/> + <reference key="parent" ref="95677340"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">116</int> + <reference key="object" ref="873978035"/> + <reference key="parent" ref="563611906"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">117</int> + <reference key="object" ref="64465084"/> + <reference key="parent" ref="968810803"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">118</int> + <reference key="object" ref="770542651"/> + <reference key="parent" ref="22019487"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">119</int> + <reference key="object" ref="173031210"/> + <reference key="parent" ref="636952233"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">120</int> + <reference key="object" ref="625625842"/> + <reference key="parent" ref="393292933"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">121</int> + <reference key="object" ref="616268607"/> + <reference key="parent" ref="437365158"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">122</int> + <reference key="object" ref="775256012"/> + <reference key="parent" ref="647019676"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-3.IBPluginDependency</string> + <string>-3.ImportedFromIB2</string> + <string>10.IBPluginDependency</string> + <string>10.ImportedFromIB2</string> + <string>113.IBPluginDependency</string> + <string>114.IBPluginDependency</string> + <string>115.IBPluginDependency</string> + <string>116.IBPluginDependency</string> + <string>117.IBPluginDependency</string> + <string>118.IBPluginDependency</string> + <string>119.IBPluginDependency</string> + <string>120.IBPluginDependency</string> + <string>121.IBPluginDependency</string> + <string>122.IBPluginDependency</string> + <string>16.IBPluginDependency</string> + <string>16.ImportedFromIB2</string> + <string>18.IBPluginDependency</string> + <string>18.ImportedFromIB2</string> + <string>20.IBPluginDependency</string> + <string>20.ImportedFromIB2</string> + <string>22.IBPluginDependency</string> + <string>22.ImportedFromIB2</string> + <string>24.IBPluginDependency</string> + <string>24.ImportedFromIB2</string> + <string>26.IBPluginDependency</string> + <string>26.ImportedFromIB2</string> + <string>6.IBEditorWindowLastContentRect</string> + <string>6.IBPluginDependency</string> + <string>6.IBWindowTemplateEditedContentRect</string> + <string>6.ImportedFromIB2</string> + <string>6.windowTemplate.maxSize</string> + <string>6.windowTemplate.minSize</string> + <string>7.IBPluginDependency</string> + <string>7.ImportedFromIB2</string> + <string>8.IBPluginDependency</string> + <string>8.ImportedFromIB2</string> + <string>91.IBPluginDependency</string> + <string>91.ImportedFromIB2</string> + <string>93.IBPluginDependency</string> + <string>93.ImportedFromIB2</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{0, 698}, {490, 147}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{0, 698}, {490, 147}}</string> + <boolean value="YES"/> + <string>{1.79769e+308, 1.79769e+308}</string> + <string>{0, 0}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">122</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">FirstResponder</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">findAndReplace:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMFindReplaceController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>findBox</string> + <string>ignoreCaseButton</string> + <string>matchWordButton</string> + <string>replaceBox</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSTextField</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSTextField</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">MMFindReplaceController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMFindReplaceController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">backwardButton</string> + <string key="NS.object.0">NSButton</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMWindowController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addNewTab:</string> + <string>findAndReplace:</string> + <string>findNext:</string> + <string>findPrevious:</string> + <string>fontSizeDown:</string> + <string>fontSizeUp:</string> + <string>performClose:</string> + <string>toggleToolbar:</string> + <string>vimMenuItemAction:</string> + <string>vimToolbarItemAction:</string> + <string>zoom:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">MMWindowController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">Miscellaneous.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PlugInInterface.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>didAdjustSubviews:</string> + <string>willAdjustSubviews:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>RBSplitView</string> + <string>RBSplitView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="881429654"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitSubview.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="152672880"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitViewPrivateDefines.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <string key="superclassName">RBSplitSubview</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">delegate</string> + <string key="NS.object.0">id</string> + </object> + <reference key="sourceIdentifier" ref="881429654"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <reference key="sourceIdentifier" ref="152672880"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <string key="superclassName">RBSplitSubview</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSActionCell</string> + <string key="superclassName">NSCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="470292118"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="358787531"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="661361003"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButton</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButtonCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSCell</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSControl</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="271756102"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSFormatter</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1061374040"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="470292118"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="358787531"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="661361003"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="271756102"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="1061374040"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="397984821"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSError.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSPanel</string> + <string key="superclassName">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTextField</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTextFieldCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <string key="superclassName">NSResponder</string> + <reference key="sourceIdentifier" ref="397984821"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindowController</string> + <string key="superclassName">NSResponder</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">showWindow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <string key="IBDocument.LastKnownRelativeProjectPath">../MacVim.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> + <string key="NS.key.0">NSSwitch</string> + <string key="NS.object.0">{15, 15}</string> + </object> + </data> +</archive> diff --git a/src/MacVim/Japanese.lproj/FindAndReplace.nib/keyedobjects.nib b/src/MacVim/Japanese.lproj/FindAndReplace.nib/keyedobjects.nib new file mode 100644 index 0000000000..24d152e212 Binary files /dev/null and b/src/MacVim/Japanese.lproj/FindAndReplace.nib/keyedobjects.nib differ diff --git a/src/MacVim/Japanese.lproj/FindAndReplace.strings b/src/MacVim/Japanese.lproj/FindAndReplace.strings new file mode 100644 index 0000000000..76ca7fac9d --- /dev/null +++ b/src/MacVim/Japanese.lproj/FindAndReplace.strings @@ -0,0 +1,27 @@ + +/* Class = "NSPanel"; title = "Find"; ObjectID = "6"; */ +"6.title" = "検索"; + +/* Class = "NSTextFieldCell"; title = "Find:"; ObjectID = "113"; */ +"113.title" = "検索文字列:"; + +/* Class = "NSTextFieldCell"; title = "Replace with:"; ObjectID = "114"; */ +"114.title" = "置換文字列:"; + +/* Class = "NSButtonCell"; title = "Next"; ObjectID = "115"; */ +"115.title" = "次へ"; + +/* Class = "NSButtonCell"; title = "Replace"; ObjectID = "116"; */ +"116.title" = "置き換え"; + +/* Class = "NSButtonCell"; title = "Replace All"; ObjectID = "117"; */ +"117.title" = "すべてを置き換え"; + +/* Class = "NSButtonCell"; title = "Match whole word only"; ObjectID = "118"; */ +"118.title" = "完全に一致する単語のみ"; + +/* Class = "NSButtonCell"; title = "Ignore case"; ObjectID = "119"; */ +"119.title" = "大文字/小文字を無視"; + +/* Class = "NSButtonCell"; title = "Previous"; ObjectID = "120"; */ +"120.title" = "前へ"; diff --git a/src/MacVim/Japanese.lproj/Localizable.strings b/src/MacVim/Japanese.lproj/Localizable.strings new file mode 100644 index 0000000000..eceba18885 --- /dev/null +++ b/src/MacVim/Japanese.lproj/Localizable.strings @@ -0,0 +1,63 @@ +// MMPreferenceController.m +"Advanced" = "詳細"; +"General" = "一般"; +"Integration" = "連携"; + +// MMAppController.m +/* Quit dialog with no changed buffers, title */ +"Are you sure you want to quit MacVim?" = "MacVimを終了しますか?"; + +/* Dialog button */ +"Cancel" = "キャンセル"; + +/* File not found dialog, text */ +"Could not open file with name %@, and %d other files." = "%1$@と、%2$d個のファイルを開けませんでした。"; + +/* File not found dialog, text */ +"Could not open file with name %@." = "%@を開けませんでした。"; + +/* File not found dialog, title */ +"File not found" = "ファイルが見つかりません"; + +/* File not found dialog, title */ +"Multiple files not found" = "複数のファイルが見つかりません"; + +/* Dialog button */ +"OK" = "OK"; + +/* No comment provided by engineer. */ +"Open Recent" = "最近開いたファイル"; + +/* Plug-In menu title */ +"Plug-In" = "プラグイン"; + +/* Dialog button */ +"Quit" = "終了"; + +/* Quit dialog with changed buffers, title */ +"Quit without saving?" = "保存せずに終了しますか?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d tabs open in MacVim. Do you want to quit anyway?" = "%d枚のタブを開いています。とにかく終了しますか?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d windows open in MacVim, with a total of %d tabs. Do you want to quit anyway?" = "%1$d枚のウインドウと、全部で%2$d枚のタブを開いています。とにかく終了しますか?"; + +/* Quit dialog with no changed buffers, text */ +"There are %d windows open in MacVim. Do you want to quit anyway?" = "%1$d枚のウインドウを開いています。とにかく終了しますか?"; + +/* Quit dialog with changed buffers, text */ +"There are modified buffers, if you quit now all changes will be lost. Quit anyway?" = "バッファが変更されています。終了するとすべての変更が失われます。それでも終了しますか?"; + +/* Unknown URL Scheme dialog, text */ +"This version of MacVim does not support \"%@\" in its URL scheme." = "このバージョンのMacVimは \"%@\" というURLスキームに対応していません。"; + +/* Unknown URL Scheme dialog, title */ +"Unknown URL Scheme" = "不明なURLスキーム"; + +// MMPreferenceController.m +"Install" = "インストール"; +"Update" = "アップデート"; +"Latest version is %@, you have %@." = "最新版は%1$@ですが、%2$@がインストールされています。"; +"Latest version is %@. You have the latest version." = "最新版の%@がインストールされています。"; +"Latest version is %@. It is not installed." = "最新版は%@です。インストールされていません。"; \ No newline at end of file diff --git a/src/MacVim/Japanese.lproj/MainMenu.nib/designable.nib b/src/MacVim/Japanese.lproj/MainMenu.nib/designable.nib new file mode 100644 index 0000000000..66060f1cdb --- /dev/null +++ b/src/MacVim/Japanese.lproj/MainMenu.nib/designable.nib @@ -0,0 +1,2059 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">10D573</string> + <string key="IBDocument.InterfaceBuilderVersion">762</string> + <string key="IBDocument.AppKitVersion">1038.29</string> + <string key="IBDocument.HIToolboxVersion">460.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="NS.object.0">762</string> + </object> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="57"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="614817157"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="953418466"> + <object class="NSMutableString" key="NSClassName"> + <characters key="NS.bytes">NSApplication</characters> + </object> + </object> + <object class="NSCustomObject" id="1030926225"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="664441048"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSMenu" id="644325495"> + <string key="NSTitle">MainMenu</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="1001437754"> + <reference key="NSMenu" ref="644325495"/> + <string key="NSTitle">MacVim</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <object class="NSCustomResource" key="NSOnImage" id="470512947"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuCheckmark</string> + </object> + <object class="NSCustomResource" key="NSMixedImage" id="862504225"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuMixedState</string> + </object> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="490698502"> + <string key="NSTitle">MacVim</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="734924874"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">MacVim について</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="792896064"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">アップデートを確認…</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="672884461"> + <reference key="NSMenu" ref="490698502"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="586667532"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">環境設定…</string> + <string key="NSKeyEquiv">,</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="407441599"> + <reference key="NSMenu" ref="490698502"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="483352267"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">サービス</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="770827357"> + <string key="NSTitle">サービス</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <string key="NSName">_NSServicesMenu</string> + </object> + </object> + <object class="NSMenuItem" id="835713662"> + <reference key="NSMenu" ref="490698502"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="54355225"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">MacVim を隠す</string> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="600071026"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">他を隠す</string> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1572864</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="243513640"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">すべてを表示</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="726862909"> + <reference key="NSMenu" ref="490698502"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="186640317"> + <reference key="NSMenu" ref="490698502"/> + <string key="NSTitle">MacVim を終了</string> + <string key="NSKeyEquiv">q</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + <string key="NSName">_NSAppleMenu</string> + </object> + </object> + <object class="NSMenuItem" id="594720119"> + <reference key="NSMenu" ref="644325495"/> + <string key="NSTitle">ファイル</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="411527105"> + <string key="NSTitle">ファイル</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="152909980"> + <reference key="NSMenu" ref="411527105"/> + <string key="NSTitle">新規ウインドウ</string> + <string key="NSKeyEquiv">n</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="907533568"> + <reference key="NSMenu" ref="411527105"/> + <string key="NSTitle">開く…</string> + <string key="NSKeyEquiv">o</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="825791443"> + <reference key="NSMenu" ref="411527105"/> + <string key="NSTitle">最近開いたファイル</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="262193711"> + <string key="NSTitle">最近開いたファイル</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="448773898"> + <reference key="NSMenu" ref="262193711"/> + <string key="NSTitle">メニューを消去</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + <string key="NSName"/> + </object> + </object> + <object class="NSMenuItem" id="305819773"> + <reference key="NSMenu" ref="411527105"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="43965448"> + <reference key="NSMenu" ref="411527105"/> + <string key="NSTitle">ウインドウを閉じる</string> + <string key="NSKeyEquiv">w</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="881112397"> + <reference key="NSMenu" ref="644325495"/> + <string key="NSTitle">編集</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="156392376"> + <string key="NSTitle">編集</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="369710348"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">取り消す</string> + <string key="NSKeyEquiv">z</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="187333208"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">やり直す</string> + <string key="NSKeyEquiv">Z</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="451247171"> + <reference key="NSMenu" ref="156392376"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="1070120326"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">カット</string> + <string key="NSKeyEquiv">x</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="780667553"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">コピー</string> + <string key="NSKeyEquiv">c</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="74966773"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">ペースト</string> + <string key="NSKeyEquiv">v</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="26226482"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">削除</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="955855321"> + <reference key="NSMenu" ref="156392376"/> + <string key="NSTitle">すべてを選択</string> + <string key="NSKeyEquiv">a</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="781359436"> + <reference key="NSMenu" ref="644325495"/> + <string key="NSTitle">ウインドウ</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="72988665"> + <string key="NSTitle">ウインドウ</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="719291268"> + <reference key="NSMenu" ref="72988665"/> + <string key="NSTitle">縮小</string> + <string key="NSKeyEquiv">m</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="516923984"> + <reference key="NSMenu" ref="72988665"/> + <string key="NSTitle">拡大</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="659581188"> + <reference key="NSMenu" ref="72988665"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="352624445"> + <reference key="NSMenu" ref="72988665"/> + <string key="NSTitle">すべてを手前に移動</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + <string key="NSName"/> + </object> + </object> + <object class="NSMenuItem" id="822169218"> + <reference key="NSMenu" ref="644325495"/> + <string key="NSTitle">ヘルプ</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="1053644787"> + <string key="NSTitle">ヘルプ</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="508051670"> + <reference key="NSMenu" ref="1053644787"/> + <string key="NSTitle">MacVim ヘルプ</string> + <string key="NSKeyEquiv">?</string> + <int key="NSKeyEquivModMask">1179648</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="754163637"> + <reference key="NSMenu" ref="1053644787"/> + <string key="NSTitle">MacVim Web サイト</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + <object class="NSMenuItem" id="1017643548"> + <reference key="NSMenu" ref="1053644787"/> + <string key="NSTitle">MacVim-KaoriYa Web サイト</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + </object> + </object> + </object> + </object> + </object> + <string key="NSName">_NSMainMenu</string> + </object> + <object class="NSCustomObject" id="265443862"> + <string key="NSClassName">MMAppController</string> + </object> + <object class="NSMenu" id="157729169"> + <string key="NSTitle"/> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="928450089"> + <reference key="NSMenu" ref="157729169"/> + <string key="NSTitle">新規ウインドウ</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="470512947"/> + <reference key="NSMixedImage" ref="862504225"/> + <object class="NSAttributedString" key="NSAttributedTitle"> + <string key="NSString"/> + </object> + </object> + </object> + </object> + <object class="NSCustomObject" id="247255121"> + <string key="NSClassName">SUUpdater</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">terminate:</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="186640317"/> + </object> + <int key="connectionID">139</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontStandardAboutPanel:</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="734924874"/> + </object> + <int key="connectionID">142</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hideOtherApplications:</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="600071026"/> + </object> + <int key="connectionID">146</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hide:</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="54355225"/> + </object> + <int key="connectionID">152</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">unhideAllApplications:</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="243513640"/> + </object> + <int key="connectionID">153</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="265443862"/> + </object> + <int key="connectionID">236</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performClose:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="43965448"/> + </object> + <int key="connectionID">249</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">newWindow:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="152909980"/> + </object> + <int key="connectionID">251</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontPreferencePanel:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="586667532"/> + </object> + <int key="connectionID">252</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">openWebsite:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="754163637"/> + </object> + <int key="connectionID">274</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">fileOpen:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="907533568"/> + </object> + <int key="connectionID">277</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">clearRecentDocuments:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="448773898"/> + </object> + <int key="connectionID">278</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">undo:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="369710348"/> + </object> + <int key="connectionID">316</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">redo:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="187333208"/> + </object> + <int key="connectionID">317</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">cut:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="1070120326"/> + </object> + <int key="connectionID">318</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">copy:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="780667553"/> + </object> + <int key="connectionID">319</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">paste:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="74966773"/> + </object> + <int key="connectionID">320</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">delete:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="26226482"/> + </object> + <int key="connectionID">321</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">selectAll:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="955855321"/> + </object> + <int key="connectionID">322</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performMiniaturize:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="719291268"/> + </object> + <int key="connectionID">323</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performZoom:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="516923984"/> + </object> + <int key="connectionID">324</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">arrangeInFront:</string> + <reference key="source" ref="1030926225"/> + <reference key="destination" ref="352624445"/> + </object> + <int key="connectionID">325</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showVimHelp:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="508051670"/> + </object> + <int key="connectionID">329</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">dockMenu</string> + <reference key="source" ref="953418466"/> + <reference key="destination" ref="157729169"/> + </object> + <int key="connectionID">341</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">newWindowAndActivate:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="928450089"/> + </object> + <int key="connectionID">350</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">openWebsiteKaoriYa:</string> + <reference key="source" ref="265443862"/> + <reference key="destination" ref="1017643548"/> + </object> + <int key="connectionID">354</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">checkForUpdates:</string> + <reference key="source" ref="247255121"/> + <reference key="destination" ref="792896064"/> + </object> + <int key="connectionID">356</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <reference key="object" ref="0"/> + <reference key="children" ref="614817157"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="953418466"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="1030926225"/> + <reference key="parent" ref="0"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="664441048"/> + <reference key="parent" ref="0"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">29</int> + <reference key="object" ref="644325495"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1001437754"/> + <reference ref="594720119"/> + <reference ref="822169218"/> + <reference ref="881112397"/> + <reference ref="781359436"/> + </object> + <reference key="parent" ref="0"/> + <string key="objectName">MainMenu</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">56</int> + <reference key="object" ref="1001437754"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="490698502"/> + </object> + <reference key="parent" ref="644325495"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">57</int> + <reference key="object" ref="490698502"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="734924874"/> + <reference ref="586667532"/> + <reference ref="483352267"/> + <reference ref="54355225"/> + <reference ref="186640317"/> + <reference ref="407441599"/> + <reference ref="835713662"/> + <reference ref="600071026"/> + <reference ref="726862909"/> + <reference ref="243513640"/> + <reference ref="672884461"/> + <reference ref="792896064"/> + </object> + <reference key="parent" ref="1001437754"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">58</int> + <reference key="object" ref="734924874"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">129</int> + <reference key="object" ref="586667532"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">131</int> + <reference key="object" ref="483352267"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="770827357"/> + </object> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">130</int> + <reference key="object" ref="770827357"/> + <reference key="parent" ref="483352267"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="54355225"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">136</int> + <reference key="object" ref="186640317"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">143</int> + <reference key="object" ref="407441599"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">144</int> + <reference key="object" ref="835713662"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">145</int> + <reference key="object" ref="600071026"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">149</int> + <reference key="object" ref="726862909"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">150</int> + <reference key="object" ref="243513640"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">196</int> + <reference key="object" ref="672884461"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">255</int> + <reference key="object" ref="792896064"/> + <reference key="parent" ref="490698502"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">217</int> + <reference key="object" ref="594720119"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="411527105"/> + </object> + <reference key="parent" ref="644325495"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">218</int> + <reference key="object" ref="411527105"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="152909980"/> + <reference ref="43965448"/> + <reference ref="907533568"/> + <reference ref="825791443"/> + <reference ref="305819773"/> + </object> + <reference key="parent" ref="594720119"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">219</int> + <reference key="object" ref="152909980"/> + <reference key="parent" ref="411527105"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">248</int> + <reference key="object" ref="43965448"/> + <reference key="parent" ref="411527105"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">261</int> + <reference key="object" ref="907533568"/> + <reference key="parent" ref="411527105"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">262</int> + <reference key="object" ref="825791443"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="262193711"/> + </object> + <reference key="parent" ref="411527105"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">271</int> + <reference key="object" ref="262193711"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="448773898"/> + </object> + <reference key="parent" ref="825791443"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">272</int> + <reference key="object" ref="448773898"/> + <reference key="parent" ref="262193711"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">263</int> + <reference key="object" ref="305819773"/> + <reference key="parent" ref="411527105"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">232</int> + <reference key="object" ref="822169218"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1053644787"/> + </object> + <reference key="parent" ref="644325495"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">233</int> + <reference key="object" ref="1053644787"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="508051670"/> + <reference ref="754163637"/> + <reference ref="1017643548"/> + </object> + <reference key="parent" ref="822169218"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">234</int> + <reference key="object" ref="754163637"/> + <reference key="parent" ref="1053644787"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">275</int> + <reference key="object" ref="508051670"/> + <reference key="parent" ref="1053644787"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">281</int> + <reference key="object" ref="881112397"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="156392376"/> + </object> + <reference key="parent" ref="644325495"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">282</int> + <reference key="object" ref="156392376"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="369710348"/> + <reference ref="187333208"/> + <reference ref="451247171"/> + <reference ref="1070120326"/> + <reference ref="780667553"/> + <reference ref="74966773"/> + <reference ref="26226482"/> + <reference ref="955855321"/> + </object> + <reference key="parent" ref="881112397"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">283</int> + <reference key="object" ref="369710348"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">284</int> + <reference key="object" ref="187333208"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">285</int> + <reference key="object" ref="451247171"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">286</int> + <reference key="object" ref="1070120326"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">287</int> + <reference key="object" ref="780667553"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">288</int> + <reference key="object" ref="74966773"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">290</int> + <reference key="object" ref="26226482"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">291</int> + <reference key="object" ref="955855321"/> + <reference key="parent" ref="156392376"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">309</int> + <reference key="object" ref="781359436"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="72988665"/> + </object> + <reference key="parent" ref="644325495"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">310</int> + <reference key="object" ref="72988665"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="719291268"/> + <reference ref="516923984"/> + <reference ref="659581188"/> + <reference ref="352624445"/> + </object> + <reference key="parent" ref="781359436"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">311</int> + <reference key="object" ref="719291268"/> + <reference key="parent" ref="72988665"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">312</int> + <reference key="object" ref="516923984"/> + <reference key="parent" ref="72988665"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">313</int> + <reference key="object" ref="659581188"/> + <reference key="parent" ref="72988665"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">314</int> + <reference key="object" ref="352624445"/> + <reference key="parent" ref="72988665"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">235</int> + <reference key="object" ref="265443862"/> + <reference key="parent" ref="0"/> + <string key="objectName">MMAppController</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">337</int> + <reference key="object" ref="157729169"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="928450089"/> + </object> + <reference key="parent" ref="0"/> + <string key="objectName">DockMenu</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">338</int> + <reference key="object" ref="928450089"/> + <reference key="parent" ref="157729169"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">352</int> + <reference key="object" ref="1017643548"/> + <reference key="parent" ref="1053644787"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">355</int> + <reference key="object" ref="247255121"/> + <reference key="parent" ref="0"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-3.IBPluginDependency</string> + <string>-3.ImportedFromIB2</string> + <string>129.IBPluginDependency</string> + <string>129.ImportedFromIB2</string> + <string>130.IBPluginDependency</string> + <string>130.ImportedFromIB2</string> + <string>131.IBPluginDependency</string> + <string>131.ImportedFromIB2</string> + <string>134.IBPluginDependency</string> + <string>134.ImportedFromIB2</string> + <string>136.IBPluginDependency</string> + <string>136.ImportedFromIB2</string> + <string>143.IBPluginDependency</string> + <string>143.ImportedFromIB2</string> + <string>144.IBPluginDependency</string> + <string>144.ImportedFromIB2</string> + <string>145.IBPluginDependency</string> + <string>145.ImportedFromIB2</string> + <string>149.IBPluginDependency</string> + <string>149.ImportedFromIB2</string> + <string>150.IBPluginDependency</string> + <string>150.ImportedFromIB2</string> + <string>196.IBPluginDependency</string> + <string>196.ImportedFromIB2</string> + <string>217.IBPluginDependency</string> + <string>217.ImportedFromIB2</string> + <string>218.IBEditorWindowLastContentRect</string> + <string>218.IBPluginDependency</string> + <string>218.ImportedFromIB2</string> + <string>219.IBPluginDependency</string> + <string>219.ImportedFromIB2</string> + <string>232.IBPluginDependency</string> + <string>232.ImportedFromIB2</string> + <string>233.IBEditorWindowLastContentRect</string> + <string>233.IBPluginDependency</string> + <string>233.ImportedFromIB2</string> + <string>234.IBPluginDependency</string> + <string>234.ImportedFromIB2</string> + <string>235.ImportedFromIB2</string> + <string>248.IBPluginDependency</string> + <string>248.ImportedFromIB2</string> + <string>255.IBPluginDependency</string> + <string>255.ImportedFromIB2</string> + <string>261.IBPluginDependency</string> + <string>261.ImportedFromIB2</string> + <string>262.IBPluginDependency</string> + <string>262.ImportedFromIB2</string> + <string>263.IBPluginDependency</string> + <string>263.ImportedFromIB2</string> + <string>271.IBPluginDependency</string> + <string>271.ImportedFromIB2</string> + <string>272.IBPluginDependency</string> + <string>272.ImportedFromIB2</string> + <string>275.IBPluginDependency</string> + <string>275.ImportedFromIB2</string> + <string>281.IBPluginDependency</string> + <string>281.ImportedFromIB2</string> + <string>282.IBEditorWindowLastContentRect</string> + <string>282.IBPluginDependency</string> + <string>282.ImportedFromIB2</string> + <string>283.IBPluginDependency</string> + <string>283.ImportedFromIB2</string> + <string>284.IBPluginDependency</string> + <string>284.ImportedFromIB2</string> + <string>285.IBPluginDependency</string> + <string>285.ImportedFromIB2</string> + <string>286.IBPluginDependency</string> + <string>286.ImportedFromIB2</string> + <string>287.IBPluginDependency</string> + <string>287.ImportedFromIB2</string> + <string>288.IBPluginDependency</string> + <string>288.ImportedFromIB2</string> + <string>29.IBEditorWindowLastContentRect</string> + <string>29.IBPluginDependency</string> + <string>29.ImportedFromIB2</string> + <string>290.IBPluginDependency</string> + <string>290.ImportedFromIB2</string> + <string>291.IBPluginDependency</string> + <string>291.ImportedFromIB2</string> + <string>309.IBPluginDependency</string> + <string>309.ImportedFromIB2</string> + <string>310.IBEditorWindowLastContentRect</string> + <string>310.IBPluginDependency</string> + <string>310.ImportedFromIB2</string> + <string>311.IBPluginDependency</string> + <string>311.ImportedFromIB2</string> + <string>312.IBPluginDependency</string> + <string>312.ImportedFromIB2</string> + <string>313.IBPluginDependency</string> + <string>313.ImportedFromIB2</string> + <string>314.IBPluginDependency</string> + <string>314.ImportedFromIB2</string> + <string>337.IBEditorWindowLastContentRect</string> + <string>337.IBPluginDependency</string> + <string>337.ImportedFromIB2</string> + <string>338.IBPluginDependency</string> + <string>338.ImportedFromIB2</string> + <string>352.IBPluginDependency</string> + <string>352.ImportedFromIB2</string> + <string>355.IBPluginDependency</string> + <string>56.IBPluginDependency</string> + <string>56.ImportedFromIB2</string> + <string>57.IBEditorWindowLastContentRect</string> + <string>57.IBPluginDependency</string> + <string>57.ImportedFromIB2</string> + <string>58.IBPluginDependency</string> + <string>58.ImportedFromIB2</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{87, 732}, {203, 93}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{368, 762}, {278, 63}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{161, 672}, {173, 153}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{73, 825}, {367, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{280, 752}, {204, 73}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{21, 799}, {164, 23}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>{{85, 622}, {230, 203}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="YES"/> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">356</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">FirstResponder</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>_cycleWindows:</string> + <string>_cycleWindowsBackwards:</string> + <string>addNewTab:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMAppController</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>fileOpen:</string> + <string>newWindow:</string> + <string>newWindowAndActivate:</string> + <string>openWebsite:</string> + <string>openWebsiteKaoriYa:</string> + <string>orderFrontPreferencePanel:</string> + <string>selectNextWindow:</string> + <string>selectPreviousWindow:</string> + <string>showVimHelp:</string> + <string>zoomAll:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">MMAppController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMAppController</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>fontSizeDown:</string> + <string>fontSizeUp:</string> + <string>forceNewWindow:</string> + <string>showHelp:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">MMWindowController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addNewTab:</string> + <string>findAndReplace:</string> + <string>findNext:</string> + <string>findPrevious:</string> + <string>fontSizeDown:</string> + <string>fontSizeUp:</string> + <string>performClose:</string> + <string>toggleToolbar:</string> + <string>vimMenuItemAction:</string> + <string>vimToolbarItemAction:</string> + <string>zoom:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">MMWindowController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSDocumentController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="936254927"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">Miscellaneous.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <reference key="sourceIdentifier" ref="936254927"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PlugInInterface.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>didAdjustSubviews:</string> + <string>willAdjustSubviews:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>RBSplitView</string> + <string>RBSplitView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="737327112"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitSubview.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1012280882"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">RBSplitViewPrivateDefines.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitSubview</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <string key="superclassName">RBSplitSubview</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">delegate</string> + <string key="NS.object.0">id</string> + </object> + <reference key="sourceIdentifier" ref="737327112"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <reference key="sourceIdentifier" ref="1012280882"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">RBSplitView</string> + <string key="superclassName">RBSplitSubview</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="387297422"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="814285932"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="224631482"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSBrowser</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSControl</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="167170315"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSDocumentController</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>clearRecentDocuments:</string> + <string>newDocument:</string> + <string>openDocument:</string> + <string>saveAllDocuments:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSFormatter</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMatrix</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="299220664"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenuItem</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="332552071"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMovieView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="387297422"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="814285932"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="224631482"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="167170315"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="299220664"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1018611152"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="535415750"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSError.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Sparkle.framework/Headers/SUAppcast.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="921023954"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Sparkle.framework/Headers/SUUpdater.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTableView</string> + <string key="superclassName">NSControl</string> + <reference key="sourceIdentifier" ref="1018611152"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSText</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSText.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <reference key="sourceIdentifier" ref="332552071"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <string key="superclassName">NSResponder</string> + <reference key="sourceIdentifier" ref="535415750"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindowController</string> + <string key="superclassName">NSResponder</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">showWindow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">SUUpdater</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">checkForUpdates:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">delegate</string> + <string key="NS.object.0">id</string> + </object> + <reference key="sourceIdentifier" ref="921023954"/> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <string key="IBDocument.LastKnownRelativeProjectPath">../MacVim.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSMenuCheckmark</string> + <string>NSMenuMixedState</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>{9, 8}</string> + <string>{7, 2}</string> + </object> + </object> + </data> +</archive> diff --git a/src/MacVim/Japanese.lproj/MainMenu.nib/keyedobjects.nib b/src/MacVim/Japanese.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000000..f984b790eb Binary files /dev/null and b/src/MacVim/Japanese.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/src/MacVim/Japanese.lproj/MainMenu.strings b/src/MacVim/Japanese.lproj/MainMenu.strings new file mode 100644 index 0000000000..1a48c1a2d4 --- /dev/null +++ b/src/MacVim/Japanese.lproj/MainMenu.strings @@ -0,0 +1,117 @@ + +/* Class = "NSMenu"; title = "MainMenu"; ObjectID = "29"; */ +"29.title" = "MainMenu"; + +/* Class = "NSMenuItem"; title = "MacVim"; ObjectID = "56"; */ +"56.title" = "MacVim"; + +/* Class = "NSMenu"; title = "MacVim"; ObjectID = "57"; */ +"57.title" = "MacVim"; + +/* Class = "NSMenuItem"; title = "About MacVim"; ObjectID = "58"; */ +"58.title" = "MacVim について"; + +/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "129"; */ +"129.title" = "環境設定…"; + +/* Class = "NSMenu"; title = "Services"; ObjectID = "130"; */ +"130.title" = "サービス"; + +/* Class = "NSMenuItem"; title = "Services"; ObjectID = "131"; */ +"131.title" = "サービス"; + +/* Class = "NSMenuItem"; title = "Hide MacVim"; ObjectID = "134"; */ +"134.title" = "MacVim を隠す"; + +/* Class = "NSMenuItem"; title = "Quit MacVim"; ObjectID = "136"; */ +"136.title" = "MacVim を終了"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "145"; */ +"145.title" = "他を隠す"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "150"; */ +"150.title" = "すべてを表示"; + +/* Class = "NSMenuItem"; title = "File"; ObjectID = "217"; */ +"217.title" = "ファイル"; + +/* Class = "NSMenu"; title = "File"; ObjectID = "218"; */ +"218.title" = "ファイル"; + +/* Class = "NSMenuItem"; title = "New Window"; ObjectID = "219"; */ +"219.title" = "新規ウインドウ"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "232"; */ +"232.title" = "ヘルプ"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "233"; */ +"233.title" = "ヘルプ"; + +/* Class = "NSMenuItem"; title = "MacVim Website"; ObjectID = "234"; */ +"234.title" = "MacVim Web サイト"; + +/* Class = "NSMenuItem"; title = "Close"; ObjectID = "248"; */ +"248.title" = "ウインドウを閉じる"; + +/* Class = "NSMenuItem"; title = "Check for updates…"; ObjectID = "255"; */ +"255.title" = "アップデートを確認…"; + +/* Class = "NSMenuItem"; title = "Open…"; ObjectID = "261"; */ +"261.title" = "開く…"; + +/* Class = "NSMenuItem"; title = "Open Recent"; ObjectID = "262"; */ +"262.title" = "最近開いたファイル"; + +/* Class = "NSMenu"; title = "Open Recent"; ObjectID = "271"; */ +"271.title" = "最近開いたファイル"; + +/* Class = "NSMenuItem"; title = "Clear Menu"; ObjectID = "272"; */ +"272.title" = "メニューを消去"; + +/* Class = "NSMenuItem"; title = "MacVim Help"; ObjectID = "275"; */ +"275.title" = "MacVim ヘルプ"; + +/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "281"; */ +"281.title" = "編集"; + +/* Class = "NSMenu"; title = "Edit"; ObjectID = "282"; */ +"282.title" = "編集"; + +/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "283"; */ +"283.title" = "取り消す"; + +/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "284"; */ +"284.title" = "やり直す"; + +/* Class = "NSMenuItem"; title = "Cut"; ObjectID = "286"; */ +"286.title" = "カット"; + +/* Class = "NSMenuItem"; title = "Copy"; ObjectID = "287"; */ +"287.title" = "コピー"; + +/* Class = "NSMenuItem"; title = "Paste"; ObjectID = "288"; */ +"288.title" = "ペースト"; + +/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "290"; */ +"290.title" = "削除"; + +/* Class = "NSMenuItem"; title = "Select All"; ObjectID = "291"; */ +"291.title" = "すべてを選択"; + +/* Class = "NSMenuItem"; title = "Window"; ObjectID = "309"; */ +"309.title" = "ウインドウ"; + +/* Class = "NSMenu"; title = "Window"; ObjectID = "310"; */ +"310.title" = "ウインドウ"; + +/* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "311"; */ +"311.title" = "縮小"; + +/* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "312"; */ +"312.title" = "拡大"; + +/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "314"; */ +"314.title" = "すべてを手前に移動"; + +/* Class = "NSMenuItem"; title = "New Window"; ObjectID = "338"; */ +"338.title" = "新規ウインドウ"; diff --git a/src/MacVim/Japanese.lproj/Preferences.nib/designable.nib b/src/MacVim/Japanese.lproj/Preferences.nib/designable.nib new file mode 100644 index 0000000000..04e94abbb6 --- /dev/null +++ b/src/MacVim/Japanese.lproj/Preferences.nib/designable.nib @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <deployment version="1050" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="MMPreferenceController"> + <connections> + <outlet property="advancedPreferences" destination="620" id="632"/> + <outlet property="generalPreferences" destination="115" id="143"/> + <outlet property="layoutPopUpButton" destination="427" id="596"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> + <userDefaultsController representsSharedInstance="YES" id="58" userLabel="Shared Defaults"/> + <customView id="115" userLabel="General"> + <rect key="frame" x="0.0" y="0.0" width="483" height="303"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <popUpButton verticalHuggingPriority="750" id="957"> + <rect key="frame" x="206" y="16" width="197" height="26"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" title="MacVimを終了しない" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" selectedItem="960" id="979"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="menu"/> + <menu key="menu" title="OtherViews" id="959"> + <items> + <menuItem title="MacVimを終了しない" state="on" id="960"/> + <menuItem title="MacVimを隠す" id="961"/> + <menuItem title="MacVimを終了" id="962"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <binding destination="58" name="selectedIndex" keyPath="values.MMLastWindowClosedBehavior" id="968"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="126"> + <rect key="frame" x="17" y="22" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="最後のウインドウを閉じた時:" id="977"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <popUpButton verticalHuggingPriority="750" id="427"> + <rect key="frame" x="218" y="122" width="229" height="26"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" title="引数リストに設定する" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" selectedItem="436" id="978"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="menu"/> + <menu key="menu" title="OtherViews" id="429"> + <items> + <menuItem title="タブで開く" tag="3" id="430"/> + <menuItem title="ウインドウで開く" tag="4" id="544"> + <connections> + <binding destination="58" name="enabled" keyPath="values.MMOpenInCurrentWindow" id="546"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSNegateBoolean</string> + </dictionary> + </binding> + </connections> + </menuItem> + <menuItem title="分割して開く" tag="1" id="431"/> + <menuItem title="引数リストに設定する" state="on" id="436"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <binding destination="58" name="selectedTag" keyPath="values.MMOpenLayout" id="441"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="124"> + <rect key="frame" x="17" y="200" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="MacVim起動時:" id="976"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="122"> + <rect key="frame" x="207" y="199" width="258" height="18"/> + <autoresizingMask key="autoresizingMask"/> + <buttonCell key="cell" type="check" title="アップデートを確認" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="975"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.SUCheckAtStartup" id="169"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="121"> + <rect key="frame" x="209" y="48" width="257" height="70"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Finderからファイルを開いたとき(たとえば、ファイルをダブルクリックしたり、ファイルをDockのMacVimアイコンにドラッグしたとき)、またはXcodeのような外部プログラムからファイルを開いたときに適用されます。" id="974"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" id="120"> + <rect key="frame" x="209" y="154" width="243" height="38"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <size key="cellSize" width="243" height="18"/> + <size key="intercellSpacing" width="4" height="2"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="997"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <cells> + <column> + <buttonCell type="radio" title="新規ウインドウで開く" imagePosition="left" alignment="left" inset="2" id="135"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="現在のウインドウで開く" imagePosition="left" alignment="left" state="on" tag="1" inset="2" id="134"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + </column> + </cells> + <connections> + <action selector="openInCurrentWindowSelectionChanged:" target="-2" id="572"/> + <binding destination="58" name="selectedTag" keyPath="values.MMOpenInCurrentWindow" id="520"/> + </connections> + </matrix> + <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="119"> + <rect key="frame" x="209" y="225" width="243" height="58"/> + <autoresizingMask key="autoresizingMask"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <size key="cellSize" width="243" height="18"/> + <size key="intercellSpacing" width="4" height="2"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="996"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <cells> + <column> + <buttonCell type="radio" title="起動時と再アクティブ時" imagePosition="left" alignment="left" state="on" tag="3" inset="2" id="139"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="MacVim起動時のみ" imagePosition="left" alignment="left" tag="1" inset="2" id="138"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <buttonCell type="radio" title="開かない" imagePosition="left" alignment="left" inset="2" id="137"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + </column> + </cells> + <connections> + <binding destination="58" name="selectedTag" keyPath="values.MMUntitledWindow" id="171"/> + </connections> + </matrix> + <textField verticalHuggingPriority="750" id="117"> + <rect key="frame" x="17" y="266" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="空のウインドウを開く時:" id="973"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="116"> + <rect key="frame" x="17" y="175" width="187" height="17"/> + <autoresizingMask key="autoresizingMask"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="アプリケーションからファイルを開く時:" id="972"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + </customView> + <customView id="620" userLabel="Advanced"> + <rect key="frame" x="0.0" y="0.0" width="485" height="336"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <textField verticalHuggingPriority="750" id="826"> + <rect key="frame" x="18" y="178" width="449" height="56"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="993"> + <font key="font" metaFont="smallSystem"/> + <string key="title">クイックスタートを有効にすると、新規ウインドウが瞬時に開くようになりますが、最新のランタイムファイルが読み込まれない場合があります。ランタイムファイル(たとえば ~/.vim ディレクトリのファイル)を変更して、新規ウインドウに確実に変更を反映させたい場合は、一旦クイックスタートを無効にしてから、再度有効にしてください。</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="817"> + <rect key="frame" x="19" y="240" width="204" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="クイックスタートを有効にする" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="992"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="quickstartButtonClicked:" target="-1" id="858"/> + <binding destination="58" name="value" keyPath="values.MMPreloadCacheSize" id="828"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="815"> + <rect key="frame" x="18" y="264" width="449" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="Core Textレンダラは標準レンダラよりも高速ですが、3本指ダブルタップによる辞書引きが動きません。" id="991"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="782"> + <rect key="frame" x="19" y="300" width="204" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Core Textレンダラを使用する" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="990"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="coreTextButtonClicked:" target="-1" id="MdA-WG-Y9J"/> + <binding destination="58" name="value" keyPath="values.MMRenderer" id="1000"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="1001"> + <rect key="frame" x="18" y="92" width="449" height="56"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1004"> + <font key="font" size="11" name="AquaKana"/> + <string key="title">ことえり等のインプットメソッドの入力をインラインで描画します。Core Textレンダラを使用する場合は、インプットメソッドの入力を描画するために、このオプションも有効にする必要があります。しかしながら、環境によってはいくつかの制限事項があります(たとえば"dead keys"へのマッピングは動かないでしょう)。</string> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="1013"> + <rect key="frame" x="19" y="154" width="269" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="インラインインプットメソッドを使用する" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="1014"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.MMUseInlineIm" id="1016"/> + </connections> + </button> + <button id="1028"> + <rect key="frame" x="18" y="68" width="390" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="OS標準フルスクリーン機能を使用する (要Mac OS X 10.7以上)" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="1029"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <binding destination="58" name="value" keyPath="values.MMNativeFullScreen" id="1031"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="1017"> + <rect key="frame" x="18" y="20" width="449" height="42"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="OS標準フルスクリーン機能では、マルチモニタ使用時は2つ目のモニタが機能しないと言える状態なので、このオプションを無効にして、MacVim独自実装のフルスクリーン機能を使用すると良いでしょう。" id="1020"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + <point key="canvasLocation" x="43.5" y="781"/> + </customView> + </objects> +</document> diff --git a/src/MacVim/Japanese.lproj/Preferences.nib/keyedobjects.nib b/src/MacVim/Japanese.lproj/Preferences.nib/keyedobjects.nib new file mode 100644 index 0000000000..9255f4af87 Binary files /dev/null and b/src/MacVim/Japanese.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/src/MacVim/Japanese.lproj/Preferences.strings b/src/MacVim/Japanese.lproj/Preferences.strings new file mode 100644 index 0000000000..9177a4910a --- /dev/null +++ b/src/MacVim/Japanese.lproj/Preferences.strings @@ -0,0 +1,90 @@ + +/* Class = "NSButtonCell"; title = "現在のウインドウで開く"; ObjectID = "134"; */ +"134.title" = "現在のウインドウで開く"; + +/* Class = "NSButtonCell"; title = "新規ウインドウで開く"; ObjectID = "135"; */ +"135.title" = "新規ウインドウで開く"; + +/* Class = "NSButtonCell"; title = "開かない"; ObjectID = "137"; */ +"137.title" = "開かない"; + +/* Class = "NSButtonCell"; title = "MacVim起動時のみ"; ObjectID = "138"; */ +"138.title" = "MacVim起動時のみ"; + +/* Class = "NSButtonCell"; title = "起動時と再アクティブ時"; ObjectID = "139"; */ +"139.title" = "起動時と再アクティブ時"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "429"; */ +"429.title" = "OtherViews"; + +/* Class = "NSMenuItem"; title = "タブで開く"; ObjectID = "430"; */ +"430.title" = "タブで開く"; + +/* Class = "NSMenuItem"; title = "分割して開く"; ObjectID = "431"; */ +"431.title" = "分割して開く"; + +/* Class = "NSMenuItem"; title = "引数リストに設定する"; ObjectID = "436"; */ +"436.title" = "引数リストに設定する"; + +/* Class = "NSMenuItem"; title = "ウインドウで開く"; ObjectID = "544"; */ +"544.title" = "ウインドウで開く"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "959"; */ +"959.title" = "OtherViews"; + +/* Class = "NSMenuItem"; title = "MacVimを終了しない"; ObjectID = "960"; */ +"960.title" = "MacVimを終了しない"; + +/* Class = "NSMenuItem"; title = "MacVimを隠す"; ObjectID = "961"; */ +"961.title" = "MacVimを隠す"; + +/* Class = "NSMenuItem"; title = "MacVimを終了"; ObjectID = "962"; */ +"962.title" = "MacVimを終了"; + +/* Class = "NSTextFieldCell"; title = "アプリケーションからファイルを開く時:"; ObjectID = "972"; */ +"972.title" = "アプリケーションからファイルを開く時:"; + +/* Class = "NSTextFieldCell"; title = "空のウインドウを開く時:"; ObjectID = "973"; */ +"973.title" = "空のウインドウを開く時:"; + +/* Class = "NSTextFieldCell"; title = "Finderからファイルを開いたとき(たとえば、ファイルをダブルクリックしたり、ファイルをDockのMacVimアイコンにドラッグしたとき)、またはXcodeのような外部プログラムからファイルを開いたときに適用されます。"; ObjectID = "974"; */ +"974.title" = "Finderからファイルを開いたとき(たとえば、ファイルをダブルクリックしたり、ファイルをDockのMacVimアイコンにドラッグしたとき)、またはXcodeのような外部プログラムからファイルを開いたときに適用されます。"; + +/* Class = "NSButtonCell"; title = "アップデートを確認"; ObjectID = "975"; */ +"975.title" = "アップデートを確認"; + +/* Class = "NSTextFieldCell"; title = "MacVim起動時:"; ObjectID = "976"; */ +"976.title" = "MacVim起動時:"; + +/* Class = "NSTextFieldCell"; title = "最後のウインドウを閉じた時:"; ObjectID = "977"; */ +"977.title" = "最後のウインドウを閉じた時:"; + +/* Class = "NSButtonCell"; title = "Use Core Text renderer"; ObjectID = "990"; */ +"990.title" = "Core Textレンダラを使用する"; + +/* Class = "NSTextFieldCell"; title = "Selecting this option will increase rendering performance but double-tapping with three fingers to look up words will no longer work."; ObjectID = "991"; */ +"991.title" = "Core Textレンダラは標準レンダラよりも高速ですが、3本指ダブルタップによる辞書引きが動きません。"; + +/* Class = "NSButtonCell"; title = "クイックスタートを有効にする"; ObjectID = "992"; */ +"992.title" = "クイックスタートを有効にする"; + +/* Class = "NSTextFieldCell"; title = "クイックスタートを有効にすると、新規ウインドウが瞬時に開くようになりますが、最新のランタイムファイルが読み込まれない場合があります。ランタイムファイル(たとえば ~/.vim ディレクトリのファイル)を変更して、新規ウインドウに確実に変更を反映させたい場合は、一旦クイックスタートを無効にしてから、再度有効にしてください。"; ObjectID = "993"; */ +"993.title" = "クイックスタートを有効にすると、新規ウインドウが瞬時に開くようになりますが、最新のランタイムファイルが読み込まれない場合があります。ランタイムファイル(たとえば ~/.vim ディレクトリのファイル)を変更して、新規ウインドウに確実に変更を反映させたい場合は、一旦クイックスタートを無効にしてから、再度有効にしてください。"; + +/* Class = "NSButtonCell"; title = "Radio"; ObjectID = "996"; */ +"996.title" = "Radio"; + +/* Class = "NSButtonCell"; title = "Radio"; ObjectID = "997"; */ +"997.title" = "Radio"; + +/* Class = "NSTextFieldCell"; title = "This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to \"dead keys\" may not work). Note that without this option the Core Text renderer will not draw marked text at all."; ObjectID = "1004"; */ +"1004.title" = "ことえり等のインプットメソッドの入力をインラインで描画します。Core Textレンダラを使用する場合は、インプットメソッドの入力を描画するために、このオプションも有効にする必要があります。しかしながら、環境によってはいくつかの制限事項があります(たとえば\"dead keys\"へのマッピングは動かないでしょう)。"; + +/* Class = "NSButtonCell"; title = "インラインインプットメソッドを使用する"; ObjectID = "1014"; */ +"1014.title" = "インラインインプットメソッドを使用する"; + +/* Class = "NSTextFieldCell"; title = "OS標準フルスクリーン機能では、マルチモニタ使用時は2つ目のモニタが機能しないと言える状態なので、このオプションを無効にして、MacVim独自実装のフルスクリーン機能を使用すると良いでしょう。"; ObjectID = "1020"; */ +"1020.title" = "OS標準フルスクリーン機能では、マルチモニタ使用時は2つ目のモニタが機能しないと言える状態なので、このオプションを無効にして、MacVim独自実装のフルスクリーン機能を使用すると良いでしょう。"; + +/* Class = "NSButtonCell"; title = "OS標準フルスクリーン機能を使用する (要Mac OS X 10.7以上)"; ObjectID = "1029"; */ +"1029.title" = "OS標準フルスクリーン機能を使用する (要Mac OS X 10.7以上)"; diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h index 289c1cdd3c..df1dc032bc 100644 --- a/src/MacVim/MMAppController.h +++ b/src/MacVim/MMAppController.h @@ -31,9 +31,7 @@ NSMutableDictionary *inputQueues; int processingFlag; -#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) FSEventStreamRef fsEventStream; -#endif } + (MMAppController *)sharedInstance; @@ -53,7 +51,11 @@ - (IBAction)selectPreviousWindow:(id)sender; - (IBAction)orderFrontPreferencePanel:(id)sender; - (IBAction)openWebsite:(id)sender; +- (IBAction)openWebsiteKaoriYa:(id)sender; - (IBAction)showVimHelp:(id)sender; - (IBAction)zoomAll:(id)sender; +- (IBAction)stayInFront:(id)sender; +- (IBAction)stayInBack:(id)sender; +- (IBAction)stayLevelNormal:(id)sender; @end diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 265ec677d2..fd09d02eaa 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -45,10 +45,8 @@ #import "Miscellaneous.h" #import <unistd.h> #import <CoreServices/CoreServices.h> -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) // Need Carbon for TIS...() functions #import <Carbon/Carbon.h> -#endif #define MM_HANDLE_XCODE_MOD_EVENT 0 @@ -59,14 +57,13 @@ static NSTimeInterval MMRequestTimeout = 5; static NSTimeInterval MMReplyTimeout = 5; -static NSString *MMWebsiteString = @"http://code.google.com/p/macvim/"; +static NSString *MMWebsiteString = @"https://macvim-dev.github.io/macvim/"; +static NSString *MMWebsiteKaoriYaString = @"https://github.com/splhack/macvim-kaoriya/"; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) // Latency (in s) between FS event occuring and being reported to MacVim. // Should be small so that MacVim is notified of changes to the ~/.vim // directory more or less immediately. static CFTimeInterval MMEventStreamLatency = 0.1; -#endif static float MMCascadeHorizontalOffset = 21; static float MMCascadeVerticalOffset = 23; @@ -143,14 +140,11 @@ - (NSString *)workingDirectoryForArguments:(NSDictionary *)args; - (NSScreen *)screenContainingTopLeftPoint:(NSPoint)pt; - (void)addInputSourceChangedObserver; - (void)removeInputSourceChangedObserver; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - (void)inputSourceChanged:(NSNotification *)notification; -#endif @end -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) static void fsEventCallback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo, @@ -161,7 +155,6 @@ - (void)inputSourceChanged:(NSNotification *)notification; { [[MMAppController sharedInstance] handleFSEvent]; } -#endif @implementation MMAppController @@ -189,41 +182,61 @@ + (void)initialize CFPreferencesSetAppValue(CFSTR("NSRepeatCountBinding"), CFSTR(""), kCFPreferencesCurrentApplication); - + + int tabMinWidthKey; + int tabMaxWidthKey; + int tabOptimumWidthKey; + if (shouldUseYosemiteTabBarStyle()) { + tabMinWidthKey = 120; + tabMaxWidthKey = 0; + tabOptimumWidthKey = 0; + } else { + tabMinWidthKey = 64; + tabMaxWidthKey = 6*64; + tabOptimumWidthKey = 132; + } + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:NO], MMNoWindowKey, - [NSNumber numberWithInt:64], MMTabMinWidthKey, - [NSNumber numberWithInt:6*64], MMTabMaxWidthKey, - [NSNumber numberWithInt:132], MMTabOptimumWidthKey, - [NSNumber numberWithBool:YES], MMShowAddTabButtonKey, - [NSNumber numberWithInt:2], MMTextInsetLeftKey, - [NSNumber numberWithInt:1], MMTextInsetRightKey, - [NSNumber numberWithInt:1], MMTextInsetTopKey, - [NSNumber numberWithInt:1], MMTextInsetBottomKey, - @"MMTypesetter", MMTypesetterKey, - [NSNumber numberWithFloat:1], MMCellWidthMultiplierKey, - [NSNumber numberWithFloat:-1], MMBaselineOffsetKey, - [NSNumber numberWithBool:YES], MMTranslateCtrlClickKey, - [NSNumber numberWithInt:0], MMOpenInCurrentWindowKey, - [NSNumber numberWithBool:NO], MMNoFontSubstitutionKey, - [NSNumber numberWithBool:YES], MMLoginShellKey, - [NSNumber numberWithInt:2], MMRendererKey, + [NSNumber numberWithBool:NO], MMNoWindowKey, + [NSNumber numberWithInt:tabMinWidthKey], + MMTabMinWidthKey, + [NSNumber numberWithInt:tabMaxWidthKey], + MMTabMaxWidthKey, + [NSNumber numberWithInt:tabOptimumWidthKey], + MMTabOptimumWidthKey, + [NSNumber numberWithBool:YES], MMShowAddTabButtonKey, + [NSNumber numberWithInt:2], MMTextInsetLeftKey, + [NSNumber numberWithInt:1], MMTextInsetRightKey, + [NSNumber numberWithInt:1], MMTextInsetTopKey, + [NSNumber numberWithInt:1], MMTextInsetBottomKey, + @"MMTypesetter", MMTypesetterKey, + [NSNumber numberWithFloat:1], MMCellWidthMultiplierKey, + [NSNumber numberWithFloat:-1], MMBaselineOffsetKey, + [NSNumber numberWithBool:YES], MMTranslateCtrlClickKey, + [NSNumber numberWithInt:0], MMOpenInCurrentWindowKey, + [NSNumber numberWithBool:NO], MMNoFontSubstitutionKey, + [NSNumber numberWithBool:YES], MMLoginShellKey, + [NSNumber numberWithInt:MMRendererCoreText], + MMRendererKey, [NSNumber numberWithInt:MMUntitledWindowAlways], - MMUntitledWindowKey, - [NSNumber numberWithBool:NO], MMTexturedWindowKey, - [NSNumber numberWithBool:NO], MMZoomBothKey, - @"", MMLoginShellCommandKey, - @"", MMLoginShellArgumentKey, - [NSNumber numberWithBool:YES], MMDialogsTrackPwdKey, - [NSNumber numberWithInt:3], MMOpenLayoutKey, - [NSNumber numberWithBool:NO], MMVerticalSplitKey, - [NSNumber numberWithInt:0], MMPreloadCacheSizeKey, - [NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey, + MMUntitledWindowKey, + [NSNumber numberWithBool:NO], MMZoomBothKey, + @"", MMLoginShellCommandKey, + @"", MMLoginShellArgumentKey, + [NSNumber numberWithBool:YES], MMDialogsTrackPwdKey, + [NSNumber numberWithInt:3], MMOpenLayoutKey, + [NSNumber numberWithBool:NO], MMVerticalSplitKey, + [NSNumber numberWithInt:0], MMPreloadCacheSizeKey, + [NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey, #ifdef INCLUDE_OLD_IM_CODE - [NSNumber numberWithBool:YES], MMUseInlineImKey, + [NSNumber numberWithBool:YES], MMUseInlineImKey, #endif // INCLUDE_OLD_IM_CODE - [NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey, - [NSNumber numberWithBool:YES], MMNativeFullScreenKey, + [NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey, + [NSNumber numberWithBool:YES], MMNativeFullScreenKey, + [NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey, + [NSNumber numberWithBool:NO], MMUseCGLayerAlwaysKey, + [NSNumber numberWithBool:YES], MMShareFindPboardKey, + [NSNumber numberWithBool:YES], MMIgnoreShiftSpaceKey, nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:dict]; @@ -323,7 +336,8 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification int idx = [fileMenu indexOfItemWithAction:@selector(fileOpen:)]; if (idx >= 0 && idx+1 < [fileMenu numberOfItems]) - recentFilesMenuItem = [fileMenu itemWithTitle:@"Open Recent"]; + recentFilesMenuItem = + [fileMenu itemWithTitle:NSLocalizedString(@"Open Recent", nil)]; [[recentFilesMenuItem submenu] performSelector:@selector(_setMenuName:) withObject:@"NSRecentDocumentsMenu"]; @@ -509,7 +523,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: if (modifiedBuffers) { NSAlert *alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Dialog button")]; [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @@ -539,7 +553,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: if (numWindows > 1 || numTabs > 1) { NSAlert *alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Dialog button")]; [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @@ -547,9 +561,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: [alert setMessageText:NSLocalizedString( @"Are you sure you want to quit MacVim?", @"Quit dialog with no changed buffers, title")]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) [alert setShowsSuppressionButton:YES]; -#endif NSString *info = nil; if (numWindows > 1) { @@ -579,12 +591,10 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: if ([alert runModal] != NSAlertFirstButtonReturn) reply = NSTerminateCancel; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if ([[alert suppressionButton] state] == NSOnState) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:MMSuppressTerminationAlertKey]; } -#endif [alert release]; } @@ -769,6 +779,7 @@ - (void)windowControllerWillOpen:(MMWindowController *)windowController if (!screen) screen = [win screen]; + BOOL willSwitchScreens = screen != [win screen]; if (cascadeFrom) { // Do manual cascading instead of using // -[MMWindow cascadeTopLeftFromPoint:] since it is rather @@ -795,7 +806,14 @@ - (void)windowControllerWillOpen:(MMWindowController *)windowController ASLogNotice(@"Window not on screen, don't constrain position"); } - [win setFrameTopLeftPoint:topLeft]; + // setFrameTopLeftPoint will trigger a resize event if the window is + // moved across monitors; at this point such a resize would incorrectly + // constrain the window to the default vim dimensions, so a specialized + // method is used that will avoid that behavior. + if (willSwitchScreens) + [windowController moveWindowAcrossScreens:topLeft]; + else + [win setFrameTopLeftPoint:topLeft]; } if (1 == [vimControllers count]) { @@ -1071,11 +1089,8 @@ - (IBAction)fileOpen:(id)sender NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setAllowsMultipleSelection:YES]; + [panel setCanChooseDirectories:YES]; [panel setAccessoryView:showHiddenFilesView()]; -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) - // NOTE: -[NSOpenPanel runModalForDirectory:file:types:] is deprecated on - // 10.7 but -[NSOpenPanel setDirectoryURL:] requires 10.6 so jump through - // the following hoops on 10.6+. dir = [dir stringByExpandingTildeInPath]; if (dir) { NSURL *dirURL = [NSURL fileURLWithPath:dir isDirectory:YES]; @@ -1084,10 +1099,12 @@ - (IBAction)fileOpen:(id)sender } NSInteger result = [panel runModal]; + +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) + if (NSModalResponseOK == result) { #else - NSInteger result = [panel runModalForDirectory:dir file:nil types:nil]; -#endif if (NSOKButton == result) { +#endif // NOTE: -[NSOpenPanel filenames] is deprecated on 10.7 so use // -[NSOpenPanel URLs] instead. The downside is that we have to check // that each URL is really a path first. @@ -1168,6 +1185,13 @@ - (IBAction)openWebsite:(id)sender [NSURL URLWithString:MMWebsiteString]]; } +- (IBAction)openWebsiteKaoriYa:(id)sender +{ + ASLogDebug(@"Open MacVim-KaoriYa website"); + [[NSWorkspace sharedWorkspace] openURL: + [NSURL URLWithString:MMWebsiteKaoriYaString]]; +} + - (IBAction)showVimHelp:(id)sender { ASLogDebug(@"Open window with Vim help"); @@ -1183,18 +1207,35 @@ - (IBAction)zoomAll:(id)sender [NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES]; } -- (IBAction)atsuiButtonClicked:(id)sender +- (IBAction)stayInFront:(id)sender { - ASLogDebug(@"Toggle ATSUI renderer"); + ASLogDebug(@"Stay in Front"); + NSWindow *keyWindow = [NSApp keyWindow]; + [keyWindow setLevel:NSFloatingWindowLevel]; +} + +- (IBAction)stayInBack:(id)sender +{ + ASLogDebug(@"Stay in Back"); + NSWindow *keyWindow = [NSApp keyWindow]; + [keyWindow setLevel:kCGDesktopIconWindowLevel +1]; +} + +- (IBAction)stayLevelNormal:(id)sender +{ + ASLogDebug(@"Stay level normal"); + NSWindow *keyWindow = [NSApp keyWindow]; + [keyWindow setLevel:NSNormalWindowLevel]; +} + +- (IBAction)coreTextButtonClicked:(id)sender +{ + ASLogDebug(@"Toggle CoreText renderer"); NSInteger renderer = MMRendererDefault; BOOL enable = ([sender state] == NSOnState); if (enable) { -#if MM_ENABLE_ATSUI - renderer = MMRendererATSUI; -#else renderer = MMRendererCoreText; -#endif } // Update the user default MMRenderer and synchronize the change so that @@ -1207,11 +1248,19 @@ - (IBAction)atsuiButtonClicked:(id)sender ASLogInfo(@"Use renderer=%ld", renderer); - // This action is called when the user clicks the "use ATSUI renderer" + // This action is called when the user clicks the "use CoreText renderer" // button in the advanced preferences pane. [self rebuildPreloadCache]; } +- (IBAction)inlineImButtonClicked:(id)sender +{ + ASLogDebug(@"Toggle inline IM option"); + // This action is called when the user clicks the "use inline IM" button + // in the advanced preferences pane. + [self rebuildPreloadCache]; +} + - (IBAction)loginShellButtonClicked:(id)sender { ASLogDebug(@"Toggle login shell option"); @@ -1574,7 +1623,7 @@ - (NSArray *)filterFilesAndNotify:(NSArray *)filenames } [alert setInformativeText:text]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; [alert release]; @@ -1686,12 +1735,17 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event while ((param = [enumerator nextObject])) { NSArray *arr = [param componentsSeparatedByString:@"="]; if ([arr count] == 2) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11 + [dict setValue:[[arr lastObject] stringByRemovingPercentEncoding] + forKey:[[arr objectAtIndex:0] stringByRemovingPercentEncoding]]; +#else [dict setValue:[[arr lastObject] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding] forKey:[[arr objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]; +#endif } } @@ -1738,7 +1792,7 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event @"Unknown URL Scheme dialog, text"), [url host]]]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; [alert release]; } @@ -1856,7 +1910,7 @@ - (void)preloadVimController:(id)sender // background, the runloop won't bother flushing the autorelease pool. // Triggering an NSEvent works around this. // http://www.mikeash.com/pyblog/more-fun-with-autorelease.html - NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined + NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 @@ -1980,13 +2034,6 @@ - (void)rebuildPreloadCache } } - -// HACK: fileAttributesAtPath was deprecated in 10.5 -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) -#define MM_fileAttributes(fm,p) [fm attributesOfItemAtPath:p error:NULL] -#else -#define MM_fileAttributes(fm,p) [fm fileAttributesAtPath:p traverseLink:YES] -#endif - (NSDate *)rcFilesModificationDate { // Check modification dates for ~/.vimrc and ~/.gvimrc and return the @@ -1998,20 +2045,20 @@ - (NSDate *)rcFilesModificationDate NSFileManager *fm = [NSFileManager defaultManager]; NSString *path = [@"~/.vimrc" stringByExpandingTildeInPath]; - NSDictionary *attr = MM_fileAttributes(fm, path); + NSDictionary *attr = [fm attributesOfItemAtPath:path error:NULL]; if (!attr) { path = [@"~/_vimrc" stringByExpandingTildeInPath]; - attr = MM_fileAttributes(fm, path); + attr = [fm attributesOfItemAtPath:path error:NULL]; } NSDate *modDate = [attr objectForKey:NSFileModificationDate]; if (modDate) date = modDate; path = [@"~/.gvimrc" stringByExpandingTildeInPath]; - attr = MM_fileAttributes(fm, path); + attr = [fm attributesOfItemAtPath:path error:NULL]; if (!attr) { path = [@"~/_gvimrc" stringByExpandingTildeInPath]; - attr = MM_fileAttributes(fm, path); + attr = [fm attributesOfItemAtPath:path error:NULL]; } modDate = [attr objectForKey:NSFileModificationDate]; if (modDate) @@ -2019,7 +2066,6 @@ - (NSDate *)rcFilesModificationDate return date; } -#undef MM_fileAttributes - (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments { @@ -2060,11 +2106,8 @@ - (void)activateWhenNextWindowOpens - (void)startWatchingVimDir { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if (fsEventStream) return; - if (NULL == FSEventStreamStart) - return; // FSEvent functions are weakly linked NSString *path = [@"~/.vim" stringByExpandingTildeInPath]; NSArray *pathsToWatch = [NSArray arrayWithObject:path]; @@ -2079,15 +2122,10 @@ - (void)startWatchingVimDir FSEventStreamStart(fsEventStream); ASLogDebug(@"Started FS event stream"); -#endif } - (void)stopWatchingVimDir { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - if (NULL == FSEventStreamStop) - return; // FSEvent functions are weakly linked - if (fsEventStream) { FSEventStreamStop(fsEventStream); FSEventStreamInvalidate(fsEventStream); @@ -2095,8 +2133,6 @@ - (void)stopWatchingVimDir fsEventStream = NULL; ASLogDebug(@"Stopped FS event stream"); } -#endif - } - (void)handleFSEvent @@ -2474,36 +2510,21 @@ - (NSScreen *)screenContainingTopLeftPoint:(NSPoint)pt - (void)addInputSourceChangedObserver { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - // The TIS symbols are weakly linked. - if (NULL != TISCopyCurrentKeyboardInputSource) { - // We get here when compiled on >=10.5 and running on >=10.5. - - id nc = [NSDistributedNotificationCenter defaultCenter]; - NSString *notifyInputSourceChanged = - (NSString *)kTISNotifySelectedKeyboardInputSourceChanged; - [nc addObserver:self - selector:@selector(inputSourceChanged:) - name:notifyInputSourceChanged - object:nil]; - } -#endif + id nc = [NSDistributedNotificationCenter defaultCenter]; + NSString *notifyInputSourceChanged = + (NSString *)kTISNotifySelectedKeyboardInputSourceChanged; + [nc addObserver:self + selector:@selector(inputSourceChanged:) + name:notifyInputSourceChanged + object:nil]; } - (void)removeInputSourceChangedObserver { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - // The TIS symbols are weakly linked. - if (NULL != TISCopyCurrentKeyboardInputSource) { - // We get here when compiled on >=10.5 and running on >=10.5. - - id nc = [NSDistributedNotificationCenter defaultCenter]; - [nc removeObserver:self]; - } -#endif + id nc = [NSDistributedNotificationCenter defaultCenter]; + [nc removeObserver:self]; } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - (void)inputSourceChanged:(NSNotification *)notification { unsigned i, count = [vimControllers count]; @@ -2514,6 +2535,5 @@ - (void)inputSourceChanged:(NSNotification *)notification [tv checkImState]; } } -#endif @end // MMAppController (Private) diff --git a/src/MacVim/MMApplication.m b/src/MacVim/MMApplication.m index 9127d43807..c6aeee09de 100644 --- a/src/MacVim/MMApplication.m +++ b/src/MacVim/MMApplication.m @@ -13,17 +13,9 @@ * Some default NSApplication key input behavior is overridden here. */ +#import "MacVim.h" #import "MMApplication.h" -// Ctrl-Tab is broken on pre 10.5, so we add a hack to make it work. -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 -# import "MMTextView.h" -# define MM_CTRL_TAB_HACK 1 -#endif - - - - @implementation MMApplication - (void)sendEvent:(NSEvent *)event @@ -31,32 +23,20 @@ - (void)sendEvent:(NSEvent *)event NSEventType type = [event type]; unsigned flags = [event modifierFlags]; -#ifdef MM_CTRL_TAB_HACK - NSResponder *firstResponder = [[self keyWindow] firstResponder]; - - if (NSKeyDown == type && NSControlKeyMask & flags && 48 == [event keyCode] - && [firstResponder isKindOfClass:[MMTextView class]]) { - // HACK! This is a Ctrl-Tab key down event and the first responder is - // an MMTextView; send the event directly to the text view, else it - // will never receive it on pre 10.5 systems. - [firstResponder keyDown:event]; - return; - } -#endif - // HACK! Intercept 'help' key presses and clear the 'help key flag', else // Cocoa turns the mouse cursor into a question mark and goes into 'context // help mode' (the keyDown: event itself never reaches the text view). By // clearing the 'help key flag' this event will be treated like a normal // key event. - if ((NSKeyDown == type || NSKeyUp == type) && (flags & NSHelpKeyMask)) { - flags &= ~NSHelpKeyMask; + if ((NSEventTypeKeyDown == type || NSEventTypeKeyUp == type) && + (flags & NSEventModifierFlagHelp)) { + flags &= ~NSEventModifierFlagHelp; event = [NSEvent keyEventWithType:[event type] location:[event locationInWindow] modifierFlags:flags timestamp:[event timestamp] windowNumber:[event windowNumber] - context:[event context] + context:nil // [event context] is always nil characters:[event characters] charactersIgnoringModifiers:[event charactersIgnoringModifiers] isARepeat:[event isARepeat] @@ -66,7 +46,6 @@ - (void)sendEvent:(NSEvent *)event [super sendEvent:event]; } - - (void)orderFrontStandardAboutPanel:(id)sender { NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey: @@ -74,7 +53,7 @@ - (void)orderFrontStandardAboutPanel:(id)sender NSString *marketingVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; NSString *title = [NSString stringWithFormat: - @"Custom Version %@ (%@)", marketingVersion, version]; + @"Custom Version %@ (KaoriYa %@)", marketingVersion, version]; [self orderFrontStandardAboutPanelWithOptions: [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/src/MacVim/MMAtsuiTextView.h b/src/MacVim/MMAtsuiTextView.h deleted file mode 100644 index fd6d92768b..0000000000 --- a/src/MacVim/MMAtsuiTextView.h +++ /dev/null @@ -1,107 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4 ft=objc: - * - * VIM - Vi IMproved by Bram Moolenaar - * MacVim GUI port by Bjorn Winckler - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ - - -#import <Cocoa/Cocoa.h> -#import "Miscellaneous.h" - -#if MM_ENABLE_ATSUI - -enum { MMMaxCellsPerChar = 2 }; - -@class MMTextViewHelper; - - -@interface MMAtsuiTextView : NSView <NSTextInput> { - // From MMTextStorage - int maxRows, maxColumns; - NSColor *defaultBackgroundColor; - NSColor *defaultForegroundColor; - NSSize cellSize; - NSFont *font; - NSFont *fontWide; - float linespace; - float ascender; - - // From NSTextView - NSSize insetSize; - - // From vim-cocoa - NSImage *contentImage; - NSSize imageSize; - ATSUStyle atsuStyles[MMMaxCellsPerChar]; - BOOL antialias; - - MMTextViewHelper *helper; -} - -- (id)initWithFrame:(NSRect)frame; - -// -// MMTextStorage methods -// -- (int)maxRows; -- (int)maxColumns; -- (void)getMaxRows:(int*)rows columns:(int*)cols; -- (void)setMaxRows:(int)rows columns:(int)cols; -- (void)setDefaultColorsBackground:(NSColor *)bgColor - foreground:(NSColor *)fgColor; -- (NSColor *)defaultBackgroundColor; -- (NSColor *)defaultForegroundColor; -- (NSRect)rectForRowsInRange:(NSRange)range; -- (NSRect)rectForColumnsInRange:(NSRange)range; - -- (void)setFont:(NSFont *)newFont; -- (void)setWideFont:(NSFont *)newFont; -- (NSFont *)font; -- (NSFont *)fontWide; -- (NSSize)cellSize; -- (void)setLinespace:(float)newLinespace; - -// -// MMTextView methods -// -- (void)deleteSign:(NSString *)signName; -- (void)setToolTipAtMousePoint:(NSString *)string; -- (void)setPreEditRow:(int)row column:(int)col; -- (void)setMouseShape:(int)shape; -- (void)setAntialias:(BOOL)state; -- (void)setImControl:(BOOL)enable; -- (void)activateIm:(BOOL)enable; -- (void)checkImState; -- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column; -- (NSPoint)pointForRow:(int)row column:(int)col; -- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr - numColumns:(int)nc; - -// -// NSTextView methods -// -- (void)keyDown:(NSEvent *)event; -- (void)insertText:(id)string; -- (void)doCommandBySelector:(SEL)selector; -- (BOOL)performKeyEquivalent:(NSEvent *)event; - -// -// NSTextContainer methods -// -- (void)setTextContainerInset:(NSSize)inset; - -// -// MMAtsuiTextView methods -// -- (void)performBatchDrawWithData:(NSData *)data; -- (NSSize)desiredSize; -- (NSSize)minSize; -- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size; - -@end - -#endif // MM_ENABLE_ATSUI diff --git a/src/MacVim/MMAtsuiTextView.m b/src/MacVim/MMAtsuiTextView.m deleted file mode 100644 index f9cfd4a198..0000000000 --- a/src/MacVim/MMAtsuiTextView.m +++ /dev/null @@ -1,1299 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4 ft=objc: - * - * VIM - Vi IMproved by Bram Moolenaar - * MacVim GUI port by Bjorn Winckler - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ -/* - * MMAtsuiTextView - * - * Dispatches keyboard and mouse input to the backend. Handles drag-n-drop of - * files onto window. The rendering is done using ATSUI. - * - * The text view area consists of two parts: - * 1. The text area - this is where text is rendered; the size is governed by - * the current number of rows and columns. - * 2. The inset area - this is a border around the text area; the size is - * governed by the user defaults MMTextInset[Left|Right|Top|Bottom]. - * - * The current size of the text view frame does not always match the desired - * area, i.e. the area determined by the number of rows, columns plus text - * inset. This distinction is particularly important when the view is being - * resized. - */ - -#import "MMAppController.h" -#import "MMAtsuiTextView.h" -#import "MMTextViewHelper.h" -#import "MMVimController.h" -#import "MMWindowController.h" - -#if MM_ENABLE_ATSUI - -// TODO: What does DRAW_TRANSP flag do? If the background isn't drawn when -// this flag is set, then sometimes the character after the cursor becomes -// blank. Everything seems to work fine by just ignoring this flag. -#define DRAW_TRANSP 0x01 /* draw with transparant bg */ -#define DRAW_BOLD 0x02 /* draw bold text */ -#define DRAW_UNDERL 0x04 /* draw underline text */ -#define DRAW_UNDERC 0x08 /* draw undercurl text */ -#define DRAW_ITALIC 0x10 /* draw italic text */ -#define DRAW_CURSOR 0x20 -#define DRAW_WIDE 0x40 /* draw wide text */ - -#define kUnderlineOffset (-2) -#define kUnderlineHeight 1 -#define kUndercurlHeight 2 -#define kUndercurlOffset (-2) -#define kUndercurlDotWidth 2 -#define kUndercurlDotDistance 2 - - -@interface NSFont (AppKitPrivate) -- (ATSUFontID) _atsFontID; -@end - - -@interface MMAtsuiTextView (Private) -- (void)initAtsuStyles; -- (void)disposeAtsuStyles; -- (void)updateAtsuStyles; -- (MMWindowController *)windowController; -- (MMVimController *)vimController; -@end - - -@interface MMAtsuiTextView (Drawing) -- (NSPoint)originForRow:(int)row column:(int)column; -- (NSRect)rectFromRow:(int)row1 column:(int)col1 - toRow:(int)row2 column:(int)col2; -- (NSSize)textAreaSize; -- (void)resizeContentImage; -- (void)beginDrawing; -- (void)endDrawing; -- (void)drawString:(UniChar *)string length:(UniCharCount)length - atRow:(int)row column:(int)col cells:(int)cells - withFlags:(int)flags foregroundColor:(NSColor *)fg - backgroundColor:(NSColor *)bg specialColor:(NSColor *)sp; -- (void)deleteLinesFromRow:(int)row lineCount:(int)count - scrollBottom:(int)bottom left:(int)left right:(int)right - color:(NSColor *)color; -- (void)insertLinesAtRow:(int)row lineCount:(int)count - scrollBottom:(int)bottom left:(int)left right:(int)right - color:(NSColor *)color; -- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 - column:(int)col2 color:(NSColor *)color; -- (void)clearAll; -- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape - fraction:(int)percent; -- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows - numColumns:(int)ncols; -@end - - - - static float -defaultLineHeightForFont(NSFont *font) -{ - // HACK: -[NSFont defaultLineHeightForFont] is deprecated but since the - // ATSUI renderer does not use NSLayoutManager we create one temporarily. - NSLayoutManager *lm = [[NSLayoutManager alloc] init]; - float height = [lm defaultLineHeightForFont:font]; - [lm release]; - - return height; -} - -@implementation MMAtsuiTextView - -- (id)initWithFrame:(NSRect)frame -{ - if (!(self = [super initWithFrame:frame])) - return nil; - - // NOTE! It does not matter which font is set here, Vim will set its - // own font on startup anyway. Just set some bogus values. - font = [[NSFont userFixedPitchFontOfSize:0] retain]; - ascender = 0; - cellSize.width = cellSize.height = 1; - contentImage = nil; - imageSize = NSZeroSize; - insetSize = NSZeroSize; - - // NOTE: If the default changes to 'NO' then the intialization of - // p_antialias in option.c must change as well. - antialias = YES; - - helper = [[MMTextViewHelper alloc] init]; - [helper setTextView:self]; - - [self initAtsuStyles]; - - [self registerForDraggedTypes:[NSArray arrayWithObjects: - NSFilenamesPboardType, NSStringPboardType, nil]]; - - return self; -} - -- (void)dealloc -{ - ASLogDebug(@""); - - [self disposeAtsuStyles]; - [font release]; font = nil; - [fontWide release]; fontWide = nil; - [defaultBackgroundColor release]; defaultBackgroundColor = nil; - [defaultForegroundColor release]; defaultForegroundColor = nil; - - [helper setTextView:nil]; - [helper release]; helper = nil; - - [super dealloc]; -} - -- (int)maxRows -{ - return maxRows; -} - -- (int)maxColumns -{ - return maxColumns; -} - -- (void)getMaxRows:(int*)rows columns:(int*)cols -{ - if (rows) *rows = maxRows; - if (cols) *cols = maxColumns; -} - -- (void)setMaxRows:(int)rows columns:(int)cols -{ - // NOTE: Just remember the new values, the actual resizing is done lazily. - maxRows = rows; - maxColumns = cols; -} - -- (void)setDefaultColorsBackground:(NSColor *)bgColor - foreground:(NSColor *)fgColor -{ - if (defaultBackgroundColor != bgColor) { - [defaultBackgroundColor release]; - defaultBackgroundColor = bgColor ? [bgColor retain] : nil; - } - - if (defaultForegroundColor != fgColor) { - [defaultForegroundColor release]; - defaultForegroundColor = fgColor ? [fgColor retain] : nil; - } -} - -- (NSColor *)defaultBackgroundColor -{ - return defaultBackgroundColor; -} - -- (NSColor *)defaultForegroundColor -{ - return defaultForegroundColor; -} - -- (void)setTextContainerInset:(NSSize)size -{ - insetSize = size; -} - -- (NSRect)rectForRowsInRange:(NSRange)range -{ - // Compute rect whose vertical dimensions cover the rows in the given - // range. - // NOTE: The rect should be in _flipped_ coordinates and the first row must - // include the top inset as well. (This method is only used to place the - // scrollbars inside MMVimView.) - - NSRect rect = { {0, 0}, {0, 0} }; - unsigned start = range.location > maxRows ? maxRows : range.location; - unsigned length = range.length; - - if (start + length > maxRows) - length = maxRows - start; - - if (start > 0) { - rect.origin.y = cellSize.height * start + insetSize.height; - rect.size.height = cellSize.height * length; - } else { - // Include top inset - rect.origin.y = 0; - rect.size.height = cellSize.height * length + insetSize.height; - } - - return rect; -} - -- (NSRect)rectForColumnsInRange:(NSRange)range -{ - // Compute rect whose horizontal dimensions cover the columns in the given - // range. - // NOTE: The first column must include the left inset. (This method is - // only used to place the scrollbars inside MMVimView.) - - NSRect rect = { {0, 0}, {0, 0} }; - unsigned start = range.location > maxColumns ? maxColumns : range.location; - unsigned length = range.length; - - if (start+length > maxColumns) - length = maxColumns - start; - - if (start > 0) { - rect.origin.x = cellSize.width * start + insetSize.width; - rect.size.width = cellSize.width * length; - } else { - // Include left inset - rect.origin.x = 0; - rect.size.width = cellSize.width * length + insetSize.width; - } - - return rect; -} - - -- (void)setFont:(NSFont *)newFont -{ - if (newFont && font != newFont) { - [font release]; - font = [newFont retain]; - ascender = roundf([font ascender]); - - float em = [@"m" sizeWithAttributes: - [NSDictionary dictionaryWithObject:newFont - forKey:NSFontAttributeName]].width; - float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults] - floatForKey:MMCellWidthMultiplierKey]; - - // NOTE! Even though NSFontFixedAdvanceAttribute is a float, it will - // only render at integer sizes. Hence, we restrict the cell width to - // an integer here, otherwise the window width and the actual text - // width will not match. - cellSize.width = ceilf(em * cellWidthMultiplier); - cellSize.height = linespace + defaultLineHeightForFont(newFont); - - [self updateAtsuStyles]; - } -} - -- (void)setWideFont:(NSFont *)newFont -{ - if (!newFont) { - if (font) [self setWideFont:font]; - } else if (newFont != fontWide) { - [fontWide release]; - - float pointSize = [newFont pointSize]; - NSFontDescriptor *desc = [newFont fontDescriptor]; - NSDictionary *dictWide = [NSDictionary - dictionaryWithObject:[NSNumber numberWithFloat:2*cellSize.width] - forKey:NSFontFixedAdvanceAttribute]; - desc = [desc fontDescriptorByAddingAttributes:dictWide]; - fontWide = [NSFont fontWithDescriptor:desc size:pointSize]; - [fontWide retain]; - } -} - -- (NSFont *)font -{ - return font; -} - -- (NSFont *)fontWide -{ - return fontWide; -} - -- (NSSize)cellSize -{ - return cellSize; -} - -- (void)setLinespace:(float)newLinespace -{ - linespace = newLinespace; - - // NOTE: The linespace is added to the cell height in order for a multiline - // selection not to have white (background color) gaps between lines. Also - // this simplifies the code a lot because there is no need to check the - // linespace when calculating the size of the text view etc. When the - // linespace is non-zero the baseline will be adjusted as well; check - // MMTypesetter. - cellSize.height = linespace + defaultLineHeightForFont(font); -} - - - -- (void)setShouldDrawInsertionPoint:(BOOL)on -{ -} - -- (void)deleteSign:(NSString *)signName -{ - // ONLY in Core Text! -} - -- (void)setToolTipAtMousePoint:(NSString *)string -{ - // ONLY in Core Text! -} - -- (void)setPreEditRow:(int)row column:(int)col -{ - [helper setPreEditRow:row column:col]; -} - -- (void)setMouseShape:(int)shape -{ - [helper setMouseShape:shape]; -} - -- (void)setAntialias:(BOOL)state -{ - antialias = state; -} - -- (void)setImControl:(BOOL)enable -{ - [helper setImControl:enable]; -} - -- (void)activateIm:(BOOL)enable -{ - [helper activateIm:enable]; -} - -- (void)checkImState -{ - [helper checkImState]; -} - -- (BOOL)_wantsKeyDownForEvent:(id)event -{ - // HACK! This is an undocumented method which is called from within - // -[NSWindow sendEvent] (and perhaps in other places as well) when the - // user presses e.g. Ctrl-Tab or Ctrl-Esc . Returning YES here effectively - // disables the Cocoa "key view loop" (which is undesirable). It may have - // other side-effects, but we really _do_ want to process all key down - // events so it seems safe to always return YES. - return YES; -} - -- (void)keyDown:(NSEvent *)event -{ - [helper keyDown:event]; -} - -- (void)insertText:(id)string -{ - [helper insertText:string]; -} - -- (void)doCommandBySelector:(SEL)selector -{ - [helper doCommandBySelector:selector]; -} - -- (BOOL)performKeyEquivalent:(NSEvent *)event -{ - return [helper performKeyEquivalent:event]; -} - -- (BOOL)hasMarkedText -{ - return [helper hasMarkedText]; -} - -- (NSRange)markedRange -{ - return [helper markedRange]; -} - -- (NSDictionary *)markedTextAttributes -{ - return [helper markedTextAttributes]; -} - -- (void)setMarkedTextAttributes:(NSDictionary *)attr -{ - [helper setMarkedTextAttributes:attr]; -} - -- (void)setMarkedText:(id)text selectedRange:(NSRange)range -{ - [helper setMarkedText:text selectedRange:range]; -} - -- (void)unmarkText -{ - [helper unmarkText]; -} - -- (void)scrollWheel:(NSEvent *)event -{ - [helper scrollWheel:event]; -} - -- (void)mouseDown:(NSEvent *)event -{ - [helper mouseDown:event]; -} - -- (void)rightMouseDown:(NSEvent *)event -{ - [helper mouseDown:event]; -} - -- (void)otherMouseDown:(NSEvent *)event -{ - [helper mouseDown:event]; -} - -- (void)mouseUp:(NSEvent *)event -{ - [helper mouseUp:event]; -} - -- (void)rightMouseUp:(NSEvent *)event -{ - [helper mouseUp:event]; -} - -- (void)otherMouseUp:(NSEvent *)event -{ - [helper mouseUp:event]; -} - -- (void)mouseDragged:(NSEvent *)event -{ - [helper mouseDragged:event]; -} - -- (void)rightMouseDragged:(NSEvent *)event -{ - [helper mouseDragged:event]; -} - -- (void)otherMouseDragged:(NSEvent *)event -{ - [helper mouseDragged:event]; -} - -- (void)mouseMoved:(NSEvent *)event -{ - [helper mouseMoved:event]; -} - -- (NSMenu*)menuForEvent:(NSEvent *)event -{ - // HACK! Return nil to disable default popup menus (Vim provides its own). - // Called when user Ctrl-clicks in the view (this is already handled in - // rightMouseDown:). - return nil; -} - -- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender -{ - return [helper performDragOperation:sender]; -} - -- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender -{ - return [helper draggingEntered:sender]; -} - -- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender -{ - return [helper draggingUpdated:sender]; -} - - - -- (BOOL)mouseDownCanMoveWindow -{ - return NO; -} - -- (BOOL)isOpaque -{ - return YES; -} - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (BOOL)isFlipped -{ - return NO; -} - -- (void)drawRect:(NSRect)rect -{ - [defaultBackgroundColor set]; - NSRectFill(rect); - - NSPoint pt = { insetSize.width, insetSize.height }; - [contentImage compositeToPoint:pt operation:NSCompositeCopy]; - -#ifdef INCLUDE_OLD_IM_CODE - if ([self hasMarkedText] && ![helper useInlineIm]) { - int len = [[helper markedText] length]; - int rows = 0; - int cols = maxColumns - [helper preEditColumn]; - NSFont *theFont = [[self markedTextAttributes] - valueForKey:NSFontAttributeName]; - if (theFont == [self fontWide]) - cols = cols / 2; - int done = 0; - int lend = cols > len ? len : cols; - NSAttributedString *aString = [[helper markedText] - attributedSubstringFromRange:NSMakeRange(done, lend)]; - NSPoint pt = [self pointForRow:[helper preEditRow] - column:[helper preEditColumn]]; - [aString drawAtPoint:pt]; - done = lend; - if (done != len) { - int r; - rows = (len - done) / (maxColumns / 2) + 1; - for (r = 1; r <= rows; r++) { - lend = len - done > maxColumns / 2 - ? maxColumns / 2 : len - done; - aString = [[helper markedText] attributedSubstringFromRange: - NSMakeRange(done, lend)]; - NSPoint pt = [self pointForRow:[helper preEditRow]+r - column:0]; - [aString drawAtPoint:pt]; - done += lend; - } - } - - rows = maxRows - 1 - [helper preEditRow]; - cols = [helper preEditColumn]; - if (theFont == fontWide) { - cols += ([helper imRange].location+[helper imRange].length) * 2; - if (cols >= maxColumns - 1) { - rows -= cols / maxColumns; - cols = cols % 2 ? cols % maxColumns + 1 : - cols % maxColumns; - } - } else { - cols += ([helper imRange].location+[helper imRange].length); - if (cols >= maxColumns) { - rows -= cols / maxColumns; - cols = cols % 2 ? cols % maxColumns + 1 : - cols % maxColumns; - } - } - - // TODO: Could IM be in "right-left" mode? If so the insertion point - // will be on the wrong side. - [self drawInsertionPointAtRow:rows - column:cols - shape:MMInsertionPointVertical - fraction:25]; - } -#endif // INCLUDE_OLD_IM_CODE -} - -- (BOOL) wantsDefaultClipping -{ - return NO; -} - - -#define MM_DEBUG_DRAWING 0 - -- (void)performBatchDrawWithData:(NSData *)data -{ - const void *bytes = [data bytes]; - const void *end = bytes + [data length]; - - if (! NSEqualSizes(imageSize, [self textAreaSize])) - [self resizeContentImage]; - -#if MM_DEBUG_DRAWING - ASLogDebug(@"====> BEGIN %s", _cmd); -#endif - [self beginDrawing]; - - // TODO: Sanity check input - - while (bytes < end) { - int type = *((int*)bytes); bytes += sizeof(int); - - if (ClearAllDrawType == type) { -#if MM_DEBUG_DRAWING - ASLogDebug(@" Clear all"); -#endif - [self clearAll]; - } else if (ClearBlockDrawType == type) { - unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned); - int row1 = *((int*)bytes); bytes += sizeof(int); - int col1 = *((int*)bytes); bytes += sizeof(int); - int row2 = *((int*)bytes); bytes += sizeof(int); - int col2 = *((int*)bytes); bytes += sizeof(int); - -#if MM_DEBUG_DRAWING - ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1, - row2,col2); -#endif - [self clearBlockFromRow:row1 column:col1 - toRow:row2 column:col2 - color:[NSColor colorWithArgbInt:color]]; - } else if (DeleteLinesDrawType == type) { - unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned); - int row = *((int*)bytes); bytes += sizeof(int); - int count = *((int*)bytes); bytes += sizeof(int); - int bot = *((int*)bytes); bytes += sizeof(int); - int left = *((int*)bytes); bytes += sizeof(int); - int right = *((int*)bytes); bytes += sizeof(int); - -#if MM_DEBUG_DRAWING - ASLogDebug(@" Delete %d line(s) from %d", count, row); -#endif - [self deleteLinesFromRow:row lineCount:count - scrollBottom:bot left:left right:right - color:[NSColor colorWithArgbInt:color]]; - } else if (DrawStringDrawType == type) { - int bg = *((int*)bytes); bytes += sizeof(int); - int fg = *((int*)bytes); bytes += sizeof(int); - int sp = *((int*)bytes); bytes += sizeof(int); - int row = *((int*)bytes); bytes += sizeof(int); - int col = *((int*)bytes); bytes += sizeof(int); - int cells = *((int*)bytes); bytes += sizeof(int); - int flags = *((int*)bytes); bytes += sizeof(int); - int len = *((int*)bytes); bytes += sizeof(int); - // UniChar *string = (UniChar*)bytes; bytes += len; - NSString *string = [[NSString alloc] - initWithBytesNoCopy:(void*)bytes - length:len - encoding:NSUTF8StringEncoding - freeWhenDone:NO]; - bytes += len; -#if MM_DEBUG_DRAWING - ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x " - "bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp); -#endif - unichar *characters = malloc(sizeof(unichar) * [string length]); - [string getCharacters:characters]; - - [self drawString:characters - length:[string length] - atRow:row - column:col - cells:cells withFlags:flags - foregroundColor:[NSColor colorWithRgbInt:fg] - backgroundColor:[NSColor colorWithArgbInt:bg] - specialColor:[NSColor colorWithRgbInt:sp]]; - free(characters); - [string release]; - } else if (InsertLinesDrawType == type) { - unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned); - int row = *((int*)bytes); bytes += sizeof(int); - int count = *((int*)bytes); bytes += sizeof(int); - int bot = *((int*)bytes); bytes += sizeof(int); - int left = *((int*)bytes); bytes += sizeof(int); - int right = *((int*)bytes); bytes += sizeof(int); - -#if MM_DEBUG_DRAWING - ASLogDebug(@" Insert %d line(s) at row %d", count, row); -#endif - [self insertLinesAtRow:row lineCount:count - scrollBottom:bot left:left right:right - color:[NSColor colorWithArgbInt:color]]; - } else if (DrawCursorDrawType == type) { - unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned); - int row = *((int*)bytes); bytes += sizeof(int); - int col = *((int*)bytes); bytes += sizeof(int); - int shape = *((int*)bytes); bytes += sizeof(int); - int percent = *((int*)bytes); bytes += sizeof(int); - -#if MM_DEBUG_DRAWING - ASLogDebug(@" Draw cursor at (%d,%d)", row, col); -#endif - [helper setInsertionPointColor:[NSColor colorWithRgbInt:color]]; - [self drawInsertionPointAtRow:row column:col shape:shape - fraction:percent]; - } else if (DrawInvertedRectDrawType == type) { - int row = *((int*)bytes); bytes += sizeof(int); - int col = *((int*)bytes); bytes += sizeof(int); - int nr = *((int*)bytes); bytes += sizeof(int); - int nc = *((int*)bytes); bytes += sizeof(int); - /*int invert = *((int*)bytes);*/ bytes += sizeof(int); - -#if MM_DEBUG_DRAWING - ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d " - "ncols=%d", row, col, nr, nc); -#endif - [self drawInvertedRectAtRow:row column:col numRows:nr - numColumns:nc]; - } else if (SetCursorPosDrawType == type) { - // TODO: This is used for Voice Over support in MMTextView, - // MMAtsuiTextView currently does not support Voice Over. - /*cursorRow = *((int*)bytes);*/ bytes += sizeof(int); - /*cursorCol = *((int*)bytes);*/ bytes += sizeof(int); - } else { - ASLogWarn(@"Unknown draw type (type=%d)", type); - } - } - - [self endDrawing]; - - [self setNeedsDisplay:YES]; - - // NOTE: During resizing, Cocoa only sends draw messages before Vim's rows - // and columns are changed (due to ipc delays). Force a redraw here. - if ([self inLiveResize]) - [self display]; - -#if MM_DEBUG_DRAWING - ASLogDebug(@"<==== END %s", _cmd); -#endif -} - -- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size -{ - // TODO: - // - Rounding errors may cause size change when there should be none - // - Desired rows/columns shold not be 'too small' - - // Constrain the desired size to the given size. Values for the minimum - // rows and columns are taken from Vim. - NSSize desiredSize = [self desiredSize]; - int desiredRows = maxRows; - int desiredCols = maxColumns; - - if (size.height != desiredSize.height) { - float fh = cellSize.height; - float ih = 2 * insetSize.height; - if (fh < 1.0f) fh = 1.0f; - - desiredRows = floor((size.height - ih)/fh); - desiredSize.height = fh*desiredRows + ih; - } - - if (size.width != desiredSize.width) { - float fw = cellSize.width; - float iw = 2 * insetSize.width; - if (fw < 1.0f) fw = 1.0f; - - desiredCols = floor((size.width - iw)/fw); - desiredSize.width = fw*desiredCols + iw; - } - - if (rows) *rows = desiredRows; - if (cols) *cols = desiredCols; - - return desiredSize; -} - -- (NSSize)desiredSize -{ - // Compute the size the text view should be for the entire text area and - // inset area to be visible with the present number of rows and columns. - return NSMakeSize(maxColumns * cellSize.width + 2 * insetSize.width, - maxRows * cellSize.height + 2 * insetSize.height); -} - -- (NSSize)minSize -{ - // Compute the smallest size the text view is allowed to be. - return NSMakeSize(MMMinColumns * cellSize.width + 2 * insetSize.width, - MMMinRows * cellSize.height + 2 * insetSize.height); -} - -- (void)changeFont:(id)sender -{ - [helper changeFont:sender]; -} - - -// -// NOTE: The menu items cut/copy/paste/undo/redo/select all/... must be bound -// to the same actions as in IB otherwise they will not work with dialogs. All -// we do here is forward these actions to the Vim process. -// -- (IBAction)cut:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (IBAction)copy:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (IBAction)paste:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (IBAction)undo:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (IBAction)redo:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (IBAction)selectAll:(id)sender -{ - [[self windowController] vimMenuItemAction:sender]; -} - -- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column -{ - // View is not flipped, instead the atsui code draws to a flipped image; - // thus we need to 'flip' the coordinate here since the column number - // increases in an up-to-down order. - point.y = [self frame].size.height - point.y; - - NSPoint origin = { insetSize.width, insetSize.height }; - - if (!(cellSize.width > 0 && cellSize.height > 0)) - return NO; - - if (row) *row = floor((point.y-origin.y-1) / cellSize.height); - if (column) *column = floor((point.x-origin.x-1) / cellSize.width); - - return YES; -} - -- (NSPoint)pointForRow:(int)row column:(int)col -{ - // Return the lower left coordinate of the cell at (row,column). - NSPoint pt; - - pt.x = insetSize.width + col*cellSize.width; - pt.y = [self frame].size.height - - (insetSize.height + (1+row)*cellSize.height); - - return pt; -} - -- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr - numColumns:(int)nc -{ - // Return the rect for the block which covers the specified rows and - // columns. The lower-left corner is the origin of this rect. - NSRect rect; - - rect.origin.x = insetSize.width + col*cellSize.width; - rect.origin.y = [self frame].size.height - - (insetSize.height + (nr+row)*cellSize.height); - rect.size.width = nc*cellSize.width; - rect.size.height = nr*cellSize.height; - - return rect; -} - -- (NSArray *)validAttributesForMarkedText -{ - return nil; -} - -- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range -{ - return nil; -} - -- (NSUInteger)characterIndexForPoint:(NSPoint)point -{ - return NSNotFound; -} - -// The return type of this message changed with OS X 10.5 so we need this -// kludge in order to avoid compiler warnings on OS X 10.4. -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) -- (NSInteger)conversationIdentifier -{ - return (NSInteger)self; -} -#else -- (long)conversationIdentifier -{ - return (long)self; -} -#endif - -- (NSRange)selectedRange -{ - return [helper imRange]; -} - -- (NSRect)firstRectForCharacterRange:(NSRange)range -{ - return [helper firstRectForCharacterRange:range]; -} - -@end // MMAtsuiTextView - - - - -@implementation MMAtsuiTextView (Private) - -- (void)initAtsuStyles -{ - int i; - for (i = 0; i < MMMaxCellsPerChar; i++) - ATSUCreateStyle(&atsuStyles[i]); -} - -- (void)disposeAtsuStyles -{ - int i; - - for (i = 0; i < MMMaxCellsPerChar; i++) - if (atsuStyles[i] != NULL) - { - if (ATSUDisposeStyle(atsuStyles[i]) != noErr) - atsuStyles[i] = NULL; - } -} - -- (void)updateAtsuStyles -{ - ATSUFontID fontID; - Fixed fontSize; - Fixed fontWidth; - int i; - CGAffineTransform transform = CGAffineTransformMakeScale(1, -1); - ATSStyleRenderingOptions options; - - fontID = [font _atsFontID]; - fontSize = Long2Fix([font pointSize]); - options = kATSStyleApplyAntiAliasing; - - ATSUAttributeTag attribTags[] = - { - kATSUFontTag, kATSUSizeTag, kATSUImposeWidthTag, - kATSUFontMatrixTag, kATSUStyleRenderingOptionsTag, - kATSUMaxATSUITagValue + 1 - }; - - ByteCount attribSizes[] = - { - sizeof(ATSUFontID), sizeof(Fixed), sizeof(fontWidth), - sizeof(CGAffineTransform), sizeof(ATSStyleRenderingOptions), - sizeof(font) - }; - - ATSUAttributeValuePtr attribValues[] = - { - &fontID, &fontSize, &fontWidth, &transform, &options, &font - }; - - ATSUFontFeatureType featureTypes[] = { - kLigaturesType, kLigaturesType - }; - - ATSUFontFeatureSelector featureSelectors[] = { - kCommonLigaturesOffSelector, kRareLigaturesOffSelector - }; - - for (i = 0; i < MMMaxCellsPerChar; i++) - { - fontWidth = Long2Fix(cellSize.width * (i + 1)); - - if (ATSUSetAttributes(atsuStyles[i], - (sizeof attribTags) / sizeof(ATSUAttributeTag), - attribTags, attribSizes, attribValues) != noErr) - { - ATSUDisposeStyle(atsuStyles[i]); - atsuStyles[i] = NULL; - } - - // Turn off ligatures by default - ATSUSetFontFeatures(atsuStyles[i], - sizeof(featureTypes) / sizeof(featureTypes[0]), - featureTypes, featureSelectors); - } -} - -- (MMWindowController *)windowController -{ - id windowController = [[self window] windowController]; - if ([windowController isKindOfClass:[MMWindowController class]]) - return (MMWindowController*)windowController; - return nil; -} - -- (MMVimController *)vimController -{ - return [[self windowController] vimController]; -} - -@end // MMAtsuiTextView (Private) - - - - -@implementation MMAtsuiTextView (Drawing) - -- (NSPoint)originForRow:(int)row column:(int)col -{ - return NSMakePoint(col * cellSize.width, row * cellSize.height); -} - -- (NSRect)rectFromRow:(int)row1 column:(int)col1 - toRow:(int)row2 column:(int)col2 -{ - NSPoint origin = [self originForRow:row1 column:col1]; - return NSMakeRect(origin.x, origin.y, - (col2 + 1 - col1) * cellSize.width, - (row2 + 1 - row1) * cellSize.height); -} - -- (NSSize)textAreaSize -{ - // Calculate the (desired) size of the text area, i.e. the text view area - // minus the inset area. - return NSMakeSize(maxColumns * cellSize.width, maxRows * cellSize.height); -} - -- (void)resizeContentImage -{ - [contentImage release]; - contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]]; - [contentImage setFlipped:YES]; - imageSize = [self textAreaSize]; -} - -- (void)beginDrawing -{ - [contentImage lockFocus]; -} - -- (void)endDrawing -{ - [contentImage unlockFocus]; -} - -#define atsu_style_set_bool(s, t, b) \ - ATSUSetAttributes(s, 1, &t, &(sizeof(Boolean)), &&b); -#define FILL_Y(y) (y * cellSize.height) - -- (void)drawString:(UniChar *)string length:(UniCharCount)length - atRow:(int)row column:(int)col cells:(int)cells - withFlags:(int)flags foregroundColor:(NSColor *)fg - backgroundColor:(NSColor *)bg specialColor:(NSColor *)sp -{ - // 'string' consists of 'length' utf-16 code pairs and should cover 'cells' - // display cells (a normal character takes up one display cell, a wide - // character takes up two) - ATSUStyle style = (flags & DRAW_WIDE) ? atsuStyles[1] : atsuStyles[0]; - ATSUTextLayout layout; - - // Font selection and rendering options for ATSUI - ATSUAttributeTag attribTags[3] = { kATSUQDBoldfaceTag, - kATSUFontMatrixTag, - kATSUStyleRenderingOptionsTag }; - - ByteCount attribSizes[] = { sizeof(Boolean), - sizeof(CGAffineTransform), - sizeof(UInt32) }; - Boolean useBold; - CGAffineTransform theTransform = CGAffineTransformMakeScale(1.0, -1.0); - UInt32 useAntialias; - - ATSUAttributeValuePtr attribValues[3] = { &useBold, &theTransform, - &useAntialias }; - - useBold = (flags & DRAW_BOLD) ? true : false; - - if (flags & DRAW_ITALIC) - theTransform.c = Fix2X(kATSItalicQDSkew); - - useAntialias = antialias ? kATSStyleApplyAntiAliasing - : kATSStyleNoAntiAliasing; - - ATSUSetAttributes(style, sizeof(attribValues) / sizeof(attribValues[0]), - attribTags, attribSizes, attribValues); - - ATSUCreateTextLayout(&layout); - ATSUSetTextPointerLocation(layout, string, - kATSUFromTextBeginning, kATSUToTextEnd, - length); - ATSUSetRunStyle(layout, style, kATSUFromTextBeginning, kATSUToTextEnd); - - NSRect rect = NSMakeRect(col * cellSize.width, row * cellSize.height, - length * cellSize.width, cellSize.height); - if (flags & DRAW_WIDE) - rect.size.width = rect.size.width * 2; - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; - - // Clip drawing to avoid text bleeding into adjacent display cells when - // antialiasing is enabled. - CGContextSaveGState(context); - CGContextClipToRect(context, *(CGRect*)&rect); - - ATSUAttributeTag tags[] = { kATSUCGContextTag }; - ByteCount sizes[] = { sizeof(CGContextRef) }; - ATSUAttributeValuePtr values[] = { &context }; - ATSUSetLayoutControls(layout, 1, tags, sizes, values); - - if (! (flags & DRAW_TRANSP)) - { - [bg set]; - NSRectFill(rect); - } - - [fg set]; - - ATSUSetTransientFontMatching(layout, TRUE); - ATSUDrawText(layout, - kATSUFromTextBeginning, - kATSUToTextEnd, - X2Fix(rect.origin.x), - X2Fix(rect.origin.y + ascender)); - ATSUDisposeTextLayout(layout); - - if (flags & DRAW_UNDERL) - { - [sp set]; - NSRectFill(NSMakeRect(rect.origin.x, - (row + 1) * cellSize.height + kUnderlineOffset, - rect.size.width, kUnderlineHeight)); - } - - if (flags & DRAW_UNDERC) - { - [sp set]; - - float line_end_x = rect.origin.x + rect.size.width; - int i = 0; - NSRect line_rect = NSMakeRect( - rect.origin.x, - (row + 1) * cellSize.height + kUndercurlOffset, - kUndercurlDotWidth, kUndercurlHeight); - - while (line_rect.origin.x < line_end_x) - { - if (i % 2) - NSRectFill(line_rect); - - line_rect.origin.x += kUndercurlDotDistance; - i++; - } - } - - CGContextRestoreGState(context); -} - -- (void)scrollRect:(NSRect)rect lineCount:(int)count -{ - NSPoint destPoint = rect.origin; - destPoint.y += count * cellSize.height; - - NSCopyBits(0, rect, destPoint); -} - -- (void)deleteLinesFromRow:(int)row lineCount:(int)count - scrollBottom:(int)bottom left:(int)left right:(int)right - color:(NSColor *)color -{ - NSRect rect = [self rectFromRow:row + count - column:left - toRow:bottom - column:right]; - [color set]; - // move rect up for count lines - [self scrollRect:rect lineCount:-count]; - [self clearBlockFromRow:bottom - count + 1 - column:left - toRow:bottom - column:right - color:color]; -} - -- (void)insertLinesAtRow:(int)row lineCount:(int)count - scrollBottom:(int)bottom left:(int)left right:(int)right - color:(NSColor *)color -{ - NSRect rect = [self rectFromRow:row - column:left - toRow:bottom - count - column:right]; - [color set]; - // move rect down for count lines - [self scrollRect:rect lineCount:count]; - [self clearBlockFromRow:row - column:left - toRow:row + count - 1 - column:right - color:color]; -} - -- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 - column:(int)col2 color:(NSColor *)color -{ - [color set]; - NSRectFill([self rectFromRow:row1 column:col1 toRow:row2 column:col2]); -} - -- (void)clearAll -{ - [defaultBackgroundColor set]; - NSRectFill(NSMakeRect(0, 0, imageSize.width, imageSize.height)); -} - -- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape - fraction:(int)percent -{ - NSPoint origin = [self originForRow:row column:col]; - NSRect rect = NSMakeRect(origin.x, origin.y, - cellSize.width, cellSize.height); - - if (MMInsertionPointHorizontal == shape) { - int frac = (cellSize.height * percent + 99)/100; - rect.origin.y += rect.size.height - frac; - rect.size.height = frac; - } else if (MMInsertionPointVertical == shape) { - int frac = (cellSize.width * percent + 99)/100; - rect.size.width = frac; - } else if (MMInsertionPointVerticalRight == shape) { - int frac = (cellSize.width * percent + 99)/100; - rect.origin.x += rect.size.width - frac; - rect.size.width = frac; - } - - [[helper insertionPointColor] set]; - if (MMInsertionPointHollow == shape) { - NSFrameRect(rect); - } else { - NSRectFill(rect); - } -} - -- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows - numColumns:(int)ncols -{ - // TODO: THIS CODE HAS NOT BEEN TESTED! - CGContextRef cgctx = [[NSGraphicsContext currentContext] graphicsPort]; - CGContextSaveGState(cgctx); - CGContextSetBlendMode(cgctx, kCGBlendModeDifference); - CGContextSetRGBFillColor(cgctx, 1.0, 1.0, 1.0, 1.0); - - CGRect rect = { col * cellSize.width, row * cellSize.height, - ncols * cellSize.width, nrows * cellSize.height }; - CGContextFillRect(cgctx, rect); - - CGContextRestoreGState(cgctx); -} - -@end // MMAtsuiTextView (Drawing) - -#endif // MM_ENABLE_ATSUI diff --git a/src/MacVim/MMBackend.h b/src/MacVim/MMBackend.h index ee631237d7..7291badc9e 100644 --- a/src/MacVim/MMBackend.h +++ b/src/MacVim/MMBackend.h @@ -56,8 +56,6 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; unsigned numWholeLineChanges; unsigned offsetForDrawDataPrune; BOOL imState; - CFSocketRef netbeansSocket; - CFRunLoopSourceRef netbeansRunLoopSource; int winposX; int winposY; #ifdef FEAT_BEVAL @@ -123,8 +121,9 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; - (void)setMouseShape:(int)shape; - (void)setBlinkWait:(int)wait on:(int)on off:(int)off; - (void)startBlink; -- (void)stopBlink; +- (void)stopBlink:(BOOL)updateCursor; - (void)adjustLinespace:(int)linespace; +- (void)adjustColumnspace:(int)columnspace; - (void)activate; - (void)setPreEditRow:(int)row column:(int)col; @@ -136,6 +135,10 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; - (void)setFullScreenBackgroundColor:(int)color; - (void)setAntialias:(BOOL)antialias; +- (void)setLigatures:(BOOL)ligatures; +- (void)setThinStrokes:(BOOL)thinStrokes; +- (void)setBlurRadius:(int)radius; +- (void)setProportionalFont:(BOOL)proportionalFont; - (void)updateModifiedFlag; @@ -155,9 +158,6 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; - (BOOL)imState; - (void)setImState:(BOOL)activated; -- (void)messageFromNetbeans; -- (void)setNetbeansSocket:(int)socket; - #ifdef FEAT_BEVAL - (void)setLastToolTip:(NSString *)toolTip; #endif diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 7a4cded10f..8d17b061be 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -65,7 +65,7 @@ extern void im_preedit_start_macvim(); extern void im_preedit_end_macvim(); extern void im_preedit_abandon_macvim(); -extern void im_preedit_changed_macvim(char *preedit_string, int cursor_index); +extern void im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_index); enum { MMBlinkStateNone = 0, @@ -163,8 +163,6 @@ - (NSComparisonResult)serverNameCompare:(NSString *)string; @end - - @interface MMBackend (Private) - (void)clearDrawData; - (void)didChangeWholeLine; @@ -196,12 +194,13 @@ - (void)addInput:(NSString *)input; - (void)redrawScreen; - (void)handleFindReplace:(NSDictionary *)args; - (void)handleMarkedText:(NSData *)data; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)handleGesture:(NSData *)data; -#endif #ifdef FEAT_BEVAL - (void)bevalCallback:(id)sender; #endif +#ifdef MESSAGE_QUEUE +- (void)checkForProcessEvents:(NSTimer *)timer; +#endif @end @@ -683,13 +682,26 @@ - (BOOL)waitForInput:(int)milliseconds // Only start the run loop if the input queue is empty, otherwise process // the input first so that the input on queue isn't delayed. - if ([inputQueue count]) { + if ([inputQueue count] > 0 || input_available() || got_int) { inputReceived = YES; } else { // Wait for the specified amount of time, unless 'milliseconds' is // negative in which case we wait "forever" (1e6 seconds translates to // approximately 11 days). CFTimeInterval dt = (milliseconds >= 0 ? .001*milliseconds : 1e6); + NSTimer *timer = nil; + + // Set interval timer which checks for the events of job and channel + // when there is any pending job or channel. + if (dt > 0.1 && (has_any_channel() || has_pending_job())) { + timer = [NSTimer scheduledTimerWithTimeInterval:0.1 + target:self + selector:@selector(checkForProcessEvents:) + userInfo:nil + repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:timer + forMode:NSDefaultRunLoopMode]; + } while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, dt, true) == kCFRunLoopRunHandledSource) { @@ -697,8 +709,14 @@ - (BOOL)waitForInput:(int)milliseconds // processed we set the timeout to 0 and keep processing until the // run-loop times out. dt = 0.0; - inputReceived = YES; + if ([inputQueue count] > 0 || input_available() || got_int) + inputReceived = YES; } + + if ([inputQueue count] > 0 || input_available() || got_int) + inputReceived = YES; + + [timer invalidate]; } // The above calls may have placed messages on the input queue so process @@ -1061,9 +1079,9 @@ - (void)startBlink } } -- (void)stopBlink +- (void)stopBlink:(BOOL)updateCursor { - if (MMBlinkStateOff == blinkState) { + if (MMBlinkStateOff == blinkState && updateCursor) { gui_update_cursor(TRUE, FALSE); [self flushQueue:YES]; } @@ -1078,6 +1096,13 @@ - (void)adjustLinespace:(int)linespace [self queueMessage:AdjustLinespaceMsgID data:data]; } +- (void)adjustColumnspace:(int)columnspace +{ + NSMutableData *data = [NSMutableData data]; + [data appendBytes:&columnspace length:sizeof(int)]; + [self queueMessage:AdjustColumnspaceMsgID data:data]; +} + - (void)activate { [self queueMessage:ActivateMsgID data:nil]; @@ -1180,6 +1205,36 @@ - (void)setAntialias:(BOOL)antialias [self queueMessage:msgid data:nil]; } +- (void)setLigatures:(BOOL)ligatures +{ + int msgid = ligatures ? EnableLigaturesMsgID : DisableLigaturesMsgID; + + [self queueMessage:msgid data:nil]; +} + +- (void)setThinStrokes:(BOOL)thinStrokes +{ + int msgid = thinStrokes ? EnableThinStrokesMsgID : DisableThinStrokesMsgID; + + [self queueMessage:msgid data:nil]; +} + +- (void)setBlurRadius:(int)radius +{ + NSMutableData *data = [NSMutableData data]; + [data appendBytes:&radius length:sizeof(int)]; + + [self queueMessage:SetBlurRadiusMsgID data:data]; +} + +- (void)setProportionalFont:(BOOL)proportionalFont +{ + int msgid = proportionalFont ? + EnableProportionalFontMsgID : DisableProportionalFontMsgID; + + [self queueMessage:msgid data:nil]; +} + - (void)updateModifiedFlag { int state = [self checkForModifiedBuffers]; @@ -1662,51 +1717,6 @@ - (void)setImState:(BOOL)activated [self flushQueue:YES]; } -static void netbeansReadCallback(CFSocketRef s, - CFSocketCallBackType callbackType, - CFDataRef address, - const void *data, - void *info) -{ - // NetBeans socket is readable. - [[MMBackend sharedInstance] messageFromNetbeans]; -} - -- (void)messageFromNetbeans -{ - [inputQueue addObject:[NSNumber numberWithInt:NetBeansMsgID]]; - [inputQueue addObject:[NSNull null]]; -} - -- (void)setNetbeansSocket:(int)socket -{ - if (netbeansSocket) { - CFRelease(netbeansSocket); - netbeansSocket = NULL; - } - - if (netbeansRunLoopSource) { - CFRunLoopSourceInvalidate(netbeansRunLoopSource); - netbeansRunLoopSource = NULL; - } - - if (socket == -1) - return; - - // Tell CFRunLoop that we are interested in NetBeans socket input. - netbeansSocket = CFSocketCreateWithNative(kCFAllocatorDefault, - socket, - kCFSocketReadCallBack, - &netbeansReadCallback, - NULL); - netbeansRunLoopSource = CFSocketCreateRunLoopSource(NULL, - netbeansSocket, - 0); - CFRunLoopAddSource(CFRunLoopGetCurrent(), - netbeansRunLoopSource, - kCFRunLoopCommonModes); -} - #ifdef FEAT_BEVAL - (void)setLastToolTip:(NSString *)toolTip { @@ -1825,6 +1835,7 @@ - (void)insertVimStateMessage [NSNumber numberWithBool:mmta], @"p_mmta", [NSNumber numberWithInt:numTabs], @"numTabs", [NSNumber numberWithInt:fuoptions_flags], @"fullScreenOptions", + [NSNumber numberWithLong:p_mouset], @"p_mouset", nil]; // Put the state before all other messages. @@ -1913,12 +1924,12 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data int col = *((int*)bytes); bytes += sizeof(int); int button = *((int*)bytes); bytes += sizeof(int); int flags = *((int*)bytes); bytes += sizeof(int); - int count = *((int*)bytes); bytes += sizeof(int); + int repeat = *((int*)bytes); bytes += sizeof(int); button = eventButtonNumberToVimMouseButton(button); if (button >= 0) { flags = eventModifierFlagsToVimMouseModMask(flags); - gui_send_mouse_event(button, col, row, count>1, flags); + gui_send_mouse_event(button, col, row, repeat, flags); } } else if (MouseUpMsgID == msgid) { if (!data) return; @@ -1981,8 +1992,10 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data const void *bytes = [data bytes]; int idx = *((int*)bytes) + 1; send_tabline_menu_event(idx, TABLINE_MENU_CLOSE); + [self redrawScreen]; } else if (AddNewTabMsgID == msgid) { send_tabline_menu_event(0, TABLINE_MENU_NEW); + [self redrawScreen]; } else if (DraggedTabMsgID == msgid) { if (!data) return; const void *bytes = [data bytes]; @@ -2059,10 +2072,6 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data [self handleOpenWithArguments:[NSDictionary dictionaryWithData:data]]; } else if (FindReplaceMsgID == msgid) { [self handleFindReplace:[NSDictionary dictionaryWithData:data]]; - } else if (NetBeansMsgID == msgid) { -#ifdef FEAT_NETBEANS_INTG - netbeans_read(); -#endif } else if (ZoomMsgID == msgid) { if (!data) return; const void *bytes = [data bytes]; @@ -2085,9 +2094,7 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data winposY = *((int*)bytes); bytes += sizeof(int); ASLogDebug(@"SetWindowPositionMsgID: x=%d y=%d", winposX, winposY); } else if (GestureMsgID == msgid) { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) [self handleGesture:data]; -#endif } else if (ActivatedImMsgID == msgid) { [self setImState:YES]; } else if (DeactivatedImMsgID == msgid) { @@ -2686,7 +2693,7 @@ - (void)handleOpenWithArguments:(NSDictionary *)args if (mch_isdir(s)) { mch_chdir((char*)s); } else { - vim_chdirfile(s); + vim_chdirfile(s, "drop"); } vim_free(s); } @@ -2964,25 +2971,25 @@ - (void)handleFindReplace:(NSDictionary *)args - (void)handleMarkedText:(NSData *)data { const void *bytes = [data bytes]; + unsigned textlen = *((unsigned*)bytes); bytes += sizeof(unsigned); int32_t pos = *((int32_t*)bytes); bytes += sizeof(int32_t); unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned); char *chars = (char *)bytes; - ASLogDebug(@"pos=%d len=%d chars=%s", pos, len, chars); + ASLogDebug(@"textlen=%d pos=%d len=%d chars=%s", textlen, pos, len, chars); if (pos < 0) { im_preedit_abandon_macvim(); - } else if (len == 0) { + } else if (textlen == 0) { im_preedit_end_macvim(); } else { if (!preedit_get_status()) im_preedit_start_macvim(); - im_preedit_changed_macvim(chars, pos); + im_preedit_changed_macvim(chars, pos, pos + len); } } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)handleGesture:(NSData *)data { const void *bytes = [data bytes]; @@ -3010,7 +3017,6 @@ - (void)handleGesture:(NSData *)data add_to_input_buf(string, 6); } } -#endif #ifdef FEAT_BEVAL - (void)bevalCallback:(id)sender @@ -3036,6 +3042,24 @@ - (void)bevalCallback:(id)sender } #endif +#ifdef MESSAGE_QUEUE +- (void)checkForProcessEvents:(NSTimer *)timer +{ +# ifdef FEAT_TIMERS + did_add_timer = FALSE; +# endif + + parse_queued_messages(); + + if (input_available() +# ifdef FEAT_TIMERS + || did_add_timer +# endif + ) + CFRunLoopStop(CFRunLoopGetCurrent()); +} +#endif + @end // MMBackend (Private) @@ -3205,13 +3229,13 @@ static int eventModifierFlagsToVimModMask(int modifierFlags) { int modMask = 0; - if (modifierFlags & NSShiftKeyMask) + if (modifierFlags & NSEventModifierFlagShift) modMask |= MOD_MASK_SHIFT; - if (modifierFlags & NSControlKeyMask) + if (modifierFlags & NSEventModifierFlagControl) modMask |= MOD_MASK_CTRL; - if (modifierFlags & NSAlternateKeyMask) + if (modifierFlags & NSEventModifierFlagOption) modMask |= MOD_MASK_ALT; - if (modifierFlags & NSCommandKeyMask) + if (modifierFlags & NSEventModifierFlagCommand) modMask |= MOD_MASK_CMD; return modMask; @@ -3221,11 +3245,11 @@ static int eventModifierFlagsToVimMouseModMask(int modifierFlags) { int modMask = 0; - if (modifierFlags & NSShiftKeyMask) + if (modifierFlags & NSEventModifierFlagShift) modMask |= MOUSE_SHIFT; - if (modifierFlags & NSControlKeyMask) + if (modifierFlags & NSEventModifierFlagControl) modMask |= MOUSE_CTRL; - if (modifierFlags & NSAlternateKeyMask) + if (modifierFlags & NSEventModifierFlagOption) modMask |= MOUSE_ALT; return modMask; diff --git a/src/MacVim/MMCoreTextView+ToolTip.m b/src/MacVim/MMCoreTextView+ToolTip.m index 7d6a261fea..defc5d0d74 100644 --- a/src/MacVim/MMCoreTextView+ToolTip.m +++ b/src/MacVim/MMCoreTextView+ToolTip.m @@ -19,10 +19,7 @@ * changes were made to adapt the code to MacVim. */ -#import "Miscellaneous.h" // Defines MM_ENABLE_ATSUI - -#if !MM_ENABLE_ATSUI - +#import "MacVim.h" #import "MMCoreTextView.h" @@ -154,12 +151,12 @@ - (void)_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count } } -// Sends a fake NSMouseExited event to the view for its current tracking rect. +// Sends a fake NSEventTypeMouseExited event to the view for its current tracking rect. - (void)_sendToolTipMouseExited { // Nothing matters except window, trackingNumber, and userData. int windowNumber = [[self window] windowNumber]; - NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited + NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSEventTypeMouseExited location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 @@ -171,12 +168,12 @@ - (void)_sendToolTipMouseExited [trackingRectOwner_ mouseExited:fakeEvent]; } -// Sends a fake NSMouseEntered event to the view for its current tracking rect. +// Sends a fake NSEventTypeMouseEntered event to the view for its current tracking rect. - (void)_sendToolTipMouseEntered { // Nothing matters except window, trackingNumber, and userData. int windowNumber = [[self window] windowNumber]; - NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered + NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSEventTypeMouseEntered location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 @@ -232,5 +229,3 @@ - (NSString *)view:(NSView *)view } @end - -#endif // !MM_ENABLE_ATSUI diff --git a/src/MacVim/MMCoreTextView.h b/src/MacVim/MMCoreTextView.h index 489ae87142..5c2278f2b1 100644 --- a/src/MacVim/MMCoreTextView.h +++ b/src/MacVim/MMCoreTextView.h @@ -9,9 +9,6 @@ */ #import <Cocoa/Cocoa.h> -#import "Miscellaneous.h" // Defines MM_ENABLE_ATSUI - -#if !MM_ENABLE_ATSUI @class MMTextViewHelper; @@ -25,12 +22,16 @@ NSFont *font; NSFont *fontWide; float linespace; + float columnspace; // From NSTextView NSSize insetSize; float fontDescent; BOOL antialias; + BOOL ligatures; + BOOL thinStrokes; + BOOL drawPending; NSMutableArray *drawData; MMTextViewHelper *helper; @@ -40,6 +41,11 @@ CGPoint *positions; NSMutableArray *fontCache; + BOOL cgLayerEnabled; + CGLayerRef cgLayer; + CGContextRef cgLayerContext; + NSLock *cgLayerLock; + // These are used in MMCoreTextView+ToolTip.m id trackingRectOwner_; // (not retained) void *trackingRectUserData_; @@ -69,6 +75,7 @@ - (NSFont *)fontWide; - (NSSize)cellSize; - (void)setLinespace:(float)newLinespace; +- (void)setProportionalFont:(BOOL)proportionalFont; // // MMTextView methods @@ -78,20 +85,23 @@ - (void)setPreEditRow:(int)row column:(int)col; - (void)setMouseShape:(int)shape; - (void)setAntialias:(BOOL)state; +- (void)setLigatures:(BOOL)state; +- (void)setThinStrokes:(BOOL)state; - (void)setImControl:(BOOL)enable; - (void)activateIm:(BOOL)enable; - (void)checkImState; - (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column; - (NSRect)rectForRow:(int)row column:(int)column numRows:(int)nr numColumns:(int)nc; +- (void)setCGLayerEnabled:(BOOL)enabled; // // NSTextView methods // +- (void)setFrameSize:(NSSize)newSize; - (void)keyDown:(NSEvent *)event; - (void)insertText:(id)string; - (void)doCommandBySelector:(SEL)selector; -- (BOOL)performKeyEquivalent:(NSEvent *)event; // // NSTextContainer methods @@ -114,5 +124,3 @@ @interface MMCoreTextView (ToolTip) - (void)setToolTipAtMousePoint:(NSString *)string; @end - -#endif // !MM_ENABLE_ATSUI diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m index c582c46518..21e7e63a2f 100644 --- a/src/MacVim/MMCoreTextView.m +++ b/src/MacVim/MMCoreTextView.m @@ -25,10 +25,7 @@ * resized. */ -#import "Miscellaneous.h" // Defines MM_ENABLE_ATSUI - -#if !MM_ENABLE_ATSUI - +#import "Miscellaneous.h" #import "MMAppController.h" #import "MMCoreTextView.h" #import "MMTextViewHelper.h" @@ -45,7 +42,30 @@ #define DRAW_UNDERC 0x08 /* draw undercurl text */ #define DRAW_ITALIC 0x10 /* draw italic text */ #define DRAW_CURSOR 0x20 -#define DRAW_WIDE 0x40 /* draw wide text */ +#define DRAW_WIDE 0x80 /* draw wide text */ +#define DRAW_COMP 0x100 /* drawing composing char */ +#define DRAW_TUNDERL 0x200 /* draw double underline text */ + +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 +#define kCTFontOrientationDefault kCTFontDefaultOrientation +#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 + +extern void CGContextSetFontSmoothingStyle(CGContextRef, int); +extern int CGContextGetFontSmoothingStyle(CGContextRef); +#define fontSmoothingStyleLight (2 << 3) + +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 + static void +CTFontDrawGlyphs(CTFontRef fontRef, const CGGlyph glyphs[], + const CGPoint positions[], UniCharCount count, + CGContextRef context) +{ + CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL); + CGContextSetFont(context, cgFontRef); + CGContextShowGlyphsAtPositions(context, glyphs, positions, count); + CGFontRelease(cgFontRef); +} +#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 @interface MMCoreTextView (Private) - (MMWindowController *)windowController; @@ -114,6 +134,10 @@ - (id)initWithFrame:(NSRect)frame if (!(self = [super initWithFrame:frame])) return nil; + cgLayerEnabled = [[NSUserDefaults standardUserDefaults] + boolForKey:MMUseCGLayerAlwaysKey]; + cgLayerLock = [NSLock new]; + // NOTE! It does not matter which font is set here, Vim will set its // own font on startup anyway. Just set some bogus values. font = [[NSFont userFixedPitchFontOfSize:0] retain]; @@ -132,6 +156,7 @@ - (id)initWithFrame:(NSRect)frame [self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, NSStringPboardType, nil]]; + ligatures = NO; return self; } @@ -288,7 +313,7 @@ - (void)setFont:(NSFont *)newFont // only render at integer sizes. Hence, we restrict the cell width to // an integer here, otherwise the window width and the actual text // width will not match. - cellSize.width = ceil(em * cellWidthMultiplier); + cellSize.width = columnspace + ceil(em * cellWidthMultiplier); cellSize.height = linespace + defaultLineHeightForFont(font); fontDescent = ceil(CTFontGetDescent(fontRef)); @@ -306,7 +331,18 @@ - (void)setWideFont:(NSFont *)newFont // NOTE: No need to set point size etc. since this is taken from the // regular font when drawing. [fontWide release]; - fontWide = [newFont retain]; + + // Use 'Apple Color Emoji' font for rendering emoji + CGFloat size = [font pointSize]; + NSFontDescriptor *emojiDesc = [NSFontDescriptor + fontDescriptorWithName:@"Apple Color Emoji" size:size]; + NSFontDescriptor *newFontDesc = [newFont fontDescriptor]; + NSDictionary *attrs = [NSDictionary + dictionaryWithObject:[NSArray arrayWithObject:newFontDesc] + forKey:NSFontCascadeListAttribute]; + NSFontDescriptor *desc = + [emojiDesc fontDescriptorByAddingAttributes:attrs]; + fontWide = [[NSFont fontWithDescriptor:desc size:size] retain]; } } @@ -338,6 +374,21 @@ - (void)setLinespace:(float)newLinespace cellSize.height = linespace + defaultLineHeightForFont(font); } +- (void)setColumnspace:(float)newColumnspace +{ + columnspace = newColumnspace; + + double em = round(defaultAdvanceForFont(font)); + float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults] + floatForKey:MMCellWidthMultiplierKey]; + + cellSize.width = columnspace + ceil(em * cellWidthMultiplier); +} + +- (void)setProportionalFont:(BOOL)proportionalFont +{ + // NOT IMPLEMENTED +} @@ -365,6 +416,16 @@ - (void)setAntialias:(BOOL)state antialias = state; } +- (void)setLigatures:(BOOL)state +{ + ligatures = state; +} + +- (void)setThinStrokes:(BOOL)state +{ + thinStrokes = state; +} + - (void)setImControl:(BOOL)enable { [helper setImControl:enable]; @@ -391,6 +452,14 @@ - (BOOL)_wantsKeyDownForEvent:(id)event return YES; } +- (void)setFrameSize:(NSSize)newSize { + if (!drawPending && !NSEqualSizes(newSize, self.frame.size) && drawData.count == 0) { + [NSAnimationContext beginGrouping]; + drawPending = YES; + } + [super setFrameSize:newSize]; +} + - (void)keyDown:(NSEvent *)event { [helper keyDown:event]; @@ -406,11 +475,6 @@ - (void)doCommandBySelector:(SEL)selector [helper doCommandBySelector:selector]; } -- (BOOL)performKeyEquivalent:(NSEvent *)event -{ - return [helper performKeyEquivalent:event]; -} - - (BOOL)hasMarkedText { return [helper hasMarkedText]; @@ -496,13 +560,10 @@ - (void)mouseMoved:(NSEvent *)event [helper mouseMoved:event]; } -// Gesture event are new for OS X 10.6 -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)swipeWithEvent:(NSEvent *)event { [helper swipeWithEvent:event]; } -#endif - (NSMenu*)menuForEvent:(NSEvent *)event { @@ -554,25 +615,116 @@ - (void)drawRect:(NSRect)rect NSGraphicsContext *context = [NSGraphicsContext currentContext]; [context setShouldAntialias:antialias]; - id data; - NSEnumerator *e = [drawData objectEnumerator]; - while ((data = [e nextObject])) - [self batchDrawData:data]; + if (cgLayerEnabled && drawData.count == 0) { + // during a live resize, we will have around a stale layer until the + // refresh messages travel back from the vim process. We push the old + // layer in at an offset to get rid of jitter due to lines changing + // position. + [cgLayerLock lock]; + CGLayerRef l = [self getCGLayer]; + CGSize cgLayerSize = CGLayerGetSize(l); + CGSize frameSize = [self frame].size; + NSRect drawRect = NSMakeRect( + 0, + frameSize.height - cgLayerSize.height, + cgLayerSize.width, + cgLayerSize.height); + + CGContextRef cgContext = [context graphicsPort]; + + const NSRect *rects; + long count; + [self getRectsBeingDrawn:&rects count:&count]; + + int i; + for (i = 0; i < count; i++) { + CGContextSaveGState(cgContext); + CGContextClipToRect(cgContext, rects[i]); + CGContextSetBlendMode(cgContext, kCGBlendModeCopy); + CGContextDrawLayerInRect(cgContext, drawRect, l); + CGContextRestoreGState(cgContext); + } + [cgLayerLock unlock]; + } else { + id data; + NSEnumerator *e = [drawData objectEnumerator]; + while ((data = [e nextObject])) + [self batchDrawData:data]; - [drawData removeAllObjects]; + [drawData removeAllObjects]; + } } - (void)performBatchDrawWithData:(NSData *)data { - [drawData addObject:data]; - [self setNeedsDisplay:YES]; + if (cgLayerEnabled && drawData.count == 0 && [self getCGContext]) { + [cgLayerLock lock]; + [self batchDrawData:data]; + [cgLayerLock unlock]; + } else { + [drawData addObject:data]; + [self setNeedsDisplay:YES]; + } + if (drawPending) { + [NSAnimationContext endGrouping]; + drawPending = NO; + } +} - // NOTE: During resizing, Cocoa only sends draw messages before Vim's rows - // and columns are changed (due to ipc delays). Force a redraw here. - if ([self inLiveResize]) - [self display]; +- (void)setCGLayerEnabled:(BOOL)enabled +{ + cgLayerEnabled = enabled; + + if (!cgLayerEnabled) + [self releaseCGLayer]; } +- (void)releaseCGLayer +{ + if (cgLayer) { + CGLayerRelease(cgLayer); + cgLayer = nil; + cgLayerContext = nil; + } +} + +- (CGLayerRef)getCGLayer +{ + NSParameterAssert(cgLayerEnabled); + if (!cgLayer && [self lockFocusIfCanDraw]) { + NSGraphicsContext *context = [NSGraphicsContext currentContext]; + NSRect frame = [self frame]; + cgLayer = CGLayerCreateWithContext( + [context graphicsPort], frame.size, NULL); + [self unlockFocus]; + } + return cgLayer; +} + +- (CGContextRef)getCGContext +{ + if (cgLayerEnabled) { + if (!cgLayerContext) + cgLayerContext = CGLayerGetContext([self getCGLayer]); + return cgLayerContext; + } else { + return [[NSGraphicsContext currentContext] graphicsPort]; + } +} + +- (void)setNeedsDisplayCGLayerInRect:(CGRect)rect +{ + if (cgLayerEnabled) + [self setNeedsDisplayInRect:rect]; +} + +- (void)setNeedsDisplayCGLayer:(BOOL)flag +{ + if (cgLayerEnabled) + [self setNeedsDisplay:flag]; +} + + - (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size { // TODO: @@ -820,7 +972,7 @@ - (void)batchDrawData:(NSData *)data const void *end = bytes + [data length]; #if MM_DEBUG_DRAWING - ASLogNotice(@"====> BEGIN %s", _cmd); + ASLogNotice(@"====> BEGIN"); #endif // TODO: Sanity check input @@ -876,10 +1028,19 @@ - (void)batchDrawData:(NSData *)data column:col numRows:height numColumns:width]; - [signImg drawInRect:r - fromRect:NSZeroRect - operation:NSCompositeSourceOver - fraction:1.0]; + if (cgLayerEnabled) { + CGContextRef context = [self getCGContext]; + CGImageRef cgImage = [signImg CGImageForProposedRect:&r + context:nil + hints:nil]; + CGContextDrawImage(context, r, cgImage); + } else { + [signImg drawInRect:r + fromRect:NSZeroRect + operation:NSCompositingOperationSourceOver + fraction:1.0]; + } + [self setNeedsDisplayCGLayerInRect:r]; } else if (DrawStringDrawType == type) { int bg = *((int*)bytes); bytes += sizeof(int); int fg = *((int*)bytes); bytes += sizeof(int); @@ -981,49 +1142,145 @@ - (void)batchDrawData:(NSData *)data } #if MM_DEBUG_DRAWING - ASLogNotice(@"<==== END %s", _cmd); + ASLogNotice(@"<==== END"); #endif } - static CTFontRef -lookupFont(NSMutableArray *fontCache, const unichar *chars, + static CTFontRef +lookupFont(NSMutableArray *fontCache, const unichar *chars, UniCharCount count, CTFontRef currFontRef) { + CGGlyph glyphs[count]; + // See if font in cache can draw at least one character NSUInteger i; for (i = 0; i < [fontCache count]; ++i) { NSFont *font = [fontCache objectAtIndex:i]; - CGGlyph glyphs[1]; - if (CTFontGetGlyphsForCharacters((CTFontRef)font, chars, glyphs, 1)) + if (CTFontGetGlyphsForCharacters((CTFontRef)font, chars, glyphs, count)) return (CTFontRef)[font retain]; } // Ask Core Text for a font (can be *very* slow, which is why we cache // fonts in the first place) - CFRange r = { 0, 1 }; - CFStringRef strRef = CFStringCreateWithCharacters(NULL, chars, 1); + CFRange r = { 0, count }; + CFStringRef strRef = CFStringCreateWithCharacters(NULL, chars, count); CTFontRef newFontRef = CTFontCreateForString(currFontRef, strRef, r); CFRelease(strRef); + // Verify the font can actually convert all the glyphs. + if (!CTFontGetGlyphsForCharacters(newFontRef, chars, glyphs, count)) + return nil; + if (newFontRef) [fontCache addObject:(NSFont *)newFontRef]; return newFontRef; } + static CFAttributedStringRef +attributedStringForString(NSString *string, const CTFontRef font, + BOOL useLigatures) +{ + NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: + (id)font, kCTFontAttributeName, + // 2 - full ligatures including rare + // 1 - basic ligatures + // 0 - no ligatures + [NSNumber numberWithBool:useLigatures], + kCTLigatureAttributeName, + nil + ]; + + return CFAttributedStringCreate(NULL, (CFStringRef)string, + (CFDictionaryRef)attrs); +} + + static UniCharCount +fetchGlyphsAndAdvances(const CTLineRef line, CGGlyph *glyphs, CGSize *advances, + CGPoint *positions, UniCharCount length) +{ + NSArray *glyphRuns = (NSArray*)CTLineGetGlyphRuns(line); + + // get a hold on the actual character widths and glyphs in line + UniCharCount offset = 0; + for (id item in glyphRuns) { + CTRunRef run = (CTRunRef)item; + CFIndex count = CTRunGetGlyphCount(run); + + if (count > 0 && count - offset > length) + count = length - offset; + + CFRange range = CFRangeMake(0, count); + + if (glyphs != NULL) + CTRunGetGlyphs(run, range, &glyphs[offset]); + if (advances != NULL) + CTRunGetAdvances(run, range, &advances[offset]); + if (positions != NULL) + CTRunGetPositions(run, range, &positions[offset]); + + offset += count; + if (offset >= length) + break; + } + + return offset; +} + + static UniCharCount +gatherGlyphs(CGGlyph glyphs[], UniCharCount count) +{ + // Gather scattered glyphs that was happended by Surrogate pair chars + UniCharCount glyphCount = 0; + NSUInteger pos = 0; + NSUInteger i; + for (i = 0; i < count; ++i) { + if (glyphs[i] != 0) { + ++glyphCount; + glyphs[pos++] = glyphs[i]; + } + } + return glyphCount; +} + + static UniCharCount +composeGlyphsForChars(const unichar *chars, CGGlyph *glyphs, + CGPoint *positions, UniCharCount length, CTFontRef font, + BOOL isComposing, BOOL useLigatures) +{ + memset(glyphs, 0, sizeof(CGGlyph) * length); + + NSString *plainText = [NSString stringWithCharacters:chars length:length]; + CFAttributedStringRef composedText = attributedStringForString(plainText, + font, + useLigatures); + + CTLineRef line = CTLineCreateWithAttributedString(composedText); + + // get the (composing)glyphs and advances for the new text + UniCharCount offset = fetchGlyphsAndAdvances(line, glyphs, NULL, + isComposing ? positions : NULL, + length); + + CFRelease(composedText); + CFRelease(line); + + // as ligatures composing characters it is required to adjust the + // original length value + return offset; +} + static void recurseDraw(const unichar *chars, CGGlyph *glyphs, CGPoint *positions, UniCharCount length, CGContextRef context, CTFontRef fontRef, - NSMutableArray *fontCache) + NSMutableArray *fontCache, BOOL isComposing, BOOL useLigatures) { - if (CTFontGetGlyphsForCharacters(fontRef, chars, glyphs, length)) { // All chars were mapped to glyphs, so draw all at once and return. - CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL); - CGContextSetFont(context, cgFontRef); - CGContextShowGlyphsAtPositions(context, glyphs, positions, length); - CGFontRelease(cgFontRef); + length = composeGlyphsForChars(chars, glyphs, positions, length, + fontRef, isComposing, useLigatures); + CTFontDrawGlyphs(fontRef, glyphs, positions, length, context); return; } @@ -1035,36 +1292,70 @@ - (void)batchDrawData:(NSData *)data // Draw as many consecutive glyphs as possible in the current font // (if a glyph is 0 that means it does not exist in the current // font). + BOOL surrogatePair = NO; while (*g && g < glyphsEnd) { - ++g; - ++c; + if (CFStringIsSurrogateHighCharacter(*c)) { + surrogatePair = YES; + g += 2; + c += 2; + } else { + ++g; + ++c; + } ++p; } int count = g-glyphs; - CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL); - CGContextSetFont(context, cgFontRef); - CGContextShowGlyphsAtPositions(context, glyphs, positions, count); - CGFontRelease(cgFontRef); + if (surrogatePair) + count = gatherGlyphs(glyphs, count); + CTFontDrawGlyphs(fontRef, glyphs, positions, count, context); } else { // Skip past as many consecutive chars as possible which cannot be // drawn in the current font. while (0 == *g && g < glyphsEnd) { - ++g; - ++c; + if (CFStringIsSurrogateHighCharacter(*c)) { + g += 2; + c += 2; + } else { + ++g; + ++c; + } ++p; } - // Figure out which font to draw these chars with. + // Try to find a fallback font that can render the entire + // invalid range. If that fails, repeatedly halve the attempted + // range until a font is found. UniCharCount count = c - chars; - CTFontRef newFontRef = lookupFont(fontCache, chars, fontRef); - if (!newFontRef) + UniCharCount attemptedCount = count; + CTFontRef fallback = nil; + while (fallback == nil && attemptedCount > 0) { + fallback = lookupFont(fontCache, chars, attemptedCount, + fontRef); + if (!fallback) + attemptedCount /= 2; + } + + if (!fallback) return; - recurseDraw(chars, glyphs, positions, count, context, newFontRef, - fontCache); + recurseDraw(chars, glyphs, positions, attemptedCount, context, + fallback, fontCache, isComposing, useLigatures); + + // If only a portion of the invalid range was rendered above, + // the remaining range needs to be attempted by subsequent + // iterations of the draw loop. + c -= count - attemptedCount; + g -= count - attemptedCount; + p -= count - attemptedCount; + + CFRelease(fallback); + } - CFRelease(newFontRef); + if (glyphs == g) { + // No valid chars in the glyphs. Exit from the possible infinite + // recursive call. + break; } chars = c; @@ -1078,13 +1369,15 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length withFlags:(int)flags foregroundColor:(int)fg backgroundColor:(int)bg specialColor:(int)sp { - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef context = [self getCGContext]; NSRect frame = [self bounds]; float x = col*cellSize.width + insetSize.width; float y = frame.size.height - insetSize.height - (1+row)*cellSize.height; float w = cellSize.width; + BOOL wide = flags & DRAW_WIDE ? YES : NO; + BOOL composing = flags & DRAW_COMP ? YES : NO; - if (flags & DRAW_WIDE) { + if (wide) { // NOTE: It is assumed that either all characters in 'chars' are wide // or all are normal width. w *= 2; @@ -1092,6 +1385,13 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length CGContextSaveGState(context); + int originalFontSmoothingStyle = 0; + if (thinStrokes) { + CGContextSetShouldSmoothFonts(context, YES); + originalFontSmoothingStyle = CGContextGetFontSmoothingStyle(context); + CGContextSetFontSmoothingStyle(context, fontSmoothingStyleLight); + } + // NOTE! 'cells' is zero if we're drawing a composing character CGFloat clipWidth = cells > 0 ? cells*cellSize.width : w; CGRect clipRect = { {x, y}, {clipWidth, cellSize.height} }; @@ -1117,7 +1417,13 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length if (flags & DRAW_UNDERL) { // Draw underline - CGRect rect = { {x, y+0.4*fontDescent}, {cells*cellSize.width, 1} }; + CGRect rect = { {x, y}, {cells*cellSize.width, 1} }; + CGContextSetRGBFillColor(context, RED(sp), GREEN(sp), BLUE(sp), + ALPHA(sp)); + CGContextFillRect(context, rect); + } else if (flags & DRAW_TUNDERL) { + // Draw underline + CGRect rect = { {x, y}, {cells*cellSize.width, 2} }; CGContextSetRGBFillColor(context, RED(sp), GREEN(sp), BLUE(sp), ALPHA(sp)); CGContextFillRect(context, rect); @@ -1136,14 +1442,14 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length } CGContextSetRGBStrokeColor(context, RED(sp), GREEN(sp), BLUE(sp), - ALPHA(sp)); + ALPHA(sp)); CGContextStrokePath(context); } if (length > maxlen) { if (glyphs) free(glyphs); if (positions) free(positions); - glyphs = (CGGlyph*)malloc(length*sizeof(CGGlyph)); + glyphs = (CGGlyph*)calloc(length, sizeof(CGGlyph)); positions = (CGPoint*)calloc(length, sizeof(CGPoint)); maxlen = length; } @@ -1154,15 +1460,14 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length CGContextSetFontSize(context, [font pointSize]); // Calculate position of each glyph relative to (x,y). - NSUInteger i; - float xrel = 0; - for (i = 0; i < length; ++i) { - positions[i].x = xrel; - xrel += w; + float xrel = composing ? .0 : w; + for (unsigned i = 0; i < length; ++i) { + positions[i].x = i * xrel; + positions[i].y = .0; } - CTFontRef fontRef = (CTFontRef)(flags & DRAW_WIDE ? [fontWide retain] - : [font retain]); + CTFontRef fontRef = (CTFontRef)(wide ? [fontWide retain] + : [font retain]); unsigned traits = 0; if (flags & DRAW_ITALIC) traits |= kCTFontItalicTrait; @@ -1171,7 +1476,7 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length if (traits) { CTFontRef fr = CTFontCreateCopyWithSymbolicTraits(fontRef, 0.0, NULL, - traits, traits); + traits, traits); if (fr) { CFRelease(fontRef); fontRef = fr; @@ -1179,18 +1484,37 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length } CGContextSetTextPosition(context, x, y+fontDescent); - recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache); + recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache, + composing, ligatures); CFRelease(fontRef); + if (thinStrokes) + CGContextSetFontSmoothingStyle(context, originalFontSmoothingStyle); CGContextRestoreGState(context); + + [self setNeedsDisplayCGLayerInRect:clipRect]; } - (void)scrollRect:(NSRect)rect lineCount:(int)count { - NSPoint destPoint = rect.origin; - destPoint.y -= count * cellSize.height; + if (cgLayerEnabled) { + CGContextRef context = [self getCGContext]; + int yOffset = count * cellSize.height; + NSRect clipRect = rect; + clipRect.origin.y -= yOffset; - NSCopyBits(0, rect, destPoint); + // draw self on top of self, offset so as to "scroll" lines vertically + CGContextSaveGState(context); + CGContextClipToRect(context, clipRect); + CGContextSetBlendMode(context, kCGBlendModeCopy); + CGContextDrawLayerAtPoint( + context, CGPointMake(0, -yOffset), [self getCGLayer]); + CGContextRestoreGState(context); + [self setNeedsDisplayCGLayerInRect:clipRect]; + } else { + NSSize delta={0, -count * cellSize.height}; + [self scrollRect:rect by:delta]; + } } - (void)deleteLinesFromRow:(int)row lineCount:(int)count @@ -1232,7 +1556,7 @@ - (void)insertLinesAtRow:(int)row lineCount:(int)count - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 column:(int)col2 color:(int)color { - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef context = [self getCGContext]; NSRect rect = [self rectFromRow:row1 column:col1 toRow:row2 column:col2]; CGContextSetRGBFillColor(context, RED(color), GREEN(color), BLUE(color), @@ -1241,11 +1565,13 @@ - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 CGContextSetBlendMode(context, kCGBlendModeCopy); CGContextFillRect(context, *(CGRect*)&rect); CGContextSetBlendMode(context, kCGBlendModeNormal); + [self setNeedsDisplayCGLayerInRect:rect]; } - (void)clearAll { - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + [self releaseCGLayer]; + CGContextRef context = [self getCGContext]; NSRect rect = [self bounds]; float r = [defaultBackgroundColor redComponent]; float g = [defaultBackgroundColor greenComponent]; @@ -1256,12 +1582,14 @@ - (void)clearAll CGContextSetRGBFillColor(context, r, g, b, a); CGContextFillRect(context, *(CGRect*)&rect); CGContextSetBlendMode(context, kCGBlendModeNormal); + + [self setNeedsDisplayCGLayer:YES]; } - (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape fraction:(int)percent color:(int)color { - CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef context = [self getCGContext]; NSRect rect = [self rectForRow:row column:col numRows:1 numColumns:1]; CGContextSaveGState(context); @@ -1303,6 +1631,7 @@ - (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape CGContextFillRect(context, *(CGRect*)&rect); } + [self setNeedsDisplayCGLayerInRect:rect]; CGContextRestoreGState(context); } @@ -1310,7 +1639,7 @@ - (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows numColumns:(int)ncols { // TODO: THIS CODE HAS NOT BEEN TESTED! - CGContextRef cgctx = [[NSGraphicsContext currentContext] graphicsPort]; + CGContextRef cgctx = [self getCGContext]; CGContextSaveGState(cgctx); CGContextSetBlendMode(cgctx, kCGBlendModeDifference); CGContextSetRGBFillColor(cgctx, 1.0, 1.0, 1.0, 1.0); @@ -1319,9 +1648,8 @@ - (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows numColumns:ncols]; CGContextFillRect(cgctx, *(CGRect*)&rect); + [self setNeedsDisplayCGLayerInRect:rect]; CGContextRestoreGState(cgctx); } @end // MMCoreTextView (Drawing) - -#endif // !MM_ENABLE_ATSUI diff --git a/src/MacVim/MMFullScreenWindow.h b/src/MacVim/MMFullScreenWindow.h index 9a86c5c5d8..629570c40c 100644 --- a/src/MacVim/MMFullScreenWindow.h +++ b/src/MacVim/MMFullScreenWindow.h @@ -30,6 +30,10 @@ // This stores the contents of fuoptions_flags at fu start time int startFuFlags; + + // Controls the speed of the fade in and out. + double fadeTime; + double fadeReservationTime; } - (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v diff --git a/src/MacVim/MMFullScreenWindow.m b/src/MacVim/MMFullScreenWindow.m index 658c24ac92..666c14391c 100644 --- a/src/MacVim/MMFullScreenWindow.m +++ b/src/MacVim/MMFullScreenWindow.m @@ -65,9 +65,9 @@ - (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v // you can't change the style of an existing window in cocoa. create a new // window and move the MMTextView into it. // (another way would be to make the existing window large enough that the - // title bar is off screen. but that doesn't work with multiple screens). + // title bar is off screen. but that doesn't work with multiple screens). self = [super initWithContentRect:[screen frame] - styleMask:NSBorderlessWindowMask + styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:YES // since we're passing [screen frame] above, @@ -104,7 +104,15 @@ - (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v // NOTE: Vim needs to process mouse moved events, so enable them here. [self setAcceptsMouseMovedEvents:YES]; - + + fadeTime = [[NSUserDefaults standardUserDefaults] doubleForKey:MMFullScreenFadeTimeKey]; + + // Each fade goes in and then out, so the fade hardware must be reserved accordingly and the + // actual fade time can't exceed half the allowable reservation time... plus some slack to + // prevent visual artifacts caused by defaulting on the fade hardware lease. + fadeTime = MIN(fadeTime, 0.5 * (kCGMaxDisplayReservationInterval - 1)); + fadeReservationTime = 2.0 * fadeTime + 1; + return self; } @@ -137,8 +145,8 @@ - (void)enterFullScreen // fade to black Boolean didBlend = NO; CGDisplayFadeReservationToken token; - if (CGAcquireDisplayFadeReservation(.5, &token) == kCGErrorSuccess) { - CGDisplayFade(token, .25, kCGDisplayBlendNormal, + if (CGAcquireDisplayFadeReservation(fadeReservationTime, &token) == kCGErrorSuccess) { + CGDisplayFade(token, fadeTime, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, .0, .0, .0, true); didBlend = YES; } @@ -155,12 +163,17 @@ - (void)enterFullScreen [[target windowController] setWindow:self]; oldTabBarStyle = [[view tabBarControl] styleName]; - [[view tabBarControl] setStyleNamed:@"Unified"]; + + NSString *style = + shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Unified"; + [[view tabBarControl] setStyleNamed:style]; // add text view oldPosition = [view frame].origin; [view removeFromSuperviewWithoutNeedingDisplay]; + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) + [[view textView] setCGLayerEnabled:YES]; [[self contentView] addSubview:view]; [self setInitialFirstResponder:[view textView]]; @@ -189,29 +202,27 @@ - (void)enterFullScreen // dimensions when exiting full-screen. startFuFlags = options; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) // HACK! Put window on all Spaces to avoid Spaces (available on OS X 10.5 // and later) from moving the full-screen window to a separate Space from // the one the decorated window is occupying. The collection behavior is // restored further down. NSWindowCollectionBehavior wcb = [self collectionBehavior]; [self setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; -#endif // make us visible and target invisible [target orderOut:self]; [self makeKeyAndOrderFront:self]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) // Restore collection behavior (see hack above). [self setCollectionBehavior:wcb]; -#endif // fade back in if (didBlend) { - CGDisplayFade(token, .25, kCGDisplayBlendSolidColor, - kCGDisplayBlendNormal, .0, .0, .0, false); - CGReleaseDisplayFadeReservation(token); + [NSAnimationContext currentContext].completionHandler = ^{ + CGDisplayFade(token, fadeTime, kCGDisplayBlendSolidColor, + kCGDisplayBlendNormal, .0, .0, .0, false); + CGReleaseDisplayFadeReservation(token); + }; } state = InFullScreen; @@ -222,8 +233,8 @@ - (void)leaveFullScreen // fade to black Boolean didBlend = NO; CGDisplayFadeReservationToken token; - if (CGAcquireDisplayFadeReservation(.5, &token) == kCGErrorSuccess) { - CGDisplayFade(token, .25, kCGDisplayBlendNormal, + if (CGAcquireDisplayFadeReservation(fadeReservationTime, &token) == kCGErrorSuccess) { + CGDisplayFade(token, fadeTime, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, .0, .0, .0, true); didBlend = YES; } @@ -277,11 +288,13 @@ - (void)leaveFullScreen [view setFrameOrigin:oldPosition]; [self close]; + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) + [[view textView] setCGLayerEnabled:NO]; + // Set the text view to initial first responder, otherwise the 'plus' // button on the tabline steals the first responder status. [target setInitialFirstResponder:[view textView]]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) // HACK! Put decorated window on all Spaces (available on OS X 10.5 and // later) so that the decorated window stays on the same Space as the full // screen window (they may occupy different Spaces e.g. if the full-screen @@ -289,7 +302,7 @@ - (void)leaveFullScreen // restored further down. NSWindowCollectionBehavior wcb = [target collectionBehavior]; [target setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; -#endif + #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) // HACK! On Mac OS X 10.7 windows animate when makeKeyAndOrderFront: is // called. This is distracting here, so disable the animation and restore @@ -308,10 +321,9 @@ - (void)leaveFullScreen if (NSWindowAnimationBehaviorNone != a) [target setAnimationBehavior:a]; #endif -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) + // Restore collection behavior (see hack above). [target setCollectionBehavior:wcb]; -#endif // ...but we don't want a focus gained message either, so don't set this // sooner @@ -319,7 +331,7 @@ - (void)leaveFullScreen // fade back in if (didBlend) { - CGDisplayFade(token, .25, kCGDisplayBlendSolidColor, + CGDisplayFade(token, fadeTime, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, .0, .0, .0, false); CGReleaseDisplayFadeReservation(token); } @@ -371,6 +383,15 @@ - (void)applicationDidChangeScreenParameters:(NSNotification *)notification [self resizeVimView]; } +- (CGFloat) viewOffset { + CGFloat menuBarHeight = 0; + if([self screen] != [[NSScreen screens] objectAtIndex:0]) { + // Screens other than the primary screen will not hide their menu bar, adjust the visible view down by the menu height + menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]-1; + } + return menuBarHeight; +} + - (void)centerView { NSRect outer = [self frame], inner = [view frame]; @@ -379,7 +400,7 @@ - (void)centerView // rendering issues may arise (screen looks blurry, each redraw clears the // entire window, etc.). NSPoint origin = { floor((outer.size.width - inner.size.width)/2), - floor((outer.size.height - inner.size.height)/2) }; + floor((outer.size.height - inner.size.height)/2 - [self viewOffset]/2) }; [view setFrameOrigin:origin]; } @@ -478,6 +499,8 @@ - (void)resizeVimView // size since it compensates for menu and dock. int maxRows, maxColumns; NSSize size = [[self screen] frame].size; + size.height -= [self viewOffset]; + [view constrainRows:&maxRows columns:&maxColumns toSize:size]; // Compute current fu size diff --git a/src/MacVim/MMPreferenceController.m b/src/MacVim/MMPreferenceController.m index bcf7a6f0a7..9c1dd1d5ca 100644 --- a/src/MacVim/MMPreferenceController.m +++ b/src/MacVim/MMPreferenceController.m @@ -36,7 +36,7 @@ static void loadSymbols() void *ptr; if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNamePreferencesGeneral")) != NULL) nsImageNamePreferencesGeneral = *(NSString**)ptr; - if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNamePreferencesAdvanced")) != NULL) + if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNameAdvanced")) != NULL) nsImageNamePreferencesAdvanced = *(NSString**)ptr; } @@ -47,20 +47,27 @@ - (void)setupToolbar { loadSymbols(); + NSString *generalLabel = NSLocalizedString(@"General", nil); + NSString *advancedLabel = NSLocalizedString(@"Advanced", nil); + if (nsImageNamePreferencesGeneral != NULL) { [self addView:generalPreferences - label:@"General" + label:generalLabel image:[NSImage imageNamed:nsImageNamePreferencesGeneral]]; } else { - [self addView:generalPreferences label:@"General"]; + [self addView:generalPreferences + label:generalLabel + image:[NSImage imageNamed:@"General"]]; } if (nsImageNamePreferencesAdvanced != NULL) { [self addView:advancedPreferences - label:@"Advanced" + label:advancedLabel image:[NSImage imageNamed:nsImageNamePreferencesAdvanced]]; } else { - [self addView:advancedPreferences label:@"Advanced"]; + [self addView:advancedPreferences + label:advancedLabel + image:[NSImage imageNamed:@"Advanced"]]; } } diff --git a/src/MacVim/MMTextStorage.h b/src/MacVim/MMTextStorage.h index 1a7277cedc..11fc5443eb 100644 --- a/src/MacVim/MMTextStorage.h +++ b/src/MacVim/MMTextStorage.h @@ -25,7 +25,7 @@ typedef struct { @interface MMTextStorage : NSTextStorage { - NSMutableAttributedString *attribString; + NSTextStorage *backingStore; int maxRows, maxColumns; int actualRows, actualColumns; NSAttributedString *emptyRowString; @@ -41,10 +41,12 @@ typedef struct { NSColor *defaultForegroundColor; NSSize cellSize; float linespace; + float columnspace; #if MM_USE_ROW_CACHE MMRowCacheEntry *rowCache; #endif BOOL characterEqualsColumn; + BOOL proportionalFont; } - (NSString *)string; @@ -59,7 +61,9 @@ typedef struct { - (int)actualRows; - (int)actualColumns; - (float)linespace; +- (float)columnspace; - (void)setLinespace:(float)newLinespace; +- (void)setColumnspace:(float)newColumnspace; - (void)getMaxRows:(int*)rows columns:(int*)cols; - (void)setMaxRows:(int)rows columns:(int)cols; - (void)drawString:(NSString *)string atRow:(int)row column:(int)col @@ -95,5 +99,6 @@ typedef struct { #if MM_USE_ROW_CACHE - (MMRowCacheEntry *)rowCache; #endif +- (void)setProportionalFont:(BOOL)proportionalFont; @end diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m index 9d4b0e02bd..2b5a3d09be 100644 --- a/src/MacVim/MMTextStorage.m +++ b/src/MacVim/MMTextStorage.m @@ -41,6 +41,8 @@ #define MM_TS_PARANOIA_LOG 1 +#define FIX_HALFWIDE_KATAKANA + // TODO: What does DRAW_TRANSP flag do? If the background isn't drawn when // this flag is set, then sometimes the character after the cursor becomes @@ -51,7 +53,8 @@ #define DRAW_UNDERC 0x08 /* draw undercurl text */ #define DRAW_ITALIC 0x10 /* draw italic text */ #define DRAW_CURSOR 0x20 -#define DRAW_WIDE 0x40 /* draw wide text */ +#define DRAW_WIDE 0x80 /* draw wide text */ +#define DRAW_TUNDERL 0x200 /* draw thick underline text */ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; @@ -66,13 +69,19 @@ - (void)fixInvalidCharactersInRange:(NSRange)range; @end +#ifdef FIX_HALFWIDE_KATAKANA +@interface NSString (Private) +- (NSRange)rangeOfComposedCharacterSequenceAtIndexEx:(NSUInteger)anIndex; +@end +#endif + @implementation MMTextStorage - (id)init { if ((self = [super init])) { - attribString = [[NSMutableAttributedString alloc] initWithString:@""]; + backingStore = [[NSTextStorage alloc] init]; // NOTE! It does not matter which font is set here, Vim will set its // own font on startup anyway. Just set some bogus values. font = [[NSFont userFixedPitchFontOfSize:0] retain]; @@ -104,19 +113,19 @@ - (void)dealloc [font release]; font = nil; [defaultBackgroundColor release]; defaultBackgroundColor = nil; [defaultForegroundColor release]; defaultForegroundColor = nil; - [attribString release]; attribString = nil; + [backingStore release]; backingStore = nil; [super dealloc]; } - (NSString *)string { - return [attribString string]; + return [backingStore string]; } - (NSDictionary *)attributesAtIndex:(NSUInteger)index effectiveRange:(NSRangePointer)range { - return [attribString attributesAtIndex:index effectiveRange:range]; + return [backingStore attributesAtIndex:index effectiveRange:range]; } - (void)replaceCharactersInRange:(NSRange)range @@ -126,7 +135,7 @@ - (void)replaceCharactersInRange:(NSRange)range ASLogWarn(@"Calling %@ on MMTextStorage is unsupported", NSStringFromSelector(_cmd)); #endif - //[attribString replaceCharactersInRange:range withString:string]; + //[backingStore replaceCharactersInRange:range withString:string]; } - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range @@ -134,7 +143,7 @@ - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range // NOTE! This method must be implemented since the text system calls it // constantly to 'fix attributes', apply font substitution, etc. #if 0 - [attribString setAttributes:attributes range:range]; + [backingStore setAttributes:attributes range:range]; #elif 1 // HACK! If the font attribute is being modified, then ensure that the new // font has a fixed advancement which is either the same as the current @@ -153,7 +162,7 @@ - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range return; float adv = cellSize.width; - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:range.location effectiveRange:NULL]) adv += adv; @@ -170,9 +179,9 @@ - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range dictionaryWithDictionary:attributes]; [newAttr setObject:newFont forKey:NSFontAttributeName]; - [attribString setAttributes:newAttr range:range]; + [backingStore setAttributes:newAttr range:range]; } else { - [attribString setAttributes:attributes range:range]; + [backingStore setAttributes:attributes range:range]; } #endif } @@ -202,6 +211,11 @@ - (float)linespace return linespace; } +- (float)columnspace +{ + return columnspace; +} + - (void)setLinespace:(float)newLinespace { NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0]; @@ -221,6 +235,25 @@ - (void)setLinespace:(float)newLinespace cellSize.height = linespace + [lm defaultLineHeightForFont:font]; } +- (void)setColumnspace:(float)newColumnspace +{ + NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0]; + if (!lm) { + ASLogWarn(@"No layout manager available"); + return; + } + + columnspace = newColumnspace; + + float em = [@"m" sizeWithAttributes: + [NSDictionary dictionaryWithObject:font + forKey:NSFontAttributeName]].width; + float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults] + floatForKey:MMCellWidthMultiplierKey]; + + cellSize.width = columnspace + ceilf(em * cellWidthMultiplier); +} + - (void)getMaxRows:(int*)rows columns:(int*)cols { if (rows) *rows = maxRows; @@ -297,6 +330,12 @@ - (void)drawString:(NSString *)string atRow:(int)row column:(int)col [attributes setObject:value forKey:NSUnderlineStyleAttributeName]; } + if (flags & DRAW_TUNDERL) { + NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleThick + | NSUnderlinePatternSolid)]; // | NSUnderlineByWordMask + [attributes setObject:value forKey:NSUnderlineStyleAttributeName]; + } + if (flags & DRAW_UNDERC) { // TODO: figure out how do draw proper undercurls NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleThick @@ -305,15 +344,15 @@ - (void)drawString:(NSString *)string atRow:(int)row column:(int)col } // Mark these characters as wide. This attribute is subsequently checked - // when translating (row,col) pairs to offsets within 'attribString'. + // when translating (row,col) pairs to offsets within 'backingStore'. if (flags & DRAW_WIDE) [attributes setObject:[NSNull null] forKey:MMWideCharacterAttributeName]; // Replace characters in text storage and apply new attributes. NSRange r = NSMakeRange(range.location, [string length]); - [attribString replaceCharactersInRange:range withString:string]; - [attribString setAttributes:attributes range:r]; + [backingStore replaceCharactersInRange:range withString:string]; + [backingStore setAttributes:attributes range:r]; NSInteger changeInLength = [string length] - range.length; if (acells != cells || acol != col) { @@ -321,18 +360,18 @@ - (void)drawString:(NSString *)string atRow:(int)row column:(int)col // NOTE: A normal width character replaced a double width // character. To maintain the invariant that each row covers the // same amount of cells, we compensate by adding an empty column. - [attribString replaceCharactersInRange:NSMakeRange(NSMaxRange(r),0) + [backingStore replaceCharactersInRange:NSMakeRange(NSMaxRange(r),0) withAttributedString:[emptyRowString attributedSubstringFromRange:NSMakeRange(0,1)]]; ++changeInLength; #if 0 } else if (acol == col - 1) { - [attribString replaceCharactersInRange:NSMakeRange(r.location,0) + [backingStore replaceCharactersInRange:NSMakeRange(r.location,0) withAttributedString:[emptyRowString attributedSubstringFromRange:NSMakeRange(0,1)]]; ++changeInLength; } else if (acol == col + 1) { - [attribString replaceCharactersInRange:NSMakeRange(r.location-1,1) + [backingStore replaceCharactersInRange:NSMakeRange(r.location-1,1) withAttributedString:[emptyRowString attributedSubstringFromRange:NSMakeRange(0,2)]]; ++changeInLength; @@ -411,10 +450,10 @@ - (void)deleteLinesFromRow:(int)row lineCount:(int)count return; } - NSAttributedString *srcString = [attribString + NSAttributedString *srcString = [backingStore attributedSubstringFromRange:srcRange]; - [attribString replaceCharactersInRange:destRange + [backingStore replaceCharactersInRange:destRange withAttributedString:srcString]; [self edited:(NSTextStorageEditedCharacters | NSTextStorageEditedAttributes) range:destRange @@ -447,9 +486,9 @@ - (void)deleteLinesFromRow:(int)row lineCount:(int)count return; } - [attribString replaceCharactersInRange:destRange + [backingStore replaceCharactersInRange:destRange withAttributedString:emptyString]; - [attribString setAttributes:attribs + [backingStore setAttributes:attribs range:NSMakeRange(destRange.location, width)]; [self edited:(NSTextStorageEditedAttributes @@ -507,9 +546,9 @@ - (void)insertLinesAtRow:(int)row lineCount:(int)count return; } - NSAttributedString *srcString = [attribString + NSAttributedString *srcString = [backingStore attributedSubstringFromRange:srcRange]; - [attribString replaceCharactersInRange:destRange + [backingStore replaceCharactersInRange:destRange withAttributedString:srcString]; [self edited:(NSTextStorageEditedCharacters | NSTextStorageEditedAttributes) range:destRange @@ -542,9 +581,9 @@ - (void)insertLinesAtRow:(int)row lineCount:(int)count return; } - [attribString replaceCharactersInRange:destRange + [backingStore replaceCharactersInRange:destRange withAttributedString:emptyString]; - [attribString setAttributes:attribs + [backingStore setAttributes:attribs range:NSMakeRange(destRange.location, width)]; [self edited:(NSTextStorageEditedAttributes @@ -589,9 +628,9 @@ - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 return; } - [attribString replaceCharactersInRange:range + [backingStore replaceCharactersInRange:range withAttributedString:emptyString]; - [attribString setAttributes:attribs + [backingStore setAttributes:attribs range:NSMakeRange(range.location, cells)]; [self edited:(NSTextStorageEditedAttributes @@ -653,6 +692,8 @@ - (void)setFont:(NSFont*)newFont NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:cellSize.width] forKey:NSFontFixedAdvanceAttribute]; + if (proportionalFont) + dict = [NSDictionary dictionary]; NSFontDescriptor *desc = [newFont fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dict]; @@ -662,6 +703,7 @@ - (void)setFont:(NSFont*)newFont NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0]; if (lm) { cellSize.height = linespace + [lm defaultLineHeightForFont:font]; + cellSize.width = columnspace + ceilf(em * cellWidthMultiplier); } else { // Should never happen, set some bogus value for cell height. ASLogWarn(@"No layout manager available"); @@ -711,6 +753,8 @@ - (void)setWideFont:(NSFont *)newFont NSDictionary *dictWide = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:2*cellSize.width] forKey:NSFontFixedAdvanceAttribute]; + if (proportionalFont) + dictWide = [NSDictionary dictionary]; desc = [desc fontDescriptorByAddingAttributes:dictWide]; fontWide = [NSFont fontWithDescriptor:desc size:pointSize]; @@ -892,7 +936,7 @@ - (NSRect)boundingRectForCharacterAtRow:(int)row column:(int)col int cells = 1; NSRange r = [self charRangeForRow:row column:&col cells:&cells]; if (NSNotFound != r.location - && [attribString attribute:MMWideCharacterAttributeName + && [backingStore attribute:MMWideCharacterAttributeName atIndex:r.location effectiveRange:nil]) rect.size.width += rect.size.width; @@ -920,6 +964,21 @@ - (MMRowCacheEntry *)rowCache } #endif +- (void)setProportionalFont:(BOOL)pfont +{ + if (proportionalFont != pfont) { + proportionalFont = pfont; + + NSFont *currentFont = font; + font = nil; + [self setFont:currentFont]; + + NSFont *currentFontWide = fontWide; + fontWide = nil; + [self setWideFont:currentFontWide]; + } +} + @end // MMTextStorage @@ -933,7 +992,7 @@ - (void)lazyResize:(BOOL)force if (!force && actualRows == maxRows && actualColumns == maxColumns) return; - NSRange oldRange = NSMakeRange(0, [attribString length]); + NSRange oldRange = NSMakeRange(0, [backingStore length]); actualRows = maxRows; actualColumns = maxColumns; @@ -965,16 +1024,16 @@ - (void)lazyResize:(BOOL)force emptyRowString = [[NSAttributedString alloc] initWithString:rowString attributes:dict]; - [attribString release]; - attribString = [[NSMutableAttributedString alloc] init]; + [backingStore release]; + backingStore = [[NSTextStorage alloc] init]; for (i=0; i<maxRows; ++i) { #if MM_USE_ROW_CACHE rowCache[i].length = actualColumns + 1; #endif - [attribString appendAttributedString:emptyRowString]; + [backingStore appendAttributedString:emptyRowString]; } - NSRange fullRange = NSMakeRange(0, [attribString length]); + NSRange fullRange = NSMakeRange(0, [backingStore length]); [self edited:(NSTextStorageEditedCharacters|NSTextStorageEditedAttributes) range:oldRange changeInLength:fullRange.length-oldRange.length]; } @@ -989,7 +1048,7 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells if (characterEqualsColumn) return NSMakeRange(row*(actualColumns+1) + col, cells); - NSString *string = [attribString string]; + NSString *string = [backingStore string]; unsigned stringLen = [string length]; NSRange r, range = { NSNotFound, 0 }; unsigned idx; @@ -1057,7 +1116,7 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; // Wide chars take up two display cells. - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:idx effectiveRange:nil]) ++i; @@ -1075,7 +1134,7 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells --i; // Wide chars take up two display cells. - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:idx effectiveRange:nil]) --i; @@ -1099,10 +1158,14 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells while (col > i) { if (idx >= stringLen) return NSMakeRange(NSNotFound, 0); +#ifdef FIX_HALFWIDE_KATAKANA + r = [string rangeOfComposedCharacterSequenceAtIndexEx:idx]; +#else r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; +#endif // Wide chars take up two display cells. - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:idx effectiveRange:nil]) ++i; @@ -1124,7 +1187,7 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; // Wide chars take up two display cells. - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:idx effectiveRange:nil]) ++i; @@ -1138,10 +1201,14 @@ - (NSRange)charRangeForRow:(int)row column:(int*)pcol cells:(int*)pcells for (i = 0; i < cells; ++i) { if (idx >= stringLen) return NSMakeRange(NSNotFound, 0); +#ifdef FIX_HALFWIDE_KATAKANA + r = [string rangeOfComposedCharacterSequenceAtIndexEx:idx]; +#else r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; +#endif // Wide chars take up two display cells. - if ([attribString attribute:MMWideCharacterAttributeName + if ([backingStore attribute:MMWideCharacterAttributeName atIndex:idx effectiveRange:nil]) ++i; @@ -1193,14 +1260,14 @@ - (void)fixInvalidCharactersInRange:(NSRange)range // TODO: Treat these separately inside of Vim so we don't have to bother // here. while (range.length > 0) { - invalidRange = [[attribString string] + invalidRange = [[backingStore string] rangeOfCharacterFromSet:invalidCharacterSet options:NSLiteralSearch range:range]; if (NSNotFound == invalidRange.location) break; - [attribString replaceCharactersInRange:invalidRange withString:@" "]; + [backingStore replaceCharactersInRange:invalidRange withString:@" "]; end = NSMaxRange(invalidRange); range.length -= end - range.location; @@ -1209,3 +1276,25 @@ - (void)fixInvalidCharactersInRange:(NSRange)range } @end // MMTextStorage (Private) + + +#ifdef FIX_HALFWIDE_KATAKANA +@implementation NSString (Private) + +- (NSRange)rangeOfComposedCharacterSequenceAtIndexEx:(NSUInteger)anIndex +{ + NSRange r; + unichar c = [self characterAtIndex:anIndex]; + unichar tc = anIndex < [self length] - 1 ? + [self characterAtIndex:(anIndex + 1)] : 0; + if ((c >= 0xff61 && c <= 0xff9f) || (tc >= 0xff61 && tc <= 0xff9f)) { + r.location = anIndex; + r.length = 1; + } else { + r = [self rangeOfComposedCharacterSequenceAtIndex:anIndex]; + } + return r; +} + +@end // NSString (Private) +#endif diff --git a/src/MacVim/MMTextView.h b/src/MacVim/MMTextView.h index 001613b4a8..206b2c0f44 100644 --- a/src/MacVim/MMTextView.h +++ b/src/MacVim/MMTextView.h @@ -20,6 +20,8 @@ int insertionPointShape; int insertionPointFraction; BOOL antialias; + BOOL ligatures; + BOOL thinStrokes; NSRect *invertRects; int numInvertRects; @@ -32,6 +34,8 @@ - (void)performBatchDrawWithData:(NSData *)data; - (void)setMouseShape:(int)shape; - (void)setAntialias:(BOOL)antialias; +- (void)setLigatures:(BOOL)ligatures; +- (void)setThinStrokes:(BOOL)thinStrokes; - (void)setImControl:(BOOL)enable; - (void)activateIm:(BOOL)enable; - (void)checkImState; @@ -45,6 +49,7 @@ - (void)setWideFont:(NSFont *)newFont; - (NSSize)cellSize; - (void)setLinespace:(float)newLinespace; +- (void)setColumnspace:(float)newColumnspace; - (int)maxRows; - (int)maxColumns; - (void)getMaxRows:(int*)rows columns:(int*)cols; @@ -65,7 +70,10 @@ - (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr numColumns:(int)nc; +- (void)setProportionalFont:(BOOL)proportionalFont; + // NOT IMPLEMENTED (only in Core Text renderer) - (void)deleteSign:(NSString *)signName; - (void)setToolTipAtMousePoint:(NSString *)string; +- (void)setCGLayerEnabled:(BOOL)enabled; @end diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index 3b9a7e4507..1ea29859c1 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -307,6 +307,16 @@ - (void)setAntialias:(BOOL)state antialias = state; } +- (void)setLigatures:(BOOL)state +{ + ligatures = state; +} + +- (void)setThinStrokes:(BOOL)state +{ + thinStrokes = state; +} + - (void)setImControl:(BOOL)enable { [helper setImControl:enable]; @@ -352,6 +362,11 @@ - (void)setLinespace:(float)newLinespace return [(MMTextStorage*)[self textStorage] setLinespace:newLinespace]; } +- (void)setColumnspace:(float)newColumnspace +{ + return [(MMTextStorage*)[self textStorage] setColumnspace:newColumnspace]; +} + - (int)maxRows { MMTextStorage *ts = (MMTextStorage *)[self textStorage]; @@ -507,6 +522,17 @@ - (void)setToolTipAtMousePoint:(NSString *)string // ONLY in Core Text! } +- (void)setCGLayerEnabled:(BOOL)enabled +{ + // ONLY in Core Text! +} + +- (void)setProportionalFont:(BOOL)proportionalFont +{ + MMTextStorage *ts = (MMTextStorage *)[self textStorage]; + [ts setProportionalFont:proportionalFont]; +} + - (BOOL)isOpaque { return NO; @@ -680,11 +706,6 @@ - (void)doCommandBySelector:(SEL)selector [helper doCommandBySelector:selector]; } -- (BOOL)performKeyEquivalent:(NSEvent *)event -{ - return [helper performKeyEquivalent:event]; -} - - (BOOL)hasMarkedText { return [helper hasMarkedText]; @@ -775,13 +796,10 @@ - (void)mouseMoved:(NSEvent *)event [helper mouseMoved:event]; } -// Gesture event are new for OS X 10.6 -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)swipeWithEvent:(NSEvent *)event { [helper swipeWithEvent:event]; } -#endif - (NSMenu*)menuForEvent:(NSEvent *)event { diff --git a/src/MacVim/MMTextViewHelper.h b/src/MacVim/MMTextViewHelper.h index 3017d7ca38..bb3d3dd5b5 100644 --- a/src/MacVim/MMTextViewHelper.h +++ b/src/MacVim/MMTextViewHelper.h @@ -10,10 +10,8 @@ #import <Cocoa/Cocoa.h> -#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) // Need Carbon for TIS...() functions #import <Carbon/Carbon.h> -#endif #define BLUE(argb) ((argb & 0xff)/255.0f) @@ -35,6 +33,10 @@ BOOL interpretKeyEventsSwallowedKey; NSEvent *currentEvent; NSMutableDictionary *signImages; + BOOL useMouseTime; + NSDate *mouseDownTime; + CGFloat scrollingDeltaX; + CGFloat scrollingDeltaY; // Input Manager NSRange imRange; @@ -45,10 +47,8 @@ int preEditColumn; BOOL imControl; BOOL imState; -#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) TISInputSourceRef lastImSource; TISInputSourceRef asciiImSource; -#endif } - (id)init; @@ -59,15 +59,12 @@ - (void)keyDown:(NSEvent *)event; - (void)insertText:(id)string; - (void)doCommandBySelector:(SEL)selector; -- (BOOL)performKeyEquivalent:(NSEvent *)event; - (void)scrollWheel:(NSEvent *)event; - (void)mouseDown:(NSEvent *)event; - (void)mouseUp:(NSEvent *)event; - (void)mouseDragged:(NSEvent *)event; - (void)mouseMoved:(NSEvent *)event; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)swipeWithEvent:(NSEvent *)event; -#endif - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; @@ -94,8 +91,6 @@ - (void)setImControl:(BOOL)enable; - (void)activateIm:(BOOL)enable; - (BOOL)useInlineIm; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - (void)checkImState; -#endif @end diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m index fdc7aaf9b9..54efcb0631 100644 --- a/src/MacVim/MMTextViewHelper.m +++ b/src/MacVim/MMTextViewHelper.m @@ -12,7 +12,7 @@ * * Contains code shared between the different text renderers. Unfortunately it * is not possible to let the text renderers inherit from this class since - * MMTextView needs to inherit from NSTextView whereas MMAtsuiTextView needs to + * MMTextView needs to inherit from NSTextView whereas MMCoreTextView needs to * inherit from NSView. */ @@ -36,24 +36,20 @@ - (MMWindowController *)windowController; - (MMVimController *)vimController; - (void)doKeyDown:(NSString *)key; - (void)doInsertText:(NSString *)text; -- (void)pollImState; - (void)hideMouseCursor; - (void)startDragTimerWithInterval:(NSTimeInterval)t; - (void)dragTimerFired:(NSTimer *)timer; - (void)setCursor; - (NSRect)trackingRect; - (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event; -- (void)sendMarkedText:(NSString *)text position:(int32_t)pos; +- (void)sendMarkedText:(NSString *)text position:(int32_t)pos length:(unsigned)len; - (void)abandonMarkedText; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)sendGestureEvent:(int)gesture flags:(int)flags; -#endif @end -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) static BOOL KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) { @@ -68,7 +64,6 @@ - (void)sendGestureEvent:(int)gesture flags:(int)flags; return [as isEqualToString:bs]; } -#endif @implementation MMTextViewHelper @@ -80,6 +75,11 @@ - (id)init signImages = [[NSMutableDictionary alloc] init]; + useMouseTime = + [[NSUserDefaults standardUserDefaults] boolForKey:MMUseMouseTimeKey]; + if (useMouseTime) + mouseDownTime = [[NSDate date] retain]; + return self; } @@ -91,8 +91,8 @@ - (void)dealloc [markedText release]; markedText = nil; [markedTextAttributes release]; markedTextAttributes = nil; [signImages release]; signImages = nil; + [mouseDownTime release]; mouseDownTime = nil; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if (asciiImSource) { CFRelease(asciiImSource); asciiImSource = NULL; @@ -101,7 +101,6 @@ - (void)dealloc CFRelease(lastImSource); lastImSource = NULL; } -#endif [super dealloc]; } @@ -129,20 +128,6 @@ - (void)keyDown:(NSEvent *)event { ASLogDebug(@"%@", event); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - if (NULL == TISCopyCurrentKeyboardInputSource) { -#endif - - // NOTE: Check IM state _before_ key has been interpreted or we'll pick - // up the old IM state when it has been switched via a keyboard shortcut - // that MacVim cannot handle. - if (imControl) - [self pollImState]; - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - } -#endif - // NOTE: Keyboard handling is complicated by the fact that we must call // interpretKeyEvents: otherwise key equivalents set up by input methods do // not work (e.g. Ctrl-Shift-; would not work under Kotoeri). @@ -173,13 +158,13 @@ - (void)keyDown:(NSEvent *)event // ASCII chars in the range after space (0x20) and before backspace (0x7f). // Note that this implies that 'mmta' (if enabled) breaks input methods // when the Alt key is held. - if ((flags & NSAlternateKeyMask) && [mmta boolValue] && [unmod length] == 1 - && [unmod characterAtIndex:0] > 0x20 - && [unmod characterAtIndex:0] < 0x7f) { + if ((flags & NSEventModifierFlagOption) + && [mmta boolValue] && [unmod length] == 1 + && [unmod characterAtIndex:0] > 0x20) { ASLogDebug(@"MACMETA key, don't interpret it"); string = unmod; - } else if (imState && (flags & NSControlKeyMask) - && !(flags & (NSAlternateKeyMask|NSCommandKeyMask)) + } else if (imState && (flags & NSEventModifierFlagControl) + && !(flags & (NSEventModifierFlagOption|NSEventModifierFlagCommand)) && [unmod length] == 1 && ([unmod characterAtIndex:0] == '6' || [unmod characterAtIndex:0] == '^')) { @@ -187,6 +172,13 @@ - (void)keyDown:(NSEvent *)event // with Ctrl-6 or Ctrl-^ when IM is active. [self doKeyDown:@"\x1e"]; string = nil; +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10) + } else if ([[NSUserDefaults standardUserDefaults] + boolForKey:MMIgnoreShiftSpaceKey] + && (flags & NSShiftKeyMask) && [string isEqualToString:@" "]) { + // HACK! for Yosemite - Fix for Shift+Space inputing + // do nothing +#endif } else { // HACK! interpretKeyEvents: may call insertText: or // doCommandBySelector:, or it may swallow the key (most likely the @@ -196,14 +188,15 @@ - (void)keyDown:(NSEvent *)event [textView interpretKeyEvents:[NSArray arrayWithObject:event]]; if (interpretKeyEventsSwallowedKey) string = nil; - else if (flags & NSCommandKeyMask) { + else if (flags & NSEventModifierFlagCommand) { // HACK! When Command is held we have to more or less guess whether // we should use characters or charactersIgnoringModifiers. The // following heuristic seems to work but it may have to change. // Note that the Shift and Alt flags may also need to be cleared // (see doKeyDown:keyCode:modifiers: in MMBackend). - if ((flags & NSShiftKeyMask && !(flags & NSAlternateKeyMask)) - || flags & NSControlKeyMask) + if ((flags & NSEventModifierFlagShift + && !(flags & NSEventModifierFlagOption)) + || flags & NSEventModifierFlagControl) string = unmod; } } @@ -218,7 +211,7 @@ - (void)keyDown:(NSEvent *)event - (void)insertText:(id)string { if ([self hasMarkedText]) { - [self sendMarkedText:nil position:0]; + [self sendMarkedText:nil position:0 length:0]; // NOTE: If this call is left out then the marked text isn't properly // erased when Return is used to accept the text. @@ -292,62 +285,48 @@ - (void)doCommandBySelector:(SEL)sel else interpretKeyEventsSwallowedKey = NO; } -- (BOOL)performKeyEquivalent:(NSEvent *)event +- (void)scrollWheel:(NSEvent *)event { - ASLogDebug(@""); - if ([event type] != NSKeyDown) - return NO; - - // NOTE: Key equivalent handling was fixed in Leopard. That is, an - // unhandled key equivalent is passed to keyDown: -- contrast this with - // pre-Leopard where unhandled key equivalents would simply disappear - // (hence the ugly hack below for Tiger). - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) - return NO; - - // HACK! KeyCode 50 represent the key which switches between windows - // within an application (like Cmd+Tab is used to switch between - // applications). Return NO here, else the window switching does not work. - if ([event keyCode] == 50) - return NO; - - // HACK! The -[NSRespoder cancelOperation:] indicates that Cmd-. is handled - // in a special way by the key window. Indeed, if we pass this event on to - // keyDown: it will result in doCommandBySelector: being called with - // cancelOperation: as selector, otherwise it is called with cancel: as the - // selector (and we respond to cancel: there). - int flags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask; - NSString *unmod = [event charactersIgnoringModifiers]; - if (flags == NSCommandKeyMask && [unmod isEqual:@"."]) - return NO; - - // HACK! Let the main menu try to handle any key down event, before - // passing it on to vim, otherwise key equivalents for menus will - // effectively be disabled. - if ([[NSApp mainMenu] performKeyEquivalent:event]) - return YES; + float dx = 0; + float dy = 0; + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 + if ([event hasPreciseScrollingDeltas]) { + NSSize cellSize = [textView cellSize]; + float thresholdX = cellSize.width; + float thresholdY = cellSize.height; + scrollingDeltaX += [event scrollingDeltaX]; + if (fabs(scrollingDeltaX) > thresholdX) { + dx = roundf(scrollingDeltaX / thresholdX); + scrollingDeltaX -= thresholdX * dx; + } + scrollingDeltaY += [event scrollingDeltaY]; + if (fabs(scrollingDeltaY) > thresholdY) { + dy = roundf(scrollingDeltaY / thresholdY); + scrollingDeltaY -= thresholdY * dy; + } + } else { + scrollingDeltaX = 0; + scrollingDeltaY = 0; + dx = [event scrollingDeltaX]; + dy = [event scrollingDeltaY]; + } +#else + dx = [event deltaX]; + dy = [event deltaY]; +#endif - // HACK! Pass the event on or it may disappear (Tiger does not pass Cmd-key - // events to keyDown:). - [self keyDown:event]; - return YES; -} + if (dx == 0 && dy == 0) + return; -- (void)scrollWheel:(NSEvent *)event -{ if ([self hasMarkedText]) { // We must clear the marked text since the cursor may move if the // marked text moves outside the view as a result of scrolling. - [self sendMarkedText:nil position:0]; + [self sendMarkedText:nil position:0 length:0]; [self unmarkText]; - [[NSInputManager currentInputManager] markedTextAbandoned:self]; + [[NSTextInputContext currentInputContext] discardMarkedText]; } - float dx = [event deltaX]; - float dy = [event deltaY]; - if (dx == 0 && dy == 0) - return; - int row, col; NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil]; if ([textView convertPoint:pt toRow:&row column:&col]) { @@ -376,25 +355,39 @@ - (void)mouseDown:(NSEvent *)event int button = [event buttonNumber]; int flags = [event modifierFlags]; - int count = [event clickCount]; + int repeat = 0; + + if (useMouseTime) { + // Use Vim mouseTime option to handle multiple mouse down events + NSDate *now = [[NSDate date] retain]; + id mouset = [[[self vimController] vimState] objectForKey:@"p_mouset"]; + NSTimeInterval interval = + [now timeIntervalSinceDate:mouseDownTime] * 1000.0; + if (interval < (NSTimeInterval)[mouset longValue]) + repeat = 1; + mouseDownTime = now; + } else { + repeat = [event clickCount] > 1; + } + NSMutableData *data = [NSMutableData data]; // If desired, intepret Ctrl-Click as a right mouse click. BOOL translateCtrlClick = [[NSUserDefaults standardUserDefaults] boolForKey:MMTranslateCtrlClickKey]; - flags = flags & NSDeviceIndependentModifierFlagsMask; + flags = flags & NSEventModifierFlagDeviceIndependentFlagsMask; if (translateCtrlClick && button == 0 && - (flags == NSControlKeyMask || - flags == (NSControlKeyMask|NSAlphaShiftKeyMask))) { + (flags == NSEventModifierFlagControl || flags == + (NSEventModifierFlagControl|NSEventModifierFlagCapsLock))) { button = 1; - flags &= ~NSControlKeyMask; + flags &= ~NSEventModifierFlagControl; } [data appendBytes:&row length:sizeof(int)]; [data appendBytes:&col length:sizeof(int)]; [data appendBytes:&button length:sizeof(int)]; [data appendBytes:&flags length:sizeof(int)]; - [data appendBytes:&count length:sizeof(int)]; + [data appendBytes:&repeat length:sizeof(int)]; [[self vimController] sendMessage:MouseDownMsgID data:data]; } @@ -477,7 +470,6 @@ - (void)mouseMoved:(NSEvent *)event [[self vimController] sendMessage:MouseMovedMsgID data:data]; } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)swipeWithEvent:(NSEvent *)event { CGFloat dx = [event deltaX]; @@ -491,7 +483,6 @@ - (void)swipeWithEvent:(NSEvent *)event [self sendGestureEvent:type flags:[event modifierFlags]]; } -#endif - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender { @@ -641,7 +632,7 @@ - (void)setMarkedText:(id)text selectedRange:(NSRange)range imRange = range; } - [self sendMarkedText:text position:range.location]; + [self sendMarkedText:text position:range.location length:range.length]; return; } @@ -773,7 +764,11 @@ - (NSRect)firstRectForCharacterRange:(NSRange)range rect.origin.y += rect.size.height; rect.origin = [textView convertPoint:rect.origin toView:nil]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 + rect = [[textView window] convertRectToScreen:rect]; +#else rect.origin = [[textView window] convertBaseToScreen:rect.origin]; +#endif return rect; } @@ -782,31 +777,24 @@ - (void)setImControl:(BOOL)enable { // This flag corresponds to the (negation of the) 'imd' option. When // enabled changes to the input method are detected and forwarded to the - // backend. On >=10.5 and later we do not forward changes to the input - // method, instead we let Vim be in complete control. - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - // The TIS symbols are weakly linked. - if (NULL != TISCopyCurrentKeyboardInputSource) { - // We get here when compiled on >=10.5 and running on >=10.5. + // backend. We do not forward changes to the input method, instead we let + // Vim be in complete control. - if (asciiImSource) { - CFRelease(asciiImSource); - asciiImSource = NULL; - } - if (lastImSource) { - CFRelease(lastImSource); - lastImSource = NULL; - } - if (enable) { - // Save current locale input source for use when IM is active and - // get an ASCII source for use when IM is deactivated (by Vim). - asciiImSource = TISCopyCurrentASCIICapableKeyboardInputSource(); - NSString *locale = [[NSLocale currentLocale] localeIdentifier]; - lastImSource = TISCopyInputSourceForLanguage((CFStringRef)locale); - } + if (asciiImSource) { + CFRelease(asciiImSource); + asciiImSource = NULL; + } + if (lastImSource) { + CFRelease(lastImSource); + lastImSource = NULL; + } + if (enable) { + // Save current locale input source for use when IM is active and + // get an ASCII source for use when IM is deactivated (by Vim). + asciiImSource = TISCopyCurrentASCIICapableKeyboardInputSource(); + NSString *locale = [[NSLocale currentLocale] localeIdentifier]; + lastImSource = TISCopyInputSourceForLanguage((CFStringRef)locale); } -#endif imControl = enable; ASLogDebug(@"IM control %sabled", enable ? "en" : "dis"); @@ -822,31 +810,14 @@ - (void)activateIm:(BOOL)enable imState = enable; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - // The TIS symbols are weakly linked. - if (NULL != TISCopyCurrentKeyboardInputSource) { - // We get here when compiled on >=10.5 and running on >=10.5. - - // Enable IM: switch back to input source used when IM was last on - // Disable IM: switch back to ASCII input source (set in setImControl:) - TISInputSourceRef ref = enable ? lastImSource : asciiImSource; - if (ref) { - ASLogDebug(@"Change input source: %@", - TISGetInputSourceProperty(ref, kTISPropertyInputSourceID)); - TISSelectInputSource(ref); - } - - return; + // Enable IM: switch back to input source used when IM was last on + // Disable IM: switch back to ASCII input source (set in setImControl:) + TISInputSourceRef ref = enable ? lastImSource : asciiImSource; + if (ref) { + ASLogDebug(@"Change input source: %@", + TISGetInputSourceProperty(ref, kTISPropertyInputSourceID)); + TISSelectInputSource(ref); } - - // We get here when compiled on >=10.5 but running on 10.4 -- fall through - // and use old IM code... -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) - // NOTE: The IM code is delegated to the frontend since calling it in - // the backend caused weird bugs (second dock icon appearing etc.). - KeyScript(enable ? smKeySysScript : smKeyRoman); -#endif } - (BOOL)useInlineIm @@ -861,9 +832,7 @@ - (BOOL)useInlineIm - (void)checkImState { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - if (imControl && NULL != TISCopyCurrentKeyboardInputSource) { - // We get here when compiled on >=10.5 and running on >=10.5. + if (imControl) { TISInputSourceRef cur = TISCopyCurrentKeyboardInputSource(); BOOL state = !KeyboardInputSourcesEqual(asciiImSource, cur); BOOL isChanged = !KeyboardInputSourcesEqual(lastImSource, cur); @@ -884,7 +853,6 @@ - (void)checkImState } return; } -#endif } @end // MMTextViewHelper @@ -921,7 +889,7 @@ - (void)doKeyDown:(NSString *)key // The low 16 bits are not used for modifier flags by NSEvent. Use // these bits for custom flags. - flags &= NSDeviceIndependentModifierFlagsMask; + flags &= NSEventModifierFlagDeviceIndependentFlagsMask; if ([currentEvent isARepeat]) flags |= 1; @@ -954,9 +922,12 @@ - (void)doInsertText:(NSString *)text // HACK! Keys on the numeric key pad are treated as special keys by Vim // so we need to pass on key code and modifier flags in this situation. unsigned mods = [currentEvent modifierFlags]; - if (mods & NSNumericPadKeyMask) { - flags = mods & NSDeviceIndependentModifierFlagsMask; + if (mods & NSEventModifierFlagNumericPad) { + flags = mods & NSEventModifierFlagDeviceIndependentFlagsMask; keyCode = [currentEvent keyCode]; + // HACK! ATOK sends Cursor-Down key. + if (imState && keyCode == 0x7d) + keyCode = 0; } if ([currentEvent isARepeat]) @@ -972,28 +943,6 @@ - (void)doInsertText:(NSString *)text [[self vimController] sendMessage:KeyDownMsgID data:data]; } -- (void)pollImState -{ -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) - // Compiled for <=10.4, running on 10.4 - - // IM is active whenever the current script is the system script and the - // system script isn't roman. (Hence IM can only be active when using - // non-roman scripts.) - - // NOTE: The IM code is delegated to the frontend since calling it in the - // backend caused weird bugs (second dock icon appearing etc.). - SInt32 currentScript = GetScriptManagerVariable(smKeyScript); - SInt32 systemScript = GetScriptManagerVariable(smSysScript); - BOOL state = currentScript != smRoman && currentScript == systemScript; - if (imState != state) { - imState = state; - int msgid = state ? ActivatedImMsgID : DeactivatedImMsgID; - [[self vimController] sendMessage:msgid data:nil]; - } -#endif -} - - (void)hideMouseCursor { // Check 'mousehide' option @@ -1117,27 +1066,26 @@ - (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event // the Kotoeri manager "commits" the text on left clicks). if (event) { - NSInputManager *imgr = [NSInputManager currentInputManager]; - if ([imgr wantsToHandleMouseEvents]) - return [imgr handleMouseEvent:event]; + return [[NSTextInputContext currentInputContext] handleEvent:event]; } return NO; } -- (void)sendMarkedText:(NSString *)text position:(int32_t)pos +- (void)sendMarkedText:(NSString *)text position:(int32_t)pos length:(unsigned)len { if (![self useInlineIm]) return; NSMutableData *data = [NSMutableData data]; - unsigned len = text == nil ? 0 + unsigned textlen = text == nil ? 0 : [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + [data appendBytes:&textlen length:sizeof(unsigned)]; [data appendBytes:&pos length:sizeof(int32_t)]; [data appendBytes:&len length:sizeof(unsigned)]; - if (len > 0) { - [data appendBytes:[text UTF8String] length:len]; + if (textlen > 0) { + [data appendBytes:[text UTF8String] length:textlen]; [data appendBytes:"\x00" length:1]; } @@ -1151,11 +1099,10 @@ - (void)abandonMarkedText // Send an empty marked text message with position set to -1 to indicate // that the marked text should be abandoned. (If pos is set to 0 Vim will // send backspace sequences to delete the old marked text.) - [self sendMarkedText:nil position:-1]; - [[NSInputManager currentInputManager] markedTextAbandoned:self]; + [self sendMarkedText:nil position:-1 length:0]; + [[NSTextInputContext currentInputContext] discardMarkedText]; } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - (void)sendGestureEvent:(int)gesture flags:(int)flags { NSMutableData *data = [NSMutableData data]; @@ -1165,6 +1112,5 @@ - (void)sendGestureEvent:(int)gesture flags:(int)flags [[self vimController] sendMessage:GestureMsgID data:data]; } -#endif @end // MMTextViewHelper (Private) diff --git a/src/MacVim/MMVimController.h b/src/MacVim/MMVimController.h index 07421b0448..cb5665ccf7 100644 --- a/src/MacVim/MMVimController.h +++ b/src/MacVim/MMVimController.h @@ -15,11 +15,8 @@ -@interface MMVimController : NSObject -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - // 10.6 has turned delegate messages into formal protocols - <NSToolbarDelegate, NSOpenSavePanelDelegate> -#endif +@interface MMVimController : NSObject<NSToolbarDelegate, + NSOpenSavePanelDelegate> { unsigned identifier; BOOL isInitialized; diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 8e01088b6a..8a772cddca 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -70,6 +70,8 @@ @interface MMAlert : NSAlert { } - (void)setTextFieldString:(NSString *)textFieldString; - (NSTextField *)textField; +- (void)beginSheetModalForWindow:(NSWindow *)window + modalDelegate:(id)delegate; @end @@ -552,15 +554,9 @@ - (void)handleMessage:(int)msgid data:(NSData *)data { if (OpenWindowMsgID == msgid) { [windowController openWindow]; - - // HACK: Delay actually presenting the window onscreen until after - // processing the queue since it contains drawing commands that need to - // be issued before presentation; otherwise the window may flash white - // just as it opens. - if (!isPreloading) - [windowController performSelector:@selector(presentWindow:) - withObject:nil - afterDelay:0]; + if (!isPreloading) { + [windowController presentWindow:nil]; + } } else if (BatchDrawMsgID == msgid) { [[[windowController vimView] textView] performBatchDrawWithData:data]; } else if (SelectTabMsgID == msgid) { @@ -573,8 +569,10 @@ - (void)handleMessage:(int)msgid data:(NSData *)data [windowController updateTabsWithData:data]; } else if (ShowTabBarMsgID == msgid) { [windowController showTabBar:YES]; + [self sendMessage:BackingPropertiesChangedMsgID data:nil]; } else if (HideTabBarMsgID == msgid) { [windowController showTabBar:NO]; + [self sendMessage:BackingPropertiesChangedMsgID data:nil]; } else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid || SetTextDimensionsReplyMsgID == msgid) { const void *bytes = [data bytes]; @@ -758,6 +756,11 @@ - (void)handleMessage:(int)msgid data:(NSData *)data int linespace = *((int*)bytes); [windowController adjustLinespace:linespace]; + } else if (AdjustColumnspaceMsgID == msgid) { + const void *bytes = [data bytes]; + int columnspace = *((int*)bytes); + + [windowController adjustColumnspace:columnspace]; } else if (ActivateMsgID == msgid) { [NSApp activateIgnoringOtherApps:YES]; [[windowController window] makeKeyAndOrderFront:self]; @@ -798,6 +801,18 @@ - (void)handleMessage:(int)msgid data:(NSData *)data [[[windowController vimView] textView] setAntialias:YES]; } else if (DisableAntialiasMsgID == msgid) { [[[windowController vimView] textView] setAntialias:NO]; + } else if (EnableLigaturesMsgID == msgid) { + [[[windowController vimView] textView] setLigatures:YES]; + } else if (DisableLigaturesMsgID == msgid) { + [[[windowController vimView] textView] setLigatures:NO]; + } else if (EnableThinStrokesMsgID == msgid) { + [[[windowController vimView] textView] setThinStrokes:YES]; + } else if (DisableThinStrokesMsgID == msgid) { + [[[windowController vimView] textView] setThinStrokes:NO]; + } else if (EnableProportionalFontMsgID == msgid) { + [[[windowController vimView] textView] setProportionalFont:YES]; + } else if (DisableProportionalFontMsgID == msgid) { + [[[windowController vimView] textView] setProportionalFont:NO]; } else if (SetVimStateMsgID == msgid) { NSDictionary *dict = [NSDictionary dictionaryWithData:data]; if (dict) { @@ -831,9 +846,11 @@ - (void)handleMessage:(int)msgid data:(NSData *)data if (dict) [self handleBrowseForFile:dict]; } else if (ShowDialogMsgID == msgid) { - NSDictionary *dict = [NSDictionary dictionaryWithData:data]; - if (dict) - [self handleShowDialog:dict]; + [windowController runAfterWindowPresentedUsingBlock:^{ + NSDictionary *dict = [NSDictionary dictionaryWithData:data]; + if (dict) + [self handleShowDialog:dict]; + }]; } else if (DeleteSignMsgID == msgid) { NSDictionary *dict = [NSDictionary dictionaryWithData:data]; if (dict) @@ -876,6 +893,10 @@ - (void)handleMessage:(int)msgid data:(NSData *)data if (filenames) [[NSDocumentController sharedDocumentController] noteNewRecentFilePaths:filenames]; + } else if (SetBlurRadiusMsgID == msgid) { + const void *bytes = [data bytes]; + int radius = *((int*)bytes); + [windowController setBlurRadius:radius]; // IMPORTANT: When adding a new message, make sure to update // isUnsafeMessage() if necessary! @@ -888,7 +909,11 @@ - (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code context:(void *)context { NSString *path = nil; +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) + if (code == NSModalResponseOK) { +#else if (code == NSOKButton) { +#endif NSURL *url = [panel URL]; if ([url isFileURL]) path = [url path]; @@ -1306,7 +1331,7 @@ - (void)popupMenuWithDescriptor:(NSArray *)desc pt = [[windowController window] mouseLocationOutsideOfEventStream]; } - NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown + NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeRightMouseDown location:pt modifierFlags:0 timestamp:0 @@ -1385,11 +1410,8 @@ - (void)handleBrowseForFile:(NSDictionary *)attr dir = [vimState objectForKey:@"pwd"]; } -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) - // 10.6+ APIs uses URLs instead of paths dir = [dir stringByExpandingTildeInPath]; NSURL *dirURL = dir ? [NSURL fileURLWithPath:dir isDirectory:YES] : nil; -#endif if (saving) { NSSavePanel *panel = [NSSavePanel savePanel]; @@ -1400,10 +1422,6 @@ - (void)handleBrowseForFile:(NSDictionary *)attr [panel setDelegate:self]; if ([panel isExpanded]) [panel setAccessoryView:showHiddenFilesView()]; -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) - // NOTE: -[NSSavePanel beginSheetForDirectory::::::] is deprecated on - // 10.6 but -[NSSavePanel setDirectoryURL:] requires 10.6 so jump - // through the following hoops on 10.6+. if (dirURL) [panel setDirectoryURL:dirURL]; @@ -1411,13 +1429,6 @@ - (void)handleBrowseForFile:(NSDictionary *)attr completionHandler:^(NSInteger result) { [self savePanelDidEnd:panel code:result context:nil]; }]; -#else - [panel beginSheetForDirectory:dir file:nil - modalForWindow:[windowController window] - modalDelegate:self - didEndSelector:@selector(savePanelDidEnd:code:context:) - contextInfo:NULL]; -#endif } else { NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setAllowsMultipleSelection:NO]; @@ -1428,10 +1439,6 @@ - (void)handleBrowseForFile:(NSDictionary *)attr [panel setCanChooseFiles:NO]; } -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) - // NOTE: -[NSOpenPanel beginSheetForDirectory:::::::] is deprecated on - // 10.6 but -[NSOpenPanel setDirectoryURL:] requires 10.6 so jump - // through the following hoops on 10.6+. if (dirURL) [panel setDirectoryURL:dirURL]; @@ -1439,13 +1446,6 @@ - (void)handleBrowseForFile:(NSDictionary *)attr completionHandler:^(NSInteger result) { [self savePanelDidEnd:panel code:result context:nil]; }]; -#else - [panel beginSheetForDirectory:dir file:nil types:nil - modalForWindow:[windowController window] - modalDelegate:self - didEndSelector:@selector(savePanelDidEnd:code:context:) - contextInfo:NULL]; -#endif } } @@ -1516,9 +1516,7 @@ - (void)handleShowDialog:(NSDictionary *)attr } [alert beginSheetModalForWindow:[windowController window] - modalDelegate:self - didEndSelector:@selector(alertDidEnd:code:context:) - contextInfo:NULL]; + modalDelegate:self]; [alert release]; } @@ -1585,13 +1583,19 @@ - (void)setInformativeText:(NSString *)text - (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate - didEndSelector:(SEL)didEndSelector - contextInfo:(void *)contextInfo { + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 + [super beginSheetModalForWindow:window + completionHandler:^(NSModalResponse code) { + [delegate alertDidEnd:self code:code context:NULL]; + }]; +#else [super beginSheetModalForWindow:window modalDelegate:delegate - didEndSelector:didEndSelector - contextInfo:contextInfo]; + didEndSelector:@selector(alertDidEnd:code:context:) + contextInfo:NULL]; +#endif // HACK! Place the input text field at the bottom of the informative text // (which has been made a bit larger by adding newline characters). diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index f2fb979f7c..fd04c47e5b 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -18,13 +18,8 @@ * the view is filled by the text view. */ -#import "Miscellaneous.h" // Defines MM_ENABLE_ATSUI - -#if MM_ENABLE_ATSUI -# import "MMAtsuiTextView.h" -#else -# import "MMCoreTextView.h" -#endif +#import "Miscellaneous.h" +#import "MMCoreTextView.h" #import "MMTextView.h" #import "MMVimController.h" #import "MMVimView.h" @@ -97,20 +92,11 @@ - (MMVimView *)initWithFrame:(NSRect)frame NSInteger renderer = [ud integerForKey:MMRendererKey]; ASLogInfo(@"Use renderer=%ld", renderer); -#if MM_ENABLE_ATSUI - if (MMRendererATSUI == renderer) { - // HACK! 'textView' has type MMTextView, but MMAtsuiTextView is not - // derived from MMTextView. - textView = [[MMAtsuiTextView alloc] initWithFrame:frame]; - } -#else if (MMRendererCoreText == renderer) { // HACK! 'textView' has type MMTextView, but MMCoreTextView is not // derived from MMTextView. textView = (MMTextView *)[[MMCoreTextView alloc] initWithFrame:frame]; - } -#endif - else { + } else { // Use Cocoa text system for text rendering. textView = [[MMTextView alloc] initWithFrame:frame]; } @@ -129,8 +115,8 @@ - (MMVimView *)initWithFrame:(NSRect)frame // Create the tab bar control (which is responsible for actually // drawing the tabline and tabs). - NSRect tabFrame = { { 0, frame.size.height - 22 }, - { frame.size.width, 22 } }; + NSRect tabFrame = { { 0, frame.size.height - kPSMTabBarControlHeight }, + { frame.size.width, kPSMTabBarControlHeight } }; tabBarControl = [[PSMTabBarControl alloc] initWithFrame:tabFrame]; [tabView setDelegate:tabBarControl]; @@ -139,10 +125,25 @@ - (MMVimView *)initWithFrame:(NSRect)frame [tabBarControl setDelegate:self]; [tabBarControl setHidden:YES]; - [tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]]; - [tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]]; - [tabBarControl setCellOptimumWidth: + if (shouldUseYosemiteTabBarStyle()) { + CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width; + int tabMaxWidth = [ud integerForKey:MMTabMaxWidthKey]; + if (tabMaxWidth == 0) + tabMaxWidth = screenWidth; + int tabOptimumWidth = [ud integerForKey:MMTabOptimumWidthKey]; + if (tabOptimumWidth == 0) + tabOptimumWidth = screenWidth; + + [tabBarControl setStyleNamed:@"Yosemite"]; + [tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]]; + [tabBarControl setCellMaxWidth:tabMaxWidth]; + [tabBarControl setCellOptimumWidth:tabOptimumWidth]; + } else { + [tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]]; + [tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]]; + [tabBarControl setCellOptimumWidth: [ud integerForKey:MMTabOptimumWidthKey]]; + } [tabBarControl setShowAddTabButton:[ud boolForKey:MMShowAddTabButtonKey]]; [[tabBarControl addTabButton] setTarget:self]; @@ -175,7 +176,7 @@ - (void)dealloc // HACK! The text storage is the principal owner of the text system, but we // keep only a reference to the text view, so release the text storage - // first (unless we are using the ATSUI renderer). + // first (unless we are using the CoreText renderer). if ([textView isKindOfClass:[MMTextView class]]) [[textView textStorage] release]; @@ -196,10 +197,14 @@ - (void)drawRect:(NSRect)rect // weird behind the window resize throbber, so emulate the look of an // NSScrollView in the bottom right corner. if (![[self window] showsResizeIndicator] // XXX: make this a flag - || !([[self window] styleMask] & NSTexturedBackgroundWindowMask)) + || !([[self window] styleMask] & NSWindowStyleMaskTexturedBackground)) return; +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) + int sw = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; +#else int sw = [NSScroller scrollerWidth]; +#endif // add .5 to the pixel locations to put the lines on a pixel boundary. // the top and right edges of the rect will be outside of the bounds rect @@ -392,7 +397,10 @@ - (NSTabViewItem *)addNewTabViewItem // which tab should be selected at all times. However, the AppKit will // automatically select the first tab added to a tab view. - NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:nil]; + // The documentation claims initWithIdentifier can be given a nil identifier, but the API itself + // is decorated such that doing so produces a warning, so the tab count is used as identifier. + NSInteger identifier = [[self tabView] numberOfTabViewItems]; + NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:[NSNumber numberWithInt:identifier]]; // NOTE: If this is the first tab it will be automatically selected. vimTaskSelectedTab = YES; @@ -447,12 +455,8 @@ - (void)setScrollbarThumbValue:(float)val proportion:(float)prop identifier:(int32_t)ident { MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL]; -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) [scroller setDoubleValue:val]; [scroller setKnobProportion:prop]; -#else - [scroller setFloatValue:val knobProportion:prop]; -#endif [scroller setEnabled:prop != 1.f]; } @@ -699,11 +703,16 @@ - (void)placeScrollbars continue; NSRect rect; +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; +#else + CGFloat scrollerWidth = [NSScroller scrollerWidth]; +#endif if ([scroller type] == MMScrollerTypeBottom) { rect = [textView rectForColumnsInRange:[scroller range]]; - rect.size.height = [NSScroller scrollerWidth]; + rect.size.height = scrollerWidth; if (leftSbVisible) - rect.origin.x += [NSScroller scrollerWidth]; + rect.origin.x += scrollerWidth; // HACK! Make sure the horizontal scrollbar covers the text view // all the way to the right, otherwise it looks ugly when the user @@ -722,7 +731,7 @@ - (void)placeScrollbars if (NSMaxX(rect) > NSMaxX(textViewFrame)) rect.size.width -= NSMaxX(rect) - NSMaxX(textViewFrame); if (!rightSbVisible) - rect.size.width -= [NSScroller scrollerWidth]; + rect.size.width -= scrollerWidth; if (rect.size.width < 0) rect.size.width = 0; } else { @@ -730,7 +739,7 @@ - (void)placeScrollbars // Adjust for the fact that text layout is flipped. rect.origin.y = NSMaxY(textViewFrame) - rect.origin.y - rect.size.height; - rect.size.width = [NSScroller scrollerWidth]; + rect.size.width = scrollerWidth; if ([scroller type] == MMScrollerTypeRight) rect.origin.x = NSMaxX(textViewFrame); @@ -752,9 +761,9 @@ - (void)placeScrollbars // Vertical scrollers must not cover the resize box in the // bottom-right corner of the window. if ([[self window] showsResizeIndicator] // XXX: make this a flag - && rect.origin.y < [NSScroller scrollerWidth]) { - rect.size.height -= [NSScroller scrollerWidth] - rect.origin.y; - rect.origin.y = [NSScroller scrollerWidth]; + && rect.origin.y < scrollerWidth) { + rect.size.height -= scrollerWidth - rect.origin.y; + rect.origin.y = scrollerWidth; } // Make sure scrollbar rect is bounded by the text view frame. @@ -808,16 +817,21 @@ - (MMScroller *)scrollbarForIdentifier:(int32_t)ident index:(unsigned *)idx - (NSSize)vimViewSizeForTextViewSize:(NSSize)textViewSize { NSSize size = textViewSize; +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; +#else + CGFloat scrollerWidth = [NSScroller scrollerWidth]; +#endif if (![[self tabBarControl] isHidden]) size.height += [[self tabBarControl] frame].size.height; if ([self bottomScrollbarVisible]) - size.height += [NSScroller scrollerWidth]; + size.height += scrollerWidth; if ([self leftScrollbarVisible]) - size.width += [NSScroller scrollerWidth]; + size.width += scrollerWidth; if ([self rightScrollbarVisible]) - size.width += [NSScroller scrollerWidth]; + size.width += scrollerWidth; return size; } @@ -825,20 +839,25 @@ - (NSSize)vimViewSizeForTextViewSize:(NSSize)textViewSize - (NSRect)textViewRectForVimViewSize:(NSSize)contentSize { NSRect rect = { {0, 0}, {contentSize.width, contentSize.height} }; +#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; +#else + CGFloat scrollerWidth = [NSScroller scrollerWidth]; +#endif if (![[self tabBarControl] isHidden]) rect.size.height -= [[self tabBarControl] frame].size.height; if ([self bottomScrollbarVisible]) { - rect.size.height -= [NSScroller scrollerWidth]; - rect.origin.y += [NSScroller scrollerWidth]; + rect.size.height -= scrollerWidth; + rect.origin.y += scrollerWidth; } if ([self leftScrollbarVisible]) { - rect.size.width -= [NSScroller scrollerWidth]; - rect.origin.x += [NSScroller scrollerWidth]; + rect.size.width -= scrollerWidth; + rect.origin.x += scrollerWidth; } if ([self rightScrollbarVisible]) - rect.size.width -= [NSScroller scrollerWidth]; + rect.size.width -= scrollerWidth; return rect; } @@ -890,7 +909,7 @@ - (void)frameSizeMayHaveChanged "%dx%d (%s)", cols, rows, constrained[1], constrained[0], MessageStrings[msgid]); - [vimController sendMessage:msgid data:data]; + [vimController sendMessageNow:msgid data:data timeout:1]; // We only want to set the window title if this resize came from // a live-resize, not (for example) setting 'columns' or 'lines'. diff --git a/src/MacVim/MMWindow.h b/src/MacVim/MMWindow.h index 385a40ea33..9eb7be1cba 100644 --- a/src/MacVim/MMWindow.h +++ b/src/MacVim/MMWindow.h @@ -28,6 +28,7 @@ - (void)setContentMinSize:(NSSize)size; - (void)setContentMaxSize:(NSSize)size; - (void)setContentSize:(NSSize)size; +- (void)setBlurRadius:(int)radius; - (IBAction)toggleFullScreen:(id)sender; - (IBAction)realToggleFullScreen:(id)sender; diff --git a/src/MacVim/MMWindow.m b/src/MacVim/MMWindow.m index 1440f0a8fd..5fa0a02e4d 100644 --- a/src/MacVim/MMWindow.m +++ b/src/MacVim/MMWindow.m @@ -29,7 +29,35 @@ #import "MMWindow.h" #import "Miscellaneous.h" +#import "CGSInternal/CGSWindow.h" + +typedef CGError CGSSetWindowBackgroundBlurRadiusFunction(CGSConnectionID cid, CGSWindowID wid, NSUInteger blur); + +static void *GetFunctionByName(NSString *library, char *func) { + CFBundleRef bundle; + CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef) library, kCFURLPOSIXPathStyle, true); + CFStringRef functionName = CFStringCreateWithCString(kCFAllocatorDefault, func, kCFStringEncodingASCII); + bundle = CFBundleCreate(kCFAllocatorDefault, bundleURL); + void *f = NULL; + if (bundle) { + f = CFBundleGetFunctionPointerForName(bundle, functionName); + CFRelease(bundle); + } + CFRelease(functionName); + CFRelease(bundleURL); + return f; +} +static CGSSetWindowBackgroundBlurRadiusFunction* GetCGSSetWindowBackgroundBlurRadiusFunction(void) { + static BOOL tried = NO; + static CGSSetWindowBackgroundBlurRadiusFunction *function = NULL; + if (!tried) { + function = GetFunctionByName(@"/System/Library/Frameworks/ApplicationServices.framework", + "CGSSetWindowBackgroundBlurRadius"); + tried = YES; + } + return function; +} @implementation MMWindow @@ -74,6 +102,14 @@ - (void)dealloc [super dealloc]; } +- (BOOL) canBecomeMainWindow { + return YES; +} + +- (BOOL) canBecomeKeyWindow { + return YES; +} + - (BOOL)hideTablineSeparator:(BOOL)hide { BOOL isHidden = [tablineSeparator isHidden]; @@ -125,6 +161,20 @@ - (void)setContentSize:(NSSize)size [super setContentSize:size]; } +- (void)setBlurRadius:(int)radius +{ + if (radius >= 0) { + CGSConnectionID con = CGSMainConnectionID(); + if (!con) { + return; + } + CGSSetWindowBackgroundBlurRadiusFunction* function = GetCGSSetWindowBackgroundBlurRadiusFunction(); + if (function) { + function(con, [self windowNumber], radius); + } + } +} + - (void)performClose:(id)sender { id wc = [self windowController]; @@ -175,4 +225,15 @@ - (IBAction)realToggleFullScreen:(id)sender #endif } +- (void)setToolbar:(NSToolbar *)toolbar +{ + if ([[NSUserDefaults standardUserDefaults] + boolForKey:MMNoTitleBarWindowKey]) { + // MacVim can't have toolbar with No title bar setting. + return; + } + + [super setToolbar:toolbar]; +} + @end // MMWindow diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index a9603031bf..8c92ed537d 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -17,11 +17,7 @@ @class MMVimController; @class MMVimView; -@interface MMWindowController : NSWindowController -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - // 10.6 has turned delegate messages into formal protocols - <NSWindowDelegate> -#endif +@interface MMWindowController : NSWindowController<NSWindowDelegate> { MMVimController *vimController; MMVimView *vimView; @@ -44,7 +40,11 @@ int userCols; NSPoint userTopLeft; NSPoint defaultTopLeft; + NSSize desiredWindowSize; NSToolbar *toolbar; + BOOL resizingDueToMove; + int blurRadius; + NSMutableArray *afterWindowPresentedQueue; } - (id)initWithVimController:(MMVimController *)controller; @@ -55,6 +55,7 @@ - (void)cleanup; - (void)openWindow; - (BOOL)presentWindow:(id)unused; +- (void)moveWindowAcrossScreens:(NSPoint)origin; - (void)updateTabsWithData:(NSData *)data; - (void)selectTabWithIndex:(int)idx; - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live @@ -77,9 +78,12 @@ - (void)showToolbar:(BOOL)on size:(int)size mode:(int)mode; - (void)setMouseShape:(int)shape; - (void)adjustLinespace:(int)linespace; +- (void)adjustColumnspace:(int)columnspace; - (void)liveResizeWillStart; - (void)liveResizeDidEnd; +- (void)setBlurRadius:(int)radius; + - (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back; - (void)leaveFullScreen; - (void)setFullScreenBackgroundColor:(NSColor *)back; @@ -88,6 +92,7 @@ - (void)setBufferModified:(BOOL)mod; - (void)setTopLeft:(NSPoint)pt; - (BOOL)getDefaultTopLeft:(NSPoint*)pt; +- (void)runAfterWindowPresentedUsingBlock:(void (^)(void))block; - (IBAction)addNewTab:(id)sender; - (IBAction)toggleToolbar:(id)sender; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index b6c6786bf1..5f7ddbf30a 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -62,7 +62,6 @@ */ #import "MMAppController.h" -#import "MMAtsuiTextView.h" #import "MMFindReplaceController.h" #import "MMFullScreenWindow.h" #import "MMTextView.h" @@ -81,7 +80,6 @@ #define FUOPT_BGCOLOR_HLGROUP 0x004 - @interface MMWindowController (Private) - (NSSize)contentSize; - (void)resizeWindowToFitContentSize:(NSSize)contentSize @@ -98,6 +96,9 @@ - (void)updateToolbar; - (BOOL)maximizeWindow:(int)options; - (void)applicationDidChangeScreenParameters:(NSNotification *)notification; - (void)enterNativeFullScreen; +- (void)processAfterWindowPresentedQueue; ++ (NSString *)tabBarStyleForUnified; ++ (NSString *)tabBarStyleForMetal; @end @@ -126,15 +127,16 @@ @implementation MMWindowController - (id)initWithVimController:(MMVimController *)controller { - unsigned styleMask = NSTitledWindowMask | NSClosableWindowMask - | NSMiniaturizableWindowMask | NSResizableWindowMask - | NSUnifiedTitleAndToolbarWindowMask; + unsigned styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable + | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable + | NSWindowStyleMaskUnifiedTitleAndToolbar + | NSWindowStyleMaskTexturedBackground; - // Use textured background on Leopard or later (skip the 'if' on Tiger for - // polished metal window). - if ([[NSUserDefaults standardUserDefaults] boolForKey:MMTexturedWindowKey] - || (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4)) - styleMask |= NSTexturedBackgroundWindowMask; + if ([[NSUserDefaults standardUserDefaults] + boolForKey:MMNoTitleBarWindowKey]) { + // No title bar setting + styleMask &= ~NSWindowStyleMaskTitled; + } // NOTE: The content rect is only used the very first time MacVim is // started (or rather, when ~/Library/Preferences/org.vim.MacVim.plist does @@ -150,6 +152,8 @@ - (id)initWithVimController:(MMVimController *)controller self = [super initWithWindow:win]; if (!self) return nil; + resizingDueToMove = NO; + vimController = controller; decoratedWindow = [win retain]; @@ -171,7 +175,7 @@ - (id)initWithVimController:(MMVimController *)controller [win setDelegate:self]; [win setInitialFirstResponder:[vimView textView]]; - if ([win styleMask] & NSTexturedBackgroundWindowMask) { + if ([win styleMask] & NSWindowStyleMaskTexturedBackground) { // On Leopard, we want to have a textured window to have nice // looking tabs. But the textured window look implies rounded // corners, which looks really weird -- disable them. This is a @@ -226,6 +230,8 @@ - (void)dealloc [windowAutosaveKey release]; windowAutosaveKey = nil; [vimView release]; vimView = nil; [toolbar release]; toolbar = nil; + // in case processAfterWindowPresentedQueue wasn't called + [afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil; [super dealloc]; } @@ -328,10 +334,15 @@ - (BOOL)presentWindow:(id)unused if (fullScreenEnabled && !fullScreenWindow) [decoratedWindow setAlphaValue:0]; + [decoratedWindow setBlurRadius:blurRadius]; + // Flag that the window is now placed on screen. From now on it is OK for // code to depend on the screen state. (Such as constraining views etc.) windowPresented = YES; + // Process deferred blocks + [self processAfterWindowPresentedQueue]; + if (fullScreenWindow) { // Delayed entering of full-screen happens here (a ":set fu" in a // GUIEnter auto command could cause this). @@ -347,6 +358,18 @@ - (BOOL)presentWindow:(id)unused return YES; } +- (void)moveWindowAcrossScreens:(NSPoint)topLeft +{ + // HACK! This method moves a window to a new origin and to a different + // screen. This is primarily useful to avoid a scenario where such a move + // will trigger a resize, even though the frame didn't actually change size. + // This method should not be called unless the new origin is definitely on + // a different screen, otherwise the next legitimate resize message will + // be skipped. + resizingDueToMove = YES; + [[self window] setFrameTopLeftPoint:topLeft]; +} + - (void)updateTabsWithData:(NSData *)data { [vimView updateTabsWithData:data]; @@ -571,11 +594,12 @@ - (void)processInputQueueDidFinish // TODO: What if the resize message fails to make it back? if (!didMaximize) { NSSize originalSize = [vimView frame].size; - NSSize contentSize = [vimView desiredSize]; - contentSize = [self constrainContentSizeToScreenSize:contentSize]; int rows = 0, cols = 0; - contentSize = [vimView constrainRows:&rows columns:&cols - toSize:contentSize]; + NSSize contentSize = [vimView constrainRows:&rows columns:&cols + toSize: + fullScreenWindow ? [fullScreenWindow frame].size : + fullScreenEnabled ? desiredWindowSize : + [self constrainContentSizeToScreenSize:[vimView desiredSize]]]; [vimView setFrameSize:contentSize]; if (fullScreenWindow) { @@ -637,6 +661,14 @@ - (void)adjustLinespace:(int)linespace } } +- (void)adjustColumnspace:(int)columnspace +{ + if (vimView && [vimView textView]) { + [[vimView textView] setColumnspace:(float)columnspace]; + shouldMaximizeWindow = shouldResizeVimView = YES; + } +} + - (void)liveResizeWillStart { if (!setupDone) return; @@ -666,37 +698,6 @@ - (void)liveResizeDidEnd NSConnection *connection = [(NSDistantObject*)proxy connectionForProxy]; [connection removeRequestMode:NSEventTrackingRunLoopMode]; - // NOTE: During live resize messages from MacVim to Vim are often dropped - // (because too many messages are sent at once). This may lead to - // inconsistent states between Vim and MacVim; to avoid this we send a - // synchronous resize message to Vim now (this is not fool-proof, but it - // does seem to work quite well). - // Do NOT send a SetTextDimensionsMsgID message (as opposed to - // LiveResizeMsgID) since then the view is constrained to not be larger - // than the screen the window mostly occupies; this makes it impossible to - // resize the window across multiple screens. - - int constrained[2]; - NSSize textViewSize = [[vimView textView] frame].size; - [[vimView textView] constrainRows:&constrained[0] columns:&constrained[1] - toSize:textViewSize]; - - ASLogDebug(@"End of live resize, notify Vim that text dimensions are %dx%d", - constrained[1], constrained[0]); - - NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)]; - BOOL sendOk = [vimController sendMessageNow:LiveResizeMsgID - data:data - timeout:.5]; - - if (!sendOk) { - // Sending of synchronous message failed. Force the window size to - // match the last dimensions received from Vim, otherwise we end up - // with inconsistent states. - [self resizeWindowToFitContentSize:[vimView desiredSize] - keepOnScreen:NO]; - } - // If we saved the original title while resizing, restore it. if (lastSetTitle != nil) { [decoratedWindow setTitle:lastSetTitle]; @@ -705,6 +706,14 @@ - (void)liveResizeDidEnd } } +- (void)setBlurRadius:(int)radius +{ + blurRadius = radius; + if (windowPresented) { + [decoratedWindow setBlurRadius:radius]; + } +} + - (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back { if (fullScreenEnabled) return; @@ -938,7 +947,6 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item - (void)windowDidBecomeMain:(NSNotification *)notification { [[MMAppController sharedInstance] setMainMenu:[vimController mainMenu]]; - [vimController sendMessage:GotFocusMsgID data:nil]; if ([vimView textView]) { NSFontManager *fm = [NSFontManager sharedFontManager]; @@ -946,7 +954,12 @@ - (void)windowDidBecomeMain:(NSNotification *)notification } } -- (void)windowDidResignMain:(NSNotification *)notification +- (void)windowDidBecomeKey:(NSNotificationCenter *)notification +{ + [vimController sendMessage:GotFocusMsgID data:nil]; +} + +- (void)windowDidResignKey:(NSNotification *)notification { [vimController sendMessage:LostFocusMsgID data:nil]; } @@ -991,9 +1004,26 @@ - (void)windowDidMove:(NSNotification *)notification [vimController sendMessage:SetWindowPositionMsgID data:data]; } +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize { + desiredWindowSize = frameSize; + return frameSize; +} + - (void)windowDidResize:(id)sender { - if (!setupDone || fullScreenEnabled) return; + if (resizingDueToMove) { + resizingDueToMove = NO; + return; + } + + if (!setupDone) + return; + + // NOTE: We need to update the window frame size for Split View even though + // in full-screen on El Capitan or later. + if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10_Max + && fullScreenEnabled) + return; // NOTE: Since we have no control over when the window may resize (Cocoa // may resize automatically) we simply set the view to fill the entire @@ -1023,8 +1053,8 @@ - (IBAction)zoom:(id)sender // Decide whether too zoom horizontally or not (always zoom vertically). NSEvent *event = [NSApp currentEvent]; - BOOL cmdLeftClick = [event type] == NSLeftMouseUp && - [event modifierFlags] & NSCommandKeyMask; + BOOL cmdLeftClick = [event type] == NSEventTypeLeftMouseUp && + [event modifierFlags] & NSEventModifierFlagCommand; BOOL zoomBoth = [[NSUserDefaults standardUserDefaults] boolForKey:MMZoomBothKey]; zoomBoth = (zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick); @@ -1130,20 +1160,31 @@ - (void)window:(NSWindow *)window // Fade out window, remove title bar and maximize, then fade back in. // (There is a small delay before window is maximized but usually this is // not noticeable on a relatively modern Mac.) + + // Fade out [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration:0.5*duration]; [[window animator] setAlphaValue:0]; } completionHandler:^{ - [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; - [[vimView tabBarControl] setStyleNamed:@"Unified"]; + [window setStyleMask:([window styleMask] | NSWindowStyleMaskFullScreen)]; + NSString *tabBarStyle = [[self class] tabBarStyleForUnified]; + [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; - [self maximizeWindow:fullScreenOptions]; + // Stay dark for some time to wait for things to sync, then do the full screen operation [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration:0.5*duration]; - [[window animator] setAlphaValue:1]; + [[window animator] setAlphaValue:0]; } completionHandler:^{ - // Do nothing + [self maximizeWindow:fullScreenOptions]; + + // Fade in + [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { + [context setDuration:0.5*duration]; + [[window animator] setAlphaValue:1]; + } completionHandler:^{ + // Do nothing + }]; }]; }]; } @@ -1153,6 +1194,9 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification // Store window frame and use it when exiting full-screen. preFullScreenFrame = [decoratedWindow frame]; + // The separator should never be visible in fullscreen or split-screen. + [decoratedWindow hideTablineSeparator:YES]; + // ASSUMPTION: fullScreenEnabled always reflects the state of Vim's 'fu'. if (!fullScreenEnabled) { ASLogDebug(@"Full-screen out of sync, tell Vim to set 'fu'"); @@ -1168,6 +1212,15 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification } } +- (void)windowDidEnterFullScreen:(NSNotification *)notification +{ + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_10_Max) { + // NOTE: On El Capitan, we need to redraw the view when entering + // full-screen using :fullscreen option (including Ctrl-Cmd-f). + [vimController sendMessage:BackingPropertiesChangedMsgID data:nil]; + } +} + - (void)windowDidFailToEnterFullScreen:(NSWindow *)window { // NOTE: This message can be called without @@ -1178,8 +1231,9 @@ - (void)windowDidFailToEnterFullScreen:(NSWindow *)window fullScreenEnabled = NO; [window setAlphaValue:1]; - [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)]; - [[vimView tabBarControl] setStyleNamed:@"Metal"]; + [window setStyleMask:([window styleMask] & ~NSWindowStyleMaskFullScreen)]; + NSString *tabBarStyle = [[self class] tabBarStyleForMetal]; + [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; [window setFrame:preFullScreenFrame display:YES]; } @@ -1208,8 +1262,9 @@ - (void)window:(NSWindow *)window [context setDuration:0.5*duration]; [[window animator] setAlphaValue:0]; } completionHandler:^{ - [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)]; - [[vimView tabBarControl] setStyleNamed:@"Metal"]; + [window setStyleMask:([window styleMask] & ~NSWindowStyleMaskFullScreen)]; + NSString *tabBarStyle = [[self class] tabBarStyleForMetal]; + [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; [window setFrame:preFullScreenFrame display:YES]; @@ -1236,6 +1291,17 @@ - (void)windowWillExitFullScreen:(NSNotification *)notification } } +- (void)windowDidExitFullScreen:(NSNotification *)notification +{ + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_10_Max) { + // NOTE: On El Capitan, we need to redraw the view when leaving + // full-screen by moving the window out from Split View. + [vimController sendMessage:BackingPropertiesChangedMsgID data:nil]; + } + + [self updateTablineSeparator]; +} + - (void)windowDidFailToExitFullScreen:(NSWindow *)window { // TODO: Is this the correct way to deal with this message? Are we still @@ -1244,14 +1310,28 @@ - (void)windowDidFailToExitFullScreen:(NSWindow *)window fullScreenEnabled = YES; [window setAlphaValue:1]; - [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; - [[vimView tabBarControl] setStyleNamed:@"Unified"]; + [window setStyleMask:([window styleMask] | NSWindowStyleMaskFullScreen)]; + NSString *tabBarStyle = [[self class] tabBarStyleForUnified]; + [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; [self maximizeWindow:fullScreenOptions]; } #endif // (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) +- (void)runAfterWindowPresentedUsingBlock:(void (^)(void))block +{ + if (windowPresented) { // no need to defer block, just run it now + block(); + return; + } + + // run block later + if (afterWindowPresentedQueue == nil) + afterWindowPresentedQueue = [[NSMutableArray alloc] init]; + [afterWindowPresentedQueue addObject:[block copy]]; +} + @end // MMWindowController @@ -1420,7 +1500,7 @@ - (void)updateTablineSeparator BOOL tabBarVisible = ![[vimView tabBarControl] isHidden]; BOOL toolbarHidden = [decoratedWindow toolbar] == nil; BOOL windowTextured = ([decoratedWindow styleMask] & - NSTexturedBackgroundWindowMask) != 0; + NSWindowStyleMaskTexturedBackground) != 0; BOOL hideSeparator = NO; if (fullScreenEnabled || tabBarVisible) @@ -1464,10 +1544,14 @@ - (void)doFindNext:(BOOL)next // See gui_macvim_add_to_find_pboard() for an explanation of these // types. - if ([bestType isEqual:VimFindPboardType]) + if ([bestType isEqual:VimFindPboardType]) { query = [pb stringForType:VimFindPboardType]; - else - query = [pb stringForType:NSStringPboardType]; + } else { + BOOL shareFindPboard = [[NSUserDefaults standardUserDefaults] + boolForKey:MMShareFindPboardKey]; + if (shareFindPboard) + query = [pb stringForType:NSStringPboardType]; + } } NSString *input = nil; @@ -1499,13 +1583,24 @@ - (void)updateToolbar - (BOOL)maximizeWindow:(int)options { + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_10_Max) { + // NOTE: Prevent to resize the window in Split View on El Capitan or + // later. + return NO; + } + int currRows, currColumns; [[vimView textView] getMaxRows:&currRows columns:&currColumns]; // NOTE: Do not use [NSScreen visibleFrame] when determining the screen // size since it compensates for menu and dock. int maxRows, maxColumns; - NSSize size = [[NSScreen mainScreen] frame].size; + NSScreen *screen = [decoratedWindow screen]; + if (!screen) { + ASLogNotice(@"Window not on screen, using main screen"); + screen = [NSScreen mainScreen]; + } + NSSize size = [screen frame].size; [vimView constrainRows:&maxRows columns:&maxColumns toSize:size]; ASLogDebug(@"Window dimensions max: %dx%d current: %dx%d", @@ -1577,5 +1672,23 @@ - (void)enterNativeFullScreen [decoratedWindow realToggleFullScreen:self]; } +- (void)processAfterWindowPresentedQueue +{ + for (void (^block)(void) in afterWindowPresentedQueue) + block(); + + [afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil; +} + ++ (NSString *)tabBarStyleForUnified +{ + return shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Unified"; +} + ++ (NSString *)tabBarStyleForMetal +{ + return shouldUseYosemiteTabBarStyle() ? @"Yosemite" : @"Metal"; +} + @end // MMWindowController (Private) diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 691c9b4847..ce6b2ca024 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -9,21 +9,74 @@ */ #import <Cocoa/Cocoa.h> -#import <asl.h> - // Taken from /usr/include/AvailabilityMacros.h -#ifndef MAC_OS_X_VERSION_10_4 -# define MAC_OS_X_VERSION_10_4 1040 +#ifndef MAC_OS_X_VERSION_10_7 +# define MAC_OS_X_VERSION_10_7 1070 #endif -#ifndef MAC_OS_X_VERSION_10_5 -# define MAC_OS_X_VERSION_10_5 1050 +#ifndef MAC_OS_X_VERSION_10_8 +# define MAC_OS_X_VERSION_10_8 1080 #endif -#ifndef MAC_OS_X_VERSION_10_6 -# define MAC_OS_X_VERSION_10_6 1060 +#ifndef MAC_OS_X_VERSION_10_9 +# define MAC_OS_X_VERSION_10_9 1090 #endif -#ifndef MAC_OS_X_VERSION_10_7 -# define MAC_OS_X_VERSION_10_7 1070 +#ifndef MAC_OS_X_VERSION_10_10 +# define MAC_OS_X_VERSION_10_10 101000 +#endif +#ifndef MAC_OS_X_VERSION_10_11 +# define MAC_OS_X_VERSION_10_11 101100 +#endif +#ifndef MAC_OS_X_VERSION_10_12 +# define MAC_OS_X_VERSION_10_12 101200 +#endif + +#ifndef NSAppKitVersionNumber10_10 +# define NSAppKitVersionNumber10_10 1343 +#endif +#ifndef NSAppKitVersionNumber10_10_Max +# define NSAppKitVersionNumber10_10_Max 1349 +#endif +#ifndef NSAppKitVersionNumber10_12 +# define NSAppKitVersionNumber10_12 1504 +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +// Deprecated constants in 10.12 SDK +# define NSAlertStyleCritical NSCriticalAlertStyle +# define NSAlertStyleInformational NSInformationalAlertStyle +# define NSAlertStyleWarning NSWarningAlertStyle +# define NSCompositingOperationSourceOver NSCompositeSourceOver +# define NSControlSizeRegular NSRegularControlSize +# define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask +# define NSEventModifierFlagCommand NSCommandKeyMask +# define NSEventModifierFlagControl NSControlKeyMask +# define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask +# define NSEventModifierFlagHelp NSHelpKeyMask +# define NSEventModifierFlagNumericPad NSNumericPadKeyMask +# define NSEventModifierFlagOption NSAlternateKeyMask +# define NSEventModifierFlagShift NSShiftKeyMask +# define NSEventTypeApplicationDefined NSApplicationDefined +# define NSEventTypeKeyDown NSKeyDown +# define NSEventTypeKeyUp NSKeyUp +# define NSEventTypeLeftMouseUp NSLeftMouseUp +# define NSEventTypeMouseEntered NSMouseEntered +# define NSEventTypeMouseExited NSMouseExited +# define NSEventTypeRightMouseDown NSRightMouseDown +# define NSWindowStyleMaskBorderless NSBorderlessWindowMask +# define NSWindowStyleMaskClosable NSClosableWindowMask +# define NSWindowStyleMaskFullScreen NSFullScreenWindowMask +# define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask +# define NSWindowStyleMaskResizable NSResizableWindowMask +# define NSWindowStyleMaskTexturedBackground NSTexturedBackgroundWindowMask +# define NSWindowStyleMaskTitled NSTitledWindowMask +# define NSWindowStyleMaskUnifiedTitleAndToolbar NSUnifiedTitleAndToolbarWindowMask +#endif + +#import <asl.h> +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +# define MM_USE_ASL +#else +# import <os/log.h> #endif @@ -157,6 +210,7 @@ enum { MouseMovedMsgID, SetMouseShapeMsgID, AdjustLinespaceMsgID, + AdjustColumnspaceMsgID, ActivateMsgID, SetServerNameMsgID, EnterFullScreenMsgID, @@ -168,6 +222,8 @@ enum { XcodeModMsgID, EnableAntialiasMsgID, DisableAntialiasMsgID, + EnableProportionalFontMsgID, + DisableProportionalFontMsgID, SetVimStateMsgID, SetDocumentFilenameMsgID, OpenWithArgumentsMsgID, @@ -183,7 +239,6 @@ enum { DeactivatedImMsgID, BrowseForFileMsgID, ShowDialogMsgID, - NetBeansMsgID, SetMarkedTextMsgID, ZoomMsgID, SetWindowPositionMsgID, @@ -193,6 +248,11 @@ enum { GestureMsgID, AddToMRUMsgID, BackingPropertiesChangedMsgID, + SetBlurRadiusMsgID, + EnableLigaturesMsgID, + DisableLigaturesMsgID, + EnableThinStrokesMsgID, + DisableThinStrokesMsgID, LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM! }; @@ -256,13 +316,15 @@ extern NSString *MMLogToStdErrKey; // (techincally this is a user default but should not be used as such). extern NSString *MMNoWindowKey; +// Argument used to control MacVim sharing search text via the Find Pasteboard. +extern NSString *MMShareFindPboardKey; + extern NSString *MMAutosaveRowsKey; extern NSString *MMAutosaveColumnsKey; extern NSString *MMRendererKey; enum { MMRendererDefault = 0, - MMRendererATSUI, MMRendererCoreText }; @@ -312,37 +374,6 @@ extern NSString *VimFindPboardType; #define keyMMUntitledWindow 'MMuw' - - -#ifndef NSINTEGER_DEFINED -// NSInteger was introduced in 10.5 -# if __LP64__ || NS_BUILD_32_LIKE_64 -typedef long NSInteger; -typedef unsigned long NSUInteger; -# else -typedef int NSInteger; -typedef unsigned int NSUInteger; -# endif -# define NSINTEGER_DEFINED 1 -#endif - -#ifndef NSAppKitVersionNumber10_4 // Needed for pre-10.5 SDK -# define NSAppKitVersionNumber10_4 824 -#endif - -#ifndef CGFLOAT_DEFINED - // On Leopard, CGFloat is float on 32bit and double on 64bit. On Tiger, - // we can't use this anyways, so it's just here to keep the compiler happy. - // However, when we're compiling for Tiger and running on Leopard, we - // might need the correct typedef, so this piece is copied from ATSTypes.h -# ifdef __LP64__ - typedef double CGFloat; -# else - typedef float CGFloat; -# endif -#endif - - // Logging related functions and macros. // // This is a very simplistic logging facility built on top of ASL. Two user @@ -377,7 +408,10 @@ extern int ASLogLevel; void ASLInit(); -#define ASLog(level, fmt, ...) \ +#if defined(MM_USE_ASL) + +# define MM_ASL_LEVEL_DEFAULT ASL_LEVEL_NOTICE +# define ASLog(level, fmt, ...) \ if (level <= ASLogLevel) { \ asl_log(NULL, NULL, level, "%s@%d: %s", \ __PRETTY_FUNCTION__, __LINE__, \ @@ -386,10 +420,47 @@ void ASLInit(); // Note: These macros are used like ASLogErr(@"text num=%d", 42). Objective-C // style specifiers (%@) are supported. -#define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__) -#define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__) -#define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__) -#define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) -#define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__) -#define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__) -#define ASLogTmp(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) +# define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__) +# define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__) +# define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__) +# define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) +# define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__) +# define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__) +# define ASLogTmp(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) + +#else + +# define MM_ASL_LEVEL_DEFAULT OS_LOG_TYPE_DEFAULT +# define ASLog(level, fmt, ...) \ + if (level <= ASLogLevel) { \ + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { \ + os_log_with_type(OS_LOG_DEFAULT, level, "%s@%d: %s", \ + __PRETTY_FUNCTION__, __LINE__, \ + [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \ + } else { \ + int logLevel; \ + switch (level) { \ + case OS_LOG_TYPE_FAULT: logLevel = ASL_LEVEL_CRIT; break; \ + case OS_LOG_TYPE_ERROR: logLevel = ASL_LEVEL_ERR; break; \ + case OS_LOG_TYPE_INFO: logLevel = ASL_LEVEL_INFO; break; \ + case OS_LOG_TYPE_DEBUG: logLevel = ASL_LEVEL_DEBUG; break; \ + default: logLevel = ASL_LEVEL_NOTICE; break; \ + } \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ + asl_log(NULL, NULL, logLevel, "%s@%d: %s", \ + __PRETTY_FUNCTION__, __LINE__, \ + [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \ + _Pragma("clang diagnostic pop") \ + } \ + } + +# define ASLogCrit(fmt, ...) ASLog(OS_LOG_TYPE_FAULT, fmt, ##__VA_ARGS__) +# define ASLogErr(fmt, ...) ASLog(OS_LOG_TYPE_ERROR, fmt, ##__VA_ARGS__) +# define ASLogWarn(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) +# define ASLogNotice(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) +# define ASLogInfo(fmt, ...) ASLog(OS_LOG_TYPE_INFO, fmt, ##__VA_ARGS__) +# define ASLogDebug(fmt, ...) ASLog(OS_LOG_TYPE_DEBUG, fmt, ##__VA_ARGS__) +# define ASLogTmp(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) + +#endif diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index f210c72ea6..3be7a21b73 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -64,6 +64,7 @@ "MouseMovedMsgID", "SetMouseShapeMsgID", "AdjustLinespaceMsgID", + "AdjustColumnspaceMsgID", "ActivateMsgID", "SetServerNameMsgID", "EnterFullScreenMsgID", @@ -75,6 +76,8 @@ "XcodeModMsgID", "EnableAntialiasMsgID", "DisableAntialiasMsgID", + "EnableProportionalFontMsgID", + "DisableProportionalFontMsgID", "SetVimStateMsgID", "SetDocumentFilenameMsgID", "OpenWithArgumentsMsgID", @@ -90,7 +93,6 @@ "DeactivatedImMsgID", "BrowseForFileMsgID", "ShowDialogMsgID", - "NetBeansMsgID", "SetMarkedTextMsgID", "ZoomMsgID", "SetWindowPositionMsgID", @@ -100,6 +102,11 @@ "GestureMsgID", "AddToMRUMsgID", "BackingPropertiesChangedMsgID", + "SetBlurRadiusMsgID", + "EnableLigaturesMsgID", + "DisableLigaturesMsgID", + "EnableThinStrokesMsgID", + "DisableThinStrokesMsgID", "END OF MESSAGE IDs" // NOTE: Must be last! }; @@ -113,6 +120,8 @@ // (techincally this is a user default but should not be used as such). NSString *MMNoWindowKey = @"MMNoWindow"; +NSString *MMShareFindPboardKey = @"MMShareFindPboard"; + NSString *MMAutosaveRowsKey = @"MMAutosaveRows"; NSString *MMAutosaveColumnsKey = @"MMAutosaveColumns"; NSString *MMRendererKey = @"MMRenderer"; @@ -120,7 +129,7 @@ // Vim find pasteboard type (string contains Vim regex patterns) NSString *VimFindPboardType = @"VimFindPboardType"; -int ASLogLevel = ASL_LEVEL_NOTICE; +int ASLogLevel = MM_ASL_LEVEL_DEFAULT; @@ -302,19 +311,32 @@ @implementation NSDictionary (MMExtras) + (id)dictionaryWithData:(NSData *)data { +#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 + id plist = [NSPropertyListSerialization + propertyListWithData:data + options:NSPropertyListImmutable + format:NULL + error:NULL]; +#else id plist = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:NULL]; +#endif return [plist isKindOfClass:[NSDictionary class]] ? plist : nil; } - (NSData *)dictionaryAsData { +#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 + return [NSPropertyListSerialization dataWithPropertyList:self + format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL]; +#else return [NSPropertyListSerialization dataFromPropertyList:self format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL]; +#endif } @end @@ -326,11 +348,19 @@ @implementation NSMutableDictionary (MMExtras) + (id)dictionaryWithData:(NSData *)data { +#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 + id plist = [NSPropertyListSerialization + propertyListWithData:data + options:NSPropertyListMutableContainers + format:NULL + error:NULL]; +#else id plist = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainers format:NULL errorDescription:NULL]; +#endif return [plist isKindOfClass:[NSMutableDictionary class]] ? plist : nil; } @@ -353,12 +383,27 @@ + (id)dictionaryWithData:(NSData *)data if (logLevelObj) { int logLevel = [logLevelObj intValue]; if (logLevel < 0) logLevel = 0; +#if defined(MM_USE_ASL) if (logLevel > ASL_LEVEL_DEBUG) logLevel = ASL_LEVEL_DEBUG; - - ASLogLevel = logLevel; asl_set_filter(NULL, ASL_FILTER_MASK_UPTO(logLevel)); +#else + switch (logLevel) { + case 0: case 1: case 2: + logLevel = OS_LOG_TYPE_FAULT; break; + case 3: + logLevel = OS_LOG_TYPE_ERROR; break; + case 4: case 5: + logLevel = OS_LOG_TYPE_DEFAULT; break; + case 6: + logLevel = OS_LOG_TYPE_INFO; break; + default: + logLevel = OS_LOG_TYPE_DEBUG; break; + } +#endif + ASLogLevel = logLevel; } +#if defined(MM_USE_ASL) // Allow for changing whether a copy of each log should be sent to stderr // (this defaults to NO if this key is missing in the user defaults // database). The above filter mask is applied to logs going to stderr, @@ -366,4 +411,5 @@ + (id)dictionaryWithData:(NSData *)data BOOL logToStdErr = [ud boolForKey:MMLogToStdErrKey]; if (logToStdErr) asl_add_log_file(NULL, 2); // The file descriptor for stderr is 2 +#endif } diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj index 1c5ff47c89..cb3174a70d 100644 --- a/src/MacVim/MacVim.xcodeproj/project.pbxproj +++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -21,15 +21,13 @@ 1D22374B0E45DF4800E6FFFF /* Advanced.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D22374A0E45DF4800E6FFFF /* Advanced.png */; }; 1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D384A0D100D671700D3C22F /* KeyBinding.plist */; }; 1D44972211FCA9B400B0630F /* MMCoreTextView+ToolTip.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D44972111FCA9B400B0630F /* MMCoreTextView+ToolTip.m */; }; - 1D493D580C5247BF00AB718C /* Vim in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; }; - 1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; }; + 1D493D580C5247BF00AB718C /* Vim in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; }; 1D80591F0E1185EA001699D1 /* Miscellaneous.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80591D0E1185EA001699D1 /* Miscellaneous.m */; }; 1D80FBD40CBBD3B700102A1C /* MMFullScreenWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD00CBBD3B700102A1C /* MMFullScreenWindow.m */; }; 1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD20CBBD3B700102A1C /* MMVimView.m */; }; 1D8B5A53104AF9FF002E59D5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D8B5A52104AF9FF002E59D5 /* Carbon.framework */; }; - 1D8BEA74104992290069B072 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D8BEA73104992290069B072 /* FindAndReplace.nib */; }; - 1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */; }; 1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D9C602E0EF79C0C0034AD44 /* MacVim.icns */; }; 1DCD00BF0E50B2B700460166 /* Attention.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AA0E50B2B700460166 /* Attention.png */; }; 1DCD00C00E50B2B700460166 /* Copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AB0E50B2B700460166 /* Copy.png */; }; @@ -65,6 +63,18 @@ 1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */; }; 1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; }; 1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; }; + 5260A93C11BD18A600EE97ED /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5260A93B11BD18A600EE97ED /* Localizable.strings */; }; + 5260A94311BD191500EE97ED /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5260A94211BD191500EE97ED /* FindAndReplace.nib */; }; + 5260A94811BD19D100EE97ED /* FindAndReplace.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5260A94611BD19D100EE97ED /* FindAndReplace.strings */; }; + 5260A94E11BD1BBC00EE97ED /* MainMenu.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5260A94C11BD1BBC00EE97ED /* MainMenu.strings */; }; + 5260A95811BD1E3300EE97ED /* Preferences.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5260A95611BD1E3300EE97ED /* Preferences.strings */; }; + 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 528DA6631426CB2A003380F1 /* plugins in Copy KaoriYa Runtime Files */ = {isa = PBXBuildFile; fileRef = 528DA6571426C607003380F1 /* plugins */; }; + 528DA6641426CB2F003380F1 /* switches in Copy KaoriYa Runtime Files */ = {isa = PBXBuildFile; fileRef = 528DA6581426C607003380F1 /* switches */; }; + 528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 528DA6691426D4EB003380F1 /* macvim-askpass */; }; + 52AA566D11C5C50500D57D62 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52AA566C11C5C50500D57D62 /* Sparkle.framework */; }; + 52AA577311C5C88800D57D62 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52AA566C11C5C50500D57D62 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 52AA577811C5D8E600D57D62 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 52AA577711C5D8E600D57D62 /* dsa_pub.pem */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -86,6 +96,20 @@ remoteGlobalIDString = 53DF68FC067E5B5A0090B5B0; remoteInfo = PSMTabBarControlFramework; }; + 52818AFE1C1C075300F59085 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8D576316048677EA00EA77CD; + remoteInfo = QuickLookStephen; + }; + 52818B001C1C084100F59085 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 8D57630D048677EA00EA77CD; + remoteInfo = QuickLookStephen; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -107,6 +131,7 @@ dstSubfolderSpec = 10; files = ( 1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */, + 52AA577311C5C88800D57D62 /* Sparkle.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -124,6 +149,40 @@ name = "Copy Vim Runtime Files"; runOnlyForDeploymentPostprocessing = 0; }; + 52818B021C1C088000F59085 /* Copy QuickLookPlugin */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ../Library/QuickLook; + dstSubfolderSpec = 6; + files = ( + 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */, + ); + name = "Copy QuickLookPlugin"; + runOnlyForDeploymentPostprocessing = 0; + }; + 528DA28A1426C479003380F1 /* Copy KaoriYa Runtime Files */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = vim; + dstSubfolderSpec = 7; + files = ( + 528DA6631426CB2A003380F1 /* plugins in Copy KaoriYa Runtime Files */, + 528DA6641426CB2F003380F1 /* switches in Copy KaoriYa Runtime Files */, + ); + name = "Copy KaoriYa Runtime Files"; + runOnlyForDeploymentPostprocessing = 0; + }; + 528DA6671426D456003380F1 /* Copy Scripts */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 6; + files = ( + 528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */, + ); + name = "Copy Scripts"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -164,8 +223,6 @@ 1D80FBD10CBBD3B700102A1C /* MMVimView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMVimView.h; sourceTree = "<group>"; }; 1D80FBD20CBBD3B700102A1C /* MMVimView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMVimView.m; sourceTree = "<group>"; }; 1D8B5A52104AF9FF002E59D5 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; - 1D9918460D299F9900A96335 /* MMAtsuiTextView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMAtsuiTextView.h; sourceTree = "<group>"; }; - 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAtsuiTextView.m; sourceTree = "<group>"; }; 1D9C602E0EF79C0C0034AD44 /* MacVim.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacVim.icns; path = icons/MacVim.icns; sourceTree = "<group>"; }; 1DCD00AA0E50B2B700460166 /* Attention.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Attention.png; path = Toolbar/Attention.png; sourceTree = "<group>"; }; 1DCD00AB0E50B2B700460166 /* Copy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Copy.png; path = Toolbar/Copy.png; sourceTree = "<group>"; }; @@ -209,6 +266,23 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 32CA4F630368D1EE00C91783 /* MacVim_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacVim_Prefix.pch; sourceTree = "<group>"; }; + 5260A93911BD189D00EE97ED /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; }; + 5260A93D11BD18AD00EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; sourceTree = "<group>"; }; + 5260A94411BD191C00EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/FindAndReplace.nib; sourceTree = "<group>"; }; + 5260A94711BD19D100EE97ED /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/FindAndReplace.strings; sourceTree = "<group>"; }; + 5260A94A11BD19DF00EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/FindAndReplace.strings; sourceTree = "<group>"; }; + 5260A94D11BD1BBC00EE97ED /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/MainMenu.strings; sourceTree = "<group>"; }; + 5260A94F11BD1C0600EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/MainMenu.strings; sourceTree = "<group>"; }; + 5260A95011BD1C7500EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/MainMenu.nib; sourceTree = "<group>"; }; + 5260A95711BD1E3300EE97ED /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Preferences.strings; sourceTree = "<group>"; }; + 5260A95911BD1E3B00EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Preferences.strings; sourceTree = "<group>"; }; + 5260A95A11BD1E4A00EE97ED /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/Preferences.nib; sourceTree = "<group>"; }; + 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = QuickLookStephen.xcodeproj; path = qlstephen/QuickLookStephen.xcodeproj; sourceTree = "<group>"; }; + 528DA6571426C607003380F1 /* plugins */ = {isa = PBXFileReference; lastKnownFileType = folder; name = plugins; path = ../../plugins; sourceTree = "<group>"; }; + 528DA6581426C607003380F1 /* switches */ = {isa = PBXFileReference; lastKnownFileType = folder; name = switches; path = ../../switches; sourceTree = "<group>"; }; + 528DA6691426D4EB003380F1 /* macvim-askpass */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "macvim-askpass"; sourceTree = "<group>"; }; + 52AA566C11C5C50500D57D62 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; }; + 52AA577711C5D8E600D57D62 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* MacVim.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MacVim.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -221,6 +295,7 @@ 1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 1D8B5A53104AF9FF002E59D5 /* Carbon.framework in Frameworks */, + 52AA566D11C5C50500D57D62 /* Sparkle.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -245,8 +320,6 @@ 1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */, 1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */, 1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */, - 1D9918460D299F9900A96335 /* MMAtsuiTextView.h */, - 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */, 1D80FBCF0CBBD3B700102A1C /* MMFullScreenWindow.h */, 1D80FBD00CBBD3B700102A1C /* MMFullScreenWindow.m */, 1D80FBD10CBBD3B700102A1C /* MMVimView.h */, @@ -277,6 +350,7 @@ isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + 52AA566C11C5C50500D57D62 /* Sparkle.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; @@ -367,6 +441,9 @@ 29B97317FDCFA39411CA2CEA /* Resources */, 1DE602460C587F760055263D /* Vim Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, + 52818AF81C1C073400F59085 /* QuickLook Plugin */, + 528DA28B1426C4DA003380F1 /* KaoriYa Resources */, + 528DA6681426D477003380F1 /* Scripts */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = MacVim; @@ -375,9 +452,14 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 52AA577711C5D8E600D57D62 /* dsa_pub.pem */, + 5260A95611BD1E3300EE97ED /* Preferences.strings */, + 5260A94C11BD1BBC00EE97ED /* MainMenu.strings */, + 5260A94611BD19D100EE97ED /* FindAndReplace.strings */, + 5260A93B11BD18A600EE97ED /* Localizable.strings */, 1D384A0D100D671700D3C22F /* KeyBinding.plist */, 1D9C602E0EF79C0C0034AD44 /* MacVim.icns */, - 1D8BEA73104992290069B072 /* FindAndReplace.nib */, + 5260A94211BD191500EE97ED /* FindAndReplace.nib */, 0395A8A90D72D88B00881434 /* General.png */, 1D22374A0E45DF4800E6FFFF /* Advanced.png */, 1DD3D51D0D82D4C9006E4320 /* ibeam.png */, @@ -406,6 +488,39 @@ name = Frameworks; sourceTree = "<group>"; }; + 52818AF81C1C073400F59085 /* QuickLook Plugin */ = { + isa = PBXGroup; + children = ( + 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */, + ); + name = "QuickLook Plugin"; + sourceTree = "<group>"; + }; + 52818AFB1C1C075300F59085 /* Products */ = { + isa = PBXGroup; + children = ( + 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */, + ); + name = Products; + sourceTree = "<group>"; + }; + 528DA28B1426C4DA003380F1 /* KaoriYa Resources */ = { + isa = PBXGroup; + children = ( + 528DA6571426C607003380F1 /* plugins */, + 528DA6581426C607003380F1 /* switches */, + ); + name = "KaoriYa Resources"; + sourceTree = "<group>"; + }; + 528DA6681426D477003380F1 /* Scripts */ = { + isa = PBXGroup; + children = ( + 528DA6691426D4EB003380F1 /* macvim-askpass */, + ); + name = Scripts; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -418,13 +533,19 @@ 8D11072E0486CEB800E47090 /* Frameworks */, 1D0DCAD80BA3604D00B6CCFA /* Copy Executables */, 1D9EB2840C366D7B0074B739 /* Copy Frameworks */, + 52818B021C1C088000F59085 /* Copy QuickLookPlugin */, 1DE608B80C58807F0055263D /* Copy Vim Runtime Files */, 1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */, + 528DA6671426D456003380F1 /* Copy Scripts */, + 52283AB71EBA200C00A6F6B9 /* Copy mvim scripts */, + 528DA28A1426C479003380F1 /* Copy KaoriYa Runtime Files */, + 52F1931D1877EC5E007C4A82 /* Copy gettext Files */, ); buildRules = ( ); dependencies = ( 1D493DCD0C5254A400AB718C /* PBXTargetDependency */, + 52818B011C1C084100F59085 /* PBXTargetDependency */, ); name = MacVim; productInstallPath = "$(HOME)/Applications"; @@ -437,8 +558,11 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0720; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MacVim" */; - compatibilityVersion = "Xcode 2.4"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -455,6 +579,10 @@ ProductGroup = 1D493DB40C52533B00AB718C /* Products */; ProjectRef = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */; }, + { + ProductGroup = 52818AFB1C1C075300F59085 /* Products */; + ProjectRef = 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */; + }, ); projectRoot = ""; targets = ( @@ -471,6 +599,13 @@ remoteRef = 1D493DB80C52533B00AB718C /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = QLStephen.qlgenerator; + remoteRef = 52818AFE1C1C075300F59085 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -509,9 +644,14 @@ 1DCD00D10E50B2B700460166 /* SaveSesn.png in Resources */, 1DCD00D20E50B2B700460166 /* TagJump.png in Resources */, 1DCD00D30E50B2B700460166 /* Undo.png in Resources */, - 1D8BEA74104992290069B072 /* FindAndReplace.nib in Resources */, + 5260A94311BD191500EE97ED /* FindAndReplace.nib in Resources */, 1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */, 1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */, + 5260A93C11BD18A600EE97ED /* Localizable.strings in Resources */, + 5260A94811BD19D100EE97ED /* FindAndReplace.strings in Resources */, + 5260A94E11BD1BBC00EE97ED /* MainMenu.strings in Resources */, + 5260A95811BD1E3300EE97ED /* Preferences.strings in Resources */, + 52AA577811C5D8E600D57D62 /* dsa_pub.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -533,6 +673,36 @@ shellScript = "# Clear deployment target, else the python script always thinks we're building on Tiger\nunset MACOSX_DEPLOYMENT_TARGET\n\n# Generate the icons (redirect stderr to ignore warnings)\ncd \"$PROJECT_DIR\"/icons/\nmake OUTDIR=\"$TARGET_BUILD_DIR\"/$UNLOCALIZED_RESOURCES_FOLDER_PATH 2> /dev/null\n"; showEnvVarsInLog = 0; }; + 52283AB71EBA200C00A6F6B9 /* Copy mvim scripts */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy mvim scripts"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "BINPATH=$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/bin\nmkdir -p $BINPATH\ncp -a $SRCROOT/mvim $BINPATH/mvim\nchmod 755 $BINPATH/mvim\n(cd $BINPATH; for f in vim vimdiff view gvim gvimdiff gview mvimdiff mview; do ln -fs mvim $f; done)"; + showEnvVarsInLog = 0; + }; + 52F1931D1877EC5E007C4A82 /* Copy gettext Files */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy gettext Files"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "DSTDIR=\"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/vim/runtime/lang/ja_JP.UTF-8/LC_MESSAGES\"\nmkdir -p \"$DSTDIR\"\ncp \"$PROJECT_DIR/../po/ja.mo\" \"$DSTDIR/vim.mo\""; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -551,7 +721,6 @@ 1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */, 1D80FBD40CBBD3B700102A1C /* MMFullScreenWindow.m in Sources */, 1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */, - 1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */, 1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */, 1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */, 0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */, @@ -571,6 +740,11 @@ name = PSMTabBarControlFramework; targetProxy = 1D493DCC0C5254A400AB718C /* PBXContainerItemProxy */; }; + 52818B011C1C084100F59085 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = QuickLookStephen; + targetProxy = 52818B001C1C084100F59085 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -582,28 +756,67 @@ name = InfoPlist.strings; sourceTree = "<group>"; }; - 1D8BEA73104992290069B072 /* FindAndReplace.nib */ = { + 1DE3F8E50D50F80500052B9E /* Preferences.nib */ = { + isa = PBXVariantGroup; + children = ( + 1DE3F8E60D50F80500052B9E /* English */, + 5260A95A11BD1E4A00EE97ED /* Japanese */, + ); + name = Preferences.nib; + sourceTree = "<group>"; + }; + 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { + isa = PBXVariantGroup; + children = ( + 29B97319FDCFA39411CA2CEA /* English */, + 5260A95011BD1C7500EE97ED /* Japanese */, + ); + name = MainMenu.nib; + sourceTree = "<group>"; + }; + 5260A93B11BD18A600EE97ED /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 5260A93911BD189D00EE97ED /* English */, + 5260A93D11BD18AD00EE97ED /* Japanese */, + ); + name = Localizable.strings; + sourceTree = "<group>"; + }; + 5260A94211BD191500EE97ED /* FindAndReplace.nib */ = { isa = PBXVariantGroup; children = ( 1D6008820E96886D003763F0 /* English */, + 5260A94411BD191C00EE97ED /* Japanese */, ); name = FindAndReplace.nib; sourceTree = "<group>"; }; - 1DE3F8E50D50F80500052B9E /* Preferences.nib */ = { + 5260A94611BD19D100EE97ED /* FindAndReplace.strings */ = { isa = PBXVariantGroup; children = ( - 1DE3F8E60D50F80500052B9E /* English */, + 5260A94711BD19D100EE97ED /* English */, + 5260A94A11BD19DF00EE97ED /* Japanese */, ); - name = Preferences.nib; + name = FindAndReplace.strings; sourceTree = "<group>"; }; - 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { + 5260A94C11BD1BBC00EE97ED /* MainMenu.strings */ = { isa = PBXVariantGroup; children = ( - 29B97319FDCFA39411CA2CEA /* English */, + 5260A94D11BD1BBC00EE97ED /* English */, + 5260A94F11BD1C0600EE97ED /* Japanese */, ); - name = MainMenu.nib; + name = MainMenu.strings; + sourceTree = "<group>"; + }; + 5260A95611BD1E3300EE97ED /* Preferences.strings */ = { + isa = PBXVariantGroup; + children = ( + 5260A95711BD1E3300EE97ED /* English */, + 5260A95911BD1E3B00EE97ED /* Japanese */, + ); + name = Preferences.strings; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ @@ -612,14 +825,15 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 73; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", ); FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\""; + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)\""; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -630,8 +844,10 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = ""; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.vim.MacVim; PRODUCT_NAME = MacVim; VERSIONING_SYSTEM = "apple-generic"; WARNING_CFLAGS = "-Wall"; @@ -643,14 +859,15 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 73; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", ); FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\""; + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)\""; GCC_DYNAMIC_NO_PIC = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -660,8 +877,10 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = ""; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.vim.MacVim; PRODUCT_NAME = MacVim; VERSIONING_SYSTEM = "apple-generic"; WRAPPER_EXTENSION = app; @@ -672,7 +891,7 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + ENABLE_TESTABILITY = YES; GCC_VERSION = 4.2; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -685,7 +904,6 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; GCC_VERSION = 4.2; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; diff --git a/src/MacVim/Miscellaneous.h b/src/MacVim/Miscellaneous.h index 52aaaea2ed..47e6d24753 100644 --- a/src/MacVim/Miscellaneous.h +++ b/src/MacVim/Miscellaneous.h @@ -16,10 +16,6 @@ // TODO: Remove this when the inline IM code has been tested #define INCLUDE_OLD_IM_CODE -// Use Core Text instead of ATSUI when compiling on 10.5+. -// Note: Core Text was introduced with 10.5, ATSUI was deprecated on 10.6. -#define MM_ENABLE_ATSUI (MAC_OS_X_VERSION_MIN_REQUIRED<MAC_OS_X_VERSION_10_5) - // NSUserDefaults keys extern NSString *MMTabMinWidthKey; @@ -37,9 +33,9 @@ extern NSString *MMTranslateCtrlClickKey; extern NSString *MMTopLeftPointKey; extern NSString *MMOpenInCurrentWindowKey; extern NSString *MMNoFontSubstitutionKey; +extern NSString *MMNoTitleBarWindowKey; extern NSString *MMLoginShellKey; extern NSString *MMUntitledWindowKey; -extern NSString *MMTexturedWindowKey; extern NSString *MMZoomBothKey; extern NSString *MMCurrentPreferencePaneKey; extern NSString *MMLoginShellCommandKey; @@ -54,6 +50,10 @@ extern NSString *MMUseInlineImKey; #endif // INCLUDE_OLD_IM_CODE extern NSString *MMSuppressTerminationAlertKey; extern NSString *MMNativeFullScreenKey; +extern NSString *MMUseMouseTimeKey; +extern NSString *MMFullScreenFadeTimeKey; +extern NSString *MMUseCGLayerAlwaysKey; +extern NSString *MMIgnoreShiftSpaceKey; // Enum for MMUntitledWindowKey @@ -105,11 +105,6 @@ enum { @interface NSSavePanel (MMExtras) - (void)hiddenFilesButtonToggled:(id)sender; -#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) -// This method is a part of a public API as of Mac OS X 10.6. Only use this -// hack for earlier versions of Mac OS X. -- (void)setShowsHiddenFiles:(BOOL)show; -#endif @end @@ -158,3 +153,6 @@ NSView *showHiddenFilesView(); // http://www.unicode.org/reports/tr15/ NSString *normalizeFilename(NSString *filename); NSArray *normalizeFilenames(NSArray *filenames); + + +BOOL shouldUseYosemiteTabBarStyle(); diff --git a/src/MacVim/Miscellaneous.m b/src/MacVim/Miscellaneous.m index 9d719e49a4..10313e4b0e 100644 --- a/src/MacVim/Miscellaneous.m +++ b/src/MacVim/Miscellaneous.m @@ -29,9 +29,9 @@ NSString *MMTopLeftPointKey = @"MMTopLeftPoint"; NSString *MMOpenInCurrentWindowKey = @"MMOpenInCurrentWindow"; NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution"; +NSString *MMNoTitleBarWindowKey = @"MMNoTitleBarWindow"; NSString *MMLoginShellKey = @"MMLoginShell"; NSString *MMUntitledWindowKey = @"MMUntitledWindow"; -NSString *MMTexturedWindowKey = @"MMTexturedWindow"; NSString *MMZoomBothKey = @"MMZoomBoth"; NSString *MMCurrentPreferencePaneKey = @"MMCurrentPreferencePane"; NSString *MMLoginShellCommandKey = @"MMLoginShellCommand"; @@ -46,6 +46,10 @@ #endif // INCLUDE_OLD_IM_CODE NSString *MMSuppressTerminationAlertKey = @"MMSuppressTerminationAlert"; NSString *MMNativeFullScreenKey = @"MMNativeFullScreen"; +NSString *MMUseMouseTimeKey = @"MMUseMouseTime"; +NSString *MMFullScreenFadeTimeKey = @"MMFullScreenFadeTime"; +NSString *MMUseCGLayerAlwaysKey = @"MMUseCGLayerAlways"; +NSString *MMIgnoreShiftSpaceKey = @"MMIgnoreShiftSpace"; @@ -100,32 +104,6 @@ - (void)hiddenFilesButtonToggled:(id)sender [self setShowsHiddenFiles:[sender intValue]]; } -#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6) -// This method is a part of a public API as of Mac OS X 10.6. Only use this -// hack for earlier versions of Mac OS X. -- (void)setShowsHiddenFiles:(BOOL)show -{ - // This is undocumented stuff, so be careful. This does the same as - // [[self _navView] setShowsHiddenFiles:show]; - // but does not produce warnings. - - if (![self respondsToSelector:@selector(_navView)]) - return; - - id navView = [self performSelector:@selector(_navView)]; - if (![navView respondsToSelector:@selector(setShowsHiddenFiles:)]) - return; - - // performSelector:withObject: does not support a BOOL - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: - [navView methodSignatureForSelector:@selector(setShowsHiddenFiles:)]]; - [invocation setTarget:navView]; - [invocation setSelector:@selector(setShowsHiddenFiles:)]; - [invocation setArgument:&show atIndex:2]; - [invocation invoke]; -} -#endif - @end // NSSavePanel (MMExtras) @@ -284,7 +262,7 @@ - (NSInteger)tag [button setAction:@selector(hiddenFilesButtonToggled:)]; // Use the regular control size (checkbox is a bit smaller without this) - NSControlSize buttonSize = NSRegularControlSize; + NSControlSize buttonSize = NSControlSizeRegular; float fontSize = [NSFont systemFontSizeForControlSize:buttonSize]; NSCell *theCell = [button cell]; NSFont *theFont = [NSFont fontWithName:[[theCell font] fontName] @@ -320,3 +298,12 @@ - (NSInteger)tag return outnames; } + + + + + BOOL +shouldUseYosemiteTabBarStyle() +{ + return floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10; +} diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj index cc503a2624..4879607e7f 100644 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj +++ b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 46; objects = { /* Begin PBXAggregateTarget section */ @@ -35,6 +35,10 @@ 52C0B9B515BDB7A9000C268F /* overflowImagePressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C0B9B315BDB7A9000C268F /* overflowImagePressed@2x.png */; }; 52C268D015BDB72B0012FECA /* overflowImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C268CE15BDB72B0012FECA /* overflowImage.png */; }; 52C268D115BDB72B0012FECA /* overflowImagePressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C268CF15BDB72B0012FECA /* overflowImagePressed.png */; }; + 52FAFCCF1C30F4B500C6E613 /* TabNewYosemite.png in Resources */ = {isa = PBXBuildFile; fileRef = 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */; }; + 52FAFCD01C30F4B500C6E613 /* TabNewYosemite@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */; }; + 52FAFCD31C30F4DF00C6E613 /* PSMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */; }; + 52FAFCD41C30F4DF00C6E613 /* PSMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */; }; 546DEAF1067F63070098DCC4 /* PSMTabBarControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 0259C576FE90428111CA0C5A /* PSMTabBarControl.m */; }; 546DEAF2067F630E0098DCC4 /* PSMTabBarControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0259C57AFE90428111CA0C5A /* PSMTabBarControl.h */; settings = {ATTRIBUTES = (Public, ); }; }; A2082A9009EAEB34009AC8BE /* PSMTabDragAssistant.h in Headers */ = {isa = PBXBuildFile; fileRef = A2082A8D09EAEB33009AC8BE /* PSMTabDragAssistant.h */; }; @@ -57,8 +61,6 @@ A27E47880A28EE7C007BA395 /* TabControlRep.tif in Resources */ = {isa = PBXBuildFile; fileRef = A20822EF0959F6AA00C5F5A4 /* TabControlRep.tif */; }; A2C0D99509AF870000ED379C /* pi.png in Resources */ = {isa = PBXBuildFile; fileRef = A2C0D99309AF870000ED379C /* pi.png */; }; A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */; }; - A2D32EE809A6399300EC8662 /* PSMAquaTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */; }; - A2D32EE909A6399300EC8662 /* PSMAquaTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */; }; A2D32EF709A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF009A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif */; }; A2D32EF809A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF109A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif */; }; A2D32EF909A63BF700EC8662 /* AquaTabClose_Front.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF209A63BF700EC8662 /* AquaTabClose_Front.tif */; }; @@ -113,6 +115,10 @@ 52C0B9B315BDB7A9000C268F /* overflowImagePressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "overflowImagePressed@2x.png"; path = "images/overflowImagePressed@2x.png"; sourceTree = "<group>"; }; 52C268CE15BDB72B0012FECA /* overflowImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = overflowImage.png; path = images/overflowImage.png; sourceTree = "<group>"; }; 52C268CF15BDB72B0012FECA /* overflowImagePressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = overflowImagePressed.png; path = images/overflowImagePressed.png; sourceTree = "<group>"; }; + 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabNewYosemite.png; path = images/TabNewYosemite.png; sourceTree = "<group>"; }; + 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabNewYosemite@2x.png"; path = "images/TabNewYosemite@2x.png"; sourceTree = "<group>"; }; + 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMYosemiteTabStyle.h; path = source/PSMYosemiteTabStyle.h; sourceTree = "<group>"; }; + 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMYosemiteTabStyle.m; path = source/PSMYosemiteTabStyle.m; sourceTree = "<group>"; }; 53DF68FD067E5B5A0090B5B0 /* PSMTabBarControl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PSMTabBarControl.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 53DF68FE067E5B5A0090B5B0 /* PSMTabBarControlFramework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PSMTabBarControlFramework-Info.plist"; sourceTree = "<group>"; }; 54D33B2806778E3300C9C163 /* PSMTabBarControl.ibclassdescription */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PSMTabBarControl.ibclassdescription; sourceTree = "<group>"; }; @@ -155,8 +161,6 @@ A2A711BE09E5BF0500D0089B /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WindowController.m; path = source/WindowController.m; sourceTree = "<group>"; }; A2C0D99309AF870000ED379C /* pi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = pi.png; path = images/pi.png; sourceTree = "<group>"; }; A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMTabStyle.h; path = source/PSMTabStyle.h; sourceTree = "<group>"; }; - A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMAquaTabStyle.h; path = source/PSMAquaTabStyle.h; sourceTree = "<group>"; }; - A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMAquaTabStyle.m; path = source/PSMAquaTabStyle.m; sourceTree = "<group>"; }; A2D32EF009A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front_Pressed.tif; path = images/AquaTabClose_Front_Pressed.tif; sourceTree = "<group>"; }; A2D32EF109A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front_Rollover.tif; path = images/AquaTabClose_Front_Rollover.tif; sourceTree = "<group>"; }; A2D32EF209A63BF700EC8662 /* AquaTabClose_Front.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front.tif; path = images/AquaTabClose_Front.tif; sourceTree = "<group>"; }; @@ -309,12 +313,12 @@ A251BE830959A1B90058BC7F /* PSMTabBarCell.h */, A251BE840959A1B90058BC7F /* PSMTabBarCell.m */, A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */, - A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */, - A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */, A2D32EFE09A63D7A00EC8662 /* PSMMetalTabStyle.h */, A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */, A2D98B070A2B432C0064C6F8 /* PSMUnifiedTabStyle.h */, A2D98B080A2B432C0064C6F8 /* PSMUnifiedTabStyle.m */, + 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */, + 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */, A268EA5F09A9831800E082AA /* PSMRolloverButton.h */, A268EA6009A9831800E082AA /* PSMRolloverButton.m */, A251BE810959A1B90058BC7F /* PSMOverflowPopUpButton.h */, @@ -388,6 +392,8 @@ 523897EE15BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png */, 52A57C0E15BBA230003EC59C /* TabClose_Front_Rollover.png */, 523897EF15BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png */, + 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */, + 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */, ); name = Images; sourceTree = "<group>"; @@ -402,8 +408,8 @@ 546DEAF2067F630E0098DCC4 /* PSMTabBarControl.h in Headers */, A251BE850959A1B90058BC7F /* PSMOverflowPopUpButton.h in Headers */, A251BE870959A1B90058BC7F /* PSMTabBarCell.h in Headers */, + 52FAFCD31C30F4DF00C6E613 /* PSMYosemiteTabStyle.h in Headers */, A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */, - A2D32EE809A6399300EC8662 /* PSMAquaTabStyle.h in Headers */, A2D32F0009A63D7A00EC8662 /* PSMMetalTabStyle.h in Headers */, A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */, A2129BB209AEB58F00724E6C /* PSMProgressIndicator.h in Headers */, @@ -439,8 +445,11 @@ /* Begin PBXProject section */ 0259C573FE90428111CA0C5A /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0710; + }; buildConfigurationList = C056398B08A954F8003078D8 /* Build configuration list for PBXProject "PSMTabBarControl" */; - compatibilityVersion = "Xcode 2.4"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -482,8 +491,10 @@ 52A57C0F15BBA230003EC59C /* TabClose_Front.png in Resources */, 52A57C1015BBA230003EC59C /* TabClose_Front_Pressed.png in Resources */, 52A57C1115BBA230003EC59C /* TabClose_Front_Rollover.png in Resources */, + 52FAFCCF1C30F4B500C6E613 /* TabNewYosemite.png in Resources */, 523897F415BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png in Resources */, 523897F515BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png in Resources */, + 52FAFCD01C30F4B500C6E613 /* TabNewYosemite@2x.png in Resources */, 523897F615BDA9AC00498A53 /* TabClose_Front@2x.png in Resources */, 523897F715BDA9AC00498A53 /* TabNewMetal@2x.png in Resources */, 523897F815BDA9AC00498A53 /* TabNewMetalPressed@2x.png in Resources */, @@ -505,11 +516,11 @@ 546DEAF1067F63070098DCC4 /* PSMTabBarControl.m in Sources */, A251BE860959A1B90058BC7F /* PSMOverflowPopUpButton.m in Sources */, A251BE880959A1B90058BC7F /* PSMTabBarCell.m in Sources */, - A2D32EE909A6399300EC8662 /* PSMAquaTabStyle.m in Sources */, A2D32F0109A63D7A00EC8662 /* PSMMetalTabStyle.m in Sources */, A268EA6309A9831800E082AA /* PSMRolloverButton.m in Sources */, A2129BB309AEB58F00724E6C /* PSMProgressIndicator.m in Sources */, A2082A9109EAEB34009AC8BE /* PSMTabDragAssistant.m in Sources */, + 52FAFCD41C30F4DF00C6E613 /* PSMYosemiteTabStyle.m in Sources */, A2D98B0B0A2B432C0064C6F8 /* PSMUnifiedTabStyle.m in Sources */, A2D98B130A2B43FA0064C6F8 /* NSBezierPath_AMShading.m in Sources */, ); @@ -572,7 +583,7 @@ C056398008A954F8003078D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -588,6 +599,7 @@ INSTALL_PATH = "@executable_path/../Frameworks"; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = com.positivespinmedia.PSMTabBarControlFramework; PRODUCT_NAME = PSMTabBarControl; SYMROOT = ../build; ZERO_LINK = NO; @@ -597,7 +609,7 @@ C056398108A954F8003078D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; @@ -610,6 +622,7 @@ INSTALL_PATH = "@executable_path/../Frameworks"; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = com.positivespinmedia.PSMTabBarControlFramework; PRODUCT_NAME = PSMTabBarControl; SYMROOT = ../build; }; @@ -636,10 +649,6 @@ C056398908A954F8003078D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; PRODUCT_NAME = All; @@ -654,7 +663,7 @@ C056398C08A954F8003078D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + ENABLE_TESTABILITY = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; @@ -666,7 +675,6 @@ C056398D08A954F8003078D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist b/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist index f7840b712b..3e49e9a9d0 100644 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist +++ b/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>PSMTabBarControl</string> <key>CFBundleIdentifier</key> - <string>com.positivespinmedia.PSMTabBarControlFramework</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> diff --git a/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png b/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png new file mode 100644 index 0000000000..a85cf21369 Binary files /dev/null and b/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png b/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png new file mode 100644 index 0000000000..9f2b024011 Binary files /dev/null and b/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h deleted file mode 100644 index e8229570ec..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// PSMAquaTabStyle.h -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import <Cocoa/Cocoa.h> -#import "PSMTabStyle.h" - -@interface PSMAquaTabStyle : NSObject <PSMTabStyle> { - NSImage *aquaTabBg; - NSImage *aquaTabBgDown; - NSImage *aquaTabBgDownGraphite; - NSImage *aquaTabBgDownNonKey; - NSImage *aquaDividerDown; - NSImage *aquaDivider; - NSImage *aquaCloseButton; - NSImage *aquaCloseButtonDown; - NSImage *aquaCloseButtonOver; - NSImage *_addTabButtonImage; - NSImage *_addTabButtonPressedImage; - NSImage *_addTabButtonRolloverImage; - NSMutableParagraphStyle *truncatingTailParagraphStyle; - NSMutableParagraphStyle *centeredParagraphStyle; -} - -- (void)loadImages; -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m deleted file mode 100644 index 158f79b9cb..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m +++ /dev/null @@ -1,513 +0,0 @@ -// -// PSMAquaTabStyle.m -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import "PSMAquaTabStyle.h" -#import "PSMTabBarCell.h" -#import "PSMTabBarControl.h" - -#define kPSMAquaObjectCounterRadius 7.0 -#define kPSMAquaCounterMinWidth 20 - -@implementation PSMAquaTabStyle - -- (NSString *)name -{ - return @"Aqua"; -} - -#pragma mark - -#pragma mark Creation/Destruction - -- (id) init -{ - if((self = [super init])) - { - [self loadImages]; - } - return self; -} - -- (void) loadImages -{ - // Aqua Tabs Images - aquaTabBg = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsBackground"]]; - [aquaTabBg setFlipped:YES]; - - aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDown"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownGraphite"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownNonKey"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparatorDown"]]; - [aquaDivider setFlipped:NO]; - - aquaDivider = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparator"]]; - [aquaDivider setFlipped:NO]; - - aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]]; - aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; - aquaCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; - - _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNew"]]; - _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewPressed"]]; - _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]]; -} - -- (void)dealloc -{ - [aquaTabBg release]; - [aquaTabBgDown release]; - [aquaDividerDown release]; - [aquaDivider release]; - [aquaCloseButton release]; - [aquaCloseButtonDown release]; - [aquaCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} - -#pragma mark - -#pragma mark Control Specifics - -- (float)leftMarginForTabBarControl -{ - return 0.0f; -} - -- (float)rightMarginForTabBarControl -{ - return 24.0f; -} - -#pragma mark - -#pragma mark Add Tab Button - -- (NSImage *)addTabButtonImage -{ - return _addTabButtonImage; -} - -- (NSImage *)addTabButtonPressedImage -{ - return _addTabButtonPressedImage; -} - -- (NSImage *)addTabButtonRolloverImage -{ - return _addTabButtonRolloverImage; -} - -#pragma mark - -#pragma mark Cell Specifics - -- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasCloseButton] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = [aquaCloseButton size]; - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0; - - return result; -} - -- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasIcon] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth); - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - result.origin.x += [aquaCloseButton size].width + kPSMTabBarCellPadding; - - return result; -} - -- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([[cell indicator] isHidden]) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth); - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - return result; -} - -- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell count] == 0) { - return NSZeroRect; - } - - float countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width; - countWidth += (2 * kPSMAquaObjectCounterRadius - 6.0); - if(countWidth < kPSMAquaCounterMinWidth) - countWidth = kPSMAquaCounterMinWidth; - - NSRect result; - result.size = NSMakeSize(countWidth, 2 * kPSMAquaObjectCounterRadius); // temp - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if(![[cell indicator] isHidden]) - result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding; - - return result; -} - -- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += kPSMMinimumTitleWidth; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += [[cell attributedStringValue] size].width; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -#pragma mark - -#pragma mark Cell Values - -- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; - [nf setLocalizesFormat:YES]; - [nf setFormat:@"0"]; - [nf setHasThousandSeparators:YES]; - NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[fm convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask] range:range]; - [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor whiteColor] colorWithAlphaComponent:0.85] range:range]; - - return attrStr; -} - -- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSString * contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - - // Paragraph Style for Truncating Long Text - if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; - [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; - - return attrStr; -} - -#pragma mark - -#pragma mark Drawing - -- (void)drawTabCell:(PSMTabBarCell *)cell; -{ - NSRect cellFrame = [cell frame]; - - // Selected Tab - if ([cell state] == NSOnState) { - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5); - aRect.size.height -= 0.5; - - // proper tint - NSControlTint currentTint; - if ([cell controlTint] == NSDefaultControlTint) - currentTint = [NSColor currentControlTint]; - else - currentTint = [cell controlTint]; - - if (![[[cell controlView] window] isKeyWindow]) - currentTint = NSClearControlTint; - - NSImage *bgImage; - switch(currentTint){ - case NSGraphiteControlTint: - bgImage = aquaTabBgDownGraphite; - break; - case NSClearControlTint: - bgImage = aquaTabBgDownNonKey; - break; - case NSBlueControlTint: - default: - bgImage = aquaTabBgDown; - break; - } - - [bgImage drawInRect:cellFrame fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0]; - [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - - aRect.size.height+=0.5; - - } else { // Unselected Tab - - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); - aRect.origin.y += 0.5; - aRect.origin.x += 1.5; - aRect.size.width -= 1; - - aRect.origin.x -= 1; - aRect.size.width += 1; - - // Rollover - if ([cell isHighlighted]) { - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); - } - - [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - } - - [self drawInteriorWithTabCell:cell inView:[cell controlView]]; -} - -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect -{ - [aquaTabBg drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0]; - - // no tab view == not connected - if(![bar tabView]){ - NSRect labelRect = rect; - labelRect.size.height -= 4.0; - labelRect.origin.y += 4.0; - NSMutableAttributedString *attrStr; - NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; - [attrStr drawInRect:labelRect]; - return; - } - - // Draw cells - NSEnumerator *e = [[bar cells] objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - if(![cell isInOverflowMenu]){ - [cell drawWithFrame:[cell frame] inView:bar]; - } - } -} - -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView -{ - NSRect cellFrame = [cell frame]; - float labelPosition = cellFrame.origin.x + MARGIN_X; - - // close button - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) { - NSSize closeButtonSize = NSZeroSize; - NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; - NSImage *closeButton = nil; - - closeButton = aquaCloseButton; - if([cell closeButtonOver]) closeButton = aquaCloseButtonOver; - if([cell closeButtonPressed]) closeButton = aquaCloseButtonDown; - - closeButtonSize = [closeButton size]; - [closeButton setFlipped:YES]; - [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - - // scoot label over - labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; - } - -#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best. - // icon - if([cell hasIcon]){ - NSRect iconRect = [self iconRectForTabCell:cell]; - NSImage *icon = [[[[cell representedObject] identifier] content] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y = cellFrame.size.height - iconRect.origin.y; - } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - - // scoot label over - labelPosition += iconRect.size.width + kPSMTabBarCellPadding; - } -#endif - - // object counter - if([cell count] > 0){ - [[NSColor colorWithCalibratedWhite:0.3 alpha:0.45] set]; - NSBezierPath *path = [NSBezierPath bezierPath]; - NSRect myRect = [self objectCounterRectForTabCell:cell]; - [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y)]; - [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius startAngle:270.0 endAngle:90.0]; - [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + myRect.size.height)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius startAngle:90.0 endAngle:270.0]; - [path fill]; - - // draw attributed string centered in area - NSRect counterStringRect; - NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell]; - counterStringRect.size = [counterString size]; - counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25; - counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5; - [counterString drawInRect:counterStringRect]; - } - - // label rect - NSRect labelRect; - labelRect.origin.x = labelPosition; - labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; - labelRect.size.height = cellFrame.size.height; - labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if(![[cell indicator] isHidden]) - labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); - - if([cell count] > 0) - labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); - - // Draw Label - [[cell attributedStringValue] drawInRect:labelRect]; -} - -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:aquaTabBg forKey:@"aquaTabBg"]; - [aCoder encodeObject:aquaTabBgDown forKey:@"aquaTabBgDown"]; - [aCoder encodeObject:aquaTabBgDownGraphite forKey:@"aquaTabBgDownGraphite"]; - [aCoder encodeObject:aquaTabBgDownNonKey forKey:@"aquaTabBgDownNonKey"]; - [aCoder encodeObject:aquaDividerDown forKey:@"aquaDividerDown"]; - [aCoder encodeObject:aquaDivider forKey:@"aquaDivider"]; - [aCoder encodeObject:aquaCloseButton forKey:@"aquaCloseButton"]; - [aCoder encodeObject:aquaCloseButtonDown forKey:@"aquaCloseButtonDown"]; - [aCoder encodeObject:aquaCloseButtonOver forKey:@"aquaCloseButtonOver"]; - [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"]; - [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"]; - [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - //self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - aquaTabBg = [[aDecoder decodeObjectForKey:@"aquaTabBg"] retain]; - aquaTabBgDown = [[aDecoder decodeObjectForKey:@"aquaTabBgDown"] retain]; - aquaTabBgDownGraphite = [[aDecoder decodeObjectForKey:@"aquaTabBgDownGraphite"] retain]; - aquaTabBgDownNonKey = [[aDecoder decodeObjectForKey:@"aquaTabBgDownNonKey"] retain]; - aquaDividerDown = [[aDecoder decodeObjectForKey:@"aquaDividerDown"] retain]; - aquaDivider = [[aDecoder decodeObjectForKey:@"aquaDivider"] retain]; - aquaCloseButton = [[aDecoder decodeObjectForKey:@"aquaCloseButton"] retain]; - aquaCloseButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseButtonDown"] retain]; - aquaCloseButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; - } - //} - return self; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m index 53fa26b567..fc1c5fae89 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m @@ -303,7 +303,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell if (!truncatingTailParagraphStyle) { truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; - [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; + [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; @@ -356,7 +356,7 @@ - (void)drawTabCell:(PSMTabBarCell *)cell // rollover if ([cell isHighlighted]) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); } aRect.origin.x -= 1; @@ -393,8 +393,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown; closeButtonSize = [closeButton size]; - [closeButton setFlipped:YES]; - [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; @@ -463,7 +462,7 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect { MyNSDrawWindowBackground(rect); [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(rect, NSCompositeSourceAtop); + NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); [[NSColor darkGrayColor] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; @@ -480,7 +479,7 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index 5e8265f91a..2b36b745e2 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -40,11 +40,14 @@ - (void)drawRect:(NSRect)rect } NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage; - NSSize imageSize = [image size]; - rect.origin.x = NSMidX(rect) - (imageSize.width * 0.5); - rect.origin.y = NSMidY(rect) - (imageSize.height * 0.5); - [image setFlipped:YES]; - [image drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; + NSSize imageSize = [image size]; + NSRect bounds = [self bounds]; + NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), + NSMidY(bounds) - (imageSize.height * 0.5f)); + [image drawAtPoint:drawPoint + fromRect:NSZeroRect + operation:NSCompositingOperationSourceOver + fraction:1.0f]; } - (void)mouseDown:(NSEvent *)event diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m index 9e57a7f42b..65b3b25052 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m @@ -296,7 +296,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { if(_isPlaceholder){ [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); + NSRectFillUsingOperation(cellFrame, NSCompositingOperationSourceAtop); return; } @@ -344,7 +344,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame [image addRepresentation:rep]; NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; [returnImage lockFocus]; - [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7]; + [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; if(![[self indicator] isHidden]){ NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]]; @@ -352,7 +352,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y); if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"])) indicatorPoint.y += 1.0; - [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7]; + [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; [pi release]; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h index f797804afe..4b320f4c8d 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h @@ -12,22 +12,24 @@ #import <Cocoa/Cocoa.h> -#ifndef NSINTEGER_DEFINED -// NSInteger was introduced in 10.5 -# if __LP64__ || NS_BUILD_32_LIKE_64 -typedef long NSInteger; -typedef unsigned long NSUInteger; -# else -typedef int NSInteger; -typedef unsigned int NSUInteger; -# endif -# define NSINTEGER_DEFINED 1 +#if !defined(MAC_OS_X_VERSION_10_12) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +# define NSCompositingOperationSourceOver NSCompositeSourceOver +# define NSCompositingOperationSourceAtop NSCompositeSourceAtop +# define NSTextAlignmentCenter NSCenterTextAlignment +#endif +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 +# define kPSMTabBarControlHeight 25 +#else +# define kPSMTabBarControlHeight 22 #endif - -#define kPSMTabBarControlHeight 22 // internal cell border #define MARGIN_X 6 -#define MARGIN_Y 3 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 +# define MARGIN_Y 5 +#else +# define MARGIN_Y 3 +#endif // padding between objects #define kPSMTabBarCellPadding 4 // fixed size objects diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index 05ed3b4700..8a04234814 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -12,8 +12,8 @@ #import "PSMRolloverButton.h" #import "PSMTabStyle.h" #import "PSMMetalTabStyle.h" -#import "PSMAquaTabStyle.h" #import "PSMUnifiedTabStyle.h" +#import "PSMYosemiteTabStyle.h" #import "PSMTabDragAssistant.h" @interface PSMTabBarControl (Private) @@ -255,13 +255,11 @@ - (NSString *)styleName - (void)setStyleNamed:(NSString *)name { [style release]; - if([name isEqualToString:@"Aqua"]){ - style = [[PSMAquaTabStyle alloc] init]; - } - else if ([name isEqualToString:@"Unified"]){ - style = [[PSMUnifiedTabStyle alloc] init]; - } - else { + if([name isEqualToString:@"Unified"]){ + style = [[PSMUnifiedTabStyle alloc] init]; + } else if([name isEqualToString:@"Yosemite"]){ + style = [[PSMYosemiteTabStyle alloc] init]; + } else { style = [[PSMMetalTabStyle alloc] init]; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m index c16264f40e..56a60d3fab 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m @@ -336,7 +336,7 @@ - (void)drawTabCell:(PSMTabBarCell *)cell if ([cell isHighlighted]) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); } // frame @@ -389,9 +389,8 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown; closeButtonSize = [closeButton size]; - [closeButton setFlipped:YES]; - [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; } @@ -474,7 +473,7 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h new file mode 100644 index 0000000000..2f3581132f --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h @@ -0,0 +1,28 @@ +// +// PSMYosemiteTabStyle.h +// PSMTabBarControl +// +// Created by Christoffer Winterkvist on 25/08/14. +// +// + +#import <Cocoa/Cocoa.h> +#import "PSMTabStyle.h" + +@interface PSMYosemiteTabStyle : NSObject <PSMTabStyle> { + NSImage *closeButton; + NSImage *closeButtonDown; + NSImage *closeButtonOver; + NSImage *_addTabButtonImage; + NSImage *_addTabButtonPressedImage; + NSImage *_addTabButtonRolloverImage; + NSMutableParagraphStyle *truncatingTailParagraphStyle; + NSMutableParagraphStyle *centeredParagraphStyle; +} + +- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; + +- (void)encodeWithCoder:(NSCoder *)aCoder; +- (id)initWithCoder:(NSCoder *)aDecoder; + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m new file mode 100644 index 0000000000..f51cceed44 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m @@ -0,0 +1,498 @@ +// +// PSMYosemiteTabStyle.m +// PSMTabBarControl +// +// Created by Christoffer Winterkvist on 25/08/14. +// +// + +#import "PSMYosemiteTabStyle.h" + +#define kPSMMetalObjectCounterRadius 7.0 +#define kPSMMetalCounterMinWidth 20 + +void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) +{ + [color set]; + NSRectFill( rect ); +} + +@implementation PSMYosemiteTabStyle + +- (void)dealloc +{ + [closeButton release]; + [closeButtonDown release]; + [closeButtonOver release]; + [_addTabButtonImage release]; + [_addTabButtonPressedImage release]; + [_addTabButtonRolloverImage release]; + + [truncatingTailParagraphStyle release]; + [centeredParagraphStyle release]; + + [super dealloc]; +} + +#pragma mark - +#pragma mark Initializers + +- (id)init +{ + self = [super init]; + if (!self) return nil; + + closeButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]]; + //NSLog(@"closeButton=%@ path=%@", metalCloseButton, + // [[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]); + closeButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Pressed"]]; + closeButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Rollover"]]; + + _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetal"]]; + _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalPressed"]]; + _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalRollover"]]; + + return self; +} + +- (NSString *)name +{ + return @"Yosemite"; +} + +#pragma mark - +#pragma mark Control Specific + +- (float)leftMarginForTabBarControl +{ + return -1.0f; +} + +- (float)rightMarginForTabBarControl +{ + return 24.0f; +} + +#pragma mark - +#pragma mark Add Tab Button + +- (NSImage *)addTabButtonImage +{ + return _addTabButtonImage; +} + +- (NSImage *)addTabButtonPressedImage +{ + return _addTabButtonPressedImage; +} + +- (NSImage *)addTabButtonRolloverImage +{ + return _addTabButtonRolloverImage; +} + +- (NSColor *)backgroundColor:(BOOL)isKeyWindow +{ + NSColor *backgroundColor; + if (isKeyWindow) { + backgroundColor = [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.875 alpha:1]; + } else { + backgroundColor = [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.957 alpha:1]; + } + + return backgroundColor; +} + +- (NSColor *)borderColor +{ + return [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.678 alpha:1]; +} + +#pragma mark - +#pragma mark Cell Specific + +- (NSRect) closeButtonRectForTabCell:(PSMTabBarCell *)cell +{ + NSRect cellFrame = [cell frame]; + + if ([cell hasCloseButton] == NO) { + return NSZeroRect; + } + + NSRect result; + result.size = [closeButton size]; + result.origin.x = cellFrame.origin.x + MARGIN_X; + result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0; + + return result; +} + +- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell +{ + NSRect cellFrame = [cell frame]; + + if ([cell hasIcon] == NO) { + return NSZeroRect; + } + + NSRect result; + result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth); + result.origin.x = cellFrame.origin.x + MARGIN_X; + result.origin.y = cellFrame.origin.y + MARGIN_Y; + + if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) + result.origin.x += [closeButton size].width + kPSMTabBarCellPadding; + + if([cell state] == NSOnState){ + result.origin.y += 1; + } + + return result; +} + +- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell +{ + NSRect cellFrame = [cell frame]; + + if ([[cell indicator] isHidden]) { + return NSZeroRect; + } + + NSRect result; + result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth); + result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth; + result.origin.y = cellFrame.origin.y + MARGIN_Y; + + if([cell state] == NSOnState){ + result.origin.y -= 1; + } + + return result; +} + +- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell +{ + NSRect cellFrame = [cell frame]; + + if ([cell count] == 0) { + return NSZeroRect; + } + + float countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width; + countWidth += (2 * kPSMMetalObjectCounterRadius - 6.0); + if(countWidth < kPSMMetalCounterMinWidth) + countWidth = kPSMMetalCounterMinWidth; + + NSRect result; + result.size = NSMakeSize(countWidth, 2 * kPSMMetalObjectCounterRadius); // temp + result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width; + result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; + + if(![[cell indicator] isHidden]) + result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding; + + return result; +} + + +- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell +{ + float resultWidth = 0.0; + + // left margin + resultWidth = MARGIN_X; + + // close button? + if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) + resultWidth += [closeButton size].width + kPSMTabBarCellPadding; + + // icon? + if([cell hasIcon]) + resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; + + // the label + resultWidth += kPSMMinimumTitleWidth; + + // object counter? + if([cell count] > 0) + resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; + + // indicator? + if ([[cell indicator] isHidden] == NO) + resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; + + // right margin + resultWidth += MARGIN_X; + + return ceil(resultWidth); +} + +- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell +{ + float resultWidth = 0.0; + + // left margin + resultWidth = MARGIN_X; + + // close button? + if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) + resultWidth += [closeButton size].width + kPSMTabBarCellPadding; + + // icon? + if([cell hasIcon]) + resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; + + // the label + resultWidth += [[cell attributedStringValue] size].width; + + // object counter? + if([cell count] > 0) + resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; + + // indicator? + if ([[cell indicator] isHidden] == NO) + resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; + + // right margin + resultWidth += MARGIN_X; + + return ceil(resultWidth); +} + +#pragma mark - +#pragma mark Cell Values + +- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell +{ + NSMutableAttributedString *attrStr; + NSFontManager *fm = [NSFontManager sharedFontManager]; + NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; + [nf setLocalizesFormat:YES]; + [nf setFormat:@"0"]; + [nf setHasThousandSeparators:YES]; + NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; + attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + NSRange range = NSMakeRange(0, [contents length]); + + // Add font attribute + [attrStr addAttribute:NSFontAttributeName value:[fm convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask] range:range]; + [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor whiteColor] colorWithAlphaComponent:0.85] range:range]; + + return attrStr; +} + +- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell +{ + NSMutableAttributedString *attrStr; + NSString *contents = [cell stringValue]; + attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + NSRange range = NSMakeRange(0, [contents length]); + + // Add font attribute + [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; + + PSMTabBarControl *bar = (PSMTabBarControl *)cell.controlView; + BOOL isKeyWindow = [bar.window isKeyWindow]; + + CGFloat textAlpha; + if ([cell state] == NSOnState) { + textAlpha = (isKeyWindow) ? 1.0f : 0.5f; + } else { + textAlpha = (isKeyWindow) ? 0.5f : 0.25f; + } + NSColor *textColor = [[NSColor textColor] colorWithAlphaComponent:textAlpha]; + + [attrStr addAttribute:NSForegroundColorAttributeName value:textColor range:range]; + + // Paragraph Style for Truncating Long Text + if (!truncatingTailParagraphStyle) { + truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; + [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; + } + [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; + + return attrStr; +} + +#pragma mark - +#pragma mark ---- drawing ---- + +- (void)drawTabCell:(PSMTabBarCell *)cell +{ + NSRect cellFrame = [cell frame]; + NSColor * lineColor = nil; + NSBezierPath* bezier = [NSBezierPath bezierPath]; + lineColor = [self borderColor]; + + if ([cell state] == NSOnState) { + // selected tab + NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); + + PSMTabBarControl *bar = (PSMTabBarControl *)cell.controlView; + BOOL isKeyWindow = [bar.window isKeyWindow]; + + // background + YosemiteNSDrawWindowBackground(aRect, [self backgroundColor:isKeyWindow]); + + aRect.size.height -= 1.0f; + aRect.origin.y += 0.5f; + // frame + [lineColor set]; + [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; + [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+aRect.size.height)]; + [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+aRect.size.height)]; + [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y)]; + [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; + [bezier stroke]; + } else { + + // unselected tab + NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); + + aRect.origin.x += 0.5; + + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); + + // frame + [lineColor set]; + [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; + [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)]; + if(!([cell tabState] & PSMTab_RightIsSelectedMask)){ + [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)]; + } + [bezier stroke]; + } + + [self drawInteriorWithTabCell:cell inView:[cell controlView]]; +} + + + +- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView +{ + NSRect cellFrame = [cell frame]; + float labelPosition = cellFrame.origin.x + MARGIN_X; + + // close button + if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) { + NSSize closeButtonSize = NSZeroSize; + NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; + NSImage *button = nil; + + if ([cell closeButtonOver]) button = closeButtonOver; + if ([cell closeButtonPressed]) button = closeButtonDown; + + closeButtonSize = [button size]; + [button drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + } + + // object counter + if([cell count] > 0){ + [[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set]; + NSBezierPath *path = [NSBezierPath bezierPath]; + NSRect myRect = [self objectCounterRectForTabCell:cell]; + [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y)]; + [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y)]; + [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:270.0 endAngle:90.0]; + [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + myRect.size.height)]; + [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:90.0 endAngle:270.0]; + [path fill]; + + // draw attributed string centered in area + NSRect counterStringRect; + NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell]; + counterStringRect.size = [counterString size]; + counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25; + counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5; + [counterString drawInRect:counterStringRect]; + } + + // label rect + NSRect labelRect; + labelRect.origin.x = labelPosition; + labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; + labelRect.size.height = cellFrame.size.height; + labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; + + if(![[cell indicator] isHidden]) + labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); + + if([cell count] > 0) + labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); + + // label + [[cell attributedStringValue] drawInRect:labelRect]; +} + +- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect +{ + BOOL isKeyWindow = [bar.window isKeyWindow]; + YosemiteNSDrawWindowBackground(rect, [self backgroundColor:isKeyWindow]); + + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.0] set]; + NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); + [[self borderColor] set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; + + // no tab view == not connected + if(![bar tabView]){ + NSRect labelRect = rect; + labelRect.size.height -= 4.0; + labelRect.origin.y += 4.0; + NSMutableAttributedString *attrStr; + NSString *contents = @"PSMTabBarControl"; + attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + NSRange range = NSMakeRange(0, [contents length]); + [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; + if (!centeredParagraphStyle) { + centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; + } + [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; + [attrStr drawInRect:labelRect]; + return; + } + + // draw cells + NSEnumerator *e = [[bar cells] objectEnumerator]; + PSMTabBarCell *cell; + while(cell = [e nextObject]){ + if(![cell isInOverflowMenu]){ + [cell drawWithFrame:[cell frame] inView:bar]; + } + } +} + +#pragma mark - +#pragma mark Archiving + +- (void)encodeWithCoder:(NSCoder *)aCoder +{ + if ([aCoder allowsKeyedCoding]) { + [aCoder encodeObject:closeButton forKey:@"metalCloseButton"]; + [aCoder encodeObject:closeButtonDown forKey:@"metalCloseButtonDown"]; + [aCoder encodeObject:closeButtonOver forKey:@"metalCloseButtonOver"]; + [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"]; + [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"]; + [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"]; + } +} + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + if ([aDecoder allowsKeyedCoding]) { + closeButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; + closeButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; + closeButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; + _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; + _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; + _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; + } + + return self; +} + +@end diff --git a/src/MacVim/README b/src/MacVim/README index 1a15597cfb..7c2018934f 100644 --- a/src/MacVim/README +++ b/src/MacVim/README @@ -162,18 +162,11 @@ be in when executing these commands): 1. Configure Vim (call "./configure --help" to see a list of flags) src/$ ./configure -2. Generate document icons (OPTIONAL) - src/MacVim/icons$ make getenvy - src/MacVim/icons$ make all - -3. Build +2. Build src/$ make The application bundle can be found inside "src/MacVim/build/Release". -If step 2 is skipped a generic document icon will be used for all file types. -It is also possible to download the document icons if this step fails. - Bjorn Winckler <bjorn.winckler@gmail.com> March 21, 2011 diff --git a/src/MacVim/Sparkle.framework/Modules b/src/MacVim/Sparkle.framework/Modules new file mode 120000 index 0000000000..5736f3186e --- /dev/null +++ b/src/MacVim/Sparkle.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/PrivateHeaders b/src/MacVim/Sparkle.framework/PrivateHeaders new file mode 120000 index 0000000000..d8e5645269 --- /dev/null +++ b/src/MacVim/Sparkle.framework/PrivateHeaders @@ -0,0 +1 @@ +Versions/Current/PrivateHeaders \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h deleted file mode 100644 index ee901e6854..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// NSApplication+AppCopies.h -// Sparkle -// -// Created by Andy Matuschak on 3/16/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -@interface NSApplication (SUAppCopies) -- (int)copiesRunning; -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h deleted file mode 100644 index c995911ca4..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// NSFileManager+Authentication.m -// Sparkle -// -// Created by Andy Matuschak on 3/9/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -@interface NSFileManager (SUAuthenticationAdditions) -- (BOOL)movePathWithAuthentication:(NSString *)src toPath:(NSString *)dst; -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h deleted file mode 100644 index f0ce7c20c0..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// NSFileManager+Verification.h -// Sparkle -// -// Created by Andy Matuschak on 3/16/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -// For the paranoid folks! -@interface NSFileManager (SUVerification) -- (BOOL)validatePath:(NSString *)path withMD5Hash:(NSString *)hash; -- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature; -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSString+extras.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/NSString+extras.h deleted file mode 100755 index 498e4d01c9..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/NSString+extras.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - -BSD License - -Copyright (c) 2002, Brent Simmons -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of ranchero.com or Brent Simmons nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ - - -/* - NSString+extras.h - NetNewsWire - - Created by Brent Simmons on Fri Jun 14 2002. - Copyright (c) 2002 Brent Simmons. All rights reserved. -*/ - - -#import <Foundation/Foundation.h> -#import <CoreFoundation/CoreFoundation.h> - - -@interface NSString (extras) - -- (NSString *)stringWithSubstitute:(NSString *)subs forCharactersFromSet:(NSCharacterSet *)set; - -- (NSString *) trimWhiteSpace; - -- (NSString *) stripHTML; - -- (NSString *) ellipsizeAfterNWords: (int) n; - -+ (BOOL) stringIsEmpty: (NSString *) s; - - -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/RSS.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/RSS.h deleted file mode 100755 index 82da04a443..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/RSS.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - -BSD License - -Copyright (c) 2002, Brent Simmons -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of ranchero.com or Brent Simmons nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ - -/* - RSS.h - A class for reading RSS feeds. - - Created by Brent Simmons on Wed Apr 17 2002. - Copyright (c) 2002 Brent Simmons. All rights reserved. -*/ - - -#import <Cocoa/Cocoa.h> -#import <CoreFoundation/CoreFoundation.h> -#import "NSString+extras.h" - - -@interface RSS : NSObject { - - NSDictionary *headerItems; - NSMutableArray *newsItems; - NSString *version; - - BOOL flRdf; - BOOL normalize; - } - - -/*Public*/ - -- (RSS *) initWithTitle: (NSString *) title andDescription: (NSString *) description; - -- (RSS *) initWithData: (NSData *) rssData normalize: (BOOL) fl; - -- (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl; -- (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl userAgent:(NSString *)userAgent; - -- (NSDictionary *) headerItems; - -- (NSMutableArray *) newsItems; - -- (NSString *) version; - -// AMM's extensions for Sparkle -- (NSDictionary *)newestItem; - - -/*Private*/ - -- (void) createheaderdictionary: (CFXMLTreeRef) tree; - -- (void) createitemsarray: (CFXMLTreeRef) tree; - -- (void) setversionstring: (CFXMLTreeRef) tree; - -- (void) flattenimagechildren: (CFXMLTreeRef) tree into: (NSMutableDictionary *) dictionary; - -- (void) flattensourceattributes: (CFXMLNodeRef) node into: (NSMutableDictionary *) dictionary; - -- (CFXMLTreeRef) getchanneltree: (CFXMLTreeRef) tree; - -- (CFXMLTreeRef) getnamedtree: (CFXMLTreeRef) currentTree name: (NSString *) name; - -- (void) normalizeRSSItem: (NSMutableDictionary *) rssItem; - -- (NSString *) getelementvalue: (CFXMLTreeRef) tree; - -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcast.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcast.h index 209fe20614..8f3efc8e80 100644 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcast.h +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcast.h @@ -6,22 +6,21 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import <Cocoa/Cocoa.h> +#ifndef SUAPPCAST_H +#define SUAPPCAST_H -@class RSS, SUAppcastItem; -@interface SUAppcast : NSObject { - NSArray *items; - id delegate; -} +#import <Foundation/Foundation.h> +#import "SUExport.h" -- (void)fetchAppcastFromURL:(NSURL *)url; -- (void)setDelegate:delegate; +@class SUAppcastItem; +SU_EXPORT @interface SUAppcast : NSObject<NSURLDownloadDelegate> -- (SUAppcastItem *)newestItem; -- (NSArray *)items; +@property (copy) NSString *userAgentString; +@property (copy) NSDictionary *httpHeaders; +- (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *))err; + +@property (readonly, copy) NSArray *items; @end -@interface NSObject (SUAppcastDelegate) -- appcastDidFinishLoading:(SUAppcast *)appcast; -@end \ No newline at end of file +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h index c0202e3d9e..86843bfb7e 100644 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h @@ -6,52 +6,39 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import <Cocoa/Cocoa.h> - - -@interface SUAppcastItem : NSObject { - NSString *title; - NSDate *date; - NSString *description; - - NSURL *releaseNotesURL; - - NSString *DSASignature; - NSString *MD5Sum; - - NSURL *fileURL; - NSString *fileVersion; - NSString *versionString; -} +#ifndef SUAPPCASTITEM_H +#define SUAPPCASTITEM_H + +#import <Foundation/Foundation.h> +#import "SUExport.h" + +SU_EXPORT @interface SUAppcastItem : NSObject +@property (copy, readonly) NSString *title; +@property (copy, readonly) NSDate *date; +@property (copy, readonly) NSString *itemDescription; +@property (strong, readonly) NSURL *releaseNotesURL; +@property (copy, readonly) NSString *DSASignature; +@property (copy, readonly) NSString *minimumSystemVersion; +@property (copy, readonly) NSString *maximumSystemVersion; +@property (strong, readonly) NSURL *fileURL; +@property (copy, readonly) NSString *versionString; +@property (copy, readonly) NSString *displayVersionString; +@property (copy, readonly) NSDictionary *deltaUpdates; +@property (strong, readonly) NSURL *infoURL; // Initializes with data from a dictionary provided by the RSS class. -- initWithDictionary:(NSDictionary *)dict; +- (instancetype)initWithDictionary:(NSDictionary *)dict; +- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString **)error; -- (NSString *)title; -- (void)setTitle:(NSString *)aTitle; +@property (getter=isDeltaUpdate, readonly) BOOL deltaUpdate; +@property (getter=isCriticalUpdate, readonly) BOOL criticalUpdate; +@property (getter=isInformationOnlyUpdate, readonly) BOOL informationOnlyUpdate; -- (NSDate *)date; -- (void)setDate:(NSDate *)aDate; +// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions. +@property (readonly, copy) NSDictionary *propertiesDictionary; -- (NSString *)description; -- (void)setDescription:(NSString *)aDescription; - -- (NSURL *)releaseNotesURL; -- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL; - -- (NSString *)DSASignature; -- (void)setDSASignature:(NSString *)aDSASignature; - -- (NSString *)MD5Sum; -- (void)setMD5Sum:(NSString *)aMd5Sum; - -- (NSURL *)fileURL; -- (void)setFileURL:(NSURL *)aFileURL; - -- (NSString *)fileVersion; -- (void)setFileVersion:(NSString *)aFileVersion; - -- (NSString *)versionString; -- (void)setVersionString:(NSString *)versionString; +- (NSURL *)infoURL; @end + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h deleted file mode 100644 index fc0ac9fd06..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SUAutomaticUpdateAlert.h -// Sparkle -// -// Created by Andy Matuschak on 3/18/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -@class SUAppcastItem; -@interface SUAutomaticUpdateAlert : NSWindowController { - SUAppcastItem *updateItem; -} - -- initWithAppcastItem:(SUAppcastItem *)item; - -- (IBAction)relaunchNow:sender; -- (IBAction)relaunchLater:sender; - -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUConstants.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUConstants.h deleted file mode 100644 index bfbe625bb3..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUConstants.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SUConstants.h -// Sparkle -// -// Created by Andy Matuschak on 3/16/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -extern NSString *SUUpdaterWillRestartNotification; - -extern NSString *SUCheckAtStartupKey; -extern NSString *SUFeedURLKey; -extern NSString *SUShowReleaseNotesKey; -extern NSString *SUSkippedVersionKey; -extern NSString *SUScheduledCheckIntervalKey; -extern NSString *SULastCheckTimeKey; -extern NSString *SUExpectsDSASignatureKey; -extern NSString *SUPublicDSAKeyKey; -extern NSString *SUAutomaticallyUpdateKey; -extern NSString *SUAllowsAutomaticUpdatesKey; \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUErrors.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUErrors.h new file mode 100644 index 0000000000..d73aadbae2 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUErrors.h @@ -0,0 +1,47 @@ +// +// SUErrors.h +// Sparkle +// +// Created by C.W. Betts on 10/13/14. +// Copyright (c) 2014 Sparkle Project. All rights reserved. +// + +#ifndef SUERRORS_H +#define SUERRORS_H + +#import <Foundation/Foundation.h> +#import "SUExport.h" + +/** + * Error domain used by Sparkle + */ +SU_EXPORT extern NSString *const SUSparkleErrorDomain; + +typedef NS_ENUM(OSStatus, SUError) { + // Appcast phase errors. + SUAppcastParseError = 1000, + SUNoUpdateError = 1001, + SUAppcastError = 1002, + SURunningFromDiskImageError = 1003, + + // Downlaod phase errors. + SUTemporaryDirectoryError = 2000, + + // Extraction phase errors. + SUUnarchivingError = 3000, + SUSignatureError = 3001, + + // Installation phase errors. + SUFileCopyFailure = 4000, + SUAuthenticationFailure = 4001, + SUMissingUpdateError = 4002, + SUMissingInstallerToolError = 4003, + SURelaunchError = 4004, + SUInstallationError = 4005, + SUDowngradeError = 4006, + + // System phase errors + SUSystemPowerOffError = 5000 +}; + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUExport.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUExport.h new file mode 100644 index 0000000000..3e3f8a1646 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUExport.h @@ -0,0 +1,18 @@ +// +// SUExport.h +// Sparkle +// +// Created by Jake Petroules on 2014-08-23. +// Copyright (c) 2014 Sparkle Project. All rights reserved. +// + +#ifndef SUEXPORT_H +#define SUEXPORT_H + +#ifdef BUILDING_SPARKLE +#define SU_EXPORT __attribute__((visibility("default"))) +#else +#define SU_EXPORT +#endif + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStandardVersionComparator.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStandardVersionComparator.h new file mode 100644 index 0000000000..d7f2a48cf2 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStandardVersionComparator.h @@ -0,0 +1,38 @@ +// +// SUStandardVersionComparator.h +// Sparkle +// +// Created by Andy Matuschak on 12/21/07. +// Copyright 2007 Andy Matuschak. All rights reserved. +// + +#ifndef SUSTANDARDVERSIONCOMPARATOR_H +#define SUSTANDARDVERSIONCOMPARATOR_H + +#import <Foundation/Foundation.h> +#import "SUExport.h" +#import "SUVersionComparisonProtocol.h" + +/*! + Sparkle's default version comparator. + + This comparator is adapted from MacPAD, by Kevin Ballard. + It's "dumb" in that it does essentially string comparison, + in components split by character type. +*/ +SU_EXPORT @interface SUStandardVersionComparator : NSObject <SUVersionComparison> + +/*! + Returns a singleton instance of the comparator. +*/ ++ (SUStandardVersionComparator *)defaultComparator; + +/*! + Compares version strings through textual analysis. + + See the implementation for more details. +*/ +- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; +@end + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h deleted file mode 100644 index e83d15206e..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// SUStatusChecker.h -// Sparkle -// -// Created by Evan Schoenberg on 7/6/06. -// - -#import <Cocoa/Cocoa.h> -#import <Sparkle/SUUpdater.h> - -@class SUStatusChecker; - -@protocol SUStatusCheckerDelegate <NSObject> -//versionString will be nil and isNewVersion will be NO if version checking fails. -- (void)statusChecker:(SUStatusChecker *)statusChecker foundVersion:(NSString *)versionString isNewVersion:(BOOL)isNewVersion; -@end - -@interface SUStatusChecker : SUUpdater { - id<SUStatusCheckerDelegate> scDelegate; -} - -// Create a status checker which will notifiy delegate once the appcast version is determined. -// Notification occurs via the method defined in the SUStatusCheckerDelegate informal protocol. -+ (SUStatusChecker *)statusCheckerForDelegate:(id<SUStatusCheckerDelegate>)delegate; - -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusController.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusController.h deleted file mode 100644 index 19a3f89ecf..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUStatusController.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// SUStatusController.h -// Sparkle -// -// Created by Andy Matuschak on 3/14/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - - -@interface SUStatusController : NSWindowController { - double progressValue, maxProgressValue; - NSString *title, *statusText, *buttonTitle; - IBOutlet NSButton *actionButton; -} - -// Pass 0 for the max progress value to get an indeterminate progress bar. -// Pass nil for the status text to not show it. -- (void)beginActionWithTitle:(NSString *)title maxProgressValue:(double)maxProgressValue statusText:(NSString *)statusText; - -// If isDefault is YES, the button's key equivalent will be \r. -- (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault; -- (void)setButtonEnabled:(BOOL)enabled; - -- (double)progressValue; -- (void)setProgressValue:(double)value; -- (double)maxProgressValue; -- (void)setMaxProgressValue:(double)value; - -- (void)setStatusText:(NSString *)statusText; - -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h deleted file mode 100644 index da111c1580..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// SUUnarchiver.h -// Sparkle -// -// Created by Andy Matuschak on 3/16/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - - -@interface SUUnarchiver : NSObject { - id delegate; -} - -- (void)unarchivePath:(NSString *)path; -- (void)setDelegate:delegate; - -@end - -@interface NSObject (SUUnarchiverDelegate) -- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(long)length; -- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver; -- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver; -@end \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h deleted file mode 100644 index 69c2817498..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// SUUpdateAlert.h -// Sparkle -// -// Created by Andy Matuschak on 3/12/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -typedef enum -{ - SUInstallUpdateChoice, - SURemindMeLaterChoice, - SUSkipThisVersionChoice -} SUUpdateAlertChoice; - -@class WebView, SUAppcastItem; -@interface SUUpdateAlert : NSWindowController { - SUAppcastItem *updateItem; - id delegate; - - IBOutlet WebView *releaseNotesView; - IBOutlet NSTextField *description; - NSProgressIndicator *releaseNotesSpinner; - BOOL webViewFinishedLoading; -} - -- initWithAppcastItem:(SUAppcastItem *)item; -- (void)setDelegate:delegate; - -- (IBAction)installUpdate:sender; -- (IBAction)skipThisVersion:sender; -- (IBAction)remindMeLater:sender; - -@end - -@interface NSObject (SUUpdateAlertDelegate) -- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice; -@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdater.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdater.h index 5f82914bc1..ed0072af40 100644 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdater.h +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUpdater.h @@ -6,50 +6,359 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import <Cocoa/Cocoa.h> - -// Before you use Sparkle in your app, you must set SUFeedURL in Info.plist to the -// address of the appcast on your webserver. If you don't already have an -// appcast, please see the Sparkle documentation to learn about how to set one up. - -// .zip, .dmg, .tar, .tbz, .tgz archives are supported at this time. - -// By default, Sparkle offers to show the user the release notes of the build they'll be -// getting, which it assumes are in the description (or body) field of the relevant RSS item. -// Set SUShowReleaseNotes to <false/> in Info.plist to hide the button. - -@class SUAppcastItem, SUUpdateAlert, SUStatusController; -@interface SUUpdater : NSObject { - SUAppcastItem *updateItem; - - SUStatusController *statusController; - SUUpdateAlert *updateAlert; - - NSURLDownload *downloader; - NSString *downloadPath; - - NSTimer *checkTimer; - NSTimeInterval checkInterval; - - BOOL verbose; - BOOL updateInProgress; -} - -// This IBAction is meant for a main menu item. Hook up any menu item to this action, -// and Sparkle will check for updates and report back its findings verbosely. -- (IBAction)checkForUpdates:sender; - -// This method is similar to the above, but it's intended for updates initiated by -// the computer instead of by the user. It does not alert the user when he is up to date, -// and it remains silent about network errors in fetching the feed. This is what you -// want to call to update programmatically; only use checkForUpdates: with buttons and menu items. +#ifndef SUUPDATER_H +#define SUUPDATER_H + +#import <Foundation/Foundation.h> +#import "SUExport.h" +#import "SUVersionComparisonProtocol.h" +#import "SUVersionDisplayProtocol.h" + +@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; + +@protocol SUUpdaterDelegate; + +/*! + The main API in Sparkle for controlling the update mechanism. + + This class is used to configure the update paramters as well as manually + and automatically schedule and control checks for updates. + */ +SU_EXPORT @interface SUUpdater : NSObject + +@property (unsafe_unretained) IBOutlet id<SUUpdaterDelegate> delegate; + ++ (SUUpdater *)sharedUpdater; ++ (SUUpdater *)updaterForBundle:(NSBundle *)bundle; +- (instancetype)initForBundle:(NSBundle *)bundle; + +@property (readonly, strong) NSBundle *hostBundle; +@property (strong, readonly) NSBundle *sparkleBundle; + +@property BOOL automaticallyChecksForUpdates; + +@property NSTimeInterval updateCheckInterval; + +/*! + * The URL of the appcast used to download update information. + * + * This property must be called on the main thread. + */ +@property (copy) NSURL *feedURL; + +@property (nonatomic, copy) NSString *userAgentString; + +@property (copy) NSDictionary *httpHeaders; + +@property BOOL sendsSystemProfile; + +@property BOOL automaticallyDownloadsUpdates; + +/*! + Explicitly checks for updates and displays a progress dialog while doing so. + + This method is meant for a main menu item. + Connect any menu item to this action in Interface Builder, + and Sparkle will check for updates and report back its findings verbosely + when it is invoked. + */ +- (IBAction)checkForUpdates:(id)sender; + +/*! + Checks for updates, but does not display any UI unless an update is found. + + This is meant for programmatically initating a check for updates. That is, + it will display no UI unless it actually finds an update, in which case it + proceeds as usual. + + If the fully automated updating is turned on, however, this will invoke that + behavior, and if an update is found, it will be downloaded and prepped for + installation. + */ - (void)checkForUpdatesInBackground; -// This method allows you to schedule a check to run every time interval. You can -// pass 0 to this method to cancel a previously scheduled timer. You probably don't want -// to call this directly: if you set a SUScheduledCheckInterval key in Info.plist or -// the user defaults, Sparkle will set this up for you automatically on startup. You might -// just want to call this every time the user changes the setting in the preferences. -- (void)scheduleCheckWithInterval:(NSTimeInterval)interval; +/*! + Checks for updates and, if available, immediately downloads and installs them. + A progress dialog is shown but the user will never be prompted to read the + release notes. + + You may want to respond to the userDidCancelDownload delegate method in case + the user clicks the "Cancel" button while the update is downloading. + */ +- (void)installUpdatesIfAvailable; + +/*! + Returns the date of last update check. + + \returns \c nil if no check has been performed. + */ +@property (readonly, copy) NSDate *lastUpdateCheckDate; + +/*! + Begins a "probing" check for updates which will not actually offer to + update to that version. + + However, the delegate methods + SUUpdaterDelegate::updater:didFindValidUpdate: and + SUUpdaterDelegate::updaterDidNotFindUpdate: will be called, + so you can use that information in your UI. + */ +- (void)checkForUpdateInformation; + +/*! + Appropriately schedules or cancels the update checking timer according to + the preferences for time interval and automatic checks. + + This call does not change the date of the next check, + but only the internal NSTimer. + */ +- (void)resetUpdateCycle; + +@property (readonly) BOOL updateInProgress; + +@end + +// ----------------------------------------------------------------------------- +// SUUpdater Notifications for events that might be interesting to more than just the delegate +// The updater will be the notification object +// ----------------------------------------------------------------------------- +SU_EXPORT extern NSString *const SUUpdaterDidFinishLoadingAppCastNotification; +SU_EXPORT extern NSString *const SUUpdaterDidFindValidUpdateNotification; +SU_EXPORT extern NSString *const SUUpdaterDidNotFindUpdateNotification; +SU_EXPORT extern NSString *const SUUpdaterWillRestartNotification; +#define SUUpdaterWillRelaunchApplicationNotification SUUpdaterWillRestartNotification; +#define SUUpdaterWillInstallUpdateNotification SUUpdaterWillRestartNotification; + +// Key for the SUAppcastItem object in the SUUpdaterDidFindValidUpdateNotification userInfo +SU_EXPORT extern NSString *const SUUpdaterAppcastItemNotificationKey; +// Key for the SUAppcast object in the SUUpdaterDidFinishLoadingAppCastNotification userInfo +SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; + +// ----------------------------------------------------------------------------- +// SUUpdater Delegate: +// ----------------------------------------------------------------------------- + +/*! + Provides methods to control the behavior of an SUUpdater object. + */ +@protocol SUUpdaterDelegate <NSObject> +@optional + +/*! + Returns whether to allow Sparkle to pop up. + + For example, this may be used to prevent Sparkle from interrupting a setup assistant. + + \param updater The SUUpdater instance. + */ +- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)updater; + +/*! + Returns additional parameters to append to the appcast URL's query string. + + This is potentially based on whether or not Sparkle will also be sending along the system profile. + + \param updater The SUUpdater instance. + \param sendingProfile Whether the system profile will also be sent. + + \return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. + */ +- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; + +/*! + Returns a custom appcast URL. + + Override this to dynamically specify the entire URL. + + \param updater The SUUpdater instance. + */ +- (NSString *)feedURLStringForUpdater:(SUUpdater *)updater; + +/*! + Returns whether Sparkle should prompt the user about automatic update checks. + + Use this to override the default behavior. + + \param updater The SUUpdater instance. + */ +- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)updater; + +/*! + Called after Sparkle has downloaded the appcast from the remote server. + + Implement this if you want to do some special handling with the appcast once it finishes loading. + + \param updater The SUUpdater instance. + \param appcast The appcast that was downloaded from the remote server. + */ +- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast; + +/*! + Returns the item in the appcast corresponding to the update that should be installed. + + If you're using special logic or extensions in your appcast, + implement this to use your own logic for finding a valid update, if any, + in the given appcast. + + \param appcast The appcast that was downloaded from the remote server. + \param updater The SUUpdater instance. + */ +- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)updater; + +/*! + Called when a valid update is found by the update driver. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be installed. + */ +- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)item; + +/*! + Called when a valid update is not found. + + \param updater The SUUpdater instance. + */ +- (void)updaterDidNotFindUpdate:(SUUpdater *)updater; + +/*! + Called immediately before downloading the specified update. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be downloaded. + \param request The mutable URL request that will be used to download the update. + */ +- (void)updater:(SUUpdater *)updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request; + +/*! + Called after the specified update failed to download. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that failed to download. + \param error The error generated by the failed download. + */ +- (void)updater:(SUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error; + +/*! + Called when the user clicks the cancel button while and update is being downloaded. + + \param updater The SUUpdater instance. + */ +- (void)userDidCancelDownload:(SUUpdater *)updater; + +/*! + Called immediately before installing the specified update. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be installed. + */ +- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)item; + +/*! + Returns whether the relaunch should be delayed in order to perform other tasks. + + This is not called if the user didn't relaunch on the previous update, + in that case it will immediately restart. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be installed. + \param invocation The invocation that must be completed before continuing with the relaunch. + + \return \c YES to delay the relaunch until \p invocation is invoked. + */ +- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)item untilInvoking:(NSInvocation *)invocation; + +/*! + Returns whether the application should be relaunched at all. + + Some apps \b cannot be relaunched under certain circumstances. + This method can be used to explicitly prevent a relaunch. + + \param updater The SUUpdater instance. + */ +- (BOOL)updaterShouldRelaunchApplication:(SUUpdater *)updater; + +/*! + Called immediately before relaunching. + + \param updater The SUUpdater instance. + */ +- (void)updaterWillRelaunchApplication:(SUUpdater *)updater; + +/*! + Returns an object that compares version numbers to determine their arithmetic relation to each other. + + This method allows you to provide a custom version comparator. + If you don't implement this method or return \c nil, + the standard version comparator will be used. + + \sa SUStandardVersionComparator + + \param updater The SUUpdater instance. + */ +- (id<SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater; + +/*! + Returns an object that formats version numbers for display to the user. + + If you don't implement this method or return \c nil, + the standard version formatter will be used. + + \sa SUUpdateAlert + + \param updater The SUUpdater instance. + */ +- (id<SUVersionDisplay>)versionDisplayerForUpdater:(SUUpdater *)updater; + +/*! + Returns the path which is used to relaunch the client after the update is installed. + + The default is the path of the host bundle. + + \param updater The SUUpdater instance. + */ +- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater; + +/*! + Called before an updater shows a modal alert window, + to give the host the opportunity to hide attached windows that may get in the way. + + \param updater The SUUpdater instance. + */ +- (void)updaterWillShowModalAlert:(SUUpdater *)updater; + +/*! + Called after an updater shows a modal alert window, + to give the host the opportunity to hide attached windows that may get in the way. + + \param updater The SUUpdater instance. + */ +- (void)updaterDidShowModalAlert:(SUUpdater *)updater; + +/*! + Called when an update is scheduled to be silently installed on quit. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be installed. + \param invocation Can be used to trigger an immediate silent install and relaunch. + */ +- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationInvocation:(NSInvocation *)invocation; + +/*! + Calls after an update that was scheduled to be silently installed on quit has been canceled. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that was proposed to be installed. + */ +- (void)updater:(SUUpdater *)updater didCancelInstallUpdateOnQuit:(SUAppcastItem *)item; + +/*! + Called after an update is aborted due to an error. + + \param updater The SUUpdater instance. + \param error The error that caused the abort + */ +- (void)updater:(SUUpdater *)updater didAbortWithError:(NSError *)error; + +@end -@end \ No newline at end of file +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUtilities.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUtilities.h deleted file mode 100644 index 5af355083b..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUUtilities.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SUUtilities.h -// Sparkle -// -// Created by Andy Matuschak on 3/12/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#import <Cocoa/Cocoa.h> - -id SUInfoValueForKey(NSString *key); -NSString *SUHostAppName(); -NSString *SUHostAppDisplayName(); -NSString *SUHostAppVersion(); -NSString *SUHostAppVersionString(); - -NSComparisonResult SUStandardVersionComparison(NSString * versionA, NSString * versionB); - -// If running make localizable-strings for genstrings, ignore the error on this line. -NSString *SULocalizedString(NSString *key, NSString *comment); diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h new file mode 100644 index 0000000000..10c4266946 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h @@ -0,0 +1,30 @@ +// +// SUVersionComparisonProtocol.h +// Sparkle +// +// Created by Andy Matuschak on 12/21/07. +// Copyright 2007 Andy Matuschak. All rights reserved. +// + +#ifndef SUVERSIONCOMPARISONPROTOCOL_H +#define SUVERSIONCOMPARISONPROTOCOL_H + +#import <Cocoa/Cocoa.h> +#import "SUExport.h" + +/*! + Provides version comparison facilities for Sparkle. +*/ +@protocol SUVersionComparison + +/*! + An abstract method to compare two version strings. + + Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, + and NSOrderedSame if they are equivalent. +*/ +- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; // *** MAY BE CALLED ON NON-MAIN THREAD! + +@end + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h new file mode 100644 index 0000000000..97fae4c909 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h @@ -0,0 +1,25 @@ +// +// SUVersionDisplayProtocol.h +// EyeTV +// +// Created by Uli Kusterer on 08.12.09. +// Copyright 2009 Elgato Systems GmbH. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "SUExport.h" + +/*! + Applies special display formatting to version numbers. +*/ +@protocol SUVersionDisplay + +/*! + Formats two version strings. + + Both versions are provided so that important distinguishing information + can be displayed while also leaving out unnecessary/confusing parts. +*/ +- (void)formatVersion:(NSString **)inOutVersionA andVersion:(NSString **)inOutVersionB; + +@end diff --git a/src/MacVim/Sparkle.framework/Versions/A/Headers/Sparkle.h b/src/MacVim/Sparkle.framework/Versions/A/Headers/Sparkle.h index 13e9b2156f..20ed6979ca 100644 --- a/src/MacVim/Sparkle.framework/Versions/A/Headers/Sparkle.h +++ b/src/MacVim/Sparkle.framework/Versions/A/Headers/Sparkle.h @@ -2,21 +2,24 @@ // Sparkle.h // Sparkle // -// Created by Andy Matuschak on 3/16/06. +// Created by Andy Matuschak on 3/16/06. (Modified by CDHW on 23/12/07) // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "SUUpdater.h" -#import "SUUtilities.h" -#import "SUConstants.h" +#ifndef SPARKLE_H +#define SPARKLE_H + +#import <Cocoa/Cocoa.h> + +// This list should include the shared headers. It doesn't matter if some of them aren't shared (unless +// there are name-space collisions) so we can list all of them to start with: + #import "SUAppcast.h" #import "SUAppcastItem.h" -#import "SUUpdateAlert.h" -#import "SUAutomaticUpdateAlert.h" -#import "SUStatusController.h" -#import "SUUnarchiver.h" -#import "SUStatusChecker.h" +#import "SUStandardVersionComparator.h" +#import "SUUpdater.h" +#import "SUVersionComparisonProtocol.h" +#import "SUVersionDisplayProtocol.h" +#import "SUErrors.h" -#import "NSApplication+AppCopies.h" -#import "NSFileManager+Authentication.h" -#import "NSFileManager+Verification.h" \ No newline at end of file +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Modules/module.modulemap b/src/MacVim/Sparkle.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000000..af3fe6d050 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Sparkle { + umbrella header "Sparkle.h" + + export * + module * { export * } +} diff --git a/src/MacVim/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h b/src/MacVim/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h new file mode 100644 index 0000000000..6397fe71a1 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h @@ -0,0 +1,35 @@ +// +// SUUnarchiver.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#ifndef SUUNARCHIVER_H +#define SUUNARCHIVER_H + +#import <Foundation/Foundation.h> + +@class SUHost; +@protocol SUUnarchiverDelegate; + +@interface SUUnarchiver : NSObject + +@property (copy, readonly) NSString *archivePath; +@property (copy, readonly) NSString *updateHostBundlePath; +@property (weak) id<SUUnarchiverDelegate> delegate; + ++ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host; + +- (void)start; +@end + +@protocol SUUnarchiverDelegate <NSObject> +- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver; +- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver; +@optional +- (void)unarchiver:(SUUnarchiver *)unarchiver extractedProgress:(double)progress; +@end + +#endif diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist new file mode 100644 index 0000000000..26a021222e --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>BuildMachineOSBuild</key> + <string>15E27e</string> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Autoupdate</string> + <key>CFBundleIconFile</key> + <string>AppIcon</string> + <key>CFBundleIdentifier</key> + <string>org.sparkle-project.Sparkle.Autoupdate</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.13.1 git-2afc553</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleSupportedPlatforms</key> + <array> + <string>MacOSX</string> + </array> + <key>CFBundleVersion</key> + <string>1.13.1</string> + <key>DTCompiler</key> + <string>com.apple.compilers.llvm.clang.1_0</string> + <key>DTPlatformBuild</key> + <string>7C68</string> + <key>DTPlatformVersion</key> + <string>GM</string> + <key>DTSDKBuild</key> + <string>15C43</string> + <key>DTSDKName</key> + <string>macosx10.11</string> + <key>DTXcode</key> + <string>0720</string> + <key>DTXcodeBuild</key> + <string>7C68</string> + <key>LSBackgroundOnly</key> + <string>1</string> + <key>LSMinimumSystemVersion</key> + <string>10.7</string> + <key>LSUIElement</key> + <string>1</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate new file mode 100755 index 0000000000..7caea3d5f5 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/PkgInfo b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/PkgInfo new file mode 100644 index 0000000000..bd04210fb4 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns new file mode 100644 index 0000000000..75c7c379f9 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/SUStatus.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/SUStatus.nib new file mode 100644 index 0000000000..30f3c2c4d1 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/SUStatus.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ar.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ar.lproj/Sparkle.strings new file mode 100644 index 0000000000..057e2f821b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ar.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ca.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ca.lproj/Sparkle.strings new file mode 100644 index 0000000000..cc238f685a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ca.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings new file mode 100644 index 0000000000..6ca360d15c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/da.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/da.lproj/Sparkle.strings new file mode 100644 index 0000000000..266c0693a6 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/da.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/de.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/de.lproj/Sparkle.strings new file mode 100644 index 0000000000..f99c8c0e15 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/de.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/el.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/el.lproj/Sparkle.strings new file mode 100644 index 0000000000..394c159c03 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/el.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/en.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/en.lproj/Sparkle.strings new file mode 100644 index 0000000000..f427ad6975 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/en.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/es.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/es.lproj/Sparkle.strings new file mode 100644 index 0000000000..8922b3213e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/es.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fi.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fi.lproj/Sparkle.strings new file mode 100644 index 0000000000..32d3107f92 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fi.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fr.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fr.lproj/Sparkle.strings new file mode 100644 index 0000000000..6577569feb Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/fr.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/he.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/he.lproj/Sparkle.strings new file mode 100644 index 0000000000..99124ccc88 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/he.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/is.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/is.lproj/Sparkle.strings new file mode 100644 index 0000000000..74ae72802a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/is.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/it.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/it.lproj/Sparkle.strings new file mode 100644 index 0000000000..f7fb93581c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/it.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings new file mode 100644 index 0000000000..1925ba49ba Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ko.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ko.lproj/Sparkle.strings new file mode 100644 index 0000000000..c6ecfbacb4 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ko.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nb.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nb.lproj/Sparkle.strings new file mode 100644 index 0000000000..25e2079383 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nb.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nl.lproj/Sparkle.strings new file mode 100644 index 0000000000..de38912253 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/nl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pl.lproj/Sparkle.strings new file mode 100644 index 0000000000..e366e3bf1c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings new file mode 100644 index 0000000000..300fc86abb Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_PT.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_PT.lproj/Sparkle.strings new file mode 100644 index 0000000000..d3eddf75d7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_PT.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ro.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ro.lproj/Sparkle.strings new file mode 100644 index 0000000000..28a407bc99 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ro.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ru.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ru.lproj/Sparkle.strings new file mode 100644 index 0000000000..d5cb607305 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ru.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sk.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sk.lproj/Sparkle.strings new file mode 100644 index 0000000000..949fb16ef5 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sk.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sl.lproj/Sparkle.strings new file mode 100644 index 0000000000..c1ce5a04ef Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sv.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sv.lproj/Sparkle.strings new file mode 100644 index 0000000000..e65ac55916 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/sv.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/th.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/th.lproj/Sparkle.strings new file mode 100644 index 0000000000..fc728fd554 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/th.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/tr.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/tr.lproj/Sparkle.strings new file mode 100644 index 0000000000..c41e3dba0e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/tr.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/uk.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/uk.lproj/Sparkle.strings new file mode 100644 index 0000000000..521656d388 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/uk.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings new file mode 100644 index 0000000000..0e91210e5e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_TW.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_TW.lproj/Sparkle.strings new file mode 100644 index 0000000000..ea8c82f97f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_TW.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/Info.plist b/src/MacVim/Sparkle.framework/Versions/A/Resources/Info.plist index c154cb61e1..aba6f81376 100644 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/Info.plist +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/Info.plist @@ -1,22 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>BuildMachineOSBuild</key> + <string>15E27e</string> <key>CFBundleDevelopmentRegion</key> - <string>English</string> + <string>en</string> <key>CFBundleExecutable</key> <string>Sparkle</string> <key>CFBundleIdentifier</key> - <string>org.andymatuschak.Sparkle</string> + <string>org.sparkle-project.Sparkle</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>Sparkle</string> <key>CFBundlePackageType</key> <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.13.1 git-2afc553</string> <key>CFBundleSignature</key> <string>????</string> + <key>CFBundleSupportedPlatforms</key> + <array> + <string>MacOSX</string> + </array> <key>CFBundleVersion</key> - <string>1.1</string> + <string>1.13.1</string> + <key>DTCompiler</key> + <string>com.apple.compilers.llvm.clang.1_0</string> + <key>DTPlatformBuild</key> + <string>7C68</string> + <key>DTPlatformVersion</key> + <string>GM</string> + <key>DTSDKBuild</key> + <string>15C43</string> + <key>DTSDKName</key> + <string>macosx10.11</string> + <key>DTXcode</key> + <string>0720</string> + <key>DTXcodeBuild</key> + <string>7C68</string> </dict> </plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist new file mode 100644 index 0000000000..1f75b248c5 --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist @@ -0,0 +1,314 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>ADP2,1</key> + <string>Developer Transition Kit</string> + <key>iMac1,1</key> + <string>iMac G3 (Rev A-D)</string> + <key>iMac4,1</key> + <string>iMac (Core Duo)</string> + <key>iMac4,2</key> + <string>iMac for Education (17 inch, Core Duo)</string> + <key>iMac5,1</key> + <string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string> + <key>iMac5,2</key> + <string>iMac (Core 2 Duo, 17 inch, Combo Drive)</string> + <key>iMac6,1</key> + <string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string> + <key>iMac7,1</key> + <string>iMac Intel Core 2 Duo (aluminum enclosure)</string> + <key>iMac8,1</key> + <string>iMac (Core 2 Duo, 20 or 24 inch, Early 2008 )</string> + <key>iMac9,1</key> + <string>iMac (Core 2 Duo, 20 or 24 inch, Early or Mid 2009 )</string> + <key>iMac10,1</key> + <string>iMac (Core 2 Duo, 21.5 or 27 inch, Late 2009 )</string> + <key>iMac11,1</key> + <string>iMac (Core i5 or i7, 27 inch Late 2009)</string> + <key>iMac11,2</key> + <string>21.5" iMac (mid 2010)</string> + <key>iMac11,3</key> + <string>iMac (Core i5 or i7, 27 inch Mid 2010)</string> + <key>iMac12,1</key> + <string>iMac (Core i3 or i5 or i7, 21.5 inch Mid 2010 or Late 2011)</string> + <key>iMac12,2</key> + <string>iMac (Core i5 or i7, 27 inch Mid 2011)</string> + <key>iMac13,1</key> + <string>iMac (Core i3 or i5 or i7, 21.5 inch Late 2012 or Early 2013)</string> + <key>iMac13,2</key> + <string>iMac (Core i5 or i7, 27 inch Late 2012)</string> + <key>iMac14,1</key> + <string>iMac (Core i5, 21.5 inch Late 2013)</string> + <key>iMac14,2</key> + <string>iMac (Core i5 or i7, 27 inch Late 2013)</string> + <key>iMac14,3</key> + <string>iMac (Core i5 or i7, 21.5 inch Late 2013)</string> + <key>iMac14,4</key> + <string>iMac (Core i5, 21.5 inch Mid 2014)</string> + <key>iMac15,1</key> + <string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2014 or Mid 2015)</string> + <key>iMac16,1</key> + <string>iMac (Core i5, 21,5 inch Late 2015)</string> + <key>iMac16,2</key> + <string>iMac (Retina 4K Core i5 or i7, 21.5 inch Late 2015)</string> + <key>iMac17,1</key> + <string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2015)</string> + <key>MacBook1,1</key> + <string>MacBook (Core Duo)</string> + <key>MacBook2,1</key> + <string>MacBook (Core 2 Duo)</string> + <key>MacBook4,1</key> + <string>MacBook (Core 2 Duo Feb 2008)</string> + <key>MacBook5,1</key> + <string>MacBook (Core 2 Duo, Late 2008, Unibody)</string> + <key>MacBook5,2</key> + <string>MacBook (Core 2 Duo, Early 2009, White)</string> + <key>MacBook6,1</key> + <string>MacBook (Core 2 Duo, Late 2009, Unibody)</string> + <key>MacBook7,1</key> + <string>MacBook (Core 2 Duo, Mid 2010, White)</string> + <key>MacBook8,1</key> + <string>MacBook (Core M, 12 inch, Early 2015)</string> + <key>MacBookAir1,1</key> + <string>MacBook Air (Core 2 Duo, 13 inch, Early 2008)</string> + <key>MacBookAir2,1</key> + <string>MacBook Air (Core 2 Duo, 13 inch, Mid 2009)</string> + <key>MacBookAir3,1</key> + <string>MacBook Air (Core 2 Duo, 11 inch, Late 2010)</string> + <key>MacBookAir3,2</key> + <string>MacBook Air (Core 2 Duo, 13 inch, Late 2010)</string> + <key>MacBookAir4,1</key> + <string>MacBook Air (Core i5 or i7, 11 inch, Mid 2011)</string> + <key>MacBookAir4,2</key> + <string>MacBook Air (Core i5 or i7, 13 inch, Mid 2011)</string> + <key>MacBookAir5,1</key> + <string>MacBook Air (Core i5 or i7, 11 inch, Mid 2012)</string> + <key>MacBookAir5,2</key> + <string>MacBook Air (Core i5 or i7, 13 inch, Mid 2012)</string> + <key>MacBookAir6,1</key> + <string>MacBook Air (Core i5 or i7, 11 inch, Mid 2013 or Early 2014)</string> + <key>MacBookAir6,2</key> + <string>MacBook Air (Core i5 or i7, 13 inch, Mid 2013 or Early 2014)</string> + <key>MacBookAir7,1</key> + <string>MacBook Air (Core i5 or i7, 11 inch, Early 2015)</string> + <key>MacBookAir7,2</key> + <string>MacBook Air (Core i5 or i7, 13 inch, Early 2015)</string> + <key>MacBookPro1,1</key> + <string>MacBook Pro Core Duo (15-inch)</string> + <key>MacBookPro1,2</key> + <string>MacBook Pro Core Duo (17-inch)</string> + <key>MacBookPro2,1</key> + <string>MacBook Pro Core 2 Duo (17-inch)</string> + <key>MacBookPro2,2</key> + <string>MacBook Pro Core 2 Duo (15-inch)</string> + <key>MacBookPro3,1</key> + <string>MacBook Pro Core 2 Duo (15-inch LED, Core 2 Duo)</string> + <key>MacBookPro3,2</key> + <string>MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo)</string> + <key>MacBookPro4,1</key> + <string>MacBook Pro (Core 2 Duo Feb 2008)</string> + <key>MacBookPro5,1</key> + <string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string> + <key>MacBookPro5,2</key> + <string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string> + <key>MacBookPro5,3</key> + <string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string> + <key>MacBookPro5,4</key> + <string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string> + <key>MacBookPro5,5</key> + <string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string> + <key>MacBookPro6,1</key> + <string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string> + <key>MacBookPro6,2</key> + <string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string> + <key>MacBookPro7,1</key> + <string>MacBook Pro Intel Core 2 Duo (mid 2010)</string> + <key>MacBookPro8,1</key> + <string>MacBook Pro Intel Core i5, Intel Core i7, 13" (early 2011)</string> + <key>MacBookPro8,2</key> + <string>MacBook Pro Intel Core i7, 15" (early 2011)</string> + <key>MacBookPro8,3</key> + <string>MacBook Pro Intel Core i7, 17" (early 2011)</string> + <key>MacBookPro9,1</key> + <string>MacBook Pro (15-inch, Mid 2012)</string> + <key>MacBookPro9,2</key> + <string>MacBook Pro (13-inch, Mid 2012)</string> + <key>MacBookPro10,1</key> + <string>MacBook Pro (Retina, Mid 2012)</string> + <key>MacBookPro10,2</key> + <string>MacBook Pro (Retina, 13-inch, Late 2012)</string> + <key>MacBookPro11,1</key> + <string>MacBook Pro (Retina, 13-inch, Late 2013)</string> + <key>MacBookPro11,2</key> + <string>MacBook Pro (Retina, 15-inch, Late 2013)</string> + <key>MacBookPro11,3</key> + <string>MacBook Pro (Retina, 15-inch, Late 2013)</string> + <key>MacbookPro11,4</key> + <string>MacBook Pro (Retina, 15-inch, Mid 2015)</string> + <key>MacbookPro11,5</key> + <string>MacBook Pro (Retina, 15-inch, Mid 2015)</string> + <key>MacbookPro12,1 </key> + <string>MacBook Pro (Retina, 13-inch, Early 2015)</string> + <key>Macmini1,1</key> + <string>Mac Mini (Core Solo/Duo)</string> + <key>Macmini2,1</key> + <string>Mac mini Intel Core</string> + <key>Macmini3,1</key> + <string>Mac mini Intel Core</string> + <key>Macmini4,1</key> + <string>Mac mini Intel Core (Mid 2010)</string> + <key>Macmini5,1</key> + <string>Mac mini (Core i5, Mid 2011)</string> + <key>Macmini5,2</key> + <string>Mac mini (Core i5 or Core i7, Mid 2011)</string> + <key>Macmini5,3</key> + <string>Mac mini (Core i7, Server, Mid 2011)</string> + <key>Macmini6,1</key> + <string>Mac mini (Core i5, Late 2012)</string> + <key>Macmini6,2</key> + <string>Mac mini (Core i7, Normal or Server, Late 2012)</string> + <key>Macmini7,1</key> + <string>Mac mini (Core i5 or Core i7, Late 2014)</string> + <key>MacPro1,1,Quad</key> + <string>Mac Pro</string> + <key>MacPro1,1</key> + <string>Mac Pro (four-core)</string> + <key>MacPro2,1</key> + <string>Mac Pro (eight-core)</string> + <key>MacPro3,1</key> + <string>Mac Pro (January 2008 4- or 8- core "Harpertown")</string> + <key>MacPro4,1</key> + <string>Mac Pro (March 2009)</string> + <key>MacPro5,1</key> + <string>Mac Pro (2010 or 2012)</string> + <key>MacPro6,1</key> + <string>Mac Pro (Late 2013)</string> + <key>PowerBook1,1</key> + <string>PowerBook G3</string> + <key>PowerBook2,1</key> + <string>iBook G3</string> + <key>PowerBook2,2</key> + <string>iBook G3 (FireWire)</string> + <key>PowerBook2,3</key> + <string>iBook G3</string> + <key>PowerBook2,4</key> + <string>iBook G3</string> + <key>PowerBook3,1</key> + <string>PowerBook G3 (FireWire)</string> + <key>PowerBook3,2</key> + <string>PowerBook G4</string> + <key>PowerBook3,3</key> + <string>PowerBook G4 (Gigabit Ethernet)</string> + <key>PowerBook3,4</key> + <string>PowerBook G4 (DVI)</string> + <key>PowerBook3,5</key> + <string>PowerBook G4 (1GHz / 867MHz)</string> + <key>PowerBook4,1</key> + <string>iBook G3 (Dual USB, Late 2001)</string> + <key>PowerBook4,2</key> + <string>iBook G3 (16MB VRAM)</string> + <key>PowerBook4,3</key> + <string>iBook G3 Opaque 16MB VRAM, 32MB VRAM, Early 2003)</string> + <key>PowerBook5,1</key> + <string>PowerBook G4 (17 inch)</string> + <key>PowerBook5,2</key> + <string>PowerBook G4 (15 inch FW 800)</string> + <key>PowerBook5,3</key> + <string>PowerBook G4 (17-inch 1.33GHz)</string> + <key>PowerBook5,4</key> + <string>PowerBook G4 (15 inch 1.5/1.33GHz)</string> + <key>PowerBook5,5</key> + <string>PowerBook G4 (17-inch 1.5GHz)</string> + <key>PowerBook5,6</key> + <string>PowerBook G4 (15 inch 1.67GHz/1.5GHz)</string> + <key>PowerBook5,7</key> + <string>PowerBook G4 (17-inch 1.67GHz)</string> + <key>PowerBook5,8</key> + <string>PowerBook G4 (Double layer SD, 15 inch)</string> + <key>PowerBook5,9</key> + <string>PowerBook G4 (Double layer SD, 17 inch)</string> + <key>PowerBook6,1</key> + <string>PowerBook G4 (12 inch)</string> + <key>PowerBook6,2</key> + <string>PowerBook G4 (12 inch, DVI)</string> + <key>PowerBook6,3</key> + <string>iBook G4</string> + <key>PowerBook6,4</key> + <string>PowerBook G4 (12 inch 1.33GHz)</string> + <key>PowerBook6,5</key> + <string>iBook G4 (Early-Late 2004)</string> + <key>PowerBook6,7</key> + <string>iBook G4 (Mid 2005)</string> + <key>PowerBook6,8</key> + <string>PowerBook G4 (12 inch 1.5GHz)</string> + <key>PowerMac1,1</key> + <string>Power Macintosh G3 (Blue & White)</string> + <key>PowerMac1,2</key> + <string>Power Macintosh G4 (PCI Graphics)</string> + <key>PowerMac2,1</key> + <string>iMac G3 (Slot-loading CD-ROM)</string> + <key>PowerMac2,2</key> + <string>iMac G3 (Summer 2000)</string> + <key>PowerMac3,1</key> + <string>Power Macintosh G4 (AGP Graphics)</string> + <key>PowerMac3,2</key> + <string>Power Macintosh G4 (AGP Graphics)</string> + <key>PowerMac3,3</key> + <string>Power Macintosh G4 (Gigabit Ethernet)</string> + <key>PowerMac3,4</key> + <string>Power Macintosh G4 (Digital Audio)</string> + <key>PowerMac3,5</key> + <string>Power Macintosh G4 (Quick Silver)</string> + <key>PowerMac3,6</key> + <string>Power Macintosh G4 (Mirrored Drive Door)</string> + <key>PowerMac4,1</key> + <string>iMac G3 (Early/Summer 2001)</string> + <key>PowerMac4,2</key> + <string>iMac G4 (Flat Panel)</string> + <key>PowerMac4,4</key> + <string>eMac</string> + <key>PowerMac4,5</key> + <string>iMac G4 (17-inch Flat Panel)</string> + <key>PowerMac5,1</key> + <string>Power Macintosh G4 Cube</string> + <key>PowerMac5,2</key> + <string>Power Mac G4 Cube</string> + <key>PowerMac6,1</key> + <string>iMac G4 (USB 2.0)</string> + <key>PowerMac6,3</key> + <string>iMac G4 (20-inch Flat Panel)</string> + <key>PowerMac6,4</key> + <string>eMac (USB 2.0, 2005)</string> + <key>PowerMac7,2</key> + <string>Power Macintosh G5</string> + <key>PowerMac7,3</key> + <string>Power Macintosh G5</string> + <key>PowerMac8,1</key> + <string>iMac G5</string> + <key>PowerMac8,2</key> + <string>iMac G5 (Ambient Light Sensor)</string> + <key>PowerMac9,1</key> + <string>Power Macintosh G5 (Late 2005)</string> + <key>PowerMac10,1</key> + <string>Mac Mini G4</string> + <key>PowerMac10,2</key> + <string>Mac Mini (Late 2005)</string> + <key>PowerMac11,2</key> + <string>Power Macintosh G5 (Late 2005)</string> + <key>PowerMac12,1</key> + <string>iMac G5 (iSight)</string> + <key>RackMac1,1</key> + <string>Xserve G4</string> + <key>RackMac1,2</key> + <string>Xserve G4 (slot-loading, cluster node)</string> + <key>RackMac3,1</key> + <string>Xserve G5</string> + <key>Xserve1,1</key> + <string>Xserve (Intel Xeon)</string> + <key>Xserve2,1</key> + <string>Xserve (January 2008 quad-core)</string> + <key>Xserve3,1</key> + <string>Xserve (early 2009)</string> +</dict> +</plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib new file mode 100644 index 0000000000..30f3c2c4d1 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib deleted file mode 100644 index ff40c9ddf7..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib +++ /dev/null @@ -1,12 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - CLASS = SUStatusController; - LANGUAGE = ObjC; - OUTLETS = {actionButton = id; }; - SUPERCLASS = NSWindowController; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib deleted file mode 100644 index 99183444cb..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>69 10 356 240 0 0 1280 832 </string> - <key>IBFramework Version</key> - <string>443.0</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> - <key>IBSystem Version</key> - <string>8H14</string> -</dict> -</plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib deleted file mode 100644 index 378b22f2a6..0000000000 Binary files a/src/MacVim/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..46d10f10df Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..1fafb0334b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..f93d74b0aa Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/Sparkle.strings new file mode 100644 index 0000000000..057e2f821b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ar.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings new file mode 100644 index 0000000000..cc238f685a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..4b32c51654 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..122c0e03a3 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..26ec025484 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings new file mode 100644 index 0000000000..6ca360d15c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..a1fbef90bb Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..05bf2cb333 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..21fca7b92f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings new file mode 100644 index 0000000000..266c0693a6 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..66360626f4 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..a457c2f643 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..92499cbb12 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings new file mode 100644 index 0000000000..f99c8c0e15 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..a3db760fe9 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..20302af0e8 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..157168bbc4 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/Sparkle.strings new file mode 100644 index 0000000000..394c159c03 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/el.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..df090b491f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib deleted file mode 100644 index 3e65b1ff50..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib +++ /dev/null @@ -1,12 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = {relaunchLater = id; relaunchNow = id; }; - CLASS = SUAutomaticUpdateAlert; - LANGUAGE = ObjC; - SUPERCLASS = NSWindowController; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib deleted file mode 100644 index 2f65f2f491..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>188 142 356 240 0 0 1280 1002 </string> - <key>IBFramework Version</key> - <string>443.0</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> - <key>IBSystem Version</key> - <string>8H14</string> -</dict> -</plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib deleted file mode 100644 index c4201cf26a..0000000000 Binary files a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..7ed2647971 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib deleted file mode 100644 index 0071ac0776..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib +++ /dev/null @@ -1,21 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = NSObject; LANGUAGE = ObjC; }, - { - ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; - CLASS = SUUpdateAlert; - LANGUAGE = ObjC; - OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; - SUPERCLASS = NSWindowController; - }, - { - ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; - CLASS = SUUpdateAlertController; - LANGUAGE = ObjC; - OUTLETS = {releaseNotesView = id; }; - SUPERCLASS = NSWindowController; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib deleted file mode 100644 index 2b25ad033c..0000000000 --- a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>425 40 356 240 0 0 1280 832 </string> - <key>IBFramework Version</key> - <string>446.1</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> - <key>IBSystem Version</key> - <string>8I127</string> -</dict> -</plist> diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib deleted file mode 100644 index be3dbd9069..0000000000 Binary files a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..9c0c887c0e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings index 6bf42f79b0..f427ad6975 100644 Binary files a/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings and b/src/MacVim/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..4fc4bbc4f7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..5ae5adefa1 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..8006f904a3 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings new file mode 100644 index 0000000000..8922b3213e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings new file mode 100644 index 0000000000..32d3107f92 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..bc13d0c06c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..f8f1f1c37f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..7b2b40e6c9 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings new file mode 100644 index 0000000000..6577569feb Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/fr_CA.lproj b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr_CA.lproj new file mode 120000 index 0000000000..f9834a395e --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/fr_CA.lproj @@ -0,0 +1 @@ +fr.lproj \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings new file mode 100644 index 0000000000..99124ccc88 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..3550df4c34 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..683ad629d6 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..6551540dee Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings new file mode 100644 index 0000000000..74ae72802a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..74eb0267e7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..a7bc37b45b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..7581873f98 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings new file mode 100644 index 0000000000..f7fb93581c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..7207576b38 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..5479c403ae Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..67c837f1ff Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings new file mode 100644 index 0000000000..1925ba49ba Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..95105afd5b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..5a81571287 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..8cecd70a49 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings new file mode 100644 index 0000000000..c6ecfbacb4 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..ab9491fb0f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..14bcaf7264 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..54e248f9a8 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/Sparkle.strings new file mode 100644 index 0000000000..25e2079383 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nb.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..f60fb1d0bf Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..7da34c239e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..516751a65e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings new file mode 100644 index 0000000000..de38912253 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..a7ae98316f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..d7a2f0f9d3 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..616cf6a058 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings new file mode 100644 index 0000000000..e366e3bf1c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt.lproj b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt.lproj new file mode 120000 index 0000000000..3c1c9f6dce --- /dev/null +++ b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt.lproj @@ -0,0 +1 @@ +pt_BR.lproj \ No newline at end of file diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..c04684b2e3 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..c0831eed54 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..da41ed28e3 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings new file mode 100644 index 0000000000..300fc86abb Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..a7c83d717b Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..7ae5322387 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..9864c7aa93 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings new file mode 100644 index 0000000000..d3eddf75d7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..eace82c800 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..e22df98199 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..fbb2a4bfb6 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings new file mode 100644 index 0000000000..28a407bc99 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..df2f8172a6 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..1e69dbe477 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..b85d061738 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings new file mode 100644 index 0000000000..d5cb607305 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..c6aa94507a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..5ce8b5ffc7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..fc3a83ce1a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings new file mode 100644 index 0000000000..949fb16ef5 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..58d1b2798a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..b3ff81800f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..02738220fc Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings new file mode 100644 index 0000000000..c1ce5a04ef Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..84a4996a75 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..a89378cb0f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..d2abca1ec4 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings new file mode 100644 index 0000000000..e65ac55916 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..f16caf04fa Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..31295fc38c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..6f575498df Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings new file mode 100644 index 0000000000..fc728fd554 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..08c15cbe41 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..cc72ff88c8 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..aa2c54deba Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings new file mode 100644 index 0000000000..c41e3dba0e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..987d91502a Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..1a77ccfc5d Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..bdce46213c Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings new file mode 100644 index 0000000000..521656d388 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..d4e07287a0 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..0bf6286372 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..b371b0dfb5 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings new file mode 100644 index 0000000000..0e91210e5e Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib new file mode 100644 index 0000000000..e204c1a4e7 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib new file mode 100644 index 0000000000..5f242053f9 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib new file mode 100644 index 0000000000..fb32ddc941 Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings new file mode 100644 index 0000000000..ea8c82f97f Binary files /dev/null and b/src/MacVim/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings differ diff --git a/src/MacVim/Sparkle.framework/Versions/A/Sparkle b/src/MacVim/Sparkle.framework/Versions/A/Sparkle index 9dbf9e7fa1..158a259231 100755 Binary files a/src/MacVim/Sparkle.framework/Versions/A/Sparkle and b/src/MacVim/Sparkle.framework/Versions/A/Sparkle differ diff --git a/src/MacVim/deploy/background.png b/src/MacVim/deploy/background.png new file mode 100644 index 0000000000..6c00b396b6 Binary files /dev/null and b/src/MacVim/deploy/background.png differ diff --git a/src/MacVim/deploy/readme.rtfd/TXT.rtf b/src/MacVim/deploy/readme.rtfd/TXT.rtf new file mode 100644 index 0000000000..24943093ae --- /dev/null +++ b/src/MacVim/deploy/readme.rtfd/TXT.rtf @@ -0,0 +1,32 @@ +{\rtf1\ansi\ansicpg932\cocoartf1404\cocoasubrtf110 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset128 HiraKakuProN-W3;} +{\colortbl;\red255\green255\blue255;} +\paperw11900\paperh16840\margl1440\margr1440\vieww11860\viewh10180\viewkind0 +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f0\fs32 \cf0 MacVim-KaoriYa +\fs24 \ +\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f1 \cf0 \'83\'43\'83\'93\'83\'58\'83\'67\'81\'5b\'83\'8b\'95\'fb\'96\'40 +\f0 \ + MacVim +\f1 \'83\'41\'83\'43\'83\'52\'83\'93\'82\'f0\'83\'41\'83\'76\'83\'8a\'83\'50\'81\'5b\'83\'56\'83\'87\'83\'93\'83\'74\'83\'48\'83\'8b\'83\'5f\'82\'c9\'83\'68\'83\'8d\'83\'62\'83\'76\'82\'b5\'82\'dc\'82\'b7\'81\'42\ +\ +\'83\'41\'83\'93\'83\'43\'83\'93\'83\'58\'83\'67\'81\'5b\'83\'8b\'95\'fb\'96\'40\ + \'83\'41\'83\'76\'83\'8a\'83\'50\'81\'5b\'83\'56\'83\'87\'83\'93\'83\'74\'83\'48\'83\'8b\'83\'5f\'82\'ccMacVim\'83\'41\'83\'43\'83\'52\'83\'93\ + \'83\'86\'81\'5b\'83\'55\'83\'74\'83\'48\'83\'8b\'83\'5f\'82\'cc\'83\'89\'83\'43\'83\'75\'83\'89\'83\'8a/Preferences/org.vim.MacVim.* +\f0 \ + +\f1 \'82\'f0\'8d\'ed\'8f\'9c\'82\'b5\'82\'dc\'82\'b7\'81\'42\'82\'dc\'82\'bd\'81\'41\'8e\'9f\'82\'cc\'83\'52\'83\'7d\'83\'93\'83\'68\'82\'f0\'8e\'c0\'8d\'73\'82\'b5\'82\'c4\'81\'41\'83\'86\'81\'5b\'83\'55\'83\'66\'83\'74\'83\'48\'83\'8b\'83\'67\'90\'dd\'92\'e8\'82\'f0\'8d\'ed\'8f\'9c\'82\'b5\'82\'dc\'82\'b7\'81\'42\ + $ defaults delete org.vim.MacVim\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f0 \cf0 \ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f1 \cf0 \'83\'68\'83\'4c\'83\'85\'83\'81\'83\'93\'83\'67 +\f0 \ + {\field{\*\fldinst{HYPERLINK "https://github.com/splhack/macvim-kaoriya/wiki/Readme"}}{\fldrslt https://github.com/splhack/macvim-kaoriya/wiki/Readme}}\ +} \ No newline at end of file diff --git a/src/MacVim/dsa_pub.pem b/src/MacVim/dsa_pub.pem new file mode 100644 index 0000000000..b26f850676 --- /dev/null +++ b/src/MacVim/dsa_pub.pem @@ -0,0 +1,20 @@ +-----BEGIN PUBLIC KEY----- +MIIDOzCCAi4GByqGSM44BAEwggIhAoIBAQDT51nkmpsi8S0/PBhoI4L82EBC2VmO +ry5eD5eUvHIK3NXYvyr54jlsgO8/v4lTWghcbHVmbPBONUCp2iIRPKwQsUpohg70 +PxxG9xSLjqfmdFVkvrdOJ+KHIVTmRqq969eC/+kDf5J9i+k+KcR9l3XOSFZj0LmG +Egojnfmu3WC0D41Z2uypCYhiT9OtSdx4JQcqB+SlTgxYYgvdxiy4xGbBsoFMSWiH +beMvxllVzXWqgx9G1SDnEHGHTjk2wK46q+5X+lMCzJPaS0IUGMLkEaOMMatQF6oN +4up9HS6YmKC7LVbmXT1LnrY+y1mfA0n49CvYe26lMWrySakqKmWGdpFXAhUAikVE +1/bbnqA9gc1Fz09bDPzTe90CggEBAJBwquIUgt/l55SPTT+M+0s94x45BbpWYB6h +IaFzsH8Okp1Emwq/RjGfQhxzANSsIuGiCDpvyxeA0E3F8IHcQckXRAnjpdY+zCM1 +6uvkve+egKPWgnLkMgCGcTnRHMVu+e9Ou9Gm1D3BD54/9tShj5Cj0RbpXbr0FhPC ++KA7J67HaBY7O6Nvlblf2++SosgjWM3golTjhVsRqdnlC/W8ndTszDRGZGA/c7A3 +FUuS3GxfzwWmbr248ez6MmwmJjwUxSOJDxp8oT61xRjqfsLsa010rSQOgshnI4aP +Yy9IWTSRq9B+tLGjYg1ynV2SfEwKs9a9aJYyL0BwB5jLU7f1GlgDggEFAAKCAQAi +QVC95RmHKJXDO9XnOIkUlRa6+HTI9cbSGGQlUaKY8HplsSYArlpDbCwMrOnb8mJ2 +kgL+DaPr1cZnLMVkV3108GI7lyX/HD5Ea4xKdXQfeszKEUXoGZbvAnd8yVVTDaAP +UdJh0eDMzSt9btHp9CVYZaa5G9kjbeEIUP5FNnnF4z7JqJTYcrFqi8NEK11y8h+3 +v5UzkT7maNEMmb75ZM8juqR46Q8cCrkmnmWpB4Z9mc6KPXlWWSo1SS4OC2W9hv5w +pL35gCRRhlwWaviSDjF/LVBag3Y3HQKU+PiCx2/3lghmkTPAjZExFMSosqG5B/rz +zW/qzqDENi5dWvF1rPRK +-----END PUBLIC KEY----- diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index dc62e2eecf..026bafbbbd 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -24,6 +24,8 @@ static int use_graphical_sign = 0; +static BOOL is_macos_high_sierra_or_later = NO; + // Max number of files to add to MRU in one go (this matches the maximum that // Cocoa displays in the MRU -- if this changes in Cocoa then update this // number as well). @@ -36,6 +38,7 @@ static int MMMinFontSize = 6; static int MMMaxFontSize = 100; +static BOOL MMShareFindPboard = YES; static GuiFont gui_macvim_font_with_name(char_u *name); static int specialKeyToNSKey(int key); @@ -67,6 +70,14 @@ path = [path stringByAppendingPathComponent:@"runtime"]; vim_setenv((char_u*)"VIMRUNTIME", (char_u*)[path UTF8String]); } + + NSString *lang = [[[NSBundle mainBundle] + preferredLocalizations] objectAtIndex:0]; + if ([lang isEqualToString:@"Japanese"]) + vim_setenv((char_u*)"LANG", (char_u*)"ja_JP.UTF-8"); + + if (mch_isdir((char_u*)"/opt/local/share/terminfo") == FALSE) + vim_setenv((char_u*)"TERMINFO", (char_u*)"/usr/share/terminfo"); } #if 0 // NOTE: setlocale(LC_ALL, "") seems to work after a restart so this is @@ -176,6 +187,20 @@ val = CFPreferencesGetAppIntegerValue((CFStringRef)MMRendererKey, kCFPreferencesCurrentApplication, &keyValid); + if (!keyValid) { + // If MMRendererKey is not valid in the defaults, it means MacVim uses + // the Core Text Renderer. + keyValid = YES; + val = MMRendererCoreText; + } + if (val != MMRendererDefault && val != MMRendererCoreText) { + // Migrate from the old value to the Core Text Renderer. + val = MMRendererCoreText; + CFPreferencesSetAppValue((CFStringRef)MMRendererKey, + (CFPropertyListRef)[NSNumber numberWithInt:val], + kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + } if (keyValid) { ASLogInfo(@"Use renderer=%ld", val); use_gui_macvim_draw_string = (val != MMRendererCoreText); @@ -184,6 +209,15 @@ // signs. use_graphical_sign = (val == MMRendererCoreText); } + + // Check to use the Find Pasteboard. + MMShareFindPboard = CFPreferencesGetAppBooleanValue((CFStringRef)MMShareFindPboardKey, + kCFPreferencesCurrentApplication, + &keyValid); + if (!keyValid) { + // Share text via the Find Pasteboard by default. + MMShareFindPboard = YES; + } } @@ -238,6 +272,7 @@ // Ensure 'linespace' option is passed along to MacVim in case it was set // in [g]vimrc. gui_mch_adjust_charheight(); + gui_mch_adjust_charwidth(); if (!MMNoMRU && GARGCOUNT > 0) { // Add files passed on command line to MRU. @@ -258,6 +293,17 @@ [[MMBackend sharedInstance] addToMRU:filenames]; } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 + if ([[NSProcessInfo processInfo] + respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]) + { + NSOperatingSystemVersion version = {10, 13, 0}; + + is_macos_high_sierra_or_later = [[NSProcessInfo processInfo] + isOperatingSystemAtLeastVersion:version]; + } +#endif + return OK; } @@ -308,7 +354,7 @@ static CFAbsoluteTime lastTime = 0; CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent(); - if (nowTime - lastTime > 0.2) { + if (nowTime - lastTime > 1.0 / 30) { [[MMBackend sharedInstance] update]; lastTime = nowTime; } @@ -392,9 +438,8 @@ // called, so force a flush of the command queue here. [[MMBackend sharedInstance] flushQueue:YES]; -#if defined(FEAT_NETBEANS_INTG) - /* Process any queued netbeans messages. */ - netbeans_parse_messages(); +#ifdef MESSAGE_QUEUE + parse_queued_messages(); #endif return [[MMBackend sharedInstance] waitForInput:wtime]; @@ -440,41 +485,16 @@ } - void -gui_mch_draw_string(int row, int col, char_u *s, int len, int cells, int flags) -{ -#ifdef FEAT_MBYTE - char_u *conv_str = NULL; - if (output_conv.vc_type != CONV_NONE) { - conv_str = string_convert(&output_conv, s, &len); - if (conv_str) - s = conv_str; - } -#endif - - [[MMBackend sharedInstance] drawString:s - length:len - row:row - column:col - cells:cells - flags:flags]; -#ifdef FEAT_MBYTE - if (conv_str) - vim_free(conv_str); -#endif -} - - int gui_macvim_draw_string(int row, int col, char_u *s, int len, int flags) { - int c, cn, cl, i; + MMBackend *backend = [MMBackend sharedInstance]; +#ifdef FEAT_MBYTE + int c, cw, cl, ccl; int start = 0; int endcol = col; int startcol = col; BOOL wide = NO; - MMBackend *backend = [MMBackend sharedInstance]; -#ifdef FEAT_MBYTE char_u *conv_str = NULL; if (output_conv.vc_type != CONV_NONE) { @@ -482,45 +502,62 @@ if (conv_str) s = conv_str; } -#endif // Loop over each character and output text when it changes from normal to // wide and vice versa. - for (i = 0; i < len; i += cl) { + for (int i = 0; i < len; i += cl) { c = utf_ptr2char(s + i); - cn = utf_char2cells(c); + cw = utf_char2cells(c); cl = utf_ptr2len(s + i); - if (0 == cl) + ccl = utfc_ptr2len(s + i); + if (cl == 0) len = i; // len must be wrong (shouldn't happen) - if (!utf_iscomposing(c)) { - if ((cn > 1 && !wide) || (cn <= 1 && wide)) { - // Changed from normal to wide or vice versa. - [backend drawString:(s+start) length:i-start - row:row column:startcol - cells:endcol-startcol - flags:(wide ? flags|DRAW_WIDE : flags)]; + if (i > start && (cl < ccl || (cw > 1 && !wide) || (cw <= 1 && wide))) { + // Changed from normal to wide or vice versa. + [backend drawString:(s+start) length:i-start + row:row column:startcol + cells:endcol-startcol + flags:flags|(wide ? DRAW_WIDE : 0)]; - start = i; - startcol = endcol; - } + start = i; + startcol = endcol; + } + + wide = cw > 1; + endcol += cw; - wide = cn > 1; - endcol += cn; + if (cl < ccl) { + // Changed from normal to wide or vice versa. + [backend drawString:(s+start) length:ccl + row:row column:startcol + cells:endcol-startcol + flags:flags|DRAW_COMP|(wide ? DRAW_WIDE : 0)]; + + start = i + ccl; + startcol = endcol; + cl = ccl; } } - // Output remaining characters. - [backend drawString:(s+start) length:len-start - row:row column:startcol cells:endcol-startcol - flags:(wide ? flags|DRAW_WIDE : flags)]; + if (len > start) { + // Output remaining characters. + [backend drawString:(s+start) length:len-start + row:row column:startcol + cells:endcol-startcol + flags:flags|(wide ? DRAW_WIDE : 0)]; + } -#ifdef FEAT_MBYTE if (conv_str) vim_free(conv_str); -#endif return endcol - col; +#else + [backend drawString:s length:len + row:row column:col + cells:len flags:flags]; + return len; +#endif } @@ -1184,6 +1221,20 @@ } + int +gui_mch_is_blinking(void) +{ + return FALSE; +} + + + int +gui_mch_is_blink_off(void) +{ + return FALSE; +} + + /* * Cursor blink functions. * @@ -1214,9 +1265,9 @@ * Stop the cursor blinking. Show the cursor if it wasn't shown. */ void -gui_mch_stop_blink(void) +gui_mch_stop_blink(int may_call_gui_update_cursor) { - [[MMBackend sharedInstance] stopBlink]; + [[MMBackend sharedInstance] stopBlink:may_call_gui_update_cursor]; } @@ -1251,7 +1302,16 @@ // -- Input Method ---------------------------------------------------------- -#if defined(USE_IM_CONTROL) +#if defined(FEAT_MBYTE) +# if defined(FEAT_EVAL) +# ifdef FEAT_GUI +# define USE_IMACTIVATEFUNC (!gui.in_use && *p_imaf != NUL) +# define USE_IMSTATUSFUNC (!gui.in_use && *p_imsf != NUL) +# else +# define USE_IMACTIVATEFUNC (*p_imaf != NUL) +# define USE_IMSTATUSFUNC (*p_imsf != NUL) +# endif +# endif void im_set_position(int row, int col) @@ -1274,6 +1334,21 @@ void im_set_active(int active) { +#if defined(FEAT_EVAL) + if (USE_IMACTIVATEFUNC) + { + if (active != im_get_status()) + { + call_imactivatefunc(active); + } + return; + } +#endif + + // Don't enable IM if imdisableactivate is true. + if (p_imdisableactivate && active) + return; + // Tell frontend to enable/disable IM (called e.g. when the mode changes). if (!p_imdisable) { int msgid = active ? ActivateKeyScriptMsgID : DeactivateKeyScriptMsgID; @@ -1286,10 +1361,15 @@ int im_get_status(void) { +# ifdef FEAT_EVAL + if (USE_IMSTATUSFUNC) + return call_imstatusfunc(); +# endif + return [[MMBackend sharedInstance] imState]; } -#endif // defined(USE_IM_CONTROL) +#endif // defined(FEAT_MBYTE) @@ -1378,6 +1458,17 @@ } +/* + * Adjust gui.char_width (after 'columnspace' was changed). + */ + int +gui_mch_adjust_charwidth(void) +{ + [[MMBackend sharedInstance] adjustColumnspace:p_columnspace]; + return OK; +} + + void gui_mch_beep(void) { @@ -1480,9 +1571,9 @@ // Ensure no data is on the output queue before presenting the dialog. gui_macvim_force_flush(); - int style = NSInformationalAlertStyle; - if (VIM_WARNING == type) style = NSWarningAlertStyle; - else if (VIM_ERROR == type) style = NSCriticalAlertStyle; + int style = NSAlertStyleInformational; + if (VIM_WARNING == type) style = NSAlertStyleWarning; + else if (VIM_ERROR == type) style = NSAlertStyleCritical; NSMutableDictionary *attr = [NSMutableDictionary dictionaryWithObject:[NSNumber numberWithInt:style] @@ -1549,6 +1640,9 @@ guicolor_T gui_mch_get_color(char_u *name) { + if (![MMBackend sharedInstance]) + return INVALCOLOR; + #ifdef FEAT_MBYTE name = CONVERT_TO_UTF8(name); #endif @@ -1567,7 +1661,7 @@ /* * Return the RGB value of a pixel as long. */ - long_u + guicolor_T gui_mch_get_rgb(guicolor_T pixel) { // This is only implemented so that vim can guess the correct value for @@ -1579,6 +1673,13 @@ } + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ + return gui_get_rgb_color_cmn(r, g, b); +} + + /* * Get the screen dimensions. * Allow 10 pixels for horizontal borders, 40 for vertical borders. @@ -1774,7 +1875,8 @@ // The second entry will be used by other applications when taking entries // off the Find pasteboard, whereas MacVim will use the first if present. [pb setString:s forType:VimFindPboardType]; - [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; + if (MMShareFindPboard) + [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; } void @@ -1783,6 +1885,16 @@ [[MMBackend sharedInstance] setAntialias:antialias]; } + void +gui_macvim_set_ligatures(int ligatures) +{ + [[MMBackend sharedInstance] setLigatures:ligatures]; +} + void +gui_macvim_set_thinstrokes(int thinStrokes) +{ + [[MMBackend sharedInstance] setThinStrokes:thinStrokes]; +} void gui_macvim_wait_for_startup() @@ -1792,7 +1904,8 @@ [backend waitForConnectionAcknowledgement]; } -void gui_macvim_get_window_layout(int *count, int *layout) + void +gui_macvim_get_window_layout(int *count, int *layout) { if (!(count && layout)) return; @@ -1806,16 +1919,23 @@ void gui_macvim_get_window_layout(int *count, int *layout) } } -void *gui_macvim_new_autoreleasepool() + void * +gui_macvim_new_autoreleasepool() { return (void *)[[NSAutoreleasePool alloc] init]; } -void gui_macvim_release_autoreleasepool(void *pool) + void +gui_macvim_release_autoreleasepool(void *pool) { [(id)pool release]; } +void gui_macvim_set_proportional_font(int proportional_font) +{ + [[MMBackend sharedInstance] setProportionalFont:proportional_font]; +} + // -- Client/Server --------------------------------------------------------- #ifdef MAC_CLIENTSERVER @@ -1857,7 +1977,7 @@ void gui_macvim_release_autoreleasepool(void *pool) */ int serverSendToVim(char_u *name, char_u *cmd, char_u **result, - int *port, int asExpr, int silent) + int *port, int asExpr, int timeout, int silent) { #ifdef FEAT_MBYTE name = CONVERT_TO_UTF8(name); @@ -2137,7 +2257,8 @@ void gui_macvim_release_autoreleasepool(void *pool) return isValid; } -static int specialKeyToNSKey(int key) + static int +specialKeyToNSKey(int key) { if (!IS_SPECIAL(key)) return key; @@ -2202,37 +2323,59 @@ static int specialKeyToNSKey(int key) return 0; } -static int vimModMaskToEventModifierFlags(int mods) + static int +vimModMaskToEventModifierFlags(int mods) { int flags = 0; if (mods & MOD_MASK_SHIFT) - flags |= NSShiftKeyMask; + flags |= NSEventModifierFlagShift; if (mods & MOD_MASK_CTRL) - flags |= NSControlKeyMask; + flags |= NSEventModifierFlagControl; if (mods & MOD_MASK_ALT) - flags |= NSAlternateKeyMask; + flags |= NSEventModifierFlagOption; if (mods & MOD_MASK_CMD) - flags |= NSCommandKeyMask; + flags |= NSEventModifierFlagCommand; return flags; } -// -- NetBeans Support ------------------------------------------------------ +// -- Job and Channel Support ------------------------------------------------------ -#ifdef FEAT_NETBEANS_INTG +#if defined(FEAT_JOB_CHANNEL) + void * +gui_macvim_add_channel(channel_T *channel, ch_part_T part) +{ + dispatch_source_t s = + dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, + channel->ch_part[part].ch_fd, + 0, + dispatch_get_main_queue()); + dispatch_source_set_event_handler(s, ^{ + channel_may_read(channel, part, "gui_macvim_add_channel"); + }); + dispatch_resume(s); + return s; +} -/* Set NetBeans socket to CFRunLoop */ void -gui_macvim_set_netbeans_socket(int socket) +gui_macvim_remove_channel(void *cookie) { - [[MMBackend sharedInstance] setNetbeansSocket:socket]; + dispatch_source_t s = (dispatch_source_t)cookie; + dispatch_source_cancel(s); + dispatch_release(s); } -#endif // FEAT_NETBEANS_INTG + void +gui_macvim_cleanup_job_all(void) +{ + if (is_macos_high_sierra_or_later) + job_cleanup_all(); +} +#endif // FEAT_JOB_CHANNEL // -- Graphical Sign Support ------------------------------------------------ @@ -2290,13 +2433,6 @@ static int vimModMaskToEventModifierFlags(int mods) [imgName release]; } -# ifdef FEAT_NETBEANS_INTG - void -netbeans_draw_multisign_indicator(int row) -{ -} -# endif // FEAT_NETBEANS_INTG - #endif // FEAT_SIGN_ICONS @@ -2306,11 +2442,11 @@ static int vimModMaskToEventModifierFlags(int mods) #ifdef FEAT_BEVAL BalloonEval * -gui_mch_create_beval_area(target, mesg, mesgCB, clientData) - void *target; - char_u *mesg; - void (*mesgCB)__ARGS((BalloonEval *, int)); - void *clientData; +gui_mch_create_beval_area( + void *target, + char_u *mesg, + void (*mesgCB)(BalloonEval *, int), + void *clientData) { BalloonEval *beval; @@ -2326,8 +2462,7 @@ static int vimModMaskToEventModifierFlags(int mods) } void -gui_mch_enable_beval_area(beval) - BalloonEval *beval; +gui_mch_enable_beval_area(BalloonEval *beval) { // Set the balloon delay when enabling balloon eval. float delay = p_bdlay/1000.0f - MMBalloonEvalInternalDelay; @@ -2338,8 +2473,7 @@ static int vimModMaskToEventModifierFlags(int mods) } void -gui_mch_disable_beval_area(beval) - BalloonEval *beval; +gui_mch_disable_beval_area(BalloonEval *beval) { // NOTE: An empty tool tip indicates that the tool tip window should hide. [[MMBackend sharedInstance] queueMessage:SetTooltipMsgID properties: @@ -2350,12 +2484,16 @@ static int vimModMaskToEventModifierFlags(int mods) * Show a balloon with "mesg". */ void -gui_mch_post_balloon(beval, mesg) - BalloonEval *beval; - char_u *mesg; +gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { NSString *toolTip = [NSString stringWithVimString:mesg]; [[MMBackend sharedInstance] setLastToolTip:toolTip]; } #endif // FEAT_BEVAL + + void +gui_macvim_set_blur(int radius) +{ + [[MMBackend sharedInstance] setBlurRadius:radius]; +} diff --git a/src/MacVim/gvimrc b/src/MacVim/gvimrc index 4b4ff38292..746411f4e1 100644 --- a/src/MacVim/gvimrc +++ b/src/MacVim/gvimrc @@ -33,10 +33,15 @@ endif " name and the buffer modified flag. set guitablabel=%M%t + " Send print jobs to Preview.app. This does not delete the temporary ps file " that is generated by :hardcopy. set printexpr=system('open\ -a\ Preview\ '.v:fname_in)\ +\ v:shell_error +" askpass +let $SSH_ASKPASS = simplify($VIM . '/../../MacOS') . '/macvim-askpass' +let $SUDO_ASKPASS = $SSH_ASKPASS + " This is so that HIG Cmd and Option movement mappings can be disabled by " adding the line @@ -105,3 +110,190 @@ endif " exists("macvim_hig_shift_movement") " Restore the previous value of 'cpoptions'. let &cpo = s:cpo_save unlet s:cpo_save + + +" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照) +" +" An example for a Japanese version gvimrc file. +" 日本語版のデフォルトGUI設定ファイル(gvimrc) - Vim 7.4 +" +" Last Change: 23-Mar-2016. +" Maintainer: MURAOKA Taro <koron.kaoriya@gmail.com> +" +" 解説: +" このファイルにはVimの起動時に必ず設定される、GUI関連の設定が書かれていま +" す。編集時の挙動に関する設定はvimrcに書かかれています。 +" +" 個人用設定は_gvimrcというファイルを作成しそこで行ないます。_gvimrcはこの +" ファイルの後に読込まれるため、ここに書かれた内容を上書きして設定することが +" 出来ます。_gvimrcは$HOMEまたは$VIMに置いておく必要があります。$HOMEは$VIM +" よりも優先され、$HOMEでみつかった場合$VIMは読込まれません。 +" +" 管理者向けに本設定ファイルを直接書き換えずに済ませることを目的として、サイ +" トローカルな設定を別ファイルで行なえるように配慮してあります。Vim起動時に +" サイトローカルな設定ファイル($VIM/gvimrc_local.vim)が存在するならば、本設 +" 定ファイルの主要部分が読み込まれる前に自動的に読み込みます。 +" +" 読み込み後、変数g:gvimrc_local_finishが非0の値に設定されていた場合には本設 +" 定ファイルに書かれた内容は一切実行されません。デフォルト動作を全て差し替え +" たい場合に利用して下さい。 +" +" 参考: +" :help gvimrc +" :echo $HOME +" :echo $VIM +" :version + +"--------------------------------------------------------------------------- +" サイトローカルな設定($VIM/gvimrc_local.vim)があれば読み込む。読み込んだ後 +" に変数g:gvimrc_local_finishに非0な値が設定されていた場合には、それ以上の設 +" 定ファイルの読込を中止する。 +if 1 && filereadable($VIM . '/gvimrc_local.vim') + source $VIM/gvimrc_local.vim + if exists('g:gvimrc_local_finish') && g:gvimrc_local_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" ユーザ優先設定($HOME/.gvimrc_first.vim)があれば読み込む。読み込んだ後に変 +" 数g:gvimrc_first_finishに非0な値が設定されていた場合には、それ以上の設定 +" ファイルの読込を中止する。 +if 1 && exists('$HOME') && filereadable($HOME . '/.gvimrc_first.vim') + unlet! g:gvimrc_first_finish + source $HOME/.gvimrc_first.vim + if exists('g:gvimrc_first_finish') && g:gvimrc_first_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" Bram氏の提供する設定例をインクルード (別ファイル:vimrc_example.vim)。これ +" 以前にg:no_gvimrc_exampleに非0な値を設定しておけばインクルードしない。 +if 1 && (!exists('g:no_gvimrc_example') || g:no_gvimrc_example == 0) + source $VIMRUNTIME/gvimrc_example.vim +endif + +"--------------------------------------------------------------------------- +" カラー設定: +"colorscheme morning + +"--------------------------------------------------------------------------- +" フォント設定: +" +if has('win32') + " Windows用 + set guifont=MS_Gothic:h12:cSHIFTJIS + "set guifont=MS_Mincho:h12:cSHIFTJIS + " 行間隔の設定 + set linespace=1 + " 一部のUCS文字の幅を自動計測して決める + if has('kaoriya') + set ambiwidth=auto + endif +elseif has('gui_macvim') + set guifont=Osaka-Mono:h14 +elseif has('mac') + set guifont=Osaka-等幅:h14 +elseif has('xfontset') + " UNIX用 (xfontsetを使用) + set guifontset=a14,r14,k14 +endif + +"--------------------------------------------------------------------------- +" ウインドウに関する設定: +" +" ウインドウの幅 +set columns=80 +" ウインドウの高さ +set lines=25 +" コマンドラインの高さ(GUI使用時) +set cmdheight=2 +" 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる) +"colorscheme evening " (GUI使用時) + +"--------------------------------------------------------------------------- +" 日本語入力に関する設定: +" +if has('multi_byte_ime') || has('xim') || has('gui_macvim') + " IME ON時のカーソルの色を設定(設定例:紫) + highlight CursorIM guibg=Purple guifg=NONE + " 挿入モード・検索モードでのデフォルトのIME状態設定 + set iminsert=0 imsearch=0 + if has('xim') && has('GUI_GTK') + " XIMの入力開始キーを設定: + " 下記の s-space はShift+Spaceの意味でkinput2+canna用設定 + "set imactivatekey=s-space + endif + " 挿入モードでのIME状態を記憶させない場合、次行のコメントを解除 + "inoremap <silent> <ESC> <ESC>:set iminsert=0<CR> +endif + +"--------------------------------------------------------------------------- +" マウスに関する設定: +" +" 解説: +" mousefocusは幾つか問題(一例:ウィンドウを分割しているラインにカーソルがあっ +" ている時の挙動)があるのでデフォルトでは設定しない。Windowsではmousehide +" が、マウスカーソルをVimのタイトルバーに置き日本語を入力するとチラチラする +" という問題を引き起す。 +" +" どのモードでもマウスを使えるようにする +set mouse=a +" マウスの移動でフォーカスを自動的に切替えない (mousefocus:切替る) +set nomousefocus +" 入力時にマウスポインタを隠す (nomousehide:隠さない) +set mousehide +" ビジュアル選択(D&D他)を自動的にクリップボードへ (:help guioptions_a) +"set guioptions+=a + +"--------------------------------------------------------------------------- +" メニューに関する設定: +" +" 解説: +" "M"オプションが指定されたときはメニュー("m")・ツールバー("T")供に登録され +" ないので、自動的にそれらの領域を削除するようにした。よって、デフォルトのそ +" れらを無視してユーザが独自の一式を登録した場合には、それらが表示されないと +" いう問題が生じ得る。しかしあまりにレアなケースであると考えられるので無視す +" る。 +" +if &guioptions =~# 'M' + let &guioptions = substitute(&guioptions, '[mT]', '', 'g') +endif + +"--------------------------------------------------------------------------- +" その他、見栄えに関する設定: +" +" 検索文字列をハイライトしない(_vimrcではなく_gvimrcで設定する必要がある) +"set nohlsearch + +"--------------------------------------------------------------------------- +" 印刷に関する設定: +" +" 注釈: +" 印刷はGUIでなくてもできるのでvimrcで設定したほうが良いかもしれない。この辺 +" りはWindowsではかなり曖昧。一般的に印刷には明朝、と言われることがあるらし +" いのでデフォルトフォントは明朝にしておく。ゴシックを使いたい場合はコメント +" アウトしてあるprintfontを参考に。 +" +" 参考: +" :hardcopy +" :help 'printfont' +" :help printing +" +" 印刷用フォント +if has('printer') + if has('win32') + set printfont=MS_Mincho:h12:cSHIFTJIS + "set printfont=MS_Gothic:h12:cSHIFTJIS + endif +endif + +" Copyright (C) 2009-2016 KaoriYa/MURAOKA Taro + + +" +" MacVim-KaoriYa固有の設定 +" +set noimdisable +set imdisableactivate diff --git a/src/MacVim/icons/MacVim-applescript.icns b/src/MacVim/icons/MacVim-applescript.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-applescript.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-applescript.icns b/src/MacVim/icons/MacVim-applescript.icns new file mode 100644 index 0000000000..2794ef5185 Binary files /dev/null and b/src/MacVim/icons/MacVim-applescript.icns differ diff --git a/src/MacVim/icons/MacVim-as.icns b/src/MacVim/icons/MacVim-as.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-as.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-as.icns b/src/MacVim/icons/MacVim-as.icns new file mode 100644 index 0000000000..c732431929 Binary files /dev/null and b/src/MacVim/icons/MacVim-as.icns differ diff --git a/src/MacVim/icons/MacVim-asp.icns b/src/MacVim/icons/MacVim-asp.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-asp.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-asp.icns b/src/MacVim/icons/MacVim-asp.icns new file mode 100644 index 0000000000..103ad14070 Binary files /dev/null and b/src/MacVim/icons/MacVim-asp.icns differ diff --git a/src/MacVim/icons/MacVim-bash.icns b/src/MacVim/icons/MacVim-bash.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-bash.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-bash.icns b/src/MacVim/icons/MacVim-bash.icns new file mode 100644 index 0000000000..ca1b480b4e Binary files /dev/null and b/src/MacVim/icons/MacVim-bash.icns differ diff --git a/src/MacVim/icons/MacVim-bib.icns b/src/MacVim/icons/MacVim-bib.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-bib.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-bib.icns b/src/MacVim/icons/MacVim-bib.icns new file mode 100644 index 0000000000..52c1de3d8c Binary files /dev/null and b/src/MacVim/icons/MacVim-bib.icns differ diff --git a/src/MacVim/icons/MacVim-bsh.icns b/src/MacVim/icons/MacVim-bsh.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-bsh.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-bsh.icns b/src/MacVim/icons/MacVim-bsh.icns new file mode 100644 index 0000000000..537889dfeb Binary files /dev/null and b/src/MacVim/icons/MacVim-bsh.icns differ diff --git a/src/MacVim/icons/MacVim-c.icns b/src/MacVim/icons/MacVim-c.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-c.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-c.icns b/src/MacVim/icons/MacVim-c.icns new file mode 100644 index 0000000000..73441f3a3f Binary files /dev/null and b/src/MacVim/icons/MacVim-c.icns differ diff --git a/src/MacVim/icons/MacVim-cfg.icns b/src/MacVim/icons/MacVim-cfg.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-cfg.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-cfg.icns b/src/MacVim/icons/MacVim-cfg.icns new file mode 100644 index 0000000000..04375930a5 Binary files /dev/null and b/src/MacVim/icons/MacVim-cfg.icns differ diff --git a/src/MacVim/icons/MacVim-cgi.icns b/src/MacVim/icons/MacVim-cgi.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-cgi.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-cgi.icns b/src/MacVim/icons/MacVim-cgi.icns new file mode 100644 index 0000000000..7d7b018bb1 Binary files /dev/null and b/src/MacVim/icons/MacVim-cgi.icns differ diff --git a/src/MacVim/icons/MacVim-cpp.icns b/src/MacVim/icons/MacVim-cpp.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-cpp.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-cpp.icns b/src/MacVim/icons/MacVim-cpp.icns new file mode 100644 index 0000000000..b806ff96f9 Binary files /dev/null and b/src/MacVim/icons/MacVim-cpp.icns differ diff --git a/src/MacVim/icons/MacVim-cs.icns b/src/MacVim/icons/MacVim-cs.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-cs.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-cs.icns b/src/MacVim/icons/MacVim-cs.icns new file mode 100644 index 0000000000..c8a88be772 Binary files /dev/null and b/src/MacVim/icons/MacVim-cs.icns differ diff --git a/src/MacVim/icons/MacVim-csfg.icns b/src/MacVim/icons/MacVim-csfg.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-csfg.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-csfg.icns b/src/MacVim/icons/MacVim-csfg.icns new file mode 100644 index 0000000000..4220f153bb Binary files /dev/null and b/src/MacVim/icons/MacVim-csfg.icns differ diff --git a/src/MacVim/icons/MacVim-css.icns b/src/MacVim/icons/MacVim-css.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-css.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-css.icns b/src/MacVim/icons/MacVim-css.icns new file mode 100644 index 0000000000..f2b749f55d Binary files /dev/null and b/src/MacVim/icons/MacVim-css.icns differ diff --git a/src/MacVim/icons/MacVim-csv.icns b/src/MacVim/icons/MacVim-csv.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-csv.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-csv.icns b/src/MacVim/icons/MacVim-csv.icns new file mode 100644 index 0000000000..271cf384a7 Binary files /dev/null and b/src/MacVim/icons/MacVim-csv.icns differ diff --git a/src/MacVim/icons/MacVim-dtd.icns b/src/MacVim/icons/MacVim-dtd.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-dtd.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-dtd.icns b/src/MacVim/icons/MacVim-dtd.icns new file mode 100644 index 0000000000..8193e1b8d6 Binary files /dev/null and b/src/MacVim/icons/MacVim-dtd.icns differ diff --git a/src/MacVim/icons/MacVim-dylan.icns b/src/MacVim/icons/MacVim-dylan.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-dylan.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-dylan.icns b/src/MacVim/icons/MacVim-dylan.icns new file mode 100644 index 0000000000..0f72546277 Binary files /dev/null and b/src/MacVim/icons/MacVim-dylan.icns differ diff --git a/src/MacVim/icons/MacVim-erl.icns b/src/MacVim/icons/MacVim-erl.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-erl.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-erl.icns b/src/MacVim/icons/MacVim-erl.icns new file mode 100644 index 0000000000..05dd7f2c8e Binary files /dev/null and b/src/MacVim/icons/MacVim-erl.icns differ diff --git a/src/MacVim/icons/MacVim-f.icns b/src/MacVim/icons/MacVim-f.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-f.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-f.icns b/src/MacVim/icons/MacVim-f.icns new file mode 100644 index 0000000000..732794ea34 Binary files /dev/null and b/src/MacVim/icons/MacVim-f.icns differ diff --git a/src/MacVim/icons/MacVim-fscript.icns b/src/MacVim/icons/MacVim-fscript.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-fscript.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-fscript.icns b/src/MacVim/icons/MacVim-fscript.icns new file mode 100644 index 0000000000..a6287d1d62 Binary files /dev/null and b/src/MacVim/icons/MacVim-fscript.icns differ diff --git a/src/MacVim/icons/MacVim-generic.icns b/src/MacVim/icons/MacVim-generic.icns index 5d5e83bcbc..d140a43482 100644 Binary files a/src/MacVim/icons/MacVim-generic.icns and b/src/MacVim/icons/MacVim-generic.icns differ diff --git a/src/MacVim/icons/MacVim-gtd.icns b/src/MacVim/icons/MacVim-gtd.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-gtd.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-gtd.icns b/src/MacVim/icons/MacVim-gtd.icns new file mode 100644 index 0000000000..05627947f1 Binary files /dev/null and b/src/MacVim/icons/MacVim-gtd.icns differ diff --git a/src/MacVim/icons/MacVim-h.icns b/src/MacVim/icons/MacVim-h.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-h.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-h.icns b/src/MacVim/icons/MacVim-h.icns new file mode 100644 index 0000000000..9c6a56cd71 Binary files /dev/null and b/src/MacVim/icons/MacVim-h.icns differ diff --git a/src/MacVim/icons/MacVim-hs.icns b/src/MacVim/icons/MacVim-hs.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-hs.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-hs.icns b/src/MacVim/icons/MacVim-hs.icns new file mode 100644 index 0000000000..66e75dfc1b Binary files /dev/null and b/src/MacVim/icons/MacVim-hs.icns differ diff --git a/src/MacVim/icons/MacVim-html.icns b/src/MacVim/icons/MacVim-html.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-html.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-html.icns b/src/MacVim/icons/MacVim-html.icns new file mode 100644 index 0000000000..398267ceda Binary files /dev/null and b/src/MacVim/icons/MacVim-html.icns differ diff --git a/src/MacVim/icons/MacVim-ics.icns b/src/MacVim/icons/MacVim-ics.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-ics.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-ics.icns b/src/MacVim/icons/MacVim-ics.icns new file mode 100644 index 0000000000..a1b891cd07 Binary files /dev/null and b/src/MacVim/icons/MacVim-ics.icns differ diff --git a/src/MacVim/icons/MacVim-inc.icns b/src/MacVim/icons/MacVim-inc.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-inc.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-inc.icns b/src/MacVim/icons/MacVim-inc.icns new file mode 100644 index 0000000000..7cb8216d50 Binary files /dev/null and b/src/MacVim/icons/MacVim-inc.icns differ diff --git a/src/MacVim/icons/MacVim-ini.icns b/src/MacVim/icons/MacVim-ini.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-ini.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-ini.icns b/src/MacVim/icons/MacVim-ini.icns new file mode 100644 index 0000000000..8d4a17fc45 Binary files /dev/null and b/src/MacVim/icons/MacVim-ini.icns differ diff --git a/src/MacVim/icons/MacVim-io.icns b/src/MacVim/icons/MacVim-io.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-io.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-io.icns b/src/MacVim/icons/MacVim-io.icns new file mode 100644 index 0000000000..e46c1a8b9e Binary files /dev/null and b/src/MacVim/icons/MacVim-io.icns differ diff --git a/src/MacVim/icons/MacVim-java.icns b/src/MacVim/icons/MacVim-java.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-java.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-java.icns b/src/MacVim/icons/MacVim-java.icns new file mode 100644 index 0000000000..be76c7d50a Binary files /dev/null and b/src/MacVim/icons/MacVim-java.icns differ diff --git a/src/MacVim/icons/MacVim-js.icns b/src/MacVim/icons/MacVim-js.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-js.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-js.icns b/src/MacVim/icons/MacVim-js.icns new file mode 100644 index 0000000000..d8708a14e6 Binary files /dev/null and b/src/MacVim/icons/MacVim-js.icns differ diff --git a/src/MacVim/icons/MacVim-jsp.icns b/src/MacVim/icons/MacVim-jsp.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-jsp.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-jsp.icns b/src/MacVim/icons/MacVim-jsp.icns new file mode 100644 index 0000000000..d9aa7c7376 Binary files /dev/null and b/src/MacVim/icons/MacVim-jsp.icns differ diff --git a/src/MacVim/icons/MacVim-lisp.icns b/src/MacVim/icons/MacVim-lisp.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-lisp.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-lisp.icns b/src/MacVim/icons/MacVim-lisp.icns new file mode 100644 index 0000000000..99e1d99f35 Binary files /dev/null and b/src/MacVim/icons/MacVim-lisp.icns differ diff --git a/src/MacVim/icons/MacVim-log.icns b/src/MacVim/icons/MacVim-log.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-log.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-log.icns b/src/MacVim/icons/MacVim-log.icns new file mode 100644 index 0000000000..3da009342c Binary files /dev/null and b/src/MacVim/icons/MacVim-log.icns differ diff --git a/src/MacVim/icons/MacVim-m.icns b/src/MacVim/icons/MacVim-m.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-m.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-m.icns b/src/MacVim/icons/MacVim-m.icns new file mode 100644 index 0000000000..339833b3a5 Binary files /dev/null and b/src/MacVim/icons/MacVim-m.icns differ diff --git a/src/MacVim/icons/MacVim-markdown.icns b/src/MacVim/icons/MacVim-markdown.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-markdown.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-markdown.icns b/src/MacVim/icons/MacVim-markdown.icns new file mode 100644 index 0000000000..fcd77c15e2 Binary files /dev/null and b/src/MacVim/icons/MacVim-markdown.icns differ diff --git a/src/MacVim/icons/MacVim-mm.icns b/src/MacVim/icons/MacVim-mm.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-mm.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-mm.icns b/src/MacVim/icons/MacVim-mm.icns new file mode 100644 index 0000000000..5df35b8150 Binary files /dev/null and b/src/MacVim/icons/MacVim-mm.icns differ diff --git a/src/MacVim/icons/MacVim-patch.icns b/src/MacVim/icons/MacVim-patch.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-patch.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-patch.icns b/src/MacVim/icons/MacVim-patch.icns new file mode 100644 index 0000000000..f1733eccc8 Binary files /dev/null and b/src/MacVim/icons/MacVim-patch.icns differ diff --git a/src/MacVim/icons/MacVim-perl.icns b/src/MacVim/icons/MacVim-perl.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-perl.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-perl.icns b/src/MacVim/icons/MacVim-perl.icns new file mode 100644 index 0000000000..2656517785 Binary files /dev/null and b/src/MacVim/icons/MacVim-perl.icns differ diff --git a/src/MacVim/icons/MacVim-php.icns b/src/MacVim/icons/MacVim-php.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-php.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-php.icns b/src/MacVim/icons/MacVim-php.icns new file mode 100644 index 0000000000..04b045ab6e Binary files /dev/null and b/src/MacVim/icons/MacVim-php.icns differ diff --git a/src/MacVim/icons/MacVim-plist.icns b/src/MacVim/icons/MacVim-plist.icns new file mode 100644 index 0000000000..1a99f6382d Binary files /dev/null and b/src/MacVim/icons/MacVim-plist.icns differ diff --git a/src/MacVim/icons/MacVim-properties.icns b/src/MacVim/icons/MacVim-properties.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-properties.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-properties.icns b/src/MacVim/icons/MacVim-properties.icns new file mode 100644 index 0000000000..a72f2e2148 Binary files /dev/null and b/src/MacVim/icons/MacVim-properties.icns differ diff --git a/src/MacVim/icons/MacVim-ps.icns b/src/MacVim/icons/MacVim-ps.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-ps.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-ps.icns b/src/MacVim/icons/MacVim-ps.icns new file mode 100644 index 0000000000..5a89e0ef92 Binary files /dev/null and b/src/MacVim/icons/MacVim-ps.icns differ diff --git a/src/MacVim/icons/MacVim-py.icns b/src/MacVim/icons/MacVim-py.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-py.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-py.icns b/src/MacVim/icons/MacVim-py.icns new file mode 100644 index 0000000000..91831149a4 Binary files /dev/null and b/src/MacVim/icons/MacVim-py.icns differ diff --git a/src/MacVim/icons/MacVim-rb.icns b/src/MacVim/icons/MacVim-rb.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-rb.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-rb.icns b/src/MacVim/icons/MacVim-rb.icns new file mode 100644 index 0000000000..a2c77319ac Binary files /dev/null and b/src/MacVim/icons/MacVim-rb.icns differ diff --git a/src/MacVim/icons/MacVim-rst.icns b/src/MacVim/icons/MacVim-rst.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-rst.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-rst.icns b/src/MacVim/icons/MacVim-rst.icns new file mode 100644 index 0000000000..c6bca79091 Binary files /dev/null and b/src/MacVim/icons/MacVim-rst.icns differ diff --git a/src/MacVim/icons/MacVim-sch.icns b/src/MacVim/icons/MacVim-sch.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-sch.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-sch.icns b/src/MacVim/icons/MacVim-sch.icns new file mode 100644 index 0000000000..007b1b12be Binary files /dev/null and b/src/MacVim/icons/MacVim-sch.icns differ diff --git a/src/MacVim/icons/MacVim-sql.icns b/src/MacVim/icons/MacVim-sql.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-sql.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-sql.icns b/src/MacVim/icons/MacVim-sql.icns new file mode 100644 index 0000000000..d601f9cadf Binary files /dev/null and b/src/MacVim/icons/MacVim-sql.icns differ diff --git a/src/MacVim/icons/MacVim-tcl.icns b/src/MacVim/icons/MacVim-tcl.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-tcl.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-tcl.icns b/src/MacVim/icons/MacVim-tcl.icns new file mode 100644 index 0000000000..5d5facf580 Binary files /dev/null and b/src/MacVim/icons/MacVim-tcl.icns differ diff --git a/src/MacVim/icons/MacVim-tex.icns b/src/MacVim/icons/MacVim-tex.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-tex.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-tex.icns b/src/MacVim/icons/MacVim-tex.icns new file mode 100644 index 0000000000..3b6efb43f3 Binary files /dev/null and b/src/MacVim/icons/MacVim-tex.icns differ diff --git a/src/MacVim/icons/MacVim-tsv.icns b/src/MacVim/icons/MacVim-tsv.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-tsv.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-tsv.icns b/src/MacVim/icons/MacVim-tsv.icns new file mode 100644 index 0000000000..8e01abfaab Binary files /dev/null and b/src/MacVim/icons/MacVim-tsv.icns differ diff --git a/src/MacVim/icons/MacVim-txt.icns b/src/MacVim/icons/MacVim-txt.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-txt.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-txt.icns b/src/MacVim/icons/MacVim-txt.icns new file mode 100644 index 0000000000..b923c4a22c Binary files /dev/null and b/src/MacVim/icons/MacVim-txt.icns differ diff --git a/src/MacVim/icons/MacVim-vb.icns b/src/MacVim/icons/MacVim-vb.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-vb.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-vb.icns b/src/MacVim/icons/MacVim-vb.icns new file mode 100644 index 0000000000..f5193145f9 Binary files /dev/null and b/src/MacVim/icons/MacVim-vb.icns differ diff --git a/src/MacVim/icons/MacVim-vba.icns b/src/MacVim/icons/MacVim-vba.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-vba.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-vba.icns b/src/MacVim/icons/MacVim-vba.icns new file mode 100644 index 0000000000..fbf1c77e24 Binary files /dev/null and b/src/MacVim/icons/MacVim-vba.icns differ diff --git a/src/MacVim/icons/MacVim-vcf.icns b/src/MacVim/icons/MacVim-vcf.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-vcf.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-vcf.icns b/src/MacVim/icons/MacVim-vcf.icns new file mode 100644 index 0000000000..91c4530e34 Binary files /dev/null and b/src/MacVim/icons/MacVim-vcf.icns differ diff --git a/src/MacVim/icons/MacVim-vim.icns b/src/MacVim/icons/MacVim-vim.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-vim.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-vim.icns b/src/MacVim/icons/MacVim-vim.icns new file mode 100644 index 0000000000..b2b5c994cf Binary files /dev/null and b/src/MacVim/icons/MacVim-vim.icns differ diff --git a/src/MacVim/icons/MacVim-wiki.icns b/src/MacVim/icons/MacVim-wiki.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-wiki.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-wiki.icns b/src/MacVim/icons/MacVim-wiki.icns new file mode 100644 index 0000000000..c4e6f95513 Binary files /dev/null and b/src/MacVim/icons/MacVim-wiki.icns differ diff --git a/src/MacVim/icons/MacVim-xml.icns b/src/MacVim/icons/MacVim-xml.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-xml.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-xml.icns b/src/MacVim/icons/MacVim-xml.icns new file mode 100644 index 0000000000..7898886a66 Binary files /dev/null and b/src/MacVim/icons/MacVim-xml.icns differ diff --git a/src/MacVim/icons/MacVim-xsl.icns b/src/MacVim/icons/MacVim-xsl.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-xsl.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-xsl.icns b/src/MacVim/icons/MacVim-xsl.icns new file mode 100644 index 0000000000..8a5335a3bf Binary files /dev/null and b/src/MacVim/icons/MacVim-xsl.icns differ diff --git a/src/MacVim/icons/MacVim-yaml.icns b/src/MacVim/icons/MacVim-yaml.icns deleted file mode 120000 index 0b2c45ea39..0000000000 --- a/src/MacVim/icons/MacVim-yaml.icns +++ /dev/null @@ -1 +0,0 @@ -MacVim-generic.icns \ No newline at end of file diff --git a/src/MacVim/icons/MacVim-yaml.icns b/src/MacVim/icons/MacVim-yaml.icns new file mode 100644 index 0000000000..2caac87617 Binary files /dev/null and b/src/MacVim/icons/MacVim-yaml.icns differ diff --git a/src/MacVim/icons/MacVim.icns b/src/MacVim/icons/MacVim.icns old mode 100644 new mode 100755 index eae898156d..4113019366 Binary files a/src/MacVim/icons/MacVim.icns and b/src/MacVim/icons/MacVim.icns differ diff --git a/src/MacVim/icons/Makefile b/src/MacVim/icons/Makefile index 97fa408ac2..1eac40c762 100644 --- a/src/MacVim/icons/Makefile +++ b/src/MacVim/icons/Makefile @@ -2,44 +2,7 @@ OUTDIR ?= . -# This script is called during the build phase with OUTDIR set to the Resources -# folder of the app bundle. The default action is to simply copy all files -# named MacVim-*.icns to OUTDIR. -# -# The files in version control are all links to the MacVim-generic.icns file. -# In order to get prettier document icons, call "make all" in this folder -# before building. This will call the document generation program which -# overwrites the MacVim-*.icns links with actual icons (see make_icons.py). -# -# The Envy Code R font can be used to render small icons that are more legible. -# In order to use ECR, call "make getenvy" before calling "make all". This -# step requires an internet connection. - $(OUTDIR)/MacVim-generic.icns: cp -pR MacVim-*.icns "$(OUTDIR)"/ -all: make_icons.py vim-noshadow-512.png loadfont.so - rm -f MacVim-*.icns - $(MAKE) -C makeicns - /usr/bin/python make_icons.py "$(OUTDIR)" - -loadfont.so: loadfont.c - /usr/bin/python setup.py install --install-lib . - -getenvy: Envy\ Code\ R\ Bold.ttf - -Envy\ Code\ R\ Bold.ttf: EnvyCodeR.zip - unzip -jo EnvyCodeR.zip - # unzip uses the file date from the zip file. Change the file date to - # "now", so that the zip is not unzipped in every `make` run.` - touch Envy\ Code\ R\ Bold.ttf - -ENVYCODE_URL=http://download.damieng.com/fonts/original/EnvyCodeR-PR7.zip -EnvyCodeR.zip: - curl ${ENVYCODE_URL} --location -o EnvyCodeR.zip - -clean: - $(MAKE) -C makeicns clean - rm -f "$(OUTDIR)"/MacVim-*.icns loadfont.so *.pyc \ - EnvyCodeR.zip *.ttf *.reg *.txt - rm -rf *.egginfo build # Created by setup.py +all: diff --git a/src/MacVim/icons/docerator.py b/src/MacVim/icons/docerator.py deleted file mode 100644 index 34381dc2b1..0000000000 --- a/src/MacVim/icons/docerator.py +++ /dev/null @@ -1,616 +0,0 @@ -from Foundation import * -from AppKit import * - -import itertools -import math -import operator -import os - -from optparse import OptionParser - - -# Resources -DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \ - 'Contents/Resources/GenericDocumentIcon.icns' # might require leopard? - - -# Cache both images and background renderers globally -imageCache = {} -bgCache = {} - - -# Make us not crash -# http://www.cocoabuilder.com/archive/message/cocoa/2008/8/6/214964 -NSApplicationLoad() - - -class Surface(object): - """Represents a simple bitmapped image.""" - - def __init__(self, *p, **kw): - if not 'premultiplyAlpha' in kw: - kw['premultiplyAlpha'] = True - if len(p) == 1 and isinstance(p[0], NSBitmapImageRep): - self.bitmapRep = p[0] - elif len(p) == 2 and isinstance(p[0], int) and isinstance(p[1], int): - format = NSAlphaFirstBitmapFormat - if not kw['premultiplyAlpha']: - format += NSAlphaNonpremultipliedBitmapFormat - self.bitmapRep = NSBitmapImageRep.alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_( - None, p[0], p[1], 8, 4, True, False, NSDeviceRGBColorSpace, - format, 0, 0) - - if not hasattr(self, 'bitmapRep') or not self.bitmapRep: - raise Exception('Failed to create surface: ' + str(p)) - - def size(self): - return map(int, self.bitmapRep.size()) # cocoa returns floats. cocoa ftw - - def data(self): - """Returns data in ARGB order (on intel, at least).""" - r = self.bitmapRep - if (r.bitmapFormat() & ~NSAlphaFirstBitmapFormat != - NSAlphaNonpremultipliedBitmapFormat) or \ - r.bitsPerPixel() != 32 or \ - r.isPlanar() or \ - r.samplesPerPixel() != 4: - raise Exception("Unsupported image format") - return self.bitmapRep.bitmapData() - - def rgbaIndices(self): - r = self.bitmapRep - if r.bitmapFormat() & NSAlphaFirstBitmapFormat != 0: - return 1, 2, 3, 0 - else: - return 0, 1, 2, 3 - - def save(self, filename): - """Saves image as png file.""" - self.bitmapRep.representationUsingType_properties_(NSPNGFileType, None) \ - .writeToFile_atomically_(filename, True) - - def draw(self): - self.bitmapRep.draw() - - def context(self): - # Note: Cocoa only supports contexts with premultiplied alpha - return NSGraphicsContext.graphicsContextWithBitmapImageRep_(self.bitmapRep) - - def copy(self): - return Surface(self.bitmapRep.copy()) - - -class Image(object): - """Represents an image that can consist of several Surfaces.""" - - def __init__(self, param): - if isinstance(param, str): - self.image = NSImage.alloc().initWithContentsOfFile_(param) - elif isinstance(param, Surface): - self.image = NSImage.alloc().initWithSize_( param.size() ) - self.image.addRepresentation_(param.bitmapRep) - - if not self.image: - raise Exception('Failed to load image: ' + str(param)) - - def surfaceOfSize(self, w, h): - """Returns an ARGB, non-premultiplied surface of size w*h or throws.""" - r = None - for rep in self.image.representations(): - # Cocoa reports fraction widths for pngs (wtf?!), so use round() - if map(lambda x: int(round(x)), rep.size()) == [w, h]: - r = rep - break - - # XXX: Resample in this case? That'd make the program easier to use, but - # can silently create blurry backgrounds. Since this happens with - # the app icon anyways, this might not be a huge deal? - if not r: - raise Exception('Unsupported size %dx%d', w, h) - return Surface(r) - - def blend(self): - self.compositeInRect( ((0, 0), self.image.size()) ) - - def compositeInRect(self, r, mode=NSCompositeSourceOver): - self.image.drawInRect_fromRect_operation_fraction_(r, NSZeroRect, - mode, 1.0) - - def sizes(self): - s = set() - for rep in self.image.representations(): - s.add(tuple(map(lambda x: int(round(x)), rep.size()))) - return s - - -class Context(object): - # Tiger has only Python2.3, so we can't use __enter__ / __exit__ for this :-( - - def __init__(self, surface): - NSGraphicsContext.saveGraphicsState() - c = surface.context() - c.setShouldAntialias_(True); - c.setImageInterpolation_(NSImageInterpolationHigh); - NSGraphicsContext.setCurrentContext_(c) - - def done(self): - NSGraphicsContext.restoreGraphicsState() - - -class SplittableBackground(object): - - def __init__(self, unsplitted, shouldSplit=True): - self.unsplitted = unsplitted - self.shouldSplit = shouldSplit - self.ground = {} - self.shadow = {} - - def rawGroundAtSize(self, s): - return self.unsplitted.surfaceOfSize(s, s) - - def groundAtSize(self, s): - if not self.shouldSplit: - return self.rawGroundAtSize(s) - self._performSplit(s) - return self.ground[s] - - def shadowAtSize(self, s): - if not self.shouldSplit: - return None - self._performSplit(s) - return self.shadow[s] - - def _performSplit(self, s): - if s in self.ground: - assert s in self.shadow - return - assert s not in self.shadow - ground, shadow = splitGenericDocumentIcon(self.unsplitted, s) - self.ground[s] = ground - self.shadow[s] = shadow - - -class BackgroundRenderer(object): - - def __init__(self, bg, icon=None, r={}): - self.bgRenderer = bg - self.icon = icon - self.cache = {} - self.rect = r - - def drawIcon(self, s): - if not self.icon: - return - - assert s in [16, 32, 128, 256, 512] - a = list(self.rect[s]) - - # convert from `flow` coords to cocoa - a[2] = -a[2] # mirror y - - w, h = s*a[1], s*a[3] - self.icon.compositeInRect( (((s-w)/2 + a[0], (s-h)/2 + a[2]), (w, h)) ) - - def drawAtSize(self, s): - if not self.icon: - # No need to split the background if no icons is interleaved -- take - # the faster code path in that case. - self.bgRenderer.rawGroundAtSize(s).draw() - return - - self.bgRenderer.groundAtSize(s).draw() - self.drawIcon(s) - if self.bgRenderer.shouldSplit: - # shadow needs to be composited, so it needs to be in an image - Image(self.bgRenderer.shadowAtSize(s)).blend() - - def backgroundAtSize(self, s): - if not s in self.cache: - result = Surface(s, s) - context = Context(result) - self.drawAtSize(s) - context.done() - self.cache[s] = result - return self.cache[s] - - -def splitGenericDocumentIcon(img, s): - """Takes the generic document icon and splits it into a background and a - shadow layer. For the 32x32 and 16x16 variants, the white pixels of the page - curl are hardcoded into the otherwise transparent shadow layer.""" - - w, h = s, s - r = img.surfaceOfSize(w, h) - bps = 4*w - data = r.data() - dr, dg, db, da = r.rgbaIndices() - - ground = Surface(w, h, premultiplyAlpha=False) - shadow = Surface(w, h, premultiplyAlpha=False) - - grounddata = ground.data() - shadowdata = shadow.data() - - for y in xrange(h): - for x in xrange(w): - idx = y*bps + 4*x - ia = data[idx + da] - ir = data[idx + dr] - ig = data[idx + dg] - ib = data[idx + db] - if ia != chr(255): - # buffer objects don't support slice assignment :-( - grounddata[idx] = ia - grounddata[idx + 1] = ir - grounddata[idx + 2] = ig - grounddata[idx + 3] = ib - shadowdata[idx] = chr(0) - shadowdata[idx + 1] = chr(0) - shadowdata[idx + 2] = chr(0) - shadowdata[idx + 3] = chr(0) - continue - - assert ir == ig == ib - grounddata[idx] = chr(255) - grounddata[idx + 1] = chr(255) - grounddata[idx + 2] = chr(255) - grounddata[idx + 3] = chr(255) - shadowdata[idx] = chr(255 - ord(ir)) - shadowdata[idx + 1] = chr(0) - shadowdata[idx + 2] = chr(0) - shadowdata[idx + 3] = chr(0) - - # Special-case 16x16 and 32x32 cases: Make some pixels on the fold white. - # Ideally, I could make the fold whiteish in all variants, but I can't. - whitePix = { 16: [(10, 2), (10, 3), (11, 3), (10, 4), (11, 4), (12, 4)], - 32: [(21, 4), (21, 5), (22, 5), (21, 6), (22, 6), (23, 6)]} - if (w, h) in [(16, 16), (32, 32)]: - for x, y in whitePix[w]: - idx = y*bps + 4*x - shadowdata[idx] = chr(255) - shadowdata[idx + 1] = chr(255) - shadowdata[idx + 2] = chr(255) - shadowdata[idx + 3] = chr(255) - - return ground, shadow - - -class TextRenderer(object): - - def __init__(self): - self.cache = {} - - def attribsAtSize(self, s): - if s not in self.cache: - self.cache[s] = self._attribsAtSize(s) - return self.cache[s] - - def centeredStyle(self): - style = NSMutableParagraphStyle.new() - style.setParagraphStyle_(NSParagraphStyle.defaultParagraphStyle()) - style.setAlignment_(NSCenterTextAlignment) - return style - - def _attribsAtSize(self, s): - # This looks not exactly like the font on Preview.app's document icons, - # but I believe that's because Preview's icons are drawn by Photoshop, - # and Adobe's font rendering is different from Apple's. - fontname = 'LucidaGrande-Bold' - - # Prepare text format - fontsizes = { 512: 72.0, 256: 36.0, 128: 18.0, 32: 7.0, 16: 3.0 } - # http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#//apple_ref/doc/uid/TP40004903 - attribs = { - NSParagraphStyleAttributeName: self.centeredStyle(), - NSForegroundColorAttributeName: NSColor.colorWithDeviceWhite_alpha_( - 0.34, 1), - NSFontAttributeName: NSFont.fontWithName_size_(fontname, fontsizes[s]) - } - - # tighten font a bit for some sizes - if s in [256, 512]: - attribs[NSKernAttributeName] = -1.0 - elif s == 32: - attribs[NSKernAttributeName] = -0.25 - - if not attribs[NSFontAttributeName]: - raise Exception('Failed to load font %s' % fontname) - return attribs - - def drawTextAtSize(self, text, s): - """Draws text `s` into the current context of size `s`.""" - - textRects = { - 512: ((0, 7), (512, 119)), - 128: ((0, 6), (128, 26.5)), - 256: ((0, 7), (256, 57)), - 16: ((1, 1), (15, 5)), - #32: ((1, 1), (31, 9)) - } - - attribs = self.attribsAtSize(s) - text = NSString.stringWithString_(text) - if s in [16, 128, 256, 512]: - text.drawInRect_withAttributes_(textRects[s], attribs) - elif s == 32: - # Try to align text on pixel boundary: - attribs = attribs.copy() - attribs[NSParagraphStyleAttributeName] = \ - NSParagraphStyle.defaultParagraphStyle() - ts = text.sizeWithAttributes_(attribs) - text.drawAtPoint_withAttributes_( (math.floor((32.0-ts[0])/2) + 0.5, 1.5), - attribs) - - -class OfficeTextRenderer(TextRenderer): - """Uses Office's LucidaSans font for 32x32. - - This font looks much better for certain strings (e.g. "PDF") but much worse - for most others (e.g. "VIM", "JAVA") -- and office fonts are usually not - installed. Hence, this class is better not used. - """ - - def _attribsAtSize(self, s): - self.useOfficeFont = False - attribs = TextRenderer._attribsAtSize(self, s) - if s == 32: - font = NSFont.fontWithName_size_('LucidaSans-Demi', 7.0) - if font: - attribs[NSFontAttributeName] = font - attribs[NSKernAttributeName] = 0 - self.useOfficeFont = True - return attribs - - def drawTextAtSize(self, text, s): - attribs = self.attribsAtSize(s) - if not self.useOfficeFont or s != 32: - TextRenderer.drawTextAtSize(self, text, s) - return - text = NSString.stringWithString_(text) - text.drawInRect_withAttributes_( ((0, 1), (31, 11)), attribs) - - -def createIcon(s, bg, textRenderer, text): - - # Fill in background - output = bg.backgroundAtSize(s).copy() - - # Draw text on top of shadow - context = Context(output) - if s in text and text[s]: - textRenderer.drawTextAtSize(text[s], s) - context.done() - - return output - - -def textDictFromTextList(l): - assert 1 <= len(l) <= 3 - if len(l) == 1: - return dict.fromkeys([16, 32, 128, 256, 512], l[0]) - elif len(l) == 2: - return dict(zip([16, 32], 2*[l[1]]) + zip((128, 256, 512), 3*[l[0]])) - elif len(l) == 3: - return dict([(16, l[2]), (32, l[1])] + zip((128, 256, 512), 3*[l[0]])) - - -def saveIcns(icons, icnsName, makeIcns='./makeicns'): - """Creates an icns file with several variants. - - Params: - icons: A dict that contains icon size as key and Surface as value. - Valid keys are 512, 256, 128, 32, 16 - icnsname: Name of the output file - """ - # If IconFamily was less buggy, we could wrap it into a python module and - # call it directly, which is about a lot faster. However, IconFamily does not - # work with NSAlphaNonpremultipliedBitmapFormat correctly, so this has to - # wait. - #import IconFamily - #typeDict = { - #16: IconFamily.kSmall32BitData, - #32: IconFamily.kLarge32BitData, - #128: IconFamily.kThumbnail32BitData, - #256: IconFamily.kIconServices256PixelDataARGB, - #512: IconFamily.IconServices512PixelDataARGB, - #} - #maskDict = { - #16: IconFamily.kSmall8BitMask, - #32: IconFamily.kLarge8BitMask, - #128: IconFamily.kThumbnail8BitMask, - #} - #output = IconFamily.IconFamily.iconFamily() - #for s, icon in icons.items(): - #output.setIconFamilyElement_fromBitmapImageRep_(typeDict[s], icon.bitmapRep) - #if s in maskDict: - #output.setIconFamilyElement_fromBitmapImageRep_( - #maskDict[s], icon.bitmapRep) - #output.writeToFile_(icnsName) - TMPFILE = 'docerator_tmp_%d.png' - try: - args = [] - for s, icon in icons.items(): - assert s in [512, 256, 128, 32, 16] - assert icon.size() == [s, s] - icon.save(TMPFILE % s) - args.append('-%d %s' % (s, TMPFILE % s)) - return \ - os.system('%s %s -out %s' % (makeIcns, ' '.join(args), icnsName)) == 0 - finally: - for s in icons: - if os.access(TMPFILE % s, os.F_OK): - os.remove(TMPFILE % s) - - -def getOutname(options): - def saneBasename(p): - """ '/my/path/to/file.txt' -> 'file' """ - return os.path.splitext(os.path.basename(p))[0] - textPart = 'Generic' - if options.text: - textPart = options.text.split(',')[0] - if options.appicon: - base = saneBasename(options.appicon) - else: - base = saneBasename(getBgName(options)) - return '%s-%s.icns' % (base, textPart) - - -def cachedImage(filename): - absPath = os.path.abspath(filename) - if not absPath in imageCache: - imageCache[absPath] = Image(absPath) - return imageCache[absPath] - - -def cachedBackground(img, split): - key = (img, split) - if not key in bgCache: - bgCache[key] = SplittableBackground(img, shouldSplit=split) - return bgCache[key] - - -# taken from running flow on preview -defaultRects = { - 16: (-0.30890000000000001, 0.4919, -1.2968, 0.4743), - 32: (-0.27810000000000001, - 0.58930000000000005, - -2.2292999999999998, - 0.57140000000000002), - 128: (1.1774, 0.56820000000000004, -0.8246, 0.56799999999999995), - 256: (0.5917, 0.56489999999999996, -1.8994, 0.56499999999999995), - 512: (0.68700000000000006, - 0.56530000000000002, - -4.2813999999999997, - 0.56540000000000001) - } - - -def getBgName(options): - if not hasattr(options, 'background') \ - or options.background in ['default-split', 'default-unsplit']: - return DEFAULT_BACKGROUND - else: - return options.background - - -class IconGenerator(object): - def __init__(self, options): - if hasattr(options, 'textrenderer') and options.textrenderer: - self.textRenderer = options.textrenderer() - else: - self.textRenderer = TextRenderer() - - # Prepare input images - splitBackground = options.background == 'default-split' - self.bgIcon = cachedImage(getBgName(options)) - - self.testIcon = None - if options.appicon: - self.testIcon = cachedImage(options.appicon) - - rects = defaultRects.copy() - rects[16] = [ 0.0000, 0.5000, -1.0000, 0.5000] # manually, better - if hasattr(options, 'rects'): - rects.update(options.rects) - - bg = cachedBackground(self.bgIcon, splitBackground) - - if hasattr(options, 'backgroundrenderer') and options.backgroundrenderer: - self.bgRenderer = options.backgroundrenderer(bg, self.testIcon, rects) - else: - self.bgRenderer = BackgroundRenderer(bg, self.testIcon, rects) - - self.testtext = textDictFromTextList(options.text.split(',')) - - def createIconAtSize(self, s): - return createIcon(s, self.bgRenderer, self.textRenderer, self.testtext) - - -def iconGenerator(**kwargs): - return IconGenerator(optsFromDict(**kwargs)) - - -def makedocicon_opts(options): - renderer = IconGenerator(options) - - if hasattr(options, 'sizes') and options.sizes: - if isinstance(options.sizes, list): - sizes = options.sizes - else: - sizes = map(int, options.sizes.split(',')) - else: - sizes = renderer.bgIcon.sizes() - if renderer.testIcon: - sizes = sizes.intersection(renderer.testIcon.sizes()) - sizes = sorted(map(operator.itemgetter(0), sizes)) - - icons = dict([(s, renderer.createIconAtSize(s)) for s in sizes]) - - if options.debug: - for s, icon in icons.iteritems(): - icon.save(options.debug % s) - - if hasattr(options, 'outname') and options.outname: - outname = options.outname - else: - outname = getOutname(options) - if saveIcns(icons, outname, options.makeicns): - print 'Wrote', outname - else: - print 'Failed to write %s. Make sure makeicns is in your path.' % outname - - -def optsFromDict(**kwargs): - options, _ = getopts().parse_args([]) # get default options - for k in kwargs: - setattr(options, k, kwargs[k]) - return options - - -def makedocicon(**kwargs): - makedocicon_opts(optsFromDict(**kwargs)) - - -def makedocicons_opts(options): - if not hasattr(options, 'text') or not options.text: - options.text = [''] - texts = options.text - for text in texts: - options.text = text - makedocicon_opts(options) - - -def makedocicons(**kwargs): - makedocicons_opts(optsFromDict(**kwargs)) - - -def getopts(): - parser = OptionParser(usage='%prog [options]', version='%prog 1.01') - parser.add_option('--background', '--bg', default='default-split', - help='Used as background (special values: "default-split" (default), ' \ - '"default-unsplit").') - parser.add_option('--appicon', help='App icon, defaults to no icon.') - - parser.add_option('--text', help='Text on icon. Defaults to empty. ' - 'More than one text is supported, multiple docicons are generated in ' - 'that case.', action='append') - parser.add_option('--sizes', help='Sizes of icons. ' \ - 'Defaults to all sizes available in input appicon. Example: "512,128,16"') - # XXX(Nico): This has to go - parser.add_option('--debug', help='If set, write out pngs for all variants.' \ - ' This needs to look like "debug%d.png".') - # XXX(Nico): This has to go once IconFamily is less buggy and can be used - # directly - parser.add_option('--makeicns', help='Path to makeicns binary', - default='./makeicns') - return parser - - -def main(): - options, args = getopts().parse_args() - makedocicons_opts(options) - - -if __name__ == '__main__': - main() diff --git a/src/MacVim/icons/docerator_test.py b/src/MacVim/icons/docerator_test.py deleted file mode 100644 index f84eb32c56..0000000000 --- a/src/MacVim/icons/docerator_test.py +++ /dev/null @@ -1,65 +0,0 @@ -import docerator -import unittest - - -class TextDictFromTextListTest(unittest.TestCase): - - def testBasic(self): - - self.assertEquals({16: 'a', 32: 'a', 128: 'a', 256: 'a', 512: 'a'}, - docerator.textDictFromTextList(['a'])) - self.assertEquals({16: 'b', 32: 'b', 128: 'a', 256: 'a', 512: 'a'}, - docerator.textDictFromTextList(['a', 'b'])) - self.assertEquals({16: 'c', 32: 'b', 128: 'a', 256: 'a', 512: 'a'}, - docerator.textDictFromTextList(['a', 'b', 'c'])) - - -class OutnameTest(unittest.TestCase): - - class FakeOptions(object): - def __init__(self, **kwargs): - for k in kwargs: - self.__setattr__(k, kwargs[k]) - - def testBasic(self): - options = OutnameTest.FakeOptions( - appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns', - text='MP3') - self.assertEquals('iTunes-MP3.icns', docerator.getOutname(options)) - - def testTextList(self): - options = OutnameTest.FakeOptions( - appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns', - text='PYTHON,PY') - self.assertEquals('iTunes-PYTHON.icns', - docerator.getOutname(options)) - - def testEmptyText(self): - options = OutnameTest.FakeOptions( - appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns', - text='') - self.assertEquals('iTunes-Generic.icns', docerator.getOutname(options)) - options = OutnameTest.FakeOptions( - appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns', - text=None) - self.assertEquals('iTunes-Generic.icns', - docerator.getOutname(options)) - - def testEmptyIcon(self): - options = OutnameTest.FakeOptions(appicon=None, text='MP3') - self.assertEquals('GenericDocumentIcon-MP3.icns', - docerator.getOutname(options)) - options = OutnameTest.FakeOptions(appicon=None, text='') - self.assertEquals('GenericDocumentIcon-Generic.icns', - docerator.getOutname(options)) - options = OutnameTest.FakeOptions(appicon=None, text='', - background='/Applications/Bla/bgicon.icns') - self.assertEquals('bgicon-Generic.icns', - docerator.getOutname(options)) - - -# XXX(Nico): Look at the doctest module. - - -if __name__ == '__main__': - unittest.main() diff --git a/src/MacVim/icons/loadfont.c b/src/MacVim/icons/loadfont.c deleted file mode 100644 index d39170e120..0000000000 --- a/src/MacVim/icons/loadfont.c +++ /dev/null @@ -1,56 +0,0 @@ -// A small python module that registers a font with ATS, given the name of -// the font. - -#include <Python/Python.h> -#include <CoreFoundation/CoreFoundation.h> -#include <Carbon/Carbon.h> - -static PyObject* loadfont(PyObject* self, PyObject* args) { - PyObject* result = Py_False; - const char* path = NULL; - int ok = PyArg_ParseTuple(args, "s", &path); - - if (ok) { - CFStringRef componentPath = CFStringCreateWithCString(kCFAllocatorDefault, - path, kCFStringEncodingUTF8); - CFURLRef componentURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - componentPath, kCFURLPOSIXPathStyle, false); - FSRef fsref; - - if (CFURLGetFSRef(componentURL, &fsref)) { - OSStatus err = noErr; - ATSFontContainerRef fontContainerRef; // we don't deactivate the font -#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) - err = ATSFontActivateFromFileReference(&fsref, - kATSFontContextLocal, kATSFontFormatUnspecified, NULL, - kATSOptionFlagsDefault, &fontContainerRef); -#else - FSSpec fsSpec; - FSRef fsRef; - if ((err = FSGetCatalogInfo( - &fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec, NULL)) == noErr) { - err = ATSFontActivateFromFileSpecification(&fsSpec, - kATSFontContextLocal, kATSFontFormatUnspecified, NULL, - kATSOptionFlagsDefault, &fontContainerRef); - } - -#endif - - if (err == noErr) { - result = Py_True; - } - } - CFRelease(componentURL); - CFRelease(componentPath); - } - return result; -} - -static PyMethodDef LoadfontMethods[] = { - { "loadfont", loadfont, METH_VARARGS, "Locally activates font from file." }, - { NULL, NULL, 0, NULL } -}; - -PyMODINIT_FUNC initloadfont(void) { - Py_InitModule("loadfont", LoadfontMethods); -} diff --git a/src/MacVim/icons/make_icons.py b/src/MacVim/icons/make_icons.py deleted file mode 100644 index 49d6f6340f..0000000000 --- a/src/MacVim/icons/make_icons.py +++ /dev/null @@ -1,208 +0,0 @@ -# Creates all of MacVim document icons. - -import os -import sys - -fontname = '' -facename = None - -# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa -try: - # Make us independent of sysprefs->appearance->antialias fonts smaller than... - # Needs to happen before docerator is imported. - from AppKit import NSUserDefaults - prefs = NSUserDefaults.standardUserDefaults() - prefs.setInteger_forKey_(4, 'AppleAntiAliasingThreshold') - - import docerator - import loadfont - - from Foundation import NSString - from AppKit import * - - dont_create = False -except Exception, e: - print e - dont_create = True # most likely because we're on tiger - - -# icon types -LARGE = 0 # 512, 128, 32, 16; about 96kB -SMALL = 1 # 128, 32, 16; about 36kB -LINK = 2 # Create link to generic icon; 4kB (== smallest block size on HFS+) - -iconsizes = { - SMALL: [128, 32, 16], - LARGE: [512, 128, 32, 16], -} - - -# Resources -MAKEICNS = 'makeicns/makeicns' -APPICON = 'vim-noshadow-512.png' -DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \ - 'Contents/Resources/GenericDocumentIcon.icns' - - -# List of icons to create -GENERIC_ICON_NAME = 'MacVim-generic' -vimIcons = { - GENERIC_ICON_NAME: [u'', LARGE], - 'MacVim-vim': [u'VIM', LARGE], - 'MacVim-txt': [u'TXT', SMALL], - 'MacVim-tex': [u'TEX', SMALL], - 'MacVim-h': [u'H', SMALL], - 'MacVim-c': [u'C', SMALL], - 'MacVim-m': [u'M', SMALL], - 'MacVim-mm': [u'MM', SMALL], - 'MacVim-cpp': [u'C\uff0b\uff0b,C++,C++', SMALL], # fullwidth plusses - 'MacVim-java': [u'JAVA', SMALL], - 'MacVim-f': [u'FTRAN', SMALL], - 'MacVim-html': [u'HTML', SMALL], - 'MacVim-xml': [u'XML', SMALL], - 'MacVim-js': [u'JS', SMALL], - 'MacVim-perl': [u'PERL,PL', SMALL], - 'MacVim-py': [u'PYTHON,PY', SMALL], - 'MacVim-php': [u'PHP', SMALL], - 'MacVim-rb': [u'RUBY,RB', SMALL], - 'MacVim-bash': [u'SH', SMALL], - 'MacVim-patch': [u'DIFF', SMALL], - 'MacVim-applescript': [u'\uf8ffSCPT,\uf8ffS', SMALL], # apple sign - 'MacVim-as': [u'FLASH', LINK], - 'MacVim-asp': [u'ASP', LINK], - 'MacVim-bib': [u'BIB', LINK], - 'MacVim-cs': [u'C#', LINK], - 'MacVim-csfg': [u'CFDG', LINK], - 'MacVim-csv': [u'CSV', LINK], - 'MacVim-tsv': [u'TSV', LINK], - 'MacVim-cgi': [u'CGI', LINK], - 'MacVim-cfg': [u'CFG', LINK], - 'MacVim-css': [u'CSS', SMALL], - 'MacVim-dtd': [u'DTD', LINK], - 'MacVim-dylan': [u'DYLAN', LINK], - 'MacVim-erl': [u'ERLANG,ERL', SMALL], - 'MacVim-fscript': [u'FSCPT,FSCR,FS', SMALL], - 'MacVim-hs': [u'HS', SMALL], - 'MacVim-inc': [u'INC', LINK], - 'MacVim-ics': [u'ICS', SMALL], - 'MacVim-ini': [u'INI', LINK], - 'MacVim-io': [u'IO', LINK], - 'MacVim-bsh': [u'BSH', LINK], - 'MacVim-properties': [u'PROP', LINK], - 'MacVim-jsp': [u'JSP', SMALL], - 'MacVim-lisp': [u'LISP,LISP,LSP', SMALL], - 'MacVim-log': [u'LOG', SMALL], - 'MacVim-wiki': [u'WIKI', SMALL], - 'MacVim-ps': [u'PS', LINK], - #'MacVim-plist': [u'PLIST', SMALL], - 'MacVim-sch': [u'SCHEME,SCM', SMALL], - 'MacVim-sql': [u'SQL', SMALL], - 'MacVim-tcl': [u'TCL', SMALL], - 'MacVim-xsl': [u'XSL', LINK], - 'MacVim-vcf': [u'VCARD,VCF', SMALL], - 'MacVim-vb': [u'VBASIC,VB', LINK], - 'MacVim-yaml': [u'YAML,YAML,YML', SMALL], - 'MacVim-gtd': [u'GTD', LINK], - 'MacVim-markdown': [u'MARK\u2193,M\u2193', LINK], # down arrow - 'MacVim-rst': [u'RST', LINK], - 'MacVim-vba': [u'VBA', LINK], -} - - -def createLinks(icons, target): - assert len(icons) > 0 - for name in icons: - icnsName = '%s.icns' % name - if os.access(icnsName, os.F_OK): - os.remove(icnsName) - os.symlink(target, icnsName) - -if not dont_create: - # define a few classes to render custom 16x16 icons - - class NoTextRenderer(docerator.TextRenderer): - def drawTextAtSize(self, text, s): - if s == 16: return # No text at 16x16 - docerator.TextRenderer.drawTextAtSize(self, text, s) - - class NoIconRenderer(docerator.BackgroundRenderer): - def drawIcon(self, s): - if s == 16: return # no "MacVim" icon on the sheet at 16x16 - docerator.BackgroundRenderer.drawIcon(self, s) - - class SmallTextRenderer(docerator.TextRenderer): - def _attribsAtSize(self, s): - global facename - attribs = docerator.TextRenderer._attribsAtSize(self, s) - if s == 16 and facename is not None: - font = NSFont.fontWithName_size_(facename, 7.0) - assert font - attribs[NSFontAttributeName] = font - attribs[NSForegroundColorAttributeName] = \ - NSColor.colorWithDeviceRed_green_blue_alpha_( - 0/255.0, 82/255.0, 0/255.0, 1) - return attribs - - def drawTextAtSize(self, text, s): - if s != 16: - docerator.TextRenderer.drawTextAtSize(self, text, s) - return - text = NSString.stringWithString_(text.lower()[0:3]) # at most 3 chars - attribs = self.attribsAtSize(s) - if len(text) <= 2: - attribs[NSKernAttributeName] = 0 # we have some space - else: - attribs[NSKernAttributeName] = -1 # we need all the room we can get - text.drawInRect_withAttributes_( ((1, 2), (15, 11)), attribs) - -def main(): - if dont_create: - print "PyObjC not found, only using a stock icon for document icons." - # Can't use the constants from docerator in this case - import shutil - shutil.copyfile(DEFAULT_BACKGROUND, '%s.icns' % GENERIC_ICON_NAME) - createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME], - '%s.icns' % GENERIC_ICON_NAME) - return - - # choose an icon font - global fontname, facename - # Thanks to DamienG for Envy Code R (redistributed with permission): - # http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released - fonts = [('Envy Code R Bold.ttf', 'EnvyCodeR-Bold'), - ('/System/Library/Fonts/Monaco.dfont', 'Monaco')] - for font in fonts: - if loadfont.loadfont(font[0]): - fontname, facename = font - break - print "Building icons with font '" + fontname + "'." - - srcdir = os.getcwd() - if len(sys.argv) > 1: - os.chdir(sys.argv[1]) - appIcon = os.path.join(srcdir, APPICON) - makeIcns = os.path.join(srcdir, MAKEICNS) - - # create LARGE and SMALL icons first... - for name, t in vimIcons.iteritems(): - text, size = t - if size == LINK: continue - print name - if name == GENERIC_ICON_NAME: - # The generic icon has no text; make the appicon a bit larger - docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, - text=text, sizes=iconsizes[size], makeicns=makeIcns, - textrenderer=NoTextRenderer, rects={16:(0.0, 0.5533, 0.0, 0.5533)}) - else: - # For the other icons, leave out appicon and render text in Envy Code R - docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon, - text=text, sizes=iconsizes[size], makeicns=makeIcns, - textrenderer=SmallTextRenderer, backgroundrenderer=NoIconRenderer) - - # ...create links later (to make sure the link targets exist) - createLinks([name for (name, t) in vimIcons.items() if t[1] == LINK], - '%s.icns' % GENERIC_ICON_NAME) - - -if __name__ == '__main__': - main() diff --git a/src/MacVim/icons/makeicns/IconFamily.h b/src/MacVim/icons/makeicns/IconFamily.h deleted file mode 100644 index 18ccf4b44d..0000000000 --- a/src/MacVim/icons/makeicns/IconFamily.h +++ /dev/null @@ -1,190 +0,0 @@ -// IconFamily.h -// IconFamily class interface -// by Troy Stephens, Thomas Schnitzer, David Remahl, Nathan Day, Ben Haller, Sven Janssen, Peter Hosey, Conor Dearden, Elliot Glaysher, and Dave MacLachlan -// version 0.9.3 -// -// Project Home Page: -// http://iconfamily.sourceforge.net/ -// -// Problems, shortcomings, and uncertainties that I'm aware of are flagged with "NOTE:". Please address bug reports, bug fixes, suggestions, etc. to the project Forums and bug tracker at https://sourceforge.net/projects/iconfamily/ - -/* - Copyright (c) 2001-2006 Troy N. Stephens - Portions Copyright (c) 2007 Google Inc. - - Use and distribution of this source code is governed by the MIT License, whose terms are as follows. - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#import <Cocoa/Cocoa.h> -#import <Carbon/Carbon.h> - -// This class is a Cocoa/Objective-C wrapper for the Mac OS X Carbon API's -// "icon family" data type. Its main purpose is to enable Cocoa applications -// to easily create custom file icons from NSImage instances, and thus take -// advantage of Mac OS X's new larger RGBA "thumbnail" icon format to provide -// richly detailed thumbnail previews of the files' contents. -// -// Using IconFamily, this becomes as simple as: -// -// id iconFamily = [IconFamily iconFamilyWithThumbnailsOfImage:anImage]; -// [iconFamily setAsCustomIconForFile:anExistingFile]; -// -// You can also write an icon family to an .icns file using the -writeToFile: -// method. - -@interface IconFamily : NSObject -{ - IconFamilyHandle hIconFamily; -} - -// Convenience methods. These use the corresponding -init... methods to return -// an autoreleased IconFamily instance. - -+ (IconFamily*) iconFamily; -+ (IconFamily*) iconFamilyWithContentsOfFile:(NSString*)path; -+ (IconFamily*) iconFamilyWithIconOfFile:(NSString*)path; -+ (IconFamily*) iconFamilyWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily; -+ (IconFamily*) iconFamilyWithSystemIcon:(int)fourByteCode; -+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image; -+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation; - -// Initializes as a new, empty IconFamily. This is IconFamily's designated -// initializer method. - -- init; - -// Initializes an IconFamily by loading the contents of an .icns file. - -- initWithContentsOfFile:(NSString*)path; - -// Initializes an IconFamily from an existing Carbon IconFamilyHandle. - -- initWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily; - -// Initializes an IconFamily by loading the Finder icon that's assigned to a -// file. - -- initWithIconOfFile:(NSString*)path; - -// Initializes an IconFamily by referencing a standard system icon. - -- initWithSystemIcon:(int)fourByteCode; - -// Initializes an IconFamily by creating its elements from a resampled -// NSImage. The second form of this method allows you to specify the degree -// of antialiasing to be used in resampling the image, by passing in one of -// the NSImageInterpolation... constants that are defined in -// NSGraphicsContext.h. The first form of this initializer simply calls the -// second form with imageInterpolation set to NSImageInterpolationHigh, which -// produces highly smoothed thumbnails. - -- initWithThumbnailsOfImage:(NSImage*)image; -- initWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation; - -// Writes the icon family to an .icns file. - -- (BOOL) writeToFile:(NSString*)path; - -// Sets the image data for one of the icon family's elements from an -// NSBitmapImageRep. The "elementType" parameter must be one of the icon -// family element types listed below, and the format of the "bitmapImageRep" -// must match the corresponding requirements specified below. Regardless of -// the elementType, the bitmapImageRep must also be non-planar and have 8 bits -// per sample. -// -// elementType dimensions format -// ------------------- ---------- --------------------------------------- -// kIconServices512PixelDataARGB 512 x 512 32-bit RGBA, 32-bit RGB, or 24-bit RGB -// kIconServices256PixelDataARGB 256 x 256 32-bit RGBA, 32-bit RGB, or 24-bit RGB -// kThumbnail32BitData 128 x 128 32-bit RGBA, 32-bit RGB, or 24-bit RGB -// kThumbnail8BitMask 128 x 128 32-bit RGBA or 8-bit intensity -// kLarge32BitData 32 x 32 32-bit RGBA, 32-bit RGB, or 24-bit RGB -// kLarge8BitMask 32 x 32 32-bit RGBA or 8-bit intensity -// kLarge1BitMask 32 x 32 32-bit RGBA, 8-bit intensity, or 1-bit -// kSmall32BitData 16 x 16 32-bit RGBA, 32-bit RGB, or 24-bit RGB -// kSmall8BitMask 16 x 16 32-bit RGBA or 8-bit intensity -// kSmall1BitMask 16 x 16 32-bit RGBA, 8-bit intensity, or 1-bit -// -// When an RGBA image is supplied to set a "Mask" element, the mask data is -// taken from the image's alpha channel. -// -// NOTE: Setting an IconFamily's kLarge1BitMask seems to damage the IconFamily -// for some as yet unknown reason. (If you then assign the icon family -// as a file's custom icon using -setAsCustomIconForFile:, the custom -// icon doesn't appear for the file in the Finder.) However, both -// custom icon display and mouse-click hit-testing in the Finder seem to -// work fine when we only set the other four elements (thus keeping the -// existing kLarge1BitMask from the valid icon family from which we -// initialized the IconFamily via -initWithContentsOfFile:, since -// IconFamily's -init method is currently broken...), so it seems safe -// to just leave the kLarge1BitMask alone. - -- (BOOL) setIconFamilyElement:(OSType)elementType - fromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep; - -// Gets the image data for one of the icon family's elements as a new, 32-bit -// RGBA NSBitmapImageRep. The specified elementType should be one of -// kIconServices512PixelDataARGB, kIconServices256PixelDataARGB, -// kThumbnail32BitData, kLarge32BitData, or kSmall32BitData. -// -// The returned NSBitmapImageRep will have the corresponding 8-bit mask data -// in its alpha channel, or a fully opaque alpha channel if the icon family -// has no 8-bit mask data for the specified alpha channel. -// -// Returns nil if the requested element cannot be retrieved (e.g. if the -// icon family has no such 32BitData element). - -- (NSBitmapImageRep*) bitmapImageRepWithAlphaForIconFamilyElement:(OSType)elementType; - -// Creates and returns an NSImage that contains the icon family's various -// elements as its NSImageReps. - -- (NSImage*) imageWithAllReps; - -// NOTE: Planned method -- not yet implemented. -// -// Gets the image data for one of the icon family's elements as a new -// NSBitmapImageRep. The specified elementType should be one of -// kThumbnail32BitData, kThumbnail8BitMask, kLarge32BitData, kLarge8BitMask, -// kLarge1BitMask, kSmall32BitData, kSmall8BitMask, or kSmall1BitMask. - -// - (NSBitmapImageRep*) bitmapImageRepForIconFamilyElement:(OSType)elementType; - -// Writes the icon family to the resource fork of the specified file as its -// kCustomIconResource, and sets the necessary Finder bits so the icon will -// be displayed for the file in Finder views. - -- (BOOL) setAsCustomIconForFile:(NSString*)path; -- (BOOL) setAsCustomIconForFile:(NSString*)path withCompatibility:(BOOL)compat; - -// Same as the -setAsCustomIconForFile:... methods, but for folders (directories). - -- (BOOL) setAsCustomIconForDirectory:(NSString*)path; -- (BOOL) setAsCustomIconForDirectory:(NSString*)path withCompatibility:(BOOL)compat; - -// Removes the custom icon (if any) from the specified file's resource fork, -// and clears the necessary Finder bits for the file. (Note that this is a -// class method, so you don't need an instance of IconFamily to invoke it.) - -+ (BOOL) removeCustomIconFromFile:(NSString*)path; - -@end - - -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // Scrap Manager has been nixed on Snow Leopard -// Methods for interfacing with the Carbon Scrap Manager (analogous to and -// interoperable with the Cocoa Pasteboard). -@interface IconFamily (ScrapAdditions) -+ (BOOL) canInitWithScrap; -+ (IconFamily*) iconFamilyWithScrap; -- initWithScrap; -- (BOOL) putOnScrap; -@end -#endif - diff --git a/src/MacVim/icons/makeicns/IconFamily.m b/src/MacVim/icons/makeicns/IconFamily.m deleted file mode 100644 index 09bd0f26ac..0000000000 --- a/src/MacVim/icons/makeicns/IconFamily.m +++ /dev/null @@ -1,1577 +0,0 @@ -// IconFamily.m -// IconFamily class implementation -// by Troy Stephens, Thomas Schnitzer, David Remahl, Nathan Day, Ben Haller, Sven Janssen, Peter Hosey, Conor Dearden, Elliot Glaysher, and Dave MacLachlan -// version 0.9.3 -// -// Project Home Page: -// http://iconfamily.sourceforge.net/ -// -// Problems, shortcomings, and uncertainties that I'm aware of are flagged with "NOTE:". Please address bug reports, bug fixes, suggestions, etc. to the project Forums and bug tracker at https://sourceforge.net/projects/iconfamily/ - -/* - Copyright (c) 2001-2006 Troy N. Stephens - Portions Copyright (c) 2007 Google Inc. - - Use and distribution of this source code is governed by the MIT License, whose terms are as follows. - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#import "IconFamily.h" -#import "NSString+CarbonFSRefCreation.h" - -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 -// This is defined in 10.5 and beyond in IconStorage.h -enum { - kIconServices512PixelDataARGB = 'ic09' /* non-premultiplied 512x512 ARGB bitmap*/ -}; -#endif - -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 -// This is defined in 10.4 and beyond in IconStorage.h -enum { - kIconServices256PixelDataARGB = 'ic08' /* non-premultiplied 256x256 ARGB bitmap*/ -}; -#endif - - -@interface IconFamily (Internals) - -+ (NSImage*) resampleImage:(NSImage*)image toIconWidth:(int)width usingImageInterpolation:(NSImageInterpolation)imageInterpolation; - -+ (Handle) get32BitDataFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize; - -+ (Handle) get8BitDataFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize; - -+ (Handle) get8BitMaskFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize; - -+ (Handle) get1BitMaskFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize; - -- (BOOL) addResourceType:(OSType)type asResID:(int)resID; - -@end - -@implementation IconFamily - -+ (IconFamily*) iconFamily -{ - return [[[IconFamily alloc] init] autorelease]; -} - -+ (IconFamily*) iconFamilyWithContentsOfFile:(NSString*)path -{ - return [[[IconFamily alloc] initWithContentsOfFile:path] autorelease]; -} - -+ (IconFamily*) iconFamilyWithIconOfFile:(NSString*)path -{ - return [[[IconFamily alloc] initWithIconOfFile:path] autorelease]; -} - -+ (IconFamily*) iconFamilyWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily -{ - return [[[IconFamily alloc] initWithIconFamilyHandle:hNewIconFamily] autorelease]; -} - -+ (IconFamily*) iconFamilyWithSystemIcon:(int)fourByteCode -{ - return [[[IconFamily alloc] initWithSystemIcon:fourByteCode] autorelease]; -} - -+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image -{ - return [[[IconFamily alloc] initWithThumbnailsOfImage:image] autorelease]; -} - -+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation -{ - return [[[IconFamily alloc] initWithThumbnailsOfImage:image usingImageInterpolation:imageInterpolation] autorelease]; -} - -// This is IconFamily's designated initializer. It creates a new IconFamily that initially has no elements. -// -// The proper way to do this is to simply allocate a zero-sized handle (not to be confused with an empty handle) and assign it to hIconFamily. This technique works on Mac OS X 10.2 as well as on 10.0.x and 10.1.x. Our previous technique of allocating an IconFamily struct with a resourceSize of 0 no longer works as of Mac OS X 10.2. -- init -{ - self = [super init]; - if (self) { - hIconFamily = (IconFamilyHandle) NewHandle( 0 ); - if (hIconFamily == NULL) { - [self autorelease]; - return nil; - } - } - return self; -} - -- initWithContentsOfFile:(NSString*)path -{ - FSRef ref; - OSStatus result; - - self = [self init]; - if (self) { - if (hIconFamily) { - DisposeHandle( (Handle)hIconFamily ); - hIconFamily = NULL; - } - if (![path getFSRef:&ref createFileIfNecessary:NO]) { - [self autorelease]; - return nil; - } - result = ReadIconFromFSRef( &ref, &hIconFamily ); - if (result != noErr) { - [self autorelease]; - return nil; - } - } - return self; -} - -- initWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily -{ - self = [self init]; - if (self) { - if (hIconFamily) { - DisposeHandle( (Handle)hIconFamily ); - hIconFamily = NULL; - } - hIconFamily = hNewIconFamily; - } - return self; -} - -- initWithIconOfFile:(NSString*)path -{ - IconRef iconRef; - OSStatus result; - SInt16 label; - FSRef ref; - - self = [self init]; - if (self) - { - if (hIconFamily) - { - DisposeHandle( (Handle)hIconFamily ); - hIconFamily = NULL; - } - - if( ![path getFSRef:&ref createFileIfNecessary:NO] ) - { - [self autorelease]; - return nil; - } - - result = GetIconRefFromFileInfo( - &ref, - /*inFileNameLength*/ 0, - /*inFileName*/ NULL, - kFSCatInfoNone, - /*inCatalogInfo*/ NULL, - kIconServicesNormalUsageFlag, - &iconRef, - &label ); - - if (result != noErr) - { - [self autorelease]; - return nil; - } - - result = IconRefToIconFamily( - iconRef, - kSelectorAllAvailableData, - &hIconFamily ); - - ReleaseIconRef( iconRef ); - - if (result != noErr || !hIconFamily) - { - [self autorelease]; - return nil; - } - } - return self; -} - -- initWithSystemIcon:(int)fourByteCode -{ - IconRef iconRef; - OSErr result; - - self = [self init]; - if (self) - { - if (hIconFamily) - { - DisposeHandle( (Handle)hIconFamily ); - hIconFamily = NULL; - } - - result = GetIconRef(kOnSystemDisk, kSystemIconsCreator, fourByteCode, &iconRef); - - if (result != noErr) - { - [self autorelease]; - return nil; - } - - result = IconRefToIconFamily( - iconRef, - kSelectorAllAvailableData, - &hIconFamily ); - - if (result != noErr || !hIconFamily) - { - [self autorelease]; - return nil; - } - - ReleaseIconRef( iconRef ); - } - return self; -} - -- initWithThumbnailsOfImage:(NSImage*)image -{ - // The default is to use a high degree of antialiasing, producing a smooth image. - return [self initWithThumbnailsOfImage:image usingImageInterpolation:NSImageInterpolationHigh]; -} - -- initWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation -{ - NSImage* iconImage512x512; - NSImage* iconImage256x256; - NSImage* iconImage128x128; - NSImage* iconImage32x32; - NSImage* iconImage16x16; - NSImage* bitmappedIconImage512x512; - NSBitmapImageRep* iconBitmap512x512; - NSBitmapImageRep* iconBitmap256x256; - NSBitmapImageRep* iconBitmap128x128; - NSBitmapImageRep* iconBitmap32x32; - NSBitmapImageRep* iconBitmap16x16; - - // Start with a new, empty IconFamily. - self = [self init]; - if (self == nil) - return nil; - - // Resample the given image to create a 512x512 pixel, 32-bit RGBA - // version, and use that as our "thumbnail" (512x512) icon and mask. - // - // Our +resampleImage:toIconWidth:... method, in its present form, - // returns an NSImage that contains an NSCacheImageRep, rather than - // an NSBitmapImageRep. We convert to an NSBitmapImageRep, so that - // our methods can scan the image data, using initWithFocusedViewRect:. - iconImage512x512 = [IconFamily resampleImage:image toIconWidth:512 usingImageInterpolation:imageInterpolation]; - if (!iconImage512x512) { - [self autorelease]; - return nil; - } - - [iconImage512x512 lockFocus]; - iconBitmap512x512 = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, 512, 512)]; - [iconImage512x512 unlockFocus]; - if (!iconBitmap512x512) { - [self release]; - return nil; - } - // Create an NSImage with the iconBitmap512x512 NSBitmapImageRep, that we - // can resample to create the smaller icon family elements. (This is - // most likely more efficient than resampling from the original image again, - // particularly if it is large. It produces a slightly different result, but - // the difference is minor and should not be objectionable...) - - bitmappedIconImage512x512 = [[NSImage alloc] initWithSize:NSMakeSize(512, 512)]; - [bitmappedIconImage512x512 addRepresentation:iconBitmap512x512]; - - if (!bitmappedIconImage512x512) { - [self autorelease]; - return nil; - } - - [self setIconFamilyElement:kIconServices512PixelDataARGB fromBitmapImageRep:iconBitmap512x512]; - [iconBitmap512x512 release]; - - iconImage256x256 = [IconFamily resampleImage:bitmappedIconImage512x512 toIconWidth:256 usingImageInterpolation:imageInterpolation]; - if (iconImage256x256) { - [iconImage256x256 lockFocus]; - iconBitmap256x256 = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, 256, 256)]; - [iconImage256x256 unlockFocus]; - if (iconBitmap256x256) { - [self setIconFamilyElement:kIconServices256PixelDataARGB fromBitmapImageRep:iconBitmap256x256]; - [iconBitmap256x256 release]; - } - } - - iconImage128x128 = [IconFamily resampleImage:bitmappedIconImage512x512 toIconWidth:128 usingImageInterpolation:imageInterpolation]; - if (iconImage128x128) { - [iconImage128x128 lockFocus]; - iconBitmap128x128 = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, 128, 128)]; - [iconImage128x128 unlockFocus]; - - if (iconBitmap128x128) { - [self setIconFamilyElement:kThumbnail32BitData fromBitmapImageRep:iconBitmap128x128]; - [self setIconFamilyElement:kThumbnail8BitMask fromBitmapImageRep:iconBitmap128x128]; - [iconBitmap128x128 release]; - } - } - - // Resample the 512x512 image to create a 32x32 pixel, 32-bit RGBA version, - // and use that as our "large" (32x32) icon and 8-bit mask. - iconImage32x32 = [IconFamily resampleImage:bitmappedIconImage512x512 toIconWidth:32 usingImageInterpolation:imageInterpolation]; - if (iconImage32x32) { - [iconImage32x32 lockFocus]; - iconBitmap32x32 = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, 32, 32)]; - [iconImage32x32 unlockFocus]; - if (iconBitmap32x32) { - [self setIconFamilyElement:kLarge32BitData fromBitmapImageRep:iconBitmap32x32]; - [self setIconFamilyElement:kLarge8BitData fromBitmapImageRep:iconBitmap32x32]; - [self setIconFamilyElement:kLarge8BitMask fromBitmapImageRep:iconBitmap32x32]; - [self setIconFamilyElement:kLarge1BitMask fromBitmapImageRep:iconBitmap32x32]; - [iconBitmap32x32 release]; - } - } - - // Resample the 512x512 image to create a 16x16 pixel, 32-bit RGBA version, - // and use that as our "small" (16x16) icon and 8-bit mask. - iconImage16x16 = [IconFamily resampleImage:bitmappedIconImage512x512 toIconWidth:16 usingImageInterpolation:imageInterpolation]; - if (iconImage16x16) { - [iconImage16x16 lockFocus]; - iconBitmap16x16 = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, 16, 16)]; - [iconImage16x16 unlockFocus]; - if (iconBitmap16x16) { - [self setIconFamilyElement:kSmall32BitData fromBitmapImageRep:iconBitmap16x16]; - [self setIconFamilyElement:kSmall8BitData fromBitmapImageRep:iconBitmap16x16]; - [self setIconFamilyElement:kSmall8BitMask fromBitmapImageRep:iconBitmap16x16]; - [self setIconFamilyElement:kSmall1BitMask fromBitmapImageRep:iconBitmap16x16]; - [iconBitmap16x16 release]; - } - } - - // Release the icon. - [bitmappedIconImage512x512 release]; - - // Return the new icon family! - return self; -} - -- (void) dealloc -{ - DisposeHandle( (Handle)hIconFamily ); - [super dealloc]; -} - -- (NSBitmapImageRep*) bitmapImageRepWithAlphaForIconFamilyElement:(OSType)elementType; -{ - NSBitmapImageRep* bitmapImageRep; - int pixelsWide; - Handle hRawBitmapData; - Handle hRawMaskData; - OSType maskElementType; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - NSBitmapFormat bitmapFormat = NSAlphaFirstBitmapFormat; -#endif - OSErr result; - unsigned long* pRawBitmapData; - unsigned long* pRawBitmapDataEnd; - unsigned char* pRawMaskData; - unsigned char* pBitmapImageRepBitmapData; - - // Make sure elementType is a valid type that we know how to handle, and - // figure out the dimensions and bit depth of the bitmap for that type. - switch (elementType) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - // 'ic09' 512x512 32-bit RGB image - case kIconServices512PixelDataARGB: - maskElementType = 0; - pixelsWide = 512; - break; -#endif - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - // 'ic08' 256x256 32-bit ARGB image - case kIconServices256PixelDataARGB: - maskElementType = 0; - pixelsWide = 256; - break; -#endif - - // 'it32' 128x128 32-bit RGB image - case kThumbnail32BitData: - maskElementType = kThumbnail8BitMask; - pixelsWide = 128; - break; - - // 'ih32' 48x48 32-bit RGB image - case kHuge32BitData: - maskElementType = kHuge8BitMask; - pixelsWide = 48; - break; - - // 'il32' 32x32 32-bit RGB image - case kLarge32BitData: - maskElementType = kLarge8BitMask; - pixelsWide = 32; - break; - - // 'is32' 16x16 32-bit RGB image - case kSmall32BitData: - maskElementType = kSmall8BitMask; - pixelsWide = 16; - break; - - default: - return nil; - } - - // Get the raw, uncompressed bitmap data for the requested element. - hRawBitmapData = NewHandle( pixelsWide * pixelsWide * 4 ); - result = GetIconFamilyData( hIconFamily, elementType, hRawBitmapData ); - if (result != noErr) { - DisposeHandle( hRawBitmapData ); - return nil; - } - - if (maskElementType) { - // Get the corresponding raw, uncompressed 8-bit mask data. - hRawMaskData = NewHandle( pixelsWide * pixelsWide ); - result = GetIconFamilyData( hIconFamily, maskElementType, hRawMaskData ); - if (result != noErr) { - DisposeHandle( hRawMaskData ); - hRawMaskData = NULL; - } - } - - // The retrieved raw bitmap data is stored in memory as 32 bit per pixel, 8 bit per sample xRGB data. (The sample order provided by IconServices is the same, regardless of whether we're running on a big-endian (PPC) or little-endian (Intel) architecture.) -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - // With proper attention to byte order, we can fold the mask data into the color data in-place, producing ARGB data suitable for handing off to NSBitmapImageRep. -#else - // With proper attention to byte order, we can fold the mask data into the color data in-place, producing RGBA data suitable for handing off to NSBitmapImageRep. -#endif -// HLock( hRawBitmapData ); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - pRawBitmapData = (unsigned long*) *hRawBitmapData; - pRawBitmapDataEnd = pRawBitmapData + pixelsWide * pixelsWide; - if (hRawMaskData) { -// HLock( hRawMaskData ); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - pRawMaskData = (unsigned char*) *hRawMaskData; - while (pRawBitmapData < pRawBitmapDataEnd) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - // Convert the xRGB pixel data to ARGB. - // PowerPC Intel - // ------- ----- - // Bytes in memory are x R G B x R G B - // *pRawBitmapData loads as 32-bit word into register xRGB BGRx - // NSSwapHostLongToBig() swaps this to xRGB xRGB - // Loading *pRawMaskData and shifting left 24 bits yields A000 A000 - // Bitwise ORing these two words together yields ARGB ARGB - // NSSwapBigLongToHost() swaps this to ARGB BGRA - // Bytes in memory after they're stored as a 32-bit word A R G B A R G B - *pRawBitmapData = NSSwapBigLongToHost((*pRawMaskData++ << 24) | NSSwapHostLongToBig(*pRawBitmapData)); -#else - // Convert the xRGB pixel data to RGBA. - // PowerPC Intel - // ------- ----- - // Bytes in memory are x R G B x R G B - // *pRawBitmapData loads as 32-bit word into register xRGB BGRx - // NSSwapHostLongToBig() swaps this to xRGB xRGB - // Shifting left 8 bits yields ('0' denotes all zero bits) RGB0 RGB0 - // Bitwise ORing with *pRawMaskData byte yields RGBA RGBA - // NSSwapBigLongToHost() swaps this to RGBA ABGR - // Bytes in memory after they're stored as a 32-bit word R G B A R G B A - *pRawBitmapData = NSSwapBigLongToHost((NSSwapHostLongToBig(*pRawBitmapData) << 8) | *pRawMaskData++); -#endif - ++pRawBitmapData; - } -// HUnlock( hRawMaskData ); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - } else { - if(maskElementType) { - // We SHOULD have a mask, but apparently not. Fake it with alpha=1. - while (pRawBitmapData < pRawBitmapDataEnd) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - // Set alpha byte to 0xff. - // PowerPC Intel - // ------- ----- - // Bytes in memory are x R G B x R G B - // Writing a single 0xff byte ('1') at pRawBitmapData yields 1 R G B 1 R G B - *(unsigned char *)pRawBitmapData = 0xff; -#else - // Set alpha byte to 0xff. - // PowerPC Intel - // ------- ----- - // Bytes in memory are R G B x R G B x - // Writing a single 0xff byte, 3 bytes past pRawBitmapData yields R G B 1 R G B 1 - *((unsigned char *)pRawBitmapData + 3) = 0xff; -#endif - ++pRawBitmapData; - } - } - } - - // Create a new NSBitmapImageRep with the given bitmap data. Note that - // when creating the NSBitmapImageRep we pass in NULL for the "planes" - // parameter. This causes the new NSBitmapImageRep to allocate its own - // buffer for the bitmap data (which it will own and release when the - // NSBitmapImageRep is released), rather than referencing the bitmap - // data we pass in (which will soon disappear when we call - // DisposeHandle() below!). (See the NSBitmapImageRep documentation for - // the -initWithBitmapDataPlanes:... method, where this is explained.) - // - // Once we have the new NSBitmapImageRep, we get a pointer to its - // bitmapData and copy our bitmap data in. - bitmapImageRep = [[[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:NULL - pixelsWide:pixelsWide - pixelsHigh:pixelsWide - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace // NOTE: is this right? -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - bitmapFormat:bitmapFormat -#endif - bytesPerRow:0 - bitsPerPixel:0] autorelease]; - pBitmapImageRepBitmapData = [bitmapImageRep bitmapData]; - if (pBitmapImageRepBitmapData) { - memcpy( pBitmapImageRepBitmapData, *hRawBitmapData, - pixelsWide * pixelsWide * 4 ); - } -// HUnlock( hRawBitmapData ); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - - // Free the retrieved raw data. - DisposeHandle( hRawBitmapData ); - if (hRawMaskData) - DisposeHandle( hRawMaskData ); - - // Return nil if the NSBitmapImageRep didn't give us a buffer to copy into. - if (pBitmapImageRepBitmapData == NULL) - return nil; - - // Return the new NSBitmapImageRep. - return bitmapImageRep; -} - -- (NSImage*) imageWithAllReps -{ - NSImage* image = NULL; - image = [[[NSImage alloc] initWithData:[NSData dataWithBytes:*hIconFamily length:GetHandleSize((Handle)hIconFamily)]] autorelease]; - return image; -} - -- (BOOL) setIconFamilyElement:(OSType)elementType fromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep -{ - Handle hRawData = NULL; - OSErr result; - - switch (elementType) { - // 'ic08' 512x512 32-bit ARGB image - case kIconServices512PixelDataARGB: - hRawData = [IconFamily get32BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:512]; - break; - - // 'ic08' 256x256 32-bit ARGB image - case kIconServices256PixelDataARGB: - hRawData = [IconFamily get32BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:256]; - break; - - // 'it32' 128x128 32-bit RGB image - case kThumbnail32BitData: - hRawData = [IconFamily get32BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:128]; - break; - - // 't8mk' 128x128 8-bit alpha mask - case kThumbnail8BitMask: - hRawData = [IconFamily get8BitMaskFromBitmapImageRep:bitmapImageRep requiredPixelSize:128]; - break; - - // 'il32' 32x32 32-bit RGB image - case kLarge32BitData: - hRawData = [IconFamily get32BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:32]; - break; - - // 'l8mk' 32x32 8-bit alpha mask - case kLarge8BitMask: - hRawData = [IconFamily get8BitMaskFromBitmapImageRep:bitmapImageRep requiredPixelSize:32]; - break; - - // 'ICN#' 32x32 1-bit alpha mask - case kLarge1BitMask: - hRawData = [IconFamily get1BitMaskFromBitmapImageRep:bitmapImageRep requiredPixelSize:32]; - break; - - // 'icl8' 32x32 8-bit indexed image data - case kLarge8BitData: - hRawData = [IconFamily get8BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:32]; - break; - - // 'is32' 16x16 32-bit RGB image - case kSmall32BitData: - hRawData = [IconFamily get32BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:16]; - break; - - // 's8mk' 16x16 8-bit alpha mask - case kSmall8BitMask: - hRawData = [IconFamily get8BitMaskFromBitmapImageRep:bitmapImageRep requiredPixelSize:16]; - break; - - // 'ics#' 16x16 1-bit alpha mask - case kSmall1BitMask: - hRawData = [IconFamily get1BitMaskFromBitmapImageRep:bitmapImageRep requiredPixelSize:16]; - break; - - // 'ics8' 16x16 8-bit indexed image data - case kSmall8BitData: - hRawData = [IconFamily get8BitDataFromBitmapImageRep:bitmapImageRep requiredPixelSize:16]; - break; - - default: - return NO; - } - - // NSLog(@"setIconFamilyElement:%@ fromBitmapImageRep:%@ generated handle %p of size %d", NSFileTypeForHFSTypeCode(elementType), bitmapImageRep, hRawData, GetHandleSize(hRawData)); - - if (hRawData == NULL) - { - NSLog(@"Null data returned to setIconFamilyElement:fromBitmapImageRep:"); - return NO; - } - - result = SetIconFamilyData( hIconFamily, elementType, hRawData ); - DisposeHandle( hRawData ); - - if (result != noErr) - { - NSLog(@"SetIconFamilyData() returned error %d", result); - return NO; - } - - return YES; -} - -- (BOOL) setAsCustomIconForFile:(NSString*)path -{ - return( [self setAsCustomIconForFile:path withCompatibility:NO] ); -} - -- (BOOL) setAsCustomIconForFile:(NSString*)path withCompatibility:(BOOL)compat -{ - FSRef targetFileFSRef; - FSRef parentDirectoryFSRef; - SInt16 file; - OSStatus result; - struct FSCatalogInfo catInfo; - struct FileInfo *finderInfo = (struct FileInfo *)&catInfo.finderInfo; - Handle hExistingCustomIcon; - Handle hIconFamilyCopy; - NSString *parentDirectory; - - // Before we do anything, get the original modification time for the target file. - NSDate* modificationDate = [[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:NO] objectForKey:NSFileModificationDate]; - - if ([path isAbsolutePath]) - parentDirectory = [path stringByDeletingLastPathComponent]; - else - parentDirectory = [[[NSFileManager defaultManager] currentDirectoryPath] stringByAppendingPathComponent:[path stringByDeletingLastPathComponent]]; - - // Get an FSRef for the target file's parent directory that we can use in - // the FSCreateResFile() and FNNotify() calls below. - if (![parentDirectory getFSRef:&parentDirectoryFSRef createFileIfNecessary:NO]) - return NO; - - // Get the name of the file, for FSCreateResFile. - struct HFSUniStr255 filename; - NSString *filenameString = [path lastPathComponent]; - filename.length = [filenameString length]; - [filenameString getCharacters:filename.unicode]; - - // Make sure the file has a resource fork that we can open. (Although - // this sounds like it would clobber an existing resource fork, the Carbon - // Resource Manager docs for this function say that's not the case. If - // the file already has a resource fork, we receive a result code of - // dupFNErr, which is not really an error per se, but just a notification - // to us that creating a new resource fork for the file was not necessary.) - FSCreateResFile( - &parentDirectoryFSRef, - filename.length, - filename.unicode, - kFSCatInfoNone, - /*catalogInfo/*/ NULL, - &targetFileFSRef, - /*newSpec*/ NULL); - result = ResError(); - if (result == dupFNErr) { - // If the call to FSCreateResFile() returned dupFNErr, targetFileFSRef will not have been set, so create it from the path. - if (![path getFSRef:&targetFileFSRef createFileIfNecessary:NO]) - return NO; - } else if (result != noErr) { - return NO; - } - - // Open the file's resource fork. - file = FSOpenResFile( &targetFileFSRef, fsRdWrPerm ); - if (file == -1) - return NO; - - // Make a copy of the icon family data to pass to AddResource(). - // (AddResource() takes ownership of the handle we pass in; after the - // CloseResFile() call its master pointer will be set to 0xffffffff. - // We want to keep the icon family data, so we make a copy.) - // HandToHand() returns the handle of the copy in hIconFamily. - hIconFamilyCopy = (Handle) hIconFamily; - result = HandToHand( &hIconFamilyCopy ); - if (result != noErr) { - CloseResFile( file ); - return NO; - } - - // Remove the file's existing kCustomIconResource of type kIconFamilyType - // (if any). - hExistingCustomIcon = GetResource( kIconFamilyType, kCustomIconResource ); - if( hExistingCustomIcon ) - RemoveResource( hExistingCustomIcon ); - - // Now add our icon family as the file's new custom icon. - AddResource( (Handle)hIconFamilyCopy, kIconFamilyType, - kCustomIconResource, "\p"); - if (ResError() != noErr) { - CloseResFile( file ); - return NO; - } - - if( compat ) - { - [self addResourceType:kLarge8BitData asResID:kCustomIconResource]; - [self addResourceType:kLarge1BitMask asResID:kCustomIconResource]; - [self addResourceType:kSmall8BitData asResID:kCustomIconResource]; - [self addResourceType:kSmall1BitMask asResID:kCustomIconResource]; - } - - // Close the file's resource fork, flushing the resource map and new icon - // data out to disk. - CloseResFile( file ); - if (ResError() != noErr) - return NO; - - // Prepare to get the Finder info. - - // Now we need to set the file's Finder info so the Finder will know that - // it has a custom icon. Start by getting the file's current finder info: - result = FSGetCatalogInfo( - &targetFileFSRef, - kFSCatInfoFinderInfo, - &catInfo, - /*outName*/ NULL, - /*fsSpec*/ NULL, - /*parentRef*/ NULL); - if (result != noErr) - return NO; - - // Set the kHasCustomIcon flag, and clear the kHasBeenInited flag. - // - // From Apple's "CustomIcon" code sample: - // "set bit 10 (has custom icon) and unset the inited flag - // kHasBeenInited is 0x0100 so the mask will be 0xFEFF:" - // finderInfo.fdFlags = 0xFEFF & (finderInfo.fdFlags | kHasCustomIcon ) ; - finderInfo->finderFlags = (finderInfo->finderFlags | kHasCustomIcon ) & ~kHasBeenInited; - - // Now write the Finder info back. - result = FSSetCatalogInfo( &targetFileFSRef, kFSCatInfoFinderInfo, &catInfo ); - if (result != noErr) - return NO; - - // Now set the modification time back to when the file was actually last modified. - NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:modificationDate, NSFileModificationDate, nil]; - [[NSFileManager defaultManager] changeFileAttributes:attributes atPath:path]; - - // Notify the system that the directory containing the file has changed, to - // give Finder the chance to find out about the file's new custom icon. - result = FNNotify( &parentDirectoryFSRef, kFNDirectoryModifiedMessage, kNilOptions ); - if (result != noErr) - return NO; - - return YES; -} - -+ (BOOL) removeCustomIconFromFile:(NSString*)path -{ - FSRef targetFileFSRef; - FSRef parentDirectoryFSRef; - SInt16 file; - OSStatus result; - struct FSCatalogInfo catInfo; - struct FileInfo *finderInfo = (struct FileInfo *)&catInfo.finderInfo; - Handle hExistingCustomIcon; - - // Get an FSRef for the target file. - if (![path getFSRef:&targetFileFSRef createFileIfNecessary:NO]) - return NO; - - // Open the file's resource fork, if it has one. - file = FSOpenResFile( &targetFileFSRef, fsRdWrPerm ); - if (file == -1) - return NO; - - // Remove the file's existing kCustomIconResource of type kIconFamilyType - // (if any). - hExistingCustomIcon = GetResource( kIconFamilyType, kCustomIconResource ); - if( hExistingCustomIcon ) - RemoveResource( hExistingCustomIcon ); - - // Close the file's resource fork, flushing the resource map out to disk. - CloseResFile( file ); - if (ResError() != noErr) - return NO; - - // Now we need to set the file's Finder info so the Finder will know that - // it has no custom icon. Start by getting the file's current Finder info. - // Also get an FSRef for its parent directory, that we can use in the - // FNNotify() call below. - result = FSGetCatalogInfo( - &targetFileFSRef, - kFSCatInfoFinderInfo, - &catInfo, - /*outName*/ NULL, - /*fsSpec*/ NULL, - &parentDirectoryFSRef ); - if (result != noErr) - return NO; - - // Clear the kHasCustomIcon flag and the kHasBeenInited flag. - finderInfo->finderFlags = finderInfo->finderFlags & ~(kHasCustomIcon | kHasBeenInited); - - // Now write the Finder info back. - result = FSSetCatalogInfo( &targetFileFSRef, kFSCatInfoFinderInfo, &catInfo ); - if (result != noErr) - return NO; - - // Notify the system that the directory containing the file has changed, to give Finder the chance to find out about the file's new custom icon. - result = FNNotify( &parentDirectoryFSRef, kFNDirectoryModifiedMessage, kNilOptions ); - if (result != noErr) - return NO; - - return YES; -} - -- (BOOL) setAsCustomIconForDirectory:(NSString*)path -{ - return [self setAsCustomIconForDirectory:path withCompatibility:NO]; -} - -- (BOOL) setAsCustomIconForDirectory:(NSString*)path withCompatibility:(BOOL)compat -{ - NSFileManager *fm = [NSFileManager defaultManager]; - BOOL isDir; - BOOL exists; - NSString *iconrPath; - FSRef targetFolderFSRef, iconrFSRef; - SInt16 file; - OSErr result; - struct HFSUniStr255 filename; - struct FSCatalogInfo catInfo; - Handle hExistingCustomIcon; - Handle hIconFamilyCopy; - - // Confirm that "path" exists and specifies a directory. - exists = [fm fileExistsAtPath:path isDirectory:&isDir]; - if( !isDir || !exists ) - return NO; - - // Get an FSRef for the folder. - if( ![path getFSRef:&targetFolderFSRef createFileIfNecessary:NO] ) - return NO; - - // Remove and re-create any existing "Icon\r" file in the directory, and get an FSRef for it. - iconrPath = [path stringByAppendingPathComponent:@"Icon\r"]; - if( [fm fileExistsAtPath:iconrPath] ) - { - if( ![fm removeFileAtPath:iconrPath handler:nil] ) - return NO; - } - if( ![iconrPath getFSRef:&iconrFSRef createFileIfNecessary:YES] ) - return NO; - - // Get type and creator information for the Icon file. - result = FSGetCatalogInfo( - &iconrFSRef, - kFSCatInfoFinderInfo, - &catInfo, - /*outName*/ NULL, - /*fsSpec*/ NULL, - /*parentRef*/ NULL ); - if( result == fnfErr ) { - // The file doesn't exist. Prepare to create it. - - struct FileInfo *finderInfo = (struct FileInfo *)catInfo.finderInfo; - - // These are the file type and creator given to Icon files created by - // the Finder. - finderInfo->fileType = 'icon'; - finderInfo->fileCreator = 'MACS'; - - // Icon files should be invisible. - finderInfo->finderFlags = kIsInvisible; - - // Because the inited flag is not set in finderFlags above, the Finder - // will ignore the location, unless it's in the 'magic rectangle' of - // { -24,000, -24,000, -16,000, -16,000 } (technote TB42). - // So we need to make sure to set this to zero anyway, so that the - // Finder will position it automatically. If the user makes the Icon - // file visible for any reason, we don't want it to be positioned in an - // exotic corner of the window. - finderInfo->location.h = finderInfo->location.v = 0; - - // Standard reserved-field practice. - finderInfo->reservedField = 0; - } else if( result != noErr ) - return NO; - - // Get the filename, to be applied to the Icon file. - filename.length = [@"Icon\r" length]; - [@"Icon\r" getCharacters:filename.unicode]; - - // Make sure the file has a resource fork that we can open. (Although - // this sounds like it would clobber an existing resource fork, the Carbon - // Resource Manager docs for this function say that's not the case.) - FSCreateResFile( - &targetFolderFSRef, - filename.length, - filename.unicode, - kFSCatInfoFinderInfo, - &catInfo, - &iconrFSRef, - /*newSpec*/ NULL); - result = ResError(); - if (!(result == noErr || result == dupFNErr)) - return NO; - - // Open the file's resource fork. - file = FSOpenResFile( &iconrFSRef, fsRdWrPerm ); - if (file == -1) - return NO; - - // Make a copy of the icon family data to pass to AddResource(). - // (AddResource() takes ownership of the handle we pass in; after the - // CloseResFile() call its master pointer will be set to 0xffffffff. - // We want to keep the icon family data, so we make a copy.) - // HandToHand() returns the handle of the copy in hIconFamily. - hIconFamilyCopy = (Handle) hIconFamily; - result = HandToHand( &hIconFamilyCopy ); - if (result != noErr) { - CloseResFile( file ); - return NO; - } - - // Remove the file's existing kCustomIconResource of type kIconFamilyType - // (if any). - hExistingCustomIcon = GetResource( kIconFamilyType, kCustomIconResource ); - if( hExistingCustomIcon ) - RemoveResource( hExistingCustomIcon ); - - // Now add our icon family as the file's new custom icon. - AddResource( (Handle)hIconFamilyCopy, kIconFamilyType, - kCustomIconResource, "\p"); - - if (ResError() != noErr) { - CloseResFile( file ); - return NO; - } - - if( compat ) - { - [self addResourceType:kLarge8BitData asResID:kCustomIconResource]; - [self addResourceType:kLarge1BitMask asResID:kCustomIconResource]; - [self addResourceType:kSmall8BitData asResID:kCustomIconResource]; - [self addResourceType:kSmall1BitMask asResID:kCustomIconResource]; - } - - // Close the file's resource fork, flushing the resource map and new icon - // data out to disk. - CloseResFile( file ); - if (ResError() != noErr) - return NO; - - result = FSGetCatalogInfo( &targetFolderFSRef, - kFSCatInfoFinderInfo, - &catInfo, - /*outName*/ NULL, - /*fsSpec*/ NULL, - /*parentRef*/ NULL); - if( result != noErr ) - return NO; - - // Tell the Finder that the folder now has a custom icon. - ((struct FolderInfo *)catInfo.finderInfo)->finderFlags = ( ((struct FolderInfo *)catInfo.finderInfo)->finderFlags | kHasCustomIcon ) & ~kHasBeenInited; - - result = FSSetCatalogInfo( &targetFolderFSRef, - kFSCatInfoFinderInfo, - &catInfo); - if( result != noErr ) - return NO; - - // Notify the system that the target directory has changed, to give Finder - // the chance to find out about its new custom icon. - result = FNNotify( &targetFolderFSRef, kFNDirectoryModifiedMessage, kNilOptions ); - if (result != noErr) - return NO; - - return YES; -} - -- (BOOL) writeToFile:(NSString*)path -{ - NSData* iconData = nil; - -// HLock((Handle)hIconFamily); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - - iconData = [NSData dataWithBytes:*hIconFamily length:GetHandleSize((Handle)hIconFamily)]; - BOOL success = [iconData writeToFile:path atomically:NO]; - -// HUnlock((Handle)hIconFamily); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - - return success; -} - -@end - -@implementation IconFamily (Internals) - -+ (NSImage*) resampleImage:(NSImage*)image toIconWidth:(int)iconWidth usingImageInterpolation:(NSImageInterpolation)imageInterpolation -{ - NSGraphicsContext* graphicsContext; - BOOL wasAntialiasing; - NSImageInterpolation previousImageInterpolation; - NSImage* newImage; - NSImage* workingImage; - NSImageRep* workingImageRep; - NSSize size, pixelSize, newSize; - NSRect iconRect; - NSRect targetRect; - - // Create a working copy of the image and scale its size down to fit in - // the square area of the icon. - // - // It seems like there should be a more memory-efficient alternative to - // first duplicating the entire original image, but I don't know what it - // is. We need to change some properties ("size" and "scalesWhenResized") - // of the original image, but we shouldn't change the original, so a copy - // is necessary. - workingImage = [image copyWithZone:[image zone]]; - [workingImage setScalesWhenResized:YES]; - size = [workingImage size]; - workingImageRep = [workingImage bestRepresentationForDevice:nil]; - if ([workingImageRep isKindOfClass:[NSBitmapImageRep class]]) { - pixelSize.width = [workingImageRep pixelsWide]; - pixelSize.height = [workingImageRep pixelsHigh]; - if (!NSEqualSizes( size, pixelSize )) { - [workingImage setSize:pixelSize]; - [workingImageRep setSize:pixelSize]; - size = pixelSize; - } - } - if (size.width >= size.height) { - newSize.width = iconWidth; - newSize.height = floor( (float) iconWidth * size.height / size.width + 0.5 ); - } else { - newSize.height = iconWidth; - newSize.width = floor( (float) iconWidth * size.width / size.height + 0.5 ); - } - [workingImage setSize:newSize]; - - // Create a new image the size of the icon, and clear it to transparent. - newImage = [[NSImage alloc] initWithSize:NSMakeSize(iconWidth,iconWidth)]; - [newImage lockFocus]; - iconRect.origin.x = iconRect.origin.y = 0; - iconRect.size.width = iconRect.size.height = iconWidth; - [[NSColor clearColor] set]; - NSRectFill( iconRect ); - - // Set current graphics context to use antialiasing and high-quality - // image scaling. - graphicsContext = [NSGraphicsContext currentContext]; - wasAntialiasing = [graphicsContext shouldAntialias]; - previousImageInterpolation = [graphicsContext imageInterpolation]; - [graphicsContext setShouldAntialias:YES]; - [graphicsContext setImageInterpolation:imageInterpolation]; - - // Composite the working image into the icon bitmap, centered. - targetRect.origin.x = ((float)iconWidth - newSize.width ) / 2.0; - targetRect.origin.y = ((float)iconWidth - newSize.height) / 2.0; - targetRect.size.width = newSize.width; - targetRect.size.height = newSize.height; - [workingImageRep drawInRect:targetRect]; - - // Restore previous graphics context settings. - [graphicsContext setShouldAntialias:wasAntialiasing]; - [graphicsContext setImageInterpolation:previousImageInterpolation]; - - [newImage unlockFocus]; - - [workingImage release]; - - // Return the new image! - return [newImage autorelease]; -} - -+ (Handle) get32BitDataFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize -{ - Handle hRawData; - unsigned char* pRawData; - Size rawDataSize; - unsigned char* pSrc; - unsigned char* pDest; - int x, y; - unsigned char alphaByte; - float oneOverAlpha; - - // Get information about the bitmapImageRep. - int pixelsWide = [bitmapImageRep pixelsWide]; - int pixelsHigh = [bitmapImageRep pixelsHigh]; - int bitsPerSample = [bitmapImageRep bitsPerSample]; - int samplesPerPixel = [bitmapImageRep samplesPerPixel]; - int bitsPerPixel = [bitmapImageRep bitsPerPixel]; - BOOL isPlanar = [bitmapImageRep isPlanar]; - int bytesPerRow = [bitmapImageRep bytesPerRow]; - unsigned char* bitmapData = [bitmapImageRep bitmapData]; - - // Make sure bitmap has the required dimensions. - if (pixelsWide != requiredPixelSize || pixelsHigh != requiredPixelSize) - return NULL; - - // So far, this code only handles non-planar 32-bit RGBA and 24-bit RGB source bitmaps. - // This could be made more flexible with some additional programming to accommodate other possible - // formats... - if (isPlanar) - { - NSLog(@"get32BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to isPlanar == YES"); - return NULL; - } - if (bitsPerSample != 8) - { - NSLog(@"get32BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to bitsPerSample == %d", bitsPerSample); - return NULL; - } - - if (((samplesPerPixel == 3) && (bitsPerPixel == 24)) || ((samplesPerPixel == 4) && (bitsPerPixel == 32))) - { - rawDataSize = pixelsWide * pixelsHigh * 4; - hRawData = NewHandle( rawDataSize ); - if (hRawData == NULL) - return NULL; - pRawData = (unsigned char*) *hRawData; - - pSrc = bitmapData; - pDest = pRawData; - - if (bitsPerPixel == 32) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x++) { - // Each pixel is 3 bytes of RGB data, followed by 1 byte of - // alpha. The RGB values are premultiplied by the alpha (so - // that Quartz can save time when compositing the bitmap to a - // destination), and we undo this premultiplication (with some - // lossiness unfortunately) when retrieving the bitmap data. - *pDest++ = alphaByte = *(pSrc+3); - if (alphaByte) { - oneOverAlpha = 255.0f / (float)alphaByte; - *pDest++ = *(pSrc+0) * oneOverAlpha; - *pDest++ = *(pSrc+1) * oneOverAlpha; - *pDest++ = *(pSrc+2) * oneOverAlpha; - } else { - *pDest++ = 0; - *pDest++ = 0; - *pDest++ = 0; - } - pSrc+=4; - } - } - } else if (bitsPerPixel == 24) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x++) { - *pDest++ = 0xFF; - *pDest++ = *pSrc++; - *pDest++ = *pSrc++; - *pDest++ = *pSrc++; - } - } - } - } - else - { - NSLog(@"get32BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to samplesPerPixel == %d, bitsPerPixel == %", samplesPerPixel, bitsPerPixel); - return NULL; - } - - return hRawData; -} - -+ (Handle) get8BitDataFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize -{ - Handle hRawData; - unsigned char* pRawData; - Size rawDataSize; - unsigned char* pSrc; - unsigned char* pDest; - int x, y; - - // Get information about the bitmapImageRep. - int pixelsWide = [bitmapImageRep pixelsWide]; - int pixelsHigh = [bitmapImageRep pixelsHigh]; - int bitsPerSample = [bitmapImageRep bitsPerSample]; - int samplesPerPixel = [bitmapImageRep samplesPerPixel]; - int bitsPerPixel = [bitmapImageRep bitsPerPixel]; - BOOL isPlanar = [bitmapImageRep isPlanar]; - int bytesPerRow = [bitmapImageRep bytesPerRow]; - unsigned char* bitmapData = [bitmapImageRep bitmapData]; - - // Make sure bitmap has the required dimensions. - if (pixelsWide != requiredPixelSize || pixelsHigh != requiredPixelSize) - return NULL; - - // So far, this code only handles non-planar 32-bit RGBA and 24-bit RGB source bitmaps. - // This could be made more flexible with some additional programming... - if (isPlanar) - { - NSLog(@"get8BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to isPlanar == YES"); - return NULL; - } - if (bitsPerSample != 8) - { - NSLog(@"get8BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to bitsPerSample == %d", bitsPerSample); - return NULL; - } - - if (((samplesPerPixel == 3) && (bitsPerPixel == 24)) || ((samplesPerPixel == 4) && (bitsPerPixel == 32))) - { - CGDirectPaletteRef cgPal; - CGDeviceColor cgCol; - - rawDataSize = pixelsWide * pixelsHigh; - hRawData = NewHandle( rawDataSize ); - if (hRawData == NULL) - return NULL; - pRawData = (unsigned char*) *hRawData; - - cgPal = CGPaletteCreateDefaultColorPalette(); - - pSrc = bitmapData; - pDest = pRawData; - if (bitsPerPixel == 32) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x++) { - cgCol.red = ((float)*(pSrc)) / 255; - cgCol.green = ((float)*(pSrc+1)) / 255; - cgCol.blue = ((float)*(pSrc+2)) / 255; - - *pDest++ = CGPaletteGetIndexForColor(cgPal, cgCol); - - pSrc+=4; - } - } - } else if (bitsPerPixel == 24) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x++) { - cgCol.red = ((float)*(pSrc)) / 255; - cgCol.green = ((float)*(pSrc+1)) / 255; - cgCol.blue = ((float)*(pSrc+2)) / 255; - - *pDest++ = CGPaletteGetIndexForColor(cgPal, cgCol); - - pSrc+=3; - } - } - } - - CGPaletteRelease(cgPal); - } - else - { - NSLog(@"get8BitDataFromBitmapImageRep:requiredPixelSize: returning NULL due to samplesPerPixel == %d, bitsPerPixel == %", samplesPerPixel, bitsPerPixel); - return NULL; - } - - return hRawData; -} - -+ (Handle) get8BitMaskFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize -{ - Handle hRawData; - unsigned char* pRawData; - Size rawDataSize; - unsigned char* pSrc; - unsigned char* pDest; - int x, y; - - // Get information about the bitmapImageRep. - int pixelsWide = [bitmapImageRep pixelsWide]; - int pixelsHigh = [bitmapImageRep pixelsHigh]; - int bitsPerSample = [bitmapImageRep bitsPerSample]; - int samplesPerPixel = [bitmapImageRep samplesPerPixel]; - int bitsPerPixel = [bitmapImageRep bitsPerPixel]; - BOOL isPlanar = [bitmapImageRep isPlanar]; - int bytesPerRow = [bitmapImageRep bytesPerRow]; - unsigned char* bitmapData = [bitmapImageRep bitmapData]; - - // Make sure bitmap has the required dimensions. - if (pixelsWide != requiredPixelSize || pixelsHigh != requiredPixelSize) - return NULL; - - // So far, this code only handles non-planar 32-bit RGBA, 24-bit RGB and 8-bit grayscale source bitmaps. - // This could be made more flexible with some additional programming... - if (isPlanar) - { - NSLog(@"get8BitMaskFromBitmapImageRep:requiredPixelSize: returning NULL due to isPlanar == YES"); - return NULL; - } - if (bitsPerSample != 8) - { - NSLog(@"get8BitMaskFromBitmapImageRep:requiredPixelSize: returning NULL due to bitsPerSample == %d", bitsPerSample); - return NULL; - } - - if (((samplesPerPixel == 1) && (bitsPerPixel == 8)) || ((samplesPerPixel == 3) && (bitsPerPixel == 24)) || ((samplesPerPixel == 4) && (bitsPerPixel == 32))) - { - rawDataSize = pixelsWide * pixelsHigh; - hRawData = NewHandle( rawDataSize ); - if (hRawData == NULL) - return NULL; - pRawData = (unsigned char*) *hRawData; - - pSrc = bitmapData; - pDest = pRawData; - - if (bitsPerPixel == 32) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x++) { - pSrc += 3; - *pDest++ = *pSrc++; - } - } - } - else if (bitsPerPixel == 24) { - memset( pDest, 255, rawDataSize ); - } - else if (bitsPerPixel == 8) { - for (y = 0; y < pixelsHigh; y++) { - memcpy( pDest, pSrc, pixelsWide ); - pSrc += bytesPerRow; - pDest += pixelsWide; - } - } - } - else - { - NSLog(@"get8BitMaskFromBitmapImageRep:requiredPixelSize: returning NULL due to samplesPerPixel == %d, bitsPerPixel == %", samplesPerPixel, bitsPerPixel); - return NULL; - } - - return hRawData; -} - -// NOTE: This method hasn't been fully tested yet. -+ (Handle) get1BitMaskFromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep requiredPixelSize:(int)requiredPixelSize -{ - Handle hRawData; - unsigned char* pRawData; - Size rawDataSize; - unsigned char* pSrc; - unsigned char* pDest; - int x, y; - unsigned char maskByte; - - // Get information about the bitmapImageRep. - int pixelsWide = [bitmapImageRep pixelsWide]; - int pixelsHigh = [bitmapImageRep pixelsHigh]; - int bitsPerSample = [bitmapImageRep bitsPerSample]; - int samplesPerPixel = [bitmapImageRep samplesPerPixel]; - int bitsPerPixel = [bitmapImageRep bitsPerPixel]; - BOOL isPlanar = [bitmapImageRep isPlanar]; - int bytesPerRow = [bitmapImageRep bytesPerRow]; - unsigned char* bitmapData = [bitmapImageRep bitmapData]; - - // Make sure bitmap has the required dimensions. - if (pixelsWide != requiredPixelSize || pixelsHigh != requiredPixelSize) - return NULL; - - // So far, this code only handles non-planar 32-bit RGBA, 24-bit RGB, 8-bit grayscale, and 1-bit source bitmaps. - // This could be made more flexible with some additional programming... - if (isPlanar) - { - NSLog(@"get1BitMaskFromBitmapImageRep:requiredPixelSize: returning NULL due to isPlanar == YES"); - return NULL; - } - - if (((bitsPerPixel == 1) && (samplesPerPixel == 1) && (bitsPerSample == 1)) || ((bitsPerPixel == 8) && (samplesPerPixel == 1) && (bitsPerSample == 8)) || - ((bitsPerPixel == 24) && (samplesPerPixel == 3) && (bitsPerSample == 8)) || ((bitsPerPixel == 32) && (samplesPerPixel == 4) && (bitsPerSample == 8))) - { - rawDataSize = (pixelsWide * pixelsHigh)/4; - hRawData = NewHandle( rawDataSize ); - if (hRawData == NULL) - return NULL; - pRawData = (unsigned char*) *hRawData; - - pSrc = bitmapData; - pDest = pRawData; - - if (bitsPerPixel == 32) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x += 8) { - maskByte = 0; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x80 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x40 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x20 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x10 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x08 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x04 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x02 : 0; pSrc += 4; - maskByte |= (*(unsigned*)pSrc & 0xff) ? 0x01 : 0; pSrc += 4; - *pDest++ = maskByte; - } - } - } - else if (bitsPerPixel == 24) { - memset( pDest, 255, rawDataSize ); - } - else if (bitsPerPixel == 8) { - for (y = 0; y < pixelsHigh; y++) { - pSrc = bitmapData + y * bytesPerRow; - for (x = 0; x < pixelsWide; x += 8) { - maskByte = 0; - maskByte |= *pSrc++ ? 0x80 : 0; - maskByte |= *pSrc++ ? 0x40 : 0; - maskByte |= *pSrc++ ? 0x20 : 0; - maskByte |= *pSrc++ ? 0x10 : 0; - maskByte |= *pSrc++ ? 0x08 : 0; - maskByte |= *pSrc++ ? 0x04 : 0; - maskByte |= *pSrc++ ? 0x02 : 0; - maskByte |= *pSrc++ ? 0x01 : 0; - *pDest++ = maskByte; - } - } - } - else if (bitsPerPixel == 1) { - for (y = 0; y < pixelsHigh; y++) { - memcpy( pDest, pSrc, pixelsWide / 8 ); - pDest += pixelsWide / 8; - pSrc += bytesPerRow; - } - } - - memcpy( pRawData+(pixelsWide*pixelsHigh)/8, pRawData, (pixelsWide*pixelsHigh)/8 ); - } - else - { - NSLog(@"get1BitMaskFromBitmapImageRep:requiredPixelSize: returning NULL due to bitsPerPixel == %d, samplesPerPixel== %d, bitsPerSample == %d", bitsPerPixel, samplesPerPixel, bitsPerSample); - return NULL; - } - - return hRawData; -} - -- (BOOL) addResourceType:(OSType)type asResID:(int)resID -{ - Handle hIconRes = NewHandle(0); - OSErr err; - - err = GetIconFamilyData( hIconFamily, type, hIconRes ); - - if( !GetHandleSize(hIconRes) || err != noErr ) - return NO; - - AddResource( hIconRes, type, resID, "\p" ); - - return YES; -} - -@end - -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // Scrap Manager has been nixed on Snow Leopard -// Methods for interfacing with the Carbon Scrap Manager (analogous to and -// interoperable with the Cocoa Pasteboard). - -@implementation IconFamily (ScrapAdditions) - -+ (BOOL) canInitWithScrap -{ - ScrapRef scrap = NULL; - ScrapFlavorInfo* scrapInfos = NULL; - UInt32 numInfos = 0; - int i = 0; - BOOL canInit = NO; - - GetCurrentScrap(&scrap); - - GetScrapFlavorCount(scrap,&numInfos); - scrapInfos = malloc( sizeof(ScrapFlavorInfo)*numInfos ); - if (scrapInfos) { - GetScrapFlavorInfoList(scrap, &numInfos, scrapInfos); - - for( i=0; i<numInfos; i++ ) - { - if( scrapInfos[i].flavorType == 'icns' ) - canInit = YES; - } - - free( scrapInfos ); - } - - return canInit; -} - -+ (IconFamily*) iconFamilyWithScrap -{ - return [[[IconFamily alloc] initWithScrap] autorelease]; -} - -- initWithScrap -{ - Handle storageMem = NULL; - Size amountMem = 0; - ScrapRef scrap; - - self = [super init]; - - if( self ) - { - GetCurrentScrap(&scrap); - - GetScrapFlavorSize( scrap, 'icns', &amountMem ); - - storageMem = NewHandle(amountMem); - - GetScrapFlavorData( scrap, 'icns', &amountMem, *storageMem ); - - hIconFamily = (IconFamilyHandle)storageMem; - } - return self; -} - -- (BOOL) putOnScrap -{ - ScrapRef scrap = NULL; - - ClearCurrentScrap(); - GetCurrentScrap(&scrap); - -// HLock((Handle)hIconFamily); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - PutScrapFlavor( scrap, 'icns', kScrapFlavorMaskNone, GetHandleSize((Handle)hIconFamily), *hIconFamily); -// HUnlock((Handle)hIconFamily); // Handle-based memory isn't compacted anymore, so calling HLock()/HUnlock() is unnecessary. - return YES; -} - -@end - -#endif diff --git a/src/MacVim/icons/makeicns/Makefile b/src/MacVim/icons/makeicns/Makefile deleted file mode 100644 index cd8ef969cb..0000000000 --- a/src/MacVim/icons/makeicns/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -CFLAGS = -fpascal-strings -O2 - -.PHONY: clean dist - -makeicns: makeicns.o IconFamily.o NSString+CarbonFSRefCreation.o - g++ -o makeicns $^ -O2 \ - -framework Foundation -framework AppKit -framework Carbon - -clean: - rm -rf makeicns.o IconFamily.o NSString+CarbonFSRefCreation.o - -dist: makeicns - rm -rf makeicns-1.0.zip - zip makeicns-1.0.zip Makefile makeicns.m IconFamily.m IconFamily.h \ - NSString+CarbonFSRefCreation.m NSString+CarbonFSRefCreation.h \ - makeicns diff --git a/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.h b/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.h deleted file mode 100644 index e965c613ab..0000000000 --- a/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (c) 2001-2006 Troy N. Stephens - - Use and distribution of this source code is governed by the MIT License, whose terms are as follows. - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#import <Foundation/Foundation.h> -#import <Carbon/Carbon.h> - -@interface NSString (CarbonFSRefCreation) - -// Fills in the given FSRef struct so it specifies the file whose path is in this string. -// If the file doesn't exist, and "createFile" is YES, this method will attempt to create -// an empty file with the specified path. (The caller should insure that the directory -// the file is to be placed in already exists.) - -- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile; - -@end diff --git a/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.m b/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.m deleted file mode 100644 index 7e6a0f4588..0000000000 --- a/src/MacVim/icons/makeicns/NSString+CarbonFSRefCreation.m +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2001-2006 Troy N. Stephens - - Use and distribution of this source code is governed by the MIT License, whose terms are as follows. - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#import "NSString+CarbonFSRefCreation.h" - -@implementation NSString (CarbonFSRefCreation) - -- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile -{ - NSFileManager* fileManager = [NSFileManager defaultManager]; - CFURLRef urlRef; - Boolean gotFSRef; - - // Check whether the file exists already. If not, create an empty file if requested. - if (![fileManager fileExistsAtPath:self]) { - if (createFile) { - if (![@"" writeToFile:self atomically:YES]) { - return NO; - } - } else { - return NO; - } - } - - // Create a CFURL with the specified POSIX path. - urlRef = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, - (CFStringRef) self, - kCFURLPOSIXPathStyle, - FALSE /* isDirectory */ ); - if (urlRef == NULL) { -// printf( "** Couldn't make a CFURLRef for the file.\n" ); - return NO; - } - - // Try to create an FSRef from the URL. (If the specified file doesn't exist, this - // function will return false, but if we've reached this code we've already insured - // that the file exists.) - gotFSRef = CFURLGetFSRef( urlRef, fsRef ); - CFRelease( urlRef ); - - if (!gotFSRef) { -// printf( "** Couldn't get an FSRef for the file.\n" ); - return NO; - } - - return YES; -} - -@end diff --git a/src/MacVim/icons/makeicns/makeicns.m b/src/MacVim/icons/makeicns/makeicns.m deleted file mode 100644 index cfc2c26fa6..0000000000 --- a/src/MacVim/icons/makeicns/makeicns.m +++ /dev/null @@ -1,173 +0,0 @@ -// makeicns -// Converts images to Apple's icns format. -// Written by nicolasweber@gmx.de, released under MIT license. - -#import <Foundation/Foundation.h> -#import <AppKit/AppKit.h> - -#import <Cocoa/Cocoa.h> - -#include "IconFamily.h" - -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 -// This is defined in 10.5 and beyond in IconStorage.h -enum { - kIconServices512PixelDataARGB = 'ic09' /* non-premultiplied 512x512 ARGB bitmap*/ -}; -#endif - -#define VERSION "1.0 (20081122)" - -void usage() { - fprintf(stderr, -"makeicns v%s\n\n", VERSION); - fprintf(stderr, -"Usage: makeicns [k1=v1] [k2=v2] ...\n\n"); - fprintf(stderr, -"Keys and values include:\n"); - fprintf(stderr, -" 512: Name of input image for 512x512 variant of icon\n"); - fprintf(stderr, -" 256: Name of input image for 256x256 variant of icon\n"); - fprintf(stderr, -" 128: Name of input image for 128x128 variant of icon\n"); - fprintf(stderr, -" 32: Name of input image for 32x32 variant of icon\n"); - fprintf(stderr, -" 16: Name of input image for 16x16 variant of icon\n"); - fprintf(stderr, -" in: Name of input image for all variants not having an explicit name\n"); - fprintf(stderr, -" out: Name of output file, defaults to first nonempty input name,\n" -" but with icns extension\n\n"); - fprintf(stderr, -"Examples:\n\n" -" icns -512 image.png -32 image.png\n" -" Creates image.icns with only a 512x512 and a 32x32 variant.\n\n" -" icns -in myfile.jpg -32 otherfile.png -out outfile.icns\n" -" Creates outfile.icns with sizes 512, 256, 128, and 16 containing data\n" -" from myfile.jpg and with size 32 containing data from otherfile.png.\n"); - exit(1); -} - - -NSBitmapImageRep* getBitmapImageRepOfSize(NSImage* img, int size) { - - // Don't resample if it's not necessary -#if 0 - // IconFamily does not work correctly with - // NSAlphaNonpremultipliedBitmapFormat images, so this has to stay disabled - // until IconFamily is fixed (if ever). - NSEnumerator* e = [[img representations] objectEnumerator]; - NSImageRep* ir; - while ((ir = [e nextObject])) { - if (![ir isKindOfClass:[NSBitmapImageRep class]]) continue; - - NSBitmapImageRep* br = (NSBitmapImageRep*)ir; - //NSLog(@"%@", br); - if ([br pixelsWide] == size && [br pixelsHigh] == size - && ([[br colorSpaceName] isEqualToString:NSDeviceRGBColorSpace] - || [[br colorSpaceName] isEqualToString:NSCalibratedRGBColorSpace]) - && ([br bitsPerPixel] == 24 || [br bitsPerPixel] == 32) - ) - return br; - } -#endif - - NSLog(@"Resampling for size %d", size); - NSBitmapImageRep* r = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:NULL - pixelsWide:size - pixelsHigh:size - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:0 - bytesPerRow:0 - bitsPerPixel:0]; - - [NSGraphicsContext saveGraphicsState]; - NSGraphicsContext* context = [NSGraphicsContext - graphicsContextWithBitmapImageRep:r]; - [context setShouldAntialias:YES]; - [context setImageInterpolation:NSImageInterpolationHigh]; - [NSGraphicsContext setCurrentContext:context]; - - [img drawInRect:NSMakeRect(0, 0, size, size) - fromRect:NSZeroRect - operation:NSCompositeCopy - fraction:1.0]; - - [NSGraphicsContext restoreGraphicsState]; - - return r; -} - - -int main(int argc, char* argv[]) { - int i; - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - NSApplicationLoad(); - - struct { - NSString* paramName; - OSType type, mask; - int size; - NSString* inputName; - } inputs[] = { - { @"512", kIconServices512PixelDataARGB, 0, 512, nil }, - { @"256", kIconServices256PixelDataARGB, 0, 256, nil }, - { @"128", kThumbnail32BitData, kThumbnail8BitMask, 128, nil }, - { @"32", kLarge32BitData, kLarge8BitMask, 32, nil }, - { @"16", kSmall32BitData, kSmall8BitMask, 16, nil }, - }; - const int N = sizeof(inputs)/sizeof(inputs[0]); - - // Process arguments -- Thanks Greg! - //http://unixjunkie.blogspot.com/2006/07/command-line-processing-in-cocoa.html - NSUserDefaults* args = [NSUserDefaults standardUserDefaults]; - - BOOL foundInputParam = NO; - NSString* outputName = [args stringForKey:@"out"]; - NSString* defaultIn = [args stringForKey:@"in"]; - for (i = 0; i < N; ++i) { - inputs[i].inputName = [args stringForKey:inputs[i].paramName]; - if (inputs[i].inputName == nil) - inputs[i].inputName = defaultIn; - foundInputParam = foundInputParam || inputs[i].inputName != nil; - - // Create default output name if necessary - if (outputName == nil && inputs[i].inputName != nil) - outputName = [[inputs[i].inputName stringByDeletingPathExtension] - stringByAppendingPathExtension:@"icns"]; - } - - if (!foundInputParam) - usage(); - - // Create output - IconFamily* output = [IconFamily iconFamily]; - - for (i = 0; i < N; ++i) { - if (inputs[i].inputName == nil) continue; - NSImage* img = [[[NSImage alloc] initWithContentsOfFile:inputs[i].inputName] - autorelease]; - - NSBitmapImageRep* rep = getBitmapImageRepOfSize(img, inputs[i].size); - [output setIconFamilyElement:inputs[i].type fromBitmapImageRep:rep]; - if (inputs[i].mask != 0) - [output setIconFamilyElement:inputs[i].mask fromBitmapImageRep:rep]; - } - - // Write output - if ([output writeToFile:outputName]) - NSLog(@"Wrote output file \"%@\"", outputName); - else - NSLog(@"Failed to write \"%@\"", outputName); - - [pool drain]; - return 0; -} diff --git a/src/MacVim/icons/setup.py b/src/MacVim/icons/setup.py deleted file mode 100644 index 3afc2ed60a..0000000000 --- a/src/MacVim/icons/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from distutils.core import setup, Extension - -setup(name="loadfont", version="1.0", - ext_modules = [Extension("loadfont", ["loadfont.c"])]) - diff --git a/src/MacVim/icons/vim-noshadow-512.png b/src/MacVim/icons/vim-noshadow-512.png deleted file mode 100644 index 0eefe3b242..0000000000 Binary files a/src/MacVim/icons/vim-noshadow-512.png and /dev/null differ diff --git a/src/MacVim/macvim-askpass b/src/MacVim/macvim-askpass new file mode 100755 index 0000000000..608439aa63 --- /dev/null +++ b/src/MacVim/macvim-askpass @@ -0,0 +1,29 @@ +#! /bin/sh + +# +# An SSH_ASKPASS command for MacOS X +# +# Author: Joseph Mocker, Sun Microsystems +# +# http://blog.retep.org/2009/04/09/ssh-askpass-on-osx-10-5/ + +# +# To use this script: +# setenv SSH_ASKPASS "macos-askpass" +# setenv DISPLAY ":0" +# + +TITLE=${MACOS_ASKPASS_TITLE:-"SSH"} + +DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\"" +DIALOG="$DIALOG with icon caution with hidden answer" + +result=`osascript -e 'tell application "Finder"' -e "activate" -e "$DIALOG" -e "text returned of result" -e 'end tell'` +osascript -e 'tell application "MacVim"' -e "activate" -e 'end tell' + +if [ "$result" = "" ]; then + exit 1 +else + echo "$result" + exit 0 +fi diff --git a/src/MacVim/mvim b/src/MacVim/mvim index 653cf783ea..daad9fbd61 100755 --- a/src/MacVim/mvim +++ b/src/MacVim/mvim @@ -8,28 +8,28 @@ # Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This # version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico # Weber and Bjorn Winckler, Aug 13 2007). -# First, check "All the Usual Suspects" for the location of the Vim.app bundle. -# You can short-circuit this by setting the VIM_APP_DIR environment variable -# or by un-commenting and editing the following line: -# VIM_APP_DIR=/Applications +# -if [ -z "$VIM_APP_DIR" ] -then - myDir="`dirname "$0"`" - myAppDir="$myDir/../Applications" - for i in ~/Applications ~/Applications/vim $myDir $myDir/vim $myAppDir $myAppDir/vim /Applications /Applications/vim /Applications/Utilities /Applications/Utilities/vim; do - if [ -x "$i/MacVim.app" ]; then - VIM_APP_DIR="$i" - break - fi +# Find Vim executable +if [ -L "$0" ]; then + # readlink -f + curdir=`pwd -P` + self_path=$0 + cd "`dirname $self_path`" + while [ -L "$self_path" ]; do + self_path=`readlink $self_path` + cd "`dirname $self_path`" + self_path=`basename $self_path` done + binary="`pwd -P`/../MacOS/Vim" + cd "$curdir" +else + binary="`dirname "$0"`/../MacOS/Vim" fi -if [ -z "$VIM_APP_DIR" ] -then - echo "Sorry, cannot find MacVim.app. Try setting the VIM_APP_DIR environment variable to the directory containing MacVim.app." +if ! [ -x "$binary" ]; then + echo "Sorry, cannot find Vim executable." exit 1 fi -binary="$VIM_APP_DIR/MacVim.app/Contents/MacOS/Vim" # Next, peek at the name used to invoke this script, and set options # accordingly. @@ -41,6 +41,11 @@ opts= # GUI mode, implies forking case "$name" in m*|g*|rm*|rg*) gui=true ;; esac +# Logged in over SSH? No gui. +if [ -n "${SSH_CONNECTION}" ]; then + gui= +fi + # Restricted mode case "$name" in r*) opts="$opts -Z";; esac diff --git a/src/MacVim/qlstephen/English.lproj/InfoPlist.strings b/src/MacVim/qlstephen/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000..74d3187406 Binary files /dev/null and b/src/MacVim/qlstephen/English.lproj/InfoPlist.strings differ diff --git a/src/MacVim/qlstephen/GeneratePreviewForURL.m b/src/MacVim/qlstephen/GeneratePreviewForURL.m new file mode 100644 index 0000000000..b3147bdb3e --- /dev/null +++ b/src/MacVim/qlstephen/GeneratePreviewForURL.m @@ -0,0 +1,88 @@ +#include <CoreFoundation/CoreFoundation.h> +#include <CoreServices/CoreServices.h> +#include <QuickLook/QuickLook.h> + +#import <Foundation/Foundation.h> + +#import "QLSFileAttributes.h" + +#define DEFAULT_MAX_FILE_SIZE 1024 * 100 + +// Generate a preview for the document with the given url +OSStatus GeneratePreviewForURL(void *thisInterface, + QLPreviewRequestRef request, + CFURLRef url, + CFStringRef contentTypeUTI, + CFDictionaryRef options) { + @autoreleasepool { + if (QLPreviewRequestIsCancelled(request)) + return noErr; + + QLSFileAttributes *magicAttributes = + [QLSFileAttributes attributesForItemAtURL:(__bridge NSURL *)url]; + + if (!magicAttributes) { + NSLog(@"QLStephen: Could not determine attribtues of file %@", url); + return noErr; + } + + if (!magicAttributes.isTextFile) { + return noErr; + } + + if (magicAttributes.fileEncoding == kCFStringEncodingInvalidId) { + NSLog(@"QLStephen: Could not determine encoding of file %@", url); + return noErr; + } + + NSDictionary *previewProperties = @{ + (NSString *)kQLPreviewPropertyStringEncodingKey : @( magicAttributes.fileEncoding ), + (NSString *)kQLPreviewPropertyWidthKey : @700, + (NSString *)kQLPreviewPropertyHeightKey : @800 + }; + + // Get size of current File + NSFileManager *man = [NSFileManager defaultManager]; + NSURL *file_url = (__bridge NSURL *)(url); + NSDictionary *attrs = [man attributesOfItemAtPath: [file_url path] error: NULL]; + + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + + // the plugin is running as com.apple.quicklook.satellite therefore we need to load our own settings + NSDictionary *defaults = [userDefaults persistentDomainForName:@"com.whomwah.quicklookstephen"]; + + long long maxFileSizeSetting = [[defaults valueForKey:@"maxFileSize"] longLongValue]; + unsigned long long maxFileSize = DEFAULT_MAX_FILE_SIZE; + if(maxFileSizeSetting > 0) { + maxFileSize = maxFileSizeSetting; + } + + // Display less data, if file is too big + if(attrs.fileSize > maxFileSize) { + NSFileHandle *myFile= [NSFileHandle fileHandleForReadingAtPath:[file_url path]]; + if(!myFile) { + return noErr; + } + NSData *displayData = [myFile readDataOfLength:maxFileSize]; + [myFile closeFile]; + + QLPreviewRequestSetDataRepresentation( + request, + (__bridge CFDataRef)displayData, + kUTTypePlainText, + (__bridge CFDictionaryRef)previewProperties); + return noErr; + } + QLPreviewRequestSetURLRepresentation( + request, + url, + kUTTypePlainText, + (__bridge CFDictionaryRef)previewProperties); + + return noErr; + } +} + +void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview) { + // implement only if supported +} diff --git a/src/MacVim/qlstephen/GenerateThumbnailForURL.m b/src/MacVim/qlstephen/GenerateThumbnailForURL.m new file mode 100644 index 0000000000..bcbe23f826 --- /dev/null +++ b/src/MacVim/qlstephen/GenerateThumbnailForURL.m @@ -0,0 +1,163 @@ +#include <CoreFoundation/CoreFoundation.h> +#include <CoreServices/CoreServices.h> +#include <QuickLook/QuickLook.h> + +#import <Foundation/Foundation.h> + +#import "QLSFileAttributes.h" + +/** + * This dictionary is used for a file with no extension. It maps the MIME type + * (as returned by file(1)) onto an appropriate thumbnail badge. + */ +static NSDictionary *mimeTypeToBadgeMap() { + return @{ + @"application/xml": @"xml", + @"text/x-c" : @"C", + @"text/x-c++" : @"C++", + @"text/x-shellscript" : @"shell", + @"text/x-php" : @"php", + @"text/x-python" : @"python", + @"text/x-perl" : @"perl", + @"text/x-ruby" : @"ruby" + }; +} + +/** + * Some formats, e.g. Makefiles, have well-known names and no extension. + */ +static NSDictionary *filenameRegexToBadgeMap() { + return @{ + @"Makefile" : @"make" + }; +} + +/** + * @return the string that should be used to badge the thumbnail. + */ +static NSString *ThumbnailBadgeForItemWithAttributes( + QLSFileAttributes *attributes) { + + NSString *fileExtension = attributes.url.pathExtension; + NSString *fileName = attributes.url.lastPathComponent; + __block NSString *badge; + + // Do we have a file extension? If so, use it as a badge if it's not too + // long. + if (![fileExtension isEqualToString:@""]) { + badge = fileExtension; + + // Is the file extension too long to be reasonably displayed in a + // thumbnail? If so, fall back on the additional tests. + + // FIXME: use some better test to determine an appropriate length. + // FIXME: perhaps we should truncate the extension (at the end? in the + // middle?) to fit as much in the thumbnail as possible. + + if (badge.length >= 10) + badge = nil; + } + + // Do we have a well-known MIME type? Note that we only do this test if we + // have no file extension. file(1) might wrongly guess the MIME type, and it + // would be annoying if the file extension were to say one thing and the + // badge another. + if (!badge && [fileExtension isEqualToString:@""]) { + NSDictionary *map = mimeTypeToBadgeMap(); + badge = map[attributes.mimeType]; + } + + // Does the filename match a known pattern? If so, use the appropriate badge. + if (!badge && [fileExtension isEqualToString:@""]) { + NSDictionary *map = filenameRegexToBadgeMap(); + [map enumerateKeysAndObjectsUsingBlock: + ^(NSString *pattern, NSString *candidateBadge, BOOL *stop) { + NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:nil]; + NSRange range = [regex rangeOfFirstMatchInString:fileName options:0 range:NSMakeRange(0, fileName.length)]; + if (range.location != NSNotFound) { + badge = candidateBadge; + *stop = true; + } + }]; + } + + // Do we have an executable text file? If so, assume it's a script of some + // sort. + if (!badge) { + NSFileManager *fm = [NSFileManager new]; + BOOL isExecutable = [fm isExecutableFileAtPath:attributes.url.path]; + if (isExecutable) + badge = @"script"; + } + + // No other tests passed? Just badge it with "txt". I would use "text", + // except that the OS X text QuickLook generator uses "txt", and we ought + // to be consistent with it. + if (!badge) { + badge = @"txt"; + } + + return [badge uppercaseString]; +} + + +/* ----------------------------------------------------------------------------- + Generate a thumbnail for file + + This function's job is to create thumbnail for designated file as fast as + possible + -------------------------------------------------------------------------- */ +OSStatus GenerateThumbnailForURL(void *thisInterface, + QLThumbnailRequestRef request, + CFURLRef url, + CFStringRef contentTypeUTI, + CFDictionaryRef options, + CGSize maxSize) { + @autoreleasepool { + if (QLThumbnailRequestIsCancelled(request)) + return noErr; + + QLSFileAttributes *magicAttributes + = [QLSFileAttributes attributesForItemAtURL:(__bridge NSURL *)url]; + + if (!magicAttributes) { + NSLog(@"QLStephen: Could not determine attribtues of file %@", url); + return noErr; + } + + if (!magicAttributes.isTextFile) { +// NSLog(@"QLStephen: I don't think %@ is a text file", url); + return noErr; + } + + if (magicAttributes.fileEncoding == kCFStringEncodingInvalidId) { + NSLog(@"QLStephen: Could not determine encoding of file %@", url); + return noErr; + } + + NSDictionary *previewProperties = @{ + (NSString *)kQLPreviewPropertyStringEncodingKey : @( magicAttributes.fileEncoding ) + }; + + NSString *badge = ThumbnailBadgeForItemWithAttributes(magicAttributes); + + NSDictionary *properties = @{ + (NSString *)kQLThumbnailPropertyExtensionKey : badge + }; + + + QLThumbnailRequestSetThumbnailWithURLRepresentation( + request, + url, + kUTTypePlainText, + (__bridge CFDictionaryRef)previewProperties, + (__bridge CFDictionaryRef)properties); + + return noErr; + } +} + +void CancelThumbnailGeneration(void* thisInterface, + QLThumbnailRequestRef thumbnail) { + // implement only if supported +} diff --git a/src/MacVim/qlstephen/Info.plist b/src/MacVim/qlstephen/Info.plist new file mode 100644 index 0000000000..f549a67bcc --- /dev/null +++ b/src/MacVim/qlstephen/Info.plist @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeName</key> + <string>PlainText</string> + <key>CFBundleTypeRole</key> + <string>QLGenerator</string> + <key>LSItemContentTypes</key> + <array> + <string>public.data</string> + </array> + <key>LSTypeIsPackage</key> + <false/> + <key>NSPersistentStoreTypeKey</key> + <string>XML</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>QLStephen</string> + <key>CFBundleShortVersionString</key> + <string>1.44</string> + <key>CFBundleVersion</key> + <string>1.4.4</string> + <key>CFPlugInDynamicRegisterFunction</key> + <string></string> + <key>CFPlugInDynamicRegistration</key> + <string>NO</string> + <key>CFPlugInFactories</key> + <dict> + <key>0CCF41BD-5E94-487C-B19D-FAADBD387609</key> + <string>QuickLookGeneratorPluginFactory</string> + </dict> + <key>CFPlugInTypes</key> + <dict> + <key>5E2D9680-5022-40FA-B806-43349622E5B9</key> + <array> + <string>0CCF41BD-5E94-487C-B19D-FAADBD387609</string> + </array> + </dict> + <key>CFPlugInUnloadFunction</key> + <string></string> + <key>NSHumanReadableCopyright</key> + <string>Copyright © 2016 Duncan Robertson. All rights reserved.</string> + <key>QLNeedsToBeRunInMainThread</key> + <true/> + <key>QLPreviewHeight</key> + <real>600</real> + <key>QLPreviewWidth</key> + <real>800</real> + <key>QLSupportsConcurrentRequests</key> + <true/> + <key>QLThumbnailMinimumSize</key> + <real>17</real> +</dict> +</plist> diff --git a/src/MacVim/qlstephen/LICENSE b/src/MacVim/qlstephen/LICENSE new file mode 100644 index 0000000000..3be462ac6f --- /dev/null +++ b/src/MacVim/qlstephen/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Duncan Robertson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/src/MacVim/qlstephen/QLSFileAttributes.h b/src/MacVim/qlstephen/QLSFileAttributes.h new file mode 100644 index 0000000000..664ef65e8a --- /dev/null +++ b/src/MacVim/qlstephen/QLSFileAttributes.h @@ -0,0 +1,21 @@ +// +// QLSMagicFileAttributes.h +// QuickLookStephen +// +// Created by Nick Hutchinson on 31/07/12. + +#import <Foundation/Foundation.h> + +@interface QLSFileAttributes : NSObject + ++ (instancetype)attributesForItemAtURL:(NSURL *)aURL; + +@property (readonly) NSURL *url; + +@property (readonly) BOOL isTextFile; +@property (readonly) NSString *mimeType; +@property (readonly) CFStringEncoding fileEncoding; + +@end + + diff --git a/src/MacVim/qlstephen/QLSFileAttributes.m b/src/MacVim/qlstephen/QLSFileAttributes.m new file mode 100644 index 0000000000..52282e6044 --- /dev/null +++ b/src/MacVim/qlstephen/QLSFileAttributes.m @@ -0,0 +1,120 @@ +// +// QLSMagicFileAttributes.m +// QuickLookStephen +// +// Created by Nick Hutchinson on 31/07/12. +// + +#import "QLSFileAttributes.h" + +@interface QLSFileAttributes () + +@property (readwrite) BOOL isTextFile; +@property (readwrite) NSString *mimeType; +@property (readwrite) CFStringEncoding fileEncoding; +@property (readwrite) NSURL *url; + +@end + +@implementation QLSFileAttributes + ++ (instancetype)attributesForItemAtURL:(NSURL *)aURL { + if ([aURL.lastPathComponent isEqualToString:@".DS_Store"]) { + NSLog(@"Ignore the .DS_Store file."); + return nil; + } + + NSString *magicString = [self magicStringForItemAtURL:aURL usingLcALL:@"en_US.UTF-8"]; + if (!magicString) magicString = [self magicStringForItemAtURL:aURL usingLcALL:@"C"]; + if (!magicString) return nil; + NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\S+/\\S+); charset=(\\S+)" options:0 error:nil]; + NSTextCheckingResult *match = [regex firstMatchInString:magicString options:0 range:NSMakeRange(0, magicString.length)]; + + if (!match) return nil; + + NSString *mimeType = [magicString substringWithRange:[match rangeAtIndex:1]]; + NSString *charset = [magicString substringWithRange:[match rangeAtIndex:2]]; + + BOOL mimeTypeIsTextual = [self mimeTypeIsTextual:mimeType]; + + CFStringEncoding encoding = + CFStringConvertIANACharSetNameToEncoding((CFStringRef)charset); + + QLSFileAttributes *attributes = [QLSFileAttributes new]; + attributes.fileEncoding = encoding; + attributes.isTextFile = mimeTypeIsTextual; + attributes.mimeType = mimeType; + attributes.url = aURL; + + return attributes; +} + +//////////////////////////////////////////////////////////////////////////////// +// Private Methods +//////////////////////////////////////////////////////////////////////////////// + ++ (NSString *)magicStringForItemAtURL:(NSURL *)aURL usingLcALL:(NSString *)lcALL { + NSString *path = [aURL path]; + NSParameterAssert(path); + + NSMutableDictionary *environment = + [NSProcessInfo.processInfo.environment mutableCopy]; + environment[@"LC_ALL"] = lcALL; + + NSTask *task = [NSTask new]; + task.launchPath = @"/usr/bin/file"; + task.arguments = @[@"--mime", @"--brief", path]; + task.environment = environment; + task.standardOutput = [NSPipe new]; + + [task launch]; + + NSData *output = + [[task.standardOutput fileHandleForReading] readDataToEndOfFile]; + + [task waitUntilExit]; + + if (task.terminationReason != NSTaskTerminationReasonExit + || task.terminationStatus != 0) { + return nil; + } + + NSCharacterSet *whitespaceCharset = + [NSCharacterSet whitespaceAndNewlineCharacterSet]; + + NSString *stringOutput = + [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding]; + + stringOutput = + [stringOutput stringByTrimmingCharactersInSet:whitespaceCharset]; + + return stringOutput; +} + + +/** + * @return YES if mimeType contains "text", or if the mime type conforms to the + * public.text UTI. + */ ++ (BOOL)mimeTypeIsTextual:(NSString *)mimeType { + NSArray *components = [mimeType componentsSeparatedByString:@"/"]; + if (components.count != 2) + return NO; + + if ([components[0] rangeOfString:@"text"].location != NSNotFound) + return YES; + + NSString *UTType = + CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag( + kUTTagClassMIMEType, + (__bridge CFStringRef)mimeType, + kUTTypeData)); + + if (UTTypeConformsTo((__bridge CFStringRef)UTType, kUTTypeText)) { + return YES; + } + + return NO; +} + +@end diff --git a/src/MacVim/qlstephen/QuickLookStephen.xcodeproj/project.pbxproj b/src/MacVim/qlstephen/QuickLookStephen.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..c7de7370d6 --- /dev/null +++ b/src/MacVim/qlstephen/QuickLookStephen.xcodeproj/project.pbxproj @@ -0,0 +1,300 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0107ABFF15C76F2900C65F1A /* QLSFileAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 0107ABFD15C76F2900C65F1A /* QLSFileAttributes.m */; }; + 0149EB3E15F2E9A3003AB298 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0149EB3D15F2E9A3003AB298 /* libicucore.dylib */; }; + 2C05A19C06CAA52B00D84F6F /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */; }; + 61E3BCFB0870B4F2002186A0 /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */; }; + 8D576312048677EA00EA77CD /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B6FE84183AC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; + 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; }; + AE02F6EB0EDDFA6400CBA17D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE02F6EA0EDDFA6400CBA17D /* Cocoa.framework */; }; + C86B05270671AA6E00DD9006 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C86B05260671AA6E00DD9006 /* CoreServices.framework */; }; + F28CFBFD0A3EC0AF000ABFF5 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */; }; + F28CFC030A3EC0C6000ABFF5 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0107ABFC15C76F2900C65F1A /* QLSFileAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QLSFileAttributes.h; sourceTree = "<group>"; }; + 0107ABFD15C76F2900C65F1A /* QLSFileAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = QLSFileAttributes.m; sourceTree = "<group>"; tabWidth = 2; usesTabs = 0; }; + 0149EB3D15F2E9A3003AB298 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; + 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 08FB77B6FE84183AC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; + 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratePreviewForURL.m; sourceTree = "<group>"; usesTabs = 0; }; + 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GenerateThumbnailForURL.m; sourceTree = "<group>"; }; + 8D576316048677EA00EA77CD /* QLStephen.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QLStephen.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; + AE02F6EA0EDDFA6400CBA17D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + C86B05260671AA6E00DD9006 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; }; + F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; + F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = /System/Library/Frameworks/QuickLook.framework; sourceTree = "<absolute>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D576313048677EA00EA77CD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0149EB3E15F2E9A3003AB298 /* libicucore.dylib in Frameworks */, + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, + C86B05270671AA6E00DD9006 /* CoreServices.framework in Frameworks */, + F28CFBFD0A3EC0AF000ABFF5 /* ApplicationServices.framework in Frameworks */, + F28CFC030A3EC0C6000ABFF5 /* QuickLook.framework in Frameworks */, + AE02F6EB0EDDFA6400CBA17D /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 089C166AFE841209C02AAC07 /* QuickLookStephen */ = { + isa = PBXGroup; + children = ( + 08FB77AFFE84173DC02AAC07 /* Source */, + 089C167CFE841241C02AAC07 /* Resources */, + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, + 19C28FB6FE9D52B211CA2CBB /* Products */, + ); + name = QuickLookStephen; + sourceTree = "<group>"; + }; + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 0149EB3D15F2E9A3003AB298 /* libicucore.dylib */, + AE02F6EA0EDDFA6400CBA17D /* Cocoa.framework */, + F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */, + F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */, + C86B05260671AA6E00DD9006 /* CoreServices.framework */, + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = "<group>"; + }; + 089C167CFE841241C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 8D576317048677EA00EA77CD /* Info.plist */, + 8D5B49A704867FD3000E48DA /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 08FB77AFFE84173DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */, + 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */, + 08FB77B6FE84183AC02AAC07 /* main.c */, + 0107ABFC15C76F2900C65F1A /* QLSFileAttributes.h */, + 0107ABFD15C76F2900C65F1A /* QLSFileAttributes.m */, + ); + name = Source; + sourceTree = "<group>"; + }; + 19C28FB6FE9D52B211CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D576316048677EA00EA77CD /* QLStephen.qlgenerator */, + ); + name = Products; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D57630D048677EA00EA77CD /* QuickLookStephen */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2CA3261E0896AD4900168862 /* Build configuration list for PBXNativeTarget "QuickLookStephen" */; + buildPhases = ( + 8D57630F048677EA00EA77CD /* Resources */, + 8D576311048677EA00EA77CD /* Sources */, + 8D576313048677EA00EA77CD /* Frameworks */, + 698210201CC62DD000504BBF /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = QuickLookStephen; + productName = QuickLookStephen; + productReference = 8D576316048677EA00EA77CD /* QLStephen.qlgenerator */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 089C1669FE841209C02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0730; + }; + buildConfigurationList = 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QuickLookStephen" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 089C166AFE841209C02AAC07 /* QuickLookStephen */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D57630D048677EA00EA77CD /* QuickLookStephen */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D57630F048677EA00EA77CD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 698210201CC62DD000504BBF /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "qlmanage -r"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D576311048677EA00EA77CD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D576312048677EA00EA77CD /* main.c in Sources */, + 2C05A19C06CAA52B00D84F6F /* GeneratePreviewForURL.m in Sources */, + 61E3BCFB0870B4F2002186A0 /* GenerateThumbnailForURL.m in Sources */, + 0107ABFF15C76F2900C65F1A /* QLSFileAttributes.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C167EFE841241C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2CA3261F0896AD4900168862 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.whomwah.quicklookstephen; + PRODUCT_NAME = QLStephen; + WRAPPER_EXTENSION = qlgenerator; + }; + name = Debug; + }; + 2CA326200896AD4900168862 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.whomwah.quicklookstephen; + PRODUCT_NAME = QLStephen; + WRAPPER_EXTENSION = qlgenerator; + }; + name = Release; + }; + 2CA326230896AD4900168862 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_PREPROCESSOR_DEFINITIONS = "RKL_PREPEND_TO_METHODS=rkl_"; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + WARNING_CFLAGS = ( + "-Wextra", + "-Wall", + "-Wno-unused-parameter", + ); + }; + name = Debug; + }; + 2CA326240896AD4900168862 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_C_LANGUAGE_STANDARD = c99; + GCC_PREPROCESSOR_DEFINITIONS = "RKL_PREPEND_TO_METHODS=rkl_"; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx; + WARNING_CFLAGS = ( + "-Wextra", + "-Wall", + "-Wno-unused-parameter", + ); + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2CA3261E0896AD4900168862 /* Build configuration list for PBXNativeTarget "QuickLookStephen" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2CA3261F0896AD4900168862 /* Debug */, + 2CA326200896AD4900168862 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QuickLookStephen" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2CA326230896AD4900168862 /* Debug */, + 2CA326240896AD4900168862 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 089C1669FE841209C02AAC07 /* Project object */; +} diff --git a/src/MacVim/qlstephen/README.md b/src/MacVim/qlstephen/README.md new file mode 100644 index 0000000000..333567d919 --- /dev/null +++ b/src/MacVim/qlstephen/README.md @@ -0,0 +1,72 @@ +## !! UPDATE !! + +Hi all. I'm afriad I don't have time to maintain this project any more. I see the issues mounting but I don't have time to answer them. This was a pet project some time ago and I still use the plugin daily and it works just fine for me in it's current form. If anyone would like to step forward and be added a contributor to move it forward, please send me a message. + +Duncan + +## Reinforcement have arrived :-) + +I have volunteered to bring Duncan's excellent QL plugin a bit more up to date. Don't expect to much though. I will focus on backlogged pull requests to begin with. + +Tomas + +# QuicklookStephen + +QLStephen is a QuickLook plugin that lets you view plain text files without a file extension. Files like: + + README + INSTALL + Capfile + CHANGELOG + etc... + +## Installation + + +### Pre-compiled + +* [Download the latest version of QuickLookStephen](https://github.com/whomwah/qlstephen/releases) +* Unzip +* Copy the file into `/Library/QuickLook` or `~/Library/QuickLook` + (You can create the `QuickLook` folder if it doesn’t exist) + + +### Manually Compiled + +Compliling the project yourself? Just copy the generated `QLStephen.qlgenerator` +file into the relevant `QuickLook` folder (as above). + + +## Trouble? + +If you’ve installed the plugin, but don’t see any changes: + +- Make sure you are editing (a) the correct plist of (b) the correct bundle. + (For example, you might have two `QLStephen` plugins. It’s possible the plugin in + another directory—perhaps `/Library/QuickLook/`—is what is being read.) +- Run `qlmanage -r` in the Terminal. (This will restart QuickLook, which reloads all plugins.) + + +## Why “QLStephen”? + +Because I was listening to [Adam and Joe](http://www.bbc.co.uk/blogs/adamandjoe/2009/06/test-1.shtml) when I first wrote it. + + +## Authors + +**Original author:** Duncan Robertson + +Special thanks to the following people for submitting patches over the years: + +* [Guillermo Ignacio Enriquez Gutierrez](https://github.com/nacho4d) +* [Rob Lourens](https://github.com/roblourens) +* [Avi Flax](https://github.com/aviflax) +* [Tony](https://github.com/Zearin) +* [Nicholas Hutchinson](https://github.com/nickhutchinson) + + +## Contributing + +* Fork the project +* Send a pull request +* Don’t change the build number (I’ll do that when I release a new version) diff --git a/src/MacVim/qlstephen/main.c b/src/MacVim/qlstephen/main.c new file mode 100644 index 0000000000..b95b9ff081 --- /dev/null +++ b/src/MacVim/qlstephen/main.c @@ -0,0 +1,218 @@ +//============================================================================== +// +// DO NO MODIFY THE CONTENT OF THIS FILE +// +// This file contains the generic CFPlug-in code necessary for your generator +// To complete your generator implement the function in GenerateThumbnailForURL/GeneratePreviewForURL.c +// +//============================================================================== + + + + + + +#include <CoreFoundation/CoreFoundation.h> +#include <CoreFoundation/CFPlugInCOM.h> +#include <CoreServices/CoreServices.h> +#include <QuickLook/QuickLook.h> + +// ----------------------------------------------------------------------------- +// constants +// ----------------------------------------------------------------------------- + +// Don't modify this line +#define PLUGIN_ID "0CCF41BD-5E94-487C-B19D-FAADBD387609" + +// +// Below is the generic glue code for all plug-ins. +// +// You should not have to modify this code aside from changing +// names if you decide to change the names defined in the Info.plist +// + + +// ----------------------------------------------------------------------------- +// typedefs +// ----------------------------------------------------------------------------- + +// The thumbnail generation function to be implemented in GenerateThumbnailForURL.c +OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize); +void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail); + +// The preview generation function to be implemented in GeneratePreviewForURL.c +OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); +void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); + +// The layout for an instance of QuickLookGeneratorPlugIn +typedef struct __QuickLookGeneratorPluginType +{ + void *conduitInterface; + CFUUIDRef factoryID; + UInt32 refCount; +} QuickLookGeneratorPluginType; + +// ----------------------------------------------------------------------------- +// prototypes +// ----------------------------------------------------------------------------- +// Forward declaration for the IUnknown implementation. +// + +QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID); +void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance); +HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); +void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); +ULONG QuickLookGeneratorPluginAddRef(void *thisInstance); +ULONG QuickLookGeneratorPluginRelease(void *thisInstance); + +// ----------------------------------------------------------------------------- +// myInterfaceFtbl definition +// ----------------------------------------------------------------------------- +// The QLGeneratorInterfaceStruct function table. +// +static QLGeneratorInterfaceStruct myInterfaceFtbl = { + NULL, + QuickLookGeneratorQueryInterface, + QuickLookGeneratorPluginAddRef, + QuickLookGeneratorPluginRelease, + NULL, + NULL, + NULL, + NULL +}; + + +// ----------------------------------------------------------------------------- +// AllocQuickLookGeneratorPluginType +// ----------------------------------------------------------------------------- +// Utility function that allocates a new instance. +// You can do some initial setup for the generator here if you wish +// like allocating globals etc... +// +QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID) +{ + QuickLookGeneratorPluginType *theNewInstance; + + theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType)); + memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType)); + + /* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */ + theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct)); + memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct)); + + /* Retain and keep an open instance refcount for each factory. */ + theNewInstance->factoryID = CFRetain(inFactoryID); + CFPlugInAddInstanceForFactory(inFactoryID); + + /* This function returns the IUnknown interface so set the refCount to one. */ + theNewInstance->refCount = 1; + return theNewInstance; +} + +// ----------------------------------------------------------------------------- +// DeallocQuickLookGeneratorPluginType +// ----------------------------------------------------------------------------- +// Utility function that deallocates the instance when +// the refCount goes to zero. +// In the current implementation generator interfaces are never deallocated +// but implement this as this might change in the future +// +void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance) +{ + CFUUIDRef theFactoryID; + + theFactoryID = thisInstance->factoryID; + /* Free the conduitInterface table up */ + free(thisInstance->conduitInterface); + + /* Free the instance structure */ + free(thisInstance); + if (theFactoryID){ + CFPlugInRemoveInstanceForFactory(theFactoryID); + CFRelease(theFactoryID); + } +} + +// ----------------------------------------------------------------------------- +// QuickLookGeneratorQueryInterface +// ----------------------------------------------------------------------------- +// Implementation of the IUnknown QueryInterface function. +// +HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv) +{ + CFUUIDRef interfaceID; + + interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid); + + if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){ + /* If the Right interface was requested, bump the ref count, + * set the ppv parameter equal to the instance, and + * return good status. + */ + ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL; + ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration; + ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL; + ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration; + ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); + *ppv = thisInstance; + CFRelease(interfaceID); + return S_OK; + }else{ + /* Requested interface unknown, bail with error. */ + *ppv = NULL; + CFRelease(interfaceID); + return E_NOINTERFACE; + } +} + +// ----------------------------------------------------------------------------- +// QuickLookGeneratorPluginAddRef +// ----------------------------------------------------------------------------- +// Implementation of reference counting for this type. Whenever an interface +// is requested, bump the refCount for the instance. NOTE: returning the +// refcount is a convention but is not required so don't rely on it. +// +ULONG QuickLookGeneratorPluginAddRef(void *thisInstance) +{ + ((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1; + return ((QuickLookGeneratorPluginType*) thisInstance)->refCount; +} + +// ----------------------------------------------------------------------------- +// QuickLookGeneratorPluginRelease +// ----------------------------------------------------------------------------- +// When an interface is released, decrement the refCount. +// If the refCount goes to zero, deallocate the instance. +// +ULONG QuickLookGeneratorPluginRelease(void *thisInstance) +{ + ((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1; + if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){ + DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance ); + return 0; + }else{ + return ((QuickLookGeneratorPluginType*) thisInstance )->refCount; + } +} + +// ----------------------------------------------------------------------------- +// QuickLookGeneratorPluginFactory +// ----------------------------------------------------------------------------- +void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) +{ + QuickLookGeneratorPluginType *result; + CFUUIDRef uuid; + + /* If correct type is being requested, allocate an + * instance of kQLGeneratorTypeID and return the IUnknown interface. + */ + if (CFEqual(typeID,kQLGeneratorTypeID)){ + uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); + result = AllocQuickLookGeneratorPluginType(uuid); + CFRelease(uuid); + return result; + } + /* If the requested type is incorrect, return NULL. */ + return NULL; +} + diff --git a/src/MacVim/vimrc b/src/MacVim/vimrc index e38e079d64..8bb98bdc3d 100644 --- a/src/MacVim/vimrc +++ b/src/MacVim/vimrc @@ -1,15 +1,288 @@ -" System vimrc file for MacVim +set nocompatible +scriptencoding utf-8 + +" Python2 +" MacVim uses Homebrew python2 if installed, otherwise configured one +if exists("&pythondll") && exists("&pythonhome") + if filereadable("/usr/local/Frameworks/Python.framework/Versions/2.7/Python") + " Homebrew python 2.7 + set pythondll=/usr/local/Frameworks/Python.framework/Versions/2.7/Python + set pythonhome=/usr/local/Frameworks/Python.framework/Versions/2.7 + endif +endif + +" Python3 +" MacVim uses Homebrew python3 if installed, next try to use python.org binary +if exists("&pythonthreedll") && exists("&pythonthreehome") && + \ !filereadable(&pythonthreedll) + if filereadable("/Library/Frameworks/Python.framework/Versions/3.6/Python") + " https://www.python.org/downloads/mac-osx/ + set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.6/Python + set pythonthreehome=/Library/Frameworks/Python.framework/Versions/3.6 + endif +endif + +" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照) +" +" An example for a Japanese version vimrc file. +" 日本語版のデフォルト設定ファイル(vimrc) - Vim 7.4 +" +" Last Change: 23-Mar-2016. +" Maintainer: MURAOKA Taro <koron.kaoriya@gmail.com> " -" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com> -" Last Change: Sat Aug 29 2009 +" 解説: +" このファイルにはVimの起動時に必ず設定される、編集時の挙動に関する設定が書 +" かれています。GUIに関する設定はgvimrcに書かかれています。 +" +" 個人用設定は_vimrcというファイルを作成しそこで行ないます。_vimrcはこのファ +" イルの後に読込まれるため、ここに書かれた内容を上書きして設定することが出来 +" ます。_vimrcは$HOMEまたは$VIMに置いておく必要があります。$HOMEは$VIMよりも +" 優先され、$HOMEでみつかった場合$VIMは読込まれません。 +" +" 管理者向けに本設定ファイルを直接書き換えずに済ませることを目的として、サイ +" トローカルな設定を別ファイルで行なえるように配慮してあります。Vim起動時に +" サイトローカルな設定ファイル($VIM/vimrc_local.vim)が存在するならば、本設定 +" ファイルの主要部分が読み込まれる前に自動的に読み込みます。 +" +" 読み込み後、変数g:vimrc_local_finishが非0の値に設定されていた場合には本設 +" 定ファイルに書かれた内容は一切実行されません。デフォルト動作を全て差し替え +" たい場合に利用して下さい。 +" +" 参考: +" :help vimrc +" :echo $HOME +" :echo $VIM +" :version -set nocompatible +"--------------------------------------------------------------------------- +" サイトローカルな設定($VIM/vimrc_local.vim)があれば読み込む。読み込んだ後に +" 変数g:vimrc_local_finishに非0な値が設定されていた場合には、それ以上の設定 +" ファイルの読込を中止する。 +if 1 && filereadable($VIM . '/vimrc_local.vim') + unlet! g:vimrc_local_finish + source $VIM/vimrc_local.vim + if exists('g:vimrc_local_finish') && g:vimrc_local_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" ユーザ優先設定($HOME/.vimrc_first.vim)があれば読み込む。読み込んだ後に変数 +" g:vimrc_first_finishに非0な値が設定されていた場合には、それ以上の設定ファ +" イルの読込を中止する。 +if 1 && exists('$HOME') && filereadable($HOME . '/.vimrc_first.vim') + unlet! g:vimrc_first_finish + source $HOME/.vimrc_first.vim + if exists('g:vimrc_first_finish') && g:vimrc_first_finish != 0 + finish + endif +endif + +" plugins下のディレクトリをruntimepathへ追加する。 +for s:path in split(glob($VIM.'/plugins/*'), '\n') + if s:path !~# '\~$' && isdirectory(s:path) + let &runtimepath = &runtimepath.','.s:path + end +endfor +unlet s:path + +"--------------------------------------------------------------------------- +" 日本語対応のための設定: +" +" ファイルを読込む時にトライする文字エンコードの順序を確定する。漢字コード自 +" 動判別機能を利用する場合には別途iconv.dllが必要。iconv.dllについては +" README_w32j.txtを参照。ユーティリティスクリプトを読み込むことで設定される。 +source $VIM/plugins/kaoriya/encode_japan.vim +" メッセージを日本語にする (Windowsでは自動的に判断・設定されている) +if !(has('win32') || has('mac')) && has('multi_lang') + if !exists('$LANG') || $LANG.'X' ==# 'X' + if !exists('$LC_CTYPE') || $LC_CTYPE.'X' ==# 'X' + language ctype ja_JP.eucJP + endif + if !exists('$LC_MESSAGES') || $LC_MESSAGES.'X' ==# 'X' + language messages ja_JP.eucJP + endif + endif +endif +" MacOS Xメニューの日本語化 (メニュー表示前に行なう必要がある) +if has('mac') + set encoding=utf-8 + set ambiwidth=double + if exists('$LANG') && $LANG ==# 'ja_JP.UTF-8' + set langmenu=ja_ja.utf-8.macvim + endif +endif +" 日本語入力用のkeymapの設定例 (コメントアウト) +if has('keymap') + " ローマ字仮名のkeymap + "silent! set keymap=japanese + "set iminsert=0 imsearch=0 +endif +" 非GUI日本語コンソールを使っている場合の設定 +if !has('gui_running') && &encoding != 'cp932' && &term == 'win32' + set termencoding=cp932 +endif + +"--------------------------------------------------------------------------- +" メニューファイルが存在しない場合は予め'guioptions'を調整しておく +if 1 && !filereadable($VIMRUNTIME . '/menu.vim') && has('gui_running') + set guioptions+=M +endif + +"--------------------------------------------------------------------------- +" Bram氏の提供する設定例をインクルード (別ファイル:vimrc_example.vim)。これ +" 以前にg:no_vimrc_exampleに非0な値を設定しておけばインクルードはしない。 +if 1 && (!exists('g:no_vimrc_example') || g:no_vimrc_example == 0) + if &guioptions !~# "M" + " vimrc_example.vimを読み込む時はguioptionsにMフラグをつけて、syntax on + " やfiletype plugin onが引き起こすmenu.vimの読み込みを避ける。こうしない + " とencに対応するメニューファイルが読み込まれてしまい、これの後で読み込 + " まれる.vimrcでencが設定された場合にその設定が反映されずメニューが文字 + " 化けてしまう。 + set guioptions+=M + source $VIMRUNTIME/vimrc_example.vim + set guioptions-=M + else + source $VIMRUNTIME/vimrc_example.vim + endif +endif + +"--------------------------------------------------------------------------- +" 検索の挙動に関する設定: +" +" 検索時に大文字小文字を無視 (noignorecase:無視しない) +set ignorecase +" 大文字小文字の両方が含まれている場合は大文字小文字を区別 +set smartcase + +"--------------------------------------------------------------------------- +" 編集に関する設定: +" +" タブの画面上での幅 +set tabstop=8 +" タブをスペースに展開しない (expandtab:展開する) +set noexpandtab +" 自動的にインデントする (noautoindent:インデントしない) +set autoindent +" バックスペースでインデントや改行を削除できるようにする +set backspace=indent,eol,start +" 検索時にファイルの最後まで行ったら最初に戻る (nowrapscan:戻らない) +set wrapscan +" 括弧入力時に対応する括弧を表示 (noshowmatch:表示しない) +set showmatch +" コマンドライン補完するときに強化されたものを使う(参照 :help wildmenu) +set wildmenu +" テキスト挿入中の自動折り返しを日本語に対応させる +set formatoptions+=mM + +"--------------------------------------------------------------------------- +" GUI固有ではない画面表示の設定: +" +" 行番号を非表示 (number:表示) +set nonumber +" ルーラーを表示 (noruler:非表示) +set ruler +" タブや改行を表示 (list:表示) +set nolist +" どの文字でタブや改行を表示するかを設定 +"set listchars=tab:>-,extends:<,trail:-,eol:< +" 長い行を折り返して表示 (nowrap:折り返さない) +set wrap +" 常にステータス行を表示 (詳細は:he laststatus) +set laststatus=2 +" コマンドラインの高さ (Windows用gvim使用時はgvimrcを編集すること) +set cmdheight=2 +" コマンドをステータス行に表示 +set showcmd +" タイトルを表示 +set title +" 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる) +"colorscheme evening " (Windows用gvim使用時はgvimrcを編集すること) + +"--------------------------------------------------------------------------- +" ファイル操作に関する設定: +" +" バックアップファイルを作成しない (次行の先頭の " を削除すれば有効になる) +"set nobackup + + +"--------------------------------------------------------------------------- +" ファイル名に大文字小文字の区別がないシステム用の設定: +" (例: DOS/Windows/MacOS) +" +if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC') + " tagsファイルの重複防止 + set tags=./tags,tags +endif + +"--------------------------------------------------------------------------- +" コンソールでのカラー表示のための設定(暫定的にUNIX専用) +if has('unix') && !has('gui_running') && !has('gui_macvim') + let s:uname = system('uname') + if s:uname =~? "linux" + set term=builtin_linux + elseif s:uname =~? "freebsd" + set term=builtin_cons25 + elseif s:uname =~? "Darwin" + set term=beos-ansi + else + set term=builtin_xterm + endif + unlet s:uname +endif + +"--------------------------------------------------------------------------- +" コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応 +if !has('gui_running') && has('xterm_clipboard') + set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen +endif + +"--------------------------------------------------------------------------- +" プラットホーム依存の特別な設定 + +" WinではPATHに$VIMが含まれていないときにexeを見つけ出せないので修正 +if has('win32') && $PATH !~? '\(^\|;\)' . escape($VIM, '\\') . '\(;\|$\)' + let $PATH = $VIM . ';' . $PATH +endif + +if has('mac') + " Macではデフォルトの'iskeyword'がcp932に対応しきれていないので修正 + set iskeyword=@,48-57,_,128-167,224-235 +endif + +"--------------------------------------------------------------------------- +" KaoriYaでバンドルしているプラグインのための設定 + +" autofmt: 日本語文章のフォーマット(折り返し)プラグイン. +set formatexpr=autofmt#japanese#formatexpr() + +" vimdoc-ja: 日本語ヘルプを無効化する. +if kaoriya#switch#enabled('disable-vimdoc-ja') + let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]vimdoc-ja"'), ',') +endif + +" vimproc: 同梱のvimprocを無効化する +"if kaoriya#switch#enabled('disable-vimproc') +" let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]vimproc$"'), ',') +"endif + +" go-extra: 同梱の vim-go-extra を無効化する +if kaoriya#switch#enabled('disable-go-extra') + let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]golang$"'), ',') +endif + +" Copyright (C) 2009-2016 KaoriYa/MURAOKA Taro + + +"--------------------------------------------------------------------------- +" MacVim-KaoriYa固有の設定 -" The default for 'backspace' is very confusing to new users, so change it to a -" more sensible value. Add "set backspace&" to your ~/.vimrc to reset it. -set backspace+=indent,eol,start +" migemo: +let $PATH = simplify($VIM . '/../../MacOS') . ':' . $PATH +set migemodict=$VIMRUNTIME/dict/migemo-dict +set migemo -" Disable localized menus for now since only some items are translated (e.g. -" the entire MacVim menu is set up in a nib file which currently only is -" translated to English). -set langmenu=none +" 印刷に関する設定: +set printmbfont=r:HiraMinProN-W3,b:HiraMinProN-W6 +set printencoding=utf-8 +set printmbcharset=UniJIS diff --git a/src/Make_bc3.mak b/src/Make_bc3.mak deleted file mode 100644 index 54c42acc6a..0000000000 --- a/src/Make_bc3.mak +++ /dev/null @@ -1,179 +0,0 @@ -# Makefile for Borland C++ 3.1 or 4.0 to compile a 16 bit version of Vim. -# -# There are compilation options at the end of this file. -# -# Command line variables: -# BOR path to root of Borland C (E:\BORLANDC) -# DEBUG set to "yes" for debugging (no) -# SPAWNO path to the spawno library directory, empty if you do not have -# it; use 8.3 filenames! (C:\CC\SPAWN) - -.AUTODEPEND - -!ifndef BOR -BOR = E:\BORLANDC -!endif - -!if ("$(DEBUG)" == "yes") -DEBUG_FLAG = -v -!else -DEBUG_FLAG = -!endif - -CC = $(BOR)\bin\bcc.exe +VIM.CFG -TLINK = $(BOR)\bin\tlink.exe - -!ifndef SPAWNO -SPAWNO = C:\CC\SPAWN -!endif - -!if ("$(SPAWNO)" == "") -LIBPATH = $(BOR)\LIB -INCLUDEPATH = $(BOR)\INCLUDE -SPAWND = -SPAWNL = -!else -LIBPATH = $(BOR)\LIB;$(SPAWNO) -INCLUDEPATH = $(BOR)\INCLUDE;$(SPAWNO) -SPAWND = ;SPAWNO -SPAWNL = spawnl.lib -!endif - - -# *Implicit Rules* -# -# use -v for debugging -# -.c.obj: - $(CC) -c $(DEBUG_FLAG) {$< } - -# *List Macros* - - -EXE_dependencies = \ - blowfish.obj \ - buffer.obj \ - charset.obj \ - diff.obj \ - digraph.obj \ - edit.obj \ - eval.obj \ - ex_cmds.obj \ - ex_cmds2.obj \ - ex_docmd.obj \ - ex_eval.obj \ - ex_getln.obj \ - fileio.obj \ - fold.obj \ - getchar.obj \ - hardcopy.obj \ - hashtab.obj \ - main.obj \ - mark.obj \ - memfile.obj \ - memline.obj \ - menu.obj \ - message.obj \ - misc1.obj \ - misc2.obj \ - move.obj \ - os_msdos.obj \ - normal.obj \ - ops.obj \ - option.obj \ - popupmnu.obj \ - quickfix.obj \ - regexp.obj \ - screen.obj \ - search.obj \ - sha256.obj \ - spell.obj \ - syntax.obj \ - tag.obj \ - term.obj \ - ui.obj \ - undo.obj \ - window.obj - -all: vim.exe install.exe uninstal.exe xxd/xxd.exe - -# *Explicit Rules* - -vim.exe: vim.cfg $(EXE_dependencies) version.c - $(CC) $(DEBUG_FLAG) -c version.c - $(TLINK) /x/c/L$(LIBPATH) $(DEBUG_FLAG) @&&| -c0l.obj $(EXE_dependencies) version.obj -vim - # no map file -$(SPAWNL) cl.lib -| - -install.exe: dosinst.c - $(CC) -einstall $(DEBUG_FLAG) dosinst.c - -uninstal.exe: uninstal.c - $(CC) $(DEBUG_FLAG) uninstal.c - -# This may fail for older make versions, building xxd will fail anyway then. -xxd/xxd.exe: xxd/xxd.c - cd xxd - $(MAKE) -f Make_bc3.mak BOR=$(BOR) DEBUG=$(DEBUG) - cd .. - -# cleaning up: Delete all generated files -clean: - -del *.obj - -del vim.exe - -del vim.sym - -del install.exe - -del uninstal.exe - -del xxd\*.obj - -del xxd\xxd.exe - -del vim.cfg - -del testdir\*.out - -# Individual File Dependencies (incomplete) -ex_docmd.obj: ex_docmd.c ex_cmds.h - -ex_eval.obj: ex_eval.c ex_cmds.h - -main.obj: main.c globals.h option.h - -term.obj: term.c term.h - -version.obj: version.c version.h - - -# Compiler Configuration File -# -# The following compile options can be changed for better machines. -# replace -1- with -2 to produce code for a 80286 or higher -# replace -1- with -3 to produce code for a 80386 or higher -# add -v for source debugging -vim.cfg: Make_bc3.mak - copy &&| --ml --1- --f- --C --N --O --Z --k- --d --h --vi- --H=VIM.SYM --w-par --weas --wpre --Iproto --I$(INCLUDEPATH) --L$(LIBPATH) --DMSDOS;FEAT_TINY$(SPAWND) -| vim.cfg - -test: - cd testdir - $(MAKE) -f Make_dos.mak small - cd .. diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 5769bd64ba..f0b91272f9 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -1,10 +1,13 @@ # # Makefile for Vim. # Compiler: Borland C++ 5.0 and later 32-bit compiler -# Targets: Dos16 or Win32 (Windows NT and Windows 95) (with/without GUI) +# Targets: Win32 (Windows NT and Windows 95) (with/without GUI) +# +# NOTE: THIS IS OLD AND PROBABLY NO LONGER WORKS. # # Contributed by Ben Singer. # Updated 4/1997 by Ron Aaron +# 2016: removed support for 16 bit DOS # 6/1997 - added support for 16 bit DOS # Note: this has been tested, and works, for BC5. Your mileage may vary. # Has been reported NOT to work with BC 4.52. Maybe it can be fixed? @@ -32,8 +35,7 @@ # name value (default) # # BOR path to root of Borland C install (c:\bc5) -# LINK name of the linker ($(BOR)\bin\ilink if OSTYPE is DOS16, -# $(BOR)\bin\ilink32 otherwise) +# LINK name of the linker ($(BOR)\bin\ilink32) # GUI no or yes: set to yes if you want the GUI version (yes) # LUA define to path to Lua dir to get Lua support (not defined) # LUA_VER define to version of Lua being used (51) @@ -68,7 +70,6 @@ # GETTEXT no or yes: set to yes for multi-language support (yes) # ICONV no or yes: set to yes for dynamic iconv support (yes) # OLE no or yes: set to yes to make OLE gvim (no) -# OSTYPE DOS16 or WIN32 (WIN32) # DEBUG no or yes: set to yes if you wish a DEBUGging build (no) # CODEGUARD no or yes: set to yes if you want to use CODEGUARD (no) # CPUNR 1 through 6: select -CPU argument to compile with (3) @@ -76,17 +77,19 @@ # USEDLL no or yes: set to yes to use the Runtime library DLL (no) # For USEDLL=yes the cc3250.dll is required to run Vim. # VIMDLL no or yes: create vim32.dll, and stub (g)vim.exe (no) -# ALIGN 1, 2 or 4: Alignment to use (4 for Win32, 2 for DOS16) +# ALIGN 1, 2 or 4: Alignment to use (4 for Win32) # FASTCALL no or yes: set to yes to use register-based function protocol (yes) # OPTIMIZE SPACE, SPEED, or MAXSPEED: type of optimization (MAXSPEED) # POSTSCRIPT no or yes: set to yes for PostScript printing -# FEATURES TINY, SMALL, NORMAL, BIG or HUGE -# (BIG for WIN32, SMALL for DOS16) +# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32) # WINVER 0x0400 or 0x0500: minimum Win32 version to support (0x0400) # CSCOPE no or yes: include support for Cscope interface (yes) -# NETBEANS no or yes: include support for Netbeans interface (yes if GUI +# NETBEANS no or yes: include support for Netbeans interface; also +# requires CHANNEL (yes if GUI # is yes) # NBDEBUG no or yes: include support for debugging Netbeans interface (no) +# CHANNEL no or yes: include support for inter process communication (yes +# if GUI is yes) # XPM define to path to XPM dir to get support for loading XPM images. ### BOR: root of the BC installation @@ -94,8 +97,7 @@ BOR = c:\bc5 !endif -### LINK: Name of the linker: tlink or ilink32 (this is below, depends on -# $(OSTYPE) +### LINK: Name of the linker: ilink32 (this is below) ### GUI: yes for GUI version, no for console version !if ("$(GUI)"=="") @@ -135,6 +137,11 @@ CSCOPE = yes NETBEANS = yes !endif +### CHANNEL: yes to enable inter process communication, no to disable it +!if ("$(CHANNEL)"=="") && ("$(GUI)"=="yes") +CHANNEL = yes +!endif + ### LUA: uncomment this line if you want lua support in vim # LUA=c:\lua @@ -156,12 +163,6 @@ NETBEANS = yes ### OLE: no for normal gvim, yes for OLE-capable gvim (only works with GUI) #OLE = yes -### OSTYPE: DOS16 for Windows 3.1 version, WIN32 for Windows 95/98/NT/2000 -# version -!if ("$(OSTYPE)"=="") -OSTYPE = WIN32 -!endif - ### DEBUG: Uncomment to make an executable for debugging # DEBUG = yes !if ("$(DEBUG)"=="yes") @@ -198,14 +199,10 @@ USEDLL = no ### VIMDLL: yes for a DLL version of VIM (NOT RECOMMENDED), no otherwise #VIMDLL = yes -### ALIGN: alignment you desire: (1,2 or 4: s/b 4 for Win32, 2 for DOS) +### ALIGN: alignment you desire: (1,2 or 4: s/b 4 for Win32) !if ("$(ALIGN)"=="") -!if ($(OSTYPE)==DOS16) -ALIGN = 2 -!else ALIGN = 4 !endif -!endif ### FASTCALL: yes to use FASTCALL calling convention (RECOMMENDED!), no otherwise # Incompatible when calling external functions (like MSVC-compiled DLLs), so @@ -229,13 +226,9 @@ FASTCALL = yes OPTIMIZE = MAXSPEED !endif -### FEATURES: TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32, SMALL for DOS16) +### FEATURES: TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32) !if ("$(FEATURES)"=="") -! if ($(OSTYPE)==DOS16) -FEATURES = SMALL -! else FEATURES = BIG -! endif !endif ### POSTSCRIPT: uncomment this line if you want PostScript printing @@ -256,24 +249,7 @@ WINVER = 0x0400 # Sanity checks for the above options: # -!if ($(OSTYPE)==DOS16) -!if (($(CPUNR)+0)>4) -!error CPUNR Must be less than or equal to 4 for DOS16 -!endif - -!if (($(ALIGN)+0)>2) -!error ALIGN Must be less than or equal to 2 for DOS16 -!endif - -!else # not DOS16 -!if (($(CPUNR)+0)<3) -!error CPUNR Must be greater or equal to 3 for WIN32 -!endif -!endif - -!if ($(OSTYPE)!=WIN32) && ($(OSTYPE)!=DOS16) -!error Check the OSTYPE variable again: $(OSTYPE) is not supported! -!endif +OSTYPE = WIN32 # # Optimizations: change as desired (RECOMMENDATION: Don't change!): @@ -295,11 +271,6 @@ OPT = $(OPT) -pr OPT = $(OPT) -vi- !endif !endif -!if ($(OSTYPE)==DOS16) -!undef GUI -!undef VIMDLL -!undef USEDLL -!endif # shouldn't have to change: LIB = $(BOR)\lib INCLUDE = $(BOR)\include;.;proto @@ -464,6 +435,7 @@ LINK2 = -aa RESFILE = vim.res !else !undef NETBEANS +!undef CHANNEL !undef XPM !undef VIMDLL !if ("$(DEBUG)"=="yes") @@ -472,26 +444,28 @@ TARGET = vimd.exe # for now, anyway: VIMDLL is only for the GUI version TARGET = vim.exe !endif -!if ($(OSTYPE)==DOS16) -DEFINES= -DFEAT_$(FEATURES) -DMSDOS -EXETYPE=-ml -STARTUPOBJ = c0l.obj -LINK2 = -!else EXETYPE=-WC STARTUPOBJ = c0x32.obj LINK2 = -ap -OS -o -P -!endif RESFILE = vim.res !endif !if ("$(NETBEANS)"=="yes") +!if ("$(CHANNEL)"!="yes") +# cannot use Netbeans without CHANNEL +NETBEANS = no +!else DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG !if ("$(NBDEBUG)"=="yes") DEFINES = $(DEFINES) -DNBDEBUG NBDEBUG_DEP = nbdebug.h nbdebug.c !endif !endif +!endif + +!if ("$(CHANNEL)"=="yes") +DEFINES = $(DEFINES) -DFEAT_JOB_CHANNEL +!endif !ifdef XPM !if ("$(GUI)"=="yes") @@ -525,16 +499,6 @@ DEFINES = $(DEFINES) -DMSWINPS ##### BASE COMPILER/TOOLS RULES ##### MAKE = $(BOR)\bin\make CFLAGS = -w-aus -w-par -w-pch -w-ngu -w-csu -I$(INCLUDE) -!if ($(OSTYPE)==DOS16) -BRC = -!if ("$(LINK)"=="") -LINK = $(BOR)\BIN\TLink -!endif -CC = $(BOR)\BIN\Bcc -LFLAGS = -Tde -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2) -LFLAGSDLL = -CFLAGS = $(CFLAGS) -H- $(HEADERS) -!else BRC = $(BOR)\BIN\brc32 !if ("$(LINK)"=="") LINK = $(BOR)\BIN\ILink32 @@ -543,7 +507,6 @@ CC = $(BOR)\BIN\Bcc32 LFLAGS = -OS -Tpe -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2) LFLAGSDLL = -Tpd -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2) CFLAGS = $(CFLAGS) -d -RT- -k- -Oi $(HEADERS) -f- -!endif CC1 = -c CC2 = -o @@ -563,8 +526,6 @@ CCARG = +$(OBJDIR)\bcc.cfg .cpp.obj: $(CC) $(CCARG) $(CC1) $(CC2)$@ $*.cpp -!if ($(OSTYPE)==DOS16) -!else # win32: vimmain = \ $(OBJDIR)\os_w32exe.obj !if ("$(VIMDLL)"=="yes") @@ -574,26 +535,33 @@ vimwinmain = \ vimwinmain = \ $(OBJDIR)\os_w32exe.obj !endif -!endif vimobj = \ + $(OBJDIR)\arabic.obj \ $(OBJDIR)\blowfish.obj \ $(OBJDIR)\buffer.obj \ $(OBJDIR)\charset.obj \ + $(OBJDIR)\crypt.obj \ + $(OBJDIR)\crypt_zip.obj \ + $(OBJDIR)\dict.obj \ $(OBJDIR)\diff.obj \ $(OBJDIR)\digraph.obj \ $(OBJDIR)\edit.obj \ $(OBJDIR)\eval.obj \ + $(OBJDIR)\evalfunc.obj \ $(OBJDIR)\ex_cmds.obj \ $(OBJDIR)\ex_cmds2.obj \ $(OBJDIR)\ex_docmd.obj \ $(OBJDIR)\ex_eval.obj \ $(OBJDIR)\ex_getln.obj \ + $(OBJDIR)\farsi.obj \ $(OBJDIR)\fileio.obj \ $(OBJDIR)\fold.obj \ $(OBJDIR)\getchar.obj \ $(OBJDIR)\hardcopy.obj \ $(OBJDIR)\hashtab.obj \ + $(OBJDIR)\json.obj \ + $(OBJDIR)\list.obj \ $(OBJDIR)\main.obj \ $(OBJDIR)\mark.obj \ $(OBJDIR)\memfile.obj \ @@ -614,11 +582,13 @@ vimobj = \ $(OBJDIR)\search.obj \ $(OBJDIR)\sha256.obj \ $(OBJDIR)\spell.obj \ + $(OBJDIR)\spellfile.obj \ $(OBJDIR)\syntax.obj \ $(OBJDIR)\tag.obj \ $(OBJDIR)\term.obj \ $(OBJDIR)\ui.obj \ $(OBJDIR)\undo.obj \ + $(OBJDIR)\userfunc.obj \ $(OBJDIR)\version.obj \ $(OBJDIR)\window.obj \ $(OBJDIR)\pathdef.obj @@ -668,6 +638,11 @@ vimobj = $(vimobj) \ $(OBJDIR)\netbeans.obj !endif +!if ("$(CHANNEL)"=="yes") +vimobj = $(vimobj) \ + $(OBJDIR)\channel.obj +!endif + !ifdef XPM vimobj = $(vimobj) \ $(OBJDIR)\xpm_w32.obj @@ -692,13 +667,8 @@ vimobj = $(vimobj) \ $(OBJDIR)\gui_w32.obj !endif -!if ($(OSTYPE)==WIN32) vimobj = $(vimobj) \ $(OBJDIR)\os_win32.obj $(OBJDIR)\os_mswin.obj $(OBJDIR)\winclip.obj -!elif ($(OSTYPE)==DOS16) -vimobj = $(vimobj) \ - $(OBJDIR)\os_msdos.obj -!endif # Blab what we are going to do: MSG = Compiling $(OSTYPE) $(TARGET) $(OLETARGET), with: !if ("$(GUI)"=="yes") @@ -743,6 +713,9 @@ MSG = $(MSG) CSCOPE !if ("$(NETBEANS)"=="yes") MSG = $(MSG) NETBEANS !endif +!if ("$(CHANNEL)"=="yes") +MSG = $(MSG) CHANNEL +!endif !ifdef XPM MSG = $(MSG) XPM !endif @@ -787,14 +760,10 @@ MSG = $(MSG) Align=$(ALIGNARG) !message $(MSG) -!if ($(OSTYPE)==DOS16) -TARGETS = $(TARGET) -!else !if ("$(VIMDLL)"=="yes") TARGETS = $(DLLTARGET) !endif TARGETS = $(TARGETS) $(TARGET) -!endif # Targets: all: vim vimrun.exe install.exe xxd uninstal.exe GvimExt/gvimext.dll @@ -820,18 +789,10 @@ GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h cd .. install.exe: dosinst.c $(OBJDIR)\bcc.cfg -!if ($(OSTYPE)==WIN32) $(CC) $(CCARG) -WC -DWIN32 -einstall dosinst.c -!else - $(CC) $(CCARG) -WC -einstall dosinst.c -!endif uninstal.exe: uninstal.c $(OBJDIR)\bcc.cfg -!if ($(OSTYPE)==WIN32) $(CC) $(CCARG) -WC -DWIN32 -O2 -euninstal uninstal.c -!else - $(CC) $(CCARG) -WC -O2 -euninstal uninstal.c -!endif clean: !if "$(OS)" == "Windows_NT" @@ -892,10 +853,7 @@ $(DLLTARGET): $(OBJDIR) $(vimdllobj) cg32.lib+ !endif # $(OSTYPE)==WIN32 causes os_mswin.c compilation. FEAT_SHORTCUT in it needs OLE -!if ("$(OLE)"=="yes" || $(OSTYPE)==WIN32) ole2w32.lib + -!endif -!if ($(OSTYPE)==WIN32) import32.lib+ !ifdef LUA $(LUA_LIB_FLAG)lua.lib+ @@ -924,9 +882,6 @@ $(DLLTARGET): $(OBJDIR) $(vimdllobj) cw32.lib !endif vim.def -!else - cl.lib -!endif | !if ("$(VIMDLL)"=="yes") @@ -943,14 +898,11 @@ $(TARGET): $(OBJDIR) $(vimobj) $(OBJDIR)\$(RESFILE) $(vimobj) !endif $<,$* -!if ($(OSTYPE)==WIN32) !if ("$(CODEGUARD)"=="yes") cg32.lib+ !endif # $(OSTYPE)==WIN32 causes os_mswin.c compilation. FEAT_SHORTCUT in it needs OLE -!if ("$(OLE)"=="yes" || $(OSTYPE)==WIN32) ole2w32.lib + -!endif import32.lib+ !ifdef LUA $(LUA_LIB_FLAG)lua.lib+ @@ -980,9 +932,6 @@ $(TARGET): $(OBJDIR) $(vimobj) $(OBJDIR)\$(RESFILE) !endif $(OBJDIR)\$(RESFILE) -!else - emu.lib + cl.lib -!endif | test: @@ -1024,6 +973,9 @@ $(OBJDIR)\xpm_w32.obj: xpm_w32.c xpm.lib $(OBJDIR)\netbeans.obj: netbeans.c $(NBDEBUG_DEP) $(CC) $(CCARG) $(CC1) $(CC2)$@ netbeans.c +$(OBJDIR)\channel.obj: channel.c + $(CC) $(CCARG) $(CC1) $(CC2)$@ channel.c + $(OBJDIR)\vim.res: vim.rc version.h tools.bmp tearoff.bmp \ vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico $(BRC) -fo$(OBJDIR)\vim.res -i $(BOR)\include -w32 -r vim.rc @&&| diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index f349798078..8c1b60e278 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,710 +1,54 @@ # -# Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2013 Dec 11 +# Makefile for VIM on Win32, using MinGW cross compiler on Cygwin # # Also read INSTALLpc.txt! # # This compiles Vim as a Windows application. If you want Vim to run as a # Cygwin application use the Makefile (just like on Unix). # -# GUI no or yes: set to yes if you want the GUI version (yes) -# PERL define to path to Perl dir to get Perl support (not defined) -# PERL_VER define to version of Perl being used (56) -# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes) -# PYTHON define to path to Python dir to get PYTHON support (not defined) -# PYTHON_VER define to version of Python being used (22) -# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes) -# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined) -# PYTHON3_VER define to version of Python3 being used (22) -# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes) -# TCL define to path to TCL dir to get TCL support (not defined) -# TCL_VER define to version of TCL being used (83) -# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes) -# RUBY define to path to Ruby dir to get Ruby support (not defined) -# RUBY_VER define to version of Ruby being used (16) -# RUBY_VER_LONG same, but in format with dot. (1.6) -# You must set RUBY_VER_LONG when changing RUBY_VER. -# You must set RUBY_API_VER version to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. -# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes) -# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined) -# MZSCHEME_VER define to version of MzScheme being used (209_000) -# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes) -# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build. -# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch". -# LUA define to path to Lua dir to get Lua support (not defined) -# LUA_VER define to version of Lua being used (51) -# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes) -# GETTEXT no or yes: set to yes for dynamic gettext support (yes) -# ICONV no or yes: set to yes for dynamic iconv support (yes) -# MBYTE no or yes: set to yes to include multibyte support (yes) -# IME no or yes: set to yes to include IME support (yes) -# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes) -# OLE no or yes: set to yes to make OLE gvim (no) -# DEBUG no or yes: set to yes if you wish a DEBUGging build (no) -# CPUNR No longer supported, use ARCH. -# ARCH i386 through pentium4: select -march argument to compile with -# (i386) -# USEDLL no or yes: set to yes to use the Runtime library DLL (no) -# For USEDLL=yes the cygwin1.dll is required to run Vim. -# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++ -# package is required to compile Vim. Or set CC to gcc-3 and add -# -L/lib/w32api to EXTRA_LIBS. -# POSTSCRIPT no or yes: set to yes for PostScript printing (no) -# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG) -# WINVER Lowest Win32 version to support. (0x0500) -# CSCOPE no or yes: to include cscope interface support (yes) -# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED) -# NETBEANS no or yes: to include netbeans interface support (yes when GUI -# is yes) -# NBDEBUG no or yes: to include netbeans interface debugging support (no) -# XPM define to path to XPM dir to get XPM image support (not defined) -#>>>>> choose options: -ifndef GUI -GUI=yes -endif - -ifndef FEATURES -FEATURES = BIG -endif - -ifndef GETTEXT -GETTEXT = yes -endif - -ifndef ICONV -ICONV = yes -endif - -ifndef MBYTE -MBYTE = yes -endif - -ifndef IME -IME = yes -endif +# The old Make_cyg.mak (maintained by Dan Sharp et al.) was merged into +# Make_cyg_ming.mak. Note: USEDLL option was removed. +# This file contains Cygwin specific settings. Common settings are contained +# in Make_cyg_ming.mak. +# +# Last updated by Ken Takata. +# Last Change: 2014 Oct 21 -ifndef ARCH -ARCH = i386 -endif -ifndef WINVER -WINVER = 0x0500 -endif +# uncomment 'PERL' if you want a perl-enabled version +#PERL=/cygdrive/c/perl -ifndef CSCOPE -CSCOPE = yes -endif +# uncomment 'LUA' if you want a Lua-enabled version +#LUA=/cygdrive/c/lua -ifndef NETBEANS -ifeq ($(GUI),yes) -NETBEANS = yes -endif -endif +# uncomment 'MZSCHEME' if you want a MzScheme-enabled version +#MZSCHEME=/cygdrive/d/plt -ifndef OPTIMIZE -OPTIMIZE = MAXSPEED -endif +# uncomment 'PYTHON' if you want a python-enabled version +#PYTHON=/cygdrive/c/python20 +# uncomment 'PYTHON3' if you want a python3-enabled version +#PYTHON3=/cygdrive/c/python31 -# Link against the shared version of libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static version instead. -ifndef STATIC_STDCPLUS -STATIC_STDCPLUS=no -endif +# uncomment 'TCL' if you want a Tcl-enabled version +#TCL=/cygdrive/c/tcl -### See feature.h for a list of optionals. -### Any other defines can be included here. +# uncomment 'RUBY' if you want a Ruby-enabled version +#RUBY=/cygdribe/c/ruby -DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \ - -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -ifeq ($(ARCH),x86-64) -DEFINES+=-DMS_WIN64 -endif -INCLUDES = -march=$(ARCH) -Iproto -#>>>>> name of the compiler and linker, name of lib directory -ifeq (yes, $(USEDLL)) -# CROSS_COMPILE is used for the gvimext DLL. +# Use MinGW(-w64) cross compiler. +# There are three MinGW packages in Cygwin: +# 32-bit: mingw-gcc-g++ and mingw64-i686-gcc-g++ +# 64-bit: mingw64-x86_64-gcc-g++ +# You may also need to set 'ARCH' in Make_cyg_ming.mak. CROSS_COMPILE = i686-pc-mingw32- -CC = gcc -RC = windres -else -# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used. -CROSS_COMPILE = i686-pc-mingw32- -CC = $(CROSS_COMPILE)gcc -RC = $(CROSS_COMPILE)windres -endif - -############################## -# DYNAMIC_PERL=yes and no both work -############################## -ifdef PERL -DEFINES += -DFEAT_PERL -INCLUDES += -I$(PERL)/lib/CORE -EXTRA_OBJS += $(OUTDIR)/if_perl.o - -ifndef DYNAMIC_PERL -DYNAMIC_PERL = yes -endif - -ifndef PERL_VER -PERL_VER = 56 -endif - -ifeq (yes, $(DYNAMIC_PERL)) -DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" -else -EXTRA_LIBS += -L$(PERL)/lib/CORE -lperl$(PERL_VER) -endif -endif - -############################## -# DYNAMIC_PYTHON=yes works. -# DYNAMIC_PYTHON=no does not (unresolved externals on link). -############################## -ifdef PYTHON -DEFINES += -DFEAT_PYTHON -EXTRA_OBJS += $(OUTDIR)/if_python.o - -ifndef DYNAMIC_PYTHON -DYNAMIC_PYTHON = yes -endif - -ifndef PYTHON_VER -PYTHON_VER = 22 -endif - -ifeq (yes, $(DYNAMIC_PYTHON)) -DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" -else -EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib -endif -endif - -############################## -# DYNAMIC_PYTHON3=yes works. -# DYNAMIC_PYTHON3=no does not (unresolved externals on link). -############################## -ifdef PYTHON3 -DEFINES += -DFEAT_PYTHON3 -EXTRA_OBJS += $(OUTDIR)/if_python3.o - -ifndef DYNAMIC_PYTHON3 -DYNAMIC_PYTHON3 = yes -endif - -ifndef PYTHON3_VER -PYTHON3_VER = 31 -endif - -ifeq (yes, $(DYNAMIC_PYTHON3)) -DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\" -else -EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib -endif -endif - -############################## -# DYNAMIC_RUBY=yes works. -# DYNAMIC_RUBY=no does not (process exits). -############################## -ifdef RUBY - -ifndef DYNAMIC_RUBY -DYNAMIC_RUBY=yes -endif -# Set default value -ifndef RUBY_VER -RUBY_VER = 16 -endif -ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.6 -endif -ifndef RUBY_API_VER -RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG)) -endif - -ifndef RUBY_PLATFORM -ifeq ($(RUBY_VER), 16) -RUBY_PLATFORM = i586-mswin32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),) -RUBY_PLATFORM = i386-mingw32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),) -RUBY_PLATFORM = x64-mingw32 -else -RUBY_PLATFORM = i386-mswin32 -endif -endif -endif -endif - -ifndef RUBY_INSTALL_NAME -ifeq ($(RUBY_VER), 16) -RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -else -ifeq ($(ARCH),x86-64) -RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER) -else -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) -endif -endif -endif - -ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) -RUBY_19_OR_LATER = 1 -endif - -DEFINES += -DFEAT_RUBY -ifneq ($(findstring w64-mingw32,$(CC)),) -# A workaround for mingw-w64 -DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE -endif -INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -ifdef RUBY_19_OR_LATER -INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -endif -EXTRA_OBJS += $(OUTDIR)/if_ruby.o - -ifeq (yes, $(DYNAMIC_RUBY)) -DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER) -else -EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME) -endif -endif - -############################## -# DYNAMIC_MZSCHEME=yes works -# DYNAMIC_MZSCHEME=no works too -############################## -ifdef MZSCHEME -DEFINES += -DFEAT_MZSCHEME -INCLUDES += -I$(MZSCHEME)/include -EXTRA_OBJS += $(OUTDIR)/if_mzsch.o - -ifndef DYNAMIC_MZSCHEME -DYNAMIC_MZSCHEME = yes -endif - -ifndef MZSCHEME_VER -MZSCHEME_VER = 209_000 -endif - -ifndef MZSCHEME_PRECISE_GC -MZSCHEME_PRECISE_GC=no -endif - -# for version 4.x we need to generate byte-code for Scheme base -ifndef MZSCHEME_GENERATE_BASE -MZSCHEME_GENERATE_BASE=no -endif - -ifndef MZSCHEME_USE_RACKET -MZSCHEME_MAIN_LIB=mzsch -else -MZSCHEME_MAIN_LIB=racket -endif - -ifeq (yes, $(DYNAMIC_MZSCHEME)) -DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -else -ifndef MZSCHEME_DLLS -MZSCHEME_DLLS = $(MZSCHEME) -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -else -MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) -endif -EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB) -endif -ifeq (yes,$(MZSCHEME_GENERATE_BASE)) -DEFINES += -DINCLUDE_MZSCHEME_BASE -MZ_EXTRA_DEP += mzscheme_base.c -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -DEFINES += -DMZ_PRECISE_GC -endif -endif - -############################## -# DYNAMIC_TCL=yes and no both work. -############################## -ifdef TCL -DEFINES += -DFEAT_TCL -INCLUDES += -I$(TCL)/include -EXTRA_OBJS += $(OUTDIR)/if_tcl.o - -ifndef DYNAMIC_TCL -DYNAMIC_TCL = yes -endif - -ifndef TCL_VER -TCL_VER = 83 -endif - -ifeq (yes, $(DYNAMIC_TCL)) -DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib -else -EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib -endif -endif - -############################## -# DYNAMIC_LUA=yes works. -# DYNAMIC_LUA=no does not (unresolved externals on link). -############################## -ifdef LUA -DEFINES += -DFEAT_LUA -INCLUDES += -I$(LUA)/include -EXTRA_OBJS += $(OUTDIR)/if_lua.o - -ifndef DYNAMIC_LUA -DYNAMIC_LUA = yes -endif - -ifndef LUA_VER -LUA_VER = 51 -endif - -ifeq (yes, $(DYNAMIC_LUA)) -DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -else -EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib -endif -endif - -############################## -ifeq (yes, $(GETTEXT)) -DEFINES += -DDYNAMIC_GETTEXT -endif - -############################## -ifeq (yes, $(ICONV)) -DEFINES += -DDYNAMIC_ICONV -endif - -############################## -ifeq (yes, $(MBYTE)) -DEFINES += -DFEAT_MBYTE -endif - -############################## -ifeq (yes, $(IME)) -DEFINES += -DFEAT_MBYTE_IME - -ifndef DYNAMIC_IME -DYNAMIC_IME = yes -endif - -ifeq (yes, $(DYNAMIC_IME)) -DEFINES += -DDYNAMIC_IME -else -EXTRA_LIBS += -limm32 -endif -endif - -############################## -ifeq (yes, $(DEBUG)) -DEFINES += -DDEBUG -INCLUDES += -g -fstack-check -DEBUG_SUFFIX = d -else - -ifeq ($(OPTIMIZE), SIZE) -OPTFLAG = -Os -else -ifeq ($(OPTIMIZE), MAXSPEED) -OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return -else -OPTFLAG = -O2 -endif -endif - -# A bug in the GCC <= 3.2 optimizer can cause a crash. The -# following option removes the problem optimization. -OPTFLAG += -fno-strength-reduce - -INCLUDES += -s - -endif - -############################## -# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll. -# USEDLL=no will build a Mingw32 executable with no extra dll dependencies. -############################## -ifeq (yes, $(USEDLL)) -DEFINES += -D_MAX_PATH=256 -D__CYGWIN__ -endif - -############################## -ifeq (yes, $(POSTSCRIPT)) -DEFINES += -DMSWINPS -endif - -############################## -ifeq (yes, $(CSCOPE)) -DEFINES += -DFEAT_CSCOPE -EXTRA_OBJS += $(OUTDIR)/if_cscope.o -endif - -############################## -ifeq ($(GUI),yes) - -############################## -ifeq (yes, $(NETBEANS)) -# Only allow NETBEANS for a GUI build. -DEFINES += -DFEAT_NETBEANS_INTG -EXTRA_OBJS += $(OUTDIR)/netbeans.o -EXTRA_LIBS += -lwsock32 - -ifeq (yes, $(NBDEBUG)) -DEFINES += -DNBDEBUG -NBDEBUG_DEP = nbdebug.h nbdebug.c -endif - -endif - -############################## -ifdef XPM -# Only allow XPM for a GUI build. -DEFINES += -DFEAT_XPM_W32 -INCLUDES += -I$(XPM)/include -EXTRA_OBJS += $(OUTDIR)/xpm_w32.o -EXTRA_LIBS += -L$(XPM)/lib -lXpm -endif - -############################## -EXE = gvim$(DEBUG_SUFFIX).exe -OUTDIR = gobj$(DEBUG_SUFFIX) -DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o -EXTRA_LIBS += -mwindows -lcomctl32 -lversion -else -EXE = vim$(DEBUG_SUFFIX).exe -OUTDIR = obj$(DEBUG_SUFFIX) -LIBS += -luser32 -lgdi32 -lcomdlg32 -endif - -############################## -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -EXTRA_OBJS += $(OUTDIR)/if_ole.o -EXTRA_LIBS += -loleaut32 -ifeq (yes, $(STATIC_STDCPLUS)) -EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -EXTRA_LIBS += -lstdc++ -endif -endif - -############################## -ifneq (sh.exe, $(SHELL)) -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -DEL = del -MKDIR = mkdir -DIRSLASH = \\ -endif - -#>>>>> end of choices -########################################################################### - -INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \ - structs.h version.h - -CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES) - -RCFLAGS = -O coff $(DEFINES) - -OBJ = \ - $(OUTDIR)/blowfish.o \ - $(OUTDIR)/buffer.o \ - $(OUTDIR)/charset.o \ - $(OUTDIR)/diff.o \ - $(OUTDIR)/digraph.o \ - $(OUTDIR)/edit.o \ - $(OUTDIR)/eval.o \ - $(OUTDIR)/ex_cmds.o \ - $(OUTDIR)/ex_cmds2.o \ - $(OUTDIR)/ex_docmd.o \ - $(OUTDIR)/ex_eval.o \ - $(OUTDIR)/ex_getln.o \ - $(OUTDIR)/fileio.o \ - $(OUTDIR)/fold.o \ - $(OUTDIR)/getchar.o \ - $(OUTDIR)/hardcopy.o \ - $(OUTDIR)/hashtab.o \ - $(OUTDIR)/main.o \ - $(OUTDIR)/mark.o \ - $(OUTDIR)/memfile.o \ - $(OUTDIR)/memline.o \ - $(OUTDIR)/menu.o \ - $(OUTDIR)/message.o \ - $(OUTDIR)/misc1.o \ - $(OUTDIR)/misc2.o \ - $(OUTDIR)/move.o \ - $(OUTDIR)/mbyte.o \ - $(OUTDIR)/normal.o \ - $(OUTDIR)/ops.o \ - $(OUTDIR)/option.o \ - $(OUTDIR)/os_win32.o \ - $(OUTDIR)/os_mswin.o \ - $(OUTDIR)/winclip.o \ - $(OUTDIR)/pathdef.o \ - $(OUTDIR)/popupmnu.o \ - $(OUTDIR)/quickfix.o \ - $(OUTDIR)/regexp.o \ - $(OUTDIR)/screen.o \ - $(OUTDIR)/search.o \ - $(OUTDIR)/sha256.o \ - $(OUTDIR)/spell.o \ - $(OUTDIR)/syntax.o \ - $(OUTDIR)/tag.o \ - $(OUTDIR)/term.o \ - $(OUTDIR)/ui.o \ - $(OUTDIR)/undo.o \ - $(OUTDIR)/version.o \ - $(OUTDIR)/vimrc.o \ - $(OUTDIR)/window.o \ - $(EXTRA_OBJS) - -all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll - -# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for -# linking unless calling ld directly. -# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information. -$(EXE): $(OUTDIR) $(OBJ) - $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS) - -xxd/xxd.exe: xxd/xxd.c - $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL) - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE) - -vimrun.exe: vimrun.c - $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS) - -install.exe: dosinst.c - $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32 - -uninstal.exe: uninstal.c - $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS) - -$(OUTDIR): - $(MKDIR) $(OUTDIR) - -tags: - command /c ctags *.c $(INCL) - -clean: - -$(DEL) $(OUTDIR)$(DIRSLASH)*.o - -rmdir $(OUTDIR) - -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe -ifdef PERL - -$(DEL) if_perl.c -endif -ifdef MZSCHEME - -$(DEL) mzscheme_base.c -endif - -$(DEL) pathdef.c - $(MAKE) -C xxd -f Make_cyg.mak clean - $(MAKE) -C GvimExt -f Make_cyg.mak clean - -distclean: clean - -$(DEL) obj$(DIRSLASH)*.o - -rmdir obj - -$(DEL) gobj$(DIRSLASH)*.o - -rmdir gobj - -$(DEL) objd$(DIRSLASH)*.o - -rmdir objd - -$(DEL) gobjd$(DIRSLASH)*.o - -rmdir gobjd - -$(DEL) *.exe - -########################################################################### - -$(OUTDIR)/%.o : %.c $(INCL) - $(CC) -c $(CFLAGS) $< -o $@ - -$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o - -$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o - -$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) - $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o - -$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h - $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o - -$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) - $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o - -$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@ - -$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@ - -if_perl.c: if_perl.xs typemap - $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \ - -prototypes -typemap \ - `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@ - -$(OUTDIR)/if_perl.o: if_perl.c $(INCL) -ifeq (yes, $(USEDLL)) - $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o -endif - -$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) -ifeq (16, $(RUBY_VER)) - $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o -endif - -$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP) - $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o - -$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) - $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o - -$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) - $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o - -$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h - $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o +#CROSS_COMPILE = i686-w64-mingw32- +#CROSS_COMPILE = x86_64-w64-mingw32- -mzscheme_base.c: - $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base -pathdef.c: $(INCL) -ifneq (sh.exe, $(SHELL)) - @echo creating pathdef.c - @echo '/* pathdef.c */' > pathdef.c - @echo '#include "vim.h"' >> pathdef.c - @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c - @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c - @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c - @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c - @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c - @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c -else - @echo creating pathdef.c - @echo /* pathdef.c */ > pathdef.c - @echo #include "vim.h" >> pathdef.c - @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c - @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c - @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c - @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c - @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c - @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c -endif +# Do not change this. +UNDER_CYGWIN = yes +include Make_cyg_ming.mak +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak new file mode 100644 index 0000000000..d51b6ea898 --- /dev/null +++ b/src/Make_cyg_ming.mak @@ -0,0 +1,1081 @@ +# Makefile for VIM on Win32 (Cygwin and MinGW) +# +# This file contains common part for Cygwin and MinGW and it is included +# from Make_cyg.mak and Make_ming.mak. +# +# Info at http://www.mingw.org +# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net +# Also requires GNU make, which you can download from the same sites. +# Get missing libraries from http://gnuwin32.sf.net. +# +# Tested on Win32 NT 4 and Win95. +# +# To make everything, just 'make -f Make_ming.mak'. +# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'. +# After a run, you can 'make -f Make_ming.mak clean' to clean up. +# +# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think +# it's just run out of memory or something. Run again, and it will continue +# with 'xxd'. +# +# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs, +# using the excellent UPX compressor: +# https://upx.github.io/ +# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs: +# http://www.matcode.com/mpress.htm +# +# Maintained by Ron Aaron <ronaharon@yahoo.com> et al. +# Updated 2014 Oct 13. + +#>>>>> choose options: +# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] +# Set to TINY to make minimal version (few features). +FEATURES=HUGE + +# set to yes for a debug build +DEBUG=no + +# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization +OPTIMIZE=MAXSPEED + +# set to yes to make gvim, no for vim +GUI=yes + +# set to no if you do not want to use DirectWrite (DirectX) +# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64. +DIRECTX=yes + +# Disable Color emoji support +# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.) +#COLOR_EMOJI=no + +# Set to one of i386, i486, i586, i686 as the minimum target processor. +# For amd64/x64 architecture set ARCH=x86-64 . +# If not set, it will be automatically detected. (Normally i686 or x86-64.) +#ARCH=i686 +# Set to yes to cross-compile from unix; no=native Windows (and Cygwin). +CROSS=no + +# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. +# Use "yes" when the path does not need to be define. +#ICONV="." +ICONV=yes +GETTEXT=yes + +# Set to yes to include multibyte support. +MBYTE=yes + +# Set to yes to include IME support. +IME=yes +DYNAMIC_IME=yes + +# Set to yes to enable writing a postscript file with :hardcopy. +POSTSCRIPT=no + +# Set to yes to enable OLE support. +OLE=no + +# Set the default $(WINVER) to make it work with WinXP. +ifndef WINVER +WINVER = 0x0501 +endif + +# Set to yes to enable Cscope support. +CSCOPE=yes + +# Set to yes to enable Netbeans support (requires CHANNEL). +NETBEANS=$(GUI) + +# Set to yes to enable inter process communication. +ifeq (HUGE, $(FEATURES)) +CHANNEL=yes +else +CHANNEL=$(GUI) +endif + +# Set to yes to enable terminal support. +ifeq (HUGE, $(FEATURES)) +TERMINAL=yes +else +TERMINAL=no +endif + +ifndef CTAGS +# this assumes ctags is Exuberant ctags +CTAGS = ctags -I INIT+ --fields=+S +endif + +# Link against the shared version of libstdc++ by default. Set +# STATIC_STDCPLUS to "yes" to link against static version instead. +ifndef STATIC_STDCPLUS +STATIC_STDCPLUS=no +endif + + +# Link against the shared version of libwinpthread by default. Set +# STATIC_WINPTHREAD to "yes" to link against static version instead. +ifndef STATIC_WINPTHREAD +STATIC_WINPTHREAD=$(STATIC_STDCPLUS) +endif + +# If the user doesn't want gettext, undefine it. +ifeq (no, $(GETTEXT)) +GETTEXT= +endif +# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23 +# Uncomment the first line and one of the following three if you want Native Language +# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by +# Franco Bez <franco.bez@gmx.de>. It may be found at +# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html +# Tested with mingw32 with GCC-2.95.2 on Win98 +# Updated 2001 Jun 9 +#GETTEXT=c:/gettext.win32.msvcrt +#STATIC_GETTEXT=USE_STATIC_GETTEXT +#DYNAMIC_GETTEXT=USE_GETTEXT_DLL +#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL +SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o +# Alternatively, if you uncomment the two following lines, you get a "safe" version +# without linking the safe_gettext_dll.o object file. +#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT +#GETTEXT_DYNAMIC=gnu_gettext.dll +INTLPATH=$(GETTEXT)/lib/mingw32 +INTLLIB=gnu_gettext + +# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext +# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/ +# uncomment the following, but I can't build a static version with them, ?-(| +#GETTEXT=c:/gettext-0.10.37-20010430 +#STATIC_GETTEXT=USE_STATIC_GETTEXT +#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT +#INTLPATH=$(GETTEXT)/lib +#INTLLIB=intl + + +# Command definitions (depends on cross-compiling and shell) +ifeq ($(CROSS),yes) +# cross-compiler prefix: +ifndef CROSS_COMPILE +CROSS_COMPILE = i586-pc-mingw32msvc- +endif +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +# normal (Windows) compilation: +ifndef CROSS_COMPILE +CROSS_COMPILE = +endif +ifneq (sh.exe, $(SHELL)) +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +DEL = del +MKDIR = mkdir +DIRSLASH = \\ +endif +endif +CC := $(CROSS_COMPILE)gcc +CXX := $(CROSS_COMPILE)g++ +ifeq ($(UNDER_CYGWIN),yes) +WINDRES := $(CROSS_COMPILE)windres +else +WINDRES := windres +endif +WINDRES_CC = $(CC) + +# Get the default ARCH. +ifndef ARCH +ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/') +endif + + +# Perl interface: +# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PERL=yes (to load the Perl DLL dynamically) +# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524) +ifdef PERL +ifndef PERL_VER +PERL_VER=524 +endif +ifndef DYNAMIC_PERL +DYNAMIC_PERL=yes +endif +# on Linux, for cross-compile, it's here: +#PERLLIB=/home/ron/ActivePerl/lib +# on NT, it's here: +PERLEXE=$(PERL)/bin/perl +PERLLIB=$(PERL)/lib +PERLLIBS=$(PERLLIB)/Core +ifeq ($(UNDER_CYGWIN),yes) +PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap) +XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp) +else +PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap +XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp +endif +XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'") +ifeq "$(XSUBPP_EXISTS)" "" +XSUBPP=$(PERLEXE) $(XSUBPPTRY) +else +XSUBPP=xsubpp +endif +endif + +# Lua interface: +# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_LUA=yes (to load the Lua DLL dynamically) +# LUA_VER=[Lua version, eg 51, 52] (default is 53) +ifdef LUA +ifndef DYNAMIC_LUA +DYNAMIC_LUA=yes +endif + +ifndef LUA_VER +LUA_VER=53 +endif + +ifeq (no,$(DYNAMIC_LUA)) +LUA_LIB = -L$(LUA)/lib -llua +endif + +endif + +# MzScheme interface: +# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically) +# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6)) +# Used for the DLL file name. E.g.: +# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll +# MZSCHEME_DEBUG=no +ifdef MZSCHEME +ifndef DYNAMIC_MZSCHEME +DYNAMIC_MZSCHEME=yes +endif + +ifndef MZSCHEME_VER +MZSCHEME_VER=3m_a0solc +endif + +# for version 4.x we need to generate byte-code for Scheme base +ifndef MZSCHEME_GENERATE_BASE +MZSCHEME_GENERATE_BASE=no +endif + +ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),) +MZSCHEME_MAIN_LIB=mzsch +else +MZSCHEME_MAIN_LIB=racket +endif + +ifndef MZSCHEME_PRECISE_GC +MZSCHEME_PRECISE_GC=no +ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),) +ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),) +MZSCHEME_PRECISE_GC=yes +endif +else +ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),) +ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),) +MZSCHEME_PRECISE_GC=yes +endif +endif +endif +endif + +ifeq (no,$(DYNAMIC_MZSCHEME)) +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) +else +MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) +endif +# the modern MinGW can dynamically link to dlls directly. +# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll +ifndef MZSCHEME_DLLS +MZSCHEME_DLLS=$(MZSCHEME) +endif +MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib +endif + +endif + +# Python interface: +# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically) +# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27) +ifdef PYTHON +ifndef DYNAMIC_PYTHON +DYNAMIC_PYTHON=yes +endif + +ifndef PYTHON_VER +PYTHON_VER=27 +endif +ifndef DYNAMIC_PYTHON_DLL +DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll +endif +ifdef PYTHON_HOME +PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\" +endif + +ifeq (no,$(DYNAMIC_PYTHON)) +PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER) +endif +# my include files are in 'win32inc' on Linux, and 'include' in the standard +# NT distro (ActiveState) +ifndef PYTHONINC +ifeq ($(CROSS),no) +PYTHONINC=-I $(PYTHON)/include +else +PYTHONINC=-I $(PYTHON)/win32inc +endif +endif +endif + +# Python3 interface: +# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically) +# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36) +ifdef PYTHON3 +ifndef DYNAMIC_PYTHON3 +DYNAMIC_PYTHON3=yes +endif + +ifndef PYTHON3_VER +PYTHON3_VER=36 +endif +ifndef DYNAMIC_PYTHON3_DLL +DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll +endif +ifdef PYTHON3_HOME +PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\" +endif + +ifeq (no,$(DYNAMIC_PYTHON3)) +PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER) +endif + +ifndef PYTHON3INC +ifeq ($(CROSS),no) +PYTHON3INC=-I $(PYTHON3)/include +else +PYTHON3INC=-I $(PYTHON3)/win32inc +endif +endif +endif + +# TCL interface: +# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_TCL=yes (to load the TCL DLL dynamically) +# TCL_VER=[TCL version, eg 83, 84] (default is 86) +# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6) +# You must set TCL_VER_LONG when you set TCL_VER. +# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll) +ifdef TCL +ifndef DYNAMIC_TCL +DYNAMIC_TCL=yes +endif +ifndef TCL_VER +TCL_VER = 86 +endif +ifndef TCL_VER_LONG +TCL_VER_LONG = 8.6 +endif +ifndef TCL_DLL +TCL_DLL = tcl$(TCL_VER).dll +endif +TCLINC += -I$(TCL)/include +endif + + +# Ruby interface: +# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static) +# RUBY_VER=[Ruby version, eg 19, 22] (default is 22) +# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0] +# (default is 2.2.0) +# You must set RUBY_API_VER_LONG when changing RUBY_VER. +# Note: If you use Ruby 1.9.3, set as follows: +# RUBY_VER=19 +# RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.) +ifdef RUBY +ifndef DYNAMIC_RUBY +DYNAMIC_RUBY=yes +endif +# Set default value +ifndef RUBY_VER +RUBY_VER = 22 +endif +ifndef RUBY_VER_LONG +RUBY_VER_LONG = 2.2.0 +endif +ifndef RUBY_API_VER_LONG +RUBY_API_VER_LONG = $(RUBY_VER_LONG) +endif +ifndef RUBY_API_VER +RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG)) +endif + +ifndef RUBY_PLATFORM +ifeq ($(RUBY_VER), 16) +RUBY_PLATFORM = i586-mswin32 +else +ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),) +RUBY_PLATFORM = i386-mingw32 +else +ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),) +RUBY_PLATFORM = x64-mingw32 +else +RUBY_PLATFORM = i386-mswin32 +endif +endif +endif +endif + +ifndef RUBY_INSTALL_NAME +ifeq ($(RUBY_VER), 16) +RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) +else +ifndef RUBY_MSVCRT_NAME +# Base name of msvcrXX.dll which is used by ruby's dll. +RUBY_MSVCRT_NAME = msvcrt +endif +ifeq ($(ARCH),x86-64) +RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) +else +RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) +endif +endif +endif + +ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) +RUBY_19_OR_LATER = 1 +endif + +RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM) +ifdef RUBY_19_OR_LATER +RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM) +endif +ifeq (no, $(DYNAMIC_RUBY)) +RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME) +endif + +endif # RUBY + +# See feature.h for a list of options. +# Any other defines can be included here. +DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD +DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ + -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H +ifeq ($(ARCH),x86-64) +DEFINES+=-DMS_WIN64 +endif + +#>>>>> end of choices +########################################################################### + +CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall +CXXFLAGS = -std=gnu++11 +WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED +EXTRA_LIBS = + +ifdef GETTEXT +DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H +GETTEXTINCLUDE = $(GETTEXT)/include +GETTEXTLIB = $(INTLPATH) +ifeq (yes, $(GETTEXT)) +DEFINES += -DDYNAMIC_GETTEXT +else +ifdef DYNAMIC_GETTEXT +DEFINES += -D$(DYNAMIC_GETTEXT) +ifdef GETTEXT_DYNAMIC +DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" +endif +endif +endif +endif + +ifdef PERL +CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS +ifeq (yes, $(DYNAMIC_PERL)) +CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" +EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER) +endif +endif + +ifdef LUA +CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA +ifeq (yes, $(DYNAMIC_LUA)) +CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" +endif +endif + +ifdef MZSCHEME +ifndef MZSCHEME_COLLECTS +MZSCHEME_COLLECTS=$(MZSCHEME)/collects +ifeq (yes, $(UNDER_CYGWIN)) +MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g') +endif +endif +CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\" +ifeq (yes, $(DYNAMIC_MZSCHEME)) +ifeq (yes, $(MZSCHEME_PRECISE_GC)) +# Precise GC does not use separate dll +CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" +else +CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" +endif +endif +ifeq (yes, "$(MZSCHEME_DEBUG)") +CFLAGS += -DMZSCHEME_FORCE_GC +endif +endif + +ifdef RUBY +CFLAGS += -DFEAT_RUBY $(RUBYINC) +ifeq (yes, $(DYNAMIC_RUBY)) +CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" +CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) +endif +ifeq (no, $(DYNAMIC_RUBY)) +CFLAGS += -DRUBY_VERSION=$(RUBY_VER) +endif +ifneq ($(findstring w64-mingw32,$(CC)),) +# A workaround for MinGW-w64 +CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE +endif +endif + +ifdef PYTHON +CFLAGS += -DFEAT_PYTHON +ifeq (yes, $(DYNAMIC_PYTHON)) +CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\" +endif +endif + +ifdef PYTHON3 +CFLAGS += -DFEAT_PYTHON3 +ifeq (yes, $(DYNAMIC_PYTHON3)) +CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\" +endif +endif + +ifdef TCL +CFLAGS += -DFEAT_TCL $(TCLINC) +ifeq (yes, $(DYNAMIC_TCL)) +CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\" +endif +endif + +ifeq ($(POSTSCRIPT),yes) +DEFINES += -DMSWINPS +endif + +ifeq (yes, $(OLE)) +DEFINES += -DFEAT_OLE +endif + +ifeq ($(CSCOPE),yes) +DEFINES += -DFEAT_CSCOPE +endif + +ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) +DEFINES += -DFEAT_NETBEANS_INTG + +ifeq ($(NBDEBUG), yes) +DEFINES += -DNBDEBUG +NBDEBUG_INCL = nbdebug.h +NBDEBUG_SRC = nbdebug.c +endif +endif +endif + +ifeq ($(CHANNEL),yes) +DEFINES += -DFEAT_JOB_CHANNEL +endif + +ifeq ($(TERMINAL),yes) +DEFINES += -DFEAT_TERMINAL +TERM_DEPS = \ + libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h \ + libvterm/src/rect.h \ + libvterm/src/utf8.h \ + libvterm/src/vterm_internal.h +endif + +# DirectWrite (DirectX) +ifeq ($(DIRECTX),yes) +# Only allow DirectWrite for a GUI build. +ifeq (yes, $(GUI)) +DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +ifneq ($(COLOR_EMOJI),no) +DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI +endif +endif +endif + +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) + +ifndef XPM +ifeq ($(ARCH),i386) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i486) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i586) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i686) +XPM = xpm/x86 +endif +ifeq ($(ARCH),x86-64) +XPM = xpm/x64 +endif +endif +ifdef XPM +ifneq ($(XPM),no) +CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include +endif +endif + +endif + +ifeq ($(DEBUG),yes) +CFLAGS += -g -fstack-check +DEBUG_SUFFIX=d +else +ifeq ($(OPTIMIZE), SIZE) +CFLAGS += -Os +else +ifeq ($(OPTIMIZE), MAXSPEED) +CFLAGS += -O3 +CFLAGS += -fomit-frame-pointer -freg-struct-return +else # SPEED +CFLAGS += -O2 +endif +endif +CFLAGS += -s +endif + +LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion +GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o +CUIOBJ = $(OUTDIR)/iscygpty.o +OBJ = \ + $(OUTDIR)/arabic.o \ + $(OUTDIR)/beval.o \ + $(OUTDIR)/blowfish.o \ + $(OUTDIR)/buffer.o \ + $(OUTDIR)/charset.o \ + $(OUTDIR)/crypt.o \ + $(OUTDIR)/crypt_zip.o \ + $(OUTDIR)/dict.o \ + $(OUTDIR)/diff.o \ + $(OUTDIR)/digraph.o \ + $(OUTDIR)/edit.o \ + $(OUTDIR)/eval.o \ + $(OUTDIR)/evalfunc.o \ + $(OUTDIR)/ex_cmds.o \ + $(OUTDIR)/ex_cmds2.o \ + $(OUTDIR)/ex_docmd.o \ + $(OUTDIR)/ex_eval.o \ + $(OUTDIR)/ex_getln.o \ + $(OUTDIR)/farsi.o \ + $(OUTDIR)/fileio.o \ + $(OUTDIR)/fold.o \ + $(OUTDIR)/getchar.o \ + $(OUTDIR)/hardcopy.o \ + $(OUTDIR)/hashtab.o \ + $(OUTDIR)/json.o \ + $(OUTDIR)/list.o \ + $(OUTDIR)/main.o \ + $(OUTDIR)/mark.o \ + $(OUTDIR)/memfile.o \ + $(OUTDIR)/memline.o \ + $(OUTDIR)/menu.o \ + $(OUTDIR)/message.o \ + $(OUTDIR)/misc1.o \ + $(OUTDIR)/misc2.o \ + $(OUTDIR)/move.o \ + $(OUTDIR)/mbyte.o \ + $(OUTDIR)/normal.o \ + $(OUTDIR)/ops.o \ + $(OUTDIR)/option.o \ + $(OUTDIR)/os_win32.o \ + $(OUTDIR)/os_mswin.o \ + $(OUTDIR)/winclip.o \ + $(OUTDIR)/pathdef.o \ + $(OUTDIR)/popupmnu.o \ + $(OUTDIR)/quickfix.o \ + $(OUTDIR)/regexp.o \ + $(OUTDIR)/screen.o \ + $(OUTDIR)/search.o \ + $(OUTDIR)/sha256.o \ + $(OUTDIR)/spell.o \ + $(OUTDIR)/spellfile.o \ + $(OUTDIR)/syntax.o \ + $(OUTDIR)/tag.o \ + $(OUTDIR)/term.o \ + $(OUTDIR)/ui.o \ + $(OUTDIR)/undo.o \ + $(OUTDIR)/userfunc.o \ + $(OUTDIR)/version.o \ + $(OUTDIR)/vimrc.o \ + $(OUTDIR)/window.o + +ifdef PERL +OBJ += $(OUTDIR)/if_perl.o +endif +ifdef LUA +OBJ += $(OUTDIR)/if_lua.o +endif +ifdef MZSCHEME +OBJ += $(OUTDIR)/if_mzsch.o +MZSCHEME_INCL = if_mzsch.h +ifeq (yes,$(MZSCHEME_GENERATE_BASE)) +CFLAGS += -DINCLUDE_MZSCHEME_BASE +MZ_EXTRA_DEP += mzscheme_base.c +endif +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +CFLAGS += -DMZ_PRECISE_GC +endif +endif +ifdef PYTHON +OBJ += $(OUTDIR)/if_python.o +endif +ifdef PYTHON3 +OBJ += $(OUTDIR)/if_python3.o +endif +ifdef RUBY +OBJ += $(OUTDIR)/if_ruby.o +endif +ifdef TCL +OBJ += $(OUTDIR)/if_tcl.o +endif +ifeq ($(CSCOPE),yes) +OBJ += $(OUTDIR)/if_cscope.o +endif + +ifeq ($(NETBEANS),yes) +ifneq ($(CHANNEL),yes) +# Cannot use Netbeans without CHANNEL +NETBEANS=no +else +ifneq (yes, $(GUI)) +# Cannot use Netbeans without GUI. +NETBEANS=no +else +OBJ += $(OUTDIR)/netbeans.o +endif +endif +endif + +ifeq ($(CHANNEL),yes) +OBJ += $(OUTDIR)/channel.o +LIB += -lwsock32 +endif + +ifeq ($(DIRECTX),yes) +# Only allow DIRECTX for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/gui_dwrite.o +LIB += -ld2d1 -ldwrite +USE_STDCPLUS = yes +endif +endif +ifneq ($(XPM),no) +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/xpm_w32.o +# You'll need libXpm.a from http://gnuwin32.sf.net +LIB += -L$(XPM)/lib -lXpm +endif +endif + +ifeq ($(TERMINAL),yes) +OBJ += $(OUTDIR)/terminal.o \ + $(OUTDIR)/term_encoding.o \ + $(OUTDIR)/term_keyboard.o \ + $(OUTDIR)/term_mouse.o \ + $(OUTDIR)/term_parser.o \ + $(OUTDIR)/term_pen.o \ + $(OUTDIR)/term_screen.o \ + $(OUTDIR)/term_state.o \ + $(OUTDIR)/term_unicode.o \ + $(OUTDIR)/term_vterm.o +endif + + +ifdef MZSCHEME +MZSCHEME_SUFFIX = Z +endif + +ifeq ($(GUI),yes) +TARGET := gvim$(DEBUG_SUFFIX).exe +DEFINES += $(DEF_GUI) +OBJ += $(GUIOBJ) +LFLAGS += -mwindows +OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) +else +OBJ += $(CUIOBJ) +TARGET := vim$(DEBUG_SUFFIX).exe +OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) +endif + +ifdef GETTEXT +ifneq (yes, $(GETTEXT)) +CFLAGS += -I$(GETTEXTINCLUDE) +ifndef STATIC_GETTEXT +LIB += -L$(GETTEXTLIB) -l$(INTLLIB) +ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) +OBJ+=$(SAFE_GETTEXT_DLL_OBJ) +endif +else +LIB += -L$(GETTEXTLIB) -lintl +endif +endif +endif + +ifdef PERL +ifeq (no, $(DYNAMIC_PERL)) +LIB += -L$(PERLLIBS) -lperl$(PERL_VER) +endif +endif + +ifdef TCL +LIB += -L$(TCL)/lib +ifeq (yes, $(DYNAMIC_TCL)) +LIB += -ltclstub$(TCL_VER) +else +LIB += -ltcl$(TCL_VER) +endif +endif + +ifeq (yes, $(OLE)) +LIB += -loleaut32 +OBJ += $(OUTDIR)/if_ole.o +USE_STDCPLUS = yes +endif + +ifeq (yes, $(MBYTE)) +DEFINES += -DFEAT_MBYTE +endif + +ifeq (yes, $(IME)) +DEFINES += -DFEAT_MBYTE_IME +ifeq (yes, $(DYNAMIC_IME)) +DEFINES += -DDYNAMIC_IME +else +LIB += -limm32 +endif +endif + +ifdef ICONV +ifneq (yes, $(ICONV)) +LIB += -L$(ICONV) +CFLAGS += -I$(ICONV) +endif +DEFINES+=-DDYNAMIC_ICONV +endif + +ifeq (yes, $(USE_STDCPLUS)) +ifeq (yes, $(STATIC_STDCPLUS)) +LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +else +LIB += -lstdc++ +endif +endif + +ifeq (yes, $(STATIC_WINPTHREAD)) +LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic +endif + +all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll + +vimrun.exe: vimrun.c + $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) + +install.exe: dosinst.c + $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid + +uninstal.exe: uninstal.c + $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) + +$(TARGET): $(OUTDIR) $(OBJ) + $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) + +upx: exes + upx gvim.exe + upx vim.exe + +mpress: exes + mpress gvim.exe + mpress vim.exe + +xxd/xxd.exe: xxd/xxd.c + $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)' + +GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h + $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS) + +tags: notags + $(CTAGS) *.c *.cpp *.h if_perl.xs + +notags: + -$(DEL) tags + +clean: + -$(DEL) $(OUTDIR)$(DIRSLASH)*.o + -$(DEL) $(OUTDIR)$(DIRSLASH)*.res + -rmdir $(OUTDIR) + -$(DEL) *.exe + -$(DEL) pathdef.c +ifdef PERL + -$(DEL) if_perl.c +endif +ifdef MZSCHEME + -$(DEL) mzscheme_base.c +endif + $(MAKE) -C GvimExt -f Make_ming.mak clean + $(MAKE) -C xxd -f Make_ming.mak clean + +########################################################################### +INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \ + keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \ + spell.h structs.h term.h beval.h $(NBDEBUG_INCL) +GUI_INCL = gui.h +CUI_INCL = iscygpty.h + +$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL) + $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@ + +$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL) + $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@ + +$(OUTDIR)/%.o : %.c $(INCL) + $(CC) -c $(CFLAGS) $< -o $@ + +$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h + $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ + --input-format=rc --output-format=coff -i vim.rc -o $@ + +$(OUTDIR): + $(MKDIR) $(OUTDIR) + +$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h + $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o + +$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o + +$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) beval.c -o $(OUTDIR)/beval.o + +$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o + +$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o + +$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h + $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o + +$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP) + $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o + +mzscheme_base.c: + $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base + +# Remove -D__IID_DEFINED__ for newer versions of the w32api +$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h + $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp + +if_perl.c: if_perl.xs typemap + $(XSUBPP) -prototypes -typemap \ + $(PERLTYPEMAP) if_perl.xs -output $@ + +$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) +ifeq (16, $(RUBY)) + $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c +endif + +$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL) + $(CC) -c $(CFLAGS) iscygpty.c -o $(OUTDIR)/iscygpty.o -U_WIN32_WINNT -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL + +$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL) + $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o + +$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) + $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o + +$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL) + $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o + +$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) + $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o + +$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS) + $(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o + + +CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \ + -DVSNPRINTF=vim_vsnprintf \ + -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \ + -DWCWIDTH_FUNCTION=utf_uint2cells + +$(OUTDIR)/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/encoding.c -o $@ + +$(OUTDIR)/term_keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/keyboard.c -o $@ + +$(OUTDIR)/term_mouse.o: libvterm/src/mouse.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/mouse.c -o $@ + +$(OUTDIR)/term_parser.o: libvterm/src/parser.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/parser.c -o $@ + +$(OUTDIR)/term_pen.o: libvterm/src/pen.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/pen.c -o $@ + +$(OUTDIR)/term_screen.o: libvterm/src/screen.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/screen.c -o $@ + +$(OUTDIR)/term_state.o: libvterm/src/state.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/state.c -o $@ + +$(OUTDIR)/term_unicode.o: libvterm/src/unicode.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/unicode.c -o $@ + +$(OUTDIR)/term_vterm.o: libvterm/src/vterm.c $(TERM_DEPS) + $(CCCTERM) libvterm/src/vterm.c -o $@ + + +pathdef.c: $(INCL) +ifneq (sh.exe, $(SHELL)) + @echo creating pathdef.c + @echo '/* pathdef.c */' > pathdef.c + @echo '#include "vim.h"' >> pathdef.c + @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c + @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c + @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c + @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c + @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c + @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c +else + @echo creating pathdef.c + @echo /* pathdef.c */ > pathdef.c + @echo #include "vim.h" >> pathdef.c + @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c + @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c + @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c + @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c + @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c + @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c +endif + +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_dice.mak b/src/Make_dice.mak index e3a8b9e0fb..c53f182f5f 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -26,23 +26,31 @@ LD = dcc ${CC} ${PRE} ${CFLAGS} $< -o $@ SRC = \ + arabic.c \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ + dict.c \ diff.c \ digraph.c \ edit.c \ eval.c \ + evalfunc.c \ ex_cmds.c \ ex_cmds2.c \ ex_docmd.c \ ex_eval.c \ ex_getln.c \ + farsi.c \ fileio.c \ fold.c \ getchar.c \ hardcopy.c \ hashtab.c \ + json.c \ + list.c \ main.c \ mark.c \ memfile.c \ @@ -64,31 +72,41 @@ SRC = \ search.c \ sha256.c \ spell.c \ + spellfile.c \ syntax.c \ tag.c \ term.c \ ui.c \ undo.c \ + userfunc.c \ window.c \ version.c -OBJ = o/blowfish.o \ +OBJ = o/arabic.o \ + o/blowfish.o \ o/buffer.o \ o/charset.o \ + o/crypt.o \ + o/crypt_zip.o \ + o/dict.o \ o/diff.o \ o/digraph.o \ o/edit.o \ o/eval.o \ + o/evalfunc.o \ o/ex_cmds.o \ o/ex_cmds2.o \ o/ex_docmd.o \ o/ex_eval.o \ o/ex_getln.o \ + o/farsi.o \ o/fileio.o \ o/fold.o \ o/getchar.o \ o/hardcopy.o \ o/hashtab.o \ + o/json.o \ + o/list.o \ o/main.o \ o/mark.o \ o/memfile.o \ @@ -110,11 +128,13 @@ OBJ = o/blowfish.o \ o/search.o \ o/sha256.o \ o/spell.o \ + o/spellfile.o \ o/syntax.o \ o/tag.o \ o/term.o \ o/ui.o \ o/undo.o \ + o/userfunc.o \ o/window.o \ $(TERMLIB) @@ -137,12 +157,20 @@ $(SYMS) : vim.h globals.h keymap.h macros.h ascii.h term.h os_amiga.h structs.h ########################################################################### +o/arabic.o: arabic.c $(SYMS) + o/blowfish.o: blowfish.c $(SYMS) o/buffer.o: buffer.c $(SYMS) o/charset.o: charset.c $(SYMS) +o/crypt.o: crypt.c $(SYMS) + +o/crypt_zip.o: crypt_zip.c $(SYMS) + +o/dict.o: dict.c $(SYMS) + o/diff.o: diff.c $(SYMS) o/digraph.o: digraph.c $(SYMS) @@ -151,6 +179,8 @@ o/edit.o: edit.c $(SYMS) o/eval.o: eval.c $(SYMS) +o/evalfunc.o: evalfunc.c $(SYMS) + o/ex_cmds.o: ex_cmds.c $(SYMS) o/ex_cmds2.o: ex_cmds2.c $(SYMS) @@ -161,6 +191,8 @@ o/ex_eval.o: ex_eval.c $(SYMS) ex_cmds.h o/ex_getln.o: ex_getln.c $(SYMS) +o/farsi.o: farsi.c $(SYMS) + o/fileio.o: fileio.c $(SYMS) o/fold.o: fold.c $(SYMS) @@ -171,6 +203,10 @@ o/hardcopy.o: hardcopy.c $(SYMS) o/hashtab.o: hashtab.c $(SYMS) +o/json.o: json.c $(SYMS) + +o/list.o: list.c $(SYMS) + o/main.o: main.c $(SYMS) o/mark.o: mark.c $(SYMS) @@ -216,7 +252,9 @@ o/search.o: search.c $(SYMS) regexp.h o/sha256.o: sha256.c $(SYMS) -o/spell.o: spell.c $(SYMS) +o/spell.o: spell.c $(SYMS) spell.h + +o/spellfile.o: spellfile.c $(SYMS) spell.h o/syntax.o: syntax.c $(SYMS) @@ -226,8 +264,10 @@ o/term.o: term.c $(SYMS) term.h o/termlib.o: termlib.c $(SYMS) -o/ui.o: ui.c $(SYMS) +o/ui.o: ui.c $(SYMS) + +o/undo.o: undo.c $(SYMS) -o/undo.o: undo.c $(SYMS) +o/userfunc.o: userfunc.c $(SYMS) -o/window.o: window.c $(SYMS) +o/window.o: window.c $(SYMS) diff --git a/src/Make_djg.mak b/src/Make_djg.mak deleted file mode 100644 index f2e7c82712..0000000000 --- a/src/Make_djg.mak +++ /dev/null @@ -1,108 +0,0 @@ -# -# Makefile for VIM on MSDOS, using DJGPP 2.0 -# - -#>>>>> choose options: - -### See feature.h for a list of optionals. -### Any other defines can be included here. - -DEFINES = - -#>>>>> name of the compiler and linker, name of lib directory -CC = gcc - -#>>>>> end of choices -########################################################################### - -INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_msdos.h structs.h -CFLAGS = -O2 -DMSDOS -Iproto $(DEFINES) -Wall -Dinterrupt= -Dfar= -DMAXMEM=512 -D_NAIVE_DOS_REGS - -OBJ = \ - obj/blowfish.o \ - obj/buffer.o \ - obj/charset.o \ - obj/diff.o \ - obj/digraph.o \ - obj/edit.o \ - obj/eval.o \ - obj/ex_cmds.o \ - obj/ex_cmds2.o \ - obj/ex_docmd.o \ - obj/ex_eval.o \ - obj/ex_getln.o \ - obj/fileio.o \ - obj/fold.o \ - obj/getchar.o \ - obj/hardcopy.o \ - obj/hashtab.o \ - obj/main.o \ - obj/mark.o \ - obj/memfile.o \ - obj/memline.o \ - obj/menu.o \ - obj/message.o \ - obj/misc1.o \ - obj/misc2.o \ - obj/move.o \ - obj/mbyte.o \ - obj/normal.o \ - obj/ops.o \ - obj/option.o \ - obj/os_msdos.o \ - obj/popupmnu.o \ - obj/quickfix.o \ - obj/regexp.o \ - obj/screen.o \ - obj/search.o \ - obj/sha256.o \ - obj/spell.o \ - obj/syntax.o \ - obj/tag.o \ - obj/term.o \ - obj/ui.o \ - obj/undo.o \ - obj/window.o \ - $(TERMLIB) - -all: vim.exe install.exe uninstal.exe xxd/xxd.exe - -# version.c is compiled each time, so that it sets the build time. -vim.exe: obj $(OBJ) version.c version.h - $(CC) $(CFLAGS) -s -o vim.exe version.c $(OBJ) -lpc - -install.exe: dosinst.c - $(CC) $(CFLAGS) -s -o install.exe dosinst.c -lpc - -uninstal.exe: uninstal.c - $(CC) $(CFLAGS) -s -o uninstal.exe uninstal.c -lpc - -# This requires GNU make. -xxd/xxd.exe: xxd/xxd.c - $(MAKE) --directory=xxd -f Make_djg.mak - -obj: - mkdir obj - -tags: - command /c ctags *.c $(INCL) ex_cmds.h - -clean: - -del obj\*.o - -rmdir obj - -del vim.exe - -del install.exe - -del xxd\xxd.exe - -del testdir\*.out - -# This requires GNU make. -test: - $(MAKE) --directory=testdir -f Make_dos.mak - -########################################################################### - -obj/%.o: %.c obj $(INCL) - $(CC) -c $(CFLAGS) -o $@ $< - -# Extra dependency (there are actually many more...) -obj/ex_docmd.o: ex_cmds.h diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak index 16589ea8ad..d90477c761 100644 --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -210,23 +210,31 @@ ALL : .\$(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvime LINK32_OBJS= \ $(EXTRAS) \ + "$(INTDIR)/arabic.obj" \ "$(INTDIR)/blowfish.obj" \ "$(INTDIR)/buffer.obj" \ "$(INTDIR)/charset.obj" \ + "$(INTDIR)/crypt.obj" \ + "$(INTDIR)/crypt_zip.obj" \ + "$(INTDIR)/dict.obj" \ "$(INTDIR)/diff.obj" \ "$(INTDIR)/digraph.obj" \ "$(INTDIR)/edit.obj" \ "$(INTDIR)/eval.obj" \ + "$(INTDIR)/evalfunc.obj" \ "$(INTDIR)/ex_cmds.obj" \ "$(INTDIR)/ex_cmds2.obj" \ "$(INTDIR)/ex_docmd.obj" \ "$(INTDIR)/ex_eval.obj" \ "$(INTDIR)/ex_getln.obj" \ + "$(INTDIR)/farsi.obj" \ "$(INTDIR)/fileio.obj" \ "$(INTDIR)/fold.obj" \ "$(INTDIR)/getchar.obj" \ "$(INTDIR)/hardcopy.obj" \ "$(INTDIR)/hashtab.obj" \ + "$(INTDIR)/json.obj" \ + "$(INTDIR)/list.obj" \ "$(INTDIR)/main.obj" \ "$(INTDIR)/mark.obj" \ "$(INTDIR)/mbyte.obj" \ @@ -250,11 +258,13 @@ LINK32_OBJS= \ "$(INTDIR)/search.obj" \ "$(INTDIR)/sha256.obj" \ "$(INTDIR)/spell.obj" \ + "$(INTDIR)/spellfile.obj" \ "$(INTDIR)/syntax.obj" \ "$(INTDIR)/tag.obj" \ "$(INTDIR)/term.obj" \ "$(INTDIR)/ui.obj" \ "$(INTDIR)/undo.obj" \ + "$(INTDIR)/userfunc.obj" \ "$(INTDIR)/version.obj" \ "$(INTDIR)/window.obj" @@ -327,6 +337,10 @@ GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h # Begin Source File +SOURCE=.\arabic.c +# End Source File +# Begin Source File + SOURCE=.\blowfish.c # End Source File # Begin Source File @@ -339,6 +353,18 @@ SOURCE=.\charset.c # End Source File # Begin Source File +SOURCE=.\crypt.c +# End Source File +# Begin Source File + +SOURCE=.\crypt_zip.c +# End Source File +# Begin Source File + +SOURCE=.\dict.c +# End Source File +# Begin Source File + SOURCE=.\diff.c # End Source File # Begin Source File @@ -355,6 +381,10 @@ SOURCE=.\eval.c # End Source File # Begin Source File +SOURCE=.\evalfunc.c +# End Source File +# Begin Source File + SOURCE=.\ex_cmds.c # End Source File # Begin Source File @@ -375,6 +405,10 @@ SOURCE=.\ex_getln.c # End Source File # Begin Source File +SOURCE=.\farsi.c +# End Source File +# Begin Source File + SOURCE=.\fileio.c # End Source File # Begin Source File @@ -545,6 +579,14 @@ SOURCE=.\if_ole.idl # End Source File # Begin Source File +SOURCE=.\json.c +# End Source File +# Begin Source File + +SOURCE=.\list.c +# End Source File +# Begin Source File + SOURCE=.\main.c # End Source File # Begin Source File @@ -637,6 +679,10 @@ SOURCE=.\spell.c # End Source File # Begin Source File +SOURCE=.\spellfile.c +# End Source File +# Begin Source File + SOURCE=.\syntax.c # End Source File # Begin Source File @@ -657,6 +703,10 @@ SOURCE=.\undo.c # End Source File # Begin Source File +SOURCE=.\userfunc.c +# End Source File +# Begin Source File + SOURCE=.\version.c # End Source File # Begin Source File diff --git a/src/Make_manx.mak b/src/Make_manx.mak index 101c5c6b32..6995b7662e 100644 --- a/src/Make_manx.mak +++ b/src/Make_manx.mak @@ -1,6 +1,8 @@ # # Makefile for VIM on the Amiga, using Aztec/Manx C 5.0 or later # +# NOTE: THIS IS OLD AND PROBABLY NO LONGER WORKS. +# # Note: Not all dependencies are included. This was done to avoid having # to compile everything when a global variable or function is added. # Careful when changing a global struct or variable! @@ -34,23 +36,31 @@ SHELL = csh REN = $(SHELL) -c mv -f DEL = $(SHELL) -c rm -f -SRC = blowfish.c \ +SRC = arabic.c \ + blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ + dict.c \ diff.c \ digraph.c \ edit.c \ eval.c \ + evalfunc.c \ ex_cmds.c \ ex_cmds2.c \ ex_docmd.c \ ex_eval.c \ ex_getln.c \ + farsi.c \ fileio.c \ fold.c \ getchar.c \ hardcopy.c \ hashtab.c \ + json.c \ + list.c \ main.c \ mark.c \ memfile.c \ @@ -72,33 +82,43 @@ SRC = blowfish.c \ search.c \ sha256.c \ spell.c \ + spellfile.c \ syntax.c \ tag.c \ term.c \ ui.c \ undo.c \ + userfunc.c \ window.c \ version.c INCL = vim.h feature.h keymap.h macros.h ascii.h term.h structs.h os_amiga.h -OBJ = obj/blowfish.o \ +OBJ = obj/arabic.o \ + obj/blowfish.o \ obj/buffer.o \ obj/charset.o \ + obj/crypt.o \ + obj/crypt_zip.o \ + obj/dict.o \ obj/diff.o \ obj/digraph.o \ obj/edit.o \ obj/eval.o \ + obj/evalfunc.o \ obj/ex_cmds.o \ obj/ex_cmds2.o \ obj/ex_docmd.o \ obj/ex_eval.o \ obj/ex_getln.o \ + obj/farsi.o \ obj/fileio.o \ obj/fold.o \ obj/getchar.o \ obj/hardcopy.o \ obj/hashtab.o \ + obj/json.o \ + obj/list.o \ obj/main.o \ obj/mark.o \ obj/memfile.o \ @@ -120,31 +140,41 @@ OBJ = obj/blowfish.o \ obj/search.o \ obj/sha256.o \ obj/spell.o \ + obj/spellfile.o \ obj/syntax.o \ obj/tag.o \ obj/term.o \ obj/ui.o \ obj/undo.o \ + obj/userfunc.o \ obj/window.o \ $(TERMLIB) -PRO = proto/blowfish.pro \ +PRO = proto/arabic.pro \ + proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ + proto/dict.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ proto/eval.pro \ + proto/evalfunc.pro \ proto/ex_cmds.pro \ proto/ex_cmds2.pro \ proto/ex_docmd.pro \ proto/ex_eval.pro \ proto/ex_getln.pro \ + proto/farsi.pro \ proto/fileio.pro \ proto/fold.pro \ proto/getchar.pro \ proto/hardcopy.pro \ proto/hashtab.pro \ + proto/json.pro \ + proto/list.pro \ proto/main.pro \ proto/mark.pro \ proto/memfile.pro \ @@ -166,12 +196,14 @@ PRO = proto/blowfish.pro \ proto/search.pro \ proto/sha256.pro \ proto/spell.pro \ + proto/spellfile.pro \ proto/syntax.pro \ proto/tag.pro \ proto/term.pro \ proto/termlib.pro \ proto/ui.pro \ proto/undo.pro \ + proto/userfunc.pro \ proto/window.pro all: Vim xxd/Xxd @@ -218,6 +250,9 @@ CCNOSYM = $(CC) $(CFLAGS) -o $(OBJ): $(SYMS) +obj/arabic.o: arabic.c + $(CCSYM) $@ arabic.c + obj/blowfish.o: blowfish.c $(CCSYM) $@ blowfish.c @@ -227,6 +262,15 @@ obj/buffer.o: buffer.c obj/charset.o: charset.c $(CCSYM) $@ charset.c +obj/crypt.o: crypt.c + $(CCSYM) $@ crypt.c + +obj/crypt_zip.o: crypt_zip.c + $(CCSYM) $@ crypt_zip.c + +obj/dict.o: dict.c + $(CCSYM) $@ dict.c + obj/diff.o: diff.c $(CCSYM) $@ diff.c @@ -239,6 +283,9 @@ obj/edit.o: edit.c obj/eval.o: eval.c $(CCSYM) $@ eval.c +obj/evalfunc.o: evalfunc.c + $(CCSYM) $@ evalfunc.c + obj/ex_cmds.o: ex_cmds.c $(CCSYM) $@ ex_cmds.c @@ -255,6 +302,9 @@ obj/ex_eval.o: ex_eval.c ex_cmds.h obj/ex_getln.o: ex_getln.c $(CCSYM) $@ ex_getln.c +obj/farsi.o: farsi.c + $(CCSYM) $@ farsi.c + obj/fileio.o: fileio.c $(CCSYM) $@ fileio.c @@ -270,6 +320,12 @@ obj/hardcopy.o: hardcopy.c obj/hashtab.o: hashtab.c $(CCSYM) $@ hashtab.c +obj/json.o: json.c + $(CCSYM) $@ json.c + +obj/list.o: list.c + $(CCSYM) $@ list.c + # Don't use $(SYMS) here, because main.c defines EXTERN obj/main.o: main.c option.h globals.h $(CCNOSYM) $@ main.c @@ -336,6 +392,9 @@ obj/sha256.o: sha256.c obj/spell.o: spell.c $(CCSYM) $@ spell.c +obj/spellfile.o: spellfile.c + $(CCSYM) $@ spellfile.c + obj/syntax.o: syntax.c $(CCSYM) $@ syntax.c @@ -354,5 +413,8 @@ obj/ui.o: ui.c obj/undo.o: undo.c $(CCSYM) $@ undo.c +obj/userfunc.o: userfunc.c + $(CCSYM) $@ userfunc.c + obj/window.o: window.c $(CCSYM) $@ window.c diff --git a/src/Make_ming.mak b/src/Make_ming.mak index f7088ad58e..e9e20f6782 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -1,191 +1,27 @@ -# Makefile for VIM on Win32 # -# Info at http://www.mingw.org -# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net -# Also requires GNU make, which you can download from the same sites. -# Get missing libraries from http://gnuwin32.sf.net. +# Makefile for VIM on Win32, using MinGW # -# Tested on Win32 NT 4 and Win95. +# Also read INSTALLpc.txt! # -# To make everything, just 'make -f Make_ming.mak'. -# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'. -# After a run, you can 'make -f Make_ming.mak clean' to clean up. +# The old Make_ming.mak (maintained by Ron Aaron et al.) was merged into +# Make_cyg_ming.mak. +# This file contains MinGW specific settings. Common settings are contained +# in Make_cyg_ming.mak. # -# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think -# it's just run out of memory or something. Run again, and it will continue -# with 'xxd'. -# -# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs, -# using the excellent UPX compressor: -# http://upx.sourceforge.net/ -# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs: -# http://www.matcode.com/mpress.htm -# -# Maintained by Ron Aaron <ronaharon@yahoo.com> et al. -# Updated 2012 Sep 5. - -#>>>>> choose options: -# set to yes for a debug build -DEBUG=no -# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization -OPTIMIZE=MAXSPEED -# set to yes to make gvim, no for vim -GUI=yes -# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] -# Set to TINY to make minimal version (few features). -FEATURES=BIG -# Set to one of i386, i486, i586, i686 as the minimum target processor. -# For amd64/x64 architecture set ARCH=x86-64 . -ARCH=i386 -# Set to yes to cross-compile from unix; no=native Windows. -CROSS=no -# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. -#ICONV="." -ICONV=yes -GETTEXT=yes -# Set to yes to include multibyte support. -MBYTE=yes -# Set to yes to include IME support. -IME=yes -DYNAMIC_IME=yes -# Set to yes to enable writing a postscript file with :hardcopy. -POSTSCRIPT=no -# Set to yes to enable OLE support. -OLE=no -# Set the default $(WINVER) to make it work with pre-Win2k. -ifndef WINVER -WINVER = 0x0500 -endif -# Set to yes to enable Cscope support. -CSCOPE=yes -# Set to yes to enable Netbeans support. -NETBEANS=$(GUI) - - -# Link against the shared version of libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static version instead. -ifndef STATIC_STDCPLUS -STATIC_STDCPLUS=no -endif - -# If the user doesn't want gettext, undefine it. -ifeq (no, $(GETTEXT)) -GETTEXT= -endif -# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23 -# Uncomment the first line and one of the following three if you want Native Language -# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by -# Franco Bez <franco.bez@gmx.de>. It may be found at -# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html -# Tested with mingw32 with GCC-2.95.2 on Win98 -# Updated 2001 Jun 9 -#GETTEXT=c:/gettext.win32.msvcrt -#STATIC_GETTEXT=USE_STATIC_GETTEXT -#DYNAMIC_GETTEXT=USE_GETTEXT_DLL -#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL -SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o -# Alternatively, if you uncomment the two following lines, you get a "safe" version -# without linking the safe_gettext_dll.o object file. -#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT -#GETTEXT_DYNAMIC=gnu_gettext.dll -INTLPATH=$(GETTEXT)/lib/mingw32 -INTLLIB=gnu_gettext +# Last updated by Ken Takata. +# Last Change: 2014 Oct 21 -# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext -# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/ -# uncomment the following, but I can't build a static version with them, ?-(| -#GETTEXT=c:/gettext-0.10.37-20010430 -#STATIC_GETTEXT=USE_STATIC_GETTEXT -#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT -#INTLPATH=$(GETTEXT)/lib -#INTLLIB=intl # uncomment 'PERL' if you want a perl-enabled version -#PERL=C:/perl -ifdef PERL -ifndef PERL_VER -PERL_VER=56 -endif -ifndef DYNAMIC_PERL -DYNAMIC_PERL=yes -endif -# on Linux, for cross-compile, it's here: -#PERLLIB=/home/ron/ActivePerl/lib -# on NT, it's here: -PERLLIB=$(PERL)/lib -PERLLIBS=$(PERLLIB)/Core -XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp -XSUBPP_EXISTS=$(shell perl -e "print 1 unless -e '$(XSUBPPTRY)'") -ifeq "$(XSUBPP_EXISTS)" "" -XSUBPP=perl $(XSUBPPTRY) -else -XSUBPP=xsubpp -endif -endif +#PERL=c:/perl # uncomment 'LUA' if you want a Lua-enabled version -#LUA=/usr/local -ifdef LUA -ifndef DYNAMIC_LUA -DYNAMIC_LUA=yes -endif - -ifndef LUA_VER -LUA_VER=51 -endif - -ifeq (no,$(DYNAMIC_LUA)) -LUA_LIB = -L$(LUA)/lib -llua -endif - -endif +#LUA=c:/lua # uncomment 'MZSCHEME' if you want a MzScheme-enabled version #MZSCHEME=d:/plt -ifdef MZSCHEME -ifndef DYNAMIC_MZSCHEME -DYNAMIC_MZSCHEME=yes -endif - -ifndef MZSCHEME_VER -MZSCHEME_VER=205_000 -endif - -ifndef MZSCHEME_PRECISE_GC -MZSCHEME_PRECISE_GC=no -endif -# for version 4.x we need to generate byte-code for Scheme base -ifndef MZSCHEME_GENERATE_BASE -MZSCHEME_GENERATE_BASE=no -endif - -ifndef MZSCHEME_USE_RACKET -MZSCHEME_MAIN_LIB=mzsch -else -MZSCHEME_MAIN_LIB=racket -endif - -ifeq (no,$(DYNAMIC_MZSCHEME)) -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -else -MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) -endif -# the modern MinGW can dynamically link to dlls directly. -# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll -ifndef MZSCHEME_DLLS -MZSCHEME_DLLS=$(MZSCHEME) -endif -MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib -endif - -endif - -# Python support -- works with the ActiveState python 2.0 release (and others -# too, probably) -# -# uncomment 'PYTHON' to make python-enabled version +# uncomment 'PYTHON' if you want a python-enabled version # Put the path to the python distro here. If cross compiling from Linux, you # will also need to convert the header files to unix instead of dos format: # for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil @@ -198,606 +34,18 @@ endif # on my NT box, it's here: #PYTHON=c:/python20 -ifdef PYTHON -ifndef DYNAMIC_PYTHON -DYNAMIC_PYTHON=yes -endif - -ifndef PYTHON_VER -PYTHON_VER=22 -endif - -ifeq (no,$(DYNAMIC_PYTHON)) -PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER) -endif -# my include files are in 'win32inc' on Linux, and 'include' in the standard -# NT distro (ActiveState) -ifeq ($(CROSS),no) -PYTHONINC=-I $(PYTHON)/include -else -PYTHONINC=-I $(PYTHON)/win32inc -endif -endif - -#PYTHON3: See comment for Python 2 above - -ifdef PYTHON3 -ifndef DYNAMIC_PYTHON3 -DYNAMIC_PYTHON3=yes -endif - -ifndef PYTHON3_VER -PYTHON3_VER=31 -endif - -ifeq (no,$(DYNAMIC_PYTHON3)) -PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER) -endif +# uncomment 'PYTHON3' if you want a python3-enabled version +#PYTHON3=c:/python31 -ifeq ($(CROSS),no) -PYTHON3INC=-I $(PYTHON3)/include -else -PYTHON3INC=-I $(PYTHON3)/win32inc -endif -endif - -# TCL interface: -# TCL=[Path to TCL directory] -# DYNAMIC_TCL=yes (to load the TCL DLL dynamically) -# TCL_VER=[TCL version, eg 83, 84] (default is 83) +# uncomment 'TCL' if you want a Tcl-enabled version #TCL=c:/tcl -ifdef TCL -ifndef DYNAMIC_TCL -DYNAMIC_TCL=yes -endif -ifndef TCL_VER -TCL_VER = 83 -endif -TCLINC += -I$(TCL)/include -endif - -# Ruby interface: -# RUBY=[Path to Ruby directory] -# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) -# RUBY_VER=[Ruby version, eg 16, 17] (default is 16) -# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6) -# You must set RUBY_VER_LONG when changing RUBY_VER. -# You must set RUBY_API_VER version to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. +# uncomment 'RUBY' if you want a Ruby-enabled version #RUBY=c:/ruby -ifdef RUBY -ifndef DYNAMIC_RUBY -DYNAMIC_RUBY=yes -endif -# Set default value -ifndef RUBY_VER -RUBY_VER = 16 -endif -ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.6 -endif -ifndef RUBY_API_VER -RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG)) -endif - -ifndef RUBY_PLATFORM -ifeq ($(RUBY_VER), 16) -RUBY_PLATFORM = i586-mswin32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),) -RUBY_PLATFORM = i386-mingw32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),) -RUBY_PLATFORM = x64-mingw32 -else -RUBY_PLATFORM = i386-mswin32 -endif -endif -endif -endif - -ifndef RUBY_INSTALL_NAME -ifeq ($(RUBY_VER), 16) -RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -else -ifeq ($(ARCH),x86-64) -RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER) -else -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) -endif -endif -endif - -ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) -RUBY_19_OR_LATER = 1 -endif - -RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -ifdef RUBY_19_OR_LATER -RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -endif -ifeq (no, $(DYNAMIC_RUBY)) -RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME) -endif - -endif # RUBY - -# See feature.h for a list of options. -# Any other defines can be included here. -DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ - -DHAVE_PATHDEF -DFEAT_$(FEATURES) -ifeq ($(ARCH),x86-64) -DEFINES+=-DMS_WIN64 -endif -ifeq ($(CROSS),yes) -# cross-compiler prefix: -CROSS_COMPILE = i586-pc-mingw32msvc- -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -# normal (Windows) compilation: -CROSS_COMPILE = -ifneq (sh.exe, $(SHELL)) -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -DEL = del -MKDIR = mkdir -DIRSLASH = \\ -endif -endif -CC := $(CROSS_COMPILE)gcc -WINDRES := $(CROSS_COMPILE)windres -WINDRES_CC = $(CC) - -#>>>>> end of choices -########################################################################### - -CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall -WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED -EXTRA_LIBS = - -ifdef GETTEXT -DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H -GETTEXTINCLUDE = $(GETTEXT)/include -GETTEXTLIB = $(INTLPATH) -ifeq (yes, $(GETTEXT)) -DEFINES += -DDYNAMIC_GETTEXT -else -ifdef DYNAMIC_GETTEXT -DEFINES += -D$(DYNAMIC_GETTEXT) -ifdef GETTEXT_DYNAMIC -DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" -endif -endif -endif -endif - -ifdef PERL -CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -ifeq (yes, $(DYNAMIC_PERL)) -CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" -EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER) -endif -endif - -ifdef LUA -CFLAGS += -I$(LUA)/include -DFEAT_LUA -ifeq (yes, $(DYNAMIC_LUA)) -CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -endif -endif - -ifdef MZSCHEME -CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\" -ifeq (yes, $(DYNAMIC_MZSCHEME)) -CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -endif -ifeq (yes, "$(MZSCHEME_DEBUG)") -CFLAGS += -DMZSCHEME_FORCE_GC -endif -endif - -ifdef RUBY -CFLAGS += -DFEAT_RUBY $(RUBYINC) -ifeq (yes, $(DYNAMIC_RUBY)) -CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) -endif -endif - -ifdef PYTHON -CFLAGS += -DFEAT_PYTHON -ifeq (yes, $(DYNAMIC_PYTHON)) -CFLAGS += -DDYNAMIC_PYTHON -endif -endif - -ifdef PYTHON3 -CFLAGS += -DFEAT_PYTHON3 -ifeq (yes, $(DYNAMIC_PYTHON3)) -CFLAGS += -DDYNAMIC_PYTHON3 -endif -endif - -ifdef TCL -CFLAGS += -DFEAT_TCL $(TCLINC) -ifeq (yes, $(DYNAMIC_TCL)) -CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -endif -endif - -ifeq ($(POSTSCRIPT),yes) -DEFINES += -DMSWINPS -endif - -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -endif - -ifeq ($(CSCOPE),yes) -DEFINES += -DFEAT_CSCOPE -endif - -ifeq ($(NETBEANS),yes) -# Only allow NETBEANS for a GUI build. -ifeq (yes, $(GUI)) -DEFINES += -DFEAT_NETBEANS_INTG - -ifeq ($(NBDEBUG), yes) -DEFINES += -DNBDEBUG -NBDEBUG_INCL = nbdebug.h -NBDEBUG_SRC = nbdebug.c -endif -endif -endif - -# Only allow XPM for a GUI build. -ifeq (yes, $(GUI)) - -ifndef XPM -ifeq ($(ARCH),i386) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i486) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i586) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i686) -XPM = xpm/x86 -endif -ifeq ($(ARCH),x86-64) -XPM = xpm/x64 -endif -endif -ifdef XPM -ifneq ($(XPM),no) -CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include -endif -endif - -endif - -ifeq ($(DEBUG),yes) -CFLAGS += -g -fstack-check -DEBUG_SUFFIX=d -else -ifeq ($(OPTIMIZE), SIZE) -CFLAGS += -Os -else -ifeq ($(OPTIMIZE), MAXSPEED) -CFLAGS += -O3 -CFLAGS += -fomit-frame-pointer -freg-struct-return -else # SPEED -CFLAGS += -O2 -endif -endif -CFLAGS += -s -endif - -LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion -GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o -OBJ = \ - $(OUTDIR)/blowfish.o \ - $(OUTDIR)/buffer.o \ - $(OUTDIR)/charset.o \ - $(OUTDIR)/diff.o \ - $(OUTDIR)/digraph.o \ - $(OUTDIR)/edit.o \ - $(OUTDIR)/eval.o \ - $(OUTDIR)/ex_cmds.o \ - $(OUTDIR)/ex_cmds2.o \ - $(OUTDIR)/ex_docmd.o \ - $(OUTDIR)/ex_eval.o \ - $(OUTDIR)/ex_getln.o \ - $(OUTDIR)/fileio.o \ - $(OUTDIR)/fold.o \ - $(OUTDIR)/getchar.o \ - $(OUTDIR)/hardcopy.o \ - $(OUTDIR)/hashtab.o \ - $(OUTDIR)/main.o \ - $(OUTDIR)/mark.o \ - $(OUTDIR)/memfile.o \ - $(OUTDIR)/memline.o \ - $(OUTDIR)/menu.o \ - $(OUTDIR)/message.o \ - $(OUTDIR)/misc1.o \ - $(OUTDIR)/misc2.o \ - $(OUTDIR)/move.o \ - $(OUTDIR)/mbyte.o \ - $(OUTDIR)/normal.o \ - $(OUTDIR)/ops.o \ - $(OUTDIR)/option.o \ - $(OUTDIR)/os_win32.o \ - $(OUTDIR)/os_mswin.o \ - $(OUTDIR)/winclip.o \ - $(OUTDIR)/pathdef.o \ - $(OUTDIR)/popupmnu.o \ - $(OUTDIR)/quickfix.o \ - $(OUTDIR)/regexp.o \ - $(OUTDIR)/screen.o \ - $(OUTDIR)/search.o \ - $(OUTDIR)/sha256.o \ - $(OUTDIR)/spell.o \ - $(OUTDIR)/syntax.o \ - $(OUTDIR)/tag.o \ - $(OUTDIR)/term.o \ - $(OUTDIR)/ui.o \ - $(OUTDIR)/undo.o \ - $(OUTDIR)/version.o \ - $(OUTDIR)/vimrc.o \ - $(OUTDIR)/window.o - -ifdef PERL -OBJ += $(OUTDIR)/if_perl.o -endif -ifdef LUA -OBJ += $(OUTDIR)/if_lua.o -endif -ifdef MZSCHEME -OBJ += $(OUTDIR)/if_mzsch.o -MZSCHEME_INCL = if_mzsch.h -ifeq (yes,$(MZSCHEME_GENERATE_BASE)) -CFLAGS += -DINCLUDE_MZSCHEME_BASE -MZ_EXTRA_DEP += mzscheme_base.c -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -CFLAGS += -DMZ_PRECISE_GC -endif -endif -ifdef PYTHON -OBJ += $(OUTDIR)/if_python.o -endif -ifdef PYTHON3 -OBJ += $(OUTDIR)/if_python3.o -endif -ifdef RUBY -OBJ += $(OUTDIR)/if_ruby.o -endif -ifdef TCL -OBJ += $(OUTDIR)/if_tcl.o -endif -ifeq ($(CSCOPE),yes) -OBJ += $(OUTDIR)/if_cscope.o -endif -ifeq ($(NETBEANS),yes) -# Only allow NETBEANS for a GUI build. -ifeq (yes, $(GUI)) -OBJ += $(OUTDIR)/netbeans.o -LIB += -lwsock32 -endif -endif -ifdef XPM -# Only allow XPM for a GUI build. -ifeq (yes, $(GUI)) -OBJ += $(OUTDIR)/xpm_w32.o -# You'll need libXpm.a from http://gnuwin32.sf.net -LIB += -L$(XPM)/lib -lXpm -endif -endif - - -ifdef MZSCHEME -MZSCHEME_SUFFIX = Z -endif - -ifeq ($(GUI),yes) -TARGET := gvim$(DEBUG_SUFFIX).exe -DEFINES += $(DEF_GUI) -OBJ += $(GUIOBJ) -LFLAGS += -mwindows -OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) -else -TARGET := vim$(DEBUG_SUFFIX).exe -OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) -endif - -ifdef GETTEXT -ifneq (yes, $(GETTEXT)) -CFLAGS += -I$(GETTEXTINCLUDE) -ifndef STATIC_GETTEXT -LIB += -L$(GETTEXTLIB) -l$(INTLLIB) -ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) -OBJ+=$(SAFE_GETTEXT_DLL_OBJ) -endif -else -LIB += -L$(GETTEXTLIB) -lintl -endif -endif -endif - -ifdef PERL -ifeq (no, $(DYNAMIC_PERL)) -LIB += -L$(PERLLIBS) -lperl$(PERL_VER) -endif -endif - -ifdef TCL -LIB += -L$(TCL)/lib -ifeq (yes, $(DYNAMIC_TCL)) -LIB += -ltclstub$(TCL_VER) -else -LIB += -ltcl$(TCL_VER) -endif -endif - -ifeq (yes, $(OLE)) -LIB += -loleaut32 -OBJ += $(OUTDIR)/if_ole.o -ifeq (yes, $(STATIC_STDCPLUS)) -LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -LIB += -lstdc++ -endif -endif - -ifeq (yes, $(MBYTE)) -DEFINES += -DFEAT_MBYTE -endif - -ifeq (yes, $(IME)) -DEFINES += -DFEAT_MBYTE_IME -ifeq (yes, $(DYNAMIC_IME)) -DEFINES += -DDYNAMIC_IME -else -LIB += -limm32 -endif -endif - -ifdef ICONV -ifneq (yes, $(ICONV)) -LIB += -L$(ICONV) -CFLAGS += -I$(ICONV) -endif -DEFINES+=-DDYNAMIC_ICONV -endif - -all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll - -vimrun.exe: vimrun.c - $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) - -install.exe: dosinst.c - $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid - -uninstal.exe: uninstal.c - $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) - -$(TARGET): $(OUTDIR) $(OBJ) - $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) - -upx: exes - upx gvim.exe - upx vim.exe - -mpress: exes - mpress gvim.exe - mpress vim.exe - -xxd/xxd.exe: xxd/xxd.c - $(MAKE) -C xxd -f Make_ming.mak CC=$(CC) - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) - -clean: - -$(DEL) $(OUTDIR)$(DIRSLASH)*.o - -$(DEL) $(OUTDIR)$(DIRSLASH)*.res - -rmdir $(OUTDIR) - -$(DEL) *.exe - -$(DEL) pathdef.c -ifdef PERL - -$(DEL) if_perl.c -endif -ifdef MZSCHEME - -$(DEL) mzscheme_base.c -endif - $(MAKE) -C GvimExt -f Make_ming.mak clean - $(MAKE) -C xxd -f Make_ming.mak clean - -########################################################################### -INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \ - structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \ - gui.h - -$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@ - -$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@ - -$(OUTDIR)/%.o : %.c $(INCL) - $(CC) -c $(CFLAGS) $< -o $@ - -$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h - $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ - --input-format=rc --output-format=coff -i vim.rc -o $@ - -$(OUTDIR): - $(MKDIR) $(OUTDIR) - -$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o - -$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o - -$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) - $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o - -$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h - $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o - -# Remove -D__IID_DEFINED__ for newer versions of the w32api -$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) - $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp - -$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) -ifeq (16, $(RUBY)) - $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c -endif - -if_perl.c: if_perl.xs typemap - $(XSUBPP) -prototypes -typemap \ - $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@ - -$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) - $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o - -$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) - $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o -$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) - $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o -mzscheme_base.c: - $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base +# Do not change this. +UNDER_CYGWIN = no +include Make_cyg_ming.mak -pathdef.c: $(INCL) -ifneq (sh.exe, $(SHELL)) - @echo creating pathdef.c - @echo '/* pathdef.c */' > pathdef.c - @echo '#include "vim.h"' >> pathdef.c - @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c - @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c - @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c - @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c - @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c - @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c -else - @echo creating pathdef.c - @echo /* pathdef.c */ > pathdef.c - @echo #include "vim.h" >> pathdef.c - @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c - @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c - @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c - @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c - @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c - @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c -endif +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_morph.mak b/src/Make_morph.mak index aa8fbd927a..57c6553cc3 100644 --- a/src/Make_morph.mak +++ b/src/Make_morph.mak @@ -24,23 +24,31 @@ RM = rm .c.o: ${CC} ${CFLAGS} $< -o $@ -SRC = blowfish.c \ +SRC = arabic.c \ + blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ + dict.c \ diff.c \ digraph.c \ edit.c \ eval.c \ + evalfunc.c \ ex_cmds.c \ ex_cmds2.c \ ex_docmd.c \ ex_eval.c \ ex_getln.c \ + farsi.c \ fileio.c \ fold.c \ getchar.c \ hardcopy.c \ hashtab.c \ + json.c \ + list.c \ main.c \ mark.c \ mbyte.c \ @@ -62,11 +70,13 @@ SRC = blowfish.c \ search.c \ sha256.c \ spell.c \ + spellfile.c \ syntax.c \ tag.c \ term.c \ ui.c \ undo.c \ + userfunc.c \ version.c \ window.c \ diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 4a979e419b..ead139b543 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -1,7 +1,7 @@ -# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me) -# and Win64, using the Microsoft Visual C++ compilers. Known to work with -# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), -# VC9 (VS2008), VC10 (VS2010) and VC11 (VS2012) +# Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64, +# using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98), +# VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010), +# VC11 (VS2012), VC12 (VS2013), VC14 (VS2015) and VC15 (VS2017) # # To build using other Windows compilers, see INSTALLpc.txt # @@ -15,68 +15,81 @@ # This will build the console version of Vim with no additional interfaces. # To add features, define any of the following: # -# For MSVC 11 you need to specify where the Win32.mak file is, e.g.: +# For MSVC 11, if you want to include Win32.mak, you need to specify +# where the file is, e.g.: # SDK_INCLUDE_DIR="C:\Program Files\Microsoft SDKs\Windows\v7.1\Include" # # !!!! After changing features do "nmake clean" first !!!! # -# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG) +# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is HUGE) # # GUI interface: GUI=yes (default is no) # +# GUI with DirectWrite (DirectX): DIRECTX=yes +# (default is yes if GUI=yes, requires GUI=yes and MBYTE=yes) +# +# Color emoji support: COLOR_EMOJI=yes +# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.) +# # OLE interface: OLE=yes (usually with GUI=yes) # -# Multibyte support: MBYTE=yes (default is no) +# Multibyte support: MBYTE=yes (default is yes for NORMAL, BIG, HUGE) # # IME support: IME=yes (requires GUI=yes) # DYNAMIC_IME=[yes or no] (to load the imm32.dll dynamically, default # is yes) # Global IME support: GIME=yes (requires GUI=yes) # +# Terminal support: TERMINAL=yes (default is yes) +# # Lua interface: # LUA=[Path to Lua directory] # DYNAMIC_LUA=yes (to load the Lua DLL dynamically) -# LUA_VER=[Lua version] (default is 51) +# LUA_VER=[Lua version] (default is 53) # # MzScheme interface: # MZSCHEME=[Path to MzScheme directory] # DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically) -# MZSCHEME_VER=[version, 205_000, ...] +# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6)) +# Used for the DLL file name. E.g.: +# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll # MZSCHEME_DEBUG=no # # Perl interface: # PERL=[Path to Perl directory] # DYNAMIC_PERL=yes (to load the Perl DLL dynamically) -# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), etc] -# (default is 56) +# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), +# 510 (5.10.x), etc] +# (default is 524) # # Python interface: # PYTHON=[Path to Python directory] # DYNAMIC_PYTHON=yes (to load the Python DLL dynamically) -# PYTHON_VER=[Python version, eg 15, 20] (default is 22) +# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27) # # Python3 interface: # PYTHON3=[Path to Python3 directory] # DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically) -# PYTHON3_VER=[Python3 version, eg 30, 31] (default is 31) +# PYTHON3_VER=[Python3 version, eg 30, 31] (default is 36) # # Ruby interface: # RUBY=[Path to Ruby directory] # DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) -# RUBY_VER=[Ruby version, eg 16, 17] (default is 18) -# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.8) -# You must set RUBY_VER_LONG when change RUBY_VER. -# You must set RUBY_API_VER to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. +# RUBY_VER=[Ruby version, eg 19, 22] (default is 22) +# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0] +# (default is 2.2.0) +# You must set RUBY_API_VER_LONG when change RUBY_VER. +# Note: If you use Ruby 1.9.3, set as follows: +# RUBY_VER=19 +# RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.) # # Tcl interface: # TCL=[Path to Tcl directory] # DYNAMIC_TCL=yes (to load the Tcl DLL dynamically) -# TCL_VER=[Tcl version, e.g. 80, 83] (default is 83) -# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.3) +# TCL_VER=[Tcl version, e.g. 80, 83] (default is 86) +# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6) # You must set TCL_VER_LONG when you set TCL_VER. -# -# SNiFF+ interface: SNIFF=yes +# TCL_DLL=[Tcl dll name, e.g. tcl86.dll] (default is tcl86.dll) # # Cscope support: CSCOPE=yes # @@ -90,6 +103,13 @@ # PostScript printing: POSTSCRIPT=yes (default is no) # # Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes) +# Requires CHANNEL. +# +# Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes +# doesn't work) +# +# Inter process communication: CHANNEL=[yes or no] (default is yes if GUI +# is yes) # # XPM Image Support: XPM=[path to XPM directory] # Default is "xpm", using the files included in the distribution. @@ -97,10 +117,15 @@ # # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # -# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is -# i386) +# Processor Version: CPUNR=[any, i586, i686, sse, sse2, avx, avx2] (default is +# any) +# avx is available on Visual C++ 2010 and after. +# avx2 is available on Visual C++ 2013 Update 2 and after. # -# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400) +# Version Support: WINVER=[0x0501, 0x0502, 0x0600, 0x0601, 0x0602, +# 0x0603, 0x0A00] (default is 0x0501) +# Supported versions depends on your target SDK, check SDKDDKVer.h +# See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt # # Debug version: DEBUG=yes # Mapfile: MAP=[no, yes or lines] (default is yes) @@ -108,12 +133,7 @@ # yes: Write a normal mapfile. # lines: Write a mapfile with line numbers (only for VC6 and later) # -# Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes -# doesn't work) -# -# Visual C Version: MSVCVER=m.n (default derived from nmake if undefined) -# -# Static Code Analysis: ANALYZE=yes (works with VS2012 only) +# Static Code Analysis: ANALYZE=yes (works with VS2012 or later) # # You can combine any of these interfaces # @@ -156,9 +176,13 @@ # you can set DEFINES on the command line, e.g., # nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS" -# Build on both Windows NT/XP and Windows 9x +# Build on Windows NT/XP -TARGETOS = BOTH +TARGETOS = WINNT + +!ifndef DIRECTX +DIRECTX = $(GUI) +!endif # Select one of eight object code directories, depends on GUI, OLE, DEBUG and # interfaces. @@ -168,6 +192,9 @@ OBJDIR = .\ObjG !else OBJDIR = .\ObjC !endif +!if "$(DIRECTX)" == "yes" +OBJDIR = $(OBJDIR)X +!endif !if "$(OLE)" == "yes" OBJDIR = $(OBJDIR)O !endif @@ -196,7 +223,7 @@ OBJDIR = $(OBJDIR)Z OBJDIR = $(OBJDIR)d !endif -# Win32.mak requires that CPU be set appropriately. +# If you include Win32.mak, it requires that CPU be set appropriately. # To cross-compile for Win64, set CPU=AMD64 or CPU=IA64. !ifdef PROCESSOR_ARCHITECTURE @@ -204,20 +231,27 @@ OBJDIR = $(OBJDIR)d ! ifdef CPU ASSEMBLY_ARCHITECTURE=$(CPU) # Using I386 for $ASSEMBLY_ARCHITECTURE doesn't work for VC7. -! if ("$(ASSEMBLY_ARCHITECTURE)" == "i386") || ("$(ASSEMBLY_ARCHITECTURE)" == "I386") -ASSEMBLY_ARCHITECTURE = x86 +! if "$(CPU)" == "I386" +CPU = i386 ! endif -! else -CPU = $(PROCESSOR_ARCHITECTURE) -ASSEMBLY_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE) -! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86") +! else # !CPU CPU = i386 +! if !defined(PLATFORM) && defined(TARGET_CPU) +PLATFORM = $(TARGET_CPU) ! endif +! ifdef PLATFORM +! if ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") +CPU = AMD64 +! elseif ("$(PLATFORM)" != "x86") && ("$(PLATFORM)" != "X86") +! error *** ERROR Unknown target platform "$(PLATFORM)". Make aborted. +! endif +! endif # !PLATFORM ! endif !else # !PROCESSOR_ARCHITECTURE # We're on Windows 95 CPU = i386 !endif # !PROCESSOR_ARCHITECTURE +ASSEMBLY_ARCHITECTURE=$(CPU) OBJDIR = $(OBJDIR)$(CPU) # Build a retail version by default @@ -230,35 +264,98 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes !endif -# Get all sorts of useful, standard macros from the Platform SDK. +# Get all sorts of useful, standard macros from the Platform SDK, +# if SDK_INCLUDE_DIR is set or USE_WIN32MAK is set to "yes". !ifdef SDK_INCLUDE_DIR !include $(SDK_INCLUDE_DIR)\Win32.mak -!else +!elseif "$(USE_WIN32MAK)"=="yes" !include <Win32.mak> +!else +link = link +!endif + + +# Check VC version. +!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul] +!message *** ERROR +!message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. +!message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. +!error Make aborted. +!else +!include msvcver.~ +!if [del msvcver.c msvcver.~] +!endif +!endif + +!if $(MSVCVER) < 1900 +MSVC_MAJOR = ($(MSVCVER) / 100 - 6) +MSVCRT_VER = ($(MSVCVER) / 10 - 60) +# Visual C++ 2017 needs special handling +# it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140 +# TODO: what's the maximum value? +!elseif $(MSVCVER) >= 1910 +MSVC_MAJOR = 15 +MSVCRT_VER = 140 +!else +MSVC_MAJOR = ($(MSVCVER) / 100 - 5) +MSVCRT_VER = ($(MSVCVER) / 10 - 50) +!endif + +# Calculate MSVC_FULL for Visual C++ 8 and up. +!if $(MSVC_MAJOR) >= 8 +! if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul] +! message *** ERROR +! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. +! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. +! error Make aborted. +! else +! include msvcfullver.~ +! if [del msvcfullver.c msvcfullver.~] +! endif +! endif +!endif + + +# Calculate MSVCRT_VER +!if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 +!include msvcrtver.~ +!if [del msvcrtver.~] +!endif +!endif + +# Base name of the msvcrXX.dll +!if $(MSVCRT_VER) <= 60 +MSVCRT_NAME = msvcrt +!elseif $(MSVCRT_VER) <= 130 +MSVCRT_NAME = msvcr$(MSVCRT_VER) +!else +MSVCRT_NAME = vcruntime$(MSVCRT_VER) +!endif + +!if $(MSVC_MAJOR) == 6 +CPU = ix86 !endif # Flag to turn on Win64 compatibility warnings for VC7.x and VC8. WP64CHECK = /Wp64 +# Use multiprocess build +USE_MP = yes + #>>>>> path of the compiler and linker; name of include and lib directories # PATH = c:\msvc20\bin;$(PATH) # INCLUDE = c:\msvc20\include # LIB = c:\msvc20\lib -!ifndef CTAGS -CTAGS = ctags +!if "$(FEATURES)"=="" +FEATURES = HUGE !endif -!if "$(SNIFF)" == "yes" -# SNIFF - Include support for SNiFF+. -SNIFF_INCL = if_sniff.h -SNIFF_OBJ = $(OBJDIR)/if_sniff.obj -SNIFF_LIB = shell32.lib -SNIFF_DEFS = -DFEAT_SNIFF -# The SNiFF integration needs multithreaded libraries! -MULTITHREADED = yes +!ifndef CTAGS +# this assumes ctags is Exuberant ctags +CTAGS = ctags -I INIT+ --fields=+S !endif !ifndef CSCOPE @@ -272,13 +369,51 @@ CSCOPE_OBJ = $(OBJDIR)/if_cscope.obj CSCOPE_DEFS = -DFEAT_CSCOPE !endif +!ifndef TERMINAL +!if "$(FEATURES)"=="HUGE" +TERMINAL = yes +!else +TERMINAL = no +!endif +!endif + +!if "$(TERMINAL)" == "yes" +TERM_OBJ = \ + $(OBJDIR)/terminal.obj \ + $(OBJDIR)/term_encoding.obj \ + $(OBJDIR)/term_keyboard.obj \ + $(OBJDIR)/term_mouse.obj \ + $(OBJDIR)/term_parser.obj \ + $(OBJDIR)/term_pen.obj \ + $(OBJDIR)/term_screen.obj \ + $(OBJDIR)/term_state.obj \ + $(OBJDIR)/term_unicode.obj \ + $(OBJDIR)/term_vterm.obj +TERM_DEFS = -DFEAT_TERMINAL +TERM_DEPS = \ + libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h \ + libvterm/src/rect.h \ + libvterm/src/utf8.h \ + libvterm/src/vterm_internal.h +!endif + !ifndef NETBEANS NETBEANS = $(GUI) !endif -# Only allow NETBEANS and XPM for a GUI build. +!ifndef CHANNEL +!if "$(FEATURES)"=="HUGE" +CHANNEL = yes +!else +CHANNEL = $(GUI) +!endif +!endif + +# GUI sepcific features. !if "$(GUI)" == "yes" -!if "$(NETBEANS)" == "yes" +# Only allow NETBEANS for a GUI build and CHANNEL. +!if "$(NETBEANS)" == "yes" && "$(CHANNEL)" == "yes" # NETBEANS - Include support for Netbeans integration NETBEANS_PRO = proto/netbeans.pro NETBEANS_OBJ = $(OBJDIR)/netbeans.obj @@ -292,8 +427,21 @@ NBDEBUG_SRC = nbdebug.c NETBEANS_LIB = WSock32.lib !endif +# DirectWrite (DirectX) +!if "$(DIRECTX)" == "yes" +DIRECTX_DEFS = -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +!if "$(COLOR_EMOJI)" != "no" +DIRECTX_DEFS = $(DIRECTX_DEFS) -DFEAT_DIRECTX_COLOR_EMOJI +!endif +DIRECTX_INCL = gui_dwrite.h +DIRECTX_OBJ = $(OUTDIR)\gui_dwrite.obj +!endif + +# Only allow XPM for a GUI build. !ifndef XPM -# XPM is not set, use the included xpm files, depending on the architecture. +!ifndef USE_MSVCRT +# Both XPM and USE_MSVCRT are not set, use the included xpm files, depending +# on the architecture. !if "$(CPU)" == "AMD64" XPM = xpm\x64 !elseif "$(CPU)" == "i386" @@ -301,17 +449,34 @@ XPM = xpm\x86 !else XPM = no !endif -!endif +!else # USE_MSVCRT +XPM = no +!endif # USE_MSVCRT +!endif # XPM !if "$(XPM)" != "no" # XPM - Include support for XPM signs # See the xpm directory for more information. XPM_OBJ = $(OBJDIR)/xpm_w32.obj XPM_DEFS = -DFEAT_XPM_W32 +!if $(MSVC_MAJOR) >= 14 +# VC14 cannot use a library built by VC12 or eariler, because VC14 uses +# Universal CRT. +XPM_LIB = $(XPM)\lib-vc14\libXpm.lib +!else XPM_LIB = $(XPM)\lib\libXpm.lib +!endif XPM_INC = -I $(XPM)\include -I $(XPM)\..\include !endif !endif +!if "$(CHANNEL)" == "yes" +CHANNEL_PRO = proto/channel.pro +CHANNEL_OBJ = $(OBJDIR)/channel.obj +CHANNEL_DEFS = -DFEAT_JOB_CHANNEL + +NETBEANS_LIB = WSock32.lib +!endif + # Set which version of the CRT to use !if defined(USE_MSVCRT) # CVARS = $(cvarsdll) @@ -327,15 +492,14 @@ XPM_INC = -I $(XPM)\include -I $(XPM)\..\include # gdi32.lib and comdlg32.lib for printing support # ole32.lib and uuid.lib are needed for FEAT_SHORTCUT CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \ - comdlg32.lib ole32.lib uuid.lib /machine:$(CPU) /nodefaultlib + comdlg32.lib ole32.lib uuid.lib /machine:$(CPU) !if "$(DELAYLOAD)" == "yes" CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib !endif ### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET) -# When set to 0x0500 ":browse" stops working. !ifndef WINVER -WINVER = 0x0400 +WINVER = 0x0501 !endif # If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal @@ -344,130 +508,126 @@ WINVER = 0x0400 #VIMRUNTIMEDIR = somewhere CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \ - $(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \ + $(CSCOPE_DEFS) $(TERM_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \ $(NBDEBUG_DEFS) $(XPM_DEFS) \ - $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ - /Fo$(OUTDIR)/ + $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) #>>>>> end of choices ########################################################################### -!ifdef OS -OS_TYPE = winnt DEL_TREE = rmdir /s /q -!else -OS_TYPE = win95 -DEL_TREE = deltree /y -!endif INTDIR=$(OBJDIR) OUTDIR=$(OBJDIR) -# Derive version of VC being used from nmake if not specified -!if "$(MSVCVER)" == "" -!if "$(_NMAKE_VER)" == "" -MSVCVER = 4.0 -!endif -!if "$(_NMAKE_VER)" == "162" -MSVCVER = 5.0 -!endif -!if "$(_NMAKE_VER)" == "6.00.8168.0" -MSVCVER = 6.0 -CPU = ix86 -!endif -!if "$(_NMAKE_VER)" == "6.00.9782.0" -MSVCVER = 6.0 -CPU = ix86 -!endif -!if "$(_NMAKE_VER)" == "7.00.9466" -MSVCVER = 7.0 -!endif -!if "$(_NMAKE_VER)" == "7.10.3077" -MSVCVER = 7.1 -!endif -!if "$(_NMAKE_VER)" == "8.00.50727.42" -MSVCVER = 8.0 -!endif -!if "$(_NMAKE_VER)" == "8.00.50727.762" -MSVCVER = 8.0 -!endif -!if "$(_NMAKE_VER)" == "9.00.20706.01" -MSVCVER = 9.0 -!endif -!if "$(_NMAKE_VER)" == "9.00.21022.08" -MSVCVER = 9.0 -!endif -!if "$(_NMAKE_VER)" == "9.00.30729.01" -MSVCVER = 9.0 -!endif -!if "$(_NMAKE_VER)" == "10.00.20506.01" -MSVCVER = 10.0 -!endif -!if "$(_NMAKE_VER)" == "10.00.30128.01" -MSVCVER = 10.0 -!endif -!if "$(_NMAKE_VER)" == "10.00.30319.01" -MSVCVER = 10.0 -!endif -!if "$(_NMAKE_VER)" == "10.00.40219.01" -MSVCVER = 10.0 -!endif -!if "$(_NMAKE_VER)" == "11.00.50727.1" -MSVCVER = 11.0 -!endif -!if "$(_NMAKE_VER)" == "11.00.51106.1" -MSVCVER = 11.0 -!endif -!if "$(_NMAKE_VER)" == "11.00.60315.1" -MSVCVER = 11.0 -!endif -!if "$(_NMAKE_VER)" == "11.00.60610.1" -MSVCVER = 11.0 -!endif -!if "$(_NMAKE_VER)" == "11.00.61030.0" -MSVCVER = 11.0 -!endif -!if "$(_NMAKE_VER)" == "12.00.21005.1" -MSVCVER = 12.0 -!endif -!endif - -# Abort building VIM if version of VC is unrecognised. -!ifndef MSVCVER -!message *** ERROR -!message Cannot determine Visual C version being used. If you are using the -!message Windows SDK then you must have the environment variable MSVCVER set to -!message your version of the VC compiler. If you are not using the Express -!message version of Visual C, you can either set MSVCVER or update this makefile -!message to handle the new value for _NMAKE_VER, "$(_NMAKE_VER)". -!error Make aborted. +### Validate CPUNR +!ifndef CPUNR +# default to untargeted code +CPUNR = any +!elseif "$(CPUNR)" == "i386" || "$(CPUNR)" == "i486" +# alias i386 and i486 to i586 +! message *** WARNING CPUNR=$(CPUNR) is not a valid target architecture. +! message Windows XP is the minimum target OS, with a minimum target +! message architecture of i586. +! message Retargeting to i586 +CPUNR = i586 +!elseif "$(CPUNR)" == "pentium4" +# alias pentium4 to sse2 +! message *** WARNING CPUNR=pentium4 is deprecated in favour of sse2. +! message Retargeting to sse2. +CPUNR = sse2 +!elseif "$(CPUNR)" != "any" && "$(CPUNR)" != "i586" && "$(CPUNR)" != "i686" && "$(CPUNR)" != "sse" && "$(CPUNR)" != "sse2" && "$(CPUNR)" != "avx" && "$(CPUNR)" != "avx2" +! error *** ERROR Unknown target architecture "$(CPUNR)". Make aborted. !endif # Convert processor ID to MVC-compatible number -!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0") && ("$(MSVCVER)" != "11.0") && ("$(MSVCVER)" != "12.0") -!if "$(CPUNR)" == "i386" -CPUARG = /G3 -!elseif "$(CPUNR)" == "i486" -CPUARG = /G4 -!elseif "$(CPUNR)" == "i586" +!if $(MSVC_MAJOR) < 8 +! if "$(CPUNR)" == "i586" CPUARG = /G5 -!elseif "$(CPUNR)" == "i686" +! elseif "$(CPUNR)" == "i686" CPUARG = /G6 -!elseif "$(CPUNR)" == "pentium4" +! elseif "$(CPUNR)" == "sse" +CPUARG = /G6 /arch:SSE +! elseif "$(CPUNR)" == "sse2" CPUARG = /G7 /arch:SSE2 -!else +! elseif "$(CPUNR)" == "avx" || "$(CPUNR)" == "avx2" +! message AVX/AVX2 Instruction Sets are not supported by Visual C++ v$(MSVC_MAJOR) +! message Falling back to SSE2 +CPUARG = /G7 /arch:SSE2 +! elseif "$(CPUNR)" == "any" CPUARG = -!endif +! endif !else -# VC8/9/10 only allows specifying SSE architecture but only for 32bit -!if "$(ASSEMBLY_ARCHITECTURE)" == "x86" && "$(CPUNR)" == "pentium4" +# IA32/SSE/SSE2 are only supported on x86 +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && ("$(CPUNR)" == "i586" || "$(CPUNR)" == "i686" || "$(CPUNR)" == "any") +# VC<11 generates fp87 code by default +! if $(MSVC_MAJOR) < 11 +CPUARG = +# VC>=11 needs explicit insturctions to generate fp87 code +! else +CPUARG = /arch:IA32 +! endif +! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse" +CPUARG = /arch:SSE +! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse2" CPUARG = /arch:SSE2 +! elseif "$(CPUNR)" == "avx" +# AVX is only supported by VC 10 and up +! if $(MSVC_MAJOR) < 10 +! message AVX Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR) +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" +! message Falling back to SSE2 +CPUARG = /arch:SSE2 +! else +CPUARG = +! endif +! else +CPUARG = /arch:AVX +! endif +! elseif "$(CPUNR)" == "avx2" +# AVX is only supported by VC 10 and up +! if $(MSVC_MAJOR) < 10 +! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR) +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" +! message Falling back to SSE2 +CPUARG = /arch:SSE2 +! else +CPUARG = +! endif +# AVX2 is only supported by VC 12U2 and up +# 180030501 is the full version number for Visual Studio 2013/VC 12 Update 2 +! elseif $(MSVC_FULL) < 180030501 +! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL) +! message Falling back to AVX +CPUARG = /arch:AVX +! else +CPUARG = /arch:AVX2 +! endif +! endif !endif -!endif + +# Pass CPUARG to GvimExt, to avoid using version-dependent defaults +MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)" + LIBC = DEBUGINFO = /Zi +# Don't use /nodefaultlib on MSVC 14 +!if $(MSVC_MAJOR) >= 14 +NODEFAULTLIB = +!else +NODEFAULTLIB = /nodefaultlib +!endif + +# Use multiprocess build on MSVC 10 +!if "$(USE_MP)"=="yes" +!if $(MSVC_MAJOR) >= 10 +CFLAGS = $(CFLAGS) /MP +!endif +!endif + + !ifdef NODEBUG VIM = vim !if "$(OPTIMIZE)" == "SPACE" @@ -478,7 +638,7 @@ OPTFLAG = /O2 OPTFLAG = /Ox !endif -!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0") +!if $(MSVC_MAJOR) >= 8 # Use link time code generation if not worried about size !if "$(OPTIMIZE)" != "SPACE" OPTFLAG = $(OPTFLAG) /GL @@ -486,12 +646,18 @@ OPTFLAG = $(OPTFLAG) /GL !endif # (/Wp64 is deprecated in VC9 and generates an obnoxious warning.) -!if ("$(MSVCVER)" == "7.0") || ("$(MSVCVER)" == "7.1") || ("$(MSVCVER)" == "8.0") +!if ($(MSVC_MAJOR) == 7) || ($(MSVC_MAJOR) == 8) CFLAGS=$(CFLAGS) $(WP64CHECK) !endif -# Static code analysis generally available starting with VS2012 -!if ("$(ANALYZE)" == "yes") && (("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0")) +# VC10 or later has stdint.h. +!if $(MSVC_MAJOR) >= 10 +CFLAGS = $(CFLAGS) -DHAVE_STDINT_H +!endif + +# Static code analysis generally available starting with VS2012 (VC11) or +# Windows SDK 7.1 (VC10) +!if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10) CFLAGS=$(CFLAGS) /analyze !endif @@ -512,7 +678,7 @@ DEBUGINFO = /ZI CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG # The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0. -! if "$(MSVCVER)" == "4.0" +! if $(MSVC_MAJOR) == 4 LIBC = ! else LIBC = /fixed:no @@ -526,28 +692,37 @@ CFLAGS = $(CFLAGS) /Zl /MTd ! endif !endif # DEBUG -INCL = vim.h os_win32.h ascii.h feature.h globals.h keymap.h macros.h \ - proto.h option.h structs.h term.h $(SNIFF_INCL) $(CSCOPE_INCL) \ - $(NBDEBUG_INCL) +INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \ + keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \ + spell.h structs.h term.h beval.h $(NBDEBUG_INCL) OBJ = \ + $(OUTDIR)\arabic.obj \ + $(OUTDIR)\beval.obj \ $(OUTDIR)\blowfish.obj \ $(OUTDIR)\buffer.obj \ $(OUTDIR)\charset.obj \ + $(OUTDIR)\crypt.obj \ + $(OUTDIR)\crypt_zip.obj \ + $(OUTDIR)\dict.obj \ $(OUTDIR)\diff.obj \ $(OUTDIR)\digraph.obj \ $(OUTDIR)\edit.obj \ $(OUTDIR)\eval.obj \ + $(OUTDIR)\evalfunc.obj \ $(OUTDIR)\ex_cmds.obj \ $(OUTDIR)\ex_cmds2.obj \ $(OUTDIR)\ex_docmd.obj \ $(OUTDIR)\ex_eval.obj \ $(OUTDIR)\ex_getln.obj \ + $(OUTDIR)\farsi.obj \ $(OUTDIR)\fileio.obj \ $(OUTDIR)\fold.obj \ $(OUTDIR)\getchar.obj \ $(OUTDIR)\hardcopy.obj \ $(OUTDIR)\hashtab.obj \ + $(OUTDIR)\json.obj \ + $(OUTDIR)\list.obj \ $(OUTDIR)\main.obj \ $(OUTDIR)\mark.obj \ $(OUTDIR)\mbyte.obj \ @@ -572,11 +747,13 @@ OBJ = \ $(OUTDIR)\search.obj \ $(OUTDIR)\sha256.obj \ $(OUTDIR)\spell.obj \ + $(OUTDIR)\spellfile.obj \ $(OUTDIR)\syntax.obj \ $(OUTDIR)\tag.obj \ $(OUTDIR)\term.obj \ $(OUTDIR)\ui.obj \ $(OUTDIR)\undo.obj \ + $(OUTDIR)\userfunc.obj \ $(OUTDIR)\window.obj \ $(OUTDIR)\vim.res @@ -616,19 +793,7 @@ CFLAGS = $(CFLAGS) -DFEAT_GUI_W32 RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32 VIM = g$(VIM) GUI_INCL = \ - gui.h \ - regexp.h \ - ascii.h \ - ex_cmds.h \ - farsi.h \ - feature.h \ - globals.h \ - gui_beval.h \ - keymap.h \ - macros.h \ - option.h \ - os_dos.h \ - os_win32.h + gui.h GUI_OBJ = \ $(OUTDIR)\gui.obj \ $(OUTDIR)\gui_beval.obj \ @@ -637,9 +802,26 @@ GUI_OBJ = \ GUI_LIB = \ gdi32.lib version.lib $(IME_LIB) \ winspool.lib comctl32.lib advapi32.lib shell32.lib \ - /machine:$(CPU) /nodefaultlib + /machine:$(CPU) !else SUBSYSTEM = console +CUI_INCL = iscygpty.h +CUI_OBJ = $(OUTDIR)\iscygpty.obj +!endif +SUBSYSTEM_TOOLS = console + +!if "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) +SUBSYSTEM_TOOLS = $(SUBSYSTEM_TOOLS),$(SUBSYSTEM_VER) +# Pass SUBSYSTEM_VER to GvimExt and other tools +MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) SUBSYSTEM_VER=$(SUBSYSTEM_VER) +MAKEFLAGS_TOOLS = $(MAKEFLAGS_TOOLS) SUBSYSTEM_VER=$(SUBSYSTEM_VER) +!endif + +!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes" +CFLAGS = $(CFLAGS) $(DIRECTX_DEFS) +GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL) +GUI_OBJ = $(GUI_OBJ) $(DIRECTX_OBJ) !endif # iconv.dll library (dynamically loaded) @@ -658,16 +840,26 @@ GETTEXT = yes CFLAGS = $(CFLAGS) -DDYNAMIC_GETTEXT !endif +# +# Support Migemo +# +!ifdef MIGEMO +!message Migemo supported - will be dynamic linked. +CFLAGS = $(CFLAGS) -DDYNAMIC_MIGEMO +!endif + # TCL interface !ifdef TCL !ifndef TCL_VER -TCL_VER = 83 -TCL_VER_LONG = 8.3 +TCL_VER = 86 +TCL_VER_LONG = 8.6 !endif !message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)" !if "$(DYNAMIC_TCL)" == "yes" !message Tcl DLL will be loaded dynamically +!ifndef TCL_DLL TCL_DLL = tcl$(TCL_VER).dll +!endif CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \ -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\" TCL_OBJ = $(OUTDIR)\if_tcl.obj @@ -684,7 +876,7 @@ TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib # Lua interface !ifdef LUA !ifndef LUA_VER -LUA_VER = 51 +LUA_VER = 53 !endif !message Lua requested (version $(LUA_VER)) - root dir is "$(LUA)" !if "$(DYNAMIC_LUA)" == "yes" @@ -712,7 +904,7 @@ DYNAMIC_PYTHON3=yes # PYTHON interface !ifdef PYTHON !ifndef PYTHON_VER -PYTHON_VER = 22 +PYTHON_VER = 27 !endif !message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)" !if "$(DYNAMIC_PYTHON)" == "yes" @@ -733,7 +925,7 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib # PYTHON3 interface !ifdef PYTHON3 !ifndef PYTHON3_VER -PYTHON3_VER = 31 +PYTHON3_VER = 36 !endif !message Python3 requested (version $(PYTHON3_VER)) - root dir is "$(PYTHON3)" !if "$(DYNAMIC_PYTHON3)" == "yes" @@ -755,55 +947,66 @@ PYTHON3_LIB = $(PYTHON3)\libs\python$(PYTHON3_VER).lib !ifdef MZSCHEME !message MzScheme requested - root dir is "$(MZSCHEME)" !ifndef MZSCHEME_VER -MZSCHEME_VER = 205_000 +MZSCHEME_VER = 3m_a0solc !endif -CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include -!if EXIST("$(MZSCHEME)\collects\scheme\base.ss") \ - || EXIST("$(MZSCHEME)\collects\scheme\base.rkt") -# for MzScheme >= 4 we need to include byte code for basic Scheme stuff -MZSCHEME_EXTRA_DEP = mzscheme_base.c -CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE +!ifndef MZSCHEME_COLLECTS +MZSCHEME_COLLECTS=$(MZSCHEME)\collects !endif +CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I "$(MZSCHEME)\include" !if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") MZSCHEME_MAIN_LIB=mzsch !else MZSCHEME_MAIN_LIB=racket !endif -!if EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \ - && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib") +!if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \ + && !EXIST("$(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll")) \ + || (EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \ + && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")) !message Building with Precise GC MZSCHEME_PRECISE_GC = yes CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC !endif !if "$(DYNAMIC_MZSCHEME)" == "yes" +!message MzScheme DLLs will be loaded dynamically +CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME !if "$(MZSCHEME_PRECISE_GC)" == "yes" -!error MzScheme with Precise GC cannot be loaded dynamically +# Precise GC does not use separate dll +CFLAGS = $(CFLAGS) \ + -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ + -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" +!else +CFLAGS = $(CFLAGS) \ + -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ + -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" !endif -!message MzScheme DLLs will be loaded dynamically -CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \ - -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ - -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" !else !if "$(MZSCHEME_DEBUG)" == "yes" CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC !endif !if "$(MZSCHEME_PRECISE_GC)" == "yes" # Precise GC does not use separate dll -MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib +!if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def") +# create .lib from .def +MZSCHEME_LIB = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib +MZSCHEME_EXTRA_DEP = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib +!else +MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib" +!endif !else -MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \ - $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib +MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \ + "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib" !endif !endif MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj # increase stack size MZSCHEME_LIB = $(MZSCHEME_LIB) /STACK:8388608 +MZSCHEME_INCL = if_mzsch.h !endif # Perl interface !ifdef PERL !ifndef PERL_VER -PERL_VER = 56 +PERL_VER = 524 !endif !message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)" !if "$(DYNAMIC_PERL)" == "yes" @@ -836,7 +1039,7 @@ PERL_LIB = $(PERL_INCDIR)\libperl$(PERL_VER).a !endif !endif -CFLAGS = $(CFLAGS) -DFEAT_PERL +CFLAGS = $(CFLAGS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS # Do we want to load Perl dynamically? !if "$(DYNAMIC_PERL)" == "yes" @@ -846,6 +1049,11 @@ CFLAGS = $(CFLAGS) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"$(PERL_DLL)\" PERL_EXE = $(PERL)\Bin$(PERL_ARCH)\perl PERL_INC = /I $(PERL_INCDIR) +!if $(MSVC_MAJOR) <= 11 +# ActivePerl 5.20+ requires stdbool.h but VC2012 or earlier doesn't have it. +# Use a stub stdbool.h. +PERL_INC = $(PERL_INC) /I if_perl_msvc +!endif PERL_OBJ = $(OUTDIR)\if_perl.obj $(OUTDIR)\if_perlsfio.obj XSUBPP = $(PERL)\lib\ExtUtils\xsubpp !if exist($(XSUBPP)) @@ -863,38 +1071,61 @@ XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap !ifdef RUBY # Set default value !ifndef RUBY_VER -RUBY_VER = 18 +RUBY_VER = 22 !endif !ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.8 +RUBY_VER_LONG = 2.2.0 +!endif +!ifndef RUBY_API_VER_LONG +RUBY_API_VER_LONG = $(RUBY_VER_LONG) !endif !ifndef RUBY_API_VER -RUBY_API_VER = $(RUBY_VER_LONG:.=) +RUBY_API_VER = $(RUBY_API_VER_LONG:.=) !endif !if $(RUBY_VER) >= 18 + !ifndef RUBY_PLATFORM +!if "$(CPU)" == "i386" RUBY_PLATFORM = i386-mswin32 -!endif +!else # CPU +RUBY_PLATFORM = x64-mswin64 +!endif # CPU +!if $(MSVCRT_VER) >= 70 && $(RUBY_VER) > 19 +RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER) +!endif # MSVCRT_VER +!endif # RUBY_PLATFORM + !ifndef RUBY_INSTALL_NAME -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) -!endif -!else +!ifndef RUBY_MSVCRT_NAME +# Base name of msvcrXX.dll which is used by ruby's dll. +RUBY_MSVCRT_NAME = $(MSVCRT_NAME) +!endif # RUBY_MSVCRT_NAME +!if "$(CPU)" == "i386" +RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) +!else # CPU +RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) +!endif # CPU +!endif # RUBY_INSTALL_NAME + +!else # $(RUBY_VER) >= 18 + !ifndef RUBY_PLATFORM RUBY_PLATFORM = i586-mswin32 !endif !ifndef RUBY_INSTALL_NAME RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) !endif + !endif # $(RUBY_VER) >= 18 !message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)" CFLAGS = $(CFLAGS) -DFEAT_RUBY RUBY_OBJ = $(OUTDIR)\if_ruby.obj !if $(RUBY_VER) >= 19 -RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM)" /I "$(RUBY)\include\ruby-$(RUBY_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_VER_LONG)\$(RUBY_PLATFORM)" +RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" !else -RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM)" +RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" !endif RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib # Do we want to load Ruby dynamically? @@ -916,9 +1147,6 @@ CFLAGS = $(CFLAGS) -DMSWINPS # # FEATURES: TINY, SMALL, NORMAL, BIG or HUGE # -!if "$(FEATURES)"=="" -FEATURES = BIG -!endif CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES) # @@ -935,7 +1163,12 @@ LINK_PDB = /PDB:$(VIM).pdb -debug # !message -conflags = /nologo /subsystem:$(SUBSYSTEM) +# CFLAGS with /Fo$(OUTDIR)/ +CFLAGS_OUTDIR=$(CFLAGS) /Fo$(OUTDIR)/ + +# Add /opt:ref to remove unreferenced functions and data even when /DEBUG is +# added. +conflags = /nologo /subsystem:$(SUBSYSTEM) /opt:ref PATHDEF_SRC = $(OUTDIR)\pathdef.c @@ -948,30 +1181,42 @@ conflags = $(conflags) /map /mapinfo:lines !ENDIF LINKARGS1 = $(linkdebug) $(conflags) -LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \ +LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib \ $(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \ $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB) # Report link time code generation progress if used. !ifdef NODEBUG -!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0") +!if $(MSVC_MAJOR) >= 8 !if "$(OPTIMIZE)" != "SPACE" LINKARGS1 = $(LINKARGS1) /LTCG:STATUS !endif !endif !endif -all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \ - GvimExt/gvimext.dll +!if $(MSVC_MAJOR) >= 11 && "$(CPU)" == "AMD64" && "$(GUI)" == "yes" +# This option is required for VC2012 or later so that 64-bit gvim can +# accept D&D from 32-bit applications. NOTE: This disables 64-bit ASLR, +# therefore the security level becomes as same as VC2010. +LINKARGS1 = $(LINKARGS1) /HIGHENTROPYVA:NO +!endif + +all: $(VIM).exe \ + vimrun.exe \ + install.exe \ + uninstal.exe \ + xxd/xxd.exe \ + tee/tee.exe \ + GvimExt/gvimext.dll -$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \ +$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \ $(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \ - $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \ + $(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \ version.c version.h - $(CC) $(CFLAGS) version.c - $(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \ + $(CC) $(CFLAGS_OUTDIR) version.c + $(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) \ $(LUA_OBJ) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) \ - $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) \ + $(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \ $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2) if exist $(VIM).exe.manifest mt.exe -nologo -manifest $(VIM).exe.manifest -updateresource:$(VIM).exe;1 @@ -982,29 +1227,42 @@ $(OUTDIR): install.exe: dosinst.c $(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib \ - user32.lib ole32.lib advapi32.lib uuid.lib + user32.lib ole32.lib advapi32.lib uuid.lib \ + -link -subsystem:$(SUBSYSTEM_TOOLS) - if exist install.exe del install.exe ren dosinst.exe install.exe + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 uninstal.exe: uninstal.c - $(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib + $(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib \ + -link -subsystem:$(SUBSYSTEM_TOOLS) + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 vimrun.exe: vimrun.c - $(CC) /nologo -DNDEBUG vimrun.c + $(CC) /nologo -DNDEBUG vimrun.c -link -subsystem:$(SUBSYSTEM_TOOLS) + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 xxd/xxd.exe: xxd/xxd.c cd xxd - $(MAKE) /NOLOGO -f Make_mvc.mak + $(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS) cd .. + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 + +tee/tee.exe: tee/tee.c + cd tee + $(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS) + cd .. + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h cd GvimExt $(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT) cd .. + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 tags: notags - $(CTAGS) *.c *.cpp *.h if_perl.xs proto\*.pro + $(CTAGS) *.c *.cpp *.h if_perl.xs notags: - if exist tags del tags @@ -1013,6 +1271,7 @@ clean: - if exist $(OUTDIR)/nul $(DEL_TREE) $(OUTDIR) - if exist *.obj del *.obj - if exist $(VIM).exe del $(VIM).exe + - if exist $(VIM).exe.manifest del $(VIM).exe.manifest - if exist $(VIM).ilk del $(VIM).ilk - if exist $(VIM).pdb del $(VIM).pdb - if exist $(VIM).map del $(VIM).map @@ -1025,12 +1284,11 @@ clean: - if exist dimm_i.c del dimm_i.c - if exist dimm.tlb del dimm.tlb - if exist dosinst.exe del dosinst.exe - - if exist mzscheme_base.c del mzscheme_base.c cd xxd $(MAKE) /NOLOGO -f Make_mvc.mak clean cd .. - cd GvimExt - $(MAKE) /NOLOGO -f Makefile clean + cd tee + $(MAKE) /NOLOGO -f Make_mvc.mak clean cd .. cd GvimExt $(MAKE) /NOLOGO -f Makefile clean @@ -1042,6 +1300,11 @@ test: $(MAKE) /NOLOGO -f Make_dos.mak win32 cd .. +testgvim: + cd testdir + $(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim win32 + cd .. + testclean: cd testdir $(MAKE) /NOLOGO -f Make_dos.mak clean @@ -1051,21 +1314,25 @@ testclean: # Create a default rule for transforming .c files to .obj files in $(OUTDIR) # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later) -!IF "$(MSVCVER)" == "4.0" +!IF "$(_NMAKE_VER)" == "" .c{$(OUTDIR)/}.obj: !ELSE .c{$(OUTDIR)/}.obj:: !ENDIF - $(CC) $(CFLAGS) $< + $(CC) $(CFLAGS_OUTDIR) $< # Create a default rule for transforming .cpp files to .obj files in $(OUTDIR) # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later) -!IF "$(MSVCVER)" == "4.0" +!IF "$(_NMAKE_VER)" == "" .cpp{$(OUTDIR)/}.obj: !ELSE .cpp{$(OUTDIR)/}.obj:: !ENDIF - $(CC) $(CFLAGS) $< + $(CC) $(CFLAGS_OUTDIR) $< + +$(OUTDIR)/arabic.obj: $(OUTDIR) arabic.c $(INCL) + +$(OUTDIR)/beval.obj: $(OUTDIR) beval.c $(INCL) $(OUTDIR)/blowfish.obj: $(OUTDIR) blowfish.c $(INCL) @@ -1073,6 +1340,12 @@ $(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL) $(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL) +$(OUTDIR)/crypt.obj: $(OUTDIR) crypt.c $(INCL) + +$(OUTDIR)/crypt_zip.obj: $(OUTDIR) crypt_zip.c $(INCL) + +$(OUTDIR)/dict.obj: $(OUTDIR) dict.c $(INCL) + $(OUTDIR)/diff.obj: $(OUTDIR) diff.c $(INCL) $(OUTDIR)/digraph.obj: $(OUTDIR) digraph.c $(INCL) @@ -1081,16 +1354,20 @@ $(OUTDIR)/edit.obj: $(OUTDIR) edit.c $(INCL) $(OUTDIR)/eval.obj: $(OUTDIR) eval.c $(INCL) +$(OUTDIR)/evalfunc.obj: $(OUTDIR) evalfunc.c $(INCL) + $(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL) $(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL) -$(OUTDIR)/ex_docmd.obj: $(OUTDIR) ex_docmd.c $(INCL) ex_cmds.h +$(OUTDIR)/ex_docmd.obj: $(OUTDIR) ex_docmd.c $(INCL) -$(OUTDIR)/ex_eval.obj: $(OUTDIR) ex_eval.c $(INCL) ex_cmds.h +$(OUTDIR)/ex_eval.obj: $(OUTDIR) ex_eval.c $(INCL) $(OUTDIR)/ex_getln.obj: $(OUTDIR) ex_getln.c $(INCL) +$(OUTDIR)/farsi.obj: $(OUTDIR) farsi.c $(INCL) + $(OUTDIR)/fileio.obj: $(OUTDIR) fileio.c $(INCL) $(OUTDIR)/fold.obj: $(OUTDIR) fold.c $(INCL) @@ -1105,47 +1382,54 @@ $(OUTDIR)/gui.obj: $(OUTDIR) gui.c $(INCL) $(GUI_INCL) $(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL) -$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL) +$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c $(INCL) $(GUI_INCL) -$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) +$(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL) + +$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) if_cscope.h $(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL) - $(CC) $(CFLAGS) $(LUA_INC) if_lua.c + $(CC) $(CFLAGS_OUTDIR) $(LUA_INC) if_lua.c if_perl.c : if_perl.xs typemap $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \ - -typemap typemap if_perl.xs > if_perl.c + -typemap typemap if_perl.xs -output if_perl.c $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL) - $(CC) $(CFLAGS) $(PERL_INC) if_perl.c + $(CC) $(CFLAGS_OUTDIR) $(PERL_INC) if_perl.c $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL) - $(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c + $(CC) $(CFLAGS_OUTDIR) $(PERL_INC) if_perlsfio.c + +$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(MZSCHEME_INCL) $(INCL) $(MZSCHEME_EXTRA_DEP) + $(CC) $(CFLAGS_OUTDIR) if_mzsch.c \ + -DMZSCHEME_COLLECTS="\"$(MZSCHEME_COLLECTS:\=\\)\"" -$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c if_mzsch.h $(INCL) $(MZSCHEME_EXTRA_DEP) - $(CC) $(CFLAGS) if_mzsch.c \ - -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\" -mzscheme_base.c: - $(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base +lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib: + lib /DEF:"$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def" $(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c if_py_both.h $(INCL) - $(CC) $(CFLAGS) $(PYTHON_INC) if_python.c + $(CC) $(CFLAGS_OUTDIR) $(PYTHON_INC) if_python.c $(OUTDIR)/if_python3.obj: $(OUTDIR) if_python3.c if_py_both.h $(INCL) - $(CC) $(CFLAGS) $(PYTHON3_INC) if_python3.c + $(CC) $(CFLAGS_OUTDIR) $(PYTHON3_INC) if_python3.c $(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp $(INCL) if_ole.h $(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c $(INCL) - $(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c - -$(OUTDIR)/if_sniff.obj: $(OUTDIR) if_sniff.c $(INCL) - $(CC) $(CFLAGS) if_sniff.c + $(CC) $(CFLAGS_OUTDIR) $(RUBY_INC) if_ruby.c $(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c $(INCL) - $(CC) $(CFLAGS) $(TCL_INC) if_tcl.c + $(CC) $(CFLAGS_OUTDIR) $(TCL_INC) if_tcl.c + +$(OUTDIR)/iscygpty.obj: $(OUTDIR) iscygpty.c $(CUI_INCL) + $(CC) $(CFLAGS_OUTDIR) iscygpty.c -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL + +$(OUTDIR)/json.obj: $(OUTDIR) json.c $(INCL) + +$(OUTDIR)/list.obj: $(OUTDIR) list.c $(INCL) -$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL) +$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL) $(CUI_INCL) $(OUTDIR)/mark.obj: $(OUTDIR) mark.c $(INCL) @@ -1167,6 +1451,8 @@ $(OUTDIR)/mbyte.obj: $(OUTDIR) mbyte.c $(INCL) $(OUTDIR)/netbeans.obj: $(OUTDIR) netbeans.c $(NBDEBUG_SRC) $(INCL) +$(OUTDIR)/channel.obj: $(OUTDIR) channel.c $(INCL) + $(OUTDIR)/normal.obj: $(OUTDIR) normal.c $(INCL) $(OUTDIR)/option.obj: $(OUTDIR) option.c $(INCL) @@ -1175,14 +1461,16 @@ $(OUTDIR)/ops.obj: $(OUTDIR) ops.c $(INCL) $(OUTDIR)/os_mswin.obj: $(OUTDIR) os_mswin.c $(INCL) +$(OUTDIR)/terminal.obj: $(OUTDIR) terminal.c $(INCL) $(TERM_DEPS) + $(OUTDIR)/winclip.obj: $(OUTDIR) winclip.c $(INCL) -$(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h +$(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) $(MZSCHEME_INCL) $(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL) $(OUTDIR)/pathdef.obj: $(OUTDIR) $(PATHDEF_SRC) $(INCL) - $(CC) $(CFLAGS) $(PATHDEF_SRC) + $(CC) $(CFLAGS_OUTDIR) $(PATHDEF_SRC) $(OUTDIR)/popupmnu.obj: $(OUTDIR) popupmnu.c $(INCL) @@ -1198,6 +1486,8 @@ $(OUTDIR)/sha256.obj: $(OUTDIR) sha256.c $(INCL) $(OUTDIR)/spell.obj: $(OUTDIR) spell.c $(INCL) +$(OUTDIR)/spellfile.obj: $(OUTDIR) spellfile.c $(INCL) + $(OUTDIR)/syntax.obj: $(OUTDIR) syntax.c $(INCL) $(OUTDIR)/tag.obj: $(OUTDIR) tag.c $(INCL) @@ -1208,15 +1498,17 @@ $(OUTDIR)/ui.obj: $(OUTDIR) ui.c $(INCL) $(OUTDIR)/undo.obj: $(OUTDIR) undo.c $(INCL) +$(OUTDIR)/userfunc.obj: $(OUTDIR) userfunc.c $(INCL) + $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL) $(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c - $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c + $(CC) $(CFLAGS_OUTDIR) $(XPM_INC) xpm_w32.c $(OUTDIR)/vim.res: $(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp \ - tearoff.bmp vim.ico vim_error.ico \ + tearoff.bmp vim2.ico vim_error.ico \ vim_alert.ico vim_info.ico vim_quest.ico - $(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc + $(RC) /nologo /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc iid_ole.c if_ole.h vim.tlb: if_ole.idl midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb \ @@ -1229,6 +1521,41 @@ $(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL) $(OUTDIR)/glbl_ime.obj: $(OUTDIR) glbl_ime.cpp dimm.h $(INCL) + +CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" \ + -DVSNPRINTF=vim_vsnprintf \ + -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \ + -DWCWIDTH_FUNCTION=utf_uint2cells \ + -D_CRT_SECURE_NO_WARNINGS + +$(OUTDIR)/term_encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/encoding.c + +$(OUTDIR)/term_keyboard.obj: $(OUTDIR) libvterm/src/keyboard.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/keyboard.c + +$(OUTDIR)/term_mouse.obj: $(OUTDIR) libvterm/src/mouse.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/mouse.c + +$(OUTDIR)/term_parser.obj: $(OUTDIR) libvterm/src/parser.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/parser.c + +$(OUTDIR)/term_pen.obj: $(OUTDIR) libvterm/src/pen.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/pen.c + +$(OUTDIR)/term_screen.obj: $(OUTDIR) libvterm/src/screen.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/screen.c + +$(OUTDIR)/term_state.obj: $(OUTDIR) libvterm/src/state.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/state.c + +$(OUTDIR)/term_unicode.obj: $(OUTDIR) libvterm/src/unicode.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/unicode.c + +$(OUTDIR)/term_vterm.obj: $(OUTDIR) libvterm/src/vterm.c $(TERM_DEPS) + $(CCCTERM) -Fo$@ libvterm/src/vterm.c + + # $CFLAGS may contain backslashes and double quotes, escape them both. E0_CFLAGS = $(CFLAGS:\=\\) E_CFLAGS = $(E0_CFLAGS:"=\") @@ -1254,22 +1581,30 @@ auto: # End Custom Build proto.h: \ + proto/arabic.pro \ proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ + proto/dict.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ proto/eval.pro \ + proto/evalfunc.pro \ proto/ex_cmds.pro \ proto/ex_cmds2.pro \ proto/ex_docmd.pro \ proto/ex_eval.pro \ proto/ex_getln.pro \ + proto/farsi.pro \ proto/fileio.pro \ proto/getchar.pro \ proto/hardcopy.pro \ proto/hashtab.pro \ + proto/json.pro \ + proto/list.pro \ proto/main.pro \ proto/mark.pro \ proto/memfile.pro \ @@ -1293,13 +1628,16 @@ proto.h: \ proto/search.pro \ proto/sha256.pro \ proto/spell.pro \ + proto/spellfile.pro \ proto/syntax.pro \ proto/tag.pro \ proto/term.pro \ proto/ui.pro \ proto/undo.pro \ + proto/userfunc.pro \ proto/window.pro \ - $(NETBEANS_PRO) + $(NETBEANS_PRO) \ + $(CHANNEL_PRO) .SUFFIXES: .cod .i @@ -1312,5 +1650,4 @@ proto.h: \ .c.i: $(CC) $(CFLAGS) /P /C $< - # vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_os2.mak b/src/Make_os2.mak deleted file mode 100644 index 42dbdb346e..0000000000 --- a/src/Make_os2.mak +++ /dev/null @@ -1,159 +0,0 @@ -# -# Makefile for VIM on OS/2 using EMX vim:ts=8:sw=8:tw=78 -# -# Created by: Paul Slootman -# - -### This Makefile has been successfully tested on these systems. -### Check the (*) column for remarks, listed below. -### Later code changes may cause small problems, otherwise Vim is supposed to -### compile and run without problems. -### Just to show that this is just like the Unix version! - -#system: configurations: version (*) tested by: -#------------- ------------------------ ------- - ---------- -#OS/2 Warp HPFS gcc-2.7.2+emx-0.9b -GUI 4.5 Paul Slootman -#OS/2 FAT gcc-2.6.3+emx -GUI 4.5 Karsten Sievert - -#>>>>> choose options: - -### See feature.h for a list of optionals. -### Any other defines can be included here. - -DEFINES = -DUSE_SYSTEM=1 - -#>>>>> name of the compiler and linker, name of lib directory -CC = gcc - -#>>>>> end of choices - -### Name of target(s) -TARGET = vim.exe - -### Names of the tools that are also made -TOOLS = xxd/xxd.exe tee/tee.exe - -########################################################################### - -INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_unix.h structs.h os_os2_cfg.h -CFLAGS = -O2 -fno-strength-reduce -DOS2 -Wall -Iproto $(DEFINES) - -OBJ = \ - blowfish.o \ - buffer.o \ - charset.o \ - diff.o \ - digraph.o \ - edit.o \ - eval.o \ - ex_cmds.o \ - ex_cmds2.o \ - ex_docmd.o \ - ex_eval.o \ - ex_getln.o \ - fileio.o \ - fold.o \ - getchar.o \ - hardcopy.o \ - hashtab.o \ - main.o \ - mark.o \ - memfile.o \ - memline.o \ - menu.o \ - message.o \ - misc1.o \ - misc2.o \ - move.o \ - mbyte.o \ - normal.o \ - ops.o \ - option.o \ - popupmnu.o \ - quickfix.o \ - regexp.o \ - screen.o \ - search.o \ - sha256.o \ - spell.o \ - syntax.o \ - tag.o \ - term.o \ - ui.o \ - undo.o \ - window.o \ - os_unix.o - -LIBS = -ltermcap - -# Default target is making the executable -all: $(TARGET) $(TOOLS) - -# Link the target for normal use -LFLAGS = -Zcrtdll -s -o $(TARGET) $(LIBS) - -$(TARGET): $(OBJ) version.c version.h - $(CC) $(CFLAGS) version.c $(OBJ) $(LFLAGS) - -xxd/xxd.exe: xxd/xxd.c - cd xxd & $(MAKE) -f Make_os2.mak - -tee/tee.exe: tee/tee.c - cd tee & $(MAKE) -f Makefile - -test: - cd testdir & $(MAKE) -f Make_os2.mak - -clean: - -del *.o - -del *.exe - -del *.~ *~ *.bak - cd xxd & $(MAKE) -f Make_os2.mak clean - cd tee & $(MAKE) -f Makefile clean - -########################################################################### - -os_unix.o: os_unix.c $(INCL) -blowfish.o: blowfish.c $(INCL) -buffer.o: buffer.c $(INCL) -charset.o: charset.c $(INCL) -diff.o: diff.c $(INCL) -digraph.o: digraph.c $(INCL) -edit.o: edit.c $(INCL) -eval.o: eval.c $(INCL) -ex_cmds.o: ex_cmds.c $(INCL) -ex_cmds2.o: ex_cmds2.c $(INCL) -ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h -ex_eval.o: ex_eval.c $(INCL) ex_cmds.h -ex_getln.o: ex_getln.c $(INCL) -fileio.o: fileio.c $(INCL) -fold.o: fold.c $(INCL) -getchar.o: getchar.c $(INCL) -hardcopy.o: hardcopy.c $(INCL) -hashtab.o: hashtab.c $(INCL) -main.o: main.c $(INCL) -mark.o: mark.c $(INCL) -memfile.o: memfile.c $(INCL) -memline.o: memline.c $(INCL) -menu.o: menu.c $(INCL) -message.o: message.c $(INCL) -misc1.o: misc1.c $(INCL) -misc2.o: misc2.c $(INCL) -move.o: move.c $(INCL) -mbyte.o: mbyte.c $(INCL) -normal.o: normal.c $(INCL) -ops.o: ops.c $(INCL) -option.o: option.c $(INCL) -popupmnu.o: popupmnu.c $(INCL) -quickfix.o: quickfix.c $(INCL) -regexp.o: regexp.c $(INCL) -screen.o: screen.c $(INCL) -search.o: search.c $(INCL) -sha256.o: sha256.c $(INCL) -spell.o: spell.c $(INCL) -syntax.o: syntax.c $(INCL) -tag.o: tag.c $(INCL) -term.o: term.c $(INCL) -ui.o: ui.c $(INCL) -undo.o: undo.c $(INCL) -window.o: window.c $(INCL) diff --git a/src/Make_sas.mak b/src/Make_sas.mak index bf57c0dcb2..d07fb5556e 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -89,23 +89,31 @@ CFLAGS4 = $(DEFINES) DATAMEMORY=$(MEMORYTYPE) PROPT = DEF=PROTO GPROTO GPPARM MAXIMUMERRORS=999 GENPROTOSTATICS GENPROTOPARAMETERS SRC = \ + arabic.c \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ + dict.c \ diff.c \ digraph.c \ edit.c \ eval.c \ + evalfunc.c \ ex_cmds.c \ ex_cmds2.c \ ex_docmd.c \ ex_eval.c \ ex_getln.c \ + farsi.c \ fileio.c \ fold.c \ getchar.c \ hardcopy.c \ hashtab.c \ + json.c \ + list.c \ main.c \ mark.c \ memfile.c \ @@ -127,32 +135,42 @@ SRC = \ search.c \ sha256.c \ spell.c \ + spellfile.c \ syntax.c \ tag.c \ term.c \ ui.c \ undo.c \ + userfunc.c \ window.c \ version.c OBJ = \ + arabic.o \ blowfish.o \ buffer.o \ charset.o \ + crypt.o \ + crypt_zip.o \ + dict.o \ diff.o \ digraph.o \ edit.o \ eval.o \ + evalfunc.o \ ex_cmds.o \ ex_cmds2.o \ ex_docmd.o \ ex_eval.o \ ex_getln.o \ + farsi.o \ fileio.o \ fold.o \ getchar.o \ hardcopy.o \ hashtab.o \ + json.o \ + list.o \ main.o \ mark.o \ memfile.o \ @@ -174,32 +192,42 @@ OBJ = \ search.o \ sha256.o \ spell.o \ + spellfile.o \ syntax.o \ tag.o \ term.o \ ui.o \ undo.o \ + userfunc.o \ window.o \ $(TERMLIB) PRO = \ + proto/arabic.pro \ proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ + proto/dict.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ proto/eval.pro \ + proto/evalfunc.pro \ proto/ex_cmds.pro \ proto/ex_cmds2.pro \ proto/ex_docmd.pro \ proto/ex_eval.pro \ proto/ex_getln.pro \ + proto/farsi.pro \ proto/fileio.pro \ proto/fold.pro \ proto/getchar.pro \ proto/hardcopy.pro \ proto/hashtab.pro \ + proto/json.pro \ + proto/list.pro \ proto/main.pro \ proto/mark.pro \ proto/memfile.pro \ @@ -221,12 +249,14 @@ PRO = \ proto/search.pro \ proto/sha256.pro \ proto/spell.pro \ + proto/spellfile.pro \ proto/syntax.pro \ proto/tag.pro \ proto/term.pro \ proto/termlib.pro \ proto/ui.pro \ proto/undo.pro \ + proto/userfunc.pro \ proto/window.pro all: proto Vim @@ -284,12 +314,20 @@ $(PRO): $(GST) vim.h $(CC) $(CFLAGS) GPFILE=proto/$*.pro $(PROPT) $*.c # dependencies +arabic.o: arabic.c +proto/arabic.pro: arabic.c blowfish.o: blowfish.c proto/blowfish.pro: blowfish.c buffer.o: buffer.c proto/buffer.pro: buffer.c charset.o: charset.c proto/charset.pro: charset.c +crypt.o: crypt.c +proto/crypt.pro: crypt.c +crypt_zip.o: crypt_zip.c +proto/crypt_zip.pro: crypt_zip.c +dict.o: dict.c +proto/dict.pro: dict.c diff.o: diff.c proto/diff.pro: diff.c digraph.o: digraph.c @@ -298,6 +336,8 @@ edit.o: edit.c proto/edit.pro: edit.c eval.o: eval.c proto/eval.pro: eval.c +evalfunc.o: evalfunc.c +proto/evalfunc.pro: evalfunc.c ex_cmds.o: ex_cmds.c proto/ex_cmds.pro: ex_cmds.c ex_cmds2.o: ex_cmds2.c @@ -308,6 +348,8 @@ ex_eval.o: ex_eval.c ex_cmds.h proto/ex_eval.pro: ex_eval.c ex_cmds.h ex_getln.o: ex_getln.c proto/ex_getln.pro: ex_getln.c +farsi.o: farsi.c +proto/farsi.pro: farsi.c fileio.o: fileio.c proto/fileio.pro: fileio.c fold.o: fold.c @@ -318,6 +360,10 @@ hardcopy.o: hardcopy.c proto/hardcopy.pro: hardcopy.c hashtab.o: hashtab.c proto/hashtab.pro: hashtab.c +json.o: json.c +proto/json.pro: json.c +list.o: list.c +proto/list.pro: list.c main.o: main.c proto/main.pro: main.c mark.o: mark.c @@ -360,6 +406,8 @@ sha256.o: sha256.c proto/sha256.pro: sha256.c spell.o: spell.c proto/spell.pro: spell.c +spellfile.o: spellfile.c +proto/spellfile.pro: spellfile.c syntax.o: syntax.c proto/syntax.pro: syntax.c tag.o: tag.c @@ -372,4 +420,6 @@ ui.o: ui.c proto/ui.pro: ui.c undo.o: undo.c proto/undo.pro: undo.c +userfunc.o: userfunc.c +proto/userfunc.pro: userfunc.c window.o: window.c diff --git a/src/Make_vms.mms b/src/Make_vms.mms index 4d19bcb2ee..a868da8da6 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -2,7 +2,7 @@ # Makefile for Vim on OpenVMS # # Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com> -# Last change: 2014 Feb 24 +# Last change: 2017 Nov 18 # # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64 # with MMS and MMK @@ -38,7 +38,7 @@ MODEL = HUGE # GUI or terminal mode executable. # Comment out if you want just the character terminal mode only. # GUI with Motif -# GUI = YES +GUI = YES # GUI with GTK # If you have GTK installed you might want to enable this option. @@ -66,7 +66,6 @@ CCVER = YES # VIM_PERL = YES # VIM_PYTHON = YES # VIM_RUBY = YES -# VIM_SNIFF = YES # X Input Method. For entering special languages like chinese and # Japanese. Please define just one: VIM_XIM or VIM_HANGULIN @@ -228,15 +227,6 @@ TCL_LIB = ,OS_VMS_TCL.OPT/OPT TCL_INC = ,dka0:[tcl80.generic] .ENDIF -.IFDEF VIM_SNIFF -# SNIFF related setup. -SNIFF_DEF = ,"FEAT_SNIFF" -SNIFF_SRC = if_sniff.c -SNIFF_OBJ = if_sniff.obj -SNIFF_LIB = -SNIFF_INC = -.ENDIF - .IFDEF VIM_RUBY # RUBY related setup. RUBY_DEF = ,"FEAT_RUBY" @@ -293,7 +283,7 @@ VIMHOST = "''F$TRNLNM("SYS$NODE")'''F$TRNLNM("UCX$INET_HOST")'.''F$TRNLNM("UCX$I .SUFFIXES : .obj .c ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - - $(TCL_DEF)$(SNIFF_DEF)$(RUBY_DEF)$(XIM_DEF)$(HANGULIN_DEF)$(TAG_DEF)$(MZSCH_DEF)$(ICONV_DEF)) - + $(TCL_DEF)$(RUBY_DEF)$(XIM_DEF)$(HANGULIN_DEF)$(TAG_DEF)$(MZSCH_DEF)$(ICONV_DEF)) - $(CFLAGS)$(GUI_FLAG) - /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC)$(PERL_INC)$(PYTHON_INC)$(TCL_INC)) @@ -302,31 +292,31 @@ ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - # as $(GUI_INC) - replaced with $(GUI_INC_VER) # Otherwise should not be any other difference. ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - - $(TCL_DEF)$(SNIFF_DEF)$(RUBY_DEF)$(XIM_DEF)$(HANGULIN_DEF)$(TAG_DEF)$(MZSCH_DEF)$(ICONV_DEF)) - + $(TCL_DEF)$(RUBY_DEF)$(XIM_DEF)$(HANGULIN_DEF)$(TAG_DEF)$(MZSCH_DEF)$(ICONV_DEF)) - $(CFLAGS)$(GUI_FLAG) - /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC_VER)$(PERL_INC)$(PYTHON_INC)$(TCL_INC)) ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \ - $(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(SNIFF_LIB) $(RUBY_LIB) + $(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB) -SRC = blowfish.c buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ - ex_docmd.c ex_eval.c ex_getln.c if_xcmdsrv.c fileio.c fold.c getchar.c \ - hardcopy.c hashtab.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ +SRC = arabic.c beval.obj blowfish.c buffer.c charset.c crypt.c crypt_zip.c dict.c diff.c digraph.c edit.c eval.c evalfunc.c \ + ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c farsi.c fileio.c fold.c getchar.c \ + hardcopy.c hashtab.c json.c list.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ misc2.c move.c normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c sha256.c\ - spell.c syntax.c tag.c term.c termlib.c ui.c undo.c version.c screen.c \ + spell.c spellfile.c syntax.c tag.c term.c termlib.c ui.c undo.c userfunc.c version.c screen.c \ window.c os_unix.c os_vms.c pathdef.c \ - $(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) $(SNIFF_SRC) \ + $(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) \ $(RUBY_SRC) $(HANGULIN_SRC) $(MZSCH_SRC) -OBJ = blowfish.obj buffer.obj charset.obj diff.obj digraph.obj edit.obj eval.obj \ - ex_cmds.obj ex_cmds2.obj ex_docmd.obj ex_eval.obj ex_getln.obj \ - if_xcmdsrv.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj main.obj mark.obj \ +OBJ = arabic.obj beval.obj blowfish.obj buffer.obj charset.obj crypt.obj crypt_zip.obj dict.obj diff.obj digraph.obj edit.obj eval.obj \ + evalfunc.obj ex_cmds.obj ex_cmds2.obj ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj \ + if_xcmdsrv.obj farsi.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj json.obj list.obj main.obj mark.obj \ menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \ move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj quickfix.obj \ - regexp.obj search.obj sha256.obj spell.obj syntax.obj tag.obj term.obj termlib.obj \ - ui.obj undo.obj screen.obj version.obj window.obj os_unix.obj \ + regexp.obj search.obj sha256.obj spell.obj spellfile.obj syntax.obj tag.obj term.obj termlib.obj \ + ui.obj undo.obj userfunc.obj screen.obj version.obj window.obj os_unix.obj \ os_vms.obj pathdef.obj if_mzsch.obj\ - $(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \ + $(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) \ $(RUBY_OBJ) $(HANGULIN_OBJ) $(MZSCH_OBJ) # Default target is making the executable @@ -496,231 +486,270 @@ ruby_env : -@ ! .ENDIF +arabic.obj : arabic.c vim.h +blowfish.obj : blowfish.c vim.h buffer.obj : buffer.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h charset.obj : charset.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h +crypt.obj : crypt.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ + beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \ + globals.h farsi.h arabic.h +crypt_zip.obj : crypt_zip.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h +dict.obj : dict.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ + beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \ globals.h farsi.h arabic.h diff.obj : diff.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h digraph.obj : digraph.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h edit.obj : edit.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h eval.obj : eval.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h version.h +evalfunc.obj : evalfunc.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h ex_cmds.obj : ex_cmds.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h ex_cmds2.obj : ex_cmds2.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h ex_docmd.obj : ex_docmd.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h ex_eval.obj : ex_eval.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h ex_getln.obj : ex_getln.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +farsi.obj : farsi.c vim.h fileio.obj : fileio.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h fold.obj : fold.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h getchar.obj : getchar.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h hardcopy.obj : hardcopy.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h hashtab.obj : hashtab.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_cscope.obj : if_cscope.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_cscope.h if_xcmdsrv.obj : if_xcmdsrv.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h if_mzsch.obj : if_mzsch.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h [.proto]gui_beval.pro ex_cmds.h proto.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_mzsch.h +json.obj : json.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ + [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ + arabic.h version.h +list.obj : list.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ + beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \ + globals.h farsi.h arabic.h main.obj : main.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h farsi.c arabic.c mark.obj : mark.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h memfile.obj : memfile.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h memline.obj : memline.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h menu.obj : menu.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h message.obj : message.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h misc1.obj : misc1.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h version.h misc2.obj : misc2.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h move.obj : move.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h mbyte.obj : mbyte.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h normal.obj : normal.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h ops.obj : ops.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h option.obj : option.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h os_unix.obj : os_unix.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h os_unixx.h os_vms.obj : os_vms.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h os_unixx.h pathdef.obj : pathdef.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h popupmnu.obj : popupmnu.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h quickfix.obj : quickfix.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h regexp.obj : regexp.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h screen.obj : screen.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h search.obj : search.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h +sha256.obj : sha256.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ + beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \ globals.h farsi.h arabic.h spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +spellfile.obj : spellfile.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h syntax.obj : syntax.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h tag.obj : tag.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h term.obj : term.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h termlib.obj : termlib.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h ui.obj : ui.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h undo.obj : undo.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h +userfunc.obj : userfunc.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h option.h structs.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.obj : version.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h window.obj : window.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui.obj : gui.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h gui_gtk.obj : gui_gtk.c gui_gtk_f.h vim.h [.auto]config.h feature.h \ os_unix.h ascii.h keymap.h term.h macros.h structs.h \ - regexp.h gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h \ proto.h globals.h farsi.h arabic.h [-.pixmaps]stock_icons.h gui_gtk_f.obj : gui_gtk_f.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui_gtk_f.h gui_motif.obj : gui_motif.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h [-.pixmaps]alert.xpm [-.pixmaps]error.xpm \ [-.pixmaps]generic.xpm [-.pixmaps]info.xpm [-.pixmaps]quest.xpm gui_athena.obj : gui_athena.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui_at_sb.h gui_gtk_x11.obj : gui_gtk_x11.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui_gtk_f.h [-.runtime]vim32x32.xpm \ [-.runtime]vim16x16.xpm [-.runtime]vim48x48.xpm gui_x11.obj : gui_x11.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h [-.runtime]vim32x32.xpm \ [-.runtime]vim16x16.xpm [-.runtime]vim48x48.xpm [-.pixmaps]tb_new.xpm \ [-.pixmaps]tb_open.xpm [-.pixmaps]tb_close.xpm [-.pixmaps]tb_save.xpm \ @@ -740,60 +769,60 @@ gui_x11.obj : gui_x11.c vim.h [.auto]config.h feature.h os_unix.h \ [-.pixmaps]tb_minwidth.xpm gui_at_sb.obj : gui_at_sb.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui_at_sb.h gui_at_fs.obj : gui_at_fs.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h gui_at_sb.h pty.obj : pty.c vim.h [.auto]config.h feature.h os_unix.h \ - ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \ [.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h hangulin.obj : hangulin.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_perl.obj : [.auto]if_perl.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_perlsfio.obj : if_perlsfio.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_python.obj : if_python.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_tcl.obj : if_tcl.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h if_ruby.obj : if_ruby.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h -if_sniff.obj : if_sniff.c vim.h [.auto]config.h feature.h os_unix.h \ +beval.obj : beval.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ - globals.h farsi.h arabic.h os_unixx.h + gui.h beval.h option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h gui_beval.obj : gui_beval.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h workshop.obj : workshop.c [.auto]config.h integration.h vim.h feature.h \ os_unix.h ascii.h keymap.h term.h macros.h structs.h \ - regexp.h gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h \ + regexp.h gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h \ proto.h globals.h farsi.h arabic.h version.h workshop.h wsdebug.obj : wsdebug.c integration.obj : integration.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h integration.h netbeans.obj : netbeans.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ - gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h version.h gui_xmdlg.obj : gui_xmdlg.c gui_xmebw.obj : gui_xmebw.c diff --git a/src/Make_w16.mak b/src/Make_w16.mak deleted file mode 100644 index bc7809ecaa..0000000000 --- a/src/Make_w16.mak +++ /dev/null @@ -1,201 +0,0 @@ -# -# Borland C++ 5.0[12] makefile for vim, 16-bit windows gui version -# By Vince Negri -# ************************************************************* -# * WARNING! -# * This was originally produced by the IDE, but has since been -# * modified to make it work properly. Adjust with care! -# * In particular, leave LinkerLocalOptsAtW16_gvim16dexe alone -# * unless you are a guru. -# ************************************************************* -# -# Look for BOR below and either pass a different value or -# adjust the path as required. For example -# make -fMake_w16.mak -DBOR=C:\PF\Borland\BC5.01 -B BccW16.cfg -# make -fMake_w16.mak -# Note: $(BOR) is effectively ignored unless BccW16.cfg is rebuilt. -# -# Does not compile with Borland C++ 4.51 Walter Briscoe 2003-02-24 -# "out of memory" from compiler if gvim16 wildly wrong. WFB 2003-03-04 -# -# vim16.def must be a DOS-formatted file. (\r\n line endings.) -# It is a UNIX-formatted file (\n line endings) in vim-*-extra.tar.gz - -.AUTODEPEND - -# -# Borland C++ tools -# -IMPLIB = Implib -BCC = Bcc +BccW16.cfg -TLINK = TLink -TLIB = TLib -BRC = Brc -TASM = Tasm -# -# IDE macros -# - -# -# Options -# -!ifndef BOR -BOR = D:\BC5 -!endif - -# !ifndef INTDIR is lethal considering CLEAN below. WFB 2003-03-13 -INTDIR=w16 - -# /Twe Make the target a Windows .EXE with explicit functions exportable + -# /x Map file off -# /l Include source line numbers in object map files` -# /c case sensitive link -# /C Case-sensitive exports and imports (16-bit only) -# /k Produce "No Stack" warning. -# /Oa Minimise segment alignment -# /Oc Minimise Chain fixes -# /Oi Minimise Iterated data -# /Or Minimise resource alignment -# /P -P=x Code pack size -# /V Windows version for application -# /L Folder to search for library files -LinkerLocalOptsAtW16_gvim16dexe =/Twe/x/l/c/C/k/Or/Oc/Oa/Oi/P=65535/V3.10 - -CompInheritOptsAt_gvim16dexe = \ - -I$(BOR)\INCLUDE;PROTO;. \ - -DFEAT_GUI;FEAT_GUI_MSWIN;FEAT_GUI_W16;MSWIN;WIN16;MSWIN16_FASTTEXT \ - -DFEAT_TOOLBAR;WIN16_3DLOOK - -# -# Dependency List -# -Dep_Gvim16 = \ - gvim16.exe - -ObjFiles = \ - $(INTDIR)\buffer.obj\ - $(INTDIR)\charset.obj\ - $(INTDIR)\diff.obj\ - $(INTDIR)\digraph.obj\ - $(INTDIR)\edit.obj\ - $(INTDIR)\eval.obj\ - $(INTDIR)\ex_cmds.obj\ - $(INTDIR)\ex_cmds2.obj\ - $(INTDIR)\ex_docmd.obj\ - $(INTDIR)\ex_eval.obj\ - $(INTDIR)\ex_getln.obj\ - $(INTDIR)\fileio.obj\ - $(INTDIR)\fold.obj\ - $(INTDIR)\getchar.obj\ - $(INTDIR)\hardcopy.obj\ - $(INTDIR)\hashtab.obj\ - $(INTDIR)\gui.obj\ - $(INTDIR)\gui_w16.obj\ - $(INTDIR)\main.obj\ - $(INTDIR)\mark.obj\ - $(INTDIR)\mbyte.obj\ - $(INTDIR)\memfile.obj\ - $(INTDIR)\memline.obj\ - $(INTDIR)\menu.obj\ - $(INTDIR)\message.obj\ - $(INTDIR)\misc1.obj\ - $(INTDIR)\misc2.obj\ - $(INTDIR)\move.obj\ - $(INTDIR)\normal.obj\ - $(INTDIR)\ops.obj\ - $(INTDIR)\option.obj\ - $(INTDIR)\os_win16.obj\ - $(INTDIR)\os_msdos.obj\ - $(INTDIR)\os_mswin.obj\ - $(INTDIR)\winclip.obj\ - $(INTDIR)\popupmnu.obj\ - $(INTDIR)\quickfix.obj\ - $(INTDIR)\regexp.obj\ - $(INTDIR)\screen.obj\ - $(INTDIR)\search.obj\ - $(INTDIR)\spell.obj\ - $(INTDIR)\syntax.obj\ - $(INTDIR)\tag.obj\ - $(INTDIR)\term.obj\ - $(INTDIR)\ui.obj\ - $(INTDIR)\undo.obj\ - $(INTDIR)\version.obj\ - $(INTDIR)\window.obj - -Dep_gvim16dexe = \ - vimtbar.lib\ - vim16.def\ - $(INTDIR)\vim16.res\ - $(ObjFiles) - -# Without the following, the implicit rule in BUILTINS.MAK is picked up -# for a rule for .c.obj rather than the local implicit rule -.SUFFIXES -.SUFFIXES .c .obj -.path.c = . - -# -P- Force C++ compilation off -# -c Compilation only -# -n Place .OBJ files -{.}.c{$(INTDIR)}.obj: - $(BCC) -P- -c -n$(INTDIR)\ {$< } - -Gvim16 : BccW16.cfg $(Dep_Gvim16) - echo MakeNode - -gvim16.exe : $(Dep_gvim16dexe) - $(TLINK) $(LinkerLocalOptsAtW16_gvim16dexe) @&&| -c0wl.obj $(ObjFiles) -|,$*,,vimtbar ctl3dv2 import cwl, vim16.def,$(INTDIR)\vim16.res - -# Force objects to be built if $(BOR) changes -$(ObjFiles) : Make_w16.mak BccW16.cfg - -$(INTDIR)\vim16.res : vim16.rc - $(BRC) -R @&&| - $(CompInheritOptsAt_gvim16dexe) -fo$*.res $? -| - - -# Compiler configuration file -# There is no rule for $(INTDIR) as make always says it does not exist -BccW16.cfg : - -@if not exist $(INTDIR)\$(NULL) mkdir $(INTDIR) - Copy &&| --3 ; Generate 80386 protected-mode compatible instructions --a ; Byte alignment --dc ; Move string literals from data segment to code segment --ff ; Fast floating point --H ; Generate and use precompiled headers --H=$(INTDIR)\gvim16.csm ; gvim16.csm is the precompiled header filename --k- ; No standard stack frame --ml ; Large memory model --OW ; Suppress the inc bp/dec bp on windows far functions --O1 ; Generate smallest possible code --O2 ; Generate fastest possible code (overrides prior -O1 control) --pr ; Fastcall calling convention passing parameters in registers --R- ; Exclude browser information in generated .OBJ files --v- ; Turn off source debugging --vi ; Turn inline function expansion on --WE ; Only __far _export functions are exported --w ; Display warnings --w-par ; Suppress: Parameter 'parameter' is never used --w-pch ; Cannot create pre-compiled header: initialized data in header --w-sig ; identifier' declared but never used --w-ucp ; Mixing pointers to different 'char' types --wuse ; 'identifier' declared but never used - $(CompInheritOptsAt_gvim16dexe) -| $@ - -!IF "$(OS)" == "Windows_NT" -NULL= -DEL_TREE = rmdir /s /q -!ELSE -NULL=nul -DEL_TREE = deltree /y -!ENDIF - -CLEAN: - -@if exist $(INTDIR)\$(NULL) $(DEL_TREE) $(INTDIR) - -@if exist BccW16.cfg erase BccW16.cfg - -@if exist gvim16.exe erase gvim16.exe diff --git a/src/Makefile b/src/Makefile index 5a3affb8a1..bea11a2042 100644 --- a/src/Makefile +++ b/src/Makefile @@ -130,6 +130,7 @@ # make installlinks only installs the Vim binary links # make installmanlinks only installs the Vim manpage links # make installmacros only installs the Vim macros +# make installpack only installs the packages # make installtutorbin only installs the Vim tutor program # make installtutor only installs the Vim tutor files # make installspell only installs the spell files @@ -206,7 +207,7 @@ #SunOS 4.1.x +X11 -GUI 5.1b (J) Bram Moolenaar #SunOS 4.1.3_U1 (sun4c) gcc +X11 +GUI Athena 5.0w (J) Darren Hiebert #SUPER-UX 6.2 (NEC SX-4) cc +X11R6 Motif,Athena4.6b (P) Lennart Schultz -#Tandem/NSK (c) Matthew Woehlke +#Tandem/NSK (c) Matthew Woehlke #Unisys 6035 cc +X11 Motif 5.3 (8) Glauber Ribeiro #ESIX V4.2 cc +X11 6.0 (a) Reinhard Wobst #Mac OS X 10.[23] gcc Carbon 6.2 (x) Bram Moolenaar @@ -281,6 +282,12 @@ CC= #GUI_LIB_LOC = -L/usr/X11R6/lib # }}} +# Defaults used when auto/config.mk does not exist. +srcdir = . +VIMNAME = vim +EXNAME = ex +VIEWNAME = view + ######################## auto/config.mk ######################## {{{1 # At this position auto/config.mk is included. When starting from the # toplevel Makefile it is almost empty. After running auto/configure it @@ -328,9 +335,13 @@ CClink = $(CC) # Uncomment one of these lines if you have that GUI but don't want to use it. # The automatic check will use another one that can be found. -# Gnome is disabled by default, it may cause trouble. +# Gnome is disabled by default, because it may cause trouble. +# +# When both GTK+ 2 and GTK+ 3 are possible then GTK+ 2 will be selected. +# To use GTK+ 3 instead use --enable-gui=gtk3 (see below). #CONF_OPT_GUI = --disable-gtk2-check -#CONF_OPT_GUI = --enable-gnome2-check +#CONF_OPT_GUI = --enable-gnome-check +#CONF_OPT_GUI = --disable-gtk3-check #CONF_OPT_GUI = --disable-motif-check #CONF_OPT_GUI = --disable-athena-check #CONF_OPT_GUI = --disable-nextaw-check @@ -341,18 +352,24 @@ CClink = $(CC) # # GTK versions that are known not to work 100% are rejected. # Use "--disable-gtktest" to accept them anyway. -# Only GTK 2 is supported, for GTK 1 use Vim 7.2. +# For GTK 1 use Vim 7.2. # # GNOME means GTK with Gnome support. If using GTK and --enable-gnome-check # is used then GNOME will automatically be used if it is found. If you have # GNOME, but do not want to use it (e.g., want a GTK-only version), then use # --enable-gui=gtk or leave out --enable-gnome-check. # +# GNOME makes sense only for GTK+ 2. Avoid use of --enable-gnome-check with +# GTK+ 3 build, as the functionality of GNOME is already incooperated into +# GTK+ 3. +# # If the selected GUI isn't found, the GUI is disabled automatically #CONF_OPT_GUI = --enable-gui=gtk2 #CONF_OPT_GUI = --enable-gui=gtk2 --disable-gtktest #CONF_OPT_GUI = --enable-gui=gnome2 #CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest +#CONF_OPT_GUI = --enable-gui=gtk3 +#CONF_OPT_GUI = --enable-gui=gtk3 --disable-gtktest #CONF_OPT_GUI = --enable-gui=motif #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared" #CONF_OPT_GUI = --enable-gui=athena @@ -361,6 +378,9 @@ CClink = $(CC) # Carbon GUI for Mac OS X #CONF_OPT_GUI = --enable-gui=carbon +# Uncomment this line to run an individual test with gvim. +#GUI_TESTARG = GUI_FLAG=-g + # DARWIN - detecting Mac OS X # Uncomment this line when you want to compile a Unix version of Vim on # Darwin. None of the Mac specific options or files will be used. @@ -383,6 +403,7 @@ CClink = $(CC) # First one is for static linking, second one for dynamic loading. # Use --with-luajit if you want to use LuaJIT instead of Lua. # Set PATH environment variable to find lua or luajit executable. +# This requires at least "normal" features, "tiny" and "small" don't work. #CONF_OPT_LUA = --enable-luainterp #CONF_OPT_LUA = --enable-luainterp=dynamic #CONF_OPT_LUA = --enable-luainterp --with-luajit @@ -392,6 +413,7 @@ CClink = $(CC) # MZSCHEME # Uncomment this when you want to include the MzScheme interface. +# NOTE: does not work well together with valgrind. #CONF_OPT_MZSCHEME = --enable-mzschemeinterp # PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works #CONF_OPT_PLTHOME = --with-plthome=/usr/local/plt @@ -408,38 +430,42 @@ CClink = $(CC) # the next line. # When you get an error for a missing "perl.exp" file, try creating an empty # one: "touch perl.exp". -# This requires at least "small" features, "tiny" doesn't work. +# This requires at least "normal" features, "tiny" and "small" don't work. #CONF_OPT_PERL = --enable-perlinterp #CONF_OPT_PERL = --enable-perlinterp=dynamic # PYTHON -# Uncomment this when you want to include the Python interface. -# Requires small features or better, fails with tiny features. +# Uncomment lines here when you want to include the Python interface. +# This requires at least "normal" features, "tiny" and "small" don't work. # NOTE: This may cause threading to be enabled, which has side effects (such # as using different libraries and debugging becomes more difficult). -# NOTE: Using this together with Perl may cause a crash in initialization. -# For Python3 support make a symbolic link in /usr/local/bin: +# For Python3 support make a symbolic link in /usr/local/bin: # ln -s python3 python3.1 # If both python2.x and python3.x are enabled then the linking will be via # dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available # However, this may still cause problems, such as "import termios" failing. # Build two separate versions of Vim in that case. #CONF_OPT_PYTHON = --enable-pythoninterp +#CONF_OPT_PYTHON = --enable-pythoninterp --with-python-command=python2.7 #CONF_OPT_PYTHON = --enable-pythoninterp=dynamic #CONF_OPT_PYTHON3 = --enable-python3interp +#CONF_OPT_PYTHON3 = --enable-python3interp --with-python3-command=python3.6 #CONF_OPT_PYTHON3 = --enable-python3interp=dynamic # RUBY # Uncomment this when you want to include the Ruby interface. # First one for static linking, second one for loading when used. # Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu). +# This requires at least "normal" features, "tiny" and "small" don't work. #CONF_OPT_RUBY = --enable-rubyinterp #CONF_OPT_RUBY = --enable-rubyinterp=dynamic #CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1 # TCL # Uncomment this when you want to include the Tcl interface. +# First one is for static linking, second one for dynamic loading. #CONF_OPT_TCL = --enable-tclinterp +#CONF_OPT_TCL = --enable-tclinterp=dynamic #CONF_OPT_TCL = --enable-tclinterp --with-tclsh=tclsh8.4 # CSCOPE @@ -454,8 +480,17 @@ CClink = $(CC) # Uncomment this when you do not want the netbeans interface. #CONF_OPT_NETBEANS = --disable-netbeans -# SNIFF - Include support for SNiFF+. -#CONF_OPT_SNIFF = --enable-sniff +# CHANNEL - inter process communication. Same conditions as NetBeans. +# Uncomment this when you do not want inter process communication. +#CONF_OPT_CHANNEL = --disable-channel + +# TERMINAL - Terminal emulator support, :terminal command. Requires the +# channel feature. The default is enable for when using "huge" features. +# Uncomment the first line when you want terminal emulator support for +# not-huge builds. Uncomment the second line when you don't want terminal +# emulator support in the huge build. +#CONF_OPT_TERMINAL = --enable-terminal +#CONF_OPT_TERMINAL = --disable-terminal # MULTIBYTE - To edit multi-byte characters. # Uncomment this when you want to edit a multibyte language. @@ -498,7 +533,7 @@ CClink = $(CC) # FEATURES - For creating Vim with more or less features # Uncomment one of these lines when you want to include few to many features. -# The default is "normal". +# The default is "huge" for most systems. #CONF_OPT_FEAT = --with-features=tiny #CONF_OPT_FEAT = --with-features=small #CONF_OPT_FEAT = --with-features=normal @@ -537,6 +572,9 @@ CClink = $(CC) # This disables the dialog that asks you if you want to save files or not. #CONF_OPT_XSMP = --disable-xsmp-interact +# If you want to always automatically add a servername, also in the terminal. +#CONF_OPT_AUTOSERVE = --enable-autoservername + # COMPILER - Name of the compiler {{{1 # The default from configure will mostly be fine, no need to change this, just # an example. If a compiler is defined here, configure will use it rather than @@ -572,8 +610,11 @@ CClink = $(CC) #CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes # Use this with GCC to check for mistakes, unused arguments, etc. -#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -#CFLAGS = -g -O2 -Wall -Wextra -Wmissing-prototypes -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DU_DEBUG +#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 +# Add -Wpedantic to find // comments and other C99 constructs. +# Better disable Perl and Python to avoid a lot of warnings. +#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 +#CFLAGS = -g -O2 -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 #PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers #MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter @@ -592,6 +633,10 @@ AUTOCONF = autoconf # PURIFY - remove the # to use the "purify" program (hoi Nia++!) #PURIFY = purify +# VALGRIND - remove the # to use valgrind for memory leaks and access errors. +# Used for the unittest targets. +# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind.$@ + # NBDEBUG - debugging the netbeans interface. #EXTRA_DEFS = -DNBDEBUG @@ -608,14 +653,47 @@ LINT_OPTIONS = -beprxzF # PROFILING - Uncomment the next two lines to do profiling with gcc and gprof. # Might not work with GUI or Perl. -# For unknown reasons adding "-lc" fixes a linking problem with some versions -# of GCC. That's probably a bug in the "-pg" implementation. # After running Vim see the profile result with: gprof vim gmon.out | vim - # Need to recompile everything after changing this: "make clean" "make". #PROFILE_CFLAGS = -pg -g -DWE_ARE_PROFILING #PROFILE_LIBS = -pg + +# GCC 5 and later need the -no-pie argument. +#PROFILE_LIBS = -pg -no-pie + +# For unknown reasons adding "-lc" fixes a linking problem with some versions +# of GCC. That's probably a bug in the "-pg" implementation. #PROFILE_LIBS = -pg -lc + +# TEST COVERAGE - Uncomment the two lines below the explanation to get code +# coverage information. (provided by Yegappan Lakshmanan) +# 1. make clean, run configure and build Vim as usual. +# 2. Generate the baseline code coverage information: +# $ lcov -c -i -b . -d objects -o objects/coverage_base.info +# 3. Run "make test" to run the unit tests. The code coverage information will +# be generated in the src/objects directory. +# 4. Generate the code coverage information from the tests: +# $ lcov -c -b . -d objects/ -o objects/coverage_test.info +# 5. Combine the baseline and test code coverage data: +# $ lcov -a objects/coverage_base.info -a objects/coverage_test.info -o objects/coverage_total.info +# 6. Process the test coverage data and generate a report in html: +# $ genhtml objects/coverage_total.info -o objects +# 7. Open the objects/index.html file in a web browser to view the coverage +# information. +# +# PROFILE_CFLAGS=-g -O0 -fprofile-arcs -ftest-coverage +# LDFLAGS=--coverage + + +# Uncomment one of the next two lines to compile Vim with the +# address sanitizer or with the undefined sanitizer. Works with gcc and +# clang. May make Vim twice as slow. Errors reported on stderr. +# More at: https://code.google.com/p/address-sanitizer/ +#SANITIZER_CFLAGS = -g -O0 -fsanitize=address -fno-omit-frame-pointer +#SANITIZER_CFLAGS = -g -O0 -fsanitize=undefined -fno-omit-frame-pointer +SANITIZER_LIBS = $(SANITIZER_CFLAGS) + # MEMORY LEAK DETECTION # Requires installing the ccmalloc library. # Configuration is in the .ccmalloc or ~/.ccmalloc file. @@ -624,13 +702,17 @@ LINT_OPTIONS = -beprxzF #LEAK_CFLAGS = -DEXITFREE #LEAK_LIBS = -lccmalloc +# Uncomment this line to have Vim call abort() when an internal error is +# detected. Useful when using a tool to find errors. +#ABORT_CLFAGS = -DABORT_ON_INTERNAL_ERROR + ##################################################### ### Specific systems, check if yours is listed! ### {{{ ##################################################### ### Uncomment things here only if the values chosen by configure are wrong. -### It's better to adjust configure.in and "make autoconf", if you can! -### Then send the required changes to configure.in to the bugs list. +### It's better to adjust configure.ac and "make autoconf", if you can! +### Then send the required changes to configure.ac to the bugs list. ### (1) BSD/OS 2.0.1, 2.1 or 3.0 using shared libraries ### @@ -867,7 +949,7 @@ LINT_OPTIONS = -beprxzF ### after changing this, you need to do "make reconfig". #CONF_TERM_LIB = --with-tlib=ncurses -### For GCC on MSDOS, the ".exe" suffix will be added. +### For GCC on MS-Windows, the ".exe" suffix will be added. #EXEEXT = .exe #LNKEXT = .exe @@ -952,8 +1034,8 @@ TOOLS = xxd/xxd$(EXEEXT) MAN1DIR = /man1 ### Vim version (adjusted by a script) -VIMMAJOR = 7 -VIMMINOR = 4 +VIMMAJOR = 8 +VIMMINOR = 1 ### Location of Vim files (should not need to be changed, and {{{1 ### some things might not work when they are changed!) @@ -970,6 +1052,7 @@ LANGSUBDIR = /lang COMPSUBDIR = /compiler KMAPSUBDIR = /keymap MACROSUBDIR = /macros +PACKSUBDIR = /pack TOOLSSUBDIR = /tools TUTORSUBDIR = /tutor SPELLSUBDIR = /spell @@ -991,6 +1074,7 @@ PODIR = po ### COMPSUBLOC location for compiler files ### KMAPSUBLOC location for keymap files ### MACROSUBLOC location for macro files +### PACKSUBLOC location for packages ### TOOLSSUBLOC location for tools files ### TUTORSUBLOC location for tutor files ### SPELLSUBLOC location for spell files @@ -1012,6 +1096,7 @@ LANGSUBLOC = $(VIMRTLOC)$(LANGSUBDIR) COMPSUBLOC = $(VIMRTLOC)$(COMPSUBDIR) KMAPSUBLOC = $(VIMRTLOC)$(KMAPSUBDIR) MACROSUBLOC = $(VIMRTLOC)$(MACROSUBDIR) +PACKSUBLOC = $(VIMRTLOC)$(PACKSUBDIR) TOOLSSUBLOC = $(VIMRTLOC)$(TOOLSSUBDIR) TUTORSUBLOC = $(VIMRTLOC)$(TUTORSUBDIR) SPELLSUBLOC = $(VIMRTLOC)$(SPELLSUBDIR) @@ -1022,7 +1107,8 @@ SCRIPTLOC = $(VIMRTLOC) ### the runtime directory is not below it. #VIMRUNTIMEDIR = $(VIMRTLOC) -### Name of the evim file target. +### Name of the defaults/evim/mswin file target. +VIM_DEFAULTS_FILE = $(DESTDIR)$(SCRIPTLOC)/defaults.vim EVIM_FILE = $(DESTDIR)$(SCRIPTLOC)/evim.vim MSWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/mswin.vim @@ -1034,6 +1120,9 @@ SYS_DELMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/delmenu.vim ### Name of the bugreport file target. SYS_BUGR_FILE = $(DESTDIR)$(SCRIPTLOC)/bugreport.vim +### Name of the rgb.txt file target. +SYS_RGB_FILE = $(DESTDIR)$(SCRIPTLOC)/rgb.txt + ### Name of the file type detection file target. SYS_FILETYPE_FILE = $(DESTDIR)$(SCRIPTLOC)/filetype.vim @@ -1117,6 +1206,9 @@ FTPLUGSOURCE = ../runtime/ftplugin # Where to copy the macro files from MACROSOURCE = ../runtime/macros +# Where to copy the package files from +PACKSOURCE = ../runtime/pack + # Where to copy the tools files from TOOLSSOURCE = ../runtime/tools @@ -1169,11 +1261,11 @@ LINKIT = @echo >/dev/null NONE_INSTALL = install_normal ### GTK GUI -GTK_SRC = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_gtk_f.c \ - gui_beval.c +GTK_SRC = gui.c gui_gtk.c gui_gtk_x11.c gui_gtk_f.c \ + gui_beval.c $(GRESOURCE_SRC) GTK_OBJ = objects/gui.o objects/gui_gtk.o objects/gui_gtk_x11.o \ - objects/pty.o objects/gui_gtk_f.o \ - objects/gui_beval.o + objects/gui_gtk_f.o \ + objects/gui_beval.o $(GRESOURCE_OBJ) GTK_DEFS = -DFEAT_GUI_GTK $(NARROW_PROTO) GTK_IPATH = $(GUI_INC_LOC) GTK_LIBS_DIR = $(GUI_LIB_LOC) @@ -1186,10 +1278,10 @@ GTK_TESTTARGET = gui GTK_BUNDLE = ### Motif GUI -MOTIF_SRC = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c \ +MOTIF_SRC = gui.c gui_motif.c gui_x11.c gui_beval.c \ gui_xmdlg.c gui_xmebw.c MOTIF_OBJ = objects/gui.o objects/gui_motif.o objects/gui_x11.o \ - objects/pty.o objects/gui_beval.o \ + objects/gui_beval.o \ objects/gui_xmdlg.o objects/gui_xmebw.o MOTIF_DEFS = -DFEAT_GUI_MOTIF $(NARROW_PROTO) MOTIF_IPATH = $(GUI_INC_LOC) @@ -1209,16 +1301,16 @@ XAW_LIB = -lXaw ### When using Xaw3d, uncomment/comment the following lines to also get the ### scrollbars from Xaw3d. -#ATHENA_SRC = gui.c gui_athena.c gui_x11.c pty.c gui_beval.c gui_at_fs.c +#ATHENA_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c gui_at_fs.c #ATHENA_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \ -# objects/pty.o objects/gui_beval.o objects/gui_at_fs.o +# objects/gui_beval.o objects/gui_at_fs.o #ATHENA_DEFS = -DFEAT_GUI_ATHENA $(NARROW_PROTO) \ # -Dvim_scrollbarWidgetClass=scrollbarWidgetClass \ # -Dvim_XawScrollbarSetThumb=XawScrollbarSetThumb -ATHENA_SRC = gui.c gui_athena.c gui_x11.c pty.c gui_beval.c \ +ATHENA_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c \ gui_at_sb.c gui_at_fs.c ATHENA_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \ - objects/pty.o objects/gui_beval.o \ + objects/gui_beval.o \ objects/gui_at_sb.o objects/gui_at_fs.o ATHENA_DEFS = -DFEAT_GUI_ATHENA $(NARROW_PROTO) @@ -1235,9 +1327,9 @@ ATHENA_BUNDLE = ### neXtaw GUI NEXTAW_LIB = -lneXtaw -NEXTAW_SRC = gui.c gui_athena.c gui_x11.c pty.c gui_beval.c gui_at_fs.c +NEXTAW_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c gui_at_fs.c NEXTAW_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \ - objects/pty.o objects/gui_beval.o objects/gui_at_fs.o + objects/gui_beval.o objects/gui_at_fs.o NEXTAW_DEFS = -DFEAT_GUI_ATHENA -DFEAT_GUI_NEXTAW $(NARROW_PROTO) NEXTAW_IPATH = $(GUI_INC_LOC) @@ -1262,8 +1354,8 @@ NEXTAW_BUNDLE = #EXTRA_LIBS = /usr/openwin/lib/libXmu.sa -lm # PHOTON GUI -PHOTONGUI_SRC = gui.c gui_photon.c pty.c -PHOTONGUI_OBJ = objects/gui.o objects/gui_photon.o objects/pty.o +PHOTONGUI_SRC = gui.c gui_photon.c +PHOTONGUI_OBJ = objects/gui.o objects/gui_photon.o PHOTONGUI_DEFS = -DFEAT_GUI_PHOTON PHOTONGUI_IPATH = PHOTONGUI_LIBS_DIR = @@ -1277,7 +1369,7 @@ PHOTONGUI_BUNDLE = # CARBON GUI CARBONGUI_SRC = gui.c gui_mac.c -CARBONGUI_OBJ = objects/gui.o objects/gui_mac.o objects/pty.o +CARBONGUI_OBJ = objects/gui.o objects/gui_mac.o CARBONGUI_DEFS = -DFEAT_GUI_MAC -fno-common -fpascal-strings \ -Wall -Wno-unknown-pragmas \ -mdynamic-no-pic -pipe @@ -1296,7 +1388,7 @@ CARBONGUI_TESTARG = VIMPROG=../$(APPDIR)/Contents/MacOS/$(VIMTARGET) # MACVIM GUI MACVIMGUI_SRC = gui.c gui_beval.c MacVim/gui_macvim.m MacVim/MMBackend.m \ MacVim/MacVim.m -MACVIMGUI_OBJ = objects/gui.o objects/gui_beval.o objects/pty.o \ +MACVIMGUI_OBJ = objects/gui.o objects/gui_beval.o \ objects/gui_macvim.o objects/MMBackend.o objects/MacVim.o MACVIMGUI_DEFS = -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe MACVIMGUI_IPATH = @@ -1308,13 +1400,23 @@ MACVIMGUI_TARGETS = MACVIMGUI_MAN_TARGETS = MACVIMGUI_TESTTARGET = gui MACVIMGUI_BUNDLE = macvim +MACVIMGUI_TESTARG = VIMPROG=../$(RELEASEDIR)/MacVim.app/Contents/MacOS/$(VIMTARGET) # All GUI files -ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_xmdlg.c gui_xmebw.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c -ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w16.pro gui_w32.pro gui_photon.pro +ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_xmdlg.c gui_xmebw.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c +ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w32.pro gui_photon.pro # }}} +TERM_DEPS = \ + libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h \ + libvterm/src/rect.h \ + libvterm/src/utf8.h \ + libvterm/src/vterm_internal.h + +TERM_SRC = libvterm/src/*.c + ### Command to create dependencies based on #include "..." ### prototype headers are ignored due to -DPROTO, system ### headers #include <...> are ignored if we use the -MM option, as @@ -1340,10 +1442,10 @@ CPP_DEPEND = $(CC) -I$(srcdir) -M$(CPP_MM) \ NO_ATTR= # # Use this for cproto 3 patchlevel 6 or below (use "cproto -V" to check): -# PROTO_FLAGS = -f4 -m__ARGS -d -E"$(CPP)" $(NO_ATTR) +# PROTO_FLAGS = -f4 -d -E"$(CPP)" $(NO_ATTR) # # Use this for cproto 3 patchlevel 7 or above (use "cproto -V" to check): -PROTO_FLAGS = -m -M__ARGS -d -E"$(CPP)" $(NO_ATTR) +PROTO_FLAGS = -d -E"$(CPP)" $(NO_ATTR) ################################################ @@ -1352,21 +1454,26 @@ PROTO_FLAGS = -m -M__ARGS -d -E"$(CPP)" $(NO_ATTR) SHELL = /bin/sh +# We would normally use "mkdir -p" but it doesn't work properly everywhere. +# Using AC_PROG_MKDIR_P in configure.ac has a problem with the "auto" +# directory. Always use the install-sh script, it's slower but reliable. +MKDIR_P = $(SHELL) install-sh -c -d + .SUFFIXES: .SUFFIXES: .c .o .pro PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS) -POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS) +POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(EXTRA_DEFS) -ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(LEAK_CFLAGS) $(POST_DEFS) +ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(SANITIZER_CFLAGS) $(LEAK_CFLAGS) $(ABORT_CLFAGS) $(POST_DEFS) # Exclude $CFLAGS for osdef.sh, for Mac 10.4 some flags don't work together # with "-E". OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS) -LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca +LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(RUBY19_CFLAGS) $(LUA_CFLAGS) $(LUA52_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(TCL_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca -LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)=" +LINT_EXTRA = -DHANGUL_INPUT -D"__attribute__(x)=" DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_GUI $(LINT_CFLAGS) @@ -1384,12 +1491,15 @@ ALL_LIBS = \ $(LIBS) \ $(EXTRA_LIBS) \ $(LUA_LIBS) \ + $(LUA52_LIBS) \ $(PERL_LIBS) \ $(PYTHON_LIBS) \ $(PYTHON3_LIBS) \ $(TCL_LIBS) \ $(RUBY_LIBS) \ + $(RUBY19_LIBS) \ $(PROFILE_LIBS) \ + $(SANITIZER_LIBS) \ $(LEAK_LIBS) # abbreviations @@ -1407,6 +1517,7 @@ DEST_LANG = $(DESTDIR)$(LANGSUBLOC) DEST_COMP = $(DESTDIR)$(COMPSUBLOC) DEST_KMAP = $(DESTDIR)$(KMAPSUBLOC) DEST_MACRO = $(DESTDIR)$(MACROSUBLOC) +DEST_PACK = $(DESTDIR)$(PACKSUBLOC) DEST_TOOLS = $(DESTDIR)$(TOOLSSUBLOC) DEST_TUTOR = $(DESTDIR)$(TUTORSUBLOC) DEST_SPELL = $(DESTDIR)$(SPELLSUBLOC) @@ -1444,25 +1555,35 @@ DEST_MAN_RU_U = $(DEST_MAN_TOP)/ru.UTF-8$(MAN1DIR) TAGS_INCL = *.h BASIC_SRC = \ + arabic.c \ + beval.c \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ + dict.c \ diff.c \ digraph.c \ edit.c \ eval.c \ + evalfunc.c \ ex_cmds.c \ ex_cmds2.c \ ex_docmd.c \ ex_eval.c \ ex_getln.c \ + farsi.c \ fileio.c \ fold.c \ getchar.c \ + guess.c \ hardcopy.c \ hashtab.c \ if_cscope.c \ if_xcmdsrv.c \ + json.c \ + list.c \ main.c \ mark.c \ memfile.c \ @@ -1479,46 +1600,61 @@ BASIC_SRC = \ os_unix.c \ auto/pathdef.c \ popupmnu.c \ + pty.c \ quickfix.c \ regexp.c \ screen.c \ search.c \ sha256.c \ spell.c \ + spellfile.c \ syntax.c \ tag.c \ term.c \ + terminal.c \ ui.c \ undo.c \ + userfunc.c \ version.c \ window.c \ $(OS_EXTRA_SRC) SRC = $(BASIC_SRC) \ $(GUI_SRC) \ + $(TERM_SRC) \ $(HANGULIN_SRC) \ $(LUA_SRC) \ + $(LUA52_SRC) \ $(MZSCHEME_SRC) \ $(PERL_SRC) \ $(PYTHON_SRC) $(PYTHON3_SRC) \ $(TCL_SRC) \ $(RUBY_SRC) \ - $(SNIFF_SRC) \ + $(RUBY19_SRC) \ $(WORKSHOP_SRC) \ $(WSDEBUG_SRC) TAGS_SRC = *.c *.cpp if_perl.xs EXTRA_SRC = hangulin.c if_lua.c if_mzsch.c auto/if_perl.c if_perlsfio.c \ - if_python.c if_python3.c if_tcl.c if_ruby.c if_sniff.c \ - gui_beval.c workshop.c wsdebug.c integration.c netbeans.c + if_python.c if_python3.c if_tcl.c if_ruby.c \ + gui_beval.c workshop.c wsdebug.c integration.c \ + netbeans.c channel.c if_lua52.c \ + $(GRESOURCE_SRC) # Unittest files +JSON_TEST_SRC = json_test.c +JSON_TEST_TARGET = json_test$(EXEEXT) +KWORD_TEST_SRC = kword_test.c +KWORD_TEST_TARGET = kword_test$(EXEEXT) MEMFILE_TEST_SRC = memfile_test.c MEMFILE_TEST_TARGET = memfile_test$(EXEEXT) +MESSAGE_TEST_SRC = message_test.c +MESSAGE_TEST_TARGET = message_test$(EXEEXT) -UNITTEST_SRC = $(MEMFILE_TEST_SRC) -UNITTEST_TARGETS = $(MEMFILE_TEST_TARGET) +UNITTEST_SRC = $(JSON_TEST_SRC) $(KWORD_TEST_SRC) $(MEMFILE_TEST_SRC) $(MESSAGE_TEST_SRC) +UNITTEST_TARGETS = $(JSON_TEST_TARGET) $(KWORD_TEST_TARGET) $(MEMFILE_TEST_TARGET) $(MESSAGE_TEST_TARGET) +RUN_UNITTESTS = run_json_test run_kword_test run_memfile_test run_message_test # All sources, also the ones that are not configured ALL_SRC = $(BASIC_SRC) $(ALL_GUI_SRC) $(UNITTEST_SRC) $(EXTRA_SRC) @@ -1526,37 +1662,46 @@ ALL_SRC = $(BASIC_SRC) $(ALL_GUI_SRC) $(UNITTEST_SRC) $(EXTRA_SRC) # Which files to check with lint. Select one of these three lines. ALL_SRC # checks more, but may not work well for checking a GUI that wasn't configured. # The perl sources also don't work well with lint. -LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PYTHON_SRC) $(PYTHON3_SRC) $(TCL_SRC) \ - $(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC) $(NETBEANS_SRC) +LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) \ + $(PYTHON_SRC) $(PYTHON3_SRC) $(TCL_SRC) \ + $(WORKSHOP_SRC) $(WSDEBUG_SRC) \ + $(NETBEANS_SRC) $(CHANNEL_SRC) $(TERM_SRC) #LINT_SRC = $(SRC) #LINT_SRC = $(ALL_SRC) #LINT_SRC = $(BASIC_SRC) OBJ_COMMON = \ + objects/arabic.o \ + objects/beval.o \ objects/buffer.o \ objects/blowfish.o \ - objects/charset.o \ + objects/crypt.o \ + objects/crypt_zip.o \ + objects/dict.o \ objects/diff.o \ objects/digraph.o \ objects/edit.o \ objects/eval.o \ + objects/evalfunc.o \ objects/ex_cmds.o \ objects/ex_cmds2.o \ objects/ex_docmd.o \ objects/ex_eval.o \ objects/ex_getln.o \ + objects/farsi.o \ objects/fileio.o \ objects/fold.o \ objects/getchar.o \ + objects/guess.o \ objects/hardcopy.o \ objects/hashtab.o \ $(HANGULIN_OBJ) \ objects/if_cscope.o \ objects/if_xcmdsrv.o \ + objects/list.o \ objects/mark.o \ - objects/memline.o \ + objects/memline.o \ objects/menu.o \ - objects/message.o \ objects/misc1.o \ objects/misc2.o \ objects/move.o \ @@ -1567,66 +1712,128 @@ OBJ_COMMON = \ objects/os_unix.o \ objects/pathdef.o \ objects/popupmnu.o \ + objects/pty.o \ objects/quickfix.o \ objects/regexp.o \ objects/screen.o \ objects/search.o \ objects/sha256.o \ objects/spell.o \ + objects/spellfile.o \ objects/syntax.o \ - $(SNIFF_OBJ) \ objects/tag.o \ objects/term.o \ + objects/terminal.o \ objects/ui.o \ objects/undo.o \ + objects/userfunc.o \ objects/version.o \ objects/window.o \ $(GUI_OBJ) \ + $(TERM_OBJ) \ $(LUA_OBJ) \ + $(LUA52_OBJ) \ $(MZSCHEME_OBJ) \ $(PERL_OBJ) \ $(PYTHON_OBJ) \ $(PYTHON3_OBJ) \ $(TCL_OBJ) \ $(RUBY_OBJ) \ + $(RUBY19_OBJ) \ $(OS_EXTRA_OBJ) \ $(WORKSHOP_OBJ) \ $(NETBEANS_OBJ) \ + $(CHANNEL_OBJ) \ $(WSDEBUG_OBJ) -OBJ = $(OBJ_COMMON) \ +# The files included by tests are not in OBJ_COMMON. +OBJ_MAIN = \ + objects/charset.o \ + objects/json.o \ objects/main.o \ - objects/memfile.o + objects/memfile.o \ + objects/message.o + +OBJ = $(OBJ_COMMON) $(OBJ_MAIN) + +OBJ_JSON_TEST = \ + objects/charset.o \ + objects/memfile.o \ + objects/message.o \ + objects/json_test.o + +JSON_TEST_OBJ = $(OBJ_COMMON) $(OBJ_JSON_TEST) + +OBJ_KWORD_TEST = \ + objects/json.o \ + objects/memfile.o \ + objects/message.o \ + objects/kword_test.o + +KWORD_TEST_OBJ = $(OBJ_COMMON) $(OBJ_KWORD_TEST) + +OBJ_MEMFILE_TEST = \ + objects/charset.o \ + objects/json.o \ + objects/message.o \ + objects/memfile_test.o + +MEMFILE_TEST_OBJ = $(OBJ_COMMON) $(OBJ_MEMFILE_TEST) + +OBJ_MESSAGE_TEST = \ + objects/charset.o \ + objects/json.o \ + objects/memfile.o \ + objects/message_test.o + +MESSAGE_TEST_OBJ = $(OBJ_COMMON) $(OBJ_MESSAGE_TEST) + +ALL_OBJ = $(OBJ_COMMON) \ + $(OBJ_MAIN) \ + $(OBJ_JSON_TEST) \ + $(OBJ_KWORD_TEST) \ + $(OBJ_MEMFILE_TEST) \ + $(OBJ_MESSAGE_TEST) -MEMFILE_TEST_OBJ = $(OBJ_COMMON) \ - objects/memfile_test.o PRO_AUTO = \ + arabic.pro \ blowfish.pro \ buffer.pro \ charset.pro \ + crypt.pro \ + crypt_zip.pro \ + dict.pro \ diff.pro \ digraph.pro \ edit.pro \ eval.pro \ + evalfunc.pro \ ex_cmds.pro \ ex_cmds2.pro \ ex_docmd.pro \ ex_eval.pro \ ex_getln.pro \ + farsi.pro \ fileio.pro \ fold.pro \ getchar.pro \ + guess.pro \ hardcopy.pro \ hashtab.pro \ hangulin.pro \ if_cscope.pro \ - if_xcmdsrv.pro \ + if_lua.pro \ + if_mzsch.pro \ if_python.pro \ if_python3.pro \ if_ruby.pro \ + if_xcmdsrv.pro \ + json.pro \ + list.pro \ main.pro \ mark.pro \ + mbyte.pro \ memfile.pro \ memline.pro \ menu.pro \ @@ -1634,36 +1841,42 @@ PRO_AUTO = \ misc1.pro \ misc2.pro \ move.pro \ - mbyte.pro \ normal.pro \ ops.pro \ option.pro \ + os_mac_conv.pro \ os_unix.pro \ popupmnu.pro \ + pty.pro \ quickfix.pro \ regexp.pro \ screen.pro \ search.pro \ sha256.pro \ spell.pro \ + spellfile.pro \ syntax.pro \ tag.pro \ term.pro \ + terminal.pro \ termlib.pro \ ui.pro \ undo.pro \ + userfunc.pro \ version.pro \ window.pro \ + beval.pro \ gui_beval.pro \ workshop.pro \ netbeans.pro \ + channel.pro \ $(ALL_GUI_PRO) \ $(TCL_PRO) # Resources used for the Mac are in one directory. RSRC_DIR = os_mac_rsrc -PRO_MANUAL = os_amiga.pro os_msdos.pro os_win16.pro os_win32.pro \ +PRO_MANUAL = os_amiga.pro os_win32.pro \ os_mswin.pro winclip.pro os_beos.pro os_vms.pro $(PERL_PRO) # Default target is making the executable and tools @@ -1693,15 +1906,17 @@ config auto/config.mk: auto/configure config.mk.in config.h.in CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" $(CONF_SHELL) srcdir="$(srcdir)" \ ./configure $(CONF_OPT_GUI) $(CONF_OPT_X) $(CONF_OPT_XSMP) \ - $(CONF_OPT_DARWIN) $(CONF_OPT_FAIL) \ + $(CONF_OPT_AUTOSERVE) $(CONF_OPT_DARWIN) $(CONF_OPT_FAIL) \ $(CONF_OPT_PERL) $(CONF_OPT_PYTHON) $(CONF_OPT_PYTHON3) \ - $(CONF_OPT_TCL) $(CONF_OPT_RUBY) $(CONF_OPT_NLS) \ + $(CONF_OPT_TCL) $(CONF_OPT_RUBY) $(CONF_OPT_RUBY19) $(CONF_OPT_NLS) \ $(CONF_OPT_CSCOPE) $(CONF_OPT_MULTIBYTE) $(CONF_OPT_INPUT) \ $(CONF_OPT_OUTPUT) $(CONF_OPT_GPM) $(CONF_OPT_WORKSHOP) \ - $(CONF_OPT_SNIFF) $(CONF_OPT_FEAT) $(CONF_TERM_LIB) \ - $(CONF_OPT_COMPBY) $(CONF_OPT_ACL) $(CONF_OPT_NETBEANS) \ + $(CONF_OPT_FEAT) $(CONF_TERM_LIB) \ + $(CONF_OPT_COMPBY) $(CONF_OPT_ACL) $(CONF_OPT_NETBEANS) \ + $(CONF_OPT_CHANNEL) $(CONF_OPT_TERMINAL) \ $(CONF_ARGS) $(CONF_OPT_MZSCHEME) $(CONF_OPT_PLTHOME) \ $(CONF_OPT_LUA) $(CONF_OPT_LUA_PREFIX) \ + $(CONF_OPT_LUA52) $(CONF_OPT_LUA52_PREFIX) \ $(CONF_OPT_SYSMOUSE); \ fi @@ -1718,7 +1933,7 @@ reconfig: scratch clean # - DO NOT RUN autoconf MANUALLY! It will overwrite ./configure instead of # producing auto/configure. # - autoconf is not run automatically, because a patch usually changes both -# configure.in and auto/configure but can't update the timestamps. People +# configure.ac and auto/configure but can't update the timestamps. People # who do not have (the correct version of) autoconf would run into trouble. # # Two tricks are required to make autoconf put its output in the "auto" dir: @@ -1741,14 +1956,18 @@ autoconf: -rm -rf autom4te.cache -rm -f auto/config.status auto/config.cache -# Re-execute this Makefile to include the new auto/config.mk produced by -# configure Only used when typing "make" with a fresh auto/config.mk. -myself: - $(MAKE) -f Makefile all +# Run vim script to generate the Ex command lookup table. +# This only needs to be run when a command name has been added or changed. +# If this fails because you don't have Vim yet, first build and install Vim +# without changes. +cmdidxs: ex_cmds.h + vim -u NONE -i NONE -X -S create_cmdidxs.vim # The normal command to compile a .c file to its .o file. -CCC = $(CC) -c -I$(srcdir) $(ALL_CFLAGS) +# Without or with ALL_CFLAGS. +CCC_NF = $(CC) -c -I$(srcdir) +CCC = $(CCC_NF) $(ALL_CFLAGS) # Link the target for normal use or debugging. @@ -1769,10 +1988,11 @@ xxd/xxd$(EXEEXT): xxd/xxd.c languages: @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); \ - CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ fi -@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ - cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ + cd $(PODIR); \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ fi # Update the *.po files for changes in the sources. Only run manually. @@ -1782,19 +2002,18 @@ update-po: # Generate function prototypes. This is not needed to compile vim, but if # you want to use it, cproto is out there on the net somewhere -- Webb # -# When generating os_amiga.pro, os_msdos.pro and os_win32.pro there will be a +# When generating os_amiga.pro and os_win32.pro there will be a # few include files that can not be found, that's OK. proto: $(PRO_AUTO) $(PRO_MANUAL) # Filter out arguments that cproto doesn't support. -# Don't pass "-pthread" to cproto, it sees it as a list of individual flags. -# Don't pass "-fstack-protector" to cproto, for the same reason. -# Don't pass "-g" to cproto. +# Don't pass "-pthread", "-fwrapv" and similar arguments to cproto, it sees +# them as a list of individual flags. # The -E"gcc -E" argument must be separate to avoid problems with shell # quoting. CPROTO = cproto $(PROTO_FLAGS) -DPROTO \ - `echo '$(LINT_CFLAGS)' | sed -e 's/-pthread//g' -e 's/-fstack-protector//g' -e 's/\ -g\ / /g'` + `echo '$(LINT_CFLAGS)' | sed -e 's/ -[a-z-]\+//g'` ### Would be nice if this would work for "normal" make. ### Currently it only works for (Free)BSD make. @@ -1811,24 +2030,16 @@ os_amiga.pro: os_amiga.c $(CPROTO) -DAMIGA -UHAVE_CONFIG_H -DBPTR=char* $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ -os_msdos.pro: os_msdos.c - $(CPROTO) -DMSDOS -UHAVE_CONFIG_H $< > proto/$@ - echo "/* vim: set ft=c : */" >> proto/$@ - -os_win16.pro: os_win16.c - $(CPROTO) -DWIN16 -UHAVE_CONFIG_H $< > proto/$@ - echo "/* vim: set ft=c : */" >> proto/$@ - os_win32.pro: os_win32.c $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ os_mswin.pro: os_mswin.c - $(CPROTO) -DWIN16 -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ + $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ winclip.pro: winclip.c - $(CPROTO) -DWIN16 -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ + $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ os_beos.pro: os_beos.c @@ -1849,6 +2060,9 @@ os_vms.pro: os_vms.c if_perl.pro: auto/if_perl.c $(CPROTO) -DFEAT_GUI auto/if_perl.c | sed "/_VI/d" > proto/$@ +gui_gtk_gresources.pro: auto/gui_gtk_gresources.c + $(CPROTO) -DFEAT_GUI $< > proto/$@ + echo "/* vim: set ft=c : */" >> proto/$@ notags: -rm -f tags @@ -1857,7 +2071,7 @@ notags: # Motif and Athena GUI # You can ignore error messages for missing files. tags TAGS: notags - $(TAGPRG) $(TAGS_SRC) $(TAGS_INCL) + $(TAGPRG) $(TAGS_SRC) $(TAGS_INCL) $(TERM_SRC) $(TERM_DEPS) # Make a highlight file for types. Requires Exuberant ctags and awk types: types.vim @@ -1865,6 +2079,12 @@ types.vim: $(TAGS_SRC) $(TAGS_INCL) ctags --c-kinds=gstu -o- $(TAGS_SRC) $(TAGS_INCL) |\ awk 'BEGIN{printf("syntax keyword Type\t")}\ {printf("%s ", $$1)}END{print ""}' > $@ + echo "syn keyword Constant OK FAIL TRUE FALSE MAYBE" >> $@ + +# TESTING +# +# Execute the test scripts and the unittests. +test check: scripttests unittests # Execute the test scripts. Run these after compiling Vim, before installing. # This doesn't depend on $(VIMTARGET), because that won't work when configure @@ -1877,7 +2097,7 @@ types.vim: $(TAGS_SRC) $(TAGS_INCL) # If everything is alright, the final message will be "ALL DONE". If not you # get "TEST FAILURE". # -test check: +scripttests: $(MAKE) -f Makefile $(VIMTARGET) if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); $(MAKE) -f Makefile check VIM=../$(VIMTARGET); \ @@ -1886,32 +2106,259 @@ test check: ln -s $(VIMTARGET) vim; \ fi cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) - $(MAKE) -f Makefile unittest + +# Run the tests with the GUI. Assumes vim/gvim was already built +testgui: + cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) GUI_FLAG=-g $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + +benchmark: + cd testdir; $(MAKE) -f Makefile benchmark VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) unittesttargets: $(MAKE) -f Makefile $(UNITTEST_TARGETS) -unittest unittests: $(UNITTEST_TARGETS) - @for t in $(UNITTEST_TARGETS); do \ - ./$$t || exit 1; echo $$t passed; \ - done +# Swap these lines to run individual tests with gvim instead of vim. +VIMTESTTARGET = $(VIMTARGET) +# VIMTESTTARGET = $(GVIMTARGET) + +# Execute the unittests one by one. +unittest unittests: $(RUN_UNITTESTS) + +run_json_test: $(JSON_TEST_TARGET) + $(VALGRIND) ./$(JSON_TEST_TARGET) || exit 1; echo $* passed; + +run_kword_test: $(KWORD_TEST_TARGET) + $(VALGRIND) ./$(KWORD_TEST_TARGET) || exit 1; echo $* passed; + +run_memfile_test: $(MEMFILE_TEST_TARGET) + $(VALGRIND) ./$(MEMFILE_TEST_TARGET) || exit 1; echo $* passed; + +run_message_test: $(MESSAGE_TEST_TARGET) + $(VALGRIND) ./$(MESSAGE_TEST_TARGET) || exit 1; echo $* passed; -# Run individual test, assuming that Vim was already compiled. -test1 test2 test3 test4 test5 test6 test7 test8 test9 \ - test_autoformat_join \ +# Run individual OLD style test. +# These do not depend on the executable, compile it when needed. +test1 \ test_eval \ + test3 test11 test14 test17 \ + test29 test30 test37 test39 \ + test42 test44 test48 test49 \ + test52 test59 \ + test64 test69 \ + test70 test72 \ + test85 test86 test87 test88 \ + test94 test95 test99 test108: + cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + +# Run individual NEW style test. +# These do not depend on the executable, compile it when needed. +test_arglist \ + test_arabic \ + test_assert \ + test_assign \ + test_autochdir \ + test_autocmd \ + test_autoload \ + test_backspace_opt \ + test_blockedit \ + test_breakindent \ + test_bufline \ + test_bufwintabinfo \ + test_cd \ + test_cdo \ + test_changedtick \ + test_changelist \ + test_channel \ + test_charsearch \ + test_charsearch_utf8 \ + test_cindent \ + test_clientserver \ + test_close_count \ + test_cmdline \ + test_command_count \ + test_comparators \ + test_compiler \ + test_crypt \ + test_cscope \ + test_cursor_func \ + test_curswant \ + test_delete \ + test_diffmode \ + test_digraph \ + test_display \ + test_edit \ + test_erasebackword \ + test_escaped_glob \ + test_eval_stuff \ + test_ex_undo \ + test_ex_z \ + test_exit \ + test_exec_while_if \ + test_execute_func \ + test_exists \ + test_exists_autocmd \ + test_expand \ + test_expand_dllpath \ + test_expr \ + test_expr_utf8 \ + test_farsi \ + test_feedkeys \ + test_file_perm \ + test_file_size \ + test_fileformat \ + test_filetype \ + test_filter_cmd \ + test_filter_map \ + test_find_complete \ + test_findfile \ + test_fixeol \ + test_float_func \ + test_fnameescape \ + test_fnamemodify \ + test_fold \ + test_functions \ + test_ga \ + test_getcwd \ + test_getvar \ + test_gf \ + test_glob2regpat \ + test_global \ + test_gn \ + test_goto \ + test_gui \ + test_gui_init \ + test_hardcopy \ + test_help \ + test_help_tagjump \ + test_hide \ + test_highlight \ + test_history \ + test_hlsearch \ + test_iminsert \ + test_increment \ + test_increment_dbcs \ + test_ins_complete \ + test_job_fails \ + test_join \ + test_json \ + test_jumplist \ + test_jumps \ + test_lambda \ + test_langmap \ + test_largefile \ + test_let \ + test_lineending \ + test_lispwords \ + test_listchars \ + test_listdict \ + test_listlbr \ + test_listlbr_utf8 \ + test_lua \ + test_makeencoding \ + test_man \ + test_maparg \ + test_mapping \ + test_marks \ + test_match \ + test_matchadd_conceal \ + test_matchadd_conceal_utf8 \ + test_menu \ + test_messages \ + test_mksession \ + test_mksession_utf8 \ + test_nested_function \ + test_netbeans \ + test_normal \ + test_number \ test_options \ - test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \ - test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ - test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \ - test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \ - test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \ - test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \ - test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \ - test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \ - test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \ - test100 test101 test102 test103 test104 test105 test106 test107: - cd testdir; rm $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + test_packadd \ + test_partial \ + test_paste \ + test_perl \ + test_plus_arg_edit \ + test_popup \ + test_preview \ + test_profile \ + test_prompt_buffer \ + test_put \ + test_python2 \ + test_python3 \ + test_pyx2 \ + test_pyx3 \ + test_quickfix \ + test_quotestar \ + test_recover \ + test_regex_char_classes \ + test_regexp_latin \ + test_regexp_utf8 \ + test_registers \ + test_reltime \ + test_retab \ + test_ruby \ + test_scroll_opt \ + test_scrollbind \ + test_search \ + test_searchpos \ + test_set \ + test_sha256 \ + test_signs \ + test_smartindent \ + test_sort \ + test_source_utf8 \ + test_spell \ + test_startup \ + test_startup_utf8 \ + test_stat \ + test_statusline \ + test_substitute \ + test_swap \ + test_syn_attr \ + test_syntax \ + test_system \ + test_tabline \ + test_tabpage \ + test_tagcase \ + test_tagjump \ + test_taglist \ + test_tcl \ + test_terminal \ + test_terminal_fail \ + test_textformat \ + test_textobjects \ + test_timers \ + test_true_false \ + test_undo \ + test_unlet \ + test_usercommands \ + test_utf8 \ + test_utf8_comparisons \ + test_viminfo \ + test_vimscript \ + test_virtualedit \ + test_visual \ + test_winbar \ + test_winbuf_close \ + test_window_cmd \ + test_window_id \ + test_windows_home \ + test_wordcount \ + test_writefile \ + test_xxd \ + test_alot_latin \ + test_alot_utf8 \ + test_alot: + cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile $@.res VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + @if test -f testdir/test.log; then \ + cat testdir/test.log; \ + fi + cat testdir/messages + +newtests: + cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile newtestssilent VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + @if test -f testdir/test.log; then \ + cat testdir/test.log; \ + fi + cat testdir/messages testclean: cd testdir; $(MAKE) -f Makefile clean @@ -1921,6 +2368,20 @@ testclean: # Unittests # It's build just like Vim to satisfy all dependencies. +$(JSON_TEST_TARGET): auto/config.mk objects $(JSON_TEST_OBJ) + $(CCC) version.c -o objects/version.o + @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ + -o $(JSON_TEST_TARGET) $(JSON_TEST_OBJ) $(ALL_LIBS)" \ + MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \ + sh $(srcdir)/link.sh + +$(KWORD_TEST_TARGET): auto/config.mk objects $(KWORD_TEST_OBJ) + $(CCC) version.c -o objects/version.o + @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ + -o $(KWORD_TEST_TARGET) $(KWORD_TEST_OBJ) $(ALL_LIBS)" \ + MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \ + sh $(srcdir)/link.sh + $(MEMFILE_TEST_TARGET): auto/config.mk objects $(MEMFILE_TEST_OBJ) $(CCC) version.c -o objects/version.o @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ @@ -1928,6 +2389,13 @@ $(MEMFILE_TEST_TARGET): auto/config.mk objects $(MEMFILE_TEST_OBJ) MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \ sh $(srcdir)/link.sh +$(MESSAGE_TEST_TARGET): auto/config.mk objects $(MESSAGE_TEST_OBJ) + $(CCC) version.c -o objects/version.o + @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ + -o $(MESSAGE_TEST_TARGET) $(MESSAGE_TEST_OBJ) $(ALL_LIBS)" \ + MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \ + sh $(srcdir)/link.sh + # install targets install: $(GUI_INSTALL) @@ -1965,17 +2433,22 @@ INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \ $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) # Install most of the runtime files -installruntime: installrtbase installmacros installtutor installspell +installruntime: installrtbase installmacros installpack installtutor installspell # install the help files; first adjust the contents for the final location installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) \ - $(DEST_FTP) $(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG) \ - $(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP) + $(DEST_FTP) $(DEST_AUTO) $(DEST_AUTO)/dist $(DEST_AUTO)/xml \ + $(DEST_PLUG) $(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP) -$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS) - @echo generating help tags # Generate the help tags with ":helptags" to handle all languages. - -@cd $(HELPSOURCE); $(MAKE) VIMEXE=$(DEST_BIN)/$(VIMTARGET) vimtags +# Move the distributed tags file aside and restore it, to avoid it being +# different from the repository. + cd $(HELPSOURCE); if test -z "$(CROSS_COMPILING)" -a -f tags; then \ + mv -f tags tags.dist; fi + @echo generating help tags + -@cd $(HELPSOURCE); if test -z "$(CROSS_COMPILING)"; then \ + $(MAKE) VIMEXE=$(DEST_BIN)/$(VIMTARGET) vimtags; fi cd $(HELPSOURCE); \ files=`ls *.txt tags`; \ files="$$files `ls *.??x tags-?? 2>/dev/null || true`"; \ @@ -1984,6 +2457,7 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ chmod $(HELPMOD) $$files $(INSTALL_DATA) $(HELPSOURCE)/*.pl $(DEST_HELP) chmod $(SCRIPTMOD) $(DEST_HELP)/*.pl + cd $(HELPSOURCE); if test -f tags.dist; then mv -f tags.dist tags; fi # install the menu files $(INSTALL_DATA) $(SCRIPTSOURCE)/menu.vim $(SYS_MENU_FILE) chmod $(VIMSCRIPTMOD) $(SYS_MENU_FILE) @@ -1991,11 +2465,16 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ chmod $(VIMSCRIPTMOD) $(SYS_SYNMENU_FILE) $(INSTALL_DATA) $(SCRIPTSOURCE)/delmenu.vim $(SYS_DELMENU_FILE) chmod $(VIMSCRIPTMOD) $(SYS_DELMENU_FILE) -# install the evim file - $(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE) - chmod $(VIMSCRIPTMOD) $(MSWIN_FILE) +# install the defaults/evim/mswin file + $(INSTALL_DATA) $(SCRIPTSOURCE)/defaults.vim $(VIM_DEFAULTS_FILE) + chmod $(VIMSCRIPTMOD) $(VIM_DEFAULTS_FILE) $(INSTALL_DATA) $(SCRIPTSOURCE)/evim.vim $(EVIM_FILE) chmod $(VIMSCRIPTMOD) $(EVIM_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE) + chmod $(VIMSCRIPTMOD) $(MSWIN_FILE) +# install the rgb.txt file + $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(SYS_RGB_FILE) + chmod $(VIMSCRIPTMOD) $(SYS_RGB_FILE) # install the bugreport file $(INSTALL_DATA) $(SCRIPTSOURCE)/bugreport.vim $(SYS_BUGR_FILE) chmod $(VIMSCRIPTMOD) $(SYS_BUGR_FILE) @@ -2025,8 +2504,9 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ cd $(PRINTSOURCE); $(INSTALL_DATA) *.ps $(DEST_PRINT) cd $(DEST_PRINT); chmod $(FILEMOD) *.ps # install the colorscheme files - cd $(COLSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_COL) - cd $(DEST_COL); chmod $(HELPMOD) *.vim README.txt + cd $(COLSOURCE); $(INSTALL_DATA_R) *.vim tools README.txt $(DEST_COL) + cd $(DEST_COL); chmod $(DIRMOD) tools + cd $(DEST_COL); chmod $(HELPMOD) *.vim README.txt tools/*.vim # install the syntax files cd $(SYNSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_SYN) cd $(DEST_SYN); chmod $(HELPMOD) *.vim README.txt @@ -2036,6 +2516,8 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ # install the standard autoload files cd $(AUTOSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_AUTO) cd $(DEST_AUTO); chmod $(HELPMOD) *.vim README.txt + cd $(AUTOSOURCE)/dist; $(INSTALL_DATA) *.vim $(DEST_AUTO)/dist + cd $(DEST_AUTO)/dist; chmod $(HELPMOD) *.vim cd $(AUTOSOURCE)/xml; $(INSTALL_DATA) *.vim $(DEST_AUTO)/xml cd $(DEST_AUTO)/xml; chmod $(HELPMOD) *.vim # install the standard plugin files @@ -2060,6 +2542,11 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO) rm -rf $$cvs; \ fi +installpack: $(DEST_VIM) $(DEST_RT) $(DEST_PACK) + $(INSTALL_DATA_R) $(PACKSOURCE)/* $(DEST_PACK) + chmod $(DIRMOD) `find $(DEST_PACK) -type d -print` + chmod $(FILEMOD) `find $(DEST_PACK) -type f -print` + # install the tutor files installtutorbin: $(DEST_VIM) $(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor @@ -2176,15 +2663,28 @@ install-languages: languages $(DEST_LANG) $(DEST_KMAP) chmod $(FILEMOD) $(DEST_KMAP)/README.txt $(DEST_KMAP)/*.vim; \ fi -# install the icons for KDE, if the directory exists and the icon doesn't. +# Install the icons for KDE, if the directory exists and the icon doesn't. +# Always when $(DESTDIR) is not empty. ICON48PATH = $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps ICON32PATH = $(DESTDIR)$(DATADIR)/icons/locolor/32x32/apps ICON16PATH = $(DESTDIR)$(DATADIR)/icons/locolor/16x16/apps +ICONTHEMEPATH = $(DATADIR)/icons/hicolor +DESKTOPPATH = $(DESTDIR)$(DATADIR)/applications KDEPATH = $(HOME)/.kde/share/icons install-icons: + if test -n "$(DESTDIR)"; then \ + $(MKDIR_P) $(ICON48PATH) $(ICON32PATH) \ + $(ICON16PATH) $(DESKTOPPATH); \ + fi + if test -d $(ICON48PATH) -a -w $(ICON48PATH) \ -a ! -f $(ICON48PATH)/gvim.png; then \ $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; \ + if test -z "$(DESTDIR)" -a -x "$(GTK_UPDATE_ICON_CACHE)" \ + -a -w $(ICONTHEMEPATH) \ + -a -f $(ICONTHEMEPATH)/index.theme; then \ + $(GTK_UPDATE_ICON_CACHE) -q $(ICONTHEMEPATH); \ + fi \ fi if test -d $(ICON32PATH) -a -w $(ICON32PATH) \ -a ! -f $(ICON32PATH)/gvim.png; then \ @@ -2194,7 +2694,14 @@ install-icons: -a ! -f $(ICON16PATH)/gvim.png; then \ $(INSTALL_DATA) $(SCRIPTSOURCE)/vim16x16.png $(ICON16PATH)/gvim.png; \ fi - + if test -d $(DESKTOPPATH) -a -w $(DESKTOPPATH); then \ + $(INSTALL_DATA) $(SCRIPTSOURCE)/vim.desktop \ + $(SCRIPTSOURCE)/gvim.desktop \ + $(DESKTOPPATH); \ + if test -z "$(DESTDIR)" -a -x "$(UPDATE_DESKTOP_DATABASE)"; then \ + $(UPDATE_DESKTOP_DATABASE) -q $(DESKTOPPATH); \ + fi \ + fi $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): @echo Runtime files not found. @@ -2204,10 +2711,10 @@ $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \ $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \ - $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \ - $(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ - $(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG): - -$(SHELL) ./mkinstalldirs $@ + $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) $(DEST_MACRO) \ + $(DEST_PACK) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ + $(DEST_AUTO) $(DEST_AUTO)/dist $(DEST_AUTO)/xml $(DEST_PLUG): + $(MKDIR_P) $@ -chmod $(DIRMOD) $@ # create links from various names to vim. This is only done when the links @@ -2339,17 +2846,20 @@ uninstall_runtime: -rm -f $(DEST_MAN_RU)/xxd.1 $(DEST_MAN_RU_U)/xxd.1 -rm -f $(DEST_HELP)/*.txt $(DEST_HELP)/tags $(DEST_HELP)/*.pl -rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-?? + -rm -f $(SYS_RGB_FILE) -rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE) - -rm -f $(SYS_BUGR_FILE) $(EVIM_FILE) $(MSWIN_FILE) + -rm -f $(SYS_BUGR_FILE) $(VIM_DEFAULTS_FILE) $(EVIM_FILE) $(MSWIN_FILE) -rm -f $(DEST_SCRIPT)/gvimrc_example.vim $(DEST_SCRIPT)/vimrc_example.vim -rm -f $(SYS_FILETYPE_FILE) $(SYS_FTOFF_FILE) $(SYS_SCRIPTS_FILE) -rm -f $(SYS_INDOFF_FILE) $(SYS_INDENT_FILE) -rm -f $(SYS_FTPLUGOF_FILE) $(SYS_FTPLUGIN_FILE) -rm -f $(SYS_OPTWIN_FILE) -rm -f $(DEST_COL)/*.vim $(DEST_COL)/README.txt + -rm -rf $(DEST_COL)/tools -rm -f $(DEST_SYN)/*.vim $(DEST_SYN)/README.txt -rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt -rm -rf $(DEST_MACRO) + -rm -rf $(DEST_PACK) -rm -rf $(DEST_TUTOR) -rm -rf $(DEST_SPELL) -rm -rf $(DEST_TOOLS) @@ -2359,18 +2869,22 @@ uninstall_runtime: -rm -f $(DEST_PRINT)/*.ps -rmdir $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) -rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt $(DEST_FTP)/logtalk.dict - -rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt $(DEST_AUTO)/xml/*.vim + -rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt + -rm -f $(DEST_AUTO)/dist/*.vim $(DEST_AUTO)/xml/*.vim -rm -f $(DEST_PLUG)/*.vim $(DEST_PLUG)/README.txt - -rmdir $(DEST_FTP) $(DEST_AUTO)/xml $(DEST_AUTO) $(DEST_PLUG) $(DEST_RT) + -rmdir $(DEST_FTP) $(DEST_AUTO)/dist $(DEST_AUTO)/xml $(DEST_AUTO) + -rmdir $(DEST_PLUG) $(DEST_RT) # This will fail when other Vim versions are installed, no worries. -rmdir $(DEST_VIM) # Clean up all the files that have been produced, except configure's. # We support common typing mistakes for Juergen! :-) clean celan: testclean macvimclean - -rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o - -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c + -rm -f *.o core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o + -rm -rf objects + -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c auto/gui_gtk_gresources.c auto/gui_gtk_gresources.h -rm -f conftest* *~ auto/link.sed + -rm -f testdir/opt_test.vim -rm -f $(UNITTEST_TARGETS) -rm -f runtime pixmaps -rm -rf $(APPDIR) @@ -2384,31 +2898,36 @@ clean celan: testclean macvimclean SHADOWDIR = shadow shadow: runtime pixmaps - mkdir $(SHADOWDIR) - cd $(SHADOWDIR); ln -s ../*.[ch] ../*.in ../*.sh ../*.xs ../*.xbm ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs . + $(MKDIR_P) $(SHADOWDIR) + cd $(SHADOWDIR); ln -s ../*.[chm] ../*.in ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../libvterm ../vimtutor ../gvimtutor ../install-sh . mkdir $(SHADOWDIR)/auto cd $(SHADOWDIR)/auto; ln -s ../../auto/configure . - mkdir $(SHADOWDIR)/po + $(MKDIR_P) $(SHADOWDIR)/po cd $(SHADOWDIR)/po; ln -s ../../po/*.po ../../po/*.mak ../../po/*.vim ../../po/Makefile . cd $(SHADOWDIR); rm -f auto/link.sed cp Makefile configure $(SHADOWDIR) rm -f $(SHADOWDIR)/auto/config.mk $(SHADOWDIR)/config.mk.dist cp config.mk.dist $(SHADOWDIR)/auto/config.mk cp config.mk.dist $(SHADOWDIR) - mkdir $(SHADOWDIR)/xxd + $(MKDIR_P) $(SHADOWDIR)/xxd cd $(SHADOWDIR)/xxd; ln -s ../../xxd/*.[ch] ../../xxd/Make* . if test -d $(RSRC_DIR); then \ cd $(SHADOWDIR); \ ln -s ../infplist.xml .; \ ln -s ../$(RSRC_DIR) ../os_mac.rsr.hqx ../dehqx.py .; \ fi - mkdir $(SHADOWDIR)/testdir + $(MKDIR_P) $(SHADOWDIR)/testdir cd $(SHADOWDIR)/testdir; ln -s ../../testdir/Makefile \ - ../../testdir/vimrc.unix \ + ../../testdir/Make_all.mak \ + ../../testdir/README.txt \ ../../testdir/*.in \ ../../testdir/*.vim \ + ../../testdir/*.py \ ../../testdir/python* \ + ../../testdir/pyxfile \ ../../testdir/sautest \ + ../../testdir/samples \ + ../../testdir/dumps \ ../../testdir/test83-tags? \ ../../testdir/*.ok . @@ -2480,13 +2999,8 @@ lintinstall: auto/if_perl.c: if_perl.xs $(PERL) -e 'unless ( $$] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$$_ $$_\n" }}' > $@ - -@if test -e $(PERLSITELIB)/ExtUtils/xsubpp; then \ - $(PERL) $(PERLSITELIB)/ExtUtils/xsubpp -prototypes -typemap \ - $(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@; \ - else \ - $(PERL) $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \ - $(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@; \ - fi + $(PERL) $(PERL_XSUBPP) -prototypes -typemap \ + $(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@ auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in CC="$(CC) $(OSDEF_CFLAGS)" srcdir=$(srcdir) sh $(srcdir)/osdef.sh @@ -2511,12 +3025,42 @@ auto/pathdef.c: Makefile auto/config.mk -@echo '";' >> $@ -@sh $(srcdir)/pathdef.sh +GUI_GTK_RES_INPUTS = \ + ../pixmaps/stock_vim_build_tags.png \ + ../pixmaps/stock_vim_find_help.png \ + ../pixmaps/stock_vim_save_all.png \ + ../pixmaps/stock_vim_session_load.png \ + ../pixmaps/stock_vim_session_new.png \ + ../pixmaps/stock_vim_session_save.png \ + ../pixmaps/stock_vim_shell.png \ + ../pixmaps/stock_vim_window_maximize.png \ + ../pixmaps/stock_vim_window_maximize_width.png \ + ../pixmaps/stock_vim_window_minimize.png \ + ../pixmaps/stock_vim_window_minimize_width.png \ + ../pixmaps/stock_vim_window_split.png \ + ../pixmaps/stock_vim_window_split_vertical.png + +auto/gui_gtk_gresources.c: gui_gtk_res.xml $(GUI_GTK_RES_INPUTS) + $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register gui_gtk_res.xml +auto/gui_gtk_gresources.h: gui_gtk_res.xml $(GUI_GTK_RES_INPUTS) + if test -z "$(GLIB_COMPILE_RESOURCES)"; then touch $@; else \ + $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register gui_gtk_res.xml; \ + fi + # All the object files are put in the "objects" directory. Since not all make # commands understand putting object files in another directory, it must be # specified for each file separately. -objects: - mkdir objects +objects: objects/.dirstamp + +objects/.dirstamp: + $(MKDIR_P) objects + touch objects/.dirstamp + +# All object files depend on the objects directory, so that parallel make +# works. Can't depend on the directory itself, its timestamp changes all the +# time. +$(ALL_OBJ): objects/.dirstamp objects/MMBackend.o: MacVim/MMBackend.m $(CCC) -fobjc-exceptions -o $@ MacVim/MMBackend.m @@ -2524,6 +3068,9 @@ objects/MMBackend.o: MacVim/MMBackend.m objects/MacVim.o: MacVim/MacVim.m $(CCC) -o $@ MacVim/MacVim.m +objects/arabic.o: arabic.c + $(CCC) -o $@ arabic.c + objects/blowfish.o: blowfish.c $(CCC) -o $@ blowfish.c @@ -2533,6 +3080,15 @@ objects/buffer.o: buffer.c objects/charset.o: charset.c $(CCC) -o $@ charset.c +objects/crypt.o: crypt.c + $(CCC) -o $@ crypt.c + +objects/crypt_zip.o: crypt_zip.c + $(CCC) -o $@ crypt_zip.c + +objects/dict.o: dict.c + $(CCC) -o $@ dict.c + objects/diff.o: diff.c $(CCC) -o $@ diff.c @@ -2545,6 +3101,9 @@ objects/edit.o: edit.c objects/eval.o: eval.c $(CCC) -o $@ eval.c +objects/evalfunc.o: evalfunc.c + $(CCC) -o $@ evalfunc.c + objects/ex_cmds.o: ex_cmds.c $(CCC) -o $@ ex_cmds.c @@ -2560,6 +3119,9 @@ objects/ex_eval.o: ex_eval.c objects/ex_getln.o: ex_getln.c $(CCC) -o $@ ex_getln.c +objects/farsi.o: farsi.c + $(CCC) -o $@ farsi.c + objects/fileio.o: fileio.c $(CCC) -o $@ fileio.c @@ -2569,6 +3131,9 @@ objects/fold.o: fold.c objects/getchar.o: getchar.c $(CCC) -o $@ getchar.c +objects/guess.o: guess.c guess_tab.c + $(CCC) -o $@ guess.c + objects/hardcopy.o: hardcopy.c $(CCC) -o $@ hardcopy.c @@ -2587,6 +3152,9 @@ objects/gui_at_sb.o: gui_at_sb.c objects/gui_athena.o: gui_athena.c $(CCC) -o $@ gui_athena.c +objects/beval.o: beval.c + $(CCC) -o $@ beval.c + objects/gui_beval.o: gui_beval.c $(CCC) -o $@ gui_beval.c @@ -2596,6 +3164,9 @@ objects/gui_gtk.o: gui_gtk.c objects/gui_gtk_f.o: gui_gtk_f.c $(CCC) -o $@ gui_gtk_f.c +objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c + $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ auto/gui_gtk_gresources.c + objects/gui_gtk_x11.o: gui_gtk_x11.c $(CCC) -o $@ gui_gtk_x11.c @@ -2630,43 +3201,50 @@ objects/if_xcmdsrv.o: if_xcmdsrv.c $(CCC) -o $@ if_xcmdsrv.c objects/if_lua.o: if_lua.c - $(CCC) $(LUA_CFLAGS) -o $@ if_lua.c + $(CCC_NF) $(LUA_CFLAGS) $(ALL_CFLAGS) -o $@ if_lua.c + +objects/if_lua52.o: if_lua52.c + $(CCC_NF) $(LUA52_CFLAGS) $(ALL_CFLAGS) -o $@ if_lua52.c objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA) $(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c - + mzscheme_base.c: $(MZSCHEME_MZC) --c-mods mzscheme_base.c ++lib scheme/base objects/if_perl.o: auto/if_perl.c - $(CCC) $(PERL_CFLAGS) -o $@ auto/if_perl.c + $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ auto/if_perl.c objects/if_perlsfio.o: if_perlsfio.c - $(CCC) $(PERL_CFLAGS) -o $@ if_perlsfio.c - -objects/py_getpath.o: $(PYTHON_CONFDIR)/getpath.c - $(CCC) $(PYTHON_CFLAGS) -o $@ $(PYTHON_CONFDIR)/getpath.c \ - -I$(PYTHON_CONFDIR) -DHAVE_CONFIG_H -DNO_MAIN \ - $(PYTHON_GETPATH_CFLAGS) + $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ if_perlsfio.c objects/if_python.o: if_python.c if_py_both.h - $(CCC) $(PYTHON_CFLAGS) $(PYTHON_CFLAGS_EXTRA) -o $@ if_python.c + $(CCC_NF) $(PYTHON_CFLAGS) $(PYTHON_CFLAGS_EXTRA) $(ALL_CFLAGS) -o $@ if_python.c objects/if_python3.o: if_python3.c if_py_both.h - $(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c + $(CCC_NF) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) $(ALL_CFLAGS) -o $@ if_python3.c objects/if_ruby.o: if_ruby.c - $(CCC) $(RUBY_CFLAGS) -o $@ if_ruby.c - -objects/if_sniff.o: if_sniff.c - $(CCC) -o $@ if_sniff.c + $(CCC_NF) $(RUBY_CFLAGS) $(ALL_CFLAGS) -o $@ if_ruby.c objects/if_tcl.o: if_tcl.c - $(CCC) -o $@ if_tcl.c + $(CCC_NF) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ if_tcl.c objects/integration.o: integration.c $(CCC) -o $@ integration.c +objects/json.o: json.c + $(CCC) -o $@ json.c + +objects/json_test.o: json_test.c + $(CCC) -o $@ json_test.c + +objects/kword_test.o: kword_test.c + $(CCC) -o $@ kword_test.c + +objects/list.o: list.c + $(CCC) -o $@ list.c + objects/main.o: main.c $(CCC) -o $@ main.c @@ -2688,6 +3266,9 @@ objects/menu.o: menu.c objects/message.o: message.c $(CCC) -o $@ message.c +objects/message_test.o: message_test.c + $(CCC) -o $@ message_test.c + objects/misc1.o: misc1.c $(CCC) -o $@ misc1.c @@ -2707,7 +3288,7 @@ objects/ops.o: ops.c $(CCC) -o $@ ops.c objects/option.o: option.c - $(CCC) -o $@ option.c + $(CCC_NF) $(LUA_CFLAGS) $(LUA52_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(RUBY_CFLAGS) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ option.c objects/os_beos.o: os_beos.c $(CCC) -o $@ os_beos.c @@ -2733,12 +3314,12 @@ objects/winclip.o: winclip.c objects/pathdef.o: auto/pathdef.c $(CCC) -o $@ auto/pathdef.c -objects/pty.o: pty.c - $(CCC) -o $@ pty.c - objects/popupmnu.o: popupmnu.c $(CCC) -o $@ popupmnu.c +objects/pty.o: pty.c + $(CCC) -o $@ pty.c + objects/quickfix.o: quickfix.c $(CCC) -o $@ quickfix.c @@ -2757,6 +3338,9 @@ objects/sha256.o: sha256.c objects/spell.o: spell.c $(CCC) -o $@ spell.c +objects/spellfile.o: spellfile.c + $(CCC) -o $@ spellfile.c + objects/syntax.o: syntax.c $(CCC) -o $@ syntax.c @@ -2766,12 +3350,18 @@ objects/tag.o: tag.c objects/term.o: term.c $(CCC) -o $@ term.c +objects/terminal.o: terminal.c $(TERM_DEPS) + $(CCC) -o $@ terminal.c + objects/ui.o: ui.c $(CCC) -o $@ ui.c objects/undo.o: undo.c $(CCC) -o $@ undo.c +objects/userfunc.o: userfunc.c + $(CCC) -o $@ userfunc.c + objects/window.o: window.c $(CCC) -o $@ window.c @@ -2784,9 +3374,44 @@ objects/wsdebug.o: wsdebug.c objects/netbeans.o: netbeans.c $(CCC) -o $@ netbeans.c +objects/channel.o: channel.c + $(CCC) -o $@ channel.c + Makefile: @echo The name of the makefile MUST be "Makefile" (with capital M)!!!! +CCCTERM = $(CCC_NF) -Ilibvterm/include $(ALL_CFLAGS) -DINLINE="" \ + -DVSNPRINTF=vim_vsnprintf \ + -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \ + -DWCWIDTH_FUNCTION=utf_uint2cells + +objects/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/encoding.c + +objects/term_keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/keyboard.c + +objects/term_mouse.o: libvterm/src/mouse.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/mouse.c + +objects/term_parser.o: libvterm/src/parser.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/parser.c + +objects/term_pen.o: libvterm/src/pen.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/pen.c + +objects/term_screen.o: libvterm/src/screen.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/screen.c + +objects/term_state.o: libvterm/src/state.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/state.c + +objects/term_unicode.o: libvterm/src/unicode.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/unicode.c + +objects/term_vterm.o: libvterm/src/vterm.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/vterm.c + ############################################################################### ### MacOS X installation ### @@ -2807,8 +3432,7 @@ install_macosx: gui_bundle # Generate the help tags file now, it won't work with "make installruntime". -@srcdir=`pwd`; cd $(HELPSOURCE); $(MAKE) VIMEXE=$$srcdir/$(VIMTARGET) vimtags # Install the runtime files. Recursive! - -mkdir -p $(DESTDIR)$(prefix)/$(RESDIR)/vim/runtime -# -mkdir $(DESTDIR)$(prefix)/$(APPDIR)/bin + $(MKDIR_P) $(DESTDIR)$(prefix)/$(RESDIR)/vim/runtime srcdir=`pwd`; $(MAKE) -f Makefile installruntime \ VIMEXE=$$srcdir/$(VIMTARGET) \ prefix=$(DESTDIR)$(prefix)/$(RESDIR)$(VIMDIR) \ @@ -2826,16 +3450,16 @@ gui_bundle: $(RESDIR) bundle-dir bundle-executable bundle-info bundle-resource \ bundle-language $(RESDIR): - mkdir -p $@ + $(MKDIR_P) $@ bundle-dir: $(APPDIR)/Contents $(VIMTARGET) # Make a link to the runtime directory, so that we can try out the executable # without installing it. - mkdir -p $(RESDIR)/vim + $(MKDIR_P) $(RESDIR)/vim -ln -s `pwd`/../runtime $(RESDIR)/vim bundle-executable: $(VIMTARGET) - mkdir -p $(APPDIR)/Contents/MacOS + $(MKDIR_P) $(APPDIR)/Contents/MacOS cp $(VIMTARGET) $(APPDIR)/Contents/MacOS/$(VIMTARGET) bundle-info: bundle-dir @@ -2866,229 +3490,310 @@ bundle-rsrc: os_mac.rsr.hqx bundle-language: bundle-dir $(APPDIR)/Contents: - -$(SHELL) ./mkinstalldirs $(APPDIR)/Contents/MacOS - -$(SHELL) ./mkinstalldirs $(RESDIR)/English.lproj + $(MKDIR_P) $(APPDIR)/Contents/MacOS + $(MKDIR_P) $(RESDIR)/English.lproj ############################################################################## ### MacVim GUI -.PHONY: macvim macvimclean +.PHONY: macvim macvim-dmg macvimclean + +RELEASEDIR = MacVim/build/Release +DMGDIR = MacVim/build/dmg +DMGFILE = MacVim.dmg + macvim: $(VIMTARGET) xcodebuild -project MacVim/MacVim.xcodeproj $(XCODEFLAGS) +macvim-dmg: macvim + mkdir -p $(DMGDIR) + cp -a $(RELEASEDIR)/MacVim.app $(DMGDIR)/ + rm -rf $(RELEASEDIR)/$(DMGFILE) + create-dmg/create-dmg \ + --volname "MacVim" \ + --volicon MacVim/icons/MacVim.icns \ + --background create-dmg/background.png \ + --window-size 650 470 \ + --icon-size 80 \ + --icon MacVim.app 240 320 \ + --app-drop-link 410 320 \ + $(RELEASEDIR)/$(DMGFILE) $(DMGDIR) + macvimclean: if test -d MacVim; then \ - xcodebuild -project MacVim/MacVim.xcodeproj clean; \ + rm -rf MacVim/build MacVim/qlstephen/build xxd/xxd.dSYM; \ fi ############################################################################### ### (automatically generated by 'make depend') ### Dependencies: +objects/arabic.o: arabic.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/beval.o: beval.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/blowfish.o: blowfish.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/buffer.o: buffer.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h objects/charset.o: charset.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/crypt.o: crypt.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/crypt_zip.o: crypt_zip.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h +objects/dict.o: dict.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/diff.o: diff.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/digraph.o: digraph.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/edit.o: edit.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/eval.o: eval.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h +objects/evalfunc.o: evalfunc.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h objects/ex_cmds.o: ex_cmds.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h objects/ex_cmds2.o: ex_cmds2.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h version.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h objects/ex_docmd.o: ex_docmd.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h ex_cmdidxs.h objects/ex_eval.o: ex_eval.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/ex_getln.o: ex_getln.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h +objects/farsi.o: farsi.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/fileio.o: fileio.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/fold.o: fold.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/getchar.o: getchar.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/guess.o: guess.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ + beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ arabic.h objects/hardcopy.o: hardcopy.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h version.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h objects/hashtab.o: hashtab.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/if_cscope.o: if_cscope.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h if_cscope.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h if_cscope.h objects/if_xcmdsrv.o: if_xcmdsrv.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h version.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h +objects/json.o: json.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/list.o: list.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/main.o: main.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h farsi.c arabic.c + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/mark.o: mark.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/memfile.o: memfile.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/memline.o: memline.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/menu.o: menu.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/message.o: message.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/misc1.o: misc1.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h objects/misc2.o: misc2.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/move.o: move.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/mbyte.o: mbyte.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/normal.o: normal.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/ops.o: ops.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ - keymap.h term.h macros.h option.h structs.h regexp.h gui.h gui_beval.h \ - proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h arabic.h -objects/option.o: option.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ + keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro structs.h \ + regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \ arabic.h +objects/option.o: option.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/os_unix.o: os_unix.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h if_mzsch.h os_unixx.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h if_mzsch.h os_unixx.h objects/pathdef.o: auto/pathdef.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/popupmnu.o: popupmnu.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h +objects/pty.o: pty.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ + keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro structs.h \ + regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \ + arabic.h objects/quickfix.o: quickfix.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/regexp.o: regexp.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h regexp_nfa.c + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h regexp_nfa.c objects/screen.o: screen.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/search.o: search.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/sha256.o: sha256.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/spell.o: spell.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/spellfile.o: spellfile.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/syntax.o: syntax.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/tag.o: tag.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ - keymap.h term.h macros.h option.h structs.h regexp.h gui.h gui_beval.h \ - proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h arabic.h -objects/term.o: term.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ + keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro structs.h \ + regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \ arabic.h +objects/term.o: term.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h +objects/terminal.o: terminal.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h objects/ui.o: ui.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ - keymap.h term.h macros.h option.h structs.h regexp.h gui.h gui_beval.h \ - proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h arabic.h -objects/undo.o: undo.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ + keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro structs.h \ + regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \ arabic.h +objects/undo.o: undo.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/userfunc.o: userfunc.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/version.o: version.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h objects/window.o: window.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/gui.o: gui.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ - keymap.h term.h macros.h option.h structs.h regexp.h gui.h gui_beval.h \ - proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h arabic.h -objects/gui_gtk.o: gui_gtk.c gui_gtk_f.h vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h ../pixmaps/stock_icons.h + keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro structs.h \ + regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h farsi.h \ + arabic.h +objects/gui_gtk.o: gui_gtk.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h gui_gtk_f.h objects/gui_gtk_f.o: gui_gtk_f.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_gtk_f.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_gtk_f.h objects/gui_motif.o: gui_motif.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_xmebw.h ../pixmaps/alert.xpm \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_xmebw.h ../pixmaps/alert.xpm \ ../pixmaps/error.xpm ../pixmaps/generic.xpm ../pixmaps/info.xpm \ ../pixmaps/quest.xpm gui_x11_pm.h ../pixmaps/tb_new.xpm \ ../pixmaps/tb_open.xpm ../pixmaps/tb_close.xpm ../pixmaps/tb_save.xpm \ @@ -3107,17 +3812,17 @@ objects/gui_motif.o: gui_motif.c vim.h auto/config.h feature.h os_unix.h \ ../pixmaps/tb_vsplit.xpm ../pixmaps/tb_maxwidth.xpm \ ../pixmaps/tb_minwidth.xpm objects/gui_xmdlg.o: gui_xmdlg.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/gui_xmebw.o: gui_xmebw.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_xmebwp.h gui_xmebw.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_xmebwp.h gui_xmebw.h objects/gui_athena.o: gui_athena.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_at_sb.h gui_x11_pm.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_at_sb.h gui_x11_pm.h \ ../pixmaps/tb_new.xpm ../pixmaps/tb_open.xpm ../pixmaps/tb_close.xpm \ ../pixmaps/tb_save.xpm ../pixmaps/tb_print.xpm ../pixmaps/tb_cut.xpm \ ../pixmaps/tb_copy.xpm ../pixmaps/tb_paste.xpm ../pixmaps/tb_find.xpm \ @@ -3134,84 +3839,98 @@ objects/gui_athena.o: gui_athena.c vim.h auto/config.h feature.h os_unix.h \ ../pixmaps/tb_vsplit.xpm ../pixmaps/tb_maxwidth.xpm \ ../pixmaps/tb_minwidth.xpm objects/gui_gtk_x11.o: gui_gtk_x11.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_gtk_f.h ../runtime/vim32x32.xpm \ - ../runtime/vim16x16.xpm ../runtime/vim48x48.xpm + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h auto/gui_gtk_gresources.h gui_gtk_f.h \ + ../runtime/vim32x32.xpm ../runtime/vim16x16.xpm ../runtime/vim48x48.xpm objects/gui_x11.o: gui_x11.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h ../runtime/vim32x32.xpm ../runtime/vim16x16.xpm \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h ../runtime/vim32x32.xpm ../runtime/vim16x16.xpm \ ../runtime/vim48x48.xpm objects/gui_at_sb.o: gui_at_sb.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_at_sb.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_at_sb.h objects/gui_at_fs.o: gui_at_fs.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h gui_at_sb.h -objects/pty.o: pty.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h \ - keymap.h term.h macros.h option.h structs.h regexp.h gui.h gui_beval.h \ - proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h gui_at_sb.h +objects/json_test.o: json_test.c main.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h json.c +objects/kword_test.o: kword_test.c main.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h charset.c objects/memfile_test.o: memfile_test.c main.c vim.h auto/config.h feature.h \ - os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h \ - structs.h regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h \ - proto.h globals.h farsi.h arabic.h farsi.c arabic.c memfile.c + os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h memfile.c +objects/message_test.o: message_test.c main.c vim.h auto/config.h feature.h \ + os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h message.c objects/hangulin.o: hangulin.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/if_lua.o: if_lua.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/if_lua52.o: if_lua52.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + alloc.h beval.h proto/beval.pro proto/gui_beval.pro ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/if_mzsch.o: if_mzsch.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h if_mzsch.h mzscheme_base.c + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h if_mzsch.h mzscheme_base.c objects/if_perl.o: auto/if_perl.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/if_perlsfio.o: if_perlsfio.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/if_python.o: if_python.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h if_py_both.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h if_py_both.h objects/if_python3.o: if_python3.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h if_py_both.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h if_py_both.h objects/if_tcl.o: if_tcl.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h objects/if_ruby.o: if_ruby.c auto/config.h vim.h feature.h os_unix.h auto/osdef.h \ - ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ - gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ - arabic.h version.h -objects/if_sniff.o: if_sniff.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h os_unixx.h + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h version.h objects/gui_beval.o: gui_beval.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h objects/workshop.o: workshop.c auto/config.h integration.h vim.h feature.h \ - os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h \ - structs.h regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h \ + os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto.h globals.h farsi.h arabic.h version.h workshop.h objects/wsdebug.o: wsdebug.c objects/integration.o: integration.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h integration.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h integration.h objects/netbeans.o: netbeans.c vim.h auto/config.h feature.h os_unix.h \ - auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ - regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ - globals.h farsi.h arabic.h version.h + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h farsi.h arabic.h version.h +objects/channel.o: channel.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h beval.h proto/gui_beval.pro \ + structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h proto.h globals.h \ + farsi.h arabic.h +objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c diff --git a/src/README.txt b/src/README.txt index 2fafd4f7c2..e134306015 100644 --- a/src/README.txt +++ b/src/README.txt @@ -8,8 +8,8 @@ You might also want to read ":help development". JUMPING AROUND -First of all, use ":make tags" to generate a tags file, so that you can use -the ":tag" command to jump around the source code. +First of all, use ":make tags" to generate a tags file, so that you can jump +around in the source code. To jump to a function or variable definition, move the cursor on the name and use the CTRL-] command. Use CTRL-T or CTRL-O to jump back. @@ -43,6 +43,21 @@ Most code can be found in a file with an obvious name (incomplete list): window.c handling split windows +DEBUGGING + +If you have a reasonable recent version of gdb, you can use the :Termdebug +command to debug Vim. See ":help :Termdebug". + +When something is time critical or stepping through code is a hassle, use the +channel logging to create a time-stamped log file. Add lines to the code like +this: + ch_log(NULL, "Value is now %02x", value); +After compiling and starting Vim, do: + :call ch_logfile('debuglog', 'w') +And edit "debuglog" to see what happens. The channel functions already have +ch_log() calls, thus you always see that in the log. + + IMPORTANT VARIABLES The current mode is stored in "State". The values it can have are NORMAL, diff --git a/src/VisVim/Commands.cpp b/src/VisVim/Commands.cpp index 111b163c42..569fbb87df 100644 --- a/src/VisVim/Commands.cpp +++ b/src/VisVim/Commands.cpp @@ -575,7 +575,7 @@ static BOOL VimOpenFile(BSTR& FileName, long LineNr) if (LineNr > 0) { // Goto line - sprintf(VimCmd, ":%d\n", LineNr); + sprintf(VimCmd, ":%ld\n", LineNr); if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf))) goto OleError; } diff --git a/src/alloc.h b/src/alloc.h new file mode 100644 index 0000000000..60fa4bd66e --- /dev/null +++ b/src/alloc.h @@ -0,0 +1,22 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + */ + +/* + * alloc.h: enumeration of alloc IDs. + * Each entry must be on exactly one line, GetAllocId() depends on that. + */ +typedef enum { + aid_none = 0, + aid_qf_dirname_start, + aid_qf_dirname_now, + aid_qf_namebuf, + aid_qf_module, + aid_qf_errmsg, + aid_qf_pattern, + aid_last +} alloc_id_T; diff --git a/src/appveyor.bat b/src/appveyor.bat new file mode 100644 index 0000000000..761f9b8908 --- /dev/null +++ b/src/appveyor.bat @@ -0,0 +1,46 @@ +@echo off +:: Batch file for building/testing Vim on AppVeyor + +setlocal ENABLEDELAYEDEXPANSION +cd %APPVEYOR_BUILD_FOLDER% + +cd src +echo "Building MinGW 32bit console version" +set PATH=c:\msys64\mingw32\bin;%PATH% +mingw32-make.exe -f Make_ming.mak GUI=no OPTIMIZE=speed IME=yes MBYTE=yes ICONV=yes DEBUG=no FEATURES=%FEATURE% || exit 1 +:: Save vim.exe before Make clean, moved back below. +copy vim.exe testdir +mingw32-make.exe -f Make_ming.mak clean + +:: Build Mingw huge version with python and channel support, or +:: with specified features without python. +echo "Building MinGW 32bit GUI version" +if "%FEATURE%" == "HUGE" ( + mingw32-make.exe -f Make_ming.mak OPTIMIZE=speed CHANNEL=yes GUI=yes IME=yes MBYTE=yes ICONV=yes DEBUG=no PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27 PYTHON3_VER=35 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python35 FEATURES=%FEATURE% || exit 1 +) ELSE ( + mingw32-make.exe -f Make_ming.mak OPTIMIZE=speed GUI=yes IME=yes MBYTE=yes ICONV=yes DEBUG=no FEATURES=%FEATURE% || exit 1 +) +.\gvim -u NONE -c "redir @a | ver |0put a | wq" ver_ming.txt + +echo "Building MSVC 64bit console Version" +sed -e "s/\$(LINKARGS2)/\$(LINKARGS2) | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak +nmake -f Make_mvc2.mak CPU=AMD64 OLE=no GUI=no IME=yes MBYTE=yes ICONV=yes DEBUG=no FEATURES=%FEATURE% || exit 1 +nmake -f Make_mvc2.mak clean + +:: build MSVC huge version with python and channel support +:: GUI needs to be last, so that testing works +echo "Building MSVC 64bit GUI Version" +if "%FEATURE%" == "HUGE" ( + nmake -f Make_mvc2.mak DIRECTX=yes CPU=AMD64 CHANNEL=yes OLE=no GUI=yes IME=yes MBYTE=yes ICONV=yes DEBUG=no PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27-x64 PYTHON3_VER=35 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python35-x64 FEATURES=%FEATURE% || exit 1 +) ELSE ( + nmake -f Make_mvc2.mak CPU=AMD64 OLE=no GUI=yes IME=yes MBYTE=yes ICONV=yes DEBUG=no FEATURES=%FEATURE% || exit 1 +) +.\gvim -u NONE -c "redir @a | ver |0put a | wq" ver_msvc.txt + +:: Restore vim.exe, tests will run with this. +move /Y testdir\vim.exe . +echo "version output MinGW" +type ver_ming.txt +echo "version output MVC" +type ver_msvc.txt +cd .. diff --git a/src/arabic.c b/src/arabic.c index 72c64b5187..9bc1669196 100644 --- a/src/arabic.c +++ b/src/arabic.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,41 +10,41 @@ /* * arabic.c: functions for Arabic language * - * Included by main.c, when FEAT_ARABIC & FEAT_GUI is defined. - * - * -- - * * Author: Nadim Shaikli & Isam Bayazidi - * */ -static int A_is_a __ARGS((int cur_c)); -static int A_is_s __ARGS((int cur_c)); -static int A_is_f __ARGS((int cur_c)); -static int chg_c_a2s __ARGS((int cur_c)); -static int chg_c_a2i __ARGS((int cur_c)); -static int chg_c_a2m __ARGS((int cur_c)); -static int chg_c_a2f __ARGS((int cur_c)); -static int chg_c_i2m __ARGS((int cur_c)); -static int chg_c_f2m __ARGS((int cur_c)); -static int chg_c_laa2i __ARGS((int hid_c)); -static int chg_c_laa2f __ARGS((int hid_c)); -static int half_shape __ARGS((int c)); -static int A_firstc_laa __ARGS((int c1, int c)); -static int A_is_harakat __ARGS((int c)); -static int A_is_iso __ARGS((int c)); -static int A_is_formb __ARGS((int c)); -static int A_is_ok __ARGS((int c)); -static int A_is_valid __ARGS((int c)); -static int A_is_special __ARGS((int c)); +#include "vim.h" + +#if defined(FEAT_ARABIC) || defined(PROTO) + +static int A_is_a(int cur_c); +static int A_is_s(int cur_c); +static int A_is_f(int cur_c); +static int chg_c_a2s(int cur_c); +static int chg_c_a2i(int cur_c); +static int chg_c_a2m(int cur_c); +static int chg_c_a2f(int cur_c); +#if 0 +static int chg_c_i2m(int cur_c); +#endif +static int chg_c_f2m(int cur_c); +static int chg_c_laa2i(int hid_c); +static int chg_c_laa2f(int hid_c); +static int half_shape(int c); +static int A_firstc_laa(int c1, int c); +static int A_is_harakat(int c); +static int A_is_iso(int c); +static int A_is_formb(int c); +static int A_is_ok(int c); +static int A_is_valid(int c); +static int A_is_special(int c); /* * Returns True if c is an ISO-8859-6 shaped ARABIC letter (user entered) */ static int -A_is_a(cur_c) - int cur_c; +A_is_a(int cur_c) { switch (cur_c) { @@ -96,8 +96,7 @@ A_is_a(cur_c) * Returns True if c is an Isolated Form-B ARABIC letter */ static int -A_is_s(cur_c) - int cur_c; +A_is_s(int cur_c) { switch (cur_c) { @@ -148,8 +147,7 @@ A_is_s(cur_c) * Returns True if c is a Final shape of an ARABIC letter */ static int -A_is_f(cur_c) - int cur_c; +A_is_f(int cur_c) { switch (cur_c) { @@ -202,129 +200,49 @@ A_is_f(cur_c) * Change shape - from ISO-8859-6/Isolated to Form-B Isolated */ static int -chg_c_a2s(cur_c) - int cur_c; +chg_c_a2s(int cur_c) { - int tempc; - switch (cur_c) { - case a_HAMZA: - tempc = a_s_HAMZA; - break; - case a_ALEF_MADDA: - tempc = a_s_ALEF_MADDA; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_s_ALEF_HAMZA_ABOVE; - break; - case a_WAW_HAMZA: - tempc = a_s_WAW_HAMZA; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_s_ALEF_HAMZA_BELOW; - break; - case a_YEH_HAMZA: - tempc = a_s_YEH_HAMZA; - break; - case a_ALEF: - tempc = a_s_ALEF; - break; - case a_TEH_MARBUTA: - tempc = a_s_TEH_MARBUTA; - break; - case a_DAL: - tempc = a_s_DAL; - break; - case a_THAL: - tempc = a_s_THAL; - break; - case a_REH: - tempc = a_s_REH; - break; - case a_ZAIN: - tempc = a_s_ZAIN; - break; - case a_TATWEEL: /* exceptions */ - tempc = cur_c; - break; - case a_WAW: - tempc = a_s_WAW; - break; - case a_ALEF_MAKSURA: - tempc = a_s_ALEF_MAKSURA; - break; - case a_BEH: - tempc = a_s_BEH; - break; - case a_TEH: - tempc = a_s_TEH; - break; - case a_THEH: - tempc = a_s_THEH; - break; - case a_JEEM: - tempc = a_s_JEEM; - break; - case a_HAH: - tempc = a_s_HAH; - break; - case a_KHAH: - tempc = a_s_KHAH; - break; - case a_SEEN: - tempc = a_s_SEEN; - break; - case a_SHEEN: - tempc = a_s_SHEEN; - break; - case a_SAD: - tempc = a_s_SAD; - break; - case a_DAD: - tempc = a_s_DAD; - break; - case a_TAH: - tempc = a_s_TAH; - break; - case a_ZAH: - tempc = a_s_ZAH; - break; - case a_AIN: - tempc = a_s_AIN; - break; - case a_GHAIN: - tempc = a_s_GHAIN; - break; - case a_FEH: - tempc = a_s_FEH; - break; - case a_QAF: - tempc = a_s_QAF; - break; - case a_KAF: - tempc = a_s_KAF; - break; - case a_LAM: - tempc = a_s_LAM; - break; - case a_MEEM: - tempc = a_s_MEEM; - break; - case a_NOON: - tempc = a_s_NOON; - break; - case a_HEH: - tempc = a_s_HEH; - break; - case a_YEH: - tempc = a_s_YEH; - break; - default: - tempc = 0; + case a_HAMZA: return a_s_HAMZA; + case a_ALEF_MADDA: return a_s_ALEF_MADDA; + case a_ALEF_HAMZA_ABOVE: return a_s_ALEF_HAMZA_ABOVE; + case a_WAW_HAMZA: return a_s_WAW_HAMZA; + case a_ALEF_HAMZA_BELOW: return a_s_ALEF_HAMZA_BELOW; + case a_YEH_HAMZA: return a_s_YEH_HAMZA; + case a_ALEF: return a_s_ALEF; + case a_TEH_MARBUTA: return a_s_TEH_MARBUTA; + case a_DAL: return a_s_DAL; + case a_THAL: return a_s_THAL; + case a_REH: return a_s_REH; + case a_ZAIN: return a_s_ZAIN; + case a_TATWEEL: return cur_c; /* exceptions */ + case a_WAW: return a_s_WAW; + case a_ALEF_MAKSURA: return a_s_ALEF_MAKSURA; + case a_BEH: return a_s_BEH; + case a_TEH: return a_s_TEH; + case a_THEH: return a_s_THEH; + case a_JEEM: return a_s_JEEM; + case a_HAH: return a_s_HAH; + case a_KHAH: return a_s_KHAH; + case a_SEEN: return a_s_SEEN; + case a_SHEEN: return a_s_SHEEN; + case a_SAD: return a_s_SAD; + case a_DAD: return a_s_DAD; + case a_TAH: return a_s_TAH; + case a_ZAH: return a_s_ZAH; + case a_AIN: return a_s_AIN; + case a_GHAIN: return a_s_GHAIN; + case a_FEH: return a_s_FEH; + case a_QAF: return a_s_QAF; + case a_KAF: return a_s_KAF; + case a_LAM: return a_s_LAM; + case a_MEEM: return a_s_MEEM; + case a_NOON: return a_s_NOON; + case a_HEH: return a_s_HEH; + case a_YEH: return a_s_YEH; } - - return tempc; + return 0; } @@ -332,129 +250,63 @@ chg_c_a2s(cur_c) * Change shape - from ISO-8859-6/Isolated to Initial */ static int -chg_c_a2i(cur_c) - int cur_c; +chg_c_a2i(int cur_c) { - int tempc; - switch (cur_c) { - case a_YEH_HAMZA: - tempc = a_i_YEH_HAMZA; - break; + case a_YEH_HAMZA: return a_i_YEH_HAMZA; case a_HAMZA: /* exceptions */ - tempc = a_s_HAMZA; - break; + return a_s_HAMZA; case a_ALEF_MADDA: /* exceptions */ - tempc = a_s_ALEF_MADDA; - break; + return a_s_ALEF_MADDA; case a_ALEF_HAMZA_ABOVE: /* exceptions */ - tempc = a_s_ALEF_HAMZA_ABOVE; - break; + return a_s_ALEF_HAMZA_ABOVE; case a_WAW_HAMZA: /* exceptions */ - tempc = a_s_WAW_HAMZA; - break; + return a_s_WAW_HAMZA; case a_ALEF_HAMZA_BELOW: /* exceptions */ - tempc = a_s_ALEF_HAMZA_BELOW; - break; + return a_s_ALEF_HAMZA_BELOW; case a_ALEF: /* exceptions */ - tempc = a_s_ALEF; - break; + return a_s_ALEF; case a_TEH_MARBUTA: /* exceptions */ - tempc = a_s_TEH_MARBUTA; - break; + return a_s_TEH_MARBUTA; case a_DAL: /* exceptions */ - tempc = a_s_DAL; - break; + return a_s_DAL; case a_THAL: /* exceptions */ - tempc = a_s_THAL; - break; + return a_s_THAL; case a_REH: /* exceptions */ - tempc = a_s_REH; - break; + return a_s_REH; case a_ZAIN: /* exceptions */ - tempc = a_s_ZAIN; - break; + return a_s_ZAIN; case a_TATWEEL: /* exceptions */ - tempc = cur_c; - break; + return cur_c; case a_WAW: /* exceptions */ - tempc = a_s_WAW; - break; + return a_s_WAW; case a_ALEF_MAKSURA: /* exceptions */ - tempc = a_s_ALEF_MAKSURA; - break; - case a_BEH: - tempc = a_i_BEH; - break; - case a_TEH: - tempc = a_i_TEH; - break; - case a_THEH: - tempc = a_i_THEH; - break; - case a_JEEM: - tempc = a_i_JEEM; - break; - case a_HAH: - tempc = a_i_HAH; - break; - case a_KHAH: - tempc = a_i_KHAH; - break; - case a_SEEN: - tempc = a_i_SEEN; - break; - case a_SHEEN: - tempc = a_i_SHEEN; - break; - case a_SAD: - tempc = a_i_SAD; - break; - case a_DAD: - tempc = a_i_DAD; - break; - case a_TAH: - tempc = a_i_TAH; - break; - case a_ZAH: - tempc = a_i_ZAH; - break; - case a_AIN: - tempc = a_i_AIN; - break; - case a_GHAIN: - tempc = a_i_GHAIN; - break; - case a_FEH: - tempc = a_i_FEH; - break; - case a_QAF: - tempc = a_i_QAF; - break; - case a_KAF: - tempc = a_i_KAF; - break; - case a_LAM: - tempc = a_i_LAM; - break; - case a_MEEM: - tempc = a_i_MEEM; - break; - case a_NOON: - tempc = a_i_NOON; - break; - case a_HEH: - tempc = a_i_HEH; - break; - case a_YEH: - tempc = a_i_YEH; - break; - default: - tempc = 0; + return a_s_ALEF_MAKSURA; + case a_BEH: return a_i_BEH; + case a_TEH: return a_i_TEH; + case a_THEH: return a_i_THEH; + case a_JEEM: return a_i_JEEM; + case a_HAH: return a_i_HAH; + case a_KHAH: return a_i_KHAH; + case a_SEEN: return a_i_SEEN; + case a_SHEEN: return a_i_SHEEN; + case a_SAD: return a_i_SAD; + case a_DAD: return a_i_DAD; + case a_TAH: return a_i_TAH; + case a_ZAH: return a_i_ZAH; + case a_AIN: return a_i_AIN; + case a_GHAIN: return a_i_GHAIN; + case a_FEH: return a_i_FEH; + case a_QAF: return a_i_QAF; + case a_KAF: return a_i_KAF; + case a_LAM: return a_i_LAM; + case a_MEEM: return a_i_MEEM; + case a_NOON: return a_i_NOON; + case a_HEH: return a_i_HEH; + case a_YEH: return a_i_YEH; } - - return tempc; + return 0; } @@ -462,129 +314,49 @@ chg_c_a2i(cur_c) * Change shape - from ISO-8859-6/Isolated to Medial */ static int -chg_c_a2m(cur_c) - int cur_c; +chg_c_a2m(int cur_c) { - int tempc; - switch (cur_c) { - case a_HAMZA: /* exception */ - tempc = a_s_HAMZA; - break; - case a_ALEF_MADDA: /* exception */ - tempc = a_f_ALEF_MADDA; - break; - case a_ALEF_HAMZA_ABOVE: /* exception */ - tempc = a_f_ALEF_HAMZA_ABOVE; - break; - case a_WAW_HAMZA: /* exception */ - tempc = a_f_WAW_HAMZA; - break; - case a_ALEF_HAMZA_BELOW: /* exception */ - tempc = a_f_ALEF_HAMZA_BELOW; - break; - case a_YEH_HAMZA: - tempc = a_m_YEH_HAMZA; - break; - case a_ALEF: /* exception */ - tempc = a_f_ALEF; - break; - case a_BEH: - tempc = a_m_BEH; - break; - case a_TEH_MARBUTA: /* exception */ - tempc = a_f_TEH_MARBUTA; - break; - case a_TEH: - tempc = a_m_TEH; - break; - case a_THEH: - tempc = a_m_THEH; - break; - case a_JEEM: - tempc = a_m_JEEM; - break; - case a_HAH: - tempc = a_m_HAH; - break; - case a_KHAH: - tempc = a_m_KHAH; - break; - case a_DAL: /* exception */ - tempc = a_f_DAL; - break; - case a_THAL: /* exception */ - tempc = a_f_THAL; - break; - case a_REH: /* exception */ - tempc = a_f_REH; - break; - case a_ZAIN: /* exception */ - tempc = a_f_ZAIN; - break; - case a_SEEN: - tempc = a_m_SEEN; - break; - case a_SHEEN: - tempc = a_m_SHEEN; - break; - case a_SAD: - tempc = a_m_SAD; - break; - case a_DAD: - tempc = a_m_DAD; - break; - case a_TAH: - tempc = a_m_TAH; - break; - case a_ZAH: - tempc = a_m_ZAH; - break; - case a_AIN: - tempc = a_m_AIN; - break; - case a_GHAIN: - tempc = a_m_GHAIN; - break; - case a_TATWEEL: /* exception */ - tempc = cur_c; - break; - case a_FEH: - tempc = a_m_FEH; - break; - case a_QAF: - tempc = a_m_QAF; - break; - case a_KAF: - tempc = a_m_KAF; - break; - case a_LAM: - tempc = a_m_LAM; - break; - case a_MEEM: - tempc = a_m_MEEM; - break; - case a_NOON: - tempc = a_m_NOON; - break; - case a_HEH: - tempc = a_m_HEH; - break; - case a_WAW: /* exception */ - tempc = a_f_WAW; - break; - case a_ALEF_MAKSURA: /* exception */ - tempc = a_f_ALEF_MAKSURA; - break; - case a_YEH: - tempc = a_m_YEH; - break; - default: - tempc = 0; + case a_HAMZA: return a_s_HAMZA; /* exception */ + case a_ALEF_MADDA: return a_f_ALEF_MADDA; /* exception */ + case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; /* exception */ + case a_WAW_HAMZA: return a_f_WAW_HAMZA; /* exception */ + case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; /* exception */ + case a_YEH_HAMZA: return a_m_YEH_HAMZA; + case a_ALEF: return a_f_ALEF; /* exception */ + case a_BEH: return a_m_BEH; + case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; /* exception */ + case a_TEH: return a_m_TEH; + case a_THEH: return a_m_THEH; + case a_JEEM: return a_m_JEEM; + case a_HAH: return a_m_HAH; + case a_KHAH: return a_m_KHAH; + case a_DAL: return a_f_DAL; /* exception */ + case a_THAL: return a_f_THAL; /* exception */ + case a_REH: return a_f_REH; /* exception */ + case a_ZAIN: return a_f_ZAIN; /* exception */ + case a_SEEN: return a_m_SEEN; + case a_SHEEN: return a_m_SHEEN; + case a_SAD: return a_m_SAD; + case a_DAD: return a_m_DAD; + case a_TAH: return a_m_TAH; + case a_ZAH: return a_m_ZAH; + case a_AIN: return a_m_AIN; + case a_GHAIN: return a_m_GHAIN; + case a_TATWEEL: return cur_c; /* exception */ + case a_FEH: return a_m_FEH; + case a_QAF: return a_m_QAF; + case a_KAF: return a_m_KAF; + case a_LAM: return a_m_LAM; + case a_MEEM: return a_m_MEEM; + case a_NOON: return a_m_NOON; + case a_HEH: return a_m_HEH; + case a_WAW: return a_f_WAW; /* exception */ + case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; /* exception */ + case a_YEH: return a_m_YEH; } - - return tempc; + return 0; } @@ -592,249 +364,114 @@ chg_c_a2m(cur_c) * Change shape - from ISO-8859-6/Isolated to final */ static int -chg_c_a2f(cur_c) - int cur_c; +chg_c_a2f(int cur_c) { - int tempc; - /* NOTE: these encodings need to be accounted for - - a_f_ALEF_MADDA; - a_f_ALEF_HAMZA_ABOVE; - a_f_ALEF_HAMZA_BELOW; - a_f_LAM_ALEF_MADDA_ABOVE; - a_f_LAM_ALEF_HAMZA_ABOVE; - a_f_LAM_ALEF_HAMZA_BELOW; - */ - + * a_f_ALEF_MADDA; + * a_f_ALEF_HAMZA_ABOVE; + * a_f_ALEF_HAMZA_BELOW; + * a_f_LAM_ALEF_MADDA_ABOVE; + * a_f_LAM_ALEF_HAMZA_ABOVE; + * a_f_LAM_ALEF_HAMZA_BELOW; + */ switch (cur_c) { - case a_HAMZA: /* exception */ - tempc = a_s_HAMZA; - break; - case a_ALEF_MADDA: - tempc = a_f_ALEF_MADDA; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_f_ALEF_HAMZA_ABOVE; - break; - case a_WAW_HAMZA: - tempc = a_f_WAW_HAMZA; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_f_ALEF_HAMZA_BELOW; - break; - case a_YEH_HAMZA: - tempc = a_f_YEH_HAMZA; - break; - case a_ALEF: - tempc = a_f_ALEF; - break; - case a_BEH: - tempc = a_f_BEH; - break; - case a_TEH_MARBUTA: - tempc = a_f_TEH_MARBUTA; - break; - case a_TEH: - tempc = a_f_TEH; - break; - case a_THEH: - tempc = a_f_THEH; - break; - case a_JEEM: - tempc = a_f_JEEM; - break; - case a_HAH: - tempc = a_f_HAH; - break; - case a_KHAH: - tempc = a_f_KHAH; - break; - case a_DAL: - tempc = a_f_DAL; - break; - case a_THAL: - tempc = a_f_THAL; - break; - case a_REH: - tempc = a_f_REH; - break; - case a_ZAIN: - tempc = a_f_ZAIN; - break; - case a_SEEN: - tempc = a_f_SEEN; - break; - case a_SHEEN: - tempc = a_f_SHEEN; - break; - case a_SAD: - tempc = a_f_SAD; - break; - case a_DAD: - tempc = a_f_DAD; - break; - case a_TAH: - tempc = a_f_TAH; - break; - case a_ZAH: - tempc = a_f_ZAH; - break; - case a_AIN: - tempc = a_f_AIN; - break; - case a_GHAIN: - tempc = a_f_GHAIN; - break; - case a_TATWEEL: /* exception */ - tempc = cur_c; - break; - case a_FEH: - tempc = a_f_FEH; - break; - case a_QAF: - tempc = a_f_QAF; - break; - case a_KAF: - tempc = a_f_KAF; - break; - case a_LAM: - tempc = a_f_LAM; - break; - case a_MEEM: - tempc = a_f_MEEM; - break; - case a_NOON: - tempc = a_f_NOON; - break; - case a_HEH: - tempc = a_f_HEH; - break; - case a_WAW: - tempc = a_f_WAW; - break; - case a_ALEF_MAKSURA: - tempc = a_f_ALEF_MAKSURA; - break; - case a_YEH: - tempc = a_f_YEH; - break; - default: - tempc = 0; + case a_HAMZA: return a_s_HAMZA; /* exception */ + case a_ALEF_MADDA: return a_f_ALEF_MADDA; + case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; + case a_WAW_HAMZA: return a_f_WAW_HAMZA; + case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; + case a_YEH_HAMZA: return a_f_YEH_HAMZA; + case a_ALEF: return a_f_ALEF; + case a_BEH: return a_f_BEH; + case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; + case a_TEH: return a_f_TEH; + case a_THEH: return a_f_THEH; + case a_JEEM: return a_f_JEEM; + case a_HAH: return a_f_HAH; + case a_KHAH: return a_f_KHAH; + case a_DAL: return a_f_DAL; + case a_THAL: return a_f_THAL; + case a_REH: return a_f_REH; + case a_ZAIN: return a_f_ZAIN; + case a_SEEN: return a_f_SEEN; + case a_SHEEN: return a_f_SHEEN; + case a_SAD: return a_f_SAD; + case a_DAD: return a_f_DAD; + case a_TAH: return a_f_TAH; + case a_ZAH: return a_f_ZAH; + case a_AIN: return a_f_AIN; + case a_GHAIN: return a_f_GHAIN; + case a_TATWEEL: return cur_c; /* exception */ + case a_FEH: return a_f_FEH; + case a_QAF: return a_f_QAF; + case a_KAF: return a_f_KAF; + case a_LAM: return a_f_LAM; + case a_MEEM: return a_f_MEEM; + case a_NOON: return a_f_NOON; + case a_HEH: return a_f_HEH; + case a_WAW: return a_f_WAW; + case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; + case a_YEH: return a_f_YEH; } - - return tempc; + return 0; } /* * Change shape - from Initial to Medial + * This code is unreachable, because for the relevant characters ARABIC_CHAR() + * is FALSE; */ +#if 0 static int -chg_c_i2m(cur_c) - int cur_c; +chg_c_i2m(int cur_c) { - int tempc; - switch (cur_c) { - case a_i_YEH_HAMZA: - tempc = a_m_YEH_HAMZA; - break; - case a_i_BEH: - tempc = a_m_BEH; - break; - case a_i_TEH: - tempc = a_m_TEH; - break; - case a_i_THEH: - tempc = a_m_THEH; - break; - case a_i_JEEM: - tempc = a_m_JEEM; - break; - case a_i_HAH: - tempc = a_m_HAH; - break; - case a_i_KHAH: - tempc = a_m_KHAH; - break; - case a_i_SEEN: - tempc = a_m_SEEN; - break; - case a_i_SHEEN: - tempc = a_m_SHEEN; - break; - case a_i_SAD: - tempc = a_m_SAD; - break; - case a_i_DAD: - tempc = a_m_DAD; - break; - case a_i_TAH: - tempc = a_m_TAH; - break; - case a_i_ZAH: - tempc = a_m_ZAH; - break; - case a_i_AIN: - tempc = a_m_AIN; - break; - case a_i_GHAIN: - tempc = a_m_GHAIN; - break; - case a_i_FEH: - tempc = a_m_FEH; - break; - case a_i_QAF: - tempc = a_m_QAF; - break; - case a_i_KAF: - tempc = a_m_KAF; - break; - case a_i_LAM: - tempc = a_m_LAM; - break; - case a_i_MEEM: - tempc = a_m_MEEM; - break; - case a_i_NOON: - tempc = a_m_NOON; - break; - case a_i_HEH: - tempc = a_m_HEH; - break; - case a_i_YEH: - tempc = a_m_YEH; - break; - default: - tempc = 0; + case a_i_YEH_HAMZA: return a_m_YEH_HAMZA; + case a_i_BEH: return a_m_BEH; + case a_i_TEH: return a_m_TEH; + case a_i_THEH: return a_m_THEH; + case a_i_JEEM: return a_m_JEEM; + case a_i_HAH: return a_m_HAH; + case a_i_KHAH: return a_m_KHAH; + case a_i_SEEN: return a_m_SEEN; + case a_i_SHEEN: return a_m_SHEEN; + case a_i_SAD: return a_m_SAD; + case a_i_DAD: return a_m_DAD; + case a_i_TAH: return a_m_TAH; + case a_i_ZAH: return a_m_ZAH; + case a_i_AIN: return a_m_AIN; + case a_i_GHAIN: return a_m_GHAIN; + case a_i_FEH: return a_m_FEH; + case a_i_QAF: return a_m_QAF; + case a_i_KAF: return a_m_KAF; + case a_i_LAM: return a_m_LAM; + case a_i_MEEM: return a_m_MEEM; + case a_i_NOON: return a_m_NOON; + case a_i_HEH: return a_m_HEH; + case a_i_YEH: return a_m_YEH; } - - return tempc; + return 0; } +#endif /* * Change shape - from Final to Medial */ static int -chg_c_f2m(cur_c) - int cur_c; +chg_c_f2m(int cur_c) { - int tempc; - switch (cur_c) { /* NOTE: these encodings are multi-positional, no ? - case a_f_ALEF_MADDA: - case a_f_ALEF_HAMZA_ABOVE: - case a_f_ALEF_HAMZA_BELOW: - */ - case a_f_YEH_HAMZA: - tempc = a_m_YEH_HAMZA; - break; + * case a_f_ALEF_MADDA: + * case a_f_ALEF_HAMZA_ABOVE: + * case a_f_ALEF_HAMZA_BELOW: + */ + case a_f_YEH_HAMZA: return a_m_YEH_HAMZA; case a_f_WAW_HAMZA: /* exceptions */ case a_f_ALEF: case a_f_TEH_MARBUTA: @@ -844,85 +481,38 @@ chg_c_f2m(cur_c) case a_f_ZAIN: case a_f_WAW: case a_f_ALEF_MAKSURA: - tempc = cur_c; - break; - case a_f_BEH: - tempc = a_m_BEH; - break; - case a_f_TEH: - tempc = a_m_TEH; - break; - case a_f_THEH: - tempc = a_m_THEH; - break; - case a_f_JEEM: - tempc = a_m_JEEM; - break; - case a_f_HAH: - tempc = a_m_HAH; - break; - case a_f_KHAH: - tempc = a_m_KHAH; - break; - case a_f_SEEN: - tempc = a_m_SEEN; - break; - case a_f_SHEEN: - tempc = a_m_SHEEN; - break; - case a_f_SAD: - tempc = a_m_SAD; - break; - case a_f_DAD: - tempc = a_m_DAD; - break; - case a_f_TAH: - tempc = a_m_TAH; - break; - case a_f_ZAH: - tempc = a_m_ZAH; - break; - case a_f_AIN: - tempc = a_m_AIN; - break; - case a_f_GHAIN: - tempc = a_m_GHAIN; - break; - case a_f_FEH: - tempc = a_m_FEH; - break; - case a_f_QAF: - tempc = a_m_QAF; - break; - case a_f_KAF: - tempc = a_m_KAF; - break; - case a_f_LAM: - tempc = a_m_LAM; - break; - case a_f_MEEM: - tempc = a_m_MEEM; - break; - case a_f_NOON: - tempc = a_m_NOON; - break; - case a_f_HEH: - tempc = a_m_HEH; - break; - case a_f_YEH: - tempc = a_m_YEH; - break; - /* NOTE: these encodings are multi-positional, no ? - case a_f_LAM_ALEF_MADDA_ABOVE: - case a_f_LAM_ALEF_HAMZA_ABOVE: - case a_f_LAM_ALEF_HAMZA_BELOW: - case a_f_LAM_ALEF: - */ - default: - tempc = 0; - } + return cur_c; + case a_f_BEH: return a_m_BEH; + case a_f_TEH: return a_m_TEH; + case a_f_THEH: return a_m_THEH; + case a_f_JEEM: return a_m_JEEM; + case a_f_HAH: return a_m_HAH; + case a_f_KHAH: return a_m_KHAH; + case a_f_SEEN: return a_m_SEEN; + case a_f_SHEEN: return a_m_SHEEN; + case a_f_SAD: return a_m_SAD; + case a_f_DAD: return a_m_DAD; + case a_f_TAH: return a_m_TAH; + case a_f_ZAH: return a_m_ZAH; + case a_f_AIN: return a_m_AIN; + case a_f_GHAIN: return a_m_GHAIN; + case a_f_FEH: return a_m_FEH; + case a_f_QAF: return a_m_QAF; + case a_f_KAF: return a_m_KAF; + case a_f_LAM: return a_m_LAM; + case a_f_MEEM: return a_m_MEEM; + case a_f_NOON: return a_m_NOON; + case a_f_HEH: return a_m_HEH; + case a_f_YEH: return a_m_YEH; - return tempc; + /* NOTE: these encodings are multi-positional, no ? + * case a_f_LAM_ALEF_MADDA_ABOVE: + * case a_f_LAM_ALEF_HAMZA_ABOVE: + * case a_f_LAM_ALEF_HAMZA_BELOW: + * case a_f_LAM_ALEF: + */ + } + return 0; } @@ -930,30 +520,16 @@ chg_c_f2m(cur_c) * Change shape - from Combination (2 char) to an Isolated */ static int -chg_c_laa2i(hid_c) - int hid_c; +chg_c_laa2i(int hid_c) { - int tempc; - switch (hid_c) { - case a_ALEF_MADDA: - tempc = a_s_LAM_ALEF_MADDA_ABOVE; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_s_LAM_ALEF_HAMZA_ABOVE; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_s_LAM_ALEF_HAMZA_BELOW; - break; - case a_ALEF: - tempc = a_s_LAM_ALEF; - break; - default: - tempc = 0; + case a_ALEF_MADDA: return a_s_LAM_ALEF_MADDA_ABOVE; + case a_ALEF_HAMZA_ABOVE: return a_s_LAM_ALEF_HAMZA_ABOVE; + case a_ALEF_HAMZA_BELOW: return a_s_LAM_ALEF_HAMZA_BELOW; + case a_ALEF: return a_s_LAM_ALEF; } - - return tempc; + return 0; } @@ -961,38 +537,23 @@ chg_c_laa2i(hid_c) * Change shape - from Combination-Isolated to Final */ static int -chg_c_laa2f(hid_c) - int hid_c; +chg_c_laa2f(int hid_c) { - int tempc; - switch (hid_c) { - case a_ALEF_MADDA: - tempc = a_f_LAM_ALEF_MADDA_ABOVE; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_f_LAM_ALEF_HAMZA_ABOVE; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_f_LAM_ALEF_HAMZA_BELOW; - break; - case a_ALEF: - tempc = a_f_LAM_ALEF; - break; - default: - tempc = 0; + case a_ALEF_MADDA: return a_f_LAM_ALEF_MADDA_ABOVE; + case a_ALEF_HAMZA_ABOVE: return a_f_LAM_ALEF_HAMZA_ABOVE; + case a_ALEF_HAMZA_BELOW: return a_f_LAM_ALEF_HAMZA_BELOW; + case a_ALEF: return a_f_LAM_ALEF; } - - return tempc; + return 0; } /* * Do "half-shaping" on character "c". Return zero if no shaping. */ static int -half_shape(c) - int c; +half_shape(int c) { if (A_is_a(c)) return chg_c_a2i(c); @@ -1011,13 +572,13 @@ half_shape(c) * in: "next_c" is the next character (not shaped). */ int -arabic_shape(c, ccp, c1p, prev_c, prev_c1, next_c) - int c; - int *ccp; - int *c1p; - int prev_c; - int prev_c1; - int next_c; +arabic_shape( + int c, + int *ccp, + int *c1p, + int prev_c, + int prev_c1, + int next_c) { int curr_c; int shape_c; @@ -1053,7 +614,11 @@ arabic_shape(c, ccp, c1p, prev_c, prev_c1, next_c) else if (!shape_c || A_is_f(shape_c) || A_is_s(shape_c) || prev_laa) curr_c = A_is_valid(next_c) ? chg_c_a2i(c) : chg_c_a2s(c); else if (A_is_valid(next_c)) +#if 0 curr_c = A_is_iso(c) ? chg_c_a2m(c) : chg_c_i2m(c); +#else + curr_c = A_is_iso(c) ? chg_c_a2m(c) : 0; +#endif else if (A_is_valid(prev_c)) curr_c = chg_c_a2f(c); else @@ -1082,9 +647,9 @@ arabic_shape(c, ccp, c1p, prev_c, prev_c1, next_c) * A_firstc_laa returns first character of LAA combination if it exists */ static int -A_firstc_laa(c, c1) - int c; /* base character */ - int c1; /* first composing character */ +A_firstc_laa( + int c, /* base character */ + int c1) /* first composing character */ { if (c1 != NUL && c == a_LAM && !A_is_harakat(c1)) return c1; @@ -1097,8 +662,7 @@ A_firstc_laa(c, c1) * (harakat/tanween) */ static int -A_is_harakat(c) - int c; +A_is_harakat(int c) { return (c >= a_FATHATAN && c <= a_SUKUN); } @@ -1109,8 +673,7 @@ A_is_harakat(c) * (alphabet/number/punctuation) */ static int -A_is_iso(c) - int c; +A_is_iso(int c) { return ((c >= a_HAMZA && c <= a_GHAIN) || (c >= a_TATWEEL && c <= a_HAMZA_BELOW) @@ -1123,8 +686,7 @@ A_is_iso(c) * (alphabet/number/punctuation) */ static int -A_is_formb(c) - int c; +A_is_formb(int c) { return ((c >= a_s_FATHATAN && c <= a_s_DAMMATAN) || c == a_s_KASRATAN @@ -1137,8 +699,7 @@ A_is_formb(c) * A_is_ok returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B) */ static int -A_is_ok(c) - int c; +A_is_ok(int c) { return (A_is_iso(c) || A_is_formb(c)); } @@ -1149,8 +710,7 @@ A_is_ok(c) * with some exceptions/exclusions */ static int -A_is_valid(c) - int c; +A_is_valid(int c) { return (A_is_ok(c) && !A_is_special(c)); } @@ -1161,8 +721,9 @@ A_is_valid(c) * Specials don't adhere to most of the rules. */ static int -A_is_special(c) - int c; +A_is_special(int c) { return (c == a_HAMZA || c == a_s_HAMZA); } + +#endif /* FEAT_ARABIC */ diff --git a/src/arabic.h b/src/arabic.h index 3a948d0441..cb5cbd1670 100644 --- a/src/arabic.h +++ b/src/arabic.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/ascii.h b/src/ascii.h index a3cfecff71..769e1a071a 100644 --- a/src/ascii.h +++ b/src/ascii.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -34,10 +34,6 @@ #define ESC_STR_nc "\033" #define DEL 0x7f #define DEL_STR (char_u *)"\177" -#define CSI 0x9b /* Control Sequence Introducer */ -#define CSI_STR "\233" -#define DCS 0x90 /* Device Control String */ -#define STERM 0x9c /* String Terminator */ #define POUND 0xA3 @@ -117,11 +113,6 @@ #define ESC_STR_nc "\x27" #define DEL 0x07 #define DEL_STR (char_u *)"\007" -/* TODO: EBCDIC Code page dependent (here 1047) */ -#define CSI 0x9b /* Control Sequence Introducer */ -#define CSI_STR "\233" -#define DCS 0x90 /* Device Control String */ -#define STERM 0x9c /* String Terminator */ #define POUND 0xB1 @@ -173,6 +164,13 @@ extern char MetaCharTable[]; #endif /* defined EBCDIC */ +/* TODO: EBCDIC Code page dependent (here 1047) */ +#define CSI 0x9b /* Control Sequence Introducer */ +#define CSI_STR "\233" +#define DCS 0x90 /* Device Control String */ +#define OSC 0x9d /* Operating System Command */ +#define STERM 0x9c /* String Terminator */ + /* * Character that separates dir names in a path. * For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works diff --git a/src/auto/configure b/src/auto/configure index bda88c63bc..a1b732b80f 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -637,6 +637,11 @@ GUI_LIB_LOC GUI_INC_LOC NARROW_PROTO MOTIF_LIBNAME +GRESOURCE_OBJ +GRESOURCE_SRC +UPDATE_DESKTOP_DATABASE +GTK_UPDATE_ICON_CACHE +GLIB_COMPILE_RESOURCES GNOME_INCLUDEDIR GNOME_LIBDIR GNOME_LIBS @@ -651,8 +656,10 @@ X_PRE_LIBS X_CFLAGS XMKMF xmkmfpath -SNIFF_OBJ -SNIFF_SRC +TERM_OBJ +TERM_SRC +CHANNEL_OBJ +CHANNEL_SRC NETBEANS_OBJ NETBEANS_SRC WORKSHOP_OBJ @@ -673,14 +680,11 @@ PYTHON3_OBJ PYTHON3_SRC PYTHON3_CFLAGS PYTHON3_LIBS -PYTHON3_CONFDIR vi_cv_path_python3 PYTHON_OBJ PYTHON_SRC PYTHON_CFLAGS -PYTHON_GETPATH_CFLAGS PYTHON_LIBS -PYTHON_CONFDIR vi_cv_path_python PERL_LIBS PERL_CFLAGS @@ -689,6 +693,7 @@ PERL_OBJ PERL_SRC shrpenv vi_cv_perlsitelib +vi_cv_perl_xsubpp vi_cv_perllib vi_cv_path_perl MZSCHEME_MZC @@ -699,6 +704,12 @@ MZSCHEME_PRO MZSCHEME_OBJ MZSCHEME_SRC vi_cv_path_mzscheme +LUA52_CFLAGS +LUA52_LIBS +LUA52_PRO +LUA52_OBJ +LUA52_SRC +vi_cv_path_lua52 LUA_CFLAGS LUA_LIBS LUA_PRO @@ -719,6 +730,7 @@ OS_EXTRA_OBJ OS_EXTRA_SRC XCODE_SELECT CPP_MM +CROSS_COMPILING STRIP AWK FGREP @@ -794,13 +806,18 @@ enable_xsmp_interact enable_luainterp with_lua_prefix with_luajit +enable_lua52interp +with_lua52_prefix enable_mzschemeinterp with_plthome enable_perlinterp enable_pythoninterp +with_python_command with_python_config_dir enable_python3interp +with_python3_command with_python3_config_dir +with_properly_linked_python2_python3 enable_tclinterp with_tclsh enable_rubyinterp @@ -808,7 +825,9 @@ with_ruby_command enable_cscope enable_workshop enable_netbeans -enable_sniff +enable_channel +enable_terminal +enable_autoservername enable_multibyte enable_hangulinput enable_xim @@ -817,6 +836,7 @@ with_x enable_gui enable_gtk2_check enable_gnome_check +enable_gtk3_check enable_motif_check enable_athena_check enable_nextaw_check @@ -826,6 +846,8 @@ enable_gtktest with_gnome_includes with_gnome_libs with_gnome +enable_icon_cache_update +enable_desktop_database_update with_motif_lib with_tlib enable_largefile @@ -833,6 +855,7 @@ enable_acl enable_gpm enable_sysmouse enable_nls +enable_migemo with_xcodecfg ' ac_precious_vars='build_alias @@ -1463,35 +1486,42 @@ Optional Features: --disable-selinux Do not check for SELinux support. --disable-xsmp Disable XSMP session management --disable-xsmp-interact Disable XSMP interaction - --enable-luainterp=OPTS Include Lua interpreter. default=no OPTS=no/yes/dynamic - --enable-mzschemeinterp Include MzScheme interpreter. + --enable-luainterp=OPTS Include Lua interpreter. default=no OPTS=no/yes/dynamic + --enable-lua52interp=OPTS Include Lua52 interpreter. default=no OPTS=no/yes/dynamic + --enable-mzschemeinterp Include MzScheme interpreter. --enable-perlinterp=OPTS Include Perl interpreter. default=no OPTS=no/yes/dynamic --enable-pythoninterp=OPTS Include Python interpreter. default=no OPTS=no/yes/dynamic - --enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic - --enable-tclinterp Include Tcl interpreter. + --enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic + --enable-tclinterp=OPTS Include Tcl interpreter. default=no OPTS=no/yes/dynamic --enable-rubyinterp=OPTS Include Ruby interpreter. default=no OPTS=no/yes/dynamic --enable-cscope Include cscope interface. --enable-workshop Include Sun Visual Workshop support. --disable-netbeans Disable NetBeans integration support. - --enable-sniff Include Sniff interface. + --disable-channel Disable process communication support. + --enable-terminal Enable terminal emulation support. + --enable-autoservername Automatically define servername at vim startup. --enable-multibyte Include multibyte editing support. --enable-hangulinput Include Hangul input support. --enable-xim Include XIM input support. --enable-fontset Include X fontset output support. - --enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon/macvim + --enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon/macvim --enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes --enable-gnome-check If GTK GUI, check for GNOME default=no + --enable-gtk3-check If auto-select GUI, check for GTK+ 3 default=yes --enable-motif-check If auto-select GUI, check for Motif default=yes --enable-athena-check If auto-select GUI, check for Athena default=yes --enable-nextaw-check If auto-select GUI, check for neXtaw default=yes --enable-carbon-check If auto-select GUI, check for Carbon default=yes --enable-macvim-check If auto-select GUI, check for MacVim default=yes --disable-gtktest Do not try to compile and run a test GTK program + --disable-icon-cache-update update disabled + --disable-desktop-database-update update disabled --disable-largefile omit support for large files - --disable-acl Don't check for ACL support. + --disable-acl No check for ACL support. --disable-gpm Don't use gpm (Linux mouse daemon). - --disable-sysmouse Don't use sysmouse (mouse in *BSD console). + --disable-sysmouse Don't use sysmouse (mouse in *BSD console). --disable-nls Don't support NLS (gettext()). + --disable-migemo Don't support C/Migemo. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1506,20 +1536,24 @@ Optional Packages: --with-view-name=NAME what to call the View executable --with-global-runtime=DIR global runtime directory in 'runtimepath' --with-modified-by=NAME name of who modified a release version - --with-features=TYPE tiny, small, normal, big or huge (default: normal) + --with-features=TYPE tiny, small, normal, big or huge (default: huge) --with-compiledby=NAME name to show in :version message --with-lua-prefix=PFX Prefix where Lua is installed. --with-luajit Link with LuaJIT instead of Lua. + --with-lua52-prefix=PFX Prefix where Lua52 is installed. --with-plthome=PLTHOME Use PLTHOME. - --with-python-config-dir=PATH Python's config directory - --with-python3-config-dir=PATH Python's config directory + --with-python-command=NAME name of the Python 2 command (default: python2 or python) + --with-python-config-dir=PATH Python's config directory (deprecated) + --with-python3-command=NAME name of the Python 3 command (default: python3 or python) + --with-python3-config-dir=PATH Python's config directory (deprecated) + --with-properly-linked-python2-python3 Link with properly linked Python 2 and Python 3. --with-tclsh=PATH which tclsh to use (default: tclsh8.0) --with-ruby-command=RUBY name of the Ruby command (default: ruby) --with-x use the X Window System --with-gnome-includes=DIR Specify location of GNOME headers --with-gnome-libs=DIR Specify location of GNOME libs --with-gnome Specify prefix for GNOME files - --with-motif-lib=STRING Library for Motif + --with-motif-lib=STRING Library for Motif --with-tlib=library terminal library to be used --with-xcodecfg=CFG Debug, Release (default: Release) @@ -3429,7 +3463,184 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_ext=c + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -3706,7 +3917,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | fi rm -f conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 @@ -3772,7 +3983,7 @@ fi $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 @@ -3827,7 +4038,7 @@ if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi - for ac_prog in gawk mawk nawk awk + for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -4064,6 +4275,194 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi +if test x"$ac_cv_prog_cc_c99" != xno; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 +$as_echo_n "checking for unsigned long long int... " >&6; } +if ${ac_cv_type_unsigned_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_unsigned_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + ac_cv_type_unsigned_long_long_int=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 +$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } + if test $ac_cv_type_unsigned_long_long_int = yes; then + +$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 +$as_echo_n "checking for long long int... " >&6; } +if ${ac_cv_type_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif +int +main () +{ +long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_type_long_long_int=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 +$as_echo "$ac_cv_type_long_long_int" >&6; } + if test $ac_cv_type_long_long_int = yes; then + +$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + fi + + if test "$ac_cv_type_long_long_int" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support long long int +See \`config.log' for more details" "$LINENO" 5; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports trailing commas" >&5 +$as_echo_n "checking if the compiler supports trailing commas... " >&6; } + trailing_commas=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + enum { + one, + }; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; trailing_commas=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$trailing_commas" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support trailing comma in enum +See \`config.log' for more details" "$LINENO" 5; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports C++ comments" >&5 +$as_echo_n "checking if the compiler supports C++ comments... " >&6; } + slash_comments=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +// C++ comments? + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; slash_comments=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$slash_comments" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support C++ comments +See \`config.log' for more details" "$LINENO" 5; } + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-fail-if-missing argument" >&5 $as_echo_n "checking --enable-fail-if-missing argument... " >&6; } @@ -4097,9 +4496,9 @@ if test "$GCC" = yes; then fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent clang version" >&5 -$as_echo_n "checking for recent clang version... " >&6; } -CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5 +$as_echo_n "checking for clang version... " >&6; } +CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'` if test x"$CLANG_VERSION_STRING" != x"" ; then CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*/\1/p'` CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/p'` @@ -4107,19 +4506,29 @@ if test x"$CLANG_VERSION_STRING" != x"" ; then CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG_VERSION" >&5 $as_echo "$CLANG_VERSION" >&6; } - if test "$CLANG_VERSION" -ge 500002075 ; then - CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if clang supports -fno-strength-reduce" >&5 +$as_echo_n "checking if clang supports -fno-strength-reduce... " >&6; } + if test "$CLANG_VERSION" -ge 500002075 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'` + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: N/A" >&5 +$as_echo "N/A" >&6; } fi +CROSS_COMPILING= if test "$cross_compiling" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&5 $as_echo "cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&6; } + CROSS_COMPILING=1 fi + test "$GCC" = yes && CPP_MM=M; if test -f ./toolcheck; then @@ -4156,6 +4565,8 @@ $as_echo_n "checking for Darwin (Mac OS X)... " >&6; } if test "`(uname) 2>/dev/null`" = Darwin; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + MACOS_X=yes + CPPFLAGS="$CPPFLAGS -DMACOS_X" { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin argument" >&5 $as_echo_n "checking --disable-darwin argument... " >&6; } @@ -4192,7 +4603,7 @@ if test "${with_developer_dir+set}" = set; then : withval=$with_developer_dir; DEVELOPER_DIR="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVELOPER_DIR" >&5 $as_echo "$DEVELOPER_DIR" >&6; } else - DEVELOPER_DIR=""; { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present" >&5 $as_echo "not present" >&6; } fi @@ -4298,6 +4709,11 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + else + if test -z "$MACOSX_DEPLOYMENT_TARGET"; then + macosx_deployment_target=`/usr/bin/sw_vers -productVersion|/usr/bin/sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` + XCODEFLAGS="$XCODEFLAGS MACOSX_DEPLOYMENT_TARGET=$macosx_deployment_target" + fi fi @@ -4350,10 +4766,10 @@ rm -f core conftest.err conftest.$ac_objext \ if test "$enable_darwin" = "yes"; then - MACOSX=yes + MACOS_X_DARWIN=yes OS_EXTRA_SRC="os_macosx.m os_mac_conv.c"; OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" - CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX" + CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN" # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ @@ -4393,7 +4809,7 @@ fi CFLAGS=$SAVE_CFLAGS if test "x$CARBON" = "xyes" -o "x$COCOA" = "xyes"; then - if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then + if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then with_x=no fi fi @@ -4779,8 +5195,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5 $as_echo "$ac_cv_lib_selinux_is_selinux_enabled" >&6; } if test "x$ac_cv_lib_selinux_is_selinux_enabled" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" +if test "x$ac_cv_header_selinux_selinux_h" = xyes; then : LIBS="$LIBS -lselinux" - $as_echo "#define HAVE_SELINUX 1" >>confdefs.h + $as_echo "#define HAVE_SELINUX 1" >>confdefs.h + +fi + fi @@ -4799,8 +5220,8 @@ if test "${with_features+set}" = set; then : withval=$with_features; features="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $features" >&5 $as_echo "$features" >&6; } else - features="normal"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: Defaulting to normal" >&5 -$as_echo "Defaulting to normal" >&6; } + features="huge"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: Defaulting to huge" >&5 +$as_echo "Defaulting to huge" >&6; } fi @@ -4890,6 +5311,10 @@ fi $as_echo "$enable_luainterp" >&6; } if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Lua with tiny or small features" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-lua-prefix argument" >&5 @@ -4934,7 +5359,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_with_luajit" >&5 $as_echo "$vi_cv_with_luajit" >&6; } - LUA_INC= if test "X$vi_cv_path_lua_pfx" != "X"; then if test "x$vi_cv_with_luajit" != "xno"; then # Extract the first word of "luajit", so it can be a program name with args. @@ -5057,7 +5481,7 @@ $as_echo "$vi_cv_version_plain_lua" >&6; } if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit" >&5 $as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit... " >&6; } - if test -f $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h; then + if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } LUA_INC=/luajit-$vi_cv_version_luajit @@ -5066,7 +5490,7 @@ $as_echo "yes" >&6; } if test "X$LUA_INC" = "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include" >&5 $as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include... " >&6; } - if test -f $vi_cv_path_lua_pfx/include/lua.h; then + if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else @@ -5074,7 +5498,7 @@ $as_echo "yes" >&6; } $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua" >&5 $as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua... " >&6; } - if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then + if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } LUA_INC=/lua$vi_cv_version_lua @@ -5151,7 +5575,7 @@ rm -f core conftest.err conftest.$ac_objext \ if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll" else - if test "x$MACOSX" = "xyes"; then + if test "x$MACOS_X" = "xyes"; then ext="dylib" indexes="" else @@ -5197,7 +5621,7 @@ $as_echo "yes" >&6; } LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS" fi if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ - test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ + test "x$MACOS_X" = "xyes" && \ test "`(uname -m) 2>/dev/null`" = "x86_64"; then LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" fi @@ -5212,57 +5636,61 @@ $as_echo "yes" >&6; } fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-mzschemeinterp argument" >&5 -$as_echo_n "checking --enable-mzschemeinterp argument... " >&6; } -# Check whether --enable-mzschemeinterp was given. -if test "${enable_mzschemeinterp+set}" = set; then : - enableval=$enable_mzschemeinterp; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-lua52interp argument" >&5 +$as_echo_n "checking --enable-lua52interp argument... " >&6; } +# Check whether --enable-lua52interp was given. +if test "${enable_lua52interp+set}" = set; then : + enableval=$enable_lua52interp; else - enable_mzschemeinterp="no" + enable_lua52interp="no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_mzschemeinterp" >&5 -$as_echo "$enable_mzschemeinterp" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_lua52interp" >&5 +$as_echo "$enable_lua52interp" >&6; } -if test "$enable_mzschemeinterp" = "yes"; then +if test "$enable_lua52interp" = "yes" -o "$enable_lua52interp" = "dynamic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-plthome argument" >&5 -$as_echo_n "checking --with-plthome argument... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-lua52-prefix argument" >&5 +$as_echo_n "checking --with-lua52-prefix argument... " >&6; } -# Check whether --with-plthome was given. -if test "${with_plthome+set}" = set; then : - withval=$with_plthome; with_plthome="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_plthome" >&5 -$as_echo "$with_plthome" >&6; } +# Check whether --with-lua52_prefix was given. +if test "${with_lua52_prefix+set}" = set; then : + withval=$with_lua52_prefix; with_lua52_prefix="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lua52_prefix" >&5 +$as_echo "$with_lua52_prefix" >&6; } else - with_plthome="";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5 -$as_echo "\"no\"" >&6; } + with_lua52_prefix="";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - if test "X$with_plthome" != "X"; then - vi_cv_path_mzscheme_pfx="$with_plthome" + if test "X$with_lua52_prefix" != "X"; then + vi_cv_path_lua52_pfx="$with_lua52_prefix" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking PLTHOME environment var" >&5 -$as_echo_n "checking PLTHOME environment var... " >&6; } - if test "X$PLTHOME" != "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$PLTHOME\"" >&5 -$as_echo "\"$PLTHOME\"" >&6; } - vi_cv_path_mzscheme_pfx="$PLTHOME" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LUA52_PREFIX environment var" >&5 +$as_echo_n "checking LUA52_PREFIX environment var... " >&6; } + if test "X$LUA52_PREFIX" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$LUA52_PREFIX\"" >&5 +$as_echo "\"$LUA52_PREFIX\"" >&6; } + vi_cv_path_lua52_pfx="$LUA52_PREFIX" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 -$as_echo "not set" >&6; } - # Extract the first word of "mzscheme", so it can be a program name with args. -set dummy mzscheme; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set, default to /usr" >&5 +$as_echo "not set, default to /usr" >&6; } + vi_cv_path_lua52_pfx="/usr" + fi + fi + + if test "X$vi_cv_path_lua52_pfx" != "X"; then + # Extract the first word of "lua", so it can be a program name with args. +set dummy lua; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_vi_cv_path_mzscheme+:} false; then : +if ${ac_cv_path_vi_cv_path_lua52+:} false; then : $as_echo_n "(cached) " >&6 else - case $vi_cv_path_mzscheme in + case $vi_cv_path_lua52 in [\\/]* | ?:[\\/]*) - ac_cv_path_vi_cv_path_mzscheme="$vi_cv_path_mzscheme" # Let the user override the test with a path. + ac_cv_path_vi_cv_path_lua52="$vi_cv_path_lua52" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5272,7 +5700,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_vi_cv_path_mzscheme="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_vi_cv_path_lua52="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5283,92 +5711,269 @@ IFS=$as_save_IFS ;; esac fi -vi_cv_path_mzscheme=$ac_cv_path_vi_cv_path_mzscheme -if test -n "$vi_cv_path_mzscheme"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_mzscheme" >&5 -$as_echo "$vi_cv_path_mzscheme" >&6; } +vi_cv_path_lua52=$ac_cv_path_vi_cv_path_lua52 +if test -n "$vi_cv_path_lua52"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_lua52" >&5 +$as_echo "$vi_cv_path_lua52" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - if test "X$vi_cv_path_mzscheme" != "X"; then - lsout=`ls -l $vi_cv_path_mzscheme` - if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then - vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` - fi - fi - - if test "X$vi_cv_path_mzscheme" != "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking MzScheme install prefix" >&5 -$as_echo_n "checking MzScheme install prefix... " >&6; } -if ${vi_cv_path_mzscheme_pfx+:} false; then : + if test "X$vi_cv_path_lua52" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua52 version" >&5 +$as_echo_n "checking Lua52 version... " >&6; } +if ${vi_cv_version_lua52+:} false; then : $as_echo_n "(cached) " >&6 else - echo "(display (simplify-path \ - (build-path (call-with-values \ - (lambda () (split-path (find-system-path (quote exec-file)))) \ - (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm - vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ - sed -e 's+/$++'` + vi_cv_version_lua52=`${vi_cv_path_lua52} -e "print(_VERSION)" | sed 's/.* //'` fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_mzscheme_pfx" >&5 -$as_echo "$vi_cv_path_mzscheme_pfx" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_lua52" >&5 +$as_echo "$vi_cv_version_lua52" >&6; } + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua52_pfx/include" >&5 +$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua52_pfx/include... " >&6; } + if test -f $vi_cv_path_lua52_pfx/include/lua.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua52_pfx/include/lua52$vi_cv_version_lua52" >&5 +$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua52_pfx/include/lua52$vi_cv_version_lua52... " >&6; } + if test -f $vi_cv_path_lua52_pfx/include/lua52$vi_cv_version_lua52/lua.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + LUA52_INC=/lua52$vi_cv_version_lua52 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + vi_cv_path_lua52_pfx= + fi + fi + fi + + if test "X$vi_cv_path_lua52_pfx" != "X"; then + if test "X$LUA52_INC" != "X"; then + LUA52_LIBS="-L${vi_cv_path_lua52_pfx}/lib -llua$vi_cv_version_lua52" + else + LUA52_LIBS="-L${vi_cv_path_lua52_pfx}/lib -llua" + fi + LUA52_CFLAGS="-I${vi_cv_path_lua52_pfx}/include${LUA52_INC}" + LUA52_SRC="if_lua52.c" + LUA52_OBJ="objects/if_lua52.o" + LUA52_PRO="if_lua52.pro" + $as_echo "#define FEAT_LUA52 1" >>confdefs.h + + if test "$enable_lua52interp" = "dynamic"; then + if test -f "${vi_cv_path_lua52_pfx}/bin/cyglua52-${vi_cv_version_lua52}.dll"; then + vi_cv_dll_name_lua52="cyglua52-${vi_cv_version_lua52}.dll" + else + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + fi + for subdir in "${lib_multiarch}" lib64 lib; do + if test -z "$subdir"; then + continue + fi + for sover in "${vi_cv_version_lua52}.${ext}" "-${vi_cv_version_lua52}.${ext}" \ + ".${vi_cv_version_lua52}.${ext}" ".${ext}.${vi_cv_version_lua52}"; do + for i in $indexes ""; do + if test -f "${vi_cv_path_lua52_pfx}/${subdir}/liblua${luajit}${sover}$i"; then + sover2="$i" + break 3 + fi + done + done + done + vi_cv_dll_name_lua52="liblua${sover}$sover2" + fi + $as_echo "#define DYNAMIC_LUA52 1" >>confdefs.h + + LUA52_LIBS="" + LUA52_CFLAGS="-DDYNAMIC_LUA52_DLL=\\\"${vi_cv_dll_name_lua52}\\\" $LUA52_CFLAGS" + fi + fi + if test "$fail_if_missing" = "yes" -a -z "$LUA52_SRC"; then + as_fn_error $? "could not configure lua52" "$LINENO" 5 + fi + + + + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-mzschemeinterp argument" >&5 +$as_echo_n "checking --enable-mzschemeinterp argument... " >&6; } +# Check whether --enable-mzschemeinterp was given. +if test "${enable_mzschemeinterp+set}" = set; then : + enableval=$enable_mzschemeinterp; +else + enable_mzschemeinterp="no" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_mzschemeinterp" >&5 +$as_echo "$enable_mzschemeinterp" >&6; } + +if test "$enable_mzschemeinterp" = "yes"; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-plthome argument" >&5 +$as_echo_n "checking --with-plthome argument... " >&6; } + +# Check whether --with-plthome was given. +if test "${with_plthome+set}" = set; then : + withval=$with_plthome; with_plthome="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_plthome" >&5 +$as_echo "$with_plthome" >&6; } +else + with_plthome="";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5 +$as_echo "\"no\"" >&6; } +fi + + + if test "X$with_plthome" != "X"; then + vi_cv_path_mzscheme_pfx="$with_plthome" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking PLTHOME environment var" >&5 +$as_echo_n "checking PLTHOME environment var... " >&6; } + if test "X$PLTHOME" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$PLTHOME\"" >&5 +$as_echo "\"$PLTHOME\"" >&6; } + vi_cv_path_mzscheme_pfx="$PLTHOME" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 +$as_echo "not set" >&6; } + # Extract the first word of "mzscheme", so it can be a program name with args. +set dummy mzscheme; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_vi_cv_path_mzscheme+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $vi_cv_path_mzscheme in + [\\/]* | ?:[\\/]*) + ac_cv_path_vi_cv_path_mzscheme="$vi_cv_path_mzscheme" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_vi_cv_path_mzscheme="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +vi_cv_path_mzscheme=$ac_cv_path_vi_cv_path_mzscheme +if test -n "$vi_cv_path_mzscheme"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_mzscheme" >&5 +$as_echo "$vi_cv_path_mzscheme" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test "X$vi_cv_path_mzscheme" != "X"; then + lsout=`ls -l $vi_cv_path_mzscheme` + if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then + vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` + fi + fi + + if test "X$vi_cv_path_mzscheme" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking MzScheme install prefix" >&5 +$as_echo_n "checking MzScheme install prefix... " >&6; } +if ${vi_cv_path_mzscheme_pfx+:} false; then : + $as_echo_n "(cached) " >&6 +else + echo "(display (simplify-path \ + (build-path (call-with-values \ + (lambda () (split-path (find-system-path (quote exec-file)))) \ + (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm + vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ + sed -e 's+/$++'` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_mzscheme_pfx" >&5 +$as_echo "$vi_cv_path_mzscheme_pfx" >&6; } rm -f mzdirs.scm fi fi fi - SCHEME_INC= if test "X$vi_cv_path_mzscheme_pfx" != "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include" >&5 -$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include... " >&6; } - if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket include directory" >&5 +$as_echo_n "checking for racket include directory... " >&6; } + SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_INC" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_INC}" >&5 +$as_echo "${SCHEME_INC}" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt" >&5 -$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt... " >&6; } - if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include" >&5 +$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include... " >&6; } + if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5 -$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; } - if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt" >&5 +$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt... " >&6; } + if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5 -$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; } - if test -f /usr/include/plt/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5 +$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; } + if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=/usr/include/plt + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5 -$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; } - if test -f /usr/include/racket/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5 +$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; } + if test -f /usr/include/plt/scheme.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=/usr/include/racket + SCHEME_INC=/usr/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - vi_cv_path_mzscheme_pfx= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5 +$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; } + if test -f /usr/include/racket/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SCHEME_INC=/usr/include/racket + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + vi_cv_path_mzscheme_pfx= + fi fi fi fi @@ -5377,52 +5982,101 @@ $as_echo "no" >&6; } fi if test "X$vi_cv_path_mzscheme_pfx" != "X"; then - if test "x$MACOSX" = "xyes"; then - MZSCHEME_LIBS="-framework Racket" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket lib directory" >&5 +$as_echo_n "checking for racket lib directory... " >&6; } + SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_LIB" != "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_LIB}" >&5 +$as_echo "${SCHEME_LIB}" >&6; } else - if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc" - else - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + fi + + for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do + if test "X$path" != "X"; then + if test "x$MACOS_X" = "xyes"; then + MZSCHEME_LIBS="-framework Racket" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libmzscheme3m.a"; then + MZSCHEME_LIBS="${path}/libmzscheme3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.a"; then + MZSCHEME_LIBS="${path}/libracket3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.a"; then + MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a" + elif test -f "${path}/libmzscheme.a"; then + MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a" + else + if test -f "${path}/libmzscheme3m.so"; then + MZSCHEME_LIBS="-L${path} -lmzscheme3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.so"; then + MZSCHEME_LIBS="-L${path} -lracket3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.so"; then + MZSCHEME_LIBS="-L${path} -lracket -lmzgc" + else + if test "$path" != "$SCHEME_LIB"; then + continue + fi + MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc" + fi + if test "$GCC" = yes; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" + elif test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" + fi + fi fi - if test "$GCC" = yes; then - MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib" - elif test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib" + if test "X$MZSCHEME_LIBS" != "X"; then + break fi + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if racket requires -pthread" >&5 +$as_echo_n "checking if racket requires -pthread... " >&6; } + if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread" + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket config directory" >&5 +$as_echo_n "checking for racket config directory... " >&6; } + SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_CONFIGDIR" != "X"; then + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_CONFIGDIR}" >&5 +$as_echo "${SCHEME_CONFIGDIR}" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket collects directory" >&5 $as_echo_n "checking for racket collects directory... " >&6; } - if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ - else - if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ + SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'` + if test "X$SCHEME_COLLECTS" = "X"; then + if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ else - if test -d $vi_cv_path_mzscheme_pfx/share/racket/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ else - if test -d $vi_cv_path_mzscheme_pfx/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + else + if test -d "$vi_cv_path_mzscheme_pfx/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + fi fi fi fi @@ -5456,7 +6110,6 @@ $as_echo_n "checking for mzscheme_base.c... " >&6; } fi if test "X$MZSCHEME_EXTRA" != "X" ; then MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE" - MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" { $as_echo "$as_me:${as_lineno-$LINENO}: result: needed" >&5 $as_echo "needed" >&6; } else @@ -5571,6 +6224,9 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_perlinterp" >&5 $as_echo "$enable_perlinterp" >&6; } if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Perl with tiny or small features" "$LINENO" 5 + fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 @@ -5646,16 +6302,28 @@ $as_echo "OK" >&6; } vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'` + vi_cv_perl_extutils=unknown_perl_extutils_path + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done - perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ - -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'` + + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ + -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//' \ + -e 's/-fdebug-prefix-map[^ ]*//g' \ + -e 's/-pipe //' \ + -e 's/-W[^ ]*//g' \ + -e 's/-D_FORTIFY_SOURCE=.//g'` perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ sed -e '/Warning/d' -e '/Note (probably harmless)/d' \ -e 's/-bE:perl.exp//' -e 's/-lc //'` perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` - if test "x$MACOSX" = "xyes"; then + if test "x$MACOS_X" = "xyes"; then perllibs=`echo "$perllibs" | sed -e 's/-arch[^-]*//g'` perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[^-]*//g'` fi @@ -5694,7 +6362,7 @@ rm -f core conftest.err conftest.$ac_objext \ LDFLAGS=$ldflags_save if test $perl_ok = yes; then if test "X$perlcppflags" != "X"; then - PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[^ ]*//'` + PERL_CFLAGS=$perlcppflags fi if test "X$perlldflags" != "X"; then if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then @@ -5715,7 +6383,7 @@ $as_echo ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } fi fi - if test "x$MACOSX" = "xyes"; then + if test "x$MACOS_X" = "xyes"; then dir=/System/Library/Perl darwindir=$dir/darwin if test -d $darwindir; then @@ -5740,7 +6408,13 @@ $as_echo ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then $as_echo "#define DYNAMIC_PERL 1" >>confdefs.h - PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS" + if ${vi_cv_dll_name_perl+:} false; then : + $as_echo_n "(cached) " >&6 +else + vi_cv_dll_name_perl="$libperl" +fi + + PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$vi_cv_dll_name_perl\\\" $PERL_CFLAGS" fi fi @@ -5767,6 +6441,25 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_pythoninterp" >&5 $as_echo "$enable_pythoninterp" >&6; } if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python-command argument" >&5 +$as_echo_n "checking --with-python-command argument... " >&6; } + + +# Check whether --with-python-command was given. +if test "${with_python_command+set}" = set; then : + withval=$with_python_command; vi_cv_path_python="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python" >&5 +$as_echo "$vi_cv_path_python" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python" = "X"; then for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -5812,6 +6505,7 @@ fi test -n "$vi_cv_path_python" && break done + fi if test "X$vi_cv_path_python" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 @@ -5873,7 +6567,7 @@ fi # Check whether --with-python-config-dir was given. if test "${with_python_config_dir+set}" = set; then : - withval=$with_python_config_dir; vi_cv_path_python_conf="${withval}" + withval=$with_python_config_dir; vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 fi @@ -5923,17 +6617,30 @@ __: @echo "python_LINKFORSHARED='$(LINKFORSHARED)'" @echo "python_DLLLIBRARY='$(DLLLIBRARY)'" @echo "python_INSTSONAME='$(INSTSONAME)'" + @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'" + @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'" + @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'" eof eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" rm -f -- "${tmp_mkf}" - if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \ + if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \ "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then vi_cv_path_python_plibs="-framework Python" + if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then + vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" + fi else - if test "${vi_cv_var_python_version}" = "1.4"; then - vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a" - else - vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" + vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" + if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then + python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t].*/\1/'` + python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t][ \t]*\(.*\)/\2/'` + if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then + python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}" + if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then + python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}" + fi + python_LINKFORSHARED="${python_link_symbol} ${python_link_path}" + fi fi vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` @@ -5941,7 +6648,9 @@ eof fi - if ${vi_cv_dll_name_python+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python's dll name" >&5 +$as_echo_n "checking Python's dll name... " >&6; } +if ${vi_cv_dll_name_python+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5952,20 +6661,21 @@ else fi fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_dll_name_python" >&5 +$as_echo "$vi_cv_dll_name_python" >&6; } PYTHON_LIBS="${vi_cv_path_python_plibs}" if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" else - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" + fi + if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then + PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + fi PYTHON_SRC="if_python.c" PYTHON_OBJ="objects/if_python.o" - if test "${vi_cv_var_python_version}" = "1.4"; then - PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" - fi - PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 $as_echo_n "checking if -pthread should be used... " >&6; } @@ -6076,8 +6786,6 @@ fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-python3interp argument" >&5 $as_echo_n "checking --enable-python3interp argument... " >&6; } # Check whether --enable-python3interp was given. @@ -6090,6 +6798,25 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_python3interp" >&5 $as_echo "$enable_python3interp" >&6; } if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python3-command argument" >&5 +$as_echo_n "checking --with-python3-command argument... " >&6; } + + +# Check whether --with-python3-command was given. +if test "${with_python3_command+set}" = set; then : + withval=$with_python3_command; vi_cv_path_python3="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python3" >&5 +$as_echo "$vi_cv_path_python3" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python3" = "X"; then for ac_prog in python3 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6135,6 +6862,7 @@ fi test -n "$vi_cv_path_python3" && break done + fi if test "X$vi_cv_path_python3" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 @@ -6213,7 +6941,7 @@ fi # Check whether --with-python3-config-dir was given. if test "${with_python3_config_dir+set}" = set; then : - withval=$with_python3_config_dir; vi_cv_path_python3_conf="${withval}" + withval=$with_python3_config_dir; vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 fi @@ -6273,7 +7001,9 @@ eof fi - if ${vi_cv_dll_name_python3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python3's dll name" >&5 +$as_echo_n "checking Python3's dll name... " >&6; } +if ${vi_cv_dll_name_python3+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6284,14 +7014,18 @@ else fi fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_dll_name_python3" >&5 +$as_echo "$vi_cv_dll_name_python3" >&6; } PYTHON3_LIBS="${vi_cv_path_python3_plibs}" if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" else - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" fi + if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then + PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + fi PYTHON3_SRC="if_python3.c" PYTHON3_OBJ="objects/if_python3.o" @@ -6396,6 +7130,14 @@ fi +# Check whether --with-properly-linked-python2-python3 was given. +if test "${with_properly_linked_python2_python3+set}" = set; then : + withval=$with_properly_linked_python2_python3; vi_cv_with_properly_linked_python2_python3="yes" +else + vi_cv_with_properly_linked_python2_python3="no" +fi + + if test "$python_ok" = yes && test "$python3_ok" = yes; then $as_echo "#define DYNAMIC_PYTHON 1" >>confdefs.h @@ -6405,8 +7147,9 @@ if test "$python_ok" = yes && test "$python3_ok" = yes; then $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; } cflags_save=$CFLAGS CFLAGS="$CFLAGS $PYTHON_CFLAGS" - ldflags_save=$LDFLAGS - LDFLAGS="-ldl $LDFLAGS" + libs_save=$LIBS + LIBS="-ldl $LIBS" + if test "x$MACOS_X" != "xyes"; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -6426,7 +7169,7 @@ else int no_rtl_global_needed_for(char *python_instsoname, char *prefix) { int needed = 0; - void* pylib = dlopen(python_instsoname, RTLD_LAZY); + void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); if (pylib != 0) { void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); @@ -6464,14 +7207,14 @@ fi CFLAGS=$cflags_save - LDFLAGS=$ldflags_save + LIBS=$libs_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5 $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; } cflags_save=$CFLAGS CFLAGS="$CFLAGS $PYTHON3_CFLAGS" - ldflags_save=$LDFLAGS - LDFLAGS="-ldl $LDFLAGS" + libs_save=$LIBS + LIBS="-ldl $LIBS" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -6492,7 +7235,7 @@ else int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) { int needed = 0; - void* pylib = dlopen(python_instsoname, RTLD_LAZY); + void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); if (pylib != 0) { void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); @@ -6528,9 +7271,17 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi + + if test "$vi_cv_with_properly_linked_python2_python3" = "yes"; then + $as_echo "#define PY_NO_RTLD_GLOBAL 1" >>confdefs.h + + $as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h + + fi CFLAGS=$cflags_save - LDFLAGS=$ldflags_save + LIBS=$libs_save PYTHON_SRC="if_python.c" PYTHON_OBJ="objects/if_python.o" @@ -6632,7 +7383,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_tclinterp" >&5 $as_echo "$enable_tclinterp" >&6; } -if test "$enable_tclinterp" = "yes"; then +if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-tclsh argument" >&5 $as_echo_n "checking --with-tclsh argument... " >&6; } @@ -6863,15 +7614,16 @@ fi if test "X$vi_cv_path_tcl" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Tcl version" >&5 $as_echo_n "checking Tcl version... " >&6; } - if echo 'exit [expr [info tclversion] < 8.0]' | $vi_cv_path_tcl - ; then + if echo 'exit [expr [info tclversion] < 8.0]' | "$vi_cv_path_tcl" - ; then tclver=`echo 'puts [info tclversion]' | $vi_cv_path_tcl -` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tclver - OK" >&5 $as_echo "$tclver - OK" >&6; }; tclloc=`echo 'set l [info library];set i [string last lib $l];incr i -2;puts [string range $l 0 $i]' | $vi_cv_path_tcl -` + tcldll=`echo 'puts libtcl[info tclversion][info sharedlibextension]' | $vi_cv_path_tcl -` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of Tcl include" >&5 $as_echo_n "checking for location of Tcl include... " >&6; } - if test "x$MACOSX" != "xyes"; then + if test "x$MACOS_X" != "xyes"; then tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver" else tclinc="/System/Library/Frameworks/Tcl.framework/Headers" @@ -6893,18 +7645,22 @@ $as_echo "<not found>" >&6; } if test -z "$SKIP_TCL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of tclConfig.sh script" >&5 $as_echo_n "checking for location of tclConfig.sh script... " >&6; } - if test "x$MACOSX" != "xyes"; then + if test "x$MACOS_X" != "xyes"; then tclcnf=`echo $tclinc | sed s/include/lib/g` tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`" else tclcnf="/System/Library/Frameworks/Tcl.framework" fi for try in $tclcnf; do - if test -f $try/tclConfig.sh; then + if test -f "$try/tclConfig.sh"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $try/tclConfig.sh" >&5 $as_echo "$try/tclConfig.sh" >&6; } - . $try/tclConfig.sh - TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"` + . "$try/tclConfig.sh" + if test "$enable_tclinterp" = "dynamic"; then + TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"` + else + TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"` + fi TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[^-]/d' -e '/^-[^D]/d' -e '/-D[^_]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'` break fi @@ -6920,10 +7676,10 @@ $as_echo_n "checking for Tcl library by myself... " >&6; } for ver in "" $tclver ; do for try in $tcllib ; do trylib=tcl$ver$ext - if test -f $try/lib$trylib ; then + if test -f "$try/lib$trylib" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $try/lib$trylib" >&5 $as_echo "$try/lib$trylib" >&6; } - TCL_LIBS="-L$try -ltcl$ver -ldl -lm" + TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm" if test "`(uname) 2>/dev/null`" = SunOS && uname -r | grep '^5' >/dev/null; then TCL_LIBS="$TCL_LIBS -R $try" @@ -6953,8 +7709,15 @@ $as_echo "<not found>" >&6; } $as_echo "too old; need Tcl version 8.0 or later" >&6; } fi fi - if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then - as_fn_error $? "could not configure Tcl" "$LINENO" 5 + if test "$enable_tclinterp" = "dynamic"; then + if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then + $as_echo "#define DYNAMIC_TCL 1" >>confdefs.h + + TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS" + fi + fi + if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then + as_fn_error $? "could not configure Tcl" "$LINENO" 5 fi fi @@ -6975,6 +7738,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5 $as_echo "$enable_rubyinterp" >&6; } if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Ruby with tiny or small features" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5 $as_echo_n "checking --with-ruby-command argument... " >&6; } @@ -7052,6 +7819,11 @@ $as_echo "$rubyhdrdir" >&6; } rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG['rubyarchhdrdir'] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG['arch']"` if test -d "$rubyarchdir"; then RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" + else + rubyarchdir=${rubyarchdir/darwin15/darwin16} + if test -d "$rubyarchdir"; then + RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" + fi fi rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['ruby_version'].gsub(/\./, '')[0,2]"` if test "X$rubyversion" = "X"; then @@ -7068,9 +7840,9 @@ $as_echo "$rubyhdrdir" >&6; } if test -f "$rubylibdir/$librubya"; then librubyarg="$librubyarg" RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" - elif test -d "/System/Library/Frameworks/Ruby.framework"; then + elif test "$vi_cv_path_ruby" = "/usr/bin/ruby" -a -d "/System/Library/Frameworks/Ruby.framework"; then RUBY_LIBS="-framework Ruby" - RUBY_CFLAGS="-DRUBY_VERSION=$rubyversion" + RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion -DRUBY_FRAMEWORK" librubyarg= fi @@ -7096,10 +7868,10 @@ $as_echo "$rubyhdrdir" >&6; } $as_echo "#define FEAT_RUBY 1" >>confdefs.h if test "$enable_rubyinterp" = "dynamic"; then - libruby=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG['LIBRUBY_SO']"` + libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG['LIBRUBY_ALIASES'].split[0]"` $as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h - RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" + RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" RUBY_LIBS= fi else @@ -7171,8 +7943,49 @@ else fi if test "$enable_netbeans" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot use NetBeans with tiny or small features" >&5 +$as_echo "cannot use NetBeans with tiny or small features" >&6; } + enable_netbeans="no" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-channel argument" >&5 +$as_echo_n "checking --disable-channel argument... " >&6; } +# Check whether --enable-channel was given. +if test "${enable_channel+set}" = set; then : + enableval=$enable_channel; +else + enable_channel="yes" +fi + +if test "$enable_channel" = "yes"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot use channels with tiny or small features" >&5 +$as_echo "cannot use channels with tiny or small features" >&6; } + enable_channel="no" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi +else + if test "$enable_netbeans" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, netbeans also disabled" >&5 +$as_echo "yes, netbeans also disabled" >&6; } + enable_netbeans="no" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi +fi + +if test "$enable_channel" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : @@ -7263,8 +8076,8 @@ _ACEOF fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling netbeans integration is possible" >&5 -$as_echo_n "checking whether compiling netbeans integration is possible... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling with process communication is possible" >&5 +$as_echo_n "checking whether compiling with process communication is possible... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7280,7 +8093,7 @@ $as_echo_n "checking whether compiling netbeans integration is possible... " >&6 /* Check bitfields */ struct nbbuf { unsigned int initDone:1; - ushort signmaplen; + unsigned short signmaplen; }; int @@ -7304,13 +8117,10 @@ if ac_fn_c_try_link "$LINENO"; then : $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; enable_netbeans="no" +$as_echo "no" >&6; }; enable_netbeans="no"; enable_channel="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } fi if test "$enable_netbeans" = "yes"; then $as_echo "#define FEAT_NETBEANS_INTG 1" >>confdefs.h @@ -7319,25 +8129,72 @@ if test "$enable_netbeans" = "yes"; then NETBEANS_OBJ="objects/netbeans.o" +fi +if test "$enable_channel" = "yes"; then + $as_echo "#define FEAT_JOB_CHANNEL 1" >>confdefs.h + + CHANNEL_SRC="channel.c" + + CHANNEL_OBJ="objects/channel.o" + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-sniff argument" >&5 -$as_echo_n "checking --enable-sniff argument... " >&6; } -# Check whether --enable-sniff was given. -if test "${enable_sniff+set}" = set; then : - enableval=$enable_sniff; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-terminal argument" >&5 +$as_echo_n "checking --enable-terminal argument... " >&6; } +# Check whether --enable-terminal was given. +if test "${enable_terminal+set}" = set; then : + enableval=$enable_terminal; +else + enable_terminal="auto" +fi + +if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot use terminal emulator with tiny or small features" >&5 +$as_echo "cannot use terminal emulator with tiny or small features" >&6; } + enable_terminal="no" + else + if test "$enable_terminal" = "auto"; then + enable_terminal="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to yes" >&5 +$as_echo "defaulting to yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + fi else - enable_sniff="no" + if test "$enable_terminal" = "auto"; then + enable_terminal="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to no" >&5 +$as_echo "defaulting to no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi fi +if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then + $as_echo "#define FEAT_TERMINAL 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_sniff" >&5 -$as_echo "$enable_sniff" >&6; } -if test "$enable_sniff" = "yes"; then - $as_echo "#define FEAT_SNIFF 1" >>confdefs.h + TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/screen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" - SNIFF_SRC="if_sniff.c" + TERM_OBJ="objects/term_encoding.o objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o objects/term_pen.o objects/term_screen.o objects/term_state.o objects/term_unicode.o objects/term_vterm.o" - SNIFF_OBJ="objects/if_sniff.o" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-autoservername argument" >&5 +$as_echo_n "checking --enable-autoservername argument... " >&6; } +# Check whether --enable-autoservername was given. +if test "${enable_autoservername+set}" = set; then : + enableval=$enable_autoservername; +else + enable_autoservername="no" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_autoservername" >&5 +$as_echo "$enable_autoservername" >&6; } +if test "$enable_autoservername" = "yes"; then + $as_echo "#define FEAT_AUTOSERVERNAME 1" >>confdefs.h fi @@ -7394,7 +8251,7 @@ fi $as_echo "$enable_fontset" >&6; } test -z "$with_x" && with_x=yes -test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes +test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes if test "$with_x" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to: don't HAVE_X11" >&5 $as_echo "defaulting to: don't HAVE_X11" >&6; } @@ -8411,7 +9268,7 @@ $as_echo "$ac_cv_small_wchar_t" >&6; } fi fi -test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no +test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-gui argument" >&5 $as_echo_n "checking --enable-gui argument... " >&6; } @@ -8427,6 +9284,7 @@ enable_gui_canon=`echo "_$enable_gui" | \ sed 's/[ _+-]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` SKIP_GTK2=YES +SKIP_GTK3=YES SKIP_GNOME=YES SKIP_MOTIF=YES SKIP_ATHENA=YES @@ -8453,7 +9311,7 @@ $as_echo "Sorry, $enable_gui GUI is not supported" >&6; } SKIP_PHOTON=YES ;; esac -elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then +elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then SKIP_CARBON= SKIP_MACVIM= case "$enable_gui_canon" in @@ -8497,6 +9355,9 @@ $as_echo "GTK+ 2.x GUI support" >&6; } $as_echo "GNOME 2.x GUI support" >&6; } SKIP_GNOME= SKIP_GTK2=;; + gtk3) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 3.x GUI support" >&5 +$as_echo "GTK+ 3.x GUI support" >&6; } + SKIP_GTK3=;; motif) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Motif GUI support" >&5 $as_echo "Motif GUI support" >&6; } SKIP_MOTIF=;; @@ -8548,6 +9409,23 @@ $as_echo "$enable_gnome_check" >&6; } fi fi +if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for GTK+ 3" >&5 +$as_echo_n "checking whether or not to look for GTK+ 3... " >&6; } + # Check whether --enable-gtk3-check was given. +if test "${enable_gtk3_check+set}" = set; then : + enableval=$enable_gtk3_check; +else + enable_gtk3_check="yes" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk3_check" >&5 +$as_echo "$enable_gtk3_check" >&6; } + if test "x$enable_gtk3_check" = "xno"; then + SKIP_GTK3=YES + fi +fi + if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for Motif" >&5 $as_echo_n "checking whether or not to look for Motif... " >&6; } @@ -8633,7 +9511,7 @@ $as_echo "$enable_macvim_check" >&6; }; fi fi -if test "x$MACOSX" = "xyes"; then +if test "x$MACOS_X" = "xyes"; then if test x$prefix = xNONE; then prefix=/Applications fi @@ -8695,8 +9573,9 @@ $as_echo "gtk test disabled" >&6; } fi if test "X$PKG_CONFIG" = "X"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : @@ -8722,7 +9601,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -8736,19 +9614,76 @@ $as_echo "no" >&6; } fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + fi if test "x$PKG_CONFIG" != "xno"; then if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then { - min_gtk_version=2.2.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5 -$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } no_gtk="" if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ && $PKG_CONFIG --exists gtk+-2.0; then { + min_gtk_version=2.2.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5 +$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0` GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0` GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0` @@ -8759,6 +9694,23 @@ $as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` } + elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ + && $PKG_CONFIG --exists gtk+-3.0; then + { + min_gtk_version=2.2.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5 +$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } + + GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0` + GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0` + GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0` + gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + } else no_gtk=yes fi @@ -8854,6 +9806,7 @@ $as_echo "no" >&6; } rm -f conf.gtktest if test "x$GTK_CFLAGS" != "x"; then + SKIP_GTK3=YES SKIP_ATHENA=YES SKIP_NEXTAW=YES SKIP_MOTIF=YES @@ -8862,11 +9815,6 @@ $as_echo "no" >&6; } fi fi if test "x$GUITYPE" = "xGTK"; then - if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \ - || test "0$gtk_minor_version" -ge 2; then - $as_echo "#define HAVE_GTK_MULTIHEAD 1" >>confdefs.h - - fi if test -z "$SKIP_GNOME"; then { @@ -8922,40 +9870,512 @@ $as_echo "yes" >&6; } GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0` GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD" >&5 -$as_echo_n "checking for FreeBSD... " >&6; } - if test "`(uname) 2>/dev/null`" = FreeBSD; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" - GNOME_LIBS="$GNOME_LIBS -pthread" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD" >&5 +$as_echo_n "checking for FreeBSD... " >&6; } + if test "`(uname) 2>/dev/null`" = FreeBSD; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" + GNOME_LIBS="$GNOME_LIBS -pthread" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + have_gnome=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + if test "x" = xfail; then + as_fn_error $? "Could not find libgnomeui-2.0 via pkg-config" "$LINENO" 5 + fi + fi + } + fi + + if test "x$have_gnome" = xyes ; then + $as_echo "#define FEAT_GUI_GNOME 1" >>confdefs.h + + GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR" + GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS" + fi + } + fi + fi +fi + + +if test -z "$SKIP_GTK3"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gtktest argument" >&5 +$as_echo_n "checking --disable-gtktest argument... " >&6; } + # Check whether --enable-gtktest was given. +if test "${enable_gtktest+set}" = set; then : + enableval=$enable_gtktest; +else + enable_gtktest=yes +fi + + if test "x$enable_gtktest" = "xyes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test enabled" >&5 +$as_echo "gtk test enabled" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test disabled" >&5 +$as_echo "gtk test disabled" >&6; } + fi + + if test "X$PKG_CONFIG" = "X"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + + fi + + if test "x$PKG_CONFIG" != "xno"; then + + if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then + { + no_gtk="" + if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ + && $PKG_CONFIG --exists gtk+-2.0; then + { + min_gtk_version=3.0.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5 +$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } + GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0` + GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0` + GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0` + gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + } + elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ + && $PKG_CONFIG --exists gtk+-3.0; then + { + min_gtk_version=3.0.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5 +$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; } + + GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0` + GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0` + GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0` + gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + } + else + no_gtk=yes + fi + + if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then + { + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + + rm -f conf.gtktest + if test "$cross_compiling" = yes; then : + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <gtk/gtk.h> +#include <stdio.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif + +int +main () +{ +int major, minor, micro; +char *tmp_version; + +system ("touch conf.gtktest"); + +/* HP/UX 9 (%@#!) writes to sscanf strings */ +tmp_version = g_strdup("$min_gtk_version"); +if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + +if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && + (gtk_micro_version >= micro))) +{ + return 0; +} +return 1; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + no_gtk=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + } + fi + if test "x$no_gtk" = x ; then + if test "x$enable_gtktest" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&5 +$as_echo "yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&5 +$as_echo "found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&6; } + fi + GUI_LIB_LOC="$GTK_LIBDIR" + GTK_LIBNAME="$GTK_LIBS" + GUI_INC_LOC="$GTK_CFLAGS" + else + { + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + GTK_CFLAGS="" + GTK_LIBS="" + : + } + fi + } + else + GTK_CFLAGS="" + GTK_LIBS="" + : + fi + + + rm -f conf.gtktest + + if test "x$GTK_CFLAGS" != "x"; then + SKIP_GTK2=YES + SKIP_GNOME=YES + SKIP_ATHENA=YES + SKIP_NEXTAW=YES + SKIP_MOTIF=YES + GUITYPE=GTK + + $as_echo "#define USE_GTK3 1" >>confdefs.h + + fi + fi +fi + +if test "x$GUITYPE" = "xGTK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of Gdk-Pixbuf" >&5 +$as_echo_n "checking version of Gdk-Pixbuf... " >&6; } + gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0` + if test "x$gdk_pixbuf_version" != x ; then + gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \ + sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/'` + if test "x$gdk_pixbuf_version_minor" != x -a \ + $gdk_pixbuf_version_minor -ge 31 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OK." >&5 +$as_echo "OK." >&6; } + # Extract the first word of "glib-compile-resources", so it can be a program name with args. +set dummy glib-compile-resources; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GLIB_COMPILE_RESOURCES+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GLIB_COMPILE_RESOURCES in + [\\/]* | ?:[\\/]*) + ac_cv_path_GLIB_COMPILE_RESOURCES="$GLIB_COMPILE_RESOURCES" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GLIB_COMPILE_RESOURCES="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GLIB_COMPILE_RESOURCES" && ac_cv_path_GLIB_COMPILE_RESOURCES="no" + ;; +esac +fi +GLIB_COMPILE_RESOURCES=$ac_cv_path_GLIB_COMPILE_RESOURCES +if test -n "$GLIB_COMPILE_RESOURCES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_COMPILE_RESOURCES" >&5 +$as_echo "$GLIB_COMPILE_RESOURCES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking glib-compile-resources" >&5 +$as_echo_n "checking glib-compile-resources... " >&6; } + if test "x$GLIB_COMPILE_RESOURCES" = xno ; then + GLIB_COMPILE_RESOURCES="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot be found in PATH." >&5 +$as_echo "cannot be found in PATH." >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: usable." >&5 +$as_echo "usable." >&6; } + $as_echo "#define USE_GRESOURCE 1" >>confdefs.h + + GRESOURCE_SRC="auto/gui_gtk_gresources.c" + GRESOURCE_OBJ="objects/gui_gtk_gresources.o" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable." >&5 +$as_echo "not usable." >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot obtain from pkg_config." >&5 +$as_echo "cannot obtain from pkg_config." >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-icon-cache-update argument" >&5 +$as_echo_n "checking --disable-icon-cache-update argument... " >&6; } + # Check whether --enable-icon_cache_update was given. +if test "${enable_icon_cache_update+set}" = set; then : + enableval=$enable_icon_cache_update; +else + enable_icon_cache_update="yes" +fi + + if test "$enable_icon_cache_update" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 +$as_echo "not set" >&6; } + # Extract the first word of "gtk-update-icon-cache", so it can be a program name with args. +set dummy gtk-update-icon-cache; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GTK_UPDATE_ICON_CACHE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GTK_UPDATE_ICON_CACHE in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTK_UPDATE_ICON_CACHE="$GTK_UPDATE_ICON_CACHE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTK_UPDATE_ICON_CACHE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GTK_UPDATE_ICON_CACHE" && ac_cv_path_GTK_UPDATE_ICON_CACHE="no" + ;; +esac +fi +GTK_UPDATE_ICON_CACHE=$ac_cv_path_GTK_UPDATE_ICON_CACHE +if test -n "$GTK_UPDATE_ICON_CACHE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_UPDATE_ICON_CACHE" >&5 +$as_echo "$GTK_UPDATE_ICON_CACHE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found in PATH." >&5 +$as_echo "not found in PATH." >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: update disabled" >&5 +$as_echo "update disabled" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-desktop-database-update argument" >&5 +$as_echo_n "checking --disable-desktop-database-update argument... " >&6; } + # Check whether --enable-desktop_database_update was given. +if test "${enable_desktop_database_update+set}" = set; then : + enableval=$enable_desktop_database_update; +else + enable_desktop_database_update="yes" +fi + + if test "$enable_desktop_database_update" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 +$as_echo "not set" >&6; } + # Extract the first word of "update-desktop-database", so it can be a program name with args. +set dummy update-desktop-database; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_UPDATE_DESKTOP_DATABASE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $UPDATE_DESKTOP_DATABASE in + [\\/]* | ?:[\\/]*) + ac_cv_path_UPDATE_DESKTOP_DATABASE="$UPDATE_DESKTOP_DATABASE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_UPDATE_DESKTOP_DATABASE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_UPDATE_DESKTOP_DATABASE" && ac_cv_path_UPDATE_DESKTOP_DATABASE="no" + ;; +esac +fi +UPDATE_DESKTOP_DATABASE=$ac_cv_path_UPDATE_DESKTOP_DATABASE +if test -n "$UPDATE_DESKTOP_DATABASE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UPDATE_DESKTOP_DATABASE" >&5 +$as_echo "$UPDATE_DESKTOP_DATABASE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi - have_gnome=yes - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - if test "x" = xfail; then - as_fn_error $? "Could not find libgnomeui-2.0 via pkg-config" "$LINENO" 5 - fi - fi - } - fi +fi - if test "x$have_gnome" = xyes ; then - $as_echo "#define FEAT_GUI_GNOME 1" >>confdefs.h - GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR" - GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS" - fi - } + if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found in PATH." >&5 +$as_echo "not found in PATH." >&6; } fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: update disabled" >&5 +$as_echo "update disabled" >&6; } fi fi + + + + + if test -z "$SKIP_MOTIF"; then gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX" GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`" @@ -9377,7 +10797,8 @@ done CPPFLAGS=$cppflags_save fi -if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then + +if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then cppflags_save=$CPPFLAGS CPPFLAGS="$CPPFLAGS $X_CFLAGS" for ac_header in X11/xpm.h X11/Sunkeysym.h @@ -9548,10 +10969,32 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CYGWIN environment" >&5 -$as_echo_n "checking for CYGWIN environment... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc link to executable" >&5 +$as_echo_n "checking for /proc link to executable... " >&6; } +if test -L "/proc/self/exe"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/self/exe" >&5 +$as_echo "/proc/self/exe" >&6; } + $as_echo "#define PROC_EXE_LINK \"/proc/self/exe\"" >>confdefs.h + +elif test -L "/proc/self/path/a.out"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/self/path/a.out" >&5 +$as_echo "/proc/self/path/a.out" >&6; } + $as_echo "#define PROC_EXE_LINK \"/proc/self/path/a.out\"" >>confdefs.h + +elif test -L "/proc/curproc/file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: /proc/curproc/file" >&5 +$as_echo "/proc/curproc/file" >&6; } + $as_echo "#define PROC_EXE_LINK \"/proc/curproc/file\"" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CYGWIN or MSYS environment" >&5 +$as_echo_n "checking for CYGWIN or MSYS environment... " >&6; } case `uname` in - CYGWIN*) CYGWIN=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + CYGWIN*|MSYS*) CYGWIN=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CYGWIN clipboard support" >&5 $as_echo_n "checking for CYGWIN clipboard support... " >&6; } @@ -9912,10 +11355,10 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -for ac_header in stdarg.h stdint.h stdlib.h string.h \ +for ac_header in stdint.h stdlib.h string.h \ sys/select.h sys/utsname.h termcap.h fcntl.h \ sgtty.h sys/ioctl.h sys/time.h sys/types.h \ - termio.h iconv.h inttypes.h langinfo.h math.h \ + termio.h iconv.h inttypes.h langinfo.h math.h migemo.h \ unistd.h stropts.h errno.h sys/resource.h \ sys/systeminfo.h locale.h sys/stream.h termios.h \ libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ @@ -10006,7 +11449,7 @@ fi done -if test "x$MACOSX" = "xyes"; then +if test "x$MACOS_X" = "xyes"; then $as_echo "#define NO_STRINGS_WITH_STRING_H 1" >>confdefs.h else @@ -10580,6 +12023,48 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rlim_t" >&5 $as_echo_n "checking for rlim_t... " >&6; } @@ -10889,16 +12374,15 @@ if test "x$vim_cv_terminfo" = "xyes" ; then fi -if test "x$olibs" != "x$LIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking what tgetent() returns for an unknown terminal" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what tgetent() returns for an unknown terminal" >&5 $as_echo_n "checking what tgetent() returns for an unknown terminal... " >&6; } -if ${vim_cv_tgent+:} false; then : +if ${vim_cv_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : - as_fn_error $? "failed to compile test program." "$LINENO" 5 + as_fn_error $? "failed to compile test program." "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10918,11 +12402,11 @@ main() _ACEOF if ac_fn_c_try_run "$LINENO"; then : - vim_cv_tgent=zero + vim_cv_tgetent=zero else - vim_cv_tgent=non-zero + vim_cv_tgetent=non-zero fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -10931,13 +12415,12 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_tgent" >&5 -$as_echo "$vim_cv_tgent" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_tgetent" >&5 +$as_echo "$vim_cv_tgetent" >&6; } - if test "x$vim_cv_tgent" = "xzero" ; then - $as_echo "#define TGETENT_ZERO_ERR 0" >>confdefs.h +if test "x$vim_cv_tgetent" = "xzero" ; then + $as_echo "#define TGETENT_ZERO_ERR 0" >>confdefs.h - fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termcap.h contains ospeed" >&5 @@ -11412,13 +12895,13 @@ if test "x$vim_cv_getcwd_broken" = "xyes" ; then fi -for ac_func in bcmp fchdir fchown fsync getcwd getpseudotty \ - getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \ +for ac_func in fchdir fchown fchmod fsync getcwd getpseudotty \ + getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \ memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ - setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ - sigvec strcasecmp strerror strftime stricmp strncasecmp \ + getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ + sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \ strnicmp strpbrk strtol tgetent towlower towupper iswupper \ - usleep utime utimes + usleep utime utimes mblen ftruncate unsetenv do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -11524,7 +13007,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11570,7 +13053,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11594,7 +13077,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11639,7 +13122,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11663,7 +13146,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11939,6 +13422,70 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOAT_FUNCS 1" >>confdefs.h +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf()" >&5 +$as_echo_n "checking for isinf()... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_MATH_H +# include <math.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif + +int +main () +{ +int r = isinf(1.11); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_ISINF 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isnan()" >&5 +$as_echo_n "checking for isnan()... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_MATH_H +# include <math.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif + +int +main () +{ +int r = isnan(1.11); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_ISNAN 1" >>confdefs.h + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -11956,9 +13503,9 @@ else fi if test "$enable_acl" = "yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lposix1e" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lposix1e" >&5 $as_echo_n "checking for acl_get_file in -lposix1e... " >&6; } if ${ac_cv_lib_posix1e_acl_get_file+:} false; then : $as_echo_n "(cached) " >&6 @@ -12080,9 +13627,9 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX ACL support" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX ACL support" >&5 $as_echo_n "checking for POSIX ACL support... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> @@ -12111,7 +13658,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get in -lsec" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get in -lsec" >&5 $as_echo_n "checking for acl_get in -lsec... " >&6; } if ${ac_cv_lib_sec_acl_get+:} false; then : $as_echo_n "(cached) " >&6 @@ -12153,7 +13700,7 @@ if test "x$ac_cv_lib_sec_acl_get" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris ACL support" >&5 $as_echo_n "checking for Solaris ACL support... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_ACL_H @@ -12181,9 +13728,9 @@ rm -f core conftest.err conftest.$ac_objext \ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AIX ACL support" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AIX ACL support" >&5 $as_echo_n "checking for AIX ACL support... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if STDC_HEADERS @@ -12228,6 +13775,38 @@ else $as_echo "yes" >&6; } fi +if test "x$GTK_CFLAGS" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pango_shape_full" >&5 +$as_echo_n "checking for pango_shape_full... " >&6; } + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <gtk/gtk.h> +int +main () +{ + pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_PANGO_SHAPE_FULL 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gpm argument" >&5 $as_echo_n "checking --disable-gpm argument... " >&6; } # Check whether --enable-gpm was given. @@ -12809,16 +14388,15 @@ $as_echo "$vim_cv_memcpy_handles_overlap" >&6; } fi - -if test "$enable_multibyte" = "yes"; then +if test "x$with_x" = "xyes"; then cflags_save=$CFLAGS - ldflags_save=$LDFLAGS - if test "x$x_includes" != "xNONE" ; then - CFLAGS="$CFLAGS -I$x_includes" - LDFLAGS="$X_LIBS $LDFLAGS -lX11" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5 + libs_save=$LIBS + LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS" + CFLAGS="$CFLAGS $X_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5 $as_echo_n "checking whether X_LOCALE needed... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <X11/Xlocale.h> int @@ -12851,7 +14429,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define X_LOCALE 1" >>confdefs.h + $as_echo "#define X_LOCALE 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -12864,9 +14442,41 @@ else $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Xutf8SetWMProperties() can be used" >&5 +$as_echo_n "checking whether Xutf8SetWMProperties() can be used... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char Xutf8SetWMProperties (); +int +main () +{ +return Xutf8SetWMProperties (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_XUTF8SETWMPROPERTIES 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$cflags_save - LDFLAGS=$ldflags_save + LIBS=$libs_save fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xpg4_setrunelocale in -lxpg4" >&5 @@ -13052,7 +14662,7 @@ rm -f core conftest.err conftest.$ac_objext \ { $as_echo "$as_me:${as_lineno-$LINENO}: result: msgfmt not found - disabled" >&5 $as_echo "msgfmt not found - disabled" >&6; }; fi - if test $have_gettext = "yes"; then + if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h MAKEMO=yes @@ -13102,6 +14712,64 @@ else $as_echo "yes" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-migemo argument" >&5 +$as_echo_n "checking --disable-migemo argument... " >&6; } +# Check whether --enable-migemo was given. +if test "${enable_migemo+set}" = set; then : + enableval=$enable_migemo; +else + enable_migemo="yes" +fi + +if test "$enable_migemo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for migemo_open in -lmigemo" >&5 +$as_echo_n "checking for migemo_open in -lmigemo... " >&6; } +if ${ac_cv_lib_migemo_migemo_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmigemo $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char migemo_open (); +int +main () +{ +return migemo_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_migemo_migemo_open=yes +else + ac_cv_lib_migemo_migemo_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_migemo_migemo_open" >&5 +$as_echo "$ac_cv_lib_migemo_migemo_open" >&6; } +if test "x$ac_cv_lib_migemo_migemo_open" = xyes; then : + LIBS="$LIBS -lmigemo"; $as_echo "#define HAVE_MIGEMO 1" >>confdefs.h + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi + ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : DLL=dlfcn.h @@ -13314,31 +14982,54 @@ fi done -if test "x$MACOSX" = "xyes" -a -n "$PERL"; then +if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then if echo $LIBS | grep -e '-ldl' >/dev/null; then LIBS=`echo $LIBS | sed s/-ldl//` PERL_LIBS="$PERL_LIBS -ldl" fi fi -if test "x$MACOSX" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -framework Cocoa" >&5 -$as_echo_n "checking whether we need -framework Cocoa... " >&6; } - if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then - LIBS=$"$LIBS -framework Cocoa" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if test "$MACOS_X" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need macOS frameworks" >&5 +$as_echo_n "checking whether we need macOS frameworks... " >&6; } + if test "$GUITYPE" = "CARBONGUI"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, we need Carbon" >&5 +$as_echo "yes, we need Carbon" >&6; } + LIBS="$LIBS -framework Carbon" + elif test "$MACOS_X_DARWIN" = "yes"; then + if test "$features" = "tiny"; then + OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'` + OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'` + if test "$enable_multibyte" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, we need CoreServices" >&5 +$as_echo "yes, we need CoreServices" >&6; } + LIBS="$LIBS -framework CoreServices" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_mac_conv.c++'` + OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_mac_conv.o++'` + CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's+-DMACOS_X_DARWIN++'` + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, we need AppKit" >&5 +$as_echo "yes, we need AppKit" >&6; } + LIBS="$LIBS -framework AppKit" + if test "$features" = "small" -a "$enable_multibyte" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: +multi_byte will be set in favor of +clipboard" >&5 +$as_echo "$as_me: +multi_byte will be set in favor of +clipboard" >&6;} + enable_multibyte=yes + $as_echo "#define FEAT_MBYTE 1" >>confdefs.h + + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi - if test "x$features" = "xtiny"; then - OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'` - OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'` fi fi -if test "x$MACOSX" = "xyes"; then +if test "x$MACOS_X" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-xcodecfg argument" >&5 $as_echo_n "checking --with-xcodecfg argument... " >&6; } @@ -13353,6 +15044,11 @@ $as_echo "using default" >&6; } fi + vim_short_version_string=`grep 'define.*VIM_VERSION_SHORT' $srcdir/version.h|sed -E -e 's/.*"([0-9.]*)".*/\1/'` + snapshot=`grep -C2 "Add new patch number below this line" $srcdir/version.c|tail -1|sed -E -e 's/^ *([0-9]+),.*/\1/'` + vim_short_version_string="$vim_short_version_string.$snapshot" + XCODEFLAGS="$XCODEFLAGS VIM_SHORT_VERSION_STRING=$vim_short_version_string" + fi @@ -13383,6 +15079,18 @@ $as_echo "no" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need to force -D_FILE_OFFSET_BITS=64" >&5 +$as_echo_n "checking whether we need to force -D_FILE_OFFSET_BITS=64... " >&6; } +if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5 $as_echo_n "checking linker --as-needed support... " >&6; } LINK_AS_NEEDED= diff --git a/src/beval.c b/src/beval.c new file mode 100644 index 0000000000..4ceddca19f --- /dev/null +++ b/src/beval.c @@ -0,0 +1,281 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * Visual Workshop integration by Gordon Prieur + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +#include "vim.h" + +#if defined(FEAT_BEVAL) || defined(PROTO) + +/* + * Get the text and position to be evaluated for "beval". + * If "getword" is true the returned text is not the whole line but the + * relevant word in allocated memory. + * Returns OK or FAIL. + */ + int +get_beval_info( + BalloonEval *beval, + int getword, + win_T **winp, + linenr_T *lnump, + char_u **textp, + int *colp) +{ + win_T *wp; + int row, col; + char_u *lbuf; + linenr_T lnum; + + *textp = NULL; +# ifdef FEAT_BEVAL_TERM +# ifdef FEAT_GUI + if (!gui.in_use) +# endif + { + row = mouse_row; + col = mouse_col; + } +# endif +# ifdef FEAT_GUI + if (gui.in_use) + { + row = Y_2_ROW(beval->y); + col = X_2_COL(beval->x); + } +#endif + wp = mouse_find_win(&row, &col); + if (wp != NULL && row >= 0 && row < wp->w_height && col < wp->w_width) + { + /* Found a window and the cursor is in the text. Now find the line + * number. */ + if (!mouse_comp_pos(wp, &row, &col, &lnum)) + { + /* Not past end of the file. */ + lbuf = ml_get_buf(wp->w_buffer, lnum, FALSE); + if (col <= win_linetabsize(wp, lbuf, (colnr_T)MAXCOL)) + { + /* Not past end of line. */ + if (getword) + { + /* For Netbeans we get the relevant part of the line + * instead of the whole line. */ + int len; + pos_T *spos = NULL, *epos = NULL; + + if (VIsual_active) + { + if (LT_POS(VIsual, curwin->w_cursor)) + { + spos = &VIsual; + epos = &curwin->w_cursor; + } + else + { + spos = &curwin->w_cursor; + epos = &VIsual; + } + } + + col = vcol2col(wp, lnum, col); + + if (VIsual_active + && wp->w_buffer == curwin->w_buffer + && (lnum == spos->lnum + ? col >= (int)spos->col + : lnum > spos->lnum) + && (lnum == epos->lnum + ? col <= (int)epos->col + : lnum < epos->lnum)) + { + /* Visual mode and pointing to the line with the + * Visual selection: return selected text, with a + * maximum of one line. */ + if (spos->lnum != epos->lnum || spos->col == epos->col) + return FAIL; + + lbuf = ml_get_buf(curwin->w_buffer, VIsual.lnum, FALSE); + len = epos->col - spos->col; + if (*p_sel != 'e') + len += MB_PTR2LEN(lbuf + epos->col); + lbuf = vim_strnsave(lbuf + spos->col, len); + lnum = spos->lnum; + col = spos->col; + } + else + { + /* Find the word under the cursor. */ + ++emsg_off; + len = find_ident_at_pos(wp, lnum, (colnr_T)col, &lbuf, + FIND_IDENT + FIND_STRING + FIND_EVAL); + --emsg_off; + if (len == 0) + return FAIL; + lbuf = vim_strnsave(lbuf, len); + } + } + + *winp = wp; + *lnump = lnum; + *textp = lbuf; + *colp = col; + beval->ts = wp->w_buffer->b_p_ts; + return OK; + } + } + } + + return FAIL; +} + +/* + * Show a balloon with "mesg" or "list". + */ + void +post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED) +{ +# ifdef FEAT_BEVAL_TERM +# ifdef FEAT_GUI + if (!gui.in_use) +# endif + ui_post_balloon(mesg, list); +# endif +# ifdef FEAT_BEVAL_GUI + if (gui.in_use) + /* GUI can't handle a list */ + gui_mch_post_balloon(beval, mesg); +# endif +} + +/* + * Returns TRUE if the balloon eval has been enabled: + * 'ballooneval' for the GUI and 'balloonevalterm' for the terminal. + * Also checks if the screen isn't scrolled up. + */ + int +can_use_beval(void) +{ + return (0 +#ifdef FEAT_BEVAL_GUI + || (gui.in_use && p_beval) +#endif +#ifdef FEAT_BEVAL_TERM + || ( +# ifdef FEAT_GUI + !gui.in_use && +# endif + p_bevalterm) +#endif + ) && msg_scrolled == 0; +} + +/* + * Common code, invoked when the mouse is resting for a moment. + */ + void +general_beval_cb(BalloonEval *beval, int state UNUSED) +{ +#ifdef FEAT_EVAL + win_T *wp; + int col; + int use_sandbox; + linenr_T lnum; + char_u *text; + static char_u *result = NULL; + long winnr = 0; + char_u *bexpr; + buf_T *save_curbuf; + size_t len; + win_T *cw; +#endif + static int recursive = FALSE; + + /* Don't do anything when 'ballooneval' is off, messages scrolled the + * windows up or we have no beval area. */ + if (!can_use_beval() || beval == NULL) + return; + + /* Don't do this recursively. Happens when the expression evaluation + * takes a long time and invokes something that checks for CTRL-C typed. */ + if (recursive) + return; + recursive = TRUE; + +#ifdef FEAT_EVAL + if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK) + { + bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr + : wp->w_buffer->b_p_bexpr; + if (*bexpr != NUL) + { + /* Convert window pointer to number. */ + for (cw = firstwin; cw != wp; cw = cw->w_next) + ++winnr; + + set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); + set_vim_var_nr(VV_BEVAL_WINNR, winnr); + set_vim_var_nr(VV_BEVAL_WINID, wp->w_id); + set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); + set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); + set_vim_var_string(VV_BEVAL_TEXT, text, -1); + vim_free(text); + + /* + * Temporarily change the curbuf, so that we can determine whether + * the buffer-local balloonexpr option was set insecurely. + */ + save_curbuf = curbuf; + curbuf = wp->w_buffer; + use_sandbox = was_set_insecurely((char_u *)"balloonexpr", + *curbuf->b_p_bexpr == NUL ? 0 : OPT_LOCAL); + curbuf = save_curbuf; + if (use_sandbox) + ++sandbox; + ++textlock; + + vim_free(result); + result = eval_to_string(bexpr, NULL, TRUE); + + /* Remove one trailing newline, it is added when the result was a + * list and it's hardly ever useful. If the user really wants a + * trailing newline he can add two and one remains. */ + if (result != NULL) + { + len = STRLEN(result); + if (len > 0 && result[len - 1] == NL) + result[len - 1] = NUL; + } + + if (use_sandbox) + --sandbox; + --textlock; + + set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); + if (result != NULL && result[0] != NUL) + { + post_balloon(beval, result, NULL); + recursive = FALSE; + return; + } + } + } +#endif +#ifdef FEAT_NETBEANS_INTG + if (bevalServers & BEVAL_NETBEANS) + netbeans_beval_cb(beval, state); +#endif +#ifdef FEAT_SUN_WORKSHOP + if (bevalServers & BEVAL_WORKSHOP) + workshop_beval_cb(beval, state); +#endif + + recursive = FALSE; +} + +#endif + diff --git a/src/beval.h b/src/beval.h new file mode 100644 index 0000000000..d9cf39f645 --- /dev/null +++ b/src/beval.h @@ -0,0 +1,89 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * Visual Workshop integration by Gordon Prieur + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + */ + +#if !defined(BEVAL__H) && (defined(FEAT_BEVAL) || defined(PROTO)) +#define BEVAL__H + +#ifdef FEAT_GUI_GTK +# ifdef USE_GTK3 +# include <gtk/gtk.h> +# else +# include <gtk/gtkwidget.h> +# endif +#else +# if defined(FEAT_GUI_X11) +# include <X11/Intrinsic.h> +# endif +#endif + +typedef enum +{ + ShS_NEUTRAL, /* nothing showing or pending */ + ShS_PENDING, /* data requested from debugger */ + ShS_UPDATE_PENDING, /* switching information displayed */ + ShS_SHOWING /* the balloon is being displayed */ +} BeState; + +typedef struct BalloonEvalStruct +{ +#ifdef FEAT_BEVAL_GUI +# ifdef FEAT_GUI_GTK + GtkWidget *target; /* widget we are monitoring */ + GtkWidget *balloonShell; + GtkWidget *balloonLabel; + unsigned int timerID; /* timer for run */ + BeState showState; /* tells us whats currently going on */ + int x; + int y; + unsigned int state; /* Button/Modifier key state */ +# elif defined(FEAT_GUI_MACVIM) + int x; + int y; +# else +# if !defined(FEAT_GUI_W32) + Widget target; /* widget we are monitoring */ + Widget balloonShell; + Widget balloonLabel; + XtIntervalId timerID; /* timer for run */ + BeState showState; /* tells us whats currently going on */ + XtAppContext appContext; /* used in event handler */ + Position x; + Position y; + Position x_root; + Position y_root; + int state; /* Button/Modifier key state */ +# else + HWND target; + HWND balloon; + int x; + int y; + BeState showState; /* tells us whats currently going on */ +# endif +# endif +# if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32) \ + && !defined(FEAT_GUI_MACVIM) + Dimension screen_width; /* screen width in pixels */ + Dimension screen_height; /* screen height in pixels */ +# endif + void (*msgCB)(struct BalloonEvalStruct *, int); + void *clientData; /* For callback */ +#endif + + int ts; /* tabstop setting for this buffer */ + char_u *msg; +} BalloonEval; + +#define EVAL_OFFSET_X 15 /* displacement of beval topleft corner from pointer */ +#define EVAL_OFFSET_Y 10 + +#ifdef FEAT_BEVAL_GUI +# include "gui_beval.pro" +#endif + +#endif /* BEVAL__H and FEAT_BEVAL_GUI */ diff --git a/src/bigvim.bat b/src/bigvim.bat index ed98626a45..e82eabddd0 100644 --- a/src/bigvim.bat +++ b/src/bigvim.bat @@ -1,5 +1,5 @@ -:: command to build big Vim with OLE, Perl, Python, Ruby and Tcl +:: command to build big Vim with OLE, Lua, Perl, Python, Racket, Ruby and Tcl SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\" SET TOOLDIR=E:\ -%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes PERL=E:\perl514 DYNAMIC_PERL=yes PERL_VER=514 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python32 DYNAMIC_PYTHON3=yes PYTHON3_VER=32 RUBY=%TOOLDIR%ruby192 DYNAMIC_RUBY=yes RUBY_VER=19 RUBY_VER_LONG=1.9.2 TCL=%TOOLDIR%tcl TCL_VER=85 TCL_VER_LONG=8.5 DYNAMIC_TCL=yes %1 IME=yes CSCOPE=yes +%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes LUA=%TOOLDIR%lua53 DYNAMIC_LUA=yes LUA_VER=53 PERL=%TOOLDIR%perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 MZSCHEME=%TOOLDIR%Racket DYNAMIC_MZSCHEME=yes MZSCHEME_VER=3m_a36fs8 RUBY=%TOOLDIR%ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 RUBY_MSVCRT_NAME=msvcrt TCL=%TOOLDIR%ActiveTcl TCL_VER=86 TCL_VER_LONG=8.6 DYNAMIC_TCL=yes TCL_DLL=tcl86t.dll %1 IME=yes CSCOPE=yes DIRECTX=yes diff --git a/src/bigvim64.bat b/src/bigvim64.bat index 6b58fa0d64..8d5fba0f66 100644 --- a/src/bigvim64.bat +++ b/src/bigvim64.bat @@ -1,7 +1,7 @@ -:: command to build big Vim 64 bit with OLE, Perl, Python, Ruby and Tcl +:: command to build big Vim 64 bit with OLE, Perl and Python. :: First run: %VCDIR%\vcvarsall.bat x86_amd64 :: Ruby and Tcl are excluded, doesn't seem to work. SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\" SET TOOLDIR=E:\ -%VCDIR%\bin\nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes PERL=E:\perl514 DYNAMIC_PERL=yes PERL_VER=514 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python32 DYNAMIC_PYTHON3=yes PYTHON3_VER=32 %1 IME=yes CSCOPE=yes +%VCDIR%\bin\nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes PERL=E:\perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 %1 IME=yes CSCOPE=yes diff --git a/src/blowfish.c b/src/blowfish.c index 3d9ba5566a..eaf0b9ed56 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -9,42 +9,62 @@ * Blowfish encryption for Vim; in Blowfish cipher feedback mode. * Contributed by Mohsin Ahmed, http://www.cs.albany.edu/~mosh * Based on http://www.schneier.com/blowfish.html by Bruce Schneier. + * + * There are two variants: + * - The old one "blowfish" has a flaw which makes it much easier to crack the + * key. To see this, make a text file with one line of 1000 "x" characters + * and write it encrypted. Use "xxd" to inspect the bytes in the file. You + * will see that a block of 8 bytes repeats 8 times. + * - The new one "blowfish2" is better. It uses an 8 byte CFB to avoid the + * repeats. */ #include "vim.h" -#if defined(FEAT_CRYPT) +#if defined(FEAT_CRYPT) || defined(PROTO) #define ARRAY_LENGTH(A) (sizeof(A)/sizeof(A[0])) #define BF_BLOCK 8 #define BF_BLOCK_MASK 7 -#define BF_CFB_LEN (8*(BF_BLOCK)) +#define BF_MAX_CFB_LEN (8 * BF_BLOCK) typedef union { UINT32_T ul[2]; char_u uc[8]; } block8; -#if defined(WIN3264) || defined(DOS32) +#if defined(WIN3264) /* MS-Windows is always little endian */ #else # ifdef HAVE_CONFIG_H - /* in configure.in AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */ + /* in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */ # else error! Please change this code to define WORDS_BIGENDIAN for big-endian machines. # endif #endif -static void bf_e_block __ARGS((UINT32_T *p_xl, UINT32_T *p_xr)); -static void bf_e_cblock __ARGS((char_u *block)); -static int bf_check_tables __ARGS((UINT32_T a_ipa[18], UINT32_T a_sbi[4][256], UINT32_T val)); -static int bf_self_test __ARGS((void)); +/* The state of encryption, referenced by cryptstate_T. */ +typedef struct { + UINT32_T pax[18]; /* P-array */ + UINT32_T sbx[4][256]; /* S-boxes */ + int randbyte_offset; + int update_offset; + char_u cfb_buffer[BF_MAX_CFB_LEN]; /* up to 64 bytes used */ + int cfb_len; /* size of cfb_buffer actually used */ +} bf_state_T; + + +static void bf_e_block(bf_state_T *state, UINT32_T *p_xl, UINT32_T *p_xr); +static void bf_e_cblock(bf_state_T *state, char_u *block); +static int bf_check_tables(UINT32_T pax[18], UINT32_T sbx[4][256], UINT32_T val); +static int bf_self_test(void); +static void bf_key_init(bf_state_T *state, char_u *password, char_u *salt, int salt_len); +static void bf_cfb_init(bf_state_T *state, char_u *seed, int seed_len); /* Blowfish code */ -static UINT32_T pax[18]; -static UINT32_T ipa[18] = { +static UINT32_T pax_init[18] = { 0x243f6a88u, 0x85a308d3u, 0x13198a2eu, 0x03707344u, 0xa4093822u, 0x299f31d0u, 0x082efa98u, 0xec4e6c89u, 0x452821e6u, @@ -53,8 +73,7 @@ static UINT32_T ipa[18] = { 0xb5470917u, 0x9216d5d9u, 0x8979fb1bu }; -static UINT32_T sbx[4][256]; -static UINT32_T sbi[4][256] = { +static UINT32_T sbx_init[4][256] = { {0xd1310ba6u, 0x98dfb5acu, 0x2ffd72dbu, 0xd01adfb7u, 0xb8e1afedu, 0x6a267e96u, 0xba7c9045u, 0xf12c7f99u, 0x24a19947u, 0xb3916cf7u, 0x0801f2e2u, 0x858efc16u, @@ -314,33 +333,40 @@ static UINT32_T sbi[4][256] = { } }; - #define F1(i) \ - xl ^= pax[i]; \ - xr ^= ((sbx[0][xl >> 24] + \ - sbx[1][(xl & 0xFF0000) >> 16]) ^ \ - sbx[2][(xl & 0xFF00) >> 8]) + \ - sbx[3][xl & 0xFF]; + xl ^= bfs->pax[i]; \ + xr ^= ((bfs->sbx[0][xl >> 24] + \ + bfs->sbx[1][(xl & 0xFF0000) >> 16]) ^ \ + bfs->sbx[2][(xl & 0xFF00) >> 8]) + \ + bfs->sbx[3][xl & 0xFF]; #define F2(i) \ - xr ^= pax[i]; \ - xl ^= ((sbx[0][xr >> 24] + \ - sbx[1][(xr & 0xFF0000) >> 16]) ^ \ - sbx[2][(xr & 0xFF00) >> 8]) + \ - sbx[3][xr & 0xFF]; - + xr ^= bfs->pax[i]; \ + xl ^= ((bfs->sbx[0][xr >> 24] + \ + bfs->sbx[1][(xr & 0xFF0000) >> 16]) ^ \ + bfs->sbx[2][(xr & 0xFF00) >> 8]) + \ + bfs->sbx[3][xr & 0xFF]; static void -bf_e_block(p_xl, p_xr) - UINT32_T *p_xl; - UINT32_T *p_xr; +bf_e_block( + bf_state_T *bfs, + UINT32_T *p_xl, + UINT32_T *p_xr) { - UINT32_T temp, xl = *p_xl, xr = *p_xr; - - F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7) - F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15) - xl ^= pax[16]; - xr ^= pax[17]; + UINT32_T temp; + UINT32_T xl = *p_xl; + UINT32_T xr = *p_xr; + + F1(0) F2(1) + F1(2) F2(3) + F1(4) F2(5) + F1(6) F2(7) + F1(8) F2(9) + F1(10) F2(11) + F1(12) F2(13) + F1(14) F2(15) + xl ^= bfs->pax[16]; + xr ^= bfs->pax[17]; temp = xl; xl = xr; xr = temp; @@ -348,22 +374,6 @@ bf_e_block(p_xl, p_xr) *p_xr = xr; } -#if 0 /* not used */ - static void -bf_d_block(p_xl, p_xr) - UINT32_T *p_xl; - UINT32_T *p_xr; -{ - UINT32_T temp, xl = *p_xl, xr = *p_xr; - F1(17) F2(16) F1(15) F2(14) F1(13) F2(12) F1(11) F2(10) - F1(9) F2(8) F1(7) F2(6) F1(5) F2(4) F1(3) F2(2) - xl ^= pax[1]; - xr ^= pax[0]; - temp = xl; xl = xr; xr = temp; - *p_xl = xl; *p_xr = xr; -} -#endif - #ifdef WORDS_BIGENDIAN # define htonl2(x) \ @@ -374,43 +384,31 @@ bf_d_block(p_xl, p_xr) #endif static void -bf_e_cblock(block) - char_u *block; +bf_e_cblock( + bf_state_T *bfs, + char_u *block) { block8 bk; memcpy(bk.uc, block, 8); htonl2(bk.ul[0]); htonl2(bk.ul[1]); - bf_e_block(&bk.ul[0], &bk.ul[1]); + bf_e_block(bfs, &bk.ul[0], &bk.ul[1]); htonl2(bk.ul[0]); htonl2(bk.ul[1]); memcpy(block, bk.uc, 8); } -#if 0 /* not used */ - void -bf_d_cblock(block) - char_u *block; -{ - block8 bk; - memcpy(bk.uc, block, 8); - htonl2(bk.ul[0]); htonl2(bk.ul[1]); - bf_d_block(&bk.ul[0], &bk.ul[1]); - htonl2(bk.ul[0]); htonl2(bk.ul[1]); - memcpy(block, bk.uc, 8); -} -#endif - /* * Initialize the crypt method using "password" as the encryption key and * "salt[salt_len]" as the salt. */ - void -bf_key_init(password, salt, salt_len) - char_u *password; - char_u *salt; - int salt_len; + static void +bf_key_init( + bf_state_T *bfs, + char_u *password, + char_u *salt, + int salt_len) { int i, j, keypos = 0; unsigned u; @@ -418,7 +416,7 @@ bf_key_init(password, salt, salt_len) char_u *key; int keylen; - /* Process the key 1000 times. + /* Process the key 1001 times. * See http://en.wikipedia.org/wiki/Key_strengthening. */ key = sha256_key(password, salt, salt_len); for (i = 0; i < 1000; i++) @@ -428,7 +426,7 @@ bf_key_init(password, salt, salt_len) keylen = (int)STRLEN(key) / 2; if (keylen == 0) { - EMSG(_("E831: bf_key_init() called with empty password")); + IEMSG(_("E831: bf_key_init() called with empty password")); return; } for (i = 0; i < keylen; i++) @@ -437,52 +435,54 @@ bf_key_init(password, salt, salt_len) key[i] = u; } - mch_memmove(sbx, sbi, 4 * 4 * 256); + /* Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of + * Blowfish. */ + mch_memmove(bfs->sbx, sbx_init, 4 * 4 * 256); for (i = 0; i < 18; ++i) { val = 0; for (j = 0; j < 4; ++j) val = (val << 8) | key[keypos++ % keylen]; - pax[i] = ipa[i] ^ val; + bfs->pax[i] = pax_init[i] ^ val; } data_l = data_r = 0; for (i = 0; i < 18; i += 2) { - bf_e_block(&data_l, &data_r); - pax[i + 0] = data_l; - pax[i + 1] = data_r; + bf_e_block(bfs, &data_l, &data_r); + bfs->pax[i + 0] = data_l; + bfs->pax[i + 1] = data_r; } for (i = 0; i < 4; ++i) { for (j = 0; j < 256; j += 2) { - bf_e_block(&data_l, &data_r); - sbx[i][j + 0] = data_l; - sbx[i][j + 1] = data_r; + bf_e_block(bfs, &data_l, &data_r); + bfs->sbx[i][j + 0] = data_l; + bfs->sbx[i][j + 1] = data_r; } } } /* - * BF Self test for corrupted tables or instructions + * Blowfish self-test for corrupted tables or instructions. */ static int -bf_check_tables(a_ipa, a_sbi, val) - UINT32_T a_ipa[18]; - UINT32_T a_sbi[4][256]; - UINT32_T val; +bf_check_tables( + UINT32_T pax[18], + UINT32_T sbx[4][256], + UINT32_T val) { int i, j; UINT32_T c = 0; for (i = 0; i < 18; i++) - c ^= a_ipa[i]; + c ^= pax[i]; for (i = 0; i < 4; i++) for (j = 0; j < 256; j++) - c ^= a_sbi[i][j]; + c ^= sbx[i][j]; return c == val; } @@ -514,12 +514,16 @@ static struct_bf_test_data bf_test_data[] = { * Return FAIL when there is something wrong with blowfish encryption. */ static int -bf_self_test() +bf_self_test(void) { int i, bn; int err = 0; block8 bk; UINT32_T ui = 0xffffffffUL; + bf_state_T state; + + vim_memset(&state, 0, sizeof(bf_state_T)); + state.cfb_len = BF_MAX_CFB_LEN; /* We can't simply use sizeof(UINT32_T), it would generate a compiler * warning. */ @@ -528,21 +532,21 @@ bf_self_test() EMSG(_("E820: sizeof(uint32_t) != 4")); } - if (!bf_check_tables(ipa, sbi, 0x6ffa520a)) + if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) err++; bn = ARRAY_LENGTH(bf_test_data); for (i = 0; i < bn; i++) { - bf_key_init((char_u *)(bf_test_data[i].password), + bf_key_init(&state, (char_u *)(bf_test_data[i].password), bf_test_data[i].salt, (int)STRLEN(bf_test_data[i].salt)); - if (!bf_check_tables(pax, sbx, bf_test_data[i].keysum)) + if (!bf_check_tables(state.pax, state.sbx, bf_test_data[i].keysum)) err++; /* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */ memcpy(bk.uc, bf_test_data[i].plaintxt, 8); - bf_e_cblock(bk.uc); + bf_e_cblock(&state, bk.uc); if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) { if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) @@ -554,43 +558,43 @@ bf_self_test() return err > 0 ? FAIL : OK; } -/* Cipher feedback mode. */ -static int randbyte_offset = 0; -static int update_offset = 0; -static char_u cfb_buffer[BF_CFB_LEN]; /* 64 bytes */ +/* + * CFB: Cipher Feedback Mode. + */ /* - * Initialize with seed "iv[iv_len]". + * Initialize with seed "seed[seed_len]". */ - void -bf_cfb_init(iv, iv_len) - char_u *iv; - int iv_len; + static void +bf_cfb_init( + bf_state_T *bfs, + char_u *seed, + int seed_len) { int i, mi; - randbyte_offset = update_offset = 0; - vim_memset(cfb_buffer, 0, BF_CFB_LEN); - if (iv_len > 0) + bfs->randbyte_offset = bfs->update_offset = 0; + vim_memset(bfs->cfb_buffer, 0, bfs->cfb_len); + if (seed_len > 0) { - mi = iv_len > BF_CFB_LEN ? iv_len : BF_CFB_LEN; + mi = seed_len > bfs->cfb_len ? seed_len : bfs->cfb_len; for (i = 0; i < mi; i++) - cfb_buffer[i % BF_CFB_LEN] ^= iv[i % iv_len]; + bfs->cfb_buffer[i % bfs->cfb_len] ^= seed[i % seed_len]; } } -#define BF_CFB_UPDATE(c) { \ - cfb_buffer[update_offset] ^= (char_u)c; \ - if (++update_offset == BF_CFB_LEN) \ - update_offset = 0; \ +#define BF_CFB_UPDATE(bfs, c) { \ + bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \ + if (++bfs->update_offset == bfs->cfb_len) \ + bfs->update_offset = 0; \ } -#define BF_RANBYTE(t) { \ - if ((randbyte_offset & BF_BLOCK_MASK) == 0) \ - bf_e_cblock(&cfb_buffer[randbyte_offset]); \ - t = cfb_buffer[randbyte_offset]; \ - if (++randbyte_offset == BF_CFB_LEN) \ - randbyte_offset = 0; \ +#define BF_RANBYTE(bfs, t) { \ + if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \ + bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \ + t = bfs->cfb_buffer[bfs->randbyte_offset]; \ + if (++bfs->randbyte_offset == bfs->cfb_len) \ + bfs->randbyte_offset = 0; \ } /* @@ -598,90 +602,69 @@ bf_cfb_init(iv, iv_len) * "from" and "to" can be equal to encrypt in place. */ void -bf_crypt_encode(from, len, to) - char_u *from; - size_t len; - char_u *to; +crypt_blowfish_encode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) { + bf_state_T *bfs = state->method_state; size_t i; int ztemp, t; for (i = 0; i < len; ++i) { ztemp = from[i]; - BF_RANBYTE(t); - BF_CFB_UPDATE(ztemp); + BF_RANBYTE(bfs, t); + BF_CFB_UPDATE(bfs, ztemp); to[i] = t ^ ztemp; } } /* - * Decrypt "ptr[len]" in place. + * Decrypt "from[len]" into "to[len]". */ void -bf_crypt_decode(ptr, len) - char_u *ptr; - long len; +crypt_blowfish_decode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) { - char_u *p; + bf_state_T *bfs = state->method_state; + size_t i; int t; - for (p = ptr; p < ptr + len; ++p) + for (i = 0; i < len; ++i) { - BF_RANBYTE(t); - *p ^= t; - BF_CFB_UPDATE(*p); + BF_RANBYTE(bfs, t); + to[i] = from[i] ^ t; + BF_CFB_UPDATE(bfs, to[i]); } } -/* - * Initialize the encryption keys and the random header according to - * the given password. - */ void -bf_crypt_init_keys(passwd) - char_u *passwd; /* password string with which to modify keys */ +crypt_blowfish_init( + cryptstate_T *state, + char_u* key, + char_u* salt, + int salt_len, + char_u* seed, + int seed_len) { - char_u *p; + bf_state_T *bfs = (bf_state_T *)alloc_clear(sizeof(bf_state_T)); - for (p = passwd; *p != NUL; ++p) - { - BF_CFB_UPDATE(*p); - } -} + state->method_state = bfs; -static int save_randbyte_offset; -static int save_update_offset; -static char_u save_cfb_buffer[BF_CFB_LEN]; -static UINT32_T save_pax[18]; -static UINT32_T save_sbx[4][256]; + /* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8 + * times. "blowfish2" uses a 8 byte buffer to avoid repeating. */ + bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK; -/* - * Save the current crypt state. Can only be used once before - * bf_crypt_restore(). - */ - void -bf_crypt_save() -{ - save_randbyte_offset = randbyte_offset; - save_update_offset = update_offset; - mch_memmove(save_cfb_buffer, cfb_buffer, BF_CFB_LEN); - mch_memmove(save_pax, pax, 4 * 18); - mch_memmove(save_sbx, sbx, 4 * 4 * 256); -} + if (blowfish_self_test() == FAIL) + return; -/* - * Restore the current crypt state. Can only be used after - * bf_crypt_save(). - */ - void -bf_crypt_restore() -{ - randbyte_offset = save_randbyte_offset; - update_offset = save_update_offset; - mch_memmove(cfb_buffer, save_cfb_buffer, BF_CFB_LEN); - mch_memmove(pax, save_pax, 4 * 18); - mch_memmove(sbx, save_sbx, 4 * 4 * 256); + bf_key_init(bfs, key, salt, salt_len); + bf_cfb_init(bfs, seed, seed_len); } /* @@ -689,7 +672,7 @@ bf_crypt_restore() * Give an error and return FAIL when not. */ int -blowfish_self_test() +blowfish_self_test(void) { if (sha256_self_test() == FAIL) { diff --git a/src/buffer.c b/src/buffer.c index 03ddb5fd9c..c8862d92a3 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -27,27 +27,23 @@ #include "vim.h" -#if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) -static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf)); -# define HAVE_BUFLIST_MATCH -static char_u *fname_match __ARGS((regprog_T *prog, char_u *name)); -#endif -static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options)); -static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer)); +static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, int ignore_case); +static char_u *fname_match(regmatch_T *rmp, char_u *name, int ignore_case); +static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options); #ifdef UNIX -static buf_T *buflist_findname_stat __ARGS((char_u *ffname, struct stat *st)); -static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp)); -static int buf_same_ino __ARGS((buf_T *buf, struct stat *stp)); +static buf_T *buflist_findname_stat(char_u *ffname, stat_T *st); +static int otherfile_buf(buf_T *buf, char_u *ffname, stat_T *stp); +static int buf_same_ino(buf_T *buf, stat_T *stp); #else -static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname)); +static int otherfile_buf(buf_T *buf, char_u *ffname); #endif #ifdef FEAT_TITLE -static int ti_change __ARGS((char_u *str, char_u **last)); +static int value_changed(char_u *str, char_u **last); #endif -static int append_arg_number __ARGS((win_T *wp, char_u *buf, int buflen, int add_file)); -static void free_buffer __ARGS((buf_T *)); -static void free_buffer_stuff __ARGS((buf_T *buf, int free_options)); -static void clear_wininfo __ARGS((buf_T *buf)); +static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file); +static void free_buffer(buf_T *); +static void free_buffer_stuff(buf_T *buf, int free_options); +static void clear_wininfo(buf_T *buf); #ifdef UNIX # define dev_T dev_t @@ -56,16 +52,76 @@ static void clear_wininfo __ARGS((buf_T *buf)); #endif #if defined(FEAT_SIGNS) -static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr)); +static void insert_sign(buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr); #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) static char *msg_loclist = N_("[Location List]"); static char *msg_qflist = N_("[Quickfix List]"); #endif -#ifdef FEAT_AUTOCMD static char *e_auabort = N_("E855: Autocommands caused command to abort"); + +/* Number of times free_buffer() was called. */ +static int buf_free_count = 0; + +/* Read data from buffer for retrying. */ + static int +read_buffer( + int read_stdin, /* read file from stdin, otherwise fifo */ + exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */ + int flags) /* extra flags for readfile() */ +{ + int retval = OK; + linenr_T line_count; + + /* + * Read from the buffer which the text is already filled in and append at + * the end. This makes it possible to retry when 'fileformat' or + * 'fileencoding' was guessed wrong. + */ + line_count = curbuf->b_ml.ml_line_count; + retval = readfile( + read_stdin ? NULL : curbuf->b_ffname, + read_stdin ? NULL : curbuf->b_fname, + (linenr_T)line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap, + flags | READ_BUFFER); + if (retval == OK) + { + /* Delete the binary lines. */ + while (--line_count >= 0) + ml_delete((linenr_T)1, FALSE); + } + else + { + /* Delete the converted lines. */ + while (curbuf->b_ml.ml_line_count > line_count) + ml_delete(line_count, FALSE); + } + /* Put the cursor on the first line. */ + curwin->w_cursor.lnum = 1; + curwin->w_cursor.col = 0; + + if (read_stdin) + { + /* Set or reset 'modified' before executing autocommands, so that + * it can be changed there. */ + if (!readonlymode && !BUFEMPTY()) + changed(); + else if (retval == OK) + unchanged(curbuf, FALSE); + + if (retval == OK) + { +#ifdef FEAT_EVAL + apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, + curbuf, &retval); +#else + apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf); #endif + } + } + return retval; +} /* * Open current buffer, that is: open the memfile and read the file into @@ -73,18 +129,17 @@ static char *e_auabort = N_("E855: Autocommands caused command to abort"); * Return FAIL for failure, OK otherwise. */ int -open_buffer(read_stdin, eap, flags) - int read_stdin; /* read file from stdin */ - exarg_T *eap; /* for forced 'ff' and 'fenc' or NULL */ - int flags; /* extra flags for readfile() */ +open_buffer( + int read_stdin, /* read file from stdin */ + exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */ + int flags) /* extra flags for readfile() */ { int retval = OK; -#ifdef FEAT_AUTOCMD - buf_T *old_curbuf; -#endif + bufref_T old_curbuf; #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; #endif + int read_fifo = FALSE; /* * The 'readonly' flag is only set when BF_NEVERLOADED is being reset. @@ -102,7 +157,7 @@ open_buffer(read_stdin, eap, flags) * If we can't create one for the current buffer, take another buffer */ close_buffer(NULL, curbuf, 0, FALSE); - for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) + FOR_ALL_BUFFERS(curbuf) if (curbuf->b_ml.ml_mfp != NULL) break; /* @@ -123,12 +178,10 @@ open_buffer(read_stdin, eap, flags) return FAIL; } -#ifdef FEAT_AUTOCMD /* The autocommands in readfile() may change the buffer, but only AFTER * reading the file. */ - old_curbuf = curbuf; + set_bufref(&old_curbuf, curbuf); modified_was_set = FALSE; -#endif /* mark cursor position as being invalid */ curwin->w_valid = 0; @@ -139,25 +192,57 @@ open_buffer(read_stdin, eap, flags) #endif ) { + int old_msg_silent = msg_silent; +#ifdef UNIX + int save_bin = curbuf->b_p_bin; + int perm; +#endif #ifdef FEAT_NETBEANS_INTG int oldFire = netbeansFireChanges; netbeansFireChanges = 0; #endif +#ifdef UNIX + perm = mch_getperm(curbuf->b_ffname); + if (perm >= 0 && (0 +# ifdef S_ISFIFO + || S_ISFIFO(perm) +# endif +# ifdef S_ISSOCK + || S_ISSOCK(perm) +# endif +# ifdef OPEN_CHR_FILES + || (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname)) +# endif + )) + read_fifo = TRUE; + if (read_fifo) + curbuf->b_p_bin = TRUE; +#endif + if (shortmess(SHM_FILEINFO)) + msg_silent = 1; retval = readfile(curbuf->b_ffname, curbuf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_NEW); + flags | READ_NEW | (read_fifo ? READ_FIFO : 0)); +#ifdef UNIX + if (read_fifo) + { + curbuf->b_p_bin = save_bin; + if (retval == OK) + retval = read_buffer(FALSE, eap, flags); + } +#endif + msg_silent = old_msg_silent; #ifdef FEAT_NETBEANS_INTG netbeansFireChanges = oldFire; #endif /* Help buffer is filtered. */ - if (curbuf->b_help) + if (bt_help(curbuf)) fix_help_buffer(); } else if (read_stdin) { - int save_bin = curbuf->b_p_bin; - linenr_T line_count; + int save_bin = curbuf->b_p_bin; /* * First read the text in binary mode into the buffer. @@ -171,42 +256,7 @@ open_buffer(read_stdin, eap, flags) flags | (READ_NEW + READ_STDIN)); curbuf->b_p_bin = save_bin; if (retval == OK) - { - line_count = curbuf->b_ml.ml_line_count; - retval = readfile(NULL, NULL, (linenr_T)line_count, - (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_BUFFER); - if (retval == OK) - { - /* Delete the binary lines. */ - while (--line_count >= 0) - ml_delete((linenr_T)1, FALSE); - } - else - { - /* Delete the converted lines. */ - while (curbuf->b_ml.ml_line_count > line_count) - ml_delete(line_count, FALSE); - } - /* Put the cursor on the first line. */ - curwin->w_cursor.lnum = 1; - curwin->w_cursor.col = 0; - - /* Set or reset 'modified' before executing autocommands, so that - * it can be changed there. */ - if (!readonlymode && !bufempty()) - changed(); - else if (retval != FAIL) - unchanged(curbuf, FALSE); -#ifdef FEAT_AUTOCMD -# ifdef FEAT_EVAL - apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, - curbuf, &retval); -# else - apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf); -# endif -#endif - } + retval = read_buffer(TRUE, eap, flags); } /* if first time loading this buffer, init b_chartab[] */ @@ -227,18 +277,23 @@ open_buffer(read_stdin, eap, flags) * the changed flag. Unless in readonly mode: "ls | gview -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) -#ifdef FEAT_AUTOCMD || modified_was_set /* ":set modified" used in autocmd */ -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) -# endif #endif ) changed(); - else if (retval != FAIL && !read_stdin) + else if (retval == OK && !read_stdin && !read_fifo) unchanged(curbuf, FALSE); save_file_ff(curbuf); /* keep this fileformat */ + /* Set last_changedtick to avoid triggering a TextChanged autocommand right + * after it was added. */ + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); +#ifdef FEAT_INS_EXPAND + curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); +#endif + /* require "!" to overwrite the file, because it wasn't read completely */ #ifdef FEAT_EVAL if (aborting()) @@ -253,71 +308,142 @@ open_buffer(read_stdin, eap, flags) foldUpdateAll(curwin); #endif -#ifdef FEAT_AUTOCMD /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF curwin->w_topfill = 0; -# endif +#endif } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); -# else +#else apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -# endif #endif - if (retval != FAIL) + if (retval == OK) { -#ifdef FEAT_AUTOCMD /* * The autocommands may have changed the current buffer. Apply the * modelines to the correct buffer, if it still exists and is loaded. */ - if (buf_valid(old_curbuf) && old_curbuf->b_ml.ml_mfp != NULL) + if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->b_ml.ml_mfp != NULL) { aco_save_T aco; /* Go to the buffer that was opened. */ - aucmd_prepbuf(&aco, old_curbuf); -#endif + aucmd_prepbuf(&aco, old_curbuf.br_buf); do_modelines(0); + + /* specified ff and enc, bin in modelines */ + if (file_ff_differs(curbuf, TRUE)) + { + /* reload buffer */ + if (eap) + { + /* restore ++ff and ++enc, ++bin if specified */ +#ifdef FEAT_MBYTE + if (eap->force_enc) + { + char_u *fenc = enc_canonize(eap->cmd + eap->force_enc); + if (fenc) { + vim_free(curbuf->b_p_fenc); + curbuf->b_p_fenc = fenc; + } + } +#endif + if (eap->force_ff) + set_fileformat(eap->force_ff, OPT_LOCAL); + if (eap->force_bin) + curbuf->b_p_bin = eap->force_bin; + } + buf_reload(curbuf, curbuf->b_orig_mode); + } curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); -#ifdef FEAT_AUTOCMD -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, - &retval); -# else + &retval); +#else apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); -# endif +#endif /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); } -#endif } return retval; } +/* + * Store "buf" in "bufref" and set the free count. + */ + void +set_bufref(bufref_T *bufref, buf_T *buf) +{ + bufref->br_buf = buf; + bufref->br_fnum = buf == NULL ? 0 : buf->b_fnum; + bufref->br_buf_free_count = buf_free_count; +} + +/* + * Return TRUE if "bufref->br_buf" points to the same buffer as when + * set_bufref() was called and it is a valid buffer. + * Only goes through the buffer list if buf_free_count changed. + * Also checks if b_fnum is still the same, a :bwipe followed by :new might get + * the same allocated memory, but it's a different buffer. + */ + int +bufref_valid(bufref_T *bufref) +{ + return bufref->br_buf_free_count == buf_free_count + ? TRUE : buf_valid(bufref->br_buf) + && bufref->br_fnum == bufref->br_buf->b_fnum; +} + /* * Return TRUE if "buf" points to a valid buffer (in the buffer list). + * This can be slow if there are many buffers, prefer using bufref_valid(). */ int -buf_valid(buf) - buf_T *buf; +buf_valid(buf_T *buf) { buf_T *bp; - for (bp = firstbuf; bp != NULL; bp = bp->b_next) + /* Assume that we more often have a recent buffer, start with the last + * one. */ + for (bp = lastbuf; bp != NULL; bp = bp->b_prev) if (bp == buf) return TRUE; return FALSE; } +/* + * A hash table used to quickly lookup a buffer by its number. + */ +static hashtab_T buf_hashtab; + + static void +buf_hashtab_add(buf_T *buf) +{ + sprintf((char *)buf->b_key, "%x", buf->b_fnum); + if (hash_add(&buf_hashtab, buf->b_key) == FAIL) + EMSG(_("E931: Buffer cannot be registered")); +} + + static void +buf_hashtab_remove(buf_T *buf) +{ + hashitem_T *hi = hash_find(&buf_hashtab, buf->b_key); + + if (!HASHITEM_EMPTY(hi)) + hash_remove(&buf_hashtab, hi); +} + +static char *e_buflocked = N_("E937: Attempt to delete a buffer that is in use"); + /* * Close the link to a buffer. * "action" is used when there is no longer a window for the buffer. @@ -336,21 +462,22 @@ buf_valid(buf) * supposed to close the window but autocommands close all other windows. */ void -close_buffer(win, buf, action, abort_if_last) - win_T *win; /* if not NULL, set b_last_cursor */ - buf_T *buf; - int action; - int abort_if_last UNUSED; +close_buffer( + win_T *win, /* if not NULL, set b_last_cursor */ + buf_T *buf, + int action, + int abort_if_last UNUSED) { -#ifdef FEAT_AUTOCMD int is_curbuf; int nwindows; -#endif + bufref_T bufref; + int is_curwin = (curwin != NULL && curwin->w_buffer == buf); + win_T *the_curwin = curwin; + tabpage_T *the_curtab = curtab; int unload_buf = (action != 0); int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int wipe_buf = (action == DOBUF_WIPE); -#ifdef FEAT_QUICKFIX /* * Force unloading or deleting when 'bufhidden' says so. * The caller must take care of NOT deleting/freeing when 'bufhidden' is @@ -369,13 +496,49 @@ close_buffer(win, buf, action, abort_if_last) } else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */ unload_buf = TRUE; -#endif - if (win != NULL -#ifdef FEAT_WINDOWS - && win_valid(win) /* in case autocommands closed the window */ +#ifdef FEAT_TERMINAL + if (bt_terminal(buf) && (buf->b_nwindows == 1 || del_buf)) + { + if (term_job_running(buf->b_term)) + { + if (wipe_buf || unload_buf) + { + if (buf->b_locked) + { + EMSG(_(e_buflocked)); + return; + } + /* Wiping out or unloading a terminal buffer kills the job. */ + free_terminal(buf); + } + else + { + /* The job keeps running, hide the buffer. */ + del_buf = FALSE; + unload_buf = FALSE; + } + } + else + { + /* A terminal buffer is wiped out if the job has finished. */ + del_buf = TRUE; + unload_buf = TRUE; + wipe_buf = TRUE; + } + } #endif - ) + + /* Disallow deleting the buffer when it is locked (already being closed or + * halfway a command that relies on it). Unloading is allowed. */ + if (buf->b_locked > 0 && (del_buf || wipe_buf)) + { + EMSG(_(e_buflocked)); + return; + } + + /* check no autocommands closed the window */ + if (win != NULL && 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. @@ -388,21 +551,22 @@ close_buffer(win, buf, action, abort_if_last) win->w_cursor.col, TRUE); } -#ifdef FEAT_AUTOCMD + set_bufref(&bufref, buf); + /* When the buffer is no longer in a window, trigger BufWinLeave */ if (buf->b_nwindows == 1) { - buf->b_closing = TRUE; - apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, - FALSE, buf); - if (!buf_valid(buf)) + ++buf->b_locked; + if (apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, + FALSE, buf) + && !bufref_valid(&bufref)) { /* Autocommands deleted the buffer. */ aucmd_abort: EMSG(_(e_auabort)); return; } - buf->b_closing = FALSE; + --buf->b_locked; if (abort_if_last && one_window()) /* Autocommands made this the only window. */ goto aucmd_abort; @@ -411,29 +575,44 @@ close_buffer(win, buf, action, abort_if_last) * BufHidden */ if (!unload_buf) { - buf->b_closing = TRUE; - apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, - FALSE, buf); - if (!buf_valid(buf)) + ++buf->b_locked; + if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, + FALSE, buf) + && !bufref_valid(&bufref)) /* Autocommands deleted the buffer. */ goto aucmd_abort; - buf->b_closing = FALSE; + --buf->b_locked; if (abort_if_last && one_window()) /* Autocommands made this the only window. */ goto aucmd_abort; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif +#endif } + + /* 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(); + } + nwindows = buf->b_nwindows; -#endif /* decrease the link count from windows (unless not in any window) */ if (buf->b_nwindows > 0) --buf->b_nwindows; +#ifdef FEAT_DIFF + if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0) + diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */ +#endif + /* Return when a window is displaying the buffer or when it's not * unloaded. */ if (buf->b_nwindows > 0 || !unload_buf) @@ -443,40 +622,33 @@ close_buffer(win, buf, action, abort_if_last) if (buf->b_ffname == NULL) del_buf = TRUE; + /* When closing the current buffer stop Visual mode before freeing + * anything. */ + if (buf == curbuf && VIsual_active +#if defined(EXITFREE) + && !entered_free_all_mem +#endif + ) + end_visual_mode(); + /* * Free all things allocated for this buffer. * Also calls the "BufDelete" autocommands when del_buf is TRUE. */ -#ifdef FEAT_AUTOCMD /* Remember if we are closing the current buffer. Restore the number of * windows, so that autocommands in buf_freeall() don't get confused. */ is_curbuf = (buf == curbuf); buf->b_nwindows = nwindows; -#endif buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - if ( -#ifdef FEAT_WINDOWS - win_valid(win) && -#else - win != NULL && -#endif - win->w_buffer == buf) - win->w_buffer = NULL; /* make sure we don't use the buffer now */ -#ifdef FEAT_AUTOCMD /* Autocommands may have deleted the buffer. */ - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) return; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif - - /* Autocommands may have opened or closed windows for this buffer. - * Decrement the count for the close we do here. */ - if (buf->b_nwindows > 0) - --buf->b_nwindows; +#endif /* * It's possible that autocommands change curbuf to the one being deleted. @@ -487,15 +659,19 @@ close_buffer(win, buf, action, abort_if_last) */ if (buf == curbuf && !is_curbuf) return; -#endif + + if (win_valid_any_tab(win) && win->w_buffer == buf) + win->w_buffer = NULL; /* make sure we don't use the buffer now */ + + /* Autocommands may have opened or closed windows for this buffer. + * Decrement the count for the close we do here. */ + if (buf->b_nwindows > 0) + --buf->b_nwindows; #ifdef FEAT_ODB_EDITOR odb_buffer_close(buf); #endif - /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR - /* * Remove the buffer from the list. */ @@ -542,14 +718,11 @@ close_buffer(win, buf, action, abort_if_last) * Make buffer not contain a file. */ void -buf_clear_file(buf) - buf_T *buf; +buf_clear_file(buf_T *buf) { buf->b_ml.ml_line_count = 1; unchanged(buf, TRUE); -#ifndef SHORT_FNAME buf->b_shortname = FALSE; -#endif buf->b_p_eol = TRUE; buf->b_start_eol = TRUE; #ifdef FEAT_MBYTE @@ -565,41 +738,64 @@ buf_clear_file(buf) /* * buf_freeall() - free all things allocated for a buffer that are related to - * the file. flags: + * the file. Careful: get here with "curwin" NULL when exiting. + * 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, flags) - buf_T *buf; - int flags; +buf_freeall(buf_T *buf, int flags) { -#ifdef FEAT_AUTOCMD int is_curbuf = (buf == curbuf); - - 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 */ - return; + bufref_T bufref; + 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_locked; + set_bufref(&bufref, buf); + if (buf->b_ml.ml_mfp != NULL) + { + if (apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, + FALSE, buf) + && !bufref_valid(&bufref)) + /* autocommands deleted the buffer */ + return; + } if ((flags & BFA_DEL) && buf->b_p_bl) { - apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf); - if (!buf_valid(buf)) /* autocommands may delete the buffer */ + if (apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, + FALSE, buf) + && !bufref_valid(&bufref)) + /* autocommands deleted the buffer */ return; } if (flags & BFA_WIPE) { - apply_autocmds(EVENT_BUFWIPEOUT, buf->b_fname, buf->b_fname, - FALSE, buf); - if (!buf_valid(buf)) /* autocommands may delete the buffer */ + if (apply_autocmds(EVENT_BUFWIPEOUT, buf->b_fname, buf->b_fname, + FALSE, buf) + && !bufref_valid(&bufref)) + /* autocommands deleted the buffer */ return; } - buf->b_closing = FALSE; -# ifdef FEAT_EVAL + --buf->b_locked; + + /* 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(); + } + +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif +#endif /* * It's possible that autocommands change curbuf to the one being deleted. @@ -609,19 +805,17 @@ buf_freeall(buf, flags) */ if (buf == curbuf && !is_curbuf) return; -#endif #ifdef FEAT_DIFF diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ #endif #ifdef FEAT_SYN_HL /* Remove any ownsyntax, unless exiting. */ - if (firstwin != NULL && curwin->w_buffer == buf) + if (curwin != NULL && curwin->w_buffer == buf) reset_synblock(curwin); #endif #ifdef FEAT_FOLDING /* No folds in an empty buffer. */ -# ifdef FEAT_WINDOWS { win_T *win; tabpage_T *tp; @@ -630,10 +824,6 @@ buf_freeall(buf, flags) if (win->w_buffer == buf) clearFolding(win); } -# else - if (curwin->w_buffer == buf) - clearFolding(curwin); -# endif #endif #ifdef FEAT_TCL @@ -657,11 +847,13 @@ buf_freeall(buf, flags) * itself (not the file, that must have been done already). */ static void -free_buffer(buf) - buf_T *buf; +free_buffer(buf_T *buf) { + ++buf_free_count; free_buffer_stuff(buf, TRUE); #ifdef FEAT_EVAL + /* b:changedtick uses an item in buf_T, remove it now */ + dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di); unref_var_dict(buf->b_vars); #endif #ifdef FEAT_LUA @@ -682,8 +874,21 @@ free_buffer(buf) #ifdef FEAT_RUBY ruby_buffer_free(buf); #endif -#ifdef FEAT_AUTOCMD +#ifdef FEAT_JOB_CHANNEL + channel_buffer_free(buf); +#endif +#ifdef FEAT_TERMINAL + free_terminal(buf); +#endif +#ifdef FEAT_JOB_CHANNEL + vim_free(buf->b_prompt_text); + free_callback(buf->b_prompt_callback, buf->b_prompt_partial); +#endif + + buf_hashtab_remove(buf); + aubuflocal_remove(buf); + if (autocmd_busy) { /* Do not free the buffer structure while autocommands are executing, @@ -692,17 +897,35 @@ free_buffer(buf) au_pending_free_buf = buf; } else -#endif vim_free(buf); } +/* + * Initializes b:changedtick. + */ + static void +init_changedtick(buf_T *buf) +{ + dictitem_T *di = (dictitem_T *)&buf->b_ct_di; + + di->di_flags = DI_FLAGS_FIX | DI_FLAGS_RO; + di->di_tv.v_type = VAR_NUMBER; + di->di_tv.v_lock = VAR_FIXED; + di->di_tv.vval.v_number = 0; + +#ifdef FEAT_EVAL + STRCPY(buf->b_ct_di.di_key, "changedtick"); + (void)dict_add(buf->b_vars, di); +#endif +} + /* * Free stuff in the buffer for ":bdel" and when wiping out the buffer. */ static void -free_buffer_stuff(buf, free_options) - buf_T *buf; - int free_options; /* free options as well */ +free_buffer_stuff( + buf_T *buf, + int free_options) /* free options as well */ { if (free_options) { @@ -713,8 +936,14 @@ free_buffer_stuff(buf, free_options) #endif } #ifdef FEAT_EVAL - vars_clear(&buf->b_vars->dv_hashtab); /* free all internal variables */ - hash_init(&buf->b_vars->dv_hashtab); + { + varnumber_T tick = CHANGEDTICK(buf); + + vars_clear(&buf->b_vars->dv_hashtab); /* free all buffer variables */ + hash_init(&buf->b_vars->dv_hashtab); + init_changedtick(buf); + CHANGEDTICK(buf) = tick; + } #endif #ifdef FEAT_USR_CMDS uc_clear(&buf->b_ucmds); /* clear local user commands */ @@ -730,8 +959,7 @@ free_buffer_stuff(buf, free_options) map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ #endif #ifdef FEAT_MBYTE - vim_free(buf->b_start_fenc); - buf->b_start_fenc = NULL; + VIM_CLEAR(buf->b_start_fenc); #endif } @@ -739,8 +967,7 @@ free_buffer_stuff(buf, free_options) * Free the b_wininfo list for buffer "buf". */ static void -clear_wininfo(buf) - buf_T *buf; +clear_wininfo(buf_T *buf) { wininfo_T *wip; @@ -759,51 +986,51 @@ clear_wininfo(buf) } } -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * Go to another buffer. Handles the result of the ATTENTION dialog. */ void -goto_buffer(eap, start, dir, count) - exarg_T *eap; - int start; - int dir; - int count; +goto_buffer( + exarg_T *eap, + int start, + int dir, + int count) { -# if defined(FEAT_WINDOWS) && defined(HAS_SWAP_EXISTS_ACTION) - buf_T *old_curbuf = curbuf; +#if defined(HAS_SWAP_EXISTS_ACTION) + bufref_T old_curbuf; + + set_bufref(&old_curbuf, curbuf); swap_exists_action = SEA_DIALOG; -# endif +#endif (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, start, dir, count, eap->forceit); -# if defined(FEAT_WINDOWS) && defined(HAS_SWAP_EXISTS_ACTION) +#if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a window. */ enter_cleanup(&cs); -# endif +# endif /* Quitting means closing the split window, nothing else. */ win_close(curwin, TRUE); swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); -# endif +# endif } else - handle_swap_exists(old_curbuf); -# endif -} + handle_swap_exists(&old_curbuf); #endif +} #if defined(HAS_SWAP_EXISTS_ACTION) || defined(PROTO) /* @@ -811,19 +1038,19 @@ goto_buffer(eap, start, dir, count) * It is allowed for "old_curbuf" to be NULL or invalid. */ void -handle_swap_exists(old_curbuf) - buf_T *old_curbuf; +handle_swap_exists(bufref_T *old_curbuf) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; # endif -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; -#endif +# endif + buf_T *buf; if (swap_exists_action == SEA_QUIT) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); @@ -835,19 +1062,22 @@ handle_swap_exists(old_curbuf) 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) + if (old_curbuf == NULL || !bufref_valid(old_curbuf) + || old_curbuf->br_buf == curbuf) + buf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED); + else + buf = old_curbuf->br_buf; + if (buf != NULL) { - enter_buffer(old_curbuf); -#ifdef FEAT_SYN_HL + enter_buffer(buf); +# ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) check_colorcolumn(curwin); -#endif +# endif } /* If "old_curbuf" is NULL we are in big trouble here... */ -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); @@ -855,7 +1085,7 @@ handle_swap_exists(old_curbuf) } else if (swap_exists_action == SEA_RECOVER) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); @@ -868,7 +1098,7 @@ handle_swap_exists(old_curbuf) cmdline_row = msg_row; do_modelines(0); -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); @@ -878,7 +1108,6 @@ handle_swap_exists(old_curbuf) } #endif -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * do_bufdel() - delete or unload buffer(s) * @@ -893,13 +1122,13 @@ handle_swap_exists(old_curbuf) * Returns error message or NULL */ char_u * -do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit) - int command; - char_u *arg; /* pointer to extra arguments */ - int addr_count; - int start_bnr; /* first buffer number in a range */ - int end_bnr; /* buffer nr or last buffer nr in a range */ - int forceit; +do_bufdel( + int command, + char_u *arg, /* pointer to extra arguments */ + int addr_count, + int start_bnr, /* first buffer number in a range */ + int end_bnr, /* buffer nr or last buffer nr in a range */ + int forceit) { int do_current = 0; /* delete current buffer? */ int deleted = 0; /* number of buffers deleted */ @@ -1005,25 +1234,22 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit) return errormsg; } -#endif /* FEAT_LISTCMDS */ -#if defined(FEAT_LISTCMDS) || defined(FEAT_PYTHON) \ - || defined(FEAT_PYTHON3) || defined(PROTO) - -static int empty_curbuf __ARGS((int close_others, int forceit, int action)); +static int empty_curbuf(int close_others, int forceit, int action); /* * Make the current buffer empty. * Used when it is wiped out and it's the last buffer. */ static int -empty_curbuf(close_others, forceit, action) - int close_others; - int forceit; - int action; +empty_curbuf( + int close_others, + int forceit, + int action) { int retval; buf_T *buf = curbuf; + bufref_T bufref; if (action == DOBUF_UNLOAD) { @@ -1031,13 +1257,10 @@ empty_curbuf(close_others, forceit, action) return FAIL; } + set_bufref(&bufref, buf); if (close_others) - { /* Close any other windows on this buffer, then make it empty. */ -#ifdef FEAT_WINDOWS close_windows(buf, TRUE); -#endif - } setpcmark(); retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, @@ -1048,7 +1271,7 @@ empty_curbuf(close_others, forceit, action) * the old one. But do_ecmd() may have done that already, check * if the buffer still exists. */ - if (buf != curbuf && buf_valid(buf) && buf->b_nwindows == 0) + if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows == 0) close_buffer(NULL, buf, action, FALSE); if (!close_others) need_fileinfo = FALSE; @@ -1071,12 +1294,12 @@ empty_curbuf(close_others, forceit, action) * Return FAIL or OK. */ int -do_buffer(action, start, dir, count, forceit) - int action; - int start; - int dir; /* FORWARD or BACKWARD */ - int count; /* buffer number or number of buffers */ - int forceit; /* TRUE for :...! */ +do_buffer( + int action, + int start, + int dir, /* FORWARD or BACKWARD */ + int count, /* buffer number or number of buffers */ + int forceit) /* TRUE for :...! */ { buf_T *buf; buf_T *bp; @@ -1154,7 +1377,7 @@ do_buffer(action, start, dir, count, forceit) { /* don't warn when deleting */ if (!unload) - EMSGN(_("E86: Buffer %ld does not exist"), count); + EMSGN(_(e_nobufnr), count); } else if (dir == FORWARD) EMSG(_("E87: Cannot go beyond last buffer")); @@ -1167,13 +1390,21 @@ do_buffer(action, start, dir, count, forceit) need_mouse_correct = TRUE; #endif -#ifdef FEAT_LISTCMDS /* * delete buffer buf from memory and/or the list */ if (unload) { int forward; + bufref_T bufref; + + if (buf->b_locked) + { + EMSG(_(e_buflocked)); + return FAIL; + } + + set_bufref(&bufref, buf); /* When unloading or deleting a buffer that's already unloaded and * unlisted: fail silently. */ @@ -1186,12 +1417,10 @@ do_buffer(action, start, dir, count, forceit) if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); -# ifdef FEAT_AUTOCMD - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed * now. */ return FAIL; -# endif /* If it's still changed fail silently, the dialog already * mentioned why it fails. */ if (bufIsChanged(buf)) @@ -1206,43 +1435,41 @@ do_buffer(action, start, dir, count, forceit) } } + /* When closing the current buffer stop Visual mode. */ + if (buf == curbuf && VIsual_active) + end_visual_mode(); + /* * If deleting the last (listed) buffer, make it empty. * The last (listed) buffer cannot be unloaded. */ - for (bp = firstbuf; bp != NULL; bp = bp->b_next) + FOR_ALL_BUFFERS(bp) if (bp->b_p_bl && bp != buf) break; if (bp == NULL && buf == curbuf) return empty_curbuf(TRUE, forceit, action); -#ifdef FEAT_WINDOWS /* * If the deleted buffer is the current one, close the current window * (unless it's the only window). Repeat this so long as we end up in * a window with this buffer. */ while (buf == curbuf -# ifdef FEAT_AUTOCMD - && !(curwin->w_closing || curwin->w_buffer->b_closing) -# endif - && (firstwin != lastwin || first_tabpage->tp_next != NULL)) + && !(curwin->w_closing || curwin->w_buffer->b_locked > 0) + && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) { if (win_close(curwin, FALSE) == FAIL) break; } -#endif /* * If the buffer to be deleted is not the current one, delete it here. */ if (buf != curbuf) { -#ifdef FEAT_WINDOWS close_windows(buf, FALSE); -#endif - if (buf != curbuf && buf_valid(buf) && buf->b_nwindows <= 0) - close_buffer(NULL, buf, action, FALSE); + if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows <= 0) + close_buffer(NULL, buf, action, FALSE); return OK; } @@ -1250,7 +1477,7 @@ do_buffer(action, start, dir, count, forceit) * Deleting the current buffer: Need to find another buffer to go to. * There should be another, otherwise it would have been handled * above. However, autocommands may have deleted all buffers. - * First use au_new_curbuf, if it is valid. + * First use au_new_curbuf.br_buf, if it is valid. * Then prefer the buffer we most recently visited. * Else try to find one that is loaded, after the current buffer, * then before the current buffer. @@ -1258,15 +1485,10 @@ do_buffer(action, start, dir, count, forceit) */ buf = NULL; /* selected buffer */ bp = NULL; /* used when no loaded buffer found */ -#ifdef FEAT_AUTOCMD - if (au_new_curbuf != NULL && buf_valid(au_new_curbuf)) - buf = au_new_curbuf; -# ifdef FEAT_JUMPLIST - else -# endif -#endif + if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf)) + buf = au_new_curbuf.br_buf; #ifdef FEAT_JUMPLIST - if (curwin->w_jumplistlen > 0) + else if (curwin->w_jumplistlen > 0) { int jumpidx; @@ -1335,7 +1557,7 @@ do_buffer(action, start, dir, count, forceit) buf = bp; if (buf == NULL) /* No loaded buffer, find listed one */ { - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_p_bl && buf != curbuf) break; } @@ -1360,7 +1582,6 @@ do_buffer(action, start, dir, count, forceit) */ if (action == DOBUF_SPLIT) /* split window first */ { -# ifdef FEAT_WINDOWS /* If 'switchbuf' contains "useopen": jump to first window containing * "buf" if one exists */ if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf)) @@ -1370,10 +1591,8 @@ do_buffer(action, start, dir, count, forceit) if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf)) return OK; if (win_split(0, 0) == FAIL) -# endif return FAIL; } -#endif /* go to current buffer - nothing to do */ if (buf == curbuf) @@ -1387,17 +1606,18 @@ do_buffer(action, start, dir, count, forceit) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { + bufref_T bufref; + + set_bufref(&bufref, buf); dialog_changed(curbuf, FALSE); -# ifdef FEAT_AUTOCMD - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! */ return FAIL; -# endif } if (bufIsChanged(curbuf)) #endif { - EMSG(_(e_nowrtmsg)); + no_write_message(); return FAIL; } } @@ -1405,22 +1625,18 @@ do_buffer(action, start, dir, count, forceit) /* Go to the other buffer. */ set_curbuf(buf, action); -#if defined(FEAT_LISTCMDS) \ - && (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND)) if (action == DOBUF_SPLIT) { RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */ } -#endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif return OK; } -#endif /* * Set current buffer to "buf". Executes autocommands and closes current @@ -1432,9 +1648,7 @@ do_buffer(action, start, dir, count, forceit) * DOBUF_WIPE wipe it out */ void -set_curbuf(buf, action) - buf_T *buf; - int action; +set_curbuf(buf_T *buf, int action) { buf_T *prevbuf; int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL @@ -1442,6 +1656,8 @@ set_curbuf(buf, action) #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; #endif + bufref_T newbufref; + bufref_T prevbufref; setpcmark(); if (!cmdmod.keepalt) @@ -1451,61 +1667,54 @@ set_curbuf(buf, action) /* Don't restart Select mode after switching to another buffer. */ VIsual_reselect = FALSE; - /* close_windows() or apply_autocmds() may change curbuf */ + /* close_windows() or apply_autocmds() may change curbuf and wipe out "buf" + */ prevbuf = curbuf; - -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL - if (buf_valid(prevbuf) && !aborting()) -# else - if (buf_valid(prevbuf)) -# endif + set_bufref(&prevbufref, prevbuf); + set_bufref(&newbufref, buf); + + /* Autocommands may delete the curren buffer and/or the buffer we wan to go + * to. In those cases don't close the buffer. */ + if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) + || (bufref_valid(&prevbufref) + && bufref_valid(&newbufref) +#ifdef FEAT_EVAL + && !aborting() #endif + )) { #ifdef FEAT_SYN_HL if (prevbuf == curwin->w_buffer) reset_synblock(curwin); #endif -#ifdef FEAT_WINDOWS if (unload) close_windows(prevbuf, FALSE); -#endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) - if (buf_valid(prevbuf) && !aborting()) +#if defined(FEAT_EVAL) + if (bufref_valid(&prevbufref) && !aborting()) #else - if (buf_valid(prevbuf)) + if (bufref_valid(&prevbufref)) #endif { -#ifdef FEAT_WINDOWS win_T *previouswin = curwin; -#endif if (prevbuf == curbuf) u_sync(FALSE); close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf, unload ? action : (action == DOBUF_GOTO - && !P_HID(prevbuf) + && !buf_hide(prevbuf) && !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE); -#ifdef FEAT_WINDOWS if (curwin != previouswin && win_valid(previouswin)) /* autocommands changed curwin, Grr! */ curwin = previouswin; -#endif } } -#ifdef FEAT_AUTOCMD /* An autocommand may have deleted "buf", already entered it (e.g., when - * it did ":bunload") or aborted the script processing! + * it did ":bunload") or aborted the script processing. * If curwin->w_buffer is null, enter_buffer() will make it valid again */ if ((buf_valid(buf) && buf != curbuf -# ifdef FEAT_EVAL - && !aborting() -# endif -# ifdef FEAT_WINDOWS - ) || curwin->w_buffer == NULL -# endif - ) +#ifdef FEAT_EVAL + && !aborting() #endif + ) || curwin->w_buffer == NULL) { enter_buffer(buf); #ifdef FEAT_SYN_HL @@ -1521,8 +1730,7 @@ set_curbuf(buf, action) * be pointing to freed memory. */ void -enter_buffer(buf) - buf_T *buf; +enter_buffer(buf_T *buf) { /* Copy buffer and window local option values. Not for a help buffer. */ buf_copy_options(buf, BCO_ENTER | BCO_NOHELP); @@ -1546,7 +1754,7 @@ enter_buffer(buf) #endif #ifdef FEAT_SYN_HL - curwin->w_s = &(buf->b_s); + curwin->w_s = &(curbuf->b_s); #endif /* Cursor on first line by default. */ @@ -1556,9 +1764,7 @@ enter_buffer(buf) curwin->w_cursor.coladd = 0; #endif curwin->w_set_curswant = TRUE; -#ifdef FEAT_AUTOCMD curwin->w_topline_was_set = FALSE; -#endif /* mark cursor position as being invalid */ curwin->w_valid = 0; @@ -1566,13 +1772,11 @@ enter_buffer(buf) /* Make sure the buffer is loaded. */ if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ { -#ifdef FEAT_AUTOCMD /* If there is no filetype, allow for detecting one. Esp. useful for * ":ball" used in a autocommand. If there already is a filetype we * might prefer to keep it. */ if (*curbuf->b_p_ft == NUL) did_filetype = FALSE; -#endif open_buffer(FALSE, NULL, 0); } @@ -1581,14 +1785,12 @@ enter_buffer(buf) if (!msg_silent) need_fileinfo = TRUE; /* display file info after redraw */ (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */ -#ifdef FEAT_AUTOCMD curwin->w_topline = 1; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF curwin->w_topfill = 0; -# endif +#endif apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); -#endif } /* If autocommands did not change the cursor position, restore cursor lnum @@ -1600,10 +1802,8 @@ enter_buffer(buf) #ifdef FEAT_TITLE maketitle(); #endif -#ifdef FEAT_AUTOCMD /* when autocmds didn't change it */ if (curwin->w_topline == 1 && !curwin->w_topline_was_set) -#endif scroll_cursor_halfway(FALSE); /* redisplay at correct position */ #ifdef FEAT_NETBEANS_INTG @@ -1612,7 +1812,7 @@ enter_buffer(buf) #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; #ifdef FEAT_KEYMAP if (curbuf->b_kmap_state & KEYMAP_INIT) @@ -1624,6 +1824,9 @@ enter_buffer(buf) if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) (void)did_set_spelllang(curwin); #endif +#ifdef FEAT_VIMINFO + curbuf->b_last_used = vim_time(); +#endif redraw_later(NOT_VALID); } @@ -1631,19 +1834,60 @@ enter_buffer(buf) #if defined(FEAT_AUTOCHDIR) || defined(PROTO) /* * Change to the directory of the current buffer. + * Don't do this while still starting up. */ void -do_autochdir() +do_autochdir(void) { - if (curbuf->b_ffname != NULL && vim_chdirfile(curbuf->b_ffname) == OK) + if ((starting == 0 || test_autochdir) + && curbuf->b_ffname != NULL + && vim_chdirfile(curbuf->b_ffname, "auto") == OK) shorten_fnames(TRUE); } #endif + void +no_write_message(void) +{ +#ifdef FEAT_TERMINAL + if (term_job_running(curbuf->b_term)) + EMSG(_("E948: Job still running (add ! to end the job)")); + else +#endif + EMSG(_("E37: No write since last change (add ! to override)")); +} + + void +no_write_message_nobang(buf_T *buf UNUSED) +{ +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + EMSG(_("E948: Job still running")); + else +#endif + EMSG(_("E37: No write since last change")); +} + /* * functions for dealing with the buffer list */ +static int top_file_num = 1; /* highest file number */ + +/* + * Return TRUE if the current buffer is empty, unnamed, unmodified and used in + * only one window. That means it can be re-used. + */ + int +curbuf_reusable(void) +{ + return (curbuf != NULL + && curbuf->b_ffname == NULL + && curbuf->b_nwindows <= 1 + && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()) + && !curbufIsChanged()); +} + /* * 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. @@ -1651,22 +1895,26 @@ do_autochdir() * 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. + * If (flags & BLN_NOOPT) is TRUE, don't copy options from the current buffer + * if the buffer already exists. * This is the ONLY way to create a new buffer. */ -static int top_file_num = 1; /* highest file number */ - buf_T * -buflist_new(ffname, sfname, lnum, flags) - 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 */ +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 */ { buf_T *buf; #ifdef UNIX - struct stat st; + stat_T st; #endif + if (top_file_num == 1) + hash_init(&buf_hashtab); + fname_expand(curbuf, &ffname, &sfname); /* will allocate ffname */ /* @@ -1678,7 +1926,7 @@ buflist_new(ffname, sfname, lnum, flags) if (sfname == NULL || mch_stat((char *)sfname, &st) < 0) st.st_dev = (dev_T)-1; #endif - if (ffname != NULL && !(flags & BLN_DUMMY) && (buf = + if (ffname != NULL && !(flags & (BLN_DUMMY | BLN_NEW)) && (buf = #ifdef UNIX buflist_findname_stat(ffname, &st) #else @@ -1689,20 +1937,24 @@ buflist_new(ffname, sfname, lnum, flags) vim_free(ffname); if (lnum != 0) buflist_setfpos(buf, curwin, lnum, (colnr_T)0, FALSE); - /* copy the options now, if 'cpo' doesn't have 's' and not done - * already */ - buf_copy_options(buf, 0); + + if ((flags & BLN_NOOPT) == 0) + /* copy the options now, if 'cpo' doesn't have 's' and not done + * already */ + buf_copy_options(buf, 0); + if ((flags & BLN_LISTED) && !buf->b_p_bl) { + bufref_T bufref; + buf->b_p_bl = TRUE; -#ifdef FEAT_AUTOCMD + set_bufref(&bufref, buf); if (!(flags & BLN_DUMMY)) { - apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf); - if (!buf_valid(buf)) + if (apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf) + && !bufref_valid(&bufref)) return NULL; } -#endif } return buf; } @@ -1716,35 +1968,25 @@ buflist_new(ffname, sfname, lnum, flags) * buffer.) */ buf = NULL; - if ((flags & BLN_CURBUF) - && curbuf != NULL - && curbuf->b_ffname == NULL - && curbuf->b_nwindows <= 1 - && (curbuf->b_ml.ml_mfp == NULL || bufempty())) + if ((flags & BLN_CURBUF) && curbuf_reusable()) { buf = curbuf; -#ifdef FEAT_AUTOCMD /* It's like this buffer is deleted. Watch out for autocommands that * change curbuf! If that happens, allocate a new buffer anyway. */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; -# endif #endif -#ifdef FEAT_QUICKFIX -# ifdef FEAT_AUTOCMD if (buf == curbuf) -# endif { /* Make sure 'bufhidden' and 'buftype' are empty */ clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); } -#endif } if (buf != curbuf || curbuf == NULL) { @@ -1765,6 +2007,7 @@ buflist_new(ffname, sfname, lnum, flags) } init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE); #endif + init_changedtick(buf); } if (ffname != NULL) @@ -1779,10 +2022,8 @@ buflist_new(ffname, sfname, lnum, flags) if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) || buf->b_wininfo == NULL) { - vim_free(buf->b_ffname); - buf->b_ffname = NULL; - vim_free(buf->b_sfname); - buf->b_sfname = NULL; + VIM_CLEAR(buf->b_ffname); + VIM_CLEAR(buf->b_sfname); if (buf != curbuf) free_buffer(buf); return NULL; @@ -1794,11 +2035,10 @@ buflist_new(ffname, sfname, lnum, flags) buf_freeall(buf, 0); if (buf != curbuf) /* autocommands deleted the buffer! */ return NULL; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return NULL; #endif - /* buf->b_nwindows = 0; why was this here? */ free_buffer_stuff(buf, FALSE); /* delete local variables et al. */ /* Init the options. */ @@ -1839,6 +2079,7 @@ buflist_new(ffname, sfname, lnum, flags) } top_file_num = 1; } + buf_hashtab_add(buf); /* * Always copy the options from the current buffer. @@ -1873,24 +2114,28 @@ buflist_new(ffname, sfname, lnum, flags) clrallmarks(buf); /* clear marks */ fmarks_check_names(buf); /* check file marks for this file */ buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ -#ifdef FEAT_AUTOCMD if (!(flags & BLN_DUMMY)) { - apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf); - if (!buf_valid(buf)) + bufref_T bufref; + + /* Tricky: these autocommands may change the buffer list. They could + * also split the window with re-using the one empty buffer. This may + * result in unexpectedly losing the empty buffer. */ + set_bufref(&bufref, buf); + if (apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf) + && !bufref_valid(&bufref)) return NULL; if (flags & BLN_LISTED) { - apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf); - if (!buf_valid(buf)) + if (apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf) + && !bufref_valid(&bufref)) return NULL; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; -# endif - } #endif + } return buf; } @@ -1901,9 +2146,9 @@ buflist_new(ffname, sfname, lnum, flags) * 'fileencoding'. */ void -free_buf_options(buf, free_p_ff) - buf_T *buf; - int free_p_ff; +free_buf_options( + buf_T *buf, + int free_p_ff) { if (free_p_ff) { @@ -1911,10 +2156,8 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_fenc); #endif clear_string_option(&buf->b_p_ff); -#ifdef FEAT_QUICKFIX clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); -#endif } #ifdef FEAT_FIND_ID clear_string_option(&buf->b_p_def); @@ -1933,6 +2176,7 @@ free_buf_options(buf, free_p_ff) #if defined(FEAT_CRYPT) clear_string_option(&buf->b_p_cm); #endif + clear_string_option(&buf->b_p_fp); #if defined(FEAT_EVAL) clear_string_option(&buf->b_p_fex); #endif @@ -1946,6 +2190,7 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_isk); #ifdef FEAT_KEYMAP clear_string_option(&buf->b_p_keymap); + keymap_clear(&buf->b_kmap_ga); ga_clear(&buf->b_kmap_ga); #endif #ifdef FEAT_COMMENTS @@ -1957,6 +2202,7 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_nf); #ifdef FEAT_SYN_HL clear_string_option(&buf->b_p_syn); + clear_string_option(&buf->b_s.b_syn_isk); #endif #ifdef FEAT_SPELL clear_string_option(&buf->b_s.b_p_spc); @@ -1968,9 +2214,7 @@ free_buf_options(buf, free_p_ff) #ifdef FEAT_SEARCHPATH clear_string_option(&buf->b_p_sua); #endif -#ifdef FEAT_AUTOCMD clear_string_option(&buf->b_p_ft); -#endif #ifdef FEAT_CINDENT clear_string_option(&buf->b_p_cink); clear_string_option(&buf->b_p_cino); @@ -1993,6 +2237,7 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_ep); clear_string_option(&buf->b_p_path); clear_string_option(&buf->b_p_tags); + clear_string_option(&buf->b_p_tc); #ifdef FEAT_INS_EXPAND clear_string_option(&buf->b_p_dict); clear_string_option(&buf->b_p_tsr); @@ -2004,30 +2249,32 @@ free_buf_options(buf, free_p_ff) buf->b_p_ul = NO_LOCAL_UNDOLEVEL; #ifdef FEAT_LISP clear_string_option(&buf->b_p_lw); +#endif + clear_string_option(&buf->b_p_bkc); +#ifdef FEAT_MBYTE + clear_string_option(&buf->b_p_menc); #endif } /* - * get alternate file n - * set linenr to lnum or altfpos.lnum if lnum == 0 - * also set cursor column to altfpos.col if 'startofline' is not set. + * Get alternate file "n". + * Set linenr to "lnum" or altfpos.lnum if "lnum" == 0. + * Also set cursor column to altfpos.col if 'startofline' is not set. * if (options & GETF_SETMARK) call setpcmark() * if (options & GETF_ALT) we are jumping to an alternate file. * if (options & GETF_SWITCH) respect 'switchbuf' settings when jumping * - * return FAIL for failure, OK for success + * Return FAIL for failure, OK for success. */ int -buflist_getfile(n, lnum, options, forceit) - int n; - linenr_T lnum; - int options; - int forceit; +buflist_getfile( + int n, + linenr_T lnum, + int options, + int forceit) { buf_T *buf; -#ifdef FEAT_WINDOWS win_T *wp = NULL; -#endif pos_T *fpos; colnr_T col; @@ -2050,10 +2297,8 @@ buflist_getfile(n, lnum, options, forceit) text_locked_msg(); return FAIL; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return FAIL; -#endif /* altfpos may be changed by getfile(), get it now */ if (lnum == 0) @@ -2065,33 +2310,35 @@ buflist_getfile(n, lnum, options, forceit) else col = 0; -#ifdef FEAT_WINDOWS if (options & GETF_SWITCH) { /* If 'switchbuf' contains "useopen": jump to first window containing * "buf" if one exists */ if (swb_flags & SWB_USEOPEN) wp = buf_jump_open_win(buf); + /* If 'switchbuf' contains "usetab": jump to first window in any tab * page containing "buf" if one exists */ if (wp == NULL && (swb_flags & SWB_USETAB)) wp = buf_jump_open_tab(buf); - /* If 'switchbuf' contains "split" or "newtab" and the current buffer - * isn't empty: open new window */ - if (wp == NULL && (swb_flags & (SWB_SPLIT | SWB_NEWTAB)) && !bufempty()) + + /* If 'switchbuf' contains "split", "vsplit" or "newtab" and the + * current buffer isn't empty: open new tab or window */ + if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB)) + && !BUFEMPTY()) { - if (swb_flags & SWB_NEWTAB) /* Open in a new tab */ + if (swb_flags & SWB_NEWTAB) tabpage_new(); - else if (win_split(0, 0) == FAIL) /* Open in a new window */ + else if (win_split(0, (swb_flags & SWB_VSPLIT) ? WSP_VERT : 0) + == FAIL) return FAIL; RESET_BINDING(curwin); } } -#endif ++RedrawingDisabled; - if (getfile(buf->b_fnum, NULL, NULL, (options & GETF_SETMARK), - lnum, forceit) <= 0) + if (GETFILE_SUCCESS(getfile(buf->b_fnum, NULL, NULL, + (options & GETF_SETMARK), lnum, forceit))) { --RedrawingDisabled; @@ -2115,7 +2362,7 @@ buflist_getfile(n, lnum, options, forceit) * go to the last know line number for the current buffer */ void -buflist_getfpos() +buflist_getfpos(void) { pos_T *fpos; @@ -2143,8 +2390,7 @@ buflist_getfpos() * Returns NULL if not found. */ buf_T * -buflist_findname_exp(fname) - char_u *fname; +buflist_findname_exp(char_u *fname) { char_u *ffname; buf_T *buf = NULL; @@ -2173,11 +2419,10 @@ buflist_findname_exp(fname) * Returns NULL if not found. */ buf_T * -buflist_findname(ffname) - char_u *ffname; +buflist_findname(char_u *ffname) { #ifdef UNIX - struct stat st; + stat_T st; if (mch_stat((char *)ffname, &st) < 0) st.st_dev = (dev_T)-1; @@ -2190,14 +2435,15 @@ buflist_findname(ffname) * Returns NULL if not found. */ static buf_T * -buflist_findname_stat(ffname, stp) - char_u *ffname; - struct stat *stp; +buflist_findname_stat( + char_u *ffname, + stat_T *stp) { #endif buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + /* Start at the last buffer, expect to find a match sooner. */ + for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname #ifdef UNIX , stp @@ -2207,23 +2453,20 @@ buflist_findname_stat(ffname, stp) return NULL; } -#if defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) \ - || defined(PROTO) /* * Find file in buffer list by a regexp pattern. * Return fnum of the found buffer. * Return < 0 for error. */ int -buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) - char_u *pattern; - char_u *pattern_end; /* pointer to first char after pattern */ - int unlisted; /* find unlisted buffers */ - int diffmode UNUSED; /* find diff-mode buffers only */ - int curtab_only; /* find buffers in current tab only */ +buflist_findpat( + char_u *pattern, + char_u *pattern_end, /* pointer to first char after pattern */ + int unlisted, /* find unlisted buffers */ + int diffmode UNUSED, /* find diff-mode buffers only */ + int curtab_only) /* find buffers in current tab only */ { buf_T *buf; - regprog_T *prog; int match = -1; int find_listed; char_u *pat; @@ -2268,42 +2511,39 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) { for (attempt = 0; attempt <= 3; ++attempt) { + regmatch_T regmatch; + /* may add '^' and '$' */ if (toggledollar) *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */ p = pat; if (*p == '^' && !(attempt & 1)) /* add/remove '^' */ ++p; - prog = vim_regcomp(p, p_magic ? RE_MAGIC : 0); - if (prog == NULL) + regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0); + if (regmatch.regprog == NULL) { vim_free(pat); return -1; } - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if (buf->b_p_bl == find_listed #ifdef FEAT_DIFF && (!diffmode || diff_mode_buf(buf)) #endif - && buflist_match(prog, buf) != NULL) + && buflist_match(®match, buf, FALSE) != NULL) { if (curtab_only) { /* Ignore the match if the buffer is not open in * the current tab. */ -#ifdef FEAT_WINDOWS win_T *wp; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_buffer == buf) break; if (wp == NULL) continue; -#else - if (curwin->w_buffer != buf) - continue; -#endif } if (match >= 0) /* already found a match */ { @@ -2313,7 +2553,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) match = buf->b_fnum; /* remember first match */ } - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (match >= 0) /* found one match */ break; } @@ -2334,7 +2574,6 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) EMSG2(_("E94: No matching buffer for %s"), pattern); return match; } -#endif #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -2344,18 +2583,17 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) * Return OK if matches found, FAIL otherwise. */ int -ExpandBufnames(pat, num_file, file, options) - char_u *pat; - int *num_file; - char_u ***file; - int options; +ExpandBufnames( + char_u *pat, + int *num_file, + char_u ***file, + int options) { int count = 0; buf_T *buf; int round; char_u *p; int attempt; - regprog_T *prog; char_u *patc; *num_file = 0; /* return values in case of FAIL */ @@ -2379,10 +2617,12 @@ ExpandBufnames(pat, num_file, file, options) */ for (attempt = 0; attempt <= 1; ++attempt) { + regmatch_T regmatch; + if (attempt > 0 && patc == pat) break; /* there was no anchor, no need to try again */ - prog = vim_regcomp(patc + attempt * 11, RE_MAGIC); - if (prog == NULL) + regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC); + if (regmatch.regprog == NULL) { if (patc != pat) vim_free(patc); @@ -2396,11 +2636,11 @@ ExpandBufnames(pat, num_file, file, options) for (round = 1; round <= 2; ++round) { count = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (!buf->b_p_bl) /* skip unlisted buffers */ continue; - p = buflist_match(prog, buf); + p = buflist_match(®match, buf, p_wic); if (p != NULL) { if (round == 1) @@ -2422,14 +2662,14 @@ ExpandBufnames(pat, num_file, file, options) *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *))); if (*file == NULL) { - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (patc != pat) vim_free(patc); return FAIL; } } } - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (count) /* match(es) found, break here */ break; } @@ -2443,21 +2683,21 @@ ExpandBufnames(pat, num_file, file, options) #endif /* FEAT_CMDL_COMPL */ -#ifdef HAVE_BUFLIST_MATCH /* * Check for a match on the file name for buffer "buf" with regprog "prog". */ static char_u * -buflist_match(prog, buf) - regprog_T *prog; - buf_T *buf; +buflist_match( + regmatch_T *rmp, + buf_T *buf, + int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match; /* First try the short file name, then the long file name. */ - match = fname_match(prog, buf->b_sfname); + match = fname_match(rmp, buf->b_sfname, ignore_case); if (match == NULL) - match = fname_match(prog, buf->b_ffname); + match = fname_match(rmp, buf->b_ffname, ignore_case); return match; } @@ -2467,25 +2707,25 @@ buflist_match(prog, buf) * Return "name" when there is a match, NULL when not. */ static char_u * -fname_match(prog, name) - regprog_T *prog; - char_u *name; +fname_match( + regmatch_T *rmp, + char_u *name, + int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match = NULL; char_u *p; - regmatch_T regmatch; if (name != NULL) { - regmatch.regprog = prog; - regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */ - if (vim_regexec(®match, name, (colnr_T)0)) + /* Ignore case when 'fileignorecase' or the argument is set. */ + rmp->rm_ic = p_fic || ignore_case; + if (vim_regexec(rmp, name, (colnr_T)0)) match = name; else { /* Replace $(HOME) with '~' and try matching again. */ p = home_replace_save(NULL, name); - if (p != NULL && vim_regexec(®match, p, (colnr_T)0)) + if (p != NULL && vim_regexec(rmp, p, (colnr_T)0)) match = name; vim_free(p); } @@ -2493,22 +2733,24 @@ fname_match(prog, name) return match; } -#endif /* - * find file in buffer list by number + * Find a file in the buffer list by buffer number. */ buf_T * -buflist_findnr(nr) - int nr; +buflist_findnr(int nr) { - buf_T *buf; + char_u key[VIM_SIZEOF_INT * 2 + 1]; + hashitem_T *hi; if (nr == 0) nr = curwin->w_alt_fnum; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_fnum == nr) - return (buf); + sprintf((char *)key, "%x", nr); + hi = hash_find(&buf_hashtab, key); + + if (!HASHITEM_EMPTY(hi)) + return (buf_T *)(hi->hi_key + - ((unsigned)(curbuf->b_key - (char_u *)curbuf))); return NULL; } @@ -2519,10 +2761,10 @@ buflist_findnr(nr) * Returns a pointer to allocated memory, of NULL when failed. */ char_u * -buflist_nr2name(n, fullname, helptail) - int n; - int fullname; - int helptail; /* for help buffers return tail only */ +buflist_nr2name( + int n, + int fullname, + int helptail) /* for help buffers return tail only */ { buf_T *buf; @@ -2539,12 +2781,12 @@ buflist_nr2name(n, fullname, helptail) * When "lnum" is 0 only do the options. */ static void -buflist_setfpos(buf, win, lnum, col, copy_options) - buf_T *buf; - win_T *win; - linenr_T lnum; - colnr_T col; - int copy_options; +buflist_setfpos( + buf_T *buf, + win_T *win, + linenr_T lnum, + colnr_T col, + int copy_options) { wininfo_T *wip; @@ -2605,21 +2847,20 @@ buflist_setfpos(buf, win, lnum, col, copy_options) } #ifdef FEAT_DIFF -static int wininfo_other_tab_diff __ARGS((wininfo_T *wip)); +static int wininfo_other_tab_diff(wininfo_T *wip); /* * Return TRUE when "wip" has 'diff' set and the diff is only for another tab * page. That's because a diff is local to a tab page. */ static int -wininfo_other_tab_diff(wip) - wininfo_T *wip; +wininfo_other_tab_diff(wininfo_T *wip) { win_T *wp; if (wip->wi_opt.wo_diff) { - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) /* return FALSE when it's a window in the current tab page, thus * the buffer was in diff mode here */ if (wip->wi_win == wp) @@ -2638,9 +2879,9 @@ wininfo_other_tab_diff(wip) * Returns NULL when there isn't any info. */ static wininfo_T * -find_wininfo(buf, skip_diff_buffer) - buf_T *buf; - int skip_diff_buffer UNUSED; +find_wininfo( + buf_T *buf, + int skip_diff_buffer UNUSED) { wininfo_T *wip; @@ -2677,8 +2918,7 @@ find_wininfo(buf, skip_diff_buffer) * global values for the window. */ void -get_winopts(buf) - buf_T *buf; +get_winopts(buf_T *buf) { wininfo_T *wip; @@ -2688,8 +2928,23 @@ get_winopts(buf) #endif wip = find_wininfo(buf, TRUE); - if (wip != NULL && wip->wi_optset) + if (wip != NULL && wip->wi_win != NULL + && wip->wi_win != curwin && wip->wi_win->w_buffer == buf) + { + /* The buffer is currently displayed in the window: use the actual + * option values instead of the saved (possibly outdated) values. */ + win_T *wp = wip->wi_win; + + copy_winopt(&wp->w_onebuf_opt, &curwin->w_onebuf_opt); +#ifdef FEAT_FOLDING + curwin->w_fold_manual = wp->w_fold_manual; + curwin->w_foldinvalid = TRUE; + cloneFoldGrowArray(&wp->w_folds, &curwin->w_folds); +#endif + } + else if (wip != NULL && wip->wi_optset) { + /* the buffer was displayed in the current window earlier */ copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt); #ifdef FEAT_FOLDING curwin->w_fold_manual = wip->wi_fold_manual; @@ -2716,8 +2971,7 @@ get_winopts(buf) * Returns a pointer to no_position if no position is found. */ pos_T * -buflist_findfpos(buf) - buf_T *buf; +buflist_findfpos(buf_T *buf) { wininfo_T *wip; static pos_T no_position = INIT_POS_T(1, 0, 0); @@ -2733,35 +2987,83 @@ buflist_findfpos(buf) * Find the lnum for the buffer 'buf' for the current window. */ linenr_T -buflist_findlnum(buf) - buf_T *buf; +buflist_findlnum(buf_T *buf) { return buflist_findfpos(buf)->lnum; } -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* - * List all know file names (for :files and :buffers command). + * List all known file names (for :files and :buffers command). */ void -buflist_list(eap) - exarg_T *eap; +buflist_list(exarg_T *eap) { buf_T *buf; int len; int i; + int ro_char; + int changed_char; +#ifdef FEAT_TERMINAL + int job_running; + int job_none_open; +#endif for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) { +#ifdef FEAT_TERMINAL + job_running = term_job_running(buf->b_term); + job_none_open = job_running && term_none_open(buf->b_term); +#endif /* skip unlisted buffers, unless ! was used */ - if (!buf->b_p_bl && !eap->forceit) + if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) + || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) + || (vim_strchr(eap->arg, '+') + && ((buf->b_flags & BF_READERR) || !bufIsChanged(buf))) + || (vim_strchr(eap->arg, 'a') + && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) + || (vim_strchr(eap->arg, 'h') + && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) +#ifdef FEAT_TERMINAL + || (vim_strchr(eap->arg, 'R') + && (!job_running || (job_running && job_none_open))) + || (vim_strchr(eap->arg, '?') + && (!job_running || (job_running && !job_none_open))) + || (vim_strchr(eap->arg, 'F') + && (job_running || buf->b_term == NULL)) +#endif + || (vim_strchr(eap->arg, '-') && buf->b_p_ma) + || (vim_strchr(eap->arg, '=') && !buf->b_p_ro) + || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) + || (vim_strchr(eap->arg, '%') && buf != curbuf) + || (vim_strchr(eap->arg, '#') + && (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) continue; - msg_putchar('\n'); if (buf_spname(buf) != NULL) vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); else home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); + if (message_filtered(NameBuff)) + continue; + + changed_char = (buf->b_flags & BF_READERR) ? 'x' + : (bufIsChanged(buf) ? '+' : ' '); +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + { + if (term_none_open(buf->b_term)) + ro_char = '?'; + else + ro_char = 'R'; + changed_char = ' '; /* bufIsChanged() returns TRUE to avoid + * closing, but it's not actually changed. */ + } + else if (buf->b_term != NULL) + ro_char = 'F'; + else +#endif + ro_char = !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '); + msg_putchar('\n'); len = vim_snprintf((char *)IObuff, IOSIZE - 20, "%3d%c%c%c%c%c \"%s\"", buf->b_fnum, buf->b_p_bl ? ' ' : 'u', @@ -2769,10 +3071,11 @@ buflist_list(eap) (curwin->w_alt_fnum == buf->b_fnum ? '#' : ' '), buf->b_ml.ml_mfp == NULL ? ' ' : (buf->b_nwindows == 0 ? 'h' : 'a'), - !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '), - (buf->b_flags & BF_READERR) ? 'x' - : (bufIsChanged(buf) ? '+' : ' '), + ro_char, + changed_char, NameBuff); + if (len > IOSIZE - 20) + len = IOSIZE - 20; /* put "line 999" in column 40 or after the file name */ i = 40 - vim_strsize(IObuff); @@ -2788,7 +3091,6 @@ buflist_list(eap) ui_breakcheck(); } } -#endif /* * Get file name and line number for file 'fnum'. @@ -2797,10 +3099,10 @@ buflist_list(eap) * Return FAIL if not found, OK for success. */ int -buflist_name_nr(fnum, fname, lnum) - int fnum; - char_u **fname; - linenr_T *lnum; +buflist_name_nr( + int fnum, + char_u **fname, + linenr_T *lnum) { buf_T *buf; @@ -2821,23 +3123,22 @@ buflist_name_nr(fnum, fname, lnum) * OK otherwise. */ int -setfname(buf, ffname, sfname, message) - buf_T *buf; - char_u *ffname, *sfname; - int message; /* give message when buffer already exists */ +setfname( + buf_T *buf, + char_u *ffname, + char_u *sfname, + int message) /* give message when buffer already exists */ { buf_T *obuf = NULL; #ifdef UNIX - struct stat st; + stat_T st; #endif if (ffname == NULL || *ffname == NUL) { /* Removing the name. */ - vim_free(buf->b_ffname); - vim_free(buf->b_sfname); - buf->b_ffname = NULL; - buf->b_sfname = NULL; + VIM_CLEAR(buf->b_ffname); + VIM_CLEAR(buf->b_sfname); #ifdef UNIX st.st_dev = (dev_T)-1; #endif @@ -2905,9 +3206,7 @@ setfname(buf, ffname, sfname, message) } #endif -#ifndef SHORT_FNAME buf->b_shortname = FALSE; -#endif buf_name_changed(buf); return OK; @@ -2918,9 +3217,7 @@ setfname(buf, ffname, sfname, message) * The name should be relative to the current directory. */ void -buf_set_name(fnum, name) - int fnum; - char_u *name; +buf_set_name(int fnum, char_u *name) { buf_T *buf; @@ -2943,8 +3240,7 @@ buf_set_name(fnum, name) * changed. */ void -buf_name_changed(buf) - buf_T *buf; +buf_name_changed(buf_T *buf) { /* * If the file name changed, also change the name of the swapfile @@ -2957,9 +3253,7 @@ buf_name_changed(buf) #ifdef FEAT_TITLE maketitle(); /* set window title */ #endif -#ifdef FEAT_WINDOWS status_redraw_all(); /* status lines need to be redrawn */ -#endif fmarks_check_names(buf); /* check named file marks */ ml_timestamp(buf); /* reset timestamp */ } @@ -2971,10 +3265,10 @@ buf_name_changed(buf) * Return the buffer. */ buf_T * -setaltfname(ffname, sfname, lnum) - char_u *ffname; - char_u *sfname; - linenr_T lnum; +setaltfname( + char_u *ffname, + char_u *sfname, + linenr_T lnum) { buf_T *buf; @@ -2990,8 +3284,8 @@ setaltfname(ffname, sfname, lnum) * Return NULL if there isn't any, and give error message if requested. */ char_u * -getaltfname(errmsg) - int errmsg; /* give error message */ +getaltfname( + int errmsg) /* give error message */ { char_u *fname; linenr_T dummy; @@ -3012,9 +3306,7 @@ getaltfname(errmsg) * used by qf_init(), main() and doarglist() */ int -buflist_add(fname, flags) - char_u *fname; - int flags; +buflist_add(char_u *fname, int flags) { buf_T *buf; @@ -3029,11 +3321,11 @@ buflist_add(fname, flags) * Adjust slashes in file names. Called after 'shellslash' was set. */ void -buflist_slash_adjust() +buflist_slash_adjust(void) { buf_T *bp; - for (bp = firstbuf; bp != NULL; bp = bp->b_next) + FOR_ALL_BUFFERS(bp) { if (bp->b_ffname != NULL) slash_adjust(bp->b_ffname); @@ -3048,8 +3340,7 @@ buflist_slash_adjust() * Also save the local window option values. */ void -buflist_altfpos(win) - win_T *win; +buflist_altfpos(win_T *win) { buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE); } @@ -3059,8 +3350,7 @@ buflist_altfpos(win) * Fname must have a full path (expanded by mch_FullName()). */ int -otherfile(ffname) - char_u *ffname; +otherfile(char_u *ffname) { return otherfile_buf(curbuf, ffname #ifdef UNIX @@ -3070,16 +3360,13 @@ otherfile(ffname) } static int -otherfile_buf(buf, ffname +otherfile_buf( + buf_T *buf, + char_u *ffname #ifdef UNIX - , stp -#endif - ) - buf_T *buf; - char_u *ffname; -#ifdef UNIX - struct stat *stp; + , stat_T *stp #endif + ) { /* no name is different */ if (ffname == NULL || *ffname == NUL || buf->b_ffname == NULL) @@ -3088,9 +3375,9 @@ otherfile_buf(buf, ffname return FALSE; #ifdef UNIX { - struct stat st; + stat_T st; - /* If no struct stat given, get it now */ + /* If no stat_T given, get it now */ if (stp == NULL) { if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0) @@ -3123,10 +3410,9 @@ otherfile_buf(buf, ffname * Must always be called when b_fname is changed!. */ void -buf_setino(buf) - buf_T *buf; +buf_setino(buf_T *buf) { - struct stat st; + stat_T st; if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0) { @@ -3142,9 +3428,9 @@ buf_setino(buf) * Return TRUE if dev/ino in buffer "buf" matches with "stp". */ static int -buf_same_ino(buf, stp) - buf_T *buf; - struct stat *stp; +buf_same_ino( + buf_T *buf, + stat_T *stp) { return (buf->b_dev_valid && stp->st_dev == buf->b_dev @@ -3156,10 +3442,10 @@ buf_same_ino(buf, stp) * Print info about the current buffer. */ void -fileinfo(fullname, shorthelp, dont_truncate) - int fullname; /* when non-zero print full path */ - int shorthelp; - int dont_truncate; +fileinfo( + int fullname, /* when non-zero print full path */ + int shorthelp, + int dont_truncate) { char_u *name; int n; @@ -3275,11 +3561,11 @@ fileinfo(fullname, shorthelp, dont_truncate) } void -col_print(buf, buflen, col, vcol) - char_u *buf; - size_t buflen; - int col; - int vcol; +col_print( + char_u *buf, + size_t buflen, + int col, + int vcol) { if (col == vcol) vim_snprintf((char *)buf, buflen, "%d", col); @@ -3288,20 +3574,18 @@ col_print(buf, buflen, col, vcol) } #if defined(FEAT_TITLE) || defined(PROTO) -/* - * put file name in title bar of window and in icon title - */ - static char_u *lasttitle = NULL; static char_u *lasticon = NULL; +/* + * Put the file name in the title bar and icon of the window. + */ void -maketitle() +maketitle(void) { char_u *p; - char_u *t_str = NULL; - char_u *i_name; - char_u *i_str = NULL; + char_u *title_str = NULL; + char_u *icon_str = NULL; int maxlen = 0; int len; int mustset; @@ -3321,7 +3605,7 @@ maketitle() need_maketitle = FALSE; if (!p_title && !p_icon && lasttitle == NULL && lasticon == NULL) - return; + return; // nothing to do if (p_title) { @@ -3332,7 +3616,7 @@ maketitle() maxlen = 10; } - t_str = buf; + title_str = buf; if (*p_titlestring != NUL) { #ifdef FEAT_STL_OPT @@ -3345,7 +3629,7 @@ maketitle() use_sandbox = was_set_insecurely((char_u *)"titlestring", 0); # endif called_emsg = FALSE; - build_stl_str_hl(curwin, t_str, sizeof(buf), + build_stl_str_hl(curwin, title_str, sizeof(buf), p_titlestring, use_sandbox, 0, maxlen, NULL, NULL); if (called_emsg) @@ -3355,7 +3639,7 @@ maketitle() } else #endif - t_str = p_titlestring; + title_str = p_titlestring; } else { @@ -3366,6 +3650,13 @@ maketitle() #define SPACE_FOR_ARGNR (IOSIZE - 10) /* at least room for " - VIM" */ if (curbuf->b_fname == NULL) vim_strncpy(buf, (char_u *)_("[No Name]"), SPACE_FOR_FNAME); +#ifdef FEAT_TERMINAL + else if (curbuf->b_term != NULL) + { + vim_strncpy(buf, term_get_status_text(curbuf->b_term), + SPACE_FOR_FNAME); + } +#endif else { p = transstr(gettail(curbuf->b_fname)); @@ -3373,20 +3664,27 @@ maketitle() vim_free(p); } - switch (bufIsChanged(curbuf) - + (curbuf->b_p_ro * 2) - + (!curbuf->b_p_ma * 4)) - { - case 1: STRCAT(buf, " +"); break; - case 2: STRCAT(buf, " ="); break; - case 3: STRCAT(buf, " =+"); break; - case 4: - case 6: STRCAT(buf, " -"); break; - case 5: - case 7: STRCAT(buf, " -+"); break; - } +#ifdef FEAT_TERMINAL + if (curbuf->b_term == NULL) +#endif + switch (bufIsChanged(curbuf) + + (curbuf->b_p_ro * 2) + + (!curbuf->b_p_ma * 4)) + { + case 1: STRCAT(buf, " +"); break; + case 2: STRCAT(buf, " ="); break; + case 3: STRCAT(buf, " =+"); break; + case 4: + case 6: STRCAT(buf, " -"); break; + case 5: + case 7: STRCAT(buf, " -+"); break; + } - if (curbuf->b_fname != NULL) + if (curbuf->b_fname != NULL +#ifdef FEAT_TERMINAL + && curbuf->b_term == NULL +#endif + ) { /* Get path of file, replace home dir with ~ */ off = (int)STRLEN(buf); @@ -3402,9 +3700,11 @@ maketitle() /* remove the file name */ p = gettail_sep(buf + off); if (p == buf + off) + { /* must be a help buffer */ vim_strncpy(buf + off, (char_u *)_("help"), (size_t)(SPACE_FOR_DIR - off - 1)); + } else *p = NUL; @@ -3447,11 +3747,11 @@ maketitle() } } } - mustset = ti_change(t_str, &lasttitle); + mustset = value_changed(title_str, &lasttitle); if (p_icon) { - i_str = buf; + icon_str = buf; if (*p_iconstring != NUL) { #ifdef FEAT_STL_OPT @@ -3464,7 +3764,7 @@ maketitle() use_sandbox = was_set_insecurely((char_u *)"iconstring", 0); # endif called_emsg = FALSE; - build_stl_str_hl(curwin, i_str, sizeof(buf), + build_stl_str_hl(curwin, icon_str, sizeof(buf), p_iconstring, use_sandbox, 0, 0, NULL, NULL); if (called_emsg) @@ -3474,32 +3774,32 @@ maketitle() } else #endif - i_str = p_iconstring; + icon_str = p_iconstring; } else { if (buf_spname(curbuf) != NULL) - i_name = buf_spname(curbuf); + p = buf_spname(curbuf); else /* use file name only in icon */ - i_name = gettail(curbuf->b_ffname); - *i_str = NUL; + p = gettail(curbuf->b_ffname); + *icon_str = NUL; /* Truncate name at 100 bytes. */ - len = (int)STRLEN(i_name); + len = (int)STRLEN(p); if (len > 100) { len -= 100; #ifdef FEAT_MBYTE if (has_mbyte) - len += (*mb_tail_off)(i_name, i_name + len) + 1; + len += (*mb_tail_off)(p, p + len) + 1; #endif - i_name += len; + p += len; } - STRCPY(i_str, i_name); - trans_characters(i_str, IOSIZE); + STRCPY(icon_str, p); + trans_characters(icon_str, IOSIZE); } } - mustset |= ti_change(i_str, &lasticon); + mustset |= value_changed(icon_str, &lasticon); if (mustset) resettitle(); @@ -3508,22 +3808,25 @@ maketitle() /* * Used for title and icon: Check if "str" differs from "*last". Set "*last" * from "str" if it does. - * Return TRUE when "*last" changed. + * Return TRUE if resettitle() is to be called. */ static int -ti_change(str, last) - char_u *str; - char_u **last; +value_changed(char_u *str, char_u **last) { if ((str == NULL) != (*last == NULL) || (str != NULL && *last != NULL && STRCMP(str, *last) != 0)) { vim_free(*last); if (str == NULL) + { *last = NULL; + mch_restore_title(last == &lasttitle ? 1 : 2); + } else + { *last = vim_strsave(str); - return TRUE; + return TRUE; + } } return FALSE; } @@ -3532,14 +3835,14 @@ ti_change(str, last) * Put current window title back (used after calling a shell) */ void -resettitle() +resettitle(void) { mch_settitle(lasttitle, lasticon); } # if defined(EXITFREE) || defined(PROTO) void -free_titles() +free_titles(void) { vim_free(lasttitle); vim_free(lasticon); @@ -3564,25 +3867,24 @@ free_titles() * or truncated if too long, fillchar is used for all whitespace. */ int -build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, - maxwidth, hltab, tabtab) - win_T *wp; - char_u *out; /* buffer to write into != NameBuff */ - size_t outlen; /* length of out[] */ - char_u *fmt; - int use_sandbox UNUSED; /* "fmt" was set insecurely, use sandbox */ - int fillchar; - int maxwidth; - struct stl_hlrec *hltab; /* return: HL attributes (can be NULL) */ - struct stl_hlrec *tabtab; /* return: tab page nrs (can be NULL) */ +build_stl_str_hl( + win_T *wp, + char_u *out, /* buffer to write into != NameBuff */ + size_t outlen, /* length of out[] */ + char_u *fmt, + int use_sandbox UNUSED, /* "fmt" was set insecurely, use sandbox */ + int fillchar, + int maxwidth, + struct stl_hlrec *hltab, /* return: HL attributes (can be NULL) */ + struct stl_hlrec *tabtab) /* return: tab page nrs (can be NULL) */ { char_u *p; char_u *s; char_u *t; int byteval; #ifdef FEAT_EVAL - win_T *o_curwin; - buf_T *o_curbuf; + win_T *save_curwin; + buf_T *save_curbuf; #endif int empty_line; colnr_T virtcol; @@ -3597,6 +3899,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, int width; int itemcnt; int curitem; + int group_end_userhl; + int group_start_userhl; int groupitem[STL_MAX_ITEM]; int groupdepth; struct stl_item @@ -3624,6 +3928,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, char_u tmp[TMPLEN]; char_u *usefmt = fmt; struct stl_hlrec *sp; + int save_must_redraw = must_redraw; + int save_redr_type = curwin->w_redr_type; #ifdef FEAT_EVAL /* @@ -3735,11 +4041,25 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, if (curitem > groupitem[groupdepth] + 1 && item[groupitem[groupdepth]].minwid == 0) { - /* remove group if all items are empty */ + /* remove group if all items are empty and highlight group + * doesn't change */ + group_start_userhl = group_end_userhl = 0; + for (n = groupitem[groupdepth] - 1; n >= 0; n--) + { + if (item[n].type == Highlight) + { + group_start_userhl = group_end_userhl = item[n].minwid; + break; + } + } for (n = groupitem[groupdepth] + 1; n < curitem; n++) + { if (item[n].type == Normal) break; - if (n == curitem) + if (item[n].type == Highlight) + group_end_userhl = item[n].minwid; + } + if (n == curitem && group_start_userhl == group_end_userhl) { p = t; l = 0; @@ -3933,15 +4253,15 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum); set_internal_string_var((char_u *)"actual_curbuf", tmp); - o_curbuf = curbuf; - o_curwin = curwin; + save_curbuf = curbuf; + save_curwin = curwin; curwin = wp; curbuf = wp->w_buffer; str = eval_to_string_safe(p, &t, use_sandbox); - curwin = o_curwin; - curbuf = o_curbuf; + curwin = save_curwin; + curbuf = save_curbuf; do_unlet((char_u *)"g:actual_curbuf", TRUE); if (str != NULL && *str != 0) @@ -3949,8 +4269,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, if (*skipdigits(str) == NUL) { num = atoi((char *)str); - vim_free(str); - str = NULL; + VIM_CLEAR(str); itemisflag = FALSE; } } @@ -4009,7 +4328,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, case STL_KEYMAP: fillable = FALSE; - if (get_keymap_str(wp, tmp, TMPLEN)) + if (get_keymap_str(wp, (char_u *)"<%s>", tmp, TMPLEN)) str = tmp; break; case STL_PAGENUM: @@ -4026,6 +4345,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, case STL_OFFSET_X: base = 'X'; + /* FALLTHROUGH */ case STL_OFFSET: #ifdef FEAT_BYTEOFF l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); @@ -4037,6 +4357,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, case STL_BYTEVAL_X: base = 'X'; + /* FALLTHROUGH */ case STL_BYTEVAL: num = byteval; if (num == NL) @@ -4060,7 +4381,6 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, : _("[Help]")); break; -#ifdef FEAT_AUTOCMD case STL_FILETYPE: if (*wp->w_buffer->b_p_ft != NUL && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3) @@ -4083,9 +4403,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, str = tmp; } break; -#endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) case STL_PREVIEWFLAG: case STL_PREVIEWFLAG_ALT: itemisflag = TRUE; @@ -4396,6 +4715,14 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, sp->userhl = 0; } + /* When inside update_screen we do not want redrawing a stausline, ruler, + * title, etc. to trigger another redraw, it may cause an endless loop. */ + if (updating_screen) + { + must_redraw = save_must_redraw; + curwin->w_redr_type = save_redr_type; + } + return width; } #endif /* FEAT_STL_OPT */ @@ -4407,17 +4734,23 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, * using "Top", "Bot" or "All" when appropriate. */ void -get_rel_pos(wp, buf, buflen) - win_T *wp; - char_u *buf; - int buflen; +get_rel_pos( + win_T *wp, + char_u *buf, + int buflen) { long above; /* number of lines above window */ long below; /* number of lines below window */ + if (buflen < 3) /* need at least 3 chars for writing */ + return; above = wp->w_topline - 1; #ifdef FEAT_DIFF above += diff_check_fill(wp, wp->w_topline) - wp->w_topfill; + if (wp->w_topline == 1 && wp->w_topfill >= 1) + above = 0; /* All buffer lines are displayed and there is an + * indication of filler lines, that can be considered + * seeing all lines. */ #endif below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1; if (below <= 0) @@ -4437,11 +4770,11 @@ get_rel_pos(wp, buf, buflen) * Return TRUE if it was appended. */ static int -append_arg_number(wp, buf, buflen, add_file) - win_T *wp; - char_u *buf; - int buflen; - int add_file; /* Add "file" before the arg number */ +append_arg_number( + win_T *wp, + char_u *buf, + int buflen, + int add_file) /* Add "file" before the arg number */ { char_u *p; @@ -4469,8 +4802,7 @@ append_arg_number(wp, buf, buflen, add_file) * Returns pointer to allocated memory (NULL for failure). */ char_u * -fix_fname(fname) - char_u *fname; +fix_fname(char_u *fname) { /* * Force expanding the path always for Unix, because symbolic links may @@ -4489,7 +4821,7 @@ fix_fname(fname) # ifdef BACKSLASH_IN_FILENAME || strstr((char *)fname, "\\\\") != NULL # endif -# if defined(MSWIN) || defined(DJGPP) +# if defined(MSWIN) || vim_strchr(fname, '~') != NULL # endif ) @@ -4516,10 +4848,10 @@ fix_fname(fname) * "ffname" becomes a pointer to allocated memory (or NULL). */ void -fname_expand(buf, ffname, sfname) - buf_T *buf UNUSED; - char_u **ffname; - char_u **sfname; +fname_expand( + buf_T *buf UNUSED, + char_u **ffname, + char_u **sfname) { if (*ffname == NULL) /* if no file name given, nothing to do */ return; @@ -4548,8 +4880,7 @@ fname_expand(buf, ffname, sfname) * Get the file name for an argument list entry. */ char_u * -alist_name(aep) - aentry_T *aep; +alist_name(aentry_T *aep) { buf_T *bp; @@ -4560,15 +4891,14 @@ alist_name(aep) return bp->b_fname; } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * do_arg_all(): Open up to 'count' windows, one for each argument. */ void -do_arg_all(count, forceit, keep_tabs) - int count; - int forceit; /* hide buffers in current windows */ - int keep_tabs; /* keep current tabs, for ":tab drop file" */ +do_arg_all( + int count, + int forceit, /* hide buffers in current windows */ + int keep_tabs) /* keep current tabs, for ":tab drop file" */ { int i; win_T *wp, *wpnext; @@ -4613,9 +4943,9 @@ do_arg_all(count, forceit, keep_tabs) old_curwin = curwin; old_curtab = curtab; -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif /* * Try closing all windows that are not in the argument list. @@ -4634,11 +4964,8 @@ do_arg_all(count, forceit, keep_tabs) wpnext = wp->w_next; buf = wp->w_buffer; if (buf->b_ffname == NULL - || (!keep_tabs && buf->b_nwindows > 1) -#ifdef FEAT_VERTSPLIT - || wp->w_width != Columns -#endif - ) + || (!keep_tabs && (buf->b_nwindows > 1 + || wp->w_width != Columns))) i = opened_len; else { @@ -4689,41 +5016,39 @@ do_arg_all(count, forceit, keep_tabs) if (i == opened_len && !keep_tabs)/* close this window */ { - if (P_HID(buf) || forceit || buf->b_nwindows > 1 + if (buf_hide(buf) || forceit || buf->b_nwindows > 1 || !bufIsChanged(buf)) { /* If the buffer was changed, and we would like to hide it, * try autowriting. */ - if (!P_HID(buf) && buf->b_nwindows <= 1 + if (!buf_hide(buf) && buf->b_nwindows <= 1 && bufIsChanged(buf)) { + bufref_T bufref; + + set_bufref(&bufref, buf); + (void)autowrite(buf, FALSE); -#ifdef FEAT_AUTOCMD + /* check if autocommands removed the window */ - if (!win_valid(wp) || !buf_valid(buf)) + if (!win_valid(wp) || !bufref_valid(&bufref)) { wpnext = firstwin; /* start all over... */ continue; } -#endif } -#ifdef FEAT_WINDOWS /* don't close last window */ - if (firstwin == lastwin + if (ONE_WINDOW && (first_tabpage->tp_next == NULL || !had_tab)) -#endif use_firstwin = TRUE; -#ifdef FEAT_WINDOWS else { - win_close(wp, !P_HID(buf) && !bufIsChanged(buf)); -# ifdef FEAT_AUTOCMD + win_close(wp, !buf_hide(buf) && !bufIsChanged(buf)); + /* check if autocommands removed the next window */ if (!win_valid(wpnext)) wpnext = firstwin; /* start all over... */ -# endif } -#endif } } } @@ -4732,11 +5057,10 @@ do_arg_all(count, forceit, keep_tabs) if (had_tab == 0 || tpnext == NULL) break; -# ifdef FEAT_AUTOCMD /* check if autocommands removed the next tab page */ if (!valid_tabpage(tpnext)) tpnext = first_tabpage; /* start all over...*/ -# endif + goto_tabpage_tp(tpnext, TRUE, TRUE); } @@ -4747,21 +5071,17 @@ do_arg_all(count, forceit, keep_tabs) if (count > opened_len || count <= 0) count = opened_len; -#ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; ++autocmd_no_leave; -#endif last_curwin = curwin; last_curtab = curtab; win_enter(lastwin, FALSE); -#ifdef FEAT_WINDOWS /* ":drop all" should re-use an empty window to avoid "--remote-tab" * leaving an empty tab page when executed locally. */ - if (keep_tabs && bufempty() && curbuf->b_nwindows == 1 + if (keep_tabs && BUFEMPTY() && curbuf->b_nwindows == 1 && curbuf->b_ffname == NULL && !curbuf->b_changed) use_firstwin = TRUE; -#endif for (i = 0; i < count && i < opened_len && !got_int; ++i) { @@ -4799,10 +5119,8 @@ do_arg_all(count, forceit, keep_tabs) if (split_ret == FAIL) continue; } -#ifdef FEAT_AUTOCMD else /* first window: do autocmd for leaving this buffer */ --autocmd_no_leave; -#endif /* * edit file "i" @@ -4815,13 +5133,11 @@ do_arg_all(count, forceit, keep_tabs) } (void)do_ecmd(0, alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE, - ((P_HID(curwin->w_buffer) + ((buf_hide(curwin->w_buffer) || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0) + ECMD_OLDBUF, curwin); -#ifdef FEAT_AUTOCMD if (use_firstwin) ++autocmd_no_leave; -#endif use_firstwin = FALSE; } ui_breakcheck(); @@ -4834,9 +5150,8 @@ do_arg_all(count, forceit, keep_tabs) /* Remove the "lock" on the argument list. */ alist_unlink(alist); -#ifdef FEAT_AUTOCMD --autocmd_no_enter; -#endif + /* restore last referenced tabpage's curwin */ if (last_curtab != new_curtab) { @@ -4851,19 +5166,15 @@ do_arg_all(count, forceit, keep_tabs) if (win_valid(new_curwin)) win_enter(new_curwin, FALSE); -#ifdef FEAT_AUTOCMD --autocmd_no_leave; -#endif vim_free(opened); } -# if defined(FEAT_LISTCMDS) || defined(PROTO) /* * Open a window for a number of buffers. */ void -ex_buffer_all(eap) - exarg_T *eap; +ex_buffer_all(exarg_T *eap) { buf_T *buf; win_T *wp, *wpnext; @@ -4873,10 +5184,8 @@ ex_buffer_all(eap) int r; int count; /* Maximum number of windows to open. */ int all; /* When TRUE also load inactive buffers. */ -#ifdef FEAT_WINDOWS int had_tab = cmdmod.tab; tabpage_T *tpnext; -#endif if (eap->addr_count == 0) /* make as many windows as possible */ count = 9999; @@ -4897,72 +5206,53 @@ ex_buffer_all(eap) * Close superfluous windows (two windows for the same buffer). * Also close windows that are not full-width. */ -#ifdef FEAT_WINDOWS if (had_tab > 0) goto_tabpage_tp(first_tabpage, TRUE, TRUE); for (;;) { -#endif tpnext = curtab->tp_next; for (wp = firstwin; wp != NULL; wp = wpnext) { wpnext = wp->w_next; if ((wp->w_buffer->b_nwindows > 1 -#ifdef FEAT_VERTSPLIT || ((cmdmod.split & WSP_VERT) ? wp->w_height + wp->w_status_height < Rows - p_ch - tabline_height() : wp->w_width != Columns) -#endif -#ifdef FEAT_WINDOWS - || (had_tab > 0 && wp != firstwin) -#endif - ) && firstwin != lastwin -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_closing) -#endif - ) + || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close(wp, FALSE); -#ifdef FEAT_AUTOCMD wpnext = firstwin; /* just in case an autocommand does something strange with windows */ tpnext = first_tabpage; /* start all over...*/ open_wins = 0; -#endif } else ++open_wins; } -#ifdef FEAT_WINDOWS /* Without the ":tab" modifier only do the current tab page. */ if (had_tab == 0 || tpnext == NULL) break; goto_tabpage_tp(tpnext, TRUE, TRUE); } -#endif /* * Go through the buffer list. When a buffer doesn't have a window yet, * open one. Otherwise move the window to the right position. * Watch out for autocommands that delete buffers or windows! */ -#ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; -#endif win_enter(lastwin, FALSE); -#ifdef FEAT_AUTOCMD ++autocmd_no_leave; -#endif for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next) { /* Check if this buffer needs a window */ if ((!all && buf->b_ml.ml_mfp == NULL) || !buf->b_p_bl) continue; -#ifdef FEAT_WINDOWS if (had_tab != 0) { /* With the ":tab" modifier don't move the window. */ @@ -4972,10 +5262,9 @@ ex_buffer_all(eap) wp = NULL; } else -#endif { /* Check if this buffer already has a window */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_buffer == buf) break; /* If the buffer already has a window, move it */ @@ -4985,6 +5274,10 @@ ex_buffer_all(eap) if (wp == NULL && split_ret == OK) { + bufref_T bufref; + + set_bufref(&bufref, buf); + /* Split the window and put the buffer in it */ p_ea_save = p_ea; p_ea = TRUE; /* use space from all windows */ @@ -4999,19 +5292,18 @@ ex_buffer_all(eap) swap_exists_action = SEA_DIALOG; #endif set_curbuf(buf, DOBUF_GOTO); -#ifdef FEAT_AUTOCMD - if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */ + if (!bufref_valid(&bufref)) { + /* autocommands deleted the buffer!!! */ #if defined(HAS_SWAP_EXISTS_ACTION) swap_exists_action = SEA_NONE; -# endif +#endif break; } -#endif #if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that @@ -5025,7 +5317,7 @@ ex_buffer_all(eap) swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or uncaught * exception. */ @@ -5048,38 +5340,29 @@ ex_buffer_all(eap) if (aborting()) break; #endif -#ifdef FEAT_WINDOWS /* When ":tab" was used open a new tab for a new window repeatedly. */ if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) cmdmod.tab = 9999; -#endif } -#ifdef FEAT_AUTOCMD --autocmd_no_enter; -#endif win_enter(firstwin, FALSE); /* back to first window */ -#ifdef FEAT_AUTOCMD --autocmd_no_leave; -#endif /* * Close superfluous windows. */ for (wp = lastwin; open_wins > count; ) { - r = (P_HID(wp->w_buffer) || !bufIsChanged(wp->w_buffer) + r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer) || autowrite(wp->w_buffer, FALSE) == OK); -#ifdef FEAT_AUTOCMD if (!win_valid(wp)) { /* BufWrite Autocommands made the window invalid, start over */ wp = lastwin; } - else -#endif - if (r) + else if (r) { - win_close(wp, !P_HID(wp->w_buffer)); + win_close(wp, !buf_hide(wp->w_buffer)); --open_wins; wp = lastwin; } @@ -5091,11 +5374,9 @@ ex_buffer_all(eap) } } } -# endif /* FEAT_LISTCMDS */ -#endif /* FEAT_WINDOWS */ -static int chk_modeline __ARGS((linenr_T, int)); +static int chk_modeline(linenr_T, int); /* * do_modelines() - process mode lines for the current file @@ -5107,8 +5388,7 @@ static int chk_modeline __ARGS((linenr_T, int)); * Returns immediately if the "ml" option isn't set. */ void -do_modelines(flags) - int flags; +do_modelines(int flags) { linenr_T lnum; int nmlines; @@ -5142,9 +5422,9 @@ do_modelines(flags) * Return FAIL if an error encountered. */ static int -chk_modeline(lnum, flags) - linenr_T lnum; - int flags; /* Same as for do_modelines(). */ +chk_modeline( + linenr_T lnum, + int flags) /* Same as for do_modelines(). */ { char_u *s; char_u *e; @@ -5264,9 +5544,9 @@ chk_modeline(lnum, flags) #if defined(FEAT_VIMINFO) || defined(PROTO) int -read_viminfo_bufferlist(virp, writing) - vir_T *virp; - int writing; +read_viminfo_bufferlist( + vir_T *virp, + int writing) { char_u *tab; linenr_T lnum; @@ -5318,14 +5598,11 @@ read_viminfo_bufferlist(virp, writing) } void -write_viminfo_bufferlist(fp) - FILE *fp; +write_viminfo_bufferlist(FILE *fp) { buf_T *buf; -#ifdef FEAT_WINDOWS win_T *win; tabpage_T *tp; -#endif char_u *line; int max_buffers; @@ -5341,20 +5618,19 @@ write_viminfo_bufferlist(fp) if (line == NULL) return; -#ifdef FEAT_WINDOWS FOR_ALL_TAB_WINDOWS(tp, win) set_last_cursor(win); -#else - set_last_cursor(curwin); -#endif fputs(_("\n# Buffer list:\n"), fp); - for (buf = firstbuf; buf != NULL ; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_fname == NULL || !buf->b_p_bl #ifdef FEAT_QUICKFIX || bt_quickfix(buf) +#endif +#ifdef FEAT_TERMINAL + || bt_terminal(buf) #endif || removable(buf->b_ffname)) continue; @@ -5372,16 +5648,103 @@ write_viminfo_bufferlist(fp) } #endif +/* + * Return TRUE if "buf" is the quickfix buffer. + */ + int +bt_quickfix(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 'q'; +} + +/* + * Return TRUE if "buf" is a terminal buffer. + */ + int +bt_terminal(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 't'; +} + +/* + * Return TRUE if "buf" is a help buffer. + */ + int +bt_help(buf_T *buf) +{ + return buf != NULL && buf->b_help; +} + +/* + * Return TRUE if "buf" is a prompt buffer. + */ + int +bt_prompt(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 'p'; +} + +/* + * Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer. + * This means the buffer name is not a file name. + */ + int +bt_nofile(buf_T *buf) +{ + return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') + || buf->b_p_bt[0] == 'a' + || buf->b_p_bt[0] == 't' + || buf->b_p_bt[0] == 'p'); +} + +/* + * Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer. + */ + int +bt_dontwrite(buf_T *buf) +{ + return buf != NULL && (buf->b_p_bt[0] == 'n' + || buf->b_p_bt[0] == 't' + || buf->b_p_bt[0] == 'p'); +} + + int +bt_dontwrite_msg(buf_T *buf) +{ + if (bt_dontwrite(buf)) + { + EMSG(_("E382: Cannot write, 'buftype' option is set")); + return TRUE; + } + return FALSE; +} + +/* + * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" + * and 'bufhidden'. + */ + int +buf_hide(buf_T *buf) +{ + /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ + switch (buf->b_p_bh[0]) + { + case 'u': /* "unload" */ + case 'w': /* "wipe" */ + case 'd': return FALSE; /* "delete" */ + case 'h': return TRUE; /* "hide" */ + } + return (p_hid || cmdmod.hide); +} /* * Return special buffer name. * Returns NULL when the buffer has a normal file name. */ char_u * -buf_spname(buf) - buf_T *buf; +buf_spname(buf_T *buf) { -#if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS) +#if defined(FEAT_QUICKFIX) if (bt_quickfix(buf)) { win_T *win; @@ -5397,34 +5760,83 @@ buf_spname(buf) return (char_u *)_(msg_qflist); } #endif -#ifdef FEAT_QUICKFIX + /* There is no _file_ when 'buftype' is "nofile", b_sfname - * contains the name as specified by the user */ + * contains the name as specified by the user. */ if (bt_nofile(buf)) { - if (buf->b_sfname != NULL) - return buf->b_sfname; +#ifdef FEAT_TERMINAL + if (buf->b_term != NULL) + return term_get_status_text(buf->b_term); +#endif + if (buf->b_fname != NULL) + return buf->b_fname; +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(buf)) + return (char_u *)_("[Prompt]"); +#endif return (char_u *)_("[Scratch]"); } -#endif + if (buf->b_fname == NULL) return (char_u *)_("[No Name]"); return NULL; } -#if (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ +#if defined(FEAT_JOB_CHANNEL) \ || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ || defined(PROTO) +# define SWITCH_TO_WIN + +/* + * Find a window that contains "buf" and switch to it. + * If there is no such window, use the current window and change "curbuf". + * Caller must initialize save_curbuf to NULL. + * restore_win_for_buf() MUST be called later! + */ + void +switch_to_win_for_buf( + buf_T *buf, + win_T **save_curwinp, + tabpage_T **save_curtabp, + bufref_T *save_curbuf) +{ + win_T *wp; + tabpage_T *tp; + + if (find_win_for_buf(buf, &wp, &tp) == FAIL) + switch_buffer(save_curbuf, buf); + else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) + { + restore_win(*save_curwinp, *save_curtabp, TRUE); + switch_buffer(save_curbuf, buf); + } +} + + void +restore_win_for_buf( + win_T *save_curwin, + tabpage_T *save_curtab, + bufref_T *save_curbuf) +{ + if (save_curbuf->br_buf == NULL) + restore_win(save_curwin, save_curtab, TRUE); + else + restore_buffer(save_curbuf); +} +#endif + +#if defined(FEAT_QUICKFIX) || defined(SWITCH_TO_WIN) || defined(PROTO) /* * Find a window for buffer "buf". * If found OK is returned and "wp" and "tp" are set to the window and tabpage. * If not found FAIL is returned. */ int -find_win_for_buf(buf, wp, tp) - buf_T *buf; - win_T **wp; - tabpage_T **tp; +find_win_for_buf( + buf_T *buf, + win_T **wp, + tabpage_T **tp) { FOR_ALL_TAB_WINDOWS(*tp, *wp) if ((*wp)->w_buffer == buf) @@ -5440,13 +5852,13 @@ find_win_for_buf(buf, wp, tp) * Insert the sign into the signlist. */ static void -insert_sign(buf, prev, next, id, lnum, typenr) - buf_T *buf; /* buffer to store sign in */ - signlist_T *prev; /* previous sign entry */ - signlist_T *next; /* next sign entry */ - int id; /* sign ID */ - linenr_T lnum; /* line number which gets the mark */ - int typenr; /* typenr of sign we are adding */ +insert_sign( + buf_T *buf, /* buffer to store sign in */ + signlist_T *prev, /* previous sign entry */ + signlist_T *next, /* next sign entry */ + int id, /* sign ID */ + linenr_T lnum, /* line number which gets the mark */ + int typenr) /* typenr of sign we are adding */ { signlist_T *newsign; @@ -5475,6 +5887,10 @@ insert_sign(buf, prev, next, id, lnum, typenr) /* first sign in signlist */ buf->b_signlist = newsign; +#ifdef FEAT_NETBEANS_INTG + if (netbeans_active()) + buf->b_has_sign_column = TRUE; +#endif } else prev->next = newsign; @@ -5485,11 +5901,11 @@ insert_sign(buf, prev, next, id, lnum, typenr) * Add the sign into the signlist. Find the right spot to do it though. */ void -buf_addsign(buf, id, lnum, typenr) - buf_T *buf; /* buffer to store sign in */ - int id; /* sign ID */ - linenr_T lnum; /* line number which gets the mark */ - int typenr; /* typenr of sign we are adding */ +buf_addsign( + buf_T *buf, /* buffer to store sign in */ + int id, /* sign ID */ + linenr_T lnum, /* line number which gets the mark */ + int typenr) /* typenr of sign we are adding */ { signlist_T *sign; /* a sign in the signlist */ signlist_T *prev; /* the previous sign */ @@ -5544,10 +5960,10 @@ buf_addsign(buf, id, lnum, typenr) * Returns the line number of the sign, or zero if the sign is not found. */ linenr_T -buf_change_sign_type(buf, markId, typenr) - buf_T *buf; /* buffer to store sign in */ - int markId; /* sign ID */ - int typenr; /* typenr of sign we are adding */ +buf_change_sign_type( + buf_T *buf, /* buffer to store sign in */ + int markId, /* sign ID */ + int typenr) /* typenr of sign we are adding */ { signlist_T *sign; /* a sign in the signlist */ @@ -5564,10 +5980,10 @@ buf_change_sign_type(buf, markId, typenr) } int -buf_getsigntype(buf, lnum, type) - buf_T *buf; - linenr_T lnum; - int type; /* SIGN_ICON, SIGN_TEXT, SIGN_ANY, SIGN_LINEHL */ +buf_getsigntype( + buf_T *buf, + linenr_T lnum, + int type) /* SIGN_ICON, SIGN_TEXT, SIGN_ANY, SIGN_LINEHL */ { signlist_T *sign; /* a sign in a b_signlist */ @@ -5588,9 +6004,9 @@ buf_getsigntype(buf, lnum, type) linenr_T -buf_delsign(buf, id) - buf_T *buf; /* buffer sign is stored in */ - int id; /* sign id */ +buf_delsign( + buf_T *buf, /* buffer sign is stored in */ + int id) /* sign id */ { signlist_T **lastp; /* pointer to pointer to current sign */ signlist_T *sign; /* a sign in a b_signlist */ @@ -5635,9 +6051,9 @@ buf_delsign(buf, id) * get loaded. */ int -buf_findsign(buf, id) - buf_T *buf; /* buffer to store sign in */ - int id; /* sign ID */ +buf_findsign( + buf_T *buf, /* buffer to store sign in */ + int id) /* sign ID */ { signlist_T *sign; /* a sign in the signlist */ @@ -5649,9 +6065,9 @@ buf_findsign(buf, id) } int -buf_findsign_id(buf, lnum) - buf_T *buf; /* buffer whose sign we are searching for */ - linenr_T lnum; /* line number of sign */ +buf_findsign_id( + buf_T *buf, /* buffer whose sign we are searching for */ + linenr_T lnum) /* line number of sign */ { signlist_T *sign; /* a sign in the signlist */ @@ -5666,10 +6082,10 @@ buf_findsign_id(buf, lnum) # if defined(FEAT_NETBEANS_INTG) || defined(PROTO) /* see if a given type of sign exists on a specific line */ int -buf_findsigntype_id(buf, lnum, typenr) - buf_T *buf; /* buffer whose sign we are searching for */ - linenr_T lnum; /* line number of sign */ - int typenr; /* sign type number */ +buf_findsigntype_id( + buf_T *buf, /* buffer whose sign we are searching for */ + linenr_T lnum, /* line number of sign */ + int typenr) /* sign type number */ { signlist_T *sign; /* a sign in the signlist */ @@ -5684,9 +6100,7 @@ buf_findsigntype_id(buf, lnum, typenr) # if defined(FEAT_SIGN_ICONS) || defined(PROTO) /* return the number of icons on the given line */ int -buf_signcount(buf, lnum) - buf_T *buf; - linenr_T lnum; +buf_signcount(buf_T *buf, linenr_T lnum) { signlist_T *sign; /* a sign in the signlist */ int count = 0; @@ -5706,8 +6120,7 @@ buf_signcount(buf, lnum) * Delete signs in buffer "buf". */ void -buf_delete_signs(buf) - buf_T *buf; +buf_delete_signs(buf_T *buf) { signlist_T *next; @@ -5731,11 +6144,11 @@ buf_delete_signs(buf) * Delete all signs in all buffers. */ void -buf_delete_all_signs() +buf_delete_all_signs(void) { buf_T *buf; /* buffer we are checking for signs */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_signlist != NULL) buf_delete_signs(buf); } @@ -5744,8 +6157,7 @@ buf_delete_all_signs() * List placed signs for "rbuf". If "rbuf" is NULL do it for all buffers. */ void -sign_list_placed(rbuf) - buf_T *rbuf; +sign_list_placed(buf_T *rbuf) { buf_T *buf; signlist_T *p; @@ -5762,7 +6174,7 @@ sign_list_placed(rbuf) if (buf->b_signlist != NULL) { vim_snprintf(lbuf, BUFSIZ, _("Signs for %s:"), buf->b_fname); - MSG_PUTS_ATTR(lbuf, hl_attr(HLF_D)); + MSG_PUTS_ATTR(lbuf, HL_ATTR(HLF_D)); msg_putchar('\n'); } for (p = buf->b_signlist; p != NULL && !got_int; p = p->next) @@ -5782,11 +6194,11 @@ sign_list_placed(rbuf) * Adjust a placed sign for inserted/deleted lines. */ void -sign_mark_adjust(line1, line2, amount, amount_after) - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +sign_mark_adjust( + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) { signlist_T *sign; /* a sign in a b_signlist */ @@ -5809,18 +6221,15 @@ sign_mark_adjust(line1, line2, amount, amount_after) * Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed. */ void -set_buflisted(on) - int on; +set_buflisted(int on) { if (on != curbuf->b_p_bl) { curbuf->b_p_bl = on; -#ifdef FEAT_AUTOCMD if (on) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); else apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); -#endif } } @@ -5829,8 +6238,7 @@ set_buflisted(on) * Return TRUE if it changed or this could not be checked. */ int -buf_contents_changed(buf) - buf_T *buf; +buf_contents_changed(buf_T *buf) { buf_T *newbuf; int differ = TRUE; @@ -5887,20 +6295,18 @@ buf_contents_changed(buf) * marks. */ void -wipe_buffer(buf, aucmd) - buf_T *buf; - int aucmd UNUSED; /* When TRUE trigger autocommands. */ +wipe_buffer( + buf_T *buf, + int aucmd UNUSED) /* When TRUE trigger autocommands. */ { if (buf->b_fnum == top_file_num - 1) --top_file_num; -#ifdef FEAT_AUTOCMD if (!aucmd) /* Don't trigger BufDelete autocommands here. */ block_autocmds(); -#endif + close_buffer(NULL, buf, DOBUF_WIPE, FALSE); -#ifdef FEAT_AUTOCMD + if (!aucmd) unblock_autocmds(); -#endif } diff --git a/src/channel.c b/src/channel.c new file mode 100644 index 0000000000..099dcaa643 --- /dev/null +++ b/src/channel.c @@ -0,0 +1,5977 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + */ + +/* + * Implements communication through a socket or any file handle. + */ + +#include "vim.h" + +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) + +/* TRUE when netbeans is running with a GUI. */ +#ifdef FEAT_GUI +# define CH_HAS_GUI (gui.in_use || gui.starting) +#endif + +/* Note: when making changes here also adjust configure.ac. */ +#ifdef WIN32 +/* WinSock API is separated from C API, thus we can't use read(), write(), + * errno... */ +# define SOCK_ERRNO errno = WSAGetLastError() +# undef ECONNREFUSED +# define ECONNREFUSED WSAECONNREFUSED +# undef EWOULDBLOCK +# define EWOULDBLOCK WSAEWOULDBLOCK +# undef EINPROGRESS +# define EINPROGRESS WSAEINPROGRESS +# ifdef EINTR +# undef EINTR +# endif +# define EINTR WSAEINTR +# define sock_write(sd, buf, len) send((SOCKET)sd, buf, len, 0) +# define sock_read(sd, buf, len) recv((SOCKET)sd, buf, len, 0) +# define sock_close(sd) closesocket((SOCKET)sd) +#else +# include <netdb.h> +# include <netinet/in.h> + +# include <sys/socket.h> +# ifdef HAVE_LIBGEN_H +# include <libgen.h> +# endif +# define SOCK_ERRNO +# define sock_write(sd, buf, len) write(sd, buf, len) +# define sock_read(sd, buf, len) read(sd, buf, len) +# define sock_close(sd) close(sd) +# define fd_read(fd, buf, len) read(fd, buf, len) +# define fd_write(sd, buf, len) write(sd, buf, len) +# define fd_close(sd) close(sd) +#endif + +static void channel_read(channel_T *channel, ch_part_T part, char *func); + +/* Whether a redraw is needed for appending a line to a buffer. */ +static int channel_need_redraw = FALSE; + +/* Whether we are inside channel_parse_messages() or another situation where it + * is safe to invoke callbacks. */ +static int safe_to_invoke_callback = 0; + +static char *part_names[] = {"sock", "out", "err", "in"}; + +#ifdef WIN32 + static int +fd_read(sock_T fd, char *buf, size_t len) +{ + HANDLE h = (HANDLE)fd; + DWORD nread; + + if (!ReadFile(h, buf, (DWORD)len, &nread, NULL)) + return -1; + return (int)nread; +} + + static int +fd_write(sock_T fd, char *buf, size_t len) +{ + HANDLE h = (HANDLE)fd; + DWORD nwrite; + + if (!WriteFile(h, buf, (DWORD)len, &nwrite, NULL)) + return -1; + return (int)nwrite; +} + + static void +fd_close(sock_T fd) +{ + HANDLE h = (HANDLE)fd; + + CloseHandle(h); +} +#endif + +/* Log file opened with ch_logfile(). */ +static FILE *log_fd = NULL; +#ifdef FEAT_RELTIME +static proftime_T log_start; +#endif + + void +ch_logfile(char_u *fname, char_u *opt) +{ + FILE *file = NULL; + + if (log_fd != NULL) + fclose(log_fd); + + if (*fname != NUL) + { + file = fopen((char *)fname, *opt == 'w' ? "w" : "a"); + if (file == NULL) + { + EMSG2(_(e_notopen), fname); + return; + } + } + log_fd = file; + + if (log_fd != NULL) + { + fprintf(log_fd, "==== start log session ====\n"); +#ifdef FEAT_RELTIME + profile_start(&log_start); +#endif + } +} + + int +ch_log_active(void) +{ + return log_fd != NULL; +} + + static void +ch_log_lead(const char *what, channel_T *ch) +{ + if (log_fd != NULL) + { +#ifdef FEAT_RELTIME + proftime_T log_now; + + profile_start(&log_now); + profile_sub(&log_now, &log_start); + fprintf(log_fd, "%s ", profile_msg(&log_now)); +#endif + if (ch != NULL) + fprintf(log_fd, "%son %d: ", what, ch->ch_id); + else + fprintf(log_fd, "%s: ", what); + } +} + +static int did_log_msg = TRUE; + +#ifndef PROTO /* prototype is in vim.h */ + void +ch_log(channel_T *ch, const char *fmt, ...) +{ + if (log_fd != NULL) + { + va_list ap; + + ch_log_lead("", ch); + va_start(ap, fmt); + vfprintf(log_fd, fmt, ap); + va_end(ap); + fputc('\n', log_fd); + fflush(log_fd); + did_log_msg = TRUE; + } +} +#endif + + static void +ch_error(channel_T *ch, const char *fmt, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 2, 3))) +#endif + ; + + static void +ch_error(channel_T *ch, const char *fmt, ...) +{ + if (log_fd != NULL) + { + va_list ap; + + ch_log_lead("ERR ", ch); + va_start(ap, fmt); + vfprintf(log_fd, fmt, ap); + va_end(ap); + fputc('\n', log_fd); + fflush(log_fd); + did_log_msg = TRUE; + } +} + +#ifdef _WIN32 +# undef PERROR +# define PERROR(msg) (void)emsg3((char_u *)"%s: %s", \ + (char_u *)msg, (char_u *)strerror_win32(errno)) + + static char * +strerror_win32(int eno) +{ + static LPVOID msgbuf = NULL; + char_u *ptr; + + if (msgbuf) + { + LocalFree(msgbuf); + msgbuf = NULL; + } + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + eno, + MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), + (LPTSTR) &msgbuf, + 0, + NULL); + if (msgbuf != NULL) + /* chomp \r or \n */ + for (ptr = (char_u *)msgbuf; *ptr; ptr++) + switch (*ptr) + { + case '\r': + STRMOVE(ptr, ptr + 1); + ptr--; + break; + case '\n': + if (*(ptr + 1) == '\0') + *ptr = '\0'; + else + *ptr = ' '; + break; + } + return msgbuf; +} +#endif + +/* + * The list of all allocated channels. + */ +static channel_T *first_channel = NULL; +static int next_ch_id = 0; + +/* + * Allocate a new channel. The refcount is set to 1. + * The channel isn't actually used until it is opened. + * Returns NULL if out of memory. + */ + channel_T * +add_channel(void) +{ + ch_part_T part; + channel_T *channel = (channel_T *)alloc_clear((int)sizeof(channel_T)); + + if (channel == NULL) + return NULL; + + channel->ch_id = next_ch_id++; + ch_log(channel, "Created channel"); + + for (part = PART_SOCK; part < PART_COUNT; ++part) + { + channel->ch_part[part].ch_fd = INVALID_FD; +#ifdef FEAT_GUI_X11 + channel->ch_part[part].ch_inputHandler = (XtInputId)NULL; +#endif +#ifdef FEAT_GUI_GTK + channel->ch_part[part].ch_inputHandler = 0; +#endif +#ifdef FEAT_GUI_MACVIM + channel->ch_part[part].ch_inputHandler = 0; +#endif + channel->ch_part[part].ch_timeout = 2000; + } + + if (first_channel != NULL) + { + first_channel->ch_prev = channel; + channel->ch_next = first_channel; + } + first_channel = channel; + + channel->ch_refcount = 1; + return channel; +} + + int +has_any_channel(void) +{ + return first_channel != NULL; +} + +/* + * Called when the refcount of a channel is zero. + * Return TRUE if "channel" has a callback and the associated job wasn't + * killed. + */ + static int +channel_still_useful(channel_T *channel) +{ + int has_sock_msg; + int has_out_msg; + int has_err_msg; + + /* If the job was killed the channel is not expected to work anymore. */ + if (channel->ch_job_killed && channel->ch_job == NULL) + return FALSE; + + /* If there is a close callback it may still need to be invoked. */ + if (channel->ch_close_cb != NULL) + return TRUE; + + /* If reading from or a buffer it's still useful. */ + if (channel->ch_part[PART_IN].ch_bufref.br_buf != NULL) + return TRUE; + + /* If there is no callback then nobody can get readahead. If the fd is + * closed and there is no readahead then the callback won't be called. */ + has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD + || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL + || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; + has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD + || channel->ch_part[PART_OUT].ch_head.rq_next != NULL + || channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL; + has_err_msg = channel->ch_part[PART_ERR].ch_fd != INVALID_FD + || channel->ch_part[PART_ERR].ch_head.rq_next != NULL + || channel->ch_part[PART_ERR].ch_json_head.jq_next != NULL; + return (channel->ch_callback != NULL && (has_sock_msg + || has_out_msg || has_err_msg)) + || ((channel->ch_part[PART_OUT].ch_callback != NULL + || channel->ch_part[PART_OUT].ch_bufref.br_buf != NULL) + && has_out_msg) + || ((channel->ch_part[PART_ERR].ch_callback != NULL + || channel->ch_part[PART_ERR].ch_bufref.br_buf != NULL) + && has_err_msg); +} + +/* + * Return TRUE if "channel" is closeable (i.e. all readable fds are closed). + */ + static int +channel_can_close(channel_T *channel) +{ + return channel->ch_to_be_closed == 0; +} + +/* + * Close a channel and free all its resources. + */ + static void +channel_free_contents(channel_T *channel) +{ + channel_close(channel, TRUE); + channel_clear(channel); + ch_log(channel, "Freeing channel"); +} + + static void +channel_free_channel(channel_T *channel) +{ + if (channel->ch_next != NULL) + channel->ch_next->ch_prev = channel->ch_prev; + if (channel->ch_prev == NULL) + first_channel = channel->ch_next; + else + channel->ch_prev->ch_next = channel->ch_next; + vim_free(channel); +} + + static void +channel_free(channel_T *channel) +{ + if (!in_free_unref_items) + { + if (safe_to_invoke_callback == 0) + channel->ch_to_be_freed = TRUE; + else + { + channel_free_contents(channel); + channel_free_channel(channel); + } + } +} + +/* + * Close a channel and free all its resources if there is no further action + * possible, there is no callback to be invoked or the associated job was + * killed. + * Return TRUE if the channel was freed. + */ + static int +channel_may_free(channel_T *channel) +{ + if (!channel_still_useful(channel)) + { + channel_free(channel); + return TRUE; + } + return FALSE; +} + +/* + * Decrement the reference count on "channel" and maybe free it when it goes + * down to zero. Don't free it if there is a pending action. + * Returns TRUE when the channel is no longer referenced. + */ + int +channel_unref(channel_T *channel) +{ + if (channel != NULL && --channel->ch_refcount <= 0) + return channel_may_free(channel); + return FALSE; +} + + int +free_unused_channels_contents(int copyID, int mask) +{ + int did_free = FALSE; + channel_T *ch; + + /* This is invoked from the garbage collector, which only runs at a safe + * point. */ + ++safe_to_invoke_callback; + + for (ch = first_channel; ch != NULL; ch = ch->ch_next) + if (!channel_still_useful(ch) + && (ch->ch_copyID & mask) != (copyID & mask)) + { + /* Free the channel and ordinary items it contains, but don't + * recurse into Lists, Dictionaries etc. */ + channel_free_contents(ch); + did_free = TRUE; + } + + --safe_to_invoke_callback; + return did_free; +} + + void +free_unused_channels(int copyID, int mask) +{ + channel_T *ch; + channel_T *ch_next; + + for (ch = first_channel; ch != NULL; ch = ch_next) + { + ch_next = ch->ch_next; + if (!channel_still_useful(ch) + && (ch->ch_copyID & mask) != (copyID & mask)) + { + /* Free the channel struct itself. */ + channel_free_channel(ch); + } + } +} + +#if defined(FEAT_GUI) || defined(PROTO) + +#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) + static void +channel_read_fd(int fd) +{ + channel_T *channel; + ch_part_T part; + + channel = channel_fd2channel(fd, &part); + if (channel == NULL) + ch_error(NULL, "Channel for fd %d not found", fd); + else + channel_read(channel, part, "channel_read_fd"); +} +#endif + +/* + * Read a command from netbeans. + */ +#ifdef FEAT_GUI_X11 + static void +messageFromServerX11(XtPointer clientData, + int *unused1 UNUSED, + XtInputId *unused2 UNUSED) +{ + channel_read_fd((int)(long)clientData); +} +#endif + +#ifdef FEAT_GUI_GTK +# if GTK_CHECK_VERSION(3,0,0) + static gboolean +messageFromServerGtk3(GIOChannel *unused1 UNUSED, + GIOCondition unused2 UNUSED, + gpointer clientData) +{ + channel_read_fd(GPOINTER_TO_INT(clientData)); + return TRUE; /* Return FALSE instead in case the event source is to + * be removed after this function returns. */ +} +# else + static void +messageFromServerGtk2(gpointer clientData, + gint unused1 UNUSED, + GdkInputCondition unused2 UNUSED) +{ + channel_read_fd((int)(long)clientData); +} +# endif +#endif + + static void +channel_gui_register_one(channel_T *channel, ch_part_T part) +{ + if (!CH_HAS_GUI) + return; + + /* gets stuck in handling events for a not connected channel */ + if (channel->ch_keep_open) + return; + +# ifdef FEAT_GUI_X11 + /* Tell notifier we are interested in being called when there is input on + * the editor connection socket. */ + if (channel->ch_part[part].ch_inputHandler == (XtInputId)NULL) + { + ch_log(channel, "Registering part %s with fd %d", + part_names[part], channel->ch_part[part].ch_fd); + + channel->ch_part[part].ch_inputHandler = XtAppAddInput( + (XtAppContext)app_context, + channel->ch_part[part].ch_fd, + (XtPointer)(XtInputReadMask + XtInputExceptMask), + messageFromServerX11, + (XtPointer)(long)channel->ch_part[part].ch_fd); + } +# else +# ifdef FEAT_GUI_GTK + /* Tell gdk we are interested in being called when there is input on the + * editor connection socket. */ + if (channel->ch_part[part].ch_inputHandler == 0) + { + ch_log(channel, "Registering part %s with fd %d", + part_names[part], channel->ch_part[part].ch_fd); +# if GTK_CHECK_VERSION(3,0,0) + GIOChannel *chnnl = g_io_channel_unix_new( + (gint)channel->ch_part[part].ch_fd); + + channel->ch_part[part].ch_inputHandler = g_io_add_watch( + chnnl, + G_IO_IN|G_IO_HUP|G_IO_ERR|G_IO_PRI, + messageFromServerGtk3, + GINT_TO_POINTER(channel->ch_part[part].ch_fd)); + + g_io_channel_unref(chnnl); +# else + channel->ch_part[part].ch_inputHandler = gdk_input_add( + (gint)channel->ch_part[part].ch_fd, + (GdkInputCondition) + ((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION), + messageFromServerGtk2, + (gpointer)(long)channel->ch_part[part].ch_fd); +# endif + } +# else +# ifdef FEAT_GUI_MACVIM + /* Tell Core Foundation we are interested in being called when there + * is input on the editor connection socket. */ + if (channel->ch_part[part].ch_inputHandler == 0) + channel->ch_part[part].ch_inputHandler = gui_macvim_add_channel( + channel, part); +# endif +# endif +# endif +} + + static void +channel_gui_register(channel_T *channel) +{ + if (channel->CH_SOCK_FD != INVALID_FD) + channel_gui_register_one(channel, PART_SOCK); + if (channel->CH_OUT_FD != INVALID_FD + && channel->CH_OUT_FD != channel->CH_SOCK_FD) + channel_gui_register_one(channel, PART_OUT); + if (channel->CH_ERR_FD != INVALID_FD + && channel->CH_ERR_FD != channel->CH_SOCK_FD + && channel->CH_ERR_FD != channel->CH_OUT_FD) + channel_gui_register_one(channel, PART_ERR); +} + +/* + * Register any of our file descriptors with the GUI event handling system. + * Called when the GUI has started. + */ + void +channel_gui_register_all(void) +{ + channel_T *channel; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + channel_gui_register(channel); +} + + static void +channel_gui_unregister_one(channel_T *channel, ch_part_T part) +{ +# ifdef FEAT_GUI_X11 + if (channel->ch_part[part].ch_inputHandler != (XtInputId)NULL) + { + ch_log(channel, "Unregistering part %s", part_names[part]); + XtRemoveInput(channel->ch_part[part].ch_inputHandler); + channel->ch_part[part].ch_inputHandler = (XtInputId)NULL; + } +# else +# ifdef FEAT_GUI_GTK + if (channel->ch_part[part].ch_inputHandler != 0) + { + ch_log(channel, "Unregistering part %s", part_names[part]); +# if GTK_CHECK_VERSION(3,0,0) + g_source_remove(channel->ch_part[part].ch_inputHandler); +# else + gdk_input_remove(channel->ch_part[part].ch_inputHandler); +# endif + channel->ch_part[part].ch_inputHandler = 0; + } +# else +# ifdef FEAT_GUI_MACVIM + if (channel->ch_part[part].ch_inputHandler != 0) + { + gui_macvim_remove_channel(channel->ch_part[part].ch_inputHandler); + channel->ch_part[part].ch_inputHandler = 0; + } +# endif +# endif +# endif +} + + static void +channel_gui_unregister(channel_T *channel) +{ + ch_part_T part; + + for (part = PART_SOCK; part < PART_IN; ++part) + channel_gui_unregister_one(channel, part); +} + +#endif + +static char *e_cannot_connect = N_("E902: Cannot connect to port"); + +/* + * Open a socket channel to "hostname":"port". + * "waittime" is the time in msec to wait for the connection. + * When negative wait forever. + * Returns the channel for success. + * Returns NULL for failure. + */ + channel_T * +channel_open( + char *hostname, + int port_in, + int waittime, + void (*nb_close_cb)(void)) +{ + int sd = -1; + struct sockaddr_in server; + struct hostent *host; +#ifdef WIN32 + u_short port = port_in; + u_long val = 1; +#else + int port = port_in; +#endif + channel_T *channel; + int ret; + +#ifdef WIN32 + channel_init_winsock(); +#endif + + channel = add_channel(); + if (channel == NULL) + { + ch_error(NULL, "Cannot allocate channel."); + return NULL; + } + + /* Get the server internet address and put into addr structure */ + /* fill in the socket address structure and connect to server */ + vim_memset((char *)&server, 0, sizeof(server)); + server.sin_family = AF_INET; + server.sin_port = htons(port); + if ((host = gethostbyname(hostname)) == NULL) + { + ch_error(channel, "in gethostbyname() in channel_open()"); + PERROR(_("E901: gethostbyname() in channel_open()")); + channel_free(channel); + return NULL; + } + { + char *p; + + /* When using host->h_addr_list[0] directly ubsan warns for it to not + * be aligned. First copy the pointer to avoid that. */ + memcpy(&p, &host->h_addr_list[0], sizeof(p)); + memcpy((char *)&server.sin_addr, p, host->h_length); + } + + /* On Mac and Solaris a zero timeout almost never works. At least wait + * one millisecond. Let's do it for all systems, because we don't know why + * this is needed. */ + if (waittime == 0) + waittime = 1; + + /* + * For Unix we need to call connect() again after connect() failed. + * On Win32 one time is sufficient. + */ + while (TRUE) + { + long elapsed_msec = 0; + int waitnow; + + if (sd >= 0) + sock_close(sd); + sd = socket(AF_INET, SOCK_STREAM, 0); + if (sd == -1) + { + ch_error(channel, "in socket() in channel_open()."); + PERROR(_("E898: socket() in channel_open()")); + channel_free(channel); + return NULL; + } + + if (waittime >= 0) + { + /* Make connect() non-blocking. */ + if ( +#ifdef _WIN32 + ioctlsocket(sd, FIONBIO, &val) < 0 +#else + fcntl(sd, F_SETFL, O_NONBLOCK) < 0 +#endif + ) + { + SOCK_ERRNO; + ch_error(channel, + "channel_open: Connect failed with errno %d", errno); + sock_close(sd); + channel_free(channel); + return NULL; + } + } + + /* Try connecting to the server. */ + ch_log(channel, "Connecting to %s port %d", hostname, port); + ret = connect(sd, (struct sockaddr *)&server, sizeof(server)); + + if (ret == 0) + /* The connection could be established. */ + break; + + SOCK_ERRNO; + if (waittime < 0 || (errno != EWOULDBLOCK + && errno != ECONNREFUSED +#ifdef EINPROGRESS + && errno != EINPROGRESS +#endif + )) + { + ch_error(channel, + "channel_open: Connect failed with errno %d", errno); + PERROR(_(e_cannot_connect)); + sock_close(sd); + channel_free(channel); + return NULL; + } + + /* Limit the waittime to 50 msec. If it doesn't work within this + * time we close the socket and try creating it again. */ + waitnow = waittime > 50 ? 50 : waittime; + + /* If connect() didn't finish then try using select() to wait for the + * connection to be made. For Win32 always use select() to wait. */ +#ifndef WIN32 + if (errno != ECONNREFUSED) +#endif + { + struct timeval tv; + fd_set rfds; + fd_set wfds; +#ifndef WIN32 + int so_error = 0; + socklen_t so_error_len = sizeof(so_error); + struct timeval start_tv; + struct timeval end_tv; +#endif + FD_ZERO(&rfds); + FD_SET(sd, &rfds); + FD_ZERO(&wfds); + FD_SET(sd, &wfds); + + tv.tv_sec = waitnow / 1000; + tv.tv_usec = (waitnow % 1000) * 1000; +#ifndef WIN32 + gettimeofday(&start_tv, NULL); +#endif + ch_log(channel, + "Waiting for connection (waiting %d msec)...", waitnow); + ret = select((int)sd + 1, &rfds, &wfds, NULL, &tv); + + if (ret < 0) + { + SOCK_ERRNO; + ch_error(channel, + "channel_open: Connect failed with errno %d", errno); + PERROR(_(e_cannot_connect)); + sock_close(sd); + channel_free(channel); + return NULL; + } + +#ifdef WIN32 + /* On Win32: select() is expected to work and wait for up to + * "waitnow" msec for the socket to be open. */ + if (FD_ISSET(sd, &wfds)) + break; + elapsed_msec = waitnow; + if (waittime > 1 && elapsed_msec < waittime) + { + waittime -= elapsed_msec; + continue; + } +#else + /* On Linux-like systems: See socket(7) for the behavior + * After putting the socket in non-blocking mode, connect() will + * return EINPROGRESS, select() will not wait (as if writing is + * possible), need to use getsockopt() to check if the socket is + * actually able to connect. + * We detect a failure to connect when either read and write fds + * are set. Use getsockopt() to find out what kind of failure. */ + if (FD_ISSET(sd, &rfds) || FD_ISSET(sd, &wfds)) + { + ret = getsockopt(sd, + SOL_SOCKET, SO_ERROR, &so_error, &so_error_len); + if (ret < 0 || (so_error != 0 + && so_error != EWOULDBLOCK + && so_error != ECONNREFUSED +# ifdef EINPROGRESS + && so_error != EINPROGRESS +# endif + )) + { + ch_error(channel, + "channel_open: Connect failed with errno %d", + so_error); + PERROR(_(e_cannot_connect)); + sock_close(sd); + channel_free(channel); + return NULL; + } + } + + if (FD_ISSET(sd, &wfds) && so_error == 0) + /* Did not detect an error, connection is established. */ + break; + + gettimeofday(&end_tv, NULL); + elapsed_msec = (end_tv.tv_sec - start_tv.tv_sec) * 1000 + + (end_tv.tv_usec - start_tv.tv_usec) / 1000; +#endif + } + +#ifndef WIN32 + if (waittime > 1 && elapsed_msec < waittime) + { + /* The port isn't ready but we also didn't get an error. + * This happens when the server didn't open the socket + * yet. Select() may return early, wait until the remaining + * "waitnow" and try again. */ + waitnow -= elapsed_msec; + waittime -= elapsed_msec; + if (waitnow > 0) + { + mch_delay((long)waitnow, TRUE); + ui_breakcheck(); + waittime -= waitnow; + } + if (!got_int) + { + if (waittime <= 0) + /* give it one more try */ + waittime = 1; + continue; + } + /* we were interrupted, behave as if timed out */ + } +#endif + + /* We timed out. */ + ch_error(channel, "Connection timed out"); + sock_close(sd); + channel_free(channel); + return NULL; + } + + ch_log(channel, "Connection made"); + + if (waittime >= 0) + { +#ifdef _WIN32 + val = 0; + ioctlsocket(sd, FIONBIO, &val); +#else + (void)fcntl(sd, F_SETFL, 0); +#endif + } + + channel->CH_SOCK_FD = (sock_T)sd; + channel->ch_nb_close_cb = nb_close_cb; + channel->ch_hostname = (char *)vim_strsave((char_u *)hostname); + channel->ch_port = port_in; + channel->ch_to_be_closed |= (1U << PART_SOCK); + +#ifdef FEAT_GUI + channel_gui_register_one(channel, PART_SOCK); +#endif + + return channel; +} + +/* + * Implements ch_open(). + */ + channel_T * +channel_open_func(typval_T *argvars) +{ + char_u *address; + char_u *p; + char *rest; + int port; + jobopt_T opt; + channel_T *channel = NULL; + + address = get_tv_string(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN + && (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)) + { + EMSG(_(e_invarg)); + return NULL; + } + + /* parse address */ + p = vim_strchr(address, ':'); + if (p == NULL) + { + EMSG2(_(e_invarg2), address); + return NULL; + } + *p++ = NUL; + port = strtol((char *)p, &rest, 10); + if (*address == NUL || port <= 0 || *rest != NUL) + { + p[-1] = ':'; + EMSG2(_(e_invarg2), address); + return NULL; + } + + /* parse options */ + clear_job_options(&opt); + opt.jo_mode = MODE_JSON; + opt.jo_timeout = 2000; + if (get_job_options(&argvars[1], &opt, + JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL, 0) == FAIL) + goto theend; + if (opt.jo_timeout < 0) + { + EMSG(_(e_invarg)); + goto theend; + } + + channel = channel_open((char *)address, port, opt.jo_waittime, NULL); + if (channel != NULL) + { + opt.jo_set = JO_ALL; + channel_set_options(channel, &opt); + } +theend: + free_job_options(&opt); + return channel; +} + + static void +ch_close_part(channel_T *channel, ch_part_T part) +{ + sock_T *fd = &channel->ch_part[part].ch_fd; + + if (*fd != INVALID_FD) + { + if (part == PART_SOCK) + sock_close(*fd); + else + { + /* When using a pty the same FD is set on multiple parts, only + * close it when the last reference is closed. */ + if ((part == PART_IN || channel->CH_IN_FD != *fd) + && (part == PART_OUT || channel->CH_OUT_FD != *fd) + && (part == PART_ERR || channel->CH_ERR_FD != *fd)) + { +#ifdef WIN32 + if (channel->ch_named_pipe) + DisconnectNamedPipe((HANDLE)fd); +#endif + fd_close(*fd); + } + } + *fd = INVALID_FD; + + /* channel is closed, may want to end the job if it was the last */ + channel->ch_to_be_closed &= ~(1U << part); + } +} + + void +channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err) +{ + if (in != INVALID_FD) + { + ch_close_part(channel, PART_IN); + channel->CH_IN_FD = in; +# if defined(UNIX) + /* Do not end the job when all output channels are closed, wait until + * the job ended. */ + if (isatty(in)) + channel->ch_to_be_closed |= (1U << PART_IN); +# endif + } + if (out != INVALID_FD) + { +# if defined(FEAT_GUI) + channel_gui_unregister_one(channel, PART_OUT); +# endif + ch_close_part(channel, PART_OUT); + channel->CH_OUT_FD = out; + channel->ch_to_be_closed |= (1U << PART_OUT); +# if defined(FEAT_GUI) + channel_gui_register_one(channel, PART_OUT); +# endif + } + if (err != INVALID_FD) + { +# if defined(FEAT_GUI) + channel_gui_unregister_one(channel, PART_ERR); +# endif + ch_close_part(channel, PART_ERR); +# if defined(FEAT_GUI_MACVIM) + if (err == out && gui.in_use) + channel->CH_ERR_FD = INVALID_FD; + else +# endif + { + channel->CH_ERR_FD = err; + channel->ch_to_be_closed |= (1U << PART_ERR); +# if defined(FEAT_GUI) + channel_gui_register_one(channel, PART_ERR); +# endif + } + } +} + +/* + * Sets the job the channel is associated with and associated options. + * This does not keep a refcount, when the job is freed ch_job is cleared. + */ + void +channel_set_job(channel_T *channel, job_T *job, jobopt_T *options) +{ + channel->ch_job = job; + + channel_set_options(channel, options); + + if (job->jv_in_buf != NULL) + { + chanpart_T *in_part = &channel->ch_part[PART_IN]; + + set_bufref(&in_part->ch_bufref, job->jv_in_buf); + ch_log(channel, "reading from buffer '%s'", + (char *)in_part->ch_bufref.br_buf->b_ffname); + if (options->jo_set & JO_IN_TOP) + { + if (options->jo_in_top == 0 && !(options->jo_set & JO_IN_BOT)) + { + /* Special mode: send last-but-one line when appending a line + * to the buffer. */ + in_part->ch_bufref.br_buf->b_write_to_channel = TRUE; + in_part->ch_buf_append = TRUE; + in_part->ch_buf_top = + in_part->ch_bufref.br_buf->b_ml.ml_line_count + 1; + } + else + in_part->ch_buf_top = options->jo_in_top; + } + else + in_part->ch_buf_top = 1; + if (options->jo_set & JO_IN_BOT) + in_part->ch_buf_bot = options->jo_in_bot; + else + in_part->ch_buf_bot = in_part->ch_bufref.br_buf->b_ml.ml_line_count; + } +} + +/* + * Find a buffer matching "name" or create a new one. + * Returns NULL if there is something very wrong (error already reported). + */ + static buf_T * +find_buffer(char_u *name, int err, int msg) +{ + buf_T *buf = NULL; + buf_T *save_curbuf = curbuf; + + if (name != NULL && *name != NUL) + { + buf = buflist_findname(name); + if (buf == NULL) + buf = buflist_findname_exp(name); + } + if (buf == NULL) + { + buf = buflist_new(name == NULL || *name == NUL ? NULL : name, + NULL, (linenr_T)0, BLN_LISTED | BLN_NEW); + if (buf == NULL) + return NULL; + buf_copy_options(buf, BCO_ENTER); + curbuf = buf; +#ifdef FEAT_QUICKFIX + set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); + set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL); +#endif + if (curbuf->b_ml.ml_mfp == NULL) + ml_open(curbuf); + if (msg) + ml_replace(1, (char_u *)(err ? "Reading from channel error..." + : "Reading from channel output..."), TRUE); + changed_bytes(1, 0); + curbuf = save_curbuf; + } + + return buf; +} + + static void +set_callback( + char_u **cbp, + partial_T **pp, + char_u *callback, + partial_T *partial) +{ + free_callback(*cbp, *pp); + if (callback != NULL && *callback != NUL) + { + if (partial != NULL) + *cbp = partial_name(partial); + else + { + *cbp = vim_strsave(callback); + func_ref(*cbp); + } + } + else + *cbp = NULL; + *pp = partial; + if (partial != NULL) + ++partial->pt_refcount; +} + +/* + * Set various properties from an "opt" argument. + */ + void +channel_set_options(channel_T *channel, jobopt_T *opt) +{ + ch_part_T part; + + if (opt->jo_set & JO_MODE) + for (part = PART_SOCK; part < PART_COUNT; ++part) + channel->ch_part[part].ch_mode = opt->jo_mode; + if (opt->jo_set & JO_IN_MODE) + channel->ch_part[PART_IN].ch_mode = opt->jo_in_mode; + if (opt->jo_set & JO_OUT_MODE) + channel->ch_part[PART_OUT].ch_mode = opt->jo_out_mode; + if (opt->jo_set & JO_ERR_MODE) + channel->ch_part[PART_ERR].ch_mode = opt->jo_err_mode; + + if (opt->jo_set & JO_TIMEOUT) + for (part = PART_SOCK; part < PART_COUNT; ++part) + channel->ch_part[part].ch_timeout = opt->jo_timeout; + if (opt->jo_set & JO_OUT_TIMEOUT) + channel->ch_part[PART_OUT].ch_timeout = opt->jo_out_timeout; + if (opt->jo_set & JO_ERR_TIMEOUT) + channel->ch_part[PART_ERR].ch_timeout = opt->jo_err_timeout; + if (opt->jo_set & JO_BLOCK_WRITE) + channel->ch_part[PART_IN].ch_block_write = 1; + + if (opt->jo_set & JO_CALLBACK) + set_callback(&channel->ch_callback, &channel->ch_partial, + opt->jo_callback, opt->jo_partial); + if (opt->jo_set & JO_OUT_CALLBACK) + set_callback(&channel->ch_part[PART_OUT].ch_callback, + &channel->ch_part[PART_OUT].ch_partial, + opt->jo_out_cb, opt->jo_out_partial); + if (opt->jo_set & JO_ERR_CALLBACK) + set_callback(&channel->ch_part[PART_ERR].ch_callback, + &channel->ch_part[PART_ERR].ch_partial, + opt->jo_err_cb, opt->jo_err_partial); + if (opt->jo_set & JO_CLOSE_CALLBACK) + set_callback(&channel->ch_close_cb, &channel->ch_close_partial, + opt->jo_close_cb, opt->jo_close_partial); + channel->ch_drop_never = opt->jo_drop_never; + + if ((opt->jo_set & JO_OUT_IO) && opt->jo_io[PART_OUT] == JIO_BUFFER) + { + buf_T *buf; + + /* writing output to a buffer. Default mode is NL. */ + if (!(opt->jo_set & JO_OUT_MODE)) + channel->ch_part[PART_OUT].ch_mode = MODE_NL; + if (opt->jo_set & JO_OUT_BUF) + { + buf = buflist_findnr(opt->jo_io_buf[PART_OUT]); + if (buf == NULL) + EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[PART_OUT]); + } + else + { + int msg = TRUE; + + if (opt->jo_set2 & JO2_OUT_MSG) + msg = opt->jo_message[PART_OUT]; + buf = find_buffer(opt->jo_io_name[PART_OUT], FALSE, msg); + } + if (buf != NULL) + { + if (opt->jo_set & JO_OUT_MODIFIABLE) + channel->ch_part[PART_OUT].ch_nomodifiable = + !opt->jo_modifiable[PART_OUT]; + + if (!buf->b_p_ma && !channel->ch_part[PART_OUT].ch_nomodifiable) + { + EMSG(_(e_modifiable)); + } + else + { + ch_log(channel, "writing out to buffer '%s'", + (char *)buf->b_ffname); + set_bufref(&channel->ch_part[PART_OUT].ch_bufref, buf); + } + } + } + + if ((opt->jo_set & JO_ERR_IO) && (opt->jo_io[PART_ERR] == JIO_BUFFER + || (opt->jo_io[PART_ERR] == JIO_OUT && (opt->jo_set & JO_OUT_IO) + && opt->jo_io[PART_OUT] == JIO_BUFFER))) + { + buf_T *buf; + + /* writing err to a buffer. Default mode is NL. */ + if (!(opt->jo_set & JO_ERR_MODE)) + channel->ch_part[PART_ERR].ch_mode = MODE_NL; + if (opt->jo_io[PART_ERR] == JIO_OUT) + buf = channel->ch_part[PART_OUT].ch_bufref.br_buf; + else if (opt->jo_set & JO_ERR_BUF) + { + buf = buflist_findnr(opt->jo_io_buf[PART_ERR]); + if (buf == NULL) + EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[PART_ERR]); + } + else + { + int msg = TRUE; + + if (opt->jo_set2 & JO2_ERR_MSG) + msg = opt->jo_message[PART_ERR]; + buf = find_buffer(opt->jo_io_name[PART_ERR], TRUE, msg); + } + if (buf != NULL) + { + if (opt->jo_set & JO_ERR_MODIFIABLE) + channel->ch_part[PART_ERR].ch_nomodifiable = + !opt->jo_modifiable[PART_ERR]; + if (!buf->b_p_ma && !channel->ch_part[PART_ERR].ch_nomodifiable) + { + EMSG(_(e_modifiable)); + } + else + { + ch_log(channel, "writing err to buffer '%s'", + (char *)buf->b_ffname); + set_bufref(&channel->ch_part[PART_ERR].ch_bufref, buf); + } + } + } + + channel->ch_part[PART_OUT].ch_io = opt->jo_io[PART_OUT]; + channel->ch_part[PART_ERR].ch_io = opt->jo_io[PART_ERR]; + channel->ch_part[PART_IN].ch_io = opt->jo_io[PART_IN]; +} + +/* + * Set the callback for "channel"/"part" for the response with "id". + */ + void +channel_set_req_callback( + channel_T *channel, + ch_part_T part, + char_u *callback, + partial_T *partial, + int id) +{ + cbq_T *head = &channel->ch_part[part].ch_cb_head; + cbq_T *item = (cbq_T *)alloc((int)sizeof(cbq_T)); + + if (item != NULL) + { + item->cq_partial = partial; + if (partial != NULL) + { + ++partial->pt_refcount; + item->cq_callback = callback; + } + else + { + item->cq_callback = vim_strsave(callback); + func_ref(item->cq_callback); + } + item->cq_seq_nr = id; + item->cq_prev = head->cq_prev; + head->cq_prev = item; + item->cq_next = NULL; + if (item->cq_prev == NULL) + head->cq_next = item; + else + item->cq_prev->cq_next = item; + } +} + + static void +write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel) +{ + char_u *line = ml_get_buf(buf, lnum, FALSE); + int len = (int)STRLEN(line); + char_u *p; + int i; + + /* Need to make a copy to be able to append a NL. */ + if ((p = alloc(len + 2)) == NULL) + return; + memcpy((char *)p, (char *)line, len); + + if (channel->ch_write_text_mode) + p[len] = CAR; + else + { + for (i = 0; i < len; ++i) + if (p[i] == NL) + p[i] = NUL; + + p[len] = NL; + } + p[len + 1] = NUL; + channel_send(channel, PART_IN, p, len + 1, "write_buf_line"); + vim_free(p); +} + +/* + * Return TRUE if "channel" can be written to. + * Returns FALSE if the input is closed or the write would block. + */ + static int +can_write_buf_line(channel_T *channel) +{ + chanpart_T *in_part = &channel->ch_part[PART_IN]; + + if (in_part->ch_fd == INVALID_FD) + return FALSE; /* pipe was closed */ + + /* for testing: block every other attempt to write */ + if (in_part->ch_block_write == 1) + in_part->ch_block_write = -1; + else if (in_part->ch_block_write == -1) + in_part->ch_block_write = 1; + + /* TODO: Win32 implementation, probably using WaitForMultipleObjects() */ +#ifndef WIN32 + { +# if defined(HAVE_SELECT) + struct timeval tval; + fd_set wfds; + int ret; + + FD_ZERO(&wfds); + FD_SET((int)in_part->ch_fd, &wfds); + tval.tv_sec = 0; + tval.tv_usec = 0; + for (;;) + { + ret = select((int)in_part->ch_fd + 1, NULL, &wfds, NULL, &tval); +# ifdef EINTR + SOCK_ERRNO; + if (ret == -1 && errno == EINTR) + continue; +# endif + if (ret <= 0 || in_part->ch_block_write == 1) + { + if (ret > 0) + ch_log(channel, "FAKED Input not ready for writing"); + else + ch_log(channel, "Input not ready for writing"); + return FALSE; + } + break; + } +# else + struct pollfd fds; + + fds.fd = in_part->ch_fd; + fds.events = POLLOUT; + if (poll(&fds, 1, 0) <= 0) + { + ch_log(channel, "Input not ready for writing"); + return FALSE; + } + if (in_part->ch_block_write == 1) + { + ch_log(channel, "FAKED Input not ready for writing"); + return FALSE; + } +# endif + } +#endif + return TRUE; +} + +/* + * Write any buffer lines to the input channel. + */ + static void +channel_write_in(channel_T *channel) +{ + chanpart_T *in_part = &channel->ch_part[PART_IN]; + linenr_T lnum; + buf_T *buf = in_part->ch_bufref.br_buf; + int written = 0; + + if (buf == NULL || in_part->ch_buf_append) + return; /* no buffer or using appending */ + if (!bufref_valid(&in_part->ch_bufref) || buf->b_ml.ml_mfp == NULL) + { + /* buffer was wiped out or unloaded */ + ch_log(channel, "input buffer has been wiped out"); + in_part->ch_bufref.br_buf = NULL; + return; + } + + for (lnum = in_part->ch_buf_top; lnum <= in_part->ch_buf_bot + && lnum <= buf->b_ml.ml_line_count; ++lnum) + { + if (!can_write_buf_line(channel)) + break; + write_buf_line(buf, lnum, channel); + ++written; + } + + if (written == 1) + ch_log(channel, "written line %d to channel", (int)lnum - 1); + else if (written > 1) + ch_log(channel, "written %d lines to channel", written); + + in_part->ch_buf_top = lnum; + if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot) + { +#if defined(FEAT_TERMINAL) + /* Send CTRL-D or "eof_chars" to close stdin on MS-Windows. */ + if (channel->ch_job != NULL) + term_send_eof(channel); +#endif + + /* Writing is done, no longer need the buffer. */ + in_part->ch_bufref.br_buf = NULL; + ch_log(channel, "Finished writing all lines to channel"); + + /* Close the pipe/socket, so that the other side gets EOF. */ + ch_close_part(channel, PART_IN); + } + else + ch_log(channel, "Still %ld more lines to write", + (long)(buf->b_ml.ml_line_count - lnum + 1)); +} + +/* + * Handle buffer "buf" being freed, remove it from any channels. + */ + void +channel_buffer_free(buf_T *buf) +{ + channel_T *channel; + ch_part_T part; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + for (part = PART_SOCK; part < PART_COUNT; ++part) + { + chanpart_T *ch_part = &channel->ch_part[part]; + + if (ch_part->ch_bufref.br_buf == buf) + { + ch_log(channel, "%s buffer has been wiped out", + part_names[part]); + ch_part->ch_bufref.br_buf = NULL; + } + } +} + +/* + * Write any lines waiting to be written to "channel". + */ + static void +channel_write_input(channel_T *channel) +{ + chanpart_T *in_part = &channel->ch_part[PART_IN]; + + if (in_part->ch_writeque.wq_next != NULL) + channel_send(channel, PART_IN, (char_u *)"", 0, "channel_write_input"); + else if (in_part->ch_bufref.br_buf != NULL) + { + if (in_part->ch_buf_append) + channel_write_new_lines(in_part->ch_bufref.br_buf); + else + channel_write_in(channel); + } +} + +/* + * Write any lines waiting to be written to a channel. + */ + void +channel_write_any_lines(void) +{ + channel_T *channel; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + channel_write_input(channel); +} + +/* + * Write appended lines above the last one in "buf" to the channel. + */ + void +channel_write_new_lines(buf_T *buf) +{ + channel_T *channel; + int found_one = FALSE; + + /* There could be more than one channel for the buffer, loop over all of + * them. */ + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + chanpart_T *in_part = &channel->ch_part[PART_IN]; + linenr_T lnum; + int written = 0; + + if (in_part->ch_bufref.br_buf == buf && in_part->ch_buf_append) + { + if (in_part->ch_fd == INVALID_FD) + continue; /* pipe was closed */ + found_one = TRUE; + for (lnum = in_part->ch_buf_bot; lnum < buf->b_ml.ml_line_count; + ++lnum) + { + if (!can_write_buf_line(channel)) + break; + write_buf_line(buf, lnum, channel); + ++written; + } + + if (written == 1) + ch_log(channel, "written line %d to channel", (int)lnum - 1); + else if (written > 1) + ch_log(channel, "written %d lines to channel", written); + if (lnum < buf->b_ml.ml_line_count) + ch_log(channel, "Still %ld more lines to write", + (long)(buf->b_ml.ml_line_count - lnum)); + + in_part->ch_buf_bot = lnum; + } + } + if (!found_one) + buf->b_write_to_channel = FALSE; +} + +/* + * Invoke the "callback" on channel "channel". + * This does not redraw but sets channel_need_redraw; + */ + static void +invoke_callback(channel_T *channel, char_u *callback, partial_T *partial, + typval_T *argv) +{ + typval_T rettv; + int dummy; + + if (safe_to_invoke_callback == 0) + IEMSG("INTERNAL: Invoking callback when it is not safe"); + + argv[0].v_type = VAR_CHANNEL; + argv[0].vval.v_channel = channel; + + call_func(callback, (int)STRLEN(callback), &rettv, 2, argv, NULL, + 0L, 0L, &dummy, TRUE, partial, NULL); + clear_tv(&rettv); + channel_need_redraw = TRUE; +} + +/* + * Return the first node from "channel"/"part" without removing it. + * Returns NULL if there is nothing. + */ + readq_T * +channel_peek(channel_T *channel, ch_part_T part) +{ + readq_T *head = &channel->ch_part[part].ch_head; + + return head->rq_next; +} + +/* + * Return a pointer to the first NL in "node". + * Skips over NUL characters. + * Returns NULL if there is no NL. + */ + char_u * +channel_first_nl(readq_T *node) +{ + char_u *buffer = node->rq_buffer; + long_u i; + + for (i = 0; i < node->rq_buflen; ++i) + if (buffer[i] == NL) + return buffer + i; + return NULL; +} + +/* + * Return the first buffer from channel "channel"/"part" and remove it. + * The caller must free it. + * Returns NULL if there is nothing. + */ + char_u * +channel_get(channel_T *channel, ch_part_T part) +{ + readq_T *head = &channel->ch_part[part].ch_head; + readq_T *node = head->rq_next; + char_u *p; + + if (node == NULL) + return NULL; + /* dispose of the node but keep the buffer */ + p = node->rq_buffer; + head->rq_next = node->rq_next; + if (node->rq_next == NULL) + head->rq_prev = NULL; + else + node->rq_next->rq_prev = NULL; + vim_free(node); + return p; +} + +/* + * Returns the whole buffer contents concatenated for "channel"/"part". + * Replaces NUL bytes with NL. + */ + static char_u * +channel_get_all(channel_T *channel, ch_part_T part) +{ + readq_T *head = &channel->ch_part[part].ch_head; + readq_T *node = head->rq_next; + long_u len = 0; + char_u *res; + char_u *p; + + /* If there is only one buffer just get that one. */ + if (head->rq_next == NULL || head->rq_next->rq_next == NULL) + return channel_get(channel, part); + + /* Concatenate everything into one buffer. */ + for (node = head->rq_next; node != NULL; node = node->rq_next) + len += node->rq_buflen; + res = lalloc(len + 1, TRUE); + if (res == NULL) + return NULL; + p = res; + for (node = head->rq_next; node != NULL; node = node->rq_next) + { + mch_memmove(p, node->rq_buffer, node->rq_buflen); + p += node->rq_buflen; + } + *p = NUL; + + /* Free all buffers */ + do + { + p = channel_get(channel, part); + vim_free(p); + } while (p != NULL); + + /* turn all NUL into NL */ + while (len > 0) + { + --len; + if (res[len] == NUL) + res[len] = NL; + } + + return res; +} + +/* + * Consume "len" bytes from the head of "node". + * Caller must check these bytes are available. + */ + void +channel_consume(channel_T *channel, ch_part_T part, int len) +{ + readq_T *head = &channel->ch_part[part].ch_head; + readq_T *node = head->rq_next; + char_u *buf = node->rq_buffer; + + mch_memmove(buf, buf + len, node->rq_buflen - len); + node->rq_buflen -= len; +} + +/* + * Collapses the first and second buffer for "channel"/"part". + * Returns FAIL if that is not possible. + * When "want_nl" is TRUE collapse more buffers until a NL is found. + */ + int +channel_collapse(channel_T *channel, ch_part_T part, int want_nl) +{ + readq_T *head = &channel->ch_part[part].ch_head; + readq_T *node = head->rq_next; + readq_T *last_node; + readq_T *n; + char_u *newbuf; + char_u *p; + long_u len; + + if (node == NULL || node->rq_next == NULL) + return FAIL; + + last_node = node->rq_next; + len = node->rq_buflen + last_node->rq_buflen + 1; + if (want_nl) + while (last_node->rq_next != NULL + && channel_first_nl(last_node) == NULL) + { + last_node = last_node->rq_next; + len += last_node->rq_buflen; + } + + p = newbuf = alloc(len); + if (newbuf == NULL) + return FAIL; /* out of memory */ + mch_memmove(p, node->rq_buffer, node->rq_buflen); + p += node->rq_buflen; + vim_free(node->rq_buffer); + node->rq_buffer = newbuf; + for (n = node; n != last_node; ) + { + n = n->rq_next; + mch_memmove(p, n->rq_buffer, n->rq_buflen); + p += n->rq_buflen; + vim_free(n->rq_buffer); + } + node->rq_buflen = (long_u)(p - newbuf); + + /* dispose of the collapsed nodes and their buffers */ + for (n = node->rq_next; n != last_node; ) + { + n = n->rq_next; + vim_free(n->rq_prev); + } + node->rq_next = last_node->rq_next; + if (last_node->rq_next == NULL) + head->rq_prev = node; + else + last_node->rq_next->rq_prev = node; + vim_free(last_node); + return OK; +} + +/* + * Store "buf[len]" on "channel"/"part". + * When "prepend" is TRUE put in front, otherwise append at the end. + * Returns OK or FAIL. + */ + static int +channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len, + int prepend, char *lead) +{ + readq_T *node; + readq_T *head = &channel->ch_part[part].ch_head; + char_u *p; + int i; + + node = (readq_T *)alloc(sizeof(readq_T)); + if (node == NULL) + return FAIL; /* out of memory */ + /* A NUL is added at the end, because netbeans code expects that. + * Otherwise a NUL may appear inside the text. */ + node->rq_buffer = alloc(len + 1); + if (node->rq_buffer == NULL) + { + vim_free(node); + return FAIL; /* out of memory */ + } + + if (channel->ch_part[part].ch_mode == MODE_NL) + { + /* Drop any CR before a NL. */ + p = node->rq_buffer; + for (i = 0; i < len; ++i) + if (buf[i] != CAR || i + 1 >= len || buf[i + 1] != NL) + *p++ = buf[i]; + *p = NUL; + node->rq_buflen = (long_u)(p - node->rq_buffer); + } + else + { + mch_memmove(node->rq_buffer, buf, len); + node->rq_buffer[len] = NUL; + node->rq_buflen = (long_u)len; + } + + if (prepend) + { + /* preend node to the head of the queue */ + node->rq_next = head->rq_next; + node->rq_prev = NULL; + if (head->rq_next == NULL) + head->rq_prev = node; + else + head->rq_next->rq_prev = node; + head->rq_next = node; + } + else + { + /* append node to the tail of the queue */ + node->rq_next = NULL; + node->rq_prev = head->rq_prev; + if (head->rq_prev == NULL) + head->rq_next = node; + else + head->rq_prev->rq_next = node; + head->rq_prev = node; + } + + if (ch_log_active() && lead != NULL) + { + ch_log_lead(lead, channel); + fprintf(log_fd, "'"); + ignored = (int)fwrite(buf, len, 1, log_fd); + fprintf(log_fd, "'\n"); + } + return OK; +} + +/* + * Try to fill the buffer of "reader". + * Returns FALSE when nothing was added. + */ + static int +channel_fill(js_read_T *reader) +{ + channel_T *channel = (channel_T *)reader->js_cookie; + ch_part_T part = reader->js_cookie_arg; + char_u *next = channel_get(channel, part); + int keeplen; + int addlen; + char_u *p; + + if (next == NULL) + return FALSE; + + keeplen = reader->js_end - reader->js_buf; + if (keeplen > 0) + { + /* Prepend unused text. */ + addlen = (int)STRLEN(next); + p = alloc(keeplen + addlen + 1); + if (p == NULL) + { + vim_free(next); + return FALSE; + } + mch_memmove(p, reader->js_buf, keeplen); + mch_memmove(p + keeplen, next, addlen + 1); + vim_free(next); + next = p; + } + + vim_free(reader->js_buf); + reader->js_buf = next; + return TRUE; +} + +/* + * Use the read buffer of "channel"/"part" and parse a JSON message that is + * complete. The messages are added to the queue. + * Return TRUE if there is more to read. + */ + static int +channel_parse_json(channel_T *channel, ch_part_T part) +{ + js_read_T reader; + typval_T listtv; + jsonq_T *item; + chanpart_T *chanpart = &channel->ch_part[part]; + jsonq_T *head = &chanpart->ch_json_head; + int status; + int ret; + + if (channel_peek(channel, part) == NULL) + return FALSE; + + reader.js_buf = channel_get(channel, part); + reader.js_used = 0; + reader.js_fill = channel_fill; + reader.js_cookie = channel; + reader.js_cookie_arg = part; + + /* When a message is incomplete we wait for a short while for more to + * arrive. After the delay drop the input, otherwise a truncated string + * or list will make us hang. + * Do not generate error messages, they will be written in a channel log. */ + ++emsg_silent; + status = json_decode(&reader, &listtv, + chanpart->ch_mode == MODE_JS ? JSON_JS : 0); + --emsg_silent; + if (status == OK) + { + /* Only accept the response when it is a list with at least two + * items. */ + if (listtv.v_type != VAR_LIST || listtv.vval.v_list->lv_len < 2) + { + if (listtv.v_type != VAR_LIST) + ch_error(channel, "Did not receive a list, discarding"); + else + ch_error(channel, "Expected list with two items, got %d", + listtv.vval.v_list->lv_len); + clear_tv(&listtv); + } + else + { + item = (jsonq_T *)alloc((unsigned)sizeof(jsonq_T)); + if (item == NULL) + clear_tv(&listtv); + else + { + item->jq_no_callback = FALSE; + item->jq_value = alloc_tv(); + if (item->jq_value == NULL) + { + vim_free(item); + clear_tv(&listtv); + } + else + { + *item->jq_value = listtv; + item->jq_prev = head->jq_prev; + head->jq_prev = item; + item->jq_next = NULL; + if (item->jq_prev == NULL) + head->jq_next = item; + else + item->jq_prev->jq_next = item; + } + } + } + } + + if (status == OK) + chanpart->ch_wait_len = 0; + else if (status == MAYBE) + { + size_t buflen = STRLEN(reader.js_buf); + + if (chanpart->ch_wait_len < buflen) + { + /* First time encountering incomplete message or after receiving + * more (but still incomplete): set a deadline of 100 msec. */ + ch_log(channel, + "Incomplete message (%d bytes) - wait 100 msec for more", + (int)buflen); + reader.js_used = 0; + chanpart->ch_wait_len = buflen; +#ifdef WIN32 + chanpart->ch_deadline = GetTickCount() + 100L; +#else + gettimeofday(&chanpart->ch_deadline, NULL); + chanpart->ch_deadline.tv_usec += 100 * 1000; + if (chanpart->ch_deadline.tv_usec > 1000 * 1000) + { + chanpart->ch_deadline.tv_usec -= 1000 * 1000; + ++chanpart->ch_deadline.tv_sec; + } +#endif + } + else + { + int timeout; +#ifdef WIN32 + timeout = GetTickCount() > chanpart->ch_deadline; +#else + { + struct timeval now_tv; + + gettimeofday(&now_tv, NULL); + timeout = now_tv.tv_sec > chanpart->ch_deadline.tv_sec + || (now_tv.tv_sec == chanpart->ch_deadline.tv_sec + && now_tv.tv_usec > chanpart->ch_deadline.tv_usec); + } +#endif + if (timeout) + { + status = FAIL; + chanpart->ch_wait_len = 0; + ch_log(channel, "timed out"); + } + else + { + reader.js_used = 0; + ch_log(channel, "still waiting on incomplete message"); + } + } + } + + if (status == FAIL) + { + ch_error(channel, "Decoding failed - discarding input"); + ret = FALSE; + chanpart->ch_wait_len = 0; + } + else if (reader.js_buf[reader.js_used] != NUL) + { + /* Put the unread part back into the channel. */ + channel_save(channel, part, reader.js_buf + reader.js_used, + (int)(reader.js_end - reader.js_buf) - reader.js_used, + TRUE, NULL); + ret = status == MAYBE ? FALSE: TRUE; + } + else + ret = FALSE; + + vim_free(reader.js_buf); + return ret; +} + +/* + * Remove "node" from the queue that it is in. Does not free it. + */ + static void +remove_cb_node(cbq_T *head, cbq_T *node) +{ + if (node->cq_prev == NULL) + head->cq_next = node->cq_next; + else + node->cq_prev->cq_next = node->cq_next; + if (node->cq_next == NULL) + head->cq_prev = node->cq_prev; + else + node->cq_next->cq_prev = node->cq_prev; +} + +/* + * Remove "node" from the queue that it is in and free it. + * Caller should have freed or used node->jq_value. + */ + static void +remove_json_node(jsonq_T *head, jsonq_T *node) +{ + if (node->jq_prev == NULL) + head->jq_next = node->jq_next; + else + node->jq_prev->jq_next = node->jq_next; + if (node->jq_next == NULL) + head->jq_prev = node->jq_prev; + else + node->jq_next->jq_prev = node->jq_prev; + vim_free(node); +} + +/* + * Get a message from the JSON queue for channel "channel". + * When "id" is positive it must match the first number in the list. + * When "id" is zero or negative jut get the first message. But not the one + * with id ch_block_id. + * When "without_callback" is TRUE also get messages that were pushed back. + * Return OK when found and return the value in "rettv". + * Return FAIL otherwise. + */ + static int +channel_get_json( + channel_T *channel, + ch_part_T part, + int id, + int without_callback, + typval_T **rettv) +{ + jsonq_T *head = &channel->ch_part[part].ch_json_head; + jsonq_T *item = head->jq_next; + + while (item != NULL) + { + list_T *l = item->jq_value->vval.v_list; + typval_T *tv = &l->lv_first->li_tv; + + if ((without_callback || !item->jq_no_callback) + && ((id > 0 && tv->v_type == VAR_NUMBER && tv->vval.v_number == id) + || (id <= 0 && (tv->v_type != VAR_NUMBER + || tv->vval.v_number == 0 + || tv->vval.v_number != channel->ch_part[part].ch_block_id)))) + { + *rettv = item->jq_value; + if (tv->v_type == VAR_NUMBER) + ch_log(channel, "Getting JSON message %ld", + (long)tv->vval.v_number); + remove_json_node(head, item); + return OK; + } + item = item->jq_next; + } + return FAIL; +} + +/* + * Put back "rettv" into the JSON queue, there was no callback for it. + * Takes over the values in "rettv". + */ + static void +channel_push_json(channel_T *channel, ch_part_T part, typval_T *rettv) +{ + jsonq_T *head = &channel->ch_part[part].ch_json_head; + jsonq_T *item = head->jq_next; + jsonq_T *newitem; + + if (head->jq_prev != NULL && head->jq_prev->jq_no_callback) + /* last item was pushed back, append to the end */ + item = NULL; + else while (item != NULL && item->jq_no_callback) + /* append after the last item that was pushed back */ + item = item->jq_next; + + newitem = (jsonq_T *)alloc((unsigned)sizeof(jsonq_T)); + if (newitem == NULL) + clear_tv(rettv); + else + { + newitem->jq_value = alloc_tv(); + if (newitem->jq_value == NULL) + { + vim_free(newitem); + clear_tv(rettv); + } + else + { + newitem->jq_no_callback = FALSE; + *newitem->jq_value = *rettv; + if (item == NULL) + { + /* append to the end */ + newitem->jq_prev = head->jq_prev; + head->jq_prev = newitem; + newitem->jq_next = NULL; + if (newitem->jq_prev == NULL) + head->jq_next = newitem; + else + newitem->jq_prev->jq_next = newitem; + } + else + { + /* append after "item" */ + newitem->jq_prev = item; + newitem->jq_next = item->jq_next; + item->jq_next = newitem; + if (newitem->jq_next == NULL) + head->jq_prev = newitem; + else + newitem->jq_next->jq_prev = newitem; + } + } + } +} + +#define CH_JSON_MAX_ARGS 4 + +/* + * Execute a command received over "channel"/"part" + * "argv[0]" is the command string. + * "argv[1]" etc. have further arguments, type is VAR_UNKNOWN if missing. + */ + static void +channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) +{ + char_u *cmd = argv[0].vval.v_string; + char_u *arg; + int options = channel->ch_part[part].ch_mode == MODE_JS ? JSON_JS : 0; + + if (argv[1].v_type != VAR_STRING) + { + ch_error(channel, "received command with non-string argument"); + if (p_verbose > 2) + EMSG(_("E903: received command with non-string argument")); + return; + } + arg = argv[1].vval.v_string; + if (arg == NULL) + arg = (char_u *)""; + + if (STRCMP(cmd, "ex") == 0) + { + int save_called_emsg = called_emsg; + + called_emsg = FALSE; + ch_log(channel, "Executing ex command '%s'", (char *)arg); + ++emsg_silent; + do_cmdline_cmd(arg); + --emsg_silent; + if (called_emsg) + ch_log(channel, "Ex command error: '%s'", + (char *)get_vim_var_str(VV_ERRMSG)); + called_emsg = save_called_emsg; + } + else if (STRCMP(cmd, "normal") == 0) + { + exarg_T ea; + + ch_log(channel, "Executing normal command '%s'", (char *)arg); + ea.arg = arg; + ea.addr_count = 0; + ea.forceit = TRUE; /* no mapping */ + ex_normal(&ea); + } + else if (STRCMP(cmd, "redraw") == 0) + { + exarg_T ea; + + ch_log(channel, "redraw"); + ea.forceit = *arg != NUL; + ex_redraw(&ea); + showruler(FALSE); + setcursor(); + out_flush_cursor(TRUE, FALSE); + } + else if (STRCMP(cmd, "expr") == 0 || STRCMP(cmd, "call") == 0) + { + int is_call = cmd[0] == 'c'; + int id_idx = is_call ? 3 : 2; + + if (argv[id_idx].v_type != VAR_UNKNOWN + && argv[id_idx].v_type != VAR_NUMBER) + { + ch_error(channel, "last argument for expr/call must be a number"); + if (p_verbose > 2) + EMSG(_("E904: last argument for expr/call must be a number")); + } + else if (is_call && argv[2].v_type != VAR_LIST) + { + ch_error(channel, "third argument for call must be a list"); + if (p_verbose > 2) + EMSG(_("E904: third argument for call must be a list")); + } + else + { + typval_T *tv = NULL; + typval_T res_tv; + typval_T err_tv; + char_u *json = NULL; + + /* Don't pollute the display with errors. */ + ++emsg_skip; + if (!is_call) + { + ch_log(channel, "Evaluating expression '%s'", (char *)arg); + tv = eval_expr(arg, NULL); + } + else + { + ch_log(channel, "Calling '%s'", (char *)arg); + if (func_call(arg, &argv[2], NULL, NULL, &res_tv) == OK) + tv = &res_tv; + } + + if (argv[id_idx].v_type == VAR_NUMBER) + { + int id = argv[id_idx].vval.v_number; + + if (tv != NULL) + json = json_encode_nr_expr(id, tv, options | JSON_NL); + if (tv == NULL || (json != NULL && *json == NUL)) + { + /* If evaluation failed or the result can't be encoded + * then return the string "ERROR". */ + vim_free(json); + err_tv.v_type = VAR_STRING; + err_tv.vval.v_string = (char_u *)"ERROR"; + json = json_encode_nr_expr(id, &err_tv, options | JSON_NL); + } + if (json != NULL) + { + channel_send(channel, + part == PART_SOCK ? PART_SOCK : PART_IN, + json, (int)STRLEN(json), (char *)cmd); + vim_free(json); + } + } + --emsg_skip; + if (tv == &res_tv) + clear_tv(tv); + else + free_tv(tv); + } + } + else if (p_verbose > 2) + { + ch_error(channel, "Received unknown command: %s", (char *)cmd); + EMSG2(_("E905: received unknown command: %s"), cmd); + } +} + +/* + * Invoke the callback at "cbhead". + * Does not redraw but sets channel_need_redraw. + */ + static void +invoke_one_time_callback( + channel_T *channel, + cbq_T *cbhead, + cbq_T *item, + typval_T *argv) +{ + ch_log(channel, "Invoking one-time callback %s", + (char *)item->cq_callback); + /* Remove the item from the list first, if the callback + * invokes ch_close() the list will be cleared. */ + remove_cb_node(cbhead, item); + invoke_callback(channel, item->cq_callback, item->cq_partial, argv); + free_callback(item->cq_callback, item->cq_partial); + vim_free(item); +} + + static void +append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, ch_part_T part) +{ + bufref_T save_curbuf = {NULL, 0, 0}; + win_T *save_curwin = NULL; + tabpage_T *save_curtab = NULL; + linenr_T lnum = buffer->b_ml.ml_line_count; + int save_write_to = buffer->b_write_to_channel; + chanpart_T *ch_part = &channel->ch_part[part]; + int save_p_ma = buffer->b_p_ma; + int empty = (buffer->b_ml.ml_flags & ML_EMPTY) ? 1 : 0; + + if (!buffer->b_p_ma && !ch_part->ch_nomodifiable) + { + if (!ch_part->ch_nomod_error) + { + ch_error(channel, "Buffer is not modifiable, cannot append"); + ch_part->ch_nomod_error = TRUE; + } + return; + } + + /* If the buffer is also used as input insert above the last + * line. Don't write these lines. */ + if (save_write_to) + { + --lnum; + buffer->b_write_to_channel = FALSE; + } + + /* Append to the buffer */ + ch_log(channel, "appending line %d to buffer", (int)lnum + 1 - empty); + + buffer->b_p_ma = TRUE; + + /* Save curbuf/curwin/curtab and make "buffer" the current buffer. */ + switch_to_win_for_buf(buffer, &save_curwin, &save_curtab, &save_curbuf); + + u_sync(TRUE); + /* ignore undo failure, undo is not very useful here */ + ignored = u_save(lnum - empty, lnum + 1); + + if (empty) + { + /* The buffer is empty, replace the first (dummy) line. */ + ml_replace(lnum, msg, TRUE); + lnum = 0; + } + else + ml_append(lnum, msg, 0, FALSE); + appended_lines_mark(lnum, 1L); + + /* Restore curbuf/curwin/curtab */ + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); + + if (ch_part->ch_nomodifiable) + buffer->b_p_ma = FALSE; + else + buffer->b_p_ma = save_p_ma; + + if (buffer->b_nwindows > 0) + { + win_T *wp; + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == buffer + && (save_write_to + ? wp->w_cursor.lnum == lnum + 1 + : (wp->w_cursor.lnum == lnum + && wp->w_cursor.col == 0))) + { + ++wp->w_cursor.lnum; + save_curwin = curwin; + curwin = wp; + curbuf = curwin->w_buffer; + scroll_cursor_bot(0, FALSE); + curwin = save_curwin; + curbuf = curwin->w_buffer; + } + } + redraw_buf_and_status_later(buffer, VALID); + channel_need_redraw = TRUE; + } + + if (save_write_to) + { + channel_T *ch; + + /* Find channels reading from this buffer and adjust their + * next-to-read line number. */ + buffer->b_write_to_channel = TRUE; + for (ch = first_channel; ch != NULL; ch = ch->ch_next) + { + chanpart_T *in_part = &ch->ch_part[PART_IN]; + + if (in_part->ch_bufref.br_buf == buffer) + in_part->ch_buf_bot = buffer->b_ml.ml_line_count; + } + } +} + + static void +drop_messages(channel_T *channel, ch_part_T part) +{ + char_u *msg; + + while ((msg = channel_get(channel, part)) != NULL) + { + ch_log(channel, "Dropping message '%s'", (char *)msg); + vim_free(msg); + } +} + +/* + * Invoke a callback for "channel"/"part" if needed. + * This does not redraw but sets channel_need_redraw when redraw is needed. + * Return TRUE when a message was handled, there might be another one. + */ + static int +may_invoke_callback(channel_T *channel, ch_part_T part) +{ + char_u *msg = NULL; + typval_T *listtv = NULL; + typval_T argv[CH_JSON_MAX_ARGS]; + int seq_nr = -1; + chanpart_T *ch_part = &channel->ch_part[part]; + ch_mode_T ch_mode = ch_part->ch_mode; + cbq_T *cbhead = &ch_part->ch_cb_head; + cbq_T *cbitem; + char_u *callback = NULL; + partial_T *partial = NULL; + buf_T *buffer = NULL; + char_u *p; + + if (channel->ch_nb_close_cb != NULL) + /* this channel is handled elsewhere (netbeans) */ + return FALSE; + + /* Use a message-specific callback, part callback or channel callback */ + for (cbitem = cbhead->cq_next; cbitem != NULL; cbitem = cbitem->cq_next) + if (cbitem->cq_seq_nr == 0) + break; + if (cbitem != NULL) + { + callback = cbitem->cq_callback; + partial = cbitem->cq_partial; + } + else if (ch_part->ch_callback != NULL) + { + callback = ch_part->ch_callback; + partial = ch_part->ch_partial; + } + else + { + callback = channel->ch_callback; + partial = channel->ch_partial; + } + + buffer = ch_part->ch_bufref.br_buf; + if (buffer != NULL && (!bufref_valid(&ch_part->ch_bufref) + || buffer->b_ml.ml_mfp == NULL)) + { + /* buffer was wiped out or unloaded */ + ch_log(channel, "%s buffer has been wiped out", part_names[part]); + ch_part->ch_bufref.br_buf = NULL; + buffer = NULL; + } + + if (ch_mode == MODE_JSON || ch_mode == MODE_JS) + { + listitem_T *item; + int argc = 0; + + /* Get any json message in the queue. */ + if (channel_get_json(channel, part, -1, FALSE, &listtv) == FAIL) + { + /* Parse readahead, return when there is still no message. */ + channel_parse_json(channel, part); + if (channel_get_json(channel, part, -1, FALSE, &listtv) == FAIL) + return FALSE; + } + + for (item = listtv->vval.v_list->lv_first; + item != NULL && argc < CH_JSON_MAX_ARGS; + item = item->li_next) + argv[argc++] = item->li_tv; + while (argc < CH_JSON_MAX_ARGS) + argv[argc++].v_type = VAR_UNKNOWN; + + if (argv[0].v_type == VAR_STRING) + { + /* ["cmd", arg] or ["cmd", arg, arg] or ["cmd", arg, arg, arg] */ + channel_exe_cmd(channel, part, argv); + free_tv(listtv); + return TRUE; + } + + if (argv[0].v_type != VAR_NUMBER) + { + ch_error(channel, + "Dropping message with invalid sequence number type"); + free_tv(listtv); + return FALSE; + } + seq_nr = argv[0].vval.v_number; + } + else if (channel_peek(channel, part) == NULL) + { + /* nothing to read on RAW or NL channel */ + return FALSE; + } + else + { + /* If there is no callback or buffer drop the message. */ + if (callback == NULL && buffer == NULL) + { + /* If there is a close callback it may use ch_read() to get the + * messages. */ + if (channel->ch_close_cb == NULL && !channel->ch_drop_never) + drop_messages(channel, part); + return FALSE; + } + + if (ch_mode == MODE_NL) + { + char_u *nl = NULL; + char_u *buf; + readq_T *node; + + /* See if we have a message ending in NL in the first buffer. If + * not try to concatenate the first and the second buffer. */ + while (TRUE) + { + node = channel_peek(channel, part); + nl = channel_first_nl(node); + if (nl != NULL) + break; + if (channel_collapse(channel, part, TRUE) == FAIL) + { + if (ch_part->ch_fd == INVALID_FD && node->rq_buflen > 0) + break; + return FALSE; /* incomplete message */ + } + } + buf = node->rq_buffer; + + if (nl == NULL) + { + /* Flush remaining message that is missing a NL. */ + char_u *new_buf; + + new_buf = vim_realloc(buf, node->rq_buflen + 1); + if (new_buf == NULL) + /* This might fail over and over again, should the message + * be dropped? */ + return FALSE; + buf = new_buf; + node->rq_buffer = buf; + nl = buf + node->rq_buflen++; + *nl = NUL; + } + + /* Convert NUL to NL, the internal representation. */ + for (p = buf; p < nl && p < buf + node->rq_buflen; ++p) + if (*p == NUL) + *p = NL; + + if (nl + 1 == buf + node->rq_buflen) + { + /* get the whole buffer, drop the NL */ + msg = channel_get(channel, part); + *nl = NUL; + } + else + { + /* Copy the message into allocated memory (excluding the NL) + * and remove it from the buffer (including the NL). */ + msg = vim_strnsave(buf, (int)(nl - buf)); + channel_consume(channel, part, (int)(nl - buf) + 1); + } + } + else + { + /* For a raw channel we don't know where the message ends, just + * get everything we have. + * Convert NUL to NL, the internal representation. */ + msg = channel_get_all(channel, part); + } + + if (msg == NULL) + return FALSE; /* out of memory (and avoids Coverity warning) */ + + argv[1].v_type = VAR_STRING; + argv[1].vval.v_string = msg; + } + + if (seq_nr > 0) + { + int done = FALSE; + + /* JSON or JS mode: invoke the one-time callback with the matching nr */ + for (cbitem = cbhead->cq_next; cbitem != NULL; cbitem = cbitem->cq_next) + if (cbitem->cq_seq_nr == seq_nr) + { + invoke_one_time_callback(channel, cbhead, cbitem, argv); + done = TRUE; + break; + } + if (!done) + { + if (channel->ch_drop_never) + { + /* message must be read with ch_read() */ + channel_push_json(channel, part, listtv); + listtv = NULL; + } + else + ch_log(channel, "Dropping message %d without callback", + seq_nr); + } + } + else if (callback != NULL || buffer != NULL) + { + if (buffer != NULL) + { + if (msg == NULL) + /* JSON or JS mode: re-encode the message. */ + msg = json_encode(listtv, ch_mode); + if (msg != NULL) + { +#ifdef FEAT_TERMINAL + if (buffer->b_term != NULL) + write_to_term(buffer, msg, channel); + else +#endif + append_to_buffer(buffer, msg, channel, part); + } + } + + if (callback != NULL) + { + if (cbitem != NULL) + invoke_one_time_callback(channel, cbhead, cbitem, argv); + else + { + /* invoke the channel callback */ + ch_log(channel, "Invoking channel callback %s", + (char *)callback); + invoke_callback(channel, callback, partial, argv); + } + } + } + else + ch_log(channel, "Dropping message %d", seq_nr); + + if (listtv != NULL) + free_tv(listtv); + vim_free(msg); + + return TRUE; +} + +/* + * Return TRUE when channel "channel" is open for writing to. + * Also returns FALSE or invalid "channel". + */ + int +channel_can_write_to(channel_T *channel) +{ + return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD + || channel->CH_IN_FD != INVALID_FD); +} + +/* + * Return TRUE when channel "channel" is open for reading or writing. + * Also returns FALSE for invalid "channel". + */ + int +channel_is_open(channel_T *channel) +{ + return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD + || channel->CH_IN_FD != INVALID_FD + || channel->CH_OUT_FD != INVALID_FD + || channel->CH_ERR_FD != INVALID_FD); +} + +/* + * Return TRUE if "channel" has JSON or other typeahead. + */ + int +channel_has_readahead(channel_T *channel, ch_part_T part) +{ + ch_mode_T ch_mode = channel->ch_part[part].ch_mode; + + if (ch_mode == MODE_JSON || ch_mode == MODE_JS) + { + jsonq_T *head = &channel->ch_part[part].ch_json_head; + jsonq_T *item = head->jq_next; + + return item != NULL; + } + return channel_peek(channel, part) != NULL; +} + +/* + * Return a string indicating the status of the channel. + * If "req_part" is not negative check that part. + */ + char * +channel_status(channel_T *channel, int req_part) +{ + ch_part_T part; + int has_readahead = FALSE; + + if (channel == NULL) + return "fail"; + if (req_part == PART_OUT) + { + if (channel->CH_OUT_FD != INVALID_FD) + return "open"; + if (channel_has_readahead(channel, PART_OUT)) + has_readahead = TRUE; + } + else if (req_part == PART_ERR) + { + if (channel->CH_ERR_FD != INVALID_FD) + return "open"; + if (channel_has_readahead(channel, PART_ERR)) + has_readahead = TRUE; + } + else + { + if (channel_is_open(channel)) + return "open"; + for (part = PART_SOCK; part < PART_IN; ++part) + if (channel_has_readahead(channel, part)) + { + has_readahead = TRUE; + break; + } + } + + if (has_readahead) + return "buffered"; + return "closed"; +} + + static void +channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part) +{ + chanpart_T *chanpart = &channel->ch_part[part]; + char namebuf[20]; /* longest is "sock_timeout" */ + size_t tail; + char *status; + char *s = ""; + + vim_strncpy((char_u *)namebuf, (char_u *)name, 4); + STRCAT(namebuf, "_"); + tail = STRLEN(namebuf); + + STRCPY(namebuf + tail, "status"); + if (chanpart->ch_fd != INVALID_FD) + status = "open"; + else if (channel_has_readahead(channel, part)) + status = "buffered"; + else + status = "closed"; + dict_add_nr_str(dict, namebuf, 0, (char_u *)status); + + STRCPY(namebuf + tail, "mode"); + switch (chanpart->ch_mode) + { + case MODE_NL: s = "NL"; break; + case MODE_RAW: s = "RAW"; break; + case MODE_JSON: s = "JSON"; break; + case MODE_JS: s = "JS"; break; + } + dict_add_nr_str(dict, namebuf, 0, (char_u *)s); + + STRCPY(namebuf + tail, "io"); + if (part == PART_SOCK) + s = "socket"; + else switch (chanpart->ch_io) + { + case JIO_NULL: s = "null"; break; + case JIO_PIPE: s = "pipe"; break; + case JIO_FILE: s = "file"; break; + case JIO_BUFFER: s = "buffer"; break; + case JIO_OUT: s = "out"; break; + } + dict_add_nr_str(dict, namebuf, 0, (char_u *)s); + + STRCPY(namebuf + tail, "timeout"); + dict_add_nr_str(dict, namebuf, chanpart->ch_timeout, NULL); +} + + void +channel_info(channel_T *channel, dict_T *dict) +{ + dict_add_nr_str(dict, "id", channel->ch_id, NULL); + dict_add_nr_str(dict, "status", 0, (char_u *)channel_status(channel, -1)); + + if (channel->ch_hostname != NULL) + { + dict_add_nr_str(dict, "hostname", 0, (char_u *)channel->ch_hostname); + dict_add_nr_str(dict, "port", channel->ch_port, NULL); + channel_part_info(channel, dict, "sock", PART_SOCK); + } + else + { + channel_part_info(channel, dict, "out", PART_OUT); + channel_part_info(channel, dict, "err", PART_ERR); + channel_part_info(channel, dict, "in", PART_IN); + } +} + +/* + * Close channel "channel". + * Trigger the close callback if "invoke_close_cb" is TRUE. + * Does not clear the buffers. + */ + void +channel_close(channel_T *channel, int invoke_close_cb) +{ + ch_log(channel, "Closing channel"); + +#ifdef FEAT_GUI + channel_gui_unregister(channel); +#endif + + ch_close_part(channel, PART_SOCK); + ch_close_part(channel, PART_IN); + ch_close_part(channel, PART_OUT); + ch_close_part(channel, PART_ERR); + + if (invoke_close_cb) + { + ch_part_T part; + + /* Invoke callbacks and flush buffers before the close callback. */ + if (channel->ch_close_cb != NULL) + ch_log(channel, + "Invoking callbacks and flushing buffers before closing"); + for (part = PART_SOCK; part < PART_IN; ++part) + { + if (channel->ch_close_cb != NULL + || channel->ch_part[part].ch_bufref.br_buf != NULL) + { + /* Increment the refcount to avoid the channel being freed + * halfway. */ + ++channel->ch_refcount; + if (channel->ch_close_cb == NULL) + ch_log(channel, "flushing %s buffers before closing", + part_names[part]); + while (may_invoke_callback(channel, part)) + ; + --channel->ch_refcount; + } + } + + if (channel->ch_close_cb != NULL) + { + typval_T argv[1]; + typval_T rettv; + int dummy; + + /* Increment the refcount to avoid the channel being freed + * halfway. */ + ++channel->ch_refcount; + ch_log(channel, "Invoking close callback %s", + (char *)channel->ch_close_cb); + argv[0].v_type = VAR_CHANNEL; + argv[0].vval.v_channel = channel; + call_func(channel->ch_close_cb, (int)STRLEN(channel->ch_close_cb), + &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, + channel->ch_close_partial, NULL); + clear_tv(&rettv); + channel_need_redraw = TRUE; + + /* the callback is only called once */ + free_callback(channel->ch_close_cb, channel->ch_close_partial); + channel->ch_close_cb = NULL; + channel->ch_close_partial = NULL; + + if (channel_need_redraw) + { + channel_need_redraw = FALSE; + redraw_after_callback(TRUE); + } + + if (!channel->ch_drop_never) + /* any remaining messages are useless now */ + for (part = PART_SOCK; part < PART_IN; ++part) + drop_messages(channel, part); + + --channel->ch_refcount; + } + } + + channel->ch_nb_close_cb = NULL; + +#ifdef FEAT_TERMINAL + term_channel_closed(channel); +#endif +} + +/* + * Close the "in" part channel "channel". + */ + void +channel_close_in(channel_T *channel) +{ + ch_close_part(channel, PART_IN); +} + + static void +remove_from_writeque(writeq_T *wq, writeq_T *entry) +{ + ga_clear(&entry->wq_ga); + wq->wq_next = entry->wq_next; + if (wq->wq_next == NULL) + wq->wq_prev = NULL; + else + wq->wq_next->wq_prev = NULL; + vim_free(entry); +} + +/* + * Clear the read buffer on "channel"/"part". + */ + static void +channel_clear_one(channel_T *channel, ch_part_T part) +{ + chanpart_T *ch_part = &channel->ch_part[part]; + jsonq_T *json_head = &ch_part->ch_json_head; + cbq_T *cb_head = &ch_part->ch_cb_head; + + while (channel_peek(channel, part) != NULL) + vim_free(channel_get(channel, part)); + + while (cb_head->cq_next != NULL) + { + cbq_T *node = cb_head->cq_next; + + remove_cb_node(cb_head, node); + free_callback(node->cq_callback, node->cq_partial); + vim_free(node); + } + + while (json_head->jq_next != NULL) + { + free_tv(json_head->jq_next->jq_value); + remove_json_node(json_head, json_head->jq_next); + } + + free_callback(ch_part->ch_callback, ch_part->ch_partial); + ch_part->ch_callback = NULL; + ch_part->ch_partial = NULL; + + while (ch_part->ch_writeque.wq_next != NULL) + remove_from_writeque(&ch_part->ch_writeque, + ch_part->ch_writeque.wq_next); +} + +/* + * Clear all the read buffers on "channel". + */ + void +channel_clear(channel_T *channel) +{ + ch_log(channel, "Clearing channel"); + VIM_CLEAR(channel->ch_hostname); + channel_clear_one(channel, PART_SOCK); + channel_clear_one(channel, PART_OUT); + channel_clear_one(channel, PART_ERR); + channel_clear_one(channel, PART_IN); + free_callback(channel->ch_callback, channel->ch_partial); + channel->ch_callback = NULL; + channel->ch_partial = NULL; + free_callback(channel->ch_close_cb, channel->ch_close_partial); + channel->ch_close_cb = NULL; + channel->ch_close_partial = NULL; +} + +#if defined(EXITFREE) || defined(PROTO) + void +channel_free_all(void) +{ + channel_T *channel; + + ch_log(NULL, "channel_free_all()"); + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + channel_clear(channel); +} +#endif + + +/* Sent when the netbeans channel is found closed when reading. */ +#define DETACH_MSG_RAW "DETACH\n" + +/* Buffer size for reading incoming messages. */ +#define MAXMSGSIZE 4096 + +#if defined(HAVE_SELECT) +/* + * Add write fds where we are waiting for writing to be possible. + */ + static int +channel_fill_wfds(int maxfd_arg, fd_set *wfds) +{ + int maxfd = maxfd_arg; + channel_T *ch; + + for (ch = first_channel; ch != NULL; ch = ch->ch_next) + { + chanpart_T *in_part = &ch->ch_part[PART_IN]; + + if (in_part->ch_fd != INVALID_FD + && (in_part->ch_bufref.br_buf != NULL + || in_part->ch_writeque.wq_next != NULL)) + { + FD_SET((int)in_part->ch_fd, wfds); + if ((int)in_part->ch_fd >= maxfd) + maxfd = (int)in_part->ch_fd + 1; + } + } + return maxfd; +} +#else +/* + * Add write fds where we are waiting for writing to be possible. + */ + static int +channel_fill_poll_write(int nfd_in, struct pollfd *fds) +{ + int nfd = nfd_in; + channel_T *ch; + + for (ch = first_channel; ch != NULL; ch = ch->ch_next) + { + chanpart_T *in_part = &ch->ch_part[PART_IN]; + + if (in_part->ch_fd != INVALID_FD + && (in_part->ch_bufref.br_buf != NULL + || in_part->ch_writeque.wq_next != NULL)) + { + in_part->ch_poll_idx = nfd; + fds[nfd].fd = in_part->ch_fd; + fds[nfd].events = POLLOUT; + ++nfd; + } + else + in_part->ch_poll_idx = -1; + } + return nfd; +} +#endif + +typedef enum { + CW_READY, + CW_NOT_READY, + CW_ERROR +} channel_wait_result; + +/* + * Check for reading from "fd" with "timeout" msec. + * Return CW_READY when there is something to read. + * Return CW_NOT_READY when there is nothing to read. + * Return CW_ERROR when there is an error. + */ + static channel_wait_result +channel_wait(channel_T *channel, sock_T fd, int timeout) +{ + if (timeout > 0) + ch_log(channel, "Waiting for up to %d msec", timeout); + +# ifdef WIN32 + if (fd != channel->CH_SOCK_FD) + { + DWORD nread; + int sleep_time; + DWORD deadline = GetTickCount() + timeout; + int delay = 1; + + /* reading from a pipe, not a socket */ + while (TRUE) + { + int r = PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL); + + if (r && nread > 0) + return CW_READY; + if (r == 0) + { + DWORD err = GetLastError(); + + if (err != ERROR_BAD_PIPE && err != ERROR_BROKEN_PIPE) + return CW_ERROR; + + if (channel->ch_named_pipe) + { + DisconnectNamedPipe((HANDLE)fd); + ConnectNamedPipe((HANDLE)fd, NULL); + } + else + return CW_ERROR; + } + + /* perhaps write some buffer lines */ + channel_write_any_lines(); + + sleep_time = deadline - GetTickCount(); + if (sleep_time <= 0) + break; + /* Wait for a little while. Very short at first, up to 10 msec + * after looping a few times. */ + if (sleep_time > delay) + sleep_time = delay; + Sleep(sleep_time); + delay = delay * 2; + if (delay > 10) + delay = 10; + } + } + else +#endif + { +#if defined(HAVE_SELECT) + struct timeval tval; + fd_set rfds; + fd_set wfds; + int ret; + int maxfd; + + tval.tv_sec = timeout / 1000; + tval.tv_usec = (timeout % 1000) * 1000; + for (;;) + { + FD_ZERO(&rfds); + FD_SET((int)fd, &rfds); + + /* Write lines to a pipe when a pipe can be written to. Need to + * set this every time, some buffers may be done. */ + maxfd = (int)fd + 1; + FD_ZERO(&wfds); + maxfd = channel_fill_wfds(maxfd, &wfds); + + ret = select(maxfd, &rfds, &wfds, NULL, &tval); +# ifdef EINTR + SOCK_ERRNO; + if (ret == -1 && errno == EINTR) + continue; +# endif + if (ret > 0) + { + if (FD_ISSET(fd, &rfds)) + return CW_READY; + channel_write_any_lines(); + continue; + } + break; + } +#else + for (;;) + { + struct pollfd fds[MAX_OPEN_CHANNELS + 1]; + int nfd = 1; + + fds[0].fd = fd; + fds[0].events = POLLIN; + nfd = channel_fill_poll_write(nfd, fds); + if (poll(fds, nfd, timeout) > 0) + { + if (fds[0].revents & POLLIN) + return CW_READY; + channel_write_any_lines(); + continue; + } + break; + } +#endif + } + return CW_NOT_READY; +} + + static void +ch_close_part_on_error( + channel_T *channel, ch_part_T part, int is_err, char *func) +{ + char msg[] = "%s(): Read %s from ch_part[%d], closing"; + + if (is_err) + /* Do not call emsg(), most likely the other end just exited. */ + ch_error(channel, msg, func, "error", part); + else + ch_log(channel, msg, func, "EOF", part); + + /* Queue a "DETACH" netbeans message in the command queue in order to + * terminate the netbeans session later. Do not end the session here + * directly as we may be running in the context of a call to + * netbeans_parse_messages(): + * netbeans_parse_messages + * -> autocmd triggered while processing the netbeans cmd + * -> ui_breakcheck + * -> gui event loop or select loop + * -> channel_read() + * Only send "DETACH" for a netbeans channel. + */ + if (channel->ch_nb_close_cb != NULL) + channel_save(channel, PART_SOCK, (char_u *)DETACH_MSG_RAW, + (int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT "); + + /* When reading is not possible close this part of the channel. Don't + * close the channel yet, there may be something to read on another part. + * When stdout and stderr use the same FD we get the error only on one of + * them, also close the other. */ + if (part == PART_OUT || part == PART_ERR) + { + ch_part_T other = part == PART_OUT ? PART_ERR : PART_OUT; + + if (channel->ch_part[part].ch_fd == channel->ch_part[other].ch_fd) + ch_close_part(channel, other); + } + ch_close_part(channel, part); + +#ifdef FEAT_GUI + /* Stop listening to GUI events right away. */ + channel_gui_unregister_one(channel, part); +#endif +} + + static void +channel_close_now(channel_T *channel) +{ + ch_log(channel, "Closing channel because all readable fds are closed"); + if (channel->ch_nb_close_cb != NULL) + (*channel->ch_nb_close_cb)(); + channel_close(channel, TRUE); +} + +/* + * Read from channel "channel" for as long as there is something to read. + * "part" is PART_SOCK, PART_OUT or PART_ERR. + * The data is put in the read queue. No callbacks are invoked here. + */ + static void +channel_read(channel_T *channel, ch_part_T part, char *func) +{ + static char_u *buf = NULL; + int len = 0; + int readlen = 0; + sock_T fd; + int use_socket = FALSE; + + fd = channel->ch_part[part].ch_fd; + if (fd == INVALID_FD) + { + ch_error(channel, "channel_read() called while %s part is closed", + part_names[part]); + return; + } + use_socket = fd == channel->CH_SOCK_FD; + + /* Allocate a buffer to read into. */ + if (buf == NULL) + { + buf = alloc(MAXMSGSIZE); + if (buf == NULL) + return; /* out of memory! */ + } + + /* Keep on reading for as long as there is something to read. + * Use select() or poll() to avoid blocking on a message that is exactly + * MAXMSGSIZE long. */ + for (;;) + { + if (channel_wait(channel, fd, 0) != CW_READY) + break; + if (use_socket) + len = sock_read(fd, (char *)buf, MAXMSGSIZE); + else + len = fd_read(fd, (char *)buf, MAXMSGSIZE); + if (len <= 0) + break; /* error or nothing more to read */ + + /* Store the read message in the queue. */ + channel_save(channel, part, buf, len, FALSE, "RECV "); + readlen += len; + if (len < MAXMSGSIZE) + break; /* did read everything that's available */ + } + + /* Reading a disconnection (readlen == 0), or an error. */ + if (readlen <= 0) + { + if (!channel->ch_keep_open) + ch_close_part_on_error(channel, part, (len < 0), func); + } +#if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK) + else if (CH_HAS_GUI && gtk_main_level() > 0) + /* signal the main loop that there is something to read */ + gtk_main_quit(); +#endif +} + +/* + * Read from RAW or NL "channel"/"part". Blocks until there is something to + * read or the timeout expires. + * When "raw" is TRUE don't block waiting on a NL. + * Returns what was read in allocated memory. + * Returns NULL in case of error or timeout. + */ + static char_u * +channel_read_block(channel_T *channel, ch_part_T part, int timeout, int raw) +{ + char_u *buf; + char_u *msg; + ch_mode_T mode = channel->ch_part[part].ch_mode; + sock_T fd = channel->ch_part[part].ch_fd; + char_u *nl; + readq_T *node; + + ch_log(channel, "Blocking %s read, timeout: %d msec", + mode == MODE_RAW ? "RAW" : "NL", timeout); + + while (TRUE) + { + node = channel_peek(channel, part); + if (node != NULL) + { + if (mode == MODE_RAW || (mode == MODE_NL + && channel_first_nl(node) != NULL)) + /* got a complete message */ + break; + if (channel_collapse(channel, part, mode == MODE_NL) == OK) + continue; + /* If not blocking or nothing more is coming then return what we + * have. */ + if (raw || fd == INVALID_FD) + break; + } + + /* Wait for up to the channel timeout. */ + if (fd == INVALID_FD) + return NULL; + if (channel_wait(channel, fd, timeout) != CW_READY) + { + ch_log(channel, "Timed out"); + return NULL; + } + channel_read(channel, part, "channel_read_block"); + } + + /* We have a complete message now. */ + if (mode == MODE_RAW) + { + msg = channel_get_all(channel, part); + } + else + { + char_u *p; + + buf = node->rq_buffer; + nl = channel_first_nl(node); + + /* Convert NUL to NL, the internal representation. */ + for (p = buf; (nl == NULL || p < nl) && p < buf + node->rq_buflen; ++p) + if (*p == NUL) + *p = NL; + + if (nl == NULL) + { + /* must be a closed channel with missing NL */ + msg = channel_get(channel, part); + } + else if (nl + 1 == buf + node->rq_buflen) + { + /* get the whole buffer */ + msg = channel_get(channel, part); + *nl = NUL; + } + else + { + /* Copy the message into allocated memory and remove it from the + * buffer. */ + msg = vim_strnsave(buf, (int)(nl - buf)); + channel_consume(channel, part, (int)(nl - buf) + 1); + } + } + if (ch_log_active()) + ch_log(channel, "Returning %d bytes", (int)STRLEN(msg)); + return msg; +} + +/* + * Read one JSON message with ID "id" from "channel"/"part" and store the + * result in "rettv". + * When "id" is -1 accept any message; + * Blocks until the message is received or the timeout is reached. + */ + static int +channel_read_json_block( + channel_T *channel, + ch_part_T part, + int timeout_arg, + int id, + typval_T **rettv) +{ + int more; + sock_T fd; + int timeout; + chanpart_T *chanpart = &channel->ch_part[part]; + + ch_log(channel, "Reading JSON"); + if (id != -1) + chanpart->ch_block_id = id; + for (;;) + { + more = channel_parse_json(channel, part); + + /* search for message "id" */ + if (channel_get_json(channel, part, id, TRUE, rettv) == OK) + { + chanpart->ch_block_id = 0; + return OK; + } + + if (!more) + { + /* Handle any other messages in the queue. If done some more + * messages may have arrived. */ + if (channel_parse_messages()) + continue; + + /* Wait for up to the timeout. If there was an incomplete message + * use the deadline for that. */ + timeout = timeout_arg; + if (chanpart->ch_wait_len > 0) + { +#ifdef WIN32 + timeout = chanpart->ch_deadline - GetTickCount() + 1; +#else + { + struct timeval now_tv; + + gettimeofday(&now_tv, NULL); + timeout = (chanpart->ch_deadline.tv_sec + - now_tv.tv_sec) * 1000 + + (chanpart->ch_deadline.tv_usec + - now_tv.tv_usec) / 1000 + + 1; + } +#endif + if (timeout < 0) + { + /* Something went wrong, channel_parse_json() didn't + * discard message. Cancel waiting. */ + chanpart->ch_wait_len = 0; + timeout = timeout_arg; + } + else if (timeout > timeout_arg) + timeout = timeout_arg; + } + fd = chanpart->ch_fd; + if (fd == INVALID_FD + || channel_wait(channel, fd, timeout) != CW_READY) + { + if (timeout == timeout_arg) + { + if (fd != INVALID_FD) + ch_log(channel, "Timed out"); + break; + } + } + else + channel_read(channel, part, "channel_read_json_block"); + } + } + chanpart->ch_block_id = 0; + return FAIL; +} + +/* + * Common for ch_read() and ch_readraw(). + */ + void +common_channel_read(typval_T *argvars, typval_T *rettv, int raw) +{ + channel_T *channel; + ch_part_T part = PART_COUNT; + jobopt_T opt; + int mode; + int timeout; + int id = -1; + typval_T *listtv = NULL; + + /* return an empty string by default */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + clear_job_options(&opt); + if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID, 0) + == FAIL) + goto theend; + + if (opt.jo_set & JO_PART) + part = opt.jo_part; + channel = get_channel_arg(&argvars[0], TRUE, TRUE, part); + if (channel != NULL) + { + if (part == PART_COUNT) + part = channel_part_read(channel); + mode = channel_get_mode(channel, part); + timeout = channel_get_timeout(channel, part); + if (opt.jo_set & JO_TIMEOUT) + timeout = opt.jo_timeout; + + if (raw || mode == MODE_RAW || mode == MODE_NL) + rettv->vval.v_string = channel_read_block(channel, part, + timeout, raw); + else + { + if (opt.jo_set & JO_ID) + id = opt.jo_id; + channel_read_json_block(channel, part, timeout, id, &listtv); + if (listtv != NULL) + { + *rettv = *listtv; + vim_free(listtv); + } + else + { + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NONE; + } + } + } + +theend: + free_job_options(&opt); +} + +# ifdef FEAT_GUI_MACVIM +/* + * Read from channel "channel" in dispatch event handler. + * Channel may be already read out elsewhere before the handler invoked + * after an event arrived, so should be checked again. + */ + void +channel_may_read(channel_T *channel, ch_part_T part, char *func) +{ + sock_T fd = channel->ch_part[part].ch_fd; + + if (fd != INVALID_FD && channel_wait(channel, fd, 0) == CW_READY) + channel_read(channel, part, func); +} +# endif + +# if defined(WIN32) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ + || defined(PROTO) +/* + * Lookup the channel from the socket. Set "partp" to the fd index. + * Returns NULL when the socket isn't found. + */ + channel_T * +channel_fd2channel(sock_T fd, ch_part_T *partp) +{ + channel_T *channel; + ch_part_T part; + + if (fd != INVALID_FD) + for (channel = first_channel; channel != NULL; + channel = channel->ch_next) + { + for (part = PART_SOCK; part < PART_IN; ++part) + if (channel->ch_part[part].ch_fd == fd) + { + *partp = part; + return channel; + } + } + return NULL; +} +# endif + +# if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO) +/* + * Check the channels for anything that is ready to be read. + * The data is put in the read queue. + * if "only_keep_open" is TRUE only check channels where ch_keep_open is set. + */ + void +channel_handle_events(int only_keep_open) +{ + channel_T *channel; + ch_part_T part; + sock_T fd; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + if (only_keep_open && !channel->ch_keep_open) + continue; + + /* check the socket and pipes */ + for (part = PART_SOCK; part < PART_IN; ++part) + { + fd = channel->ch_part[part].ch_fd; + if (fd != INVALID_FD) + { + int r = channel_wait(channel, fd, 0); + + if (r == CW_READY) + channel_read(channel, part, "channel_handle_events"); + else if (r == CW_ERROR) + ch_close_part_on_error(channel, part, TRUE, + "channel_handle_events"); + } + } + } +} +# endif + +# if defined(FEAT_GUI) || defined(PROTO) +/* + * Return TRUE when there is any channel with a keep_open flag. + */ + int +channel_any_keep_open() +{ + channel_T *channel; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + if (channel->ch_keep_open) + return TRUE; + return FALSE; +} +# endif + +/* + * Set "channel"/"part" to non-blocking. + * Only works for sockets and pipes. + */ + void +channel_set_nonblock(channel_T *channel, ch_part_T part) +{ + chanpart_T *ch_part = &channel->ch_part[part]; + int fd = ch_part->ch_fd; + + if (fd != INVALID_FD) + { +#ifdef _WIN32 + u_long val = 1; + + ioctlsocket(fd, FIONBIO, &val); +#else + (void)fcntl(fd, F_SETFL, O_NONBLOCK); +#endif + ch_part->ch_nonblocking = TRUE; + } +} + +/* + * Write "buf" (NUL terminated string) to "channel"/"part". + * When "fun" is not NULL an error message might be given. + * Return FAIL or OK. + */ + int +channel_send( + channel_T *channel, + ch_part_T part, + char_u *buf_arg, + int len_arg, + char *fun) +{ + int res; + sock_T fd; + chanpart_T *ch_part = &channel->ch_part[part]; + int did_use_queue = FALSE; + + fd = ch_part->ch_fd; + if (fd == INVALID_FD) + { + if (!channel->ch_error && fun != NULL) + { + ch_error(channel, "%s(): write while not connected", fun); + EMSG2(_("E630: %s(): write while not connected"), fun); + } + channel->ch_error = TRUE; + return FAIL; + } + + if (ch_log_active()) + { + ch_log_lead("SEND ", channel); + fprintf(log_fd, "'"); + ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd); + fprintf(log_fd, "'\n"); + fflush(log_fd); + did_log_msg = TRUE; + } + + for (;;) + { + writeq_T *wq = &ch_part->ch_writeque; + char_u *buf; + int len; + + if (wq->wq_next != NULL) + { + /* first write what was queued */ + buf = wq->wq_next->wq_ga.ga_data; + len = wq->wq_next->wq_ga.ga_len; + did_use_queue = TRUE; + } + else + { + if (len_arg == 0) + /* nothing to write, called from channel_select_check() */ + return OK; + buf = buf_arg; + len = len_arg; + } + + if (part == PART_SOCK) + res = sock_write(fd, (char *)buf, len); + else + { + res = fd_write(fd, (char *)buf, len); +#ifdef WIN32 + if (channel->ch_named_pipe && res < 0) + { + DisconnectNamedPipe((HANDLE)fd); + ConnectNamedPipe((HANDLE)fd, NULL); + } +#endif + + } + if (res < 0 && (errno == EWOULDBLOCK +#ifdef EAGAIN + || errno == EAGAIN +#endif + )) + res = 0; /* nothing got written */ + + if (res >= 0 && ch_part->ch_nonblocking) + { + writeq_T *entry = wq->wq_next; + + if (did_use_queue) + ch_log(channel, "Sent %d bytes now", res); + if (res == len) + { + /* Wrote all the buf[len] bytes. */ + if (entry != NULL) + { + /* Remove the entry from the write queue. */ + remove_from_writeque(wq, entry); + continue; + } + if (did_use_queue) + ch_log(channel, "Write queue empty"); + } + else + { + /* Wrote only buf[res] bytes, can't write more now. */ + if (entry != NULL) + { + if (res > 0) + { + /* Remove the bytes that were written. */ + mch_memmove(entry->wq_ga.ga_data, + (char *)entry->wq_ga.ga_data + res, + len - res); + entry->wq_ga.ga_len -= res; + } + buf = buf_arg; + len = len_arg; + } + else + { + buf += res; + len -= res; + } + ch_log(channel, "Adding %d bytes to the write queue", len); + + /* Append the not written bytes of the argument to the write + * buffer. Limit entries to 4000 bytes. */ + if (wq->wq_prev != NULL + && wq->wq_prev->wq_ga.ga_len + len < 4000) + { + writeq_T *last = wq->wq_prev; + + /* append to the last entry */ + if (ga_grow(&last->wq_ga, len) == OK) + { + mch_memmove((char *)last->wq_ga.ga_data + + last->wq_ga.ga_len, + buf, len); + last->wq_ga.ga_len += len; + } + } + else + { + writeq_T *last = (writeq_T *)alloc((int)sizeof(writeq_T)); + + if (last != NULL) + { + last->wq_prev = wq->wq_prev; + last->wq_next = NULL; + if (wq->wq_prev == NULL) + wq->wq_next = last; + else + wq->wq_prev->wq_next = last; + wq->wq_prev = last; + ga_init2(&last->wq_ga, 1, 1000); + if (ga_grow(&last->wq_ga, len) == OK) + { + mch_memmove(last->wq_ga.ga_data, buf, len); + last->wq_ga.ga_len = len; + } + } + } + } + } + else if (res != len) + { + if (!channel->ch_error && fun != NULL) + { + ch_error(channel, "%s(): write failed", fun); + EMSG2(_("E631: %s(): write failed"), fun); + } + channel->ch_error = TRUE; + return FAIL; + } + + channel->ch_error = FALSE; + return OK; + } +} + +/* + * Common for "ch_sendexpr()" and "ch_sendraw()". + * Returns the channel if the caller should read the response. + * Sets "part_read" to the read fd. + * Otherwise returns NULL. + */ + static channel_T * +send_common( + typval_T *argvars, + char_u *text, + int id, + int eval, + jobopt_T *opt, + char *fun, + ch_part_T *part_read) +{ + channel_T *channel; + ch_part_T part_send; + + clear_job_options(opt); + channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); + if (channel == NULL) + return NULL; + part_send = channel_part_send(channel); + *part_read = channel_part_read(channel); + + if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT, 0) == FAIL) + return NULL; + + /* Set the callback. An empty callback means no callback and not reading + * the response. With "ch_evalexpr()" and "ch_evalraw()" a callback is not + * allowed. */ + if (opt->jo_callback != NULL && *opt->jo_callback != NUL) + { + if (eval) + { + EMSG2(_("E917: Cannot use a callback with %s()"), fun); + return NULL; + } + channel_set_req_callback(channel, *part_read, + opt->jo_callback, opt->jo_partial, id); + } + + if (channel_send(channel, part_send, text, (int)STRLEN(text), fun) == OK + && opt->jo_callback == NULL) + return channel; + return NULL; +} + +/* + * common for "ch_evalexpr()" and "ch_sendexpr()" + */ + void +ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) +{ + char_u *text; + typval_T *listtv; + channel_T *channel; + int id; + ch_mode_T ch_mode; + ch_part_T part_send; + ch_part_T part_read; + jobopt_T opt; + int timeout; + + /* return an empty string by default */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); + if (channel == NULL) + return; + part_send = channel_part_send(channel); + + ch_mode = channel_get_mode(channel, part_send); + if (ch_mode == MODE_RAW || ch_mode == MODE_NL) + { + EMSG(_("E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel")); + return; + } + + id = ++channel->ch_last_msg_id; + text = json_encode_nr_expr(id, &argvars[1], + (ch_mode == MODE_JS ? JSON_JS : 0) | JSON_NL); + if (text == NULL) + return; + + channel = send_common(argvars, text, id, eval, &opt, + eval ? "ch_evalexpr" : "ch_sendexpr", &part_read); + vim_free(text); + if (channel != NULL && eval) + { + if (opt.jo_set & JO_TIMEOUT) + timeout = opt.jo_timeout; + else + timeout = channel_get_timeout(channel, part_read); + if (channel_read_json_block(channel, part_read, timeout, id, &listtv) + == OK) + { + list_T *list = listtv->vval.v_list; + + /* Move the item from the list and then change the type to + * avoid the value being freed. */ + *rettv = list->lv_last->li_tv; + list->lv_last->li_tv.v_type = VAR_NUMBER; + free_tv(listtv); + } + } + free_job_options(&opt); +} + +/* + * common for "ch_evalraw()" and "ch_sendraw()" + */ + void +ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) +{ + char_u buf[NUMBUFLEN]; + char_u *text; + channel_T *channel; + ch_part_T part_read; + jobopt_T opt; + int timeout; + + /* return an empty string by default */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + text = get_tv_string_buf(&argvars[1], buf); + channel = send_common(argvars, text, 0, eval, &opt, + eval ? "ch_evalraw" : "ch_sendraw", &part_read); + if (channel != NULL && eval) + { + if (opt.jo_set & JO_TIMEOUT) + timeout = opt.jo_timeout; + else + timeout = channel_get_timeout(channel, part_read); + rettv->vval.v_string = channel_read_block(channel, part_read, + timeout, TRUE); + } + free_job_options(&opt); +} + +# define KEEP_OPEN_TIME 20 /* msec */ + +# if (defined(UNIX) && !defined(HAVE_SELECT)) || defined(PROTO) +/* + * Add open channels to the poll struct. + * Return the adjusted struct index. + * The type of "fds" is hidden to avoid problems with the function proto. + */ + int +channel_poll_setup(int nfd_in, void *fds_in, int *towait) +{ + int nfd = nfd_in; + channel_T *channel; + struct pollfd *fds = fds_in; + ch_part_T part; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + for (part = PART_SOCK; part < PART_IN; ++part) + { + chanpart_T *ch_part = &channel->ch_part[part]; + + if (ch_part->ch_fd != INVALID_FD) + { + if (channel->ch_keep_open) + { + /* For unknown reason poll() returns immediately for a + * keep-open channel. Instead of adding it to the fds add + * a short timeout and check, like polling. */ + if (*towait < 0 || *towait > KEEP_OPEN_TIME) + *towait = KEEP_OPEN_TIME; + } + else + { + ch_part->ch_poll_idx = nfd; + fds[nfd].fd = ch_part->ch_fd; + fds[nfd].events = POLLIN; + nfd++; + } + } + else + channel->ch_part[part].ch_poll_idx = -1; + } + } + + nfd = channel_fill_poll_write(nfd, fds); + + return nfd; +} + +/* + * The type of "fds" is hidden to avoid problems with the function proto. + */ + int +channel_poll_check(int ret_in, void *fds_in) +{ + int ret = ret_in; + channel_T *channel; + struct pollfd *fds = fds_in; + ch_part_T part; + int idx; + chanpart_T *in_part; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + for (part = PART_SOCK; part < PART_IN; ++part) + { + idx = channel->ch_part[part].ch_poll_idx; + + if (ret > 0 && idx != -1 && (fds[idx].revents & POLLIN)) + { + channel_read(channel, part, "channel_poll_check"); + --ret; + } + else if (channel->ch_part[part].ch_fd != INVALID_FD + && channel->ch_keep_open) + { + /* polling a keep-open channel */ + channel_read(channel, part, "channel_poll_check_keep_open"); + } + } + + in_part = &channel->ch_part[PART_IN]; + idx = in_part->ch_poll_idx; + if (ret > 0 && idx != -1 && (fds[idx].revents & POLLOUT)) + { + channel_write_input(channel); + --ret; + } + } + + return ret; +} +# endif /* UNIX && !HAVE_SELECT */ + +# if (!defined(WIN32) && defined(HAVE_SELECT)) || defined(PROTO) + +/* + * The "fd_set" type is hidden to avoid problems with the function proto. + */ + int +channel_select_setup( + int maxfd_in, + void *rfds_in, + void *wfds_in, + struct timeval *tv, + struct timeval **tvp) +{ + int maxfd = maxfd_in; + channel_T *channel; + fd_set *rfds = rfds_in; + fd_set *wfds = wfds_in; + ch_part_T part; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + for (part = PART_SOCK; part < PART_IN; ++part) + { + sock_T fd = channel->ch_part[part].ch_fd; + + if (fd != INVALID_FD) + { + if (channel->ch_keep_open) + { + /* For unknown reason select() returns immediately for a + * keep-open channel. Instead of adding it to the rfds add + * a short timeout and check, like polling. */ + if (*tvp == NULL || tv->tv_sec > 0 + || tv->tv_usec > KEEP_OPEN_TIME * 1000) + { + *tvp = tv; + tv->tv_sec = 0; + tv->tv_usec = KEEP_OPEN_TIME * 1000; + } + } + else + { + FD_SET((int)fd, rfds); + if (maxfd < (int)fd) + maxfd = (int)fd; + } + } + } + } + + maxfd = channel_fill_wfds(maxfd, wfds); + + return maxfd; +} + +/* + * The "fd_set" type is hidden to avoid problems with the function proto. + */ + int +channel_select_check(int ret_in, void *rfds_in, void *wfds_in) +{ + int ret = ret_in; + channel_T *channel; + fd_set *rfds = rfds_in; + fd_set *wfds = wfds_in; + ch_part_T part; + chanpart_T *in_part; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + { + for (part = PART_SOCK; part < PART_IN; ++part) + { + sock_T fd = channel->ch_part[part].ch_fd; + + if (ret > 0 && fd != INVALID_FD && FD_ISSET(fd, rfds)) + { + channel_read(channel, part, "channel_select_check"); + FD_CLR(fd, rfds); + --ret; + } + else if (fd != INVALID_FD && channel->ch_keep_open) + { + /* polling a keep-open channel */ + channel_read(channel, part, "channel_select_check_keep_open"); + } + } + + in_part = &channel->ch_part[PART_IN]; + if (ret > 0 && in_part->ch_fd != INVALID_FD + && FD_ISSET(in_part->ch_fd, wfds)) + { + /* Clear the flag first, ch_fd may change in channel_write_input(). */ + FD_CLR(in_part->ch_fd, wfds); + channel_write_input(channel); + --ret; + } + } + + return ret; +} +# endif /* !WIN32 && HAVE_SELECT */ + +/* + * Execute queued up commands. + * Invoked from the main loop when it's safe to execute received commands. + * Return TRUE when something was done. + */ + int +channel_parse_messages(void) +{ + channel_T *channel = first_channel; + int ret = FALSE; + int r; + ch_part_T part = PART_SOCK; +#ifdef ELAPSED_FUNC + ELAPSED_TYPE start_tv; + + ELAPSED_INIT(start_tv); +#endif + + ++safe_to_invoke_callback; + + /* Only do this message when another message was given, otherwise we get + * lots of them. */ + if (did_log_msg) + { + ch_log(NULL, "looking for messages on channels"); + did_log_msg = FALSE; + } + while (channel != NULL) + { + if (channel_can_close(channel)) + { + channel->ch_to_be_closed = (1U << PART_COUNT); + channel_close_now(channel); + /* channel may have been freed, start over */ + channel = first_channel; + continue; + } + if (channel->ch_to_be_freed) + { + channel_free(channel); + /* channel has been freed, start over */ + channel = first_channel; + continue; + } + if (channel->ch_refcount == 0 && !channel_still_useful(channel)) + { + /* channel is no longer useful, free it */ + channel_free(channel); + channel = first_channel; + part = PART_SOCK; + continue; + } + if (channel->ch_part[part].ch_fd != INVALID_FD + || channel_has_readahead(channel, part)) + { + /* Increase the refcount, in case the handler causes the channel + * to be unreferenced or closed. */ + ++channel->ch_refcount; + r = may_invoke_callback(channel, part); + if (r == OK) + ret = TRUE; + if (channel_unref(channel) || (r == OK +#ifdef ELAPSED_FUNC + /* Limit the time we loop here to 100 msec, otherwise + * Vim becomes unresponsive when the callback takes + * more than a bit of time. */ + && ELAPSED_FUNC(start_tv) < 100L +#endif + )) + { + /* channel was freed or something was done, start over */ + channel = first_channel; + part = PART_SOCK; + continue; + } + } + if (part < PART_ERR) + ++part; + else + { + channel = channel->ch_next; + part = PART_SOCK; + } + } + + if (channel_need_redraw) + { + channel_need_redraw = FALSE; + redraw_after_callback(TRUE); + } + + --safe_to_invoke_callback; + + return ret; +} + +/* + * Return TRUE if any channel has readahead. That means we should not block on + * waiting for input. + */ + int +channel_any_readahead(void) +{ + channel_T *channel = first_channel; + ch_part_T part = PART_SOCK; + + while (channel != NULL) + { + if (channel_has_readahead(channel, part)) + return TRUE; + if (part < PART_ERR) + ++part; + else + { + channel = channel->ch_next; + part = PART_SOCK; + } + } + return FALSE; +} + +/* + * Mark references to lists used in channels. + */ + int +set_ref_in_channel(int copyID) +{ + int abort = FALSE; + channel_T *channel; + typval_T tv; + + for (channel = first_channel; channel != NULL; channel = channel->ch_next) + if (channel_still_useful(channel)) + { + tv.v_type = VAR_CHANNEL; + tv.vval.v_channel = channel; + abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} + +/* + * Return the "part" to write to for "channel". + */ + ch_part_T +channel_part_send(channel_T *channel) +{ + if (channel->CH_SOCK_FD == INVALID_FD) + return PART_IN; + return PART_SOCK; +} + +/* + * Return the default "part" to read from for "channel". + */ + ch_part_T +channel_part_read(channel_T *channel) +{ + if (channel->CH_SOCK_FD == INVALID_FD) + return PART_OUT; + return PART_SOCK; +} + +/* + * Return the mode of "channel"/"part" + * If "channel" is invalid returns MODE_JSON. + */ + ch_mode_T +channel_get_mode(channel_T *channel, ch_part_T part) +{ + if (channel == NULL) + return MODE_JSON; + return channel->ch_part[part].ch_mode; +} + +/* + * Return the timeout of "channel"/"part" + */ + int +channel_get_timeout(channel_T *channel, ch_part_T part) +{ + return channel->ch_part[part].ch_timeout; +} + + static int +handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo) +{ + char_u *val = get_tv_string(item); + + opt->jo_set |= jo; + if (STRCMP(val, "nl") == 0) + *modep = MODE_NL; + else if (STRCMP(val, "raw") == 0) + *modep = MODE_RAW; + else if (STRCMP(val, "js") == 0) + *modep = MODE_JS; + else if (STRCMP(val, "json") == 0) + *modep = MODE_JSON; + else + { + EMSG2(_(e_invarg2), val); + return FAIL; + } + return OK; +} + + static int +handle_io(typval_T *item, ch_part_T part, jobopt_T *opt) +{ + char_u *val = get_tv_string(item); + + opt->jo_set |= JO_OUT_IO << (part - PART_OUT); + if (STRCMP(val, "null") == 0) + opt->jo_io[part] = JIO_NULL; + else if (STRCMP(val, "pipe") == 0) + opt->jo_io[part] = JIO_PIPE; + else if (STRCMP(val, "file") == 0) + opt->jo_io[part] = JIO_FILE; + else if (STRCMP(val, "buffer") == 0) + opt->jo_io[part] = JIO_BUFFER; + else if (STRCMP(val, "out") == 0 && part == PART_ERR) + opt->jo_io[part] = JIO_OUT; + else + { + EMSG2(_(e_invarg2), val); + return FAIL; + } + return OK; +} + +/* + * Clear a jobopt_T before using it. + */ + void +clear_job_options(jobopt_T *opt) +{ + vim_memset(opt, 0, sizeof(jobopt_T)); +} + +/* + * Free any members of a jobopt_T. + */ + void +free_job_options(jobopt_T *opt) +{ + if (opt->jo_partial != NULL) + partial_unref(opt->jo_partial); + else if (opt->jo_callback != NULL) + func_unref(opt->jo_callback); + if (opt->jo_out_partial != NULL) + partial_unref(opt->jo_out_partial); + else if (opt->jo_out_cb != NULL) + func_unref(opt->jo_out_cb); + if (opt->jo_err_partial != NULL) + partial_unref(opt->jo_err_partial); + else if (opt->jo_err_cb != NULL) + func_unref(opt->jo_err_cb); + if (opt->jo_close_partial != NULL) + partial_unref(opt->jo_close_partial); + else if (opt->jo_close_cb != NULL) + func_unref(opt->jo_close_cb); + if (opt->jo_exit_partial != NULL) + partial_unref(opt->jo_exit_partial); + else if (opt->jo_exit_cb != NULL) + func_unref(opt->jo_exit_cb); + if (opt->jo_env != NULL) + dict_unref(opt->jo_env); +} + +/* + * Get the PART_ number from the first character of an option name. + */ + static int +part_from_char(int c) +{ + return c == 'i' ? PART_IN : c == 'o' ? PART_OUT: PART_ERR; +} + +/* + * Get the option entries from the dict in "tv", parse them and put the result + * in "opt". + * Only accept JO_ options in "supported" and JO2_ options in "supported2". + * If an option value is invalid return FAIL. + */ + int +get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) +{ + typval_T *item; + char_u *val; + dict_T *dict; + int todo; + hashitem_T *hi; + ch_part_T part; + + if (tv->v_type == VAR_UNKNOWN) + return OK; + if (tv->v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return FAIL; + } + dict = tv->vval.v_dict; + if (dict == NULL) + return OK; + + todo = (int)dict->dv_hashtab.ht_used; + for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + item = &dict_lookup(hi)->di_tv; + + if (STRCMP(hi->hi_key, "mode") == 0) + { + if (!(supported & JO_MODE)) + break; + if (handle_mode(item, opt, &opt->jo_mode, JO_MODE) == FAIL) + return FAIL; + } + else if (STRCMP(hi->hi_key, "in_mode") == 0) + { + if (!(supported & JO_IN_MODE)) + break; + if (handle_mode(item, opt, &opt->jo_in_mode, JO_IN_MODE) + == FAIL) + return FAIL; + } + else if (STRCMP(hi->hi_key, "out_mode") == 0) + { + if (!(supported & JO_OUT_MODE)) + break; + if (handle_mode(item, opt, &opt->jo_out_mode, JO_OUT_MODE) + == FAIL) + return FAIL; + } + else if (STRCMP(hi->hi_key, "err_mode") == 0) + { + if (!(supported & JO_ERR_MODE)) + break; + if (handle_mode(item, opt, &opt->jo_err_mode, JO_ERR_MODE) + == FAIL) + return FAIL; + } + else if (STRCMP(hi->hi_key, "in_io") == 0 + || STRCMP(hi->hi_key, "out_io") == 0 + || STRCMP(hi->hi_key, "err_io") == 0) + { + if (!(supported & JO_OUT_IO)) + break; + if (handle_io(item, part_from_char(*hi->hi_key), opt) == FAIL) + return FAIL; + } + else if (STRCMP(hi->hi_key, "in_name") == 0 + || STRCMP(hi->hi_key, "out_name") == 0 + || STRCMP(hi->hi_key, "err_name") == 0) + { + part = part_from_char(*hi->hi_key); + + if (!(supported & JO_OUT_IO)) + break; + opt->jo_set |= JO_OUT_NAME << (part - PART_OUT); + opt->jo_io_name[part] = + get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]); + } + else if (STRCMP(hi->hi_key, "pty") == 0) + { + if (!(supported & JO_MODE)) + break; + opt->jo_pty = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "in_buf") == 0 + || STRCMP(hi->hi_key, "out_buf") == 0 + || STRCMP(hi->hi_key, "err_buf") == 0) + { + part = part_from_char(*hi->hi_key); + + if (!(supported & JO_OUT_IO)) + break; + opt->jo_set |= JO_OUT_BUF << (part - PART_OUT); + opt->jo_io_buf[part] = get_tv_number(item); + if (opt->jo_io_buf[part] <= 0) + { + EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + return FAIL; + } + if (buflist_findnr(opt->jo_io_buf[part]) == NULL) + { + EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[part]); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "out_modifiable") == 0 + || STRCMP(hi->hi_key, "err_modifiable") == 0) + { + part = part_from_char(*hi->hi_key); + + if (!(supported & JO_OUT_IO)) + break; + opt->jo_set |= JO_OUT_MODIFIABLE << (part - PART_OUT); + opt->jo_modifiable[part] = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "out_msg") == 0 + || STRCMP(hi->hi_key, "err_msg") == 0) + { + part = part_from_char(*hi->hi_key); + + if (!(supported & JO_OUT_IO)) + break; + opt->jo_set2 |= JO2_OUT_MSG << (part - PART_OUT); + opt->jo_message[part] = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "in_top") == 0 + || STRCMP(hi->hi_key, "in_bot") == 0) + { + linenr_T *lp; + + if (!(supported & JO_OUT_IO)) + break; + if (hi->hi_key[3] == 't') + { + lp = &opt->jo_in_top; + opt->jo_set |= JO_IN_TOP; + } + else + { + lp = &opt->jo_in_bot; + opt->jo_set |= JO_IN_BOT; + } + *lp = get_tv_number(item); + if (*lp < 0) + { + EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "channel") == 0) + { + if (!(supported & JO_OUT_IO)) + break; + opt->jo_set |= JO_CHANNEL; + if (item->v_type != VAR_CHANNEL) + { + EMSG2(_(e_invargval), "channel"); + return FAIL; + } + opt->jo_channel = item->vval.v_channel; + } + else if (STRCMP(hi->hi_key, "callback") == 0) + { + if (!(supported & JO_CALLBACK)) + break; + opt->jo_set |= JO_CALLBACK; + opt->jo_callback = get_callback(item, &opt->jo_partial); + if (opt->jo_callback == NULL) + { + EMSG2(_(e_invargval), "callback"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "out_cb") == 0) + { + if (!(supported & JO_OUT_CALLBACK)) + break; + opt->jo_set |= JO_OUT_CALLBACK; + opt->jo_out_cb = get_callback(item, &opt->jo_out_partial); + if (opt->jo_out_cb == NULL) + { + EMSG2(_(e_invargval), "out_cb"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "err_cb") == 0) + { + if (!(supported & JO_ERR_CALLBACK)) + break; + opt->jo_set |= JO_ERR_CALLBACK; + opt->jo_err_cb = get_callback(item, &opt->jo_err_partial); + if (opt->jo_err_cb == NULL) + { + EMSG2(_(e_invargval), "err_cb"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "close_cb") == 0) + { + if (!(supported & JO_CLOSE_CALLBACK)) + break; + opt->jo_set |= JO_CLOSE_CALLBACK; + opt->jo_close_cb = get_callback(item, &opt->jo_close_partial); + if (opt->jo_close_cb == NULL) + { + EMSG2(_(e_invargval), "close_cb"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "drop") == 0) + { + int never = FALSE; + val = get_tv_string(item); + + if (STRCMP(val, "never") == 0) + never = TRUE; + else if (STRCMP(val, "auto") != 0) + { + EMSG3(_(e_invargNval), "drop", val); + return FAIL; + } + opt->jo_drop_never = never; + } + else if (STRCMP(hi->hi_key, "exit_cb") == 0) + { + if (!(supported & JO_EXIT_CB)) + break; + opt->jo_set |= JO_EXIT_CB; + opt->jo_exit_cb = get_callback(item, &opt->jo_exit_partial); + if (opt->jo_exit_cb == NULL) + { + EMSG2(_(e_invargval), "exit_cb"); + return FAIL; + } + } +#ifdef FEAT_TERMINAL + else if (STRCMP(hi->hi_key, "term_name") == 0) + { + if (!(supported2 & JO2_TERM_NAME)) + break; + opt->jo_set2 |= JO2_TERM_NAME; + opt->jo_term_name = get_tv_string_chk(item); + if (opt->jo_term_name == NULL) + { + EMSG2(_(e_invargval), "term_name"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "term_finish") == 0) + { + if (!(supported2 & JO2_TERM_FINISH)) + break; + val = get_tv_string(item); + if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) + { + EMSG3(_(e_invargNval), "term_finish", val); + return FAIL; + } + opt->jo_set2 |= JO2_TERM_FINISH; + opt->jo_term_finish = *val; + } + else if (STRCMP(hi->hi_key, "term_opencmd") == 0) + { + char_u *p; + + if (!(supported2 & JO2_TERM_OPENCMD)) + break; + opt->jo_set2 |= JO2_TERM_OPENCMD; + p = opt->jo_term_opencmd = get_tv_string_chk(item); + if (p != NULL) + { + /* Must have %d and no other %. */ + p = vim_strchr(p, '%'); + if (p != NULL && (p[1] != 'd' + || vim_strchr(p + 2, '%') != NULL)) + p = NULL; + } + if (p == NULL) + { + EMSG2(_(e_invargval), "term_opencmd"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "eof_chars") == 0) + { + char_u *p; + + if (!(supported2 & JO2_EOF_CHARS)) + break; + opt->jo_set2 |= JO2_EOF_CHARS; + p = opt->jo_eof_chars = get_tv_string_chk(item); + if (p == NULL) + { + EMSG2(_(e_invargval), "eof_chars"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "term_rows") == 0) + { + if (!(supported2 & JO2_TERM_ROWS)) + break; + opt->jo_set2 |= JO2_TERM_ROWS; + opt->jo_term_rows = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "term_cols") == 0) + { + if (!(supported2 & JO2_TERM_COLS)) + break; + opt->jo_set2 |= JO2_TERM_COLS; + opt->jo_term_cols = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "vertical") == 0) + { + if (!(supported2 & JO2_VERTICAL)) + break; + opt->jo_set2 |= JO2_VERTICAL; + opt->jo_vertical = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "curwin") == 0) + { + if (!(supported2 & JO2_CURWIN)) + break; + opt->jo_set2 |= JO2_CURWIN; + opt->jo_curwin = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "hidden") == 0) + { + if (!(supported2 & JO2_HIDDEN)) + break; + opt->jo_set2 |= JO2_HIDDEN; + opt->jo_hidden = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "norestore") == 0) + { + if (!(supported2 & JO2_NORESTORE)) + break; + opt->jo_set2 |= JO2_NORESTORE; + opt->jo_term_norestore = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "term_kill") == 0) + { + if (!(supported2 & JO2_TERM_KILL)) + break; + opt->jo_set2 |= JO2_TERM_KILL; + opt->jo_term_kill = get_tv_string_chk(item); + } +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + else if (STRCMP(hi->hi_key, "ansi_colors") == 0) + { + int n = 0; + listitem_T *li; + long_u rgb[16]; + + if (!(supported2 & JO2_ANSI_COLORS)) + break; + + if (item == NULL || item->v_type != VAR_LIST + || item->vval.v_list == NULL) + { + EMSG2(_(e_invargval), "ansi_colors"); + return FAIL; + } + + li = item->vval.v_list->lv_first; + for (; li != NULL && n < 16; li = li->li_next, n++) + { + char_u *color_name; + guicolor_T guicolor; + + color_name = get_tv_string_chk(&li->li_tv); + if (color_name == NULL) + return FAIL; + + guicolor = GUI_GET_COLOR(color_name); + if (guicolor == INVALCOLOR) + return FAIL; + + rgb[n] = GUI_MCH_GET_RGB(guicolor); + } + + if (n != 16 || li != NULL) + { + EMSG2(_(e_invargval), "ansi_colors"); + return FAIL; + } + + opt->jo_set2 |= JO2_ANSI_COLORS; + memcpy(opt->jo_ansi_colors, rgb, sizeof(rgb)); + } +# endif +#endif + else if (STRCMP(hi->hi_key, "env") == 0) + { + if (!(supported2 & JO2_ENV)) + break; + if (item->v_type != VAR_DICT) + { + EMSG2(_(e_invargval), "env"); + return FAIL; + } + opt->jo_set2 |= JO2_ENV; + opt->jo_env = item->vval.v_dict; + if (opt->jo_env != NULL) + ++opt->jo_env->dv_refcount; + } + else if (STRCMP(hi->hi_key, "cwd") == 0) + { + if (!(supported2 & JO2_CWD)) + break; + opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); + if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)) + { + EMSG2(_(e_invargval), "cwd"); + return FAIL; + } + opt->jo_set2 |= JO2_CWD; + } + else if (STRCMP(hi->hi_key, "waittime") == 0) + { + if (!(supported & JO_WAITTIME)) + break; + opt->jo_set |= JO_WAITTIME; + opt->jo_waittime = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "timeout") == 0) + { + if (!(supported & JO_TIMEOUT)) + break; + opt->jo_set |= JO_TIMEOUT; + opt->jo_timeout = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "out_timeout") == 0) + { + if (!(supported & JO_OUT_TIMEOUT)) + break; + opt->jo_set |= JO_OUT_TIMEOUT; + opt->jo_out_timeout = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "err_timeout") == 0) + { + if (!(supported & JO_ERR_TIMEOUT)) + break; + opt->jo_set |= JO_ERR_TIMEOUT; + opt->jo_err_timeout = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "part") == 0) + { + if (!(supported & JO_PART)) + break; + opt->jo_set |= JO_PART; + val = get_tv_string(item); + if (STRCMP(val, "err") == 0) + opt->jo_part = PART_ERR; + else if (STRCMP(val, "out") == 0) + opt->jo_part = PART_OUT; + else + { + EMSG3(_(e_invargNval), "part", val); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "id") == 0) + { + if (!(supported & JO_ID)) + break; + opt->jo_set |= JO_ID; + opt->jo_id = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "stoponexit") == 0) + { + if (!(supported & JO_STOPONEXIT)) + break; + opt->jo_set |= JO_STOPONEXIT; + opt->jo_stoponexit = get_tv_string_buf_chk(item, + opt->jo_soe_buf); + if (opt->jo_stoponexit == NULL) + { + EMSG2(_(e_invargval), "stoponexit"); + return FAIL; + } + } + else if (STRCMP(hi->hi_key, "block_write") == 0) + { + if (!(supported & JO_BLOCK_WRITE)) + break; + opt->jo_set |= JO_BLOCK_WRITE; + opt->jo_block_write = get_tv_number(item); + } + else + break; + --todo; + } + if (todo > 0) + { + EMSG2(_(e_invarg2), hi->hi_key); + return FAIL; + } + + return OK; +} + +/* + * Get the channel from the argument. + * Returns NULL if the handle is invalid. + * When "check_open" is TRUE check that the channel can be used. + * When "reading" is TRUE "check_open" considers typeahead useful. + * "part" is used to check typeahead, when PART_COUNT use the default part. + */ + channel_T * +get_channel_arg(typval_T *tv, int check_open, int reading, ch_part_T part) +{ + channel_T *channel = NULL; + int has_readahead = FALSE; + + if (tv->v_type == VAR_JOB) + { + if (tv->vval.v_job != NULL) + channel = tv->vval.v_job->jv_channel; + } + else if (tv->v_type == VAR_CHANNEL) + { + channel = tv->vval.v_channel; + } + else + { + EMSG2(_(e_invarg2), get_tv_string(tv)); + return NULL; + } + if (channel != NULL && reading) + has_readahead = channel_has_readahead(channel, + part != PART_COUNT ? part : channel_part_read(channel)); + + if (check_open && (channel == NULL || (!channel_is_open(channel) + && !(reading && has_readahead)))) + { + EMSG(_("E906: not an open channel")); + return NULL; + } + return channel; +} + +static job_T *first_job = NULL; + + static void +job_free_contents(job_T *job) +{ + int i; + + ch_log(job->jv_channel, "Freeing job"); + if (job->jv_channel != NULL) + { + /* The link from the channel to the job doesn't count as a reference, + * thus don't decrement the refcount of the job. The reference from + * the job to the channel does count the reference, decrement it and + * NULL the reference. We don't set ch_job_killed, unreferencing the + * job doesn't mean it stops running. */ + job->jv_channel->ch_job = NULL; + channel_unref(job->jv_channel); + } + mch_clear_job(job); + + vim_free(job->jv_tty_in); + vim_free(job->jv_tty_out); + vim_free(job->jv_stoponexit); + free_callback(job->jv_exit_cb, job->jv_exit_partial); + if (job->jv_argv != NULL) + { + for (i = 0; job->jv_argv[i] != NULL; i++) + vim_free(job->jv_argv[i]); + vim_free(job->jv_argv); + } +} + + static void +job_free_job(job_T *job) +{ + if (job->jv_next != NULL) + job->jv_next->jv_prev = job->jv_prev; + if (job->jv_prev == NULL) + first_job = job->jv_next; + else + job->jv_prev->jv_next = job->jv_next; + vim_free(job); +} + + static void +job_free(job_T *job) +{ + if (!in_free_unref_items) + { + job_free_contents(job); + job_free_job(job); + } +} + +#if defined(EXITFREE) || defined(PROTO) + void +job_free_all(void) +{ + while (first_job != NULL) + job_free(first_job); +} +#endif + +/* + * Return TRUE if we need to check if the process of "job" has ended. + */ + static int +job_need_end_check(job_T *job) +{ + return job->jv_status == JOB_STARTED + && (job->jv_stoponexit != NULL || job->jv_exit_cb != NULL); +} + +/* + * Return TRUE if the channel of "job" is still useful. + */ + static int +job_channel_still_useful(job_T *job) +{ + return job->jv_channel != NULL && channel_still_useful(job->jv_channel); +} + +/* + * Return TRUE if the channel of "job" is closeable. + */ + static int +job_channel_can_close(job_T *job) +{ + return job->jv_channel != NULL && channel_can_close(job->jv_channel); +} + +/* + * Return TRUE if the job should not be freed yet. Do not free the job when + * it has not ended yet and there is a "stoponexit" flag, an exit callback + * or when the associated channel will do something with the job output. + */ + static int +job_still_useful(job_T *job) +{ + return job_need_end_check(job) || job_channel_still_useful(job); +} + +#if defined(GUI_MAY_FORK) || defined(PROTO) +/* + * Return TRUE when there is any running job that we care about. + */ + int +job_any_running() +{ + job_T *job; + + for (job = first_job; job != NULL; job = job->jv_next) + if (job_still_useful(job)) + { + ch_log(NULL, "GUI not forking because a job is running"); + return TRUE; + } + return FALSE; +} +#endif + +#if !defined(USE_ARGV) || defined(PROTO) +/* + * Escape one argument for an external command. + * Returns the escaped string in allocated memory. NULL when out of memory. + */ + static char_u * +win32_escape_arg(char_u *arg) +{ + int slen, dlen; + int escaping = 0; + int i; + char_u *s, *d; + char_u *escaped_arg; + int has_spaces = FALSE; + + /* First count the number of extra bytes required. */ + slen = (int)STRLEN(arg); + dlen = slen; + for (s = arg; *s != NUL; MB_PTR_ADV(s)) + { + if (*s == '"' || *s == '\\') + ++dlen; + if (*s == ' ' || *s == '\t') + has_spaces = TRUE; + } + + if (has_spaces) + dlen += 2; + + if (dlen == slen) + return vim_strsave(arg); + + /* Allocate memory for the result and fill it. */ + escaped_arg = alloc(dlen + 1); + if (escaped_arg == NULL) + return NULL; + memset(escaped_arg, 0, dlen+1); + + d = escaped_arg; + + if (has_spaces) + *d++ = '"'; + + for (s = arg; *s != NUL;) + { + switch (*s) + { + case '"': + for (i = 0; i < escaping; i++) + *d++ = '\\'; + escaping = 0; + *d++ = '\\'; + *d++ = *s++; + break; + case '\\': + escaping++; + *d++ = *s++; + break; + default: + escaping = 0; + MB_COPY_CHAR(s, d); + break; + } + } + + /* add terminating quote and finish with a NUL */ + if (has_spaces) + { + for (i = 0; i < escaping; i++) + *d++ = '\\'; + *d++ = '"'; + } + *d = NUL; + + return escaped_arg; +} + +/* + * Build a command line from a list, taking care of escaping. + * The result is put in gap->ga_data. + * Returns FAIL when out of memory. + */ + int +win32_build_cmd(list_T *l, garray_T *gap) +{ + listitem_T *li; + char_u *s; + + for (li = l->lv_first; li != NULL; li = li->li_next) + { + s = get_tv_string_chk(&li->li_tv); + if (s == NULL) + return FAIL; + s = win32_escape_arg(s); + if (s == NULL) + return FAIL; + ga_concat(gap, s); + vim_free(s); + if (li->li_next != NULL) + ga_append(gap, ' '); + } + return OK; +} +#endif + +/* + * NOTE: Must call job_cleanup() only once right after the status of "job" + * changed to JOB_ENDED (i.e. after job_status() returned "dead" first or + * mch_detect_ended_job() returned non-NULL). + */ + void +job_cleanup(job_T *job) +{ + if (job->jv_status != JOB_ENDED) + return; + + /* Ready to cleanup the job. */ + job->jv_status = JOB_FINISHED; + + /* When only channel-in is kept open, close explicitly. */ + if (job->jv_channel != NULL) + ch_close_part(job->jv_channel, PART_IN); + + if (job->jv_exit_cb != NULL) + { + typval_T argv[3]; + typval_T rettv; + int dummy; + + /* Invoke the exit callback. Make sure the refcount is > 0. */ + ch_log(job->jv_channel, "Invoking exit callback %s", job->jv_exit_cb); + ++job->jv_refcount; + argv[0].v_type = VAR_JOB; + argv[0].vval.v_job = job; + argv[1].v_type = VAR_NUMBER; + argv[1].vval.v_number = job->jv_exitval; + call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb), + &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, + job->jv_exit_partial, NULL); + clear_tv(&rettv); + --job->jv_refcount; + channel_need_redraw = TRUE; + } + + /* Do not free the job in case the close callback of the associated channel + * isn't invoked yet and may get information by job_info(). */ + if (job->jv_refcount == 0 && !job_channel_still_useful(job)) + { + /* The job was already unreferenced and the associated channel was + * detached, now that it ended it can be freed. Careful: caller must + * not use "job" after this! */ + job_free(job); + } +} + +/* + * Mark references in jobs that are still useful. + */ + int +set_ref_in_job(int copyID) +{ + int abort = FALSE; + job_T *job; + typval_T tv; + + for (job = first_job; job != NULL; job = job->jv_next) + if (job_still_useful(job)) + { + tv.v_type = VAR_JOB; + tv.vval.v_job = job; + abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} + +/* + * Dereference "job". Note that after this "job" may have been freed. + */ + void +job_unref(job_T *job) +{ + if (job != NULL && --job->jv_refcount <= 0) + { + /* Do not free the job if there is a channel where the close callback + * may get the job info. */ + if (!job_channel_still_useful(job)) + { + /* Do not free the job when it has not ended yet and there is a + * "stoponexit" flag or an exit callback. */ + if (!job_need_end_check(job)) + { + job_free(job); + } + else if (job->jv_channel != NULL) + { + /* Do remove the link to the channel, otherwise it hangs + * around until Vim exits. See job_free() for refcount. */ + ch_log(job->jv_channel, "detaching channel from job"); + job->jv_channel->ch_job = NULL; + channel_unref(job->jv_channel); + job->jv_channel = NULL; + } + } + } +} + + int +free_unused_jobs_contents(int copyID, int mask) +{ + int did_free = FALSE; + job_T *job; + + for (job = first_job; job != NULL; job = job->jv_next) + if ((job->jv_copyID & mask) != (copyID & mask) + && !job_still_useful(job)) + { + /* Free the channel and ordinary items it contains, but don't + * recurse into Lists, Dictionaries etc. */ + job_free_contents(job); + did_free = TRUE; + } + return did_free; +} + + void +free_unused_jobs(int copyID, int mask) +{ + job_T *job; + job_T *job_next; + + for (job = first_job; job != NULL; job = job_next) + { + job_next = job->jv_next; + if ((job->jv_copyID & mask) != (copyID & mask) + && !job_still_useful(job)) + { + /* Free the job struct itself. */ + job_free_job(job); + } + } +} + +/* + * Allocate a job. Sets the refcount to one and sets options default. + */ + job_T * +job_alloc(void) +{ + job_T *job; + + job = (job_T *)alloc_clear(sizeof(job_T)); + if (job != NULL) + { + job->jv_refcount = 1; + job->jv_stoponexit = vim_strsave((char_u *)"term"); + + if (first_job != NULL) + { + first_job->jv_prev = job; + job->jv_next = first_job; + } + first_job = job; + } + return job; +} + + void +job_set_options(job_T *job, jobopt_T *opt) +{ + if (opt->jo_set & JO_STOPONEXIT) + { + vim_free(job->jv_stoponexit); + if (opt->jo_stoponexit == NULL || *opt->jo_stoponexit == NUL) + job->jv_stoponexit = NULL; + else + job->jv_stoponexit = vim_strsave(opt->jo_stoponexit); + } + if (opt->jo_set & JO_EXIT_CB) + { + free_callback(job->jv_exit_cb, job->jv_exit_partial); + if (opt->jo_exit_cb == NULL || *opt->jo_exit_cb == NUL) + { + job->jv_exit_cb = NULL; + job->jv_exit_partial = NULL; + } + else + { + job->jv_exit_partial = opt->jo_exit_partial; + if (job->jv_exit_partial != NULL) + { + job->jv_exit_cb = opt->jo_exit_cb; + ++job->jv_exit_partial->pt_refcount; + } + else + { + job->jv_exit_cb = vim_strsave(opt->jo_exit_cb); + func_ref(job->jv_exit_cb); + } + } + } +} + +/* + * Called when Vim is exiting: kill all jobs that have the "stoponexit" flag. + */ + void +job_stop_on_exit(void) +{ + job_T *job; + + for (job = first_job; job != NULL; job = job->jv_next) + if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) + mch_signal_job(job, job->jv_stoponexit); +} + +/* + * Return TRUE when there is any job that has an exit callback and might exit, + * which means job_check_ended() should be called more often. + */ + int +has_pending_job(void) +{ + job_T *job; + + for (job = first_job; job != NULL; job = job->jv_next) + /* Only should check if the channel has been closed, if the channel is + * open the job won't exit. */ + if ((job->jv_status == JOB_STARTED && !job_channel_still_useful(job)) + || (job->jv_status == JOB_FINISHED + && job_channel_can_close(job))) + return TRUE; + return FALSE; +} + +#define MAX_CHECK_ENDED 8 + +/* + * Called once in a while: check if any jobs that seem useful have ended. + */ + void +job_check_ended(void) +{ + int i; + + if (first_job == NULL) + return; + + for (i = 0; i < MAX_CHECK_ENDED; ++i) + { + /* NOTE: mch_detect_ended_job() must only return a job of which the + * status was just set to JOB_ENDED. */ + job_T *job = mch_detect_ended_job(first_job); + + if (job == NULL) + break; + job_cleanup(job); /* may free "job" */ + } + + if (channel_need_redraw) + { + channel_need_redraw = FALSE; + redraw_after_callback(TRUE); + } +} + +/* + * Create a job and return it. Implements job_start(). + * "argv_arg" is only for Unix. + * When "argv_arg" is NULL then "argvars" is used. + * The returned job has a refcount of one. + * Returns NULL when out of memory. + */ + job_T * +job_start( + typval_T *argvars, + char **argv_arg, + jobopt_T *opt_arg, + int is_terminal UNUSED) +{ + job_T *job; + char_u *cmd = NULL; + char **argv = NULL; + int argc = 0; +#if defined(UNIX) +# define USE_ARGV + int i; +#else + garray_T ga; +#endif + jobopt_T opt; + ch_part_T part; + + job = job_alloc(); + if (job == NULL) + return NULL; + + job->jv_status = JOB_FAILED; +#ifndef USE_ARGV + ga_init2(&ga, (int)sizeof(char*), 20); +#endif + + if (opt_arg != NULL) + opt = *opt_arg; + else + { + /* Default mode is NL. */ + clear_job_options(&opt); + opt.jo_mode = MODE_NL; + if (get_job_options(&argvars[1], &opt, + JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT + + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE, + JO2_ENV + JO2_CWD) == FAIL) + goto theend; + } + + /* Check that when io is "file" that there is a file name. */ + for (part = PART_OUT; part < PART_COUNT; ++part) + if ((opt.jo_set & (JO_OUT_IO << (part - PART_OUT))) + && opt.jo_io[part] == JIO_FILE + && (!(opt.jo_set & (JO_OUT_NAME << (part - PART_OUT))) + || *opt.jo_io_name[part] == NUL)) + { + EMSG(_("E920: _io file requires _name to be set")); + goto theend; + } + + if ((opt.jo_set & JO_IN_IO) && opt.jo_io[PART_IN] == JIO_BUFFER) + { + buf_T *buf = NULL; + + /* check that we can find the buffer before starting the job */ + if (opt.jo_set & JO_IN_BUF) + { + buf = buflist_findnr(opt.jo_io_buf[PART_IN]); + if (buf == NULL) + EMSGN(_(e_nobufnr), (long)opt.jo_io_buf[PART_IN]); + } + else if (!(opt.jo_set & JO_IN_NAME)) + { + EMSG(_("E915: in_io buffer requires in_buf or in_name to be set")); + } + else + buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE); + if (buf == NULL) + goto theend; + if (buf->b_ml.ml_mfp == NULL) + { + char_u numbuf[NUMBUFLEN]; + char_u *s; + + if (opt.jo_set & JO_IN_BUF) + { + sprintf((char *)numbuf, "%d", opt.jo_io_buf[PART_IN]); + s = numbuf; + } + else + s = opt.jo_io_name[PART_IN]; + EMSG2(_("E918: buffer must be loaded: %s"), s); + goto theend; + } + job->jv_in_buf = buf; + } + + job_set_options(job, &opt); + +#ifdef USE_ARGV + if (argv_arg != NULL) + { + /* Make a copy of argv_arg for job->jv_argv. */ + for (i = 0; argv_arg[i] != NULL; i++) + argc++; + argv = (char **)alloc(sizeof(char *) * (argc + 1)); + if (argv == NULL) + goto theend; + for (i = 0; i < argc; i++) + argv[i] = (char *)vim_strsave((char_u *)argv_arg[i]); + argv[argc] = NULL; + } + else +#endif + if (argvars[0].v_type == VAR_STRING) + { + /* Command is a string. */ + cmd = argvars[0].vval.v_string; + if (cmd == NULL || *cmd == NUL) + { + EMSG(_(e_invarg)); + goto theend; + } + + if (build_argv_from_string(cmd, &argv, &argc) == FAIL) + goto theend; + } + else if (argvars[0].v_type != VAR_LIST + || argvars[0].vval.v_list == NULL + || argvars[0].vval.v_list->lv_len < 1) + { + EMSG(_(e_invarg)); + goto theend; + } + else + { + list_T *l = argvars[0].vval.v_list; + + if (build_argv_from_list(l, &argv, &argc) == FAIL) + goto theend; +#ifndef USE_ARGV + if (win32_build_cmd(l, &ga) == FAIL) + goto theend; + cmd = ga.ga_data; +#endif + } + + /* Save the command used to start the job. */ + job->jv_argv = argv; + +#ifdef USE_ARGV + if (ch_log_active()) + { + garray_T ga; + + ga_init2(&ga, (int)sizeof(char), 200); + for (i = 0; i < argc; ++i) + { + if (i > 0) + ga_concat(&ga, (char_u *)" "); + ga_concat(&ga, (char_u *)argv[i]); + } + ch_log(NULL, "Starting job: %s", (char *)ga.ga_data); + ga_clear(&ga); + } + mch_job_start(argv, job, &opt, is_terminal); +#else + ch_log(NULL, "Starting job: %s", (char *)cmd); + mch_job_start((char *)cmd, job, &opt); +#endif + + /* If the channel is reading from a buffer, write lines now. */ + if (job->jv_channel != NULL) + channel_write_in(job->jv_channel); + +theend: +#ifndef USE_ARGV + vim_free(ga.ga_data); +#endif + if (argv != job->jv_argv) + vim_free(argv); + free_job_options(&opt); + return job; +} + +/* + * Get the status of "job" and invoke the exit callback when needed. + * The returned string is not allocated. + */ + char * +job_status(job_T *job) +{ + char *result; + + if (job->jv_status >= JOB_ENDED) + /* No need to check, dead is dead. */ + result = "dead"; + else if (job->jv_status == JOB_FAILED) + result = "fail"; + else + { + result = mch_job_status(job); + if (job->jv_status == JOB_ENDED) + job_cleanup(job); + } + return result; +} + +/* + * Implementation of job_info(). + */ + void +job_info(job_T *job, dict_T *dict) +{ + dictitem_T *item; + varnumber_T nr; + list_T *l; + int i; + + dict_add_nr_str(dict, "status", 0L, (char_u *)job_status(job)); + + item = dictitem_alloc((char_u *)"channel"); + if (item == NULL) + return; + item->di_tv.v_lock = 0; + item->di_tv.v_type = VAR_CHANNEL; + item->di_tv.vval.v_channel = job->jv_channel; + if (job->jv_channel != NULL) + ++job->jv_channel->ch_refcount; + if (dict_add(dict, item) == FAIL) + dictitem_free(item); + +#ifdef UNIX + nr = job->jv_pid; +#else + nr = job->jv_proc_info.dwProcessId; +#endif + dict_add_nr_str(dict, "process", nr, NULL); + dict_add_nr_str(dict, "tty_in", 0L, + job->jv_tty_in != NULL ? job->jv_tty_in : (char_u *)""); + dict_add_nr_str(dict, "tty_out", 0L, + job->jv_tty_out != NULL ? job->jv_tty_out : (char_u *)""); + + dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL); + dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb); + dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit); + + l = list_alloc(); + if (l != NULL) + { + dict_add_list(dict, "cmd", l); + if (job->jv_argv != NULL) + for (i = 0; job->jv_argv[i] != NULL; i++) + list_append_string(l, (char_u *)job->jv_argv[i], -1); + } +} + +/* + * Implementation of job_info() to return info for all jobs. + */ + void +job_info_all(list_T *l) +{ + job_T *job; + typval_T tv; + + for (job = first_job; job != NULL; job = job->jv_next) + { + tv.v_type = VAR_JOB; + tv.vval.v_job = job; + + if (list_append_tv(l, &tv) != OK) + return; + } +} + +/* + * Send a signal to "job". Implements job_stop(). + * When "type" is not NULL use this for the type. + * Otherwise use argvars[1] for the type. + */ + int +job_stop(job_T *job, typval_T *argvars, char *type) +{ + char_u *arg; + + if (type != NULL) + arg = (char_u *)type; + else if (argvars[1].v_type == VAR_UNKNOWN) + arg = (char_u *)""; + else + { + arg = get_tv_string_chk(&argvars[1]); + if (arg == NULL) + { + EMSG(_(e_invarg)); + return 0; + } + } + if (job->jv_status == JOB_FAILED) + { + ch_log(job->jv_channel, "Job failed to start, job_stop() skipped"); + return 0; + } + if (job->jv_status == JOB_ENDED) + { + ch_log(job->jv_channel, "Job has already ended, job_stop() skipped"); + return 0; + } + ch_log(job->jv_channel, "Stopping job with '%s'", (char *)arg); + if (mch_signal_job(job, arg) == FAIL) + return 0; + + /* Assume that only "kill" will kill the job. */ + if (job->jv_channel != NULL && STRCMP(arg, "kill") == 0) + job->jv_channel->ch_job_killed = TRUE; + + /* We don't try freeing the job, obviously the caller still has a + * reference to it. */ + return 1; +} + + void +invoke_prompt_callback(void) +{ + typval_T rettv; + int dummy; + typval_T argv[2]; + char_u *text; + char_u *prompt; + linenr_T lnum = curbuf->b_ml.ml_line_count; + + // Add a new line for the prompt before invoking the callback, so that + // text can always be inserted above the last line. + ml_append(lnum, (char_u *)"", 0, FALSE); + curwin->w_cursor.lnum = lnum + 1; + curwin->w_cursor.col = 0; + + if (curbuf->b_prompt_callback == NULL || *curbuf->b_prompt_callback == NUL) + return; + text = ml_get(lnum); + prompt = prompt_text(); + if (STRLEN(text) >= STRLEN(prompt)) + text += STRLEN(prompt); + argv[0].v_type = VAR_STRING; + argv[0].vval.v_string = vim_strsave(text); + argv[1].v_type = VAR_UNKNOWN; + + call_func(curbuf->b_prompt_callback, + (int)STRLEN(curbuf->b_prompt_callback), + &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, + curbuf->b_prompt_partial, NULL); + clear_tv(&argv[0]); + clear_tv(&rettv); +} + +/* + * Return TRUE when the interrupt callback was invoked. + */ + int +invoke_prompt_interrupt(void) +{ + typval_T rettv; + int dummy; + typval_T argv[1]; + + if (curbuf->b_prompt_interrupt == NULL + || *curbuf->b_prompt_interrupt == NUL) + return FALSE; + argv[0].v_type = VAR_UNKNOWN; + + got_int = FALSE; // don't skip executing commands + call_func(curbuf->b_prompt_interrupt, + (int)STRLEN(curbuf->b_prompt_interrupt), + &rettv, 0, argv, NULL, 0L, 0L, &dummy, TRUE, + curbuf->b_prompt_int_partial, NULL); + clear_tv(&rettv); + return TRUE; +} + +# ifdef FEAT_GUI_MACVIM + void +job_cleanup_all(void) +{ + job_T *job; + + for (job = first_job; job != NULL; job = job->jv_next) + { + channel_T *channel = job->jv_channel; + ch_part_T part; + + if (channel == NULL || job->jv_status != JOB_FINISHED) + continue; + + /* check the socket and pipes */ + for (part = PART_SOCK; part < PART_IN; ++part) + { + sock_T fd = channel->ch_part[part].ch_fd; + + if (fd != INVALID_FD) + { + int r = channel_wait(channel, fd, 0); + + if (r == CW_READY) + channel_read(channel, part, "job_cleanup_all"); + else if (r == CW_ERROR) + ch_close_part_on_error(channel, part, TRUE, + "job_cleanup_all"); + } + } + } +} +# endif + +#endif /* FEAT_JOB_CHANNEL */ diff --git a/src/charset.c b/src/charset.c index e7aabe7ed5..179fc89db3 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,17 +10,17 @@ #include "vim.h" #ifdef FEAT_LINEBREAK -static int win_chartabsize __ARGS((win_T *wp, char_u *p, colnr_T col)); +static int win_chartabsize(win_T *wp, char_u *p, colnr_T col); #endif #ifdef FEAT_MBYTE # if defined(HAVE_WCHAR_H) # include <wchar.h> /* for towupper() and towlower() */ # endif -static int win_nolbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp)); +static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp); #endif -static unsigned nr2hex __ARGS((unsigned c)); +static unsigned nr2hex(unsigned c); static int chartab_initialized = FALSE; @@ -30,21 +30,32 @@ static int chartab_initialized = FALSE; #define RESET_CHARTAB(buf, c) (buf)->b_chartab[(unsigned)(c) >> 3] &= ~(1 << ((c) & 0x7)) #define GET_CHARTAB(buf, c) ((buf)->b_chartab[(unsigned)(c) >> 3] & (1 << ((c) & 0x7))) +/* table used below, see init_chartab() for an explanation */ +static char_u g_chartab[256]; + +/* + * Flags for g_chartab[]. + */ +#define CT_CELL_MASK 0x07 /* mask: nr of display cells (1, 2 or 4) */ +#define CT_PRINT_CHAR 0x10 /* flag: set for printable chars */ +#define CT_ID_CHAR 0x20 /* flag: set for ID chars */ +#define CT_FNAME_CHAR 0x40 /* flag: set for file name chars */ + /* - * Fill chartab[]. Also fills curbuf->b_chartab[] with flags for keyword + * Fill g_chartab[]. Also fills curbuf->b_chartab[] with flags for keyword * characters for current buffer. * * Depends on the option settings 'iskeyword', 'isident', 'isfname', * 'isprint' and 'encoding'. * - * The index in chartab[] depends on 'encoding': + * The index in g_chartab[] depends on 'encoding': * - For non-multi-byte index with the byte (same as the character). * - For DBCS index with the first byte. * - For UTF-8 index with the character (when first byte is up to 0x80 it is * the same as the character, if the first byte is 0x80 and above it depends * on further bytes). * - * The contents of chartab[]: + * The contents of g_chartab[]: * - The lower two bits, masked by CT_CELL_MASK, give the number of display * cells the character occupies (1 or 2). Not valid for UTF-8 above 0x80. * - CT_PRINT_CHAR bit is set when the character is printable (no need to @@ -57,15 +68,15 @@ static int chartab_initialized = FALSE; * error, OK otherwise. */ int -init_chartab() +init_chartab(void) { return buf_init_chartab(curbuf, TRUE); } int -buf_init_chartab(buf, global) - buf_T *buf; - int global; /* FALSE: only set buf->b_chartab[] */ +buf_init_chartab( + buf_T *buf, + int global) /* FALSE: only set buf->b_chartab[] */ { int c; int c2; @@ -86,18 +97,18 @@ buf_init_chartab(buf, global) */ c = 0; while (c < ' ') - chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; + g_chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; #ifdef EBCDIC while (c < 255) #else while (c <= '~') #endif - chartab[c++] = 1 + CT_PRINT_CHAR; + g_chartab[c++] = 1 + CT_PRINT_CHAR; #ifdef FEAT_FKMAP if (p_altkeymap) { while (c < YE) - chartab[c++] = 1 + CT_PRINT_CHAR; + g_chartab[c++] = 1 + CT_PRINT_CHAR; } #endif while (c < 256) @@ -105,17 +116,17 @@ buf_init_chartab(buf, global) #ifdef FEAT_MBYTE /* UTF-8: bytes 0xa0 - 0xff are printable (latin1) */ if (enc_utf8 && c >= 0xa0) - chartab[c++] = CT_PRINT_CHAR + 1; + g_chartab[c++] = CT_PRINT_CHAR + 1; /* euc-jp characters starting with 0x8e are single width */ else if (enc_dbcs == DBCS_JPNU && c == 0x8e) - chartab[c++] = CT_PRINT_CHAR + 1; + g_chartab[c++] = CT_PRINT_CHAR + 1; /* other double-byte chars can be printable AND double-width */ else if (enc_dbcs != 0 && MB_BYTE2LEN(c) == 2) - chartab[c++] = CT_PRINT_CHAR + 2; + g_chartab[c++] = CT_PRINT_CHAR + 2; else #endif /* the rest is unprintable by default */ - chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; + g_chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; } #ifdef FEAT_MBYTE @@ -124,7 +135,7 @@ buf_init_chartab(buf, global) if ((enc_dbcs != 0 && MB_BYTE2LEN(c) > 1) || (enc_dbcs == DBCS_JPNU && c == 0x8e) || (enc_utf8 && c >= 0xa0)) - chartab[c] |= CT_FNAME_CHAR; + g_chartab[c] |= CT_FNAME_CHAR; #endif } @@ -232,9 +243,9 @@ buf_init_chartab(buf, global) if (i == 0) /* (re)set ID flag */ { if (tilde) - chartab[c] &= ~CT_ID_CHAR; + g_chartab[c] &= ~CT_ID_CHAR; else - chartab[c] |= CT_ID_CHAR; + g_chartab[c] |= CT_ID_CHAR; } else if (i == 1) /* (re)set printable */ { @@ -256,23 +267,23 @@ buf_init_chartab(buf, global) { if (tilde) { - chartab[c] = (chartab[c] & ~CT_CELL_MASK) + g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK) + ((dy_flags & DY_UHEX) ? 4 : 2); - chartab[c] &= ~CT_PRINT_CHAR; + g_chartab[c] &= ~CT_PRINT_CHAR; } else { - chartab[c] = (chartab[c] & ~CT_CELL_MASK) + 1; - chartab[c] |= CT_PRINT_CHAR; + g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK) + 1; + g_chartab[c] |= CT_PRINT_CHAR; } } } else if (i == 2) /* (re)set fname flag */ { if (tilde) - chartab[c] &= ~CT_FNAME_CHAR; + g_chartab[c] &= ~CT_FNAME_CHAR; else - chartab[c] |= CT_FNAME_CHAR; + g_chartab[c] |= CT_FNAME_CHAR; } else /* i == 3 */ /* (re)set keyword flag */ { @@ -302,9 +313,9 @@ buf_init_chartab(buf, global) * enough room, not all characters will be translated. */ void -trans_characters(buf, bufsize) - char_u *buf; - int bufsize; +trans_characters( + char_u *buf, + int bufsize) { int len; /* length of string needing translation */ int room; /* room in buffer after string */ @@ -345,8 +356,7 @@ trans_characters(buf, bufsize) * printable chars. Returns NULL when out of memory. */ char_u * -transstr(s) - char_u *s; +transstr(char_u *s) { char_u *res; char_u *p; @@ -423,11 +433,11 @@ transstr(s) * Otherwise puts the result in "buf[buflen]". */ char_u * -str_foldcase(str, orglen, buf, buflen) - char_u *str; - int orglen; - char_u *buf; - int buflen; +str_foldcase( + char_u *str, + int orglen, + char_u *buf, + int buflen) { garray_T ga; int i; @@ -531,9 +541,9 @@ str_foldcase(str, orglen, buf, buflen) #endif /* - * Catch 22: chartab[] can't be initialized before the options are + * Catch 22: g_chartab[] can't be initialized before the options are * initialized, and initializing options may cause transchar() to be called! - * When chartab_initialized == FALSE don't use chartab[]. + * When chartab_initialized == FALSE don't use g_chartab[]. * Does NOT work for multi-byte characters, c must be <= 255. * Also doesn't work for the first byte of a multi-byte, "c" must be a * character! @@ -541,8 +551,7 @@ str_foldcase(str, orglen, buf, buflen) static char_u transchar_buf[7]; char_u * -transchar(c) - int c; +transchar(int c) { int i; @@ -562,7 +571,7 @@ transchar(c) (c >= ' ' && c <= '~') #endif #ifdef FEAT_FKMAP - || F_ischar(c) + || (p_altkeymap && F_ischar(c)) #endif )) || (c < 256 && vim_isprintc_strict(c))) { @@ -581,8 +590,7 @@ transchar(c) * for an illegal UTF-8 byte. */ char_u * -transchar_byte(c) - int c; +transchar_byte(int c) { if (enc_utf8 && c >= 0x80) { @@ -599,9 +607,7 @@ transchar_byte(c) * Does NOT work for multi-byte characters, c must be <= 255. */ void -transchar_nonprint(buf, c) - char_u *buf; - int c; +transchar_nonprint(char_u *buf, int c) { if (c == NL) c = NUL; /* we use newline in place of a NUL */ @@ -668,9 +674,7 @@ transchar_nonprint(buf, c) } void -transchar_hex(buf, c) - char_u *buf; - int c; +transchar_hex(char_u *buf, int c) { int i = 0; @@ -694,8 +698,7 @@ transchar_hex(buf, c) * function key 1. */ static unsigned -nr2hex(c) - unsigned c; +nr2hex(unsigned c) { if ((c & 0xf) <= 9) return (c & 0xf) + '0'; @@ -711,14 +714,13 @@ nr2hex(c) * cells depends on further bytes. */ int -byte2cells(b) - int b; +byte2cells(int b) { #ifdef FEAT_MBYTE if (enc_utf8 && b >= 0x80) return 0; #endif - return (chartab[b] & CT_CELL_MASK); + return (g_chartab[b] & CT_CELL_MASK); } /* @@ -727,8 +729,7 @@ byte2cells(b) * A TAB is counted as two cells: "^I" or four: "<09>". */ int -char2cells(c) - int c; +char2cells(int c) { if (IS_SPECIAL(c)) return char2cells(K_SECOND(c)) + 2; @@ -748,7 +749,7 @@ char2cells(c) } } #endif - return (chartab[c & 0xff] & CT_CELL_MASK); + return (g_chartab[c & 0xff] & CT_CELL_MASK); } /* @@ -756,8 +757,7 @@ char2cells(c) * A TAB is counted as two cells: "^I" or four: "<09>". */ int -ptr2cells(p) - char_u *p; +ptr2cells(char_u *p) { #ifdef FEAT_MBYTE /* For UTF-8 we need to look at more bytes if the first byte is >= 0x80. */ @@ -765,7 +765,7 @@ ptr2cells(p) return utf_ptr2cells(p); /* For DBCS we can tell the cell count from the first byte. */ #endif - return (chartab[*p] & CT_CELL_MASK); + return (g_chartab[*p] & CT_CELL_MASK); } /* @@ -773,8 +773,7 @@ ptr2cells(p) * counting TABs as two characters: "^I". */ int -vim_strsize(s) - char_u *s; +vim_strsize(char_u *s) { return vim_strnsize(s, (int)MAXCOL); } @@ -784,9 +783,7 @@ vim_strsize(s) * screen, counting TABs as two characters: "^I". */ int -vim_strnsize(s, len) - char_u *s; - int len; +vim_strnsize(char_u *s, int len) { int size = 0; @@ -825,23 +822,15 @@ vim_strnsize(s, len) else \ return ptr2cells(p); -#if defined(FEAT_VREPLACE) || defined(FEAT_EX_EXTRA) || defined(FEAT_GUI) \ - || defined(FEAT_VIRTUALEDIT) || defined(PROTO) int -chartabsize(p, col) - char_u *p; - colnr_T col; +chartabsize(char_u *p, colnr_T col) { RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, p, col) } -#endif #ifdef FEAT_LINEBREAK static int -win_chartabsize(wp, p, col) - win_T *wp; - char_u *p; - colnr_T col; +win_chartabsize(win_T *wp, char_u *p, colnr_T col) { RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col) } @@ -852,8 +841,7 @@ win_chartabsize(wp, p, col) * taking into account the size of a tab. */ int -linetabsize(s) - char_u *s; +linetabsize(char_u *s) { return linetabsize_col(0, s); } @@ -862,9 +850,7 @@ linetabsize(s) * Like linetabsize(), but starting at column "startcol". */ int -linetabsize_col(startcol, s) - int startcol; - char_u *s; +linetabsize_col(int startcol, char_u *s) { colnr_T col = startcol; char_u *line = s; /* pointer to start of line, for breakindent */ @@ -878,16 +864,13 @@ linetabsize_col(startcol, s) * Like linetabsize(), but for a given window instead of the current one. */ int -win_linetabsize(wp, line, len) - win_T *wp; - char_u *line; - colnr_T len; +win_linetabsize(win_T *wp, char_u *line, colnr_T len) { colnr_T col = 0; char_u *s; for (s = line; *s != NUL && (len == MAXCOL || s < line + len); - mb_ptr_adv(s)) + MB_PTR_ADV(s)) col += win_lbr_chartabsize(wp, line, s, col, NULL); return (int)col; } @@ -897,65 +880,57 @@ win_linetabsize(wp, line, len) * Letters and characters from the 'isident' option. */ int -vim_isIDc(c) - int c; +vim_isIDc(int c) { - return (c > 0 && c < 0x100 && (chartab[c] & CT_ID_CHAR)); + return (c > 0 && c < 0x100 && (g_chartab[c] & CT_ID_CHAR)); } /* * return TRUE if 'c' is a keyword character: Letters and characters from - * 'iskeyword' option for current buffer. + * 'iskeyword' option for the current buffer. * For multi-byte characters mb_get_class() is used (builtin rules). */ int -vim_iswordc(c) - int c; +vim_iswordc(int c) { return vim_iswordc_buf(c, curbuf); } int -vim_iswordc_buf(c, buf) - int c; - buf_T *buf; +vim_iswordc_buf(int c, buf_T *buf) { -#ifdef FEAT_MBYTE if (c >= 0x100) { +#ifdef FEAT_MBYTE if (enc_dbcs != 0) return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2; if (enc_utf8) - return utf_class(c) >= 2; - } + return utf_class_buf(c, buf) >= 2; #endif - return (c > 0 && c < 0x100 && GET_CHARTAB(buf, c) != 0); + return FALSE; + } + return (c > 0 && GET_CHARTAB(buf, c) != 0); } /* * Just like vim_iswordc() but uses a pointer to the (multi-byte) character. */ int -vim_iswordp(p) - char_u *p; +vim_iswordp(char_u *p) { -#ifdef FEAT_MBYTE - if (has_mbyte && MB_BYTE2LEN(*p) > 1) - return mb_get_class(p) >= 2; -#endif - return GET_CHARTAB(curbuf, *p) != 0; + return vim_iswordp_buf(p, curbuf); } int -vim_iswordp_buf(p, buf) - char_u *p; - buf_T *buf; +vim_iswordp_buf(char_u *p, buf_T *buf) { + int c = *p; + #ifdef FEAT_MBYTE - if (has_mbyte && MB_BYTE2LEN(*p) > 1) - return mb_get_class(p) >= 2; + if (has_mbyte && MB_BYTE2LEN(c) > 1) + c = (*mb_ptr2char)(p); #endif - return (GET_CHARTAB(buf, *p) != 0); + return vim_iswordc_buf(c, buf); } /* @@ -963,10 +938,9 @@ vim_iswordp_buf(p, buf) * Assume characters above 0x100 are valid (multi-byte). */ int -vim_isfilec(c) - int c; +vim_isfilec(int c) { - return (c >= 0x100 || (c > 0 && (chartab[c] & CT_FNAME_CHAR))); + return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_FNAME_CHAR))); } /* @@ -976,8 +950,7 @@ vim_isfilec(c) * returns false. */ int -vim_isfilec_or_wc(c) - int c; +vim_isfilec_or_wc(int c) { char_u buf[2]; @@ -987,19 +960,18 @@ vim_isfilec_or_wc(c) } /* - * return TRUE if 'c' is a printable character + * Return TRUE if 'c' is a printable character. * Assume characters above 0x100 are printable (multi-byte), except for * Unicode. */ int -vim_isprintc(c) - int c; +vim_isprintc(int c) { #ifdef FEAT_MBYTE if (enc_utf8 && c >= 0x100) return utf_printable(c); #endif - return (c >= 0x100 || (c > 0 && (chartab[c] & CT_PRINT_CHAR))); + return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR))); } /* @@ -1007,8 +979,7 @@ vim_isprintc(c) * byte of a double-byte character. */ int -vim_isprintc_strict(c) - int c; +vim_isprintc_strict(int c) { #ifdef FEAT_MBYTE if (enc_dbcs != 0 && c < 0x100 && MB_BYTE2LEN(c) > 1) @@ -1016,17 +987,17 @@ vim_isprintc_strict(c) if (enc_utf8 && c >= 0x100) return utf_printable(c); #endif - return (c >= 0x100 || (c > 0 && (chartab[c] & CT_PRINT_CHAR))); + return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR))); } /* * like chartabsize(), but also check for line breaks on the screen */ int -lbr_chartabsize(line, s, col) - char_u *line UNUSED; /* start of the line */ - unsigned char *s; - colnr_T col; +lbr_chartabsize( + char_u *line UNUSED, /* start of the line */ + unsigned char *s, + colnr_T col) { #ifdef FEAT_LINEBREAK if (!curwin->w_p_lbr && *p_sbr == NUL && !curwin->w_p_bri) @@ -1047,15 +1018,15 @@ lbr_chartabsize(line, s, col) * Call lbr_chartabsize() and advance the pointer. */ int -lbr_chartabsize_adv(line, s, col) - char_u *line; /* start of the line */ - char_u **s; - colnr_T col; +lbr_chartabsize_adv( + char_u *line, /* start of the line */ + char_u **s, + colnr_T col) { int retval; retval = lbr_chartabsize(line, *s, col); - mb_ptr_adv(*s); + MB_PTR_ADV(*s); return retval; } @@ -1067,12 +1038,12 @@ lbr_chartabsize_adv(line, s, col) * value, init to 0 before calling. */ int -win_lbr_chartabsize(wp, line, s, col, headp) - win_T *wp; - char_u *line UNUSED; /* start of the line */ - char_u *s; - colnr_T col; - int *headp UNUSED; +win_lbr_chartabsize( + win_T *wp, + char_u *line UNUSED, /* start of the line */ + char_u *s, + colnr_T col, + int *headp UNUSED) { #ifdef FEAT_LINEBREAK int c; @@ -1118,13 +1089,10 @@ win_lbr_chartabsize(wp, line, s, col, headp) * needs a break here */ if (wp->w_p_lbr - && vim_isbreak(c) - && !vim_isbreak(s[1]) + && VIM_ISBREAK(c) + && !VIM_ISBREAK((int)s[1]) && wp->w_p_wrap -# ifdef FEAT_VERTSPLIT - && wp->w_width != 0 -# endif - ) + && wp->w_width != 0) { /* * Count all characters from first non-blank after a blank up to next @@ -1132,7 +1100,7 @@ win_lbr_chartabsize(wp, line, s, col, headp) */ numberextra = win_col_off(wp); col2 = col; - colmax = (colnr_T)(W_WIDTH(wp) - numberextra - col_adj); + colmax = (colnr_T)(wp->w_width - numberextra - col_adj); if (col >= colmax) { colmax += col_adj; @@ -1144,12 +1112,12 @@ win_lbr_chartabsize(wp, line, s, col, headp) for (;;) { ps = s; - mb_ptr_adv(s); + MB_PTR_ADV(s); c = *s; if (!(c != NUL - && (vim_isbreak(c) - || (!vim_isbreak(c) - && (col2 == col || !vim_isbreak(*ps)))))) + && (VIM_ISBREAK(c) + || (!VIM_ISBREAK(c) + && (col2 == col || !VIM_ISBREAK((int)*ps)))))) break; col2 += win_chartabsize(wp, s, col2); @@ -1178,27 +1146,54 @@ win_lbr_chartabsize(wp, line, s, col, headp) added = 0; if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0) { - numberextra = win_col_off(wp); + colnr_T sbrlen = 0; + int numberwidth = win_col_off(wp); + + numberextra = numberwidth; col += numberextra + mb_added; - if (col >= (colnr_T)W_WIDTH(wp)) + if (col >= (colnr_T)wp->w_width) { - col -= W_WIDTH(wp); - numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); - if (numberextra > 0) + col -= wp->w_width; + numberextra = wp->w_width - (numberextra - win_col_off2(wp)); + if (col >= numberextra && numberextra > 0) + col %= numberextra; + if (*p_sbr != NUL) + { + sbrlen = (colnr_T)MB_CHARLEN(p_sbr); + if (col >= sbrlen) + col -= sbrlen; + } + if (col >= numberextra && numberextra > 0) col = col % numberextra; + else if (col > 0 && numberextra > 0) + col += numberwidth - win_col_off2(wp); + + numberwidth -= win_col_off2(wp); } - if (col == 0 || col + size > (colnr_T)W_WIDTH(wp)) + if (col == 0 || col + size + sbrlen > (colnr_T)wp->w_width) { added = 0; if (*p_sbr != NUL) - added += vim_strsize(p_sbr); + { + if (size + sbrlen + numberwidth > (colnr_T)wp->w_width) + { + /* calculate effective window width */ + int width = (colnr_T)wp->w_width - sbrlen - numberwidth; + int prev_width = col ? ((colnr_T)wp->w_width - (sbrlen + col)) : 0; + if (width == 0) + width = (colnr_T)wp->w_width; + added += ((size - prev_width) / width) * vim_strsize(p_sbr); + if ((size - prev_width) % width) + /* wrapped, add another length of 'sbr' */ + added += vim_strsize(p_sbr); + } + else + added += vim_strsize(p_sbr); + } if (wp->w_p_bri) added += get_breakindent_win(wp, line); - if (tab_corr) - size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts; - else - size += added; + size += added; if (col != 0) added = 0; } @@ -1216,11 +1211,11 @@ win_lbr_chartabsize(wp, line, s, col, headp) * doesn't fit at the end of the screen line. */ static int -win_nolbr_chartabsize(wp, s, col, headp) - win_T *wp; - char_u *s; - colnr_T col; - int *headp; +win_nolbr_chartabsize( + win_T *wp, + char_u *s, + colnr_T col, + int *headp) { int n; @@ -1246,18 +1241,14 @@ win_nolbr_chartabsize(wp, s, col, headp) * "wp". */ int -in_win_border(wp, vcol) - win_T *wp; - colnr_T vcol; +in_win_border(win_T *wp, colnr_T vcol) { int width1; /* width of first line (after line number) */ int width2; /* width of further lines */ -#ifdef FEAT_VERTSPLIT if (wp->w_width == 0) /* there is no border */ return FALSE; -#endif - width1 = W_WIDTH(wp) - win_col_off(wp); + width1 = wp->w_width - win_col_off(wp); if ((int)vcol < width1 - 1) return FALSE; if ((int)vcol == width1 - 1) @@ -1278,12 +1269,12 @@ in_win_border(wp, vcol) * This is used very often, keep it fast! */ void -getvcol(wp, pos, start, cursor, end) - win_T *wp; - pos_T *pos; - colnr_T *start; - colnr_T *cursor; - colnr_T *end; +getvcol( + win_T *wp, + pos_T *pos, + colnr_T *start, + colnr_T *cursor, + colnr_T *end) { colnr_T vcol; char_u *ptr; /* points to current char */ @@ -1299,7 +1290,18 @@ getvcol(wp, pos, start, cursor, end) if (pos->col == MAXCOL) posptr = NULL; /* continue until the NUL */ else + { + /* Special check for an empty line, which can happen on exit, when + * ml_get_buf() always returns an empty string. */ + if (*ptr == NUL) + pos->col = 0; posptr = ptr + pos->col; +#ifdef FEAT_MBYTE + if (has_mbyte) + /* always start on the first byte */ + posptr -= (*mb_head_off)(line, posptr); +#endif + } /* * This function is used very often, do some speed optimizations. @@ -1341,7 +1343,7 @@ getvcol(wp, pos, start, cursor, end) if (enc_utf8 && c >= 0x80) incr = utf_ptr2cells(ptr); else - incr = CHARSIZE(c); + incr = g_chartab[c] & CT_CELL_MASK; /* If a double-cell char doesn't fit at the end of a line * it wraps to the next line, it's like this char is three @@ -1355,14 +1357,14 @@ getvcol(wp, pos, start, cursor, end) } else #endif - incr = CHARSIZE(c); + incr = g_chartab[c] & CT_CELL_MASK; } if (posptr != NULL && ptr >= posptr) /* character at pos->col */ break; vcol += incr; - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); } } else @@ -1383,7 +1385,7 @@ getvcol(wp, pos, start, cursor, end) break; vcol += incr; - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); } } if (start != NULL) @@ -1396,7 +1398,8 @@ getvcol(wp, pos, start, cursor, end) && (State & NORMAL) && !wp->w_p_list && !virtual_active() - && !(VIsual_active && (*p_sel == 'e' || ltoreq(*pos, VIsual))) + && !(VIsual_active + && (*p_sel == 'e' || LTOREQ_POS(*pos, VIsual))) ) *cursor = vcol + incr - 1; /* cursor at end */ else @@ -1408,14 +1411,18 @@ getvcol(wp, pos, start, cursor, end) * Get virtual cursor column in the current window, pretending 'list' is off. */ colnr_T -getvcol_nolist(posp) - pos_T *posp; +getvcol_nolist(pos_T *posp) { int list_save = curwin->w_p_list; colnr_T vcol; curwin->w_p_list = FALSE; - getvcol(curwin, posp, NULL, &vcol, NULL); +#ifdef FEAT_VIRTUALEDIT + if (posp->coladd) + getvvcol(curwin, posp, NULL, &vcol, NULL); + else +#endif + getvcol(curwin, posp, NULL, &vcol, NULL); curwin->w_p_list = list_save; return vcol; } @@ -1425,12 +1432,12 @@ getvcol_nolist(posp) * Get virtual column in virtual mode. */ void -getvvcol(wp, pos, start, cursor, end) - win_T *wp; - pos_T *pos; - colnr_T *start; - colnr_T *cursor; - colnr_T *end; +getvvcol( + win_T *wp, + pos_T *pos, + colnr_T *start, + colnr_T *cursor, + colnr_T *end) { colnr_T col; colnr_T coladd; @@ -1481,14 +1488,16 @@ getvvcol(wp, pos, start, cursor, end) * Used for Visual block mode. */ void -getvcols(wp, pos1, pos2, left, right) - win_T *wp; - pos_T *pos1, *pos2; - colnr_T *left, *right; +getvcols( + win_T *wp, + pos_T *pos1, + pos_T *pos2, + colnr_T *left, + colnr_T *right) { colnr_T from1, from2, to1, to2; - if (ltp(pos1, pos2)) + if (LT_POSP(pos1, pos2)) { getvvcol(wp, pos1, &from1, NULL, &to1); getvvcol(wp, pos2, &from2, NULL, &to2); @@ -1517,22 +1526,36 @@ getvcols(wp, pos1, pos2, left, right) * skipwhite: skip over ' ' and '\t'. */ char_u * -skipwhite(q) - char_u *q; +skipwhite(char_u *q) { char_u *p = q; - while (vim_iswhite(*p)) /* skip to next non-white */ + while (VIM_ISWHITE(*p)) /* skip to next non-white */ ++p; return p; } +/* + * getwhitecols: return the number of whitespace + * columns (bytes) at the start of a given line + */ + int +getwhitecols_curline() +{ + return getwhitecols(ml_get_curline()); +} + + int +getwhitecols(char_u *p) +{ + return skipwhite(p) - p; +} + /* * skip over digits */ char_u * -skipdigits(q) - char_u *q; +skipdigits(char_u *q) { char_u *p = q; @@ -1542,12 +1565,24 @@ skipdigits(q) } #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) || defined(PROTO) +/* + * skip over binary digits + */ + char_u * +skipbin(char_u *q) +{ + char_u *p = q; + + while (vim_isbdigit(*p)) /* skip to next non-digit */ + ++p; + return p; +} + /* * skip over digits and hex characters */ char_u * -skiphex(q) - char_u *q; +skiphex(char_u *q) { char_u *p = q; @@ -1557,13 +1592,24 @@ skiphex(q) } #endif -#if defined(FEAT_EX_EXTRA) || defined(PROTO) +/* + * skip to bin digit (or NUL after the string) + */ + char_u * +skiptobin(char_u *q) +{ + char_u *p = q; + + while (*p != NUL && !vim_isbdigit(*p)) /* skip to next digit */ + ++p; + return p; +} + /* * skip to digit (or NUL after the string) */ char_u * -skiptodigit(q) - char_u *q; +skiptodigit(char_u *q) { char_u *p = q; @@ -1576,8 +1622,7 @@ skiptodigit(q) * skip to hex character (or NUL after the string) */ char_u * -skiptohex(q) - char_u *q; +skiptohex(char_u *q) { char_u *p = q; @@ -1585,7 +1630,6 @@ skiptohex(q) ++p; return p; } -#endif /* * Variant of isdigit() that can handle characters > 0x100. @@ -1594,8 +1638,7 @@ skiptohex(q) * Use the VIM_ISDIGIT() macro for simple arguments. */ int -vim_isdigit(c) - int c; +vim_isdigit(int c) { return (c >= '0' && c <= '9'); } @@ -1606,14 +1649,23 @@ vim_isdigit(c) * superscript 1 to be a digit. */ int -vim_isxdigit(c) - int c; +vim_isxdigit(int c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } +/* + * Corollary of vim_isdigit and vim_isxdigit() that can handle + * characters > 0x100. + */ + int +vim_isbdigit(int c) +{ + return (c == '0' || c == '1'); +} + #if defined(FEAT_MBYTE) || defined(PROTO) /* * Vim's own character class functions. These exist because many library @@ -1629,8 +1681,7 @@ static char_u latin1upper[257] = " !\"#$%&'()*+, static char_u latin1lower[257] = " !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xd7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; int -vim_islower(c) - int c; +vim_islower(int c) { if (c <= '@') return FALSE; @@ -1654,8 +1705,7 @@ vim_islower(c) } int -vim_isupper(c) - int c; +vim_isupper(int c) { if (c <= '@') return FALSE; @@ -1679,12 +1729,11 @@ vim_isupper(c) } int -vim_toupper(c) - int c; +vim_toupper(int c) { if (c <= '@') return c; - if (c >= 0x80) + if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII)) { if (enc_utf8) return utf_toupper(c); @@ -1700,16 +1749,17 @@ vim_toupper(c) if (enc_latin1like) return latin1upper[c]; } + if (c < 0x80 && (cmp_flags & CMP_KEEPASCII)) + return TOUPPER_ASC(c); return TOUPPER_LOC(c); } int -vim_tolower(c) - int c; +vim_tolower(int c) { if (c <= '@') return c; - if (c >= 0x80) + if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII)) { if (enc_utf8) return utf_tolower(c); @@ -1725,6 +1775,8 @@ vim_tolower(c) if (enc_latin1like) return latin1lower[c]; } + if (c < 0x80 && (cmp_flags & CMP_KEEPASCII)) + return TOLOWER_ASC(c); return TOLOWER_LOC(c); } #endif @@ -1733,22 +1785,18 @@ vim_tolower(c) * skiptowhite: skip over text until ' ' or '\t' or NUL. */ char_u * -skiptowhite(p) - char_u *p; +skiptowhite(char_u *p) { while (*p != ' ' && *p != '\t' && *p != NUL) ++p; return p; } -#if defined(FEAT_LISTCMDS) || defined(FEAT_SIGNS) || defined(FEAT_SNIFF) \ - || defined(PROTO) /* * skiptowhite_esc: Like skiptowhite(), but also skip escaped chars */ char_u * -skiptowhite_esc(p) - char_u *p; +skiptowhite_esc(char_u *p) { while (*p != ' ' && *p != '\t' && *p != NUL) { @@ -1758,15 +1806,13 @@ skiptowhite_esc(p) } return p; } -#endif /* * Getdigits: Get a number from a string and skip over it. * Note: the argument is a pointer to a char_u pointer! */ long -getdigits(pp) - char_u **pp; +getdigits(char_u **pp) { char_u *p; long retval; @@ -1784,8 +1830,7 @@ getdigits(pp) * Return TRUE if "lbuf" is empty or only contains blanks. */ int -vim_isblankline(lbuf) - char_u *lbuf; +vim_isblankline(char_u *lbuf) { char_u *p; @@ -1795,35 +1840,39 @@ vim_isblankline(lbuf) /* * Convert a string into a long and/or unsigned long, taking care of - * hexadecimal and octal numbers. Accepts a '-' sign. - * If "hexp" is not NULL, returns a flag to indicate the type of the number: + * hexadecimal, octal, and binary numbers. Accepts a '-' sign. + * If "prep" is not NULL, returns a flag to indicate the type of the number: * 0 decimal * '0' octal + * 'B' bin + * 'b' bin * 'X' hex * 'x' hex * If "len" is not NULL, the length of the number in characters is returned. * If "nptr" is not NULL, the signed result is returned in it. * If "unptr" is not NULL, the unsigned result is returned in it. - * If "dooct" is non-zero recognize octal numbers, when > 1 always assume - * octal number. - * If "dohex" is non-zero recognize hex numbers, when > 1 always assume - * hex number. + * If "what" contains STR2NR_BIN recognize binary numbers + * If "what" contains STR2NR_OCT recognize octal numbers + * If "what" contains STR2NR_HEX recognize hex numbers + * If "what" contains STR2NR_FORCE always assume bin/oct/hex. + * If maxlen > 0, check at a maximum maxlen chars. */ void -vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr) - char_u *start; - int *hexp; /* return: type of number 0 = decimal, 'x' - or 'X' is hex, '0' = octal */ - int *len; /* return: detected length of number */ - int dooct; /* recognize octal number */ - int dohex; /* recognize hex number */ - long *nptr; /* return: signed result */ - unsigned long *unptr; /* return: unsigned result */ +vim_str2nr( + char_u *start, + int *prep, /* return: type of number 0 = decimal, 'x' + or 'X' is hex, '0' = octal, 'b' or 'B' + is bin */ + int *len, /* return: detected length of number */ + int what, /* what numbers to recognize */ + varnumber_T *nptr, /* return: signed result */ + uvarnumber_T *unptr, /* return: unsigned result */ + int maxlen) /* max length of string to check */ { char_u *ptr = start; - int hex = 0; /* default is decimal */ + int pre = 0; /* default is decimal */ int negative = FALSE; - unsigned long un = 0; + uvarnumber_T un = 0; int n; if (ptr[0] == '-') @@ -1832,51 +1881,92 @@ vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr) ++ptr; } - /* Recognize hex and octal. */ - if (ptr[0] == '0' && ptr[1] != '8' && ptr[1] != '9') + /* Recognize hex, octal, and bin. */ + if (ptr[0] == '0' && ptr[1] != '8' && ptr[1] != '9' + && (maxlen == 0 || maxlen > 1)) { - hex = ptr[1]; - if (dohex && (hex == 'X' || hex == 'x') && vim_isxdigit(ptr[2])) - ptr += 2; /* hexadecimal */ + pre = ptr[1]; + if ((what & STR2NR_HEX) + && (pre == 'X' || pre == 'x') && vim_isxdigit(ptr[2]) + && (maxlen == 0 || maxlen > 2)) + /* hexadecimal */ + ptr += 2; + else if ((what & STR2NR_BIN) + && (pre == 'B' || pre == 'b') && vim_isbdigit(ptr[2]) + && (maxlen == 0 || maxlen > 2)) + /* binary */ + ptr += 2; else { - hex = 0; /* default is decimal */ - if (dooct) + /* decimal or octal, default is decimal */ + pre = 0; + if (what & STR2NR_OCT) { /* Don't interpret "0", "08" or "0129" as octal. */ - for (n = 1; VIM_ISDIGIT(ptr[n]); ++n) + for (n = 1; n != maxlen && VIM_ISDIGIT(ptr[n]); ++n) { if (ptr[n] > '7') { - hex = 0; /* can't be octal */ + pre = 0; /* can't be octal */ break; } - if (ptr[n] >= '0') - hex = '0'; /* assume octal */ + pre = '0'; /* assume octal */ } } } } /* - * Do the string-to-numeric conversion "manually" to avoid sscanf quirks. - */ - if (hex == '0' || dooct > 1) + * Do the string-to-numeric conversion "manually" to avoid sscanf quirks. + */ + n = 1; + if (pre == 'B' || pre == 'b' || what == STR2NR_BIN + STR2NR_FORCE) + { + /* bin */ + if (pre != 0) + n += 2; /* skip over "0b" */ + while ('0' <= *ptr && *ptr <= '1') + { + /* avoid ubsan error for overflow */ + if (un <= UVARNUM_MAX / 2) + un = 2 * un + (uvarnumber_T)(*ptr - '0'); + else + un = UVARNUM_MAX; + ++ptr; + if (n++ == maxlen) + break; + } + } + else if (pre == '0' || what == STR2NR_OCT + STR2NR_FORCE) { /* octal */ while ('0' <= *ptr && *ptr <= '7') { - un = 8 * un + (unsigned long)(*ptr - '0'); + /* avoid ubsan error for overflow */ + if (un <= UVARNUM_MAX / 8) + un = 8 * un + (uvarnumber_T)(*ptr - '0'); + else + un = UVARNUM_MAX; ++ptr; + if (n++ == maxlen) + break; } } - else if (hex != 0 || dohex > 1) + else if (pre != 0 || what == STR2NR_HEX + STR2NR_FORCE) { /* hex */ + if (pre != 0) + n += 2; /* skip over "0x" */ while (vim_isxdigit(*ptr)) { - un = 16 * un + (unsigned long)hex2nr(*ptr); + /* avoid ubsan error for overflow */ + if (un <= UVARNUM_MAX / 16) + un = 16 * un + (uvarnumber_T)hex2nr(*ptr); + else + un = UVARNUM_MAX; ++ptr; + if (n++ == maxlen) + break; } } else @@ -1884,21 +1974,40 @@ vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr) /* decimal */ while (VIM_ISDIGIT(*ptr)) { - un = 10 * un + (unsigned long)(*ptr - '0'); + uvarnumber_T digit = (uvarnumber_T)(*ptr - '0'); + + /* avoid ubsan error for overflow */ + if (un < UVARNUM_MAX / 10 + || (un == UVARNUM_MAX / 10 && digit <= UVARNUM_MAX % 10)) + un = 10 * un + digit; + else + un = UVARNUM_MAX; ++ptr; + if (n++ == maxlen) + break; } } - if (hexp != NULL) - *hexp = hex; + if (prep != NULL) + *prep = pre; if (len != NULL) *len = (int)(ptr - start); if (nptr != NULL) { if (negative) /* account for leading '-' for decimal numbers */ - *nptr = -(long)un; + { + /* avoid ubsan error for overflow */ + if (un > VARNUM_MAX) + *nptr = VARNUM_MIN; + else + *nptr = -(varnumber_T)un; + } else - *nptr = (long)un; + { + if (un > VARNUM_MAX) + un = VARNUM_MAX; + *nptr = (varnumber_T)un; + } } if (unptr != NULL) *unptr = un; @@ -1909,8 +2018,7 @@ vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr) * Only valid when the argument is '0' - '9', 'A' - 'F' or 'a' - 'f'. */ int -hex2nr(c) - int c; +hex2nr(int c) { if (c >= 'a' && c <= 'f') return c - 'a' + 10; @@ -1919,15 +2027,13 @@ hex2nr(c) return c - '0'; } -#if defined(FEAT_TERMRESPONSE) \ - || (defined(FEAT_GUI_GTK) && defined(FEAT_WINDOWS)) || defined(PROTO) +#if defined(FEAT_TERMRESPONSE) || defined(FEAT_GUI_GTK) || defined(PROTO) /* * Convert two hex characters to a byte. * Return -1 if one of the characters is not hex. */ int -hexhex2nr(p) - char_u *p; +hexhex2nr(char_u *p) { if (!vim_isxdigit(p[0]) || !vim_isxdigit(p[1])) return -1; @@ -1949,8 +2055,7 @@ hexhex2nr(p) * characters. */ int -rem_backslash(str) - char_u *str; +rem_backslash(char_u *str) { #ifdef BACKSLASH_IN_FILENAME return (str[0] == '\\' @@ -1973,8 +2078,7 @@ rem_backslash(str) * is not a normal file character. */ void -backslash_halve(p) - char_u *p; +backslash_halve(char_u *p) { for ( ; *p; ++p) if (rem_backslash(p)) @@ -1985,8 +2089,7 @@ backslash_halve(p) * backslash_halve() plus save the result in allocated memory. */ char_u * -backslash_halve_save(p) - char_u *p; +backslash_halve_save(char_u *p) { char_u *res; @@ -2044,9 +2147,7 @@ static char_u ebcdic2ascii_tab[256] = * wanting 7-bit ASCII characters out the other end. */ void -ebcdic2ascii(buffer, len) - char_u *buffer; - int len; +ebcdic2ascii(char_u *buffer, int len) { int i; diff --git a/src/config.aap.in b/src/config.aap.in index d398a193ab..34ddfa618e 100644 --- a/src/config.aap.in +++ b/src/config.aap.in @@ -47,8 +47,6 @@ PYTHON_SRC = @PYTHON_SRC@ PYTHON_OBJ = @PYTHON_OBJ@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_CONFDIR = @PYTHON_CONFDIR@ -PYTHON_GETPATH_CFLAGS = @PYTHON_GETPATH_CFLAGS@ TCL = @vi_cv_path_tcl@ TCL_SRC = @TCL_SRC@ @@ -65,6 +63,8 @@ WORKSHOP_OBJ = @WORKSHOP_OBJ@ NETBEANS_SRC = @NETBEANS_SRC@ NETBEANS_OBJ = @NETBEANS_OBJ@ +CHANNEL_SRC = @CHANNEL_SRC@ +CHANNEL_OBJ = @CHANNEL_OBJ@ RUBY = @vi_cv_path_ruby@ RUBY_SRC = @RUBY_SRC@ @@ -73,9 +73,6 @@ RUBY_PRO = @RUBY_PRO@ RUBY_CFLAGS = @RUBY_CFLAGS@ RUBY_LIBS = @RUBY_LIBS@ -SNIFF_SRC = @SNIFF_SRC@ -SNIFF_OBJ = @SNIFF_OBJ@ - AWK = @AWK@ STRIP = @STRIP@ diff --git a/src/config.h.in b/src/config.h.in index 7f16e622aa..73eff7e1c0 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,6 +1,6 @@ /* - * config.h.in. Generated automatically from configure.in by autoheader, and - * manually changed after that. + * config.h.in. Originally generated automatically from configure.ac by + * autoheader and manually changed after that. */ /* Define if we have EBCDIC code */ @@ -154,12 +154,15 @@ #undef BAD_GETCWD /* Define if you the function: */ -#undef HAVE_BCMP #undef HAVE_FCHDIR #undef HAVE_FCHOWN +#undef HAVE_FCHMOD +#undef HAVE_FLOAT_FUNCS #undef HAVE_FSEEKO #undef HAVE_FSYNC +#undef HAVE_FTRUNCATE #undef HAVE_GETCWD +#undef HAVE_GETPGID #undef HAVE_GETPSEUDOTTY #undef HAVE_GETPWENT #undef HAVE_GETPWNAM @@ -168,14 +171,13 @@ #undef HAVE_GETTIMEOFDAY #undef HAVE_GETWD #undef HAVE_ICONV -#undef HAVE_NL_LANGINFO_CODESET #undef HAVE_LSTAT -#undef HAVE_MEMCMP #undef HAVE_MEMSET +#undef HAVE_MIGEMO #undef HAVE_MKDTEMP #undef HAVE_NANOSLEEP +#undef HAVE_NL_LANGINFO_CODESET #undef HAVE_OPENDIR -#undef HAVE_FLOAT_FUNCS #undef HAVE_PUTENV #undef HAVE_QSORT #undef HAVE_READLINK @@ -190,6 +192,7 @@ #undef HAVE_SIGSET #undef HAVE_SIGSETJMP #undef HAVE_SIGSTACK +#undef HAVE_SIGPROCMASK #undef HAVE_SIGVEC #undef HAVE_SMACK #undef HAVE_STRCASECMP @@ -209,9 +212,11 @@ #undef HAVE_TOWLOWER #undef HAVE_TOWUPPER #undef HAVE_ISWUPPER +#undef HAVE_UNSETENV #undef HAVE_USLEEP #undef HAVE_UTIME #undef HAVE_BIND_TEXTDOMAIN_CODESET +#undef HAVE_MBLEN /* Define, if needed, for accessing large files. */ #undef _LARGE_FILES @@ -233,6 +238,7 @@ #undef HAVE_LIBGEN_H #undef HAVE_LIBINTL_H #undef HAVE_LOCALE_H +#undef HAVE_MIGEMO_H #undef HAVE_MATH_H #undef HAVE_NDIR_H #undef HAVE_POLL_H @@ -296,7 +302,6 @@ /* #undef STDC_HEADERS */ /* instead, we check a few STDC things ourselves */ -#undef HAVE_STDARG_H #undef HAVE_STDLIB_H #undef HAVE_STRING_H @@ -321,6 +326,9 @@ /* Define if you want to include the Lua interpreter. */ #undef FEAT_LUA +/* Define if you want to include the Lua 5.2 interpreter. */ +#undef FEAT_LUA52 + /* Define for linking via dlopen() or LoadLibrary() */ #undef DYNAMIC_LUA @@ -354,14 +362,17 @@ /* Define if you want to include the Ruby interpreter. */ #undef FEAT_RUBY +/* Define if you want to include the Ruby1.9 interpreter. */ +#undef FEAT_RUBY19 + /* Define for linking via dlopen() or LoadLibrary() */ #undef DYNAMIC_RUBY /* Define if you want to include the Tcl interpreter. */ #undef FEAT_TCL -/* Define if you want to include the Sniff interface. */ -#undef FEAT_SNIFF +/* Define for linking via dlopen() or LoadLibrary() */ +#undef DYNAMIC_TCL /* Define if you want to add support for ACL */ #undef HAVE_POSIX_ACL @@ -369,6 +380,9 @@ #undef HAVE_SOLARIS_ACL #undef HAVE_AIX_ACL +/* Define if pango_shape_full() is available. */ +#undef HAVE_PANGO_SHAPE_FULL + /* Define if you want to add support of GPM (Linux console mouse daemon) */ #undef HAVE_GPM @@ -381,6 +395,9 @@ /* Define if you want to include multibyte support. */ #undef FEAT_MBYTE +/* Define if you want to always define a server name at vim startup. */ +#undef FEAT_AUTOSERVERNAME + /* Define if you want to include fontset support. */ #undef FEAT_XFONTSET @@ -396,9 +413,6 @@ /* Define if you use KDE and want KDE Toolbar support. */ #undef FEAT_KDETOOLBAR -/* Define if GTK+ multihead support is available (requires GTK+ >= 2.1.1). */ -#undef HAVE_GTK_MULTIHEAD - /* Define if your X has own locale library */ #undef X_LOCALE @@ -429,6 +443,12 @@ /* Define if you want to include NetBeans integration. */ #undef FEAT_NETBEANS_INTG +/* Define if you want to include process communication. */ +#undef FEAT_JOB_CHANNEL + +/* Define if you want to include terminal emulator support. */ +#undef FEAT_TERMINAL + /* Define default global runtime path */ #undef RUNTIME_GLOBAL @@ -441,8 +461,29 @@ /* Define if fcntl()'s F_SETFD command knows about FD_CLOEXEC */ #undef HAVE_FD_CLOEXEC +/* Define if /proc/self/exe or similar can be read */ +#undef PROC_EXE_LINK + /* Define if you want Cygwin to use the WIN32 clipboard, not compatible with X11*/ #undef FEAT_CYGWIN_WIN32_CLIPBOARD /* Define if we have AvailabilityMacros.h on Mac OS X */ #undef HAVE_AVAILABILITYMACROS_H + +/* Define if Xutf8SetWMProperties() is in an X library. */ +#undef HAVE_XUTF8SETWMPROPERTIES + +/* Define if GResource is used to load icons */ +#undef USE_GRESOURCE + +/* Define if GTK+ GUI is to be linked against GTK+ 3 */ +#undef USE_GTK3 + +/* Define if we have isinf() */ +#undef HAVE_ISINF + +/* Define if we have isnan() */ +#undef HAVE_ISNAN + +/* Define to inline symbol or empty */ +#undef inline diff --git a/src/config.mk.dist b/src/config.mk.dist index fa7c108505..8a584c29a4 100644 --- a/src/config.mk.dist +++ b/src/config.mk.dist @@ -1,4 +1,4 @@ -the first targets to make vim are: scratch config myself +the first target to make vim is: reconfig srcdir = . VIMNAME = vim EXNAME = ex diff --git a/src/config.mk.in b/src/config.mk.in index a8bd68d1eb..071f37eec1 100644 --- a/src/config.mk.in +++ b/src/config.mk.in @@ -44,17 +44,24 @@ LUA_OBJ = @LUA_OBJ@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_PRO = @LUA_PRO@ +LUA52_LIBS = @LUA52_LIBS@ +LUA52_SRC = @LUA52_SRC@ +LUA52_OBJ = @LUA52_OBJ@ +LUA52_CFLAGS = @LUA52_CFLAGS@ +LUA52_PRO = @LUA52_PRO@ + MZSCHEME_LIBS = @MZSCHEME_LIBS@ MZSCHEME_SRC = @MZSCHEME_SRC@ MZSCHEME_OBJ = @MZSCHEME_OBJ@ MZSCHEME_CFLAGS = @MZSCHEME_CFLAGS@ MZSCHEME_PRO = @MZSCHEME_PRO@ -MZSCHEME_EXTRA = @MZSCHEME_EXTRA@ +MZSCHEME_EXTRA = @MZSCHEME_EXTRA@ MZSCHEME_MZC = @MZSCHEME_MZC@ PERL = @vi_cv_path_perl@ PERLLIB = @vi_cv_perllib@ PERLSITELIB = @vi_cv_perlsitelib@ +PERL_XSUBPP = @vi_cv_perl_xsubpp@ PERL_LIBS = @PERL_LIBS@ SHRPENV = @shrpenv@ PERL_SRC = @PERL_SRC@ @@ -66,14 +73,11 @@ PYTHON_SRC = @PYTHON_SRC@ PYTHON_OBJ = @PYTHON_OBJ@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_CONFDIR = @PYTHON_CONFDIR@ -PYTHON_GETPATH_CFLAGS = @PYTHON_GETPATH_CFLAGS@ PYTHON3_SRC = @PYTHON3_SRC@ PYTHON3_OBJ = @PYTHON3_OBJ@ PYTHON3_CFLAGS = @PYTHON3_CFLAGS@ PYTHON3_LIBS = @PYTHON3_LIBS@ -PYTHON3_CONFDIR = @PYTHON3_CONFDIR@ TCL = @vi_cv_path_tcl@ TCL_SRC = @TCL_SRC@ @@ -90,6 +94,10 @@ WORKSHOP_OBJ = @WORKSHOP_OBJ@ NETBEANS_SRC = @NETBEANS_SRC@ NETBEANS_OBJ = @NETBEANS_OBJ@ +CHANNEL_SRC = @CHANNEL_SRC@ +CHANNEL_OBJ = @CHANNEL_OBJ@ +TERM_SRC = @TERM_SRC@ +TERM_OBJ = @TERM_OBJ@ RUBY = @vi_cv_path_ruby@ RUBY_SRC = @RUBY_SRC@ @@ -98,14 +106,12 @@ RUBY_PRO = @RUBY_PRO@ RUBY_CFLAGS = @RUBY_CFLAGS@ RUBY_LIBS = @RUBY_LIBS@ -SNIFF_SRC = @SNIFF_SRC@ -SNIFF_OBJ = @SNIFF_OBJ@ - AWK = @AWK@ STRIP = @STRIP@ EXEEXT = @EXEEXT@ +CROSS_COMPILING = @CROSS_COMPILING@ COMPILEDBY = @compiledby@ @@ -159,6 +165,13 @@ GUI_X_LIBS = @GUI_X_LIBS@ MOTIF_LIBNAME = @MOTIF_LIBNAME@ GTK_LIBNAME = @GTK_LIBNAME@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GRESOURCE_SRC = @GRESOURCE_SRC@ +GRESOURCE_OBJ = @GRESOURCE_OBJ@ + +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +UPDATE_DESKTOP_DATABASE = @UPDATE_DESKTOP_DATABASE@ + ### Any OS dependent extra source and object file OS_EXTRA_SRC = @OS_EXTRA_SRC@ OS_EXTRA_OBJ = @OS_EXTRA_OBJ@ diff --git a/src/configure.ac b/src/configure.ac new file mode 100644 index 0000000000..214cf1e2f6 --- /dev/null +++ b/src/configure.ac @@ -0,0 +1,4674 @@ +dnl configure.ac: autoconf script for Vim + +dnl Process this file with autoconf 2.12 or 2.13 to produce "configure". +dnl Should also work with autoconf 2.54 and later. + +AC_INIT(vim.h) +AC_CONFIG_HEADER(auto/config.h:config.h.in) + +dnl Being able to run configure means the system is Unix (compatible). +AC_DEFINE(UNIX) +AC_PROG_MAKE_SET + +dnl Checks for programs. +AC_PROG_CC_C99 dnl required by almost everything +AC_PROG_CPP dnl required by header file checks +AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP +AC_PROG_FGREP dnl finds working grep -F +AC_ISC_POSIX dnl required by AC_C_CROSS +AC_PROG_AWK dnl required for "make html" in ../doc + +dnl Don't strip if we don't have it +AC_CHECK_PROG(STRIP, strip, strip, :) + +dnl Check for extension of executables +AC_EXEEXT + +dnl Check for standard headers. We don't use this in Vim but other stuff +dnl in autoconf needs it, where it uses STDC_HEADERS. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT + +dnl Check that the C99 features that Vim uses are supported: +if test x"$ac_cv_prog_cc_c99" != xno; then + dnl If the compiler doesn't explicitly support C99, then check + dnl for the specific features Vim uses + + AC_TYPE_LONG_LONG_INT + if test "$ac_cv_type_long_long_int" = no; then + AC_MSG_FAILURE([Compiler does not support long long int]) + fi + + AC_MSG_CHECKING([if the compiler supports trailing commas]) + trailing_commas=no + AC_TRY_COMPILE([], [ + enum { + one, + };], + [AC_MSG_RESULT(yes); trailing_commas=yes], + [AC_MSG_RESULT(no)]) + if test "$trailing_commas" = no; then + AC_MSG_FAILURE([Compiler does not support trailing comma in enum]) + fi + + AC_MSG_CHECKING([if the compiler supports C++ comments]) + slash_comments=no + AC_TRY_COMPILE([], + [// C++ comments?], + [AC_MSG_RESULT(yes); slash_comments=yes], + [AC_MSG_RESULT(no)]) + if test "$slash_comments" = no; then + AC_MSG_FAILURE([Compiler does not support C++ comments]) + fi +fi + +dnl Check for the flag that fails if stuff are missing. + +AC_MSG_CHECKING(--enable-fail-if-missing argument) +AC_ARG_ENABLE(fail_if_missing, + [ --enable-fail-if-missing Fail if dependencies on additional features + specified on the command line are missing.], + [fail_if_missing="yes"], + [fail_if_missing="no"]) +AC_MSG_RESULT($fail_if_missing) + +dnl Set default value for CFLAGS if none is defined or it's empty +if test -z "$CFLAGS"; then + CFLAGS="-O" + test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall" +fi +if test "$GCC" = yes; then + dnl method that should work for nearly all versions + gccversion=`$CC -dumpversion` + if test "x$gccversion" = "x"; then + dnl old method; fall-back for when -dumpversion doesn't work + gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'` + fi + dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki + if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then + echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"' + CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'` + else + if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then + echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' + CFLAGS="$CFLAGS -fno-strength-reduce" + fi + fi +fi + +dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a +dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on +dnl the version number of the clang in use. +dnl Note that this does not work to get the version of clang 3.1 or 3.2. +AC_MSG_CHECKING(for clang version) +CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang[[^0-9]]*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'` +if test x"$CLANG_VERSION_STRING" != x"" ; then + CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'` + CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'` + CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'` + CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION` + AC_MSG_RESULT($CLANG_VERSION) + dnl If you find the same issue with versions earlier than 500.2.75, + dnl change the constant 500002075 below appropriately. To get the + dnl integer corresponding to a version number, refer to the + dnl definition of CLANG_VERSION above. + AC_MSG_CHECKING(if clang supports -fno-strength-reduce) + if test "$CLANG_VERSION" -ge 500002075 ; then + AC_MSG_RESULT(no) + CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'` + else + AC_MSG_RESULT(yes) + fi +else + AC_MSG_RESULT(N/A) +fi + +dnl If configure thinks we are cross compiling, there might be something +dnl wrong with the CC or CFLAGS settings, give a useful warning message +CROSS_COMPILING= +if test "$cross_compiling" = yes; then + AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS]) + CROSS_COMPILING=1 +fi +AC_SUBST(CROSS_COMPILING) + +dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies. +dnl But gcc 3.1 changed the meaning! See near the end. +test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM) + +if test -f ./toolcheck; then + AC_CHECKING(for buggy tools) + sh ./toolcheck 1>&AC_FD_MSG +fi + +OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" + +dnl Check for BeOS, which needs an extra source file +AC_MSG_CHECKING(for BeOS) +case `uname` in + BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o + BEOS=yes; AC_MSG_RESULT(yes);; + *) BEOS=no; AC_MSG_RESULT(no);; +esac + +dnl If QNX is found, assume we don't want to use Xphoton +dnl unless it was specifically asked for (--with-x) +AC_MSG_CHECKING(for QNX) +case `uname` in + QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o + test -z "$with_x" && with_x=no + QNX=yes; AC_MSG_RESULT(yes);; + *) QNX=no; AC_MSG_RESULT(no);; +esac + +dnl Check for Darwin and MacOS X +dnl We do a check for MacOS X in the very beginning because there +dnl are a lot of other things we need to change besides GUI stuff +AC_MSG_CHECKING([for Darwin (Mac OS X)]) +if test "`(uname) 2>/dev/null`" = Darwin; then + AC_MSG_RESULT(yes) + MACOS_X=yes + CPPFLAGS="$CPPFLAGS -DMACOS_X" + + AC_MSG_CHECKING(--disable-darwin argument) + AC_ARG_ENABLE(darwin, + [ --disable-darwin Disable Darwin (Mac OS X) support.], + , [enable_darwin="yes"]) + if test "$enable_darwin" = "yes"; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if Darwin files are there) + if test -f os_macosx.m; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT([no, Darwin support disabled]) + enable_darwin=no + fi + else + AC_MSG_RESULT([yes, Darwin support excluded]) + fi + + AC_MSG_CHECKING(--with-developer-dir argument) + AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools], + DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR), + AC_MSG_RESULT(not present)) + + if test "x$DEVELOPER_DIR" = "x"; then + AC_PATH_PROG(XCODE_SELECT, xcode-select) + if test "x$XCODE_SELECT" != "x"; then + AC_MSG_CHECKING(for developer dir using xcode-select) + DEVELOPER_DIR=`$XCODE_SELECT -print-path` + AC_MSG_RESULT([$DEVELOPER_DIR]) + else + DEVELOPER_DIR=/Developer + fi + fi + + AC_MSG_CHECKING(--with-macsdk argument) + AC_ARG_WITH(macsdk, + [ --with-macsdk=SDK SDK version (10.4, 10.5, 10.6, ...)], + [ MACSDK="$withval"; AC_MSG_RESULT($MACSDK) ], + [ MACSDK=""; AC_MSG_RESULT(using default) ]) + + if test -n "$MACSDK"; then + AC_MSG_CHECKING(if SDK is supported) + save_cflags="$CFLAGS" + save_ldflags="$LDFLAGS" + sdkflags="$DEVELOPER_DIR/SDKs/MacOSX$MACSDK" + if test "x$MACSDK" = "x10.4"; then + sdkflags="$sdkflags""u" + fi + sdkflags="$sdkflags.sdk -mmacosx-version-min=$MACSDK" + CFLAGS="$CFLAGS -isysroot $sdkflags" + LDFLAGS="$LDFLAGS -Wl,-syslibroot,$sdkflags" + AC_TRY_LINK([ ], [ ], + [ AC_MSG_RESULT([yes]) + XCODEFLAGS="$XCODEFLAGS -sdk macosx$MACSDK MACOSX_DEPLOYMENT_TARGET=$MACSDK" ], + [ AC_MSG_RESULT([no]) + dnl Important to clear MACSDK so later on in the script we can assume + dnl that no SDK was chosen if it is empty. + MACSDK="" + CFLAGS="$save_cflags" + LDFLAGS="$save_ldflags" ]) + else + if test -z "$MACOSX_DEPLOYMENT_TARGET"; then + macosx_deployment_target=`/usr/bin/sw_vers -productVersion|/usr/bin/sed -e 's/^\([[0-9]]*\.[[0-9]]*\).*/\1/'` + XCODEFLAGS="$XCODEFLAGS MACOSX_DEPLOYMENT_TARGET=$macosx_deployment_target" + fi + fi + + + AC_MSG_CHECKING(--with-macarchs argument) + AC_ARG_WITH(macarchs, + [ --with-macarchs=ARCHS space separated list of archs (i386 x86_64 ppc ...)], + [ ARCHS="$withval"; AC_MSG_RESULT($ARCHS) ], + [ ARCHS=""; AC_MSG_RESULT(defaulting to native arch) ]) + + if test -n "$ARCHS"; then + AC_MSG_CHECKING(if architectures are supported) + save_cflags="$CFLAGS" + save_ldflags="$LDFLAGS" + archflags=`echo "$ARCHS" | sed -e 's/[[[:<:]]]/-arch /g'` + CFLAGS="$CFLAGS $archflags" + LDFLAGS="$LDFLAGS $archflags" + AC_TRY_LINK([ ], [ ], + [ AC_MSG_RESULT([yes]) + XCODEFLAGS="$XCODEFLAGS ARCHS=\"$ARCHS\" ONLY_ACTIVE_ARCH=\"NO\"" ], + [ AC_MSG_RESULT([no, will build for native arch only]) + ARCHS="" + CFLAGS="$save_cflags" + LDFLAGS="$save_ldflags" ]) + fi + + + if test "$enable_darwin" = "yes"; then + MACOS_X_DARWIN=yes + OS_EXTRA_SRC="os_macosx.m os_mac_conv.c"; + OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" + dnl TODO: use -arch i386 on Intel machines + dnl Removed -no-cpp-precomp, only for very old compilers. + CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN" + + dnl If Carbon or Cocoa is found, assume we don't want + dnl X11 unless it was specifically asked for (--with-x) + dnl or Motif, Athena or GTK GUI is used. + AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes) + + SAVE_CPPFLAGS=$CPPFLAGS + SAVE_CFLAGS=$CFLAGS + CPPFLAGS="$CPPFLAGS -ObjC" + CFLAGS="$CFLAGS -ObjC" + AC_CHECK_HEADER(Cocoa/Cocoa.h, COCOA=yes) + CPPFLAGS=$SAVE_CPPFLAGS + CFLAGS=$SAVE_CFLAGS + + if test "x$CARBON" = "xyes" -o "x$COCOA" = "xyes"; then + if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then + with_x=no + fi + fi + fi +else + AC_MSG_RESULT(no) +fi + +dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon +dnl so we need to include it to have access to version macros. +AC_CHECK_HEADERS(AvailabilityMacros.h) + +AC_SUBST(OS_EXTRA_SRC) +AC_SUBST(OS_EXTRA_OBJ) + +dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS. +dnl Only when the directory exists and it wasn't there yet. +dnl For gcc don't do this when it is already in the default search path. +dnl Skip all of this when cross-compiling. +if test "$cross_compiling" = no; then + AC_MSG_CHECKING(--with-local-dir argument) + have_local_include='' + have_local_lib='' + AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries. + --without-local-dir do not search /usr/local for local libraries.], [ + local_dir="$withval" + case "$withval" in + */*) ;; + no) + # avoid adding local dir to LDFLAGS and CPPFLAGS + have_local_include=yes + have_local_lib=yes + ;; + *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;; + esac + AC_MSG_RESULT($local_dir) + ], [ + local_dir=/usr/local + AC_MSG_RESULT(Defaulting to $local_dir) + ]) + if test "$GCC" = yes -a "$local_dir" != no; then + echo 'void f(){}' > conftest.c + dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler) + have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"` + have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"` + rm -f conftest.c conftest.o + fi + if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then + tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"` + if test "$tt" = "$LDFLAGS"; then + LDFLAGS="$LDFLAGS -L${local_dir}/lib" + fi + fi + if test -z "$have_local_include" -a -d "${local_dir}/include"; then + tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"` + if test "$tt" = "$CPPFLAGS"; then + CPPFLAGS="$CPPFLAGS -I${local_dir}/include" + fi + fi +fi + +AC_MSG_CHECKING(--with-vim-name argument) +AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], + VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME), + VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME)) +AC_SUBST(VIMNAME) +AC_MSG_CHECKING(--with-ex-name argument) +AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable], + EXNAME="$withval"; AC_MSG_RESULT($EXNAME), + EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex)) +AC_SUBST(EXNAME) +AC_MSG_CHECKING(--with-view-name argument) +AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable], + VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME), + VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view)) +AC_SUBST(VIEWNAME) + +AC_MSG_CHECKING(--with-global-runtime argument) +AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'], + AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"), + AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(--with-modified-by argument) +AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version], + AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"), + AC_MSG_RESULT(no)) + +dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix +AC_MSG_CHECKING(if character set is EBCDIC) +AC_TRY_COMPILE([ ], +[ /* TryCompile function for CharSet. + Treat any failure as ASCII for compatibility with existing art. + Use compile-time rather than run-time tests for cross-compiler + tolerance. */ +#if '0'!=240 +make an error "Character set is not EBCDIC" +#endif ], +[ # TryCompile action if true +cf_cv_ebcdic=yes ], +[ # TryCompile action if false +cf_cv_ebcdic=no]) +# end of TryCompile ]) +# end of CacheVal CvEbcdic +AC_MSG_RESULT($cf_cv_ebcdic) +case "$cf_cv_ebcdic" in #(vi + yes) AC_DEFINE(EBCDIC) + line_break='"\\n"' + ;; + *) line_break='"\\012"';; +esac +AC_SUBST(line_break) + +if test "$cf_cv_ebcdic" = "yes"; then +dnl If we have EBCDIC we most likely have z/OS Unix, let's test it! +AC_MSG_CHECKING(for z/OS Unix) +case `uname` in + OS/390) zOSUnix="yes"; + dnl If using cc the environment variable _CC_CCMODE must be + dnl set to "1", so that some compiler extensions are enabled. + dnl If using c89 the environment variable is named _CC_C89MODE. + dnl Note: compile with c89 never tested. + if test "$CC" = "cc"; then + ccm="$_CC_CCMODE" + ccn="CC" + else + if test "$CC" = "c89"; then + ccm="$_CC_C89MODE" + ccn="C89" + else + ccm=1 + fi + fi + if test "$ccm" != "1"; then + echo "" + echo "------------------------------------------" + echo " On z/OS Unix, the environment variable" + echo " _CC_${ccn}MODE must be set to \"1\"!" + echo " Do:" + echo " export _CC_${ccn}MODE=1" + echo " and then call configure again." + echo "------------------------------------------" + exit 1 + fi + # Set CFLAGS for configure process. + # This will be reset later for config.mk. + # Use haltonmsg to force error for missing H files. + CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; + LDFLAGS="$LDFLAGS -Wl,EDIT=NO" + AC_MSG_RESULT(yes) + ;; + *) zOSUnix="no"; + AC_MSG_RESULT(no) + ;; +esac +fi + +dnl Set QUOTESED. Needs additional backslashes on zOS +if test "$zOSUnix" = "yes"; then + QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'" +else + QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'" +fi +AC_SUBST(QUOTESED) + + +dnl Link with -lsmack for Smack stuff; if not found +AC_MSG_CHECKING(--disable-smack argument) +AC_ARG_ENABLE(smack, + [ --disable-smack Do not check for Smack support.], + , enable_smack="yes") +if test "$enable_smack" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no") +else + AC_MSG_RESULT(yes) +fi +if test "$enable_smack" = "yes"; then + AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no") +fi +if test "$enable_smack" = "yes"; then + AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h) + AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); enable_smack="no") +fi +if test "$enable_smack" = "yes"; then + AC_CHECK_LIB(attr, setxattr, + [LIBS="$LIBS -lattr" + found_smack="yes" + AC_DEFINE(HAVE_SMACK)]) +fi + +dnl When smack was found don't search for SELinux +if test "x$found_smack" = "x"; then + dnl Link with -lselinux for SELinux stuff; if not found + AC_MSG_CHECKING(--disable-selinux argument) + AC_ARG_ENABLE(selinux, + [ --disable-selinux Do not check for SELinux support.], + , enable_selinux="yes") + if test "$enable_selinux" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_LIB(selinux, is_selinux_enabled, + [AC_CHECK_HEADER(selinux/selinux.h, + [LIBS="$LIBS -lselinux" + AC_DEFINE(HAVE_SELINUX)])]) + else + AC_MSG_RESULT(yes) + fi +fi + +dnl Check user requested features. + +AC_MSG_CHECKING(--with-features argument) +AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)], + features="$withval"; AC_MSG_RESULT($features), + features="huge"; AC_MSG_RESULT(Defaulting to huge)) + +dovimdiff="" +dogvimdiff="" +case "$features" in + tiny) AC_DEFINE(FEAT_TINY) ;; + small) AC_DEFINE(FEAT_SMALL) ;; + normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + *) AC_MSG_RESULT([Sorry, $features is not supported]) ;; +esac + +AC_SUBST(dovimdiff) +AC_SUBST(dogvimdiff) + +AC_MSG_CHECKING(--with-compiledby argument) +AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message], + compiledby="$withval"; AC_MSG_RESULT($withval), + compiledby=""; AC_MSG_RESULT(no)) +AC_SUBST(compiledby) + +AC_MSG_CHECKING(--disable-xsmp argument) +AC_ARG_ENABLE(xsmp, + [ --disable-xsmp Disable XSMP session management], + , enable_xsmp="yes") + +if test "$enable_xsmp" = "yes"; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(--disable-xsmp-interact argument) + AC_ARG_ENABLE(xsmp-interact, + [ --disable-xsmp-interact Disable XSMP interaction], + , enable_xsmp_interact="yes") + if test "$enable_xsmp_interact" = "yes"; then + AC_MSG_RESULT(no) + AC_DEFINE(USE_XSMP_INTERACT) + else + AC_MSG_RESULT(yes) + fi +else + AC_MSG_RESULT(yes) +fi + +dnl Check for Lua feature. +AC_MSG_CHECKING(--enable-luainterp argument) +AC_ARG_ENABLE(luainterp, + [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_luainterp="no"]) +AC_MSG_RESULT($enable_luainterp) + +if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Lua with tiny or small features]) + fi + + dnl -- find the lua executable + AC_SUBST(vi_cv_path_lua) + + AC_MSG_CHECKING(--with-lua-prefix argument) + AC_ARG_WITH(lua_prefix, + [ --with-lua-prefix=PFX Prefix where Lua is installed.], + with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix), + with_lua_prefix="";AC_MSG_RESULT(no)) + + if test "X$with_lua_prefix" != "X"; then + vi_cv_path_lua_pfx="$with_lua_prefix" + else + AC_MSG_CHECKING(LUA_PREFIX environment var) + if test "X$LUA_PREFIX" != "X"; then + AC_MSG_RESULT("$LUA_PREFIX") + vi_cv_path_lua_pfx="$LUA_PREFIX" + else + AC_MSG_RESULT([not set, default to /usr]) + vi_cv_path_lua_pfx="/usr" + fi + fi + + AC_MSG_CHECKING(--with-luajit) + AC_ARG_WITH(luajit, + [ --with-luajit Link with LuaJIT instead of Lua.], + [vi_cv_with_luajit="$withval"], + [vi_cv_with_luajit="no"]) + AC_MSG_RESULT($vi_cv_with_luajit) + + if test "X$vi_cv_path_lua_pfx" != "X"; then + if test "x$vi_cv_with_luajit" != "xno"; then + dnl -- try to find LuaJIT executable + AC_PATH_PROG(vi_cv_path_luajit, luajit) + if test "X$vi_cv_path_luajit" != "X"; then + dnl -- find LuaJIT version + AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit, + [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ]) + AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit, + [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ]) + vi_cv_path_lua="$vi_cv_path_luajit" + vi_cv_version_lua="$vi_cv_version_lua_luajit" + fi + else + dnl -- try to find Lua executable + AC_PATH_PROG(vi_cv_path_plain_lua, lua) + if test "X$vi_cv_path_plain_lua" != "X"; then + dnl -- find Lua version + AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua, + [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ]) + fi + vi_cv_path_lua="$vi_cv_path_plain_lua" + vi_cv_version_lua="$vi_cv_version_plain_lua" + fi + if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit) + if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then + AC_MSG_RESULT(yes) + LUA_INC=/luajit-$vi_cv_version_luajit + fi + fi + if test "X$LUA_INC" = "X"; then + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include) + if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua) + if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then + AC_MSG_RESULT(yes) + LUA_INC=/lua$vi_cv_version_lua + else + AC_MSG_RESULT(no) + vi_cv_path_lua_pfx= + fi + fi + fi + fi + + if test "X$vi_cv_path_lua_pfx" != "X"; then + if test "x$vi_cv_with_luajit" != "xno"; then + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + else + lib_multiarch="lib" + fi + if test "X$vi_cv_version_lua" = "X"; then + LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit" + else + LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua" + fi + else + if test "X$LUA_INC" != "X"; then + dnl Test alternate location using version + LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua" + else + LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua" + fi + fi + if test "$enable_luainterp" = "dynamic"; then + lua_ok="yes" + else + AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane]) + libs_save=$LIBS + LIBS="$LIBS $LUA_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); lua_ok="yes", + AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="") + LIBS=$libs_save + fi + if test "x$lua_ok" = "xyes"; then + LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}" + LUA_SRC="if_lua.c" + LUA_OBJ="objects/if_lua.o" + LUA_PRO="if_lua.pro" + AC_DEFINE(FEAT_LUA) + fi + if test "$enable_luainterp" = "dynamic"; then + if test "x$vi_cv_with_luajit" != "xno"; then + luajit="jit" + fi + if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then + vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll" + else + if test "x$MACOS_X" = "xyes"; then + ext="dylib" + indexes="" + else + ext="so" + indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9" + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + fi + fi + dnl Determine the sover for the current version, but fallback to + dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found. + AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx) + for subdir in "${lib_multiarch}" lib64 lib; do + if test -z "$subdir"; then + continue + fi + for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \ + ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do + for i in $indexes ""; do + if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then + sover2="$i" + break 3 + fi + done + done + sover="" + done + if test "X$sover" = "X"; then + AC_MSG_RESULT(no) + lua_ok="no" + vi_cv_dll_name_lua="liblua${luajit}.${ext}" + else + AC_MSG_RESULT(yes) + lua_ok="yes" + vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2" + fi + fi + AC_DEFINE(DYNAMIC_LUA) + LUA_LIBS="" + LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS" + fi + if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ + test "x$MACOS_X" = "xyes" && \ + test "`(uname -m) 2>/dev/null`" = "x86_64"; then + dnl OSX/x64 requires these flags. See http://luajit.org/install.html + LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" + fi + fi + if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then + AC_MSG_ERROR([could not configure lua]) + fi + AC_SUBST(LUA_SRC) + AC_SUBST(LUA_OBJ) + AC_SUBST(LUA_PRO) + AC_SUBST(LUA_LIBS) + AC_SUBST(LUA_CFLAGS) +fi + +dnl Check for Lua52 feature. +AC_MSG_CHECKING(--enable-lua52interp argument) +AC_ARG_ENABLE(lua52interp, + [ --enable-lua52interp[=OPTS] Include Lua52 interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_lua52interp="no"]) +AC_MSG_RESULT($enable_lua52interp) + +if test "$enable_lua52interp" = "yes" -o "$enable_lua52interp" = "dynamic"; then + dnl -- find the lua52 executable + AC_SUBST(vi_cv_path_lua52) + + AC_MSG_CHECKING(--with-lua52-prefix argument) + AC_ARG_WITH(lua52_prefix, + [ --with-lua52-prefix=PFX Prefix where Lua52 is installed.], + with_lua52_prefix="$withval"; AC_MSG_RESULT($with_lua52_prefix), + with_lua52_prefix="";AC_MSG_RESULT(no)) + + if test "X$with_lua52_prefix" != "X"; then + vi_cv_path_lua52_pfx="$with_lua52_prefix" + else + AC_MSG_CHECKING(LUA52_PREFIX environment var) + if test "X$LUA52_PREFIX" != "X"; then + AC_MSG_RESULT("$LUA52_PREFIX") + vi_cv_path_lua52_pfx="$LUA52_PREFIX" + else + AC_MSG_RESULT([not set, default to /usr]) + vi_cv_path_lua52_pfx="/usr" + fi + fi + + if test "X$vi_cv_path_lua52_pfx" != "X"; then + dnl -- try to find Lua52 executable + AC_PATH_PROG(vi_cv_path_lua52, lua) + if test "X$vi_cv_path_lua52" != "X"; then + dnl -- find Lua52 version + AC_CACHE_CHECK(Lua52 version, vi_cv_version_lua52, + [ vi_cv_version_lua52=`${vi_cv_path_lua52} -e "print(_VERSION)" | sed 's/.* //'` ]) + fi + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua52_pfx/include) + if test -f $vi_cv_path_lua52_pfx/include/lua.h; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua52_pfx/include/lua52$vi_cv_version_lua52) + if test -f $vi_cv_path_lua52_pfx/include/lua52$vi_cv_version_lua52/lua.h; then + AC_MSG_RESULT(yes) + LUA52_INC=/lua52$vi_cv_version_lua52 + else + AC_MSG_RESULT(no) + vi_cv_path_lua52_pfx= + fi + fi + fi + + if test "X$vi_cv_path_lua52_pfx" != "X"; then + if test "X$LUA52_INC" != "X"; then + dnl Test alternate location using version + LUA52_LIBS="-L${vi_cv_path_lua52_pfx}/lib -llua$vi_cv_version_lua52" + else + LUA52_LIBS="-L${vi_cv_path_lua52_pfx}/lib -llua" + fi + LUA52_CFLAGS="-I${vi_cv_path_lua52_pfx}/include${LUA52_INC}" + LUA52_SRC="if_lua52.c" + LUA52_OBJ="objects/if_lua52.o" + LUA52_PRO="if_lua52.pro" + AC_DEFINE(FEAT_LUA52) + if test "$enable_lua52interp" = "dynamic"; then + if test -f "${vi_cv_path_lua52_pfx}/bin/cyglua52-${vi_cv_version_lua52}.dll"; then + vi_cv_dll_name_lua52="cyglua52-${vi_cv_version_lua52}.dll" + else + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + fi + dnl Determine the sover for the current version, but fallback to + dnl liblua${vi_cv_version_lua52}.so if no sover-versioned file is found. + for subdir in "${lib_multiarch}" lib64 lib; do + if test -z "$subdir"; then + continue + fi + for sover in "${vi_cv_version_lua52}.${ext}" "-${vi_cv_version_lua52}.${ext}" \ + ".${vi_cv_version_lua52}.${ext}" ".${ext}.${vi_cv_version_lua52}"; do + for i in $indexes ""; do + if test -f "${vi_cv_path_lua52_pfx}/${subdir}/liblua${luajit}${sover}$i"; then + sover2="$i" + break 3 + fi + done + done + done + vi_cv_dll_name_lua52="liblua${sover}$sover2" + fi + AC_DEFINE(DYNAMIC_LUA52) + LUA52_LIBS="" + LUA52_CFLAGS="-DDYNAMIC_LUA52_DLL=\\\"${vi_cv_dll_name_lua52}\\\" $LUA52_CFLAGS" + fi + fi + if test "$fail_if_missing" = "yes" -a -z "$LUA52_SRC"; then + AC_MSG_ERROR([could not configure lua52]) + fi + AC_SUBST(LUA52_SRC) + AC_SUBST(LUA52_OBJ) + AC_SUBST(LUA52_PRO) + AC_SUBST(LUA52_LIBS) + AC_SUBST(LUA52_CFLAGS) +fi + + +dnl Check for MzScheme feature. +AC_MSG_CHECKING(--enable-mzschemeinterp argument) +AC_ARG_ENABLE(mzschemeinterp, + [ --enable-mzschemeinterp Include MzScheme interpreter.], , + [enable_mzschemeinterp="no"]) +AC_MSG_RESULT($enable_mzschemeinterp) + +if test "$enable_mzschemeinterp" = "yes"; then + dnl -- find the mzscheme executable + AC_SUBST(vi_cv_path_mzscheme) + + AC_MSG_CHECKING(--with-plthome argument) + AC_ARG_WITH(plthome, + [ --with-plthome=PLTHOME Use PLTHOME.], + with_plthome="$withval"; AC_MSG_RESULT($with_plthome), + with_plthome="";AC_MSG_RESULT("no")) + + if test "X$with_plthome" != "X"; then + vi_cv_path_mzscheme_pfx="$with_plthome" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + AC_MSG_CHECKING(PLTHOME environment var) + if test "X$PLTHOME" != "X"; then + AC_MSG_RESULT("$PLTHOME") + vi_cv_path_mzscheme_pfx="$PLTHOME" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + AC_MSG_RESULT(not set) + dnl -- try to find MzScheme executable + AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme) + + dnl resolve symbolic link, the executable is often elsewhere and there + dnl are no links for the include files. + if test "X$vi_cv_path_mzscheme" != "X"; then + lsout=`ls -l $vi_cv_path_mzscheme` + if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then + vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` + fi + fi + + if test "X$vi_cv_path_mzscheme" != "X"; then + dnl -- find where MzScheme thinks it was installed + AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx, + dnl different versions of MzScheme differ in command line processing + dnl use universal approach + echo "(display (simplify-path \ + (build-path (call-with-values \ + (lambda () (split-path (find-system-path (quote exec-file)))) \ + (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm + dnl Remove a trailing slash + [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ + sed -e 's+/$++'` ]) + rm -f mzdirs.scm + fi + fi + fi + + if test "X$vi_cv_path_mzscheme_pfx" != "X"; then + AC_MSG_CHECKING(for racket include directory) + SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_INC" != "X"; then + AC_MSG_RESULT(${SCHEME_INC}) + else + AC_MSG_RESULT(not found) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include) + if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) + if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then + AC_MSG_RESULT(yes) + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) + if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then + AC_MSG_RESULT(yes) + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) + if test -f /usr/include/plt/scheme.h; then + AC_MSG_RESULT(yes) + SCHEME_INC=/usr/include/plt + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) + if test -f /usr/include/racket/scheme.h; then + AC_MSG_RESULT(yes) + SCHEME_INC=/usr/include/racket + else + AC_MSG_RESULT(no) + vi_cv_path_mzscheme_pfx= + fi + fi + fi + fi + fi + fi + fi + + if test "X$vi_cv_path_mzscheme_pfx" != "X"; then + + AC_MSG_CHECKING(for racket lib directory) + SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_LIB" != "X"; then + AC_MSG_RESULT(${SCHEME_LIB}) + else + AC_MSG_RESULT(not found) + fi + + for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do + if test "X$path" != "X"; then + if test "x$MACOS_X" = "xyes"; then + MZSCHEME_LIBS="-framework Racket" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libmzscheme3m.a"; then + MZSCHEME_LIBS="${path}/libmzscheme3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.a"; then + MZSCHEME_LIBS="${path}/libracket3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.a"; then + MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a" + elif test -f "${path}/libmzscheme.a"; then + MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a" + else + dnl Using shared objects + if test -f "${path}/libmzscheme3m.so"; then + MZSCHEME_LIBS="-L${path} -lmzscheme3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.so"; then + MZSCHEME_LIBS="-L${path} -lracket3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.so"; then + MZSCHEME_LIBS="-L${path} -lracket -lmzgc" + else + dnl try next until last + if test "$path" != "$SCHEME_LIB"; then + continue + fi + MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc" + fi + if test "$GCC" = yes; then + dnl Make Vim remember the path to the library. For when it's not in + dnl $LD_LIBRARY_PATH. + MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" + elif test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" + fi + fi + fi + if test "X$MZSCHEME_LIBS" != "X"; then + break + fi + done + + AC_MSG_CHECKING([if racket requires -pthread]) + if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then + AC_MSG_RESULT(yes) + MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread" + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread" + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING(for racket config directory) + SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_CONFIGDIR" != "X"; then + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'" + AC_MSG_RESULT(${SCHEME_CONFIGDIR}) + else + AC_MSG_RESULT(not found) + fi + + AC_MSG_CHECKING(for racket collects directory) + SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'` + if test "X$SCHEME_COLLECTS" = "X"; then + if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ + else + if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ + else + if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + else + if test -d "$vi_cv_path_mzscheme_pfx/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + fi + fi + fi + fi + fi + if test "X$SCHEME_COLLECTS" != "X" ; then + AC_MSG_RESULT(${SCHEME_COLLECTS}) + else + AC_MSG_RESULT(not found) + fi + + AC_MSG_CHECKING(for mzscheme_base.c) + if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" + MZSCHEME_MOD="++lib scheme/base" + else + if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" + MZSCHEME_MOD="++lib scheme/base" + else + if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool" + MZSCHEME_MOD="" + fi + fi + fi + if test "X$MZSCHEME_EXTRA" != "X" ; then + dnl need to generate bytecode for MzScheme base + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE" + AC_MSG_RESULT(needed) + else + AC_MSG_RESULT(not needed) + fi + + dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'". + AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"]) + + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ + -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" + + dnl Test that we can compile a simple program with these CFLAGS and LIBS. + AC_MSG_CHECKING([if compile and link flags for MzScheme are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" + LIBS="$LIBS $MZSCHEME_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); mzs_ok=yes, + AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $mzs_ok = yes; then + MZSCHEME_SRC="if_mzsch.c" + MZSCHEME_OBJ="objects/if_mzsch.o" + MZSCHEME_PRO="if_mzsch.pro" + AC_DEFINE(FEAT_MZSCHEME) + else + MZSCHEME_CFLAGS= + MZSCHEME_LIBS= + MZSCHEME_EXTRA= + MZSCHEME_MZC= + fi + fi + AC_SUBST(MZSCHEME_SRC) + AC_SUBST(MZSCHEME_OBJ) + AC_SUBST(MZSCHEME_PRO) + AC_SUBST(MZSCHEME_LIBS) + AC_SUBST(MZSCHEME_CFLAGS) + AC_SUBST(MZSCHEME_EXTRA) + AC_SUBST(MZSCHEME_MZC) +fi + + +AC_MSG_CHECKING(--enable-perlinterp argument) +AC_ARG_ENABLE(perlinterp, + [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_perlinterp="no"]) +AC_MSG_RESULT($enable_perlinterp) +if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Perl with tiny or small features]) + fi + AC_SUBST(vi_cv_path_perl) + AC_PATH_PROG(vi_cv_path_perl, perl) + if test "X$vi_cv_path_perl" != "X"; then + AC_MSG_CHECKING(Perl version) + if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then + eval `$vi_cv_path_perl -V:usethreads` + eval `$vi_cv_path_perl -V:libperl` + if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then + badthreads=no + else + if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then + eval `$vi_cv_path_perl -V:use5005threads` + if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then + badthreads=no + else + badthreads=yes + AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<) + fi + else + badthreads=yes + AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<) + fi + fi + if test $badthreads = no; then + AC_MSG_RESULT(OK) + eval `$vi_cv_path_perl -V:shrpenv` + if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04 + shrpenv="" + fi + vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` + vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'` + AC_SUBST(vi_cv_perllib) + vi_cv_perl_extutils=unknown_perl_extutils_path + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + AC_SUBST(vi_cv_perl_xsubpp) + AC_SUBST(vi_cv_perlsitelib) + dnl Remove "-fno-something", it breaks using cproto. + dnl Remove "-fdebug-prefix-map", it isn't supported by clang. + dnl Remove "FORTIFY_SOURCE", it will be defined twice. + dnl remove -pipe and -Wxxx, it confuses cproto + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ + -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \ + -e 's/-fdebug-prefix-map[[^ ]]*//g' \ + -e 's/-pipe //' \ + -e 's/-W[[^ ]]*//g' \ + -e 's/-D_FORTIFY_SOURCE=.//g'` + dnl Remove "-lc", it breaks on FreeBSD when using "-pthread". + perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ + sed -e '/Warning/d' -e '/Note (probably harmless)/d' \ + -e 's/-bE:perl.exp//' -e 's/-lc //'` + dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH + dnl a test in configure may fail because of that. + perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ + -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` + + if test "x$MACOS_X" = "xyes"; then + dnl Perl on Mac OS X 10.5 and later adds "-arch" flags but these + dnl should only be included if requested by passing --with-archs + dnl to configure, so strip these flags first (if present) + perllibs=`echo "$perllibs" | sed -e 's/-arch[[^-]]*//g'` + perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[[^-]]*//g'` + fi + + dnl check that compiling a simple program still works with the flags + dnl added for Perl. + AC_MSG_CHECKING([if compile and link flags for Perl are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + ldflags_save=$LDFLAGS + CFLAGS="$CFLAGS $perlcppflags" + LIBS="$LIBS $perllibs" + perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'` + LDFLAGS="$perlldflags $LDFLAGS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); perl_ok=yes, + AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + LDFLAGS=$ldflags_save + if test $perl_ok = yes; then + if test "X$perlcppflags" != "X"; then + PERL_CFLAGS=$perlcppflags + fi + if test "X$perlldflags" != "X"; then + if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then + LDFLAGS="$perlldflags $LDFLAGS" + fi + fi + PERL_LIBS=$perllibs + PERL_SRC="auto/if_perl.c if_perlsfio.c" + PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o" + PERL_PRO="if_perl.pro if_perlsfio.pro" + AC_DEFINE(FEAT_PERL) + fi + fi + else + AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<) + fi + fi + + if test "x$MACOS_X" = "xyes"; then + dnl Mac OS X 10.2 or later + dir=/System/Library/Perl + darwindir=$dir/darwin + if test -d $darwindir; then + PERL=/usr/bin/perl + else + dnl Mac OS X 10.3 + dir=/System/Library/Perl/5.8.1 + darwindir=$dir/darwin-thread-multi-2level + if test -d $darwindir; then + PERL=/usr/bin/perl + fi + fi + if test -n "$PERL"; then + PERL_DIR="$dir" + PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE" + PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a" + PERL_LIBS="-L$darwindir/CORE -lperl" + fi + dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only + dnl be included if requested by passing --with-mac-arch to + dnl configure, so strip these flags first (if present) + PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` + PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` + fi + if test "$enable_perlinterp" = "dynamic"; then + if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then + AC_DEFINE(DYNAMIC_PERL) + AC_CACHE_VAL(vi_cv_dll_name_perl, [vi_cv_dll_name_perl="$libperl"]) + PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$vi_cv_dll_name_perl\\\" $PERL_CFLAGS" + fi + fi + + if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then + AC_MSG_ERROR([could not configure perl]) + fi +fi +AC_SUBST(shrpenv) +AC_SUBST(PERL_SRC) +AC_SUBST(PERL_OBJ) +AC_SUBST(PERL_PRO) +AC_SUBST(PERL_CFLAGS) +AC_SUBST(PERL_LIBS) + +AC_MSG_CHECKING(--enable-pythoninterp argument) +AC_ARG_ENABLE(pythoninterp, + [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_pythoninterp="no"]) +AC_MSG_RESULT($enable_pythoninterp) +if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Python with tiny or small features]) + fi + + dnl -- find the python executable + AC_MSG_CHECKING(--with-python-command argument) + AC_SUBST(vi_cv_path_python) + AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)], + vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python" = "X"; then + AC_PATH_PROGS(vi_cv_path_python, python2 python) + fi + if test "X$vi_cv_path_python" != "X"; then + + dnl -- get its version number + AC_CACHE_CHECK(Python version,vi_cv_var_python_version, + [[vi_cv_var_python_version=` + ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'` + ]]) + + dnl -- it must be at least version 2.3 + AC_MSG_CHECKING(Python is 2.3 or better) + if ${vi_cv_path_python} -c \ + "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)" + then + AC_MSG_RESULT(yep) + + dnl -- find where python thinks it was installed + AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx, + [ vi_cv_path_python_pfx=` + ${vi_cv_path_python} -c \ + "import sys; print sys.prefix"` ]) + + dnl -- and where it thinks it runs + AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx, + [ vi_cv_path_python_epfx=` + ${vi_cv_path_python} -c \ + "import sys; print sys.exec_prefix"` ]) + + dnl -- python's internal library path + + AC_CACHE_VAL(vi_cv_path_pythonpath, + [ vi_cv_path_pythonpath=` + unset PYTHONPATH; + ${vi_cv_path_python} -c \ + "import sys, string; print string.join(sys.path,':')"` ]) + + dnl -- where the Python implementation library archives are + + AC_ARG_WITH(python-config-dir, + [ --with-python-config-dir=PATH Python's config directory (deprecated)], + [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] ) + + AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf, + [ + vi_cv_path_python_conf= + d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"` + if test -d "$d" && test -f "$d/config.c"; then + vi_cv_path_python_conf="$d" + else + for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do + for subdir in lib64 lib share; do + d="${path}/${subdir}/python${vi_cv_var_python_version}/config" + if test -d "$d" && test -f "$d/config.c"; then + vi_cv_path_python_conf="$d" + fi + done + done + fi + ]) + + PYTHON_CONFDIR="${vi_cv_path_python_conf}" + + if test "X$PYTHON_CONFDIR" = "X"; then + AC_MSG_RESULT([can't find it!]) + else + + dnl -- we need to examine Python's config/Makefile too + dnl see what the interpreter is built from + AC_CACHE_VAL(vi_cv_path_python_plibs, + [ + pwd=`pwd` + tmp_mkf="$pwd/config-PyMake$$" + cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" +__: + @echo "python_BASEMODLIBS='$(BASEMODLIBS)'" + @echo "python_LIBS='$(LIBS)'" + @echo "python_SYSLIBS='$(SYSLIBS)'" + @echo "python_LINKFORSHARED='$(LINKFORSHARED)'" + @echo "python_DLLLIBRARY='$(DLLLIBRARY)'" + @echo "python_INSTSONAME='$(INSTSONAME)'" + @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'" + @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'" + @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'" +eof + dnl -- delete the lines from make about Entering/Leaving directory + eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" + rm -f -- "${tmp_mkf}" + if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \ + "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then + vi_cv_path_python_plibs="-framework Python" + if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then + vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" + fi + else + vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" + dnl -- Check if the path contained in python_LINKFORSHARED is + dnl usable for vim build. If not, make and try other + dnl candidates. + if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then + python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'` + python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'` + if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then + dnl -- The path looks relative. Guess the absolute one using + dnl the prefix and try that. + python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}" + if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then + dnl -- A last resort. + python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}" + dnl -- No check is done. The last word is left to the + dnl "sanity" test on link flags that follows shortly. + fi + python_LINKFORSHARED="${python_link_symbol} ${python_link_path}" + fi + fi + vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" + dnl remove -ltermcap, it can conflict with an earlier -lncurses + vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` + fi + ]) + AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python, + [ + if test "X$python_DLLLIBRARY" != "X"; then + vi_cv_dll_name_python="$python_DLLLIBRARY" + else + vi_cv_dll_name_python="$python_INSTSONAME" + fi + ]) + + PYTHON_LIBS="${vi_cv_path_python_plibs}" + if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" + else + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" + fi + if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then + dnl Define PYTHON_HOME if --with-python-config-dir was used + PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + + fi + PYTHON_SRC="if_python.c" + PYTHON_OBJ="objects/if_python.o" + + dnl On FreeBSD linking with "-pthread" is required to use threads. + dnl _THREAD_SAFE must be used for compiling then. + dnl The "-pthread" is added to $LIBS, so that the following check for + dnl sigaltstack() will look in libc_r (it's there in libc!). + dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC + dnl will then define target-specific defines, e.g., -D_REENTRANT. + dnl Don't do this for Mac OSX, -pthread will generate a warning. + AC_MSG_CHECKING([if -pthread should be used]) + threadsafe_flag= + thread_lib= + dnl if test "x$MACOS_X" != "xyes"; then + if test "`(uname) 2>/dev/null`" != Darwin; then + test "$GCC" = yes && threadsafe_flag="-pthread" + if test "`(uname) 2>/dev/null`" = FreeBSD; then + threadsafe_flag="-D_THREAD_SAFE" + thread_lib="-pthread" + fi + if test "`(uname) 2>/dev/null`" = SunOS; then + threadsafe_flag="-pthreads" + fi + fi + libs_save_old=$LIBS + if test -n "$threadsafe_flag"; then + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $threadsafe_flag" + LIBS="$LIBS $thread_lib" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag", + AC_MSG_RESULT(no); LIBS=$libs_save_old + ) + CFLAGS=$cflags_save + else + AC_MSG_RESULT(no) + fi + + dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely + dnl on any of the search paths set above. The -framework flag does it + dnl all for us. + if test -n "$MACSDK"; then + PYTHON_CFLAGS= + PYTHON_LIBS=-framework Python + PYTHON_CONFDIR= + PYTHON_GETPATH_CFLAGS= + fi + + dnl Check that compiling a simple program still works with the flags + dnl added for Python. + AC_MSG_CHECKING([if compile and link flags for Python are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $PYTHON_CFLAGS" + LIBS="$LIBS $PYTHON_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); python_ok=yes, + AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $python_ok = yes; then + AC_DEFINE(FEAT_PYTHON) + else + LIBS=$libs_save_old + PYTHON_SRC= + PYTHON_OBJ= + PYTHON_LIBS= + PYTHON_CFLAGS= + fi + fi + else + AC_MSG_RESULT(too old) + fi + fi + + if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then + AC_MSG_ERROR([could not configure python]) + fi +fi + +AC_SUBST(PYTHON_LIBS) +AC_SUBST(PYTHON_CFLAGS) +AC_SUBST(PYTHON_SRC) +AC_SUBST(PYTHON_OBJ) + + +AC_MSG_CHECKING(--enable-python3interp argument) +AC_ARG_ENABLE(python3interp, + [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_python3interp="no"]) +AC_MSG_RESULT($enable_python3interp) +if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Python with tiny or small features]) + fi + + dnl -- find the python3 executable + AC_MSG_CHECKING(--with-python3-command argument) + AC_SUBST(vi_cv_path_python3) + AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)], + vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python3" = "X"; then + AC_PATH_PROGS(vi_cv_path_python3, python3 python) + fi + if test "X$vi_cv_path_python3" != "X"; then + + dnl -- get its version number + AC_CACHE_CHECK(Python version,vi_cv_var_python3_version, + [[vi_cv_var_python3_version=` + ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'` + ]]) + + dnl -- it must be at least version 3 + AC_MSG_CHECKING(Python is 3.0 or better) + if ${vi_cv_path_python3} -c \ + "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)" + then + AC_MSG_RESULT(yep) + + dnl -- get abiflags for python 3.2 or higher (PEP 3149) + AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags, + [ + vi_cv_var_python3_abiflags= + if ${vi_cv_path_python3} -c \ + "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)" + then + vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \ + "import sys; print(sys.abiflags)"` + fi ]) + + dnl -- find where python3 thinks it was installed + AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx, + [ vi_cv_path_python3_pfx=` + ${vi_cv_path_python3} -c \ + "import sys; print(sys.prefix)"` ]) + + dnl -- and where it thinks it runs + AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx, + [ vi_cv_path_python3_epfx=` + ${vi_cv_path_python3} -c \ + "import sys; print(sys.exec_prefix)"` ]) + + dnl -- python3's internal library path + + AC_CACHE_VAL(vi_cv_path_python3path, + [ vi_cv_path_python3path=` + unset PYTHONPATH; + ${vi_cv_path_python3} -c \ + "import sys, string; print(':'.join(sys.path))"` ]) + + dnl -- where the Python implementation library archives are + + AC_ARG_WITH(python3-config-dir, + [ --with-python3-config-dir=PATH Python's config directory (deprecated)], + [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] ) + + AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf, + [ + vi_cv_path_python3_conf= + config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" + d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"` + if test -d "$d" && test -f "$d/config.c"; then + vi_cv_path_python3_conf="$d" + else + for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do + for subdir in lib64 lib share; do + d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}" + if test -d "$d" && test -f "$d/config.c"; then + vi_cv_path_python3_conf="$d" + fi + done + done + fi + ]) + + PYTHON3_CONFDIR="${vi_cv_path_python3_conf}" + + if test "X$PYTHON3_CONFDIR" = "X"; then + AC_MSG_RESULT([can't find it!]) + else + + dnl -- we need to examine Python's config/Makefile too + dnl see what the interpreter is built from + AC_CACHE_VAL(vi_cv_path_python3_plibs, + [ + pwd=`pwd` + tmp_mkf="$pwd/config-PyMake$$" + cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" +__: + @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'" + @echo "python3_LIBS='$(LIBS)'" + @echo "python3_SYSLIBS='$(SYSLIBS)'" + @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'" + @echo "python3_INSTSONAME='$(INSTSONAME)'" +eof + dnl -- delete the lines from make about Entering/Leaving directory + eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" + rm -f -- "${tmp_mkf}" + vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" + vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}" + dnl remove -ltermcap, it can conflict with an earlier -lncurses + vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//` + vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//` + ]) + AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3, + [ + if test "X$python3_DLLLIBRARY" != "X"; then + vi_cv_dll_name_python3="$python3_DLLLIBRARY" + else + vi_cv_dll_name_python3="$python3_INSTSONAME" + fi + ]) + + PYTHON3_LIBS="${vi_cv_path_python3_plibs}" + if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" + else + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" + fi + if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then + dnl Define PYTHON3_HOME if --with-python-config-dir was used + PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + fi + PYTHON3_SRC="if_python3.c" + PYTHON3_OBJ="objects/if_python3.o" + + dnl On FreeBSD linking with "-pthread" is required to use threads. + dnl _THREAD_SAFE must be used for compiling then. + dnl The "-pthread" is added to $LIBS, so that the following check for + dnl sigaltstack() will look in libc_r (it's there in libc!). + dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC + dnl will then define target-specific defines, e.g., -D_REENTRANT. + dnl Don't do this for Mac OSX, -pthread will generate a warning. + AC_MSG_CHECKING([if -pthread should be used]) + threadsafe_flag= + thread_lib= + dnl if test "x$MACOS_X" != "xyes"; then + if test "`(uname) 2>/dev/null`" != Darwin; then + test "$GCC" = yes && threadsafe_flag="-pthread" + if test "`(uname) 2>/dev/null`" = FreeBSD; then + threadsafe_flag="-D_THREAD_SAFE" + thread_lib="-pthread" + fi + if test "`(uname) 2>/dev/null`" = SunOS; then + threadsafe_flag="-pthreads" + fi + fi + libs_save_old=$LIBS + if test -n "$threadsafe_flag"; then + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $threadsafe_flag" + LIBS="$LIBS $thread_lib" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag", + AC_MSG_RESULT(no); LIBS=$libs_save_old + ) + CFLAGS=$cflags_save + else + AC_MSG_RESULT(no) + fi + + dnl check that compiling a simple program still works with the flags + dnl added for Python. + AC_MSG_CHECKING([if compile and link flags for Python 3 are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" + LIBS="$LIBS $PYTHON3_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); python3_ok=yes, + AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test "$python3_ok" = yes; then + AC_DEFINE(FEAT_PYTHON3) + else + LIBS=$libs_save_old + PYTHON3_SRC= + PYTHON3_OBJ= + PYTHON3_LIBS= + PYTHON3_CFLAGS= + fi + fi + else + AC_MSG_RESULT(too old) + fi + fi + if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then + AC_MSG_ERROR([could not configure python3]) + fi +fi + +AC_SUBST(PYTHON3_LIBS) +AC_SUBST(PYTHON3_CFLAGS) +AC_SUBST(PYTHON3_SRC) +AC_SUBST(PYTHON3_OBJ) + +AC_ARG_WITH(properly-linked-python2-python3, + [ --with-properly-linked-python2-python3 Link with properly linked Python 2 and Python 3.], + [vi_cv_with_properly_linked_python2_python3="yes"], + [vi_cv_with_properly_linked_python2_python3="no"]) + +dnl if python2.x and python3.x are enabled one can only link in code +dnl with dlopen(), dlsym(), dlclose() +if test "$python_ok" = yes && test "$python3_ok" = yes; then + AC_DEFINE(DYNAMIC_PYTHON) + AC_DEFINE(DYNAMIC_PYTHON3) + AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $PYTHON_CFLAGS" + libs_save=$LIBS + dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) + LIBS="-ldl $LIBS" + if test "x$MACOS_X" != "xyes"; then + AC_RUN_IFELSE([AC_LANG_SOURCE([ + #include <dlfcn.h> + /* If this program fails, then RTLD_GLOBAL is needed. + * RTLD_GLOBAL will be used and then it is not possible to + * have both python versions enabled in the same vim instance. + * Only the first python version used will be switched on. + */ + + int no_rtl_global_needed_for(char *python_instsoname, char *prefix) + { + int needed = 0; + void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); + if (pylib != 0) + { + void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); + void (*init)(void) = dlsym(pylib, "Py_Initialize"); + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); + void (*final)(void) = dlsym(pylib, "Py_Finalize"); + (*pfx)(prefix); + (*init)(); + needed = (*simple)("import termios") == -1; + (*final)(); + dlclose(pylib); + } + return !needed; + } + + int main(int argc, char** argv) + { + int not_needed = 0; + if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}")) + not_needed = 1; + return !not_needed; + }])], + [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) + + CFLAGS=$cflags_save + LIBS=$libs_save + + AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" + libs_save=$LIBS + dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) + LIBS="-ldl $LIBS" + AC_RUN_IFELSE([AC_LANG_SOURCE([ + #include <dlfcn.h> + #include <wchar.h> + /* If this program fails, then RTLD_GLOBAL is needed. + * RTLD_GLOBAL will be used and then it is not possible to + * have both python versions enabled in the same vim instance. + * Only the first python version used will be switched on. + */ + + int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) + { + int needed = 0; + void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); + if (pylib != 0) + { + void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); + void (*init)(void) = dlsym(pylib, "Py_Initialize"); + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); + void (*final)(void) = dlsym(pylib, "Py_Finalize"); + (*pfx)(prefix); + (*init)(); + needed = (*simple)("import termios") == -1; + (*final)(); + dlclose(pylib); + } + return !needed; + } + + int main(int argc, char** argv) + { + int not_needed = 0; + if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}")) + not_needed = 1; + return !not_needed; + }])], + [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) + fi + + if test "$vi_cv_with_properly_linked_python2_python3" = "yes"; then + AC_DEFINE(PY_NO_RTLD_GLOBAL) + AC_DEFINE(PY3_NO_RTLD_GLOBAL) + fi + + CFLAGS=$cflags_save + LIBS=$libs_save + + PYTHON_SRC="if_python.c" + PYTHON_OBJ="objects/if_python.o" + PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" + PYTHON_LIBS= + PYTHON3_SRC="if_python3.c" + PYTHON3_OBJ="objects/if_python3.o" + PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" + PYTHON3_LIBS= +elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then + AC_DEFINE(DYNAMIC_PYTHON) + PYTHON_SRC="if_python.c" + PYTHON_OBJ="objects/if_python.o" + PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" + PYTHON_LIBS= +elif test "$python_ok" = yes; then + dnl Check that adding -fPIE works. It may be needed when using a static + dnl Python library. + AC_MSG_CHECKING([if -fPIE can be added for Python]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE" + LIBS="$LIBS $PYTHON_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); fpie_ok=yes, + AC_MSG_RESULT(no); fpie_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $fpie_ok = yes; then + PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE" + fi +elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then + AC_DEFINE(DYNAMIC_PYTHON3) + PYTHON3_SRC="if_python3.c" + PYTHON3_OBJ="objects/if_python3.o" + PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" + PYTHON3_LIBS= +elif test "$python3_ok" = yes; then + dnl Check that adding -fPIE works. It may be needed when using a static + dnl Python library. + AC_MSG_CHECKING([if -fPIE can be added for Python3]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE" + LIBS="$LIBS $PYTHON3_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); fpie_ok=yes, + AC_MSG_RESULT(no); fpie_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $fpie_ok = yes; then + PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE" + fi +fi + +AC_MSG_CHECKING(--enable-tclinterp argument) +AC_ARG_ENABLE(tclinterp, + [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_tclinterp="no"]) +AC_MSG_RESULT($enable_tclinterp) + +if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then + + dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420] + AC_MSG_CHECKING(--with-tclsh argument) + AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)], + tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name), + tclsh_name="tclsh8.5"; AC_MSG_RESULT(no)) + AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) + AC_SUBST(vi_cv_path_tcl) + + dnl when no specific version specified, also try 8.4, 8.2 and 8.0 + if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then + tclsh_name="tclsh8.4" + AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) + fi + if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then + tclsh_name="tclsh8.2" + AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) + fi + if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then + tclsh_name="tclsh8.0" + AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) + fi + dnl still didn't find it, try without version number + if test "X$vi_cv_path_tcl" = "X"; then + tclsh_name="tclsh" + AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) + fi + if test "X$vi_cv_path_tcl" != "X"; then + AC_MSG_CHECKING(Tcl version) + if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then + tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -` + AC_MSG_RESULT($tclver - OK); + tclloc=`echo 'set l [[info library]];set i [[string last lib $l]];incr i -2;puts [[string range $l 0 $i]]' | $vi_cv_path_tcl -` + tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -` + + AC_MSG_CHECKING(for location of Tcl include) + if test "x$MACOS_X" != "xyes"; then + tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver" + else + dnl For Mac OS X 10.3, use the OS-provided framework location + tclinc="/System/Library/Frameworks/Tcl.framework/Headers" + fi + TCL_INC= + for try in $tclinc; do + if test -f "$try/tcl.h"; then + AC_MSG_RESULT($try/tcl.h) + TCL_INC=$try + break + fi + done + if test -z "$TCL_INC"; then + AC_MSG_RESULT(<not found>) + SKIP_TCL=YES + fi + if test -z "$SKIP_TCL"; then + AC_MSG_CHECKING(for location of tclConfig.sh script) + if test "x$MACOS_X" != "xyes"; then + tclcnf=`echo $tclinc | sed s/include/lib/g` + tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`" + else + dnl For Mac OS X 10.3, use the OS-provided framework location + tclcnf="/System/Library/Frameworks/Tcl.framework" + fi + for try in $tclcnf; do + if test -f "$try/tclConfig.sh"; then + AC_MSG_RESULT($try/tclConfig.sh) + . "$try/tclConfig.sh" + dnl use eval, because tcl 8.2 includes ${TCL_DBGX} + if test "$enable_tclinterp" = "dynamic"; then + TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"` + else + TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"` + fi + dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the + dnl "-D_ABC" items. Watch out for -DFOO=long\ long. + TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'` + break + fi + done + if test -z "$TCL_LIBS"; then + AC_MSG_RESULT(<not found>) + AC_MSG_CHECKING(for Tcl library by myself) + tcllib=`echo $tclinc | sed s/include/lib/g` + tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`" + for ext in .so .a ; do + for ver in "" $tclver ; do + for try in $tcllib ; do + trylib=tcl$ver$ext + if test -f "$try/lib$trylib" ; then + AC_MSG_RESULT($try/lib$trylib) + TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm" + if test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + TCL_LIBS="$TCL_LIBS -R $try" + fi + break 3 + fi + done + done + done + if test -z "$TCL_LIBS"; then + AC_MSG_RESULT(<not found>) + SKIP_TCL=YES + fi + fi + if test -z "$SKIP_TCL"; then + AC_DEFINE(FEAT_TCL) + TCL_SRC=if_tcl.c + TCL_OBJ=objects/if_tcl.o + TCL_PRO=if_tcl.pro + TCL_CFLAGS="-I$TCL_INC $TCL_DEFS" + fi + fi + else + AC_MSG_RESULT(too old; need Tcl version 8.0 or later) + fi + fi + if test "$enable_tclinterp" = "dynamic"; then + if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then + AC_DEFINE(DYNAMIC_TCL) + TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS" + fi + fi + if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then + AC_MSG_ERROR([could not configure Tcl]) + fi +fi +AC_SUBST(TCL_SRC) +AC_SUBST(TCL_OBJ) +AC_SUBST(TCL_PRO) +AC_SUBST(TCL_CFLAGS) +AC_SUBST(TCL_LIBS) + +AC_MSG_CHECKING(--enable-rubyinterp argument) +AC_ARG_ENABLE(rubyinterp, + [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_rubyinterp="no"]) +AC_MSG_RESULT($enable_rubyinterp) +if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Ruby with tiny or small features]) + fi + + AC_MSG_CHECKING(--with-ruby-command argument) + AC_SUBST(vi_cv_path_ruby) + AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)], + RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD), + RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD)) + AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD) + if test "X$vi_cv_path_ruby" != "X"; then + AC_MSG_CHECKING(Ruby version) + if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then + AC_MSG_RESULT(OK) + AC_MSG_CHECKING(Ruby rbconfig) + ruby_rbconfig="RbConfig" + if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then + ruby_rbconfig="Config" + fi + AC_MSG_RESULT($ruby_rbconfig) + AC_MSG_CHECKING(Ruby header files) + rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null` + if test "X$rubyhdrdir" != "X"; then + AC_MSG_RESULT($rubyhdrdir) + RUBY_CFLAGS="-I$rubyhdrdir" + rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"` + if test -d "$rubyarchdir"; then + RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" + else + dnl rbconfig says darwin15 but 10.12 SDK has darwin16 + rubyarchdir=${rubyarchdir/darwin15/darwin16} + if test -d "$rubyarchdir"; then + RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" + fi + fi + rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"` + if test "X$rubyversion" = "X"; then + rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"` + fi + RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion" + rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"` + if test "X$rubylibs" != "X"; then + RUBY_LIBS="$rubylibs" + fi + librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"` + librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"` + rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"` + if test -f "$rubylibdir/$librubya"; then + librubyarg="$librubyarg" + RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" + elif test "$vi_cv_path_ruby" = "/usr/bin/ruby" -a -d "/System/Library/Frameworks/Ruby.framework"; then + dnl On Mac OS X it is safer to just use the -framework flag + RUBY_LIBS="-framework Ruby" + dnl Don't include the -I flag when -framework is set + RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion -DRUBY_FRAMEWORK" + librubyarg= + fi + + if test "X$librubyarg" != "X"; then + RUBY_LIBS="$librubyarg $RUBY_LIBS" + fi + rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"` + if test "X$rubyldflags" != "X"; then + dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only + dnl be included if requested by passing --with-mac-arch to + dnl configure, so strip these flags first (if present) + rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` + if test "X$rubyldflags" != "X"; then + if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi + fi + fi + if test "X$rubyldflags" != "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi + RUBY_SRC="if_ruby.c" + RUBY_OBJ="objects/if_ruby.o" + RUBY_PRO="if_ruby.pro" + + AC_DEFINE(FEAT_RUBY) + if test "$enable_rubyinterp" = "dynamic"; then + libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"` + AC_DEFINE(DYNAMIC_RUBY) + RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" + RUBY_LIBS= + fi + else + AC_MSG_RESULT(not found; disabling Ruby) + fi + else + AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later) + fi + fi + + if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then + AC_MSG_ERROR([could not configure Ruby]) + fi +fi +AC_SUBST(RUBY_SRC) +AC_SUBST(RUBY_OBJ) +AC_SUBST(RUBY_PRO) +AC_SUBST(RUBY_CFLAGS) +AC_SUBST(RUBY_LIBS) + +AC_MSG_CHECKING(--enable-cscope argument) +AC_ARG_ENABLE(cscope, + [ --enable-cscope Include cscope interface.], , + [enable_cscope="no"]) +AC_MSG_RESULT($enable_cscope) +if test "$enable_cscope" = "yes"; then + AC_DEFINE(FEAT_CSCOPE) +fi + +AC_MSG_CHECKING(--enable-workshop argument) +AC_ARG_ENABLE(workshop, + [ --enable-workshop Include Sun Visual Workshop support.], , + [enable_workshop="no"]) +AC_MSG_RESULT($enable_workshop) +if test "$enable_workshop" = "yes"; then + AC_DEFINE(FEAT_SUN_WORKSHOP) + WORKSHOP_SRC="workshop.c integration.c" + AC_SUBST(WORKSHOP_SRC) + WORKSHOP_OBJ="objects/workshop.o objects/integration.o" + AC_SUBST(WORKSHOP_OBJ) + if test "${enable_gui-xxx}" = xxx; then + enable_gui=motif + fi +fi + +AC_MSG_CHECKING(--disable-netbeans argument) +AC_ARG_ENABLE(netbeans, + [ --disable-netbeans Disable NetBeans integration support.], + , [enable_netbeans="yes"]) +if test "$enable_netbeans" = "yes"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_RESULT([cannot use NetBeans with tiny or small features]) + enable_netbeans="no" + else + AC_MSG_RESULT(no) + fi +else + AC_MSG_RESULT(yes) +fi + +AC_MSG_CHECKING(--disable-channel argument) +AC_ARG_ENABLE(channel, + [ --disable-channel Disable process communication support.], + , [enable_channel="yes"]) +if test "$enable_channel" = "yes"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_RESULT([cannot use channels with tiny or small features]) + enable_channel="no" + else + AC_MSG_RESULT(no) + fi +else + if test "$enable_netbeans" = "yes"; then + AC_MSG_RESULT([yes, netbeans also disabled]) + enable_netbeans="no" + else + AC_MSG_RESULT(yes) + fi +fi + +if test "$enable_channel" = "yes"; then + dnl On Solaris we need the socket and nsl library. + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(nsl, gethostbyname) + AC_MSG_CHECKING(whether compiling with process communication is possible) + AC_TRY_LINK([ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <fcntl.h> +#include <netdb.h> +#include <netinet/in.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/socket.h> + /* Check bitfields */ + struct nbbuf { + unsigned int initDone:1; + unsigned short signmaplen; + }; + ], [ + /* Check creating a socket. */ + struct sockaddr_in server; + (void)socket(AF_INET, SOCK_STREAM, 0); + (void)htons(100); + (void)gethostbyname("microsoft.com"); + if (errno == ECONNREFUSED) + (void)connect(1, (struct sockaddr *)&server, sizeof(server)); + ], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no") +fi +if test "$enable_netbeans" = "yes"; then + AC_DEFINE(FEAT_NETBEANS_INTG) + NETBEANS_SRC="netbeans.c" + AC_SUBST(NETBEANS_SRC) + NETBEANS_OBJ="objects/netbeans.o" + AC_SUBST(NETBEANS_OBJ) +fi +if test "$enable_channel" = "yes"; then + AC_DEFINE(FEAT_JOB_CHANNEL) + CHANNEL_SRC="channel.c" + AC_SUBST(CHANNEL_SRC) + CHANNEL_OBJ="objects/channel.o" + AC_SUBST(CHANNEL_OBJ) +fi + +AC_MSG_CHECKING(--enable-terminal argument) +AC_ARG_ENABLE(terminal, + [ --enable-terminal Enable terminal emulation support.], + , [enable_terminal="auto"]) +if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_RESULT([cannot use terminal emulator with tiny or small features]) + enable_terminal="no" + else + if test "$enable_terminal" = "auto"; then + enable_terminal="yes" + AC_MSG_RESULT(defaulting to yes) + else + AC_MSG_RESULT(yes) + fi + fi +else + if test "$enable_terminal" = "auto"; then + enable_terminal="no" + AC_MSG_RESULT(defaulting to no) + else + AC_MSG_RESULT(no) + fi +fi +if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then + AC_DEFINE(FEAT_TERMINAL) + TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/screen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" + AC_SUBST(TERM_SRC) + TERM_OBJ="objects/term_encoding.o objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o objects/term_pen.o objects/term_screen.o objects/term_state.o objects/term_unicode.o objects/term_vterm.o" + AC_SUBST(TERM_OBJ) +fi + +AC_MSG_CHECKING(--enable-autoservername argument) +AC_ARG_ENABLE(autoservername, + [ --enable-autoservername Automatically define servername at vim startup.], , + [enable_autoservername="no"]) +AC_MSG_RESULT($enable_autoservername) +if test "$enable_autoservername" = "yes"; then + AC_DEFINE(FEAT_AUTOSERVERNAME) +fi + +AC_MSG_CHECKING(--enable-multibyte argument) +AC_ARG_ENABLE(multibyte, + [ --enable-multibyte Include multibyte editing support.], , + [enable_multibyte="no"]) +AC_MSG_RESULT($enable_multibyte) +if test "$enable_multibyte" = "yes"; then + AC_DEFINE(FEAT_MBYTE) +fi + +AC_MSG_CHECKING(--enable-hangulinput argument) +AC_ARG_ENABLE(hangulinput, + [ --enable-hangulinput Include Hangul input support.], , + [enable_hangulinput="no"]) +AC_MSG_RESULT($enable_hangulinput) + +AC_MSG_CHECKING(--enable-xim argument) +AC_ARG_ENABLE(xim, + [ --enable-xim Include XIM input support.], + AC_MSG_RESULT($enable_xim), + [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)]) + +AC_MSG_CHECKING(--enable-fontset argument) +AC_ARG_ENABLE(fontset, + [ --enable-fontset Include X fontset output support.], , + [enable_fontset="no"]) +AC_MSG_RESULT($enable_fontset) +dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI + +test -z "$with_x" && with_x=yes +test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes +if test "$with_x" = no; then + AC_MSG_RESULT(defaulting to: don't HAVE_X11) +else + dnl Do this check early, so that its failure can override user requests. + + AC_PATH_PROG(xmkmfpath, xmkmf) + + AC_PATH_XTRA + + dnl On z/OS Unix the X libraries are DLLs. To use them the code must + dnl be compiled with a special option. + dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS. + if test "$zOSUnix" = "yes"; then + CFLAGS="$CFLAGS -W c,dll" + LDFLAGS="$LDFLAGS -W l,dll" + X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" + fi + + dnl On my HPUX system the X include dir is found, but the lib dir not. + dnl This is a desparate try to fix this. + + if test -d "$x_includes" && test ! -d "$x_libraries"; then + x_libraries=`echo "$x_includes" | sed s/include/lib/` + AC_MSG_RESULT(Corrected X libraries to $x_libraries) + X_LIBS="$X_LIBS -L$x_libraries" + if test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + X_LIBS="$X_LIBS -R $x_libraries" + fi + fi + + if test -d "$x_libraries" && test ! -d "$x_includes"; then + x_includes=`echo "$x_libraries" | sed s/lib/include/` + AC_MSG_RESULT(Corrected X includes to $x_includes) + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed. + X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`" + dnl Remove "-L/usr/lib " from X_LIBS, should not be needed. + X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`" + dnl Same for "-R/usr/lib ". + X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`" + + + dnl Check if the X11 header files are correctly installed. On some systems + dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h + dnl is missing. + AC_MSG_CHECKING(if X11 header files can be found) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $X_CFLAGS" + AC_TRY_COMPILE([#include <X11/Xlib.h> +#include <X11/Intrinsic.h>], , + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); no_x=yes) + CFLAGS=$cflags_save + + if test "${no_x-no}" = yes; then + with_x=no + else + AC_DEFINE(HAVE_X11) + X_LIB="-lXt -lX11"; + AC_SUBST(X_LIB) + + ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$x_libraries $LDFLAGS" + + dnl Check for -lXdmcp (needed on SunOS 4.1.4) + dnl For HP-UX 10.20 it must be before -lSM -lICE + AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],, + [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp]) + + dnl Some systems need -lnsl -lsocket when testing for ICE. + dnl The check above doesn't do this, try here (again). Also needed to get + dnl them after Xdmcp. link.sh will remove them when not needed. + dnl Check for other function than above to avoid the cached value + AC_CHECK_LIB(ICE, IceOpenConnection, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS]) + + dnl Check for -lXpm (needed for some versions of Motif) + LDFLAGS="$X_LIBS $ac_save_LDFLAGS" + AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],, + [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS]) + + dnl Check that the X11 header files don't use implicit declarations + AC_MSG_CHECKING(if X11 header files implicitly declare return values) + cflags_save=$CFLAGS + dnl -Werror is GCC only, others like Solaris Studio might not like it + if test "$GCC" = yes; then + CFLAGS="$CFLAGS $X_CFLAGS -Werror" + else + CFLAGS="$CFLAGS $X_CFLAGS" + fi + AC_TRY_COMPILE([#include <X11/Xlib.h>], , + AC_MSG_RESULT(no), + CFLAGS="$CFLAGS -Wno-implicit-int" + AC_TRY_COMPILE([#include <X11/Xlib.h>], , + AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int", + AC_MSG_RESULT(test failed) + ) + ) + CFLAGS=$cflags_save + + LDFLAGS="$ac_save_LDFLAGS" + + AC_MSG_CHECKING(size of wchar_t is 2 bytes) + AC_CACHE_VAL(ac_cv_small_wchar_t, + [AC_TRY_RUN([ +#include <X11/Xlib.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif + main() + { + if (sizeof(wchar_t) <= 2) + exit(1); + exit(0); + }], + ac_cv_small_wchar_t="no", + ac_cv_small_wchar_t="yes", + AC_MSG_ERROR(failed to compile test program))]) + AC_MSG_RESULT($ac_cv_small_wchar_t) + if test "x$ac_cv_small_wchar_t" = "xyes" ; then + AC_DEFINE(SMALL_WCHAR_T) + fi + + fi +fi + +test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no + +AC_MSG_CHECKING(--enable-gui argument) +AC_ARG_ENABLE(gui, + [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon/macvim]], , enable_gui="auto") + +dnl Canonicalize the --enable-gui= argument so that it can be easily compared. +dnl Do not use character classes for portability with old tools. +enable_gui_canon=`echo "_$enable_gui" | \ + sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + +dnl Skip everything by default. +SKIP_GTK2=YES +SKIP_GTK3=YES +SKIP_GNOME=YES +SKIP_MOTIF=YES +SKIP_ATHENA=YES +SKIP_NEXTAW=YES +SKIP_PHOTON=YES +SKIP_CARBON=YES +SKIP_MACVIM=YES +GUITYPE=NONE + +if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then + SKIP_PHOTON= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_PHOTON=YES ;; + yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; + auto) AC_MSG_RESULT(auto - automatic GUI support) ;; + photon) AC_MSG_RESULT(Photon GUI support) ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_PHOTON=YES ;; + esac + +elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then + SKIP_CARBON= + SKIP_MACVIM= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_CARBON=YES + SKIP_MACVIM=YES ;; + yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) + SKIP_CARBON=YES ;; + carbon) AC_MSG_RESULT(Carbon GUI support) + SKIP_MACVIM=YES ;; + macvim) AC_MSG_RESULT(MacVim GUI support) + SKIP_CARBON=YES ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_CARBON=YES + SKIP_MACVIM=YES ;; + esac + +else + + case "$enable_gui_canon" in + no|none) AC_MSG_RESULT(no GUI support) ;; + yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) + SKIP_GTK2= + SKIP_GNOME= + SKIP_MOTIF= + SKIP_ATHENA= + SKIP_NEXTAW= + SKIP_MACVIM= + SKIP_CARBON=;; + gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support) + SKIP_GTK2=;; + gnome2) AC_MSG_RESULT(GNOME 2.x GUI support) + SKIP_GNOME= + SKIP_GTK2=;; + gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support) + SKIP_GTK3=;; + motif) AC_MSG_RESULT(Motif GUI support) + SKIP_MOTIF=;; + athena) AC_MSG_RESULT(Athena GUI support) + SKIP_ATHENA=;; + nextaw) AC_MSG_RESULT(neXtaw GUI support) + SKIP_NEXTAW=;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;; + esac + +fi + +if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \ + -a "$enable_gui_canon" != "gnome2"; then + AC_MSG_CHECKING(whether or not to look for GTK+ 2) + AC_ARG_ENABLE(gtk2-check, + [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]], + , enable_gtk2_check="yes") + AC_MSG_RESULT($enable_gtk2_check) + if test "x$enable_gtk2_check" = "xno"; then + SKIP_GTK2=YES + SKIP_GNOME=YES + fi +fi + +if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then + AC_MSG_CHECKING(whether or not to look for GNOME) + AC_ARG_ENABLE(gnome-check, + [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]], + , enable_gnome_check="no") + AC_MSG_RESULT($enable_gnome_check) + if test "x$enable_gnome_check" = "xno"; then + SKIP_GNOME=YES + fi +fi + +if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then + AC_MSG_CHECKING(whether or not to look for GTK+ 3) + AC_ARG_ENABLE(gtk3-check, + [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]], + , enable_gtk3_check="yes") + AC_MSG_RESULT($enable_gtk3_check) + if test "x$enable_gtk3_check" = "xno"; then + SKIP_GTK3=YES + fi +fi + +if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then + AC_MSG_CHECKING(whether or not to look for Motif) + AC_ARG_ENABLE(motif-check, + [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]], + , enable_motif_check="yes") + AC_MSG_RESULT($enable_motif_check) + if test "x$enable_motif_check" = "xno"; then + SKIP_MOTIF=YES + fi +fi + +if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then + AC_MSG_CHECKING(whether or not to look for Athena) + AC_ARG_ENABLE(athena-check, + [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]], + , enable_athena_check="yes") + AC_MSG_RESULT($enable_athena_check) + if test "x$enable_athena_check" = "xno"; then + SKIP_ATHENA=YES + fi +fi + +if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then + AC_MSG_CHECKING(whether or not to look for neXtaw) + AC_ARG_ENABLE(nextaw-check, + [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]], + , enable_nextaw_check="yes") + AC_MSG_RESULT($enable_nextaw_check); + if test "x$enable_nextaw_check" = "xno"; then + SKIP_NEXTAW=YES + fi +fi + +if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then + AC_MSG_CHECKING(whether or not to look for Carbon) + AC_ARG_ENABLE(carbon-check, + [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]], + , enable_carbon_check="yes") + AC_MSG_RESULT($enable_carbon_check); + if test "x$enable_carbon_check" = "xno"; then + SKIP_CARBON=YES + fi +fi + +if test "x$SKIP_MACVIM" != "xYES" -a "$enable_gui_canon" != "macvim"; then + AC_MSG_CHECKING(whether or not to look for MacVim) + AC_ARG_ENABLE(macvim-check, + [ --enable-macvim-check If auto-select GUI, check for MacVim [default=yes]], + , enable_macvim_check="yes") + AC_MSG_RESULT($enable_macvim_check); + if test "x$enable_macvim_check" = "xno"; then + SKIP_MACVIM=YES + fi +fi + +if test "x$MACOS_X" = "xyes"; then + dnl Default install directory is not /usr/local + if test x$prefix = xNONE; then + prefix=/Applications + fi + + if test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then + AC_MSG_CHECKING(for MacVim GUI) + dnl already did the check, just give the message + AC_MSG_RESULT(yes); + GUITYPE=MACVIMGUI + dnl Sorry for the hard coded default + datadir='${prefix}/MacVim.app/Contents/Resources' + elif test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then + AC_MSG_CHECKING(for Carbon GUI) + dnl already did the check, just give the message + AC_MSG_RESULT(yes); + GUITYPE=CARBONGUI + dnl Sorry for the hard coded default + datadir='${prefix}/Vim.app/Contents/Resources' + + CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon" + fi + + if test "$VIMNAME" = "vim"; then + VIMNAME=Vim + fi + + dnl skip everything else + SKIP_GTK2=YES; + SKIP_GNOME=YES; + SKIP_MOTIF=YES; + SKIP_ATHENA=YES; + SKIP_NEXTAW=YES; + SKIP_PHOTON=YES; +fi + +dnl define an autoconf function to check for a specified version of GTK, and +dnl try to compile/link a GTK program. +dnl +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[ + if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then + { + no_gtk="" + if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ + && $PKG_CONFIG --exists gtk+-2.0; then + { + min_gtk_version=ifelse([$1], ,2.2.0,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + dnl We should be using PKG_CHECK_MODULES() instead of this hack. + dnl But I guess the dependency on pkgconfig.m4 is not wanted or + dnl something like that. + GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0` + GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0` + GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0` + gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + } + elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ + && $PKG_CONFIG --exists gtk+-3.0; then + { + min_gtk_version=ifelse([$1], ,3.0.0,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + + GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0` + GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0` + GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0` + gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + } + else + no_gtk=yes + fi + + if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then + { + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + + dnl + dnl Now check if the installed GTK is sufficiently new. + dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include <gtk/gtk.h> +#include <stdio.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif + +int +main () +{ +int major, minor, micro; +char *tmp_version; + +system ("touch conf.gtktest"); + +/* HP/UX 9 (%@#!) writes to sscanf strings */ +tmp_version = g_strdup("$min_gtk_version"); +if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + +if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && + (gtk_micro_version >= micro))) +{ + return 0; +} +return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + } + fi + if test "x$no_gtk" = x ; then + if test "x$enable_gtktest" = "xyes"; then + AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) + else + AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) + fi + ifelse([$2], , :, [$2]) + else + { + AC_MSG_RESULT(no) + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + } + fi + } + else + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + +dnl --------------------------------------------------------------------------- +dnl gnome +dnl --------------------------------------------------------------------------- +AC_DEFUN([GNOME_INIT_HOOK], +[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes=DIR Specify location of GNOME headers], + [CFLAGS="$CFLAGS -I$withval"] + ) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs=DIR Specify location of GNOME libs], + [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval] + ) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + { + AC_MSG_CHECKING(for libgnomeui-2.0) + if $PKG_CONFIG --exists libgnomeui-2.0; then + AC_MSG_RESULT(yes) + GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0` + GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0` + GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0` + + dnl On FreeBSD we need -pthread but pkg-config doesn't include it. + dnl This might not be the right way but it works for me... + AC_MSG_CHECKING(for FreeBSD) + if test "`(uname) 2>/dev/null`" = FreeBSD; then + AC_MSG_RESULT(yes, adding -pthread) + GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" + GNOME_LIBS="$GNOME_LIBS -pthread" + else + AC_MSG_RESULT(no) + fi + $1 + else + AC_MSG_RESULT(not found) + if test "x$2" = xfail; then + AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config) + fi + fi + } + fi +]) + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail) +]) + + +dnl --------------------------------------------------------------------------- +dnl Check for GTK2. If it fails, then continue on for Motif as before... +dnl --------------------------------------------------------------------------- +if test -z "$SKIP_GTK2"; then + + AC_MSG_CHECKING(--disable-gtktest argument) + AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], + , enable_gtktest=yes) + if test "x$enable_gtktest" = "xyes" ; then + AC_MSG_RESULT(gtk test enabled) + else + AC_MSG_RESULT(gtk test disabled) + fi + + if test "X$PKG_CONFIG" = "X"; then + AC_PATH_TOOL(PKG_CONFIG, pkg-config, no) + fi + + if test "x$PKG_CONFIG" != "xno"; then + dnl First try finding version 2.2.0 or later. The 2.0.x series has + dnl problems (bold fonts, --remote doesn't work). + AM_PATH_GTK(2.2.0, + [GUI_LIB_LOC="$GTK_LIBDIR" + GTK_LIBNAME="$GTK_LIBS" + GUI_INC_LOC="$GTK_CFLAGS"], ) + if test "x$GTK_CFLAGS" != "x"; then + SKIP_GTK3=YES + SKIP_ATHENA=YES + SKIP_NEXTAW=YES + SKIP_MOTIF=YES + GUITYPE=GTK + AC_SUBST(GTK_LIBNAME) + fi + fi + if test "x$GUITYPE" = "xGTK"; then + dnl + dnl if GTK exists, then check for GNOME. + dnl + if test -z "$SKIP_GNOME"; then + { + GNOME_INIT_HOOK([have_gnome=yes]) + if test "x$have_gnome" = xyes ; then + AC_DEFINE(FEAT_GUI_GNOME) + GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR" + GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS" + fi + } + fi + fi +fi + + +dnl --------------------------------------------------------------------------- +dnl Check for GTK3. +dnl --------------------------------------------------------------------------- +if test -z "$SKIP_GTK3"; then + + AC_MSG_CHECKING(--disable-gtktest argument) + AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], + , enable_gtktest=yes) + if test "x$enable_gtktest" = "xyes" ; then + AC_MSG_RESULT(gtk test enabled) + else + AC_MSG_RESULT(gtk test disabled) + fi + + if test "X$PKG_CONFIG" = "X"; then + AC_PATH_TOOL(PKG_CONFIG, pkg-config, no) + fi + + if test "x$PKG_CONFIG" != "xno"; then + AM_PATH_GTK(3.0.0, + [GUI_LIB_LOC="$GTK_LIBDIR" + GTK_LIBNAME="$GTK_LIBS" + GUI_INC_LOC="$GTK_CFLAGS"], ) + if test "x$GTK_CFLAGS" != "x"; then + SKIP_GTK2=YES + SKIP_GNOME=YES + SKIP_ATHENA=YES + SKIP_NEXTAW=YES + SKIP_MOTIF=YES + GUITYPE=GTK + AC_SUBST(GTK_LIBNAME) + AC_DEFINE(USE_GTK3) + fi + fi +fi + +dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and +dnl glib-compile-resources is found in PATH, use GResource. +if test "x$GUITYPE" = "xGTK"; then + AC_MSG_CHECKING([version of Gdk-Pixbuf]) + gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0` + if test "x$gdk_pixbuf_version" != x ; then + gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \ + sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'` + if test "x$gdk_pixbuf_version_minor" != x -a \ + $gdk_pixbuf_version_minor -ge 31 ; then + AC_MSG_RESULT([OK.]) + AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no) + AC_MSG_CHECKING([glib-compile-resources]) + if test "x$GLIB_COMPILE_RESOURCES" = xno ; then + GLIB_COMPILE_RESOURCES="" + AC_MSG_RESULT([cannot be found in PATH.]) + else + AC_MSG_RESULT([usable.]) + AC_DEFINE(USE_GRESOURCE) + GRESOURCE_SRC="auto/gui_gtk_gresources.c" + GRESOURCE_OBJ="objects/gui_gtk_gresources.o" + fi + else + AC_MSG_RESULT([not usable.]) + fi + else + AC_MSG_RESULT([cannot obtain from pkg_config.]) + fi + + AC_MSG_CHECKING([--disable-icon-cache-update argument]) + AC_ARG_ENABLE(icon_cache_update, + [ --disable-icon-cache-update update disabled], + [], + [enable_icon_cache_update="yes"]) + if test "$enable_icon_cache_update" = "yes"; then + AC_MSG_RESULT([not set]) + AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no) + if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then + AC_MSG_RESULT([not found in PATH.]) + fi + else + AC_MSG_RESULT([update disabled]) + fi + + AC_MSG_CHECKING([--disable-desktop-database-update argument]) + AC_ARG_ENABLE(desktop_database_update, + [ --disable-desktop-database-update update disabled], + [], + [enable_desktop_database_update="yes"]) + if test "$enable_desktop_database_update" = "yes"; then + AC_MSG_RESULT([not set]) + AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no) + if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then + AC_MSG_RESULT([not found in PATH.]) + fi + else + AC_MSG_RESULT([update disabled]) + fi +fi +AC_SUBST(GLIB_COMPILE_RESOURCES) +AC_SUBST(GRESOURCE_SRC) +AC_SUBST(GRESOURCE_OBJ) +AC_SUBST(GTK_UPDATE_ICON_CACHE) +AC_SUBST(UPDATE_DESKTOP_DATABASE) + +dnl Check for Motif include files location. +dnl The LAST one found is used, this makes the highest version to be used, +dnl e.g. when Motif1.2 and Motif2.0 are both present. + +if test -z "$SKIP_MOTIF"; then + gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX" + dnl Remove "-I" from before $GUI_INC_LOC if it's there + GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`" + + AC_MSG_CHECKING(for location of Motif GUI includes) + gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC" + GUI_INC_LOC= + for try in $gui_includes; do + if test -f "$try/Xm/Xm.h"; then + GUI_INC_LOC=$try + fi + done + if test -n "$GUI_INC_LOC"; then + if test "$GUI_INC_LOC" = /usr/include; then + GUI_INC_LOC= + AC_MSG_RESULT(in default path) + else + AC_MSG_RESULT($GUI_INC_LOC) + fi + else + AC_MSG_RESULT(<not found>) + SKIP_MOTIF=YES + fi +fi + +dnl Check for Motif library files location. In the same order as the include +dnl files, to avoid a mixup if several versions are present + +if test -z "$SKIP_MOTIF"; then + AC_MSG_CHECKING(--with-motif-lib argument) + AC_ARG_WITH(motif-lib, + [ --with-motif-lib=STRING Library for Motif ], + [ MOTIF_LIBNAME="${withval}" ] ) + + if test -n "$MOTIF_LIBNAME"; then + AC_MSG_RESULT($MOTIF_LIBNAME) + GUI_LIB_LOC= + else + AC_MSG_RESULT(no) + + dnl Remove "-L" from before $GUI_LIB_LOC if it's there + GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`" + + dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The + dnl linker will figure out which one to use, we only check if one exists. + AC_MSG_CHECKING(for location of Motif GUI libs) + gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC" + GUI_LIB_LOC= + for try in $gui_libs; do + for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do + if test -f "$libtry"; then + GUI_LIB_LOC=$try + fi + done + done + if test -n "$GUI_LIB_LOC"; then + dnl Remove /usr/lib, it causes trouble on some systems + if test "$GUI_LIB_LOC" = /usr/lib \ + -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \ + -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then + GUI_LIB_LOC= + AC_MSG_RESULT(in default path) + else + if test -n "$GUI_LIB_LOC"; then + AC_MSG_RESULT($GUI_LIB_LOC) + if test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC" + fi + fi + fi + MOTIF_LIBNAME=-lXm + else + AC_MSG_RESULT(<not found>) + SKIP_MOTIF=YES + fi + fi +fi + +if test -z "$SKIP_MOTIF"; then + SKIP_ATHENA=YES + SKIP_NEXTAW=YES + GUITYPE=MOTIF + AC_SUBST(MOTIF_LIBNAME) +fi + +dnl Check if the Athena files can be found + +GUI_X_LIBS= + +if test -z "$SKIP_ATHENA"; then + AC_MSG_CHECKING(if Athena header files can be found) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ +#include <X11/Intrinsic.h> +#include <X11/Xaw/Paned.h>], , + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); SKIP_ATHENA=YES ) + CFLAGS=$cflags_save +fi + +if test -z "$SKIP_ATHENA"; then + GUITYPE=ATHENA +fi + +if test -z "$SKIP_NEXTAW"; then + AC_MSG_CHECKING(if neXtaw header files can be found) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ +#include <X11/Intrinsic.h> +#include <X11/neXtaw/Paned.h>], , + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); SKIP_NEXTAW=YES ) + CFLAGS=$cflags_save +fi + +if test -z "$SKIP_NEXTAW"; then + GUITYPE=NEXTAW +fi + +if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then + dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty + dnl Avoid adding it when it twice + if test -n "$GUI_INC_LOC"; then + GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`" + fi + if test -n "$GUI_LIB_LOC"; then + GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`" + fi + + dnl Check for -lXext and then for -lXmu + ldflags_save=$LDFLAGS + LDFLAGS="$X_LIBS $LDFLAGS" + AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],, + [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) + dnl For Solaris we need -lw and -ldl before linking with -lXmu works. + AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],, + [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) + AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],, + [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) + AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],, + [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) + if test -z "$SKIP_MOTIF"; then + AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],, + [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) + fi + LDFLAGS=$ldflags_save + + dnl Execute xmkmf to figure out if -DNARROWPROTO is needed. + AC_MSG_CHECKING(for extra X11 defines) + NARROW_PROTO= + rm -fr conftestdir + if mkdir conftestdir; then + cd conftestdir + cat > Imakefile <<'EOF' +acfindx: + @echo 'NARROW_PROTO="${PROTO_DEFINES}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + fi + cd .. + rm -fr conftestdir + fi + if test -z "$NARROW_PROTO"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT($NARROW_PROTO) + fi + AC_SUBST(NARROW_PROTO) +fi + +dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs +dnl use the X11 include path +if test "$enable_xsmp" = "yes"; then + cppflags_save=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_CHECK_HEADERS(X11/SM/SMlib.h) + CPPFLAGS=$cppflags_save +fi + + +if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then + dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path + cppflags_save=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h) + + dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h + if test ! "$enable_xim" = "no"; then + AC_MSG_CHECKING(for XIMText in X11/Xlib.h) + AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no; xim has been disabled); enable_xim="no") + fi + CPPFLAGS=$cppflags_save + + dnl automatically enable XIM when hangul input isn't enabled + if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \ + -a "x$GUITYPE" != "xNONE" ; then + AC_MSG_RESULT(X GUI selected; xim has been enabled) + enable_xim="yes" + fi +fi + +if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then + cppflags_save=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $X_CFLAGS" +dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h + AC_MSG_CHECKING([for X11/Xmu/Editres.h]) + AC_TRY_COMPILE([ +#include <X11/Intrinsic.h> +#include <X11/Xmu/Editres.h>], + [int i; i = 0;], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_X11_XMU_EDITRES_H), + AC_MSG_RESULT(no)) + CPPFLAGS=$cppflags_save +fi + +dnl Only use the Xm directory when compiling Motif, don't use it for Athena +if test -z "$SKIP_MOTIF"; then + cppflags_save=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + if test "$zOSUnix" = "yes"; then + xmheader="Xm/Xm.h" + else + xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h + Xm/UnhighlightT.h Xm/Notebook.h" + fi + AC_CHECK_HEADERS($xmheader) + + if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then + dnl Solaris uses XpmAttributes_21, very annoying. + AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h]) + AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;], + AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21), + AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) + ) + else + AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) + fi + CPPFLAGS=$cppflags_save +fi + +if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then + AC_MSG_RESULT(no GUI selected; xim has been disabled) + enable_xim="no" +fi +if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then + AC_MSG_RESULT(no GUI selected; fontset has been disabled) + enable_fontset="no" +fi +if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then + AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled) + enable_fontset="no" +fi + +if test -z "$SKIP_PHOTON"; then + GUITYPE=PHOTONGUI +fi + +AC_SUBST(GUI_INC_LOC) +AC_SUBST(GUI_LIB_LOC) +AC_SUBST(GUITYPE) +AC_SUBST(GUI_X_LIBS) + +if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then + AC_MSG_ERROR([cannot use workshop without Motif]) +fi + +dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled +if test "$enable_xim" = "yes"; then + AC_DEFINE(FEAT_XIM) +fi +if test "$enable_fontset" = "yes"; then + AC_DEFINE(FEAT_XFONTSET) +fi + + +dnl --------------------------------------------------------------------------- +dnl end of GUI-checking +dnl --------------------------------------------------------------------------- + +AC_MSG_CHECKING([for /proc link to executable]) +if test -L "/proc/self/exe"; then + dnl Linux + AC_MSG_RESULT([/proc/self/exe]) + AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe") +elif test -L "/proc/self/path/a.out"; then + dnl Solaris + AC_MSG_RESULT([/proc/self/path/a.out]) + AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out") +elif test -L "/proc/curproc/file"; then + dnl FreeBSD + AC_MSG_RESULT([/proc/curproc/file]) + AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file") +else + AC_MSG_RESULT(no) +fi + +dnl Check for Cygwin, which needs an extra source file if not using X11 +AC_MSG_CHECKING(for CYGWIN or MSYS environment) +case `uname` in + CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes) + AC_MSG_CHECKING(for CYGWIN clipboard support) + if test "x$with_x" = "xno" ; then + OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o + AC_MSG_RESULT(yes) + AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD) + else + AC_MSG_RESULT(no - using X11) + fi ;; + + *) CYGWIN=no; AC_MSG_RESULT(no);; +esac + +dnl Only really enable hangul input when GUI and XFONTSET are available +if test "$enable_hangulinput" = "yes"; then + if test "x$GUITYPE" = "xNONE"; then + AC_MSG_RESULT(no GUI selected; hangul input has been disabled) + enable_hangulinput=no + else + AC_DEFINE(FEAT_HANGULIN) + HANGULIN_SRC=hangulin.c + AC_SUBST(HANGULIN_SRC) + HANGULIN_OBJ=objects/hangulin.o + AC_SUBST(HANGULIN_OBJ) + fi +fi + +dnl Checks for libraries and include files. + +AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#include <ctype.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); } + ]])],[ + vim_cv_toupper_broken=yes + ],[ + vim_cv_toupper_broken=no + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken') + ])]) + +if test "x$vim_cv_toupper_broken" = "xyes" ; then + AC_DEFINE(BROKEN_TOUPPER) +fi + +AC_MSG_CHECKING(whether __DATE__ and __TIME__ work) +AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME), + AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(whether __attribute__((unused)) is allowed) +AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED), + AC_MSG_RESULT(no)) + +dnl Checks for header files. +AC_CHECK_HEADER(elf.h, HAS_ELF=1) +dnl AC_CHECK_HEADER(dwarf.h, SVR4=1) +if test "$HAS_ELF" = 1; then + AC_CHECK_LIB(elf, main) +fi + +AC_HEADER_DIRENT + +dnl If sys/wait.h is not found it might still exist but not be POSIX +dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT) +if test $ac_cv_header_sys_wait_h = no; then + AC_MSG_CHECKING([for sys/wait.h that defines union wait]) + AC_TRY_COMPILE([#include <sys/wait.h>], + [union wait xx, yy; xx = yy], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SYS_WAIT_H) + AC_DEFINE(HAVE_UNION_WAIT), + AC_MSG_RESULT(no)) +fi + +AC_CHECK_HEADERS(stdint.h stdlib.h string.h \ + sys/select.h sys/utsname.h termcap.h fcntl.h \ + sgtty.h sys/ioctl.h sys/time.h sys/types.h \ + termio.h iconv.h inttypes.h langinfo.h math.h migemo.h \ + unistd.h stropts.h errno.h sys/resource.h \ + sys/systeminfo.h locale.h sys/stream.h termios.h \ + libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ + utime.h sys/param.h libintl.h libgen.h \ + util/debug.h util/msg18n.h frame.h sys/acl.h \ + sys/access.h sys/sysinfo.h wchar.h wctype.h) + +dnl sys/ptem.h depends on sys/stream.h on Solaris +AC_CHECK_HEADERS(sys/ptem.h, [], [], +[#if defined HAVE_SYS_STREAM_H +# include <sys/stream.h> +#endif]) + +dnl sys/sysctl.h depends on sys/param.h on OpenBSD +AC_CHECK_HEADERS(sys/sysctl.h, [], [], +[#if defined HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif]) + + +dnl pthread_np.h may exist but can only be used after including pthread.h +AC_MSG_CHECKING([for pthread_np.h]) +AC_TRY_COMPILE([ +#include <pthread.h> +#include <pthread_np.h>], + [int i; i = 0;], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTHREAD_NP_H), + AC_MSG_RESULT(no)) + +AC_CHECK_HEADERS(strings.h) +if test "x$MACOS_X" = "xyes"; then + dnl The strings.h file on OS/X contains a warning and nothing useful. + AC_DEFINE(NO_STRINGS_WITH_STRING_H) +else + +dnl Check if strings.h and string.h can both be included when defined. +AC_MSG_CHECKING([if strings.h can be included after string.h]) +cppflags_save=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $X_CFLAGS" +AC_TRY_COMPILE([ +#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO) +# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */ + /* but don't do it on AIX 5.1 (Uribarri) */ +#endif +#ifdef HAVE_XM_XM_H +# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */ +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#if defined(HAVE_STRINGS_H) +# include <strings.h> +#endif + ], [int i; i = 0;], + AC_MSG_RESULT(yes), + AC_DEFINE(NO_STRINGS_WITH_STRING_H) + AC_MSG_RESULT(no)) +CPPFLAGS=$cppflags_save +fi + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_PROG_GCC_TRADITIONAL +AC_C_CONST +AC_C_VOLATILE +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_UID_T +AC_TYPE_UINT32_T + +AC_HEADER_TIME +AC_CHECK_TYPE(ino_t, long) +AC_CHECK_TYPE(dev_t, unsigned) +AC_C_BIGENDIAN(,,,) +AC_C_INLINE + +AC_MSG_CHECKING(for rlim_t) +if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then + AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t]) +else + AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl +changequote([,]), + [ +#include <sys/types.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#ifdef HAVE_SYS_RESOURCE_H +# include <sys/resource.h> +#endif + ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no) + AC_MSG_RESULT($ac_cv_type_rlim_t) +fi +if test $ac_cv_type_rlim_t = no; then + cat >> confdefs.h <<\EOF +#define rlim_t unsigned long +EOF +fi + +AC_MSG_CHECKING(for stack_t) +if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then + AC_MSG_RESULT([(cached) $ac_cv_type_stack_t]) +else + AC_EGREP_CPP(stack_t, + [ +#include <sys/types.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#include <signal.h> + ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no) + AC_MSG_RESULT($ac_cv_type_stack_t) +fi +if test $ac_cv_type_stack_t = no; then + cat >> confdefs.h <<\EOF +#define stack_t struct sigaltstack +EOF +fi + +dnl BSDI uses ss_base while others use ss_sp for the stack pointer. +AC_MSG_CHECKING(whether stack_t has an ss_base field) +AC_TRY_COMPILE([ +#include <sys/types.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#include <signal.h> +#include "confdefs.h" + ], [stack_t sigstk; sigstk.ss_base = 0; ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE), + AC_MSG_RESULT(no)) + +olibs="$LIBS" +AC_MSG_CHECKING(--with-tlib argument) +AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],) +if test -n "$with_tlib"; then + AC_MSG_RESULT($with_tlib) + LIBS="$LIBS -l$with_tlib" + AC_MSG_CHECKING(for linking with $with_tlib library) + AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED)) + dnl Need to check for tgetent() below. + olibs="$LIBS" +else + AC_MSG_RESULT([empty: automatic terminal library selection]) + dnl On HP-UX 10.10 termcap or termlib should be used instead of + dnl curses, because curses is much slower. + dnl Newer versions of ncurses are preferred over anything, except + dnl when tinfo has been split off, it contains all we need. + dnl Older versions of ncurses have bugs, get a new one! + dnl Digital Unix (OSF1) should use curses (Ronald Schild). + dnl On SCO Openserver should prefer termlib (Roger Cornelius). + case "`uname -s 2>/dev/null`" in + OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";; + *) tlibs="tinfo ncurses termlib termcap curses";; + esac + for libname in $tlibs; do + AC_CHECK_LIB(${libname}, tgetent,,) + if test "x$olibs" != "x$LIBS"; then + dnl It's possible that a library is found but it doesn't work + dnl e.g., shared library that cannot be found + dnl compile and run a test program to be sure + AC_TRY_RUN([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }], + res="OK", res="FAIL", res="FAIL") + if test "$res" = "OK"; then + break + fi + AC_MSG_RESULT($libname library is not usable) + LIBS="$olibs" + fi + done + if test "x$olibs" = "x$LIBS"; then + AC_MSG_RESULT(no terminal library found) + fi +fi + +if test "x$olibs" = "x$LIBS"; then + AC_MSG_CHECKING([for tgetent()]) + AC_TRY_LINK([], + [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");], + AC_MSG_RESULT(yes), + AC_MSG_ERROR([NOT FOUND! + You need to install a terminal library; for example ncurses. + Or specify the name of the library with --with-tlib.])) +fi + +AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +main() +{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); } + ]])],[ + vim_cv_terminfo=no + ],[ + vim_cv_terminfo=yes + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo') + ]) + ]) + +if test "x$vim_cv_terminfo" = "xyes" ; then + AC_DEFINE(TERMINFO) +fi + +AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +main() +{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); } + ]])],[ + vim_cv_tgetent=zero + ],[ + vim_cv_tgetent=non-zero + ],[ + AC_MSG_ERROR(failed to compile test program.) + ]) + ]) + +if test "x$vim_cv_tgetent" = "xzero" ; then + AC_DEFINE(TGETENT_ZERO_ERR, 0) +fi + +AC_MSG_CHECKING(whether termcap.h contains ospeed) +AC_TRY_LINK([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif + ], [ospeed = 20000], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED), + [AC_MSG_RESULT(no) + AC_MSG_CHECKING(whether ospeed can be extern) + AC_TRY_LINK([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif +extern short ospeed; + ], [ospeed = 20000], + AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN), + AC_MSG_RESULT(no))] + ) + +AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC]) +AC_TRY_LINK([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif + ], [if (UP == 0 && BC == 0) PC = 1], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC), + [AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether UP, BC and PC can be extern]) + AC_TRY_LINK([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif +extern char *UP, *BC, PC; + ], [if (UP == 0 && BC == 0) PC = 1], + AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN), + AC_MSG_RESULT(no))] + ) + +AC_MSG_CHECKING(whether tputs() uses outfuntype) +AC_TRY_COMPILE([ +#ifdef HAVE_TERMCAP_H +# include <termcap.h> +#endif + ], [extern int xx(); tputs("test", 1, (outfuntype)xx)], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE), + AC_MSG_RESULT(no)) + +dnl On some SCO machines sys/select redefines struct timeval +AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included]) +AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/time.h> +#include <sys/select.h>], , + AC_MSG_RESULT(yes) + AC_DEFINE(SYS_SELECT_WITH_SYS_TIME), + AC_MSG_RESULT(no)) + +dnl AC_DECL_SYS_SIGLIST + +dnl Checks for pty.c (copied from screen) ========================== +AC_MSG_CHECKING(for /dev/ptc) +if test -r /dev/ptc; then + AC_DEFINE(HAVE_DEV_PTC) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for SVR4 ptys) +if test -c /dev/ptmx ; then + AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS), + AC_MSG_RESULT(no)) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for ptyranges) +if test -d /dev/ptym ; then + pdir='/dev/ptym' +else + pdir='/dev' +fi +dnl SCO uses ptyp%d +AC_EGREP_CPP(yes, +[#ifdef M_UNIX + yes; +#endif + ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) +dnl if test -c /dev/ptyp19; then +dnl ptys=`echo /dev/ptyp??` +dnl else +dnl ptys=`echo $pdir/pty??` +dnl fi +if test "$ptys" != "$pdir/pty??" ; then + p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` + p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` + AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") + AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") + AC_MSG_RESULT([$p0 / $p1]) +else + AC_MSG_RESULT([don't know]) +fi + +dnl **** pty mode/group handling **** +dnl +dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222 +rm -f conftest_grp +AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <sys/stat.h> +#include <stdio.h> +main() +{ + struct stat sb; + char *x,*ttyname(); + int om, m; + FILE *fp; + + if (!(x = ttyname(0))) exit(1); + if (stat(x, &sb)) exit(1); + om = sb.st_mode; + if (om & 002) exit(0); + m = system("mesg y"); + if (m == -1 || m == 127) exit(1); + if (stat(x, &sb)) exit(1); + m = sb.st_mode; + if (chmod(x, om)) exit(1); + if (m & 002) exit(0); + if (sb.st_gid == getgid()) exit(1); + if (!(fp=fopen("conftest_grp", "w"))) + exit(1); + fprintf(fp, "%d\n", sb.st_gid); + fclose(fp); + exit(0); +} + ]])],[ + if test -f conftest_grp; then + vim_cv_tty_group=`cat conftest_grp` + if test "x$vim_cv_tty_mode" = "x" ; then + vim_cv_tty_mode=0620 + fi + AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group]) + else + vim_cv_tty_group=world + AC_MSG_RESULT([ptys are world accessible]) + fi + ],[ + vim_cv_tty_group=world + AC_MSG_RESULT([can't determine - assume ptys are world accessible]) + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode') + ]) + ]) +rm -f conftest_grp + +if test "x$vim_cv_tty_group" != "xworld" ; then + AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group) + if test "x$vim_cv_tty_mode" = "x" ; then + AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)]) + else + AC_DEFINE(PTYMODE, 0620) + fi +fi + +dnl Checks for library functions. =================================== + +AC_TYPE_SIGNAL + +dnl find out what to use at the end of a signal function +if test $ac_cv_type_signal = void; then + AC_DEFINE(SIGRETURN, [return]) +else + AC_DEFINE(SIGRETURN, [return 0]) +fi + +dnl check if struct sigcontext is defined (used for SGI only) +AC_MSG_CHECKING(for struct sigcontext) +AC_TRY_COMPILE([ +#include <signal.h> +test_sig() +{ + struct sigcontext *scont; + scont = (struct sigcontext *)0; + return 1; +} ], , + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SIGCONTEXT), + AC_MSG_RESULT(no)) + +dnl tricky stuff: try to find out if getcwd() is implemented with +dnl system("sh -c pwd") +AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +char *dagger[] = { "IFS=pwd", 0 }; +main() +{ + char buffer[500]; + extern char **environ; + environ = dagger; + return getcwd(buffer, 500) ? 0 : 1; +} + ]])],[ + vim_cv_getcwd_broken=no + ],[ + vim_cv_getcwd_broken=yes + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken') + ]) + ]) + +if test "x$vim_cv_getcwd_broken" = "xyes" ; then + AC_DEFINE(BAD_GETCWD) +fi + +dnl Check for functions in one big call, to reduce the size of configure. +dnl Can only be used for functions that do not require any include. +AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \ + getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \ + memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ + getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ + sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \ + strnicmp strpbrk strtol tgetent towlower towupper iswupper \ + usleep utime utimes mblen ftruncate unsetenv) +AC_FUNC_FSEEKO + +dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when +dnl appropriate, so that off_t is 64 bits when needed. +AC_SYS_LARGEFILE + +dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible +AC_MSG_CHECKING(for st_blksize) +AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/stat.h>], +[ struct stat st; + int n; + + stat("/", &st); + n = (int)st.st_blksize;], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE), + AC_MSG_RESULT(no)) + +AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include "confdefs.h" +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#include <sys/types.h> +#include <sys/stat.h> +main() {struct stat st; exit(stat("configure/", &st) != 0); } + ]])],[ + vim_cv_stat_ignores_slash=yes + ],[ + vim_cv_stat_ignores_slash=no + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash') + ]) + ]) + +if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then + AC_DEFINE(STAT_IGNORES_SLASH) +fi + +dnl Link with iconv for charset translation, if not found without library. +dnl check for iconv() requires including iconv.h +dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it +dnl has been installed. +AC_MSG_CHECKING(for iconv_open()) +save_LIBS="$LIBS" +LIBS="$LIBS -liconv" +AC_TRY_LINK([ +#ifdef HAVE_ICONV_H +# include <iconv.h> +#endif + ], [iconv_open("fr", "to");], + AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV), + LIBS="$save_LIBS" + AC_TRY_LINK([ +#ifdef HAVE_ICONV_H +# include <iconv.h> +#endif + ], [iconv_open("fr", "to");], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV), + AC_MSG_RESULT(no))) + + +AC_MSG_CHECKING(for nl_langinfo(CODESET)) +AC_TRY_LINK([ +#ifdef HAVE_LANGINFO_H +# include <langinfo.h> +#endif +], [char *cs = nl_langinfo(CODESET);], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET), + AC_MSG_RESULT(no)) + +dnl Need various functions for floating point support. Only enable +dnl floating point when they are all present. +AC_CHECK_LIB(m, strtod) +AC_MSG_CHECKING([for strtod() and other floating point functions]) +AC_TRY_LINK([ +#ifdef HAVE_MATH_H +# include <math.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +], [char *s; double d; + d = strtod("1.1", &s); + d = fabs(1.11); + d = ceil(1.11); + d = floor(1.11); + d = log10(1.11); + d = pow(1.11, 2.22); + d = sqrt(1.11); + d = sin(1.11); + d = cos(1.11); + d = atan(1.11); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS), + AC_MSG_RESULT(no)) + +dnl isinf() and isnan() need to include header files and may need -lm. +AC_MSG_CHECKING([for isinf()]) +AC_TRY_LINK([ +#ifdef HAVE_MATH_H +# include <math.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +], [int r = isinf(1.11); ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF), + AC_MSG_RESULT(no)) + +AC_MSG_CHECKING([for isnan()]) +AC_TRY_LINK([ +#ifdef HAVE_MATH_H +# include <math.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +], [int r = isnan(1.11); ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN), + AC_MSG_RESULT(no)) + +dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI +dnl when -lacl works, also try to use -lattr (required for Debian). +dnl On Solaris, use the acl_get/set functions in libsec, if present. +AC_MSG_CHECKING(--disable-acl argument) +AC_ARG_ENABLE(acl, + [ --disable-acl No check for ACL support.], + , [enable_acl="yes"]) +if test "$enable_acl" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"], + AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl" + AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),) + + AC_MSG_CHECKING(for POSIX ACL support) + AC_TRY_LINK([ +#include <sys/types.h> +#ifdef HAVE_SYS_ACL_H +# include <sys/acl.h> +#endif +acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS); + acl_set_file("foo", ACL_TYPE_ACCESS, acl); + acl_free(acl);], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL), + AC_MSG_RESULT(no)) + + AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)], + AC_MSG_CHECKING(for Solaris ACL support) + AC_TRY_LINK([ +#ifdef HAVE_SYS_ACL_H +# include <sys/acl.h> +#endif], [acl("foo", GETACLCNT, 0, NULL); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL), + AC_MSG_RESULT(no))) + + AC_MSG_CHECKING(for AIX ACL support) + AC_TRY_LINK([ +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +#ifdef HAVE_SYS_ACL_H +# include <sys/acl.h> +#endif +#ifdef HAVE_SYS_ACCESS_H +# include <sys/access.h> +#endif +#define _ALL_SOURCE + +#include <sys/stat.h> + +int aclsize; +struct acl *aclent;], [aclsize = sizeof(struct acl); + aclent = (void *)malloc(aclsize); + statacl("foo", STX_NORMAL, aclent, aclsize); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL), + AC_MSG_RESULT(no)) +else + AC_MSG_RESULT(yes) +fi + +if test "x$GTK_CFLAGS" != "x"; then + dnl pango_shape_full() is new, fall back to pango_shape(). + AC_MSG_CHECKING(for pango_shape_full) + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK( + [#include <gtk/gtk.h>], + [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL), + AC_MSG_RESULT(no)) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" +fi + +AC_MSG_CHECKING(--disable-gpm argument) +AC_ARG_ENABLE(gpm, + [ --disable-gpm Don't use gpm (Linux mouse daemon).], , + [enable_gpm="yes"]) + +if test "$enable_gpm" = "yes"; then + AC_MSG_RESULT(no) + dnl Checking if gpm support can be compiled + AC_CACHE_CHECK([for gpm], vi_cv_have_gpm, + [olibs="$LIBS" ; LIBS="-lgpm"] + AC_TRY_LINK( + [#include <gpm.h> + #include <linux/keyboard.h>], + [Gpm_GetLibVersion(NULL);], + dnl Configure defines HAVE_GPM, if it is defined feature.h defines + dnl FEAT_MOUSE_GPM if mouse support is included + [vi_cv_have_gpm=yes], + [vi_cv_have_gpm=no]) + [LIBS="$olibs"] + ) + if test $vi_cv_have_gpm = yes; then + LIBS="$LIBS -lgpm" + AC_DEFINE(HAVE_GPM) + fi +else + AC_MSG_RESULT(yes) +fi + +AC_MSG_CHECKING(--disable-sysmouse argument) +AC_ARG_ENABLE(sysmouse, + [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], , + [enable_sysmouse="yes"]) + +if test "$enable_sysmouse" = "yes"; then + AC_MSG_RESULT(no) + dnl Checking if sysmouse support can be compiled + dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h + dnl defines FEAT_SYSMOUSE if mouse support is included + AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse, + AC_TRY_LINK( + [#include <sys/consio.h> + #include <signal.h> + #include <sys/fbio.h>], + [struct mouse_info mouse; + mouse.operation = MOUSE_MODE; + mouse.operation = MOUSE_SHOW; + mouse.u.mode.mode = 0; + mouse.u.mode.signal = SIGUSR2;], + [vi_cv_have_sysmouse=yes], + [vi_cv_have_sysmouse=no]) + ) + if test $vi_cv_have_sysmouse = yes; then + AC_DEFINE(HAVE_SYSMOUSE) + fi +else + AC_MSG_RESULT(yes) +fi + +dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known +AC_MSG_CHECKING(for FD_CLOEXEC) +AC_TRY_COMPILE( +[#if HAVE_FCNTL_H +# include <fcntl.h> +#endif], +[ int flag = FD_CLOEXEC;], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC), + AC_MSG_RESULT(not usable)) + +dnl rename needs to be checked separately to work on Nextstep with cc +AC_MSG_CHECKING(for rename) +AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME), + AC_MSG_RESULT(no)) + +dnl sysctl() may exist but not the arguments we use +AC_MSG_CHECKING(for sysctl) +AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/sysctl.h>], +[ int mib[2], r; + size_t len; + + mib[0] = CTL_HW; + mib[1] = HW_USERMEM; + len = sizeof(r); + (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL), + AC_MSG_RESULT(not usable)) + +dnl sysinfo() may exist but not be Linux compatible +AC_MSG_CHECKING(for sysinfo) +AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/sysinfo.h>], +[ struct sysinfo sinfo; + int t; + + (void)sysinfo(&sinfo); + t = sinfo.totalram; + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO), + AC_MSG_RESULT(not usable)) + +dnl struct sysinfo may have the mem_unit field or not +AC_MSG_CHECKING(for sysinfo.mem_unit) +AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/sysinfo.h>], +[ struct sysinfo sinfo; + sinfo.mem_unit = 1; + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT), + AC_MSG_RESULT(no)) + +dnl sysconf() may exist but not support what we want to use +AC_MSG_CHECKING(for sysconf) +AC_TRY_COMPILE( +[#include <unistd.h>], +[ (void)sysconf(_SC_PAGESIZE); + (void)sysconf(_SC_PHYS_PAGES); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF), + AC_MSG_RESULT(not usable)) + +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([time_t]) +AC_CHECK_SIZEOF([off_t]) + +dnl Use different names to avoid clashing with other header files. +AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int]) +AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long]) + +dnl Make sure that uint32_t is really 32 bits unsigned. +AC_MSG_CHECKING([uint32_t is 32 bits]) +AC_TRY_RUN([ +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +main() { + uint32_t nr1 = (uint32_t)-1; + uint32_t nr2 = (uint32_t)0xffffffffUL; + if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1); + exit(0); +}], +AC_MSG_RESULT(ok), +AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]), +AC_MSG_WARN([cannot check uint32_t when cross-compiling.])) + +dnl Check for memmove() before bcopy(), makes memmove() be used when both are +dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5. + +[bcopy_test_prog=' +#include "confdefs.h" +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#endif +main() { + char buf[10]; + strcpy(buf, "abcdefghi"); + mch_memmove(buf, buf + 2, 3); + if (strncmp(buf, "ababcf", 6)) + exit(1); + strcpy(buf, "abcdefghi"); + mch_memmove(buf + 2, buf, 3); + if (strncmp(buf, "cdedef", 6)) + exit(1); + exit(0); /* libc version works properly. */ +}'] + +AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])], + [ + vim_cv_memmove_handles_overlap=yes + ],[ + vim_cv_memmove_handles_overlap=no + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap') + ]) + ]) + +if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then + AC_DEFINE(USEMEMMOVE) +else + AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])], + [ + vim_cv_bcopy_handles_overlap=yes + ],[ + vim_cv_bcopy_handles_overlap=no + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap') + ]) + ]) + + if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then + AC_DEFINE(USEBCOPY) + else + AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])], + [ + vim_cv_memcpy_handles_overlap=yes + ],[ + vim_cv_memcpy_handles_overlap=no + ],[ + AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap') + ]) + ]) + + if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then + AC_DEFINE(USEMEMCPY) + fi + fi +fi + + +dnl Check for multibyte locale functions +dnl Find out if _Xsetlocale() is supported by libX11. +dnl Check if X_LOCALE should be defined. +if test "x$with_x" = "xyes"; then + cflags_save=$CFLAGS + libs_save=$LIBS + LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS" + CFLAGS="$CFLAGS $X_CFLAGS" + + AC_MSG_CHECKING(whether X_LOCALE needed) + AC_TRY_COMPILE([#include <X11/Xlocale.h>],, + AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) + AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used) + AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no)) + + CFLAGS=$cflags_save + LIBS=$libs_save +fi + +dnl Link with xpg4, it is said to make Korean locale working +AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,) + +dnl Check how we can run ctags. Default to "ctags" when nothing works. +dnl Use --version to detect Exuberant ctags (preferred) +dnl Add --fields=+S to get function signatures for omni completion. +dnl -t for typedefs (many ctags have this) +dnl -s for static functions (Elvis ctags only?) +dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'. +dnl -i+m to test for older Exuberant ctags +AC_MSG_CHECKING(how to create tags) +test -f tags && mv tags tags.save +if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then + TAGPRG="ctags -I INIT+ --fields=+S" +elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then + TAGPRG="exctags -I INIT+ --fields=+S" +elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then + TAGPRG="exuberant-ctags -I INIT+ --fields=+S" +else + TAGPRG="ctags" + (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags" + (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c" + (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags" + (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t" + (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts" + (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs" + (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m" +fi +test -f tags.save && mv tags.save tags +AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG) + +dnl Check how we can run man with a section number +AC_MSG_CHECKING(how to run man with a section nr) +MANDEF="man" +(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s" +AC_MSG_RESULT($MANDEF) +if test "$MANDEF" = "man -s"; then + AC_DEFINE(USEMAN_S) +fi + +dnl Check if gettext() is working and if it needs -lintl +dnl We take care to base this on an empty LIBS: on some systems libelf would be +dnl in LIBS and implicitly take along libintl. The final LIBS would then not +dnl contain libintl, and the link step would fail due to -Wl,--as-needed. +AC_MSG_CHECKING(--disable-nls argument) +AC_ARG_ENABLE(nls, + [ --disable-nls Don't support NLS (gettext()).], , + [enable_nls="yes"]) + +if test "$enable_nls" = "yes"; then + AC_MSG_RESULT(no) + + INSTALL_LANGS=install-languages + AC_SUBST(INSTALL_LANGS) + INSTALL_TOOL_LANGS=install-tool-languages + AC_SUBST(INSTALL_TOOL_LANGS) + + AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, ) + AC_MSG_CHECKING([for NLS]) + if test -f po/Makefile; then + have_gettext="no" + if test -n "$MSGFMT"; then + olibs=$LIBS + LIBS="" + AC_TRY_LINK( + [#include <libintl.h>], + [gettext("Test");], + AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs, + LIBS="-lintl" + AC_TRY_LINK( + [#include <libintl.h>], + [gettext("Test");], + AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes"; + LIBS="$olibs -lintl", + AC_MSG_RESULT([gettext() doesn't work]); + LIBS=$olibs)) + else + AC_MSG_RESULT([msgfmt not found - disabled]); + fi + if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then + AC_DEFINE(HAVE_GETTEXT) + MAKEMO=yes + AC_SUBST(MAKEMO) + dnl this was added in GNU gettext 0.10.36 + AC_CHECK_FUNCS(bind_textdomain_codeset) + dnl _nl_msg_cat_cntr is required for GNU gettext + AC_MSG_CHECKING([for _nl_msg_cat_cntr]) + AC_TRY_LINK( + [#include <libintl.h> + extern int _nl_msg_cat_cntr;], + [++_nl_msg_cat_cntr;], + AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR), + AC_MSG_RESULT([no])) + fi + else + AC_MSG_RESULT([no "po/Makefile" - disabled]); + fi +else + AC_MSG_RESULT(yes) +fi + +dnl Check for C/Migemo (regexp pattern expansion). +AC_MSG_CHECKING(--disable-migemo argument) +AC_ARG_ENABLE(migemo, + [ --disable-migemo Don't support C/Migemo.], , + [enable_migemo="yes"]) +if test "$enable_migemo" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_LIB(migemo, migemo_open, + [LIBS="$LIBS -lmigemo"; AC_DEFINE(HAVE_MIGEMO)],,) +else + AC_MSG_RESULT(yes) +fi + +dnl Check for dynamic linking loader +AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)]) +if test x${DLL} = xdlfcn.h; then + AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ]) + AC_MSG_CHECKING([for dlopen()]) + AC_TRY_LINK(,[ + extern void* dlopen(); + dlopen(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), + AC_MSG_RESULT(no); + AC_MSG_CHECKING([for dlopen() in -ldl]) + olibs=$LIBS + LIBS="$LIBS -ldl" + AC_TRY_LINK(,[ + extern void* dlopen(); + dlopen(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), + AC_MSG_RESULT(no); + LIBS=$olibs)) + dnl ReliantUNIX has dlopen() in libc but everything else in libdl + dnl ick :-) + AC_MSG_CHECKING([for dlsym()]) + AC_TRY_LINK(,[ + extern void* dlsym(); + dlsym(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), + AC_MSG_RESULT(no); + AC_MSG_CHECKING([for dlsym() in -ldl]) + olibs=$LIBS + LIBS="$LIBS -ldl" + AC_TRY_LINK(,[ + extern void* dlsym(); + dlsym(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), + AC_MSG_RESULT(no); + LIBS=$olibs)) +elif test x${DLL} = xdl.h; then + AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ]) + AC_MSG_CHECKING([for shl_load()]) + AC_TRY_LINK(,[ + extern void* shl_load(); + shl_load(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), + AC_MSG_RESULT(no); + AC_MSG_CHECKING([for shl_load() in -ldld]) + olibs=$LIBS + LIBS="$LIBS -ldld" + AC_TRY_LINK(,[ + extern void* shl_load(); + shl_load(); + ], + AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), + AC_MSG_RESULT(no); + LIBS=$olibs)) +fi +AC_CHECK_HEADERS(setjmp.h) + +if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then + dnl -ldl must come after DynaLoader.a + if echo $LIBS | grep -e '-ldl' >/dev/null; then + LIBS=`echo $LIBS | sed s/-ldl//` + PERL_LIBS="$PERL_LIBS -ldl" + fi +fi + +if test "$MACOS_X" = "yes"; then + AC_MSG_CHECKING([whether we need macOS frameworks]) + if test "$GUITYPE" = "CARBONGUI"; then + AC_MSG_RESULT([yes, we need Carbon]) + LIBS="$LIBS -framework Carbon" + elif test "$MACOS_X_DARWIN" = "yes"; then + if test "$features" = "tiny"; then + dnl Since no FEAT_CLIPBOARD, no longer need for os_macosx.m. + OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'` + OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'` + if test "$enable_multibyte" = "yes"; then + AC_MSG_RESULT([yes, we need CoreServices]) + LIBS="$LIBS -framework CoreServices" + else + dnl Since no FEAT_MBYTE, no longer need for os_mac_conv.c. + AC_MSG_RESULT([no]) + OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_mac_conv.c++'` + OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_mac_conv.o++'` + CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's+-DMACOS_X_DARWIN++'` + fi + else + AC_MSG_RESULT([yes, we need AppKit]) + LIBS="$LIBS -framework AppKit" + if test "$features" = "small" -a "$enable_multibyte" = "no"; then + dnl Since FEAT_CLIPBOARD is to be defined in vim.h for FEAT_SMALL, define + dnl FEAT_MBYTE in order not to compromise the interoperability of the + dnl clipboard. + AC_MSG_NOTICE([+multi_byte will be set in favor of +clipboard]) + enable_multibyte=yes + AC_DEFINE(FEAT_MBYTE) + fi + fi + else + AC_MSG_RESULT([no]) + fi +fi + +if test "x$MACOS_X" = "xyes"; then + AC_MSG_CHECKING(--with-xcodecfg argument) + AC_ARG_WITH(xcodecfg, + [ --with-xcodecfg=CFG Debug, Release (default: Release)], + [ XCODEFLAGS="$XCODEFLAGS -configuration $withval" + AC_MSG_RESULT($withval) ], + [ AC_MSG_RESULT(using default) ]) + + dnl Set CFBundleShortVersionString of Info.plist + vim_short_version_string=`grep 'define.*VIM_VERSION_SHORT' $srcdir/version.h|sed -E -e 's/.*"([[0-9.]]*)".*/\1/'` + snapshot=`grep -C2 "Add new patch number below this line" $srcdir/version.c|tail -1|sed -E -e 's/^ *([[0-9]]+),.*/\1/'` + vim_short_version_string="$vim_short_version_string.$snapshot" + XCODEFLAGS="$XCODEFLAGS VIM_SHORT_VERSION_STRING=$vim_short_version_string" + + AC_SUBST(XCODEFLAGS) +fi + + +dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to +dnl use "-isystem" instead of "-I" for all non-Vim include dirs. +dnl But only when making dependencies, cproto and lint don't take "-isystem". +dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow +dnl the number before the version number. +DEPEND_CFLAGS_FILTER= +if test "$GCC" = yes; then + AC_MSG_CHECKING(for GCC 3 or later) + gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` + if test "$gccmajor" -gt "2"; then + DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. + dnl Also remove duplicate _FORTIFY_SOURCE arguments. + dnl And undefine it first to avoid a warning. + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) + if test "$gccmajor" -gt "3"; then + CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'` + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +fi +AC_SUBST(DEPEND_CFLAGS_FILTER) + +dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64 +dnl isn't required, but the CFLAGS for some of the libraries we're using +dnl include the define. Since the define changes the size of some datatypes +dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a +dnl consistent value. It's therefore safest to force the use of the define +dnl if it's present in any of the *_CFLAGS variables. +AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64) +if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then + AC_MSG_RESULT(yes) + AC_DEFINE(_FILE_OFFSET_BITS, 64) +else + AC_MSG_RESULT(no) +fi + +dnl link.sh tries to avoid overlinking in a hackish way. +dnl At least GNU ld supports --as-needed which provides the same functionality +dnl at linker level. Let's use it. +AC_MSG_CHECKING(linker --as-needed support) +LINK_AS_NEEDED= +# Check if linker supports --as-needed and --no-as-needed options +if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then + LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'` + LINK_AS_NEEDED=yes +fi +if test "$LINK_AS_NEEDED" = yes; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(LINK_AS_NEEDED) + +# IBM z/OS reset CFLAGS for config.mk +if test "$zOSUnix" = "yes"; then + CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" +fi + +dnl write output files +AC_OUTPUT(auto/config.mk:config.mk.in) + +dnl vim: set sw=2 tw=78 fo+=l: diff --git a/src/configure.in b/src/configure.in deleted file mode 100644 index 16a7daae19..0000000000 --- a/src/configure.in +++ /dev/null @@ -1,4064 +0,0 @@ -dnl configure.in: autoconf script for Vim - -dnl Process this file with autoconf 2.12 or 2.13 to produce "configure". -dnl Should also work with autoconf 2.54 and later. - -AC_INIT(vim.h) -AC_CONFIG_HEADER(auto/config.h:config.h.in) - -dnl Being able to run configure means the system is Unix (compatible). -AC_DEFINE(UNIX) -AC_PROG_MAKE_SET - -dnl Checks for programs. -AC_PROG_CC dnl required by almost everything -AC_PROG_CPP dnl required by header file checks -AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP -AC_PROG_FGREP dnl finds working grep -F -AC_ISC_POSIX dnl required by AC_C_CROSS -AC_PROG_AWK dnl required for "make html" in ../doc - -dnl Don't strip if we don't have it -AC_CHECK_PROG(STRIP, strip, strip, :) - -dnl Check for extension of executables -AC_EXEEXT - -dnl Check for standard headers. We don't use this in Vim but other stuff -dnl in autoconf needs it, where it uses STDC_HEADERS. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT - -dnl Check for the flag that fails if stuff are missing. - -AC_MSG_CHECKING(--enable-fail-if-missing argument) -AC_ARG_ENABLE(fail_if_missing, - [ --enable-fail-if-missing Fail if dependencies on additional features - specified on the command line are missing.], - [fail_if_missing="yes"], - [fail_if_missing="no"]) -AC_MSG_RESULT($fail_if_missing) - -dnl Set default value for CFLAGS if none is defined or it's empty -if test -z "$CFLAGS"; then - CFLAGS="-O" - test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall" -fi -if test "$GCC" = yes; then - dnl method that should work for nearly all versions - gccversion=`$CC -dumpversion` - if test "x$gccversion" = "x"; then - dnl old method; fall-back for when -dumpversion doesn't work - gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'` - fi - dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki - if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then - echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"' - CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'` - else - if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then - echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' - CFLAGS="$CFLAGS -fno-strength-reduce" - fi - fi -fi - -dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a -dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on -dnl the version number of the clang in use. -dnl Note that this does not work to get the version of clang 3.1 or 3.2. -AC_MSG_CHECKING(for recent clang version) -CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'` -if test x"$CLANG_VERSION_STRING" != x"" ; then - CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'` - CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'` - CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'` - CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION` - AC_MSG_RESULT($CLANG_VERSION) - dnl If you find the same issue with versions earlier than 500.2.75, - dnl change the constant 500002075 below appropriately. To get the - dnl integer corresponding to a version number, refer to the - dnl definition of CLANG_VERSION above. - if test "$CLANG_VERSION" -ge 500002075 ; then - CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'` - fi -else - AC_MSG_RESULT(no) -fi - -dnl If configure thinks we are cross compiling, there might be something -dnl wrong with the CC or CFLAGS settings, give a useful warning message -if test "$cross_compiling" = yes; then - AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS]) -fi - -dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies. -dnl But gcc 3.1 changed the meaning! See near the end. -test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM) - -if test -f ./toolcheck; then - AC_CHECKING(for buggy tools) - sh ./toolcheck 1>&AC_FD_MSG -fi - -OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" - -dnl Check for BeOS, which needs an extra source file -AC_MSG_CHECKING(for BeOS) -case `uname` in - BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o - BEOS=yes; AC_MSG_RESULT(yes);; - *) BEOS=no; AC_MSG_RESULT(no);; -esac - -dnl If QNX is found, assume we don't want to use Xphoton -dnl unless it was specifically asked for (--with-x) -AC_MSG_CHECKING(for QNX) -case `uname` in - QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o - test -z "$with_x" && with_x=no - QNX=yes; AC_MSG_RESULT(yes);; - *) QNX=no; AC_MSG_RESULT(no);; -esac - -dnl Check for Darwin and MacOS X -dnl We do a check for MacOS X in the very beginning because there -dnl are a lot of other things we need to change besides GUI stuff -AC_MSG_CHECKING([for Darwin (Mac OS X)]) -if test "`(uname) 2>/dev/null`" = Darwin; then - AC_MSG_RESULT(yes) - - AC_MSG_CHECKING(--disable-darwin argument) - AC_ARG_ENABLE(darwin, - [ --disable-darwin Disable Darwin (Mac OS X) support.], - , [enable_darwin="yes"]) - if test "$enable_darwin" = "yes"; then - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if Darwin files are there) - if test -f os_macosx.m; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT([no, Darwin support disabled]) - enable_darwin=no - fi - else - AC_MSG_RESULT([yes, Darwin support excluded]) - fi - - AC_MSG_CHECKING(--with-developer-dir argument) - AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools], - DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR), - DEVELOPER_DIR=""; AC_MSG_RESULT(not present)) - - if test "x$DEVELOPER_DIR" = "x"; then - AC_PATH_PROG(XCODE_SELECT, xcode-select) - if test "x$XCODE_SELECT" != "x"; then - AC_MSG_CHECKING(for developer dir using xcode-select) - DEVELOPER_DIR=`$XCODE_SELECT -print-path` - AC_MSG_RESULT([$DEVELOPER_DIR]) - else - DEVELOPER_DIR=/Developer - fi - fi - - AC_MSG_CHECKING(--with-macsdk argument) - AC_ARG_WITH(macsdk, - [ --with-macsdk=SDK SDK version (10.4, 10.5, 10.6, ...)], - [ MACSDK="$withval"; AC_MSG_RESULT($MACSDK) ], - [ MACSDK=""; AC_MSG_RESULT(using default) ]) - - if test -n "$MACSDK"; then - AC_MSG_CHECKING(if SDK is supported) - save_cflags="$CFLAGS" - save_ldflags="$LDFLAGS" - sdkflags="$DEVELOPER_DIR/SDKs/MacOSX$MACSDK" - if test "x$MACSDK" = "x10.4"; then - sdkflags="$sdkflags""u" - fi - sdkflags="$sdkflags.sdk -mmacosx-version-min=$MACSDK" - CFLAGS="$CFLAGS -isysroot $sdkflags" - LDFLAGS="$LDFLAGS -Wl,-syslibroot,$sdkflags" - AC_TRY_LINK([ ], [ ], - [ AC_MSG_RESULT([yes]) - XCODEFLAGS="$XCODEFLAGS -sdk macosx$MACSDK MACOSX_DEPLOYMENT_TARGET=$MACSDK" ], - [ AC_MSG_RESULT([no]) - dnl Important to clear MACSDK so later on in the script we can assume - dnl that no SDK was chosen if it is empty. - MACSDK="" - CFLAGS="$save_cflags" - LDFLAGS="$save_ldflags" ]) - fi - - - AC_MSG_CHECKING(--with-macarchs argument) - AC_ARG_WITH(macarchs, - [ --with-macarchs=ARCHS space separated list of archs (i386 x86_64 ppc ...)], - [ ARCHS="$withval"; AC_MSG_RESULT($ARCHS) ], - [ ARCHS=""; AC_MSG_RESULT(defaulting to native arch) ]) - - if test -n "$ARCHS"; then - AC_MSG_CHECKING(if architectures are supported) - save_cflags="$CFLAGS" - save_ldflags="$LDFLAGS" - archflags=`echo "$ARCHS" | sed -e 's/[[[:<:]]]/-arch /g'` - CFLAGS="$CFLAGS $archflags" - LDFLAGS="$LDFLAGS $archflags" - AC_TRY_LINK([ ], [ ], - [ AC_MSG_RESULT([yes]) - XCODEFLAGS="$XCODEFLAGS ARCHS=\"$ARCHS\" ONLY_ACTIVE_ARCH=\"NO\"" ], - [ AC_MSG_RESULT([no, will build for native arch only]) - ARCHS="" - CFLAGS="$save_cflags" - LDFLAGS="$save_ldflags" ]) - fi - - - if test "$enable_darwin" = "yes"; then - MACOSX=yes - OS_EXTRA_SRC="os_macosx.m os_mac_conv.c"; - OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" - dnl TODO: use -arch i386 on Intel machines - dnl Removed -no-cpp-precomp, only for very old compilers. - CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX" - - dnl If Carbon or Cocoa is found, assume we don't want - dnl X11 unless it was specifically asked for (--with-x) - dnl or Motif, Athena or GTK GUI is used. - AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes) - - SAVE_CPPFLAGS=$CPPFLAGS - SAVE_CFLAGS=$CFLAGS - CPPFLAGS="$CPPFLAGS -ObjC" - CFLAGS="$CFLAGS -ObjC" - AC_CHECK_HEADER(Cocoa/Cocoa.h, COCOA=yes) - CPPFLAGS=$SAVE_CPPFLAGS - CFLAGS=$SAVE_CFLAGS - - if test "x$CARBON" = "xyes" -o "x$COCOA" = "xyes"; then - if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then - with_x=no - fi - fi - fi -else - AC_MSG_RESULT(no) -fi - -dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon -dnl so we need to include it to have access to version macros. -AC_CHECK_HEADERS(AvailabilityMacros.h) - -AC_SUBST(OS_EXTRA_SRC) -AC_SUBST(OS_EXTRA_OBJ) - -dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS. -dnl Only when the directory exists and it wasn't there yet. -dnl For gcc don't do this when it is already in the default search path. -dnl Skip all of this when cross-compiling. -if test "$cross_compiling" = no; then - AC_MSG_CHECKING(--with-local-dir argument) - have_local_include='' - have_local_lib='' - AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries. - --without-local-dir do not search /usr/local for local libraries.], [ - local_dir="$withval" - case "$withval" in - */*) ;; - no) - # avoid adding local dir to LDFLAGS and CPPFLAGS - have_local_include=yes - have_local_lib=yes - ;; - *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;; - esac - AC_MSG_RESULT($local_dir) - ], [ - local_dir=/usr/local - AC_MSG_RESULT(Defaulting to $local_dir) - ]) - if test "$GCC" = yes -a "$local_dir" != no; then - echo 'void f(){}' > conftest.c - dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler) - have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"` - have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"` - rm -f conftest.c conftest.o - fi - if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then - tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"` - if test "$tt" = "$LDFLAGS"; then - LDFLAGS="$LDFLAGS -L${local_dir}/lib" - fi - fi - if test -z "$have_local_include" -a -d "${local_dir}/include"; then - tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"` - if test "$tt" = "$CPPFLAGS"; then - CPPFLAGS="$CPPFLAGS -I${local_dir}/include" - fi - fi -fi - -AC_MSG_CHECKING(--with-vim-name argument) -AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], - VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME), - VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME)) -AC_SUBST(VIMNAME) -AC_MSG_CHECKING(--with-ex-name argument) -AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable], - EXNAME="$withval"; AC_MSG_RESULT($EXNAME), - EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex)) -AC_SUBST(EXNAME) -AC_MSG_CHECKING(--with-view-name argument) -AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable], - VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME), - VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view)) -AC_SUBST(VIEWNAME) - -AC_MSG_CHECKING(--with-global-runtime argument) -AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'], - AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"), - AC_MSG_RESULT(no)) - -AC_MSG_CHECKING(--with-modified-by argument) -AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version], - AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"), - AC_MSG_RESULT(no)) - -dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix -AC_MSG_CHECKING(if character set is EBCDIC) -AC_TRY_COMPILE([ ], -[ /* TryCompile function for CharSet. - Treat any failure as ASCII for compatibility with existing art. - Use compile-time rather than run-time tests for cross-compiler - tolerance. */ -#if '0'!=240 -make an error "Character set is not EBCDIC" -#endif ], -[ # TryCompile action if true -cf_cv_ebcdic=yes ], -[ # TryCompile action if false -cf_cv_ebcdic=no]) -# end of TryCompile ]) -# end of CacheVal CvEbcdic -AC_MSG_RESULT($cf_cv_ebcdic) -case "$cf_cv_ebcdic" in #(vi - yes) AC_DEFINE(EBCDIC) - line_break='"\\n"' - ;; - *) line_break='"\\012"';; -esac -AC_SUBST(line_break) - -if test "$cf_cv_ebcdic" = "yes"; then -dnl If we have EBCDIC we most likely have z/OS Unix, let's test it! -AC_MSG_CHECKING(for z/OS Unix) -case `uname` in - OS/390) zOSUnix="yes"; - dnl If using cc the environment variable _CC_CCMODE must be - dnl set to "1", so that some compiler extensions are enabled. - dnl If using c89 the environment variable is named _CC_C89MODE. - dnl Note: compile with c89 never tested. - if test "$CC" = "cc"; then - ccm="$_CC_CCMODE" - ccn="CC" - else - if test "$CC" = "c89"; then - ccm="$_CC_C89MODE" - ccn="C89" - else - ccm=1 - fi - fi - if test "$ccm" != "1"; then - echo "" - echo "------------------------------------------" - echo " On z/OS Unix, the environment variable" - echo " _CC_${ccn}MODE must be set to \"1\"!" - echo " Do:" - echo " export _CC_${ccn}MODE=1" - echo " and then call configure again." - echo "------------------------------------------" - exit 1 - fi - # Set CFLAGS for configure process. - # This will be reset later for config.mk. - # Use haltonmsg to force error for missing H files. - CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; - LDFLAGS="$LDFLAGS -Wl,EDIT=NO" - AC_MSG_RESULT(yes) - ;; - *) zOSUnix="no"; - AC_MSG_RESULT(no) - ;; -esac -fi - -dnl Set QUOTESED. Needs additional backslashes on zOS -if test "$zOSUnix" = "yes"; then - QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'" -else - QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'" -fi -AC_SUBST(QUOTESED) - - -dnl Link with -lsmack for Smack stuff; if not found -AC_MSG_CHECKING(--disable-smack argument) -AC_ARG_ENABLE(smack, - [ --disable-smack Do not check for Smack support.], - , enable_smack="yes") -if test "$enable_smack" = "yes"; then - AC_MSG_RESULT(no) - AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no") -else - AC_MSG_RESULT(yes) -fi -if test "$enable_smack" = "yes"; then - AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no") -fi -if test "$enable_smack" = "yes"; then - AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h) - AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>], - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); enable_smack="no") -fi -if test "$enable_smack" = "yes"; then - AC_CHECK_LIB(attr, setxattr, - [LIBS="$LIBS -lattr" - found_smack="yes" - AC_DEFINE(HAVE_SMACK)]) -fi - -dnl When smack was found don't search for SELinux -if test "x$found_smack" = "x"; then - dnl Link with -lselinux for SELinux stuff; if not found - AC_MSG_CHECKING(--disable-selinux argument) - AC_ARG_ENABLE(selinux, - [ --disable-selinux Do not check for SELinux support.], - , enable_selinux="yes") - if test "$enable_selinux" = "yes"; then - AC_MSG_RESULT(no) - AC_CHECK_LIB(selinux, is_selinux_enabled, - [LIBS="$LIBS -lselinux" - AC_DEFINE(HAVE_SELINUX)]) - else - AC_MSG_RESULT(yes) - fi -fi - -dnl Check user requested features. - -AC_MSG_CHECKING(--with-features argument) -AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)], - features="$withval"; AC_MSG_RESULT($features), - features="normal"; AC_MSG_RESULT(Defaulting to normal)) - -dovimdiff="" -dogvimdiff="" -case "$features" in - tiny) AC_DEFINE(FEAT_TINY) ;; - small) AC_DEFINE(FEAT_SMALL) ;; - normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; - big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; - huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; - *) AC_MSG_RESULT([Sorry, $features is not supported]) ;; -esac - -AC_SUBST(dovimdiff) -AC_SUBST(dogvimdiff) - -AC_MSG_CHECKING(--with-compiledby argument) -AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message], - compiledby="$withval"; AC_MSG_RESULT($withval), - compiledby=""; AC_MSG_RESULT(no)) -AC_SUBST(compiledby) - -AC_MSG_CHECKING(--disable-xsmp argument) -AC_ARG_ENABLE(xsmp, - [ --disable-xsmp Disable XSMP session management], - , enable_xsmp="yes") - -if test "$enable_xsmp" = "yes"; then - AC_MSG_RESULT(no) - AC_MSG_CHECKING(--disable-xsmp-interact argument) - AC_ARG_ENABLE(xsmp-interact, - [ --disable-xsmp-interact Disable XSMP interaction], - , enable_xsmp_interact="yes") - if test "$enable_xsmp_interact" = "yes"; then - AC_MSG_RESULT(no) - AC_DEFINE(USE_XSMP_INTERACT) - else - AC_MSG_RESULT(yes) - fi -else - AC_MSG_RESULT(yes) -fi - -dnl Check for Lua feature. -AC_MSG_CHECKING(--enable-luainterp argument) -AC_ARG_ENABLE(luainterp, - [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], , - [enable_luainterp="no"]) -AC_MSG_RESULT($enable_luainterp) - -if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then - dnl -- find the lua executable - AC_SUBST(vi_cv_path_lua) - - AC_MSG_CHECKING(--with-lua-prefix argument) - AC_ARG_WITH(lua_prefix, - [ --with-lua-prefix=PFX Prefix where Lua is installed.], - with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix), - with_lua_prefix="";AC_MSG_RESULT(no)) - - if test "X$with_lua_prefix" != "X"; then - vi_cv_path_lua_pfx="$with_lua_prefix" - else - AC_MSG_CHECKING(LUA_PREFIX environment var) - if test "X$LUA_PREFIX" != "X"; then - AC_MSG_RESULT("$LUA_PREFIX") - vi_cv_path_lua_pfx="$LUA_PREFIX" - else - AC_MSG_RESULT([not set, default to /usr]) - vi_cv_path_lua_pfx="/usr" - fi - fi - - AC_MSG_CHECKING(--with-luajit) - AC_ARG_WITH(luajit, - [ --with-luajit Link with LuaJIT instead of Lua.], - [vi_cv_with_luajit="$withval"], - [vi_cv_with_luajit="no"]) - AC_MSG_RESULT($vi_cv_with_luajit) - - LUA_INC= - if test "X$vi_cv_path_lua_pfx" != "X"; then - if test "x$vi_cv_with_luajit" != "xno"; then - dnl -- try to find LuaJIT executable - AC_PATH_PROG(vi_cv_path_luajit, luajit) - if test "X$vi_cv_path_luajit" != "X"; then - dnl -- find LuaJIT version - AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit, - [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ]) - AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit, - [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ]) - vi_cv_path_lua="$vi_cv_path_luajit" - vi_cv_version_lua="$vi_cv_version_lua_luajit" - fi - else - dnl -- try to find Lua executable - AC_PATH_PROG(vi_cv_path_plain_lua, lua) - if test "X$vi_cv_path_plain_lua" != "X"; then - dnl -- find Lua version - AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua, - [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ]) - fi - vi_cv_path_lua="$vi_cv_path_plain_lua" - vi_cv_version_lua="$vi_cv_version_plain_lua" - fi - if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then - AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit) - if test -f $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h; then - AC_MSG_RESULT(yes) - LUA_INC=/luajit-$vi_cv_version_luajit - fi - fi - if test "X$LUA_INC" = "X"; then - AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include) - if test -f $vi_cv_path_lua_pfx/include/lua.h; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua) - if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then - AC_MSG_RESULT(yes) - LUA_INC=/lua$vi_cv_version_lua - else - AC_MSG_RESULT(no) - vi_cv_path_lua_pfx= - fi - fi - fi - fi - - if test "X$vi_cv_path_lua_pfx" != "X"; then - if test "x$vi_cv_with_luajit" != "xno"; then - multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` - if test "X$multiarch" != "X"; then - lib_multiarch="lib/${multiarch}" - else - lib_multiarch="lib" - fi - if test "X$vi_cv_version_lua" = "X"; then - LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit" - else - LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua" - fi - else - if test "X$LUA_INC" != "X"; then - dnl Test alternate location using version - LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua" - else - LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua" - fi - fi - if test "$enable_luainterp" = "dynamic"; then - lua_ok="yes" - else - AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane]) - libs_save=$LIBS - LIBS="$LIBS $LUA_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); lua_ok="yes", - AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="") - LIBS=$libs_save - fi - if test "x$lua_ok" = "xyes"; then - LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}" - LUA_SRC="if_lua.c" - LUA_OBJ="objects/if_lua.o" - LUA_PRO="if_lua.pro" - AC_DEFINE(FEAT_LUA) - fi - if test "$enable_luainterp" = "dynamic"; then - if test "x$vi_cv_with_luajit" != "xno"; then - luajit="jit" - fi - if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then - vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll" - else - if test "x$MACOSX" = "xyes"; then - ext="dylib" - indexes="" - else - ext="so" - indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9" - multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` - if test "X$multiarch" != "X"; then - lib_multiarch="lib/${multiarch}" - fi - fi - dnl Determine the sover for the current version, but fallback to - dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found. - AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx) - for subdir in "${lib_multiarch}" lib64 lib; do - if test -z "$subdir"; then - continue - fi - for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \ - ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do - for i in $indexes ""; do - if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then - sover2="$i" - break 3 - fi - done - done - sover="" - done - if test "X$sover" = "X"; then - AC_MSG_RESULT(no) - lua_ok="no" - vi_cv_dll_name_lua="liblua${luajit}.${ext}" - else - AC_MSG_RESULT(yes) - lua_ok="yes" - vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2" - fi - fi - AC_DEFINE(DYNAMIC_LUA) - LUA_LIBS="" - LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS" - fi - if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ - test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ - test "`(uname -m) 2>/dev/null`" = "x86_64"; then - dnl OSX/x64 requires these flags. See http://luajit.org/install.html - LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" - fi - fi - if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then - AC_MSG_ERROR([could not configure lua]) - fi - AC_SUBST(LUA_SRC) - AC_SUBST(LUA_OBJ) - AC_SUBST(LUA_PRO) - AC_SUBST(LUA_LIBS) - AC_SUBST(LUA_CFLAGS) -fi - - -dnl Check for MzScheme feature. -AC_MSG_CHECKING(--enable-mzschemeinterp argument) -AC_ARG_ENABLE(mzschemeinterp, - [ --enable-mzschemeinterp Include MzScheme interpreter.], , - [enable_mzschemeinterp="no"]) -AC_MSG_RESULT($enable_mzschemeinterp) - -if test "$enable_mzschemeinterp" = "yes"; then - dnl -- find the mzscheme executable - AC_SUBST(vi_cv_path_mzscheme) - - AC_MSG_CHECKING(--with-plthome argument) - AC_ARG_WITH(plthome, - [ --with-plthome=PLTHOME Use PLTHOME.], - with_plthome="$withval"; AC_MSG_RESULT($with_plthome), - with_plthome="";AC_MSG_RESULT("no")) - - if test "X$with_plthome" != "X"; then - vi_cv_path_mzscheme_pfx="$with_plthome" - else - AC_MSG_CHECKING(PLTHOME environment var) - if test "X$PLTHOME" != "X"; then - AC_MSG_RESULT("$PLTHOME") - vi_cv_path_mzscheme_pfx="$PLTHOME" - else - AC_MSG_RESULT(not set) - dnl -- try to find MzScheme executable - AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme) - - dnl resolve symbolic link, the executable is often elsewhere and there - dnl are no links for the include files. - if test "X$vi_cv_path_mzscheme" != "X"; then - lsout=`ls -l $vi_cv_path_mzscheme` - if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then - vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` - fi - fi - - if test "X$vi_cv_path_mzscheme" != "X"; then - dnl -- find where MzScheme thinks it was installed - AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx, - dnl different versions of MzScheme differ in command line processing - dnl use universal approach - echo "(display (simplify-path \ - (build-path (call-with-values \ - (lambda () (split-path (find-system-path (quote exec-file)))) \ - (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm - dnl Remove a trailing slash - [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ - sed -e 's+/$++'` ]) - rm -f mzdirs.scm - fi - fi - fi - - SCHEME_INC= - if test "X$vi_cv_path_mzscheme_pfx" != "X"; then - AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include) - if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) - if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then - AC_MSG_RESULT(yes) - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) - if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then - AC_MSG_RESULT(yes) - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) - if test -f /usr/include/plt/scheme.h; then - AC_MSG_RESULT(yes) - SCHEME_INC=/usr/include/plt - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) - if test -f /usr/include/racket/scheme.h; then - AC_MSG_RESULT(yes) - SCHEME_INC=/usr/include/racket - else - AC_MSG_RESULT(no) - vi_cv_path_mzscheme_pfx= - fi - fi - fi - fi - fi - fi - - if test "X$vi_cv_path_mzscheme_pfx" != "X"; then - if test "x$MACOSX" = "xyes"; then - MZSCHEME_LIBS="-framework Racket" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then - MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a" - else - dnl Using shared objects - if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m" - MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" - elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc" - else - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" - fi - if test "$GCC" = yes; then - dnl Make Vim remember the path to the library. For when it's not in - dnl $LD_LIBRARY_PATH. - MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib" - elif test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib" - fi - fi - - AC_MSG_CHECKING(for racket collects directory) - if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ - else - if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ - else - if test -d $vi_cv_path_mzscheme_pfx/share/racket/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ - else - if test -d $vi_cv_path_mzscheme_pfx/collects; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ - fi - fi - fi - fi - if test "X$SCHEME_COLLECTS" != "X" ; then - AC_MSG_RESULT(${SCHEME_COLLECTS}) - else - AC_MSG_RESULT(not found) - fi - - AC_MSG_CHECKING(for mzscheme_base.c) - if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then - MZSCHEME_EXTRA="mzscheme_base.c" - MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" - MZSCHEME_MOD="++lib scheme/base" - else - if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then - MZSCHEME_EXTRA="mzscheme_base.c" - MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" - MZSCHEME_MOD="++lib scheme/base" - else - if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then - MZSCHEME_EXTRA="mzscheme_base.c" - MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool" - MZSCHEME_MOD="" - fi - fi - fi - if test "X$MZSCHEME_EXTRA" != "X" ; then - dnl need to generate bytecode for MzScheme base - MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE" - MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" - AC_MSG_RESULT(needed) - else - AC_MSG_RESULT(not needed) - fi - - dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'". - AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"]) - - MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ - -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" - - dnl Test that we can compile a simple program with these CFLAGS and LIBS. - AC_MSG_CHECKING([if compile and link flags for MzScheme are sane]) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" - LIBS="$LIBS $MZSCHEME_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); mzs_ok=yes, - AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - if test $mzs_ok = yes; then - MZSCHEME_SRC="if_mzsch.c" - MZSCHEME_OBJ="objects/if_mzsch.o" - MZSCHEME_PRO="if_mzsch.pro" - AC_DEFINE(FEAT_MZSCHEME) - else - MZSCHEME_CFLAGS= - MZSCHEME_LIBS= - MZSCHEME_EXTRA= - MZSCHEME_MZC= - fi - fi - AC_SUBST(MZSCHEME_SRC) - AC_SUBST(MZSCHEME_OBJ) - AC_SUBST(MZSCHEME_PRO) - AC_SUBST(MZSCHEME_LIBS) - AC_SUBST(MZSCHEME_CFLAGS) - AC_SUBST(MZSCHEME_EXTRA) - AC_SUBST(MZSCHEME_MZC) -fi - - -AC_MSG_CHECKING(--enable-perlinterp argument) -AC_ARG_ENABLE(perlinterp, - [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], , - [enable_perlinterp="no"]) -AC_MSG_RESULT($enable_perlinterp) -if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then - AC_SUBST(vi_cv_path_perl) - AC_PATH_PROG(vi_cv_path_perl, perl) - if test "X$vi_cv_path_perl" != "X"; then - AC_MSG_CHECKING(Perl version) - if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then - eval `$vi_cv_path_perl -V:usethreads` - eval `$vi_cv_path_perl -V:libperl` - if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then - badthreads=no - else - if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then - eval `$vi_cv_path_perl -V:use5005threads` - if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then - badthreads=no - else - badthreads=yes - AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<) - fi - else - badthreads=yes - AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<) - fi - fi - if test $badthreads = no; then - AC_MSG_RESULT(OK) - eval `$vi_cv_path_perl -V:shrpenv` - if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04 - shrpenv="" - fi - vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` - vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'` - AC_SUBST(vi_cv_perllib) - AC_SUBST(vi_cv_perlsitelib) - dnl Remove "-fno-something", it breaks using cproto. - perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ - -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'` - dnl Remove "-lc", it breaks on FreeBSD when using "-pthread". - perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ - sed -e '/Warning/d' -e '/Note (probably harmless)/d' \ - -e 's/-bE:perl.exp//' -e 's/-lc //'` - dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH - dnl a test in configure may fail because of that. - perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ - -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` - - if test "x$MACOSX" = "xyes"; then - dnl Perl on Mac OS X 10.5 and later adds "-arch" flags but these - dnl should only be included if requested by passing --with-archs - dnl to configure, so strip these flags first (if present) - perllibs=`echo "$perllibs" | sed -e 's/-arch[[^-]]*//g'` - perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[[^-]]*//g'` - fi - - dnl check that compiling a simple program still works with the flags - dnl added for Perl. - AC_MSG_CHECKING([if compile and link flags for Perl are sane]) - cflags_save=$CFLAGS - libs_save=$LIBS - ldflags_save=$LDFLAGS - CFLAGS="$CFLAGS $perlcppflags" - LIBS="$LIBS $perllibs" - perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'` - LDFLAGS="$perlldflags $LDFLAGS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); perl_ok=yes, - AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - LDFLAGS=$ldflags_save - if test $perl_ok = yes; then - if test "X$perlcppflags" != "X"; then - dnl remove -pipe and -Wxxx, it confuses cproto - PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'` - fi - if test "X$perlldflags" != "X"; then - if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then - LDFLAGS="$perlldflags $LDFLAGS" - fi - fi - PERL_LIBS=$perllibs - PERL_SRC="auto/if_perl.c if_perlsfio.c" - PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o" - PERL_PRO="if_perl.pro if_perlsfio.pro" - AC_DEFINE(FEAT_PERL) - fi - fi - else - AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<) - fi - fi - - if test "x$MACOSX" = "xyes"; then - dnl Mac OS X 10.2 or later - dir=/System/Library/Perl - darwindir=$dir/darwin - if test -d $darwindir; then - PERL=/usr/bin/perl - else - dnl Mac OS X 10.3 - dir=/System/Library/Perl/5.8.1 - darwindir=$dir/darwin-thread-multi-2level - if test -d $darwindir; then - PERL=/usr/bin/perl - fi - fi - if test -n "$PERL"; then - PERL_DIR="$dir" - PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE" - PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a" - PERL_LIBS="-L$darwindir/CORE -lperl" - fi - dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only - dnl be included if requested by passing --with-mac-arch to - dnl configure, so strip these flags first (if present) - PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - fi - if test "$enable_perlinterp" = "dynamic"; then - if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then - AC_DEFINE(DYNAMIC_PERL) - PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS" - fi - fi - - if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then - AC_MSG_ERROR([could not configure perl]) - fi -fi -AC_SUBST(shrpenv) -AC_SUBST(PERL_SRC) -AC_SUBST(PERL_OBJ) -AC_SUBST(PERL_PRO) -AC_SUBST(PERL_CFLAGS) -AC_SUBST(PERL_LIBS) - -AC_MSG_CHECKING(--enable-pythoninterp argument) -AC_ARG_ENABLE(pythoninterp, - [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], , - [enable_pythoninterp="no"]) -AC_MSG_RESULT($enable_pythoninterp) -if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then - dnl -- find the python executable - AC_PATH_PROGS(vi_cv_path_python, python2 python) - if test "X$vi_cv_path_python" != "X"; then - - dnl -- get its version number - AC_CACHE_CHECK(Python version,vi_cv_var_python_version, - [[vi_cv_var_python_version=` - ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'` - ]]) - - dnl -- it must be at least version 2.3 - AC_MSG_CHECKING(Python is 2.3 or better) - if ${vi_cv_path_python} -c \ - "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)" - then - AC_MSG_RESULT(yep) - - dnl -- find where python thinks it was installed - AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx, - [ vi_cv_path_python_pfx=` - ${vi_cv_path_python} -c \ - "import sys; print sys.prefix"` ]) - - dnl -- and where it thinks it runs - AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx, - [ vi_cv_path_python_epfx=` - ${vi_cv_path_python} -c \ - "import sys; print sys.exec_prefix"` ]) - - dnl -- python's internal library path - - AC_CACHE_VAL(vi_cv_path_pythonpath, - [ vi_cv_path_pythonpath=` - unset PYTHONPATH; - ${vi_cv_path_python} -c \ - "import sys, string; print string.join(sys.path,':')"` ]) - - dnl -- where the Python implementation library archives are - - AC_ARG_WITH(python-config-dir, - [ --with-python-config-dir=PATH Python's config directory], - [ vi_cv_path_python_conf="${withval}" ] ) - - AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf, - [ - vi_cv_path_python_conf= - d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"` - if test -d "$d" && test -f "$d/config.c"; then - vi_cv_path_python_conf="$d" - else - for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do - for subdir in lib64 lib share; do - d="${path}/${subdir}/python${vi_cv_var_python_version}/config" - if test -d "$d" && test -f "$d/config.c"; then - vi_cv_path_python_conf="$d" - fi - done - done - fi - ]) - - PYTHON_CONFDIR="${vi_cv_path_python_conf}" - - if test "X$PYTHON_CONFDIR" = "X"; then - AC_MSG_RESULT([can't find it!]) - else - - dnl -- we need to examine Python's config/Makefile too - dnl see what the interpreter is built from - AC_CACHE_VAL(vi_cv_path_python_plibs, - [ - pwd=`pwd` - tmp_mkf="$pwd/config-PyMake$$" - cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" -__: - @echo "python_BASEMODLIBS='$(BASEMODLIBS)'" - @echo "python_LIBS='$(LIBS)'" - @echo "python_SYSLIBS='$(SYSLIBS)'" - @echo "python_LINKFORSHARED='$(LINKFORSHARED)'" - @echo "python_DLLLIBRARY='$(DLLLIBRARY)'" - @echo "python_INSTSONAME='$(INSTSONAME)'" -eof - dnl -- delete the lines from make about Entering/Leaving directory - eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" - rm -f -- "${tmp_mkf}" - if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \ - "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then - vi_cv_path_python_plibs="-framework Python" - else - if test "${vi_cv_var_python_version}" = "1.4"; then - vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a" - else - vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" - fi - vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" - dnl remove -ltermcap, it can conflict with an earlier -lncurses - vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` - fi - ]) - AC_CACHE_VAL(vi_cv_dll_name_python, - [ - if test "X$python_DLLLIBRARY" != "X"; then - vi_cv_dll_name_python="$python_DLLLIBRARY" - else - vi_cv_dll_name_python="$python_INSTSONAME" - fi - ]) - - PYTHON_LIBS="${vi_cv_path_python_plibs}" - if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" - else - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" - fi - PYTHON_SRC="if_python.c" - PYTHON_OBJ="objects/if_python.o" - if test "${vi_cv_var_python_version}" = "1.4"; then - PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" - fi - PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" - - dnl On FreeBSD linking with "-pthread" is required to use threads. - dnl _THREAD_SAFE must be used for compiling then. - dnl The "-pthread" is added to $LIBS, so that the following check for - dnl sigaltstack() will look in libc_r (it's there in libc!). - dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC - dnl will then define target-specific defines, e.g., -D_REENTRANT. - dnl Don't do this for Mac OSX, -pthread will generate a warning. - AC_MSG_CHECKING([if -pthread should be used]) - threadsafe_flag= - thread_lib= - dnl if test "x$MACOSX" != "xyes"; then - if test "`(uname) 2>/dev/null`" != Darwin; then - test "$GCC" = yes && threadsafe_flag="-pthread" - if test "`(uname) 2>/dev/null`" = FreeBSD; then - threadsafe_flag="-D_THREAD_SAFE" - thread_lib="-pthread" - fi - if test "`(uname) 2>/dev/null`" = SunOS; then - threadsafe_flag="-pthreads" - fi - fi - libs_save_old=$LIBS - if test -n "$threadsafe_flag"; then - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $threadsafe_flag" - LIBS="$LIBS $thread_lib" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag", - AC_MSG_RESULT(no); LIBS=$libs_save_old - ) - CFLAGS=$cflags_save - else - AC_MSG_RESULT(no) - fi - - dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely - dnl on any of the search paths set above. The -framework flag does it - dnl all for us. - if test -n "$MACSDK"; then - PYTHON_CFLAGS= - PYTHON_LIBS=-framework Python - PYTHON_CONFDIR= - PYTHON_GETPATH_CFLAGS= - fi - - dnl Check that compiling a simple program still works with the flags - dnl added for Python. - AC_MSG_CHECKING([if compile and link flags for Python are sane]) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $PYTHON_CFLAGS" - LIBS="$LIBS $PYTHON_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); python_ok=yes, - AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - if test $python_ok = yes; then - AC_DEFINE(FEAT_PYTHON) - else - LIBS=$libs_save_old - PYTHON_SRC= - PYTHON_OBJ= - PYTHON_LIBS= - PYTHON_CFLAGS= - fi - fi - else - AC_MSG_RESULT(too old) - fi - fi - - if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then - AC_MSG_ERROR([could not configure python]) - fi -fi - -AC_SUBST(PYTHON_CONFDIR) -AC_SUBST(PYTHON_LIBS) -AC_SUBST(PYTHON_GETPATH_CFLAGS) -AC_SUBST(PYTHON_CFLAGS) -AC_SUBST(PYTHON_SRC) -AC_SUBST(PYTHON_OBJ) - - -AC_MSG_CHECKING(--enable-python3interp argument) -AC_ARG_ENABLE(python3interp, - [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], , - [enable_python3interp="no"]) -AC_MSG_RESULT($enable_python3interp) -if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then - dnl -- find the python3 executable - AC_PATH_PROGS(vi_cv_path_python3, python3 python) - if test "X$vi_cv_path_python3" != "X"; then - - dnl -- get its version number - AC_CACHE_CHECK(Python version,vi_cv_var_python3_version, - [[vi_cv_var_python3_version=` - ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'` - ]]) - - dnl -- it must be at least version 3 - AC_MSG_CHECKING(Python is 3.0 or better) - if ${vi_cv_path_python3} -c \ - "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)" - then - AC_MSG_RESULT(yep) - - dnl -- get abiflags for python 3.2 or higher (PEP 3149) - AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags, - [ - vi_cv_var_python3_abiflags= - if ${vi_cv_path_python3} -c \ - "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)" - then - vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \ - "import sys; print(sys.abiflags)"` - fi ]) - - dnl -- find where python3 thinks it was installed - AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx, - [ vi_cv_path_python3_pfx=` - ${vi_cv_path_python3} -c \ - "import sys; print(sys.prefix)"` ]) - - dnl -- and where it thinks it runs - AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx, - [ vi_cv_path_python3_epfx=` - ${vi_cv_path_python3} -c \ - "import sys; print(sys.exec_prefix)"` ]) - - dnl -- python3's internal library path - - AC_CACHE_VAL(vi_cv_path_python3path, - [ vi_cv_path_python3path=` - unset PYTHONPATH; - ${vi_cv_path_python3} -c \ - "import sys, string; print(':'.join(sys.path))"` ]) - - dnl -- where the Python implementation library archives are - - AC_ARG_WITH(python3-config-dir, - [ --with-python3-config-dir=PATH Python's config directory], - [ vi_cv_path_python3_conf="${withval}" ] ) - - AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf, - [ - vi_cv_path_python3_conf= - config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" - d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"` - if test -d "$d" && test -f "$d/config.c"; then - vi_cv_path_python3_conf="$d" - else - for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do - for subdir in lib64 lib share; do - d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}" - if test -d "$d" && test -f "$d/config.c"; then - vi_cv_path_python3_conf="$d" - fi - done - done - fi - ]) - - PYTHON3_CONFDIR="${vi_cv_path_python3_conf}" - - if test "X$PYTHON3_CONFDIR" = "X"; then - AC_MSG_RESULT([can't find it!]) - else - - dnl -- we need to examine Python's config/Makefile too - dnl see what the interpreter is built from - AC_CACHE_VAL(vi_cv_path_python3_plibs, - [ - pwd=`pwd` - tmp_mkf="$pwd/config-PyMake$$" - cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" -__: - @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'" - @echo "python3_LIBS='$(LIBS)'" - @echo "python3_SYSLIBS='$(SYSLIBS)'" - @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'" - @echo "python3_INSTSONAME='$(INSTSONAME)'" -eof - dnl -- delete the lines from make about Entering/Leaving directory - eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" - rm -f -- "${tmp_mkf}" - vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" - vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}" - dnl remove -ltermcap, it can conflict with an earlier -lncurses - vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//` - vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//` - ]) - AC_CACHE_VAL(vi_cv_dll_name_python3, - [ - if test "X$python3_DLLLIBRARY" != "X"; then - vi_cv_dll_name_python3="$python3_DLLLIBRARY" - else - vi_cv_dll_name_python3="$python3_INSTSONAME" - fi - ]) - - PYTHON3_LIBS="${vi_cv_path_python3_plibs}" - if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" - else - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" - fi - PYTHON3_SRC="if_python3.c" - PYTHON3_OBJ="objects/if_python3.o" - - dnl On FreeBSD linking with "-pthread" is required to use threads. - dnl _THREAD_SAFE must be used for compiling then. - dnl The "-pthread" is added to $LIBS, so that the following check for - dnl sigaltstack() will look in libc_r (it's there in libc!). - dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC - dnl will then define target-specific defines, e.g., -D_REENTRANT. - dnl Don't do this for Mac OSX, -pthread will generate a warning. - AC_MSG_CHECKING([if -pthread should be used]) - threadsafe_flag= - thread_lib= - dnl if test "x$MACOSX" != "xyes"; then - if test "`(uname) 2>/dev/null`" != Darwin; then - test "$GCC" = yes && threadsafe_flag="-pthread" - if test "`(uname) 2>/dev/null`" = FreeBSD; then - threadsafe_flag="-D_THREAD_SAFE" - thread_lib="-pthread" - fi - if test "`(uname) 2>/dev/null`" = SunOS; then - threadsafe_flag="-pthreads" - fi - fi - libs_save_old=$LIBS - if test -n "$threadsafe_flag"; then - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $threadsafe_flag" - LIBS="$LIBS $thread_lib" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag", - AC_MSG_RESULT(no); LIBS=$libs_save_old - ) - CFLAGS=$cflags_save - else - AC_MSG_RESULT(no) - fi - - dnl check that compiling a simple program still works with the flags - dnl added for Python. - AC_MSG_CHECKING([if compile and link flags for Python 3 are sane]) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $PYTHON3_CFLAGS" - LIBS="$LIBS $PYTHON3_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); python3_ok=yes, - AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - if test "$python3_ok" = yes; then - AC_DEFINE(FEAT_PYTHON3) - else - LIBS=$libs_save_old - PYTHON3_SRC= - PYTHON3_OBJ= - PYTHON3_LIBS= - PYTHON3_CFLAGS= - fi - fi - else - AC_MSG_RESULT(too old) - fi - fi - if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then - AC_MSG_ERROR([could not configure python3]) - fi -fi - -AC_SUBST(PYTHON3_CONFDIR) -AC_SUBST(PYTHON3_LIBS) -AC_SUBST(PYTHON3_CFLAGS) -AC_SUBST(PYTHON3_SRC) -AC_SUBST(PYTHON3_OBJ) - -dnl if python2.x and python3.x are enabled one can only link in code -dnl with dlopen(), dlsym(), dlclose() -if test "$python_ok" = yes && test "$python3_ok" = yes; then - AC_DEFINE(DYNAMIC_PYTHON) - AC_DEFINE(DYNAMIC_PYTHON3) - AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python) - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $PYTHON_CFLAGS" - ldflags_save=$LDFLAGS - dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) - LDFLAGS="-ldl $LDFLAGS" - AC_RUN_IFELSE([AC_LANG_SOURCE([ - #include <dlfcn.h> - /* If this program fails, then RTLD_GLOBAL is needed. - * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. - * Only the first python version used will be switched on. - */ - - int no_rtl_global_needed_for(char *python_instsoname, char *prefix) - { - int needed = 0; - void* pylib = dlopen(python_instsoname, RTLD_LAZY); - if (pylib != 0) - { - void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); - void (*init)(void) = dlsym(pylib, "Py_Initialize"); - int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); - void (*final)(void) = dlsym(pylib, "Py_Finalize"); - (*pfx)(prefix); - (*init)(); - needed = (*simple)("import termios") == -1; - (*final)(); - dlclose(pylib); - } - return !needed; - } - - int main(int argc, char** argv) - { - int not_needed = 0; - if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}")) - not_needed = 1; - return !not_needed; - }])], - [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) - - CFLAGS=$cflags_save - LDFLAGS=$ldflags_save - - AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3) - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $PYTHON3_CFLAGS" - ldflags_save=$LDFLAGS - dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) - LDFLAGS="-ldl $LDFLAGS" - AC_RUN_IFELSE([AC_LANG_SOURCE([ - #include <dlfcn.h> - #include <wchar.h> - /* If this program fails, then RTLD_GLOBAL is needed. - * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. - * Only the first python version used will be switched on. - */ - - int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) - { - int needed = 0; - void* pylib = dlopen(python_instsoname, RTLD_LAZY); - if (pylib != 0) - { - void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); - void (*init)(void) = dlsym(pylib, "Py_Initialize"); - int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); - void (*final)(void) = dlsym(pylib, "Py_Finalize"); - (*pfx)(prefix); - (*init)(); - needed = (*simple)("import termios") == -1; - (*final)(); - dlclose(pylib); - } - return !needed; - } - - int main(int argc, char** argv) - { - int not_needed = 0; - if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}")) - not_needed = 1; - return !not_needed; - }])], - [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) - - CFLAGS=$cflags_save - LDFLAGS=$ldflags_save - - PYTHON_SRC="if_python.c" - PYTHON_OBJ="objects/if_python.o" - PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" - PYTHON_LIBS= - PYTHON3_SRC="if_python3.c" - PYTHON3_OBJ="objects/if_python3.o" - PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" - PYTHON3_LIBS= -elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then - AC_DEFINE(DYNAMIC_PYTHON) - PYTHON_SRC="if_python.c" - PYTHON_OBJ="objects/if_python.o" - PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" - PYTHON_LIBS= -elif test "$python_ok" = yes; then - dnl Check that adding -fPIE works. It may be needed when using a static - dnl Python library. - AC_MSG_CHECKING([if -fPIE can be added for Python]) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE" - LIBS="$LIBS $PYTHON_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); fpie_ok=yes, - AC_MSG_RESULT(no); fpie_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - if test $fpie_ok = yes; then - PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE" - fi -elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then - AC_DEFINE(DYNAMIC_PYTHON3) - PYTHON3_SRC="if_python3.c" - PYTHON3_OBJ="objects/if_python3.o" - PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" - PYTHON3_LIBS= -elif test "$python3_ok" = yes; then - dnl Check that adding -fPIE works. It may be needed when using a static - dnl Python library. - AC_MSG_CHECKING([if -fPIE can be added for Python3]) - cflags_save=$CFLAGS - libs_save=$LIBS - CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE" - LIBS="$LIBS $PYTHON3_LIBS" - AC_TRY_LINK(,[ ], - AC_MSG_RESULT(yes); fpie_ok=yes, - AC_MSG_RESULT(no); fpie_ok=no) - CFLAGS=$cflags_save - LIBS=$libs_save - if test $fpie_ok = yes; then - PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE" - fi -fi - -AC_MSG_CHECKING(--enable-tclinterp argument) -AC_ARG_ENABLE(tclinterp, - [ --enable-tclinterp Include Tcl interpreter.], , - [enable_tclinterp="no"]) -AC_MSG_RESULT($enable_tclinterp) - -if test "$enable_tclinterp" = "yes"; then - - dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420] - AC_MSG_CHECKING(--with-tclsh argument) - AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)], - tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name), - tclsh_name="tclsh8.5"; AC_MSG_RESULT(no)) - AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) - AC_SUBST(vi_cv_path_tcl) - - dnl when no specific version specified, also try 8.4, 8.2 and 8.0 - if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then - tclsh_name="tclsh8.4" - AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) - fi - if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then - tclsh_name="tclsh8.2" - AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) - fi - if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then - tclsh_name="tclsh8.0" - AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) - fi - dnl still didn't find it, try without version number - if test "X$vi_cv_path_tcl" = "X"; then - tclsh_name="tclsh" - AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) - fi - if test "X$vi_cv_path_tcl" != "X"; then - AC_MSG_CHECKING(Tcl version) - if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then - tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -` - AC_MSG_RESULT($tclver - OK); - tclloc=`echo 'set l [[info library]];set i [[string last lib $l]];incr i -2;puts [[string range $l 0 $i]]' | $vi_cv_path_tcl -` - - AC_MSG_CHECKING(for location of Tcl include) - if test "x$MACOSX" != "xyes"; then - tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver" - else - dnl For Mac OS X 10.3, use the OS-provided framework location - tclinc="/System/Library/Frameworks/Tcl.framework/Headers" - fi - TCL_INC= - for try in $tclinc; do - if test -f "$try/tcl.h"; then - AC_MSG_RESULT($try/tcl.h) - TCL_INC=$try - break - fi - done - if test -z "$TCL_INC"; then - AC_MSG_RESULT(<not found>) - SKIP_TCL=YES - fi - if test -z "$SKIP_TCL"; then - AC_MSG_CHECKING(for location of tclConfig.sh script) - if test "x$MACOSX" != "xyes"; then - tclcnf=`echo $tclinc | sed s/include/lib/g` - tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`" - else - dnl For Mac OS X 10.3, use the OS-provided framework location - tclcnf="/System/Library/Frameworks/Tcl.framework" - fi - for try in $tclcnf; do - if test -f $try/tclConfig.sh; then - AC_MSG_RESULT($try/tclConfig.sh) - . $try/tclConfig.sh - dnl use eval, because tcl 8.2 includes ${TCL_DBGX} - TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"` - dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the - dnl "-D_ABC" items. Watch out for -DFOO=long\ long. - TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'` - break - fi - done - if test -z "$TCL_LIBS"; then - AC_MSG_RESULT(<not found>) - AC_MSG_CHECKING(for Tcl library by myself) - tcllib=`echo $tclinc | sed s/include/lib/g` - tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`" - for ext in .so .a ; do - for ver in "" $tclver ; do - for try in $tcllib ; do - trylib=tcl$ver$ext - if test -f $try/lib$trylib ; then - AC_MSG_RESULT($try/lib$trylib) - TCL_LIBS="-L$try -ltcl$ver -ldl -lm" - if test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - TCL_LIBS="$TCL_LIBS -R $try" - fi - break 3 - fi - done - done - done - if test -z "$TCL_LIBS"; then - AC_MSG_RESULT(<not found>) - SKIP_TCL=YES - fi - fi - if test -z "$SKIP_TCL"; then - AC_DEFINE(FEAT_TCL) - TCL_SRC=if_tcl.c - TCL_OBJ=objects/if_tcl.o - TCL_PRO=if_tcl.pro - TCL_CFLAGS="-I$TCL_INC $TCL_DEFS" - fi - fi - else - AC_MSG_RESULT(too old; need Tcl version 8.0 or later) - fi - fi - if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then - AC_MSG_ERROR([could not configure Tcl]) - fi -fi -AC_SUBST(TCL_SRC) -AC_SUBST(TCL_OBJ) -AC_SUBST(TCL_PRO) -AC_SUBST(TCL_CFLAGS) -AC_SUBST(TCL_LIBS) - -AC_MSG_CHECKING(--enable-rubyinterp argument) -AC_ARG_ENABLE(rubyinterp, - [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], , - [enable_rubyinterp="no"]) -AC_MSG_RESULT($enable_rubyinterp) -if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then - AC_MSG_CHECKING(--with-ruby-command argument) - AC_SUBST(vi_cv_path_ruby) - AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)], - RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD), - RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD)) - AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD) - if test "X$vi_cv_path_ruby" != "X"; then - AC_MSG_CHECKING(Ruby version) - if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then - AC_MSG_RESULT(OK) - AC_MSG_CHECKING(Ruby rbconfig) - ruby_rbconfig="RbConfig" - if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then - ruby_rbconfig="Config" - fi - AC_MSG_RESULT($ruby_rbconfig) - AC_MSG_CHECKING(Ruby header files) - rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null` - if test "X$rubyhdrdir" != "X"; then - AC_MSG_RESULT($rubyhdrdir) - RUBY_CFLAGS="-I$rubyhdrdir" - rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"` - if test -d "$rubyarchdir"; then - RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" - fi - rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"` - if test "X$rubyversion" = "X"; then - rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"` - fi - RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion" - rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"` - if test "X$rubylibs" != "X"; then - RUBY_LIBS="$rubylibs" - fi - librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"` - librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"` - rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"` - if test -f "$rubylibdir/$librubya"; then - librubyarg="$librubyarg" - RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" - elif test -d "/System/Library/Frameworks/Ruby.framework"; then - dnl On Mac OS X it is safer to just use the -framework flag - RUBY_LIBS="-framework Ruby" - dnl Don't include the -I flag when -framework is set - RUBY_CFLAGS="-DRUBY_VERSION=$rubyversion" - librubyarg= - fi - - if test "X$librubyarg" != "X"; then - RUBY_LIBS="$librubyarg $RUBY_LIBS" - fi - rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"` - if test "X$rubyldflags" != "X"; then - dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only - dnl be included if requested by passing --with-mac-arch to - dnl configure, so strip these flags first (if present) - rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - if test "X$rubyldflags" != "X"; then - if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then - LDFLAGS="$rubyldflags $LDFLAGS" - fi - fi - fi - if test "X$rubyldflags" != "X"; then - LDFLAGS="$rubyldflags $LDFLAGS" - fi - RUBY_SRC="if_ruby.c" - RUBY_OBJ="objects/if_ruby.o" - RUBY_PRO="if_ruby.pro" - - AC_DEFINE(FEAT_RUBY) - if test "$enable_rubyinterp" = "dynamic"; then - libruby=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"` - AC_DEFINE(DYNAMIC_RUBY) - RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" - RUBY_LIBS= - fi - else - AC_MSG_RESULT(not found; disabling Ruby) - fi - else - AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later) - fi - fi - - if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then - AC_MSG_ERROR([could not configure Ruby]) - fi -fi -AC_SUBST(RUBY_SRC) -AC_SUBST(RUBY_OBJ) -AC_SUBST(RUBY_PRO) -AC_SUBST(RUBY_CFLAGS) -AC_SUBST(RUBY_LIBS) - -AC_MSG_CHECKING(--enable-cscope argument) -AC_ARG_ENABLE(cscope, - [ --enable-cscope Include cscope interface.], , - [enable_cscope="no"]) -AC_MSG_RESULT($enable_cscope) -if test "$enable_cscope" = "yes"; then - AC_DEFINE(FEAT_CSCOPE) -fi - -AC_MSG_CHECKING(--enable-workshop argument) -AC_ARG_ENABLE(workshop, - [ --enable-workshop Include Sun Visual Workshop support.], , - [enable_workshop="no"]) -AC_MSG_RESULT($enable_workshop) -if test "$enable_workshop" = "yes"; then - AC_DEFINE(FEAT_SUN_WORKSHOP) - WORKSHOP_SRC="workshop.c integration.c" - AC_SUBST(WORKSHOP_SRC) - WORKSHOP_OBJ="objects/workshop.o objects/integration.o" - AC_SUBST(WORKSHOP_OBJ) - if test "${enable_gui-xxx}" = xxx; then - enable_gui=motif - fi -fi - -AC_MSG_CHECKING(--disable-netbeans argument) -AC_ARG_ENABLE(netbeans, - [ --disable-netbeans Disable NetBeans integration support.], - , [enable_netbeans="yes"]) -if test "$enable_netbeans" = "yes"; then - AC_MSG_RESULT(no) - dnl On Solaris we need the socket and nsl library. - AC_CHECK_LIB(socket, socket) - AC_CHECK_LIB(nsl, gethostbyname) - AC_MSG_CHECKING(whether compiling netbeans integration is possible) - AC_TRY_LINK([ -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <fcntl.h> -#include <netdb.h> -#include <netinet/in.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> - /* Check bitfields */ - struct nbbuf { - unsigned int initDone:1; - ushort signmaplen; - }; - ], [ - /* Check creating a socket. */ - struct sockaddr_in server; - (void)socket(AF_INET, SOCK_STREAM, 0); - (void)htons(100); - (void)gethostbyname("microsoft.com"); - if (errno == ECONNREFUSED) - (void)connect(1, (struct sockaddr *)&server, sizeof(server)); - ], - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); enable_netbeans="no") -else - AC_MSG_RESULT(yes) -fi -if test "$enable_netbeans" = "yes"; then - AC_DEFINE(FEAT_NETBEANS_INTG) - NETBEANS_SRC="netbeans.c" - AC_SUBST(NETBEANS_SRC) - NETBEANS_OBJ="objects/netbeans.o" - AC_SUBST(NETBEANS_OBJ) -fi - -AC_MSG_CHECKING(--enable-sniff argument) -AC_ARG_ENABLE(sniff, - [ --enable-sniff Include Sniff interface.], , - [enable_sniff="no"]) -AC_MSG_RESULT($enable_sniff) -if test "$enable_sniff" = "yes"; then - AC_DEFINE(FEAT_SNIFF) - SNIFF_SRC="if_sniff.c" - AC_SUBST(SNIFF_SRC) - SNIFF_OBJ="objects/if_sniff.o" - AC_SUBST(SNIFF_OBJ) -fi - -AC_MSG_CHECKING(--enable-multibyte argument) -AC_ARG_ENABLE(multibyte, - [ --enable-multibyte Include multibyte editing support.], , - [enable_multibyte="no"]) -AC_MSG_RESULT($enable_multibyte) -if test "$enable_multibyte" = "yes"; then - AC_DEFINE(FEAT_MBYTE) -fi - -AC_MSG_CHECKING(--enable-hangulinput argument) -AC_ARG_ENABLE(hangulinput, - [ --enable-hangulinput Include Hangul input support.], , - [enable_hangulinput="no"]) -AC_MSG_RESULT($enable_hangulinput) - -AC_MSG_CHECKING(--enable-xim argument) -AC_ARG_ENABLE(xim, - [ --enable-xim Include XIM input support.], - AC_MSG_RESULT($enable_xim), - [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)]) - -AC_MSG_CHECKING(--enable-fontset argument) -AC_ARG_ENABLE(fontset, - [ --enable-fontset Include X fontset output support.], , - [enable_fontset="no"]) -AC_MSG_RESULT($enable_fontset) -dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI - -test -z "$with_x" && with_x=yes -test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes -if test "$with_x" = no; then - AC_MSG_RESULT(defaulting to: don't HAVE_X11) -else - dnl Do this check early, so that its failure can override user requests. - - AC_PATH_PROG(xmkmfpath, xmkmf) - - AC_PATH_XTRA - - dnl On z/OS Unix the X libraries are DLLs. To use them the code must - dnl be compiled with a special option. - dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS. - if test "$zOSUnix" = "yes"; then - CFLAGS="$CFLAGS -W c,dll" - LDFLAGS="$LDFLAGS -W l,dll" - X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" - fi - - dnl On my HPUX system the X include dir is found, but the lib dir not. - dnl This is a desparate try to fix this. - - if test -d "$x_includes" && test ! -d "$x_libraries"; then - x_libraries=`echo "$x_includes" | sed s/include/lib/` - AC_MSG_RESULT(Corrected X libraries to $x_libraries) - X_LIBS="$X_LIBS -L$x_libraries" - if test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - X_LIBS="$X_LIBS -R $x_libraries" - fi - fi - - if test -d "$x_libraries" && test ! -d "$x_includes"; then - x_includes=`echo "$x_libraries" | sed s/lib/include/` - AC_MSG_RESULT(Corrected X includes to $x_includes) - X_CFLAGS="$X_CFLAGS -I$x_includes" - fi - - dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed. - X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`" - dnl Remove "-L/usr/lib " from X_LIBS, should not be needed. - X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`" - dnl Same for "-R/usr/lib ". - X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`" - - - dnl Check if the X11 header files are correctly installed. On some systems - dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h - dnl is missing. - AC_MSG_CHECKING(if X11 header files can be found) - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $X_CFLAGS" - AC_TRY_COMPILE([#include <X11/Xlib.h> -#include <X11/Intrinsic.h>], , - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); no_x=yes) - CFLAGS=$cflags_save - - if test "${no_x-no}" = yes; then - with_x=no - else - AC_DEFINE(HAVE_X11) - X_LIB="-lXt -lX11"; - AC_SUBST(X_LIB) - - ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$x_libraries $LDFLAGS" - - dnl Check for -lXdmcp (needed on SunOS 4.1.4) - dnl For HP-UX 10.20 it must be before -lSM -lICE - AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],, - [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp]) - - dnl Some systems need -lnsl -lsocket when testing for ICE. - dnl The check above doesn't do this, try here (again). Also needed to get - dnl them after Xdmcp. link.sh will remove them when not needed. - dnl Check for other function than above to avoid the cached value - AC_CHECK_LIB(ICE, IceOpenConnection, - [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS]) - - dnl Check for -lXpm (needed for some versions of Motif) - LDFLAGS="$X_LIBS $ac_save_LDFLAGS" - AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],, - [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS]) - - dnl Check that the X11 header files don't use implicit declarations - AC_MSG_CHECKING(if X11 header files implicitly declare return values) - cflags_save=$CFLAGS - dnl -Werror is GCC only, others like Solaris Studio might not like it - if test "$GCC" = yes; then - CFLAGS="$CFLAGS $X_CFLAGS -Werror" - else - CFLAGS="$CFLAGS $X_CFLAGS" - fi - AC_TRY_COMPILE([#include <X11/Xlib.h>], , - AC_MSG_RESULT(no), - CFLAGS="$CFLAGS -Wno-implicit-int" - AC_TRY_COMPILE([#include <X11/Xlib.h>], , - AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int", - AC_MSG_RESULT(test failed) - ) - ) - CFLAGS=$cflags_save - - LDFLAGS="$ac_save_LDFLAGS" - - AC_MSG_CHECKING(size of wchar_t is 2 bytes) - AC_CACHE_VAL(ac_cv_small_wchar_t, - [AC_TRY_RUN([ -#include <X11/Xlib.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif - main() - { - if (sizeof(wchar_t) <= 2) - exit(1); - exit(0); - }], - ac_cv_small_wchar_t="no", - ac_cv_small_wchar_t="yes", - AC_MSG_ERROR(failed to compile test program))]) - AC_MSG_RESULT($ac_cv_small_wchar_t) - if test "x$ac_cv_small_wchar_t" = "xyes" ; then - AC_DEFINE(SMALL_WCHAR_T) - fi - - fi -fi - -test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no - -AC_MSG_CHECKING(--enable-gui argument) -AC_ARG_ENABLE(gui, - [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon/macvim]], , enable_gui="auto") - -dnl Canonicalize the --enable-gui= argument so that it can be easily compared. -dnl Do not use character classes for portability with old tools. -enable_gui_canon=`echo "_$enable_gui" | \ - sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - -dnl Skip everything by default. -SKIP_GTK2=YES -SKIP_GNOME=YES -SKIP_MOTIF=YES -SKIP_ATHENA=YES -SKIP_NEXTAW=YES -SKIP_PHOTON=YES -SKIP_CARBON=YES -SKIP_MACVIM=YES -GUITYPE=NONE - -if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then - SKIP_PHOTON= - case "$enable_gui_canon" in - no) AC_MSG_RESULT(no GUI support) - SKIP_PHOTON=YES ;; - yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; - auto) AC_MSG_RESULT(auto - automatic GUI support) ;; - photon) AC_MSG_RESULT(Photon GUI support) ;; - *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) - SKIP_PHOTON=YES ;; - esac - -elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then - SKIP_CARBON= - SKIP_MACVIM= - case "$enable_gui_canon" in - no) AC_MSG_RESULT(no GUI support) - SKIP_CARBON=YES - SKIP_MACVIM=YES ;; - yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) - SKIP_CARBON=YES ;; - carbon) AC_MSG_RESULT(Carbon GUI support) - SKIP_MACVIM=YES ;; - macvim) AC_MSG_RESULT(MacVim GUI support) - SKIP_CARBON=YES ;; - *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) - SKIP_CARBON=YES - SKIP_MACVIM=YES ;; - esac - -else - - case "$enable_gui_canon" in - no|none) AC_MSG_RESULT(no GUI support) ;; - yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) - SKIP_GTK2= - SKIP_GNOME= - SKIP_MOTIF= - SKIP_ATHENA= - SKIP_NEXTAW= - SKIP_MACVIM= - SKIP_CARBON=;; - gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support) - SKIP_GTK2=;; - gnome2) AC_MSG_RESULT(GNOME 2.x GUI support) - SKIP_GNOME= - SKIP_GTK2=;; - motif) AC_MSG_RESULT(Motif GUI support) - SKIP_MOTIF=;; - athena) AC_MSG_RESULT(Athena GUI support) - SKIP_ATHENA=;; - nextaw) AC_MSG_RESULT(neXtaw GUI support) - SKIP_NEXTAW=;; - *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;; - esac - -fi - -if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \ - -a "$enable_gui_canon" != "gnome2"; then - AC_MSG_CHECKING(whether or not to look for GTK+ 2) - AC_ARG_ENABLE(gtk2-check, - [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]], - , enable_gtk2_check="yes") - AC_MSG_RESULT($enable_gtk2_check) - if test "x$enable_gtk2_check" = "xno"; then - SKIP_GTK2=YES - SKIP_GNOME=YES - fi -fi - -if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then - AC_MSG_CHECKING(whether or not to look for GNOME) - AC_ARG_ENABLE(gnome-check, - [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]], - , enable_gnome_check="no") - AC_MSG_RESULT($enable_gnome_check) - if test "x$enable_gnome_check" = "xno"; then - SKIP_GNOME=YES - fi -fi - -if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then - AC_MSG_CHECKING(whether or not to look for Motif) - AC_ARG_ENABLE(motif-check, - [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]], - , enable_motif_check="yes") - AC_MSG_RESULT($enable_motif_check) - if test "x$enable_motif_check" = "xno"; then - SKIP_MOTIF=YES - fi -fi - -if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then - AC_MSG_CHECKING(whether or not to look for Athena) - AC_ARG_ENABLE(athena-check, - [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]], - , enable_athena_check="yes") - AC_MSG_RESULT($enable_athena_check) - if test "x$enable_athena_check" = "xno"; then - SKIP_ATHENA=YES - fi -fi - -if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then - AC_MSG_CHECKING(whether or not to look for neXtaw) - AC_ARG_ENABLE(nextaw-check, - [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]], - , enable_nextaw_check="yes") - AC_MSG_RESULT($enable_nextaw_check); - if test "x$enable_nextaw_check" = "xno"; then - SKIP_NEXTAW=YES - fi -fi - -if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then - AC_MSG_CHECKING(whether or not to look for Carbon) - AC_ARG_ENABLE(carbon-check, - [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]], - , enable_carbon_check="yes") - AC_MSG_RESULT($enable_carbon_check); - if test "x$enable_carbon_check" = "xno"; then - SKIP_CARBON=YES - fi -fi - -if test "x$SKIP_MACVIM" != "xYES" -a "$enable_gui_canon" != "macvim"; then - AC_MSG_CHECKING(whether or not to look for MacVim) - AC_ARG_ENABLE(macvim-check, - [ --enable-macvim-check If auto-select GUI, check for MacVim [default=yes]], - , enable_macvim_check="yes") - AC_MSG_RESULT($enable_macvim_check); - if test "x$enable_macvim_check" = "xno"; then - SKIP_MACVIM=YES - fi -fi - -if test "x$MACOSX" = "xyes"; then - dnl Default install directory is not /usr/local - if test x$prefix = xNONE; then - prefix=/Applications - fi - - if test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then - AC_MSG_CHECKING(for MacVim GUI) - dnl already did the check, just give the message - AC_MSG_RESULT(yes); - GUITYPE=MACVIMGUI - dnl Sorry for the hard coded default - datadir='${prefix}/MacVim.app/Contents/Resources' - elif test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then - AC_MSG_CHECKING(for Carbon GUI) - dnl already did the check, just give the message - AC_MSG_RESULT(yes); - GUITYPE=CARBONGUI - dnl Sorry for the hard coded default - datadir='${prefix}/Vim.app/Contents/Resources' - - CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon" - fi - - if test "$VIMNAME" = "vim"; then - VIMNAME=Vim - fi - - dnl skip everything else - SKIP_GTK2=YES; - SKIP_GNOME=YES; - SKIP_MOTIF=YES; - SKIP_ATHENA=YES; - SKIP_NEXTAW=YES; - SKIP_PHOTON=YES; -fi - -dnl define an autoconf function to check for a specified version of GTK, and -dnl try to compile/link a GTK program. -dnl -dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS -dnl -AC_DEFUN(AM_PATH_GTK, -[ - if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then - { - min_gtk_version=ifelse([$1], ,2.2.0,$1) - AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) - no_gtk="" - if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ - && $PKG_CONFIG --exists gtk+-2.0; then - { - dnl We should be using PKG_CHECK_MODULES() instead of this hack. - dnl But I guess the dependency on pkgconfig.m4 is not wanted or - dnl something like that. - GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0` - GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0` - GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0` - gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` - gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` - gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` - } - else - no_gtk=yes - fi - - if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then - { - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" - - dnl - dnl Now check if the installed GTK is sufficiently new. - dnl - rm -f conf.gtktest - AC_TRY_RUN([ -#include <gtk/gtk.h> -#include <stdio.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif - -int -main () -{ -int major, minor, micro; -char *tmp_version; - -system ("touch conf.gtktest"); - -/* HP/UX 9 (%@#!) writes to sscanf strings */ -tmp_version = g_strdup("$min_gtk_version"); -if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtk_version"); - exit(1); - } - -if ((gtk_major_version > major) || - ((gtk_major_version == major) && (gtk_minor_version > minor)) || - ((gtk_major_version == major) && (gtk_minor_version == minor) && - (gtk_micro_version >= micro))) -{ - return 0; -} -return 1; -} -],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - } - fi - if test "x$no_gtk" = x ; then - if test "x$enable_gtktest" = "xyes"; then - AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) - else - AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) - fi - ifelse([$2], , :, [$2]) - else - { - AC_MSG_RESULT(no) - GTK_CFLAGS="" - GTK_LIBS="" - ifelse([$3], , :, [$3]) - } - fi - } - else - GTK_CFLAGS="" - GTK_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - rm -f conf.gtktest -]) - -dnl --------------------------------------------------------------------------- -dnl gnome -dnl --------------------------------------------------------------------------- -AC_DEFUN([GNOME_INIT_HOOK], -[ - AC_SUBST(GNOME_LIBS) - AC_SUBST(GNOME_LIBDIR) - AC_SUBST(GNOME_INCLUDEDIR) - - AC_ARG_WITH(gnome-includes, - [ --with-gnome-includes=DIR Specify location of GNOME headers], - [CFLAGS="$CFLAGS -I$withval"] - ) - - AC_ARG_WITH(gnome-libs, - [ --with-gnome-libs=DIR Specify location of GNOME libs], - [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval] - ) - - AC_ARG_WITH(gnome, - [ --with-gnome Specify prefix for GNOME files], - if test x$withval = xyes; then - want_gnome=yes - ifelse([$1], [], :, [$1]) - else - if test "x$withval" = xno; then - want_gnome=no - else - want_gnome=yes - LDFLAGS="$LDFLAGS -L$withval/lib" - CFLAGS="$CFLAGS -I$withval/include" - gnome_prefix=$withval/lib - fi - fi, - want_gnome=yes) - - if test "x$want_gnome" = xyes; then - { - AC_MSG_CHECKING(for libgnomeui-2.0) - if $PKG_CONFIG --exists libgnomeui-2.0; then - AC_MSG_RESULT(yes) - GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0` - GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0` - GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0` - - dnl On FreeBSD we need -pthread but pkg-config doesn't include it. - dnl This might not be the right way but it works for me... - AC_MSG_CHECKING(for FreeBSD) - if test "`(uname) 2>/dev/null`" = FreeBSD; then - AC_MSG_RESULT(yes, adding -pthread) - GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" - GNOME_LIBS="$GNOME_LIBS -pthread" - else - AC_MSG_RESULT(no) - fi - $1 - else - AC_MSG_RESULT(not found) - if test "x$2" = xfail; then - AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config) - fi - fi - } - fi -]) - -AC_DEFUN([GNOME_INIT],[ - GNOME_INIT_HOOK([],fail) -]) - - -dnl --------------------------------------------------------------------------- -dnl Check for GTK2. If it fails, then continue on for Motif as before... -dnl --------------------------------------------------------------------------- -if test -z "$SKIP_GTK2"; then - - AC_MSG_CHECKING(--disable-gtktest argument) - AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], - , enable_gtktest=yes) - if test "x$enable_gtktest" = "xyes" ; then - AC_MSG_RESULT(gtk test enabled) - else - AC_MSG_RESULT(gtk test disabled) - fi - - if test "X$PKG_CONFIG" = "X"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi - - if test "x$PKG_CONFIG" != "xno"; then - dnl First try finding version 2.2.0 or later. The 2.0.x series has - dnl problems (bold fonts, --remote doesn't work). - AM_PATH_GTK(2.2.0, - [GUI_LIB_LOC="$GTK_LIBDIR" - GTK_LIBNAME="$GTK_LIBS" - GUI_INC_LOC="$GTK_CFLAGS"], ) - if test "x$GTK_CFLAGS" != "x"; then - SKIP_ATHENA=YES - SKIP_NEXTAW=YES - SKIP_MOTIF=YES - GUITYPE=GTK - AC_SUBST(GTK_LIBNAME) - fi - fi - if test "x$GUITYPE" = "xGTK"; then - if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \ - || test "0$gtk_minor_version" -ge 2; then - AC_DEFINE(HAVE_GTK_MULTIHEAD) - fi - dnl - dnl if GTK exists, then check for GNOME. - dnl - if test -z "$SKIP_GNOME"; then - { - GNOME_INIT_HOOK([have_gnome=yes]) - if test "x$have_gnome" = xyes ; then - AC_DEFINE(FEAT_GUI_GNOME) - GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR" - GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS" - fi - } - fi - fi -fi - -dnl Check for Motif include files location. -dnl The LAST one found is used, this makes the highest version to be used, -dnl e.g. when Motif1.2 and Motif2.0 are both present. - -if test -z "$SKIP_MOTIF"; then - gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX" - dnl Remove "-I" from before $GUI_INC_LOC if it's there - GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`" - - AC_MSG_CHECKING(for location of Motif GUI includes) - gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC" - GUI_INC_LOC= - for try in $gui_includes; do - if test -f "$try/Xm/Xm.h"; then - GUI_INC_LOC=$try - fi - done - if test -n "$GUI_INC_LOC"; then - if test "$GUI_INC_LOC" = /usr/include; then - GUI_INC_LOC= - AC_MSG_RESULT(in default path) - else - AC_MSG_RESULT($GUI_INC_LOC) - fi - else - AC_MSG_RESULT(<not found>) - SKIP_MOTIF=YES - fi -fi - -dnl Check for Motif library files location. In the same order as the include -dnl files, to avoid a mixup if several versions are present - -if test -z "$SKIP_MOTIF"; then - AC_MSG_CHECKING(--with-motif-lib argument) - AC_ARG_WITH(motif-lib, - [ --with-motif-lib=STRING Library for Motif ], - [ MOTIF_LIBNAME="${withval}" ] ) - - if test -n "$MOTIF_LIBNAME"; then - AC_MSG_RESULT($MOTIF_LIBNAME) - GUI_LIB_LOC= - else - AC_MSG_RESULT(no) - - dnl Remove "-L" from before $GUI_LIB_LOC if it's there - GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`" - - dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The - dnl linker will figure out which one to use, we only check if one exists. - AC_MSG_CHECKING(for location of Motif GUI libs) - gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC" - GUI_LIB_LOC= - for try in $gui_libs; do - for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do - if test -f "$libtry"; then - GUI_LIB_LOC=$try - fi - done - done - if test -n "$GUI_LIB_LOC"; then - dnl Remove /usr/lib, it causes trouble on some systems - if test "$GUI_LIB_LOC" = /usr/lib \ - -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \ - -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then - GUI_LIB_LOC= - AC_MSG_RESULT(in default path) - else - if test -n "$GUI_LIB_LOC"; then - AC_MSG_RESULT($GUI_LIB_LOC) - if test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC" - fi - fi - fi - MOTIF_LIBNAME=-lXm - else - AC_MSG_RESULT(<not found>) - SKIP_MOTIF=YES - fi - fi -fi - -if test -z "$SKIP_MOTIF"; then - SKIP_ATHENA=YES - SKIP_NEXTAW=YES - GUITYPE=MOTIF - AC_SUBST(MOTIF_LIBNAME) -fi - -dnl Check if the Athena files can be found - -GUI_X_LIBS= - -if test -z "$SKIP_ATHENA"; then - AC_MSG_CHECKING(if Athena header files can be found) - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $X_CFLAGS" - AC_TRY_COMPILE([ -#include <X11/Intrinsic.h> -#include <X11/Xaw/Paned.h>], , - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); SKIP_ATHENA=YES ) - CFLAGS=$cflags_save -fi - -if test -z "$SKIP_ATHENA"; then - GUITYPE=ATHENA -fi - -if test -z "$SKIP_NEXTAW"; then - AC_MSG_CHECKING(if neXtaw header files can be found) - cflags_save=$CFLAGS - CFLAGS="$CFLAGS $X_CFLAGS" - AC_TRY_COMPILE([ -#include <X11/Intrinsic.h> -#include <X11/neXtaw/Paned.h>], , - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); SKIP_NEXTAW=YES ) - CFLAGS=$cflags_save -fi - -if test -z "$SKIP_NEXTAW"; then - GUITYPE=NEXTAW -fi - -if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then - dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty - dnl Avoid adding it when it twice - if test -n "$GUI_INC_LOC"; then - GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`" - fi - if test -n "$GUI_LIB_LOC"; then - GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`" - fi - - dnl Check for -lXext and then for -lXmu - ldflags_save=$LDFLAGS - LDFLAGS="$X_LIBS $LDFLAGS" - AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],, - [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - dnl For Solaris we need -lw and -ldl before linking with -lXmu works. - AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],, - [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],, - [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],, - [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - if test -z "$SKIP_MOTIF"; then - AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],, - [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - fi - LDFLAGS=$ldflags_save - - dnl Execute xmkmf to figure out if -DNARROWPROTO is needed. - AC_MSG_CHECKING(for extra X11 defines) - NARROW_PROTO= - rm -fr conftestdir - if mkdir conftestdir; then - cd conftestdir - cat > Imakefile <<'EOF' -acfindx: - @echo 'NARROW_PROTO="${PROTO_DEFINES}"' -EOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then - eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` - fi - cd .. - rm -fr conftestdir - fi - if test -z "$NARROW_PROTO"; then - AC_MSG_RESULT(no) - else - AC_MSG_RESULT($NARROW_PROTO) - fi - AC_SUBST(NARROW_PROTO) -fi - -dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs -dnl use the X11 include path -if test "$enable_xsmp" = "yes"; then - cppflags_save=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - AC_CHECK_HEADERS(X11/SM/SMlib.h) - CPPFLAGS=$cppflags_save -fi - -if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then - dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path - cppflags_save=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h) - - dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h - if test ! "$enable_xim" = "no"; then - AC_MSG_CHECKING(for XIMText in X11/Xlib.h) - AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>], - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no; xim has been disabled); enable_xim="no") - fi - CPPFLAGS=$cppflags_save - - dnl automatically enable XIM when hangul input isn't enabled - if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \ - -a "x$GUITYPE" != "xNONE" ; then - AC_MSG_RESULT(X GUI selected; xim has been enabled) - enable_xim="yes" - fi -fi - -if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then - cppflags_save=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $X_CFLAGS" -dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h - AC_MSG_CHECKING([for X11/Xmu/Editres.h]) - AC_TRY_COMPILE([ -#include <X11/Intrinsic.h> -#include <X11/Xmu/Editres.h>], - [int i; i = 0;], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_X11_XMU_EDITRES_H), - AC_MSG_RESULT(no)) - CPPFLAGS=$cppflags_save -fi - -dnl Only use the Xm directory when compiling Motif, don't use it for Athena -if test -z "$SKIP_MOTIF"; then - cppflags_save=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - if test "$zOSUnix" = "yes"; then - xmheader="Xm/Xm.h" - else - xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h - Xm/UnhighlightT.h Xm/Notebook.h" - fi - AC_CHECK_HEADERS($xmheader) - - if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then - dnl Solaris uses XpmAttributes_21, very annoying. - AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h]) - AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;], - AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21), - AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) - ) - else - AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) - fi - CPPFLAGS=$cppflags_save -fi - -if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then - AC_MSG_RESULT(no GUI selected; xim has been disabled) - enable_xim="no" -fi -if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then - AC_MSG_RESULT(no GUI selected; fontset has been disabled) - enable_fontset="no" -fi -if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then - AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled) - enable_fontset="no" -fi - -if test -z "$SKIP_PHOTON"; then - GUITYPE=PHOTONGUI -fi - -AC_SUBST(GUI_INC_LOC) -AC_SUBST(GUI_LIB_LOC) -AC_SUBST(GUITYPE) -AC_SUBST(GUI_X_LIBS) - -if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then - AC_MSG_ERROR([cannot use workshop without Motif]) -fi - -dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled -if test "$enable_xim" = "yes"; then - AC_DEFINE(FEAT_XIM) -fi -if test "$enable_fontset" = "yes"; then - AC_DEFINE(FEAT_XFONTSET) -fi - - -dnl --------------------------------------------------------------------------- -dnl end of GUI-checking -dnl --------------------------------------------------------------------------- - -dnl Check for Cygwin, which needs an extra source file if not using X11 -AC_MSG_CHECKING(for CYGWIN environment) -case `uname` in - CYGWIN*) CYGWIN=yes; AC_MSG_RESULT(yes) - AC_MSG_CHECKING(for CYGWIN clipboard support) - if test "x$with_x" = "xno" ; then - OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o - AC_MSG_RESULT(yes) - AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD) - else - AC_MSG_RESULT(no - using X11) - fi ;; - - *) CYGWIN=no; AC_MSG_RESULT(no);; -esac - -dnl Only really enable hangul input when GUI and XFONTSET are available -if test "$enable_hangulinput" = "yes"; then - if test "x$GUITYPE" = "xNONE"; then - AC_MSG_RESULT(no GUI selected; hangul input has been disabled) - enable_hangulinput=no - else - AC_DEFINE(FEAT_HANGULIN) - HANGULIN_SRC=hangulin.c - AC_SUBST(HANGULIN_SRC) - HANGULIN_OBJ=objects/hangulin.o - AC_SUBST(HANGULIN_OBJ) - fi -fi - -dnl Checks for libraries and include files. - -AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#include <ctype.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); } - ]])],[ - vim_cv_toupper_broken=yes - ],[ - vim_cv_toupper_broken=no - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken') - ])]) - -if test "x$vim_cv_toupper_broken" = "xyes" ; then - AC_DEFINE(BROKEN_TOUPPER) -fi - -AC_MSG_CHECKING(whether __DATE__ and __TIME__ work) -AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME), - AC_MSG_RESULT(no)) - -AC_MSG_CHECKING(whether __attribute__((unused)) is allowed) -AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED), - AC_MSG_RESULT(no)) - -dnl Checks for header files. -AC_CHECK_HEADER(elf.h, HAS_ELF=1) -dnl AC_CHECK_HEADER(dwarf.h, SVR4=1) -if test "$HAS_ELF" = 1; then - AC_CHECK_LIB(elf, main) -fi - -AC_HEADER_DIRENT - -dnl If sys/wait.h is not found it might still exist but not be POSIX -dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT) -if test $ac_cv_header_sys_wait_h = no; then - AC_MSG_CHECKING([for sys/wait.h that defines union wait]) - AC_TRY_COMPILE([#include <sys/wait.h>], - [union wait xx, yy; xx = yy], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SYS_WAIT_H) - AC_DEFINE(HAVE_UNION_WAIT), - AC_MSG_RESULT(no)) -fi - -AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \ - sys/select.h sys/utsname.h termcap.h fcntl.h \ - sgtty.h sys/ioctl.h sys/time.h sys/types.h \ - termio.h iconv.h inttypes.h langinfo.h math.h \ - unistd.h stropts.h errno.h sys/resource.h \ - sys/systeminfo.h locale.h sys/stream.h termios.h \ - libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ - utime.h sys/param.h libintl.h libgen.h \ - util/debug.h util/msg18n.h frame.h sys/acl.h \ - sys/access.h sys/sysinfo.h wchar.h wctype.h) - -dnl sys/ptem.h depends on sys/stream.h on Solaris -AC_CHECK_HEADERS(sys/ptem.h, [], [], -[#if defined HAVE_SYS_STREAM_H -# include <sys/stream.h> -#endif]) - -dnl sys/sysctl.h depends on sys/param.h on OpenBSD -AC_CHECK_HEADERS(sys/sysctl.h, [], [], -[#if defined HAVE_SYS_PARAM_H -# include <sys/param.h> -#endif]) - - -dnl pthread_np.h may exist but can only be used after including pthread.h -AC_MSG_CHECKING([for pthread_np.h]) -AC_TRY_COMPILE([ -#include <pthread.h> -#include <pthread_np.h>], - [int i; i = 0;], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PTHREAD_NP_H), - AC_MSG_RESULT(no)) - -AC_CHECK_HEADERS(strings.h) -if test "x$MACOSX" = "xyes"; then - dnl The strings.h file on OS/X contains a warning and nothing useful. - AC_DEFINE(NO_STRINGS_WITH_STRING_H) -else - -dnl Check if strings.h and string.h can both be included when defined. -AC_MSG_CHECKING([if strings.h can be included after string.h]) -cppflags_save=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $X_CFLAGS" -AC_TRY_COMPILE([ -#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO) -# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */ - /* but don't do it on AIX 5.1 (Uribarri) */ -#endif -#ifdef HAVE_XM_XM_H -# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */ -#endif -#ifdef HAVE_STRING_H -# include <string.h> -#endif -#if defined(HAVE_STRINGS_H) -# include <strings.h> -#endif - ], [int i; i = 0;], - AC_MSG_RESULT(yes), - AC_DEFINE(NO_STRINGS_WITH_STRING_H) - AC_MSG_RESULT(no)) -CPPFLAGS=$cppflags_save -fi - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_PROG_GCC_TRADITIONAL -AC_C_CONST -AC_C_VOLATILE -AC_TYPE_MODE_T -AC_TYPE_OFF_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_UID_T -AC_TYPE_UINT32_T - -AC_HEADER_TIME -AC_CHECK_TYPE(ino_t, long) -AC_CHECK_TYPE(dev_t, unsigned) -AC_C_BIGENDIAN(,,,) - -AC_MSG_CHECKING(for rlim_t) -if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then - AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t]) -else - AC_EGREP_CPP(dnl -changequote(<<,>>)dnl -<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl -changequote([,]), - [ -#include <sys/types.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#ifdef HAVE_SYS_RESOURCE_H -# include <sys/resource.h> -#endif - ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no) - AC_MSG_RESULT($ac_cv_type_rlim_t) -fi -if test $ac_cv_type_rlim_t = no; then - cat >> confdefs.h <<\EOF -#define rlim_t unsigned long -EOF -fi - -AC_MSG_CHECKING(for stack_t) -if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then - AC_MSG_RESULT([(cached) $ac_cv_type_stack_t]) -else - AC_EGREP_CPP(stack_t, - [ -#include <sys/types.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#include <signal.h> - ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no) - AC_MSG_RESULT($ac_cv_type_stack_t) -fi -if test $ac_cv_type_stack_t = no; then - cat >> confdefs.h <<\EOF -#define stack_t struct sigaltstack -EOF -fi - -dnl BSDI uses ss_base while others use ss_sp for the stack pointer. -AC_MSG_CHECKING(whether stack_t has an ss_base field) -AC_TRY_COMPILE([ -#include <sys/types.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#include <signal.h> -#include "confdefs.h" - ], [stack_t sigstk; sigstk.ss_base = 0; ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE), - AC_MSG_RESULT(no)) - -olibs="$LIBS" -AC_MSG_CHECKING(--with-tlib argument) -AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],) -if test -n "$with_tlib"; then - AC_MSG_RESULT($with_tlib) - LIBS="$LIBS -l$with_tlib" - AC_MSG_CHECKING(for linking with $with_tlib library) - AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED)) - dnl Need to check for tgetent() below. - olibs="$LIBS" -else - AC_MSG_RESULT([empty: automatic terminal library selection]) - dnl On HP-UX 10.10 termcap or termlib should be used instead of - dnl curses, because curses is much slower. - dnl Newer versions of ncurses are preferred over anything, except - dnl when tinfo has been split off, it contains all we need. - dnl Older versions of ncurses have bugs, get a new one! - dnl Digital Unix (OSF1) should use curses (Ronald Schild). - dnl On SCO Openserver should prefer termlib (Roger Cornelius). - case "`uname -s 2>/dev/null`" in - OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";; - *) tlibs="tinfo ncurses termlib termcap curses";; - esac - for libname in $tlibs; do - AC_CHECK_LIB(${libname}, tgetent,,) - if test "x$olibs" != "x$LIBS"; then - dnl It's possible that a library is found but it doesn't work - dnl e.g., shared library that cannot be found - dnl compile and run a test program to be sure - AC_TRY_RUN([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }], - res="OK", res="FAIL", res="FAIL") - if test "$res" = "OK"; then - break - fi - AC_MSG_RESULT($libname library is not usable) - LIBS="$olibs" - fi - done - if test "x$olibs" = "x$LIBS"; then - AC_MSG_RESULT(no terminal library found) - fi -fi - -if test "x$olibs" = "x$LIBS"; then - AC_MSG_CHECKING([for tgetent()]) - AC_TRY_LINK([], - [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");], - AC_MSG_RESULT(yes), - AC_MSG_ERROR([NOT FOUND! - You need to install a terminal library; for example ncurses. - Or specify the name of the library with --with-tlib.])) -fi - -AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif -#ifdef HAVE_STRING_H -# include <string.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -main() -{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); } - ]])],[ - vim_cv_terminfo=no - ],[ - vim_cv_terminfo=yes - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo') - ]) - ]) - -if test "x$vim_cv_terminfo" = "xyes" ; then - AC_DEFINE(TERMINFO) -fi - -if test "x$olibs" != "x$LIBS"; then - AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -main() -{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); } - ]])],[ - vim_cv_tgent=zero - ],[ - vim_cv_tgent=non-zero - ],[ - AC_MSG_ERROR(failed to compile test program.) - ]) - ]) - - if test "x$vim_cv_tgent" = "xzero" ; then - AC_DEFINE(TGETENT_ZERO_ERR, 0) - fi -fi - -AC_MSG_CHECKING(whether termcap.h contains ospeed) -AC_TRY_LINK([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif - ], [ospeed = 20000], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED), - [AC_MSG_RESULT(no) - AC_MSG_CHECKING(whether ospeed can be extern) - AC_TRY_LINK([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif -extern short ospeed; - ], [ospeed = 20000], - AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN), - AC_MSG_RESULT(no))] - ) - -AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC]) -AC_TRY_LINK([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif - ], [if (UP == 0 && BC == 0) PC = 1], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC), - [AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether UP, BC and PC can be extern]) - AC_TRY_LINK([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif -extern char *UP, *BC, PC; - ], [if (UP == 0 && BC == 0) PC = 1], - AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN), - AC_MSG_RESULT(no))] - ) - -AC_MSG_CHECKING(whether tputs() uses outfuntype) -AC_TRY_COMPILE([ -#ifdef HAVE_TERMCAP_H -# include <termcap.h> -#endif - ], [extern int xx(); tputs("test", 1, (outfuntype)xx)], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE), - AC_MSG_RESULT(no)) - -dnl On some SCO machines sys/select redefines struct timeval -AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included]) -AC_TRY_COMPILE([ -#include <sys/types.h> -#include <sys/time.h> -#include <sys/select.h>], , - AC_MSG_RESULT(yes) - AC_DEFINE(SYS_SELECT_WITH_SYS_TIME), - AC_MSG_RESULT(no)) - -dnl AC_DECL_SYS_SIGLIST - -dnl Checks for pty.c (copied from screen) ========================== -AC_MSG_CHECKING(for /dev/ptc) -if test -r /dev/ptc; then - AC_DEFINE(HAVE_DEV_PTC) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING(for SVR4 ptys) -if test -c /dev/ptmx ; then - AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS), - AC_MSG_RESULT(no)) -else - AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING(for ptyranges) -if test -d /dev/ptym ; then - pdir='/dev/ptym' -else - pdir='/dev' -fi -dnl SCO uses ptyp%d -AC_EGREP_CPP(yes, -[#ifdef M_UNIX - yes; -#endif - ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) -dnl if test -c /dev/ptyp19; then -dnl ptys=`echo /dev/ptyp??` -dnl else -dnl ptys=`echo $pdir/pty??` -dnl fi -if test "$ptys" != "$pdir/pty??" ; then - p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` - p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` - AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") - AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") - AC_MSG_RESULT([$p0 / $p1]) -else - AC_MSG_RESULT([don't know]) -fi - -dnl **** pty mode/group handling **** -dnl -dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222 -rm -f conftest_grp -AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <sys/stat.h> -#include <stdio.h> -main() -{ - struct stat sb; - char *x,*ttyname(); - int om, m; - FILE *fp; - - if (!(x = ttyname(0))) exit(1); - if (stat(x, &sb)) exit(1); - om = sb.st_mode; - if (om & 002) exit(0); - m = system("mesg y"); - if (m == -1 || m == 127) exit(1); - if (stat(x, &sb)) exit(1); - m = sb.st_mode; - if (chmod(x, om)) exit(1); - if (m & 002) exit(0); - if (sb.st_gid == getgid()) exit(1); - if (!(fp=fopen("conftest_grp", "w"))) - exit(1); - fprintf(fp, "%d\n", sb.st_gid); - fclose(fp); - exit(0); -} - ]])],[ - if test -f conftest_grp; then - vim_cv_tty_group=`cat conftest_grp` - if test "x$vim_cv_tty_mode" = "x" ; then - vim_cv_tty_mode=0620 - fi - AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group]) - else - vim_cv_tty_group=world - AC_MSG_RESULT([ptys are world accessible]) - fi - ],[ - vim_cv_tty_group=world - AC_MSG_RESULT([can't determine - assume ptys are world accessible]) - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode') - ]) - ]) -rm -f conftest_grp - -if test "x$vim_cv_tty_group" != "xworld" ; then - AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group) - if test "x$vim_cv_tty_mode" = "x" ; then - AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)]) - else - AC_DEFINE(PTYMODE, 0620) - fi -fi - -dnl Checks for library functions. =================================== - -AC_TYPE_SIGNAL - -dnl find out what to use at the end of a signal function -if test $ac_cv_type_signal = void; then - AC_DEFINE(SIGRETURN, [return]) -else - AC_DEFINE(SIGRETURN, [return 0]) -fi - -dnl check if struct sigcontext is defined (used for SGI only) -AC_MSG_CHECKING(for struct sigcontext) -AC_TRY_COMPILE([ -#include <signal.h> -test_sig() -{ - struct sigcontext *scont; - scont = (struct sigcontext *)0; - return 1; -} ], , - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SIGCONTEXT), - AC_MSG_RESULT(no)) - -dnl tricky stuff: try to find out if getcwd() is implemented with -dnl system("sh -c pwd") -AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -char *dagger[] = { "IFS=pwd", 0 }; -main() -{ - char buffer[500]; - extern char **environ; - environ = dagger; - return getcwd(buffer, 500) ? 0 : 1; -} - ]])],[ - vim_cv_getcwd_broken=no - ],[ - vim_cv_getcwd_broken=yes - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken') - ]) - ]) - -if test "x$vim_cv_getcwd_broken" = "xyes" ; then - AC_DEFINE(BAD_GETCWD) -fi - -dnl Check for functions in one big call, to reduce the size of configure. -dnl Can only be used for functions that do not require any include. -AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \ - getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \ - memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ - setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ - sigvec strcasecmp strerror strftime stricmp strncasecmp \ - strnicmp strpbrk strtol tgetent towlower towupper iswupper \ - usleep utime utimes) -AC_FUNC_FSEEKO - -dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when -dnl appropriate, so that off_t is 64 bits when needed. -AC_SYS_LARGEFILE - -dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible -AC_MSG_CHECKING(for st_blksize) -AC_TRY_COMPILE( -[#include <sys/types.h> -#include <sys/stat.h>], -[ struct stat st; - int n; - - stat("/", &st); - n = (int)st.st_blksize;], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE), - AC_MSG_RESULT(no)) - -AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include "confdefs.h" -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> -main() {struct stat st; exit(stat("configure/", &st) != 0); } - ]])],[ - vim_cv_stat_ignores_slash=yes - ],[ - vim_cv_stat_ignores_slash=no - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash') - ]) - ]) - -if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then - AC_DEFINE(STAT_IGNORES_SLASH) -fi - -dnl Link with iconv for charset translation, if not found without library. -dnl check for iconv() requires including iconv.h -dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it -dnl has been installed. -AC_MSG_CHECKING(for iconv_open()) -save_LIBS="$LIBS" -LIBS="$LIBS -liconv" -AC_TRY_LINK([ -#ifdef HAVE_ICONV_H -# include <iconv.h> -#endif - ], [iconv_open("fr", "to");], - AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV), - LIBS="$save_LIBS" - AC_TRY_LINK([ -#ifdef HAVE_ICONV_H -# include <iconv.h> -#endif - ], [iconv_open("fr", "to");], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV), - AC_MSG_RESULT(no))) - - -AC_MSG_CHECKING(for nl_langinfo(CODESET)) -AC_TRY_LINK([ -#ifdef HAVE_LANGINFO_H -# include <langinfo.h> -#endif -], [char *cs = nl_langinfo(CODESET);], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET), - AC_MSG_RESULT(no)) - -dnl Need various functions for floating point support. Only enable -dnl floating point when they are all present. -AC_CHECK_LIB(m, strtod) -AC_MSG_CHECKING([for strtod() and other floating point functions]) -AC_TRY_LINK([ -#ifdef HAVE_MATH_H -# include <math.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -], [char *s; double d; - d = strtod("1.1", &s); - d = fabs(1.11); - d = ceil(1.11); - d = floor(1.11); - d = log10(1.11); - d = pow(1.11, 2.22); - d = sqrt(1.11); - d = sin(1.11); - d = cos(1.11); - d = atan(1.11); - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS), - AC_MSG_RESULT(no)) - -dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI -dnl when -lacl works, also try to use -lattr (required for Debian). -dnl On Solaris, use the acl_get/set functions in libsec, if present. -AC_MSG_CHECKING(--disable-acl argument) -AC_ARG_ENABLE(acl, - [ --disable-acl Don't check for ACL support.], - , [enable_acl="yes"]) -if test "$enable_acl" = "yes"; then -AC_MSG_RESULT(no) -AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"], - AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl" - AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),) - -AC_MSG_CHECKING(for POSIX ACL support) -AC_TRY_LINK([ -#include <sys/types.h> -#ifdef HAVE_SYS_ACL_H -# include <sys/acl.h> -#endif -acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS); - acl_set_file("foo", ACL_TYPE_ACCESS, acl); - acl_free(acl);], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL), - AC_MSG_RESULT(no)) - -AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)], -AC_MSG_CHECKING(for Solaris ACL support) -AC_TRY_LINK([ -#ifdef HAVE_SYS_ACL_H -# include <sys/acl.h> -#endif], [acl("foo", GETACLCNT, 0, NULL); - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL), - AC_MSG_RESULT(no))) - -AC_MSG_CHECKING(for AIX ACL support) -AC_TRY_LINK([ -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -#ifdef HAVE_SYS_ACL_H -# include <sys/acl.h> -#endif -#ifdef HAVE_SYS_ACCESS_H -# include <sys/access.h> -#endif -#define _ALL_SOURCE - -#include <sys/stat.h> - -int aclsize; -struct acl *aclent;], [aclsize = sizeof(struct acl); - aclent = (void *)malloc(aclsize); - statacl("foo", STX_NORMAL, aclent, aclsize); - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL), - AC_MSG_RESULT(no)) -else - AC_MSG_RESULT(yes) -fi - -AC_MSG_CHECKING(--disable-gpm argument) -AC_ARG_ENABLE(gpm, - [ --disable-gpm Don't use gpm (Linux mouse daemon).], , - [enable_gpm="yes"]) - -if test "$enable_gpm" = "yes"; then - AC_MSG_RESULT(no) - dnl Checking if gpm support can be compiled - AC_CACHE_CHECK([for gpm], vi_cv_have_gpm, - [olibs="$LIBS" ; LIBS="-lgpm"] - AC_TRY_LINK( - [#include <gpm.h> - #include <linux/keyboard.h>], - [Gpm_GetLibVersion(NULL);], - dnl Configure defines HAVE_GPM, if it is defined feature.h defines - dnl FEAT_MOUSE_GPM if mouse support is included - [vi_cv_have_gpm=yes], - [vi_cv_have_gpm=no]) - [LIBS="$olibs"] - ) - if test $vi_cv_have_gpm = yes; then - LIBS="$LIBS -lgpm" - AC_DEFINE(HAVE_GPM) - fi -else - AC_MSG_RESULT(yes) -fi - -AC_MSG_CHECKING(--disable-sysmouse argument) -AC_ARG_ENABLE(sysmouse, - [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], , - [enable_sysmouse="yes"]) - -if test "$enable_sysmouse" = "yes"; then - AC_MSG_RESULT(no) - dnl Checking if sysmouse support can be compiled - dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h - dnl defines FEAT_SYSMOUSE if mouse support is included - AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse, - AC_TRY_LINK( - [#include <sys/consio.h> - #include <signal.h> - #include <sys/fbio.h>], - [struct mouse_info mouse; - mouse.operation = MOUSE_MODE; - mouse.operation = MOUSE_SHOW; - mouse.u.mode.mode = 0; - mouse.u.mode.signal = SIGUSR2;], - [vi_cv_have_sysmouse=yes], - [vi_cv_have_sysmouse=no]) - ) - if test $vi_cv_have_sysmouse = yes; then - AC_DEFINE(HAVE_SYSMOUSE) - fi -else - AC_MSG_RESULT(yes) -fi - -dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known -AC_MSG_CHECKING(for FD_CLOEXEC) -AC_TRY_COMPILE( -[#if HAVE_FCNTL_H -# include <fcntl.h> -#endif], -[ int flag = FD_CLOEXEC;], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC), - AC_MSG_RESULT(not usable)) - -dnl rename needs to be checked separately to work on Nextstep with cc -AC_MSG_CHECKING(for rename) -AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME), - AC_MSG_RESULT(no)) - -dnl sysctl() may exist but not the arguments we use -AC_MSG_CHECKING(for sysctl) -AC_TRY_COMPILE( -[#include <sys/types.h> -#include <sys/sysctl.h>], -[ int mib[2], r; - size_t len; - - mib[0] = CTL_HW; - mib[1] = HW_USERMEM; - len = sizeof(r); - (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0); - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL), - AC_MSG_RESULT(not usable)) - -dnl sysinfo() may exist but not be Linux compatible -AC_MSG_CHECKING(for sysinfo) -AC_TRY_COMPILE( -[#include <sys/types.h> -#include <sys/sysinfo.h>], -[ struct sysinfo sinfo; - int t; - - (void)sysinfo(&sinfo); - t = sinfo.totalram; - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO), - AC_MSG_RESULT(not usable)) - -dnl struct sysinfo may have the mem_unit field or not -AC_MSG_CHECKING(for sysinfo.mem_unit) -AC_TRY_COMPILE( -[#include <sys/types.h> -#include <sys/sysinfo.h>], -[ struct sysinfo sinfo; - sinfo.mem_unit = 1; - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT), - AC_MSG_RESULT(no)) - -dnl sysconf() may exist but not support what we want to use -AC_MSG_CHECKING(for sysconf) -AC_TRY_COMPILE( -[#include <unistd.h>], -[ (void)sysconf(_SC_PAGESIZE); - (void)sysconf(_SC_PHYS_PAGES); - ], - AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF), - AC_MSG_RESULT(not usable)) - -AC_CHECK_SIZEOF([int]) -AC_CHECK_SIZEOF([long]) -AC_CHECK_SIZEOF([time_t]) -AC_CHECK_SIZEOF([off_t]) - -dnl Use different names to avoid clashing with other header files. -AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int]) -AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long]) - -dnl Make sure that uint32_t is really 32 bits unsigned. -AC_MSG_CHECKING([uint32_t is 32 bits]) -AC_TRY_RUN([ -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#endif -main() { - uint32_t nr1 = (uint32_t)-1; - uint32_t nr2 = (uint32_t)0xffffffffUL; - if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1); - exit(0); -}], -AC_MSG_RESULT(ok), -AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]), -AC_MSG_WARN([cannot check uint32_t when cross-compiling.])) - -dnl Check for memmove() before bcopy(), makes memmove() be used when both are -dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5. - -[bcopy_test_prog=' -#include "confdefs.h" -#ifdef HAVE_STRING_H -# include <string.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#endif -main() { - char buf[10]; - strcpy(buf, "abcdefghi"); - mch_memmove(buf, buf + 2, 3); - if (strncmp(buf, "ababcf", 6)) - exit(1); - strcpy(buf, "abcdefghi"); - mch_memmove(buf + 2, buf, 3); - if (strncmp(buf, "cdedef", 6)) - exit(1); - exit(0); /* libc version works properly. */ -}'] - -AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])], - [ - vim_cv_memmove_handles_overlap=yes - ],[ - vim_cv_memmove_handles_overlap=no - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap') - ]) - ]) - -if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then - AC_DEFINE(USEMEMMOVE) -else - AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])], - [ - vim_cv_bcopy_handles_overlap=yes - ],[ - vim_cv_bcopy_handles_overlap=no - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap') - ]) - ]) - - if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then - AC_DEFINE(USEBCOPY) - else - AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap], - [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])], - [ - vim_cv_memcpy_handles_overlap=yes - ],[ - vim_cv_memcpy_handles_overlap=no - ],[ - AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap') - ]) - ]) - - if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then - AC_DEFINE(USEMEMCPY) - fi - fi -fi - - -dnl Check for multibyte locale functions -dnl Find out if _Xsetlocale() is supported by libX11. -dnl Check if X_LOCALE should be defined. - -if test "$enable_multibyte" = "yes"; then - cflags_save=$CFLAGS - ldflags_save=$LDFLAGS - if test "x$x_includes" != "xNONE" ; then - CFLAGS="$CFLAGS -I$x_includes" - LDFLAGS="$X_LIBS $LDFLAGS -lX11" - AC_MSG_CHECKING(whether X_LOCALE needed) - AC_TRY_COMPILE([#include <X11/Xlocale.h>],, - AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) - AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), - AC_MSG_RESULT(no)) - fi - CFLAGS=$cflags_save - LDFLAGS=$ldflags_save -fi - -dnl Link with xpg4, it is said to make Korean locale working -AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,) - -dnl Check how we can run ctags. Default to "ctags" when nothing works. -dnl Use --version to detect Exuberant ctags (preferred) -dnl Add --fields=+S to get function signatures for omni completion. -dnl -t for typedefs (many ctags have this) -dnl -s for static functions (Elvis ctags only?) -dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'. -dnl -i+m to test for older Exuberant ctags -AC_MSG_CHECKING(how to create tags) -test -f tags && mv tags tags.save -if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then - TAGPRG="ctags -I INIT+ --fields=+S" -elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then - TAGPRG="exctags -I INIT+ --fields=+S" -elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then - TAGPRG="exuberant-ctags -I INIT+ --fields=+S" -else - TAGPRG="ctags" - (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags" - (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c" - (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags" - (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t" - (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts" - (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs" - (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m" -fi -test -f tags.save && mv tags.save tags -AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG) - -dnl Check how we can run man with a section number -AC_MSG_CHECKING(how to run man with a section nr) -MANDEF="man" -(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s" -AC_MSG_RESULT($MANDEF) -if test "$MANDEF" = "man -s"; then - AC_DEFINE(USEMAN_S) -fi - -dnl Check if gettext() is working and if it needs -lintl -dnl We take care to base this on an empty LIBS: on some systems libelf would be -dnl in LIBS and implicitly take along libintl. The final LIBS would then not -dnl contain libintl, and the link step would fail due to -Wl,--as-needed. -AC_MSG_CHECKING(--disable-nls argument) -AC_ARG_ENABLE(nls, - [ --disable-nls Don't support NLS (gettext()).], , - [enable_nls="yes"]) - -if test "$enable_nls" = "yes"; then - AC_MSG_RESULT(no) - - INSTALL_LANGS=install-languages - AC_SUBST(INSTALL_LANGS) - INSTALL_TOOL_LANGS=install-tool-languages - AC_SUBST(INSTALL_TOOL_LANGS) - - AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, ) - AC_MSG_CHECKING([for NLS]) - if test -f po/Makefile; then - have_gettext="no" - if test -n "$MSGFMT"; then - olibs=$LIBS - LIBS="" - AC_TRY_LINK( - [#include <libintl.h>], - [gettext("Test");], - AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs, - LIBS="-lintl" - AC_TRY_LINK( - [#include <libintl.h>], - [gettext("Test");], - AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes"; - LIBS="$olibs -lintl", - AC_MSG_RESULT([gettext() doesn't work]); - LIBS=$olibs)) - else - AC_MSG_RESULT([msgfmt not found - disabled]); - fi - if test $have_gettext = "yes"; then - AC_DEFINE(HAVE_GETTEXT) - MAKEMO=yes - AC_SUBST(MAKEMO) - dnl this was added in GNU gettext 0.10.36 - AC_CHECK_FUNCS(bind_textdomain_codeset) - dnl _nl_msg_cat_cntr is required for GNU gettext - AC_MSG_CHECKING([for _nl_msg_cat_cntr]) - AC_TRY_LINK( - [#include <libintl.h> - extern int _nl_msg_cat_cntr;], - [++_nl_msg_cat_cntr;], - AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR), - AC_MSG_RESULT([no])) - fi - else - AC_MSG_RESULT([no "po/Makefile" - disabled]); - fi -else - AC_MSG_RESULT(yes) -fi - -dnl Check for dynamic linking loader -AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)]) -if test x${DLL} = xdlfcn.h; then - AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ]) - AC_MSG_CHECKING([for dlopen()]) - AC_TRY_LINK(,[ - extern void* dlopen(); - dlopen(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), - AC_MSG_RESULT(no); - AC_MSG_CHECKING([for dlopen() in -ldl]) - olibs=$LIBS - LIBS="$LIBS -ldl" - AC_TRY_LINK(,[ - extern void* dlopen(); - dlopen(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), - AC_MSG_RESULT(no); - LIBS=$olibs)) - dnl ReliantUNIX has dlopen() in libc but everything else in libdl - dnl ick :-) - AC_MSG_CHECKING([for dlsym()]) - AC_TRY_LINK(,[ - extern void* dlsym(); - dlsym(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), - AC_MSG_RESULT(no); - AC_MSG_CHECKING([for dlsym() in -ldl]) - olibs=$LIBS - LIBS="$LIBS -ldl" - AC_TRY_LINK(,[ - extern void* dlsym(); - dlsym(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), - AC_MSG_RESULT(no); - LIBS=$olibs)) -elif test x${DLL} = xdl.h; then - AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ]) - AC_MSG_CHECKING([for shl_load()]) - AC_TRY_LINK(,[ - extern void* shl_load(); - shl_load(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), - AC_MSG_RESULT(no); - AC_MSG_CHECKING([for shl_load() in -ldld]) - olibs=$LIBS - LIBS="$LIBS -ldld" - AC_TRY_LINK(,[ - extern void* shl_load(); - shl_load(); - ], - AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), - AC_MSG_RESULT(no); - LIBS=$olibs)) -fi -AC_CHECK_HEADERS(setjmp.h) - -if test "x$MACOSX" = "xyes" -a -n "$PERL"; then - dnl -ldl must come after DynaLoader.a - if echo $LIBS | grep -e '-ldl' >/dev/null; then - LIBS=`echo $LIBS | sed s/-ldl//` - PERL_LIBS="$PERL_LIBS -ldl" - fi -fi - -if test "x$MACOSX" = "xyes"; then - AC_MSG_CHECKING(whether we need -framework Cocoa) - dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is - dnl disabled during tiny build) - if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then - LIBS=$"$LIBS -framework Cocoa" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - dnl As mentioned above, tiny build implies os_macosx.m isn't needed. - dnl Exclude it from OS_EXTRA_SRC so that linker won't complain about - dnl missing Objective-C symbols. - if test "x$features" = "xtiny"; then - OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'` - OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'` - fi -fi - -if test "x$MACOSX" = "xyes"; then - AC_MSG_CHECKING(--with-xcodecfg argument) - AC_ARG_WITH(xcodecfg, - [ --with-xcodecfg=CFG Debug, Release (default: Release)], - [ XCODEFLAGS="$XCODEFLAGS -configuration $withval" - AC_MSG_RESULT($withval) ], - [ AC_MSG_RESULT(using default) ]) - - AC_SUBST(XCODEFLAGS) -fi - - -dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to -dnl use "-isystem" instead of "-I" for all non-Vim include dirs. -dnl But only when making dependencies, cproto and lint don't take "-isystem". -dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow -dnl the number before the version number. -DEPEND_CFLAGS_FILTER= -if test "$GCC" = yes; then - AC_MSG_CHECKING(for GCC 3 or later) - gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` - if test "$gccmajor" -gt "2"; then - DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is - dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. - dnl Also remove duplicate _FORTIFY_SOURCE arguments. - dnl And undefine it first to avoid a warning. - AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) - if test "$gccmajor" -gt "3"; then - CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'` - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -fi -AC_SUBST(DEPEND_CFLAGS_FILTER) - -dnl link.sh tries to avoid overlinking in a hackish way. -dnl At least GNU ld supports --as-needed which provides the same functionality -dnl at linker level. Let's use it. -AC_MSG_CHECKING(linker --as-needed support) -LINK_AS_NEEDED= -# Check if linker supports --as-needed and --no-as-needed options -if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then - LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'` - LINK_AS_NEEDED=yes -fi -if test "$LINK_AS_NEEDED" = yes; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_SUBST(LINK_AS_NEEDED) - -# IBM z/OS reset CFLAGS for config.mk -if test "$zOSUnix" = "yes"; then - CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" -fi - -dnl write output files -AC_OUTPUT(auto/config.mk:config.mk.in) - -dnl vim: set sw=2 tw=78 fo+=l: diff --git a/src/create-dmg/LICENSE b/src/create-dmg/LICENSE new file mode 100644 index 0000000000..349b6d82b3 --- /dev/null +++ b/src/create-dmg/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2008-2014 Andrey Tarantsov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/create-dmg/README b/src/create-dmg/README new file mode 100644 index 0000000000..4557795edb --- /dev/null +++ b/src/create-dmg/README @@ -0,0 +1,2 @@ +Content of this directory (except background.png) is copied from +https://github.com/andreyvit/create-dmg (5acf22f). diff --git a/src/create-dmg/background.png b/src/create-dmg/background.png new file mode 100644 index 0000000000..739494dc9f Binary files /dev/null and b/src/create-dmg/background.png differ diff --git a/src/create-dmg/background.pxd b/src/create-dmg/background.pxd new file mode 100644 index 0000000000..60dddda486 Binary files /dev/null and b/src/create-dmg/background.pxd differ diff --git a/src/create-dmg/builder/create-dmg.builder b/src/create-dmg/builder/create-dmg.builder new file mode 100644 index 0000000000..d4285280f1 --- /dev/null +++ b/src/create-dmg/builder/create-dmg.builder @@ -0,0 +1,26 @@ +SET app_name create-dmg + +VERSION create-dmg.cur create-dmg heads/master + +NEWDIR build.dir temp %-build - + +NEWFILE create-dmg.zip featured %.zip % + + +COPYTO [build.dir] + INTO create-dmg [create-dmg.cur]/create-dmg + INTO sample [create-dmg.cur]/sample + INTO support [create-dmg.cur]/support + +SUBSTVARS [build.dir<alter>]/create-dmg [[]] + + +ZIP [create-dmg.zip] + INTO [build-files-prefix] [build.dir] + + +PUT megabox-builds create-dmg.zip +PUT megabox-builds build.log + +PUT s3-builds create-dmg.zip +PUT s3-builds build.log diff --git a/src/create-dmg/create-dmg b/src/create-dmg/create-dmg new file mode 100755 index 0000000000..454e6ad9aa --- /dev/null +++ b/src/create-dmg/create-dmg @@ -0,0 +1,230 @@ +#! /bin/bash + +# Create a read-only disk image of the contents of a folder + +set -e; + +function pure_version() { + echo '1.0.0.2' +} + +function version() { + echo "create-dmg $(pure_version)" +} + +function usage() { + version + echo "Creates a fancy DMG file." + echo "Usage: $(basename $0) options... image.dmg source_folder" + echo "All contents of source_folder will be copied into the disk image." + echo "Options:" + echo " --volname name" + echo " set volume name (displayed in the Finder sidebar and window title)" + echo " --volicon icon.icns" + echo " set volume icon" + echo " --background pic.png" + echo " set folder background image (provide png, gif, jpg)" + echo " --window-pos x y" + echo " set position the folder window" + echo " --window-size width height" + echo " set size of the folder window" + echo " --text-size text_size" + echo " set window text size (10-16)" + echo " --icon-size icon_size" + echo " set window icons size (up to 128)" + echo " --icon file_name x y" + echo " set position of the file's icon" + echo " --hide-extension file_name" + echo " hide the extension of file" + echo " --custom-icon file_name custom_icon_or_sample_file x y" + echo " set position and custom icon" + echo " --app-drop-link x y" + echo " make a drop link to Applications, at location x,y" + echo " --eula eula_file" + echo " attach a license file to the dmg" + echo " --no-internet-enable" + echo " disable automatic mount©" + echo " --version show tool version number" + echo " -h, --help display this help" + exit 0 +} + +WINX=10 +WINY=60 +WINW=500 +WINH=350 +ICON_SIZE=128 +TEXT_SIZE=16 + +while test "${1:0:1}" = "-"; do + case $1 in + --volname) + VOLUME_NAME="$2" + shift; shift;; + --volicon) + VOLUME_ICON_FILE="$2" + shift; shift;; + --background) + BACKGROUND_FILE="$2" + BACKGROUND_FILE_NAME="$(basename $BACKGROUND_FILE)" + BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\"" + REPOSITION_HIDDEN_FILES_CLAUSE="set position of every item to {theBottomRightX + 100, 100}" + shift; shift;; + --icon-size) + ICON_SIZE="$2" + shift; shift;; + --text-size) + TEXT_SIZE="$2" + shift; shift;; + --window-pos) + WINX=$2; WINY=$3 + shift; shift; shift;; + --window-size) + WINW=$2; WINH=$3 + shift; shift; shift;; + --icon) + POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4} +" + shift; shift; shift; shift;; + --hide-extension) + HIDING_CLAUSE="${HIDING_CLAUSE}set the extension hidden of item \"$2\" to true +" + shift; shift;; + --custom-icon) + shift; shift; shift; shift; shift;; + -h | --help) + usage;; + --version) + version; exit 0;; + --pure-version) + pure_version; exit 0;; + --app-drop-link) + APPLICATION_LINK=$2 + APPLICATION_CLAUSE="set position of item \"Applications\" to {$2, $3} +" + shift; shift; shift;; + --eula) + EULA_RSRC=$2 + shift; shift;; + --no-internet-enable) + NOINTERNET=1 + shift;; + -*) + echo "Unknown option $1. Run with --help for help." + exit 1;; + esac +done + +test -z "$2" && { + echo "Not enough arguments. Invoke with --help for help." + exit 1 +} + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DMG_PATH="$1" +DMG_DIRNAME="$(dirname "$DMG_PATH")" +DMG_DIR="$(cd "$DMG_DIRNAME" > /dev/null; pwd)" +DMG_NAME="$(basename "$DMG_PATH")" +DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}" +SRC_FOLDER="$(cd "$2" > /dev/null; pwd)" +test -z "$VOLUME_NAME" && VOLUME_NAME="$(basename "$DMG_PATH" .dmg)" + +AUX_PATH="$SCRIPT_DIR/support" + +test -d "$AUX_PATH" || { + echo "Cannot find support directory: $AUX_PATH" + exit 1 +} + +if [ -f "$SRC_FOLDER/.DS_Store" ]; then + echo "Deleting any .DS_Store in source folder" + rm "$SRC_FOLDER/.DS_Store" +fi + +# Create the image +echo "Creating disk image..." +test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}" +ACTUAL_SIZE=`du -sm "$SRC_FOLDER" | sed -e 's/ .*//g'` +DISK_IMAGE_SIZE=$(expr $ACTUAL_SIZE + 20) +hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}" + +# mount it +echo "Mounting disk image..." +MOUNT_DIR="/Volumes/${VOLUME_NAME}" + +# try unmount dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it) +echo "Unmounting disk image..." +DEV_NAME=$(hdiutil info | egrep '^/dev/' | sed 1q | awk '{print $1}') +test -d "${MOUNT_DIR}" && hdiutil detach "${DEV_NAME}" + +echo "Mount directory: $MOUNT_DIR" +DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}') +echo "Device name: $DEV_NAME" + +if ! test -z "$BACKGROUND_FILE"; then + echo "Copying background file..." + test -d "$MOUNT_DIR/.background" || mkdir "$MOUNT_DIR/.background" + cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME" +fi + +if ! test -z "$APPLICATION_LINK"; then + echo "making link to Applications dir" + echo $MOUNT_DIR + ln -s /Applications "$MOUNT_DIR/Applications" +fi + +if ! test -z "$VOLUME_ICON_FILE"; then + echo "Copying volume icon file '$VOLUME_ICON_FILE'..." + cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns" + SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns" +fi + +# run applescript +APPLESCRIPT=$(mktemp -t createdmg) +cat "$AUX_PATH/template.applescript" | sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" -e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" -e "s/REPOSITION_HIDDEN_FILES_CLAUSE/$REPOSITION_HIDDEN_FILES_CLAUSE/g" -e "s/ICON_SIZE/$ICON_SIZE/g" -e "s/TEXT_SIZE/$TEXT_SIZE/g" | perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" | perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" | perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" >"$APPLESCRIPT" + +echo "Running Applescript: /usr/bin/osascript \"${APPLESCRIPT}\" \"${VOLUME_NAME}\"" +"/usr/bin/osascript" "${APPLESCRIPT}" "${VOLUME_NAME}" || true +echo "Done running the applescript..." +sleep 4 + +rm "$APPLESCRIPT" + +# make sure it's not world writeable +echo "Fixing permissions..." +chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true +echo "Done fixing permissions." + +# make the top window open itself on mount: +echo "Blessing started" +bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}" +echo "Blessing finished" + +if ! test -z "$VOLUME_ICON_FILE"; then + # tell the volume that it has a special file attribute + SetFile -a C "$MOUNT_DIR" +fi + +# unmount +echo "Unmounting disk image..." +hdiutil detach "${DEV_NAME}" + +# compress image +echo "Compressing disk image..." +hdiutil convert "${DMG_TEMP_NAME}" -format UDBZ -o "${DMG_DIR}/${DMG_NAME}" +rm -f "${DMG_TEMP_NAME}" + +# adding EULA resources +if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then + echo "adding EULA resources" + "${AUX_PATH}/dmg-license.py" "${DMG_DIR}/${DMG_NAME}" "${EULA_RSRC}" +fi + +if [ ! -z "${NOINTERNET}" -a "${NOINTERNET}" == 1 ]; then + echo "not setting 'internet-enable' on the dmg" +else + hdiutil internet-enable -yes "${DMG_DIR}/${DMG_NAME}" +fi + +echo "Disk image done" +exit 0 diff --git a/src/create-dmg/support/dmg-license.py b/src/create-dmg/support/dmg-license.py new file mode 100755 index 0000000000..9003a7c5e7 --- /dev/null +++ b/src/create-dmg/support/dmg-license.py @@ -0,0 +1,163 @@ +#! /usr/bin/env python +""" +This script adds a license file to a DMG. Requires Xcode and a plain ascii text +license file. +Obviously only runs on a Mac. + +Copyright (C) 2011-2013 Jared Hobbs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" +import os +import sys +import tempfile +import optparse + + +class Path(str): + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + os.unlink(self) + + +def mktemp(dir=None, suffix=''): + (fd, filename) = tempfile.mkstemp(dir=dir, suffix=suffix) + os.close(fd) + return Path(filename) + + +def main(options, args): + dmgFile, license = args + with mktemp('.') as tmpFile: + with open(tmpFile, 'w') as f: + f.write("""data 'TMPL' (128, "LPic") { + $"1344 6566 6175 6C74 204C 616E 6775 6167" + $"6520 4944 4457 5244 0543 6F75 6E74 4F43" + $"4E54 042A 2A2A 2A4C 5354 430B 7379 7320" + $"6C61 6E67 2049 4444 5752 441E 6C6F 6361" + $"6C20 7265 7320 4944 2028 6F66 6673 6574" + $"2066 726F 6D20 3530 3030 4457 5244 1032" + $"2D62 7974 6520 6C61 6E67 7561 6765 3F44" + $"5752 4404 2A2A 2A2A 4C53 5445" +}; + +data 'LPic' (5000) { + $"0000 0002 0000 0000 0000 0000 0004 0000" +}; + +data 'STR#' (5000, "English buttons") { + $"0006 0D45 6E67 6C69 7368 2074 6573 7431" + $"0541 6772 6565 0844 6973 6167 7265 6505" + $"5072 696E 7407 5361 7665 2E2E 2E7A 4966" + $"2079 6F75 2061 6772 6565 2077 6974 6820" + $"7468 6520 7465 726D 7320 6F66 2074 6869" + $"7320 6C69 6365 6E73 652C 2063 6C69 636B" + $"2022 4167 7265 6522 2074 6F20 6163 6365" + $"7373 2074 6865 2073 6F66 7477 6172 652E" + $"2020 4966 2079 6F75 2064 6F20 6E6F 7420" + $"6167 7265 652C 2070 7265 7373 2022 4469" + $"7361 6772 6565 2E22" +}; + +data 'STR#' (5002, "English") { + $"0006 0745 6E67 6C69 7368 0541 6772 6565" + $"0844 6973 6167 7265 6505 5072 696E 7407" + $"5361 7665 2E2E 2E7B 4966 2079 6F75 2061" + $"6772 6565 2077 6974 6820 7468 6520 7465" + $"726D 7320 6F66 2074 6869 7320 6C69 6365" + $"6E73 652C 2070 7265 7373 2022 4167 7265" + $"6522 2074 6F20 696E 7374 616C 6C20 7468" + $"6520 736F 6674 7761 7265 2E20 2049 6620" + $"796F 7520 646F 206E 6F74 2061 6772 6565" + $"2C20 7072 6573 7320 2244 6973 6167 7265" + $"6522 2E" +};\n\n""") + with open(license, 'r') as l: + kind = 'RTF ' if license.lower().endswith('.rtf') else 'TEXT' + f.write('data \'%s\' (5000, "English") {\n' % kind) + def escape(s): + return s.strip().replace('\\', '\\\\').replace('"', '\\"') + + for line in l: + if len(line) < 1000: + f.write(' "' + escape(line) + '\\n"\n') + else: + for liner in line.split('.'): + f.write(' "' + escape(liner) + '. \\n"\n') + f.write('};\n\n') + f.write("""data 'styl' (5000, "English") { + $"0003 0000 0000 000C 0009 0014 0000 0000" + $"0000 0000 0000 0000 0027 000C 0009 0014" + $"0100 0000 0000 0000 0000 0000 002A 000C" + $"0009 0014 0000 0000 0000 0000 0000" +};\n""") + os.system('hdiutil unflatten -quiet "%s"' % dmgFile) + ret = os.system('%s -a %s -o "%s"' % + (options.rez, tmpFile, dmgFile)) + os.system('hdiutil flatten -quiet "%s"' % dmgFile) + if options.compression is not None: + os.system('cp %s %s.temp.dmg' % (dmgFile, dmgFile)) + os.remove(dmgFile) + if options.compression == "bz2": + os.system('hdiutil convert %s.temp.dmg -format UDBZ -o %s' % + (dmgFile, dmgFile)) + elif options.compression == "gz": + os.system('hdiutil convert %s.temp.dmg -format ' % dmgFile + + 'UDZO -imagekey zlib-devel=9 -o %s' % dmgFile) + os.remove('%s.temp.dmg' % dmgFile) + if ret == 0: + print "Successfully added license to '%s'" % dmgFile + else: + print "Failed to add license to '%s'" % dmgFile + +if __name__ == '__main__': + parser = optparse.OptionParser() + parser.set_usage("""%prog <dmgFile> <licenseFile> [OPTIONS] + This program adds a software license agreement to a DMG file. + It requires Xcode and either a plain ascii text <licenseFile> + or a <licenseFile.rtf> with the RTF contents. + + See --help for more details.""") + parser.add_option( + '--rez', + '-r', + action='store', + default='/Applications/Xcode.app/Contents/Developer/Tools/Rez', + help='The path to the Rez tool. Defaults to %default' + ) + parser.add_option( + '--compression', + '-c', + action='store', + choices=['bz2', 'gz'], + default=None, + help='Optionally compress dmg using specified compression type. ' + 'Choices are bz2 and gz.' + ) + options, args = parser.parse_args() + cond = len(args) != 2 + if not os.path.exists(options.rez): + print 'Failed to find Rez at "%s"!\n' % options.rez + cond = True + if cond: + parser.print_usage() + sys.exit(1) + main(options, args) diff --git a/src/create-dmg/support/template.applescript b/src/create-dmg/support/template.applescript new file mode 100644 index 0000000000..2a7f2aa0b6 --- /dev/null +++ b/src/create-dmg/support/template.applescript @@ -0,0 +1,79 @@ +on run (volumeName) + tell application "Finder" + tell disk (volumeName as string) + open + + set theXOrigin to WINX + set theYOrigin to WINY + set theWidth to WINW + set theHeight to WINH + + set theBottomRightX to (theXOrigin + theWidth) + set theBottomRightY to (theYOrigin + theHeight) + set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\"" + + tell container window + set current view to icon view + set toolbar visible to false + set statusbar visible to false + set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY} + set statusbar visible to false + REPOSITION_HIDDEN_FILES_CLAUSE + end tell + + set opts to the icon view options of container window + tell opts + set icon size to ICON_SIZE + set text size to TEXT_SIZE + set arrangement to not arranged + end tell + BACKGROUND_CLAUSE + + -- Positioning + POSITION_CLAUSE + + -- Hiding + HIDING_CLAUSE + + -- Application Link Clause + APPLICATION_CLAUSE + close + open + + update without registering applications + -- Force saving of the size + delay 1 + + tell container window + set statusbar visible to false + set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10} + end tell + + update without registering applications + end tell + + delay 1 + + tell disk (volumeName as string) + tell container window + set statusbar visible to false + set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY} + end tell + + update without registering applications + end tell + + --give the finder some time to write the .DS_Store file + delay 3 + + set waitTime to 0 + set ejectMe to false + repeat while ejectMe is false + delay 1 + set waitTime to waitTime + 1 + + if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true + end repeat + log "waited " & waitTime & " seconds for .DS_STORE to be created." + end tell +end run diff --git a/src/create_cmdidxs.vim b/src/create_cmdidxs.vim new file mode 100644 index 0000000000..c306ccb872 --- /dev/null +++ b/src/create_cmdidxs.vim @@ -0,0 +1,81 @@ +" This script generates the tables cmdidxs1[] and cmdidxs2[][] which, +" given a Ex command, determine the first value to probe to find +" a matching command in cmdnames[] based on the first character +" and the first 2 characters of the command. +" This is used to speed up lookup in cmdnames[]. +" +" Script should be run every time new Ex commands are added in Vim, +" from the src/vim directory, since it reads commands from "ex_cmds.h". + +let cmds = [] +let skipped_cmds = 0 + +for line in readfile('ex_cmds.h') + if line =~ '^EX(CMD_' + let m = matchlist(line, '^EX(CMD_\S*,\s*"\([a-z][^"]*\)"') + if len(m) >= 2 + let cmds += [ m[1] ] + else + let skipped_cmds += 1 + endif + endif +endfor + +let cmdidxs1 = {} +let cmdidxs2 = {} + +for i in range(len(cmds) - 1, 0, -1) + let cmd = cmds[i] + let c1 = cmd[0] " First character of command + let c2 = cmd[1] " Second character of command (if any) + + let cmdidxs1{c1} = i + if c2 >= 'a' && c2 <= 'z' + let cmdidxs2{c1}{c2} = i + endif +endfor + +let output = [ '/* Automatically generated code by create_cmdidxs.vim' ] +let output += [ ' *' ] +let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] +let output += [ ' * based on the first letter of a command.' ] +let output += [ ' */' ] +let output += [ 'static const unsigned short cmdidxs1[26] =' ] +let output += [ '{' ] + +let a_to_z = map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)') +for c1 in a_to_z + let line = ' /* ' . c1 . ' */ ' . cmdidxs1{c1} . ((c1 == 'z') ? '' : ',') + let output += [ line ] +endfor +let output += [ '};' ] +let output += [ '' ] +let output += [ '/*' ] +let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] +let output += [ ' * based on the first 2 letters of a command.' ] +let output += [ ' * Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they' ] +let output += [ ' * fit in a byte.' ] +let output += [ ' */' ] +let output += [ 'static const unsigned char cmdidxs2[26][26] =' ] +let output += [ '{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */' ] + +for c1 in a_to_z + let line = ' /* ' . c1 . ' */ {' + for c2 in a_to_z + if exists('cmdidxs2{c1}{c2}') + let line .= printf('%3d', cmdidxs2{c1}{c2} - cmdidxs1{c1}) + else + let line .= ' 0' + endif + let line .= (c2 == 'z') ? '' : ',' + endfor + let line .= ' }' . ((c1 == 'z') ? '' : ',') + let output += [ line ] +endfor + +let output += [ '};' ] +let output += [ '' ] +let output += [ 'static const int command_count = ' . (len(cmds) + skipped_cmds) . ';' ] + +call writefile(output, "ex_cmdidxs.h") +quit diff --git a/src/crypt.c b/src/crypt.c new file mode 100644 index 0000000000..dfbf02ca5f --- /dev/null +++ b/src/crypt.c @@ -0,0 +1,591 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * crypt.c: Generic encryption support. + */ +#include "vim.h" + +#if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Optional encryption support. + * Mohsin Ahmed, mosh@sasi.com, 1998-09-24 + * Based on zip/crypt sources. + * Refactored by David Leadbeater, 2014. + * + * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to + * most countries. There are a few exceptions, but that still should not be a + * problem since this code was originally created in Europe and India. + * + * Blowfish addition originally made by Mohsin Ahmed, + * http://www.cs.albany.edu/~mosh 2010-03-14 + * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html) + * and sha256 by Christophe Devine. + */ + +typedef struct { + char *name; /* encryption name as used in 'cryptmethod' */ + char *magic; /* magic bytes stored in file header */ + int salt_len; /* length of salt, or 0 when not using salt */ + int seed_len; /* length of seed, or 0 when not using salt */ + int works_inplace; /* encryption/decryption can be done in-place */ + int whole_undofile; /* whole undo file is encrypted */ + + /* Optional function pointer for a self-test. */ + int (* self_test_fn)(); + + /* Function pointer for initializing encryption/decription. */ + void (* init_fn)(cryptstate_T *state, char_u *key, + char_u *salt, int salt_len, char_u *seed, int seed_len); + + /* Function pointers for encoding/decoding from one buffer into another. + * Optional, however, these or the _buffer ones should be configured. */ + void (*encode_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u *to); + void (*decode_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u *to); + + /* Function pointers for encoding and decoding, can buffer data if needed. + * Optional (however, these or the above should be configured). */ + long (*encode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u **newptr); + long (*decode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u **newptr); + + /* Function pointers for in-place encoding and decoding, used for + * crypt_*_inplace(). "from" and "to" arguments will be equal. + * These may be the same as decode_fn and encode_fn above, however an + * algorithm may implement them in a way that is not interchangeable with + * the crypt_(en|de)code() interface (for example because it wishes to add + * padding to files). + * This method is used for swap and undo files which have a rigid format. + */ + void (*encode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len, + char_u *p2); + void (*decode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len, + char_u *p2); +} cryptmethod_T; + +/* index is method_nr of cryptstate_T, CRYPT_M_* */ +static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { + /* PK_Zip; very weak */ + { + "zip", + "VimCrypt~01!", + 0, + 0, + TRUE, + FALSE, + NULL, + crypt_zip_init, + crypt_zip_encode, crypt_zip_decode, + NULL, NULL, + crypt_zip_encode, crypt_zip_decode, + }, + + /* Blowfish/CFB + SHA-256 custom key derivation; implementation issues. */ + { + "blowfish", + "VimCrypt~02!", + 8, + 8, + TRUE, + FALSE, + blowfish_self_test, + crypt_blowfish_init, + crypt_blowfish_encode, crypt_blowfish_decode, + NULL, NULL, + crypt_blowfish_encode, crypt_blowfish_decode, + }, + + /* Blowfish/CFB + SHA-256 custom key derivation; fixed. */ + { + "blowfish2", + "VimCrypt~03!", + 8, + 8, + TRUE, + TRUE, + blowfish_self_test, + crypt_blowfish_init, + crypt_blowfish_encode, crypt_blowfish_decode, + NULL, NULL, + crypt_blowfish_encode, crypt_blowfish_decode, + }, + + /* NOTE: when adding a new method, use some random bytes for the magic key, + * to avoid that a text file is recognized as encrypted. */ +}; + +#define CRYPT_MAGIC_LEN 12 /* cannot change */ +static char crypt_magic_head[] = "VimCrypt~"; + +/* + * Return int value for crypt method name. + * 0 for "zip", the old method. Also for any non-valid value. + * 1 for "blowfish". + * 2 for "blowfish2". + */ + int +crypt_method_nr_from_name(char_u *name) +{ + int i; + + for (i = 0; i < CRYPT_M_COUNT; ++i) + if (STRCMP(name, cryptmethods[i].name) == 0) + return i; + return 0; +} + +/* + * Get the crypt method used for a file from "ptr[len]", the magic text at the + * start of the file. + * Returns -1 when no encryption used. + */ + int +crypt_method_nr_from_magic(char *ptr, int len) +{ + int i; + + if (len < CRYPT_MAGIC_LEN) + return -1; + + for (i = 0; i < CRYPT_M_COUNT; i++) + if (memcmp(ptr, cryptmethods[i].magic, CRYPT_MAGIC_LEN) == 0) + return i; + + i = (int)STRLEN(crypt_magic_head); + if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) + EMSG(_("E821: File is encrypted with unknown method")); + + return -1; +} + +/* + * Return TRUE if the crypt method for "method_nr" can be done in-place. + */ + int +crypt_works_inplace(cryptstate_T *state) +{ + return cryptmethods[state->method_nr].works_inplace; +} + +/* + * Get the crypt method for buffer "buf" as a number. + */ + int +crypt_get_method_nr(buf_T *buf) +{ + return crypt_method_nr_from_name(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); +} + +/* + * Return TRUE when the buffer uses an encryption method that encrypts the + * whole undo file, not only the text. + */ + int +crypt_whole_undofile(int method_nr) +{ + return cryptmethods[method_nr].whole_undofile; +} + +/* + * Get crypt method specifc length of the file header in bytes. + */ + int +crypt_get_header_len(int method_nr) +{ + return CRYPT_MAGIC_LEN + + cryptmethods[method_nr].salt_len + + cryptmethods[method_nr].seed_len; +} + +/* + * Set the crypt method for buffer "buf" to "method_nr" using the int value as + * returned by crypt_method_nr_from_name(). + */ + void +crypt_set_cm_option(buf_T *buf, int method_nr) +{ + free_string_option(buf->b_p_cm); + buf->b_p_cm = vim_strsave((char_u *)cryptmethods[method_nr].name); +} + +/* + * If the crypt method for the current buffer has a self-test, run it and + * return OK/FAIL. + */ + int +crypt_self_test(void) +{ + int method_nr = crypt_get_method_nr(curbuf); + + if (cryptmethods[method_nr].self_test_fn == NULL) + return OK; + return cryptmethods[method_nr].self_test_fn(); +} + +/* + * Allocate a crypt state and initialize it. + */ + cryptstate_T * +crypt_create( + int method_nr, + char_u *key, + char_u *salt, + int salt_len, + char_u *seed, + int seed_len) +{ + cryptstate_T *state = (cryptstate_T *)alloc((int)sizeof(cryptstate_T)); + + state->method_nr = method_nr; + cryptmethods[method_nr].init_fn(state, key, salt, salt_len, seed, seed_len); + return state; +} + +/* + * Allocate a crypt state from a file header and initialize it. + * Assumes that header contains at least the number of bytes that + * crypt_get_header_len() returns for "method_nr". + */ + cryptstate_T * +crypt_create_from_header( + int method_nr, + char_u *key, + char_u *header) +{ + char_u *salt = NULL; + char_u *seed = NULL; + int salt_len = cryptmethods[method_nr].salt_len; + int seed_len = cryptmethods[method_nr].seed_len; + + if (salt_len > 0) + salt = header + CRYPT_MAGIC_LEN; + if (seed_len > 0) + seed = header + CRYPT_MAGIC_LEN + salt_len; + + return crypt_create(method_nr, key, salt, salt_len, seed, seed_len); +} + +/* + * Read the crypt method specific header data from "fp". + * Return an allocated cryptstate_T or NULL on error. + */ + cryptstate_T * +crypt_create_from_file(FILE *fp, char_u *key) +{ + int method_nr; + int header_len; + char magic_buffer[CRYPT_MAGIC_LEN]; + char_u *buffer; + cryptstate_T *state; + + if (fread(magic_buffer, CRYPT_MAGIC_LEN, 1, fp) != 1) + return NULL; + method_nr = crypt_method_nr_from_magic(magic_buffer, CRYPT_MAGIC_LEN); + if (method_nr < 0) + return NULL; + + header_len = crypt_get_header_len(method_nr); + if ((buffer = alloc(header_len)) == NULL) + return NULL; + mch_memmove(buffer, magic_buffer, CRYPT_MAGIC_LEN); + if (header_len > CRYPT_MAGIC_LEN + && fread(buffer + CRYPT_MAGIC_LEN, + header_len - CRYPT_MAGIC_LEN, 1, fp) != 1) + { + vim_free(buffer); + return NULL; + } + + state = crypt_create_from_header(method_nr, key, buffer); + vim_free(buffer); + return state; +} + +/* + * Allocate a cryptstate_T for writing and initialize it with "key". + * Allocates and fills in the header and stores it in "header", setting + * "header_len". The header may include salt and seed, depending on + * cryptmethod. Caller must free header. + * Returns the state or NULL on failure. + */ + cryptstate_T * +crypt_create_for_writing( + int method_nr, + char_u *key, + char_u **header, + int *header_len) +{ + int len = crypt_get_header_len(method_nr); + char_u *salt = NULL; + char_u *seed = NULL; + int salt_len = cryptmethods[method_nr].salt_len; + int seed_len = cryptmethods[method_nr].seed_len; + cryptstate_T *state; + + *header_len = len; + *header = alloc(len); + if (*header == NULL) + return NULL; + + mch_memmove(*header, cryptmethods[method_nr].magic, CRYPT_MAGIC_LEN); + if (salt_len > 0 || seed_len > 0) + { + if (salt_len > 0) + salt = *header + CRYPT_MAGIC_LEN; + if (seed_len > 0) + seed = *header + CRYPT_MAGIC_LEN + salt_len; + + /* TODO: Should this be crypt method specific? (Probably not worth + * it). sha2_seed is pretty bad for large amounts of entropy, so make + * that into something which is suitable for anything. */ + sha2_seed(salt, salt_len, seed, seed_len); + } + + state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len); + if (state == NULL) + VIM_CLEAR(*header); + return state; +} + +/* + * Free the crypt state. + */ + void +crypt_free_state(cryptstate_T *state) +{ + vim_free(state->method_state); + vim_free(state); +} + +/* + * Encode "from[len]" and store the result in a newly allocated buffer, which + * is stored in "newptr". + * Return number of bytes in "newptr", 0 for need more or -1 on error. + */ + long +crypt_encode_alloc( + cryptstate_T *state, + char_u *from, + size_t len, + char_u **newptr) +{ + cryptmethod_T *method = &cryptmethods[state->method_nr]; + + if (method->encode_buffer_fn != NULL) + /* Has buffer function, pass through. */ + return method->encode_buffer_fn(state, from, len, newptr); + if (len == 0) + /* Not buffering, just return EOF. */ + return (long)len; + + *newptr = alloc((long)len); + if (*newptr == NULL) + return -1; + method->encode_fn(state, from, len, *newptr); + return (long)len; +} + +/* + * Decrypt "ptr[len]" and store the result in a newly allocated buffer, which + * is stored in "newptr". + * Return number of bytes in "newptr", 0 for need more or -1 on error. + */ + long +crypt_decode_alloc( + cryptstate_T *state, + char_u *ptr, + long len, + char_u **newptr) +{ + cryptmethod_T *method = &cryptmethods[state->method_nr]; + + if (method->decode_buffer_fn != NULL) + /* Has buffer function, pass through. */ + return method->decode_buffer_fn(state, ptr, len, newptr); + + if (len == 0) + /* Not buffering, just return EOF. */ + return len; + + *newptr = alloc(len); + if (*newptr == NULL) + return -1; + method->decode_fn(state, ptr, len, *newptr); + return len; +} + +/* + * Encrypting "from[len]" into "to[len]". + */ + void +crypt_encode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) +{ + cryptmethods[state->method_nr].encode_fn(state, from, len, to); +} + +/* + * decrypting "from[len]" into "to[len]". + */ + void +crypt_decode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) +{ + cryptmethods[state->method_nr].decode_fn(state, from, len, to); +} + +/* + * Simple inplace encryption, modifies "buf[len]" in place. + */ + void +crypt_encode_inplace( + cryptstate_T *state, + char_u *buf, + size_t len) +{ + cryptmethods[state->method_nr].encode_inplace_fn(state, buf, len, buf); +} + +/* + * Simple inplace decryption, modifies "buf[len]" in place. + */ + void +crypt_decode_inplace( + cryptstate_T *state, + char_u *buf, + size_t len) +{ + cryptmethods[state->method_nr].decode_inplace_fn(state, buf, len, buf); +} + +/* + * Free an allocated crypt key. Clear the text to make sure it doesn't stay + * in memory anywhere. + */ + void +crypt_free_key(char_u *key) +{ + char_u *p; + + if (key != NULL) + { + for (p = key; *p != NUL; ++p) + *p = 0; + vim_free(key); + } +} + +/* + * Check the crypt method and give a warning if it's outdated. + */ + void +crypt_check_method(int method) +{ + if (method < CRYPT_M_BF2) + { + msg_scroll = TRUE; + MSG(_("Warning: Using a weak encryption method; see :help 'cm'")); + } +} + + void +crypt_check_current_method(void) +{ + crypt_check_method(crypt_get_method_nr(curbuf)); +} + +/* + * Ask the user for a crypt key. + * When "store" is TRUE, the new key is stored in the 'key' option, and the + * 'key' option value is returned: Don't free it. + * When "store" is FALSE, the typed key is returned in allocated memory. + * Returns NULL on failure. + */ + char_u * +crypt_get_key( + int store, + int twice) /* Ask for the key twice. */ +{ + char_u *p1, *p2 = NULL; + int round; + + for (round = 0; ; ++round) + { + cmdline_star = TRUE; + cmdline_row = msg_row; + p1 = getcmdline_prompt(NUL, round == 0 + ? (char_u *)_("Enter encryption key: ") + : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING, + NULL); + cmdline_star = FALSE; + + if (p1 == NULL) + break; + + if (round == twice) + { + if (p2 != NULL && STRCMP(p1, p2) != 0) + { + MSG(_("Keys don't match!")); + crypt_free_key(p1); + crypt_free_key(p2); + p2 = NULL; + round = -1; /* do it again */ + continue; + } + + if (store) + { + set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL); + crypt_free_key(p1); + p1 = curbuf->b_p_key; + } + break; + } + p2 = p1; + } + + /* since the user typed this, no need to wait for return */ + if (msg_didout) + msg_putchar('\n'); + need_wait_return = FALSE; + msg_didout = FALSE; + + crypt_free_key(p2); + return p1; +} + + +/* + * Append a message to IObuff for the encryption/decryption method being used. + */ + void +crypt_append_msg( + buf_T *buf) +{ + if (crypt_get_method_nr(buf) == 0) + STRCAT(IObuff, _("[crypted]")); + else + { + STRCAT(IObuff, "["); + STRCAT(IObuff, *buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); + STRCAT(IObuff, "]"); + } +} + +#endif /* FEAT_CRYPT */ diff --git a/src/crypt_zip.c b/src/crypt_zip.c new file mode 100644 index 0000000000..08cf6082cf --- /dev/null +++ b/src/crypt_zip.c @@ -0,0 +1,158 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * crypt_zip.c: Zip encryption support. + */ +#include "vim.h" + +#if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Optional encryption support. + * Mohsin Ahmed, mosh@sasi.com, 98-09-24 + * Based on zip/crypt sources. + * + * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to + * most countries. There are a few exceptions, but that still should not be a + * problem since this code was originally created in Europe and India. + */ + +/* Need a type that should be 32 bits. 64 also works but wastes space. */ +# if VIM_SIZEOF_INT >= 4 +typedef unsigned int u32_T; /* int is at least 32 bits */ +# else +typedef unsigned long u32_T; /* long should be 32 bits or more */ +# endif + +/* The state of encryption, referenced by cryptstate_T. */ +typedef struct { + u32_T keys[3]; +} zip_state_T; + + +static void make_crc_tab(void); + +static u32_T crc_32_table[256]; + +/* + * Fill the CRC table, if not done already. + */ + static void +make_crc_tab(void) +{ + u32_T s, t, v; + static int done = FALSE; + + if (done) + return; + for (t = 0; t < 256; t++) + { + v = t; + for (s = 0; s < 8; s++) + v = (v >> 1) ^ ((v & 1) * (u32_T)0xedb88320L); + crc_32_table[t] = v; + } + done = TRUE; +} + +#define CRC32(c, b) (crc_32_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) + +/* + * Return the next byte in the pseudo-random sequence. + */ +#define DECRYPT_BYTE_ZIP(keys, t) { \ + short_u temp = (short_u)keys[2] | 2; \ + t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \ +} + +/* + * Update the encryption keys with the next byte of plain text. + */ +#define UPDATE_KEYS_ZIP(keys, c) { \ + keys[0] = CRC32(keys[0], (c)); \ + keys[1] += keys[0] & 0xff; \ + keys[1] = keys[1] * 134775813L + 1; \ + keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \ +} + +/* + * Initialize for encryption/decryption. + */ + void +crypt_zip_init( + cryptstate_T *state, + char_u *key, + char_u *salt UNUSED, + int salt_len UNUSED, + char_u *seed UNUSED, + int seed_len UNUSED) +{ + char_u *p; + zip_state_T *zs; + + zs = (zip_state_T *)alloc(sizeof(zip_state_T)); + state->method_state = zs; + + make_crc_tab(); + zs->keys[0] = 305419896L; + zs->keys[1] = 591751049L; + zs->keys[2] = 878082192L; + for (p = key; *p != NUL; ++p) + { + UPDATE_KEYS_ZIP(zs->keys, (int)*p); + } +} + +/* + * Encrypt "from[len]" into "to[len]". + * "from" and "to" can be equal to encrypt in place. + */ + void +crypt_zip_encode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) +{ + zip_state_T *zs = state->method_state; + size_t i; + int ztemp, t; + + for (i = 0; i < len; ++i) + { + ztemp = from[i]; + DECRYPT_BYTE_ZIP(zs->keys, t); + UPDATE_KEYS_ZIP(zs->keys, ztemp); + to[i] = t ^ ztemp; + } +} + +/* + * Decrypt "from[len]" into "to[len]". + */ + void +crypt_zip_decode( + cryptstate_T *state, + char_u *from, + size_t len, + char_u *to) +{ + zip_state_T *zs = state->method_state; + size_t i; + short_u temp; + + for (i = 0; i < len; ++i) + { + temp = (short_u)zs->keys[2] | 2; + temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); + UPDATE_KEYS_ZIP(zs->keys, to[i] = from[i] ^ temp); + } +} + +#endif /* FEAT_CRYPT */ diff --git a/src/dehqx.py b/src/dehqx.py index 34d9ae4b0b..00e8f9f340 100644 --- a/src/dehqx.py +++ b/src/dehqx.py @@ -1,7 +1,7 @@ # Python script to get both the data and resource fork from a BinHex encoded # file. # Author: MURAOKA Taro <koron.kaoriya@gmail.com> -# Last Change: 2012 Jun 29 +# Last Change: 2018 Mar 27 # # Copyright (C) 2003,12 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. @@ -15,11 +15,13 @@ out = conv.FName out_data = out out_rsrc = out + '.rsrcfork' -#print 'out_rsrc=' + out_rsrc -print 'In file: ' + input + +# This uses the print statement on Python 2, print function on Python 3. +#print('out_rsrc=' + out_rsrc) +print('In file: ' + input) outfile = open(out_data, 'wb') -print ' Out data fork: ' + out_data +print(' Out data fork: ' + out_data) while 1: d = conv.read(128000) if not d: break @@ -29,7 +31,7 @@ d = conv.read_rsrc(128000) if d: - print ' Out rsrc fork: ' + out_rsrc + print(' Out rsrc fork: ' + out_rsrc) outfile = open(out_rsrc, 'wb') outfile.write(d) while 1: diff --git a/src/dict.c b/src/dict.c new file mode 100644 index 0000000000..55069783f2 --- /dev/null +++ b/src/dict.c @@ -0,0 +1,879 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * dict.c: Dictionary support + */ + +#include "vim.h" + +#if defined(FEAT_EVAL) || defined(PROTO) + +/* List head for garbage collection. Although there can be a reference loop + * from partial to dict to partial, we don't need to keep track of the partial, + * since it will get freed when the dict is unused and gets freed. */ +static dict_T *first_dict = NULL; /* list of all dicts */ + +/* + * Allocate an empty header for a dictionary. + */ + dict_T * +dict_alloc(void) +{ + dict_T *d; + + d = (dict_T *)alloc(sizeof(dict_T)); + if (d != NULL) + { + /* Add the dict to the list of dicts for garbage collection. */ + if (first_dict != NULL) + first_dict->dv_used_prev = d; + d->dv_used_next = first_dict; + d->dv_used_prev = NULL; + first_dict = d; + + hash_init(&d->dv_hashtab); + d->dv_lock = 0; + d->dv_scope = 0; + d->dv_refcount = 0; + d->dv_copyID = 0; + } + return d; +} + + dict_T * +dict_alloc_lock(int lock) +{ + dict_T *d = dict_alloc(); + + if (d != NULL) + d->dv_lock = lock; + return d; +} + +/* + * Allocate an empty dict for a return value. + * Returns OK or FAIL. + */ + int +rettv_dict_alloc(typval_T *rettv) +{ + dict_T *d = dict_alloc_lock(0); + + if (d == NULL) + return FAIL; + + rettv_dict_set(rettv, d); + return OK; +} + +/* + * Set a dictionary as the return value + */ + void +rettv_dict_set(typval_T *rettv, dict_T *d) +{ + rettv->v_type = VAR_DICT; + rettv->vval.v_dict = d; + if (d != NULL) + ++d->dv_refcount; +} + +/* + * Free a Dictionary, including all non-container items it contains. + * Ignores the reference count. + */ + void +dict_free_contents(dict_T *d) +{ + int todo; + hashitem_T *hi; + dictitem_T *di; + + /* Lock the hashtab, we don't want it to resize while freeing items. */ + hash_lock(&d->dv_hashtab); + todo = (int)d->dv_hashtab.ht_used; + for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + /* Remove the item before deleting it, just in case there is + * something recursive causing trouble. */ + di = HI2DI(hi); + hash_remove(&d->dv_hashtab, hi); + dictitem_free(di); + --todo; + } + } + + /* The hashtab is still locked, it has to be re-initialized anyway */ + hash_clear(&d->dv_hashtab); +} + + static void +dict_free_dict(dict_T *d) +{ + /* Remove the dict from the list of dicts for garbage collection. */ + if (d->dv_used_prev == NULL) + first_dict = d->dv_used_next; + else + d->dv_used_prev->dv_used_next = d->dv_used_next; + if (d->dv_used_next != NULL) + d->dv_used_next->dv_used_prev = d->dv_used_prev; + vim_free(d); +} + + static void +dict_free(dict_T *d) +{ + if (!in_free_unref_items) + { + dict_free_contents(d); + dict_free_dict(d); + } +} + +/* + * Unreference a Dictionary: decrement the reference count and free it when it + * becomes zero. + */ + void +dict_unref(dict_T *d) +{ + if (d != NULL && --d->dv_refcount <= 0) + dict_free(d); +} + +/* + * Go through the list of dicts and free items without the copyID. + * Returns TRUE if something was freed. + */ + int +dict_free_nonref(int copyID) +{ + dict_T *dd; + int did_free = FALSE; + + for (dd = first_dict; dd != NULL; dd = dd->dv_used_next) + if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + { + /* Free the Dictionary and ordinary items it contains, but don't + * recurse into Lists and Dictionaries, they will be in the list + * of dicts or list of lists. */ + dict_free_contents(dd); + did_free = TRUE; + } + return did_free; +} + + void +dict_free_items(int copyID) +{ + dict_T *dd, *dd_next; + + for (dd = first_dict; dd != NULL; dd = dd_next) + { + dd_next = dd->dv_used_next; + if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + dict_free_dict(dd); + } +} + +/* + * Allocate a Dictionary item. + * The "key" is copied to the new item. + * Note that the value of the item "di_tv" still needs to be initialized! + * Returns NULL when out of memory. + */ + dictitem_T * +dictitem_alloc(char_u *key) +{ + dictitem_T *di; + + di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key))); + if (di != NULL) + { + STRCPY(di->di_key, key); + di->di_flags = DI_FLAGS_ALLOC; + } + return di; +} + +/* + * Make a copy of a Dictionary item. + */ + static dictitem_T * +dictitem_copy(dictitem_T *org) +{ + dictitem_T *di; + + di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + + STRLEN(org->di_key))); + if (di != NULL) + { + STRCPY(di->di_key, org->di_key); + di->di_flags = DI_FLAGS_ALLOC; + copy_tv(&org->di_tv, &di->di_tv); + } + return di; +} + +/* + * Remove item "item" from Dictionary "dict" and free it. + */ + void +dictitem_remove(dict_T *dict, dictitem_T *item) +{ + hashitem_T *hi; + + hi = hash_find(&dict->dv_hashtab, item->di_key); + if (HASHITEM_EMPTY(hi)) + internal_error("dictitem_remove()"); + else + hash_remove(&dict->dv_hashtab, hi); + dictitem_free(item); +} + +/* + * Free a dict item. Also clears the value. + */ + void +dictitem_free(dictitem_T *item) +{ + clear_tv(&item->di_tv); + if (item->di_flags & DI_FLAGS_ALLOC) + vim_free(item); +} + +/* + * Make a copy of dict "d". Shallow if "deep" is FALSE. + * The refcount of the new dict is set to 1. + * See item_copy() for "copyID". + * Returns NULL when out of memory. + */ + dict_T * +dict_copy(dict_T *orig, int deep, int copyID) +{ + dict_T *copy; + dictitem_T *di; + int todo; + hashitem_T *hi; + + if (orig == NULL) + return NULL; + + copy = dict_alloc(); + if (copy != NULL) + { + if (copyID != 0) + { + orig->dv_copyID = copyID; + orig->dv_copydict = copy; + } + todo = (int)orig->dv_hashtab.ht_used; + for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + + di = dictitem_alloc(hi->hi_key); + if (di == NULL) + break; + if (deep) + { + if (item_copy(&HI2DI(hi)->di_tv, &di->di_tv, deep, + copyID) == FAIL) + { + vim_free(di); + break; + } + } + else + copy_tv(&HI2DI(hi)->di_tv, &di->di_tv); + if (dict_add(copy, di) == FAIL) + { + dictitem_free(di); + break; + } + } + } + + ++copy->dv_refcount; + if (todo > 0) + { + dict_unref(copy); + copy = NULL; + } + } + + return copy; +} + +/* + * Add item "item" to Dictionary "d". + * Returns FAIL when out of memory and when key already exists. + */ + int +dict_add(dict_T *d, dictitem_T *item) +{ + return hash_add(&d->dv_hashtab, item->di_key); +} + +/* + * Add a number or string entry to dictionary "d". + * When "str" is NULL use number "nr", otherwise use "str". + * Returns FAIL when out of memory and when key already exists. + */ + int +dict_add_nr_str( + dict_T *d, + char *key, + varnumber_T nr, + char_u *str) +{ + dictitem_T *item; + + item = dictitem_alloc((char_u *)key); + if (item == NULL) + return FAIL; + item->di_tv.v_lock = 0; + if (str == NULL) + { + item->di_tv.v_type = VAR_NUMBER; + item->di_tv.vval.v_number = nr; + } + else + { + item->di_tv.v_type = VAR_STRING; + item->di_tv.vval.v_string = vim_strsave(str); + } + if (dict_add(d, item) == FAIL) + { + dictitem_free(item); + return FAIL; + } + return OK; +} + +/* + * Add a list entry to dictionary "d". + * Returns FAIL when out of memory and when key already exists. + */ + int +dict_add_list(dict_T *d, char *key, list_T *list) +{ + dictitem_T *item; + + item = dictitem_alloc((char_u *)key); + if (item == NULL) + return FAIL; + item->di_tv.v_lock = 0; + item->di_tv.v_type = VAR_LIST; + item->di_tv.vval.v_list = list; + ++list->lv_refcount; + if (dict_add(d, item) == FAIL) + { + dictitem_free(item); + return FAIL; + } + return OK; +} + +/* + * Add a dict entry to dictionary "d". + * Returns FAIL when out of memory and when key already exists. + */ + int +dict_add_dict(dict_T *d, char *key, dict_T *dict) +{ + dictitem_T *item; + + item = dictitem_alloc((char_u *)key); + if (item == NULL) + return FAIL; + item->di_tv.v_lock = 0; + item->di_tv.v_type = VAR_DICT; + item->di_tv.vval.v_dict = dict; + ++dict->dv_refcount; + if (dict_add(d, item) == FAIL) + { + dictitem_free(item); + return FAIL; + } + return OK; +} + +/* + * Get the number of items in a Dictionary. + */ + long +dict_len(dict_T *d) +{ + if (d == NULL) + return 0L; + return (long)d->dv_hashtab.ht_used; +} + +/* + * Find item "key[len]" in Dictionary "d". + * If "len" is negative use strlen(key). + * Returns NULL when not found. + */ + dictitem_T * +dict_find(dict_T *d, char_u *key, int len) +{ +#define AKEYLEN 200 + char_u buf[AKEYLEN]; + char_u *akey; + char_u *tofree = NULL; + hashitem_T *hi; + + if (d == NULL) + return NULL; + if (len < 0) + akey = key; + else if (len >= AKEYLEN) + { + tofree = akey = vim_strnsave(key, len); + if (akey == NULL) + return NULL; + } + else + { + /* Avoid a malloc/free by using buf[]. */ + vim_strncpy(buf, key, len); + akey = buf; + } + + hi = hash_find(&d->dv_hashtab, akey); + vim_free(tofree); + if (HASHITEM_EMPTY(hi)) + return NULL; + return HI2DI(hi); +} + +/* + * Get a string item from a dictionary. + * When "save" is TRUE allocate memory for it. + * When FALSE a shared buffer is used, can only be used once! + * Returns NULL if the entry doesn't exist or out of memory. + */ + char_u * +get_dict_string(dict_T *d, char_u *key, int save) +{ + dictitem_T *di; + char_u *s; + + di = dict_find(d, key, -1); + if (di == NULL) + return NULL; + s = get_tv_string(&di->di_tv); + if (save && s != NULL) + s = vim_strsave(s); + return s; +} + +/* + * Get a number item from a dictionary. + * Returns 0 if the entry doesn't exist. + */ + varnumber_T +get_dict_number(dict_T *d, char_u *key) +{ + dictitem_T *di; + + di = dict_find(d, key, -1); + if (di == NULL) + return 0; + return get_tv_number(&di->di_tv); +} + +/* + * Return an allocated string with the string representation of a Dictionary. + * May return NULL. + */ + char_u * +dict2string(typval_T *tv, int copyID, int restore_copyID) +{ + garray_T ga; + int first = TRUE; + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + hashitem_T *hi; + char_u *s; + dict_T *d; + int todo; + + if ((d = tv->vval.v_dict) == NULL) + return NULL; + ga_init2(&ga, (int)sizeof(char), 80); + ga_append(&ga, '{'); + + todo = (int)d->dv_hashtab.ht_used; + for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + + if (first) + first = FALSE; + else + ga_concat(&ga, (char_u *)", "); + + tofree = string_quote(hi->hi_key, FALSE); + if (tofree != NULL) + { + ga_concat(&ga, tofree); + vim_free(tofree); + } + ga_concat(&ga, (char_u *)": "); + s = echo_string_core(&HI2DI(hi)->di_tv, &tofree, numbuf, copyID, + FALSE, restore_copyID, TRUE); + if (s != NULL) + ga_concat(&ga, s); + vim_free(tofree); + if (s == NULL || did_echo_string_emsg) + break; + line_breakcheck(); + + } + } + if (todo > 0) + { + vim_free(ga.ga_data); + return NULL; + } + + ga_append(&ga, '}'); + ga_append(&ga, NUL); + return (char_u *)ga.ga_data; +} + +/* + * Allocate a variable for a Dictionary and fill it from "*arg". + * Return OK or FAIL. Returns NOTDONE for {expr}. + */ + int +get_dict_tv(char_u **arg, typval_T *rettv, int evaluate) +{ + dict_T *d = NULL; + typval_T tvkey; + typval_T tv; + char_u *key = NULL; + dictitem_T *item; + char_u *start = skipwhite(*arg + 1); + char_u buf[NUMBUFLEN]; + + /* + * First check if it's not a curly-braces thing: {expr}. + * Must do this without evaluating, otherwise a function may be called + * twice. Unfortunately this means we need to call eval1() twice for the + * first item. + * But {} is an empty Dictionary. + */ + if (*start != '}') + { + if (eval1(&start, &tv, FALSE) == FAIL) /* recursive! */ + return FAIL; + if (*start == '}') + return NOTDONE; + } + + if (evaluate) + { + d = dict_alloc(); + if (d == NULL) + return FAIL; + } + tvkey.v_type = VAR_UNKNOWN; + tv.v_type = VAR_UNKNOWN; + + *arg = skipwhite(*arg + 1); + while (**arg != '}' && **arg != NUL) + { + if (eval1(arg, &tvkey, evaluate) == FAIL) /* recursive! */ + goto failret; + if (**arg != ':') + { + EMSG2(_("E720: Missing colon in Dictionary: %s"), *arg); + clear_tv(&tvkey); + goto failret; + } + if (evaluate) + { + key = get_tv_string_buf_chk(&tvkey, buf); + if (key == NULL) + { + /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ + clear_tv(&tvkey); + goto failret; + } + } + + *arg = skipwhite(*arg + 1); + if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ + { + if (evaluate) + clear_tv(&tvkey); + goto failret; + } + if (evaluate) + { + item = dict_find(d, key, -1); + if (item != NULL) + { + EMSG2(_("E721: Duplicate key in Dictionary: \"%s\""), key); + clear_tv(&tvkey); + clear_tv(&tv); + goto failret; + } + item = dictitem_alloc(key); + clear_tv(&tvkey); + if (item != NULL) + { + item->di_tv = tv; + item->di_tv.v_lock = 0; + if (dict_add(d, item) == FAIL) + dictitem_free(item); + } + } + + if (**arg == '}') + break; + if (**arg != ',') + { + EMSG2(_("E722: Missing comma in Dictionary: %s"), *arg); + goto failret; + } + *arg = skipwhite(*arg + 1); + } + + if (**arg != '}') + { + EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg); +failret: + if (evaluate) + dict_free(d); + return FAIL; + } + + *arg = skipwhite(*arg + 1); + if (evaluate) + rettv_dict_set(rettv, d); + + return OK; +} + +/* + * Go over all entries in "d2" and add them to "d1". + * When "action" is "error" then a duplicate key is an error. + * When "action" is "force" then a duplicate key is overwritten. + * Otherwise duplicate keys are ignored ("action" is "keep"). + */ + void +dict_extend(dict_T *d1, dict_T *d2, char_u *action) +{ + dictitem_T *di1; + hashitem_T *hi2; + int todo; + char_u *arg_errmsg = (char_u *)N_("extend() argument"); + + todo = (int)d2->dv_hashtab.ht_used; + for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) + { + if (!HASHITEM_EMPTY(hi2)) + { + --todo; + di1 = dict_find(d1, hi2->hi_key, -1); + if (d1->dv_scope != 0) + { + /* Disallow replacing a builtin function in l: and g:. + * Check the key to be valid when adding to any scope. */ + if (d1->dv_scope == VAR_DEF_SCOPE + && HI2DI(hi2)->di_tv.v_type == VAR_FUNC + && var_check_func_name(hi2->hi_key, di1 == NULL)) + break; + if (!valid_varname(hi2->hi_key)) + break; + } + if (di1 == NULL) + { + di1 = dictitem_copy(HI2DI(hi2)); + if (di1 != NULL && dict_add(d1, di1) == FAIL) + dictitem_free(di1); + } + else if (*action == 'e') + { + EMSG2(_("E737: Key already exists: %s"), hi2->hi_key); + break; + } + else if (*action == 'f' && HI2DI(hi2) != di1) + { + if (tv_check_lock(di1->di_tv.v_lock, arg_errmsg, TRUE) + || var_check_ro(di1->di_flags, arg_errmsg, TRUE)) + break; + clear_tv(&di1->di_tv); + copy_tv(&HI2DI(hi2)->di_tv, &di1->di_tv); + } + } + } +} + +/* + * Return the dictitem that an entry in a hashtable points to. + */ + dictitem_T * +dict_lookup(hashitem_T *hi) +{ + return HI2DI(hi); +} + +/* + * Return TRUE when two dictionaries have exactly the same key/values. + */ + int +dict_equal( + dict_T *d1, + dict_T *d2, + int ic, /* ignore case for strings */ + int recursive) /* TRUE when used recursively */ +{ + hashitem_T *hi; + dictitem_T *item2; + int todo; + + if (d1 == NULL && d2 == NULL) + return TRUE; + if (d1 == NULL || d2 == NULL) + return FALSE; + if (d1 == d2) + return TRUE; + if (dict_len(d1) != dict_len(d2)) + return FALSE; + + todo = (int)d1->dv_hashtab.ht_used; + for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + item2 = dict_find(d2, hi->hi_key, -1); + if (item2 == NULL) + return FALSE; + if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic, recursive)) + return FALSE; + --todo; + } + } + return TRUE; +} + +/* + * Turn a dict into a list: + * "what" == 0: list of keys + * "what" == 1: list of values + * "what" == 2: list of items + */ + void +dict_list(typval_T *argvars, typval_T *rettv, int what) +{ + list_T *l2; + dictitem_T *di; + hashitem_T *hi; + listitem_T *li; + listitem_T *li2; + dict_T *d; + int todo; + + if (argvars[0].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + if ((d = argvars[0].vval.v_dict) == NULL) + return; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + todo = (int)d->dv_hashtab.ht_used; + for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + di = HI2DI(hi); + + li = listitem_alloc(); + if (li == NULL) + break; + list_append(rettv->vval.v_list, li); + + if (what == 0) + { + /* keys() */ + li->li_tv.v_type = VAR_STRING; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_string = vim_strsave(di->di_key); + } + else if (what == 1) + { + /* values() */ + copy_tv(&di->di_tv, &li->li_tv); + } + else + { + /* items() */ + l2 = list_alloc(); + li->li_tv.v_type = VAR_LIST; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_list = l2; + if (l2 == NULL) + break; + ++l2->lv_refcount; + + li2 = listitem_alloc(); + if (li2 == NULL) + break; + list_append(l2, li2); + li2->li_tv.v_type = VAR_STRING; + li2->li_tv.v_lock = 0; + li2->li_tv.vval.v_string = vim_strsave(di->di_key); + + li2 = listitem_alloc(); + if (li2 == NULL) + break; + list_append(l2, li2); + copy_tv(&di->di_tv, &li2->li_tv); + } + } + } +} + +/* + * Make each item in the dict readonly (not the value of the item). + */ + void +dict_set_items_ro(dict_T *di) +{ + int todo = (int)di->dv_hashtab.ht_used; + hashitem_T *hi; + + /* Set readonly */ + for (hi = di->dv_hashtab.ht_array; todo > 0 ; ++hi) + { + if (HASHITEM_EMPTY(hi)) + continue; + --todo; + HI2DI(hi)->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX; + } +} + +#endif /* defined(FEAT_EVAL) */ diff --git a/src/diff.c b/src/diff.c index 98b791a720..c67654f621 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1,4 +1,4 @@ -/* vim:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -23,34 +23,35 @@ static int diff_busy = FALSE; /* ex_diffgetput() is busy */ #define DIFF_IWHITE 4 /* ignore change in white space */ #define DIFF_HORIZONTAL 8 /* horizontal splits */ #define DIFF_VERTICAL 16 /* vertical splits */ +#define DIFF_HIDDEN_OFF 32 /* diffoff when hidden */ static int diff_flags = DIFF_FILLER; #define LBUFLEN 50 /* length of line in diff file */ static int diff_a_works = MAYBE; /* TRUE when "diff -a" works, FALSE when it doesn't work, MAYBE when not checked yet */ -#if defined(MSWIN) || defined(MSDOS) +#if defined(MSWIN) static int diff_bin_works = MAYBE; /* TRUE when "diff --binary" works, FALSE when it doesn't work, MAYBE when not checked yet */ #endif -static int diff_buf_idx __ARGS((buf_T *buf)); -static int diff_buf_idx_tp __ARGS((buf_T *buf, tabpage_T *tp)); -static void diff_mark_adjust_tp __ARGS((tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after)); -static void diff_check_unchanged __ARGS((tabpage_T *tp, diff_T *dp)); -static int diff_check_sanity __ARGS((tabpage_T *tp, diff_T *dp)); -static void diff_redraw __ARGS((int dofold)); -static int diff_write __ARGS((buf_T *buf, char_u *fname)); -static void diff_file __ARGS((char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)); -static int diff_equal_entry __ARGS((diff_T *dp, int idx1, int idx2)); -static int diff_cmp __ARGS((char_u *s1, char_u *s2)); +static int diff_buf_idx(buf_T *buf); +static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp); +static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after); +static void diff_check_unchanged(tabpage_T *tp, diff_T *dp); +static int diff_check_sanity(tabpage_T *tp, diff_T *dp); +static void diff_redraw(int dofold); +static int diff_write(buf_T *buf, char_u *fname); +static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff); +static int diff_equal_entry(diff_T *dp, int idx1, int idx2); +static int diff_cmp(char_u *s1, char_u *s2); #ifdef FEAT_FOLDING -static void diff_fold_update __ARGS((diff_T *dp, int skip_idx)); +static void diff_fold_update(diff_T *dp, int skip_idx); #endif -static void diff_read __ARGS((int idx_orig, int idx_new, char_u *fname)); -static void diff_copy_entry __ARGS((diff_T *dprev, diff_T *dp, int idx_orig, int idx_new)); -static diff_T *diff_alloc_new __ARGS((tabpage_T *tp, diff_T *dprev, diff_T *dp)); +static void diff_read(int idx_orig, int idx_new, char_u *fname); +static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new); +static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp); #ifndef USE_CR # define tag_fgets vim_fgets @@ -60,13 +61,12 @@ static diff_T *diff_alloc_new __ARGS((tabpage_T *tp, diff_T *dprev, diff_T *dp)) * Called when deleting or unloading a buffer: No longer make a diff with it. */ void -diff_buf_delete(buf) - buf_T *buf; +diff_buf_delete(buf_T *buf) { int i; tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) { i = diff_buf_idx_tp(buf, tp); if (i != DB_COUNT) @@ -84,8 +84,7 @@ diff_buf_delete(buf) * diff buffers. */ void -diff_buf_adjust(win) - win_T *win; +diff_buf_adjust(win_T *win) { win_T *wp; int i; @@ -94,7 +93,7 @@ diff_buf_adjust(win) { /* When there is no window showing a diff for this buffer, remove * it from the diffs. */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_buffer == win->w_buffer && wp->w_p_diff) break; if (wp == NULL) @@ -121,8 +120,7 @@ diff_buf_adjust(win) * about the screen contents. */ void -diff_buf_add(buf) - buf_T *buf; +diff_buf_add(buf_T *buf) { int i; @@ -138,7 +136,24 @@ diff_buf_add(buf) return; } - EMSGN(_("E96: Can not diff more than %ld buffers"), DB_COUNT); + EMSGN(_("E96: Cannot diff more than %ld buffers"), DB_COUNT); +} + +/* + * Remove all buffers to make diffs for. + */ + static void +diff_buf_clear(void) +{ + int i; + + for (i = 0; i < DB_COUNT; ++i) + if (curtab->tp_diffbuf[i] != NULL) + { + curtab->tp_diffbuf[i] = NULL; + curtab->tp_diff_invalid = TRUE; + diff_redraw(TRUE); + } } /* @@ -146,8 +161,7 @@ diff_buf_add(buf) * Return its index or DB_COUNT if not found. */ static int -diff_buf_idx(buf) - buf_T *buf; +diff_buf_idx(buf_T *buf) { int idx; @@ -162,9 +176,7 @@ diff_buf_idx(buf) * Return its index or DB_COUNT if not found. */ static int -diff_buf_idx_tp(buf, tp) - buf_T *buf; - tabpage_T *tp; +diff_buf_idx_tp(buf_T *buf, tabpage_T *tp) { int idx; @@ -179,13 +191,12 @@ diff_buf_idx_tp(buf, tp) * when info is requested. */ void -diff_invalidate(buf) - buf_T *buf; +diff_invalidate(buf_T *buf) { tabpage_T *tp; int i; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) { i = diff_buf_idx_tp(buf, tp); if (i != DB_COUNT) @@ -201,17 +212,17 @@ diff_invalidate(buf) * Called by mark_adjust(): update line numbers in "curbuf". */ void -diff_mark_adjust(line1, line2, amount, amount_after) - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +diff_mark_adjust( + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) { int idx; tabpage_T *tp; /* Handle all tab pages that use the current buffer in a diff. */ - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) { idx = diff_buf_idx_tp(curbuf, tp); if (idx != DB_COUNT) @@ -227,13 +238,13 @@ diff_mark_adjust(line1, line2, amount, amount_after) * When inserting/deleting lines in existing change blocks, update them. */ static void -diff_mark_adjust_tp(tp, idx, line1, line2, amount, amount_after) - tabpage_T *tp; - int idx; - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +diff_mark_adjust_tp( + tabpage_T *tp, + int idx, + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) { diff_T *dp; diff_T *dprev; @@ -479,10 +490,7 @@ diff_mark_adjust_tp(tp, idx, line1, line2, amount, amount_after) * Allocate a new diff block and link it between "dprev" and "dp". */ static diff_T * -diff_alloc_new(tp, dprev, dp) - tabpage_T *tp; - diff_T *dprev; - diff_T *dp; +diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp) { diff_T *dnew; @@ -505,9 +513,7 @@ diff_alloc_new(tp, dprev, dp) * must take care of removing it. */ static void -diff_check_unchanged(tp, dp) - tabpage_T *tp; - diff_T *dp; +diff_check_unchanged(tabpage_T *tp, diff_T *dp) { int i_org; int i_new; @@ -581,9 +587,7 @@ diff_check_unchanged(tp, dp) * This can happen when the diff program returns invalid results. */ static int -diff_check_sanity(tp, dp) - tabpage_T *tp; - diff_T *dp; +diff_check_sanity(tabpage_T *tp, diff_T *dp) { int i; @@ -599,13 +603,13 @@ diff_check_sanity(tp, dp) * Mark all diff buffers in the current tab page for redraw. */ static void -diff_redraw(dofold) - int dofold; /* also recompute the folds */ +diff_redraw( + int dofold) /* also recompute the folds */ { win_T *wp; int n; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_p_diff) { redraw_win_later(wp, SOME_VALID); @@ -633,9 +637,7 @@ diff_redraw(dofold) * Return FAIL for failure */ static int -diff_write(buf, fname) - buf_T *buf; - char_u *fname; +diff_write(buf_T *buf, char_u *fname) { int r; char_u *save_ff; @@ -656,8 +658,8 @@ diff_write(buf, fname) * could have been produced by autocommands, e.g. the netrw plugin). */ void -ex_diffupdate(eap) - exarg_T *eap UNUSED; /* can be NULL */ +ex_diffupdate( + exarg_T *eap) /* can be NULL */ { buf_T *buf; int idx_orig; @@ -688,9 +690,9 @@ ex_diffupdate(eap) return; /* We need three temp file names. */ - tmp_orig = vim_tempname('o'); - tmp_new = vim_tempname('n'); - tmp_diff = vim_tempname('d'); + tmp_orig = vim_tempname('o', TRUE); + tmp_new = vim_tempname('n', TRUE); + tmp_diff = vim_tempname('d', TRUE); if (tmp_orig == NULL || tmp_new == NULL || tmp_diff == NULL) goto theend; @@ -749,7 +751,7 @@ ex_diffupdate(eap) break; #endif -#if defined(MSWIN) || defined(MSDOS) +#if defined(MSWIN) /* If the "-a" argument works, also check if "--binary" works. */ if (ok && diff_a_works == MAYBE && diff_bin_works == MAYBE) { @@ -780,7 +782,7 @@ ex_diffupdate(eap) EMSG(_("E810: Cannot read or write temp files")); EMSG(_("E97: Cannot create diffs")); diff_a_works = MAYBE; -#if defined(MSWIN) || defined(MSDOS) +#if defined(MSWIN) diff_bin_works = MAYBE; #endif goto theend; @@ -804,8 +806,8 @@ ex_diffupdate(eap) for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new) { buf = curtab->tp_diffbuf[idx_new]; - if (buf == NULL) - continue; + if (buf == NULL || buf->b_ml.ml_mfp == NULL) + continue; /* skip buffer that isn't loaded */ if (diff_write(buf, tmp_new) == FAIL) continue; diff_file(tmp_orig, tmp_new, tmp_diff); @@ -832,10 +834,10 @@ ex_diffupdate(eap) * Make a diff between files "tmp_orig" and "tmp_new", results in "tmp_diff". */ static void -diff_file(tmp_orig, tmp_new, tmp_diff) - char_u *tmp_orig; - char_u *tmp_new; - char_u *tmp_diff; +diff_file( + char_u *tmp_orig, + char_u *tmp_new, + char_u *tmp_diff) { char_u *cmd; size_t len; @@ -861,7 +863,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff) * non-zero when differences have been found. */ vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s", diff_a_works == FALSE ? "" : "-a ", -#if defined(MSWIN) || defined(MSDOS) +#if defined(MSWIN) diff_bin_works == TRUE ? "--binary " : "", #else "", @@ -870,13 +872,9 @@ diff_file(tmp_orig, tmp_new, tmp_diff) (diff_flags & DIFF_ICASE) ? "-i " : "", tmp_orig, tmp_new); append_redir(cmd, (int)len, p_srr, tmp_diff); -#ifdef FEAT_AUTOCMD block_autocmds(); /* Avoid ShellCmdPost stuff */ -#endif (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif vim_free(cmd); } } @@ -888,8 +886,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff) * could have been produced by autocommands, e.g. the netrw plugin). */ void -ex_diffpatch(eap) - exarg_T *eap; +ex_diffpatch(exarg_T *eap) { char_u *tmp_orig; /* name of original temp file */ char_u *tmp_new; /* name of patched temp file */ @@ -905,13 +902,15 @@ ex_diffpatch(eap) char_u *browseFile = NULL; int browse_flag = cmdmod.browse; #endif - struct stat st; + stat_T st; + char_u *esc_name = NULL; #ifdef FEAT_BROWSE if (cmdmod.browse) { browseFile = do_browse(0, (char_u *)_("Patch file"), - eap->arg, NULL, NULL, BROWSE_FILTER_ALL_FILES, NULL); + eap->arg, NULL, NULL, + (char_u *)_(BROWSE_FILTER_ALL_FILES), NULL); if (browseFile == NULL) return; /* operation cancelled */ eap->arg = browseFile; @@ -920,8 +919,8 @@ ex_diffpatch(eap) #endif /* We need two temp file names. */ - tmp_orig = vim_tempname('o'); - tmp_new = vim_tempname('n'); + tmp_orig = vim_tempname('o', FALSE); + tmp_new = vim_tempname('n', FALSE); if (tmp_orig == NULL || tmp_new == NULL) goto theend; @@ -935,11 +934,14 @@ ex_diffpatch(eap) /* Get the absolute path of the patchfile, changing directory below. */ fullname = FullName_save(eap->arg, FALSE); #endif - buflen = STRLEN(tmp_orig) + ( + esc_name = vim_strsave_shellescape( # ifdef UNIX - fullname != NULL ? STRLEN(fullname) : + fullname != NULL ? fullname : # endif - STRLEN(eap->arg)) + STRLEN(tmp_new) + 16; + eap->arg, TRUE, TRUE); + if (esc_name == NULL) + goto theend; + buflen = STRLEN(tmp_orig) + STRLEN(esc_name) + STRLEN(tmp_new) + 16; buf = alloc((unsigned)buflen); if (buf == NULL) goto theend; @@ -977,19 +979,11 @@ ex_diffpatch(eap) { /* Build the patch command and execute it. Ignore errors. Switch to * cooked mode to allow the user to respond to prompts. */ - vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"", - tmp_new, tmp_orig, -# ifdef UNIX - fullname != NULL ? fullname : -# endif - eap->arg); -#ifdef FEAT_AUTOCMD + vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s", + tmp_new, tmp_orig, esc_name); block_autocmds(); /* Avoid ShellCmdPost stuff */ -#endif (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif } #ifdef UNIX @@ -1051,11 +1045,9 @@ ex_diffpatch(eap) eap->arg = newname; ex_file(eap); -#ifdef FEAT_AUTOCMD /* Do filetype detection with the new name. */ if (au_has_group((char_u *)"filetypedetect")) do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); -#endif } } } @@ -1073,6 +1065,7 @@ ex_diffpatch(eap) #ifdef UNIX vim_free(fullname); #endif + vim_free(esc_name); #ifdef FEAT_BROWSE vim_free(browseFile); cmdmod.browse = browse_flag; @@ -1083,14 +1076,19 @@ ex_diffpatch(eap) * Split the window and edit another file, setting options to show the diffs. */ void -ex_diffsplit(eap) - exarg_T *eap; +ex_diffsplit(exarg_T *eap) { win_T *old_curwin = curwin; + bufref_T old_curbuf; + set_bufref(&old_curbuf, curbuf); #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif + /* Need to compute w_fraction when no redraw happened yet. */ + validate_cursor(); + set_fraction(curwin); + /* don't use a new tab page, each tab page has its own diffs */ cmdmod.tab = 0; @@ -1105,7 +1103,18 @@ ex_diffsplit(eap) { /* Set 'diff', 'scrollbind' on and 'wrap' off. */ diff_win_options(curwin, TRUE); - diff_win_options(old_curwin, TRUE); + if (win_valid(old_curwin)) + { + diff_win_options(old_curwin, TRUE); + + if (bufref_valid(&old_curbuf)) + /* Move the cursor position to that of the old window. */ + curwin->w_cursor.lnum = diff_get_corresponding_line( + old_curbuf.br_buf, old_curwin->w_cursor.lnum); + } + /* Now that lines are folded scroll to show the cursor at the same + * relative position. */ + scroll_to_fraction(curwin, curwin->w_height); } } } @@ -1114,20 +1123,33 @@ ex_diffsplit(eap) * Set options to show diffs for the current window. */ void -ex_diffthis(eap) - exarg_T *eap UNUSED; +ex_diffthis(exarg_T *eap UNUSED) { /* Set 'diff', 'scrollbind' on and 'wrap' off. */ diff_win_options(curwin, TRUE); } + static void +set_diff_option(win_T *wp, int value) +{ + win_T *old_curwin = curwin; + + curwin = wp; + curbuf = curwin->w_buffer; + ++curbuf_lock; + set_option_value((char_u *)"diff", (long)value, NULL, OPT_LOCAL); + --curbuf_lock; + curwin = old_curwin; + curbuf = curwin->w_buffer; +} + /* * Set options in window "wp" for diff mode. */ void -diff_win_options(wp, addbuf) - win_T *wp; - int addbuf; /* Add buffer to diff. */ +diff_win_options( + win_T *wp, + int addbuf) /* Add buffer to diff. */ { # ifdef FEAT_FOLDING win_T *old_curwin = curwin; @@ -1138,32 +1160,30 @@ diff_win_options(wp, addbuf) curwin = old_curwin; # endif - wp->w_p_diff = TRUE; - /* Use 'scrollbind' and 'cursorbind' when available */ -#ifdef FEAT_SCROLLBIND - if (!wp->w_p_diff_saved) + if (!wp->w_p_diff) wp->w_p_scb_save = wp->w_p_scb; wp->w_p_scb = TRUE; -#endif -#ifdef FEAT_CURSORBIND - if (!wp->w_p_diff_saved) + if (!wp->w_p_diff) wp->w_p_crb_save = wp->w_p_crb; wp->w_p_crb = TRUE; -#endif - if (!wp->w_p_diff_saved) + if (!wp->w_p_diff) wp->w_p_wrap_save = wp->w_p_wrap; wp->w_p_wrap = FALSE; # ifdef FEAT_FOLDING curwin = wp; curbuf = curwin->w_buffer; - if (!wp->w_p_diff_saved) + if (!wp->w_p_diff) + { + if (wp->w_p_diff_saved) + free_string_option(wp->w_p_fdm_save); wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm); + } set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff", OPT_LOCAL|OPT_FREE, 0); curwin = old_curwin; curbuf = curwin->w_buffer; - if (!wp->w_p_diff_saved) + if (!wp->w_p_diff) { wp->w_p_fdc_save = wp->w_p_fdc; wp->w_p_fen_save = wp->w_p_fen; @@ -1176,13 +1196,13 @@ diff_win_options(wp, addbuf) /* make sure topline is not halfway a fold */ changed_window_setting_win(wp); # endif -#ifdef FEAT_SCROLLBIND if (vim_strchr(p_sbo, 'h') == NULL) do_cmdline_cmd((char_u *)"set sbo+=hor"); -#endif - /* Saved the current values, to be restored in ex_diffoff(). */ + /* Save the current values, to be restored in ex_diffoff(). */ wp->w_p_diff_saved = TRUE; + set_diff_option(wp, TRUE); + if (addbuf) diff_buf_add(wp->w_buffer); redraw_win_later(wp, NOT_VALID); @@ -1193,91 +1213,78 @@ diff_win_options(wp, addbuf) * Only in the current tab page. */ void -ex_diffoff(eap) - exarg_T *eap; +ex_diffoff(exarg_T *eap) { win_T *wp; - win_T *old_curwin = curwin; -#ifdef FEAT_SCROLLBIND int diffwin = FALSE; -#endif - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { if (eap->forceit ? wp->w_p_diff : wp == curwin) { - /* Set 'diff', 'scrollbind' off and 'wrap' on. If option values - * were saved in diff_win_options() restore them. */ - wp->w_p_diff = FALSE; + /* Set 'diff' off. If option values were saved in + * diff_win_options(), restore the ones whose settings seem to have + * been left over from diff mode. */ + set_diff_option(wp, FALSE); -#ifdef FEAT_SCROLLBIND - if (wp->w_p_scb) - wp->w_p_scb = wp->w_p_diff_saved ? wp->w_p_scb_save : FALSE; -#endif -#ifdef FEAT_CURSORBIND - if (wp->w_p_crb) - wp->w_p_crb = wp->w_p_diff_saved ? wp->w_p_crb_save : FALSE; -#endif - if (!wp->w_p_wrap) - wp->w_p_wrap = wp->w_p_diff_saved ? wp->w_p_wrap_save : TRUE; -#ifdef FEAT_FOLDING - curwin = wp; - curbuf = curwin->w_buffer; if (wp->w_p_diff_saved) { + + if (wp->w_p_scb) + wp->w_p_scb = wp->w_p_scb_save; + if (wp->w_p_crb) + wp->w_p_crb = wp->w_p_crb_save; + if (!wp->w_p_wrap) + wp->w_p_wrap = wp->w_p_wrap_save; +#ifdef FEAT_FOLDING free_string_option(wp->w_p_fdm); - wp->w_p_fdm = wp->w_p_fdm_save; - wp->w_p_fdm_save = empty_option; - } - else - set_string_option_direct((char_u *)"fdm", -1, - (char_u *)"manual", OPT_LOCAL|OPT_FREE, 0); - curwin = old_curwin; - curbuf = curwin->w_buffer; - if (wp->w_p_fdc == diff_foldcolumn) - wp->w_p_fdc = wp->w_p_diff_saved ? wp->w_p_fdc_save : 0; - if (wp->w_p_fdl == 0 && wp->w_p_diff_saved) - wp->w_p_fdl = wp->w_p_fdl_save; - - if (wp->w_p_fen) - { + wp->w_p_fdm = vim_strsave( + *wp->w_p_fdm_save ? wp->w_p_fdm_save : (char_u*)"manual"); + + if (wp->w_p_fdc == diff_foldcolumn) + wp->w_p_fdc = wp->w_p_fdc_save; + if (wp->w_p_fdl == 0) + wp->w_p_fdl = wp->w_p_fdl_save; + /* Only restore 'foldenable' when 'foldmethod' is not * "manual", otherwise we continue to show the diff folds. */ - if (foldmethodIsManual(wp) || !wp->w_p_diff_saved) - wp->w_p_fen = FALSE; - else - wp->w_p_fen = wp->w_p_fen_save; + if (wp->w_p_fen) + wp->w_p_fen = foldmethodIsManual(wp) ? FALSE + : wp->w_p_fen_save; + + foldUpdateAll(wp); +#endif } + /* remove filler lines */ + wp->w_topfill = 0; - foldUpdateAll(wp); - /* make sure topline is not halfway a fold */ + /* make sure topline is not halfway a fold and cursor is + * invalidated */ changed_window_setting_win(wp); -#endif + /* Note: 'sbo' is not restored, it's a global option. */ diff_buf_adjust(wp); - - wp->w_p_diff_saved = FALSE; } -#ifdef FEAT_SCROLLBIND diffwin |= wp->w_p_diff; -#endif } -#ifdef FEAT_SCROLLBIND + /* Also remove hidden buffers from the list. */ + if (eap->forceit) + diff_buf_clear(); + /* Remove "hor" from from 'scrollopt' if there are no diff windows left. */ if (!diffwin && vim_strchr(p_sbo, 'h') != NULL) do_cmdline_cmd((char_u *)"set sbo-=hor"); -#endif } /* * Read the diff output and add each entry to the diff list. */ static void -diff_read(idx_orig, idx_new, fname) - int idx_orig; /* idx of original file */ - int idx_new; /* idx of new file */ - char_u *fname; /* name of diff output file */ +diff_read( + int idx_orig, /* idx of original file */ + int idx_new, /* idx of new file */ + char_u *fname) /* name of diff output file */ { FILE *fd; diff_T *dprev = NULL; @@ -1468,11 +1475,11 @@ diff_read(idx_orig, idx_new, fname) * Copy an entry at "dp" from "idx_orig" to "idx_new". */ static void -diff_copy_entry(dprev, dp, idx_orig, idx_new) - diff_T *dprev; - diff_T *dp; - int idx_orig; - int idx_new; +diff_copy_entry( + diff_T *dprev, + diff_T *dp, + int idx_orig, + int idx_new) { long off; @@ -1489,8 +1496,7 @@ diff_copy_entry(dprev, dp, idx_orig, idx_new) * Clear the list of diffblocks for tab page "tp". */ void -diff_clear(tp) - tabpage_T *tp; +diff_clear(tabpage_T *tp) { diff_T *p, *next_p; @@ -1512,9 +1518,7 @@ diff_clear(tp) * This should only be used for windows where 'diff' is set. */ int -diff_check(wp, lnum) - win_T *wp; - linenr_T lnum; +diff_check(win_T *wp, linenr_T lnum) { int idx; /* index in tp_diffbuf[] for this buffer */ diff_T *dp; @@ -1575,7 +1579,8 @@ diff_check(wp, lnum) /* Compare all lines. If they are equal the lines were inserted * in some buffers, deleted in others, but not changed. */ for (i = 0; i < DB_COUNT; ++i) - if (i != idx && curtab->tp_diffbuf[i] != NULL && dp->df_count[i] != 0) + if (i != idx && curtab->tp_diffbuf[i] != NULL + && dp->df_count[i] != 0) if (!diff_equal_entry(dp, idx, i)) return -1; } @@ -1606,10 +1611,7 @@ diff_check(wp, lnum) * Compare two entries in diff "*dp" and return TRUE if they are equal. */ static int -diff_equal_entry(dp, idx1, idx2) - diff_T *dp; - int idx1; - int idx2; +diff_equal_entry(diff_T *dp, int idx1, int idx2) { int i; char_u *line; @@ -1634,19 +1636,49 @@ diff_equal_entry(dp, idx1, idx2) return TRUE; } +/* + * Compare the characters at "p1" and "p2". If they are equal (possibly + * ignoring case) return TRUE and set "len" to the number of bytes. + */ + static int +diff_equal_char(char_u *p1, char_u *p2, int *len) +{ +#ifdef FEAT_MBYTE + int l = (*mb_ptr2len)(p1); + + if (l != (*mb_ptr2len)(p2)) + return FALSE; + if (l > 1) + { + if (STRNCMP(p1, p2, l) != 0 + && (!enc_utf8 + || !(diff_flags & DIFF_ICASE) + || utf_fold(utf_ptr2char(p1)) + != utf_fold(utf_ptr2char(p2)))) + return FALSE; + *len = l; + } + else +#endif + { + if ((*p1 != *p2) + && (!(diff_flags & DIFF_ICASE) + || TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2))) + return FALSE; + *len = 1; + } + return TRUE; +} + /* * Compare strings "s1" and "s2" according to 'diffopt'. * Return non-zero when they are different. */ static int -diff_cmp(s1, s2) - char_u *s1; - char_u *s2; +diff_cmp(char_u *s1, char_u *s2) { char_u *p1, *p2; -#ifdef FEAT_MBYTE int l; -#endif if ((diff_flags & (DIFF_ICASE | DIFF_IWHITE)) == 0) return STRCMP(s1, s2); @@ -1658,37 +1690,17 @@ diff_cmp(s1, s2) p2 = s2; while (*p1 != NUL && *p2 != NUL) { - if (vim_iswhite(*p1) && vim_iswhite(*p2)) + if (VIM_ISWHITE(*p1) && VIM_ISWHITE(*p2)) { p1 = skipwhite(p1); p2 = skipwhite(p2); } else { -#ifdef FEAT_MBYTE - l = (*mb_ptr2len)(p1); - if (l != (*mb_ptr2len)(p2)) + if (!diff_equal_char(p1, p2, &l)) break; - if (l > 1) - { - if (STRNCMP(p1, p2, l) != 0 - && (!enc_utf8 - || !(diff_flags & DIFF_ICASE) - || utf_fold(utf_ptr2char(p1)) - != utf_fold(utf_ptr2char(p2)))) - break; - p1 += l; - p2 += l; - } - else -#endif - { - if (*p1 != *p2 && (!(diff_flags & DIFF_ICASE) - || TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2))) - break; - ++p1; - ++p2; - } + p1 += l; + p2 += l; } } @@ -1704,9 +1716,7 @@ diff_cmp(s1, s2) * Return the number of filler lines above "lnum". */ int -diff_check_fill(wp, lnum) - win_T *wp; - linenr_T lnum; +diff_check_fill(win_T *wp, linenr_T lnum) { int n; @@ -1724,9 +1734,7 @@ diff_check_fill(wp, lnum) * show the same diff'ed lines. */ void -diff_set_topline(fromwin, towin) - win_T *fromwin; - win_T *towin; +diff_set_topline(win_T *fromwin, win_T *towin) { buf_T *frombuf = fromwin->w_buffer; linenr_T lnum = fromwin->w_topline; @@ -1846,7 +1854,7 @@ diff_set_topline(fromwin, towin) * This is called when 'diffopt' is changed. */ int -diffopt_changed() +diffopt_changed(void) { char_u *p; int diff_context_new = 6; @@ -1892,6 +1900,11 @@ diffopt_changed() p += 11; diff_foldcolumn_new = getdigits(&p); } + else if (STRNCMP(p, "hiddenoff", 9) == 0) + { + p += 9; + diff_flags_new |= DIFF_HIDDEN_OFF; + } if (*p != ',' && *p != NUL) return FAIL; if (*p == ',') @@ -1904,7 +1917,7 @@ diffopt_changed() /* If "icase" or "iwhite" was added or removed, need to update the diff. */ if (diff_flags != diff_flags_new) - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) tp->tp_diff_invalid = TRUE; diff_flags = diff_flags_new; @@ -1924,21 +1937,30 @@ diffopt_changed() * Return TRUE if 'diffopt' contains "horizontal". */ int -diffopt_horizontal() +diffopt_horizontal(void) { return (diff_flags & DIFF_HORIZONTAL) != 0; } +/* + * Return TRUE if 'diffopt' contains "hiddenoff". + */ + int +diffopt_hiddenoff(void) +{ + return (diff_flags & DIFF_HIDDEN_OFF) != 0; +} + /* * Find the difference within a changed line. * Returns TRUE if the line was added, no other buffer has it. */ int -diff_find_change(wp, lnum, startp, endp) - win_T *wp; - linenr_T lnum; - int *startp; /* first char of the change */ - int *endp; /* last char of the change */ +diff_find_change( + win_T *wp, + linenr_T lnum, + int *startp, /* first char of the change */ + int *endp) /* last char of the change */ { char_u *line_org; char_u *line_new; @@ -1949,6 +1971,8 @@ diff_find_change(wp, lnum, startp, endp) int idx; int off; int added = TRUE; + char_u *p1, *p2; + int l; /* Make a copy of the line, the next ml_get() will invalidate it. */ line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE)); @@ -1989,18 +2013,19 @@ diff_find_change(wp, lnum, startp, endp) while (line_org[si_org] != NUL) { if ((diff_flags & DIFF_IWHITE) - && vim_iswhite(line_org[si_org]) - && vim_iswhite(line_new[si_new])) + && VIM_ISWHITE(line_org[si_org]) + && VIM_ISWHITE(line_new[si_new])) { si_org = (int)(skipwhite(line_org + si_org) - line_org); si_new = (int)(skipwhite(line_new + si_new) - line_new); } else { - if (line_org[si_org] != line_new[si_new]) + if (!diff_equal_char(line_org + si_org, line_new + si_new, + &l)) break; - ++si_org; - ++si_new; + si_org += l; + si_new += l; } } #ifdef FEAT_MBYTE @@ -2024,22 +2049,28 @@ diff_find_change(wp, lnum, startp, endp) && ei_org >= 0 && ei_new >= 0) { if ((diff_flags & DIFF_IWHITE) - && vim_iswhite(line_org[ei_org]) - && vim_iswhite(line_new[ei_new])) + && VIM_ISWHITE(line_org[ei_org]) + && VIM_ISWHITE(line_new[ei_new])) { while (ei_org >= *startp - && vim_iswhite(line_org[ei_org])) + && VIM_ISWHITE(line_org[ei_org])) --ei_org; while (ei_new >= si_new - && vim_iswhite(line_new[ei_new])) + && VIM_ISWHITE(line_new[ei_new])) --ei_new; } else { - if (line_org[ei_org] != line_new[ei_new]) + p1 = line_org + ei_org; + p2 = line_new + ei_new; +#ifdef FEAT_MBYTE + p1 -= (*mb_head_off)(line_org, p1); + p2 -= (*mb_head_off)(line_new, p2); +#endif + if (!diff_equal_char(p1, p2, &l)) break; - --ei_org; - --ei_new; + ei_org -= l; + ei_new -= l; } } if (*endp < ei_org) @@ -2058,9 +2089,7 @@ diff_find_change(wp, lnum, startp, endp) * Return FALSE if there are no diff blocks at all in this window. */ int -diff_infold(wp, lnum) - win_T *wp; - linenr_T lnum; +diff_infold(win_T *wp, linenr_T lnum) { int i; int idx = -1; @@ -2107,12 +2136,25 @@ diff_infold(wp, lnum) * "dp" and "do" commands. */ void -nv_diffgetput(put) - int put; +nv_diffgetput(int put, long count) { exarg_T ea; + char_u buf[30]; - ea.arg = (char_u *)""; +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf)) + { + vim_beep(BO_OPER); + return; + } +#endif + if (count == 0) + ea.arg = (char_u *)""; + else + { + vim_snprintf((char *)buf, 30, "%ld", count); + ea.arg = buf; + } if (put) ea.cmdidx = CMD_diffput; else @@ -2128,8 +2170,7 @@ nv_diffgetput(put) * ":diffput" */ void -ex_diffgetput(eap) - exarg_T *eap; +ex_diffgetput(exarg_T *eap) { linenr_T lnum; int count; @@ -2194,7 +2235,7 @@ ex_diffgetput(eap) { /* Buffer number or pattern given. Ignore trailing white space. */ p = eap->arg + STRLEN(eap->arg); - while (p > eap->arg && vim_iswhite(p[-1])) + while (p > eap->arg && VIM_ISWHITE(p[-1])) --p; for (i = 0; vim_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) ; @@ -2325,7 +2366,7 @@ ex_diffgetput(eap) end_skip = 0; } - buf_empty = FALSE; + buf_empty = BUFEMPTY(); added = 0; for (i = 0; i < count; ++i) { @@ -2451,14 +2492,12 @@ ex_diffgetput(eap) * When there are no diffs, all folds are removed. */ static void -diff_fold_update(dp, skip_idx) - diff_T *dp; - int skip_idx; +diff_fold_update(diff_T *dp, int skip_idx) { int i; win_T *wp; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) for (i = 0; i < DB_COUNT; ++i) if (curtab->tp_diffbuf[i] == wp->w_buffer && i != skip_idx) foldUpdate(wp, dp->df_lnum[i], @@ -2470,12 +2509,11 @@ diff_fold_update(dp, skip_idx) * Return TRUE if buffer "buf" is in diff-mode. */ int -diff_mode_buf(buf) - buf_T *buf; +diff_mode_buf(buf_T *buf) { tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) if (diff_buf_idx_tp(buf, tp) != DB_COUNT) return TRUE; return FALSE; @@ -2486,9 +2524,7 @@ diff_mode_buf(buf) * Return FAIL if there isn't such a diff block. */ int -diff_move_to(dir, count) - int dir; - long count; +diff_move_to(int dir, long count) { int idx; linenr_T lnum = curwin->w_cursor.lnum; @@ -2540,22 +2576,22 @@ diff_move_to(dir, count) return OK; } -#if defined(FEAT_CURSORBIND) || defined(PROTO) - linenr_T -diff_get_corresponding_line(buf1, lnum1, buf2, lnum3) - buf_T *buf1; - linenr_T lnum1; - buf_T *buf2; - linenr_T lnum3; +/* + * Return the line number in the current window that is closest to "lnum1" in + * "buf1" in diff mode. + */ + static linenr_T +diff_get_corresponding_line_int( + buf_T *buf1, + linenr_T lnum1) { int idx1; int idx2; diff_T *dp; int baseline = 0; - linenr_T lnum2; idx1 = diff_buf_idx(buf1); - idx2 = diff_buf_idx(buf2); + idx2 = diff_buf_idx(curbuf); if (idx1 == DB_COUNT || idx2 == DB_COUNT || curtab->tp_first_diff == NULL) return lnum1; @@ -2568,15 +2604,8 @@ diff_get_corresponding_line(buf1, lnum1, buf2, lnum3) for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) { if (dp->df_lnum[idx1] > lnum1) - { - lnum2 = lnum1 - baseline; - /* don't end up past the end of the file */ - if (lnum2 > buf2->b_ml.ml_line_count) - lnum2 = buf2->b_ml.ml_line_count; - - return lnum2; - } - else if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1) + return lnum1 - baseline; + if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1) { /* Inside the diffblock */ baseline = lnum1 - dp->df_lnum[idx1]; @@ -2585,10 +2614,11 @@ diff_get_corresponding_line(buf1, lnum1, buf2, lnum3) return dp->df_lnum[idx2] + baseline; } - else if ( (dp->df_lnum[idx1] == lnum1) - && (dp->df_count[idx1] == 0) - && (dp->df_lnum[idx2] <= lnum3) - && ((dp->df_lnum[idx2] + dp->df_count[idx2]) > lnum3)) + if ( (dp->df_lnum[idx1] == lnum1) + && (dp->df_count[idx1] == 0) + && (dp->df_lnum[idx2] <= curwin->w_cursor.lnum) + && ((dp->df_lnum[idx2] + dp->df_count[idx2]) + > curwin->w_cursor.lnum)) /* * Special case: if the cursor is just after a zero-count * block (i.e. all filler) and the target cursor is already @@ -2596,30 +2626,36 @@ diff_get_corresponding_line(buf1, lnum1, buf2, lnum3) * unmoved. This makes repeated CTRL-W W operations work * as expected. */ - return lnum3; + return curwin->w_cursor.lnum; baseline = (dp->df_lnum[idx1] + dp->df_count[idx1]) - (dp->df_lnum[idx2] + dp->df_count[idx2]); } /* If we get here then the cursor is after the last diff */ - lnum2 = lnum1 - baseline; - /* don't end up past the end of the file */ - if (lnum2 > buf2->b_ml.ml_line_count) - lnum2 = buf2->b_ml.ml_line_count; + return lnum1 - baseline; +} + +/* + * Return the line number in the current window that is closest to "lnum1" in + * "buf1" in diff mode. Checks the line number to be valid. + */ + linenr_T +diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1) +{ + linenr_T lnum = diff_get_corresponding_line_int(buf1, lnum1); - return lnum2; + /* don't end up past the end of the file */ + if (lnum > curbuf->b_ml.ml_line_count) + return curbuf->b_ml.ml_line_count; + return lnum; } -#endif -#if defined(FEAT_FOLDING) || defined(PROTO) /* * For line "lnum" in the current window find the equivalent lnum in window * "wp", compensating for inserted/deleted lines. */ linenr_T -diff_lnum_win(lnum, wp) - linenr_T lnum; - win_T *wp; +diff_lnum_win(linenr_T lnum, win_T *wp) { diff_T *dp; int idx; @@ -2653,6 +2689,5 @@ diff_lnum_win(lnum, wp) n = dp->df_lnum[i] + dp->df_count[i]; return n; } -#endif #endif /* FEAT_DIFF */ diff --git a/src/digraph.c b/src/digraph.c index 9f7d0cc4e2..6909c5b9c7 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -28,8 +28,8 @@ typedef struct digraph result_T result; } digr_T; -static int getexactdigraph __ARGS((int, int, int)); -static void printdigraph __ARGS((digr_T *)); +static int getexactdigraph(int, int, int); +static void printdigraph(digr_T *); /* digraphs added by the user */ static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; @@ -39,74 +39,7 @@ static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; * compilers cannot handle them (Amiga SAS/C is the most picky one). */ static digr_T digraphdefault[] = -#if defined(MSDOS) || defined(OS2) - /* - * MSDOS digraphs. - */ - {{'C', ',', 128}, /* ~@ XX */ - {'u', '"', 129}, /* */ - {'e', '\'', 130}, /* */ - {'a', '^', 131}, /* */ - {'a', '"', 132}, /* */ - {'a', '`', 133}, /* */ - {'a', '@', 134}, /* */ - {'c', ',', 135}, /* ~G XX */ - {'e', '^', 136}, /* ~H XX */ - {'e', '"', 137}, /* */ - {'e', '`', 138}, /* */ - {'i', '"', 139}, /* */ - {'i', '^', 140}, /* */ - {'i', '`', 141}, /* */ - {'A', '"', 142}, /* ~N XX */ - {'A', '@', 143}, /* */ - {'E', '\'', 144}, /* */ - {'a', 'e', 145}, /* */ - {'A', 'E', 146}, /* */ - {'o', '^', 147}, /* */ - {'o', '"', 148}, /* */ - {'o', '`', 149}, /* */ - {'u', '^', 150}, /* */ - {'u', '`', 151}, /* */ - {'y', '"', 152}, /* */ - {'O', '"', 153}, /* */ - {'U', '"', 154}, /* */ - {'c', '|', 155}, /* */ - {'$', '$', 156}, /* */ - {'Y', '-', 157}, /* ~] XX */ - {'P', 't', 158}, /* */ - {'f', 'f', 159}, /* */ - {'a', '\'', 160}, /* */ - {'i', '\'', 161}, /* */ - {'o', '\'', 162}, /* */ - {'u', '\'', 163}, /* x XX */ - {'n', '~', 164}, /* */ - {'N', '~', 165}, /* */ - {'a', 'a', 166}, /* */ - {'o', 'o', 167}, /* */ - {'~', '?', 168}, /* */ - {'-', 'a', 169}, /* */ - {'a', '-', 170}, /* */ - {'1', '2', 171}, /* */ - {'1', '4', 172}, /* */ - {'~', '!', 173}, /* */ - {'<', '<', 174}, /* */ - {'>', '>', 175}, /* */ - - {'s', 's', 225}, /* */ - {'j', 'u', 230}, /* */ - {'o', '/', 237}, /* */ - {'+', '-', 241}, /* */ - {'>', '=', 242}, /* */ - {'<', '=', 243}, /* */ - {':', '-', 246}, /* */ - {'~', '~', 247}, /* */ - {'~', 'o', 248}, /* */ - {'2', '2', 253}, /* */ - {NUL, NUL, NUL} - }; - -#else /* !MSDOS && !OS2 */ -# ifdef __MINT__ +#ifdef __MINT__ /* * ATARI digraphs @@ -171,8 +104,8 @@ static digr_T digraphdefault[] = {NUL, NUL, NUL} }; -# else /* !__MINT__ */ -# ifdef HPUX_DIGRAPHS +#else /* !__MINT__ */ +# ifdef HPUX_DIGRAPHS /* * different HPUX digraphs @@ -275,9 +208,9 @@ static digr_T digraphdefault[] = {NUL, NUL, NUL} }; -# else /* !HPUX_DIGRAPHS */ +# else /* !HPUX_DIGRAPHS */ -# ifdef EBCDIC +# ifdef EBCDIC /* * EBCDIC - ISO digraphs @@ -387,8 +320,8 @@ static digr_T digraphdefault[] = {NUL, NUL, NUL} }; -# else -# if defined(MACOS) && !defined(FEAT_MBYTE) +# else +# if defined(MACOS_X) && !defined(FEAT_MBYTE) /* * Macintosh digraphs @@ -516,9 +449,9 @@ static digr_T digraphdefault[] = {NUL, NUL, NUL} }; -# else /* !MACOS */ +# else /* !MACOS_X */ -# ifdef OLD_DIGRAPHS +# ifdef OLD_DIGRAPHS /* * digraphs compatible with Vim 5.x @@ -625,7 +558,7 @@ static digr_T digraphdefault[] = {'y', '"', 255}, /* x XX */ {NUL, NUL, NUL} }; -# else /* OLD_DIGRAPHS */ +# else /* OLD_DIGRAPHS */ /* * digraphs for Unicode from RFC1345 @@ -1379,6 +1312,7 @@ static digr_T digraphdefault[] = {'/', '-', 0x2020}, {'/', '=', 0x2021}, {'.', '.', 0x2025}, + {',', '.', 0x2026}, {'%', '0', 0x2030}, {'1', '\'', 0x2032}, {'2', '\'', 0x2033}, @@ -1942,6 +1876,13 @@ static digr_T digraphdefault[] = {'f', 'l', 0xfb02}, {'f', 't', 0xfb05}, {'s', 't', 0xfb06}, + + /* extra alternatives, easier to remember */ + {'W', '`', 0x1e80}, + {'w', '`', 0x1e81}, + {'Y', '`', 0x1ef2}, + {'y', '`', 0x1ef3}, + # endif /* FEAT_MBYTE */ /* Vim 5.x compatible digraphs that don't conflict with the above */ @@ -2001,20 +1942,18 @@ static digr_T digraphdefault[] = {NUL, NUL, NUL} }; -# endif /* OLD_DIGRAPHS */ +# endif /* OLD_DIGRAPHS */ -# endif /* Macintosh */ -# endif /* EBCDIC */ -# endif /* !HPUX_DIGRAPHS */ -# endif /* !__MINT__ */ -#endif /* !MSDOS && !OS2 */ +# endif /* Macintosh */ +# endif /* EBCDIC */ +# endif /* !HPUX_DIGRAPHS */ +#endif /* !__MINT__ */ /* * handle digraphs after typing a character */ int -do_digraph(c) - int c; +do_digraph(int c) { static int backspaced; /* character before K_BS */ static int lastchar; /* last typed character */ @@ -2035,14 +1974,72 @@ do_digraph(c) return c; } +/* + * Find a digraph for "val". If found return the string to display it. + * If not found return NULL. + */ + char_u * +get_digraph_for_char(int val_arg) +{ + int val = val_arg; + int i; + int use_defaults; + digr_T *dp; + static char_u r[3]; + +#if defined(FEAT_MBYTE) && defined(USE_UNICODE_DIGRAPHS) + if (!enc_utf8) + { + char_u buf[6], *to; + vimconv_T vc; + + // convert the character from 'encoding' to Unicode + i = mb_char2bytes(val, buf); + vc.vc_type = CONV_NONE; + if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK) + { + vc.vc_fail = TRUE; + to = string_convert(&vc, buf, &i); + if (to != NULL) + { + val = utf_ptr2char(to); + vim_free(to); + } + (void)convert_setup(&vc, NULL, NULL); + } + } +#endif + + for (use_defaults = 0; use_defaults <= 1; use_defaults++) + { + if (use_defaults == 0) + dp = (digr_T *)user_digraphs.ga_data; + else + dp = digraphdefault; + for (i = 0; use_defaults ? dp->char1 != NUL + : i < user_digraphs.ga_len; ++i) + { + if (dp->result == val) + { + r[0] = dp->char1; + r[1] = dp->char2; + r[2] = NUL; + return r; + } + ++dp; + } + } + return NULL; +} + /* * Get a digraph. Used after typing CTRL-K on the command line or in normal * mode. * Returns composed character, or NUL when ESC was used. */ int -get_digraph(cmdline) - int cmdline; /* TRUE when called from the cmdline */ +get_digraph( + int cmdline) /* TRUE when called from the cmdline */ { int c, cc; @@ -2085,10 +2082,7 @@ get_digraph(cmdline) * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80. */ static int -getexactdigraph(char1, char2, meta_char) - int char1; - int char2; - int meta_char; +getexactdigraph(int char1, int char2, int meta_char) { int i; int retval = 0; @@ -2173,10 +2167,7 @@ getexactdigraph(char1, char2, meta_char) * Allow for both char1-char2 and char2-char1 */ int -getdigraph(char1, char2, meta_char) - int char1; - int char2; - int meta_char; +getdigraph(int char1, int char2, int meta_char) { int retval; @@ -2192,8 +2183,7 @@ getdigraph(char1, char2, meta_char) * format: {c1}{c2} char {c1}{c2} char ... */ void -putdigraph(str) - char_u *str; +putdigraph(char_u *str) { int char1, char2, n; int i; @@ -2252,7 +2242,7 @@ putdigraph(str) } void -listdigraphs() +listdigraphs(void) { int i; digr_T *dp; @@ -2297,8 +2287,7 @@ listdigraphs() } static void -printdigraph(dp) - digr_T *dp; +printdigraph(digr_T *dp) { char_u buf[30]; char_u *p; @@ -2357,7 +2346,7 @@ typedef struct #define KMAP_MAXLEN 20 /* maximum length of "from" or "to" */ -static void keymap_unload __ARGS((void)); +static void keymap_unload(void); /* * Set up key mapping tables for the 'keymap' option. @@ -2366,7 +2355,7 @@ static void keymap_unload __ARGS((void)); * checked. */ char_u * -keymap_init() +keymap_init(void) { curbuf->b_kmap_state &= ~KEYMAP_INIT; @@ -2397,13 +2386,13 @@ keymap_init() /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */ vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc); - if (source_runtime(buf, FALSE) == FAIL) + if (source_runtime(buf, 0) == FAIL) # endif { /* try finding "keymap/'keymap'.vim" in 'runtimepath' */ vim_snprintf((char *)buf, buflen, "keymap/%s.vim", curbuf->b_p_keymap); - if (source_runtime(buf, FALSE) == FAIL) + if (source_runtime(buf, 0) == FAIL) { vim_free(buf); return (char_u *)N_("E544: Keymap file not found"); @@ -2419,8 +2408,7 @@ keymap_init() * ":loadkeymap" command: load the following lines as the keymap. */ void -ex_loadkeymap(eap) - exarg_T *eap; +ex_loadkeymap(exarg_T *eap) { char_u *line; char_u *p; @@ -2496,16 +2484,14 @@ ex_loadkeymap(eap) p_cpo = save_cpo; curbuf->b_kmap_state |= KEYMAP_LOADED; -#ifdef FEAT_WINDOWS status_redraw_curbuf(); -#endif } /* * Stop using 'keymap'. */ static void -keymap_unload() +keymap_unload(void) { char_u buf[KMAP_MAXLEN + 10]; int i; @@ -2524,18 +2510,26 @@ keymap_unload() { vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from); (void)do_map(1, buf, LANGMAP, FALSE); - vim_free(kp[i].from); - vim_free(kp[i].to); } + keymap_clear(&curbuf->b_kmap_ga); p_cpo = save_cpo; ga_clear(&curbuf->b_kmap_ga); curbuf->b_kmap_state &= ~KEYMAP_LOADED; -#ifdef FEAT_WINDOWS status_redraw_curbuf(); -#endif } -#endif /* FEAT_KEYMAP */ + void +keymap_clear(garray_T *kmap) +{ + int i; + kmap_T *kp = (kmap_T *)kmap->ga_data; + for (i = 0; i < kmap->ga_len; ++i) + { + vim_free(kp[i].from); + vim_free(kp[i].to); + } +} +#endif /* FEAT_KEYMAP */ diff --git a/src/dosinst.c b/src/dosinst.c index 5b54380fe7..e5d1f75fd3 100644 --- a/src/dosinst.c +++ b/src/dosinst.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,8 +19,18 @@ #define DOSINST #include "dosinst.h" +#define GVIMEXT64_PATH "GvimExt64\\gvimext.dll" +#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll" + /* Macro to do an error check I was typing over and over */ -#define CHECK_REG_ERROR(code) if (code != ERROR_SUCCESS) { printf("%ld error number: %ld\n", (long)__LINE__, (long)code); return 1; } +#define CHECK_REG_ERROR(code) \ + do { \ + if (code != ERROR_SUCCESS) \ + { \ + printf("%ld error number: %ld\n", (long)__LINE__, (long)code); \ + return 1; \ + } \ + } while (0) int has_vim = 0; /* installable vim.exe exists */ int has_gvim = 0; /* installable gvim.exe exists */ @@ -75,23 +85,25 @@ char *(remap_choices[]) = { "\nChoose:", "Do not remap keys for Windows behavior", - "Remap a few keys for Windows behavior (<C-V>, <C-C>, etc)", + "Remap a few keys for Windows behavior (CTRL-V, CTRL-C, CTRL-F, etc)", }; -int remap_choice = (int)remap_win; +int remap_choice = (int)remap_no; char *remap_text = "- %s"; enum { mouse_xterm = 1, - mouse_mswin + mouse_mswin, + mouse_default }; char *(mouse_choices[]) = { "\nChoose the way how Vim uses the mouse:", "right button extends selection (the Unix way)", - "right button has a popup menu (the Windows way)", + "right button has a popup menu, left button starts select mode (the Windows way)", + "right button has a popup menu, left button starts visual mode", }; -int mouse_choice = (int)mouse_mswin; +int mouse_choice = (int)mouse_default; char *mouse_text = "- The mouse %s"; enum @@ -152,8 +164,7 @@ get_choice(char **table, int entries) { if (idx) printf("%2d ", idx); - printf(table[idx]); - printf("\n"); + puts(table[idx]); } printf("Choice: "); if (scanf("%d", &answer) != 1) @@ -359,7 +370,6 @@ find_bat_exe(int check_bat_only) mch_chdir(installdir); } -#ifdef WIN3264 /* * Get the value of $VIMRUNTIME or $VIM and write it in $TEMP/vimini.ini, so * that NSIS can read it. @@ -612,7 +622,6 @@ uninstall_check(int skip_question) return foundone; } -#endif /* * Find out information about the system. @@ -762,6 +771,7 @@ install_bat_choice(int idx) fprintf(fd, "@echo off\n"); fprintf(fd, "rem -- Run Vim --\n"); fprintf(fd, "\n"); + fprintf(fd, "setlocal\n"); /* Don't use double quotes for the "set" argument, also when it * contains a space. The quotes would be included in the value @@ -793,6 +803,9 @@ install_bat_choice(int idx) fprintf(fd, "if .%%1==. goto loopend\n"); if (*exename == 'g') { + fprintf(fd, "if NOT .%%1==.--nofork goto noforklongarg\n"); + fprintf(fd, "set VIMNOFORK=1\n"); + fprintf(fd, ":noforklongarg\n"); fprintf(fd, "if NOT .%%1==.-f goto noforkarg\n"); fprintf(fd, "set VIMNOFORK=1\n"); fprintf(fd, ":noforkarg\n"); @@ -1149,10 +1162,9 @@ install_vimrc(int idx) fprintf(fd, "set compatible\n"); break; case compat_some_enhancements: - fprintf(fd, "set nocompatible\n"); + fprintf(fd, "source $VIMRUNTIME/defaults.vim\n"); break; case compat_all_enhancements: - fprintf(fd, "set nocompatible\n"); fprintf(fd, "source $VIMRUNTIME/vimrc_example.vim\n"); break; } @@ -1172,6 +1184,8 @@ install_vimrc(int idx) case mouse_mswin: fprintf(fd, "behave mswin\n"); break; + case mouse_default: + break; } if ((tfd = fopen("diff.exe", "r")) != NULL) { @@ -1183,18 +1197,22 @@ install_vimrc(int idx) fprintf(fd, " let opt = '-a --binary '\n"); fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n"); fprintf(fd, " if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif\n"); - /* Use quotes only when needed, they may cause trouble. */ + /* Use quotes only when needed, they may cause trouble. + * Always escape "!". */ fprintf(fd, " let arg1 = v:fname_in\n"); fprintf(fd, " if arg1 =~ ' ' | let arg1 = '\"' . arg1 . '\"' | endif\n"); + fprintf(fd, " let arg1 = substitute(arg1, '!', '\\!', 'g')\n"); fprintf(fd, " let arg2 = v:fname_new\n"); fprintf(fd, " if arg2 =~ ' ' | let arg2 = '\"' . arg2 . '\"' | endif\n"); + fprintf(fd, " let arg2 = substitute(arg2, '!', '\\!', 'g')\n"); fprintf(fd, " let arg3 = v:fname_out\n"); fprintf(fd, " if arg3 =~ ' ' | let arg3 = '\"' . arg3 . '\"' | endif\n"); + fprintf(fd, " let arg3 = substitute(arg3, '!', '\\!', 'g')\n"); /* If the path has a space: When using cmd.exe (Win NT/2000/XP) put * quotes around the diff command and rely on the default value of - * shellxquote to solve the quoting problem for the whole command. - * + * shellxquote to solve the quoting problem for the whole command. + * * Otherwise put a double quote just before the space and at the * end of the command. Putting quotes around the whole thing * doesn't work on Win 95/98/ME. This is mostly guessed! */ @@ -1211,6 +1229,7 @@ install_vimrc(int idx) fprintf(fd, " else\n"); fprintf(fd, " let cmd = $VIMRUNTIME . '\\diff'\n"); fprintf(fd, " endif\n"); + fprintf(fd, " let cmd = substitute(cmd, '!', '\\!', 'g')\n"); fprintf(fd, " silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3\n"); fprintf(fd, " if exists('l:shxq_sav')\n"); fprintf(fd, " let &shellxquote=l:shxq_sav\n"); @@ -1309,24 +1328,24 @@ init_vimrc_choices(void) /* Whether to remap keys */ alloc_text(choice_count, remap_text , remap_choices[remap_choice]); choices[choice_count].changefunc = change_remap_choice; - choices[choice_count].installfunc = NULL;; + choices[choice_count].installfunc = NULL; choices[choice_count].active = (*oldvimrc == NUL); ++choice_count; /* default way to use the mouse */ alloc_text(choice_count, mouse_text, mouse_choices[mouse_choice]); choices[choice_count].changefunc = change_mouse_choice; - choices[choice_count].installfunc = NULL;; + choices[choice_count].installfunc = NULL; choices[choice_count].active = (*oldvimrc == NUL); ++choice_count; } -#if defined(WIN3264) static LONG reg_create_key( HKEY root, const char *subkey, - PHKEY phKey) + PHKEY phKey, + DWORD flag) { DWORD disp; @@ -1334,7 +1353,7 @@ reg_create_key( return RegCreateKeyEx( root, subkey, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WOW64_64KEY | KEY_WRITE, + flag | KEY_WRITE, NULL, phKey, &disp); } @@ -1353,10 +1372,11 @@ reg_create_key_and_value( HKEY hRootKey, const char *subkey, const char *value_name, - const char *data) + const char *data, + DWORD flag) { HKEY hKey; - LONG lRet = reg_create_key(hRootKey, subkey, &hKey); + LONG lRet = reg_create_key(hRootKey, subkey, &hKey, flag); if (ERROR_SUCCESS == lRet) { @@ -1372,21 +1392,22 @@ register_inproc_server( const char *clsid, const char *extname, const char *module, - const char *threading_model) + const char *threading_model, + DWORD flag) { CHAR subkey[BUFSIZE]; LONG lRet; sprintf(subkey, "CLSID\\%s", clsid); - lRet = reg_create_key_and_value(hRootKey, subkey, NULL, extname); + lRet = reg_create_key_and_value(hRootKey, subkey, NULL, extname, flag); if (ERROR_SUCCESS == lRet) { sprintf(subkey, "CLSID\\%s\\InProcServer32", clsid); - lRet = reg_create_key_and_value(hRootKey, subkey, NULL, module); + lRet = reg_create_key_and_value(hRootKey, subkey, NULL, module, flag); if (ERROR_SUCCESS == lRet) { lRet = reg_create_key_and_value(hRootKey, subkey, - "ThreadingModel", threading_model); + "ThreadingModel", threading_model, flag); } } return lRet; @@ -1397,13 +1418,15 @@ register_shellex( HKEY hRootKey, const char *clsid, const char *name, - const char *exe_path) + const char *exe_path, + DWORD flag) { LONG lRet = reg_create_key_and_value( hRootKey, "*\\shellex\\ContextMenuHandlers\\gvim", NULL, - clsid); + clsid, + flag); if (ERROR_SUCCESS == lRet) { @@ -1411,7 +1434,8 @@ register_shellex( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", clsid, - name); + name, + flag); if (ERROR_SUCCESS == lRet) { @@ -1419,7 +1443,8 @@ register_shellex( HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", "path", - exe_path); + exe_path, + flag); } } return lRet; @@ -1428,7 +1453,8 @@ register_shellex( static LONG register_openwith( HKEY hRootKey, - const char *exe_path) + const char *exe_path, + DWORD flag) { char exe_cmd[BUFSIZE]; LONG lRet; @@ -1438,7 +1464,8 @@ register_openwith( hRootKey, "Applications\\gvim.exe\\shell\\edit\\command", NULL, - exe_cmd); + exe_cmd, + flag); if (ERROR_SUCCESS == lRet) { @@ -1452,7 +1479,7 @@ register_openwith( for (i = 0; ERROR_SUCCESS == lRet && i < sizeof(openwith) / sizeof(openwith[0]); i++) { - lRet = reg_create_key_and_value(hRootKey, openwith[i], NULL, ""); + lRet = reg_create_key_and_value(hRootKey, openwith[i], NULL, "", flag); } } @@ -1467,14 +1494,13 @@ register_uninstall( const char *uninstall_string) { LONG lRet = reg_create_key_and_value(hRootKey, appname, - "DisplayName", display_name); + "DisplayName", display_name, KEY_WOW64_64KEY); if (ERROR_SUCCESS == lRet) lRet = reg_create_key_and_value(hRootKey, appname, - "UninstallString", uninstall_string); + "UninstallString", uninstall_string, KEY_WOW64_64KEY); return lRet; } -#endif /* WIN3264 */ /* * Add some entries to the registry: @@ -1486,7 +1512,6 @@ register_uninstall( static int install_registry(void) { -#ifdef WIN3264 LONG lRet = ERROR_SUCCESS; const char *vim_ext_ThreadingModel = "Apartment"; const char *vim_ext_name = "Vim Shell Extension"; @@ -1494,40 +1519,59 @@ install_registry(void) char vim_exe_path[BUFSIZE]; char display_name[BUFSIZE]; char uninstall_string[BUFSIZE]; + int i; + int loop_count = is_64bit_os() ? 2 : 1; + DWORD flag; sprintf(vim_exe_path, "%s\\gvim.exe", installdir); if (install_popup) { char bufg[BUFSIZE]; - struct stat st; - - if (stat("gvimext.dll", &st) >= 0) - sprintf(bufg, "%s\\gvimext.dll", installdir); - else - /* gvimext.dll is in gvimext subdir */ - sprintf(bufg, "%s\\gvimext\\gvimext.dll", installdir); printf("Creating \"Edit with Vim\" popup menu entry\n"); - lRet = register_inproc_server( - HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, - bufg, vim_ext_ThreadingModel); - if (ERROR_SUCCESS != lRet) - return FAIL; - lRet = register_shellex( - HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, vim_exe_path); - if (ERROR_SUCCESS != lRet) - return FAIL; + for (i = 0; i < loop_count; i++) + { + if (i == 0) + { + sprintf(bufg, "%s\\" GVIMEXT32_PATH, installdir); + flag = KEY_WOW64_32KEY; + } + else + { + sprintf(bufg, "%s\\" GVIMEXT64_PATH, installdir); + flag = KEY_WOW64_64KEY; + } + + lRet = register_inproc_server( + HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, + bufg, vim_ext_ThreadingModel, flag); + if (ERROR_SUCCESS != lRet) + return FAIL; + lRet = register_shellex( + HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, + vim_exe_path, flag); + if (ERROR_SUCCESS != lRet) + return FAIL; + } } if (install_openwith) { printf("Creating \"Open with ...\" list entry\n"); - lRet = register_openwith(HKEY_CLASSES_ROOT, vim_exe_path); - if (ERROR_SUCCESS != lRet) - return FAIL; + for (i = 0; i < loop_count; i++) + { + if (i == 0) + flag = KEY_WOW64_32KEY; + else + flag = KEY_WOW64_64KEY; + + lRet = register_openwith(HKEY_CLASSES_ROOT, vim_exe_path, flag); + if (ERROR_SUCCESS != lRet) + return FAIL; + } } printf("Creating an uninstall entry\n"); @@ -1551,7 +1595,6 @@ install_registry(void) uninstall_string); if (ERROR_SUCCESS != lRet) return FAIL; -#endif /* WIN3264 */ return OK; } @@ -1581,12 +1624,8 @@ init_popup_choice(void) struct stat st; if (has_gvim - && (stat("gvimext.dll", &st) >= 0 - || stat("gvimext/gvimext.dll", &st) >= 0) -#ifndef WIN3264 - && searchpath("regedit.exe") != NULL -#endif - ) + && (stat(GVIMEXT32_PATH, &st) >= 0 + || stat(GVIMEXT64_PATH, &st) >= 0)) { choices[choice_count].changefunc = change_popup_choice; choices[choice_count].installfunc = NULL; @@ -1620,11 +1659,7 @@ change_openwith_choice(int idx) static void init_openwith_choice(void) { - if (has_gvim -#ifndef WIN3264 - && searchpath("regedit.exe") != NULL -#endif - ) + if (has_gvim) { choices[choice_count].changefunc = change_openwith_choice; choices[choice_count].installfunc = NULL; @@ -1636,7 +1671,6 @@ init_openwith_choice(void) add_dummy_choice(); } -#ifdef WIN3264 /* create_shortcut * * Create a shell link. @@ -1932,21 +1966,16 @@ toggle_shortcut_choice(int idx) alloc_text(idx, "Create a desktop icon for %s", arg); } } -#endif /* WIN3264 */ static void init_startmenu_choice(void) { -#ifdef WIN3264 /* Start menu */ choices[choice_count].changefunc = toggle_startmenu_choice; choices[choice_count].installfunc = NULL; choices[choice_count].active = 1; toggle_startmenu_choice(choice_count); /* set the text */ ++choice_count; -#else - add_dummy_choice(); -#endif } /* @@ -1955,7 +1984,6 @@ init_startmenu_choice(void) static void init_shortcut_choices(void) { -#ifdef WIN3264 /* Shortcut to gvim */ choices[choice_count].text = NULL; choices[choice_count].arg = 0; @@ -1982,14 +2010,8 @@ init_shortcut_choices(void) choices[choice_count].installfunc = install_shortcut_gview; toggle_shortcut_choice(choice_count); ++choice_count; -#else - add_dummy_choice(); - add_dummy_choice(); - add_dummy_choice(); -#endif } -#ifdef WIN3264 /* * Attempt to register OLE for Vim. */ @@ -2001,16 +2023,9 @@ install_OLE_register(void) printf("\n--- Attempting to register Vim with OLE ---\n"); printf("(There is no message whether this works or not.)\n"); -#ifndef __CYGWIN__ sprintf(register_command_string, "\"%s\\gvim.exe\" -silent -register", installdir); -#else - /* handle this differently for Cygwin which sometimes has trouble with - * Windows-style pathnames here. */ - sprintf(register_command_string, "./gvim.exe -silent -register"); -#endif system(register_command_string); } -#endif /* WIN3264 */ /* * Remove the last part of directory "path[]" to get its parent, and put the @@ -2205,23 +2220,23 @@ print_cmd_line_help(void) printf(" Create .bat files for Vim variants in the Windows directory.\n"); printf("-create-vimrc\n"); printf(" Create a default _vimrc file if one does not already exist.\n"); + printf("-vimrc-remap [no|win]\n"); + printf(" Remap keys when creating a default _vimrc file.\n"); + printf("-vimrc-behave [unix|mswin|default]\n"); + printf(" Set mouse behavior when creating a default _vimrc file.\n"); printf("-install-popup\n"); printf(" Install the Edit-with-Vim context menu entry\n"); printf("-install-openwith\n"); printf(" Add Vim to the \"Open With...\" context menu list\n"); -#ifdef WIN3264 printf("-add-start-menu"); printf(" Add Vim to the start menu\n"); printf("-install-icons"); printf(" Create icons for gVim executables on the desktop\n"); -#endif printf("-create-directories [vim|home]\n"); printf(" Create runtime directories to drop plugins into; in the $VIM\n"); printf(" or $HOME directory\n"); -#ifdef WIN3264 printf("-register-OLE"); printf(" Ignored\n"); -#endif printf("\n"); } @@ -2264,6 +2279,28 @@ command_line_setup_choices(int argc, char **argv) */ init_vimrc_choices(); } + else if (strcmp(argv[i], "-vimrc-remap") == 0) + { + if (i + 1 == argc) + break; + i++; + if (strcmp(argv[i], "no") == 0) + remap_choice = remap_no; + else if (strcmp(argv[i], "win") == 0) + remap_choice = remap_win; + } + else if (strcmp(argv[i], "-vimrc-behave") == 0) + { + if (i + 1 == argc) + break; + i++; + if (strcmp(argv[i], "unix") == 0) + mouse_choice = mouse_xterm; + else if (strcmp(argv[i], "mswin") == 0) + mouse_choice = mouse_mswin; + else if (strcmp(argv[i], "default") == 0) + mouse_choice = mouse_default; + } else if (strcmp(argv[i], "-install-popup") == 0) { init_popup_choice(); @@ -2305,12 +2342,10 @@ command_line_setup_choices(int argc, char **argv) else /* No choice specified, default to vim directory */ vimfiles_dir_choice = (int)vimfiles_dir_vim; } -#ifdef WIN3264 else if (strcmp(argv[i], "-register-OLE") == 0) { /* This is always done when gvim is found */ } -#endif else /* Unknown switch */ { printf("Got unknown argument argv[%d] = %s\n", i, argv[i]); @@ -2430,8 +2465,7 @@ NULL printf("\n"); for (i = 0; items[i] != NULL; ++i) { - printf(items[i]); - printf("\n"); + puts(items[i]); printf("Hit Enter to continue, b (back) or q (quit help): "); c = getchar(); rewind(stdin); @@ -2468,11 +2502,9 @@ install(void) || !interactive) install_registry(); -#ifdef WIN3264 /* Register gvim with OLE. */ if (has_gvim) install_OLE_register(); -#endif } /* @@ -2508,7 +2540,6 @@ main(int argc, char **argv) /* Initialize this program. */ do_inits(argv); -#ifdef WIN3264 if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0) { /* Only check for already installed Vims. Used by NSIS installer. */ @@ -2524,7 +2555,6 @@ main(int argc, char **argv) sleep(3); exit(0); } -#endif printf("This program sets up the installation of Vim " VIM_VERSION_MEDIUM "\n\n"); @@ -2532,11 +2562,9 @@ main(int argc, char **argv) /* Check if the user unpacked the archives properly. */ check_unpack(); -#ifdef WIN3264 /* Check for already installed Vims. */ if (interactive) uninstall_check(0); -#endif /* Find out information about the system. */ inspect_system(); diff --git a/src/dosinst.h b/src/dosinst.h index b33426ad78..59de932489 100644 --- a/src/dosinst.h +++ b/src/dosinst.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -26,19 +26,10 @@ # include "vimio.h" # include <ctype.h> -# ifndef __CYGWIN__ -# include <direct.h> -# endif +# include <direct.h> -# if defined(_WIN64) || defined(WIN32) -# define WIN3264 -# include <windows.h> -# include <shlobj.h> -# else -# include <dir.h> -# include <bios.h> -# include <dos.h> -# endif +# include <windows.h> +# include <shlobj.h> #endif #ifdef UNIX_LINT @@ -46,26 +37,24 @@ char *searchpath(char *name); #endif -#if defined(DJGPP) || defined(UNIX_LINT) +#if defined(UNIX_LINT) # include <unistd.h> # include <errno.h> #endif #include "version.h" -#if defined(DJGPP) || defined(UNIX_LINT) +#if defined(UNIX_LINT) # define vim_mkdir(x, y) mkdir((char *)(x), y) #else -# if defined(WIN3264) && !defined(__BORLANDC__) +# ifndef __BORLANDC__ # define vim_mkdir(x, y) _mkdir((char *)(x)) # else # define vim_mkdir(x, y) mkdir((char *)(x)) # endif #endif -#ifndef DJGPP -# define sleep(n) Sleep((n) * 1000) -#endif +#define sleep(n) Sleep((n) * 1000) /* ---------------------------------------- */ @@ -90,6 +79,9 @@ char *searchpath(char *name); # ifndef KEY_WOW64_64KEY # define KEY_WOW64_64KEY 0x0100 # endif +# ifndef KEY_WOW64_32KEY +# define KEY_WOW64_32KEY 0x0200 +# endif #define VIM_STARTMENU "Programs\\Vim " VIM_VERSION_SHORT @@ -136,40 +128,32 @@ myexit(int n) exit(n); } -#ifdef WIN3264 -/* This symbol is not defined in older versions of the SDK or Visual C++ */ - -#ifndef VER_PLATFORM_WIN32_WINDOWS -# define VER_PLATFORM_WIN32_WINDOWS 1 -#endif - -static DWORD g_PlatformId; +typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL); /* - * Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or - * VER_PLATFORM_WIN32_WINDOWS (Win95). + * Check if this is a 64-bit OS. */ - static void -PlatformId(void) + static BOOL +is_64bit_os(void) { - static int done = FALSE; - - if (!done) - { - OSVERSIONINFO ovi; - - ovi.dwOSVersionInfoSize = sizeof(ovi); - GetVersionEx(&ovi); - - g_PlatformId = ovi.dwPlatformId; - done = TRUE; - } +#ifdef _WIN64 + return TRUE; +#else + BOOL bIsWow64 = FALSE; + LPFN_ISWOW64PROCESS pIsWow64Process; + + pIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( + GetModuleHandle("kernel32"), "IsWow64Process"); + if (pIsWow64Process != NULL) + pIsWow64Process(GetCurrentProcess(), &bIsWow64); + return bIsWow64; +#endif } -# ifdef __BORLANDC__ +#ifdef __BORLANDC__ /* Borland defines its own searchpath() in dir.h */ -# include <dir.h> -# else +# include <dir.h> +#else static char * searchpath(char *name) { @@ -178,28 +162,17 @@ searchpath(char *name) /* There appears to be a bug in FindExecutableA() on Windows NT. * Use FindExecutableW() instead... */ - PlatformId(); - if (g_PlatformId == VER_PLATFORM_WIN32_NT) + MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1, + (LPWSTR)widename, BUFSIZE); + if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", + (LPWSTR)location) > (HINSTANCE)32) { - MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1, - (LPWSTR)widename, BUFSIZE); - if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", - (LPWSTR)location) > (HINSTANCE)32) - { - WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, - (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); - return widename; - } - } - else - { - if (FindExecutableA((LPCTSTR)name, (LPCTSTR)"", - (LPTSTR)location) > (HINSTANCE)32) - return location; + WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, + (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); + return widename; } return NULL; } -# endif #endif /* @@ -219,7 +192,6 @@ searchpath_save(char *name) return s; } -#ifdef WIN3264 #ifndef CSIDL_COMMON_PROGRAMS # define CSIDL_COMMON_PROGRAMS 0x0017 @@ -357,7 +329,6 @@ get_shell_folder_path( return OK; } -#endif /* * List of targets. The first one (index zero) is used for the default path @@ -408,10 +379,8 @@ char *(icon_link_names[ICON_COUNT]) = "gVim Easy " VIM_VERSION_SHORT ".lnk", "gVim Read only " VIM_VERSION_SHORT ".lnk"}; -/* This is only used for dosinst.c when WIN3264 is defined and for uninstal.c - * when not being able to directly access registry entries. */ -#if (defined(DOSINST) && defined(WIN3264)) \ - || (!defined(DOSINST) && !defined(WIN3264)) +/* This is only used for dosinst.c. */ +#if defined(DOSINST) /* * Run an external command and wait for it to finish. */ @@ -423,9 +392,7 @@ run_command(char *cmd) char *p; /* On WinNT, 'start' is a shell built-in for cmd.exe rather than an - * executable (start.exe) like in Win9x. DJGPP, being a DOS program, - * is given the COMSPEC command.com by WinNT, so we have to find - * cmd.exe manually and use it. */ + * executable (start.exe) like in Win9x. */ cmd_path = searchpath_save("cmd.exe"); if (cmd_path != NULL) { @@ -452,7 +419,7 @@ run_command(char *cmd) /* * Append a backslash to "name" if there isn't one yet. */ - static void + void add_pathsep(char *name) { int len = strlen(name); @@ -468,24 +435,9 @@ add_pathsep(char *name) int change_drive(int drive) { -#ifdef WIN3264 char temp[3] = "-:"; temp[0] = (char)(drive + 'A' - 1); return !SetCurrentDirectory(temp); -#else -# ifndef UNIX_LINT - union REGS regs; - - regs.h.ah = 0x0e; - regs.h.dl = drive - 1; - intdos(®s, ®s); /* set default drive */ - regs.h.ah = 0x19; - intdos(®s, ®s); /* get default drive */ - if (regs.h.al == drive - 1) - return 0; -# endif - return -1; -#endif } /* @@ -511,7 +463,7 @@ mch_chdir(char *path) /* * Expand the executable name into a full path name. */ -#if defined(__BORLANDC__) && !defined(WIN3264) +#if defined(__BORLANDC__) /* Only Borland C++ has this. */ # define my_fullpath(b, n, l) _fullpath(b, n, l) @@ -520,92 +472,11 @@ mch_chdir(char *path) static char * my_fullpath(char *buf, char *fname, int len) { -# ifdef WIN3264 /* Only GetModuleFileName() will get the long file name path. * GetFullPathName() may still use the short (FAT) name. */ DWORD len_read = GetModuleFileName(NULL, buf, (size_t)len); return (len_read > 0 && len_read < (DWORD)len) ? buf : NULL; -# else - char olddir[BUFSIZE]; - char *p, *q; - int c; - char *retval = buf; - - if (strchr(fname, ':') != NULL) /* already expanded */ - { - strncpy(buf, fname, len); - } - else - { - *buf = NUL; - /* - * change to the directory for a moment, - * and then do the getwd() (and get back to where we were). - * This will get the correct path name with "../" things. - */ - p = strrchr(fname, '/'); - q = strrchr(fname, '\\'); - if (q != NULL && (p == NULL || q > p)) - p = q; - q = strrchr(fname, ':'); - if (q != NULL && (p == NULL || q > p)) - p = q; - if (p != NULL) - { - if (getcwd(olddir, BUFSIZE) == NULL) - { - p = NULL; /* can't get current dir: don't chdir */ - retval = NULL; - } - else - { - if (p == fname) /* /fname */ - q = p + 1; /* -> / */ - else if (q + 1 == p) /* ... c:\foo */ - q = p + 1; /* -> c:\ */ - else /* but c:\foo\bar */ - q = p; /* -> c:\foo */ - - c = *q; /* truncate at start of fname */ - *q = NUL; - if (mch_chdir(fname)) /* change to the directory */ - retval = NULL; - else - { - fname = q; - if (c == '\\') /* if we cut the name at a */ - fname++; /* '\', don't add it again */ - } - *q = c; - } - } - if (getcwd(buf, len) == NULL) - { - retval = NULL; - *buf = NUL; - } - /* - * Concatenate the file name to the path. - */ - if (strlen(buf) + strlen(fname) >= len - 1) - { - printf("ERROR: File name too long!\n"); - myexit(1); - } - add_pathsep(buf); - strcat(buf, fname); - if (p) - mch_chdir(olddir); - } - - /* Replace forward slashes with backslashes, required for the path to a - * command. */ - while ((p = strchr(buf, '/')) != NULL) - *p = '\\'; - - return retval; -# endif } #endif @@ -640,14 +511,6 @@ char *sysdrive; /* system drive or "c:\" */ static void do_inits(char **argv) { -#ifdef DJGPP - /* - * Use Long File Names by default, if $LFN not set. - */ - if (getenv("LFN") == NULL) - putenv("LFN=y"); -#endif - /* Find out the full path of our executable. */ if (my_fullpath(installdir, argv[0], BUFSIZE) == NULL) { diff --git a/src/edit.c b/src/edit.c index a72ea8bc4a..8cef9854ba 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -17,37 +17,41 @@ /* * definitions used for CTRL-X submode */ -#define CTRL_X_WANT_IDENT 0x100 - -#define CTRL_X_NOT_DEFINED_YET 1 -#define CTRL_X_SCROLL 2 -#define CTRL_X_WHOLE_LINE 3 -#define CTRL_X_FILES 4 -#define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) -#define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) -#define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) -#define CTRL_X_FINISHED 8 -#define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) -#define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) -#define CTRL_X_CMDLINE 11 -#define CTRL_X_FUNCTION 12 -#define CTRL_X_OMNI 13 -#define CTRL_X_SPELL 14 -#define CTRL_X_LOCAL_MSG 15 /* only used in "ctrl_x_msgs" */ - -#define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] - +# define CTRL_X_WANT_IDENT 0x100 + +# define CTRL_X_NORMAL 0 /* CTRL-N CTRL-P completion, default */ +# define CTRL_X_NOT_DEFINED_YET 1 +# define CTRL_X_SCROLL 2 +# define CTRL_X_WHOLE_LINE 3 +# define CTRL_X_FILES 4 +# define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) +# define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) +# define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) +# define CTRL_X_FINISHED 8 +# define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) +# define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) +# define CTRL_X_CMDLINE 11 +# define CTRL_X_FUNCTION 12 +# define CTRL_X_OMNI 13 +# define CTRL_X_SPELL 14 +# define CTRL_X_LOCAL_MSG 15 /* only used in "ctrl_x_msgs" */ +# define CTRL_X_EVAL 16 /* for builtin function complete() */ + +# define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] +# define CTRL_X_MODE_LINE_OR_EVAL(m) ((m) == CTRL_X_WHOLE_LINE || (m) == CTRL_X_EVAL) + +/* Message for CTRL-X mode, index is ctrl_x_mode. */ static char *ctrl_x_msgs[] = { - N_(" Keyword completion (^N^P)"), /* ctrl_x_mode == 0, ^P/^N compl. */ + N_(" Keyword completion (^N^P)"), /* CTRL_X_NORMAL, ^P/^N compl. */ N_(" ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)"), - NULL, + NULL, /* CTRL_X_SCROLL: depends on state */ N_(" Whole line completion (^L^N^P)"), N_(" File name completion (^F^N^P)"), N_(" Tag completion (^]^N^P)"), N_(" Path pattern completion (^N^P)"), N_(" Definition completion (^D^N^P)"), - NULL, + NULL, /* CTRL_X_FINISHED */ N_(" Dictionary completion (^K^N^P)"), N_(" Thesaurus completion (^T^N^P)"), N_(" Command-line completion (^V^N^P)"), @@ -55,13 +59,14 @@ static char *ctrl_x_msgs[] = N_(" Omni completion (^O^N^P)"), N_(" Spelling suggestion (s^N^P)"), N_(" Keyword Local completion (^N^P)"), + NULL, /* CTRL_X_EVAL doesn't use msg. */ }; static char e_hitend[] = N_("Hit end of paragraph"); -#ifdef FEAT_COMPL_FUNC +# ifdef FEAT_COMPL_FUNC static char e_complwin[] = N_("E839: Completion function changed window"); static char e_compldel[] = N_("E840: Completion function deleted text"); -#endif +# endif /* * Structure used to store one match for insert completion. @@ -80,8 +85,8 @@ struct compl_S int cp_number; /* sequence number */ }; -#define ORIGINAL_TEXT (1) /* the original text when the expansion begun */ -#define FREE_FNAME (2) +# define ORIGINAL_TEXT (1) /* the original text when the expansion begun */ +# define FREE_FNAME (2) /* * All the current matches are stored in a list. @@ -93,6 +98,7 @@ struct compl_S static compl_T *compl_first_match = NULL; static compl_T *compl_curr_match = NULL; static compl_T *compl_shown_match = NULL; +static compl_T *compl_old_match = NULL; /* After using a cursor key <Enter> selects a match in the popup menu, * otherwise it inserts a line break. */ @@ -105,6 +111,11 @@ static char_u *compl_leader = NULL; static int compl_get_longest = FALSE; /* put longest common string in compl_leader */ +static int compl_no_insert = FALSE; /* FALSE: select & insert + TRUE: noinsert */ +static int compl_no_select = FALSE; /* FALSE: select & insert + TRUE: noselect */ + static int compl_used_match; /* Selected one of the matches. When FALSE the match was edited or using the longest common string. */ @@ -118,6 +129,9 @@ static int compl_restarting = FALSE; /* don't insert match */ * FALSE the word to be completed must be located. */ static int compl_started = FALSE; +/* Which Ctrl-X mode are we in? */ +static int ctrl_x_mode = CTRL_X_NORMAL; + /* Set when doing something for completion that may call edit() recursively, * which is not allowed. */ static int compl_busy = FALSE; @@ -137,48 +151,49 @@ static expand_T compl_xp; static int compl_opt_refresh_always = FALSE; -static void ins_ctrl_x __ARGS((void)); -static int has_compl_option __ARGS((int dict_opt)); -static int ins_compl_accept_char __ARGS((int c)); -static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup)); -static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len)); -static void ins_compl_longest_match __ARGS((compl_T *match)); -static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase)); -static int ins_compl_make_cyclic __ARGS((void)); -static void ins_compl_upd_pum __ARGS((void)); -static void ins_compl_del_pum __ARGS((void)); -static int pum_wanted __ARGS((void)); -static int pum_enough_matches __ARGS((void)); -static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int flags, int thesaurus)); -static void ins_compl_files __ARGS((int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir)); -static char_u *find_line_end __ARGS((char_u *ptr)); -static void ins_compl_free __ARGS((void)); -static void ins_compl_clear __ARGS((void)); -static int ins_compl_bs __ARGS((void)); -static int ins_compl_need_restart __ARGS((void)); -static void ins_compl_new_leader __ARGS((void)); -static void ins_compl_addleader __ARGS((int c)); -static int ins_compl_len __ARGS((void)); -static void ins_compl_restart __ARGS((void)); -static void ins_compl_set_original_text __ARGS((char_u *str)); -static void ins_compl_addfrommatch __ARGS((void)); -static int ins_compl_prep __ARGS((int c)); -static void ins_compl_fixRedoBufForLeader __ARGS((char_u *ptr_arg)); -static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag)); -#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) -static void ins_compl_add_list __ARGS((list_T *list)); -static void ins_compl_add_dict __ARGS((dict_T *dict)); -#endif -static int ins_compl_get_exp __ARGS((pos_T *ini)); -static void ins_compl_delete __ARGS((void)); -static void ins_compl_insert __ARGS((void)); -static int ins_compl_next __ARGS((int allow_get_expansion, int count, int insert_match)); -static int ins_compl_key2dir __ARGS((int c)); -static int ins_compl_pum_key __ARGS((int c)); -static int ins_compl_key2count __ARGS((int c)); -static int ins_compl_use_match __ARGS((int c)); -static int ins_complete __ARGS((int c)); -static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len)); +static void ins_ctrl_x(void); +static int has_compl_option(int dict_opt); +static int ins_compl_accept_char(int c); +static int ins_compl_add(char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup); +static int ins_compl_equal(compl_T *match, char_u *str, int len); +static void ins_compl_longest_match(compl_T *match); +static void ins_compl_add_matches(int num_matches, char_u **matches, int icase); +static int ins_compl_make_cyclic(void); +static void ins_compl_upd_pum(void); +static void ins_compl_del_pum(void); +static int pum_wanted(void); +static int pum_enough_matches(void); +static void ins_compl_dictionaries(char_u *dict, char_u *pat, int flags, int thesaurus); +static void ins_compl_files(int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir); +static char_u *find_line_end(char_u *ptr); +static void ins_compl_free(void); +static void ins_compl_clear(void); +static int ins_compl_bs(void); +static int ins_compl_need_restart(void); +static void ins_compl_new_leader(void); +static void ins_compl_addleader(int c); +static int ins_compl_len(void); +static void ins_compl_restart(void); +static void ins_compl_set_original_text(char_u *str); +static void ins_compl_addfrommatch(void); +static int ins_compl_prep(int c); +static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg); +static buf_T *ins_compl_next_buf(buf_T *buf, int flag); +# if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) +static void ins_compl_add_list(list_T *list); +static void ins_compl_add_dict(dict_T *dict); +# endif +static int ins_compl_get_exp(pos_T *ini); +static void ins_compl_delete(void); +static void ins_compl_insert(int in_compl_func); +static int ins_compl_next(int allow_get_expansion, int count, int insert_match, int in_compl_func); +static int ins_compl_key2dir(int c); +static int ins_compl_pum_key(int c); +static int ins_compl_key2count(int c); +static int ins_compl_use_match(int c); +static int ins_complete(int c, int enable_pum); +static void show_pum(int prev_w_wrow, int prev_w_leftcol); +static unsigned quote_meta(char_u *dest, char_u *str, int len); #endif /* FEAT_INS_EXPAND */ #define BACKSPACE_CHAR 1 @@ -186,78 +201,83 @@ static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len)); #define BACKSPACE_WORD_NOT_SPACE 3 #define BACKSPACE_LINE 4 -static void ins_redraw __ARGS((int ready)); -static void ins_ctrl_v __ARGS((void)); -static void undisplay_dollar __ARGS((void)); -static void insert_special __ARGS((int, int, int)); -static void internal_format __ARGS((int textwidth, int second_indent, int flags, int format_only, int c)); -static void check_auto_format __ARGS((int)); -static void redo_literal __ARGS((int c)); -static void start_arrow __ARGS((pos_T *end_insert_pos)); +static void ins_redraw(int ready); +static void ins_ctrl_v(void); +#ifdef FEAT_JOB_CHANNEL +static void init_prompt(int cmdchar_todo); +#endif +static void undisplay_dollar(void); +static void insert_special(int, int, int); +static void internal_format(int textwidth, int second_indent, int flags, int format_only, int c); +static void check_auto_format(int); +static void redo_literal(int c); +static void start_arrow(pos_T *end_insert_pos); +static void start_arrow_with_change(pos_T *end_insert_pos, int change); +static void start_arrow_common(pos_T *end_insert_pos, int change); #ifdef FEAT_SPELL -static void check_spell_redraw __ARGS((void)); -static void spell_back_to_badword __ARGS((void)); +static void check_spell_redraw(void); +static void spell_back_to_badword(void); static int spell_bad_len = 0; /* length of located bad word */ #endif -static void stop_insert __ARGS((pos_T *end_insert_pos, int esc, int nomove)); -static int echeck_abbr __ARGS((int)); -static int replace_pop __ARGS((void)); -static void replace_join __ARGS((int off)); -static void replace_pop_ins __ARGS((void)); +static void stop_insert(pos_T *end_insert_pos, int esc, int nomove); +static int echeck_abbr(int); +static int replace_pop(void); +static void replace_join(int off); +static void replace_pop_ins(void); #ifdef FEAT_MBYTE -static void mb_replace_pop_ins __ARGS((int cc)); +static void mb_replace_pop_ins(int cc); #endif -static void replace_flush __ARGS((void)); -static void replace_do_bs __ARGS((int limit_col)); -static int del_char_after_col __ARGS((int limit_col)); +static void replace_flush(void); +static void replace_do_bs(int limit_col); +static int del_char_after_col(int limit_col); #ifdef FEAT_CINDENT -static int cindent_on __ARGS((void)); +static int cindent_on(void); #endif -static void ins_reg __ARGS((void)); -static void ins_ctrl_g __ARGS((void)); -static void ins_ctrl_hat __ARGS((void)); -static int ins_esc __ARGS((long *count, int cmdchar, int nomove)); +static void ins_reg(void); +static void ins_ctrl_g(void); +static void ins_ctrl_hat(void); +static int ins_esc(long *count, int cmdchar, int nomove); #ifdef FEAT_RIGHTLEFT -static void ins_ctrl_ __ARGS((void)); -#endif -static int ins_start_select __ARGS((int c)); -static void ins_insert __ARGS((int replaceState)); -static void ins_ctrl_o __ARGS((void)); -static void ins_shift __ARGS((int c, int lastc)); -static void ins_del __ARGS((void)); -static int ins_bs __ARGS((int c, int mode, int *inserted_space_p)); +static void ins_ctrl_(void); +#endif +static int ins_start_select(int c); +static void ins_insert(int replaceState); +static void ins_ctrl_o(void); +static void ins_shift(int c, int lastc); +static void ins_del(void); +static int ins_bs(int c, int mode, int *inserted_space_p); #ifdef FEAT_MOUSE -static void ins_mouse __ARGS((int c)); -static void ins_mousescroll __ARGS((int dir)); +static void ins_mouse(int c); +static void ins_mousescroll(int dir); #endif #if defined(FEAT_GUI_TABLINE) || defined(PROTO) -static void ins_tabline __ARGS((int c)); -#endif -static void ins_left __ARGS((void)); -static void ins_home __ARGS((int c)); -static void ins_end __ARGS((int c)); -static void ins_s_left __ARGS((void)); -static void ins_right __ARGS((void)); -static void ins_s_right __ARGS((void)); -static void ins_up __ARGS((int startcol)); -static void ins_pageup __ARGS((void)); -static void ins_down __ARGS((int startcol)); -static void ins_pagedown __ARGS((void)); +static void ins_tabline(int c); +#endif +static void ins_left(int end_change); +static void ins_home(int c); +static void ins_end(int c); +static void ins_s_left(void); +static void ins_right(int end_change); +static void ins_s_right(void); +static void ins_up(int startcol); +static void ins_pageup(void); +static void ins_down(int startcol); +static void ins_pagedown(void); #ifdef FEAT_DND -static void ins_drop __ARGS((void)); +static void ins_drop(void); #endif -static int ins_tab __ARGS((void)); -static int ins_eol __ARGS((int c)); +static int ins_tab(void); +static int ins_eol(int c); #ifdef FEAT_DIGRAPHS -static int ins_digraph __ARGS((void)); +static int ins_digraph(void); #endif -static int ins_ctrl_ey __ARGS((int tc)); +static int ins_ctrl_ey(int tc); #ifdef FEAT_SMARTINDENT -static void ins_try_si __ARGS((int c)); +static void ins_try_si(int c); #endif -static colnr_T get_nolist_virtcol __ARGS((void)); -#ifdef FEAT_AUTOCMD -static char_u *do_insert_char_pre __ARGS((int c)); +static colnr_T get_nolist_virtcol(void); +#if defined(FEAT_EVAL) +static char_u *do_insert_char_pre(int c); #endif static colnr_T Insstart_textlen; /* length of line when insert started */ @@ -289,6 +309,8 @@ static int ins_need_undo; /* call u_save() before inserting a static int did_add_space = FALSE; /* auto_format() added an extra space under the cursor */ +static int dont_sync_undo = FALSE; /* CTRL-G U prevents syncing undo for + the next left/right cursor */ /* * edit(): Start inserting text. @@ -296,6 +318,7 @@ static int did_add_space = FALSE; /* auto_format() added an extra space * "cmdchar" can be: * 'i' normal insert command * 'a' normal append command + * K_PS bracketed paste * 'R' replace command * 'r' "r<CR>" command: insert one <CR>. Note: count can be > 1, for redo, * but still only one <CR> is inserted. The <Esc> is not used for redo. @@ -309,14 +332,14 @@ static int did_add_space = FALSE; /* auto_format() added an extra space * Return TRUE if a CTRL-O command caused the return (insert mode pending). */ int -edit(cmdchar, startln, count) - int cmdchar; - int startln; /* if set, insert at start of line */ - long count; +edit( + int cmdchar, + int startln, /* if set, insert at start of line */ + long count) { int c = 0; char_u *ptr; - int lastc; + int lastc = 0; int mincol; static linenr_T o_lnum = 0; int i; @@ -331,6 +354,9 @@ edit(cmdchar, startln, count) int inserted_space = FALSE; /* just inserted a space */ int replaceState = REPLACE; int nomove = FALSE; /* don't move cursor on return */ +#ifdef FEAT_JOB_CHANNEL + int cmdchar_todo = cmdchar; +#endif /* Remember whether editing was restarted after CTRL-O. */ did_restart_edit = restart_edit; @@ -368,7 +394,6 @@ edit(cmdchar, startln, count) ins_compl_clear(); /* clear stuff for CTRL-X mode */ #endif -#ifdef FEAT_AUTOCMD /* * Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx". */ @@ -376,7 +401,7 @@ edit(cmdchar, startln, count) { pos_T save_cursor = curwin->w_cursor; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (cmdchar == 'R') ptr = (char_u *)"r"; else if (cmdchar == 'V') @@ -385,7 +410,7 @@ edit(cmdchar, startln, count) ptr = (char_u *)"i"; set_vim_var_string(VV_INSERTMODE, ptr, 1); set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */ -# endif +#endif apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf); /* Make sure the cursor didn't move. Do call check_cursor_col() in @@ -394,10 +419,10 @@ edit(cmdchar, startln, count) * the "A" command, thus set State to avoid that. Also check that the * line number is still valid (lines may have been deleted). * Do not restore if v:char was set to a non-empty string. */ - if (!equalpos(curwin->w_cursor, save_cursor) -# ifdef FEAT_EVAL + if (!EQUAL_POS(curwin->w_cursor, save_cursor) +#ifdef FEAT_EVAL && *get_vim_var_str(VV_CHAR) == NUL -# endif +#endif && save_cursor.lnum <= curbuf->b_ml.ml_line_count) { int save_state = State; @@ -408,12 +433,11 @@ edit(cmdchar, startln, count) State = save_state; } } -#endif #ifdef FEAT_CONCEAL /* Check if the cursor line needs redrawing before changing State. If * 'concealcursor' is "n" it needs to be redrawn without concealing. */ - conceal_check_cursur_line(); + conceal_check_cursor_line(); #endif #ifdef FEAT_MOUSE @@ -449,7 +473,10 @@ edit(cmdchar, startln, count) else #endif { - AppendCharToRedobuff(cmdchar); + if (cmdchar == K_PS) + AppendCharToRedobuff('a'); + else + AppendCharToRedobuff(cmdchar); if (cmdchar == 'g') /* "gI" command */ AppendCharToRedobuff('I'); else if (cmdchar == 'r') /* "r<CR>" command */ @@ -498,7 +525,7 @@ edit(cmdchar, startln, count) */ if (curbuf->b_p_iminsert == B_IMODE_LMAP) State |= LANGMAP; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); #endif @@ -517,11 +544,15 @@ edit(cmdchar, startln, count) revins_legal = 0; revins_scol = -1; #endif + if (!p_ek) + /* Disable bracketed paste mode, we won't recognize the escape + * sequences. */ + out_str(T_BD); /* * Handle restarting Insert mode. - * Don't do this for "CTRL-O ." (repeat an insert): we get here with - * restart_edit non-zero, and something in the stuff buffer. + * Don't do this for "CTRL-O ." (repeat an insert): In that case we get + * here with something in the stuff buffer. */ if (restart_edit != 0 && stuff_empty()) { @@ -636,7 +667,11 @@ edit(cmdchar, startln, count) if (update_Insstart_orig) Insstart_orig = Insstart; - if (stop_insert_mode) + if (stop_insert_mode +#ifdef FEAT_INS_EXPAND + && !pum_visible() +#endif + ) { /* ":stopinsert" used or 'insertmode' reset */ count = 0; @@ -678,6 +713,14 @@ edit(cmdchar, startln, count) foldCheckClose(); #endif +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf)) + { + init_prompt(cmdchar_todo); + cmdchar_todo = NUL; + } +#endif + /* * If we inserted a character at the last position of the last line in * the window, scroll the window one line up. This avoids an extra @@ -735,15 +778,11 @@ edit(cmdchar, startln, count) */ ins_redraw(TRUE); -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif -#ifdef FEAT_CURSORBIND if (curwin->w_p_crb) do_check_cursorbind(); -#endif update_curswant(); old_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -755,18 +794,35 @@ edit(cmdchar, startln, count) #endif /* - * Get a character for Insert mode. Ignore K_IGNORE. + * Get a character for Insert mode. Ignore K_IGNORE and K_NOP. */ - lastc = c; /* remember previous char for CTRL-D */ - do - { - c = safe_vgetc(); - } while (c == K_IGNORE); + if (c != K_CURSORHOLD) + lastc = c; /* remember the previous char for CTRL-D */ + + /* After using CTRL-G U the next cursor key will not break undo. */ + if (dont_sync_undo == MAYBE) + dont_sync_undo = TRUE; + else + dont_sync_undo = FALSE; + if (cmdchar == K_PS) + /* Got here from normal mode when bracketed paste started. */ + c = K_PS; + else + do + { + c = safe_vgetc(); + + if (stop_insert_mode) + { + // Insert mode ended, possibly from a callback. + count = 0; + nomove = TRUE; + goto doESCkey; + } + } while (c == K_IGNORE || c == K_NOP); -#ifdef FEAT_AUTOCMD /* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */ did_cursorhold = TRUE; -#endif #ifdef FEAT_RIGHTLEFT if (p_hkmap && KeyTyped) @@ -802,7 +858,7 @@ edit(cmdchar, startln, count) * "compl_leader". Except when at the original match and * there is nothing to add, CTRL-L works like CTRL-P then. */ if (c == Ctrl_L - && (ctrl_x_mode != CTRL_X_WHOLE_LINE + && (!CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode) || (int)STRLEN(compl_shown_match->cp_str) > curwin->w_cursor.col - compl_col)) { @@ -814,14 +870,14 @@ edit(cmdchar, startln, count) * completion: Add to "compl_leader". */ if (ins_compl_accept_char(c)) { -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* Trigger InsertCharPre. */ char_u *str = do_insert_char_pre(c); char_u *p; if (str != NULL) { - for (p = str; *p != NUL; mb_ptr_adv(p)) + for (p = str; *p != NUL; MB_PTR_ADV(p)) ins_compl_addleader(PTR2CHAR(p)); vim_free(str); } @@ -833,11 +889,12 @@ edit(cmdchar, startln, count) /* Pressing CTRL-Y selects the current match. When * compl_enter_selects is set the Enter key does the same. */ - if (c == Ctrl_Y || (compl_enter_selects - && (c == CAR || c == K_KENTER || c == NL))) + if ((c == Ctrl_Y || (compl_enter_selects + && (c == CAR || c == K_KENTER || c == NL))) + && stop_arrow() == OK) { ins_compl_delete(); - ins_compl_insert(); + ins_compl_insert(FALSE); } } } @@ -946,7 +1003,7 @@ edit(cmdchar, startln, count) case ESC: /* End input mode */ if (echeck_abbr(ESC + ABBR_OFF)) break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case Ctrl_C: /* End input mode */ #ifdef FEAT_CMDWIN @@ -959,6 +1016,19 @@ edit(cmdchar, startln, count) goto doESCkey; } #endif +#ifdef FEAT_JOB_CHANNEL + if (c == Ctrl_C && bt_prompt(curbuf)) + { + if (invoke_prompt_interrupt()) + { + if (!bt_prompt(curbuf)) + // buffer changed to a non-prompt buffer, get out of + // Insert mode + goto doESCkey; + break; + } + } +#endif #ifdef UNIX do_intr: @@ -973,7 +1043,7 @@ edit(cmdchar, startln, count) got_int = FALSE; } else - vim_beep(); + vim_beep(BO_IM); break; } doESCkey: @@ -987,12 +1057,10 @@ edit(cmdchar, startln, count) if (ins_esc(&count, cmdchar, nomove)) { -#ifdef FEAT_AUTOCMD if (cmdchar != 'r' && cmdchar != 'v') apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL, FALSE, curbuf); did_cursorhold = FALSE; -#endif return (c == Ctrl_O); } continue; @@ -1000,9 +1068,11 @@ edit(cmdchar, startln, count) case Ctrl_Z: /* suspend when 'insertmode' set */ if (!p_im) goto normalchar; /* insert CTRL-Z as normal char */ - stuffReadbuff((char_u *)":st\r"); - c = Ctrl_O; - /*FALLTHROUGH*/ + do_cmdline_cmd((char_u *)"stop"); +#ifdef CURSOR_SHAPE + ui_cursor_shape(); /* may need to update cursor shape */ +#endif + continue; case Ctrl_O: /* execute one command */ #ifdef FEAT_COMPL_FUNC @@ -1032,12 +1102,6 @@ edit(cmdchar, startln, count) case K_SELECT: /* end of Select mode mapping - ignore */ break; -#ifdef FEAT_SNIFF - case K_SNIFF: /* Sniff command received */ - stuffcharReadbuff(K_SNIFF); - goto doESCkey; -#endif - case K_HELP: /* Help key works like <ESC> <Help> */ case K_F1: case K_XF1: @@ -1122,6 +1186,18 @@ edit(cmdchar, startln, count) break; case Ctrl_W: /* delete word before the cursor */ +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && (mod_mask & MOD_MASK_SHIFT) == 0) + { + // In a prompt window CTRL-W is used for window commands. + // Use Shift-CTRL-W to delete a word. + stuffcharReadbuff(Ctrl_W); + restart_edit = 'A'; + nomove = TRUE; + count = 0; + goto doESCkey; + } +#endif did_backspace = ins_bs(c, BACKSPACE_WORD, &inserted_space); auto_format(FALSE, TRUE); break; @@ -1143,6 +1219,7 @@ edit(cmdchar, startln, count) case K_LEFTDRAG: case K_LEFTRELEASE: case K_LEFTRELEASE_NM: + case K_MOUSEMOVE: case K_MIDDLEMOUSE: case K_MIDDLEDRAG: case K_MIDDLERELEASE: @@ -1183,6 +1260,16 @@ edit(cmdchar, startln, count) break; # endif #endif + case K_PS: + bracketed_paste(PASTE_INSERT, FALSE, NULL); + if (cmdchar == K_PS) + /* invoked from normal mode, bail out */ + goto doESCkey; + break; + case K_PE: + /* Got K_PE without K_PS, ignore. */ + break; + #ifdef FEAT_GUI_TABLINE case K_TABLINE: case K_TABMENU: @@ -1193,13 +1280,10 @@ edit(cmdchar, startln, count) case K_IGNORE: /* Something mapped to nothing */ break; - -#ifdef FEAT_AUTOCMD case K_CURSORHOLD: /* Didn't type something for a while. */ apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; break; -#endif #ifdef FEAT_GUI_W32 /* On Win32 ignore <M-F4>, we get it when closing the window was @@ -1238,7 +1322,7 @@ edit(cmdchar, startln, count) if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) ins_s_left(); else - ins_left(); + ins_left(dont_sync_undo == FALSE); break; case K_S_LEFT: /* <S-Left> */ @@ -1250,7 +1334,7 @@ edit(cmdchar, startln, count) if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) ins_s_right(); else - ins_right(); + ins_right(dont_sync_undo == FALSE); break; case K_S_RIGHT: /* <S-Right> */ @@ -1326,7 +1410,7 @@ edit(cmdchar, startln, count) /* FALLTHROUGH */ case CAR: case NL: -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* In a quickfix window a <CR> jumps to the error under the * cursor. */ if (bt_quickfix(curbuf) && c == CAR) @@ -1346,7 +1430,18 @@ edit(cmdchar, startln, count) goto doESCkey; } #endif - if (ins_eol(c) && !p_im) +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf)) + { + invoke_prompt_callback(); + if (!bt_prompt(curbuf)) + // buffer changed to a non-prompt buffer, get out of + // Insert mode + goto doESCkey; + break; + } +#endif + if (ins_eol(c) == FAIL && !p_im) goto doESCkey; /* out of memory */ auto_format(FALSE, FALSE); inserted_space = FALSE; @@ -1414,14 +1509,21 @@ edit(cmdchar, startln, count) /* if 'complete' is empty then plain ^P is no longer special, * but it is under other ^X modes */ if (*curbuf->b_p_cpt == NUL - && ctrl_x_mode != 0 + && (ctrl_x_mode == CTRL_X_NORMAL + || ctrl_x_mode == CTRL_X_WHOLE_LINE) && !(compl_cont_status & CONT_LOCAL)) goto normalchar; docomplete: compl_busy = TRUE; - if (ins_complete(c) == FAIL) +#ifdef FEAT_FOLDING + disable_fold_update++; /* don't redraw folds here */ +#endif + if (ins_complete(c, TRUE) == FAIL) compl_cont_status = 0; +#ifdef FEAT_FOLDING + disable_fold_update--; +#endif compl_busy = FALSE; break; #endif /* FEAT_INS_EXPAND */ @@ -1441,7 +1543,7 @@ edit(cmdchar, startln, count) /* * Insert a normal character. */ -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if (!p_paste) { /* Trigger InsertCharPre. */ @@ -1453,7 +1555,7 @@ edit(cmdchar, startln, count) if (*str != NUL && stop_arrow() != FAIL) { /* Insert the new value of v:char literally. */ - for (p = str; *p != NUL; mb_ptr_adv(p)) + for (p = str; *p != NUL; MB_PTR_ADV(p)) { c = PTR2CHAR(p); if (c == CAR || c == K_KENTER || c == NL) @@ -1518,11 +1620,14 @@ edit(cmdchar, startln, count) break; } /* end of switch (c) */ -#ifdef FEAT_AUTOCMD /* If typed something may trigger CursorHoldI again. */ - if (c != K_CURSORHOLD) - did_cursorhold = FALSE; + if (c != K_CURSORHOLD +#ifdef FEAT_COMPL_FUNC + /* but not in CTRL-X mode, a script can't restore the state */ + && ctrl_x_mode == CTRL_X_NORMAL #endif + ) + did_cursorhold = FALSE; /* If the cursor was moved we didn't just insert a space */ if (arrow_used) @@ -1531,7 +1636,7 @@ edit(cmdchar, startln, count) #ifdef FEAT_CINDENT if (can_cindent && cindent_on() # ifdef FEAT_INS_EXPAND - && ctrl_x_mode == 0 + && ctrl_x_mode == CTRL_X_NORMAL # endif ) { @@ -1560,8 +1665,8 @@ edit(cmdchar, startln, count) * inserting sequences of characters (e.g., for CTRL-R). */ static void -ins_redraw(ready) - int ready UNUSED; /* not busy with something */ +ins_redraw( + int ready UNUSED) /* not busy with something */ { #ifdef FEAT_CONCEAL linenr_T conceal_old_cursor_line = 0; @@ -1572,23 +1677,17 @@ ins_redraw(ready) if (char_avail()) return; -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) +#if defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. Not when the popup menu is * visible, the command might delete it. */ - if (ready && ( -# ifdef FEAT_AUTOCMD - has_cursormovedI() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif -# ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 + if (ready && (has_cursormovedI() +# if defined(FEAT_CONCEAL) + || curwin->w_p_cole > 0 # endif ) - && !equalpos(last_cursormoved, curwin->w_cursor) + && !EQUAL_POS(last_cursormoved, curwin->w_cursor) # ifdef FEAT_INS_EXPAND - && !pum_visible() + && !pum_visible() # endif ) { @@ -1600,10 +1699,13 @@ ins_redraw(ready) if (syntax_present(curwin) && must_redraw) update_screen(0); # endif -# ifdef FEAT_AUTOCMD if (has_cursormovedI()) + { + /* Make sure curswant is correct, an autocommand may call + * getcurpos(). */ + update_curswant(); apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); -# endif + } # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { @@ -1616,19 +1718,38 @@ ins_redraw(ready) } #endif -#ifdef FEAT_AUTOCMD /* Trigger TextChangedI if b_changedtick differs. */ if (ready && has_textchangedI() - && last_changedtick != curbuf->b_changedtick -# ifdef FEAT_INS_EXPAND + && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) +#ifdef FEAT_INS_EXPAND && !pum_visible() -# endif +#endif ) { - if (last_changedtick_buf == curbuf) - apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); - last_changedtick_buf = curbuf; - last_changedtick = curbuf->b_changedtick; + aco_save_T aco; + + // save and restore curwin and curbuf, in case the autocmd changes them + aucmd_prepbuf(&aco, curbuf); + apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); + aucmd_restbuf(&aco); + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); + } + +#ifdef FEAT_INS_EXPAND + /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes + * TextChangedI will need to trigger for backwards compatibility, thus use + * different b_last_changedtick* variables. */ + if (ready && has_textchangedP() + && curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf) + && pum_visible()) + { + aco_save_T aco; + + // save and restore curwin and curbuf, in case the autocmd changes them + aucmd_prepbuf(&aco, curbuf); + apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf); + aucmd_restbuf(&aco); + curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); } #endif @@ -1658,7 +1779,7 @@ ins_redraw(ready) * Handle a CTRL-V or CTRL-Q typed in Insert mode. */ static void -ins_ctrl_v() +ins_ctrl_v(void) { int c; int did_putchar = FALSE; @@ -1707,9 +1828,7 @@ static int pc_row; static int pc_col; void -edit_putchar(c, highlight) - int c; - int highlight; +edit_putchar(int c, int highlight) { int attr; @@ -1718,18 +1837,18 @@ edit_putchar(c, highlight) update_topline(); /* just in case w_topline isn't valid */ validate_cursor(); if (highlight) - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); else attr = 0; pc_row = W_WINROW(curwin) + curwin->w_wrow; - pc_col = W_WINCOL(curwin); + pc_col = curwin->w_wincol; #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE) pc_status = PC_STATUS_UNSET; #endif #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { - pc_col += W_WIDTH(curwin) - 1 - curwin->w_wcol; + pc_col += curwin->w_width - 1 - curwin->w_wcol; # ifdef FEAT_MBYTE if (has_mbyte) { @@ -1766,11 +1885,78 @@ edit_putchar(c, highlight) } } +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) +/* + * Return the effective prompt for the current buffer. + */ + char_u * +prompt_text(void) +{ + if (curbuf->b_prompt_text == NULL) + return (char_u *)"% "; + return curbuf->b_prompt_text; +} + +/* + * Prepare for prompt mode: Make sure the last line has the prompt text. + * Move the cursor to this line. + */ + static void +init_prompt(int cmdchar_todo) +{ + char_u *prompt = prompt_text(); + char_u *text; + + curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + text = ml_get_curline(); + if (STRNCMP(text, prompt, STRLEN(prompt)) != 0) + { + // prompt is missing, insert it or append a line with it + if (*text == NUL) + ml_replace(curbuf->b_ml.ml_line_count, prompt, TRUE); + else + ml_append(curbuf->b_ml.ml_line_count, prompt, 0, FALSE); + curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + coladvance((colnr_T)MAXCOL); + changed_bytes(curbuf->b_ml.ml_line_count, 0); + } + + // Insert always starts after the prompt, allow editing text after it. + if (Insstart_orig.lnum != curwin->w_cursor.lnum + || Insstart_orig.col != (int)STRLEN(prompt)) + { + Insstart.lnum = curwin->w_cursor.lnum; + Insstart.col = (int)STRLEN(prompt); + Insstart_orig = Insstart; + Insstart_textlen = Insstart.col; + Insstart_blank_vcol = MAXCOL; + arrow_used = FALSE; + } + + if (cmdchar_todo == 'A') + coladvance((colnr_T)MAXCOL); + if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt)) + curwin->w_cursor.col = (int)STRLEN(prompt); + /* Make sure the cursor is in a valid position. */ + check_cursor(); +} + +/* + * Return TRUE if the cursor is in the editable position of the prompt line. + */ + int +prompt_curpos_editable() +{ + return curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count + && curwin->w_cursor.col >= (int)STRLEN(prompt_text()); +} +#endif + /* * Undo the previous edit_putchar(). */ void -edit_unputchar() +edit_unputchar(void) { if (pc_status != PC_STATUS_UNSET && pc_row >= msg_scrolled) { @@ -1790,8 +1976,7 @@ edit_unputchar() * Only works when cursor is in the line that changes. */ void -display_dollar(col) - colnr_T col; +display_dollar(colnr_T col) { colnr_T save_col; @@ -1812,7 +1997,7 @@ display_dollar(col) } #endif curs_columns(FALSE); /* recompute w_wrow and w_wcol */ - if (curwin->w_wcol < W_WIDTH(curwin)) + if (curwin->w_wcol < curwin->w_width) { edit_putchar('$', FALSE); dollar_vcol = curwin->w_virtcol; @@ -1825,7 +2010,7 @@ display_dollar(col) * in insert mode. */ static void -undisplay_dollar() +undisplay_dollar(void) { if (dollar_vcol >= 0) { @@ -1843,12 +2028,12 @@ undisplay_dollar() * if round is TRUE, round the indent to 'shiftwidth' (only with _INC and _Dec). */ void -change_indent(type, amount, round, replaced, call_changed_bytes) - int type; - int amount; - int round; - int replaced; /* replaced character, put on replace stack */ - int call_changed_bytes; /* call changed_bytes() */ +change_indent( + int type, + int amount, + int round, + int replaced, /* replaced character, put on replace stack */ + int call_changed_bytes) /* call changed_bytes() */ { int vcol; int last_vcol; @@ -2092,13 +2277,12 @@ change_indent(type, amount, round, replaced, call_changed_bytes) * modes. */ void -truncate_spaces(line) - char_u *line; +truncate_spaces(char_u *line) { int i; /* find start of trailing white space */ - for (i = (int)STRLEN(line) - 1; i >= 0 && vim_iswhite(line[i]); i--) + for (i = (int)STRLEN(line) - 1; i >= 0 && VIM_ISWHITE(line[i]); i--) { if (State & REPLACE_FLAG) replace_join(0); /* remove a NUL from the replace stack */ @@ -2115,8 +2299,7 @@ truncate_spaces(line) * character. */ void -backspace_until_column(col) - int col; +backspace_until_column(int col) { while ((int)curwin->w_cursor.col > col) { @@ -2135,8 +2318,7 @@ backspace_until_column(col) * Return TRUE when something was deleted. */ static int -del_char_after_col(limit_col) - int limit_col UNUSED; +del_char_after_col(int limit_col UNUSED) { #ifdef FEAT_MBYTE if (enc_utf8 && limit_col >= 0) @@ -2170,7 +2352,7 @@ del_char_after_col(limit_col) * CTRL-X pressed in Insert mode. */ static void -ins_ctrl_x() +ins_ctrl_x(void) { /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X * CTRL-V works like CTRL-N */ @@ -2190,12 +2372,29 @@ ins_ctrl_x() } } +/* + * Whether other than default completion has been selected. + */ + int +ctrl_x_mode_not_default(void) +{ + return ctrl_x_mode != CTRL_X_NORMAL; +} + +/* + * Whether CTRL-X was typed without a following character. + */ + int +ctrl_x_mode_not_defined_yet(void) +{ + return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET; +} + /* * Return TRUE if the 'dict' or 'tsr' option can be used. */ static int -has_compl_option(dict_opt) - int dict_opt; +has_compl_option(int dict_opt) { if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL # ifdef FEAT_SPELL @@ -2204,17 +2403,20 @@ has_compl_option(dict_opt) ) : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) { - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; msg_attr(dict_opt ? (char_u *)_("'dictionary' option is empty") : (char_u *)_("'thesaurus' option is empty"), - hl_attr(HLF_E)); + HL_ATTR(HLF_E)); if (emsg_silent == 0) { - vim_beep(); + vim_beep(BO_COMPL); setcursor(); out_flush(); - ui_delay(2000L, FALSE); +#ifdef FEAT_EVAL + if (!get_vim_var_nr(VV_TESTING)) +#endif + ui_delay(2000L, FALSE); } return FALSE; } @@ -2226,8 +2428,7 @@ has_compl_option(dict_opt) * This depends on the current mode. */ int -vim_is_ctrl_x_key(c) - int c; +vim_is_ctrl_x_key(int c) { /* Always allow ^R - let it's results then be checked */ if (c == Ctrl_R) @@ -2277,8 +2478,10 @@ vim_is_ctrl_x_key(c) #endif case CTRL_X_SPELL: return (c == Ctrl_S || c == Ctrl_P || c == Ctrl_N); + case CTRL_X_EVAL: + return (c == Ctrl_P || c == Ctrl_N); } - EMSG(_(e_internal)); + internal_error("vim_is_ctrl_x_key()"); return FALSE; } @@ -2288,8 +2491,7 @@ vim_is_ctrl_x_key(c) * is visible. */ static int -ins_compl_accept_char(c) - int c; +ins_compl_accept_char(int c) { if (ctrl_x_mode & CTRL_X_WANT_IDENT) /* When expanding an identifier only accept identifier chars. */ @@ -2307,7 +2509,7 @@ ins_compl_accept_char(c) case CTRL_X_OMNI: /* Command line and Omni completion can work with just about any * printable character, but do stop at white space. */ - return vim_isprintc(c) && !vim_iswhite(c); + return vim_isprintc(c) && !VIM_ISWHITE(c); case CTRL_X_WHOLE_LINE: /* For while line completion a space can be part of the line. */ @@ -2323,13 +2525,13 @@ ins_compl_accept_char(c) * the rest of the word to be in -- webb */ int -ins_compl_add_infercase(str, len, icase, fname, dir, flags) - char_u *str; - int len; - int icase; - char_u *fname; - int dir; - int flags; +ins_compl_add_infercase( + char_u *str, + int len, + int icase, + char_u *fname, + int dir, + int flags) { char_u *p; int i, c; @@ -2352,7 +2554,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags) actual_len = 0; while (*p != NUL) { - mb_ptr_adv(p); + MB_PTR_ADV(p); ++actual_len; } } @@ -2368,7 +2570,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags) actual_compl_length = 0; while (*p != NUL) { - mb_ptr_adv(p); + MB_PTR_ADV(p); ++actual_compl_length; } } @@ -2492,15 +2694,15 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags) * maybe because alloc() returns NULL, then FAIL is returned. */ static int -ins_compl_add(str, len, icase, fname, cptext, cdir, flags, adup) - char_u *str; - int len; - int icase; - char_u *fname; - char_u **cptext; /* extra text for popup menu or NULL */ - int cdir; - int flags; - int adup; /* accept duplicate match */ +ins_compl_add( + char_u *str, + int len, + int icase, + char_u *fname, + char_u **cptext, /* extra text for popup menu or NULL */ + int cdir, + int flags, + int adup) /* accept duplicate match */ { compl_T *match; int dir = (cdir == 0 ? compl_direction : cdir); @@ -2611,10 +2813,7 @@ ins_compl_add(str, len, icase, fname, cptext, cdir, flags, adup) * match->cp_icase. */ static int -ins_compl_equal(match, str, len) - compl_T *match; - char_u *str; - int len; +ins_compl_equal(compl_T *match, char_u *str, int len) { if (match->cp_icase) return STRNICMP(match->cp_str, str, (size_t)len) == 0; @@ -2625,8 +2824,7 @@ ins_compl_equal(match, str, len) * Reduce the longest common string for match "match". */ static void -ins_compl_longest_match(match) - compl_T *match; +ins_compl_longest_match(compl_T *match) { char_u *p, *s; int c1, c2; @@ -2675,8 +2873,8 @@ ins_compl_longest_match(match) #ifdef FEAT_MBYTE if (has_mbyte) { - mb_ptr_adv(p); - mb_ptr_adv(s); + MB_PTR_ADV(p); + MB_PTR_ADV(s); } else #endif @@ -2710,10 +2908,10 @@ ins_compl_longest_match(match) * Frees matches[]. */ static void -ins_compl_add_matches(num_matches, matches, icase) - int num_matches; - char_u **matches; - int icase; +ins_compl_add_matches( + int num_matches, + char_u **matches, + int icase) { int i; int add_r = OK; @@ -2731,7 +2929,7 @@ ins_compl_add_matches(num_matches, matches, icase) * Return the number of matches (excluding the original). */ static int -ins_compl_make_cyclic() +ins_compl_make_cyclic(void) { compl_T *match; int count = 0; @@ -2754,23 +2952,37 @@ ins_compl_make_cyclic() return count; } +/* + * Set variables that store noselect and noinsert behavior from the + * 'completeopt' value. + */ + void +completeopt_was_set(void) +{ + compl_no_insert = FALSE; + compl_no_select = FALSE; + if (strstr((char *)p_cot, "noselect") != NULL) + compl_no_select = TRUE; + if (strstr((char *)p_cot, "noinsert") != NULL) + compl_no_insert = TRUE; +} + /* * Start completion for the complete() function. * "startcol" is where the matched text starts (1 is first column). * "list" is the list of matches. */ void -set_completion(startcol, list) - colnr_T startcol; - list_T *list; +set_completion(colnr_T startcol, list_T *list) { + int save_w_wrow = curwin->w_wrow; + int save_w_leftcol = curwin->w_leftcol; + /* If already doing completions stop it. */ - if (ctrl_x_mode != 0) + if (ctrl_x_mode != CTRL_X_NORMAL) ins_compl_prep(' '); ins_compl_clear(); - - if (stop_arrow() == FAIL) - return; + ins_compl_free(); compl_direction = FORWARD; if (startcol > curwin->w_cursor.col) @@ -2783,8 +2995,7 @@ set_completion(startcol, list) -1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) return; - /* Handle like dictionary completion. */ - ctrl_x_mode = CTRL_X_WHOLE_LINE; + ctrl_x_mode = CTRL_X_EVAL; ins_compl_add_list(list); compl_matches = ins_compl_make_cyclic(); @@ -2793,7 +3004,20 @@ set_completion(startcol, list) compl_cont_status = 0; compl_curr_match = compl_first_match; - ins_complete(Ctrl_N); + if (compl_no_insert || compl_no_select) + { + ins_complete(K_DOWN, FALSE); + if (compl_no_select) + /* Down/Up has no real effect. */ + ins_complete(K_UP, FALSE); + } + else + ins_complete(Ctrl_N, FALSE); + compl_enter_selects = compl_no_insert; + + /* Lazily show the popup menu, unless we got interrupted. */ + if (!compl_interrupted) + show_pum(save_w_wrow, save_w_leftcol); out_flush(); } @@ -2807,7 +3031,7 @@ static int compl_match_arraysize; * Update the screen and when there is any scrolling remove the popup menu. */ static void -ins_compl_upd_pum() +ins_compl_upd_pum(void) { int h; @@ -2824,13 +3048,12 @@ ins_compl_upd_pum() * Remove any popup menu. */ static void -ins_compl_del_pum() +ins_compl_del_pum(void) { if (compl_match_array != NULL) { pum_undisplay(); - vim_free(compl_match_array); - compl_match_array = NULL; + VIM_CLEAR(compl_match_array); } } @@ -2838,7 +3061,7 @@ ins_compl_del_pum() * Return TRUE if the popup menu should be displayed. */ static int -pum_wanted() +pum_wanted(void) { /* 'completeopt' must contain "menu" or "menuone" */ if (vim_strchr(p_cot, 'm') == NULL) @@ -2859,7 +3082,7 @@ pum_wanted() * One if 'completopt' contains "menuone". */ static int -pum_enough_matches() +pum_enough_matches(void) { compl_T *compl; int i; @@ -2886,7 +3109,7 @@ pum_enough_matches() * Also adjusts "compl_shown_match" to an entry that is actually displayed. */ void -ins_compl_show_pum() +ins_compl_show_pum(void) { compl_T *compl; compl_T *shown_compl = NULL; @@ -3013,6 +3236,10 @@ ins_compl_show_pum() if (compl_match_array != NULL) { + /* In Replace mode when a $ is displayed at the end of the line only + * part of the screen would be updated. We do need to redraw here. */ + dollar_vcol = -1; + /* Compute the screen column of the start of the completed text. * Use the cursor to get all wrapping and other settings right. */ col = curwin->w_cursor.col; @@ -3030,11 +3257,11 @@ ins_compl_show_pum() * files "dict_start" to the list of completions. */ static void -ins_compl_dictionaries(dict_start, pat, flags, thesaurus) - char_u *dict_start; - char_u *pat; - int flags; /* DICT_FIRST and/or DICT_EXACT */ - int thesaurus; /* Thesaurus completion */ +ins_compl_dictionaries( + char_u *dict_start, + char_u *pat, + int flags, /* DICT_FIRST and/or DICT_EXACT */ + int thesaurus) /* Thesaurus completion */ { char_u *dict = dict_start; char_u *ptr; @@ -3070,7 +3297,7 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus) /* When invoked to match whole lines for CTRL-X CTRL-L adjust the pattern * to only match at the start of a line. Otherwise just match the * pattern. Also need to double backslashes. */ - if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) { char_u *pat_esc = vim_strsave_escaped(pat, (char_u *)"\\"); size_t len; @@ -3154,14 +3381,14 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus) } static void -ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir) - int count; - char_u **files; - int thesaurus; - int flags; - regmatch_T *regmatch; - char_u *buf; - int *dir; +ins_compl_files( + int count, + char_u **files, + int thesaurus, + int flags, + regmatch_T *regmatch, + char_u *buf, + int *dir) { char_u *ptr; int i; @@ -3175,7 +3402,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir) { vim_snprintf((char *)IObuff, IOSIZE, _("Scanning dictionary: %s"), (char *)files[i]); - (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); + (void)msg_trunc_attr(IObuff, TRUE, HL_ATTR(HLF_R)); } if (fp != NULL) @@ -3191,7 +3418,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir) while (vim_regexec(regmatch, buf, (colnr_T)(ptr - buf))) { ptr = regmatch->startp[0]; - if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) ptr = find_line_end(ptr); else ptr = find_word_end(ptr); @@ -3251,7 +3478,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir) break; } line_breakcheck(); - ins_compl_check_keys(50); + ins_compl_check_keys(50, FALSE); } fclose(fp); } @@ -3263,8 +3490,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir) * Returns a pointer to the first char of the word. Also stops at a NUL. */ char_u * -find_word_start(ptr) - char_u *ptr; +find_word_start(char_u *ptr) { #ifdef FEAT_MBYTE if (has_mbyte) @@ -3282,8 +3508,7 @@ find_word_start(ptr) * Returns a pointer to just after the word. */ char_u * -find_word_end(ptr) - char_u *ptr; +find_word_end(char_u *ptr) { #ifdef FEAT_MBYTE int start_class; @@ -3311,8 +3536,7 @@ find_word_end(ptr) * Returns a pointer to just after the line. */ static char_u * -find_line_end(ptr) - char_u *ptr; +find_line_end(char_u *ptr) { char_u *s; @@ -3326,15 +3550,13 @@ find_line_end(ptr) * Free the list of completions */ static void -ins_compl_free() +ins_compl_free(void) { compl_T *match; int i; - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_leader); - compl_leader = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_leader); if (compl_first_match == NULL) return; @@ -3357,29 +3579,29 @@ ins_compl_free() } while (compl_curr_match != NULL && compl_curr_match != compl_first_match); compl_first_match = compl_curr_match = NULL; compl_shown_match = NULL; + compl_old_match = NULL; } static void -ins_compl_clear() +ins_compl_clear(void) { compl_cont_status = 0; compl_started = FALSE; compl_matches = 0; - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_leader); - compl_leader = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_leader); edit_submode_extra = NULL; - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_orig_text); compl_enter_selects = FALSE; + /* clear v:completed_item */ + set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); } /* * Return TRUE when Insert completion is active. */ int -ins_compl_active() +ins_compl_active(void) { return compl_started; } @@ -3391,20 +3613,23 @@ ins_compl_active() * to be got from the user. */ static int -ins_compl_bs() +ins_compl_bs(void) { char_u *line; char_u *p; line = ml_get_curline(); p = line + curwin->w_cursor.col; - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); /* Stop completion when the whole word was deleted. For Omni completion - * allow the word to be deleted, we won't match everything. */ + * allow the word to be deleted, we won't match everything. + * Respect the 'backspace' option. */ if ((int)(p - line) - (int)compl_col < 0 || ((int)(p - line) - (int)compl_col == 0 - && (ctrl_x_mode & CTRL_X_OMNI) == 0)) + && ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL + || (!can_bs(BS_START) && (int)(p - line) - (int)compl_col + - compl_length < 0)) return K_BS; /* Deleted more than what was used to find matches or didn't finish @@ -3431,7 +3656,7 @@ ins_compl_bs() * be called. */ static int -ins_compl_need_restart() +ins_compl_need_restart(void) { /* Return TRUE if we didn't complete finding matches or when the * 'completefunc' returned "always" in the "refresh" dictionary item. */ @@ -3446,7 +3671,7 @@ ins_compl_need_restart() * May also search for matches again if the previous search was interrupted. */ static void -ins_compl_new_leader() +ins_compl_new_leader(void) { ins_compl_del_pum(); ins_compl_delete(); @@ -3471,12 +3696,11 @@ ins_compl_new_leader() { /* Show the cursor after the match, not after the redrawn text. */ setcursor(); - out_flush(); - gui_update_cursor(FALSE, FALSE); + out_flush_cursor(FALSE, FALSE); } #endif compl_restarting = TRUE; - if (ins_complete(Ctrl_N) == FAIL) + if (ins_complete(Ctrl_N, TRUE) == FAIL) compl_cont_status = 0; compl_restarting = FALSE; } @@ -3496,7 +3720,7 @@ ins_compl_new_leader() * the cursor column. Making sure it never goes below zero. */ static int -ins_compl_len() +ins_compl_len(void) { int off = (int)curwin->w_cursor.col - (int)compl_col; @@ -3510,12 +3734,15 @@ ins_compl_len() * matches. */ static void -ins_compl_addleader(c) - int c; +ins_compl_addleader(int c) { #ifdef FEAT_MBYTE int cc; +#endif + if (stop_arrow() == FAIL) + return; +#ifdef FEAT_MBYTE if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; @@ -3556,7 +3783,7 @@ ins_compl_addleader(c) * BS or a key was typed while still searching for matches. */ static void -ins_compl_restart() +ins_compl_restart(void) { ins_compl_free(); compl_started = FALSE; @@ -3569,12 +3796,13 @@ ins_compl_restart() * Set the first match, the original text. */ static void -ins_compl_set_original_text(str) - char_u *str; +ins_compl_set_original_text(char_u *str) { char_u *p; - /* Replace the original text entry. */ + /* Replace the original text entry. + * The ORIGINAL_TEXT flag is either at the first item or might possibly be + * at the last item for backward completion */ if (compl_first_match->cp_flags & ORIGINAL_TEXT) /* safety check */ { p = vim_strsave(str); @@ -3584,6 +3812,16 @@ ins_compl_set_original_text(str) compl_first_match->cp_str = p; } } + else if (compl_first_match->cp_prev != NULL + && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT)) + { + p = vim_strsave(str); + if (p != NULL) + { + vim_free(compl_first_match->cp_prev->cp_str); + compl_first_match->cp_prev->cp_str = p; + } + } } /* @@ -3591,7 +3829,7 @@ ins_compl_set_original_text(str) * matches. */ static void -ins_compl_addfrommatch() +ins_compl_addfrommatch(void) { char_u *p; int len = (int)curwin->w_cursor.col - (int)compl_col; @@ -3634,8 +3872,7 @@ ins_compl_addfrommatch() * Returns TRUE when the character is not to be inserted; */ static int -ins_compl_prep(c) - int c; +ins_compl_prep(int c) { char_u *ptr; int want_cindent; @@ -3659,10 +3896,11 @@ ins_compl_prep(c) /* Set "compl_get_longest" when finding the first matches. */ if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET - || (ctrl_x_mode == 0 && !compl_started)) + || (ctrl_x_mode == CTRL_X_NORMAL && !compl_started)) { - compl_get_longest = (vim_strchr(p_cot, 'l') != NULL); + compl_get_longest = (strstr((char *)p_cot, "longest") != NULL); compl_used_match = TRUE; + } if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET) @@ -3763,19 +4001,19 @@ ins_compl_prep(c) else compl_cont_mode = CTRL_X_NOT_DEFINED_YET; } - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; showmode(); break; } } - else if (ctrl_x_mode != 0) + else if (ctrl_x_mode != CTRL_X_NORMAL) { /* We're already in CTRL-X mode, do we stay in it? */ if (!vim_is_ctrl_x_key(c)) { if (ctrl_x_mode == CTRL_X_SCROLL) - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; else ctrl_x_mode = CTRL_X_FINISHED; edit_submode = NULL; @@ -3789,8 +4027,8 @@ ins_compl_prep(c) * 'Pattern not found') until another key is hit, then go back to * showing what mode we are in. */ showmode(); - if ((ctrl_x_mode == 0 && c != Ctrl_N && c != Ctrl_P && c != Ctrl_R - && !ins_compl_pum_key(c)) + if ((ctrl_x_mode == CTRL_X_NORMAL && c != Ctrl_N && c != Ctrl_P + && c != Ctrl_R && !ins_compl_pum_key(c)) || ctrl_x_mode == CTRL_X_FINISHED) { /* Get here when we have finished typing a sequence of ^N and @@ -3838,7 +4076,8 @@ ins_compl_prep(c) /* put the cursor on the last char, for 'tw' formatting */ if (prev_col > 0) dec_cursor(); - if (stop_arrow() == OK) + /* only format when something was inserted */ + if (!arrow_used && !ins_need_undo && c != Ctrl_E) insertchar(NUL, 0, -1); if (prev_col > 0 && ml_get_curline()[curwin->w_cursor.col] != NUL) @@ -3853,7 +4092,8 @@ ins_compl_prep(c) && pum_visible()) retval = TRUE; - /* CTRL-E means completion is Ended, go back to the typed text. */ + /* CTRL-E means completion is Ended, go back to the typed text. + * but only do this, if the Popup is still visible */ if (c == Ctrl_E) { ins_compl_delete(); @@ -3871,7 +4111,7 @@ ins_compl_prep(c) compl_matches = 0; if (!shortmess(SHM_COMPLETIONMENU)) msg_clr_cmdline(); /* necessary for "noshowmode" */ - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; compl_enter_selects = FALSE; if (edit_submode != NULL) { @@ -3879,6 +4119,12 @@ ins_compl_prep(c) showmode(); } +#ifdef FEAT_CMDWIN + if (c == Ctrl_C && cmdwin_type != 0) + /* Avoid the popup menu remains displayed when leaving the + * command line window. */ + update_screen(0); +#endif #ifdef FEAT_CINDENT /* * Indent now if a key was typed that is in 'cinkeys'. @@ -3886,19 +4132,15 @@ ins_compl_prep(c) if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0))) do_c_expr_indent(); #endif -#ifdef FEAT_AUTOCMD /* Trigger the CompleteDone event to give scripts a chance to act * upon the completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); -#endif } } -#ifdef FEAT_AUTOCMD else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) /* Trigger the CompleteDone event to give scripts a chance to act * upon the (possibly failed) completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); -#endif /* reset continue_* if we left expansion-mode, if we stay they'll be * (re)set properly in ins_complete() */ @@ -3917,8 +4159,7 @@ ins_compl_prep(c) * "ptr" is the known leader text or NUL. */ static void -ins_compl_fixRedoBufForLeader(ptr_arg) - char_u *ptr_arg; +ins_compl_fixRedoBufForLeader(char_u *ptr_arg) { int len; char_u *p; @@ -3940,7 +4181,7 @@ ins_compl_fixRedoBufForLeader(ptr_arg) if (len > 0) len -= (*mb_head_off)(p, p + len); #endif - for (p += len; *p != NUL; mb_ptr_adv(p)) + for (p += len; *p != NUL; MB_PTR_ADV(p)) AppendCharToRedobuff(K_BS); } else @@ -3958,26 +4199,18 @@ ins_compl_fixRedoBufForLeader(ptr_arg) * Returns the buffer to scan, if any, otherwise returns curbuf -- Acevedo */ static buf_T * -ins_compl_next_buf(buf, flag) - buf_T *buf; - int flag; +ins_compl_next_buf(buf_T *buf, int flag) { -#ifdef FEAT_WINDOWS static win_T *wp; -#endif if (flag == 'w') /* just windows */ { -#ifdef FEAT_WINDOWS if (buf == curbuf) /* first call for this flag/expansion */ wp = curwin; while ((wp = (wp->w_next != NULL ? wp->w_next : firstwin)) != curwin && wp->w_buffer->b_scanned) ; buf = wp->w_buffer; -#else - buf = curbuf; -#endif } else /* 'b' (just loaded buffers), 'u' (just non-loaded buffers) or 'U' @@ -3994,20 +4227,18 @@ ins_compl_next_buf(buf, flag) } #ifdef FEAT_COMPL_FUNC -static void expand_by_function __ARGS((int type, char_u *base)); - /* * Execute user defined complete function 'completefunc' or 'omnifunc', and * get matches in "matches". */ static void -expand_by_function(type, base) - int type; /* CTRL_X_OMNI or CTRL_X_FUNCTION */ - char_u *base; +expand_by_function( + int type, /* CTRL_X_OMNI or CTRL_X_FUNCTION */ + char_u *base) { list_T *matchlist = NULL; dict_T *matchdict = NULL; - char_u *args[2]; + typval_T args[3]; char_u *funcname; pos_T pos; win_T *curwin_save; @@ -4019,15 +4250,18 @@ expand_by_function(type, base) return; /* Call 'completefunc' to obtain the list of matches. */ - args[0] = (char_u *)"0"; - args[1] = base; + args[0].v_type = VAR_NUMBER; + args[0].vval.v_number = 0; + args[1].v_type = VAR_STRING; + args[1].vval.v_string = base != NULL ? base : (char_u *)""; + args[2].v_type = VAR_UNKNOWN; pos = curwin->w_cursor; curwin_save = curwin; curbuf_save = curbuf; /* Call a function, which returns a list or dict. */ - if (call_vim_function(funcname, 2, args, FALSE, FALSE, &rettv) == OK) + if (call_vim_function(funcname, 2, args, &rettv, FALSE) == OK) { switch (rettv.v_type) { @@ -4050,8 +4284,8 @@ expand_by_function(type, base) goto theend; } curwin->w_cursor = pos; /* restore the cursor position */ - check_cursor(); - if (!equalpos(curwin->w_cursor, pos)) + validate_cursor(); + if (!EQUAL_POS(curwin->w_cursor, pos)) { EMSG(_(e_compldel)); goto theend; @@ -4075,8 +4309,7 @@ expand_by_function(type, base) * Add completions from a list. */ static void -ins_compl_add_list(list) - list_T *list; +ins_compl_add_list(list_T *list) { listitem_T *li; int dir = compl_direction; @@ -4096,8 +4329,7 @@ ins_compl_add_list(list) * Add completions from a dict. */ static void -ins_compl_add_dict(dict) - dict_T *dict; +ins_compl_add_dict(dict_T *dict) { dictitem_T *di_refresh; dictitem_T *di_words; @@ -4126,9 +4358,7 @@ ins_compl_add_dict(dict) * maybe because alloc() returns NULL, then FAIL is returned. */ int -ins_compl_add_tv(tv, dir) - typval_T *tv; - int dir; +ins_compl_add_tv(typval_T *tv, int dir) { char_u *word; int icase = FALSE; @@ -4147,6 +4377,8 @@ ins_compl_add_tv(tv, dir) (char_u *)"kind", FALSE); cptext[CPT_INFO] = get_dict_string(tv->vval.v_dict, (char_u *)"info", FALSE); + cptext[CPT_USER_DATA] = get_dict_string(tv->vval.v_dict, + (char_u *)"user_data", FALSE); if (get_dict_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL) icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase"); if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL) @@ -4175,8 +4407,7 @@ ins_compl_add_tv(tv, dir) * Return the total number of matches or -1 if still unknown -- Acevedo */ static int -ins_compl_get_exp(ini) - pos_T *ini; +ins_compl_get_exp(pos_T *ini) { static pos_T first_match_pos; static pos_T last_match_pos; @@ -4198,12 +4429,11 @@ ins_compl_get_exp(ini) char_u *ptr; char_u *dict = NULL; int dict_f = 0; - compl_T *old_match; int set_match_pos; if (!compl_started) { - for (ins_buf = firstbuf; ins_buf != NULL; ins_buf = ins_buf->b_next) + FOR_ALL_BUFFERS(ins_buf) ins_buf->b_scanned = 0; found_all = FALSE; ins_buf = curbuf; @@ -4212,7 +4442,7 @@ ins_compl_get_exp(ini) last_match_pos = first_match_pos = *ini; } - old_match = compl_curr_match; /* remember the last current match */ + compl_old_match = compl_curr_match; /* remember the last current match */ pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos; /* For ^N/^P loop over all the flags/windows/buffers in 'complete' */ for (;;) @@ -4223,7 +4453,8 @@ ins_compl_get_exp(ini) /* For ^N/^P pick a new entry from e_cpt if compl_started is off, * or if found_all says this entry is done. For ^X^L only use the * entries from 'complete' that look in loaded buffers. */ - if ((ctrl_x_mode == 0 || ctrl_x_mode == CTRL_X_WHOLE_LINE) + if ((ctrl_x_mode == CTRL_X_NORMAL + || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) && (!compl_started || found_all)) { found_all = FALSE; @@ -4233,9 +4464,17 @@ ins_compl_get_exp(ini) { ins_buf = curbuf; first_match_pos = *ini; - /* So that ^N can match word immediately after cursor */ - if (ctrl_x_mode == 0) - dec(&first_match_pos); + /* Move the cursor back one character so that ^N can match the + * word immediately after the cursor. */ + if (ctrl_x_mode == CTRL_X_NORMAL && dec(&first_match_pos) < 0) + { + /* Move the cursor to after the last character in the + * buffer, so that word at start of buffer is found + * correctly. */ + first_match_pos.lnum = ins_buf->b_ml.ml_line_count; + first_match_pos.col = + (colnr_T)STRLEN(ml_get(first_match_pos.lnum)); + } last_match_pos = first_match_pos; type = 0; @@ -4270,13 +4509,13 @@ ins_compl_get_exp(ini) : ins_buf->b_sfname == NULL ? ins_buf->b_fname : ins_buf->b_sfname); - (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); + (void)msg_trunc_attr(IObuff, TRUE, HL_ATTR(HLF_R)); } else if (*e_cpt == NUL) break; else { - if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) type = -1; else if (*e_cpt == 'k' || *e_cpt == 's') { @@ -4300,7 +4539,7 @@ ins_compl_get_exp(ini) { type = CTRL_X_TAGS; vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags.")); - (void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); + (void)msg_trunc_attr(IObuff, TRUE, HL_ATTR(HLF_R)); } else type = -1; @@ -4314,6 +4553,11 @@ ins_compl_get_exp(ini) } } + /* If complete() was called then compl_pattern has been reset. The + * following won't work then, bail out. */ + if (compl_pattern == NULL) + break; + switch (type) { case -1: @@ -4355,8 +4599,8 @@ ins_compl_get_exp(ini) /* Find up to TAG_MANY matches. Avoids that an enormous number * of matches is found when compl_pattern is empty */ if (find_tags(compl_pattern, &num_matches, &matches, - TAG_REGEXP | TAG_NAMES | TAG_NOIC | - TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0), + TAG_REGEXP | TAG_NAMES | TAG_NOIC | TAG_INS_COMP + | (ctrl_x_mode != CTRL_X_NORMAL ? TAG_VERBOSE : 0), TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0) { ins_compl_add_matches(num_matches, matches, p_ic); @@ -4421,9 +4665,10 @@ ins_compl_get_exp(ini) ++msg_silent; /* Don't want messages for wrapscan. */ - /* ctrl_x_mode == CTRL_X_WHOLE_LINE || word-wise search that + /* CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode) + * || word-wise search that * has added a word that was at the beginning of the line */ - if ( ctrl_x_mode == CTRL_X_WHOLE_LINE + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode) || (compl_cont_status & CONT_SOL)) found_new_match = search_for_exact_line(ins_buf, pos, compl_direction, compl_pattern); @@ -4431,7 +4676,7 @@ ins_compl_get_exp(ini) found_new_match = searchit(NULL, ins_buf, pos, compl_direction, compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG, - RE_LAST, (linenr_T)0, NULL); + RE_LAST, (linenr_T)0, NULL, NULL); --msg_silent; if (!compl_started || set_match_pos) { @@ -4457,7 +4702,7 @@ ins_compl_get_exp(ini) && ini->col == pos->col) continue; ptr = ml_get_buf(ins_buf, pos->lnum, FALSE) + pos->col; - if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) { if (compl_cont_status & CONT_ADDING) { @@ -4546,21 +4791,24 @@ ins_compl_get_exp(ini) /* check if compl_curr_match has changed, (e.g. other type of * expansion added something) */ - if (type != 0 && compl_curr_match != old_match) + if (type != 0 && compl_curr_match != compl_old_match) found_new_match = OK; /* break the loop for specialized modes (use 'complete' just for the - * generic ctrl_x_mode == 0) or when we've found a new match */ - if ((ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE) + * generic ctrl_x_mode == CTRL_X_NORMAL) or when we've found a new + * match */ + if ((ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) || found_new_match != FAIL) { if (got_int) break; /* Fill the popup menu as soon as possible. */ if (type != -1) - ins_compl_check_keys(0); + ins_compl_check_keys(0, FALSE); - if ((ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE) + if ((ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) || compl_interrupted) break; compl_started = TRUE; @@ -4576,52 +4824,89 @@ ins_compl_get_exp(ini) } compl_started = TRUE; - if ((ctrl_x_mode == 0 || ctrl_x_mode == CTRL_X_WHOLE_LINE) + if ((ctrl_x_mode == CTRL_X_NORMAL || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) && *e_cpt == NUL) /* Got to end of 'complete' */ found_new_match = FAIL; i = -1; /* total of matches, unknown */ - if (found_new_match == FAIL - || (ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE)) + if (found_new_match == FAIL || (ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))) i = ins_compl_make_cyclic(); - /* If several matches were added (FORWARD) or the search failed and has - * just been made cyclic then we have to move compl_curr_match to the next - * or previous entry (if any) -- Acevedo */ - compl_curr_match = compl_direction == FORWARD ? old_match->cp_next - : old_match->cp_prev; - if (compl_curr_match == NULL) - compl_curr_match = old_match; + if (compl_old_match != NULL) + { + /* If several matches were added (FORWARD) or the search failed and has + * just been made cyclic then we have to move compl_curr_match to the + * next or previous entry (if any) -- Acevedo */ + compl_curr_match = compl_direction == FORWARD ? compl_old_match->cp_next + : compl_old_match->cp_prev; + if (compl_curr_match == NULL) + compl_curr_match = compl_old_match; + } return i; } /* Delete the old text being completed. */ static void -ins_compl_delete() +ins_compl_delete(void) { - int i; + int col; /* * In insert mode: Delete the typed part. * In replace mode: Put the old characters back, if any. */ - i = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0); - backspace_until_column(i); + col = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0); + if ((int)curwin->w_cursor.col > col) + { + if (stop_arrow() == FAIL) + return; + backspace_until_column(col); + } /* TODO: is this sufficient for redrawing? Redrawing everything causes * flicker, thus we can't do that. */ changed_cline_bef_curs(); + /* clear v:completed_item */ + set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); } -/* Insert the new text being completed. */ +/* + * Insert the new text being completed. + * "in_compl_func" is TRUE when called from complete_check(). + */ static void -ins_compl_insert() +ins_compl_insert(int in_compl_func) { + dict_T *dict; + ins_bytes(compl_shown_match->cp_str + ins_compl_len()); if (compl_shown_match->cp_flags & ORIGINAL_TEXT) compl_used_match = FALSE; else compl_used_match = TRUE; + + /* Set completed item. */ + /* { word, abbr, menu, kind, info } */ + dict = dict_alloc_lock(VAR_FIXED); + if (dict != NULL) + { + dict_add_nr_str(dict, "word", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_str)); + dict_add_nr_str(dict, "abbr", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_ABBR])); + dict_add_nr_str(dict, "menu", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_MENU])); + dict_add_nr_str(dict, "kind", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_KIND])); + dict_add_nr_str(dict, "info", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO])); + dict_add_nr_str(dict, "user_data", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_USER_DATA])); + } + set_vim_var_dict(VV_COMPLETED_ITEM, dict); + if (!in_compl_func) + compl_curr_match = compl_shown_match; } /* @@ -4641,18 +4926,19 @@ ins_compl_insert() * calls this function with "allow_get_expansion" FALSE. */ static int -ins_compl_next(allow_get_expansion, count, insert_match) - int allow_get_expansion; - int count; /* repeat completion this many times; should +ins_compl_next( + int allow_get_expansion, + int count, /* repeat completion this many times; should be at least 1 */ - int insert_match; /* Insert the newly selected match */ + int insert_match, /* Insert the newly selected match */ + int in_compl_func) /* called from complete_check() */ { int num_matches = -1; - int i; int todo = count; compl_T *found_compl = NULL; int found_end = FALSE; int advance; + int started = compl_started; /* When user complete function return -1 for findstart which is next * time of 'always', compl_shown_match become NULL. */ @@ -4734,7 +5020,7 @@ ins_compl_next(allow_get_expansion, count, insert_match) return -1; } - if (advance) + if (!compl_no_select && advance) { if (compl_shows_dir == BACKWARD) --compl_pending; @@ -4786,10 +5072,15 @@ ins_compl_next(allow_get_expansion, count, insert_match) } /* Insert the text of the new completion, or the compl_leader. */ - if (insert_match) + if (compl_no_insert && !started) + { + ins_bytes(compl_orig_text + ins_compl_len()); + compl_used_match = FALSE; + } + else if (insert_match) { if (!compl_get_longest || compl_used_match) - ins_compl_insert(); + ins_compl_insert(in_compl_func); else ins_bytes(compl_leader + ins_compl_len()); } @@ -4811,8 +5102,7 @@ ins_compl_next(allow_get_expansion, count, insert_match) { /* Show the cursor after the match, not after the redrawn text. */ setcursor(); - out_flush(); - gui_update_cursor(FALSE, FALSE); + out_flush_cursor(FALSE, FALSE); } #endif @@ -4823,7 +5113,10 @@ ins_compl_next(allow_get_expansion, count, insert_match) /* Enter will select a match when the match wasn't inserted and the popup * menu is visible. */ - compl_enter_selects = !insert_match && compl_match_array != NULL; + if (compl_no_insert && !started) + compl_enter_selects = TRUE; + else + compl_enter_selects = !insert_match && compl_match_array != NULL; /* * Show the file name for the match (if any) @@ -4831,15 +5124,30 @@ ins_compl_next(allow_get_expansion, count, insert_match) */ if (compl_shown_match->cp_fname != NULL) { - STRCPY(IObuff, "match in file "); - i = (vim_strsize(compl_shown_match->cp_fname) + 16) - sc_col; - if (i <= 0) - i = 0; - else - STRCAT(IObuff, "<"); - STRCAT(IObuff, compl_shown_match->cp_fname + i); - msg(IObuff); - redraw_cmdline = FALSE; /* don't overwrite! */ + char *lead = _("match in file"); + int space = sc_col - vim_strsize((char_u *)lead) - 2; + char_u *s; + char_u *e; + + if (space > 0) + { + /* We need the tail that fits. With double-byte encoding going + * back from the end is very slow, thus go from the start and keep + * the text that fits in "space" between "s" and "e". */ + for (s = e = compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e)) + { + space -= ptr2cells(e); + while (space < 0) + { + space += ptr2cells(s); + MB_PTR_ADV(s); + } + } + vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead, + s > compl_shown_match->cp_fname ? "<" : "", s); + msg(IObuff); + redraw_cmdline = FALSE; /* don't overwrite! */ + } } return num_matches; @@ -4851,18 +5159,19 @@ ins_compl_next(allow_get_expansion, count, insert_match) * mode. Also, when compl_pending is not zero, show a completion as soon as * possible. -- webb * "frequency" specifies out of how many calls we actually check. + * "in_compl_func" is TRUE when called from complete_check(), don't set + * compl_curr_match. */ void -ins_compl_check_keys(frequency) - int frequency; +ins_compl_check_keys(int frequency, int in_compl_func) { static int count = 0; + int c; - int c; - - /* Don't check when reading keys from a script. That would break the test - * scripts */ - if (using_script()) + /* Don't check when reading keys from a script, :normal or feedkeys(). + * That would break the test scripts. But do check for keys when called + * from complete_check(). */ + if (!in_compl_func && (using_script() || ex_normal_busy)) return; /* Only do this at regular intervals */ @@ -4880,7 +5189,7 @@ ins_compl_check_keys(frequency) c = safe_vgetc(); /* Eat the character */ compl_shows_dir = ins_compl_key2dir(c); (void)ins_compl_next(FALSE, ins_compl_key2count(c), - c != K_UP && c != K_DOWN); + c != K_UP && c != K_DOWN, in_compl_func); } else { @@ -4898,12 +5207,12 @@ ins_compl_check_keys(frequency) } } } - if (compl_pending != 0 && !got_int) + if (compl_pending != 0 && !got_int && !compl_no_insert) { int todo = compl_pending > 0 ? compl_pending : -compl_pending; compl_pending = 0; - (void)ins_compl_next(FALSE, todo, TRUE); + (void)ins_compl_next(FALSE, todo, TRUE, in_compl_func); } } @@ -4912,12 +5221,10 @@ ins_compl_check_keys(frequency) * Returns BACKWARD or FORWARD. */ static int -ins_compl_key2dir(c) - int c; +ins_compl_key2dir(int c) { if (c == Ctrl_P || c == Ctrl_L - || (pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP - || c == K_S_UP || c == K_UP))) + || c == K_PAGEUP || c == K_KPAGEUP || c == K_S_UP || c == K_UP) return BACKWARD; return FORWARD; } @@ -4927,8 +5234,7 @@ ins_compl_key2dir(c) * is visible. */ static int -ins_compl_pum_key(c) - int c; +ins_compl_pum_key(int c) { return pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP || c == K_S_UP || c == K_PAGEDOWN || c == K_KPAGEDOWN || c == K_S_DOWN @@ -4940,8 +5246,7 @@ ins_compl_pum_key(c) * Returns 1 for most keys, height of the popup menu for page-up/down keys. */ static int -ins_compl_key2count(c) - int c; +ins_compl_key2count(int c) { int h; @@ -4960,8 +5265,7 @@ ins_compl_key2count(c) * to change the currently selected completion. */ static int -ins_compl_use_match(c) - int c; +ins_compl_use_match(int c) { switch (c) { @@ -4984,16 +5288,20 @@ ins_compl_use_match(c) * Returns OK if completion was done, FAIL if something failed (out of mem). */ static int -ins_complete(c) - int c; +ins_complete(int c, int enable_pum) { char_u *line; int startcol = 0; /* column where searched text starts */ colnr_T curs_col; /* cursor column */ int n; int save_w_wrow; + int save_w_leftcol; + int insert_match; + int save_did_ai = did_ai; compl_direction = ins_compl_key2dir(c); + insert_match = ins_compl_use_match(c); + if (!compl_started) { /* First time we hit ^N or ^P (in a row, I mean) */ @@ -5025,8 +5333,9 @@ ins_complete(c) * it is a continued search */ compl_cont_status &= ~CONT_INTRPT; /* remove INTRPT */ - if (ctrl_x_mode == 0 || ctrl_x_mode == CTRL_X_PATH_PATTERNS - || ctrl_x_mode == CTRL_X_PATH_DEFINES) + if (ctrl_x_mode == CTRL_X_NORMAL + || ctrl_x_mode == CTRL_X_PATH_PATTERNS + || ctrl_x_mode == CTRL_X_PATH_DEFINES) { if (compl_startpos.lnum != curwin->w_cursor.lnum) { @@ -5034,7 +5343,7 @@ ins_complete(c) * first non_blank in the line, if it is not a wordchar * include it to get a better pattern, but then we don't * want the "\\<" prefix, check it bellow */ - compl_col = (colnr_T)(skipwhite(line) - line); + compl_col = (colnr_T)getwhitecols(line); compl_startpos.col = compl_col; compl_startpos.lnum = curwin->w_cursor.lnum; compl_cont_status &= ~CONT_SOL; /* clear SOL if present */ @@ -5067,7 +5376,7 @@ ins_complete(c) if (compl_length < 1) compl_cont_status &= CONT_LOCAL; } - else if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + else if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) compl_cont_status = CONT_ADDING | CONT_N_ADDS; else compl_cont_status = 0; @@ -5078,7 +5387,8 @@ ins_complete(c) if (!(compl_cont_status & CONT_ADDING)) /* normal expansion */ { compl_cont_mode = ctrl_x_mode; - if (ctrl_x_mode != 0) /* Remove LOCAL if ctrl_x_mode != 0 */ + if (ctrl_x_mode != CTRL_X_NORMAL) + /* Remove LOCAL if ctrl_x_mode != CTRL_X_NORMAL */ compl_cont_status = 0; compl_cont_status |= CONT_N_ADDS; compl_startpos = curwin->w_cursor; @@ -5087,7 +5397,7 @@ ins_complete(c) } /* Work out completion pattern and original text -- webb */ - if (ctrl_x_mode == 0 || (ctrl_x_mode & CTRL_X_WANT_IDENT)) + if (ctrl_x_mode == CTRL_X_NORMAL || (ctrl_x_mode & CTRL_X_WANT_IDENT)) { if ((compl_cont_status & CONT_SOL) || ctrl_x_mode == CTRL_X_PATH_DEFINES) @@ -5198,9 +5508,9 @@ ins_complete(c) } } } - else if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + else if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) { - compl_col = (colnr_T)(skipwhite(line) - line); + compl_col = (colnr_T)getwhitecols(line); compl_length = (int)curs_col - (int)compl_col; if (compl_length < 0) /* cursor in indent: empty pattern */ compl_length = 0; @@ -5219,9 +5529,9 @@ ins_complete(c) { char_u *p = line + startcol; - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); while (p > line && vim_isfilec(PTR2CHAR(p))) - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); if (p == line && vim_isfilec(PTR2CHAR(p))) startcol = 0; else @@ -5241,7 +5551,7 @@ ins_complete(c) if (compl_pattern == NULL) return FAIL; set_cmd_context(&compl_xp, compl_pattern, - (int)STRLEN(compl_pattern), curs_col); + (int)STRLEN(compl_pattern), curs_col, FALSE); if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL || compl_xp.xp_context == EXPAND_NOTHING) /* No completion possible, use an empty pattern to get a @@ -5258,7 +5568,7 @@ ins_complete(c) * Call user defined function 'completefunc' with "a:findstart" * set to 1 to obtain the length of text to use for completion. */ - char_u *args[2]; + typval_T args[3]; int col; char_u *funcname; pos_T pos; @@ -5273,11 +5583,16 @@ ins_complete(c) { EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION ? "completefunc" : "omnifunc"); + /* restore did_ai, so that adding comment leader works */ + did_ai = save_did_ai; return FAIL; } - args[0] = (char_u *)"1"; - args[1] = NULL; + args[0].v_type = VAR_NUMBER; + args[0].vval.v_number = 1; + args[1].v_type = VAR_STRING; + args[1].vval.v_string = (char_u *)""; + args[2].v_type = VAR_UNKNOWN; pos = curwin->w_cursor; curwin_save = curwin; curbuf_save = curbuf; @@ -5288,8 +5603,8 @@ ins_complete(c) return FAIL; } curwin->w_cursor = pos; /* restore the cursor position */ - check_cursor(); - if (!equalpos(curwin->w_cursor, pos)) + validate_cursor(); + if (!EQUAL_POS(curwin->w_cursor, pos)) { EMSG(_(e_compldel)); return FAIL; @@ -5302,7 +5617,7 @@ ins_complete(c) return FAIL; if (col == -3) { - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; if (!shortmess(SHM_COMPLETIONMENU)) msg_clr_cmdline(); @@ -5356,14 +5671,14 @@ ins_complete(c) } else { - EMSG2(_(e_intern2), "ins_complete()"); + internal_error("ins_complete()"); return FAIL; } if (compl_cont_status & CONT_ADDING) { edit_submode_pre = (char_u *)_(" Adding"); - if (ctrl_x_mode == CTRL_X_WHOLE_LINE) + if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) { /* Insert a new line, keep indentation but ignore 'comments' */ #ifdef FEAT_COMMENTS @@ -5402,10 +5717,8 @@ ins_complete(c) if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, -1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) { - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_orig_text); return FAIL; } @@ -5419,6 +5732,8 @@ ins_complete(c) edit_submode_extra = NULL; out_flush(); } + else if (insert_match && stop_arrow() == FAIL) + return FAIL; compl_shown_match = compl_curr_match; compl_shows_dir = compl_direction; @@ -5427,7 +5742,8 @@ ins_complete(c) * Find next match (and following matches). */ save_w_wrow = curwin->w_wrow; - n = ins_compl_next(TRUE, ins_compl_key2count(c), ins_compl_use_match(c)); + save_w_leftcol = curwin->w_leftcol; + n = ins_compl_next(TRUE, ins_compl_key2count(c), insert_match, FALSE); /* may undisplay the popup menu */ ins_compl_upd_pum(); @@ -5458,7 +5774,7 @@ ins_complete(c) * (such as M in M'exico) if not tried already. -- Acevedo */ if ( compl_length > 1 || (compl_cont_status & CONT_ADDING) - || (ctrl_x_mode != 0 + || (ctrl_x_mode != CTRL_X_NORMAL && ctrl_x_mode != CTRL_X_PATH_PATTERNS && ctrl_x_mode != CTRL_X_PATH_DEFINES)) compl_cont_status &= ~CONT_N_ADDS; @@ -5571,34 +5887,41 @@ ins_complete(c) if (!p_smd) msg_attr(edit_submode_extra, edit_submode_highl < HLF_COUNT - ? hl_attr(edit_submode_highl) : 0); + ? HL_ATTR(edit_submode_highl) : 0); } else msg_clr_cmdline(); /* necessary for "noshowmode" */ } /* Show the popup menu, unless we got interrupted. */ - if (!compl_interrupted) - { - /* RedrawingDisabled may be set when invoked through complete(). */ - n = RedrawingDisabled; - RedrawingDisabled = 0; + if (enable_pum && !compl_interrupted) + show_pum(save_w_wrow, save_w_leftcol); - /* If the cursor moved we need to remove the pum first. */ - setcursor(); - if (save_w_wrow != curwin->w_wrow) - ins_compl_del_pum(); - - ins_compl_show_pum(); - setcursor(); - RedrawingDisabled = n; - } compl_was_interrupted = compl_interrupted; compl_interrupted = FALSE; return OK; } + static void +show_pum(int prev_w_wrow, int prev_w_leftcol) +{ + /* RedrawingDisabled may be set when invoked through complete(). */ + int n = RedrawingDisabled; + + RedrawingDisabled = 0; + + /* If the cursor moved or the display scrolled we need to remove the pum + * first. */ + setcursor(); + if (prev_w_wrow != curwin->w_wrow || prev_w_leftcol != curwin->w_leftcol) + ins_compl_del_pum(); + + ins_compl_show_pum(); + setcursor(); + RedrawingDisabled = n; +} + /* * Looks in the first "len" chars. of "src" for search-metachars. * If dest is not NULL the chars. are copied there quoting (with @@ -5606,10 +5929,7 @@ ins_complete(c) * Returns the length (needed) of dest */ static unsigned -quote_meta(dest, src, len) - char_u *dest; - char_u *src; - int len; +quote_meta(char_u *dest, char_u *src, int len) { unsigned m = (unsigned)len + 1; /* one extra for the NUL */ @@ -5623,13 +5943,16 @@ quote_meta(dest, src, len) if (ctrl_x_mode == CTRL_X_DICTIONARY || ctrl_x_mode == CTRL_X_THESAURUS) break; + /* FALLTHROUGH */ case '~': if (!p_magic) /* quote these only if magic is set */ break; + /* FALLTHROUGH */ case '\\': if (ctrl_x_mode == CTRL_X_DICTIONARY || ctrl_x_mode == CTRL_X_THESAURUS) break; + /* FALLTHROUGH */ case '^': /* currently it's not needed. */ case '$': m++; @@ -5671,7 +5994,7 @@ quote_meta(dest, src, len) * For Unicode a character > 255 may be returned. */ int -get_literal() +get_literal(void) { int cc; int nc; @@ -5808,10 +6131,10 @@ get_literal() * Insert character, taking care of special keys and mod_mask */ static void -insert_special(c, allow_modmask, ctrlv) - int c; - int allow_modmask; - int ctrlv; /* c was typed after CTRL-V */ +insert_special( + int c, + int allow_modmask, + int ctrlv) /* c was typed after CTRL-V */ { char_u *p; int len; @@ -5823,7 +6146,7 @@ insert_special(c, allow_modmask, ctrlv) * Only use mod_mask for special keys, to avoid things like <S-Space>, * unless 'allow_modmask' is TRUE. */ -#ifdef MACOS +#ifdef MACOS_X /* Command-key never produces a normal key */ if (mod_mask & MOD_MASK_CMD) allow_modmask = TRUE; @@ -5863,9 +6186,9 @@ insert_special(c, allow_modmask, ctrlv) #endif #ifdef FEAT_MBYTE -# define WHITECHAR(cc) (vim_iswhite(cc) && (!enc_utf8 || !utf_iscomposing(utf_ptr2char(ml_get_cursor() + 1)))) +# define WHITECHAR(cc) (VIM_ISWHITE(cc) && (!enc_utf8 || !utf_iscomposing(utf_ptr2char(ml_get_cursor() + 1)))) #else -# define WHITECHAR(cc) vim_iswhite(cc) +# define WHITECHAR(cc) VIM_ISWHITE(cc) #endif /* @@ -5879,18 +6202,23 @@ insert_special(c, allow_modmask, ctrlv) * INSCHAR_COM_LIST - format comments with num list or 2nd line indent */ void -insertchar(c, flags, second_indent) - int c; /* character to insert or NUL */ - int flags; /* INSCHAR_FORMAT, etc. */ - int second_indent; /* indent for second line if >= 0 */ +insertchar( + int c, /* character to insert or NUL */ + int flags, /* INSCHAR_FORMAT, etc. */ + int second_indent) /* indent for second line if >= 0 */ { int textwidth; #ifdef FEAT_COMMENTS char_u *p; #endif int fo_ins_blank; + int force_format = flags & INSCHAR_FORMAT; - textwidth = comp_textwidth(flags & INSCHAR_FORMAT); +#if defined(FEAT_GUI_MACVIM) + textwidth = im_is_preediting() ? 0 : comp_textwidth(force_format); +#else + textwidth = comp_textwidth(force_format); +#endif fo_ins_blank = has_format_option(FO_INS_BLANK); /* @@ -5909,8 +6237,8 @@ insertchar(c, flags, second_indent) * before 'textwidth' */ if (textwidth > 0 - && ((flags & INSCHAR_FORMAT) - || (!vim_iswhite(c) + && (force_format + || (!VIM_ISWHITE(c) && !((State & REPLACE_FLAG) #ifdef FEAT_VREPLACE && !(State & VREPLACE_FLAG) @@ -5926,9 +6254,12 @@ insertchar(c, flags, second_indent) /* Format with 'formatexpr' when it's set. Use internal formatting * when 'formatexpr' isn't set or it returns non-zero. */ #if defined(FEAT_EVAL) - int do_internal = TRUE; + int do_internal = TRUE; + colnr_T virtcol = get_nolist_virtcol() + + char2cells(c != NUL ? c : gchar_cursor()); - if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0) + if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0 + && (force_format || virtcol > (colnr_T)textwidth)) { do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0); /* It may be required to save for undo again, e.g. when setline() @@ -5964,7 +6295,7 @@ insertchar(c, flags, second_indent) ++p; middle_len = copy_option_part(&p, lead_end, COM_MAX_LEN, ","); /* Don't count trailing white space for middle_len */ - while (middle_len > 0 && vim_iswhite(lead_end[middle_len - 1])) + while (middle_len > 0 && VIM_ISWHITE(lead_end[middle_len - 1])) --middle_len; /* Find the end-comment string */ @@ -5974,7 +6305,7 @@ insertchar(c, flags, second_indent) /* Skip white space before the cursor */ i = curwin->w_cursor.col; - while (--i >= 0 && vim_iswhite(line[i])) + while (--i >= 0 && VIM_ISWHITE(line[i])) ; i++; @@ -6013,6 +6344,8 @@ insertchar(c, flags, second_indent) * 'paste' is set).. * Don't do this when there an InsertCharPre autocommand is defined, * because we need to fire the event for every character. + * Do the check for InsertCharPre before the call to vpeekc() because the + * InsertCharPre autocommand could change the input buffer. */ #ifdef USE_ON_FLY_SCROLL dont_scroll = FALSE; /* allow scrolling here */ @@ -6022,6 +6355,7 @@ insertchar(c, flags, second_indent) #ifdef FEAT_MBYTE && (!has_mbyte || (*mb_char2len)(c) == 1) #endif + && !has_insertcharpre() && vpeekc() != NUL && !(State & REPLACE_FLAG) #ifdef FEAT_CINDENT @@ -6030,10 +6364,7 @@ insertchar(c, flags, second_indent) #ifdef FEAT_RIGHTLEFT && !p_ri #endif -#ifdef FEAT_AUTOCMD - && !has_insertcharpre() -#endif - ) + ) { #define INPUT_BUFLEN 100 char_u buf[INPUT_BUFLEN + 1]; @@ -6058,6 +6389,9 @@ insertchar(c, flags, second_indent) && (!has_mbyte || MB_BYTE2LEN_CHECK(c) == 1) #endif && i < INPUT_BUFLEN +# ifdef FEAT_FKMAP + && !(p_fkmap && KeyTyped) /* Farsi mode mapping moves cursor */ +# endif && (textwidth == 0 || (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth) && !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1]))) @@ -6066,10 +6400,6 @@ insertchar(c, flags, second_indent) c = vgetc(); if (p_hkmap && KeyTyped) c = hkmap(c); /* Hebrew mode mapping */ -# ifdef FEAT_FKMAP - if (p_fkmap && KeyTyped) - c = fkmap(c); /* Farsi mode mapping */ -# endif buf[i++] = c; #else buf[i++] = vgetc(); @@ -6125,12 +6455,12 @@ insertchar(c, flags, second_indent) * will be the comment leader length sent to open_line(). */ static void -internal_format(textwidth, second_indent, flags, format_only, c) - int textwidth; - int second_indent; - int flags; - int format_only; - int c; /* character to be inserted (can be NUL) */ +internal_format( + int textwidth, + int second_indent, + int flags, + int format_only, + int c) /* character to be inserted (can be NUL) */ { int cc; int save_char = NUL; @@ -6146,6 +6476,12 @@ internal_format(textwidth, second_indent, flags, format_only, c) int no_leader = FALSE; int do_comments = (flags & INSCHAR_DO_COM); #endif +#ifdef FEAT_LINEBREAK + int has_lbr = curwin->w_p_lbr; + + /* make sure win_lbr_chartabsize() counts correctly */ + curwin->w_p_lbr = FALSE; +#endif /* * When 'ai' is off we don't want a space under the cursor to be @@ -6158,7 +6494,7 @@ internal_format(textwidth, second_indent, flags, format_only, c) ) { cc = gchar_cursor(); - if (vim_iswhite(cc)) + if (VIM_ISWHITE(cc)) { save_char = cc; pchar_cursor('x'); @@ -6498,6 +6834,9 @@ internal_format(textwidth, second_indent, flags, format_only, c) if (save_char != NUL) /* put back space after cursor */ pchar_cursor(save_char); +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = has_lbr; +#endif if (!format_only && haveto_redraw) { update_topline(); @@ -6513,9 +6852,9 @@ internal_format(textwidth, second_indent, flags, format_only, c) * saved here. */ void -auto_format(trailblank, prev_line) - int trailblank; /* when TRUE also format with trailing blank */ - int prev_line; /* may start in previous line */ +auto_format( + int trailblank, /* when TRUE also format with trailing blank */ + int prev_line) /* may start in previous line */ { pos_T pos; colnr_T len; @@ -6624,8 +6963,8 @@ auto_format(trailblank, prev_line) * position. */ static void -check_auto_format(end_insert) - int end_insert; /* TRUE when ending Insert mode */ +check_auto_format( + int end_insert) /* TRUE when ending Insert mode */ { int c = ' '; int cc; @@ -6657,13 +6996,13 @@ check_auto_format(end_insert) /* * Find out textwidth to be used for formatting: * if 'textwidth' option is set, use it - * else if 'wrapmargin' option is set, use W_WIDTH(curwin) - 'wrapmargin' + * else if 'wrapmargin' option is set, use curwin->w_width - 'wrapmargin' * if invalid value, use 0. * Set default to window width (maximum 79) for "gq" operator. */ int -comp_textwidth(ff) - int ff; /* force formatting (for "gq" command) */ +comp_textwidth( + int ff) /* force formatting (for "gq" command) */ { int textwidth; @@ -6672,7 +7011,7 @@ comp_textwidth(ff) { /* The width is the window width minus 'wrapmargin' minus all the * things that add to the margin. */ - textwidth = W_WIDTH(curwin) - curbuf->b_p_wm; + textwidth = curwin->w_width - curbuf->b_p_wm; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) textwidth -= 1; @@ -6681,11 +7020,7 @@ comp_textwidth(ff) textwidth -= curwin->w_p_fdc; #endif #ifdef FEAT_SIGNS - if (curwin->w_buffer->b_signlist != NULL -# ifdef FEAT_NETBEANS_INTG - || netbeans_active() -# endif - ) + if (signcolumn_on(curwin)) textwidth -= 1; #endif if (curwin->w_p_nu || curwin->w_p_rnu) @@ -6695,7 +7030,7 @@ comp_textwidth(ff) textwidth = 0; if (ff && textwidth == 0) { - textwidth = W_WIDTH(curwin) - 1; + textwidth = curwin->w_width - 1; if (textwidth > 79) textwidth = 79; } @@ -6706,8 +7041,7 @@ comp_textwidth(ff) * Put a character in the redo buffer, for when just after a CTRL-V. */ static void -redo_literal(c) - int c; +redo_literal(int c) { char_u buf[10]; @@ -6727,10 +7061,35 @@ redo_literal(c) * For undo/redo it resembles hitting the <ESC> key. */ static void -start_arrow(end_insert_pos) - pos_T *end_insert_pos; /* can be NULL */ +start_arrow( + pos_T *end_insert_pos) /* can be NULL */ { - if (!arrow_used) /* something has been inserted */ + start_arrow_common(end_insert_pos, TRUE); +} + +/* + * Like start_arrow() but with end_change argument. + * Will prepare for redo of CTRL-G U if "end_change" is FALSE. + */ + static void +start_arrow_with_change( + pos_T *end_insert_pos, /* can be NULL */ + int end_change) /* end undoable change */ +{ + start_arrow_common(end_insert_pos, end_change); + if (!end_change) + { + AppendCharToRedobuff(Ctrl_G); + AppendCharToRedobuff('U'); + } +} + + static void +start_arrow_common( + pos_T *end_insert_pos, /* can be NULL */ + int end_change) /* end undoable change */ +{ + if (!arrow_used && end_change) /* something has been inserted */ { AppendToRedobuff(ESC_STR); stop_insert(end_insert_pos, FALSE, FALSE); @@ -6747,7 +7106,7 @@ start_arrow(end_insert_pos) * It may be skipped again, thus reset spell_redraw_lnum first. */ static void -check_spell_redraw() +check_spell_redraw(void) { if (spell_redraw_lnum != 0) { @@ -6763,7 +7122,7 @@ check_spell_redraw() * spelled word, if there is one. */ static void -spell_back_to_badword() +spell_back_to_badword(void) { pos_T tpos = curwin->w_cursor; @@ -6779,17 +7138,23 @@ spell_back_to_badword() * Returns FAIL if undo is impossible, shouldn't insert then. */ int -stop_arrow() +stop_arrow(void) { if (arrow_used) { + Insstart = curwin->w_cursor; /* new insertion starts here */ + if (Insstart.col > Insstart_orig.col && !ins_need_undo) + /* Don't update the original insert position when moved to the + * right, except when nothing was inserted yet. */ + update_Insstart_orig = FALSE; + Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + if (u_save_cursor() == OK) { arrow_used = FALSE; ins_need_undo = FALSE; } - Insstart = curwin->w_cursor; /* new insertion starts here */ - Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + ai_col = 0; #ifdef FEAT_VREPLACE if (State & VREPLACE_FLAG) @@ -6822,10 +7187,10 @@ stop_arrow() * to another window/buffer. */ static void -stop_insert(end_insert_pos, esc, nomove) - pos_T *end_insert_pos; - int esc; /* called by ins_esc() */ - int nomove; /* <c-\><c-o>, don't move cursor */ +stop_insert( + pos_T *end_insert_pos, + int esc, /* called by ins_esc() */ + int nomove) /* <c-\><c-o>, don't move cursor */ { int cc; char_u *ptr; @@ -6867,13 +7232,13 @@ stop_insert(end_insert_pos, esc, nomove) { dec_cursor(); cc = gchar_cursor(); - if (!vim_iswhite(cc)) + if (!VIM_ISWHITE(cc)) curwin->w_cursor = tpos; } auto_format(TRUE, FALSE); - if (vim_iswhite(cc)) + if (VIM_ISWHITE(cc)) { if (gchar_cursor() != NUL) inc_cursor(); @@ -6909,15 +7274,21 @@ stop_insert(end_insert_pos, esc, nomove) if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) --curwin->w_cursor.col; cc = gchar_cursor(); - if (!vim_iswhite(cc)) + if (!VIM_ISWHITE(cc)) break; if (del_char(TRUE) == FAIL) break; /* should not happen */ } if (curwin->w_cursor.lnum != tpos.lnum) curwin->w_cursor = tpos; - else if (cc != NUL) - ++curwin->w_cursor.col; /* put cursor back on the NUL */ + else + { + /* reset tpos, could have been invalidated in the loop above */ + tpos = curwin->w_cursor; + tpos.col++; + if (cc != NUL && gchar_pos(&tpos) == NUL) + ++curwin->w_cursor.col; /* put cursor back on the NUL */ + } /* <C-S-Right> may have started Visual mode, adjust the position for * deleted characters. */ @@ -6957,8 +7328,7 @@ stop_insert(end_insert_pos, esc, nomove) * Used for the replace command. */ void -set_last_insert(c) - int c; +set_last_insert(int c) { char_u *s; @@ -6979,13 +7349,11 @@ set_last_insert(c) #if defined(EXITFREE) || defined(PROTO) void -free_last_insert() +free_last_insert(void) { - vim_free(last_insert); - last_insert = NULL; + VIM_CLEAR(last_insert); # ifdef FEAT_INS_EXPAND - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_orig_text); # endif } #endif @@ -6996,9 +7364,7 @@ free_last_insert() * Returns a pointer to after the added bytes. */ char_u * -add_char2buf(c, s) - int c; - char_u *s; +add_char2buf(int c, char_u *s) { #ifdef FEAT_MBYTE char_u temp[MB_MAXBYTES + 1]; @@ -7041,8 +7407,7 @@ add_char2buf(c, s) * if flags & BL_FIX don't leave the cursor on a NUL. */ void -beginline(flags) - int flags; +beginline(int flags) { if ((flags & BL_SOL) && !p_sol) coladvance(curwin->w_curswant); @@ -7057,7 +7422,7 @@ beginline(flags) { char_u *ptr; - for (ptr = ml_get_curline(); vim_iswhite(*ptr) + for (ptr = ml_get_curline(); VIM_ISWHITE(*ptr) && !((flags & BL_FIX) && ptr[1] == NUL); ++ptr) ++curwin->w_cursor.col; } @@ -7074,7 +7439,7 @@ beginline(flags) */ int -oneright() +oneright(void) { char_u *ptr; int l; @@ -7127,12 +7492,14 @@ oneright() } int -oneleft() +oneleft(void) { #ifdef FEAT_VIRTUALEDIT if (virtual_active()) { +# ifdef FEAT_LINEBREAK int width; +# endif int v = getviscol(); if (v == 0) @@ -7196,9 +7563,9 @@ oneleft() } int -cursor_up(n, upd_topline) - long n; - int upd_topline; /* When TRUE: update topline */ +cursor_up( + long n, + int upd_topline) /* When TRUE: update topline */ { linenr_T lnum; @@ -7255,9 +7622,9 @@ cursor_up(n, upd_topline) * Cursor down a number of logical lines. */ int -cursor_down(n, upd_topline) - long n; - int upd_topline; /* When TRUE: update topline */ +cursor_down( + long n, + int upd_topline) /* When TRUE: update topline */ { linenr_T lnum; @@ -7316,10 +7683,10 @@ cursor_down(n, upd_topline) * first have to remove the command. */ int -stuff_inserted(c, count, no_esc) - int c; /* Command character to be inserted */ - long count; /* Repeat this many times */ - int no_esc; /* Don't add an ESC at the end */ +stuff_inserted( + int c, /* Command character to be inserted */ + long count, /* Repeat this many times */ + int no_esc) /* Don't add an ESC at the end */ { char_u *esc_ptr; char_u *ptr; @@ -7376,7 +7743,7 @@ stuff_inserted(c, count, no_esc) } char_u * -get_last_insert() +get_last_insert(void) { if (last_insert == NULL) return NULL; @@ -7388,7 +7755,7 @@ get_last_insert() * Returns pointer to allocated memory (must be freed) or NULL. */ char_u * -get_last_insert_save() +get_last_insert_save(void) { char_u *s; int len; @@ -7412,8 +7779,7 @@ get_last_insert_save() * the replacement string is inserted in typebuf.tb_buf[], followed by "c". */ static int -echeck_abbr(c) - int c; +echeck_abbr(int c) { /* Don't check for abbreviation in paste mode, when disabled and just * after moving around with cursor keys. */ @@ -7448,8 +7814,8 @@ static long replace_stack_nr = 0; /* next entry in replace stack */ static long replace_stack_len = 0; /* max. number of entries */ void -replace_push(c) - int c; /* character that is replaced (NUL is none) */ +replace_push( + int c) /* character that is replaced (NUL is none) */ { char_u *p; @@ -7486,8 +7852,7 @@ replace_push(c) * Return the number of bytes done (includes composing characters). */ int -replace_push_mb(p) - char_u *p; +replace_push_mb(char_u *p) { int l = (*mb_ptr2len)(p); int j; @@ -7504,7 +7869,7 @@ replace_push_mb(p) * return replaced character or NUL otherwise */ static int -replace_pop() +replace_pop(void) { if (replace_stack_nr == 0) return -1; @@ -7516,8 +7881,8 @@ replace_pop() * encountered. */ static void -replace_join(off) - int off; /* offset for which NUL to remove */ +replace_join( + int off) /* offset for which NUL to remove */ { int i; @@ -7536,7 +7901,7 @@ replace_join(off) * before the cursor. Can only be used in REPLACE or VREPLACE mode. */ static void -replace_pop_ins() +replace_pop_ins(void) { int cc; int oldState = State; @@ -7560,8 +7925,7 @@ replace_pop_ins() * indicates a multi-byte char, pop the other bytes too. */ static void -mb_replace_pop_ins(cc) - int cc; +mb_replace_pop_ins(int cc) { int n; char_u buf[MB_MAXBYTES + 1]; @@ -7615,10 +7979,9 @@ mb_replace_pop_ins(cc) * (called when exiting replace mode) */ static void -replace_flush() +replace_flush(void) { - vim_free(replace_stack); - replace_stack = NULL; + VIM_CLEAR(replace_stack); replace_stack_len = 0; replace_stack_nr = 0; } @@ -7633,8 +7996,7 @@ replace_flush() * using composing characters, use del_char_after_col() instead of del_char(). */ static void -replace_do_bs(limit_col) - int limit_col; +replace_do_bs(int limit_col) { int cc; #ifdef FEAT_VREPLACE @@ -7720,7 +8082,7 @@ replace_do_bs(limit_col) * Return TRUE if C-indenting is on. */ static int -cindent_on() +cindent_on(void) { return (!p_paste && (curbuf->b_p_cin # ifdef FEAT_EVAL @@ -7739,16 +8101,20 @@ cindent_on() */ void -fixthisline(get_the_indent) - int (*get_the_indent) __ARGS((void)); +fixthisline(int (*get_the_indent)(void)) { - change_indent(INDENT_SET, get_the_indent(), FALSE, 0, TRUE); - if (linewhite(curwin->w_cursor.lnum)) - did_ai = TRUE; /* delete the indent if the line stays empty */ + int amount = get_the_indent(); + + if (amount >= 0) + { + change_indent(INDENT_SET, amount, FALSE, 0, TRUE); + if (linewhite(curwin->w_cursor.lnum)) + did_ai = TRUE; /* delete the indent if the line stays empty */ + } } void -fix_indent() +fix_indent(void) { if (p_paste) return; @@ -7782,10 +8148,10 @@ fix_indent() * If line_is_empty is TRUE accept keys with '0' before them. */ int -in_cinkeys(keytyped, when, line_is_empty) - int keytyped; - int when; - int line_is_empty; +in_cinkeys( + int keytyped, + int when, + int line_is_empty) { char_u *look; int try_match; @@ -8009,8 +8375,7 @@ in_cinkeys(keytyped, when, line_is_empty) { /* "0=word": Check if there are only blanks before the * word. */ - line = ml_get_curline(); - if ((int)(skipwhite(line) - line) != + if (getwhitecols_curline() != (int)(curwin->w_cursor.col - (p - look))) match = FALSE; } @@ -8027,7 +8392,8 @@ in_cinkeys(keytyped, when, line_is_empty) { if (try_match && *look == keytyped) return TRUE; - ++look; + if (*look != NUL) + ++look; } /* @@ -8044,8 +8410,7 @@ in_cinkeys(keytyped, when, line_is_empty) * Map Hebrew keyboard when in hkmap mode. */ int -hkmap(c) - int c; +hkmap(int c) { if (p_hkmapp) /* phonetic mapping, by Ilya Dogolazky */ { @@ -8125,7 +8490,7 @@ hkmap(c) #endif static void -ins_reg() +ins_reg(void) { int need_redraw = FALSE; int regname; @@ -8176,7 +8541,7 @@ ins_reg() ++no_u_sync; if (regname == '=') { -# ifdef USE_IM_CONTROL +# ifdef HAVE_INPUT_METHOD int im_on = im_get_status(); # endif /* Sync undo when evaluating the expression calls setline() or @@ -8184,7 +8549,7 @@ ins_reg() u_sync_once = 2; regname = get_expr_register(); -# ifdef USE_IM_CONTROL +# ifdef HAVE_INPUT_METHOD /* Restore the Input Method. */ if (im_on) im_set_active(TRUE); @@ -8192,7 +8557,7 @@ ins_reg() } if (regname == NUL || !valid_yank_reg(regname, FALSE)) { - vim_beep(); + vim_beep(BO_REG); need_redraw = TRUE; /* remove the '"' */ } else @@ -8210,7 +8575,7 @@ ins_reg() } else if (insert_reg(regname, literally) == FAIL) { - vim_beep(); + vim_beep(BO_REG); need_redraw = TRUE; /* remove the '"' */ } else if (stop_insert_mode) @@ -8243,7 +8608,7 @@ ins_reg() * CTRL-G commands in Insert mode. */ static void -ins_ctrl_g() +ins_ctrl_g(void) { int c; @@ -8283,8 +8648,15 @@ ins_ctrl_g() Insstart = curwin->w_cursor; break; + /* CTRL-G U: do not break undo with the next char */ + case 'U': + /* Allow one left/right cursor movement with the next char, + * without breaking undo. */ + dont_sync_undo = MAYBE; + break; + /* Unknown CTRL-G command, reserved for future expansion. */ - default: vim_beep(); + default: vim_beep(BO_CTRLG); } } @@ -8292,7 +8664,7 @@ ins_ctrl_g() * CTRL-^ in Insert mode. */ static void -ins_ctrl_hat() +ins_ctrl_hat(void) { if (map_to_exists_mode((char_u *)"", LANGMAP, FALSE)) { @@ -8306,12 +8678,12 @@ ins_ctrl_hat() { curbuf->b_p_iminsert = B_IMODE_LMAP; State |= LANGMAP; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD im_set_active(FALSE); #endif } } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM */ @@ -8335,7 +8707,7 @@ ins_ctrl_hat() if (gui.in_use) gui_update_cursor(TRUE, FALSE); #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) +#if defined(FEAT_KEYMAP) /* Show/unshow value of 'keymap' in status lines. */ status_redraw_curbuf(); #endif @@ -8347,10 +8719,10 @@ ins_ctrl_hat() * insert. */ static int -ins_esc(count, cmdchar, nomove) - long *count; - int cmdchar; - int nomove; /* don't move cursor */ +ins_esc( + long *count, + int cmdchar, + int nomove) /* don't move cursor */ { int temp; static int disabled_redraw = FALSE; @@ -8404,7 +8776,7 @@ ins_esc(count, cmdchar, nomove) (void)start_redo_ins(); if (cmdchar == 'r' || cmdchar == 'v') - stuffReadbuff(ESC_STR); /* no ESC in redo buffer */ + stuffRedoReadbuff(ESC_STR); /* no ESC in redo buffer */ ++RedrawingDisabled; disabled_redraw = TRUE; return FALSE; /* repeat the insert */ @@ -8458,7 +8830,7 @@ ins_esc(count, cmdchar, nomove) } } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD /* Disable IM to allow typing English directly for Normal mode commands. * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as * well). */ @@ -8477,12 +8849,15 @@ ins_esc(count, cmdchar, nomove) #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif + if (!p_ek) + /* Re-enable bracketed paste mode. */ + out_str(T_BE); /* * When recording or for CTRL-O, need to display the new mode. * Otherwise remove the mode message. */ - if (Recording || restart_edit != NUL) + if (reg_recording != 0 || restart_edit != NUL) showmode(); else if (p_smd) MSG(""); @@ -8496,7 +8871,7 @@ ins_esc(count, cmdchar, nomove) * Move to end of reverse inserted text. */ static void -ins_ctrl_() +ins_ctrl_(void) { if (revins_on && revins_chars && revins_scol >= 0) { @@ -8540,8 +8915,7 @@ ins_ctrl_() * Returns TRUE when a CTRL-O and other keys stuffed. */ static int -ins_start_select(c) - int c; +ins_start_select(int c) { if (km_startsel) switch (c) @@ -8552,7 +8926,7 @@ ins_start_select(c) case K_KPAGEUP: case K_PAGEDOWN: case K_KPAGEDOWN: -# ifdef MACOS +# ifdef MACOS_X case K_LEFT: case K_RIGHT: case K_UP: @@ -8595,8 +8969,7 @@ ins_start_select(c) * <Insert> key in Insert mode: toggle insert/replace mode. */ static void -ins_insert(replaceState) - int replaceState; +ins_insert(int replaceState) { #ifdef FEAT_FKMAP if (p_fkmap && p_ri) @@ -8607,7 +8980,6 @@ ins_insert(replaceState) } #endif -#ifdef FEAT_AUTOCMD # ifdef FEAT_EVAL set_vim_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" : @@ -8617,7 +8989,6 @@ ins_insert(replaceState) "r"), 1); # endif apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf); -#endif if (State & REPLACE_FLAG) State = INSERT | (State & LANGMAP); else @@ -8633,7 +9004,7 @@ ins_insert(replaceState) * Pressed CTRL-O in Insert mode. */ static void -ins_ctrl_o() +ins_ctrl_o(void) { #ifdef FEAT_VREPLACE if (State & VREPLACE_FLAG) @@ -8660,9 +9031,7 @@ ins_ctrl_o() * autoindent, we support it everywhere. */ static void -ins_shift(c, lastc) - int c; - int lastc; +ins_shift(int c, int lastc) { if (stop_arrow() == FAIL) return; @@ -8699,7 +9068,7 @@ ins_shift(c, lastc) } static void -ins_del() +ins_del(void) { int temp; @@ -8710,12 +9079,22 @@ ins_del() temp = curwin->w_cursor.col; if (!can_bs(BS_EOL) /* only if "eol" included */ || do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL) - vim_beep(); + vim_beep(BO_BS); else + { curwin->w_cursor.col = temp; +#ifdef FEAT_VREPLACE + /* Adjust orig_line_count in case more lines have been deleted than + * have been added. That makes sure, that open_line() later + * can access all buffer lines correctly */ + if (State & VREPLACE_FLAG && + orig_line_count > curbuf->b_ml.ml_line_count) + orig_line_count = curbuf->b_ml.ml_line_count; +#endif + } } - else if (del_char(FALSE) == FAIL) /* delete char under cursor */ - vim_beep(); + else if (del_char(FALSE) == FAIL) /* delete char under cursor */ + vim_beep(BO_BS); did_ai = FALSE; #ifdef FEAT_SMARTINDENT did_si = FALSE; @@ -8725,14 +9104,13 @@ ins_del() AppendCharToRedobuff(K_DEL); } -static void ins_bs_one __ARGS((colnr_T *vcolp)); +static void ins_bs_one(colnr_T *vcolp); /* * Delete one character for ins_bs(). */ static void -ins_bs_one(vcolp) - colnr_T *vcolp; +ins_bs_one(colnr_T *vcolp) { dec_cursor(); getvcol(curwin, &curwin->w_cursor, vcolp, NULL, NULL); @@ -8753,10 +9131,10 @@ ins_bs_one(vcolp) * Return TRUE when backspace was actually used. */ static int -ins_bs(c, mode, inserted_space_p) - int c; - int mode; - int *inserted_space_p; +ins_bs( + int c, + int mode, + int *inserted_space_p) { linenr_T lnum; int cc; @@ -8776,7 +9154,7 @@ ins_bs(c, mode, inserted_space_p) * can't backup past starting point unless 'backspace' > 1 * can backup to a previous line if 'backspace' == 0 */ - if ( bufempty() + if ( BUFEMPTY() || ( #ifdef FEAT_RIGHTLEFT !revins_on && @@ -8790,7 +9168,7 @@ ins_bs(c, mode, inserted_space_p) && curwin->w_cursor.col <= ai_col) || (!can_bs(BS_EOL) && curwin->w_cursor.col == 0)))) { - vim_beep(); + vim_beep(BO_BS); return FALSE; } @@ -8832,11 +9210,11 @@ ins_bs(c, mode, inserted_space_p) #endif /* - * delete newline! + * Delete newline! */ if (curwin->w_cursor.col == 0) { - lnum = Insstart_orig.lnum; + lnum = Insstart.lnum; if (curwin->w_cursor.lnum == lnum #ifdef FEAT_RIGHTLEFT || revins_on @@ -8846,9 +9224,8 @@ ins_bs(c, mode, inserted_space_p) if (u_save((linenr_T)(curwin->w_cursor.lnum - 2), (linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL) return FALSE; - --Insstart_orig.lnum; - Insstart_orig.col = MAXCOL; - Insstart = Insstart_orig; + --Insstart.lnum; + Insstart.col = (colnr_T)STRLEN(ml_get(Insstart.lnum)); } /* * In replace mode: @@ -8999,7 +9376,7 @@ ins_bs(c, mode, inserted_space_p) /* delete characters until we are at or before want_vcol */ while (vcol > want_vcol - && (cc = *(ml_get_cursor() - 1), vim_iswhite(cc))) + && (cc = *(ml_get_cursor() - 1), VIM_ISWHITE(cc))) ins_bs_one(&vcol); /* insert extra spaces until we are at want_vcol */ @@ -9032,72 +9409,94 @@ ins_bs(c, mode, inserted_space_p) /* * Delete upto starting point, start of line or previous word. */ - else do + else { +#ifdef FEAT_MBYTE + int cclass = 0, prev_cclass = 0; + + if (has_mbyte) + cclass = mb_get_class(ml_get_cursor()); +#endif + do + { #ifdef FEAT_RIGHTLEFT - if (!revins_on) /* put cursor on char to be deleted */ + if (!revins_on) /* put cursor on char to be deleted */ #endif - dec_cursor(); + dec_cursor(); - /* start of word? */ - if (mode == BACKSPACE_WORD && !vim_isspace(gchar_cursor())) - { - mode = BACKSPACE_WORD_NOT_SPACE; - temp = vim_iswordc(gchar_cursor()); - } - /* end of word? */ - else if (mode == BACKSPACE_WORD_NOT_SPACE - && (vim_isspace(cc = gchar_cursor()) - || vim_iswordc(cc) != temp)) - { + cc = gchar_cursor(); +#ifdef FEAT_MBYTE + /* look multi-byte character class */ + if (has_mbyte) + { + prev_cclass = cclass; + cclass = mb_get_class(ml_get_cursor()); + } +#endif + + /* start of word? */ + if (mode == BACKSPACE_WORD && !vim_isspace(cc)) + { + mode = BACKSPACE_WORD_NOT_SPACE; + temp = vim_iswordc(cc); + } + /* end of word? */ + else if (mode == BACKSPACE_WORD_NOT_SPACE + && ((vim_isspace(cc) || vim_iswordc(cc) != temp) +#ifdef FEAT_MBYTE + || prev_cclass != cclass +#endif + )) + { #ifdef FEAT_RIGHTLEFT - if (!revins_on) + if (!revins_on) #endif - inc_cursor(); + inc_cursor(); #ifdef FEAT_RIGHTLEFT - else if (State & REPLACE_FLAG) - dec_cursor(); + else if (State & REPLACE_FLAG) + dec_cursor(); #endif - break; - } - if (State & REPLACE_FLAG) - replace_do_bs(-1); - else - { + break; + } + if (State & REPLACE_FLAG) + replace_do_bs(-1); + else + { #ifdef FEAT_MBYTE - if (enc_utf8 && p_deco) - (void)utfc_ptr2char(ml_get_cursor(), cpc); + if (enc_utf8 && p_deco) + (void)utfc_ptr2char(ml_get_cursor(), cpc); #endif - (void)del_char(FALSE); + (void)del_char(FALSE); #ifdef FEAT_MBYTE - /* - * If there are combining characters and 'delcombine' is set - * move the cursor back. Don't back up before the base - * character. - */ - if (enc_utf8 && p_deco && cpc[0] != NUL) - inc_cursor(); + /* + * If there are combining characters and 'delcombine' is set + * move the cursor back. Don't back up before the base + * character. + */ + if (enc_utf8 && p_deco && cpc[0] != NUL) + inc_cursor(); #endif #ifdef FEAT_RIGHTLEFT - if (revins_chars) - { - revins_chars--; - revins_legal++; + if (revins_chars) + { + revins_chars--; + revins_legal++; + } + if (revins_on && gchar_cursor() == NUL) + break; +#endif } - if (revins_on && gchar_cursor() == NUL) + /* Just a single backspace?: */ + if (mode == BACKSPACE_CHAR) break; -#endif - } - /* Just a single backspace?: */ - if (mode == BACKSPACE_CHAR) - break; - } while ( + } while ( #ifdef FEAT_RIGHTLEFT - revins_on || + revins_on || #endif - (curwin->w_cursor.col > mincol - && (curwin->w_cursor.lnum != Insstart_orig.lnum - || curwin->w_cursor.col != Insstart_orig.col))); + (curwin->w_cursor.col > mincol + && (curwin->w_cursor.lnum != Insstart_orig.lnum + || curwin->w_cursor.col != Insstart_orig.col))); + } did_backspace = TRUE; } #ifdef FEAT_SMARTINDENT @@ -9116,7 +9515,7 @@ ins_bs(c, mode, inserted_space_p) /* If deleted before the insertion point, adjust it */ if (curwin->w_cursor.lnum == Insstart_orig.lnum - && curwin->w_cursor.col < Insstart_orig.col) + && curwin->w_cursor.col < Insstart_orig.col) Insstart_orig.col = curwin->w_cursor.col; /* vi behaviour: the cursor moves backward but the character that @@ -9142,8 +9541,7 @@ ins_bs(c, mode, inserted_space_p) #ifdef FEAT_MOUSE static void -ins_mouse(c) - int c; +ins_mouse(int c) { pos_T tpos; win_T *old_curwin = curwin; @@ -9159,7 +9557,6 @@ ins_mouse(c) tpos = curwin->w_cursor; if (do_mouse(NULL, c, BACKWARD, 1L, 0)) { -#ifdef FEAT_WINDOWS win_T *new_curwin = curwin; if (curwin != old_curwin && win_valid(old_curwin)) @@ -9168,35 +9565,32 @@ ins_mouse(c) * previous one to stop insert there properly. */ curwin = old_curwin; curbuf = curwin->w_buffer; - } +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf)) + // Restart Insert mode when re-entering the prompt buffer. + curbuf->b_prompt_insert = 'A'; #endif + } start_arrow(curwin == old_curwin ? &tpos : NULL); -#ifdef FEAT_WINDOWS if (curwin != new_curwin && win_valid(new_curwin)) { curwin = new_curwin; curbuf = curwin->w_buffer; } -#endif # ifdef FEAT_CINDENT can_cindent = TRUE; # endif } -#ifdef FEAT_WINDOWS /* redraw status lines (in case another window became active) */ redraw_statuslines(); -#endif } static void -ins_mousescroll(dir) - int dir; +ins_mousescroll(int dir) { pos_T tpos; -# if defined(FEAT_WINDOWS) - win_T *old_curwin = curwin; -# endif + win_T *old_curwin = curwin, *wp; # ifdef FEAT_INS_EXPAND int did_scroll = FALSE; # endif @@ -9206,7 +9600,6 @@ ins_mousescroll(dir) tpos = curwin->w_cursor; -# ifdef FEAT_WINDOWS if (mouse_row >= 0 && mouse_col >= 0) { int row, col; @@ -9215,20 +9608,18 @@ ins_mousescroll(dir) col = mouse_col; /* find the window at the pointer coordinates */ - curwin = mouse_find_win(&row, &col); + wp = mouse_find_win(&row, &col); + if (wp == NULL) + return; + curwin = wp; curbuf = curwin->w_buffer; } if (curwin == old_curwin) -# endif undisplay_dollar(); # ifdef FEAT_INS_EXPAND /* Don't scroll the window in which completion is being done. */ - if (!pum_visible() -# if defined(FEAT_WINDOWS) - || curwin != old_curwin -# endif - ) + if (!pum_visible() || curwin != old_curwin) # endif { # ifdef FEAT_GUI_SCROLL_WHEEL_FORCE @@ -9261,7 +9652,7 @@ ins_mousescroll(dir) step = scroll_wheel_force; # endif if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = W_WIDTH(curwin); + step = curwin->w_width; val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step); if (val < 0) val = 0; @@ -9273,12 +9664,10 @@ ins_mousescroll(dir) # endif } -# ifdef FEAT_WINDOWS curwin->w_redr_status = TRUE; curwin = old_curwin; curbuf = curwin->w_buffer; -# endif # ifdef FEAT_INS_EXPAND /* The popup menu may overlay the window, need to redraw it. @@ -9291,7 +9680,7 @@ ins_mousescroll(dir) } # endif - if (!equalpos(curwin->w_cursor, tpos)) + if (!EQUAL_POS(curwin->w_cursor, tpos)) { start_arrow(&tpos); # ifdef FEAT_CINDENT @@ -9301,10 +9690,108 @@ ins_mousescroll(dir) } #endif +/* + * Handle receiving P_PS: start paste mode. Inserts the following text up to + * P_PE literally. + * When "drop" is TRUE then consume the text and drop it. + */ + int +bracketed_paste(paste_mode_T mode, int drop, garray_T *gap) +{ + int c; + char_u buf[NUMBUFLEN + MB_MAXBYTES]; + int idx = 0; + char_u *end = find_termcode((char_u *)"PE"); + int ret_char = -1; + int save_allow_keys = allow_keys; + int save_paste = p_paste; + int save_ai = curbuf->b_p_ai; + + /* If the end code is too long we can't detect it, read everything. */ + if (STRLEN(end) >= NUMBUFLEN) + end = NULL; + ++no_mapping; + allow_keys = 0; + p_paste = TRUE; + curbuf->b_p_ai = FALSE; + + for (;;) + { + /* When the end is not defined read everything. */ + if (end == NULL && vpeekc() == NUL) + break; + c = plain_vgetc(); +#ifdef FEAT_MBYTE + if (has_mbyte) + idx += (*mb_char2bytes)(c, buf + idx); + else +#endif + buf[idx++] = c; + buf[idx] = NUL; + if (end != NULL && STRNCMP(buf, end, idx) == 0) + { + if (end[idx] == NUL) + break; /* Found the end of paste code. */ + continue; + } + if (!drop) + { + switch (mode) + { + case PASTE_CMDLINE: + put_on_cmdline(buf, idx, TRUE); + break; + + case PASTE_EX: + if (gap != NULL && ga_grow(gap, idx) == OK) + { + mch_memmove((char *)gap->ga_data + gap->ga_len, + buf, (size_t)idx); + gap->ga_len += idx; + } + break; + + case PASTE_INSERT: + if (stop_arrow() == OK) + { + c = buf[0]; + if (idx == 1 && (c == CAR || c == K_KENTER || c == NL)) + ins_eol(c); + else + { + ins_char_bytes(buf, idx); + AppendToRedobuffLit(buf, idx); + } + } + break; + + case PASTE_ONE_CHAR: + if (ret_char == -1) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + ret_char = (*mb_ptr2char)(buf); + else +#endif + ret_char = buf[0]; + } + break; + } + } + idx = 0; + } + + --no_mapping; + allow_keys = save_allow_keys; + p_paste = save_paste; + curbuf->b_p_ai = save_ai; + + return ret_char; +} + #if defined(FEAT_GUI_TABLINE) || defined(PROTO) static void -ins_tabline(c) - int c; +ins_tabline(int c) { /* We will be leaving the current window, unless closing another tab. */ if (c != K_TABMENU || current_tabmenu != TABLINE_MENU_CLOSE @@ -9329,7 +9816,7 @@ ins_tabline(c) #if defined(FEAT_GUI) || defined(PROTO) void -ins_scroll() +ins_scroll(void) { pos_T tpos; @@ -9345,7 +9832,7 @@ ins_scroll() } void -ins_horscroll() +ins_horscroll(void) { pos_T tpos; @@ -9362,7 +9849,8 @@ ins_horscroll() #endif static void -ins_left() +ins_left( + int end_change) /* end undoable change */ { pos_T tpos; @@ -9377,9 +9865,13 @@ ins_left() #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) /* Only call start_arrow() when not busy with preediting, it will * break undo. K_LEFT is inserted in im_correct_cursor(). */ - if (!im_is_preediting()) + if (p_imst == IM_OVER_THE_SPOT || !im_is_preediting()) #endif - start_arrow(&tpos); + { + start_arrow_with_change(&tpos, end_change); + if (!end_change) + AppendCharToRedobuff(K_LEFT); + } #ifdef FEAT_RIGHTLEFT /* If exit reversed string, position is fixed */ if (revins_scol != -1 && (int)curwin->w_cursor.col >= revins_scol) @@ -9394,18 +9886,19 @@ ins_left() */ else if (vim_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1) { + /* always break undo when moving upwards/downwards, else undo may break */ start_arrow(&tpos); --(curwin->w_cursor.lnum); coladvance((colnr_T)MAXCOL); curwin->w_set_curswant = TRUE; /* so we stay at the end */ } else - vim_beep(); + vim_beep(BO_CRSR); + dont_sync_undo = FALSE; } static void -ins_home(c) - int c; +ins_home(int c) { pos_T tpos; @@ -9426,8 +9919,7 @@ ins_home(c) } static void -ins_end(c) - int c; +ins_end(int c) { pos_T tpos; @@ -9446,7 +9938,7 @@ ins_end(c) } static void -ins_s_left() +ins_s_left(void) { #ifdef FEAT_FOLDING if ((fdo_flags & FDO_HOR) && KeyTyped) @@ -9460,11 +9952,12 @@ ins_s_left() curwin->w_set_curswant = TRUE; } else - vim_beep(); + vim_beep(BO_CRSR); } static void -ins_right() +ins_right( + int end_change) /* end undoable change */ { #ifdef FEAT_FOLDING if ((fdo_flags & FDO_HOR) && KeyTyped) @@ -9477,7 +9970,9 @@ ins_right() #endif ) { - start_arrow(&curwin->w_cursor); + start_arrow_with_change(&curwin->w_cursor, end_change); + if (!end_change) + AppendCharToRedobuff(K_RIGHT); curwin->w_set_curswant = TRUE; #ifdef FEAT_VIRTUALEDIT if (virtual_active()) @@ -9510,11 +10005,12 @@ ins_right() curwin->w_cursor.col = 0; } else - vim_beep(); + vim_beep(BO_CRSR); + dont_sync_undo = FALSE; } static void -ins_s_right() +ins_s_right(void) { #ifdef FEAT_FOLDING if ((fdo_flags & FDO_HOR) && KeyTyped) @@ -9529,12 +10025,12 @@ ins_s_right() curwin->w_set_curswant = TRUE; } else - vim_beep(); + vim_beep(BO_CRSR); } static void -ins_up(startcol) - int startcol; /* when TRUE move to Insstart.col */ +ins_up( + int startcol) /* when TRUE move to Insstart.col */ { pos_T tpos; linenr_T old_topline = curwin->w_topline; @@ -9560,17 +10056,16 @@ ins_up(startcol) #endif } else - vim_beep(); + vim_beep(BO_CRSR); } static void -ins_pageup() +ins_pageup(void) { pos_T tpos; undisplay_dollar(); -#ifdef FEAT_WINDOWS if (mod_mask & MOD_MASK_CTRL) { /* <C-PageUp>: tab page back */ @@ -9581,7 +10076,6 @@ ins_pageup() } return; } -#endif tpos = curwin->w_cursor; if (onepage(BACKWARD, 1L) == OK) @@ -9592,12 +10086,12 @@ ins_pageup() #endif } else - vim_beep(); + vim_beep(BO_CRSR); } static void -ins_down(startcol) - int startcol; /* when TRUE move to Insstart.col */ +ins_down( + int startcol) /* when TRUE move to Insstart.col */ { pos_T tpos; linenr_T old_topline = curwin->w_topline; @@ -9623,17 +10117,16 @@ ins_down(startcol) #endif } else - vim_beep(); + vim_beep(BO_CRSR); } static void -ins_pagedown() +ins_pagedown(void) { pos_T tpos; undisplay_dollar(); -#ifdef FEAT_WINDOWS if (mod_mask & MOD_MASK_CTRL) { /* <C-PageDown>: tab page forward */ @@ -9644,7 +10137,6 @@ ins_pagedown() } return; } -#endif tpos = curwin->w_cursor; if (onepage(FORWARD, 1L) == OK) @@ -9655,12 +10147,12 @@ ins_pagedown() #endif } else - vim_beep(); + vim_beep(BO_CRSR); } #ifdef FEAT_DND static void -ins_drop() +ins_drop(void) { do_put('~', BACKWARD, 1L, PUT_CURSEND); } @@ -9671,7 +10163,7 @@ ins_drop() * Return TRUE when the TAB needs to be inserted like a normal character. */ static int -ins_tab() +ins_tab(void) { int ind; int i; @@ -9778,7 +10270,7 @@ ins_tab() /* Find first white before the cursor */ fpos = curwin->w_cursor; - while (fpos.col > 0 && vim_iswhite(ptr[-1])) + while (fpos.col > 0 && VIM_ISWHITE(ptr[-1])) { --fpos.col; --ptr; @@ -9799,7 +10291,7 @@ ins_tab() /* Use as many TABs as possible. Beware of 'breakindent', 'showbreak' * and 'linebreak' adding extra virtual columns. */ - while (vim_iswhite(*ptr)) + while (VIM_ISWHITE(*ptr)) { i = lbr_chartabsize(NULL, (char_u *)"\t", vcol); if (vcol + i > want_vcol) @@ -9895,18 +10387,17 @@ ins_tab() /* * Handle CR or NL in insert mode. - * Return TRUE when out of memory or can't undo. + * Return FAIL when out of memory or can't undo. */ static int -ins_eol(c) - int c; +ins_eol(int c) { int i; if (echeck_abbr(c + ABBR_OFF)) - return FALSE; + return OK; if (stop_arrow() == FAIL) - return TRUE; + return FAIL; undisplay_dollar(); /* @@ -9961,7 +10452,7 @@ ins_eol(c) foldOpenCursor(); #endif - return (!i); + return i; } #ifdef FEAT_DIGRAPHS @@ -9971,7 +10462,7 @@ ins_eol(c) * done. */ static int -ins_digraph() +ins_digraph(void) { int c; int cc; @@ -10063,8 +10554,7 @@ ins_digraph() * Returns the char to be inserted, or NUL if none found. */ int -ins_copychar(lnum) - linenr_T lnum; +ins_copychar(linenr_T lnum) { int c; int temp; @@ -10073,7 +10563,7 @@ ins_copychar(lnum) if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) { - vim_beep(); + vim_beep(BO_COPY); return NUL; } @@ -10096,7 +10586,7 @@ ins_copychar(lnum) c = *ptr; #endif if (c == NUL) - vim_beep(); + vim_beep(BO_COPY); return c; } @@ -10104,8 +10594,7 @@ ins_copychar(lnum) * CTRL-Y or CTRL-E typed in Insert mode. */ static int -ins_ctrl_ey(tc) - int tc; +ins_ctrl_ey(int tc) { int c = tc; @@ -10153,8 +10642,7 @@ ins_ctrl_ey(tc) * Used when inserting a "normal" character. */ static void -ins_try_si(c) - int c; +ins_try_si(int c) { pos_T *pos, old_pos; char_u *ptr; @@ -10182,7 +10670,7 @@ ins_try_si(c) ptr = ml_get(pos->lnum); i = pos->col; if (i > 0) /* skip blanks before '{' */ - while (--i > 0 && vim_iswhite(ptr[i])) + while (--i > 0 && VIM_ISWHITE(ptr[i])) ; curwin->w_cursor.lnum = pos->lnum; curwin->w_cursor.col = i; @@ -10246,7 +10734,7 @@ ins_try_si(c) * Unless 'cpo' contains the 'L' flag. */ static colnr_T -get_nolist_virtcol() +get_nolist_virtcol(void) { if (curwin->w_p_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) return getvcol_nolist(&curwin->w_cursor); @@ -10254,7 +10742,7 @@ get_nolist_virtcol() return curwin->w_virtcol; } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* * Handle the InsertCharPre autocommand. * "c" is the character that was typed. @@ -10262,8 +10750,7 @@ get_nolist_virtcol() * Return NULL to continue inserting "c". */ static char_u * -do_insert_char_pre(c) - int c; +do_insert_char_pre(int c) { char_u *res; char_u buf[MB_MAXBYTES + 1]; @@ -10272,11 +10759,11 @@ do_insert_char_pre(c) if (!has_insertcharpre()) return NULL; -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (has_mbyte) buf[(*mb_char2bytes)(c, buf)] = NUL; else -#endif +# endif { buf[0] = c; buf[1] = NUL; diff --git a/src/eval.c b/src/eval.c index 254de321e4..26aa0e34e7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,112 +10,30 @@ /* * eval.c: Expression evaluation. */ +#define USING_FLOAT_STUFF #include "vim.h" #if defined(FEAT_EVAL) || defined(PROTO) -#ifdef AMIGA -# include <time.h> /* for strftime() */ -#endif - #ifdef VMS # include <float.h> #endif -#ifdef MACOS -# include <time.h> /* for time_t */ -#endif - -#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) -# include <math.h> -#endif - #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */ -#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not - be freed. */ - -/* - * In a hashtab item "hi_key" points to "di_key" in a dictitem. - * This avoids adding a pointer to the hashtab item. - * DI2HIKEY() converts a dictitem pointer to a hashitem key pointer. - * HIKEY2DI() converts a hashitem key pointer to a dictitem pointer. - * HI2DI() converts a hashitem pointer to a dictitem pointer. - */ -static dictitem_T dumdi; -#define DI2HIKEY(di) ((di)->di_key) -#define HIKEY2DI(p) ((dictitem_T *)(p - (dumdi.di_key - (char_u *)&dumdi))) -#define HI2DI(hi) HIKEY2DI((hi)->hi_key) - -/* - * Structure returned by get_lval() and used by set_var_lval(). - * For a plain name: - * "name" points to the variable name. - * "exp_name" is NULL. - * "tv" is NULL - * For a magic braces name: - * "name" points to the expanded variable name. - * "exp_name" is non-NULL, to be freed later. - * "tv" is NULL - * For an index in a list: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the (first) list item value - * "li" points to the (first) list item - * "range", "n1", "n2" and "empty2" indicate what items are used. - * For an existing Dict item: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the dict item value - * "newkey" is NULL - * For a non-existing Dict item: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the Dictionary typval_T - * "newkey" is the key for the new item. - */ -typedef struct lval_S -{ - char_u *ll_name; /* start of variable name (can be NULL) */ - char_u *ll_exp_name; /* NULL or expanded name in allocated memory. */ - typval_T *ll_tv; /* Typeval of item being used. If "newkey" - isn't NULL it's the Dict to which to add - the item. */ - listitem_T *ll_li; /* The list item or NULL. */ - list_T *ll_list; /* The list or NULL. */ - int ll_range; /* TRUE when a [i:j] range was used */ - long ll_n1; /* First index for list */ - long ll_n2; /* Second index for list range */ - int ll_empty2; /* Second index is empty: [i:] */ - dict_T *ll_dict; /* The Dictionary or NULL */ - dictitem_T *ll_di; /* The dictitem or NULL */ - char_u *ll_newkey; /* New key for Dict in alloc. mem or NULL. */ -} lval_T; - - static char *e_letunexp = N_("E18: Unexpected characters in :let"); -static char *e_listidx = N_("E684: list index out of range: %ld"); static char *e_undefvar = N_("E121: Undefined variable: %s"); static char *e_missbrac = N_("E111: Missing ']'"); -static char *e_listarg = N_("E686: Argument of %s must be a List"); -static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary"); -static char *e_emptykey = N_("E713: Cannot use empty key for Dictionary"); -static char *e_listreq = N_("E714: List required"); -static char *e_dictreq = N_("E715: Dictionary required"); -static char *e_toomanyarg = N_("E118: Too many arguments for function: %s"); -static char *e_dictkey = N_("E716: Key not present in Dictionary: %s"); -static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); -static char *e_funcdict = N_("E717: Dictionary entry already exists"); -static char *e_funcref = N_("E718: Funcref required"); static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary"); static char *e_letwrong = N_("E734: Wrong variable type for %s="); -static char *e_nofunc = N_("E130: Unknown function: %s"); static char *e_illvar = N_("E461: Illegal variable name: %s"); #ifdef FEAT_FLOAT static char *e_float_as_string = N_("E806: using Float as a String"); #endif +#define NAMESPACE_CHAR (char_u *)"abglstvw" + static dictitem_T globvars_var; /* variable used for g: */ #define globvarht globvardict.dv_hashtab @@ -131,11 +49,6 @@ static hashtab_T compat_hashtab; * The last bit is used for previous_funccal, ignored when comparing. */ static int current_copyID = 0; -#define COPYID_INC 2 -#define COPYID_MASK (~0x1) - -/* Abort conversion to string after a recursion error. */ -static int did_echo_string_emsg = FALSE; /* * Array to hold the hashtab with variables local to each sourced script. @@ -153,111 +66,9 @@ static garray_T ga_scripts = {0, 0, sizeof(scriptvar_T *), 4, NULL}; static int echo_attr = 0; /* attributes used for ":echo" */ -/* Values for trans_function_name() argument: */ -#define TFN_INT 1 /* internal function name OK */ -#define TFN_QUIET 2 /* no error messages */ -#define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ - -/* Values for get_lval() flags argument: */ -#define GLV_QUIET TFN_QUIET /* no error messages */ -#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ - -/* - * Structure to hold info for a user function. - */ -typedef struct ufunc ufunc_T; - -struct ufunc -{ - int uf_varargs; /* variable nr of arguments */ - int uf_flags; - int uf_calls; /* nr of active calls */ - garray_T uf_args; /* arguments */ - garray_T uf_lines; /* function lines */ -#ifdef FEAT_PROFILE - int uf_profiling; /* TRUE when func is being profiled */ - /* profiling the function as a whole */ - int uf_tm_count; /* nr of calls */ - proftime_T uf_tm_total; /* time spent in function + children */ - proftime_T uf_tm_self; /* time spent in function itself */ - proftime_T uf_tm_children; /* time spent in children this call */ - /* profiling the function per line */ - int *uf_tml_count; /* nr of times line was executed */ - proftime_T *uf_tml_total; /* time spent in a line + children */ - proftime_T *uf_tml_self; /* time spent in a line itself */ - proftime_T uf_tml_start; /* start time for current line */ - proftime_T uf_tml_children; /* time spent in children for this line */ - proftime_T uf_tml_wait; /* start wait time for current line */ - int uf_tml_idx; /* index of line being timed; -1 if none */ - int uf_tml_execed; /* line being timed was executed */ -#endif - scid_T uf_script_ID; /* ID of script where function was defined, - used for s: variables */ - int uf_refcount; /* for numbered function: reference count */ - char_u uf_name[1]; /* name of function (actually longer); can - start with <SNR>123_ (<SNR> is K_SPECIAL - KS_EXTRA KE_SNR) */ -}; - -/* function flags */ -#define FC_ABORT 1 /* abort function on error */ -#define FC_RANGE 2 /* function accepts range */ -#define FC_DICT 4 /* Dict function, uses "self" */ - -/* - * All user-defined functions are found in this hashtable. - */ -static hashtab_T func_hashtab; - /* The names of packages that once were loaded are remembered. */ static garray_T ga_loaded = {0, 0, sizeof(char_u *), 4, NULL}; -/* list heads for garbage collection */ -static dict_T *first_dict = NULL; /* list of all dicts */ -static list_T *first_list = NULL; /* list of all lists */ - -/* From user function to hashitem and back. */ -static ufunc_T dumuf; -#define UF2HIKEY(fp) ((fp)->uf_name) -#define HIKEY2UF(p) ((ufunc_T *)(p - (dumuf.uf_name - (char_u *)&dumuf))) -#define HI2UF(hi) HIKEY2UF((hi)->hi_key) - -#define FUNCARG(fp, j) ((char_u **)(fp->uf_args.ga_data))[j] -#define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j] - -#define MAX_FUNC_ARGS 20 /* maximum number of function arguments */ -#define VAR_SHORT_LEN 20 /* short variable name length */ -#define FIXVAR_CNT 12 /* number of fixed variables */ - -/* structure to hold info for a function that is currently being executed. */ -typedef struct funccall_S funccall_T; - -struct funccall_S -{ - ufunc_T *func; /* function being called */ - int linenr; /* next line to be executed */ - int returned; /* ":return" used */ - struct /* fixed variables for arguments */ - { - dictitem_T var; /* variable (without room for name) */ - char_u room[VAR_SHORT_LEN]; /* room for the name */ - } fixvar[FIXVAR_CNT]; - dict_T l_vars; /* l: local function variables */ - dictitem_T l_vars_var; /* variable for l: scope */ - dict_T l_avars; /* a: argument variables */ - dictitem_T l_avars_var; /* variable for a: scope */ - list_T l_varlist; /* list for a:000 */ - listitem_T l_listitems[MAX_FUNC_ARGS]; /* listitems for a:000 */ - typval_T *rettv; /* return value */ - linenr_T breakpoint; /* next line with breakpoint or zero */ - int dbg_tick; /* debug_tick when breakpoint was set */ - int level; /* top nesting level of executed function */ -#ifdef FEAT_PROFILE - proftime_T prof_child; /* time spent in a child */ -#endif - funccall_T *caller; /* calling function or NULL */ -}; - /* * Info used by a ":for" loop. */ @@ -269,16 +80,6 @@ typedef struct list_T *fi_list; /* list being used */ } forinfo_T; -/* - * Struct used by trans_function_name() - */ -typedef struct -{ - dict_T *fd_dict; /* Dictionary used */ - char_u *fd_newkey; /* new key in "dict" in allocated memory */ - dictitem_T *fd_di; /* Dictionary item used */ -} funcdict_T; - /* * Array to hold the value of v: variables. @@ -286,20 +87,18 @@ typedef struct * The reason to use this table anyway is for very quick access to the * variables with the VV_ defines. */ -#include "version.h" /* values for vv_flags: */ #define VV_COMPAT 1 /* compatible, also used without "v:" */ #define VV_RO 2 /* read-only */ #define VV_RO_SBX 4 /* read-only in the sandbox */ -#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}}, {0} +#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}} static struct vimvar { char *vv_name; /* name of variable, without v: */ - dictitem_T vv_di; /* value and name for key */ - char vv_filler[16]; /* space for LONGEST name below!!! */ + dictitem16_T vv_di; /* value and name for key (max 16 chars!) */ char vv_flags; /* VV_COMPAT, VV_RO, VV_RO_SBX */ } vimvars[VV_LEN] = { @@ -348,6 +147,7 @@ static struct vimvar {VV_NAME("fcs_choice", VAR_STRING), 0}, {VV_NAME("beval_bufnr", VAR_NUMBER), VV_RO}, {VV_NAME("beval_winnr", VAR_NUMBER), VV_RO}, + {VV_NAME("beval_winid", VAR_NUMBER), VV_RO}, {VV_NAME("beval_lnum", VAR_NUMBER), VV_RO}, {VV_NAME("beval_col", VAR_NUMBER), VV_RO}, {VV_NAME("beval_text", VAR_STRING), VV_RO}, @@ -357,6 +157,7 @@ static struct vimvar {VV_NAME("swapcommand", VAR_STRING), VV_RO}, {VV_NAME("char", VAR_STRING), 0}, {VV_NAME("mouse_win", VAR_NUMBER), 0}, + {VV_NAME("mouse_winid", VAR_NUMBER), 0}, {VV_NAME("mouse_lnum", VAR_NUMBER), 0}, {VV_NAME("mouse_col", VAR_NUMBER), 0}, {VV_NAME("operator", VAR_STRING), VV_RO}, @@ -365,6 +166,33 @@ static struct vimvar {VV_NAME("oldfiles", VAR_LIST), 0}, {VV_NAME("windowid", VAR_NUMBER), VV_RO}, {VV_NAME("progpath", VAR_STRING), VV_RO}, + {VV_NAME("completed_item", VAR_DICT), VV_RO}, + {VV_NAME("option_new", VAR_STRING), VV_RO}, + {VV_NAME("option_old", VAR_STRING), VV_RO}, + {VV_NAME("option_type", VAR_STRING), VV_RO}, + {VV_NAME("errors", VAR_LIST), 0}, + {VV_NAME("false", VAR_SPECIAL), VV_RO}, + {VV_NAME("true", VAR_SPECIAL), VV_RO}, + {VV_NAME("null", VAR_SPECIAL), VV_RO}, + {VV_NAME("none", VAR_SPECIAL), VV_RO}, + {VV_NAME("vim_did_enter", VAR_NUMBER), VV_RO}, + {VV_NAME("testing", VAR_NUMBER), 0}, + {VV_NAME("t_number", VAR_NUMBER), VV_RO}, + {VV_NAME("t_string", VAR_NUMBER), VV_RO}, + {VV_NAME("t_func", VAR_NUMBER), VV_RO}, + {VV_NAME("t_list", VAR_NUMBER), VV_RO}, + {VV_NAME("t_dict", VAR_NUMBER), VV_RO}, + {VV_NAME("t_float", VAR_NUMBER), VV_RO}, + {VV_NAME("t_bool", VAR_NUMBER), VV_RO}, + {VV_NAME("t_none", VAR_NUMBER), VV_RO}, + {VV_NAME("t_job", VAR_NUMBER), VV_RO}, + {VV_NAME("t_channel", VAR_NUMBER), VV_RO}, + {VV_NAME("termrfgresp", VAR_STRING), VV_RO}, + {VV_NAME("termrbgresp", VAR_STRING), VV_RO}, + {VV_NAME("termu7resp", VAR_STRING), VV_RO}, + {VV_NAME("termstyleresp", VAR_STRING), VV_RO}, + {VV_NAME("termblinkresp", VAR_STRING), VV_RO}, + {VV_NAME("event", VAR_DICT), VV_RO}, }; /* shorthand */ @@ -373,490 +201,88 @@ static struct vimvar #define vv_float vv_di.di_tv.vval.v_float #define vv_str vv_di.di_tv.vval.v_string #define vv_list vv_di.di_tv.vval.v_list +#define vv_dict vv_di.di_tv.vval.v_dict #define vv_tv vv_di.di_tv static dictitem_T vimvars_var; /* variable used for v: */ #define vimvarht vimvardict.dv_hashtab -static void prepare_vimvar __ARGS((int idx, typval_T *save_tv)); -static void restore_vimvar __ARGS((int idx, typval_T *save_tv)); -static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars)); -static char_u *skip_var_list __ARGS((char_u *arg, int *var_count, int *semicolon)); -static char_u *skip_var_one __ARGS((char_u *arg)); -static void list_hashtable_vars __ARGS((hashtab_T *ht, char_u *prefix, int empty, int *first)); -static void list_glob_vars __ARGS((int *first)); -static void list_buf_vars __ARGS((int *first)); -static void list_win_vars __ARGS((int *first)); -#ifdef FEAT_WINDOWS -static void list_tab_vars __ARGS((int *first)); -#endif -static void list_vim_vars __ARGS((int *first)); -static void list_script_vars __ARGS((int *first)); -static void list_func_vars __ARGS((int *first)); -static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first)); -static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op)); -static int check_changedtick __ARGS((char_u *arg)); -static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags)); -static void clear_lval __ARGS((lval_T *lp)); -static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op)); -static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u *op)); -static void list_fix_watch __ARGS((list_T *l, listitem_T *item)); -static void ex_unletlock __ARGS((exarg_T *eap, char_u *argstart, int deep)); -static int do_unlet_var __ARGS((lval_T *lp, char_u *name_end, int forceit)); -static int do_lock_var __ARGS((lval_T *lp, char_u *name_end, int deep, int lock)); -static void item_lock __ARGS((typval_T *tv, int deep, int lock)); -static int tv_islocked __ARGS((typval_T *tv)); - -static int eval0 __ARGS((char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate)); -static int eval1 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval2 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval3 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval4 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval5 __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int eval6 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string)); -static int eval7 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string)); - -static int eval_index __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose)); -static int get_option_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int get_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int get_lit_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int get_list_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int rettv_list_alloc __ARGS((typval_T *rettv)); -static long list_len __ARGS((list_T *l)); -static int list_equal __ARGS((list_T *l1, list_T *l2, int ic, int recursive)); -static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic, int recursive)); -static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic, int recursive)); -static long list_find_nr __ARGS((list_T *l, long idx, int *errorp)); -static long list_idx_of_item __ARGS((list_T *l, listitem_T *item)); -static int list_append_number __ARGS((list_T *l, varnumber_T n)); -static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef)); -static int list_concat __ARGS((list_T *l1, list_T *l2, typval_T *tv)); -static list_T *list_copy __ARGS((list_T *orig, int deep, int copyID)); -static char_u *list2string __ARGS((typval_T *tv, int copyID)); -static int list_join_inner __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo_style, int copyID, garray_T *join_gap)); -static int list_join __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo, int copyID)); -static int free_unref_items __ARGS((int copyID)); -static int rettv_dict_alloc __ARGS((typval_T *rettv)); -static dictitem_T *dictitem_copy __ARGS((dictitem_T *org)); -static void dictitem_remove __ARGS((dict_T *dict, dictitem_T *item)); -static dict_T *dict_copy __ARGS((dict_T *orig, int deep, int copyID)); -static long dict_len __ARGS((dict_T *d)); -static char_u *dict2string __ARGS((typval_T *tv, int copyID)); -static int get_dict_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static char_u *echo_string __ARGS((typval_T *tv, char_u **tofree, char_u *numbuf, int copyID)); -static char_u *tv2string __ARGS((typval_T *tv, char_u **tofree, char_u *numbuf, int copyID)); -static char_u *string_quote __ARGS((char_u *str, int function)); -#ifdef FEAT_FLOAT -static int string2float __ARGS((char_u *text, float_T *value)); -#endif -static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); -static int find_internal_func __ARGS((char_u *name)); -static char_u *deref_func_name __ARGS((char_u *name, int *lenp, int no_autoload)); -static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict)); -static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict)); -static void emsg_funcname __ARGS((char *ermsg, char_u *name)); -static int non_zero_arg __ARGS((typval_T *argvars)); +static int ex_let_vars(char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars); +static char_u *skip_var_list(char_u *arg, int *var_count, int *semicolon); +static char_u *skip_var_one(char_u *arg); +static void list_glob_vars(int *first); +static void list_buf_vars(int *first); +static void list_win_vars(int *first); +static void list_tab_vars(int *first); +static void list_vim_vars(int *first); +static void list_script_vars(int *first); +static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first); +static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op); +static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op); +static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op); +static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep); +static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit); +static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock); +static void item_lock(typval_T *tv, int deep, int lock); + +static int eval2(char_u **arg, typval_T *rettv, int evaluate); +static int eval3(char_u **arg, typval_T *rettv, int evaluate); +static int eval4(char_u **arg, typval_T *rettv, int evaluate); +static int eval5(char_u **arg, typval_T *rettv, int evaluate); +static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string); +static int eval7(char_u **arg, typval_T *rettv, int evaluate, int want_string); + +static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose); +static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate); +static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate); +static int free_unref_items(int copyID); +static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate); +static int get_env_len(char_u **arg); +static char_u * make_expanded_name(char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end); +static void check_vars(char_u *name, int len); +static typval_T *alloc_string_tv(char_u *string); +static void delete_var(hashtab_T *ht, hashitem_T *hi); +static void list_one_var(dictitem_T *v, char_u *prefix, int *first); +static void list_one_var_a(char_u *prefix, char_u *name, int type, char_u *string, int *first); +static char_u *find_option_end(char_u **arg, int *opt_flags); + +/* for VIM_VERSION_ defines */ +#include "version.h" -#ifdef FEAT_FLOAT -static void f_abs __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_acos __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_add __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_and __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_append __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_argc __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_argidx __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_arglistid __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_argv __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_asin __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_atan __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_atan2 __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_browse __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_browsedir __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_bufexists __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_buflisted __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_bufloaded __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_bufname __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_bufnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_bufwinnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_byte2line __ARGS((typval_T *argvars, typval_T *rettv)); -static void byteidx __ARGS((typval_T *argvars, typval_T *rettv, int comp)); -static void f_byteidx __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_byteidxcomp __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_call __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_ceil __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_changenr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_char2nr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_cindent __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_clearmatches __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_col __ARGS((typval_T *argvars, typval_T *rettv)); -#if defined(FEAT_INS_EXPAND) -static void f_complete __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_complete_add __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_complete_check __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_confirm __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_copy __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_cos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_cosh __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_count __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_cscope_connection __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_cursor __ARGS((typval_T *argsvars, typval_T *rettv)); -static void f_deepcopy __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_delete __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_did_filetype __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_diff_filler __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_diff_hlID __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_empty __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_escape __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_eval __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_eventhandler __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_executable __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_exepath __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_exists __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_exp __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_expand __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_extend __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_feedkeys __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_filereadable __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_filewritable __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_filter __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_finddir __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_findfile __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_float2nr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_floor __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_fmod __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_fnameescape __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_fnamemodify __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foldclosed __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foldclosedend __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foldlevel __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foldtext __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foldtextresult __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_foreground __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_function __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_garbagecollect __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_get __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getbufline __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getbufvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getchar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcharmod __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcmdline __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcmdpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcmdtype __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcwd __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getfontname __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getfperm __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getfsize __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getftime __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getftype __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getline __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getmatches __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getpid __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getcurpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getregtype __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_gettabvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_gettabwinvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getwinposx __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getwinposy __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_getwinvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_glob __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_globpath __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_has __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_has_key __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_haslocaldir __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_hasmapto __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_histadd __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_histdel __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_histget __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_histnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_hlID __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_hlexists __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_hostname __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_iconv __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_indent __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_index __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_input __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_inputdialog __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_inputlist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_inputrestore __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_inputsave __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_inputsecret __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_insert __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_invert __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_isdirectory __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_islocked __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_items __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_join __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_keys __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_last_buffer_nr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_len __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_libcall __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_libcallnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_line __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_line2byte __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_lispindent __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_localtime __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_log __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_log10 __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -#ifdef FEAT_LUA -static void f_luaeval __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_map __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_maparg __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_mapcheck __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_match __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchadd __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchaddpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matcharg __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchdelete __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchend __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchlist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_matchstr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_max __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_min __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef vim_mkdir -static void f_mkdir __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_mode __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_MZSCHEME -static void f_mzeval __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_nextnonblank __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_nr2char __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_or __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_pathshorten __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_pow __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_prevnonblank __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_printf __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_pumvisible __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_PYTHON3 -static void f_py3eval __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -#ifdef FEAT_PYTHON -static void f_pyeval __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_range __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_reltime __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_reltimestr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remote_expr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remote_foreground __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remote_peek __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remote_read __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remote_send __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_remove __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_rename __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_repeat __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_resolve __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_reverse __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_round __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_screenattr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_screenchar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_screencol __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_screenrow __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_search __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_searchpairpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_searchpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_server2client __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_serverlist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setbufvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setcmdpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setline __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setloclist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setmatches __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setpos __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setqflist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setreg __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_settabvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_settabwinvar __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_CRYPT -static void f_sha256 __ARGS((typval_T *argvars, typval_T *rettv)); -#endif /* FEAT_CRYPT */ -static void f_shellescape __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_shiftwidth __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_simplify __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_sin __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_sinh __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_sort __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_soundfold __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_spellbadword __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_spellsuggest __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_split __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_sqrt __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_str2float __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_str2nr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strchars __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef HAVE_STRFTIME -static void f_strftime __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_stridx __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_string __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strlen __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strpart __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strridx __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strtrans __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strdisplaywidth __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_strwidth __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_submatch __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_substitute __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_synID __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_synIDattr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_synIDtrans __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_synstack __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_synconcealed __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_system __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_systemlist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tabpagebuflist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tabpagewinnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_taglist __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tagfiles __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tempname __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_test __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_tan __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tanh __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_tolower __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_toupper __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_tr __ARGS((typval_T *argvars, typval_T *rettv)); -#ifdef FEAT_FLOAT -static void f_trunc __ARGS((typval_T *argvars, typval_T *rettv)); -#endif -static void f_type __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_undofile __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_undotree __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_uniq __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_values __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_wildmenumode __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winbufnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_wincol __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winheight __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winline __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winnr __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winrestcmd __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winrestview __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winsaveview __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_winwidth __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv)); -static void f_xor __ARGS((typval_T *argvars, typval_T *rettv)); - -static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp)); -static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum)); -static int get_env_len __ARGS((char_u **arg)); -static int get_id_len __ARGS((char_u **arg)); -static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose)); -static char_u *find_name_end __ARGS((char_u *arg, char_u **expr_start, char_u **expr_end, int flags)); -#define FNE_INCL_BR 1 /* find_name_end(): include [] in name */ -#define FNE_CHECK_START 2 /* find_name_end(): check name starts with - valid character */ -static char_u * make_expanded_name __ARGS((char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end)); -static int eval_isnamec __ARGS((int c)); -static int eval_isnamec1 __ARGS((int c)); -static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int verbose, int no_autoload)); -static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose)); -static typval_T *alloc_tv __ARGS((void)); -static typval_T *alloc_string_tv __ARGS((char_u *string)); -static void init_tv __ARGS((typval_T *varp)); -static long get_tv_number __ARGS((typval_T *varp)); -static linenr_T get_tv_lnum __ARGS((typval_T *argvars)); -static linenr_T get_tv_lnum_buf __ARGS((typval_T *argvars, buf_T *buf)); -static char_u *get_tv_string __ARGS((typval_T *varp)); -static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf)); -static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf)); -static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int no_autoload)); -static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int no_autoload)); -static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); -static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); -static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); -static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); -static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string, int *first)); -static void set_var __ARGS((char_u *name, typval_T *varp, int copy)); -static int var_check_ro __ARGS((int flags, char_u *name)); -static int var_check_fixed __ARGS((int flags, char_u *name)); -static int var_check_func_name __ARGS((char_u *name, int new_var)); -static int valid_varname __ARGS((char_u *varname)); -static int tv_check_lock __ARGS((int lock, char_u *name)); -static int item_copy __ARGS((typval_T *from, typval_T *to, int deep, int copyID)); -static char_u *find_option_end __ARGS((char_u **arg, int *opt_flags)); -static char_u *trans_function_name __ARGS((char_u **pp, int skip, int flags, funcdict_T *fd)); -static int eval_fname_script __ARGS((char_u *p)); -static int eval_fname_sid __ARGS((char_u *p)); -static void list_func_head __ARGS((ufunc_T *fp, int indent)); -static ufunc_T *find_func __ARGS((char_u *name)); -static int function_exists __ARGS((char_u *name)); -static int builtin_function __ARGS((char_u *name, int len)); -#ifdef FEAT_PROFILE -static void func_do_profile __ARGS((ufunc_T *fp)); -static void prof_sort_list __ARGS((FILE *fd, ufunc_T **sorttab, int st_len, char *title, int prefer_self)); -static void prof_func_line __ARGS((FILE *fd, int count, proftime_T *total, proftime_T *self, int prefer_self)); -static int -# ifdef __BORLANDC__ - _RTLENTRYF -# endif - prof_total_cmp __ARGS((const void *s1, const void *s2)); -static int -# ifdef __BORLANDC__ - _RTLENTRYF -# endif - prof_self_cmp __ARGS((const void *s1, const void *s2)); -#endif -static int script_autoload __ARGS((char_u *name, int reload)); -static char_u *autoload_name __ARGS((char_u *name)); -static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp)); -static void func_free __ARGS((ufunc_T *fp)); -static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict)); -static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ; -static void free_funccal __ARGS((funccall_T *fc, int free_val)); -static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)); -static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp)); -static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off)); -static int searchpair_cmn __ARGS((typval_T *argvars, pos_T *match_pos)); -static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos, int *flagsp)); -static void setwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off)); -static int write_list __ARGS((FILE *fd, list_T *list, int binary)); -static void get_cmd_output_as_rettv __ARGS((typval_T *argvars, typval_T *rettv, int retlist)); +#if defined(EBCDIC) || defined(PROTO) +/* + * Compare struct fst by function name. + */ + static int +compare_func_name(const void *s1, const void *s2) +{ + struct fst *p1 = (struct fst *)s1; + struct fst *p2 = (struct fst *)s2; + + return STRCMP(p1->f_name, p2->f_name); +} -#ifdef EBCDIC -static int compare_func_name __ARGS((const void *s1, const void *s2)); -static void sortFunctions __ARGS(()); +/* + * Sort the function table by function name. + * The sorting of the table above is ASCII dependant. + * On machines using EBCDIC we have to sort it. + */ + static void +sortFunctions(void) +{ + int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1; + + qsort(functions, (size_t)funcCnt, sizeof(struct fst), compare_func_name); +} #endif + /* * Initialize the global and v: variables. */ void -eval_init() +eval_init(void) { int i; struct vimvar *p; @@ -865,11 +291,16 @@ eval_init() init_var_dict(&vimvardict, &vimvars_var, VAR_SCOPE); vimvardict.dv_lock = VAR_FIXED; hash_init(&compat_hashtab); - hash_init(&func_hashtab); + func_init(); for (i = 0; i < VV_LEN; ++i) { p = &vimvars[i]; + if (STRLEN(p->vv_name) > 16) + { + IEMSG("INTERNAL: name too long, increase size of dictitem16_T"); + getout(1); + } STRCPY(p->vv_di.di_key, p->vv_name); if (p->vv_flags & VV_RO) p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; @@ -885,8 +316,30 @@ eval_init() /* add to compat scope dict */ hash_add(&compat_hashtab, p->vv_di.di_key); } + vimvars[VV_VERSION].vv_nr = VIM_VERSION_100; + set_vim_var_nr(VV_SEARCHFORWARD, 1L); set_vim_var_nr(VV_HLSEARCH, 1L); + set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); + set_vim_var_list(VV_ERRORS, list_alloc()); + set_vim_var_dict(VV_EVENT, dict_alloc_lock(VAR_FIXED)); + + set_vim_var_nr(VV_FALSE, VVAL_FALSE); + set_vim_var_nr(VV_TRUE, VVAL_TRUE); + set_vim_var_nr(VV_NONE, VVAL_NONE); + set_vim_var_nr(VV_NULL, VVAL_NULL); + + set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER); + set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING); + set_vim_var_nr(VV_TYPE_FUNC, VAR_TYPE_FUNC); + set_vim_var_nr(VV_TYPE_LIST, VAR_TYPE_LIST); + set_vim_var_nr(VV_TYPE_DICT, VAR_TYPE_DICT); + set_vim_var_nr(VV_TYPE_FLOAT, VAR_TYPE_FLOAT); + set_vim_var_nr(VV_TYPE_BOOL, VAR_TYPE_BOOL); + set_vim_var_nr(VV_TYPE_NONE, VAR_TYPE_NONE); + set_vim_var_nr(VV_TYPE_JOB, VAR_TYPE_JOB); + set_vim_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL); + set_reg_var(0); /* default for v:register is not 0 but '"' */ #ifdef EBCDIC @@ -899,7 +352,7 @@ eval_init() #if defined(EXITFREE) || defined(PROTO) void -eval_clear() +eval_clear(void) { int i; struct vimvar *p; @@ -908,10 +361,7 @@ eval_clear() { p = &vimvars[i]; if (p->vv_di.di_tv.v_type == VAR_STRING) - { - vim_free(p->vv_str); - p->vv_str = NULL; - } + VIM_CLEAR(p->vv_str); else if (p->vv_di.di_tv.v_type == VAR_LIST) { list_unref(p->vv_list); @@ -943,79 +393,20 @@ eval_clear() ga_clear(&ga_scripts); /* unreferenced lists and dicts */ - (void)garbage_collect(); + (void)garbage_collect(FALSE); /* functions */ free_all_functions(); - hash_clear(&func_hashtab); } #endif -/* - * Return the name of the executed function. - */ - char_u * -func_name(cookie) - void *cookie; -{ - return ((funccall_T *)cookie)->func->uf_name; -} - -/* - * Return the address holding the next breakpoint line for a funccall cookie. - */ - linenr_T * -func_breakpoint(cookie) - void *cookie; -{ - return &((funccall_T *)cookie)->breakpoint; -} - -/* - * Return the address holding the debug tick for a funccall cookie. - */ - int * -func_dbg_tick(cookie) - void *cookie; -{ - return &((funccall_T *)cookie)->dbg_tick; -} - -/* - * Return the nesting level for a funccall cookie. - */ - int -func_level(cookie) - void *cookie; -{ - return ((funccall_T *)cookie)->level; -} - -/* pointer to funccal for currently active function */ -funccall_T *current_funccal = NULL; - -/* pointer to list of previously used funccal, still around because some - * item in it is still being used. */ -funccall_T *previous_funccal = NULL; - -/* - * Return TRUE when a function was ended by a ":return" command. - */ - int -current_func_returned() -{ - return current_funccal->returned; -} - /* * Set an internal variable to a string value. Creates the variable if it does * not already exist. */ void -set_internal_string_var(name, value) - char_u *name; - char_u *value; +set_internal_string_var(char_u *name, char_u *value) { char_u *val; typval_T *tvp; @@ -1033,18 +424,18 @@ set_internal_string_var(name, value) } static lval_T *redir_lval = NULL; +#define EVALCMD_BUSY (redir_lval == (lval_T *)&redir_lval) static garray_T redir_ga; /* only valid when redir_lval is not NULL */ static char_u *redir_endp = NULL; static char_u *redir_varname = NULL; /* * Start recording command output to a variable + * When "append" is TRUE append to an existing variable. * Returns OK if successfully completed the setup. FAIL otherwise. */ int -var_redir_start(name, append) - char_u *name; - int append; /* append to an existing variable */ +var_redir_start(char_u *name, int append) { int save_emsg; int err; @@ -1121,9 +512,7 @@ var_redir_start(name, append) * :redir END */ void -var_redir_str(value, value_len) - char_u *value; - int value_len; +var_redir_str(char_u *value, int value_len) { int len; @@ -1149,10 +538,16 @@ var_redir_str(value, value_len) * Frees the allocated memory. */ void -var_redir_stop() +var_redir_stop(void) { typval_T tv; + if (EVALCMD_BUSY) + { + redir_lval = NULL; + return; + } + if (redir_lval != NULL) { /* If there was no error: assign the text to the variable. */ @@ -1171,23 +566,20 @@ var_redir_stop() } /* free the collected output */ - vim_free(redir_ga.ga_data); - redir_ga.ga_data = NULL; + VIM_CLEAR(redir_ga.ga_data); - vim_free(redir_lval); - redir_lval = NULL; + VIM_CLEAR(redir_lval); } - vim_free(redir_varname); - redir_varname = NULL; + VIM_CLEAR(redir_varname); } # if defined(FEAT_MBYTE) || defined(PROTO) int -eval_charconvert(enc_from, enc_to, fname_from, fname_to) - char_u *enc_from; - char_u *enc_to; - char_u *fname_from; - char_u *fname_to; +eval_charconvert( + char_u *enc_from, + char_u *enc_to, + char_u *fname_from, + char_u *fname_to) { int err = FALSE; @@ -1210,9 +602,7 @@ eval_charconvert(enc_from, enc_to, fname_from, fname_to) # if defined(FEAT_POSTSCRIPT) || defined(PROTO) int -eval_printexpr(fname, args) - char_u *fname; - char_u *args; +eval_printexpr(char_u *fname, char_u *args) { int err = FALSE; @@ -1234,10 +624,10 @@ eval_printexpr(fname, args) # if defined(FEAT_DIFF) || defined(PROTO) void -eval_diff(origfile, newfile, outfile) - char_u *origfile; - char_u *newfile; - char_u *outfile; +eval_diff( + char_u *origfile, + char_u *newfile, + char_u *outfile) { int err = FALSE; @@ -1251,10 +641,10 @@ eval_diff(origfile, newfile, outfile) } void -eval_patch(origfile, difffile, outfile) - char_u *origfile; - char_u *difffile; - char_u *outfile; +eval_patch( + char_u *origfile, + char_u *difffile, + char_u *outfile) { int err; @@ -1274,14 +664,14 @@ eval_patch(origfile, difffile, outfile) * Return TRUE or FALSE. */ int -eval_to_bool(arg, error, nextcmd, skip) - char_u *arg; - int *error; - char_u **nextcmd; - int skip; /* only parse, don't execute */ +eval_to_bool( + char_u *arg, + int *error, + char_u **nextcmd, + int skip) /* only parse, don't execute */ { typval_T tv; - int retval = FALSE; + varnumber_T retval = FALSE; if (skip) ++emsg_skip; @@ -1299,7 +689,71 @@ eval_to_bool(arg, error, nextcmd, skip) if (skip) --emsg_skip; - return retval; + return (int)retval; +} + + static int +eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) +{ + char_u *s; + int dummy; + char_u buf[NUMBUFLEN]; + + if (expr->v_type == VAR_FUNC) + { + s = expr->vval.v_string; + if (s == NULL || *s == NUL) + return FAIL; + if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL, + 0L, 0L, &dummy, TRUE, NULL, NULL) == FAIL) + return FAIL; + } + else if (expr->v_type == VAR_PARTIAL) + { + partial_T *partial = expr->vval.v_partial; + + s = partial_name(partial); + if (s == NULL || *s == NUL) + return FAIL; + if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL, + 0L, 0L, &dummy, TRUE, partial, NULL) == FAIL) + return FAIL; + } + else + { + s = get_tv_string_buf_chk(expr, buf); + if (s == NULL) + return FAIL; + s = skipwhite(s); + if (eval1(&s, rettv, TRUE) == FAIL) + return FAIL; + if (*s != NUL) /* check for trailing chars after expr */ + { + EMSG2(_(e_invexpr2), s); + return FAIL; + } + } + return OK; +} + +/* + * Like eval_to_bool() but using a typval_T instead of a string. + * Works for string, funcref and partial. + */ + int +eval_expr_to_bool(typval_T *expr, int *error) +{ + typval_T rettv; + int res; + + if (eval_expr_typval(expr, NULL, 0, &rettv) == FAIL) + { + *error = TRUE; + return FALSE; + } + res = (get_tv_number_chk(&rettv, error) != 0); + clear_tv(&rettv); + return res; } /* @@ -1308,10 +762,10 @@ eval_to_bool(arg, error, nextcmd, skip) * pointer to allocated memory, or NULL for failure or when "skip" is TRUE. */ char_u * -eval_to_string_skip(arg, nextcmd, skip) - char_u *arg; - char_u **nextcmd; - int skip; /* only parse, don't execute */ +eval_to_string_skip( + char_u *arg, + char_u **nextcmd, + int skip) /* only parse, don't execute */ { typval_T tv; char_u *retval; @@ -1336,8 +790,7 @@ eval_to_string_skip(arg, nextcmd, skip) * Return FAIL for an error, OK otherwise. */ int -skip_expr(pp) - char_u **pp; +skip_expr(char_u **pp) { typval_T rettv; @@ -1352,10 +805,10 @@ skip_expr(pp) * Return pointer to allocated memory, or NULL for failure. */ char_u * -eval_to_string(arg, nextcmd, convert) - char_u *arg; - char_u **nextcmd; - int convert; +eval_to_string( + char_u *arg, + char_u **nextcmd, + int convert) { typval_T tv; char_u *retval; @@ -1373,7 +826,7 @@ eval_to_string(arg, nextcmd, convert) ga_init2(&ga, (int)sizeof(char), 80); if (tv.vval.v_list != NULL) { - list_join(&ga, tv.vval.v_list, (char_u *)"\n", TRUE, 0); + list_join(&ga, tv.vval.v_list, (char_u *)"\n", TRUE, FALSE, 0); if (tv.vval.v_list->lv_len > 0) ga_append(&ga, NL); } @@ -1400,10 +853,10 @@ eval_to_string(arg, nextcmd, convert) * textlock. When "use_sandbox" is TRUE use the sandbox. */ char_u * -eval_to_string_safe(arg, nextcmd, use_sandbox) - char_u *arg; - char_u **nextcmd; - int use_sandbox; +eval_to_string_safe( + char_u *arg, + char_u **nextcmd, + int use_sandbox) { char_u *retval; void *save_funccalp; @@ -1425,12 +878,11 @@ eval_to_string_safe(arg, nextcmd, use_sandbox) * Evaluates "expr" silently. * Returns -1 for an error. */ - int -eval_to_number(expr) - char_u *expr; + varnumber_T +eval_to_number(char_u *expr) { typval_T rettv; - int retval; + varnumber_T retval; char_u *p = skipwhite(expr); ++emsg_off; @@ -1453,9 +905,7 @@ eval_to_number(expr) * When not used yet add the variable to the v: hashtable. */ static void -prepare_vimvar(idx, save_tv) - int idx; - typval_T *save_tv; +prepare_vimvar(int idx, typval_T *save_tv) { *save_tv = vimvars[idx].vv_tv; if (vimvars[idx].vv_type == VAR_UNKNOWN) @@ -1467,9 +917,7 @@ prepare_vimvar(idx, save_tv) * When no longer defined, remove the variable from the v: hashtable. */ static void -restore_vimvar(idx, save_tv) - int idx; - typval_T *save_tv; +restore_vimvar(int idx, typval_T *save_tv) { hashitem_T *hi; @@ -1478,7 +926,7 @@ restore_vimvar(idx, save_tv) { hi = hash_find(&vimvarht, vimvars[idx].vv_di.di_key); if (HASHITEM_EMPTY(hi)) - EMSG2(_(e_intern2), "restore_vimvar()"); + internal_error("restore_vimvar()"); else hash_remove(&vimvarht, hi); } @@ -1491,9 +939,7 @@ restore_vimvar(idx, save_tv) * Returns NULL when there is an error. */ list_T * -eval_spell_expr(badword, expr) - char_u *badword; - char_u *expr; +eval_spell_expr(char_u *badword, char_u *expr) { typval_T save_val; typval_T rettv; @@ -1529,9 +975,7 @@ eval_spell_expr(badword, expr) * Used to get the good word and score from the eval_spell_expr() result. */ int -get_spellword(list, pp) - list_T *list; - char_u **pp; +get_spellword(list_T *list, char_u **pp) { listitem_T *li; @@ -1543,7 +987,7 @@ get_spellword(list, pp) li = li->li_next; if (li == NULL) return -1; - return get_tv_number(&li->li_tv); + return (int)get_tv_number(&li->li_tv); } #endif @@ -1553,77 +997,36 @@ get_spellword(list, pp) * Returns NULL when there is an error. */ typval_T * -eval_expr(arg, nextcmd) - char_u *arg; - char_u **nextcmd; +eval_expr(char_u *arg, char_u **nextcmd) { typval_T *tv; tv = (typval_T *)alloc(sizeof(typval_T)); if (tv != NULL && eval0(arg, tv, nextcmd, TRUE) == FAIL) - { - vim_free(tv); - tv = NULL; - } + VIM_CLEAR(tv); return tv; } /* - * Call some vimL function and return the result in "*rettv". - * Uses argv[argc] for the function arguments. Only Number and String - * arguments are currently supported. + * Call some Vim script function and return the result in "*rettv". + * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] + * should have type VAR_UNKNOWN. * Returns OK or FAIL. */ int -call_vim_function(func, argc, argv, safe, str_arg_only, rettv) - char_u *func; - int argc; - char_u **argv; - int safe; /* use the sandbox */ - int str_arg_only; /* all arguments are strings */ - typval_T *rettv; +call_vim_function( + char_u *func, + int argc, + typval_T *argv, + typval_T *rettv, + int safe) /* use the sandbox */ { - typval_T *argvars; - long n; - int len; - int i; int doesrange; void *save_funccalp = NULL; int ret; - argvars = (typval_T *)alloc((unsigned)((argc + 1) * sizeof(typval_T))); - if (argvars == NULL) - return FAIL; - - for (i = 0; i < argc; i++) - { - /* Pass a NULL or empty argument as an empty string */ - if (argv[i] == NULL || *argv[i] == NUL) - { - argvars[i].v_type = VAR_STRING; - argvars[i].vval.v_string = (char_u *)""; - continue; - } - - if (str_arg_only) - len = 0; - else - /* Recognize a number argument, the others must be strings. */ - vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL); - if (len != 0 && len == (int)STRLEN(argv[i])) - { - argvars[i].v_type = VAR_NUMBER; - argvars[i].vval.v_number = n; - } - else - { - argvars[i].v_type = VAR_STRING; - argvars[i].vval.v_string = argv[i]; - } - } - if (safe) { save_funccalp = save_funccal(); @@ -1631,15 +1034,14 @@ call_vim_function(func, argc, argv, safe, str_arg_only, rettv) } rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */ - ret = call_func(func, (int)STRLEN(func), rettv, argc, argvars, + ret = call_func(func, (int)STRLEN(func), rettv, argc, argv, NULL, curwin->w_cursor.lnum, curwin->w_cursor.lnum, - &doesrange, TRUE, NULL); + &doesrange, TRUE, NULL, NULL); if (safe) { --sandbox; restore_funccal(save_funccalp); } - vim_free(argvars); if (ret == FAIL) clear_tv(rettv); @@ -1648,22 +1050,22 @@ call_vim_function(func, argc, argv, safe, str_arg_only, rettv) } /* - * Call vimL function "func" and return the result as a number. + * Call Vim script function "func" and return the result as a number. * Returns -1 when calling the function fails. - * Uses argv[argc] for the function arguments. + * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should + * have type VAR_UNKNOWN. */ - long -call_func_retnr(func, argc, argv, safe) - char_u *func; - int argc; - char_u **argv; - int safe; /* use the sandbox */ + varnumber_T +call_func_retnr( + char_u *func, + int argc, + typval_T *argv, + int safe) /* use the sandbox */ { typval_T rettv; - long retval; + varnumber_T retval; - /* All arguments are passed as strings, no conversion to number. */ - if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL) + if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) return -1; retval = get_tv_number_chk(&rettv, NULL); @@ -1676,22 +1078,22 @@ call_func_retnr(func, argc, argv, safe) # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) /* - * Call vimL function "func" and return the result as a string. + * Call Vim script function "func" and return the result as a string. * Returns NULL when calling the function fails. - * Uses argv[argc] for the function arguments. + * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should + * have type VAR_UNKNOWN. */ void * -call_func_retstr(func, argc, argv, safe) - char_u *func; - int argc; - char_u **argv; - int safe; /* use the sandbox */ +call_func_retstr( + char_u *func, + int argc, + typval_T *argv, + int safe) /* use the sandbox */ { typval_T rettv; char_u *retval; - /* All arguments are passed as strings, no conversion to number. */ - if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL) + if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) return NULL; retval = vim_strsave(get_tv_string(&rettv)); @@ -1701,21 +1103,21 @@ call_func_retstr(func, argc, argv, safe) # endif /* - * Call vimL function "func" and return the result as a List. - * Uses argv[argc] for the function arguments. + * Call Vim script function "func" and return the result as a List. + * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should + * have type VAR_UNKNOWN. * Returns NULL when there is something wrong. */ void * -call_func_retlist(func, argc, argv, safe) - char_u *func; - int argc; - char_u **argv; - int safe; /* use the sandbox */ +call_func_retlist( + char_u *func, + int argc, + typval_T *argv, + int safe) /* use the sandbox */ { typval_T rettv; - /* All arguments are passed as strings, no conversion to number. */ - if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL) + if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) return NULL; if (rettv.v_type != VAR_LIST) @@ -1728,66 +1130,6 @@ call_func_retlist(func, argc, argv, safe) } #endif -/* - * Save the current function call pointer, and set it to NULL. - * Used when executing autocommands and for ":source". - */ - void * -save_funccal() -{ - funccall_T *fc = current_funccal; - - current_funccal = NULL; - return (void *)fc; -} - - void -restore_funccal(vfc) - void *vfc; -{ - funccall_T *fc = (funccall_T *)vfc; - - current_funccal = fc; -} - -#if defined(FEAT_PROFILE) || defined(PROTO) -/* - * Prepare profiling for entering a child or something else that is not - * counted for the script/function itself. - * Should always be called in pair with prof_child_exit(). - */ - void -prof_child_enter(tm) - proftime_T *tm; /* place to store waittime */ -{ - funccall_T *fc = current_funccal; - - if (fc != NULL && fc->func->uf_profiling) - profile_start(&fc->prof_child); - script_prof_save(tm); -} - -/* - * Take care of time spent in a child. - * Should always be called after prof_child_enter(). - */ - void -prof_child_exit(tm) - proftime_T *tm; /* where waittime was stored */ -{ - funccall_T *fc = current_funccal; - - if (fc != NULL && fc->func->uf_profiling) - { - profile_end(&fc->prof_child); - profile_sub_wait(tm, &fc->prof_child); /* don't count waiting time */ - profile_add(&fc->func->uf_tm_children, &fc->prof_child); - profile_add(&fc->func->uf_tml_children, &fc->prof_child); - } - script_prof_restore(tm); -} -#endif - #ifdef FEAT_FOLDING /* @@ -1795,12 +1137,10 @@ prof_child_exit(tm) * it in "*cp". Doesn't give error messages. */ int -eval_foldexpr(arg, cp) - char_u *arg; - int *cp; +eval_foldexpr(char_u *arg, int *cp) { typval_T tv; - int retval; + varnumber_T retval; char_u *s; int use_sandbox = was_set_insecurely((char_u *)"foldexpr", OPT_LOCAL); @@ -1835,7 +1175,7 @@ eval_foldexpr(arg, cp) --sandbox; --textlock; - return retval; + return (int)retval; } #endif @@ -1849,8 +1189,7 @@ eval_foldexpr(arg, cp) * ":let [var1, var2] = expr" unpack list. */ void -ex_let(eap) - exarg_T *eap; +ex_let(exarg_T *eap) { char_u *arg = eap->arg; char_u *expr = NULL; @@ -1885,9 +1224,7 @@ ex_let(eap) list_glob_vars(&first); list_buf_vars(&first); list_win_vars(&first); -#ifdef FEAT_WINDOWS list_tab_vars(&first); -#endif list_script_vars(&first); list_func_vars(&first); list_vim_vars(&first); @@ -1934,13 +1271,13 @@ ex_let(eap) * Returns OK or FAIL; */ static int -ex_let_vars(arg_start, tv, copy, semicolon, var_count, nextchars) - char_u *arg_start; - typval_T *tv; - int copy; /* copy values from "tv", don't move */ - int semicolon; /* from skip_var_list() */ - int var_count; /* from skip_var_list() */ - char_u *nextchars; +ex_let_vars( + char_u *arg_start, + typval_T *tv, + int copy, /* copy values from "tv", don't move */ + int semicolon, /* from skip_var_list() */ + int var_count, /* from skip_var_list() */ + char_u *nextchars) { char_u *arg = arg_start; list_T *l; @@ -2016,7 +1353,7 @@ ex_let_vars(arg_start, tv, copy, semicolon, var_count, nextchars) } else if (*arg != ',' && *arg != ']') { - EMSG2(_(e_intern2), "ex_let_vars()"); + internal_error("ex_let_vars()"); return FAIL; } } @@ -2032,10 +1369,10 @@ ex_let_vars(arg_start, tv, copy, semicolon, var_count, nextchars) * Return NULL for an error. */ static char_u * -skip_var_list(arg, var_count, semicolon) - char_u *arg; - int *var_count; - int *semicolon; +skip_var_list( + char_u *arg, + int *var_count, + int *semicolon) { char_u *p, *s; @@ -2083,8 +1420,7 @@ skip_var_list(arg, var_count, semicolon) * l[idx]. */ static char_u * -skip_var_one(arg) - char_u *arg; +skip_var_one(char_u *arg) { if (*arg == '@' && arg[1] != NUL) return arg + 2; @@ -2096,12 +1432,12 @@ skip_var_one(arg) * List variables for hashtab "ht" with prefix "prefix". * If "empty" is TRUE also list NULL strings as empty strings. */ - static void -list_hashtable_vars(ht, prefix, empty, first) - hashtab_T *ht; - char_u *prefix; - int empty; - int *first; + void +list_hashtable_vars( + hashtab_T *ht, + char_u *prefix, + int empty, + int *first) { hashitem_T *hi; dictitem_T *di; @@ -2125,8 +1461,7 @@ list_hashtable_vars(ht, prefix, empty, first) * List global variables. */ static void -list_glob_vars(first) - int *first; +list_glob_vars(int *first) { list_hashtable_vars(&globvarht, (char_u *)"", TRUE, first); } @@ -2135,49 +1470,37 @@ list_glob_vars(first) * List buffer variables. */ static void -list_buf_vars(first) - int *first; +list_buf_vars(int *first) { - char_u numbuf[NUMBUFLEN]; - list_hashtable_vars(&curbuf->b_vars->dv_hashtab, (char_u *)"b:", TRUE, first); - - sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick); - list_one_var_a((char_u *)"b:", (char_u *)"changedtick", VAR_NUMBER, - numbuf, first); } /* * List window variables. */ static void -list_win_vars(first) - int *first; +list_win_vars(int *first) { list_hashtable_vars(&curwin->w_vars->dv_hashtab, (char_u *)"w:", TRUE, first); } -#ifdef FEAT_WINDOWS /* * List tab page variables. */ static void -list_tab_vars(first) - int *first; +list_tab_vars(int *first) { list_hashtable_vars(&curtab->tp_vars->dv_hashtab, (char_u *)"t:", TRUE, first); } -#endif /* * List Vim variables. */ static void -list_vim_vars(first) - int *first; +list_vim_vars(int *first) { list_hashtable_vars(&vimvarht, (char_u *)"v:", FALSE, first); } @@ -2186,34 +1509,18 @@ list_vim_vars(first) * List script-local variables, if there is a script. */ static void -list_script_vars(first) - int *first; +list_script_vars(int *first) { if (current_SID > 0 && current_SID <= ga_scripts.ga_len) list_hashtable_vars(&SCRIPT_VARS(current_SID), (char_u *)"s:", FALSE, first); } -/* - * List function variables, if there is a function. - */ - static void -list_func_vars(first) - int *first; -{ - if (current_funccal != NULL) - list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, - (char_u *)"l:", FALSE, first); -} - /* * List variables in "arg". */ static char_u * -list_arg_vars(eap, arg, first) - exarg_T *eap; - char_u *arg; - int *first; +list_arg_vars(exarg_T *eap, char_u *arg, int *first) { int error = FALSE; int len; @@ -2228,7 +1535,7 @@ list_arg_vars(eap, arg, first) if (error || eap->skip) { arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START); - if (!vim_iswhite(*arg) && !ends_excmd(*arg)) + if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) { emsg_severe = TRUE; EMSG(_(e_trailing)); @@ -2256,7 +1563,7 @@ list_arg_vars(eap, arg, first) { if (tofree != NULL) name = tofree; - if (get_var_tv(name, len, &tv, TRUE, FALSE) == FAIL) + if (get_var_tv(name, len, &tv, NULL, TRUE, FALSE) == FAIL) error = TRUE; else { @@ -2273,9 +1580,7 @@ list_arg_vars(eap, arg, first) case 'g': list_glob_vars(first); break; case 'b': list_buf_vars(first); break; case 'w': list_win_vars(first); break; -#ifdef FEAT_WINDOWS case 't': list_tab_vars(first); break; -#endif case 'v': list_vim_vars(first); break; case 's': list_script_vars(first); break; case 'l': list_func_vars(first); break; @@ -2321,12 +1626,12 @@ list_arg_vars(eap, arg, first) * Returns NULL if there is an error. */ static char_u * -ex_let_one(arg, tv, copy, endchars, op) - char_u *arg; /* points to variable name */ - typval_T *tv; /* value to assign to variable */ - int copy; /* copy value from "tv" */ - char_u *endchars; /* valid chars after variable name or NULL */ - char_u *op; /* "+", "-", "." or NULL*/ +ex_let_one( + char_u *arg, /* points to variable name */ + typval_T *tv, /* value to assign to variable */ + int copy, /* copy value from "tv" */ + char_u *endchars, /* valid chars after variable name or NULL */ + char_u *op) /* "+", "-", "." or NULL*/ { int c1; char_u *name; @@ -2412,7 +1717,7 @@ ex_let_one(arg, tv, copy, endchars, op) c1 = *p; *p = NUL; - n = get_tv_number(tv); + n = (long)get_tv_number(tv); s = get_tv_string_chk(tv); /* != NULL if number or string */ if (s != NULL && op != NULL && *op != '=') { @@ -2420,7 +1725,10 @@ ex_let_one(arg, tv, copy, endchars, op) &stringval, opt_flags); if ((opt_type == 1 && *op == '.') || (opt_type == 0 && *op != '.')) + { EMSG2(_(e_letwrong), op); + s = NULL; /* don't set the value */ + } else { if (opt_type == 1) /* number */ @@ -2511,21 +1819,6 @@ ex_let_one(arg, tv, copy, endchars, op) return arg_end; } -/* - * If "arg" is equal to "b:changedtick" give an error and return TRUE. - */ - static int -check_changedtick(arg) - char_u *arg; -{ - if (STRNCMP(arg, "b:changedtick", 13) == 0 && !eval_isnamec(arg[13])) - { - EMSG2(_(e_readonlyvar), arg); - return TRUE; - } - return FALSE; -} - /* * Get an lval: variable, Dict item or List item that can be assigned a value * to: "name", "na{me}", "name[expr]", "name[expr:expr]", "name[expr][expr]", @@ -2538,21 +1831,22 @@ check_changedtick(arg) * * flags: * GLV_QUIET: do not give error messages + * GLV_READ_ONLY: will not change the variable * GLV_NO_AUTOLOAD: do not use script autoloading * * Returns a pointer to just after the name, including indexes. * When an evaluation error occurs "lp->ll_name" is NULL; * Returns NULL for a parsing error. Still need to free items in "lp"! */ - static char_u * -get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) - char_u *name; - typval_T *rettv; - lval_T *lp; - int unlet; - int skip; - int flags; /* GLV_ values */ - int fne_flags; /* flags for find_name_end() */ + char_u * +get_lval( + char_u *name, + typval_T *rettv, + lval_T *lp, + int unlet, + int skip, + int flags, /* GLV_ values */ + int fne_flags) /* flags for find_name_end() */ { char_u *p; char_u *expr_start, *expr_end; @@ -2582,7 +1876,7 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) if (expr_start != NULL) { /* Don't expand the name when we already know there is an error. */ - if (unlet && !vim_iswhite(*p) && !ends_excmd(*p) + if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { EMSG(_(e_trailing)); @@ -2613,7 +1907,10 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) cc = *p; *p = NUL; - v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD); + /* Only pass &ht when we would write to the variable, it prevents autoload + * as well. */ + v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht, + flags & GLV_NO_AUTOLOAD); if (v == NULL && !quiet) EMSG2(_(e_undefvar), lp->ll_name); *p = cc; @@ -2624,6 +1921,8 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) * Loop until no more [idx] or .key is following. */ lp->ll_tv = &v->di_tv; + var1.v_type = VAR_UNKNOWN; + var2.v_type = VAR_UNKNOWN; while (*p == '[' || (*p == '.' && lp->ll_tv->v_type == VAR_DICT)) { if (!(lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list != NULL) @@ -2681,8 +1980,7 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) { if (!quiet) EMSG(_(e_dictrange)); - if (!empty1) - clear_tv(&var1); + clear_tv(&var1); return NULL; } if (rettv != NULL && (rettv->v_type != VAR_LIST @@ -2690,8 +1988,7 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) { if (!quiet) EMSG(_("E709: [:] requires a List value")); - if (!empty1) - clear_tv(&var1); + clear_tv(&var1); return NULL; } p = skipwhite(p + 1); @@ -2702,15 +1999,13 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) lp->ll_empty2 = FALSE; if (eval1(&p, &var2, TRUE) == FAIL) /* recursive! */ { - if (!empty1) - clear_tv(&var1); + clear_tv(&var1); return NULL; } if (get_tv_string_chk(&var2) == NULL) { /* not a number or string */ - if (!empty1) - clear_tv(&var1); + clear_tv(&var1); clear_tv(&var2); return NULL; } @@ -2724,10 +2019,8 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) { if (!quiet) EMSG(_(e_missbrac)); - if (!empty1) - clear_tv(&var1); - if (lp->ll_range && !lp->ll_empty2) - clear_tv(&var2); + clear_tv(&var1); + clear_tv(&var2); return NULL; } @@ -2740,11 +2033,9 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) if (len == -1) { /* "[key]": get key from "var1" */ - key = get_tv_string(&var1); /* is number or string */ - if (*key == NUL) + key = get_tv_string_chk(&var1); /* is number or string */ + if (key == NULL) { - if (!quiet) - EMSG(_(e_emptykey)); clear_tv(&var1); return NULL; } @@ -2792,26 +2083,27 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) { if (!quiet) EMSG2(_(e_dictkey), key); - if (len == -1) - clear_tv(&var1); + clear_tv(&var1); return NULL; } if (len == -1) lp->ll_newkey = vim_strsave(key); else lp->ll_newkey = vim_strnsave(key, len); - if (len == -1) - clear_tv(&var1); + clear_tv(&var1); if (lp->ll_newkey == NULL) p = NULL; break; } /* existing variable, need to check if it can be changed */ - else if (var_check_ro(lp->ll_di->di_flags, name)) + else if ((flags & GLV_READ_ONLY) == 0 + && var_check_ro(lp->ll_di->di_flags, name, FALSE)) + { + clear_tv(&var1); return NULL; + } - if (len == -1) - clear_tv(&var1); + clear_tv(&var1); lp->ll_tv = &lp->ll_di->di_tv; } else @@ -2822,10 +2114,10 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) if (empty1) lp->ll_n1 = 0; else - { - lp->ll_n1 = get_tv_number(&var1); /* is number or string */ - clear_tv(&var1); - } + /* is number or string */ + lp->ll_n1 = (long)get_tv_number(&var1); + clear_tv(&var1); + lp->ll_dict = NULL; lp->ll_list = lp->ll_tv->vval.v_list; lp->ll_li = list_find(lp->ll_list, lp->ll_n1); @@ -2839,8 +2131,7 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) } if (lp->ll_li == NULL) { - if (lp->ll_range && !lp->ll_empty2) - clear_tv(&var2); + clear_tv(&var2); if (!quiet) EMSGN(_(e_listidx), lp->ll_n1); return NULL; @@ -2854,7 +2145,8 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) */ if (lp->ll_range && !lp->ll_empty2) { - lp->ll_n2 = get_tv_number(&var2); /* is number or string */ + lp->ll_n2 = (long)get_tv_number(&var2); + /* is number or string */ clear_tv(&var2); if (lp->ll_n2 < 0) { @@ -2883,15 +2175,15 @@ get_lval(name, rettv, lp, unlet, skip, flags, fne_flags) } } + clear_tv(&var1); return p; } /* * Clear lval "lp" that was filled by get_lval(). */ - static void -clear_lval(lp) - lval_T *lp; + void +clear_lval(lval_T *lp) { vim_free(lp->ll_exp_name); vim_free(lp->ll_newkey); @@ -2903,12 +2195,12 @@ clear_lval(lp) * "op" is NULL, "+" for "+=", "-" for "-=", "." for ".=" or "=" for "=". */ static void -set_var_lval(lp, endp, rettv, copy, op) - lval_T *lp; - char_u *endp; - typval_T *rettv; - int copy; - char_u *op; +set_var_lval( + lval_T *lp, + char_u *endp, + typval_T *rettv, + int copy, + char_u *op) { int cc; listitem_T *ri; @@ -2916,34 +2208,53 @@ set_var_lval(lp, endp, rettv, copy, op) if (lp->ll_tv == NULL) { - if (!check_changedtick(lp->ll_name)) + cc = *endp; + *endp = NUL; + if (op != NULL && *op != '=') { - cc = *endp; - *endp = NUL; - if (op != NULL && *op != '=') - { - typval_T tv; + typval_T tv; - /* handle +=, -= and .= */ - if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name), - &tv, TRUE, FALSE) == OK) - { - if (tv_op(&tv, rettv, op) == OK) - set_var(lp->ll_name, &tv, FALSE); - clear_tv(&tv); - } + /* handle +=, -= and .= */ + di = NULL; + if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name), + &tv, &di, TRUE, FALSE) == OK) + { + if ((di == NULL + || (!var_check_ro(di->di_flags, lp->ll_name, FALSE) + && !tv_check_lock(di->di_tv.v_lock, lp->ll_name, + FALSE))) + && tv_op(&tv, rettv, op) == OK) + set_var(lp->ll_name, &tv, FALSE); + clear_tv(&tv); } - else - set_var(lp->ll_name, rettv, copy); - *endp = cc; } + else + set_var(lp->ll_name, rettv, copy); + *endp = cc; } else if (tv_check_lock(lp->ll_newkey == NULL ? lp->ll_tv->v_lock - : lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name)) + : lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name, FALSE)) ; else if (lp->ll_range) { + listitem_T *ll_li = lp->ll_li; + int ll_n1 = lp->ll_n1; + + /* + * Check whether any of the list items is locked + */ + for (ri = rettv->vval.v_list->lv_first; ri != NULL && ll_li != NULL; ) + { + if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name, FALSE)) + return; + ri = ri->li_next; + if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1)) + break; + ll_li = ll_li->li_next; + ++ll_n1; + } + /* * Assign the List values to the list items. */ @@ -3029,22 +2340,25 @@ set_var_lval(lp, endp, rettv, copy, op) * Returns OK or FAIL. */ static int -tv_op(tv1, tv2, op) - typval_T *tv1; - typval_T *tv2; - char_u *op; +tv_op(typval_T *tv1, typval_T *tv2, char_u *op) { - long n; + varnumber_T n; char_u numbuf[NUMBUFLEN]; char_u *s; - /* Can't do anything with a Funcref or a Dict on the right. */ - if (tv2->v_type != VAR_FUNC && tv2->v_type != VAR_DICT) + /* Can't do anything with a Funcref, Dict, v:true on the right. */ + if (tv2->v_type != VAR_FUNC && tv2->v_type != VAR_DICT + && tv2->v_type != VAR_SPECIAL) { switch (tv1->v_type) { + case VAR_UNKNOWN: case VAR_DICT: case VAR_FUNC: + case VAR_PARTIAL: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: break; case VAR_LIST: @@ -3102,8 +2416,8 @@ tv_op(tv1, tv2, op) } return OK; -#ifdef FEAT_FLOAT case VAR_FLOAT: +#ifdef FEAT_FLOAT { float_T f; @@ -3120,8 +2434,8 @@ tv_op(tv1, tv2, op) else tv1->vval.v_float -= f; } - return OK; #endif + return OK; } } @@ -3129,57 +2443,6 @@ tv_op(tv1, tv2, op) return FAIL; } -/* - * Add a watcher to a list. - */ - void -list_add_watch(l, lw) - list_T *l; - listwatch_T *lw; -{ - lw->lw_next = l->lv_watch; - l->lv_watch = lw; -} - -/* - * Remove a watcher from a list. - * No warning when it isn't found... - */ - void -list_rem_watch(l, lwrem) - list_T *l; - listwatch_T *lwrem; -{ - listwatch_T *lw, **lwp; - - lwp = &l->lv_watch; - for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next) - { - if (lw == lwrem) - { - *lwp = lw->lw_next; - break; - } - lwp = &lw->lw_next; - } -} - -/* - * Just before removing an item from a list: advance watchers to the next - * item. - */ - static void -list_fix_watch(l, item) - list_T *l; - listitem_T *item; -{ - listwatch_T *lw; - - for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next) - if (lw->lw_item == item) - lw->lw_item = item->li_next; -} - /* * Evaluate the expression used in a ":for var in expr" command. * "arg" points to "var". @@ -3187,11 +2450,11 @@ list_fix_watch(l, item) * Return a pointer that holds the info. Null when there is an error. */ void * -eval_for_line(arg, errp, nextcmdp, skip) - char_u *arg; - int *errp; - char_u **nextcmdp; - int skip; +eval_for_line( + char_u *arg, + int *errp, + char_u **nextcmdp, + int skip) { forinfo_T *fi; char_u *expr; @@ -3209,7 +2472,7 @@ eval_for_line(arg, errp, nextcmdp, skip) return fi; expr = skipwhite(expr); - if (expr[0] != 'i' || expr[1] != 'n' || !vim_iswhite(expr[2])) + if (expr[0] != 'i' || expr[1] != 'n' || !VIM_ISWHITE(expr[2])) { EMSG(_("E690: Missing \"in\" after :for")); return fi; @@ -3223,11 +2486,16 @@ eval_for_line(arg, errp, nextcmdp, skip) if (!skip) { l = tv.vval.v_list; - if (tv.v_type != VAR_LIST || l == NULL) + if (tv.v_type != VAR_LIST) { EMSG(_(e_listreq)); clear_tv(&tv); } + else if (l == NULL) + { + /* a null list is like an empty list: do nothing */ + clear_tv(&tv); + } else { /* No need to increment the refcount, it's already set for the @@ -3251,9 +2519,7 @@ eval_for_line(arg, errp, nextcmdp, skip) * something wrong. */ int -next_for_item(fi_void, arg) - void *fi_void; - char_u *arg; +next_for_item(void *fi_void, char_u *arg) { forinfo_T *fi = (forinfo_T *)fi_void; int result; @@ -3275,8 +2541,7 @@ next_for_item(fi_void, arg) * Free the structure used to store info used by ":for". */ void -free_for_info(fi_void) - void *fi_void; +free_for_info(void *fi_void) { forinfo_T *fi = (forinfo_T *)fi_void; @@ -3291,10 +2556,10 @@ free_for_info(fi_void) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) void -set_context_for_expression(xp, arg, cmdidx) - expand_T *xp; - char_u *arg; - cmdidx_T cmdidx; +set_context_for_expression( + expand_T *xp, + char_u *arg, + cmdidx_T cmdidx) { int got_eq = FALSE; int c; @@ -3309,8 +2574,8 @@ set_context_for_expression(xp, arg, cmdidx) for (p = arg + STRLEN(arg); p >= arg; ) { xp->xp_pattern = p; - mb_ptr_back(arg, p); - if (vim_iswhite(*p)) + MB_PTR_BACK(arg, p); + if (VIM_ISWHITE(*p)) break; } return; @@ -3350,11 +2615,17 @@ set_context_for_expression(xp, arg, cmdidx) got_eq = TRUE; xp->xp_context = EXPAND_EXPRESSION; } - else if (c == '<' + else if (c == '#' + && xp->xp_context == EXPAND_EXPRESSION) + { + /* Autoload function/variable contains '#'. */ + break; + } + else if ((c == '<' || c == '#') && xp->xp_context == EXPAND_FUNCTIONS && vim_strchr(xp->xp_pattern, '(') == NULL) { - /* Function name can start with "<SNR>" */ + /* Function name can start with "<SNR>" and contain '#'. */ break; } else if (cmdidx != CMD_let || got_eq) @@ -3400,142 +2671,11 @@ set_context_for_expression(xp, arg, cmdidx) #endif /* FEAT_CMDL_COMPL */ -/* - * ":1,25call func(arg1, arg2)" function call. - */ - void -ex_call(eap) - exarg_T *eap; -{ - char_u *arg = eap->arg; - char_u *startarg; - char_u *name; - char_u *tofree; - int len; - typval_T rettv; - linenr_T lnum; - int doesrange; - int failed = FALSE; - funcdict_T fudi; - - if (eap->skip) - { - /* trans_function_name() doesn't work well when skipping, use eval0() - * instead to skip to any following command, e.g. for: - * :if 0 | call dict.foo().bar() | endif */ - ++emsg_skip; - if (eval0(eap->arg, &rettv, &eap->nextcmd, FALSE) != FAIL) - clear_tv(&rettv); - --emsg_skip; - return; - } - - tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi); - if (fudi.fd_newkey != NULL) - { - /* Still need to give an error message for missing key. */ - EMSG2(_(e_dictkey), fudi.fd_newkey); - vim_free(fudi.fd_newkey); - } - if (tofree == NULL) - return; - - /* Increase refcount on dictionary, it could get deleted when evaluating - * the arguments. */ - if (fudi.fd_dict != NULL) - ++fudi.fd_dict->dv_refcount; - - /* If it is the name of a variable of type VAR_FUNC use its contents. */ - len = (int)STRLEN(tofree); - name = deref_func_name(tofree, &len, FALSE); - - /* Skip white space to allow ":call func ()". Not good, but required for - * backward compatibility. */ - startarg = skipwhite(arg); - rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ - - if (*startarg != '(') - { - EMSG2(_("E107: Missing parentheses: %s"), eap->arg); - goto end; - } - - /* - * When skipping, evaluate the function once, to find the end of the - * arguments. - * When the function takes a range, this is discovered after the first - * call, and the loop is broken. - */ - if (eap->skip) - { - ++emsg_skip; - lnum = eap->line2; /* do it once, also with an invalid range */ - } - else - lnum = eap->line1; - for ( ; lnum <= eap->line2; ++lnum) - { - if (!eap->skip && eap->addr_count > 0) - { - curwin->w_cursor.lnum = lnum; - curwin->w_cursor.col = 0; -#ifdef FEAT_VIRTUALEDIT - curwin->w_cursor.coladd = 0; -#endif - } - arg = startarg; - if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg, - eap->line1, eap->line2, &doesrange, - !eap->skip, fudi.fd_dict) == FAIL) - { - failed = TRUE; - break; - } - - /* Handle a function returning a Funcref, Dictionary or List. */ - if (handle_subscript(&arg, &rettv, !eap->skip, TRUE) == FAIL) - { - failed = TRUE; - break; - } - - clear_tv(&rettv); - if (doesrange || eap->skip) - break; - - /* Stop when immediately aborting on error, or when an interrupt - * occurred or an exception was thrown but not caught. - * get_func_tv() returned OK, so that the check for trailing - * characters below is executed. */ - if (aborting()) - break; - } - if (eap->skip) - --emsg_skip; - - if (!failed) - { - /* Check for trailing illegal characters and a following command. */ - if (!ends_excmd(*arg)) - { - emsg_severe = TRUE; - EMSG(_(e_trailing)); - } - else - eap->nextcmd = check_nextcmd(arg); - } - -end: - dict_unref(fudi.fd_dict); - vim_free(tofree); -} - /* * ":unlet[!] var1 ... " command. */ void -ex_unlet(eap) - exarg_T *eap; +ex_unlet(exarg_T *eap) { ex_unletlock(eap, eap->arg, 0); } @@ -3544,8 +2684,7 @@ ex_unlet(eap) * ":lockvar" and ":unlockvar" commands */ void -ex_lockvar(eap) - exarg_T *eap; +ex_lockvar(exarg_T *eap) { char_u *arg = eap->arg; int deep = 2; @@ -3565,10 +2704,10 @@ ex_lockvar(eap) * ":unlet", ":lockvar" and ":unlockvar" are quite similar. */ static void -ex_unletlock(eap, argstart, deep) - exarg_T *eap; - char_u *argstart; - int deep; +ex_unletlock( + exarg_T *eap, + char_u *argstart, + int deep) { char_u *arg = argstart; char_u *name_end; @@ -3577,12 +2716,26 @@ ex_unletlock(eap, argstart, deep) do { + if (*arg == '$') + { + char_u *name = ++arg; + + if (get_env_len(&arg) == 0) + { + EMSG2(_(e_invarg2), name - 1); + return; + } + vim_unsetenv(name); + arg = skipwhite(arg); + continue; + } + /* Parse the name and find the end. */ name_end = get_lval(arg, NULL, &lv, TRUE, eap->skip || error, 0, FNE_CHECK_START); if (lv.ll_name == NULL) error = TRUE; /* error but continue parsing */ - if (name_end == NULL || (!vim_iswhite(*name_end) + if (name_end == NULL || (!VIM_ISWHITE(*name_end) && !ends_excmd(*name_end))) { if (name_end != NULL) @@ -3620,10 +2773,10 @@ ex_unletlock(eap, argstart, deep) } static int -do_unlet_var(lp, name_end, forceit) - lval_T *lp; - char_u *name_end; - int forceit; +do_unlet_var( + lval_T *lp, + char_u *name_end, + int forceit) { int ret = OK; int cc; @@ -3634,17 +2787,29 @@ do_unlet_var(lp, name_end, forceit) *name_end = NUL; /* Normal name or expanded name. */ - if (check_changedtick(lp->ll_name)) - ret = FAIL; - else if (do_unlet(lp->ll_name, forceit) == FAIL) + if (do_unlet(lp->ll_name, forceit) == FAIL) ret = FAIL; *name_end = cc; } - else if (tv_check_lock(lp->ll_tv->v_lock, lp->ll_name)) + else if ((lp->ll_list != NULL + && tv_check_lock(lp->ll_list->lv_lock, lp->ll_name, FALSE)) + || (lp->ll_dict != NULL + && tv_check_lock(lp->ll_dict->dv_lock, lp->ll_name, FALSE))) return FAIL; else if (lp->ll_range) { listitem_T *li; + listitem_T *ll_li = lp->ll_li; + int ll_n1 = lp->ll_n1; + + while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1)) + { + li = ll_li->li_next; + if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name, FALSE)) + return FAIL; + ll_li = li; + ++ll_n1; + } /* Delete a range of List items. */ while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1)) @@ -3673,25 +2838,46 @@ do_unlet_var(lp, name_end, forceit) * When "forceit" is TRUE don't complain if the variable doesn't exist. */ int -do_unlet(name, forceit) - char_u *name; - int forceit; +do_unlet(char_u *name, int forceit) { hashtab_T *ht; hashitem_T *hi; char_u *varname; + dict_T *d; dictitem_T *di; ht = find_var_ht(name, &varname); if (ht != NULL && *varname != NUL) { + d = get_current_funccal_dict(ht); + if (d == NULL) + { + if (ht == &globvarht) + d = &globvardict; + else if (ht == &compat_hashtab) + d = &vimvardict; + else + { + di = find_var_in_ht(ht, *name, (char_u *)"", FALSE); + d = di == NULL ? NULL : di->di_tv.vval.v_dict; + } + if (d == NULL) + { + internal_error("do_unlet()"); + return FAIL; + } + } hi = hash_find(ht, varname); - if (!HASHITEM_EMPTY(hi)) + if (HASHITEM_EMPTY(hi)) + hi = find_hi_in_scoped_ht(name, &ht); + if (hi != NULL && !HASHITEM_EMPTY(hi)) { di = HI2DI(hi); - if (var_check_fixed(di->di_flags, name) - || var_check_ro(di->di_flags, name)) + if (var_check_fixed(di->di_flags, name, FALSE) + || var_check_ro(di->di_flags, name, FALSE) + || tv_check_lock(d->dv_lock, name, FALSE)) return FAIL; + delete_var(ht, hi); return OK; } @@ -3708,11 +2894,11 @@ do_unlet(name, forceit) * "lock" is TRUE for ":lockvar", FALSE for ":unlockvar". */ static int -do_lock_var(lp, name_end, deep, lock) - lval_T *lp; - char_u *name_end; - int deep; - int lock; +do_lock_var( + lval_T *lp, + char_u *name_end, + int deep, + int lock) { int ret = OK; int cc; @@ -3727,21 +2913,22 @@ do_lock_var(lp, name_end, deep, lock) *name_end = NUL; /* Normal name or expanded name. */ - if (check_changedtick(lp->ll_name)) + di = find_var(lp->ll_name, NULL, TRUE); + if (di == NULL) ret = FAIL; + else if ((di->di_flags & DI_FLAGS_FIX) + && di->di_tv.v_type != VAR_DICT + && di->di_tv.v_type != VAR_LIST) + /* For historic reasons this error is not given for a list or dict. + * E.g., the b: dict could be locked/unlocked. */ + EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); else { - di = find_var(lp->ll_name, NULL, TRUE); - if (di == NULL) - ret = FAIL; + if (lock) + di->di_flags |= DI_FLAGS_LOCK; else - { - if (lock) - di->di_flags |= DI_FLAGS_LOCK; - else - di->di_flags &= ~DI_FLAGS_LOCK; - item_lock(&di->di_tv, deep, lock); - } + di->di_flags &= ~DI_FLAGS_LOCK; + item_lock(&di->di_tv, deep, lock); } *name_end = cc; } @@ -3761,7 +2948,7 @@ do_lock_var(lp, name_end, deep, lock) /* (un)lock a List item. */ item_lock(&lp->ll_li->li_tv, deep, lock); else - /* un(lock) a Dictionary item. */ + /* (un)lock a Dictionary item. */ item_lock(&lp->ll_di->di_tv, deep, lock); return ret; @@ -3771,10 +2958,7 @@ do_lock_var(lp, name_end, deep, lock) * Lock or unlock an item. "deep" is nr of levels to go. */ static void -item_lock(tv, deep, lock) - typval_T *tv; - int deep; - int lock; +item_lock(typval_T *tv, int deep, int lock) { static int recurse = 0; list_T *l; @@ -3800,6 +2984,17 @@ item_lock(tv, deep, lock) switch (tv->v_type) { + case VAR_UNKNOWN: + case VAR_NUMBER: + case VAR_STRING: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_FLOAT: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + break; + case VAR_LIST: if ((l = tv->vval.v_list) != NULL) { @@ -3838,29 +3033,12 @@ item_lock(tv, deep, lock) --recurse; } -/* - * Return TRUE if typeval "tv" is locked: Either that value is locked itself - * or it refers to a List or Dictionary that is locked. - */ - static int -tv_islocked(tv) - typval_T *tv; -{ - return (tv->v_lock & VAR_LOCKED) - || (tv->v_type == VAR_LIST - && tv->vval.v_list != NULL - && (tv->vval.v_list->lv_lock & VAR_LOCKED)) - || (tv->v_type == VAR_DICT - && tv->vval.v_dict != NULL - && (tv->vval.v_dict->dv_lock & VAR_LOCKED)); -} - #if (defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)) || defined(PROTO) /* * Delete all "menutrans_" variables. */ void -del_menutrans_vars() +del_menutrans_vars(void) { hashitem_T *hi; int todo; @@ -3888,7 +3066,7 @@ del_menutrans_vars() * get_user_var_name(). */ -static char_u *cat_prefix_varname __ARGS((int prefix, char_u *name)); +static char_u *cat_prefix_varname(int prefix, char_u *name); static char_u *varnamebuf = NULL; static int varnamebuflen = 0; @@ -3897,9 +3075,7 @@ static int varnamebuflen = 0; * Function to concatenate a prefix and a variable name. */ static char_u * -cat_prefix_varname(prefix, name) - int prefix; - char_u *name; +cat_prefix_varname(int prefix, char_u *name) { int len; @@ -3927,16 +3103,12 @@ cat_prefix_varname(prefix, name) * (global/buffer/window/built-in) variable names. */ char_u * -get_user_var_name(xp, idx) - expand_T *xp; - int idx; +get_user_var_name(expand_T *xp, int idx) { static long_u gdone; static long_u bdone; static long_u wdone; -#ifdef FEAT_WINDOWS static long_u tdone; -#endif static int vidx; static hashitem_T *hi; hashtab_T *ht; @@ -3944,9 +3116,7 @@ get_user_var_name(xp, idx) if (idx == 0) { gdone = bdone = wdone = vidx = 0; -#ifdef FEAT_WINDOWS tdone = 0; -#endif } /* Global variables */ @@ -3975,11 +3145,6 @@ get_user_var_name(xp, idx) ++hi; return cat_prefix_varname('b', hi->hi_key); } - if (bdone == ht->ht_used) - { - ++bdone; - return (char_u *)"b:changedtick"; - } /* w: variables */ ht = &curwin->w_vars->dv_hashtab; @@ -3994,7 +3159,6 @@ get_user_var_name(xp, idx) return cat_prefix_varname('w', hi->hi_key); } -#ifdef FEAT_WINDOWS /* t: variables */ ht = &curtab->tp_vars->dv_hashtab; if (tdone < ht->ht_used) @@ -4007,14 +3171,12 @@ get_user_var_name(xp, idx) ++hi; return cat_prefix_varname('t', hi->hi_key); } -#endif /* v: variables */ if (vidx < VV_LEN) return cat_prefix_varname('v', (char_u *)vimvars[vidx++].vv_name); - vim_free(varnamebuf); - varnamebuf = NULL; + VIM_CLEAR(varnamebuf); varnamebuflen = 0; return NULL; } @@ -4022,23 +3184,32 @@ get_user_var_name(xp, idx) #endif /* FEAT_CMDL_COMPL */ /* - * types for expressions. + * Return TRUE if "pat" matches "text". + * Does not use 'cpo' and always uses 'magic'. */ -typedef enum + static int +pattern_match(char_u *pat, char_u *text, int ic) { - TYPE_UNKNOWN = 0 - , TYPE_EQUAL /* == */ - , TYPE_NEQUAL /* != */ - , TYPE_GREATER /* > */ - , TYPE_GEQUAL /* >= */ - , TYPE_SMALLER /* < */ - , TYPE_SEQUAL /* <= */ - , TYPE_MATCH /* =~ */ - , TYPE_NOMATCH /* !~ */ -} exptype_T; + int matches = FALSE; + char_u *save_cpo; + regmatch_T regmatch; -/* - * The "evaluate" argument: When FALSE, the argument is only parsed but not + /* avoid 'l' flag in 'cpoptions' */ + save_cpo = p_cpo; + p_cpo = (char_u *)""; + regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + if (regmatch.regprog != NULL) + { + regmatch.rm_ic = ic; + matches = vim_regexec_nl(®match, text, (colnr_T)0); + vim_regfree(regmatch.regprog); + } + p_cpo = save_cpo; + return matches; +} + +/* + * The "evaluate" argument: When FALSE, the argument is only parsed but not * executed. The function may return OK, but the rettv will be of type * VAR_UNKNOWN. The function still returns FAIL for a syntax error. */ @@ -4050,12 +3221,12 @@ typedef enum * Note: "rettv.v_lock" is not set. * Return OK or FAIL. */ - static int -eval0(arg, rettv, nextcmd, evaluate) - char_u *arg; - typval_T *rettv; - char_u **nextcmd; - int evaluate; + int +eval0( + char_u *arg, + typval_T *rettv, + char_u **nextcmd, + int evaluate) { int ret; char_u *p; @@ -4092,11 +3263,8 @@ eval0(arg, rettv, nextcmd, evaluate) * * Return OK or FAIL. */ - static int -eval1(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; + int +eval1(char_u **arg, typval_T *rettv, int evaluate) { int result; typval_T var2; @@ -4166,10 +3334,7 @@ eval1(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval2(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +eval2(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; long result; @@ -4237,10 +3402,7 @@ eval2(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval3(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +eval3(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; long result; @@ -4317,10 +3479,7 @@ eval3(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval4(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +eval4(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; char_u *p; @@ -4328,12 +3487,7 @@ eval4(arg, rettv, evaluate) exptype_T type = TYPE_UNKNOWN; int type_is = FALSE; /* TRUE for "is" and "isnot" */ int len = 2; - long n1, n2; - char_u *s1, *s2; - char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; - regmatch_T regmatch; int ic; - char_u *save_cpo; /* * Get the first variable. @@ -4374,7 +3528,8 @@ eval4(arg, rettv, evaluate) { if (p[2] == 'n' && p[3] == 'o' && p[4] == 't') len = 5; - if (!vim_isIDc(p[len])) + i = p[len]; + if (!isalnum(i) && i != '_') { type = len == 2 ? TYPE_EQUAL : TYPE_NEQUAL; type_is = TRUE; @@ -4413,201 +3568,12 @@ eval4(arg, rettv, evaluate) clear_tv(rettv); return FAIL; } - if (evaluate) { - if (type_is && rettv->v_type != var2.v_type) - { - /* For "is" a different type always means FALSE, for "notis" - * it means TRUE. */ - n1 = (type == TYPE_NEQUAL); - } - else if (rettv->v_type == VAR_LIST || var2.v_type == VAR_LIST) - { - if (type_is) - { - n1 = (rettv->v_type == var2.v_type - && rettv->vval.v_list == var2.vval.v_list); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - else if (rettv->v_type != var2.v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) - { - if (rettv->v_type != var2.v_type) - EMSG(_("E691: Can only compare List with List")); - else - EMSG(_("E692: Invalid operation for List")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - else - { - /* Compare two Lists for being equal or unequal. */ - n1 = list_equal(rettv->vval.v_list, var2.vval.v_list, - ic, FALSE); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - } - - else if (rettv->v_type == VAR_DICT || var2.v_type == VAR_DICT) - { - if (type_is) - { - n1 = (rettv->v_type == var2.v_type - && rettv->vval.v_dict == var2.vval.v_dict); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - else if (rettv->v_type != var2.v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) - { - if (rettv->v_type != var2.v_type) - EMSG(_("E735: Can only compare Dictionary with Dictionary")); - else - EMSG(_("E736: Invalid operation for Dictionary")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - else - { - /* Compare two Dictionaries for being equal or unequal. */ - n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict, - ic, FALSE); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - } - - else if (rettv->v_type == VAR_FUNC || var2.v_type == VAR_FUNC) - { - if (rettv->v_type != var2.v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) - { - if (rettv->v_type != var2.v_type) - EMSG(_("E693: Can only compare Funcref with Funcref")); - else - EMSG(_("E694: Invalid operation for Funcrefs")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - else - { - /* Compare two Funcrefs for being equal or unequal. */ - if (rettv->vval.v_string == NULL - || var2.vval.v_string == NULL) - n1 = FALSE; - else - n1 = STRCMP(rettv->vval.v_string, - var2.vval.v_string) == 0; - if (type == TYPE_NEQUAL) - n1 = !n1; - } - } - -#ifdef FEAT_FLOAT - /* - * If one of the two variables is a float, compare as a float. - * When using "=~" or "!~", always compare as string. - */ - else if ((rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT) - && type != TYPE_MATCH && type != TYPE_NOMATCH) - { - float_T f1, f2; - - if (rettv->v_type == VAR_FLOAT) - f1 = rettv->vval.v_float; - else - f1 = get_tv_number(rettv); - if (var2.v_type == VAR_FLOAT) - f2 = var2.vval.v_float; - else - f2 = get_tv_number(&var2); - n1 = FALSE; - switch (type) - { - case TYPE_EQUAL: n1 = (f1 == f2); break; - case TYPE_NEQUAL: n1 = (f1 != f2); break; - case TYPE_GREATER: n1 = (f1 > f2); break; - case TYPE_GEQUAL: n1 = (f1 >= f2); break; - case TYPE_SMALLER: n1 = (f1 < f2); break; - case TYPE_SEQUAL: n1 = (f1 <= f2); break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ - } - } -#endif - - /* - * If one of the two variables is a number, compare as a number. - * When using "=~" or "!~", always compare as string. - */ - else if ((rettv->v_type == VAR_NUMBER || var2.v_type == VAR_NUMBER) - && type != TYPE_MATCH && type != TYPE_NOMATCH) - { - n1 = get_tv_number(rettv); - n2 = get_tv_number(&var2); - switch (type) - { - case TYPE_EQUAL: n1 = (n1 == n2); break; - case TYPE_NEQUAL: n1 = (n1 != n2); break; - case TYPE_GREATER: n1 = (n1 > n2); break; - case TYPE_GEQUAL: n1 = (n1 >= n2); break; - case TYPE_SMALLER: n1 = (n1 < n2); break; - case TYPE_SEQUAL: n1 = (n1 <= n2); break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ - } - } - else - { - s1 = get_tv_string_buf(rettv, buf1); - s2 = get_tv_string_buf(&var2, buf2); - if (type != TYPE_MATCH && type != TYPE_NOMATCH) - i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); - else - i = 0; - n1 = FALSE; - switch (type) - { - case TYPE_EQUAL: n1 = (i == 0); break; - case TYPE_NEQUAL: n1 = (i != 0); break; - case TYPE_GREATER: n1 = (i > 0); break; - case TYPE_GEQUAL: n1 = (i >= 0); break; - case TYPE_SMALLER: n1 = (i < 0); break; - case TYPE_SEQUAL: n1 = (i <= 0); break; - - case TYPE_MATCH: - case TYPE_NOMATCH: - /* avoid 'l' flag in 'cpoptions' */ - save_cpo = p_cpo; - p_cpo = (char_u *)""; - regmatch.regprog = vim_regcomp(s2, - RE_MAGIC + RE_STRING); - regmatch.rm_ic = ic; - if (regmatch.regprog != NULL) - { - n1 = vim_regexec_nl(®match, s1, (colnr_T)0); - vim_regfree(regmatch.regprog); - if (type == TYPE_NOMATCH) - n1 = !n1; - } - p_cpo = save_cpo; - break; + int ret = typval_compare(rettv, &var2, type, type_is, ic); - case TYPE_UNKNOWN: break; /* avoid gcc warning */ - } - } - clear_tv(rettv); clear_tv(&var2); - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = n1; + return ret; } } @@ -4626,15 +3592,12 @@ eval4(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval5(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +eval5(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; typval_T var3; int op; - long n1, n2; + varnumber_T n1, n2; #ifdef FEAT_FLOAT float_T f1 = 0, f2 = 0; #endif @@ -4811,15 +3774,15 @@ eval5(arg, rettv, evaluate) * Return OK or FAIL. */ static int -eval6(arg, rettv, evaluate, want_string) - char_u **arg; - typval_T *rettv; - int evaluate; - int want_string; /* after "." operator */ +eval6( + char_u **arg, + typval_T *rettv, + int evaluate, + int want_string) /* after "." operator */ { typval_T var2; int op; - long n1, n2; + varnumber_T n1, n2; #ifdef FEAT_FLOAT int use_float = FALSE; float_T f1 = 0, f2; @@ -4941,11 +3904,11 @@ eval6(arg, rettv, evaluate, want_string) if (n2 == 0) /* give an error message? */ { if (n1 == 0) - n1 = -0x7fffffffL - 1L; /* similar to NaN */ + n1 = VARNUM_MIN; /* similar to NaN */ else if (n1 < 0) - n1 = -0x7fffffffL; + n1 = -VARNUM_MAX; else - n1 = 0x7fffffffL; + n1 = VARNUM_MAX; } else n1 = n1 / n2; @@ -4993,13 +3956,13 @@ eval6(arg, rettv, evaluate, want_string) * Return OK or FAIL. */ static int -eval7(arg, rettv, evaluate, want_string) - char_u **arg; - typval_T *rettv; - int evaluate; - int want_string UNUSED; /* after "." operator */ +eval7( + char_u **arg, + typval_T *rettv, + int evaluate, + int want_string UNUSED) /* after "." operator */ { - long n; + varnumber_T n; int len; char_u *s; char_u *start_leader, *end_leader; @@ -5013,7 +3976,7 @@ eval7(arg, rettv, evaluate, want_string) rettv->v_type = VAR_UNKNOWN; /* - * Skip '!' and '-' characters. They are handled later. + * Skip '!', '-' and '+' characters. They are handled later. */ start_leader = *arg; while (**arg == '!' || **arg == '-' || **arg == '+') @@ -5076,7 +4039,7 @@ eval7(arg, rettv, evaluate, want_string) else #endif { - vim_str2nr(*arg, NULL, &len, TRUE, TRUE, &n, NULL); + vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0); *arg += len; if (evaluate) { @@ -5106,9 +4069,12 @@ eval7(arg, rettv, evaluate, want_string) break; /* + * Lambda: {arg, arg -> expr} * Dictionary: {key: val, key: val} */ - case '{': ret = get_dict_tv(arg, rettv, evaluate); + case '{': ret = get_lambda_tv(arg, rettv, evaluate); + if (ret == NOTDONE) + ret = get_dict_tv(arg, rettv, evaluate); break; /* @@ -5173,21 +4139,33 @@ eval7(arg, rettv, evaluate, want_string) { if (**arg == '(') /* recursive! */ { + partial_T *partial; + + if (!evaluate) + check_vars(s, len); + /* If "s" is the name of a variable of type VAR_FUNC * use its contents. */ - s = deref_func_name(s, &len, !evaluate); + s = deref_func_name(s, &len, &partial, !evaluate); - /* Invoke the function. */ - ret = get_func_tv(s, len, rettv, arg, - curwin->w_cursor.lnum, curwin->w_cursor.lnum, - &len, evaluate, NULL); + /* Need to make a copy, in case evaluating the arguments makes + * the name invalid. */ + s = vim_strsave(s); + if (s == NULL) + ret = FAIL; + else + /* Invoke the function. */ + ret = get_func_tv(s, len, rettv, arg, + curwin->w_cursor.lnum, curwin->w_cursor.lnum, + &len, evaluate, partial, NULL); + vim_free(s); /* If evaluate is FALSE rettv->v_type was not set in * get_func_tv, but it's needed in handle_subscript() to parse * what follows. So set it here. */ if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') { - rettv->vval.v_string = vim_strsave((char_u *)""); + rettv->vval.v_string = NULL; rettv->v_type = VAR_FUNC; } @@ -5202,9 +4180,12 @@ eval7(arg, rettv, evaluate, want_string) } } else if (evaluate) - ret = get_var_tv(s, len, rettv, TRUE, FALSE); + ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE); else + { + check_vars(s, len); ret = OK; + } } vim_free(alias); } @@ -5222,7 +4203,7 @@ eval7(arg, rettv, evaluate, want_string) if (ret == OK && evaluate && end_leader > start_leader) { int error = FALSE; - int val = 0; + varnumber_T val = 0; #ifdef FEAT_FLOAT float_T f = 0.0; @@ -5285,11 +4266,11 @@ eval7(arg, rettv, evaluate, want_string) * Returns FAIL or OK. "*arg" is advanced to after the ']'. */ static int -eval_index(arg, rettv, evaluate, verbose) - char_u **arg; - typval_T *rettv; - int evaluate; - int verbose; /* give error messages */ +eval_index( + char_u **arg, + typval_T *rettv, + int evaluate, + int verbose) /* give error messages */ { int empty1 = FALSE, empty2 = FALSE; typval_T var1, var2; @@ -5299,21 +4280,39 @@ eval_index(arg, rettv, evaluate, verbose) char_u *s; char_u *key = NULL; - if (rettv->v_type == VAR_FUNC) + switch (rettv->v_type) { - if (verbose) - EMSG(_("E695: Cannot index a Funcref")); - return FAIL; - } + case VAR_FUNC: + case VAR_PARTIAL: + if (verbose) + EMSG(_("E695: Cannot index a Funcref")); + return FAIL; + case VAR_FLOAT: #ifdef FEAT_FLOAT - else if (rettv->v_type == VAR_FLOAT) - { - if (verbose) - EMSG(_(e_float_as_string)); - return FAIL; - } + if (verbose) + EMSG(_(e_float_as_string)); + return FAIL; #endif + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + if (verbose) + EMSG(_("E909: Cannot index a special variable")); + return FAIL; + case VAR_UNKNOWN: + if (evaluate) + return FAIL; + /* FALLTHROUGH */ + + case VAR_STRING: + case VAR_NUMBER: + case VAR_LIST: + case VAR_DICT: + break; + } + init_tv(&var1); + init_tv(&var2); if (**arg == '.') { /* @@ -5404,6 +4403,15 @@ eval_index(arg, rettv, evaluate, verbose) switch (rettv->v_type) { + case VAR_UNKNOWN: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_FLOAT: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + break; /* not evaluating, skipping over subscript */ + case VAR_NUMBER: case VAR_STRING: s = get_tv_string(rettv); @@ -5477,15 +4485,13 @@ eval_index(arg, rettv, evaluate, verbose) { if (list_append_tv(l, &item->li_tv) == FAIL) { - list_free(l, TRUE); + list_free(l); return FAIL; } item = item->li_next; } clear_tv(rettv); - rettv->v_type = VAR_LIST; - rettv->vval.v_list = l; - ++l->lv_refcount; + rettv_list_set(rettv, l); } else { @@ -5509,11 +4515,9 @@ eval_index(arg, rettv, evaluate, verbose) if (len == -1) { - key = get_tv_string(&var1); - if (*key == NUL) + key = get_tv_string_chk(&var1); + if (key == NULL) { - if (verbose) - EMSG(_(e_emptykey)); clear_tv(&var1); return FAIL; } @@ -5545,11 +4549,11 @@ eval_index(arg, rettv, evaluate, verbose) * "arg" is advanced to character after the option name. * Return OK or FAIL. */ - static int -get_option_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; /* when NULL, only check if option exists */ - int evaluate; + int +get_option_tv( + char_u **arg, + typval_T *rettv, /* when NULL, only check if option exists */ + int evaluate) { char_u *option_end; long numval; @@ -5625,10 +4629,7 @@ get_option_tv(arg, rettv, evaluate) * Return OK or FAIL. */ static int -get_string_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +get_string_tv(char_u **arg, typval_T *rettv, int evaluate) { char_u *p; char_u *name; @@ -5637,7 +4638,7 @@ get_string_tv(arg, rettv, evaluate) /* * Find the end of the string, skipping backslashed characters. */ - for (p = *arg + 1; *p != NUL && *p != '"'; mb_ptr_adv(p)) + for (p = *arg + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p)) { if (*p == '\\' && p[1] != NUL) { @@ -5696,8 +4697,10 @@ get_string_tv(arg, rettv, evaluate) if (c == 'X') n = 2; - else + else if (*p == 'u') n = 4; + else + n = 8; nr = 0; while (--n >= 0 && vim_isxdigit(p[1])) { @@ -5735,7 +4738,7 @@ get_string_tv(arg, rettv, evaluate) break; /* Special key, e.g.: "\<C-W>" */ - case '<': extra = trans_special(&p, name, TRUE); + case '<': extra = trans_special(&p, name, TRUE, TRUE); if (extra != 0) { name += extra; @@ -5752,7 +4755,9 @@ get_string_tv(arg, rettv, evaluate) } *name = NUL; - *arg = p + 1; + if (*p != NUL) /* just in case */ + ++p; + *arg = p; return OK; } @@ -5762,10 +4767,7 @@ get_string_tv(arg, rettv, evaluate) * Return OK or FAIL. */ static int -get_lit_string_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; +get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate) { char_u *p; char_u *str; @@ -5774,7 +4776,7 @@ get_lit_string_tv(arg, rettv, evaluate) /* * Find the end of the string, skipping ''. */ - for (p = *arg + 1; *p != NUL; mb_ptr_adv(p)) + for (p = *arg + 1; *p != NUL; MB_PTR_ADV(p)) { if (*p == '\'') { @@ -5824,301 +4826,116 @@ get_lit_string_tv(arg, rettv, evaluate) } /* - * Allocate a variable for a List and fill it from "*arg". - * Return OK or FAIL. + * Return the function name of the partial. */ - static int -get_list_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; + char_u * +partial_name(partial_T *pt) { - list_T *l = NULL; - typval_T tv; - listitem_T *item; - - if (evaluate) - { - l = list_alloc(); - if (l == NULL) - return FAIL; - } - - *arg = skipwhite(*arg + 1); - while (**arg != ']' && **arg != NUL) - { - if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ - goto failret; - if (evaluate) - { - item = listitem_alloc(); - if (item != NULL) - { - item->li_tv = tv; - item->li_tv.v_lock = 0; - list_append(l, item); - } - else - clear_tv(&tv); - } - - if (**arg == ']') - break; - if (**arg != ',') - { - EMSG2(_("E696: Missing comma in List: %s"), *arg); - goto failret; - } - *arg = skipwhite(*arg + 1); - } - - if (**arg != ']') - { - EMSG2(_("E697: Missing end of List ']': %s"), *arg); -failret: - if (evaluate) - list_free(l, TRUE); - return FAIL; - } - - *arg = skipwhite(*arg + 1); - if (evaluate) - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = l; - ++l->lv_refcount; - } - - return OK; + if (pt->pt_name != NULL) + return pt->pt_name; + return pt->pt_func->uf_name; } -/* - * Allocate an empty header for a list. - * Caller should take care of the reference count. - */ - list_T * -list_alloc() + static void +partial_free(partial_T *pt) { - list_T *l; + int i; - l = (list_T *)alloc_clear(sizeof(list_T)); - if (l != NULL) + for (i = 0; i < pt->pt_argc; ++i) + clear_tv(&pt->pt_argv[i]); + vim_free(pt->pt_argv); + dict_unref(pt->pt_dict); + if (pt->pt_name != NULL) { - /* Prepend the list to the list of lists for garbage collection. */ - if (first_list != NULL) - first_list->lv_used_prev = l; - l->lv_used_prev = NULL; - l->lv_used_next = first_list; - first_list = l; + func_unref(pt->pt_name); + vim_free(pt->pt_name); } - return l; -} - -/* - * Allocate an empty list for a return value. - * Returns OK or FAIL. - */ - static int -rettv_list_alloc(rettv) - typval_T *rettv; -{ - list_T *l = list_alloc(); - - if (l == NULL) - return FAIL; - - rettv->vval.v_list = l; - rettv->v_type = VAR_LIST; - ++l->lv_refcount; - return OK; + else + func_ptr_unref(pt->pt_func); + vim_free(pt); } /* - * Unreference a list: decrement the reference count and free it when it + * Unreference a closure: decrement the reference count and free it when it * becomes zero. */ void -list_unref(l) - list_T *l; +partial_unref(partial_T *pt) { - if (l != NULL && --l->lv_refcount <= 0) - list_free(l, TRUE); + if (pt != NULL && --pt->pt_refcount <= 0) + partial_free(pt); } -/* - * Free a list, including all items it points to. - * Ignores the reference count. - */ - void -list_free(l, recurse) - list_T *l; - int recurse; /* Free Lists and Dictionaries recursively. */ +static int tv_equal_recurse_limit; + + static int +func_equal( + typval_T *tv1, + typval_T *tv2, + int ic) /* ignore case */ { - listitem_T *item; + char_u *s1, *s2; + dict_T *d1, *d2; + int a1, a2; + int i; - /* Remove the list from the list of lists for garbage collection. */ - if (l->lv_used_prev == NULL) - first_list = l->lv_used_next; - else - l->lv_used_prev->lv_used_next = l->lv_used_next; - if (l->lv_used_next != NULL) - l->lv_used_next->lv_used_prev = l->lv_used_prev; + /* empty and NULL function name considered the same */ + s1 = tv1->v_type == VAR_FUNC ? tv1->vval.v_string + : partial_name(tv1->vval.v_partial); + if (s1 != NULL && *s1 == NUL) + s1 = NULL; + s2 = tv2->v_type == VAR_FUNC ? tv2->vval.v_string + : partial_name(tv2->vval.v_partial); + if (s2 != NULL && *s2 == NUL) + s2 = NULL; + if (s1 == NULL || s2 == NULL) + { + if (s1 != s2) + return FALSE; + } + else if (STRCMP(s1, s2) != 0) + return FALSE; - for (item = l->lv_first; item != NULL; item = l->lv_first) + /* empty dict and NULL dict is different */ + d1 = tv1->v_type == VAR_FUNC ? NULL : tv1->vval.v_partial->pt_dict; + d2 = tv2->v_type == VAR_FUNC ? NULL : tv2->vval.v_partial->pt_dict; + if (d1 == NULL || d2 == NULL) { - /* Remove the item before deleting it. */ - l->lv_first = item->li_next; - if (recurse || (item->li_tv.v_type != VAR_LIST - && item->li_tv.v_type != VAR_DICT)) - clear_tv(&item->li_tv); - vim_free(item); + if (d1 != d2) + return FALSE; } - vim_free(l); -} + else if (!dict_equal(d1, d2, ic, TRUE)) + return FALSE; -/* - * Allocate a list item. - */ - listitem_T * -listitem_alloc() -{ - return (listitem_T *)alloc(sizeof(listitem_T)); -} + /* empty list and no list considered the same */ + a1 = tv1->v_type == VAR_FUNC ? 0 : tv1->vval.v_partial->pt_argc; + a2 = tv2->v_type == VAR_FUNC ? 0 : tv2->vval.v_partial->pt_argc; + if (a1 != a2) + return FALSE; + for (i = 0; i < a1; ++i) + if (!tv_equal(tv1->vval.v_partial->pt_argv + i, + tv2->vval.v_partial->pt_argv + i, ic, TRUE)) + return FALSE; -/* - * Free a list item. Also clears the value. Does not notify watchers. - */ - void -listitem_free(item) - listitem_T *item; -{ - clear_tv(&item->li_tv); - vim_free(item); + return TRUE; } /* - * Remove a list item from a List and free it. Also clears the value. + * Return TRUE if "tv1" and "tv2" have the same value. + * Compares the items just like "==" would compare them, but strings and + * numbers are different. Floats and numbers are also different. */ - void -listitem_remove(l, item) - list_T *l; - listitem_T *item; + int +tv_equal( + typval_T *tv1, + typval_T *tv2, + int ic, /* ignore case */ + int recursive) /* TRUE when used recursively */ { - vimlist_remove(l, item, item); - listitem_free(item); -} - -/* - * Get the number of items in a list. - */ - static long -list_len(l) - list_T *l; -{ - if (l == NULL) - return 0L; - return l->lv_len; -} - -/* - * Return TRUE when two lists have exactly the same values. - */ - static int -list_equal(l1, l2, ic, recursive) - list_T *l1; - list_T *l2; - int ic; /* ignore case for strings */ - int recursive; /* TRUE when used recursively */ -{ - listitem_T *item1, *item2; - - if (l1 == NULL || l2 == NULL) - return FALSE; - if (l1 == l2) - return TRUE; - if (list_len(l1) != list_len(l2)) - return FALSE; - - for (item1 = l1->lv_first, item2 = l2->lv_first; - item1 != NULL && item2 != NULL; - item1 = item1->li_next, item2 = item2->li_next) - if (!tv_equal(&item1->li_tv, &item2->li_tv, ic, recursive)) - return FALSE; - return item1 == NULL && item2 == NULL; -} - -#if defined(FEAT_RUBY) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ - || defined(FEAT_MZSCHEME) || defined(FEAT_LUA) \ - || defined(FEAT_GUI_MACVIM) || defined(PROTO) -/* - * Return the dictitem that an entry in a hashtable points to. - */ - dictitem_T * -dict_lookup(hi) - hashitem_T *hi; -{ - return HI2DI(hi); -} -#endif - -/* - * Return TRUE when two dictionaries have exactly the same key/values. - */ - static int -dict_equal(d1, d2, ic, recursive) - dict_T *d1; - dict_T *d2; - int ic; /* ignore case for strings */ - int recursive; /* TRUE when used recursively */ -{ - hashitem_T *hi; - dictitem_T *item2; - int todo; - - if (d1 == NULL || d2 == NULL) - return FALSE; - if (d1 == d2) - return TRUE; - if (dict_len(d1) != dict_len(d2)) - return FALSE; - - todo = (int)d1->dv_hashtab.ht_used; - for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - item2 = dict_find(d2, hi->hi_key, -1); - if (item2 == NULL) - return FALSE; - if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic, recursive)) - return FALSE; - --todo; - } - } - return TRUE; -} - -static int tv_equal_recurse_limit; - -/* - * Return TRUE if "tv1" and "tv2" have the same value. - * Compares the items just like "==" would compare them, but strings and - * numbers are different. Floats and numbers are also different. - */ - static int -tv_equal(tv1, tv2, ic, recursive) - typval_T *tv1; - typval_T *tv2; - int ic; /* ignore case */ - int recursive; /* TRUE when used recursively */ -{ - char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; - char_u *s1, *s2; - static int recursive_cnt = 0; /* catch recursive loops */ - int r; - - if (tv1->v_type != tv2->v_type) - return FALSE; + char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; + char_u *s1, *s2; + static int recursive_cnt = 0; /* catch recursive loops */ + int r; /* Catch lists and dicts that have an endless loop by limiting * recursiveness to a limit. We guess they are equal then. @@ -6134,6 +4951,22 @@ tv_equal(tv1, tv2, ic, recursive) return TRUE; } + /* For VAR_FUNC and VAR_PARTIAL compare the function name, bound dict and + * arguments. */ + if ((tv1->v_type == VAR_FUNC + || (tv1->v_type == VAR_PARTIAL && tv1->vval.v_partial != NULL)) + && (tv2->v_type == VAR_FUNC + || (tv2->v_type == VAR_PARTIAL && tv2->vval.v_partial != NULL))) + { + ++recursive_cnt; + r = func_equal(tv1, tv2, ic); + --recursive_cnt; + return r; + } + + if (tv1->v_type != tv2->v_type) + return FALSE; + switch (tv1->v_type) { case VAR_LIST: @@ -6148,17909 +4981,3538 @@ tv_equal(tv1, tv2, ic, recursive) --recursive_cnt; return r; - case VAR_FUNC: - return (tv1->vval.v_string != NULL - && tv2->vval.v_string != NULL - && STRCMP(tv1->vval.v_string, tv2->vval.v_string) == 0); - case VAR_NUMBER: return tv1->vval.v_number == tv2->vval.v_number; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - return tv1->vval.v_float == tv2->vval.v_float; -#endif - case VAR_STRING: s1 = get_tv_string_buf(tv1, buf1); s2 = get_tv_string_buf(tv2, buf2); return ((ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2)) == 0); + + case VAR_SPECIAL: + return tv1->vval.v_number == tv2->vval.v_number; + + case VAR_FLOAT: +#ifdef FEAT_FLOAT + return tv1->vval.v_float == tv2->vval.v_float; +#endif + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + return tv1->vval.v_job == tv2->vval.v_job; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + return tv1->vval.v_channel == tv2->vval.v_channel; +#endif + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_UNKNOWN: + break; } - EMSG2(_(e_intern2), "tv_equal()"); - return TRUE; + /* VAR_UNKNOWN can be the result of a invalid expression, let's say it + * does not equal anything, not even itself. */ + return FALSE; } /* - * Locate item with index "n" in list "l" and return it. - * A negative index is counted from the end; -1 is the last item. - * Returns NULL when "n" is out of range. + * Return the next (unique) copy ID. + * Used for serializing nested structures. */ - listitem_T * -list_find(l, n) - list_T *l; - long n; + int +get_copyID(void) { - listitem_T *item; - long idx; - - if (l == NULL) - return NULL; + current_copyID += COPYID_INC; + return current_copyID; +} - /* Negative index is relative to the end. */ - if (n < 0) - n = l->lv_len + n; +/* + * Garbage collection for lists and dictionaries. + * + * We use reference counts to be able to free most items right away when they + * are no longer used. But for composite items it's possible that it becomes + * unused while the reference count is > 0: When there is a recursive + * reference. Example: + * :let l = [1, 2, 3] + * :let d = {9: l} + * :let l[1] = d + * + * Since this is quite unusual we handle this with garbage collection: every + * once in a while find out which lists and dicts are not referenced from any + * variable. + * + * Here is a good reference text about garbage collection (refers to Python + * but it applies to all reference-counting mechanisms): + * http://python.ca/nas/python/gc/ + */ - /* Check for index out of range. */ - if (n < 0 || n >= l->lv_len) - return NULL; +/* + * Do garbage collection for lists and dicts. + * When "testing" is TRUE this is called from test_garbagecollect_now(). + * Return TRUE if some memory was freed. + */ + int +garbage_collect(int testing) +{ + int copyID; + int abort = FALSE; + buf_T *buf; + win_T *wp; + int i; + int did_free = FALSE; + tabpage_T *tp; - /* When there is a cached index may start search from there. */ - if (l->lv_idx_item != NULL) - { - if (n < l->lv_idx / 2) - { - /* closest to the start of the list */ - item = l->lv_first; - idx = 0; - } - else if (n > (l->lv_idx + l->lv_len) / 2) - { - /* closest to the end of the list */ - item = l->lv_last; - idx = l->lv_len - 1; - } - else - { - /* closest to the cached index */ - item = l->lv_idx_item; - idx = l->lv_idx; - } - } - else + if (!testing) { - if (n < l->lv_len / 2) - { - /* closest to the start of the list */ - item = l->lv_first; - idx = 0; - } - else - { - /* closest to the end of the list */ - item = l->lv_last; - idx = l->lv_len - 1; - } + /* Only do this once. */ + want_garbage_collect = FALSE; + may_garbage_collect = FALSE; + garbage_collect_at_exit = FALSE; } - while (n > idx) + /* We advance by two because we add one for items referenced through + * previous_funccal. */ + copyID = get_copyID(); + + /* + * 1. Go through all accessible variables and mark all lists and dicts + * with copyID. + */ + + /* Don't free variables in the previous_funccal list unless they are only + * referenced through previous_funccal. This must be first, because if + * the item is referenced elsewhere the funccal must not be freed. */ + abort = abort || set_ref_in_previous_funccal(copyID); + + /* script-local variables */ + for (i = 1; i <= ga_scripts.ga_len; ++i) + abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL); + + /* buffer-local variables */ + FOR_ALL_BUFFERS(buf) + abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID, + NULL, NULL); + + /* window-local variables */ + FOR_ALL_TAB_WINDOWS(tp, wp) + abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID, + NULL, NULL); + if (aucmd_win != NULL) + abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID, + NULL, NULL); + + /* tabpage-local variables */ + FOR_ALL_TABPAGES(tp) + abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID, + NULL, NULL); + /* global variables */ + abort = abort || set_ref_in_ht(&globvarht, copyID, NULL); + + /* function-local variables */ + abort = abort || set_ref_in_call_stack(copyID); + + /* named functions (matters for closures) */ + abort = abort || set_ref_in_functions(copyID); + + /* function call arguments, if v:testing is set. */ + abort = abort || set_ref_in_func_args(copyID); + + /* v: vars */ + abort = abort || set_ref_in_ht(&vimvarht, copyID, NULL); + +#ifdef FEAT_LUA + abort = abort || set_ref_in_lua(copyID); +#endif + +#ifdef FEAT_PYTHON + abort = abort || set_ref_in_python(copyID); +#endif + +#ifdef FEAT_PYTHON3 + abort = abort || set_ref_in_python3(copyID); +#endif + +#ifdef FEAT_JOB_CHANNEL + abort = abort || set_ref_in_channel(copyID); + abort = abort || set_ref_in_job(copyID); +#endif +#ifdef FEAT_NETBEANS_INTG + abort = abort || set_ref_in_nb_channel(copyID); +#endif + +#ifdef FEAT_TIMERS + abort = abort || set_ref_in_timer(copyID); +#endif + +#ifdef FEAT_QUICKFIX + abort = abort || set_ref_in_quickfix(copyID); +#endif + +#ifdef FEAT_TERMINAL + abort = abort || set_ref_in_term(copyID); +#endif + + if (!abort) { - /* search forward */ - item = item->li_next; - ++idx; + /* + * 2. Free lists and dictionaries that are not referenced. + */ + did_free = free_unref_items(copyID); + + /* + * 3. Check if any funccal can be freed now. + * This may call us back recursively. + */ + free_unref_funccal(copyID, testing); } - while (n < idx) + else if (p_verbose > 0) { - /* search backward */ - item = item->li_prev; - --idx; + verb_msg((char_u *)_("Not enough memory to set references, garbage collection aborted!")); } - /* cache the used index */ - l->lv_idx = idx; - l->lv_idx_item = item; - - return item; + return did_free; } /* - * Get list item "l[idx]" as a number. + * Free lists, dictionaries, channels and jobs that are no longer referenced. */ - static long -list_find_nr(l, idx, errorp) - list_T *l; - long idx; - int *errorp; /* set to TRUE when something wrong */ + static int +free_unref_items(int copyID) { - listitem_T *li; + int did_free = FALSE; - li = list_find(l, idx); - if (li == NULL) - { - if (errorp != NULL) - *errorp = TRUE; - return -1L; - } - return get_tv_number_chk(&li->li_tv, errorp); + /* Let all "free" functions know that we are here. This means no + * dictionaries, lists, channels or jobs are to be freed, because we will + * do that here. */ + in_free_unref_items = TRUE; + + /* + * PASS 1: free the contents of the items. We don't free the items + * themselves yet, so that it is possible to decrement refcount counters + */ + + /* Go through the list of dicts and free items without the copyID. */ + did_free |= dict_free_nonref(copyID); + + /* Go through the list of lists and free items without the copyID. */ + did_free |= list_free_nonref(copyID); + +#ifdef FEAT_JOB_CHANNEL + /* Go through the list of jobs and free items without the copyID. This + * must happen before doing channels, because jobs refer to channels, but + * the reference from the channel to the job isn't tracked. */ + did_free |= free_unused_jobs_contents(copyID, COPYID_MASK); + + /* Go through the list of channels and free items without the copyID. */ + did_free |= free_unused_channels_contents(copyID, COPYID_MASK); +#endif + + /* + * PASS 2: free the items themselves. + */ + dict_free_items(copyID); + list_free_items(copyID); + +#ifdef FEAT_JOB_CHANNEL + /* Go through the list of jobs and free items without the copyID. This + * must happen before doing channels, because jobs refer to channels, but + * the reference from the channel to the job isn't tracked. */ + free_unused_jobs(copyID, COPYID_MASK); + + /* Go through the list of channels and free items without the copyID. */ + free_unused_channels(copyID, COPYID_MASK); +#endif + + in_free_unref_items = FALSE; + + return did_free; } /* - * Get list item "l[idx - 1]" as a string. Returns NULL for failure. + * Mark all lists and dicts referenced through hashtab "ht" with "copyID". + * "list_stack" is used to add lists to be marked. Can be NULL. + * + * Returns TRUE if setting references failed somehow. */ - char_u * -list_find_str(l, idx) - list_T *l; - long idx; + int +set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack) { - listitem_T *li; + int todo; + int abort = FALSE; + hashitem_T *hi; + hashtab_T *cur_ht; + ht_stack_T *ht_stack = NULL; + ht_stack_T *tempitem; - li = list_find(l, idx - 1); - if (li == NULL) + cur_ht = ht; + for (;;) { - EMSGN(_(e_listidx), idx); - return NULL; + if (!abort) + { + /* Mark each item in the hashtab. If the item contains a hashtab + * it is added to ht_stack, if it contains a list it is added to + * list_stack. */ + todo = (int)cur_ht->ht_used; + for (hi = cur_ht->ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + --todo; + abort = abort || set_ref_in_item(&HI2DI(hi)->di_tv, copyID, + &ht_stack, list_stack); + } + } + + if (ht_stack == NULL) + break; + + /* take an item from the stack */ + cur_ht = ht_stack->ht; + tempitem = ht_stack; + ht_stack = ht_stack->prev; + free(tempitem); } - return get_tv_string(&li->li_tv); + + return abort; } /* - * Locate "item" list "l" and return its index. - * Returns -1 when "item" is not in the list. + * Mark all lists and dicts referenced through list "l" with "copyID". + * "ht_stack" is used to add hashtabs to be marked. Can be NULL. + * + * Returns TRUE if setting references failed somehow. */ - static long -list_idx_of_item(l, item) - list_T *l; - listitem_T *item; + int +set_ref_in_list(list_T *l, int copyID, ht_stack_T **ht_stack) { - long idx = 0; - listitem_T *li; + listitem_T *li; + int abort = FALSE; + list_T *cur_l; + list_stack_T *list_stack = NULL; + list_stack_T *tempitem; - if (l == NULL) - return -1; - idx = 0; - for (li = l->lv_first; li != NULL && li != item; li = li->li_next) - ++idx; - if (li == NULL) - return -1; - return idx; -} - -/* - * Append item "item" to the end of list "l". - */ - void -list_append(l, item) - list_T *l; - listitem_T *item; -{ - if (l->lv_last == NULL) - { - /* empty list */ - l->lv_first = item; - l->lv_last = item; - item->li_prev = NULL; - } - else + cur_l = l; + for (;;) { - l->lv_last->li_next = item; - item->li_prev = l->lv_last; - l->lv_last = item; - } - ++l->lv_len; - item->li_next = NULL; -} - -/* - * Append typval_T "tv" to the end of list "l". - * Return FAIL when out of memory. - */ - int -list_append_tv(l, tv) - list_T *l; - typval_T *tv; -{ - listitem_T *li = listitem_alloc(); - - if (li == NULL) - return FAIL; - copy_tv(tv, &li->li_tv); - list_append(l, li); - return OK; -} - -/* - * Add a dictionary to a list. Used by getqflist(). - * Return FAIL when out of memory. - */ - int -list_append_dict(list, dict) - list_T *list; - dict_T *dict; -{ - listitem_T *li = listitem_alloc(); - - if (li == NULL) - return FAIL; - li->li_tv.v_type = VAR_DICT; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_dict = dict; - list_append(list, li); - ++dict->dv_refcount; - return OK; -} - -/* - * Make a copy of "str" and append it as an item to list "l". - * When "len" >= 0 use "str[len]". - * Returns FAIL when out of memory. - */ - int -list_append_string(l, str, len) - list_T *l; - char_u *str; - int len; -{ - listitem_T *li = listitem_alloc(); - - if (li == NULL) - return FAIL; - list_append(l, li); - li->li_tv.v_type = VAR_STRING; - li->li_tv.v_lock = 0; - if (str == NULL) - li->li_tv.vval.v_string = NULL; - else if ((li->li_tv.vval.v_string = (len >= 0 ? vim_strnsave(str, len) - : vim_strsave(str))) == NULL) - return FAIL; - return OK; -} + if (!abort) + /* Mark each item in the list. If the item contains a hashtab + * it is added to ht_stack, if it contains a list it is added to + * list_stack. */ + for (li = cur_l->lv_first; !abort && li != NULL; li = li->li_next) + abort = abort || set_ref_in_item(&li->li_tv, copyID, + ht_stack, &list_stack); + if (list_stack == NULL) + break; -/* - * Append "n" to list "l". - * Returns FAIL when out of memory. - */ - static int -list_append_number(l, n) - list_T *l; - varnumber_T n; -{ - listitem_T *li; + /* take an item from the stack */ + cur_l = list_stack->list; + tempitem = list_stack; + list_stack = list_stack->prev; + free(tempitem); + } - li = listitem_alloc(); - if (li == NULL) - return FAIL; - li->li_tv.v_type = VAR_NUMBER; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_number = n; - list_append(l, li); - return OK; + return abort; } /* - * Insert typval_T "tv" in list "l" before "item". - * If "item" is NULL append at the end. - * Return FAIL when out of memory. + * Mark all lists and dicts referenced through typval "tv" with "copyID". + * "list_stack" is used to add lists to be marked. Can be NULL. + * "ht_stack" is used to add hashtabs to be marked. Can be NULL. + * + * Returns TRUE if setting references failed somehow. */ int -list_insert_tv(l, tv, item) - list_T *l; - typval_T *tv; - listitem_T *item; +set_ref_in_item( + typval_T *tv, + int copyID, + ht_stack_T **ht_stack, + list_stack_T **list_stack) { - listitem_T *ni = listitem_alloc(); - - if (ni == NULL) - return FAIL; - copy_tv(tv, &ni->li_tv); - list_insert(l, ni, item); - return OK; -} + int abort = FALSE; - void -list_insert(l, ni, item) - list_T *l; - listitem_T *ni; - listitem_T *item; -{ - if (item == NULL) - /* Append new item at end of list. */ - list_append(l, ni); - else + if (tv->v_type == VAR_DICT) { - /* Insert new item before existing item. */ - ni->li_prev = item->li_prev; - ni->li_next = item; - if (item->li_prev == NULL) + dict_T *dd = tv->vval.v_dict; + + if (dd != NULL && dd->dv_copyID != copyID) { - l->lv_first = ni; - ++l->lv_idx; + /* Didn't see this dict yet. */ + dd->dv_copyID = copyID; + if (ht_stack == NULL) + { + abort = set_ref_in_ht(&dd->dv_hashtab, copyID, list_stack); + } + else + { + ht_stack_T *newitem = (ht_stack_T*)malloc(sizeof(ht_stack_T)); + if (newitem == NULL) + abort = TRUE; + else + { + newitem->ht = &dd->dv_hashtab; + newitem->prev = *ht_stack; + *ht_stack = newitem; + } + } } - else + } + else if (tv->v_type == VAR_LIST) + { + list_T *ll = tv->vval.v_list; + + if (ll != NULL && ll->lv_copyID != copyID) { - item->li_prev->li_next = ni; - l->lv_idx_item = NULL; + /* Didn't see this list yet. */ + ll->lv_copyID = copyID; + if (list_stack == NULL) + { + abort = set_ref_in_list(ll, copyID, ht_stack); + } + else + { + list_stack_T *newitem = (list_stack_T*)malloc( + sizeof(list_stack_T)); + if (newitem == NULL) + abort = TRUE; + else + { + newitem->list = ll; + newitem->prev = *list_stack; + *list_stack = newitem; + } + } } - item->li_prev = ni; - ++l->lv_len; } -} - -/* - * Extend "l1" with "l2". - * If "bef" is NULL append at the end, otherwise insert before this item. - * Returns FAIL when out of memory. - */ - static int -list_extend(l1, l2, bef) - list_T *l1; - list_T *l2; - listitem_T *bef; -{ - listitem_T *item; - int todo = l2->lv_len; - - /* We also quit the loop when we have inserted the original item count of - * the list, avoid a hang when we extend a list with itself. */ - for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next) - if (list_insert_tv(l1, &item->li_tv, bef) == FAIL) - return FAIL; - return OK; -} - -/* - * Concatenate lists "l1" and "l2" into a new list, stored in "tv". - * Return FAIL when out of memory. - */ - static int -list_concat(l1, l2, tv) - list_T *l1; - list_T *l2; - typval_T *tv; -{ - list_T *l; - - if (l1 == NULL || l2 == NULL) - return FAIL; - - /* make a copy of the first list. */ - l = list_copy(l1, FALSE, 0); - if (l == NULL) - return FAIL; - tv->v_type = VAR_LIST; - tv->vval.v_list = l; + else if (tv->v_type == VAR_FUNC) + { + abort = set_ref_in_func(tv->vval.v_string, NULL, copyID); + } + else if (tv->v_type == VAR_PARTIAL) + { + partial_T *pt = tv->vval.v_partial; + int i; - /* append all items from the second list */ - return list_extend(l, l2, NULL); -} + /* A partial does not have a copyID, because it cannot contain itself. + */ + if (pt != NULL) + { + abort = set_ref_in_func(pt->pt_name, pt->pt_func, copyID); -/* - * Make a copy of list "orig". Shallow if "deep" is FALSE. - * The refcount of the new list is set to 1. - * See item_copy() for "copyID". - * Returns NULL when out of memory. - */ - static list_T * -list_copy(orig, deep, copyID) - list_T *orig; - int deep; - int copyID; -{ - list_T *copy; - listitem_T *item; - listitem_T *ni; + if (pt->pt_dict != NULL) + { + typval_T dtv; - if (orig == NULL) - return NULL; + dtv.v_type = VAR_DICT; + dtv.vval.v_dict = pt->pt_dict; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } - copy = list_alloc(); - if (copy != NULL) + for (i = 0; i < pt->pt_argc; ++i) + abort = abort || set_ref_in_item(&pt->pt_argv[i], copyID, + ht_stack, list_stack); + } + } +#ifdef FEAT_JOB_CHANNEL + else if (tv->v_type == VAR_JOB) { - if (copyID != 0) + job_T *job = tv->vval.v_job; + typval_T dtv; + + if (job != NULL && job->jv_copyID != copyID) { - /* Do this before adding the items, because one of the items may - * refer back to this list. */ - orig->lv_copyID = copyID; - orig->lv_copylist = copy; + job->jv_copyID = copyID; + if (job->jv_channel != NULL) + { + dtv.v_type = VAR_CHANNEL; + dtv.vval.v_channel = job->jv_channel; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + if (job->jv_exit_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = job->jv_exit_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } } - for (item = orig->lv_first; item != NULL && !got_int; - item = item->li_next) + } + else if (tv->v_type == VAR_CHANNEL) + { + channel_T *ch =tv->vval.v_channel; + ch_part_T part; + typval_T dtv; + jsonq_T *jq; + cbq_T *cq; + + if (ch != NULL && ch->ch_copyID != copyID) { - ni = listitem_alloc(); - if (ni == NULL) - break; - if (deep) + ch->ch_copyID = copyID; + for (part = PART_SOCK; part < PART_COUNT; ++part) { - if (item_copy(&item->li_tv, &ni->li_tv, deep, copyID) == FAIL) + for (jq = ch->ch_part[part].ch_json_head.jq_next; jq != NULL; + jq = jq->jq_next) + set_ref_in_item(jq->jq_value, copyID, ht_stack, list_stack); + for (cq = ch->ch_part[part].ch_cb_head.cq_next; cq != NULL; + cq = cq->cq_next) + if (cq->cq_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = cq->cq_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + if (ch->ch_part[part].ch_partial != NULL) { - vim_free(ni); - break; + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = ch->ch_part[part].ch_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } } - else - copy_tv(&item->li_tv, &ni->li_tv); - list_append(copy, ni); - } - ++copy->lv_refcount; - if (item != NULL) - { - list_unref(copy); - copy = NULL; + if (ch->ch_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = ch->ch_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + if (ch->ch_close_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = ch->ch_close_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } } } - - return copy; +#endif + return abort; } -/* - * Remove items "item" to "item2" from list "l". - * Does not free the listitem or the value! - * This used to be called list_remove, but that conflicts with a Sun header - * file. - */ - void -vimlist_remove(l, item, item2) - list_T *l; - listitem_T *item; - listitem_T *item2; + static char * +get_var_special_name(int nr) { - listitem_T *ip; - - /* notify watchers */ - for (ip = item; ip != NULL; ip = ip->li_next) + switch (nr) { - --l->lv_len; - list_fix_watch(l, ip); - if (ip == item2) - break; + case VVAL_FALSE: return "v:false"; + case VVAL_TRUE: return "v:true"; + case VVAL_NONE: return "v:none"; + case VVAL_NULL: return "v:null"; } - - if (item2->li_next == NULL) - l->lv_last = item->li_prev; - else - item2->li_next->li_prev = item->li_prev; - if (item->li_prev == NULL) - l->lv_first = item2->li_next; - else - item->li_prev->li_next = item2->li_next; - l->lv_idx_item = NULL; + internal_error("get_var_special_name()"); + return "42"; } /* - * Return an allocated string with the string representation of a list. + * Return a string with the string representation of a variable. + * If the memory is allocated "tofree" is set to it, otherwise NULL. + * "numbuf" is used for a number. + * When "copyID" is not NULL replace recursive lists and dicts with "...". + * When both "echo_style" and "composite_val" are FALSE, put quotes around + * stings as "string()", otherwise does not put quotes around strings, as + * ":echo" displays values. + * When "restore_copyID" is FALSE, repeated items in dictionaries and lists + * are replaced with "...". * May return NULL. */ - static char_u * -list2string(tv, copyID) - typval_T *tv; - int copyID; + char_u * +echo_string_core( + typval_T *tv, + char_u **tofree, + char_u *numbuf, + int copyID, + int echo_style, + int restore_copyID, + int composite_val) { - garray_T ga; + static int recurse = 0; + char_u *r = NULL; - if (tv->vval.v_list == NULL) - return NULL; - ga_init2(&ga, (int)sizeof(char), 80); - ga_append(&ga, '['); - if (list_join(&ga, tv->vval.v_list, (char_u *)", ", FALSE, copyID) == FAIL) + if (recurse >= DICT_MAXNEST) { - vim_free(ga.ga_data); - return NULL; + if (!did_echo_string_emsg) + { + /* Only give this message once for a recursive call to avoid + * flooding the user with errors. And stop iterating over lists + * and dicts. */ + did_echo_string_emsg = TRUE; + EMSG(_("E724: variable nested too deep for displaying")); + } + *tofree = NULL; + return (char_u *)"{E724}"; } - ga_append(&ga, ']'); - ga_append(&ga, NUL); - return (char_u *)ga.ga_data; -} - -typedef struct join_S { - char_u *s; - char_u *tofree; -} join_T; - - static int -list_join_inner(gap, l, sep, echo_style, copyID, join_gap) - garray_T *gap; /* to store the result in */ - list_T *l; - char_u *sep; - int echo_style; - int copyID; - garray_T *join_gap; /* to keep each list item string */ -{ - int i; - join_T *p; - int len; - int sumlen = 0; - int first = TRUE; - char_u *tofree; - char_u numbuf[NUMBUFLEN]; - listitem_T *item; - char_u *s; + ++recurse; - /* Stringify each item in the list. */ - for (item = l->lv_first; item != NULL && !got_int; item = item->li_next) + switch (tv->v_type) { - if (echo_style) - s = echo_string(&item->li_tv, &tofree, numbuf, copyID); - else - s = tv2string(&item->li_tv, &tofree, numbuf, copyID); - if (s == NULL) - return FAIL; - - len = (int)STRLEN(s); - sumlen += len; - - ga_grow(join_gap, 1); - p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++); - if (tofree != NULL || s != numbuf) - { - p->s = s; - p->tofree = tofree; - } - else - { - p->s = vim_strnsave(s, len); - p->tofree = p->s; - } + case VAR_STRING: + if (echo_style && !composite_val) + { + *tofree = NULL; + r = tv->vval.v_string; + if (r == NULL) + r = (char_u *)""; + } + else + { + *tofree = string_quote(tv->vval.v_string, FALSE); + r = *tofree; + } + break; - line_breakcheck(); - if (did_echo_string_emsg) /* recursion error, bail out */ + case VAR_FUNC: + if (echo_style) + { + *tofree = NULL; + r = tv->vval.v_string; + } + else + { + *tofree = string_quote(tv->vval.v_string, TRUE); + r = *tofree; + } break; - } - /* Allocate result buffer with its total size, avoid re-allocation and - * multiple copy operations. Add 2 for a tailing ']' and NUL. */ - if (join_gap->ga_len >= 2) - sumlen += (int)STRLEN(sep) * (join_gap->ga_len - 1); - if (ga_grow(gap, sumlen + 2) == FAIL) - return FAIL; + case VAR_PARTIAL: + { + partial_T *pt = tv->vval.v_partial; + char_u *fname = string_quote(pt == NULL ? NULL + : partial_name(pt), FALSE); + garray_T ga; + int i; + char_u *tf; - for (i = 0; i < join_gap->ga_len && !got_int; ++i) - { - if (first) - first = FALSE; - else - ga_concat(gap, sep); - p = ((join_T *)join_gap->ga_data) + i; + ga_init2(&ga, 1, 100); + ga_concat(&ga, (char_u *)"function("); + if (fname != NULL) + { + ga_concat(&ga, fname); + vim_free(fname); + } + if (pt != NULL && pt->pt_argc > 0) + { + ga_concat(&ga, (char_u *)", ["); + for (i = 0; i < pt->pt_argc; ++i) + { + if (i > 0) + ga_concat(&ga, (char_u *)", "); + ga_concat(&ga, + tv2string(&pt->pt_argv[i], &tf, numbuf, copyID)); + vim_free(tf); + } + ga_concat(&ga, (char_u *)"]"); + } + if (pt != NULL && pt->pt_dict != NULL) + { + typval_T dtv; - if (p->s != NULL) - ga_concat(gap, p->s); - line_breakcheck(); - } + ga_concat(&ga, (char_u *)", "); + dtv.v_type = VAR_DICT; + dtv.vval.v_dict = pt->pt_dict; + ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID)); + vim_free(tf); + } + ga_concat(&ga, (char_u *)")"); - return OK; + *tofree = ga.ga_data; + r = *tofree; + break; + } + + case VAR_LIST: + if (tv->vval.v_list == NULL) + { + *tofree = NULL; + r = NULL; + } + else if (copyID != 0 && tv->vval.v_list->lv_copyID == copyID + && tv->vval.v_list->lv_len > 0) + { + *tofree = NULL; + r = (char_u *)"[...]"; + } + else + { + int old_copyID = tv->vval.v_list->lv_copyID; + + tv->vval.v_list->lv_copyID = copyID; + *tofree = list2string(tv, copyID, restore_copyID); + if (restore_copyID) + tv->vval.v_list->lv_copyID = old_copyID; + r = *tofree; + } + break; + + case VAR_DICT: + if (tv->vval.v_dict == NULL) + { + *tofree = NULL; + r = NULL; + } + else if (copyID != 0 && tv->vval.v_dict->dv_copyID == copyID + && tv->vval.v_dict->dv_hashtab.ht_used != 0) + { + *tofree = NULL; + r = (char_u *)"{...}"; + } + else + { + int old_copyID = tv->vval.v_dict->dv_copyID; + tv->vval.v_dict->dv_copyID = copyID; + *tofree = dict2string(tv, copyID, restore_copyID); + if (restore_copyID) + tv->vval.v_dict->dv_copyID = old_copyID; + r = *tofree; + } + break; + + case VAR_NUMBER: + case VAR_UNKNOWN: + *tofree = NULL; + r = get_tv_string_buf(tv, numbuf); + break; + + case VAR_JOB: + case VAR_CHANNEL: + *tofree = NULL; + r = get_tv_string_buf(tv, numbuf); + if (composite_val) + { + *tofree = string_quote(r, FALSE); + r = *tofree; + } + break; + + case VAR_FLOAT: +#ifdef FEAT_FLOAT + *tofree = NULL; + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); + r = numbuf; + break; +#endif + + case VAR_SPECIAL: + *tofree = NULL; + r = (char_u *)get_var_special_name(tv->vval.v_number); + break; + } + + if (--recurse == 0) + did_echo_string_emsg = FALSE; + return r; } /* - * Join list "l" into a string in "*gap", using separator "sep". - * When "echo_style" is TRUE use String as echoed, otherwise as inside a List. - * Return FAIL or OK. + * Return a string with the string representation of a variable. + * If the memory is allocated "tofree" is set to it, otherwise NULL. + * "numbuf" is used for a number. + * Does not put quotes around strings, as ":echo" displays values. + * When "copyID" is not NULL replace recursive lists and dicts with "...". + * May return NULL. */ - static int -list_join(gap, l, sep, echo_style, copyID) - garray_T *gap; - list_T *l; - char_u *sep; - int echo_style; - int copyID; + char_u * +echo_string( + typval_T *tv, + char_u **tofree, + char_u *numbuf, + int copyID) { - garray_T join_ga; - int retval; - join_T *p; - int i; + return echo_string_core(tv, tofree, numbuf, copyID, TRUE, FALSE, FALSE); +} + +/* + * Return a string with the string representation of a variable. + * If the memory is allocated "tofree" is set to it, otherwise NULL. + * "numbuf" is used for a number. + * Puts quotes around strings, so that they can be parsed back by eval(). + * May return NULL. + */ + char_u * +tv2string( + typval_T *tv, + char_u **tofree, + char_u *numbuf, + int copyID) +{ + return echo_string_core(tv, tofree, numbuf, copyID, FALSE, TRUE, FALSE); +} - ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len); - retval = list_join_inner(gap, l, sep, echo_style, copyID, &join_ga); +/* + * Return string "str" in ' quotes, doubling ' characters. + * If "str" is NULL an empty string is assumed. + * If "function" is TRUE make it function('string'). + */ + char_u * +string_quote(char_u *str, int function) +{ + unsigned len; + char_u *p, *r, *s; - /* Dispose each item in join_ga. */ - if (join_ga.ga_data != NULL) + len = (function ? 13 : 3); + if (str != NULL) + { + len += (unsigned)STRLEN(str); + for (p = str; *p != NUL; MB_PTR_ADV(p)) + if (*p == '\'') + ++len; + } + s = r = alloc(len); + if (r != NULL) { - p = (join_T *)join_ga.ga_data; - for (i = 0; i < join_ga.ga_len; ++i) + if (function) { - vim_free(p->tofree); - ++p; + STRCPY(r, "function('"); + r += 10; } - ga_clear(&join_ga); + else + *r++ = '\''; + if (str != NULL) + for (p = str; *p != NUL; ) + { + if (*p == '\'') + *r++ = '\''; + MB_COPY_CHAR(p, r); + } + *r++ = '\''; + if (function) + *r++ = ')'; + *r++ = NUL; } - - return retval; + return s; } +#if defined(FEAT_FLOAT) || defined(PROTO) /* - * Garbage collection for lists and dictionaries. - * - * We use reference counts to be able to free most items right away when they - * are no longer used. But for composite items it's possible that it becomes - * unused while the reference count is > 0: When there is a recursive - * reference. Example: - * :let l = [1, 2, 3] - * :let d = {9: l} - * :let l[1] = d - * - * Since this is quite unusual we handle this with garbage collection: every - * once in a while find out which lists and dicts are not referenced from any - * variable. - * - * Here is a good reference text about garbage collection (refers to Python - * but it applies to all reference-counting mechanisms): - * http://python.ca/nas/python/gc/ - */ - -/* - * Do garbage collection for lists and dicts. - * Return TRUE if some memory was freed. + * Convert the string "text" to a floating point number. + * This uses strtod(). setlocale(LC_NUMERIC, "C") has been used to make sure + * this always uses a decimal point. + * Returns the length of the text that was consumed. */ int -garbage_collect() +string2float( + char_u *text, + float_T *value) /* result stored here */ { - int copyID; - buf_T *buf; - win_T *wp; - int i; - funccall_T *fc, **pfc; - int did_free; - int did_free_funccal = FALSE; -#ifdef FEAT_WINDOWS - tabpage_T *tp; -#endif - - /* Only do this once. */ - want_garbage_collect = FALSE; - may_garbage_collect = FALSE; - garbage_collect_at_exit = FALSE; - - /* We advance by two because we add one for items referenced through - * previous_funccal. */ - current_copyID += COPYID_INC; - copyID = current_copyID; - - /* - * 1. Go through all accessible variables and mark all lists and dicts - * with copyID. - */ + char *s = (char *)text; + float_T f; - /* Don't free variables in the previous_funccal list unless they are only - * referenced through previous_funccal. This must be first, because if - * the item is referenced elsewhere the funccal must not be freed. */ - for (fc = previous_funccal; fc != NULL; fc = fc->caller) + /* MS-Windows does not deal with "inf" and "nan" properly. */ + if (STRNICMP(text, "inf", 3) == 0) { - set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1); - set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1); + *value = INFINITY; + return 3; } - - /* script-local variables */ - for (i = 1; i <= ga_scripts.ga_len; ++i) - set_ref_in_ht(&SCRIPT_VARS(i), copyID); - - /* buffer-local variables */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - set_ref_in_item(&buf->b_bufvar.di_tv, copyID); - - /* window-local variables */ - FOR_ALL_TAB_WINDOWS(tp, wp) - set_ref_in_item(&wp->w_winvar.di_tv, copyID); -#ifdef FEAT_AUTOCMD - if (aucmd_win != NULL) - set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID); -#endif - -#ifdef FEAT_WINDOWS - /* tabpage-local variables */ - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) - set_ref_in_item(&tp->tp_winvar.di_tv, copyID); -#endif - - /* global variables */ - set_ref_in_ht(&globvarht, copyID); - - /* function-local variables */ - for (fc = current_funccal; fc != NULL; fc = fc->caller) + if (STRNICMP(text, "-inf", 3) == 0) { - set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID); - set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID); + *value = -INFINITY; + return 4; } - - /* v: vars */ - set_ref_in_ht(&vimvarht, copyID); - -#ifdef FEAT_LUA - set_ref_in_lua(copyID); -#endif - -#ifdef FEAT_PYTHON - set_ref_in_python(copyID); -#endif - -#ifdef FEAT_PYTHON3 - set_ref_in_python3(copyID); -#endif - - /* - * 2. Free lists and dictionaries that are not referenced. - */ - did_free = free_unref_items(copyID); - - /* - * 3. Check if any funccal can be freed now. - */ - for (pfc = &previous_funccal; *pfc != NULL; ) + if (STRNICMP(text, "nan", 3) == 0) { - if (can_free_funccal(*pfc, copyID)) - { - fc = *pfc; - *pfc = fc->caller; - free_funccal(fc, TRUE); - did_free = TRUE; - did_free_funccal = TRUE; - } - else - pfc = &(*pfc)->caller; + *value = NAN; + return 3; } - if (did_free_funccal) - /* When a funccal was freed some more items might be garbage - * collected, so run again. */ - (void)garbage_collect(); - - return did_free; + f = strtod(s, &s); + *value = f; + return (int)((char_u *)s - text); } +#endif /* - * Free lists and dictionaries that are no longer referenced. + * Get the value of an environment variable. + * "arg" is pointing to the '$'. It is advanced to after the name. + * If the environment variable was not set, silently assume it is empty. + * Return FAIL if the name is invalid. */ static int -free_unref_items(copyID) - int copyID; +get_env_tv(char_u **arg, typval_T *rettv, int evaluate) { - dict_T *dd; - list_T *ll; - int did_free = FALSE; + char_u *string = NULL; + int len; + int cc; + char_u *name; + int mustfree = FALSE; - /* - * Go through the list of dicts and free items without the copyID. - */ - for (dd = first_dict; dd != NULL; ) - if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + ++*arg; + name = *arg; + len = get_env_len(arg); + if (evaluate) + { + if (len == 0) + return FAIL; /* invalid empty name */ + + cc = name[len]; + name[len] = NUL; + /* first try vim_getenv(), fast for normal environment vars */ + string = vim_getenv(name, &mustfree); + if (string != NULL && *string != NUL) { - /* Free the Dictionary and ordinary items it contains, but don't - * recurse into Lists and Dictionaries, they will be in the list - * of dicts or list of lists. */ - dict_free(dd, FALSE); - did_free = TRUE; - - /* restart, next dict may also have been freed */ - dd = first_dict; + if (!mustfree) + string = vim_strsave(string); } else - dd = dd->dv_used_next; - - /* - * Go through the list of lists and free items without the copyID. - * But don't free a list that has a watcher (used in a for loop), these - * are not referenced anywhere. - */ - for (ll = first_list; ll != NULL; ) - if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK) - && ll->lv_watch == NULL) { - /* Free the List and ordinary items it contains, but don't recurse - * into Lists and Dictionaries, they will be in the list of dicts - * or list of lists. */ - list_free(ll, FALSE); - did_free = TRUE; - - /* restart, next list may also have been freed */ - ll = first_list; + if (mustfree) + vim_free(string); + + /* next try expanding things like $VIM and ${HOME} */ + string = expand_env_save(name - 1); + if (string != NULL && *string == '$') + VIM_CLEAR(string); } - else - ll = ll->lv_used_next; + name[len] = cc; - return did_free; -} - -/* - * Mark all lists and dicts referenced through hashtab "ht" with "copyID". - */ - void -set_ref_in_ht(ht, copyID) - hashtab_T *ht; - int copyID; -{ - int todo; - hashitem_T *hi; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = string; + } - todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) - if (!HASHITEM_EMPTY(hi)) - { - --todo; - set_ref_in_item(&HI2DI(hi)->di_tv, copyID); - } + return OK; } -/* - * Mark all lists and dicts referenced through list "l" with "copyID". - */ - void -set_ref_in_list(l, copyID) - list_T *l; - int copyID; -{ - listitem_T *li; - for (li = l->lv_first; li != NULL; li = li->li_next) - set_ref_in_item(&li->li_tv, copyID); -} /* - * Mark all lists and dicts referenced through typval "tv" with "copyID". + * Translate a String variable into a position. + * Returns NULL when there is an error. */ - void -set_ref_in_item(tv, copyID) - typval_T *tv; - int copyID; + pos_T * +var2fpos( + typval_T *varp, + int dollar_lnum, /* TRUE when $ is last line */ + int *fnum) /* set to fnum for '0, 'A, etc. */ { - dict_T *dd; - list_T *ll; + char_u *name; + static pos_T pos; + pos_T *pp; - switch (tv->v_type) + /* Argument can be [lnum, col, coladd]. */ + if (varp->v_type == VAR_LIST) { - case VAR_DICT: - dd = tv->vval.v_dict; - if (dd != NULL && dd->dv_copyID != copyID) - { - /* Didn't see this dict yet. */ - dd->dv_copyID = copyID; - set_ref_in_ht(&dd->dv_hashtab, copyID); - } - break; + list_T *l; + int len; + int error = FALSE; + listitem_T *li; - case VAR_LIST: - ll = tv->vval.v_list; - if (ll != NULL && ll->lv_copyID != copyID) - { - /* Didn't see this list yet. */ - ll->lv_copyID = copyID; - set_ref_in_list(ll, copyID); - } - break; - } - return; -} + l = varp->vval.v_list; + if (l == NULL) + return NULL; -/* - * Allocate an empty header for a dictionary. - */ - dict_T * -dict_alloc() -{ - dict_T *d; + /* Get the line number */ + pos.lnum = list_find_nr(l, 0L, &error); + if (error || pos.lnum <= 0 || pos.lnum > curbuf->b_ml.ml_line_count) + return NULL; /* invalid line number */ - d = (dict_T *)alloc(sizeof(dict_T)); - if (d != NULL) - { - /* Add the dict to the list of dicts for garbage collection. */ - if (first_dict != NULL) - first_dict->dv_used_prev = d; - d->dv_used_next = first_dict; - d->dv_used_prev = NULL; - first_dict = d; - - hash_init(&d->dv_hashtab); - d->dv_lock = 0; - d->dv_scope = 0; - d->dv_refcount = 0; - d->dv_copyID = 0; - } - return d; -} + /* Get the column number */ + pos.col = list_find_nr(l, 1L, &error); + if (error) + return NULL; + len = (long)STRLEN(ml_get(pos.lnum)); -/* - * Allocate an empty dict for a return value. - * Returns OK or FAIL. - */ - static int -rettv_dict_alloc(rettv) - typval_T *rettv; -{ - dict_T *d = dict_alloc(); + /* We accept "$" for the column number: last column. */ + li = list_find(l, 1L); + if (li != NULL && li->li_tv.v_type == VAR_STRING + && li->li_tv.vval.v_string != NULL + && STRCMP(li->li_tv.vval.v_string, "$") == 0) + pos.col = len + 1; - if (d == NULL) - return FAIL; + /* Accept a position up to the NUL after the line. */ + if (pos.col == 0 || (int)pos.col > len + 1) + return NULL; /* invalid column number */ + --pos.col; - rettv->vval.v_dict = d; - rettv->v_type = VAR_DICT; - ++d->dv_refcount; - return OK; -} +#ifdef FEAT_VIRTUALEDIT + /* Get the virtual offset. Defaults to zero. */ + pos.coladd = list_find_nr(l, 2L, &error); + if (error) + pos.coladd = 0; +#endif + return &pos; + } -/* - * Unreference a Dictionary: decrement the reference count and free it when it - * becomes zero. - */ - void -dict_unref(d) - dict_T *d; -{ - if (d != NULL && --d->dv_refcount <= 0) - dict_free(d, TRUE); -} + name = get_tv_string_chk(varp); + if (name == NULL) + return NULL; + if (name[0] == '.') /* cursor */ + return &curwin->w_cursor; + if (name[0] == 'v' && name[1] == NUL) /* Visual start */ + { + if (VIsual_active) + return &VIsual; + return &curwin->w_cursor; + } + if (name[0] == '\'') /* mark */ + { + pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); + if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) + return NULL; + return pp; + } -/* - * Free a Dictionary, including all items it contains. - * Ignores the reference count. - */ - void -dict_free(d, recurse) - dict_T *d; - int recurse; /* Free Lists and Dictionaries recursively. */ -{ - int todo; - hashitem_T *hi; - dictitem_T *di; +#ifdef FEAT_VIRTUALEDIT + pos.coladd = 0; +#endif - /* Remove the dict from the list of dicts for garbage collection. */ - if (d->dv_used_prev == NULL) - first_dict = d->dv_used_next; - else - d->dv_used_prev->dv_used_next = d->dv_used_next; - if (d->dv_used_next != NULL) - d->dv_used_next->dv_used_prev = d->dv_used_prev; - - /* Lock the hashtab, we don't want it to resize while freeing items. */ - hash_lock(&d->dv_hashtab); - todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + if (name[0] == 'w' && dollar_lnum) { - if (!HASHITEM_EMPTY(hi)) + pos.col = 0; + if (name[1] == '0') /* "w0": first visible line */ { - /* Remove the item before deleting it, just in case there is - * something recursive causing trouble. */ - di = HI2DI(hi); - hash_remove(&d->dv_hashtab, hi); - if (recurse || (di->di_tv.v_type != VAR_LIST - && di->di_tv.v_type != VAR_DICT)) - clear_tv(&di->di_tv); - vim_free(di); - --todo; + update_topline(); + /* In silent Ex mode topline is zero, but that's not a valid line + * number; use one instead. */ + pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1; + return &pos; + } + else if (name[1] == '$') /* "w$": last visible line */ + { + validate_botline(); + /* In silent Ex mode botline is zero, return zero then. */ + pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0; + return &pos; } } - hash_clear(&d->dv_hashtab); - vim_free(d); -} - -/* - * Allocate a Dictionary item. - * The "key" is copied to the new item. - * Note that the value of the item "di_tv" still needs to be initialized! - * Returns NULL when out of memory. - */ - dictitem_T * -dictitem_alloc(key) - char_u *key; -{ - dictitem_T *di; - - di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key))); - if (di != NULL) + else if (name[0] == '$') /* last column or line */ { - STRCPY(di->di_key, key); - di->di_flags = 0; + if (dollar_lnum) + { + pos.lnum = curbuf->b_ml.ml_line_count; + pos.col = 0; + } + else + { + pos.lnum = curwin->w_cursor.lnum; + pos.col = (colnr_T)STRLEN(ml_get_curline()); + } + return &pos; } - return di; + return NULL; } /* - * Make a copy of a Dictionary item. + * Convert list in "arg" into a position and optional file number. + * When "fnump" is NULL there is no file number, only 3 items. + * Note that the column is passed on as-is, the caller may want to decrement + * it to use 1 for the first column. + * Return FAIL when conversion is not possible, doesn't check the position for + * validity. */ - static dictitem_T * -dictitem_copy(org) - dictitem_T *org; + int +list2fpos( + typval_T *arg, + pos_T *posp, + int *fnump, + colnr_T *curswantp) { - dictitem_T *di; + list_T *l = arg->vval.v_list; + long i = 0; + long n; + + /* List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only + * there when "fnump" isn't NULL; "coladd" and "curswant" are optional. */ + if (arg->v_type != VAR_LIST + || l == NULL + || l->lv_len < (fnump == NULL ? 2 : 3) + || l->lv_len > (fnump == NULL ? 4 : 5)) + return FAIL; - di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) - + STRLEN(org->di_key))); - if (di != NULL) + if (fnump != NULL) { - STRCPY(di->di_key, org->di_key); - di->di_flags = 0; - copy_tv(&org->di_tv, &di->di_tv); + n = list_find_nr(l, i++, NULL); /* fnum */ + if (n < 0) + return FAIL; + if (n == 0) + n = curbuf->b_fnum; /* current buffer */ + *fnump = n; } - return di; -} -/* - * Remove item "item" from Dictionary "dict" and free it. - */ - static void -dictitem_remove(dict, item) - dict_T *dict; - dictitem_T *item; -{ - hashitem_T *hi; + n = list_find_nr(l, i++, NULL); /* lnum */ + if (n < 0) + return FAIL; + posp->lnum = n; - hi = hash_find(&dict->dv_hashtab, item->di_key); - if (HASHITEM_EMPTY(hi)) - EMSG2(_(e_intern2), "dictitem_remove()"); + n = list_find_nr(l, i++, NULL); /* col */ + if (n < 0) + return FAIL; + posp->col = n; + +#ifdef FEAT_VIRTUALEDIT + n = list_find_nr(l, i, NULL); /* off */ + if (n < 0) + posp->coladd = 0; else - hash_remove(&dict->dv_hashtab, hi); - dictitem_free(item); + posp->coladd = n; +#endif + + if (curswantp != NULL) + *curswantp = list_find_nr(l, i + 1, NULL); /* curswant */ + + return OK; } /* - * Free a dict item. Also clears the value. + * Get the length of an environment variable name. + * Advance "arg" to the first character after the name. + * Return 0 for error. */ - void -dictitem_free(item) - dictitem_T *item; + static int +get_env_len(char_u **arg) { - clear_tv(&item->di_tv); - vim_free(item); + char_u *p; + int len; + + for (p = *arg; vim_isIDc(*p); ++p) + ; + if (p == *arg) /* no name found */ + return 0; + + len = (int)(p - *arg); + *arg = p; + return len; } /* - * Make a copy of dict "d". Shallow if "deep" is FALSE. - * The refcount of the new dict is set to 1. - * See item_copy() for "copyID". - * Returns NULL when out of memory. + * Get the length of the name of a function or internal variable. + * "arg" is advanced to the first non-white character after the name. + * Return 0 if something is wrong. */ - static dict_T * -dict_copy(orig, deep, copyID) - dict_T *orig; - int deep; - int copyID; + int +get_id_len(char_u **arg) { - dict_T *copy; - dictitem_T *di; - int todo; - hashitem_T *hi; - - if (orig == NULL) - return NULL; + char_u *p; + int len; - copy = dict_alloc(); - if (copy != NULL) + /* Find the end of the name. */ + for (p = *arg; eval_isnamec(*p); ++p) { - if (copyID != 0) + if (*p == ':') { - orig->dv_copyID = copyID; - orig->dv_copydict = copy; - } - todo = (int)orig->dv_hashtab.ht_used; - for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - - di = dictitem_alloc(hi->hi_key); - if (di == NULL) - break; - if (deep) - { - if (item_copy(&HI2DI(hi)->di_tv, &di->di_tv, deep, - copyID) == FAIL) - { - vim_free(di); - break; - } - } - else - copy_tv(&HI2DI(hi)->di_tv, &di->di_tv); - if (dict_add(copy, di) == FAIL) - { - dictitem_free(di); - break; - } - } - } - - ++copy->dv_refcount; - if (todo > 0) - { - dict_unref(copy); - copy = NULL; + /* "s:" is start of "s:var", but "n:" is not and can be used in + * slice "[n:]". Also "xx:" is not a namespace. */ + len = (int)(p - *arg); + if ((len == 1 && vim_strchr(NAMESPACE_CHAR, **arg) == NULL) + || len > 1) + break; } } + if (p == *arg) /* no name found */ + return 0; - return copy; -} + len = (int)(p - *arg); + *arg = skipwhite(p); -/* - * Add item "item" to Dictionary "d". - * Returns FAIL when out of memory and when key already exists. - */ - int -dict_add(d, item) - dict_T *d; - dictitem_T *item; -{ - return hash_add(&d->dv_hashtab, item->di_key); + return len; } /* - * Add a number or string entry to dictionary "d". - * When "str" is NULL use number "nr", otherwise use "str". - * Returns FAIL when out of memory and when key already exists. + * Get the length of the name of a variable or function. + * Only the name is recognized, does not handle ".key" or "[idx]". + * "arg" is advanced to the first non-white character after the name. + * Return -1 if curly braces expansion failed. + * Return 0 if something else is wrong. + * If the name contains 'magic' {}'s, expand them and return the + * expanded name in an allocated string via 'alias' - caller must free. */ int -dict_add_nr_str(d, key, nr, str) - dict_T *d; - char *key; - long nr; - char_u *str; +get_name_len( + char_u **arg, + char_u **alias, + int evaluate, + int verbose) { - dictitem_T *item; + int len; + char_u *p; + char_u *expr_start; + char_u *expr_end; - item = dictitem_alloc((char_u *)key); - if (item == NULL) - return FAIL; - item->di_tv.v_lock = 0; - if (str == NULL) + *alias = NULL; /* default to no alias */ + + if ((*arg)[0] == K_SPECIAL && (*arg)[1] == KS_EXTRA + && (*arg)[2] == (int)KE_SNR) { - item->di_tv.v_type = VAR_NUMBER; - item->di_tv.vval.v_number = nr; + /* hard coded <SNR>, already translated */ + *arg += 3; + return get_id_len(arg) + 3; } - else + len = eval_fname_script(*arg); + if (len > 0) { - item->di_tv.v_type = VAR_STRING; - item->di_tv.vval.v_string = vim_strsave(str); + /* literal "<SID>", "s:" or "<SNR>" */ + *arg += len; } - if (dict_add(d, item) == FAIL) + + /* + * Find the end of the name; check for {} construction. + */ + p = find_name_end(*arg, &expr_start, &expr_end, + len > 0 ? 0 : FNE_CHECK_START); + if (expr_start != NULL) { - dictitem_free(item); - return FAIL; + char_u *temp_string; + + if (!evaluate) + { + len += (int)(p - *arg); + *arg = skipwhite(p); + return len; + } + + /* + * Include any <SID> etc in the expanded string: + * Thus the -len here. + */ + temp_string = make_expanded_name(*arg - len, expr_start, expr_end, p); + if (temp_string == NULL) + return -1; + *alias = temp_string; + *arg = skipwhite(p); + return (int)STRLEN(temp_string); } - return OK; + + len += get_id_len(arg); + if (len == 0 && verbose) + EMSG2(_(e_invexpr2), *arg); + + return len; } /* - * Add a list entry to dictionary "d". - * Returns FAIL when out of memory and when key already exists. + * Find the end of a variable or function name, taking care of magic braces. + * If "expr_start" is not NULL then "expr_start" and "expr_end" are set to the + * start and end of the first magic braces item. + * "flags" can have FNE_INCL_BR and FNE_CHECK_START. + * Return a pointer to just after the name. Equal to "arg" if there is no + * valid name. */ - int -dict_add_list(d, key, list) - dict_T *d; - char *key; - list_T *list; + char_u * +find_name_end( + char_u *arg, + char_u **expr_start, + char_u **expr_end, + int flags) { - dictitem_T *item; + int mb_nest = 0; + int br_nest = 0; + char_u *p; + int len; - item = dictitem_alloc((char_u *)key); - if (item == NULL) - return FAIL; - item->di_tv.v_lock = 0; - item->di_tv.v_type = VAR_LIST; - item->di_tv.vval.v_list = list; - if (dict_add(d, item) == FAIL) + if (expr_start != NULL) { - dictitem_free(item); - return FAIL; + *expr_start = NULL; + *expr_end = NULL; } - ++list->lv_refcount; - return OK; -} -/* - * Get the number of items in a Dictionary. - */ - static long -dict_len(d) - dict_T *d; -{ - if (d == NULL) - return 0L; - return (long)d->dv_hashtab.ht_used; + /* Quick check for valid starting character. */ + if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{') + return arg; + + for (p = arg; *p != NUL + && (eval_isnamec(*p) + || *p == '{' + || ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.')) + || mb_nest != 0 + || br_nest != 0); MB_PTR_ADV(p)) + { + if (*p == '\'') + { + /* skip over 'string' to avoid counting [ and ] inside it. */ + for (p = p + 1; *p != NUL && *p != '\''; MB_PTR_ADV(p)) + ; + if (*p == NUL) + break; + } + else if (*p == '"') + { + /* skip over "str\"ing" to avoid counting [ and ] inside it. */ + for (p = p + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p)) + if (*p == '\\' && p[1] != NUL) + ++p; + if (*p == NUL) + break; + } + else if (br_nest == 0 && mb_nest == 0 && *p == ':') + { + /* "s:" is start of "s:var", but "n:" is not and can be used in + * slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */ + len = (int)(p - arg); + if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) + || (len > 1 && p[-1] != '}')) + break; + } + + if (mb_nest == 0) + { + if (*p == '[') + ++br_nest; + else if (*p == ']') + --br_nest; + } + + if (br_nest == 0) + { + if (*p == '{') + { + mb_nest++; + if (expr_start != NULL && *expr_start == NULL) + *expr_start = p; + } + else if (*p == '}') + { + mb_nest--; + if (expr_start != NULL && mb_nest == 0 && *expr_end == NULL) + *expr_end = p; + } + } + } + + return p; } /* - * Find item "key[len]" in Dictionary "d". - * If "len" is negative use strlen(key). - * Returns NULL when not found. + * Expands out the 'magic' {}'s in a variable/function name. + * Note that this can call itself recursively, to deal with + * constructs like foo{bar}{baz}{bam} + * The four pointer arguments point to "foo{expre}ss{ion}bar" + * "in_start" ^ + * "expr_start" ^ + * "expr_end" ^ + * "in_end" ^ + * + * Returns a new allocated string, which the caller must free. + * Returns NULL for failure. */ - dictitem_T * -dict_find(d, key, len) - dict_T *d; - char_u *key; - int len; + static char_u * +make_expanded_name( + char_u *in_start, + char_u *expr_start, + char_u *expr_end, + char_u *in_end) { -#define AKEYLEN 200 - char_u buf[AKEYLEN]; - char_u *akey; - char_u *tofree = NULL; - hashitem_T *hi; + char_u c1; + char_u *retval = NULL; + char_u *temp_result; + char_u *nextcmd = NULL; + + if (expr_end == NULL || in_end == NULL) + return NULL; + *expr_start = NUL; + *expr_end = NUL; + c1 = *in_end; + *in_end = NUL; - if (len < 0) - akey = key; - else if (len >= AKEYLEN) + temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE); + if (temp_result != NULL && nextcmd == NULL) { - tofree = akey = vim_strnsave(key, len); - if (akey == NULL) - return NULL; + retval = alloc((unsigned)(STRLEN(temp_result) + (expr_start - in_start) + + (in_end - expr_end) + 1)); + if (retval != NULL) + { + STRCPY(retval, in_start); + STRCAT(retval, temp_result); + STRCAT(retval, expr_end + 1); + } } - else + vim_free(temp_result); + + *in_end = c1; /* put char back for error messages */ + *expr_start = '{'; + *expr_end = '}'; + + if (retval != NULL) { - /* Avoid a malloc/free by using buf[]. */ - vim_strncpy(buf, key, len); - akey = buf; + temp_result = find_name_end(retval, &expr_start, &expr_end, 0); + if (expr_start != NULL) + { + /* Further expansion! */ + temp_result = make_expanded_name(retval, expr_start, + expr_end, temp_result); + vim_free(retval); + retval = temp_result; + } } - hi = hash_find(&d->dv_hashtab, akey); - vim_free(tofree); - if (HASHITEM_EMPTY(hi)) - return NULL; - return HI2DI(hi); + return retval; } /* - * Get a string item from a dictionary. - * When "save" is TRUE allocate memory for it. - * Returns NULL if the entry doesn't exist or out of memory. + * Return TRUE if character "c" can be used in a variable or function name. + * Does not include '{' or '}' for magic braces. */ - char_u * -get_dict_string(d, key, save) - dict_T *d; - char_u *key; - int save; + int +eval_isnamec(int c) { - dictitem_T *di; - char_u *s; - - di = dict_find(d, key, -1); - if (di == NULL) - return NULL; - s = get_tv_string(&di->di_tv); - if (save && s != NULL) - s = vim_strsave(s); - return s; + return (ASCII_ISALNUM(c) || c == '_' || c == ':' || c == AUTOLOAD_CHAR); } /* - * Get a number item from a dictionary. - * Returns 0 if the entry doesn't exist or out of memory. + * Return TRUE if character "c" can be used as the first character in a + * variable or function name (excluding '{' and '}'). */ - long -get_dict_number(d, key) - dict_T *d; - char_u *key; + int +eval_isnamec1(int c) { - dictitem_T *di; - - di = dict_find(d, key, -1); - if (di == NULL) - return 0; - return get_tv_number(&di->di_tv); + return (ASCII_ISALPHA(c) || c == '_'); } /* - * Return an allocated string with the string representation of a Dictionary. - * May return NULL. + * Set number v: variable to "val". */ - static char_u * -dict2string(tv, copyID) - typval_T *tv; - int copyID; + void +set_vim_var_nr(int idx, varnumber_T val) { - garray_T ga; - int first = TRUE; - char_u *tofree; - char_u numbuf[NUMBUFLEN]; - hashitem_T *hi; - char_u *s; - dict_T *d; - int todo; + vimvars[idx].vv_nr = val; +} - if ((d = tv->vval.v_dict) == NULL) - return NULL; - ga_init2(&ga, (int)sizeof(char), 80); - ga_append(&ga, '{'); +/* + * Get number v: variable value. + */ + varnumber_T +get_vim_var_nr(int idx) +{ + return vimvars[idx].vv_nr; +} - todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; +/* + * Get string v: variable value. Uses a static buffer, can only be used once. + * If the String variable has never been set, return an empty string. + * Never returns NULL; + */ + char_u * +get_vim_var_str(int idx) +{ + return get_tv_string(&vimvars[idx].vv_tv); +} - if (first) - first = FALSE; - else - ga_concat(&ga, (char_u *)", "); +/* + * Get List v: variable value. Caller must take care of reference count when + * needed. + */ + list_T * +get_vim_var_list(int idx) +{ + return vimvars[idx].vv_list; +} - tofree = string_quote(hi->hi_key, FALSE); - if (tofree != NULL) - { - ga_concat(&ga, tofree); - vim_free(tofree); - } - ga_concat(&ga, (char_u *)": "); - s = tv2string(&HI2DI(hi)->di_tv, &tofree, numbuf, copyID); - if (s != NULL) - ga_concat(&ga, s); - vim_free(tofree); - if (s == NULL || did_echo_string_emsg) - break; - line_breakcheck(); +/* + * Get Dict v: variable value. Caller must take care of reference count when + * needed. + */ + dict_T * +get_vim_var_dict(int idx) +{ + return vimvars[idx].vv_dict; +} - } - } - if (todo > 0) +/* + * Set v:char to character "c". + */ + void +set_vim_var_char(int c) +{ + char_u buf[MB_MAXBYTES + 1]; + +#ifdef FEAT_MBYTE + if (has_mbyte) + buf[(*mb_char2bytes)(c, buf)] = NUL; + else +#endif { - vim_free(ga.ga_data); - return NULL; + buf[0] = c; + buf[1] = NUL; } + set_vim_var_string(VV_CHAR, buf, -1); +} - ga_append(&ga, '}'); - ga_append(&ga, NUL); - return (char_u *)ga.ga_data; +/* + * Set v:count to "count" and v:count1 to "count1". + * When "set_prevcount" is TRUE first set v:prevcount from v:count. + */ + void +set_vcount( + long count, + long count1, + int set_prevcount) +{ + if (set_prevcount) + vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; + vimvars[VV_COUNT].vv_nr = count; + vimvars[VV_COUNT1].vv_nr = count1; } /* - * Allocate a variable for a Dictionary and fill it from "*arg". - * Return OK or FAIL. Returns NOTDONE for {expr}. + * Save variables that might be changed as a side effect. Used when executing + * a timer callback. */ - static int -get_dict_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; + void +save_vimvars(vimvars_save_T *vvsave) { - dict_T *d = NULL; - typval_T tvkey; - typval_T tv; - char_u *key = NULL; - dictitem_T *item; - char_u *start = skipwhite(*arg + 1); - char_u buf[NUMBUFLEN]; + vvsave->vv_prevcount = vimvars[VV_PREVCOUNT].vv_nr; + vvsave->vv_count = vimvars[VV_COUNT].vv_nr; + vvsave->vv_count1 = vimvars[VV_COUNT1].vv_nr; +} - /* - * First check if it's not a curly-braces thing: {expr}. - * Must do this without evaluating, otherwise a function may be called - * twice. Unfortunately this means we need to call eval1() twice for the - * first item. - * But {} is an empty Dictionary. - */ - if (*start != '}') - { - if (eval1(&start, &tv, FALSE) == FAIL) /* recursive! */ - return FAIL; - if (*start == '}') - return NOTDONE; - } +/* + * Restore variables saved by save_vimvars(). + */ + void +restore_vimvars(vimvars_save_T *vvsave) +{ + vimvars[VV_PREVCOUNT].vv_nr = vvsave->vv_prevcount; + vimvars[VV_COUNT].vv_nr = vvsave->vv_count; + vimvars[VV_COUNT1].vv_nr = vvsave->vv_count1; +} - if (evaluate) +/* + * Set string v: variable to a copy of "val". + */ + void +set_vim_var_string( + int idx, + char_u *val, + int len) /* length of "val" to use or -1 (whole string) */ +{ + clear_tv(&vimvars[idx].vv_di.di_tv); + vimvars[idx].vv_type = VAR_STRING; + if (val == NULL) + vimvars[idx].vv_str = NULL; + else if (len == -1) + vimvars[idx].vv_str = vim_strsave(val); + else + vimvars[idx].vv_str = vim_strnsave(val, len); +} + +/* + * Set List v: variable to "val". + */ + void +set_vim_var_list(int idx, list_T *val) +{ + clear_tv(&vimvars[idx].vv_di.di_tv); + vimvars[idx].vv_type = VAR_LIST; + vimvars[idx].vv_list = val; + if (val != NULL) + ++val->lv_refcount; +} + +/* + * Set Dictionary v: variable to "val". + */ + void +set_vim_var_dict(int idx, dict_T *val) +{ + clear_tv(&vimvars[idx].vv_di.di_tv); + vimvars[idx].vv_type = VAR_DICT; + vimvars[idx].vv_dict = val; + if (val != NULL) { - d = dict_alloc(); - if (d == NULL) - return FAIL; + ++val->dv_refcount; + dict_set_items_ro(val); } - tvkey.v_type = VAR_UNKNOWN; - tv.v_type = VAR_UNKNOWN; +} - *arg = skipwhite(*arg + 1); - while (**arg != '}' && **arg != NUL) - { - if (eval1(arg, &tvkey, evaluate) == FAIL) /* recursive! */ - goto failret; - if (**arg != ':') - { - EMSG2(_("E720: Missing colon in Dictionary: %s"), *arg); - clear_tv(&tvkey); - goto failret; - } - if (evaluate) - { - key = get_tv_string_buf_chk(&tvkey, buf); - if (key == NULL || *key == NUL) - { - /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ - if (key != NULL) - EMSG(_(e_emptykey)); - clear_tv(&tvkey); - goto failret; - } - } +/* + * Set v:register if needed. + */ + void +set_reg_var(int c) +{ + char_u regname; - *arg = skipwhite(*arg + 1); - if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ - { - if (evaluate) - clear_tv(&tvkey); - goto failret; - } - if (evaluate) - { - item = dict_find(d, key, -1); - if (item != NULL) - { - EMSG2(_("E721: Duplicate key in Dictionary: \"%s\""), key); - clear_tv(&tvkey); - clear_tv(&tv); - goto failret; - } - item = dictitem_alloc(key); - clear_tv(&tvkey); - if (item != NULL) - { - item->di_tv = tv; - item->di_tv.v_lock = 0; - if (dict_add(d, item) == FAIL) - dictitem_free(item); - } - } + if (c == 0 || c == ' ') + regname = '"'; + else + regname = c; + /* Avoid free/alloc when the value is already right. */ + if (vimvars[VV_REG].vv_str == NULL || vimvars[VV_REG].vv_str[0] != c) + set_vim_var_string(VV_REG, ®name, 1); +} - if (**arg == '}') - break; - if (**arg != ',') - { - EMSG2(_("E722: Missing comma in Dictionary: %s"), *arg); - goto failret; - } - *arg = skipwhite(*arg + 1); - } +/* + * Get or set v:exception. If "oldval" == NULL, return the current value. + * Otherwise, restore the value to "oldval" and return NULL. + * Must always be called in pairs to save and restore v:exception! Does not + * take care of memory allocations. + */ + char_u * +v_exception(char_u *oldval) +{ + if (oldval == NULL) + return vimvars[VV_EXCEPTION].vv_str; - if (**arg != '}') - { - EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg); -failret: - if (evaluate) - dict_free(d, TRUE); - return FAIL; - } + vimvars[VV_EXCEPTION].vv_str = oldval; + return NULL; +} - *arg = skipwhite(*arg + 1); - if (evaluate) - { - rettv->v_type = VAR_DICT; - rettv->vval.v_dict = d; - ++d->dv_refcount; - } +/* + * Get or set v:throwpoint. If "oldval" == NULL, return the current value. + * Otherwise, restore the value to "oldval" and return NULL. + * Must always be called in pairs to save and restore v:throwpoint! Does not + * take care of memory allocations. + */ + char_u * +v_throwpoint(char_u *oldval) +{ + if (oldval == NULL) + return vimvars[VV_THROWPOINT].vv_str; - return OK; + vimvars[VV_THROWPOINT].vv_str = oldval; + return NULL; } /* - * Return a string with the string representation of a variable. - * If the memory is allocated "tofree" is set to it, otherwise NULL. - * "numbuf" is used for a number. - * Does not put quotes around strings, as ":echo" displays values. - * When "copyID" is not NULL replace recursive lists and dicts with "...". - * May return NULL. + * Set v:cmdarg. + * If "eap" != NULL, use "eap" to generate the value and return the old value. + * If "oldarg" != NULL, restore the value to "oldarg" and return NULL. + * Must always be called in pairs! */ - static char_u * -echo_string(tv, tofree, numbuf, copyID) - typval_T *tv; - char_u **tofree; - char_u *numbuf; - int copyID; + char_u * +set_cmdarg(exarg_T *eap, char_u *oldarg) { - static int recurse = 0; - char_u *r = NULL; + char_u *oldval; + char_u *newval; + unsigned len; - if (recurse >= DICT_MAXNEST) + oldval = vimvars[VV_CMDARG].vv_str; + if (eap == NULL) { - if (!did_echo_string_emsg) - { - /* Only give this message once for a recursive call to avoid - * flooding the user with errors. And stop iterating over lists - * and dicts. */ - did_echo_string_emsg = TRUE; - EMSG(_("E724: variable nested too deep for displaying")); - } - *tofree = NULL; - return (char_u *)"{E724}"; + vim_free(oldval); + vimvars[VV_CMDARG].vv_str = oldarg; + return NULL; } - ++recurse; - switch (tv->v_type) - { - case VAR_FUNC: - *tofree = NULL; - r = tv->vval.v_string; - break; + if (eap->force_bin == FORCE_BIN) + len = 6; + else if (eap->force_bin == FORCE_NOBIN) + len = 8; + else + len = 0; - case VAR_LIST: - if (tv->vval.v_list == NULL) - { - *tofree = NULL; - r = NULL; - } - else if (copyID != 0 && tv->vval.v_list->lv_copyID == copyID) - { - *tofree = NULL; - r = (char_u *)"[...]"; - } - else - { - tv->vval.v_list->lv_copyID = copyID; - *tofree = list2string(tv, copyID); - r = *tofree; - } - break; - - case VAR_DICT: - if (tv->vval.v_dict == NULL) - { - *tofree = NULL; - r = NULL; - } - else if (copyID != 0 && tv->vval.v_dict->dv_copyID == copyID) - { - *tofree = NULL; - r = (char_u *)"{...}"; - } - else - { - tv->vval.v_dict->dv_copyID = copyID; - *tofree = dict2string(tv, copyID); - r = *tofree; - } - break; + if (eap->read_edit) + len += 7; - case VAR_STRING: - case VAR_NUMBER: - *tofree = NULL; - r = get_tv_string_buf(tv, numbuf); - break; + if (eap->force_ff != 0) + len += 10; /* " ++ff=unix" */ +# ifdef FEAT_MBYTE + if (eap->force_enc != 0) + len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7; + if (eap->bad_char != 0) + len += 7 + 4; /* " ++bad=" + "keep" or "drop" */ +# endif -#ifdef FEAT_FLOAT - case VAR_FLOAT: - *tofree = NULL; - vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); - r = numbuf; - break; -#endif + newval = alloc(len + 1); + if (newval == NULL) + return NULL; - default: - EMSG2(_(e_intern2), "echo_string()"); - *tofree = NULL; - } + if (eap->force_bin == FORCE_BIN) + sprintf((char *)newval, " ++bin"); + else if (eap->force_bin == FORCE_NOBIN) + sprintf((char *)newval, " ++nobin"); + else + *newval = NUL; - if (--recurse == 0) - did_echo_string_emsg = FALSE; - return r; -} + if (eap->read_edit) + STRCAT(newval, " ++edit"); -/* - * Return a string with the string representation of a variable. - * If the memory is allocated "tofree" is set to it, otherwise NULL. - * "numbuf" is used for a number. - * Puts quotes around strings, so that they can be parsed back by eval(). - * May return NULL. - */ - static char_u * -tv2string(tv, tofree, numbuf, copyID) - typval_T *tv; - char_u **tofree; - char_u *numbuf; - int copyID; -{ - switch (tv->v_type) - { - case VAR_FUNC: - *tofree = string_quote(tv->vval.v_string, TRUE); - return *tofree; - case VAR_STRING: - *tofree = string_quote(tv->vval.v_string, FALSE); - return *tofree; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - *tofree = NULL; - vim_snprintf((char *)numbuf, NUMBUFLEN - 1, "%g", tv->vval.v_float); - return numbuf; + if (eap->force_ff != 0) + sprintf((char *)newval + STRLEN(newval), " ++ff=%s", + eap->force_ff == 'u' ? "unix" + : eap->force_ff == 'd' ? "dos" + : "mac"); +#ifdef FEAT_MBYTE + if (eap->force_enc != 0) + sprintf((char *)newval + STRLEN(newval), " ++enc=%s", + eap->cmd + eap->force_enc); + if (eap->bad_char == BAD_KEEP) + STRCPY(newval + STRLEN(newval), " ++bad=keep"); + else if (eap->bad_char == BAD_DROP) + STRCPY(newval + STRLEN(newval), " ++bad=drop"); + else if (eap->bad_char != 0) + sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); #endif - case VAR_NUMBER: - case VAR_LIST: - case VAR_DICT: - break; - default: - EMSG2(_(e_intern2), "tv2string()"); - } - return echo_string(tv, tofree, numbuf, copyID); + vimvars[VV_CMDARG].vv_str = newval; + return oldval; } /* - * Return string "str" in ' quotes, doubling ' characters. - * If "str" is NULL an empty string is assumed. - * If "function" is TRUE make it function('string'). + * Get the value of internal variable "name". + * Return OK or FAIL. If OK is returned "rettv" must be cleared. */ - static char_u * -string_quote(str, function) - char_u *str; - int function; + int +get_var_tv( + char_u *name, + int len, /* length of "name" */ + typval_T *rettv, /* NULL when only checking existence */ + dictitem_T **dip, /* non-NULL when typval's dict item is needed */ + int verbose, /* may give error message */ + int no_autoload) /* do not use script autoloading */ { - unsigned len; - char_u *p, *r, *s; + int ret = OK; + typval_T *tv = NULL; + dictitem_T *v; + int cc; - len = (function ? 13 : 3); - if (str != NULL) + /* truncate the name, so that we can use strcmp() */ + cc = name[len]; + name[len] = NUL; + + /* + * Check for user-defined variables. + */ + v = find_var(name, NULL, no_autoload); + if (v != NULL) { - len += (unsigned)STRLEN(str); - for (p = str; *p != NUL; mb_ptr_adv(p)) - if (*p == '\'') - ++len; + tv = &v->di_tv; + if (dip != NULL) + *dip = v; } - s = r = alloc(len); - if (r != NULL) + + if (tv == NULL) { - if (function) - { - STRCPY(r, "function('"); - r += 10; - } - else - *r++ = '\''; - if (str != NULL) - for (p = str; *p != NUL; ) - { - if (*p == '\'') - *r++ = '\''; - MB_COPY_CHAR(p, r); - } - *r++ = '\''; - if (function) - *r++ = ')'; - *r++ = NUL; + if (rettv != NULL && verbose) + EMSG2(_(e_undefvar), name); + ret = FAIL; } - return s; -} + else if (rettv != NULL) + copy_tv(tv, rettv); -#ifdef FEAT_FLOAT -/* - * Convert the string "text" to a floating point number. - * This uses strtod(). setlocale(LC_NUMERIC, "C") has been used to make sure - * this always uses a decimal point. - * Returns the length of the text that was consumed. - */ - static int -string2float(text, value) - char_u *text; - float_T *value; /* result stored here */ -{ - char *s = (char *)text; - float_T f; + name[len] = cc; - f = strtod(s, &s); - *value = f; - return (int)((char_u *)s - text); + return ret; } -#endif /* - * Get the value of an environment variable. - * "arg" is pointing to the '$'. It is advanced to after the name. - * If the environment variable was not set, silently assume it is empty. - * Return FAIL if the name is invalid. + * Check if variable "name[len]" is a local variable or an argument. + * If so, "*eval_lavars_used" is set to TRUE. */ - static int -get_env_tv(arg, rettv, evaluate) - char_u **arg; - typval_T *rettv; - int evaluate; + static void +check_vars(char_u *name, int len) { - char_u *string = NULL; - int len; int cc; - char_u *name; - int mustfree = FALSE; - - ++*arg; - name = *arg; - len = get_env_len(arg); - if (evaluate) - { - if (len == 0) - return FAIL; /* can't be an environment variable */ + char_u *varname; + hashtab_T *ht; - cc = name[len]; - name[len] = NUL; - /* first try vim_getenv(), fast for normal environment vars */ - string = vim_getenv(name, &mustfree); - if (string != NULL && *string != NUL) - { - if (!mustfree) - string = vim_strsave(string); - } - else - { - if (mustfree) - vim_free(string); + if (eval_lavars_used == NULL) + return; - /* next try expanding things like $VIM and ${HOME} */ - string = expand_env_save(name - 1); - if (string != NULL && *string == '$') - { - vim_free(string); - string = NULL; - } - } - name[len] = cc; + /* truncate the name, so that we can use strcmp() */ + cc = name[len]; + name[len] = NUL; - rettv->v_type = VAR_STRING; - rettv->vval.v_string = string; + ht = find_var_ht(name, &varname); + if (ht == get_funccal_local_ht() || ht == get_funccal_args_ht()) + { + if (find_var(name, NULL, TRUE) != NULL) + *eval_lavars_used = TRUE; } - return OK; + name[len] = cc; } -/* - * Array with names and number of arguments of all internal functions - * MUST BE KEPT SORTED IN strcmp() ORDER FOR BINARY SEARCH! - */ -static struct fst -{ - char *f_name; /* function name */ - char f_min_argc; /* minimal number of arguments */ - char f_max_argc; /* maximal number of arguments */ - void (*f_func) __ARGS((typval_T *args, typval_T *rvar)); - /* implementation of function */ -} functions[] = -{ -#ifdef FEAT_FLOAT - {"abs", 1, 1, f_abs}, - {"acos", 1, 1, f_acos}, /* WJMc */ -#endif - {"add", 2, 2, f_add}, - {"and", 2, 2, f_and}, - {"append", 2, 2, f_append}, - {"argc", 0, 0, f_argc}, - {"argidx", 0, 0, f_argidx}, - {"arglistid", 0, 2, f_arglistid}, - {"argv", 0, 1, f_argv}, -#ifdef FEAT_FLOAT - {"asin", 1, 1, f_asin}, /* WJMc */ - {"atan", 1, 1, f_atan}, - {"atan2", 2, 2, f_atan2}, -#endif - {"browse", 4, 4, f_browse}, - {"browsedir", 2, 2, f_browsedir}, - {"bufexists", 1, 1, f_bufexists}, - {"buffer_exists", 1, 1, f_bufexists}, /* obsolete */ - {"buffer_name", 1, 1, f_bufname}, /* obsolete */ - {"buffer_number", 1, 1, f_bufnr}, /* obsolete */ - {"buflisted", 1, 1, f_buflisted}, - {"bufloaded", 1, 1, f_bufloaded}, - {"bufname", 1, 1, f_bufname}, - {"bufnr", 1, 2, f_bufnr}, - {"bufwinnr", 1, 1, f_bufwinnr}, - {"byte2line", 1, 1, f_byte2line}, - {"byteidx", 2, 2, f_byteidx}, - {"byteidxcomp", 2, 2, f_byteidxcomp}, - {"call", 2, 3, f_call}, -#ifdef FEAT_FLOAT - {"ceil", 1, 1, f_ceil}, -#endif - {"changenr", 0, 0, f_changenr}, - {"char2nr", 1, 2, f_char2nr}, - {"cindent", 1, 1, f_cindent}, - {"clearmatches", 0, 0, f_clearmatches}, - {"col", 1, 1, f_col}, -#if defined(FEAT_INS_EXPAND) - {"complete", 2, 2, f_complete}, - {"complete_add", 1, 1, f_complete_add}, - {"complete_check", 0, 0, f_complete_check}, -#endif - {"confirm", 1, 4, f_confirm}, - {"copy", 1, 1, f_copy}, -#ifdef FEAT_FLOAT - {"cos", 1, 1, f_cos}, - {"cosh", 1, 1, f_cosh}, -#endif - {"count", 2, 4, f_count}, - {"cscope_connection",0,3, f_cscope_connection}, - {"cursor", 1, 3, f_cursor}, - {"deepcopy", 1, 2, f_deepcopy}, - {"delete", 1, 1, f_delete}, - {"did_filetype", 0, 0, f_did_filetype}, - {"diff_filler", 1, 1, f_diff_filler}, - {"diff_hlID", 2, 2, f_diff_hlID}, - {"empty", 1, 1, f_empty}, - {"escape", 2, 2, f_escape}, - {"eval", 1, 1, f_eval}, - {"eventhandler", 0, 0, f_eventhandler}, - {"executable", 1, 1, f_executable}, - {"exepath", 1, 1, f_exepath}, - {"exists", 1, 1, f_exists}, -#ifdef FEAT_FLOAT - {"exp", 1, 1, f_exp}, -#endif - {"expand", 1, 3, f_expand}, - {"extend", 2, 3, f_extend}, - {"feedkeys", 1, 2, f_feedkeys}, - {"file_readable", 1, 1, f_filereadable}, /* obsolete */ - {"filereadable", 1, 1, f_filereadable}, - {"filewritable", 1, 1, f_filewritable}, - {"filter", 2, 2, f_filter}, - {"finddir", 1, 3, f_finddir}, - {"findfile", 1, 3, f_findfile}, -#ifdef FEAT_FLOAT - {"float2nr", 1, 1, f_float2nr}, - {"floor", 1, 1, f_floor}, - {"fmod", 2, 2, f_fmod}, -#endif - {"fnameescape", 1, 1, f_fnameescape}, - {"fnamemodify", 2, 2, f_fnamemodify}, - {"foldclosed", 1, 1, f_foldclosed}, - {"foldclosedend", 1, 1, f_foldclosedend}, - {"foldlevel", 1, 1, f_foldlevel}, - {"foldtext", 0, 0, f_foldtext}, - {"foldtextresult", 1, 1, f_foldtextresult}, - {"foreground", 0, 0, f_foreground}, - {"function", 1, 1, f_function}, - {"garbagecollect", 0, 1, f_garbagecollect}, - {"get", 2, 3, f_get}, - {"getbufline", 2, 3, f_getbufline}, - {"getbufvar", 2, 3, f_getbufvar}, - {"getchar", 0, 1, f_getchar}, - {"getcharmod", 0, 0, f_getcharmod}, - {"getcmdline", 0, 0, f_getcmdline}, - {"getcmdpos", 0, 0, f_getcmdpos}, - {"getcmdtype", 0, 0, f_getcmdtype}, - {"getcurpos", 0, 0, f_getcurpos}, - {"getcwd", 0, 0, f_getcwd}, - {"getfontname", 0, 1, f_getfontname}, - {"getfperm", 1, 1, f_getfperm}, - {"getfsize", 1, 1, f_getfsize}, - {"getftime", 1, 1, f_getftime}, - {"getftype", 1, 1, f_getftype}, - {"getline", 1, 2, f_getline}, - {"getloclist", 1, 1, f_getqflist}, - {"getmatches", 0, 0, f_getmatches}, - {"getpid", 0, 0, f_getpid}, - {"getpos", 1, 1, f_getpos}, - {"getqflist", 0, 0, f_getqflist}, - {"getreg", 0, 3, f_getreg}, - {"getregtype", 0, 1, f_getregtype}, - {"gettabvar", 2, 3, f_gettabvar}, - {"gettabwinvar", 3, 4, f_gettabwinvar}, - {"getwinposx", 0, 0, f_getwinposx}, - {"getwinposy", 0, 0, f_getwinposy}, - {"getwinvar", 2, 3, f_getwinvar}, - {"glob", 1, 3, f_glob}, - {"globpath", 2, 4, f_globpath}, - {"has", 1, 1, f_has}, - {"has_key", 2, 2, f_has_key}, - {"haslocaldir", 0, 0, f_haslocaldir}, - {"hasmapto", 1, 3, f_hasmapto}, - {"highlightID", 1, 1, f_hlID}, /* obsolete */ - {"highlight_exists",1, 1, f_hlexists}, /* obsolete */ - {"histadd", 2, 2, f_histadd}, - {"histdel", 1, 2, f_histdel}, - {"histget", 1, 2, f_histget}, - {"histnr", 1, 1, f_histnr}, - {"hlID", 1, 1, f_hlID}, - {"hlexists", 1, 1, f_hlexists}, - {"hostname", 0, 0, f_hostname}, - {"iconv", 3, 3, f_iconv}, - {"indent", 1, 1, f_indent}, - {"index", 2, 4, f_index}, - {"input", 1, 3, f_input}, - {"inputdialog", 1, 3, f_inputdialog}, - {"inputlist", 1, 1, f_inputlist}, - {"inputrestore", 0, 0, f_inputrestore}, - {"inputsave", 0, 0, f_inputsave}, - {"inputsecret", 1, 2, f_inputsecret}, - {"insert", 2, 3, f_insert}, - {"invert", 1, 1, f_invert}, - {"isdirectory", 1, 1, f_isdirectory}, - {"islocked", 1, 1, f_islocked}, - {"items", 1, 1, f_items}, - {"join", 1, 2, f_join}, - {"keys", 1, 1, f_keys}, - {"last_buffer_nr", 0, 0, f_last_buffer_nr},/* obsolete */ - {"len", 1, 1, f_len}, - {"libcall", 3, 3, f_libcall}, - {"libcallnr", 3, 3, f_libcallnr}, - {"line", 1, 1, f_line}, - {"line2byte", 1, 1, f_line2byte}, - {"lispindent", 1, 1, f_lispindent}, - {"localtime", 0, 0, f_localtime}, -#ifdef FEAT_FLOAT - {"log", 1, 1, f_log}, - {"log10", 1, 1, f_log10}, -#endif -#ifdef FEAT_LUA - {"luaeval", 1, 2, f_luaeval}, -#endif - {"map", 2, 2, f_map}, - {"maparg", 1, 4, f_maparg}, - {"mapcheck", 1, 3, f_mapcheck}, - {"match", 2, 4, f_match}, - {"matchadd", 2, 4, f_matchadd}, - {"matchaddpos", 2, 4, f_matchaddpos}, - {"matcharg", 1, 1, f_matcharg}, - {"matchdelete", 1, 1, f_matchdelete}, - {"matchend", 2, 4, f_matchend}, - {"matchlist", 2, 4, f_matchlist}, - {"matchstr", 2, 4, f_matchstr}, - {"max", 1, 1, f_max}, - {"min", 1, 1, f_min}, -#ifdef vim_mkdir - {"mkdir", 1, 3, f_mkdir}, -#endif - {"mode", 0, 1, f_mode}, -#ifdef FEAT_MZSCHEME - {"mzeval", 1, 1, f_mzeval}, -#endif - {"nextnonblank", 1, 1, f_nextnonblank}, - {"nr2char", 1, 2, f_nr2char}, - {"or", 2, 2, f_or}, - {"pathshorten", 1, 1, f_pathshorten}, -#ifdef FEAT_FLOAT - {"pow", 2, 2, f_pow}, -#endif - {"prevnonblank", 1, 1, f_prevnonblank}, - {"printf", 2, 19, f_printf}, - {"pumvisible", 0, 0, f_pumvisible}, -#ifdef FEAT_PYTHON3 - {"py3eval", 1, 1, f_py3eval}, -#endif -#ifdef FEAT_PYTHON - {"pyeval", 1, 1, f_pyeval}, -#endif - {"range", 1, 3, f_range}, - {"readfile", 1, 3, f_readfile}, - {"reltime", 0, 2, f_reltime}, - {"reltimestr", 1, 1, f_reltimestr}, - {"remote_expr", 2, 3, f_remote_expr}, - {"remote_foreground", 1, 1, f_remote_foreground}, - {"remote_peek", 1, 2, f_remote_peek}, - {"remote_read", 1, 1, f_remote_read}, - {"remote_send", 2, 3, f_remote_send}, - {"remove", 2, 3, f_remove}, - {"rename", 2, 2, f_rename}, - {"repeat", 2, 2, f_repeat}, - {"resolve", 1, 1, f_resolve}, - {"reverse", 1, 1, f_reverse}, -#ifdef FEAT_FLOAT - {"round", 1, 1, f_round}, -#endif - {"screenattr", 2, 2, f_screenattr}, - {"screenchar", 2, 2, f_screenchar}, - {"screencol", 0, 0, f_screencol}, - {"screenrow", 0, 0, f_screenrow}, - {"search", 1, 4, f_search}, - {"searchdecl", 1, 3, f_searchdecl}, - {"searchpair", 3, 7, f_searchpair}, - {"searchpairpos", 3, 7, f_searchpairpos}, - {"searchpos", 1, 4, f_searchpos}, - {"server2client", 2, 2, f_server2client}, - {"serverlist", 0, 0, f_serverlist}, - {"setbufvar", 3, 3, f_setbufvar}, - {"setcmdpos", 1, 1, f_setcmdpos}, - {"setline", 2, 2, f_setline}, - {"setloclist", 2, 3, f_setloclist}, - {"setmatches", 1, 1, f_setmatches}, - {"setpos", 2, 2, f_setpos}, - {"setqflist", 1, 2, f_setqflist}, - {"setreg", 2, 3, f_setreg}, - {"settabvar", 3, 3, f_settabvar}, - {"settabwinvar", 4, 4, f_settabwinvar}, - {"setwinvar", 3, 3, f_setwinvar}, -#ifdef FEAT_CRYPT - {"sha256", 1, 1, f_sha256}, -#endif - {"shellescape", 1, 2, f_shellescape}, - {"shiftwidth", 0, 0, f_shiftwidth}, - {"simplify", 1, 1, f_simplify}, -#ifdef FEAT_FLOAT - {"sin", 1, 1, f_sin}, - {"sinh", 1, 1, f_sinh}, -#endif - {"sort", 1, 3, f_sort}, - {"soundfold", 1, 1, f_soundfold}, - {"spellbadword", 0, 1, f_spellbadword}, - {"spellsuggest", 1, 3, f_spellsuggest}, - {"split", 1, 3, f_split}, -#ifdef FEAT_FLOAT - {"sqrt", 1, 1, f_sqrt}, - {"str2float", 1, 1, f_str2float}, -#endif - {"str2nr", 1, 2, f_str2nr}, - {"strchars", 1, 1, f_strchars}, - {"strdisplaywidth", 1, 2, f_strdisplaywidth}, -#ifdef HAVE_STRFTIME - {"strftime", 1, 2, f_strftime}, -#endif - {"stridx", 2, 3, f_stridx}, - {"string", 1, 1, f_string}, - {"strlen", 1, 1, f_strlen}, - {"strpart", 2, 3, f_strpart}, - {"strridx", 2, 3, f_strridx}, - {"strtrans", 1, 1, f_strtrans}, - {"strwidth", 1, 1, f_strwidth}, - {"submatch", 1, 2, f_submatch}, - {"substitute", 4, 4, f_substitute}, - {"synID", 3, 3, f_synID}, - {"synIDattr", 2, 3, f_synIDattr}, - {"synIDtrans", 1, 1, f_synIDtrans}, - {"synconcealed", 2, 2, f_synconcealed}, - {"synstack", 2, 2, f_synstack}, - {"system", 1, 2, f_system}, - {"systemlist", 1, 2, f_systemlist}, - {"tabpagebuflist", 0, 1, f_tabpagebuflist}, - {"tabpagenr", 0, 1, f_tabpagenr}, - {"tabpagewinnr", 1, 2, f_tabpagewinnr}, - {"tagfiles", 0, 0, f_tagfiles}, - {"taglist", 1, 1, f_taglist}, -#ifdef FEAT_FLOAT - {"tan", 1, 1, f_tan}, - {"tanh", 1, 1, f_tanh}, -#endif - {"tempname", 0, 0, f_tempname}, - {"test", 1, 1, f_test}, - {"tolower", 1, 1, f_tolower}, - {"toupper", 1, 1, f_toupper}, - {"tr", 3, 3, f_tr}, -#ifdef FEAT_FLOAT - {"trunc", 1, 1, f_trunc}, -#endif - {"type", 1, 1, f_type}, - {"undofile", 1, 1, f_undofile}, - {"undotree", 0, 0, f_undotree}, - {"uniq", 1, 3, f_uniq}, - {"values", 1, 1, f_values}, - {"virtcol", 1, 1, f_virtcol}, - {"visualmode", 0, 1, f_visualmode}, - {"wildmenumode", 0, 0, f_wildmenumode}, - {"winbufnr", 1, 1, f_winbufnr}, - {"wincol", 0, 0, f_wincol}, - {"winheight", 1, 1, f_winheight}, - {"winline", 0, 0, f_winline}, - {"winnr", 0, 1, f_winnr}, - {"winrestcmd", 0, 0, f_winrestcmd}, - {"winrestview", 1, 1, f_winrestview}, - {"winsaveview", 0, 0, f_winsaveview}, - {"winwidth", 1, 1, f_winwidth}, - {"writefile", 2, 3, f_writefile}, - {"xor", 2, 2, f_xor}, -}; - -#if defined(FEAT_CMDL_COMPL) || defined(PROTO) - -/* - * Function given to ExpandGeneric() to obtain the list of internal - * or user defined function names. - */ - char_u * -get_function_name(xp, idx) - expand_T *xp; - int idx; -{ - static int intidx = -1; - char_u *name; - - if (idx == 0) - intidx = -1; - if (intidx < 0) - { - name = get_user_func_name(xp, idx); - if (name != NULL) - return name; - } - if (++intidx < (int)(sizeof(functions) / sizeof(struct fst))) - { - STRCPY(IObuff, functions[intidx].f_name); - STRCAT(IObuff, "("); - if (functions[intidx].f_max_argc == 0) - STRCAT(IObuff, ")"); - return IObuff; - } - - return NULL; -} - -/* - * Function given to ExpandGeneric() to obtain the list of internal or - * user defined variable or function names. - */ - char_u * -get_expr_name(xp, idx) - expand_T *xp; - int idx; -{ - static int intidx = -1; - char_u *name; - - if (idx == 0) - intidx = -1; - if (intidx < 0) - { - name = get_function_name(xp, idx); - if (name != NULL) - return name; - } - return get_user_var_name(xp, ++intidx); -} - -#endif /* FEAT_CMDL_COMPL */ - -#if defined(EBCDIC) || defined(PROTO) -/* - * Compare struct fst by function name. - */ - static int -compare_func_name(s1, s2) - const void *s1; - const void *s2; -{ - struct fst *p1 = (struct fst *)s1; - struct fst *p2 = (struct fst *)s2; - - return STRCMP(p1->f_name, p2->f_name); -} - -/* - * Sort the function table by function name. - * The sorting of the table above is ASCII dependant. - * On machines using EBCDIC we have to sort it. - */ - static void -sortFunctions() -{ - int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1; - - qsort(functions, (size_t)funcCnt, sizeof(struct fst), compare_func_name); -} -#endif - - -/* - * Find internal function in table above. - * Return index, or -1 if not found - */ - static int -find_internal_func(name) - char_u *name; /* name of the function */ -{ - int first = 0; - int last = (int)(sizeof(functions) / sizeof(struct fst)) - 1; - int cmp; - int x; - - /* - * Find the function name in the table. Binary search. - */ - while (first <= last) - { - x = first + ((unsigned)(last - first) >> 1); - cmp = STRCMP(name, functions[x].f_name); - if (cmp < 0) - last = x - 1; - else if (cmp > 0) - first = x + 1; - else - return x; - } - return -1; -} - -/* - * Check if "name" is a variable of type VAR_FUNC. If so, return the function - * name it contains, otherwise return "name". - */ - static char_u * -deref_func_name(name, lenp, no_autoload) - char_u *name; - int *lenp; - int no_autoload; -{ - dictitem_T *v; - int cc; - - cc = name[*lenp]; - name[*lenp] = NUL; - v = find_var(name, NULL, no_autoload); - name[*lenp] = cc; - if (v != NULL && v->di_tv.v_type == VAR_FUNC) - { - if (v->di_tv.vval.v_string == NULL) - { - *lenp = 0; - return (char_u *)""; /* just in case */ - } - *lenp = (int)STRLEN(v->di_tv.vval.v_string); - return v->di_tv.vval.v_string; - } - - return name; -} - -/* - * Allocate a variable for the result of a function. - * Return OK or FAIL. - */ - static int -get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange, - evaluate, selfdict) - char_u *name; /* name of the function */ - int len; /* length of "name" */ - typval_T *rettv; - char_u **arg; /* argument, pointing to the '(' */ - linenr_T firstline; /* first line of range */ - linenr_T lastline; /* last line of range */ - int *doesrange; /* return: function handled range */ - int evaluate; - dict_T *selfdict; /* Dictionary for "self" */ -{ - char_u *argp; - int ret = OK; - typval_T argvars[MAX_FUNC_ARGS + 1]; /* vars for arguments */ - int argcount = 0; /* number of arguments found */ - - /* - * Get the arguments. - */ - argp = *arg; - while (argcount < MAX_FUNC_ARGS) - { - argp = skipwhite(argp + 1); /* skip the '(' or ',' */ - if (*argp == ')' || *argp == ',' || *argp == NUL) - break; - if (eval1(&argp, &argvars[argcount], evaluate) == FAIL) - { - ret = FAIL; - break; - } - ++argcount; - if (*argp != ',') - break; - } - if (*argp == ')') - ++argp; - else - ret = FAIL; - - if (ret == OK) - ret = call_func(name, len, rettv, argcount, argvars, - firstline, lastline, doesrange, evaluate, selfdict); - else if (!aborting()) - { - if (argcount == MAX_FUNC_ARGS) - emsg_funcname(N_("E740: Too many arguments for function %s"), name); - else - emsg_funcname(N_("E116: Invalid arguments for function %s"), name); - } - - while (--argcount >= 0) - clear_tv(&argvars[argcount]); - - *arg = skipwhite(argp); - return ret; -} - - -/* - * Call a function with its resolved parameters - * Return FAIL when the function can't be called, OK otherwise. - * Also returns OK when an error was encountered while executing the function. - */ - static int -call_func(funcname, len, rettv, argcount, argvars, firstline, lastline, - doesrange, evaluate, selfdict) - char_u *funcname; /* name of the function */ - int len; /* length of "name" */ - typval_T *rettv; /* return value goes here */ - int argcount; /* number of "argvars" */ - typval_T *argvars; /* vars for arguments, must have "argcount" - PLUS ONE elements! */ - linenr_T firstline; /* first line of range */ - linenr_T lastline; /* last line of range */ - int *doesrange; /* return: function handled range */ - int evaluate; - dict_T *selfdict; /* Dictionary for "self" */ -{ - int ret = FAIL; -#define ERROR_UNKNOWN 0 -#define ERROR_TOOMANY 1 -#define ERROR_TOOFEW 2 -#define ERROR_SCRIPT 3 -#define ERROR_DICT 4 -#define ERROR_NONE 5 -#define ERROR_OTHER 6 - int error = ERROR_NONE; - int i; - int llen; - ufunc_T *fp; -#define FLEN_FIXED 40 - char_u fname_buf[FLEN_FIXED + 1]; - char_u *fname; - char_u *name; - - /* Make a copy of the name, if it comes from a funcref variable it could - * be changed or deleted in the called function. */ - name = vim_strnsave(funcname, len); - if (name == NULL) - return ret; - - /* - * In a script change <SID>name() and s:name() to K_SNR 123_name(). - * Change <SNR>123_name() to K_SNR 123_name(). - * Use fname_buf[] when it fits, otherwise allocate memory (slow). - */ - llen = eval_fname_script(name); - if (llen > 0) - { - fname_buf[0] = K_SPECIAL; - fname_buf[1] = KS_EXTRA; - fname_buf[2] = (int)KE_SNR; - i = 3; - if (eval_fname_sid(name)) /* "<SID>" or "s:" */ - { - if (current_SID <= 0) - error = ERROR_SCRIPT; - else - { - sprintf((char *)fname_buf + 3, "%ld_", (long)current_SID); - i = (int)STRLEN(fname_buf); - } - } - if (i + STRLEN(name + llen) < FLEN_FIXED) - { - STRCPY(fname_buf + i, name + llen); - fname = fname_buf; - } - else - { - fname = alloc((unsigned)(i + STRLEN(name + llen) + 1)); - if (fname == NULL) - error = ERROR_OTHER; - else - { - mch_memmove(fname, fname_buf, (size_t)i); - STRCPY(fname + i, name + llen); - } - } - } - else - fname = name; - - *doesrange = FALSE; - - - /* execute the function if no errors detected and executing */ - if (evaluate && error == ERROR_NONE) - { - char_u *rfname = fname; - - /* Ignore "g:" before a function name. */ - if (fname[0] == 'g' && fname[1] == ':') - rfname = fname + 2; - - rettv->v_type = VAR_NUMBER; /* default rettv is number zero */ - rettv->vval.v_number = 0; - error = ERROR_UNKNOWN; - - if (!builtin_function(rfname, -1)) - { - /* - * User defined function. - */ - fp = find_func(rfname); - -#ifdef FEAT_AUTOCMD - /* Trigger FuncUndefined event, may load the function. */ - if (fp == NULL - && apply_autocmds(EVENT_FUNCUNDEFINED, - rfname, rfname, TRUE, NULL) - && !aborting()) - { - /* executed an autocommand, search for the function again */ - fp = find_func(rfname); - } -#endif - /* Try loading a package. */ - if (fp == NULL && script_autoload(rfname, TRUE) && !aborting()) - { - /* loaded a package, search for the function again */ - fp = find_func(rfname); - } - - if (fp != NULL) - { - if (fp->uf_flags & FC_RANGE) - *doesrange = TRUE; - if (argcount < fp->uf_args.ga_len) - error = ERROR_TOOFEW; - else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len) - error = ERROR_TOOMANY; - else if ((fp->uf_flags & FC_DICT) && selfdict == NULL) - error = ERROR_DICT; - else - { - /* - * Call the user function. - * Save and restore search patterns, script variables and - * redo buffer. - */ - save_search_patterns(); - saveRedobuff(); - ++fp->uf_calls; - call_user_func(fp, argcount, argvars, rettv, - firstline, lastline, - (fp->uf_flags & FC_DICT) ? selfdict : NULL); - if (--fp->uf_calls <= 0 && isdigit(*fp->uf_name) - && fp->uf_refcount <= 0) - /* Function was unreferenced while being used, free it - * now. */ - func_free(fp); - restoreRedobuff(); - restore_search_patterns(); - error = ERROR_NONE; - } - } - } - else - { - /* - * Find the function name in the table, call its implementation. - */ - i = find_internal_func(fname); - if (i >= 0) - { - if (argcount < functions[i].f_min_argc) - error = ERROR_TOOFEW; - else if (argcount > functions[i].f_max_argc) - error = ERROR_TOOMANY; - else - { - argvars[argcount].v_type = VAR_UNKNOWN; - functions[i].f_func(argvars, rettv); - error = ERROR_NONE; - } - } - } - /* - * The function call (or "FuncUndefined" autocommand sequence) might - * have been aborted by an error, an interrupt, or an explicitly thrown - * exception that has not been caught so far. This situation can be - * tested for by calling aborting(). For an error in an internal - * function or for the "E132" error in call_user_func(), however, the - * throw point at which the "force_abort" flag (temporarily reset by - * emsg()) is normally updated has not been reached yet. We need to - * update that flag first to make aborting() reliable. - */ - update_force_abort(); - } - if (error == ERROR_NONE) - ret = OK; - - /* - * Report an error unless the argument evaluation or function call has been - * cancelled due to an aborting error, an interrupt, or an exception. - */ - if (!aborting()) - { - switch (error) - { - case ERROR_UNKNOWN: - emsg_funcname(N_("E117: Unknown function: %s"), name); - break; - case ERROR_TOOMANY: - emsg_funcname(e_toomanyarg, name); - break; - case ERROR_TOOFEW: - emsg_funcname(N_("E119: Not enough arguments for function: %s"), - name); - break; - case ERROR_SCRIPT: - emsg_funcname(N_("E120: Using <SID> not in a script context: %s"), - name); - break; - case ERROR_DICT: - emsg_funcname(N_("E725: Calling dict function without Dictionary: %s"), - name); - break; - } - } - - if (fname != name && fname != fname_buf) - vim_free(fname); - vim_free(name); - - return ret; -} - -/* - * Give an error message with a function name. Handle <SNR> things. - * "ermsg" is to be passed without translation, use N_() instead of _(). - */ - static void -emsg_funcname(ermsg, name) - char *ermsg; - char_u *name; -{ - char_u *p; - - if (*name == K_SPECIAL) - p = concat_str((char_u *)"<SNR>", name + 3); - else - p = name; - EMSG2(_(ermsg), p); - if (p != name) - vim_free(p); -} - -/* - * Return TRUE for a non-zero Number and a non-empty String. - */ - static int -non_zero_arg(argvars) - typval_T *argvars; -{ - return ((argvars[0].v_type == VAR_NUMBER - && argvars[0].vval.v_number != 0) - || (argvars[0].v_type == VAR_STRING - && argvars[0].vval.v_string != NULL - && *argvars[0].vval.v_string != NUL)); -} - -/********************************************* - * Implementation of the built-in functions - */ - -#ifdef FEAT_FLOAT -static int get_float_arg __ARGS((typval_T *argvars, float_T *f)); - -/* - * Get the float value of "argvars[0]" into "f". - * Returns FAIL when the argument is not a Number or Float. - */ - static int -get_float_arg(argvars, f) - typval_T *argvars; - float_T *f; -{ - if (argvars[0].v_type == VAR_FLOAT) - { - *f = argvars[0].vval.v_float; - return OK; - } - if (argvars[0].v_type == VAR_NUMBER) - { - *f = (float_T)argvars[0].vval.v_number; - return OK; - } - EMSG(_("E808: Number or Float required")); - return FAIL; -} - -/* - * "abs(expr)" function - */ - static void -f_abs(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - if (argvars[0].v_type == VAR_FLOAT) - { - rettv->v_type = VAR_FLOAT; - rettv->vval.v_float = fabs(argvars[0].vval.v_float); - } - else - { - varnumber_T n; - int error = FALSE; - - n = get_tv_number_chk(&argvars[0], &error); - if (error) - rettv->vval.v_number = -1; - else if (n > 0) - rettv->vval.v_number = n; - else - rettv->vval.v_number = -n; - } -} - -/* - * "acos()" function - */ - static void -f_acos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = acos(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "add(list, item)" function - */ - static void -f_add(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - list_T *l; - - rettv->vval.v_number = 1; /* Default: Failed */ - if (argvars[0].v_type == VAR_LIST) - { - if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, (char_u *)_("add() argument")) - && list_append_tv(l, &argvars[1]) == OK) - copy_tv(&argvars[0], rettv); - } - else - EMSG(_(e_listreq)); -} - -/* - * "and(expr, expr)" function - */ - static void -f_and(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - & get_tv_number_chk(&argvars[1], NULL); -} - -/* - * "append(lnum, string/list)" function - */ - static void -f_append(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - long lnum; - char_u *line; - list_T *l = NULL; - listitem_T *li = NULL; - typval_T *tv; - long added = 0; - - /* When coming here from Insert mode, sync undo, so that this can be - * undone separately from what was previously inserted. */ - if (u_sync_once == 2) - { - u_sync_once = 1; /* notify that u_sync() was called */ - u_sync(TRUE); - } - - lnum = get_tv_lnum(argvars); - if (lnum >= 0 - && lnum <= curbuf->b_ml.ml_line_count - && u_save(lnum, lnum + 1) == OK) - { - if (argvars[1].v_type == VAR_LIST) - { - l = argvars[1].vval.v_list; - if (l == NULL) - return; - li = l->lv_first; - } - for (;;) - { - if (l == NULL) - tv = &argvars[1]; /* append a string */ - else if (li == NULL) - break; /* end of list */ - else - tv = &li->li_tv; /* append item from list */ - line = get_tv_string_chk(tv); - if (line == NULL) /* type error */ - { - rettv->vval.v_number = 1; /* Failed */ - break; - } - ml_append(lnum + added, line, (colnr_T)0, FALSE); - ++added; - if (l == NULL) - break; - li = li->li_next; - } - - appended_lines_mark(lnum, added); - if (curwin->w_cursor.lnum > lnum) - curwin->w_cursor.lnum += added; - } - else - rettv->vval.v_number = 1; /* Failed */ -} - -/* - * "argc()" function - */ - static void -f_argc(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = ARGCOUNT; -} - -/* - * "argidx()" function - */ - static void -f_argidx(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = curwin->w_arg_idx; -} - -/* - * "arglistid()" function - */ - static void -f_arglistid(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - win_T *wp; - tabpage_T *tp = NULL; - long n; - - rettv->vval.v_number = -1; - if (argvars[0].v_type != VAR_UNKNOWN) - { - if (argvars[1].v_type != VAR_UNKNOWN) - { - n = get_tv_number(&argvars[1]); - if (n >= 0) - tp = find_tabpage(n); - } - else - tp = curtab; - - if (tp != NULL) - { - wp = find_win_by_nr(&argvars[0], tp); - if (wp != NULL) - rettv->vval.v_number = wp->w_alist->id; - } - } - else - rettv->vval.v_number = curwin->w_alist->id; -} - -/* - * "argv(nr)" function - */ - static void -f_argv(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int idx; - - if (argvars[0].v_type != VAR_UNKNOWN) - { - idx = get_tv_number_chk(&argvars[0], NULL); - if (idx >= 0 && idx < ARGCOUNT) - rettv->vval.v_string = vim_strsave(alist_name(&ARGLIST[idx])); - else - rettv->vval.v_string = NULL; - rettv->v_type = VAR_STRING; - } - else if (rettv_list_alloc(rettv) == OK) - for (idx = 0; idx < ARGCOUNT; ++idx) - list_append_string(rettv->vval.v_list, - alist_name(&ARGLIST[idx]), -1); -} - -#ifdef FEAT_FLOAT -/* - * "asin()" function - */ - static void -f_asin(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = asin(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "atan()" function - */ - static void -f_atan(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = atan(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "atan2()" function - */ - static void -f_atan2(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T fx, fy; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &fx) == OK - && get_float_arg(&argvars[1], &fy) == OK) - rettv->vval.v_float = atan2(fx, fy); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "browse(save, title, initdir, default)" function - */ - static void -f_browse(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_BROWSE - int save; - char_u *title; - char_u *initdir; - char_u *defname; - char_u buf[NUMBUFLEN]; - char_u buf2[NUMBUFLEN]; - int error = FALSE; - - save = get_tv_number_chk(&argvars[0], &error); - title = get_tv_string_chk(&argvars[1]); - initdir = get_tv_string_buf_chk(&argvars[2], buf); - defname = get_tv_string_buf_chk(&argvars[3], buf2); - - if (error || title == NULL || initdir == NULL || defname == NULL) - rettv->vval.v_string = NULL; - else - rettv->vval.v_string = - do_browse(save ? BROWSE_SAVE : 0, - title, defname, NULL, initdir, NULL, curbuf); -#else - rettv->vval.v_string = NULL; -#endif - rettv->v_type = VAR_STRING; -} - -/* - * "browsedir(title, initdir)" function - */ - static void -f_browsedir(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_BROWSE - char_u *title; - char_u *initdir; - char_u buf[NUMBUFLEN]; - - title = get_tv_string_chk(&argvars[0]); - initdir = get_tv_string_buf_chk(&argvars[1], buf); - - if (title == NULL || initdir == NULL) - rettv->vval.v_string = NULL; - else - rettv->vval.v_string = do_browse(BROWSE_DIR, - title, NULL, NULL, initdir, NULL, curbuf); -#else - rettv->vval.v_string = NULL; -#endif - rettv->v_type = VAR_STRING; -} - -static buf_T *find_buffer __ARGS((typval_T *avar)); - -/* - * Find a buffer by number or exact name. - */ - static buf_T * -find_buffer(avar) - typval_T *avar; -{ - buf_T *buf = NULL; - - if (avar->v_type == VAR_NUMBER) - buf = buflist_findnr((int)avar->vval.v_number); - else if (avar->v_type == VAR_STRING && avar->vval.v_string != NULL) - { - buf = buflist_findname_exp(avar->vval.v_string); - if (buf == NULL) - { - /* No full path name match, try a match with a URL or a "nofile" - * buffer, these don't use the full path. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_fname != NULL - && (path_with_url(buf->b_fname) -#ifdef FEAT_QUICKFIX - || bt_nofile(buf) -#endif - ) - && STRCMP(buf->b_fname, avar->vval.v_string) == 0) - break; - } - } - return buf; -} - -/* - * "bufexists(expr)" function - */ - static void -f_bufexists(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = (find_buffer(&argvars[0]) != NULL); -} - -/* - * "buflisted(expr)" function - */ - static void -f_buflisted(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - buf_T *buf; - - buf = find_buffer(&argvars[0]); - rettv->vval.v_number = (buf != NULL && buf->b_p_bl); -} - -/* - * "bufloaded(expr)" function - */ - static void -f_bufloaded(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - buf_T *buf; - - buf = find_buffer(&argvars[0]); - rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL); -} - -static buf_T *get_buf_tv __ARGS((typval_T *tv, int curtab_only)); - -/* - * Get buffer by number or pattern. - */ - static buf_T * -get_buf_tv(tv, curtab_only) - typval_T *tv; - int curtab_only; -{ - char_u *name = tv->vval.v_string; - int save_magic; - char_u *save_cpo; - buf_T *buf; - - if (tv->v_type == VAR_NUMBER) - return buflist_findnr((int)tv->vval.v_number); - if (tv->v_type != VAR_STRING) - return NULL; - if (name == NULL || *name == NUL) - return curbuf; - if (name[0] == '$' && name[1] == NUL) - return lastbuf; - - /* Ignore 'magic' and 'cpoptions' here to make scripts portable */ - save_magic = p_magic; - p_magic = TRUE; - save_cpo = p_cpo; - p_cpo = (char_u *)""; - - buf = buflist_findnr(buflist_findpat(name, name + STRLEN(name), - TRUE, FALSE, curtab_only)); - - p_magic = save_magic; - p_cpo = save_cpo; - - /* If not found, try expanding the name, like done for bufexists(). */ - if (buf == NULL) - buf = find_buffer(tv); - - return buf; -} - -/* - * "bufname(expr)" function - */ - static void -f_bufname(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - buf_T *buf; - - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - ++emsg_off; - buf = get_buf_tv(&argvars[0], FALSE); - rettv->v_type = VAR_STRING; - if (buf != NULL && buf->b_fname != NULL) - rettv->vval.v_string = vim_strsave(buf->b_fname); - else - rettv->vval.v_string = NULL; - --emsg_off; -} - -/* - * "bufnr(expr)" function - */ - static void -f_bufnr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - buf_T *buf; - int error = FALSE; - char_u *name; - - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - ++emsg_off; - buf = get_buf_tv(&argvars[0], FALSE); - --emsg_off; - - /* If the buffer isn't found and the second argument is not zero create a - * new buffer. */ - if (buf == NULL - && argvars[1].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[1], &error) != 0 - && !error - && (name = get_tv_string_chk(&argvars[0])) != NULL - && !error) - buf = buflist_new(name, NULL, (linenr_T)1, 0); - - if (buf != NULL) - rettv->vval.v_number = buf->b_fnum; - else - rettv->vval.v_number = -1; -} - -/* - * "bufwinnr(nr)" function - */ - static void -f_bufwinnr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ -#ifdef FEAT_WINDOWS - win_T *wp; - int winnr = 0; -#endif - buf_T *buf; - - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - ++emsg_off; - buf = get_buf_tv(&argvars[0], TRUE); -#ifdef FEAT_WINDOWS - for (wp = firstwin; wp; wp = wp->w_next) - { - ++winnr; - if (wp->w_buffer == buf) - break; - } - rettv->vval.v_number = (wp != NULL ? winnr : -1); -#else - rettv->vval.v_number = (curwin->w_buffer == buf ? 1 : -1); -#endif - --emsg_off; -} - -/* - * "byte2line(byte)" function - */ - static void -f_byte2line(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifndef FEAT_BYTEOFF - rettv->vval.v_number = -1; -#else - long boff = 0; - - boff = get_tv_number(&argvars[0]) - 1; /* boff gets -1 on type error */ - if (boff < 0) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = ml_find_line_or_offset(curbuf, - (linenr_T)0, &boff); -#endif -} - - static void -byteidx(argvars, rettv, comp) - typval_T *argvars; - typval_T *rettv; - int comp UNUSED; -{ -#ifdef FEAT_MBYTE - char_u *t; -#endif - char_u *str; - long idx; - - str = get_tv_string_chk(&argvars[0]); - idx = get_tv_number_chk(&argvars[1], NULL); - rettv->vval.v_number = -1; - if (str == NULL || idx < 0) - return; - -#ifdef FEAT_MBYTE - t = str; - for ( ; idx > 0; idx--) - { - if (*t == NUL) /* EOL reached */ - return; - if (enc_utf8 && comp) - t += utf_ptr2len(t); - else - t += (*mb_ptr2len)(t); - } - rettv->vval.v_number = (varnumber_T)(t - str); -#else - if ((size_t)idx <= STRLEN(str)) - rettv->vval.v_number = idx; -#endif -} - -/* - * "byteidx()" function - */ - static void -f_byteidx(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - byteidx(argvars, rettv, FALSE); -} - -/* - * "byteidxcomp()" function - */ - static void -f_byteidxcomp(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - byteidx(argvars, rettv, TRUE); -} - - int -func_call(name, args, selfdict, rettv) - char_u *name; - typval_T *args; - dict_T *selfdict; - typval_T *rettv; -{ - listitem_T *item; - typval_T argv[MAX_FUNC_ARGS + 1]; - int argc = 0; - int dummy; - int r = 0; - - for (item = args->vval.v_list->lv_first; item != NULL; - item = item->li_next) - { - if (argc == MAX_FUNC_ARGS) - { - EMSG(_("E699: Too many arguments")); - break; - } - /* Make a copy of each argument. This is needed to be able to set - * v_lock to VAR_FIXED in the copy without changing the original list. - */ - copy_tv(&item->li_tv, &argv[argc++]); - } - - if (item == NULL) - r = call_func(name, (int)STRLEN(name), rettv, argc, argv, - curwin->w_cursor.lnum, curwin->w_cursor.lnum, - &dummy, TRUE, selfdict); - - /* Free the arguments. */ - while (argc > 0) - clear_tv(&argv[--argc]); - - return r; -} - -/* - * "call(func, arglist)" function - */ - static void -f_call(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *func; - dict_T *selfdict = NULL; - - if (argvars[1].v_type != VAR_LIST) - { - EMSG(_(e_listreq)); - return; - } - if (argvars[1].vval.v_list == NULL) - return; - - if (argvars[0].v_type == VAR_FUNC) - func = argvars[0].vval.v_string; - else - func = get_tv_string(&argvars[0]); - if (*func == NUL) - return; /* type error or empty name */ - - if (argvars[2].v_type != VAR_UNKNOWN) - { - if (argvars[2].v_type != VAR_DICT) - { - EMSG(_(e_dictreq)); - return; - } - selfdict = argvars[2].vval.v_dict; - } - - (void)func_call(func, &argvars[1], selfdict, rettv); -} - -#ifdef FEAT_FLOAT -/* - * "ceil({float})" function - */ - static void -f_ceil(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = ceil(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "changenr()" function - */ - static void -f_changenr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = curbuf->b_u_seq_cur; -} - -/* - * "char2nr(string)" function - */ - static void -f_char2nr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ -#ifdef FEAT_MBYTE - if (has_mbyte) - { - int utf8 = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) - utf8 = get_tv_number_chk(&argvars[1], NULL); - - if (utf8) - rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0])); - else - rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0])); - } - else -#endif - rettv->vval.v_number = get_tv_string(&argvars[0])[0]; -} - -/* - * "cindent(lnum)" function - */ - static void -f_cindent(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_CINDENT - pos_T pos; - linenr_T lnum; - - pos = curwin->w_cursor; - lnum = get_tv_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - { - curwin->w_cursor.lnum = lnum; - rettv->vval.v_number = get_c_indent(); - curwin->w_cursor = pos; - } - else -#endif - rettv->vval.v_number = -1; -} - -/* - * "clearmatches()" function - */ - static void -f_clearmatches(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - clear_matches(curwin); -#endif -} - -/* - * "col(string)" function - */ - static void -f_col(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - colnr_T col = 0; - pos_T *fp; - int fnum = curbuf->b_fnum; - - fp = var2fpos(&argvars[0], FALSE, &fnum); - if (fp != NULL && fnum == curbuf->b_fnum) - { - if (fp->col == MAXCOL) - { - /* '> can be MAXCOL, get the length of the line then */ - if (fp->lnum <= curbuf->b_ml.ml_line_count) - col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1; - else - col = MAXCOL; - } - else - { - col = fp->col + 1; -#ifdef FEAT_VIRTUALEDIT - /* col(".") when the cursor is on the NUL at the end of the line - * because of "coladd" can be seen as an extra column. */ - if (virtual_active() && fp == &curwin->w_cursor) - { - char_u *p = ml_get_cursor(); - - if (curwin->w_cursor.coladd >= (colnr_T)chartabsize(p, - curwin->w_virtcol - curwin->w_cursor.coladd)) - { -# ifdef FEAT_MBYTE - int l; - - if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL) - col += l; -# else - if (*p != NUL && p[1] == NUL) - ++col; -# endif - } - } -#endif - } - } - rettv->vval.v_number = col; -} - -#if defined(FEAT_INS_EXPAND) -/* - * "complete()" function - */ - static void -f_complete(argvars, rettv) - typval_T *argvars; - typval_T *rettv UNUSED; -{ - int startcol; - - if ((State & INSERT) == 0) - { - EMSG(_("E785: complete() can only be used in Insert mode")); - return; - } - - /* Check for undo allowed here, because if something was already inserted - * the line was already saved for undo and this check isn't done. */ - if (!undo_allowed()) - return; - - if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) - { - EMSG(_(e_invarg)); - return; - } - - startcol = get_tv_number_chk(&argvars[0], NULL); - if (startcol <= 0) - return; - - set_completion(startcol - 1, argvars[1].vval.v_list); -} - -/* - * "complete_add()" function - */ - static void -f_complete_add(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0); -} - -/* - * "complete_check()" function - */ - static void -f_complete_check(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int saved = RedrawingDisabled; - - RedrawingDisabled = 0; - ins_compl_check_keys(0); - rettv->vval.v_number = compl_interrupted; - RedrawingDisabled = saved; -} -#endif - -/* - * "confirm(message, buttons[, default [, type]])" function - */ - static void -f_confirm(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) - char_u *message; - char_u *buttons = NULL; - char_u buf[NUMBUFLEN]; - char_u buf2[NUMBUFLEN]; - int def = 1; - int type = VIM_GENERIC; - char_u *typestr; - int error = FALSE; - - message = get_tv_string_chk(&argvars[0]); - if (message == NULL) - error = TRUE; - if (argvars[1].v_type != VAR_UNKNOWN) - { - buttons = get_tv_string_buf_chk(&argvars[1], buf); - if (buttons == NULL) - error = TRUE; - if (argvars[2].v_type != VAR_UNKNOWN) - { - def = get_tv_number_chk(&argvars[2], &error); - if (argvars[3].v_type != VAR_UNKNOWN) - { - typestr = get_tv_string_buf_chk(&argvars[3], buf2); - if (typestr == NULL) - error = TRUE; - else - { - switch (TOUPPER_ASC(*typestr)) - { - case 'E': type = VIM_ERROR; break; - case 'Q': type = VIM_QUESTION; break; - case 'I': type = VIM_INFO; break; - case 'W': type = VIM_WARNING; break; - case 'G': type = VIM_GENERIC; break; - } - } - } - } - } - - if (buttons == NULL || *buttons == NUL) - buttons = (char_u *)_("&Ok"); - - if (!error) - rettv->vval.v_number = do_dialog(type, NULL, message, buttons, - def, NULL, FALSE); -#endif -} - -/* - * "copy()" function - */ - static void -f_copy(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - item_copy(&argvars[0], rettv, FALSE, 0); -} - -#ifdef FEAT_FLOAT -/* - * "cos()" function - */ - static void -f_cos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = cos(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "cosh()" function - */ - static void -f_cosh(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = cosh(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "count()" function - */ - static void -f_count(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - long n = 0; - int ic = FALSE; - - if (argvars[0].v_type == VAR_LIST) - { - listitem_T *li; - list_T *l; - long idx; - - if ((l = argvars[0].vval.v_list) != NULL) - { - li = l->lv_first; - if (argvars[2].v_type != VAR_UNKNOWN) - { - int error = FALSE; - - ic = get_tv_number_chk(&argvars[2], &error); - if (argvars[3].v_type != VAR_UNKNOWN) - { - idx = get_tv_number_chk(&argvars[3], &error); - if (!error) - { - li = list_find(l, idx); - if (li == NULL) - EMSGN(_(e_listidx), idx); - } - } - if (error) - li = NULL; - } - - for ( ; li != NULL; li = li->li_next) - if (tv_equal(&li->li_tv, &argvars[1], ic, FALSE)) - ++n; - } - } - else if (argvars[0].v_type == VAR_DICT) - { - int todo; - dict_T *d; - hashitem_T *hi; - - if ((d = argvars[0].vval.v_dict) != NULL) - { - int error = FALSE; - - if (argvars[2].v_type != VAR_UNKNOWN) - { - ic = get_tv_number_chk(&argvars[2], &error); - if (argvars[3].v_type != VAR_UNKNOWN) - EMSG(_(e_invarg)); - } - - todo = error ? 0 : (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic, FALSE)) - ++n; - } - } - } - } - else - EMSG2(_(e_listdictarg), "count()"); - rettv->vval.v_number = n; -} - -/* - * "cscope_connection([{num} , {dbpath} [, {prepend}]])" function - * - * Checks the existence of a cscope connection. - */ - static void -f_cscope_connection(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_CSCOPE - int num = 0; - char_u *dbpath = NULL; - char_u *prepend = NULL; - char_u buf[NUMBUFLEN]; - - if (argvars[0].v_type != VAR_UNKNOWN - && argvars[1].v_type != VAR_UNKNOWN) - { - num = (int)get_tv_number(&argvars[0]); - dbpath = get_tv_string(&argvars[1]); - if (argvars[2].v_type != VAR_UNKNOWN) - prepend = get_tv_string_buf(&argvars[2], buf); - } - - rettv->vval.v_number = cs_connection(num, dbpath, prepend); -#endif -} - -/* - * "cursor(lnum, col)" function - * - * Moves the cursor to the specified line and column. - * Returns 0 when the position could be set, -1 otherwise. - */ - static void -f_cursor(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - long line, col; -#ifdef FEAT_VIRTUALEDIT - long coladd = 0; -#endif - - rettv->vval.v_number = -1; - if (argvars[1].v_type == VAR_UNKNOWN) - { - pos_T pos; - colnr_T curswant = -1; - - if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) - return; - line = pos.lnum; - col = pos.col; -#ifdef FEAT_VIRTUALEDIT - coladd = pos.coladd; -#endif - if (curswant >= 0) - curwin->w_curswant = curswant - 1; - } - else - { - line = get_tv_lnum(argvars); - col = get_tv_number_chk(&argvars[1], NULL); -#ifdef FEAT_VIRTUALEDIT - if (argvars[2].v_type != VAR_UNKNOWN) - coladd = get_tv_number_chk(&argvars[2], NULL); -#endif - } - if (line < 0 || col < 0 -#ifdef FEAT_VIRTUALEDIT - || coladd < 0 -#endif - ) - return; /* type error; errmsg already given */ - if (line > 0) - curwin->w_cursor.lnum = line; - if (col > 0) - curwin->w_cursor.col = col - 1; -#ifdef FEAT_VIRTUALEDIT - curwin->w_cursor.coladd = coladd; -#endif - - /* Make sure the cursor is in a valid position. */ - check_cursor(); -#ifdef FEAT_MBYTE - /* Correct cursor for multi-byte character. */ - if (has_mbyte) - mb_adjust_cursor(); -#endif - - curwin->w_set_curswant = TRUE; - rettv->vval.v_number = 0; -} - -/* - * "deepcopy()" function - */ - static void -f_deepcopy(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int noref = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) - noref = get_tv_number_chk(&argvars[1], NULL); - if (noref < 0 || noref > 1) - EMSG(_(e_invarg)); - else - { - current_copyID += COPYID_INC; - item_copy(&argvars[0], rettv, TRUE, noref == 0 ? current_copyID : 0); - } -} - -/* - * "delete()" function - */ - static void -f_delete(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - if (check_restricted() || check_secure()) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = mch_remove(get_tv_string(&argvars[0])); -} - -/* - * "did_filetype()" function - */ - static void -f_did_filetype(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_AUTOCMD - rettv->vval.v_number = did_filetype; -#endif -} - -/* - * "diff_filler()" function - */ - static void -f_diff_filler(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_DIFF - rettv->vval.v_number = diff_check_fill(curwin, get_tv_lnum(argvars)); -#endif -} - -/* - * "diff_hlID()" function - */ - static void -f_diff_hlID(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_DIFF - linenr_T lnum = get_tv_lnum(argvars); - static linenr_T prev_lnum = 0; - static int changedtick = 0; - static int fnum = 0; - static int change_start = 0; - static int change_end = 0; - static hlf_T hlID = (hlf_T)0; - int filler_lines; - int col; - - if (lnum < 0) /* ignore type error in {lnum} arg */ - lnum = 0; - if (lnum != prev_lnum - || changedtick != curbuf->b_changedtick - || fnum != curbuf->b_fnum) - { - /* New line, buffer, change: need to get the values. */ - filler_lines = diff_check(curwin, lnum); - if (filler_lines < 0) - { - if (filler_lines == -1) - { - change_start = MAXCOL; - change_end = -1; - if (diff_find_change(curwin, lnum, &change_start, &change_end)) - hlID = HLF_ADD; /* added line */ - else - hlID = HLF_CHD; /* changed line */ - } - else - hlID = HLF_ADD; /* added line */ - } - else - hlID = (hlf_T)0; - prev_lnum = lnum; - changedtick = curbuf->b_changedtick; - fnum = curbuf->b_fnum; - } - - if (hlID == HLF_CHD || hlID == HLF_TXD) - { - col = get_tv_number(&argvars[1]) - 1; /* ignore type error in {col} */ - if (col >= change_start && col <= change_end) - hlID = HLF_TXD; /* changed text */ - else - hlID = HLF_CHD; /* changed line */ - } - rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID; -#endif -} - -/* - * "empty({expr})" function - */ - static void -f_empty(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int n; - - switch (argvars[0].v_type) - { - case VAR_STRING: - case VAR_FUNC: - n = argvars[0].vval.v_string == NULL - || *argvars[0].vval.v_string == NUL; - break; - case VAR_NUMBER: - n = argvars[0].vval.v_number == 0; - break; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - n = argvars[0].vval.v_float == 0.0; - break; -#endif - case VAR_LIST: - n = argvars[0].vval.v_list == NULL - || argvars[0].vval.v_list->lv_first == NULL; - break; - case VAR_DICT: - n = argvars[0].vval.v_dict == NULL - || argvars[0].vval.v_dict->dv_hashtab.ht_used == 0; - break; - default: - EMSG2(_(e_intern2), "f_empty()"); - n = 0; - } - - rettv->vval.v_number = n; -} - -/* - * "escape({string}, {chars})" function - */ - static void -f_escape(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[NUMBUFLEN]; - - rettv->vval.v_string = vim_strsave_escaped(get_tv_string(&argvars[0]), - get_tv_string_buf(&argvars[1], buf)); - rettv->v_type = VAR_STRING; -} - -/* - * "eval()" function - */ - static void -f_eval(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s; - - s = get_tv_string_chk(&argvars[0]); - if (s != NULL) - s = skipwhite(s); - - if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) - { - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = 0; - } - else if (*s != NUL) - EMSG(_(e_trailing)); -} - -/* - * "eventhandler()" function - */ - static void -f_eventhandler(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = vgetc_busy; -} - -/* - * "executable()" function - */ - static void -f_executable(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = mch_can_exe(get_tv_string(&argvars[0]), NULL); -} - -/* - * "exepath()" function - */ - static void -f_exepath(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p = NULL; - - (void)mch_can_exe(get_tv_string(&argvars[0]), &p); - rettv->v_type = VAR_STRING; - rettv->vval.v_string = p; -} - -/* - * "exists()" function - */ - static void -f_exists(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - char_u *name; - int n = FALSE; - int len = 0; - - p = get_tv_string(&argvars[0]); - if (*p == '$') /* environment variable */ - { - /* first try "normal" environment variables (fast) */ - if (mch_getenv(p + 1) != NULL) - n = TRUE; - else - { - /* try expanding things like $VIM and ${HOME} */ - p = expand_env_save(p); - if (p != NULL && *p != '$') - n = TRUE; - vim_free(p); - } - } - else if (*p == '&' || *p == '+') /* option */ - { - n = (get_option_tv(&p, NULL, TRUE) == OK); - if (*skipwhite(p) != NUL) - n = FALSE; /* trailing garbage */ - } - else if (*p == '*') /* internal or user defined function */ - { - n = function_exists(p + 1); - } - else if (*p == ':') - { - n = cmd_exists(p + 1); - } - else if (*p == '#') - { -#ifdef FEAT_AUTOCMD - if (p[1] == '#') - n = autocmd_supported(p + 2); - else - n = au_exists(p + 1); -#endif - } - else /* internal variable */ - { - char_u *tofree; - typval_T tv; - - /* get_name_len() takes care of expanding curly braces */ - name = p; - len = get_name_len(&p, &tofree, TRUE, FALSE); - if (len > 0) - { - if (tofree != NULL) - name = tofree; - n = (get_var_tv(name, len, &tv, FALSE, TRUE) == OK); - if (n) - { - /* handle d.key, l[idx], f(expr) */ - n = (handle_subscript(&p, &tv, TRUE, FALSE) == OK); - if (n) - clear_tv(&tv); - } - } - if (*p != NUL) - n = FALSE; - - vim_free(tofree); - } - - rettv->vval.v_number = n; -} - -#ifdef FEAT_FLOAT -/* - * "exp()" function - */ - static void -f_exp(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = exp(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "expand()" function - */ - static void -f_expand(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s; - int len; - char_u *errormsg; - int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND; - expand_T xpc; - int error = FALSE; - char_u *result; - - rettv->v_type = VAR_STRING; - if (argvars[1].v_type != VAR_UNKNOWN - && argvars[2].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[2], &error) - && !error) - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; - } - - s = get_tv_string(&argvars[0]); - if (*s == '%' || *s == '#' || *s == '<') - { - ++emsg_off; - result = eval_vars(s, s, &len, NULL, &errormsg, NULL); - --emsg_off; - if (rettv->v_type == VAR_LIST) - { - if (rettv_list_alloc(rettv) != FAIL && result != NULL) - list_append_string(rettv->vval.v_list, result, -1); - else - vim_free(result); - } - else - rettv->vval.v_string = result; - } - else - { - /* When the optional second argument is non-zero, don't remove matches - * for 'wildignore' and don't put matches for 'suffixes' at the end. */ - if (argvars[1].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[1], &error)) - options |= WILD_KEEP_ALL; - if (!error) - { - ExpandInit(&xpc); - xpc.xp_context = EXPAND_FILES; - if (p_wic) - options += WILD_ICASE; - if (rettv->v_type == VAR_STRING) - rettv->vval.v_string = ExpandOne(&xpc, s, NULL, - options, WILD_ALL); - else if (rettv_list_alloc(rettv) != FAIL) - { - int i; - - ExpandOne(&xpc, s, NULL, options, WILD_ALL_KEEP); - for (i = 0; i < xpc.xp_numfiles; i++) - list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); - ExpandCleanup(&xpc); - } - } - else - rettv->vval.v_string = NULL; - } -} - -/* - * Go over all entries in "d2" and add them to "d1". - * When "action" is "error" then a duplicate key is an error. - * When "action" is "force" then a duplicate key is overwritten. - * Otherwise duplicate keys are ignored ("action" is "keep"). - */ - void -dict_extend(d1, d2, action) - dict_T *d1; - dict_T *d2; - char_u *action; -{ - dictitem_T *di1; - hashitem_T *hi2; - int todo; - - todo = (int)d2->dv_hashtab.ht_used; - for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) - { - if (!HASHITEM_EMPTY(hi2)) - { - --todo; - di1 = dict_find(d1, hi2->hi_key, -1); - if (d1->dv_scope != 0) - { - /* Disallow replacing a builtin function in l: and g:. - * Check the key to be valid when adding to any - * scope. */ - if (d1->dv_scope == VAR_DEF_SCOPE - && HI2DI(hi2)->di_tv.v_type == VAR_FUNC - && var_check_func_name(hi2->hi_key, - di1 == NULL)) - break; - if (!valid_varname(hi2->hi_key)) - break; - } - if (di1 == NULL) - { - di1 = dictitem_copy(HI2DI(hi2)); - if (di1 != NULL && dict_add(d1, di1) == FAIL) - dictitem_free(di1); - } - else if (*action == 'e') - { - EMSG2(_("E737: Key already exists: %s"), hi2->hi_key); - break; - } - else if (*action == 'f' && HI2DI(hi2) != di1) - { - clear_tv(&di1->di_tv); - copy_tv(&HI2DI(hi2)->di_tv, &di1->di_tv); - } - } - } -} - -/* - * "extend(list, list [, idx])" function - * "extend(dict, dict [, action])" function - */ - static void -f_extend(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char *arg_errmsg = N_("extend() argument"); - - if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST) - { - list_T *l1, *l2; - listitem_T *item; - long before; - int error = FALSE; - - l1 = argvars[0].vval.v_list; - l2 = argvars[1].vval.v_list; - if (l1 != NULL && !tv_check_lock(l1->lv_lock, (char_u *)_(arg_errmsg)) - && l2 != NULL) - { - if (argvars[2].v_type != VAR_UNKNOWN) - { - before = get_tv_number_chk(&argvars[2], &error); - if (error) - return; /* type error; errmsg already given */ - - if (before == l1->lv_len) - item = NULL; - else - { - item = list_find(l1, before); - if (item == NULL) - { - EMSGN(_(e_listidx), before); - return; - } - } - } - else - item = NULL; - list_extend(l1, l2, item); - - copy_tv(&argvars[0], rettv); - } - } - else if (argvars[0].v_type == VAR_DICT && argvars[1].v_type == VAR_DICT) - { - dict_T *d1, *d2; - char_u *action; - int i; - - d1 = argvars[0].vval.v_dict; - d2 = argvars[1].vval.v_dict; - if (d1 != NULL && !tv_check_lock(d1->dv_lock, (char_u *)_(arg_errmsg)) - && d2 != NULL) - { - /* Check the third argument. */ - if (argvars[2].v_type != VAR_UNKNOWN) - { - static char *(av[]) = {"keep", "force", "error"}; - - action = get_tv_string_chk(&argvars[2]); - if (action == NULL) - return; /* type error; errmsg already given */ - for (i = 0; i < 3; ++i) - if (STRCMP(action, av[i]) == 0) - break; - if (i == 3) - { - EMSG2(_(e_invarg2), action); - return; - } - } - else - action = (char_u *)"force"; - - dict_extend(d1, d2, action); - - copy_tv(&argvars[0], rettv); - } - } - else - EMSG2(_(e_listdictarg), "extend()"); -} - -/* - * "feedkeys()" function - */ - static void -f_feedkeys(argvars, rettv) - typval_T *argvars; - typval_T *rettv UNUSED; -{ - int remap = TRUE; - char_u *keys, *flags; - char_u nbuf[NUMBUFLEN]; - int typed = FALSE; - char_u *keys_esc; - - /* This is not allowed in the sandbox. If the commands would still be - * executed in the sandbox it would be OK, but it probably happens later, - * when "sandbox" is no longer set. */ - if (check_secure()) - return; - - keys = get_tv_string(&argvars[0]); - if (*keys != NUL) - { - if (argvars[1].v_type != VAR_UNKNOWN) - { - flags = get_tv_string_buf(&argvars[1], nbuf); - for ( ; *flags != NUL; ++flags) - { - switch (*flags) - { - case 'n': remap = FALSE; break; - case 'm': remap = TRUE; break; - case 't': typed = TRUE; break; - } - } - } - - /* Need to escape K_SPECIAL and CSI before putting the string in the - * typeahead buffer. */ - keys_esc = vim_strsave_escape_csi(keys); - if (keys_esc != NULL) - { - ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), - typebuf.tb_len, !typed, FALSE); - vim_free(keys_esc); - if (vgetc_busy) - typebuf_was_filled = TRUE; - } - } -} - -/* - * "filereadable()" function - */ - static void -f_filereadable(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int fd; - char_u *p; - int n; - -#ifndef O_NONBLOCK -# define O_NONBLOCK 0 -#endif - p = get_tv_string(&argvars[0]); - if (*p && !mch_isdir(p) && (fd = mch_open((char *)p, - O_RDONLY | O_NONBLOCK, 0)) >= 0) - { - n = TRUE; - close(fd); - } - else - n = FALSE; - - rettv->vval.v_number = n; -} - -/* - * Return 0 for not writable, 1 for writable file, 2 for a dir which we have - * rights to write into. - */ - static void -f_filewritable(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = filewritable(get_tv_string(&argvars[0])); -} - -static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int find_what)); - - static void -findfilendir(argvars, rettv, find_what) - typval_T *argvars UNUSED; - typval_T *rettv; - int find_what UNUSED; -{ -#ifdef FEAT_SEARCHPATH - char_u *fname; - char_u *fresult = NULL; - char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; - char_u *p; - char_u pathbuf[NUMBUFLEN]; - int count = 1; - int first = TRUE; - int error = FALSE; -#endif - - rettv->vval.v_string = NULL; - rettv->v_type = VAR_STRING; - -#ifdef FEAT_SEARCHPATH - fname = get_tv_string(&argvars[0]); - - if (argvars[1].v_type != VAR_UNKNOWN) - { - p = get_tv_string_buf_chk(&argvars[1], pathbuf); - if (p == NULL) - error = TRUE; - else - { - if (*p != NUL) - path = p; - - if (argvars[2].v_type != VAR_UNKNOWN) - count = get_tv_number_chk(&argvars[2], &error); - } - } - - if (count < 0 && rettv_list_alloc(rettv) == FAIL) - error = TRUE; - - if (*fname != NUL && !error) - { - do - { - if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST) - vim_free(fresult); - fresult = find_file_in_path_option(first ? fname : NULL, - first ? (int)STRLEN(fname) : 0, - 0, first, path, - find_what, - curbuf->b_ffname, - find_what == FINDFILE_DIR - ? (char_u *)"" : curbuf->b_p_sua); - first = FALSE; - - if (fresult != NULL && rettv->v_type == VAR_LIST) - list_append_string(rettv->vval.v_list, fresult, -1); - - } while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL); - } - - if (rettv->v_type == VAR_STRING) - rettv->vval.v_string = fresult; -#endif -} - -static void filter_map __ARGS((typval_T *argvars, typval_T *rettv, int map)); -static int filter_map_one __ARGS((typval_T *tv, char_u *expr, int map, int *remp)); - -/* - * Implementation of map() and filter(). - */ - static void -filter_map(argvars, rettv, map) - typval_T *argvars; - typval_T *rettv; - int map; -{ - char_u buf[NUMBUFLEN]; - char_u *expr; - listitem_T *li, *nli; - list_T *l = NULL; - dictitem_T *di; - hashtab_T *ht; - hashitem_T *hi; - dict_T *d = NULL; - typval_T save_val; - typval_T save_key; - int rem; - int todo; - char_u *ermsg = (char_u *)(map ? "map()" : "filter()"); - char *arg_errmsg = (map ? N_("map() argument") - : N_("filter() argument")); - int save_did_emsg; - int idx = 0; - - if (argvars[0].v_type == VAR_LIST) - { - if ((l = argvars[0].vval.v_list) == NULL - || tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg))) - return; - } - else if (argvars[0].v_type == VAR_DICT) - { - if ((d = argvars[0].vval.v_dict) == NULL - || tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg))) - return; - } - else - { - EMSG2(_(e_listdictarg), ermsg); - return; - } - - expr = get_tv_string_buf_chk(&argvars[1], buf); - /* On type errors, the preceding call has already displayed an error - * message. Avoid a misleading error message for an empty string that - * was not passed as argument. */ - if (expr != NULL) - { - prepare_vimvar(VV_VAL, &save_val); - expr = skipwhite(expr); - - /* We reset "did_emsg" to be able to detect whether an error - * occurred during evaluation of the expression. */ - save_did_emsg = did_emsg; - did_emsg = FALSE; - - prepare_vimvar(VV_KEY, &save_key); - if (argvars[0].v_type == VAR_DICT) - { - vimvars[VV_KEY].vv_type = VAR_STRING; - - ht = &d->dv_hashtab; - hash_lock(ht); - todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - di = HI2DI(hi); - if (tv_check_lock(di->di_tv.v_lock, - (char_u *)_(arg_errmsg))) - break; - vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); - if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL - || did_emsg) - break; - if (!map && rem) - dictitem_remove(d, di); - clear_tv(&vimvars[VV_KEY].vv_tv); - } - } - hash_unlock(ht); - } - else - { - vimvars[VV_KEY].vv_type = VAR_NUMBER; - - for (li = l->lv_first; li != NULL; li = nli) - { - if (tv_check_lock(li->li_tv.v_lock, (char_u *)_(arg_errmsg))) - break; - nli = li->li_next; - vimvars[VV_KEY].vv_nr = idx; - if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL - || did_emsg) - break; - if (!map && rem) - listitem_remove(l, li); - ++idx; - } - } - - restore_vimvar(VV_KEY, &save_key); - restore_vimvar(VV_VAL, &save_val); - - did_emsg |= save_did_emsg; - } - - copy_tv(&argvars[0], rettv); -} - - static int -filter_map_one(tv, expr, map, remp) - typval_T *tv; - char_u *expr; - int map; - int *remp; -{ - typval_T rettv; - char_u *s; - int retval = FAIL; - - copy_tv(tv, &vimvars[VV_VAL].vv_tv); - s = expr; - if (eval1(&s, &rettv, TRUE) == FAIL) - goto theend; - if (*s != NUL) /* check for trailing chars after expr */ - { - EMSG2(_(e_invexpr2), s); - goto theend; - } - if (map) - { - /* map(): replace the list item value */ - clear_tv(tv); - rettv.v_lock = 0; - *tv = rettv; - } - else - { - int error = FALSE; - - /* filter(): when expr is zero remove the item */ - *remp = (get_tv_number_chk(&rettv, &error) == 0); - clear_tv(&rettv); - /* On type error, nothing has been removed; return FAIL to stop the - * loop. The error message was given by get_tv_number_chk(). */ - if (error) - goto theend; - } - retval = OK; -theend: - clear_tv(&vimvars[VV_VAL].vv_tv); - return retval; -} - -/* - * "filter()" function - */ - static void -f_filter(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - filter_map(argvars, rettv, FALSE); -} - -/* - * "finddir({fname}[, {path}[, {count}]])" function - */ - static void -f_finddir(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - findfilendir(argvars, rettv, FINDFILE_DIR); -} - -/* - * "findfile({fname}[, {path}[, {count}]])" function - */ - static void -f_findfile(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - findfilendir(argvars, rettv, FINDFILE_FILE); -} - -#ifdef FEAT_FLOAT -/* - * "float2nr({float})" function - */ - static void -f_float2nr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - if (get_float_arg(argvars, &f) == OK) - { - if (f < -0x7fffffff) - rettv->vval.v_number = -0x7fffffff; - else if (f > 0x7fffffff) - rettv->vval.v_number = 0x7fffffff; - else - rettv->vval.v_number = (varnumber_T)f; - } -} - -/* - * "floor({float})" function - */ - static void -f_floor(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = floor(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "fmod()" function - */ - static void -f_fmod(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T fx, fy; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &fx) == OK - && get_float_arg(&argvars[1], &fy) == OK) - rettv->vval.v_float = fmod(fx, fy); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "fnameescape({string})" function - */ - static void -f_fnameescape(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_string = vim_strsave_fnameescape( - get_tv_string(&argvars[0]), FALSE); - rettv->v_type = VAR_STRING; -} - -/* - * "fnamemodify({fname}, {mods})" function - */ - static void -f_fnamemodify(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *fname; - char_u *mods; - int usedlen = 0; - int len; - char_u *fbuf = NULL; - char_u buf[NUMBUFLEN]; - - fname = get_tv_string_chk(&argvars[0]); - mods = get_tv_string_buf_chk(&argvars[1], buf); - if (fname == NULL || mods == NULL) - fname = NULL; - else - { - len = (int)STRLEN(fname); - (void)modify_fname(mods, &usedlen, &fname, &fbuf, &len); - } - - rettv->v_type = VAR_STRING; - if (fname == NULL) - rettv->vval.v_string = NULL; - else - rettv->vval.v_string = vim_strnsave(fname, len); - vim_free(fbuf); -} - -static void foldclosed_both __ARGS((typval_T *argvars, typval_T *rettv, int end)); - -/* - * "foldclosed()" function - */ - static void -foldclosed_both(argvars, rettv, end) - typval_T *argvars UNUSED; - typval_T *rettv; - int end UNUSED; -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - linenr_T first, last; - - lnum = get_tv_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - { - if (hasFoldingWin(curwin, lnum, &first, &last, FALSE, NULL)) - { - if (end) - rettv->vval.v_number = (varnumber_T)last; - else - rettv->vval.v_number = (varnumber_T)first; - return; - } - } -#endif - rettv->vval.v_number = -1; -} - -/* - * "foldclosed()" function - */ - static void -f_foldclosed(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - foldclosed_both(argvars, rettv, FALSE); -} - -/* - * "foldclosedend()" function - */ - static void -f_foldclosedend(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - foldclosed_both(argvars, rettv, TRUE); -} - -/* - * "foldlevel()" function - */ - static void -f_foldlevel(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - - lnum = get_tv_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - rettv->vval.v_number = foldLevel(lnum); -#endif -} - -/* - * "foldtext()" function - */ - static void -f_foldtext(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - char_u *s; - char_u *r; - int len; - char *txt; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_FOLDING - if ((linenr_T)vimvars[VV_FOLDSTART].vv_nr > 0 - && (linenr_T)vimvars[VV_FOLDEND].vv_nr - <= curbuf->b_ml.ml_line_count - && vimvars[VV_FOLDDASHES].vv_str != NULL) - { - /* Find first non-empty line in the fold. */ - lnum = (linenr_T)vimvars[VV_FOLDSTART].vv_nr; - while (lnum < (linenr_T)vimvars[VV_FOLDEND].vv_nr) - { - if (!linewhite(lnum)) - break; - ++lnum; - } - - /* Find interesting text in this line. */ - s = skipwhite(ml_get(lnum)); - /* skip C comment-start */ - if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) - { - s = skipwhite(s + 2); - if (*skipwhite(s) == NUL - && lnum + 1 < (linenr_T)vimvars[VV_FOLDEND].vv_nr) - { - s = skipwhite(ml_get(lnum + 1)); - if (*s == '*') - s = skipwhite(s + 1); - } - } - txt = _("+-%s%3ld lines: "); - r = alloc((unsigned)(STRLEN(txt) - + STRLEN(vimvars[VV_FOLDDASHES].vv_str) /* for %s */ - + 20 /* for %3ld */ - + STRLEN(s))); /* concatenated */ - if (r != NULL) - { - sprintf((char *)r, txt, vimvars[VV_FOLDDASHES].vv_str, - (long)((linenr_T)vimvars[VV_FOLDEND].vv_nr - - (linenr_T)vimvars[VV_FOLDSTART].vv_nr + 1)); - len = (int)STRLEN(r); - STRCAT(r, s); - /* remove 'foldmarker' and 'commentstring' */ - foldtext_cleanup(r + len); - rettv->vval.v_string = r; - } - } -#endif -} - -/* - * "foldtextresult(lnum)" function - */ - static void -f_foldtextresult(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - char_u *text; - char_u buf[51]; - foldinfo_T foldinfo; - int fold_count; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_FOLDING - lnum = get_tv_lnum(argvars); - /* treat illegal types and illegal string values for {lnum} the same */ - if (lnum < 0) - lnum = 0; - fold_count = foldedCount(curwin, lnum, &foldinfo); - if (fold_count > 0) - { - text = get_foldtext(curwin, lnum, lnum + fold_count - 1, - &foldinfo, buf); - if (text == buf) - text = vim_strsave(text); - rettv->vval.v_string = text; - } -#endif -} - -/* - * "foreground()" function - */ - static void -f_foreground(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_GUI - if (gui.in_use) - gui_mch_set_foreground(); -#else -# ifdef WIN32 - win32_set_foreground(); -# endif -#endif -} - -/* - * "function()" function - */ - static void -f_function(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s; - - s = get_tv_string(&argvars[0]); - if (s == NULL || *s == NUL || VIM_ISDIGIT(*s)) - EMSG2(_(e_invarg2), s); - /* Don't check an autoload name for existence here. */ - else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s)) - EMSG2(_("E700: Unknown function: %s"), s); - else - { - if (STRNCMP(s, "s:", 2) == 0 || STRNCMP(s, "<SID>", 5) == 0) - { - char sid_buf[25]; - int off = *s == 's' ? 2 : 5; - - /* Expand s: and <SID> into <SNR>nr_, so that the function can - * also be called from another script. Using trans_function_name() - * would also work, but some plugins depend on the name being - * printable text. */ - sprintf(sid_buf, "<SNR>%ld_", (long)current_SID); - rettv->vval.v_string = - alloc((int)(STRLEN(sid_buf) + STRLEN(s + off) + 1)); - if (rettv->vval.v_string != NULL) - { - STRCPY(rettv->vval.v_string, sid_buf); - STRCAT(rettv->vval.v_string, s + off); - } - } - else - rettv->vval.v_string = vim_strsave(s); - rettv->v_type = VAR_FUNC; - } -} - -/* - * "garbagecollect()" function - */ - static void -f_garbagecollect(argvars, rettv) - typval_T *argvars; - typval_T *rettv UNUSED; -{ - /* This is postponed until we are back at the toplevel, because we may be - * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ - want_garbage_collect = TRUE; - - if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1) - garbage_collect_at_exit = TRUE; -} - -/* - * "get()" function - */ - static void -f_get(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - listitem_T *li; - list_T *l; - dictitem_T *di; - dict_T *d; - typval_T *tv = NULL; - - if (argvars[0].v_type == VAR_LIST) - { - if ((l = argvars[0].vval.v_list) != NULL) - { - int error = FALSE; - - li = list_find(l, get_tv_number_chk(&argvars[1], &error)); - if (!error && li != NULL) - tv = &li->li_tv; - } - } - else if (argvars[0].v_type == VAR_DICT) - { - if ((d = argvars[0].vval.v_dict) != NULL) - { - di = dict_find(d, get_tv_string(&argvars[1]), -1); - if (di != NULL) - tv = &di->di_tv; - } - } - else - EMSG2(_(e_listdictarg), "get()"); - - if (tv == NULL) - { - if (argvars[2].v_type != VAR_UNKNOWN) - copy_tv(&argvars[2], rettv); - } - else - copy_tv(tv, rettv); -} - -static void get_buffer_lines __ARGS((buf_T *buf, linenr_T start, linenr_T end, int retlist, typval_T *rettv)); - -/* - * Get line or list of lines from buffer "buf" into "rettv". - * Return a range (from start to end) of lines in rettv from the specified - * buffer. - * If 'retlist' is TRUE, then the lines are returned as a Vim List. - */ - static void -get_buffer_lines(buf, start, end, retlist, rettv) - buf_T *buf; - linenr_T start; - linenr_T end; - int retlist; - typval_T *rettv; -{ - char_u *p; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - if (retlist && rettv_list_alloc(rettv) == FAIL) - return; - - if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0) - return; - - if (!retlist) - { - if (start >= 1 && start <= buf->b_ml.ml_line_count) - p = ml_get_buf(buf, start, FALSE); - else - p = (char_u *)""; - rettv->vval.v_string = vim_strsave(p); - } - else - { - if (end < start) - return; - - if (start < 1) - start = 1; - if (end > buf->b_ml.ml_line_count) - end = buf->b_ml.ml_line_count; - while (start <= end) - if (list_append_string(rettv->vval.v_list, - ml_get_buf(buf, start++, FALSE), -1) == FAIL) - break; - } -} - -/* - * "getbufline()" function - */ - static void -f_getbufline(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - linenr_T end; - buf_T *buf; - - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - ++emsg_off; - buf = get_buf_tv(&argvars[0], FALSE); - --emsg_off; - - lnum = get_tv_lnum_buf(&argvars[1], buf); - if (argvars[2].v_type == VAR_UNKNOWN) - end = lnum; - else - end = get_tv_lnum_buf(&argvars[2], buf); - - get_buffer_lines(buf, lnum, end, TRUE, rettv); -} - -/* - * "getbufvar()" function - */ - static void -f_getbufvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - buf_T *buf; - buf_T *save_curbuf; - char_u *varname; - dictitem_T *v; - int done = FALSE; - - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - varname = get_tv_string_chk(&argvars[1]); - ++emsg_off; - buf = get_buf_tv(&argvars[0], FALSE); - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - - if (buf != NULL && varname != NULL) - { - /* set curbuf to be our buf, temporarily */ - save_curbuf = curbuf; - curbuf = buf; - - if (*varname == '&') /* buffer-local-option */ - { - if (get_option_tv(&varname, rettv, TRUE) == OK) - done = TRUE; - } - else if (STRCMP(varname, "changedtick") == 0) - { - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = curbuf->b_changedtick; - done = TRUE; - } - else - { - /* Look up the variable. */ - /* Let getbufvar({nr}, "") return the "b:" dictionary. */ - v = find_var_in_ht(&curbuf->b_vars->dv_hashtab, - 'b', varname, FALSE); - if (v != NULL) - { - copy_tv(&v->di_tv, rettv); - done = TRUE; - } - } - - /* restore previous notion of curbuf */ - curbuf = save_curbuf; - } - - if (!done && argvars[2].v_type != VAR_UNKNOWN) - /* use the default value */ - copy_tv(&argvars[2], rettv); - - --emsg_off; -} - -/* - * "getchar()" function - */ - static void -f_getchar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - varnumber_T n; - int error = FALSE; - - /* Position the cursor. Needed after a message that ends in a space. */ - windgoto(msg_row, msg_col); - - ++no_mapping; - ++allow_keys; - for (;;) - { - if (argvars[0].v_type == VAR_UNKNOWN) - /* getchar(): blocking wait. */ - n = safe_vgetc(); - else if (get_tv_number_chk(&argvars[0], &error) == 1) - /* getchar(1): only check if char avail */ - n = vpeekc_any(); - else if (error || vpeekc_any() == NUL) - /* illegal argument or getchar(0) and no char avail: return zero */ - n = 0; - else - /* getchar(0) and char avail: return char */ - n = safe_vgetc(); - - if (n == K_IGNORE) - continue; - break; - } - --no_mapping; - --allow_keys; - - vimvars[VV_MOUSE_WIN].vv_nr = 0; - vimvars[VV_MOUSE_LNUM].vv_nr = 0; - vimvars[VV_MOUSE_COL].vv_nr = 0; - - rettv->vval.v_number = n; - if (IS_SPECIAL(n) || mod_mask != 0) - { - char_u temp[10]; /* modifier: 3, mbyte-char: 6, NUL: 1 */ - int i = 0; - - /* Turn a special key into three bytes, plus modifier. */ - if (mod_mask != 0) - { - temp[i++] = K_SPECIAL; - temp[i++] = KS_MODIFIER; - temp[i++] = mod_mask; - } - if (IS_SPECIAL(n)) - { - temp[i++] = K_SPECIAL; - temp[i++] = K_SECOND(n); - temp[i++] = K_THIRD(n); - } -#ifdef FEAT_MBYTE - else if (has_mbyte) - i += (*mb_char2bytes)(n, temp + i); -#endif - else - temp[i++] = n; - temp[i++] = NUL; - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(temp); - -#ifdef FEAT_MOUSE - if (is_mouse_key(n) -# ifdef FEAT_GUI_MACVIM - || n == K_SWIPELEFT - || n == K_SWIPERIGHT - || n == K_SWIPEUP - || n == K_SWIPEDOWN -# endif - ) - { - int row = mouse_row; - int col = mouse_col; - win_T *win; - linenr_T lnum; -# ifdef FEAT_WINDOWS - win_T *wp; -# endif - int winnr = 1; - - if (row >= 0 && col >= 0) - { - /* Find the window at the mouse coordinates and compute the - * text position. */ - win = mouse_find_win(&row, &col); - (void)mouse_comp_pos(win, &row, &col, &lnum); -# ifdef FEAT_WINDOWS - for (wp = firstwin; wp != win; wp = wp->w_next) - ++winnr; -# endif - vimvars[VV_MOUSE_WIN].vv_nr = winnr; - vimvars[VV_MOUSE_LNUM].vv_nr = lnum; - vimvars[VV_MOUSE_COL].vv_nr = col + 1; - } - } -#endif - } -} - -/* - * "getcharmod()" function - */ - static void -f_getcharmod(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = mod_mask; -} - -/* - * "getcmdline()" function - */ - static void -f_getcmdline(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = get_cmdline_str(); -} - -/* - * "getcmdpos()" function - */ - static void -f_getcmdpos(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = get_cmdline_pos() + 1; -} - -/* - * "getcmdtype()" function - */ - static void -f_getcmdtype(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = alloc(2); - if (rettv->vval.v_string != NULL) - { - rettv->vval.v_string[0] = get_cmdline_type(); - rettv->vval.v_string[1] = NUL; - } -} - -/* - * "getcwd()" function - */ - static void -f_getcwd(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *cwd; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - cwd = alloc(MAXPATHL); - if (cwd != NULL) - { - if (mch_dirname(cwd, MAXPATHL) != FAIL) - { - rettv->vval.v_string = vim_strsave(cwd); -#ifdef BACKSLASH_IN_FILENAME - if (rettv->vval.v_string != NULL) - slash_adjust(rettv->vval.v_string); -#endif - } - vim_free(cwd); - } -} - -/* - * "getfontname()" function - */ - static void -f_getfontname(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_GUI - if (gui.in_use) - { - GuiFont font; - char_u *name = NULL; - - if (argvars[0].v_type == VAR_UNKNOWN) - { - /* Get the "Normal" font. Either the name saved by - * hl_set_font_name() or from the font ID. */ - font = gui.norm_font; - name = hl_get_font_name(); - } - else - { - name = get_tv_string(&argvars[0]); - if (STRCMP(name, "*") == 0) /* don't use font dialog */ - return; - font = gui_mch_get_font(name, FALSE); - if (font == NOFONT) - return; /* Invalid font name, return empty string. */ - } - rettv->vval.v_string = gui_mch_get_fontname(font, name); - if (argvars[0].v_type != VAR_UNKNOWN) - gui_mch_free_font(font); - } -#endif -} - -/* - * "getfperm({fname})" function - */ - static void -f_getfperm(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *fname; - struct stat st; - char_u *perm = NULL; - char_u flags[] = "rwx"; - int i; - - fname = get_tv_string(&argvars[0]); - - rettv->v_type = VAR_STRING; - if (mch_stat((char *)fname, &st) >= 0) - { - perm = vim_strsave((char_u *)"---------"); - if (perm != NULL) - { - for (i = 0; i < 9; i++) - { - if (st.st_mode & (1 << (8 - i))) - perm[i] = flags[i % 3]; - } - } - } - rettv->vval.v_string = perm; -} - -/* - * "getfsize({fname})" function - */ - static void -f_getfsize(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *fname; - struct stat st; - - fname = get_tv_string(&argvars[0]); - - rettv->v_type = VAR_NUMBER; - - if (mch_stat((char *)fname, &st) >= 0) - { - if (mch_isdir(fname)) - rettv->vval.v_number = 0; - else - { - rettv->vval.v_number = (varnumber_T)st.st_size; - - /* non-perfect check for overflow */ - if ((off_t)rettv->vval.v_number != (off_t)st.st_size) - rettv->vval.v_number = -2; - } - } - else - rettv->vval.v_number = -1; -} - -/* - * "getftime({fname})" function - */ - static void -f_getftime(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *fname; - struct stat st; - - fname = get_tv_string(&argvars[0]); - - if (mch_stat((char *)fname, &st) >= 0) - rettv->vval.v_number = (varnumber_T)st.st_mtime; - else - rettv->vval.v_number = -1; -} - -/* - * "getftype({fname})" function - */ - static void -f_getftype(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *fname; - struct stat st; - char_u *type = NULL; - char *t; - - fname = get_tv_string(&argvars[0]); - - rettv->v_type = VAR_STRING; - if (mch_lstat((char *)fname, &st) >= 0) - { -#ifdef S_ISREG - if (S_ISREG(st.st_mode)) - t = "file"; - else if (S_ISDIR(st.st_mode)) - t = "dir"; -# ifdef S_ISLNK - else if (S_ISLNK(st.st_mode)) - t = "link"; -# endif -# ifdef S_ISBLK - else if (S_ISBLK(st.st_mode)) - t = "bdev"; -# endif -# ifdef S_ISCHR - else if (S_ISCHR(st.st_mode)) - t = "cdev"; -# endif -# ifdef S_ISFIFO - else if (S_ISFIFO(st.st_mode)) - t = "fifo"; -# endif -# ifdef S_ISSOCK - else if (S_ISSOCK(st.st_mode)) - t = "fifo"; -# endif - else - t = "other"; -#else -# ifdef S_IFMT - switch (st.st_mode & S_IFMT) - { - case S_IFREG: t = "file"; break; - case S_IFDIR: t = "dir"; break; -# ifdef S_IFLNK - case S_IFLNK: t = "link"; break; -# endif -# ifdef S_IFBLK - case S_IFBLK: t = "bdev"; break; -# endif -# ifdef S_IFCHR - case S_IFCHR: t = "cdev"; break; -# endif -# ifdef S_IFIFO - case S_IFIFO: t = "fifo"; break; -# endif -# ifdef S_IFSOCK - case S_IFSOCK: t = "socket"; break; -# endif - default: t = "other"; - } -# else - if (mch_isdir(fname)) - t = "dir"; - else - t = "file"; -# endif -#endif - type = vim_strsave((char_u *)t); - } - rettv->vval.v_string = type; -} - -/* - * "getline(lnum, [end])" function - */ - static void -f_getline(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - linenr_T end; - int retlist; - - lnum = get_tv_lnum(argvars); - if (argvars[1].v_type == VAR_UNKNOWN) - { - end = 0; - retlist = FALSE; - } - else - { - end = get_tv_lnum(&argvars[1]); - retlist = TRUE; - } - - get_buffer_lines(curbuf, lnum, end, retlist, rettv); -} - -/* - * "getmatches()" function - */ - static void -f_getmatches(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - dict_T *dict; - matchitem_T *cur = curwin->w_match_head; - int i; - - if (rettv_list_alloc(rettv) == OK) - { - while (cur != NULL) - { - dict = dict_alloc(); - if (dict == NULL) - return; - if (cur->match.regprog == NULL) - { - /* match added with matchaddpos() */ - for (i = 0; i < MAXPOSMATCH; ++i) - { - llpos_T *llpos; - char buf[6]; - list_T *l; - - llpos = &cur->pos.pos[i]; - if (llpos->lnum == 0) - break; - l = list_alloc(); - if (l == NULL) - break; - list_append_number(l, (varnumber_T)llpos->lnum); - if (llpos->col > 0) - { - list_append_number(l, (varnumber_T)llpos->col); - list_append_number(l, (varnumber_T)llpos->len); - } - sprintf(buf, "pos%d", i + 1); - dict_add_list(dict, buf, l); - } - } - else - { - dict_add_nr_str(dict, "pattern", 0L, cur->pattern); - } - dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id)); - dict_add_nr_str(dict, "priority", (long)cur->priority, NULL); - dict_add_nr_str(dict, "id", (long)cur->id, NULL); - list_append_dict(rettv->vval.v_list, dict); - cur = cur->next; - } - } -#endif -} - -/* - * "getpid()" function - */ - static void -f_getpid(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = mch_get_pid(); -} - -static void getpos_both __ARGS((typval_T *argvars, typval_T *rettv, int getcurpos)); - -/* - * "getcurpos()" function - */ - static void -f_getcurpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - getpos_both(argvars, rettv, TRUE); -} - -/* - * "getpos(string)" function - */ - static void -f_getpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - getpos_both(argvars, rettv, FALSE); -} - - static void -getpos_both(argvars, rettv, getcurpos) - typval_T *argvars; - typval_T *rettv; - int getcurpos; -{ - pos_T *fp; - list_T *l; - int fnum = -1; - - if (rettv_list_alloc(rettv) == OK) - { - l = rettv->vval.v_list; - if (getcurpos) - fp = &curwin->w_cursor; - else - fp = var2fpos(&argvars[0], TRUE, &fnum); - if (fnum != -1) - list_append_number(l, (varnumber_T)fnum); - else - list_append_number(l, (varnumber_T)0); - list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum - : (varnumber_T)0); - list_append_number(l, (fp != NULL) - ? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1) - : (varnumber_T)0); - list_append_number(l, -#ifdef FEAT_VIRTUALEDIT - (fp != NULL) ? (varnumber_T)fp->coladd : -#endif - (varnumber_T)0); - if (getcurpos) - list_append_number(l, (varnumber_T)curwin->w_curswant + 1); - } - else - rettv->vval.v_number = FALSE; -} - -/* - * "getqflist()" and "getloclist()" functions - */ - static void -f_getqflist(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_QUICKFIX - win_T *wp; -#endif - -#ifdef FEAT_QUICKFIX - if (rettv_list_alloc(rettv) == OK) - { - wp = NULL; - if (argvars[0].v_type != VAR_UNKNOWN) /* getloclist() */ - { - wp = find_win_by_nr(&argvars[0], NULL); - if (wp == NULL) - return; - } - - (void)get_errorlist(wp, rettv->vval.v_list); - } -#endif -} - -/* - * "getreg()" function - */ - static void -f_getreg(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *strregname; - int regname; - int arg2 = FALSE; - int return_list = FALSE; - int error = FALSE; - - if (argvars[0].v_type != VAR_UNKNOWN) - { - strregname = get_tv_string_chk(&argvars[0]); - error = strregname == NULL; - if (argvars[1].v_type != VAR_UNKNOWN) - { - arg2 = get_tv_number_chk(&argvars[1], &error); - if (!error && argvars[2].v_type != VAR_UNKNOWN) - return_list = get_tv_number_chk(&argvars[2], &error); - } - } - else - strregname = vimvars[VV_REG].vv_str; - - if (error) - return; - - regname = (strregname == NULL ? '"' : *strregname); - if (regname == 0) - regname = '"'; - - if (return_list) - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = (list_T *)get_reg_contents(regname, - (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST); - } - else - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = get_reg_contents(regname, - arg2 ? GREG_EXPR_SRC : 0); - } -} - -/* - * "getregtype()" function - */ - static void -f_getregtype(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *strregname; - int regname; - char_u buf[NUMBUFLEN + 2]; - long reglen = 0; - - if (argvars[0].v_type != VAR_UNKNOWN) - { - strregname = get_tv_string_chk(&argvars[0]); - if (strregname == NULL) /* type error; errmsg already given */ - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - return; - } - } - else - /* Default to v:register */ - strregname = vimvars[VV_REG].vv_str; - - regname = (strregname == NULL ? '"' : *strregname); - if (regname == 0) - regname = '"'; - - buf[0] = NUL; - buf[1] = NUL; - switch (get_reg_type(regname, ®len)) - { - case MLINE: buf[0] = 'V'; break; - case MCHAR: buf[0] = 'v'; break; - case MBLOCK: - buf[0] = Ctrl_V; - sprintf((char *)buf + 1, "%ld", reglen + 1); - break; - } - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(buf); -} - -/* - * "gettabvar()" function - */ - static void -f_gettabvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - tabpage_T *tp; - dictitem_T *v; - char_u *varname; - int done = FALSE; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - - varname = get_tv_string_chk(&argvars[1]); - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); - if (tp != NULL && varname != NULL) - { - /* look up the variable */ - v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE); - if (v != NULL) - { - copy_tv(&v->di_tv, rettv); - done = TRUE; - } - } - - if (!done && argvars[2].v_type != VAR_UNKNOWN) - copy_tv(&argvars[2], rettv); -} - -/* - * "gettabwinvar()" function - */ - static void -f_gettabwinvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - getwinvar(argvars, rettv, 1); -} - -/* - * "getwinposx()" function - */ - static void -f_getwinposx(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = -1; -#ifdef FEAT_GUI - if (gui.in_use) - { - int x, y; - - if (gui_mch_get_winpos(&x, &y) == OK) - rettv->vval.v_number = x; - } -#endif -} - -/* - * "getwinposy()" function - */ - static void -f_getwinposy(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = -1; -#ifdef FEAT_GUI - if (gui.in_use) - { - int x, y; - - if (gui_mch_get_winpos(&x, &y) == OK) - rettv->vval.v_number = y; - } -#endif -} - -/* - * Find window specified by "vp" in tabpage "tp". - */ - static win_T * -find_win_by_nr(vp, tp) - typval_T *vp; - tabpage_T *tp UNUSED; /* NULL for current tab page */ -{ -#ifdef FEAT_WINDOWS - win_T *wp; -#endif - int nr; - - nr = get_tv_number_chk(vp, NULL); - -#ifdef FEAT_WINDOWS - if (nr < 0) - return NULL; - if (nr == 0) - return curwin; - - for (wp = (tp == NULL || tp == curtab) ? firstwin : tp->tp_firstwin; - wp != NULL; wp = wp->w_next) - if (--nr <= 0) - break; - return wp; -#else - if (nr == 0 || nr == 1) - return curwin; - return NULL; -#endif -} - -/* - * "getwinvar()" function - */ - static void -f_getwinvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - getwinvar(argvars, rettv, 0); -} - -/* - * getwinvar() and gettabwinvar() - */ - static void -getwinvar(argvars, rettv, off) - typval_T *argvars; - typval_T *rettv; - int off; /* 1 for gettabwinvar() */ -{ - win_T *win, *oldcurwin; - char_u *varname; - dictitem_T *v; - tabpage_T *tp = NULL; - tabpage_T *oldtabpage; - int done = FALSE; - -#ifdef FEAT_WINDOWS - if (off == 1) - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); - else - tp = curtab; -#endif - win = find_win_by_nr(&argvars[off], tp); - varname = get_tv_string_chk(&argvars[off + 1]); - ++emsg_off; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - - if (win != NULL && varname != NULL) - { - /* Set curwin to be our win, temporarily. Also set the tabpage, - * otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE); - - if (*varname == '&') /* window-local-option */ - { - if (get_option_tv(&varname, rettv, 1) == OK) - done = TRUE; - } - else - { - /* Look up the variable. */ - /* Let getwinvar({nr}, "") return the "w:" dictionary. */ - v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE); - if (v != NULL) - { - copy_tv(&v->di_tv, rettv); - done = TRUE; - } - } - - /* restore previous notion of curwin */ - restore_win(oldcurwin, oldtabpage, TRUE); - } - - if (!done && argvars[off + 2].v_type != VAR_UNKNOWN) - /* use the default return value */ - copy_tv(&argvars[off + 2], rettv); - - --emsg_off; -} - -/* - * "glob()" function - */ - static void -f_glob(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int options = WILD_SILENT|WILD_USE_NL; - expand_T xpc; - int error = FALSE; - - /* When the optional second argument is non-zero, don't remove matches - * for 'wildignore' and don't put matches for 'suffixes' at the end. */ - rettv->v_type = VAR_STRING; - if (argvars[1].v_type != VAR_UNKNOWN) - { - if (get_tv_number_chk(&argvars[1], &error)) - options |= WILD_KEEP_ALL; - if (argvars[2].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[2], &error)) - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; - } - } - if (!error) - { - ExpandInit(&xpc); - xpc.xp_context = EXPAND_FILES; - if (p_wic) - options += WILD_ICASE; - if (rettv->v_type == VAR_STRING) - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), - NULL, options, WILD_ALL); - else if (rettv_list_alloc(rettv) != FAIL) - { - int i; - - ExpandOne(&xpc, get_tv_string(&argvars[0]), - NULL, options, WILD_ALL_KEEP); - for (i = 0; i < xpc.xp_numfiles; i++) - list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); - - ExpandCleanup(&xpc); - } - } - else - rettv->vval.v_string = NULL; -} - -/* - * "globpath()" function - */ - static void -f_globpath(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int flags = 0; - char_u buf1[NUMBUFLEN]; - char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); - int error = FALSE; - garray_T ga; - int i; - - /* When the optional second argument is non-zero, don't remove matches - * for 'wildignore' and don't put matches for 'suffixes' at the end. */ - rettv->v_type = VAR_STRING; - if (argvars[2].v_type != VAR_UNKNOWN) - { - if (get_tv_number_chk(&argvars[2], &error)) - flags |= WILD_KEEP_ALL; - if (argvars[3].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[3], &error)) - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; - } - } - if (file != NULL && !error) - { - ga_init2(&ga, (int)sizeof(char_u *), 10); - globpath(get_tv_string(&argvars[0]), file, &ga, flags); - if (rettv->v_type == VAR_STRING) - rettv->vval.v_string = ga_concat_strings(&ga, "\n"); - else if (rettv_list_alloc(rettv) != FAIL) - for (i = 0; i < ga.ga_len; ++i) - list_append_string(rettv->vval.v_list, - ((char_u **)(ga.ga_data))[i], -1); - ga_clear_strings(&ga); - } - else - rettv->vval.v_string = NULL; -} - -/* - * "has()" function - */ - static void -f_has(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int i; - char_u *name; - int n = FALSE; - static char *(has_list[]) = - { -#ifdef AMIGA - "amiga", -# ifdef FEAT_ARP - "arp", -# endif -#endif -#ifdef __BEOS__ - "beos", -#endif -#ifdef MSDOS -# ifdef DJGPP - "dos32", -# else - "dos16", -# endif -#endif -#ifdef MACOS - "mac", -#endif -#if defined(MACOS_X_UNIX) - "macunix", -#endif -#ifdef OS2 - "os2", -#endif -#ifdef __QNX__ - "qnx", -#endif -#ifdef UNIX - "unix", -#endif -#ifdef VMS - "vms", -#endif -#ifdef WIN16 - "win16", -#endif -#ifdef WIN32 - "win32", -#endif -#if defined(UNIX) && (defined(__CYGWIN32__) || defined(__CYGWIN__)) - "win32unix", -#endif -#if defined(WIN64) || defined(_WIN64) - "win64", -#endif -#ifdef EBCDIC - "ebcdic", -#endif -#ifndef CASE_INSENSITIVE_FILENAME - "fname_case", -#endif -#ifdef HAVE_ACL - "acl", -#endif -#ifdef FEAT_ARABIC - "arabic", -#endif -#ifdef FEAT_AUTOCMD - "autocmd", -#endif -#ifdef FEAT_BEVAL - "balloon_eval", -# ifndef FEAT_GUI_W32 /* other GUIs always have multiline balloons */ - "balloon_multiline", -# endif -#endif -#if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS) - "builtin_terms", -# ifdef ALL_BUILTIN_TCAPS - "all_builtin_terms", -# endif -#endif -#if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ - || defined(FEAT_GUI_W32) \ - || defined(FEAT_GUI_MOTIF)) - "browsefilter", -#endif -#ifdef FEAT_BYTEOFF - "byte_offset", -#endif -#ifdef FEAT_CINDENT - "cindent", -#endif -#ifdef FEAT_CLIENTSERVER - "clientserver", -#endif -#ifdef FEAT_CLIPBOARD - "clipboard", -#endif -#ifdef FEAT_CMDL_COMPL - "cmdline_compl", -#endif -#ifdef FEAT_CMDHIST - "cmdline_hist", -#endif -#ifdef FEAT_COMMENTS - "comments", -#endif -#ifdef FEAT_CONCEAL - "conceal", -#endif -#ifdef FEAT_CRYPT - "cryptv", -#endif -#ifdef FEAT_CSCOPE - "cscope", -#endif -#ifdef FEAT_CURSORBIND - "cursorbind", -#endif -#ifdef CURSOR_SHAPE - "cursorshape", -#endif -#ifdef DEBUG - "debug", -#endif -#ifdef FEAT_CON_DIALOG - "dialog_con", -#endif -#ifdef FEAT_GUI_DIALOG - "dialog_gui", -#endif -#ifdef FEAT_DIFF - "diff", -#endif -#ifdef FEAT_DIGRAPHS - "digraphs", -#endif -#ifdef FEAT_DND - "dnd", -#endif -#ifdef FEAT_EMACS_TAGS - "emacs_tags", -#endif - "eval", /* always present, of course! */ -#ifdef FEAT_EX_EXTRA - "ex_extra", -#endif -#ifdef FEAT_SEARCH_EXTRA - "extra_search", -#endif -#ifdef FEAT_FKMAP - "farsi", -#endif -#ifdef FEAT_SEARCHPATH - "file_in_path", -#endif -#ifdef FEAT_FILTERPIPE - "filterpipe", -#endif -#ifdef FEAT_FIND_ID - "find_in_path", -#endif -#ifdef FEAT_FLOAT - "float", -#endif -#ifdef FEAT_FOLDING - "folding", -#endif -#ifdef FEAT_FOOTER - "footer", -#endif -#if !defined(USE_SYSTEM) && defined(UNIX) - "fork", -#endif -#ifdef FEAT_FULLSCREEN - "fullscreen", -#endif -#ifdef FEAT_GETTEXT - "gettext", -#endif -#ifdef FEAT_GUI - "gui", -#endif -#ifdef FEAT_GUI_ATHENA -# ifdef FEAT_GUI_NEXTAW - "gui_neXtaw", -# else - "gui_athena", -# endif -#endif -#ifdef FEAT_GUI_GTK - "gui_gtk", - "gui_gtk2", -#endif -#ifdef FEAT_GUI_GNOME - "gui_gnome", -#endif -#ifdef FEAT_GUI_MAC - "gui_mac", -#endif -#ifdef FEAT_GUI_MACVIM - "gui_macvim", -#endif -#ifdef FEAT_GUI_MOTIF - "gui_motif", -#endif -#ifdef FEAT_GUI_PHOTON - "gui_photon", -#endif -#ifdef FEAT_GUI_W16 - "gui_win16", -#endif -#ifdef FEAT_GUI_W32 - "gui_win32", -#endif -#ifdef FEAT_HANGULIN - "hangul_input", -#endif -#if defined(HAVE_ICONV_H) && defined(USE_ICONV) - "iconv", -#endif -#ifdef FEAT_INS_EXPAND - "insert_expand", -#endif -#ifdef FEAT_JUMPLIST - "jumplist", -#endif -#ifdef FEAT_KEYMAP - "keymap", -#endif -#ifdef FEAT_LANGMAP - "langmap", -#endif -#ifdef FEAT_LIBCALL - "libcall", -#endif -#ifdef FEAT_LINEBREAK - "linebreak", -#endif -#ifdef FEAT_LISP - "lispindent", -#endif -#ifdef FEAT_LISTCMDS - "listcmds", -#endif -#ifdef FEAT_LOCALMAP - "localmap", -#endif -#ifdef FEAT_LUA -# ifndef DYNAMIC_LUA - "lua", -# endif -#endif -#ifdef FEAT_MENU - "menu", -#endif -#ifdef FEAT_SESSION - "mksession", -#endif -#ifdef FEAT_MODIFY_FNAME - "modify_fname", -#endif -#ifdef FEAT_MOUSE - "mouse", -#endif -#ifdef FEAT_MOUSESHAPE - "mouseshape", -#endif -#if defined(UNIX) || defined(VMS) -# ifdef FEAT_MOUSE_DEC - "mouse_dec", -# endif -# ifdef FEAT_MOUSE_GPM - "mouse_gpm", -# endif -# ifdef FEAT_MOUSE_JSB - "mouse_jsbterm", -# endif -# ifdef FEAT_MOUSE_NET - "mouse_netterm", -# endif -# ifdef FEAT_MOUSE_PTERM - "mouse_pterm", -# endif -# ifdef FEAT_MOUSE_SGR - "mouse_sgr", -# endif -# ifdef FEAT_SYSMOUSE - "mouse_sysmouse", -# endif -# ifdef FEAT_MOUSE_URXVT - "mouse_urxvt", -# endif -# ifdef FEAT_MOUSE_XTERM - "mouse_xterm", -# endif -#endif -#ifdef FEAT_MBYTE - "multi_byte", -#endif -#ifdef FEAT_MBYTE_IME - "multi_byte_ime", -#endif -#ifdef FEAT_MULTI_LANG - "multi_lang", -#endif -#ifdef FEAT_MZSCHEME -#ifndef DYNAMIC_MZSCHEME - "mzscheme", -#endif -#endif -#ifdef FEAT_OLE - "ole", -#endif -#ifdef FEAT_PATH_EXTRA - "path_extra", -#endif -#ifdef FEAT_PERL -#ifndef DYNAMIC_PERL - "perl", -#endif -#endif -#ifdef FEAT_PERSISTENT_UNDO - "persistent_undo", -#endif -#ifdef FEAT_PYTHON -#ifndef DYNAMIC_PYTHON - "python", -#endif -#endif -#ifdef FEAT_PYTHON3 -#ifndef DYNAMIC_PYTHON3 - "python3", -#endif -#endif -#ifdef FEAT_POSTSCRIPT - "postscript", -#endif -#ifdef FEAT_PRINTER - "printer", -#endif -#ifdef FEAT_PROFILE - "profile", -#endif -#ifdef FEAT_RELTIME - "reltime", -#endif -#ifdef FEAT_QUICKFIX - "quickfix", -#endif -#ifdef FEAT_RIGHTLEFT - "rightleft", -#endif -#if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY) - "ruby", -#endif -#ifdef FEAT_SCROLLBIND - "scrollbind", -#endif -#ifdef FEAT_CMDL_INFO - "showcmd", - "cmdline_info", -#endif -#ifdef FEAT_SIGNS - "signs", -#endif -#ifdef FEAT_SMARTINDENT - "smartindent", -#endif -#ifdef FEAT_SNIFF - "sniff", -#endif -#ifdef STARTUPTIME - "startuptime", -#endif -#ifdef FEAT_STL_OPT - "statusline", -#endif -#ifdef FEAT_SUN_WORKSHOP - "sun_workshop", -#endif -#ifdef FEAT_NETBEANS_INTG - "netbeans_intg", -#endif -#ifdef FEAT_ODB_EDITOR - "odbeditor", -#endif -#ifdef FEAT_SPELL - "spell", -#endif -#ifdef FEAT_SYN_HL - "syntax", -#endif -#if defined(USE_SYSTEM) || !defined(UNIX) - "system", -#endif -#ifdef FEAT_TAG_BINS - "tag_binary", -#endif -#ifdef FEAT_TAG_OLDSTATIC - "tag_old_static", -#endif -#ifdef FEAT_TAG_ANYWHITE - "tag_any_white", -#endif -#ifdef FEAT_TCL -# ifndef DYNAMIC_TCL - "tcl", -# endif -#endif -#ifdef TERMINFO - "terminfo", -#endif -#ifdef FEAT_TERMRESPONSE - "termresponse", -#endif -#ifdef FEAT_TEXTOBJ - "textobjects", -#endif -#ifdef HAVE_TGETENT - "tgetent", -#endif -#ifdef FEAT_TITLE - "title", -#endif -#ifdef FEAT_TOOLBAR - "toolbar", -#endif -#ifdef FEAT_TRANSPARENCY - "transparency", -#endif -#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) - "unnamedplus", -#endif -#ifdef FEAT_USR_CMDS - "user-commands", /* was accidentally included in 5.4 */ - "user_commands", -#endif -#ifdef FEAT_VIMINFO - "viminfo", -#endif -#ifdef FEAT_VERTSPLIT - "vertsplit", -#endif -#ifdef FEAT_VIRTUALEDIT - "virtualedit", -#endif - "visual", -#ifdef FEAT_VISUALEXTRA - "visualextra", -#endif -#ifdef FEAT_VREPLACE - "vreplace", -#endif -#ifdef FEAT_WILDIGN - "wildignore", -#endif -#ifdef FEAT_WILDMENU - "wildmenu", -#endif -#ifdef FEAT_WINDOWS - "windows", -#endif -#ifdef FEAT_WAK - "winaltkeys", -#endif -#ifdef FEAT_WRITEBACKUP - "writebackup", -#endif -#ifdef FEAT_XIM - "xim", -#endif -#ifdef FEAT_XFONTSET - "xfontset", -#endif -#ifdef FEAT_XPM_W32 - "xpm", - "xpm_w32", /* for backward compatibility */ -#else -# if defined(HAVE_XPM) - "xpm", -# endif -#endif -#ifdef USE_XSMP - "xsmp", -#endif -#ifdef USE_XSMP_INTERACT - "xsmp_interact", -#endif -#ifdef FEAT_XCLIPBOARD - "xterm_clipboard", -#endif -#ifdef FEAT_XTERM_SAVE - "xterm_save", -#endif -#if defined(UNIX) && defined(FEAT_X11) - "X11", -#endif - NULL - }; - - name = get_tv_string(&argvars[0]); - for (i = 0; has_list[i] != NULL; ++i) - if (STRICMP(name, has_list[i]) == 0) - { - n = TRUE; - break; - } - - if (n == FALSE) - { - if (STRNICMP(name, "patch", 5) == 0) - { - if (name[5] == '-' - && STRLEN(name) > 11 - && vim_isdigit(name[6]) - && vim_isdigit(name[8]) - && vim_isdigit(name[10])) - { - int major = atoi((char *)name + 6); - int minor = atoi((char *)name + 8); - - /* Expect "patch-9.9.01234". */ - n = (major < VIM_VERSION_MAJOR - || (major == VIM_VERSION_MAJOR - && (minor < VIM_VERSION_MINOR - || (minor == VIM_VERSION_MINOR - && has_patch(atoi((char *)name + 10)))))); - } - else - n = has_patch(atoi((char *)name + 5)); - } - else if (STRICMP(name, "vim_starting") == 0) - n = (starting != 0); -#ifdef FEAT_MBYTE - else if (STRICMP(name, "multi_byte_encoding") == 0) - n = has_mbyte; -#endif -#if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32) - else if (STRICMP(name, "balloon_multiline") == 0) - n = multiline_balloon_available(); -#endif -#ifdef DYNAMIC_TCL - else if (STRICMP(name, "tcl") == 0) - n = tcl_enabled(FALSE); -#endif -#if defined(USE_ICONV) && defined(DYNAMIC_ICONV) - else if (STRICMP(name, "iconv") == 0) - n = iconv_enabled(FALSE); -#endif -#ifdef DYNAMIC_LUA - else if (STRICMP(name, "lua") == 0) - n = lua_enabled(FALSE); -#endif -#ifdef DYNAMIC_MZSCHEME - else if (STRICMP(name, "mzscheme") == 0) - n = mzscheme_enabled(FALSE); -#endif -#ifdef DYNAMIC_RUBY - else if (STRICMP(name, "ruby") == 0) - n = ruby_enabled(FALSE); -#endif -#ifdef FEAT_PYTHON -#ifdef DYNAMIC_PYTHON - else if (STRICMP(name, "python") == 0) - n = python_enabled(FALSE); -#endif -#endif -#ifdef FEAT_PYTHON3 -#ifdef DYNAMIC_PYTHON3 - else if (STRICMP(name, "python3") == 0) - n = python3_enabled(FALSE); -#endif -#endif -#ifdef DYNAMIC_PERL - else if (STRICMP(name, "perl") == 0) - n = perl_enabled(FALSE); -#endif -#ifdef FEAT_GUI - else if (STRICMP(name, "gui_running") == 0) - n = (gui.in_use || gui.starting); -# ifdef FEAT_GUI_W32 - else if (STRICMP(name, "gui_win32s") == 0) - n = gui_is_win32s(); -# endif -# ifdef FEAT_BROWSE - else if (STRICMP(name, "browse") == 0) - n = gui.in_use; /* gui_mch_browse() works when GUI is running */ -# endif -#endif -#ifdef FEAT_SYN_HL - else if (STRICMP(name, "syntax_items") == 0) - n = syntax_present(curwin); -#endif -#if defined(WIN3264) - else if (STRICMP(name, "win95") == 0) - n = mch_windows95(); -#endif -#ifdef FEAT_NETBEANS_INTG - else if (STRICMP(name, "netbeans_enabled") == 0) - n = netbeans_active(); -#endif - } - - rettv->vval.v_number = n; -} - -/* - * "has_key()" function - */ - static void -f_has_key(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - if (argvars[0].v_type != VAR_DICT) - { - EMSG(_(e_dictreq)); - return; - } - if (argvars[0].vval.v_dict == NULL) - return; - - rettv->vval.v_number = dict_find(argvars[0].vval.v_dict, - get_tv_string(&argvars[1]), -1) != NULL; -} - -/* - * "haslocaldir()" function - */ - static void -f_haslocaldir(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = (curwin->w_localdir != NULL); -} - -/* - * "hasmapto()" function - */ - static void -f_hasmapto(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *name; - char_u *mode; - char_u buf[NUMBUFLEN]; - int abbr = FALSE; - - name = get_tv_string(&argvars[0]); - if (argvars[1].v_type == VAR_UNKNOWN) - mode = (char_u *)"nvo"; - else - { - mode = get_tv_string_buf(&argvars[1], buf); - if (argvars[2].v_type != VAR_UNKNOWN) - abbr = get_tv_number(&argvars[2]); - } - - if (map_to_exists(name, mode, abbr)) - rettv->vval.v_number = TRUE; - else - rettv->vval.v_number = FALSE; -} - -/* - * "histadd()" function - */ - static void -f_histadd(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_CMDHIST - int histype; - char_u *str; - char_u buf[NUMBUFLEN]; -#endif - - rettv->vval.v_number = FALSE; - if (check_restricted() || check_secure()) - return; -#ifdef FEAT_CMDHIST - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ - histype = str != NULL ? get_histtype(str) : -1; - if (histype >= 0) - { - str = get_tv_string_buf(&argvars[1], buf); - if (*str != NUL) - { - init_history(); - add_to_history(histype, str, FALSE, NUL); - rettv->vval.v_number = TRUE; - return; - } - } -#endif -} - -/* - * "histdel()" function - */ - static void -f_histdel(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_CMDHIST - int n; - char_u buf[NUMBUFLEN]; - char_u *str; - - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ - if (str == NULL) - n = 0; - else if (argvars[1].v_type == VAR_UNKNOWN) - /* only one argument: clear entire history */ - n = clr_history(get_histtype(str)); - else if (argvars[1].v_type == VAR_NUMBER) - /* index given: remove that entry */ - n = del_history_idx(get_histtype(str), - (int)get_tv_number(&argvars[1])); - else - /* string given: remove all matching entries */ - n = del_history_entry(get_histtype(str), - get_tv_string_buf(&argvars[1], buf)); - rettv->vval.v_number = n; -#endif -} - -/* - * "histget()" function - */ - static void -f_histget(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_CMDHIST - int type; - int idx; - char_u *str; - - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ - if (str == NULL) - rettv->vval.v_string = NULL; - else - { - type = get_histtype(str); - if (argvars[1].v_type == VAR_UNKNOWN) - idx = get_history_idx(type); - else - idx = (int)get_tv_number_chk(&argvars[1], NULL); - /* -1 on type error */ - rettv->vval.v_string = vim_strsave(get_history_entry(type, idx)); - } -#else - rettv->vval.v_string = NULL; -#endif - rettv->v_type = VAR_STRING; -} - -/* - * "histnr()" function - */ - static void -f_histnr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int i; - -#ifdef FEAT_CMDHIST - char_u *history = get_tv_string_chk(&argvars[0]); - - i = history == NULL ? HIST_CMD - 1 : get_histtype(history); - if (i >= HIST_CMD && i < HIST_COUNT) - i = get_history_idx(i); - else -#endif - i = -1; - rettv->vval.v_number = i; -} - -/* - * "highlightID(name)" function - */ - static void -f_hlID(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = syn_name2id(get_tv_string(&argvars[0])); -} - -/* - * "highlight_exists()" function - */ - static void -f_hlexists(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = highlight_exists(get_tv_string(&argvars[0])); -} - -/* - * "hostname()" function - */ - static void -f_hostname(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u hostname[256]; - - mch_get_host_name(hostname, 256); - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(hostname); -} - -/* - * iconv() function - */ - static void -f_iconv(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_MBYTE - char_u buf1[NUMBUFLEN]; - char_u buf2[NUMBUFLEN]; - char_u *from, *to, *str; - vimconv_T vimconv; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - -#ifdef FEAT_MBYTE - str = get_tv_string(&argvars[0]); - from = enc_canonize(enc_skip(get_tv_string_buf(&argvars[1], buf1))); - to = enc_canonize(enc_skip(get_tv_string_buf(&argvars[2], buf2))); - vimconv.vc_type = CONV_NONE; - convert_setup(&vimconv, from, to); - - /* If the encodings are equal, no conversion needed. */ - if (vimconv.vc_type == CONV_NONE) - rettv->vval.v_string = vim_strsave(str); - else - rettv->vval.v_string = string_convert(&vimconv, str, NULL); - - convert_setup(&vimconv, NULL, NULL); - vim_free(from); - vim_free(to); -#endif -} - -/* - * "indent()" function - */ - static void -f_indent(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - - lnum = get_tv_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - rettv->vval.v_number = get_indent_lnum(lnum); - else - rettv->vval.v_number = -1; -} - -/* - * "index()" function - */ - static void -f_index(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - list_T *l; - listitem_T *item; - long idx = 0; - int ic = FALSE; - - rettv->vval.v_number = -1; - if (argvars[0].v_type != VAR_LIST) - { - EMSG(_(e_listreq)); - return; - } - l = argvars[0].vval.v_list; - if (l != NULL) - { - item = l->lv_first; - if (argvars[2].v_type != VAR_UNKNOWN) - { - int error = FALSE; - - /* Start at specified item. Use the cached index that list_find() - * sets, so that a negative number also works. */ - item = list_find(l, get_tv_number_chk(&argvars[2], &error)); - idx = l->lv_idx; - if (argvars[3].v_type != VAR_UNKNOWN) - ic = get_tv_number_chk(&argvars[3], &error); - if (error) - item = NULL; - } - - for ( ; item != NULL; item = item->li_next, ++idx) - if (tv_equal(&item->li_tv, &argvars[1], ic, FALSE)) - { - rettv->vval.v_number = idx; - break; - } - } -} - -static int inputsecret_flag = 0; - -static void get_user_input __ARGS((typval_T *argvars, typval_T *rettv, int inputdialog)); - -/* - * This function is used by f_input() and f_inputdialog() functions. The third - * argument to f_input() specifies the type of completion to use at the - * prompt. The third argument to f_inputdialog() specifies the value to return - * when the user cancels the prompt. - */ - static void -get_user_input(argvars, rettv, inputdialog) - typval_T *argvars; - typval_T *rettv; - int inputdialog; -{ - char_u *prompt = get_tv_string_chk(&argvars[0]); - char_u *p = NULL; - int c; - char_u buf[NUMBUFLEN]; - int cmd_silent_save = cmd_silent; - char_u *defstr = (char_u *)""; - int xp_type = EXPAND_NOTHING; - char_u *xp_arg = NULL; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - -#ifdef NO_CONSOLE_INPUT - /* While starting up, there is no place to enter text. */ - if (no_console_input()) - return; -#endif - - cmd_silent = FALSE; /* Want to see the prompt. */ - if (prompt != NULL) - { - /* Only the part of the message after the last NL is considered as - * prompt for the command line */ - p = vim_strrchr(prompt, '\n'); - if (p == NULL) - p = prompt; - else - { - ++p; - c = *p; - *p = NUL; - msg_start(); - msg_clr_eos(); - msg_puts_attr(prompt, echo_attr); - msg_didout = FALSE; - msg_starthere(); - *p = c; - } - cmdline_row = msg_row; - - if (argvars[1].v_type != VAR_UNKNOWN) - { - defstr = get_tv_string_buf_chk(&argvars[1], buf); - if (defstr != NULL) - stuffReadbuffSpec(defstr); - - if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN) - { - char_u *xp_name; - int xp_namelen; - long argt; - - /* input() with a third argument: completion */ - rettv->vval.v_string = NULL; - - xp_name = get_tv_string_buf_chk(&argvars[2], buf); - if (xp_name == NULL) - return; - - xp_namelen = (int)STRLEN(xp_name); - - if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt, - &xp_arg) == FAIL) - return; - } - } - - if (defstr != NULL) - { -# ifdef FEAT_EX_EXTRA - int save_ex_normal_busy = ex_normal_busy; - ex_normal_busy = 0; -# endif - rettv->vval.v_string = - getcmdline_prompt(inputsecret_flag ? NUL : '@', p, echo_attr, - xp_type, xp_arg); -# ifdef FEAT_EX_EXTRA - ex_normal_busy = save_ex_normal_busy; -# endif - } - if (inputdialog && rettv->vval.v_string == NULL - && argvars[1].v_type != VAR_UNKNOWN - && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(get_tv_string_buf( - &argvars[2], buf)); - - vim_free(xp_arg); - - /* since the user typed this, no need to wait for return */ - need_wait_return = FALSE; - msg_didout = FALSE; - } - cmd_silent = cmd_silent_save; -} - -/* - * "input()" function - * Also handles inputsecret() when inputsecret is set. - */ - static void -f_input(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - get_user_input(argvars, rettv, FALSE); -} - -/* - * "inputdialog()" function - */ - static void -f_inputdialog(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ -#if defined(FEAT_GUI_TEXTDIALOG) - /* Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' */ - if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) - { - char_u *message; - char_u buf[NUMBUFLEN]; - char_u *defstr = (char_u *)""; - - message = get_tv_string_chk(&argvars[0]); - if (argvars[1].v_type != VAR_UNKNOWN - && (defstr = get_tv_string_buf_chk(&argvars[1], buf)) != NULL) - vim_strncpy(IObuff, defstr, IOSIZE - 1); - else - IObuff[0] = NUL; - if (message != NULL && defstr != NULL - && do_dialog(VIM_QUESTION, NULL, message, - (char_u *)_("&OK\n&Cancel"), 1, IObuff, FALSE) == 1) - rettv->vval.v_string = vim_strsave(IObuff); - else - { - if (message != NULL && defstr != NULL - && argvars[1].v_type != VAR_UNKNOWN - && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave( - get_tv_string_buf(&argvars[2], buf)); - else - rettv->vval.v_string = NULL; - } - rettv->v_type = VAR_STRING; - } - else -#endif - get_user_input(argvars, rettv, TRUE); -} - -/* - * "inputlist()" function - */ - static void -f_inputlist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - listitem_T *li; - int selected; - int mouse_used; - -#ifdef NO_CONSOLE_INPUT - /* While starting up, there is no place to enter text. */ - if (no_console_input()) - return; -#endif - if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL) - { - EMSG2(_(e_listarg), "inputlist()"); - return; - } - - msg_start(); - msg_row = Rows - 1; /* for when 'cmdheight' > 1 */ - lines_left = Rows; /* avoid more prompt */ - msg_scroll = TRUE; - msg_clr_eos(); - - for (li = argvars[0].vval.v_list->lv_first; li != NULL; li = li->li_next) - { - msg_puts(get_tv_string(&li->li_tv)); - msg_putchar('\n'); - } - - /* Ask for choice. */ - selected = prompt_for_number(&mouse_used); - if (mouse_used) - selected -= lines_left; - - rettv->vval.v_number = selected; -} - - -static garray_T ga_userinput = {0, 0, sizeof(tasave_T), 4, NULL}; - -/* - * "inputrestore()" function - */ - static void -f_inputrestore(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - if (ga_userinput.ga_len > 0) - { - --ga_userinput.ga_len; - restore_typeahead((tasave_T *)(ga_userinput.ga_data) - + ga_userinput.ga_len); - /* default return is zero == OK */ - } - else if (p_verbose > 1) - { - verb_msg((char_u *)_("called inputrestore() more often than inputsave()")); - rettv->vval.v_number = 1; /* Failed */ - } -} - -/* - * "inputsave()" function - */ - static void -f_inputsave(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - /* Add an entry to the stack of typeahead storage. */ - if (ga_grow(&ga_userinput, 1) == OK) - { - save_typeahead((tasave_T *)(ga_userinput.ga_data) - + ga_userinput.ga_len); - ++ga_userinput.ga_len; - /* default return is zero == OK */ - } - else - rettv->vval.v_number = 1; /* Failed */ -} - -/* - * "inputsecret()" function - */ - static void -f_inputsecret(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - ++cmdline_star; - ++inputsecret_flag; - f_input(argvars, rettv); - --cmdline_star; - --inputsecret_flag; -} - -/* - * "insert()" function - */ - static void -f_insert(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - long before = 0; - listitem_T *item; - list_T *l; - int error = FALSE; - - if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), "insert()"); - else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, (char_u *)_("insert() argument"))) - { - if (argvars[2].v_type != VAR_UNKNOWN) - before = get_tv_number_chk(&argvars[2], &error); - if (error) - return; /* type error; errmsg already given */ - - if (before == l->lv_len) - item = NULL; - else - { - item = list_find(l, before); - if (item == NULL) - { - EMSGN(_(e_listidx), before); - l = NULL; - } - } - if (l != NULL) - { - list_insert_tv(l, &argvars[1], item); - copy_tv(&argvars[0], rettv); - } - } -} - -/* - * "invert(expr)" function - */ - static void -f_invert(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = ~get_tv_number_chk(&argvars[0], NULL); -} - -/* - * "isdirectory()" function - */ - static void -f_isdirectory(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = mch_isdir(get_tv_string(&argvars[0])); -} - -/* - * "islocked()" function - */ - static void -f_islocked(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - lval_T lv; - char_u *end; - dictitem_T *di; - - rettv->vval.v_number = -1; - end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, - GLV_NO_AUTOLOAD, FNE_CHECK_START); - if (end != NULL && lv.ll_name != NULL) - { - if (*end != NUL) - EMSG(_(e_trailing)); - else - { - if (lv.ll_tv == NULL) - { - if (check_changedtick(lv.ll_name)) - rettv->vval.v_number = 1; /* always locked */ - else - { - di = find_var(lv.ll_name, NULL, TRUE); - if (di != NULL) - { - /* Consider a variable locked when: - * 1. the variable itself is locked - * 2. the value of the variable is locked. - * 3. the List or Dict value is locked. - */ - rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) - || tv_islocked(&di->di_tv)); - } - } - } - else if (lv.ll_range) - EMSG(_("E786: Range not allowed")); - else if (lv.ll_newkey != NULL) - EMSG2(_(e_dictkey), lv.ll_newkey); - else if (lv.ll_list != NULL) - /* List item. */ - rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv); - else - /* Dictionary item. */ - rettv->vval.v_number = tv_islocked(&lv.ll_di->di_tv); - } - } - - clear_lval(&lv); -} - -static void dict_list __ARGS((typval_T *argvars, typval_T *rettv, int what)); - -/* - * Turn a dict into a list: - * "what" == 0: list of keys - * "what" == 1: list of values - * "what" == 2: list of items - */ - static void -dict_list(argvars, rettv, what) - typval_T *argvars; - typval_T *rettv; - int what; -{ - list_T *l2; - dictitem_T *di; - hashitem_T *hi; - listitem_T *li; - listitem_T *li2; - dict_T *d; - int todo; - - if (argvars[0].v_type != VAR_DICT) - { - EMSG(_(e_dictreq)); - return; - } - if ((d = argvars[0].vval.v_dict) == NULL) - return; - - if (rettv_list_alloc(rettv) == FAIL) - return; - - todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - di = HI2DI(hi); - - li = listitem_alloc(); - if (li == NULL) - break; - list_append(rettv->vval.v_list, li); - - if (what == 0) - { - /* keys() */ - li->li_tv.v_type = VAR_STRING; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_string = vim_strsave(di->di_key); - } - else if (what == 1) - { - /* values() */ - copy_tv(&di->di_tv, &li->li_tv); - } - else - { - /* items() */ - l2 = list_alloc(); - li->li_tv.v_type = VAR_LIST; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_list = l2; - if (l2 == NULL) - break; - ++l2->lv_refcount; - - li2 = listitem_alloc(); - if (li2 == NULL) - break; - list_append(l2, li2); - li2->li_tv.v_type = VAR_STRING; - li2->li_tv.v_lock = 0; - li2->li_tv.vval.v_string = vim_strsave(di->di_key); - - li2 = listitem_alloc(); - if (li2 == NULL) - break; - list_append(l2, li2); - copy_tv(&di->di_tv, &li2->li_tv); - } - } - } -} - -/* - * "items(dict)" function - */ - static void -f_items(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - dict_list(argvars, rettv, 2); -} - -/* - * "join()" function - */ - static void -f_join(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - garray_T ga; - char_u *sep; - - if (argvars[0].v_type != VAR_LIST) - { - EMSG(_(e_listreq)); - return; - } - if (argvars[0].vval.v_list == NULL) - return; - if (argvars[1].v_type == VAR_UNKNOWN) - sep = (char_u *)" "; - else - sep = get_tv_string_chk(&argvars[1]); - - rettv->v_type = VAR_STRING; - - if (sep != NULL) - { - ga_init2(&ga, (int)sizeof(char), 80); - list_join(&ga, argvars[0].vval.v_list, sep, TRUE, 0); - ga_append(&ga, NUL); - rettv->vval.v_string = (char_u *)ga.ga_data; - } - else - rettv->vval.v_string = NULL; -} - -/* - * "keys()" function - */ - static void -f_keys(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - dict_list(argvars, rettv, 0); -} - -/* - * "last_buffer_nr()" function. - */ - static void -f_last_buffer_nr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int n = 0; - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (n < buf->b_fnum) - n = buf->b_fnum; - - rettv->vval.v_number = n; -} - -/* - * "len()" function - */ - static void -f_len(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - switch (argvars[0].v_type) - { - case VAR_STRING: - case VAR_NUMBER: - rettv->vval.v_number = (varnumber_T)STRLEN( - get_tv_string(&argvars[0])); - break; - case VAR_LIST: - rettv->vval.v_number = list_len(argvars[0].vval.v_list); - break; - case VAR_DICT: - rettv->vval.v_number = dict_len(argvars[0].vval.v_dict); - break; - default: - EMSG(_("E701: Invalid type for len()")); - break; - } -} - -static void libcall_common __ARGS((typval_T *argvars, typval_T *rettv, int type)); - - static void -libcall_common(argvars, rettv, type) - typval_T *argvars; - typval_T *rettv; - int type; -{ -#ifdef FEAT_LIBCALL - char_u *string_in; - char_u **string_result; - int nr_result; -#endif - - rettv->v_type = type; - if (type != VAR_NUMBER) - rettv->vval.v_string = NULL; - - if (check_restricted() || check_secure()) - return; - -#ifdef FEAT_LIBCALL - /* The first two args must be strings, otherwise its meaningless */ - if (argvars[0].v_type == VAR_STRING && argvars[1].v_type == VAR_STRING) - { - string_in = NULL; - if (argvars[2].v_type == VAR_STRING) - string_in = argvars[2].vval.v_string; - if (type == VAR_NUMBER) - string_result = NULL; - else - string_result = &rettv->vval.v_string; - if (mch_libcall(argvars[0].vval.v_string, - argvars[1].vval.v_string, - string_in, - argvars[2].vval.v_number, - string_result, - &nr_result) == OK - && type == VAR_NUMBER) - rettv->vval.v_number = nr_result; - } -#endif -} - -/* - * "libcall()" function - */ - static void -f_libcall(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - libcall_common(argvars, rettv, VAR_STRING); -} - -/* - * "libcallnr()" function - */ - static void -f_libcallnr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - libcall_common(argvars, rettv, VAR_NUMBER); -} - -/* - * "line(string)" function - */ - static void -f_line(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum = 0; - pos_T *fp; - int fnum; - - fp = var2fpos(&argvars[0], TRUE, &fnum); - if (fp != NULL) - lnum = fp->lnum; - rettv->vval.v_number = lnum; -} - -/* - * "line2byte(lnum)" function - */ - static void -f_line2byte(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifndef FEAT_BYTEOFF - rettv->vval.v_number = -1; -#else - linenr_T lnum; - - lnum = get_tv_lnum(argvars); - if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = ml_find_line_or_offset(curbuf, lnum, NULL); - if (rettv->vval.v_number >= 0) - ++rettv->vval.v_number; -#endif -} - -/* - * "lispindent(lnum)" function - */ - static void -f_lispindent(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_LISP - pos_T pos; - linenr_T lnum; - - pos = curwin->w_cursor; - lnum = get_tv_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - { - curwin->w_cursor.lnum = lnum; - rettv->vval.v_number = get_lisp_indent(); - curwin->w_cursor = pos; - } - else -#endif - rettv->vval.v_number = -1; -} - -/* - * "localtime()" function - */ - static void -f_localtime(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = (varnumber_T)time(NULL); -} - -static void get_maparg __ARGS((typval_T *argvars, typval_T *rettv, int exact)); - - static void -get_maparg(argvars, rettv, exact) - typval_T *argvars; - typval_T *rettv; - int exact; -{ - char_u *keys; - char_u *which; - char_u buf[NUMBUFLEN]; - char_u *keys_buf = NULL; - char_u *rhs; - int mode; - int abbr = FALSE; - int get_dict = FALSE; - mapblock_T *mp; - int buffer_local; - - /* return empty string for failure */ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - - keys = get_tv_string(&argvars[0]); - if (*keys == NUL) - return; - - if (argvars[1].v_type != VAR_UNKNOWN) - { - which = get_tv_string_buf_chk(&argvars[1], buf); - if (argvars[2].v_type != VAR_UNKNOWN) - { - abbr = get_tv_number(&argvars[2]); - if (argvars[3].v_type != VAR_UNKNOWN) - get_dict = get_tv_number(&argvars[3]); - } - } - else - which = (char_u *)""; - if (which == NULL) - return; - - mode = get_map_mode(&which, 0); - - keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE); - rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local); - vim_free(keys_buf); - - if (!get_dict) - { - /* Return a string. */ - if (rhs != NULL) - rettv->vval.v_string = str2special_save(rhs, FALSE); - - } - else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL) - { - /* Return a dictionary. */ - char_u *lhs = str2special_save(mp->m_keys, TRUE); - char_u *mapmode = map_mode_to_chars(mp->m_mode); - dict_T *dict = rettv->vval.v_dict; - - dict_add_nr_str(dict, "lhs", 0L, lhs); - dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str); - dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL); - dict_add_nr_str(dict, "expr", mp->m_expr ? 1L : 0L, NULL); - dict_add_nr_str(dict, "silent", mp->m_silent ? 1L : 0L, NULL); - dict_add_nr_str(dict, "sid", (long)mp->m_script_ID, NULL); - dict_add_nr_str(dict, "buffer", (long)buffer_local, NULL); - dict_add_nr_str(dict, "nowait", mp->m_nowait ? 1L : 0L, NULL); - dict_add_nr_str(dict, "mode", 0L, mapmode); - - vim_free(lhs); - vim_free(mapmode); - } -} - -#ifdef FEAT_FLOAT -/* - * "log()" function - */ - static void -f_log(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = log(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "log10()" function - */ - static void -f_log10(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = log10(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -#ifdef FEAT_LUA -/* - * "luaeval()" function - */ - static void -f_luaeval(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *str; - char_u buf[NUMBUFLEN]; - - str = get_tv_string_buf(&argvars[0], buf); - do_luaeval(str, argvars + 1, rettv); -} -#endif - -/* - * "map()" function - */ - static void -f_map(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - filter_map(argvars, rettv, TRUE); -} - -/* - * "maparg()" function - */ - static void -f_maparg(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - get_maparg(argvars, rettv, TRUE); -} - -/* - * "mapcheck()" function - */ - static void -f_mapcheck(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - get_maparg(argvars, rettv, FALSE); -} - -static void find_some_match __ARGS((typval_T *argvars, typval_T *rettv, int start)); - - static void -find_some_match(argvars, rettv, type) - typval_T *argvars; - typval_T *rettv; - int type; -{ - char_u *str = NULL; - long len = 0; - char_u *expr = NULL; - char_u *pat; - regmatch_T regmatch; - char_u patbuf[NUMBUFLEN]; - char_u strbuf[NUMBUFLEN]; - char_u *save_cpo; - long start = 0; - long nth = 1; - colnr_T startcol = 0; - int match = 0; - list_T *l = NULL; - listitem_T *li = NULL; - long idx = 0; - char_u *tofree = NULL; - - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ - save_cpo = p_cpo; - p_cpo = (char_u *)""; - - rettv->vval.v_number = -1; - if (type == 3) - { - /* return empty list when there are no matches */ - if (rettv_list_alloc(rettv) == FAIL) - goto theend; - } - else if (type == 2) - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - } - - if (argvars[0].v_type == VAR_LIST) - { - if ((l = argvars[0].vval.v_list) == NULL) - goto theend; - li = l->lv_first; - } - else - { - expr = str = get_tv_string(&argvars[0]); - len = (long)STRLEN(str); - } - - pat = get_tv_string_buf_chk(&argvars[1], patbuf); - if (pat == NULL) - goto theend; - - if (argvars[2].v_type != VAR_UNKNOWN) - { - int error = FALSE; - - start = get_tv_number_chk(&argvars[2], &error); - if (error) - goto theend; - if (l != NULL) - { - li = list_find(l, start); - if (li == NULL) - goto theend; - idx = l->lv_idx; /* use the cached index */ - } - else - { - if (start < 0) - start = 0; - if (start > len) - goto theend; - /* When "count" argument is there ignore matches before "start", - * otherwise skip part of the string. Differs when pattern is "^" - * or "\<". */ - if (argvars[3].v_type != VAR_UNKNOWN) - startcol = start; - else - { - str += start; - len -= start; - } - } - - if (argvars[3].v_type != VAR_UNKNOWN) - nth = get_tv_number_chk(&argvars[3], &error); - if (error) - goto theend; - } - - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - if (regmatch.regprog != NULL) - { - regmatch.rm_ic = p_ic; - - for (;;) - { - if (l != NULL) - { - if (li == NULL) - { - match = FALSE; - break; - } - vim_free(tofree); - str = echo_string(&li->li_tv, &tofree, strbuf, 0); - if (str == NULL) - break; - } - - match = vim_regexec_nl(®match, str, (colnr_T)startcol); - - if (match && --nth <= 0) - break; - if (l == NULL && !match) - break; - - /* Advance to just after the match. */ - if (l != NULL) - { - li = li->li_next; - ++idx; - } - else - { -#ifdef FEAT_MBYTE - startcol = (colnr_T)(regmatch.startp[0] - + (*mb_ptr2len)(regmatch.startp[0]) - str); -#else - startcol = (colnr_T)(regmatch.startp[0] + 1 - str); -#endif - if (startcol > (colnr_T)len - || str + startcol <= regmatch.startp[0]) - { - match = FALSE; - break; - } - } - } - - if (match) - { - if (type == 3) - { - int i; - - /* return list with matched string and submatches */ - for (i = 0; i < NSUBEXP; ++i) - { - if (regmatch.endp[i] == NULL) - { - if (list_append_string(rettv->vval.v_list, - (char_u *)"", 0) == FAIL) - break; - } - else if (list_append_string(rettv->vval.v_list, - regmatch.startp[i], - (int)(regmatch.endp[i] - regmatch.startp[i])) - == FAIL) - break; - } - } - else if (type == 2) - { - /* return matched string */ - if (l != NULL) - copy_tv(&li->li_tv, rettv); - else - rettv->vval.v_string = vim_strnsave(regmatch.startp[0], - (int)(regmatch.endp[0] - regmatch.startp[0])); - } - else if (l != NULL) - rettv->vval.v_number = idx; - else - { - if (type != 0) - rettv->vval.v_number = - (varnumber_T)(regmatch.startp[0] - str); - else - rettv->vval.v_number = - (varnumber_T)(regmatch.endp[0] - str); - rettv->vval.v_number += (varnumber_T)(str - expr); - } - } - vim_regfree(regmatch.regprog); - } - -theend: - vim_free(tofree); - p_cpo = save_cpo; -} - -/* - * "match()" function - */ - static void -f_match(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - find_some_match(argvars, rettv, 1); -} - -/* - * "matchadd()" function - */ - static void -f_matchadd(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - char_u buf[NUMBUFLEN]; - char_u *grp = get_tv_string_buf_chk(&argvars[0], buf); /* group */ - char_u *pat = get_tv_string_buf_chk(&argvars[1], buf); /* pattern */ - int prio = 10; /* default priority */ - int id = -1; - int error = FALSE; - - rettv->vval.v_number = -1; - - if (grp == NULL || pat == NULL) - return; - if (argvars[2].v_type != VAR_UNKNOWN) - { - prio = get_tv_number_chk(&argvars[2], &error); - if (argvars[3].v_type != VAR_UNKNOWN) - id = get_tv_number_chk(&argvars[3], &error); - } - if (error == TRUE) - return; - if (id >= 1 && id <= 3) - { - EMSGN("E798: ID is reserved for \":match\": %ld", id); - return; - } - - rettv->vval.v_number = match_add(curwin, grp, pat, prio, id, NULL); -#endif -} - -/* - * "matchaddpos()" function - */ - static void -f_matchaddpos(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - char_u buf[NUMBUFLEN]; - char_u *group; - int prio = 10; - int id = -1; - int error = FALSE; - list_T *l; - - rettv->vval.v_number = -1; - - group = get_tv_string_buf_chk(&argvars[0], buf); - if (group == NULL) - return; - - if (argvars[1].v_type != VAR_LIST) - { - EMSG2(_(e_listarg), "matchaddpos()"); - return; - } - l = argvars[1].vval.v_list; - if (l == NULL) - return; - - if (argvars[2].v_type != VAR_UNKNOWN) - { - prio = get_tv_number_chk(&argvars[2], &error); - if (argvars[3].v_type != VAR_UNKNOWN) - id = get_tv_number_chk(&argvars[3], &error); - } - if (error == TRUE) - return; - - /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */ - if (id == 1 || id == 2) - { - EMSGN("E798: ID is reserved for \":match\": %ld", id); - return; - } - - rettv->vval.v_number = match_add(curwin, group, NULL, prio, id, l); -#endif -} - -/* - * "matcharg()" function - */ - static void -f_matcharg(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - if (rettv_list_alloc(rettv) == OK) - { -#ifdef FEAT_SEARCH_EXTRA - int id = get_tv_number(&argvars[0]); - matchitem_T *m; - - if (id >= 1 && id <= 3) - { - if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) - { - list_append_string(rettv->vval.v_list, - syn_id2name(m->hlg_id), -1); - list_append_string(rettv->vval.v_list, m->pattern, -1); - } - else - { - list_append_string(rettv->vval.v_list, NULL, -1); - list_append_string(rettv->vval.v_list, NULL, -1); - } - } -#endif - } -} - -/* - * "matchdelete()" function - */ - static void -f_matchdelete(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - rettv->vval.v_number = match_delete(curwin, - (int)get_tv_number(&argvars[0]), TRUE); -#endif -} - -/* - * "matchend()" function - */ - static void -f_matchend(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - find_some_match(argvars, rettv, 0); -} - -/* - * "matchlist()" function - */ - static void -f_matchlist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - find_some_match(argvars, rettv, 3); -} - -/* - * "matchstr()" function - */ - static void -f_matchstr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - find_some_match(argvars, rettv, 2); -} - -static void max_min __ARGS((typval_T *argvars, typval_T *rettv, int domax)); - - static void -max_min(argvars, rettv, domax) - typval_T *argvars; - typval_T *rettv; - int domax; -{ - long n = 0; - long i; - int error = FALSE; - - if (argvars[0].v_type == VAR_LIST) - { - list_T *l; - listitem_T *li; - - l = argvars[0].vval.v_list; - if (l != NULL) - { - li = l->lv_first; - if (li != NULL) - { - n = get_tv_number_chk(&li->li_tv, &error); - for (;;) - { - li = li->li_next; - if (li == NULL) - break; - i = get_tv_number_chk(&li->li_tv, &error); - if (domax ? i > n : i < n) - n = i; - } - } - } - } - else if (argvars[0].v_type == VAR_DICT) - { - dict_T *d; - int first = TRUE; - hashitem_T *hi; - int todo; - - d = argvars[0].vval.v_dict; - if (d != NULL) - { - todo = (int)d->dv_hashtab.ht_used; - for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - i = get_tv_number_chk(&HI2DI(hi)->di_tv, &error); - if (first) - { - n = i; - first = FALSE; - } - else if (domax ? i > n : i < n) - n = i; - } - } - } - } - else - EMSG(_(e_listdictarg)); - rettv->vval.v_number = error ? 0 : n; -} - -/* - * "max()" function - */ - static void -f_max(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - max_min(argvars, rettv, TRUE); -} - -/* - * "min()" function - */ - static void -f_min(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - max_min(argvars, rettv, FALSE); -} - -static int mkdir_recurse __ARGS((char_u *dir, int prot)); - -/* - * Create the directory in which "dir" is located, and higher levels when - * needed. - */ - static int -mkdir_recurse(dir, prot) - char_u *dir; - int prot; -{ - char_u *p; - char_u *updir; - int r = FAIL; - - /* Get end of directory name in "dir". - * We're done when it's "/" or "c:/". */ - p = gettail_sep(dir); - if (p <= get_past_head(dir)) - return OK; - - /* If the directory exists we're done. Otherwise: create it.*/ - updir = vim_strnsave(dir, (int)(p - dir)); - if (updir == NULL) - return FAIL; - if (mch_isdir(updir)) - r = OK; - else if (mkdir_recurse(updir, prot) == OK) - r = vim_mkdir_emsg(updir, prot); - vim_free(updir); - return r; -} - -#ifdef vim_mkdir -/* - * "mkdir()" function - */ - static void -f_mkdir(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *dir; - char_u buf[NUMBUFLEN]; - int prot = 0755; - - rettv->vval.v_number = FAIL; - if (check_restricted() || check_secure()) - return; - - dir = get_tv_string_buf(&argvars[0], buf); - if (*dir == NUL) - rettv->vval.v_number = FAIL; - else - { - if (*gettail(dir) == NUL) - /* remove trailing slashes */ - *gettail_sep(dir) = NUL; - - if (argvars[1].v_type != VAR_UNKNOWN) - { - if (argvars[2].v_type != VAR_UNKNOWN) - prot = get_tv_number_chk(&argvars[2], NULL); - if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0) - mkdir_recurse(dir, prot); - } - rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot); - } -} -#endif - -/* - * "mode()" function - */ - static void -f_mode(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[3]; - - buf[1] = NUL; - buf[2] = NUL; - - if (VIsual_active) - { - if (VIsual_select) - buf[0] = VIsual_mode + 's' - 'v'; - else - buf[0] = VIsual_mode; - } - else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE - || State == CONFIRM) - { - buf[0] = 'r'; - if (State == ASKMORE) - buf[1] = 'm'; - else if (State == CONFIRM) - buf[1] = '?'; - } - else if (State == EXTERNCMD) - buf[0] = '!'; - else if (State & INSERT) - { -#ifdef FEAT_VREPLACE - if (State & VREPLACE_FLAG) - { - buf[0] = 'R'; - buf[1] = 'v'; - } - else -#endif - if (State & REPLACE_FLAG) - buf[0] = 'R'; - else - buf[0] = 'i'; - } - else if (State & CMDLINE) - { - buf[0] = 'c'; - if (exmode_active) - buf[1] = 'v'; - } - else if (exmode_active) - { - buf[0] = 'c'; - buf[1] = 'e'; - } - else - { - buf[0] = 'n'; - if (finish_op) - buf[1] = 'o'; - } - - /* Clear out the minor mode when the argument is not a non-zero number or - * non-empty string. */ - if (!non_zero_arg(&argvars[0])) - buf[1] = NUL; - - rettv->vval.v_string = vim_strsave(buf); - rettv->v_type = VAR_STRING; -} - -#if defined(FEAT_MZSCHEME) || defined(PROTO) -/* - * "mzeval()" function - */ - static void -f_mzeval(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *str; - char_u buf[NUMBUFLEN]; - - str = get_tv_string_buf(&argvars[0], buf); - do_mzeval(str, rettv); -} - - void -mzscheme_call_vim(name, args, rettv) - char_u *name; - typval_T *args; - typval_T *rettv; -{ - typval_T argvars[3]; - - argvars[0].v_type = VAR_STRING; - argvars[0].vval.v_string = name; - copy_tv(args, &argvars[1]); - argvars[2].v_type = VAR_UNKNOWN; - f_call(argvars, rettv); - clear_tv(&argvars[1]); -} -#endif - -/* - * "nextnonblank()" function - */ - static void -f_nextnonblank(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - - for (lnum = get_tv_lnum(argvars); ; ++lnum) - { - if (lnum < 0 || lnum > curbuf->b_ml.ml_line_count) - { - lnum = 0; - break; - } - if (*skipwhite(ml_get(lnum)) != NUL) - break; - } - rettv->vval.v_number = lnum; -} - -/* - * "nr2char()" function - */ - static void -f_nr2char(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[NUMBUFLEN]; - -#ifdef FEAT_MBYTE - if (has_mbyte) - { - int utf8 = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) - utf8 = get_tv_number_chk(&argvars[1], NULL); - if (utf8) - buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; - else - buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; - } - else -#endif - { - buf[0] = (char_u)get_tv_number(&argvars[0]); - buf[1] = NUL; - } - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(buf); -} - -/* - * "or(expr, expr)" function - */ - static void -f_or(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - | get_tv_number_chk(&argvars[1], NULL); -} - -/* - * "pathshorten()" function - */ - static void -f_pathshorten(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - - rettv->v_type = VAR_STRING; - p = get_tv_string_chk(&argvars[0]); - if (p == NULL) - rettv->vval.v_string = NULL; - else - { - p = vim_strsave(p); - rettv->vval.v_string = p; - if (p != NULL) - shorten_dir(p); - } -} - -#ifdef FEAT_FLOAT -/* - * "pow()" function - */ - static void -f_pow(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T fx, fy; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &fx) == OK - && get_float_arg(&argvars[1], &fy) == OK) - rettv->vval.v_float = pow(fx, fy); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "prevnonblank()" function - */ - static void -f_prevnonblank(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - - lnum = get_tv_lnum(argvars); - if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) - lnum = 0; - else - while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL) - --lnum; - rettv->vval.v_number = lnum; -} - -#ifdef HAVE_STDARG_H -/* This dummy va_list is here because: - * - passing a NULL pointer doesn't work when va_list isn't a pointer - * - locally in the function results in a "used before set" warning - * - using va_start() to initialize it gives "function with fixed args" error */ -static va_list ap; -#endif - -/* - * "printf()" function - */ - static void -f_printf(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef HAVE_STDARG_H /* only very old compilers can't do this */ - { - char_u buf[NUMBUFLEN]; - int len; - char_u *s; - int saved_did_emsg = did_emsg; - char *fmt; - - /* Get the required length, allocate the buffer and do it for real. */ - did_emsg = FALSE; - fmt = (char *)get_tv_string_buf(&argvars[0], buf); - len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1); - if (!did_emsg) - { - s = alloc(len + 1); - if (s != NULL) - { - rettv->vval.v_string = s; - (void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1); - } - } - did_emsg |= saved_did_emsg; - } -#endif -} - -/* - * "pumvisible()" function - */ - static void -f_pumvisible(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_INS_EXPAND - if (pum_visible()) - rettv->vval.v_number = 1; -#endif -} - -#ifdef FEAT_PYTHON3 -/* - * "py3eval()" function - */ - static void -f_py3eval(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *str; - char_u buf[NUMBUFLEN]; - - str = get_tv_string_buf(&argvars[0], buf); - do_py3eval(str, rettv); -} -#endif - -#ifdef FEAT_PYTHON -/* - * "pyeval()" function - */ - static void -f_pyeval(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *str; - char_u buf[NUMBUFLEN]; - - str = get_tv_string_buf(&argvars[0], buf); - do_pyeval(str, rettv); -} -#endif - -/* - * "range()" function - */ - static void -f_range(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - long start; - long end; - long stride = 1; - long i; - int error = FALSE; - - start = get_tv_number_chk(&argvars[0], &error); - if (argvars[1].v_type == VAR_UNKNOWN) - { - end = start - 1; - start = 0; - } - else - { - end = get_tv_number_chk(&argvars[1], &error); - if (argvars[2].v_type != VAR_UNKNOWN) - stride = get_tv_number_chk(&argvars[2], &error); - } - - if (error) - return; /* type error; errmsg already given */ - if (stride == 0) - EMSG(_("E726: Stride is zero")); - else if (stride > 0 ? end + 1 < start : end - 1 > start) - EMSG(_("E727: Start past end")); - else - { - if (rettv_list_alloc(rettv) == OK) - for (i = start; stride > 0 ? i <= end : i >= end; i += stride) - if (list_append_number(rettv->vval.v_list, - (varnumber_T)i) == FAIL) - break; - } -} - -/* - * "readfile()" function - */ - static void -f_readfile(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int binary = FALSE; - int failed = FALSE; - char_u *fname; - FILE *fd; - char_u buf[(IOSIZE/256)*256]; /* rounded to avoid odd + 1 */ - int io_size = sizeof(buf); - int readlen; /* size of last fread() */ - char_u *prev = NULL; /* previously read bytes, if any */ - long prevlen = 0; /* length of data in prev */ - long prevsize = 0; /* size of prev buffer */ - long maxline = MAXLNUM; - long cnt = 0; - char_u *p; /* position in buf */ - char_u *start; /* start of current line */ - - if (argvars[1].v_type != VAR_UNKNOWN) - { - if (STRCMP(get_tv_string(&argvars[1]), "b") == 0) - binary = TRUE; - if (argvars[2].v_type != VAR_UNKNOWN) - maxline = get_tv_number(&argvars[2]); - } - - if (rettv_list_alloc(rettv) == FAIL) - return; - - /* Always open the file in binary mode, library functions have a mind of - * their own about CR-LF conversion. */ - fname = get_tv_string(&argvars[0]); - if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) - { - EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") : fname); - return; - } - - while (cnt < maxline || maxline < 0) - { - readlen = (int)fread(buf, 1, io_size, fd); - - /* This for loop processes what was read, but is also entered at end - * of file so that either: - * - an incomplete line gets written - * - a "binary" file gets an empty line at the end if it ends in a - * newline. */ - for (p = buf, start = buf; - p < buf + readlen || (readlen <= 0 && (prevlen > 0 || binary)); - ++p) - { - if (*p == '\n' || readlen <= 0) - { - listitem_T *li; - char_u *s = NULL; - long_u len = p - start; - - /* Finished a line. Remove CRs before NL. */ - if (readlen > 0 && !binary) - { - while (len > 0 && start[len - 1] == '\r') - --len; - /* removal may cross back to the "prev" string */ - if (len == 0) - while (prevlen > 0 && prev[prevlen - 1] == '\r') - --prevlen; - } - if (prevlen == 0) - s = vim_strnsave(start, (int)len); - else - { - /* Change "prev" buffer to be the right size. This way - * the bytes are only copied once, and very long lines are - * allocated only once. */ - if ((s = vim_realloc(prev, prevlen + len + 1)) != NULL) - { - mch_memmove(s + prevlen, start, len); - s[prevlen + len] = NUL; - prev = NULL; /* the list will own the string */ - prevlen = prevsize = 0; - } - } - if (s == NULL) - { - do_outofmem_msg((long_u) prevlen + len + 1); - failed = TRUE; - break; - } - - if ((li = listitem_alloc()) == NULL) - { - vim_free(s); - failed = TRUE; - break; - } - li->li_tv.v_type = VAR_STRING; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_string = s; - list_append(rettv->vval.v_list, li); - - start = p + 1; /* step over newline */ - if ((++cnt >= maxline && maxline >= 0) || readlen <= 0) - break; - } - else if (*p == NUL) - *p = '\n'; -#ifdef FEAT_MBYTE - /* Check for utf8 "bom"; U+FEFF is encoded as EF BB BF. Do this - * when finding the BF and check the previous two bytes. */ - else if (*p == 0xbf && enc_utf8 && !binary) - { - /* Find the two bytes before the 0xbf. If p is at buf, or buf - * + 1, these may be in the "prev" string. */ - char_u back1 = p >= buf + 1 ? p[-1] - : prevlen >= 1 ? prev[prevlen - 1] : NUL; - char_u back2 = p >= buf + 2 ? p[-2] - : p == buf + 1 && prevlen >= 1 ? prev[prevlen - 1] - : prevlen >= 2 ? prev[prevlen - 2] : NUL; - - if (back2 == 0xef && back1 == 0xbb) - { - char_u *dest = p - 2; - - /* Usually a BOM is at the beginning of a file, and so at - * the beginning of a line; then we can just step over it. - */ - if (start == dest) - start = p + 1; - else - { - /* have to shuffle buf to close gap */ - int adjust_prevlen = 0; - - if (dest < buf) - { - adjust_prevlen = (int)(buf - dest); /* must be 1 or 2 */ - dest = buf; - } - if (readlen > p - buf + 1) - mch_memmove(dest, p + 1, readlen - (p - buf) - 1); - readlen -= 3 - adjust_prevlen; - prevlen -= adjust_prevlen; - p = dest - 1; - } - } - } -#endif - } /* for */ - - if (failed || (cnt >= maxline && maxline >= 0) || readlen <= 0) - break; - if (start < p) - { - /* There's part of a line in buf, store it in "prev". */ - if (p - start + prevlen >= prevsize) - { - /* need bigger "prev" buffer */ - char_u *newprev; - - /* A common use case is ordinary text files and "prev" gets a - * fragment of a line, so the first allocation is made - * small, to avoid repeatedly 'allocing' large and - * 'reallocing' small. */ - if (prevsize == 0) - prevsize = (long)(p - start); - else - { - long grow50pc = (prevsize * 3) / 2; - long growmin = (long)((p - start) * 2 + prevlen); - prevsize = grow50pc > growmin ? grow50pc : growmin; - } - newprev = prev == NULL ? alloc(prevsize) - : vim_realloc(prev, prevsize); - if (newprev == NULL) - { - do_outofmem_msg((long_u)prevsize); - failed = TRUE; - break; - } - prev = newprev; - } - /* Add the line part to end of "prev". */ - mch_memmove(prev + prevlen, start, p - start); - prevlen += (long)(p - start); - } - } /* while */ - - /* - * For a negative line count use only the lines at the end of the file, - * free the rest. - */ - if (!failed && maxline < 0) - while (cnt > -maxline) - { - listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first); - --cnt; - } - - if (failed) - { - list_free(rettv->vval.v_list, TRUE); - /* readfile doc says an empty list is returned on error */ - rettv->vval.v_list = list_alloc(); - } - - vim_free(prev); - fclose(fd); -} - -#if defined(FEAT_RELTIME) -static int list2proftime __ARGS((typval_T *arg, proftime_T *tm)); - -/* - * Convert a List to proftime_T. - * Return FAIL when there is something wrong. - */ - static int -list2proftime(arg, tm) - typval_T *arg; - proftime_T *tm; -{ - long n1, n2; - int error = FALSE; - - if (arg->v_type != VAR_LIST || arg->vval.v_list == NULL - || arg->vval.v_list->lv_len != 2) - return FAIL; - n1 = list_find_nr(arg->vval.v_list, 0L, &error); - n2 = list_find_nr(arg->vval.v_list, 1L, &error); -# ifdef WIN3264 - tm->HighPart = n1; - tm->LowPart = n2; -# else - tm->tv_sec = n1; - tm->tv_usec = n2; -# endif - return error ? FAIL : OK; -} -#endif /* FEAT_RELTIME */ - -/* - * "reltime()" function - */ - static void -f_reltime(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_RELTIME - proftime_T res; - proftime_T start; - - if (argvars[0].v_type == VAR_UNKNOWN) - { - /* No arguments: get current time. */ - profile_start(&res); - } - else if (argvars[1].v_type == VAR_UNKNOWN) - { - if (list2proftime(&argvars[0], &res) == FAIL) - return; - profile_end(&res); - } - else - { - /* Two arguments: compute the difference. */ - if (list2proftime(&argvars[0], &start) == FAIL - || list2proftime(&argvars[1], &res) == FAIL) - return; - profile_sub(&res, &start); - } - - if (rettv_list_alloc(rettv) == OK) - { - long n1, n2; - -# ifdef WIN3264 - n1 = res.HighPart; - n2 = res.LowPart; -# else - n1 = res.tv_sec; - n2 = res.tv_usec; -# endif - list_append_number(rettv->vval.v_list, (varnumber_T)n1); - list_append_number(rettv->vval.v_list, (varnumber_T)n2); - } -#endif -} - -/* - * "reltimestr()" function - */ - static void -f_reltimestr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_RELTIME - proftime_T tm; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_RELTIME - if (list2proftime(&argvars[0], &tm) == OK) - rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); -#endif -} - -#if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) -static void make_connection __ARGS((void)); -static int check_connection __ARGS((void)); - - static void -make_connection() -{ - if (X_DISPLAY == NULL -# ifdef FEAT_GUI - && !gui.in_use -# endif - ) - { - x_force_connect = TRUE; - setup_term_clip(); - x_force_connect = FALSE; - } -} - - static int -check_connection() -{ - make_connection(); - if (X_DISPLAY == NULL) - { - EMSG(_("E240: No connection to Vim server")); - return FAIL; - } - return OK; -} -#endif - -#ifdef FEAT_CLIENTSERVER -static void remote_common __ARGS((typval_T *argvars, typval_T *rettv, int expr)); - - static void -remote_common(argvars, rettv, expr) - typval_T *argvars; - typval_T *rettv; - int expr; -{ - char_u *server_name; - char_u *keys; - char_u *r = NULL; - char_u buf[NUMBUFLEN]; -# ifdef WIN32 - HWND w; -# elif defined(FEAT_X11) - Window w; -# elif defined(MAC_CLIENTSERVER) - int w; // This is the port number ('w' is a bit confusing) -# endif - - if (check_restricted() || check_secure()) - return; - -# ifdef FEAT_X11 - if (check_connection() == FAIL) - return; -# endif - - server_name = get_tv_string_chk(&argvars[0]); - if (server_name == NULL) - return; /* type error; errmsg already given */ - keys = get_tv_string_buf(&argvars[1], buf); -# ifdef WIN32 - if (serverSendToVim(server_name, keys, &r, &w, expr, TRUE) < 0) -# elif defined(FEAT_X11) - if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, 0, TRUE) - < 0) -# elif defined(MAC_CLIENTSERVER) - if (serverSendToVim(server_name, keys, &r, &w, expr, TRUE) < 0) -# endif - { - if (r != NULL) - EMSG(r); /* sending worked but evaluation failed */ - else - EMSG2(_("E241: Unable to send to %s"), server_name); - return; - } - - rettv->vval.v_string = r; - - if (argvars[2].v_type != VAR_UNKNOWN) - { - dictitem_T v; - char_u str[30]; - char_u *idvar; - - sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); - v.di_tv.v_type = VAR_STRING; - v.di_tv.vval.v_string = vim_strsave(str); - idvar = get_tv_string_chk(&argvars[2]); - if (idvar != NULL) - set_var(idvar, &v.di_tv, FALSE); - vim_free(v.di_tv.vval.v_string); - } -} -#endif - -/* - * "remote_expr()" function - */ - static void -f_remote_expr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_CLIENTSERVER - remote_common(argvars, rettv, TRUE); -#endif -} - -/* - * "remote_foreground()" function - */ - static void -f_remote_foreground(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_CLIENTSERVER -# ifdef WIN32 - /* On Win32 it's done in this application. */ - { - char_u *server_name = get_tv_string_chk(&argvars[0]); - - if (server_name != NULL) - serverForeground(server_name); - } -# elif defined(FEAT_X11) || defined(MAC_CLIENTSERVER) - /* Send a foreground() expression to the server. */ - argvars[1].v_type = VAR_STRING; - argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); - argvars[2].v_type = VAR_UNKNOWN; - remote_common(argvars, rettv, TRUE); - vim_free(argvars[1].vval.v_string); -# endif -#endif -} - - static void -f_remote_peek(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_CLIENTSERVER - dictitem_T v; - char_u *s = NULL; -# ifdef WIN32 - long_u n = 0; -# endif - char_u *serverid; - - if (check_restricted() || check_secure()) - { - rettv->vval.v_number = -1; - return; - } - serverid = get_tv_string_chk(&argvars[0]); - if (serverid == NULL) - { - rettv->vval.v_number = -1; - return; /* type error; errmsg already given */ - } -# ifdef WIN32 - sscanf(serverid, SCANF_HEX_LONG_U, &n); - if (n == 0) - rettv->vval.v_number = -1; - else - { - s = serverGetReply((HWND)n, FALSE, FALSE, FALSE); - rettv->vval.v_number = (s != NULL); - } -# elif defined(FEAT_X11) - if (check_connection() == FAIL) - return; - - rettv->vval.v_number = serverPeekReply(X_DISPLAY, - serverStrToWin(serverid), &s); -# elif defined(MAC_CLIENTSERVER) - rettv->vval.v_number = serverPeekReply(serverStrToPort(serverid), &s); -# endif - - if (argvars[1].v_type != VAR_UNKNOWN && rettv->vval.v_number > 0) - { - char_u *retvar; - - v.di_tv.v_type = VAR_STRING; - v.di_tv.vval.v_string = vim_strsave(s); - retvar = get_tv_string_chk(&argvars[1]); - if (retvar != NULL) - set_var(retvar, &v.di_tv, FALSE); - vim_free(v.di_tv.vval.v_string); - } -#else - rettv->vval.v_number = -1; -#endif -} - - static void -f_remote_read(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *r = NULL; - -#ifdef FEAT_CLIENTSERVER - char_u *serverid = get_tv_string_chk(&argvars[0]); - - if (serverid != NULL && !check_restricted() && !check_secure()) - { -# ifdef WIN32 - /* The server's HWND is encoded in the 'id' parameter */ - long_u n = 0; - - sscanf(serverid, SCANF_HEX_LONG_U, &n); - if (n != 0) - r = serverGetReply((HWND)n, FALSE, TRUE, TRUE); - if (r == NULL) -# elif defined(FEAT_X11) - if (check_connection() == FAIL || serverReadReply(X_DISPLAY, - serverStrToWin(serverid), &r, FALSE) < 0) -# elif defined(MAC_CLIENTSERVER) - if (serverReadReply(serverStrToPort(serverid), &r) < 0) -# endif - EMSG(_("E277: Unable to read a server reply")); - } -#endif - rettv->v_type = VAR_STRING; - rettv->vval.v_string = r; -} - -/* - * "remote_send()" function - */ - static void -f_remote_send(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_CLIENTSERVER - remote_common(argvars, rettv, FALSE); -#endif -} - -/* - * "remove()" function - */ - static void -f_remove(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - list_T *l; - listitem_T *item, *item2; - listitem_T *li; - long idx; - long end; - char_u *key; - dict_T *d; - dictitem_T *di; - char *arg_errmsg = N_("remove() argument"); - - if (argvars[0].v_type == VAR_DICT) - { - if (argvars[2].v_type != VAR_UNKNOWN) - EMSG2(_(e_toomanyarg), "remove()"); - else if ((d = argvars[0].vval.v_dict) != NULL - && !tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg))) - { - key = get_tv_string_chk(&argvars[1]); - if (key != NULL) - { - di = dict_find(d, key, -1); - if (di == NULL) - EMSG2(_(e_dictkey), key); - else - { - *rettv = di->di_tv; - init_tv(&di->di_tv); - dictitem_remove(d, di); - } - } - } - } - else if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listdictarg), "remove()"); - else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg))) - { - int error = FALSE; - - idx = get_tv_number_chk(&argvars[1], &error); - if (error) - ; /* type error: do nothing, errmsg already given */ - else if ((item = list_find(l, idx)) == NULL) - EMSGN(_(e_listidx), idx); - else - { - if (argvars[2].v_type == VAR_UNKNOWN) - { - /* Remove one item, return its value. */ - vimlist_remove(l, item, item); - *rettv = item->li_tv; - vim_free(item); - } - else - { - /* Remove range of items, return list with values. */ - end = get_tv_number_chk(&argvars[2], &error); - if (error) - ; /* type error: do nothing */ - else if ((item2 = list_find(l, end)) == NULL) - EMSGN(_(e_listidx), end); - else - { - int cnt = 0; - - for (li = item; li != NULL; li = li->li_next) - { - ++cnt; - if (li == item2) - break; - } - if (li == NULL) /* didn't find "item2" after "item" */ - EMSG(_(e_invrange)); - else - { - vimlist_remove(l, item, item2); - if (rettv_list_alloc(rettv) == OK) - { - l = rettv->vval.v_list; - l->lv_first = item; - l->lv_last = item2; - item->li_prev = NULL; - item2->li_next = NULL; - l->lv_len = cnt; - } - } - } - } - } - } -} - -/* - * "rename({from}, {to})" function - */ - static void -f_rename(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[NUMBUFLEN]; - - if (check_restricted() || check_secure()) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = vim_rename(get_tv_string(&argvars[0]), - get_tv_string_buf(&argvars[1], buf)); -} - -/* - * "repeat()" function - */ - static void -f_repeat(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - int n; - int slen; - int len; - char_u *r; - int i; - - n = get_tv_number(&argvars[1]); - if (argvars[0].v_type == VAR_LIST) - { - if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) - while (n-- > 0) - if (list_extend(rettv->vval.v_list, - argvars[0].vval.v_list, NULL) == FAIL) - break; - } - else - { - p = get_tv_string(&argvars[0]); - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - - slen = (int)STRLEN(p); - len = slen * n; - if (len <= 0) - return; - - r = alloc(len + 1); - if (r != NULL) - { - for (i = 0; i < n; i++) - mch_memmove(r + i * slen, p, (size_t)slen); - r[len] = NUL; - } - - rettv->vval.v_string = r; - } -} - -/* - * "resolve()" function - */ - static void -f_resolve(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; -#ifdef HAVE_READLINK - char_u *buf = NULL; -#endif - - p = get_tv_string(&argvars[0]); -#ifdef FEAT_SHORTCUT - { - char_u *v = NULL; - - v = mch_resolve_shortcut(p); - if (v != NULL) - rettv->vval.v_string = v; - else - rettv->vval.v_string = vim_strsave(p); - } -#else -# ifdef HAVE_READLINK - { - char_u *cpy; - int len; - char_u *remain = NULL; - char_u *q; - int is_relative_to_current = FALSE; - int has_trailing_pathsep = FALSE; - int limit = 100; - - p = vim_strsave(p); - - if (p[0] == '.' && (vim_ispathsep(p[1]) - || (p[1] == '.' && (vim_ispathsep(p[2]))))) - is_relative_to_current = TRUE; - - len = STRLEN(p); - if (len > 0 && after_pathsep(p, p + len)) - { - has_trailing_pathsep = TRUE; - p[len - 1] = NUL; /* the trailing slash breaks readlink() */ - } - - q = getnextcomp(p); - if (*q != NUL) - { - /* Separate the first path component in "p", and keep the - * remainder (beginning with the path separator). */ - remain = vim_strsave(q - 1); - q[-1] = NUL; - } - - buf = alloc(MAXPATHL + 1); - if (buf == NULL) - goto fail; - - for (;;) - { - for (;;) - { - len = readlink((char *)p, (char *)buf, MAXPATHL); - if (len <= 0) - break; - buf[len] = NUL; - - if (limit-- == 0) - { - vim_free(p); - vim_free(remain); - EMSG(_("E655: Too many symbolic links (cycle?)")); - rettv->vval.v_string = NULL; - goto fail; - } - - /* Ensure that the result will have a trailing path separator - * if the argument has one. */ - if (remain == NULL && has_trailing_pathsep) - add_pathsep(buf); - - /* Separate the first path component in the link value and - * concatenate the remainders. */ - q = getnextcomp(vim_ispathsep(*buf) ? buf + 1 : buf); - if (*q != NUL) - { - if (remain == NULL) - remain = vim_strsave(q - 1); - else - { - cpy = concat_str(q - 1, remain); - if (cpy != NULL) - { - vim_free(remain); - remain = cpy; - } - } - q[-1] = NUL; - } - - q = gettail(p); - if (q > p && *q == NUL) - { - /* Ignore trailing path separator. */ - q[-1] = NUL; - q = gettail(p); - } - if (q > p && !mch_isFullName(buf)) - { - /* symlink is relative to directory of argument */ - cpy = alloc((unsigned)(STRLEN(p) + STRLEN(buf) + 1)); - if (cpy != NULL) - { - STRCPY(cpy, p); - STRCPY(gettail(cpy), buf); - vim_free(p); - p = cpy; - } - } - else - { - vim_free(p); - p = vim_strsave(buf); - } - } - - if (remain == NULL) - break; - - /* Append the first path component of "remain" to "p". */ - q = getnextcomp(remain + 1); - len = q - remain - (*q != NUL); - cpy = vim_strnsave(p, STRLEN(p) + len); - if (cpy != NULL) - { - STRNCAT(cpy, remain, len); - vim_free(p); - p = cpy; - } - /* Shorten "remain". */ - if (*q != NUL) - STRMOVE(remain, q - 1); - else - { - vim_free(remain); - remain = NULL; - } - } - - /* If the result is a relative path name, make it explicitly relative to - * the current directory if and only if the argument had this form. */ - if (!vim_ispathsep(*p)) - { - if (is_relative_to_current - && *p != NUL - && !(p[0] == '.' - && (p[1] == NUL - || vim_ispathsep(p[1]) - || (p[1] == '.' - && (p[2] == NUL - || vim_ispathsep(p[2])))))) - { - /* Prepend "./". */ - cpy = concat_str((char_u *)"./", p); - if (cpy != NULL) - { - vim_free(p); - p = cpy; - } - } - else if (!is_relative_to_current) - { - /* Strip leading "./". */ - q = p; - while (q[0] == '.' && vim_ispathsep(q[1])) - q += 2; - if (q > p) - STRMOVE(p, p + 2); - } - } - - /* Ensure that the result will have no trailing path separator - * if the argument had none. But keep "/" or "//". */ - if (!has_trailing_pathsep) - { - q = p + STRLEN(p); - if (after_pathsep(p, q)) - *gettail_sep(p) = NUL; - } - - rettv->vval.v_string = p; - } -# else - rettv->vval.v_string = vim_strsave(p); -# endif -#endif - - simplify_filename(rettv->vval.v_string); - -#ifdef HAVE_READLINK -fail: - vim_free(buf); -#endif - rettv->v_type = VAR_STRING; -} - -/* - * "reverse({list})" function - */ - static void -f_reverse(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - list_T *l; - listitem_T *li, *ni; - - if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), "reverse()"); - else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, (char_u *)_("reverse() argument"))) - { - li = l->lv_last; - l->lv_first = l->lv_last = NULL; - l->lv_len = 0; - while (li != NULL) - { - ni = li->li_prev; - list_append(l, li); - li = ni; - } - rettv->vval.v_list = l; - rettv->v_type = VAR_LIST; - ++l->lv_refcount; - l->lv_idx = l->lv_len - l->lv_idx - 1; - } -} - -#define SP_NOMOVE 0x01 /* don't move cursor */ -#define SP_REPEAT 0x02 /* repeat to find outer pair */ -#define SP_RETCOUNT 0x04 /* return matchcount */ -#define SP_SETPCMARK 0x08 /* set previous context mark */ -#define SP_START 0x10 /* accept match at start position */ -#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */ -#define SP_END 0x40 /* leave cursor at end of match */ - -static int get_search_arg __ARGS((typval_T *varp, int *flagsp)); - -/* - * Get flags for a search function. - * Possibly sets "p_ws". - * Returns BACKWARD, FORWARD or zero (for an error). - */ - static int -get_search_arg(varp, flagsp) - typval_T *varp; - int *flagsp; -{ - int dir = FORWARD; - char_u *flags; - char_u nbuf[NUMBUFLEN]; - int mask; - - if (varp->v_type != VAR_UNKNOWN) - { - flags = get_tv_string_buf_chk(varp, nbuf); - if (flags == NULL) - return 0; /* type error; errmsg already given */ - while (*flags != NUL) - { - switch (*flags) - { - case 'b': dir = BACKWARD; break; - case 'w': p_ws = TRUE; break; - case 'W': p_ws = FALSE; break; - default: mask = 0; - if (flagsp != NULL) - switch (*flags) - { - case 'c': mask = SP_START; break; - case 'e': mask = SP_END; break; - case 'm': mask = SP_RETCOUNT; break; - case 'n': mask = SP_NOMOVE; break; - case 'p': mask = SP_SUBPAT; break; - case 'r': mask = SP_REPEAT; break; - case 's': mask = SP_SETPCMARK; break; - } - if (mask == 0) - { - EMSG2(_(e_invarg2), flags); - dir = 0; - } - else - *flagsp |= mask; - } - if (dir == 0) - break; - ++flags; - } - } - return dir; -} - -/* - * Shared by search() and searchpos() functions - */ - static int -search_cmn(argvars, match_pos, flagsp) - typval_T *argvars; - pos_T *match_pos; - int *flagsp; -{ - int flags; - char_u *pat; - pos_T pos; - pos_T save_cursor; - int save_p_ws = p_ws; - int dir; - int retval = 0; /* default: FAIL */ - long lnum_stop = 0; - proftime_T tm; -#ifdef FEAT_RELTIME - long time_limit = 0; -#endif - int options = SEARCH_KEEP; - int subpatnum; - - pat = get_tv_string(&argvars[0]); - dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */ - if (dir == 0) - goto theend; - flags = *flagsp; - if (flags & SP_START) - options |= SEARCH_START; - if (flags & SP_END) - options |= SEARCH_END; - - /* Optional arguments: line number to stop searching and timeout. */ - if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) - { - lnum_stop = get_tv_number_chk(&argvars[2], NULL); - if (lnum_stop < 0) - goto theend; -#ifdef FEAT_RELTIME - if (argvars[3].v_type != VAR_UNKNOWN) - { - time_limit = get_tv_number_chk(&argvars[3], NULL); - if (time_limit < 0) - goto theend; - } -#endif - } - -#ifdef FEAT_RELTIME - /* Set the time limit, if there is one. */ - profile_setlimit(time_limit, &tm); -#endif - - /* - * This function does not accept SP_REPEAT and SP_RETCOUNT flags. - * Check to make sure only those flags are set. - * Also, Only the SP_NOMOVE or the SP_SETPCMARK flag can be set. Both - * flags cannot be set. Check for that condition also. - */ - if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0) - || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) - { - EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); - goto theend; - } - - pos = save_cursor = curwin->w_cursor; - subpatnum = searchit(curwin, curbuf, &pos, dir, pat, 1L, - options, RE_SEARCH, (linenr_T)lnum_stop, &tm); - if (subpatnum != FAIL) - { - if (flags & SP_SUBPAT) - retval = subpatnum; - else - retval = pos.lnum; - if (flags & SP_SETPCMARK) - setpcmark(); - curwin->w_cursor = pos; - if (match_pos != NULL) - { - /* Store the match cursor position */ - match_pos->lnum = pos.lnum; - match_pos->col = pos.col + 1; - } - /* "/$" will put the cursor after the end of the line, may need to - * correct that here */ - check_cursor(); - } - - /* If 'n' flag is used: restore cursor position. */ - if (flags & SP_NOMOVE) - curwin->w_cursor = save_cursor; - else - curwin->w_set_curswant = TRUE; -theend: - p_ws = save_p_ws; - - return retval; -} - -#ifdef FEAT_FLOAT - -/* - * round() is not in C90, use ceil() or floor() instead. - */ - float_T -vim_round(f) - float_T f; -{ - return f > 0 ? floor(f + 0.5) : ceil(f - 0.5); -} - -/* - * "round({float})" function - */ - static void -f_round(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = vim_round(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "screenattr()" function - */ - static void -f_screenattr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int row; - int col; - int c; - - row = get_tv_number_chk(&argvars[0], NULL) - 1; - col = get_tv_number_chk(&argvars[1], NULL) - 1; - if (row < 0 || row >= screen_Rows - || col < 0 || col >= screen_Columns) - c = -1; - else - c = ScreenAttrs[LineOffset[row] + col]; - rettv->vval.v_number = c; -} - -/* - * "screenchar()" function - */ - static void -f_screenchar(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int row; - int col; - int off; - int c; - - row = get_tv_number_chk(&argvars[0], NULL) - 1; - col = get_tv_number_chk(&argvars[1], NULL) - 1; - if (row < 0 || row >= screen_Rows - || col < 0 || col >= screen_Columns) - c = -1; - else - { - off = LineOffset[row] + col; -#ifdef FEAT_MBYTE - if (enc_utf8 && ScreenLinesUC[off] != 0) - c = ScreenLinesUC[off]; - else -#endif - c = ScreenLines[off]; - } - rettv->vval.v_number = c; -} - -/* - * "screencol()" function - * - * First column is 1 to be consistent with virtcol(). - */ - static void -f_screencol(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = screen_screencol() + 1; -} - -/* - * "screenrow()" function - */ - static void -f_screenrow(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = screen_screenrow() + 1; -} - -/* - * "search()" function - */ - static void -f_search(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int flags = 0; - - rettv->vval.v_number = search_cmn(argvars, NULL, &flags); -} - -/* - * "searchdecl()" function - */ - static void -f_searchdecl(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int locally = 1; - int thisblock = 0; - int error = FALSE; - char_u *name; - - rettv->vval.v_number = 1; /* default: FAIL */ - - name = get_tv_string_chk(&argvars[0]); - if (argvars[1].v_type != VAR_UNKNOWN) - { - locally = get_tv_number_chk(&argvars[1], &error) == 0; - if (!error && argvars[2].v_type != VAR_UNKNOWN) - thisblock = get_tv_number_chk(&argvars[2], &error) != 0; - } - if (!error && name != NULL) - rettv->vval.v_number = find_decl(name, (int)STRLEN(name), - locally, thisblock, SEARCH_KEEP) == FAIL; -} - -/* - * Used by searchpair() and searchpairpos() - */ - static int -searchpair_cmn(argvars, match_pos) - typval_T *argvars; - pos_T *match_pos; -{ - char_u *spat, *mpat, *epat; - char_u *skip; - int save_p_ws = p_ws; - int dir; - int flags = 0; - char_u nbuf1[NUMBUFLEN]; - char_u nbuf2[NUMBUFLEN]; - char_u nbuf3[NUMBUFLEN]; - int retval = 0; /* default: FAIL */ - long lnum_stop = 0; - long time_limit = 0; - - /* Get the three pattern arguments: start, middle, end. */ - spat = get_tv_string_chk(&argvars[0]); - mpat = get_tv_string_buf_chk(&argvars[1], nbuf1); - epat = get_tv_string_buf_chk(&argvars[2], nbuf2); - if (spat == NULL || mpat == NULL || epat == NULL) - goto theend; /* type error */ - - /* Handle the optional fourth argument: flags */ - dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ - if (dir == 0) - goto theend; - - /* Don't accept SP_END or SP_SUBPAT. - * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. - */ - if ((flags & (SP_END | SP_SUBPAT)) != 0 - || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) - { - EMSG2(_(e_invarg2), get_tv_string(&argvars[3])); - goto theend; - } - - /* Using 'r' implies 'W', otherwise it doesn't work. */ - if (flags & SP_REPEAT) - p_ws = FALSE; - - /* Optional fifth argument: skip expression */ - if (argvars[3].v_type == VAR_UNKNOWN - || argvars[4].v_type == VAR_UNKNOWN) - skip = (char_u *)""; - else - { - skip = get_tv_string_buf_chk(&argvars[4], nbuf3); - if (argvars[5].v_type != VAR_UNKNOWN) - { - lnum_stop = get_tv_number_chk(&argvars[5], NULL); - if (lnum_stop < 0) - goto theend; -#ifdef FEAT_RELTIME - if (argvars[6].v_type != VAR_UNKNOWN) - { - time_limit = get_tv_number_chk(&argvars[6], NULL); - if (time_limit < 0) - goto theend; - } -#endif - } - } - if (skip == NULL) - goto theend; /* type error */ - - retval = do_searchpair(spat, mpat, epat, dir, skip, flags, - match_pos, lnum_stop, time_limit); - -theend: - p_ws = save_p_ws; - - return retval; -} - -/* - * "searchpair()" function - */ - static void -f_searchpair(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = searchpair_cmn(argvars, NULL); -} - -/* - * "searchpairpos()" function - */ - static void -f_searchpairpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - pos_T match_pos; - int lnum = 0; - int col = 0; - - if (rettv_list_alloc(rettv) == FAIL) - return; - - if (searchpair_cmn(argvars, &match_pos) > 0) - { - lnum = match_pos.lnum; - col = match_pos.col; - } - - list_append_number(rettv->vval.v_list, (varnumber_T)lnum); - list_append_number(rettv->vval.v_list, (varnumber_T)col); -} - -/* - * Search for a start/middle/end thing. - * Used by searchpair(), see its documentation for the details. - * Returns 0 or -1 for no match, - */ - long -do_searchpair(spat, mpat, epat, dir, skip, flags, match_pos, - lnum_stop, time_limit) - char_u *spat; /* start pattern */ - char_u *mpat; /* middle pattern */ - char_u *epat; /* end pattern */ - int dir; /* BACKWARD or FORWARD */ - char_u *skip; /* skip expression */ - int flags; /* SP_SETPCMARK and other SP_ values */ - pos_T *match_pos; - linenr_T lnum_stop; /* stop at this line if not zero */ - long time_limit UNUSED; /* stop after this many msec */ -{ - char_u *save_cpo; - char_u *pat, *pat2 = NULL, *pat3 = NULL; - long retval = 0; - pos_T pos; - pos_T firstpos; - pos_T foundpos; - pos_T save_cursor; - pos_T save_pos; - int n; - int r; - int nest = 1; - int err; - int options = SEARCH_KEEP; - proftime_T tm; - - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ - save_cpo = p_cpo; - p_cpo = empty_option; - -#ifdef FEAT_RELTIME - /* Set the time limit, if there is one. */ - profile_setlimit(time_limit, &tm); -#endif - - /* Make two search patterns: start/end (pat2, for in nested pairs) and - * start/middle/end (pat3, for the top pair). */ - pat2 = alloc((unsigned)(STRLEN(spat) + STRLEN(epat) + 15)); - pat3 = alloc((unsigned)(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 23)); - if (pat2 == NULL || pat3 == NULL) - goto theend; - sprintf((char *)pat2, "\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); - if (*mpat == NUL) - STRCPY(pat3, pat2); - else - sprintf((char *)pat3, "\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", - spat, epat, mpat); - if (flags & SP_START) - options |= SEARCH_START; - - save_cursor = curwin->w_cursor; - pos = curwin->w_cursor; - clearpos(&firstpos); - clearpos(&foundpos); - pat = pat3; - for (;;) - { - n = searchit(curwin, curbuf, &pos, dir, pat, 1L, - options, RE_SEARCH, lnum_stop, &tm); - if (n == FAIL || (firstpos.lnum != 0 && equalpos(pos, firstpos))) - /* didn't find it or found the first match again: FAIL */ - break; - - if (firstpos.lnum == 0) - firstpos = pos; - if (equalpos(pos, foundpos)) - { - /* Found the same position again. Can happen with a pattern that - * has "\zs" at the end and searching backwards. Advance one - * character and try again. */ - if (dir == BACKWARD) - decl(&pos); - else - incl(&pos); - } - foundpos = pos; - - /* clear the start flag to avoid getting stuck here */ - options &= ~SEARCH_START; - - /* If the skip pattern matches, ignore this match. */ - if (*skip != NUL) - { - save_pos = curwin->w_cursor; - curwin->w_cursor = pos; - r = eval_to_bool(skip, &err, NULL, FALSE); - curwin->w_cursor = save_pos; - if (err) - { - /* Evaluating {skip} caused an error, break here. */ - curwin->w_cursor = save_cursor; - retval = -1; - break; - } - if (r) - continue; - } - - if ((dir == BACKWARD && n == 3) || (dir == FORWARD && n == 2)) - { - /* Found end when searching backwards or start when searching - * forward: nested pair. */ - ++nest; - pat = pat2; /* nested, don't search for middle */ - } - else - { - /* Found end when searching forward or start when searching - * backward: end of (nested) pair; or found middle in outer pair. */ - if (--nest == 1) - pat = pat3; /* outer level, search for middle */ - } - - if (nest == 0) - { - /* Found the match: return matchcount or line number. */ - if (flags & SP_RETCOUNT) - ++retval; - else - retval = pos.lnum; - if (flags & SP_SETPCMARK) - setpcmark(); - curwin->w_cursor = pos; - if (!(flags & SP_REPEAT)) - break; - nest = 1; /* search for next unmatched */ - } - } - - if (match_pos != NULL) - { - /* Store the match cursor position */ - match_pos->lnum = curwin->w_cursor.lnum; - match_pos->col = curwin->w_cursor.col + 1; - } - - /* If 'n' flag is used or search failed: restore cursor position. */ - if ((flags & SP_NOMOVE) || retval == 0) - curwin->w_cursor = save_cursor; - -theend: - vim_free(pat2); - vim_free(pat3); - if (p_cpo == empty_option) - p_cpo = save_cpo; - else - /* Darn, evaluating the {skip} expression changed the value. */ - free_string_option(save_cpo); - - return retval; -} - -/* - * "searchpos()" function - */ - static void -f_searchpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - pos_T match_pos; - int lnum = 0; - int col = 0; - int n; - int flags = 0; - - if (rettv_list_alloc(rettv) == FAIL) - return; - - n = search_cmn(argvars, &match_pos, &flags); - if (n > 0) - { - lnum = match_pos.lnum; - col = match_pos.col; - } - - list_append_number(rettv->vval.v_list, (varnumber_T)lnum); - list_append_number(rettv->vval.v_list, (varnumber_T)col); - if (flags & SP_SUBPAT) - list_append_number(rettv->vval.v_list, (varnumber_T)n); -} - - - static void -f_server2client(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_CLIENTSERVER - char_u buf[NUMBUFLEN]; - char_u *server = get_tv_string_chk(&argvars[0]); - char_u *reply = get_tv_string_buf_chk(&argvars[1], buf); - - rettv->vval.v_number = -1; - if (server == NULL || reply == NULL) - return; - if (check_restricted() || check_secure()) - return; -# ifdef FEAT_X11 - if (check_connection() == FAIL) - return; -# endif - - if (serverSendReply(server, reply) < 0) - { - EMSG(_("E258: Unable to send to client")); - return; - } - rettv->vval.v_number = 0; -#else - rettv->vval.v_number = -1; -#endif -} - - static void -f_serverlist(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *r = NULL; - -#ifdef FEAT_CLIENTSERVER -# if defined(WIN32) || defined(MAC_CLIENTSERVER) - r = serverGetVimNames(); -# elif defined(FEAT_X11) - make_connection(); - if (X_DISPLAY != NULL) - r = serverGetVimNames(X_DISPLAY); -# endif -#endif - rettv->v_type = VAR_STRING; - rettv->vval.v_string = r; -} - -/* - * "setbufvar()" function - */ - static void -f_setbufvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv UNUSED; -{ - buf_T *buf; - aco_save_T aco; - char_u *varname, *bufvarname; - typval_T *varp; - char_u nbuf[NUMBUFLEN]; - - if (check_restricted() || check_secure()) - return; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - varname = get_tv_string_chk(&argvars[1]); - buf = get_buf_tv(&argvars[0], FALSE); - varp = &argvars[2]; - - if (buf != NULL && varname != NULL && varp != NULL) - { - /* set curbuf to be our buf, temporarily */ - aucmd_prepbuf(&aco, buf); - - if (*varname == '&') - { - long numval; - char_u *strval; - int error = FALSE; - - ++varname; - numval = get_tv_number_chk(varp, &error); - strval = get_tv_string_buf_chk(varp, nbuf); - if (!error && strval != NULL) - set_option_value(varname, numval, strval, OPT_LOCAL); - } - else - { - bufvarname = alloc((unsigned)STRLEN(varname) + 3); - if (bufvarname != NULL) - { - STRCPY(bufvarname, "b:"); - STRCPY(bufvarname + 2, varname); - set_var(bufvarname, varp, TRUE); - vim_free(bufvarname); - } - } - - /* reset notion of buffer */ - aucmd_restbuf(&aco); - } -} - -/* - * "setcmdpos()" function - */ - static void -f_setcmdpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int pos = (int)get_tv_number(&argvars[0]) - 1; - - if (pos >= 0) - rettv->vval.v_number = set_cmdline_pos(pos); -} - -/* - * "setline()" function - */ - static void -f_setline(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - linenr_T lnum; - char_u *line = NULL; - list_T *l = NULL; - listitem_T *li = NULL; - long added = 0; - linenr_T lcount = curbuf->b_ml.ml_line_count; - - lnum = get_tv_lnum(&argvars[0]); - if (argvars[1].v_type == VAR_LIST) - { - l = argvars[1].vval.v_list; - li = l->lv_first; - } - else - line = get_tv_string_chk(&argvars[1]); - - /* default result is zero == OK */ - for (;;) - { - if (l != NULL) - { - /* list argument, get next string */ - if (li == NULL) - break; - line = get_tv_string_chk(&li->li_tv); - li = li->li_next; - } - - rettv->vval.v_number = 1; /* FAIL */ - if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) - break; - - /* When coming here from Insert mode, sync undo, so that this can be - * undone separately from what was previously inserted. */ - if (u_sync_once == 2) - { - u_sync_once = 1; /* notify that u_sync() was called */ - u_sync(TRUE); - } - - if (lnum <= curbuf->b_ml.ml_line_count) - { - /* existing line, replace it */ - if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK) - { - changed_bytes(lnum, 0); - if (lnum == curwin->w_cursor.lnum) - check_cursor_col(); - rettv->vval.v_number = 0; /* OK */ - } - } - else if (added > 0 || u_save(lnum - 1, lnum) == OK) - { - /* lnum is one past the last line, append the line */ - ++added; - if (ml_append(lnum - 1, line, (colnr_T)0, FALSE) == OK) - rettv->vval.v_number = 0; /* OK */ - } - - if (l == NULL) /* only one string argument */ - break; - ++lnum; - } - - if (added > 0) - appended_lines_mark(lcount, added); -} - -static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *rettv)); - -/* - * Used by "setqflist()" and "setloclist()" functions - */ - static void -set_qf_ll_list(wp, list_arg, action_arg, rettv) - win_T *wp UNUSED; - typval_T *list_arg UNUSED; - typval_T *action_arg UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_QUICKFIX - char_u *act; - int action = ' '; -#endif - - rettv->vval.v_number = -1; - -#ifdef FEAT_QUICKFIX - if (list_arg->v_type != VAR_LIST) - EMSG(_(e_listreq)); - else - { - list_T *l = list_arg->vval.v_list; - - if (action_arg->v_type == VAR_STRING) - { - act = get_tv_string_chk(action_arg); - if (act == NULL) - return; /* type error; errmsg already given */ - if (*act == 'a' || *act == 'r') - action = *act; - } - - if (l != NULL && set_errorlist(wp, l, action, - (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK) - rettv->vval.v_number = 0; - } -#endif -} - -/* - * "setloclist()" function - */ - static void -f_setloclist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - win_T *win; - - rettv->vval.v_number = -1; - - win = find_win_by_nr(&argvars[0], NULL); - if (win != NULL) - set_qf_ll_list(win, &argvars[1], &argvars[2], rettv); -} - -/* - * "setmatches()" function - */ - static void -f_setmatches(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_SEARCH_EXTRA - list_T *l; - listitem_T *li; - dict_T *d; - - rettv->vval.v_number = -1; - if (argvars[0].v_type != VAR_LIST) - { - EMSG(_(e_listreq)); - return; - } - if ((l = argvars[0].vval.v_list) != NULL) - { - - /* To some extent make sure that we are dealing with a list from - * "getmatches()". */ - li = l->lv_first; - while (li != NULL) - { - if (li->li_tv.v_type != VAR_DICT - || (d = li->li_tv.vval.v_dict) == NULL) - { - EMSG(_(e_invarg)); - return; - } - if (!(dict_find(d, (char_u *)"group", -1) != NULL - && dict_find(d, (char_u *)"pattern", -1) != NULL - && dict_find(d, (char_u *)"priority", -1) != NULL - && dict_find(d, (char_u *)"id", -1) != NULL)) - { - EMSG(_(e_invarg)); - return; - } - li = li->li_next; - } - - clear_matches(curwin); - li = l->lv_first; - while (li != NULL) - { - d = li->li_tv.vval.v_dict; - match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE), - get_dict_string(d, (char_u *)"pattern", FALSE), - (int)get_dict_number(d, (char_u *)"priority"), - (int)get_dict_number(d, (char_u *)"id"), NULL); - li = li->li_next; - } - rettv->vval.v_number = 0; - } -#endif -} - -/* - * "setpos()" function - */ - static void -f_setpos(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - pos_T pos; - int fnum; - char_u *name; - colnr_T curswant = -1; - - rettv->vval.v_number = -1; - name = get_tv_string_chk(argvars); - if (name != NULL) - { - if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) - { - if (--pos.col < 0) - pos.col = 0; - if (name[0] == '.' && name[1] == NUL) - { - /* set cursor */ - if (fnum == curbuf->b_fnum) - { - curwin->w_cursor = pos; - if (curswant >= 0) - curwin->w_curswant = curswant - 1; - check_cursor(); - rettv->vval.v_number = 0; - } - else - EMSG(_(e_invarg)); - } - else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) - { - /* set mark */ - if (setmark_pos(name[1], &pos, fnum) == OK) - rettv->vval.v_number = 0; - } - else - EMSG(_(e_invarg)); - } - } -} - -/* - * "setqflist()" function - */ - static void -f_setqflist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - set_qf_ll_list(NULL, &argvars[0], &argvars[1], rettv); -} - -/* - * "setreg()" function - */ - static void -f_setreg(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int regname; - char_u *strregname; - char_u *stropt; - char_u *strval; - int append; - char_u yank_type; - long block_len; - - block_len = -1; - yank_type = MAUTO; - append = FALSE; - - strregname = get_tv_string_chk(argvars); - rettv->vval.v_number = 1; /* FAIL is default */ - - if (strregname == NULL) - return; /* type error; errmsg already given */ - regname = *strregname; - if (regname == 0 || regname == '@') - regname = '"'; - - if (argvars[2].v_type != VAR_UNKNOWN) - { - stropt = get_tv_string_chk(&argvars[2]); - if (stropt == NULL) - return; /* type error */ - for (; *stropt != NUL; ++stropt) - switch (*stropt) - { - case 'a': case 'A': /* append */ - append = TRUE; - break; - case 'v': case 'c': /* character-wise selection */ - yank_type = MCHAR; - break; - case 'V': case 'l': /* line-wise selection */ - yank_type = MLINE; - break; - case 'b': case Ctrl_V: /* block-wise selection */ - yank_type = MBLOCK; - if (VIM_ISDIGIT(stropt[1])) - { - ++stropt; - block_len = getdigits(&stropt) - 1; - --stropt; - } - break; - } - } - - if (argvars[1].v_type == VAR_LIST) - { - char_u **lstval; - char_u **allocval; - char_u buf[NUMBUFLEN]; - char_u **curval; - char_u **curallocval; - int len = argvars[1].vval.v_list->lv_len; - listitem_T *li; - - /* First half: use for pointers to result lines; second half: use for - * pointers to allocated copies. */ - lstval = (char_u **)alloc(sizeof(char_u *) * ((len + 1) * 2)); - if (lstval == NULL) - return; - curval = lstval; - allocval = lstval + len + 2; - curallocval = allocval; - - for (li = argvars[1].vval.v_list->lv_first; li != NULL; - li = li->li_next) - { - strval = get_tv_string_buf_chk(&li->li_tv, buf); - if (strval == NULL) - goto free_lstval; - if (strval == buf) - { - /* Need to make a copy, next get_tv_string_buf_chk() will - * overwrite the string. */ - strval = vim_strsave(buf); - if (strval == NULL) - goto free_lstval; - *curallocval++ = strval; - } - *curval++ = strval; - } - *curval++ = NULL; - - write_reg_contents_lst(regname, lstval, -1, - append, yank_type, block_len); -free_lstval: - while (curallocval > allocval) - vim_free(*--curallocval); - vim_free(lstval); - } - else - { - strval = get_tv_string_chk(&argvars[1]); - if (strval == NULL) - return; - write_reg_contents_ex(regname, strval, -1, - append, yank_type, block_len); - } - rettv->vval.v_number = 0; -} - -/* - * "settabvar()" function - */ - static void -f_settabvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ -#ifdef FEAT_WINDOWS - tabpage_T *save_curtab; - tabpage_T *tp; -#endif - char_u *varname, *tabvarname; - typval_T *varp; - - rettv->vval.v_number = 0; - - if (check_restricted() || check_secure()) - return; - -#ifdef FEAT_WINDOWS - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); -#endif - varname = get_tv_string_chk(&argvars[1]); - varp = &argvars[2]; - - if (varname != NULL && varp != NULL -#ifdef FEAT_WINDOWS - && tp != NULL -#endif - ) - { -#ifdef FEAT_WINDOWS - save_curtab = curtab; - goto_tabpage_tp(tp, FALSE, FALSE); -#endif - - tabvarname = alloc((unsigned)STRLEN(varname) + 3); - if (tabvarname != NULL) - { - STRCPY(tabvarname, "t:"); - STRCPY(tabvarname + 2, varname); - set_var(tabvarname, varp, TRUE); - vim_free(tabvarname); - } - -#ifdef FEAT_WINDOWS - /* Restore current tabpage */ - if (valid_tabpage(save_curtab)) - goto_tabpage_tp(save_curtab, FALSE, FALSE); -#endif - } -} - -/* - * "settabwinvar()" function - */ - static void -f_settabwinvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - setwinvar(argvars, rettv, 1); -} - -/* - * "setwinvar()" function - */ - static void -f_setwinvar(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - setwinvar(argvars, rettv, 0); -} - -/* - * "setwinvar()" and "settabwinvar()" functions - */ - - static void -setwinvar(argvars, rettv, off) - typval_T *argvars; - typval_T *rettv UNUSED; - int off; -{ - win_T *win; -#ifdef FEAT_WINDOWS - win_T *save_curwin; - tabpage_T *save_curtab; -#endif - char_u *varname, *winvarname; - typval_T *varp; - char_u nbuf[NUMBUFLEN]; - tabpage_T *tp = NULL; - - if (check_restricted() || check_secure()) - return; - -#ifdef FEAT_WINDOWS - if (off == 1) - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); - else - tp = curtab; -#endif - win = find_win_by_nr(&argvars[off], tp); - varname = get_tv_string_chk(&argvars[off + 1]); - varp = &argvars[off + 2]; - - if (win != NULL && varname != NULL && varp != NULL) - { -#ifdef FEAT_WINDOWS - if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL) - return; -#endif - - if (*varname == '&') - { - long numval; - char_u *strval; - int error = FALSE; - - ++varname; - numval = get_tv_number_chk(varp, &error); - strval = get_tv_string_buf_chk(varp, nbuf); - if (!error && strval != NULL) - set_option_value(varname, numval, strval, OPT_LOCAL); - } - else - { - winvarname = alloc((unsigned)STRLEN(varname) + 3); - if (winvarname != NULL) - { - STRCPY(winvarname, "w:"); - STRCPY(winvarname + 2, varname); - set_var(winvarname, varp, TRUE); - vim_free(winvarname); - } - } - -#ifdef FEAT_WINDOWS - restore_win(save_curwin, save_curtab, TRUE); -#endif - } -} - -#ifdef FEAT_CRYPT -/* - * "sha256({string})" function - */ - static void -f_sha256(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - - p = get_tv_string(&argvars[0]); - rettv->vval.v_string = vim_strsave( - sha256_bytes(p, (int)STRLEN(p), NULL, 0)); - rettv->v_type = VAR_STRING; -} -#endif /* FEAT_CRYPT */ - -/* - * "shellescape({string})" function - */ - static void -f_shellescape(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_string = vim_strsave_shellescape( - get_tv_string(&argvars[0]), non_zero_arg(&argvars[1]), TRUE); - rettv->v_type = VAR_STRING; -} - -/* - * shiftwidth() function - */ - static void -f_shiftwidth(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->vval.v_number = get_sw_value(curbuf); -} - -/* - * "simplify()" function - */ - static void -f_simplify(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - - p = get_tv_string(&argvars[0]); - rettv->vval.v_string = vim_strsave(p); - simplify_filename(rettv->vval.v_string); /* simplify in place */ - rettv->v_type = VAR_STRING; -} - -#ifdef FEAT_FLOAT -/* - * "sin()" function - */ - static void -f_sin(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = sin(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "sinh()" function - */ - static void -f_sinh(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = sinh(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - item_compare __ARGS((const void *s1, const void *s2)); -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - item_compare2 __ARGS((const void *s1, const void *s2)); - -/* struct used in the array that's given to qsort() */ -typedef struct -{ - listitem_T *item; - int idx; -} sortItem_T; - -static int item_compare_ic; -static int item_compare_numeric; -static char_u *item_compare_func; -static dict_T *item_compare_selfdict; -static int item_compare_func_err; -static int item_compare_keep_zero; -static void do_sort_uniq __ARGS((typval_T *argvars, typval_T *rettv, int sort)); -#define ITEM_COMPARE_FAIL 999 - -/* - * Compare functions for f_sort() and f_uniq() below. - */ - static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -item_compare(s1, s2) - const void *s1; - const void *s2; -{ - sortItem_T *si1, *si2; - char_u *p1, *p2; - char_u *tofree1, *tofree2; - int res; - char_u numbuf1[NUMBUFLEN]; - char_u numbuf2[NUMBUFLEN]; - - si1 = (sortItem_T *)s1; - si2 = (sortItem_T *)s2; - p1 = tv2string(&si1->item->li_tv, &tofree1, numbuf1, 0); - p2 = tv2string(&si2->item->li_tv, &tofree2, numbuf2, 0); - if (p1 == NULL) - p1 = (char_u *)""; - if (p2 == NULL) - p2 = (char_u *)""; - if (!item_compare_numeric) - { - if (item_compare_ic) - res = STRICMP(p1, p2); - else - res = STRCMP(p1, p2); - } - else - { - double n1, n2; - n1 = strtod((char *)p1, (char **)&p1); - n2 = strtod((char *)p2, (char **)&p2); - res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1; - } - - /* When the result would be zero, compare the pointers themselves. Makes - * the sort stable. */ - if (res == 0 && !item_compare_keep_zero) - res = si1->idx > si2->idx ? 1 : -1; - - vim_free(tofree1); - vim_free(tofree2); - return res; -} - - static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -item_compare2(s1, s2) - const void *s1; - const void *s2; -{ - sortItem_T *si1, *si2; - int res; - typval_T rettv; - typval_T argv[3]; - int dummy; - - /* shortcut after failure in previous call; compare all items equal */ - if (item_compare_func_err) - return 0; - - si1 = (sortItem_T *)s1; - si2 = (sortItem_T *)s2; - - /* Copy the values. This is needed to be able to set v_lock to VAR_FIXED - * in the copy without changing the original list items. */ - copy_tv(&si1->item->li_tv, &argv[0]); - copy_tv(&si2->item->li_tv, &argv[1]); - - rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ - res = call_func(item_compare_func, (int)STRLEN(item_compare_func), - &rettv, 2, argv, 0L, 0L, &dummy, TRUE, - item_compare_selfdict); - clear_tv(&argv[0]); - clear_tv(&argv[1]); - - if (res == FAIL) - res = ITEM_COMPARE_FAIL; - else - res = get_tv_number_chk(&rettv, &item_compare_func_err); - if (item_compare_func_err) - res = ITEM_COMPARE_FAIL; /* return value has wrong type */ - clear_tv(&rettv); - - /* When the result would be zero, compare the pointers themselves. Makes - * the sort stable. */ - if (res == 0 && !item_compare_keep_zero) - res = si1->idx > si2->idx ? 1 : -1; - - return res; -} - -/* - * "sort({list})" function - */ - static void -do_sort_uniq(argvars, rettv, sort) - typval_T *argvars; - typval_T *rettv; - int sort; -{ - list_T *l; - listitem_T *li; - sortItem_T *ptrs; - long len; - long i; - - if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), sort ? "sort()" : "uniq()"); - else - { - l = argvars[0].vval.v_list; - if (l == NULL || tv_check_lock(l->lv_lock, - (char_u *)(sort ? _("sort() argument") : _("uniq() argument")))) - return; - rettv->vval.v_list = l; - rettv->v_type = VAR_LIST; - ++l->lv_refcount; - - len = list_len(l); - if (len <= 1) - return; /* short list sorts pretty quickly */ - - item_compare_ic = FALSE; - item_compare_numeric = FALSE; - item_compare_func = NULL; - item_compare_selfdict = NULL; - if (argvars[1].v_type != VAR_UNKNOWN) - { - /* optional second argument: {func} */ - if (argvars[1].v_type == VAR_FUNC) - item_compare_func = argvars[1].vval.v_string; - else - { - int error = FALSE; - - i = get_tv_number_chk(&argvars[1], &error); - if (error) - return; /* type error; errmsg already given */ - if (i == 1) - item_compare_ic = TRUE; - else - item_compare_func = get_tv_string(&argvars[1]); - if (item_compare_func != NULL) - { - if (STRCMP(item_compare_func, "n") == 0) - { - item_compare_func = NULL; - item_compare_numeric = TRUE; - } - else if (STRCMP(item_compare_func, "i") == 0) - { - item_compare_func = NULL; - item_compare_ic = TRUE; - } - } - } - - if (argvars[2].v_type != VAR_UNKNOWN) - { - /* optional third argument: {dict} */ - if (argvars[2].v_type != VAR_DICT) - { - EMSG(_(e_dictreq)); - return; - } - item_compare_selfdict = argvars[2].vval.v_dict; - } - } - - /* Make an array with each entry pointing to an item in the List. */ - ptrs = (sortItem_T *)alloc((int)(len * sizeof(sortItem_T))); - if (ptrs == NULL) - return; - - i = 0; - if (sort) - { - /* sort(): ptrs will be the list to sort */ - for (li = l->lv_first; li != NULL; li = li->li_next) - { - ptrs[i].item = li; - ptrs[i].idx = i; - ++i; - } - - item_compare_func_err = FALSE; - item_compare_keep_zero = FALSE; - /* test the compare function */ - if (item_compare_func != NULL - && item_compare2((void *)&ptrs[0], (void *)&ptrs[1]) - == ITEM_COMPARE_FAIL) - EMSG(_("E702: Sort compare function failed")); - else - { - /* Sort the array with item pointers. */ - qsort((void *)ptrs, (size_t)len, sizeof(sortItem_T), - item_compare_func == NULL ? item_compare : item_compare2); - - if (!item_compare_func_err) - { - /* Clear the List and append the items in sorted order. */ - l->lv_first = l->lv_last = l->lv_idx_item = NULL; - l->lv_len = 0; - for (i = 0; i < len; ++i) - list_append(l, ptrs[i].item); - } - } - } - else - { - int (*item_compare_func_ptr)__ARGS((const void *, const void *)); - - /* f_uniq(): ptrs will be a stack of items to remove */ - item_compare_func_err = FALSE; - item_compare_keep_zero = TRUE; - item_compare_func_ptr = item_compare_func - ? item_compare2 : item_compare; - - for (li = l->lv_first; li != NULL && li->li_next != NULL; - li = li->li_next) - { - if (item_compare_func_ptr((void *)&li, (void *)&li->li_next) - == 0) - ptrs[i++].item = li; - if (item_compare_func_err) - { - EMSG(_("E882: Uniq compare function failed")); - break; - } - } - - if (!item_compare_func_err) - { - while (--i >= 0) - { - li = ptrs[i].item->li_next; - ptrs[i].item->li_next = li->li_next; - if (li->li_next != NULL) - li->li_next->li_prev = ptrs[i].item; - else - l->lv_last = ptrs[i].item; - list_fix_watch(l, li); - listitem_free(li); - l->lv_len--; - } - } - } - - vim_free(ptrs); - } -} - -/* - * "sort({list})" function - */ - static void -f_sort(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - do_sort_uniq(argvars, rettv, TRUE); -} - -/* - * "uniq({list})" function - */ - static void -f_uniq(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - do_sort_uniq(argvars, rettv, FALSE); -} - -/* - * "soundfold({word})" function - */ - static void -f_soundfold(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s; - - rettv->v_type = VAR_STRING; - s = get_tv_string(&argvars[0]); -#ifdef FEAT_SPELL - rettv->vval.v_string = eval_soundfold(s); -#else - rettv->vval.v_string = vim_strsave(s); -#endif -} - -/* - * "spellbadword()" function - */ - static void -f_spellbadword(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *word = (char_u *)""; - hlf_T attr = HLF_COUNT; - int len = 0; - - if (rettv_list_alloc(rettv) == FAIL) - return; - -#ifdef FEAT_SPELL - if (argvars[0].v_type == VAR_UNKNOWN) - { - /* Find the start and length of the badly spelled word. */ - len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr); - if (len != 0) - word = ml_get_cursor(); - } - else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) - { - char_u *str = get_tv_string_chk(&argvars[0]); - int capcol = -1; - - if (str != NULL) - { - /* Check the argument for spelling. */ - while (*str != NUL) - { - len = spell_check(curwin, str, &attr, &capcol, FALSE); - if (attr != HLF_COUNT) - { - word = str; - break; - } - str += len; - } - } - } -#endif - - list_append_string(rettv->vval.v_list, word, len); - list_append_string(rettv->vval.v_list, (char_u *)( - attr == HLF_SPB ? "bad" : - attr == HLF_SPR ? "rare" : - attr == HLF_SPL ? "local" : - attr == HLF_SPC ? "caps" : - ""), -1); -} - -/* - * "spellsuggest()" function - */ - static void -f_spellsuggest(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_SPELL - char_u *str; - int typeerr = FALSE; - int maxcount; - garray_T ga; - int i; - listitem_T *li; - int need_capital = FALSE; -#endif - - if (rettv_list_alloc(rettv) == FAIL) - return; - -#ifdef FEAT_SPELL - if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) - { - str = get_tv_string(&argvars[0]); - if (argvars[1].v_type != VAR_UNKNOWN) - { - maxcount = get_tv_number_chk(&argvars[1], &typeerr); - if (maxcount <= 0) - return; - if (argvars[2].v_type != VAR_UNKNOWN) - { - need_capital = get_tv_number_chk(&argvars[2], &typeerr); - if (typeerr) - return; - } - } - else - maxcount = 25; - - spell_suggest_list(&ga, str, maxcount, need_capital, FALSE); - - for (i = 0; i < ga.ga_len; ++i) - { - str = ((char_u **)ga.ga_data)[i]; - - li = listitem_alloc(); - if (li == NULL) - vim_free(str); - else - { - li->li_tv.v_type = VAR_STRING; - li->li_tv.v_lock = 0; - li->li_tv.vval.v_string = str; - list_append(rettv->vval.v_list, li); - } - } - ga_clear(&ga); - } -#endif -} - - static void -f_split(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *str; - char_u *end; - char_u *pat = NULL; - regmatch_T regmatch; - char_u patbuf[NUMBUFLEN]; - char_u *save_cpo; - int match; - colnr_T col = 0; - int keepempty = FALSE; - int typeerr = FALSE; - - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ - save_cpo = p_cpo; - p_cpo = (char_u *)""; - - str = get_tv_string(&argvars[0]); - if (argvars[1].v_type != VAR_UNKNOWN) - { - pat = get_tv_string_buf_chk(&argvars[1], patbuf); - if (pat == NULL) - typeerr = TRUE; - if (argvars[2].v_type != VAR_UNKNOWN) - keepempty = get_tv_number_chk(&argvars[2], &typeerr); - } - if (pat == NULL || *pat == NUL) - pat = (char_u *)"[\\x01- ]\\+"; - - if (rettv_list_alloc(rettv) == FAIL) - return; - if (typeerr) - return; - - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - if (regmatch.regprog != NULL) - { - regmatch.rm_ic = FALSE; - while (*str != NUL || keepempty) - { - if (*str == NUL) - match = FALSE; /* empty item at the end */ - else - match = vim_regexec_nl(®match, str, col); - if (match) - end = regmatch.startp[0]; - else - end = str + STRLEN(str); - if (keepempty || end > str || (rettv->vval.v_list->lv_len > 0 - && *str != NUL && match && end < regmatch.endp[0])) - { - if (list_append_string(rettv->vval.v_list, str, - (int)(end - str)) == FAIL) - break; - } - if (!match) - break; - /* Advance to just after the match. */ - if (regmatch.endp[0] > str) - col = 0; - else - { - /* Don't get stuck at the same match. */ -#ifdef FEAT_MBYTE - col = (*mb_ptr2len)(regmatch.endp[0]); -#else - col = 1; -#endif - } - str = regmatch.endp[0]; - } - - vim_regfree(regmatch.regprog); - } - - p_cpo = save_cpo; -} - -#ifdef FEAT_FLOAT -/* - * "sqrt()" function - */ - static void -f_sqrt(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = sqrt(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "str2float()" function - */ - static void -f_str2float(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p = skipwhite(get_tv_string(&argvars[0])); - - if (*p == '+') - p = skipwhite(p + 1); - (void)string2float(p, &rettv->vval.v_float); - rettv->v_type = VAR_FLOAT; -} -#endif - -/* - * "str2nr()" function - */ - static void -f_str2nr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int base = 10; - char_u *p; - long n; - - if (argvars[1].v_type != VAR_UNKNOWN) - { - base = get_tv_number(&argvars[1]); - if (base != 8 && base != 10 && base != 16) - { - EMSG(_(e_invarg)); - return; - } - } - - p = skipwhite(get_tv_string(&argvars[0])); - if (*p == '+') - p = skipwhite(p + 1); - vim_str2nr(p, NULL, NULL, base == 8 ? 2 : 0, base == 16 ? 2 : 0, &n, NULL); - rettv->vval.v_number = n; -} - -#ifdef HAVE_STRFTIME -/* - * "strftime({format}[, {time}])" function - */ - static void -f_strftime(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u result_buf[256]; - struct tm *curtime; - time_t seconds; - char_u *p; - - rettv->v_type = VAR_STRING; - - p = get_tv_string(&argvars[0]); - if (argvars[1].v_type == VAR_UNKNOWN) - seconds = time(NULL); - else - seconds = (time_t)get_tv_number(&argvars[1]); - curtime = localtime(&seconds); - /* MSVC returns NULL for an invalid value of seconds. */ - if (curtime == NULL) - rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)")); - else - { -# ifdef FEAT_MBYTE - vimconv_T conv; - char_u *enc; - - conv.vc_type = CONV_NONE; - enc = enc_locale(); - convert_setup(&conv, p_enc, enc); - if (conv.vc_type != CONV_NONE) - p = string_convert(&conv, p, NULL); -# endif - if (p != NULL) - (void)strftime((char *)result_buf, sizeof(result_buf), - (char *)p, curtime); - else - result_buf[0] = NUL; - -# ifdef FEAT_MBYTE - if (conv.vc_type != CONV_NONE) - vim_free(p); - convert_setup(&conv, enc, p_enc); - if (conv.vc_type != CONV_NONE) - rettv->vval.v_string = string_convert(&conv, result_buf, NULL); - else -# endif - rettv->vval.v_string = vim_strsave(result_buf); - -# ifdef FEAT_MBYTE - /* Release conversion descriptors */ - convert_setup(&conv, NULL, NULL); - vim_free(enc); -# endif - } -} -#endif - -/* - * "stridx()" function - */ - static void -f_stridx(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[NUMBUFLEN]; - char_u *needle; - char_u *haystack; - char_u *save_haystack; - char_u *pos; - int start_idx; - - needle = get_tv_string_chk(&argvars[1]); - save_haystack = haystack = get_tv_string_buf_chk(&argvars[0], buf); - rettv->vval.v_number = -1; - if (needle == NULL || haystack == NULL) - return; /* type error; errmsg already given */ - - if (argvars[2].v_type != VAR_UNKNOWN) - { - int error = FALSE; - - start_idx = get_tv_number_chk(&argvars[2], &error); - if (error || start_idx >= (int)STRLEN(haystack)) - return; - if (start_idx >= 0) - haystack += start_idx; - } - - pos = (char_u *)strstr((char *)haystack, (char *)needle); - if (pos != NULL) - rettv->vval.v_number = (varnumber_T)(pos - save_haystack); -} - -/* - * "string()" function - */ - static void -f_string(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *tofree; - char_u numbuf[NUMBUFLEN]; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, 0); - /* Make a copy if we have a value but it's not in allocated memory. */ - if (rettv->vval.v_string != NULL && tofree == NULL) - rettv->vval.v_string = vim_strsave(rettv->vval.v_string); -} - -/* - * "strlen()" function - */ - static void -f_strlen(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = (varnumber_T)(STRLEN( - get_tv_string(&argvars[0]))); -} - -/* - * "strchars()" function - */ - static void -f_strchars(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s = get_tv_string(&argvars[0]); -#ifdef FEAT_MBYTE - varnumber_T len = 0; - - while (*s != NUL) - { - mb_cptr2char_adv(&s); - ++len; - } - rettv->vval.v_number = len; -#else - rettv->vval.v_number = (varnumber_T)(STRLEN(s)); -#endif -} - -/* - * "strdisplaywidth()" function - */ - static void -f_strdisplaywidth(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s = get_tv_string(&argvars[0]); - int col = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) - col = get_tv_number(&argvars[1]); - - rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); -} - -/* - * "strwidth()" function - */ - static void -f_strwidth(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *s = get_tv_string(&argvars[0]); - - rettv->vval.v_number = (varnumber_T)( -#ifdef FEAT_MBYTE - mb_string2cells(s, -1) -#else - STRLEN(s) -#endif - ); -} - -/* - * "strpart()" function - */ - static void -f_strpart(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - int n; - int len; - int slen; - int error = FALSE; - - p = get_tv_string(&argvars[0]); - slen = (int)STRLEN(p); - - n = get_tv_number_chk(&argvars[1], &error); - if (error) - len = 0; - else if (argvars[2].v_type != VAR_UNKNOWN) - len = get_tv_number(&argvars[2]); - else - len = slen - n; /* default len: all bytes that are available. */ - - /* - * Only return the overlap between the specified part and the actual - * string. - */ - if (n < 0) - { - len += n; - n = 0; - } - else if (n > slen) - n = slen; - if (len < 0) - len = 0; - else if (n + len > slen) - len = slen - n; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strnsave(p + n, len); -} - -/* - * "strridx()" function - */ - static void -f_strridx(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u buf[NUMBUFLEN]; - char_u *needle; - char_u *haystack; - char_u *rest; - char_u *lastmatch = NULL; - int haystack_len, end_idx; - - needle = get_tv_string_chk(&argvars[1]); - haystack = get_tv_string_buf_chk(&argvars[0], buf); - - rettv->vval.v_number = -1; - if (needle == NULL || haystack == NULL) - return; /* type error; errmsg already given */ - - haystack_len = (int)STRLEN(haystack); - if (argvars[2].v_type != VAR_UNKNOWN) - { - /* Third argument: upper limit for index */ - end_idx = get_tv_number_chk(&argvars[2], NULL); - if (end_idx < 0) - return; /* can never find a match */ - } - else - end_idx = haystack_len; - - if (*needle == NUL) - { - /* Empty string matches past the end. */ - lastmatch = haystack + end_idx; - } - else - { - for (rest = haystack; *rest != '\0'; ++rest) - { - rest = (char_u *)strstr((char *)rest, (char *)needle); - if (rest == NULL || rest > haystack + end_idx) - break; - lastmatch = rest; - } - } - - if (lastmatch == NULL) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = (varnumber_T)(lastmatch - haystack); -} - -/* - * "strtrans()" function - */ - static void -f_strtrans(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = transstr(get_tv_string(&argvars[0])); -} - -/* - * "submatch()" function - */ - static void -f_submatch(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int error = FALSE; - int no; - int retList = 0; - - no = (int)get_tv_number_chk(&argvars[0], &error); - if (error) - return; - error = FALSE; - if (argvars[1].v_type != VAR_UNKNOWN) - retList = get_tv_number_chk(&argvars[1], &error); - if (error) - return; - - if (retList == 0) - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = reg_submatch(no); - } - else - { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = reg_submatch_list(no); - } -} - -/* - * "substitute()" function - */ - static void -f_substitute(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u patbuf[NUMBUFLEN]; - char_u subbuf[NUMBUFLEN]; - char_u flagsbuf[NUMBUFLEN]; - - char_u *str = get_tv_string_chk(&argvars[0]); - char_u *pat = get_tv_string_buf_chk(&argvars[1], patbuf); - char_u *sub = get_tv_string_buf_chk(&argvars[2], subbuf); - char_u *flg = get_tv_string_buf_chk(&argvars[3], flagsbuf); - - rettv->v_type = VAR_STRING; - if (str == NULL || pat == NULL || sub == NULL || flg == NULL) - rettv->vval.v_string = NULL; - else - rettv->vval.v_string = do_string_sub(str, pat, sub, flg); -} - -/* - * "synID(lnum, col, trans)" function - */ - static void -f_synID(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int id = 0; -#ifdef FEAT_SYN_HL - long lnum; - long col; - int trans; - int transerr = FALSE; - - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ - trans = get_tv_number_chk(&argvars[2], &transerr); - - if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count - && col >= 0 && col < (long)STRLEN(ml_get(lnum))) - id = syn_get_id(curwin, lnum, (colnr_T)col, trans, NULL, FALSE); -#endif - - rettv->vval.v_number = id; -} - -/* - * "synIDattr(id, what [, mode])" function - */ - static void -f_synIDattr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *p = NULL; -#ifdef FEAT_SYN_HL - int id; - char_u *what; - char_u *mode; - char_u modebuf[NUMBUFLEN]; - int modec; - - id = get_tv_number(&argvars[0]); - what = get_tv_string(&argvars[1]); - if (argvars[2].v_type != VAR_UNKNOWN) - { - mode = get_tv_string_buf(&argvars[2], modebuf); - modec = TOLOWER_ASC(mode[0]); - if (modec != 't' && modec != 'c' && modec != 'g') - modec = 0; /* replace invalid with current */ - } - else - { -#ifdef FEAT_GUI - if (gui.in_use) - modec = 'g'; - else -#endif - if (t_colors > 1) - modec = 'c'; - else - modec = 't'; - } - - - switch (TOLOWER_ASC(what[0])) - { - case 'b': - if (TOLOWER_ASC(what[1]) == 'g') /* bg[#] */ - p = highlight_color(id, what, modec); - else /* bold */ - p = highlight_has_attr(id, HL_BOLD, modec); - break; - - case 'f': /* fg[#] or font */ - p = highlight_color(id, what, modec); - break; - - case 'i': - if (TOLOWER_ASC(what[1]) == 'n') /* inverse */ - p = highlight_has_attr(id, HL_INVERSE, modec); - else /* italic */ - p = highlight_has_attr(id, HL_ITALIC, modec); - break; - - case 'n': /* name */ - p = get_highlight_name(NULL, id - 1); - break; - - case 'r': /* reverse */ - p = highlight_has_attr(id, HL_INVERSE, modec); - break; - - case 's': - if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ - p = highlight_color(id, what, modec); - else /* standout */ - p = highlight_has_attr(id, HL_STANDOUT, modec); - break; - - case 'u': - if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c') - /* underline */ - p = highlight_has_attr(id, HL_UNDERLINE, modec); - else - /* undercurl */ - p = highlight_has_attr(id, HL_UNDERCURL, modec); - break; - } - - if (p != NULL) - p = vim_strsave(p); -#endif - rettv->v_type = VAR_STRING; - rettv->vval.v_string = p; -} - -/* - * "synIDtrans(id)" function - */ - static void -f_synIDtrans(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int id; - -#ifdef FEAT_SYN_HL - id = get_tv_number(&argvars[0]); - - if (id > 0) - id = syn_get_final_id(id); - else -#endif - id = 0; - - rettv->vval.v_number = id; -} - -/* - * "synconcealed(lnum, col)" function - */ - static void -f_synconcealed(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) - long lnum; - long col; - int syntax_flags = 0; - int cchar; - int matchid = 0; - char_u str[NUMBUFLEN]; -#endif - - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; - -#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ - - vim_memset(str, NUL, sizeof(str)); - - if (rettv_list_alloc(rettv) != FAIL) - { - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count - && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) - && curwin->w_p_cole > 0) - { - (void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE); - syntax_flags = get_syntax_info(&matchid); - - /* get the conceal character */ - if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) - { - cchar = syn_get_sub_char(); - if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) - cchar = lcs_conceal; - if (cchar != NUL) - { -# ifdef FEAT_MBYTE - if (has_mbyte) - (*mb_char2bytes)(cchar, str); - else -# endif - str[0] = cchar; - } - } - } - - list_append_number(rettv->vval.v_list, - (syntax_flags & HL_CONCEAL) != 0); - /* -1 to auto-determine strlen */ - list_append_string(rettv->vval.v_list, str, -1); - list_append_number(rettv->vval.v_list, matchid); - } -#endif -} - -/* - * "synstack(lnum, col)" function - */ - static void -f_synstack(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_SYN_HL - long lnum; - long col; - int i; - int id; -#endif - - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; - -#ifdef FEAT_SYN_HL - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ - - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count - && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) - && rettv_list_alloc(rettv) != FAIL) - { - (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); - for (i = 0; ; ++i) - { - id = syn_get_stack_item(i); - if (id < 0) - break; - if (list_append_number(rettv->vval.v_list, id) == FAIL) - break; - } - } -#endif -} - - static void -get_cmd_output_as_rettv(argvars, rettv, retlist) - typval_T *argvars; - typval_T *rettv; - int retlist; -{ - char_u *res = NULL; - char_u *p; - char_u *infile = NULL; - char_u buf[NUMBUFLEN]; - int err = FALSE; - FILE *fd; - list_T *list = NULL; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - if (check_restricted() || check_secure()) - goto errret; - - if (argvars[1].v_type != VAR_UNKNOWN) - { - /* - * Write the string to a temp file, to be used for input of the shell - * command. - */ - if ((infile = vim_tempname('i')) == NULL) - { - EMSG(_(e_notmp)); - goto errret; - } - - fd = mch_fopen((char *)infile, WRITEBIN); - if (fd == NULL) - { - EMSG2(_(e_notopen), infile); - goto errret; - } - if (argvars[1].v_type == VAR_LIST) - { - if (write_list(fd, argvars[1].vval.v_list, TRUE) == FAIL) - err = TRUE; - } - else - { - p = get_tv_string_buf_chk(&argvars[1], buf); - if (p == NULL) - { - fclose(fd); - goto errret; /* type error; errmsg already given */ - } - if (fwrite(p, STRLEN(p), 1, fd) != 1) - err = TRUE; - } - if (fclose(fd) != 0) - err = TRUE; - if (err) - { - EMSG(_("E677: Error writing temp file")); - goto errret; - } - } - - if (retlist) - { - int len; - listitem_T *li; - char_u *s = NULL; - char_u *start; - char_u *end; - int i; - - res = get_cmd_output(get_tv_string(&argvars[0]), infile, - SHELL_SILENT | SHELL_COOKED, &len); - if (res == NULL) - goto errret; - - list = list_alloc(); - if (list == NULL) - goto errret; - - for (i = 0; i < len; ++i) - { - start = res + i; - while (i < len && res[i] != NL) - ++i; - end = res + i; - - s = alloc((unsigned)(end - start + 1)); - if (s == NULL) - goto errret; - - for (p = s; start < end; ++p, ++start) - *p = *start == NUL ? NL : *start; - *p = NUL; - - li = listitem_alloc(); - if (li == NULL) - { - vim_free(s); - goto errret; - } - li->li_tv.v_type = VAR_STRING; - li->li_tv.vval.v_string = s; - list_append(list, li); - } - - ++list->lv_refcount; - rettv->v_type = VAR_LIST; - rettv->vval.v_list = list; - list = NULL; - } - else - { - res = get_cmd_output(get_tv_string(&argvars[0]), infile, - SHELL_SILENT | SHELL_COOKED, NULL); -#ifdef USE_CR - /* translate <CR> into <NL> */ - if (res != NULL) - { - char_u *s; - - for (s = res; *s; ++s) - { - if (*s == CAR) - *s = NL; - } - } -#else -# ifdef USE_CRNL - /* translate <CR><NL> into <NL> */ - if (res != NULL) - { - char_u *s, *d; - - d = res; - for (s = res; *s; ++s) - { - if (s[0] == CAR && s[1] == NL) - ++s; - *d++ = *s; - } - *d = NUL; - } -# endif -#endif - rettv->vval.v_string = res; - res = NULL; - } - -errret: - if (infile != NULL) - { - mch_remove(infile); - vim_free(infile); - } - if (res != NULL) - vim_free(res); - if (list != NULL) - list_free(list, TRUE); -} - -/* - * "system()" function - */ - static void -f_system(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - get_cmd_output_as_rettv(argvars, rettv, FALSE); -} - -/* - * "systemlist()" function - */ - static void -f_systemlist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - get_cmd_output_as_rettv(argvars, rettv, TRUE); -} - -/* - * "tabpagebuflist()" function - */ - static void -f_tabpagebuflist(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_WINDOWS - tabpage_T *tp; - win_T *wp = NULL; - - if (argvars[0].v_type == VAR_UNKNOWN) - wp = firstwin; - else - { - tp = find_tabpage((int)get_tv_number(&argvars[0])); - if (tp != NULL) - wp = (tp == curtab) ? firstwin : tp->tp_firstwin; - } - if (wp != NULL && rettv_list_alloc(rettv) != FAIL) - { - for (; wp != NULL; wp = wp->w_next) - if (list_append_number(rettv->vval.v_list, - wp->w_buffer->b_fnum) == FAIL) - break; - } -#endif -} - - -/* - * "tabpagenr()" function - */ - static void -f_tabpagenr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int nr = 1; -#ifdef FEAT_WINDOWS - char_u *arg; - - if (argvars[0].v_type != VAR_UNKNOWN) - { - arg = get_tv_string_chk(&argvars[0]); - nr = 0; - if (arg != NULL) - { - if (STRCMP(arg, "$") == 0) - nr = tabpage_index(NULL) - 1; - else - EMSG2(_(e_invexpr2), arg); - } - } - else - nr = tabpage_index(curtab); -#endif - rettv->vval.v_number = nr; -} - - -#ifdef FEAT_WINDOWS -static int get_winnr __ARGS((tabpage_T *tp, typval_T *argvar)); - -/* - * Common code for tabpagewinnr() and winnr(). - */ - static int -get_winnr(tp, argvar) - tabpage_T *tp; - typval_T *argvar; -{ - win_T *twin; - int nr = 1; - win_T *wp; - char_u *arg; - - twin = (tp == curtab) ? curwin : tp->tp_curwin; - if (argvar->v_type != VAR_UNKNOWN) - { - arg = get_tv_string_chk(argvar); - if (arg == NULL) - nr = 0; /* type error; errmsg already given */ - else if (STRCMP(arg, "$") == 0) - twin = (tp == curtab) ? lastwin : tp->tp_lastwin; - else if (STRCMP(arg, "#") == 0) - { - twin = (tp == curtab) ? prevwin : tp->tp_prevwin; - if (twin == NULL) - nr = 0; - } - else - { - EMSG2(_(e_invexpr2), arg); - nr = 0; - } - } - - if (nr > 0) - for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; - wp != twin; wp = wp->w_next) - { - if (wp == NULL) - { - /* didn't find it in this tabpage */ - nr = 0; - break; - } - ++nr; - } - return nr; -} -#endif - -/* - * "tabpagewinnr()" function - */ - static void -f_tabpagewinnr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int nr = 1; -#ifdef FEAT_WINDOWS - tabpage_T *tp; - - tp = find_tabpage((int)get_tv_number(&argvars[0])); - if (tp == NULL) - nr = 0; - else - nr = get_winnr(tp, &argvars[1]); -#endif - rettv->vval.v_number = nr; -} - - -/* - * "tagfiles()" function - */ - static void -f_tagfiles(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - char_u *fname; - tagname_T tn; - int first; - - if (rettv_list_alloc(rettv) == FAIL) - return; - fname = alloc(MAXPATHL); - if (fname == NULL) - return; - - for (first = TRUE; ; first = FALSE) - if (get_tagfname(&tn, first, fname) == FAIL - || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) - break; - tagname_free(&tn); - vim_free(fname); -} - -/* - * "taglist()" function - */ - static void -f_taglist(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *tag_pattern; - - tag_pattern = get_tv_string(&argvars[0]); - - rettv->vval.v_number = FALSE; - if (*tag_pattern == NUL) - return; - - if (rettv_list_alloc(rettv) == OK) - (void)get_tags(rettv->vval.v_list, tag_pattern); -} - -/* - * "tempname()" function - */ - static void -f_tempname(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - static int x = 'A'; - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_tempname(x); - - /* Advance 'x' to use A-Z and 0-9, so that there are at least 34 different - * names. Skip 'I' and 'O', they are used for shell redirection. */ - do - { - if (x == 'Z') - x = '0'; - else if (x == '9') - x = 'A'; - else - { -#ifdef EBCDIC - if (x == 'I') - x = 'J'; - else if (x == 'R') - x = 'S'; - else -#endif - ++x; - } - } while (x == 'I' || x == 'O'); -} - -/* - * "test(list)" function: Just checking the walls... - */ - static void -f_test(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ - /* Used for unit testing. Change the code below to your liking. */ -#if 0 - listitem_T *li; - list_T *l; - char_u *bad, *good; - - if (argvars[0].v_type != VAR_LIST) - return; - l = argvars[0].vval.v_list; - if (l == NULL) - return; - li = l->lv_first; - if (li == NULL) - return; - bad = get_tv_string(&li->li_tv); - li = li->li_next; - if (li == NULL) - return; - good = get_tv_string(&li->li_tv); - rettv->vval.v_number = test_edit_score(bad, good); -#endif -} - -#ifdef FEAT_FLOAT -/* - * "tan()" function - */ - static void -f_tan(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = tan(f); - else - rettv->vval.v_float = 0.0; -} - -/* - * "tanh()" function - */ - static void -f_tanh(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = tanh(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "tolower(string)" function - */ - static void -f_tolower(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *p; - - p = vim_strsave(get_tv_string(&argvars[0])); - rettv->v_type = VAR_STRING; - rettv->vval.v_string = p; - - if (p != NULL) - while (*p != NUL) - { -#ifdef FEAT_MBYTE - int l; - - if (enc_utf8) - { - int c, lc; - - c = utf_ptr2char(p); - lc = utf_tolower(c); - l = utf_ptr2len(p); - /* TODO: reallocate string when byte count changes. */ - if (utf_char2len(lc) == l) - utf_char2bytes(lc, p); - p += l; - } - else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ - else -#endif - { - *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ - ++p; - } - } -} - -/* - * "toupper(string)" function - */ - static void -f_toupper(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = strup_save(get_tv_string(&argvars[0])); -} - -/* - * "tr(string, fromstr, tostr)" function - */ - static void -f_tr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - char_u *in_str; - char_u *fromstr; - char_u *tostr; - char_u *p; -#ifdef FEAT_MBYTE - int inlen; - int fromlen; - int tolen; - int idx; - char_u *cpstr; - int cplen; - int first = TRUE; -#endif - char_u buf[NUMBUFLEN]; - char_u buf2[NUMBUFLEN]; - garray_T ga; - - in_str = get_tv_string(&argvars[0]); - fromstr = get_tv_string_buf_chk(&argvars[1], buf); - tostr = get_tv_string_buf_chk(&argvars[2], buf2); - - /* Default return value: empty string. */ - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; - if (fromstr == NULL || tostr == NULL) - return; /* type error; errmsg already given */ - ga_init2(&ga, (int)sizeof(char), 80); - -#ifdef FEAT_MBYTE - if (!has_mbyte) -#endif - /* not multi-byte: fromstr and tostr must be the same length */ - if (STRLEN(fromstr) != STRLEN(tostr)) - { -#ifdef FEAT_MBYTE -error: -#endif - EMSG2(_(e_invarg2), fromstr); - ga_clear(&ga); - return; - } - - /* fromstr and tostr have to contain the same number of chars */ - while (*in_str != NUL) - { -#ifdef FEAT_MBYTE - if (has_mbyte) - { - inlen = (*mb_ptr2len)(in_str); - cpstr = in_str; - cplen = inlen; - idx = 0; - for (p = fromstr; *p != NUL; p += fromlen) - { - fromlen = (*mb_ptr2len)(p); - if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) - { - for (p = tostr; *p != NUL; p += tolen) - { - tolen = (*mb_ptr2len)(p); - if (idx-- == 0) - { - cplen = tolen; - cpstr = p; - break; - } - } - if (*p == NUL) /* tostr is shorter than fromstr */ - goto error; - break; - } - ++idx; - } - - if (first && cpstr == in_str) - { - /* Check that fromstr and tostr have the same number of - * (multi-byte) characters. Done only once when a character - * of in_str doesn't appear in fromstr. */ - first = FALSE; - for (p = tostr; *p != NUL; p += tolen) - { - tolen = (*mb_ptr2len)(p); - --idx; - } - if (idx != 0) - goto error; - } - - ga_grow(&ga, cplen); - mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen); - ga.ga_len += cplen; - - in_str += inlen; - } - else -#endif - { - /* When not using multi-byte chars we can do it faster. */ - p = vim_strchr(fromstr, *in_str); - if (p != NULL) - ga_append(&ga, tostr[p - fromstr]); - else - ga_append(&ga, *in_str); - ++in_str; - } - } - - /* add a terminating NUL */ - ga_grow(&ga, 1); - ga_append(&ga, NUL); - - rettv->vval.v_string = ga.ga_data; -} - -#ifdef FEAT_FLOAT -/* - * "trunc({float})" function - */ - static void -f_trunc(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - float_T f; - - rettv->v_type = VAR_FLOAT; - if (get_float_arg(argvars, &f) == OK) - /* trunc() is not in C90, use floor() or ceil() instead. */ - rettv->vval.v_float = f > 0 ? floor(f) : ceil(f); - else - rettv->vval.v_float = 0.0; -} -#endif - -/* - * "type(expr)" function - */ - static void -f_type(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int n; - - switch (argvars[0].v_type) - { - case VAR_NUMBER: n = 0; break; - case VAR_STRING: n = 1; break; - case VAR_FUNC: n = 2; break; - case VAR_LIST: n = 3; break; - case VAR_DICT: n = 4; break; -#ifdef FEAT_FLOAT - case VAR_FLOAT: n = 5; break; -#endif - default: EMSG2(_(e_intern2), "f_type()"); n = 0; break; - } - rettv->vval.v_number = n; -} - -/* - * "undofile(name)" function - */ - static void -f_undofile(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - rettv->v_type = VAR_STRING; -#ifdef FEAT_PERSISTENT_UNDO - { - char_u *fname = get_tv_string(&argvars[0]); - - if (*fname == NUL) - { - /* If there is no file name there will be no undo file. */ - rettv->vval.v_string = NULL; - } - else - { - char_u *ffname = FullName_save(fname, FALSE); - - if (ffname != NULL) - rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); - vim_free(ffname); - } - } -#else - rettv->vval.v_string = NULL; -#endif -} - -/* - * "undotree()" function - */ - static void -f_undotree(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - if (rettv_dict_alloc(rettv) == OK) - { - dict_T *dict = rettv->vval.v_dict; - list_T *list; - - dict_add_nr_str(dict, "synced", (long)curbuf->b_u_synced, NULL); - dict_add_nr_str(dict, "seq_last", curbuf->b_u_seq_last, NULL); - dict_add_nr_str(dict, "save_last", - (long)curbuf->b_u_save_nr_last, NULL); - dict_add_nr_str(dict, "seq_cur", curbuf->b_u_seq_cur, NULL); - dict_add_nr_str(dict, "time_cur", (long)curbuf->b_u_time_cur, NULL); - dict_add_nr_str(dict, "save_cur", (long)curbuf->b_u_save_nr_cur, NULL); - - list = list_alloc(); - if (list != NULL) - { - u_eval_tree(curbuf->b_u_oldhead, list); - dict_add_list(dict, "entries", list); - } - } -} - -/* - * "values(dict)" function - */ - static void -f_values(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - dict_list(argvars, rettv, 1); -} - -/* - * "virtcol(string)" function - */ - static void -f_virtcol(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - colnr_T vcol = 0; - pos_T *fp; - int fnum = curbuf->b_fnum; - - fp = var2fpos(&argvars[0], FALSE, &fnum); - if (fp != NULL && fp->lnum <= curbuf->b_ml.ml_line_count - && fnum == curbuf->b_fnum) - { - getvvcol(curwin, fp, NULL, NULL, &vcol); - ++vcol; - } - - rettv->vval.v_number = vcol; -} - -/* - * "visualmode()" function - */ - static void -f_visualmode(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ - char_u str[2]; - - rettv->v_type = VAR_STRING; - str[0] = curbuf->b_visual_mode_eval; - str[1] = NUL; - rettv->vval.v_string = vim_strsave(str); - - /* A non-zero number or non-empty string argument: reset mode. */ - if (non_zero_arg(&argvars[0])) - curbuf->b_visual_mode_eval = NUL; -} - -/* - * "wildmenumode()" function - */ - static void -f_wildmenumode(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv UNUSED; -{ -#ifdef FEAT_WILDMENU - if (wild_menu_showing) - rettv->vval.v_number = 1; -#endif -} - -/* - * "winbufnr(nr)" function - */ - static void -f_winbufnr(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - win_T *wp; - - wp = find_win_by_nr(&argvars[0], NULL); - if (wp == NULL) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = wp->w_buffer->b_fnum; -} - -/* - * "wincol()" function - */ - static void -f_wincol(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - validate_cursor(); - rettv->vval.v_number = curwin->w_wcol + 1; -} - -/* - * "winheight(nr)" function - */ - static void -f_winheight(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - win_T *wp; - - wp = find_win_by_nr(&argvars[0], NULL); - if (wp == NULL) - rettv->vval.v_number = -1; - else - rettv->vval.v_number = wp->w_height; -} - -/* - * "winline()" function - */ - static void -f_winline(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - validate_cursor(); - rettv->vval.v_number = curwin->w_wrow + 1; -} - -/* - * "winnr()" function - */ - static void -f_winnr(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - int nr = 1; - -#ifdef FEAT_WINDOWS - nr = get_winnr(curtab, &argvars[0]); -#endif - rettv->vval.v_number = nr; -} - -/* - * "winrestcmd()" function - */ - static void -f_winrestcmd(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ -#ifdef FEAT_WINDOWS - win_T *wp; - int winnr = 1; - garray_T ga; - char_u buf[50]; - - ga_init2(&ga, (int)sizeof(char), 70); - for (wp = firstwin; wp != NULL; wp = wp->w_next) - { - sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height); - ga_concat(&ga, buf); -# ifdef FEAT_VERTSPLIT - sprintf((char *)buf, "vert %dresize %d|", winnr, wp->w_width); - ga_concat(&ga, buf); -# endif - ++winnr; - } - ga_append(&ga, NUL); - - rettv->vval.v_string = ga.ga_data; -#else - rettv->vval.v_string = NULL; -#endif - rettv->v_type = VAR_STRING; -} - -/* - * "winrestview()" function - */ - static void -f_winrestview(argvars, rettv) - typval_T *argvars; - typval_T *rettv UNUSED; -{ - dict_T *dict; - - if (argvars[0].v_type != VAR_DICT - || (dict = argvars[0].vval.v_dict) == NULL) - EMSG(_(e_invarg)); - else - { - if (dict_find(dict, (char_u *)"lnum", -1) != NULL) - curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); - if (dict_find(dict, (char_u *)"col", -1) != NULL) - curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); -#ifdef FEAT_VIRTUALEDIT - if (dict_find(dict, (char_u *)"coladd", -1) != NULL) - curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); -#endif - if (dict_find(dict, (char_u *)"curswant", -1) != NULL) - { - curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); - curwin->w_set_curswant = FALSE; - } - - if (dict_find(dict, (char_u *)"topline", -1) != NULL) - set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); -#ifdef FEAT_DIFF - if (dict_find(dict, (char_u *)"topfill", -1) != NULL) - curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); -#endif - if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) - curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); - if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) - curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); - - check_cursor(); - win_new_height(curwin, curwin->w_height); -# ifdef FEAT_VERTSPLIT - win_new_width(curwin, W_WIDTH(curwin)); -# endif - changed_window_setting(); - - if (curwin->w_topline == 0) - curwin->w_topline = 1; - if (curwin->w_topline > curbuf->b_ml.ml_line_count) - curwin->w_topline = curbuf->b_ml.ml_line_count; -#ifdef FEAT_DIFF - check_topfill(curwin, TRUE); -#endif - } -} - -/* - * "winsaveview()" function - */ - static void -f_winsaveview(argvars, rettv) - typval_T *argvars UNUSED; - typval_T *rettv; -{ - dict_T *dict; - - if (rettv_dict_alloc(rettv) == FAIL) - return; - dict = rettv->vval.v_dict; - - dict_add_nr_str(dict, "lnum", (long)curwin->w_cursor.lnum, NULL); - dict_add_nr_str(dict, "col", (long)curwin->w_cursor.col, NULL); -#ifdef FEAT_VIRTUALEDIT - dict_add_nr_str(dict, "coladd", (long)curwin->w_cursor.coladd, NULL); -#endif - update_curswant(); - dict_add_nr_str(dict, "curswant", (long)curwin->w_curswant, NULL); - - dict_add_nr_str(dict, "topline", (long)curwin->w_topline, NULL); -#ifdef FEAT_DIFF - dict_add_nr_str(dict, "topfill", (long)curwin->w_topfill, NULL); -#endif - dict_add_nr_str(dict, "leftcol", (long)curwin->w_leftcol, NULL); - dict_add_nr_str(dict, "skipcol", (long)curwin->w_skipcol, NULL); -} - -/* - * "winwidth(nr)" function - */ - static void -f_winwidth(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - win_T *wp; - - wp = find_win_by_nr(&argvars[0], NULL); - if (wp == NULL) - rettv->vval.v_number = -1; - else -#ifdef FEAT_VERTSPLIT - rettv->vval.v_number = wp->w_width; -#else - rettv->vval.v_number = Columns; -#endif -} - -/* - * Write list of strings to file - */ - static int -write_list(fd, list, binary) - FILE *fd; - list_T *list; - int binary; -{ - listitem_T *li; - int c; - int ret = OK; - char_u *s; - - for (li = list->lv_first; li != NULL; li = li->li_next) - { - for (s = get_tv_string(&li->li_tv); *s != NUL; ++s) - { - if (*s == '\n') - c = putc(NUL, fd); - else - c = putc(*s, fd); - if (c == EOF) - { - ret = FAIL; - break; - } - } - if (!binary || li->li_next != NULL) - if (putc('\n', fd) == EOF) - { - ret = FAIL; - break; - } - if (ret == FAIL) - { - EMSG(_(e_write)); - break; - } - } - return ret; -} - -/* - * "writefile()" function - */ - static void -f_writefile(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - int binary = FALSE; - char_u *fname; - FILE *fd; - int ret = 0; - - if (check_restricted() || check_secure()) - return; - - if (argvars[0].v_type != VAR_LIST) - { - EMSG2(_(e_listarg), "writefile()"); - return; - } - if (argvars[0].vval.v_list == NULL) - return; - - if (argvars[2].v_type != VAR_UNKNOWN - && STRCMP(get_tv_string(&argvars[2]), "b") == 0) - binary = TRUE; - - /* Always open the file in binary mode, library functions have a mind of - * their own about CR-LF conversion. */ - fname = get_tv_string(&argvars[1]); - if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) - { - EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname); - ret = -1; - } - else - { - if (write_list(fd, argvars[0].vval.v_list, binary) == FAIL) - ret = -1; - fclose(fd); - } - - rettv->vval.v_number = ret; -} - -/* - * "xor(expr, expr)" function - */ - static void -f_xor(argvars, rettv) - typval_T *argvars; - typval_T *rettv; -{ - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - ^ get_tv_number_chk(&argvars[1], NULL); -} - - -/* - * Translate a String variable into a position. - * Returns NULL when there is an error. - */ - static pos_T * -var2fpos(varp, dollar_lnum, fnum) - typval_T *varp; - int dollar_lnum; /* TRUE when $ is last line */ - int *fnum; /* set to fnum for '0, 'A, etc. */ -{ - char_u *name; - static pos_T pos; - pos_T *pp; - - /* Argument can be [lnum, col, coladd]. */ - if (varp->v_type == VAR_LIST) - { - list_T *l; - int len; - int error = FALSE; - listitem_T *li; - - l = varp->vval.v_list; - if (l == NULL) - return NULL; - - /* Get the line number */ - pos.lnum = list_find_nr(l, 0L, &error); - if (error || pos.lnum <= 0 || pos.lnum > curbuf->b_ml.ml_line_count) - return NULL; /* invalid line number */ - - /* Get the column number */ - pos.col = list_find_nr(l, 1L, &error); - if (error) - return NULL; - len = (long)STRLEN(ml_get(pos.lnum)); - - /* We accept "$" for the column number: last column. */ - li = list_find(l, 1L); - if (li != NULL && li->li_tv.v_type == VAR_STRING - && li->li_tv.vval.v_string != NULL - && STRCMP(li->li_tv.vval.v_string, "$") == 0) - pos.col = len + 1; - - /* Accept a position up to the NUL after the line. */ - if (pos.col == 0 || (int)pos.col > len + 1) - return NULL; /* invalid column number */ - --pos.col; - -#ifdef FEAT_VIRTUALEDIT - /* Get the virtual offset. Defaults to zero. */ - pos.coladd = list_find_nr(l, 2L, &error); - if (error) - pos.coladd = 0; -#endif - - return &pos; - } - - name = get_tv_string_chk(varp); - if (name == NULL) - return NULL; - if (name[0] == '.') /* cursor */ - return &curwin->w_cursor; - if (name[0] == 'v' && name[1] == NUL) /* Visual start */ - { - if (VIsual_active) - return &VIsual; - return &curwin->w_cursor; - } - if (name[0] == '\'') /* mark */ - { - pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); - if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) - return NULL; - return pp; - } - -#ifdef FEAT_VIRTUALEDIT - pos.coladd = 0; -#endif - - if (name[0] == 'w' && dollar_lnum) - { - pos.col = 0; - if (name[1] == '0') /* "w0": first visible line */ - { - update_topline(); - pos.lnum = curwin->w_topline; - return &pos; - } - else if (name[1] == '$') /* "w$": last visible line */ - { - validate_botline(); - pos.lnum = curwin->w_botline - 1; - return &pos; - } - } - else if (name[0] == '$') /* last column or line */ - { - if (dollar_lnum) - { - pos.lnum = curbuf->b_ml.ml_line_count; - pos.col = 0; - } - else - { - pos.lnum = curwin->w_cursor.lnum; - pos.col = (colnr_T)STRLEN(ml_get_curline()); - } - return &pos; - } - return NULL; -} - -/* - * Convert list in "arg" into a position and optional file number. - * When "fnump" is NULL there is no file number, only 3 items. - * Note that the column is passed on as-is, the caller may want to decrement - * it to use 1 for the first column. - * Return FAIL when conversion is not possible, doesn't check the position for - * validity. - */ - static int -list2fpos(arg, posp, fnump, curswantp) - typval_T *arg; - pos_T *posp; - int *fnump; - colnr_T *curswantp; -{ - list_T *l = arg->vval.v_list; - long i = 0; - long n; - - /* List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only - * there when "fnump" isn't NULL; "coladd" and "curswant" are optional. */ - if (arg->v_type != VAR_LIST - || l == NULL - || l->lv_len < (fnump == NULL ? 2 : 3) - || l->lv_len > (fnump == NULL ? 4 : 5)) - return FAIL; - - if (fnump != NULL) - { - n = list_find_nr(l, i++, NULL); /* fnum */ - if (n < 0) - return FAIL; - if (n == 0) - n = curbuf->b_fnum; /* current buffer */ - *fnump = n; - } - - n = list_find_nr(l, i++, NULL); /* lnum */ - if (n < 0) - return FAIL; - posp->lnum = n; - - n = list_find_nr(l, i++, NULL); /* col */ - if (n < 0) - return FAIL; - posp->col = n; - -#ifdef FEAT_VIRTUALEDIT - n = list_find_nr(l, i, NULL); /* off */ - if (n < 0) - posp->coladd = 0; - else - posp->coladd = n; -#endif - - if (curswantp != NULL) - *curswantp = list_find_nr(l, i + 1, NULL); /* curswant */ - - return OK; -} - -/* - * Get the length of an environment variable name. - * Advance "arg" to the first character after the name. - * Return 0 for error. - */ - static int -get_env_len(arg) - char_u **arg; -{ - char_u *p; - int len; - - for (p = *arg; vim_isIDc(*p); ++p) - ; - if (p == *arg) /* no name found */ - return 0; - - len = (int)(p - *arg); - *arg = p; - return len; -} - -/* - * Get the length of the name of a function or internal variable. - * "arg" is advanced to the first non-white character after the name. - * Return 0 if something is wrong. - */ - static int -get_id_len(arg) - char_u **arg; -{ - char_u *p; - int len; - - /* Find the end of the name. */ - for (p = *arg; eval_isnamec(*p); ++p) - ; - if (p == *arg) /* no name found */ - return 0; - - len = (int)(p - *arg); - *arg = skipwhite(p); - - return len; -} - -/* - * Get the length of the name of a variable or function. - * Only the name is recognized, does not handle ".key" or "[idx]". - * "arg" is advanced to the first non-white character after the name. - * Return -1 if curly braces expansion failed. - * Return 0 if something else is wrong. - * If the name contains 'magic' {}'s, expand them and return the - * expanded name in an allocated string via 'alias' - caller must free. - */ - static int -get_name_len(arg, alias, evaluate, verbose) - char_u **arg; - char_u **alias; - int evaluate; - int verbose; -{ - int len; - char_u *p; - char_u *expr_start; - char_u *expr_end; - - *alias = NULL; /* default to no alias */ - - if ((*arg)[0] == K_SPECIAL && (*arg)[1] == KS_EXTRA - && (*arg)[2] == (int)KE_SNR) - { - /* hard coded <SNR>, already translated */ - *arg += 3; - return get_id_len(arg) + 3; - } - len = eval_fname_script(*arg); - if (len > 0) - { - /* literal "<SID>", "s:" or "<SNR>" */ - *arg += len; - } - - /* - * Find the end of the name; check for {} construction. - */ - p = find_name_end(*arg, &expr_start, &expr_end, - len > 0 ? 0 : FNE_CHECK_START); - if (expr_start != NULL) - { - char_u *temp_string; - - if (!evaluate) - { - len += (int)(p - *arg); - *arg = skipwhite(p); - return len; - } - - /* - * Include any <SID> etc in the expanded string: - * Thus the -len here. - */ - temp_string = make_expanded_name(*arg - len, expr_start, expr_end, p); - if (temp_string == NULL) - return -1; - *alias = temp_string; - *arg = skipwhite(p); - return (int)STRLEN(temp_string); - } - - len += get_id_len(arg); - if (len == 0 && verbose) - EMSG2(_(e_invexpr2), *arg); - - return len; -} - -/* - * Find the end of a variable or function name, taking care of magic braces. - * If "expr_start" is not NULL then "expr_start" and "expr_end" are set to the - * start and end of the first magic braces item. - * "flags" can have FNE_INCL_BR and FNE_CHECK_START. - * Return a pointer to just after the name. Equal to "arg" if there is no - * valid name. - */ - static char_u * -find_name_end(arg, expr_start, expr_end, flags) - char_u *arg; - char_u **expr_start; - char_u **expr_end; - int flags; -{ - int mb_nest = 0; - int br_nest = 0; - char_u *p; - - if (expr_start != NULL) - { - *expr_start = NULL; - *expr_end = NULL; - } - - /* Quick check for valid starting character. */ - if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{') - return arg; - - for (p = arg; *p != NUL - && (eval_isnamec(*p) - || *p == '{' - || ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.')) - || mb_nest != 0 - || br_nest != 0); mb_ptr_adv(p)) - { - if (*p == '\'') - { - /* skip over 'string' to avoid counting [ and ] inside it. */ - for (p = p + 1; *p != NUL && *p != '\''; mb_ptr_adv(p)) - ; - if (*p == NUL) - break; - } - else if (*p == '"') - { - /* skip over "str\"ing" to avoid counting [ and ] inside it. */ - for (p = p + 1; *p != NUL && *p != '"'; mb_ptr_adv(p)) - if (*p == '\\' && p[1] != NUL) - ++p; - if (*p == NUL) - break; - } - - if (mb_nest == 0) - { - if (*p == '[') - ++br_nest; - else if (*p == ']') - --br_nest; - } - - if (br_nest == 0) - { - if (*p == '{') - { - mb_nest++; - if (expr_start != NULL && *expr_start == NULL) - *expr_start = p; - } - else if (*p == '}') - { - mb_nest--; - if (expr_start != NULL && mb_nest == 0 && *expr_end == NULL) - *expr_end = p; - } - } - } - - return p; -} - -/* - * Expands out the 'magic' {}'s in a variable/function name. - * Note that this can call itself recursively, to deal with - * constructs like foo{bar}{baz}{bam} - * The four pointer arguments point to "foo{expre}ss{ion}bar" - * "in_start" ^ - * "expr_start" ^ - * "expr_end" ^ - * "in_end" ^ - * - * Returns a new allocated string, which the caller must free. - * Returns NULL for failure. - */ - static char_u * -make_expanded_name(in_start, expr_start, expr_end, in_end) - char_u *in_start; - char_u *expr_start; - char_u *expr_end; - char_u *in_end; -{ - char_u c1; - char_u *retval = NULL; - char_u *temp_result; - char_u *nextcmd = NULL; - - if (expr_end == NULL || in_end == NULL) - return NULL; - *expr_start = NUL; - *expr_end = NUL; - c1 = *in_end; - *in_end = NUL; - - temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE); - if (temp_result != NULL && nextcmd == NULL) - { - retval = alloc((unsigned)(STRLEN(temp_result) + (expr_start - in_start) - + (in_end - expr_end) + 1)); - if (retval != NULL) - { - STRCPY(retval, in_start); - STRCAT(retval, temp_result); - STRCAT(retval, expr_end + 1); - } - } - vim_free(temp_result); - - *in_end = c1; /* put char back for error messages */ - *expr_start = '{'; - *expr_end = '}'; - - if (retval != NULL) - { - temp_result = find_name_end(retval, &expr_start, &expr_end, 0); - if (expr_start != NULL) - { - /* Further expansion! */ - temp_result = make_expanded_name(retval, expr_start, - expr_end, temp_result); - vim_free(retval); - retval = temp_result; - } - } - - return retval; -} - -/* - * Return TRUE if character "c" can be used in a variable or function name. - * Does not include '{' or '}' for magic braces. - */ - static int -eval_isnamec(c) - int c; -{ - return (ASCII_ISALNUM(c) || c == '_' || c == ':' || c == AUTOLOAD_CHAR); -} - -/* - * Return TRUE if character "c" can be used as the first character in a - * variable or function name (excluding '{' and '}'). - */ - static int -eval_isnamec1(c) - int c; -{ - return (ASCII_ISALPHA(c) || c == '_'); -} - -/* - * Set number v: variable to "val". - */ - void -set_vim_var_nr(idx, val) - int idx; - long val; -{ - vimvars[idx].vv_nr = val; -} - -/* - * Get number v: variable value. - */ - long -get_vim_var_nr(idx) - int idx; -{ - return vimvars[idx].vv_nr; -} - -/* - * Get string v: variable value. Uses a static buffer, can only be used once. - */ - char_u * -get_vim_var_str(idx) - int idx; -{ - return get_tv_string(&vimvars[idx].vv_tv); -} - -/* - * Get List v: variable value. Caller must take care of reference count when - * needed. - */ - list_T * -get_vim_var_list(idx) - int idx; -{ - return vimvars[idx].vv_list; -} - -/* - * Set v:char to character "c". - */ - void -set_vim_var_char(c) - int c; -{ - char_u buf[MB_MAXBYTES + 1]; - -#ifdef FEAT_MBYTE - if (has_mbyte) - buf[(*mb_char2bytes)(c, buf)] = NUL; - else -#endif - { - buf[0] = c; - buf[1] = NUL; - } - set_vim_var_string(VV_CHAR, buf, -1); -} - -/* - * Set v:count to "count" and v:count1 to "count1". - * When "set_prevcount" is TRUE first set v:prevcount from v:count. - */ - void -set_vcount(count, count1, set_prevcount) - long count; - long count1; - int set_prevcount; -{ - if (set_prevcount) - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; - vimvars[VV_COUNT].vv_nr = count; - vimvars[VV_COUNT1].vv_nr = count1; -} - -/* - * Set string v: variable to a copy of "val". - */ - void -set_vim_var_string(idx, val, len) - int idx; - char_u *val; - int len; /* length of "val" to use or -1 (whole string) */ -{ - /* Need to do this (at least) once, since we can't initialize a union. - * Will always be invoked when "v:progname" is set. */ - vimvars[VV_VERSION].vv_nr = VIM_VERSION_100; - - vim_free(vimvars[idx].vv_str); - if (val == NULL) - vimvars[idx].vv_str = NULL; - else if (len == -1) - vimvars[idx].vv_str = vim_strsave(val); - else - vimvars[idx].vv_str = vim_strnsave(val, len); -} - -/* - * Set List v: variable to "val". - */ - void -set_vim_var_list(idx, val) - int idx; - list_T *val; -{ - list_unref(vimvars[idx].vv_list); - vimvars[idx].vv_list = val; - if (val != NULL) - ++val->lv_refcount; -} - -/* - * Set v:register if needed. - */ - void -set_reg_var(c) - int c; -{ - char_u regname; - - if (c == 0 || c == ' ') - regname = '"'; - else - regname = c; - /* Avoid free/alloc when the value is already right. */ - if (vimvars[VV_REG].vv_str == NULL || vimvars[VV_REG].vv_str[0] != c) - set_vim_var_string(VV_REG, ®name, 1); -} - -/* - * Get or set v:exception. If "oldval" == NULL, return the current value. - * Otherwise, restore the value to "oldval" and return NULL. - * Must always be called in pairs to save and restore v:exception! Does not - * take care of memory allocations. - */ - char_u * -v_exception(oldval) - char_u *oldval; -{ - if (oldval == NULL) - return vimvars[VV_EXCEPTION].vv_str; - - vimvars[VV_EXCEPTION].vv_str = oldval; - return NULL; -} - -/* - * Get or set v:throwpoint. If "oldval" == NULL, return the current value. - * Otherwise, restore the value to "oldval" and return NULL. - * Must always be called in pairs to save and restore v:throwpoint! Does not - * take care of memory allocations. - */ - char_u * -v_throwpoint(oldval) - char_u *oldval; -{ - if (oldval == NULL) - return vimvars[VV_THROWPOINT].vv_str; - - vimvars[VV_THROWPOINT].vv_str = oldval; - return NULL; -} - -#if defined(FEAT_AUTOCMD) || defined(PROTO) -/* - * Set v:cmdarg. - * If "eap" != NULL, use "eap" to generate the value and return the old value. - * If "oldarg" != NULL, restore the value to "oldarg" and return NULL. - * Must always be called in pairs! - */ - char_u * -set_cmdarg(eap, oldarg) - exarg_T *eap; - char_u *oldarg; -{ - char_u *oldval; - char_u *newval; - unsigned len; - - oldval = vimvars[VV_CMDARG].vv_str; - if (eap == NULL) - { - vim_free(oldval); - vimvars[VV_CMDARG].vv_str = oldarg; - return NULL; - } - - if (eap->force_bin == FORCE_BIN) - len = 6; - else if (eap->force_bin == FORCE_NOBIN) - len = 8; - else - len = 0; - - if (eap->read_edit) - len += 7; - - if (eap->force_ff != 0) - len += (unsigned)STRLEN(eap->cmd + eap->force_ff) + 6; -# ifdef FEAT_MBYTE - if (eap->force_enc != 0) - len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7; - if (eap->bad_char != 0) - len += 7 + 4; /* " ++bad=" + "keep" or "drop" */ -# endif - - newval = alloc(len + 1); - if (newval == NULL) - return NULL; - - if (eap->force_bin == FORCE_BIN) - sprintf((char *)newval, " ++bin"); - else if (eap->force_bin == FORCE_NOBIN) - sprintf((char *)newval, " ++nobin"); - else - *newval = NUL; - - if (eap->read_edit) - STRCAT(newval, " ++edit"); - - if (eap->force_ff != 0) - sprintf((char *)newval + STRLEN(newval), " ++ff=%s", - eap->cmd + eap->force_ff); -# ifdef FEAT_MBYTE - if (eap->force_enc != 0) - sprintf((char *)newval + STRLEN(newval), " ++enc=%s", - eap->cmd + eap->force_enc); - if (eap->bad_char == BAD_KEEP) - STRCPY(newval + STRLEN(newval), " ++bad=keep"); - else if (eap->bad_char == BAD_DROP) - STRCPY(newval + STRLEN(newval), " ++bad=drop"); - else if (eap->bad_char != 0) - sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); -# endif - vimvars[VV_CMDARG].vv_str = newval; - return oldval; -} -#endif - -/* - * Get the value of internal variable "name". - * Return OK or FAIL. - */ - static int -get_var_tv(name, len, rettv, verbose, no_autoload) - char_u *name; - int len; /* length of "name" */ - typval_T *rettv; /* NULL when only checking existence */ - int verbose; /* may give error message */ - int no_autoload; /* do not use script autoloading */ -{ - int ret = OK; - typval_T *tv = NULL; - typval_T atv; - dictitem_T *v; - int cc; - - /* truncate the name, so that we can use strcmp() */ - cc = name[len]; - name[len] = NUL; - - /* - * Check for "b:changedtick". - */ - if (STRCMP(name, "b:changedtick") == 0) - { - atv.v_type = VAR_NUMBER; - atv.vval.v_number = curbuf->b_changedtick; - tv = &atv; - } - - /* - * Check for user-defined variables. - */ - else - { - v = find_var(name, NULL, no_autoload); - if (v != NULL) - tv = &v->di_tv; - } - - if (tv == NULL) - { - if (rettv != NULL && verbose) - EMSG2(_(e_undefvar), name); - ret = FAIL; - } - else if (rettv != NULL) - copy_tv(tv, rettv); - - name[len] = cc; - - return ret; -} - -/* - * Handle expr[expr], expr[expr:expr] subscript and .name lookup. - * Also handle function call with Funcref variable: func(expr) - * Can all be combined: dict.func(expr)[idx]['func'](expr) - */ - static int -handle_subscript(arg, rettv, evaluate, verbose) - char_u **arg; - typval_T *rettv; - int evaluate; /* do more than finding the end */ - int verbose; /* give error messages */ -{ - int ret = OK; - dict_T *selfdict = NULL; - char_u *s; - int len; - typval_T functv; - - while (ret == OK - && (**arg == '[' - || (**arg == '.' && rettv->v_type == VAR_DICT) - || (**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC))) - && !vim_iswhite(*(*arg - 1))) - { - if (**arg == '(') - { - /* need to copy the funcref so that we can clear rettv */ - if (evaluate) - { - functv = *rettv; - rettv->v_type = VAR_UNKNOWN; - - /* Invoke the function. Recursive! */ - s = functv.vval.v_string; - } - else - s = (char_u *)""; - ret = get_func_tv(s, (int)STRLEN(s), rettv, arg, - curwin->w_cursor.lnum, curwin->w_cursor.lnum, - &len, evaluate, selfdict); - - /* Clear the funcref afterwards, so that deleting it while - * evaluating the arguments is possible (see test55). */ - if (evaluate) - clear_tv(&functv); - - /* Stop the expression evaluation when immediately aborting on - * error, or when an interrupt occurred or an exception was thrown - * but not caught. */ - if (aborting()) - { - if (ret == OK) - clear_tv(rettv); - ret = FAIL; - } - dict_unref(selfdict); - selfdict = NULL; - } - else /* **arg == '[' || **arg == '.' */ - { - dict_unref(selfdict); - if (rettv->v_type == VAR_DICT) - { - selfdict = rettv->vval.v_dict; - if (selfdict != NULL) - ++selfdict->dv_refcount; - } - else - selfdict = NULL; - if (eval_index(arg, rettv, evaluate, verbose) == FAIL) - { - clear_tv(rettv); - ret = FAIL; - } - } - } - dict_unref(selfdict); - return ret; -} - -/* - * Allocate memory for a variable type-value, and make it empty (0 or NULL - * value). - */ - static typval_T * -alloc_tv() -{ - return (typval_T *)alloc_clear((unsigned)sizeof(typval_T)); -} - -/* - * Allocate memory for a variable type-value, and assign a string to it. - * The string "s" must have been allocated, it is consumed. - * Return NULL for out of memory, the variable otherwise. - */ - static typval_T * -alloc_string_tv(s) - char_u *s; -{ - typval_T *rettv; - - rettv = alloc_tv(); - if (rettv != NULL) - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = s; - } - else - vim_free(s); - return rettv; -} - -/* - * Free the memory for a variable type-value. - */ - void -free_tv(varp) - typval_T *varp; -{ - if (varp != NULL) - { - switch (varp->v_type) - { - case VAR_FUNC: - func_unref(varp->vval.v_string); - /*FALLTHROUGH*/ - case VAR_STRING: - vim_free(varp->vval.v_string); - break; - case VAR_LIST: - list_unref(varp->vval.v_list); - break; - case VAR_DICT: - dict_unref(varp->vval.v_dict); - break; - case VAR_NUMBER: -#ifdef FEAT_FLOAT - case VAR_FLOAT: -#endif - case VAR_UNKNOWN: - break; - default: - EMSG2(_(e_intern2), "free_tv()"); - break; - } - vim_free(varp); - } -} - -/* - * Free the memory for a variable value and set the value to NULL or 0. - */ - void -clear_tv(varp) - typval_T *varp; -{ - if (varp != NULL) - { - switch (varp->v_type) - { - case VAR_FUNC: - func_unref(varp->vval.v_string); - /*FALLTHROUGH*/ - case VAR_STRING: - vim_free(varp->vval.v_string); - varp->vval.v_string = NULL; - break; - case VAR_LIST: - list_unref(varp->vval.v_list); - varp->vval.v_list = NULL; - break; - case VAR_DICT: - dict_unref(varp->vval.v_dict); - varp->vval.v_dict = NULL; - break; - case VAR_NUMBER: - varp->vval.v_number = 0; - break; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - varp->vval.v_float = 0.0; - break; -#endif - case VAR_UNKNOWN: - break; - default: - EMSG2(_(e_intern2), "clear_tv()"); - } - varp->v_lock = 0; - } -} - -/* - * Set the value of a variable to NULL without freeing items. - */ - static void -init_tv(varp) - typval_T *varp; -{ - if (varp != NULL) - vim_memset(varp, 0, sizeof(typval_T)); -} - -/* - * Get the number value of a variable. - * If it is a String variable, uses vim_str2nr(). - * For incompatible types, return 0. - * get_tv_number_chk() is similar to get_tv_number(), but informs the - * caller of incompatible types: it sets *denote to TRUE if "denote" - * is not NULL or returns -1 otherwise. - */ - static long -get_tv_number(varp) - typval_T *varp; -{ - int error = FALSE; - - return get_tv_number_chk(varp, &error); /* return 0L on error */ -} - - long -get_tv_number_chk(varp, denote) - typval_T *varp; - int *denote; -{ - long n = 0L; - - switch (varp->v_type) - { - case VAR_NUMBER: - return (long)(varp->vval.v_number); -#ifdef FEAT_FLOAT - case VAR_FLOAT: - EMSG(_("E805: Using a Float as a Number")); - break; -#endif - case VAR_FUNC: - EMSG(_("E703: Using a Funcref as a Number")); - break; - case VAR_STRING: - if (varp->vval.v_string != NULL) - vim_str2nr(varp->vval.v_string, NULL, NULL, - TRUE, TRUE, &n, NULL); - return n; - case VAR_LIST: - EMSG(_("E745: Using a List as a Number")); - break; - case VAR_DICT: - EMSG(_("E728: Using a Dictionary as a Number")); - break; - default: - EMSG2(_(e_intern2), "get_tv_number()"); - break; - } - if (denote == NULL) /* useful for values that must be unsigned */ - n = -1; - else - *denote = TRUE; - return n; -} - -/* - * Get the lnum from the first argument. - * Also accepts ".", "$", etc., but that only works for the current buffer. - * Returns -1 on error. - */ - static linenr_T -get_tv_lnum(argvars) - typval_T *argvars; -{ - typval_T rettv; - linenr_T lnum; - - lnum = get_tv_number_chk(&argvars[0], NULL); - if (lnum == 0) /* no valid number, try using line() */ - { - rettv.v_type = VAR_NUMBER; - f_line(argvars, &rettv); - lnum = rettv.vval.v_number; - clear_tv(&rettv); - } - return lnum; -} - -/* - * Get the lnum from the first argument. - * Also accepts "$", then "buf" is used. - * Returns 0 on error. - */ - static linenr_T -get_tv_lnum_buf(argvars, buf) - typval_T *argvars; - buf_T *buf; -{ - if (argvars[0].v_type == VAR_STRING - && argvars[0].vval.v_string != NULL - && argvars[0].vval.v_string[0] == '$' - && buf != NULL) - return buf->b_ml.ml_line_count; - return get_tv_number_chk(&argvars[0], NULL); -} - -/* - * Get the string value of a variable. - * If it is a Number variable, the number is converted into a string. - * get_tv_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! - * get_tv_string_buf() uses a given buffer. - * If the String variable has never been set, return an empty string. - * Never returns NULL; - * get_tv_string_chk() and get_tv_string_buf_chk() are similar, but return - * NULL on error. - */ - static char_u * -get_tv_string(varp) - typval_T *varp; -{ - static char_u mybuf[NUMBUFLEN]; - - return get_tv_string_buf(varp, mybuf); -} - - static char_u * -get_tv_string_buf(varp, buf) - typval_T *varp; - char_u *buf; -{ - char_u *res = get_tv_string_buf_chk(varp, buf); - - return res != NULL ? res : (char_u *)""; -} - -/* - * Careful: This uses a single, static buffer. YOU CAN ONLY USE IT ONCE! - */ - char_u * -get_tv_string_chk(varp) - typval_T *varp; -{ - static char_u mybuf[NUMBUFLEN]; - - return get_tv_string_buf_chk(varp, mybuf); -} - - static char_u * -get_tv_string_buf_chk(varp, buf) - typval_T *varp; - char_u *buf; -{ - switch (varp->v_type) - { - case VAR_NUMBER: - sprintf((char *)buf, "%ld", (long)varp->vval.v_number); - return buf; - case VAR_FUNC: - EMSG(_("E729: using Funcref as a String")); - break; - case VAR_LIST: - EMSG(_("E730: using List as a String")); - break; - case VAR_DICT: - EMSG(_("E731: using Dictionary as a String")); - break; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - EMSG(_(e_float_as_string)); - break; -#endif - case VAR_STRING: - if (varp->vval.v_string != NULL) - return varp->vval.v_string; - return (char_u *)""; - default: - EMSG2(_(e_intern2), "get_tv_string_buf()"); - break; - } - return NULL; -} - -/* - * Find variable "name" in the list of variables. - * Return a pointer to it if found, NULL if not found. - * Careful: "a:0" variables don't have a name. - * When "htp" is not NULL we are writing to the variable, set "htp" to the - * hashtab_T used. - */ - static dictitem_T * -find_var(name, htp, no_autoload) - char_u *name; - hashtab_T **htp; - int no_autoload; -{ - char_u *varname; - hashtab_T *ht; - - ht = find_var_ht(name, &varname); - if (htp != NULL) - *htp = ht; - if (ht == NULL) - return NULL; - return find_var_in_ht(ht, *name, varname, no_autoload || htp != NULL); -} - -/* - * Find variable "varname" in hashtab "ht" with name "htname". - * Returns NULL if not found. - */ - static dictitem_T * -find_var_in_ht(ht, htname, varname, no_autoload) - hashtab_T *ht; - int htname; - char_u *varname; - int no_autoload; -{ - hashitem_T *hi; - - if (*varname == NUL) - { - /* Must be something like "s:", otherwise "ht" would be NULL. */ - switch (htname) - { - case 's': return &SCRIPT_SV(current_SID)->sv_var; - case 'g': return &globvars_var; - case 'v': return &vimvars_var; - case 'b': return &curbuf->b_bufvar; - case 'w': return &curwin->w_winvar; -#ifdef FEAT_WINDOWS - case 't': return &curtab->tp_winvar; -#endif - case 'l': return current_funccal == NULL - ? NULL : ¤t_funccal->l_vars_var; - case 'a': return current_funccal == NULL - ? NULL : ¤t_funccal->l_avars_var; - } - return NULL; - } - - hi = hash_find(ht, varname); - if (HASHITEM_EMPTY(hi)) - { - /* For global variables we may try auto-loading the script. If it - * worked find the variable again. Don't auto-load a script if it was - * loaded already, otherwise it would be loaded every time when - * checking if a function name is a Funcref variable. */ - if (ht == &globvarht && !no_autoload) - { - /* Note: script_autoload() may make "hi" invalid. It must either - * be obtained again or not used. */ - if (!script_autoload(varname, FALSE) || aborting()) - return NULL; - hi = hash_find(ht, varname); - } - if (HASHITEM_EMPTY(hi)) - return NULL; - } - return HI2DI(hi); -} - -/* - * Find the hashtab used for a variable name. - * Set "varname" to the start of name without ':'. - */ - static hashtab_T * -find_var_ht(name, varname) - char_u *name; - char_u **varname; -{ - hashitem_T *hi; - - if (name[1] != ':') - { - /* The name must not start with a colon or #. */ - if (name[0] == ':' || name[0] == AUTOLOAD_CHAR) - return NULL; - *varname = name; - - /* "version" is "v:version" in all scopes */ - hi = hash_find(&compat_hashtab, name); - if (!HASHITEM_EMPTY(hi)) - return &compat_hashtab; - - if (current_funccal == NULL) - return &globvarht; /* global variable */ - return ¤t_funccal->l_vars.dv_hashtab; /* l: variable */ - } - *varname = name + 2; - if (*name == 'g') /* global variable */ - return &globvarht; - /* There must be no ':' or '#' in the rest of the name, unless g: is used - */ - if (vim_strchr(name + 2, ':') != NULL - || vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL) - return NULL; - if (*name == 'b') /* buffer variable */ - return &curbuf->b_vars->dv_hashtab; - if (*name == 'w') /* window variable */ - return &curwin->w_vars->dv_hashtab; -#ifdef FEAT_WINDOWS - if (*name == 't') /* tab page variable */ - return &curtab->tp_vars->dv_hashtab; -#endif - if (*name == 'v') /* v: variable */ - return &vimvarht; - if (*name == 'a' && current_funccal != NULL) /* function argument */ - return ¤t_funccal->l_avars.dv_hashtab; - if (*name == 'l' && current_funccal != NULL) /* local function variable */ - return ¤t_funccal->l_vars.dv_hashtab; - if (*name == 's' /* script variable */ - && current_SID > 0 && current_SID <= ga_scripts.ga_len) - return &SCRIPT_VARS(current_SID); - return NULL; -} - -/* - * Get the string value of a (global/local) variable. - * Note: see get_tv_string() for how long the pointer remains valid. - * Returns NULL when it doesn't exist. - */ - char_u * -get_var_value(name) - char_u *name; -{ - dictitem_T *v; - - v = find_var(name, NULL, FALSE); - if (v == NULL) - return NULL; - return get_tv_string(&v->di_tv); -} - -/* - * Allocate a new hashtab for a sourced script. It will be used while - * sourcing this script and when executing functions defined in the script. - */ - void -new_script_vars(id) - scid_T id; -{ - int i; - hashtab_T *ht; - scriptvar_T *sv; - - if (ga_grow(&ga_scripts, (int)(id - ga_scripts.ga_len)) == OK) - { - /* Re-allocating ga_data means that an ht_array pointing to - * ht_smallarray becomes invalid. We can recognize this: ht_mask is - * at its init value. Also reset "v_dict", it's always the same. */ - for (i = 1; i <= ga_scripts.ga_len; ++i) - { - ht = &SCRIPT_VARS(i); - if (ht->ht_mask == HT_INIT_SIZE - 1) - ht->ht_array = ht->ht_smallarray; - sv = SCRIPT_SV(i); - sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict; - } - - while (ga_scripts.ga_len < id) - { - sv = SCRIPT_SV(ga_scripts.ga_len + 1) = - (scriptvar_T *)alloc_clear(sizeof(scriptvar_T)); - init_var_dict(&sv->sv_dict, &sv->sv_var, VAR_SCOPE); - ++ga_scripts.ga_len; - } - } -} - -/* - * Initialize dictionary "dict" as a scope and set variable "dict_var" to - * point to it. - */ - void -init_var_dict(dict, dict_var, scope) - dict_T *dict; - dictitem_T *dict_var; - int scope; -{ - hash_init(&dict->dv_hashtab); - dict->dv_lock = 0; - dict->dv_scope = scope; - dict->dv_refcount = DO_NOT_FREE_CNT; - dict->dv_copyID = 0; - dict_var->di_tv.vval.v_dict = dict; - dict_var->di_tv.v_type = VAR_DICT; - dict_var->di_tv.v_lock = VAR_FIXED; - dict_var->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; - dict_var->di_key[0] = NUL; -} - -/* - * Unreference a dictionary initialized by init_var_dict(). - */ - void -unref_var_dict(dict) - dict_T *dict; -{ - /* Now the dict needs to be freed if no one else is using it, go back to - * normal reference counting. */ - dict->dv_refcount -= DO_NOT_FREE_CNT - 1; - dict_unref(dict); -} - -/* - * Clean up a list of internal variables. - * Frees all allocated variables and the value they contain. - * Clears hashtab "ht", does not free it. - */ - void -vars_clear(ht) - hashtab_T *ht; -{ - vars_clear_ext(ht, TRUE); -} - -/* - * Like vars_clear(), but only free the value if "free_val" is TRUE. - */ - static void -vars_clear_ext(ht, free_val) - hashtab_T *ht; - int free_val; -{ - int todo; - hashitem_T *hi; - dictitem_T *v; - - hash_lock(ht); - todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - - /* Free the variable. Don't remove it from the hashtab, - * ht_array might change then. hash_clear() takes care of it - * later. */ - v = HI2DI(hi); - if (free_val) - clear_tv(&v->di_tv); - if ((v->di_flags & DI_FLAGS_FIX) == 0) - vim_free(v); - } - } - hash_clear(ht); - ht->ht_used = 0; -} - -/* - * Delete a variable from hashtab "ht" at item "hi". - * Clear the variable value and free the dictitem. - */ - static void -delete_var(ht, hi) - hashtab_T *ht; - hashitem_T *hi; -{ - dictitem_T *di = HI2DI(hi); - - hash_remove(ht, hi); - clear_tv(&di->di_tv); - vim_free(di); -} - -/* - * List the value of one internal variable. - */ - static void -list_one_var(v, prefix, first) - dictitem_T *v; - char_u *prefix; - int *first; -{ - char_u *tofree; - char_u *s; - char_u numbuf[NUMBUFLEN]; - - current_copyID += COPYID_INC; - s = echo_string(&v->di_tv, &tofree, numbuf, current_copyID); - list_one_var_a(prefix, v->di_key, v->di_tv.v_type, - s == NULL ? (char_u *)"" : s, first); - vim_free(tofree); -} - - static void -list_one_var_a(prefix, name, type, string, first) - char_u *prefix; - char_u *name; - int type; - char_u *string; - int *first; /* when TRUE clear rest of screen and set to FALSE */ -{ - /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ - msg_start(); - msg_puts(prefix); - if (name != NULL) /* "a:" vars don't have a name stored */ - msg_puts(name); - msg_putchar(' '); - msg_advance(22); - if (type == VAR_NUMBER) - msg_putchar('#'); - else if (type == VAR_FUNC) - msg_putchar('*'); - else if (type == VAR_LIST) - { - msg_putchar('['); - if (*string == '[') - ++string; - } - else if (type == VAR_DICT) - { - msg_putchar('{'); - if (*string == '{') - ++string; - } - else - msg_putchar(' '); - - msg_outtrans(string); - - if (type == VAR_FUNC) - msg_puts((char_u *)"()"); - if (*first) - { - msg_clr_eos(); - *first = FALSE; - } -} - -/* - * Set variable "name" to value in "tv". - * If the variable already exists, the value is updated. - * Otherwise the variable is created. - */ - static void -set_var(name, tv, copy) - char_u *name; - typval_T *tv; - int copy; /* make copy of value in "tv" */ -{ - dictitem_T *v; - char_u *varname; - hashtab_T *ht; - - ht = find_var_ht(name, &varname); - if (ht == NULL || *varname == NUL) - { - EMSG2(_(e_illvar), name); - return; - } - v = find_var_in_ht(ht, 0, varname, TRUE); - - if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL)) - return; - - if (v != NULL) - { - /* existing variable, need to clear the value */ - if (var_check_ro(v->di_flags, name) - || tv_check_lock(v->di_tv.v_lock, name)) - return; - if (v->di_tv.v_type != tv->v_type - && !((v->di_tv.v_type == VAR_STRING - || v->di_tv.v_type == VAR_NUMBER) - && (tv->v_type == VAR_STRING - || tv->v_type == VAR_NUMBER)) -#ifdef FEAT_FLOAT - && !((v->di_tv.v_type == VAR_NUMBER - || v->di_tv.v_type == VAR_FLOAT) - && (tv->v_type == VAR_NUMBER - || tv->v_type == VAR_FLOAT)) -#endif - ) - { - EMSG2(_("E706: Variable type mismatch for: %s"), name); - return; - } - - /* - * Handle setting internal v: variables separately: we don't change - * the type. - */ - if (ht == &vimvarht) - { - if (v->di_tv.v_type == VAR_STRING) - { - vim_free(v->di_tv.vval.v_string); - if (copy || tv->v_type != VAR_STRING) - v->di_tv.vval.v_string = vim_strsave(get_tv_string(tv)); - else - { - /* Take over the string to avoid an extra alloc/free. */ - v->di_tv.vval.v_string = tv->vval.v_string; - tv->vval.v_string = NULL; - } - } - else if (v->di_tv.v_type != VAR_NUMBER) - EMSG2(_(e_intern2), "set_var()"); - else - { - v->di_tv.vval.v_number = get_tv_number(tv); - if (STRCMP(varname, "searchforward") == 0) - set_search_direction(v->di_tv.vval.v_number ? '/' : '?'); -#ifdef FEAT_SEARCH_EXTRA - else if (STRCMP(varname, "hlsearch") == 0) - { - no_hlsearch = !v->di_tv.vval.v_number; - redraw_all_later(SOME_VALID); - } -#endif - } - return; - } - - clear_tv(&v->di_tv); - } - else /* add a new variable */ - { - /* Can't add "v:" variable. */ - if (ht == &vimvarht) - { - EMSG2(_(e_illvar), name); - return; - } - - /* Make sure the variable name is valid. */ - if (!valid_varname(varname)) - return; - - v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) - + STRLEN(varname))); - if (v == NULL) - return; - STRCPY(v->di_key, varname); - if (hash_add(ht, DI2HIKEY(v)) == FAIL) - { - vim_free(v); - return; - } - v->di_flags = 0; - } - - if (copy || tv->v_type == VAR_NUMBER || tv->v_type == VAR_FLOAT) - copy_tv(tv, &v->di_tv); - else - { - v->di_tv = *tv; - v->di_tv.v_lock = 0; - init_tv(tv); - } -} - -/* - * Return TRUE if di_flags "flags" indicates variable "name" is read-only. - * Also give an error message. - */ - static int -var_check_ro(flags, name) - int flags; - char_u *name; -{ - if (flags & DI_FLAGS_RO) - { - EMSG2(_(e_readonlyvar), name); - return TRUE; - } - if ((flags & DI_FLAGS_RO_SBX) && sandbox) - { - EMSG2(_(e_readonlysbx), name); - return TRUE; - } - return FALSE; -} - -/* - * Return TRUE if di_flags "flags" indicates variable "name" is fixed. - * Also give an error message. - */ - static int -var_check_fixed(flags, name) - int flags; - char_u *name; -{ - if (flags & DI_FLAGS_FIX) - { - EMSG2(_("E795: Cannot delete variable %s"), name); - return TRUE; - } - return FALSE; -} - -/* - * Check if a funcref is assigned to a valid variable name. - * Return TRUE and give an error if not. - */ - static int -var_check_func_name(name, new_var) - char_u *name; /* points to start of variable name */ - int new_var; /* TRUE when creating the variable */ -{ - /* Allow for w: b: s: and t:. */ - if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') - && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') - ? name[2] : name[0])) - { - EMSG2(_("E704: Funcref variable name must start with a capital: %s"), - name); - return TRUE; - } - /* Don't allow hiding a function. When "v" is not NULL we might be - * assigning another function to the same var, the type is checked - * below. */ - if (new_var && function_exists(name)) - { - EMSG2(_("E705: Variable name conflicts with existing function: %s"), - name); - return TRUE; - } - return FALSE; -} - -/* - * Check if a variable name is valid. - * Return FALSE and give an error if not. - */ - static int -valid_varname(varname) - char_u *varname; -{ - char_u *p; - - for (p = varname; *p != NUL; ++p) - if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) - && *p != AUTOLOAD_CHAR) - { - EMSG2(_(e_illvar), varname); - return FALSE; - } - return TRUE; -} - -/* - * Return TRUE if typeval "tv" is set to be locked (immutable). - * Also give an error message, using "name". - */ - static int -tv_check_lock(lock, name) - int lock; - char_u *name; -{ - if (lock & VAR_LOCKED) - { - EMSG2(_("E741: Value is locked: %s"), - name == NULL ? (char_u *)_("Unknown") : name); - return TRUE; - } - if (lock & VAR_FIXED) - { - EMSG2(_("E742: Cannot change value of %s"), - name == NULL ? (char_u *)_("Unknown") : name); - return TRUE; - } - return FALSE; -} - -/* - * Copy the values from typval_T "from" to typval_T "to". - * When needed allocates string or increases reference count. - * Does not make a copy of a list or dict but copies the reference! - * It is OK for "from" and "to" to point to the same item. This is used to - * make a copy later. - */ - void -copy_tv(from, to) - typval_T *from; - typval_T *to; -{ - to->v_type = from->v_type; - to->v_lock = 0; - switch (from->v_type) - { - case VAR_NUMBER: - to->vval.v_number = from->vval.v_number; - break; -#ifdef FEAT_FLOAT - case VAR_FLOAT: - to->vval.v_float = from->vval.v_float; - break; -#endif - case VAR_STRING: - case VAR_FUNC: - if (from->vval.v_string == NULL) - to->vval.v_string = NULL; - else - { - to->vval.v_string = vim_strsave(from->vval.v_string); - if (from->v_type == VAR_FUNC) - func_ref(to->vval.v_string); - } - break; - case VAR_LIST: - if (from->vval.v_list == NULL) - to->vval.v_list = NULL; - else - { - to->vval.v_list = from->vval.v_list; - ++to->vval.v_list->lv_refcount; - } - break; - case VAR_DICT: - if (from->vval.v_dict == NULL) - to->vval.v_dict = NULL; - else - { - to->vval.v_dict = from->vval.v_dict; - ++to->vval.v_dict->dv_refcount; - } - break; - default: - EMSG2(_(e_intern2), "copy_tv()"); - break; - } -} - -/* - * Make a copy of an item. - * Lists and Dictionaries are also copied. A deep copy if "deep" is set. - * For deepcopy() "copyID" is zero for a full copy or the ID for when a - * reference to an already copied list/dict can be used. - * Returns FAIL or OK. - */ - static int -item_copy(from, to, deep, copyID) - typval_T *from; - typval_T *to; - int deep; - int copyID; -{ - static int recurse = 0; - int ret = OK; - - if (recurse >= DICT_MAXNEST) - { - EMSG(_("E698: variable nested too deep for making a copy")); - return FAIL; - } - ++recurse; - - switch (from->v_type) - { - case VAR_NUMBER: -#ifdef FEAT_FLOAT - case VAR_FLOAT: -#endif - case VAR_STRING: - case VAR_FUNC: - copy_tv(from, to); - break; - case VAR_LIST: - to->v_type = VAR_LIST; - to->v_lock = 0; - if (from->vval.v_list == NULL) - to->vval.v_list = NULL; - else if (copyID != 0 && from->vval.v_list->lv_copyID == copyID) - { - /* use the copy made earlier */ - to->vval.v_list = from->vval.v_list->lv_copylist; - ++to->vval.v_list->lv_refcount; - } - else - to->vval.v_list = list_copy(from->vval.v_list, deep, copyID); - if (to->vval.v_list == NULL) - ret = FAIL; - break; - case VAR_DICT: - to->v_type = VAR_DICT; - to->v_lock = 0; - if (from->vval.v_dict == NULL) - to->vval.v_dict = NULL; - else if (copyID != 0 && from->vval.v_dict->dv_copyID == copyID) - { - /* use the copy made earlier */ - to->vval.v_dict = from->vval.v_dict->dv_copydict; - ++to->vval.v_dict->dv_refcount; - } - else - to->vval.v_dict = dict_copy(from->vval.v_dict, deep, copyID); - if (to->vval.v_dict == NULL) - ret = FAIL; - break; - default: - EMSG2(_(e_intern2), "item_copy()"); - ret = FAIL; - } - --recurse; - return ret; -} - -/* - * ":echo expr1 ..." print each argument separated with a space, add a - * newline at the end. - * ":echon expr1 ..." print each argument plain. - */ - void -ex_echo(eap) - exarg_T *eap; -{ - char_u *arg = eap->arg; - typval_T rettv; - char_u *tofree; - char_u *p; - int needclr = TRUE; - int atstart = TRUE; - char_u numbuf[NUMBUFLEN]; - - if (eap->skip) - ++emsg_skip; - while (*arg != NUL && *arg != '|' && *arg != '\n' && !got_int) - { - /* If eval1() causes an error message the text from the command may - * still need to be cleared. E.g., "echo 22,44". */ - need_clr_eos = needclr; - - p = arg; - if (eval1(&arg, &rettv, !eap->skip) == FAIL) - { - /* - * Report the invalid expression unless the expression evaluation - * has been cancelled due to an aborting error, an interrupt, or an - * exception. - */ - if (!aborting()) - EMSG2(_(e_invexpr2), p); - need_clr_eos = FALSE; - break; - } - need_clr_eos = FALSE; - - if (!eap->skip) - { - if (atstart) - { - atstart = FALSE; - /* Call msg_start() after eval1(), evaluating the expression - * may cause a message to appear. */ - if (eap->cmdidx == CMD_echo) - { - /* Mark the saved text as finishing the line, so that what - * follows is displayed on a new line when scrolling back - * at the more prompt. */ - msg_sb_eol(); - msg_start(); - } - } - else if (eap->cmdidx == CMD_echo) - msg_puts_attr((char_u *)" ", echo_attr); - current_copyID += COPYID_INC; - p = echo_string(&rettv, &tofree, numbuf, current_copyID); - if (p != NULL) - for ( ; *p != NUL && !got_int; ++p) - { - if (*p == '\n' || *p == '\r' || *p == TAB) - { - if (*p != TAB && needclr) - { - /* remove any text still there from the command */ - msg_clr_eos(); - needclr = FALSE; - } - msg_putchar_attr(*p, echo_attr); - } - else - { -#ifdef FEAT_MBYTE - if (has_mbyte) - { - int i = (*mb_ptr2len)(p); - - (void)msg_outtrans_len_attr(p, i, echo_attr); - p += i - 1; - } - else -#endif - (void)msg_outtrans_len_attr(p, 1, echo_attr); - } - } - vim_free(tofree); - } - clear_tv(&rettv); - arg = skipwhite(arg); - } - eap->nextcmd = check_nextcmd(arg); - - if (eap->skip) - --emsg_skip; - else - { - /* remove text that may still be there from the command */ - if (needclr) - msg_clr_eos(); - if (eap->cmdidx == CMD_echo) - msg_end(); - } -} - -/* - * ":echohl {name}". - */ - void -ex_echohl(eap) - exarg_T *eap; -{ - int id; - - id = syn_name2id(eap->arg); - if (id == 0) - echo_attr = 0; - else - echo_attr = syn_id2attr(id); -} - -/* - * ":execute expr1 ..." execute the result of an expression. - * ":echomsg expr1 ..." Print a message - * ":echoerr expr1 ..." Print an error - * Each gets spaces around each argument and a newline at the end for - * echo commands - */ - void -ex_execute(eap) - exarg_T *eap; -{ - char_u *arg = eap->arg; - typval_T rettv; - int ret = OK; - char_u *p; - garray_T ga; - int len; - int save_did_emsg; - - ga_init2(&ga, 1, 80); - - if (eap->skip) - ++emsg_skip; - while (*arg != NUL && *arg != '|' && *arg != '\n') - { - p = arg; - if (eval1(&arg, &rettv, !eap->skip) == FAIL) - { - /* - * Report the invalid expression unless the expression evaluation - * has been cancelled due to an aborting error, an interrupt, or an - * exception. - */ - if (!aborting()) - EMSG2(_(e_invexpr2), p); - ret = FAIL; - break; - } - - if (!eap->skip) - { - p = get_tv_string(&rettv); - len = (int)STRLEN(p); - if (ga_grow(&ga, len + 2) == FAIL) - { - clear_tv(&rettv); - ret = FAIL; - break; - } - if (ga.ga_len) - ((char_u *)(ga.ga_data))[ga.ga_len++] = ' '; - STRCPY((char_u *)(ga.ga_data) + ga.ga_len, p); - ga.ga_len += len; - } - - clear_tv(&rettv); - arg = skipwhite(arg); - } - - if (ret != FAIL && ga.ga_data != NULL) - { - if (eap->cmdidx == CMD_echomsg) - { - MSG_ATTR(ga.ga_data, echo_attr); - out_flush(); - } - else if (eap->cmdidx == CMD_echoerr) - { - /* We don't want to abort following commands, restore did_emsg. */ - save_did_emsg = did_emsg; - EMSG((char_u *)ga.ga_data); - if (!force_abort) - did_emsg = save_did_emsg; - } - else if (eap->cmdidx == CMD_execute) - do_cmdline((char_u *)ga.ga_data, - eap->getline, eap->cookie, DOCMD_NOWAIT|DOCMD_VERBOSE); - } - - ga_clear(&ga); - - if (eap->skip) - --emsg_skip; - - eap->nextcmd = check_nextcmd(arg); -} - -/* - * Skip over the name of an option: "&option", "&g:option" or "&l:option". - * "arg" points to the "&" or '+' when called, to "option" when returning. - * Returns NULL when no option name found. Otherwise pointer to the char - * after the option name. - */ - static char_u * -find_option_end(arg, opt_flags) - char_u **arg; - int *opt_flags; -{ - char_u *p = *arg; - - ++p; - if (*p == 'g' && p[1] == ':') - { - *opt_flags = OPT_GLOBAL; - p += 2; - } - else if (*p == 'l' && p[1] == ':') - { - *opt_flags = OPT_LOCAL; - p += 2; - } - else - *opt_flags = 0; - - if (!ASCII_ISALPHA(*p)) - return NULL; - *arg = p; - - if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) - p += 4; /* termcap option */ - else - while (ASCII_ISALPHA(*p)) - ++p; - return p; -} - -/* - * ":function" - */ - void -ex_function(eap) - exarg_T *eap; -{ - char_u *theline; - int i; - int j; - int c; - int saved_did_emsg; - int saved_wait_return = need_wait_return; - char_u *name = NULL; - char_u *p; - char_u *arg; - char_u *line_arg = NULL; - garray_T newargs; - garray_T newlines; - int varargs = FALSE; - int mustend = FALSE; - int flags = 0; - ufunc_T *fp; - int indent; - int nesting; - char_u *skip_until = NULL; - dictitem_T *v; - funcdict_T fudi; - static int func_nr = 0; /* number for nameless function */ - int paren; - hashtab_T *ht; - int todo; - hashitem_T *hi; - int sourcing_lnum_off; - - /* - * ":function" without argument: list functions. - */ - if (ends_excmd(*eap->arg)) - { - if (!eap->skip) - { - todo = (int)func_hashtab.ht_used; - for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - fp = HI2UF(hi); - if (!isdigit(*fp->uf_name)) - list_func_head(fp, FALSE); - } - } - } - eap->nextcmd = check_nextcmd(eap->arg); - return; - } - - /* - * ":function /pat": list functions matching pattern. - */ - if (*eap->arg == '/') - { - p = skip_regexp(eap->arg + 1, '/', TRUE, NULL); - if (!eap->skip) - { - regmatch_T regmatch; - - c = *p; - *p = NUL; - regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); - *p = c; - if (regmatch.regprog != NULL) - { - regmatch.rm_ic = p_ic; - - todo = (int)func_hashtab.ht_used; - for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - fp = HI2UF(hi); - if (!isdigit(*fp->uf_name) - && vim_regexec(®match, fp->uf_name, 0)) - list_func_head(fp, FALSE); - } - } - vim_regfree(regmatch.regprog); - } - } - if (*p == '/') - ++p; - eap->nextcmd = check_nextcmd(p); - return; - } - - /* - * Get the function name. There are these situations: - * func normal function name - * "name" == func, "fudi.fd_dict" == NULL - * dict.func new dictionary entry - * "name" == NULL, "fudi.fd_dict" set, - * "fudi.fd_di" == NULL, "fudi.fd_newkey" == func - * dict.func existing dict entry with a Funcref - * "name" == func, "fudi.fd_dict" set, - * "fudi.fd_di" set, "fudi.fd_newkey" == NULL - * dict.func existing dict entry that's not a Funcref - * "name" == NULL, "fudi.fd_dict" set, - * "fudi.fd_di" set, "fudi.fd_newkey" == NULL - * s:func script-local function name - * g:func global function name, same as "func" - */ - p = eap->arg; - name = trans_function_name(&p, eap->skip, 0, &fudi); - paren = (vim_strchr(p, '(') != NULL); - if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip) - { - /* - * Return on an invalid expression in braces, unless the expression - * evaluation has been cancelled due to an aborting error, an - * interrupt, or an exception. - */ - if (!aborting()) - { - if (!eap->skip && fudi.fd_newkey != NULL) - EMSG2(_(e_dictkey), fudi.fd_newkey); - vim_free(fudi.fd_newkey); - return; - } - else - eap->skip = TRUE; - } - - /* An error in a function call during evaluation of an expression in magic - * braces should not cause the function not to be defined. */ - saved_did_emsg = did_emsg; - did_emsg = FALSE; - - /* - * ":function func" with only function name: list function. - */ - if (!paren) - { - if (!ends_excmd(*skipwhite(p))) - { - EMSG(_(e_trailing)); - goto ret_free; - } - eap->nextcmd = check_nextcmd(p); - if (eap->nextcmd != NULL) - *p = NUL; - if (!eap->skip && !got_int) - { - fp = find_func(name); - if (fp != NULL) - { - list_func_head(fp, TRUE); - for (j = 0; j < fp->uf_lines.ga_len && !got_int; ++j) - { - if (FUNCLINE(fp, j) == NULL) - continue; - msg_putchar('\n'); - msg_outnum((long)(j + 1)); - if (j < 9) - msg_putchar(' '); - if (j < 99) - msg_putchar(' '); - msg_prt_line(FUNCLINE(fp, j), FALSE); - out_flush(); /* show a line at a time */ - ui_breakcheck(); - } - if (!got_int) - { - msg_putchar('\n'); - msg_puts((char_u *)" endfunction"); - } - } - else - emsg_funcname(N_("E123: Undefined function: %s"), name); - } - goto ret_free; - } - - /* - * ":function name(arg1, arg2)" Define function. - */ - p = skipwhite(p); - if (*p != '(') - { - if (!eap->skip) - { - EMSG2(_("E124: Missing '(': %s"), eap->arg); - goto ret_free; - } - /* attempt to continue by skipping some text */ - if (vim_strchr(p, '(') != NULL) - p = vim_strchr(p, '('); - } - p = skipwhite(p + 1); - - ga_init2(&newargs, (int)sizeof(char_u *), 3); - ga_init2(&newlines, (int)sizeof(char_u *), 3); - - if (!eap->skip) - { - /* Check the name of the function. Unless it's a dictionary function - * (that we are overwriting). */ - if (name != NULL) - arg = name; - else - arg = fudi.fd_newkey; - if (arg != NULL && (fudi.fd_di == NULL - || fudi.fd_di->di_tv.v_type != VAR_FUNC)) - { - if (*arg == K_SPECIAL) - j = 3; - else - j = 0; - while (arg[j] != NUL && (j == 0 ? eval_isnamec1(arg[j]) - : eval_isnamec(arg[j]))) - ++j; - if (arg[j] != NUL) - emsg_funcname((char *)e_invarg2, arg); - } - /* Disallow using the g: dict. */ - if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) - EMSG(_("E862: Cannot use g: here")); - } - - /* - * Isolate the arguments: "arg1, arg2, ...)" - */ - while (*p != ')') - { - if (p[0] == '.' && p[1] == '.' && p[2] == '.') - { - varargs = TRUE; - p += 3; - mustend = TRUE; - } - else - { - arg = p; - while (ASCII_ISALNUM(*p) || *p == '_') - ++p; - if (arg == p || isdigit(*arg) - || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0) - || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) - { - if (!eap->skip) - EMSG2(_("E125: Illegal argument: %s"), arg); - break; - } - if (ga_grow(&newargs, 1) == FAIL) - goto erret; - c = *p; - *p = NUL; - arg = vim_strsave(arg); - if (arg == NULL) - goto erret; - - /* Check for duplicate argument name. */ - for (i = 0; i < newargs.ga_len; ++i) - if (STRCMP(((char_u **)(newargs.ga_data))[i], arg) == 0) - { - EMSG2(_("E853: Duplicate argument name: %s"), arg); - vim_free(arg); - goto erret; - } - - ((char_u **)(newargs.ga_data))[newargs.ga_len] = arg; - *p = c; - newargs.ga_len++; - if (*p == ',') - ++p; - else - mustend = TRUE; - } - p = skipwhite(p); - if (mustend && *p != ')') - { - if (!eap->skip) - EMSG2(_(e_invarg2), eap->arg); - break; - } - } - ++p; /* skip the ')' */ - - /* find extra arguments "range", "dict" and "abort" */ - for (;;) - { - p = skipwhite(p); - if (STRNCMP(p, "range", 5) == 0) - { - flags |= FC_RANGE; - p += 5; - } - else if (STRNCMP(p, "dict", 4) == 0) - { - flags |= FC_DICT; - p += 4; - } - else if (STRNCMP(p, "abort", 5) == 0) - { - flags |= FC_ABORT; - p += 5; - } - else - break; - } - - /* When there is a line break use what follows for the function body. - * Makes 'exe "func Test()\n...\nendfunc"' work. */ - if (*p == '\n') - line_arg = p + 1; - else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) - EMSG(_(e_trailing)); - - /* - * Read the body of the function, until ":endfunction" is found. - */ - if (KeyTyped) - { - /* Check if the function already exists, don't let the user type the - * whole function before telling him it doesn't work! For a script we - * need to skip the body to be able to find what follows. */ - if (!eap->skip && !eap->forceit) - { - if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) - EMSG(_(e_funcdict)); - else if (name != NULL && find_func(name) != NULL) - emsg_funcname(e_funcexts, name); - } - - if (!eap->skip && did_emsg) - goto erret; - - msg_putchar('\n'); /* don't overwrite the function name */ - cmdline_row = msg_row; - } - - indent = 2; - nesting = 0; - for (;;) - { - if (KeyTyped) - { - msg_scroll = TRUE; - saved_wait_return = FALSE; - } - need_wait_return = FALSE; - sourcing_lnum_off = sourcing_lnum; - - if (line_arg != NULL) - { - /* Use eap->arg, split up in parts by line breaks. */ - theline = line_arg; - p = vim_strchr(theline, '\n'); - if (p == NULL) - line_arg += STRLEN(line_arg); - else - { - *p = NUL; - line_arg = p + 1; - } - } - else if (eap->getline == NULL) - theline = getcmdline(':', 0L, indent); - else - theline = eap->getline(':', eap->cookie, indent); - if (KeyTyped) - lines_left = Rows - 1; - if (theline == NULL) - { - EMSG(_("E126: Missing :endfunction")); - goto erret; - } - - /* Detect line continuation: sourcing_lnum increased more than one. */ - if (sourcing_lnum > sourcing_lnum_off + 1) - sourcing_lnum_off = sourcing_lnum - sourcing_lnum_off - 1; - else - sourcing_lnum_off = 0; - - if (skip_until != NULL) - { - /* between ":append" and "." and between ":python <<EOF" and "EOF" - * don't check for ":endfunc". */ - if (STRCMP(theline, skip_until) == 0) - { - vim_free(skip_until); - skip_until = NULL; - } - } - else - { - /* skip ':' and blanks*/ - for (p = theline; vim_iswhite(*p) || *p == ':'; ++p) - ; - - /* Check for "endfunction". */ - if (checkforcmd(&p, "endfunction", 4) && nesting-- == 0) - { - if (line_arg == NULL) - vim_free(theline); - break; - } - - /* Increase indent inside "if", "while", "for" and "try", decrease - * at "end". */ - if (indent > 2 && STRNCMP(p, "end", 3) == 0) - indent -= 2; - else if (STRNCMP(p, "if", 2) == 0 - || STRNCMP(p, "wh", 2) == 0 - || STRNCMP(p, "for", 3) == 0 - || STRNCMP(p, "try", 3) == 0) - indent += 2; - - /* Check for defining a function inside this function. */ - if (checkforcmd(&p, "function", 2)) - { - if (*p == '!') - p = skipwhite(p + 1); - p += eval_fname_script(p); - if (ASCII_ISALPHA(*p)) - { - vim_free(trans_function_name(&p, TRUE, 0, NULL)); - if (*skipwhite(p) == '(') - { - ++nesting; - indent += 2; - } - } - } - - /* Check for ":append" or ":insert". */ - p = skip_range(p, NULL); - if ((p[0] == 'a' && (!ASCII_ISALPHA(p[1]) || p[1] == 'p')) - || (p[0] == 'i' - && (!ASCII_ISALPHA(p[1]) || (p[1] == 'n' - && (!ASCII_ISALPHA(p[2]) || (p[2] == 's')))))) - skip_until = vim_strsave((char_u *)"."); - - /* Check for ":python <<EOF", ":tcl <<EOF", etc. */ - arg = skipwhite(skiptowhite(p)); - if (arg[0] == '<' && arg[1] =='<' - && ((p[0] == 'p' && p[1] == 'y' - && (!ASCII_ISALPHA(p[2]) || p[2] == 't')) - || (p[0] == 'p' && p[1] == 'e' - && (!ASCII_ISALPHA(p[2]) || p[2] == 'r')) - || (p[0] == 't' && p[1] == 'c' - && (!ASCII_ISALPHA(p[2]) || p[2] == 'l')) - || (p[0] == 'l' && p[1] == 'u' && p[2] == 'a' - && !ASCII_ISALPHA(p[3])) - || (p[0] == 'r' && p[1] == 'u' && p[2] == 'b' - && (!ASCII_ISALPHA(p[3]) || p[3] == 'y')) - || (p[0] == 'm' && p[1] == 'z' - && (!ASCII_ISALPHA(p[2]) || p[2] == 's')) - )) - { - /* ":python <<" continues until a dot, like ":append" */ - p = skipwhite(arg + 2); - if (*p == NUL) - skip_until = vim_strsave((char_u *)"."); - else - skip_until = vim_strsave(p); - } - } - - /* Add the line to the function. */ - if (ga_grow(&newlines, 1 + sourcing_lnum_off) == FAIL) - { - if (line_arg == NULL) - vim_free(theline); - goto erret; - } - - /* Copy the line to newly allocated memory. get_one_sourceline() - * allocates 250 bytes per line, this saves 80% on average. The cost - * is an extra alloc/free. */ - p = vim_strsave(theline); - if (p != NULL) - { - if (line_arg == NULL) - vim_free(theline); - theline = p; - } - - ((char_u **)(newlines.ga_data))[newlines.ga_len++] = theline; - - /* Add NULL lines for continuation lines, so that the line count is - * equal to the index in the growarray. */ - while (sourcing_lnum_off-- > 0) - ((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL; - - /* Check for end of eap->arg. */ - if (line_arg != NULL && *line_arg == NUL) - line_arg = NULL; - } - - /* Don't define the function when skipping commands or when an error was - * detected. */ - if (eap->skip || did_emsg) - goto erret; - - /* - * If there are no errors, add the function - */ - if (fudi.fd_dict == NULL) - { - v = find_var(name, &ht, FALSE); - if (v != NULL && v->di_tv.v_type == VAR_FUNC) - { - emsg_funcname(N_("E707: Function name conflicts with variable: %s"), - name); - goto erret; - } - - fp = find_func(name); - if (fp != NULL) - { - if (!eap->forceit) - { - emsg_funcname(e_funcexts, name); - goto erret; - } - if (fp->uf_calls > 0) - { - emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"), - name); - goto erret; - } - /* redefine existing function */ - ga_clear_strings(&(fp->uf_args)); - ga_clear_strings(&(fp->uf_lines)); - vim_free(name); - name = NULL; - } - } - else - { - char numbuf[20]; - - fp = NULL; - if (fudi.fd_newkey == NULL && !eap->forceit) - { - EMSG(_(e_funcdict)); - goto erret; - } - if (fudi.fd_di == NULL) - { - /* Can't add a function to a locked dictionary */ - if (tv_check_lock(fudi.fd_dict->dv_lock, eap->arg)) - goto erret; - } - /* Can't change an existing function if it is locked */ - else if (tv_check_lock(fudi.fd_di->di_tv.v_lock, eap->arg)) - goto erret; - - /* Give the function a sequential number. Can only be used with a - * Funcref! */ - vim_free(name); - sprintf(numbuf, "%d", ++func_nr); - name = vim_strsave((char_u *)numbuf); - if (name == NULL) - goto erret; - } - - if (fp == NULL) +/* + * Handle expr[expr], expr[expr:expr] subscript and .name lookup. + * Also handle function call with Funcref variable: func(expr) + * Can all be combined: dict.func(expr)[idx]['func'](expr) + */ + int +handle_subscript( + char_u **arg, + typval_T *rettv, + int evaluate, /* do more than finding the end */ + int verbose) /* give error messages */ +{ + int ret = OK; + dict_T *selfdict = NULL; + char_u *s; + int len; + typval_T functv; + + while (ret == OK + && (**arg == '[' + || (**arg == '.' && rettv->v_type == VAR_DICT) + || (**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC + || rettv->v_type == VAR_PARTIAL))) + && !VIM_ISWHITE(*(*arg - 1))) { - if (fudi.fd_dict == NULL && vim_strchr(name, AUTOLOAD_CHAR) != NULL) + if (**arg == '(') { - int slen, plen; - char_u *scriptname; + partial_T *pt = NULL; - /* Check that the autoload name matches the script name. */ - j = FAIL; - if (sourcing_name != NULL) + /* need to copy the funcref so that we can clear rettv */ + if (evaluate) { - scriptname = autoload_name(name); - if (scriptname != NULL) + functv = *rettv; + rettv->v_type = VAR_UNKNOWN; + + /* Invoke the function. Recursive! */ + if (functv.v_type == VAR_PARTIAL) { - p = vim_strchr(scriptname, '/'); - plen = (int)STRLEN(p); - slen = (int)STRLEN(sourcing_name); - if (slen > plen && fnamecmp(p, - sourcing_name + slen - plen) == 0) - j = OK; - vim_free(scriptname); + pt = functv.vval.v_partial; + s = partial_name(pt); } + else + s = functv.vval.v_string; } - if (j == FAIL) + else + s = (char_u *)""; + ret = get_func_tv(s, (int)STRLEN(s), rettv, arg, + curwin->w_cursor.lnum, curwin->w_cursor.lnum, + &len, evaluate, pt, selfdict); + + /* Clear the funcref afterwards, so that deleting it while + * evaluating the arguments is possible (see test55). */ + if (evaluate) + clear_tv(&functv); + + /* Stop the expression evaluation when immediately aborting on + * error, or when an interrupt occurred or an exception was thrown + * but not caught. */ + if (aborting()) { - EMSG2(_("E746: Function name does not match script file name: %s"), name); - goto erret; + if (ret == OK) + clear_tv(rettv); + ret = FAIL; } + dict_unref(selfdict); + selfdict = NULL; } - - fp = (ufunc_T *)alloc((unsigned)(sizeof(ufunc_T) + STRLEN(name))); - if (fp == NULL) - goto erret; - - if (fudi.fd_dict != NULL) + else /* **arg == '[' || **arg == '.' */ { - if (fudi.fd_di == NULL) + dict_unref(selfdict); + if (rettv->v_type == VAR_DICT) { - /* add new dict entry */ - fudi.fd_di = dictitem_alloc(fudi.fd_newkey); - if (fudi.fd_di == NULL) - { - vim_free(fp); - goto erret; - } - if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) - { - vim_free(fudi.fd_di); - vim_free(fp); - goto erret; - } + selfdict = rettv->vval.v_dict; + if (selfdict != NULL) + ++selfdict->dv_refcount; } else - /* overwrite existing dict entry */ - clear_tv(&fudi.fd_di->di_tv); - fudi.fd_di->di_tv.v_type = VAR_FUNC; - fudi.fd_di->di_tv.v_lock = 0; - fudi.fd_di->di_tv.vval.v_string = vim_strsave(name); - fp->uf_refcount = 1; - - /* behave like "dict" was used */ - flags |= FC_DICT; + selfdict = NULL; + if (eval_index(arg, rettv, evaluate, verbose) == FAIL) + { + clear_tv(rettv); + ret = FAIL; + } } - - /* insert the new function in the function list */ - STRCPY(fp->uf_name, name); - hash_add(&func_hashtab, UF2HIKEY(fp)); } - fp->uf_args = newargs; - fp->uf_lines = newlines; -#ifdef FEAT_PROFILE - fp->uf_tml_count = NULL; - fp->uf_tml_total = NULL; - fp->uf_tml_self = NULL; - fp->uf_profiling = FALSE; - if (prof_def_func()) - func_do_profile(fp); -#endif - fp->uf_varargs = varargs; - fp->uf_flags = flags; - fp->uf_calls = 0; - fp->uf_script_ID = current_SID; - goto ret_free; - -erret: - ga_clear_strings(&newargs); - ga_clear_strings(&newlines); -ret_free: - vim_free(skip_until); - vim_free(fudi.fd_newkey); - vim_free(name); - did_emsg |= saved_did_emsg; - need_wait_return |= saved_wait_return; + + /* Turn "dict.Func" into a partial for "Func" bound to "dict". + * Don't do this when "Func" is already a partial that was bound + * explicitly (pt_auto is FALSE). */ + if (selfdict != NULL + && (rettv->v_type == VAR_FUNC + || (rettv->v_type == VAR_PARTIAL + && (rettv->vval.v_partial->pt_auto + || rettv->vval.v_partial->pt_dict == NULL)))) + selfdict = make_partial(selfdict, rettv); + + dict_unref(selfdict); + return ret; } /* - * Get a function name, translating "<SID>" and "<SNR>". - * Also handles a Funcref in a List or Dictionary. - * Returns the function name in allocated memory, or NULL for failure. - * flags: - * TFN_INT: internal function name OK - * TFN_QUIET: be quiet - * TFN_NO_AUTOLOAD: do not use script autoloading - * Advances "pp" to just after the function name (if no error). + * Allocate memory for a variable type-value, and make it empty (0 or NULL + * value). */ - static char_u * -trans_function_name(pp, skip, flags, fdp) - char_u **pp; - int skip; /* only find the end, don't evaluate */ - int flags; - funcdict_T *fdp; /* return: info about dictionary used */ + typval_T * +alloc_tv(void) { - char_u *name = NULL; - char_u *start; - char_u *end; - int lead; - char_u sid_buf[20]; - int len; - lval_T lv; + return (typval_T *)alloc_clear((unsigned)sizeof(typval_T)); +} - if (fdp != NULL) - vim_memset(fdp, 0, sizeof(funcdict_T)); - start = *pp; +/* + * Allocate memory for a variable type-value, and assign a string to it. + * The string "s" must have been allocated, it is consumed. + * Return NULL for out of memory, the variable otherwise. + */ + static typval_T * +alloc_string_tv(char_u *s) +{ + typval_T *rettv; - /* Check for hard coded <SNR>: already translated function ID (from a user - * command). */ - if ((*pp)[0] == K_SPECIAL && (*pp)[1] == KS_EXTRA - && (*pp)[2] == (int)KE_SNR) + rettv = alloc_tv(); + if (rettv != NULL) { - *pp += 3; - len = get_id_len(pp) + 3; - return vim_strnsave(start, len); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = s; } + else + vim_free(s); + return rettv; +} - /* A name starting with "<SID>" or "<SNR>" is local to a script. But - * don't skip over "s:", get_lval() needs it for "s:dict.func". */ - lead = eval_fname_script(start); - if (lead > 2) - start += lead; - - /* Note that TFN_ flags use the same values as GLV_ flags. */ - end = get_lval(start, NULL, &lv, FALSE, skip, flags, - lead > 2 ? 0 : FNE_CHECK_START); - if (end == start) - { - if (!skip) - EMSG(_("E129: Function name required")); - goto theend; - } - if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range))) +/* + * Free the memory for a variable type-value. + */ + void +free_tv(typval_T *varp) +{ + if (varp != NULL) { - /* - * Report an invalid expression in braces, unless the expression - * evaluation has been cancelled due to an aborting error, an - * interrupt, or an exception. - */ - if (!aborting()) + switch (varp->v_type) { - if (end != NULL) - EMSG2(_(e_invarg2), start); + case VAR_FUNC: + func_unref(varp->vval.v_string); + /* FALLTHROUGH */ + case VAR_STRING: + vim_free(varp->vval.v_string); + break; + case VAR_PARTIAL: + partial_unref(varp->vval.v_partial); + break; + case VAR_LIST: + list_unref(varp->vval.v_list); + break; + case VAR_DICT: + dict_unref(varp->vval.v_dict); + break; + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + job_unref(varp->vval.v_job); + break; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + channel_unref(varp->vval.v_channel); + break; +#endif + case VAR_NUMBER: + case VAR_FLOAT: + case VAR_UNKNOWN: + case VAR_SPECIAL: + break; } - else - *pp = find_name_end(start, NULL, NULL, FNE_INCL_BR); - goto theend; + vim_free(varp); } +} - if (lv.ll_tv != NULL) +/* + * Free the memory for a variable value and set the value to NULL or 0. + */ + void +clear_tv(typval_T *varp) +{ + if (varp != NULL) { - if (fdp != NULL) - { - fdp->fd_dict = lv.ll_dict; - fdp->fd_newkey = lv.ll_newkey; - lv.ll_newkey = NULL; - fdp->fd_di = lv.ll_di; - } - if (lv.ll_tv->v_type == VAR_FUNC && lv.ll_tv->vval.v_string != NULL) - { - name = vim_strsave(lv.ll_tv->vval.v_string); - *pp = end; - } - else + switch (varp->v_type) { - if (!skip && !(flags & TFN_QUIET) && (fdp == NULL - || lv.ll_dict == NULL || fdp->fd_newkey == NULL)) - EMSG(_(e_funcref)); - else - *pp = end; - name = NULL; + case VAR_FUNC: + func_unref(varp->vval.v_string); + /* FALLTHROUGH */ + case VAR_STRING: + VIM_CLEAR(varp->vval.v_string); + break; + case VAR_PARTIAL: + partial_unref(varp->vval.v_partial); + varp->vval.v_partial = NULL; + break; + case VAR_LIST: + list_unref(varp->vval.v_list); + varp->vval.v_list = NULL; + break; + case VAR_DICT: + dict_unref(varp->vval.v_dict); + varp->vval.v_dict = NULL; + break; + case VAR_NUMBER: + case VAR_SPECIAL: + varp->vval.v_number = 0; + break; + case VAR_FLOAT: +#ifdef FEAT_FLOAT + varp->vval.v_float = 0.0; + break; +#endif + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + job_unref(varp->vval.v_job); + varp->vval.v_job = NULL; +#endif + break; + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + channel_unref(varp->vval.v_channel); + varp->vval.v_channel = NULL; +#endif + case VAR_UNKNOWN: + break; } - goto theend; + varp->v_lock = 0; } +} - if (lv.ll_name == NULL) - { - /* Error found, but continue after the function name. */ - *pp = end; - goto theend; - } +/* + * Set the value of a variable to NULL without freeing items. + */ + void +init_tv(typval_T *varp) +{ + if (varp != NULL) + vim_memset(varp, 0, sizeof(typval_T)); +} - /* Check if the name is a Funcref. If so, use the value. */ - if (lv.ll_exp_name != NULL) - { - len = (int)STRLEN(lv.ll_exp_name); - name = deref_func_name(lv.ll_exp_name, &len, flags & TFN_NO_AUTOLOAD); - if (name == lv.ll_exp_name) - name = NULL; - } - else - { - len = (int)(end - *pp); - name = deref_func_name(*pp, &len, flags & TFN_NO_AUTOLOAD); - if (name == *pp) - name = NULL; - } - if (name != NULL) - { - name = vim_strsave(name); - *pp = end; - if (STRNCMP(name, "<SNR>", 5) == 0) - { - /* Change "<SNR>" to the byte sequence. */ - name[0] = K_SPECIAL; - name[1] = KS_EXTRA; - name[2] = (int)KE_SNR; - mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1); - } - goto theend; - } +/* + * Get the number value of a variable. + * If it is a String variable, uses vim_str2nr(). + * For incompatible types, return 0. + * get_tv_number_chk() is similar to get_tv_number(), but informs the + * caller of incompatible types: it sets *denote to TRUE if "denote" + * is not NULL or returns -1 otherwise. + */ + varnumber_T +get_tv_number(typval_T *varp) +{ + int error = FALSE; - if (lv.ll_exp_name != NULL) - { - len = (int)STRLEN(lv.ll_exp_name); - if (lead <= 2 && lv.ll_name == lv.ll_exp_name - && STRNCMP(lv.ll_name, "s:", 2) == 0) - { - /* When there was "s:" already or the name expanded to get a - * leading "s:" then remove it. */ - lv.ll_name += 2; - len -= 2; - lead = 2; - } - } - else - { - /* skip over "s:" and "g:" */ - if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':')) - lv.ll_name += 2; - len = (int)(end - lv.ll_name); - } + return get_tv_number_chk(varp, &error); /* return 0L on error */ +} - /* - * Copy the function name to allocated memory. - * Accept <SID>name() inside a script, translate into <SNR>123_name(). - * Accept <SNR>123_name() outside a script. - */ - if (skip) - lead = 0; /* do nothing */ - else if (lead > 0) - { - lead = 3; - if ((lv.ll_exp_name != NULL && eval_fname_sid(lv.ll_exp_name)) - || eval_fname_sid(*pp)) - { - /* It's "s:" or "<SID>" */ - if (current_SID <= 0) - { - EMSG(_(e_usingsid)); - goto theend; - } - sprintf((char *)sid_buf, "%ld_", (long)current_SID); - lead += (int)STRLEN(sid_buf); - } - } - else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) - { - EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"), - start); - goto theend; - } - if (!skip && !(flags & TFN_QUIET)) - { - char_u *cp = vim_strchr(lv.ll_name, ':'); + varnumber_T +get_tv_number_chk(typval_T *varp, int *denote) +{ + varnumber_T n = 0L; - if (cp != NULL && cp < end) - { - EMSG2(_("E884: Function name cannot contain a colon: %s"), start); - goto theend; - } + switch (varp->v_type) + { + case VAR_NUMBER: + return varp->vval.v_number; + case VAR_FLOAT: +#ifdef FEAT_FLOAT + EMSG(_("E805: Using a Float as a Number")); + break; +#endif + case VAR_FUNC: + case VAR_PARTIAL: + EMSG(_("E703: Using a Funcref as a Number")); + break; + case VAR_STRING: + if (varp->vval.v_string != NULL) + vim_str2nr(varp->vval.v_string, NULL, NULL, + STR2NR_ALL, &n, NULL, 0); + return n; + case VAR_LIST: + EMSG(_("E745: Using a List as a Number")); + break; + case VAR_DICT: + EMSG(_("E728: Using a Dictionary as a Number")); + break; + case VAR_SPECIAL: + return varp->vval.v_number == VVAL_TRUE ? 1 : 0; + break; + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + EMSG(_("E910: Using a Job as a Number")); + break; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + EMSG(_("E913: Using a Channel as a Number")); + break; +#endif + case VAR_UNKNOWN: + internal_error("get_tv_number(UNKNOWN)"); + break; } + if (denote == NULL) /* useful for values that must be unsigned */ + n = -1; + else + *denote = TRUE; + return n; +} - name = alloc((unsigned)(len + lead + 1)); - if (name != NULL) +#ifdef FEAT_FLOAT + float_T +get_tv_float(typval_T *varp) +{ + switch (varp->v_type) { - if (lead > 0) - { - name[0] = K_SPECIAL; - name[1] = KS_EXTRA; - name[2] = (int)KE_SNR; - if (lead > 3) /* If it's "<SID>" */ - STRCPY(name + 3, sid_buf); - } - mch_memmove(name + lead, lv.ll_name, (size_t)len); - name[lead + len] = NUL; + case VAR_NUMBER: + return (float_T)(varp->vval.v_number); + case VAR_FLOAT: + return varp->vval.v_float; + case VAR_FUNC: + case VAR_PARTIAL: + EMSG(_("E891: Using a Funcref as a Float")); + break; + case VAR_STRING: + EMSG(_("E892: Using a String as a Float")); + break; + case VAR_LIST: + EMSG(_("E893: Using a List as a Float")); + break; + case VAR_DICT: + EMSG(_("E894: Using a Dictionary as a Float")); + break; + case VAR_SPECIAL: + EMSG(_("E907: Using a special value as a Float")); + break; + case VAR_JOB: +# ifdef FEAT_JOB_CHANNEL + EMSG(_("E911: Using a Job as a Float")); + break; +# endif + case VAR_CHANNEL: +# ifdef FEAT_JOB_CHANNEL + EMSG(_("E914: Using a Channel as a Float")); + break; +# endif + case VAR_UNKNOWN: + internal_error("get_tv_float(UNKNOWN)"); + break; } - *pp = end; - -theend: - clear_lval(&lv); - return name; + return 0; } +#endif /* - * Return 5 if "p" starts with "<SID>" or "<SNR>" (ignoring case). - * Return 2 if "p" starts with "s:". - * Return 0 otherwise. + * Get the string value of a variable. + * If it is a Number variable, the number is converted into a string. + * get_tv_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! + * get_tv_string_buf() uses a given buffer. + * If the String variable has never been set, return an empty string. + * Never returns NULL; + * get_tv_string_chk() and get_tv_string_buf_chk() are similar, but return + * NULL on error. */ - static int -eval_fname_script(p) - char_u *p; + char_u * +get_tv_string(typval_T *varp) { - if (p[0] == '<' && (STRNICMP(p + 1, "SID>", 4) == 0 - || STRNICMP(p + 1, "SNR>", 4) == 0)) - return 5; - if (p[0] == 's' && p[1] == ':') - return 2; - return 0; + static char_u mybuf[NUMBUFLEN]; + + return get_tv_string_buf(varp, mybuf); } -/* - * Return TRUE if "p" starts with "<SID>" or "s:". - * Only works if eval_fname_script() returned non-zero for "p"! - */ - static int -eval_fname_sid(p) - char_u *p; + char_u * +get_tv_string_buf(typval_T *varp, char_u *buf) { - return (*p == 's' || TOUPPER_ASC(p[2]) == 'I'); + char_u *res = get_tv_string_buf_chk(varp, buf); + + return res != NULL ? res : (char_u *)""; } /* - * List the head of the function: "name(arg1, arg2)". + * Careful: This uses a single, static buffer. YOU CAN ONLY USE IT ONCE! */ - static void -list_func_head(fp, indent) - ufunc_T *fp; - int indent; + char_u * +get_tv_string_chk(typval_T *varp) { - int j; + static char_u mybuf[NUMBUFLEN]; - msg_start(); - if (indent) - MSG_PUTS(" "); - MSG_PUTS("function "); - if (fp->uf_name[0] == K_SPECIAL) - { - MSG_PUTS_ATTR("<SNR>", hl_attr(HLF_8)); - msg_puts(fp->uf_name + 3); - } - else - msg_puts(fp->uf_name); - msg_putchar('('); - for (j = 0; j < fp->uf_args.ga_len; ++j) - { - if (j) - MSG_PUTS(", "); - msg_puts(FUNCARG(fp, j)); - } - if (fp->uf_varargs) + return get_tv_string_buf_chk(varp, mybuf); +} + + char_u * +get_tv_string_buf_chk(typval_T *varp, char_u *buf) +{ + switch (varp->v_type) { - if (j) - MSG_PUTS(", "); - MSG_PUTS("..."); + case VAR_NUMBER: + vim_snprintf((char *)buf, NUMBUFLEN, "%lld", + (long long)varp->vval.v_number); + return buf; + case VAR_FUNC: + case VAR_PARTIAL: + EMSG(_("E729: using Funcref as a String")); + break; + case VAR_LIST: + EMSG(_("E730: using List as a String")); + break; + case VAR_DICT: + EMSG(_("E731: using Dictionary as a String")); + break; + case VAR_FLOAT: +#ifdef FEAT_FLOAT + EMSG(_(e_float_as_string)); + break; +#endif + case VAR_STRING: + if (varp->vval.v_string != NULL) + return varp->vval.v_string; + return (char_u *)""; + case VAR_SPECIAL: + STRCPY(buf, get_var_special_name(varp->vval.v_number)); + return buf; + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + { + job_T *job = varp->vval.v_job; + char *status; + + if (job == NULL) + return (char_u *)"no process"; + status = job->jv_status == JOB_FAILED ? "fail" + : job->jv_status >= JOB_ENDED ? "dead" + : "run"; +# ifdef UNIX + vim_snprintf((char *)buf, NUMBUFLEN, + "process %ld %s", (long)job->jv_pid, status); +# elif defined(WIN32) + vim_snprintf((char *)buf, NUMBUFLEN, + "process %ld %s", + (long)job->jv_proc_info.dwProcessId, + status); +# else + /* fall-back */ + vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status); +# endif + return buf; + } +#endif + break; + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + { + channel_T *channel = varp->vval.v_channel; + char *status = channel_status(channel, -1); + + if (channel == NULL) + vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status); + else + vim_snprintf((char *)buf, NUMBUFLEN, + "channel %d %s", channel->ch_id, status); + return buf; + } +#endif + break; + case VAR_UNKNOWN: + EMSG(_("E908: using an invalid value as a String")); + break; } - msg_putchar(')'); - if (fp->uf_flags & FC_ABORT) - MSG_PUTS(" abort"); - if (fp->uf_flags & FC_RANGE) - MSG_PUTS(" range"); - if (fp->uf_flags & FC_DICT) - MSG_PUTS(" dict"); - msg_clr_eos(); - if (p_verbose > 0) - last_set_msg(fp->uf_script_ID); + return NULL; } /* - * Find a function by name, return pointer to it in ufuncs. - * Return NULL for unknown function. + * Find variable "name" in the list of variables. + * Return a pointer to it if found, NULL if not found. + * Careful: "a:0" variables don't have a name. + * When "htp" is not NULL we are writing to the variable, set "htp" to the + * hashtab_T used. */ - static ufunc_T * -find_func(name) - char_u *name; + dictitem_T * +find_var(char_u *name, hashtab_T **htp, int no_autoload) { - hashitem_T *hi; + char_u *varname; + hashtab_T *ht; + dictitem_T *ret = NULL; - hi = hash_find(&func_hashtab, name); - if (!HASHITEM_EMPTY(hi)) - return HI2UF(hi); - return NULL; + ht = find_var_ht(name, &varname); + if (htp != NULL) + *htp = ht; + if (ht == NULL) + return NULL; + ret = find_var_in_ht(ht, *name, varname, no_autoload || htp != NULL); + if (ret != NULL) + return ret; + + /* Search in parent scope for lambda */ + return find_var_in_scoped_ht(name, no_autoload || htp != NULL); } -#if defined(EXITFREE) || defined(PROTO) - void -free_all_functions() +/* + * Find variable "varname" in hashtab "ht" with name "htname". + * Returns NULL if not found. + */ + dictitem_T * +find_var_in_ht( + hashtab_T *ht, + int htname, + char_u *varname, + int no_autoload) { hashitem_T *hi; - /* Need to start all over every time, because func_free() may change the - * hash table. */ - while (func_hashtab.ht_used > 0) - for (hi = func_hashtab.ht_array; ; ++hi) - if (!HASHITEM_EMPTY(hi)) - { - func_free(HI2UF(hi)); - break; - } -} -#endif + if (*varname == NUL) + { + /* Must be something like "s:", otherwise "ht" would be NULL. */ + switch (htname) + { + case 's': return &SCRIPT_SV(current_SID)->sv_var; + case 'g': return &globvars_var; + case 'v': return &vimvars_var; + case 'b': return &curbuf->b_bufvar; + case 'w': return &curwin->w_winvar; + case 't': return &curtab->tp_winvar; + case 'l': return get_funccal_local_var(); + case 'a': return get_funccal_args_var(); + } + return NULL; + } - int -translated_function_exists(name) - char_u *name; -{ - if (builtin_function(name, -1)) - return find_internal_func(name) >= 0; - return find_func(name) != NULL; + hi = hash_find(ht, varname); + if (HASHITEM_EMPTY(hi)) + { + /* For global variables we may try auto-loading the script. If it + * worked find the variable again. Don't auto-load a script if it was + * loaded already, otherwise it would be loaded every time when + * checking if a function name is a Funcref variable. */ + if (ht == &globvarht && !no_autoload) + { + /* Note: script_autoload() may make "hi" invalid. It must either + * be obtained again or not used. */ + if (!script_autoload(varname, FALSE) || aborting()) + return NULL; + hi = hash_find(ht, varname); + } + if (HASHITEM_EMPTY(hi)) + return NULL; + } + return HI2DI(hi); } /* - * Return TRUE if a function "name" exists. + * Find the hashtab used for a variable name. + * Return NULL if the name is not valid. + * Set "varname" to the start of name without ':'. */ - static int -function_exists(name) - char_u *name; + hashtab_T * +find_var_ht(char_u *name, char_u **varname) { - char_u *nm = name; - char_u *p; - int n = FALSE; + hashitem_T *hi; + hashtab_T *ht; - p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET|TFN_NO_AUTOLOAD, - NULL); - nm = skipwhite(nm); + if (name[0] == NUL) + return NULL; + if (name[1] != ':') + { + /* The name must not start with a colon or #. */ + if (name[0] == ':' || name[0] == AUTOLOAD_CHAR) + return NULL; + *varname = name; - /* Only accept "funcname", "funcname ", "funcname (..." and - * "funcname(...", not "funcname!...". */ - if (p != NULL && (*nm == NUL || *nm == '(')) - n = translated_function_exists(p); - vim_free(p); - return n; + /* "version" is "v:version" in all scopes */ + hi = hash_find(&compat_hashtab, name); + if (!HASHITEM_EMPTY(hi)) + return &compat_hashtab; + + ht = get_funccal_local_ht(); + if (ht == NULL) + return &globvarht; /* global variable */ + return ht; /* local variable */ + } + *varname = name + 2; + if (*name == 'g') /* global variable */ + return &globvarht; + /* There must be no ':' or '#' in the rest of the name, unless g: is used + */ + if (vim_strchr(name + 2, ':') != NULL + || vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL) + return NULL; + if (*name == 'b') /* buffer variable */ + return &curbuf->b_vars->dv_hashtab; + if (*name == 'w') /* window variable */ + return &curwin->w_vars->dv_hashtab; + if (*name == 't') /* tab page variable */ + return &curtab->tp_vars->dv_hashtab; + if (*name == 'v') /* v: variable */ + return &vimvarht; + if (*name == 'a') /* a: function argument */ + return get_funccal_args_ht(); + if (*name == 'l') /* l: local function variable */ + return get_funccal_local_ht(); + if (*name == 's' /* script variable */ + && current_SID > 0 && current_SID <= ga_scripts.ga_len) + return &SCRIPT_VARS(current_SID); + return NULL; } +/* + * Get the string value of a (global/local) variable. + * Note: see get_tv_string() for how long the pointer remains valid. + * Returns NULL when it doesn't exist. + */ char_u * -get_expanded_name(name, check) - char_u *name; - int check; +get_var_value(char_u *name) { - char_u *nm = name; - char_u *p; + dictitem_T *v; + + v = find_var(name, NULL, FALSE); + if (v == NULL) + return NULL; + return get_tv_string(&v->di_tv); +} - p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL); +/* + * Allocate a new hashtab for a sourced script. It will be used while + * sourcing this script and when executing functions defined in the script. + */ + void +new_script_vars(scid_T id) +{ + int i; + hashtab_T *ht; + scriptvar_T *sv; - if (p != NULL && *nm == NUL) - if (!check || translated_function_exists(p)) - return p; + if (ga_grow(&ga_scripts, (int)(id - ga_scripts.ga_len)) == OK) + { + /* Re-allocating ga_data means that an ht_array pointing to + * ht_smallarray becomes invalid. We can recognize this: ht_mask is + * at its init value. Also reset "v_dict", it's always the same. */ + for (i = 1; i <= ga_scripts.ga_len; ++i) + { + ht = &SCRIPT_VARS(i); + if (ht->ht_mask == HT_INIT_SIZE - 1) + ht->ht_array = ht->ht_smallarray; + sv = SCRIPT_SV(i); + sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict; + } - vim_free(p); - return NULL; + while (ga_scripts.ga_len < id) + { + sv = SCRIPT_SV(ga_scripts.ga_len + 1) = + (scriptvar_T *)alloc_clear(sizeof(scriptvar_T)); + init_var_dict(&sv->sv_dict, &sv->sv_var, VAR_SCOPE); + ++ga_scripts.ga_len; + } + } } /* - * Return TRUE if "name" looks like a builtin function name: starts with a - * lower case letter and doesn't contain AUTOLOAD_CHAR. - * "len" is the length of "name", or -1 for NUL terminated. + * Initialize dictionary "dict" as a scope and set variable "dict_var" to + * point to it. */ - static int -builtin_function(name, len) - char_u *name; - int len; + void +init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope) { - char_u *p; - - if (!ASCII_ISLOWER(name[0])) - return FALSE; - p = vim_strchr(name, AUTOLOAD_CHAR); - return p == NULL || (len > 0 && p > name + len); + hash_init(&dict->dv_hashtab); + dict->dv_lock = 0; + dict->dv_scope = scope; + dict->dv_refcount = DO_NOT_FREE_CNT; + dict->dv_copyID = 0; + dict_var->di_tv.vval.v_dict = dict; + dict_var->di_tv.v_type = VAR_DICT; + dict_var->di_tv.v_lock = VAR_FIXED; + dict_var->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; + dict_var->di_key[0] = NUL; } -#if defined(FEAT_PROFILE) || defined(PROTO) /* - * Start profiling function "fp". + * Unreference a dictionary initialized by init_var_dict(). */ - static void -func_do_profile(fp) - ufunc_T *fp; + void +unref_var_dict(dict_T *dict) { - int len = fp->uf_lines.ga_len; + /* Now the dict needs to be freed if no one else is using it, go back to + * normal reference counting. */ + dict->dv_refcount -= DO_NOT_FREE_CNT - 1; + dict_unref(dict); +} - if (len == 0) - len = 1; /* avoid getting error for allocating zero bytes */ - fp->uf_tm_count = 0; - profile_zero(&fp->uf_tm_self); - profile_zero(&fp->uf_tm_total); - if (fp->uf_tml_count == NULL) - fp->uf_tml_count = (int *)alloc_clear((unsigned) (sizeof(int) * len)); - if (fp->uf_tml_total == NULL) - fp->uf_tml_total = (proftime_T *)alloc_clear((unsigned) - (sizeof(proftime_T) * len)); - if (fp->uf_tml_self == NULL) - fp->uf_tml_self = (proftime_T *)alloc_clear((unsigned) - (sizeof(proftime_T) * len)); - fp->uf_tml_idx = -1; - if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL - || fp->uf_tml_self == NULL) - return; /* out of memory */ - - fp->uf_profiling = TRUE; +/* + * Clean up a list of internal variables. + * Frees all allocated variables and the value they contain. + * Clears hashtab "ht", does not free it. + */ + void +vars_clear(hashtab_T *ht) +{ + vars_clear_ext(ht, TRUE); } /* - * Dump the profiling results for all functions in file "fd". + * Like vars_clear(), but only free the value if "free_val" is TRUE. */ void -func_dump_profile(fd) - FILE *fd; +vars_clear_ext(hashtab_T *ht, int free_val) { - hashitem_T *hi; int todo; - ufunc_T *fp; - int i; - ufunc_T **sorttab; - int st_len = 0; - - todo = (int)func_hashtab.ht_used; - if (todo == 0) - return; /* nothing to dump */ - - sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); + hashitem_T *hi; + dictitem_T *v; - for (hi = func_hashtab.ht_array; todo > 0; ++hi) + hash_lock(ht); + todo = (int)ht->ht_used; + for (hi = ht->ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) { --todo; - fp = HI2UF(hi); - if (fp->uf_profiling) - { - if (sorttab != NULL) - sorttab[st_len++] = fp; - - if (fp->uf_name[0] == K_SPECIAL) - fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3); - else - fprintf(fd, "FUNCTION %s()\n", fp->uf_name); - if (fp->uf_tm_count == 1) - fprintf(fd, "Called 1 time\n"); - else - fprintf(fd, "Called %d times\n", fp->uf_tm_count); - fprintf(fd, "Total time: %s\n", profile_msg(&fp->uf_tm_total)); - fprintf(fd, " Self time: %s\n", profile_msg(&fp->uf_tm_self)); - fprintf(fd, "\n"); - fprintf(fd, "count total (s) self (s)\n"); - for (i = 0; i < fp->uf_lines.ga_len; ++i) - { - if (FUNCLINE(fp, i) == NULL) - continue; - prof_func_line(fd, fp->uf_tml_count[i], - &fp->uf_tml_total[i], &fp->uf_tml_self[i], TRUE); - fprintf(fd, "%s\n", FUNCLINE(fp, i)); - } - fprintf(fd, "\n"); - } + /* Free the variable. Don't remove it from the hashtab, + * ht_array might change then. hash_clear() takes care of it + * later. */ + v = HI2DI(hi); + if (free_val) + clear_tv(&v->di_tv); + if (v->di_flags & DI_FLAGS_ALLOC) + vim_free(v); } } - - if (sorttab != NULL && st_len > 0) - { - qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *), - prof_total_cmp); - prof_sort_list(fd, sorttab, st_len, "TOTAL", FALSE); - qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *), - prof_self_cmp); - prof_sort_list(fd, sorttab, st_len, "SELF", TRUE); - } - - vim_free(sorttab); + hash_clear(ht); + ht->ht_used = 0; } +/* + * Delete a variable from hashtab "ht" at item "hi". + * Clear the variable value and free the dictitem. + */ static void -prof_sort_list(fd, sorttab, st_len, title, prefer_self) - FILE *fd; - ufunc_T **sorttab; - int st_len; - char *title; - int prefer_self; /* when equal print only self time */ +delete_var(hashtab_T *ht, hashitem_T *hi) { - int i; - ufunc_T *fp; + dictitem_T *di = HI2DI(hi); - fprintf(fd, "FUNCTIONS SORTED ON %s TIME\n", title); - fprintf(fd, "count total (s) self (s) function\n"); - for (i = 0; i < 20 && i < st_len; ++i) - { - fp = sorttab[i]; - prof_func_line(fd, fp->uf_tm_count, &fp->uf_tm_total, &fp->uf_tm_self, - prefer_self); - if (fp->uf_name[0] == K_SPECIAL) - fprintf(fd, " <SNR>%s()\n", fp->uf_name + 3); - else - fprintf(fd, " %s()\n", fp->uf_name); - } - fprintf(fd, "\n"); + hash_remove(ht, hi); + clear_tv(&di->di_tv); + vim_free(di); } /* - * Print the count and times for one function or function line. + * List the value of one internal variable. */ static void -prof_func_line(fd, count, total, self, prefer_self) - FILE *fd; - int count; - proftime_T *total; - proftime_T *self; - int prefer_self; /* when equal print only self time */ +list_one_var(dictitem_T *v, char_u *prefix, int *first) +{ + char_u *tofree; + char_u *s; + char_u numbuf[NUMBUFLEN]; + + s = echo_string(&v->di_tv, &tofree, numbuf, get_copyID()); + list_one_var_a(prefix, v->di_key, v->di_tv.v_type, + s == NULL ? (char_u *)"" : s, first); + vim_free(tofree); +} + + static void +list_one_var_a( + char_u *prefix, + char_u *name, + int type, + char_u *string, + int *first) /* when TRUE clear rest of screen and set to FALSE */ { - if (count > 0) + /* don't use msg() or msg_attr() to avoid overwriting "v:statusmsg" */ + msg_start(); + msg_puts(prefix); + if (name != NULL) /* "a:" vars don't have a name stored */ + msg_puts(name); + msg_putchar(' '); + msg_advance(22); + if (type == VAR_NUMBER) + msg_putchar('#'); + else if (type == VAR_FUNC || type == VAR_PARTIAL) + msg_putchar('*'); + else if (type == VAR_LIST) { - fprintf(fd, "%5d ", count); - if (prefer_self && profile_equal(total, self)) - fprintf(fd, " "); - else - fprintf(fd, "%s ", profile_msg(total)); - if (!prefer_self && profile_equal(total, self)) - fprintf(fd, " "); - else - fprintf(fd, "%s ", profile_msg(self)); + msg_putchar('['); + if (*string == '[') + ++string; + } + else if (type == VAR_DICT) + { + msg_putchar('{'); + if (*string == '{') + ++string; } else - fprintf(fd, " "); -} + msg_putchar(' '); -/* - * Compare function for total time sorting. - */ - static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -prof_total_cmp(s1, s2) - const void *s1; - const void *s2; -{ - ufunc_T *p1, *p2; + msg_outtrans(string); - p1 = *(ufunc_T **)s1; - p2 = *(ufunc_T **)s2; - return profile_cmp(&p1->uf_tm_total, &p2->uf_tm_total); + if (type == VAR_FUNC || type == VAR_PARTIAL) + msg_puts((char_u *)"()"); + if (*first) + { + msg_clr_eos(); + *first = FALSE; + } } /* - * Compare function for self time sorting. + * Set variable "name" to value in "tv". + * If the variable already exists, the value is updated. + * Otherwise the variable is created. */ - static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -prof_self_cmp(s1, s2) - const void *s1; - const void *s2; + void +set_var( + char_u *name, + typval_T *tv, + int copy) /* make copy of value in "tv" */ { - ufunc_T *p1, *p2; + dictitem_T *v; + char_u *varname; + hashtab_T *ht; - p1 = *(ufunc_T **)s1; - p2 = *(ufunc_T **)s2; - return profile_cmp(&p1->uf_tm_self, &p2->uf_tm_self); -} + ht = find_var_ht(name, &varname); + if (ht == NULL || *varname == NUL) + { + EMSG2(_(e_illvar), name); + return; + } + v = find_var_in_ht(ht, 0, varname, TRUE); -#endif + /* Search in parent scope which is possible to reference from lambda */ + if (v == NULL) + v = find_var_in_scoped_ht(name, TRUE); -/* - * If "name" has a package name try autoloading the script for it. - * Return TRUE if a package was loaded. - */ - static int -script_autoload(name, reload) - char_u *name; - int reload; /* load script again when already loaded */ -{ - char_u *p; - char_u *scriptname, *tofree; - int ret = FALSE; - int i; + if ((tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL) + && var_check_func_name(name, v == NULL)) + return; - /* If there is no '#' after name[0] there is no package name. */ - p = vim_strchr(name, AUTOLOAD_CHAR); - if (p == NULL || p == name) - return FALSE; + if (v != NULL) + { + /* existing variable, need to clear the value */ + if (var_check_ro(v->di_flags, name, FALSE) + || tv_check_lock(v->di_tv.v_lock, name, FALSE)) + return; - tofree = scriptname = autoload_name(name); + /* + * Handle setting internal v: variables separately where needed to + * prevent changing the type. + */ + if (ht == &vimvarht) + { + if (v->di_tv.v_type == VAR_STRING) + { + vim_free(v->di_tv.vval.v_string); + if (copy || tv->v_type != VAR_STRING) + v->di_tv.vval.v_string = vim_strsave(get_tv_string(tv)); + else + { + /* Take over the string to avoid an extra alloc/free. */ + v->di_tv.vval.v_string = tv->vval.v_string; + tv->vval.v_string = NULL; + } + return; + } + else if (v->di_tv.v_type == VAR_NUMBER) + { + v->di_tv.vval.v_number = get_tv_number(tv); + if (STRCMP(varname, "searchforward") == 0) + set_search_direction(v->di_tv.vval.v_number ? '/' : '?'); +#ifdef FEAT_SEARCH_EXTRA + else if (STRCMP(varname, "hlsearch") == 0) + { + no_hlsearch = !v->di_tv.vval.v_number; + redraw_all_later(SOME_VALID); + } +#endif + return; + } + else if (v->di_tv.v_type != tv->v_type) + internal_error("set_var()"); + } - /* Find the name in the list of previously loaded package names. Skip - * "autoload/", it's always the same. */ - for (i = 0; i < ga_loaded.ga_len; ++i) - if (STRCMP(((char_u **)ga_loaded.ga_data)[i] + 9, scriptname + 9) == 0) - break; - if (!reload && i < ga_loaded.ga_len) - ret = FALSE; /* was loaded already */ - else + clear_tv(&v->di_tv); + } + else /* add a new variable */ { - /* Remember the name if it wasn't loaded already. */ - if (i == ga_loaded.ga_len && ga_grow(&ga_loaded, 1) == OK) + /* Can't add "v:" variable. */ + if (ht == &vimvarht) { - ((char_u **)ga_loaded.ga_data)[ga_loaded.ga_len++] = scriptname; - tofree = NULL; + EMSG2(_(e_illvar), name); + return; } - /* Try loading the package from $VIMRUNTIME/autoload/<name>.vim */ - if (source_runtime(scriptname, FALSE) == OK) - ret = TRUE; + /* Make sure the variable name is valid. */ + if (!valid_varname(varname)) + return; + + v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + + STRLEN(varname))); + if (v == NULL) + return; + STRCPY(v->di_key, varname); + if (hash_add(ht, DI2HIKEY(v)) == FAIL) + { + vim_free(v); + return; + } + v->di_flags = DI_FLAGS_ALLOC; + } + + if (copy || tv->v_type == VAR_NUMBER || tv->v_type == VAR_FLOAT) + copy_tv(tv, &v->di_tv); + else + { + v->di_tv = *tv; + v->di_tv.v_lock = 0; + init_tv(tv); + } +} + +/* + * Return TRUE if di_flags "flags" indicates variable "name" is read-only. + * Also give an error message. + */ + int +var_check_ro(int flags, char_u *name, int use_gettext) +{ + if (flags & DI_FLAGS_RO) + { + EMSG2(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); + return TRUE; } - - vim_free(tofree); - return ret; + if ((flags & DI_FLAGS_RO_SBX) && sandbox) + { + EMSG2(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name); + return TRUE; + } + return FALSE; } /* - * Return the autoload script name for a function or variable name. - * Returns NULL when out of memory. + * Return TRUE if di_flags "flags" indicates variable "name" is fixed. + * Also give an error message. */ - static char_u * -autoload_name(name) - char_u *name; + int +var_check_fixed(int flags, char_u *name, int use_gettext) { - char_u *p; - char_u *scriptname; - - /* Get the script file name: replace '#' with '/', append ".vim". */ - scriptname = alloc((unsigned)(STRLEN(name) + 14)); - if (scriptname == NULL) - return FALSE; - STRCPY(scriptname, "autoload/"); - STRCAT(scriptname, name); - *vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL; - STRCAT(scriptname, ".vim"); - while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL) - *p = '/'; - return scriptname; + if (flags & DI_FLAGS_FIX) + { + EMSG2(_("E795: Cannot delete variable %s"), + use_gettext ? (char_u *)_(name) : name); + return TRUE; + } + return FALSE; } -#if defined(FEAT_CMDL_COMPL) || defined(PROTO) - /* - * Function given to ExpandGeneric() to obtain the list of user defined - * function names. + * Check if a funcref is assigned to a valid variable name. + * Return TRUE and give an error if not. */ - char_u * -get_user_func_name(xp, idx) - expand_T *xp; - int idx; + int +var_check_func_name( + char_u *name, /* points to start of variable name */ + int new_var) /* TRUE when creating the variable */ { - static long_u done; - static hashitem_T *hi; - ufunc_T *fp; - - if (idx == 0) + /* Allow for w: b: s: and t:. */ + if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') + && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') + ? name[2] : name[0])) { - done = 0; - hi = func_hashtab.ht_array; + EMSG2(_("E704: Funcref variable name must start with a capital: %s"), + name); + return TRUE; } - if (done < func_hashtab.ht_used) + /* Don't allow hiding a function. When "v" is not NULL we might be + * assigning another function to the same var, the type is checked + * below. */ + if (new_var && function_exists(name, FALSE)) { - if (done++ > 0) - ++hi; - while (HASHITEM_EMPTY(hi)) - ++hi; - fp = HI2UF(hi); - - if (fp->uf_flags & FC_DICT) - return (char_u *)""; /* don't show dict functions */ + EMSG2(_("E705: Variable name conflicts with existing function: %s"), + name); + return TRUE; + } + return FALSE; +} - if (STRLEN(fp->uf_name) + 4 >= IOSIZE) - return fp->uf_name; /* prevents overflow */ +/* + * Check if a variable name is valid. + * Return FALSE and give an error if not. + */ + int +valid_varname(char_u *varname) +{ + char_u *p; - cat_func_name(IObuff, fp); - if (xp->xp_context != EXPAND_USER_FUNC) + for (p = varname; *p != NUL; ++p) + if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) + && *p != AUTOLOAD_CHAR) { - STRCAT(IObuff, "("); - if (!fp->uf_varargs && fp->uf_args.ga_len == 0) - STRCAT(IObuff, ")"); + EMSG2(_(e_illvar), varname); + return FALSE; } - return IObuff; - } - return NULL; + return TRUE; } -#endif /* FEAT_CMDL_COMPL */ - /* - * Copy the function name of "fp" to buffer "buf". - * "buf" must be able to hold the function name plus three bytes. - * Takes care of script-local function names. + * Return TRUE if typeval "tv" is set to be locked (immutable). + * Also give an error message, using "name" or _("name") when use_gettext is + * TRUE. */ - static void -cat_func_name(buf, fp) - char_u *buf; - ufunc_T *fp; + int +tv_check_lock(int lock, char_u *name, int use_gettext) { - if (fp->uf_name[0] == K_SPECIAL) + if (lock & VAR_LOCKED) { - STRCPY(buf, "<SNR>"); - STRCAT(buf, fp->uf_name + 3); + EMSG2(_("E741: Value is locked: %s"), + name == NULL ? (char_u *)_("Unknown") + : use_gettext ? (char_u *)_(name) + : name); + return TRUE; } - else - STRCPY(buf, fp->uf_name); + if (lock & VAR_FIXED) + { + EMSG2(_("E742: Cannot change value of %s"), + name == NULL ? (char_u *)_("Unknown") + : use_gettext ? (char_u *)_(name) + : name); + return TRUE; + } + return FALSE; } /* - * ":delfunction {name}" + * Copy the values from typval_T "from" to typval_T "to". + * When needed allocates string or increases reference count. + * Does not make a copy of a list or dict but copies the reference! + * It is OK for "from" and "to" to point to the same item. This is used to + * make a copy later. */ void -ex_delfunction(eap) - exarg_T *eap; +copy_tv(typval_T *from, typval_T *to) { - ufunc_T *fp = NULL; - char_u *p; - char_u *name; - funcdict_T fudi; + to->v_type = from->v_type; + to->v_lock = 0; + switch (from->v_type) + { + case VAR_NUMBER: + case VAR_SPECIAL: + to->vval.v_number = from->vval.v_number; + break; + case VAR_FLOAT: +#ifdef FEAT_FLOAT + to->vval.v_float = from->vval.v_float; + break; +#endif + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + to->vval.v_job = from->vval.v_job; + if (to->vval.v_job != NULL) + ++to->vval.v_job->jv_refcount; + break; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + to->vval.v_channel = from->vval.v_channel; + if (to->vval.v_channel != NULL) + ++to->vval.v_channel->ch_refcount; + break; +#endif + case VAR_STRING: + case VAR_FUNC: + if (from->vval.v_string == NULL) + to->vval.v_string = NULL; + else + { + to->vval.v_string = vim_strsave(from->vval.v_string); + if (from->v_type == VAR_FUNC) + func_ref(to->vval.v_string); + } + break; + case VAR_PARTIAL: + if (from->vval.v_partial == NULL) + to->vval.v_partial = NULL; + else + { + to->vval.v_partial = from->vval.v_partial; + ++to->vval.v_partial->pt_refcount; + } + break; + case VAR_LIST: + if (from->vval.v_list == NULL) + to->vval.v_list = NULL; + else + { + to->vval.v_list = from->vval.v_list; + ++to->vval.v_list->lv_refcount; + } + break; + case VAR_DICT: + if (from->vval.v_dict == NULL) + to->vval.v_dict = NULL; + else + { + to->vval.v_dict = from->vval.v_dict; + ++to->vval.v_dict->dv_refcount; + } + break; + case VAR_UNKNOWN: + internal_error("copy_tv(UNKNOWN)"); + break; + } +} - p = eap->arg; - name = trans_function_name(&p, eap->skip, 0, &fudi); - vim_free(fudi.fd_newkey); - if (name == NULL) +/* + * Make a copy of an item. + * Lists and Dictionaries are also copied. A deep copy if "deep" is set. + * For deepcopy() "copyID" is zero for a full copy or the ID for when a + * reference to an already copied list/dict can be used. + * Returns FAIL or OK. + */ + int +item_copy( + typval_T *from, + typval_T *to, + int deep, + int copyID) +{ + static int recurse = 0; + int ret = OK; + + if (recurse >= DICT_MAXNEST) { - if (fudi.fd_dict != NULL && !eap->skip) - EMSG(_(e_funcref)); - return; + EMSG(_("E698: variable nested too deep for making a copy")); + return FAIL; } - if (!ends_excmd(*skipwhite(p))) + ++recurse; + + switch (from->v_type) { - vim_free(name); - EMSG(_(e_trailing)); - return; + case VAR_NUMBER: + case VAR_FLOAT: + case VAR_STRING: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + copy_tv(from, to); + break; + case VAR_LIST: + to->v_type = VAR_LIST; + to->v_lock = 0; + if (from->vval.v_list == NULL) + to->vval.v_list = NULL; + else if (copyID != 0 && from->vval.v_list->lv_copyID == copyID) + { + /* use the copy made earlier */ + to->vval.v_list = from->vval.v_list->lv_copylist; + ++to->vval.v_list->lv_refcount; + } + else + to->vval.v_list = list_copy(from->vval.v_list, deep, copyID); + if (to->vval.v_list == NULL) + ret = FAIL; + break; + case VAR_DICT: + to->v_type = VAR_DICT; + to->v_lock = 0; + if (from->vval.v_dict == NULL) + to->vval.v_dict = NULL; + else if (copyID != 0 && from->vval.v_dict->dv_copyID == copyID) + { + /* use the copy made earlier */ + to->vval.v_dict = from->vval.v_dict->dv_copydict; + ++to->vval.v_dict->dv_refcount; + } + else + to->vval.v_dict = dict_copy(from->vval.v_dict, deep, copyID); + if (to->vval.v_dict == NULL) + ret = FAIL; + break; + case VAR_UNKNOWN: + internal_error("item_copy(UNKNOWN)"); + ret = FAIL; } - eap->nextcmd = check_nextcmd(p); - if (eap->nextcmd != NULL) - *p = NUL; + --recurse; + return ret; +} + +/* + * This function is used by f_input() and f_inputdialog() functions. The third + * argument to f_input() specifies the type of completion to use at the + * prompt. The third argument to f_inputdialog() specifies the value to return + * when the user cancels the prompt. + */ + void +get_user_input( + typval_T *argvars, + typval_T *rettv, + int inputdialog, + int secret) +{ + char_u *prompt = get_tv_string_chk(&argvars[0]); + char_u *p = NULL; + int c; + char_u buf[NUMBUFLEN]; + int cmd_silent_save = cmd_silent; + char_u *defstr = (char_u *)""; + int xp_type = EXPAND_NOTHING; + char_u *xp_arg = NULL; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; - if (!eap->skip) - fp = find_func(name); - vim_free(name); +#ifdef NO_CONSOLE_INPUT + /* While starting up, there is no place to enter text. When running tests + * with --not-a-term we assume feedkeys() will be used. */ + if (no_console_input() && !is_not_a_term()) + return; +#endif - if (!eap->skip) + cmd_silent = FALSE; /* Want to see the prompt. */ + if (prompt != NULL) { - if (fp == NULL) - { - EMSG2(_(e_nofunc), eap->arg); - return; - } - if (fp->uf_calls > 0) + /* Only the part of the message after the last NL is considered as + * prompt for the command line */ + p = vim_strrchr(prompt, '\n'); + if (p == NULL) + p = prompt; + else { - EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg); - return; + ++p; + c = *p; + *p = NUL; + msg_start(); + msg_clr_eos(); + msg_puts_attr(prompt, echo_attr); + msg_didout = FALSE; + msg_starthere(); + *p = c; } + cmdline_row = msg_row; - if (fudi.fd_dict != NULL) + if (argvars[1].v_type != VAR_UNKNOWN) { - /* Delete the dict item that refers to the function, it will - * invoke func_unref() and possibly delete the function. */ - dictitem_remove(fudi.fd_dict, fudi.fd_di); - } - else - func_free(fp); - } -} + defstr = get_tv_string_buf_chk(&argvars[1], buf); + if (defstr != NULL) + stuffReadbuffSpec(defstr); -/* - * Free a function and remove it from the list of functions. - */ - static void -func_free(fp) - ufunc_T *fp; -{ - hashitem_T *hi; + if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN) + { + char_u *xp_name; + int xp_namelen; + long argt; - /* clear this function */ - ga_clear_strings(&(fp->uf_args)); - ga_clear_strings(&(fp->uf_lines)); -#ifdef FEAT_PROFILE - vim_free(fp->uf_tml_count); - vim_free(fp->uf_tml_total); - vim_free(fp->uf_tml_self); -#endif + /* input() with a third argument: completion */ + rettv->vval.v_string = NULL; - /* remove the function from the function hashtable */ - hi = hash_find(&func_hashtab, UF2HIKEY(fp)); - if (HASHITEM_EMPTY(hi)) - EMSG2(_(e_intern2), "func_free()"); - else - hash_remove(&func_hashtab, hi); + xp_name = get_tv_string_buf_chk(&argvars[2], buf); + if (xp_name == NULL) + return; - vim_free(fp); -} + xp_namelen = (int)STRLEN(xp_name); -/* - * Unreference a Function: decrement the reference count and free it when it - * becomes zero. Only for numbered functions. - */ - void -func_unref(name) - char_u *name; -{ - ufunc_T *fp; + if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt, + &xp_arg) == FAIL) + return; + } + } - if (name != NULL && isdigit(*name)) - { - fp = find_func(name); - if (fp == NULL) - EMSG2(_(e_intern2), "func_unref()"); - else if (--fp->uf_refcount <= 0) + if (defstr != NULL) { - /* Only delete it when it's not being used. Otherwise it's done - * when "uf_calls" becomes zero. */ - if (fp->uf_calls == 0) - func_free(fp); + int save_ex_normal_busy = ex_normal_busy; + ex_normal_busy = 0; + rettv->vval.v_string = + getcmdline_prompt(secret ? NUL : '@', p, echo_attr, + xp_type, xp_arg); + ex_normal_busy = save_ex_normal_busy; } - } -} + if (inputdialog && rettv->vval.v_string == NULL + && argvars[1].v_type != VAR_UNKNOWN + && argvars[2].v_type != VAR_UNKNOWN) + rettv->vval.v_string = vim_strsave(get_tv_string_buf( + &argvars[2], buf)); -/* - * Count a reference to a Function. - */ - void -func_ref(name) - char_u *name; -{ - ufunc_T *fp; + vim_free(xp_arg); - if (name != NULL && isdigit(*name)) - { - fp = find_func(name); - if (fp == NULL) - EMSG2(_(e_intern2), "func_ref()"); - else - ++fp->uf_refcount; + /* since the user typed this, no need to wait for return */ + need_wait_return = FALSE; + msg_didout = FALSE; } + cmd_silent = cmd_silent_save; } /* - * Call a user function. + * ":echo expr1 ..." print each argument separated with a space, add a + * newline at the end. + * ":echon expr1 ..." print each argument plain. */ - static void -call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict) - ufunc_T *fp; /* pointer to function */ - int argcount; /* nr of args */ - typval_T *argvars; /* arguments */ - typval_T *rettv; /* return value */ - linenr_T firstline; /* first line of range */ - linenr_T lastline; /* last line of range */ - dict_T *selfdict; /* Dictionary for "self" */ + void +ex_echo(exarg_T *eap) { - char_u *save_sourcing_name; - linenr_T save_sourcing_lnum; - scid_T save_current_SID; - funccall_T *fc; - int save_did_emsg; - static int depth = 0; - dictitem_T *v; - int fixvar_idx = 0; /* index in fixvar[] */ - int i; - int ai; + char_u *arg = eap->arg; + typval_T rettv; + char_u *tofree; + char_u *p; + int needclr = TRUE; + int atstart = TRUE; char_u numbuf[NUMBUFLEN]; - char_u *name; -#ifdef FEAT_PROFILE - proftime_T wait_start; - proftime_T call_start; -#endif - - /* If depth of calling is getting too high, don't execute the function */ - if (depth >= p_mfd) - { - EMSG(_("E132: Function call depth is higher than 'maxfuncdepth'")); - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = -1; - return; - } - ++depth; - - line_breakcheck(); /* check for CTRL-C hit */ - - fc = (funccall_T *)alloc(sizeof(funccall_T)); - fc->caller = current_funccal; - current_funccal = fc; - fc->func = fp; - fc->rettv = rettv; - rettv->vval.v_number = 0; - fc->linenr = 0; - fc->returned = FALSE; - fc->level = ex_nesting_level; - /* Check if this function has a breakpoint. */ - fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); - fc->dbg_tick = debug_tick; - - /* - * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables - * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free - * each argument variable and saves a lot of time. - */ - /* - * Init l: variables. - */ - init_var_dict(&fc->l_vars, &fc->l_vars_var, VAR_DEF_SCOPE); - if (selfdict != NULL) - { - /* Set l:self to "selfdict". Use "name" to avoid a warning from - * some compiler that checks the destination size. */ - v = &fc->fixvar[fixvar_idx++].var; - name = v->di_key; - STRCPY(name, "self"); - v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; - hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); - v->di_tv.v_type = VAR_DICT; - v->di_tv.v_lock = 0; - v->di_tv.vval.v_dict = selfdict; - ++selfdict->dv_refcount; - } - /* - * Init a: variables. - * Set a:0 to "argcount". - * Set a:000 to a list with room for the "..." arguments. - */ - init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); - add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", - (varnumber_T)(argcount - fp->uf_args.ga_len)); - /* Use "name" to avoid a warning from some compiler that checks the - * destination size. */ - v = &fc->fixvar[fixvar_idx++].var; - name = v->di_key; - STRCPY(name, "000"); - v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; - hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); - v->di_tv.v_type = VAR_LIST; - v->di_tv.v_lock = VAR_FIXED; - v->di_tv.vval.v_list = &fc->l_varlist; - vim_memset(&fc->l_varlist, 0, sizeof(list_T)); - fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; - fc->l_varlist.lv_lock = VAR_FIXED; - - /* - * Set a:firstline to "firstline" and a:lastline to "lastline". - * Set a:name to named arguments. - * Set a:N to the "..." arguments. - */ - add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", - (varnumber_T)firstline); - add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", - (varnumber_T)lastline); - for (i = 0; i < argcount; ++i) + if (eap->skip) + ++emsg_skip; + while (*arg != NUL && *arg != '|' && *arg != '\n' && !got_int) { - ai = i - fp->uf_args.ga_len; - if (ai < 0) - /* named argument a:name */ - name = FUNCARG(fp, i); - else - { - /* "..." argument a:1, a:2, etc. */ - sprintf((char *)numbuf, "%d", ai + 1); - name = numbuf; - } - if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN) - { - v = &fc->fixvar[fixvar_idx++].var; - v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; - } - else - { - v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) - + STRLEN(name))); - if (v == NULL) - break; - v->di_flags = DI_FLAGS_RO; - } - STRCPY(v->di_key, name); - hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); - - /* Note: the values are copied directly to avoid alloc/free. - * "argvars" must have VAR_FIXED for v_lock. */ - v->di_tv = argvars[i]; - v->di_tv.v_lock = VAR_FIXED; + /* If eval1() causes an error message the text from the command may + * still need to be cleared. E.g., "echo 22,44". */ + need_clr_eos = needclr; - if (ai >= 0 && ai < MAX_FUNC_ARGS) + p = arg; + if (eval1(&arg, &rettv, !eap->skip) == FAIL) { - list_append(&fc->l_varlist, &fc->l_listitems[ai]); - fc->l_listitems[ai].li_tv = argvars[i]; - fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED; + /* + * Report the invalid expression unless the expression evaluation + * has been cancelled due to an aborting error, an interrupt, or an + * exception. + */ + if (!aborting()) + EMSG2(_(e_invexpr2), p); + need_clr_eos = FALSE; + break; } - } - - /* Don't redraw while executing the function. */ - ++RedrawingDisabled; - save_sourcing_name = sourcing_name; - save_sourcing_lnum = sourcing_lnum; - sourcing_lnum = 1; - sourcing_name = alloc((unsigned)((save_sourcing_name == NULL ? 0 - : STRLEN(save_sourcing_name)) + STRLEN(fp->uf_name) + 13)); - if (sourcing_name != NULL) - { - if (save_sourcing_name != NULL - && STRNCMP(save_sourcing_name, "function ", 9) == 0) - sprintf((char *)sourcing_name, "%s..", save_sourcing_name); - else - STRCPY(sourcing_name, "function "); - cat_func_name(sourcing_name + STRLEN(sourcing_name), fp); + need_clr_eos = FALSE; - if (p_verbose >= 12) + if (!eap->skip) { - ++no_wait_return; - verbose_enter_scroll(); - - smsg((char_u *)_("calling %s"), sourcing_name); - if (p_verbose >= 14) + if (atstart) { - char_u buf[MSG_BUF_LEN]; - char_u numbuf2[NUMBUFLEN]; - char_u *tofree; - char_u *s; - - msg_puts((char_u *)"("); - for (i = 0; i < argcount; ++i) + atstart = FALSE; + /* Call msg_start() after eval1(), evaluating the expression + * may cause a message to appear. */ + if (eap->cmdidx == CMD_echo) + { + /* Mark the saved text as finishing the line, so that what + * follows is displayed on a new line when scrolling back + * at the more prompt. */ + msg_sb_eol(); + msg_start(); + } + } + else if (eap->cmdidx == CMD_echo) + msg_puts_attr((char_u *)" ", echo_attr); + p = echo_string(&rettv, &tofree, numbuf, get_copyID()); + if (p != NULL) + for ( ; *p != NUL && !got_int; ++p) { - if (i > 0) - msg_puts((char_u *)", "); - if (argvars[i].v_type == VAR_NUMBER) - msg_outnum((long)argvars[i].vval.v_number); + if (*p == '\n' || *p == '\r' || *p == TAB) + { + if (*p != TAB && needclr) + { + /* remove any text still there from the command */ + msg_clr_eos(); + needclr = FALSE; + } + msg_putchar_attr(*p, echo_attr); + } else { - /* Do not want errors such as E724 here. */ - ++emsg_off; - s = tv2string(&argvars[i], &tofree, numbuf2, 0); - --emsg_off; - if (s != NULL) +#ifdef FEAT_MBYTE + if (has_mbyte) { - if (vim_strsize(s) > MSG_BUF_CLEN) - { - trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); - s = buf; - } - msg_puts(s); - vim_free(tofree); + int i = (*mb_ptr2len)(p); + + (void)msg_outtrans_len_attr(p, i, echo_attr); + p += i - 1; } + else +#endif + (void)msg_outtrans_len_attr(p, 1, echo_attr); } } - msg_puts((char_u *)")"); - } - msg_puts((char_u *)"\n"); /* don't overwrite this either */ - - verbose_leave_scroll(); - --no_wait_return; + vim_free(tofree); } + clear_tv(&rettv); + arg = skipwhite(arg); } -#ifdef FEAT_PROFILE - if (do_profiling == PROF_YES) + eap->nextcmd = check_nextcmd(arg); + + if (eap->skip) + --emsg_skip; + else { - if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) - func_do_profile(fp); - if (fp->uf_profiling - || (fc->caller != NULL && fc->caller->func->uf_profiling)) - { - ++fp->uf_tm_count; - profile_start(&call_start); - profile_zero(&fp->uf_tm_children); - } - script_prof_save(&wait_start); + /* remove text that may still be there from the command */ + if (needclr) + msg_clr_eos(); + if (eap->cmdidx == CMD_echo) + msg_end(); } -#endif - - save_current_SID = current_SID; - current_SID = fp->uf_script_ID; - save_did_emsg = did_emsg; - did_emsg = FALSE; +} - /* call do_cmdline() to execute the lines */ - do_cmdline(NULL, get_func_line, (void *)fc, - DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); +/* + * ":echohl {name}". + */ + void +ex_echohl(exarg_T *eap) +{ + echo_attr = syn_name2attr(eap->arg); +} - --RedrawingDisabled; +/* + * ":execute expr1 ..." execute the result of an expression. + * ":echomsg expr1 ..." Print a message + * ":echoerr expr1 ..." Print an error + * Each gets spaces around each argument and a newline at the end for + * echo commands + */ + void +ex_execute(exarg_T *eap) +{ + char_u *arg = eap->arg; + typval_T rettv; + int ret = OK; + char_u *p; + garray_T ga; + int len; + int save_did_emsg; - /* when the function was aborted because of an error, return -1 */ - if ((did_emsg && (fp->uf_flags & FC_ABORT)) || rettv->v_type == VAR_UNKNOWN) - { - clear_tv(rettv); - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = -1; - } + ga_init2(&ga, 1, 80); -#ifdef FEAT_PROFILE - if (do_profiling == PROF_YES && (fp->uf_profiling - || (fc->caller != NULL && fc->caller->func->uf_profiling))) + if (eap->skip) + ++emsg_skip; + while (*arg != NUL && *arg != '|' && *arg != '\n') { - profile_end(&call_start); - profile_sub_wait(&wait_start, &call_start); - profile_add(&fp->uf_tm_total, &call_start); - profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children); - if (fc->caller != NULL && fc->caller->func->uf_profiling) + p = arg; + if (eval1(&arg, &rettv, !eap->skip) == FAIL) { - profile_add(&fc->caller->func->uf_tm_children, &call_start); - profile_add(&fc->caller->func->uf_tml_children, &call_start); + /* + * Report the invalid expression unless the expression evaluation + * has been cancelled due to an aborting error, an interrupt, or an + * exception. + */ + if (!aborting()) + EMSG2(_(e_invexpr2), p); + ret = FAIL; + break; } - } -#endif - /* when being verbose, mention the return value */ - if (p_verbose >= 12) - { - ++no_wait_return; - verbose_enter_scroll(); - - if (aborting()) - smsg((char_u *)_("%s aborted"), sourcing_name); - else if (fc->rettv->v_type == VAR_NUMBER) - smsg((char_u *)_("%s returning #%ld"), sourcing_name, - (long)fc->rettv->vval.v_number); - else + if (!eap->skip) { - char_u buf[MSG_BUF_LEN]; - char_u numbuf2[NUMBUFLEN]; - char_u *tofree; - char_u *s; - - /* The value may be very long. Skip the middle part, so that we - * have some idea how it starts and ends. smsg() would always - * truncate it at the end. Don't want errors such as E724 here. */ - ++emsg_off; - s = tv2string(fc->rettv, &tofree, numbuf2, 0); - --emsg_off; - if (s != NULL) + p = get_tv_string(&rettv); + len = (int)STRLEN(p); + if (ga_grow(&ga, len + 2) == FAIL) { - if (vim_strsize(s) > MSG_BUF_CLEN) - { - trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); - s = buf; - } - smsg((char_u *)_("%s returning %s"), sourcing_name, s); - vim_free(tofree); + clear_tv(&rettv); + ret = FAIL; + break; } + if (ga.ga_len) + ((char_u *)(ga.ga_data))[ga.ga_len++] = ' '; + STRCPY((char_u *)(ga.ga_data) + ga.ga_len, p); + ga.ga_len += len; } - msg_puts((char_u *)"\n"); /* don't overwrite this either */ - - verbose_leave_scroll(); - --no_wait_return; - } - - vim_free(sourcing_name); - sourcing_name = save_sourcing_name; - sourcing_lnum = save_sourcing_lnum; - current_SID = save_current_SID; -#ifdef FEAT_PROFILE - if (do_profiling == PROF_YES) - script_prof_restore(&wait_start); -#endif - - if (p_verbose >= 12 && sourcing_name != NULL) - { - ++no_wait_return; - verbose_enter_scroll(); - - smsg((char_u *)_("continuing in %s"), sourcing_name); - msg_puts((char_u *)"\n"); /* don't overwrite this either */ - verbose_leave_scroll(); - --no_wait_return; + clear_tv(&rettv); + arg = skipwhite(arg); } - did_emsg |= save_did_emsg; - current_funccal = fc->caller; - --depth; - - /* If the a:000 list and the l: and a: dicts are not referenced we can - * free the funccall_T and what's in it. */ - if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT - && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT - && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT) - { - free_funccal(fc, FALSE); - } - else + if (ret != FAIL && ga.ga_data != NULL) { - hashitem_T *hi; - listitem_T *li; - int todo; - - /* "fc" is still in use. This can happen when returning "a:000" or - * assigning "l:" to a global variable. - * Link "fc" in the list for garbage collection later. */ - fc->caller = previous_funccal; - previous_funccal = fc; - - /* Make a copy of the a: variables, since we didn't do that above. */ - todo = (int)fc->l_avars.dv_hashtab.ht_used; - for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi) + if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echoerr) { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - v = HI2DI(hi); - copy_tv(&v->di_tv, &v->di_tv); - } + /* Mark the already saved text as finishing the line, so that what + * follows is displayed on a new line when scrolling back at the + * more prompt. */ + msg_sb_eol(); } - /* Make a copy of the a:000 items, since we didn't do that above. */ - for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) - copy_tv(&li->li_tv, &li->li_tv); + if (eap->cmdidx == CMD_echomsg) + { + MSG_ATTR(ga.ga_data, echo_attr); + out_flush(); + } + else if (eap->cmdidx == CMD_echoerr) + { + /* We don't want to abort following commands, restore did_emsg. */ + save_did_emsg = did_emsg; + EMSG((char_u *)ga.ga_data); + if (!force_abort) + did_emsg = save_did_emsg; + } + else if (eap->cmdidx == CMD_execute) + do_cmdline((char_u *)ga.ga_data, + eap->getline, eap->cookie, DOCMD_NOWAIT|DOCMD_VERBOSE); } -} -/* - * Return TRUE if items in "fc" do not have "copyID". That means they are not - * referenced from anywhere that is in use. - */ - static int -can_free_funccal(fc, copyID) - funccall_T *fc; - int copyID; -{ - return (fc->l_varlist.lv_copyID != copyID - && fc->l_vars.dv_copyID != copyID - && fc->l_avars.dv_copyID != copyID); + ga_clear(&ga); + + if (eap->skip) + --emsg_skip; + + eap->nextcmd = check_nextcmd(arg); } /* - * Free "fc" and what it contains. + * Find window specified by "vp" in tabpage "tp". */ - static void -free_funccal(fc, free_val) - funccall_T *fc; - int free_val; /* a: vars were allocated */ + win_T * +find_win_by_nr( + typval_T *vp, + tabpage_T *tp) /* NULL for current tab page */ { - listitem_T *li; - - /* The a: variables typevals may not have been allocated, only free the - * allocated variables. */ - vars_clear_ext(&fc->l_avars.dv_hashtab, free_val); - - /* free all l: variables */ - vars_clear(&fc->l_vars.dv_hashtab); + win_T *wp; + int nr; - /* Free the a:000 variables if they were allocated. */ - if (free_val) - for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) - clear_tv(&li->li_tv); + nr = (int)get_tv_number_chk(vp, NULL); - vim_free(fc); -} + if (nr < 0) + return NULL; + if (nr == 0) + return curwin; -/* - * Add a number variable "name" to dict "dp" with value "nr". - */ - static void -add_nr_var(dp, v, name, nr) - dict_T *dp; - dictitem_T *v; - char *name; - varnumber_T nr; -{ - STRCPY(v->di_key, name); - v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; - hash_add(&dp->dv_hashtab, DI2HIKEY(v)); - v->di_tv.v_type = VAR_NUMBER; - v->di_tv.v_lock = VAR_FIXED; - v->di_tv.vval.v_number = nr; + FOR_ALL_WINDOWS_IN_TAB(tp, wp) + { + if (nr >= LOWEST_WIN_ID) + { + if (wp->w_id == nr) + return wp; + } + else if (--nr <= 0) + break; + } + if (nr >= LOWEST_WIN_ID) + return NULL; + return wp; } /* - * ":return [expr]" + * Find window specified by "wvp" in tabpage "tvp". */ - void -ex_return(eap) - exarg_T *eap; + win_T * +find_tabwin( + typval_T *wvp, /* VAR_UNKNOWN for current window */ + typval_T *tvp) /* VAR_UNKNOWN for current tab page */ { - char_u *arg = eap->arg; - typval_T rettv; - int returning = FALSE; - - if (current_funccal == NULL) - { - EMSG(_("E133: :return not inside a function")); - return; - } - - if (eap->skip) - ++emsg_skip; + win_T *wp = NULL; + tabpage_T *tp = NULL; + long n; - eap->nextcmd = NULL; - if ((*arg != NUL && *arg != '|' && *arg != '\n') - && eval0(arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) + if (wvp->v_type != VAR_UNKNOWN) { - if (!eap->skip) - returning = do_return(eap, FALSE, TRUE, &rettv); + if (tvp->v_type != VAR_UNKNOWN) + { + n = (long)get_tv_number(tvp); + if (n >= 0) + tp = find_tabpage(n); + } else - clear_tv(&rettv); - } - /* It's safer to return also on error. */ - else if (!eap->skip) - { - /* - * Return unless the expression evaluation has been cancelled due to an - * aborting error, an interrupt, or an exception. - */ - if (!aborting()) - returning = do_return(eap, FALSE, TRUE, NULL); - } + tp = curtab; - /* When skipping or the return gets pending, advance to the next command - * in this line (!returning). Otherwise, ignore the rest of the line. - * Following lines will be ignored by get_func_line(). */ - if (returning) - eap->nextcmd = NULL; - else if (eap->nextcmd == NULL) /* no argument */ - eap->nextcmd = check_nextcmd(arg); + if (tp != NULL) + wp = find_win_by_nr(wvp, tp); + } + else + wp = curwin; - if (eap->skip) - --emsg_skip; + return wp; } /* - * Return from a function. Possibly makes the return pending. Also called - * for a pending return at the ":endtry" or after returning from an extra - * do_cmdline(). "reanimate" is used in the latter case. "is_cmd" is set - * when called due to a ":return" command. "rettv" may point to a typval_T - * with the return rettv. Returns TRUE when the return can be carried out, - * FALSE when the return gets pending. + * getwinvar() and gettabwinvar() */ - int -do_return(eap, reanimate, is_cmd, rettv) - exarg_T *eap; - int reanimate; - int is_cmd; - void *rettv; + void +getwinvar( + typval_T *argvars, + typval_T *rettv, + int off) /* 1 for gettabwinvar() */ { - int idx; - struct condstack *cstack = eap->cstack; + win_T *win; + char_u *varname; + dictitem_T *v; + tabpage_T *tp = NULL; + int done = FALSE; + win_T *oldcurwin; + tabpage_T *oldtabpage; + int need_switch_win; + + if (off == 1) + tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + else + tp = curtab; + win = find_win_by_nr(&argvars[off], tp); + varname = get_tv_string_chk(&argvars[off + 1]); + ++emsg_off; - if (reanimate) - /* Undo the return. */ - current_funccal->returned = FALSE; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; - /* - * Cleanup (and inactivate) conditionals, but stop when a try conditional - * not in its finally clause (which then is to be executed next) is found. - * In this case, make the ":return" pending for execution at the ":endtry". - * Otherwise, return normally. - */ - idx = cleanup_conditionals(eap->cstack, 0, TRUE); - if (idx >= 0) + if (win != NULL && varname != NULL) { - cstack->cs_pending[idx] = CSTP_RETURN; - - if (!is_cmd && !reanimate) - /* A pending return again gets pending. "rettv" points to an - * allocated variable with the rettv of the original ":return"'s - * argument if present or is NULL else. */ - cstack->cs_rettv[idx] = rettv; - else + /* Set curwin to be our win, temporarily. Also set the tabpage, + * otherwise the window is not valid. Only do this when needed, + * autocommands get blocked. */ + need_switch_win = !(tp == curtab && win == curwin); + if (!need_switch_win + || switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK) { - /* When undoing a return in order to make it pending, get the stored - * return rettv. */ - if (reanimate) - rettv = current_funccal->rettv; - - if (rettv != NULL) + if (*varname == '&') { - /* Store the value of the pending return. */ - if ((cstack->cs_rettv[idx] = alloc_tv()) != NULL) - *(typval_T *)cstack->cs_rettv[idx] = *(typval_T *)rettv; - else - EMSG(_(e_outofmem)); + if (varname[1] == NUL) + { + /* get all window-local options in a dict */ + dict_T *opts = get_winbuf_options(FALSE); + + if (opts != NULL) + { + rettv_dict_set(rettv, opts); + done = TRUE; + } + } + else if (get_option_tv(&varname, rettv, 1) == OK) + /* window-local-option */ + done = TRUE; } else - cstack->cs_rettv[idx] = NULL; - - if (reanimate) { - /* The pending return value could be overwritten by a ":return" - * without argument in a finally clause; reset the default - * return value. */ - current_funccal->rettv->v_type = VAR_NUMBER; - current_funccal->rettv->vval.v_number = 0; + /* Look up the variable. */ + /* Let getwinvar({nr}, "") return the "w:" dictionary. */ + v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', + varname, FALSE); + if (v != NULL) + { + copy_tv(&v->di_tv, rettv); + done = TRUE; + } } } - report_make_pending(CSTP_RETURN, rettv); - } - else - { - current_funccal->returned = TRUE; - /* If the return is carried out now, store the return value. For - * a return immediately after reanimation, the value is already - * there. */ - if (!reanimate && rettv != NULL) - { - clear_tv(current_funccal->rettv); - *current_funccal->rettv = *(typval_T *)rettv; - if (!is_cmd) - vim_free(rettv); - } + if (need_switch_win) + /* restore previous notion of curwin */ + restore_win(oldcurwin, oldtabpage, TRUE); } - return idx < 0; -} - -/* - * Free the variable with a pending return value. - */ - void -discard_pending_return(rettv) - void *rettv; -{ - free_tv((typval_T *)rettv); -} - -/* - * Generate a return command for producing the value of "rettv". The result - * is an allocated string. Used by report_pending() for verbose messages. - */ - char_u * -get_return_cmd(rettv) - void *rettv; -{ - char_u *s = NULL; - char_u *tofree = NULL; - char_u numbuf[NUMBUFLEN]; + if (!done && argvars[off + 2].v_type != VAR_UNKNOWN) + /* use the default return value */ + copy_tv(&argvars[off + 2], rettv); - if (rettv != NULL) - s = echo_string((typval_T *)rettv, &tofree, numbuf, 0); - if (s == NULL) - s = (char_u *)""; - - STRCPY(IObuff, ":return "); - STRNCPY(IObuff + 8, s, IOSIZE - 8); - if (STRLEN(s) + 8 >= IOSIZE) - STRCPY(IObuff + IOSIZE - 4, "..."); - vim_free(tofree); - return vim_strsave(IObuff); + --emsg_off; } /* - * Get next function line. - * Called by do_cmdline() to get the next line. - * Returns allocated string, or NULL for end of function. + * "setwinvar()" and "settabwinvar()" functions */ - char_u * -get_func_line(c, cookie, indent) - int c UNUSED; - void *cookie; - int indent UNUSED; + void +setwinvar(typval_T *argvars, typval_T *rettv UNUSED, int off) { - funccall_T *fcp = (funccall_T *)cookie; - ufunc_T *fp = fcp->func; - char_u *retval; - garray_T *gap; /* growarray with function lines */ + win_T *win; + win_T *save_curwin; + tabpage_T *save_curtab; + int need_switch_win; + char_u *varname, *winvarname; + typval_T *varp; + char_u nbuf[NUMBUFLEN]; + tabpage_T *tp = NULL; - /* If breakpoints have been added/deleted need to check for it. */ - if (fcp->dbg_tick != debug_tick) - { - fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, - sourcing_lnum); - fcp->dbg_tick = debug_tick; - } -#ifdef FEAT_PROFILE - if (do_profiling == PROF_YES) - func_line_end(cookie); -#endif + if (check_restricted() || check_secure()) + return; - gap = &fp->uf_lines; - if (((fp->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) - || fcp->returned) - retval = NULL; + if (off == 1) + tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); else + tp = curtab; + win = find_win_by_nr(&argvars[off], tp); + varname = get_tv_string_chk(&argvars[off + 1]); + varp = &argvars[off + 2]; + + if (win != NULL && varname != NULL && varp != NULL) { - /* Skip NULL lines (continuation lines). */ - while (fcp->linenr < gap->ga_len - && ((char_u **)(gap->ga_data))[fcp->linenr] == NULL) - ++fcp->linenr; - if (fcp->linenr >= gap->ga_len) - retval = NULL; - else + need_switch_win = !(tp == curtab && win == curwin); + if (!need_switch_win + || switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == OK) { - retval = vim_strsave(((char_u **)(gap->ga_data))[fcp->linenr++]); - sourcing_lnum = fcp->linenr; -#ifdef FEAT_PROFILE - if (do_profiling == PROF_YES) - func_line_start(cookie); -#endif - } - } + if (*varname == '&') + { + long numval; + char_u *strval; + int error = FALSE; - /* Did we encounter a breakpoint? */ - if (fcp->breakpoint != 0 && fcp->breakpoint <= sourcing_lnum) - { - dbg_breakpoint(fp->uf_name, sourcing_lnum); - /* Find next breakpoint. */ - fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, - sourcing_lnum); - fcp->dbg_tick = debug_tick; + ++varname; + numval = (long)get_tv_number_chk(varp, &error); + strval = get_tv_string_buf_chk(varp, nbuf); + if (!error && strval != NULL) + set_option_value(varname, numval, strval, OPT_LOCAL); + } + else + { + winvarname = alloc((unsigned)STRLEN(varname) + 3); + if (winvarname != NULL) + { + STRCPY(winvarname, "w:"); + STRCPY(winvarname + 2, varname); + set_var(winvarname, varp, TRUE); + vim_free(winvarname); + } + } + } + if (need_switch_win) + restore_win(save_curwin, save_curtab, TRUE); } - - return retval; } -#if defined(FEAT_PROFILE) || defined(PROTO) /* - * Called when starting to read a function line. - * "sourcing_lnum" must be correct! - * When skipping lines it may not actually be executed, but we won't find out - * until later and we need to store the time now. + * Skip over the name of an option: "&option", "&g:option" or "&l:option". + * "arg" points to the "&" or '+' when called, to "option" when returning. + * Returns NULL when no option name found. Otherwise pointer to the char + * after the option name. */ - void -func_line_start(cookie) - void *cookie; + static char_u * +find_option_end(char_u **arg, int *opt_flags) { - funccall_T *fcp = (funccall_T *)cookie; - ufunc_T *fp = fcp->func; + char_u *p = *arg; - if (fp->uf_profiling && sourcing_lnum >= 1 - && sourcing_lnum <= fp->uf_lines.ga_len) + ++p; + if (*p == 'g' && p[1] == ':') { - fp->uf_tml_idx = sourcing_lnum - 1; - /* Skip continuation lines. */ - while (fp->uf_tml_idx > 0 && FUNCLINE(fp, fp->uf_tml_idx) == NULL) - --fp->uf_tml_idx; - fp->uf_tml_execed = FALSE; - profile_start(&fp->uf_tml_start); - profile_zero(&fp->uf_tml_children); - profile_get_wait(&fp->uf_tml_wait); + *opt_flags = OPT_GLOBAL; + p += 2; } -} + else if (*p == 'l' && p[1] == ':') + { + *opt_flags = OPT_LOCAL; + p += 2; + } + else + *opt_flags = 0; -/* - * Called when actually executing a function line. - */ - void -func_line_exec(cookie) - void *cookie; -{ - funccall_T *fcp = (funccall_T *)cookie; - ufunc_T *fp = fcp->func; + if (!ASCII_ISALPHA(*p)) + return NULL; + *arg = p; - if (fp->uf_profiling && fp->uf_tml_idx >= 0) - fp->uf_tml_execed = TRUE; + if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) + p += 4; /* termcap option */ + else + while (ASCII_ISALPHA(*p)) + ++p; + return p; } /* - * Called when done with a function line. + * Return the autoload script name for a function or variable name. + * Returns NULL when out of memory. */ - void -func_line_end(cookie) - void *cookie; + char_u * +autoload_name(char_u *name) { - funccall_T *fcp = (funccall_T *)cookie; - ufunc_T *fp = fcp->func; + char_u *p; + char_u *scriptname; - if (fp->uf_profiling && fp->uf_tml_idx >= 0) - { - if (fp->uf_tml_execed) - { - ++fp->uf_tml_count[fp->uf_tml_idx]; - profile_end(&fp->uf_tml_start); - profile_sub_wait(&fp->uf_tml_wait, &fp->uf_tml_start); - profile_add(&fp->uf_tml_total[fp->uf_tml_idx], &fp->uf_tml_start); - profile_self(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_start, - &fp->uf_tml_children); - } - fp->uf_tml_idx = -1; - } + /* Get the script file name: replace '#' with '/', append ".vim". */ + scriptname = alloc((unsigned)(STRLEN(name) + 14)); + if (scriptname == NULL) + return FALSE; + STRCPY(scriptname, "autoload/"); + STRCAT(scriptname, name); + *vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL; + STRCAT(scriptname, ".vim"); + while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL) + *p = '/'; + return scriptname; } -#endif /* - * Return TRUE if the currently active function should be ended, because a - * return was encountered or an error occurred. Used inside a ":while". + * If "name" has a package name try autoloading the script for it. + * Return TRUE if a package was loaded. */ int -func_has_ended(cookie) - void *cookie; +script_autoload( + char_u *name, + int reload) /* load script again when already loaded */ { - funccall_T *fcp = (funccall_T *)cookie; + char_u *p; + char_u *scriptname, *tofree; + int ret = FALSE; + int i; - /* Ignore the "abort" flag if the abortion behavior has been changed due to - * an error inside a try conditional. */ - return (((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) - || fcp->returned); -} + /* If there is no '#' after name[0] there is no package name. */ + p = vim_strchr(name, AUTOLOAD_CHAR); + if (p == NULL || p == name) + return FALSE; -/* - * return TRUE if cookie indicates a function which "abort"s on errors. - */ - int -func_has_abort(cookie) - void *cookie; -{ - return ((funccall_T *)cookie)->func->uf_flags & FC_ABORT; + tofree = scriptname = autoload_name(name); + + /* Find the name in the list of previously loaded package names. Skip + * "autoload/", it's always the same. */ + for (i = 0; i < ga_loaded.ga_len; ++i) + if (STRCMP(((char_u **)ga_loaded.ga_data)[i] + 9, scriptname + 9) == 0) + break; + if (!reload && i < ga_loaded.ga_len) + ret = FALSE; /* was loaded already */ + else + { + /* Remember the name if it wasn't loaded already. */ + if (i == ga_loaded.ga_len && ga_grow(&ga_loaded, 1) == OK) + { + ((char_u **)ga_loaded.ga_data)[ga_loaded.ga_len++] = scriptname; + tofree = NULL; + } + + /* Try loading the package from $VIMRUNTIME/autoload/<name>.vim */ + if (source_runtime(scriptname, 0) == OK) + ret = TRUE; + } + + vim_free(tofree); + return ret; } #if defined(FEAT_VIMINFO) || defined(FEAT_SESSION) @@ -24061,11 +8523,10 @@ typedef enum VAR_FLAVOUR_VIMINFO /* all uppercase */ } var_flavour_T; -static var_flavour_T var_flavour __ARGS((char_u *varname)); +static var_flavour_T var_flavour(char_u *varname); static var_flavour_T -var_flavour(varname) - char_u *varname; +var_flavour(char_u *varname) { char_u *p = varname; @@ -24086,13 +8547,12 @@ var_flavour(varname) * Restore global vars that start with a capital from the viminfo file */ int -read_viminfo_varlist(virp, writing) - vir_T *virp; - int writing; +read_viminfo_varlist(vir_T *virp, int writing) { char_u *tab; int type = VAR_NUMBER; typval_T tv; + void *save_funccal; if (!writing && (find_viminfo_parameter('!') != NULL)) { @@ -24108,6 +8568,7 @@ read_viminfo_varlist(virp, writing) #endif case 'D': type = VAR_DICT; break; case 'L': type = VAR_LIST; break; + case 'X': type = VAR_SPECIAL; break; } tab = vim_strchr(tab, '\t'); @@ -24139,7 +8600,10 @@ read_viminfo_varlist(virp, writing) } } + /* when in a function use global variables */ + save_funccal = clear_current_funccal(); set_var(virp->vir_line + 1, &tv, FALSE); + restore_current_funccal(save_funccal); if (tv.v_type == VAR_STRING) vim_free(tv.vval.v_string); @@ -24156,13 +8620,12 @@ read_viminfo_varlist(virp, writing) * Write global vars that start with a capital to the viminfo file */ void -write_viminfo_varlist(fp) - FILE *fp; +write_viminfo_varlist(FILE *fp) { hashitem_T *hi; dictitem_T *this_var; int todo; - char *s; + char *s = ""; char_u *p; char_u *tofree; char_u numbuf[NUMBUFLEN]; @@ -24185,12 +8648,17 @@ write_viminfo_varlist(fp) { case VAR_STRING: s = "STR"; break; case VAR_NUMBER: s = "NUM"; break; -#ifdef FEAT_FLOAT case VAR_FLOAT: s = "FLO"; break; -#endif case VAR_DICT: s = "DIC"; break; case VAR_LIST: s = "LIS"; break; - default: continue; + case VAR_SPECIAL: s = "XPL"; break; + + case VAR_UNKNOWN: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_JOB: + case VAR_CHANNEL: + continue; } fprintf(fp, "!%s\t%s\t", this_var->di_key, s); p = echo_string(&this_var->di_tv, &tofree, numbuf, 0); @@ -24205,8 +8673,7 @@ write_viminfo_varlist(fp) #if defined(FEAT_SESSION) || defined(PROTO) int -store_session_globals(fd) - FILE *fd; +store_session_globals(FILE *fd) { hashitem_T *hi; dictitem_T *this_var; @@ -24271,85 +8738,700 @@ store_session_globals(fd) } return OK; } -#endif +#endif + +/* + * Display script name where an item was last set. + * Should only be invoked when 'verbose' is non-zero. + */ + void +last_set_msg(scid_T scriptID) +{ + char_u *p; + + if (scriptID != 0) + { + p = home_replace_save(NULL, get_scriptname(scriptID)); + if (p != NULL) + { + verbose_enter(); + MSG_PUTS(_("\n\tLast set from ")); + MSG_PUTS(p); + vim_free(p); + verbose_leave(); + } + } +} + +/* reset v:option_new, v:option_old and v:option_type */ + void +reset_v_option_vars(void) +{ + set_vim_var_string(VV_OPTION_NEW, NULL, -1); + set_vim_var_string(VV_OPTION_OLD, NULL, -1); + set_vim_var_string(VV_OPTION_TYPE, NULL, -1); +} + +/* + * Prepare "gap" for an assert error and add the sourcing position. + */ + void +prepare_assert_error(garray_T *gap) +{ + char buf[NUMBUFLEN]; + + ga_init2(gap, 1, 100); + if (sourcing_name != NULL) + { + ga_concat(gap, sourcing_name); + if (sourcing_lnum > 0) + ga_concat(gap, (char_u *)" "); + } + if (sourcing_lnum > 0) + { + sprintf(buf, "line %ld", (long)sourcing_lnum); + ga_concat(gap, (char_u *)buf); + } + if (sourcing_name != NULL || sourcing_lnum > 0) + ga_concat(gap, (char_u *)": "); +} + +/* + * Add an assert error to v:errors. + */ + void +assert_error(garray_T *gap) +{ + struct vimvar *vp = &vimvars[VV_ERRORS]; + + if (vp->vv_type != VAR_LIST || vimvars[VV_ERRORS].vv_list == NULL) + /* Make sure v:errors is a list. */ + set_vim_var_list(VV_ERRORS, list_alloc()); + list_append_string(vimvars[VV_ERRORS].vv_list, gap->ga_data, gap->ga_len); +} + + int +assert_equal_common(typval_T *argvars, assert_type_T atype) +{ + garray_T ga; + + if (tv_equal(&argvars[0], &argvars[1], FALSE, FALSE) + != (atype == ASSERT_EQUAL)) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], + atype); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + + int +assert_equalfile(typval_T *argvars) +{ + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *fname1 = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + garray_T ga; + FILE *fd1; + FILE *fd2; + + if (fname1 == NULL || fname2 == NULL) + return 0; + + IObuff[0] = NUL; + fd1 = mch_fopen((char *)fname1, READBIN); + if (fd1 == NULL) + { + vim_snprintf((char *)IObuff, IOSIZE, (char *)e_notread, fname1); + } + else + { + fd2 = mch_fopen((char *)fname2, READBIN); + if (fd2 == NULL) + { + fclose(fd1); + vim_snprintf((char *)IObuff, IOSIZE, (char *)e_notread, fname2); + } + else + { + int c1, c2; + long count = 0; + + for (;;) + { + c1 = fgetc(fd1); + c2 = fgetc(fd2); + if (c1 == EOF) + { + if (c2 != EOF) + STRCPY(IObuff, "first file is shorter"); + break; + } + else if (c2 == EOF) + { + STRCPY(IObuff, "second file is shorter"); + break; + } + else if (c1 != c2) + { + vim_snprintf((char *)IObuff, IOSIZE, + "difference at byte %ld", count); + break; + } + ++count; + } + fclose(fd1); + fclose(fd2); + } + } + if (IObuff[0] != NUL) + { + prepare_assert_error(&ga); + ga_concat(&ga, IObuff); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + + int +assert_match_common(typval_T *argvars, assert_type_T atype) +{ + garray_T ga; + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *pat = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *text = get_tv_string_buf_chk(&argvars[1], buf2); + + if (pat == NULL || text == NULL) + EMSG(_(e_invarg)); + else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH)) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], + atype); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + + int +assert_inrange(typval_T *argvars) +{ + garray_T ga; + int error = FALSE; + varnumber_T lower = get_tv_number_chk(&argvars[0], &error); + varnumber_T upper = get_tv_number_chk(&argvars[1], &error); + varnumber_T actual = get_tv_number_chk(&argvars[2], &error); + char_u *tofree; + char msg[200]; + char_u numbuf[NUMBUFLEN]; + + if (error) + return 0; + if (actual < lower || actual > upper) + { + prepare_assert_error(&ga); + if (argvars[3].v_type != VAR_UNKNOWN) + { + ga_concat(&ga, tv2string(&argvars[3], &tofree, numbuf, 0)); + vim_free(tofree); + } + else + { + vim_snprintf(msg, 200, "Expected range %ld - %ld, but got %ld", + (long)lower, (long)upper, (long)actual); + ga_concat(&ga, (char_u *)msg); + } + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + +/* + * Common for assert_true() and assert_false(). + * Return non-zero for failure. + */ + int +assert_bool(typval_T *argvars, int isTrue) +{ + int error = FALSE; + garray_T ga; + + if (argvars[0].v_type == VAR_SPECIAL + && argvars[0].vval.v_number == (isTrue ? VVAL_TRUE : VVAL_FALSE)) + return 0; + if (argvars[0].v_type != VAR_NUMBER + || (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue + || error) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[1], + (char_u *)(isTrue ? "True" : "False"), + NULL, &argvars[0], ASSERT_OTHER); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + + int +assert_report(typval_T *argvars) +{ + garray_T ga; + + prepare_assert_error(&ga); + ga_concat(&ga, get_tv_string(&argvars[0])); + assert_error(&ga); + ga_clear(&ga); + return 1; +} + + int +assert_exception(typval_T *argvars) +{ + garray_T ga; + char_u *error = get_tv_string_chk(&argvars[0]); + + if (vimvars[VV_EXCEPTION].vv_str == NULL) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"v:exception is not set"); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + else if (error != NULL + && strstr((char *)vimvars[VV_EXCEPTION].vv_str, (char *)error) == NULL) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[1], NULL, &argvars[0], + &vimvars[VV_EXCEPTION].vv_tv, ASSERT_OTHER); + assert_error(&ga); + ga_clear(&ga); + return 1; + } + return 0; +} + + int +assert_beeps(typval_T *argvars) +{ + char_u *cmd = get_tv_string_chk(&argvars[0]); + garray_T ga; + int ret = 0; + + called_vim_beep = FALSE; + suppress_errthrow = TRUE; + emsg_silent = FALSE; + do_cmdline_cmd(cmd); + if (!called_vim_beep) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"command did not beep: "); + ga_concat(&ga, cmd); + assert_error(&ga); + ga_clear(&ga); + ret = 1; + } + + suppress_errthrow = FALSE; + emsg_on_display = FALSE; + return ret; +} + + int +assert_fails(typval_T *argvars) +{ + char_u *cmd = get_tv_string_chk(&argvars[0]); + garray_T ga; + int ret = 0; + + called_emsg = FALSE; + suppress_errthrow = TRUE; + emsg_silent = TRUE; + do_cmdline_cmd(cmd); + if (!called_emsg) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"command did not fail: "); + ga_concat(&ga, cmd); + assert_error(&ga); + ga_clear(&ga); + ret = 1; + } + else if (argvars[1].v_type != VAR_UNKNOWN) + { + char_u buf[NUMBUFLEN]; + char *error = (char *)get_tv_string_buf_chk(&argvars[1], buf); + + if (error == NULL + || strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[2], NULL, &argvars[1], + &vimvars[VV_ERRMSG].vv_tv, ASSERT_OTHER); + assert_error(&ga); + ga_clear(&ga); + ret = 1; + } + } + + called_emsg = FALSE; + suppress_errthrow = FALSE; + emsg_silent = FALSE; + emsg_on_display = FALSE; + set_vim_var_string(VV_ERRMSG, NULL, 0); + return ret; +} + +/* + * Append "str" to "gap", escaping unprintable characters. + * Changes NL to \n, CR to \r, etc. + */ + static void +ga_concat_esc(garray_T *gap, char_u *str) +{ + char_u *p; + char_u buf[NUMBUFLEN]; + + if (str == NULL) + { + ga_concat(gap, (char_u *)"NULL"); + return; + } + + for (p = str; *p != NUL; ++p) + switch (*p) + { + case BS: ga_concat(gap, (char_u *)"\\b"); break; + case ESC: ga_concat(gap, (char_u *)"\\e"); break; + case FF: ga_concat(gap, (char_u *)"\\f"); break; + case NL: ga_concat(gap, (char_u *)"\\n"); break; + case TAB: ga_concat(gap, (char_u *)"\\t"); break; + case CAR: ga_concat(gap, (char_u *)"\\r"); break; + case '\\': ga_concat(gap, (char_u *)"\\\\"); break; + default: + if (*p < ' ') + { + vim_snprintf((char *)buf, NUMBUFLEN, "\\x%02x", *p); + ga_concat(gap, buf); + } + else + ga_append(gap, *p); + break; + } +} /* - * Display script name where an item was last set. - * Should only be invoked when 'verbose' is non-zero. + * Fill "gap" with information about an assert error. */ void -last_set_msg(scriptID) - scid_T scriptID; +fill_assert_error( + garray_T *gap, + typval_T *opt_msg_tv, + char_u *exp_str, + typval_T *exp_tv, + typval_T *got_tv, + assert_type_T atype) { - char_u *p; + char_u numbuf[NUMBUFLEN]; + char_u *tofree; - if (scriptID != 0) + if (opt_msg_tv->v_type != VAR_UNKNOWN) { - p = home_replace_save(NULL, get_scriptname(scriptID)); - if (p != NULL) - { - verbose_enter(); - MSG_PUTS(_("\n\tLast set from ")); - MSG_PUTS(p); - vim_free(p); - verbose_leave(); - } + ga_concat(gap, echo_string(opt_msg_tv, &tofree, numbuf, 0)); + vim_free(tofree); + ga_concat(gap, (char_u *)": "); + } + + if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH) + ga_concat(gap, (char_u *)"Pattern "); + else if (atype == ASSERT_NOTEQUAL) + ga_concat(gap, (char_u *)"Expected not equal to "); + else + ga_concat(gap, (char_u *)"Expected "); + if (exp_str == NULL) + { + ga_concat_esc(gap, tv2string(exp_tv, &tofree, numbuf, 0)); + vim_free(tofree); + } + else + ga_concat_esc(gap, exp_str); + if (atype != ASSERT_NOTEQUAL) + { + if (atype == ASSERT_MATCH) + ga_concat(gap, (char_u *)" does not match "); + else if (atype == ASSERT_NOTMATCH) + ga_concat(gap, (char_u *)" does match "); + else + ga_concat(gap, (char_u *)" but got "); + ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0)); + vim_free(tofree); } } /* - * List v:oldfiles in a nice way. + * Compare "typ1" and "typ2". Put the result in "typ1". */ - void -ex_oldfiles(eap) - exarg_T *eap UNUSED; + int +typval_compare( + typval_T *typ1, /* first operand */ + typval_T *typ2, /* second operand */ + exptype_T type, /* operator */ + int type_is, /* TRUE for "is" and "isnot" */ + int ic) /* ignore case */ { - list_T *l = vimvars[VV_OLDFILES].vv_list; - listitem_T *li; - int nr = 0; + int i; + varnumber_T n1, n2; + char_u *s1, *s2; + char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; - if (l == NULL) - msg((char_u *)_("No old files")); - else + if (type_is && typ1->v_type != typ2->v_type) + { + /* For "is" a different type always means FALSE, for "notis" + * it means TRUE. */ + n1 = (type == TYPE_NEQUAL); + } + else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST) { - msg_start(); - msg_scroll = TRUE; - for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) + if (type_is) + { + n1 = (typ1->v_type == typ2->v_type + && typ1->vval.v_list == typ2->vval.v_list); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + else if (typ1->v_type != typ2->v_type + || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) + { + if (typ1->v_type != typ2->v_type) + EMSG(_("E691: Can only compare List with List")); + else + EMSG(_("E692: Invalid operation for List")); + clear_tv(typ1); + return FAIL; + } + else { - msg_outnum((long)++nr); - MSG_PUTS(": "); - msg_outtrans(get_tv_string(&li->li_tv)); - msg_putchar('\n'); - out_flush(); /* output one line at a time */ - ui_breakcheck(); + /* Compare two Lists for being equal or unequal. */ + n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list, + ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; } - /* Assume "got_int" was set to truncate the listing. */ - got_int = FALSE; + } -#ifdef FEAT_BROWSE_CMD - if (cmdmod.browse) + else if (typ1->v_type == VAR_DICT || typ2->v_type == VAR_DICT) + { + if (type_is) { - quit_more = FALSE; - nr = prompt_for_number(FALSE); - msg_starthere(); - if (nr > 0) - { - char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), - (long)nr); + n1 = (typ1->v_type == typ2->v_type + && typ1->vval.v_dict == typ2->vval.v_dict); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + else if (typ1->v_type != typ2->v_type + || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) + { + if (typ1->v_type != typ2->v_type) + EMSG(_("E735: Can only compare Dictionary with Dictionary")); + else + EMSG(_("E736: Invalid operation for Dictionary")); + clear_tv(typ1); + return FAIL; + } + else + { + /* Compare two Dictionaries for being equal or unequal. */ + n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict, + ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + } - if (p != NULL) - { - p = expand_env_save(p); - eap->arg = p; - eap->cmdidx = CMD_edit; - cmdmod.browse = FALSE; - do_exedit(eap, NULL); - vim_free(p); - } - } + else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC + || typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL) + { + if (type != TYPE_EQUAL && type != TYPE_NEQUAL) + { + EMSG(_("E694: Invalid operation for Funcrefs")); + clear_tv(typ1); + return FAIL; } + if ((typ1->v_type == VAR_PARTIAL + && typ1->vval.v_partial == NULL) + || (typ2->v_type == VAR_PARTIAL + && typ2->vval.v_partial == NULL)) + /* when a partial is NULL assume not equal */ + n1 = FALSE; + else if (type_is) + { + if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC) + /* strings are considered the same if their value is + * the same */ + n1 = tv_equal(typ1, typ2, ic, FALSE); + else if (typ1->v_type == VAR_PARTIAL + && typ2->v_type == VAR_PARTIAL) + n1 = (typ1->vval.v_partial == typ2->vval.v_partial); + else + n1 = FALSE; + } + else + n1 = tv_equal(typ1, typ2, ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + +#ifdef FEAT_FLOAT + /* + * If one of the two variables is a float, compare as a float. + * When using "=~" or "!~", always compare as string. + */ + else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT) + && type != TYPE_MATCH && type != TYPE_NOMATCH) + { + float_T f1, f2; + + if (typ1->v_type == VAR_FLOAT) + f1 = typ1->vval.v_float; + else + f1 = get_tv_number(typ1); + if (typ2->v_type == VAR_FLOAT) + f2 = typ2->vval.v_float; + else + f2 = get_tv_number(typ2); + n1 = FALSE; + switch (type) + { + case TYPE_EQUAL: n1 = (f1 == f2); break; + case TYPE_NEQUAL: n1 = (f1 != f2); break; + case TYPE_GREATER: n1 = (f1 > f2); break; + case TYPE_GEQUAL: n1 = (f1 >= f2); break; + case TYPE_SMALLER: n1 = (f1 < f2); break; + case TYPE_SEQUAL: n1 = (f1 <= f2); break; + case TYPE_UNKNOWN: + case TYPE_MATCH: + case TYPE_NOMATCH: break; /* avoid gcc warning */ + } + } #endif + + /* + * If one of the two variables is a number, compare as a number. + * When using "=~" or "!~", always compare as string. + */ + else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER) + && type != TYPE_MATCH && type != TYPE_NOMATCH) + { + n1 = get_tv_number(typ1); + n2 = get_tv_number(typ2); + switch (type) + { + case TYPE_EQUAL: n1 = (n1 == n2); break; + case TYPE_NEQUAL: n1 = (n1 != n2); break; + case TYPE_GREATER: n1 = (n1 > n2); break; + case TYPE_GEQUAL: n1 = (n1 >= n2); break; + case TYPE_SMALLER: n1 = (n1 < n2); break; + case TYPE_SEQUAL: n1 = (n1 <= n2); break; + case TYPE_UNKNOWN: + case TYPE_MATCH: + case TYPE_NOMATCH: break; /* avoid gcc warning */ + } + } + else + { + s1 = get_tv_string_buf(typ1, buf1); + s2 = get_tv_string_buf(typ2, buf2); + if (type != TYPE_MATCH && type != TYPE_NOMATCH) + i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); + else + i = 0; + n1 = FALSE; + switch (type) + { + case TYPE_EQUAL: n1 = (i == 0); break; + case TYPE_NEQUAL: n1 = (i != 0); break; + case TYPE_GREATER: n1 = (i > 0); break; + case TYPE_GEQUAL: n1 = (i >= 0); break; + case TYPE_SMALLER: n1 = (i < 0); break; + case TYPE_SEQUAL: n1 = (i <= 0); break; + + case TYPE_MATCH: + case TYPE_NOMATCH: + n1 = pattern_match(s2, s1, ic); + if (type == TYPE_NOMATCH) + n1 = !n1; + break; + + case TYPE_UNKNOWN: break; /* avoid gcc warning */ + } + } + clear_tv(typ1); + typ1->v_type = VAR_NUMBER; + typ1->vval.v_number = n1; + + return OK; +} + + char_u * +typval_tostring(arg) + typval_T *arg; +{ + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + char_u *ret = NULL; + + if (arg == NULL) + return vim_strsave((char_u *)"(does not exist)"); + ret = tv2string(arg, &tofree, numbuf, 0); + /* Make a copy if we have a value but it's not in allocated memory. */ + if (ret != NULL && tofree == NULL) + ret = vim_strsave(ret); + return ret; +} + + int +var_exists(char_u *var) +{ + char_u *name; + char_u *tofree; + typval_T tv; + int len = 0; + int n = FALSE; + + /* get_name_len() takes care of expanding curly braces */ + name = var; + len = get_name_len(&var, &tofree, TRUE, FALSE); + if (len > 0) + { + if (tofree != NULL) + name = tofree; + n = (get_var_tv(name, len, &tv, NULL, FALSE, TRUE) == OK); + if (n) + { + /* handle d.key, l[idx], f(expr) */ + n = (handle_subscript(&var, &tv, TRUE, FALSE) == OK); + if (n) + clear_tv(&tv); + } } + if (*var != NUL) + n = FALSE; + + vim_free(tofree); + return n; } #endif /* FEAT_EVAL */ @@ -24361,9 +9443,9 @@ ex_oldfiles(eap) /* * Functions for ":8" filename modifier: get 8.3 version of a filename. */ -static int get_short_pathname __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen)); -static int shortpath_for_invalid_fname __ARGS((char_u **fname, char_u **bufp, int *fnamelen)); -static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen)); +static int get_short_pathname(char_u **fnamep, char_u **bufp, int *fnamelen); +static int shortpath_for_invalid_fname(char_u **fname, char_u **bufp, int *fnamelen); +static int shortpath_for_partial(char_u **fnamep, char_u **bufp, int *fnamelen); /* * Get the short path (8.3) for the filename in "fnamep". @@ -24374,16 +9456,13 @@ static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fn * Returns OK on success, FAIL on failure. */ static int -get_short_pathname(fnamep, bufp, fnamelen) - char_u **fnamep; - char_u **bufp; - int *fnamelen; +get_short_pathname(char_u **fnamep, char_u **bufp, int *fnamelen) { int l, len; char_u *newbuf; len = *fnamelen; - l = GetShortPathName(*fnamep, *fnamep, len); + l = GetShortPathName((LPSTR)*fnamep, (LPSTR)*fnamep, len); if (l > len - 1) { /* If that doesn't work (not enough space), then save the string @@ -24396,7 +9475,7 @@ get_short_pathname(fnamep, bufp, fnamelen) *fnamep = *bufp = newbuf; /* Really should always succeed, as the buffer is big enough. */ - l = GetShortPathName(*fnamep, *fnamep, l+1); + l = GetShortPathName((LPSTR)*fnamep, (LPSTR)*fnamep, l+1); } *fnamelen = l; @@ -24419,10 +9498,10 @@ get_short_pathname(fnamep, bufp, fnamelen) * Returns OK on success (or nothing done) and FAIL on failure (out of memory). */ static int -shortpath_for_invalid_fname(fname, bufp, fnamelen) - char_u **fname; - char_u **bufp; - int *fnamelen; +shortpath_for_invalid_fname( + char_u **fname, + char_u **bufp, + int *fnamelen) { char_u *short_fname, *save_fname, *pbuf_unused; char_u *endp, *save_endp; @@ -24526,10 +9605,10 @@ shortpath_for_invalid_fname(fname, bufp, fnamelen) * Returns OK for success, FAIL for failure. */ static int -shortpath_for_partial(fnamep, bufp, fnamelen) - char_u **fnamep; - char_u **bufp; - int *fnamelen; +shortpath_for_partial( + char_u **fnamep, + char_u **bufp, + int *fnamelen) { int sepcount, len, tflen; char_u *p; @@ -24539,7 +9618,7 @@ shortpath_for_partial(fnamep, bufp, fnamelen) /* Count up the path separators from the RHS.. so we know which part * of the path to return. */ sepcount = 0; - for (p = *fnamep; p < *fnamep + *fnamelen; mb_ptr_adv(p)) + for (p = *fnamep; p < *fnamep + *fnamelen; MB_PTR_ADV(p)) if (vim_ispathsep(*p)) ++sepcount; @@ -24610,12 +9689,12 @@ shortpath_for_partial(fnamep, bufp, fnamelen) * When there is an error, *fnamep is set to NULL. */ int -modify_fname(src, usedlen, fnamep, bufp, fnamelen) - char_u *src; /* string with modifiers */ - int *usedlen; /* characters after src that are used */ - char_u **fnamep; /* file name so far */ - char_u **bufp; /* buffer for allocated file name or NULL */ - int *fnamelen; /* length of fnamep */ +modify_fname( + char_u *src, /* string with modifiers */ + int *usedlen, /* characters after src that are used */ + char_u **fnamep, /* file name so far */ + char_u **bufp, /* buffer for allocated file name or NULL */ + int *fnamelen) /* length of fnamep */ { int valid = 0; char_u *tail; @@ -24657,7 +9736,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) } /* When "/." or "/.." is used: force expansion to get rid of it. */ - for (p = *fnamep; *p != NUL; mb_ptr_adv(p)) + for (p = *fnamep; *p != NUL; MB_PTR_ADV(p)) { if (vim_ispathsep(*p) && p[1] == '.' @@ -24688,7 +9767,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) p = alloc(_MAX_PATH + 1); if (p != NULL) { - if (GetLongPathName(*fnamep, p, MAXPATHL)) + if (GetLongPathName((LPSTR)*fnamep, (LPSTR)p, _MAX_PATH)) { vim_free(*bufp); *bufp = *fnamep = p; @@ -24787,7 +9866,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) *usedlen += 2; s = get_past_head(*fnamep); while (tail > s && after_pathsep(s, tail)) - mb_ptr_back(*fnamep, tail); + MB_PTR_BACK(*fnamep, tail); *fnamelen = (int)(tail - *fnamep); #ifdef VMS if (*fnamelen > 0) @@ -24806,7 +9885,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) else { while (tail > s && !after_pathsep(s, tail)) - mb_ptr_back(*fnamep, tail); + MB_PTR_BACK(*fnamep, tail); } } @@ -24957,7 +10036,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) if (sub != NULL && str != NULL) { *usedlen = (int)(p + 1 - src); - s = do_string_sub(str, pat, sub, flags); + s = do_string_sub(str, pat, sub, NULL, flags); if (s != NULL) { *fnamep = s; @@ -24981,7 +10060,13 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') { + /* vim_strsave_shellescape() needs a NUL terminated string. */ + c = (*fnamep)[*fnamelen]; + if (c != NUL) + (*fnamep)[*fnamelen] = NUL; p = vim_strsave_shellescape(*fnamep, FALSE, FALSE); + if (c != NUL) + (*fnamep)[*fnamelen] = c; if (p == NULL) return -1; vim_free(*bufp); @@ -24995,21 +10080,24 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen) /* * Perform a substitution on "str" with pattern "pat" and substitute "sub". + * When "sub" is NULL "expr" is used, must be a VAR_FUNC or VAR_PARTIAL. * "flags" can be "g" to do a global substitute. * Returns an allocated string, NULL for error. */ char_u * -do_string_sub(str, pat, sub, flags) - char_u *str; - char_u *pat; - char_u *sub; - char_u *flags; +do_string_sub( + char_u *str, + char_u *pat, + char_u *sub, + typval_T *expr, + char_u *flags) { int sublen; regmatch_T regmatch; int i; int do_all; char_u *tail; + char_u *end; garray_T ga; char_u *ret; char_u *save_cpo; @@ -25028,6 +10116,7 @@ do_string_sub(str, pat, sub, flags) if (regmatch.regprog != NULL) { tail = str; + end = str + STRLEN(str); while (vim_regexec_nl(®match, str, (colnr_T)(tail - str))) { /* Skip empty match except for first match. */ @@ -25053,8 +10142,8 @@ do_string_sub(str, pat, sub, flags) * - The substituted text. * - The text after the match. */ - sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE); - if (ga_grow(&ga, (int)(STRLEN(tail) + sublen - + sublen = vim_regsub(®match, sub, expr, tail, FALSE, TRUE, FALSE); + if (ga_grow(&ga, (int)((end - tail) + sublen - (regmatch.endp[0] - regmatch.startp[0]))) == FAIL) { ga_clear(&ga); @@ -25065,7 +10154,7 @@ do_string_sub(str, pat, sub, flags) i = (int)(regmatch.startp[0] - tail); mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i); /* add the substituted text */ - (void)vim_regsub(®match, sub, (char_u *)ga.ga_data + (void)vim_regsub(®match, sub, expr, (char_u *)ga.ga_data + ga.ga_len + i, TRUE, TRUE, FALSE); ga.ga_len += i + sublen - 1; tail = regmatch.endp[0]; @@ -25086,10 +10175,166 @@ do_string_sub(str, pat, sub, flags) if (p_cpo == empty_option) p_cpo = save_cpo; else - /* Darn, evaluating {sub} expression changed the value. */ + /* Darn, evaluating {sub} expression or {expr} changed the value. */ free_string_option(save_cpo); return ret; } + static int +filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp) +{ + typval_T rettv; + typval_T argv[3]; + int retval = FAIL; + + copy_tv(tv, &vimvars[VV_VAL].vv_tv); + argv[0] = vimvars[VV_KEY].vv_tv; + argv[1] = vimvars[VV_VAL].vv_tv; + if (eval_expr_typval(expr, argv, 2, &rettv) == FAIL) + goto theend; + if (map) + { + /* map(): replace the list item value */ + clear_tv(tv); + rettv.v_lock = 0; + *tv = rettv; + } + else + { + int error = FALSE; + + /* filter(): when expr is zero remove the item */ + *remp = (get_tv_number_chk(&rettv, &error) == 0); + clear_tv(&rettv); + /* On type error, nothing has been removed; return FAIL to stop the + * loop. The error message was given by get_tv_number_chk(). */ + if (error) + goto theend; + } + retval = OK; +theend: + clear_tv(&vimvars[VV_VAL].vv_tv); + return retval; +} + + +/* + * Implementation of map() and filter(). + */ + void +filter_map(typval_T *argvars, typval_T *rettv, int map) +{ + typval_T *expr; + listitem_T *li, *nli; + list_T *l = NULL; + dictitem_T *di; + hashtab_T *ht; + hashitem_T *hi; + dict_T *d = NULL; + typval_T save_val; + typval_T save_key; + int rem; + int todo; + char_u *ermsg = (char_u *)(map ? "map()" : "filter()"); + char_u *arg_errmsg = (char_u *)(map ? N_("map() argument") + : N_("filter() argument")); + int save_did_emsg; + int idx = 0; + + if (argvars[0].v_type == VAR_LIST) + { + if ((l = argvars[0].vval.v_list) == NULL + || (!map && tv_check_lock(l->lv_lock, arg_errmsg, TRUE))) + return; + } + else if (argvars[0].v_type == VAR_DICT) + { + if ((d = argvars[0].vval.v_dict) == NULL + || (!map && tv_check_lock(d->dv_lock, arg_errmsg, TRUE))) + return; + } + else + { + EMSG2(_(e_listdictarg), ermsg); + return; + } + + expr = &argvars[1]; + /* On type errors, the preceding call has already displayed an error + * message. Avoid a misleading error message for an empty string that + * was not passed as argument. */ + if (expr->v_type != VAR_UNKNOWN) + { + prepare_vimvar(VV_VAL, &save_val); + + /* We reset "did_emsg" to be able to detect whether an error + * occurred during evaluation of the expression. */ + save_did_emsg = did_emsg; + did_emsg = FALSE; + + prepare_vimvar(VV_KEY, &save_key); + if (argvars[0].v_type == VAR_DICT) + { + vimvars[VV_KEY].vv_type = VAR_STRING; + + ht = &d->dv_hashtab; + hash_lock(ht); + todo = (int)ht->ht_used; + for (hi = ht->ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + int r; + + --todo; + di = HI2DI(hi); + if (map && + (tv_check_lock(di->di_tv.v_lock, arg_errmsg, TRUE) + || var_check_ro(di->di_flags, arg_errmsg, TRUE))) + break; + vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); + r = filter_map_one(&di->di_tv, expr, map, &rem); + clear_tv(&vimvars[VV_KEY].vv_tv); + if (r == FAIL || did_emsg) + break; + if (!map && rem) + { + if (var_check_fixed(di->di_flags, arg_errmsg, TRUE) + || var_check_ro(di->di_flags, arg_errmsg, TRUE)) + break; + dictitem_remove(d, di); + } + } + } + hash_unlock(ht); + } + else + { + vimvars[VV_KEY].vv_type = VAR_NUMBER; + + for (li = l->lv_first; li != NULL; li = nli) + { + if (map && tv_check_lock(li->li_tv.v_lock, arg_errmsg, TRUE)) + break; + nli = li->li_next; + vimvars[VV_KEY].vv_nr = idx; + if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL + || did_emsg) + break; + if (!map && rem) + listitem_remove(l, li); + ++idx; + } + } + + restore_vimvar(VV_KEY, &save_key); + restore_vimvar(VV_VAL, &save_val); + + did_emsg |= save_did_emsg; + } + + copy_tv(&argvars[0], rettv); +} + #endif /* defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) */ diff --git a/src/evalfunc.c b/src/evalfunc.c new file mode 100644 index 0000000000..9397577d4f --- /dev/null +++ b/src/evalfunc.c @@ -0,0 +1,14028 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * evalfunc.c: Builtin functions + */ +#define USING_FLOAT_STUFF + +#include "vim.h" + +#if defined(FEAT_EVAL) || defined(PROTO) + +#ifdef AMIGA +# include <time.h> /* for strftime() */ +#endif + +#ifdef VMS +# include <float.h> +#endif + +#ifdef MACOS_X +# include <time.h> /* for time_t */ +#endif + +static char *e_listarg = N_("E686: Argument of %s must be a List"); +#ifdef FEAT_QUICKFIX +static char *e_stringreq = N_("E928: String required"); +#endif + +#ifdef FEAT_FLOAT +static void f_abs(typval_T *argvars, typval_T *rettv); +static void f_acos(typval_T *argvars, typval_T *rettv); +#endif +static void f_add(typval_T *argvars, typval_T *rettv); +static void f_and(typval_T *argvars, typval_T *rettv); +static void f_append(typval_T *argvars, typval_T *rettv); +static void f_appendbufline(typval_T *argvars, typval_T *rettv); +static void f_argc(typval_T *argvars, typval_T *rettv); +static void f_argidx(typval_T *argvars, typval_T *rettv); +static void f_arglistid(typval_T *argvars, typval_T *rettv); +static void f_argv(typval_T *argvars, typval_T *rettv); +static void f_assert_beeps(typval_T *argvars, typval_T *rettv); +static void f_assert_equal(typval_T *argvars, typval_T *rettv); +static void f_assert_equalfile(typval_T *argvars, typval_T *rettv); +static void f_assert_exception(typval_T *argvars, typval_T *rettv); +static void f_assert_fails(typval_T *argvars, typval_T *rettv); +static void f_assert_false(typval_T *argvars, typval_T *rettv); +static void f_assert_inrange(typval_T *argvars, typval_T *rettv); +static void f_assert_match(typval_T *argvars, typval_T *rettv); +static void f_assert_notequal(typval_T *argvars, typval_T *rettv); +static void f_assert_notmatch(typval_T *argvars, typval_T *rettv); +static void f_assert_report(typval_T *argvars, typval_T *rettv); +static void f_assert_true(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_asin(typval_T *argvars, typval_T *rettv); +static void f_atan(typval_T *argvars, typval_T *rettv); +static void f_atan2(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_BEVAL +static void f_balloon_show(typval_T *argvars, typval_T *rettv); +# if defined(FEAT_BEVAL_TERM) +static void f_balloon_split(typval_T *argvars, typval_T *rettv); +# endif +#endif +static void f_browse(typval_T *argvars, typval_T *rettv); +static void f_browsedir(typval_T *argvars, typval_T *rettv); +static void f_bufexists(typval_T *argvars, typval_T *rettv); +static void f_buflisted(typval_T *argvars, typval_T *rettv); +static void f_bufloaded(typval_T *argvars, typval_T *rettv); +static void f_bufname(typval_T *argvars, typval_T *rettv); +static void f_bufnr(typval_T *argvars, typval_T *rettv); +static void f_bufwinid(typval_T *argvars, typval_T *rettv); +static void f_bufwinnr(typval_T *argvars, typval_T *rettv); +static void f_byte2line(typval_T *argvars, typval_T *rettv); +static void byteidx(typval_T *argvars, typval_T *rettv, int comp); +static void f_byteidx(typval_T *argvars, typval_T *rettv); +static void f_byteidxcomp(typval_T *argvars, typval_T *rettv); +static void f_call(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_ceil(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_JOB_CHANNEL +static void f_ch_canread(typval_T *argvars, typval_T *rettv); +static void f_ch_close(typval_T *argvars, typval_T *rettv); +static void f_ch_close_in(typval_T *argvars, typval_T *rettv); +static void f_ch_evalexpr(typval_T *argvars, typval_T *rettv); +static void f_ch_evalraw(typval_T *argvars, typval_T *rettv); +static void f_ch_getbufnr(typval_T *argvars, typval_T *rettv); +static void f_ch_getjob(typval_T *argvars, typval_T *rettv); +static void f_ch_info(typval_T *argvars, typval_T *rettv); +static void f_ch_log(typval_T *argvars, typval_T *rettv); +static void f_ch_logfile(typval_T *argvars, typval_T *rettv); +static void f_ch_open(typval_T *argvars, typval_T *rettv); +static void f_ch_read(typval_T *argvars, typval_T *rettv); +static void f_ch_readraw(typval_T *argvars, typval_T *rettv); +static void f_ch_sendexpr(typval_T *argvars, typval_T *rettv); +static void f_ch_sendraw(typval_T *argvars, typval_T *rettv); +static void f_ch_setoptions(typval_T *argvars, typval_T *rettv); +static void f_ch_status(typval_T *argvars, typval_T *rettv); +#endif +static void f_changenr(typval_T *argvars, typval_T *rettv); +static void f_char2nr(typval_T *argvars, typval_T *rettv); +static void f_cindent(typval_T *argvars, typval_T *rettv); +static void f_clearmatches(typval_T *argvars, typval_T *rettv); +static void f_col(typval_T *argvars, typval_T *rettv); +#if defined(FEAT_INS_EXPAND) +static void f_complete(typval_T *argvars, typval_T *rettv); +static void f_complete_add(typval_T *argvars, typval_T *rettv); +static void f_complete_check(typval_T *argvars, typval_T *rettv); +#endif +static void f_confirm(typval_T *argvars, typval_T *rettv); +static void f_copy(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_cos(typval_T *argvars, typval_T *rettv); +static void f_cosh(typval_T *argvars, typval_T *rettv); +#endif +static void f_count(typval_T *argvars, typval_T *rettv); +static void f_cscope_connection(typval_T *argvars, typval_T *rettv); +static void f_cursor(typval_T *argsvars, typval_T *rettv); +static void f_deepcopy(typval_T *argvars, typval_T *rettv); +static void f_delete(typval_T *argvars, typval_T *rettv); +static void f_deletebufline(typval_T *argvars, typval_T *rettv); +static void f_did_filetype(typval_T *argvars, typval_T *rettv); +static void f_diff_filler(typval_T *argvars, typval_T *rettv); +static void f_diff_hlID(typval_T *argvars, typval_T *rettv); +static void f_empty(typval_T *argvars, typval_T *rettv); +static void f_escape(typval_T *argvars, typval_T *rettv); +static void f_eval(typval_T *argvars, typval_T *rettv); +static void f_eventhandler(typval_T *argvars, typval_T *rettv); +static void f_executable(typval_T *argvars, typval_T *rettv); +static void f_execute(typval_T *argvars, typval_T *rettv); +static void f_exepath(typval_T *argvars, typval_T *rettv); +static void f_exists(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_exp(typval_T *argvars, typval_T *rettv); +#endif +static void f_expand(typval_T *argvars, typval_T *rettv); +static void f_extend(typval_T *argvars, typval_T *rettv); +static void f_feedkeys(typval_T *argvars, typval_T *rettv); +static void f_filereadable(typval_T *argvars, typval_T *rettv); +static void f_filewritable(typval_T *argvars, typval_T *rettv); +static void f_filter(typval_T *argvars, typval_T *rettv); +static void f_finddir(typval_T *argvars, typval_T *rettv); +static void f_findfile(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_float2nr(typval_T *argvars, typval_T *rettv); +static void f_floor(typval_T *argvars, typval_T *rettv); +static void f_fmod(typval_T *argvars, typval_T *rettv); +#endif +static void f_fnameescape(typval_T *argvars, typval_T *rettv); +static void f_fnamemodify(typval_T *argvars, typval_T *rettv); +static void f_foldclosed(typval_T *argvars, typval_T *rettv); +static void f_foldclosedend(typval_T *argvars, typval_T *rettv); +static void f_foldlevel(typval_T *argvars, typval_T *rettv); +static void f_foldtext(typval_T *argvars, typval_T *rettv); +static void f_foldtextresult(typval_T *argvars, typval_T *rettv); +static void f_foreground(typval_T *argvars, typval_T *rettv); +static void f_funcref(typval_T *argvars, typval_T *rettv); +static void f_function(typval_T *argvars, typval_T *rettv); +static void f_garbagecollect(typval_T *argvars, typval_T *rettv); +static void f_get(typval_T *argvars, typval_T *rettv); +static void f_getbufinfo(typval_T *argvars, typval_T *rettv); +static void f_getbufline(typval_T *argvars, typval_T *rettv); +static void f_getbufvar(typval_T *argvars, typval_T *rettv); +static void f_getchangelist(typval_T *argvars, typval_T *rettv); +static void f_getchar(typval_T *argvars, typval_T *rettv); +static void f_getcharmod(typval_T *argvars, typval_T *rettv); +static void f_getcharsearch(typval_T *argvars, typval_T *rettv); +static void f_getcmdline(typval_T *argvars, typval_T *rettv); +#if defined(FEAT_CMDL_COMPL) +static void f_getcompletion(typval_T *argvars, typval_T *rettv); +#endif +static void f_getcmdpos(typval_T *argvars, typval_T *rettv); +static void f_getcmdtype(typval_T *argvars, typval_T *rettv); +static void f_getcmdwintype(typval_T *argvars, typval_T *rettv); +static void f_getcwd(typval_T *argvars, typval_T *rettv); +static void f_getfontname(typval_T *argvars, typval_T *rettv); +static void f_getfperm(typval_T *argvars, typval_T *rettv); +static void f_getfsize(typval_T *argvars, typval_T *rettv); +static void f_getftime(typval_T *argvars, typval_T *rettv); +static void f_getftype(typval_T *argvars, typval_T *rettv); +static void f_getjumplist(typval_T *argvars, typval_T *rettv); +static void f_getline(typval_T *argvars, typval_T *rettv); +static void f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED); +static void f_getmatches(typval_T *argvars, typval_T *rettv); +static void f_getpid(typval_T *argvars, typval_T *rettv); +static void f_getcurpos(typval_T *argvars, typval_T *rettv); +static void f_getpos(typval_T *argvars, typval_T *rettv); +static void f_getqflist(typval_T *argvars, typval_T *rettv); +static void f_getreg(typval_T *argvars, typval_T *rettv); +static void f_getregtype(typval_T *argvars, typval_T *rettv); +static void f_gettabinfo(typval_T *argvars, typval_T *rettv); +static void f_gettabvar(typval_T *argvars, typval_T *rettv); +static void f_gettabwinvar(typval_T *argvars, typval_T *rettv); +static void f_getwininfo(typval_T *argvars, typval_T *rettv); +static void f_getwinpos(typval_T *argvars, typval_T *rettv); +static void f_getwinposx(typval_T *argvars, typval_T *rettv); +static void f_getwinposy(typval_T *argvars, typval_T *rettv); +static void f_getwinvar(typval_T *argvars, typval_T *rettv); +static void f_glob(typval_T *argvars, typval_T *rettv); +static void f_globpath(typval_T *argvars, typval_T *rettv); +static void f_glob2regpat(typval_T *argvars, typval_T *rettv); +static void f_has(typval_T *argvars, typval_T *rettv); +static void f_has_key(typval_T *argvars, typval_T *rettv); +static void f_haslocaldir(typval_T *argvars, typval_T *rettv); +static void f_hasmapto(typval_T *argvars, typval_T *rettv); +static void f_histadd(typval_T *argvars, typval_T *rettv); +static void f_histdel(typval_T *argvars, typval_T *rettv); +static void f_histget(typval_T *argvars, typval_T *rettv); +static void f_histnr(typval_T *argvars, typval_T *rettv); +static void f_hlID(typval_T *argvars, typval_T *rettv); +static void f_hlexists(typval_T *argvars, typval_T *rettv); +static void f_hostname(typval_T *argvars, typval_T *rettv); +static void f_iconv(typval_T *argvars, typval_T *rettv); +static void f_indent(typval_T *argvars, typval_T *rettv); +static void f_index(typval_T *argvars, typval_T *rettv); +static void f_input(typval_T *argvars, typval_T *rettv); +static void f_inputdialog(typval_T *argvars, typval_T *rettv); +static void f_inputlist(typval_T *argvars, typval_T *rettv); +static void f_inputrestore(typval_T *argvars, typval_T *rettv); +static void f_inputsave(typval_T *argvars, typval_T *rettv); +static void f_inputsecret(typval_T *argvars, typval_T *rettv); +static void f_insert(typval_T *argvars, typval_T *rettv); +static void f_invert(typval_T *argvars, typval_T *rettv); +static void f_isdirectory(typval_T *argvars, typval_T *rettv); +static void f_islocked(typval_T *argvars, typval_T *rettv); +#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) +static void f_isnan(typval_T *argvars, typval_T *rettv); +#endif +static void f_items(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_JOB_CHANNEL +static void f_job_getchannel(typval_T *argvars, typval_T *rettv); +static void f_job_info(typval_T *argvars, typval_T *rettv); +static void f_job_setoptions(typval_T *argvars, typval_T *rettv); +static void f_job_start(typval_T *argvars, typval_T *rettv); +static void f_job_stop(typval_T *argvars, typval_T *rettv); +static void f_job_status(typval_T *argvars, typval_T *rettv); +#endif +static void f_join(typval_T *argvars, typval_T *rettv); +static void f_js_decode(typval_T *argvars, typval_T *rettv); +static void f_js_encode(typval_T *argvars, typval_T *rettv); +static void f_json_decode(typval_T *argvars, typval_T *rettv); +static void f_json_encode(typval_T *argvars, typval_T *rettv); +static void f_keys(typval_T *argvars, typval_T *rettv); +static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv); +static void f_len(typval_T *argvars, typval_T *rettv); +static void f_libcall(typval_T *argvars, typval_T *rettv); +static void f_libcallnr(typval_T *argvars, typval_T *rettv); +static void f_line(typval_T *argvars, typval_T *rettv); +static void f_line2byte(typval_T *argvars, typval_T *rettv); +static void f_lispindent(typval_T *argvars, typval_T *rettv); +static void f_localtime(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_log(typval_T *argvars, typval_T *rettv); +static void f_log10(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_LUA +static void f_luaeval(typval_T *argvars, typval_T *rettv); +#endif +static void f_map(typval_T *argvars, typval_T *rettv); +static void f_maparg(typval_T *argvars, typval_T *rettv); +static void f_mapcheck(typval_T *argvars, typval_T *rettv); +static void f_match(typval_T *argvars, typval_T *rettv); +static void f_matchadd(typval_T *argvars, typval_T *rettv); +static void f_matchaddpos(typval_T *argvars, typval_T *rettv); +static void f_matcharg(typval_T *argvars, typval_T *rettv); +static void f_matchdelete(typval_T *argvars, typval_T *rettv); +static void f_matchend(typval_T *argvars, typval_T *rettv); +static void f_matchlist(typval_T *argvars, typval_T *rettv); +static void f_matchstr(typval_T *argvars, typval_T *rettv); +static void f_matchstrpos(typval_T *argvars, typval_T *rettv); +static void f_max(typval_T *argvars, typval_T *rettv); +static void f_migemo(typval_T *argvars, typval_T *rettv); +static void f_min(typval_T *argvars, typval_T *rettv); +#ifdef vim_mkdir +static void f_mkdir(typval_T *argvars, typval_T *rettv); +#endif +static void f_mode(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_MZSCHEME +static void f_mzeval(typval_T *argvars, typval_T *rettv); +#endif +static void f_nextnonblank(typval_T *argvars, typval_T *rettv); +static void f_nr2char(typval_T *argvars, typval_T *rettv); +static void f_or(typval_T *argvars, typval_T *rettv); +static void f_pathshorten(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_PERL +static void f_perleval(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_FLOAT +static void f_pow(typval_T *argvars, typval_T *rettv); +#endif +static void f_prevnonblank(typval_T *argvars, typval_T *rettv); +static void f_printf(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_JOB_CHANNEL +static void f_prompt_setcallback(typval_T *argvars, typval_T *rettv); +static void f_prompt_setinterrupt(typval_T *argvars, typval_T *rettv); +static void f_prompt_setprompt(typval_T *argvars, typval_T *rettv); +#endif +static void f_pumvisible(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_PYTHON3 +static void f_py3eval(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_PYTHON +static void f_pyeval(typval_T *argvars, typval_T *rettv); +#endif +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) +static void f_pyxeval(typval_T *argvars, typval_T *rettv); +#endif +static void f_range(typval_T *argvars, typval_T *rettv); +static void f_readfile(typval_T *argvars, typval_T *rettv); +static void f_reg_executing(typval_T *argvars, typval_T *rettv); +static void f_reg_recording(typval_T *argvars, typval_T *rettv); +static void f_reltime(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_reltimefloat(typval_T *argvars, typval_T *rettv); +#endif +static void f_reltimestr(typval_T *argvars, typval_T *rettv); +static void f_remote_expr(typval_T *argvars, typval_T *rettv); +static void f_remote_foreground(typval_T *argvars, typval_T *rettv); +static void f_remote_peek(typval_T *argvars, typval_T *rettv); +static void f_remote_read(typval_T *argvars, typval_T *rettv); +static void f_remote_send(typval_T *argvars, typval_T *rettv); +static void f_remote_startserver(typval_T *argvars, typval_T *rettv); +static void f_remove(typval_T *argvars, typval_T *rettv); +static void f_rename(typval_T *argvars, typval_T *rettv); +static void f_repeat(typval_T *argvars, typval_T *rettv); +static void f_resolve(typval_T *argvars, typval_T *rettv); +static void f_reverse(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_round(typval_T *argvars, typval_T *rettv); +#endif +static void f_screenattr(typval_T *argvars, typval_T *rettv); +static void f_screenchar(typval_T *argvars, typval_T *rettv); +static void f_screencol(typval_T *argvars, typval_T *rettv); +static void f_screenrow(typval_T *argvars, typval_T *rettv); +static void f_search(typval_T *argvars, typval_T *rettv); +static void f_searchdecl(typval_T *argvars, typval_T *rettv); +static void f_searchpair(typval_T *argvars, typval_T *rettv); +static void f_searchpairpos(typval_T *argvars, typval_T *rettv); +static void f_searchpos(typval_T *argvars, typval_T *rettv); +static void f_server2client(typval_T *argvars, typval_T *rettv); +static void f_serverlist(typval_T *argvars, typval_T *rettv); +static void f_setbufline(typval_T *argvars, typval_T *rettv); +static void f_setbufvar(typval_T *argvars, typval_T *rettv); +static void f_setcharsearch(typval_T *argvars, typval_T *rettv); +static void f_setcmdpos(typval_T *argvars, typval_T *rettv); +static void f_setfperm(typval_T *argvars, typval_T *rettv); +static void f_setline(typval_T *argvars, typval_T *rettv); +static void f_setloclist(typval_T *argvars, typval_T *rettv); +static void f_setmatches(typval_T *argvars, typval_T *rettv); +static void f_setpos(typval_T *argvars, typval_T *rettv); +static void f_setqflist(typval_T *argvars, typval_T *rettv); +static void f_setreg(typval_T *argvars, typval_T *rettv); +static void f_settabvar(typval_T *argvars, typval_T *rettv); +static void f_settabwinvar(typval_T *argvars, typval_T *rettv); +static void f_setwinvar(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_CRYPT +static void f_sha256(typval_T *argvars, typval_T *rettv); +#endif /* FEAT_CRYPT */ +static void f_shellescape(typval_T *argvars, typval_T *rettv); +static void f_shiftwidth(typval_T *argvars, typval_T *rettv); +static void f_simplify(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_sin(typval_T *argvars, typval_T *rettv); +static void f_sinh(typval_T *argvars, typval_T *rettv); +#endif +static void f_sort(typval_T *argvars, typval_T *rettv); +static void f_soundfold(typval_T *argvars, typval_T *rettv); +static void f_spellbadword(typval_T *argvars, typval_T *rettv); +static void f_spellsuggest(typval_T *argvars, typval_T *rettv); +static void f_split(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_sqrt(typval_T *argvars, typval_T *rettv); +static void f_str2float(typval_T *argvars, typval_T *rettv); +#endif +static void f_str2nr(typval_T *argvars, typval_T *rettv); +static void f_strchars(typval_T *argvars, typval_T *rettv); +#ifdef HAVE_STRFTIME +static void f_strftime(typval_T *argvars, typval_T *rettv); +#endif +static void f_strgetchar(typval_T *argvars, typval_T *rettv); +static void f_stridx(typval_T *argvars, typval_T *rettv); +static void f_string(typval_T *argvars, typval_T *rettv); +static void f_strlen(typval_T *argvars, typval_T *rettv); +static void f_strcharpart(typval_T *argvars, typval_T *rettv); +static void f_strpart(typval_T *argvars, typval_T *rettv); +static void f_strridx(typval_T *argvars, typval_T *rettv); +static void f_strtrans(typval_T *argvars, typval_T *rettv); +static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv); +static void f_strwidth(typval_T *argvars, typval_T *rettv); +static void f_submatch(typval_T *argvars, typval_T *rettv); +static void f_substitute(typval_T *argvars, typval_T *rettv); +static void f_synID(typval_T *argvars, typval_T *rettv); +static void f_synIDattr(typval_T *argvars, typval_T *rettv); +static void f_synIDtrans(typval_T *argvars, typval_T *rettv); +static void f_synstack(typval_T *argvars, typval_T *rettv); +static void f_synconcealed(typval_T *argvars, typval_T *rettv); +static void f_system(typval_T *argvars, typval_T *rettv); +static void f_systemlist(typval_T *argvars, typval_T *rettv); +static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv); +static void f_tabpagenr(typval_T *argvars, typval_T *rettv); +static void f_tabpagewinnr(typval_T *argvars, typval_T *rettv); +static void f_taglist(typval_T *argvars, typval_T *rettv); +static void f_tagfiles(typval_T *argvars, typval_T *rettv); +static void f_tempname(typval_T *argvars, typval_T *rettv); +static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv); +static void f_test_autochdir(typval_T *argvars, typval_T *rettv); +static void f_test_feedinput(typval_T *argvars, typval_T *rettv); +static void f_test_override(typval_T *argvars, typval_T *rettv); +static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv); +static void f_test_ignore_error(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_JOB_CHANNEL +static void f_test_null_channel(typval_T *argvars, typval_T *rettv); +#endif +static void f_test_null_dict(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_JOB_CHANNEL +static void f_test_null_job(typval_T *argvars, typval_T *rettv); +#endif +static void f_test_null_list(typval_T *argvars, typval_T *rettv); +static void f_test_null_partial(typval_T *argvars, typval_T *rettv); +static void f_test_null_string(typval_T *argvars, typval_T *rettv); +static void f_test_settime(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_tan(typval_T *argvars, typval_T *rettv); +static void f_tanh(typval_T *argvars, typval_T *rettv); +#endif +#ifdef FEAT_TIMERS +static void f_timer_info(typval_T *argvars, typval_T *rettv); +static void f_timer_pause(typval_T *argvars, typval_T *rettv); +static void f_timer_start(typval_T *argvars, typval_T *rettv); +static void f_timer_stop(typval_T *argvars, typval_T *rettv); +static void f_timer_stopall(typval_T *argvars, typval_T *rettv); +#endif +static void f_tolower(typval_T *argvars, typval_T *rettv); +static void f_toupper(typval_T *argvars, typval_T *rettv); +static void f_tr(typval_T *argvars, typval_T *rettv); +static void f_trim(typval_T *argvars, typval_T *rettv); +#ifdef FEAT_FLOAT +static void f_trunc(typval_T *argvars, typval_T *rettv); +#endif +static void f_type(typval_T *argvars, typval_T *rettv); +static void f_undofile(typval_T *argvars, typval_T *rettv); +static void f_undotree(typval_T *argvars, typval_T *rettv); +static void f_uniq(typval_T *argvars, typval_T *rettv); +static void f_values(typval_T *argvars, typval_T *rettv); +static void f_virtcol(typval_T *argvars, typval_T *rettv); +static void f_visualmode(typval_T *argvars, typval_T *rettv); +static void f_wildmenumode(typval_T *argvars, typval_T *rettv); +static void f_win_findbuf(typval_T *argvars, typval_T *rettv); +static void f_win_getid(typval_T *argvars, typval_T *rettv); +static void f_win_gotoid(typval_T *argvars, typval_T *rettv); +static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv); +static void f_win_id2win(typval_T *argvars, typval_T *rettv); +static void f_win_screenpos(typval_T *argvars, typval_T *rettv); +static void f_winbufnr(typval_T *argvars, typval_T *rettv); +static void f_wincol(typval_T *argvars, typval_T *rettv); +static void f_winheight(typval_T *argvars, typval_T *rettv); +static void f_winline(typval_T *argvars, typval_T *rettv); +static void f_winnr(typval_T *argvars, typval_T *rettv); +static void f_winrestcmd(typval_T *argvars, typval_T *rettv); +static void f_winrestview(typval_T *argvars, typval_T *rettv); +static void f_winsaveview(typval_T *argvars, typval_T *rettv); +static void f_winwidth(typval_T *argvars, typval_T *rettv); +static void f_writefile(typval_T *argvars, typval_T *rettv); +static void f_wordcount(typval_T *argvars, typval_T *rettv); +static void f_xor(typval_T *argvars, typval_T *rettv); + +/* + * Array with names and number of arguments of all internal functions + * MUST BE KEPT SORTED IN strcmp() ORDER FOR BINARY SEARCH! + */ +static struct fst +{ + char *f_name; /* function name */ + char f_min_argc; /* minimal number of arguments */ + char f_max_argc; /* maximal number of arguments */ + void (*f_func)(typval_T *args, typval_T *rvar); + /* implementation of function */ +} functions[] = +{ +#ifdef FEAT_FLOAT + {"abs", 1, 1, f_abs}, + {"acos", 1, 1, f_acos}, /* WJMc */ +#endif + {"add", 2, 2, f_add}, + {"and", 2, 2, f_and}, + {"append", 2, 2, f_append}, + {"appendbufline", 3, 3, f_appendbufline}, + {"argc", 0, 0, f_argc}, + {"argidx", 0, 0, f_argidx}, + {"arglistid", 0, 2, f_arglistid}, + {"argv", 0, 1, f_argv}, +#ifdef FEAT_FLOAT + {"asin", 1, 1, f_asin}, /* WJMc */ +#endif + {"assert_beeps", 1, 2, f_assert_beeps}, + {"assert_equal", 2, 3, f_assert_equal}, + {"assert_equalfile", 2, 2, f_assert_equalfile}, + {"assert_exception", 1, 2, f_assert_exception}, + {"assert_fails", 1, 2, f_assert_fails}, + {"assert_false", 1, 2, f_assert_false}, + {"assert_inrange", 3, 4, f_assert_inrange}, + {"assert_match", 2, 3, f_assert_match}, + {"assert_notequal", 2, 3, f_assert_notequal}, + {"assert_notmatch", 2, 3, f_assert_notmatch}, + {"assert_report", 1, 1, f_assert_report}, + {"assert_true", 1, 2, f_assert_true}, +#ifdef FEAT_FLOAT + {"atan", 1, 1, f_atan}, + {"atan2", 2, 2, f_atan2}, +#endif +#ifdef FEAT_BEVAL + {"balloon_show", 1, 1, f_balloon_show}, +# if defined(FEAT_BEVAL_TERM) + {"balloon_split", 1, 1, f_balloon_split}, +# endif +#endif + {"browse", 4, 4, f_browse}, + {"browsedir", 2, 2, f_browsedir}, + {"bufexists", 1, 1, f_bufexists}, + {"buffer_exists", 1, 1, f_bufexists}, /* obsolete */ + {"buffer_name", 1, 1, f_bufname}, /* obsolete */ + {"buffer_number", 1, 1, f_bufnr}, /* obsolete */ + {"buflisted", 1, 1, f_buflisted}, + {"bufloaded", 1, 1, f_bufloaded}, + {"bufname", 1, 1, f_bufname}, + {"bufnr", 1, 2, f_bufnr}, + {"bufwinid", 1, 1, f_bufwinid}, + {"bufwinnr", 1, 1, f_bufwinnr}, + {"byte2line", 1, 1, f_byte2line}, + {"byteidx", 2, 2, f_byteidx}, + {"byteidxcomp", 2, 2, f_byteidxcomp}, + {"call", 2, 3, f_call}, +#ifdef FEAT_FLOAT + {"ceil", 1, 1, f_ceil}, +#endif +#ifdef FEAT_JOB_CHANNEL + {"ch_canread", 1, 1, f_ch_canread}, + {"ch_close", 1, 1, f_ch_close}, + {"ch_close_in", 1, 1, f_ch_close_in}, + {"ch_evalexpr", 2, 3, f_ch_evalexpr}, + {"ch_evalraw", 2, 3, f_ch_evalraw}, + {"ch_getbufnr", 2, 2, f_ch_getbufnr}, + {"ch_getjob", 1, 1, f_ch_getjob}, + {"ch_info", 1, 1, f_ch_info}, + {"ch_log", 1, 2, f_ch_log}, + {"ch_logfile", 1, 2, f_ch_logfile}, + {"ch_open", 1, 2, f_ch_open}, + {"ch_read", 1, 2, f_ch_read}, + {"ch_readraw", 1, 2, f_ch_readraw}, + {"ch_sendexpr", 2, 3, f_ch_sendexpr}, + {"ch_sendraw", 2, 3, f_ch_sendraw}, + {"ch_setoptions", 2, 2, f_ch_setoptions}, + {"ch_status", 1, 2, f_ch_status}, +#endif + {"changenr", 0, 0, f_changenr}, + {"char2nr", 1, 2, f_char2nr}, + {"cindent", 1, 1, f_cindent}, + {"clearmatches", 0, 0, f_clearmatches}, + {"col", 1, 1, f_col}, +#if defined(FEAT_INS_EXPAND) + {"complete", 2, 2, f_complete}, + {"complete_add", 1, 1, f_complete_add}, + {"complete_check", 0, 0, f_complete_check}, +#endif + {"confirm", 1, 4, f_confirm}, + {"copy", 1, 1, f_copy}, +#ifdef FEAT_FLOAT + {"cos", 1, 1, f_cos}, + {"cosh", 1, 1, f_cosh}, +#endif + {"count", 2, 4, f_count}, + {"cscope_connection",0,3, f_cscope_connection}, + {"cursor", 1, 3, f_cursor}, + {"deepcopy", 1, 2, f_deepcopy}, + {"delete", 1, 2, f_delete}, + {"deletebufline", 2, 3, f_deletebufline}, + {"did_filetype", 0, 0, f_did_filetype}, + {"diff_filler", 1, 1, f_diff_filler}, + {"diff_hlID", 2, 2, f_diff_hlID}, + {"empty", 1, 1, f_empty}, + {"escape", 2, 2, f_escape}, + {"eval", 1, 1, f_eval}, + {"eventhandler", 0, 0, f_eventhandler}, + {"executable", 1, 1, f_executable}, + {"execute", 1, 2, f_execute}, + {"exepath", 1, 1, f_exepath}, + {"exists", 1, 1, f_exists}, +#ifdef FEAT_FLOAT + {"exp", 1, 1, f_exp}, +#endif + {"expand", 1, 3, f_expand}, + {"extend", 2, 3, f_extend}, + {"feedkeys", 1, 2, f_feedkeys}, + {"file_readable", 1, 1, f_filereadable}, /* obsolete */ + {"filereadable", 1, 1, f_filereadable}, + {"filewritable", 1, 1, f_filewritable}, + {"filter", 2, 2, f_filter}, + {"finddir", 1, 3, f_finddir}, + {"findfile", 1, 3, f_findfile}, +#ifdef FEAT_FLOAT + {"float2nr", 1, 1, f_float2nr}, + {"floor", 1, 1, f_floor}, + {"fmod", 2, 2, f_fmod}, +#endif + {"fnameescape", 1, 1, f_fnameescape}, + {"fnamemodify", 2, 2, f_fnamemodify}, + {"foldclosed", 1, 1, f_foldclosed}, + {"foldclosedend", 1, 1, f_foldclosedend}, + {"foldlevel", 1, 1, f_foldlevel}, + {"foldtext", 0, 0, f_foldtext}, + {"foldtextresult", 1, 1, f_foldtextresult}, + {"foreground", 0, 0, f_foreground}, + {"funcref", 1, 3, f_funcref}, + {"function", 1, 3, f_function}, + {"garbagecollect", 0, 1, f_garbagecollect}, + {"get", 2, 3, f_get}, + {"getbufinfo", 0, 1, f_getbufinfo}, + {"getbufline", 2, 3, f_getbufline}, + {"getbufvar", 2, 3, f_getbufvar}, + {"getchangelist", 1, 1, f_getchangelist}, + {"getchar", 0, 1, f_getchar}, + {"getcharmod", 0, 0, f_getcharmod}, + {"getcharsearch", 0, 0, f_getcharsearch}, + {"getcmdline", 0, 0, f_getcmdline}, + {"getcmdpos", 0, 0, f_getcmdpos}, + {"getcmdtype", 0, 0, f_getcmdtype}, + {"getcmdwintype", 0, 0, f_getcmdwintype}, +#if defined(FEAT_CMDL_COMPL) + {"getcompletion", 2, 3, f_getcompletion}, +#endif + {"getcurpos", 0, 0, f_getcurpos}, + {"getcwd", 0, 2, f_getcwd}, + {"getfontname", 0, 1, f_getfontname}, + {"getfperm", 1, 1, f_getfperm}, + {"getfsize", 1, 1, f_getfsize}, + {"getftime", 1, 1, f_getftime}, + {"getftype", 1, 1, f_getftype}, + {"getjumplist", 0, 2, f_getjumplist}, + {"getline", 1, 2, f_getline}, + {"getloclist", 1, 2, f_getloclist}, + {"getmatches", 0, 0, f_getmatches}, + {"getpid", 0, 0, f_getpid}, + {"getpos", 1, 1, f_getpos}, + {"getqflist", 0, 1, f_getqflist}, + {"getreg", 0, 3, f_getreg}, + {"getregtype", 0, 1, f_getregtype}, + {"gettabinfo", 0, 1, f_gettabinfo}, + {"gettabvar", 2, 3, f_gettabvar}, + {"gettabwinvar", 3, 4, f_gettabwinvar}, + {"getwininfo", 0, 1, f_getwininfo}, + {"getwinpos", 0, 1, f_getwinpos}, + {"getwinposx", 0, 0, f_getwinposx}, + {"getwinposy", 0, 0, f_getwinposy}, + {"getwinvar", 2, 3, f_getwinvar}, + {"glob", 1, 4, f_glob}, + {"glob2regpat", 1, 1, f_glob2regpat}, + {"globpath", 2, 5, f_globpath}, + {"has", 1, 1, f_has}, + {"has_key", 2, 2, f_has_key}, + {"haslocaldir", 0, 2, f_haslocaldir}, + {"hasmapto", 1, 3, f_hasmapto}, + {"highlightID", 1, 1, f_hlID}, /* obsolete */ + {"highlight_exists",1, 1, f_hlexists}, /* obsolete */ + {"histadd", 2, 2, f_histadd}, + {"histdel", 1, 2, f_histdel}, + {"histget", 1, 2, f_histget}, + {"histnr", 1, 1, f_histnr}, + {"hlID", 1, 1, f_hlID}, + {"hlexists", 1, 1, f_hlexists}, + {"hostname", 0, 0, f_hostname}, + {"iconv", 3, 3, f_iconv}, + {"indent", 1, 1, f_indent}, + {"index", 2, 4, f_index}, + {"input", 1, 3, f_input}, + {"inputdialog", 1, 3, f_inputdialog}, + {"inputlist", 1, 1, f_inputlist}, + {"inputrestore", 0, 0, f_inputrestore}, + {"inputsave", 0, 0, f_inputsave}, + {"inputsecret", 1, 2, f_inputsecret}, + {"insert", 2, 3, f_insert}, + {"invert", 1, 1, f_invert}, + {"isdirectory", 1, 1, f_isdirectory}, + {"islocked", 1, 1, f_islocked}, +#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) + {"isnan", 1, 1, f_isnan}, +#endif + {"items", 1, 1, f_items}, +#ifdef FEAT_JOB_CHANNEL + {"job_getchannel", 1, 1, f_job_getchannel}, + {"job_info", 0, 1, f_job_info}, + {"job_setoptions", 2, 2, f_job_setoptions}, + {"job_start", 1, 2, f_job_start}, + {"job_status", 1, 1, f_job_status}, + {"job_stop", 1, 2, f_job_stop}, +#endif + {"join", 1, 2, f_join}, + {"js_decode", 1, 1, f_js_decode}, + {"js_encode", 1, 1, f_js_encode}, + {"json_decode", 1, 1, f_json_decode}, + {"json_encode", 1, 1, f_json_encode}, + {"keys", 1, 1, f_keys}, + {"last_buffer_nr", 0, 0, f_last_buffer_nr},/* obsolete */ + {"len", 1, 1, f_len}, + {"libcall", 3, 3, f_libcall}, + {"libcallnr", 3, 3, f_libcallnr}, + {"line", 1, 1, f_line}, + {"line2byte", 1, 1, f_line2byte}, + {"lispindent", 1, 1, f_lispindent}, + {"localtime", 0, 0, f_localtime}, +#ifdef FEAT_FLOAT + {"log", 1, 1, f_log}, + {"log10", 1, 1, f_log10}, +#endif +#ifdef FEAT_LUA + {"luaeval", 1, 2, f_luaeval}, +#endif + {"map", 2, 2, f_map}, + {"maparg", 1, 4, f_maparg}, + {"mapcheck", 1, 3, f_mapcheck}, + {"match", 2, 4, f_match}, + {"matchadd", 2, 5, f_matchadd}, + {"matchaddpos", 2, 5, f_matchaddpos}, + {"matcharg", 1, 1, f_matcharg}, + {"matchdelete", 1, 1, f_matchdelete}, + {"matchend", 2, 4, f_matchend}, + {"matchlist", 2, 4, f_matchlist}, + {"matchstr", 2, 4, f_matchstr}, + {"matchstrpos", 2, 4, f_matchstrpos}, + {"max", 1, 1, f_max}, + {"migemo", 1, 1, f_migemo}, + {"min", 1, 1, f_min}, +#ifdef vim_mkdir + {"mkdir", 1, 3, f_mkdir}, +#endif + {"mode", 0, 1, f_mode}, +#ifdef FEAT_MZSCHEME + {"mzeval", 1, 1, f_mzeval}, +#endif + {"nextnonblank", 1, 1, f_nextnonblank}, + {"nr2char", 1, 2, f_nr2char}, + {"or", 2, 2, f_or}, + {"pathshorten", 1, 1, f_pathshorten}, +#ifdef FEAT_PERL + {"perleval", 1, 1, f_perleval}, +#endif +#ifdef FEAT_FLOAT + {"pow", 2, 2, f_pow}, +#endif + {"prevnonblank", 1, 1, f_prevnonblank}, + {"printf", 1, 19, f_printf}, +#ifdef FEAT_JOB_CHANNEL + {"prompt_setcallback", 2, 2, f_prompt_setcallback}, + {"prompt_setinterrupt", 2, 2, f_prompt_setinterrupt}, + {"prompt_setprompt", 2, 2, f_prompt_setprompt}, +#endif + {"pumvisible", 0, 0, f_pumvisible}, +#ifdef FEAT_PYTHON3 + {"py3eval", 1, 1, f_py3eval}, +#endif +#ifdef FEAT_PYTHON + {"pyeval", 1, 1, f_pyeval}, +#endif +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) + {"pyxeval", 1, 1, f_pyxeval}, +#endif + {"range", 1, 3, f_range}, + {"readfile", 1, 3, f_readfile}, + {"reg_executing", 0, 0, f_reg_executing}, + {"reg_recording", 0, 0, f_reg_recording}, + {"reltime", 0, 2, f_reltime}, +#ifdef FEAT_FLOAT + {"reltimefloat", 1, 1, f_reltimefloat}, +#endif + {"reltimestr", 1, 1, f_reltimestr}, + {"remote_expr", 2, 4, f_remote_expr}, + {"remote_foreground", 1, 1, f_remote_foreground}, + {"remote_peek", 1, 2, f_remote_peek}, + {"remote_read", 1, 2, f_remote_read}, + {"remote_send", 2, 3, f_remote_send}, + {"remote_startserver", 1, 1, f_remote_startserver}, + {"remove", 2, 3, f_remove}, + {"rename", 2, 2, f_rename}, + {"repeat", 2, 2, f_repeat}, + {"resolve", 1, 1, f_resolve}, + {"reverse", 1, 1, f_reverse}, +#ifdef FEAT_FLOAT + {"round", 1, 1, f_round}, +#endif + {"screenattr", 2, 2, f_screenattr}, + {"screenchar", 2, 2, f_screenchar}, + {"screencol", 0, 0, f_screencol}, + {"screenrow", 0, 0, f_screenrow}, + {"search", 1, 4, f_search}, + {"searchdecl", 1, 3, f_searchdecl}, + {"searchpair", 3, 7, f_searchpair}, + {"searchpairpos", 3, 7, f_searchpairpos}, + {"searchpos", 1, 4, f_searchpos}, + {"server2client", 2, 2, f_server2client}, + {"serverlist", 0, 0, f_serverlist}, + {"setbufline", 3, 3, f_setbufline}, + {"setbufvar", 3, 3, f_setbufvar}, + {"setcharsearch", 1, 1, f_setcharsearch}, + {"setcmdpos", 1, 1, f_setcmdpos}, + {"setfperm", 2, 2, f_setfperm}, + {"setline", 2, 2, f_setline}, + {"setloclist", 2, 4, f_setloclist}, + {"setmatches", 1, 1, f_setmatches}, + {"setpos", 2, 2, f_setpos}, + {"setqflist", 1, 3, f_setqflist}, + {"setreg", 2, 3, f_setreg}, + {"settabvar", 3, 3, f_settabvar}, + {"settabwinvar", 4, 4, f_settabwinvar}, + {"setwinvar", 3, 3, f_setwinvar}, +#ifdef FEAT_CRYPT + {"sha256", 1, 1, f_sha256}, +#endif + {"shellescape", 1, 2, f_shellescape}, + {"shiftwidth", 0, 0, f_shiftwidth}, + {"simplify", 1, 1, f_simplify}, +#ifdef FEAT_FLOAT + {"sin", 1, 1, f_sin}, + {"sinh", 1, 1, f_sinh}, +#endif + {"sort", 1, 3, f_sort}, + {"soundfold", 1, 1, f_soundfold}, + {"spellbadword", 0, 1, f_spellbadword}, + {"spellsuggest", 1, 3, f_spellsuggest}, + {"split", 1, 3, f_split}, +#ifdef FEAT_FLOAT + {"sqrt", 1, 1, f_sqrt}, + {"str2float", 1, 1, f_str2float}, +#endif + {"str2nr", 1, 2, f_str2nr}, + {"strcharpart", 2, 3, f_strcharpart}, + {"strchars", 1, 2, f_strchars}, + {"strdisplaywidth", 1, 2, f_strdisplaywidth}, +#ifdef HAVE_STRFTIME + {"strftime", 1, 2, f_strftime}, +#endif + {"strgetchar", 2, 2, f_strgetchar}, + {"stridx", 2, 3, f_stridx}, + {"string", 1, 1, f_string}, + {"strlen", 1, 1, f_strlen}, + {"strpart", 2, 3, f_strpart}, + {"strridx", 2, 3, f_strridx}, + {"strtrans", 1, 1, f_strtrans}, + {"strwidth", 1, 1, f_strwidth}, + {"submatch", 1, 2, f_submatch}, + {"substitute", 4, 4, f_substitute}, + {"synID", 3, 3, f_synID}, + {"synIDattr", 2, 3, f_synIDattr}, + {"synIDtrans", 1, 1, f_synIDtrans}, + {"synconcealed", 2, 2, f_synconcealed}, + {"synstack", 2, 2, f_synstack}, + {"system", 1, 2, f_system}, + {"systemlist", 1, 2, f_systemlist}, + {"tabpagebuflist", 0, 1, f_tabpagebuflist}, + {"tabpagenr", 0, 1, f_tabpagenr}, + {"tabpagewinnr", 1, 2, f_tabpagewinnr}, + {"tagfiles", 0, 0, f_tagfiles}, + {"taglist", 1, 2, f_taglist}, +#ifdef FEAT_FLOAT + {"tan", 1, 1, f_tan}, + {"tanh", 1, 1, f_tanh}, +#endif + {"tempname", 0, 0, f_tempname}, +#ifdef FEAT_TERMINAL + {"term_dumpdiff", 2, 3, f_term_dumpdiff}, + {"term_dumpload", 1, 2, f_term_dumpload}, + {"term_dumpwrite", 2, 3, f_term_dumpwrite}, + {"term_getaltscreen", 1, 1, f_term_getaltscreen}, +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + {"term_getansicolors", 1, 1, f_term_getansicolors}, +# endif + {"term_getattr", 2, 2, f_term_getattr}, + {"term_getcursor", 1, 1, f_term_getcursor}, + {"term_getjob", 1, 1, f_term_getjob}, + {"term_getline", 2, 2, f_term_getline}, + {"term_getscrolled", 1, 1, f_term_getscrolled}, + {"term_getsize", 1, 1, f_term_getsize}, + {"term_getstatus", 1, 1, f_term_getstatus}, + {"term_gettitle", 1, 1, f_term_gettitle}, + {"term_gettty", 1, 2, f_term_gettty}, + {"term_list", 0, 0, f_term_list}, + {"term_scrape", 2, 2, f_term_scrape}, + {"term_sendkeys", 2, 2, f_term_sendkeys}, +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + {"term_setansicolors", 2, 2, f_term_setansicolors}, +# endif + {"term_setkill", 2, 2, f_term_setkill}, + {"term_setrestore", 2, 2, f_term_setrestore}, + {"term_setsize", 3, 3, f_term_setsize}, + {"term_start", 1, 2, f_term_start}, + {"term_wait", 1, 2, f_term_wait}, +#endif + {"test_alloc_fail", 3, 3, f_test_alloc_fail}, + {"test_autochdir", 0, 0, f_test_autochdir}, + {"test_feedinput", 1, 1, f_test_feedinput}, + {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, + {"test_ignore_error", 1, 1, f_test_ignore_error}, +#ifdef FEAT_JOB_CHANNEL + {"test_null_channel", 0, 0, f_test_null_channel}, +#endif + {"test_null_dict", 0, 0, f_test_null_dict}, +#ifdef FEAT_JOB_CHANNEL + {"test_null_job", 0, 0, f_test_null_job}, +#endif + {"test_null_list", 0, 0, f_test_null_list}, + {"test_null_partial", 0, 0, f_test_null_partial}, + {"test_null_string", 0, 0, f_test_null_string}, + {"test_override", 2, 2, f_test_override}, + {"test_settime", 1, 1, f_test_settime}, +#ifdef FEAT_TIMERS + {"timer_info", 0, 1, f_timer_info}, + {"timer_pause", 2, 2, f_timer_pause}, + {"timer_start", 2, 3, f_timer_start}, + {"timer_stop", 1, 1, f_timer_stop}, + {"timer_stopall", 0, 0, f_timer_stopall}, +#endif + {"tolower", 1, 1, f_tolower}, + {"toupper", 1, 1, f_toupper}, + {"tr", 3, 3, f_tr}, + {"trim", 1, 2, f_trim}, +#ifdef FEAT_FLOAT + {"trunc", 1, 1, f_trunc}, +#endif + {"type", 1, 1, f_type}, + {"undofile", 1, 1, f_undofile}, + {"undotree", 0, 0, f_undotree}, + {"uniq", 1, 3, f_uniq}, + {"values", 1, 1, f_values}, + {"virtcol", 1, 1, f_virtcol}, + {"visualmode", 0, 1, f_visualmode}, + {"wildmenumode", 0, 0, f_wildmenumode}, + {"win_findbuf", 1, 1, f_win_findbuf}, + {"win_getid", 0, 2, f_win_getid}, + {"win_gotoid", 1, 1, f_win_gotoid}, + {"win_id2tabwin", 1, 1, f_win_id2tabwin}, + {"win_id2win", 1, 1, f_win_id2win}, + {"win_screenpos", 1, 1, f_win_screenpos}, + {"winbufnr", 1, 1, f_winbufnr}, + {"wincol", 0, 0, f_wincol}, + {"winheight", 1, 1, f_winheight}, + {"winline", 0, 0, f_winline}, + {"winnr", 0, 1, f_winnr}, + {"winrestcmd", 0, 0, f_winrestcmd}, + {"winrestview", 1, 1, f_winrestview}, + {"winsaveview", 0, 0, f_winsaveview}, + {"winwidth", 1, 1, f_winwidth}, + {"wordcount", 0, 0, f_wordcount}, + {"writefile", 2, 3, f_writefile}, + {"xor", 2, 2, f_xor}, +}; + +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) + +/* + * Function given to ExpandGeneric() to obtain the list of internal + * or user defined function names. + */ + char_u * +get_function_name(expand_T *xp, int idx) +{ + static int intidx = -1; + char_u *name; + + if (idx == 0) + intidx = -1; + if (intidx < 0) + { + name = get_user_func_name(xp, idx); + if (name != NULL) + return name; + } + if (++intidx < (int)(sizeof(functions) / sizeof(struct fst))) + { + STRCPY(IObuff, functions[intidx].f_name); + STRCAT(IObuff, "("); + if (functions[intidx].f_max_argc == 0) + STRCAT(IObuff, ")"); + return IObuff; + } + + return NULL; +} + +/* + * Function given to ExpandGeneric() to obtain the list of internal or + * user defined variable or function names. + */ + char_u * +get_expr_name(expand_T *xp, int idx) +{ + static int intidx = -1; + char_u *name; + + if (idx == 0) + intidx = -1; + if (intidx < 0) + { + name = get_function_name(xp, idx); + if (name != NULL) + return name; + } + return get_user_var_name(xp, ++intidx); +} + +#endif /* FEAT_CMDL_COMPL */ + +/* + * Find internal function in table above. + * Return index, or -1 if not found + */ + int +find_internal_func( + char_u *name) /* name of the function */ +{ + int first = 0; + int last = (int)(sizeof(functions) / sizeof(struct fst)) - 1; + int cmp; + int x; + + /* + * Find the function name in the table. Binary search. + */ + while (first <= last) + { + x = first + ((unsigned)(last - first) >> 1); + cmp = STRCMP(name, functions[x].f_name); + if (cmp < 0) + last = x - 1; + else if (cmp > 0) + first = x + 1; + else + return x; + } + return -1; +} + + int +call_internal_func( + char_u *name, + int argcount, + typval_T *argvars, + typval_T *rettv) +{ + int i; + + i = find_internal_func(name); + if (i < 0) + return ERROR_UNKNOWN; + if (argcount < functions[i].f_min_argc) + return ERROR_TOOFEW; + if (argcount > functions[i].f_max_argc) + return ERROR_TOOMANY; + argvars[argcount].v_type = VAR_UNKNOWN; + functions[i].f_func(argvars, rettv); + return ERROR_NONE; +} + +/* + * Return TRUE for a non-zero Number and a non-empty String. + */ + static int +non_zero_arg(typval_T *argvars) +{ + return ((argvars[0].v_type == VAR_NUMBER + && argvars[0].vval.v_number != 0) + || (argvars[0].v_type == VAR_SPECIAL + && argvars[0].vval.v_number == VVAL_TRUE) + || (argvars[0].v_type == VAR_STRING + && argvars[0].vval.v_string != NULL + && *argvars[0].vval.v_string != NUL)); +} + +/* + * Get the lnum from the first argument. + * Also accepts ".", "$", etc., but that only works for the current buffer. + * Returns -1 on error. + */ + static linenr_T +get_tv_lnum(typval_T *argvars) +{ + typval_T rettv; + linenr_T lnum; + + lnum = (linenr_T)get_tv_number_chk(&argvars[0], NULL); + if (lnum == 0) /* no valid number, try using line() */ + { + rettv.v_type = VAR_NUMBER; + f_line(argvars, &rettv); + lnum = (linenr_T)rettv.vval.v_number; + clear_tv(&rettv); + } + return lnum; +} + +#ifdef FEAT_FLOAT +static int get_float_arg(typval_T *argvars, float_T *f); + +/* + * Get the float value of "argvars[0]" into "f". + * Returns FAIL when the argument is not a Number or Float. + */ + static int +get_float_arg(typval_T *argvars, float_T *f) +{ + if (argvars[0].v_type == VAR_FLOAT) + { + *f = argvars[0].vval.v_float; + return OK; + } + if (argvars[0].v_type == VAR_NUMBER) + { + *f = (float_T)argvars[0].vval.v_number; + return OK; + } + EMSG(_("E808: Number or Float required")); + return FAIL; +} + +/* + * "abs(expr)" function + */ + static void +f_abs(typval_T *argvars, typval_T *rettv) +{ + if (argvars[0].v_type == VAR_FLOAT) + { + rettv->v_type = VAR_FLOAT; + rettv->vval.v_float = fabs(argvars[0].vval.v_float); + } + else + { + varnumber_T n; + int error = FALSE; + + n = get_tv_number_chk(&argvars[0], &error); + if (error) + rettv->vval.v_number = -1; + else if (n > 0) + rettv->vval.v_number = n; + else + rettv->vval.v_number = -n; + } +} + +/* + * "acos()" function + */ + static void +f_acos(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = acos(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "add(list, item)" function + */ + static void +f_add(typval_T *argvars, typval_T *rettv) +{ + list_T *l; + + rettv->vval.v_number = 1; /* Default: Failed */ + if (argvars[0].v_type == VAR_LIST) + { + if ((l = argvars[0].vval.v_list) != NULL + && !tv_check_lock(l->lv_lock, + (char_u *)N_("add() argument"), TRUE) + && list_append_tv(l, &argvars[1]) == OK) + copy_tv(&argvars[0], rettv); + } + else + EMSG(_(e_listreq)); +} + +/* + * "and(expr, expr)" function + */ + static void +f_and(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) + & get_tv_number_chk(&argvars[1], NULL); +} + +/* + * Get the lnum from the first argument. + * Also accepts "$", then "buf" is used. + * Returns 0 on error. + */ + static linenr_T +get_tv_lnum_buf(typval_T *argvars, buf_T *buf) +{ + if (argvars[0].v_type == VAR_STRING + && argvars[0].vval.v_string != NULL + && argvars[0].vval.v_string[0] == '$' + && buf != NULL) + return buf->b_ml.ml_line_count; + return (linenr_T)get_tv_number_chk(&argvars[0], NULL); +} + +/* + * If there is a window for "curbuf", make it the current window. + */ + static void +find_win_for_curbuf(void) +{ + wininfo_T *wip; + + for (wip = curbuf->b_wininfo; wip != NULL; wip = wip->wi_next) + { + if (wip->wi_win != NULL) + { + curwin = wip->wi_win; + break; + } + } +} + +/* + * Set line or list of lines in buffer "buf". + */ + static void +set_buffer_lines( + buf_T *buf, + linenr_T lnum_arg, + int append, + typval_T *lines, + typval_T *rettv) +{ + linenr_T lnum = lnum_arg + (append ? 1 : 0); + char_u *line = NULL; + list_T *l = NULL; + listitem_T *li = NULL; + long added = 0; + linenr_T append_lnum; + buf_T *curbuf_save = NULL; + win_T *curwin_save = NULL; + int is_curbuf = buf == curbuf; + + /* When using the current buffer ml_mfp will be set if needed. Useful when + * setline() is used on startup. For other buffers the buffer must be + * loaded. */ + if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1) + { + rettv->vval.v_number = 1; /* FAIL */ + return; + } + + if (!is_curbuf) + { + curbuf_save = curbuf; + curwin_save = curwin; + curbuf = buf; + find_win_for_curbuf(); + } + + if (append) + // appendbufline() uses the line number below which we insert + append_lnum = lnum - 1; + else + // setbufline() uses the line number above which we insert, we only + // append if it's below the last line + append_lnum = curbuf->b_ml.ml_line_count; + + if (lines->v_type == VAR_LIST) + { + l = lines->vval.v_list; + li = l->lv_first; + } + else + line = get_tv_string_chk(lines); + + /* default result is zero == OK */ + for (;;) + { + if (l != NULL) + { + /* list argument, get next string */ + if (li == NULL) + break; + line = get_tv_string_chk(&li->li_tv); + li = li->li_next; + } + + rettv->vval.v_number = 1; /* FAIL */ + if (line == NULL || lnum > curbuf->b_ml.ml_line_count + 1) + break; + + /* When coming here from Insert mode, sync undo, so that this can be + * undone separately from what was previously inserted. */ + if (u_sync_once == 2) + { + u_sync_once = 1; /* notify that u_sync() was called */ + u_sync(TRUE); + } + + if (!append && lnum <= curbuf->b_ml.ml_line_count) + { + /* existing line, replace it */ + if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK) + { + changed_bytes(lnum, 0); + if (is_curbuf && lnum == curwin->w_cursor.lnum) + check_cursor_col(); + rettv->vval.v_number = 0; /* OK */ + } + } + else if (added > 0 || u_save(lnum - 1, lnum) == OK) + { + /* append the line */ + ++added; + if (ml_append(lnum - 1, line, (colnr_T)0, FALSE) == OK) + rettv->vval.v_number = 0; /* OK */ + } + + if (l == NULL) /* only one string argument */ + break; + ++lnum; + } + + if (added > 0) + { + win_T *wp; + tabpage_T *tp; + + appended_lines_mark(append_lnum, added); + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer == buf && wp->w_cursor.lnum > append_lnum) + wp->w_cursor.lnum += added; + check_cursor_col(); + +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && (State & INSERT)) + // show the line with the prompt + update_topline(); +#endif + } + + if (!is_curbuf) + { + curbuf = curbuf_save; + curwin = curwin_save; + } +} + +/* + * "append(lnum, string/list)" function + */ + static void +f_append(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum = get_tv_lnum(&argvars[0]); + + set_buffer_lines(curbuf, lnum, TRUE, &argvars[1], rettv); +} + +/* + * "appendbufline(buf, lnum, string/list)" function + */ + static void +f_appendbufline(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + buf_T *buf; + + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + rettv->vval.v_number = 1; /* FAIL */ + else + { + lnum = get_tv_lnum_buf(&argvars[1], buf); + set_buffer_lines(buf, lnum, TRUE, &argvars[2], rettv); + } +} + +/* + * "argc()" function + */ + static void +f_argc(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = ARGCOUNT; +} + +/* + * "argidx()" function + */ + static void +f_argidx(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = curwin->w_arg_idx; +} + +/* + * "arglistid()" function + */ + static void +f_arglistid(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + + rettv->vval.v_number = -1; + wp = find_tabwin(&argvars[0], &argvars[1]); + if (wp != NULL) + rettv->vval.v_number = wp->w_alist->id; +} + +/* + * "argv(nr)" function + */ + static void +f_argv(typval_T *argvars, typval_T *rettv) +{ + int idx; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + idx = (int)get_tv_number_chk(&argvars[0], NULL); + if (idx >= 0 && idx < ARGCOUNT) + rettv->vval.v_string = vim_strsave(alist_name(&ARGLIST[idx])); + else + rettv->vval.v_string = NULL; + rettv->v_type = VAR_STRING; + } + else if (rettv_list_alloc(rettv) == OK) + for (idx = 0; idx < ARGCOUNT; ++idx) + list_append_string(rettv->vval.v_list, + alist_name(&ARGLIST[idx]), -1); +} + +/* + * "assert_beeps(cmd [, error])" function + */ + static void +f_assert_beeps(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_beeps(argvars); +} + +/* + * "assert_equal(expected, actual[, msg])" function + */ + static void +f_assert_equal(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_equal_common(argvars, ASSERT_EQUAL); +} + +/* + * "assert_equalfile(fname-one, fname-two)" function + */ + static void +f_assert_equalfile(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_equalfile(argvars); +} + +/* + * "assert_notequal(expected, actual[, msg])" function + */ + static void +f_assert_notequal(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_equal_common(argvars, ASSERT_NOTEQUAL); +} + +/* + * "assert_exception(string[, msg])" function + */ + static void +f_assert_exception(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_exception(argvars); +} + +/* + * "assert_fails(cmd [, error])" function + */ + static void +f_assert_fails(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_fails(argvars); +} + +/* + * "assert_false(actual[, msg])" function + */ + static void +f_assert_false(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_bool(argvars, FALSE); +} + +/* + * "assert_inrange(lower, upper[, msg])" function + */ + static void +f_assert_inrange(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_inrange(argvars); +} + +/* + * "assert_match(pattern, actual[, msg])" function + */ + static void +f_assert_match(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_match_common(argvars, ASSERT_MATCH); +} + +/* + * "assert_notmatch(pattern, actual[, msg])" function + */ + static void +f_assert_notmatch(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_match_common(argvars, ASSERT_NOTMATCH); +} + +/* + * "assert_report(msg)" function + */ + static void +f_assert_report(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_report(argvars); +} + +/* + * "assert_true(actual[, msg])" function + */ + static void +f_assert_true(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_bool(argvars, TRUE); +} + +#ifdef FEAT_FLOAT +/* + * "asin()" function + */ + static void +f_asin(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = asin(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "atan()" function + */ + static void +f_atan(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = atan(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "atan2()" function + */ + static void +f_atan2(typval_T *argvars, typval_T *rettv) +{ + float_T fx = 0.0, fy = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &fx) == OK + && get_float_arg(&argvars[1], &fy) == OK) + rettv->vval.v_float = atan2(fx, fy); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "balloon_show()" function + */ +#ifdef FEAT_BEVAL + static void +f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) +{ + if (balloonEval != NULL) + { + if (argvars[0].v_type == VAR_LIST +# ifdef FEAT_GUI + && !gui.in_use +# endif + ) + post_balloon(balloonEval, NULL, argvars[0].vval.v_list); + else + post_balloon(balloonEval, get_tv_string_chk(&argvars[0]), NULL); + } +} + +# if defined(FEAT_BEVAL_TERM) + static void +f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) +{ + if (rettv_list_alloc(rettv) == OK) + { + char_u *msg = get_tv_string_chk(&argvars[0]); + + if (msg != NULL) + { + pumitem_T *array; + int size = split_message(msg, &array); + int i; + + /* Skip the first and last item, they are always empty. */ + for (i = 1; i < size - 1; ++i) + list_append_string(rettv->vval.v_list, array[i].pum_text, -1); + while (size > 0) + vim_free(array[--size].pum_text); + vim_free(array); + } + } +} +# endif +#endif + +/* + * "browse(save, title, initdir, default)" function + */ + static void +f_browse(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_BROWSE + int save; + char_u *title; + char_u *initdir; + char_u *defname; + char_u buf[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + int error = FALSE; + + save = (int)get_tv_number_chk(&argvars[0], &error); + title = get_tv_string_chk(&argvars[1]); + initdir = get_tv_string_buf_chk(&argvars[2], buf); + defname = get_tv_string_buf_chk(&argvars[3], buf2); + + if (error || title == NULL || initdir == NULL || defname == NULL) + rettv->vval.v_string = NULL; + else + rettv->vval.v_string = + do_browse(save ? BROWSE_SAVE : 0, + title, defname, NULL, initdir, NULL, curbuf); +#else + rettv->vval.v_string = NULL; +#endif + rettv->v_type = VAR_STRING; +} + +/* + * "browsedir(title, initdir)" function + */ + static void +f_browsedir(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_BROWSE + char_u *title; + char_u *initdir; + char_u buf[NUMBUFLEN]; + + title = get_tv_string_chk(&argvars[0]); + initdir = get_tv_string_buf_chk(&argvars[1], buf); + + if (title == NULL || initdir == NULL) + rettv->vval.v_string = NULL; + else + rettv->vval.v_string = do_browse(BROWSE_DIR, + title, NULL, NULL, initdir, NULL, curbuf); +#else + rettv->vval.v_string = NULL; +#endif + rettv->v_type = VAR_STRING; +} + +static buf_T *find_buffer(typval_T *avar); + +/* + * Find a buffer by number or exact name. + */ + static buf_T * +find_buffer(typval_T *avar) +{ + buf_T *buf = NULL; + + if (avar->v_type == VAR_NUMBER) + buf = buflist_findnr((int)avar->vval.v_number); + else if (avar->v_type == VAR_STRING && avar->vval.v_string != NULL) + { + buf = buflist_findname_exp(avar->vval.v_string); + if (buf == NULL) + { + /* No full path name match, try a match with a URL or a "nofile" + * buffer, these don't use the full path. */ + FOR_ALL_BUFFERS(buf) + if (buf->b_fname != NULL + && (path_with_url(buf->b_fname) +#ifdef FEAT_QUICKFIX + || bt_nofile(buf) +#endif + ) + && STRCMP(buf->b_fname, avar->vval.v_string) == 0) + break; + } + } + return buf; +} + +/* + * "bufexists(expr)" function + */ + static void +f_bufexists(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = (find_buffer(&argvars[0]) != NULL); +} + +/* + * "buflisted(expr)" function + */ + static void +f_buflisted(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf; + + buf = find_buffer(&argvars[0]); + rettv->vval.v_number = (buf != NULL && buf->b_p_bl); +} + +/* + * "bufloaded(expr)" function + */ + static void +f_bufloaded(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf; + + buf = find_buffer(&argvars[0]); + rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL); +} + + buf_T * +buflist_find_by_name(char_u *name, int curtab_only) +{ + int save_magic; + char_u *save_cpo; + buf_T *buf; + + /* Ignore 'magic' and 'cpoptions' here to make scripts portable */ + save_magic = p_magic; + p_magic = TRUE; + save_cpo = p_cpo; + p_cpo = (char_u *)""; + + buf = buflist_findnr(buflist_findpat(name, name + STRLEN(name), + TRUE, FALSE, curtab_only)); + + p_magic = save_magic; + p_cpo = save_cpo; + return buf; +} + +/* + * Get buffer by number or pattern. + */ + buf_T * +get_buf_tv(typval_T *tv, int curtab_only) +{ + char_u *name = tv->vval.v_string; + buf_T *buf; + + if (tv->v_type == VAR_NUMBER) + return buflist_findnr((int)tv->vval.v_number); + if (tv->v_type != VAR_STRING) + return NULL; + if (name == NULL || *name == NUL) + return curbuf; + if (name[0] == '$' && name[1] == NUL) + return lastbuf; + + buf = buflist_find_by_name(name, curtab_only); + + /* If not found, try expanding the name, like done for bufexists(). */ + if (buf == NULL) + buf = find_buffer(tv); + + return buf; +} + +/* + * "bufname(expr)" function + */ + static void +f_bufname(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + rettv->v_type = VAR_STRING; + if (buf != NULL && buf->b_fname != NULL) + rettv->vval.v_string = vim_strsave(buf->b_fname); + else + rettv->vval.v_string = NULL; + --emsg_off; +} + +/* + * "bufnr(expr)" function + */ + static void +f_bufnr(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf; + int error = FALSE; + char_u *name; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + + /* If the buffer isn't found and the second argument is not zero create a + * new buffer. */ + if (buf == NULL + && argvars[1].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[1], &error) != 0 + && !error + && (name = get_tv_string_chk(&argvars[0])) != NULL + && !error) + buf = buflist_new(name, NULL, (linenr_T)1, 0); + + if (buf != NULL) + rettv->vval.v_number = buf->b_fnum; + else + rettv->vval.v_number = -1; +} + + static void +buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr) +{ + win_T *wp; + int winnr = 0; + buf_T *buf; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], TRUE); + FOR_ALL_WINDOWS(wp) + { + ++winnr; + if (wp->w_buffer == buf) + break; + } + rettv->vval.v_number = (wp != NULL ? (get_nr ? winnr : wp->w_id) : -1); + --emsg_off; +} + +/* + * "bufwinid(nr)" function + */ + static void +f_bufwinid(typval_T *argvars, typval_T *rettv) +{ + buf_win_common(argvars, rettv, FALSE); +} + +/* + * "bufwinnr(nr)" function + */ + static void +f_bufwinnr(typval_T *argvars, typval_T *rettv) +{ + buf_win_common(argvars, rettv, TRUE); +} + +/* + * "byte2line(byte)" function + */ + static void +f_byte2line(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifndef FEAT_BYTEOFF + rettv->vval.v_number = -1; +#else + long boff = 0; + + boff = get_tv_number(&argvars[0]) - 1; /* boff gets -1 on type error */ + if (boff < 0) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = ml_find_line_or_offset(curbuf, + (linenr_T)0, &boff); +#endif +} + + static void +byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED) +{ +#ifdef FEAT_MBYTE + char_u *t; +#endif + char_u *str; + varnumber_T idx; + + str = get_tv_string_chk(&argvars[0]); + idx = get_tv_number_chk(&argvars[1], NULL); + rettv->vval.v_number = -1; + if (str == NULL || idx < 0) + return; + +#ifdef FEAT_MBYTE + t = str; + for ( ; idx > 0; idx--) + { + if (*t == NUL) /* EOL reached */ + return; + if (enc_utf8 && comp) + t += utf_ptr2len(t); + else + t += (*mb_ptr2len)(t); + } + rettv->vval.v_number = (varnumber_T)(t - str); +#else + if ((size_t)idx <= STRLEN(str)) + rettv->vval.v_number = idx; +#endif +} + +/* + * "byteidx()" function + */ + static void +f_byteidx(typval_T *argvars, typval_T *rettv) +{ + byteidx(argvars, rettv, FALSE); +} + +/* + * "byteidxcomp()" function + */ + static void +f_byteidxcomp(typval_T *argvars, typval_T *rettv) +{ + byteidx(argvars, rettv, TRUE); +} + +/* + * "call(func, arglist [, dict])" function + */ + static void +f_call(typval_T *argvars, typval_T *rettv) +{ + char_u *func; + partial_T *partial = NULL; + dict_T *selfdict = NULL; + + if (argvars[1].v_type != VAR_LIST) + { + EMSG(_(e_listreq)); + return; + } + if (argvars[1].vval.v_list == NULL) + return; + + if (argvars[0].v_type == VAR_FUNC) + func = argvars[0].vval.v_string; + else if (argvars[0].v_type == VAR_PARTIAL) + { + partial = argvars[0].vval.v_partial; + func = partial_name(partial); + } + else + func = get_tv_string(&argvars[0]); + if (*func == NUL) + return; /* type error or empty name */ + + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (argvars[2].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + selfdict = argvars[2].vval.v_dict; + } + + (void)func_call(func, &argvars[1], partial, selfdict, rettv); +} + +#ifdef FEAT_FLOAT +/* + * "ceil({float})" function + */ + static void +f_ceil(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = ceil(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +#ifdef FEAT_JOB_CHANNEL +/* + * "ch_canread()" function + */ + static void +f_ch_canread(typval_T *argvars, typval_T *rettv) +{ + channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + + rettv->vval.v_number = 0; + if (channel != NULL) + rettv->vval.v_number = channel_has_readahead(channel, PART_SOCK) + || channel_has_readahead(channel, PART_OUT) + || channel_has_readahead(channel, PART_ERR); +} + +/* + * "ch_close()" function + */ + static void +f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) +{ + channel_T *channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); + + if (channel != NULL) + { + channel_close(channel, FALSE); + channel_clear(channel); + } +} + +/* + * "ch_close()" function + */ + static void +f_ch_close_in(typval_T *argvars, typval_T *rettv UNUSED) +{ + channel_T *channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); + + if (channel != NULL) + channel_close_in(channel); +} + +/* + * "ch_getbufnr()" function + */ + static void +f_ch_getbufnr(typval_T *argvars, typval_T *rettv) +{ + channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + + rettv->vval.v_number = -1; + if (channel != NULL) + { + char_u *what = get_tv_string(&argvars[1]); + int part; + + if (STRCMP(what, "err") == 0) + part = PART_ERR; + else if (STRCMP(what, "out") == 0) + part = PART_OUT; + else if (STRCMP(what, "in") == 0) + part = PART_IN; + else + part = PART_SOCK; + if (channel->ch_part[part].ch_bufref.br_buf != NULL) + rettv->vval.v_number = + channel->ch_part[part].ch_bufref.br_buf->b_fnum; + } +} + +/* + * "ch_getjob()" function + */ + static void +f_ch_getjob(typval_T *argvars, typval_T *rettv) +{ + channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + + if (channel != NULL) + { + rettv->v_type = VAR_JOB; + rettv->vval.v_job = channel->ch_job; + if (channel->ch_job != NULL) + ++channel->ch_job->jv_refcount; + } +} + +/* + * "ch_info()" function + */ + static void +f_ch_info(typval_T *argvars, typval_T *rettv UNUSED) +{ + channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + + if (channel != NULL && rettv_dict_alloc(rettv) != FAIL) + channel_info(channel, rettv->vval.v_dict); +} + +/* + * "ch_log()" function + */ + static void +f_ch_log(typval_T *argvars, typval_T *rettv UNUSED) +{ + char_u *msg = get_tv_string(&argvars[0]); + channel_T *channel = NULL; + + if (argvars[1].v_type != VAR_UNKNOWN) + channel = get_channel_arg(&argvars[1], FALSE, FALSE, 0); + + ch_log(channel, "%s", msg); +} + +/* + * "ch_logfile()" function + */ + static void +f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) +{ + char_u *fname; + char_u *opt = (char_u *)""; + char_u buf[NUMBUFLEN]; + + /* Don't open a file in restricted mode. */ + if (check_restricted() || check_secure()) + return; + fname = get_tv_string(&argvars[0]); + if (argvars[1].v_type == VAR_STRING) + opt = get_tv_string_buf(&argvars[1], buf); + ch_logfile(fname, opt); +} + +/* + * "ch_open()" function + */ + static void +f_ch_open(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_CHANNEL; + if (check_restricted() || check_secure()) + return; + rettv->vval.v_channel = channel_open_func(argvars); +} + +/* + * "ch_read()" function + */ + static void +f_ch_read(typval_T *argvars, typval_T *rettv) +{ + common_channel_read(argvars, rettv, FALSE); +} + +/* + * "ch_readraw()" function + */ + static void +f_ch_readraw(typval_T *argvars, typval_T *rettv) +{ + common_channel_read(argvars, rettv, TRUE); +} + +/* + * "ch_evalexpr()" function + */ + static void +f_ch_evalexpr(typval_T *argvars, typval_T *rettv) +{ + ch_expr_common(argvars, rettv, TRUE); +} + +/* + * "ch_sendexpr()" function + */ + static void +f_ch_sendexpr(typval_T *argvars, typval_T *rettv) +{ + ch_expr_common(argvars, rettv, FALSE); +} + +/* + * "ch_evalraw()" function + */ + static void +f_ch_evalraw(typval_T *argvars, typval_T *rettv) +{ + ch_raw_common(argvars, rettv, TRUE); +} + +/* + * "ch_sendraw()" function + */ + static void +f_ch_sendraw(typval_T *argvars, typval_T *rettv) +{ + ch_raw_common(argvars, rettv, FALSE); +} + +/* + * "ch_setoptions()" function + */ + static void +f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED) +{ + channel_T *channel; + jobopt_T opt; + + channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + if (channel == NULL) + return; + clear_job_options(&opt); + if (get_job_options(&argvars[1], &opt, + JO_CB_ALL + JO_TIMEOUT_ALL + JO_MODE_ALL, 0) == OK) + channel_set_options(channel, &opt); + free_job_options(&opt); +} + +/* + * "ch_status()" function + */ + static void +f_ch_status(typval_T *argvars, typval_T *rettv) +{ + channel_T *channel; + jobopt_T opt; + int part = -1; + + /* return an empty string by default */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + + if (argvars[1].v_type != VAR_UNKNOWN) + { + clear_job_options(&opt); + if (get_job_options(&argvars[1], &opt, JO_PART, 0) == OK + && (opt.jo_set & JO_PART)) + part = opt.jo_part; + } + + rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel, part)); +} +#endif + +/* + * "changenr()" function + */ + static void +f_changenr(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = curbuf->b_u_seq_cur; +} + +/* + * "char2nr(string)" function + */ + static void +f_char2nr(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_MBYTE + if (has_mbyte) + { + int utf8 = 0; + + if (argvars[1].v_type != VAR_UNKNOWN) + utf8 = (int)get_tv_number_chk(&argvars[1], NULL); + + if (utf8) + rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0])); + else + rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0])); + } + else +#endif + rettv->vval.v_number = get_tv_string(&argvars[0])[0]; +} + +/* + * "cindent(lnum)" function + */ + static void +f_cindent(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_CINDENT + pos_T pos; + linenr_T lnum; + + pos = curwin->w_cursor; + lnum = get_tv_lnum(argvars); + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) + { + curwin->w_cursor.lnum = lnum; + rettv->vval.v_number = get_c_indent(); + curwin->w_cursor = pos; + } + else +#endif + rettv->vval.v_number = -1; +} + +/* + * "clearmatches()" function + */ + static void +f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + clear_matches(curwin); +#endif +} + +/* + * "col(string)" function + */ + static void +f_col(typval_T *argvars, typval_T *rettv) +{ + colnr_T col = 0; + pos_T *fp; + int fnum = curbuf->b_fnum; + + fp = var2fpos(&argvars[0], FALSE, &fnum); + if (fp != NULL && fnum == curbuf->b_fnum) + { + if (fp->col == MAXCOL) + { + /* '> can be MAXCOL, get the length of the line then */ + if (fp->lnum <= curbuf->b_ml.ml_line_count) + col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1; + else + col = MAXCOL; + } + else + { + col = fp->col + 1; +#ifdef FEAT_VIRTUALEDIT + /* col(".") when the cursor is on the NUL at the end of the line + * because of "coladd" can be seen as an extra column. */ + if (virtual_active() && fp == &curwin->w_cursor) + { + char_u *p = ml_get_cursor(); + + if (curwin->w_cursor.coladd >= (colnr_T)chartabsize(p, + curwin->w_virtcol - curwin->w_cursor.coladd)) + { +# ifdef FEAT_MBYTE + int l; + + if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL) + col += l; +# else + if (*p != NUL && p[1] == NUL) + ++col; +# endif + } + } +#endif + } + } + rettv->vval.v_number = col; +} + +#if defined(FEAT_INS_EXPAND) +/* + * "complete()" function + */ + static void +f_complete(typval_T *argvars, typval_T *rettv UNUSED) +{ + int startcol; + + if ((State & INSERT) == 0) + { + EMSG(_("E785: complete() can only be used in Insert mode")); + return; + } + + /* Check for undo allowed here, because if something was already inserted + * the line was already saved for undo and this check isn't done. */ + if (!undo_allowed()) + return; + + if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) + { + EMSG(_(e_invarg)); + return; + } + + startcol = (int)get_tv_number_chk(&argvars[0], NULL); + if (startcol <= 0) + return; + + set_completion(startcol - 1, argvars[1].vval.v_list); +} + +/* + * "complete_add()" function + */ + static void +f_complete_add(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0); +} + +/* + * "complete_check()" function + */ + static void +f_complete_check(typval_T *argvars UNUSED, typval_T *rettv) +{ + int saved = RedrawingDisabled; + + RedrawingDisabled = 0; + ins_compl_check_keys(0, TRUE); + rettv->vval.v_number = compl_interrupted; + RedrawingDisabled = saved; +} +#endif + +/* + * "confirm(message, buttons[, default [, type]])" function + */ + static void +f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) + char_u *message; + char_u *buttons = NULL; + char_u buf[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + int def = 1; + int type = VIM_GENERIC; + char_u *typestr; + int error = FALSE; + + message = get_tv_string_chk(&argvars[0]); + if (message == NULL) + error = TRUE; + if (argvars[1].v_type != VAR_UNKNOWN) + { + buttons = get_tv_string_buf_chk(&argvars[1], buf); + if (buttons == NULL) + error = TRUE; + if (argvars[2].v_type != VAR_UNKNOWN) + { + def = (int)get_tv_number_chk(&argvars[2], &error); + if (argvars[3].v_type != VAR_UNKNOWN) + { + typestr = get_tv_string_buf_chk(&argvars[3], buf2); + if (typestr == NULL) + error = TRUE; + else + { + switch (TOUPPER_ASC(*typestr)) + { + case 'E': type = VIM_ERROR; break; + case 'Q': type = VIM_QUESTION; break; + case 'I': type = VIM_INFO; break; + case 'W': type = VIM_WARNING; break; + case 'G': type = VIM_GENERIC; break; + } + } + } + } + } + + if (buttons == NULL || *buttons == NUL) + buttons = (char_u *)_("&Ok"); + + if (!error) + rettv->vval.v_number = do_dialog(type, NULL, message, buttons, + def, NULL, FALSE); +#endif +} + +/* + * "copy()" function + */ + static void +f_copy(typval_T *argvars, typval_T *rettv) +{ + item_copy(&argvars[0], rettv, FALSE, 0); +} + +#ifdef FEAT_FLOAT +/* + * "cos()" function + */ + static void +f_cos(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = cos(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "cosh()" function + */ + static void +f_cosh(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = cosh(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "count()" function + */ + static void +f_count(typval_T *argvars, typval_T *rettv) +{ + long n = 0; + int ic = FALSE; + int error = FALSE; + + if (argvars[2].v_type != VAR_UNKNOWN) + ic = (int)get_tv_number_chk(&argvars[2], &error); + + if (argvars[0].v_type == VAR_STRING) + { + char_u *expr = get_tv_string_chk(&argvars[1]); + char_u *p = argvars[0].vval.v_string; + char_u *next; + + if (!error && expr != NULL && *expr != NUL && p != NULL) + { + if (ic) + { + size_t len = STRLEN(expr); + + while (*p != NUL) + { + if (MB_STRNICMP(p, expr, len) == 0) + { + ++n; + p += len; + } + else + MB_PTR_ADV(p); + } + } + else + while ((next = (char_u *)strstr((char *)p, (char *)expr)) + != NULL) + { + ++n; + p = next + STRLEN(expr); + } + } + + } + else if (argvars[0].v_type == VAR_LIST) + { + listitem_T *li; + list_T *l; + long idx; + + if ((l = argvars[0].vval.v_list) != NULL) + { + li = l->lv_first; + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (argvars[3].v_type != VAR_UNKNOWN) + { + idx = (long)get_tv_number_chk(&argvars[3], &error); + if (!error) + { + li = list_find(l, idx); + if (li == NULL) + EMSGN(_(e_listidx), idx); + } + } + if (error) + li = NULL; + } + + for ( ; li != NULL; li = li->li_next) + if (tv_equal(&li->li_tv, &argvars[1], ic, FALSE)) + ++n; + } + } + else if (argvars[0].v_type == VAR_DICT) + { + int todo; + dict_T *d; + hashitem_T *hi; + + if ((d = argvars[0].vval.v_dict) != NULL) + { + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (argvars[3].v_type != VAR_UNKNOWN) + EMSG(_(e_invarg)); + } + + todo = error ? 0 : (int)d->dv_hashtab.ht_used; + for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic, FALSE)) + ++n; + } + } + } + } + else + EMSG2(_(e_listdictarg), "count()"); + rettv->vval.v_number = n; +} + +/* + * "cscope_connection([{num} , {dbpath} [, {prepend}]])" function + * + * Checks the existence of a cscope connection. + */ + static void +f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_CSCOPE + int num = 0; + char_u *dbpath = NULL; + char_u *prepend = NULL; + char_u buf[NUMBUFLEN]; + + if (argvars[0].v_type != VAR_UNKNOWN + && argvars[1].v_type != VAR_UNKNOWN) + { + num = (int)get_tv_number(&argvars[0]); + dbpath = get_tv_string(&argvars[1]); + if (argvars[2].v_type != VAR_UNKNOWN) + prepend = get_tv_string_buf(&argvars[2], buf); + } + + rettv->vval.v_number = cs_connection(num, dbpath, prepend); +#endif +} + +/* + * "cursor(lnum, col)" function, or + * "cursor(list)" + * + * Moves the cursor to the specified line and column. + * Returns 0 when the position could be set, -1 otherwise. + */ + static void +f_cursor(typval_T *argvars, typval_T *rettv) +{ + long line, col; +#ifdef FEAT_VIRTUALEDIT + long coladd = 0; +#endif + int set_curswant = TRUE; + + rettv->vval.v_number = -1; + if (argvars[1].v_type == VAR_UNKNOWN) + { + pos_T pos; + colnr_T curswant = -1; + + if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) + { + EMSG(_(e_invarg)); + return; + } + line = pos.lnum; + col = pos.col; +#ifdef FEAT_VIRTUALEDIT + coladd = pos.coladd; +#endif + if (curswant >= 0) + { + curwin->w_curswant = curswant - 1; + set_curswant = FALSE; + } + } + else + { + line = get_tv_lnum(argvars); + col = (long)get_tv_number_chk(&argvars[1], NULL); +#ifdef FEAT_VIRTUALEDIT + if (argvars[2].v_type != VAR_UNKNOWN) + coladd = (long)get_tv_number_chk(&argvars[2], NULL); +#endif + } + if (line < 0 || col < 0 +#ifdef FEAT_VIRTUALEDIT + || coladd < 0 +#endif + ) + return; /* type error; errmsg already given */ + if (line > 0) + curwin->w_cursor.lnum = line; + if (col > 0) + curwin->w_cursor.col = col - 1; +#ifdef FEAT_VIRTUALEDIT + curwin->w_cursor.coladd = coladd; +#endif + + /* Make sure the cursor is in a valid position. */ + check_cursor(); +#ifdef FEAT_MBYTE + /* Correct cursor for multi-byte character. */ + if (has_mbyte) + mb_adjust_cursor(); +#endif + + curwin->w_set_curswant = set_curswant; + rettv->vval.v_number = 0; +} + +/* + * "deepcopy()" function + */ + static void +f_deepcopy(typval_T *argvars, typval_T *rettv) +{ + int noref = 0; + int copyID; + + if (argvars[1].v_type != VAR_UNKNOWN) + noref = (int)get_tv_number_chk(&argvars[1], NULL); + if (noref < 0 || noref > 1) + EMSG(_(e_invarg)); + else + { + copyID = get_copyID(); + item_copy(&argvars[0], rettv, TRUE, noref == 0 ? copyID : 0); + } +} + +/* + * "delete()" function + */ + static void +f_delete(typval_T *argvars, typval_T *rettv) +{ + char_u nbuf[NUMBUFLEN]; + char_u *name; + char_u *flags; + + rettv->vval.v_number = -1; + if (check_restricted() || check_secure()) + return; + + name = get_tv_string(&argvars[0]); + if (name == NULL || *name == NUL) + { + EMSG(_(e_invarg)); + return; + } + + if (argvars[1].v_type != VAR_UNKNOWN) + flags = get_tv_string_buf(&argvars[1], nbuf); + else + flags = (char_u *)""; + + if (*flags == NUL) + /* delete a file */ + rettv->vval.v_number = mch_remove(name) == 0 ? 0 : -1; + else if (STRCMP(flags, "d") == 0) + /* delete an empty directory */ + rettv->vval.v_number = mch_rmdir(name) == 0 ? 0 : -1; + else if (STRCMP(flags, "rf") == 0) + /* delete a directory recursively */ + rettv->vval.v_number = delete_recursive(name); + else + EMSG2(_(e_invexpr2), flags); +} + +/* + * "deletebufline()" function + */ + static void +f_deletebufline(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + buf_T *buf; + linenr_T first, last; + linenr_T lnum; + long count; + int is_curbuf; + buf_T *curbuf_save = NULL; + win_T *curwin_save = NULL; + tabpage_T *tp; + win_T *wp; + + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + { + rettv->vval.v_number = 1; /* FAIL */ + return; + } + is_curbuf = buf == curbuf; + + first = get_tv_lnum_buf(&argvars[1], buf); + if (argvars[2].v_type != VAR_UNKNOWN) + last = get_tv_lnum_buf(&argvars[2], buf); + else + last = first; + + if (buf->b_ml.ml_mfp == NULL || first < 1 + || first > buf->b_ml.ml_line_count || last < first) + { + rettv->vval.v_number = 1; /* FAIL */ + return; + } + + if (!is_curbuf) + { + curbuf_save = curbuf; + curwin_save = curwin; + curbuf = buf; + find_win_for_curbuf(); + } + if (last > curbuf->b_ml.ml_line_count) + last = curbuf->b_ml.ml_line_count; + count = last - first + 1; + + // When coming here from Insert mode, sync undo, so that this can be + // undone separately from what was previously inserted. + if (u_sync_once == 2) + { + u_sync_once = 1; // notify that u_sync() was called + u_sync(TRUE); + } + + if (u_save(first - 1, last + 1) == FAIL) + { + rettv->vval.v_number = 1; /* FAIL */ + return; + } + + for (lnum = first; lnum <= last; ++lnum) + ml_delete(first, TRUE); + + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer == buf) + { + if (wp->w_cursor.lnum > last) + wp->w_cursor.lnum -= count; + else if (wp->w_cursor.lnum> first) + wp->w_cursor.lnum = first; + if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) + wp->w_cursor.lnum = wp->w_buffer->b_ml.ml_line_count; + } + check_cursor_col(); + deleted_lines_mark(first, count); + + if (!is_curbuf) + { + curbuf = curbuf_save; + curwin = curwin_save; + } +} + +/* + * "did_filetype()" function + */ + static void +f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + rettv->vval.v_number = did_filetype; +} + +/* + * "diff_filler()" function + */ + static void +f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_DIFF + rettv->vval.v_number = diff_check_fill(curwin, get_tv_lnum(argvars)); +#endif +} + +/* + * "diff_hlID()" function + */ + static void +f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_DIFF + linenr_T lnum = get_tv_lnum(argvars); + static linenr_T prev_lnum = 0; + static varnumber_T changedtick = 0; + static int fnum = 0; + static int change_start = 0; + static int change_end = 0; + static hlf_T hlID = (hlf_T)0; + int filler_lines; + int col; + + if (lnum < 0) /* ignore type error in {lnum} arg */ + lnum = 0; + if (lnum != prev_lnum + || changedtick != CHANGEDTICK(curbuf) + || fnum != curbuf->b_fnum) + { + /* New line, buffer, change: need to get the values. */ + filler_lines = diff_check(curwin, lnum); + if (filler_lines < 0) + { + if (filler_lines == -1) + { + change_start = MAXCOL; + change_end = -1; + if (diff_find_change(curwin, lnum, &change_start, &change_end)) + hlID = HLF_ADD; /* added line */ + else + hlID = HLF_CHD; /* changed line */ + } + else + hlID = HLF_ADD; /* added line */ + } + else + hlID = (hlf_T)0; + prev_lnum = lnum; + changedtick = CHANGEDTICK(curbuf); + fnum = curbuf->b_fnum; + } + + if (hlID == HLF_CHD || hlID == HLF_TXD) + { + col = get_tv_number(&argvars[1]) - 1; /* ignore type error in {col} */ + if (col >= change_start && col <= change_end) + hlID = HLF_TXD; /* changed text */ + else + hlID = HLF_CHD; /* changed line */ + } + rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID; +#endif +} + +/* + * "empty({expr})" function + */ + static void +f_empty(typval_T *argvars, typval_T *rettv) +{ + int n = FALSE; + + switch (argvars[0].v_type) + { + case VAR_STRING: + case VAR_FUNC: + n = argvars[0].vval.v_string == NULL + || *argvars[0].vval.v_string == NUL; + break; + case VAR_PARTIAL: + n = FALSE; + break; + case VAR_NUMBER: + n = argvars[0].vval.v_number == 0; + break; + case VAR_FLOAT: +#ifdef FEAT_FLOAT + n = argvars[0].vval.v_float == 0.0; + break; +#endif + case VAR_LIST: + n = argvars[0].vval.v_list == NULL + || argvars[0].vval.v_list->lv_first == NULL; + break; + case VAR_DICT: + n = argvars[0].vval.v_dict == NULL + || argvars[0].vval.v_dict->dv_hashtab.ht_used == 0; + break; + case VAR_SPECIAL: + n = argvars[0].vval.v_number != VVAL_TRUE; + break; + + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + n = argvars[0].vval.v_job == NULL + || argvars[0].vval.v_job->jv_status != JOB_STARTED; + break; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + n = argvars[0].vval.v_channel == NULL + || !channel_is_open(argvars[0].vval.v_channel); + break; +#endif + case VAR_UNKNOWN: + internal_error("f_empty(UNKNOWN)"); + n = TRUE; + break; + } + + rettv->vval.v_number = n; +} + +/* + * "escape({string}, {chars})" function + */ + static void +f_escape(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + + rettv->vval.v_string = vim_strsave_escaped(get_tv_string(&argvars[0]), + get_tv_string_buf(&argvars[1], buf)); + rettv->v_type = VAR_STRING; +} + +/* + * "eval()" function + */ + static void +f_eval(typval_T *argvars, typval_T *rettv) +{ + char_u *s, *p; + + s = get_tv_string_chk(&argvars[0]); + if (s != NULL) + s = skipwhite(s); + + p = s; + if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) + { + if (p != NULL && !aborting()) + EMSG2(_(e_invexpr2), p); + need_clr_eos = FALSE; + rettv->v_type = VAR_NUMBER; + rettv->vval.v_number = 0; + } + else if (*s != NUL) + EMSG(_(e_trailing)); +} + +/* + * "eventhandler()" function + */ + static void +f_eventhandler(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = vgetc_busy; +} + +/* + * "executable()" function + */ + static void +f_executable(typval_T *argvars, typval_T *rettv) +{ + char_u *name = get_tv_string(&argvars[0]); + + /* Check in $PATH and also check directly if there is a directory name. */ + rettv->vval.v_number = mch_can_exe(name, NULL, TRUE) + || (gettail(name) != name && mch_can_exe(name, NULL, FALSE)); +} + +static garray_T redir_execute_ga; + +/* + * Append "value[value_len]" to the execute() output. + */ + void +execute_redir_str(char_u *value, int value_len) +{ + int len; + + if (value_len == -1) + len = (int)STRLEN(value); /* Append the entire string */ + else + len = value_len; /* Append only "value_len" characters */ + if (ga_grow(&redir_execute_ga, len) == OK) + { + mch_memmove((char *)redir_execute_ga.ga_data + + redir_execute_ga.ga_len, value, len); + redir_execute_ga.ga_len += len; + } +} + +/* + * Get next line from a list. + * Called by do_cmdline() to get the next line. + * Returns allocated string, or NULL for end of function. + */ + + static char_u * +get_list_line( + int c UNUSED, + void *cookie, + int indent UNUSED) +{ + listitem_T **p = (listitem_T **)cookie; + listitem_T *item = *p; + char_u buf[NUMBUFLEN]; + char_u *s; + + if (item == NULL) + return NULL; + s = get_tv_string_buf_chk(&item->li_tv, buf); + *p = item->li_next; + return s == NULL ? NULL : vim_strsave(s); +} + +/* + * "execute()" function + */ + static void +f_execute(typval_T *argvars, typval_T *rettv) +{ + char_u *cmd = NULL; + list_T *list = NULL; + int save_msg_silent = msg_silent; + int save_emsg_silent = emsg_silent; + int save_emsg_noredir = emsg_noredir; + int save_redir_execute = redir_execute; + int save_redir_off = redir_off; + garray_T save_ga; + + rettv->vval.v_string = NULL; + rettv->v_type = VAR_STRING; + + if (argvars[0].v_type == VAR_LIST) + { + list = argvars[0].vval.v_list; + if (list == NULL || list->lv_first == NULL) + /* empty list, no commands, empty output */ + return; + ++list->lv_refcount; + } + else + { + cmd = get_tv_string_chk(&argvars[0]); + if (cmd == NULL) + return; + } + + if (argvars[1].v_type != VAR_UNKNOWN) + { + char_u buf[NUMBUFLEN]; + char_u *s = get_tv_string_buf_chk(&argvars[1], buf); + + if (s == NULL) + return; + if (STRNCMP(s, "silent", 6) == 0) + ++msg_silent; + if (STRCMP(s, "silent!") == 0) + { + emsg_silent = TRUE; + emsg_noredir = TRUE; + } + } + else + ++msg_silent; + + if (redir_execute) + save_ga = redir_execute_ga; + ga_init2(&redir_execute_ga, (int)sizeof(char), 500); + redir_execute = TRUE; + redir_off = FALSE; + + if (cmd != NULL) + do_cmdline_cmd(cmd); + else + { + listitem_T *item = list->lv_first; + + do_cmdline(NULL, get_list_line, (void *)&item, + DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED); + --list->lv_refcount; + } + + /* Need to append a NUL to the result. */ + if (ga_grow(&redir_execute_ga, 1) == OK) + { + ((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL; + rettv->vval.v_string = redir_execute_ga.ga_data; + } + else + { + ga_clear(&redir_execute_ga); + rettv->vval.v_string = NULL; + } + msg_silent = save_msg_silent; + emsg_silent = save_emsg_silent; + emsg_noredir = save_emsg_noredir; + + redir_execute = save_redir_execute; + if (redir_execute) + redir_execute_ga = save_ga; + redir_off = save_redir_off; + + /* "silent reg" or "silent echo x" leaves msg_col somewhere in the + * line. Put it back in the first column. */ + msg_col = 0; +} + +/* + * "exepath()" function + */ + static void +f_exepath(typval_T *argvars, typval_T *rettv) +{ + char_u *p = NULL; + + (void)mch_can_exe(get_tv_string(&argvars[0]), &p, TRUE); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = p; +} + +/* + * "exists()" function + */ + static void +f_exists(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + int n = FALSE; + + p = get_tv_string(&argvars[0]); + if (*p == '$') /* environment variable */ + { + /* first try "normal" environment variables (fast) */ + if (mch_getenv(p + 1) != NULL) + n = TRUE; + else + { + /* try expanding things like $VIM and ${HOME} */ + p = expand_env_save(p); + if (p != NULL && *p != '$') + n = TRUE; + vim_free(p); + } + } + else if (*p == '&' || *p == '+') /* option */ + { + n = (get_option_tv(&p, NULL, TRUE) == OK); + if (*skipwhite(p) != NUL) + n = FALSE; /* trailing garbage */ + } + else if (*p == '*') /* internal or user defined function */ + { + n = function_exists(p + 1, FALSE); + } + else if (*p == ':') + { + n = cmd_exists(p + 1); + } + else if (*p == '#') + { + if (p[1] == '#') + n = autocmd_supported(p + 2); + else + n = au_exists(p + 1); + } + else /* internal variable */ + { + n = var_exists(p); + } + + rettv->vval.v_number = n; +} + +#ifdef FEAT_FLOAT +/* + * "exp()" function + */ + static void +f_exp(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = exp(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "expand()" function + */ + static void +f_expand(typval_T *argvars, typval_T *rettv) +{ + char_u *s; + int len; + char_u *errormsg; + int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND; + expand_T xpc; + int error = FALSE; + char_u *result; + + rettv->v_type = VAR_STRING; + if (argvars[1].v_type != VAR_UNKNOWN + && argvars[2].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[2], &error) + && !error) + { + rettv_list_set(rettv, NULL); + } + + s = get_tv_string(&argvars[0]); + if (*s == '%' || *s == '#' || *s == '<') + { + ++emsg_off; + result = eval_vars(s, s, &len, NULL, &errormsg, NULL); + --emsg_off; + if (rettv->v_type == VAR_LIST) + { + if (rettv_list_alloc(rettv) != FAIL && result != NULL) + list_append_string(rettv->vval.v_list, result, -1); + else + vim_free(result); + } + else + rettv->vval.v_string = result; + } + else + { + /* When the optional second argument is non-zero, don't remove matches + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ + if (argvars[1].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[1], &error)) + options |= WILD_KEEP_ALL; + if (!error) + { + ExpandInit(&xpc); + xpc.xp_context = EXPAND_FILES; + if (p_wic) + options += WILD_ICASE; + if (rettv->v_type == VAR_STRING) + rettv->vval.v_string = ExpandOne(&xpc, s, NULL, + options, WILD_ALL); + else if (rettv_list_alloc(rettv) != FAIL) + { + int i; + + ExpandOne(&xpc, s, NULL, options, WILD_ALL_KEEP); + for (i = 0; i < xpc.xp_numfiles; i++) + list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); + ExpandCleanup(&xpc); + } + } + else + rettv->vval.v_string = NULL; + } +} + +/* + * "extend(list, list [, idx])" function + * "extend(dict, dict [, action])" function + */ + static void +f_extend(typval_T *argvars, typval_T *rettv) +{ + char_u *arg_errmsg = (char_u *)N_("extend() argument"); + + if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST) + { + list_T *l1, *l2; + listitem_T *item; + long before; + int error = FALSE; + + l1 = argvars[0].vval.v_list; + l2 = argvars[1].vval.v_list; + if (l1 != NULL && !tv_check_lock(l1->lv_lock, arg_errmsg, TRUE) + && l2 != NULL) + { + if (argvars[2].v_type != VAR_UNKNOWN) + { + before = (long)get_tv_number_chk(&argvars[2], &error); + if (error) + return; /* type error; errmsg already given */ + + if (before == l1->lv_len) + item = NULL; + else + { + item = list_find(l1, before); + if (item == NULL) + { + EMSGN(_(e_listidx), before); + return; + } + } + } + else + item = NULL; + list_extend(l1, l2, item); + + copy_tv(&argvars[0], rettv); + } + } + else if (argvars[0].v_type == VAR_DICT && argvars[1].v_type == VAR_DICT) + { + dict_T *d1, *d2; + char_u *action; + int i; + + d1 = argvars[0].vval.v_dict; + d2 = argvars[1].vval.v_dict; + if (d1 != NULL && !tv_check_lock(d1->dv_lock, arg_errmsg, TRUE) + && d2 != NULL) + { + /* Check the third argument. */ + if (argvars[2].v_type != VAR_UNKNOWN) + { + static char *(av[]) = {"keep", "force", "error"}; + + action = get_tv_string_chk(&argvars[2]); + if (action == NULL) + return; /* type error; errmsg already given */ + for (i = 0; i < 3; ++i) + if (STRCMP(action, av[i]) == 0) + break; + if (i == 3) + { + EMSG2(_(e_invarg2), action); + return; + } + } + else + action = (char_u *)"force"; + + dict_extend(d1, d2, action); + + copy_tv(&argvars[0], rettv); + } + } + else + EMSG2(_(e_listdictarg), "extend()"); +} + +/* + * "feedkeys()" function + */ + static void +f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) +{ + int remap = TRUE; + int insert = FALSE; + char_u *keys, *flags; + char_u nbuf[NUMBUFLEN]; + int typed = FALSE; + int execute = FALSE; + int dangerous = FALSE; + char_u *keys_esc; + + /* This is not allowed in the sandbox. If the commands would still be + * executed in the sandbox it would be OK, but it probably happens later, + * when "sandbox" is no longer set. */ + if (check_secure()) + return; + + keys = get_tv_string(&argvars[0]); + + if (argvars[1].v_type != VAR_UNKNOWN) + { + flags = get_tv_string_buf(&argvars[1], nbuf); + for ( ; *flags != NUL; ++flags) + { + switch (*flags) + { + case 'n': remap = FALSE; break; + case 'm': remap = TRUE; break; + case 't': typed = TRUE; break; + case 'i': insert = TRUE; break; + case 'x': execute = TRUE; break; + case '!': dangerous = TRUE; break; + } + } + } + + if (*keys != NUL || execute) + { + /* Need to escape K_SPECIAL and CSI before putting the string in the + * typeahead buffer. */ + keys_esc = vim_strsave_escape_csi(keys); + if (keys_esc != NULL) + { + ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), + insert ? 0 : typebuf.tb_len, !typed, FALSE); + vim_free(keys_esc); + if (vgetc_busy +#ifdef FEAT_TIMERS + || timer_busy +#endif + ) + 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; + + if (!dangerous) + ++ex_normal_busy; + exec_normal(TRUE, TRUE); + if (!dangerous) + --ex_normal_busy; + + msg_scroll |= save_msg_scroll; + } + } + } +} + +/* + * "filereadable()" function + */ + static void +f_filereadable(typval_T *argvars, typval_T *rettv) +{ + int fd; + char_u *p; + int n; + +#ifndef O_NONBLOCK +# define O_NONBLOCK 0 +#endif + p = get_tv_string(&argvars[0]); + if (*p && !mch_isdir(p) && (fd = mch_open((char *)p, + O_RDONLY | O_NONBLOCK, 0)) >= 0) + { + n = TRUE; + close(fd); + } + else + n = FALSE; + + rettv->vval.v_number = n; +} + +/* + * Return 0 for not writable, 1 for writable file, 2 for a dir which we have + * rights to write into. + */ + static void +f_filewritable(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = filewritable(get_tv_string(&argvars[0])); +} + + static void +findfilendir( + typval_T *argvars UNUSED, + typval_T *rettv, + int find_what UNUSED) +{ +#ifdef FEAT_SEARCHPATH + char_u *fname; + char_u *fresult = NULL; + char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; + char_u *p; + char_u pathbuf[NUMBUFLEN]; + int count = 1; + int first = TRUE; + int error = FALSE; +#endif + + rettv->vval.v_string = NULL; + rettv->v_type = VAR_STRING; + +#ifdef FEAT_SEARCHPATH + fname = get_tv_string(&argvars[0]); + + if (argvars[1].v_type != VAR_UNKNOWN) + { + p = get_tv_string_buf_chk(&argvars[1], pathbuf); + if (p == NULL) + error = TRUE; + else + { + if (*p != NUL) + path = p; + + if (argvars[2].v_type != VAR_UNKNOWN) + count = (int)get_tv_number_chk(&argvars[2], &error); + } + } + + if (count < 0 && rettv_list_alloc(rettv) == FAIL) + error = TRUE; + + if (*fname != NUL && !error) + { + do + { + if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST) + vim_free(fresult); + fresult = find_file_in_path_option(first ? fname : NULL, + first ? (int)STRLEN(fname) : 0, + 0, first, path, + find_what, + curbuf->b_ffname, + find_what == FINDFILE_DIR + ? (char_u *)"" : curbuf->b_p_sua); + first = FALSE; + + if (fresult != NULL && rettv->v_type == VAR_LIST) + list_append_string(rettv->vval.v_list, fresult, -1); + + } while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL); + } + + if (rettv->v_type == VAR_STRING) + rettv->vval.v_string = fresult; +#endif +} + +/* + * "filter()" function + */ + static void +f_filter(typval_T *argvars, typval_T *rettv) +{ + filter_map(argvars, rettv, FALSE); +} + +/* + * "finddir({fname}[, {path}[, {count}]])" function + */ + static void +f_finddir(typval_T *argvars, typval_T *rettv) +{ + findfilendir(argvars, rettv, FINDFILE_DIR); +} + +/* + * "findfile({fname}[, {path}[, {count}]])" function + */ + static void +f_findfile(typval_T *argvars, typval_T *rettv) +{ + findfilendir(argvars, rettv, FINDFILE_FILE); +} + +#ifdef FEAT_FLOAT +/* + * "float2nr({float})" function + */ + static void +f_float2nr(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + if (get_float_arg(argvars, &f) == OK) + { + if (f <= -VARNUM_MAX + DBL_EPSILON) + rettv->vval.v_number = -VARNUM_MAX; + else if (f >= VARNUM_MAX - DBL_EPSILON) + rettv->vval.v_number = VARNUM_MAX; + else + rettv->vval.v_number = (varnumber_T)f; + } +} + +/* + * "floor({float})" function + */ + static void +f_floor(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = floor(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "fmod()" function + */ + static void +f_fmod(typval_T *argvars, typval_T *rettv) +{ + float_T fx = 0.0, fy = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &fx) == OK + && get_float_arg(&argvars[1], &fy) == OK) + rettv->vval.v_float = fmod(fx, fy); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "fnameescape({string})" function + */ + static void +f_fnameescape(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_string = vim_strsave_fnameescape( + get_tv_string(&argvars[0]), FALSE); + rettv->v_type = VAR_STRING; +} + +/* + * "fnamemodify({fname}, {mods})" function + */ + static void +f_fnamemodify(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + char_u *mods; + int usedlen = 0; + int len; + char_u *fbuf = NULL; + char_u buf[NUMBUFLEN]; + + fname = get_tv_string_chk(&argvars[0]); + mods = get_tv_string_buf_chk(&argvars[1], buf); + if (fname == NULL || mods == NULL) + fname = NULL; + else + { + len = (int)STRLEN(fname); + (void)modify_fname(mods, &usedlen, &fname, &fbuf, &len); + } + + rettv->v_type = VAR_STRING; + if (fname == NULL) + rettv->vval.v_string = NULL; + else + rettv->vval.v_string = vim_strnsave(fname, len); + vim_free(fbuf); +} + +static void foldclosed_both(typval_T *argvars, typval_T *rettv, int end); + +/* + * "foldclosed()" function + */ + static void +foldclosed_both( + typval_T *argvars UNUSED, + typval_T *rettv, + int end UNUSED) +{ +#ifdef FEAT_FOLDING + linenr_T lnum; + linenr_T first, last; + + lnum = get_tv_lnum(argvars); + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) + { + if (hasFoldingWin(curwin, lnum, &first, &last, FALSE, NULL)) + { + if (end) + rettv->vval.v_number = (varnumber_T)last; + else + rettv->vval.v_number = (varnumber_T)first; + return; + } + } +#endif + rettv->vval.v_number = -1; +} + +/* + * "foldclosed()" function + */ + static void +f_foldclosed(typval_T *argvars, typval_T *rettv) +{ + foldclosed_both(argvars, rettv, FALSE); +} + +/* + * "foldclosedend()" function + */ + static void +f_foldclosedend(typval_T *argvars, typval_T *rettv) +{ + foldclosed_both(argvars, rettv, TRUE); +} + +/* + * "foldlevel()" function + */ + static void +f_foldlevel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_FOLDING + linenr_T lnum; + + lnum = get_tv_lnum(argvars); + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) + rettv->vval.v_number = foldLevel(lnum); +#endif +} + +/* + * "foldtext()" function + */ + static void +f_foldtext(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_FOLDING + linenr_T foldstart; + linenr_T foldend; + char_u *dashes; + linenr_T lnum; + char_u *s; + char_u *r; + int len; + char *txt; + long count; +#endif + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_FOLDING + foldstart = (linenr_T)get_vim_var_nr(VV_FOLDSTART); + foldend = (linenr_T)get_vim_var_nr(VV_FOLDEND); + dashes = get_vim_var_str(VV_FOLDDASHES); + if (foldstart > 0 && foldend <= curbuf->b_ml.ml_line_count + && dashes != NULL) + { + /* Find first non-empty line in the fold. */ + for (lnum = foldstart; lnum < foldend; ++lnum) + if (!linewhite(lnum)) + break; + + /* Find interesting text in this line. */ + s = skipwhite(ml_get(lnum)); + /* skip C comment-start */ + if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) + { + s = skipwhite(s + 2); + if (*skipwhite(s) == NUL + && lnum + 1 < (linenr_T)get_vim_var_nr(VV_FOLDEND)) + { + s = skipwhite(ml_get(lnum + 1)); + if (*s == '*') + s = skipwhite(s + 1); + } + } + count = (long)(foldend - foldstart + 1); + txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count); + r = alloc((unsigned)(STRLEN(txt) + + STRLEN(dashes) /* for %s */ + + 20 /* for %3ld */ + + STRLEN(s))); /* concatenated */ + if (r != NULL) + { + sprintf((char *)r, txt, dashes, count); + len = (int)STRLEN(r); + STRCAT(r, s); + /* remove 'foldmarker' and 'commentstring' */ + foldtext_cleanup(r + len); + rettv->vval.v_string = r; + } + } +#endif +} + +/* + * "foldtextresult(lnum)" function + */ + static void +f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_FOLDING + linenr_T lnum; + char_u *text; + char_u buf[FOLD_TEXT_LEN]; + foldinfo_T foldinfo; + int fold_count; + static int entered = FALSE; +#endif + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_FOLDING + if (entered) + return; /* reject recursive use */ + entered = TRUE; + + lnum = get_tv_lnum(argvars); + /* treat illegal types and illegal string values for {lnum} the same */ + if (lnum < 0) + lnum = 0; + fold_count = foldedCount(curwin, lnum, &foldinfo); + if (fold_count > 0) + { + text = get_foldtext(curwin, lnum, lnum + fold_count - 1, + &foldinfo, buf); + if (text == buf) + text = vim_strsave(text); + rettv->vval.v_string = text; + } + + entered = FALSE; +#endif +} + +/* + * "foreground()" function + */ + static void +f_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_GUI + if (gui.in_use) + gui_mch_set_foreground(); +#else +# ifdef WIN32 + win32_set_foreground(); +# endif +#endif +} + + static void +common_function(typval_T *argvars, typval_T *rettv, int is_funcref) +{ + char_u *s; + char_u *name; + int use_string = FALSE; + partial_T *arg_pt = NULL; + char_u *trans_name = NULL; + + if (argvars[0].v_type == VAR_FUNC) + { + /* function(MyFunc, [arg], dict) */ + s = argvars[0].vval.v_string; + } + else if (argvars[0].v_type == VAR_PARTIAL + && argvars[0].vval.v_partial != NULL) + { + /* function(dict.MyFunc, [arg]) */ + arg_pt = argvars[0].vval.v_partial; + s = partial_name(arg_pt); + } + else + { + /* function('MyFunc', [arg], dict) */ + s = get_tv_string(&argvars[0]); + use_string = TRUE; + } + + if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) + { + name = s; + trans_name = trans_function_name(&name, FALSE, + TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD | TFN_NO_DEREF, NULL, NULL); + if (*name != NUL) + s = NULL; + } + + if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) + || (is_funcref && trans_name == NULL)) + EMSG2(_(e_invarg2), use_string ? get_tv_string(&argvars[0]) : s); + /* Don't check an autoload name for existence here. */ + else if (trans_name != NULL && (is_funcref + ? find_func(trans_name) == NULL + : !translated_function_exists(trans_name))) + EMSG2(_("E700: Unknown function: %s"), s); + else + { + int dict_idx = 0; + int arg_idx = 0; + list_T *list = NULL; + + if (STRNCMP(s, "s:", 2) == 0 || STRNCMP(s, "<SID>", 5) == 0) + { + char sid_buf[25]; + int off = *s == 's' ? 2 : 5; + + /* Expand s: and <SID> into <SNR>nr_, so that the function can + * also be called from another script. Using trans_function_name() + * would also work, but some plugins depend on the name being + * printable text. */ + sprintf(sid_buf, "<SNR>%ld_", (long)current_SID); + name = alloc((int)(STRLEN(sid_buf) + STRLEN(s + off) + 1)); + if (name != NULL) + { + STRCPY(name, sid_buf); + STRCAT(name, s + off); + } + } + else + name = vim_strsave(s); + + if (argvars[1].v_type != VAR_UNKNOWN) + { + if (argvars[2].v_type != VAR_UNKNOWN) + { + /* function(name, [args], dict) */ + arg_idx = 1; + dict_idx = 2; + } + else if (argvars[1].v_type == VAR_DICT) + /* function(name, dict) */ + dict_idx = 1; + else + /* function(name, [args]) */ + arg_idx = 1; + if (dict_idx > 0) + { + if (argvars[dict_idx].v_type != VAR_DICT) + { + EMSG(_("E922: expected a dict")); + vim_free(name); + goto theend; + } + if (argvars[dict_idx].vval.v_dict == NULL) + dict_idx = 0; + } + if (arg_idx > 0) + { + if (argvars[arg_idx].v_type != VAR_LIST) + { + EMSG(_("E923: Second argument of function() must be a list or a dict")); + vim_free(name); + goto theend; + } + list = argvars[arg_idx].vval.v_list; + if (list == NULL || list->lv_len == 0) + arg_idx = 0; + } + } + if (dict_idx > 0 || arg_idx > 0 || arg_pt != NULL || is_funcref) + { + partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T)); + + /* result is a VAR_PARTIAL */ + if (pt == NULL) + vim_free(name); + else + { + if (arg_idx > 0 || (arg_pt != NULL && arg_pt->pt_argc > 0)) + { + listitem_T *li; + int i = 0; + int arg_len = 0; + int lv_len = 0; + + if (arg_pt != NULL) + arg_len = arg_pt->pt_argc; + if (list != NULL) + lv_len = list->lv_len; + pt->pt_argc = arg_len + lv_len; + pt->pt_argv = (typval_T *)alloc( + sizeof(typval_T) * pt->pt_argc); + if (pt->pt_argv == NULL) + { + vim_free(pt); + vim_free(name); + goto theend; + } + for (i = 0; i < arg_len; i++) + copy_tv(&arg_pt->pt_argv[i], &pt->pt_argv[i]); + if (lv_len > 0) + for (li = list->lv_first; li != NULL; + li = li->li_next) + copy_tv(&li->li_tv, &pt->pt_argv[i++]); + } + + /* For "function(dict.func, [], dict)" and "func" is a partial + * use "dict". That is backwards compatible. */ + if (dict_idx > 0) + { + /* The dict is bound explicitly, pt_auto is FALSE. */ + pt->pt_dict = argvars[dict_idx].vval.v_dict; + ++pt->pt_dict->dv_refcount; + } + else if (arg_pt != NULL) + { + /* If the dict was bound automatically the result is also + * bound automatically. */ + pt->pt_dict = arg_pt->pt_dict; + pt->pt_auto = arg_pt->pt_auto; + if (pt->pt_dict != NULL) + ++pt->pt_dict->dv_refcount; + } + + pt->pt_refcount = 1; + if (arg_pt != NULL && arg_pt->pt_func != NULL) + { + pt->pt_func = arg_pt->pt_func; + func_ptr_ref(pt->pt_func); + vim_free(name); + } + else if (is_funcref) + { + pt->pt_func = find_func(trans_name); + func_ptr_ref(pt->pt_func); + vim_free(name); + } + else + { + pt->pt_name = name; + func_ref(name); + } + } + rettv->v_type = VAR_PARTIAL; + rettv->vval.v_partial = pt; + } + else + { + /* result is a VAR_FUNC */ + rettv->v_type = VAR_FUNC; + rettv->vval.v_string = name; + func_ref(name); + } + } +theend: + vim_free(trans_name); +} + +/* + * "funcref()" function + */ + static void +f_funcref(typval_T *argvars, typval_T *rettv) +{ + common_function(argvars, rettv, TRUE); +} + +/* + * "function()" function + */ + static void +f_function(typval_T *argvars, typval_T *rettv) +{ + common_function(argvars, rettv, FALSE); +} + +/* + * "garbagecollect()" function + */ + static void +f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED) +{ + /* This is postponed until we are back at the toplevel, because we may be + * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ + want_garbage_collect = TRUE; + + if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1) + garbage_collect_at_exit = TRUE; +} + +/* + * "get()" function + */ + static void +f_get(typval_T *argvars, typval_T *rettv) +{ + listitem_T *li; + list_T *l; + dictitem_T *di; + dict_T *d; + typval_T *tv = NULL; + + if (argvars[0].v_type == VAR_LIST) + { + if ((l = argvars[0].vval.v_list) != NULL) + { + int error = FALSE; + + li = list_find(l, (long)get_tv_number_chk(&argvars[1], &error)); + if (!error && li != NULL) + tv = &li->li_tv; + } + } + else if (argvars[0].v_type == VAR_DICT) + { + if ((d = argvars[0].vval.v_dict) != NULL) + { + di = dict_find(d, get_tv_string(&argvars[1]), -1); + if (di != NULL) + tv = &di->di_tv; + } + } + else if (argvars[0].v_type == VAR_PARTIAL || argvars[0].v_type == VAR_FUNC) + { + partial_T *pt; + partial_T fref_pt; + + if (argvars[0].v_type == VAR_PARTIAL) + pt = argvars[0].vval.v_partial; + else + { + vim_memset(&fref_pt, 0, sizeof(fref_pt)); + fref_pt.pt_name = argvars[0].vval.v_string; + pt = &fref_pt; + } + + if (pt != NULL) + { + char_u *what = get_tv_string(&argvars[1]); + char_u *n; + + if (STRCMP(what, "func") == 0 || STRCMP(what, "name") == 0) + { + rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING); + n = partial_name(pt); + if (n == NULL) + rettv->vval.v_string = NULL; + else + { + rettv->vval.v_string = vim_strsave(n); + if (rettv->v_type == VAR_FUNC) + func_ref(rettv->vval.v_string); + } + } + else if (STRCMP(what, "dict") == 0) + rettv_dict_set(rettv, pt->pt_dict); + else if (STRCMP(what, "args") == 0) + { + rettv->v_type = VAR_LIST; + if (rettv_list_alloc(rettv) == OK) + { + int i; + + for (i = 0; i < pt->pt_argc; ++i) + list_append_tv(rettv->vval.v_list, &pt->pt_argv[i]); + } + } + else + EMSG2(_(e_invarg2), what); + return; + } + } + else + EMSG2(_(e_listdictarg), "get()"); + + if (tv == NULL) + { + if (argvars[2].v_type != VAR_UNKNOWN) + copy_tv(&argvars[2], rettv); + } + else + copy_tv(tv, rettv); +} + +#ifdef FEAT_SIGNS +/* + * Returns information about signs placed in a buffer as list of dicts. + */ + static void +get_buffer_signs(buf_T *buf, list_T *l) +{ + signlist_T *sign; + + for (sign = buf->b_signlist; sign; sign = sign->next) + { + dict_T *d = dict_alloc(); + + if (d != NULL) + { + dict_add_nr_str(d, "id", sign->id, NULL); + dict_add_nr_str(d, "lnum", sign->lnum, NULL); + dict_add_nr_str(d, "name", 0L, sign_typenr2name(sign->typenr)); + + list_append_dict(l, d); + } + } +} +#endif + +/* + * Returns buffer options, variables and other attributes in a dictionary. + */ + static dict_T * +get_buffer_info(buf_T *buf) +{ + dict_T *dict; + tabpage_T *tp; + win_T *wp; + list_T *windows; + + dict = dict_alloc(); + if (dict == NULL) + return NULL; + + dict_add_nr_str(dict, "bufnr", buf->b_fnum, NULL); + dict_add_nr_str(dict, "name", 0L, + buf->b_ffname != NULL ? buf->b_ffname : (char_u *)""); + dict_add_nr_str(dict, "lnum", buf == curbuf ? curwin->w_cursor.lnum + : buflist_findlnum(buf), NULL); + dict_add_nr_str(dict, "loaded", buf->b_ml.ml_mfp != NULL, NULL); + dict_add_nr_str(dict, "listed", buf->b_p_bl, NULL); + dict_add_nr_str(dict, "changed", bufIsChanged(buf), NULL); + dict_add_nr_str(dict, "changedtick", CHANGEDTICK(buf), NULL); + dict_add_nr_str(dict, "hidden", + buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0, + NULL); + + /* Get a reference to buffer variables */ + dict_add_dict(dict, "variables", buf->b_vars); + + /* List of windows displaying this buffer */ + windows = list_alloc(); + if (windows != NULL) + { + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer == buf) + list_append_number(windows, (varnumber_T)wp->w_id); + dict_add_list(dict, "windows", windows); + } + +#ifdef FEAT_SIGNS + if (buf->b_signlist != NULL) + { + /* List of signs placed in this buffer */ + list_T *signs = list_alloc(); + if (signs != NULL) + { + get_buffer_signs(buf, signs); + dict_add_list(dict, "signs", signs); + } + } +#endif + + return dict; +} + +/* + * "getbufinfo()" function + */ + static void +f_getbufinfo(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = NULL; + buf_T *argbuf = NULL; + dict_T *d; + int filtered = FALSE; + int sel_buflisted = FALSE; + int sel_bufloaded = FALSE; + int sel_bufmodified = FALSE; + + if (rettv_list_alloc(rettv) != OK) + return; + + /* List of all the buffers or selected buffers */ + if (argvars[0].v_type == VAR_DICT) + { + dict_T *sel_d = argvars[0].vval.v_dict; + + if (sel_d != NULL) + { + dictitem_T *di; + + filtered = TRUE; + + di = dict_find(sel_d, (char_u *)"buflisted", -1); + if (di != NULL && get_tv_number(&di->di_tv)) + sel_buflisted = TRUE; + + di = dict_find(sel_d, (char_u *)"bufloaded", -1); + if (di != NULL && get_tv_number(&di->di_tv)) + sel_bufloaded = TRUE; + + di = dict_find(sel_d, (char_u *)"bufmodified", -1); + if (di != NULL && get_tv_number(&di->di_tv)) + sel_bufmodified = TRUE; + } + } + else if (argvars[0].v_type != VAR_UNKNOWN) + { + /* Information about one buffer. Argument specifies the buffer */ + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + argbuf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + if (argbuf == NULL) + return; + } + + /* Return information about all the buffers or a specified buffer */ + FOR_ALL_BUFFERS(buf) + { + if (argbuf != NULL && argbuf != buf) + continue; + if (filtered && ((sel_bufloaded && buf->b_ml.ml_mfp == NULL) + || (sel_buflisted && !buf->b_p_bl) + || (sel_bufmodified && !buf->b_changed))) + continue; + + d = get_buffer_info(buf); + if (d != NULL) + list_append_dict(rettv->vval.v_list, d); + if (argbuf != NULL) + return; + } +} + +static void get_buffer_lines(buf_T *buf, linenr_T start, linenr_T end, int retlist, typval_T *rettv); + +/* + * Get line or list of lines from buffer "buf" into "rettv". + * Return a range (from start to end) of lines in rettv from the specified + * buffer. + * If 'retlist' is TRUE, then the lines are returned as a Vim List. + */ + static void +get_buffer_lines( + buf_T *buf, + linenr_T start, + linenr_T end, + int retlist, + typval_T *rettv) +{ + char_u *p; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + if (retlist && rettv_list_alloc(rettv) == FAIL) + return; + + if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0) + return; + + if (!retlist) + { + if (start >= 1 && start <= buf->b_ml.ml_line_count) + p = ml_get_buf(buf, start, FALSE); + else + p = (char_u *)""; + rettv->vval.v_string = vim_strsave(p); + } + else + { + if (end < start) + return; + + if (start < 1) + start = 1; + if (end > buf->b_ml.ml_line_count) + end = buf->b_ml.ml_line_count; + while (start <= end) + if (list_append_string(rettv->vval.v_list, + ml_get_buf(buf, start++, FALSE), -1) == FAIL) + break; + } +} + +/* + * "getbufline()" function + */ + static void +f_getbufline(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + linenr_T end; + buf_T *buf; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + + lnum = get_tv_lnum_buf(&argvars[1], buf); + if (argvars[2].v_type == VAR_UNKNOWN) + end = lnum; + else + end = get_tv_lnum_buf(&argvars[2], buf); + + get_buffer_lines(buf, lnum, end, TRUE, rettv); +} + +/* + * "getbufvar()" function + */ + static void +f_getbufvar(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf; + buf_T *save_curbuf; + char_u *varname; + dictitem_T *v; + int done = FALSE; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + varname = get_tv_string_chk(&argvars[1]); + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + if (buf != NULL && varname != NULL) + { + /* set curbuf to be our buf, temporarily */ + save_curbuf = curbuf; + curbuf = buf; + + if (*varname == '&') + { + if (varname[1] == NUL) + { + /* get all buffer-local options in a dict */ + dict_T *opts = get_winbuf_options(TRUE); + + if (opts != NULL) + { + rettv_dict_set(rettv, opts); + done = TRUE; + } + } + else if (get_option_tv(&varname, rettv, TRUE) == OK) + /* buffer-local-option */ + done = TRUE; + } + else + { + /* Look up the variable. */ + /* Let getbufvar({nr}, "") return the "b:" dictionary. */ + v = find_var_in_ht(&curbuf->b_vars->dv_hashtab, + 'b', varname, FALSE); + if (v != NULL) + { + copy_tv(&v->di_tv, rettv); + done = TRUE; + } + } + + /* restore previous notion of curbuf */ + curbuf = save_curbuf; + } + + if (!done && argvars[2].v_type != VAR_UNKNOWN) + /* use the default value */ + copy_tv(&argvars[2], rettv); + + --emsg_off; +} + +/* + * "getchangelist()" function + */ + static void +f_getchangelist(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_JUMPLIST + buf_T *buf; + int i; + list_T *l; + dict_T *d; +#endif + + if (rettv_list_alloc(rettv) != OK) + return; + +#ifdef FEAT_JUMPLIST + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + if (buf == NULL) + return; + + l = list_alloc(); + if (l == NULL) + return; + + if (list_append_list(rettv->vval.v_list, l) == FAIL) + return; + /* + * The current window change list index tracks only the position in the + * current buffer change list. For other buffers, use the change list + * length as the current index. + */ + list_append_number(rettv->vval.v_list, + (varnumber_T)((buf == curwin->w_buffer) + ? curwin->w_changelistidx : buf->b_changelistlen)); + + for (i = 0; i < buf->b_changelistlen; ++i) + { + if (buf->b_changelist[i].lnum == 0) + continue; + if ((d = dict_alloc()) == NULL) + return; + if (list_append_dict(l, d) == FAIL) + return; + dict_add_nr_str(d, "lnum", (long)buf->b_changelist[i].lnum, NULL); + dict_add_nr_str(d, "col", (long)buf->b_changelist[i].col, NULL); +# ifdef FEAT_VIRTUALEDIT + dict_add_nr_str(d, "coladd", (long)buf->b_changelist[i].coladd, NULL); +# endif + } +#endif +} +/* + * "getchar()" function + */ + static void +f_getchar(typval_T *argvars, typval_T *rettv) +{ + varnumber_T n; + int error = FALSE; + + /* Position the cursor. Needed after a message that ends in a space. */ + windgoto(msg_row, msg_col); + + ++no_mapping; + ++allow_keys; + for (;;) + { + if (argvars[0].v_type == VAR_UNKNOWN) + /* getchar(): blocking wait. */ + n = plain_vgetc(); + else if (get_tv_number_chk(&argvars[0], &error) == 1) + /* getchar(1): only check if char avail */ + n = vpeekc_any(); + else if (error || vpeekc_any() == NUL) + /* illegal argument or getchar(0) and no char avail: return zero */ + n = 0; + else + /* getchar(0) and char avail: return char */ + n = plain_vgetc(); + + if (n == K_IGNORE) + continue; + break; + } + --no_mapping; + --allow_keys; + + set_vim_var_nr(VV_MOUSE_WIN, 0); + set_vim_var_nr(VV_MOUSE_WINID, 0); + set_vim_var_nr(VV_MOUSE_LNUM, 0); + set_vim_var_nr(VV_MOUSE_COL, 0); + + rettv->vval.v_number = n; + if (IS_SPECIAL(n) || mod_mask != 0) + { + char_u temp[10]; /* modifier: 3, mbyte-char: 6, NUL: 1 */ + int i = 0; + + /* Turn a special key into three bytes, plus modifier. */ + if (mod_mask != 0) + { + temp[i++] = K_SPECIAL; + temp[i++] = KS_MODIFIER; + temp[i++] = mod_mask; + } + if (IS_SPECIAL(n)) + { + temp[i++] = K_SPECIAL; + temp[i++] = K_SECOND(n); + temp[i++] = K_THIRD(n); + } +#ifdef FEAT_MBYTE + else if (has_mbyte) + i += (*mb_char2bytes)(n, temp + i); +#endif + else + temp[i++] = n; + temp[i++] = NUL; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(temp); + +#ifdef FEAT_MOUSE + if (is_mouse_key(n) +# ifdef FEAT_GUI_MACVIM + || n == K_SWIPELEFT + || n == K_SWIPERIGHT + || n == K_SWIPEUP + || n == K_SWIPEDOWN +# endif + ) + { + int row = mouse_row; + int col = mouse_col; + win_T *win; + linenr_T lnum; + win_T *wp; + int winnr = 1; + + if (row >= 0 && col >= 0) + { + /* Find the window at the mouse coordinates and compute the + * text position. */ + win = mouse_find_win(&row, &col); + if (win == NULL) + return; + (void)mouse_comp_pos(win, &row, &col, &lnum); + for (wp = firstwin; wp != win; wp = wp->w_next) + ++winnr; + set_vim_var_nr(VV_MOUSE_WIN, winnr); + set_vim_var_nr(VV_MOUSE_WINID, win->w_id); + set_vim_var_nr(VV_MOUSE_LNUM, lnum); + set_vim_var_nr(VV_MOUSE_COL, col + 1); + } + } +#endif + } +} + +/* + * "getcharmod()" function + */ + static void +f_getcharmod(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = mod_mask; +} + +/* + * "getcharsearch()" function + */ + static void +f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (rettv_dict_alloc(rettv) != FAIL) + { + dict_T *dict = rettv->vval.v_dict; + + dict_add_nr_str(dict, "char", 0L, last_csearch()); + dict_add_nr_str(dict, "forward", last_csearch_forward(), NULL); + dict_add_nr_str(dict, "until", last_csearch_until(), NULL); + } +} + +/* + * "getcmdline()" function + */ + static void +f_getcmdline(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = get_cmdline_str(); +} + +/* + * "getcmdpos()" function + */ + static void +f_getcmdpos(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = get_cmdline_pos() + 1; +} + +/* + * "getcmdtype()" function + */ + static void +f_getcmdtype(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = alloc(2); + if (rettv->vval.v_string != NULL) + { + rettv->vval.v_string[0] = get_cmdline_type(); + rettv->vval.v_string[1] = NUL; + } +} + +/* + * "getcmdwintype()" function + */ + static void +f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_CMDWIN + rettv->vval.v_string = alloc(2); + if (rettv->vval.v_string != NULL) + { + rettv->vval.v_string[0] = cmdwin_type; + rettv->vval.v_string[1] = NUL; + } +#endif +} + +#if defined(FEAT_CMDL_COMPL) +/* + * "getcompletion()" function + */ + static void +f_getcompletion(typval_T *argvars, typval_T *rettv) +{ + char_u *pat; + expand_T xpc; + int filtered = FALSE; + int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH + | WILD_NO_BEEP; + + if (argvars[2].v_type != VAR_UNKNOWN) + filtered = get_tv_number_chk(&argvars[2], NULL); + + if (p_wic) + options |= WILD_ICASE; + + /* For filtered results, 'wildignore' is used */ + if (!filtered) + options |= WILD_KEEP_ALL; + + ExpandInit(&xpc); + xpc.xp_pattern = get_tv_string(&argvars[0]); + xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); + xpc.xp_context = cmdcomplete_str_to_type(get_tv_string(&argvars[1])); + if (xpc.xp_context == EXPAND_NOTHING) + { + if (argvars[1].v_type == VAR_STRING) + EMSG2(_(e_invarg2), argvars[1].vval.v_string); + else + EMSG(_(e_invarg)); + return; + } + +# if defined(FEAT_MENU) + if (xpc.xp_context == EXPAND_MENUS) + { + set_context_in_menu_cmd(&xpc, (char_u *)"menu", xpc.xp_pattern, FALSE); + xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); + } +# endif +#ifdef FEAT_CSCOPE + if (xpc.xp_context == EXPAND_CSCOPE) + { + set_context_in_cscope_cmd(&xpc, xpc.xp_pattern, CMD_cscope); + xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); + } +#endif +#ifdef FEAT_SIGNS + if (xpc.xp_context == EXPAND_SIGN) + { + set_context_in_sign_cmd(&xpc, xpc.xp_pattern); + xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); + } +#endif + + pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context); + if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL)) + { + int i; + + ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP); + + for (i = 0; i < xpc.xp_numfiles; i++) + list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); + } + vim_free(pat); + ExpandCleanup(&xpc); +} +#endif + +/* + * "getcwd()" function + */ + static void +f_getcwd(typval_T *argvars, typval_T *rettv) +{ + win_T *wp = NULL; + char_u *cwd; + int global = FALSE; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + if (argvars[0].v_type == VAR_NUMBER && argvars[0].vval.v_number == -1) + global = TRUE; + else + wp = find_tabwin(&argvars[0], &argvars[1]); + + if (wp != NULL && wp->w_localdir != NULL) + rettv->vval.v_string = vim_strsave(wp->w_localdir); + else if (wp != NULL || global) + { + if (globaldir != NULL) + rettv->vval.v_string = vim_strsave(globaldir); + else + { + cwd = alloc(MAXPATHL); + if (cwd != NULL) + { + if (mch_dirname(cwd, MAXPATHL) != FAIL) + rettv->vval.v_string = vim_strsave(cwd); + vim_free(cwd); + } + } +#ifdef BACKSLASH_IN_FILENAME + if (rettv->vval.v_string != NULL) + slash_adjust(rettv->vval.v_string); +#endif + } +} + +/* + * "getfontname()" function + */ + static void +f_getfontname(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_GUI + if (gui.in_use) + { + GuiFont font; + char_u *name = NULL; + + if (argvars[0].v_type == VAR_UNKNOWN) + { + /* Get the "Normal" font. Either the name saved by + * hl_set_font_name() or from the font ID. */ + font = gui.norm_font; + name = hl_get_font_name(); + } + else + { + name = get_tv_string(&argvars[0]); + if (STRCMP(name, "*") == 0) /* don't use font dialog */ + return; + font = gui_mch_get_font(name, FALSE); + if (font == NOFONT) + return; /* Invalid font name, return empty string. */ + } + rettv->vval.v_string = gui_mch_get_fontname(font, name); + if (argvars[0].v_type != VAR_UNKNOWN) + gui_mch_free_font(font); + } +#endif +} + +/* + * "getfperm({fname})" function + */ + static void +f_getfperm(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + stat_T st; + char_u *perm = NULL; + char_u flags[] = "rwx"; + int i; + + fname = get_tv_string(&argvars[0]); + + rettv->v_type = VAR_STRING; + if (mch_stat((char *)fname, &st) >= 0) + { + perm = vim_strsave((char_u *)"---------"); + if (perm != NULL) + { + for (i = 0; i < 9; i++) + { + if (st.st_mode & (1 << (8 - i))) + perm[i] = flags[i % 3]; + } + } + } + rettv->vval.v_string = perm; +} + +/* + * "getfsize({fname})" function + */ + static void +f_getfsize(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + stat_T st; + + fname = get_tv_string(&argvars[0]); + + rettv->v_type = VAR_NUMBER; + + if (mch_stat((char *)fname, &st) >= 0) + { + if (mch_isdir(fname)) + rettv->vval.v_number = 0; + else + { + rettv->vval.v_number = (varnumber_T)st.st_size; + + /* non-perfect check for overflow */ + if ((off_T)rettv->vval.v_number != (off_T)st.st_size) + rettv->vval.v_number = -2; + } + } + else + rettv->vval.v_number = -1; +} + +/* + * "getftime({fname})" function + */ + static void +f_getftime(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + stat_T st; + + fname = get_tv_string(&argvars[0]); + + if (mch_stat((char *)fname, &st) >= 0) + rettv->vval.v_number = (varnumber_T)st.st_mtime; + else + rettv->vval.v_number = -1; +} + +/* + * "getftype({fname})" function + */ + static void +f_getftype(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + stat_T st; + char_u *type = NULL; + char *t; + + fname = get_tv_string(&argvars[0]); + + rettv->v_type = VAR_STRING; + if (mch_lstat((char *)fname, &st) >= 0) + { +#ifdef S_ISREG + if (S_ISREG(st.st_mode)) + t = "file"; + else if (S_ISDIR(st.st_mode)) + t = "dir"; +# ifdef S_ISLNK + else if (S_ISLNK(st.st_mode)) + t = "link"; +# endif +# ifdef S_ISBLK + else if (S_ISBLK(st.st_mode)) + t = "bdev"; +# endif +# ifdef S_ISCHR + else if (S_ISCHR(st.st_mode)) + t = "cdev"; +# endif +# ifdef S_ISFIFO + else if (S_ISFIFO(st.st_mode)) + t = "fifo"; +# endif +# ifdef S_ISSOCK + else if (S_ISSOCK(st.st_mode)) + t = "fifo"; +# endif + else + t = "other"; +#else +# ifdef S_IFMT + switch (st.st_mode & S_IFMT) + { + case S_IFREG: t = "file"; break; + case S_IFDIR: t = "dir"; break; +# ifdef S_IFLNK + case S_IFLNK: t = "link"; break; +# endif +# ifdef S_IFBLK + case S_IFBLK: t = "bdev"; break; +# endif +# ifdef S_IFCHR + case S_IFCHR: t = "cdev"; break; +# endif +# ifdef S_IFIFO + case S_IFIFO: t = "fifo"; break; +# endif +# ifdef S_IFSOCK + case S_IFSOCK: t = "socket"; break; +# endif + default: t = "other"; + } +# else + if (mch_isdir(fname)) + t = "dir"; + else + t = "file"; +# endif +#endif + type = vim_strsave((char_u *)t); + } + rettv->vval.v_string = type; +} + +/* + * "getjumplist()" function + */ + static void +f_getjumplist(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_JUMPLIST + win_T *wp; + int i; + list_T *l; + dict_T *d; +#endif + + if (rettv_list_alloc(rettv) != OK) + return; + +#ifdef FEAT_JUMPLIST + wp = find_tabwin(&argvars[0], &argvars[1]); + if (wp == NULL) + return; + + l = list_alloc(); + if (l == NULL) + return; + + if (list_append_list(rettv->vval.v_list, l) == FAIL) + return; + list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx); + + cleanup_jumplist(wp, TRUE); + + for (i = 0; i < wp->w_jumplistlen; ++i) + { + if (wp->w_jumplist[i].fmark.mark.lnum == 0) + continue; + if ((d = dict_alloc()) == NULL) + return; + if (list_append_dict(l, d) == FAIL) + return; + dict_add_nr_str(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum, + NULL); + dict_add_nr_str(d, "col", (long)wp->w_jumplist[i].fmark.mark.col, + NULL); +# ifdef FEAT_VIRTUALEDIT + dict_add_nr_str(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd, + NULL); +# endif + dict_add_nr_str(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum, NULL); + if (wp->w_jumplist[i].fname != NULL) + dict_add_nr_str(d, "filename", 0L, wp->w_jumplist[i].fname); + } +#endif +} + +/* + * "getline(lnum, [end])" function + */ + static void +f_getline(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + linenr_T end; + int retlist; + + lnum = get_tv_lnum(argvars); + if (argvars[1].v_type == VAR_UNKNOWN) + { + end = 0; + retlist = FALSE; + } + else + { + end = get_tv_lnum(&argvars[1]); + retlist = TRUE; + } + + get_buffer_lines(curbuf, lnum, end, retlist, rettv); +} + +#ifdef FEAT_QUICKFIX + static void +get_qf_loc_list(int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv) +{ + if (what_arg->v_type == VAR_UNKNOWN) + { + if (rettv_list_alloc(rettv) == OK) + if (is_qf || wp != NULL) + (void)get_errorlist(NULL, wp, -1, rettv->vval.v_list); + } + else + { + if (rettv_dict_alloc(rettv) == OK) + if (is_qf || (wp != NULL)) + { + if (what_arg->v_type == VAR_DICT) + { + dict_T *d = what_arg->vval.v_dict; + + if (d != NULL) + qf_get_properties(wp, d, rettv->vval.v_dict); + } + else + EMSG(_(e_dictreq)); + } + } +} +#endif + +/* + * "getloclist()" function + */ + static void +f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_QUICKFIX + win_T *wp; + + wp = find_win_by_nr(&argvars[0], NULL); + get_qf_loc_list(FALSE, wp, &argvars[1], rettv); +#endif +} + +/* + * "getmatches()" function + */ + static void +f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + dict_T *dict; + matchitem_T *cur = curwin->w_match_head; + int i; + + if (rettv_list_alloc(rettv) == OK) + { + while (cur != NULL) + { + dict = dict_alloc(); + if (dict == NULL) + return; + if (cur->match.regprog == NULL) + { + /* match added with matchaddpos() */ + for (i = 0; i < MAXPOSMATCH; ++i) + { + llpos_T *llpos; + char buf[6]; + list_T *l; + + llpos = &cur->pos.pos[i]; + if (llpos->lnum == 0) + break; + l = list_alloc(); + if (l == NULL) + break; + list_append_number(l, (varnumber_T)llpos->lnum); + if (llpos->col > 0) + { + list_append_number(l, (varnumber_T)llpos->col); + list_append_number(l, (varnumber_T)llpos->len); + } + sprintf(buf, "pos%d", i + 1); + dict_add_list(dict, buf, l); + } + } + else + { + dict_add_nr_str(dict, "pattern", 0L, cur->pattern); + } + dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id)); + dict_add_nr_str(dict, "priority", (long)cur->priority, NULL); + dict_add_nr_str(dict, "id", (long)cur->id, NULL); +# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE) + if (cur->conceal_char) + { + char_u buf[MB_MAXBYTES + 1]; + + buf[(*mb_char2bytes)((int)cur->conceal_char, buf)] = NUL; + dict_add_nr_str(dict, "conceal", 0L, (char_u *)&buf); + } +# endif + list_append_dict(rettv->vval.v_list, dict); + cur = cur->next; + } + } +#endif +} + +/* + * "getpid()" function + */ + static void +f_getpid(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = mch_get_pid(); +} + + static void +getpos_both( + typval_T *argvars, + typval_T *rettv, + int getcurpos) +{ + pos_T *fp; + list_T *l; + int fnum = -1; + + if (rettv_list_alloc(rettv) == OK) + { + l = rettv->vval.v_list; + if (getcurpos) + fp = &curwin->w_cursor; + else + fp = var2fpos(&argvars[0], TRUE, &fnum); + if (fnum != -1) + list_append_number(l, (varnumber_T)fnum); + else + list_append_number(l, (varnumber_T)0); + list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum + : (varnumber_T)0); + list_append_number(l, (fp != NULL) + ? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1) + : (varnumber_T)0); + list_append_number(l, +#ifdef FEAT_VIRTUALEDIT + (fp != NULL) ? (varnumber_T)fp->coladd : +#endif + (varnumber_T)0); + if (getcurpos) + { + update_curswant(); + list_append_number(l, curwin->w_curswant == MAXCOL ? + (varnumber_T)MAXCOL : (varnumber_T)curwin->w_curswant + 1); + } + } + else + rettv->vval.v_number = FALSE; +} + + +/* + * "getcurpos()" function + */ + static void +f_getcurpos(typval_T *argvars, typval_T *rettv) +{ + getpos_both(argvars, rettv, TRUE); +} + +/* + * "getpos(string)" function + */ + static void +f_getpos(typval_T *argvars, typval_T *rettv) +{ + getpos_both(argvars, rettv, FALSE); +} + +/* + * "getqflist()" function + */ + static void +f_getqflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_QUICKFIX + get_qf_loc_list(TRUE, NULL, &argvars[0], rettv); +#endif +} + +/* + * "getreg()" function + */ + static void +f_getreg(typval_T *argvars, typval_T *rettv) +{ + char_u *strregname; + int regname; + int arg2 = FALSE; + int return_list = FALSE; + int error = FALSE; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + strregname = get_tv_string_chk(&argvars[0]); + error = strregname == NULL; + if (argvars[1].v_type != VAR_UNKNOWN) + { + arg2 = (int)get_tv_number_chk(&argvars[1], &error); + if (!error && argvars[2].v_type != VAR_UNKNOWN) + return_list = (int)get_tv_number_chk(&argvars[2], &error); + } + } + else + strregname = get_vim_var_str(VV_REG); + + if (error) + return; + + regname = (strregname == NULL ? '"' : *strregname); + if (regname == 0) + regname = '"'; + + if (return_list) + { + rettv->v_type = VAR_LIST; + rettv->vval.v_list = (list_T *)get_reg_contents(regname, + (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST); + if (rettv->vval.v_list == NULL) + (void)rettv_list_alloc(rettv); + else + ++rettv->vval.v_list->lv_refcount; + } + else + { + rettv->v_type = VAR_STRING; + rettv->vval.v_string = get_reg_contents(regname, + arg2 ? GREG_EXPR_SRC : 0); + } +} + +/* + * "getregtype()" function + */ + static void +f_getregtype(typval_T *argvars, typval_T *rettv) +{ + char_u *strregname; + int regname; + char_u buf[NUMBUFLEN + 2]; + long reglen = 0; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + strregname = get_tv_string_chk(&argvars[0]); + if (strregname == NULL) /* type error; errmsg already given */ + { + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + return; + } + } + else + /* Default to v:register */ + strregname = get_vim_var_str(VV_REG); + + regname = (strregname == NULL ? '"' : *strregname); + if (regname == 0) + regname = '"'; + + buf[0] = NUL; + buf[1] = NUL; + switch (get_reg_type(regname, ®len)) + { + case MLINE: buf[0] = 'V'; break; + case MCHAR: buf[0] = 'v'; break; + case MBLOCK: + buf[0] = Ctrl_V; + sprintf((char *)buf + 1, "%ld", reglen + 1); + break; + } + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(buf); +} + +/* + * Returns information (variables, options, etc.) about a tab page + * as a dictionary. + */ + static dict_T * +get_tabpage_info(tabpage_T *tp, int tp_idx) +{ + win_T *wp; + dict_T *dict; + list_T *l; + + dict = dict_alloc(); + if (dict == NULL) + return NULL; + + dict_add_nr_str(dict, "tabnr", tp_idx, NULL); + + l = list_alloc(); + if (l != NULL) + { + for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; + wp; wp = wp->w_next) + list_append_number(l, (varnumber_T)wp->w_id); + dict_add_list(dict, "windows", l); + } + + /* Make a reference to tabpage variables */ + dict_add_dict(dict, "variables", tp->tp_vars); + + return dict; +} + +/* + * "gettabinfo()" function + */ + static void +f_gettabinfo(typval_T *argvars, typval_T *rettv) +{ + tabpage_T *tp, *tparg = NULL; + dict_T *d; + int tpnr = 0; + + if (rettv_list_alloc(rettv) != OK) + return; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + /* Information about one tab page */ + tparg = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + if (tparg == NULL) + return; + } + + /* Get information about a specific tab page or all tab pages */ + FOR_ALL_TABPAGES(tp) + { + tpnr++; + if (tparg != NULL && tp != tparg) + continue; + d = get_tabpage_info(tp, tpnr); + if (d != NULL) + list_append_dict(rettv->vval.v_list, d); + if (tparg != NULL) + return; + } +} + +/* + * "gettabvar()" function + */ + static void +f_gettabvar(typval_T *argvars, typval_T *rettv) +{ + win_T *oldcurwin; + tabpage_T *tp, *oldtabpage; + dictitem_T *v; + char_u *varname; + int done = FALSE; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + varname = get_tv_string_chk(&argvars[1]); + tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + if (tp != NULL && varname != NULL) + { + /* Set tp to be our tabpage, temporarily. Also set the window to the + * first window in the tabpage, otherwise the window is not valid. */ + if (switch_win(&oldcurwin, &oldtabpage, + tp == curtab || tp->tp_firstwin == NULL ? firstwin + : tp->tp_firstwin, tp, TRUE) == OK) + { + /* look up the variable */ + /* Let gettabvar({nr}, "") return the "t:" dictionary. */ + v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); + if (v != NULL) + { + copy_tv(&v->di_tv, rettv); + done = TRUE; + } + } + + /* restore previous notion of curwin */ + restore_win(oldcurwin, oldtabpage, TRUE); + } + + if (!done && argvars[2].v_type != VAR_UNKNOWN) + copy_tv(&argvars[2], rettv); +} + +/* + * "gettabwinvar()" function + */ + static void +f_gettabwinvar(typval_T *argvars, typval_T *rettv) +{ + getwinvar(argvars, rettv, 1); +} + +/* + * Returns information about a window as a dictionary. + */ + static dict_T * +get_win_info(win_T *wp, short tpnr, short winnr) +{ + dict_T *dict; + + dict = dict_alloc(); + if (dict == NULL) + return NULL; + + dict_add_nr_str(dict, "tabnr", tpnr, NULL); + dict_add_nr_str(dict, "winnr", winnr, NULL); + dict_add_nr_str(dict, "winid", wp->w_id, NULL); + dict_add_nr_str(dict, "height", wp->w_height, NULL); +#ifdef FEAT_MENU + dict_add_nr_str(dict, "winbar", wp->w_winbar_height, NULL); +#endif + dict_add_nr_str(dict, "width", wp->w_width, NULL); + dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL); + +#ifdef FEAT_TERMINAL + dict_add_nr_str(dict, "terminal", bt_terminal(wp->w_buffer), NULL); +#endif +#ifdef FEAT_QUICKFIX + dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL); + dict_add_nr_str(dict, "loclist", + (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL); +#endif + + /* Add a reference to window variables */ + dict_add_dict(dict, "variables", wp->w_vars); + + return dict; +} + +/* + * "getwininfo()" function + */ + static void +f_getwininfo(typval_T *argvars, typval_T *rettv) +{ + tabpage_T *tp; + win_T *wp = NULL, *wparg = NULL; + dict_T *d; + short tabnr = 0, winnr; + + if (rettv_list_alloc(rettv) != OK) + return; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + wparg = win_id2wp(argvars); + if (wparg == NULL) + return; + } + + /* Collect information about either all the windows across all the tab + * pages or one particular window. + */ + FOR_ALL_TABPAGES(tp) + { + tabnr++; + winnr = 0; + FOR_ALL_WINDOWS_IN_TAB(tp, wp) + { + winnr++; + if (wparg != NULL && wp != wparg) + continue; + d = get_win_info(wp, tabnr, winnr); + if (d != NULL) + list_append_dict(rettv->vval.v_list, d); + if (wparg != NULL) + /* found information about a specific window */ + return; + } + } +} + +/* + * "win_findbuf()" function + */ + static void +f_win_findbuf(typval_T *argvars, typval_T *rettv) +{ + if (rettv_list_alloc(rettv) != FAIL) + win_findbuf(argvars, rettv->vval.v_list); +} + +/* + * "win_getid()" function + */ + static void +f_win_getid(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = win_getid(argvars); +} + +/* + * "win_gotoid()" function + */ + static void +f_win_gotoid(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = win_gotoid(argvars); +} + +/* + * "win_id2tabwin()" function + */ + static void +f_win_id2tabwin(typval_T *argvars, typval_T *rettv) +{ + if (rettv_list_alloc(rettv) != FAIL) + win_id2tabwin(argvars, rettv->vval.v_list); +} + +/* + * "win_id2win()" function + */ + static void +f_win_id2win(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = win_id2win(argvars); +} + +/* + * "win_screenpos()" function + */ + static void +f_win_screenpos(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + wp = find_win_by_nr(&argvars[0], NULL); + list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1); + list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); +} + +/* + * "getwinpos({timeout})" function + */ + static void +f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) +{ + int x = -1; + int y = -1; + + if (rettv_list_alloc(rettv) == FAIL) + return; +#ifdef FEAT_GUI + if (gui.in_use) + (void)gui_mch_get_winpos(&x, &y); +# if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + else +# endif +#endif +#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + { + varnumber_T timeout = 100; + + if (argvars[0].v_type != VAR_UNKNOWN) + timeout = get_tv_number(&argvars[0]); + term_get_winpos(&x, &y, timeout); + } +#endif + list_append_number(rettv->vval.v_list, (varnumber_T)x); + list_append_number(rettv->vval.v_list, (varnumber_T)y); +} + + +/* + * "getwinposx()" function + */ + static void +f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = -1; +#ifdef FEAT_GUI + if (gui.in_use) + { + int x, y; + + if (gui_mch_get_winpos(&x, &y) == OK) + rettv->vval.v_number = x; + return; + } +#endif +#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + { + int x, y; + + if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) + rettv->vval.v_number = x; + } +#endif +} + +/* + * "getwinposy()" function + */ + static void +f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = -1; +#ifdef FEAT_GUI + if (gui.in_use) + { + int x, y; + + if (gui_mch_get_winpos(&x, &y) == OK) + rettv->vval.v_number = y; + return; + } +#endif +#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + { + int x, y; + + if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) + rettv->vval.v_number = y; + } +#endif +} + +/* + * "getwinvar()" function + */ + static void +f_getwinvar(typval_T *argvars, typval_T *rettv) +{ + getwinvar(argvars, rettv, 0); +} + +/* + * "glob()" function + */ + static void +f_glob(typval_T *argvars, typval_T *rettv) +{ + int options = WILD_SILENT|WILD_USE_NL; + expand_T xpc; + int error = FALSE; + + /* When the optional second argument is non-zero, don't remove matches + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ + rettv->v_type = VAR_STRING; + if (argvars[1].v_type != VAR_UNKNOWN) + { + if (get_tv_number_chk(&argvars[1], &error)) + options |= WILD_KEEP_ALL; + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (get_tv_number_chk(&argvars[2], &error)) + { + rettv_list_set(rettv, NULL); + } + if (argvars[3].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[3], &error)) + options |= WILD_ALLLINKS; + } + } + if (!error) + { + ExpandInit(&xpc); + xpc.xp_context = EXPAND_FILES; + if (p_wic) + options += WILD_ICASE; + if (rettv->v_type == VAR_STRING) + rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), + NULL, options, WILD_ALL); + else if (rettv_list_alloc(rettv) != FAIL) + { + int i; + + ExpandOne(&xpc, get_tv_string(&argvars[0]), + NULL, options, WILD_ALL_KEEP); + for (i = 0; i < xpc.xp_numfiles; i++) + list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); + + ExpandCleanup(&xpc); + } + } + else + rettv->vval.v_string = NULL; +} + +/* + * "globpath()" function + */ + static void +f_globpath(typval_T *argvars, typval_T *rettv) +{ + int flags = 0; + char_u buf1[NUMBUFLEN]; + char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); + int error = FALSE; + garray_T ga; + int i; + + /* When the optional second argument is non-zero, don't remove matches + * for 'wildignore' and don't put matches for 'suffixes' at the end. */ + rettv->v_type = VAR_STRING; + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (get_tv_number_chk(&argvars[2], &error)) + flags |= WILD_KEEP_ALL; + if (argvars[3].v_type != VAR_UNKNOWN) + { + if (get_tv_number_chk(&argvars[3], &error)) + { + rettv_list_set(rettv, NULL); + } + if (argvars[4].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[4], &error)) + flags |= WILD_ALLLINKS; + } + } + if (file != NULL && !error) + { + ga_init2(&ga, (int)sizeof(char_u *), 10); + globpath(get_tv_string(&argvars[0]), file, &ga, flags); + if (rettv->v_type == VAR_STRING) + rettv->vval.v_string = ga_concat_strings(&ga, "\n"); + else if (rettv_list_alloc(rettv) != FAIL) + for (i = 0; i < ga.ga_len; ++i) + list_append_string(rettv->vval.v_list, + ((char_u **)(ga.ga_data))[i], -1); + ga_clear_strings(&ga); + } + else + rettv->vval.v_string = NULL; +} + +/* + * "glob2regpat()" function + */ + static void +f_glob2regpat(typval_T *argvars, typval_T *rettv) +{ + char_u *pat = get_tv_string_chk(&argvars[0]); + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = (pat == NULL) + ? NULL : file_pat_to_reg_pat(pat, NULL, NULL, FALSE); +} + +/* for VIM_VERSION_ defines */ +#include "version.h" + +/* + * "has()" function + */ + static void +f_has(typval_T *argvars, typval_T *rettv) +{ + int i; + char_u *name; + int n = FALSE; + static char *(has_list[]) = + { +#ifdef AMIGA + "amiga", +# ifdef FEAT_ARP + "arp", +# endif +#endif +#ifdef __BEOS__ + "beos", +#endif +#ifdef MACOS_X + "mac", /* Mac OS X (and, once, Mac OS Classic) */ + "osx", /* Mac OS X */ +# ifdef MACOS_X_DARWIN + "macunix", /* Mac OS X, with the darwin feature */ + "osxdarwin", /* synonym for macunix */ +# endif +#endif +#ifdef __QNX__ + "qnx", +#endif +#ifdef UNIX + "unix", +#endif +#ifdef VMS + "vms", +#endif +#ifdef WIN32 + "win32", +#endif +#if defined(UNIX) && (defined(__CYGWIN32__) || defined(__CYGWIN__)) + "win32unix", +#endif +#if defined(WIN64) || defined(_WIN64) + "win64", +#endif +#ifdef EBCDIC + "ebcdic", +#endif +#ifndef CASE_INSENSITIVE_FILENAME + "fname_case", +#endif +#ifdef HAVE_ACL + "acl", +#endif +#ifdef FEAT_ARABIC + "arabic", +#endif + "autocmd", +#ifdef FEAT_AUTOSERVERNAME + "autoservername", +#endif +#ifdef FEAT_BEVAL_GUI + "balloon_eval", +# ifndef FEAT_GUI_W32 /* other GUIs always have multiline balloons */ + "balloon_multiline", +# endif +#endif +#ifdef FEAT_BEVAL_TERM + "balloon_eval_term", +#endif +#if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS) + "builtin_terms", +# ifdef ALL_BUILTIN_TCAPS + "all_builtin_terms", +# endif +#endif +#if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ + || defined(FEAT_GUI_W32) \ + || defined(FEAT_GUI_MOTIF)) + "browsefilter", +#endif +#ifdef FEAT_BYTEOFF + "byte_offset", +#endif +#ifdef FEAT_JOB_CHANNEL + "channel", +#endif +#ifdef FEAT_CINDENT + "cindent", +#endif +#ifdef FEAT_CLIENTSERVER + "clientserver", +#endif +#ifdef FEAT_CLIPBOARD + "clipboard", +#endif +#ifdef FEAT_CMDL_COMPL + "cmdline_compl", +#endif +#ifdef FEAT_CMDHIST + "cmdline_hist", +#endif +#ifdef FEAT_COMMENTS + "comments", +#endif +#ifdef FEAT_CONCEAL + "conceal", +#endif +#ifdef FEAT_CRYPT + "cryptv", + "crypt-blowfish", + "crypt-blowfish2", +#endif +#ifdef FEAT_CSCOPE + "cscope", +#endif + "cursorbind", +#ifdef CURSOR_SHAPE + "cursorshape", +#endif +#ifdef DEBUG + "debug", +#endif +#ifdef FEAT_CON_DIALOG + "dialog_con", +#endif +#ifdef FEAT_GUI_DIALOG + "dialog_gui", +#endif +#ifdef FEAT_DIFF + "diff", +#endif +#ifdef FEAT_DIGRAPHS + "digraphs", +#endif +#ifdef FEAT_DIRECTX + "directx", +#endif +#ifdef FEAT_DND + "dnd", +#endif +#ifdef FEAT_EMACS_TAGS + "emacs_tags", +#endif + "eval", /* always present, of course! */ + "ex_extra", /* graduated feature */ +#ifdef FEAT_SEARCH_EXTRA + "extra_search", +#endif +#ifdef FEAT_FKMAP + "farsi", +#endif +#ifdef FEAT_SEARCHPATH + "file_in_path", +#endif +#ifdef FEAT_FILTERPIPE + "filterpipe", +#endif +#ifdef FEAT_FIND_ID + "find_in_path", +#endif +#ifdef FEAT_FLOAT + "float", +#endif +#ifdef FEAT_FOLDING + "folding", +#endif +#ifdef FEAT_FOOTER + "footer", +#endif +#if !defined(USE_SYSTEM) && defined(UNIX) + "fork", +#endif +#ifdef FEAT_FULLSCREEN + "fullscreen", +#endif +#ifdef FEAT_GETTEXT + "gettext", +#endif + "guess_encode", +#ifdef FEAT_GUI + "gui", +#endif +#ifdef FEAT_GUI_ATHENA +# ifdef FEAT_GUI_NEXTAW + "gui_neXtaw", +# else + "gui_athena", +# endif +#endif +#ifdef FEAT_GUI_GTK + "gui_gtk", +# ifdef USE_GTK3 + "gui_gtk3", +# else + "gui_gtk2", +# endif +#endif +#ifdef FEAT_GUI_GNOME + "gui_gnome", +#endif +#ifdef FEAT_GUI_MAC + "gui_mac", +#endif +#ifdef FEAT_GUI_MACVIM + "gui_macvim", +#endif +#ifdef FEAT_GUI_MOTIF + "gui_motif", +#endif +#ifdef FEAT_GUI_PHOTON + "gui_photon", +#endif +#ifdef FEAT_GUI_W32 + "gui_win32", +#endif +#ifdef FEAT_HANGULIN + "hangul_input", +#endif +#if defined(HAVE_ICONV_H) && defined(USE_ICONV) + "iconv", +#endif +#ifdef FEAT_INS_EXPAND + "insert_expand", +#endif +#ifdef FEAT_JOB_CHANNEL + "job", +#endif +#ifdef FEAT_JUMPLIST + "jumplist", +#endif + "kaoriya", +#ifdef FEAT_KEYMAP + "keymap", +#endif + "lambda", /* always with FEAT_EVAL, since 7.4.2120 with closure */ +#ifdef FEAT_LANGMAP + "langmap", +#endif +#ifdef FEAT_LIBCALL + "libcall", +#endif +#ifdef FEAT_LINEBREAK + "linebreak", +#endif +#ifdef FEAT_LISP + "lispindent", +#endif + "listcmds", +#ifdef FEAT_LOCALMAP + "localmap", +#endif +#ifdef FEAT_LUA +# ifndef DYNAMIC_LUA + "lua", +# endif +#endif +#ifdef FEAT_MENU + "menu", +#endif +#ifdef USE_MIGEMO +# ifndef DYNAMIC_MIGEMO + "migemo", +# endif +#endif +#ifdef FEAT_SESSION + "mksession", +#endif +#ifdef FEAT_MODIFY_FNAME + "modify_fname", +#endif +#ifdef FEAT_MOUSE + "mouse", +#endif +#ifdef FEAT_MOUSESHAPE + "mouseshape", +#endif +#if defined(UNIX) || defined(VMS) +# ifdef FEAT_MOUSE_DEC + "mouse_dec", +# endif +# ifdef FEAT_MOUSE_GPM + "mouse_gpm", +# endif +# ifdef FEAT_MOUSE_JSB + "mouse_jsbterm", +# endif +# ifdef FEAT_MOUSE_NET + "mouse_netterm", +# endif +# ifdef FEAT_MOUSE_PTERM + "mouse_pterm", +# endif +# ifdef FEAT_MOUSE_SGR + "mouse_sgr", +# endif +# ifdef FEAT_SYSMOUSE + "mouse_sysmouse", +# endif +# ifdef FEAT_MOUSE_URXVT + "mouse_urxvt", +# endif +# ifdef FEAT_MOUSE_XTERM + "mouse_xterm", +# endif +#endif +#ifdef FEAT_MBYTE + "multi_byte", +#endif +#ifdef FEAT_MBYTE_IME + "multi_byte_ime", +#endif +#ifdef FEAT_MULTI_LANG + "multi_lang", +#endif +#ifdef FEAT_MZSCHEME +#ifndef DYNAMIC_MZSCHEME + "mzscheme", +#endif +#endif +#ifdef FEAT_NUM64 + "num64", +#endif +#ifdef FEAT_OLE + "ole", +#endif + "packages", +#ifdef FEAT_PATH_EXTRA + "path_extra", +#endif +#ifdef FEAT_PERL +#ifndef DYNAMIC_PERL + "perl", +#endif +#endif +#ifdef FEAT_PERSISTENT_UNDO + "persistent_undo", +#endif +#if defined(FEAT_PYTHON) + "python_compiled", +# if defined(DYNAMIC_PYTHON) + "python_dynamic", +# else + "python", + "pythonx", +# endif +#endif +#if defined(FEAT_PYTHON3) + "python3_compiled", +# if defined(DYNAMIC_PYTHON3) + "python3_dynamic", +# else + "python3", + "pythonx", +# endif +#endif +#ifdef FEAT_POSTSCRIPT + "postscript", +#endif +#ifdef FEAT_PRINTER + "printer", +#endif +#ifdef FEAT_PROFILE + "profile", +#endif +#ifdef FEAT_RELTIME + "reltime", +#endif +#ifdef FEAT_QUICKFIX + "quickfix", +#endif +#ifdef FEAT_RIGHTLEFT + "rightleft", +#endif +#if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY) + "ruby", +#endif + "scrollbind", +#ifdef FEAT_CMDL_INFO + "showcmd", + "cmdline_info", +#endif +#ifdef FEAT_SIGNS + "signs", +#endif +#ifdef FEAT_SMARTINDENT + "smartindent", +#endif +#ifdef STARTUPTIME + "startuptime", +#endif +#ifdef FEAT_STL_OPT + "statusline", +#endif +#ifdef FEAT_SUN_WORKSHOP + "sun_workshop", +#endif +#ifdef FEAT_NETBEANS_INTG + "netbeans_intg", +#endif +#ifdef FEAT_ODB_EDITOR + "odbeditor", +#endif +#ifdef FEAT_SPELL + "spell", +#endif +#ifdef FEAT_SYN_HL + "syntax", +#endif +#if defined(USE_SYSTEM) || !defined(UNIX) + "system", +#endif +#ifdef FEAT_TAG_BINS + "tag_binary", +#endif +#ifdef FEAT_TAG_OLDSTATIC + "tag_old_static", +#endif +#ifdef FEAT_TAG_ANYWHITE + "tag_any_white", +#endif +#ifdef FEAT_TCL +# ifndef DYNAMIC_TCL + "tcl", +# endif +#endif +#ifdef FEAT_TERMGUICOLORS + "termguicolors", +#endif +#if defined(FEAT_TERMINAL) && !defined(WIN3264) + "terminal", +#endif +#ifdef TERMINFO + "terminfo", +#endif +#ifdef FEAT_TERMRESPONSE + "termresponse", +#endif +#ifdef FEAT_TEXTOBJ + "textobjects", +#endif +#ifdef HAVE_TGETENT + "tgetent", +#endif +#ifdef FEAT_TIMERS + "timers", +#endif +#ifdef FEAT_TITLE + "title", +#endif +#ifdef FEAT_TOOLBAR + "toolbar", +#endif +#ifdef FEAT_TRANSPARENCY + "transparency", +#endif +#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) + "unnamedplus", +#endif +#ifdef FEAT_USR_CMDS + "user-commands", /* was accidentally included in 5.4 */ + "user_commands", +#endif +#ifdef FEAT_VIMINFO + "viminfo", +#endif + "vertsplit", +#ifdef FEAT_VIRTUALEDIT + "virtualedit", +#endif + "visual", +#ifdef FEAT_VISUALEXTRA + "visualextra", +#endif +#ifdef FEAT_VREPLACE + "vreplace", +#endif +#ifdef FEAT_VTP + "vtp", +#endif +#ifdef FEAT_WILDIGN + "wildignore", +#endif +#ifdef FEAT_WILDMENU + "wildmenu", +#endif + "windows", +#ifdef FEAT_WAK + "winaltkeys", +#endif +#ifdef FEAT_WRITEBACKUP + "writebackup", +#endif +#ifdef FEAT_XIM + "xim", +#endif +#ifdef FEAT_XFONTSET + "xfontset", +#endif +#ifdef FEAT_XPM_W32 + "xpm", + "xpm_w32", /* for backward compatibility */ +#else +# if defined(HAVE_XPM) + "xpm", +# endif +#endif +#ifdef USE_XSMP + "xsmp", +#endif +#ifdef USE_XSMP_INTERACT + "xsmp_interact", +#endif +#ifdef FEAT_XCLIPBOARD + "xterm_clipboard", +#endif +#ifdef FEAT_XTERM_SAVE + "xterm_save", +#endif +#if defined(UNIX) && defined(FEAT_X11) + "X11", +#endif + NULL + }; + + name = get_tv_string(&argvars[0]); + for (i = 0; has_list[i] != NULL; ++i) + if (STRICMP(name, has_list[i]) == 0) + { + n = TRUE; + break; + } + + if (n == FALSE) + { + if (STRNICMP(name, "patch", 5) == 0) + { + if (name[5] == '-' + && STRLEN(name) >= 11 + && vim_isdigit(name[6]) + && vim_isdigit(name[8]) + && vim_isdigit(name[10])) + { + int major = atoi((char *)name + 6); + int minor = atoi((char *)name + 8); + + /* Expect "patch-9.9.01234". */ + n = (major < VIM_VERSION_MAJOR + || (major == VIM_VERSION_MAJOR + && (minor < VIM_VERSION_MINOR + || (minor == VIM_VERSION_MINOR + && has_patch(atoi((char *)name + 10)))))); + } + else + n = has_patch(atoi((char *)name + 5)); + } + else if (STRICMP(name, "vim_starting") == 0) + n = (starting != 0); + else if (STRICMP(name, "ttyin") == 0) + n = mch_input_isatty(); + else if (STRICMP(name, "ttyout") == 0) + n = stdout_isatty; +#ifdef FEAT_MBYTE + else if (STRICMP(name, "multi_byte_encoding") == 0) + n = has_mbyte; +#endif +#if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32) + else if (STRICMP(name, "balloon_multiline") == 0) + n = multiline_balloon_available(); +#endif +#ifdef DYNAMIC_TCL + else if (STRICMP(name, "tcl") == 0) + n = tcl_enabled(FALSE); +#endif +#if defined(USE_ICONV) && defined(DYNAMIC_ICONV) + else if (STRICMP(name, "iconv") == 0) + n = iconv_enabled(FALSE); +#endif +#ifdef DYNAMIC_LUA + else if (STRICMP(name, "lua") == 0) + n = lua_enabled(FALSE); +#endif +#ifdef DYNAMIC_MZSCHEME + else if (STRICMP(name, "mzscheme") == 0) + n = mzscheme_enabled(FALSE); +#endif +#ifdef DYNAMIC_RUBY + else if (STRICMP(name, "ruby") == 0) + n = ruby_enabled(FALSE); +#endif +#ifdef DYNAMIC_PYTHON + else if (STRICMP(name, "python") == 0) + n = python_enabled(FALSE); +#endif +#ifdef DYNAMIC_PYTHON3 + else if (STRICMP(name, "python3") == 0) + n = python3_enabled(FALSE); +#endif +#if defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) + else if (STRICMP(name, "pythonx") == 0) + { +# if defined(DYNAMIC_PYTHON) && defined(DYNAMIC_PYTHON3) + if (p_pyx == 0) + n = python3_enabled(FALSE) || python_enabled(FALSE); + else if (p_pyx == 3) + n = python3_enabled(FALSE); + else if (p_pyx == 2) + n = python_enabled(FALSE); +# elif defined(DYNAMIC_PYTHON) + n = python_enabled(FALSE); +# elif defined(DYNAMIC_PYTHON3) + n = python3_enabled(FALSE); +# endif + } +#endif +#ifdef DYNAMIC_PERL + else if (STRICMP(name, "perl") == 0) + n = perl_enabled(FALSE); +#endif +#ifdef FEAT_GUI + else if (STRICMP(name, "gui_running") == 0) + n = (gui.in_use || gui.starting); +# ifdef FEAT_BROWSE + else if (STRICMP(name, "browse") == 0) + n = gui.in_use; /* gui_mch_browse() works when GUI is running */ +# endif +#endif +#ifdef FEAT_SYN_HL + else if (STRICMP(name, "syntax_items") == 0) + n = syntax_present(curwin); +#endif +#ifdef FEAT_VTP + else if (STRICMP(name, "vcon") == 0) + n = has_vtp_working(); +#endif +#ifdef FEAT_NETBEANS_INTG + else if (STRICMP(name, "netbeans_enabled") == 0) + n = netbeans_active(); +#endif +#if defined(FEAT_TERMINAL) && defined(WIN3264) + else if (STRICMP(name, "terminal") == 0) + n = terminal_enabled(); +#endif +#ifdef USE_MIGEMO + else if (STRICMP(name, "migemo") == 0) + n = migemo_enabled() ? TRUE : FALSE; +#endif + } + + rettv->vval.v_number = n; +} + +/* + * "has_key()" function + */ + static void +f_has_key(typval_T *argvars, typval_T *rettv) +{ + if (argvars[0].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + if (argvars[0].vval.v_dict == NULL) + return; + + rettv->vval.v_number = dict_find(argvars[0].vval.v_dict, + get_tv_string(&argvars[1]), -1) != NULL; +} + +/* + * "haslocaldir()" function + */ + static void +f_haslocaldir(typval_T *argvars, typval_T *rettv) +{ + win_T *wp = NULL; + + wp = find_tabwin(&argvars[0], &argvars[1]); + rettv->vval.v_number = (wp != NULL && wp->w_localdir != NULL); +} + +/* + * "hasmapto()" function + */ + static void +f_hasmapto(typval_T *argvars, typval_T *rettv) +{ + char_u *name; + char_u *mode; + char_u buf[NUMBUFLEN]; + int abbr = FALSE; + + name = get_tv_string(&argvars[0]); + if (argvars[1].v_type == VAR_UNKNOWN) + mode = (char_u *)"nvo"; + else + { + mode = get_tv_string_buf(&argvars[1], buf); + if (argvars[2].v_type != VAR_UNKNOWN) + abbr = (int)get_tv_number(&argvars[2]); + } + + if (map_to_exists(name, mode, abbr)) + rettv->vval.v_number = TRUE; + else + rettv->vval.v_number = FALSE; +} + +/* + * "histadd()" function + */ + static void +f_histadd(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_CMDHIST + int histype; + char_u *str; + char_u buf[NUMBUFLEN]; +#endif + + rettv->vval.v_number = FALSE; + if (check_restricted() || check_secure()) + return; +#ifdef FEAT_CMDHIST + str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + histype = str != NULL ? get_histtype(str) : -1; + if (histype >= 0) + { + str = get_tv_string_buf(&argvars[1], buf); + if (*str != NUL) + { + init_history(); + add_to_history(histype, str, FALSE, NUL); + rettv->vval.v_number = TRUE; + return; + } + } +#endif +} + +/* + * "histdel()" function + */ + static void +f_histdel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_CMDHIST + int n; + char_u buf[NUMBUFLEN]; + char_u *str; + + str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + if (str == NULL) + n = 0; + else if (argvars[1].v_type == VAR_UNKNOWN) + /* only one argument: clear entire history */ + n = clr_history(get_histtype(str)); + else if (argvars[1].v_type == VAR_NUMBER) + /* index given: remove that entry */ + n = del_history_idx(get_histtype(str), + (int)get_tv_number(&argvars[1])); + else + /* string given: remove all matching entries */ + n = del_history_entry(get_histtype(str), + get_tv_string_buf(&argvars[1], buf)); + rettv->vval.v_number = n; +#endif +} + +/* + * "histget()" function + */ + static void +f_histget(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_CMDHIST + int type; + int idx; + char_u *str; + + str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + if (str == NULL) + rettv->vval.v_string = NULL; + else + { + type = get_histtype(str); + if (argvars[1].v_type == VAR_UNKNOWN) + idx = get_history_idx(type); + else + idx = (int)get_tv_number_chk(&argvars[1], NULL); + /* -1 on type error */ + rettv->vval.v_string = vim_strsave(get_history_entry(type, idx)); + } +#else + rettv->vval.v_string = NULL; +#endif + rettv->v_type = VAR_STRING; +} + +/* + * "histnr()" function + */ + static void +f_histnr(typval_T *argvars UNUSED, typval_T *rettv) +{ + int i; + +#ifdef FEAT_CMDHIST + char_u *history = get_tv_string_chk(&argvars[0]); + + i = history == NULL ? HIST_CMD - 1 : get_histtype(history); + if (i >= HIST_CMD && i < HIST_COUNT) + i = get_history_idx(i); + else +#endif + i = -1; + rettv->vval.v_number = i; +} + +/* + * "highlightID(name)" function + */ + static void +f_hlID(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = syn_name2id(get_tv_string(&argvars[0])); +} + +/* + * "highlight_exists()" function + */ + static void +f_hlexists(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = highlight_exists(get_tv_string(&argvars[0])); +} + +/* + * "hostname()" function + */ + static void +f_hostname(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u hostname[256]; + + mch_get_host_name(hostname, 256); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(hostname); +} + +/* + * iconv() function + */ + static void +f_iconv(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_MBYTE + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *from, *to, *str; + vimconv_T vimconv; +#endif + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + +#ifdef FEAT_MBYTE + str = get_tv_string(&argvars[0]); + from = enc_canonize(enc_skip(get_tv_string_buf(&argvars[1], buf1))); + to = enc_canonize(enc_skip(get_tv_string_buf(&argvars[2], buf2))); + vimconv.vc_type = CONV_NONE; + convert_setup(&vimconv, from, to); + + /* If the encodings are equal, no conversion needed. */ + if (vimconv.vc_type == CONV_NONE) + rettv->vval.v_string = vim_strsave(str); + else + rettv->vval.v_string = string_convert(&vimconv, str, NULL); + + convert_setup(&vimconv, NULL, NULL); + vim_free(from); + vim_free(to); +#endif +} + +/* + * "indent()" function + */ + static void +f_indent(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + + lnum = get_tv_lnum(argvars); + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) + rettv->vval.v_number = get_indent_lnum(lnum); + else + rettv->vval.v_number = -1; +} + +/* + * "index()" function + */ + static void +f_index(typval_T *argvars, typval_T *rettv) +{ + list_T *l; + listitem_T *item; + long idx = 0; + int ic = FALSE; + + rettv->vval.v_number = -1; + if (argvars[0].v_type != VAR_LIST) + { + EMSG(_(e_listreq)); + return; + } + l = argvars[0].vval.v_list; + if (l != NULL) + { + item = l->lv_first; + if (argvars[2].v_type != VAR_UNKNOWN) + { + int error = FALSE; + + /* Start at specified item. Use the cached index that list_find() + * sets, so that a negative number also works. */ + item = list_find(l, (long)get_tv_number_chk(&argvars[2], &error)); + idx = l->lv_idx; + if (argvars[3].v_type != VAR_UNKNOWN) + ic = (int)get_tv_number_chk(&argvars[3], &error); + if (error) + item = NULL; + } + + for ( ; item != NULL; item = item->li_next, ++idx) + if (tv_equal(&item->li_tv, &argvars[1], ic, FALSE)) + { + rettv->vval.v_number = idx; + break; + } + } +} + +static int inputsecret_flag = 0; + +/* + * "input()" function + * Also handles inputsecret() when inputsecret is set. + */ + static void +f_input(typval_T *argvars, typval_T *rettv) +{ + get_user_input(argvars, rettv, FALSE, inputsecret_flag); +} + +/* + * "inputdialog()" function + */ + static void +f_inputdialog(typval_T *argvars, typval_T *rettv) +{ +#if defined(FEAT_GUI_TEXTDIALOG) + /* Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' */ + if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) + { + char_u *message; + char_u buf[NUMBUFLEN]; + char_u *defstr = (char_u *)""; + + message = get_tv_string_chk(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN + && (defstr = get_tv_string_buf_chk(&argvars[1], buf)) != NULL) + vim_strncpy(IObuff, defstr, IOSIZE - 1); + else + IObuff[0] = NUL; + if (message != NULL && defstr != NULL + && do_dialog(VIM_QUESTION, NULL, message, + (char_u *)_("&OK\n&Cancel"), 1, IObuff, FALSE) == 1) + rettv->vval.v_string = vim_strsave(IObuff); + else + { + if (message != NULL && defstr != NULL + && argvars[1].v_type != VAR_UNKNOWN + && argvars[2].v_type != VAR_UNKNOWN) + rettv->vval.v_string = vim_strsave( + get_tv_string_buf(&argvars[2], buf)); + else + rettv->vval.v_string = NULL; + } + rettv->v_type = VAR_STRING; + } + else +#endif + get_user_input(argvars, rettv, TRUE, inputsecret_flag); +} + +/* + * "inputlist()" function + */ + static void +f_inputlist(typval_T *argvars, typval_T *rettv) +{ + listitem_T *li; + int selected; + int mouse_used; + +#ifdef NO_CONSOLE_INPUT + /* While starting up, there is no place to enter text. When running tests + * with --not-a-term we assume feedkeys() will be used. */ + if (no_console_input() && !is_not_a_term()) + return; +#endif + if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL) + { + EMSG2(_(e_listarg), "inputlist()"); + return; + } + + msg_start(); + msg_row = Rows - 1; /* for when 'cmdheight' > 1 */ + lines_left = Rows; /* avoid more prompt */ + msg_scroll = TRUE; + msg_clr_eos(); + + for (li = argvars[0].vval.v_list->lv_first; li != NULL; li = li->li_next) + { + msg_puts(get_tv_string(&li->li_tv)); + msg_putchar('\n'); + } + + /* Ask for choice. */ + selected = prompt_for_number(&mouse_used); + if (mouse_used) + selected -= lines_left; + + rettv->vval.v_number = selected; +} + + +static garray_T ga_userinput = {0, 0, sizeof(tasave_T), 4, NULL}; + +/* + * "inputrestore()" function + */ + static void +f_inputrestore(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (ga_userinput.ga_len > 0) + { + --ga_userinput.ga_len; + restore_typeahead((tasave_T *)(ga_userinput.ga_data) + + ga_userinput.ga_len); + /* default return is zero == OK */ + } + else if (p_verbose > 1) + { + verb_msg((char_u *)_("called inputrestore() more often than inputsave()")); + rettv->vval.v_number = 1; /* Failed */ + } +} + +/* + * "inputsave()" function + */ + static void +f_inputsave(typval_T *argvars UNUSED, typval_T *rettv) +{ + /* Add an entry to the stack of typeahead storage. */ + if (ga_grow(&ga_userinput, 1) == OK) + { + save_typeahead((tasave_T *)(ga_userinput.ga_data) + + ga_userinput.ga_len); + ++ga_userinput.ga_len; + /* default return is zero == OK */ + } + else + rettv->vval.v_number = 1; /* Failed */ +} + +/* + * "inputsecret()" function + */ + static void +f_inputsecret(typval_T *argvars, typval_T *rettv) +{ + ++cmdline_star; + ++inputsecret_flag; + f_input(argvars, rettv); + --cmdline_star; + --inputsecret_flag; +} + +/* + * "insert()" function + */ + static void +f_insert(typval_T *argvars, typval_T *rettv) +{ + long before = 0; + listitem_T *item; + list_T *l; + int error = FALSE; + + if (argvars[0].v_type != VAR_LIST) + EMSG2(_(e_listarg), "insert()"); + else if ((l = argvars[0].vval.v_list) != NULL + && !tv_check_lock(l->lv_lock, (char_u *)N_("insert() argument"), TRUE)) + { + if (argvars[2].v_type != VAR_UNKNOWN) + before = (long)get_tv_number_chk(&argvars[2], &error); + if (error) + return; /* type error; errmsg already given */ + + if (before == l->lv_len) + item = NULL; + else + { + item = list_find(l, before); + if (item == NULL) + { + EMSGN(_(e_listidx), before); + l = NULL; + } + } + if (l != NULL) + { + list_insert_tv(l, &argvars[1], item); + copy_tv(&argvars[0], rettv); + } + } +} + +/* + * "invert(expr)" function + */ + static void +f_invert(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = ~get_tv_number_chk(&argvars[0], NULL); +} + +/* + * "isdirectory()" function + */ + static void +f_isdirectory(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = mch_isdir(get_tv_string(&argvars[0])); +} + +/* + * Return TRUE if typeval "tv" is locked: Either that value is locked itself + * or it refers to a List or Dictionary that is locked. + */ + static int +tv_islocked(typval_T *tv) +{ + return (tv->v_lock & VAR_LOCKED) + || (tv->v_type == VAR_LIST + && tv->vval.v_list != NULL + && (tv->vval.v_list->lv_lock & VAR_LOCKED)) + || (tv->v_type == VAR_DICT + && tv->vval.v_dict != NULL + && (tv->vval.v_dict->dv_lock & VAR_LOCKED)); +} + +/* + * "islocked()" function + */ + static void +f_islocked(typval_T *argvars, typval_T *rettv) +{ + lval_T lv; + char_u *end; + dictitem_T *di; + + rettv->vval.v_number = -1; + end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, + GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START); + if (end != NULL && lv.ll_name != NULL) + { + if (*end != NUL) + EMSG(_(e_trailing)); + else + { + if (lv.ll_tv == NULL) + { + di = find_var(lv.ll_name, NULL, TRUE); + if (di != NULL) + { + /* Consider a variable locked when: + * 1. the variable itself is locked + * 2. the value of the variable is locked. + * 3. the List or Dict value is locked. + */ + rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) + || tv_islocked(&di->di_tv)); + } + } + else if (lv.ll_range) + EMSG(_("E786: Range not allowed")); + else if (lv.ll_newkey != NULL) + EMSG2(_(e_dictkey), lv.ll_newkey); + else if (lv.ll_list != NULL) + /* List item. */ + rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv); + else + /* Dictionary item. */ + rettv->vval.v_number = tv_islocked(&lv.ll_di->di_tv); + } + } + + clear_lval(&lv); +} + +#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) +/* + * "isnan()" function + */ + static void +f_isnan(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = argvars[0].v_type == VAR_FLOAT + && isnan(argvars[0].vval.v_float); +} +#endif + +/* + * "items(dict)" function + */ + static void +f_items(typval_T *argvars, typval_T *rettv) +{ + dict_list(argvars, rettv, 2); +} + +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) +/* + * Get the job from the argument. + * Returns NULL if the job is invalid. + */ + static job_T * +get_job_arg(typval_T *tv) +{ + job_T *job; + + if (tv->v_type != VAR_JOB) + { + EMSG2(_(e_invarg2), get_tv_string(tv)); + return NULL; + } + job = tv->vval.v_job; + + if (job == NULL) + EMSG(_("E916: not a valid job")); + return job; +} + +/* + * "job_getchannel()" function + */ + static void +f_job_getchannel(typval_T *argvars, typval_T *rettv) +{ + job_T *job = get_job_arg(&argvars[0]); + + if (job != NULL) + { + rettv->v_type = VAR_CHANNEL; + rettv->vval.v_channel = job->jv_channel; + if (job->jv_channel != NULL) + ++job->jv_channel->ch_refcount; + } +} + +/* + * "job_info()" function + */ + static void +f_job_info(typval_T *argvars, typval_T *rettv) +{ + if (argvars[0].v_type != VAR_UNKNOWN) + { + job_T *job = get_job_arg(&argvars[0]); + + if (job != NULL && rettv_dict_alloc(rettv) != FAIL) + job_info(job, rettv->vval.v_dict); + } + else if (rettv_list_alloc(rettv) == OK) + job_info_all(rettv->vval.v_list); +} + +/* + * "job_setoptions()" function + */ + static void +f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED) +{ + job_T *job = get_job_arg(&argvars[0]); + jobopt_T opt; + + if (job == NULL) + return; + clear_job_options(&opt); + if (get_job_options(&argvars[1], &opt, JO_STOPONEXIT + JO_EXIT_CB, 0) == OK) + job_set_options(job, &opt); + free_job_options(&opt); +} + +/* + * "job_start()" function + */ + static void +f_job_start(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_JOB; + if (check_restricted() || check_secure()) + return; + rettv->vval.v_job = job_start(argvars, NULL, NULL, FALSE); +} + +/* + * "job_status()" function + */ + static void +f_job_status(typval_T *argvars, typval_T *rettv) +{ + job_T *job = get_job_arg(&argvars[0]); + + if (job != NULL) + { + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave((char_u *)job_status(job)); + } +} + +/* + * "job_stop()" function + */ + static void +f_job_stop(typval_T *argvars, typval_T *rettv) +{ + job_T *job = get_job_arg(&argvars[0]); + + if (job != NULL) + rettv->vval.v_number = job_stop(job, argvars, NULL); +} +#endif + +/* + * "join()" function + */ + static void +f_join(typval_T *argvars, typval_T *rettv) +{ + garray_T ga; + char_u *sep; + + if (argvars[0].v_type != VAR_LIST) + { + EMSG(_(e_listreq)); + return; + } + if (argvars[0].vval.v_list == NULL) + return; + if (argvars[1].v_type == VAR_UNKNOWN) + sep = (char_u *)" "; + else + sep = get_tv_string_chk(&argvars[1]); + + rettv->v_type = VAR_STRING; + + if (sep != NULL) + { + ga_init2(&ga, (int)sizeof(char), 80); + list_join(&ga, argvars[0].vval.v_list, sep, TRUE, FALSE, 0); + ga_append(&ga, NUL); + rettv->vval.v_string = (char_u *)ga.ga_data; + } + else + rettv->vval.v_string = NULL; +} + +/* + * "js_decode()" function + */ + static void +f_js_decode(typval_T *argvars, typval_T *rettv) +{ + js_read_T reader; + + reader.js_buf = get_tv_string(&argvars[0]); + reader.js_fill = NULL; + reader.js_used = 0; + if (json_decode_all(&reader, rettv, JSON_JS) != OK) + EMSG(_(e_invarg)); +} + +/* + * "js_encode()" function + */ + static void +f_js_encode(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = json_encode(&argvars[0], JSON_JS); +} + +/* + * "json_decode()" function + */ + static void +f_json_decode(typval_T *argvars, typval_T *rettv) +{ + js_read_T reader; + + reader.js_buf = get_tv_string(&argvars[0]); + reader.js_fill = NULL; + reader.js_used = 0; + json_decode_all(&reader, rettv, 0); +} + +/* + * "json_encode()" function + */ + static void +f_json_encode(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = json_encode(&argvars[0], 0); +} + +/* + * "keys()" function + */ + static void +f_keys(typval_T *argvars, typval_T *rettv) +{ + dict_list(argvars, rettv, 0); +} + +/* + * "last_buffer_nr()" function. + */ + static void +f_last_buffer_nr(typval_T *argvars UNUSED, typval_T *rettv) +{ + int n = 0; + buf_T *buf; + + FOR_ALL_BUFFERS(buf) + if (n < buf->b_fnum) + n = buf->b_fnum; + + rettv->vval.v_number = n; +} + +/* + * "len()" function + */ + static void +f_len(typval_T *argvars, typval_T *rettv) +{ + switch (argvars[0].v_type) + { + case VAR_STRING: + case VAR_NUMBER: + rettv->vval.v_number = (varnumber_T)STRLEN( + get_tv_string(&argvars[0])); + break; + case VAR_LIST: + rettv->vval.v_number = list_len(argvars[0].vval.v_list); + break; + case VAR_DICT: + rettv->vval.v_number = dict_len(argvars[0].vval.v_dict); + break; + case VAR_UNKNOWN: + case VAR_SPECIAL: + case VAR_FLOAT: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_JOB: + case VAR_CHANNEL: + EMSG(_("E701: Invalid type for len()")); + break; + } +} + + static void +libcall_common(typval_T *argvars UNUSED, typval_T *rettv, int type) +{ +#ifdef FEAT_LIBCALL + char_u *string_in; + char_u **string_result; + int nr_result; +#endif + + rettv->v_type = type; + if (type != VAR_NUMBER) + rettv->vval.v_string = NULL; + + if (check_restricted() || check_secure()) + return; + +#ifdef FEAT_LIBCALL + /* The first two args must be strings, otherwise it's meaningless */ + if (argvars[0].v_type == VAR_STRING && argvars[1].v_type == VAR_STRING) + { + string_in = NULL; + if (argvars[2].v_type == VAR_STRING) + string_in = argvars[2].vval.v_string; + if (type == VAR_NUMBER) + string_result = NULL; + else + string_result = &rettv->vval.v_string; + if (mch_libcall(argvars[0].vval.v_string, + argvars[1].vval.v_string, + string_in, + argvars[2].vval.v_number, + string_result, + &nr_result) == OK + && type == VAR_NUMBER) + rettv->vval.v_number = nr_result; + } +#endif +} + +/* + * "libcall()" function + */ + static void +f_libcall(typval_T *argvars, typval_T *rettv) +{ + libcall_common(argvars, rettv, VAR_STRING); +} + +/* + * "libcallnr()" function + */ + static void +f_libcallnr(typval_T *argvars, typval_T *rettv) +{ + libcall_common(argvars, rettv, VAR_NUMBER); +} + +/* + * "line(string)" function + */ + static void +f_line(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum = 0; + pos_T *fp; + int fnum; + + fp = var2fpos(&argvars[0], TRUE, &fnum); + if (fp != NULL) + lnum = fp->lnum; + rettv->vval.v_number = lnum; +} + +/* + * "line2byte(lnum)" function + */ + static void +f_line2byte(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifndef FEAT_BYTEOFF + rettv->vval.v_number = -1; +#else + linenr_T lnum; + + lnum = get_tv_lnum(argvars); + if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = ml_find_line_or_offset(curbuf, lnum, NULL); + if (rettv->vval.v_number >= 0) + ++rettv->vval.v_number; +#endif +} + +/* + * "lispindent(lnum)" function + */ + static void +f_lispindent(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_LISP + pos_T pos; + linenr_T lnum; + + pos = curwin->w_cursor; + lnum = get_tv_lnum(argvars); + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) + { + curwin->w_cursor.lnum = lnum; + rettv->vval.v_number = get_lisp_indent(); + curwin->w_cursor = pos; + } + else +#endif + rettv->vval.v_number = -1; +} + +/* + * "localtime()" function + */ + static void +f_localtime(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = (varnumber_T)time(NULL); +} + +static void get_maparg(typval_T *argvars, typval_T *rettv, int exact); + + static void +get_maparg(typval_T *argvars, typval_T *rettv, int exact) +{ + char_u *keys; + char_u *which; + char_u buf[NUMBUFLEN]; + char_u *keys_buf = NULL; + char_u *rhs; + int mode; + int abbr = FALSE; + int get_dict = FALSE; + mapblock_T *mp; + int buffer_local; + + /* return empty string for failure */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + keys = get_tv_string(&argvars[0]); + if (*keys == NUL) + return; + + if (argvars[1].v_type != VAR_UNKNOWN) + { + which = get_tv_string_buf_chk(&argvars[1], buf); + if (argvars[2].v_type != VAR_UNKNOWN) + { + abbr = (int)get_tv_number(&argvars[2]); + if (argvars[3].v_type != VAR_UNKNOWN) + get_dict = (int)get_tv_number(&argvars[3]); + } + } + else + which = (char_u *)""; + if (which == NULL) + return; + + mode = get_map_mode(&which, 0); + + keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE); + rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local); + vim_free(keys_buf); + + if (!get_dict) + { + /* Return a string. */ + if (rhs != NULL) + { + if (*rhs == NUL) + rettv->vval.v_string = vim_strsave((char_u *)"<Nop>"); + else + rettv->vval.v_string = str2special_save(rhs, FALSE); + } + + } + else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL) + { + /* Return a dictionary. */ + char_u *lhs = str2special_save(mp->m_keys, TRUE); + char_u *mapmode = map_mode_to_chars(mp->m_mode); + dict_T *dict = rettv->vval.v_dict; + + dict_add_nr_str(dict, "lhs", 0L, lhs); + dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str); + dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL); + dict_add_nr_str(dict, "expr", mp->m_expr ? 1L : 0L, NULL); + dict_add_nr_str(dict, "silent", mp->m_silent ? 1L : 0L, NULL); + dict_add_nr_str(dict, "sid", (long)mp->m_script_ID, NULL); + dict_add_nr_str(dict, "buffer", (long)buffer_local, NULL); + dict_add_nr_str(dict, "nowait", mp->m_nowait ? 1L : 0L, NULL); + dict_add_nr_str(dict, "mode", 0L, mapmode); + + vim_free(lhs); + vim_free(mapmode); + } +} + +#ifdef FEAT_FLOAT +/* + * "log()" function + */ + static void +f_log(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = log(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "log10()" function + */ + static void +f_log10(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = log10(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +#ifdef FEAT_LUA +/* + * "luaeval()" function + */ + static void +f_luaeval(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + str = get_tv_string_buf(&argvars[0], buf); + do_luaeval(str, argvars + 1, rettv); +} +#endif + +/* + * "map()" function + */ + static void +f_map(typval_T *argvars, typval_T *rettv) +{ + filter_map(argvars, rettv, TRUE); +} + +/* + * "maparg()" function + */ + static void +f_maparg(typval_T *argvars, typval_T *rettv) +{ + get_maparg(argvars, rettv, TRUE); +} + +/* + * "mapcheck()" function + */ + static void +f_mapcheck(typval_T *argvars, typval_T *rettv) +{ + get_maparg(argvars, rettv, FALSE); +} + +typedef enum +{ + MATCH_END, /* matchend() */ + MATCH_MATCH, /* match() */ + MATCH_STR, /* matchstr() */ + MATCH_LIST, /* matchlist() */ + MATCH_POS /* matchstrpos() */ +} matchtype_T; + + static void +find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) +{ + char_u *str = NULL; + long len = 0; + char_u *expr = NULL; + char_u *pat; + regmatch_T regmatch; + char_u patbuf[NUMBUFLEN]; + char_u strbuf[NUMBUFLEN]; + char_u *save_cpo; + long start = 0; + long nth = 1; + colnr_T startcol = 0; + int match = 0; + list_T *l = NULL; + listitem_T *li = NULL; + long idx = 0; + char_u *tofree = NULL; + + /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + save_cpo = p_cpo; + p_cpo = (char_u *)""; + + rettv->vval.v_number = -1; + if (type == MATCH_LIST || type == MATCH_POS) + { + /* type MATCH_LIST: return empty list when there are no matches. + * type MATCH_POS: return ["", -1, -1, -1] */ + if (rettv_list_alloc(rettv) == FAIL) + goto theend; + if (type == MATCH_POS + && (list_append_string(rettv->vval.v_list, + (char_u *)"", 0) == FAIL + || list_append_number(rettv->vval.v_list, + (varnumber_T)-1) == FAIL + || list_append_number(rettv->vval.v_list, + (varnumber_T)-1) == FAIL + || list_append_number(rettv->vval.v_list, + (varnumber_T)-1) == FAIL)) + { + list_free(rettv->vval.v_list); + rettv->vval.v_list = NULL; + goto theend; + } + } + else if (type == MATCH_STR) + { + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + } + + if (argvars[0].v_type == VAR_LIST) + { + if ((l = argvars[0].vval.v_list) == NULL) + goto theend; + li = l->lv_first; + } + else + { + expr = str = get_tv_string(&argvars[0]); + len = (long)STRLEN(str); + } + + pat = get_tv_string_buf_chk(&argvars[1], patbuf); + if (pat == NULL) + goto theend; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + int error = FALSE; + + start = (long)get_tv_number_chk(&argvars[2], &error); + if (error) + goto theend; + if (l != NULL) + { + li = list_find(l, start); + if (li == NULL) + goto theend; + idx = l->lv_idx; /* use the cached index */ + } + else + { + if (start < 0) + start = 0; + if (start > len) + goto theend; + /* When "count" argument is there ignore matches before "start", + * otherwise skip part of the string. Differs when pattern is "^" + * or "\<". */ + if (argvars[3].v_type != VAR_UNKNOWN) + startcol = start; + else + { + str += start; + len -= start; + } + } + + if (argvars[3].v_type != VAR_UNKNOWN) + nth = (long)get_tv_number_chk(&argvars[3], &error); + if (error) + goto theend; + } + + regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + if (regmatch.regprog != NULL) + { + regmatch.rm_ic = p_ic; + + for (;;) + { + if (l != NULL) + { + if (li == NULL) + { + match = FALSE; + break; + } + vim_free(tofree); + expr = str = echo_string(&li->li_tv, &tofree, strbuf, 0); + if (str == NULL) + break; + } + + match = vim_regexec_nl(®match, str, (colnr_T)startcol); + + if (match && --nth <= 0) + break; + if (l == NULL && !match) + break; + + /* Advance to just after the match. */ + if (l != NULL) + { + li = li->li_next; + ++idx; + } + else + { +#ifdef FEAT_MBYTE + startcol = (colnr_T)(regmatch.startp[0] + + (*mb_ptr2len)(regmatch.startp[0]) - str); +#else + startcol = (colnr_T)(regmatch.startp[0] + 1 - str); +#endif + if (startcol > (colnr_T)len + || str + startcol <= regmatch.startp[0]) + { + match = FALSE; + break; + } + } + } + + if (match) + { + if (type == MATCH_POS) + { + listitem_T *li1 = rettv->vval.v_list->lv_first; + listitem_T *li2 = li1->li_next; + listitem_T *li3 = li2->li_next; + listitem_T *li4 = li3->li_next; + + vim_free(li1->li_tv.vval.v_string); + li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0], + (int)(regmatch.endp[0] - regmatch.startp[0])); + li3->li_tv.vval.v_number = + (varnumber_T)(regmatch.startp[0] - expr); + li4->li_tv.vval.v_number = + (varnumber_T)(regmatch.endp[0] - expr); + if (l != NULL) + li2->li_tv.vval.v_number = (varnumber_T)idx; + } + else if (type == MATCH_LIST) + { + int i; + + /* return list with matched string and submatches */ + for (i = 0; i < NSUBEXP; ++i) + { + if (regmatch.endp[i] == NULL) + { + if (list_append_string(rettv->vval.v_list, + (char_u *)"", 0) == FAIL) + break; + } + else if (list_append_string(rettv->vval.v_list, + regmatch.startp[i], + (int)(regmatch.endp[i] - regmatch.startp[i])) + == FAIL) + break; + } + } + else if (type == MATCH_STR) + { + /* return matched string */ + if (l != NULL) + copy_tv(&li->li_tv, rettv); + else + rettv->vval.v_string = vim_strnsave(regmatch.startp[0], + (int)(regmatch.endp[0] - regmatch.startp[0])); + } + else if (l != NULL) + rettv->vval.v_number = idx; + else + { + if (type != MATCH_END) + rettv->vval.v_number = + (varnumber_T)(regmatch.startp[0] - str); + else + rettv->vval.v_number = + (varnumber_T)(regmatch.endp[0] - str); + rettv->vval.v_number += (varnumber_T)(str - expr); + } + } + vim_regfree(regmatch.regprog); + } + +theend: + if (type == MATCH_POS && l == NULL && rettv->vval.v_list != NULL) + /* matchstrpos() without a list: drop the second item. */ + listitem_remove(rettv->vval.v_list, + rettv->vval.v_list->lv_first->li_next); + vim_free(tofree); + p_cpo = save_cpo; +} + +/* + * "match()" function + */ + static void +f_match(typval_T *argvars, typval_T *rettv) +{ + find_some_match(argvars, rettv, MATCH_MATCH); +} + +/* + * "matchadd()" function + */ + static void +f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + char_u buf[NUMBUFLEN]; + char_u *grp = get_tv_string_buf_chk(&argvars[0], buf); /* group */ + char_u *pat = get_tv_string_buf_chk(&argvars[1], buf); /* pattern */ + int prio = 10; /* default priority */ + int id = -1; + int error = FALSE; + char_u *conceal_char = NULL; + + rettv->vval.v_number = -1; + + if (grp == NULL || pat == NULL) + return; + if (argvars[2].v_type != VAR_UNKNOWN) + { + prio = (int)get_tv_number_chk(&argvars[2], &error); + if (argvars[3].v_type != VAR_UNKNOWN) + { + id = (int)get_tv_number_chk(&argvars[3], &error); + if (argvars[4].v_type != VAR_UNKNOWN) + { + if (argvars[4].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + if (dict_find(argvars[4].vval.v_dict, + (char_u *)"conceal", -1) != NULL) + conceal_char = get_dict_string(argvars[4].vval.v_dict, + (char_u *)"conceal", FALSE); + } + } + } + if (error == TRUE) + return; + if (id >= 1 && id <= 3) + { + EMSGN(_("E798: ID is reserved for \":match\": %ld"), id); + return; + } + + rettv->vval.v_number = match_add(curwin, grp, pat, prio, id, NULL, + conceal_char); +#endif +} + +/* + * "matchaddpos()" function + */ + static void +f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + char_u buf[NUMBUFLEN]; + char_u *group; + int prio = 10; + int id = -1; + int error = FALSE; + list_T *l; + char_u *conceal_char = NULL; + + rettv->vval.v_number = -1; + + group = get_tv_string_buf_chk(&argvars[0], buf); + if (group == NULL) + return; + + if (argvars[1].v_type != VAR_LIST) + { + EMSG2(_(e_listarg), "matchaddpos()"); + return; + } + l = argvars[1].vval.v_list; + if (l == NULL) + return; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + prio = (int)get_tv_number_chk(&argvars[2], &error); + if (argvars[3].v_type != VAR_UNKNOWN) + { + id = (int)get_tv_number_chk(&argvars[3], &error); + if (argvars[4].v_type != VAR_UNKNOWN) + { + if (argvars[4].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + if (dict_find(argvars[4].vval.v_dict, + (char_u *)"conceal", -1) != NULL) + conceal_char = get_dict_string(argvars[4].vval.v_dict, + (char_u *)"conceal", FALSE); + } + } + } + if (error == TRUE) + return; + + /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */ + if (id == 1 || id == 2) + { + EMSGN(_("E798: ID is reserved for \":match\": %ld"), id); + return; + } + + rettv->vval.v_number = match_add(curwin, group, NULL, prio, id, l, + conceal_char); +#endif +} + +/* + * "matcharg()" function + */ + static void +f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (rettv_list_alloc(rettv) == OK) + { +#ifdef FEAT_SEARCH_EXTRA + int id = (int)get_tv_number(&argvars[0]); + matchitem_T *m; + + if (id >= 1 && id <= 3) + { + if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) + { + list_append_string(rettv->vval.v_list, + syn_id2name(m->hlg_id), -1); + list_append_string(rettv->vval.v_list, m->pattern, -1); + } + else + { + list_append_string(rettv->vval.v_list, NULL, -1); + list_append_string(rettv->vval.v_list, NULL, -1); + } + } +#endif + } +} + +/* + * "matchdelete()" function + */ + static void +f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + rettv->vval.v_number = match_delete(curwin, + (int)get_tv_number(&argvars[0]), TRUE); +#endif +} + +/* + * "matchend()" function + */ + static void +f_matchend(typval_T *argvars, typval_T *rettv) +{ + find_some_match(argvars, rettv, MATCH_END); +} + +/* + * "matchlist()" function + */ + static void +f_matchlist(typval_T *argvars, typval_T *rettv) +{ + find_some_match(argvars, rettv, MATCH_LIST); +} + +/* + * "matchstr()" function + */ + static void +f_matchstr(typval_T *argvars, typval_T *rettv) +{ + find_some_match(argvars, rettv, MATCH_STR); +} + +/* + * "matchstrpos()" function + */ + static void +f_matchstrpos(typval_T *argvars, typval_T *rettv) +{ + find_some_match(argvars, rettv, MATCH_POS); +} + +static void max_min(typval_T *argvars, typval_T *rettv, int domax); + + static void +max_min(typval_T *argvars, typval_T *rettv, int domax) +{ + varnumber_T n = 0; + varnumber_T i; + int error = FALSE; + + if (argvars[0].v_type == VAR_LIST) + { + list_T *l; + listitem_T *li; + + l = argvars[0].vval.v_list; + if (l != NULL) + { + li = l->lv_first; + if (li != NULL) + { + n = get_tv_number_chk(&li->li_tv, &error); + for (;;) + { + li = li->li_next; + if (li == NULL) + break; + i = get_tv_number_chk(&li->li_tv, &error); + if (domax ? i > n : i < n) + n = i; + } + } + } + } + else if (argvars[0].v_type == VAR_DICT) + { + dict_T *d; + int first = TRUE; + hashitem_T *hi; + int todo; + + d = argvars[0].vval.v_dict; + if (d != NULL) + { + todo = (int)d->dv_hashtab.ht_used; + for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + i = get_tv_number_chk(&HI2DI(hi)->di_tv, &error); + if (first) + { + n = i; + first = FALSE; + } + else if (domax ? i > n : i < n) + n = i; + } + } + } + } + else + EMSG2(_(e_listdictarg), domax ? "max()" : "min()"); + rettv->vval.v_number = error ? 0 : n; +} + +/* + * "max()" function + */ + static void +f_max(typval_T *argvars, typval_T *rettv) +{ + max_min(argvars, rettv, TRUE); +} + +/* + * "migemo()" function + */ + static void +f_migemo(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + char_u* arg = get_tv_string(&argvars[0]); + + rettv->v_type = VAR_STRING; +#ifdef USE_MIGEMO + rettv->vval.v_string = query_migemo(arg); +#else + rettv->vval.v_string = vim_strsave(arg); +#endif +} + +/* + * "min()" function + */ + static void +f_min(typval_T *argvars, typval_T *rettv) +{ + max_min(argvars, rettv, FALSE); +} + +static int mkdir_recurse(char_u *dir, int prot); + +/* + * Create the directory in which "dir" is located, and higher levels when + * needed. + * Return OK or FAIL. + */ + static int +mkdir_recurse(char_u *dir, int prot) +{ + char_u *p; + char_u *updir; + int r = FAIL; + + /* Get end of directory name in "dir". + * We're done when it's "/" or "c:/". */ + p = gettail_sep(dir); + if (p <= get_past_head(dir)) + return OK; + + /* If the directory exists we're done. Otherwise: create it.*/ + updir = vim_strnsave(dir, (int)(p - dir)); + if (updir == NULL) + return FAIL; + if (mch_isdir(updir)) + r = OK; + else if (mkdir_recurse(updir, prot) == OK) + r = vim_mkdir_emsg(updir, prot); + vim_free(updir); + return r; +} + +#ifdef vim_mkdir +/* + * "mkdir()" function + */ + static void +f_mkdir(typval_T *argvars, typval_T *rettv) +{ + char_u *dir; + char_u buf[NUMBUFLEN]; + int prot = 0755; + + rettv->vval.v_number = FAIL; + if (check_restricted() || check_secure()) + return; + + dir = get_tv_string_buf(&argvars[0], buf); + if (*dir == NUL) + return; + + if (*gettail(dir) == NUL) + /* remove trailing slashes */ + *gettail_sep(dir) = NUL; + + if (argvars[1].v_type != VAR_UNKNOWN) + { + if (argvars[2].v_type != VAR_UNKNOWN) + { + prot = (int)get_tv_number_chk(&argvars[2], NULL); + if (prot == -1) + return; + } + if (STRCMP(get_tv_string(&argvars[1]), "p") == 0) + { + if (mch_isdir(dir)) + { + /* With the "p" flag it's OK if the dir already exists. */ + rettv->vval.v_number = OK; + return; + } + mkdir_recurse(dir, prot); + } + } + rettv->vval.v_number = vim_mkdir_emsg(dir, prot); +} +#endif + +/* + * "mode()" function + */ + static void +f_mode(typval_T *argvars, typval_T *rettv) +{ + char_u buf[3]; + + buf[1] = NUL; + buf[2] = NUL; + + if (time_for_testing == 93784) + { + /* Testing the two-character code. */ + buf[0] = 'x'; + buf[1] = '!'; + } +#ifdef FEAT_TERMINAL + else if (term_use_loop()) + buf[0] = 't'; +#endif + else if (VIsual_active) + { + if (VIsual_select) + buf[0] = VIsual_mode + 's' - 'v'; + else + buf[0] = VIsual_mode; + } + else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE + || State == CONFIRM) + { + buf[0] = 'r'; + if (State == ASKMORE) + buf[1] = 'm'; + else if (State == CONFIRM) + buf[1] = '?'; + } + else if (State == EXTERNCMD) + buf[0] = '!'; + else if (State & INSERT) + { +#ifdef FEAT_VREPLACE + if (State & VREPLACE_FLAG) + { + buf[0] = 'R'; + buf[1] = 'v'; + } + else +#endif + { + if (State & REPLACE_FLAG) + buf[0] = 'R'; + else + buf[0] = 'i'; +#ifdef FEAT_INS_EXPAND + if (ins_compl_active()) + buf[1] = 'c'; + else if (ctrl_x_mode_not_defined_yet()) + buf[1] = 'x'; +#endif + } + } + else if ((State & CMDLINE) || exmode_active) + { + buf[0] = 'c'; + if (exmode_active == EXMODE_VIM) + buf[1] = 'v'; + else if (exmode_active == EXMODE_NORMAL) + buf[1] = 'e'; + } + else + { + buf[0] = 'n'; + if (finish_op) + buf[1] = 'o'; + } + + /* Clear out the minor mode when the argument is not a non-zero number or + * non-empty string. */ + if (!non_zero_arg(&argvars[0])) + buf[1] = NUL; + + rettv->vval.v_string = vim_strsave(buf); + rettv->v_type = VAR_STRING; +} + +#if defined(FEAT_MZSCHEME) || defined(PROTO) +/* + * "mzeval()" function + */ + static void +f_mzeval(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + str = get_tv_string_buf(&argvars[0], buf); + do_mzeval(str, rettv); +} + + void +mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv) +{ + typval_T argvars[3]; + + argvars[0].v_type = VAR_STRING; + argvars[0].vval.v_string = name; + copy_tv(args, &argvars[1]); + argvars[2].v_type = VAR_UNKNOWN; + f_call(argvars, rettv); + clear_tv(&argvars[1]); +} +#endif + +/* + * "nextnonblank()" function + */ + static void +f_nextnonblank(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + + for (lnum = get_tv_lnum(argvars); ; ++lnum) + { + if (lnum < 0 || lnum > curbuf->b_ml.ml_line_count) + { + lnum = 0; + break; + } + if (*skipwhite(ml_get(lnum)) != NUL) + break; + } + rettv->vval.v_number = lnum; +} + +/* + * "nr2char()" function + */ + static void +f_nr2char(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + +#ifdef FEAT_MBYTE + if (has_mbyte) + { + int utf8 = 0; + + if (argvars[1].v_type != VAR_UNKNOWN) + utf8 = (int)get_tv_number_chk(&argvars[1], NULL); + if (utf8) + buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; + else + buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; + } + else +#endif + { + buf[0] = (char_u)get_tv_number(&argvars[0]); + buf[1] = NUL; + } + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(buf); +} + +/* + * "or(expr, expr)" function + */ + static void +f_or(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) + | get_tv_number_chk(&argvars[1], NULL); +} + +/* + * "pathshorten()" function + */ + static void +f_pathshorten(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + + rettv->v_type = VAR_STRING; + p = get_tv_string_chk(&argvars[0]); + if (p == NULL) + rettv->vval.v_string = NULL; + else + { + p = vim_strsave(p); + rettv->vval.v_string = p; + if (p != NULL) + shorten_dir(p); + } +} + +#ifdef FEAT_PERL +/* + * "perleval()" function + */ + static void +f_perleval(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + str = get_tv_string_buf(&argvars[0], buf); + do_perleval(str, rettv); +} +#endif + +#ifdef FEAT_FLOAT +/* + * "pow()" function + */ + static void +f_pow(typval_T *argvars, typval_T *rettv) +{ + float_T fx = 0.0, fy = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &fx) == OK + && get_float_arg(&argvars[1], &fy) == OK) + rettv->vval.v_float = pow(fx, fy); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "prevnonblank()" function + */ + static void +f_prevnonblank(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + + lnum = get_tv_lnum(argvars); + if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) + lnum = 0; + else + while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL) + --lnum; + rettv->vval.v_number = lnum; +} + +/* This dummy va_list is here because: + * - passing a NULL pointer doesn't work when va_list isn't a pointer + * - locally in the function results in a "used before set" warning + * - using va_start() to initialize it gives "function with fixed args" error */ +static va_list ap; + +/* + * "printf()" function + */ + static void +f_printf(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + int len; + char_u *s; + int saved_did_emsg = did_emsg; + char *fmt; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + /* Get the required length, allocate the buffer and do it for real. */ + did_emsg = FALSE; + fmt = (char *)get_tv_string_buf(&argvars[0], buf); + len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); + if (!did_emsg) + { + s = alloc(len + 1); + if (s != NULL) + { + rettv->vval.v_string = s; + (void)vim_vsnprintf_typval((char *)s, len + 1, fmt, + ap, argvars + 1); + } + } + did_emsg |= saved_did_emsg; +} + +#ifdef FEAT_JOB_CHANNEL +/* + * "prompt_setcallback({buffer}, {callback})" function + */ + static void +f_prompt_setcallback(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf; + char_u *callback; + partial_T *partial; + + if (check_secure()) + return; + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + return; + + callback = get_callback(&argvars[1], &partial); + if (callback == NULL) + return; + + free_callback(buf->b_prompt_callback, buf->b_prompt_partial); + if (partial == NULL) + buf->b_prompt_callback = vim_strsave(callback); + else + /* pointer into the partial */ + buf->b_prompt_callback = callback; + buf->b_prompt_partial = partial; +} + +/* + * "prompt_setinterrupt({buffer}, {callback})" function + */ + static void +f_prompt_setinterrupt(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf; + char_u *callback; + partial_T *partial; + + if (check_secure()) + return; + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + return; + + callback = get_callback(&argvars[1], &partial); + if (callback == NULL) + return; + + free_callback(buf->b_prompt_interrupt, buf->b_prompt_int_partial); + if (partial == NULL) + buf->b_prompt_interrupt = vim_strsave(callback); + else + /* pointer into the partial */ + buf->b_prompt_interrupt = callback; + buf->b_prompt_int_partial = partial; +} + +/* + * "prompt_setprompt({buffer}, {text})" function + */ + static void +f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf; + char_u *text; + + if (check_secure()) + return; + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + return; + + text = get_tv_string(&argvars[1]); + vim_free(buf->b_prompt_text); + buf->b_prompt_text = vim_strsave(text); +} +#endif + +/* + * "pumvisible()" function + */ + static void +f_pumvisible(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_INS_EXPAND + if (pum_visible()) + rettv->vval.v_number = 1; +#endif +} + +#ifdef FEAT_PYTHON3 +/* + * "py3eval()" function + */ + static void +f_py3eval(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + if (p_pyx == 0) + p_pyx = 3; + + str = get_tv_string_buf(&argvars[0], buf); + do_py3eval(str, rettv); +} +#endif + +#ifdef FEAT_PYTHON +/* + * "pyeval()" function + */ + static void +f_pyeval(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + if (p_pyx == 0) + p_pyx = 2; + + str = get_tv_string_buf(&argvars[0], buf); + do_pyeval(str, rettv); +} +#endif + +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) +/* + * "pyxeval()" function + */ + static void +f_pyxeval(typval_T *argvars, typval_T *rettv) +{ +# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) + init_pyxversion(); + if (p_pyx == 2) + f_pyeval(argvars, rettv); + else + f_py3eval(argvars, rettv); +# elif defined(FEAT_PYTHON) + f_pyeval(argvars, rettv); +# elif defined(FEAT_PYTHON3) + f_py3eval(argvars, rettv); +# endif +} +#endif + +/* + * "range()" function + */ + static void +f_range(typval_T *argvars, typval_T *rettv) +{ + varnumber_T start; + varnumber_T end; + varnumber_T stride = 1; + varnumber_T i; + int error = FALSE; + + start = get_tv_number_chk(&argvars[0], &error); + if (argvars[1].v_type == VAR_UNKNOWN) + { + end = start - 1; + start = 0; + } + else + { + end = get_tv_number_chk(&argvars[1], &error); + if (argvars[2].v_type != VAR_UNKNOWN) + stride = get_tv_number_chk(&argvars[2], &error); + } + + if (error) + return; /* type error; errmsg already given */ + if (stride == 0) + EMSG(_("E726: Stride is zero")); + else if (stride > 0 ? end + 1 < start : end - 1 > start) + EMSG(_("E727: Start past end")); + else + { + if (rettv_list_alloc(rettv) == OK) + for (i = start; stride > 0 ? i <= end : i >= end; i += stride) + if (list_append_number(rettv->vval.v_list, + (varnumber_T)i) == FAIL) + break; + } +} + +/* + * "readfile()" function + */ + static void +f_readfile(typval_T *argvars, typval_T *rettv) +{ + int binary = FALSE; + int failed = FALSE; + char_u *fname; + FILE *fd; + char_u buf[(IOSIZE/256)*256]; /* rounded to avoid odd + 1 */ + int io_size = sizeof(buf); + int readlen; /* size of last fread() */ + char_u *prev = NULL; /* previously read bytes, if any */ + long prevlen = 0; /* length of data in prev */ + long prevsize = 0; /* size of prev buffer */ + long maxline = MAXLNUM; + long cnt = 0; + char_u *p; /* position in buf */ + char_u *start; /* start of current line */ + + if (argvars[1].v_type != VAR_UNKNOWN) + { + if (STRCMP(get_tv_string(&argvars[1]), "b") == 0) + binary = TRUE; + if (argvars[2].v_type != VAR_UNKNOWN) + maxline = (long)get_tv_number(&argvars[2]); + } + + if (rettv_list_alloc(rettv) == FAIL) + return; + + /* Always open the file in binary mode, library functions have a mind of + * their own about CR-LF conversion. */ + fname = get_tv_string(&argvars[0]); + if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) + { + EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") : fname); + return; + } + + while (cnt < maxline || maxline < 0) + { + readlen = (int)fread(buf, 1, io_size, fd); + + /* This for loop processes what was read, but is also entered at end + * of file so that either: + * - an incomplete line gets written + * - a "binary" file gets an empty line at the end if it ends in a + * newline. */ + for (p = buf, start = buf; + p < buf + readlen || (readlen <= 0 && (prevlen > 0 || binary)); + ++p) + { + if (*p == '\n' || readlen <= 0) + { + listitem_T *li; + char_u *s = NULL; + long_u len = p - start; + + /* Finished a line. Remove CRs before NL. */ + if (readlen > 0 && !binary) + { + while (len > 0 && start[len - 1] == '\r') + --len; + /* removal may cross back to the "prev" string */ + if (len == 0) + while (prevlen > 0 && prev[prevlen - 1] == '\r') + --prevlen; + } + if (prevlen == 0) + s = vim_strnsave(start, (int)len); + else + { + /* Change "prev" buffer to be the right size. This way + * the bytes are only copied once, and very long lines are + * allocated only once. */ + if ((s = vim_realloc(prev, prevlen + len + 1)) != NULL) + { + mch_memmove(s + prevlen, start, len); + s[prevlen + len] = NUL; + prev = NULL; /* the list will own the string */ + prevlen = prevsize = 0; + } + } + if (s == NULL) + { + do_outofmem_msg((long_u) prevlen + len + 1); + failed = TRUE; + break; + } + + if ((li = listitem_alloc()) == NULL) + { + vim_free(s); + failed = TRUE; + break; + } + li->li_tv.v_type = VAR_STRING; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_string = s; + list_append(rettv->vval.v_list, li); + + start = p + 1; /* step over newline */ + if ((++cnt >= maxline && maxline >= 0) || readlen <= 0) + break; + } + else if (*p == NUL) + *p = '\n'; +#ifdef FEAT_MBYTE + /* Check for utf8 "bom"; U+FEFF is encoded as EF BB BF. Do this + * when finding the BF and check the previous two bytes. */ + else if (*p == 0xbf && enc_utf8 && !binary) + { + /* Find the two bytes before the 0xbf. If p is at buf, or buf + * + 1, these may be in the "prev" string. */ + char_u back1 = p >= buf + 1 ? p[-1] + : prevlen >= 1 ? prev[prevlen - 1] : NUL; + char_u back2 = p >= buf + 2 ? p[-2] + : p == buf + 1 && prevlen >= 1 ? prev[prevlen - 1] + : prevlen >= 2 ? prev[prevlen - 2] : NUL; + + if (back2 == 0xef && back1 == 0xbb) + { + char_u *dest = p - 2; + + /* Usually a BOM is at the beginning of a file, and so at + * the beginning of a line; then we can just step over it. + */ + if (start == dest) + start = p + 1; + else + { + /* have to shuffle buf to close gap */ + int adjust_prevlen = 0; + + if (dest < buf) + { + adjust_prevlen = (int)(buf - dest); /* must be 1 or 2 */ + dest = buf; + } + if (readlen > p - buf + 1) + mch_memmove(dest, p + 1, readlen - (p - buf) - 1); + readlen -= 3 - adjust_prevlen; + prevlen -= adjust_prevlen; + p = dest - 1; + } + } + } +#endif + } /* for */ + + if (failed || (cnt >= maxline && maxline >= 0) || readlen <= 0) + break; + if (start < p) + { + /* There's part of a line in buf, store it in "prev". */ + if (p - start + prevlen >= prevsize) + { + /* need bigger "prev" buffer */ + char_u *newprev; + + /* A common use case is ordinary text files and "prev" gets a + * fragment of a line, so the first allocation is made + * small, to avoid repeatedly 'allocing' large and + * 'reallocing' small. */ + if (prevsize == 0) + prevsize = (long)(p - start); + else + { + long grow50pc = (prevsize * 3) / 2; + long growmin = (long)((p - start) * 2 + prevlen); + prevsize = grow50pc > growmin ? grow50pc : growmin; + } + newprev = prev == NULL ? alloc(prevsize) + : vim_realloc(prev, prevsize); + if (newprev == NULL) + { + do_outofmem_msg((long_u)prevsize); + failed = TRUE; + break; + } + prev = newprev; + } + /* Add the line part to end of "prev". */ + mch_memmove(prev + prevlen, start, p - start); + prevlen += (long)(p - start); + } + } /* while */ + + /* + * For a negative line count use only the lines at the end of the file, + * free the rest. + */ + if (!failed && maxline < 0) + while (cnt > -maxline) + { + listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first); + --cnt; + } + + if (failed) + { + list_free(rettv->vval.v_list); + /* readfile doc says an empty list is returned on error */ + rettv->vval.v_list = list_alloc(); + } + + vim_free(prev); + fclose(fd); +} + + static void +return_register(int regname, typval_T *rettv) +{ + char_u buf[2] = {0, 0}; + + buf[0] = (char_u)regname; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(buf); +} + +/* + * "reg_executing()" function + */ + static void +f_reg_executing(typval_T *argvars UNUSED, typval_T *rettv) +{ + return_register(reg_executing, rettv); +} + +/* + * "reg_recording()" function + */ + static void +f_reg_recording(typval_T *argvars UNUSED, typval_T *rettv) +{ + return_register(reg_recording, rettv); +} + +#if defined(FEAT_RELTIME) +static int list2proftime(typval_T *arg, proftime_T *tm); + +/* + * Convert a List to proftime_T. + * Return FAIL when there is something wrong. + */ + static int +list2proftime(typval_T *arg, proftime_T *tm) +{ + long n1, n2; + int error = FALSE; + + if (arg->v_type != VAR_LIST || arg->vval.v_list == NULL + || arg->vval.v_list->lv_len != 2) + return FAIL; + n1 = list_find_nr(arg->vval.v_list, 0L, &error); + n2 = list_find_nr(arg->vval.v_list, 1L, &error); +# ifdef WIN3264 + tm->HighPart = n1; + tm->LowPart = n2; +# else + tm->tv_sec = n1; + tm->tv_usec = n2; +# endif + return error ? FAIL : OK; +} +#endif /* FEAT_RELTIME */ + +/* + * "reltime()" function + */ + static void +f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_RELTIME + proftime_T res; + proftime_T start; + + if (argvars[0].v_type == VAR_UNKNOWN) + { + /* No arguments: get current time. */ + profile_start(&res); + } + else if (argvars[1].v_type == VAR_UNKNOWN) + { + if (list2proftime(&argvars[0], &res) == FAIL) + return; + profile_end(&res); + } + else + { + /* Two arguments: compute the difference. */ + if (list2proftime(&argvars[0], &start) == FAIL + || list2proftime(&argvars[1], &res) == FAIL) + return; + profile_sub(&res, &start); + } + + if (rettv_list_alloc(rettv) == OK) + { + long n1, n2; + +# ifdef WIN3264 + n1 = res.HighPart; + n2 = res.LowPart; +# else + n1 = res.tv_sec; + n2 = res.tv_usec; +# endif + list_append_number(rettv->vval.v_list, (varnumber_T)n1); + list_append_number(rettv->vval.v_list, (varnumber_T)n2); + } +#endif +} + +#ifdef FEAT_FLOAT +/* + * "reltimefloat()" function + */ + static void +f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) +{ +# ifdef FEAT_RELTIME + proftime_T tm; +# endif + + rettv->v_type = VAR_FLOAT; + rettv->vval.v_float = 0; +# ifdef FEAT_RELTIME + if (list2proftime(&argvars[0], &tm) == OK) + rettv->vval.v_float = profile_float(&tm); +# endif +} +#endif + +/* + * "reltimestr()" function + */ + static void +f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_RELTIME + proftime_T tm; +#endif + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_RELTIME + if (list2proftime(&argvars[0], &tm) == OK) + rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); +#endif +} + +#if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) +static void make_connection(void); +static int check_connection(void); + + static void +make_connection(void) +{ + if (X_DISPLAY == NULL +# ifdef FEAT_GUI + && !gui.in_use +# endif + ) + { + x_force_connect = TRUE; + setup_term_clip(); + x_force_connect = FALSE; + } +} + + static int +check_connection(void) +{ + make_connection(); + if (X_DISPLAY == NULL) + { + EMSG(_("E240: No connection to the X server")); + return FAIL; + } + return OK; +} +#endif + +#ifdef FEAT_CLIENTSERVER + static void +remote_common(typval_T *argvars, typval_T *rettv, int expr) +{ + char_u *server_name; + char_u *keys; + char_u *r = NULL; + char_u buf[NUMBUFLEN]; + int timeout = 0; +# ifdef WIN32 + HWND w; +# elif defined(FEAT_X11) + Window w; +# elif defined(MAC_CLIENTSERVER) + int w; // This is the port number ('w' is a bit confusing) +# endif + + if (check_restricted() || check_secure()) + return; + +# ifdef FEAT_X11 + if (check_connection() == FAIL) + return; +# endif + if (argvars[2].v_type != VAR_UNKNOWN + && argvars[3].v_type != VAR_UNKNOWN) + timeout = get_tv_number(&argvars[3]); + + server_name = get_tv_string_chk(&argvars[0]); + if (server_name == NULL) + return; /* type error; errmsg already given */ + keys = get_tv_string_buf(&argvars[1], buf); +# if defined(WIN32) || defined(MAC_CLIENTSERVER) + if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) +# else + if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, + 0, TRUE) < 0) +# endif + { + if (r != NULL) + { + EMSG(r); /* sending worked but evaluation failed */ + vim_free(r); + } + else + EMSG2(_("E241: Unable to send to %s"), server_name); + return; + } + + rettv->vval.v_string = r; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + dictitem_T v; + char_u str[30]; + char_u *idvar; + + idvar = get_tv_string_chk(&argvars[2]); + if (idvar != NULL && *idvar != NUL) + { + sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); + v.di_tv.v_type = VAR_STRING; + v.di_tv.vval.v_string = vim_strsave(str); + set_var(idvar, &v.di_tv, FALSE); + vim_free(v.di_tv.vval.v_string); + } + } +} +#endif + +/* + * "remote_expr()" function + */ + static void +f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_CLIENTSERVER + remote_common(argvars, rettv, TRUE); +#endif +} + +/* + * "remote_foreground()" function + */ + static void +f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_CLIENTSERVER +# ifdef WIN32 + /* On Win32 it's done in this application. */ + { + char_u *server_name = get_tv_string_chk(&argvars[0]); + + if (server_name != NULL) + serverForeground(server_name); + } +# elif defined(FEAT_X11) || defined(MAC_CLIENTSERVER) + /* Send a foreground() expression to the server. */ + argvars[1].v_type = VAR_STRING; + argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); + argvars[2].v_type = VAR_UNKNOWN; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + remote_common(argvars, rettv, TRUE); + vim_free(argvars[1].vval.v_string); +# endif +#endif +} + + static void +f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_CLIENTSERVER + dictitem_T v; + char_u *s = NULL; +# ifdef WIN32 + long_u n = 0; +# endif + char_u *serverid; + + if (check_restricted() || check_secure()) + { + rettv->vval.v_number = -1; + return; + } + serverid = get_tv_string_chk(&argvars[0]); + if (serverid == NULL) + { + rettv->vval.v_number = -1; + return; /* type error; errmsg already given */ + } +# ifdef WIN32 + sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n); + if (n == 0) + rettv->vval.v_number = -1; + else + { + s = serverGetReply((HWND)n, FALSE, FALSE, FALSE, 0); + rettv->vval.v_number = (s != NULL); + } +# elif defined(FEAT_X11) + if (check_connection() == FAIL) + return; + + rettv->vval.v_number = serverPeekReply(X_DISPLAY, + serverStrToWin(serverid), &s); +# elif defined(MAC_CLIENTSERVER) + rettv->vval.v_number = serverPeekReply(serverStrToPort(serverid), &s); +# endif + + if (argvars[1].v_type != VAR_UNKNOWN && rettv->vval.v_number > 0) + { + char_u *retvar; + + v.di_tv.v_type = VAR_STRING; + v.di_tv.vval.v_string = vim_strsave(s); + retvar = get_tv_string_chk(&argvars[1]); + if (retvar != NULL) + set_var(retvar, &v.di_tv, FALSE); + vim_free(v.di_tv.vval.v_string); + } +#else + rettv->vval.v_number = -1; +#endif +} + + static void +f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u *r = NULL; + +#ifdef FEAT_CLIENTSERVER + char_u *serverid = get_tv_string_chk(&argvars[0]); + + if (serverid != NULL && !check_restricted() && !check_secure()) + { + int timeout = 0; +# ifdef WIN32 + /* The server's HWND is encoded in the 'id' parameter */ + long_u n = 0; +# endif + + if (argvars[1].v_type != VAR_UNKNOWN) + timeout = get_tv_number(&argvars[1]); + +# ifdef WIN32 + sscanf((char *)serverid, SCANF_HEX_LONG_U, &n); + if (n != 0) + r = serverGetReply((HWND)n, FALSE, TRUE, TRUE, timeout); + if (r == NULL) +# elif defined(MAC_CLIENTSERVER) + if (serverReadReply(serverStrToPort(serverid), &r) < 0) +# else + if (check_connection() == FAIL + || serverReadReply(X_DISPLAY, serverStrToWin(serverid), + &r, FALSE, timeout) < 0) +# endif + EMSG(_("E277: Unable to read a server reply")); + } +#endif + rettv->v_type = VAR_STRING; + rettv->vval.v_string = r; +} + +/* + * "remote_send()" function + */ + static void +f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_CLIENTSERVER + remote_common(argvars, rettv, FALSE); +#endif +} + +/* + * "remote_startserver()" function + */ + static void +f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_CLIENTSERVER + char_u *server = get_tv_string_chk(&argvars[0]); + + if (server == NULL) + return; /* type error; errmsg already given */ + if (serverName != NULL) + EMSG(_("E941: already started a server")); + else + { +# ifdef FEAT_X11 + if (check_connection() == OK) + serverRegisterName(X_DISPLAY, server); +# elif defined(MAC_CLIENTSERVER) + serverRegisterName(server); +# else + serverSetName(server); +# endif + } +#else + EMSG(_("E942: +clientserver feature not available")); +#endif +} + +/* + * "remove()" function + */ + static void +f_remove(typval_T *argvars, typval_T *rettv) +{ + list_T *l; + listitem_T *item, *item2; + listitem_T *li; + long idx; + long end; + char_u *key; + dict_T *d; + dictitem_T *di; + char_u *arg_errmsg = (char_u *)N_("remove() argument"); + + if (argvars[0].v_type == VAR_DICT) + { + if (argvars[2].v_type != VAR_UNKNOWN) + EMSG2(_(e_toomanyarg), "remove()"); + else if ((d = argvars[0].vval.v_dict) != NULL + && !tv_check_lock(d->dv_lock, arg_errmsg, TRUE)) + { + key = get_tv_string_chk(&argvars[1]); + if (key != NULL) + { + di = dict_find(d, key, -1); + if (di == NULL) + EMSG2(_(e_dictkey), key); + else if (!var_check_fixed(di->di_flags, arg_errmsg, TRUE) + && !var_check_ro(di->di_flags, arg_errmsg, TRUE)) + { + *rettv = di->di_tv; + init_tv(&di->di_tv); + dictitem_remove(d, di); + } + } + } + } + else if (argvars[0].v_type != VAR_LIST) + EMSG2(_(e_listdictarg), "remove()"); + else if ((l = argvars[0].vval.v_list) != NULL + && !tv_check_lock(l->lv_lock, arg_errmsg, TRUE)) + { + int error = FALSE; + + idx = (long)get_tv_number_chk(&argvars[1], &error); + if (error) + ; /* type error: do nothing, errmsg already given */ + else if ((item = list_find(l, idx)) == NULL) + EMSGN(_(e_listidx), idx); + else + { + if (argvars[2].v_type == VAR_UNKNOWN) + { + /* Remove one item, return its value. */ + vimlist_remove(l, item, item); + *rettv = item->li_tv; + vim_free(item); + } + else + { + /* Remove range of items, return list with values. */ + end = (long)get_tv_number_chk(&argvars[2], &error); + if (error) + ; /* type error: do nothing */ + else if ((item2 = list_find(l, end)) == NULL) + EMSGN(_(e_listidx), end); + else + { + int cnt = 0; + + for (li = item; li != NULL; li = li->li_next) + { + ++cnt; + if (li == item2) + break; + } + if (li == NULL) /* didn't find "item2" after "item" */ + EMSG(_(e_invrange)); + else + { + vimlist_remove(l, item, item2); + if (rettv_list_alloc(rettv) == OK) + { + l = rettv->vval.v_list; + l->lv_first = item; + l->lv_last = item2; + item->li_prev = NULL; + item2->li_next = NULL; + l->lv_len = cnt; + } + } + } + } + } + } +} + +/* + * "rename({from}, {to})" function + */ + static void +f_rename(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + + if (check_restricted() || check_secure()) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = vim_rename(get_tv_string(&argvars[0]), + get_tv_string_buf(&argvars[1], buf)); +} + +/* + * "repeat()" function + */ + static void +f_repeat(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + int n; + int slen; + int len; + char_u *r; + int i; + + n = (int)get_tv_number(&argvars[1]); + if (argvars[0].v_type == VAR_LIST) + { + if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) + while (n-- > 0) + if (list_extend(rettv->vval.v_list, + argvars[0].vval.v_list, NULL) == FAIL) + break; + } + else + { + p = get_tv_string(&argvars[0]); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + slen = (int)STRLEN(p); + len = slen * n; + if (len <= 0) + return; + + r = alloc(len + 1); + if (r != NULL) + { + for (i = 0; i < n; i++) + mch_memmove(r + i * slen, p, (size_t)slen); + r[len] = NUL; + } + + rettv->vval.v_string = r; + } +} + +/* + * "resolve()" function + */ + static void +f_resolve(typval_T *argvars, typval_T *rettv) +{ + char_u *p; +#ifdef HAVE_READLINK + char_u *buf = NULL; +#endif + + p = get_tv_string(&argvars[0]); +#ifdef FEAT_SHORTCUT + { + char_u *v = NULL; + + v = mch_resolve_shortcut(p); + if (v != NULL) + rettv->vval.v_string = v; + else + rettv->vval.v_string = vim_strsave(p); + } +#else +# ifdef HAVE_READLINK + { + char_u *cpy; + int len; + char_u *remain = NULL; + char_u *q; + int is_relative_to_current = FALSE; + int has_trailing_pathsep = FALSE; + int limit = 100; + + p = vim_strsave(p); + + if (p[0] == '.' && (vim_ispathsep(p[1]) + || (p[1] == '.' && (vim_ispathsep(p[2]))))) + is_relative_to_current = TRUE; + + len = STRLEN(p); + if (len > 0 && after_pathsep(p, p + len)) + { + has_trailing_pathsep = TRUE; + p[len - 1] = NUL; /* the trailing slash breaks readlink() */ + } + + q = getnextcomp(p); + if (*q != NUL) + { + /* Separate the first path component in "p", and keep the + * remainder (beginning with the path separator). */ + remain = vim_strsave(q - 1); + q[-1] = NUL; + } + + buf = alloc(MAXPATHL + 1); + if (buf == NULL) + goto fail; + + for (;;) + { + for (;;) + { + len = readlink((char *)p, (char *)buf, MAXPATHL); + if (len <= 0) + break; + buf[len] = NUL; + + if (limit-- == 0) + { + vim_free(p); + vim_free(remain); + EMSG(_("E655: Too many symbolic links (cycle?)")); + rettv->vval.v_string = NULL; + goto fail; + } + + /* Ensure that the result will have a trailing path separator + * if the argument has one. */ + if (remain == NULL && has_trailing_pathsep) + add_pathsep(buf); + + /* Separate the first path component in the link value and + * concatenate the remainders. */ + q = getnextcomp(vim_ispathsep(*buf) ? buf + 1 : buf); + if (*q != NUL) + { + if (remain == NULL) + remain = vim_strsave(q - 1); + else + { + cpy = concat_str(q - 1, remain); + if (cpy != NULL) + { + vim_free(remain); + remain = cpy; + } + } + q[-1] = NUL; + } + + q = gettail(p); + if (q > p && *q == NUL) + { + /* Ignore trailing path separator. */ + q[-1] = NUL; + q = gettail(p); + } + if (q > p && !mch_isFullName(buf)) + { + /* symlink is relative to directory of argument */ + cpy = alloc((unsigned)(STRLEN(p) + STRLEN(buf) + 1)); + if (cpy != NULL) + { + STRCPY(cpy, p); + STRCPY(gettail(cpy), buf); + vim_free(p); + p = cpy; + } + } + else + { + vim_free(p); + p = vim_strsave(buf); + } + } + + if (remain == NULL) + break; + + /* Append the first path component of "remain" to "p". */ + q = getnextcomp(remain + 1); + len = q - remain - (*q != NUL); + cpy = vim_strnsave(p, STRLEN(p) + len); + if (cpy != NULL) + { + STRNCAT(cpy, remain, len); + vim_free(p); + p = cpy; + } + /* Shorten "remain". */ + if (*q != NUL) + STRMOVE(remain, q - 1); + else + VIM_CLEAR(remain); + } + + /* If the result is a relative path name, make it explicitly relative to + * the current directory if and only if the argument had this form. */ + if (!vim_ispathsep(*p)) + { + if (is_relative_to_current + && *p != NUL + && !(p[0] == '.' + && (p[1] == NUL + || vim_ispathsep(p[1]) + || (p[1] == '.' + && (p[2] == NUL + || vim_ispathsep(p[2])))))) + { + /* Prepend "./". */ + cpy = concat_str((char_u *)"./", p); + if (cpy != NULL) + { + vim_free(p); + p = cpy; + } + } + else if (!is_relative_to_current) + { + /* Strip leading "./". */ + q = p; + while (q[0] == '.' && vim_ispathsep(q[1])) + q += 2; + if (q > p) + STRMOVE(p, p + 2); + } + } + + /* Ensure that the result will have no trailing path separator + * if the argument had none. But keep "/" or "//". */ + if (!has_trailing_pathsep) + { + q = p + STRLEN(p); + if (after_pathsep(p, q)) + *gettail_sep(p) = NUL; + } + + rettv->vval.v_string = p; + } +# else + rettv->vval.v_string = vim_strsave(p); +# endif +#endif + + simplify_filename(rettv->vval.v_string); + +#ifdef HAVE_READLINK +fail: + vim_free(buf); +#endif + rettv->v_type = VAR_STRING; +} + +/* + * "reverse({list})" function + */ + static void +f_reverse(typval_T *argvars, typval_T *rettv) +{ + list_T *l; + listitem_T *li, *ni; + + if (argvars[0].v_type != VAR_LIST) + EMSG2(_(e_listarg), "reverse()"); + else if ((l = argvars[0].vval.v_list) != NULL + && !tv_check_lock(l->lv_lock, + (char_u *)N_("reverse() argument"), TRUE)) + { + li = l->lv_last; + l->lv_first = l->lv_last = NULL; + l->lv_len = 0; + while (li != NULL) + { + ni = li->li_prev; + list_append(l, li); + li = ni; + } + rettv_list_set(rettv, l); + l->lv_idx = l->lv_len - l->lv_idx - 1; + } +} + +#define SP_NOMOVE 0x01 /* don't move cursor */ +#define SP_REPEAT 0x02 /* repeat to find outer pair */ +#define SP_RETCOUNT 0x04 /* return matchcount */ +#define SP_SETPCMARK 0x08 /* set previous context mark */ +#define SP_START 0x10 /* accept match at start position */ +#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */ +#define SP_END 0x40 /* leave cursor at end of match */ +#define SP_COLUMN 0x80 /* start at cursor column */ + +static int get_search_arg(typval_T *varp, int *flagsp); + +/* + * Get flags for a search function. + * Possibly sets "p_ws". + * Returns BACKWARD, FORWARD or zero (for an error). + */ + static int +get_search_arg(typval_T *varp, int *flagsp) +{ + int dir = FORWARD; + char_u *flags; + char_u nbuf[NUMBUFLEN]; + int mask; + + if (varp->v_type != VAR_UNKNOWN) + { + flags = get_tv_string_buf_chk(varp, nbuf); + if (flags == NULL) + return 0; /* type error; errmsg already given */ + while (*flags != NUL) + { + switch (*flags) + { + case 'b': dir = BACKWARD; break; + case 'w': p_ws = TRUE; break; + case 'W': p_ws = FALSE; break; + default: mask = 0; + if (flagsp != NULL) + switch (*flags) + { + case 'c': mask = SP_START; break; + case 'e': mask = SP_END; break; + case 'm': mask = SP_RETCOUNT; break; + case 'n': mask = SP_NOMOVE; break; + case 'p': mask = SP_SUBPAT; break; + case 'r': mask = SP_REPEAT; break; + case 's': mask = SP_SETPCMARK; break; + case 'z': mask = SP_COLUMN; break; + } + if (mask == 0) + { + EMSG2(_(e_invarg2), flags); + dir = 0; + } + else + *flagsp |= mask; + } + if (dir == 0) + break; + ++flags; + } + } + return dir; +} + +/* + * Shared by search() and searchpos() functions. + */ + static int +search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) +{ + int flags; + char_u *pat; + pos_T pos; + pos_T save_cursor; + int save_p_ws = p_ws; + int dir; + int retval = 0; /* default: FAIL */ + long lnum_stop = 0; + proftime_T tm; +#ifdef FEAT_RELTIME + long time_limit = 0; +#endif + int options = SEARCH_KEEP; + int subpatnum; + + pat = get_tv_string(&argvars[0]); + dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */ + if (dir == 0) + goto theend; + flags = *flagsp; + if (flags & SP_START) + options |= SEARCH_START; + if (flags & SP_END) + options |= SEARCH_END; + if (flags & SP_COLUMN) + options |= SEARCH_COL; + + /* Optional arguments: line number to stop searching and timeout. */ + if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) + { + lnum_stop = (long)get_tv_number_chk(&argvars[2], NULL); + if (lnum_stop < 0) + goto theend; +#ifdef FEAT_RELTIME + if (argvars[3].v_type != VAR_UNKNOWN) + { + time_limit = (long)get_tv_number_chk(&argvars[3], NULL); + if (time_limit < 0) + goto theend; + } +#endif + } + +#ifdef FEAT_RELTIME + /* Set the time limit, if there is one. */ + profile_setlimit(time_limit, &tm); +#endif + + /* + * This function does not accept SP_REPEAT and SP_RETCOUNT flags. + * Check to make sure only those flags are set. + * Also, Only the SP_NOMOVE or the SP_SETPCMARK flag can be set. Both + * flags cannot be set. Check for that condition also. + */ + if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0) + || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); + goto theend; + } + + pos = save_cursor = curwin->w_cursor; + subpatnum = searchit(curwin, curbuf, &pos, dir, pat, 1L, + options, RE_SEARCH, (linenr_T)lnum_stop, &tm, NULL); + if (subpatnum != FAIL) + { + if (flags & SP_SUBPAT) + retval = subpatnum; + else + retval = pos.lnum; + if (flags & SP_SETPCMARK) + setpcmark(); + curwin->w_cursor = pos; + if (match_pos != NULL) + { + /* Store the match cursor position */ + match_pos->lnum = pos.lnum; + match_pos->col = pos.col + 1; + } + /* "/$" will put the cursor after the end of the line, may need to + * correct that here */ + check_cursor(); + } + + /* If 'n' flag is used: restore cursor position. */ + if (flags & SP_NOMOVE) + curwin->w_cursor = save_cursor; + else + curwin->w_set_curswant = TRUE; +theend: + p_ws = save_p_ws; + + return retval; +} + +#ifdef FEAT_FLOAT + +/* + * round() is not in C90, use ceil() or floor() instead. + */ + float_T +vim_round(float_T f) +{ + return f > 0 ? floor(f + 0.5) : ceil(f - 0.5); +} + +/* + * "round({float})" function + */ + static void +f_round(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = vim_round(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "screenattr()" function + */ + static void +f_screenattr(typval_T *argvars, typval_T *rettv) +{ + int row; + int col; + int c; + + row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; + col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; + if (row < 0 || row >= screen_Rows + || col < 0 || col >= screen_Columns) + c = -1; + else + c = ScreenAttrs[LineOffset[row] + col]; + rettv->vval.v_number = c; +} + +/* + * "screenchar()" function + */ + static void +f_screenchar(typval_T *argvars, typval_T *rettv) +{ + int row; + int col; + int off; + int c; + + row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; + col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; + if (row < 0 || row >= screen_Rows + || col < 0 || col >= screen_Columns) + c = -1; + else + { + off = LineOffset[row] + col; +#ifdef FEAT_MBYTE + if (enc_utf8 && ScreenLinesUC[off] != 0) + c = ScreenLinesUC[off]; + else +#endif + c = ScreenLines[off]; + } + rettv->vval.v_number = c; +} + +/* + * "screencol()" function + * + * First column is 1 to be consistent with virtcol(). + */ + static void +f_screencol(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = screen_screencol() + 1; +} + +/* + * "screenrow()" function + */ + static void +f_screenrow(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = screen_screenrow() + 1; +} + +/* + * "search()" function + */ + static void +f_search(typval_T *argvars, typval_T *rettv) +{ + int flags = 0; + + rettv->vval.v_number = search_cmn(argvars, NULL, &flags); +} + +/* + * "searchdecl()" function + */ + static void +f_searchdecl(typval_T *argvars, typval_T *rettv) +{ + int locally = 1; + int thisblock = 0; + int error = FALSE; + char_u *name; + + rettv->vval.v_number = 1; /* default: FAIL */ + + name = get_tv_string_chk(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN) + { + locally = (int)get_tv_number_chk(&argvars[1], &error) == 0; + if (!error && argvars[2].v_type != VAR_UNKNOWN) + thisblock = (int)get_tv_number_chk(&argvars[2], &error) != 0; + } + if (!error && name != NULL) + rettv->vval.v_number = find_decl(name, (int)STRLEN(name), + locally, thisblock, SEARCH_KEEP) == FAIL; +} + +/* + * Used by searchpair() and searchpairpos() + */ + static int +searchpair_cmn(typval_T *argvars, pos_T *match_pos) +{ + char_u *spat, *mpat, *epat; + typval_T *skip; + int save_p_ws = p_ws; + int dir; + int flags = 0; + char_u nbuf1[NUMBUFLEN]; + char_u nbuf2[NUMBUFLEN]; + int retval = 0; /* default: FAIL */ + long lnum_stop = 0; + long time_limit = 0; + + /* Get the three pattern arguments: start, middle, end. */ + spat = get_tv_string_chk(&argvars[0]); + mpat = get_tv_string_buf_chk(&argvars[1], nbuf1); + epat = get_tv_string_buf_chk(&argvars[2], nbuf2); + if (spat == NULL || mpat == NULL || epat == NULL) + goto theend; /* type error */ + + /* Handle the optional fourth argument: flags */ + dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ + if (dir == 0) + goto theend; + + /* Don't accept SP_END or SP_SUBPAT. + * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. + */ + if ((flags & (SP_END | SP_SUBPAT)) != 0 + || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[3])); + goto theend; + } + + /* Using 'r' implies 'W', otherwise it doesn't work. */ + if (flags & SP_REPEAT) + p_ws = FALSE; + + /* Optional fifth argument: skip expression */ + if (argvars[3].v_type == VAR_UNKNOWN + || argvars[4].v_type == VAR_UNKNOWN) + skip = NULL; + else + { + skip = &argvars[4]; + if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL + && skip->v_type != VAR_STRING) + { + /* Type error */ + goto theend; + } + if (argvars[5].v_type != VAR_UNKNOWN) + { + lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL); + if (lnum_stop < 0) + goto theend; +#ifdef FEAT_RELTIME + if (argvars[6].v_type != VAR_UNKNOWN) + { + time_limit = (long)get_tv_number_chk(&argvars[6], NULL); + if (time_limit < 0) + goto theend; + } +#endif + } + } + + retval = do_searchpair(spat, mpat, epat, dir, skip, flags, + match_pos, lnum_stop, time_limit); + +theend: + p_ws = save_p_ws; + + return retval; +} + +/* + * "searchpair()" function + */ + static void +f_searchpair(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = searchpair_cmn(argvars, NULL); +} + +/* + * "searchpairpos()" function + */ + static void +f_searchpairpos(typval_T *argvars, typval_T *rettv) +{ + pos_T match_pos; + int lnum = 0; + int col = 0; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + if (searchpair_cmn(argvars, &match_pos) > 0) + { + lnum = match_pos.lnum; + col = match_pos.col; + } + + list_append_number(rettv->vval.v_list, (varnumber_T)lnum); + list_append_number(rettv->vval.v_list, (varnumber_T)col); +} + +/* + * Search for a start/middle/end thing. + * Used by searchpair(), see its documentation for the details. + * Returns 0 or -1 for no match, + */ + long +do_searchpair( + char_u *spat, /* start pattern */ + char_u *mpat, /* middle pattern */ + char_u *epat, /* end pattern */ + int dir, /* BACKWARD or FORWARD */ + typval_T *skip, /* skip expression */ + int flags, /* SP_SETPCMARK and other SP_ values */ + pos_T *match_pos, + linenr_T lnum_stop, /* stop at this line if not zero */ + long time_limit UNUSED) /* stop after this many msec */ +{ + char_u *save_cpo; + char_u *pat, *pat2 = NULL, *pat3 = NULL; + long retval = 0; + pos_T pos; + pos_T firstpos; + pos_T foundpos; + pos_T save_cursor; + pos_T save_pos; + int n; + int r; + int nest = 1; + int use_skip = FALSE; + int err; + int options = SEARCH_KEEP; + proftime_T tm; + + /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + save_cpo = p_cpo; + p_cpo = empty_option; + +#ifdef FEAT_RELTIME + /* Set the time limit, if there is one. */ + profile_setlimit(time_limit, &tm); +#endif + + /* Make two search patterns: start/end (pat2, for in nested pairs) and + * start/middle/end (pat3, for the top pair). */ + pat2 = alloc((unsigned)(STRLEN(spat) + STRLEN(epat) + 17)); + pat3 = alloc((unsigned)(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25)); + if (pat2 == NULL || pat3 == NULL) + goto theend; + sprintf((char *)pat2, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); + if (*mpat == NUL) + STRCPY(pat3, pat2); + else + sprintf((char *)pat3, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", + spat, epat, mpat); + if (flags & SP_START) + options |= SEARCH_START; + + if (skip != NULL) + { + /* Empty string means to not use the skip expression. */ + if (skip->v_type == VAR_STRING || skip->v_type == VAR_FUNC) + use_skip = skip->vval.v_string != NULL + && *skip->vval.v_string != NUL; + } + + save_cursor = curwin->w_cursor; + pos = curwin->w_cursor; + CLEAR_POS(&firstpos); + CLEAR_POS(&foundpos); + pat = pat3; + for (;;) + { + n = searchit(curwin, curbuf, &pos, dir, pat, 1L, + options, RE_SEARCH, lnum_stop, &tm, NULL); + if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos))) + /* didn't find it or found the first match again: FAIL */ + break; + + if (firstpos.lnum == 0) + firstpos = pos; + if (EQUAL_POS(pos, foundpos)) + { + /* Found the same position again. Can happen with a pattern that + * has "\zs" at the end and searching backwards. Advance one + * character and try again. */ + if (dir == BACKWARD) + decl(&pos); + else + incl(&pos); + } + foundpos = pos; + + /* clear the start flag to avoid getting stuck here */ + options &= ~SEARCH_START; + + /* If the skip pattern matches, ignore this match. */ + if (use_skip) + { + save_pos = curwin->w_cursor; + curwin->w_cursor = pos; + err = FALSE; + r = eval_expr_to_bool(skip, &err); + curwin->w_cursor = save_pos; + if (err) + { + /* Evaluating {skip} caused an error, break here. */ + curwin->w_cursor = save_cursor; + retval = -1; + break; + } + if (r) + continue; + } + + if ((dir == BACKWARD && n == 3) || (dir == FORWARD && n == 2)) + { + /* Found end when searching backwards or start when searching + * forward: nested pair. */ + ++nest; + pat = pat2; /* nested, don't search for middle */ + } + else + { + /* Found end when searching forward or start when searching + * backward: end of (nested) pair; or found middle in outer pair. */ + if (--nest == 1) + pat = pat3; /* outer level, search for middle */ + } + + if (nest == 0) + { + /* Found the match: return matchcount or line number. */ + if (flags & SP_RETCOUNT) + ++retval; + else + retval = pos.lnum; + if (flags & SP_SETPCMARK) + setpcmark(); + curwin->w_cursor = pos; + if (!(flags & SP_REPEAT)) + break; + nest = 1; /* search for next unmatched */ + } + } + + if (match_pos != NULL) + { + /* Store the match cursor position */ + match_pos->lnum = curwin->w_cursor.lnum; + match_pos->col = curwin->w_cursor.col + 1; + } + + /* If 'n' flag is used or search failed: restore cursor position. */ + if ((flags & SP_NOMOVE) || retval == 0) + curwin->w_cursor = save_cursor; + +theend: + vim_free(pat2); + vim_free(pat3); + if (p_cpo == empty_option) + p_cpo = save_cpo; + else + /* Darn, evaluating the {skip} expression changed the value. */ + free_string_option(save_cpo); + + return retval; +} + +/* + * "searchpos()" function + */ + static void +f_searchpos(typval_T *argvars, typval_T *rettv) +{ + pos_T match_pos; + int lnum = 0; + int col = 0; + int n; + int flags = 0; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + n = search_cmn(argvars, &match_pos, &flags); + if (n > 0) + { + lnum = match_pos.lnum; + col = match_pos.col; + } + + list_append_number(rettv->vval.v_list, (varnumber_T)lnum); + list_append_number(rettv->vval.v_list, (varnumber_T)col); + if (flags & SP_SUBPAT) + list_append_number(rettv->vval.v_list, (varnumber_T)n); +} + + static void +f_server2client(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_CLIENTSERVER + char_u buf[NUMBUFLEN]; + char_u *server = get_tv_string_chk(&argvars[0]); + char_u *reply = get_tv_string_buf_chk(&argvars[1], buf); + + rettv->vval.v_number = -1; + if (server == NULL || reply == NULL) + return; + if (check_restricted() || check_secure()) + return; +# ifdef FEAT_X11 + if (check_connection() == FAIL) + return; +# endif + + if (serverSendReply(server, reply) < 0) + { + EMSG(_("E258: Unable to send to client")); + return; + } + rettv->vval.v_number = 0; +#else + rettv->vval.v_number = -1; +#endif +} + + static void +f_serverlist(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u *r = NULL; + +#ifdef FEAT_CLIENTSERVER +# if defined(WIN32) || defined(MAC_CLIENTSERVER) + r = serverGetVimNames(); +# elif defined(FEAT_X11) + make_connection(); + if (X_DISPLAY != NULL) + r = serverGetVimNames(X_DISPLAY); +# endif +#endif + rettv->v_type = VAR_STRING; + rettv->vval.v_string = r; +} + +/* + * "setbufline()" function + */ + static void +f_setbufline(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + linenr_T lnum; + buf_T *buf; + + buf = get_buf_tv(&argvars[0], FALSE); + if (buf == NULL) + rettv->vval.v_number = 1; /* FAIL */ + else + { + lnum = get_tv_lnum_buf(&argvars[1], buf); + set_buffer_lines(buf, lnum, FALSE, &argvars[2], rettv); + } +} + +/* + * "setbufvar()" function + */ + static void +f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf; + char_u *varname, *bufvarname; + typval_T *varp; + char_u nbuf[NUMBUFLEN]; + + if (check_restricted() || check_secure()) + return; + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + varname = get_tv_string_chk(&argvars[1]); + buf = get_buf_tv(&argvars[0], FALSE); + varp = &argvars[2]; + + if (buf != NULL && varname != NULL && varp != NULL) + { + if (*varname == '&') + { + long numval; + char_u *strval; + int error = FALSE; + aco_save_T aco; + + /* set curbuf to be our buf, temporarily */ + aucmd_prepbuf(&aco, buf); + + ++varname; + numval = (long)get_tv_number_chk(varp, &error); + strval = get_tv_string_buf_chk(varp, nbuf); + if (!error && strval != NULL) + set_option_value(varname, numval, strval, OPT_LOCAL); + + /* reset notion of buffer */ + aucmd_restbuf(&aco); + } + else + { + buf_T *save_curbuf = curbuf; + + bufvarname = alloc((unsigned)STRLEN(varname) + 3); + if (bufvarname != NULL) + { + curbuf = buf; + STRCPY(bufvarname, "b:"); + STRCPY(bufvarname + 2, varname); + set_var(bufvarname, varp, TRUE); + vim_free(bufvarname); + curbuf = save_curbuf; + } + } + } +} + + static void +f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED) +{ + dict_T *d; + dictitem_T *di; + char_u *csearch; + + if (argvars[0].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + + if ((d = argvars[0].vval.v_dict) != NULL) + { + csearch = get_dict_string(d, (char_u *)"char", FALSE); + if (csearch != NULL) + { +#ifdef FEAT_MBYTE + if (enc_utf8) + { + int pcc[MAX_MCO]; + int c = utfc_ptr2char(csearch, pcc); + + set_last_csearch(c, csearch, utfc_ptr2len(csearch)); + } + else +#endif + set_last_csearch(PTR2CHAR(csearch), + csearch, MB_PTR2LEN(csearch)); + } + + di = dict_find(d, (char_u *)"forward", -1); + if (di != NULL) + set_csearch_direction((int)get_tv_number(&di->di_tv) + ? FORWARD : BACKWARD); + + di = dict_find(d, (char_u *)"until", -1); + if (di != NULL) + set_csearch_until(!!get_tv_number(&di->di_tv)); + } +} + +/* + * "setcmdpos()" function + */ + static void +f_setcmdpos(typval_T *argvars, typval_T *rettv) +{ + int pos = (int)get_tv_number(&argvars[0]) - 1; + + if (pos >= 0) + rettv->vval.v_number = set_cmdline_pos(pos); +} + +/* + * "setfperm({fname}, {mode})" function + */ + static void +f_setfperm(typval_T *argvars, typval_T *rettv) +{ + char_u *fname; + char_u modebuf[NUMBUFLEN]; + char_u *mode_str; + int i; + int mask; + int mode = 0; + + rettv->vval.v_number = 0; + fname = get_tv_string_chk(&argvars[0]); + if (fname == NULL) + return; + mode_str = get_tv_string_buf_chk(&argvars[1], modebuf); + if (mode_str == NULL) + return; + if (STRLEN(mode_str) != 9) + { + EMSG2(_(e_invarg2), mode_str); + return; + } + + mask = 1; + for (i = 8; i >= 0; --i) + { + if (mode_str[i] != '-') + mode |= mask; + mask = mask << 1; + } + rettv->vval.v_number = mch_setperm(fname, mode) == OK; +} + +/* + * "setline()" function + */ + static void +f_setline(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum = get_tv_lnum(&argvars[0]); + + set_buffer_lines(curbuf, lnum, FALSE, &argvars[1], rettv); +} + +static void set_qf_ll_list(win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *what_arg, typval_T *rettv); + +/* + * Used by "setqflist()" and "setloclist()" functions + */ + static void +set_qf_ll_list( + win_T *wp UNUSED, + typval_T *list_arg UNUSED, + typval_T *action_arg UNUSED, + typval_T *what_arg UNUSED, + typval_T *rettv) +{ +#ifdef FEAT_QUICKFIX + static char *e_invact = N_("E927: Invalid action: '%s'"); + char_u *act; + int action = 0; + static int recursive = 0; +#endif + + rettv->vval.v_number = -1; + +#ifdef FEAT_QUICKFIX + if (list_arg->v_type != VAR_LIST) + EMSG(_(e_listreq)); + else if (recursive != 0) + EMSG(_(e_au_recursive)); + else + { + list_T *l = list_arg->vval.v_list; + dict_T *d = NULL; + int valid_dict = TRUE; + + if (action_arg->v_type == VAR_STRING) + { + act = get_tv_string_chk(action_arg); + if (act == NULL) + return; /* type error; errmsg already given */ + if ((*act == 'a' || *act == 'r' || *act == ' ' || *act == 'f') && + act[1] == NUL) + action = *act; + else + EMSG2(_(e_invact), act); + } + else if (action_arg->v_type == VAR_UNKNOWN) + action = ' '; + else + EMSG(_(e_stringreq)); + + if (action_arg->v_type != VAR_UNKNOWN + && what_arg->v_type != VAR_UNKNOWN) + { + if (what_arg->v_type == VAR_DICT) + d = what_arg->vval.v_dict; + else + { + EMSG(_(e_dictreq)); + valid_dict = FALSE; + } + } + + ++recursive; + if (l != NULL && action && valid_dict && set_errorlist(wp, l, action, + (char_u *)(wp == NULL ? ":setqflist()" : ":setloclist()"), + d) == OK) + rettv->vval.v_number = 0; + --recursive; + } +#endif +} + +/* + * "setloclist()" function + */ + static void +f_setloclist(typval_T *argvars, typval_T *rettv) +{ + win_T *win; + + rettv->vval.v_number = -1; + + win = find_win_by_nr(&argvars[0], NULL); + if (win != NULL) + set_qf_ll_list(win, &argvars[1], &argvars[2], &argvars[3], rettv); +} + +/* + * "setmatches()" function + */ + static void +f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_SEARCH_EXTRA + list_T *l; + listitem_T *li; + dict_T *d; + list_T *s = NULL; + + rettv->vval.v_number = -1; + if (argvars[0].v_type != VAR_LIST) + { + EMSG(_(e_listreq)); + return; + } + if ((l = argvars[0].vval.v_list) != NULL) + { + + /* To some extent make sure that we are dealing with a list from + * "getmatches()". */ + li = l->lv_first; + while (li != NULL) + { + if (li->li_tv.v_type != VAR_DICT + || (d = li->li_tv.vval.v_dict) == NULL) + { + EMSG(_(e_invarg)); + return; + } + if (!(dict_find(d, (char_u *)"group", -1) != NULL + && (dict_find(d, (char_u *)"pattern", -1) != NULL + || dict_find(d, (char_u *)"pos1", -1) != NULL) + && dict_find(d, (char_u *)"priority", -1) != NULL + && dict_find(d, (char_u *)"id", -1) != NULL)) + { + EMSG(_(e_invarg)); + return; + } + li = li->li_next; + } + + clear_matches(curwin); + li = l->lv_first; + while (li != NULL) + { + int i = 0; + char_u buf[5]; + dictitem_T *di; + char_u *group; + int priority; + int id; + char_u *conceal; + + d = li->li_tv.vval.v_dict; + if (dict_find(d, (char_u *)"pattern", -1) == NULL) + { + if (s == NULL) + { + s = list_alloc(); + if (s == NULL) + return; + } + + /* match from matchaddpos() */ + for (i = 1; i < 9; i++) + { + sprintf((char *)buf, (char *)"pos%d", i); + if ((di = dict_find(d, (char_u *)buf, -1)) != NULL) + { + if (di->di_tv.v_type != VAR_LIST) + return; + + list_append_tv(s, &di->di_tv); + s->lv_refcount++; + } + else + break; + } + } + + group = get_dict_string(d, (char_u *)"group", TRUE); + priority = (int)get_dict_number(d, (char_u *)"priority"); + id = (int)get_dict_number(d, (char_u *)"id"); + conceal = dict_find(d, (char_u *)"conceal", -1) != NULL + ? get_dict_string(d, (char_u *)"conceal", TRUE) + : NULL; + if (i == 0) + { + match_add(curwin, group, + get_dict_string(d, (char_u *)"pattern", FALSE), + priority, id, NULL, conceal); + } + else + { + match_add(curwin, group, NULL, priority, id, s, conceal); + list_unref(s); + s = NULL; + } + vim_free(group); + vim_free(conceal); + + li = li->li_next; + } + rettv->vval.v_number = 0; + } +#endif +} + +/* + * "setpos()" function + */ + static void +f_setpos(typval_T *argvars, typval_T *rettv) +{ + pos_T pos; + int fnum; + char_u *name; + colnr_T curswant = -1; + + rettv->vval.v_number = -1; + name = get_tv_string_chk(argvars); + if (name != NULL) + { + if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) + { + if (--pos.col < 0) + pos.col = 0; + if (name[0] == '.' && name[1] == NUL) + { + /* set cursor; "fnum" is ignored */ + curwin->w_cursor = pos; + if (curswant >= 0) + { + curwin->w_curswant = curswant - 1; + curwin->w_set_curswant = FALSE; + } + check_cursor(); + rettv->vval.v_number = 0; + } + else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) + { + /* set mark */ + if (setmark_pos(name[1], &pos, fnum) == OK) + rettv->vval.v_number = 0; + } + else + EMSG(_(e_invarg)); + } + } +} + +/* + * "setqflist()" function + */ + static void +f_setqflist(typval_T *argvars, typval_T *rettv) +{ + set_qf_ll_list(NULL, &argvars[0], &argvars[1], &argvars[2], rettv); +} + +/* + * "setreg()" function + */ + static void +f_setreg(typval_T *argvars, typval_T *rettv) +{ + int regname; + char_u *strregname; + char_u *stropt; + char_u *strval; + int append; + char_u yank_type; + long block_len; + + block_len = -1; + yank_type = MAUTO; + append = FALSE; + + strregname = get_tv_string_chk(argvars); + rettv->vval.v_number = 1; /* FAIL is default */ + + if (strregname == NULL) + return; /* type error; errmsg already given */ + regname = *strregname; + if (regname == 0 || regname == '@') + regname = '"'; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + stropt = get_tv_string_chk(&argvars[2]); + if (stropt == NULL) + return; /* type error */ + for (; *stropt != NUL; ++stropt) + switch (*stropt) + { + case 'a': case 'A': /* append */ + append = TRUE; + break; + case 'v': case 'c': /* character-wise selection */ + yank_type = MCHAR; + break; + case 'V': case 'l': /* line-wise selection */ + yank_type = MLINE; + break; + case 'b': case Ctrl_V: /* block-wise selection */ + yank_type = MBLOCK; + if (VIM_ISDIGIT(stropt[1])) + { + ++stropt; + block_len = getdigits(&stropt) - 1; + --stropt; + } + break; + } + } + + if (argvars[1].v_type == VAR_LIST) + { + char_u **lstval; + char_u **allocval; + char_u buf[NUMBUFLEN]; + char_u **curval; + char_u **curallocval; + list_T *ll = argvars[1].vval.v_list; + listitem_T *li; + int len; + + /* If the list is NULL handle like an empty list. */ + len = ll == NULL ? 0 : ll->lv_len; + + /* First half: use for pointers to result lines; second half: use for + * pointers to allocated copies. */ + lstval = (char_u **)alloc(sizeof(char_u *) * ((len + 1) * 2)); + if (lstval == NULL) + return; + curval = lstval; + allocval = lstval + len + 2; + curallocval = allocval; + + for (li = ll == NULL ? NULL : ll->lv_first; li != NULL; + li = li->li_next) + { + strval = get_tv_string_buf_chk(&li->li_tv, buf); + if (strval == NULL) + goto free_lstval; + if (strval == buf) + { + /* Need to make a copy, next get_tv_string_buf_chk() will + * overwrite the string. */ + strval = vim_strsave(buf); + if (strval == NULL) + goto free_lstval; + *curallocval++ = strval; + } + *curval++ = strval; + } + *curval++ = NULL; + + write_reg_contents_lst(regname, lstval, -1, + append, yank_type, block_len); +free_lstval: + while (curallocval > allocval) + vim_free(*--curallocval); + vim_free(lstval); + } + else + { + strval = get_tv_string_chk(&argvars[1]); + if (strval == NULL) + return; + write_reg_contents_ex(regname, strval, -1, + append, yank_type, block_len); + } + rettv->vval.v_number = 0; +} + +/* + * "settabvar()" function + */ + static void +f_settabvar(typval_T *argvars, typval_T *rettv) +{ + tabpage_T *save_curtab; + tabpage_T *tp; + char_u *varname, *tabvarname; + typval_T *varp; + + rettv->vval.v_number = 0; + + if (check_restricted() || check_secure()) + return; + + tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + varname = get_tv_string_chk(&argvars[1]); + varp = &argvars[2]; + + if (varname != NULL && varp != NULL && tp != NULL) + { + save_curtab = curtab; + goto_tabpage_tp(tp, FALSE, FALSE); + + tabvarname = alloc((unsigned)STRLEN(varname) + 3); + if (tabvarname != NULL) + { + STRCPY(tabvarname, "t:"); + STRCPY(tabvarname + 2, varname); + set_var(tabvarname, varp, TRUE); + vim_free(tabvarname); + } + + /* Restore current tabpage */ + if (valid_tabpage(save_curtab)) + goto_tabpage_tp(save_curtab, FALSE, FALSE); + } +} + +/* + * "settabwinvar()" function + */ + static void +f_settabwinvar(typval_T *argvars, typval_T *rettv) +{ + setwinvar(argvars, rettv, 1); +} + +/* + * "setwinvar()" function + */ + static void +f_setwinvar(typval_T *argvars, typval_T *rettv) +{ + setwinvar(argvars, rettv, 0); +} + +#ifdef FEAT_CRYPT +/* + * "sha256({string})" function + */ + static void +f_sha256(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + + p = get_tv_string(&argvars[0]); + rettv->vval.v_string = vim_strsave( + sha256_bytes(p, (int)STRLEN(p), NULL, 0)); + rettv->v_type = VAR_STRING; +} +#endif /* FEAT_CRYPT */ + +/* + * "shellescape({string})" function + */ + static void +f_shellescape(typval_T *argvars, typval_T *rettv) +{ + int do_special = non_zero_arg(&argvars[1]); + + rettv->vval.v_string = vim_strsave_shellescape( + get_tv_string(&argvars[0]), do_special, do_special); + rettv->v_type = VAR_STRING; +} + +/* + * shiftwidth() function + */ + static void +f_shiftwidth(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->vval.v_number = get_sw_value(curbuf); +} + +/* + * "simplify()" function + */ + static void +f_simplify(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + + p = get_tv_string(&argvars[0]); + rettv->vval.v_string = vim_strsave(p); + simplify_filename(rettv->vval.v_string); /* simplify in place */ + rettv->v_type = VAR_STRING; +} + +#ifdef FEAT_FLOAT +/* + * "sin()" function + */ + static void +f_sin(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = sin(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "sinh()" function + */ + static void +f_sinh(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = sinh(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +static int +#ifdef __BORLANDC__ + _RTLENTRYF +#endif + item_compare(const void *s1, const void *s2); +static int +#ifdef __BORLANDC__ + _RTLENTRYF +#endif + item_compare2(const void *s1, const void *s2); + +/* struct used in the array that's given to qsort() */ +typedef struct +{ + listitem_T *item; + int idx; +} sortItem_T; + +/* struct storing information about current sort */ +typedef struct +{ + int item_compare_ic; + int item_compare_numeric; + int item_compare_numbers; +#ifdef FEAT_FLOAT + int item_compare_float; +#endif + char_u *item_compare_func; + partial_T *item_compare_partial; + dict_T *item_compare_selfdict; + int item_compare_func_err; + int item_compare_keep_zero; +} sortinfo_T; +static sortinfo_T *sortinfo = NULL; +static void do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort); +#define ITEM_COMPARE_FAIL 999 + +/* + * Compare functions for f_sort() and f_uniq() below. + */ + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +item_compare(const void *s1, const void *s2) +{ + sortItem_T *si1, *si2; + typval_T *tv1, *tv2; + char_u *p1, *p2; + char_u *tofree1 = NULL, *tofree2 = NULL; + int res; + char_u numbuf1[NUMBUFLEN]; + char_u numbuf2[NUMBUFLEN]; + + si1 = (sortItem_T *)s1; + si2 = (sortItem_T *)s2; + tv1 = &si1->item->li_tv; + tv2 = &si2->item->li_tv; + + if (sortinfo->item_compare_numbers) + { + varnumber_T v1 = get_tv_number(tv1); + varnumber_T v2 = get_tv_number(tv2); + + return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; + } + +#ifdef FEAT_FLOAT + if (sortinfo->item_compare_float) + { + float_T v1 = get_tv_float(tv1); + float_T v2 = get_tv_float(tv2); + + return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; + } +#endif + + /* tv2string() puts quotes around a string and allocates memory. Don't do + * that for string variables. Use a single quote when comparing with a + * non-string to do what the docs promise. */ + if (tv1->v_type == VAR_STRING) + { + if (tv2->v_type != VAR_STRING || sortinfo->item_compare_numeric) + p1 = (char_u *)"'"; + else + p1 = tv1->vval.v_string; + } + else + p1 = tv2string(tv1, &tofree1, numbuf1, 0); + if (tv2->v_type == VAR_STRING) + { + if (tv1->v_type != VAR_STRING || sortinfo->item_compare_numeric) + p2 = (char_u *)"'"; + else + p2 = tv2->vval.v_string; + } + else + p2 = tv2string(tv2, &tofree2, numbuf2, 0); + if (p1 == NULL) + p1 = (char_u *)""; + if (p2 == NULL) + p2 = (char_u *)""; + if (!sortinfo->item_compare_numeric) + { + if (sortinfo->item_compare_ic) + res = STRICMP(p1, p2); + else + res = STRCMP(p1, p2); + } + else + { + double n1, n2; + n1 = strtod((char *)p1, (char **)&p1); + n2 = strtod((char *)p2, (char **)&p2); + res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1; + } + + /* When the result would be zero, compare the item indexes. Makes the + * sort stable. */ + if (res == 0 && !sortinfo->item_compare_keep_zero) + res = si1->idx > si2->idx ? 1 : -1; + + vim_free(tofree1); + vim_free(tofree2); + return res; +} + + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +item_compare2(const void *s1, const void *s2) +{ + sortItem_T *si1, *si2; + int res; + typval_T rettv; + typval_T argv[3]; + int dummy; + char_u *func_name; + partial_T *partial = sortinfo->item_compare_partial; + + /* shortcut after failure in previous call; compare all items equal */ + if (sortinfo->item_compare_func_err) + return 0; + + si1 = (sortItem_T *)s1; + si2 = (sortItem_T *)s2; + + if (partial == NULL) + func_name = sortinfo->item_compare_func; + else + func_name = partial_name(partial); + + /* Copy the values. This is needed to be able to set v_lock to VAR_FIXED + * in the copy without changing the original list items. */ + copy_tv(&si1->item->li_tv, &argv[0]); + copy_tv(&si2->item->li_tv, &argv[1]); + + rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ + res = call_func(func_name, (int)STRLEN(func_name), + &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, + partial, sortinfo->item_compare_selfdict); + clear_tv(&argv[0]); + clear_tv(&argv[1]); + + if (res == FAIL) + res = ITEM_COMPARE_FAIL; + else + res = (int)get_tv_number_chk(&rettv, &sortinfo->item_compare_func_err); + if (sortinfo->item_compare_func_err) + res = ITEM_COMPARE_FAIL; /* return value has wrong type */ + clear_tv(&rettv); + + /* When the result would be zero, compare the pointers themselves. Makes + * the sort stable. */ + if (res == 0 && !sortinfo->item_compare_keep_zero) + res = si1->idx > si2->idx ? 1 : -1; + + return res; +} + +/* + * "sort({list})" function + */ + static void +do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort) +{ + list_T *l; + listitem_T *li; + sortItem_T *ptrs; + sortinfo_T *old_sortinfo; + sortinfo_T info; + long len; + long i; + + /* Pointer to current info struct used in compare function. Save and + * restore the current one for nested calls. */ + old_sortinfo = sortinfo; + sortinfo = &info; + + if (argvars[0].v_type != VAR_LIST) + EMSG2(_(e_listarg), sort ? "sort()" : "uniq()"); + else + { + l = argvars[0].vval.v_list; + if (l == NULL || tv_check_lock(l->lv_lock, + (char_u *)(sort ? N_("sort() argument") : N_("uniq() argument")), + TRUE)) + goto theend; + rettv_list_set(rettv, l); + + len = list_len(l); + if (len <= 1) + goto theend; /* short list sorts pretty quickly */ + + info.item_compare_ic = FALSE; + info.item_compare_numeric = FALSE; + info.item_compare_numbers = FALSE; +#ifdef FEAT_FLOAT + info.item_compare_float = FALSE; +#endif + info.item_compare_func = NULL; + info.item_compare_partial = NULL; + info.item_compare_selfdict = NULL; + if (argvars[1].v_type != VAR_UNKNOWN) + { + /* optional second argument: {func} */ + if (argvars[1].v_type == VAR_FUNC) + info.item_compare_func = argvars[1].vval.v_string; + else if (argvars[1].v_type == VAR_PARTIAL) + info.item_compare_partial = argvars[1].vval.v_partial; + else + { + int error = FALSE; + + i = (long)get_tv_number_chk(&argvars[1], &error); + if (error) + goto theend; /* type error; errmsg already given */ + if (i == 1) + info.item_compare_ic = TRUE; + else if (argvars[1].v_type != VAR_NUMBER) + info.item_compare_func = get_tv_string(&argvars[1]); + else if (i != 0) + { + EMSG(_(e_invarg)); + goto theend; + } + if (info.item_compare_func != NULL) + { + if (*info.item_compare_func == NUL) + { + /* empty string means default sort */ + info.item_compare_func = NULL; + } + else if (STRCMP(info.item_compare_func, "n") == 0) + { + info.item_compare_func = NULL; + info.item_compare_numeric = TRUE; + } + else if (STRCMP(info.item_compare_func, "N") == 0) + { + info.item_compare_func = NULL; + info.item_compare_numbers = TRUE; + } +#ifdef FEAT_FLOAT + else if (STRCMP(info.item_compare_func, "f") == 0) + { + info.item_compare_func = NULL; + info.item_compare_float = TRUE; + } +#endif + else if (STRCMP(info.item_compare_func, "i") == 0) + { + info.item_compare_func = NULL; + info.item_compare_ic = TRUE; + } + } + } + + if (argvars[2].v_type != VAR_UNKNOWN) + { + /* optional third argument: {dict} */ + if (argvars[2].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + goto theend; + } + info.item_compare_selfdict = argvars[2].vval.v_dict; + } + } + + /* Make an array with each entry pointing to an item in the List. */ + ptrs = (sortItem_T *)alloc((int)(len * sizeof(sortItem_T))); + if (ptrs == NULL) + goto theend; + + i = 0; + if (sort) + { + /* sort(): ptrs will be the list to sort */ + for (li = l->lv_first; li != NULL; li = li->li_next) + { + ptrs[i].item = li; + ptrs[i].idx = i; + ++i; + } + + info.item_compare_func_err = FALSE; + info.item_compare_keep_zero = FALSE; + /* test the compare function */ + if ((info.item_compare_func != NULL + || info.item_compare_partial != NULL) + && item_compare2((void *)&ptrs[0], (void *)&ptrs[1]) + == ITEM_COMPARE_FAIL) + EMSG(_("E702: Sort compare function failed")); + else + { + /* Sort the array with item pointers. */ + qsort((void *)ptrs, (size_t)len, sizeof(sortItem_T), + info.item_compare_func == NULL + && info.item_compare_partial == NULL + ? item_compare : item_compare2); + + if (!info.item_compare_func_err) + { + /* Clear the List and append the items in sorted order. */ + l->lv_first = l->lv_last = l->lv_idx_item = NULL; + l->lv_len = 0; + for (i = 0; i < len; ++i) + list_append(l, ptrs[i].item); + } + } + } + else + { + int (*item_compare_func_ptr)(const void *, const void *); + + /* f_uniq(): ptrs will be a stack of items to remove */ + info.item_compare_func_err = FALSE; + info.item_compare_keep_zero = TRUE; + item_compare_func_ptr = info.item_compare_func != NULL + || info.item_compare_partial != NULL + ? item_compare2 : item_compare; + + for (li = l->lv_first; li != NULL && li->li_next != NULL; + li = li->li_next) + { + if (item_compare_func_ptr((void *)&li, (void *)&li->li_next) + == 0) + ptrs[i++].item = li; + if (info.item_compare_func_err) + { + EMSG(_("E882: Uniq compare function failed")); + break; + } + } + + if (!info.item_compare_func_err) + { + while (--i >= 0) + { + li = ptrs[i].item->li_next; + ptrs[i].item->li_next = li->li_next; + if (li->li_next != NULL) + li->li_next->li_prev = ptrs[i].item; + else + l->lv_last = ptrs[i].item; + list_fix_watch(l, li); + listitem_free(li); + l->lv_len--; + } + } + } + + vim_free(ptrs); + } +theend: + sortinfo = old_sortinfo; +} + +/* + * "sort({list})" function + */ + static void +f_sort(typval_T *argvars, typval_T *rettv) +{ + do_sort_uniq(argvars, rettv, TRUE); +} + +/* + * "uniq({list})" function + */ + static void +f_uniq(typval_T *argvars, typval_T *rettv) +{ + do_sort_uniq(argvars, rettv, FALSE); +} + +/* + * "soundfold({word})" function + */ + static void +f_soundfold(typval_T *argvars, typval_T *rettv) +{ + char_u *s; + + rettv->v_type = VAR_STRING; + s = get_tv_string(&argvars[0]); +#ifdef FEAT_SPELL + rettv->vval.v_string = eval_soundfold(s); +#else + rettv->vval.v_string = vim_strsave(s); +#endif +} + +/* + * "spellbadword()" function + */ + static void +f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u *word = (char_u *)""; + hlf_T attr = HLF_COUNT; + int len = 0; + + if (rettv_list_alloc(rettv) == FAIL) + return; + +#ifdef FEAT_SPELL + if (argvars[0].v_type == VAR_UNKNOWN) + { + /* Find the start and length of the badly spelled word. */ + len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr); + if (len != 0) + { + word = ml_get_cursor(); + curwin->w_set_curswant = TRUE; + } + } + else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) + { + char_u *str = get_tv_string_chk(&argvars[0]); + int capcol = -1; + + if (str != NULL) + { + /* Check the argument for spelling. */ + while (*str != NUL) + { + len = spell_check(curwin, str, &attr, &capcol, FALSE); + if (attr != HLF_COUNT) + { + word = str; + break; + } + str += len; + } + } + } +#endif + + list_append_string(rettv->vval.v_list, word, len); + list_append_string(rettv->vval.v_list, (char_u *)( + attr == HLF_SPB ? "bad" : + attr == HLF_SPR ? "rare" : + attr == HLF_SPL ? "local" : + attr == HLF_SPC ? "caps" : + ""), -1); +} + +/* + * "spellsuggest()" function + */ + static void +f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_SPELL + char_u *str; + int typeerr = FALSE; + int maxcount; + garray_T ga; + int i; + listitem_T *li; + int need_capital = FALSE; +#endif + + if (rettv_list_alloc(rettv) == FAIL) + return; + +#ifdef FEAT_SPELL + if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) + { + str = get_tv_string(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN) + { + maxcount = (int)get_tv_number_chk(&argvars[1], &typeerr); + if (maxcount <= 0) + return; + if (argvars[2].v_type != VAR_UNKNOWN) + { + need_capital = (int)get_tv_number_chk(&argvars[2], &typeerr); + if (typeerr) + return; + } + } + else + maxcount = 25; + + spell_suggest_list(&ga, str, maxcount, need_capital, FALSE); + + for (i = 0; i < ga.ga_len; ++i) + { + str = ((char_u **)ga.ga_data)[i]; + + li = listitem_alloc(); + if (li == NULL) + vim_free(str); + else + { + li->li_tv.v_type = VAR_STRING; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_string = str; + list_append(rettv->vval.v_list, li); + } + } + ga_clear(&ga); + } +#endif +} + + static void +f_split(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + char_u *end; + char_u *pat = NULL; + regmatch_T regmatch; + char_u patbuf[NUMBUFLEN]; + char_u *save_cpo; + int match; + colnr_T col = 0; + int keepempty = FALSE; + int typeerr = FALSE; + + /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + save_cpo = p_cpo; + p_cpo = (char_u *)""; + + str = get_tv_string(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN) + { + pat = get_tv_string_buf_chk(&argvars[1], patbuf); + if (pat == NULL) + typeerr = TRUE; + if (argvars[2].v_type != VAR_UNKNOWN) + keepempty = (int)get_tv_number_chk(&argvars[2], &typeerr); + } + if (pat == NULL || *pat == NUL) + pat = (char_u *)"[\\x01- ]\\+"; + + if (rettv_list_alloc(rettv) == FAIL) + return; + if (typeerr) + return; + + regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + if (regmatch.regprog != NULL) + { + regmatch.rm_ic = FALSE; + while (*str != NUL || keepempty) + { + if (*str == NUL) + match = FALSE; /* empty item at the end */ + else + match = vim_regexec_nl(®match, str, col); + if (match) + end = regmatch.startp[0]; + else + end = str + STRLEN(str); + if (keepempty || end > str || (rettv->vval.v_list->lv_len > 0 + && *str != NUL && match && end < regmatch.endp[0])) + { + if (list_append_string(rettv->vval.v_list, str, + (int)(end - str)) == FAIL) + break; + } + if (!match) + break; + /* Advance to just after the match. */ + if (regmatch.endp[0] > str) + col = 0; + else + { + /* Don't get stuck at the same match. */ +#ifdef FEAT_MBYTE + col = (*mb_ptr2len)(regmatch.endp[0]); +#else + col = 1; +#endif + } + str = regmatch.endp[0]; + } + + vim_regfree(regmatch.regprog); + } + + p_cpo = save_cpo; +} + +#ifdef FEAT_FLOAT +/* + * "sqrt()" function + */ + static void +f_sqrt(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = sqrt(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "str2float()" function + */ + static void +f_str2float(typval_T *argvars, typval_T *rettv) +{ + char_u *p = skipwhite(get_tv_string(&argvars[0])); + int isneg = (*p == '-'); + + if (*p == '+' || *p == '-') + p = skipwhite(p + 1); + (void)string2float(p, &rettv->vval.v_float); + if (isneg) + rettv->vval.v_float *= -1; + rettv->v_type = VAR_FLOAT; +} +#endif + +/* + * "str2nr()" function + */ + static void +f_str2nr(typval_T *argvars, typval_T *rettv) +{ + int base = 10; + char_u *p; + varnumber_T n; + int what; + int isneg; + + if (argvars[1].v_type != VAR_UNKNOWN) + { + base = (int)get_tv_number(&argvars[1]); + if (base != 2 && base != 8 && base != 10 && base != 16) + { + EMSG(_(e_invarg)); + return; + } + } + + p = skipwhite(get_tv_string(&argvars[0])); + isneg = (*p == '-'); + if (*p == '+' || *p == '-') + p = skipwhite(p + 1); + switch (base) + { + case 2: what = STR2NR_BIN + STR2NR_FORCE; break; + case 8: what = STR2NR_OCT + STR2NR_FORCE; break; + case 16: what = STR2NR_HEX + STR2NR_FORCE; break; + default: what = 0; + } + vim_str2nr(p, NULL, NULL, what, &n, NULL, 0); + if (isneg) + rettv->vval.v_number = -n; + else + rettv->vval.v_number = n; + +} + +#ifdef HAVE_STRFTIME +/* + * "strftime({format}[, {time}])" function + */ + static void +f_strftime(typval_T *argvars, typval_T *rettv) +{ + char_u result_buf[256]; + struct tm *curtime; + time_t seconds; + char_u *p; + + rettv->v_type = VAR_STRING; + + p = get_tv_string(&argvars[0]); + if (argvars[1].v_type == VAR_UNKNOWN) + seconds = time(NULL); + else + seconds = (time_t)get_tv_number(&argvars[1]); + curtime = localtime(&seconds); + /* MSVC returns NULL for an invalid value of seconds. */ + if (curtime == NULL) + rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)")); + else + { +# ifdef FEAT_MBYTE + vimconv_T conv; + char_u *enc; + + conv.vc_type = CONV_NONE; + enc = enc_locale(); + convert_setup(&conv, p_enc, enc); + if (conv.vc_type != CONV_NONE) + p = string_convert(&conv, p, NULL); +# endif + if (p != NULL) + (void)strftime((char *)result_buf, sizeof(result_buf), + (char *)p, curtime); + else + result_buf[0] = NUL; + +# ifdef FEAT_MBYTE + if (conv.vc_type != CONV_NONE) + vim_free(p); + convert_setup(&conv, enc, p_enc); + if (conv.vc_type != CONV_NONE) + rettv->vval.v_string = string_convert(&conv, result_buf, NULL); + else +# endif + rettv->vval.v_string = vim_strsave(result_buf); + +# ifdef FEAT_MBYTE + /* Release conversion descriptors */ + convert_setup(&conv, NULL, NULL); + vim_free(enc); +# endif + } +} +#endif + +/* + * "strgetchar()" function + */ + static void +f_strgetchar(typval_T *argvars, typval_T *rettv) +{ + char_u *str; + int len; + int error = FALSE; + int charidx; + + rettv->vval.v_number = -1; + str = get_tv_string_chk(&argvars[0]); + if (str == NULL) + return; + len = (int)STRLEN(str); + charidx = (int)get_tv_number_chk(&argvars[1], &error); + if (error) + return; +#ifdef FEAT_MBYTE + { + int byteidx = 0; + + while (charidx >= 0 && byteidx < len) + { + if (charidx == 0) + { + rettv->vval.v_number = mb_ptr2char(str + byteidx); + break; + } + --charidx; + byteidx += MB_CPTR2LEN(str + byteidx); + } + } +#else + if (charidx < len) + rettv->vval.v_number = str[charidx]; +#endif +} + +/* + * "stridx()" function + */ + static void +f_stridx(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + char_u *needle; + char_u *haystack; + char_u *save_haystack; + char_u *pos; + int start_idx; + + needle = get_tv_string_chk(&argvars[1]); + save_haystack = haystack = get_tv_string_buf_chk(&argvars[0], buf); + rettv->vval.v_number = -1; + if (needle == NULL || haystack == NULL) + return; /* type error; errmsg already given */ + + if (argvars[2].v_type != VAR_UNKNOWN) + { + int error = FALSE; + + start_idx = (int)get_tv_number_chk(&argvars[2], &error); + if (error || start_idx >= (int)STRLEN(haystack)) + return; + if (start_idx >= 0) + haystack += start_idx; + } + + pos = (char_u *)strstr((char *)haystack, (char *)needle); + if (pos != NULL) + rettv->vval.v_number = (varnumber_T)(pos - save_haystack); +} + +/* + * "string()" function + */ + static void +f_string(typval_T *argvars, typval_T *rettv) +{ + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, + get_copyID()); + /* Make a copy if we have a value but it's not in allocated memory. */ + if (rettv->vval.v_string != NULL && tofree == NULL) + rettv->vval.v_string = vim_strsave(rettv->vval.v_string); +} + +/* + * "strlen()" function + */ + static void +f_strlen(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = (varnumber_T)(STRLEN( + get_tv_string(&argvars[0]))); +} + +/* + * "strchars()" function + */ + static void +f_strchars(typval_T *argvars, typval_T *rettv) +{ + char_u *s = get_tv_string(&argvars[0]); + int skipcc = 0; +#ifdef FEAT_MBYTE + varnumber_T len = 0; + int (*func_mb_ptr2char_adv)(char_u **pp); +#endif + + if (argvars[1].v_type != VAR_UNKNOWN) + skipcc = (int)get_tv_number_chk(&argvars[1], NULL); + if (skipcc < 0 || skipcc > 1) + EMSG(_(e_invarg)); + else + { +#ifdef FEAT_MBYTE + func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv; + while (*s != NUL) + { + func_mb_ptr2char_adv(&s); + ++len; + } + rettv->vval.v_number = len; +#else + rettv->vval.v_number = (varnumber_T)(STRLEN(s)); +#endif + } +} + +/* + * "strdisplaywidth()" function + */ + static void +f_strdisplaywidth(typval_T *argvars, typval_T *rettv) +{ + char_u *s = get_tv_string(&argvars[0]); + int col = 0; + + if (argvars[1].v_type != VAR_UNKNOWN) + col = (int)get_tv_number(&argvars[1]); + + rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); +} + +/* + * "strwidth()" function + */ + static void +f_strwidth(typval_T *argvars, typval_T *rettv) +{ + char_u *s = get_tv_string(&argvars[0]); + + rettv->vval.v_number = (varnumber_T)( +#ifdef FEAT_MBYTE + mb_string2cells(s, -1) +#else + STRLEN(s) +#endif + ); +} + +/* + * "strcharpart()" function + */ + static void +f_strcharpart(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_MBYTE + char_u *p; + int nchar; + int nbyte = 0; + int charlen; + int len = 0; + int slen; + int error = FALSE; + + p = get_tv_string(&argvars[0]); + slen = (int)STRLEN(p); + + nchar = (int)get_tv_number_chk(&argvars[1], &error); + if (!error) + { + if (nchar > 0) + while (nchar > 0 && nbyte < slen) + { + nbyte += MB_CPTR2LEN(p + nbyte); + --nchar; + } + else + nbyte = nchar; + if (argvars[2].v_type != VAR_UNKNOWN) + { + charlen = (int)get_tv_number(&argvars[2]); + while (charlen > 0 && nbyte + len < slen) + { + int off = nbyte + len; + + if (off < 0) + len += 1; + else + len += MB_CPTR2LEN(p + off); + --charlen; + } + } + else + len = slen - nbyte; /* default: all bytes that are available. */ + } + + /* + * Only return the overlap between the specified part and the actual + * string. + */ + if (nbyte < 0) + { + len += nbyte; + nbyte = 0; + } + else if (nbyte > slen) + nbyte = slen; + if (len < 0) + len = 0; + else if (nbyte + len > slen) + len = slen - nbyte; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strnsave(p + nbyte, len); +#else + f_strpart(argvars, rettv); +#endif +} + +/* + * "strpart()" function + */ + static void +f_strpart(typval_T *argvars, typval_T *rettv) +{ + char_u *p; + int n; + int len; + int slen; + int error = FALSE; + + p = get_tv_string(&argvars[0]); + slen = (int)STRLEN(p); + + n = (int)get_tv_number_chk(&argvars[1], &error); + if (error) + len = 0; + else if (argvars[2].v_type != VAR_UNKNOWN) + len = (int)get_tv_number(&argvars[2]); + else + len = slen - n; /* default len: all bytes that are available. */ + + /* + * Only return the overlap between the specified part and the actual + * string. + */ + if (n < 0) + { + len += n; + n = 0; + } + else if (n > slen) + n = slen; + if (len < 0) + len = 0; + else if (n + len > slen) + len = slen - n; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strnsave(p + n, len); +} + +/* + * "strridx()" function + */ + static void +f_strridx(typval_T *argvars, typval_T *rettv) +{ + char_u buf[NUMBUFLEN]; + char_u *needle; + char_u *haystack; + char_u *rest; + char_u *lastmatch = NULL; + int haystack_len, end_idx; + + needle = get_tv_string_chk(&argvars[1]); + haystack = get_tv_string_buf_chk(&argvars[0], buf); + + rettv->vval.v_number = -1; + if (needle == NULL || haystack == NULL) + return; /* type error; errmsg already given */ + + haystack_len = (int)STRLEN(haystack); + if (argvars[2].v_type != VAR_UNKNOWN) + { + /* Third argument: upper limit for index */ + end_idx = (int)get_tv_number_chk(&argvars[2], NULL); + if (end_idx < 0) + return; /* can never find a match */ + } + else + end_idx = haystack_len; + + if (*needle == NUL) + { + /* Empty string matches past the end. */ + lastmatch = haystack + end_idx; + } + else + { + for (rest = haystack; *rest != '\0'; ++rest) + { + rest = (char_u *)strstr((char *)rest, (char *)needle); + if (rest == NULL || rest > haystack + end_idx) + break; + lastmatch = rest; + } + } + + if (lastmatch == NULL) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = (varnumber_T)(lastmatch - haystack); +} + +/* + * "strtrans()" function + */ + static void +f_strtrans(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = transstr(get_tv_string(&argvars[0])); +} + +/* + * "submatch()" function + */ + static void +f_submatch(typval_T *argvars, typval_T *rettv) +{ + int error = FALSE; + int no; + int retList = 0; + + no = (int)get_tv_number_chk(&argvars[0], &error); + if (error) + return; + if (no < 0 || no >= NSUBEXP) + { + EMSGN(_("E935: invalid submatch number: %d"), no); + return; + } + if (argvars[1].v_type != VAR_UNKNOWN) + retList = (int)get_tv_number_chk(&argvars[1], &error); + if (error) + return; + + if (retList == 0) + { + rettv->v_type = VAR_STRING; + rettv->vval.v_string = reg_submatch(no); + } + else + { + rettv->v_type = VAR_LIST; + rettv->vval.v_list = reg_submatch_list(no); + } +} + +/* + * "substitute()" function + */ + static void +f_substitute(typval_T *argvars, typval_T *rettv) +{ + char_u patbuf[NUMBUFLEN]; + char_u subbuf[NUMBUFLEN]; + char_u flagsbuf[NUMBUFLEN]; + + char_u *str = get_tv_string_chk(&argvars[0]); + char_u *pat = get_tv_string_buf_chk(&argvars[1], patbuf); + char_u *sub = NULL; + typval_T *expr = NULL; + char_u *flg = get_tv_string_buf_chk(&argvars[3], flagsbuf); + + if (argvars[2].v_type == VAR_FUNC || argvars[2].v_type == VAR_PARTIAL) + expr = &argvars[2]; + else + sub = get_tv_string_buf_chk(&argvars[2], subbuf); + + rettv->v_type = VAR_STRING; + if (str == NULL || pat == NULL || (sub == NULL && expr == NULL) + || flg == NULL) + rettv->vval.v_string = NULL; + else + rettv->vval.v_string = do_string_sub(str, pat, sub, expr, flg); +} + +/* + * "synID(lnum, col, trans)" function + */ + static void +f_synID(typval_T *argvars UNUSED, typval_T *rettv) +{ + int id = 0; +#ifdef FEAT_SYN_HL + linenr_T lnum; + colnr_T col; + int trans; + int transerr = FALSE; + + lnum = get_tv_lnum(argvars); /* -1 on type error */ + col = (linenr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ + trans = (int)get_tv_number_chk(&argvars[2], &transerr); + + if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count + && col >= 0 && col < (long)STRLEN(ml_get(lnum))) + id = syn_get_id(curwin, lnum, (colnr_T)col, trans, NULL, FALSE); +#endif + + rettv->vval.v_number = id; +} + +/* + * "synIDattr(id, what [, mode])" function + */ + static void +f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u *p = NULL; +#ifdef FEAT_SYN_HL + int id; + char_u *what; + char_u *mode; + char_u modebuf[NUMBUFLEN]; + int modec; + + id = (int)get_tv_number(&argvars[0]); + what = get_tv_string(&argvars[1]); + if (argvars[2].v_type != VAR_UNKNOWN) + { + mode = get_tv_string_buf(&argvars[2], modebuf); + modec = TOLOWER_ASC(mode[0]); + if (modec != 't' && modec != 'c' && modec != 'g') + modec = 0; /* replace invalid with current */ + } + else + { +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (USE_24BIT) + modec = 'g'; + else +#endif + if (t_colors > 1) + modec = 'c'; + else + modec = 't'; + } + + + switch (TOLOWER_ASC(what[0])) + { + case 'b': + if (TOLOWER_ASC(what[1]) == 'g') /* bg[#] */ + p = highlight_color(id, what, modec); + else /* bold */ + p = highlight_has_attr(id, HL_BOLD, modec); + break; + + case 'f': /* fg[#] or font */ + p = highlight_color(id, what, modec); + break; + + case 'i': + if (TOLOWER_ASC(what[1]) == 'n') /* inverse */ + p = highlight_has_attr(id, HL_INVERSE, modec); + else /* italic */ + p = highlight_has_attr(id, HL_ITALIC, modec); + break; + + case 'n': /* name */ + p = get_highlight_name_ext(NULL, id - 1, FALSE); + break; + + case 'r': /* reverse */ + p = highlight_has_attr(id, HL_INVERSE, modec); + break; + + case 's': + if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ + p = highlight_color(id, what, modec); + /* strikeout */ + else if (TOLOWER_ASC(what[1]) == 't' && + TOLOWER_ASC(what[2]) == 'r') + p = highlight_has_attr(id, HL_STRIKETHROUGH, modec); + else /* standout */ + p = highlight_has_attr(id, HL_STANDOUT, modec); + break; + + case 'u': + if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c') + /* underline */ + p = highlight_has_attr(id, HL_UNDERLINE, modec); + else + /* undercurl */ + p = highlight_has_attr(id, HL_UNDERCURL, modec); + break; + } + + if (p != NULL) + p = vim_strsave(p); +#endif + rettv->v_type = VAR_STRING; + rettv->vval.v_string = p; +} + +/* + * "synIDtrans(id)" function + */ + static void +f_synIDtrans(typval_T *argvars UNUSED, typval_T *rettv) +{ + int id; + +#ifdef FEAT_SYN_HL + id = (int)get_tv_number(&argvars[0]); + + if (id > 0) + id = syn_get_final_id(id); + else +#endif + id = 0; + + rettv->vval.v_number = id; +} + +/* + * "synconcealed(lnum, col)" function + */ + static void +f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) +{ +#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) + linenr_T lnum; + colnr_T col; + int syntax_flags = 0; + int cchar; + int matchid = 0; + char_u str[NUMBUFLEN]; +#endif + + rettv_list_set(rettv, NULL); + +#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) + lnum = get_tv_lnum(argvars); /* -1 on type error */ + col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ + + vim_memset(str, NUL, sizeof(str)); + + if (rettv_list_alloc(rettv) != FAIL) + { + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count + && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) + && curwin->w_p_cole > 0) + { + (void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE); + syntax_flags = get_syntax_info(&matchid); + + /* get the conceal character */ + if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) + { + cchar = syn_get_sub_char(); + if (cchar == NUL && curwin->w_p_cole == 1) + cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal; + if (cchar != NUL) + { +# ifdef FEAT_MBYTE + if (has_mbyte) + (*mb_char2bytes)(cchar, str); + else +# endif + str[0] = cchar; + } + } + } + + list_append_number(rettv->vval.v_list, + (syntax_flags & HL_CONCEAL) != 0); + /* -1 to auto-determine strlen */ + list_append_string(rettv->vval.v_list, str, -1); + list_append_number(rettv->vval.v_list, matchid); + } +#endif +} + +/* + * "synstack(lnum, col)" function + */ + static void +f_synstack(typval_T *argvars UNUSED, typval_T *rettv) +{ +#ifdef FEAT_SYN_HL + linenr_T lnum; + colnr_T col; + int i; + int id; +#endif + + rettv_list_set(rettv, NULL); + +#ifdef FEAT_SYN_HL + lnum = get_tv_lnum(argvars); /* -1 on type error */ + col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ + + if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count + && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) + && rettv_list_alloc(rettv) != FAIL) + { + (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); + for (i = 0; ; ++i) + { + id = syn_get_stack_item(i); + if (id < 0) + break; + if (list_append_number(rettv->vval.v_list, id) == FAIL) + break; + } + } +#endif +} + + static void +get_cmd_output_as_rettv( + typval_T *argvars, + typval_T *rettv, + int retlist) +{ + char_u *res = NULL; + char_u *p; + char_u *infile = NULL; + int err = FALSE; + FILE *fd; + list_T *list = NULL; + int flags = SHELL_SILENT; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + if (check_restricted() || check_secure()) + goto errret; + + if (argvars[1].v_type != VAR_UNKNOWN) + { + /* + * Write the text to a temp file, to be used for input of the shell + * command. + */ + if ((infile = vim_tempname('i', TRUE)) == NULL) + { + EMSG(_(e_notmp)); + goto errret; + } + + fd = mch_fopen((char *)infile, WRITEBIN); + if (fd == NULL) + { + EMSG2(_(e_notopen), infile); + goto errret; + } + if (argvars[1].v_type == VAR_NUMBER) + { + linenr_T lnum; + buf_T *buf; + + buf = buflist_findnr(argvars[1].vval.v_number); + if (buf == NULL) + { + EMSGN(_(e_nobufnr), argvars[1].vval.v_number); + fclose(fd); + goto errret; + } + + for (lnum = 1; lnum <= buf->b_ml.ml_line_count; lnum++) + { + for (p = ml_get_buf(buf, lnum, FALSE); *p != NUL; ++p) + if (putc(*p == '\n' ? NUL : *p, fd) == EOF) + { + err = TRUE; + break; + } + if (putc(NL, fd) == EOF) + { + err = TRUE; + break; + } + } + } + else if (argvars[1].v_type == VAR_LIST) + { + if (write_list(fd, argvars[1].vval.v_list, TRUE) == FAIL) + err = TRUE; + } + else + { + size_t len; + char_u buf[NUMBUFLEN]; + + p = get_tv_string_buf_chk(&argvars[1], buf); + if (p == NULL) + { + fclose(fd); + goto errret; /* type error; errmsg already given */ + } + len = STRLEN(p); + if (len > 0 && fwrite(p, len, 1, fd) != 1) + err = TRUE; + } + if (fclose(fd) != 0) + err = TRUE; + if (err) + { + EMSG(_("E677: Error writing temp file")); + goto errret; + } + } + + /* Omit SHELL_COOKED when invoked with ":silent". Avoids that the shell + * echoes typeahead, that messes up the display. */ + if (!msg_silent) + flags += SHELL_COOKED; + + if (retlist) + { + int len; + listitem_T *li; + char_u *s = NULL; + char_u *start; + char_u *end; + int i; + + res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, &len); + if (res == NULL) + goto errret; + + list = list_alloc(); + if (list == NULL) + goto errret; + + for (i = 0; i < len; ++i) + { + start = res + i; + while (i < len && res[i] != NL) + ++i; + end = res + i; + + s = alloc((unsigned)(end - start + 1)); + if (s == NULL) + goto errret; + + for (p = s; start < end; ++p, ++start) + *p = *start == NUL ? NL : *start; + *p = NUL; + + li = listitem_alloc(); + if (li == NULL) + { + vim_free(s); + goto errret; + } + li->li_tv.v_type = VAR_STRING; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_string = s; + list_append(list, li); + } + + rettv_list_set(rettv, list); + list = NULL; + } + else + { + res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, NULL); +#ifdef USE_CR + /* translate <CR> into <NL> */ + if (res != NULL) + { + char_u *s; + + for (s = res; *s; ++s) + { + if (*s == CAR) + *s = NL; + } + } +#else +# ifdef USE_CRNL + /* translate <CR><NL> into <NL> */ + if (res != NULL) + { + char_u *s, *d; + + d = res; + for (s = res; *s; ++s) + { + if (s[0] == CAR && s[1] == NL) + ++s; + *d++ = *s; + } + *d = NUL; + } +# endif +#endif + rettv->vval.v_string = res; + res = NULL; + } + +errret: + if (infile != NULL) + { + mch_remove(infile); + vim_free(infile); + } + if (res != NULL) + vim_free(res); + if (list != NULL) + list_free(list); +} + +/* + * "system()" function + */ + static void +f_system(typval_T *argvars, typval_T *rettv) +{ + get_cmd_output_as_rettv(argvars, rettv, FALSE); +} + +/* + * "systemlist()" function + */ + static void +f_systemlist(typval_T *argvars, typval_T *rettv) +{ + get_cmd_output_as_rettv(argvars, rettv, TRUE); +} + +/* + * "tabpagebuflist()" function + */ + static void +f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + tabpage_T *tp; + win_T *wp = NULL; + + if (argvars[0].v_type == VAR_UNKNOWN) + wp = firstwin; + else + { + tp = find_tabpage((int)get_tv_number(&argvars[0])); + if (tp != NULL) + wp = (tp == curtab) ? firstwin : tp->tp_firstwin; + } + if (wp != NULL && rettv_list_alloc(rettv) != FAIL) + { + for (; wp != NULL; wp = wp->w_next) + if (list_append_number(rettv->vval.v_list, + wp->w_buffer->b_fnum) == FAIL) + break; + } +} + + +/* + * "tabpagenr()" function + */ + static void +f_tabpagenr(typval_T *argvars UNUSED, typval_T *rettv) +{ + int nr = 1; + char_u *arg; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + arg = get_tv_string_chk(&argvars[0]); + nr = 0; + if (arg != NULL) + { + if (STRCMP(arg, "$") == 0) + nr = tabpage_index(NULL) - 1; + else + EMSG2(_(e_invexpr2), arg); + } + } + else + nr = tabpage_index(curtab); + rettv->vval.v_number = nr; +} + + +static int get_winnr(tabpage_T *tp, typval_T *argvar); + +/* + * Common code for tabpagewinnr() and winnr(). + */ + static int +get_winnr(tabpage_T *tp, typval_T *argvar) +{ + win_T *twin; + int nr = 1; + win_T *wp; + char_u *arg; + + twin = (tp == curtab) ? curwin : tp->tp_curwin; + if (argvar->v_type != VAR_UNKNOWN) + { + arg = get_tv_string_chk(argvar); + if (arg == NULL) + nr = 0; /* type error; errmsg already given */ + else if (STRCMP(arg, "$") == 0) + twin = (tp == curtab) ? lastwin : tp->tp_lastwin; + else if (STRCMP(arg, "#") == 0) + { + twin = (tp == curtab) ? prevwin : tp->tp_prevwin; + if (twin == NULL) + nr = 0; + } + else + { + EMSG2(_(e_invexpr2), arg); + nr = 0; + } + } + + if (nr > 0) + for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; + wp != twin; wp = wp->w_next) + { + if (wp == NULL) + { + /* didn't find it in this tabpage */ + nr = 0; + break; + } + ++nr; + } + return nr; +} + +/* + * "tabpagewinnr()" function + */ + static void +f_tabpagewinnr(typval_T *argvars UNUSED, typval_T *rettv) +{ + int nr = 1; + tabpage_T *tp; + + tp = find_tabpage((int)get_tv_number(&argvars[0])); + if (tp == NULL) + nr = 0; + else + nr = get_winnr(tp, &argvars[1]); + rettv->vval.v_number = nr; +} + + +/* + * "tagfiles()" function + */ + static void +f_tagfiles(typval_T *argvars UNUSED, typval_T *rettv) +{ + char_u *fname; + tagname_T tn; + int first; + + if (rettv_list_alloc(rettv) == FAIL) + return; + fname = alloc(MAXPATHL); + if (fname == NULL) + return; + + for (first = TRUE; ; first = FALSE) + if (get_tagfname(&tn, first, fname) == FAIL + || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) + break; + tagname_free(&tn); + vim_free(fname); +} + +/* + * "taglist()" function + */ + static void +f_taglist(typval_T *argvars, typval_T *rettv) +{ + char_u *fname = NULL; + char_u *tag_pattern; + + tag_pattern = get_tv_string(&argvars[0]); + + rettv->vval.v_number = FALSE; + if (*tag_pattern == NUL) + return; + + if (argvars[1].v_type != VAR_UNKNOWN) + fname = get_tv_string(&argvars[1]); + if (rettv_list_alloc(rettv) == OK) + (void)get_tags(rettv->vval.v_list, tag_pattern, fname); +} + +/* + * "tempname()" function + */ + static void +f_tempname(typval_T *argvars UNUSED, typval_T *rettv) +{ + static int x = 'A'; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_tempname(x, FALSE); + + /* Advance 'x' to use A-Z and 0-9, so that there are at least 34 different + * names. Skip 'I' and 'O', they are used for shell redirection. */ + do + { + if (x == 'Z') + x = '0'; + else if (x == '9') + x = 'A'; + else + { +#ifdef EBCDIC + if (x == 'I') + x = 'J'; + else if (x == 'R') + x = 'S'; + else +#endif + ++x; + } + } while (x == 'I' || x == 'O'); +} + +#ifdef FEAT_FLOAT +/* + * "tan()" function + */ + static void +f_tan(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = tan(f); + else + rettv->vval.v_float = 0.0; +} + +/* + * "tanh()" function + */ + static void +f_tanh(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + rettv->vval.v_float = tanh(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "test_alloc_fail(id, countdown, repeat)" function + */ + static void +f_test_alloc_fail(typval_T *argvars, typval_T *rettv UNUSED) +{ + if (argvars[0].v_type != VAR_NUMBER + || argvars[0].vval.v_number <= 0 + || argvars[1].v_type != VAR_NUMBER + || argvars[1].vval.v_number < 0 + || argvars[2].v_type != VAR_NUMBER) + EMSG(_(e_invarg)); + else + { + alloc_fail_id = argvars[0].vval.v_number; + if (alloc_fail_id >= aid_last) + EMSG(_(e_invarg)); + alloc_fail_countdown = argvars[1].vval.v_number; + alloc_fail_repeat = argvars[2].vval.v_number; + did_outofmem_msg = FALSE; + } +} + +/* + * "test_autochdir()" + */ + static void +f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#if defined(FEAT_AUTOCHDIR) + test_autochdir = TRUE; +#endif +} + +/* + * "test_feedinput()" + */ + static void +f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED) +{ +#ifdef USE_INPUT_BUF + char_u *val = get_tv_string_chk(&argvars[0]); + + if (val != NULL) + { + trash_input_buf(); + add_to_input_buf_csi(val, (int)STRLEN(val)); + } +#endif +} + +/* + * "test_disable({name}, {val})" function + */ + static void +f_test_override(typval_T *argvars, typval_T *rettv UNUSED) +{ + char_u *name = (char_u *)""; + int val; + static int save_starting = -1; + + if (argvars[0].v_type != VAR_STRING + || (argvars[1].v_type) != VAR_NUMBER) + EMSG(_(e_invarg)); + else + { + name = get_tv_string_chk(&argvars[0]); + val = (int)get_tv_number(&argvars[1]); + + if (STRCMP(name, (char_u *)"redraw") == 0) + disable_redraw_for_testing = val; + else if (STRCMP(name, (char_u *)"char_avail") == 0) + disable_char_avail_for_testing = val; + else if (STRCMP(name, (char_u *)"starting") == 0) + { + if (val) + { + if (save_starting < 0) + save_starting = starting; + starting = 0; + } + else + { + starting = save_starting; + save_starting = -1; + } + } + else if (STRCMP(name, (char_u *)"ALL") == 0) + { + disable_char_avail_for_testing = FALSE; + disable_redraw_for_testing = FALSE; + if (save_starting >= 0) + { + starting = save_starting; + save_starting = -1; + } + } + else + EMSG2(_(e_invarg2), name); + } +} + +/* + * "test_garbagecollect_now()" function + */ + static void +f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + /* This is dangerous, any Lists and Dicts used internally may be freed + * while still in use. */ + garbage_collect(TRUE); +} + +/* + * "test_ignore_error()" function + */ + static void +f_test_ignore_error(typval_T *argvars, typval_T *rettv UNUSED) +{ + ignore_error_for_testing(get_tv_string(&argvars[0])); +} + +#ifdef FEAT_JOB_CHANNEL + static void +f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_CHANNEL; + rettv->vval.v_channel = NULL; +} +#endif + + static void +f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv_dict_set(rettv, NULL); +} + +#ifdef FEAT_JOB_CHANNEL + static void +f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_JOB; + rettv->vval.v_job = NULL; +} +#endif + + static void +f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv_list_set(rettv, NULL); +} + + static void +f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_PARTIAL; + rettv->vval.v_partial = NULL; +} + + static void +f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +} + + static void +f_test_settime(typval_T *argvars, typval_T *rettv UNUSED) +{ + time_for_testing = (time_t)get_tv_number(&argvars[0]); +} + +#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO) +/* + * Get a callback from "arg". It can be a Funcref or a function name. + * When "arg" is zero return an empty string. + * Return NULL for an invalid argument. + */ + char_u * +get_callback(typval_T *arg, partial_T **pp) +{ + if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL) + { + *pp = arg->vval.v_partial; + ++(*pp)->pt_refcount; + return partial_name(*pp); + } + *pp = NULL; + if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING) + { + func_ref(arg->vval.v_string); + return arg->vval.v_string; + } + if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0) + return (char_u *)""; + EMSG(_("E921: Invalid callback argument")); + return NULL; +} + +/* + * Unref/free "callback" and "partial" returned by get_callback(). + */ + void +free_callback(char_u *callback, partial_T *partial) +{ + if (partial != NULL) + partial_unref(partial); + else if (callback != NULL) + { + func_unref(callback); + vim_free(callback); + } +} +#endif + +#ifdef FEAT_TIMERS +/* + * "timer_info([timer])" function + */ + static void +f_timer_info(typval_T *argvars, typval_T *rettv) +{ + timer_T *timer = NULL; + + if (rettv_list_alloc(rettv) != OK) + return; + if (argvars[0].v_type != VAR_UNKNOWN) + { + if (argvars[0].v_type != VAR_NUMBER) + EMSG(_(e_number_exp)); + else + { + timer = find_timer((int)get_tv_number(&argvars[0])); + if (timer != NULL) + add_timer_info(rettv, timer); + } + } + else + add_timer_info_all(rettv); +} + +/* + * "timer_pause(timer, paused)" function + */ + static void +f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) +{ + timer_T *timer = NULL; + int paused = (int)get_tv_number(&argvars[1]); + + if (argvars[0].v_type != VAR_NUMBER) + EMSG(_(e_number_exp)); + else + { + timer = find_timer((int)get_tv_number(&argvars[0])); + if (timer != NULL) + timer->tr_paused = paused; + } +} + +/* + * "timer_start(time, callback [, options])" function + */ + static void +f_timer_start(typval_T *argvars, typval_T *rettv) +{ + long msec = (long)get_tv_number(&argvars[0]); + timer_T *timer; + int repeat = 0; + char_u *callback; + dict_T *dict; + partial_T *partial; + + rettv->vval.v_number = -1; + if (check_secure()) + return; + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (argvars[2].v_type != VAR_DICT + || (dict = argvars[2].vval.v_dict) == NULL) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[2])); + return; + } + if (dict_find(dict, (char_u *)"repeat", -1) != NULL) + repeat = get_dict_number(dict, (char_u *)"repeat"); + } + + callback = get_callback(&argvars[1], &partial); + if (callback == NULL) + return; + + timer = create_timer(msec, repeat); + if (timer == NULL) + free_callback(callback, partial); + else + { + if (partial == NULL) + timer->tr_callback = vim_strsave(callback); + else + /* pointer into the partial */ + timer->tr_callback = callback; + timer->tr_partial = partial; + rettv->vval.v_number = (varnumber_T)timer->tr_id; + } +} + +/* + * "timer_stop(timer)" function + */ + static void +f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED) +{ + timer_T *timer; + + if (argvars[0].v_type != VAR_NUMBER) + { + EMSG(_(e_number_exp)); + return; + } + timer = find_timer((int)get_tv_number(&argvars[0])); + if (timer != NULL) + stop_timer(timer); +} + +/* + * "timer_stopall()" function + */ + static void +f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + stop_all_timers(); +} +#endif + +/* + * "tolower(string)" function + */ + static void +f_tolower(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = strlow_save(get_tv_string(&argvars[0])); +} + +/* + * "toupper(string)" function + */ + static void +f_toupper(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = strup_save(get_tv_string(&argvars[0])); +} + +/* + * "tr(string, fromstr, tostr)" function + */ + static void +f_tr(typval_T *argvars, typval_T *rettv) +{ + char_u *in_str; + char_u *fromstr; + char_u *tostr; + char_u *p; +#ifdef FEAT_MBYTE + int inlen; + int fromlen; + int tolen; + int idx; + char_u *cpstr; + int cplen; + int first = TRUE; +#endif + char_u buf[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + garray_T ga; + + in_str = get_tv_string(&argvars[0]); + fromstr = get_tv_string_buf_chk(&argvars[1], buf); + tostr = get_tv_string_buf_chk(&argvars[2], buf2); + + /* Default return value: empty string. */ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + if (fromstr == NULL || tostr == NULL) + return; /* type error; errmsg already given */ + ga_init2(&ga, (int)sizeof(char), 80); + +#ifdef FEAT_MBYTE + if (!has_mbyte) +#endif + /* not multi-byte: fromstr and tostr must be the same length */ + if (STRLEN(fromstr) != STRLEN(tostr)) + { +#ifdef FEAT_MBYTE +error: +#endif + EMSG2(_(e_invarg2), fromstr); + ga_clear(&ga); + return; + } + + /* fromstr and tostr have to contain the same number of chars */ + while (*in_str != NUL) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + { + inlen = (*mb_ptr2len)(in_str); + cpstr = in_str; + cplen = inlen; + idx = 0; + for (p = fromstr; *p != NUL; p += fromlen) + { + fromlen = (*mb_ptr2len)(p); + if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) + { + for (p = tostr; *p != NUL; p += tolen) + { + tolen = (*mb_ptr2len)(p); + if (idx-- == 0) + { + cplen = tolen; + cpstr = p; + break; + } + } + if (*p == NUL) /* tostr is shorter than fromstr */ + goto error; + break; + } + ++idx; + } + + if (first && cpstr == in_str) + { + /* Check that fromstr and tostr have the same number of + * (multi-byte) characters. Done only once when a character + * of in_str doesn't appear in fromstr. */ + first = FALSE; + for (p = tostr; *p != NUL; p += tolen) + { + tolen = (*mb_ptr2len)(p); + --idx; + } + if (idx != 0) + goto error; + } + + (void)ga_grow(&ga, cplen); + mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen); + ga.ga_len += cplen; + + in_str += inlen; + } + else +#endif + { + /* When not using multi-byte chars we can do it faster. */ + p = vim_strchr(fromstr, *in_str); + if (p != NULL) + ga_append(&ga, tostr[p - fromstr]); + else + ga_append(&ga, *in_str); + ++in_str; + } + } + + /* add a terminating NUL */ + (void)ga_grow(&ga, 1); + ga_append(&ga, NUL); + + rettv->vval.v_string = ga.ga_data; +} + +/* + * "trim({expr})" function + */ + static void +f_trim(typval_T *argvars, typval_T *rettv) +{ + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *head = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *mask = NULL; + char_u *tail; + char_u *prev; + char_u *p; + int c1; + + rettv->v_type = VAR_STRING; + if (head == NULL) + { + rettv->vval.v_string = NULL; + return; + } + + if (argvars[1].v_type == VAR_STRING) + mask = get_tv_string_buf_chk(&argvars[1], buf2); + + while (*head != NUL) + { + c1 = PTR2CHAR(head); + if (mask == NULL) + { + if (c1 > ' ' && c1 != 0xa0) + break; + } + else + { + for (p = mask; *p != NUL; MB_PTR_ADV(p)) + if (c1 == PTR2CHAR(p)) + break; + if (*p == NUL) + break; + } + MB_PTR_ADV(head); + } + + for (tail = head + STRLEN(head); tail > head; tail = prev) + { + prev = tail; + MB_PTR_BACK(head, prev); + c1 = PTR2CHAR(prev); + if (mask == NULL) + { + if (c1 > ' ' && c1 != 0xa0) + break; + } + else + { + for (p = mask; *p != NUL; MB_PTR_ADV(p)) + if (c1 == PTR2CHAR(p)) + break; + if (*p == NUL) + break; + } + } + rettv->vval.v_string = vim_strnsave(head, (int)(tail - head)); +} + +#ifdef FEAT_FLOAT +/* + * "trunc({float})" function + */ + static void +f_trunc(typval_T *argvars, typval_T *rettv) +{ + float_T f = 0.0; + + rettv->v_type = VAR_FLOAT; + if (get_float_arg(argvars, &f) == OK) + /* trunc() is not in C90, use floor() or ceil() instead. */ + rettv->vval.v_float = f > 0 ? floor(f) : ceil(f); + else + rettv->vval.v_float = 0.0; +} +#endif + +/* + * "type(expr)" function + */ + static void +f_type(typval_T *argvars, typval_T *rettv) +{ + int n = -1; + + switch (argvars[0].v_type) + { + case VAR_NUMBER: n = VAR_TYPE_NUMBER; break; + case VAR_STRING: n = VAR_TYPE_STRING; break; + case VAR_PARTIAL: + case VAR_FUNC: n = VAR_TYPE_FUNC; break; + case VAR_LIST: n = VAR_TYPE_LIST; break; + case VAR_DICT: n = VAR_TYPE_DICT; break; + case VAR_FLOAT: n = VAR_TYPE_FLOAT; break; + case VAR_SPECIAL: + if (argvars[0].vval.v_number == VVAL_FALSE + || argvars[0].vval.v_number == VVAL_TRUE) + n = VAR_TYPE_BOOL; + else + n = VAR_TYPE_NONE; + break; + case VAR_JOB: n = VAR_TYPE_JOB; break; + case VAR_CHANNEL: n = VAR_TYPE_CHANNEL; break; + case VAR_UNKNOWN: + internal_error("f_type(UNKNOWN)"); + n = -1; + break; + } + rettv->vval.v_number = n; +} + +/* + * "undofile(name)" function + */ + static void +f_undofile(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; +#ifdef FEAT_PERSISTENT_UNDO + { + char_u *fname = get_tv_string(&argvars[0]); + + if (*fname == NUL) + { + /* If there is no file name there will be no undo file. */ + rettv->vval.v_string = NULL; + } + else + { + char_u *ffname = FullName_save(fname, FALSE); + + if (ffname != NULL) + rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); + vim_free(ffname); + } + } +#else + rettv->vval.v_string = NULL; +#endif +} + +/* + * "undotree()" function + */ + static void +f_undotree(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (rettv_dict_alloc(rettv) == OK) + { + dict_T *dict = rettv->vval.v_dict; + list_T *list; + + dict_add_nr_str(dict, "synced", (long)curbuf->b_u_synced, NULL); + dict_add_nr_str(dict, "seq_last", curbuf->b_u_seq_last, NULL); + dict_add_nr_str(dict, "save_last", + (long)curbuf->b_u_save_nr_last, NULL); + dict_add_nr_str(dict, "seq_cur", curbuf->b_u_seq_cur, NULL); + dict_add_nr_str(dict, "time_cur", (long)curbuf->b_u_time_cur, NULL); + dict_add_nr_str(dict, "save_cur", (long)curbuf->b_u_save_nr_cur, NULL); + + list = list_alloc(); + if (list != NULL) + { + u_eval_tree(curbuf->b_u_oldhead, list); + dict_add_list(dict, "entries", list); + } + } +} + +/* + * "values(dict)" function + */ + static void +f_values(typval_T *argvars, typval_T *rettv) +{ + dict_list(argvars, rettv, 1); +} + +/* + * "virtcol(string)" function + */ + static void +f_virtcol(typval_T *argvars, typval_T *rettv) +{ + colnr_T vcol = 0; + pos_T *fp; + int fnum = curbuf->b_fnum; + + fp = var2fpos(&argvars[0], FALSE, &fnum); + if (fp != NULL && fp->lnum <= curbuf->b_ml.ml_line_count + && fnum == curbuf->b_fnum) + { + getvvcol(curwin, fp, NULL, NULL, &vcol); + ++vcol; + } + + rettv->vval.v_number = vcol; +} + +/* + * "visualmode()" function + */ + static void +f_visualmode(typval_T *argvars, typval_T *rettv) +{ + char_u str[2]; + + rettv->v_type = VAR_STRING; + str[0] = curbuf->b_visual_mode_eval; + str[1] = NUL; + rettv->vval.v_string = vim_strsave(str); + + /* A non-zero number or non-empty string argument: reset mode. */ + if (non_zero_arg(&argvars[0])) + curbuf->b_visual_mode_eval = NUL; +} + +/* + * "wildmenumode()" function + */ + static void +f_wildmenumode(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#ifdef FEAT_WILDMENU + if (wild_menu_showing) + rettv->vval.v_number = 1; +#endif +} + +/* + * "winbufnr(nr)" function + */ + static void +f_winbufnr(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + + wp = find_win_by_nr(&argvars[0], NULL); + if (wp == NULL) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = wp->w_buffer->b_fnum; +} + +/* + * "wincol()" function + */ + static void +f_wincol(typval_T *argvars UNUSED, typval_T *rettv) +{ + validate_cursor(); + rettv->vval.v_number = curwin->w_wcol + 1; +} + +/* + * "winheight(nr)" function + */ + static void +f_winheight(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + + wp = find_win_by_nr(&argvars[0], NULL); + if (wp == NULL) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = wp->w_height; +} + +/* + * "winline()" function + */ + static void +f_winline(typval_T *argvars UNUSED, typval_T *rettv) +{ + validate_cursor(); + rettv->vval.v_number = curwin->w_wrow + 1; +} + +/* + * "winnr()" function + */ + static void +f_winnr(typval_T *argvars UNUSED, typval_T *rettv) +{ + int nr = 1; + + nr = get_winnr(curtab, &argvars[0]); + rettv->vval.v_number = nr; +} + +/* + * "winrestcmd()" function + */ + static void +f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv) +{ + win_T *wp; + int winnr = 1; + garray_T ga; + char_u buf[50]; + + ga_init2(&ga, (int)sizeof(char), 70); + FOR_ALL_WINDOWS(wp) + { + sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height); + ga_concat(&ga, buf); + sprintf((char *)buf, "vert %dresize %d|", winnr, wp->w_width); + ga_concat(&ga, buf); + ++winnr; + } + ga_append(&ga, NUL); + + rettv->vval.v_string = ga.ga_data; + rettv->v_type = VAR_STRING; +} + +/* + * "winrestview()" function + */ + static void +f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) +{ + dict_T *dict; + + if (argvars[0].v_type != VAR_DICT + || (dict = argvars[0].vval.v_dict) == NULL) + EMSG(_(e_invarg)); + else + { + if (dict_find(dict, (char_u *)"lnum", -1) != NULL) + curwin->w_cursor.lnum = (linenr_T)get_dict_number(dict, (char_u *)"lnum"); + if (dict_find(dict, (char_u *)"col", -1) != NULL) + curwin->w_cursor.col = (colnr_T)get_dict_number(dict, (char_u *)"col"); +#ifdef FEAT_VIRTUALEDIT + if (dict_find(dict, (char_u *)"coladd", -1) != NULL) + curwin->w_cursor.coladd = (colnr_T)get_dict_number(dict, (char_u *)"coladd"); +#endif + if (dict_find(dict, (char_u *)"curswant", -1) != NULL) + { + curwin->w_curswant = (colnr_T)get_dict_number(dict, (char_u *)"curswant"); + curwin->w_set_curswant = FALSE; + } + + if (dict_find(dict, (char_u *)"topline", -1) != NULL) + set_topline(curwin, (linenr_T)get_dict_number(dict, (char_u *)"topline")); +#ifdef FEAT_DIFF + if (dict_find(dict, (char_u *)"topfill", -1) != NULL) + curwin->w_topfill = (int)get_dict_number(dict, (char_u *)"topfill"); +#endif + if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) + curwin->w_leftcol = (colnr_T)get_dict_number(dict, (char_u *)"leftcol"); + if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) + curwin->w_skipcol = (colnr_T)get_dict_number(dict, (char_u *)"skipcol"); + + check_cursor(); + win_new_height(curwin, curwin->w_height); + win_new_width(curwin, curwin->w_width); + changed_window_setting(); + + if (curwin->w_topline <= 0) + curwin->w_topline = 1; + if (curwin->w_topline > curbuf->b_ml.ml_line_count) + curwin->w_topline = curbuf->b_ml.ml_line_count; +#ifdef FEAT_DIFF + check_topfill(curwin, TRUE); +#endif + } +} + +/* + * "winsaveview()" function + */ + static void +f_winsaveview(typval_T *argvars UNUSED, typval_T *rettv) +{ + dict_T *dict; + + if (rettv_dict_alloc(rettv) == FAIL) + return; + dict = rettv->vval.v_dict; + + dict_add_nr_str(dict, "lnum", (long)curwin->w_cursor.lnum, NULL); + dict_add_nr_str(dict, "col", (long)curwin->w_cursor.col, NULL); +#ifdef FEAT_VIRTUALEDIT + dict_add_nr_str(dict, "coladd", (long)curwin->w_cursor.coladd, NULL); +#endif + update_curswant(); + dict_add_nr_str(dict, "curswant", (long)curwin->w_curswant, NULL); + + dict_add_nr_str(dict, "topline", (long)curwin->w_topline, NULL); +#ifdef FEAT_DIFF + dict_add_nr_str(dict, "topfill", (long)curwin->w_topfill, NULL); +#endif + dict_add_nr_str(dict, "leftcol", (long)curwin->w_leftcol, NULL); + dict_add_nr_str(dict, "skipcol", (long)curwin->w_skipcol, NULL); +} + +/* + * "winwidth(nr)" function + */ + static void +f_winwidth(typval_T *argvars, typval_T *rettv) +{ + win_T *wp; + + wp = find_win_by_nr(&argvars[0], NULL); + if (wp == NULL) + rettv->vval.v_number = -1; + else + rettv->vval.v_number = wp->w_width; +} + +/* + * "wordcount()" function + */ + static void +f_wordcount(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (rettv_dict_alloc(rettv) == FAIL) + return; + cursor_pos_info(rettv->vval.v_dict); +} + +/* + * "writefile()" function + */ + static void +f_writefile(typval_T *argvars, typval_T *rettv) +{ + int binary = FALSE; + int append = FALSE; +#ifdef HAVE_FSYNC + int do_fsync = p_fs; +#endif + char_u *fname; + FILE *fd; + int ret = 0; + listitem_T *li; + list_T *list; + + rettv->vval.v_number = -1; + if (check_restricted() || check_secure()) + return; + + if (argvars[0].v_type != VAR_LIST) + { + EMSG2(_(e_listarg), "writefile()"); + return; + } + list = argvars[0].vval.v_list; + if (list == NULL) + return; + for (li = list->lv_first; li != NULL; li = li->li_next) + if (get_tv_string_chk(&li->li_tv) == NULL) + return; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + char_u *arg2 = get_tv_string_chk(&argvars[2]); + + if (arg2 == NULL) + return; + if (vim_strchr(arg2, 'b') != NULL) + binary = TRUE; + if (vim_strchr(arg2, 'a') != NULL) + append = TRUE; +#ifdef HAVE_FSYNC + if (vim_strchr(arg2, 's') != NULL) + do_fsync = TRUE; + else if (vim_strchr(arg2, 'S') != NULL) + do_fsync = FALSE; +#endif + } + + fname = get_tv_string_chk(&argvars[1]); + if (fname == NULL) + return; + + /* Always open the file in binary mode, library functions have a mind of + * their own about CR-LF conversion. */ + if (*fname == NUL || (fd = mch_fopen((char *)fname, + append ? APPENDBIN : WRITEBIN)) == NULL) + { + EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname); + ret = -1; + } + else + { + if (write_list(fd, list, binary) == FAIL) + ret = -1; +#ifdef HAVE_FSYNC + else if (do_fsync) + /* Ignore the error, the user wouldn't know what to do about it. + * May happen for a device. */ + ignored = fsync(fileno(fd)); +#endif + fclose(fd); + } + + rettv->vval.v_number = ret; +} + +/* + * "xor(expr, expr)" function + */ + static void +f_xor(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) + ^ get_tv_number_chk(&argvars[1], NULL); +} + + +#endif /* FEAT_EVAL */ diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h new file mode 100644 index 0000000000..21d3ec2cd4 --- /dev/null +++ b/src/ex_cmdidxs.h @@ -0,0 +1,72 @@ +/* Automatically generated code by create_cmdidxs.vim + * + * Table giving the index of the first command in cmdnames[] to lookup + * based on the first letter of a command. + */ +static const unsigned short cmdidxs1[26] = +{ + /* a */ 0, + /* b */ 19, + /* c */ 42, + /* d */ 103, + /* e */ 125, + /* f */ 145, + /* g */ 161, + /* h */ 167, + /* i */ 176, + /* j */ 194, + /* k */ 196, + /* l */ 201, + /* m */ 259, + /* n */ 279, + /* o */ 299, + /* p */ 311, + /* q */ 350, + /* r */ 353, + /* s */ 372, + /* t */ 439, + /* u */ 479, + /* v */ 490, + /* w */ 508, + /* x */ 523, + /* y */ 532, + /* z */ 533 +}; + +/* + * Table giving the index of the first command in cmdnames[] to lookup + * based on the first 2 letters of a command. + * Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they + * fit in a byte. + */ +static const unsigned char cmdidxs2[26][26] = +{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */ + /* a */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 15, 0, 16, 0, 0, 0, 0, 0 }, + /* b */ { 2, 0, 0, 4, 5, 7, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12, 0, 13, 0, 0, 0, 0, 22, 0, 0, 0 }, + /* c */ { 3, 10, 12, 14, 16, 18, 21, 0, 0, 0, 0, 29, 33, 36, 42, 51, 53, 54, 55, 0, 57, 0, 60, 0, 0, 0 }, + /* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 16, 0, 0, 17, 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, 0 }, + /* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0 }, + /* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0 }, + /* g */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 4, 5, 0, 0, 0, 0 }, + /* h */ { 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* i */ { 1, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 5, 6, 0, 0, 0, 0, 0, 13, 0, 15, 0, 0, 0, 0, 0 }, + /* j */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, + /* k */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* l */ { 3, 9, 11, 15, 16, 20, 23, 28, 0, 0, 0, 30, 33, 36, 40, 46, 0, 48, 57, 49, 50, 54, 56, 0, 0, 0 }, + /* m */ { 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18 }, + /* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 }, + /* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 }, + /* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 16, 17, 26, 0, 27, 0, 28, 0 }, + /* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 18, 0, 0, 0, 0 }, + /* s */ { 2, 6, 15, 0, 18, 22, 0, 24, 25, 0, 0, 28, 30, 34, 38, 40, 0, 48, 0, 49, 0, 61, 62, 0, 63, 0 }, + /* t */ { 2, 0, 19, 0, 22, 24, 0, 25, 0, 26, 0, 27, 28, 31, 33, 34, 0, 35, 37, 0, 38, 0, 0, 0, 0, 0 }, + /* u */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* v */ { 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 9, 12, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0 }, + /* w */ { 2, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 8, 0, 9, 10, 0, 12, 0, 13, 14, 0, 0, 0, 0 }, + /* x */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0 }, + /* y */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +static const int command_count = 546; diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 62621bfa57..60d72023c9 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -14,39 +14,42 @@ #include "vim.h" #include "version.h" -#ifdef FEAT_EX_EXTRA -static int linelen __ARGS((int *has_tab)); +#ifdef FEAT_FLOAT +# include <float.h> #endif -static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out)); + +static int linelen(int *has_tab); +static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out); #ifdef FEAT_VIMINFO -static char_u *viminfo_filename __ARGS((char_u *)); -static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags)); -static int viminfo_encoding __ARGS((vir_T *virp)); -static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing)); +static char_u *viminfo_filename(char_u *); +static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags); +static int viminfo_encoding(vir_T *virp); +static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing); #endif -static int check_readonly __ARGS((int *forceit, buf_T *buf)); -#ifdef FEAT_AUTOCMD -static void delbuf_msg __ARGS((char_u *name)); -#endif +static int check_readonly(int *forceit, buf_T *buf); +static void delbuf_msg(char_u *name); static int #ifdef __BORLANDC__ _RTLENTRYF #endif - help_compare __ARGS((const void *s1, const void *s2)); + help_compare(const void *s1, const void *s2); +static void prepare_help_buffer(void); /* * ":ascii" and "ga". */ void -do_ascii(eap) - exarg_T *eap UNUSED; +do_ascii(exarg_T *eap UNUSED) { int c; int cval; char buf1[20]; char buf2[20]; char_u buf3[7]; +#ifdef FEAT_DIGRAPHS + char_u *dig; +#endif #ifdef FEAT_MBYTE int cc[MAX_MCO]; int ci = 0; @@ -92,7 +95,15 @@ do_ascii(eap) else #endif buf2[0] = NUL; - vim_snprintf((char *)IObuff, IOSIZE, +#ifdef FEAT_DIGRAPHS + dig = get_digraph_for_char(cval); + if (dig != NULL) + vim_snprintf((char *)IObuff, IOSIZE, + _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"), + transchar(c), buf1, buf2, cval, cval, cval, dig); + else +#endif + vim_snprintf((char *)IObuff, IOSIZE, _("<%s>%s%s %d, Hex %02x, Octal %03o"), transchar(c), buf1, buf2, cval, cval, cval); #ifdef FEAT_MBYTE @@ -119,9 +130,19 @@ do_ascii(eap) ) IObuff[len++] = ' '; /* draw composing char on top of a space */ len += (*mb_char2bytes)(c, IObuff + len); - vim_snprintf((char *)IObuff + len, IOSIZE - len, - c < 0x10000 ? _("> %d, Hex %04x, Octal %o") - : _("> %d, Hex %08x, Octal %o"), c, c, c); +#ifdef FEAT_DIGRAPHS + dig = get_digraph_for_char(c); + if (dig != NULL) + vim_snprintf((char *)IObuff + len, IOSIZE - len, + c < 0x10000 ? _("> %d, Hex %04x, Oct %o, Digr %s") + : _("> %d, Hex %08x, Oct %o, Digr %s"), + c, c, c, dig); + else +#endif + vim_snprintf((char *)IObuff + len, IOSIZE - len, + c < 0x10000 ? _("> %d, Hex %04x, Octal %o") + : _("> %d, Hex %08x, Octal %o"), + c, c, c); if (ci == MAX_MCO) break; if (enc_utf8) @@ -134,13 +155,11 @@ do_ascii(eap) msg(IObuff); } -#if defined(FEAT_EX_EXTRA) || defined(PROTO) /* * ":left", ":center" and ":right": align text. */ void -ex_align(eap) - exarg_T *eap; +ex_align(exarg_T *eap) { pos_T save_curpos; int len; @@ -177,7 +196,7 @@ ex_align(eap) if (width <= 0) width = curbuf->b_p_tw; if (width == 0 && curbuf->b_p_wm > 0) - width = W_WIDTH(curwin) - curbuf->b_p_wm; + width = curwin->w_width - curbuf->b_p_wm; if (width <= 0) width = 80; } @@ -242,8 +261,7 @@ ex_align(eap) * Get the length of the current line, excluding trailing white space. */ static int -linelen(has_tab) - int *has_tab; +linelen(int *has_tab) { char_u *line; char_u *first; @@ -257,7 +275,7 @@ linelen(has_tab) /* find the character after the last non-blank character */ for (last = first + STRLEN(first); - last > first && vim_iswhite(last[-1]); --last) + last > first && VIM_ISWHITE(last[-1]); --last) ; save = *last; *last = NUL; @@ -274,33 +292,43 @@ linelen(has_tab) static char_u *sortbuf1; static char_u *sortbuf2; -static int sort_ic; /* ignore case */ -static int sort_nr; /* sort on number */ -static int sort_rx; /* sort on regex instead of skipping it */ +static int sort_ic; /* ignore case */ +static int sort_nr; /* sort on number */ +static int sort_rx; /* sort on regex instead of skipping it */ +#ifdef FEAT_FLOAT +static int sort_flt; /* sort on floating number */ +#endif -static int sort_abort; /* flag to indicate if sorting has been interrupted */ +static int sort_abort; /* flag to indicate if sorting has been interrupted */ /* Struct to store info to be sorted. */ typedef struct { linenr_T lnum; /* line number */ - long start_col_nr; /* starting column number or number */ - long end_col_nr; /* ending column number */ + union { + struct + { + varnumber_T start_col_nr; /* starting column number */ + varnumber_T end_col_nr; /* ending column number */ + } line; + varnumber_T value; /* value if sorting by integer */ +#ifdef FEAT_FLOAT + float_T value_flt; /* value if sorting by float */ +#endif + } st_u; } sorti_T; static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_compare __ARGS((const void *s1, const void *s2)); +sort_compare(const void *s1, const void *s2); static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_compare(s1, s2) - const void *s1; - const void *s2; +sort_compare(const void *s1, const void *s2) { sorti_T l1 = *(sorti_T *)s1; sorti_T l2 = *(sorti_T *)s2; @@ -318,19 +346,24 @@ sort_compare(s1, s2) /* When sorting numbers "start_col_nr" is the number, not the column * number. */ if (sort_nr) - result = l1.start_col_nr == l2.start_col_nr ? 0 - : l1.start_col_nr > l2.start_col_nr ? 1 : -1; + result = l1.st_u.value == l2.st_u.value ? 0 + : l1.st_u.value > l2.st_u.value ? 1 : -1; +#ifdef FEAT_FLOAT + else if (sort_flt) + result = l1.st_u.value_flt == l2.st_u.value_flt ? 0 + : l1.st_u.value_flt > l2.st_u.value_flt ? 1 : -1; +#endif else { /* We need to copy one line into "sortbuf1", because there is no * guarantee that the first pointer becomes invalid when obtaining the * second one. */ - STRNCPY(sortbuf1, ml_get(l1.lnum) + l1.start_col_nr, - l1.end_col_nr - l1.start_col_nr + 1); - sortbuf1[l1.end_col_nr - l1.start_col_nr] = 0; - STRNCPY(sortbuf2, ml_get(l2.lnum) + l2.start_col_nr, - l2.end_col_nr - l2.start_col_nr + 1); - sortbuf2[l2.end_col_nr - l2.start_col_nr] = 0; + STRNCPY(sortbuf1, ml_get(l1.lnum) + l1.st_u.line.start_col_nr, + l1.st_u.line.end_col_nr - l1.st_u.line.start_col_nr + 1); + sortbuf1[l1.st_u.line.end_col_nr - l1.st_u.line.start_col_nr] = 0; + STRNCPY(sortbuf2, ml_get(l2.lnum) + l2.st_u.line.start_col_nr, + l2.st_u.line.end_col_nr - l2.st_u.line.start_col_nr + 1); + sortbuf2[l2.st_u.line.end_col_nr - l2.st_u.line.start_col_nr] = 0; result = sort_ic ? STRICMP(sortbuf1, sortbuf2) : STRCMP(sortbuf1, sortbuf2); @@ -346,8 +379,7 @@ sort_compare(s1, s2) * ":sort". */ void -ex_sort(eap) - exarg_T *eap; +ex_sort(exarg_T *eap) { regmatch_T regmatch; int len; @@ -364,8 +396,8 @@ ex_sort(eap) long deleted; colnr_T start_col; colnr_T end_col; - int sort_oct; /* sort on octal number */ - int sort_hex; /* sort on hex number */ + int sort_what = 0; + int format_found = 0; /* Sorting one line is really quick! */ if (count <= 1) @@ -380,22 +412,46 @@ ex_sort(eap) if (nrs == NULL) goto sortend; - sort_abort = sort_ic = sort_rx = sort_nr = sort_oct = sort_hex = 0; + sort_abort = sort_ic = sort_rx = sort_nr = 0; +#ifdef FEAT_FLOAT + sort_flt = 0; +#endif for (p = eap->arg; *p != NUL; ++p) { - if (vim_iswhite(*p)) + if (VIM_ISWHITE(*p)) ; else if (*p == 'i') sort_ic = TRUE; else if (*p == 'r') sort_rx = TRUE; else if (*p == 'n') - sort_nr = 2; + { + sort_nr = 1; + ++format_found; + } +#ifdef FEAT_FLOAT + else if (*p == 'f') + { + sort_flt = 1; + ++format_found; + } +#endif + else if (*p == 'b') + { + sort_what = STR2NR_BIN + STR2NR_FORCE; + ++format_found; + } else if (*p == 'o') - sort_oct = 2; + { + sort_what = STR2NR_OCT + STR2NR_FORCE; + ++format_found; + } else if (*p == 'x') - sort_hex = 2; + { + sort_what = STR2NR_HEX + STR2NR_FORCE; + ++format_found; + } else if (*p == 'u') unique = TRUE; else if (*p == '"') /* comment start */ @@ -438,15 +494,16 @@ ex_sort(eap) } } - /* Can only have one of 'n', 'o' and 'x'. */ - if (sort_nr + sort_oct + sort_hex > 2) + /* Can only have one of 'n', 'b', 'o' and 'x'. */ + if (format_found > 1) { EMSG(_(e_invarg)); goto sortend; } - /* From here on "sort_nr" is used as a flag for any number sorting. */ - sort_nr += sort_oct + sort_hex; + /* From here on "sort_nr" is used as a flag for any integer number + * sorting. */ + sort_nr += sort_what; /* * Make an array with all line numbers. This avoids having to copy all @@ -479,7 +536,11 @@ ex_sort(eap) if (regmatch.regprog != NULL) end_col = 0; - if (sort_nr) + if (sort_nr +#ifdef FEAT_FLOAT + || sort_flt +#endif + ) { /* Make sure vim_str2nr doesn't read any digits past the end * of the match, by temporarily terminating the string there */ @@ -488,25 +549,45 @@ ex_sort(eap) *s2 = NUL; /* Sorting on number: Store the number itself. */ p = s + start_col; - if (sort_hex) - s = skiptohex(p); - else - s = skiptodigit(p); - if (s > p && s[-1] == '-') - --s; /* include preceding negative sign */ - if (*s == NUL) - /* empty line should sort before any number */ - nrs[lnum - eap->line1].start_col_nr = -MAXLNUM; + if (sort_nr) + { + if (sort_what & STR2NR_HEX) + s = skiptohex(p); + else if (sort_what & STR2NR_BIN) + s = skiptobin(p); + else + s = skiptodigit(p); + if (s > p && s[-1] == '-') + --s; /* include preceding negative sign */ + if (*s == NUL) + /* empty line should sort before any number */ + nrs[lnum - eap->line1].st_u.value = -MAXLNUM; + else + vim_str2nr(s, NULL, NULL, sort_what, + &nrs[lnum - eap->line1].st_u.value, NULL, 0); + } +#ifdef FEAT_FLOAT else - vim_str2nr(s, NULL, NULL, sort_oct, sort_hex, - &nrs[lnum - eap->line1].start_col_nr, NULL); + { + s = skipwhite(p); + if (*s == '+') + s = skipwhite(s + 1); + + if (*s == NUL) + /* empty line should sort before any number */ + nrs[lnum - eap->line1].st_u.value_flt = -DBL_MAX; + else + nrs[lnum - eap->line1].st_u.value_flt = + strtod((char *)s, NULL); + } +#endif *s2 = c; } else { /* Store the column to sort at. */ - nrs[lnum - eap->line1].start_col_nr = start_col; - nrs[lnum - eap->line1].end_col_nr = end_col; + nrs[lnum - eap->line1].st_u.line.start_col_nr = start_col; + nrs[lnum - eap->line1].st_u.line.end_col_nr = end_col; } nrs[lnum - eap->line1].lnum = lnum; @@ -539,10 +620,11 @@ ex_sort(eap) if (!unique || i == 0 || (sort_ic ? STRICMP(s, sortbuf1) : STRCMP(s, sortbuf1)) != 0) { - if (ml_append(lnum++, s, (colnr_T)0, FALSE) == FAIL) + /* Copy the line into a buffer, it may become invalid in + * ml_append(). And it's needed for "unique". */ + STRCPY(sortbuf1, s); + if (ml_append(lnum++, sortbuf1, (colnr_T)0, FALSE) == FAIL) break; - if (unique) - STRCPY(sortbuf1, s); } fast_breakcheck(); if (got_int) @@ -580,8 +662,7 @@ ex_sort(eap) * ":retab". */ void -ex_retab(eap) - exarg_T *eap; +ex_retab(exarg_T *eap) { linenr_T lnum; int got_tab = FALSE; @@ -621,7 +702,7 @@ ex_retab(eap) did_undo = FALSE; for (;;) { - if (vim_iswhite(ptr[col])) + if (VIM_ISWHITE(ptr[col])) { if (!got_tab && num_spaces == 0) { @@ -722,7 +803,6 @@ ex_retab(eap) u_clearline(); } -#endif /* * :move command - move lines line1-line2 to line dest @@ -730,16 +810,17 @@ ex_retab(eap) * return FAIL for failure, OK otherwise */ int -do_move(line1, line2, dest) - linenr_T line1; - linenr_T line2; - linenr_T dest; +do_move(linenr_T line1, linenr_T line2, linenr_T dest) { char_u *str; linenr_T l; linenr_T extra; /* Num lines added before line1 */ linenr_T num_lines; /* Num lines moved */ linenr_T last_line; /* Last line in file after adding new text */ +#ifdef FEAT_FOLDING + win_T *win; + tabpage_T *tp; +#endif if (dest >= line1 && dest < line2) { @@ -783,24 +864,34 @@ do_move(line1, line2, dest) * their final destination at the new text position -- webb */ last_line = curbuf->b_ml.ml_line_count; - mark_adjust(line1, line2, last_line - line2, 0L); - changed_lines(last_line - num_lines + 1, 0, last_line + 1, num_lines); + mark_adjust_nofold(line1, line2, last_line - line2, 0L); if (dest >= line2) { - mark_adjust(line2 + 1, dest, -num_lines, 0L); + mark_adjust_nofold(line2 + 1, dest, -num_lines, 0L); +#ifdef FEAT_FOLDING + FOR_ALL_TAB_WINDOWS(tp, win) { + if (win->w_buffer == curbuf) + foldMoveRange(&win->w_folds, line1, line2, dest); + } +#endif curbuf->b_op_start.lnum = dest - num_lines + 1; curbuf->b_op_end.lnum = dest; } else { - mark_adjust(dest + 1, line1 - 1, num_lines, 0L); + mark_adjust_nofold(dest + 1, line1 - 1, num_lines, 0L); +#ifdef FEAT_FOLDING + FOR_ALL_TAB_WINDOWS(tp, win) { + if (win->w_buffer == curbuf) + foldMoveRange(&win->w_folds, dest + 1, line1 - 1, line2); + } +#endif curbuf->b_op_start.lnum = dest + 1; curbuf->b_op_end.lnum = dest + num_lines; } curbuf->b_op_start.col = curbuf->b_op_end.col = 0; - mark_adjust(last_line - num_lines + 1, last_line, + mark_adjust_nofold(last_line - num_lines + 1, last_line, -(last_line - dest - extra), 0L); - changed_lines(last_line - num_lines + 1, 0, last_line + 1, -extra); /* * Now we delete the original text -- webb @@ -845,10 +936,7 @@ do_move(line1, line2, dest) * ":copy" */ void -ex_copy(line1, line2, n) - linenr_T line1; - linenr_T line2; - linenr_T n; +ex_copy(linenr_T line1, linenr_T line2, linenr_T n) { linenr_T count; char_u *p; @@ -903,7 +991,7 @@ static char_u *prevcmd = NULL; /* the previous command */ #if defined(EXITFREE) || defined(PROTO) void -free_prev_shellcmd() +free_prev_shellcmd(void) { vim_free(prevcmd); } @@ -915,11 +1003,12 @@ free_prev_shellcmd() * Remember the argument. */ void -do_bang(addr_count, eap, forceit, do_in, do_out) - int addr_count; - exarg_T *eap; - int forceit; - int do_in, do_out; +do_bang( + int addr_count, + exarg_T *eap, + int forceit, + int do_in, + int do_out) { char_u *arg = eap->arg; /* command */ linenr_T line1 = eap->line1; /* start of range */ @@ -1057,9 +1146,7 @@ do_bang(addr_count, eap, forceit, do_in, do_out) /* Careful: This may recursively call do_bang() again! (because of * autocommands) */ do_filter(line1, line2, eap, newcmd, do_in, do_out); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf); -#endif } if (free_newcmd) vim_free(newcmd); @@ -1081,11 +1168,13 @@ do_bang(addr_count, eap, forceit, do_in, do_out) * We use output redirection if do_out is TRUE. */ static void -do_filter(line1, line2, eap, cmd, do_in, do_out) - linenr_T line1, line2; - exarg_T *eap; /* for forced 'ff' and 'fenc' */ - char_u *cmd; - int do_in, do_out; +do_filter( + linenr_T line1, + linenr_T line2, + exarg_T *eap, /* for forced 'ff' and 'fenc' */ + char_u *cmd, + int do_in, + int do_out) { char_u *itmp = NULL; char_u *otmp = NULL; @@ -1093,22 +1182,12 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) linenr_T read_linecount; pos_T cursor_save; char_u *cmd_buf; -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif int shell_flags = 0; if (*cmd == NUL) /* no filter command */ return; -#ifdef WIN3264 - /* - * Check if external commands are allowed now. - */ - if (can_end_termcap_mode(TRUE) == FALSE) - return; -#endif - cursor_save = curwin->w_cursor; linecount = line2 - line1 + 1; curwin->w_cursor.lnum = line1; @@ -1157,8 +1236,8 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) } else #endif - if ((do_in && (itmp = vim_tempname('i')) == NULL) - || (do_out && (otmp = vim_tempname('o')) == NULL)) + if ((do_in && (itmp = vim_tempname('i', FALSE)) == NULL) + || (do_out && (otmp = vim_tempname('o', FALSE)) == NULL)) { EMSG(_(e_notmp)); goto filterend; @@ -1174,16 +1253,14 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) { msg_putchar('\n'); /* keep message from buf_write() */ --no_wait_return; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif (void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */ goto filterend; } -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; -#endif if (!do_out) msg_putchar('\n'); @@ -1247,9 +1324,9 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) if (otmp != NULL) { if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, - eap, READ_FILTER) == FAIL) + eap, READ_FILTER) != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif { @@ -1258,10 +1335,8 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) } goto error; } -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; -#endif } read_linecount = curbuf->b_ml.ml_line_count - read_linecount; @@ -1341,13 +1416,11 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) filterend: -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { --no_wait_return; EMSG(_("E135: *Filter* Autocommands must not change current buffer")); } -#endif if (itmp != NULL) mch_remove(itmp); if (otmp != NULL) @@ -1361,9 +1434,9 @@ do_filter(line1, line2, eap, cmd, do_in, do_out) * When "cmd" is NULL start an interactive shell. */ void -do_shell(cmd, flags) - char_u *cmd; - int flags; /* may be SHELL_DOOUT when output is redirected */ +do_shell( + char_u *cmd, + int flags) /* may be SHELL_DOOUT when output is redirected */ { buf_T *buf; #ifndef FEAT_GUI_MSWIN @@ -1385,12 +1458,6 @@ do_shell(cmd, flags) } #ifdef MSWIN - /* - * Check if external commands are allowed now. - */ - if (can_end_termcap_mode(TRUE) == FALSE) - return; - /* * Check if ":!start" is used. */ @@ -1403,9 +1470,7 @@ do_shell(cmd, flags) * avoid having to type return below. */ msg_putchar('\r'); /* put cursor at start of line */ -#ifdef FEAT_AUTOCMD if (!autocmd_busy) -#endif { #ifdef MSWIN if (!winstart) @@ -1418,13 +1483,9 @@ do_shell(cmd, flags) msg_putchar('\n'); /* may shift screen one line up */ /* warning message before calling the shell */ - if (p_warn -#ifdef FEAT_AUTOCMD - && !autocmd_busy -#endif - && msg_silent == 0) - for (buf = firstbuf; buf; buf = buf->b_next) - if (bufIsChanged(buf)) + if (p_warn && !autocmd_busy && msg_silent == 0) + FOR_ALL_BUFFERS(buf) + if (bufIsChangedNotTerm(buf)) { #ifdef FEAT_GUI_MSWIN if (!winstart) @@ -1457,14 +1518,12 @@ do_shell(cmd, flags) msg_col = 0; } -#ifdef FEAT_AUTOCMD if (autocmd_busy) { if (msg_silent == 0) redraw_later_clear(); } else -#endif { /* * For ":sh" there is no need to call wait_return(), just redraw. @@ -1533,9 +1592,7 @@ do_shell(cmd, flags) /* display any error messages now */ display_errors(); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf); -#endif } /* @@ -1544,15 +1601,15 @@ do_shell(cmd, flags) * Returns an allocated string with the shell command, or NULL for failure. */ char_u * -make_filter_cmd(cmd, itmp, otmp) - char_u *cmd; /* command */ - char_u *itmp; /* NULL or name of input file */ - char_u *otmp; /* NULL or name of output file */ +make_filter_cmd( + char_u *cmd, /* command */ + char_u *itmp, /* NULL or name of input file */ + char_u *otmp) /* NULL or name of output file */ { char_u *buf; long_u len; -#if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2) +#if defined(UNIX) int is_fish_shell; char_u *shell_name = get_isolated_shell_name(); @@ -1572,7 +1629,7 @@ make_filter_cmd(cmd, itmp, otmp) if (buf == NULL) return NULL; -#if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2) +#if defined(UNIX) /* * Put braces around the command (for concatenated commands) when * redirecting input and/or output. @@ -1639,11 +1696,11 @@ make_filter_cmd(cmd, itmp, otmp) * STRLEN(opt) + STRLEN(fname) + 3 */ void -append_redir(buf, buflen, opt, fname) - char_u *buf; - int buflen; - char_u *opt; - char_u *fname; +append_redir( + char_u *buf, + int buflen, + char_u *opt, + char_u *fname) { char_u *p; char_u *end; @@ -1673,16 +1730,19 @@ append_redir(buf, buflen, opt, fname) (char *)opt, (char *)fname); } -#ifdef FEAT_VIMINFO +#if defined(FEAT_VIMINFO) || defined(PROTO) -static int no_viminfo __ARGS((void)); +static int no_viminfo(void); +static int read_viminfo_barline(vir_T *virp, int got_encoding, int force, int writing); +static void write_viminfo_version(FILE *fp_out); +static void write_viminfo_barlines(vir_T *virp, FILE *fp_out); static int viminfo_errcnt; static int -no_viminfo() +no_viminfo(void) { /* "vim -i NONE" does not read or write a viminfo file */ - return (use_viminfo != NULL && STRCMP(use_viminfo, "NONE") == 0); + return STRCMP(p_viminfofile, "NONE") == 0; } /* @@ -1690,10 +1750,7 @@ no_viminfo() * Count the number of errors. When there are more than 10, return TRUE. */ int -viminfo_error(errnum, message, line) - char *errnum; - char *message; - char_u *line; +viminfo_error(char *errnum, char *message, char_u *line) { vim_snprintf((char *)IObuff, IOSIZE, _("%sviminfo: %s in line: "), errnum, message); @@ -1714,9 +1771,9 @@ viminfo_error(errnum, message, line) * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb */ int -read_viminfo(file, flags) - char_u *file; /* file name or NULL to use default name */ - int flags; /* VIF_WANT_INFO et al. */ +read_viminfo( + char_u *file, /* file name or NULL to use default name */ + int flags) /* VIF_WANT_INFO et al. */ { FILE *fp; char_u *fname; @@ -1760,25 +1817,22 @@ read_viminfo(file, flags) * info is written to the file. */ void -write_viminfo(file, forceit) - char_u *file; - int forceit; +write_viminfo(char_u *file, int forceit) { char_u *fname; FILE *fp_in = NULL; /* input viminfo file, if any */ FILE *fp_out = NULL; /* output viminfo file */ char_u *tempname = NULL; /* name of temp viminfo file */ - struct stat st_new; /* mch_stat() of potential new file */ - char_u *wp; + stat_T st_new; /* mch_stat() of potential new file */ #if defined(UNIX) || defined(VMS) mode_t umask_save; #endif #ifdef UNIX int shortname = FALSE; /* use 8.3 file name */ - struct stat st_old; /* mch_stat() of existing viminfo file */ + stat_T st_old; /* mch_stat() of existing viminfo file */ #endif #ifdef WIN3264 - long perm = -1; + int hidden = FALSE; #endif if (no_viminfo()) @@ -1791,27 +1845,29 @@ write_viminfo(file, forceit) fp_in = mch_fopen((char *)fname, READBIN); if (fp_in == NULL) { + int fd; + /* if it does exist, but we can't read it, don't try writing */ if (mch_stat((char *)fname, &st_new) == 0) goto end; -#if defined(UNIX) || defined(VMS) - /* - * For Unix we create the .viminfo non-accessible for others, - * because it may contain text from non-accessible documents. - */ - umask_save = umask(077); -#endif - fp_out = mch_fopen((char *)fname, WRITEBIN); -#if defined(UNIX) || defined(VMS) - (void)umask(umask_save); -#endif + + /* Create the new .viminfo non-accessible for others, because it may + * contain text from non-accessible documents. It is up to the user to + * widen access (e.g. to a group). This may also fail if there is a + * race condition, then just give up. */ + fd = mch_open((char *)fname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); + if (fd < 0) + goto end; + fp_out = fdopen(fd, WRITEBIN); } else { /* * There is an existing viminfo file. Create a temporary file to * write the new viminfo into, in the same directory as the - * existing viminfo file, which will be renamed later. + * existing viminfo file, which will be renamed once all writing is + * successful. */ #ifdef UNIX /* @@ -1841,29 +1897,27 @@ write_viminfo(file, forceit) #endif #ifdef WIN3264 /* Get the file attributes of the existing viminfo file. */ - perm = mch_getperm(fname); + hidden = mch_ishidden(fname); #endif /* - * Make tempname. + * Make tempname, find one that does not exist yet. + * Beware of a race condition: If someone logs out and all Vim + * instances exit at the same time a temp file might be created between + * stat() and open(). Use mch_open() with O_EXCL to avoid that. * May try twice: Once normal and once with shortname set, just in * case somebody puts his viminfo file in an 8.3 filesystem. */ for (;;) { + int next_char = 'z'; + char_u *wp; + tempname = buf_modname( #ifdef UNIX shortname, #else -# ifdef SHORT_FNAME - TRUE, -# else -# ifdef FEAT_GUI_W32 - gui_is_win32s(), -# else FALSE, -# endif -# endif #endif fname, #ifdef VMS @@ -1876,105 +1930,127 @@ write_viminfo(file, forceit) break; /* - * Check if tempfile already exists. Never overwrite an - * existing file! + * Try a series of names. Change one character, just before + * the extension. This should also work for an 8.3 + * file name, when after adding the extension it still is + * the same file as the original. */ - if (mch_stat((char *)tempname, &st_new) == 0) + wp = tempname + STRLEN(tempname) - 5; + if (wp < gettail(tempname)) /* empty file name? */ + wp = gettail(tempname); + for (;;) { -#ifdef UNIX - /* - * Check if tempfile is same as original file. May happen - * when modname() gave the same file back. E.g. silly - * link, or file name-length reached. Try again with - * shortname set. - */ - if (!shortname && st_new.st_dev == st_old.st_dev - && st_new.st_ino == st_old.st_ino) - { - vim_free(tempname); - tempname = NULL; - shortname = TRUE; - continue; - } -#endif /* - * Try another name. Change one character, just before - * the extension. This should also work for an 8.3 - * file name, when after adding the extension it still is - * the same file as the original. + * Check if tempfile already exists. Never overwrite an + * existing file! */ - wp = tempname + STRLEN(tempname) - 5; - if (wp < gettail(tempname)) /* empty file name? */ - wp = gettail(tempname); - for (*wp = 'z'; mch_stat((char *)tempname, &st_new) == 0; - --*wp) + if (mch_stat((char *)tempname, &st_new) == 0) { +#ifdef UNIX /* - * They all exist? Must be something wrong! Don't - * write the viminfo file then. + * Check if tempfile is same as original file. May happen + * when modname() gave the same file back. E.g. silly + * link, or file name-length reached. Try again with + * shortname set. */ - if (*wp == 'a') + if (!shortname && st_new.st_dev == st_old.st_dev + && st_new.st_ino == st_old.st_ino) { - vim_free(tempname); - tempname = NULL; + VIM_CLEAR(tempname); + shortname = TRUE; break; } +#endif } - } - break; - } - - if (tempname != NULL) - { + else + { + /* Try creating the file exclusively. This may fail if + * another Vim tries to do it at the same time. */ #ifdef VMS - /* fdopen() fails for some reason */ - umask_save = umask(077); - fp_out = mch_fopen((char *)tempname, WRITEBIN); - (void)umask(umask_save); + /* fdopen() fails for some reason */ + umask_save = umask(077); + fp_out = mch_fopen((char *)tempname, WRITEBIN); + (void)umask(umask_save); #else - int fd; + int fd; - /* Use mch_open() to be able to use O_NOFOLLOW and set file - * protection: - * Unix: same as original file, but strip s-bit. Reset umask to - * avoid it getting in the way. - * Others: r&w for user only. */ + /* Use mch_open() to be able to use O_NOFOLLOW and set file + * protection: + * Unix: same as original file, but strip s-bit. Reset + * umask to avoid it getting in the way. + * Others: r&w for user only. */ # ifdef UNIX - umask_save = umask(0); - fd = mch_open((char *)tempname, - O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, - (int)((st_old.st_mode & 0777) | 0600)); - (void)umask(umask_save); + umask_save = umask(0); + fd = mch_open((char *)tempname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, + (int)((st_old.st_mode & 0777) | 0600)); + (void)umask(umask_save); # else - fd = mch_open((char *)tempname, - O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); + fd = mch_open((char *)tempname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); # endif - if (fd < 0) - fp_out = NULL; - else - fp_out = fdopen(fd, WRITEBIN); + if (fd < 0) + { + fp_out = NULL; +# ifdef EEXIST + /* Avoid trying lots of names while the problem is lack + * of premission, only retry if the file already + * exists. */ + if (errno != EEXIST) + break; +# endif + } + else + fp_out = fdopen(fd, WRITEBIN); #endif /* VMS */ + if (fp_out != NULL) + break; + } - /* - * If we can't create in the same directory, try creating a - * "normal" temp file. - */ - if (fp_out == NULL) - { - vim_free(tempname); - if ((tempname = vim_tempname('o')) != NULL) - fp_out = mch_fopen((char *)tempname, WRITEBIN); + /* Assume file exists, try again with another name. */ + if (next_char == 'a' - 1) + { + /* They all exist? Must be something wrong! Don't write + * the viminfo file then. */ + EMSG2(_("E929: Too many viminfo temp files, like %s!"), + tempname); + break; + } + *wp = next_char; + --next_char; } + if (tempname != NULL) + break; + /* continue if shortname was set */ + } + #if defined(UNIX) && defined(HAVE_FCHOWN) + if (tempname != NULL && fp_out != NULL) + { + stat_T tmp_st; + /* - * Make sure the owner can read/write it. This only works for - * root. + * Make sure the original owner can read/write the tempfile and + * otherwise preserve permissions, making sure the group matches. */ - if (fp_out != NULL) - ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); -#endif + if (mch_stat((char *)tempname, &tmp_st) >= 0) + { + if (st_old.st_uid != tmp_st.st_uid) + /* Changing the owner might fail, in which case the + * file will now owned by the current user, oh well. */ + ignored = fchown(fileno(fp_out), st_old.st_uid, -1); + if (st_old.st_gid != tmp_st.st_gid + && fchown(fileno(fp_out), -1, st_old.st_gid) == -1) + /* can't set the group to what it should be, remove + * group permissions */ + (void)mch_setperm(tempname, 0600); + } + else + /* can't stat the file, set conservative permissions */ + (void)mch_setperm(tempname, 0600); } +#endif } /* @@ -1999,26 +2075,30 @@ write_viminfo(file, forceit) viminfo_errcnt = 0; do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS)); - fclose(fp_out); /* errors are ignored !? */ + if (fclose(fp_out) == EOF) + ++viminfo_errcnt; + if (fp_in != NULL) { fclose(fp_in); /* In case of an error keep the original viminfo file. Otherwise * rename the newly written file. Give an error if that fails. */ - if (viminfo_errcnt == 0 && vim_rename(tempname, fname) == -1) + if (viminfo_errcnt == 0) { - ++viminfo_errcnt; - EMSG2(_("E886: Can't rename viminfo file to %s!"), fname); + if (vim_rename(tempname, fname) == -1) + { + ++viminfo_errcnt; + EMSG2(_("E886: Can't rename viminfo file to %s!"), fname); + } +# ifdef WIN3264 + /* If the viminfo file was hidden then also hide the new file. */ + else if (hidden) + mch_hide(fname); +# endif } if (viminfo_errcnt > 0) mch_remove(tempname); - -#ifdef WIN3264 - /* If the viminfo file was hidden then also hide the new file. */ - if (perm > 0 && (perm & FILE_ATTRIBUTE_HIDDEN)) - mch_hide(fname); -#endif } end: @@ -2035,21 +2115,25 @@ write_viminfo(file, forceit) * Returns an allocated string. NULL when out of memory. */ static char_u * -viminfo_filename(file) - char_u *file; +viminfo_filename(char_u *file) { if (file == NULL || *file == NUL) { - if (use_viminfo != NULL) - file = use_viminfo; + if (*p_viminfofile != NUL) + file = p_viminfofile; else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL) { #ifdef VIMINFO_FILE2 - /* don't use $HOME when not defined (turned into "c:/"!). */ # ifdef VMS if (mch_getenv((char_u *)"SYS$LOGIN") == NULL) # else +# ifdef MSWIN + /* Use $VIM only if $HOME is the default "C:/". */ + if (STRCMP(vim_getenv((char_u *)"HOME", NULL), "C:/") == 0 + && mch_getenv((char_u *)"HOME") == NULL) +# else if (mch_getenv((char_u *)"HOME") == NULL) +# endif # endif { /* don't use $VIM when not available. */ @@ -2073,15 +2157,13 @@ viminfo_filename(file) * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo(). */ static void -do_viminfo(fp_in, fp_out, flags) - FILE *fp_in; - FILE *fp_out; - int flags; +do_viminfo(FILE *fp_in, FILE *fp_out, int flags) { - int count = 0; int eof = FALSE; vir_T vir; int merge = FALSE; + int do_copy_marks = FALSE; + garray_T buflist; if ((vir.vir_line = alloc(LSIZE)) == NULL) return; @@ -2089,11 +2171,21 @@ do_viminfo(fp_in, fp_out, flags) #ifdef FEAT_MBYTE vir.vir_conv.vc_type = CONV_NONE; #endif + ga_init2(&vir.vir_barlines, (int)sizeof(char_u *), 100); + vir.vir_version = -1; if (fp_in != NULL) { if (flags & VIF_WANT_INFO) { + if (fp_out != NULL) + { + /* Registers and marks are read and kept separate from what + * this Vim is using. They are merged when writing. */ + prepare_viminfo_registers(); + prepare_viminfo_marks(); + } + eof = read_viminfo_up_to_marks(&vir, flags & VIF_FORCEIT, fp_out != NULL); merge = TRUE; @@ -2103,13 +2195,18 @@ do_viminfo(fp_in, fp_out, flags) while (!(eof = viminfo_readline(&vir)) && vir.vir_line[0] != '>') ; + + do_copy_marks = (flags & + (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)); } + if (fp_out != NULL) { /* Write the info: */ fprintf(fp_out, _("# This viminfo file was generated by Vim %s.\n"), VIM_VERSION_MEDIUM); fputs(_("# You may edit it if you're careful!\n\n"), fp_out); + write_viminfo_version(fp_out); #ifdef FEAT_MBYTE fputs(_("# Value of 'encoding' when this file was written\n"), fp_out); fprintf(fp_out, "*encoding=%s\n\n", p_enc); @@ -2120,22 +2217,33 @@ do_viminfo(fp_in, fp_out, flags) write_viminfo_history(fp_out, merge); #endif write_viminfo_registers(fp_out); + finish_viminfo_registers(); #ifdef FEAT_EVAL write_viminfo_varlist(fp_out); #endif write_viminfo_filemarks(fp_out); + finish_viminfo_marks(); write_viminfo_bufferlist(fp_out); - count = write_viminfo_marks(fp_out); + write_viminfo_barlines(&vir, fp_out); + + if (do_copy_marks) + ga_init2(&buflist, sizeof(buf_T *), 50); + write_viminfo_marks(fp_out, do_copy_marks ? &buflist : NULL); + } + + if (do_copy_marks) + { + copy_viminfo_marks(&vir, fp_out, &buflist, eof, flags); + if (fp_out != NULL) + ga_clear(&buflist); } - if (fp_in != NULL - && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT))) - copy_viminfo_marks(&vir, fp_out, count, eof, flags); vim_free(vir.vir_line); #ifdef FEAT_MBYTE if (vir.vir_conv.vc_type != CONV_NONE) convert_setup(&vir.vir_conv, NULL, NULL); #endif + ga_clear_strings(&vir.vir_barlines); } /* @@ -2144,17 +2252,19 @@ do_viminfo(fp_in, fp_out, flags) * are local to a file. Returns TRUE when end-of-file is reached. -- webb */ static int -read_viminfo_up_to_marks(virp, forceit, writing) - vir_T *virp; - int forceit; - int writing; +read_viminfo_up_to_marks( + vir_T *virp, + int forceit, + int writing) { int eof; buf_T *buf; + int got_encoding = FALSE; #ifdef FEAT_CMDHIST prepare_viminfo_history(forceit ? 9999 : 0, writing); #endif + eof = viminfo_readline(virp); while (!eof && virp->vir_line[0] != '>') { @@ -2162,7 +2272,6 @@ read_viminfo_up_to_marks(virp, forceit, writing) { /* Characters reserved for future expansion, ignored now */ case '+': /* "+40 /path/dir file", for running vim without args */ - case '|': /* to be defined */ case '^': /* to be defined */ case '<': /* long line - ignored */ /* A comment or empty line. */ @@ -2172,7 +2281,12 @@ read_viminfo_up_to_marks(virp, forceit, writing) case '#': eof = viminfo_readline(virp); break; + case '|': + eof = read_viminfo_barline(virp, got_encoding, + forceit, writing); + break; case '*': /* "*encoding=value" */ + got_encoding = TRUE; eof = viminfo_encoding(virp); break; case '!': /* global variable */ @@ -2186,7 +2300,15 @@ read_viminfo_up_to_marks(virp, forceit, writing) eof = read_viminfo_bufferlist(virp, writing); break; case '"': - eof = read_viminfo_register(virp, forceit); + /* When registers are in bar lines skip the old style register + * lines. */ + if (virp->vir_version < VIMINFO_VERSION_WITH_REGISTERS) + eof = read_viminfo_register(virp, forceit); + else + do { + eof = viminfo_readline(virp); + } while (!eof && (virp->vir_line[0] == TAB + || virp->vir_line[0] == '<')); break; case '/': /* Search string */ case '&': /* Substitute search string */ @@ -2201,14 +2323,21 @@ read_viminfo_up_to_marks(virp, forceit, writing) case '=': case '@': #ifdef FEAT_CMDHIST - eof = read_viminfo_history(virp, writing); -#else - eof = viminfo_readline(virp); + /* When history is in bar lines skip the old style history + * lines. */ + if (virp->vir_version < VIMINFO_VERSION_WITH_HISTORY) + eof = read_viminfo_history(virp, writing); + else #endif + eof = viminfo_readline(virp); break; case '-': case '\'': - eof = read_viminfo_filemark(virp, forceit); + /* When file marks are in bar lines skip the old style lines. */ + if (virp->vir_version < VIMINFO_VERSION_WITH_MARKS) + eof = read_viminfo_filemark(virp, forceit); + else + eof = viminfo_readline(virp); break; default: if (viminfo_error("E575: ", _("Illegal starting char"), @@ -2223,11 +2352,11 @@ read_viminfo_up_to_marks(virp, forceit, writing) #ifdef FEAT_CMDHIST /* Finish reading history items. */ if (!writing) - finish_viminfo_history(); + finish_viminfo_history(virp); #endif /* Change file names to buffer numbers for fmarks. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) fmarks_check_names(buf); return eof; @@ -2239,8 +2368,7 @@ read_viminfo_up_to_marks(virp, forceit, writing) * conversion of text with iconv() in viminfo_readstring(). */ static int -viminfo_encoding(virp) - vir_T *virp; +viminfo_encoding(vir_T *virp) { #ifdef FEAT_MBYTE char_u *p; @@ -2269,15 +2397,14 @@ viminfo_encoding(virp) * Returns TRUE for end-of-file; */ int -viminfo_readline(virp) - vir_T *virp; +viminfo_readline(vir_T *virp) { return vim_fgets(virp->vir_line, LSIZE, virp->vir_fd); } /* - * check string read from viminfo file - * remove '\n' at the end of the line + * Check string read from viminfo file. + * Remove '\n' at the end of the line. * - replace CTRL-V CTRL-V with CTRL-V * - replace CTRL-V 'n' with '\n' * @@ -2286,10 +2413,10 @@ viminfo_readline(virp) * Return the string in allocated memory (NULL when out of memory). */ char_u * -viminfo_readstring(virp, off, convert) - vir_T *virp; - int off; /* offset for virp->vir_line */ - int convert UNUSED; /* convert the string */ +viminfo_readstring( + vir_T *virp, + int off, /* offset for virp->vir_line */ + int convert UNUSED) /* convert the string */ { char_u *retval; char_u *s, *d; @@ -2359,9 +2486,7 @@ viminfo_readstring(virp, off, convert) * - write " < <string> \n " in second line */ void -viminfo_writestring(fd, p) - FILE *fd; - char_u *p; +viminfo_writestring(FILE *fd, char_u *p) { int c; char_u *s; @@ -2393,117 +2518,485 @@ viminfo_writestring(fd, p) } putc('\n', fd); } -#endif /* FEAT_VIMINFO */ /* - * Implementation of ":fixdel", also used by get_stty(). - * <BS> resulting <Del> - * ^? ^H - * not ^? ^? + * Write a string in quotes that barline_parse() can read back. + * Breaks the line in less than LSIZE pieces when needed. + * Returns remaining characters in the line. */ - void -do_fixdel(eap) - exarg_T *eap UNUSED; + int +barline_writestring(FILE *fd, char_u *s, int remaining_start) { - char_u *p; - - p = find_termcode((char_u *)"kb"); - add_termcode((char_u *)"kD", p != NULL - && *p == DEL ? (char_u *)CTRL_H_STR : DEL_STR, FALSE); -} + char_u *p; + int remaining = remaining_start; + int len = 2; - void -print_line_no_prefix(lnum, use_number, list) - linenr_T lnum; - int use_number; - int list; -{ - char_u numbuf[30]; + /* Count the number of characters produced, including quotes. */ + for (p = s; *p != NUL; ++p) + { + if (*p == NL) + len += 2; + else if (*p == '"' || *p == '\\') + len += 2; + else + ++len; + } + if (len > remaining - 2) + { + fprintf(fd, ">%d\n|<", len); + remaining = LSIZE - 20; + } - if (curwin->w_p_nu || use_number) + putc('"', fd); + for (p = s; *p != NUL; ++p) { - vim_snprintf((char *)numbuf, sizeof(numbuf), - "%*ld ", number_width(curwin), (long)lnum); - msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */ + if (*p == NL) + { + putc('\\', fd); + putc('n', fd); + --remaining; + } + else if (*p == '"' || *p == '\\') + { + putc('\\', fd); + putc(*p, fd); + --remaining; + } + else + putc(*p, fd); + --remaining; + + if (remaining < 3) + { + putc('\n', fd); + putc('|', fd); + putc('<', fd); + /* Leave enough space for another continuation. */ + remaining = LSIZE - 20; + } } - msg_prt_line(ml_get(lnum), list); + putc('"', fd); + return remaining - 2; } /* - * Print a text line. Also in silent mode ("ex -s"). + * Parse a viminfo line starting with '|'. + * Add each decoded value to "values". + * Returns TRUE if the next line is to be read after using the parsed values. */ - void -print_line(lnum, use_number, list) - linenr_T lnum; - int use_number; - int list; + static int +barline_parse(vir_T *virp, char_u *text, garray_T *values) { - int save_silent = silent_mode; + char_u *p = text; + char_u *nextp = NULL; + char_u *buf = NULL; + bval_T *value; + int i; + int allocated = FALSE; + int eof; +#ifdef FEAT_MBYTE + char_u *sconv; + int converted; +#endif - msg_start(); - silent_mode = FALSE; - info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ - print_line_no_prefix(lnum, use_number, list); - if (save_silent) + while (*p == ',') { - msg_putchar('\n'); - cursor_on(); /* msg_start() switches it off */ - out_flush(); - silent_mode = save_silent; - } - info_message = FALSE; -} + ++p; + if (ga_grow(values, 1) == FAIL) + break; + value = (bval_T *)(values->ga_data) + values->ga_len; - int -rename_buffer(new_fname) - char_u *new_fname; -{ - char_u *fname, *sfname, *xfname; - buf_T *buf; + if (*p == '>') + { + /* Need to read a continuation line. Put strings in allocated + * memory, because virp->vir_line is overwritten. */ + if (!allocated) + { + for (i = 0; i < values->ga_len; ++i) + { + bval_T *vp = (bval_T *)(values->ga_data) + i; -#ifdef FEAT_AUTOCMD - buf = curbuf; - apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); - /* buffer changed, don't change name now */ - if (buf != curbuf) - return FAIL; -# ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ - return FAIL; -# endif -#endif - /* - * The name of the current buffer will be changed. - * A new (unlisted) buffer entry needs to be made to hold the old file - * name, which will become the alternate file name. - * But don't set the alternate file name if the buffer didn't have a - * name. - */ - fname = curbuf->b_ffname; - sfname = curbuf->b_sfname; - xfname = curbuf->b_fname; - curbuf->b_ffname = NULL; - curbuf->b_sfname = NULL; - if (setfname(curbuf, new_fname, NULL, TRUE) == FAIL) - { - curbuf->b_ffname = fname; - curbuf->b_sfname = sfname; - return FAIL; - } - curbuf->b_flags |= BF_NOTEDITED; - if (xfname != NULL && *xfname != NUL) - { - buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0); + if (vp->bv_type == BVAL_STRING && !vp->bv_allocated) + { + vp->bv_string = vim_strnsave(vp->bv_string, vp->bv_len); + vp->bv_allocated = TRUE; + } + } + allocated = TRUE; + } + + if (vim_isdigit(p[1])) + { + size_t len; + size_t todo; + size_t n; + + /* String value was split into lines that are each shorter + * than LSIZE: + * |{bartype},>{length of "{text}{text2}"} + * |<"{text1} + * |<{text2}",{value} + * Length includes the quotes. + */ + ++p; + len = getdigits(&p); + buf = alloc((int)(len + 1)); + if (buf == NULL) + return TRUE; + p = buf; + for (todo = len; todo > 0; todo -= n) + { + eof = viminfo_readline(virp); + if (eof || virp->vir_line[0] != '|' + || virp->vir_line[1] != '<') + { + /* File was truncated or garbled. Read another line if + * this one starts with '|'. */ + vim_free(buf); + return eof || virp->vir_line[0] == '|'; + } + /* Get length of text, excluding |< and NL chars. */ + n = STRLEN(virp->vir_line); + while (n > 0 && (virp->vir_line[n - 1] == NL + || virp->vir_line[n - 1] == CAR)) + --n; + n -= 2; + if (n > todo) + { + /* more values follow after the string */ + nextp = virp->vir_line + 2 + todo; + n = todo; + } + mch_memmove(p, virp->vir_line + 2, n); + p += n; + } + *p = NUL; + p = buf; + } + else + { + /* Line ending in ">" continues in the next line: + * |{bartype},{lots of values},> + * |<{value},{value} + */ + eof = viminfo_readline(virp); + if (eof || virp->vir_line[0] != '|' + || virp->vir_line[1] != '<') + /* File was truncated or garbled. Read another line if + * this one starts with '|'. */ + return eof || virp->vir_line[0] == '|'; + p = virp->vir_line + 2; + } + } + + if (isdigit(*p)) + { + value->bv_type = BVAL_NR; + value->bv_nr = getdigits(&p); + ++values->ga_len; + } + else if (*p == '"') + { + int len = 0; + char_u *s = p; + + /* Unescape special characters in-place. */ + ++p; + while (*p != '"') + { + if (*p == NL || *p == NUL) + return TRUE; /* syntax error, drop the value */ + if (*p == '\\') + { + ++p; + if (*p == 'n') + s[len++] = '\n'; + else + s[len++] = *p; + ++p; + } + else + s[len++] = *p++; + } + ++p; + s[len] = NUL; + +#ifdef FEAT_MBYTE + converted = FALSE; + if (virp->vir_conv.vc_type != CONV_NONE && *s != NUL) + { + sconv = string_convert(&virp->vir_conv, s, NULL); + if (sconv != NULL) + { + if (s == buf) + vim_free(s); + s = sconv; + buf = s; + converted = TRUE; + } + } +#endif + /* Need to copy in allocated memory if the string wasn't allocated + * above and we did allocate before, thus vir_line may change. */ + if (s != buf && allocated) + s = vim_strsave(s); + value->bv_string = s; + value->bv_type = BVAL_STRING; + value->bv_len = len; + value->bv_allocated = allocated +#ifdef FEAT_MBYTE + || converted +#endif + ; + ++values->ga_len; + if (nextp != NULL) + { + /* values following a long string */ + p = nextp; + nextp = NULL; + } + } + else if (*p == ',') + { + value->bv_type = BVAL_EMPTY; + ++values->ga_len; + } + else + break; + } + return TRUE; +} + + static int +read_viminfo_barline(vir_T *virp, int got_encoding, int force, int writing) +{ + char_u *p = virp->vir_line + 1; + int bartype; + garray_T values; + bval_T *vp; + int i; + int read_next = TRUE; + + /* The format is: |{bartype},{value},... + * For a very long string: + * |{bartype},>{length of "{text}{text2}"} + * |<{text1} + * |<{text2},{value} + * For a long line not using a string + * |{bartype},{lots of values},> + * |<{value},{value} + */ + if (*p == '<') + { + /* Continuation line of an unrecognized item. */ + if (writing) + ga_add_string(&virp->vir_barlines, virp->vir_line); + } + else + { + ga_init2(&values, sizeof(bval_T), 20); + bartype = getdigits(&p); + switch (bartype) + { + case BARTYPE_VERSION: + /* Only use the version when it comes before the encoding. + * If it comes later it was copied by a Vim version that + * doesn't understand the version. */ + if (!got_encoding) + { + read_next = barline_parse(virp, p, &values); + vp = (bval_T *)values.ga_data; + if (values.ga_len > 0 && vp->bv_type == BVAL_NR) + virp->vir_version = vp->bv_nr; + } + break; + + case BARTYPE_HISTORY: + read_next = barline_parse(virp, p, &values); + handle_viminfo_history(&values, writing); + break; + + case BARTYPE_REGISTER: + read_next = barline_parse(virp, p, &values); + handle_viminfo_register(&values, force); + break; + + case BARTYPE_MARK: + read_next = barline_parse(virp, p, &values); + handle_viminfo_mark(&values, force); + break; + + default: + /* copy unrecognized line (for future use) */ + if (writing) + ga_add_string(&virp->vir_barlines, virp->vir_line); + } + for (i = 0; i < values.ga_len; ++i) + { + vp = (bval_T *)values.ga_data + i; + if (vp->bv_type == BVAL_STRING && vp->bv_allocated) + vim_free(vp->bv_string); + } + ga_clear(&values); + } + + if (read_next) + return viminfo_readline(virp); + return FALSE; +} + + static void +write_viminfo_version(FILE *fp_out) +{ + fprintf(fp_out, "# Viminfo version\n|%d,%d\n\n", + BARTYPE_VERSION, VIMINFO_VERSION); +} + + static void +write_viminfo_barlines(vir_T *virp, FILE *fp_out) +{ + int i; + garray_T *gap = &virp->vir_barlines; + int seen_useful = FALSE; + char *line; + + if (gap->ga_len > 0) + { + fputs(_("\n# Bar lines, copied verbatim:\n"), fp_out); + + /* Skip over continuation lines until seeing a useful line. */ + for (i = 0; i < gap->ga_len; ++i) + { + line = ((char **)(gap->ga_data))[i]; + if (seen_useful || line[1] != '<') + { + fputs(line, fp_out); + seen_useful = TRUE; + } + } + } +} +#endif /* FEAT_VIMINFO */ + +/* + * Return the current time in seconds. Calls time(), unless test_settime() + * was used. + */ + time_T +vim_time(void) +{ +# ifdef FEAT_EVAL + return time_for_testing == 0 ? time(NULL) : time_for_testing; +# else + return time(NULL); +# endif +} + +/* + * Implementation of ":fixdel", also used by get_stty(). + * <BS> resulting <Del> + * ^? ^H + * not ^? ^? + */ + void +do_fixdel(exarg_T *eap UNUSED) +{ + char_u *p; + + p = find_termcode((char_u *)"kb"); + add_termcode((char_u *)"kD", p != NULL + && *p == DEL ? (char_u *)CTRL_H_STR : DEL_STR, FALSE); +} + + void +print_line_no_prefix( + linenr_T lnum, + int use_number, + int list) +{ + char_u numbuf[30]; + + if (curwin->w_p_nu || use_number) + { + vim_snprintf((char *)numbuf, sizeof(numbuf), + "%*ld ", number_width(curwin), (long)lnum); + msg_puts_attr(numbuf, HL_ATTR(HLF_N)); /* Highlight line nrs */ + } + msg_prt_line(ml_get(lnum), list); +} + +/* + * Print a text line. Also in silent mode ("ex -s"). + */ + void +print_line(linenr_T lnum, int use_number, int list) +{ + int save_silent = silent_mode; + + /* apply :filter /pat/ */ + if (message_filtered(ml_get(lnum))) + return; + + msg_start(); + silent_mode = FALSE; + info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ + print_line_no_prefix(lnum, use_number, list); + if (save_silent) + { + msg_putchar('\n'); + cursor_on(); /* msg_start() switches it off */ + out_flush(); + silent_mode = save_silent; + } + info_message = FALSE; +} + + int +rename_buffer(char_u *new_fname) +{ + char_u *fname, *sfname, *xfname; + buf_T *buf; + + buf = curbuf; + apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); + /* buffer changed, don't change name now */ + if (buf != curbuf) + return FAIL; +#ifdef FEAT_EVAL + if (aborting()) /* autocmds may abort script processing */ + return FAIL; +#endif + /* + * The name of the current buffer will be changed. + * A new (unlisted) buffer entry needs to be made to hold the old file + * name, which will become the alternate file name. + * But don't set the alternate file name if the buffer didn't have a + * name. + */ + fname = curbuf->b_ffname; + sfname = curbuf->b_sfname; + xfname = curbuf->b_fname; + curbuf->b_ffname = NULL; + curbuf->b_sfname = NULL; + if (setfname(curbuf, new_fname, NULL, TRUE) == FAIL) + { + curbuf->b_ffname = fname; + curbuf->b_sfname = sfname; + return FAIL; + } + curbuf->b_flags |= BF_NOTEDITED; + if (xfname != NULL && *xfname != NUL) + { + buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0); if (buf != NULL && !cmdmod.keepalt) curwin->w_alt_fnum = buf->b_fnum; } vim_free(fname); vim_free(sfname); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); -#endif + /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; return OK; } @@ -2511,8 +3004,7 @@ rename_buffer(new_fname) * ":file[!] [fname]". */ void -ex_file(eap) - exarg_T *eap; +ex_file(exarg_T *eap) { /* ":0file" removes the file name. Check for illegal uses ":3file", * "0file name", etc. */ @@ -2531,15 +3023,16 @@ ex_file(eap) return; } /* print full file name if :cd used */ - fileinfo(FALSE, FALSE, eap->forceit); + if (!shortmess(SHM_FILEINFO)) + fileinfo(FALSE, FALSE, eap->forceit); + redraw_tabline = TRUE; } /* * ":update". */ void -ex_update(eap) - exarg_T *eap; +ex_update(exarg_T *eap) { if (curbufIsChanged()) (void)do_write(eap); @@ -2549,8 +3042,7 @@ ex_update(eap) * ":write" and ":saveas". */ void -ex_write(eap) - exarg_T *eap; +ex_write(exarg_T *eap) { if (eap->usefilter) /* input lines to shell command */ do_bang(1, eap, FALSE, TRUE, FALSE); @@ -2567,8 +3059,7 @@ ex_write(eap) * return FAIL for failure, OK otherwise */ int -do_write(eap) - exarg_T *eap; +do_write(exarg_T *eap) { int other; char_u *fname = NULL; /* init to shut up gcc */ @@ -2579,6 +3070,7 @@ do_write(eap) char_u *browse_file = NULL; #endif buf_T *alt_buf = NULL; + int name_was_missing; if (not_writing()) /* check 'write' option */ return FAIL; @@ -2681,22 +3173,20 @@ do_write(eap) { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { -#ifdef FEAT_AUTOCMD buf_T *was_curbuf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) -# else +#else if (curbuf != was_curbuf) -# endif +#endif { /* buffer changed, don't change name now */ retval = FAIL; goto theend; } -#endif /* Exchange the file names for the current and the alternate * buffer. This makes it look like we are now editing the buffer * under the new name. Must be done before buf_write(), because @@ -2712,7 +3202,7 @@ do_write(eap) alt_buf->b_sfname = curbuf->b_sfname; curbuf->b_sfname = fname; buf_name_changed(curbuf); -#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf); if (!alt_buf->b_p_bl) @@ -2720,11 +3210,11 @@ do_write(eap) alt_buf->b_p_bl = TRUE; apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf); } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) -# else +#else if (curbuf != was_curbuf) -# endif +#endif { /* buffer changed, don't write the file */ retval = FAIL; @@ -2736,16 +3226,17 @@ do_write(eap) { if (au_has_group((char_u *)"filetypedetect")) (void)do_doautocmd((char_u *)"filetypedetect BufRead", - TRUE); + TRUE, NULL); do_modelines(0); } /* Autocommands may have changed buffer names, esp. when * 'autochdir' is set. */ fname = curbuf->b_sfname; -#endif } + name_was_missing = curbuf->b_ffname == NULL; + retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2, eap, eap->append, eap->forceit, TRUE, FALSE); @@ -2755,12 +3246,15 @@ do_write(eap) if (retval == OK) { curbuf->b_p_ro = FALSE; -#ifdef FEAT_WINDOWS redraw_tabline = TRUE; -#endif } - /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + } + + /* Change directories when the 'acd' option is set and the file name + * got changed or set. */ + if (eap->cmdidx == CMD_saveas || name_was_missing) + { + DO_AUTOCHDIR; } } @@ -2779,13 +3273,13 @@ do_write(eap) * Return OK if it's OK, FAIL if it is not. */ int -check_overwrite(eap, buf, fname, ffname, other) - exarg_T *eap; - buf_T *buf; - char_u *fname; /* file name to be used (can differ from +check_overwrite( + exarg_T *eap, + buf_T *buf, + char_u *fname, /* file name to be used (can differ from buf->ffname) */ - char_u *ffname; /* full path version of fname */ - int other; /* writing under other name */ + char_u *ffname, /* full path version of fname */ + int other) /* writing under other name */ { /* * write to other file or b_flags set or not writing the whole file: @@ -2898,8 +3392,7 @@ check_overwrite(eap, buf, fname, ffname, other) * Handle ":wnext", ":wNext" and ":wprevious" commands. */ void -ex_wnext(eap) - exarg_T *eap; +ex_wnext(exarg_T *eap) { int i; @@ -2917,8 +3410,7 @@ ex_wnext(eap) * ":wall", ":wqall" and ":xall": Write all changed files (and exit). */ void -do_wqall(eap) - exarg_T *eap; +do_wqall(exarg_T *eap) { buf_T *buf; int error = 0; @@ -2927,9 +3419,17 @@ do_wqall(eap) if (eap->cmdidx == CMD_xall || eap->cmdidx == CMD_wqall) exiting = TRUE; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { - if (bufIsChanged(buf)) +#ifdef FEAT_TERMINAL + if (exiting && term_job_running(buf->b_term)) + { + no_write_message_nobang(buf); + ++error; + } + else +#endif + if (bufIsChanged(buf) && !bt_dontwrite(buf)) { /* * Check if there is a reason the buffer cannot be written: @@ -2961,13 +3461,14 @@ do_wqall(eap) } else { + bufref_T bufref; + + set_bufref(&bufref, buf); if (buf_write_all(buf, eap->forceit) == FAIL) ++error; -#ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) buf = firstbuf; -#endif } eap->forceit = save_forceit; /* check_overwrite() may set it */ } @@ -2985,7 +3486,7 @@ do_wqall(eap) * Return TRUE and give a message when it's not st. */ int -not_writing() +not_writing(void) { if (p_write) return FALSE; @@ -2999,11 +3500,9 @@ not_writing() * message when the buffer is readonly. */ static int -check_readonly(forceit, buf) - int *forceit; - buf_T *buf; +check_readonly(int *forceit, buf_T *buf) { - struct stat st; + stat_T st; /* Handle a file being readonly when the 'readonly' option is set or when * the file exists and permissions are read-only. @@ -3049,31 +3548,32 @@ check_readonly(forceit, buf) /* * Try to abandon current file and edit a new or existing file. - * 'fnum' is the number of the file, if zero use ffname/sfname. + * "fnum" is the number of the file, if zero use ffname/sfname. + * "lnum" is the line number for the cursor in the new file (if non-zero). * - * Return 1 for "normal" error, 2 for "not written" error, 0 for success - * -1 for successfully opening another file. - * 'lnum' is the line number for the cursor in the new file (if non-zero). + * Return: + * GETFILE_ERROR for "normal" error, + * GETFILE_NOT_WRITTEN for "not written" error, + * GETFILE_SAME_FILE for success + * GETFILE_OPEN_OTHER for successfully opening another file. */ int -getfile(fnum, ffname, sfname, setpm, lnum, forceit) - int fnum; - char_u *ffname; - char_u *sfname; - int setpm; - linenr_T lnum; - int forceit; +getfile( + int fnum, + char_u *ffname, + char_u *sfname, + int setpm, + linenr_T lnum, + int forceit) { int other; int retval; char_u *free_me = NULL; if (text_locked()) - return 1; -#ifdef FEAT_AUTOCMD + return GETFILE_ERROR; if (curbuf_locked()) - return 1; -#endif + return GETFILE_ERROR; if (fnum == 0) { @@ -3087,7 +3587,7 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit) if (other) ++no_wait_return; /* don't wait for autowrite message */ - if (other && !forceit && curbuf->b_nwindows == 1 && !P_HID(curbuf) + if (other && !forceit && curbuf->b_nwindows == 1 && !buf_hide(curbuf) && curbufIsChanged() && autowrite(curbuf, forceit) == FAIL) { #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) @@ -3098,8 +3598,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit) { if (other) --no_wait_return; - EMSG(_(e_nowrtmsg)); - retval = 2; /* file has been changed */ + no_write_message(); + retval = GETFILE_NOT_WRITTEN; /* file has been changed */ goto theend; } } @@ -3113,14 +3613,14 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit) curwin->w_cursor.lnum = lnum; check_cursor_lnum(); beginline(BL_SOL | BL_FIX); - retval = 0; /* it's in the same file */ + retval = GETFILE_SAME_FILE; /* it's in the same file */ } else if (do_ecmd(fnum, ffname, sfname, NULL, lnum, - (P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0), + (buf_hide(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0), curwin) == OK) - retval = -1; /* opened another file */ + retval = GETFILE_OPEN_OTHER; /* opened another file */ else - retval = 1; /* error encountered */ + retval = GETFILE_ERROR; /* error encountered */ theend: vim_free(free_me); @@ -3157,34 +3657,33 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit) * return FAIL for failure, OK otherwise */ int -do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) - int fnum; - char_u *ffname; - char_u *sfname; - exarg_T *eap; /* can be NULL! */ - linenr_T newlnum; - int flags; - win_T *oldwin; +do_ecmd( + int fnum, + char_u *ffname, + char_u *sfname, + exarg_T *eap, /* can be NULL! */ + linenr_T newlnum, + int flags, + win_T *oldwin) { int other_file; /* TRUE if editing another file */ int oldbuf; /* TRUE if using existing buffer */ -#ifdef FEAT_AUTOCMD int auto_buf = FALSE; /* TRUE if autocommands brought us into the buffer unexpectedly */ char_u *new_name = NULL; +#if defined(FEAT_EVAL) int did_set_swapcommand = FALSE; #endif buf_T *buf; -#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) - buf_T *old_curbuf = curbuf; -#endif + bufref_T bufref; + bufref_T old_curbuf; char_u *free_fname = NULL; #ifdef FEAT_BROWSE char_u *browse_file = NULL; #endif int retval = FAIL; long n; - linenr_T lnum; + pos_T orig_pos; linenr_T topline = 0; int newcol = -1; int solcol = -1; @@ -3197,9 +3696,11 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) int did_get_winopts = FALSE; #endif int readfile_flags = 0; + int did_inc_redrawing_disabled = FALSE; if (eap != NULL) command = eap->do_ecmd_cmd; + set_bufref(&old_curbuf, curbuf); if (fnum != 0) { @@ -3212,11 +3713,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #ifdef FEAT_BROWSE if (cmdmod.browse) { -# ifdef FEAT_AUTOCMD if ( -# ifdef FEAT_GUI +# ifdef FEAT_GUI !gui.in_use && -# endif +# endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: @@ -3225,7 +3725,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) ffname = (char_u *)"."; } else -# endif { browse_file = do_browse(0, (char_u *)_("Edit File"), ffname, NULL, NULL, NULL, curbuf); @@ -3246,10 +3745,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) fname_case(sfname, 0); /* set correct case for sfname */ #endif -#ifdef FEAT_LISTCMDS if ((flags & ECMD_ADDBUF) && (ffname == NULL || *ffname == NUL)) goto theend; -#endif if (ffname == NULL) other_file = TRUE; @@ -3299,7 +3796,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) */ reset_VIsual(); -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if ((command != NULL || newlnum > (linenr_T)0) && *get_vim_var_str(VV_SWAPCOMMAND) == NUL) { @@ -3331,9 +3828,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) */ if (other_file) { -#ifdef FEAT_LISTCMDS if (!(flags & ECMD_ADDBUF)) -#endif { if (!cmdmod.keepalt) curwin->w_alt_fnum = curbuf->b_fnum; @@ -3345,7 +3840,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) buf = buflist_findnr(fnum); else { -#ifdef FEAT_LISTCMDS if (flags & ECMD_ADDBUF) { linenr_T tlnum = 1L; @@ -3359,34 +3853,28 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) (void)buflist_new(ffname, sfname, tlnum, BLN_LISTED); goto theend; } -#endif buf = buflist_new(ffname, sfname, 0L, BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED)); -#ifdef FEAT_AUTOCMD + /* autocommands may change curwin and curbuf */ if (oldwin != NULL) oldwin = curwin; - old_curbuf = curbuf; -#endif + set_bufref(&old_curbuf, curbuf); } if (buf == NULL) goto theend; if (buf->b_ml.ml_mfp == NULL) /* no memfile yet */ { oldbuf = FALSE; - buf->b_nwindows = 0; } else /* existing memfile */ { oldbuf = TRUE; + set_bufref(&bufref, buf); (void)buf_check_timestamp(buf, FALSE); - /* Check if autocommands made buffer invalid or changed the current - * buffer. */ - if (!buf_valid(buf) -#ifdef FEAT_AUTOCMD - || curbuf != old_curbuf -#endif - ) + /* Check if autocommands made the buffer invalid or changed the + * current buffer. */ + if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) goto theend; #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ @@ -3407,11 +3895,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) * Make the (new) buffer the one used by the current window. * If the old buffer becomes unused, free it if ECMD_HIDE is FALSE. * If the current buffer was empty and has no file name, curbuf - * is returned by buflist_new(). + * is returned by buflist_new(), nothing to do here. */ if (buf != curbuf) { -#ifdef FEAT_AUTOCMD /* * Be careful: The autocommands may delete any buffer and change * the current buffer. @@ -3424,65 +3911,70 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) */ if (buf->b_fname != NULL) new_name = vim_strsave(buf->b_fname); - au_new_curbuf = buf; + set_bufref(&au_new_curbuf, buf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); - if (!buf_valid(buf)) /* new buffer has been deleted */ + if (!bufref_valid(&au_new_curbuf)) { + /* new buffer has been deleted */ delbuf_msg(new_name); /* frees new_name */ goto theend; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ { vim_free(new_name); goto theend; } -# endif +#endif if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else { - if (curbuf == old_curbuf) -#endif + win_T *the_curwin = curwin; + + /* Set the w_closing flag to avoid that autocommands close the + * window. And set b_locked for the same reason. */ + the_curwin->w_closing = TRUE; + ++buf->b_locked; + + if (curbuf == old_curbuf.br_buf) buf_copy_options(buf, BCO_ENTER); - /* close the link to the current buffer */ + /* Close the link to the current buffer. This will set + * oldwin->w_buffer to NULL. */ u_sync(FALSE); close_buffer(oldwin, curbuf, (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE); -#ifdef FEAT_AUTOCMD - /* Autocommands may open a new window and leave oldwin open - * which leads to crashes since the above call sets - * oldwin->w_buffer to NULL. */ - if (curwin != oldwin && oldwin != aucmd_win - && win_valid(oldwin) && oldwin->w_buffer == NULL) - win_close(oldwin, FALSE); + the_curwin->w_closing = FALSE; + --buf->b_locked; -# ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ +#ifdef FEAT_EVAL + /* autocmds may abort script processing */ + if (aborting() && curwin->w_buffer != NULL) { vim_free(new_name); goto theend; } -# endif +#endif /* Be careful again, like above. */ - if (!buf_valid(buf)) /* new buffer has been deleted */ + if (!bufref_valid(&au_new_curbuf)) { + /* new buffer has been deleted */ delbuf_msg(new_name); /* frees new_name */ goto theend; } if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else -#endif { #ifdef FEAT_SYN_HL /* * <VN> We could instead free the synblock * and re-attach to buffer, perhaps. */ - if (curwin->w_s == &(curwin->w_buffer->b_s)) + if (curwin->w_buffer == NULL + || curwin->w_s == &(curwin->w_buffer->b_s)) curwin->w_s = &(buf->b_s); #endif curwin->w_buffer = buf; @@ -3507,116 +3999,54 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #ifdef FEAT_SPELL did_get_winopts = TRUE; #endif - -#ifdef FEAT_AUTOCMD } vim_free(new_name); - au_new_curbuf = NULL; -#endif + au_new_curbuf.br_buf = NULL; + au_new_curbuf.br_buf_free_count = 0; } - else - ++curbuf->b_nwindows; curwin->w_pcmark.lnum = 1; curwin->w_pcmark.col = 0; } else /* !other_file */ { - if ( -#ifdef FEAT_LISTCMDS - (flags & ECMD_ADDBUF) || -#endif - check_fname() == FAIL) + if ((flags & ECMD_ADDBUF) || check_fname() == FAIL) goto theend; + oldbuf = (flags & ECMD_OLDBUF); } + /* Don't redraw until the cursor is in the right line, otherwise + * autocommands may cause ml_get errors. */ + ++RedrawingDisabled; + did_inc_redrawing_disabled = TRUE; + + buf = curbuf; if ((flags & ECMD_SET_HELP) || keep_help_flag) { - char_u *p; - - curbuf->b_help = TRUE; -#ifdef FEAT_QUICKFIX - set_string_option_direct((char_u *)"buftype", -1, - (char_u *)"help", OPT_FREE|OPT_LOCAL, 0); -#endif - - /* - * Always set these options after jumping to a help tag, because the - * user may have an autocommand that gets in the way. - * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and - * latin1 word characters (for translated help files). - * Only set it when needed, buf_init_chartab() is some work. - */ - p = -#ifdef EBCDIC - (char_u *)"65-255,^*,^|,^\""; -#else - (char_u *)"!-~,^*,^|,^\",192-255"; -#endif - if (STRCMP(curbuf->b_p_isk, p) != 0) - { - set_string_option_direct((char_u *)"isk", -1, p, - OPT_FREE|OPT_LOCAL, 0); - check_buf_options(curbuf); - (void)buf_init_chartab(curbuf, FALSE); - } - - curbuf->b_p_ts = 8; /* 'tabstop' is 8 */ - curwin->w_p_list = FALSE; /* no list mode */ - - curbuf->b_p_ma = FALSE; /* not modifiable */ - curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */ - curwin->w_p_nu = 0; /* no line numbers */ - curwin->w_p_rnu = 0; /* no relative line numbers */ - RESET_BINDING(curwin); /* no scroll or cursor binding */ -#ifdef FEAT_ARABIC - curwin->w_p_arab = FALSE; /* no arabic mode */ -#endif -#ifdef FEAT_RIGHTLEFT - curwin->w_p_rl = FALSE; /* help window is left-to-right */ -#endif -#ifdef FEAT_FOLDING - curwin->w_p_fen = FALSE; /* No folding in the help window */ -#endif -#ifdef FEAT_DIFF - curwin->w_p_diff = FALSE; /* No 'diff' */ -#endif -#ifdef FEAT_SPELL - curwin->w_p_spell = FALSE; /* No spell checking */ -#endif - -#ifdef FEAT_AUTOCMD - buf = curbuf; -#endif - set_buflisted(FALSE); + prepare_help_buffer(); } else { -#ifdef FEAT_AUTOCMD - buf = curbuf; -#endif /* Don't make a buffer listed if it's a help buffer. Useful when * using CTRL-O to go back to a help file. */ if (!curbuf->b_help) set_buflisted(TRUE); } -#ifdef FEAT_AUTOCMD /* If autocommands change buffers under our fingers, forget about * editing the file. */ if (buf != curbuf) goto theend; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; -# endif +#endif /* Since we are starting to edit a file, consider the filetype to be * unset. Helps for when an autocommand changes files and expects syntax * highlighting to work in the other file. */ did_filetype = FALSE; -#endif /* * other_file oldbuf @@ -3633,13 +4063,13 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) newlnum = curwin->w_cursor.lnum; solcol = curwin->w_cursor.col; } -#ifdef FEAT_AUTOCMD buf = curbuf; if (buf->b_fname != NULL) new_name = vim_strsave(buf->b_fname); else new_name = NULL; -#endif + set_bufref(&bufref, buf); + if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) { /* Save all the text, so that the reload can be undone. @@ -3647,7 +4077,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) u_sync(FALSE); if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE) == FAIL) + { + vim_free(new_name); goto theend; + } u_unchanged(curbuf); buf_freeall(curbuf, BFA_KEEP_UNDO); @@ -3656,10 +4089,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) } else buf_freeall(curbuf, 0); /* free all things for buffer */ -#ifdef FEAT_AUTOCMD + /* If autocommands deleted the buffer we were going to re-edit, give * up and jump to the end. */ - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) { delbuf_msg(new_name); /* frees new_name */ goto theend; @@ -3671,10 +4104,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) * the autocommands changed the buffer... */ if (buf != curbuf) goto theend; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; -# endif #endif buf_clear_file(curbuf); curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */ @@ -3684,25 +4116,15 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) /* * If we get here we are sure to start editing */ - /* don't redraw until the cursor is in the right line */ - ++RedrawingDisabled; - /* Assume success now */ retval = OK; - /* - * Reset cursor position, could be used by autocommands. - */ - check_cursor(); - /* * Check if we are editing the w_arg_idx file in the argument list. */ check_arg_idx(curwin); -#ifdef FEAT_AUTOCMD if (!auto_buf) -#endif { /* * Set cursor and init window before reading the file and executing @@ -3714,7 +4136,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #ifdef FEAT_FOLDING /* It's possible that all lines in the buffer changed. Need to update * automatic folding for all windows where it's used. */ -# ifdef FEAT_WINDOWS { win_T *win; tabpage_T *tp; @@ -3723,19 +4144,16 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) if (win->w_buffer == curbuf) foldUpdateAll(win); } -# else - foldUpdateAll(curwin); -# endif #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; /* * Careful: open_buffer() and apply_autocmds() may change the current * buffer and window. */ - lnum = curwin->w_cursor.lnum; + orig_pos = curwin->w_cursor; topline = curwin->w_topline; if (!oldbuf) /* need to read the file */ { @@ -3747,7 +4165,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) /* * Open the buffer and read the file. */ -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (should_abort(open_buffer(FALSE, eap, readfile_flags))) retval = FAIL; #else @@ -3757,10 +4175,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT) retval = FAIL; - handle_swap_exists(old_curbuf); + handle_swap_exists(&old_curbuf); #endif } -#ifdef FEAT_AUTOCMD else { /* Read the modelines, but only to set window-local options. Any @@ -3774,16 +4191,20 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) &retval); } check_arg_idx(curwin); -#endif - /* - * If autocommands change the cursor position or topline, we should - * keep it. - */ - if (curwin->w_cursor.lnum != lnum) + /* If autocommands change the cursor position or topline, we should + * keep it. Also when it moves within a line. But not when it moves + * to the first non-blank. */ + if (!EQUAL_POS(curwin->w_cursor, orig_pos)) { - newlnum = curwin->w_cursor.lnum; - newcol = curwin->w_cursor.col; + char_u *text = ml_get_curline(); + + if (curwin->w_cursor.lnum != orig_pos.lnum + || curwin->w_cursor.col != (int)(skipwhite(text) - text)) + { + newlnum = curwin->w_cursor.lnum; + newcol = curwin->w_cursor.col; + } } if (curwin->w_topline == topline) topline = 0; @@ -3847,20 +4268,14 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) } } -#ifdef FEAT_WINDOWS /* Check if cursors in other windows on the same buffer are still valid */ check_lnums(FALSE); -#endif /* * Did not read the file, need to show some info about the file. * Do this after setting the cursor. */ - if (oldbuf -#ifdef FEAT_AUTOCMD - && !auto_buf -#endif - ) + if (oldbuf && !auto_buf) { int msg_scroll_save = msg_scroll; @@ -3874,11 +4289,16 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) msg_scroll = msg_scroll_save; msg_scrolled_ign = TRUE; - fileinfo(FALSE, TRUE, FALSE); + if (!shortmess(SHM_FILEINFO)) + fileinfo(FALSE, TRUE, FALSE); msg_scrolled_ign = FALSE; } +#ifdef FEAT_VIMINFO + curbuf->b_last_used = vim_time(); +#endif + if (command != NULL) do_cmdline(command, NULL, NULL, DOCMD_VERBOSE); @@ -3888,15 +4308,14 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #endif --RedrawingDisabled; + did_inc_redrawing_disabled = FALSE; if (!skip_redraw) { n = p_so; if (topline == 0 && command == NULL) p_so = 999; /* force cursor halfway the window */ update_topline(); -#ifdef FEAT_SCROLLBIND curwin->w_scbind_pos = curwin->w_topline; -#endif p_so = n; redraw_curbuf_later(NOT_VALID); /* redraw this buffer later */ } @@ -3904,8 +4323,22 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) if (p_im) need_start_insertmode = TRUE; - /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR +#ifdef FEAT_AUTOCHDIR + /* Change directories when the 'acd' option is set and we aren't already in + * that directory (should already be done above). Expect getcwd() to be + * faster than calling shorten_fnames() unnecessarily. */ + if (p_acd && curbuf->b_ffname != NULL) + { + char_u curdir[MAXPATHL]; + char_u filedir[MAXPATHL]; + + vim_strncpy(filedir, curbuf->b_ffname, MAXPATHL - 1); + *gettail_sep(filedir) = NUL; + if (mch_dirname(curdir, MAXPATHL) != FAIL + && vim_fnamecmp(curdir, filedir) != 0) + do_autochdir(); + } +#endif #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) if (curbuf->b_ffname != NULL) @@ -3922,7 +4355,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #endif theend: -#ifdef FEAT_AUTOCMD + if (did_inc_redrawing_disabled) + --RedrawingDisabled; +#if defined(FEAT_EVAL) if (did_set_swapcommand) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif @@ -3933,17 +4368,15 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) return retval; } -#ifdef FEAT_AUTOCMD static void -delbuf_msg(name) - char_u *name; +delbuf_msg(char_u *name) { EMSG2(_("E143: Autocommands unexpectedly deleted new buffer %s"), name == NULL ? (char_u *)"" : name); vim_free(name); - au_new_curbuf = NULL; + au_new_curbuf.br_buf = NULL; + au_new_curbuf.br_buf_free_count = 0; } -#endif static int append_indent = 0; /* autoindent for first line */ @@ -3951,8 +4384,7 @@ static int append_indent = 0; /* autoindent for first line */ * ":insert" and ":append", also used by ":change" */ void -ex_append(eap) - exarg_T *eap; +ex_append(exarg_T *eap) { char_u *theline; int did_undo = FALSE; @@ -3973,7 +4405,7 @@ ex_append(eap) if (eap->cmdidx != CMD_append) --lnum; - /* when the buffer is empty append to line 0 and delete the dummy line */ + /* when the buffer is empty need to delete the dummy line */ if (empty && lnum == 1) lnum = 0; @@ -4011,11 +4443,19 @@ ex_append(eap) eap->nextcmd = p; } else + { + int save_State = State; + + /* Set State to avoid the cursor shape to be set to INSERT mode + * when getline() returns. */ + State = CMDLINE; theline = eap->getline( #ifdef FEAT_EVAL eap->cstack->cs_looplevel > 0 ? -1 : #endif NUL, eap->cookie, indent); + State = save_State; + } lines_left = Rows - 1; if (theline == NULL) break; @@ -4049,7 +4489,7 @@ ex_append(eap) did_undo = TRUE; ml_append(lnum, theline, (colnr_T)0, FALSE); - appended_lines_mark(lnum, 1L); + appended_lines_mark(lnum + (empty ? 1 : 0), 1L); vim_free(theline); ++lnum; @@ -4088,8 +4528,7 @@ ex_append(eap) * ":change" */ void -ex_change(eap) - exarg_T *eap; +ex_change(exarg_T *eap) { linenr_T lnum; @@ -4118,11 +4557,10 @@ ex_change(eap) } void -ex_z(eap) - exarg_T *eap; +ex_z(exarg_T *eap) { char_u *x; - int bigness; + long bigness; char_u *kind; int minus = 0; linenr_T start, end, curs, i; @@ -4133,10 +4571,8 @@ ex_z(eap) * 'scroll' */ if (eap->forceit) bigness = curwin->w_height; -#ifdef FEAT_WINDOWS - else if (firstwin != lastwin) + else if (!ONE_WINDOW) bigness = curwin->w_height - 3; -#endif else bigness = curwin->w_p_scr * 2; if (bigness < 1) @@ -4159,7 +4595,12 @@ ex_z(eap) } else { - bigness = atoi((char *)x); + bigness = atol((char *)x); + + /* bigness could be < 0 if atol(x) overflows. */ + if (bigness > 2 * curbuf->b_ml.ml_line_count || bigness < 0) + bigness = 2 * curbuf->b_ml.ml_line_count; + p_window = bigness; if (*kind == '=') bigness += 2; @@ -4217,6 +4658,8 @@ ex_z(eap) if (curs > curbuf->b_ml.ml_line_count) curs = curbuf->b_ml.ml_line_count; + else if (curs < 1) + curs = 1; for (i = start; i <= end; i++) { @@ -4238,8 +4681,12 @@ ex_z(eap) msg_putchar('-'); } } - - curwin->w_cursor.lnum = curs; + + if (curwin->w_cursor.lnum != curs) + { + curwin->w_cursor.lnum = curs; + curwin->w_cursor.col = 0; + } ex_no_reprint = TRUE; } @@ -4249,7 +4696,7 @@ ex_z(eap) * Otherwise, return FALSE. */ int -check_restricted() +check_restricted(void) { if (restricted) { @@ -4265,7 +4712,7 @@ check_restricted() * Otherwise, return FALSE. */ int -check_secure() +check_secure(void) { if (secure) { @@ -4290,6 +4737,20 @@ check_secure() static char_u *old_sub = NULL; /* previous substitute pattern */ static int global_need_beginline; /* call beginline() after ":g" */ +/* + * Flags that are kept between calls to :substitute. + */ +typedef struct { + int do_all; /* do multiple substitutions per line */ + int do_ask; /* ask for confirmation */ + int do_count; /* count only */ + int do_error; /* if false, ignore errors */ + int do_print; /* print last line with subs. */ + int do_list; /* list last line with subs. */ + int do_number; /* list last line with line nr*/ + int do_ic; /* ignore case flag */ +} subflags_T; + /* do_sub() * * Perform a substitution from line eap->line1 to line eap->line2 using the @@ -4300,20 +4761,18 @@ static int global_need_beginline; /* call beginline() after ":g" */ * The usual escapes are supported as described in the regexp docs. */ void -do_sub(eap) - exarg_T *eap; +do_sub(exarg_T *eap) { linenr_T lnum; long i = 0; regmmatch_T regmatch; - static int do_all = FALSE; /* do multiple substitutions per line */ - static int do_ask = FALSE; /* ask for confirmation */ - static int do_count = FALSE; /* count only */ - static int do_error = TRUE; /* if false, ignore errors */ - static int do_print = FALSE; /* print last line with subs. */ - static int do_list = FALSE; /* list last line with subs. */ - static int do_number = FALSE; /* list last line with line nr*/ - static int do_ic = 0; /* ignore case flag */ + static subflags_T subflags = {FALSE, FALSE, FALSE, TRUE, FALSE, + FALSE, FALSE, 0}; +#ifdef FEAT_EVAL + subflags_T subflags_save; +#endif + int save_do_all; /* remember user specified 'g' flag */ + int save_do_ask; /* remember user specified 'c' flag */ char_u *pat = NULL, *sub = NULL; /* init for GCC */ int delimiter; int sublen; @@ -4351,7 +4810,7 @@ do_sub(eap) which_pat = RE_SUBST; /* use last substitute regexp */ /* new pattern and substitution */ - if (eap->cmd[0] == 's' && *cmd != NUL && !vim_iswhite(*cmd) + if (eap->cmd[0] == 's' && *cmd != NUL && !VIM_ISWHITE(*cmd) && vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) { /* don't accept alphanumeric for separator */ @@ -4407,7 +4866,7 @@ do_sub(eap) } if (cmd[0] == '\\' && cmd[1] != 0) /* skip escaped characters */ ++cmd; - mb_ptr_adv(cmd); + MB_PTR_ADV(cmd); } if (!eap->skip) @@ -4455,6 +4914,8 @@ do_sub(eap) && (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l' || *cmd == 'p' || *cmd == '#')))) { + linenr_T joined_lines_count; + curwin->w_cursor.lnum = eap->line1; if (*cmd == 'l') eap->flags = EXFLAG_LIST; @@ -4463,10 +4924,27 @@ do_sub(eap) else if (*cmd == 'p') eap->flags = EXFLAG_PRINT; - (void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, TRUE); - sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1; - (void)do_sub_msg(FALSE); - ex_may_print(eap); + /* The number of lines joined is the number of lines in the range plus + * one. One less when the last line is included. */ + joined_lines_count = eap->line2 - eap->line1 + 1; + if (eap->line2 < curbuf->b_ml.ml_line_count) + ++joined_lines_count; + if (joined_lines_count > 1) + { + (void)do_join(joined_lines_count, FALSE, TRUE, FALSE, TRUE); + sub_nsubs = joined_lines_count - 1; + sub_nlines = 1; + (void)do_sub_msg(FALSE); + ex_may_print(eap); + } + + if (!cmdmod.keeppatterns) + save_re_pat(RE_SUBST, pat, p_magic); +#ifdef FEAT_CMDHIST + /* put pattern in history */ + add_to_history(HIST_SEARCH, pat, TRUE, NUL); +#endif + return; } @@ -4480,16 +4958,16 @@ do_sub(eap) if (!p_ed) { if (p_gd) /* default is global on */ - do_all = TRUE; + subflags.do_all = TRUE; else - do_all = FALSE; - do_ask = FALSE; + subflags.do_all = FALSE; + subflags.do_ask = FALSE; } - do_error = TRUE; - do_print = FALSE; - do_count = FALSE; - do_number = FALSE; - do_ic = 0; + subflags.do_error = TRUE; + subflags.do_print = FALSE; + subflags.do_count = FALSE; + subflags.do_number = FALSE; + subflags.do_ic = 0; } while (*cmd) { @@ -4498,37 +4976,40 @@ do_sub(eap) * 'r' is never inverted. */ if (*cmd == 'g') - do_all = !do_all; + subflags.do_all = !subflags.do_all; else if (*cmd == 'c') - do_ask = !do_ask; + subflags.do_ask = !subflags.do_ask; else if (*cmd == 'n') - do_count = TRUE; + subflags.do_count = TRUE; else if (*cmd == 'e') - do_error = !do_error; + subflags.do_error = !subflags.do_error; else if (*cmd == 'r') /* use last used regexp */ which_pat = RE_LAST; else if (*cmd == 'p') - do_print = TRUE; + subflags.do_print = TRUE; else if (*cmd == '#') { - do_print = TRUE; - do_number = TRUE; + subflags.do_print = TRUE; + subflags.do_number = TRUE; } else if (*cmd == 'l') { - do_print = TRUE; - do_list = TRUE; + subflags.do_print = TRUE; + subflags.do_list = TRUE; } else if (*cmd == 'i') /* ignore case */ - do_ic = 'i'; + subflags.do_ic = 'i'; else if (*cmd == 'I') /* don't ignore case */ - do_ic = 'I'; + subflags.do_ic = 'I'; else break; ++cmd; } - if (do_count) - do_ask = FALSE; + if (subflags.do_count) + subflags.do_ask = FALSE; + + save_do_all = subflags.do_all; + save_do_ask = subflags.do_ask; /* * check for a trailing count @@ -4537,7 +5018,7 @@ do_sub(eap) if (VIM_ISDIGIT(*cmd)) { i = getdigits(&cmd); - if (i <= 0 && !eap->skip && do_error) + if (i <= 0 && !eap->skip && subflags.do_error) { EMSG(_(e_zerocount)); return; @@ -4565,7 +5046,7 @@ do_sub(eap) if (eap->skip) /* not executing commands, only parsing */ return; - if (!do_count && !curbuf->b_p_ma) + if (!subflags.do_count && !curbuf->b_p_ma) { /* Substitution is not allowed in non-'modifiable' buffer */ EMSG(_(e_modifiable)); @@ -4574,15 +5055,15 @@ do_sub(eap) if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, ®match) == FAIL) { - if (do_error) + if (subflags.do_error) EMSG(_(e_invcmd)); return; } /* the 'i' or 'I' flag overrules 'ignorecase' and 'smartcase' */ - if (do_ic == 'i') + if (subflags.do_ic == 'i') regmatch.rmm_ic = TRUE; - else if (do_ic == 'I') + else if (subflags.do_ic == 'I') regmatch.rmm_ic = FALSE; sub_firstline = NULL; @@ -4600,13 +5081,13 @@ do_sub(eap) */ line2 = eap->line2; for (lnum = eap->line1; lnum <= line2 && !(got_quit -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) +#if defined(FEAT_EVAL) || aborting() #endif ); ++lnum) { nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, - (colnr_T)0, NULL); + (colnr_T)0, NULL, NULL); if (nmatch) { colnr_T copycol; @@ -4697,8 +5178,7 @@ do_sub(eap) lnum += regmatch.startpos[0].lnum; sub_firstlnum += regmatch.startpos[0].lnum; nmatch -= regmatch.startpos[0].lnum; - vim_free(sub_firstline); - sub_firstline = NULL; + VIM_CLEAR(sub_firstline); } if (sub_firstline == NULL) @@ -4751,7 +5231,7 @@ do_sub(eap) * 2. If do_count is set only increase the counter. * If do_ask is set, ask for confirmation. */ - if (do_count) + if (subflags.do_count) { /* For a multi-line match, put matchcol at the NUL at * the end of the line and set nmatch to one, so that @@ -4773,7 +5253,7 @@ do_sub(eap) goto skip; } - if (do_ask) + if (subflags.do_ask) { int typed = 0; @@ -4785,6 +5265,8 @@ do_sub(eap) setmouse(); /* disable mouse in xterm */ #endif curwin->w_cursor.col = regmatch.startpos[0].col; + if (curwin->w_p_crb) + do_check_cursorbind(); /* When 'cpoptions' contains "u" don't sync undo when * asking for confirmation. */ @@ -4794,19 +5276,22 @@ do_sub(eap) /* * Loop until 'y', 'n', 'q', CTRL-E or CTRL-Y typed. */ - while (do_ask) + while (subflags.do_ask) { if (exmode_active) { char_u *resp; colnr_T sc, ec; - print_line_no_prefix(lnum, do_number, do_list); + print_line_no_prefix(lnum, + subflags.do_number, subflags.do_list); getvcol(curwin, &curwin->w_cursor, &sc, NULL, NULL); curwin->w_cursor.col = regmatch.endpos[0].col - 1; + if (curwin->w_cursor.col < 0) + curwin->w_cursor.col = 0; getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec); - if (do_number || curwin->w_p_nu) + if (subflags.do_number || curwin->w_p_nu) { int numw = number_width(curwin) + 1; sc += numw; @@ -4853,10 +5338,7 @@ do_sub(eap) sub_firstline + copycol); if (new_line == NULL) - { - vim_free(orig_line); - orig_line = NULL; - } + VIM_CLEAR(orig_line); else { /* Position the cursor relative to the @@ -4896,7 +5378,7 @@ do_sub(eap) msg_no_more = TRUE; /* write message same highlighting as for * wait_return */ - smsg_attr(hl_attr(HLF_R), + smsg_attr(HL_ATTR(HLF_R), (char_u *)_("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); msg_no_more = FALSE; msg_scroll = i; @@ -4940,13 +5422,13 @@ do_sub(eap) if (typed == 'l') { /* last: replace and then stop */ - do_all = FALSE; + subflags.do_all = FALSE; line2 = lnum; break; } if (typed == 'a') { - do_ask = FALSE; + subflags.do_ask = FALSE; break; } #ifdef FEAT_INS_EXPAND @@ -4989,23 +5471,29 @@ do_sub(eap) * 3. substitute the string. */ #ifdef FEAT_EVAL - if (do_count) + if (subflags.do_count) { /* prevent accidentally changing the buffer by a function */ save_ma = curbuf->b_p_ma; curbuf->b_p_ma = FALSE; sandbox++; } + /* Save flags for recursion. They can change for e.g. + * :s/^/\=execute("s#^##gn") */ + subflags_save = subflags; #endif /* get length of substitution part */ sublen = vim_regsub_multi(®match, sub_firstlnum - regmatch.startpos[0].lnum, sub, sub_firstline, FALSE, p_magic, TRUE); #ifdef FEAT_EVAL - if (do_count) + /* Don't keep flags set by a recursive call. */ + subflags = subflags_save; + if (subflags.do_count) { curbuf->b_p_ma = save_ma; - sandbox--; + if (sandbox > 0) + sandbox--; goto skip; } #endif @@ -5098,7 +5586,7 @@ do_sub(eap) if (sub_firstlnum <= line2) do_again = TRUE; else - do_all = FALSE; + subflags.do_all = FALSE; } /* Remember next character to be copied. */ @@ -5133,7 +5621,7 @@ do_sub(eap) ml_append(lnum - 1, new_start, (colnr_T)(p1 - new_start + 1), FALSE); mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); - if (do_ask) + if (subflags.do_ask) appended_lines(lnum - 1, 1L); else { @@ -5174,7 +5662,7 @@ do_sub(eap) || got_int || got_quit || lnum > line2 - || !(do_all || do_again) + || !(subflags.do_all || do_again) || (sub_firstline[matchcol] == NUL && nmatch <= 1 && !re_multiline(regmatch.regprog))); nmatch = -1; @@ -5192,7 +5680,7 @@ do_sub(eap) || nmatch_tl > 0 || (nmatch = vim_regexec_multi(®match, curwin, curbuf, sub_firstlnum, - matchcol, NULL)) == 0 + matchcol, NULL, NULL)) == 0 || regmatch.startpos[0].lnum > 0) { if (new_start != NULL) @@ -5228,7 +5716,7 @@ do_sub(eap) ml_delete(lnum, (int)FALSE); mark_adjust(lnum, lnum + nmatch_tl - 1, (long)MAXLNUM, -nmatch_tl); - if (do_ask) + if (subflags.do_ask) deleted_lines(lnum, nmatch_tl); --lnum; line2 -= nmatch_tl; /* nr of lines decreases */ @@ -5237,7 +5725,7 @@ do_sub(eap) /* When asking, undo is saved each time, must also set * changed flag each time. */ - if (do_ask) + if (subflags.do_ask) changed_bytes(lnum, 0); else { @@ -5257,7 +5745,7 @@ do_sub(eap) } if (nmatch == -1 && !lastone) nmatch = vim_regexec_multi(®match, curwin, curbuf, - sub_firstlnum, matchcol, NULL); + sub_firstlnum, matchcol, NULL, NULL); /* * 5. break if there isn't another match in this line @@ -5279,8 +5767,7 @@ do_sub(eap) if (did_sub) ++sub_nlines; vim_free(new_start); /* for when substitute was cancelled */ - vim_free(sub_firstline); /* free the copy of the original line */ - sub_firstline = NULL; + VIM_CLEAR(sub_firstline); /* free the copy of the original line */ } line_breakcheck(); @@ -5299,7 +5786,7 @@ do_sub(eap) vim_free(sub_firstline); /* may have to free allocated copy of the line */ /* ":s/pat//n" doesn't move the cursor */ - if (do_count) + if (subflags.do_count) curwin->w_cursor = old_cursor; if (sub_nsubs > start_nsubs) @@ -5311,20 +5798,22 @@ do_sub(eap) if (!global_busy) { - if (!do_ask) /* when interactive leave cursor on the match */ + /* when interactive leave cursor on the match */ + if (!subflags.do_ask) { if (endcolumn) coladvance((colnr_T)MAXCOL); else beginline(BL_WHITE | BL_FIX); } - if (!do_sub_msg(do_count) && do_ask) + if (!do_sub_msg(subflags.do_count) && subflags.do_ask) MSG(""); } else global_need_beginline = TRUE; - if (do_print) - print_line(curwin->w_cursor.lnum, do_number, do_list); + if (subflags.do_print) + print_line(curwin->w_cursor.lnum, + subflags.do_number, subflags.do_list); } else if (!global_busy) { @@ -5332,17 +5821,21 @@ do_sub(eap) EMSG(_(e_interr)); else if (got_match) /* did find something but nothing substituted */ MSG(""); - else if (do_error) /* nothing found */ + else if (subflags.do_error) /* nothing found */ EMSG2(_(e_patnotf2), get_search_pat()); } #ifdef FEAT_FOLDING - if (do_ask && hasAnyFolding(curwin)) + if (subflags.do_ask && hasAnyFolding(curwin)) /* Cursor position may require updating */ changed_window_setting(); #endif vim_regfree(regmatch.regprog); + + /* Restore the flag values, they can be used for ":&&". */ + subflags.do_all = save_do_all; + subflags.do_ask = save_do_ask; } /* @@ -5351,8 +5844,8 @@ do_sub(eap) * Return TRUE if a message was given. */ int -do_sub_msg(count_only) - int count_only; /* used 'n' flag for ":s" */ +do_sub_msg( + int count_only) /* used 'n' flag for ":s" */ { /* * Only report substitutions when: @@ -5394,6 +5887,17 @@ do_sub_msg(count_only) return FALSE; } + static void +global_exe_one(char_u *cmd, linenr_T lnum) +{ + curwin->w_cursor.lnum = lnum; + curwin->w_cursor.col = 0; + if (*cmd == NUL || *cmd == '\n') + do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT); + else + do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT); +} + /* * Execute a global command of the form: * @@ -5411,8 +5915,7 @@ do_sub_msg(count_only) * lines we do not know where to search for the next match. */ void -ex_global(eap) - exarg_T *eap; +ex_global(exarg_T *eap) { linenr_T lnum; /* line number according to old situation */ int ndone = 0; @@ -5425,9 +5928,13 @@ ex_global(eap) int match; int which_pat; - if (global_busy) + /* When nesting the command works on one line. This allows for + * ":g/found/v/notfound/command". */ + if (global_busy && (eap->line1 != 1 + || eap->line2 != curbuf->b_ml.ml_line_count)) { - EMSG(_("E147: Cannot do :global recursive")); /* will increment global_busy */ + /* will increment global_busy to break out of the loop */ + EMSG(_("E147: Cannot do :global recursive with a range")); return; } @@ -5485,38 +5992,58 @@ ex_global(eap) return; } - /* - * pass 1: set marks for each (not) matching line - */ - for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum) + if (global_busy) { - /* a match on this line? */ + lnum = curwin->w_cursor.lnum; match = vim_regexec_multi(®match, curwin, curbuf, lnum, - (colnr_T)0, NULL); + (colnr_T)0, NULL, NULL); if ((type == 'g' && match) || (type == 'v' && !match)) + global_exe_one(cmd, lnum); + } + else + { + /* + * pass 1: set marks for each (not) matching line + */ + for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum) { - ml_setmarked(lnum); - ndone++; + /* a match on this line? */ + match = vim_regexec_multi(®match, curwin, curbuf, lnum, + (colnr_T)0, NULL, NULL); + if ((type == 'g' && match) || (type == 'v' && !match)) + { + ml_setmarked(lnum); + ndone++; + } + line_breakcheck(); } - line_breakcheck(); - } - /* - * pass 2: execute the command for each line that has been marked - */ - if (got_int) - MSG(_(e_interr)); - else if (ndone == 0) - { - if (type == 'v') - smsg((char_u *)_("Pattern found in every line: %s"), pat); + /* + * pass 2: execute the command for each line that has been marked + */ + if (got_int) + MSG(_(e_interr)); + else if (ndone == 0) + { + if (type == 'v') + smsg((char_u *)_("Pattern found in every line: %s"), pat); + else + smsg((char_u *)_("Pattern not found: %s"), pat); + } else - smsg((char_u *)_("Pattern not found: %s"), pat); + { +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif + global_exe(cmd); +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif + } + + ml_clearmarked(); /* clear rest of the marks */ } - else - global_exe(cmd); - ml_clearmarked(); /* clear rest of the marks */ vim_regfree(regmatch.regprog); } @@ -5524,8 +6051,7 @@ ex_global(eap) * Execute "cmd" on lines marked with ml_setmarked(). */ void -global_exe(cmd) - char_u *cmd; +global_exe(char_u *cmd) { linenr_T old_lcount; /* b_ml.ml_line_count before the command */ buf_T *old_buf = curbuf; /* remember what buffer we started in */ @@ -5548,12 +6074,7 @@ global_exe(cmd) old_lcount = curbuf->b_ml.ml_line_count; while (!got_int && (lnum = ml_firstmarked()) != 0 && global_busy == 1) { - curwin->w_cursor.lnum = lnum; - curwin->w_cursor.col = 0; - if (*cmd == NUL || *cmd == '\n') - do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT); - else - do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT); + global_exe_one(cmd, lnum); ui_breakcheck(); } @@ -5582,9 +6103,7 @@ global_exe(cmd) #ifdef FEAT_VIMINFO int -read_viminfo_sub_string(virp, force) - vir_T *virp; - int force; +read_viminfo_sub_string(vir_T *virp, int force) { if (force) vim_free(old_sub); @@ -5594,8 +6113,7 @@ read_viminfo_sub_string(virp, force) } void -write_viminfo_sub_string(fp) - FILE *fp; +write_viminfo_sub_string(FILE *fp) { if (get_viminfo_parameter('/') != 0 && old_sub != NULL) { @@ -5607,20 +6125,20 @@ write_viminfo_sub_string(fp) #if defined(EXITFREE) || defined(PROTO) void -free_old_sub() +free_old_sub(void) { vim_free(old_sub); } #endif -#if (defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)) || defined(PROTO) +#if defined(FEAT_QUICKFIX) || defined(PROTO) /* * Set up for a tagpreview. * Return TRUE when it was created. */ int -prepare_tagpreview(undo_sync) - int undo_sync; /* sync undo when leaving the window */ +prepare_tagpreview( + int undo_sync) /* sync undo when leaving the window */ { win_T *wp; @@ -5633,7 +6151,7 @@ prepare_tagpreview(undo_sync) */ if (!curwin->w_p_pvw) { - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_p_pvw) break; if (wp != NULL) @@ -5669,17 +6187,14 @@ prepare_tagpreview(undo_sync) * ":help": open a read-only window on a help file */ void -ex_help(eap) - exarg_T *eap; +ex_help(exarg_T *eap) { char_u *arg; char_u *tag; FILE *helpfd; /* file descriptor of help file */ int n; int i; -#ifdef FEAT_WINDOWS win_T *wp; -#endif int num_matches; char_u **matches; char_u *p; @@ -5726,7 +6241,7 @@ ex_help(eap) /* remove trailing blanks */ p = arg + STRLEN(arg) - 1; - while (p > arg && vim_iswhite(*p) && p[-1] != '\\') + while (p > arg && VIM_ISWHITE(*p) && p[-1] != '\\') *p-- = NUL; #ifdef FEAT_MULTI_LANG @@ -5781,23 +6296,17 @@ ex_help(eap) * Re-use an existing help window or open a new one. * Always open a new one for ":tab help". */ - if (!curwin->w_buffer->b_help -#ifdef FEAT_WINDOWS - || cmdmod.tab != 0 -#endif - ) + if (!bt_help(curwin->w_buffer) || cmdmod.tab != 0) { -#ifdef FEAT_WINDOWS if (cmdmod.tab != 0) wp = NULL; else - for (wp = firstwin; wp != NULL; wp = wp->w_next) - if (wp->w_buffer != NULL && wp->w_buffer->b_help) + FOR_ALL_WINDOWS(wp) + if (bt_help(wp->w_buffer)) break; if (wp != NULL && wp->w_buffer->b_nwindows > 0) win_enter(wp, TRUE); else -#endif { /* * There is no help window yet. @@ -5810,28 +6319,18 @@ ex_help(eap) } fclose(helpfd); -#ifdef FEAT_WINDOWS /* Split off help window; put it at far top if no position * specified, the current window is vertically split and * narrow. */ n = WSP_HELP; -# ifdef FEAT_VERTSPLIT if (cmdmod.split == 0 && curwin->w_width != Columns && curwin->w_width < 80) n |= WSP_TOP; -# endif if (win_split(0, n) == FAIL) goto erret; -#else - /* use current window */ - if (!can_abandon(curbuf, FALSE)) - goto erret; -#endif -#ifdef FEAT_WINDOWS if (curwin->w_height < p_hh) win_setheight((int)p_hh); -#endif /* * Open help file (do_ecmd() will set b_help flag, readfile() will @@ -5841,12 +6340,7 @@ ex_help(eap) alt_fnum = curbuf->b_fnum; (void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL, ECMD_HIDE + ECMD_SET_HELP, -#ifdef FEAT_WINDOWS - NULL /* buffer is still open, don't store info */ -#else - curwin -#endif - ); + NULL); /* buffer is still open, don't store info */ if (!cmdmod.keepalt) curwin->w_alt_fnum = alt_fnum; empty_fnum = curbuf->b_fnum; @@ -5883,6 +6377,23 @@ ex_help(eap) vim_free(tag); } +/* + * ":helpclose": Close one help window + */ + void +ex_helpclose(exarg_T *eap UNUSED) +{ + win_T *win; + + FOR_ALL_WINDOWS(win) + { + if (bt_help(win->w_buffer)) + { + win_close(win, FALSE); + return; + } + } +} #if defined(FEAT_MULTI_LANG) || defined(PROTO) /* @@ -5891,8 +6402,7 @@ ex_help(eap) * Returns NULL if not found. */ char_u * -check_help_lang(arg) - char_u *arg; +check_help_lang(char_u *arg) { int len = (int)STRLEN(arg); @@ -5918,10 +6428,10 @@ check_help_lang(arg) * match some string for which help is requested. webb. */ int -help_heuristic(matched_string, offset, wrong_case) - char_u *matched_string; - int offset; /* offset for match */ - int wrong_case; /* no matching case */ +help_heuristic( + char_u *matched_string, + int offset, /* offset for match */ + int wrong_case) /* no matching case */ { int num_letters; char_u *p; @@ -5962,9 +6472,7 @@ help_heuristic(matched_string, offset, wrong_case) #ifdef __BORLANDC__ _RTLENTRYF #endif -help_compare(s1, s2) - const void *s1; - const void *s2; +help_compare(const void *s1, const void *s2) { char *p1; char *p2; @@ -5981,29 +6489,31 @@ help_compare(s1, s2) * When "keep_lang" is TRUE try keeping the language of the current buffer. */ int -find_help_tags(arg, num_matches, matches, keep_lang) - char_u *arg; - int *num_matches; - char_u ***matches; - int keep_lang; +find_help_tags( + char_u *arg, + int *num_matches, + char_u ***matches, + int keep_lang) { char_u *s, *d; int i; static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*", "/*", "/\\*", "\"*", "**", "cpo-*", "/\\(\\)", "/\\%(\\)", - "?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?", + "?", ":?", "?<CR>", "g?", "g?g?", "g??", "/\\?", "/\\z(\\)", "\\=", ":s\\=", - "[count]", "[quotex]", "[range]", + "[count]", "[quotex]", + "[range]", ":[range]", "[pattern]", "\\|", "\\%$", "s/\\~", "s/\\U", "s/\\L", "s/\\1", "s/\\2", "s/\\3", "s/\\9"}; static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star", "/star", "/\\\\star", "quotestar", "starstar", "cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)", - "?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?", + "?", ":?", "?<CR>", "g?", "g?g?", "g??", "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=", - "\\[count]", "\\[quotex]", "\\[range]", + "\\[count]", "\\[quotex]", + "\\[range]", ":\\[range]", "\\[pattern]", "\\\\bar", "/\\\\%\\$", "s/\\\\\\~", "s/\\\\U", "s/\\\\L", "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"}; @@ -6052,6 +6562,11 @@ find_help_tags(arg, num_matches, matches, keep_lang) || (arg[0] == '\\' && arg[1] == '{')) *d++ = '\\'; + /* + * If tag starts with "('", skip the "(". Fixes CTRL-] on ('option'. + */ + if (*arg == '(' && arg[1] == '\'') + arg++; for (s = arg; *s; ++s) { /* @@ -6132,12 +6647,22 @@ find_help_tags(arg, num_matches, matches, keep_lang) *d++ = *s; + /* + * If tag contains "({" or "([", tag terminates at the "(". + * This is for help on functions, e.g.: abs({expr}). + */ + if (*s == '(' && (s[1] == '{' || s[1] =='[')) + break; + /* * If tag starts with ', toss everything after a second '. Fixes * CTRL-] on 'option'. (would include the trailing '.'). */ if (*s == '\'' && s > arg && *arg == '\'') break; + /* Also '{' and '}'. */ + if (*s == '}' && s > arg && *arg == '{') + break; } *d = NUL; @@ -6185,12 +6710,79 @@ find_help_tags(arg, num_matches, matches, keep_lang) return OK; } +/* + * Called when starting to edit a buffer for a help file. + */ + static void +prepare_help_buffer(void) +{ + char_u *p; + + curbuf->b_help = TRUE; +#ifdef FEAT_QUICKFIX + set_string_option_direct((char_u *)"buftype", -1, + (char_u *)"help", OPT_FREE|OPT_LOCAL, 0); +#endif + + /* + * Always set these options after jumping to a help tag, because the + * user may have an autocommand that gets in the way. + * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and + * latin1 word characters (for translated help files). + * Only set it when needed, buf_init_chartab() is some work. + */ + p = +#ifdef EBCDIC + (char_u *)"65-255,^*,^|,^\""; +#else + (char_u *)"!-~,^*,^|,^\",192-255"; +#endif + if (STRCMP(curbuf->b_p_isk, p) != 0) + { + set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0); + check_buf_options(curbuf); + (void)buf_init_chartab(curbuf, FALSE); + } + +#ifdef FEAT_FOLDING + /* Don't use the global foldmethod.*/ + set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual", + OPT_FREE|OPT_LOCAL, 0); +#endif + + curbuf->b_p_ts = 8; /* 'tabstop' is 8 */ + curwin->w_p_list = FALSE; /* no list mode */ + + curbuf->b_p_ma = FALSE; /* not modifiable */ + curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */ + curwin->w_p_nu = 0; /* no line numbers */ + curwin->w_p_rnu = 0; /* no relative line numbers */ + RESET_BINDING(curwin); /* no scroll or cursor binding */ +#ifdef FEAT_ARABIC + curwin->w_p_arab = FALSE; /* no arabic mode */ +#endif +#ifdef FEAT_RIGHTLEFT + curwin->w_p_rl = FALSE; /* help window is left-to-right */ +#endif +#ifdef FEAT_FOLDING + curwin->w_p_fen = FALSE; /* No folding in the help window */ +#endif +#ifdef FEAT_DIFF + curwin->w_p_diff = FALSE; /* No 'diff' */ +#endif +#ifdef FEAT_SPELL + curwin->w_p_spell = FALSE; /* No spell checking */ +#endif + + set_buflisted(FALSE); +} + /* * After reading a help file: May cleanup a help buffer when syntax * highlighting is not used. */ void -fix_help_buffer() +fix_help_buffer(void) { linenr_T lnum; char_u *line; @@ -6201,8 +6793,13 @@ fix_help_buffer() char_u *rt; int mustfree; - /* set filetype to "help". */ - set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); + /* Set filetype to "help" if still needed. */ + if (STRCMP(curbuf->b_p_ft, "help") != 0) + { + ++curbuf_lock; + set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); + --curbuf_lock; + } #ifdef FEAT_SYN_HL if (!syntax_present(curwin)) @@ -6212,7 +6809,7 @@ fix_help_buffer() { line = ml_get_buf(curbuf, lnum, FALSE); len = (int)STRLEN(line); - if (in_example && len > 0 && !vim_iswhite(line[0])) + if (in_example && len > 0 && !VIM_ISWHITE(line[0])) { /* End of example: non-white or '<' in first column. */ if (line[0] == '<') @@ -6271,7 +6868,7 @@ fix_help_buffer() copy_option_part(&p, NameBuff, MAXPATHL, ","); mustfree = FALSE; rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); - if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME) + if (rt != NULL && fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME) { int fcount; char_u **fnames; @@ -6295,13 +6892,10 @@ fix_help_buffer() && fcount > 0) { #ifdef FEAT_MULTI_LANG - int i1; - int i2; - char_u *f1; - char_u *f2; - char_u *t1; - char_u *e1; - char_u *e2; + int i1, i2; + char_u *f1, *f2; + char_u *t1, *t2; + char_u *e1, *e2; /* If foo.abx is found use it instead of foo.txt in * the same directory. */ @@ -6316,29 +6910,25 @@ fix_help_buffer() f1 = fnames[i1]; f2 = fnames[i2]; t1 = gettail(f1); - if (fnamencmp(f1, f2, t1 - f1) != 0) - continue; + t2 = gettail(f2); e1 = vim_strrchr(t1, '.'); - e2 = vim_strrchr(gettail(f2), '.'); - if (e1 == NUL || e2 == NUL) + e2 = vim_strrchr(t2, '.'); + if (e1 == NULL || e2 == NULL) continue; if (fnamecmp(e1, ".txt") != 0 && fnamecmp(e1, fname + 4) != 0) { /* Not .txt and not .abx, remove it. */ - vim_free(fnames[i1]); - fnames[i1] = NULL; + VIM_CLEAR(fnames[i1]); continue; } - if (fnamencmp(f1, f2, e1 - f1) != 0) + if (e1 - f1 != e2 - f2 + || fnamencmp(f1, f2, e1 - f1) != 0) continue; if (fnamecmp(e1, ".txt") == 0 && fnamecmp(e2, fname + 4) == 0) - { /* use .abx instead of .txt */ - vim_free(fnames[i1]); - fnames[i1] = NULL; - } + VIM_CLEAR(fnames[i1]); } } #endif @@ -6422,168 +7012,39 @@ fix_help_buffer() } if (mustfree) vim_free(rt); - } - break; - } - } -} - -/* - * ":exusage" - */ - void -ex_exusage(eap) - exarg_T *eap UNUSED; -{ - do_cmdline_cmd((char_u *)"help ex-cmd-index"); -} - -/* - * ":viusage" - */ - void -ex_viusage(eap) - exarg_T *eap UNUSED; -{ - do_cmdline_cmd((char_u *)"help normal-index"); -} - -#if defined(FEAT_EX_EXTRA) || defined(PROTO) -static void helptags_one __ARGS((char_u *dir, char_u *ext, char_u *lang, int add_help_tags)); - -/* - * ":helptags" - */ - void -ex_helptags(eap) - exarg_T *eap; -{ - garray_T ga; - int i, j; - int len; -#ifdef FEAT_MULTI_LANG - char_u lang[2]; -#endif - expand_T xpc; - char_u *dirname; - char_u ext[5]; - char_u fname[8]; - int filecount; - char_u **files; - int add_help_tags = FALSE; - - /* Check for ":helptags ++t {dir}". */ - if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3])) - { - add_help_tags = TRUE; - eap->arg = skipwhite(eap->arg + 3); - } - - ExpandInit(&xpc); - xpc.xp_context = EXPAND_DIRECTORIES; - dirname = ExpandOne(&xpc, eap->arg, NULL, - WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); - if (dirname == NULL || !mch_isdir(dirname)) - { - EMSG2(_("E150: Not a directory: %s"), eap->arg); - return; - } - -#ifdef FEAT_MULTI_LANG - /* Get a list of all files in the help directory and in subdirectories. */ - STRCPY(NameBuff, dirname); - add_pathsep(NameBuff); - STRCAT(NameBuff, "**"); - if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, - EW_FILE|EW_SILENT) == FAIL - || filecount == 0) - { - EMSG2("E151: No match: %s", NameBuff); - vim_free(dirname); - return; - } - - /* Go over all files in the directory to find out what languages are - * present. */ - ga_init2(&ga, 1, 10); - for (i = 0; i < filecount; ++i) - { - len = (int)STRLEN(files[i]); - if (len > 4) - { - if (STRICMP(files[i] + len - 4, ".txt") == 0) - { - /* ".txt" -> language "en" */ - lang[0] = 'e'; - lang[1] = 'n'; - } - else if (files[i][len - 4] == '.' - && ASCII_ISALPHA(files[i][len - 3]) - && ASCII_ISALPHA(files[i][len - 2]) - && TOLOWER_ASC(files[i][len - 1]) == 'x') - { - /* ".abx" -> language "ab" */ - lang[0] = TOLOWER_ASC(files[i][len - 3]); - lang[1] = TOLOWER_ASC(files[i][len - 2]); - } - else - continue; - - /* Did we find this language already? */ - for (j = 0; j < ga.ga_len; j += 2) - if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0) - break; - if (j == ga.ga_len) - { - /* New language, add it. */ - if (ga_grow(&ga, 2) == FAIL) - break; - ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0]; - ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1]; - } - } - } - - /* - * Loop over the found languages to generate a tags file for each one. - */ - for (j = 0; j < ga.ga_len; j += 2) - { - STRCPY(fname, "tags-xx"); - fname[5] = ((char_u *)ga.ga_data)[j]; - fname[6] = ((char_u *)ga.ga_data)[j + 1]; - if (fname[5] == 'e' && fname[6] == 'n') - { - /* English is an exception: use ".txt" and "tags". */ - fname[4] = NUL; - STRCPY(ext, ".txt"); - } - else - { - /* Language "ab" uses ".abx" and "tags-ab". */ - STRCPY(ext, ".xxx"); - ext[1] = fname[5]; - ext[2] = fname[6]; + } + break; } - helptags_one(dirname, ext, fname, add_help_tags); } +} - ga_clear(&ga); - FreeWild(filecount, files); +/* + * ":exusage" + */ + void +ex_exusage(exarg_T *eap UNUSED) +{ + do_cmdline_cmd((char_u *)"help ex-cmd-index"); +} -#else - /* No language support, just use "*.txt" and "tags". */ - helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags); -#endif - vim_free(dirname); +/* + * ":viusage" + */ + void +ex_viusage(exarg_T *eap UNUSED) +{ + do_cmdline_cmd((char_u *)"help normal-index"); } +/* + * Generate tags in one help directory. + */ static void -helptags_one(dir, ext, tagfname, add_help_tags) - char_u *dir; /* doc directory */ - char_u *ext; /* suffix, ".txt", ".itx", ".frx", etc. */ - char_u *tagfname; /* "tags" for English, "tags-fr" for French. */ - int add_help_tags; /* add "help-tags" tag */ +helptags_one( + char_u *dir, /* doc directory */ + char_u *ext, /* suffix, ".txt", ".itx", ".frx", etc. */ + char_u *tagfname, /* "tags" for English, "tags-fr" for French. */ + int add_help_tags) /* add "help-tags" tag */ { FILE *fd_tags; FILE *fd; @@ -6615,7 +7076,7 @@ helptags_one(dir, ext, tagfname, add_help_tags) || filecount == 0) { if (!got_int) - EMSG2("E151: No match: %s", NameBuff); + EMSG2(_("E151: No match: %s"), NameBuff); return; } @@ -6768,7 +7229,8 @@ helptags_one(dir, ext, tagfname, add_help_tags) /* * Sort the tags. */ - sort_strings((char_u **)ga.ga_data, ga.ga_len); + if (ga.ga_data != NULL) + sort_strings((char_u **)ga.ga_data, ga.ga_len); /* * Check for duplicates. @@ -6832,7 +7294,150 @@ helptags_one(dir, ext, tagfname, add_help_tags) ga_clear(&ga); fclose(fd_tags); /* there is no check for an error... */ } + +/* + * Generate tags in one help directory, taking care of translations. + */ + static void +do_helptags(char_u *dirname, int add_help_tags) +{ +#ifdef FEAT_MULTI_LANG + int len; + int i, j; + garray_T ga; + char_u lang[2]; + char_u ext[5]; + char_u fname[8]; + int filecount; + char_u **files; + + /* Get a list of all files in the help directory and in subdirectories. */ + STRCPY(NameBuff, dirname); + add_pathsep(NameBuff); + STRCAT(NameBuff, "**"); + if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, + EW_FILE|EW_SILENT) == FAIL + || filecount == 0) + { + EMSG2(_("E151: No match: %s"), NameBuff); + return; + } + + /* Go over all files in the directory to find out what languages are + * present. */ + ga_init2(&ga, 1, 10); + for (i = 0; i < filecount; ++i) + { + len = (int)STRLEN(files[i]); + if (len > 4) + { + if (STRICMP(files[i] + len - 4, ".txt") == 0) + { + /* ".txt" -> language "en" */ + lang[0] = 'e'; + lang[1] = 'n'; + } + else if (files[i][len - 4] == '.' + && ASCII_ISALPHA(files[i][len - 3]) + && ASCII_ISALPHA(files[i][len - 2]) + && TOLOWER_ASC(files[i][len - 1]) == 'x') + { + /* ".abx" -> language "ab" */ + lang[0] = TOLOWER_ASC(files[i][len - 3]); + lang[1] = TOLOWER_ASC(files[i][len - 2]); + } + else + continue; + + /* Did we find this language already? */ + for (j = 0; j < ga.ga_len; j += 2) + if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0) + break; + if (j == ga.ga_len) + { + /* New language, add it. */ + if (ga_grow(&ga, 2) == FAIL) + break; + ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0]; + ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1]; + } + } + } + + /* + * Loop over the found languages to generate a tags file for each one. + */ + for (j = 0; j < ga.ga_len; j += 2) + { + STRCPY(fname, "tags-xx"); + fname[5] = ((char_u *)ga.ga_data)[j]; + fname[6] = ((char_u *)ga.ga_data)[j + 1]; + if (fname[5] == 'e' && fname[6] == 'n') + { + /* English is an exception: use ".txt" and "tags". */ + fname[4] = NUL; + STRCPY(ext, ".txt"); + } + else + { + /* Language "ab" uses ".abx" and "tags-ab". */ + STRCPY(ext, ".xxx"); + ext[1] = fname[5]; + ext[2] = fname[6]; + } + helptags_one(dirname, ext, fname, add_help_tags); + } + + ga_clear(&ga); + FreeWild(filecount, files); + +#else + /* No language support, just use "*.txt" and "tags". */ + helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags); #endif +} + + static void +helptags_cb(char_u *fname, void *cookie) +{ + do_helptags(fname, *(int *)cookie); +} + +/* + * ":helptags" + */ + void +ex_helptags(exarg_T *eap) +{ + expand_T xpc; + char_u *dirname; + int add_help_tags = FALSE; + + /* Check for ":helptags ++t {dir}". */ + if (STRNCMP(eap->arg, "++t", 3) == 0 && VIM_ISWHITE(eap->arg[3])) + { + add_help_tags = TRUE; + eap->arg = skipwhite(eap->arg + 3); + } + + if (STRCMP(eap->arg, "ALL") == 0) + { + do_in_path(p_rtp, (char_u *)"doc", DIP_ALL + DIP_DIR, + helptags_cb, &add_help_tags); + } + else + { + ExpandInit(&xpc); + xpc.xp_context = EXPAND_DIRECTORIES; + dirname = ExpandOne(&xpc, eap->arg, NULL, + WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); + if (dirname == NULL || !mch_isdir(dirname)) + EMSG2(_("E150: Not a directory: %s"), eap->arg); + else + do_helptags(dirname, add_help_tags); + vim_free(dirname); + } +} #if defined(FEAT_SIGNS) || defined(PROTO) @@ -6847,9 +7452,9 @@ struct sign int sn_typenr; /* type number of sign */ char_u *sn_name; /* name of sign */ char_u *sn_icon; /* name of pixmap */ -#ifdef FEAT_SIGN_ICONS +# ifdef FEAT_SIGN_ICONS void *sn_image; /* icon image */ -#endif +# endif char_u *sn_text; /* text used instead of pixmap */ int sn_line_hl; /* highlight ID for line */ int sn_text_hl; /* highlight ID for text */ @@ -6858,25 +7463,25 @@ struct sign static sign_T *first_sign = NULL; static int next_sign_typenr = 1; -static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd)); -static void sign_list_defined __ARGS((sign_T *sp)); -static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev)); +static int sign_cmd_idx(char_u *begin_cmd, char_u *end_cmd); +static void sign_list_defined(sign_T *sp); +static void sign_undefine(sign_T *sp, sign_T *sp_prev); static char *cmds[] = { "define", -#define SIGNCMD_DEFINE 0 +# define SIGNCMD_DEFINE 0 "undefine", -#define SIGNCMD_UNDEFINE 1 +# define SIGNCMD_UNDEFINE 1 "list", -#define SIGNCMD_LIST 2 +# define SIGNCMD_LIST 2 "place", -#define SIGNCMD_PLACE 3 +# define SIGNCMD_PLACE 3 "unplace", -#define SIGNCMD_UNPLACE 4 +# define SIGNCMD_UNPLACE 4 "jump", -#define SIGNCMD_JUMP 5 +# define SIGNCMD_JUMP 5 NULL -#define SIGNCMD_LAST 6 +# define SIGNCMD_LAST 6 }; /* @@ -6884,9 +7489,9 @@ static char *cmds[] = { * "*end_cmd" must be writable. */ static int -sign_cmd_idx(begin_cmd, end_cmd) - char_u *begin_cmd; /* begin of sign subcmd */ - char_u *end_cmd; /* just after sign subcmd */ +sign_cmd_idx( + char_u *begin_cmd, /* begin of sign subcmd */ + char_u *end_cmd) /* just after sign subcmd */ { int idx; char save = *end_cmd; @@ -6903,15 +7508,14 @@ sign_cmd_idx(begin_cmd, end_cmd) * ":sign" command */ void -ex_sign(eap) - exarg_T *eap; +ex_sign(exarg_T *eap) { char_u *arg = eap->arg; char_u *p; int idx; sign_T *sp; sign_T *sp_prev; - buf_T *buf; + buf_T *buf = NULL; /* Parse the subcommand. */ p = skiptowhite(arg); @@ -7019,7 +7623,7 @@ ex_sign(eap) vim_free(sp->sn_icon); sp->sn_icon = vim_strnsave(arg, (int)(p - arg)); backslash_halve(sp->sn_icon); -#ifdef FEAT_SIGN_ICONS +# ifdef FEAT_SIGN_ICONS if (gui.in_use) { out_flush(); @@ -7027,7 +7631,7 @@ ex_sign(eap) gui_mch_destroy_sign(sp->sn_image); sp->sn_image = gui_mch_register_sign(sp->sn_icon); } -#endif +# endif } else if (STRNCMP(arg, "text=", 5) == 0) { @@ -7036,7 +7640,7 @@ ex_sign(eap) int len; arg += 5; -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE /* Count cells and check for non-printable chars */ if (has_mbyte) { @@ -7049,7 +7653,7 @@ ex_sign(eap) } } else -#endif +# endif { for (s = arg; s < p; ++s) if (!vim_isprintc(*s)) @@ -7143,7 +7747,7 @@ ex_sign(eap) if (VIM_ISDIGIT(*arg)) { id = getdigits(&arg); - if (!vim_iswhite(*arg) && *arg != NUL) + if (!VIM_ISWHITE(*arg) && *arg != NUL) { id = -1; arg = arg1; @@ -7154,7 +7758,7 @@ ex_sign(eap) if (idx == SIGNCMD_UNPLACE && *arg == NUL) { /* ":sign unplace {id}": remove placed sign by number */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if ((lnum = buf_delsign(buf, id)) != 0) update_debug_sign(buf, lnum); return; @@ -7245,6 +7849,11 @@ ex_sign(eap) { /* ... not currently in a window */ char_u *cmd; + if (buf->b_fname == NULL) + { + EMSG(_("E934: Cannot jump to a buffer that does not have a name")); + return; + } cmd = alloc((unsigned)STRLEN(buf->b_fname) + 25); if (cmd == NULL) return; @@ -7252,9 +7861,9 @@ ex_sign(eap) do_cmdline_cmd(cmd); vim_free(cmd); } -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING foldOpenCursor(); -#endif +# endif } else EMSGN(_("E157: Invalid sign ID: %ld"), id); @@ -7304,13 +7913,13 @@ ex_sign(eap) } } -#if defined(FEAT_SIGN_ICONS) || defined(PROTO) +# if defined(FEAT_SIGN_ICONS) || defined(PROTO) /* * Allocate the icons. Called when the GUI has started. Allows defining * signs before it starts. */ void -sign_gui_started() +sign_gui_started(void) { sign_T *sp; @@ -7318,14 +7927,13 @@ sign_gui_started() if (sp->sn_icon != NULL) sp->sn_image = gui_mch_register_sign(sp->sn_icon); } -#endif +# endif /* * List one sign. */ static void -sign_list_defined(sp) - sign_T *sp; +sign_list_defined(sign_T *sp) { char_u *p; @@ -7334,12 +7942,12 @@ sign_list_defined(sp) { MSG_PUTS(" icon="); msg_outtrans(sp->sn_icon); -#ifdef FEAT_SIGN_ICONS +# ifdef FEAT_SIGN_ICONS if (sp->sn_image == NULL) MSG_PUTS(_(" (NOT FOUND)")); -#else +# else MSG_PUTS(_(" (not supported)")); -#endif +# endif } if (sp->sn_text != NULL) { @@ -7349,7 +7957,7 @@ sign_list_defined(sp) if (sp->sn_line_hl > 0) { MSG_PUTS(" linehl="); - p = get_highlight_name(NULL, sp->sn_line_hl - 1); + p = get_highlight_name_ext(NULL, sp->sn_line_hl - 1, FALSE); if (p == NULL) MSG_PUTS("NONE"); else @@ -7358,7 +7966,7 @@ sign_list_defined(sp) if (sp->sn_text_hl > 0) { MSG_PUTS(" texthl="); - p = get_highlight_name(NULL, sp->sn_text_hl - 1); + p = get_highlight_name_ext(NULL, sp->sn_text_hl - 1, FALSE); if (p == NULL) MSG_PUTS("NONE"); else @@ -7370,19 +7978,17 @@ sign_list_defined(sp) * Undefine a sign and free its memory. */ static void -sign_undefine(sp, sp_prev) - sign_T *sp; - sign_T *sp_prev; +sign_undefine(sign_T *sp, sign_T *sp_prev) { vim_free(sp->sn_name); vim_free(sp->sn_icon); -#ifdef FEAT_SIGN_ICONS +# ifdef FEAT_SIGN_ICONS if (sp->sn_image != NULL) { out_flush(); gui_mch_destroy_sign(sp->sn_image); } -#endif +# endif vim_free(sp->sn_text); if (sp_prev == NULL) first_sign = sp->sn_next; @@ -7396,9 +8002,7 @@ sign_undefine(sp, sp_prev) * If "line" is TRUE: line highl, if FALSE: text highl. */ int -sign_get_attr(typenr, line) - int typenr; - int line; +sign_get_attr(int typenr, int line) { sign_T *sp; @@ -7425,8 +8029,7 @@ sign_get_attr(typenr, line) * Returns NULL if there isn't one. */ char_u * -sign_get_text(typenr) - int typenr; +sign_get_text(int typenr) { sign_T *sp; @@ -7436,10 +8039,10 @@ sign_get_text(typenr) return NULL; } -#if defined(FEAT_SIGN_ICONS) || defined(PROTO) +# if defined(FEAT_SIGN_ICONS) || defined(PROTO) void * -sign_get_image(typenr) - int typenr; /* the attribute which may have a sign */ +sign_get_image( + int typenr) /* the attribute which may have a sign */ { sign_T *sp; @@ -7448,14 +8051,13 @@ sign_get_image(typenr) return sp->sn_image; return NULL; } -#endif +# endif /* * Get the name of a sign by its typenr. */ char_u * -sign_typenr2name(typenr) - int typenr; +sign_typenr2name(int typenr) { sign_T *sp; @@ -7465,19 +8067,19 @@ sign_typenr2name(typenr) return (char_u *)_("[Deleted]"); } -#if defined(EXITFREE) || defined(PROTO) +# if defined(EXITFREE) || defined(PROTO) /* * Undefine/free all signs. */ void -free_signs() +free_signs(void) { while (first_sign != NULL) sign_undefine(first_sign, NULL); } -#endif +# endif -#if defined(FEAT_CMDL_COMPL) || defined(PROTO) +# if defined(FEAT_CMDL_COMPL) || defined(PROTO) static enum { EXP_SUBCMD, /* expand :sign sub-commands */ @@ -7492,9 +8094,7 @@ static enum * expansion. */ char_u * -get_sign_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_sign_name(expand_T *xp UNUSED, int idx) { sign_T *sp; int current_idx; @@ -7540,9 +8140,7 @@ get_sign_name(xp, idx) * Handle command line completion for :sign command. */ void -set_context_in_sign_cmd(xp, arg) - expand_T *xp; - char_u *arg; +set_context_in_sign_cmd(expand_T *xp, char_u *arg) { char_u *p; char_u *end_subcmd; @@ -7609,7 +8207,7 @@ set_context_in_sign_cmd(xp, arg) /* :sign define {name} {args}... {last}= * | | * last p */ - if (p == NUL) + if (p == NULL) { /* Expand last argument name (before equal sign). */ xp->xp_pattern = last; @@ -7655,25 +8253,50 @@ set_context_in_sign_cmd(xp, arg) } } } +# endif #endif -#endif -#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) +/* + * Make the user happy. + */ + void +ex_smile(exarg_T *eap UNUSED) +{ + static char *code[] = { + "\34 \4o\14$\4ox\30 \2o\30$\1ox\25 \2o\36$\1o\11 \1o\1$\3 \2$\1 \1o\1$x\5 \1o\1 \1$\1 \2o\10 \1o\44$\1o\7 \2$\1 \2$\1 \2$\1o\1$x\2 \2o\1 \1$\1 \1$\1 \1\"\1$\6 \1o\11$\4 \15$\4 \11$\1o\7 \3$\1o\2$\1o\1$x\2 \1\"\6$\1o\1$\5 \1o\11$\6 \13$\6 \12$\1o\4 \10$x\4 \7$\4 \13$\6 \13$\6 \27$x\4 \27$\4 \15$\4 \16$\2 \3\"\3$x\5 \1\"\3$\4\"\61$\5 \1\"\3$x\6 \3$\3 \1o\62$\5 \1\"\3$\1ox\5 \1o\2$\1\"\3 \63$\7 \3$\1ox\5 \3$\4 \55$\1\"\1 \1\"\6$", + "\5o\4$\1ox\4 \1o\3$\4o\5$\2 \45$\3 \1o\21$x\4 \10$\1\"\4$\3 \42$\5 \4$\10\"x\3 \4\"\7 \4$\4 \1\"\34$\1\"\6 \1o\3$x\16 \1\"\3$\1o\5 \3\"\22$\1\"\2$\1\"\11 \3$x\20 \3$\1o\12 \1\"\2$\2\"\6$\4\"\13 \1o\3$x\21 \4$\1o\40 \1o\3$\1\"x\22 \1\"\4$\1o\6 \1o\6$\1o\1\"\4$\1o\10 \1o\4$x\24 \1\"\5$\2o\5 \2\"\4$\1o\5$\1o\3 \1o\4$\2\"x\27 \2\"\5$\4o\2 \1\"\3$\1o\11$\3\"x\32 \2\"\7$\2o\1 \12$x\42 \4\"\13$x\46 \14$x\47 \12$\1\"x\50 \1\"\3$\4\"x" + }; + char *p; + int n; + int i; + + msg_start(); + msg_putchar('\n'); + for (i = 0; i < 2; ++i) + for (p = code[i]; *p != NUL; ++p) + if (*p == 'x') + msg_putchar('\n'); + else + for (n = *p++; n > 0; --n) + if (*p == 'o' || *p == '$') + msg_putchar_attr(*p, HL_ATTR(HLF_L)); + else + msg_putchar(*p); + msg_clr_eos(); +} + /* * ":drop" * Opens the first argument in a window. When there are two or more arguments * the argument list is redefined. */ void -ex_drop(eap) - exarg_T *eap; +ex_drop(exarg_T *eap) { int split = FALSE; win_T *wp; buf_T *buf; -# ifdef FEAT_WINDOWS tabpage_T *tp; -# endif /* * Check if the first argument is already being edited in a window. If @@ -7693,7 +8316,6 @@ ex_drop(eap) if (ARGCOUNT == 0) return; -# ifdef FEAT_WINDOWS if (cmdmod.tab) { /* ":tab drop file ...": open a tab for each argument that isn't @@ -7702,7 +8324,6 @@ ex_drop(eap) ex_all(eap); } else -# endif { /* ":drop file ...": Edit the first argument. Jump to an existing * window if possible, edit in current window if the current buffer @@ -7713,9 +8334,7 @@ ex_drop(eap) { if (wp->w_buffer == buf) { -# ifdef FEAT_WINDOWS goto_tabpage_win(tp, wp); -# endif curwin->w_arg_idx = 0; return; } @@ -7727,18 +8346,11 @@ ex_drop(eap) * Skip the check if the 'hidden' option is set, as in this case the * buffer won't be lost. */ - if (!P_HID(curbuf)) + if (!buf_hide(curbuf)) { -# ifdef FEAT_WINDOWS ++emsg_off; -# endif split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); -# ifdef FEAT_WINDOWS --emsg_off; -# else - if (split) - return; -# endif } /* Fake a ":sfirst" or ":first" command edit the first argument. */ @@ -7752,4 +8364,119 @@ ex_drop(eap) ex_rewind(eap); } } + +/* + * Skip over the pattern argument of ":vimgrep /pat/[g][j]". + * Put the start of the pattern in "*s", unless "s" is NULL. + * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. + * If "s" is not NULL terminate the pattern with a NUL. + * Return a pointer to the char just past the pattern plus flags. + */ + char_u * +skip_vimgrep_pat(char_u *p, char_u **s, int *flags) +{ + int c; + + if (vim_isIDc(*p)) + { + /* ":vimgrep pattern fname" */ + if (s != NULL) + *s = p; + p = skiptowhite(p); + if (s != NULL && *p != NUL) + *p++ = NUL; + } + else + { + /* ":vimgrep /pattern/[g][j] fname" */ + if (s != NULL) + *s = p + 1; + c = *p; + p = skip_regexp(p + 1, c, TRUE, NULL); + if (*p != c) + return NULL; + + /* Truncate the pattern. */ + if (s != NULL) + *p = NUL; + ++p; + + /* Find the flags */ + while (*p == 'g' || *p == 'j') + { + if (flags != NULL) + { + if (*p == 'g') + *flags |= VGR_GLOBAL; + else + *flags |= VGR_NOJUMP; + } + ++p; + } + } + return p; +} + +#if defined(FEAT_EVAL) || defined(PROTO) +/* + * List v:oldfiles in a nice way. + */ + void +ex_oldfiles(exarg_T *eap UNUSED) +{ + list_T *l = get_vim_var_list(VV_OLDFILES); + listitem_T *li; + int nr = 0; + char_u *fname; + + if (l == NULL) + msg((char_u *)_("No old files")); + else + { + msg_start(); + msg_scroll = TRUE; + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) + { + ++nr; + fname = get_tv_string(&li->li_tv); + if (!message_filtered(fname)) + { + msg_outnum((long)nr); + MSG_PUTS(": "); + msg_outtrans(fname); + msg_clr_eos(); + msg_putchar('\n'); + out_flush(); /* output one line at a time */ + ui_breakcheck(); + } + } + + /* Assume "got_int" was set to truncate the listing. */ + got_int = FALSE; + +# ifdef FEAT_BROWSE_CMD + if (cmdmod.browse) + { + quit_more = FALSE; + nr = prompt_for_number(FALSE); + msg_starthere(); + if (nr > 0) + { + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), + (long)nr); + + if (p != NULL) + { + p = expand_env_save(p); + eap->arg = p; + eap->cmdidx = CMD_edit; + cmdmod.browse = FALSE; + do_exedit(eap, NULL); + vim_free(p); + } + } + } +# endif + } +} #endif diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 4558c8bfba..2146b34911 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -51,13 +51,26 @@ #define BUFUNL 0x20000L /* accepts unlisted buffer too */ #define ARGOPT 0x40000L /* allow "++opt=val" argument */ #define SBOXOK 0x80000L /* allowed in the sandbox */ -#define CMDWIN 0x100000L /* allowed in cmdline window */ +#define CMDWIN 0x100000L /* allowed in cmdline window; when missing + * disallows editing another buffer when + * curbuf_lock is set */ #define MODIFY 0x200000L /* forbidden in non-'modifiable' buffer */ #define EXFLAGS 0x400000L /* allow flags after count in argument */ #define FILES (XFILE | EXTRA) /* multiple extra files allowed */ #define WORD1 (EXTRA | NOSPC) /* one extra word allowed */ #define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */ +/* values for cmd_addr_type */ +#define ADDR_LINES 0 +#define ADDR_WINDOWS 1 +#define ADDR_ARGUMENTS 2 +#define ADDR_LOADED_BUFFERS 3 +#define ADDR_BUFFERS 4 +#define ADDR_TABS 5 +#define ADDR_TABS_RELATIVE 6 /* Tab page that only relative */ +#define ADDR_QUICKFIX 7 +#define ADDR_OTHER 99 + #ifndef DO_DECLARE_EXCMD typedef struct exarg exarg_T; #endif @@ -74,1075 +87,1662 @@ typedef struct exarg exarg_T; # undef EX /* just in case */ #endif #ifdef DO_DECLARE_EXCMD -# define EX(a, b, c, d) {(char_u *)b, c, (long_u)(d)} +# define EX(a, b, c, d, e) {(char_u *)b, c, (long_u)(d), e} -typedef void (*ex_func_T) __ARGS((exarg_T *eap)); +typedef void (*ex_func_T) (exarg_T *eap); static struct cmdname { char_u *cmd_name; /* name of the command */ ex_func_T cmd_func; /* function for this command */ long_u cmd_argt; /* flags declared above */ -} -# if defined(FEAT_GUI_W16) -_far -# endif -cmdnames[] = + int cmd_addr_type; /* flag for address type */ +} cmdnames[] = #else -# define EX(a, b, c, d) a +# define EX(a, b, c, d, e) a enum CMD_index #endif { EX(CMD_append, "append", ex_append, - BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_abbreviate, "abbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_abclear, "abclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_aboveleft, "aboveleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_all, "all", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_amenu, "amenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_anoremenu, "anoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_args, "args", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_argadd, "argadd", ex_argadd, - BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR), + BANG|RANGE|NOTADR|ZEROR|FILES|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argdelete, "argdelete", ex_argdelete, - BANG|RANGE|NOTADR|FILES|TRLBAR), + BANG|RANGE|NOTADR|FILES|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argdo, "argdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_ARGUMENTS), EX(CMD_argedit, "argedit", ex_argedit, - BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argglobal, "argglobal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_arglocal, "arglocal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_argument, "argument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_ascii, "ascii", do_ascii, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_autocmd, "autocmd", ex_autocmd, - BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_augroup, "augroup", ex_autocmd, - BANG|WORD1|TRLBAR|CMDWIN), + BANG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_aunmenu, "aunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_buffer, "buffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, + ADDR_BUFFERS), EX(CMD_bNext, "bNext", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_ball, "ball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_badd, "badd", ex_edit, - NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN), + NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_bdelete, "bdelete", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_BUFFERS), EX(CMD_behave, "behave", ex_behave, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_belowright, "belowright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_bfirst, "bfirst", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_blast, "blast", ex_blast, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_bmodified, "bmodified", ex_bmodified, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_bnext, "bnext", ex_bnext, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_botright, "botright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_bprevious, "bprevious", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_brewind, "brewind", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_break, "break", ex_break, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_breakadd, "breakadd", ex_breakadd, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_breakdel, "breakdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_breaklist, "breaklist", ex_breaklist, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_browse, "browse", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_buffers, "buffers", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_bufdo, "bufdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_BUFFERS), EX(CMD_bunload, "bunload", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_LOADED_BUFFERS), EX(CMD_bwipeout, "bwipeout", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR, + ADDR_BUFFERS), EX(CMD_change, "change", ex_change, - BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY), + BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_cNext, "cNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cNfile, "cNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cabbrev, "cabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cabclear, "cabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_caddbuffer, "caddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_caddexpr, "caddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_caddfile, "caddfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_call, "call", ex_call, - RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_catch, "catch", ex_catch, - EXTRA|SBOXOK|CMDWIN), + EXTRA|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_cbuffer, "cbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), + BANG|RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), +EX(CMD_cbottom, "cbottom", ex_cbottom, + TRLBAR, + ADDR_LINES), EX(CMD_cc, "cc", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cclose, "cclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cd, "cd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), +EX(CMD_cdo, "cdo", ex_listdo, + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_QUICKFIX), EX(CMD_center, "center", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_cexpr, "cexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), + NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cfile, "cfile", ex_cfile, - TRLBAR|FILE1|BANG), + TRLBAR|FILE1|BANG, + ADDR_LINES), +EX(CMD_cfdo, "cfdo", ex_listdo, + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_QUICKFIX), EX(CMD_cfirst, "cfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cgetfile, "cgetfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_cgetbuffer, "cgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_cgetexpr, "cgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_chdir, "chdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_changes, "changes", ex_changes, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_checkpath, "checkpath", ex_checkpath, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_checktime, "checktime", ex_checktime, - RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_LINES), +EX(CMD_chistory, "chistory", qf_history, + TRLBAR, + ADDR_LINES), EX(CMD_clist, "clist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_clast, "clast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_close, "close", ex_close, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|NOTADR|COUNT|TRLBAR|CMDWIN, + ADDR_WINDOWS), +EX(CMD_clearjumps, "clearjumps", ex_clearjumps, + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_cmap, "cmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cmapclear, "cmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_cmenu, "cmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnext, "cnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cnewer, "cnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cnfile, "cnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cnoremap, "cnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnoreabbrev, "cnoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnoremenu, "cnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_copy, "copy", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_colder, "colder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_colorscheme, "colorscheme", ex_colorscheme, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_command, "command", ex_command, - EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_comclear, "comclear", ex_comclear, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_compiler, "compiler", ex_compiler, - BANG|TRLBAR|WORD1|CMDWIN), + BANG|TRLBAR|WORD1|CMDWIN, + ADDR_LINES), EX(CMD_continue, "continue", ex_continue, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_confirm, "confirm", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_copen, "copen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cprevious, "cprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cpfile, "cpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cquit, "cquit", ex_cquit, - TRLBAR|BANG), + TRLBAR|BANG, + ADDR_LINES), EX(CMD_crewind, "crewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), -EX(CMD_cscope, "cscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), -EX(CMD_cstag, "cstag", do_cstag, - BANG|TRLBAR|WORD1), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), +EX(CMD_cscope, "cscope", ex_cscope, + EXTRA|NOTRLCOM|XFILE, + ADDR_LINES), +EX(CMD_cstag, "cstag", ex_cstag, + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_cunmap, "cunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cunabbrev, "cunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cunmenu, "cunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cwindow, "cwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_delete, "delete", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_delmarks, "delmarks", ex_delmarks, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_debug, "debug", ex_debug, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_debuggreedy, "debuggreedy", ex_debuggreedy, - RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN), + RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_delcommand, "delcommand", ex_delcommand, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_delfunction, "delfunction", ex_delfunction, - NEEDARG|WORD1|CMDWIN), + BANG|NEEDARG|WORD1|CMDWIN, + ADDR_LINES), EX(CMD_display, "display", ex_display, - EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_diffupdate, "diffupdate", ex_diffupdate, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_diffget, "diffget", ex_diffgetput, - RANGE|EXTRA|TRLBAR|MODIFY), + RANGE|EXTRA|TRLBAR|MODIFY, + ADDR_LINES), EX(CMD_diffoff, "diffoff", ex_diffoff, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_diffpatch, "diffpatch", ex_diffpatch, - EXTRA|FILE1|TRLBAR|MODIFY), + EXTRA|FILE1|TRLBAR|MODIFY, + ADDR_LINES), EX(CMD_diffput, "diffput", ex_diffgetput, - RANGE|EXTRA|TRLBAR), + RANGE|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_diffsplit, "diffsplit", ex_diffsplit, - EXTRA|FILE1|TRLBAR), + EXTRA|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_diffthis, "diffthis", ex_diffthis, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_digraphs, "digraphs", ex_digraphs, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_djump, "djump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_dlist, "dlist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_doautocmd, "doautocmd", ex_doautocmd, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_doautoall, "doautoall", ex_doautoall, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_drop, "drop", ex_drop, - FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR), + FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_dsearch, "dsearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_dsplit, "dsplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_edit, "edit", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_earlier, "earlier", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), + TRLBAR|EXTRA|NOSPC|CMDWIN, + ADDR_LINES), EX(CMD_echo, "echo", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echoerr, "echoerr", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echohl, "echohl", ex_echohl, - EXTRA|TRLBAR|SBOXOK|CMDWIN), + EXTRA|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echomsg, "echomsg", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echon, "echon", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_else, "else", ex_else, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_elseif, "elseif", ex_else, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_emenu, "emenu", ex_emenu, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN), + NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN, + ADDR_LINES), EX(CMD_endif, "endif", ex_endif, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endfunction, "endfunction", ex_endfunction, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_endfor, "endfor", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endtry, "endtry", ex_endtry, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endwhile, "endwhile", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_enew, "enew", ex_edit, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_ex, "ex", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_execute, "execute", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_exit, "exit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_exusage, "exusage", ex_exusage, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_file, "file", ex_file, - RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR), + RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_files, "files", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_filetype, "filetype", ex_filetype, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), +EX(CMD_filter, "filter", ex_wrongmodifier, + BANG|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_find, "find", ex_find, - RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_finally, "finally", ex_finally, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_finish, "finish", ex_finish, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_first, "first", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_fixdel, "fixdel", do_fixdel, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_fold, "fold", ex_fold, - RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_foldclose, "foldclose", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_folddoopen, "folddoopen", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), + RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_folddoclosed, "folddoclosed", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), + RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_foldopen, "foldopen", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_for, "for", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_function, "function", ex_function, - EXTRA|BANG|CMDWIN), + EXTRA|BANG|CMDWIN, + ADDR_LINES), EX(CMD_global, "global", ex_global, - RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN), + RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_goto, "goto", ex_goto, - RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN), + RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_grep, "grep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_grepadd, "grepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_gui, "gui", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_gvim, "gvim", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_help, "help", ex_help, - BANG|EXTRA|NOTRLCOM), + BANG|EXTRA|NOTRLCOM, + ADDR_LINES), +EX(CMD_helpclose, "helpclose", ex_helpclose, + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_helpfind, "helpfind", ex_helpfind, - EXTRA|NOTRLCOM), + EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_helpgrep, "helpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), + EXTRA|NOTRLCOM|NEEDARG, + ADDR_LINES), EX(CMD_helptags, "helptags", ex_helptags, - NEEDARG|FILES|TRLBAR|CMDWIN), + NEEDARG|FILES|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_hardcopy, "hardcopy", ex_hardcopy, - RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG), + RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG, + ADDR_LINES), EX(CMD_highlight, "highlight", ex_highlight, - BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN), + BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_hide, "hide", ex_hide, - BANG|EXTRA|NOTRLCOM), + BANG|RANGE|NOTADR|COUNT|EXTRA|TRLBAR, + ADDR_WINDOWS), EX(CMD_history, "history", ex_history, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_insert, "insert", ex_append, - BANG|RANGE|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_iabbrev, "iabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iabclear, "iabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_if, "if", ex_if, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_ijump, "ijump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_ilist, "ilist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_imap, "imap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_imapclear, "imapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_imenu, "imenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoremap, "inoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoreabbrev, "inoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoremenu, "inoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_intro, "intro", ex_intro, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_isearch, "isearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_isplit, "isplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_iunmap, "iunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iunabbrev, "iunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iunmenu, "iunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_join, "join", ex_join, - BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_jumps, "jumps", ex_jumps, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_k, "k", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), + RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keepalt, "keepalt", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_list, "list", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lNext, "lNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lNfile, "lNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_last, "last", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_language, "language", ex_language, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_laddexpr, "laddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_laddfile, "laddfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_later, "later", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), + TRLBAR|EXTRA|NOSPC|CMDWIN, + ADDR_LINES), EX(CMD_lbuffer, "lbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), + BANG|RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), +EX(CMD_lbottom, "lbottom", ex_cbottom, + TRLBAR, + ADDR_LINES), EX(CMD_lcd, "lcd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lchdir, "lchdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lclose, "lclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), -EX(CMD_lcscope, "lcscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), +EX(CMD_lcscope, "lcscope", ex_cscope, + EXTRA|NOTRLCOM|XFILE, + ADDR_LINES), +EX(CMD_ldo, "ldo", ex_listdo, + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_QUICKFIX), EX(CMD_left, "left", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_leftabove, "leftabove", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_let, "let", ex_let, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_lexpr, "lexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), + NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lfile, "lfile", ex_cfile, - TRLBAR|FILE1|BANG), + TRLBAR|FILE1|BANG, + ADDR_LINES), +EX(CMD_lfdo, "lfdo", ex_listdo, + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_QUICKFIX), EX(CMD_lfirst, "lfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lgetfile, "lgetfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_lgetbuffer, "lgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_lgetexpr, "lgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_lgrep, "lgrep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lgrepadd, "lgrepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), + EXTRA|NOTRLCOM|NEEDARG, + ADDR_LINES), +EX(CMD_lhistory, "lhistory", qf_history, + TRLBAR, + ADDR_LINES), EX(CMD_ll, "ll", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_llast, "llast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_llist, "llist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lmap, "lmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lmapclear, "lmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lmake, "lmake", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lnoremap, "lnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lnext, "lnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lnewer, "lnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lnfile, "lnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_loadview, "loadview", ex_loadview, - FILE1|TRLBAR), + FILE1|TRLBAR, + ADDR_LINES), EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap, - CMDWIN), + CMDWIN, + ADDR_LINES), EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_lockvar, "lockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_lolder, "lolder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lopen, "lopen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lprevious, "lprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lpfile, "lpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lrewind, "lrewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_ltag, "ltag", ex_tag, - NOTADR|TRLBAR|BANG|WORD1), + NOTADR|TRLBAR|BANG|WORD1, + ADDR_LINES), EX(CMD_lunmap, "lunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lua, "lua", ex_lua, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_luado, "luado", ex_luado, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_luafile, "luafile", ex_luafile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lwindow, "lwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_ls, "ls", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_move, "move", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_mark, "mark", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), + RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_make, "make", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_map, "map", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_mapclear, "mapclear", ex_mapclear, - EXTRA|BANG|TRLBAR|CMDWIN), + EXTRA|BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_marks, "marks", do_marks, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_match, "match", ex_match, - RANGE|NOTADR|EXTRA|CMDWIN), + RANGE|NOTADR|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_macaction, "macaction", ex_macaction, - EXTRA|NOSPC|NEEDARG), + EXTRA|NOSPC|NEEDARG, + ADDR_LINES), EX(CMD_macmenu, "macmenu", ex_macmenu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_menu, "menu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_menutranslate, "menutranslate", ex_menutranslate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_messages, "messages", ex_messages, - TRLBAR|CMDWIN), + EXTRA|TRLBAR|RANGE|CMDWIN, + ADDR_OTHER), EX(CMD_mkexrc, "mkexrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mksession, "mksession", ex_mkrc, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_mkspell, "mkspell", ex_mkspell, - BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_mkvimrc, "mkvimrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mkview, "mkview", ex_mkrc, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_mode, "mode", ex_mode, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mzscheme, "mzscheme", ex_mzscheme, - RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK), + RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_mzfile, "mzfile", ex_mzfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_next, "next", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_nbkey, "nbkey", ex_nbkey, - EXTRA|NOTADR|NEEDARG), + EXTRA|NOTADR|NEEDARG, + ADDR_LINES), EX(CMD_nbclose, "nbclose", ex_nbclose, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nbstart, "nbstart", ex_nbstart, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_new, "new", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_nmap, "nmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nmapclear, "nmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nmenu, "nmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nnoremap, "nnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nnoremenu, "nnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noremap, "noremap", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noremenu, "noremenu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noswapfile, "noswapfile", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_normal, "normal", ex_normal, - RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN), + RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_number, "number", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nunmap, "nunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nunmenu, "nunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_open, "open", ex_open, - RANGE|BANG|EXTRA), + RANGE|BANG|EXTRA, + ADDR_LINES), EX(CMD_oldfiles, "oldfiles", ex_oldfiles, - BANG|TRLBAR|SBOXOK|CMDWIN), + BANG|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_omap, "omap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_omapclear, "omapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_omenu, "omenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_only, "only", ex_only, - BANG|TRLBAR), + BANG|NOTADR|RANGE|COUNT|TRLBAR, + ADDR_WINDOWS), EX(CMD_onoremap, "onoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_onoremenu, "onoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_options, "options", ex_options, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_ounmap, "ounmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_ounmenu, "ounmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_print, "print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK, + ADDR_LINES), +EX(CMD_packadd, "packadd", ex_packadd, + BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), +EX(CMD_packloadall, "packloadall", ex_packloadall, + BANG|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_pclose, "pclose", ex_pclose, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_perl, "perl", ex_perl, - RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN), + RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_perldo, "perldo", ex_perldo, - RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN), + RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pedit, "pedit", ex_pedit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_pop, "pop", ex_tag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_popup, "popup", ex_popup, - NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_ppop, "ppop", ex_ptag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_preserve, "preserve", ex_preserve, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_previous, "previous", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_promptfind, "promptfind", gui_mch_find_dialog, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_promptrepl, "promptrepl", gui_mch_replace_dialog, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_profile, "profile", ex_profile, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_profdel, "profdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_psearch, "psearch", ex_psearch, - BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA), + BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA, + ADDR_LINES), EX(CMD_ptag, "ptag", ex_ptag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptNext, "ptNext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptfirst, "ptfirst", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptjump, "ptjump", ex_ptag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_ptlast, "ptlast", ex_ptag, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_ptnext, "ptnext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptprevious, "ptprevious", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptrewind, "ptrewind", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptselect, "ptselect", ex_ptag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_put, "put", ex_put, - RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_pwd, "pwd", ex_pwd, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_python, "python", ex_python, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pydo, "pydo", ex_pydo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pyfile, "pyfile", ex_pyfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3, "py3", ex_py3, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3do, "py3do", ex_py3do, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_python3, "python3", ex_py3, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3file, "py3file", ex_py3file, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), +EX(CMD_pyx, "pyx", ex_pyx, + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), +EX(CMD_pyxdo, "pyxdo", ex_pyxdo, + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), +EX(CMD_pythonx, "pythonx", ex_pyx, + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), +EX(CMD_pyxfile, "pyxfile", ex_pyxfile, + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_quit, "quit", ex_quit, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|COUNT|NOTADR|TRLBAR|CMDWIN, + ADDR_WINDOWS), EX(CMD_quitall, "quitall", ex_quit_all, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_qall, "qall", ex_quit_all, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_read, "read", ex_read, - BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY), + BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_recover, "recover", ex_recover, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_redo, "redo", ex_redo, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redir, "redir", ex_redir, - BANG|FILES|TRLBAR|CMDWIN), + BANG|FILES|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redraw, "redraw", ex_redraw, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redrawstatus, "redrawstatus", ex_redrawstatus, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_registers, "registers", ex_display, - EXTRA|NOTRLCOM|TRLBAR|CMDWIN), + EXTRA|NOTRLCOM|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_resize, "resize", ex_resize, - RANGE|NOTADR|TRLBAR|WORD1), + RANGE|NOTADR|TRLBAR|WORD1|CMDWIN, + ADDR_LINES), EX(CMD_retab, "retab", ex_retab, - TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_return, "return", ex_return, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_rewind, "rewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_right, "right", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_rightbelow, "rightbelow", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_runtime, "runtime", ex_runtime, - BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN), + BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_ruby, "ruby", ex_ruby, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rubydo, "rubydo", ex_rubydo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rubyfile, "rubyfile", ex_rubyfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rundo, "rundo", ex_rundo, - NEEDARG|FILE1), + NEEDARG|FILE1, + ADDR_LINES), EX(CMD_rviminfo, "rviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_substitute, "substitute", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_sNext, "sNext", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_sargument, "sargument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_sall, "sall", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_sandbox, "sandbox", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_saveas, "saveas", ex_write, - BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR), + BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR, + ADDR_LINES), EX(CMD_sbuffer, "sbuffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, + ADDR_BUFFERS), EX(CMD_sbNext, "sbNext", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sball, "sball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbfirst, "sbfirst", ex_brewind, - TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sblast, "sblast", ex_blast, - TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbmodified, "sbmodified", ex_bmodified, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbnext, "sbnext", ex_bnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbprevious, "sbprevious", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbrewind, "sbrewind", ex_brewind, - TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_scriptnames, "scriptnames", ex_scriptnames, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, - WORD1|TRLBAR|CMDWIN), -EX(CMD_scscope, "scscope", do_scscope, - EXTRA|NOTRLCOM), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), +EX(CMD_scscope, "scscope", ex_scscope, + EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_set, "set", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_setfiletype, "setfiletype", ex_setfiletype, - TRLBAR|EXTRA|NEEDARG|CMDWIN), + TRLBAR|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_setglobal, "setglobal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_setlocal, "setlocal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_sfind, "sfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_sfirst, "sfirst", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_shell, "shell", ex_shell, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_simalt, "simalt", ex_simalt, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_sign, "sign", ex_sign, - NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN), + NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_silent, "silent", ex_wrongmodifier, - NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_sleep, "sleep", ex_sleep, - RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN), + RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_slast, "slast", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_smagic, "smagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_smap, "smap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_smapclear, "smapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_smenu, "smenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_snext, "snext", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), -EX(CMD_sniff, "sniff", ex_sniff, - EXTRA|TRLBAR), + RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_snomagic, "snomagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_snoremap, "snoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_snoremenu, "snoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_source, "source", ex_source, - BANG|FILE1|TRLBAR|SBOXOK|CMDWIN), + BANG|FILE1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_sort, "sort", ex_sort, - RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY), + RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY, + ADDR_LINES), EX(CMD_split, "split", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_spellgood, "spellgood", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_spelldump, "spelldump", ex_spelldump, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_spellinfo, "spellinfo", ex_spellinfo, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_spellrepall, "spellrepall", ex_spellrepall, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_spellundo, "spellundo", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_spellwrong, "spellwrong", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_sprevious, "sprevious", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_srewind, "srewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_stop, "stop", ex_stop, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_stag, "stag", ex_stag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_startinsert, "startinsert", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_startgreplace, "startgreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_startreplace, "startreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_stopinsert, "stopinsert", ex_stopinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_stjump, "stjump", ex_stag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_stselect, "stselect", ex_stag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_sunhide, "sunhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_sunmap, "sunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_sunmenu, "sunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_suspend, "suspend", ex_stop, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_sview, "sview", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_swapname, "swapname", ex_swapname, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_syntax, "syntax", ex_syntax, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_syntime, "syntime", ex_syntime, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_syncbind, "syncbind", ex_syncbind, - TRLBAR), + TRLBAR, + ADDR_LINES), +EX(CMD_smile, "smile", ex_smile, + TRLBAR|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_t, "t", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_tNext, "tNext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_tag, "tag", ex_tag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_tags, "tags", do_tags, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_tab, "tab", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_TABS), EX(CMD_tabclose, "tabclose", ex_tabclose, - RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN), + BANG|RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR|CMDWIN, + ADDR_TABS), EX(CMD_tabdo, "tabdo", ex_listdo, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_TABS), EX(CMD_tabedit, "tabedit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR, + ADDR_TABS), EX(CMD_tabfind, "tabfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR, + ADDR_TABS), EX(CMD_tabfirst, "tabfirst", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_TABS), EX(CMD_tabmove, "tabmove", ex_tabmove, - RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR), + RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR, + ADDR_TABS), EX(CMD_tablast, "tablast", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_TABS), EX(CMD_tabnext, "tabnext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR, + ADDR_TABS), EX(CMD_tabnew, "tabnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR, + ADDR_TABS), EX(CMD_tabonly, "tabonly", ex_tabonly, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR|CMDWIN, + ADDR_TABS), EX(CMD_tabprevious, "tabprevious", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR, + ADDR_TABS_RELATIVE), EX(CMD_tabNext, "tabNext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR, + ADDR_TABS_RELATIVE), EX(CMD_tabrewind, "tabrewind", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_TABS), EX(CMD_tabs, "tabs", ex_tabs, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_TABS), EX(CMD_tcl, "tcl", ex_tcl, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tcldo, "tcldo", ex_tcldo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tclfile, "tclfile", ex_tclfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tearoff, "tearoff", ex_tearoff, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN, + ADDR_LINES), +EX(CMD_terminal, "terminal", ex_terminal, + RANGE|BANG|FILES|CMDWIN, + ADDR_LINES), EX(CMD_tfirst, "tfirst", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_throw, "throw", ex_throw, - EXTRA|NEEDARG|SBOXOK|CMDWIN), + EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_tjump, "tjump", ex_tag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_tlast, "tlast", ex_tag, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_tmenu, "tmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), +EX(CMD_tmap, "tmap", ex_map, + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), +EX(CMD_tmapclear, "tmapclear", ex_mapclear, + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_tnext, "tnext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), +EX(CMD_tnoremap, "tnoremap", ex_map, + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_topleft, "topleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_tprevious, "tprevious", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_trewind, "trewind", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_try, "try", ex_try, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_tselect, "tselect", ex_tag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_tunmenu, "tunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), +EX(CMD_tunmap, "tunmap", ex_unmap, + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_undo, "undo", ex_undo, - RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN), + RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_undojoin, "undojoin", ex_undojoin, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_undolist, "undolist", ex_undolist, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_unabbreviate, "unabbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unhide, "unhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_unlet, "unlet", ex_unlet, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_unlockvar, "unlockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_unmap, "unmap", ex_unmap, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unmenu, "unmenu", ex_menu, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unsilent, "unsilent", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_update, "update", ex_update, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_vglobal, "vglobal", ex_global, - RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN, + ADDR_LINES), EX(CMD_version, "version", ex_version, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_verbose, "verbose", ex_wrongmodifier, - NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_vertical, "vertical", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_visual, "visual", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_view, "view", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vimgrep, "vimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_viusage, "viusage", ex_viusage, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_vmap, "vmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vmapclear, "vmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_vmenu, "vmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vnoremap, "vnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vnew, "vnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vnoremenu, "vnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vsplit, "vsplit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vunmap, "vunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vunmenu, "vunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_write, "write", ex_write, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_wNext, "wNext", ex_wnext, - RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wall, "wall", do_wqall, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_while, "while", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_winsize, "winsize", ex_winsize, - EXTRA|NEEDARG|TRLBAR), + EXTRA|NEEDARG|TRLBAR, + ADDR_LINES), EX(CMD_wincmd, "wincmd", ex_wincmd, - NEEDARG|WORD1|RANGE|NOTADR), + NEEDARG|WORD1|RANGE|NOTADR|CMDWIN, + ADDR_WINDOWS), EX(CMD_windo, "windo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_WINDOWS), EX(CMD_winpos, "winpos", ex_winpos, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_wnext, "wnext", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wprevious, "wprevious", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wq, "wq", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_wqall, "wqall", do_wqall, - BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_wsverb, "wsverb", ex_wsverb, - EXTRA|NOTADR|NEEDARG), + EXTRA|NOTADR|NEEDARG, + ADDR_LINES), EX(CMD_wundo, "wundo", ex_wundo, - BANG|NEEDARG|FILE1), + BANG|NEEDARG|FILE1, + ADDR_LINES), EX(CMD_wviminfo, "wviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xit, "xit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xall, "xall", do_wqall, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_xmap, "xmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xmapclear, "xmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xmenu, "xmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xnoremap, "xnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xnoremenu, "xnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xunmap, "xunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xunmenu, "xunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_yank, "yank", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_z, "z", ex_z, - RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), /* commands that don't start with a lowercase letter */ EX(CMD_bang, "!", ex_bang, - RANGE|WHOLEFOLD|BANG|FILES|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILES|CMDWIN, + ADDR_LINES), EX(CMD_pound, "#", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_and, "&", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_star, "*", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lshift, "<", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_equal, "=", ex_equal, - RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN), + RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN, + ADDR_LINES), EX(CMD_rshift, ">", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_at, "@", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_Next, "Next", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_Print, "Print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_X, "X", ex_X, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_tilde, "~", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), #ifndef DO_DECLARE_EXCMD #ifdef FEAT_USR_CMDS @@ -1155,8 +1755,6 @@ EX(CMD_tilde, "~", do_sub, #endif }; -#define USER_CMDIDX(idx) ((int)(idx) < 0) - #ifndef DO_DECLARE_EXCMD typedef enum CMD_index cmdidx_T; @@ -1176,6 +1774,7 @@ struct exarg int addr_count; /* the number of addresses given */ linenr_T line1; /* the first line number */ linenr_T line2; /* the second line number or count */ + int addr_type; /* type of the count/range */ int flags; /* extra flags after count: EXFLAG_ */ char_u *do_ecmd_cmd; /* +command arg to be used in edited file */ linenr_T do_ecmd_lnum; /* the line number in an edited file */ @@ -1185,7 +1784,7 @@ struct exarg int regname; /* register name (NUL if none) */ int force_bin; /* 0, FORCE_BIN or FORCE_NOBIN */ int read_edit; /* ++edit argument */ - int force_ff; /* ++ff= argument (index in cmd[]) */ + int force_ff; /* ++ff= argument (first char of argument) */ #ifdef FEAT_MBYTE int force_enc; /* ++enc= argument (index in cmd[]) */ int bad_char; /* BAD_KEEP, BAD_DROP or replacement byte */ @@ -1194,7 +1793,7 @@ struct exarg int useridx; /* user command index */ #endif char_u *errmsg; /* returned error message */ - char_u *(*getline) __ARGS((int, void *, int)); + char_u *(*getline)(int, void *, int); void *cookie; /* argument for getline() */ #ifdef FEAT_EVAL struct condstack *cstack; /* condition stack for ":if" etc. */ diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 2198f16c41..c4734f6c14 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -14,7 +14,7 @@ #include "vim.h" #include "version.h" -static void cmd_source __ARGS((char_u *fname, exarg_T *eap)); +static void cmd_source(char_u *fname, exarg_T *eap); #ifdef FEAT_EVAL /* Growarray to store info about already sourced scripts. @@ -68,14 +68,27 @@ typedef struct sn_prl_S #if defined(FEAT_EVAL) || defined(PROTO) static int debug_greedy = FALSE; /* batch mode debugging: don't save and restore typeahead. */ +static int get_maxbacktrace_level(void); +static void do_setdebugtracelevel(char_u *arg); +static void do_checkbacktracelevel(void); +static void do_showbacktrace(char_u *cmd); + +static char_u *debug_oldval = NULL; /* old and newval for debug expressions */ +static char_u *debug_newval = NULL; +static int debug_expr = 0; /* use debug_expr */ + + int +has_watchexpr(void) +{ + return debug_expr; +} /* * do_debug(): Debug mode. * Repeatedly get Ex commands, until told to continue normal execution. */ void -do_debug(cmd) - char_u *cmd; +do_debug(char_u *cmd) { int save_msg_scroll = msg_scroll; int save_State = State; @@ -87,9 +100,7 @@ do_debug(cmd) tasave_T typeaheadbuf; int typeahead_saved = FALSE; int save_ignore_script = 0; -# ifdef FEAT_EX_EXTRA int save_ex_normal_busy; -# endif int n; char_u *cmdline = NULL; char_u *p; @@ -101,6 +112,10 @@ do_debug(cmd) #define CMD_FINISH 4 #define CMD_QUIT 5 #define CMD_INTERRUPT 6 +#define CMD_BACKTRACE 7 +#define CMD_FRAME 8 +#define CMD_UP 9 +#define CMD_DOWN 10 #ifdef ALWAYS_USE_GUI /* Can't do this when there is no terminal for input/output. */ @@ -126,19 +141,28 @@ do_debug(cmd) redir_off = TRUE; /* don't redirect debug commands */ State = NORMAL; -#ifdef FEAT_SNIFF - want_sniff_request = 0; /* No K_SNIFF wanted */ -#endif + debug_mode = TRUE; if (!debug_did_msg) MSG(_("Entering Debug mode. Type \"cont\" to continue.")); + if (debug_oldval != NULL) + { + smsg((char_u *)_("Oldval = \"%s\""), debug_oldval); + vim_free(debug_oldval); + debug_oldval = NULL; + } + if (debug_newval != NULL) + { + smsg((char_u *)_("Newval = \"%s\""), debug_newval); + vim_free(debug_newval); + debug_newval = NULL; + } if (sourcing_name != NULL) msg(sourcing_name); if (sourcing_lnum != 0) smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); else smsg((char_u *)_("cmd: %s"), cmd); - /* * Repeat getting a command and executing it. */ @@ -146,18 +170,14 @@ do_debug(cmd) { msg_scroll = TRUE; need_wait_return = FALSE; -#ifdef FEAT_SNIFF - ProcessSniffRequests(); -#endif + /* Save the current typeahead buffer and replace it with an empty one. * This makes sure we get input from the user here and don't interfere * with the commands being executed. Reset "ex_normal_busy" to avoid * the side effects of using ":normal". Save the stuff buffer and make * it empty. Set ignore_script to avoid reading from script input. */ -# ifdef FEAT_EX_EXTRA save_ex_normal_busy = ex_normal_busy; ex_normal_busy = 0; -# endif if (!debug_greedy) { save_typeahead(&typeaheadbuf); @@ -166,6 +186,7 @@ do_debug(cmd) ignore_script = TRUE; } + vim_free(cmdline); cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL); if (typeahead_saved) @@ -173,11 +194,10 @@ do_debug(cmd) restore_typeahead(&typeaheadbuf); ignore_script = save_ignore_script; } -# ifdef FEAT_EX_EXTRA ex_normal_busy = save_ex_normal_busy; -# endif cmdline_row = msg_row; + msg_starthere(); if (cmdline != NULL) { /* If this is a debug command, set "last_cmd". @@ -197,8 +217,18 @@ do_debug(cmd) case 's': last_cmd = CMD_STEP; tail = "tep"; break; - case 'f': last_cmd = CMD_FINISH; - tail = "inish"; + case 'f': + last_cmd = 0; + if (p[1] == 'r') + { + last_cmd = CMD_FRAME; + tail = "rame"; + } + else + { + last_cmd = CMD_FINISH; + tail = "inish"; + } break; case 'q': last_cmd = CMD_QUIT; tail = "uit"; @@ -206,6 +236,21 @@ do_debug(cmd) case 'i': last_cmd = CMD_INTERRUPT; tail = "nterrupt"; break; + case 'b': last_cmd = CMD_BACKTRACE; + if (p[1] == 't') + tail = "t"; + else + tail = "acktrace"; + break; + case 'w': last_cmd = CMD_BACKTRACE; + tail = "here"; + break; + case 'u': last_cmd = CMD_UP; + tail = "p"; + break; + case 'd': last_cmd = CMD_DOWN; + tail = "own"; + break; default: last_cmd = 0; } if (last_cmd != 0) @@ -217,7 +262,7 @@ do_debug(cmd) ++p; ++tail; } - if (ASCII_ISALPHA(*p)) + if (ASCII_ISALPHA(*p) && last_cmd != CMD_FRAME) last_cmd = 0; } } @@ -250,7 +295,31 @@ do_debug(cmd) /* Do not repeat ">interrupt" cmd, continue stepping. */ last_cmd = CMD_STEP; break; + case CMD_BACKTRACE: + do_showbacktrace(cmd); + continue; + case CMD_FRAME: + if (*p == NUL) + { + do_showbacktrace(cmd); + } + else + { + p = skipwhite(p); + do_setdebugtracelevel(p); + } + continue; + case CMD_UP: + debug_backtrace_level++; + do_checkbacktracelevel(); + continue; + case CMD_DOWN: + debug_backtrace_level--; + do_checkbacktracelevel(); + continue; } + /* Going out reset backtrace_level */ + debug_backtrace_level = 0; break; } @@ -260,8 +329,6 @@ do_debug(cmd) (void)do_cmdline(cmdline, getexline, NULL, DOCMD_VERBOSE|DOCMD_EXCRESET); debug_break_level = n; - - vim_free(cmdline); } lines_left = Rows - 1; } @@ -274,6 +341,7 @@ do_debug(cmd) msg_scroll = save_msg_scroll; lines_left = Rows - 1; State = save_State; + debug_mode = FALSE; did_emsg = save_did_emsg; cmd_silent = save_cmd_silent; msg_silent = save_msg_silent; @@ -285,12 +353,96 @@ do_debug(cmd) debug_did_msg = TRUE; } + static int +get_maxbacktrace_level(void) +{ + char *p, *q; + int maxbacktrace = 0; + + if (sourcing_name != NULL) + { + p = (char *)sourcing_name; + while ((q = strstr(p, "..")) != NULL) + { + p = q + 2; + maxbacktrace++; + } + } + return maxbacktrace; +} + + static void +do_setdebugtracelevel(char_u *arg) +{ + int level; + + level = atoi((char *)arg); + if (*arg == '+' || level < 0) + debug_backtrace_level += level; + else + debug_backtrace_level = level; + + do_checkbacktracelevel(); +} + + static void +do_checkbacktracelevel(void) +{ + if (debug_backtrace_level < 0) + { + debug_backtrace_level = 0; + MSG(_("frame is zero")); + } + else + { + int max = get_maxbacktrace_level(); + + if (debug_backtrace_level > max) + { + debug_backtrace_level = max; + smsg((char_u *)_("frame at highest level: %d"), max); + } + } +} + + static void +do_showbacktrace(char_u *cmd) +{ + char *cur; + char *next; + int i = 0; + int max = get_maxbacktrace_level(); + + if (sourcing_name != NULL) + { + cur = (char *)sourcing_name; + while (!got_int) + { + next = strstr(cur, ".."); + if (next != NULL) + *next = NUL; + if (i == max - debug_backtrace_level) + smsg((char_u *)"->%d %s", max - i, cur); + else + smsg((char_u *)" %d %s", max - i, cur); + ++i; + if (next == NULL) + break; + *next = '.'; + cur = next + 2; + } + } + if (sourcing_lnum != 0) + smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); + else + smsg((char_u *)_("cmd: %s"), cmd); +} + /* * ":debug". */ void -ex_debug(eap) - exarg_T *eap; +ex_debug(exarg_T *eap) { int debug_break_level_save = debug_break_level; @@ -320,8 +472,7 @@ static char_u *debug_skipped_name; * Called from do_one_cmd() before executing a command. */ void -dbg_check_breakpoint(eap) - exarg_T *eap; +dbg_check_breakpoint(exarg_T *eap) { char_u *p; @@ -368,8 +519,7 @@ dbg_check_breakpoint(eap) * set. Return TRUE when the debug mode is entered this time. */ int -dbg_check_skipped(eap) - exarg_T *eap; +dbg_check_skipped(exarg_T *eap) { int prev_got_int; @@ -399,11 +549,15 @@ dbg_check_skipped(eap) struct debuggy { int dbg_nr; /* breakpoint number */ - int dbg_type; /* DBG_FUNC or DBG_FILE */ - char_u *dbg_name; /* function or file name */ + int dbg_type; /* DBG_FUNC, DBG_FILE or DBG_EXPR */ + char_u *dbg_name; /* function, expression or file name */ regprog_T *dbg_prog; /* regexp program */ linenr_T dbg_lnum; /* line number in function or file */ int dbg_forceit; /* ! used */ +#ifdef FEAT_EVAL + typval_T *dbg_val; /* last result of watchexpression */ +#endif + int dbg_level; /* stored nested level for expr */ }; static garray_T dbg_breakp = {0, 0, sizeof(struct debuggy), 4, NULL}; @@ -417,9 +571,10 @@ static garray_T prof_ga = {0, 0, sizeof(struct debuggy), 4, NULL}; #endif #define DBG_FUNC 1 #define DBG_FILE 2 +#define DBG_EXPR 3 -static int dbg_parsearg __ARGS((char_u *arg, garray_T *gap)); -static linenr_T debuggy_find __ARGS((int file,char_u *fname, linenr_T after, garray_T *gap, int *fp)); +static int dbg_parsearg(char_u *arg, garray_T *gap); +static linenr_T debuggy_find(int file,char_u *fname, linenr_T after, garray_T *gap, int *fp); /* * Parse the arguments of ":profile", ":breakadd" or ":breakdel" and put them @@ -428,9 +583,9 @@ static linenr_T debuggy_find __ARGS((int file,char_u *fname, linenr_T after, gar * Returns FAIL for failure. */ static int -dbg_parsearg(arg, gap) - char_u *arg; - garray_T *gap; /* either &dbg_breakp or &prof_ga */ +dbg_parsearg( + char_u *arg, + garray_T *gap) /* either &dbg_breakp or &prof_ga */ { char_u *p = arg; char_u *q; @@ -460,6 +615,12 @@ dbg_parsearg(arg, gap) bp->dbg_type = DBG_FILE; here = TRUE; } + else if ( +#ifdef FEAT_PROFILE + gap != &prof_ga && +#endif + STRNCMP(p, "expr", 4) == 0) + bp->dbg_type = DBG_EXPR; else { EMSG2(_(e_invarg2), p); @@ -495,6 +656,12 @@ dbg_parsearg(arg, gap) bp->dbg_name = vim_strsave(p); else if (here) bp->dbg_name = vim_strsave(curbuf->b_ffname); + else if (bp->dbg_type == DBG_EXPR) + { + bp->dbg_name = vim_strsave(p); + if (bp->dbg_name != NULL) + bp->dbg_val = eval_expr(bp->dbg_name, NULL); + } else { /* Expand the file name in the same way as do_source(). This means @@ -525,8 +692,7 @@ dbg_parsearg(arg, gap) * ":breakadd". */ void -ex_breakadd(eap) - exarg_T *eap; +ex_breakadd(exarg_T *eap) { struct debuggy *bp; char_u *pat; @@ -543,26 +709,35 @@ ex_breakadd(eap) bp = &DEBUGGY(gap, gap->ga_len); bp->dbg_forceit = eap->forceit; - pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE); - if (pat != NULL) - { - bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - vim_free(pat); - } - if (pat == NULL || bp->dbg_prog == NULL) - vim_free(bp->dbg_name); - else + if (bp->dbg_type != DBG_EXPR) { - if (bp->dbg_lnum == 0) /* default line number is 1 */ - bp->dbg_lnum = 1; + pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE); + if (pat != NULL) + { + bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + vim_free(pat); + } + if (pat == NULL || bp->dbg_prog == NULL) + vim_free(bp->dbg_name); + else + { + if (bp->dbg_lnum == 0) /* default line number is 1 */ + bp->dbg_lnum = 1; #ifdef FEAT_PROFILE - if (eap->cmdidx != CMD_profile) + if (eap->cmdidx != CMD_profile) #endif - { - DEBUGGY(gap, gap->ga_len).dbg_nr = ++last_breakp; - ++debug_tick; + { + DEBUGGY(gap, gap->ga_len).dbg_nr = ++last_breakp; + ++debug_tick; + } + ++gap->ga_len; } - ++gap->ga_len; + } + else + { + /* DBG_EXPR */ + DEBUGGY(gap, gap->ga_len++).dbg_nr = ++last_breakp; + ++debug_tick; } } } @@ -571,8 +746,7 @@ ex_breakadd(eap) * ":debuggreedy". */ void -ex_debuggreedy(eap) - exarg_T *eap; +ex_debuggreedy(exarg_T *eap) { if (eap->addr_count == 0 || eap->line2 != 0) debug_greedy = TRUE; @@ -584,8 +758,7 @@ ex_debuggreedy(eap) * ":breakdel" and ":profdel". */ void -ex_breakdel(eap) - exarg_T *eap; +ex_breakdel(exarg_T *eap) { struct debuggy *bp, *bpi; int nr; @@ -624,7 +797,7 @@ ex_breakdel(eap) } else { - /* ":breakdel {func|file} [lnum] {name}" */ + /* ":breakdel {func|file|expr} [lnum] {name}" */ if (dbg_parsearg(eap->arg, gap) == FAIL) return; bp = &DEBUGGY(gap, gap->ga_len); @@ -652,6 +825,11 @@ ex_breakdel(eap) while (gap->ga_len > 0) { vim_free(DEBUGGY(gap, todel).dbg_name); +#ifdef FEAT_EVAL + if (DEBUGGY(gap, todel).dbg_type == DBG_EXPR + && DEBUGGY(gap, todel).dbg_val != NULL) + free_tv(DEBUGGY(gap, todel).dbg_val); +#endif vim_regfree(DEBUGGY(gap, todel).dbg_prog); --gap->ga_len; if (todel < gap->ga_len) @@ -675,8 +853,7 @@ ex_breakdel(eap) * ":breaklist". */ void -ex_breaklist(eap) - exarg_T *eap UNUSED; +ex_breaklist(exarg_T *eap UNUSED) { struct debuggy *bp; int i; @@ -689,11 +866,15 @@ ex_breaklist(eap) bp = &BREAKP(i); if (bp->dbg_type == DBG_FILE) home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("%3d %s %s line %ld"), + if (bp->dbg_type != DBG_EXPR) + smsg((char_u *)_("%3d %s %s line %ld"), bp->dbg_nr, bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, (long)bp->dbg_lnum); + else + smsg((char_u *)_("%3d expr %s"), + bp->dbg_nr, bp->dbg_name); } } @@ -702,10 +883,10 @@ ex_breaklist(eap) * Returns line number at which to break; zero when no matching breakpoint. */ linenr_T -dbg_find_breakpoint(file, fname, after) - int file; /* TRUE for a file, FALSE for a function */ - char_u *fname; /* file or function name */ - linenr_T after; /* after this line number */ +dbg_find_breakpoint( + int file, /* TRUE for a file, FALSE for a function */ + char_u *fname, /* file or function name */ + linenr_T after) /* after this line number */ { return debuggy_find(file, fname, after, &dbg_breakp, NULL); } @@ -715,10 +896,10 @@ dbg_find_breakpoint(file, fname, after) * Return TRUE if profiling is on for a function or sourced file. */ int -has_profiling(file, fname, fp) - int file; /* TRUE for a file, FALSE for a function */ - char_u *fname; /* file or function name */ - int *fp; /* return: forceit */ +has_profiling( + int file, /* TRUE for a file, FALSE for a function */ + char_u *fname, /* file or function name */ + int *fp) /* return: forceit */ { return (debuggy_find(file, fname, (linenr_T)0, &prof_ga, fp) != (linenr_T)0); @@ -729,17 +910,16 @@ has_profiling(file, fname, fp) * Common code for dbg_find_breakpoint() and has_profiling(). */ static linenr_T -debuggy_find(file, fname, after, gap, fp) - int file; /* TRUE for a file, FALSE for a function */ - char_u *fname; /* file or function name */ - linenr_T after; /* after this line number */ - garray_T *gap; /* either &dbg_breakp or &prof_ga */ - int *fp; /* if not NULL: return forceit */ +debuggy_find( + int file, /* TRUE for a file, FALSE for a function */ + char_u *fname, /* file or function name */ + linenr_T after, /* after this line number */ + garray_T *gap, /* either &dbg_breakp or &prof_ga */ + int *fp) /* if not NULL: return forceit */ { struct debuggy *bp; int i; linenr_T lnum = 0; - regmatch_T regmatch; char_u *name = fname; int prev_got_int; @@ -765,14 +945,13 @@ debuggy_find(file, fname, after, gap, fp) /* Skip entries that are not useful or are for a line that is beyond * an already found breakpoint. */ bp = &DEBUGGY(gap, i); - if (((bp->dbg_type == DBG_FILE) == file && ( + if (((bp->dbg_type == DBG_FILE) == file && + bp->dbg_type != DBG_EXPR && ( #ifdef FEAT_PROFILE gap == &prof_ga || #endif (bp->dbg_lnum > after && (lnum == 0 || bp->dbg_lnum < lnum))))) { - regmatch.regprog = bp->dbg_prog; - regmatch.rm_ic = FALSE; /* * Save the value of got_int and reset it. We don't want a * previous interruption cancel matching, only hitting CTRL-C @@ -780,7 +959,7 @@ debuggy_find(file, fname, after, gap, fp) */ prev_got_int = got_int; got_int = FALSE; - if (vim_regexec(®match, name, (colnr_T)0)) + if (vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0)) { lnum = bp->dbg_lnum; if (fp != NULL) @@ -788,6 +967,63 @@ debuggy_find(file, fname, after, gap, fp) } got_int |= prev_got_int; } +#ifdef FEAT_EVAL + else if (bp->dbg_type == DBG_EXPR) + { + typval_T *tv; + int line = FALSE; + + prev_got_int = got_int; + got_int = FALSE; + + tv = eval_expr(bp->dbg_name, NULL); + if (tv != NULL) + { + if (bp->dbg_val == NULL) + { + debug_oldval = typval_tostring(NULL); + bp->dbg_val = tv; + debug_newval = typval_tostring(bp->dbg_val); + line = TRUE; + } + else + { + if (typval_compare(tv, bp->dbg_val, TYPE_EQUAL, + TRUE, FALSE) == OK + && tv->vval.v_number == FALSE) + { + typval_T *v; + + line = TRUE; + debug_oldval = typval_tostring(bp->dbg_val); + /* Need to evaluate again, typval_compare() overwrites + * "tv". */ + v = eval_expr(bp->dbg_name, NULL); + debug_newval = typval_tostring(v); + free_tv(bp->dbg_val); + bp->dbg_val = v; + } + free_tv(tv); + } + } + else if (bp->dbg_val != NULL) + { + debug_oldval = typval_tostring(bp->dbg_val); + debug_newval = typval_tostring(NULL); + free_tv(bp->dbg_val); + bp->dbg_val = NULL; + line = TRUE; + } + + if (line) + { + lnum = after > 0 ? after : 1; + break; + } + + got_int |= prev_got_int; + } +#endif } if (name != fname) vim_free(name); @@ -799,9 +1035,7 @@ debuggy_find(file, fname, after, gap, fp) * Called when a breakpoint was encountered. */ void -dbg_breakpoint(name, lnum) - char_u *name; - linenr_T lnum; +dbg_breakpoint(char_u *name, linenr_T lnum) { /* We need to check if this line is actually executed in do_one_cmd() */ debug_breakpoint_name = name; @@ -814,8 +1048,7 @@ dbg_breakpoint(name, lnum) * Store the current time in "tm". */ void -profile_start(tm) - proftime_T *tm; +profile_start(proftime_T *tm) { # ifdef WIN3264 QueryPerformanceCounter(tm); @@ -828,8 +1061,7 @@ profile_start(tm) * Compute the elapsed time from "tm" till now and store in "tm". */ void -profile_end(tm) - proftime_T *tm; +profile_end(proftime_T *tm) { proftime_T now; @@ -852,8 +1084,7 @@ profile_end(tm) * Subtract the time "tm2" from "tm". */ void -profile_sub(tm, tm2) - proftime_T *tm, *tm2; +profile_sub(proftime_T *tm, proftime_T *tm2) { # ifdef WIN3264 tm->QuadPart -= tm2->QuadPart; @@ -873,8 +1104,7 @@ profile_sub(tm, tm2) * Uses a static buffer! */ char * -profile_msg(tm) - proftime_T *tm; +profile_msg(proftime_T *tm) { static char buf[50]; @@ -889,13 +1119,29 @@ profile_msg(tm) return buf; } +# if defined(FEAT_FLOAT) || defined(PROTO) +/* + * Return a float that represents the time in "tm". + */ + float_T +profile_float(proftime_T *tm) +{ +# ifdef WIN3264 + LARGE_INTEGER fr; + + QueryPerformanceFrequency(&fr); + return (float_T)tm->QuadPart / (float_T)fr.QuadPart; +# else + return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0; +# endif +} +# endif + /* * Put the time "msec" past now in "tm". */ void -profile_setlimit(msec, tm) - long msec; - proftime_T *tm; +profile_setlimit(long msec, proftime_T *tm) { if (msec <= 0) /* no limit */ profile_zero(tm); @@ -922,8 +1168,7 @@ profile_setlimit(msec, tm) * Return TRUE if the current time is past "tm". */ int -profile_passed_limit(tm) - proftime_T *tm; +profile_passed_limit(proftime_T *tm) { proftime_T now; @@ -945,8 +1190,7 @@ profile_passed_limit(tm) * Set the time in "tm" to zero. */ void -profile_zero(tm) - proftime_T *tm; +profile_zero(proftime_T *tm) { # ifdef WIN3264 tm->QuadPart = 0; @@ -958,151 +1202,520 @@ profile_zero(tm) # endif /* FEAT_PROFILE || FEAT_RELTIME */ -#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) -# if defined(HAVE_MATH_H) -# include <math.h> -# endif +# if defined(FEAT_TIMERS) || defined(PROTO) +static timer_T *first_timer = NULL; +static long last_timer_id = 0; -/* - * Divide the time "tm" by "count" and store in "tm2". - */ - void -profile_divide(tm, count, tm2) - proftime_T *tm; - proftime_T *tm2; - int count; + long +proftime_time_left(proftime_T *due, proftime_T *now) { - if (count == 0) - profile_zero(tm2); - else - { -# ifdef WIN3264 - tm2->QuadPart = tm->QuadPart / count; -# else - double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count; +# ifdef WIN3264 + LARGE_INTEGER fr; - tm2->tv_sec = floor(usec / 1000000.0); - tm2->tv_usec = vim_round(usec - (tm2->tv_sec * 1000000.0)); -# endif - } + if (now->QuadPart > due->QuadPart) + return 0; + QueryPerformanceFrequency(&fr); + return (long)(((double)(due->QuadPart - now->QuadPart) + / (double)fr.QuadPart) * 1000); +# else + if (now->tv_sec > due->tv_sec) + return 0; + return (due->tv_sec - now->tv_sec) * 1000 + + (due->tv_usec - now->tv_usec) / 1000; +# endif } -#endif - -# if defined(FEAT_PROFILE) || defined(PROTO) -/* - * Functions for profiling. - */ -static void script_do_profile __ARGS((scriptitem_T *si)); -static void script_dump_profile __ARGS((FILE *fd)); -static proftime_T prof_wait_time; /* - * Add the time "tm2" to "tm". + * Insert a timer in the list of timers. */ - void -profile_add(tm, tm2) - proftime_T *tm, *tm2; + static void +insert_timer(timer_T *timer) { -# ifdef WIN3264 - tm->QuadPart += tm2->QuadPart; -# else - tm->tv_usec += tm2->tv_usec; - tm->tv_sec += tm2->tv_sec; - if (tm->tv_usec >= 1000000) - { - tm->tv_usec -= 1000000; - ++tm->tv_sec; - } -# endif + timer->tr_next = first_timer; + timer->tr_prev = NULL; + if (first_timer != NULL) + first_timer->tr_prev = timer; + first_timer = timer; + did_add_timer = TRUE; } /* - * Add the "self" time from the total time and the children's time. + * Take a timer out of the list of timers. */ - void -profile_self(self, total, children) - proftime_T *self, *total, *children; + static void +remove_timer(timer_T *timer) { - /* Check that the result won't be negative. Can happen with recursive - * calls. */ -#ifdef WIN3264 - if (total->QuadPart <= children->QuadPart) - return; -#else - if (total->tv_sec < children->tv_sec - || (total->tv_sec == children->tv_sec - && total->tv_usec <= children->tv_usec)) - return; -#endif - profile_add(self, total); - profile_sub(self, children); + if (timer->tr_prev == NULL) + first_timer = timer->tr_next; + else + timer->tr_prev->tr_next = timer->tr_next; + if (timer->tr_next != NULL) + timer->tr_next->tr_prev = timer->tr_prev; } -/* - * Get the current waittime. - */ - void -profile_get_wait(tm) - proftime_T *tm; + static void +free_timer(timer_T *timer) { - *tm = prof_wait_time; + free_callback(timer->tr_callback, timer->tr_partial); + vim_free(timer); } /* - * Subtract the passed waittime since "tm" from "tma". + * Create a timer and return it. NULL if out of memory. + * Caller should set the callback. */ - void -profile_sub_wait(tm, tma) - proftime_T *tm, *tma; + timer_T * +create_timer(long msec, int repeat) { - proftime_T tm3 = prof_wait_time; + timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T)); + long prev_id = last_timer_id; - profile_sub(&tm3, tm); - profile_sub(tma, &tm3); + if (timer == NULL) + return NULL; + if (++last_timer_id <= prev_id) + /* Overflow! Might cause duplicates... */ + last_timer_id = 0; + timer->tr_id = last_timer_id; + insert_timer(timer); + if (repeat != 0) + timer->tr_repeat = repeat - 1; + timer->tr_interval = msec; + + profile_setlimit(msec, &timer->tr_due); + return timer; } /* - * Return TRUE if "tm1" and "tm2" are equal. + * Invoke the callback of "timer". */ - int -profile_equal(tm1, tm2) - proftime_T *tm1, *tm2; + static void +timer_callback(timer_T *timer) { -# ifdef WIN3264 - return (tm1->QuadPart == tm2->QuadPart); -# else - return (tm1->tv_usec == tm2->tv_usec && tm1->tv_sec == tm2->tv_sec); -# endif + typval_T rettv; + int dummy; + typval_T argv[2]; + + argv[0].v_type = VAR_NUMBER; + argv[0].vval.v_number = (varnumber_T)timer->tr_id; + argv[1].v_type = VAR_UNKNOWN; + + call_func(timer->tr_callback, (int)STRLEN(timer->tr_callback), + &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, + timer->tr_partial, NULL); + clear_tv(&rettv); } /* - * Return <0, 0 or >0 if "tm1" < "tm2", "tm1" == "tm2" or "tm1" > "tm2" + * Call timers that are due. + * Return the time in msec until the next timer is due. + * Returns -1 if there are no pending timers. */ - int -profile_cmp(tm1, tm2) - const proftime_T *tm1, *tm2; + long +check_due_timer(void) { -# ifdef WIN3264 - return (int)(tm2->QuadPart - tm1->QuadPart); -# else - if (tm1->tv_sec == tm2->tv_sec) - return tm2->tv_usec - tm1->tv_usec; - return tm2->tv_sec - tm1->tv_sec; -# endif -} + timer_T *timer; + timer_T *timer_next; + long this_due; + long next_due = -1; + proftime_T now; + int did_one = FALSE; + int need_update_screen = FALSE; + long current_id = last_timer_id; -static char_u *profile_fname = NULL; -static proftime_T pause_time; + /* Don't run any timers while exiting or dealing with an error. */ + if (exiting || aborting()) + return next_due; + + profile_start(&now); + for (timer = first_timer; timer != NULL && !got_int; timer = timer_next) + { + timer_next = timer->tr_next; + + if (timer->tr_id == -1 || timer->tr_firing || timer->tr_paused) + continue; + this_due = proftime_time_left(&timer->tr_due, &now); + if (this_due <= 1) + { + /* Save and restore a lot of flags, because the timer fires while + * waiting for a character, which might be halfway a command. */ + int save_timer_busy = timer_busy; + int save_vgetc_busy = vgetc_busy; + int save_did_emsg = did_emsg; + int save_called_emsg = called_emsg; + int save_must_redraw = must_redraw; + int save_trylevel = trylevel; + int save_did_throw = did_throw; + int save_ex_pressedreturn = get_pressedreturn(); + except_T *save_current_exception = current_exception; + vimvars_save_T vvsave; + + /* Create a scope for running the timer callback, ignoring most of + * the current scope, such as being inside a try/catch. */ + timer_busy = timer_busy > 0 || vgetc_busy > 0; + vgetc_busy = 0; + called_emsg = FALSE; + did_emsg = FALSE; + did_uncaught_emsg = FALSE; + must_redraw = 0; + trylevel = 0; + did_throw = FALSE; + current_exception = NULL; + save_vimvars(&vvsave); + + timer->tr_firing = TRUE; + timer_callback(timer); + timer->tr_firing = FALSE; + + timer_next = timer->tr_next; + did_one = TRUE; + timer_busy = save_timer_busy; + vgetc_busy = save_vgetc_busy; + if (did_uncaught_emsg) + ++timer->tr_emsg_count; + did_emsg = save_did_emsg; + called_emsg = save_called_emsg; + trylevel = save_trylevel; + did_throw = save_did_throw; + current_exception = save_current_exception; + restore_vimvars(&vvsave); + if (must_redraw != 0) + need_update_screen = TRUE; + must_redraw = must_redraw > save_must_redraw + ? must_redraw : save_must_redraw; + set_pressedreturn(save_ex_pressedreturn); + + /* Only fire the timer again if it repeats and stop_timer() wasn't + * called while inside the callback (tr_id == -1). */ + if (timer->tr_repeat != 0 && timer->tr_id != -1 + && timer->tr_emsg_count < 3) + { + profile_setlimit(timer->tr_interval, &timer->tr_due); + this_due = proftime_time_left(&timer->tr_due, &now); + if (this_due < 1) + this_due = 1; + if (timer->tr_repeat > 0) + --timer->tr_repeat; + } + else + { + this_due = -1; + remove_timer(timer); + free_timer(timer); + } + } + if (this_due > 0 && (next_due == -1 || next_due > this_due)) + next_due = this_due; + } + + if (did_one) + redraw_after_callback(need_update_screen); + +#ifdef FEAT_BEVAL_TERM + if (bevalexpr_due_set) + { + this_due = proftime_time_left(&bevalexpr_due, &now); + if (this_due <= 1) + { + bevalexpr_due_set = FALSE; + if (balloonEval == NULL) + { + balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval)); + balloonEvalForTerm = TRUE; + } + if (balloonEval != NULL) + general_beval_cb(balloonEval, 0); + } + else if (next_due == -1 || next_due > this_due) + next_due = this_due; + } +#endif +#ifdef FEAT_TERMINAL + /* Some terminal windows may need their buffer updated. */ + next_due = term_check_timers(next_due, &now); +#endif + + return current_id != last_timer_id ? 1 : next_due; +} /* - * ":profile cmd args" + * Find a timer by ID. Returns NULL if not found; */ - void -ex_profile(eap) - exarg_T *eap; + timer_T * +find_timer(long id) { - char_u *e; - int len; + timer_T *timer; + + if (id >= 0) + { + for (timer = first_timer; timer != NULL; timer = timer->tr_next) + if (timer->tr_id == id) + return timer; + } + return NULL; +} + + +/* + * Stop a timer and delete it. + */ + void +stop_timer(timer_T *timer) +{ + if (timer->tr_firing) + /* Free the timer after the callback returns. */ + timer->tr_id = -1; + else + { + remove_timer(timer); + free_timer(timer); + } +} + + void +stop_all_timers(void) +{ + timer_T *timer; + timer_T *timer_next; + + for (timer = first_timer; timer != NULL; timer = timer_next) + { + timer_next = timer->tr_next; + stop_timer(timer); + } +} + + void +add_timer_info(typval_T *rettv, timer_T *timer) +{ + list_T *list = rettv->vval.v_list; + dict_T *dict = dict_alloc(); + dictitem_T *di; + long remaining; + proftime_T now; + + if (dict == NULL) + return; + list_append_dict(list, dict); + + dict_add_nr_str(dict, "id", timer->tr_id, NULL); + dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL); + + profile_start(&now); + remaining = proftime_time_left(&timer->tr_due, &now); + dict_add_nr_str(dict, "remaining", (long)remaining, NULL); + + dict_add_nr_str(dict, "repeat", + (long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL); + dict_add_nr_str(dict, "paused", (long)(timer->tr_paused), NULL); + + di = dictitem_alloc((char_u *)"callback"); + if (di != NULL) + { + if (dict_add(dict, di) == FAIL) + vim_free(di); + else if (timer->tr_partial != NULL) + { + di->di_tv.v_type = VAR_PARTIAL; + di->di_tv.vval.v_partial = timer->tr_partial; + ++timer->tr_partial->pt_refcount; + } + else + { + di->di_tv.v_type = VAR_FUNC; + di->di_tv.vval.v_string = vim_strsave(timer->tr_callback); + } + di->di_tv.v_lock = 0; + } +} + + void +add_timer_info_all(typval_T *rettv) +{ + timer_T *timer; + + for (timer = first_timer; timer != NULL; timer = timer->tr_next) + if (timer->tr_id != -1) + add_timer_info(rettv, timer); +} + +/* + * Mark references in partials of timers. + */ + int +set_ref_in_timer(int copyID) +{ + int abort = FALSE; + timer_T *timer; + typval_T tv; + + for (timer = first_timer; timer != NULL; timer = timer->tr_next) + { + if (timer->tr_partial != NULL) + { + tv.v_type = VAR_PARTIAL; + tv.vval.v_partial = timer->tr_partial; + } + else + { + tv.v_type = VAR_FUNC; + tv.vval.v_string = timer->tr_callback; + } + abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} + +# if defined(EXITFREE) || defined(PROTO) + void +timer_free_all() +{ + timer_T *timer; + + while (first_timer != NULL) + { + timer = first_timer; + remove_timer(timer); + free_timer(timer); + } +} +# endif +# endif + +#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) +# if defined(HAVE_MATH_H) +# include <math.h> +# endif + +/* + * Divide the time "tm" by "count" and store in "tm2". + */ + void +profile_divide(proftime_T *tm, int count, proftime_T *tm2) +{ + if (count == 0) + profile_zero(tm2); + else + { +# ifdef WIN3264 + tm2->QuadPart = tm->QuadPart / count; +# else + double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count; + + tm2->tv_sec = floor(usec / 1000000.0); + tm2->tv_usec = vim_round(usec - (tm2->tv_sec * 1000000.0)); +# endif + } +} +#endif + +# if defined(FEAT_PROFILE) || defined(PROTO) +/* + * Functions for profiling. + */ +static void script_do_profile(scriptitem_T *si); +static void script_dump_profile(FILE *fd); +static proftime_T prof_wait_time; + +/* + * Add the time "tm2" to "tm". + */ + void +profile_add(proftime_T *tm, proftime_T *tm2) +{ +# ifdef WIN3264 + tm->QuadPart += tm2->QuadPart; +# else + tm->tv_usec += tm2->tv_usec; + tm->tv_sec += tm2->tv_sec; + if (tm->tv_usec >= 1000000) + { + tm->tv_usec -= 1000000; + ++tm->tv_sec; + } +# endif +} + +/* + * Add the "self" time from the total time and the children's time. + */ + void +profile_self(proftime_T *self, proftime_T *total, proftime_T *children) +{ + /* Check that the result won't be negative. Can happen with recursive + * calls. */ +#ifdef WIN3264 + if (total->QuadPart <= children->QuadPart) + return; +#else + if (total->tv_sec < children->tv_sec + || (total->tv_sec == children->tv_sec + && total->tv_usec <= children->tv_usec)) + return; +#endif + profile_add(self, total); + profile_sub(self, children); +} + +/* + * Get the current waittime. + */ + void +profile_get_wait(proftime_T *tm) +{ + *tm = prof_wait_time; +} + +/* + * Subtract the passed waittime since "tm" from "tma". + */ + void +profile_sub_wait(proftime_T *tm, proftime_T *tma) +{ + proftime_T tm3 = prof_wait_time; + + profile_sub(&tm3, tm); + profile_sub(tma, &tm3); +} + +/* + * Return TRUE if "tm1" and "tm2" are equal. + */ + int +profile_equal(proftime_T *tm1, proftime_T *tm2) +{ +# ifdef WIN3264 + return (tm1->QuadPart == tm2->QuadPart); +# else + return (tm1->tv_usec == tm2->tv_usec && tm1->tv_sec == tm2->tv_sec); +# endif +} + +/* + * Return <0, 0 or >0 if "tm1" < "tm2", "tm1" == "tm2" or "tm1" > "tm2" + */ + int +profile_cmp(const proftime_T *tm1, const proftime_T *tm2) +{ +# ifdef WIN3264 + return (int)(tm2->QuadPart - tm1->QuadPart); +# else + if (tm1->tv_sec == tm2->tv_sec) + return tm2->tv_usec - tm1->tv_usec; + return tm2->tv_sec - tm1->tv_sec; +# endif +} + +static char_u *profile_fname = NULL; +static proftime_T pause_time; + +/* + * ":profile cmd args" + */ + void +ex_profile(exarg_T *eap) +{ + char_u *e; + int len; e = skiptowhite(eap->arg); len = (int)(e - eap->arg); @@ -1111,7 +1724,7 @@ ex_profile(eap) if (len == 5 && STRNCMP(eap->arg, "start", 5) == 0 && *e != NUL) { vim_free(profile_fname); - profile_fname = vim_strsave(e); + profile_fname = expand_env_save_opt(e, TRUE); do_profiling = PROF_YES; profile_zero(&prof_wait_time); set_vim_var_nr(VV_PROFILING, 1L); @@ -1167,9 +1780,7 @@ static char *pexpand_cmds[] = { * specific expansion. */ char_u * -get_profile_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_profile_name(expand_T *xp UNUSED, int idx) { switch (pexpand_what) { @@ -1185,9 +1796,7 @@ get_profile_name(xp, idx) * Handle command line completion for :profile command. */ void -set_context_in_profile_cmd(xp, arg) - expand_T *xp; - char_u *arg; +set_context_in_profile_cmd(expand_T *xp, char_u *arg) { char_u *end_subcmd; @@ -1215,7 +1824,7 @@ set_context_in_profile_cmd(xp, arg) * Dump the profiling info. */ void -profile_dump() +profile_dump(void) { FILE *fd; @@ -1237,8 +1846,7 @@ profile_dump() * Start profiling script "fp". */ static void -script_do_profile(si) - scriptitem_T *si; +script_do_profile(scriptitem_T *si) { si->sn_pr_count = 0; profile_zero(&si->sn_pr_total); @@ -1251,11 +1859,11 @@ script_do_profile(si) } /* - * save time when starting to invoke another script or function. + * Save time when starting to invoke another script or function. */ void -script_prof_save(tm) - proftime_T *tm; /* place to store wait time */ +script_prof_save( + proftime_T *tm) /* place to store wait time */ { scriptitem_T *si; @@ -1272,8 +1880,7 @@ script_prof_save(tm) * Count time spent in children after invoking another script or function. */ void -script_prof_restore(tm) - proftime_T *tm; +script_prof_restore(proftime_T *tm) { scriptitem_T *si; @@ -1296,7 +1903,7 @@ static proftime_T inchar_time; * Called when starting to wait for the user to type a character. */ void -prof_inchar_enter() +prof_inchar_enter(void) { profile_start(&inchar_time); } @@ -1305,7 +1912,7 @@ prof_inchar_enter() * Called when finished waiting for the user to type a character. */ void -prof_inchar_exit() +prof_inchar_exit(void) { profile_end(&inchar_time); profile_add(&prof_wait_time, &inchar_time); @@ -1315,8 +1922,7 @@ prof_inchar_exit() * Dump the profiling results for all scripts in file "fd". */ static void -script_dump_profile(fd) - FILE *fd; +script_dump_profile(FILE *fd) { int id; scriptitem_T *si; @@ -1344,12 +1950,34 @@ script_dump_profile(fd) fprintf(fd, "Cannot open file!\n"); else { - for (i = 0; i < si->sn_prl_ga.ga_len; ++i) + /* Keep going till the end of file, so that trailing + * continuation lines are listed. */ + for (i = 0; ; ++i) { if (vim_fgets(IObuff, IOSIZE, sfd)) break; - pp = &PRL_ITEM(si, i); - if (pp->snp_count > 0) + /* When a line has been truncated, append NL, taking care + * of multi-byte characters . */ + if (IObuff[IOSIZE - 2] != NUL && IObuff[IOSIZE - 2] != NL) + { + int n = IOSIZE - 2; +# ifdef FEAT_MBYTE + if (enc_utf8) + { + /* Move to the first byte of this char. + * utf_head_off() doesn't work, because it checks + * for a truncated character. */ + while (n > 0 && (IObuff[n] & 0xc0) == 0x80) + --n; + } + else if (has_mbyte) + n -= mb_head_off(IObuff, IObuff + n); +# endif + IObuff[n] = NL; + IObuff[n + 1] = NUL; + } + if (i < si->sn_prl_ga.ga_len + && (pp = &PRL_ITEM(si, i))->snp_count > 0) { fprintf(fd, "%5d ", pp->snp_count); if (profile_equal(&pp->sn_prl_total, &pp->sn_prl_self)) @@ -1374,7 +2002,7 @@ script_dump_profile(fd) * profiled. */ int -prof_def_func() +prof_def_func(void) { if (current_SID > 0) return SCRIPT_ITEM(current_SID).sn_pr_force; @@ -1391,11 +2019,10 @@ prof_def_func() * return FAIL for failure, OK otherwise */ int -autowrite(buf, forceit) - buf_T *buf; - int forceit; +autowrite(buf_T *buf, int forceit) { int r; + bufref_T bufref; if (!(p_aw || p_awa) || !p_write #ifdef FEAT_QUICKFIX @@ -1404,11 +2031,12 @@ autowrite(buf, forceit) #endif || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) return FAIL; + set_bufref(&bufref, buf); r = buf_write_all(buf, forceit); /* Writing may succeed but the buffer still changed, e.g., when there is a * conversion error. We do want to return FAIL then. */ - if (buf_valid(buf) && bufIsChanged(buf)) + if (bufref_valid(&bufref) && bufIsChanged(buf)) r = FAIL; return r; } @@ -1417,21 +2045,24 @@ autowrite(buf, forceit) * flush all buffers, except the ones that are readonly */ void -autowrite_all() +autowrite_all(void) { buf_T *buf; if (!(p_aw || p_awa) || !p_write) return; - for (buf = firstbuf; buf; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (bufIsChanged(buf) && !buf->b_p_ro) { + bufref_T bufref; + + set_bufref(&bufref, buf); + (void)buf_write_all(buf, FALSE); -#ifdef FEAT_AUTOCMD + /* an autocommand may have deleted the buffer */ - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) buf = firstbuf; -#endif } } @@ -1440,11 +2071,12 @@ autowrite_all() * For flags use the CCGD_ values. */ int -check_changed(buf, flags) - buf_T *buf; - int flags; +check_changed(buf_T *buf, int flags) { - int forceit = (flags & CCGD_FORCEIT); + int forceit = (flags & CCGD_FORCEIT); + bufref_T bufref; + + set_bufref(&bufref, buf); if ( !forceit && bufIsChanged(buf) @@ -1458,7 +2090,7 @@ check_changed(buf, flags) int count = 0; if (flags & CCGD_ALLBUF) - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) + FOR_ALL_BUFFERS(buf2) if (bufIsChanged(buf2) && (buf2->b_ffname != NULL # ifdef FEAT_BROWSE @@ -1466,24 +2098,22 @@ check_changed(buf, flags) # endif )) ++count; -# ifdef FEAT_AUTOCMD - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; -# endif + dialog_changed(buf, count > 1); -# ifdef FEAT_AUTOCMD - if (!buf_valid(buf)) + + if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; -# endif return bufIsChanged(buf); } #endif if (flags & CCGD_EXCMD) - EMSG(_(e_nowrtmsg)); + no_write_message(); else - EMSG(_(e_nowrtmsg_nobang)); + no_write_message_nobang(curbuf); return TRUE; } return FALSE; @@ -1496,8 +2126,7 @@ check_changed(buf, flags) * When wanting to write a file without a file name, ask the user for a name. */ void -browse_save_fname(buf) - buf_T *buf; +browse_save_fname(buf_T *buf) { if (buf->b_fname == NULL) { @@ -1577,9 +2206,9 @@ vim_dialog_save_all_changes(buf) * Must check 'write' option first! */ void -dialog_changed(buf, checkall) - buf_T *buf; - int checkall; /* may abandon all changed buffers */ +dialog_changed( + buf_T *buf, + int checkall) /* may abandon all changed buffers */ { char_u buff[DIALOG_MSG_SIZE]; int ret; @@ -1599,9 +2228,7 @@ dialog_changed(buf, checkall) else { #endif - dialog_msg(buff, _("Save changes to \"%s\"?"), - (buf->b_fname != NULL) ? - buf->b_fname : (char_u *)_("Untitled")); + dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); if (checkall) ret = vim_dialog_yesnoallcancel(VIM_QUESTION, NULL, buff, 1); else @@ -1636,7 +2263,7 @@ dialog_changed(buf, checkall) * Skip readonly buffers, these need to be confirmed * individually. */ - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) + FOR_ALL_BUFFERS(buf2) { if (bufIsChanged(buf2) && (buf2->b_ffname != NULL @@ -1646,6 +2273,9 @@ dialog_changed(buf, checkall) ) && !buf2->b_p_ro) { + bufref_T bufref; + + set_bufref(&bufref, buf2); #ifdef FEAT_BROWSE /* May get file name, when there is none */ browse_save_fname(buf2); @@ -1654,11 +2284,10 @@ dialog_changed(buf, checkall) buf2->b_fname, buf2->b_ffname, FALSE) == OK) /* didn't hit Cancel */ (void)buf_write_all(buf2, FALSE); -#ifdef FEAT_AUTOCMD + /* an autocommand may have deleted the buffer */ - if (!buf_valid(buf2)) + if (!bufref_valid(&bufref)) buf2 = firstbuf; -#endif } } } @@ -1667,7 +2296,7 @@ dialog_changed(buf, checkall) /* * mark all buffers as unchanged */ - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) + FOR_ALL_BUFFERS(buf2) unchanged(buf2, TRUE); } } @@ -1678,27 +2307,22 @@ dialog_changed(buf, checkall) * hidden, autowriting it or unloading it. */ int -can_abandon(buf, forceit) - buf_T *buf; - int forceit; +can_abandon(buf_T *buf, int forceit) { - return ( P_HID(buf) + return ( buf_hide(buf) || !bufIsChanged(buf) || buf->b_nwindows > 1 || autowrite(buf, forceit) == OK || forceit); } -static void add_bufnum __ARGS((int *bufnrs, int *bufnump, int nr)); +static void add_bufnum(int *bufnrs, int *bufnump, int nr); /* * Add a buffer number to "bufnrs", unless it's already there. */ static void -add_bufnum(bufnrs, bufnump, nr) - int *bufnrs; - int *bufnump; - int nr; +add_bufnum(int *bufnrs, int *bufnump, int nr) { int i; @@ -1712,10 +2336,13 @@ add_bufnum(bufnrs, bufnump, nr) /* * Return TRUE if any buffer was changed and cannot be abandoned. * That changed buffer becomes the current buffer. + * When "unload" is TRUE the current buffer is unloaded instead of making it + * hidden. This is used for ":q!". */ int -check_changed_any(hidden) - int hidden; /* Only check hidden buffers */ +check_changed_any( + int hidden, /* Only check hidden buffers */ + int unload) { int ret = FALSE; buf_T *buf; @@ -1724,12 +2351,11 @@ check_changed_any(hidden) int bufnum = 0; int bufcount = 0; int *bufnrs; -#ifdef FEAT_WINDOWS tabpage_T *tp; win_T *wp; -#endif - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + /* Make a list of all buffers, with the most important ones first. */ + FOR_ALL_BUFFERS(buf) ++bufcount; if (bufcount == 0) @@ -1741,20 +2367,20 @@ check_changed_any(hidden) /* curbuf */ bufnrs[bufnum++] = curbuf->b_fnum; -#ifdef FEAT_WINDOWS - /* buf in curtab */ + + /* buffers in current tab */ FOR_ALL_WINDOWS(wp) if (wp->w_buffer != curbuf) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); - /* buf in other tab */ - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + /* buffers in other tabs */ + FOR_ALL_TABPAGES(tp) if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); -#endif - /* any other buf */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + + /* any other buffer */ + FOR_ALL_BUFFERS(buf) add_bufnum(bufnrs, &bufnum, buf->b_fnum); for (i = 0; i < bufnum; ++i) @@ -1764,11 +2390,22 @@ check_changed_any(hidden) continue; if ((!hidden || buf->b_nwindows == 0) && bufIsChanged(buf)) { + bufref_T bufref; + + set_bufref(&bufref, buf); +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + { + if (term_try_stop_job(buf) == FAIL) + break; + } + else +#endif /* Try auto-writing the buffer. If this fails but the buffer no * longer exists it's not changed, that's OK. */ if (check_changed(buf, (p_awa ? CCGD_AW : 0) | CCGD_MULTWIN - | CCGD_ALLBUF) && buf_valid(buf)) + | CCGD_ALLBUF) && bufref_valid(&bufref)) break; /* didn't save - still changes */ } } @@ -1776,6 +2413,7 @@ check_changed_any(hidden) if (i >= bufnum) goto theend; + /* Get here if "buf" cannot be abandoned. */ ret = TRUE; exiting = FALSE; #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) @@ -1795,7 +2433,14 @@ check_changed_any(hidden) msg_col = 0; msg_didout = FALSE; } - if (EMSG2(_("E162: No write since last change for buffer \"%s\""), + if ( +#ifdef FEAT_TERMINAL + term_job_running(buf->b_term) + ? EMSG2(_("E947: Job still running in buffer \"%s\""), + buf->b_fname) + : +#endif + EMSG2(_("E162: No write since last change for buffer \"%s\""), buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) { save = no_wait_return; @@ -1805,28 +2450,27 @@ check_changed_any(hidden) } } -#ifdef FEAT_WINDOWS /* Try to find a window that contains the buffer. */ if (buf != curbuf) FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer == buf) { + bufref_T bufref; + + set_bufref(&bufref, buf); + goto_tabpage_win(tp, wp); -# ifdef FEAT_AUTOCMD + /* Paranoia: did autocms wipe out the buffer with changes? */ - if (!buf_valid(buf)) - { + if (!bufref_valid(&bufref)) goto theend; - } -# endif goto buf_found; } buf_found: -#endif /* Open the changed buffer in the current window. */ if (buf != curbuf) - set_curbuf(buf, DOBUF_GOTO); + set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO); theend: vim_free(bufnrs); @@ -1838,7 +2482,7 @@ check_changed_any(hidden) * give error message for FAIL */ int -check_fname() +check_fname(void) { if (curbuf->b_ffname == NULL) { @@ -1854,25 +2498,19 @@ check_fname() * return FAIL for failure, OK otherwise */ int -buf_write_all(buf, forceit) - buf_T *buf; - int forceit; +buf_write_all(buf_T *buf, int forceit) { int retval; -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif retval = (buf_write(buf, buf->b_ffname, buf->b_fname, (linenr_T)1, buf->b_ml.ml_line_count, NULL, FALSE, forceit, TRUE, FALSE)); -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { - msg_source(hl_attr(HLF_W)); + msg_source(HL_ATTR(HLF_W)); MSG(_("Warning: Entered other buffer unexpectedly (check autocommands)")); } -#endif return retval; } @@ -1880,13 +2518,11 @@ buf_write_all(buf, forceit) * Code to handle the argument list. */ -static char_u *do_one_arg __ARGS((char_u *str)); -static int do_arglist __ARGS((char_u *str, int what, int after)); -static void alist_check_arg_idx __ARGS((void)); -static int editing_arg_idx __ARGS((win_T *win)); -#ifdef FEAT_LISTCMDS -static int alist_add_list __ARGS((int count, char_u **files, int after)); -#endif +static char_u *do_one_arg(char_u *str); +static int do_arglist(char_u *str, int what, int after); +static void alist_check_arg_idx(void); +static int editing_arg_idx(win_T *win); +static int alist_add_list(int count, char_u **files, int after); #define AL_SET 1 #define AL_ADD 2 #define AL_DEL 3 @@ -1897,8 +2533,7 @@ static int alist_add_list __ARGS((int count, char_u **files, int after)); * Return a pointer to the start of the next argument. */ static char_u * -do_one_arg(str) - char_u *str; +do_one_arg(char_u *str) { char_u *p; int inbacktick; @@ -1933,10 +2568,8 @@ do_one_arg(str) * Separate the arguments in "str" and return a list of pointers in the * growarray "gap". */ - int -get_arglist(gap, str) - garray_T *gap; - char_u *str; + static int +get_arglist(garray_T *gap, char_u *str, int escaped) { ga_init2(gap, (int)sizeof(char_u *), 20); while (*str != NUL) @@ -1948,6 +2581,10 @@ get_arglist(gap, str) } ((char_u **)gap->ga_data)[gap->ga_len++] = str; + /* If str is escaped, don't handle backslashes or spaces */ + if (!escaped) + return OK; + /* Isolate one argument, change it in-place, put a NUL after it. */ str = do_one_arg(str); } @@ -1961,16 +2598,16 @@ get_arglist(gap, str) * Return FAIL or OK. */ int -get_arglist_exp(str, fcountp, fnamesp, wig) - char_u *str; - int *fcountp; - char_u ***fnamesp; - int wig; +get_arglist_exp( + char_u *str, + int *fcountp, + char_u ***fnamesp, + int wig) { garray_T ga; int i; - if (get_arglist(&ga, str) == FAIL) + if (get_arglist(&ga, str, TRUE) == FAIL) return FAIL; if (wig == TRUE) i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data, @@ -1984,17 +2621,14 @@ get_arglist_exp(str, fcountp, fnamesp, wig) } #endif -#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) /* * Redefine the argument list. */ void -set_arglist(str) - char_u *str; +set_arglist(char_u *str) { do_arglist(str, AL_SET, 0); } -#endif /* * "what" == AL_SET: Redefine the argument list to 'str'. @@ -2004,27 +2638,36 @@ set_arglist(str) * Return FAIL for failure, OK otherwise. */ static int -do_arglist(str, what, after) - char_u *str; - int what UNUSED; - int after UNUSED; /* 0 means before first one */ +do_arglist( + char_u *str, + int what, + int after UNUSED) /* 0 means before first one */ { garray_T new_ga; int exp_count; char_u **exp_files; int i; -#ifdef FEAT_LISTCMDS char_u *p; int match; -#endif + int arg_escaped = TRUE; + + /* + * Set default argument for ":argadd" command. + */ + if (what == AL_ADD && *str == NUL) + { + if (curbuf->b_ffname == NULL) + return FAIL; + str = curbuf->b_fname; + arg_escaped = FALSE; + } /* * Collect all file name arguments in "new_ga". */ - if (get_arglist(&new_ga, str) == FAIL) + if (get_arglist(&new_ga, str, arg_escaped) == FAIL) return FAIL; -#ifdef FEAT_LISTCMDS if (what == AL_DEL) { regmatch_T regmatch; @@ -2071,27 +2714,22 @@ do_arglist(str, what, after) ga_clear(&new_ga); } else -#endif { i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); ga_clear(&new_ga); - if (i == FAIL) - return FAIL; - if (exp_count == 0) + if (i == FAIL || exp_count == 0) { EMSG(_(e_nomatch)); return FAIL; } -#ifdef FEAT_LISTCMDS if (what == AL_ADD) { (void)alist_add_list(exp_count, exp_files, after); vim_free(exp_files); } else /* what == AL_SET */ -#endif alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0); } @@ -2104,18 +2742,14 @@ do_arglist(str, what, after) * Check the validity of the arg_idx for each other window. */ static void -alist_check_arg_idx() +alist_check_arg_idx(void) { -#ifdef FEAT_WINDOWS win_T *win; tabpage_T *tp; FOR_ALL_TAB_WINDOWS(tp, win) if (win->w_alist == curwin->w_alist) check_arg_idx(win); -#else - check_arg_idx(curwin); -#endif } /* @@ -2123,8 +2757,7 @@ alist_check_arg_idx() * index. */ static int -editing_arg_idx(win) - win_T *win; +editing_arg_idx(win_T *win) { return !(win->w_arg_idx >= WARGCOUNT(win) || (win->w_buffer->b_fnum @@ -2139,8 +2772,7 @@ editing_arg_idx(win) * Check if window "win" is editing the w_arg_idx file in its argument list. */ void -check_arg_idx(win) - win_T *win; +check_arg_idx(win_T *win) { if (WARGCOUNT(win) > 1 && !editing_arg_idx(win)) { @@ -2149,9 +2781,7 @@ check_arg_idx(win) win->w_arg_idx_invalid = TRUE; if (win->w_arg_idx != WARGCOUNT(win) - 1 && arg_had_last == FALSE -#ifdef FEAT_WINDOWS && ALIST(win) == &global_alist -#endif && GARGCOUNT > 0 && win->w_arg_idx < GARGCOUNT && (win->w_buffer->b_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum @@ -2166,10 +2796,7 @@ check_arg_idx(win) * Set "arg_had_last" if it's also the last one */ win->w_arg_idx_invalid = FALSE; if (win->w_arg_idx == WARGCOUNT(win) - 1 -#ifdef FEAT_WINDOWS - && win->w_alist == &global_alist -#endif - ) + && win->w_alist == &global_alist) arg_had_last = TRUE; } } @@ -2178,23 +2805,17 @@ check_arg_idx(win) * ":args", ":argslocal" and ":argsglobal". */ void -ex_args(eap) - exarg_T *eap; +ex_args(exarg_T *eap) { int i; if (eap->cmdidx != CMD_args) { -#if defined(FEAT_WINDOWS) && defined(FEAT_LISTCMDS) alist_unlink(ALIST(curwin)); if (eap->cmdidx == CMD_argglobal) ALIST(curwin) = &global_alist; else /* eap->cmdidx == CMD_arglocal */ alist_new(); -#else - ex_ni(eap); - return; -#endif } if (!ends_excmd(*eap->arg)) @@ -2205,31 +2826,28 @@ ex_args(eap) */ ex_next(eap); } - else -#if defined(FEAT_WINDOWS) && defined(FEAT_LISTCMDS) - if (eap->cmdidx == CMD_args) -#endif + else if (eap->cmdidx == CMD_args) { /* * ":args": list arguments. */ if (ARGCOUNT > 0) { - /* Overwrite the command, for a short list there is no scrolling - * required and no wait_return(). */ - gotocmdline(TRUE); - for (i = 0; i < ARGCOUNT; ++i) + char_u **items = (char_u **)alloc(sizeof(char_u *) * ARGCOUNT); + + if (items != NULL) { - if (i == curwin->w_arg_idx) - msg_putchar('['); - msg_outtrans(alist_name(&ARGLIST[i])); - if (i == curwin->w_arg_idx) - msg_putchar(']'); - msg_putchar(' '); + /* Overwrite the command, for a short list there is no + * scrolling required and no wait_return(). */ + gotocmdline(TRUE); + + for (i = 0; i < ARGCOUNT; ++i) + items[i] = alist_name(&ARGLIST[i]); + list_in_columns(items, ARGCOUNT, curwin->w_arg_idx); + vim_free(items); } } } -#if defined(FEAT_WINDOWS) && defined(FEAT_LISTCMDS) else if (eap->cmdidx == CMD_arglocal) { garray_T *gap = &curwin->w_alist->al_ga; @@ -2248,15 +2866,13 @@ ex_args(eap) ++gap->ga_len; } } -#endif } /* * ":previous", ":sprevious", ":Next" and ":sNext". */ void -ex_previous(eap) - exarg_T *eap; +ex_previous(exarg_T *eap) { /* If past the last one already, go to the last one. */ if (curwin->w_arg_idx - (int)eap->line2 >= ARGCOUNT) @@ -2269,8 +2885,7 @@ ex_previous(eap) * ":rewind", ":first", ":sfirst" and ":srewind". */ void -ex_rewind(eap) - exarg_T *eap; +ex_rewind(exarg_T *eap) { do_argfile(eap, 0); } @@ -2279,8 +2894,7 @@ ex_rewind(eap) * ":last" and ":slast". */ void -ex_last(eap) - exarg_T *eap; +ex_last(exarg_T *eap) { do_argfile(eap, ARGCOUNT - 1); } @@ -2289,8 +2903,7 @@ ex_last(eap) * ":argument" and ":sargument". */ void -ex_argument(eap) - exarg_T *eap; +ex_argument(exarg_T *eap) { int i; @@ -2305,9 +2918,7 @@ ex_argument(eap) * Edit file "argn" of the argument lists. */ void -do_argfile(eap, argn) - exarg_T *eap; - int argn; +do_argfile(exarg_T *eap, int argn) { int other; char_u *p; @@ -2329,7 +2940,6 @@ do_argfile(eap, argn) need_mouse_correct = TRUE; #endif -#ifdef FEAT_WINDOWS /* split window or create new tab page first */ if (*eap->cmd == 's' || cmdmod.tab != 0) { @@ -2338,20 +2948,19 @@ do_argfile(eap, argn) RESET_BINDING(curwin); } else -#endif { /* * if 'hidden' set, only check for changed file when re-editing * the same buffer */ other = TRUE; - if (P_HID(curbuf)) + if (buf_hide(curbuf)) { p = fix_fname(alist_name(&ARGLIST[argn])); other = otherfile(p); vim_free(p); } - if ((!P_HID(curbuf) || !other) + if ((!buf_hide(curbuf) || !other) && check_changed(curbuf, CCGD_AW | (other ? 0 : CCGD_MULTWIN) | (eap->forceit ? CCGD_FORCEIT : 0) @@ -2360,11 +2969,7 @@ do_argfile(eap, argn) } curwin->w_arg_idx = argn; - if (argn == ARGCOUNT - 1 -#ifdef FEAT_WINDOWS - && curwin->w_alist == &global_alist -#endif - ) + if (argn == ARGCOUNT - 1 && curwin->w_alist == &global_alist) arg_had_last = TRUE; /* Edit the file; always use the last known line number. @@ -2372,7 +2977,7 @@ do_argfile(eap, argn) * argument index. */ if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL, eap, ECMD_LAST, - (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) + (buf_hide(curwin->w_buffer) ? ECMD_HIDE : 0) + (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL) curwin->w_arg_idx = old_arg_idx; /* like Vi: set the mark where the cursor is in the file. */ @@ -2385,8 +2990,7 @@ do_argfile(eap, argn) * ":next", and commands that behave like it. */ void -ex_next(eap) - exarg_T *eap; +ex_next(exarg_T *eap) { int i; @@ -2394,7 +2998,7 @@ ex_next(eap) * check for changed buffer now, if this fails the argument list is not * redefined. */ - if ( P_HID(curbuf) + if ( buf_hide(curbuf) || eap->cmdidx == CMD_snext || !check_changed(curbuf, CCGD_AW | (eap->forceit ? CCGD_FORCEIT : 0) @@ -2412,50 +3016,36 @@ ex_next(eap) } } -#ifdef FEAT_LISTCMDS /* * ":argedit" */ void -ex_argedit(eap) - exarg_T *eap; +ex_argedit(exarg_T *eap) { - int fnum; - int i; - char_u *s; - - /* Add the argument to the buffer list and get the buffer number. */ - fnum = buflist_add(eap->arg, BLN_LISTED); - - /* Check if this argument is already in the argument list. */ - for (i = 0; i < ARGCOUNT; ++i) - if (ARGLIST[i].ae_fnum == fnum) - break; - if (i == ARGCOUNT) - { - /* Can't find it, add it to the argument list. */ - s = vim_strsave(eap->arg); - if (s == NULL) - return; - i = alist_add_list(1, &s, - eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1); - if (i < 0) - return; - curwin->w_arg_idx = i; - } + int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1; + // Whether curbuf will be reused, curbuf->b_ffname will be set. + int curbuf_is_reusable = curbuf_reusable(); - alist_check_arg_idx(); + if (do_arglist(eap->arg, AL_ADD, i) == FAIL) + return; +#ifdef FEAT_TITLE + maketitle(); +#endif + if (curwin->w_arg_idx == 0 + && (curbuf->b_ml.ml_flags & ML_EMPTY) + && (curbuf->b_ffname == NULL || curbuf_is_reusable)) + i = 0; /* Edit the argument. */ - do_argfile(eap, i); + if (i < ARGCOUNT) + do_argfile(eap, i); } /* * ":argadd" */ void -ex_argadd(eap) - exarg_T *eap; +ex_argadd(exarg_T *eap) { do_arglist(eap->arg, AL_ADD, eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1); @@ -2468,8 +3058,7 @@ ex_argadd(eap) * ":argdelete" */ void -ex_argdelete(eap) - exarg_T *eap; +ex_argdelete(exarg_T *eap) { int i; int n; @@ -2480,8 +3069,15 @@ ex_argdelete(eap) if (eap->line2 > ARGCOUNT) eap->line2 = ARGCOUNT; n = eap->line2 - eap->line1 + 1; - if (*eap->arg != NUL || n <= 0) + if (*eap->arg != NUL) + /* Can't have both a range and an argument. */ EMSG(_(e_invarg)); + else if (n <= 0) + { + /* Don't give an error for ":%argdel" if the list is empty. */ + if (eap->line1 != 1 || eap->line2 != 0) + EMSG(_(e_invrange)); + } else { for (i = eap->line1; i <= eap->line2; ++i) @@ -2493,6 +3089,10 @@ ex_argdelete(eap) curwin->w_arg_idx -= n; else if (curwin->w_arg_idx > eap->line1) curwin->w_arg_idx = eap->line1; + if (ARGCOUNT == 0) + curwin->w_arg_idx = 0; + else if (curwin->w_arg_idx >= ARGCOUNT) + curwin->w_arg_idx = ARGCOUNT - 1; } } else if (*eap->arg == NUL) @@ -2505,60 +3105,109 @@ ex_argdelete(eap) } /* - * ":argdo", ":windo", ":bufdo", ":tabdo" + * ":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo" */ void -ex_listdo(eap) - exarg_T *eap; +ex_listdo(exarg_T *eap) { int i; -#ifdef FEAT_WINDOWS win_T *wp; tabpage_T *tp; -#endif - buf_T *buf; + buf_T *buf = curbuf; int next_fnum = 0; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif char_u *p_shm_save; +#ifdef FEAT_QUICKFIX + int qf_size = 0; + int qf_idx; +#endif -#ifndef FEAT_WINDOWS - if (eap->cmdidx == CMD_windo) +#ifndef FEAT_QUICKFIX + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo || + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { ex_ni(eap); return; } #endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) /* Don't do syntax HL autocommands. Skipping the syntax file is a * great speed improvement. */ save_ei = au_event_disable(",Syntax"); #endif +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo - || P_HID(curbuf) + || buf_hide(curbuf) || !check_changed(curbuf, CCGD_AW | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) { - /* start at the first argument/window/buffer */ i = 0; -#ifdef FEAT_WINDOWS + /* start at the eap->line1 argument/window/buffer */ wp = firstwin; tp = first_tabpage; -#endif + switch (eap->cmdidx) + { + case CMD_windo: + for ( ; wp != NULL && i + 1 < eap->line1; wp = wp->w_next) + i++; + break; + case CMD_tabdo: + for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) + i++; + break; + case CMD_argdo: + i = eap->line1 - 1; + break; + default: + break; + } /* set pcmark now */ if (eap->cmdidx == CMD_bufdo) - goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); + { + /* Advance to the first listed buffer after "eap->line1". */ + for (buf = firstbuf; buf != NULL && (buf->b_fnum < eap->line1 + || !buf->b_p_bl); buf = buf->b_next) + if (buf->b_fnum > eap->line2) + { + buf = NULL; + break; + } + if (buf != NULL) + goto_buffer(eap, DOBUF_FIRST, FORWARD, buf->b_fnum); + } +#ifdef FEAT_QUICKFIX + else if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) + { + qf_size = qf_get_size(eap); + if (qf_size <= 0 || eap->line1 > qf_size) + buf = NULL; + else + { + ex_cc(eap); + + buf = curbuf; + i = eap->line1 - 1; + if (eap->addr_count <= 0) + /* default is all the quickfix/location list entries */ + eap->line2 = qf_size; + } + } +#endif else setpcmark(); listcmd_busy = TRUE; /* avoids setting pcmark below */ - while (!got_int) + while (!got_int && buf != NULL) { if (eap->cmdidx == CMD_argdo) { @@ -2579,9 +3228,7 @@ ex_listdo(eap) } if (curwin->w_arg_idx != i) break; - ++i; } -#ifdef FEAT_WINDOWS else if (eap->cmdidx == CMD_windo) { /* go to window "wp" */ @@ -2600,7 +3247,6 @@ ex_listdo(eap) goto_tabpage_tp(tp, TRUE, TRUE); tp = tp->tp_next; } -#endif else if (eap->cmdidx == CMD_bufdo) { /* Remember the number of the next listed buffer, in case @@ -2614,6 +3260,8 @@ ex_listdo(eap) } } + ++i; + /* execute the command */ do_cmdline(eap->arg, eap->getline, eap->cookie, DOCMD_VERBOSE + DOCMD_NOWAIT); @@ -2621,10 +3269,10 @@ ex_listdo(eap) if (eap->cmdidx == CMD_bufdo) { /* Done? */ - if (next_fnum < 0) + if (next_fnum < 0 || next_fnum > eap->line2) break; /* Check if the buffer still exists. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_fnum == next_fnum) break; if (buf == NULL) @@ -2638,25 +3286,47 @@ ex_listdo(eap) set_option_value((char_u *)"shm", 0L, p_shm_save, 0); vim_free(p_shm_save); - /* If autocommands took us elsewhere, quit here */ + /* If autocommands took us elsewhere, quit here. */ if (curbuf->b_fnum != next_fnum) break; } +#ifdef FEAT_QUICKFIX + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) + { + if (i >= qf_size || i >= eap->line2) + break; + + qf_idx = qf_get_cur_idx(eap); + + ex_cnext(eap); + + /* If jumping to the next quickfix entry fails, quit here */ + if (qf_get_cur_idx(eap) == qf_idx) + break; + } +#endif + if (eap->cmdidx == CMD_windo) { validate_cursor(); /* cursor may have moved */ -#ifdef FEAT_SCROLLBIND + /* required when 'scrollbind' has been set */ if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif } + + if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo) + if (i+1 > eap->line2) + break; + if (eap->cmdidx == CMD_argdo && i >= eap->line2) + break; } listcmd_busy = FALSE; } -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) if (save_ei != NULL) { au_event_restore(save_ei); @@ -2664,6 +3334,9 @@ ex_listdo(eap) curbuf->b_fname, TRUE, curbuf); } #endif +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif } /* @@ -2673,12 +3346,13 @@ ex_listdo(eap) * Returns index of first added argument. Returns -1 when failed (out of mem). */ static int -alist_add_list(count, files, after) - int count; - char_u **files; - int after; /* where to add: 0 = before first one */ +alist_add_list( + int count, + char_u **files, + int after) /* where to add: 0 = before first one */ { int i; + int old_argcount = ARGCOUNT; if (ga_grow(&ALIST(curwin)->al_ga, count) == OK) { @@ -2692,11 +3366,12 @@ alist_add_list(count, files, after) for (i = 0; i < count; ++i) { ARGLIST[after + i].ae_fname = files[i]; - ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED); + ARGLIST[after + i].ae_fnum = + buflist_add(files[i], BLN_LISTED | BLN_CURBUF); } ALIST(curwin)->al_ga.ga_len += count; - if (curwin->w_arg_idx >= after) - ++curwin->w_arg_idx; + if (old_argcount > 0 && curwin->w_arg_idx >= after) + curwin->w_arg_idx += count; return after; } @@ -2705,15 +3380,28 @@ alist_add_list(count, files, after) return -1; } -#endif /* FEAT_LISTCMDS */ +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) +/* + * Function given to ExpandGeneric() to obtain the possible arguments of the + * argedit and argdelete commands. + */ + char_u * +get_arglist_name(expand_T *xp UNUSED, int idx) +{ + if (idx >= ARGCOUNT) + return NULL; + + return alist_name(&ARGLIST[idx]); +} +#endif + #ifdef FEAT_EVAL /* * ":compiler[!] {name}" */ void -ex_compiler(eap) - exarg_T *eap; +ex_compiler(exarg_T *eap) { char_u *buf; char_u *old_cur_comp = NULL; @@ -2754,200 +3442,779 @@ ex_compiler(eap) do_unlet((char_u *)"b:current_compiler", TRUE); sprintf((char *)buf, "compiler/%s.vim", eap->arg); - if (source_runtime(buf, TRUE) == FAIL) + if (source_runtime(buf, DIP_ALL) == FAIL) EMSG2(_("E666: compiler not supported: %s"), eap->arg); vim_free(buf); do_cmdline_cmd((char_u *)":delcommand CompilerSet"); - /* Set "b:current_compiler" from "current_compiler". */ - p = get_var_value((char_u *)"g:current_compiler"); - if (p != NULL) - set_internal_string_var((char_u *)"b:current_compiler", p); + /* Set "b:current_compiler" from "current_compiler". */ + p = get_var_value((char_u *)"g:current_compiler"); + if (p != NULL) + set_internal_string_var((char_u *)"b:current_compiler", p); + + /* Restore "current_compiler" for ":compiler {name}". */ + if (!eap->forceit) + { + if (old_cur_comp != NULL) + { + set_internal_string_var((char_u *)"g:current_compiler", + old_cur_comp); + vim_free(old_cur_comp); + } + else + do_unlet((char_u *)"g:current_compiler", TRUE); + } + } + } +} +#endif + +/* + * ":runtime [what] {name}" + */ + void +ex_runtime(exarg_T *eap) +{ + char_u *arg = eap->arg; + char_u *p = skiptowhite(arg); + int len = (int)(p - arg); + int flags = eap->forceit ? DIP_ALL : 0; + + if (STRNCMP(arg, "START", len) == 0) + { + flags += DIP_START + DIP_NORTP; + arg = skipwhite(arg + len); + } + else if (STRNCMP(arg, "OPT", len) == 0) + { + flags += DIP_OPT + DIP_NORTP; + arg = skipwhite(arg + len); + } + else if (STRNCMP(arg, "PACK", len) == 0) + { + flags += DIP_START + DIP_OPT + DIP_NORTP; + arg = skipwhite(arg + len); + } + else if (STRNCMP(arg, "ALL", len) == 0) + { + flags += DIP_START + DIP_OPT; + arg = skipwhite(arg + len); + } + + source_runtime(arg, flags); +} + + static void +source_callback(char_u *fname, void *cookie UNUSED) +{ + (void)do_source(fname, FALSE, DOSO_NONE); +} + +/* + * Find the file "name" in all directories in "path" and invoke + * "callback(fname, cookie)". + * "name" can contain wildcards. + * When "flags" has DIP_ALL: source all files, otherwise only the first one. + * When "flags" has DIP_DIR: find directories instead of files. + * When "flags" has DIP_ERR: give an error message if there is no match. + * + * return FAIL when no file could be sourced, OK otherwise. + */ + int +do_in_path( + char_u *path, + char_u *name, + int flags, + void (*callback)(char_u *fname, void *ck), + void *cookie) +{ + char_u *rtp; + char_u *np; + char_u *buf; + char_u *rtp_copy; + char_u *tail; + int num_files; + char_u **files; + int i; + int did_one = FALSE; +#ifdef AMIGA + struct Process *proc = (struct Process *)FindTask(0L); + APTR save_winptr = proc->pr_WindowPtr; + + /* Avoid a requester here for a volume that doesn't exist. */ + proc->pr_WindowPtr = (APTR)-1L; +#endif + + /* Make a copy of 'runtimepath'. Invoking the callback may change the + * value. */ + rtp_copy = vim_strsave(path); + buf = alloc(MAXPATHL); + if (buf != NULL && rtp_copy != NULL) + { + if (p_verbose > 1 && name != NULL) + { + verbose_enter(); + smsg((char_u *)_("Searching for \"%s\" in \"%s\""), + (char *)name, (char *)path); + verbose_leave(); + } + + /* Loop over all entries in 'runtimepath'. */ + rtp = rtp_copy; + while (*rtp != NUL && ((flags & DIP_ALL) || !did_one)) + { + size_t buflen; + + /* Copy the path from 'runtimepath' to buf[]. */ + copy_option_part(&rtp, buf, MAXPATHL, ","); + buflen = STRLEN(buf); + + /* Skip after or non-after directories. */ + if (flags & (DIP_NOAFTER | DIP_AFTER)) + { + int is_after = buflen >= 5 + && STRCMP(buf + buflen - 5, "after") == 0; + + if ((is_after && (flags & DIP_NOAFTER)) + || (!is_after && (flags & DIP_AFTER))) + continue; + } + + if (name == NULL) + { + (*callback)(buf, (void *) &cookie); + if (!did_one) + did_one = (cookie == NULL); + } + else if (buflen + STRLEN(name) + 2 < MAXPATHL) + { + add_pathsep(buf); + tail = buf + STRLEN(buf); + + /* Loop over all patterns in "name" */ + np = name; + while (*np != NUL && ((flags & DIP_ALL) || !did_one)) + { + /* Append the pattern from "name" to buf[]. */ + copy_option_part(&np, tail, (int)(MAXPATHL - (tail - buf)), + "\t "); + + if (p_verbose > 2) + { + verbose_enter(); + smsg((char_u *)_("Searching for \"%s\""), buf); + verbose_leave(); + } + + /* Expand wildcards, invoke the callback for each match. */ + if (gen_expand_wildcards(1, &buf, &num_files, &files, + (flags & DIP_DIR) ? EW_DIR : EW_FILE) == OK) + { + for (i = 0; i < num_files; ++i) + { + (*callback)(files[i], cookie); + did_one = TRUE; + if (!(flags & DIP_ALL)) + break; + } + FreeWild(num_files, files); + } + } + } + } + } + vim_free(buf); + vim_free(rtp_copy); + if (!did_one && name != NULL) + { + char *basepath = path == p_rtp ? "runtimepath" : "packpath"; + + if (flags & DIP_ERR) + EMSG3(_(e_dirnotf), basepath, name); + else if (p_verbose > 0) + { + verbose_enter(); + smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name); + verbose_leave(); + } + } + +#ifdef AMIGA + proc->pr_WindowPtr = save_winptr; +#endif + + return did_one ? OK : FAIL; +} + +/* + * Find "name" in "path". When found, invoke the callback function for + * it: callback(fname, "cookie") + * When "flags" has DIP_ALL repeat for all matches, otherwise only the first + * one is used. + * Returns OK when at least one match found, FAIL otherwise. + * + * If "name" is NULL calls callback for each entry in "path". Cookie is + * passed by reference in this case, setting it to NULL indicates that callback + * has done its job. + */ + static int +do_in_path_and_pp( + char_u *path, + char_u *name, + int flags, + void (*callback)(char_u *fname, void *ck), + void *cookie) +{ + int done = FAIL; + char_u *s; + int len; + char *start_dir = "pack/*/start/*/%s"; + char *opt_dir = "pack/*/opt/*/%s"; + + if ((flags & DIP_NORTP) == 0) + done = do_in_path(path, name, flags, callback, cookie); + + if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START)) + { + len = (int)(STRLEN(start_dir) + STRLEN(name)); + s = alloc(len); + if (s == NULL) + return FAIL; + vim_snprintf((char *)s, len, start_dir, name); + done = do_in_path(p_pp, s, flags, callback, cookie); + vim_free(s); + } + + if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT)) + { + len = (int)(STRLEN(opt_dir) + STRLEN(name)); + s = alloc(len); + if (s == NULL) + return FAIL; + vim_snprintf((char *)s, len, opt_dir, name); + done = do_in_path(p_pp, s, flags, callback, cookie); + vim_free(s); + } + + return done; +} + +/* + * Just like do_in_path_and_pp(), using 'runtimepath' for "path". + */ + int +do_in_runtimepath( + char_u *name, + int flags, + void (*callback)(char_u *fname, void *ck), + void *cookie) +{ + return do_in_path_and_pp(p_rtp, name, flags, callback, cookie); +} + +/* + * Source the file "name" from all directories in 'runtimepath'. + * "name" can contain wildcards. + * When "flags" has DIP_ALL: source all files, otherwise only the first one. + * + * return FAIL when no file could be sourced, OK otherwise. + */ + int +source_runtime(char_u *name, int flags) +{ + return source_in_path(p_rtp, name, flags); +} + +/* + * Just like source_runtime(), but use "path" instead of 'runtimepath'. + */ + int +source_in_path(char_u *path, char_u *name, int flags) +{ + return do_in_path_and_pp(path, name, flags, source_callback, NULL); +} + + +#if defined(FEAT_EVAL) || defined(PROTO) + +/* + * Expand wildcards in "pat" and invoke do_source() for each match. + */ + static void +source_all_matches(char_u *pat) +{ + int num_files; + char_u **files; + int i; + + if (gen_expand_wildcards(1, &pat, &num_files, &files, EW_FILE) == OK) + { + for (i = 0; i < num_files; ++i) + (void)do_source(files[i], FALSE, DOSO_NONE); + FreeWild(num_files, files); + } +} + +/* + * Add the package directory to 'runtimepath'. + */ + static int +add_pack_dir_to_rtp(char_u *fname) +{ + char_u *p4, *p3, *p2, *p1, *p; + char_u *insp; + int c; + char_u *new_rtp; + int keep; + size_t oldlen; + size_t addlen; + char_u *afterdir = NULL; + size_t afterlen = 0; + char_u *ffname = NULL; + size_t fname_len; + char_u *buf = NULL; + char_u *rtp_ffname; + int match; + int retval = FAIL; + + p4 = p3 = p2 = p1 = get_past_head(fname); + for (p = p1; *p; MB_PTR_ADV(p)) + if (vim_ispathsep_nocolon(*p)) + { + p4 = p3; p3 = p2; p2 = p1; p1 = p; + } + + /* now we have: + * rtp/pack/name/start/name + * p4 p3 p2 p1 + * + * find the part up to "pack" in 'runtimepath' */ + c = *++p4; /* append pathsep in order to expand symlink */ + *p4 = NUL; + ffname = fix_fname(fname); + *p4 = c; + if (ffname == NULL) + return FAIL; + + /* Find "ffname" in "p_rtp", ignoring '/' vs '\' differences. */ + fname_len = STRLEN(ffname); + insp = p_rtp; + buf = alloc(MAXPATHL); + if (buf == NULL) + goto theend; + while (*insp != NUL) + { + copy_option_part(&insp, buf, MAXPATHL, ","); + add_pathsep(buf); + rtp_ffname = fix_fname(buf); + if (rtp_ffname == NULL) + goto theend; + match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0; + vim_free(rtp_ffname); + if (match) + break; + } + + if (*insp == NUL) + /* not found, append at the end */ + insp = p_rtp + STRLEN(p_rtp); + else + /* append after the matching directory. */ + --insp; + + /* check if rtp/pack/name/start/name/after exists */ + afterdir = concat_fnames(fname, (char_u *)"after", TRUE); + if (afterdir != NULL && mch_isdir(afterdir)) + afterlen = STRLEN(afterdir) + 1; /* add one for comma */ + + oldlen = STRLEN(p_rtp); + addlen = STRLEN(fname) + 1; /* add one for comma */ + new_rtp = alloc((int)(oldlen + addlen + afterlen + 1)); + /* add one for NUL */ + if (new_rtp == NULL) + goto theend; + keep = (int)(insp - p_rtp); + mch_memmove(new_rtp, p_rtp, keep); + new_rtp[keep] = ','; + mch_memmove(new_rtp + keep + 1, fname, addlen); + if (p_rtp[keep] != NUL) + mch_memmove(new_rtp + keep + addlen, p_rtp + keep, oldlen - keep + 1); + if (afterlen > 0) + { + STRCAT(new_rtp, ","); + STRCAT(new_rtp, afterdir); + } + set_option_value((char_u *)"rtp", 0L, new_rtp, 0); + vim_free(new_rtp); + retval = OK; + +theend: + vim_free(buf); + vim_free(ffname); + vim_free(afterdir); + return retval; +} + +/* + * Load scripts in "plugin" and "ftdetect" directories of the package. + */ + static int +load_pack_plugin(char_u *fname) +{ + static char *plugpat = "%s/plugin/**/*.vim"; + static char *ftpat = "%s/ftdetect/*.vim"; + int len; + char_u *ffname = fix_fname(fname); + char_u *pat = NULL; + int retval = FAIL; + + if (ffname == NULL) + return FAIL; + len = (int)STRLEN(ffname) + (int)STRLEN(ftpat); + pat = alloc(len); + if (pat == NULL) + goto theend; + vim_snprintf((char *)pat, len, plugpat, ffname); + source_all_matches(pat); + + { + char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes"); + + /* If runtime/filetype.vim wasn't loaded yet, the scripts will be + * found when it loads. */ + if (cmd != NULL && eval_to_number(cmd) > 0) + { + do_cmdline_cmd((char_u *)"augroup filetypedetect"); + vim_snprintf((char *)pat, len, ftpat, ffname); + source_all_matches(pat); + do_cmdline_cmd((char_u *)"augroup END"); + } + vim_free(cmd); + } + vim_free(pat); + retval = OK; + +theend: + vim_free(ffname); + return retval; +} + +/* used for "cookie" of add_pack_plugin() */ +static int APP_ADD_DIR; +static int APP_LOAD; +static int APP_BOTH; + + static void +add_pack_plugin(char_u *fname, void *cookie) +{ + if (cookie != &APP_LOAD) + { + char_u *buf = alloc(MAXPATHL); + char_u *p; + int found = FALSE; + + if (buf == NULL) + return; + p = p_rtp; + while (*p != NUL) + { + copy_option_part(&p, buf, MAXPATHL, ","); + if (pathcmp((char *)buf, (char *)fname, -1) == 0) + { + found = TRUE; + break; + } + } + vim_free(buf); + if (!found) + /* directory is not yet in 'runtimepath', add it */ + if (add_pack_dir_to_rtp(fname) == FAIL) + return; + } + + if (cookie != &APP_ADD_DIR) + load_pack_plugin(fname); +} + +/* + * Add all packages in the "start" directory to 'runtimepath'. + */ + void +add_pack_start_dirs(void) +{ + do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, + add_pack_plugin, &APP_ADD_DIR); +} + +/* + * Load plugins from all packages in the "start" directory. + */ + void +load_start_packages(void) +{ + did_source_packages = TRUE; + do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, + add_pack_plugin, &APP_LOAD); +} + +/* + * ":packloadall" + * Find plugins in the package directories and source them. + */ + void +ex_packloadall(exarg_T *eap) +{ + if (!did_source_packages || eap->forceit) + { + /* First do a round to add all directories to 'runtimepath', then load + * the plugins. This allows for plugins to use an autoload directory + * of another plugin. */ + add_pack_start_dirs(); + load_start_packages(); + } +} + +/* + * ":packadd[!] {name}" + */ + void +ex_packadd(exarg_T *eap) +{ + static char *plugpat = "pack/*/%s/%s"; + int len; + char *pat; + int round; + int res = OK; + + /* Round 1: use "start", round 2: use "opt". */ + for (round = 1; round <= 2; ++round) + { + /* Only look under "start" when loading packages wasn't done yet. */ + if (round == 1 && did_source_packages) + continue; - /* Restore "current_compiler" for ":compiler {name}". */ - if (!eap->forceit) - { - if (old_cur_comp != NULL) - { - set_internal_string_var((char_u *)"g:current_compiler", - old_cur_comp); - vim_free(old_cur_comp); - } - else - do_unlet((char_u *)"g:current_compiler", TRUE); - } - } + len = (int)STRLEN(plugpat) + (int)STRLEN(eap->arg) + 5; + pat = (char *)alloc(len); + if (pat == NULL) + return; + vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg); + /* The first round don't give a "not found" error, in the second round + * only when nothing was found in the first round. */ + res = do_in_path(p_pp, (char_u *)pat, + DIP_ALL + DIP_DIR + (round == 2 && res == FAIL ? DIP_ERR : 0), + add_pack_plugin, eap->forceit ? &APP_ADD_DIR : &APP_BOTH); + vim_free(pat); } } #endif +#if defined(FEAT_EVAL) || defined(PROTO) /* - * ":runtime {name}" + * ":options" */ void -ex_runtime(eap) - exarg_T *eap; +ex_options( + exarg_T *eap UNUSED) { - source_runtime(eap->arg, eap->forceit); + vim_setenv((char_u *)"OPTWIN_CMD", (char_u *)(cmdmod.tab ? "tab" : "")); + cmd_source((char_u *)SYS_OPTWIN_FILE, NULL); } +#endif -static void source_callback __ARGS((char_u *fname, void *cookie)); - - static void -source_callback(fname, cookie) - char_u *fname; - void *cookie UNUSED; -{ - (void)do_source(fname, FALSE, DOSO_NONE); -} +#if defined(FEAT_PYTHON3) || defined(FEAT_PYTHON) || defined(PROTO) +# if (defined(FEAT_PYTHON) && defined(FEAT_PYTHON3)) || defined(PROTO) /* - * Source the file "name" from all directories in 'runtimepath'. - * "name" can contain wildcards. - * When "all" is TRUE, source all files, otherwise only the first one. - * return FAIL when no file could be sourced, OK otherwise. + * Detect Python 3 or 2, and initialize 'pyxversion'. */ - int -source_runtime(name, all) - char_u *name; - int all; + void +init_pyxversion(void) { - return do_in_runtimepath(name, all, source_callback, NULL); + if (p_pyx == 0) + { + if (python3_enabled(FALSE)) + p_pyx = 3; + else if (python_enabled(FALSE)) + p_pyx = 2; + } } +# endif /* - * Find "name" in 'runtimepath'. When found, invoke the callback function for - * it: callback(fname, "cookie") - * When "all" is TRUE repeat for all matches, otherwise only the first one is - * used. - * Returns OK when at least one match found, FAIL otherwise. - * - * If "name" is NULL calls callback for each entry in runtimepath. Cookie is - * passed by reference in this case, setting it to NULL indicates that callback - * has done its job. + * Does a file contain one of the following strings at the beginning of any + * line? + * "#!(any string)python2" => returns 2 + * "#!(any string)python3" => returns 3 + * "# requires python 2.x" => returns 2 + * "# requires python 3.x" => returns 3 + * otherwise return 0. */ - int -do_in_runtimepath(name, all, callback, cookie) - char_u *name; - int all; - void (*callback)__ARGS((char_u *fname, void *ck)); - void *cookie; + static int +requires_py_version(char_u *filename) { - char_u *rtp; - char_u *np; - char_u *buf; - char_u *rtp_copy; - char_u *tail; - int num_files; - char_u **files; - int i; - int did_one = FALSE; -#ifdef AMIGA - struct Process *proc = (struct Process *)FindTask(0L); - APTR save_winptr = proc->pr_WindowPtr; + FILE *file; + int requires_py_version = 0; + int i, lines; - /* Avoid a requester here for a volume that doesn't exist. */ - proc->pr_WindowPtr = (APTR)-1L; -#endif + lines = (int)p_mls; + if (lines < 0) + lines = 5; - /* Make a copy of 'runtimepath'. Invoking the callback may change the - * value. */ - rtp_copy = vim_strsave(p_rtp); - buf = alloc(MAXPATHL); - if (buf != NULL && rtp_copy != NULL) + file = mch_fopen((char *)filename, "r"); + if (file != NULL) { - if (p_verbose > 1 && name != NULL) - { - verbose_enter(); - smsg((char_u *)_("Searching for \"%s\" in \"%s\""), - (char *)name, (char *)p_rtp); - verbose_leave(); - } - - /* Loop over all entries in 'runtimepath'. */ - rtp = rtp_copy; - while (*rtp != NUL && (all || !did_one)) + for (i = 0; i < lines; i++) { - /* Copy the path from 'runtimepath' to buf[]. */ - copy_option_part(&rtp, buf, MAXPATHL, ","); - if (name == NULL) + if (vim_fgets(IObuff, IOSIZE, file)) + break; + if (i == 0 && IObuff[0] == '#' && IObuff[1] == '!') { - (*callback)(buf, (void *) &cookie); - if (!did_one) - did_one = (cookie == NULL); + /* Check shebang. */ + if (strstr((char *)IObuff + 2, "python2") != NULL) + { + requires_py_version = 2; + break; + } + if (strstr((char *)IObuff + 2, "python3") != NULL) + { + requires_py_version = 3; + break; + } } - else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) + IObuff[21] = '\0'; + if (STRCMP("# requires python 2.x", IObuff) == 0) { - add_pathsep(buf); - tail = buf + STRLEN(buf); + requires_py_version = 2; + break; + } + if (STRCMP("# requires python 3.x", IObuff) == 0) + { + requires_py_version = 3; + break; + } + } + fclose(file); + } + return requires_py_version; +} - /* Loop over all patterns in "name" */ - np = name; - while (*np != NUL && (all || !did_one)) - { - /* Append the pattern from "name" to buf[]. */ - copy_option_part(&np, tail, (int)(MAXPATHL - (tail - buf)), - "\t "); - if (p_verbose > 2) - { - verbose_enter(); - smsg((char_u *)_("Searching for \"%s\""), buf); - verbose_leave(); - } +/* + * Source a python file using the requested python version. + */ + static void +source_pyx_file(exarg_T *eap, char_u *fname) +{ + exarg_T ex; + int v = requires_py_version(fname); - /* Expand wildcards, invoke the callback for each match. */ - if (gen_expand_wildcards(1, &buf, &num_files, &files, - EW_FILE) == OK) - { - for (i = 0; i < num_files; ++i) - { - (*callback)(files[i], cookie); - did_one = TRUE; - if (!all) - break; - } - FreeWild(num_files, files); - } - } - } - } +# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) + init_pyxversion(); +# endif + if (v == 0) + { +# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) + /* user didn't choose a preference, 'pyx' is used */ + v = p_pyx; +# elif defined(FEAT_PYTHON) + v = 2; +# elif defined(FEAT_PYTHON3) + v = 3; +# endif } - vim_free(buf); - vim_free(rtp_copy); - if (p_verbose > 0 && !did_one && name != NULL) + + /* + * now source, if required python version is not supported show + * unobtrusive message. + */ + if (eap == NULL) + vim_memset(&ex, 0, sizeof(ex)); + else + ex = *eap; + ex.arg = fname; + ex.cmd = (char_u *)(v == 2 ? "pyfile" : "pyfile3"); + + if (v == 2) { - verbose_enter(); - smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name); - verbose_leave(); +# ifdef FEAT_PYTHON + ex_pyfile(&ex); +# else + vim_snprintf((char *)IObuff, IOSIZE, + _("W20: Required python version 2.x not supported, ignoring file: %s"), + fname); + MSG(IObuff); +# endif + return; } + else + { +# ifdef FEAT_PYTHON3 + ex_py3file(&ex); +# else + vim_snprintf((char *)IObuff, IOSIZE, + _("W21: Required python version 3.x not supported, ignoring file: %s"), + fname); + MSG(IObuff); +# endif + return; + } +} -#ifdef AMIGA - proc->pr_WindowPtr = save_winptr; -#endif +/* + * ":pyxfile {fname}" + */ + void +ex_pyxfile(exarg_T *eap) +{ + source_pyx_file(eap, eap->arg); +} - return did_one ? OK : FAIL; +/* + * ":pyx" + */ + void +ex_pyx(exarg_T *eap) +{ +# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) + init_pyxversion(); + if (p_pyx == 2) + ex_python(eap); + else + ex_py3(eap); +# elif defined(FEAT_PYTHON) + ex_python(eap); +# elif defined(FEAT_PYTHON3) + ex_py3(eap); +# endif } -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) /* - * ":options" + * ":pyxdo" */ void -ex_options(eap) - exarg_T *eap UNUSED; +ex_pyxdo(exarg_T *eap) { - cmd_source((char_u *)SYS_OPTWIN_FILE, NULL); +# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) + init_pyxversion(); + if (p_pyx == 2) + ex_pydo(eap); + else + ex_py3do(eap); +# elif defined(FEAT_PYTHON) + ex_pydo(eap); +# elif defined(FEAT_PYTHON3) + ex_py3do(eap); +# endif } + #endif /* * ":source {fname}" */ void -ex_source(eap) - exarg_T *eap; +ex_source(exarg_T *eap) { #ifdef FEAT_BROWSE if (cmdmod.browse) @@ -2955,7 +4222,8 @@ ex_source(eap) char_u *fname = NULL; fname = do_browse(0, (char_u *)_("Source Vim script"), eap->arg, - NULL, NULL, BROWSE_FILTER_MACROS, NULL); + NULL, NULL, + (char_u *)_(BROWSE_FILTER_MACROS), NULL); if (fname != NULL) { cmd_source(fname, eap); @@ -2968,9 +4236,7 @@ ex_source(eap) } static void -cmd_source(fname, eap) - char_u *fname; - exarg_T *eap; +cmd_source(char_u *fname, exarg_T *eap) { if (*fname == NUL) EMSG(_(e_argreq)); @@ -3029,8 +4295,7 @@ struct source_cookie * Return the address holding the next breakpoint line for a source cookie. */ linenr_T * -source_breakpoint(cookie) - void *cookie; +source_breakpoint(void *cookie) { return &((struct source_cookie *)cookie)->breakpoint; } @@ -3039,8 +4304,7 @@ source_breakpoint(cookie) * Return the address holding the debug tick for a source cookie. */ int * -source_dbg_tick(cookie) - void *cookie; +source_dbg_tick(void *cookie) { return &((struct source_cookie *)cookie)->dbg_tick; } @@ -3049,26 +4313,24 @@ source_dbg_tick(cookie) * Return the nesting level for a source cookie. */ int -source_level(cookie) - void *cookie; +source_level(void *cookie) { return ((struct source_cookie *)cookie)->level; } #endif -static char_u *get_one_sourceline __ARGS((struct source_cookie *sp)); +static char_u *get_one_sourceline(struct source_cookie *sp); #if (defined(WIN32) && defined(FEAT_CSCOPE)) || defined(HAVE_FD_CLOEXEC) # define USE_FOPEN_NOINH -static FILE *fopen_noinh_readbin __ARGS((char *filename)); +static FILE *fopen_noinh_readbin(char *filename); /* * Special function to open a file without handle inheritance. * When possible the handle is closed on exec(). */ static FILE * -fopen_noinh_readbin(filename) - char *filename; +fopen_noinh_readbin(char *filename) { # ifdef WIN32 int fd_tmp = mch_open(filename, O_RDONLY | O_BINARY | O_NOINHERIT, 0); @@ -3083,7 +4345,7 @@ fopen_noinh_readbin(filename) { int fdflags = fcntl(fd_tmp, F_GETFD); if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0) - fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC); + (void)fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC); } # endif @@ -3100,10 +4362,10 @@ fopen_noinh_readbin(filename) * return FAIL if file could not be opened, OK otherwise */ int -do_source(fname, check_other, is_vimrc) - char_u *fname; - int check_other; /* check for .vimrc and _vimrc */ - int is_vimrc; /* DOSO_ value */ +do_source( + char_u *fname, + int check_other, /* check for .vimrc and _vimrc */ + int is_vimrc) /* DOSO_ value */ { struct source_cookie cookie; char_u *save_sourcing_name; @@ -3119,7 +4381,7 @@ do_source(fname, check_other, is_vimrc) int save_debug_break_level = debug_break_level; scriptitem_T *si = NULL; # ifdef UNIX - struct stat st; + stat_T st; int stat_ok; # endif #endif @@ -3144,23 +4406,21 @@ do_source(fname, check_other, is_vimrc) goto theend; } -#ifdef FEAT_AUTOCMD /* Apply SourceCmd autocommands, they should get the file and source it. */ if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL) && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp, FALSE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL retval = aborting() ? FAIL : OK; -# else +#else retval = OK; -# endif +#endif goto theend; } /* Apply SourcePre autocommands, they may get the file. */ apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf); -#endif #ifdef USE_FOPEN_NOINH cookie.fp = fopen_noinh_readbin((char *)fname_exp); @@ -3266,27 +4526,6 @@ do_source(fname, check_other, is_vimrc) save_sourcing_lnum = sourcing_lnum; sourcing_lnum = 0; -#ifdef FEAT_MBYTE - cookie.conv.vc_type = CONV_NONE; /* no conversion */ - - /* Read the first line so we can check for a UTF-8 BOM. */ - firstline = getsourceline(0, (void *)&cookie, 0); - if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef - && firstline[1] == 0xbb && firstline[2] == 0xbf) - { - /* Found BOM; setup conversion, skip over BOM and recode the line. */ - convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); - p = string_convert(&cookie.conv, firstline + 3, NULL); - if (p == NULL) - p = vim_strsave(firstline + 3); - if (p != NULL) - { - vim_free(firstline); - firstline = p; - } - } -#endif - #ifdef STARTUPTIME if (time_fd != NULL) time_push(&tv_rel, &tv_start); @@ -3379,6 +4618,27 @@ do_source(fname, check_other, is_vimrc) # endif #endif +#ifdef FEAT_MBYTE + cookie.conv.vc_type = CONV_NONE; /* no conversion */ + + /* Read the first line so we can check for a UTF-8 BOM. */ + firstline = getsourceline(0, (void *)&cookie, 0); + if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef + && firstline[1] == 0xbb && firstline[2] == 0xbf) + { + /* Found BOM; setup conversion, skip over BOM and recode the line. */ + convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); + p = string_convert(&cookie.conv, firstline + 3, NULL); + if (p == NULL) + p = vim_strsave(firstline + 3); + if (p != NULL) + { + vim_free(firstline); + firstline = p; + } + } +#endif + /* * Call do_cmdline, which will call getsourceline() to get the lines. */ @@ -3460,8 +4720,7 @@ do_source(fname, check_other, is_vimrc) * ":scriptnames" */ void -ex_scriptnames(eap) - exarg_T *eap UNUSED; +ex_scriptnames(exarg_T *eap UNUSED) { int i; @@ -3479,7 +4738,7 @@ ex_scriptnames(eap) * Fix slashes in the list of script names for 'shellslash'. */ void -scriptnames_slash_adjust() +scriptnames_slash_adjust(void) { int i; @@ -3493,8 +4752,7 @@ scriptnames_slash_adjust() * Get a pointer to a script name. Used for ":verbose set". */ char_u * -get_scriptname(id) - scid_T id; +get_scriptname(scid_T id) { if (id == SID_MODELINE) return (char_u *)_("modeline"); @@ -3511,7 +4769,7 @@ get_scriptname(id) # if defined(EXITFREE) || defined(PROTO) void -free_scriptnames() +free_scriptnames(void) { int i; @@ -3533,10 +4791,7 @@ free_scriptnames() * Codewarrior Pro 2. */ char * -fgets_cr(s, n, stream) - char *s; - int n; - FILE *stream; +fgets_cr(char *s, int n, FILE *stream) { return fgets(s, n, stream); } @@ -3548,10 +4803,7 @@ fgets_cr(s, n, stream) * At least CodeWarrior 9 needed this code. */ char * -fgets_cr(s, n, stream) - char *s; - int n; - FILE *stream; +fgets_cr(char *s, int n, FILE *stream) { int c = 0; int char_read = 0; @@ -3590,10 +4842,7 @@ fgets_cr(s, n, stream) * Return NULL for end-of-file or some error. */ char_u * -getsourceline(c, cookie, indent) - int c UNUSED; - void *cookie; - int indent UNUSED; +getsourceline(int c UNUSED, void *cookie, int indent UNUSED) { struct source_cookie *sp = (struct source_cookie *)cookie; char_u *line; @@ -3704,8 +4953,7 @@ getsourceline(c, cookie, indent) } static char_u * -get_one_sourceline(sp) - struct source_cookie *sp; +get_one_sourceline(struct source_cookie *sp) { garray_T ga; int len; @@ -3817,7 +5065,7 @@ get_one_sourceline(sp) { if (!sp->error) { - msg_source(hl_attr(HLF_W)); + msg_source(HL_ATTR(HLF_W)); EMSG(_("W15: Warning: Wrong line separator, ^M may be missing")); } sp->error = TRUE; @@ -3861,7 +5109,7 @@ get_one_sourceline(sp) * until later and we need to store the time now. */ void -script_line_start() +script_line_start(void) { scriptitem_T *si; sn_prl_T *pp; @@ -3873,7 +5121,8 @@ script_line_start() { /* Grow the array before starting the timer, so that the time spent * here isn't counted. */ - ga_grow(&si->sn_prl_ga, (int)(sourcing_lnum - si->sn_prl_ga.ga_len)); + (void)ga_grow(&si->sn_prl_ga, + (int)(sourcing_lnum - si->sn_prl_ga.ga_len)); si->sn_prl_idx = sourcing_lnum - 1; while (si->sn_prl_ga.ga_len <= si->sn_prl_idx && si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen) @@ -3896,7 +5145,7 @@ script_line_start() * Called when actually executing a function line. */ void -script_line_exec() +script_line_exec(void) { scriptitem_T *si; @@ -3908,10 +5157,10 @@ script_line_exec() } /* - * Called when done with a function line. + * Called when done with a script line. */ void -script_line_end() +script_line_end(void) { scriptitem_T *si; sn_prl_T *pp; @@ -3942,8 +5191,7 @@ script_line_end() * Without the multi-byte feature it's simply ignored. */ void -ex_scriptencoding(eap) - exarg_T *eap UNUSED; +ex_scriptencoding(exarg_T *eap UNUSED) { #ifdef FEAT_MBYTE struct source_cookie *sp; @@ -3978,8 +5226,7 @@ ex_scriptencoding(eap) * ":finish": Mark a sourced file as finished. */ void -ex_finish(eap) - exarg_T *eap; +ex_finish(exarg_T *eap) { if (getline_equal(eap->getline, eap->cookie, getsourceline)) do_finish(eap, FALSE); @@ -3993,9 +5240,7 @@ ex_finish(eap) * an extra do_cmdline(). "reanimate" is used in the latter case. */ void -do_finish(eap, reanimate) - exarg_T *eap; - int reanimate; +do_finish(exarg_T *eap, int reanimate) { int idx; @@ -4027,9 +5272,9 @@ do_finish(eap, reanimate) * Return FALSE when not sourcing a file. */ int -source_finished(fgetline, cookie) - char_u *(*fgetline) __ARGS((int, void *, int)); - void *cookie; +source_finished( + char_u *(*fgetline)(int, void *, int), + void *cookie) { return (getline_equal(fgetline, cookie, getsourceline) && ((struct source_cookie *)getline_cookie( @@ -4037,13 +5282,11 @@ source_finished(fgetline, cookie) } #endif -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * ":checktime [buffer]" */ void -ex_checktime(eap) - exarg_T *eap; +ex_checktime(exarg_T *eap) { buf_T *buf; int save_no_check_timestamps = no_check_timestamps; @@ -4059,22 +5302,19 @@ ex_checktime(eap) } no_check_timestamps = save_no_check_timestamps; } -#endif #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) # define HAVE_GET_LOCALE_VAL -static char *get_locale_val __ARGS((int what)); +static char_u *get_locale_val(int what); - static char * -get_locale_val(what) - int what; + static char_u * +get_locale_val(int what) { - char *loc; + char_u *loc; - /* Obtain the locale value from the libraries. For DJGPP this is - * redefined and it doesn't use the arguments. */ - loc = setlocale(what, NULL); + /* Obtain the locale value from the libraries. */ + loc = (char_u *)setlocale(what, NULL); # ifdef WIN32 if (loc != NULL) @@ -4138,7 +5378,7 @@ gettext_lang(char_u *name) for (i = 0; mtable[i] != NULL; i += 2) if (STRNICMP(mtable[i], name, STRLEN(mtable[i])) == 0) - return mtable[i + 1]; + return (char_u *)mtable[i + 1]; return name; } #endif @@ -4149,19 +5389,19 @@ gettext_lang(char_u *name) * 'helplang'. May return NULL or an empty string. */ char_u * -get_mess_lang() +get_mess_lang(void) { char_u *p; # ifdef HAVE_GET_LOCALE_VAL # if defined(LC_MESSAGES) - p = (char_u *)get_locale_val(LC_MESSAGES); + p = get_locale_val(LC_MESSAGES); # else /* This is necessary for Win32, where LC_MESSAGES is not defined and $LANG * may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME * and LC_MONETARY may be set differently for a Japanese working in the * US. */ - p = (char_u *)get_locale_val(LC_COLLATE); + p = get_locale_val(LC_COLLATE); # endif # else p = mch_getenv((char_u *)"LC_ALL"); @@ -4185,13 +5425,13 @@ get_mess_lang() || ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) \ && !defined(LC_MESSAGES)) -static char_u *get_mess_env __ARGS((void)); +static char_u *get_mess_env(void); /* * Get the language used for messages from the environment. */ static char_u * -get_mess_env() +get_mess_env(void) { char_u *p; @@ -4206,7 +5446,7 @@ get_mess_env() p = NULL; /* ignore something like "1043" */ # ifdef HAVE_GET_LOCALE_VAL if (p == NULL || *p == NUL) - p = (char_u *)get_locale_val(LC_CTYPE); + p = get_locale_val(LC_CTYPE); # endif } } @@ -4221,12 +5461,12 @@ get_mess_env() * Also do "v:lc_time"and "v:ctype". */ void -set_lang_var() +set_lang_var(void) { char_u *loc; # ifdef HAVE_GET_LOCALE_VAL - loc = (char_u *)get_locale_val(LC_CTYPE); + loc = get_locale_val(LC_CTYPE); # else /* setlocale() not supported: use the default value */ loc = (char_u *)"C"; @@ -4236,14 +5476,14 @@ set_lang_var() /* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall * back to LC_CTYPE if it's empty. */ # if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES) - loc = (char_u *)get_locale_val(LC_MESSAGES); + loc = get_locale_val(LC_MESSAGES); # else loc = get_mess_env(); # endif set_vim_var_string(VV_LANG, loc, -1); # ifdef HAVE_GET_LOCALE_VAL - loc = (char_u *)get_locale_val(LC_TIME); + loc = get_locale_val(LC_TIME); # endif set_vim_var_string(VV_LC_TIME, loc, -1); } @@ -4255,8 +5495,7 @@ set_lang_var() * ":language": Set the language (locale). */ void -ex_language(eap) - exarg_T *eap; +ex_language(exarg_T *eap) { char *loc; char_u *p; @@ -4275,7 +5514,7 @@ ex_language(eap) * Allow abbreviation, but require at least 3 characters to avoid * confusion with a two letter language name "me" or "ct". */ p = skiptowhite(eap->arg); - if ((*p == NUL || vim_iswhite(*p)) && p - eap->arg >= 3) + if ((*p == NUL || VIM_ISWHITE(*p)) && p - eap->arg >= 3) { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { @@ -4385,28 +5624,14 @@ ex_language(eap) # if defined(FEAT_CMDL_COMPL) || defined(PROTO) static char_u **locales = NULL; /* Array of all available locales */ -static int did_init_locales = FALSE; - -static void init_locales __ARGS((void)); -static char_u **find_locales __ARGS((void)); -/* - * Lazy initialization of all available locales. - */ - static void -init_locales() -{ - if (!did_init_locales) - { - did_init_locales = TRUE; - locales = find_locales(); - } -} +# ifndef WIN32 +static int did_init_locales = FALSE; /* Return an array of strings for all available locales + NULL for the * last element. Return NULL in case of error. */ static char_u ** -find_locales() +find_locales(void) { garray_T locales_ga; char_u *loc; @@ -4443,18 +5668,33 @@ find_locales() ((char_u **)locales_ga.ga_data)[locales_ga.ga_len] = NULL; return (char_u **)locales_ga.ga_data; } +# endif + +/* + * Lazy initialization of all available locales. + */ + static void +init_locales(void) +{ +# ifndef WIN32 + if (!did_init_locales) + { + did_init_locales = TRUE; + locales = find_locales(); + } +# endif +} # if defined(EXITFREE) || defined(PROTO) void -free_locales() +free_locales(void) { int i; if (locales != NULL) { for (i = 0; locales[i] != NULL; i++) vim_free(locales[i]); - vim_free(locales); - locales = NULL; + VIM_CLEAR(locales); } } # endif @@ -4464,9 +5704,7 @@ free_locales() * ":language" command. */ char_u * -get_lang_arg(xp, idx) - expand_T *xp UNUSED; - int idx; +get_lang_arg(expand_T *xp UNUSED, int idx) { if (idx == 0) return (char_u *)"messages"; @@ -4485,9 +5723,7 @@ get_lang_arg(xp, idx) * Function given to ExpandGeneric() to obtain the available locales. */ char_u * -get_locales(xp, idx) - expand_T *xp UNUSED; - int idx; +get_locales(expand_T *xp UNUSED, int idx) { init_locales(); if (locales == NULL) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a091c0bece..55d96e72aa 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -27,6 +27,7 @@ typedef struct ucmd char_u *uc_rep; /* The command's replacement string */ long uc_def; /* The default value for a range/count */ int uc_compl; /* completion type */ + int uc_addr_type; /* The command's address type */ # ifdef FEAT_EVAL scid_T uc_scriptID; /* SID where the command was defined */ # ifdef FEAT_CMDL_COMPL @@ -42,71 +43,56 @@ static garray_T ucmds = {0, 0, sizeof(ucmd_T), 4, NULL}; #define USER_CMD(i) (&((ucmd_T *)(ucmds.ga_data))[i]) #define USER_CMD_GA(gap, i) (&((ucmd_T *)((gap)->ga_data))[i]) -static void do_ucmd __ARGS((exarg_T *eap)); -static void ex_command __ARGS((exarg_T *eap)); -static void ex_delcommand __ARGS((exarg_T *eap)); +static void do_ucmd(exarg_T *eap); +static void ex_command(exarg_T *eap); +static void ex_delcommand(exarg_T *eap); # ifdef FEAT_CMDL_COMPL -static char_u *get_user_command_name __ARGS((int idx)); +static char_u *get_user_command_name(int idx); # endif +/* Wether a command index indicates a user command. */ +# define IS_USER_CMDIDX(idx) ((int)(idx) < 0) + #else # define ex_command ex_ni # define ex_comclear ex_ni # define ex_delcommand ex_ni +/* Wether a command index indicates a user command. */ +# define IS_USER_CMDIDX(idx) (FALSE) #endif +static int compute_buffer_local_count(int addr_type, int lnum, int local); #ifdef FEAT_EVAL -static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int), void *cookie)); +static char_u *do_one_cmd(char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int), void *cookie); #else -static char_u *do_one_cmd __ARGS((char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie)); +static char_u *do_one_cmd(char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie); static int if_level = 0; /* depth in :if */ #endif -static void append_command __ARGS((char_u *cmd)); -static char_u *find_command __ARGS((exarg_T *eap, int *full)); +static void append_command(char_u *cmd); +static char_u *find_command(exarg_T *eap, int *full); -static void ex_abbreviate __ARGS((exarg_T *eap)); -static void ex_map __ARGS((exarg_T *eap)); -static void ex_unmap __ARGS((exarg_T *eap)); -static void ex_mapclear __ARGS((exarg_T *eap)); -static void ex_abclear __ARGS((exarg_T *eap)); +static void ex_abbreviate(exarg_T *eap); +static void ex_map(exarg_T *eap); +static void ex_unmap(exarg_T *eap); +static void ex_mapclear(exarg_T *eap); +static void ex_abclear(exarg_T *eap); #ifndef FEAT_MENU # define ex_emenu ex_ni # define ex_menu ex_ni # define ex_menutranslate ex_ni #endif -#ifdef FEAT_AUTOCMD -static void ex_autocmd __ARGS((exarg_T *eap)); -static void ex_doautocmd __ARGS((exarg_T *eap)); -#else -# define ex_autocmd ex_ni -# define ex_doautocmd ex_ni -# define ex_doautoall ex_ni -#endif -#ifdef FEAT_LISTCMDS -static void ex_bunload __ARGS((exarg_T *eap)); -static void ex_buffer __ARGS((exarg_T *eap)); -static void ex_bmodified __ARGS((exarg_T *eap)); -static void ex_bnext __ARGS((exarg_T *eap)); -static void ex_bprevious __ARGS((exarg_T *eap)); -static void ex_brewind __ARGS((exarg_T *eap)); -static void ex_blast __ARGS((exarg_T *eap)); -#else -# define ex_bunload ex_ni -# define ex_buffer ex_ni -# define ex_bmodified ex_ni -# define ex_bnext ex_ni -# define ex_bprevious ex_ni -# define ex_brewind ex_ni -# define ex_blast ex_ni -# define buflist_list ex_ni -# define ex_checktime ex_ni -#endif -#if !defined(FEAT_LISTCMDS) || !defined(FEAT_WINDOWS) -# define ex_buffer_all ex_ni -#endif -static char_u *getargcmd __ARGS((char_u **)); -static char_u *skip_cmd_arg __ARGS((char_u *p, int rembs)); -static int getargopt __ARGS((exarg_T *eap)); +static void ex_autocmd(exarg_T *eap); +static void ex_doautocmd(exarg_T *eap); +static void ex_bunload(exarg_T *eap); +static void ex_buffer(exarg_T *eap); +static void ex_bmodified(exarg_T *eap); +static void ex_bnext(exarg_T *eap); +static void ex_bprevious(exarg_T *eap); +static void ex_brewind(exarg_T *eap); +static void ex_blast(exarg_T *eap); +static char_u *getargcmd(char_u **); +static char_u *skip_cmd_arg(char_u *p, int rembs); +static int getargopt(exarg_T *eap); #ifndef FEAT_QUICKFIX # define ex_make ex_ni # define ex_cbuffer ex_ni @@ -115,21 +101,23 @@ static int getargopt __ARGS((exarg_T *eap)); # define ex_cfile ex_ni # define qf_list ex_ni # define qf_age ex_ni +# define qf_history ex_ni # define ex_helpgrep ex_ni # define ex_vimgrep ex_ni #endif -#if !defined(FEAT_QUICKFIX) || !defined(FEAT_WINDOWS) +#if !defined(FEAT_QUICKFIX) # define ex_cclose ex_ni # define ex_copen ex_ni # define ex_cwindow ex_ni +# define ex_cbottom ex_ni #endif #if !defined(FEAT_QUICKFIX) || !defined(FEAT_EVAL) # define ex_cexpr ex_ni #endif -static int check_more __ARGS((int, int)); -static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file)); -static void get_flags __ARGS((exarg_T *eap)); +static int check_more(int, int); +static linenr_T get_address(exarg_T *, char_u **, int addr_type, int skip, int to_other_file, int address_count); +static void get_flags(exarg_T *eap); #if !defined(FEAT_PERL) \ || !defined(FEAT_PYTHON) || !defined(FEAT_PYTHON3) \ || !defined(FEAT_TCL) \ @@ -137,90 +125,68 @@ static void get_flags __ARGS((exarg_T *eap)); || !defined(FEAT_LUA) \ || !defined(FEAT_MZSCHEME) # define HAVE_EX_SCRIPT_NI -static void ex_script_ni __ARGS((exarg_T *eap)); +static void ex_script_ni(exarg_T *eap); #endif -static char_u *invalid_range __ARGS((exarg_T *eap)); -static void correct_range __ARGS((exarg_T *eap)); +static char_u *invalid_range(exarg_T *eap); +static void correct_range(exarg_T *eap); #ifdef FEAT_QUICKFIX -static char_u *replace_makeprg __ARGS((exarg_T *eap, char_u *p, char_u **cmdlinep)); -#endif -static char_u *repl_cmdline __ARGS((exarg_T *eap, char_u *src, int srclen, char_u *repl, char_u **cmdlinep)); -static void ex_highlight __ARGS((exarg_T *eap)); -static void ex_colorscheme __ARGS((exarg_T *eap)); -static void ex_quit __ARGS((exarg_T *eap)); -static void ex_cquit __ARGS((exarg_T *eap)); -static void ex_quit_all __ARGS((exarg_T *eap)); -#ifdef FEAT_WINDOWS -static void ex_close __ARGS((exarg_T *eap)); -static void ex_win_close __ARGS((int forceit, win_T *win, tabpage_T *tp)); -static void ex_only __ARGS((exarg_T *eap)); -static void ex_resize __ARGS((exarg_T *eap)); -static void ex_stag __ARGS((exarg_T *eap)); -static void ex_tabclose __ARGS((exarg_T *eap)); -static void ex_tabonly __ARGS((exarg_T *eap)); -static void ex_tabnext __ARGS((exarg_T *eap)); -static void ex_tabmove __ARGS((exarg_T *eap)); -static void ex_tabs __ARGS((exarg_T *eap)); -#else -# define ex_close ex_ni -# define ex_only ex_ni -# define ex_all ex_ni -# define ex_resize ex_ni -# define ex_splitview ex_ni -# define ex_stag ex_ni -# define ex_tabnext ex_ni -# define ex_tabmove ex_ni -# define ex_tabs ex_ni -# define ex_tabclose ex_ni -# define ex_tabonly ex_ni -#endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) -static void ex_pclose __ARGS((exarg_T *eap)); -static void ex_ptag __ARGS((exarg_T *eap)); -static void ex_pedit __ARGS((exarg_T *eap)); +static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep); +#endif +static char_u *repl_cmdline(exarg_T *eap, char_u *src, int srclen, char_u *repl, char_u **cmdlinep); +static void ex_highlight(exarg_T *eap); +static void ex_colorscheme(exarg_T *eap); +static void ex_quit(exarg_T *eap); +static void ex_cquit(exarg_T *eap); +static void ex_quit_all(exarg_T *eap); +static void ex_close(exarg_T *eap); +static void ex_win_close(int forceit, win_T *win, tabpage_T *tp); +static void ex_only(exarg_T *eap); +static void ex_resize(exarg_T *eap); +static void ex_stag(exarg_T *eap); +static void ex_tabclose(exarg_T *eap); +static void ex_tabonly(exarg_T *eap); +static void ex_tabnext(exarg_T *eap); +static void ex_tabmove(exarg_T *eap); +static void ex_tabs(exarg_T *eap); +#if defined(FEAT_QUICKFIX) +static void ex_pclose(exarg_T *eap); +static void ex_ptag(exarg_T *eap); +static void ex_pedit(exarg_T *eap); #else # define ex_pclose ex_ni # define ex_ptag ex_ni # define ex_pedit ex_ni #endif -static void ex_hide __ARGS((exarg_T *eap)); -static void ex_stop __ARGS((exarg_T *eap)); -static void ex_exit __ARGS((exarg_T *eap)); -static void ex_print __ARGS((exarg_T *eap)); +static void ex_hide(exarg_T *eap); +static void ex_stop(exarg_T *eap); +static void ex_exit(exarg_T *eap); +static void ex_print(exarg_T *eap); #ifdef FEAT_BYTEOFF -static void ex_goto __ARGS((exarg_T *eap)); +static void ex_goto(exarg_T *eap); #else # define ex_goto ex_ni #endif -static void ex_shell __ARGS((exarg_T *eap)); -static void ex_preserve __ARGS((exarg_T *eap)); -static void ex_recover __ARGS((exarg_T *eap)); -#ifndef FEAT_LISTCMDS -# define ex_argedit ex_ni -# define ex_argadd ex_ni -# define ex_argdelete ex_ni -# define ex_listdo ex_ni -#endif -static void ex_mode __ARGS((exarg_T *eap)); -static void ex_wrongmodifier __ARGS((exarg_T *eap)); -static void ex_find __ARGS((exarg_T *eap)); -static void ex_open __ARGS((exarg_T *eap)); -static void ex_edit __ARGS((exarg_T *eap)); -#if !defined(FEAT_GUI) && !defined(FEAT_CLIENTSERVER) -# define ex_drop ex_ni -#endif +static void ex_shell(exarg_T *eap); +static void ex_preserve(exarg_T *eap); +static void ex_recover(exarg_T *eap); +static void ex_mode(exarg_T *eap); +static void ex_wrongmodifier(exarg_T *eap); +static void ex_find(exarg_T *eap); +static void ex_open(exarg_T *eap); +static void ex_edit(exarg_T *eap); #ifndef FEAT_GUI # define ex_gui ex_nogui -static void ex_nogui __ARGS((exarg_T *eap)); +static void ex_nogui(exarg_T *eap); #endif #if defined(FEAT_GUI_W32) && defined(FEAT_MENU) && defined(FEAT_TEAROFF) -static void ex_tearoff __ARGS((exarg_T *eap)); +static void ex_tearoff(exarg_T *eap); #else # define ex_tearoff ex_ni #endif -#if defined(FEAT_MENU) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_MACVIM)) -static void ex_popup __ARGS((exarg_T *eap)); +#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_MACVIM) \ + || defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU) +static void ex_popup(exarg_T *eap); #else # define ex_popup ex_ni #endif @@ -236,14 +202,18 @@ static void ex_popup __ARGS((exarg_T *eap)); # define ex_helpfind ex_ni #endif #ifndef FEAT_CSCOPE -# define do_cscope ex_ni -# define do_scscope ex_ni -# define do_cstag ex_ni +# define ex_cscope ex_ni +# define ex_scscope ex_ni +# define ex_cstag ex_ni #endif #ifndef FEAT_SYN_HL # define ex_syntax ex_ni # define ex_ownsyntax ex_ni #endif +#ifndef FEAT_EVAL +# define ex_packadd ex_ni +# define ex_packloadall ex_ni +#endif #if !defined(FEAT_SYN_HL) || !defined(FEAT_PROFILE) # define ex_syntime ex_ni #endif @@ -281,6 +251,11 @@ static void ex_popup __ARGS((exarg_T *eap)); # define ex_py3do ex_ni # define ex_py3file ex_ni #endif +#if !defined(FEAT_PYTHON) && !defined(FEAT_PYTHON3) +# define ex_pyx ex_script_ni +# define ex_pyxdo ex_ni +# define ex_pyxfile ex_ni +#endif #ifndef FEAT_TCL # define ex_tcl ex_script_ni # define ex_tcldo ex_ni @@ -291,81 +266,62 @@ static void ex_popup __ARGS((exarg_T *eap)); # define ex_rubydo ex_ni # define ex_rubyfile ex_ni #endif -#ifndef FEAT_SNIFF -# define ex_sniff ex_ni -#endif #ifndef FEAT_KEYMAP # define ex_loadkeymap ex_ni #endif -static void ex_swapname __ARGS((exarg_T *eap)); -static void ex_syncbind __ARGS((exarg_T *eap)); -static void ex_read __ARGS((exarg_T *eap)); -static void ex_pwd __ARGS((exarg_T *eap)); -static void ex_equal __ARGS((exarg_T *eap)); -static void ex_sleep __ARGS((exarg_T *eap)); -static void do_exmap __ARGS((exarg_T *eap, int isabbrev)); -static void ex_winsize __ARGS((exarg_T *eap)); -#ifdef FEAT_WINDOWS -static void ex_wincmd __ARGS((exarg_T *eap)); -#else -# define ex_wincmd ex_ni -#endif +static void ex_swapname(exarg_T *eap); +static void ex_syncbind(exarg_T *eap); +static void ex_read(exarg_T *eap); +static void ex_pwd(exarg_T *eap); +static void ex_equal(exarg_T *eap); +static void ex_sleep(exarg_T *eap); +static void do_exmap(exarg_T *eap, int isabbrev); +static void ex_winsize(exarg_T *eap); +static void ex_wincmd(exarg_T *eap); #if defined(FEAT_GUI) || defined(UNIX) || defined(VMS) || defined(MSWIN) -static void ex_winpos __ARGS((exarg_T *eap)); +static void ex_winpos(exarg_T *eap); #else # define ex_winpos ex_ni #endif -static void ex_operators __ARGS((exarg_T *eap)); -static void ex_put __ARGS((exarg_T *eap)); -static void ex_copymove __ARGS((exarg_T *eap)); -static void ex_submagic __ARGS((exarg_T *eap)); -static void ex_join __ARGS((exarg_T *eap)); -static void ex_at __ARGS((exarg_T *eap)); -static void ex_bang __ARGS((exarg_T *eap)); -static void ex_undo __ARGS((exarg_T *eap)); +static void ex_operators(exarg_T *eap); +static void ex_put(exarg_T *eap); +static void ex_copymove(exarg_T *eap); +static void ex_submagic(exarg_T *eap); +static void ex_join(exarg_T *eap); +static void ex_at(exarg_T *eap); +static void ex_bang(exarg_T *eap); +static void ex_undo(exarg_T *eap); #ifdef FEAT_PERSISTENT_UNDO -static void ex_wundo __ARGS((exarg_T *eap)); -static void ex_rundo __ARGS((exarg_T *eap)); -#endif -static void ex_redo __ARGS((exarg_T *eap)); -static void ex_later __ARGS((exarg_T *eap)); -static void ex_redir __ARGS((exarg_T *eap)); -static void ex_redraw __ARGS((exarg_T *eap)); -static void ex_redrawstatus __ARGS((exarg_T *eap)); -static void close_redir __ARGS((void)); -static void ex_mkrc __ARGS((exarg_T *eap)); -static void ex_mark __ARGS((exarg_T *eap)); +static void ex_wundo(exarg_T *eap); +static void ex_rundo(exarg_T *eap); +#endif +static void ex_redo(exarg_T *eap); +static void ex_later(exarg_T *eap); +static void ex_redir(exarg_T *eap); +static void ex_redrawstatus(exarg_T *eap); +static void close_redir(void); +static void ex_mkrc(exarg_T *eap); +static void ex_mark(exarg_T *eap); #ifdef FEAT_USR_CMDS -static char_u *uc_fun_cmd __ARGS((void)); -static char_u *find_ucmd __ARGS((exarg_T *eap, char_u *p, int *full, expand_T *xp, int *compl)); -#endif -#ifdef FEAT_EX_EXTRA -static void ex_normal __ARGS((exarg_T *eap)); -static void ex_startinsert __ARGS((exarg_T *eap)); -static void ex_stopinsert __ARGS((exarg_T *eap)); -#else -# define ex_normal ex_ni -# define ex_align ex_ni -# define ex_retab ex_ni -# define ex_startinsert ex_ni -# define ex_stopinsert ex_ni -# define ex_helptags ex_ni -# define ex_sort ex_ni +static char_u *uc_fun_cmd(void); +static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *compl); #endif +static void ex_startinsert(exarg_T *eap); +static void ex_stopinsert(exarg_T *eap); #ifdef FEAT_FIND_ID -static void ex_checkpath __ARGS((exarg_T *eap)); -static void ex_findpat __ARGS((exarg_T *eap)); +static void ex_checkpath(exarg_T *eap); +static void ex_findpat(exarg_T *eap); #else # define ex_findpat ex_ni # define ex_checkpath ex_ni #endif -#if defined(FEAT_FIND_ID) && defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) -static void ex_psearch __ARGS((exarg_T *eap)); +#if defined(FEAT_FIND_ID) && defined(FEAT_QUICKFIX) +static void ex_psearch(exarg_T *eap); #else # define ex_psearch ex_ni #endif -static void ex_tag __ARGS((exarg_T *eap)); -static void ex_tag_cmd __ARGS((exarg_T *eap, char_u *name)); +static void ex_tag(exarg_T *eap); +static void ex_tag_cmd(exarg_T *eap, char_u *name); #ifndef FEAT_EVAL # define ex_scriptnames ex_ni # define ex_finish ex_ni @@ -395,12 +351,12 @@ static void ex_tag_cmd __ARGS((exarg_T *eap, char_u *name)); # define ex_return ex_ni # define ex_oldfiles ex_ni #endif -static char_u *arg_all __ARGS((void)); +static char_u *arg_all(void); #ifdef FEAT_SESSION -static int makeopens __ARGS((FILE *fd, char_u *dirnow)); -static int put_view __ARGS((FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx)); -static void ex_loadview __ARGS((exarg_T *eap)); -static char_u *get_view_file __ARGS((int c)); +static int makeopens(FILE *fd, char_u *dirnow); +static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx); +static void ex_loadview(exarg_T *eap); +static char_u *get_view_file(int c); static int did_lcd; /* whether ":lcd" was produced for a session */ #else # define ex_loadview ex_ni @@ -409,18 +365,13 @@ static int did_lcd; /* whether ":lcd" was produced for a session */ # define ex_compiler ex_ni #endif #ifdef FEAT_VIMINFO -static void ex_viminfo __ARGS((exarg_T *eap)); +static void ex_viminfo(exarg_T *eap); #else # define ex_viminfo ex_ni #endif -static void ex_behave __ARGS((exarg_T *eap)); -#ifdef FEAT_AUTOCMD -static void ex_filetype __ARGS((exarg_T *eap)); -static void ex_setfiletype __ARGS((exarg_T *eap)); -#else -# define ex_filetype ex_ni -# define ex_setfiletype ex_ni -#endif +static void ex_behave(exarg_T *eap); +static void ex_filetype(exarg_T *eap); +static void ex_setfiletype(exarg_T *eap); #ifndef FEAT_DIFF # define ex_diffoff ex_ni # define ex_diffpatch ex_ni @@ -429,27 +380,27 @@ static void ex_setfiletype __ARGS((exarg_T *eap)); # define ex_diffthis ex_ni # define ex_diffupdate ex_ni #endif -static void ex_digraphs __ARGS((exarg_T *eap)); -static void ex_set __ARGS((exarg_T *eap)); -#if !defined(FEAT_EVAL) || !defined(FEAT_AUTOCMD) +static void ex_digraphs(exarg_T *eap); +static void ex_set(exarg_T *eap); +#if !defined(FEAT_EVAL) # define ex_options ex_ni #endif #ifdef FEAT_SEARCH_EXTRA -static void ex_nohlsearch __ARGS((exarg_T *eap)); -static void ex_match __ARGS((exarg_T *eap)); +static void ex_nohlsearch(exarg_T *eap); +static void ex_match(exarg_T *eap); #else # define ex_nohlsearch ex_ni # define ex_match ex_ni #endif #ifdef FEAT_CRYPT -static void ex_X __ARGS((exarg_T *eap)); +static void ex_X(exarg_T *eap); #else # define ex_X ex_ni #endif #ifdef FEAT_FOLDING -static void ex_fold __ARGS((exarg_T *eap)); -static void ex_foldopen __ARGS((exarg_T *eap)); -static void ex_folddo __ARGS((exarg_T *eap)); +static void ex_fold(exarg_T *eap); +static void ex_foldopen(exarg_T *eap); +static void ex_folddo(exarg_T *eap); #else # define ex_fold ex_ni # define ex_foldopen ex_ni @@ -484,12 +435,16 @@ static void ex_folddo __ARGS((exarg_T *eap)); #endif #ifndef FEAT_JUMPLIST # define ex_jumps ex_ni +# define ex_clearjumps ex_ni # define ex_changes ex_ni #endif #ifndef FEAT_PROFILE # define ex_profile ex_ni #endif +#ifndef FEAT_TERMINAL +# define ex_terminal ex_ni +#endif #ifndef FEAT_GUI_MACVIM # define ex_macaction ex_ni @@ -501,40 +456,7 @@ static void ex_folddo __ARGS((exarg_T *eap)); */ #define DO_DECLARE_EXCMD #include "ex_cmds.h" - -/* - * Table used to quickly search for a command, based on its first character. - */ -static cmdidx_T cmdidxs[27] = -{ - CMD_append, - CMD_buffer, - CMD_change, - CMD_delete, - CMD_edit, - CMD_file, - CMD_global, - CMD_help, - CMD_insert, - CMD_join, - CMD_k, - CMD_list, - CMD_move, - CMD_next, - CMD_open, - CMD_print, - CMD_quit, - CMD_read, - CMD_substitute, - CMD_t, - CMD_undo, - CMD_vglobal, - CMD_write, - CMD_xit, - CMD_yank, - CMD_z, - CMD_bang -}; +#include "ex_cmdidxs.h" static char_u dollar_command[2] = {'$', 0}; @@ -558,13 +480,13 @@ struct loop_cookie int current_line; /* last read line from growarray */ int repeating; /* TRUE when looping a second time */ /* When "repeating" is FALSE use "getline" and "cookie" to get lines */ - char_u *(*getline) __ARGS((int, void *, int)); + char_u *(*getline)(int, void *, int); void *cookie; }; -static char_u *get_loop_line __ARGS((int c, void *cookie, int indent)); -static int store_loop_line __ARGS((garray_T *gap, char_u *line)); -static void free_cmdlines __ARGS((garray_T *gap)); +static char_u *get_loop_line(int c, void *cookie, int indent); +static int store_loop_line(garray_T *gap, char_u *line); +static void free_cmdlines(garray_T *gap); /* Struct to save a few things while debugging. Used in do_cmdline() only. */ struct dbg_stuff @@ -582,12 +504,11 @@ struct dbg_stuff except_T *current_exception; }; -static void save_dbg_stuff __ARGS((struct dbg_stuff *dsp)); -static void restore_dbg_stuff __ARGS((struct dbg_stuff *dsp)); +static void save_dbg_stuff(struct dbg_stuff *dsp); +static void restore_dbg_stuff(struct dbg_stuff *dsp); static void -save_dbg_stuff(dsp) - struct dbg_stuff *dsp; +save_dbg_stuff(struct dbg_stuff *dsp) { dsp->trylevel = trylevel; trylevel = 0; dsp->force_abort = force_abort; force_abort = FALSE; @@ -605,8 +526,7 @@ save_dbg_stuff(dsp) } static void -restore_dbg_stuff(dsp) - struct dbg_stuff *dsp; +restore_dbg_stuff(struct dbg_stuff *dsp) { suppress_errthrow = FALSE; trylevel = dsp->trylevel; @@ -623,19 +543,18 @@ restore_dbg_stuff(dsp) } #endif - /* * do_exmode(): Repeatedly get commands for the "Ex" mode, until the ":vi" * command is given. */ void -do_exmode(improved) - int improved; /* TRUE for "improved Ex" mode */ +do_exmode( + int improved) /* TRUE for "improved Ex" mode */ { int save_msg_scroll; int prev_msg_row; linenr_T prev_line; - int changedtick; + varnumber_T changedtick; if (improved) exmode_active = EXMODE_VIM; @@ -655,31 +574,23 @@ do_exmode(improved) /* Ignore scrollbar and mouse events in Ex mode */ ++hold_gui_events; #endif -#ifdef FEAT_SNIFF - want_sniff_request = 0; /* No K_SNIFF wanted */ -#endif MSG(_("Entering Ex mode. Type \"visual\" to go to Normal mode.")); while (exmode_active) { -#ifdef FEAT_EX_EXTRA /* Check for a ":normal" command and no more characters left. */ if (ex_normal_busy > 0 && typebuf.tb_len == 0) { exmode_active = FALSE; break; } -#endif msg_scroll = TRUE; need_wait_return = FALSE; ex_pressedreturn = FALSE; ex_no_reprint = FALSE; - changedtick = curbuf->b_changedtick; + changedtick = CHANGEDTICK(curbuf); prev_msg_row = msg_row; prev_line = curwin->w_cursor.lnum; -#ifdef FEAT_SNIFF - ProcessSniffRequests(); -#endif if (improved) { cmdline_row = msg_row; @@ -690,7 +601,7 @@ do_exmode(improved) lines_left = Rows - 1; if ((prev_line != curwin->w_cursor.lnum - || changedtick != curbuf->b_changedtick) && !ex_no_reprint) + || changedtick != CHANGEDTICK(curbuf)) && !ex_no_reprint) { if (curbuf->b_ml.ml_flags & ML_EMPTY) EMSG(_(e_emptybuf)); @@ -732,8 +643,7 @@ do_exmode(improved) * Execute a simple command line. Used for translated commands like "*". */ int -do_cmdline_cmd(cmd) - char_u *cmd; +do_cmdline_cmd(char_u *cmd) { return do_cmdline(cmd, NULL, NULL, DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); @@ -759,11 +669,11 @@ do_cmdline_cmd(cmd) * return FAIL if cmdline could not be executed, OK otherwise */ int -do_cmdline(cmdline, fgetline, cookie, flags) - char_u *cmdline; - char_u *(*fgetline) __ARGS((int, void *, int)); - void *cookie; /* argument for fgetline() */ - int flags; +do_cmdline( + char_u *cmdline, + char_u *(*fgetline)(int, void *, int), + void *cookie, /* argument for fgetline() */ + int flags) { char_u *next_cmdline; /* next cmd to execute */ char_u *cmdline_copy = NULL; /* copy of cmd line */ @@ -786,7 +696,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) struct msglist *private_msg_list; /* "fgetline" and "cookie" passed to do_one_cmd() */ - char_u *(*cmd_getline) __ARGS((int, void *, int)); + char_u *(*cmd_getline)(int, void *, int); void *cmd_cookie; struct loop_cookie cmd_loop_cookie; void *real_cookie; @@ -810,8 +720,13 @@ do_cmdline(cmdline, fgetline, cookie, flags) #endif /* It's possible to create an endless loop with ":execute", catch that - * here. The value of 200 allows nested function calls, ":source", etc. */ - if (call_depth == 200) + * here. The value of 200 allows nested function calls, ":source", etc. + * Allow 200 or 'maxfuncdepth', whatever is larger. */ + if (call_depth >= 200 +#ifdef FEAT_EVAL + && call_depth >= p_mfd +#endif + ) { EMSG(_("E169: Command too recursive")); #ifdef FEAT_EVAL @@ -871,7 +786,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) if (flags & DOCMD_EXCRESET) save_dbg_stuff(&debug_saved); else - vim_memset(&debug_saved, 0, 1); + vim_memset(&debug_saved, 0, sizeof(debug_saved)); initial_trylevel = trylevel; @@ -930,8 +845,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) { /* Each '|' separated command is stored separately in lines_ga, to * be able to jump to it. Don't use next_cmdline now. */ - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); /* Check if a function has returned or, unless it has an unclosed * try conditional, aborted. */ @@ -1146,8 +1060,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) if (next_cmdline == NULL) { - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); #ifdef FEAT_CMDHIST /* * If the command was typed, remember it for the ':' register. @@ -1238,6 +1151,13 @@ do_cmdline(cmdline, fgetline, cookie, flags) } } + /* Check for the next breakpoint after a watchexpression */ + if (breakpoint != NULL && has_watchexpr()) + { + *breakpoint = dbg_find_breakpoint(FALSE, fname, sourcing_lnum); + *dbg_tick = debug_tick; + } + /* * When not inside any ":while" loop, clear remembered lines. */ @@ -1411,8 +1331,6 @@ do_cmdline(cmdline, fgetline, cookie, flags) break; case ET_INTERRUPT: break; - default: - p = vim_strsave((char_u *)_(e_internal)); } saved_sourcing_name = sourcing_name; @@ -1558,10 +1476,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) * Obtain a line when inside a ":while" or ":for" loop. */ static char_u * -get_loop_line(c, cookie, indent) - int c; - void *cookie; - int indent; +get_loop_line(int c, void *cookie, int indent) { struct loop_cookie *cp = (struct loop_cookie *)cookie; wcmd_T *wp; @@ -1594,9 +1509,7 @@ get_loop_line(c, cookie, indent) * Store a line in "gap" so that a ":while" loop can execute it again. */ static int -store_loop_line(gap, line) - garray_T *gap; - char_u *line; +store_loop_line(garray_T *gap, char_u *line) { if (ga_grow(gap, 1) == FAIL) return FAIL; @@ -1610,8 +1523,7 @@ store_loop_line(gap, line) * Free the lines stored for a ":while" or ":for" loop. */ static void -free_cmdlines(gap) - garray_T *gap; +free_cmdlines(garray_T *gap) { while (gap->ga_len > 0) { @@ -1626,13 +1538,13 @@ free_cmdlines(gap) * "func". * Otherwise return TRUE when "fgetline" equals "func". */ int -getline_equal(fgetline, cookie, func) - char_u *(*fgetline) __ARGS((int, void *, int)); - void *cookie UNUSED; /* argument for fgetline() */ - char_u *(*func) __ARGS((int, void *, int)); +getline_equal( + char_u *(*fgetline)(int, void *, int), + void *cookie UNUSED, /* argument for fgetline() */ + char_u *(*func)(int, void *, int)) { #ifdef FEAT_EVAL - char_u *(*gp) __ARGS((int, void *, int)); + char_u *(*gp)(int, void *, int); struct loop_cookie *cp; /* When "fgetline" is "get_loop_line()" use the "cookie" to find the @@ -1657,12 +1569,12 @@ getline_equal(fgetline, cookie, func) * getline function. Otherwise return "cookie". */ void * -getline_cookie(fgetline, cookie) - char_u *(*fgetline) __ARGS((int, void *, int)) UNUSED; - void *cookie; /* argument for fgetline() */ +getline_cookie( + char_u *(*fgetline)(int, void *, int) UNUSED, + void *cookie) /* argument for fgetline() */ { # ifdef FEAT_EVAL - char_u *(*gp) __ARGS((int, void *, int)); + char_u *(*gp)(int, void *, int); struct loop_cookie *cp; /* When "fgetline" is "get_loop_line()" use the "cookie" to find the @@ -1682,6 +1594,89 @@ getline_cookie(fgetline, cookie) } #endif + +/* + * Helper function to apply an offset for buffer commands, i.e. ":bdelete", + * ":bwipeout", etc. + * Returns the buffer number. + */ + static int +compute_buffer_local_count(int addr_type, int lnum, int offset) +{ + buf_T *buf; + buf_T *nextbuf; + int count = offset; + + buf = firstbuf; + while (buf->b_next != NULL && buf->b_fnum < lnum) + buf = buf->b_next; + while (count != 0) + { + count += (offset < 0) ? 1 : -1; + nextbuf = (offset < 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) + break; + buf = nextbuf; + if (addr_type == ADDR_LOADED_BUFFERS) + /* skip over unloaded buffers */ + while (buf->b_ml.ml_mfp == NULL) + { + nextbuf = (offset < 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) + break; + buf = nextbuf; + } + } + /* we might have gone too far, last buffer is not loadedd */ + if (addr_type == ADDR_LOADED_BUFFERS) + while (buf->b_ml.ml_mfp == NULL) + { + nextbuf = (offset >= 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) + break; + buf = nextbuf; + } + return buf->b_fnum; +} + +static int current_win_nr(win_T *win); +static int current_tab_nr(tabpage_T *tab); + + static int +current_win_nr(win_T *win) +{ + win_T *wp; + int nr = 0; + + FOR_ALL_WINDOWS(wp) + { + ++nr; + if (wp == win) + break; + } + return nr; +} + + static int +current_tab_nr(tabpage_T *tab) +{ + tabpage_T *tp; + int nr = 0; + + FOR_ALL_TABPAGES(tp) + { + ++nr; + if (tp == tab) + break; + } + return nr; +} + +# define CURRENT_WIN_NR current_win_nr(curwin) +# define LAST_WIN_NR current_win_nr(NULL) +# define CURRENT_TAB_NR current_tab_nr(curtab) +# define LAST_TAB_NR current_tab_nr(NULL) + /* * Execute one Ex command. * @@ -1689,10 +1684,11 @@ getline_cookie(fgetline, cookie) * * 1. skip comment lines and leading space * 2. handle command modifiers - * 3. parse range - * 4. parse command - * 5. parse arguments - * 6. switch on command name + * 3. find the command + * 4. parse range + * 5. Parse the command. + * 6. parse arguments + * 7. switch on command name * * Note: "fgetline" can be NULL. * @@ -1705,23 +1701,20 @@ getline_cookie(fgetline, cookie) #pragma optimize( "g", off ) #endif static char_u * -do_one_cmd(cmdlinep, sourcing, -#ifdef FEAT_EVAL - cstack, -#endif - fgetline, cookie) - char_u **cmdlinep; - int sourcing; +do_one_cmd( + char_u **cmdlinep, + int sourcing, #ifdef FEAT_EVAL - struct condstack *cstack; + struct condstack *cstack, #endif - char_u *(*fgetline) __ARGS((int, void *, int)); - void *cookie; /* argument for fgetline() */ + char_u *(*fgetline)(int, void *, int), + void *cookie) /* argument for fgetline() */ { char_u *p; linenr_T lnum; long n; char_u *errormsg = NULL; /* error message */ + char_u *after_modifier = NULL; exarg_T ea; /* Ex command arguments */ long verbose_save = -1; int save_msg_scroll = msg_scroll; @@ -1732,6 +1725,8 @@ do_one_cmd(cmdlinep, sourcing, #endif cmdmod_T save_cmdmod; int ni; /* set when Not Implemented */ + char_u *cmd; + int address_count = 1; vim_memset(&ea, 0, sizeof(ea)); ea.line1 = 1; @@ -1746,11 +1741,8 @@ do_one_cmd(cmdlinep, sourcing, /* avoid that a function call in 'statusline' does this */ && !getline_equal(fgetline, cookie, get_func_line) #endif -#ifdef FEAT_AUTOCMD /* avoid that an autocommand, e.g. QuitPre, does this */ - && !getline_equal(fgetline, cookie, getnextac) -#endif - ) + && !getline_equal(fgetline, cookie, getnextac)) --quitmore; /* @@ -1771,7 +1763,7 @@ do_one_cmd(cmdlinep, sourcing, for (;;) { /* - * 1. skip comment lines and leading white space and colons + * 1. Skip comment lines and leading white space and colons. */ while (*ea.cmd == ' ' || *ea.cmd == '\t' || *ea.cmd == ':') ++ea.cmd; @@ -1796,26 +1788,20 @@ do_one_cmd(cmdlinep, sourcing, } /* - * 2. handle command modifiers. + * 2. Handle command modifiers. */ - p = ea.cmd; - if (VIM_ISDIGIT(*ea.cmd)) - p = skipwhite(skipdigits(ea.cmd)); + p = skip_range(ea.cmd, NULL); switch (*p) { /* When adding an entry, also modify cmd_exists(). */ case 'a': if (!checkforcmd(&ea.cmd, "aboveleft", 3)) break; -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_ABOVE; -#endif continue; case 'b': if (checkforcmd(&ea.cmd, "belowright", 3)) { -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_BELOW; -#endif continue; } if (checkforcmd(&ea.cmd, "browse", 3)) @@ -1827,9 +1813,7 @@ do_one_cmd(cmdlinep, sourcing, } if (!checkforcmd(&ea.cmd, "botright", 2)) break; -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_BOT; -#endif continue; case 'c': if (!checkforcmd(&ea.cmd, "confirm", 4)) @@ -1859,6 +1843,31 @@ do_one_cmd(cmdlinep, sourcing, cmdmod.keepjumps = TRUE; continue; + case 'f': /* only accept ":filter {pat} cmd" */ + { + char_u *reg_pat; + + if (!checkforcmd(&p, "filter", 4) + || *p == NUL || ends_excmd(*p)) + break; + if (*p == '!') + { + cmdmod.filter_force = TRUE; + p = skipwhite(p + 1); + if (*p == NUL || ends_excmd(*p)) + break; + } + p = skip_vimgrep_pat(p, ®_pat, NULL); + if (p == NULL || *p == NUL) + break; + cmdmod.filter_regmatch.regprog = + vim_regcomp(reg_pat, RE_MAGIC); + if (cmdmod.filter_regmatch.regprog == NULL) + break; + ea.cmd = p; + continue; + } + /* ":hide" and ":hide | cmd" are not modifiers */ case 'h': if (p != ea.cmd || !checkforcmd(&p, "hide", 3) || *p == NUL || ends_excmd(*p)) @@ -1875,14 +1884,11 @@ do_one_cmd(cmdlinep, sourcing, if (!checkforcmd(&ea.cmd, "leftabove", 5)) break; -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_ABOVE; -#endif continue; case 'n': if (checkforcmd(&ea.cmd, "noautocmd", 3)) { -#ifdef FEAT_AUTOCMD if (cmdmod.save_ei == NULL) { /* Set 'eventignore' to "all". Restore the @@ -1891,19 +1897,16 @@ do_one_cmd(cmdlinep, sourcing, set_string_option_direct((char_u *)"ei", -1, (char_u *)"all", OPT_FREE, SID_NONE); } -#endif continue; } - if (!checkforcmd(&ea.cmd, "noswapfile", 6)) + if (!checkforcmd(&ea.cmd, "noswapfile", 3)) break; cmdmod.noswapfile = TRUE; continue; case 'r': if (!checkforcmd(&ea.cmd, "rightbelow", 6)) break; -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_BELOW; -#endif continue; case 's': if (checkforcmd(&ea.cmd, "sandbox", 3)) @@ -1920,7 +1923,7 @@ do_one_cmd(cmdlinep, sourcing, if (save_msg_silent == -1) save_msg_silent = msg_silent; ++msg_silent; - if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1])) + if (*ea.cmd == '!' && !VIM_ISWHITE(ea.cmd[-1])) { /* ":silent!", but not "silent !cmd" */ ea.cmd = skipwhite(ea.cmd + 1); @@ -1931,20 +1934,25 @@ do_one_cmd(cmdlinep, sourcing, case 't': if (checkforcmd(&p, "tab", 3)) { -#ifdef FEAT_WINDOWS - if (vim_isdigit(*ea.cmd)) - cmdmod.tab = atoi((char *)ea.cmd) + 1; - else + long tabnr = get_address(&ea, &ea.cmd, ADDR_TABS, + ea.skip, FALSE, 1); + if (tabnr == MAXLNUM) cmdmod.tab = tabpage_index(curtab) + 1; + else + { + if (tabnr < 0 || tabnr > LAST_TAB_NR) + { + errormsg = (char_u *)_(e_invrange); + goto doend; + } + cmdmod.tab = tabnr + 1; + } ea.cmd = p; -#endif continue; } if (!checkforcmd(&ea.cmd, "topleft", 2)) break; -#ifdef FEAT_WINDOWS cmdmod.split |= WSP_TOP; -#endif continue; case 'u': if (!checkforcmd(&ea.cmd, "unsilent", 3)) @@ -1956,9 +1964,7 @@ do_one_cmd(cmdlinep, sourcing, case 'v': if (checkforcmd(&ea.cmd, "vertical", 4)) { -#ifdef FEAT_VERTSPLIT cmdmod.split |= WSP_VERT; -#endif continue; } if (!checkforcmd(&p, "verbose", 4)) @@ -1974,6 +1980,7 @@ do_one_cmd(cmdlinep, sourcing, } break; } + after_modifier = ea.cmd; #ifdef FEAT_EVAL ea.skip = did_emsg || got_int || did_throw || (cstack->cs_idx >= 0 @@ -2005,7 +2012,18 @@ do_one_cmd(cmdlinep, sourcing, #endif /* - * 3. parse a range specifier of the form: addr [,addr] [;addr] .. + * 3. Skip over the range to find the command. Let "p" point to after it. + * + * We need the command to know what kind of range it uses. + */ + cmd = ea.cmd; + ea.cmd = skip_range(ea.cmd, NULL); + if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) + ea.cmd = skipwhite(ea.cmd + 1); + p = find_command(&ea, NULL); + +/* + * 4. parse a range specifier of the form: addr [,addr] [;addr] .. * * where 'addr' is: * @@ -2021,13 +2039,57 @@ do_one_cmd(cmdlinep, sourcing, * is equal to the lower. */ + /* ea.addr_type for user commands is set by find_ucmd */ + if (!IS_USER_CMDIDX(ea.cmdidx)) + { + if (ea.cmdidx != CMD_SIZE) + ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; + else + ea.addr_type = ADDR_LINES; + + /* :wincmd range depends on the argument. */ + if (ea.cmdidx == CMD_wincmd && p != NULL) + get_wincmd_addr_type(skipwhite(p), &ea); + } + /* repeat for all ',' or ';' separated addresses */ + ea.cmd = cmd; for (;;) { ea.line1 = ea.line2; - ea.line2 = curwin->w_cursor.lnum; /* default is current line number */ + switch (ea.addr_type) + { + case ADDR_LINES: + /* default is current line number */ + ea.line2 = curwin->w_cursor.lnum; + break; + case ADDR_WINDOWS: + ea.line2 = CURRENT_WIN_NR; + break; + case ADDR_ARGUMENTS: + ea.line2 = curwin->w_arg_idx + 1; + if (ea.line2 > ARGCOUNT) + ea.line2 = ARGCOUNT; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_BUFFERS: + ea.line2 = curbuf->b_fnum; + break; + case ADDR_TABS: + ea.line2 = CURRENT_TAB_NR; + break; + case ADDR_TABS_RELATIVE: + ea.line2 = 1; + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + ea.line2 = qf_get_cur_valid_idx(&ea); + break; +#endif + } ea.cmd = skipwhite(ea.cmd); - lnum = get_address(&ea.cmd, ea.skip, ea.addr_count == 0); + lnum = get_address(&ea, &ea.cmd, ea.addr_type, ea.skip, + ea.addr_count == 0, address_count++); if (ea.cmd == NULL) /* error detected */ goto doend; if (lnum == MAXLNUM) @@ -2035,8 +2097,69 @@ do_one_cmd(cmdlinep, sourcing, if (*ea.cmd == '%') /* '%' - all lines */ { ++ea.cmd; - ea.line1 = 1; - ea.line2 = curbuf->b_ml.ml_line_count; + switch (ea.addr_type) + { + case ADDR_LINES: + ea.line1 = 1; + ea.line2 = curbuf->b_ml.ml_line_count; + break; + case ADDR_LOADED_BUFFERS: + { + buf_T *buf = firstbuf; + + while (buf->b_next != NULL + && buf->b_ml.ml_mfp == NULL) + buf = buf->b_next; + ea.line1 = buf->b_fnum; + buf = lastbuf; + while (buf->b_prev != NULL + && buf->b_ml.ml_mfp == NULL) + buf = buf->b_prev; + ea.line2 = buf->b_fnum; + break; + } + case ADDR_BUFFERS: + ea.line1 = firstbuf->b_fnum; + ea.line2 = lastbuf->b_fnum; + break; + case ADDR_WINDOWS: + case ADDR_TABS: + if (IS_USER_CMDIDX(ea.cmdidx)) + { + ea.line1 = 1; + ea.line2 = ea.addr_type == ADDR_WINDOWS + ? LAST_WIN_NR : LAST_TAB_NR; + } + else + { + /* there is no Vim command which uses '%' and + * ADDR_WINDOWS or ADDR_TABS */ + errormsg = (char_u *)_(e_invrange); + goto doend; + } + break; + case ADDR_TABS_RELATIVE: + errormsg = (char_u *)_(e_invrange); + goto doend; + break; + case ADDR_ARGUMENTS: + if (ARGCOUNT == 0) + ea.line1 = ea.line2 = 0; + else + { + ea.line1 = 1; + ea.line2 = ARGCOUNT; + } + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + ea.line1 = 1; + ea.line2 = qf_get_size(&ea); + if (ea.line2 == 0) + ea.line2 = 1; + break; +#endif + } ++ea.addr_count; } /* '*' - visual area */ @@ -2044,6 +2167,12 @@ do_one_cmd(cmdlinep, sourcing, { pos_T *fp; + if (ea.addr_type != ADDR_LINES) + { + errormsg = (char_u *)_(e_invrange); + goto doend; + } + ++ea.cmd; if (!ea.skip) { @@ -2066,7 +2195,11 @@ do_one_cmd(cmdlinep, sourcing, if (*ea.cmd == ';') { if (!ea.skip) + { curwin->w_cursor.lnum = ea.line2; + /* don't leave the cursor on an illegal line or column */ + check_cursor(); + } } else if (*ea.cmd != ',') break; @@ -2082,11 +2215,8 @@ do_one_cmd(cmdlinep, sourcing, ea.addr_count = 0; } - /* Don't leave the cursor on an illegal line (caused by ';') */ - check_cursor_lnum(); - /* - * 4. parse command + * 5. Parse the command. */ /* @@ -2100,8 +2230,8 @@ do_one_cmd(cmdlinep, sourcing, * If we got a line, but no command, then go to the line. * If we find a '|' or '\n' we set ea.nextcmd. */ - if (*ea.cmd == NUL || *ea.cmd == '"' || - (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) + if (*ea.cmd == NUL || *ea.cmd == '"' + || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) { /* * strange vi behaviour: @@ -2147,8 +2277,28 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } - /* Find the command and let "p" point to after it. */ - p = find_command(&ea, NULL); + /* If this looks like an undefined user command and there are CmdUndefined + * autocommands defined, trigger the matching autocommands. */ + if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip + && ASCII_ISUPPER(*ea.cmd) + && has_cmdundefined()) + { + int ret; + + p = ea.cmd; + while (ASCII_ISALNUM(*p)) + ++p; + p = vim_strnsave(ea.cmd, (int)(p - ea.cmd)); + ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); + vim_free(p); + /* If the autocommands did something and didn't cause an error, try + * finding the command again. */ + p = (ret +#ifdef FEAT_EVAL + && !aborting() +#endif + ) ? find_command(&ea, NULL) : ea.cmd; + } #ifdef FEAT_USR_CMDS if (p == NULL) @@ -2158,7 +2308,8 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } /* Check for wrong commands. */ - if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78) + if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78 + && !IS_USER_CMDIDX(ea.cmdidx)) { errormsg = uc_fun_cmd(); goto doend; @@ -2170,18 +2321,22 @@ do_one_cmd(cmdlinep, sourcing, { STRCPY(IObuff, _("E492: Not an editor command")); if (!sourcing) - append_command(*cmdlinep); + { + /* If the modifier was parsed OK the error must be in the + * following command */ + if (after_modifier != NULL) + append_command(after_modifier); + else + append_command(*cmdlinep); + } errormsg = IObuff; did_emsg_syntax = TRUE; } goto doend; } - ni = ( -#ifdef FEAT_USR_CMDS - !USER_CMDIDX(ea.cmdidx) && -#endif - (cmdnames[ea.cmdidx].cmd_func == ex_ni + ni = (!IS_USER_CMDIDX(ea.cmdidx) + && (cmdnames[ea.cmdidx].cmd_func == ex_ni #ifdef HAVE_EX_SCRIPT_NI || cmdnames[ea.cmdidx].cmd_func == ex_script_ni #endif @@ -2214,11 +2369,9 @@ do_one_cmd(cmdlinep, sourcing, ea.forceit = FALSE; /* - * 5. parse arguments + * 6. Parse arguments. */ -#ifdef FEAT_USR_CMDS - if (!USER_CMDIDX(ea.cmdidx)) -#endif + if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; if (!ea.skip) @@ -2239,33 +2392,21 @@ do_one_cmd(cmdlinep, sourcing, } if (text_locked() && !(ea.argt & CMDWIN) -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) + && !IS_USER_CMDIDX(ea.cmdidx)) { /* Command not allowed when editing the command line. */ -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) - errormsg = (char_u *)_(e_cmdwin); - else -#endif - errormsg = (char_u *)_(e_secure); + errormsg = (char_u *)_(get_text_locked_msg()); goto doend; } -#ifdef FEAT_AUTOCMD /* Disallow editing another buffer when "curbuf_lock" is set. * Do allow ":edit" (check for argument later). * Do allow ":checktime" (it's postponed). */ if (!(ea.argt & CMDWIN) && ea.cmdidx != CMD_edit && ea.cmdidx != CMD_checktime -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif + && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; -#endif if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { @@ -2319,7 +2460,8 @@ do_one_cmd(cmdlinep, sourcing, correct_range(&ea); #ifdef FEAT_FOLDING - if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy) + if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy + && ea.addr_type == ADDR_LINES) { /* Put the first line at the start of a closed fold, put the last line * at the end of a closed fold. */ @@ -2423,6 +2565,7 @@ do_one_cmd(cmdlinep, sourcing, * Any others? */ else if (ea.cmdidx == CMD_bang + || ea.cmdidx == CMD_terminal || ea.cmdidx == CMD_global || ea.cmdidx == CMD_vglobal || ea.usefilter) @@ -2448,17 +2591,58 @@ do_one_cmd(cmdlinep, sourcing, if ((ea.argt & DFLALL) && ea.addr_count == 0) { + buf_T *buf; + ea.line1 = 1; - ea.line2 = curbuf->b_ml.ml_line_count; + switch (ea.addr_type) + { + case ADDR_LINES: + ea.line2 = curbuf->b_ml.ml_line_count; + break; + case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_next; + ea.line1 = buf->b_fnum; + buf = lastbuf; + while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_prev; + ea.line2 = buf->b_fnum; + break; + case ADDR_BUFFERS: + ea.line1 = firstbuf->b_fnum; + ea.line2 = lastbuf->b_fnum; + break; + case ADDR_WINDOWS: + ea.line2 = LAST_WIN_NR; + break; + case ADDR_TABS: + ea.line2 = LAST_TAB_NR; + break; + case ADDR_TABS_RELATIVE: + ea.line2 = 1; + break; + case ADDR_ARGUMENTS: + if (ARGCOUNT == 0) + ea.line1 = ea.line2 = 0; + else + ea.line2 = ARGCOUNT; + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + ea.line2 = qf_get_size(&ea); + if (ea.line2 == 0) + ea.line2 = 1; + break; +#endif + } } /* accept numbered register only when no count allowed (:put) */ if ( (ea.argt & REGSTR) && *ea.arg != NUL -#ifdef FEAT_USR_CMDS - /* Do not allow register = for user commands */ - && (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') -#endif + /* Do not allow register = for user commands */ + && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) { #ifndef FEAT_CLIPBOARD @@ -2469,14 +2653,8 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } #endif - if ( -#ifdef FEAT_USR_CMDS - valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put - && USER_CMDIDX(ea.cmdidx))) -#else - valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put) -#endif - ) + if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put + && !IS_USER_CMDIDX(ea.cmdidx)))) { ea.regname = *ea.arg++; #ifdef FEAT_EVAL @@ -2497,7 +2675,7 @@ do_one_cmd(cmdlinep, sourcing, */ if ((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg) && (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL - || vim_iswhite(*p))) + || VIM_ISWHITE(*p))) { n = getdigits(&ea.arg); ea.arg = skipwhite(ea.arg); @@ -2520,7 +2698,8 @@ do_one_cmd(cmdlinep, sourcing, /* * Be vi compatible: no error message for out of range. */ - if (ea.line2 > curbuf->b_ml.ml_line_count) + if (ea.addr_type == ADDR_LINES + && ea.line2 > curbuf->b_ml.ml_line_count) ea.line2 = curbuf->b_ml.ml_line_count; } } @@ -2591,6 +2770,7 @@ do_one_cmd(cmdlinep, sourcing, case CMD_echomsg: case CMD_echon: case CMD_execute: + case CMD_filter: case CMD_help: case CMD_hide: case CMD_ijump: @@ -2644,16 +2824,12 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } -#ifdef FEAT_LISTCMDS /* * Accept buffer name. Cannot be used at the same time with a buffer * number. Don't do this for a user command. */ if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0 -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) + && !IS_USER_CMDIDX(ea.cmdidx)) { /* * :bdelete, :bwipeout and :bunload take several arguments, separated @@ -2666,7 +2842,7 @@ do_one_cmd(cmdlinep, sourcing, else { p = ea.arg + STRLEN(ea.arg); - while (p > ea.arg && vim_iswhite(p[-1])) + while (p > ea.arg && VIM_ISWHITE(p[-1])) --p; } ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & BUFUNL) != 0, @@ -2676,10 +2852,19 @@ do_one_cmd(cmdlinep, sourcing, ea.addr_count = 1; ea.arg = skipwhite(p); } -#endif + + /* The :try command saves the emsg_silent flag, reset it here when + * ":silent! try" was used, it should only apply to :try itself. */ + if (ea.cmdidx == CMD_try && did_esilent > 0) + { + emsg_silent -= did_esilent; + if (emsg_silent < 0) + emsg_silent = 0; + did_esilent = 0; + } /* - * 6. switch on command name + * 7. Execute the command. * * The "ea" structure holds the arguments that can be used. */ @@ -2691,7 +2876,7 @@ do_one_cmd(cmdlinep, sourcing, #endif #ifdef FEAT_USR_CMDS - if (USER_CMDIDX(ea.cmdidx)) + if (IS_USER_CMDIDX(ea.cmdidx)) { /* * Execute a user-defined command. @@ -2733,7 +2918,10 @@ do_one_cmd(cmdlinep, sourcing, doend: if (curwin->w_cursor.lnum == 0) /* can happen with zero line number */ + { curwin->w_cursor.lnum = 1; + curwin->w_cursor.col = 0; + } if (errormsg != NULL && *errormsg != NUL && !did_emsg) { @@ -2750,16 +2938,13 @@ do_one_cmd(cmdlinep, sourcing, } #ifdef FEAT_EVAL do_errthrow(cstack, - (ea.cmdidx != CMD_SIZE -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); + (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) + ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); #endif if (verbose_save >= 0) p_verbose = verbose_save; -#ifdef FEAT_AUTOCMD + if (cmdmod.save_ei != NULL) { /* Restore 'eventignore' to the value before ":noautocmd". */ @@ -2767,7 +2952,9 @@ do_one_cmd(cmdlinep, sourcing, OPT_FREE, SID_NONE); free_string_option(cmdmod.save_ei); } -#endif + + if (cmdmod.filter_regmatch.regprog != NULL) + vim_regfree(cmdmod.filter_regmatch.regprog); cmdmod = save_cmdmod; @@ -2813,10 +3000,10 @@ do_one_cmd(cmdlinep, sourcing, * If there is a match advance "pp" to the argument and return TRUE. */ int -checkforcmd(pp, cmd, len) - char_u **pp; /* start of command */ - char *cmd; /* name of command */ - int len; /* required length */ +checkforcmd( + char_u **pp, /* start of command */ + char *cmd, /* name of command */ + int len) /* required length */ { int i; @@ -2837,8 +3024,7 @@ checkforcmd(pp, cmd, len) * invisible otherwise. */ static void -append_command(cmd) - char_u *cmd; +append_command(char_u *cmd) { char_u *s = cmd; char_u *d; @@ -2875,9 +3061,7 @@ append_command(cmd) * Returns NULL for an ambiguous user command. */ static char_u * -find_command(eap, full) - exarg_T *eap; - int *full UNUSED; +find_command(exarg_T *eap, int *full UNUSED) { int len; char_u *p; @@ -2888,7 +3072,7 @@ find_command(eap, full) * Exceptions: * - the 'k' command can directly be followed by any character. * - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r' - * but :sre[wind] is another command, as are :scrip[tnames], + * but :sre[wind] is another command, as are :scr[iptnames], * :scs[cope], :sim[alt], :sig[ns] and :sil[ent]. * - the "d" command can directly be followed by 'l' or 'p' flag. */ @@ -2899,8 +3083,8 @@ find_command(eap, full) ++p; } else if (p[0] == 's' - && ((p[1] == 'c' && p[2] != 's' && p[2] != 'r' - && p[3] != 'i' && p[4] != 'p') + && ((p[1] == 'c' && (p[2] == NUL || (p[2] != 's' && p[2] != 'r' + && (p[3] == NUL || (p[3] != 'i' && p[4] != 'p'))))) || p[1] == 'g' || (p[1] == 'i' && p[2] != 'm' && p[2] != 'l' && p[2] != 'g') || p[1] == 'I' @@ -2939,10 +3123,25 @@ find_command(eap, full) } } - if (ASCII_ISLOWER(*eap->cmd)) - eap->cmdidx = cmdidxs[CharOrdLow(*eap->cmd)]; + if (ASCII_ISLOWER(eap->cmd[0])) + { + int c1 = eap->cmd[0]; + int c2 = eap->cmd[1]; + + if (command_count != (int)CMD_SIZE) + { + iemsg((char_u *)_("E943: Command table needs to be updated, run 'make cmdidxs'")); + getout(1); + } + + /* Use a precomputed index for fast look-up in cmdnames[] + * taking into account the first 2 letters of eap->cmd. */ + eap->cmdidx = cmdidxs1[CharOrdLow(c1)]; + if (ASCII_ISLOWER(c2)) + eap->cmdidx += cmdidxs2[CharOrdLow(c1)][CharOrdLow(c2)]; + } else - eap->cmdidx = cmdidxs[26]; + eap->cmdidx = CMD_bang; for ( ; (int)eap->cmdidx < (int)CMD_SIZE; eap->cmdidx = (cmdidx_T)((int)eap->cmdidx + 1)) @@ -2984,12 +3183,12 @@ find_command(eap, full) * Return NULL if there is no matching command. */ static char_u * -find_ucmd(eap, p, full, xp, compl) - exarg_T *eap; - char_u *p; /* end of the command (possibly including count) */ - int *full; /* set to TRUE for a full match */ - expand_T *xp; /* used for completion, NULL otherwise */ - int *compl; /* completion flags or NULL */ +find_ucmd( + exarg_T *eap, + char_u *p, /* end of the command (possibly including count) */ + int *full, /* set to TRUE for a full match */ + expand_T *xp, /* used for completion, NULL otherwise */ + int *compl) /* completion flags or NULL */ { int len = (int)(p - eap->cmd); int j, k, matchlen = 0; @@ -3044,6 +3243,7 @@ find_ucmd(eap, p, full, xp, compl) eap->cmdidx = CMD_USER_BUF; eap->argt = (long)uc->uc_argt; eap->useridx = j; + eap->addr_type = uc->uc_addr_type; # ifdef FEAT_CMDL_COMPL if (compl != NULL) @@ -3104,6 +3304,7 @@ static struct cmdmod {"botright", 2, FALSE}, {"browse", 3, FALSE}, {"confirm", 4, FALSE}, + {"filter", 4, FALSE}, {"hide", 3, FALSE}, {"keepalt", 5, FALSE}, {"keepjumps", 5, FALSE}, @@ -3128,8 +3329,7 @@ static struct cmdmod * Return zero when it's not a modifier. */ int -modifier_len(cmd) - char_u *cmd; +modifier_len(char_u *cmd) { int i, j; char_u *p = cmd; @@ -3154,8 +3354,7 @@ modifier_len(cmd) * Return 3 if there is an ambiguous match. */ int -cmd_exists(name) - char_u *name; +cmd_exists(char_u *name) { exarg_T ea; int full = FALSE; @@ -3196,9 +3395,9 @@ cmd_exists(name) * probably won't change that much -- webb. */ char_u * -set_one_cmd_context(xp, buff) - expand_T *xp; - char_u *buff; /* buffer for command string */ +set_one_cmd_context( + expand_T *xp, + char_u *buff) /* buffer for command string */ { char_u *p; char_u *cmd, *arg; @@ -3219,7 +3418,7 @@ set_one_cmd_context(xp, buff) ea.argt = 0; /* - * 2. skip comment lines and leading space, colons or bars + * 1. skip comment lines and leading space, colons or bars */ for (cmd = buff; vim_strchr((char_u *)" \t:|", *cmd) != NULL; cmd++) ; @@ -3234,13 +3433,9 @@ set_one_cmd_context(xp, buff) } /* - * 3. parse a range specifier of the form: addr [,addr] [;addr] .. + * 3. Skip over the range to find the command. */ cmd = skip_range(cmd, &xp->xp_context); - -/* - * 4. parse command - */ xp->xp_pattern = cmd; if (*cmd == NUL) return NULL; @@ -3270,9 +3465,10 @@ set_one_cmd_context(xp, buff) p = cmd; while (ASCII_ISALPHA(*p) || *p == '*') /* Allow * wild card */ ++p; - /* check for non-alpha command */ - if (p == cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL) - ++p; + /* a user command may contain digits */ + if (ASCII_ISUPPER(cmd[0])) + while (ASCII_ISALNUM(*p) || *p == '*') + ++p; /* for python 3.x: ":py3*" commands completion */ if (cmd[0] == 'p' && cmd[1] == 'y' && p == cmd + 2 && *p == '3') { @@ -3280,6 +3476,9 @@ set_one_cmd_context(xp, buff) while (ASCII_ISALPHA(*p) || *p == '*') ++p; } + /* check for non-alpha command */ + if (p == cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL) + ++p; len = (int)(p - cmd); if (len == 0) @@ -3346,11 +3545,9 @@ set_one_cmd_context(xp, buff) } /* - * 5. parse arguments + * 6. parse arguments */ -#ifdef FEAT_USR_CMDS - if (!USER_CMDIDX(ea.cmdidx)) -#endif + if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; arg = skipwhite(p); @@ -3429,7 +3626,7 @@ set_one_cmd_context(xp, buff) return NULL; /* It's a comment */ } } - mb_ptr_adv(p); + MB_PTR_ADV(p); } } @@ -3453,7 +3650,7 @@ set_one_cmd_context(xp, buff) { if (*p == '\\' && *(p + 1) != NUL) ++p; /* skip over escaped character */ - mb_ptr_adv(p); + MB_PTR_ADV(p); } } @@ -3490,7 +3687,7 @@ set_one_cmd_context(xp, buff) } /* An argument can contain just about everything, except * characters that end the command and white space. */ - else if (c == '|' || c == '\n' || c == '"' || (vim_iswhite(c) + else if (c == '|' || c == '\n' || c == '"' || (VIM_ISWHITE(c) #ifdef SPACE_IN_FILENAME && (!(ea.argt & NOSPC) || usefilter) #endif @@ -3513,7 +3710,7 @@ set_one_cmd_context(xp, buff) else #endif len = 1; - mb_ptr_adv(p); + MB_PTR_ADV(p); } if (in_quote) bow = p; @@ -3521,7 +3718,7 @@ set_one_cmd_context(xp, buff) xp->xp_pattern = p; p -= len; } - mb_ptr_adv(p); + MB_PTR_ADV(p); } /* @@ -3533,7 +3730,7 @@ set_one_cmd_context(xp, buff) xp->xp_context = EXPAND_FILES; /* For a shell command more chars need to be escaped. */ - if (usefilter || ea.cmdidx == CMD_bang) + if (usefilter || ea.cmdidx == CMD_bang || ea.cmdidx == CMD_terminal) { #ifndef BACKSLASH_IN_FILENAME xp->xp_shell = TRUE; @@ -3545,7 +3742,7 @@ set_one_cmd_context(xp, buff) /* Check for environment variable */ if (*xp->xp_pattern == '$' -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) || *xp->xp_pattern == '%' #endif ) @@ -3584,7 +3781,7 @@ set_one_cmd_context(xp, buff) } /* - * 6. switch on command name + * 6. Switch on command name. */ switch (ea.cmdidx) { @@ -3614,6 +3811,8 @@ set_one_cmd_context(xp, buff) case CMD_botright: case CMD_browse: case CMD_bufdo: + case CMD_cdo: + case CMD_cfdo: case CMD_confirm: case CMD_debug: case CMD_folddoclosed: @@ -3623,7 +3822,9 @@ set_one_cmd_context(xp, buff) case CMD_keepjumps: case CMD_keepmarks: case CMD_keeppatterns: + case CMD_ldo: case CMD_leftabove: + case CMD_lfdo: case CMD_lockmarks: case CMD_noautocmd: case CMD_noswapfile: @@ -3638,6 +3839,16 @@ set_one_cmd_context(xp, buff) case CMD_windo: return arg; + case CMD_filter: + if (*arg != NUL) + arg = skip_vimgrep_pat(arg, NULL, NULL); + if (arg == NULL || *arg == NUL) + { + xp->xp_context = EXPAND_NOTHING; + return NULL; + } + return skipwhite(arg); + #ifdef FEAT_CMDL_COMPL # ifdef FEAT_SEARCH_EXTRA case CMD_match: @@ -3678,7 +3889,7 @@ set_one_cmd_context(xp, buff) return NULL; } - /* For the -complete and -nargs attributes, we complete + /* For the -complete, -nargs and -addr attributes, we complete * their arguments as well. */ if (STRNICMP(arg, "complete", p - arg) == 0) @@ -3693,6 +3904,12 @@ set_one_cmd_context(xp, buff) xp->xp_pattern = p + 1; return NULL; } + else if (STRNICMP(arg, "addr", p - arg) == 0) + { + xp->xp_context = EXPAND_USER_ADDR_TYPE; + xp->xp_pattern = p + 1; + return NULL; + } return NULL; } arg = skipwhite(p); @@ -3781,14 +3998,12 @@ set_one_cmd_context(xp, buff) } } break; -#ifdef FEAT_AUTOCMD + case CMD_autocmd: return set_context_in_autocmd(xp, arg, FALSE); - case CMD_doautocmd: case CMD_doautoall: return set_context_in_autocmd(xp, arg, TRUE); -#endif case CMD_set: set_context_in_set_cmd(xp, arg, 0); break; @@ -3836,18 +4051,32 @@ set_one_cmd_context(xp, buff) case CMD_echoerr: case CMD_call: case CMD_return: + case CMD_cexpr: + case CMD_caddexpr: + case CMD_cgetexpr: + case CMD_lexpr: + case CMD_laddexpr: + case CMD_lgetexpr: set_context_for_expression(xp, arg, ea.cmdidx); break; case CMD_unlet: while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; + xp->xp_context = EXPAND_USER_VARS; xp->xp_pattern = arg; - break; - case CMD_function: - case CMD_delfunction: + if (*xp->xp_pattern == '$') + { + xp->xp_context = EXPAND_ENV_VARS; + ++xp->xp_pattern; + } + + break; + + case CMD_function: + case CMD_delfunction: xp->xp_context = EXPAND_USER_FUNC; xp->xp_pattern = arg; break; @@ -3871,20 +4100,18 @@ set_one_cmd_context(xp, buff) set_context_in_sign_cmd(xp, arg); break; #endif -#ifdef FEAT_LISTCMDS case CMD_bdelete: case CMD_bwipeout: case CMD_bunload: while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case CMD_buffer: case CMD_sbuffer: case CMD_checktime: xp->xp_context = EXPAND_BUFFERS; xp->xp_pattern = arg; break; -#endif #ifdef FEAT_USR_CMDS case CMD_USER: case CMD_USER_BUF: @@ -3911,7 +4138,7 @@ set_one_cmd_context(xp, buff) arg = p + 1; else if (*p == '\\' && *(p + 1) != NUL) ++p; /* skip over escaped character */ - mb_ptr_adv(p); + MB_PTR_ADV(p); } xp->xp_pattern = arg; } @@ -3927,6 +4154,7 @@ set_one_cmd_context(xp, buff) case CMD_cmap: case CMD_cnoremap: case CMD_lmap: case CMD_lnoremap: case CMD_smap: case CMD_snoremap: + case CMD_tmap: case CMD_tnoremap: case CMD_xmap: case CMD_xnoremap: return set_context_in_map_cmd(xp, cmd, arg, forceit, FALSE, FALSE, ea.cmdidx); @@ -3938,9 +4166,24 @@ set_one_cmd_context(xp, buff) case CMD_cunmap: case CMD_lunmap: case CMD_sunmap: + case CMD_tunmap: case CMD_xunmap: return set_context_in_map_cmd(xp, cmd, arg, forceit, FALSE, TRUE, ea.cmdidx); + case CMD_mapclear: + case CMD_nmapclear: + case CMD_vmapclear: + case CMD_omapclear: + case CMD_imapclear: + case CMD_cmapclear: + case CMD_lmapclear: + case CMD_smapclear: + case CMD_tmapclear: + case CMD_xmapclear: + xp->xp_context = EXPAND_MAPCLEAR; + xp->xp_pattern = arg; + break; + case CMD_abbreviate: case CMD_noreabbrev: case CMD_cabbrev: case CMD_cnoreabbrev: case CMD_iabbrev: case CMD_inoreabbrev: @@ -3987,6 +4230,11 @@ set_one_cmd_context(xp, buff) xp->xp_pattern = arg; break; + case CMD_packadd: + xp->xp_context = EXPAND_PACKADD; + xp->xp_pattern = arg; + break; + #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) case CMD_language: @@ -4020,6 +4268,11 @@ set_one_cmd_context(xp, buff) xp->xp_pattern = arg; break; + case CMD_messages: + xp->xp_context = EXPAND_MESSAGES; + xp->xp_pattern = arg; + break; + #if defined(FEAT_CMDHIST) case CMD_history: xp->xp_context = EXPAND_HISTORY; @@ -4033,6 +4286,12 @@ set_one_cmd_context(xp, buff) break; #endif + case CMD_argdelete: + while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + arg = xp->xp_pattern + 1; + xp->xp_context = EXPAND_ARGLIST; + xp->xp_pattern = arg; + break; #ifdef FEAT_GUI_MACVIM case CMD_macaction: xp->xp_context = EXPAND_MACACTION; @@ -4058,15 +4317,22 @@ set_one_cmd_context(xp, buff) * Returns the "cmd" pointer advanced to beyond the range. */ char_u * -skip_range(cmd, ctx) - char_u *cmd; - int *ctx; /* pointer to xp_context or NULL */ +skip_range( + char_u *cmd, + int *ctx) /* pointer to xp_context or NULL */ { unsigned delim; - while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL) + while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL) { - if (*cmd == '\'') + if (*cmd == '\\') + { + if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&') + ++cmd; + else + break; + } + else if (*cmd == '\'') { if (*++cmd == NUL && ctx != NULL) *ctx = EXPAND_NOTHING; @@ -4100,10 +4366,13 @@ skip_range(cmd, ctx) * Return MAXLNUM when no Ex address was found. */ static linenr_T -get_address(ptr, skip, to_other_file) - char_u **ptr; - int skip; /* only skip the address, don't use it */ - int to_other_file; /* flag: may jump to other file */ +get_address( + exarg_T *eap UNUSED, + char_u **ptr, + int addr_type, /* flag: one of ADDR_LINES, ... */ + int skip, /* only skip the address, don't use it */ + int to_other_file, /* flag: may jump to other file */ + int address_count UNUSED) /* 1 for first address, >1 after comma */ { int c; int i; @@ -4112,6 +4381,7 @@ get_address(ptr, skip, to_other_file) pos_T pos; pos_T *fp; linenr_T lnum; + buf_T *buf; cmd = skipwhite(*ptr); lnum = MAXLNUM; @@ -4120,137 +4390,226 @@ get_address(ptr, skip, to_other_file) switch (*cmd) { case '.': /* '.' - Cursor position */ - ++cmd; + ++cmd; + switch (addr_type) + { + case ADDR_LINES: lnum = curwin->w_cursor.lnum; break; + case ADDR_WINDOWS: + lnum = CURRENT_WIN_NR; + break; + case ADDR_ARGUMENTS: + lnum = curwin->w_arg_idx + 1; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_BUFFERS: + lnum = curbuf->b_fnum; + break; + case ADDR_TABS: + lnum = CURRENT_TAB_NR; + break; + case ADDR_TABS_RELATIVE: + EMSG(_(e_invrange)); + cmd = NULL; + goto error; + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + lnum = qf_get_cur_valid_idx(eap); + break; +#endif + } + break; case '$': /* '$' - last line */ - ++cmd; + ++cmd; + switch (addr_type) + { + case ADDR_LINES: lnum = curbuf->b_ml.ml_line_count; break; + case ADDR_WINDOWS: + lnum = LAST_WIN_NR; + break; + case ADDR_ARGUMENTS: + lnum = ARGCOUNT; + break; + case ADDR_LOADED_BUFFERS: + buf = lastbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_prev == NULL) + break; + buf = buf->b_prev; + } + lnum = buf->b_fnum; + break; + case ADDR_BUFFERS: + lnum = lastbuf->b_fnum; + break; + case ADDR_TABS: + lnum = LAST_TAB_NR; + break; + case ADDR_TABS_RELATIVE: + EMSG(_(e_invrange)); + cmd = NULL; + goto error; + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + lnum = qf_get_size(eap); + if (lnum == 0) + lnum = 1; + break; +#endif + } + break; case '\'': /* ''' - mark */ - if (*++cmd == NUL) + if (*++cmd == NUL) + { + cmd = NULL; + goto error; + } + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + cmd = NULL; + goto error; + } + if (skip) + ++cmd; + else + { + /* Only accept a mark in another file when it is + * used by itself: ":'M". */ + fp = getmark(*cmd, to_other_file && cmd[1] == NUL); + ++cmd; + if (fp == (pos_T *)-1) + /* Jumped to another file. */ + lnum = curwin->w_cursor.lnum; + else + { + if (check_mark(fp) == FAIL) { cmd = NULL; goto error; } - if (skip) - ++cmd; - else - { - /* Only accept a mark in another file when it is - * used by itself: ":'M". */ - fp = getmark(*cmd, to_other_file && cmd[1] == NUL); - ++cmd; - if (fp == (pos_T *)-1) - /* Jumped to another file. */ - lnum = curwin->w_cursor.lnum; - else - { - if (check_mark(fp) == FAIL) - { - cmd = NULL; - goto error; - } - lnum = fp->lnum; - } - } - break; + lnum = fp->lnum; + } + } + break; case '/': case '?': /* '/' or '?' - search */ - c = *cmd++; - if (skip) /* skip "/pat/" */ - { - cmd = skip_regexp(cmd, c, (int)p_magic, NULL); - if (*cmd == c) - ++cmd; - } - else - { - pos = curwin->w_cursor; /* save curwin->w_cursor */ - /* - * When '/' or '?' follows another address, start - * from there. - */ - if (lnum != MAXLNUM) - curwin->w_cursor.lnum = lnum; - /* - * Start a forward search at the end of the line. - * Start a backward search at the start of the line. - * This makes sure we never match in the current - * line, and can match anywhere in the - * next/previous line. - */ - if (c == '/') - curwin->w_cursor.col = MAXCOL; - else - curwin->w_cursor.col = 0; - searchcmdlen = 0; - if (!do_search(NULL, c, cmd, 1L, - SEARCH_HIS | SEARCH_MSG, NULL)) - { - curwin->w_cursor = pos; - cmd = NULL; - goto error; - } - lnum = curwin->w_cursor.lnum; - curwin->w_cursor = pos; - /* adjust command string pointer */ - cmd += searchcmdlen; - } - break; + c = *cmd++; + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + cmd = NULL; + goto error; + } + if (skip) /* skip "/pat/" */ + { + cmd = skip_regexp(cmd, c, (int)p_magic, NULL); + if (*cmd == c) + ++cmd; + } + else + { + pos = curwin->w_cursor; /* save curwin->w_cursor */ + /* + * When '/' or '?' follows another address, start + * from there. + */ + if (lnum != MAXLNUM) + curwin->w_cursor.lnum = lnum; + /* + * Start a forward search at the end of the line (unless + * before the first line). + * Start a backward search at the start of the line. + * This makes sure we never match in the current + * line, and can match anywhere in the + * next/previous line. + */ + if (c == '/' && curwin->w_cursor.lnum > 0) + curwin->w_cursor.col = MAXCOL; + else + curwin->w_cursor.col = 0; + searchcmdlen = 0; + if (!do_search(NULL, c, cmd, 1L, + SEARCH_HIS | SEARCH_MSG, NULL, NULL)) + { + curwin->w_cursor = pos; + cmd = NULL; + goto error; + } + lnum = curwin->w_cursor.lnum; + curwin->w_cursor = pos; + /* adjust command string pointer */ + cmd += searchcmdlen; + } + break; case '\\': /* "\?", "\/" or "\&", repeat search */ - ++cmd; - if (*cmd == '&') - i = RE_SUBST; - else if (*cmd == '?' || *cmd == '/') - i = RE_SEARCH; - else - { - EMSG(_(e_backslash)); - cmd = NULL; - goto error; - } + ++cmd; + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + cmd = NULL; + goto error; + } + if (*cmd == '&') + i = RE_SUBST; + else if (*cmd == '?' || *cmd == '/') + i = RE_SEARCH; + else + { + EMSG(_(e_backslash)); + cmd = NULL; + goto error; + } - if (!skip) - { - /* - * When search follows another address, start from - * there. - */ - if (lnum != MAXLNUM) - pos.lnum = lnum; - else - pos.lnum = curwin->w_cursor.lnum; - - /* - * Start the search just like for the above - * do_search(). - */ - if (*cmd != '?') - pos.col = MAXCOL; - else - pos.col = 0; - if (searchit(curwin, curbuf, &pos, - *cmd == '?' ? BACKWARD : FORWARD, - (char_u *)"", 1L, SEARCH_MSG, - i, (linenr_T)0, NULL) != FAIL) - lnum = pos.lnum; - else - { - cmd = NULL; - goto error; - } - } - ++cmd; - break; + if (!skip) + { + /* + * When search follows another address, start from + * there. + */ + if (lnum != MAXLNUM) + pos.lnum = lnum; + else + pos.lnum = curwin->w_cursor.lnum; + + /* + * Start the search just like for the above + * do_search(). + */ + if (*cmd != '?') + pos.col = MAXCOL; + else + pos.col = 0; +#ifdef FEAT_VIRTUALEDIT + pos.coladd = 0; +#endif + if (searchit(curwin, curbuf, &pos, + *cmd == '?' ? BACKWARD : FORWARD, + (char_u *)"", 1L, SEARCH_MSG, + i, (linenr_T)0, NULL, NULL) != FAIL) + lnum = pos.lnum; + else + { + cmd = NULL; + goto error; + } + } + ++cmd; + break; default: - if (VIM_ISDIGIT(*cmd)) /* absolute line number */ - lnum = getdigits(&cmd); + if (VIM_ISDIGIT(*cmd)) /* absolute line number */ + lnum = getdigits(&cmd); } for (;;) @@ -4260,7 +4619,37 @@ get_address(ptr, skip, to_other_file) break; if (lnum == MAXLNUM) - lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */ + { + switch (addr_type) + { + case ADDR_LINES: + /* "+1" is same as ".+1" */ + lnum = curwin->w_cursor.lnum; + break; + case ADDR_WINDOWS: + lnum = CURRENT_WIN_NR; + break; + case ADDR_ARGUMENTS: + lnum = curwin->w_arg_idx + 1; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_BUFFERS: + lnum = curbuf->b_fnum; + break; + case ADDR_TABS: + lnum = CURRENT_TAB_NR; + break; + case ADDR_TABS_RELATIVE: + lnum = 1; + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + lnum = qf_get_cur_valid_idx(eap); + break; +#endif + } + } + if (VIM_ISDIGIT(*cmd)) i = '+'; /* "number" is same as "+number" */ else @@ -4269,10 +4658,31 @@ get_address(ptr, skip, to_other_file) n = 1; else n = getdigits(&cmd); - if (i == '-') - lnum -= n; + + if (addr_type == ADDR_TABS_RELATIVE) + { + EMSG(_(e_invrange)); + cmd = NULL; + goto error; + } + else if (addr_type == ADDR_LOADED_BUFFERS + || addr_type == ADDR_BUFFERS) + lnum = compute_buffer_local_count( + addr_type, lnum, (i == '-') ? -1 * n : n); else - lnum += n; + { +#ifdef FEAT_FOLDING + /* Relative line addressing, need to adjust for folded lines + * now, but only do it after the first address. */ + if (addr_type == ADDR_LINES && (i == '-' || i == '+') + && address_count >= 2) + (void)hasFolding(lnum, NULL, &lnum); +#endif + if (i == '-') + lnum -= n; + else + lnum += n; + } } } while (*cmd == '/' || *cmd == '?'); @@ -4285,8 +4695,7 @@ get_address(ptr, skip, to_other_file) * Get flags from an Ex command argument. */ static void -get_flags(eap) - exarg_T *eap; +get_flags(exarg_T *eap) { while (vim_strchr((char_u *)"lp#", *eap->arg) != NULL) { @@ -4304,8 +4713,7 @@ get_flags(eap) * Function called for command which is Not Implemented. NI! */ void -ex_ni(eap) - exarg_T *eap; +ex_ni(exarg_T *eap) { if (!eap->skip) eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version"); @@ -4317,8 +4725,7 @@ ex_ni(eap) * Skips over ":perl <<EOF" constructs. */ static void -ex_script_ni(eap) - exarg_T *eap; +ex_script_ni(exarg_T *eap) { if (!eap->skip) ex_ni(eap); @@ -4332,20 +4739,76 @@ ex_script_ni(eap) * Return NULL when valid, error message when invalid. */ static char_u * -invalid_range(eap) - exarg_T *eap; +invalid_range(exarg_T *eap) { + buf_T *buf; if ( eap->line1 < 0 || eap->line2 < 0 - || eap->line1 > eap->line2 - || ((eap->argt & RANGE) - && !(eap->argt & NOTADR) - && eap->line2 > curbuf->b_ml.ml_line_count + || eap->line1 > eap->line2) + return (char_u *)_(e_invrange); + + if (eap->argt & RANGE) + { + switch(eap->addr_type) + { + case ADDR_LINES: + if (!(eap->argt & NOTADR) + && eap->line2 > curbuf->b_ml.ml_line_count #ifdef FEAT_DIFF - + (eap->cmdidx == CMD_diffget) + + (eap->cmdidx == CMD_diffget) #endif - )) - return (char_u *)_(e_invrange); + ) + return (char_u *)_(e_invrange); + break; + case ADDR_ARGUMENTS: + /* add 1 if ARGCOUNT is 0 */ + if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) + return (char_u *)_(e_invrange); + break; + case ADDR_BUFFERS: + if (eap->line1 < firstbuf->b_fnum + || eap->line2 > lastbuf->b_fnum) + return (char_u *)_(e_invrange); + break; + case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_next == NULL) + return (char_u *)_(e_invrange); + buf = buf->b_next; + } + if (eap->line1 < buf->b_fnum) + return (char_u *)_(e_invrange); + buf = lastbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_prev == NULL) + return (char_u *)_(e_invrange); + buf = buf->b_prev; + } + if (eap->line2 > buf->b_fnum) + return (char_u *)_(e_invrange); + break; + case ADDR_WINDOWS: + if (eap->line2 > LAST_WIN_NR) + return (char_u *)_(e_invrange); + break; + case ADDR_TABS: + if (eap->line2 > LAST_TAB_NR) + return (char_u *)_(e_invrange); + break; + case ADDR_TABS_RELATIVE: + /* Do nothing */ + break; +#ifdef FEAT_QUICKFIX + case ADDR_QUICKFIX: + if (eap->line2 != 1 && eap->line2 > qf_get_size(eap)) + return (char_u *)_(e_invrange); + break; +#endif + } + } return NULL; } @@ -4353,8 +4816,7 @@ invalid_range(eap) * Correct the range for zero line number, if required. */ static void -correct_range(eap) - exarg_T *eap; +correct_range(exarg_T *eap) { if (!(eap->argt & ZEROR)) /* zero in range not allowed */ { @@ -4366,15 +4828,14 @@ correct_range(eap) } #ifdef FEAT_QUICKFIX -static char_u *skip_grep_pat __ARGS((exarg_T *eap)); +static char_u *skip_grep_pat(exarg_T *eap); /* * For a ":vimgrep" or ":vimgrepadd" command return a pointer past the * pattern. Otherwise return eap->arg. */ static char_u * -skip_grep_pat(eap) - exarg_T *eap; +skip_grep_pat(exarg_T *eap) { char_u *p = eap->arg; @@ -4395,10 +4856,7 @@ skip_grep_pat(eap) * in the command line, so that things like % get expanded. */ static char_u * -replace_makeprg(eap, p, cmdlinep) - exarg_T *eap; - char_u *p; - char_u **cmdlinep; +replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) { char_u *new_cmdline; char_u *program; @@ -4480,10 +4938,10 @@ replace_makeprg(eap, p, cmdlinep) * Return FAIL for failure, OK otherwise. */ int -expand_filename(eap, cmdlinep, errormsgp) - exarg_T *eap; - char_u **cmdlinep; - char_u **errormsgp; +expand_filename( + exarg_T *eap, + char_u **cmdlinep, + char_u **errormsgp) { int has_wildcards; /* need to expand wildcards */ char_u *repl; @@ -4561,12 +5019,14 @@ expand_filename(eap, cmdlinep, errormsgp) if (!eap->usefilter && !escaped && eap->cmdidx != CMD_bang - && eap->cmdidx != CMD_make - && eap->cmdidx != CMD_lmake && eap->cmdidx != CMD_grep - && eap->cmdidx != CMD_lgrep && eap->cmdidx != CMD_grepadd + && eap->cmdidx != CMD_hardcopy + && eap->cmdidx != CMD_lgrep && eap->cmdidx != CMD_lgrepadd + && eap->cmdidx != CMD_lmake + && eap->cmdidx != CMD_make + && eap->cmdidx != CMD_terminal #ifndef UNIX && !(eap->argt & NOSPC) #endif @@ -4596,7 +5056,8 @@ expand_filename(eap, cmdlinep, errormsgp) } /* For a shell command a '!' must be escaped. */ - if ((eap->usefilter || eap->cmdidx == CMD_bang) + if ((eap->usefilter || eap->cmdidx == CMD_bang + || eap->cmdidx == CMD_terminal) && vim_strpbrk(repl, (char_u *)"!") != NULL) { char_u *l; @@ -4630,35 +5091,12 @@ expand_filename(eap, cmdlinep, errormsgp) { if (n == 2) { -#ifdef UNIX - /* - * Only for Unix we check for more than one file name. - * For other systems spaces are considered to be part - * of the file name. - * Only check here if there is no wildcard, otherwise - * ExpandOne() will check for errors. This allows - * ":e `ls ve*.c`" on Unix. - */ - if (!has_wildcards) - for (p = eap->arg; *p; ++p) - { - /* skip escaped characters */ - if (p[1] && (*p == '\\' || *p == Ctrl_V)) - ++p; - else if (vim_iswhite(*p)) - { - *errormsgp = (char_u *)_("E172: Only one file name allowed"); - return FAIL; - } - } -#endif - /* * Halve the number of backslashes (this is Vi compatible). * For Unix and OS/2, when wildcards are expanded, this is * done by ExpandOne() below. */ -#if defined(UNIX) || defined(OS2) +#if defined(UNIX) if (!has_wildcards) #endif backslash_halve(eap->arg); @@ -4722,12 +5160,12 @@ expand_filename(eap, cmdlinep, errormsgp) * Returns NULL for failure. */ static char_u * -repl_cmdline(eap, src, srclen, repl, cmdlinep) - exarg_T *eap; - char_u *src; - int srclen; - char_u *repl; - char_u **cmdlinep; +repl_cmdline( + exarg_T *eap, + char_u *src, + int srclen, + char_u *repl, + char_u **cmdlinep) { int len; int i; @@ -4779,8 +5217,7 @@ repl_cmdline(eap, src, srclen, repl, cmdlinep) * Check for '|' to separate commands and '"' to start comments. */ void -separate_nextcmd(eap) - exarg_T *eap; +separate_nextcmd(exarg_T *eap) { char_u *p; @@ -4790,7 +5227,7 @@ separate_nextcmd(eap) p = eap->arg; #endif - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (*p == Ctrl_V) { @@ -4849,8 +5286,7 @@ separate_nextcmd(eap) * get + command from ex argument */ static char_u * -getargcmd(argp) - char_u **argp; +getargcmd(char_u **argp) { char_u *arg = *argp; char_u *command = NULL; @@ -4878,9 +5314,9 @@ getargcmd(argp) * Find end of "+command" argument. Skip over "\ " and "\\". */ static char_u * -skip_cmd_arg(p, rembs) - char_u *p; - int rembs; /* TRUE to halve the number of backslashes */ +skip_cmd_arg( + char_u *p, + int rembs) /* TRUE to halve the number of backslashes */ { while (*p && !vim_isspace(*p)) { @@ -4891,18 +5327,33 @@ skip_cmd_arg(p, rembs) else ++p; } - mb_ptr_adv(p); + MB_PTR_ADV(p); } return p; } +#if defined(FEAT_MBYTE) || defined(PROTO) + int +get_bad_opt(char_u *p, exarg_T *eap) +{ + if (STRICMP(p, "keep") == 0) + eap->bad_char = BAD_KEEP; + else if (STRICMP(p, "drop") == 0) + eap->bad_char = BAD_DROP; + else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) + eap->bad_char = *p; + else + return FAIL; + return OK; +} +#endif + /* * Get "++opt=arg" argument. * Return FAIL or OK. */ static int -getargopt(eap) - exarg_T *eap; +getargopt(exarg_T *eap) { char_u *arg = eap->arg + 2; int *pp = NULL; @@ -4976,6 +5427,7 @@ getargopt(eap) #endif if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) return FAIL; + eap->force_ff = eap->cmd[eap->force_ff]; #ifdef FEAT_MBYTE } else if (pp == &eap->force_enc) @@ -4988,14 +5440,7 @@ getargopt(eap) { /* Check ++bad= argument. Must be a single-byte character, "keep" or * "drop". */ - p = eap->cmd + bad_char_idx; - if (STRICMP(p, "keep") == 0) - eap->bad_char = BAD_KEEP; - else if (STRICMP(p, "drop") == 0) - eap->bad_char = BAD_DROP; - else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) - eap->bad_char = *p; - else + if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL) return FAIL; } #endif @@ -5007,8 +5452,7 @@ getargopt(eap) * ":abbreviate" and friends. */ static void -ex_abbreviate(eap) - exarg_T *eap; +ex_abbreviate(exarg_T *eap) { do_exmap(eap, TRUE); /* almost the same as mapping */ } @@ -5017,8 +5461,7 @@ ex_abbreviate(eap) * ":map" and friends. */ static void -ex_map(eap) - exarg_T *eap; +ex_map(exarg_T *eap) { /* * If we are sourcing .exrc or .vimrc in current directory we @@ -5037,8 +5480,7 @@ ex_map(eap) * ":unmap" and friends. */ static void -ex_unmap(eap) - exarg_T *eap; +ex_unmap(exarg_T *eap) { do_exmap(eap, FALSE); } @@ -5047,8 +5489,7 @@ ex_unmap(eap) * ":mapclear" and friends. */ static void -ex_mapclear(eap) - exarg_T *eap; +ex_mapclear(exarg_T *eap) { map_clear(eap->cmd, eap->arg, eap->forceit, FALSE); } @@ -5057,16 +5498,13 @@ ex_mapclear(eap) * ":abclear" and friends. */ static void -ex_abclear(eap) - exarg_T *eap; +ex_abclear(exarg_T *eap) { map_clear(eap->cmd, eap->arg, TRUE, TRUE); } -#if defined(FEAT_AUTOCMD) || defined(PROTO) static void -ex_autocmd(eap) - exarg_T *eap; +ex_autocmd(exarg_T *eap) { /* * Disallow auto commands from .exrc and .vimrc in current @@ -5087,27 +5525,25 @@ ex_autocmd(eap) * ":doautocmd": Apply the automatic commands to the current buffer. */ static void -ex_doautocmd(eap) - exarg_T *eap; +ex_doautocmd(exarg_T *eap) { char_u *arg = eap->arg; int call_do_modelines = check_nomodeline(&arg); + int did_aucmd; - (void)do_doautocmd(arg, TRUE); - if (call_do_modelines) /* Only when there is no <nomodeline>. */ + (void)do_doautocmd(arg, TRUE, &did_aucmd); + /* Only when there is no <nomodeline>. */ + if (call_do_modelines && did_aucmd) do_modelines(0); } -#endif -#ifdef FEAT_LISTCMDS /* * :[N]bunload[!] [N] [bufname] unload buffer * :[N]bdelete[!] [N] [bufname] delete buffer from buffer list * :[N]bwipeout[!] [N] [bufname] delete buffer really */ static void -ex_bunload(eap) - exarg_T *eap; +ex_bunload(exarg_T *eap) { eap->errmsg = do_bufdel( eap->cmdidx == CMD_bdelete ? DOBUF_DEL @@ -5121,8 +5557,7 @@ ex_bunload(eap) * :[N]sbuffer [N] to buffer N */ static void -ex_buffer(eap) - exarg_T *eap; +ex_buffer(exarg_T *eap) { if (*eap->arg) eap->errmsg = e_trailing; @@ -5132,6 +5567,8 @@ ex_buffer(eap) goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0); else goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5140,10 +5577,11 @@ ex_buffer(eap) * :[N]sbmodified [N] to next mod. buffer */ static void -ex_bmodified(eap) - exarg_T *eap; +ex_bmodified(exarg_T *eap) { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5151,10 +5589,11 @@ ex_bmodified(eap) * :[N]sbnext [N] split and to next buffer */ static void -ex_bnext(eap) - exarg_T *eap; +ex_bnext(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5164,10 +5603,11 @@ ex_bnext(eap) * :[N]sbprevious [N] split and to previous buffer */ static void -ex_bprevious(eap) - exarg_T *eap; +ex_bprevious(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5177,10 +5617,11 @@ ex_bprevious(eap) * :sbfirst split and to first buffer */ static void -ex_brewind(eap) - exarg_T *eap; +ex_brewind(exarg_T *eap) { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5188,16 +5629,15 @@ ex_brewind(eap) * :sblast split and to last buffer */ static void -ex_blast(eap) - exarg_T *eap; +ex_blast(exarg_T *eap) { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } -#endif int -ends_excmd(c) - int c; +ends_excmd(int c) { return (c == NUL || c == '|' || c == '"' || c == '\n'); } @@ -5209,8 +5649,7 @@ ends_excmd(c) * Return NULL if not found. */ char_u * -find_nextcmd(p) - char_u *p; +find_nextcmd(char_u *p) { while (*p != '|' && *p != '\n') { @@ -5223,16 +5662,16 @@ find_nextcmd(p) #endif /* - * Check if *p is a separator between Ex commands. - * Return NULL if it isn't, (p + 1) if it is. + * Check if *p is a separator between Ex commands, skipping over white space. + * Return NULL if it isn't, the following character if it is. */ char_u * -check_nextcmd(p) - char_u *p; +check_nextcmd(char_u *p) { - p = skipwhite(p); - if (*p == '|' || *p == '\n') - return (p + 1); + char_u *s = skipwhite(p); + + if (*s == '|' || *s == '\n') + return (s + 1); else return NULL; } @@ -5246,9 +5685,9 @@ check_nextcmd(p) * return OK otherwise */ static int -check_more(message, forceit) - int message; /* when FALSE check only, no messages */ - int forceit; +check_more( + int message, /* when FALSE check only, no messages */ + int forceit) { int n = ARGCOUNT - curwin->w_arg_idx - 1; @@ -5290,9 +5729,7 @@ check_more(message, forceit) * Function given to ExpandGeneric() to obtain the list of command names. */ char_u * -get_command_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_command_name(expand_T *xp UNUSED, int idx) { if (idx >= (int)CMD_SIZE) # ifdef FEAT_USR_CMDS @@ -5305,23 +5742,24 @@ get_command_name(xp, idx) #endif #if defined(FEAT_USR_CMDS) || defined(PROTO) -static int uc_add_command __ARGS((char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int force)); -static void uc_list __ARGS((char_u *name, size_t name_len)); -static int uc_scan_attr __ARGS((char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg)); -static char_u *uc_split_args __ARGS((char_u *arg, size_t *lenp)); -static size_t uc_check_code __ARGS((char_u *code, size_t len, char_u *buf, ucmd_T *cmd, exarg_T *eap, char_u **split_buf, size_t *split_len)); +static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int addr_type, int force); +static void uc_list(char_u *name, size_t name_len); +static int uc_scan_attr(char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg, int* attr_type_arg); +static char_u *uc_split_args(char_u *arg, size_t *lenp); +static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd, exarg_T *eap, char_u **split_buf, size_t *split_len); static int -uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) - char_u *name; - size_t name_len; - char_u *rep; - long argt; - long def; - int flags; - int compl; - char_u *compl_arg; - int force; +uc_add_command( + char_u *name, + size_t name_len, + char_u *rep, + long argt, + long def, + int flags, + int compl, + char_u *compl_arg, + int addr_type, + int force) { ucmd_T *cmd = NULL; char_u *p; @@ -5375,11 +5813,9 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) goto fail; } - vim_free(cmd->uc_rep); - cmd->uc_rep = NULL; + VIM_CLEAR(cmd->uc_rep); #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) - vim_free(cmd->uc_compl_arg); - cmd->uc_compl_arg = NULL; + VIM_CLEAR(cmd->uc_compl_arg); #endif break; } @@ -5415,6 +5851,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) cmd->uc_compl_arg = compl_arg; # endif #endif + cmd->uc_addr_type = addr_type; return OK; @@ -5427,6 +5864,24 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) } #endif +#if defined(FEAT_USR_CMDS) +static struct +{ + int expand; + char *name; +} addr_type_complete[] = +{ + {ADDR_ARGUMENTS, "arguments"}, + {ADDR_LINES, "lines"}, + {ADDR_LOADED_BUFFERS, "loaded_buffers"}, + {ADDR_TABS, "tabs"}, + {ADDR_BUFFERS, "buffers"}, + {ADDR_WINDOWS, "windows"}, + {ADDR_QUICKFIX, "quickfix"}, + {-1, NULL} +}; +#endif + #if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO) /* * List of names for completion for ":command" with the EXPAND_ flag. @@ -5438,6 +5893,7 @@ static struct char *name; } command_complete[] = { + {EXPAND_ARGLIST, "arglist"}, {EXPAND_AUGROUP, "augroup"}, {EXPAND_BEHAVE, "behave"}, {EXPAND_BUFFERS, "buffer"}, @@ -5468,13 +5924,16 @@ static struct && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) {EXPAND_LOCALES, "locale"}, #endif + {EXPAND_MAPCLEAR, "mapclear"}, {EXPAND_MAPPINGS, "mapping"}, {EXPAND_MENUS, "menu"}, + {EXPAND_MESSAGES, "messages"}, {EXPAND_OWNSYNTAX, "syntax"}, #if defined(FEAT_PROFILE) {EXPAND_SYNTIME, "syntime"}, #endif {EXPAND_SETTINGS, "option"}, + {EXPAND_PACKADD, "packadd"}, {EXPAND_SHELLCMD, "shellcmd"}, #if defined(FEAT_SIGNS) {EXPAND_SIGN, "sign"}, @@ -5489,9 +5948,7 @@ static struct #if defined(FEAT_USR_CMDS) || defined(PROTO) static void -uc_list(name, name_len) - char_u *name; - size_t name_len; +uc_list(char_u *name, size_t name_len) { int i, j; int found = FALSE; @@ -5508,13 +5965,15 @@ uc_list(name, name_len) cmd = USER_CMD_GA(gap, i); a = (long)cmd->uc_argt; - /* Skip commands which don't match the requested prefix */ - if (STRNCMP(name, cmd->uc_name, name_len) != 0) + /* Skip commands which don't match the requested prefix and + * commands filtered out. */ + if (STRNCMP(name, cmd->uc_name, name_len) != 0 + || message_filtered(cmd->uc_name)) continue; /* Put out the title first time */ if (!found) - MSG_PUTS_TITLE(_("\n Name Args Range Complete Definition")); + MSG_PUTS_TITLE(_("\n Name Args Address Complete Definition")); found = TRUE; msg_putchar('\n'); if (got_int) @@ -5526,7 +5985,7 @@ uc_list(name, name_len) msg_putchar(gap != &ucmds ? 'b' : ' '); msg_putchar(' '); - msg_outtrans_attr(cmd->uc_name, hl_attr(HLF_D)); + msg_outtrans_attr(cmd->uc_name, HL_ATTR(HLF_D)); len = (int)STRLEN(cmd->uc_name) + 4; do { @@ -5575,6 +6034,20 @@ uc_list(name, name_len) IObuff[len++] = ' '; } while (len < 11); + /* Address Type */ + for (j = 0; addr_type_complete[j].expand != -1; ++j) + if (addr_type_complete[j].expand != ADDR_LINES + && addr_type_complete[j].expand == cmd->uc_addr_type) + { + STRCPY(IObuff + len, addr_type_complete[j].name); + len += (int)STRLEN(IObuff + len); + break; + } + + do { + IObuff[len++] = ' '; + } while (len < 21); + /* Completion */ for (j = 0; command_complete[j].expand != 0; ++j) if (command_complete[j].expand == cmd->uc_compl) @@ -5586,7 +6059,7 @@ uc_list(name, name_len) do { IObuff[len++] = ' '; - } while (len < 21); + } while (len < 35); IObuff[len] = '\0'; msg_outtrans(IObuff); @@ -5611,7 +6084,7 @@ uc_list(name, name_len) } static char_u * -uc_fun_cmd() +uc_fun_cmd(void) { static char_u fcmd[] = {0x84, 0xaf, 0x60, 0xb9, 0xaf, 0xb5, 0x60, 0xa4, 0xa5, 0xad, 0xa1, 0xae, 0xa4, 0x60, 0xa1, 0x60, @@ -5626,14 +6099,15 @@ uc_fun_cmd() } static int -uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg) - char_u *attr; - size_t len; - long *argt; - long *def; - int *flags; - int *compl; - char_u **compl_arg; +uc_scan_attr( + char_u *attr, + size_t len, + long *argt, + long *def, + int *flags, + int *compl, + char_u **compl_arg, + int *addr_type_arg) { char_u *p; @@ -5752,6 +6226,20 @@ uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg) == FAIL) return FAIL; } + else if (STRNICMP(attr, "addr", attrlen) == 0) + { + *argt |= RANGE; + if (val == NULL) + { + EMSG(_("E179: argument required for -addr")); + return FAIL; + } + if (parse_addr_type_arg(val, (int)vallen, argt, addr_type_arg) + == FAIL) + return FAIL; + if (addr_type_arg != ADDR_LINES) + *argt |= (ZEROR | NOTADR) ; + } else { char_u ch = attr[len]; @@ -5769,8 +6257,7 @@ uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg) * ":command ..." */ static void -ex_command(eap) - exarg_T *eap; +ex_command(exarg_T *eap) { char_u *name; char_u *end; @@ -5780,6 +6267,7 @@ ex_command(eap) int flags = 0; int compl = EXPAND_NOTHING; char_u *compl_arg = NULL; + int addr_type_arg = ADDR_LINES; int has_attr = (eap->arg[0] == '-'); int name_len; @@ -5790,7 +6278,8 @@ ex_command(eap) { ++p; end = skiptowhite(p); - if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg) + if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, + &compl_arg, &addr_type_arg) == FAIL) return; p = skipwhite(end); @@ -5801,7 +6290,7 @@ ex_command(eap) if (ASCII_ISALPHA(*p)) while (ASCII_ISALNUM(*p)) ++p; - if (!ends_excmd(*p) && !vim_iswhite(*p)) + if (!ends_excmd(*p) && !VIM_ISWHITE(*p)) { EMSG(_("E182: Invalid command name")); return; @@ -5831,7 +6320,7 @@ ex_command(eap) } else uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, - eap->forceit); + addr_type_arg, eap->forceit); } /* @@ -5839,8 +6328,7 @@ ex_command(eap) * Clear all user commands, global and for current buffer. */ void -ex_comclear(eap) - exarg_T *eap UNUSED; +ex_comclear(exarg_T *eap UNUSED) { uc_clear(&ucmds); uc_clear(&curbuf->b_ucmds); @@ -5850,8 +6338,7 @@ ex_comclear(eap) * Clear all user commands for "gap". */ void -uc_clear(gap) - garray_T *gap; +uc_clear(garray_T *gap) { int i; ucmd_T *cmd; @@ -5869,8 +6356,7 @@ uc_clear(gap) } static void -ex_delcommand(eap) - exarg_T *eap; +ex_delcommand(exarg_T *eap) { int i = 0; ucmd_T *cmd = NULL; @@ -5914,9 +6400,7 @@ ex_delcommand(eap) * split and quote args for <f-args> */ static char_u * -uc_split_args(arg, lenp) - char_u *arg; - size_t *lenp; +uc_split_args(char_u *arg, size_t *lenp) { char_u *buf; char_u *p; @@ -5934,7 +6418,7 @@ uc_split_args(arg, lenp) len += 2; p += 2; } - else if (p[0] == '\\' && vim_iswhite(p[1])) + else if (p[0] == '\\' && VIM_ISWHITE(p[1])) { len += 1; p += 2; @@ -5944,7 +6428,7 @@ uc_split_args(arg, lenp) len += 2; p += 1; } - else if (vim_iswhite(*p)) + else if (VIM_ISWHITE(*p)) { p = skipwhite(p); if (*p == NUL) @@ -5982,7 +6466,7 @@ uc_split_args(arg, lenp) *q++ = '\\'; p += 2; } - else if (p[0] == '\\' && vim_iswhite(p[1])) + else if (p[0] == '\\' && VIM_ISWHITE(p[1])) { *q++ = p[1]; p += 2; @@ -5992,7 +6476,7 @@ uc_split_args(arg, lenp) *q++ = '\\'; *q++ = *p++; } - else if (vim_iswhite(*p)) + else if (VIM_ISWHITE(*p)) { p = skipwhite(p); if (*p == NUL) @@ -6013,31 +6497,61 @@ uc_split_args(arg, lenp) return buf; } -/* - * Check for a <> code in a user command. - * "code" points to the '<'. "len" the length of the <> (inclusive). - * "buf" is where the result is to be added. - * "split_buf" points to a buffer used for splitting, caller should free it. - * "split_len" is the length of what "split_buf" contains. + static size_t +add_cmd_modifier(char_u *buf, char *mod_str, int *multi_mods) +{ + size_t result; + + result = STRLEN(mod_str); + if (*multi_mods) + result += 1; + if (buf != NULL) + { + if (*multi_mods) + STRCAT(buf, " "); + STRCAT(buf, mod_str); + } + + *multi_mods = 1; + + return result; +} + +/* + * Check for a <> code in a user command. + * "code" points to the '<'. "len" the length of the <> (inclusive). + * "buf" is where the result is to be added. + * "split_buf" points to a buffer used for splitting, caller should free it. + * "split_len" is the length of what "split_buf" contains. * Returns the length of the replacement, which has been added to "buf". * Returns -1 if there was no match, and only the "<" has been copied. */ static size_t -uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) - char_u *code; - size_t len; - char_u *buf; - ucmd_T *cmd; /* the user command we're expanding */ - exarg_T *eap; /* ex arguments */ - char_u **split_buf; - size_t *split_len; +uc_check_code( + char_u *code, + size_t len, + char_u *buf, + ucmd_T *cmd, /* the user command we're expanding */ + exarg_T *eap, /* ex arguments */ + char_u **split_buf, + size_t *split_len) { size_t result = 0; char_u *p = code + 1; size_t l = len - 2; int quote = 0; - enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_REGISTER, - ct_LT, ct_NONE } type = ct_NONE; + enum { + ct_ARGS, + ct_BANG, + ct_COUNT, + ct_LINE1, + ct_LINE2, + ct_RANGE, + ct_MODS, + ct_REGISTER, + ct_LT, + ct_NONE + } type = ct_NONE; if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-') { @@ -6059,10 +6573,14 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) type = ct_LINE1; else if (STRNICMP(p, "line2>", l) == 0) type = ct_LINE2; + else if (STRNICMP(p, "range>", l) == 0) + type = ct_RANGE; else if (STRNICMP(p, "lt>", l) == 0) type = ct_LT; else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0) type = ct_REGISTER; + else if (STRNICMP(p, "mods>", l) == 0) + type = ct_MODS; switch (type) { @@ -6158,11 +6676,13 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) case ct_LINE1: case ct_LINE2: + case ct_RANGE: case ct_COUNT: { char num_buf[20]; long num = (type == ct_LINE1) ? eap->line1 : (type == ct_LINE2) ? eap->line2 : + (type == ct_RANGE) ? eap->addr_count : (eap->addr_count > 0) ? eap->line2 : cmd->uc_def; size_t num_len; @@ -6186,6 +6706,84 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) break; } + case ct_MODS: + { + int multi_mods = 0; + typedef struct { + int *varp; + char *name; + } mod_entry_T; + static mod_entry_T mod_entries[] = { +#ifdef FEAT_BROWSE_CMD + {&cmdmod.browse, "browse"}, +#endif +#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) + {&cmdmod.confirm, "confirm"}, +#endif + {&cmdmod.hide, "hide"}, + {&cmdmod.keepalt, "keepalt"}, + {&cmdmod.keepjumps, "keepjumps"}, + {&cmdmod.keepmarks, "keepmarks"}, + {&cmdmod.keeppatterns, "keeppatterns"}, + {&cmdmod.lockmarks, "lockmarks"}, + {&cmdmod.noswapfile, "noswapfile"}, + {NULL, NULL} + }; + int i; + + result = quote ? 2 : 0; + if (buf != NULL) + { + if (quote) + *buf++ = '"'; + *buf = '\0'; + } + + /* :aboveleft and :leftabove */ + if (cmdmod.split & WSP_ABOVE) + result += add_cmd_modifier(buf, "aboveleft", &multi_mods); + /* :belowright and :rightbelow */ + if (cmdmod.split & WSP_BELOW) + result += add_cmd_modifier(buf, "belowright", &multi_mods); + /* :botright */ + if (cmdmod.split & WSP_BOT) + result += add_cmd_modifier(buf, "botright", &multi_mods); + + /* the modifiers that are simple flags */ + for (i = 0; mod_entries[i].varp != NULL; ++i) + if (*mod_entries[i].varp) + result += add_cmd_modifier(buf, mod_entries[i].name, + &multi_mods); + + /* TODO: How to support :noautocmd? */ +#ifdef HAVE_SANDBOX + /* TODO: How to support :sandbox?*/ +#endif + /* :silent */ + if (msg_silent > 0) + result += add_cmd_modifier(buf, + emsg_silent > 0 ? "silent!" : "silent", &multi_mods); + /* :tab */ + if (cmdmod.tab > 0) + result += add_cmd_modifier(buf, "tab", &multi_mods); + /* :topleft */ + if (cmdmod.split & WSP_TOP) + result += add_cmd_modifier(buf, "topleft", &multi_mods); + /* TODO: How to support :unsilent?*/ + /* :verbose */ + if (p_verbose > 0) + result += add_cmd_modifier(buf, "verbose", &multi_mods); + /* :vertical */ + if (cmdmod.split & WSP_VERT) + result += add_cmd_modifier(buf, "vertical", &multi_mods); + if (quote && buf != NULL) + { + buf += result - 2; + *buf = '"'; + } + break; + } + case ct_REGISTER: result = eap->regname ? 1 : 0; if (quote) @@ -6219,8 +6817,7 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) } static void -do_ucmd(eap) - exarg_T *eap; +do_ucmd(exarg_T *eap) { char_u *buf; char_u *p; @@ -6349,8 +6946,7 @@ do_ucmd(eap) # if defined(FEAT_CMDL_COMPL) || defined(PROTO) static char_u * -get_user_command_name(idx) - int idx; +get_user_command_name(int idx) { return get_user_commands(NULL, idx - (int)CMD_SIZE); } @@ -6359,9 +6955,7 @@ get_user_command_name(idx) * Function given to ExpandGeneric() to obtain the list of user command names. */ char_u * -get_user_commands(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_commands(expand_T *xp UNUSED, int idx) { if (idx < curbuf->b_ucmds.ga_len) return USER_CMD_GA(&curbuf->b_ucmds, idx)->uc_name; @@ -6371,18 +6965,25 @@ get_user_commands(xp, idx) return NULL; } +/* + * Function given to ExpandGeneric() to obtain the list of user address type names. + */ + char_u * +get_user_cmd_addr_type(expand_T *xp UNUSED, int idx) +{ + return (char_u *)addr_type_complete[idx].name; +} + /* * Function given to ExpandGeneric() to obtain the list of user command * attributes. */ char_u * -get_user_cmd_flags(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_flags(expand_T *xp UNUSED, int idx) { static char *user_cmd_flags[] = - {"bang", "bar", "buffer", "complete", "count", - "nargs", "range", "register"}; + {"addr", "bang", "bar", "buffer", "complete", + "count", "nargs", "range", "register"}; if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0]))) return NULL; @@ -6393,9 +6994,7 @@ get_user_cmd_flags(xp, idx) * Function given to ExpandGeneric() to obtain the list of values for -nargs. */ char_u * -get_user_cmd_nargs(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_nargs(expand_T *xp UNUSED, int idx) { static char *user_cmd_nargs[] = {"0", "1", "*", "?", "+"}; @@ -6408,14 +7007,52 @@ get_user_cmd_nargs(xp, idx) * Function given to ExpandGeneric() to obtain the list of values for -complete. */ char_u * -get_user_cmd_complete(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_complete(expand_T *xp UNUSED, int idx) { return (char_u *)command_complete[idx].name; } # endif /* FEAT_CMDL_COMPL */ +/* + * Parse address type argument + */ + int +parse_addr_type_arg( + char_u *value, + int vallen, + long *argt, + int *addr_type_arg) +{ + int i, a, b; + + for (i = 0; addr_type_complete[i].expand != -1; ++i) + { + a = (int)STRLEN(addr_type_complete[i].name) == vallen; + b = STRNCMP(value, addr_type_complete[i].name, vallen) == 0; + if (a && b) + { + *addr_type_arg = addr_type_complete[i].expand; + break; + } + } + + if (addr_type_complete[i].expand == -1) + { + char_u *err = value; + + for (i = 0; err[i] != NUL && !VIM_ISWHITE(err[i]); i++) + ; + err[i] = NUL; + EMSG2(_("E180: Invalid address type value: %s"), err); + return FAIL; + } + + if (*addr_type_arg != ADDR_LINES) + *argt |= NOTADR; + + return OK; +} + #endif /* FEAT_USR_CMDS */ #if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO) @@ -6427,12 +7064,12 @@ get_user_cmd_complete(xp, idx) * Returns FAIL if something is wrong. */ int -parse_compl_arg(value, vallen, complp, argt, compl_arg) - char_u *value; - int vallen; - int *complp; - long *argt; - char_u **compl_arg UNUSED; +parse_compl_arg( + char_u *value, + int vallen, + int *complp, + long *argt, + char_u **compl_arg UNUSED) { char_u *arg = NULL; # if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) @@ -6500,11 +7137,22 @@ parse_compl_arg(value, vallen, complp, argt, compl_arg) # endif return OK; } + + int +cmdcomplete_str_to_type(char_u *complete_str) +{ + int i; + + for (i = 0; command_complete[i].expand != 0; ++i) + if (STRCMP(complete_str, command_complete[i].name) == 0) + return command_complete[i].expand; + + return EXPAND_NOTHING; +} #endif static void -ex_colorscheme(eap) - exarg_T *eap; +ex_colorscheme(exarg_T *eap) { if (*eap->arg == NUL) { @@ -6535,8 +7183,7 @@ ex_colorscheme(eap) } static void -ex_highlight(eap) - exarg_T *eap; +ex_highlight(exarg_T *eap) { if (*eap->arg == NUL && eap->cmd[2] == '!') MSG(_("Greetings, Vim user!")); @@ -6549,19 +7196,47 @@ ex_highlight(eap) * (because of an error). May need to restore the terminal mode. */ void -not_exiting() +not_exiting(void) { exiting = FALSE; settmode(TMODE_RAW); } + static int +before_quit_autocmds(win_T *wp, int quit_all, int forceit) +{ + apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer); + + /* Bail out when autocommands closed the window. + * Refuse to quit when the buffer in the last window is being closed (can + * only happen in autocommands). */ + if (!win_valid(wp) + || curbuf_locked() + || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) + return TRUE; + + if (quit_all || (check_more(FALSE, forceit) == OK && only_one_window())) + { + apply_autocmds(EVENT_EXITPRE, NULL, NULL, FALSE, curbuf); + /* Refuse to quit when locked or when the buffer in the last window is + * being closed (can only happen in autocommands). */ + if (curbuf_locked() + || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) + return TRUE; + } + + return FALSE; +} + /* - * ":quit": quit current window, quit Vim if closed the last window. + * ":quit": quit current window, quit Vim if the last window is closed. + * ":{nr}quit": quit window {nr} */ static void -ex_quit(eap) - exarg_T *eap; +ex_quit(exarg_T *eap) { + win_T *wp; + #ifdef FEAT_CMDWIN if (cmdwin_type != 0) { @@ -6575,13 +7250,24 @@ ex_quit(eap) text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - /* Refuse to quit when locked or when the buffer in the last window is - * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) + if (eap->addr_count > 0) + { + int wnr = eap->line2; + + for (wp = firstwin; wp->w_next != NULL; wp = wp->w_next) + if (--wnr <= 0) + break; + } + else + wp = curwin; + + /* Refuse to quit when locked. */ + if (curbuf_locked()) + return; + + /* Trigger QuitPre and maybe ExitPre */ + if (before_quit_autocmds(wp, FALSE, eap->forceit)) return; -#endif #ifdef FEAT_NETBEANS_INTG netbeansForcedQuit = eap->forceit; @@ -6592,28 +7278,32 @@ ex_quit(eap) */ if (check_more(FALSE, eap->forceit) == OK && only_one_window()) exiting = TRUE; - if ((!P_HID(curbuf) - && check_changed(curbuf, (p_awa ? CCGD_AW : 0) + if ((!buf_hide(wp->w_buffer) + && check_changed(wp->w_buffer, (p_awa ? CCGD_AW : 0) | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) || check_more(TRUE, eap->forceit) == FAIL - || (only_one_window() && check_changed_any(eap->forceit))) + || (only_one_window() && check_changed_any(eap->forceit, TRUE))) { not_exiting(); } else { -#ifdef FEAT_WINDOWS - if (only_one_window()) /* quit last window */ -#endif + /* quit last window + * Note: only_one_window() returns true, even so a help window is + * still open. In that case only quit, if no address has been + * specified. Example: + * :h|wincmd w|1q - don't quit + * :h|wincmd w|q - quit + */ + if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0)) getout(0); -#ifdef FEAT_WINDOWS -# ifdef FEAT_GUI + not_exiting(); +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif - /* close window; may free buffer */ - win_close(curwin, !P_HID(curwin->w_buffer) || eap->forceit); #endif + /* close window; may free buffer */ + win_close(wp, !buf_hide(wp->w_buffer) || eap->forceit); } } @@ -6621,8 +7311,7 @@ ex_quit(eap) * ":cquit". */ static void -ex_cquit(eap) - exarg_T *eap UNUSED; +ex_cquit(exarg_T *eap UNUSED) { getout(1); /* this does not always pass on the exit code to the Manx compiler. why? */ @@ -6632,8 +7321,7 @@ ex_cquit(eap) * ":qall": try to quit all windows */ static void -ex_quit_all(eap) - exarg_T *eap; +ex_quit_all(exarg_T *eap) { # ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6652,101 +7340,211 @@ ex_quit_all(eap) text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - /* Refuse to quit when locked or when the buffer in the last window is - * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) + + if (before_quit_autocmds(curwin, TRUE, eap->forceit)) return; -#endif exiting = TRUE; - if (eap->forceit || !check_changed_any(FALSE)) + if (eap->forceit || !check_changed_any(FALSE, FALSE)) getout(0); not_exiting(); } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * ":close": close current window, unless it is the last one */ static void -ex_close(eap) - exarg_T *eap; +ex_close(exarg_T *eap) { -# ifdef FEAT_CMDWIN + win_T *win; + int winnr = 0; +#ifdef FEAT_CMDWIN if (cmdwin_type != 0) cmdwin_result = Ctrl_C; else -# endif - if (!text_locked() -#ifdef FEAT_AUTOCMD - && !curbuf_locked() #endif - ) - ex_win_close(eap->forceit, curwin, NULL); + if (!text_locked() && !curbuf_locked()) + { + if (eap->addr_count == 0) + ex_win_close(eap->forceit, curwin, NULL); + else + { + FOR_ALL_WINDOWS(win) + { + winnr++; + if (winnr == eap->line2) + break; + } + if (win == NULL) + win = lastwin; + ex_win_close(eap->forceit, win, NULL); + } + } } -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX /* * ":pclose": Close any preview window. */ static void -ex_pclose(eap) - exarg_T *eap; +ex_pclose(exarg_T *eap) { win_T *win; - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) if (win->w_p_pvw) { ex_win_close(eap->forceit, win, NULL); break; } } -# endif +#endif /* * Close window "win" and take care of handling closing the last window for a * modified buffer. */ static void -ex_win_close(forceit, win, tp) - int forceit; - win_T *win; - tabpage_T *tp; /* NULL or the tab page "win" is in */ +ex_win_close( + int forceit, + win_T *win, + tabpage_T *tp) /* NULL or the tab page "win" is in */ { int need_hide; buf_T *buf = win->w_buffer; need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1); - if (need_hide && !P_HID(buf) && !forceit) + if (need_hide && !buf_hide(buf) && !forceit) { -# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) +#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { + bufref_T bufref; + + set_bufref(&bufref, buf); dialog_changed(buf, FALSE); - if (buf_valid(buf) && bufIsChanged(buf)) + if (bufref_valid(&bufref) && bufIsChanged(buf)) return; need_hide = FALSE; } else -# endif +#endif { - EMSG(_(e_nowrtmsg)); + no_write_message(); return; } } -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif /* free buffer when not hiding it or when it's a scratch buffer */ if (tp == NULL) - win_close(win, !need_hide && !P_HID(buf)); + win_close(win, !need_hide && !buf_hide(buf)); else - win_close_othertab(win, !need_hide && !P_HID(buf), tp); + win_close_othertab(win, !need_hide && !buf_hide(buf), tp); +} + +/* + * Handle the argument for a tabpage related ex command. + * Returns a tabpage number. + * When an error is encountered then eap->errmsg is set. + */ + static int +get_tabpage_arg(exarg_T *eap) +{ + int tab_number; + int unaccept_arg0 = (eap->cmdidx == CMD_tabmove) ? 0 : 1; + + if (eap->arg && *eap->arg != NUL) + { + char_u *p = eap->arg; + char_u *p_save; + int relative = 0; /* argument +N/-N means: go to N places to the + * right/left relative to the current position. */ + + if (*p == '-') + { + relative = -1; + p++; + } + else if (*p == '+') + { + relative = 1; + p++; + } + + p_save = p; + tab_number = getdigits(&p); + + if (relative == 0) + { + if (STRCMP(p, "$") == 0) + tab_number = LAST_TAB_NR; + else if (p == p_save || *p_save == '-' || *p != NUL + || tab_number > LAST_TAB_NR) + { + /* No numbers as argument. */ + eap->errmsg = e_invarg; + goto theend; + } + } + else + { + if (*p_save == NUL) + tab_number = 1; + else if (p == p_save || *p_save == '-' || *p != NUL + || tab_number == 0) + { + /* No numbers as argument. */ + eap->errmsg = e_invarg; + goto theend; + } + tab_number = tab_number * relative + tabpage_index(curtab); + if (!unaccept_arg0 && relative == -1) + --tab_number; + } + if (tab_number < unaccept_arg0 || tab_number > LAST_TAB_NR) + eap->errmsg = e_invarg; + } + else if (eap->addr_count > 0) + { + if (unaccept_arg0 && eap->line2 == 0) + { + eap->errmsg = e_invrange; + tab_number = 0; + } + else + { + tab_number = eap->line2; + if (!unaccept_arg0 && **eap->cmdlinep == '-') + { + --tab_number; + if (tab_number < unaccept_arg0) + eap->errmsg = e_invarg; + } + } + } + else + { + switch (eap->cmdidx) + { + case CMD_tabnext: + tab_number = tabpage_index(curtab) + 1; + if (tab_number > LAST_TAB_NR) + tab_number = 1; + break; + case CMD_tabmove: + tab_number = LAST_TAB_NR; + break; + default: + tab_number = tabpage_index(curtab); + } + } + +theend: + return tab_number; } /* @@ -6754,10 +7552,10 @@ ex_win_close(forceit, win, tp) * ":tabclose N": close tab page N. */ static void -ex_tabclose(eap) - exarg_T *eap; +ex_tabclose(exarg_T *eap) { tabpage_T *tp; + int tab_number; # ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6768,9 +7566,10 @@ ex_tabclose(eap) EMSG(_("E784: Cannot close last tab page")); else { - if (eap->addr_count > 0) + tab_number = get_tabpage_arg(eap); + if (eap->errmsg == NULL) { - tp = find_tabpage((int)eap->line2); + tp = find_tabpage(tab_number); if (tp == NULL) { beep_flush(); @@ -6781,13 +7580,9 @@ ex_tabclose(eap) tabpage_close_other(tp, eap->forceit); return; } + else if (!text_locked() && !curbuf_locked()) + tabpage_close(eap->forceit); } - if (!text_locked() -#ifdef FEAT_AUTOCMD - && !curbuf_locked() -#endif - ) - tabpage_close(eap->forceit); } } @@ -6795,11 +7590,11 @@ ex_tabclose(eap) * ":tabonly": close all tab pages except the current one */ static void -ex_tabonly(eap) - exarg_T *eap; +ex_tabonly(exarg_T *eap) { tabpage_T *tp; int done; + int tab_number; # ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6810,22 +7605,27 @@ ex_tabonly(eap) MSG(_("Already only one tab page")); else { - /* Repeat this up to a 1000 times, because autocommands may mess - * up the lists. */ - for (done = 0; done < 1000; ++done) + tab_number = get_tabpage_arg(eap); + if (eap->errmsg == NULL) { - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) - if (tp->tp_topframe != topframe) - { - tabpage_close_other(tp, eap->forceit); - /* if we failed to close it quit */ - if (valid_tabpage(tp)) - done = 1000; - /* start over, "tp" is now invalid */ + goto_tabpage(tab_number); + /* Repeat this up to a 1000 times, because autocommands may + * mess up the lists. */ + for (done = 0; done < 1000; ++done) + { + FOR_ALL_TABPAGES(tp) + if (tp->tp_topframe != topframe) + { + tabpage_close_other(tp, eap->forceit); + /* if we failed to close it quit */ + if (valid_tabpage(tp)) + done = 1000; + /* start over, "tp" is now invalid */ + break; + } + if (first_tabpage->tp_next == NULL) break; - } - if (first_tabpage->tp_next == NULL) - break; + } } } } @@ -6834,14 +7634,13 @@ ex_tabonly(eap) * Close the current tab page. */ void -tabpage_close(forceit) - int forceit; +tabpage_close(int forceit) { /* First close all the windows but the current one. If that worked then * close the last window in this tab, that will close it. */ - if (lastwin != firstwin) + if (!ONE_WINDOW) close_others(TRUE, forceit); - if (lastwin == firstwin) + if (ONE_WINDOW) ex_win_close(forceit, curwin, NULL); # ifdef FEAT_GUI need_mouse_correct = TRUE; @@ -6855,9 +7654,7 @@ tabpage_close(forceit) * last-but-one tab page. */ void -tabpage_close_other(tp, forceit) - tabpage_T *tp; - int forceit; +tabpage_close_other(tabpage_T *tp, int forceit) { int done = 0; win_T *wp; @@ -6876,6 +7673,8 @@ tabpage_close_other(tp, forceit) break; } + apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); + redraw_tabline = TRUE; if (h != tabline_height()) shell_new_rows(); @@ -6885,12 +7684,25 @@ tabpage_close_other(tp, forceit) * ":only". */ static void -ex_only(eap) - exarg_T *eap; +ex_only(exarg_T *eap) { + win_T *wp; + int wnr; # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif + if (eap->addr_count > 0) + { + wnr = eap->line2; + for (wp = firstwin; --wnr > 0; ) + { + if (wp->w_next == NULL) + break; + else + wp = wp->w_next; + } + win_goto(wp); + } close_others(TRUE, eap->forceit); } @@ -6899,34 +7711,39 @@ ex_only(eap) * Also used for ":tab drop file ..." after setting the argument list. */ void -ex_all(eap) - exarg_T *eap; +ex_all(exarg_T *eap) { if (eap->addr_count == 0) eap->line2 = 9999; do_arg_all((int)eap->line2, eap->forceit, eap->cmdidx == CMD_drop); } -#endif /* FEAT_WINDOWS */ static void -ex_hide(eap) - exarg_T *eap; +ex_hide(exarg_T *eap UNUSED) { - if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL) - eap->errmsg = e_invarg; - else + /* ":hide" or ":hide | cmd": hide current window */ + if (!eap->skip) { - /* ":hide" or ":hide | cmd": hide current window */ - eap->nextcmd = check_nextcmd(eap->arg); -#ifdef FEAT_WINDOWS - if (!eap->skip) - { -# ifdef FEAT_GUI - need_mouse_correct = TRUE; -# endif +#ifdef FEAT_GUI + need_mouse_correct = TRUE; +#endif + if (eap->addr_count == 0) win_close(curwin, FALSE); /* don't free buffer */ + else + { + int winnr = 0; + win_T *win; + + FOR_ALL_WINDOWS(win) + { + winnr++; + if (winnr == eap->line2) + break; + } + if (win == NULL) + win = lastwin; + win_close(win, FALSE); } -#endif } } @@ -6934,20 +7751,12 @@ ex_hide(eap) * ":stop" and ":suspend": Suspend Vim. */ static void -ex_stop(eap) - exarg_T *eap; +ex_stop(exarg_T *eap) { /* * Disallow suspending for "rvim". */ - if (!check_restricted() -#ifdef WIN3264 - /* - * Check if external commands are allowed now. - */ - && can_end_termcap_mode(TRUE) -#endif - ) + if (!check_restricted()) { if (!eap->forceit) autowrite_all(); @@ -6972,11 +7781,10 @@ ex_stop(eap) } /* - * ":exit", ":xit" and ":wq": Write file and exit Vim. + * ":exit", ":xit" and ":wq": Write file and quite the current window. */ static void -ex_exit(eap) - exarg_T *eap; +ex_exit(exarg_T *eap) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6991,13 +7799,9 @@ ex_exit(eap) text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - /* Refuse to quit when locked or when the buffer in the last window is - * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) + + if (before_quit_autocmds(curwin, FALSE, eap->forceit)) return; -#endif /* * if more files or windows we won't exit @@ -7008,23 +7812,20 @@ ex_exit(eap) || curbufIsChanged()) && do_write(eap) == FAIL) || check_more(TRUE, eap->forceit) == FAIL - || (only_one_window() && check_changed_any(eap->forceit))) + || (only_one_window() && check_changed_any(eap->forceit, FALSE))) { not_exiting(); } else { -#ifdef FEAT_WINDOWS if (only_one_window()) /* quit last window, exit Vim */ -#endif getout(0); -#ifdef FEAT_WINDOWS + not_exiting(); # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif /* Quit current window, may free the buffer. */ - win_close(curwin, !P_HID(curwin->w_buffer)); -#endif + win_close(curwin, !buf_hide(curwin->w_buffer)); } } @@ -7032,8 +7833,7 @@ ex_exit(eap) * ":print", ":list", ":number". */ static void -ex_print(eap) - exarg_T *eap; +ex_print(exarg_T *eap) { if (curbuf->b_ml.ml_flags & ML_EMPTY) EMSG(_(e_emptybuf)); @@ -7060,8 +7860,7 @@ ex_print(eap) #ifdef FEAT_BYTEOFF static void -ex_goto(eap) - exarg_T *eap; +ex_goto(exarg_T *eap) { goto_byte(eap->line2); } @@ -7071,13 +7870,12 @@ ex_goto(eap) * ":shell". */ static void -ex_shell(eap) - exarg_T *eap UNUSED; +ex_shell(exarg_T *eap UNUSED) { do_shell(NULL, 0); } -#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) \ +#if defined(HAVE_DROP_FILE) \ || (defined(FEAT_GUI_GTK) && defined(FEAT_DND)) \ || defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_MAC) \ @@ -7095,17 +7893,13 @@ ex_shell(eap) * list. This function takes over responsibility for freeing the list. * * XXX The list is made into the argument list. This is freed using - * FreeWild(), which does a series of vim_free() calls, unless the two defines - * __EMX__ and __ALWAYS_HAS_TRAILING_NUL_POINTER are set. In this case, a - * routine _fnexplodefree() is used. This may cause problems, but as the drop - * file functionality is (currently) not in EMX this is not presently a - * problem. + * FreeWild(), which does a series of vim_free() calls. */ void -handle_drop(filec, filev, split) - int filec; /* the number of files dropped */ - char_u **filev; /* the list of files dropped */ - int split; /* force splitting the window */ +handle_drop( + int filec, /* the number of files dropped */ + char_u **filev, /* the list of files dropped */ + int split) /* force splitting the window */ { exarg_T ea; int save_msg_scroll = msg_scroll; @@ -7113,10 +7907,9 @@ handle_drop(filec, filev, split) /* Postpone this while editing the command line. */ if (text_locked()) return; -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return; -#endif + /* When the screen is being updated we should not change buffers and * windows structures, it may cause freed memory to be used. */ if (updating_screen) @@ -7127,7 +7920,7 @@ handle_drop(filec, filev, split) * We don't need to check if the 'hidden' option is set, as in this * case the buffer won't be lost. */ - if (!P_HID(curbuf) && !split) + if (!buf_hide(curbuf) && !split) { ++emsg_off; split = check_changed(curbuf, CCGD_AW); @@ -7135,7 +7928,6 @@ handle_drop(filec, filev, split) } if (split) { -# ifdef FEAT_WINDOWS if (win_split(0, 0) == FAIL) return; RESET_BINDING(curwin); @@ -7144,9 +7936,6 @@ handle_drop(filec, filev, split) * existing one is overwritten. */ alist_unlink(curwin->w_alist); alist_new(); -# else - return; /* can't split, always fail */ -# endif } /* @@ -7177,8 +7966,7 @@ handle_drop(filec, filev, split) * Clear an argument list: free all file names and reset it to zero entries. */ void -alist_clear(al) - alist_T *al; +alist_clear(alist_T *al) { while (--al->al_ga.ga_len >= 0) vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname); @@ -7189,22 +7977,18 @@ alist_clear(al) * Init an argument list. */ void -alist_init(al) - alist_T *al; +alist_init(alist_T *al) { ga_init2(&al->al_ga, (int)sizeof(aentry_T), 5); } -#if defined(FEAT_WINDOWS) || defined(PROTO) - /* * Remove a reference from an argument list. * Ignored when the argument list is the global one. * If the argument list is no longer used by any window, free it. */ void -alist_unlink(al) - alist_T *al; +alist_unlink(alist_T *al) { if (al != &global_alist && --al->al_refcount <= 0) { @@ -7213,12 +7997,11 @@ alist_unlink(al) } } -# if defined(FEAT_LISTCMDS) || defined(HAVE_DROP_FILE) || defined(PROTO) /* * Create a new argument list and use it for the current window. */ void -alist_new() +alist_new(void) { curwin->w_alist = (alist_T *)alloc((unsigned)sizeof(alist_T)); if (curwin->w_alist == NULL) @@ -7233,19 +8016,15 @@ alist_new() alist_init(curwin->w_alist); } } -# endif -#endif -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) || defined(PROTO) +#if !defined(UNIX) || defined(PROTO) /* * Expand the file names in the global argument list. * If "fnum_list" is not NULL, use "fnum_list[fnum_len]" as a list of buffer * numbers to be re-used. */ void -alist_expand(fnum_list, fnum_len) - int *fnum_list; - int fnum_len; +alist_expand(int *fnum_list, int fnum_len) { char_u **old_arg_files; int old_arg_count; @@ -7283,15 +8062,23 @@ alist_expand(fnum_list, fnum_len) * Takes over the allocated files[] and the allocated fnames in it. */ void -alist_set(al, count, files, use_curbuf, fnum_list, fnum_len) - alist_T *al; - int count; - char_u **files; - int use_curbuf; - int *fnum_list; - int fnum_len; +alist_set( + alist_T *al, + int count, + char_u **files, + int use_curbuf, + int *fnum_list, + int fnum_len) { int i; + static int recursive = 0; + + if (recursive) + { + EMSG(_(e_au_recursive)); + return; + } + ++recursive; alist_clear(al); if (ga_grow(&al->al_ga, count) == OK) @@ -7319,10 +8106,10 @@ alist_set(al, count, files, use_curbuf, fnum_list, fnum_len) } else FreeWild(count, files); -#ifdef FEAT_WINDOWS if (al == &global_alist) -#endif arg_had_last = FALSE; + + --recursive; } /* @@ -7330,10 +8117,10 @@ alist_set(al, count, files, use_curbuf, fnum_list, fnum_len) * "fname" must have been allocated and "al" must have been checked for room. */ void -alist_add(al, fname, set_fnum) - alist_T *al; - char_u *fname; - int set_fnum; /* 1: set buffer number; 2: re-use curbuf */ +alist_add( + alist_T *al, + char_u *fname, + int set_fnum) /* 1: set buffer number; 2: re-use curbuf */ { if (fname == NULL) /* don't add NULL file names */ return; @@ -7352,24 +8139,20 @@ alist_add(al, fname, set_fnum) * Adjust slashes in file names. Called after 'shellslash' was set. */ void -alist_slash_adjust() +alist_slash_adjust(void) { int i; -# ifdef FEAT_WINDOWS win_T *wp; tabpage_T *tp; -# endif for (i = 0; i < GARGCOUNT; ++i) if (GARGLIST[i].ae_fname != NULL) slash_adjust(GARGLIST[i].ae_fname); -# ifdef FEAT_WINDOWS FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_alist != &global_alist) for (i = 0; i < WARGCOUNT(wp); ++i) if (WARGLIST(wp)[i].ae_fname != NULL) slash_adjust(WARGLIST(wp)[i].ae_fname); -# endif } #endif @@ -7377,8 +8160,7 @@ alist_slash_adjust() * ":preserve". */ static void -ex_preserve(eap) - exarg_T *eap UNUSED; +ex_preserve(exarg_T *eap UNUSED) { curbuf->b_flags |= BF_PRESERVED; ml_preserve(curbuf, TRUE); @@ -7388,8 +8170,7 @@ ex_preserve(eap) * ":recover". */ static void -ex_recover(eap) - exarg_T *eap; +ex_recover(exarg_T *eap) { /* Set recoverymode right away to avoid the ATTENTION prompt. */ recoverymode = TRUE; @@ -7408,13 +8189,11 @@ ex_recover(eap) * Command modifier used in a wrong way. */ static void -ex_wrongmodifier(eap) - exarg_T *eap; +ex_wrongmodifier(exarg_T *eap) { eap->errmsg = e_invcmd; } -#ifdef FEAT_WINDOWS /* * :sview [+command] file split window with new file, read-only * :split [[+command] file] split window with current or new file @@ -7429,44 +8208,33 @@ ex_wrongmodifier(eap) * :tabfind [+command] file open new Tab page and find "file" */ void -ex_splitview(eap) - exarg_T *eap; +ex_splitview(exarg_T *eap) { win_T *old_curwin = curwin; -# if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) +#if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) char_u *fname = NULL; -# endif -# ifdef FEAT_BROWSE +#endif +#ifdef FEAT_BROWSE int browse_flag = cmdmod.browse; -# endif - -# ifndef FEAT_VERTSPLIT - if (eap->cmdidx == CMD_vsplit || eap->cmdidx == CMD_vnew) - { - ex_ni(eap); - return; - } -# endif +#endif -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX /* A ":split" in the quickfix window works like ":new". Don't want two * quickfix windows. But it's OK when doing ":tab split". */ if (bt_quickfix(curbuf) && cmdmod.tab == 0) { if (eap->cmdidx == CMD_split) eap->cmdidx = CMD_new; -# ifdef FEAT_VERTSPLIT if (eap->cmdidx == CMD_vsplit) eap->cmdidx = CMD_vnew; -# endif } -# endif +#endif -# ifdef FEAT_SEARCHPATH +#ifdef FEAT_SEARCHPATH if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) { fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), @@ -7475,22 +8243,19 @@ ex_splitview(eap) goto theend; eap->arg = fname; } -# ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE else -# endif # endif -# ifdef FEAT_BROWSE +#endif +#ifdef FEAT_BROWSE if (cmdmod.browse -# ifdef FEAT_VERTSPLIT && eap->cmdidx != CMD_vnew -# endif && eap->cmdidx != CMD_new) { -# ifdef FEAT_AUTOCMD if ( -# ifdef FEAT_GUI +# ifdef FEAT_GUI !gui.in_use && -# endif +# endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: @@ -7499,7 +8264,6 @@ ex_splitview(eap) eap->arg = (char_u *)"."; } else -# endif { fname = do_browse(0, (char_u *)_("Edit File in new window"), eap->arg, NULL, NULL, NULL, curbuf); @@ -7509,7 +8273,7 @@ ex_splitview(eap) } } cmdmod.browse = FALSE; /* Don't browse again in do_ecmd(). */ -# endif +#endif /* * Either open new tab page or split the window. @@ -7535,20 +8299,18 @@ ex_splitview(eap) else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0, *eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) { -# ifdef FEAT_SCROLLBIND /* Reset 'scrollbind' when editing another file, but keep it when * doing ":split" without arguments. */ if (*eap->arg != NUL -# ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE || cmdmod.browse -# endif +# endif ) { RESET_BINDING(curwin); } else do_check_scrollbind(FALSE); -# endif do_exedit(eap, old_curwin); } @@ -7566,7 +8328,7 @@ ex_splitview(eap) * Open a new tab page. */ void -tabpage_new() +tabpage_new(void) { exarg_T ea; @@ -7581,9 +8343,10 @@ tabpage_new() * :tabnext command */ static void -ex_tabnext(eap) - exarg_T *eap; +ex_tabnext(exarg_T *eap) { + int tab_number; + switch (eap->cmdidx) { case CMD_tabfirst: @@ -7595,10 +8358,40 @@ ex_tabnext(eap) break; case CMD_tabprevious: case CMD_tabNext: - goto_tabpage(eap->addr_count == 0 ? -1 : -(int)eap->line2); + if (eap->arg && *eap->arg != NUL) + { + char_u *p = eap->arg; + char_u *p_save = p; + + tab_number = getdigits(&p); + if (p == p_save || *p_save == '-' || *p != NUL + || tab_number == 0) + { + /* No numbers as argument. */ + eap->errmsg = e_invarg; + return; + } + } + else + { + if (eap->addr_count == 0) + tab_number = 1; + else + { + tab_number = eap->line2; + if (tab_number < 1) + { + eap->errmsg = e_invrange; + return; + } + } + } + goto_tabpage(-tab_number); break; default: /* CMD_tabnext */ - goto_tabpage(eap->addr_count == 0 ? 0 : (int)eap->line2); + tab_number = get_tabpage_arg(eap); + if (eap->errmsg == NULL) + goto_tabpage(tab_number); break; } } @@ -7607,53 +8400,20 @@ ex_tabnext(eap) * :tabmove command */ static void -ex_tabmove(eap) - exarg_T *eap; +ex_tabmove(exarg_T *eap) { - int tab_number = 9999; - - if (eap->arg && *eap->arg != NUL) - { - char_u *p = eap->arg; - int relative = 0; /* argument +N/-N means: move N places to the - * right/left relative to the current position. */ - - if (*eap->arg == '-') - { - relative = -1; - p = eap->arg + 1; - } - else if (*eap->arg == '+') - { - relative = 1; - p = eap->arg + 1; - } - else - p = eap->arg; - - if (p == skipdigits(p)) - { - /* No numbers as argument. */ - eap->errmsg = e_invarg; - return; - } - - tab_number = getdigits(&p); - if (relative != 0) - tab_number = tab_number * relative + tabpage_index(curtab) - 1;; - } - else if (eap->addr_count != 0) - tab_number = eap->line2; + int tab_number; - tabpage_move(tab_number); + tab_number = get_tabpage_arg(eap); + if (eap->errmsg == NULL) + tabpage_move(tab_number); } /* * :tabs command: List tabs and their contents. */ static void -ex_tabs(eap) - exarg_T *eap UNUSED; +ex_tabs(exarg_T *eap UNUSED) { tabpage_T *tp; win_T *wp; @@ -7665,7 +8425,7 @@ ex_tabs(eap) { msg_putchar('\n'); vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++); - msg_outtrans_attr(IObuff, hl_attr(HLF_T)); + msg_outtrans_attr(IObuff, HL_ATTR(HLF_T)); out_flush(); /* output one line at a time */ ui_breakcheck(); @@ -7692,15 +8452,12 @@ ex_tabs(eap) } } -#endif /* FEAT_WINDOWS */ - /* * ":mode": Set screen mode. * If no argument given, just get the screen size and redraw. */ static void -ex_mode(eap) - exarg_T *eap; +ex_mode(exarg_T *eap) { if (*eap->arg == NUL) shell_resized(); @@ -7708,14 +8465,12 @@ ex_mode(eap) mch_screenmode(eap->arg); } -#ifdef FEAT_WINDOWS /* * ":resize". * set, increment or decrement current window height */ static void -ex_resize(eap) - exarg_T *eap; +ex_resize(exarg_T *eap) { int n; win_T *wp = curwin; @@ -7727,37 +8482,33 @@ ex_resize(eap) ; } -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif n = atol((char *)eap->arg); -#ifdef FEAT_VERTSPLIT if (cmdmod.split & WSP_VERT) { if (*eap->arg == '-' || *eap->arg == '+') - n += W_WIDTH(curwin); + n += curwin->w_width; else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ n = 9999; win_setwidth_win((int)n, wp); } else -#endif { if (*eap->arg == '-' || *eap->arg == '+') n += curwin->w_height; - else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ + else if (n == 0 && eap->arg[0] == NUL) /* default is very high */ n = 9999; win_setheight_win((int)n, wp); } } -#endif /* * ":find [+command] <file>" command. */ static void -ex_find(eap) - exarg_T *eap; +ex_find(exarg_T *eap) { #ifdef FEAT_SEARCHPATH char_u *fname; @@ -7793,8 +8544,7 @@ ex_find(eap) * ":open" simulation: for now just work like ":visual". */ static void -ex_open(eap) - exarg_T *eap; +ex_open(exarg_T *eap) { regmatch_T regmatch; char_u *p; @@ -7831,8 +8581,7 @@ ex_open(eap) * ":edit", ":badd", ":visual". */ static void -ex_edit(eap) - exarg_T *eap; +ex_edit(exarg_T *eap) { do_exedit(eap, NULL); } @@ -7841,14 +8590,12 @@ ex_edit(eap) * ":edit <file>" command and alikes. */ void -do_exedit(eap, old_curwin) - exarg_T *eap; - win_T *old_curwin; /* curwin before doing a split or NULL */ +do_exedit( + exarg_T *eap, + win_T *old_curwin) /* curwin before doing a split or NULL */ { int n; -#ifdef FEAT_WINDOWS int need_hide; -#endif int exmode_was = exmode_active; /* @@ -7903,10 +8650,7 @@ do_exedit(eap, old_curwin) if ((eap->cmdidx == CMD_new || eap->cmdidx == CMD_tabnew || eap->cmdidx == CMD_tabedit -#ifdef FEAT_VERTSPLIT - || eap->cmdidx == CMD_vnew -#endif - ) && *eap->arg == NUL) + || eap->cmdidx == CMD_vnew) && *eap->arg == NUL) { /* ":new" or ":tabnew" without argument: edit an new empty buffer */ setpcmark(); @@ -7914,23 +8658,18 @@ do_exedit(eap, old_curwin) ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0), old_curwin == NULL ? curwin : NULL); } - else if ((eap->cmdidx != CMD_split -#ifdef FEAT_VERTSPLIT - && eap->cmdidx != CMD_vsplit -#endif - ) + else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit) || *eap->arg != NUL #ifdef FEAT_BROWSE || cmdmod.browse #endif ) { -#ifdef FEAT_AUTOCMD /* Can't edit another file when "curbuf_lock" is set. Only ":edit" * can bring us here, others are stopped earlier. */ if (*eap->arg != NUL && curbuf_locked()) return; -#endif + n = readonlymode; if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview) readonlymode = TRUE; @@ -7944,43 +8683,39 @@ do_exedit(eap, old_curwin) (*eap->arg == NUL && eap->do_ecmd_lnum == 0 && vim_strchr(p_cpo, CPO_GOTO1) != NULL) ? ECMD_ONE : eap->do_ecmd_lnum, - (P_HID(curbuf) ? ECMD_HIDE : 0) + (buf_hide(curbuf) ? ECMD_HIDE : 0) + (eap->forceit ? ECMD_FORCEIT : 0) /* after a split we can use an existing buffer */ + (old_curwin != NULL ? ECMD_OLDBUF : 0) -#ifdef FEAT_LISTCMDS + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 ) -#endif , old_curwin == NULL ? curwin : NULL) == FAIL) { /* Editing the file failed. If the window was split, close it. */ -#ifdef FEAT_WINDOWS if (old_curwin != NULL) { need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); - if (!need_hide || P_HID(curbuf)) + if (!need_hide || buf_hide(curbuf)) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a window. */ enter_cleanup(&cs); -# endif -# ifdef FEAT_GUI +#endif +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif - win_close(curwin, !need_hide && !P_HID(curbuf)); +#endif + win_close(curwin, !need_hide && !buf_hide(curbuf)); -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or * uncaught exception. */ leave_cleanup(&cs); -# endif +#endif } } -#endif } else if (readonlymode && curbuf->b_nwindows == 1) { @@ -8006,7 +8741,6 @@ do_exedit(eap, old_curwin) #endif } -#ifdef FEAT_WINDOWS /* * if ":split file" worked, set alternate file name in old window to new * file @@ -8018,7 +8752,6 @@ do_exedit(eap, old_curwin) && old_curwin->w_buffer != curbuf && !cmdmod.keepalt) old_curwin->w_alt_fnum = curbuf->b_fnum; -#endif ex_no_reprint = TRUE; } @@ -8028,8 +8761,7 @@ do_exedit(eap, old_curwin) * ":gui" and ":gvim" when there is no GUI. */ static void -ex_nogui(eap) - exarg_T *eap; +ex_nogui(exarg_T *eap) { eap->errmsg = e_nogvim; } @@ -8037,26 +8769,34 @@ ex_nogui(eap) #if defined(FEAT_GUI_W32) && defined(FEAT_MENU) && defined(FEAT_TEAROFF) static void -ex_tearoff(eap) - exarg_T *eap; +ex_tearoff(exarg_T *eap) { gui_make_tearoff(eap->arg); } #endif -#if defined(FEAT_MENU) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_MACVIM)) +#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_MACVIM) \ + || defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU) static void -ex_popup(eap) - exarg_T *eap; +ex_popup(exarg_T *eap) { - gui_make_popup(eap->arg, eap->forceit); +# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_MACVIM) + if (gui.in_use) + gui_make_popup(eap->arg, eap->forceit); +# ifdef FEAT_TERM_POPUP_MENU + else +# endif +# endif +# ifdef FEAT_TERM_POPUP_MENU + pum_make_popup(eap->arg, eap->forceit); +# endif } #endif static void -ex_swapname(eap) - exarg_T *eap UNUSED; +ex_swapname(exarg_T *eap UNUSED) { if (curbuf->b_ml.ml_mfp == NULL || curbuf->b_ml.ml_mfp->mf_fname == NULL) MSG(_("No swap file")); @@ -8070,10 +8810,8 @@ ex_swapname(eap) * (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>) */ static void -ex_syncbind(eap) - exarg_T *eap UNUSED; +ex_syncbind(exarg_T *eap UNUSED) { -#ifdef FEAT_SCROLLBIND win_T *wp; win_T *save_curwin = curwin; buf_T *save_curbuf = curbuf; @@ -8089,7 +8827,7 @@ ex_syncbind(eap) if (curwin->w_p_scb) { topline = curwin->w_topline; - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { if (wp->w_p_scb && wp->w_buffer) { @@ -8110,7 +8848,7 @@ ex_syncbind(eap) /* * Set all scrollbind windows to the same topline. */ - for (curwin = firstwin; curwin; curwin = curwin->w_next) + FOR_ALL_WINDOWS(curwin) { if (curwin->w_p_scb) { @@ -8123,9 +8861,7 @@ ex_syncbind(eap) curwin->w_scbind_pos = topline; redraw_later(VALID); cursor_correct(); -#ifdef FEAT_WINDOWS curwin->w_redr_status = TRUE; -#endif } } curwin = save_curwin; @@ -8143,13 +8879,11 @@ ex_syncbind(eap) ins_typebuf(ctrl_o, REMAP_NONE, 0, TRUE, FALSE); } } -#endif } static void -ex_read(eap) - exarg_T *eap; +ex_read(exarg_T *eap) { int i; int empty = (curbuf->b_ml.ml_flags & ML_EMPTY); @@ -8195,9 +8929,9 @@ ex_read(eap) eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } - if (i == FAIL) + if (i != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_(e_notopen), eap->arg); @@ -8230,13 +8964,10 @@ static char_u *prev_dir = NULL; #if defined(EXITFREE) || defined(PROTO) void -free_cd_dir() +free_cd_dir(void) { - vim_free(prev_dir); - prev_dir = NULL; - - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(prev_dir); + VIM_CLEAR(globaldir); } #endif @@ -8245,11 +8976,9 @@ free_cd_dir() * When "local" is TRUE then this was after an ":lcd" command. */ void -post_chdir(local) - int local; +post_chdir(int local) { - vim_free(curwin->w_localdir); - curwin->w_localdir = NULL; + VIM_CLEAR(curwin->w_localdir); if (local) { /* If still in global directory, need to remember current @@ -8264,8 +8993,7 @@ post_chdir(local) { /* We are now in the global directory, no need to remember its * name. */ - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(globaldir); } shorten_fnames(TRUE); @@ -8276,8 +9004,7 @@ post_chdir(local) * ":cd", ":lcd", ":chdir" and ":lchdir". */ void -ex_cd(eap) - exarg_T *eap; +ex_cd(exarg_T *eap) { char_u *new_dir; char_u *tofree; @@ -8290,10 +9017,8 @@ ex_cd(eap) else #endif { -#ifdef FEAT_AUTOCMD if (allbuf_locked()) return; -#endif if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !eap->forceit) { @@ -8342,11 +9067,17 @@ ex_cd(eap) EMSG(_(e_failed)); else { - post_chdir(eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir); + int is_local_chdir = eap->cmdidx == CMD_lcd + || eap->cmdidx == CMD_lchdir; + + post_chdir(is_local_chdir); /* Echo the new current directory if the command was typed. */ if (KeyTyped || p_verbose >= 5) ex_pwd(eap); + apply_autocmds(EVENT_DIRCHANGED, + is_local_chdir ? (char_u *)"window" : (char_u *)"global", + new_dir, FALSE, curbuf); } vim_free(tofree); } @@ -8356,8 +9087,7 @@ ex_cd(eap) * ":pwd". */ static void -ex_pwd(eap) - exarg_T *eap UNUSED; +ex_pwd(exarg_T *eap UNUSED) { if (mch_dirname(NameBuff, MAXPATHL) == OK) { @@ -8374,16 +9104,14 @@ ex_pwd(eap) * ":=". */ static void -ex_equal(eap) - exarg_T *eap; +ex_equal(exarg_T *eap) { smsg((char_u *)"%ld", (long)eap->line2); ex_may_print(eap); } static void -ex_sleep(eap) - exarg_T *eap; +ex_sleep(exarg_T *eap) { int n; long len; @@ -8392,7 +9120,7 @@ ex_sleep(eap) { n = W_WINROW(curwin) + curwin->w_wrow - msg_scrolled; if (n >= 0) - windgoto((int)n, W_WINCOL(curwin) + curwin->w_wcol); + windgoto((int)n, curwin->w_wincol + curwin->w_wcol); } len = eap->line2; @@ -8409,30 +9137,46 @@ ex_sleep(eap) * Sleep for "msec" milliseconds, but keep checking for a CTRL-C every second. */ void -do_sleep(msec) - long msec; +do_sleep(long msec) { long done; + long wait_now; cursor_on(); out_flush(); - for (done = 0; !got_int && done < msec; done += 1000L) + for (done = 0; !got_int && done < msec; done += wait_now) { - ui_delay(msec - done > 1000L ? 1000L : msec - done, TRUE); - ui_breakcheck(); -#ifdef FEAT_NETBEANS_INTG - /* Process the netbeans messages that may have been received in the - * call to ui_breakcheck() when the GUI is in use. This may occur when - * running a test case. */ - netbeans_parse_messages(); + wait_now = msec - done > 1000L ? 1000L : msec - done; +#ifdef FEAT_TIMERS + { + long due_time = check_due_timer(); + + if (due_time > 0 && due_time < wait_now) + wait_now = due_time; + } +#endif +#ifdef FEAT_JOB_CHANNEL + if (has_any_channel() && wait_now > 100L) + wait_now = 100L; +#endif + ui_delay(wait_now, TRUE); +#ifdef FEAT_JOB_CHANNEL + if (has_any_channel()) + ui_breakcheck_force(TRUE); + else +#endif + ui_breakcheck(); +#ifdef MESSAGE_QUEUE + /* Process the netbeans and clientserver messages that may have been + * received in the call to ui_breakcheck() when the GUI is in use. This + * may occur when running a test case. */ + parse_queued_messages(); #endif } } static void -do_exmap(eap, isabbrev) - exarg_T *eap; - int isabbrev; +do_exmap(exarg_T *eap, int isabbrev) { int mode; char_u *cmdp; @@ -8454,8 +9198,7 @@ do_exmap(eap, isabbrev) * ":winsize" command (obsolete). */ static void -ex_winsize(eap) - exarg_T *eap; +ex_winsize(exarg_T *eap) { int w, h; char_u *arg = eap->arg; @@ -8471,10 +9214,8 @@ ex_winsize(eap) EMSG(_("E465: :winsize requires two number arguments")); } -#ifdef FEAT_WINDOWS static void -ex_wincmd(eap) - exarg_T *eap; +ex_wincmd(exarg_T *eap) { int xchar = NUL; char_u *p; @@ -8507,15 +9248,13 @@ ex_wincmd(eap) postponed_split_tab = 0; } } -#endif #if defined(FEAT_GUI) || defined(UNIX) || defined(VMS) || defined(MSWIN) /* * ":winpos". */ static void -ex_winpos(eap) - exarg_T *eap; +ex_winpos(exarg_T *eap) { int x, y; char_u *arg = eap->arg; @@ -8577,8 +9316,7 @@ ex_winpos(eap) * Handle command that work like operators: ":delete", ":yank", ":>" and ":<". */ static void -ex_operators(eap) - exarg_T *eap; +ex_operators(exarg_T *eap) { oparg_T oa; @@ -8637,8 +9375,7 @@ ex_operators(eap) * ":put". */ static void -ex_put(eap) - exarg_T *eap; +ex_put(exarg_T *eap) { /* ":0put" works like ":1put!". */ if (eap->line2 == 0) @@ -8655,12 +9392,11 @@ ex_put(eap) * Handle ":copy" and ":move". */ static void -ex_copymove(eap) - exarg_T *eap; +ex_copymove(exarg_T *eap) { long n; - n = get_address(&eap->arg, FALSE, FALSE); + n = get_address(eap, &eap->arg, eap->addr_type, FALSE, FALSE, 1); if (eap->arg == NULL) /* error detected */ { eap->nextcmd = NULL; @@ -8693,8 +9429,7 @@ ex_copymove(eap) * Print the current line if flags were given to the Ex command. */ void -ex_may_print(eap) - exarg_T *eap; +ex_may_print(exarg_T *eap) { if (eap->flags != 0) { @@ -8708,8 +9443,7 @@ ex_may_print(eap) * ":smagic" and ":snomagic". */ static void -ex_submagic(eap) - exarg_T *eap; +ex_submagic(exarg_T *eap) { int magic_save = p_magic; @@ -8722,8 +9456,7 @@ ex_submagic(eap) * ":join". */ static void -ex_join(eap) - exarg_T *eap; +ex_join(exarg_T *eap) { curwin->w_cursor.lnum = eap->line1; if (eap->line1 == eap->line2) @@ -8746,13 +9479,13 @@ ex_join(eap) * ":[addr]@r" or ":[addr]*r": execute register */ static void -ex_at(eap) - exarg_T *eap; +ex_at(exarg_T *eap) { int c; int prev_len = typebuf.tb_len; curwin->w_cursor.lnum = eap->line2; + check_cursor_col(); #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ @@ -8790,8 +9523,7 @@ ex_at(eap) * ":!". */ static void -ex_bang(eap) - exarg_T *eap; +ex_bang(exarg_T *eap) { do_bang(eap->addr_count, eap, eap->forceit, TRUE, TRUE); } @@ -8800,8 +9532,7 @@ ex_bang(eap) * ":undo". */ static void -ex_undo(eap) - exarg_T *eap UNUSED; +ex_undo(exarg_T *eap) { if (eap->addr_count == 1) /* :undo 123 */ undo_time(eap->line2, FALSE, FALSE, TRUE); @@ -8811,8 +9542,7 @@ ex_undo(eap) #ifdef FEAT_PERSISTENT_UNDO static void -ex_wundo(eap) - exarg_T *eap; +ex_wundo(exarg_T *eap) { char_u hash[UNDO_HASH_SIZE]; @@ -8821,8 +9551,7 @@ ex_wundo(eap) } static void -ex_rundo(eap) - exarg_T *eap; +ex_rundo(exarg_T *eap) { char_u hash[UNDO_HASH_SIZE]; @@ -8835,8 +9564,7 @@ ex_rundo(eap) * ":redo". */ static void -ex_redo(eap) - exarg_T *eap UNUSED; +ex_redo(exarg_T *eap UNUSED) { u_redo(1); } @@ -8845,8 +9573,7 @@ ex_redo(eap) * ":earlier" and ":later". */ static void -ex_later(eap) - exarg_T *eap; +ex_later(exarg_T *eap) { long count = 0; int sec = FALSE; @@ -8879,13 +9606,20 @@ ex_later(eap) * ":redir": start/stop redirection. */ static void -ex_redir(eap) - exarg_T *eap; +ex_redir(exarg_T *eap) { char *mode; char_u *fname; char_u *arg = eap->arg; +#ifdef FEAT_EVAL + if (redir_execute) + { + EMSG(_("E930: Cannot use :redir inside execute()")); + return; + } +#endif + if (STRICMP(eap->arg, "END") == 0) close_redir(); else @@ -8915,7 +9649,8 @@ ex_redir(eap) browseFile = do_browse(BROWSE_SAVE, (char_u *)_("Save Redirection"), - fname, NULL, NULL, BROWSE_FILTER_ALL_FILES, curbuf); + fname, NULL, NULL, + (char_u *)_(BROWSE_FILTER_ALL_FILES), curbuf); if (browseFile == NULL) return; /* operation cancelled */ vim_free(fname); @@ -9000,15 +9735,15 @@ ex_redir(eap) /* * ":redraw": force redraw */ - static void -ex_redraw(eap) - exarg_T *eap; + void +ex_redraw(exarg_T *eap) { int r = RedrawingDisabled; int p = p_lz; RedrawingDisabled = 0; p_lz = FALSE; + validate_cursor(); update_topline(); update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0); #ifdef FEAT_TITLE @@ -9026,16 +9761,18 @@ ex_redraw(eap) need_wait_return = FALSE; out_flush(); +#ifdef FEAT_GUI_MACVIM + if (gui.in_use) + gui_macvim_force_flush(); +#endif } /* * ":redrawstatus": force redraw of status line(s) */ static void -ex_redrawstatus(eap) - exarg_T *eap UNUSED; +ex_redrawstatus(exarg_T *eap UNUSED) { -#if defined(FEAT_WINDOWS) int r = RedrawingDisabled; int p = p_lz; @@ -9049,11 +9786,14 @@ ex_redrawstatus(eap) RedrawingDisabled = r; p_lz = p; out_flush(); +#ifdef FEAT_GUI_MACVIM + if (gui.in_use) + gui_macvim_force_flush(); #endif } static void -close_redir() +close_redir(void) { if (redir_fd != NULL) { @@ -9079,8 +9819,8 @@ static int mksession_nl = FALSE; /* use NL only in put_eol() */ * ":mkexrc", ":mkvimrc", ":mkview" and ":mksession". */ static void -ex_mkrc(eap) - exarg_T *eap; +ex_mkrc( + exarg_T *eap) { FILE *fd; int failed = FALSE; @@ -9144,7 +9884,8 @@ ex_mkrc(eap) eap->cmdidx == CMD_mksession ? (char_u *)_("Save Session") : # endif (char_u *)_("Save Setup"), - fname, (char_u *)"vim", NULL, BROWSE_FILTER_MACROS, NULL); + fname, (char_u *)"vim", NULL, + (char_u *)_(BROWSE_FILTER_MACROS), NULL); if (browseFile == NULL) goto theend; fname = browseFile; @@ -9226,7 +9967,7 @@ ex_mkrc(eap) *dirnow = NUL; if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR)) { - if (vim_chdirfile(fname) == OK) + if (vim_chdirfile(fname, NULL) == OK) shorten_fnames(TRUE); } else if (*dirnow != NUL @@ -9305,9 +10046,7 @@ ex_mkrc(eap) #if ((defined(FEAT_SESSION) || defined(FEAT_EVAL)) && defined(vim_mkdir)) \ || defined(PROTO) int -vim_mkdir_emsg(name, prot) - char_u *name; - int prot UNUSED; +vim_mkdir_emsg(char_u *name, int prot) { if (vim_mkdir(name, prot) != 0) { @@ -9323,10 +10062,10 @@ vim_mkdir_emsg(name, prot) * Return file descriptor, or NULL on failure. */ FILE * -open_exfile(fname, forceit, mode) - char_u *fname; - int forceit; - char *mode; /* "w" for create new file or "a" for append */ +open_exfile( + char_u *fname, + int forceit, + char *mode) /* "w" for create new file or "a" for append */ { FILE *fd; @@ -9354,8 +10093,7 @@ open_exfile(fname, forceit, mode) * ":mark" and ":k". */ static void -ex_mark(eap) - exarg_T *eap; +ex_mark(exarg_T *eap) { pos_T pos; @@ -9378,7 +10116,7 @@ ex_mark(eap) * Update w_topline, w_leftcol and the cursor position. */ void -update_topline_cursor() +update_topline_cursor(void) { check_cursor(); /* put cursor on valid line */ update_topline(); @@ -9387,22 +10125,62 @@ update_topline_cursor() update_curswant(); } -#ifdef FEAT_EX_EXTRA +/* + * Save the current State and go to Normal mode. + * Return TRUE if the typeahead could be saved. + */ + int +save_current_state(save_state_T *sst) +{ + sst->save_msg_scroll = msg_scroll; + sst->save_restart_edit = restart_edit; + sst->save_msg_didout = msg_didout; + sst->save_State = State; + sst->save_insertmode = p_im; + sst->save_finish_op = finish_op; + sst->save_opcount = opcount; + + msg_scroll = FALSE; /* no msg scrolling in Normal mode */ + restart_edit = 0; /* don't go to Insert mode */ + p_im = FALSE; /* don't use 'insertmode' */ + + /* + * Save the current typeahead. This is required to allow using ":normal" + * from an event handler and makes sure we don't hang when the argument + * ends with half a command. + */ + save_typeahead(&sst->tabuf); + return sst->tabuf.typebuf_valid; +} + + void +restore_current_state(save_state_T *sst) +{ + /* Restore the previous typeahead. */ + restore_typeahead(&sst->tabuf); + + msg_scroll = sst->save_msg_scroll; + restart_edit = sst->save_restart_edit; + p_im = sst->save_insertmode; + finish_op = sst->save_finish_op; + opcount = sst->save_opcount; + msg_didout |= sst->save_msg_didout; /* don't reset msg_didout now */ + + /* Restore the state (needed when called from a function executed for + * 'indentexpr'). Update the mouse and cursor, they may have changed. */ + State = sst->save_State; +#ifdef CURSOR_SHAPE + ui_cursor_shape(); /* may show different cursor shape */ +#endif +} + /* * ":normal[!] {commands}": Execute normal mode commands. */ - static void -ex_normal(eap) - exarg_T *eap; + void +ex_normal(exarg_T *eap) { - int save_msg_scroll = msg_scroll; - int save_restart_edit = restart_edit; - int save_msg_didout = msg_didout; - int save_State = State; - tasave_T tabuf; - int save_insertmode = p_im; - int save_finish_op = finish_op; - int save_opcount = opcount; + save_state_T save_state; #ifdef FEAT_MBYTE char_u *arg = NULL; int l; @@ -9419,11 +10197,6 @@ ex_normal(eap) EMSG(_("E192: Recursive use of :normal too deep")); return; } - ++ex_normal_busy; - - msg_scroll = FALSE; /* no msg scrolling in Normal mode */ - restart_edit = 0; /* don't go to Insert mode */ - p_im = FALSE; /* don't use 'insertmode' */ #ifdef FEAT_MBYTE /* @@ -9489,13 +10262,8 @@ ex_normal(eap) } #endif - /* - * Save the current typeahead. This is required to allow using ":normal" - * from an event handler and makes sure we don't hang when the argument - * ends with half a command. - */ - save_typeahead(&tabuf); - if (tabuf.typebuf_valid) + ++ex_normal_busy; + if (save_current_state(&save_state)) { /* * Repeat the :normal command for each line in the range. When no @@ -9508,6 +10276,7 @@ ex_normal(eap) { curwin->w_cursor.lnum = eap->line1++; curwin->w_cursor.col = 0; + check_cursor_moved(curwin); } exec_normal_cmd( @@ -9522,20 +10291,15 @@ ex_normal(eap) /* Might not return to the main loop when in an event handler. */ update_topline_cursor(); - /* Restore the previous typeahead. */ - restore_typeahead(&tabuf); - + restore_current_state(&save_state); --ex_normal_busy; - msg_scroll = save_msg_scroll; - restart_edit = save_restart_edit; - p_im = save_insertmode; - finish_op = save_finish_op; - opcount = save_opcount; - msg_didout |= save_msg_didout; /* don't reset msg_didout now */ +#ifdef FEAT_MOUSE + setmouse(); +#endif +#ifdef CURSOR_SHAPE + ui_cursor_shape(); /* may show different cursor shape */ +#endif - /* Restore the state (needed when called from a function executed for - * 'indentexpr'). */ - State = save_State; #ifdef FEAT_MBYTE vim_free(arg); #endif @@ -9545,11 +10309,13 @@ ex_normal(eap) * ":startinsert", ":startreplace" and ":startgreplace" */ static void -ex_startinsert(eap) - exarg_T *eap; +ex_startinsert(exarg_T *eap) { if (eap->forceit) { + /* cursor line can be zero on startup */ + if (!curwin->w_cursor.lnum) + curwin->w_cursor.lnum = 1; coladvance((colnr_T)MAXCOL); curwin->w_curswant = MAXCOL; curwin->w_set_curswant = FALSE; @@ -9579,60 +10345,72 @@ ex_startinsert(eap) * ":stopinsert" */ static void -ex_stopinsert(eap) - exarg_T *eap UNUSED; +ex_stopinsert(exarg_T *eap UNUSED) { restart_edit = 0; stop_insert_mode = TRUE; + clearmode(); } -#endif -#if defined(FEAT_EX_EXTRA) || defined(FEAT_MENU) || defined(PROTO) /* * Execute normal mode command "cmd". * "remap" can be REMAP_NONE or REMAP_YES. */ void -exec_normal_cmd(cmd, remap, silent) - char_u *cmd; - int remap; - int silent; +exec_normal_cmd(char_u *cmd, int remap, int silent) +{ + /* Stuff the argument into the typeahead buffer. */ + ins_typebuf(cmd, remap, 0, TRUE, silent); + exec_normal(FALSE, FALSE); +} + +/* + * Execute normal_cmd() until there is no typeahead left. + */ + void +exec_normal(int was_typed, int may_use_terminal_loop UNUSED) { oparg_T oa; - /* - * Stuff the argument into the typeahead buffer. - * Execute normal_cmd() until there is no typeahead left. - */ clear_oparg(&oa); finish_op = FALSE; - ins_typebuf(cmd, remap, 0, TRUE, silent); - while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0)) - && !got_int) + while ((!stuff_empty() || ((was_typed || !typebuf_typed()) + && typebuf.tb_len > 0)) && !got_int) { update_topline_cursor(); - normal_cmd(&oa, TRUE); /* execute a Normal mode cmd */ +#ifdef FEAT_TERMINAL + if (may_use_terminal_loop && term_use_loop() + && oa.op_type == OP_NOP && oa.regname == NUL + && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. With FAIL we first need to position the + * cursor and the screen needs to be redrawn. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else +#endif + /* execute a Normal mode cmd */ + normal_cmd(&oa, TRUE); } } -#endif #ifdef FEAT_FIND_ID static void -ex_checkpath(eap) - exarg_T *eap; +ex_checkpath(exarg_T *eap) { find_pattern_in_path(NULL, 0, 0, FALSE, FALSE, CHECK_PATH, 1L, eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW, (linenr_T)1, (linenr_T)MAXLNUM); } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* * ":psearch" */ static void -ex_psearch(eap) - exarg_T *eap; +ex_psearch(exarg_T *eap) { g_do_tagpreview = p_pvh; ex_findpat(eap); @@ -9641,8 +10419,7 @@ ex_psearch(eap) #endif static void -ex_findpat(eap) - exarg_T *eap; +ex_findpat(exarg_T *eap) { int whole = TRUE; long n; @@ -9699,15 +10476,13 @@ ex_findpat(eap) } #endif -#ifdef FEAT_WINDOWS -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX /* * ":ptag", ":ptselect", ":ptjump", ":ptnext", etc. */ static void -ex_ptag(eap) - exarg_T *eap; +ex_ptag(exarg_T *eap) { g_do_tagpreview = p_pvh; /* will be reset to 0 in ex_tag_cmd() */ ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1); @@ -9717,14 +10492,13 @@ ex_ptag(eap) * ":pedit" */ static void -ex_pedit(eap) - exarg_T *eap; +ex_pedit(exarg_T *eap) { win_T *curwin_save = curwin; g_do_tagpreview = p_pvh; prepare_tagpreview(TRUE); - keep_help_flag = curwin_save->w_buffer->b_help; + keep_help_flag = bt_help(curwin_save->w_buffer); do_exedit(eap, NULL); keep_help_flag = FALSE; if (curwin != curwin_save && win_valid(curwin_save)) @@ -9736,14 +10510,13 @@ ex_pedit(eap) } g_do_tagpreview = 0; } -# endif +#endif /* * ":stag", ":stselect" and ":stjump". */ static void -ex_stag(eap) - exarg_T *eap; +ex_stag(exarg_T *eap) { postponed_split = -1; postponed_split_flags = cmdmod.split; @@ -9752,22 +10525,18 @@ ex_stag(eap) postponed_split_flags = 0; postponed_split_tab = 0; } -#endif /* * ":tag", ":tselect", ":tjump", ":tnext", etc. */ static void -ex_tag(eap) - exarg_T *eap; +ex_tag(exarg_T *eap) { ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name); } static void -ex_tag_cmd(eap, name) - exarg_T *eap; - char_u *name; +ex_tag_cmd(exarg_T *eap, char_u *name) { int cmd; @@ -9794,7 +10563,7 @@ ex_tag_cmd(eap, name) #ifdef FEAT_CSCOPE if (p_cst && *eap->arg != NUL) { - do_cstag(eap); + ex_cstag(eap); return; } #endif @@ -9822,9 +10591,7 @@ ex_tag_cmd(eap, name) * the variable. Otherwise return -1 and "*usedlen" is unchanged. */ int -find_cmdline_var(src, usedlen) - char_u *src; - int *usedlen; +find_cmdline_var(char_u *src, int *usedlen) { int len; int i; @@ -9832,32 +10599,28 @@ find_cmdline_var(src, usedlen) "%", #define SPEC_PERC 0 "#", -#define SPEC_HASH 1 +#define SPEC_HASH (SPEC_PERC + 1) "<cword>", /* cursor word */ -#define SPEC_CWORD 2 +#define SPEC_CWORD (SPEC_HASH + 1) "<cWORD>", /* cursor WORD */ -#define SPEC_CCWORD 3 +#define SPEC_CCWORD (SPEC_CWORD + 1) + "<cexpr>", /* expr under cursor */ +#define SPEC_CEXPR (SPEC_CCWORD + 1) "<cfile>", /* cursor path name */ -#define SPEC_CFILE 4 +#define SPEC_CFILE (SPEC_CEXPR + 1) "<sfile>", /* ":so" file name */ -#define SPEC_SFILE 5 +#define SPEC_SFILE (SPEC_CFILE + 1) "<slnum>", /* ":so" file line number */ -#define SPEC_SLNUM 6 -#ifdef FEAT_AUTOCMD +#define SPEC_SLNUM (SPEC_SFILE + 1) "<afile>", /* autocommand file name */ -# define SPEC_AFILE 7 +#define SPEC_AFILE (SPEC_SLNUM + 1) "<abuf>", /* autocommand buffer number */ -# define SPEC_ABUF 8 +#define SPEC_ABUF (SPEC_AFILE + 1) "<amatch>", /* autocommand match name */ -# define SPEC_AMATCH 9 -#endif +#define SPEC_AMATCH (SPEC_ABUF + 1) #ifdef FEAT_CLIENTSERVER "<client>" -# ifdef FEAT_AUTOCMD -# define SPEC_CLIENT 10 -# else -# define SPEC_CLIENT 7 -# endif +# define SPEC_CLIENT (SPEC_AMATCH + 1) #endif }; @@ -9894,13 +10657,13 @@ find_cmdline_var(src, usedlen) * number of characters to skip. */ char_u * -eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) - char_u *src; /* pointer into commandline */ - char_u *srcstart; /* beginning of valid memory for src */ - int *usedlen; /* characters after src that are used */ - linenr_T *lnump; /* line number for :e command, or NULL */ - char_u **errormsg; /* pointer to error message */ - int *escaped; /* return value has escaped white space (can +eval_vars( + char_u *src, /* pointer into commandline */ + char_u *srcstart, /* beginning of valid memory for src */ + int *usedlen, /* characters after src that are used */ + linenr_T *lnump, /* line number for :e command, or NULL */ + char_u **errormsg, /* pointer to error message */ + int *escaped) /* return value has escaped white space (can * be NULL) */ { int i; @@ -9944,10 +10707,13 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) /* * word or WORD under cursor */ - if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD) + if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD + || spec_idx == SPEC_CEXPR) { - resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ? - (FIND_IDENT|FIND_STRING) : FIND_STRING); + resultlen = find_ident_under_cursor(&result, + spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING) + : spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL) + : FIND_STRING); if (resultlen == 0) { *errormsg = (char_u *)""; @@ -9993,9 +10759,12 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) if (*s == '<') /* "#<99" uses v:oldfiles */ ++s; i = (int)getdigits(&s); + if (s == src + 2 && src[1] == '-') + /* just a minus sign, don't skip over it */ + s--; *usedlen = (int)(s - src); /* length of what we expand */ - if (src[1] == '<') + if (src[1] == '<' && i != 0) { if (*usedlen < 2) { @@ -10018,6 +10787,8 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) } else { + if (i == 0 && src[1] == '<' && *usedlen > 1) + *usedlen = 1; buf = buflist_findnr(i); if (buf == NULL) { @@ -10048,7 +10819,6 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) break; #endif -#ifdef FEAT_AUTOCMD case SPEC_AFILE: /* file name for autocommand */ result = autocmd_fname; if (result != NULL && !autocmd_fname_full) @@ -10087,7 +10857,6 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) } break; -#endif case SPEC_SFILE: /* file name for ":so" command */ result = sourcing_name; if (result == NULL) @@ -10112,6 +10881,9 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) result = strbuf; break; #endif + default: + result = (char_u *)""; /* avoid gcc warning */ + break; } resultlen = (int)STRLEN(result); /* length of new string */ @@ -10157,7 +10929,7 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped) * Returns NULL when out of memory. */ static char_u * -arg_all() +arg_all(void) { int len; int idx; @@ -10186,7 +10958,11 @@ arg_all() } for ( ; *p != NUL; ++p) { - if (*p == ' ' || *p == '\\') + if (*p == ' ' +#ifndef BACKSLASH_IN_FILENAME + || *p == '\\' +#endif + ) { /* insert a backslash */ if (retval != NULL) @@ -10216,15 +10992,13 @@ arg_all() return retval; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Expand the <sfile> string in "arg". * * Returns an allocated string, or NULL for any error. */ char_u * -expand_sfile(arg) - char_u *arg; +expand_sfile(char_u *arg) { char_u *errormsg; int len; @@ -10279,32 +11053,30 @@ expand_sfile(arg) return result; } -#endif #ifdef FEAT_SESSION -static int ses_winsizes __ARGS((FILE *fd, int restore_size, - win_T *tab_firstwin)); -static int ses_win_rec __ARGS((FILE *fd, frame_T *fr)); -static frame_T *ses_skipframe __ARGS((frame_T *fr)); -static int ses_do_frame __ARGS((frame_T *fr)); -static int ses_do_win __ARGS((win_T *wp)); -static int ses_arglist __ARGS((FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp)); -static int ses_put_fname __ARGS((FILE *fd, char_u *name, unsigned *flagp)); -static int ses_fname __ARGS((FILE *fd, buf_T *buf, unsigned *flagp)); +static int ses_winsizes(FILE *fd, int restore_size, + win_T *tab_firstwin); +static int ses_win_rec(FILE *fd, frame_T *fr); +static frame_T *ses_skipframe(frame_T *fr); +static int ses_do_frame(frame_T *fr); +static int ses_do_win(win_T *wp); +static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp); +static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp); +static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol); /* * Write openfile commands for the current buffers to an .exrc file. * Return FAIL on error, OK otherwise. */ static int -makeopens(fd, dirnow) - FILE *fd; - char_u *dirnow; /* Current directory name */ +makeopens( + FILE *fd, + char_u *dirnow) /* Current directory name */ { buf_T *buf; int only_save_windows = TRUE; int nr; - int cnr = 1; int restore_size = TRUE; win_T *wp; char_u *sname; @@ -10378,16 +11150,21 @@ makeopens(fd, dirnow) return FAIL; /* Now put the other buffers into the buffer list */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) +#ifdef FEAT_TERMINAL + /* skip terminal buffers: finished ones are not useful, others + * will be resurrected and result in a new buffer */ + && !bt_terminal(buf) +#endif && buf->b_fname != NULL && buf->b_p_bl) { if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L : buf->b_wininfo->wi_fpos.lnum) < 0 - || ses_fname(fd, buf, &ssop_flags) == FAIL) + || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL) return FAIL; } } @@ -10450,7 +11227,8 @@ makeopens(fd, dirnow) tab_topframe = topframe; for (tabnr = 1; ; ++tabnr) { - int need_tabnew = FALSE; + int need_tabnew = FALSE; + int cnr = 1; if ((ssop_flags & SSOP_TABPAGES)) { @@ -10481,14 +11259,15 @@ makeopens(fd, dirnow) { if (ses_do_win(wp) && wp->w_buffer->b_ffname != NULL - && !wp->w_buffer->b_help + && !bt_help(wp->w_buffer) #ifdef FEAT_QUICKFIX && !bt_nofile(wp->w_buffer) #endif ) { if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0 - || ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL) + || ses_fname(fd, wp->w_buffer, &ssop_flags, TRUE) + == FAIL) return FAIL; need_tabnew = FALSE; if (!wp->w_arg_idx_invalid) @@ -10538,8 +11317,13 @@ makeopens(fd, dirnow) * resized when moving between windows. * Do this before restoring the view, so that the topline and the * cursor can be set. This is done again below. + * winminheight and winminwidth need to be set to avoid an error if the + * user has set winheight or winwidth. */ - if (put_line(fd, "set winheight=1 winwidth=1") == FAIL) + if (put_line(fd, "set winminheight=0") == FAIL + || put_line(fd, "set winheight=1") == FAIL + || put_line(fd, "set winminwidth=0") == FAIL + || put_line(fd, "set winwidth=1") == FAIL) return FAIL; if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL) return FAIL; @@ -10596,7 +11380,8 @@ makeopens(fd, dirnow) /* * Wipe out an empty unnamed buffer we started in. */ - if (put_line(fd, "if exists('s:wipebuf')") == FAIL) + if (put_line(fd, "if exists('s:wipebuf') && s:wipebuf != bufnr('%')") + == FAIL) return FAIL; if (put_line(fd, " silent exe 'bwipe ' . s:wipebuf") == FAIL) return FAIL; @@ -10609,6 +11394,10 @@ makeopens(fd, dirnow) if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s", p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL) return FAIL; + /* Re-apply 'winminheight' and 'winminwidth'. */ + if (fprintf(fd, "set winminheight=%ld winminwidth=%ld", + p_wmh, p_wmw) < 0 || put_eol(fd) == FAIL) + return FAIL; /* * Lastly, execute the x.vim file if it exists. @@ -10623,10 +11412,10 @@ makeopens(fd, dirnow) } static int -ses_winsizes(fd, restore_size, tab_firstwin) - FILE *fd; - int restore_size; - win_T *tab_firstwin; +ses_winsizes( + FILE *fd, + int restore_size, + win_T *tab_firstwin) { int n = 0; win_T *wp; @@ -10671,9 +11460,7 @@ ses_winsizes(fd, restore_size, tab_firstwin) * Returns FAIL when writing the commands to "fd" fails. */ static int -ses_win_rec(fd, fr) - FILE *fd; - frame_T *fr; +ses_win_rec(FILE *fd, frame_T *fr) { frame_T *frc; int count = 0; @@ -10721,8 +11508,7 @@ ses_win_rec(fd, fr) * Returns NULL when there none. */ static frame_T * -ses_skipframe(fr) - frame_T *fr; +ses_skipframe(frame_T *fr) { frame_T *frc; @@ -10737,8 +11523,7 @@ ses_skipframe(fr) * the Session. */ static int -ses_do_frame(fr) - frame_T *fr; +ses_do_frame(frame_T *fr) { frame_T *frc; @@ -10754,9 +11539,14 @@ ses_do_frame(fr) * Return non-zero if window "wp" is to be stored in the Session. */ static int -ses_do_win(wp) - win_T *wp; +ses_do_win(win_T *wp) { +#ifdef FEAT_TERMINAL + if (bt_terminal(wp->w_buffer)) + return !term_is_finished(wp->w_buffer) + && (ssop_flags & SSOP_TERMINAL) + && term_should_restore(wp->w_buffer); +#endif if (wp->w_buffer->b_fname == NULL #ifdef FEAT_QUICKFIX /* When 'buftype' is "nofile" can't restore the window contents. */ @@ -10764,7 +11554,7 @@ ses_do_win(wp) #endif ) return (ssop_flags & SSOP_BLANK); - if (wp->w_buffer->b_help) + if (bt_help(wp->w_buffer)) return (ssop_flags & SSOP_HELP); return TRUE; } @@ -10774,12 +11564,12 @@ ses_do_win(wp) * Caller must make sure 'scrolloff' is zero. */ static int -put_view(fd, wp, add_edit, flagp, current_arg_idx) - FILE *fd; - win_T *wp; - int add_edit; /* add ":edit" command to view */ - unsigned *flagp; /* vop_flags or ssop_flags */ - int current_arg_idx; /* current argument index of the window, use +put_view( + FILE *fd, + win_T *wp, + int add_edit, /* add ":edit" command to view */ + unsigned *flagp, /* vop_flags or ssop_flags */ + int current_arg_idx) /* current argument index of the window, use * -1 if unknown */ { win_T *save_curwin; @@ -10822,21 +11612,39 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx) /* Edit the file. Skip this when ":next" already did it. */ if (add_edit && (!did_next || wp->w_arg_idx_invalid)) { +# ifdef FEAT_TERMINAL + if (bt_terminal(wp->w_buffer)) + { + if (term_write_session(fd, wp) == FAIL) + return FAIL; + } + else +# endif /* * Load the file. */ if (wp->w_buffer->b_ffname != NULL -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX && !bt_nofile(wp->w_buffer) -#endif +# endif ) { /* * Editing a file in this buffer: use ":edit file". * This may have side effects! (e.g., compressed or network file). + * + * Note, if a buffer for that file already exists, use :badd to + * edit that buffer, to not lose folding information (:edit resets + * folds in other buffers) */ - if (fputs("edit ", fd) < 0 - || ses_fname(fd, wp->w_buffer, flagp) == FAIL) + if (fputs("if bufexists('", fd) < 0 + || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL + || fputs("') | buffer ", fd) < 0 + || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL + || fputs(" | else | edit ", fd) < 0 + || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL + || fputs(" | endif", fd) < 0 + || put_eol(fd) == FAIL) return FAIL; } else @@ -10849,7 +11657,7 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx) { /* The buffer does have a name, but it's not a file name. */ if (fputs("file ", fd) < 0 - || ses_fname(fd, wp->w_buffer, flagp) == FAIL) + || ses_fname(fd, wp->w_buffer, flagp, TRUE) == FAIL) return FAIL; } #endif @@ -10894,10 +11702,7 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx) */ if ((*flagp & SSOP_FOLDS) && wp->w_buffer->b_ffname != NULL -# ifdef FEAT_QUICKFIX - && (*wp->w_buffer->b_p_bt == NUL || wp->w_buffer->b_help) -# endif - ) + && (*wp->w_buffer->b_p_bt == NUL || bt_help(wp->w_buffer))) { if (put_folds(fd, wp) == FAIL) return FAIL; @@ -10960,9 +11765,11 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx) } /* - * Local directory. + * Local directory, if the current flag is not view options or the "curdir" + * option is included. */ - if (wp->w_localdir != NULL) + if (wp->w_localdir != NULL + && (flagp != &vop_flags || (*flagp & SSOP_CURDIR))) { if (fputs("lcd ", fd) < 0 || ses_put_fname(fd, wp->w_localdir, flagp) == FAIL @@ -10979,12 +11786,12 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx) * Returns FAIL if writing fails. */ static int -ses_arglist(fd, cmd, gap, fullname, flagp) - FILE *fd; - char *cmd; - garray_T *gap; - int fullname; /* TRUE: use full path name */ - unsigned *flagp; +ses_arglist( + FILE *fd, + char *cmd, + garray_T *gap, + int fullname, /* TRUE: use full path name */ + unsigned *flagp) { int i; char_u *buf = NULL; @@ -11009,7 +11816,7 @@ ses_arglist(fd, cmd, gap, fullname, flagp) s = buf; } } - if (fputs("argadd ", fd) < 0 + if (fputs("$argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL || put_eol(fd) == FAIL) { @@ -11024,14 +11831,11 @@ ses_arglist(fd, cmd, gap, fullname, flagp) /* * Write a buffer name to the session file. - * Also ends the line. + * Also ends the line, if "add_eol" is TRUE. * Returns FAIL if writing fails. */ static int -ses_fname(fd, buf, flagp) - FILE *fd; - buf_T *buf; - unsigned *flagp; +ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol) { char_u *name; @@ -11050,7 +11854,8 @@ ses_fname(fd, buf, flagp) name = buf->b_sfname; else name = buf->b_ffname; - if (ses_put_fname(fd, name, flagp) == FAIL || put_eol(fd) == FAIL) + if (ses_put_fname(fd, name, flagp) == FAIL + || (add_eol && put_eol(fd) == FAIL)) return FAIL; return OK; } @@ -11062,10 +11867,7 @@ ses_fname(fd, buf, flagp) * Returns FAIL if writing fails or out of memory. */ static int -ses_put_fname(fd, name, flagp) - FILE *fd; - char_u *name; - unsigned *flagp; +ses_put_fname(FILE *fd, char_u *name, unsigned *flagp) { char_u *sname; char_u *p; @@ -11078,7 +11880,7 @@ ses_put_fname(fd, name, flagp) if (*flagp & SSOP_SLASH) { /* change all backslashes to forward slashes */ - for (p = sname; *p != NUL; mb_ptr_adv(p)) + for (p = sname; *p != NUL; MB_PTR_ADV(p)) if (*p == '\\') *p = '/'; } @@ -11101,8 +11903,7 @@ ses_put_fname(fd, name, flagp) * ":loadview [nr]" */ static void -ex_loadview(eap) - exarg_T *eap; +ex_loadview(exarg_T *eap) { char_u *fname; @@ -11118,8 +11919,7 @@ ex_loadview(eap) * Get the name of the view file for the current buffer. */ static char_u * -get_view_file(c) - int c; +get_view_file(int c) { int len = 0; char_u *p, *s; @@ -11187,8 +11987,7 @@ get_view_file(c) * Return FAIL for a write error. */ int -put_eol(fd) - FILE *fd; +put_eol(FILE *fd) { if ( #ifdef USE_CRNL @@ -11208,9 +12007,7 @@ put_eol(fd) * Return FAIL for a write error. */ int -put_line(fd, s) - FILE *fd; - char *s; +put_line(FILE *fd, char *s) { if (fputs(s, fd) < 0 || put_eol(fd) == FAIL) return FAIL; @@ -11222,8 +12019,8 @@ put_line(fd, s) * ":rviminfo" and ":wviminfo". */ static void -ex_viminfo(eap) - exarg_T *eap; +ex_viminfo( + exarg_T *eap) { char_u *save_viminfo; @@ -11248,10 +12045,7 @@ ex_viminfo(eap) * "format" must contain "%s". */ void -dialog_msg(buff, format, fname) - char_u *buff; - char *format; - char_u *fname; +dialog_msg(char_u *buff, char *format, char_u *fname) { if (fname == NULL) fname = (char_u *)_("Untitled"); @@ -11263,8 +12057,7 @@ dialog_msg(buff, format, fname) * ":behave {mswin,xterm}" */ static void -ex_behave(eap) - exarg_T *eap; +ex_behave(exarg_T *eap) { if (STRCMP(eap->arg, "mswin") == 0) { @@ -11291,9 +12084,7 @@ ex_behave(eap) * ":behave {mswin,xterm}" command. */ char_u * -get_behave_arg(xp, idx) - expand_T *xp UNUSED; - int idx; +get_behave_arg(expand_T *xp UNUSED, int idx) { if (idx == 0) return (char_u *)"mswin"; @@ -11301,9 +12092,28 @@ get_behave_arg(xp, idx) return (char_u *)"xterm"; return NULL; } + +/* + * Function given to ExpandGeneric() to obtain the possible arguments of the + * ":messages {clear}" command. + */ + char_u * +get_messages_arg(expand_T *xp UNUSED, int idx) +{ + if (idx == 0) + return (char_u *)"clear"; + return NULL; +} #endif -#ifdef FEAT_AUTOCMD + char_u * +get_mapclear_arg(expand_T *xp UNUSED, int idx) +{ + if (idx == 0) + return (char_u *)"<buffer>"; + return NULL; +} + static int filetype_detect = FALSE; static int filetype_plugin = FALSE; static int filetype_indent = FALSE; @@ -11318,8 +12128,7 @@ static int filetype_indent = FALSE; * indent off: load indoff.vim */ static void -ex_filetype(eap) - exarg_T *eap; +ex_filetype(exarg_T *eap) { char_u *arg = eap->arg; int plugin = FALSE; @@ -11356,22 +12165,22 @@ ex_filetype(eap) { if (*arg == 'o' || !filetype_detect) { - source_runtime((char_u *)FILETYPE_FILE, TRUE); + source_runtime((char_u *)FILETYPE_FILE, DIP_ALL); filetype_detect = TRUE; if (plugin) { - source_runtime((char_u *)FTPLUGIN_FILE, TRUE); + source_runtime((char_u *)FTPLUGIN_FILE, DIP_ALL); filetype_plugin = TRUE; } if (indent) { - source_runtime((char_u *)INDENT_FILE, TRUE); + source_runtime((char_u *)INDENT_FILE, DIP_ALL); filetype_indent = TRUE; } } if (*arg == 'd') { - (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE); + (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE, NULL); do_modelines(0); } } @@ -11381,18 +12190,18 @@ ex_filetype(eap) { if (plugin) { - source_runtime((char_u *)FTPLUGOF_FILE, TRUE); + source_runtime((char_u *)FTPLUGOF_FILE, DIP_ALL); filetype_plugin = FALSE; } if (indent) { - source_runtime((char_u *)INDOFF_FILE, TRUE); + source_runtime((char_u *)INDOFF_FILE, DIP_ALL); filetype_indent = FALSE; } } else { - source_runtime((char_u *)FTOFF_FILE, TRUE); + source_runtime((char_u *)FTOFF_FILE, DIP_ALL); filetype_detect = FALSE; } } @@ -11401,20 +12210,26 @@ ex_filetype(eap) } /* - * ":setfiletype {name}" + * ":setfiletype [FALLBACK] {name}" */ static void -ex_setfiletype(eap) - exarg_T *eap; +ex_setfiletype(exarg_T *eap) { if (!did_filetype) - set_option_value((char_u *)"filetype", 0L, eap->arg, OPT_LOCAL); + { + char_u *arg = eap->arg; + + if (STRNCMP(arg, "FALLBACK ", 9) == 0) + arg += 9; + + set_option_value((char_u *)"filetype", 0L, arg, OPT_LOCAL); + if (arg != eap->arg) + did_filetype = FALSE; + } } -#endif static void -ex_digraphs(eap) - exarg_T *eap UNUSED; +ex_digraphs(exarg_T *eap UNUSED) { #ifdef FEAT_DIGRAPHS if (*eap->arg != NUL) @@ -11427,8 +12242,7 @@ ex_digraphs(eap) } static void -ex_set(eap) - exarg_T *eap; +ex_set(exarg_T *eap) { int flags = 0; @@ -11436,7 +12250,7 @@ ex_set(eap) flags = OPT_LOCAL; else if (eap->cmdidx == CMD_setglobal) flags = OPT_GLOBAL; -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) && defined(FEAT_BROWSE) +#if defined(FEAT_EVAL) && defined(FEAT_BROWSE) if (cmdmod.browse && flags == 0) ex_options(eap); else @@ -11444,15 +12258,23 @@ ex_set(eap) (void)do_set(eap->arg, flags); } -#ifdef FEAT_SEARCH_EXTRA +#if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) + void +set_no_hlsearch(int flag) +{ + no_hlsearch = flag; +# ifdef FEAT_EVAL + set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls); +# endif +} + /* * ":nohlsearch" */ static void -ex_nohlsearch(eap) - exarg_T *eap UNUSED; +ex_nohlsearch(exarg_T *eap UNUSED) { - SET_NO_HLSEARCH(TRUE); + set_no_hlsearch(TRUE); redraw_all_later(SOME_VALID); } @@ -11462,8 +12284,7 @@ ex_nohlsearch(eap) * skipping commands to find the next command. */ static void -ex_match(eap) - exarg_T *eap; +ex_match(exarg_T *eap) { char_u *p; char_u *g = NULL; @@ -11486,7 +12307,7 @@ ex_match(eap) if (ends_excmd(*eap->arg)) end = eap->arg; else if ((STRNICMP(eap->arg, "none", 4) == 0 - && (vim_iswhite(eap->arg[4]) || ends_excmd(eap->arg[4])))) + && (VIM_ISWHITE(eap->arg[4]) || ends_excmd(eap->arg[4])))) end = eap->arg + 4; else { @@ -11497,6 +12318,7 @@ ex_match(eap) if (*p == NUL) { /* There must be two arguments. */ + vim_free(g); EMSG2(_(e_invarg2), eap->arg); return; } @@ -11505,18 +12327,20 @@ ex_match(eap) { if (*end != NUL && !ends_excmd(*skipwhite(end + 1))) { + vim_free(g); eap->errmsg = e_trailing; return; } if (*end != *p) { + vim_free(g); EMSG2(_(e_invarg2), p); return; } c = *end; *end = NUL; - match_add(curwin, g, p + 1, 10, id, NULL); + match_add(curwin, g, p + 1, 10, id, NULL, NULL); vim_free(g); *end = c; } @@ -11530,37 +12354,37 @@ ex_match(eap) * ":X": Get crypt key */ static void -ex_X(eap) - exarg_T *eap UNUSED; +ex_X(exarg_T *eap UNUSED) { - if (get_crypt_method(curbuf) == 0 || blowfish_self_test() == OK) - (void)get_crypt_key(TRUE, TRUE); + crypt_check_current_method(); + (void)crypt_get_key(TRUE, TRUE); } #endif #ifdef FEAT_FOLDING static void -ex_fold(eap) - exarg_T *eap; +ex_fold(exarg_T *eap) { if (foldManualAllowed(TRUE)) foldCreate(eap->line1, eap->line2); } static void -ex_foldopen(eap) - exarg_T *eap; +ex_foldopen(exarg_T *eap) { opFoldRange(eap->line1, eap->line2, eap->cmdidx == CMD_foldopen, eap->forceit, FALSE); } static void -ex_folddo(eap) - exarg_T *eap; +ex_folddo(exarg_T *eap) { linenr_T lnum; +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif + /* First set the marks for all lines closed/open. */ for (lnum = eap->line1; lnum <= eap->line2; ++lnum) if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed)) @@ -11569,5 +12393,22 @@ ex_folddo(eap) /* Execute the command on the marked lines. */ global_exe(eap->arg); ml_clearmarked(); /* clear rest of the marks */ +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif +} +#endif + +# if defined(FEAT_TIMERS) || defined(PROTO) + int +get_pressedreturn(void) +{ + return ex_pressedreturn; +} + + void +set_pressedreturn(int val) +{ + ex_pressedreturn = val; } #endif diff --git a/src/ex_eval.c b/src/ex_eval.c index 04c31c21f9..f209c5f955 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -15,9 +15,9 @@ #if defined(FEAT_EVAL) || defined(PROTO) -static void free_msglist __ARGS((struct msglist *l)); -static int throw_exception __ARGS((void *, int, char_u *)); -static char_u *get_end_emsg __ARGS((struct condstack *cstack)); +static void free_msglist(struct msglist *l); +static int throw_exception(void *, except_type_T, char_u *); +static char_u *get_end_emsg(struct condstack *cstack); /* * Exception handling terms: @@ -65,10 +65,10 @@ static char_u *get_end_emsg __ARGS((struct condstack *cstack)); # define THROW_ON_INTERRUPT_TRUE #endif -static void catch_exception __ARGS((except_T *excp)); -static void finish_exception __ARGS((except_T *excp)); -static void discard_exception __ARGS((except_T *excp, int was_finished)); -static void report_pending __ARGS((int action, int pending, void *value)); +static void catch_exception(except_T *excp); +static void finish_exception(except_T *excp); +static void discard_exception(except_T *excp, int was_finished); +static void report_pending(int action, int pending, void *value); /* * When several errors appear in a row, setting "force_abort" is delayed until @@ -93,7 +93,7 @@ static int cause_abort = FALSE; * due to a parsing error, aborting() always returns the same value. */ int -aborting() +aborting(void) { return (did_emsg && force_abort) || got_int || did_throw; } @@ -105,7 +105,7 @@ aborting() * error message has been reached. update_force_abort() should be called then. */ void -update_force_abort() +update_force_abort(void) { if (cause_abort) force_abort = TRUE; @@ -118,8 +118,7 @@ update_force_abort() * displayed and actually caused the abortion. */ int -should_abort(retcode) - int retcode; +should_abort(int retcode) { return ((retcode == FAIL && trylevel != 0 && !emsg_silent) || aborting()); } @@ -131,7 +130,7 @@ should_abort(retcode) * commands are still reported. */ int -aborted_in_try() +aborted_in_try(void) { /* This function is only called after an error. In this case, "force_abort" * determines whether searching for finally clauses is necessary. */ @@ -148,10 +147,10 @@ aborted_in_try() * set to TRUE, if a later but severer message should be used instead. */ int -cause_errthrow(mesg, severe, ignore) - char_u *mesg; - int severe; - int *ignore; +cause_errthrow( + char_u *mesg, + int severe, + int *ignore) { struct msglist *elem; struct msglist **plist; @@ -305,8 +304,7 @@ cause_errthrow(mesg, severe, ignore) * Free a "msg_list" and the messages it contains. */ static void -free_msglist(l) - struct msglist *l; +free_msglist(struct msglist *l) { struct msglist *messages, *next; @@ -325,7 +323,7 @@ free_msglist(l) * to NULL. */ void -free_global_msglist() +free_global_msglist(void) { free_msglist(*msg_list); *msg_list = NULL; @@ -337,9 +335,7 @@ free_global_msglist() * has returned (see do_one_cmd()). */ void -do_errthrow(cstack, cmdname) - struct condstack *cstack; - char_u *cmdname; +do_errthrow(struct condstack *cstack, char_u *cmdname) { /* * Ensure that all commands in nested function calls and sourced files @@ -374,8 +370,7 @@ do_errthrow(cstack, cmdname) * FALSE otherwise. */ int -do_intthrow(cstack) - struct condstack *cstack; +do_intthrow(struct condstack *cstack) { /* * If no interrupt occurred or no try conditional is active and no exception @@ -425,11 +420,11 @@ do_intthrow(cstack) * Get an exception message that is to be stored in current_exception->value. */ char_u * -get_exception_string(value, type, cmdname, should_free) - void *value; - int type; - char_u *cmdname; - int *should_free; +get_exception_string( + void *value, + except_type_T type, + char_u *cmdname, + int *should_free) { char_u *ret, *mesg; int cmdlen; @@ -437,7 +432,7 @@ get_exception_string(value, type, cmdname, should_free) if (type == ET_ERROR) { - *should_free = FALSE; + *should_free = TRUE; mesg = ((struct msglist *)value)->throw_msg; if (cmdname != NULL && *cmdname != NUL) { @@ -494,7 +489,7 @@ get_exception_string(value, type, cmdname, should_free) else { *should_free = FALSE; - ret = (char_u *) value; + ret = (char_u *)value; } return ret; @@ -508,10 +503,7 @@ get_exception_string(value, type, cmdname, should_free) * error exception. */ static int -throw_exception(value, type, cmdname) - void *value; - int type; - char_u *cmdname; +throw_exception(void *value, except_type_T type, char_u *cmdname) { except_T *excp; int should_free; @@ -597,15 +589,13 @@ throw_exception(value, type, cmdname) * caught and the catch clause has been ended normally. */ static void -discard_exception(excp, was_finished) - except_T *excp; - int was_finished; +discard_exception(except_T *excp, int was_finished) { char_u *saved_IObuff; if (excp == NULL) { - EMSG(_(e_internal)); + internal_error("discard_exception()"); return; } @@ -648,10 +638,13 @@ discard_exception(excp, was_finished) * Discard the exception currently being thrown. */ void -discard_current_exception() +discard_current_exception(void) { - discard_exception(current_exception, FALSE); - current_exception = NULL; + if (current_exception != NULL) + { + discard_exception(current_exception, FALSE); + current_exception = NULL; + } did_throw = FALSE; need_rethrow = FALSE; } @@ -660,8 +653,7 @@ discard_current_exception() * Put an exception on the caught stack. */ static void -catch_exception(excp) - except_T *excp; +catch_exception(except_T *excp) { excp->caught = caught_stack; caught_stack = excp; @@ -708,11 +700,10 @@ catch_exception(excp) * Remove an exception from the caught stack. */ static void -finish_exception(excp) - except_T *excp; +finish_exception(except_T *excp) { if (excp != caught_stack) - EMSG(_(e_internal)); + internal_error("finish_exception()"); caught_stack = caught_stack->caught; if (caught_stack != NULL) { @@ -758,10 +749,7 @@ finish_exception(excp) * or the exception value for a pending exception. */ static void -report_pending(action, pending, value) - int action; - int pending; - void *value; +report_pending(int action, int pending, void *value) { char_u *mesg; char *s; @@ -841,9 +829,7 @@ report_pending(action, pending, value) * the 'verbose' option or when debugging. */ void -report_make_pending(pending, value) - int pending; - void *value; +report_make_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) { @@ -860,9 +846,7 @@ report_make_pending(pending, value) * it if required by the 'verbose' option or when debugging. */ void -report_resume_pending(pending, value) - int pending; - void *value; +report_resume_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) { @@ -879,9 +863,7 @@ report_resume_pending(pending, value) * by the 'verbose' option or when debugging. */ void -report_discard_pending(pending, value) - int pending; - void *value; +report_discard_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) { @@ -898,8 +880,7 @@ report_discard_pending(pending, value) * ":if". */ void -ex_if(eap) - exarg_T *eap; +ex_if(exarg_T *eap) { int error; int skip; @@ -937,8 +918,7 @@ ex_if(eap) * ":endif". */ void -ex_endif(eap) - exarg_T *eap; +ex_endif(exarg_T *eap) { did_endif = TRUE; if (eap->cstack->cs_idx < 0 @@ -968,8 +948,7 @@ ex_endif(eap) * ":else" and ":elseif". */ void -ex_else(eap) - exarg_T *eap; +ex_else(exarg_T *eap) { int error; int skip; @@ -1060,8 +1039,7 @@ ex_else(eap) * Handle ":while" and ":for". */ void -ex_while(eap) - exarg_T *eap; +ex_while(exarg_T *eap) { int error; int skip; @@ -1160,8 +1138,7 @@ ex_while(eap) * ":continue" */ void -ex_continue(eap) - exarg_T *eap; +ex_continue(exarg_T *eap) { int idx; struct condstack *cstack = eap->cstack; @@ -1199,8 +1176,7 @@ ex_continue(eap) * ":break" */ void -ex_break(eap) - exarg_T *eap; +ex_break(exarg_T *eap) { int idx; struct condstack *cstack = eap->cstack; @@ -1226,8 +1202,7 @@ ex_break(eap) * ":endwhile" and ":endfor" */ void -ex_endwhile(eap) - exarg_T *eap; +ex_endwhile(exarg_T *eap) { struct condstack *cstack = eap->cstack; int idx; @@ -1313,8 +1288,7 @@ ex_endwhile(eap) * ":throw expr" */ void -ex_throw(eap) - exarg_T *eap; +ex_throw(exarg_T *eap) { char_u *arg = eap->arg; char_u *value; @@ -1344,8 +1318,7 @@ ex_throw(eap) * used for rethrowing an uncaught exception. */ void -do_throw(cstack) - struct condstack *cstack; +do_throw(struct condstack *cstack) { int idx; int inactivate_try = FALSE; @@ -1426,8 +1399,7 @@ do_throw(cstack) * ":try" */ void -ex_try(eap) - exarg_T *eap; +ex_try(exarg_T *eap) { int skip; struct condstack *cstack = eap->cstack; @@ -1496,8 +1468,7 @@ ex_try(eap) * ":catch /{pattern}/" and ":catch" */ void -ex_catch(eap) - exarg_T *eap; +ex_catch(exarg_T *eap) { int idx = 0; int give_up = FALSE; @@ -1594,7 +1565,11 @@ ex_catch(eap) } save_cpo = p_cpo; p_cpo = (char_u *)""; + /* Disable error messages, it will make current_exception + * invalid. */ + ++emsg_off; regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + --emsg_off; regmatch.rm_ic = FALSE; if (end != NULL) *end = save_char; @@ -1631,7 +1606,7 @@ ex_catch(eap) * ":break", ":return", ":finish", error, interrupt, or another * exception. */ if (cstack->cs_exception[cstack->cs_idx] != current_exception) - EMSG(_(e_internal)); + internal_error("ex_catch()"); } else { @@ -1657,8 +1632,7 @@ ex_catch(eap) * ":finally" */ void -ex_finally(eap) - exarg_T *eap; +ex_finally(exarg_T *eap) { int idx; int skip = FALSE; @@ -1766,7 +1740,7 @@ ex_finally(eap) * exception will be discarded. */ if (did_throw && cstack->cs_exception[cstack->cs_idx] != current_exception) - EMSG(_(e_internal)); + internal_error("ex_finally()"); } /* @@ -1785,8 +1759,7 @@ ex_finally(eap) * ":endtry" */ void -ex_endtry(eap) - exarg_T *eap; +ex_endtry(exarg_T *eap) { int idx; int skip; @@ -1984,8 +1957,7 @@ ex_endtry(eap) * execution. */ void -enter_cleanup(csp) - cleanup_T *csp; +enter_cleanup(cleanup_T *csp) { int pending = CSTP_NONE; @@ -2009,7 +1981,10 @@ enter_cleanup(csp) * there is an extra instance for every call of do_cmdline(), anyway. */ if (did_throw || need_rethrow) + { csp->exception = current_exception; + current_exception = NULL; + } else { csp->exception = NULL; @@ -2047,8 +2022,7 @@ enter_cleanup(csp) * exception state is discarded. */ void -leave_cleanup(csp) - cleanup_T *csp; +leave_cleanup(cleanup_T *csp) { int pending = csp->pending; @@ -2133,10 +2107,10 @@ leave_cleanup(csp) * when such a try conditional is left. */ int -cleanup_conditionals(cstack, searched_cond, inclusive) - struct condstack *cstack; - int searched_cond; - int inclusive; +cleanup_conditionals( + struct condstack *cstack, + int searched_cond, + int inclusive) { int idx; int stop = FALSE; @@ -2256,8 +2230,7 @@ cleanup_conditionals(cstack, searched_cond, inclusive) * Return an appropriate error message for a missing endwhile/endfor/endif. */ static char_u * -get_end_emsg(cstack) - struct condstack *cstack; +get_end_emsg(struct condstack *cstack) { if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE) return e_endwhile; @@ -2275,11 +2248,11 @@ get_end_emsg(cstack) * Also free "for info" structures where needed. */ void -rewind_conditionals(cstack, idx, cond_type, cond_level) - struct condstack *cstack; - int idx; - int cond_type; - int *cond_level; +rewind_conditionals( + struct condstack *cstack, + int idx, + int cond_type, + int *cond_level) { while (cstack->cs_idx > idx) { @@ -2295,8 +2268,7 @@ rewind_conditionals(cstack, idx, cond_type, cond_level) * ":endfunction" when not after a ":function" */ void -ex_endfunction(eap) - exarg_T *eap UNUSED; +ex_endfunction(exarg_T *eap UNUSED) { EMSG(_("E193: :endfunction not inside a function")); } @@ -2305,8 +2277,7 @@ ex_endfunction(eap) * Return TRUE if the string "p" looks like a ":while" or ":for" command. */ int -has_loop_cmd(p) - char_u *p; +has_loop_cmd(char_u *p) { int len; diff --git a/src/ex_getln.c b/src/ex_getln.c index b5fa737c0a..71673cfccd 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -52,12 +52,17 @@ static int cmd_showtail; /* Only show path tail in lists ? */ static int new_cmdpos; /* position set by set_cmdline_pos() */ #endif +static int extra_char = NUL; /* extra character to display when redrawing + * the command line */ +static int extra_char_shift; + #ifdef FEAT_CMDHIST typedef struct hist_entry { int hisnum; /* identifying number */ int viminfo; /* when TRUE hisstr comes from viminfo */ char_u *hisstr; /* actual entry, separator char after the NUL */ + time_t time_set; /* when it was typed, zero if unknown */ } histentry_T; static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL}; @@ -66,11 +71,11 @@ static int hisnum[HIST_COUNT] = {0, 0, 0, 0, 0}; /* identifying (unique) number of newest history entry */ static int hislen = 0; /* actual length of history tables */ -static int hist_char2type __ARGS((int c)); +static int hist_char2type(int c); -static int in_history __ARGS((int, char_u *, int, int, int)); +static int in_history(int, char_u *, int, int, int); # ifdef FEAT_EVAL -static int calc_hist_idx __ARGS((int histype, int num)); +static int calc_hist_idx(int histype, int num); # endif #endif @@ -82,50 +87,51 @@ static int cmd_hkmap = 0; /* Hebrew mapping during command line */ static int cmd_fkmap = 0; /* Farsi mapping during command line */ #endif -static int cmdline_charsize __ARGS((int idx)); -static void set_cmdspos __ARGS((void)); -static void set_cmdspos_cursor __ARGS((void)); +static int cmdline_charsize(int idx); +static void set_cmdspos(void); +static void set_cmdspos_cursor(void); #ifdef FEAT_MBYTE -static void correct_cmdspos __ARGS((int idx, int cells)); -#endif -static void alloc_cmdbuff __ARGS((int len)); -static int realloc_cmdbuff __ARGS((int len)); -static void draw_cmdline __ARGS((int start, int len)); -static void save_cmdline __ARGS((struct cmdline_info *ccp)); -static void restore_cmdline __ARGS((struct cmdline_info *ccp)); -static int cmdline_paste __ARGS((int regname, int literally, int remcr)); +static void correct_cmdspos(int idx, int cells); +#endif +static void alloc_cmdbuff(int len); +static int realloc_cmdbuff(int len); +static void draw_cmdline(int start, int len); +static void save_cmdline(struct cmdline_info *ccp); +static void restore_cmdline(struct cmdline_info *ccp); +static int cmdline_paste(int regname, int literally, int remcr); #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) -static void redrawcmd_preedit __ARGS((void)); +static void redrawcmd_preedit(void); #endif #ifdef FEAT_WILDMENU -static void cmdline_del __ARGS((int from)); -#endif -static void redrawcmdprompt __ARGS((void)); -static void cursorcmd __ARGS((void)); -static int ccheck_abbr __ARGS((int)); -static int nextwild __ARGS((expand_T *xp, int type, int options, int escape)); -static void escape_fname __ARGS((char_u **pp)); -static int showmatches __ARGS((expand_T *xp, int wildmenu)); -static void set_expand_context __ARGS((expand_T *xp)); -static int ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***, int)); -static int expand_showtail __ARGS((expand_T *xp)); +static void cmdline_del(int from); +#endif +static void redrawcmdprompt(void); +static void cursorcmd(void); +static int ccheck_abbr(int); +static int nextwild(expand_T *xp, int type, int options, int escape); +static void escape_fname(char_u **pp); +static int showmatches(expand_T *xp, int wildmenu); +static void set_expand_context(expand_T *xp); +static int ExpandFromContext(expand_T *xp, char_u *, int *, char_u ***, int); +static int expand_showtail(expand_T *xp); #ifdef FEAT_CMDL_COMPL -static int expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg)); -static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname[])); +static int expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int flagsarg); +static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file, char *dirname[]); +static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file); # ifdef FEAT_CMDHIST -static char_u *get_history_arg __ARGS((expand_T *xp, int idx)); +static char_u *get_history_arg(expand_T *xp, int idx); # endif # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) -static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)); -static int ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file)); +static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file); +static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file); # endif #endif #ifdef FEAT_CMDHIST -static void clear_hist_entry __ARGS((histentry_T *hisptr)); +static void clear_hist_entry(histentry_T *hisptr); #endif #ifdef FEAT_CMDWIN -static int ex_window __ARGS((void)); +static int open_cmdwin(void); #endif #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -133,7 +139,91 @@ static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_func_compare __ARGS((const void *s1, const void *s2)); +sort_func_compare(const void *s1, const void *s2); +#endif +#ifdef FEAT_SEARCH_EXTRA +static void set_search_match(pos_T *t); +#endif + + + static void +trigger_cmd_autocmd(int typechar, int evt) +{ + char_u typestr[2]; + + typestr[0] = typechar; + typestr[1] = NUL; + apply_autocmds(evt, typestr, typestr, FALSE, curbuf); +} + +/* + * Abandon the command line. + */ + static void +abandon_cmdline(void) +{ + VIM_CLEAR(ccline.cmdbuff); + if (msg_scrolled == 0) + compute_cmdrow(); + MSG(""); + redraw_cmdline = TRUE; +} + +#ifdef FEAT_SEARCH_EXTRA +/* + * Guess that the pattern matches everything. Only finds specific cases, such + * as a trailing \|, which can happen while typing a pattern. + */ + static int +empty_pattern(char_u *p) +{ + size_t n = STRLEN(p); + + /* remove trailing \v and the like */ + while (n >= 2 && p[n - 2] == '\\' + && vim_strchr((char_u *)"mMvVcCZ", p[n - 1]) != NULL) + n -= 2; + return n == 0 || (n >= 2 && p[n - 2] == '\\' && p[n - 1] == '|'); +} +#endif + +#ifdef FEAT_SEARCH_EXTRA +typedef struct { + colnr_T vs_curswant; + colnr_T vs_leftcol; + linenr_T vs_topline; +# ifdef FEAT_DIFF + int vs_topfill; +# endif + linenr_T vs_botline; + linenr_T vs_empty_rows; +} viewstate_T; + + static void +save_viewstate(viewstate_T *vs) +{ + vs->vs_curswant = curwin->w_curswant; + vs->vs_leftcol = curwin->w_leftcol; + vs->vs_topline = curwin->w_topline; +# ifdef FEAT_DIFF + vs->vs_topfill = curwin->w_topfill; +# endif + vs->vs_botline = curwin->w_botline; + vs->vs_empty_rows = curwin->w_empty_rows; +} + + static void +restore_viewstate(viewstate_T *vs) +{ + curwin->w_curswant = vs->vs_curswant; + curwin->w_leftcol = vs->vs_leftcol; + curwin->w_topline = vs->vs_topline; +# ifdef FEAT_DIFF + curwin->w_topfill = vs->vs_topfill; +# endif + curwin->w_botline = vs->vs_botline; + curwin->w_empty_rows = vs->vs_empty_rows; +} #endif /* @@ -156,10 +246,10 @@ sort_func_compare __ARGS((const void *s1, const void *s2)); * otherwise. */ char_u * -getcmdline(firstc, count, indent) - int firstc; - long count UNUSED; /* only used for incremental search */ - int indent; /* indent for inside conditionals */ +getcmdline( + int firstc, + long count UNUSED, /* only used for incremental search */ + int indent) /* indent for inside conditionals */ { int c; int i; @@ -172,14 +262,12 @@ getcmdline(firstc, count, indent) int histype; /* history type to be used */ #endif #ifdef FEAT_SEARCH_EXTRA - pos_T old_cursor; - colnr_T old_curswant; - colnr_T old_leftcol; - linenr_T old_topline; -# ifdef FEAT_DIFF - int old_topfill; -# endif - linenr_T old_botline; + pos_T search_start; /* where 'incsearch' starts searching */ + pos_T save_cursor; + viewstate_T init_viewstate; + viewstate_T old_viewstate; + pos_T match_start = curwin->w_cursor; + pos_T match_end; int did_incsearch = FALSE; int incsearch_postponed = FALSE; #endif @@ -205,9 +293,17 @@ getcmdline(firstc, count, indent) * custom status line may invoke ":normal". */ struct cmdline_info save_ccline; #endif + int cmdline_type; +#ifdef USE_MIGEMO + int migemo_enabled = 0; +#endif -#ifdef FEAT_SNIFF - want_sniff_request = 0; +#ifdef USE_MIGEMO + if (count < 0) + { + migemo_enabled = 1; + count = -count - 1; + } #endif #ifdef FEAT_EVAL if (firstc == -1) @@ -224,14 +320,11 @@ getcmdline(firstc, count, indent) ccline.overstrike = FALSE; /* always start in insert mode */ #ifdef FEAT_SEARCH_EXTRA - old_cursor = curwin->w_cursor; /* needs to be restored later */ - old_curswant = curwin->w_curswant; - old_leftcol = curwin->w_leftcol; - old_topline = curwin->w_topline; -# ifdef FEAT_DIFF - old_topfill = curwin->w_topfill; -# endif - old_botline = curwin->w_botline; + CLEAR_POS(&match_end); + save_cursor = curwin->w_cursor; /* may be restored later */ + search_start = curwin->w_cursor; + save_viewstate(&init_viewstate); + save_viewstate(&old_viewstate); #endif /* @@ -246,11 +339,12 @@ getcmdline(firstc, count, indent) return NULL; /* out of memory */ ccline.cmdlen = ccline.cmdpos = 0; ccline.cmdbuff[0] = NUL; + sb_text_start_cmdline(); /* autoindent for :insert and :append */ if (firstc <= 0) { - copy_spaces(ccline.cmdbuff, indent); + vim_memset(ccline.cmdbuff, ' ', indent); ccline.cmdbuff[indent] = NUL; ccline.cmdpos = indent; ccline.cmdspos = indent; @@ -312,11 +406,11 @@ getcmdline(firstc, count, indent) b_im_ptr = &curbuf->b_p_imsearch; if (*b_im_ptr == B_IMODE_LMAP) State |= LANGMAP; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD im_set_active(*b_im_ptr == B_IMODE_IM); #endif } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD else if (p_imcmdline) im_set_active(TRUE); #endif @@ -332,6 +426,10 @@ getcmdline(firstc, count, indent) * terminal mode set to cooked. Need to set raw mode here then. */ settmode(TMODE_RAW); + /* Trigger CmdlineEnter autocommands. */ + cmdline_type = firstc == NUL ? '-' : firstc; + trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER); + #ifdef FEAT_CMDHIST init_history(); hiscnt = hislen; /* set hiscnt to impossible history value */ @@ -362,14 +460,18 @@ getcmdline(firstc, count, indent) #endif quit_more = FALSE; /* reset after CTRL-D which had a more-prompt */ + did_emsg = FALSE; /* There can't really be a reason why an error + that occurs while typing a command should + cause the command not to be executed. */ + cursorcmd(); /* set the cursor on the right spot */ - /* Get a character. Ignore K_IGNORE, it should not do anything, such - * as stop completion. */ + /* Get a character. Ignore K_IGNORE and K_NOP, they should not do + * anything, such as stop completion. */ do { c = safe_vgetc(); - } while (c == K_IGNORE); + } while (c == K_IGNORE || c == K_NOP); if (KeyTyped) { @@ -429,10 +531,7 @@ getcmdline(firstc, count, indent) && c != K_KPAGEDOWN && c != K_KPAGEUP && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) - { - vim_free(lookfor); - lookfor = NULL; - } + VIM_CLEAR(lookfor); #endif /* @@ -502,11 +601,7 @@ getcmdline(firstc, count, indent) } else { -# ifdef FEAT_VERTSPLIT win_redraw_last_status(topframe); -# else - lastwin->w_redr_status = TRUE; -# endif redraw_statuslines(); } KeyTyped = skt; @@ -626,8 +721,8 @@ getcmdline(firstc, count, indent) #endif if (vim_ispathsep(ccline.cmdbuff[j]) #ifdef BACKSLASH_IN_FILENAME - && vim_strchr(" *?[{`$%#", ccline.cmdbuff[j + 1]) - == NULL + && vim_strchr((char_u *)" *?[{`$%#", + ccline.cmdbuff[j + 1]) == NULL #endif ) { @@ -759,11 +854,14 @@ getcmdline(firstc, count, indent) #ifdef FEAT_CMDWIN if (c == cedit_key || c == K_CMDWIN) { - /* - * Open a window to edit the command line (and history). - */ - c = ex_window(); - some_key_typed = TRUE; + if (ex_normal_busy == 0 && got_int == FALSE) + { + /* + * Open a window to edit the command line (and history). + */ + c = open_cmdwin(); + some_key_typed = TRUE; + } } # ifdef FEAT_DIGRAPHS else @@ -897,7 +995,7 @@ getcmdline(firstc, count, indent) firstc != '@'); } else - vim_beep(); + vim_beep(BO_WILD); } #ifdef FEAT_WILDMENU else if (xpc.xp_numfiles == -1) @@ -998,6 +1096,15 @@ getcmdline(firstc, count, indent) /* Truncate at the end, required for multi-byte chars. */ ccline.cmdbuff[ccline.cmdlen] = NUL; +#ifdef FEAT_SEARCH_EXTRA + if (ccline.cmdlen == 0) + { + search_start = save_cursor; + /* save view settings, so that the screen + * won't be restored at the wrong position */ + old_viewstate = init_viewstate; + } +#endif redrawcmd(); } else if (ccline.cmdlen == 0 && c != Ctrl_W @@ -1011,8 +1118,7 @@ getcmdline(firstc, count, indent) ) goto cmdline_not_changed; - vim_free(ccline.cmdbuff); /* no commandline to return */ - ccline.cmdbuff = NULL; + VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */ if (!cmd_silent) { #ifdef FEAT_RIGHTLEFT @@ -1023,6 +1129,10 @@ getcmdline(firstc, count, indent) msg_col = 0; msg_putchar(' '); /* delete ':' */ } +#ifdef FEAT_SEARCH_EXTRA + if (ccline.cmdlen == 0) + search_start = save_cursor; +#endif redraw_cmdline = TRUE; goto returncmd; /* back to cmd mode */ } @@ -1048,7 +1158,7 @@ getcmdline(firstc, count, indent) { /* ":lmap" mappings exists, toggle use of mappings. */ State ^= LANGMAP; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD im_set_active(FALSE); /* Disable input method */ #endif if (b_im_ptr != NULL) @@ -1059,7 +1169,7 @@ getcmdline(firstc, count, indent) *b_im_ptr = B_IMODE_NONE; } } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM. When @@ -1090,7 +1200,7 @@ getcmdline(firstc, count, indent) #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) +#if defined(FEAT_KEYMAP) /* Show/unshow value of 'keymap' in status lines later. */ status_redraw_curbuf(); #endif @@ -1106,6 +1216,10 @@ getcmdline(firstc, count, indent) ccline.cmdbuff[i++] = ccline.cmdbuff[j++]; /* Truncate at the end, required for multi-byte chars. */ ccline.cmdbuff[ccline.cmdlen] = NUL; +#ifdef FEAT_SEARCH_EXTRA + if (ccline.cmdlen == 0) + search_start = save_cursor; +#endif redrawcmd(); goto cmdline_changed; @@ -1126,10 +1240,7 @@ getcmdline(firstc, count, indent) /* In exmode it doesn't make sense to return. Except when * ":normal" runs out of characters. */ if (exmode_active -#ifdef FEAT_EX_EXTRA - && (ex_normal_busy == 0 || typebuf.tb_len > 0) -#endif - ) + && (ex_normal_busy == 0 || typebuf.tb_len > 0)) goto cmdline_not_changed; gotesc = TRUE; /* will free ccline.cmdbuff after @@ -1147,6 +1258,7 @@ getcmdline(firstc, count, indent) i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */ if (i == Ctrl_R) c = plain_vgetc(); /* CTRL-R CTRL-R <char> */ + extra_char = NUL; --no_mapping; #ifdef FEAT_EVAL /* @@ -1260,7 +1372,7 @@ getcmdline(firstc, count, indent) goto cmdline_not_changed; case K_IGNORE: - /* Ignore mouse event or ex_window() result. */ + /* Ignore mouse event or open_cmdwin() result. */ goto cmdline_not_changed; #ifdef FEAT_GUI_W32 @@ -1379,6 +1491,7 @@ getcmdline(firstc, count, indent) case K_X2MOUSE: case K_X2DRAG: case K_X2RELEASE: + case K_MOUSEMOVE: goto cmdline_not_changed; # ifdef FEAT_GUI_MACVIM @@ -1453,26 +1566,31 @@ getcmdline(firstc, count, indent) if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) { /* Add a character from under the cursor for 'incsearch' */ - if (did_incsearch - && !equalpos(curwin->w_cursor, old_cursor)) + if (did_incsearch) { - c = gchar_cursor(); - /* If 'ignorecase' and 'smartcase' are set and the - * command line has no uppercase characters, convert - * the character to lowercase */ - if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff)) - c = MB_TOLOWER(c); - if (c != NUL) + curwin->w_cursor = match_end; + if (!EQUAL_POS(curwin->w_cursor, search_start)) { - if (c == firstc || vim_strchr((char_u *)( - p_magic ? "\\^$.*[" : "\\^$"), c) - != NULL) + c = gchar_cursor(); + /* If 'ignorecase' and 'smartcase' are set and the + * command line has no uppercase characters, convert + * the character to lowercase */ + if (p_ic && p_scs + && !pat_has_uppercase(ccline.cmdbuff)) + c = MB_TOLOWER(c); + if (c != NUL) { - /* put a backslash before special characters */ - stuffcharReadbuff(c); - c = '\\'; + if (c == firstc || vim_strchr((char_u *)( + p_magic ? "\\~^$.*[" : "\\^$"), c) + != NULL) + { + /* put a backslash before special + * characters */ + stuffcharReadbuff(c); + c = '\\'; + } + break; } - break; } } goto cmdline_not_changed; @@ -1491,10 +1609,10 @@ getcmdline(firstc, count, indent) if (nextwild(&xpc, (c == Ctrl_P) ? WILD_PREV : WILD_NEXT, 0, firstc != '@') == FAIL) break; - goto cmdline_changed; + goto cmdline_not_changed; } - #ifdef FEAT_CMDHIST + /* FALLTHROUGH */ case K_UP: case K_DOWN: case K_S_UP: @@ -1636,7 +1754,99 @@ getcmdline(firstc, count, indent) goto cmdline_changed; } beep_flush(); +#endif goto cmdline_not_changed; + +#ifdef FEAT_SEARCH_EXTRA + case Ctrl_G: /* next match */ + case Ctrl_T: /* previous match */ + if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) + { + pos_T t; + char_u *pat; + int search_flags = SEARCH_NOOF; + + if (ccline.cmdlen == 0) + goto cmdline_not_changed; + + if (firstc == ccline.cmdbuff[0]) + pat = last_search_pattern(); + else + pat = ccline.cmdbuff; + + save_last_search_pattern(); + cursor_off(); + out_flush(); + if (c == Ctrl_G) + { + t = match_end; + if (LT_POS(match_start, match_end)) + /* start searching at the end of the match + * not at the beginning of the next column */ + (void)decl(&t); + search_flags += SEARCH_COL; + } + else + t = match_start; + if (!p_hls) + search_flags += SEARCH_KEEP; + ++emsg_off; +#ifdef USE_MIGEMO + if (migemo_enabled) + search_flags += SEARCH_MIGEMO; +#endif + i = searchit(curwin, curbuf, &t, + c == Ctrl_G ? FORWARD : BACKWARD, + pat, count, search_flags, + RE_SEARCH, 0, NULL, NULL); + --emsg_off; + if (i) + { + search_start = match_start; + match_end = t; + match_start = t; + if (c == Ctrl_T && firstc == '/') + { + /* move just before the current match, so that + * when nv_search finishes the cursor will be + * put back on the match */ + search_start = t; + (void)decl(&search_start); + } + else if (c == Ctrl_G && firstc == '?') + { + /* move just after the current match, so that + * when nv_search finishes the cursor will be + * put back on the match */ + search_start = t; + (void)incl(&search_start); + } + if (LT_POS(t, search_start) && c == Ctrl_G) + { + /* wrap around */ + search_start = t; + if (firstc == '?') + (void)incl(&search_start); + else + (void)decl(&search_start); + } + + set_search_match(&match_end); + curwin->w_cursor = match_start; + changed_cline_bef_curs(); + update_topline(); + validate_cursor(); + highlight_match = TRUE; + save_viewstate(&old_viewstate); + update_screen(NOT_VALID); + redrawcmdline(); + } + else + vim_beep(BO_ERROR); + restore_last_search_pattern(); + goto cmdline_not_changed; + } + break; #endif case Ctrl_V: @@ -1647,6 +1857,7 @@ getcmdline(firstc, count, indent) putcmdline('^', TRUE); c = get_literal(); /* get next (two) character(s) */ do_abbr = FALSE; /* don't do abbreviation now */ + extra_char = NUL; #ifdef FEAT_MBYTE /* may need to remove ^ when composing char was typed */ if (enc_utf8 && utf_iscomposing(c) && !cmd_silent) @@ -1668,6 +1879,7 @@ getcmdline(firstc, count, indent) dont_scroll = TRUE; /* disallow scrolling here */ #endif c = get_digraph(TRUE); + extra_char = NUL; if (c != NUL) break; @@ -1679,7 +1891,7 @@ getcmdline(firstc, count, indent) case Ctrl__: /* CTRL-_: switch language mode */ if (!p_ari) break; -#ifdef FEAT_FKMAP +# ifdef FEAT_FKMAP if (p_altkeymap) { cmd_fkmap = !cmd_fkmap; @@ -1687,11 +1899,15 @@ getcmdline(firstc, count, indent) ccline.overstrike = FALSE; } else /* Hebrew is default */ -#endif +# endif cmd_hkmap = !cmd_hkmap; goto cmdline_not_changed; #endif + case K_PS: + bracketed_paste(PASTE_CMDLINE, FALSE, NULL); + goto cmdline_changed; + default: #ifdef UNIX if (c == intr_char) @@ -1762,6 +1978,9 @@ getcmdline(firstc, count, indent) #endif cmdline_changed: + /* Trigger CmdlineChanged autocommands. */ + trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); + #ifdef FEAT_SEARCH_EXTRA /* * 'incsearch' highlighting. @@ -1780,26 +1999,38 @@ getcmdline(firstc, count, indent) continue; } incsearch_postponed = FALSE; - curwin->w_cursor = old_cursor; /* start at old position */ + curwin->w_cursor = search_start; /* start at old position */ + save_last_search_pattern(); /* If there is no command line, don't do anything */ if (ccline.cmdlen == 0) + { i = 0; + set_no_hlsearch(TRUE); /* turn off previous highlight */ + redraw_all_later(SOME_VALID); + } else { + int search_flags = SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK; cursor_off(); /* so the user knows we're busy */ out_flush(); ++emsg_off; /* So it doesn't beep if bad expr */ +#ifdef USE_MIGEMO + if (migemo_enabled) + search_flags += SEARCH_MIGEMO; +#endif #ifdef FEAT_RELTIME /* Set the time limit to half a second. */ profile_setlimit(500L, &tm); #endif + if (!p_hls) + search_flags += SEARCH_KEEP; i = do_search(NULL, firstc, ccline.cmdbuff, count, - SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK, + search_flags, #ifdef FEAT_RELTIME - &tm + &tm, NULL #else - NULL + NULL, NULL #endif ); --emsg_off; @@ -1821,12 +2052,7 @@ getcmdline(firstc, count, indent) /* first restore the old curwin values, so the screen is * positioned in the same way as the actual search command */ - curwin->w_leftcol = old_leftcol; - curwin->w_topline = old_topline; -# ifdef FEAT_DIFF - curwin->w_topfill = old_topfill; -# endif - curwin->w_botline = old_botline; + restore_viewstate(&old_viewstate); changed_cline_bef_curs(); update_topline(); @@ -1834,34 +2060,30 @@ getcmdline(firstc, count, indent) { pos_T save_pos = curwin->w_cursor; - /* - * First move cursor to end of match, then to the start. This - * moves the whole match onto the screen when 'nowrap' is set. - */ - curwin->w_cursor.lnum += search_match_lines; - curwin->w_cursor.col = search_match_endcol; - if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) - { - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; - coladvance((colnr_T)MAXCOL); - } + match_start = curwin->w_cursor; + set_search_match(&curwin->w_cursor); validate_cursor(); end_pos = curwin->w_cursor; + match_end = end_pos; curwin->w_cursor = save_pos; } else end_pos = curwin->w_cursor; /* shutup gcc 4 */ + /* Disable 'hlsearch' highlighting if the pattern matches + * everything. Avoids a flash when typing "foo\|". */ + if (empty_pattern(ccline.cmdbuff)) + set_no_hlsearch(TRUE); + validate_cursor(); -# ifdef FEAT_WINDOWS /* May redraw the status line to show the cursor position. */ if (p_ru && curwin->w_status_height > 0) curwin->w_redr_status = TRUE; -# endif save_cmdline(&save_ccline); update_screen(SOME_VALID); restore_cmdline(&save_ccline); + restore_last_search_pattern(); /* Leave it at the end to make CTRL-R CTRL-W work. */ if (i != 0) @@ -1906,17 +2128,22 @@ getcmdline(firstc, count, indent) #ifdef FEAT_SEARCH_EXTRA if (did_incsearch) { - curwin->w_cursor = old_cursor; - curwin->w_curswant = old_curswant; - curwin->w_leftcol = old_leftcol; - curwin->w_topline = old_topline; -# ifdef FEAT_DIFF - curwin->w_topfill = old_topfill; -# endif - curwin->w_botline = old_botline; + if (gotesc) + curwin->w_cursor = save_cursor; + else + { + if (!EQUAL_POS(save_cursor, search_start)) + { + /* put the '" mark at the original position */ + curwin->w_cursor = save_cursor; + setpcmark(); + } + curwin->w_cursor = search_start; + } + restore_viewstate(&old_viewstate); highlight_match = FALSE; validate_cursor(); /* needed for TAB */ - redraw_later(SOME_VALID); + redraw_all_later(SOME_VALID); } #endif @@ -1939,15 +2166,8 @@ getcmdline(firstc, count, indent) } #endif - if (gotesc) /* abandon command line */ - { - vim_free(ccline.cmdbuff); - ccline.cmdbuff = NULL; - if (msg_scrolled == 0) - compute_cmdrow(); - MSG(""); - redraw_cmdline = TRUE; - } + if (gotesc) + abandon_cmdline(); } /* @@ -1963,8 +2183,11 @@ getcmdline(firstc, count, indent) if (some_key_typed) need_wait_return = FALSE; + /* Trigger CmdlineLeave autocommands. */ + trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); + State = save_State; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) im_save_status(b_im_ptr); im_set_active(FALSE); @@ -1975,6 +2198,7 @@ getcmdline(firstc, count, indent) #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif + sb_text_end_cmdline(); { char_u *p = ccline.cmdbuff; @@ -1993,16 +2217,17 @@ getcmdline(firstc, count, indent) * Returns the command line in allocated memory, or NULL. */ char_u * -getcmdline_prompt(firstc, prompt, attr, xp_context, xp_arg) - int firstc; - char_u *prompt; /* command line prompt */ - int attr; /* attributes for prompt */ - int xp_context; /* type of expansion */ - char_u *xp_arg; /* user-defined expansion argument */ +getcmdline_prompt( + int firstc, + char_u *prompt, /* command line prompt */ + int attr, /* attributes for prompt */ + int xp_context, /* type of expansion */ + char_u *xp_arg) /* user-defined expansion argument */ { char_u *s; struct cmdline_info save_ccline; int msg_col_save = msg_col; + int msg_silent_save = msg_silent; save_cmdline(&save_ccline); ccline.cmdprompt = prompt; @@ -2012,8 +2237,10 @@ getcmdline_prompt(firstc, prompt, attr, xp_context, xp_arg) ccline.xp_arg = xp_arg; ccline.input_fn = (firstc == '@'); # endif + msg_silent = 0; s = getcmdline(firstc, 1L, 0); restore_cmdline(&save_ccline); + msg_silent = msg_silent_save; /* Restore msg_col, the prompt from input() may have changed it. * But only if called recursively and the commandline is therefore being * restored to an old one; if not, the input() prompt stays on the screen, @@ -2031,7 +2258,7 @@ getcmdline_prompt(firstc, prompt, attr, xp_context, xp_arg) * 'balloonexpr', etc. */ int -text_locked() +text_locked(void) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -2045,23 +2272,27 @@ text_locked() * window is open or editing the cmdline in another way. */ void -text_locked_msg() +text_locked_msg(void) +{ + EMSG(_(get_text_locked_msg())); +} + + char_u * +get_text_locked_msg(void) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0) - EMSG(_(e_cmdwin)); - else + return e_cmdwin; #endif - EMSG(_(e_secure)); + return e_secure; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is * and give an error message. */ int -curbuf_locked() +curbuf_locked(void) { if (curbuf_lock > 0) { @@ -2076,7 +2307,7 @@ curbuf_locked() * message. */ int -allbuf_locked() +allbuf_locked(void) { if (allbuf_lock > 0) { @@ -2085,11 +2316,9 @@ allbuf_locked() } return FALSE; } -#endif static int -cmdline_charsize(idx) - int idx; +cmdline_charsize(int idx) { #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) if (cmdline_star > 0) /* showing '*', always 1 position */ @@ -2103,7 +2332,7 @@ cmdline_charsize(idx) * indent. */ static void -set_cmdspos() +set_cmdspos(void) { if (ccline.cmdfirstc != NUL) ccline.cmdspos = 1 + ccline.cmdindent; @@ -2115,7 +2344,7 @@ set_cmdspos() * Compute the screen position for the cursor on the command line. */ static void -set_cmdspos_cursor() +set_cmdspos_cursor(void) { int i, m, c; @@ -2156,9 +2385,7 @@ set_cmdspos_cursor() * character that doesn't fit, so that a ">" must be displayed. */ static void -correct_cmdspos(idx, cells) - int idx; - int cells; +correct_cmdspos(int idx, int cells) { if ((*mb_ptr2len)(ccline.cmdbuff + idx) > 1 && (*mb_ptr2cells)(ccline.cmdbuff + idx) > 1 @@ -2171,10 +2398,10 @@ correct_cmdspos(idx, cells) * Get an Ex command line for the ":" command. */ char_u * -getexline(c, cookie, indent) - int c; /* normally ':', NUL for ":append" */ - void *cookie UNUSED; - int indent; /* indent for inside conditionals */ +getexline( + int c, /* normally ':', NUL for ":append" */ + void *cookie UNUSED, + int indent) /* indent for inside conditionals */ { /* When executing a register, remove ':' that's in front of each line. */ if (exec_from_reg && vpeekc() == ':') @@ -2189,11 +2416,11 @@ getexline(c, cookie, indent) * Returns a string in allocated memory or NULL. */ char_u * -getexmodeline(promptc, cookie, indent) - int promptc; /* normally ':', NUL for ":append" and '?' for +getexmodeline( + int promptc, /* normally ':', NUL for ":append" and '?' for :s prompt */ - void *cookie UNUSED; - int indent; /* indent for inside conditionals */ + void *cookie UNUSED, + int indent) /* indent for inside conditionals */ { garray_T line_ga; char_u *pend; @@ -2250,13 +2477,22 @@ getexmodeline(promptc, cookie, indent) got_int = FALSE; while (!got_int) { + long sw; + char_u *s; + if (ga_grow(&line_ga, 40) == FAIL) break; - /* Get one character at a time. Don't use inchar(), it can't handle - * special characters. */ + /* + * Get one character at a time. + */ prev_char = c1; - c1 = vgetc(); + + /* Check for a ":normal" command and no more characters left. */ + if (ex_normal_busy > 0 && typebuf.tb_len == 0) + c1 = '\n'; + else + c1 = vgetc(); /* * Handle line editing. @@ -2269,6 +2505,12 @@ getexmodeline(promptc, cookie, indent) break; } + if (c1 == K_PS) + { + bracketed_paste(PASTE_EX, FALSE, &line_ga); + goto redraw; + } + if (!escaped) { /* CR typed means "enter", which is NL */ @@ -2301,13 +2543,12 @@ getexmodeline(promptc, cookie, indent) msg_col = startcol; msg_clr_eos(); line_ga.ga_len = 0; - continue; + goto redraw; } if (c1 == Ctrl_T) { - long sw = get_sw_value(curbuf); - + sw = get_sw_value(curbuf); p = (char_u *)line_ga.ga_data; p[line_ga.ga_len] = NUL; indent = get_indent_str(p, 8, FALSE); @@ -2315,9 +2556,9 @@ getexmodeline(promptc, cookie, indent) add_indent: while (get_indent_str(p, 8, FALSE) < indent) { - char_u *s = skipwhite(p); - - ga_grow(&line_ga, 1); + (void)ga_grow(&line_ga, 2); /* one more for the NUL */ + p = (char_u *)line_ga.ga_data; + s = skipwhite(p); mch_memmove(s + 1, s, line_ga.ga_len - (s - p) + 1); *s = ' '; ++line_ga.ga_len; @@ -2366,13 +2607,15 @@ getexmodeline(promptc, cookie, indent) { p[line_ga.ga_len] = NUL; indent = get_indent_str(p, 8, FALSE); - --indent; - indent -= indent % get_sw_value(curbuf); + if (indent > 0) + { + --indent; + indent -= indent % get_sw_value(curbuf); + } } while (get_indent_str(p, 8, FALSE) > indent) { - char_u *s = skipwhite(p); - + s = skipwhite(p); mch_memmove(s - 1, s, line_ga.ga_len - (s - p) + 1); --line_ga.ga_len; } @@ -2474,7 +2717,7 @@ getexmodeline(promptc, cookie, indent) * Return TRUE if ccline.overstrike is on. */ int -cmdline_overstrike() +cmdline_overstrike(void) { return ccline.overstrike; } @@ -2483,7 +2726,7 @@ cmdline_overstrike() * Return TRUE if the cursor is at the end of the cmdline. */ int -cmdline_at_end() +cmdline_at_end(void) { return (ccline.cmdpos >= ccline.cmdlen); } @@ -2496,7 +2739,7 @@ cmdline_at_end() * This is used by the IM code to obtain the start of the preedit string. */ colnr_T -cmdline_getvcol_cursor() +cmdline_getvcol_cursor(void) { if (ccline.cmdbuff == NULL || ccline.cmdpos > ccline.cmdlen) return MAXCOL; @@ -2524,7 +2767,7 @@ cmdline_getvcol_cursor() * IM feedback attributes. The cursor position is restored after drawing. */ static void -redrawcmd_preedit() +redrawcmd_preedit(void) { if ((State & CMDLINE) # ifndef FEAT_GUI_MACVIM @@ -2598,8 +2841,7 @@ redrawcmd_preedit() * Returns the new value of ccline.cmdbuff and ccline.cmdbufflen. */ static void -alloc_cmdbuff(len) - int len; +alloc_cmdbuff(int len) { /* * give some extra space to avoid having to allocate all the time @@ -2618,8 +2860,7 @@ alloc_cmdbuff(len) * return FAIL for failure, OK otherwise */ static int -realloc_cmdbuff(len) - int len; +realloc_cmdbuff(int len) { char_u *p; @@ -2660,7 +2901,7 @@ static char_u *arshape_buf = NULL; # if defined(EXITFREE) || defined(PROTO) void -free_cmdline_buf() +free_cmdline_buf(void) { vim_free(arshape_buf); } @@ -2672,9 +2913,7 @@ free_cmdline_buf() * when cmdline_star is TRUE. */ static void -draw_cmdline(start, len) - int start; - int len; +draw_cmdline(int start, int len) { #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) int i; @@ -2795,9 +3034,7 @@ draw_cmdline(start, len) * "c" must be printable (fit in one display cell)! */ void -putcmdline(c, shift) - int c; - int shift; +putcmdline(int c, int shift) { if (cmd_silent) return; @@ -2807,13 +3044,15 @@ putcmdline(c, shift) draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos); msg_no_more = FALSE; cursorcmd(); + extra_char = c; + extra_char_shift = shift; } /* * Undo a putcmdline(c, FALSE). */ void -unputcmdline() +unputcmdline(void) { if (cmd_silent) return; @@ -2829,6 +3068,7 @@ unputcmdline() draw_cmdline(ccline.cmdpos, 1); msg_no_more = FALSE; cursorcmd(); + extra_char = NUL; } /* @@ -2840,10 +3080,7 @@ unputcmdline() * called afterwards. */ int -put_on_cmdline(str, len, redraw) - char_u *str; - int len; - int redraw; +put_on_cmdline(char_u *str, int len, int redraw) { int retval; int i; @@ -3013,8 +3250,7 @@ static int prev_ccline_used = FALSE; * available globally in prev_ccline. */ static void -save_cmdline(ccp) - struct cmdline_info *ccp; +save_cmdline(struct cmdline_info *ccp) { if (!prev_ccline_used) { @@ -3032,8 +3268,7 @@ save_cmdline(ccp) * Restore ccline after it has been saved with save_cmdline(). */ static void -restore_cmdline(ccp) - struct cmdline_info *ccp; +restore_cmdline(struct cmdline_info *ccp) { ccline = prev_ccline; prev_ccline = *ccp; @@ -3046,7 +3281,7 @@ restore_cmdline(ccp) * Returns NULL when failed. */ char_u * -save_cmdline_alloc() +save_cmdline_alloc(void) { struct cmdline_info *p; @@ -3060,8 +3295,7 @@ save_cmdline_alloc() * Restore the command line from the return value of save_cmdline_alloc(). */ void -restore_cmdline_alloc(p) - char_u *p; +restore_cmdline_alloc(char_u *p) { if (p != NULL) { @@ -3072,18 +3306,18 @@ restore_cmdline_alloc(p) #endif /* - * paste a yank register into the command line. - * used by CTRL-R command in command-line mode + * Paste a yank register into the command line. + * Used by CTRL-R command in command-line mode. * insert_reg() can't be used here, because special characters from the * register contents will be interpreted as commands. * - * return FAIL for failure, OK otherwise + * Return FAIL for failure, OK otherwise. */ static int -cmdline_paste(regname, literally, remcr) - int regname; - int literally; /* Insert text literally instead of "as typed" */ - int remcr; /* remove trailing CR */ +cmdline_paste( + int regname, + int literally, /* Insert text literally instead of "as typed" */ + int remcr) /* remove trailing CR */ { long i; char_u *arg; @@ -3094,7 +3328,8 @@ cmdline_paste(regname, literally, remcr) /* check for valid regname; also accept special characters for CTRL-R in * the command line */ if (regname != Ctrl_F && regname != Ctrl_P && regname != Ctrl_W - && regname != Ctrl_A && !valid_yank_reg(regname, FALSE)) + && regname != Ctrl_A && regname != Ctrl_L + && !valid_yank_reg(regname, FALSE)) return FAIL; /* A register containing CTRL-R can cause an endless loop. Allow using @@ -3169,9 +3404,7 @@ cmdline_paste(regname, literally, remcr) * line. */ void -cmdline_paste_str(s, literally) - char_u *s; - int literally; +cmdline_paste_str(char_u *s, int literally) { int c, cv; @@ -3206,8 +3439,7 @@ cmdline_paste_str(s, literally) * position. */ static void -cmdline_del(from) - int from; +cmdline_del(int from) { mch_memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos, (size_t)(ccline.cmdlen - ccline.cmdpos + 1)); @@ -3217,22 +3449,30 @@ cmdline_del(from) #endif /* - * this function is called when the screen size changes and with incremental - * search + * This function is called when the screen size changes and with incremental + * search and in other situations where the command line may have been + * overwritten. */ void -redrawcmdline() +redrawcmdline(void) +{ + redrawcmdline_ex(TRUE); +} + + void +redrawcmdline_ex(int do_compute_cmdrow) { if (cmd_silent) return; need_wait_return = FALSE; - compute_cmdrow(); + if (do_compute_cmdrow) + compute_cmdrow(); redrawcmd(); cursorcmd(); } static void -redrawcmdprompt() +redrawcmdprompt(void) { int i; @@ -3257,7 +3497,7 @@ redrawcmdprompt() * Redraw what is currently on the command line. */ void -redrawcmd() +redrawcmd(void) { if (cmd_silent) return; @@ -3280,6 +3520,8 @@ redrawcmd() msg_no_more = FALSE; set_cmdspos_cursor(); + if (extra_char != NUL) + putcmdline(extra_char, extra_char_shift); /* * An emsg() before may have set msg_scroll. This is used in normal mode, @@ -3293,17 +3535,17 @@ redrawcmd() } void -compute_cmdrow() +compute_cmdrow(void) { if (exmode_active || msg_scrolled != 0) cmdline_row = Rows - 1; else cmdline_row = W_WINROW(lastwin) + lastwin->w_height - + W_STATUS_HEIGHT(lastwin); + + lastwin->w_status_height; } static void -cursorcmd() +cursorcmd(void) { if (cmd_silent) return; @@ -3327,7 +3569,8 @@ cursorcmd() windgoto(msg_row, msg_col); #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) - redrawcmd_preedit(); + if (p_imst == IM_ON_THE_SPOT) + redrawcmd_preedit(); #endif #ifdef MCH_CURSOR_SHAPE mch_update_cursor(); @@ -3335,8 +3578,7 @@ cursorcmd() } void -gotocmdline(clr) - int clr; +gotocmdline(int clr) { msg_start(); #ifdef FEAT_RIGHTLEFT @@ -3357,13 +3599,27 @@ gotocmdline(clr) * backspaces and the replacement string is inserted, followed by "c". */ static int -ccheck_abbr(c) - int c; +ccheck_abbr(int c) { + int spos = 0; + if (p_paste || no_abbr) /* no abbreviations or in paste mode */ return FALSE; - return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0); + /* Do not consider '<,'> be part of the mapping, skip leading whitespace. + * Actually accepts any mark. */ + while (VIM_ISWHITE(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) + spos++; + if (ccline.cmdlen - spos > 5 + && ccline.cmdbuff[spos] == '\'' + && ccline.cmdbuff[spos + 2] == ',' + && ccline.cmdbuff[spos + 3] == '\'') + spos += 5; + else + /* check abbreviation from the beginning of the commandline */ + spos = 0; + + return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, spos); } #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -3371,9 +3627,7 @@ ccheck_abbr(c) #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_func_compare(s1, s2) - const void *s1; - const void *s2; +sort_func_compare(const void *s1, const void *s2) { char_u *p1 = *(char_u **)s1; char_u *p2 = *(char_u **)s2; @@ -3391,11 +3645,11 @@ sort_func_compare(s1, s2) * normal character (instead of being expanded). This allows :s/^I^D etc. */ static int -nextwild(xp, type, options, escape) - expand_T *xp; - int type; - int options; /* extra options for ExpandOne() */ - int escape; /* if TRUE, escape the returned matches */ +nextwild( + expand_T *xp, + int type, + int options, /* extra options for ExpandOne() */ + int escape) /* if TRUE, escape the returned matches */ { int i, j; char_u *p1; @@ -3462,10 +3716,7 @@ nextwild(xp, type, options, escape) || ccline.cmdbuff[i + j] == '?') break; if ((int)STRLEN(p2) < j) - { - vim_free(p2); - p2 = NULL; - } + VIM_CLEAR(p2); } } } @@ -3544,12 +3795,12 @@ nextwild(xp, type, options, escape) * The variables xp->xp_context and xp->xp_backslash must have been set! */ char_u * -ExpandOne(xp, str, orig, options, mode) - expand_T *xp; - char_u *str; - char_u *orig; /* allocated copy of original of expanded string */ - int options; - int mode; +ExpandOne( + expand_T *xp, + char_u *str, + char_u *orig, /* allocated copy of original of expanded string */ + int options, + int mode) { char_u *ss = NULL; static int findex; @@ -3611,8 +3862,7 @@ ExpandOne(xp, str, orig, options, mode) { FreeWild(xp->xp_numfiles, xp->xp_files); xp->xp_numfiles = -1; - vim_free(orig_save); - orig_save = NULL; + VIM_CLEAR(orig_save); } findex = 0; @@ -3695,29 +3945,47 @@ ExpandOne(xp, str, orig, options, mode) /* Find longest common part */ if (mode == WILD_LONGEST && xp->xp_numfiles > 0) { - for (len = 0; xp->xp_files[0][len]; ++len) + int mb_len = 1; + int c0, ci; + + for (len = 0; xp->xp_files[0][len]; len += mb_len) { - for (i = 0; i < xp->xp_numfiles; ++i) +#ifdef FEAT_MBYTE + if (has_mbyte) + { + mb_len = (*mb_ptr2len)(&xp->xp_files[0][len]); + c0 =(* mb_ptr2char)(&xp->xp_files[0][len]); + } + else +#endif + c0 = xp->xp_files[0][len]; + for (i = 1; i < xp->xp_numfiles; ++i) { +#ifdef FEAT_MBYTE + if (has_mbyte) + ci =(* mb_ptr2char)(&xp->xp_files[i][len]); + else +#endif + ci = xp->xp_files[i][len]; if (p_fic && (xp->xp_context == EXPAND_DIRECTORIES || xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_SHELLCMD || xp->xp_context == EXPAND_BUFFERS)) { - if (TOLOWER_LOC(xp->xp_files[i][len]) != - TOLOWER_LOC(xp->xp_files[0][len])) + if (MB_TOLOWER(c0) != MB_TOLOWER(ci)) break; } - else if (xp->xp_files[i][len] != xp->xp_files[0][len]) + else if (c0 != ci) break; } if (i < xp->xp_numfiles) { if (!(options & WILD_NO_BEEP)) - vim_beep(); + vim_beep(BO_WILD); break; } } + ss = alloc((unsigned)len + 1); if (ss) vim_strncpy(ss, xp->xp_files[0], (size_t)len); @@ -3757,8 +4025,7 @@ ExpandOne(xp, str, orig, options, mode) * Prepare an expand structure for use. */ void -ExpandInit(xp) - expand_T *xp; +ExpandInit(expand_T *xp) { xp->xp_pattern = NULL; xp->xp_pattern_len = 0; @@ -3778,8 +4045,7 @@ ExpandInit(xp) * Cleanup an expand structure after use. */ void -ExpandCleanup(xp) - expand_T *xp; +ExpandCleanup(expand_T *xp) { if (xp->xp_numfiles >= 0) { @@ -3789,12 +4055,12 @@ ExpandCleanup(xp) } void -ExpandEscape(xp, str, numfiles, files, options) - expand_T *xp; - char_u *str; - int numfiles; - char_u **files; - int options; +ExpandEscape( + expand_T *xp, + char_u *str, + int numfiles, + char_u **files, + int options) { int i; char_u *p; @@ -3885,9 +4151,7 @@ ExpandEscape(xp, str, numfiles, files, options) * Returns the result in allocated memory. */ char_u * -vim_strsave_fnameescape(fname, shell) - char_u *fname; - int shell; +vim_strsave_fnameescape(char_u *fname, int shell) { char_u *p; #ifdef BACKSLASH_IN_FILENAME @@ -3926,8 +4190,7 @@ vim_strsave_fnameescape(fname, shell) * Put a backslash before the file name in "pp", which is in allocated memory. */ static void -escape_fname(pp) - char_u **pp; +escape_fname(char_u **pp) { char_u *p; @@ -3946,10 +4209,10 @@ escape_fname(pp) * If 'orig_pat' starts with "~/", replace the home directory with "~". */ void -tilde_replace(orig_pat, num_files, files) - char_u *orig_pat; - int num_files; - char_u **files; +tilde_replace( + char_u *orig_pat, + int num_files, + char_u **files) { int i; char_u *p; @@ -3974,9 +4237,7 @@ tilde_replace(orig_pat, num_files, files) * be inserted like a normal character. */ static int -showmatches(xp, wildmenu) - expand_T *xp; - int wildmenu UNUSED; +showmatches(expand_T *xp, int wildmenu UNUSED) { #define L_SHOWFILE(m) (showtail ? sm_gettail(files_found[m]) : files_found[m]) int num_files; @@ -4026,7 +4287,7 @@ showmatches(xp, wildmenu) got_int = FALSE; /* only int. the completion, not the cmd line */ #ifdef FEAT_WILDMENU else if (wildmenu) - win_redr_status_matches(xp, num_files, files_found, 0, showtail); + win_redr_status_matches(xp, num_files, files_found, -1, showtail); #endif else { @@ -4059,14 +4320,14 @@ showmatches(xp, wildmenu) lines = (num_files + columns - 1) / columns; } - attr = hl_attr(HLF_D); /* find out highlighting for directories */ + attr = HL_ATTR(HLF_D); /* find out highlighting for directories */ if (xp->xp_context == EXPAND_TAGS_LISTFILES) { - MSG_PUTS_ATTR(_("tagname"), hl_attr(HLF_T)); + MSG_PUTS_ATTR(_("tagname"), HL_ATTR(HLF_T)); msg_clr_eos(); msg_advance(maxlen - 3); - MSG_PUTS_ATTR(_(" kind file\n"), hl_attr(HLF_T)); + MSG_PUTS_ATTR(_(" kind file\n"), HL_ATTR(HLF_T)); } /* list the files line by line */ @@ -4077,12 +4338,12 @@ showmatches(xp, wildmenu) { if (xp->xp_context == EXPAND_TAGS_LISTFILES) { - msg_outtrans_attr(files_found[k], hl_attr(HLF_D)); + msg_outtrans_attr(files_found[k], HL_ATTR(HLF_D)); p = files_found[k] + STRLEN(files_found[k]) + 1; msg_advance(maxlen + 1); msg_puts(p); msg_advance(maxlen + 3); - msg_puts_long_attr(p + 2, hl_attr(HLF_D)); + msg_puts_long_attr(p + 2, HL_ATTR(HLF_D)); break; } for (j = maxlen - lastlen; --j >= 0; ) @@ -4158,8 +4419,7 @@ showmatches(xp, wildmenu) * Find tail of file name path, but ignore trailing "/". */ char_u * -sm_gettail(s) - char_u *s; +sm_gettail(char_u *s) { char_u *p; char_u *t = s; @@ -4178,7 +4438,7 @@ sm_gettail(s) t = p; had_sep = FALSE; } - mb_ptr_adv(p); + MB_PTR_ADV(p); } return t; } @@ -4189,8 +4449,7 @@ sm_gettail(s) * returned. */ static int -expand_showtail(xp) - expand_T *xp; +expand_showtail(expand_T *xp) { char_u *s; char_u *end; @@ -4225,10 +4484,10 @@ expand_showtail(xp) * the name into allocated memory and prepend "^". */ char_u * -addstar(fname, len, context) - char_u *fname; - int len; - int context; /* EXPAND_FILES etc. */ +addstar( + char_u *fname, + int len, + int context) /* EXPAND_FILES etc. */ { char_u *retval; int i, j; @@ -4254,7 +4513,10 @@ addstar(fname, len, context) || context == EXPAND_COMPILER || context == EXPAND_OWNSYNTAX || context == EXPAND_FILETYPE - || (context == EXPAND_TAGS && fname[0] == '/')) + || context == EXPAND_PACKADD + || ((context == EXPAND_TAGS_LISTFILES + || context == EXPAND_TAGS) + && fname[0] == '/')) retval = vim_strnsave(fname, len); else { @@ -4394,8 +4656,7 @@ addstar(fname, len, context) * EXPAND_USER Complete user names */ static void -set_expand_context(xp) - expand_T *xp; +set_expand_context(expand_T *xp) { /* only expansion for ':', '>' and '=' command-lines */ if (ccline.cmdfirstc != ':' @@ -4408,15 +4669,16 @@ set_expand_context(xp) xp->xp_context = EXPAND_NOTHING; return; } - set_cmd_context(xp, ccline.cmdbuff, ccline.cmdlen, ccline.cmdpos); + set_cmd_context(xp, ccline.cmdbuff, ccline.cmdlen, ccline.cmdpos, TRUE); } void -set_cmd_context(xp, str, len, col) - expand_T *xp; - char_u *str; /* start of command line */ - int len; /* length of command line (excl. NUL) */ - int col; /* position of cursor */ +set_cmd_context( + expand_T *xp, + char_u *str, /* start of command line */ + int len, /* length of command line (excl. NUL) */ + int col, /* position of cursor */ + int use_ccline UNUSED) /* use ccline for info */ { int old_char = NUL; char_u *nextcomm; @@ -4431,14 +4693,14 @@ set_cmd_context(xp, str, len, col) nextcomm = str; #ifdef FEAT_EVAL - if (ccline.cmdfirstc == '=') + if (use_ccline && ccline.cmdfirstc == '=') { # ifdef FEAT_CMDL_COMPL /* pass CMD_SIZE because there is no real command */ set_context_for_expression(xp, str, CMD_SIZE); # endif } - else if (ccline.input_fn) + else if (use_ccline && ccline.input_fn) { xp->xp_context = ccline.xp_context; xp->xp_pattern = ccline.cmdbuff; @@ -4471,12 +4733,12 @@ set_cmd_context(xp, str, len, col) * Returns EXPAND_OK otherwise. */ int -expand_cmdline(xp, str, col, matchcount, matches) - expand_T *xp; - char_u *str; /* start of command line */ - int col; /* position of cursor */ - int *matchcount; /* return: nr of matches */ - char_u ***matches; /* return: array of pointers to matches */ +expand_cmdline( + expand_T *xp, + char_u *str, /* start of command line */ + int col, /* position of cursor */ + int *matchcount, /* return: nr of matches */ + char_u ***matches) /* return: array of pointers to matches */ { char_u *file_str = NULL; int options = WILD_ADD_SLASH|WILD_SILENT; @@ -4514,34 +4776,59 @@ expand_cmdline(xp, str, col, matchcount, matches) #ifdef FEAT_MULTI_LANG /* - * Cleanup matches for help tags: remove "@en" if "en" is the only language. + * Cleanup matches for help tags: + * Remove "@ab" if the top of 'helplang' is "ab" and the language of the first + * tag matches it. Otherwise remove "@en" if "en" is the only language. */ -static void cleanup_help_tags __ARGS((int num_file, char_u **file)); +static void cleanup_help_tags(int num_file, char_u **file); static void -cleanup_help_tags(num_file, file) - int num_file; - char_u **file; +cleanup_help_tags(int num_file, char_u **file) { int i, j; int len; + char_u buf[4]; + char_u *p = buf; + + if (p_hlg[0] != NUL && (p_hlg[0] != 'e' || p_hlg[1] != 'n')) + { + *p++ = '@'; + *p++ = p_hlg[0]; + *p++ = p_hlg[1]; + } + *p = NUL; for (i = 0; i < num_file; ++i) { len = (int)STRLEN(file[i]) - 3; - if (len > 0 && STRCMP(file[i] + len, "@en") == 0) + if (len <= 0) + continue; + if (STRCMP(file[i] + len, "@en") == 0) { /* Sorting on priority means the same item in another language may * be anywhere. Search all items for a match up to the "@en". */ for (j = 0; j < num_file; ++j) - if (j != i - && (int)STRLEN(file[j]) == len + 3 - && STRNCMP(file[i], file[j], len + 1) == 0) + if (j != i && (int)STRLEN(file[j]) == len + 3 + && STRNCMP(file[i], file[j], len + 1) == 0) break; if (j == num_file) + /* item only exists with @en, remove it */ file[i][len] = NUL; } } + + if (*buf != NUL) + for (i = 0; i < num_file; ++i) + { + len = (int)STRLEN(file[i]) - 3; + if (len <= 0) + continue; + if (STRCMP(file[i] + len, buf) == 0) + { + /* remove the default language */ + file[i][len] = NUL; + } + } } #endif @@ -4549,12 +4836,12 @@ cleanup_help_tags(num_file, file) * Do the expansion based on xp->xp_context and "pat". */ static int -ExpandFromContext(xp, pat, num_file, file, options) - expand_T *xp; - char_u *pat; - int *num_file; - char_u ***file; - int options; /* EW_ flags */ +ExpandFromContext( + expand_T *xp, + char_u *pat, + int *num_file, + char_u ***file, + int options) /* EW_ flags */ { #ifdef FEAT_CMDL_COMPL regmatch_T regmatch; @@ -4571,6 +4858,8 @@ ExpandFromContext(xp, pat, num_file, file, options) flags |= EW_KEEPALL; if (options & WILD_SILENT) flags |= EW_SILENT; + if (options & WILD_ALLLINKS) + flags |= EW_ALLLINKS; if (xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_DIRECTORIES @@ -4650,27 +4939,30 @@ ExpandFromContext(xp, pat, num_file, file, options) if (xp->xp_context == EXPAND_COLORS) { char *directories[] = {"colors", NULL}; - return ExpandRTDir(pat, num_file, file, directories); + return ExpandRTDir(pat, DIP_START + DIP_OPT, num_file, file, + directories); } if (xp->xp_context == EXPAND_COMPILER) { char *directories[] = {"compiler", NULL}; - return ExpandRTDir(pat, num_file, file, directories); + return ExpandRTDir(pat, 0, num_file, file, directories); } if (xp->xp_context == EXPAND_OWNSYNTAX) { char *directories[] = {"syntax", NULL}; - return ExpandRTDir(pat, num_file, file, directories); + return ExpandRTDir(pat, 0, num_file, file, directories); } if (xp->xp_context == EXPAND_FILETYPE) { char *directories[] = {"syntax", "indent", "ftplugin", NULL}; - return ExpandRTDir(pat, num_file, file, directories); + return ExpandRTDir(pat, 0, num_file, file, directories); } # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) if (xp->xp_context == EXPAND_USER_LIST) return ExpandUserList(xp, num_file, file); # endif + if (xp->xp_context == EXPAND_PACKADD) + return ExpandPackAddDir(pat, num_file, file); regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0); if (regmatch.regprog == NULL) @@ -4693,18 +4985,21 @@ ExpandFromContext(xp, pat, num_file, file, options) static struct expgen { int context; - char_u *((*func)__ARGS((expand_T *, int))); + char_u *((*func)(expand_T *, int)); int ic; int escaped; } tab[] = { {EXPAND_COMMANDS, get_command_name, FALSE, TRUE}, {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE}, + {EXPAND_MAPCLEAR, get_mapclear_arg, TRUE, TRUE}, + {EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE}, #ifdef FEAT_CMDHIST {EXPAND_HISTORY, get_history_arg, TRUE, TRUE}, #endif #ifdef FEAT_USR_CMDS {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE}, + {EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, FALSE, TRUE}, {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE}, {EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE}, {EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE}, @@ -4726,10 +5021,8 @@ ExpandFromContext(xp, pat, num_file, file, options) {EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE}, #endif {EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE}, -#ifdef FEAT_AUTOCMD {EXPAND_EVENTS, get_event_name, TRUE, TRUE}, {EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE}, -#endif #ifdef FEAT_CSCOPE {EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE}, #endif @@ -4746,6 +5039,7 @@ ExpandFromContext(xp, pat, num_file, file, options) #endif {EXPAND_ENV_VARS, get_env_name, TRUE, TRUE}, {EXPAND_USER, get_users, TRUE, FALSE}, + {EXPAND_ARGLIST, get_arglist_name, TRUE, FALSE}, #ifdef FEAT_GUI_MACVIM {EXPAND_MACACTION, get_macaction_name, FALSE, FALSE}, #endif @@ -4785,14 +5079,14 @@ ExpandFromContext(xp, pat, num_file, file, options) * Returns OK when no problems encountered, FAIL for error (out of memory). */ int -ExpandGeneric(xp, regmatch, num_file, file, func, escaped) - expand_T *xp; - regmatch_T *regmatch; - int *num_file; - char_u ***file; - char_u *((*func)__ARGS((expand_T *, int))); +ExpandGeneric( + expand_T *xp, + regmatch_T *regmatch, + int *num_file, + char_u ***file, + char_u *((*func)(expand_T *, int)), /* returns a string from the list */ - int escaped; + int escaped) { int i; int count = 0; @@ -4877,15 +5171,15 @@ ExpandGeneric(xp, regmatch, num_file, file, func, escaped) * Returns FAIL or OK; */ static int -expand_shellcmd(filepat, num_file, file, flagsarg) - char_u *filepat; /* pattern to match with command names */ - int *num_file; /* return: number of matches */ - char_u ***file; /* return: array with matches */ - int flagsarg; /* EW_ flags */ +expand_shellcmd( + char_u *filepat, /* pattern to match with command names */ + int *num_file, /* return: number of matches */ + char_u ***file, /* return: array with matches */ + int flagsarg) /* EW_ flags */ { char_u *pat; int i; - char_u *path; + char_u *path = NULL; int mustfree = FALSE; garray_T ga; char_u *buf = alloc(MAXPATHL); @@ -4893,6 +5187,10 @@ expand_shellcmd(filepat, num_file, file, flagsarg) char_u *s, *e; int flags = flagsarg; int ret; + int did_curdir = FALSE; + hashtab_T found_ht; + hashitem_T *hi; + hash_T hash; if (buf == NULL) return FAIL; @@ -4904,32 +5202,40 @@ expand_shellcmd(filepat, num_file, file, flagsarg) if (pat[i] == '\\' && pat[i + 1] == ' ') STRMOVE(pat + i, pat + i + 1); - flags |= EW_FILE | EW_EXEC; + flags |= EW_FILE | EW_EXEC | EW_SHELLCMD; - /* For an absolute name we don't use $PATH. */ - if (mch_isFullName(pat)) - path = (char_u *)" "; - else if ((pat[0] == '.' && (vim_ispathsep(pat[1]) - || (pat[1] == '.' && vim_ispathsep(pat[2]))))) + if (pat[0] == '.' && (vim_ispathsep(pat[1]) + || (pat[1] == '.' && vim_ispathsep(pat[2])))) path = (char_u *)"."; else { - path = vim_getenv((char_u *)"PATH", &mustfree); + /* For an absolute name we don't use $PATH. */ + if (!mch_isFullName(pat)) + path = vim_getenv((char_u *)"PATH", &mustfree); if (path == NULL) path = (char_u *)""; } /* * Go over all directories in $PATH. Expand matches in that directory and - * collect them in "ga". + * collect them in "ga". When "." is not in $PATH also expand for the + * current directory, to find "subdir/cmd". */ ga_init2(&ga, (int)sizeof(char *), 10); - for (s = path; *s != NUL; s = e) + hash_init(&found_ht); + for (s = path; ; s = e) { - if (*s == ' ') - ++s; /* Skip space used for absolute path name. */ + if (*s == NUL) + { + if (did_curdir) + break; + /* Find directories in the current directory, path is empty. */ + did_curdir = TRUE; + } + else if (*s == '.') + did_curdir = TRUE; -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) e = vim_strchr(s, ';'); #else e = vim_strchr(s, ':'); @@ -4955,15 +5261,23 @@ expand_shellcmd(filepat, num_file, file, flagsarg) { for (i = 0; i < *num_file; ++i) { - s = (*file)[i]; - if (STRLEN(s) > l) + char_u *name = (*file)[i]; + + if (STRLEN(name) > l) { - /* Remove the path again. */ - STRMOVE(s, s + l); - ((char_u **)ga.ga_data)[ga.ga_len++] = s; + // Check if this name was already found. + hash = hash_hash(name + l); + hi = hash_lookup(&found_ht, name + l, hash); + if (HASHITEM_EMPTY(hi)) + { + // Remove the path that was prepended. + STRMOVE(name, name + l); + ((char_u **)ga.ga_data)[ga.ga_len++] = name; + hash_add_item(&found_ht, hi, name, hash); + name = NULL; + } } - else - vim_free(s); + vim_free(name); } vim_free(*file); } @@ -4978,28 +5292,29 @@ expand_shellcmd(filepat, num_file, file, flagsarg) vim_free(pat); if (mustfree) vim_free(path); + hash_clear(&found_ht); return OK; } # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) -static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T *xp, int *num_file, char_u ***file)); +static void * call_user_expand_func(void *(*user_expand_func)(char_u *, int, typval_T *, int), expand_T *xp, int *num_file, char_u ***file); /* - * Call "user_expand_func()" to invoke a user defined VimL function and return - * the result (either a string or a List). + * Call "user_expand_func()" to invoke a user defined Vim script function and + * return the result (either a string or a List). */ static void * -call_user_expand_func(user_expand_func, xp, num_file, file) - void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)); - expand_T *xp; - int *num_file; - char_u ***file; +call_user_expand_func( + void *(*user_expand_func)(char_u *, int, typval_T *, int), + expand_T *xp, + int *num_file, + char_u ***file) { int keep = 0; - char_u num[50]; - char_u *args[3]; + typval_T args[4]; int save_current_SID = current_SID; + char_u *pat = NULL; void *ret; struct cmdline_info save_ccline; @@ -5014,10 +5329,15 @@ call_user_expand_func(user_expand_func, xp, num_file, file) ccline.cmdbuff[ccline.cmdlen] = 0; } - args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); - args[1] = xp->xp_line; - sprintf((char *)num, "%d", xp->xp_col); - args[2] = num; + pat = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); + + args[0].v_type = VAR_STRING; + args[0].vval.v_string = pat; + args[1].v_type = VAR_STRING; + args[1].vval.v_string = xp->xp_line; + args[2].v_type = VAR_NUMBER; + args[2].vval.v_number = xp->xp_col; + args[3].v_type = VAR_UNKNOWN; /* Save the cmdline, we don't know what the function may do. */ save_ccline = ccline; @@ -5032,7 +5352,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file) if (ccline.cmdbuff != NULL) ccline.cmdbuff[ccline.cmdlen] = keep; - vim_free(args[0]); + vim_free(pat); return ret; } @@ -5040,17 +5360,18 @@ call_user_expand_func(user_expand_func, xp, num_file, file) * Expand names with a function defined by the user. */ static int -ExpandUserDefined(xp, regmatch, num_file, file) - expand_T *xp; - regmatch_T *regmatch; - int *num_file; - char_u ***file; +ExpandUserDefined( + expand_T *xp, + regmatch_T *regmatch, + int *num_file, + char_u ***file) { char_u *retstr; char_u *s; char_u *e; - char_u keep; + int keep; garray_T ga; + int skip; retstr = call_user_expand_func(call_func_retstr, xp, num_file, file); if (retstr == NULL) @@ -5063,23 +5384,19 @@ ExpandUserDefined(xp, regmatch, num_file, file) if (e == NULL) e = s + STRLEN(s); keep = *e; - *e = 0; + *e = NUL; - if (xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0) + skip = xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0; + *e = keep; + + if (!skip) { - *e = keep; - if (*e != NUL) - ++e; - continue; + if (ga_grow(&ga, 1) == FAIL) + break; + ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); + ++ga.ga_len; } - if (ga_grow(&ga, 1) == FAIL) - break; - - ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); - ++ga.ga_len; - - *e = keep; if (*e != NUL) ++e; } @@ -5093,10 +5410,10 @@ ExpandUserDefined(xp, regmatch, num_file, file) * Expand names with a list returned by a function defined by the user. */ static int -ExpandUserList(xp, num_file, file) - expand_T *xp; - int *num_file; - char_u ***file; +ExpandUserList( + expand_T *xp, + int *num_file, + char_u ***file) { list_T *retlist; listitem_T *li; @@ -5129,16 +5446,22 @@ ExpandUserList(xp, num_file, file) #endif /* - * Expand color scheme, compiler or filetype names: - * 'runtimepath'/{dirnames}/{pat}.vim + * Expand color scheme, compiler or filetype names. + * Search from 'runtimepath': + * 'runtimepath'/{dirnames}/{pat}.vim + * When "flags" has DIP_START: search also from 'start' of 'packpath': + * 'packpath'/pack/ * /start/ * /{dirnames}/{pat}.vim + * When "flags" has DIP_OPT: search also from 'opt' of 'packpath': + * 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim * "dirnames" is an array with one or more directory names. */ static int -ExpandRTDir(pat, num_file, file, dirnames) - char_u *pat; - int *num_file; - char_u ***file; - char *dirnames[]; +ExpandRTDir( + char_u *pat, + int flags, + int *num_file, + char_u ***file, + char *dirnames[]) { char_u *s; char_u *e; @@ -5165,6 +5488,36 @@ ExpandRTDir(pat, num_file, file, dirnames) vim_free(s); } + if (flags & DIP_START) { + for (i = 0; dirnames[i] != NULL; ++i) + { + s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 22)); + if (s == NULL) + { + ga_clear_strings(&ga); + return FAIL; + } + sprintf((char *)s, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); + globpath(p_pp, s, &ga, 0); + vim_free(s); + } + } + + if (flags & DIP_OPT) { + for (i = 0; dirnames[i] != NULL; ++i) + { + s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 20)); + if (s == NULL) + { + ga_clear_strings(&ga); + return FAIL; + } + sprintf((char *)s, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); + globpath(p_pp, s, &ga, 0); + vim_free(s); + } + } + for (i = 0; i < ga.ga_len; ++i) { match = ((char_u **)ga.ga_data)[i]; @@ -5173,7 +5526,7 @@ ExpandRTDir(pat, num_file, file, dirnames) if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0) { e -= 4; - for (s = e; s > match; mb_ptr_back(match, s)) + for (s = e; s > match; MB_PTR_BACK(match, s)) if (s < match || vim_ispathsep(*s)) break; ++s; @@ -5194,24 +5547,76 @@ ExpandRTDir(pat, num_file, file, dirnames) return OK; } -#endif - -#if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO) /* - * Expand "file" for all comma-separated directories in "path". - * Adds the matches to "ga". Caller must init "ga". + * Expand loadplugin names: + * 'packpath'/pack/ * /opt/{pat} */ - void -globpath(path, file, ga, expand_options) - char_u *path; - char_u *file; - garray_T *ga; - int expand_options; + static int +ExpandPackAddDir( + char_u *pat, + int *num_file, + char_u ***file) { - expand_T xpc; - char_u *buf; - int i; - int num_p; + char_u *s; + char_u *e; + char_u *match; + garray_T ga; + int i; + int pat_len; + + *num_file = 0; + *file = NULL; + pat_len = (int)STRLEN(pat); + ga_init2(&ga, (int)sizeof(char *), 10); + + s = alloc((unsigned)(pat_len + 26)); + if (s == NULL) + { + ga_clear_strings(&ga); + return FAIL; + } + sprintf((char *)s, "pack/*/opt/%s*", pat); + globpath(p_pp, s, &ga, 0); + vim_free(s); + + for (i = 0; i < ga.ga_len; ++i) + { + match = ((char_u **)ga.ga_data)[i]; + s = gettail(match); + e = s + STRLEN(s); + mch_memmove(match, s, e - s + 1); + } + + if (ga.ga_len == 0) + return FAIL; + + /* Sort and remove duplicates which can happen when specifying multiple + * directories in dirnames. */ + remove_duplicates(&ga); + + *file = ga.ga_data; + *num_file = ga.ga_len; + return OK; +} + +#endif + +#if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO) +/* + * Expand "file" for all comma-separated directories in "path". + * Adds the matches to "ga". Caller must init "ga". + */ + void +globpath( + char_u *path, + char_u *file, + garray_T *ga, + int expand_options) +{ + expand_T xpc; + char_u *buf; + int i; + int num_p; char_u **p; buf = alloc(MAXPATHL); @@ -5228,7 +5633,7 @@ globpath(path, file, ga, expand_options) copy_option_part(&path, buf, MAXPATHL, ","); if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) { -# if defined(MSWIN) || defined(MSDOS) +# if defined(MSWIN) /* Using the platform's path separator (\) makes vim incorrectly * treat it as an escape character, use '/' instead. */ if (*buf != NUL && !after_pathsep(buf, buf + STRLEN(buf))) @@ -5272,8 +5677,7 @@ globpath(path, file, ga, expand_options) * Translate a history character to the associated type number. */ static int -hist_char2type(c) - int c; +hist_char2type(int c) { if (c == ':') return HIST_CMD; @@ -5308,9 +5712,7 @@ static char *(history_names[]) = * arguments of the ":history command. */ static char_u * -get_history_arg(xp, idx) - expand_T *xp UNUSED; - int idx; +get_history_arg(expand_T *xp UNUSED, int idx) { static char_u compl[2] = { NUL, NUL }; char *short_names = ":=@>?/"; @@ -5335,7 +5737,7 @@ get_history_arg(xp, idx) * Also used to re-allocate the history when the size changes. */ void -init_history() +init_history(void) { int newlen; /* new length of history table */ histentry_T *temp; @@ -5413,12 +5815,12 @@ init_history() } static void -clear_hist_entry(hisptr) - histentry_T *hisptr; +clear_hist_entry(histentry_T *hisptr) { hisptr->hisnum = 0; hisptr->viminfo = FALSE; hisptr->hisstr = NULL; + hisptr->time_set = 0; } /* @@ -5426,12 +5828,12 @@ clear_hist_entry(hisptr) * If 'move_to_front' is TRUE, matching entry is moved to end of history. */ static int -in_history(type, str, move_to_front, sep, writing) - int type; - char_u *str; - int move_to_front; /* Move the entry to the front if it exists */ - int sep; - int writing; /* ignore entries read from viminfo */ +in_history( + int type, + char_u *str, + int move_to_front, /* Move the entry to the front if it exists */ + int sep, + int writing) /* ignore entries read from viminfo */ { int i; int last_i = -1; @@ -5474,6 +5876,7 @@ in_history(type, str, move_to_front, sep, writing) history[type][i].hisnum = ++hisnum[type]; history[type][i].viminfo = FALSE; history[type][i].hisstr = str; + history[type][i].time_set = vim_time(); return TRUE; } return FALSE; @@ -5485,8 +5888,7 @@ in_history(type, str, move_to_front, sep, writing) * Returns -1 for unknown history name. */ int -get_histtype(name) - char_u *name; +get_histtype(char_u *name) { int i; int len = (int)STRLEN(name); @@ -5513,11 +5915,11 @@ static int last_maptick = -1; /* last seen maptick */ * values. */ void -add_to_history(histype, new_entry, in_map, sep) - int histype; - char_u *new_entry; - int in_map; /* consider maptick when inside a mapping */ - int sep; /* separator character used (search hist) */ +add_to_history( + int histype, + char_u *new_entry, + int in_map, /* consider maptick when inside a mapping */ + int sep) /* separator character used (search hist) */ { histentry_T *hisptr; int len; @@ -5535,7 +5937,7 @@ add_to_history(histype, new_entry, in_map, sep) */ if (histype == HIST_SEARCH && in_map) { - if (maptick == last_maptick) + if (maptick == last_maptick && hisidx[HIST_SEARCH] >= 0) { /* Current line is from the same mapping, remove it */ hisptr = &history[HIST_SEARCH][hisidx[HIST_SEARCH]]; @@ -5562,6 +5964,7 @@ add_to_history(histype, new_entry, in_map, sep) hisptr->hisnum = ++hisnum[histype]; hisptr->viminfo = FALSE; + hisptr->time_set = vim_time(); if (histype == HIST_SEARCH && in_map) last_maptick = maptick; } @@ -5574,8 +5977,7 @@ add_to_history(histype, new_entry, in_map, sep) * "histype" may be one of the HIST_ values. */ int -get_history_idx(histype) - int histype; +get_history_idx(int histype) { if (hislen == 0 || histype < 0 || histype >= HIST_COUNT || hisidx[histype] < 0) @@ -5584,96 +5986,6 @@ get_history_idx(histype) return history[histype][hisidx[histype]].hisnum; } -static struct cmdline_info *get_ccline_ptr __ARGS((void)); - -/* - * Get pointer to the command line info to use. cmdline_paste() may clear - * ccline and put the previous value in prev_ccline. - */ - static struct cmdline_info * -get_ccline_ptr() -{ - if ((State & CMDLINE) == 0) - return NULL; - if (ccline.cmdbuff != NULL) - return &ccline; - if (prev_ccline_used && prev_ccline.cmdbuff != NULL) - return &prev_ccline; - return NULL; -} - -/* - * Get the current command line in allocated memory. - * Only works when the command line is being edited. - * Returns NULL when something is wrong. - */ - char_u * -get_cmdline_str() -{ - struct cmdline_info *p = get_ccline_ptr(); - - if (p == NULL) - return NULL; - return vim_strnsave(p->cmdbuff, p->cmdlen); -} - -/* - * Get the current command line position, counted in bytes. - * Zero is the first position. - * Only works when the command line is being edited. - * Returns -1 when something is wrong. - */ - int -get_cmdline_pos() -{ - struct cmdline_info *p = get_ccline_ptr(); - - if (p == NULL) - return -1; - return p->cmdpos; -} - -/* - * Set the command line byte position to "pos". Zero is the first position. - * Only works when the command line is being edited. - * Returns 1 when failed, 0 when OK. - */ - int -set_cmdline_pos(pos) - int pos; -{ - struct cmdline_info *p = get_ccline_ptr(); - - if (p == NULL) - return 1; - - /* The position is not set directly but after CTRL-\ e or CTRL-R = has - * changed the command line. */ - if (pos < 0) - new_cmdpos = 0; - else - new_cmdpos = pos; - return 0; -} - -/* - * Get the current command-line type. - * Returns ':' or '/' or '?' or '@' or '>' or '-' - * Only works when the command line is being edited. - * Returns NUL when something is wrong. - */ - int -get_cmdline_type() -{ - struct cmdline_info *p = get_ccline_ptr(); - - if (p == NULL) - return NUL; - if (p->cmdfirstc == NUL) - return (p->input_fn) ? '@' : '-'; - return p->cmdfirstc; -} - /* * Calculate history index from a number: * num > 0: seen as identifying number of a history entry @@ -5681,9 +5993,7 @@ get_cmdline_type() * "histype" may be one of the HIST_ values. */ static int -calc_hist_idx(histype, num) - int histype; - int num; +calc_hist_idx(int histype, int num) { int i; histentry_T *hist; @@ -5723,9 +6033,7 @@ calc_hist_idx(histype, num) * "histype" may be one of the HIST_ values. */ char_u * -get_history_entry(histype, idx) - int histype; - int idx; +get_history_entry(int histype, int idx) { idx = calc_hist_idx(histype, idx); if (idx >= 0) @@ -5739,8 +6047,7 @@ get_history_entry(histype, idx) * "histype" may be one of the HIST_ values. */ int -clr_history(histype) - int histype; +clr_history(int histype) { int i; histentry_T *hisptr; @@ -5752,6 +6059,7 @@ clr_history(histype) { vim_free(hisptr->hisstr); clear_hist_entry(hisptr); + hisptr++; } hisidx[histype] = -1; /* mark history as cleared */ hisnum[histype] = 0; /* reset identifier counter */ @@ -5765,9 +6073,7 @@ clr_history(histype) * "histype" may be one of the HIST_ values. */ int -del_history_entry(histype, str) - int histype; - char_u *str; +del_history_entry(int histype, char_u *str) { regmatch_T regmatch; histentry_T *hisptr; @@ -5823,9 +6129,7 @@ del_history_entry(histype, str) * "histype" may be one of the HIST_ values. */ int -del_history_idx(histype, idx) - int histype; - int idx; +del_history_idx(int histype, int idx) { int i, j; @@ -5862,7 +6166,7 @@ del_history_idx(histype, idx) * history. */ void -remove_key_from_history() +remove_key_from_history(void) { char_u *p; int i; @@ -5879,7 +6183,7 @@ remove_key_from_history() if (p == NULL) break; ++p; - for (i = 0; p[i] && !vim_iswhite(p[i]); ++i) + for (i = 0; p[i] && !VIM_ISWHITE(p[i]); ++i) if (p[i] == '\\' && p[i + 1]) ++i; STRMOVE(p, p + i); @@ -5890,6 +6194,104 @@ remove_key_from_history() #endif /* FEAT_CMDHIST */ +#if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) || defined(PROTO) +/* + * Get pointer to the command line info to use. cmdline_paste() may clear + * ccline and put the previous value in prev_ccline. + */ + static struct cmdline_info * +get_ccline_ptr(void) +{ + if ((State & CMDLINE) == 0) + return NULL; + if (ccline.cmdbuff != NULL) + return &ccline; + if (prev_ccline_used && prev_ccline.cmdbuff != NULL) + return &prev_ccline; + return NULL; +} +#endif + +#if defined(FEAT_EVAL) || defined(PROTO) +/* + * Get the current command line in allocated memory. + * Only works when the command line is being edited. + * Returns NULL when something is wrong. + */ + char_u * +get_cmdline_str(void) +{ + struct cmdline_info *p = get_ccline_ptr(); + + if (p == NULL) + return NULL; + return vim_strnsave(p->cmdbuff, p->cmdlen); +} + +/* + * Get the current command line position, counted in bytes. + * Zero is the first position. + * Only works when the command line is being edited. + * Returns -1 when something is wrong. + */ + int +get_cmdline_pos(void) +{ + struct cmdline_info *p = get_ccline_ptr(); + + if (p == NULL) + return -1; + return p->cmdpos; +} + +/* + * Set the command line byte position to "pos". Zero is the first position. + * Only works when the command line is being edited. + * Returns 1 when failed, 0 when OK. + */ + int +set_cmdline_pos( + int pos) +{ + struct cmdline_info *p = get_ccline_ptr(); + + if (p == NULL) + return 1; + + /* The position is not set directly but after CTRL-\ e or CTRL-R = has + * changed the command line. */ + if (pos < 0) + new_cmdpos = 0; + else + new_cmdpos = pos; + return 0; +} +#endif + +#if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) || defined(PROTO) +/* + * Get the current command-line type. + * Returns ':' or '/' or '?' or '@' or '>' or '-' + * Only works when the command line is being edited. + * Returns NUL when something is wrong. + */ + int +get_cmdline_type(void) +{ + struct cmdline_info *p = get_ccline_ptr(); + + if (p == NULL) + return NUL; + if (p->cmdfirstc == NUL) + return +# ifdef FEAT_EVAL + (p->input_fn) ? '@' : +# endif + '-'; + return p->cmdfirstc; +} +#endif + #if defined(FEAT_QUICKFIX) || defined(FEAT_CMDHIST) || defined(PROTO) /* * Get indices "num1,num2" that specify a range within a list (not a range of @@ -5897,19 +6299,16 @@ remove_key_from_history() * Returns OK if parsed successfully, otherwise FAIL. */ int -get_list_range(str, num1, num2) - char_u **str; - int *num1; - int *num2; +get_list_range(char_u **str, int *num1, int *num2) { int len; int first = FALSE; - long num; + varnumber_T num; *str = skipwhite(*str); if (**str == '-' || vim_isdigit(**str)) /* parse "from" part of range */ { - vim_str2nr(*str, NULL, &len, FALSE, FALSE, &num, NULL); + vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0); *str += len; *num1 = (int)num; first = TRUE; @@ -5918,7 +6317,7 @@ get_list_range(str, num1, num2) if (**str == ',') /* parse "to" part of range */ { *str = skipwhite(*str + 1); - vim_str2nr(*str, NULL, &len, FALSE, FALSE, &num, NULL); + vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0); if (len > 0) { *num2 = (int)num; @@ -5938,8 +6337,7 @@ get_list_range(str, num1, num2) * :history command - print a history */ void -ex_history(eap) - exarg_T *eap; +ex_history(exarg_T *eap) { histentry_T *hist; int histype1 = HIST_CMD; @@ -6035,20 +6433,21 @@ ex_history(eap) /* * Buffers for history read from a viminfo file. Only valid while reading. */ -static char_u **viminfo_history[HIST_COUNT] = {NULL, NULL, NULL, NULL}; -static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0}; -static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0}; +static histentry_T *viminfo_history[HIST_COUNT] = + {NULL, NULL, NULL, NULL, NULL}; +static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0, 0}; +static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0, 0}; static int viminfo_add_at_front = FALSE; -static int hist_type2char __ARGS((int type, int use_question)); +static int hist_type2char(int type, int use_question); /* * Translate a history type number to the associated character. */ static int -hist_type2char(type, use_question) - int type; - int use_question; /* use '?' instead of '/' */ +hist_type2char( + int type, + int use_question) /* use '?' instead of '/' */ { if (type == HIST_CMD) return ':'; @@ -6069,9 +6468,7 @@ hist_type2char(type, use_question) * This allocates history arrays to store the read history lines. */ void -prepare_viminfo_history(asklen, writing) - int asklen; - int writing; +prepare_viminfo_history(int asklen, int writing) { int i; int num; @@ -6097,8 +6494,8 @@ prepare_viminfo_history(asklen, writing) if (len <= 0) viminfo_history[type] = NULL; else - viminfo_history[type] = - (char_u **)lalloc((long_u)(len * sizeof(char_u *)), FALSE); + viminfo_history[type] = (histentry_T *)lalloc( + (long_u)(len * sizeof(histentry_T)), FALSE); if (viminfo_history[type] == NULL) len = 0; viminfo_hislen[type] = len; @@ -6111,9 +6508,7 @@ prepare_viminfo_history(asklen, writing) * new. */ int -read_viminfo_history(virp, writing) - vir_T *virp; - int writing; +read_viminfo_history(vir_T *virp, int writing) { int type; long_u len; @@ -6150,7 +6545,11 @@ read_viminfo_history(virp, writing) mch_memmove(p, val, (size_t)len + 1); p[len + 1] = NUL; } - viminfo_history[type][viminfo_hisidx[type]++] = p; + viminfo_history[type][viminfo_hisidx[type]].hisstr = p; + viminfo_history[type][viminfo_hisidx[type]].time_set = 0; + viminfo_history[type][viminfo_hisidx[type]].viminfo = TRUE; + viminfo_history[type][viminfo_hisidx[type]].hisnum = 0; + viminfo_hisidx[type]++; } } } @@ -6160,58 +6559,227 @@ read_viminfo_history(virp, writing) } /* - * Finish reading history lines from viminfo. Not used when writing viminfo. + * Accept a new style history line from the viminfo, store it in the history + * array when it's new. */ void -finish_viminfo_history() +handle_viminfo_history( + garray_T *values, + int writing) { - int idx; - int i; - int type; + int type; + long_u len; + char_u *val; + char_u *p; + bval_T *vp = (bval_T *)values->ga_data; + + /* Check the format: + * |{bartype},{histtype},{timestamp},{separator},"text" */ + if (values->ga_len < 4 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || (vp[2].bv_type != BVAL_NR && vp[2].bv_type != BVAL_EMPTY) + || vp[3].bv_type != BVAL_STRING) + return; - for (type = 0; type < HIST_COUNT; ++type) + type = vp[0].bv_nr; + if (type >= HIST_COUNT) + return; + if (viminfo_hisidx[type] < viminfo_hislen[type]) { - if (history[type] == NULL) - continue; - idx = hisidx[type] + viminfo_hisidx[type]; - if (idx >= hislen) - idx -= hislen; - else if (idx < 0) - idx = hislen - 1; - if (viminfo_add_at_front) - hisidx[type] = idx; - else + val = vp[3].bv_string; + if (val != NULL && *val != NUL) { - if (hisidx[type] == -1) - hisidx[type] = hislen - 1; - do + int sep = type == HIST_SEARCH && vp[2].bv_type == BVAL_NR + ? vp[2].bv_nr : NUL; + int idx; + int overwrite = FALSE; + + if (!in_history(type, val, viminfo_add_at_front, sep, writing)) { - if (history[type][idx].hisstr != NULL - || history[type][idx].viminfo) - break; - if (++idx == hislen) - idx = 0; - } while (idx != hisidx[type]); - if (idx != hisidx[type] && --idx < 0) - idx = hislen - 1; + /* If lines were written by an older Vim we need to avoid + * getting duplicates. See if the entry already exists. */ + for (idx = 0; idx < viminfo_hisidx[type]; ++idx) + { + p = viminfo_history[type][idx].hisstr; + if (STRCMP(val, p) == 0 + && (type != HIST_SEARCH || sep == p[STRLEN(p) + 1])) + { + overwrite = TRUE; + break; + } + } + + if (!overwrite) + { + /* Need to re-allocate to append the separator byte. */ + len = vp[3].bv_len; + p = lalloc(len + 2, TRUE); + } + else + len = 0; /* for picky compilers */ + if (p != NULL) + { + viminfo_history[type][idx].time_set = vp[1].bv_nr; + if (!overwrite) + { + mch_memmove(p, val, (size_t)len + 1); + /* Put the separator after the NUL. */ + p[len + 1] = sep; + viminfo_history[type][idx].hisstr = p; + viminfo_history[type][idx].hisnum = 0; + viminfo_history[type][idx].viminfo = TRUE; + viminfo_hisidx[type]++; + } + } + } } - for (i = 0; i < viminfo_hisidx[type]; i++) + } +} + +/* + * Concatenate history lines from viminfo after the lines typed in this Vim. + */ + static void +concat_history(int type) +{ + int idx; + int i; + + idx = hisidx[type] + viminfo_hisidx[type]; + if (idx >= hislen) + idx -= hislen; + else if (idx < 0) + idx = hislen - 1; + if (viminfo_add_at_front) + hisidx[type] = idx; + else + { + if (hisidx[type] == -1) + hisidx[type] = hislen - 1; + do { - vim_free(history[type][idx].hisstr); - history[type][idx].hisstr = viminfo_history[type][i]; - history[type][idx].viminfo = TRUE; - if (--idx < 0) - idx = hislen - 1; - } - idx += 1; + if (history[type][idx].hisstr != NULL + || history[type][idx].viminfo) + break; + if (++idx == hislen) + idx = 0; + } while (idx != hisidx[type]); + if (idx != hisidx[type] && --idx < 0) + idx = hislen - 1; + } + for (i = 0; i < viminfo_hisidx[type]; i++) + { + vim_free(history[type][idx].hisstr); + history[type][idx].hisstr = viminfo_history[type][i].hisstr; + history[type][idx].viminfo = TRUE; + history[type][idx].time_set = viminfo_history[type][i].time_set; + if (--idx < 0) + idx = hislen - 1; + } + idx += 1; + idx %= hislen; + for (i = 0; i < viminfo_hisidx[type]; i++) + { + history[type][idx++].hisnum = ++hisnum[type]; idx %= hislen; - for (i = 0; i < viminfo_hisidx[type]; i++) + } +} + +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +sort_hist(const void *s1, const void *s2) +{ + histentry_T *p1 = *(histentry_T **)s1; + histentry_T *p2 = *(histentry_T **)s2; + + if (p1->time_set < p2->time_set) return -1; + if (p1->time_set > p2->time_set) return 1; + return 0; +} +#endif + +/* + * Merge history lines from viminfo and lines typed in this Vim based on the + * timestamp; + */ + static void +merge_history(int type) +{ + int max_len; + histentry_T **tot_hist; + histentry_T *new_hist; + int i; + int len; + + /* Make one long list with all entries. */ + max_len = hislen + viminfo_hisidx[type]; + tot_hist = (histentry_T **)alloc(max_len * (int)sizeof(histentry_T *)); + new_hist = (histentry_T *)alloc(hislen * (int)sizeof(histentry_T)); + if (tot_hist == NULL || new_hist == NULL) + { + vim_free(tot_hist); + vim_free(new_hist); + return; + } + for (i = 0; i < viminfo_hisidx[type]; i++) + tot_hist[i] = &viminfo_history[type][i]; + len = i; + for (i = 0; i < hislen; i++) + if (history[type][i].hisstr != NULL) + tot_hist[len++] = &history[type][i]; + + /* Sort the list on timestamp. */ + qsort((void *)tot_hist, (size_t)len, sizeof(histentry_T *), sort_hist); + + /* Keep the newest ones. */ + for (i = 0; i < hislen; i++) + { + if (i < len) { - history[type][idx++].hisnum = ++hisnum[type]; - idx %= hislen; + new_hist[i] = *tot_hist[i]; + tot_hist[i]->hisstr = NULL; + if (new_hist[i].hisnum == 0) + new_hist[i].hisnum = ++hisnum[type]; } - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + else + clear_hist_entry(&new_hist[i]); + } + hisidx[type] = (i < len ? i : len) - 1; + + /* Free what is not kept. */ + for (i = 0; i < viminfo_hisidx[type]; i++) + vim_free(viminfo_history[type][i].hisstr); + for (i = 0; i < hislen; i++) + vim_free(history[type][i].hisstr); + vim_free(history[type]); + history[type] = new_hist; + vim_free(tot_hist); +} + +/* + * Finish reading history lines from viminfo. Not used when writing viminfo. + */ + void +finish_viminfo_history(vir_T *virp) +{ + int type; + int merge = virp->vir_version >= VIMINFO_VERSION_WITH_HISTORY; + + for (type = 0; type < HIST_COUNT; ++type) + { + if (history[type] == NULL) + continue; + + if (merge) + merge_history(type); + else + concat_history(type); + + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } } @@ -6223,15 +6791,11 @@ finish_viminfo_history() * When "merge" is FALSE just write all history lines. Used for ":wviminfo!". */ void -write_viminfo_history(fp, merge) - FILE *fp; - int merge; +write_viminfo_history(FILE *fp, int merge) { int i; int type; int num_saved; - char_u *p; - int c; int round; init_history(); @@ -6247,8 +6811,9 @@ write_viminfo_history(fp, merge) fprintf(fp, _("\n# %s History (newest to oldest):\n"), type == HIST_CMD ? _("Command Line") : type == HIST_SEARCH ? _("Search String") : - type == HIST_EXPR ? _("Expression") : - _("Input Line")); + type == HIST_EXPR ? _("Expression") : + type == HIST_INPUT ? _("Input Line") : + _("Debug Line")); if (num_saved > hislen) num_saved = hislen; @@ -6272,9 +6837,23 @@ write_viminfo_history(fp, merge) while (num_saved > 0 && !(round == 2 && i >= viminfo_hisidx[type])) { - p = round == 1 ? history[type][i].hisstr - : viminfo_history[type] == NULL ? NULL - : viminfo_history[type][i]; + char_u *p; + time_t timestamp; + int c = NUL; + + if (round == 1) + { + p = history[type][i].hisstr; + timestamp = history[type][i].time_set; + } + else + { + p = viminfo_history[type] == NULL ? NULL + : viminfo_history[type][i].hisstr; + timestamp = viminfo_history[type] == NULL ? 0 + : viminfo_history[type][i].time_set; + } + if (p != NULL && (round == 2 || !merge || !history[type][i].viminfo)) @@ -6289,6 +6868,21 @@ write_viminfo_history(fp, merge) putc(c == NUL ? ' ' : c, fp); } viminfo_writestring(fp, p); + + { + char cbuf[NUMBUFLEN]; + + /* New style history with a bar line. Format: + * |{bartype},{histtype},{timestamp},{separator},"text" */ + if (c == NUL) + cbuf[0] = NUL; + else + sprintf(cbuf, "%d", c); + fprintf(fp, "|%d,%d,%ld,%s,", BARTYPE_HISTORY, + type, (long)timestamp, cbuf); + barline_writestring(fp, p, LSIZE - 20); + putc('\n', fp); + } } if (round == 1) { @@ -6308,9 +6902,8 @@ write_viminfo_history(fp, merge) } for (i = 0; i < viminfo_hisidx[type]; ++i) if (viminfo_history[type] != NULL) - vim_free(viminfo_history[type][i]); - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + vim_free(viminfo_history[type][i].hisstr); + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } } @@ -6322,8 +6915,7 @@ write_viminfo_history(fp, merge) * It is directly written into the command buffer block. */ void -cmd_pchar(c, offset) - int c, offset; +cmd_pchar(int c, int offset) { if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) { @@ -6335,8 +6927,7 @@ cmd_pchar(c, offset) } int -cmd_gchar(offset) - int offset; +cmd_gchar(int offset) { if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) { @@ -6357,26 +6948,26 @@ cmd_gchar(offset) * K_IGNORE if editing continues */ static int -ex_window() +open_cmdwin(void) { struct cmdline_info save_ccline; - buf_T *old_curbuf = curbuf; + bufref_T old_curbuf; win_T *old_curwin = curwin; - buf_T *bp; + bufref_T bufref; win_T *wp; int i; linenr_T lnum; int histtype; garray_T winsizes; -#ifdef FEAT_AUTOCMD - char_u typestr[2]; -#endif int save_restart_edit = restart_edit; int save_State = State; int save_exmode = exmode_active; #ifdef FEAT_RIGHTLEFT int save_cmdmsg_rl = cmdmsg_rl; #endif +#ifdef FEAT_FOLDING + int save_KeyTyped; +#endif /* Can't do this recursively. Can't do it when typing a password. */ if (cmdwin_type != 0 @@ -6388,24 +6979,23 @@ ex_window() beep_flush(); return K_IGNORE; } + set_bufref(&old_curbuf, curbuf); /* Save current window sizes. */ win_size_save(&winsizes); -# ifdef FEAT_AUTOCMD /* Don't execute autocommands while creating the window. */ block_autocmds(); -# endif + /* don't use a new tab page */ cmdmod.tab = 0; + cmdmod.noswapfile = 1; /* Create a window for the command-line buffer. */ if (win_split((int)p_cwh, WSP_BOT) == FAIL) { beep_flush(); -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif return K_IGNORE; } cmdwin_type = get_cmdline_type(); @@ -6414,7 +7004,6 @@ ex_window() (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL); (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); - set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); curbuf->b_p_ma = TRUE; #ifdef FEAT_FOLDING curwin->w_p_fen = FALSE; @@ -6425,10 +7014,10 @@ ex_window() # endif RESET_BINDING(curwin); -# ifdef FEAT_AUTOCMD /* Do execute autocommands for setting the filetype (load syntax). */ unblock_autocmds(); -# endif + /* But don't allow switching to another buffer. */ + ++curbuf_lock; /* Showing the prompt may have set need_wait_return, reset it. */ need_wait_return = FALSE; @@ -6443,6 +7032,7 @@ ex_window() } set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL); } + --curbuf_lock; /* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin * sets 'textwidth' to 78). */ @@ -6478,9 +7068,7 @@ ex_window() redraw_later(SOME_VALID); /* Save the command line info, can be used recursively. */ - save_ccline = ccline; - ccline.cmdbuff = NULL; - ccline.cmdprompt = NULL; + save_cmdline(&save_ccline); /* No Ex mode here! */ exmode_active = 0; @@ -6490,14 +7078,10 @@ ex_window() setmouse(); # endif -# ifdef FEAT_AUTOCMD /* Trigger CmdwinEnter autocommands. */ - typestr[0] = cmdwin_type; - typestr[1] = NUL; - apply_autocmds(EVENT_CMDWINENTER, typestr, typestr, FALSE, curbuf); + trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); if (restart_edit != 0) /* autocmd with ":startinsert" */ stuffcharReadbuff(K_NOP); -# endif i = RedrawingDisabled; RedrawingDisabled = 0; @@ -6510,27 +7094,34 @@ ex_window() RedrawingDisabled = i; -# ifdef FEAT_AUTOCMD +# ifdef FEAT_FOLDING + save_KeyTyped = KeyTyped; +# endif + /* Trigger CmdwinLeave autocommands. */ - apply_autocmds(EVENT_CMDWINLEAVE, typestr, typestr, FALSE, curbuf); + trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE); + +# ifdef FEAT_FOLDING + /* Restore KeyTyped in case it is modified by autocommands */ + KeyTyped = save_KeyTyped; # endif /* Restore the command line info. */ - ccline = save_ccline; + restore_cmdline(&save_ccline); cmdwin_type = 0; exmode_active = save_exmode; /* Safety check: The old window or buffer was deleted: It's a bug when * this happens! */ - if (!win_valid(old_curwin) || !buf_valid(old_curbuf)) + if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) { cmdwin_result = Ctrl_C; EMSG(_("E199: Active window or buffer deleted")); } else { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* autocmds may abort script processing */ if (aborting() && cmdwin_result != K_IGNORE) cmdwin_result = Ctrl_C; @@ -6570,7 +7161,13 @@ ex_window() else ccline.cmdbuff = vim_strsave(ml_get_curline()); if (ccline.cmdbuff == NULL) + { + ccline.cmdbuff = vim_strsave((char_u *)""); + ccline.cmdlen = 0; + ccline.cmdbufflen = 1; + ccline.cmdpos = 0; cmdwin_result = Ctrl_C; + } else { ccline.cmdlen = (int)STRLEN(ccline.cmdbuff); @@ -6585,26 +7182,26 @@ ex_window() } } -# ifdef FEAT_AUTOCMD /* Don't execute autocommands while deleting the window. */ block_autocmds(); +# ifdef FEAT_CONCEAL + /* Avoid command-line window first character being concealed. */ + curwin->w_p_cole = 0; # endif wp = curwin; - bp = curbuf; + set_bufref(&bufref, curbuf); win_goto(old_curwin); win_close(wp, TRUE); /* win_close() may have already wiped the buffer when 'bh' is * set to 'wipe' */ - if (buf_valid(bp)) - close_buffer(NULL, bp, DOBUF_WIPE, FALSE); + if (bufref_valid(&bufref)) + close_buffer(NULL, bufref.br_buf, DOBUF_WIPE, FALSE); /* Restore window sizes. */ win_size_restore(&winsizes); -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif } ga_clear(&winsizes); @@ -6630,9 +7227,7 @@ ex_window() * Returns a pointer to allocated memory with {script} or NULL. */ char_u * -script_get(eap, cmd) - exarg_T *eap; - char_u *cmd; +script_get(exarg_T *eap, char_u *cmd) { char_u *theline; char *end_pattern = NULL; @@ -6671,3 +7266,21 @@ script_get(eap, cmd) return (char_u *)ga.ga_data; } + +#ifdef FEAT_SEARCH_EXTRA + static void +set_search_match(pos_T *t) +{ + /* + * First move cursor to end of match, then to the start. This + * moves the whole match onto the screen when 'nowrap' is set. + */ + t->lnum += search_match_lines; + t->col = search_match_endcol; + if (t->lnum > curbuf->b_ml.ml_line_count) + { + t->lnum = curbuf->b_ml.ml_line_count; + coladvance((colnr_T)MAXCOL); + } +} +#endif diff --git a/src/farsi.c b/src/farsi.c index be4c1ce7dc..ebed47e6e2 100644 --- a/src/farsi.c +++ b/src/farsi.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -9,97 +9,53 @@ /* * farsi.c: functions for Farsi language - * - * Included by main.c, when FEAT_FKMAP is defined. */ -static int toF_Xor_X_ __ARGS((int c)); -static int F_is_TyE __ARGS((int c)); -static int F_is_TyC_TyD __ARGS((int c)); -static int F_is_TyB_TyC_TyD __ARGS((int src, int offset)); -static int toF_TyB __ARGS((int c)); -static void put_curr_and_l_to_X __ARGS((int c)); -static void put_and_redo __ARGS((int c)); -static void chg_c_toX_orX __ARGS((void)); -static void chg_c_to_X_orX_ __ARGS((void)); -static void chg_c_to_X_or_X __ARGS((void)); -static void chg_l_to_X_orX_ __ARGS((void)); -static void chg_l_toXor_X __ARGS((void)); -static void chg_r_to_Xor_X_ __ARGS((void)); -static int toF_leading __ARGS((int c)); -static int toF_Rjoin __ARGS((int c)); -static int canF_Ljoin __ARGS((int c)); -static int canF_Rjoin __ARGS((int c)); -static int F_isterm __ARGS((int c)); -static int toF_ending __ARGS((int c)); -static void lrswapbuf __ARGS((char_u *buf, int len)); +#include "vim.h" + +#if defined(FEAT_FKMAP) || defined(PROTO) + +static int F_is_TyB_TyC_TyD(int src, int offset); /* -** Convert the given Farsi character into a _X or _X_ type -*/ + * Convert the given Farsi character into a _X or _X_ type + */ static int -toF_Xor_X_(c) - int c; +toF_Xor_X_(int c) { int tempc; switch (c) { - case BE: - return _BE; - case PE: - return _PE; - case TE: - return _TE; - case SE: - return _SE; - case JIM: - return _JIM; - case CHE: - return _CHE; - case HE_J: - return _HE_J; - case XE: - return _XE; - case SIN: - return _SIN; - case SHIN: - return _SHIN; - case SAD: - return _SAD; - case ZAD: - return _ZAD; - case AYN: - return _AYN; - case AYN_: - return _AYN_; - case GHAYN: - return _GHAYN; - case GHAYN_: - return _GHAYN_; - case FE: - return _FE; - case GHAF: - return _GHAF; - case KAF: - return _KAF; - case GAF: - return _GAF; - case LAM: - return _LAM; - case MIM: - return _MIM; - case NOON: - return _NOON; + case BE: return _BE; + case PE: return _PE; + case TE: return _TE; + case SE: return _SE; + case JIM: return _JIM; + case CHE: return _CHE; + case HE_J: return _HE_J; + case XE: return _XE; + case SIN: return _SIN; + case SHIN: return _SHIN; + case SAD: return _SAD; + case ZAD: return _ZAD; + case AYN: return _AYN; + case AYN_: return _AYN_; + case GHAYN: return _GHAYN; + case GHAYN_: return _GHAYN_; + case FE: return _FE; + case GHAF: return _GHAF; + case KAF: return _KAF; + case GAF: return _GAF; + case LAM: return _LAM; + case MIM: return _MIM; + case NOON: return _NOON; case YE: - case YE_: - return _YE; + case YE_: return _YE; case YEE: - case YEE_: - return _YEE; + case YEE_: return _YEE; case IE: - case IE_: - return _IE; + case IE_: return _IE; case F_HE: tempc = _HE; @@ -129,91 +85,61 @@ toF_Xor_X_(c) } /* -** Convert the given Farsi character into Farsi capital character . -*/ - int -toF_TyA(c) - int c ; + * Convert the given Farsi character into Farsi capital character. + */ + static int +toF_TyA(int c) { switch (c) { - case ALEF_: - return ALEF; - case ALEF_U_H_: - return ALEF_U_H; - case _BE: - return BE; - case _PE: - return PE; - case _TE: - return TE; - case _SE: - return SE; - case _JIM: - return JIM; - case _CHE: - return CHE; - case _HE_J: - return HE_J; - case _XE: - return XE; - case _SIN: - return SIN; - case _SHIN: - return SHIN; - case _SAD: - return SAD; - case _ZAD: - return ZAD; + case ALEF_: return ALEF; + case ALEF_U_H_: return ALEF_U_H; + case _BE: return BE; + case _PE: return PE; + case _TE: return TE; + case _SE: return SE; + case _JIM: return JIM; + case _CHE: return CHE; + case _HE_J: return HE_J; + case _XE: return XE; + case _SIN: return SIN; + case _SHIN: return SHIN; + case _SAD: return SAD; + case _ZAD: return ZAD; case _AYN: case AYN_: - case _AYN_: - return AYN; + case _AYN_: return AYN; case _GHAYN: case GHAYN_: - case _GHAYN_: - return GHAYN; - case _FE: - return FE; - case _GHAF: - return GHAF; -/* I am not sure what it is !!! case _KAF_H: */ - case _KAF: - return KAF; - case _GAF: - return GAF; - case _LAM: - return LAM; - case _MIM: - return MIM; - case _NOON: - return NOON; + case _GHAYN_: return GHAYN; + case _FE: return FE; + case _GHAF: return GHAF; + /* I am not sure what it is !!! case _KAF_H: */ + case _KAF: return KAF; + case _GAF: return GAF; + case _LAM: return LAM; + case _MIM: return MIM; + case _NOON: return NOON; case _YE: - case YE_: - return YE; + case YE_: return YE; case _YEE: - case YEE_: - return YEE; - case TEE_: - return TEE; + case YEE_: return YEE; + case TEE_: return TEE; case _IE: - case IE_: - return IE; + case IE_: return IE; case _HE: - case _HE_: - return F_HE; + case _HE_: return F_HE; } return c; } /* -** Is the character under the cursor+offset in the given buffer a join type. -** That is a character that is combined with the others. -** Note: the offset is used only for command line buffer. -*/ + * Is the character under the cursor+offset in the given buffer a join type. + * That is a character that is combined with the others. + * Note: the offset is used only for command line buffer. + */ static int -F_is_TyB_TyC_TyD(src, offset) - int src, offset; +F_is_TyB_TyC_TyD(int src, int offset) { int c; @@ -261,11 +187,10 @@ F_is_TyB_TyC_TyD(src, offset) } /* -** Is the Farsi character one of the terminating only type. -*/ + * Is the Farsi character one of the terminating only type. + */ static int -F_is_TyE(c) - int c; +F_is_TyE(int c) { switch (c) { @@ -285,11 +210,10 @@ F_is_TyE(c) } /* -** Is the Farsi character one of the none leading type. -*/ + * Is the Farsi character one of the none leading type. + */ static int -F_is_TyC_TyD(c) - int c; +F_is_TyC_TyD(int c) { switch (c) { @@ -310,16 +234,15 @@ F_is_TyC_TyD(c) } /* -** Convert a none leading Farsi char into a leading type. -*/ + * Convert a none leading Farsi char into a leading type. + */ static int -toF_TyB(c) - int c; +toF_TyB(int c) { switch (c) { case ALEF_: return ALEF; - case ALEF_U_H_: return ALEF_U_H; + case ALEF_U_H_: return ALEF_U_H; case _AYN_: return _AYN; case AYN_: return AYN; /* exception - there are many of them */ case _GHAYN_: return _GHAYN; @@ -333,12 +256,20 @@ toF_TyB(c) return c; } + + static void +put_and_redo(int c) +{ + pchar_cursor(c); + AppendCharToRedobuff(K_BS); + AppendCharToRedobuff(c); +} + /* -** Overwrite the current redo and cursor characters + left adjust -*/ + * Overwrite the current redo and cursor characters + left adjust. + */ static void -put_curr_and_l_to_X(c) - int c; +put_curr_and_l_to_X(int c) { int tempc; @@ -371,20 +302,11 @@ put_curr_and_l_to_X(c) put_and_redo(c); } - static void -put_and_redo(c) - int c; -{ - pchar_cursor(c); - AppendCharToRedobuff(K_BS); - AppendCharToRedobuff(c); -} - /* -** Change the char. under the cursor to a X_ or X type -*/ + * Change the char. under the cursor to a X_ or X type + */ static void -chg_c_toX_orX() +chg_c_toX_orX(void) { int tempc, curc; @@ -505,11 +427,10 @@ chg_c_toX_orX() } /* -** Change the char. under the cursor to a _X_ or X_ type -*/ - + * Change the char. under the cursor to a _X_ or X_ type + */ static void -chg_c_to_X_orX_() +chg_c_to_X_orX_(void) { int tempc; @@ -557,10 +478,10 @@ chg_c_to_X_orX_() } /* -** Change the char. under the cursor to a _X_ or _X type -*/ + * Change the char. under the cursor to a _X_ or _X type + */ static void -chg_c_to_X_or_X () +chg_c_to_X_or_X(void) { int tempc; @@ -588,10 +509,10 @@ chg_c_to_X_or_X () } /* -** Change the character left to the cursor to a _X_ or X_ type -*/ + * Change the character left to the cursor to a _X_ or X_ type + */ static void -chg_l_to_X_orX_ () +chg_l_to_X_orX_(void) { int tempc; @@ -656,11 +577,10 @@ chg_l_to_X_orX_ () } /* -** Change the character left to the cursor to a X or _X type -*/ - + * Change the character left to the cursor to a X or _X type + */ static void -chg_l_toXor_X () +chg_l_toXor_X(void) { int tempc; @@ -725,11 +645,10 @@ chg_l_toXor_X () } /* -** Change the character right to the cursor to a _X or _X_ type -*/ - + * Change the character right to the cursor to a _X or _X_ type + */ static void -chg_r_to_Xor_X_() +chg_r_to_Xor_X_(void) { int tempc, c; @@ -750,50 +669,51 @@ chg_r_to_Xor_X_() } /* -** Map Farsi keyboard when in fkmap mode. -*/ - + * Map Farsi keyboard when in fkmap mode. + */ int -fkmap(c) - int c; +fkmap(int c) { int tempc; - static int revins; + int insert_mode = (State & INSERT); + static int revins = 0; if (IS_SPECIAL(c)) return c; - if (VIM_ISDIGIT(c) || ((c == '.' || c == '+' || c == '-' || - c == '^' || c == '%' || c == '#' || c == '=') && revins)) + if (insert_mode) { - if (!revins) + if (VIM_ISDIGIT(c) || ((c == '.' || c == '+' || c == '-' || + c == '^' || c == '%' || c == '#' || c == '=') && revins)) { - if (curwin->w_cursor.col) + /* Numbers are entered left-to-right. */ + if (!revins) { - if (!p_ri) - dec_cursor(); + if (curwin->w_cursor.col) + { + if (!p_ri) + dec_cursor(); chg_c_toX_orX (); chg_l_toXor_X (); - if (!p_ri) - inc_cursor(); + if (!p_ri) + inc_cursor(); + } } - } - arrow_used = TRUE; - (void)stop_arrow(); + arrow_used = TRUE; + (void)stop_arrow(); - if (!curwin->w_p_rl && revins) - inc_cursor(); + if (!curwin->w_p_rl && revins) + inc_cursor(); - ++revins; - p_ri=1; - } - else - { - if (revins) + ++revins; + p_ri = 1; + } + else if (revins) { + /* Stop entering number. */ arrow_used = TRUE; (void)stop_arrow(); @@ -834,14 +754,14 @@ fkmap(c) if (!revins) { if (curwin->w_p_rl) - p_ri=0; + p_ri = 0; if (!curwin->w_p_rl) - p_ri=1; + p_ri = 1; } - if ((c < 0x100) && (isalpha(c) || c == '&' || c == '^' || c == ';' || + if ((c < 0x100) && (isalpha(c) || c == '&' || c == '^' || c == ';' || c == '\''|| c == ',' || c == '[' || - c == ']' || c == '{' || c == '}' )) + c == ']' || c == '{' || c == '}')) chg_r_to_Xor_X_(); tempc = 0; @@ -905,13 +825,12 @@ fkmap(c) case NL: case TAB: - if (p_ri && c == NL && curwin->w_cursor.col) + if (p_ri && c == NL && curwin->w_cursor.col && insert_mode) { /* - ** If the char before the cursor is _X_ or X_ do not change - ** the one under the cursor with X type. - */ - + * If the char before the cursor is _X_ or X_ do not change + * the one under the cursor with X type. + */ dec_cursor(); if (F_isalpha(gchar_cursor())) @@ -923,8 +842,7 @@ fkmap(c) inc_cursor(); } - if (!p_ri) - if (!curwin->w_cursor.col) + if (!p_ri && !curwin->w_cursor.col) { switch (c) { @@ -982,224 +900,227 @@ fkmap(c) } break; } - if (!p_ri) - dec_cursor(); - switch ((tempc = gchar_cursor())) + if (insert_mode) { - case _BE: - case _PE: - case _TE: - case _SE: - case _JIM: - case _CHE: - case _HE_J: - case _XE: - case _SIN: - case _SHIN: - case _SAD: - case _ZAD: - case _FE: - case _GHAF: - case _KAF: - case _KAF_H: - case _GAF: - case _LAM: - case _MIM: - case _NOON: - case _HE: - case _HE_: - case _TA: - case _ZA: - put_curr_and_l_to_X(toF_TyA(tempc)); - break; - case _AYN: - case _AYN_: - - if (!p_ri) - if (!curwin->w_cursor.col) - { - put_curr_and_l_to_X(AYN); - break; - } - - if (p_ri) - inc_cursor(); - else - dec_cursor(); - - if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - tempc = AYN_; - else - tempc = AYN; - - if (p_ri) - dec_cursor(); - else - inc_cursor(); - - put_curr_and_l_to_X(tempc); - - break; - case _GHAYN: - case _GHAYN_: - - if (!p_ri) - if (!curwin->w_cursor.col) - { - put_curr_and_l_to_X(GHAYN); - break; - } - - if (p_ri) - inc_cursor(); - else - dec_cursor(); - - if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - tempc = GHAYN_; - else - tempc = GHAYN; - - if (p_ri) - dec_cursor(); - else - inc_cursor(); - - put_curr_and_l_to_X(tempc); - break; - case _YE: - case _IE: - case _YEE: - if (!p_ri) - if (!curwin->w_cursor.col) - { - put_curr_and_l_to_X((tempc == _YE ? YE : - (tempc == _IE ? IE : YEE))); - break; - } - - if (p_ri) - inc_cursor(); - else - dec_cursor(); - - if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - tempc = (tempc == _YE ? YE_ : - (tempc == _IE ? IE_ : YEE_)); - else - tempc = (tempc == _YE ? YE : - (tempc == _IE ? IE : YEE)); - - if (p_ri) - dec_cursor(); - else - inc_cursor(); + if (!p_ri) + dec_cursor(); - put_curr_and_l_to_X(tempc); - break; + switch ((tempc = gchar_cursor())) + { + case _BE: + case _PE: + case _TE: + case _SE: + case _JIM: + case _CHE: + case _HE_J: + case _XE: + case _SIN: + case _SHIN: + case _SAD: + case _ZAD: + case _FE: + case _GHAF: + case _KAF: + case _KAF_H: + case _GAF: + case _LAM: + case _MIM: + case _NOON: + case _HE: + case _HE_: + case _TA: + case _ZA: + put_curr_and_l_to_X(toF_TyA(tempc)); + break; + case _AYN: + case _AYN_: + + if (!p_ri) + if (!curwin->w_cursor.col) + { + put_curr_and_l_to_X(AYN); + break; + } + + if (p_ri) + inc_cursor(); + else + dec_cursor(); + + if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) + tempc = AYN_; + else + tempc = AYN; + + if (p_ri) + dec_cursor(); + else + inc_cursor(); + + put_curr_and_l_to_X(tempc); + + break; + case _GHAYN: + case _GHAYN_: + + if (!p_ri) + if (!curwin->w_cursor.col) + { + put_curr_and_l_to_X(GHAYN); + break; + } + + if (p_ri) + inc_cursor(); + else + dec_cursor(); + + if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) + tempc = GHAYN_; + else + tempc = GHAYN; + + if (p_ri) + dec_cursor(); + else + inc_cursor(); + + put_curr_and_l_to_X(tempc); + break; + case _YE: + case _IE: + case _YEE: + if (!p_ri) + if (!curwin->w_cursor.col) + { + put_curr_and_l_to_X((tempc == _YE ? YE : + (tempc == _IE ? IE : YEE))); + break; + } + + if (p_ri) + inc_cursor(); + else + dec_cursor(); + + if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) + tempc = (tempc == _YE ? YE_ : + (tempc == _IE ? IE_ : YEE_)); + else + tempc = (tempc == _YE ? YE : + (tempc == _IE ? IE : YEE)); + + if (p_ri) + dec_cursor(); + else + inc_cursor(); + + put_curr_and_l_to_X(tempc); + break; } if (!p_ri) inc_cursor(); + } - tempc = 0; + tempc = 0; - switch (c) - { - case '0': return FARSI_0; - case '1': return FARSI_1; - case '2': return FARSI_2; - case '3': return FARSI_3; - case '4': return FARSI_4; - case '5': return FARSI_5; - case '6': return FARSI_6; - case '7': return FARSI_7; - case '8': return FARSI_8; - case '9': return FARSI_9; - case 'B': return F_PSP; - case 'E': return JAZR_N; - case 'F': return ALEF_D_H; - case 'H': return ALEF_A; - case 'I': return TASH; - case 'K': return F_LQUOT; - case 'L': return F_RQUOT; - case 'M': return HAMZE; - case 'O': return '['; - case 'P': return ']'; - case 'Q': return OO; - case 'R': return MAD_N; - case 'T': return OW; - case 'U': return MAD; - case 'W': return OW_OW; - case 'Y': return JAZR; - case '`': return F_PCN; - case '!': return F_EXCL; - case '@': return F_COMMA; - case '#': return F_DIVIDE; - case '$': return F_CURRENCY; - case '%': return F_PERCENT; - case '^': return F_MUL; - case '&': return F_BCOMMA; - case '*': return F_STAR; - case '(': return F_LPARENT; - case ')': return F_RPARENT; - case '-': return F_MINUS; - case '_': return F_UNDERLINE; - case '=': return F_EQUALS; - case '+': return F_PLUS; - case '\\': return F_BSLASH; - case '|': return F_PIPE; - case ':': return F_DCOLON; - case '"': return F_SEMICOLON; - case '.': return F_PERIOD; - case '/': return F_SLASH; - case '<': return F_LESS; - case '>': return F_GREATER; - case '?': return F_QUESTION; - case ' ': return F_BLANK; - } - break; + switch (c) + { + case '0': return FARSI_0; + case '1': return FARSI_1; + case '2': return FARSI_2; + case '3': return FARSI_3; + case '4': return FARSI_4; + case '5': return FARSI_5; + case '6': return FARSI_6; + case '7': return FARSI_7; + case '8': return FARSI_8; + case '9': return FARSI_9; + case 'B': return F_PSP; + case 'E': return JAZR_N; + case 'F': return ALEF_D_H; + case 'H': return ALEF_A; + case 'I': return TASH; + case 'K': return F_LQUOT; + case 'L': return F_RQUOT; + case 'M': return HAMZE; + case 'O': return '['; + case 'P': return ']'; + case 'Q': return OO; + case 'R': return MAD_N; + case 'T': return OW; + case 'U': return MAD; + case 'W': return OW_OW; + case 'Y': return JAZR; + case '`': return F_PCN; + case '!': return F_EXCL; + case '@': return F_COMMA; + case '#': return F_DIVIDE; + case '$': return F_CURRENCY; + case '%': return F_PERCENT; + case '^': return F_MUL; + case '&': return F_BCOMMA; + case '*': return F_STAR; + case '(': return F_LPARENT; + case ')': return F_RPARENT; + case '-': return F_MINUS; + case '_': return F_UNDERLINE; + case '=': return F_EQUALS; + case '+': return F_PLUS; + case '\\': return F_BSLASH; + case '|': return F_PIPE; + case ':': return F_DCOLON; + case '"': return F_SEMICOLON; + case '.': return F_PERIOD; + case '/': return F_SLASH; + case '<': return F_LESS; + case '>': return F_GREATER; + case '?': return F_QUESTION; + case ' ': return F_BLANK; + } + break; case 'a': - tempc = _SHIN; + tempc = _SHIN; break; case 'A': - tempc = WAW_H; + tempc = WAW_H; break; case 'b': - tempc = ZAL; + tempc = ZAL; break; case 'c': - tempc = ZE; + tempc = ZE; break; case 'C': - tempc = JE; + tempc = JE; break; case 'd': - tempc = _YE; + tempc = _YE; break; case 'D': - tempc = _YEE; + tempc = _YEE; break; case 'e': - tempc = _SE; + tempc = _SE; break; case 'f': - tempc = _BE; + tempc = _BE; break; case 'g': - tempc = _LAM; + tempc = _LAM; break; case 'G': if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { + { if (gchar_cursor() == _LAM) chg_c_toX_orX (); - else - if (p_ri) - chg_c_to_X_or_X (); + else if (p_ri) + chg_c_to_X_or_X (); } if (!p_ri) @@ -1213,16 +1134,15 @@ fkmap(c) { chg_c_toX_orX (); chg_l_toXor_X (); - tempc = ALEF_U_H; + tempc = ALEF_U_H; + } + else if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) + { + tempc = ALEF_U_H_; + chg_l_toXor_X (); } else - if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - { - tempc = ALEF_U_H_; - chg_l_toXor_X (); - } - else - tempc = ALEF_U_H; + tempc = ALEF_U_H; if (!p_ri) inc_cursor(); @@ -1252,17 +1172,17 @@ fkmap(c) if (!p_ri) dec_cursor(); - tempc = LA; + tempc = LA; } else { if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) { - tempc = ALEF_; + tempc = ALEF_; chg_l_toXor_X (); } else - tempc = ALEF; + tempc = ALEF; } if (!p_ri) @@ -1270,8 +1190,8 @@ fkmap(c) return tempc; case 'i': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { + if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) + { if (!p_ri && !F_is_TyE(tempc)) chg_c_to_X_orX_ (); if (p_ri) @@ -1286,19 +1206,19 @@ fkmap(c) dec_cursor(); if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - tempc = _HE_; + tempc = _HE_; else - tempc = _HE; + tempc = _HE; if (!p_ri) inc_cursor(); break; case 'j': - tempc = _TE; + tempc = _TE; break; case 'J': if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { + { if (p_ri) chg_c_to_X_or_X (); @@ -1313,88 +1233,88 @@ fkmap(c) if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) { - tempc = TEE_; + tempc = TEE_; chg_l_toXor_X (); } else - tempc = TEE; + tempc = TEE; if (!p_ri) inc_cursor(); return tempc; case 'k': - tempc = _NOON; + tempc = _NOON; break; case 'l': - tempc = _MIM; + tempc = _MIM; break; case 'm': - tempc = _PE; + tempc = _PE; break; case 'n': case 'N': - tempc = DAL; + tempc = DAL; break; case 'o': - tempc = _XE; + tempc = _XE; break; case 'p': - tempc = _HE_J; + tempc = _HE_J; break; case 'q': - tempc = _ZAD; + tempc = _ZAD; break; case 'r': - tempc = _GHAF; + tempc = _GHAF; break; case 's': - tempc = _SIN; + tempc = _SIN; break; case 'S': - tempc = _IE; + tempc = _IE; break; case 't': - tempc = _FE; + tempc = _FE; break; case 'u': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { - if (!p_ri && !F_is_TyE(tempc)) - chg_c_to_X_orX_ (); - if (p_ri) - chg_c_to_X_or_X (); + if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) + { + if (!p_ri && !F_is_TyE(tempc)) + chg_c_to_X_orX_ (); + if (p_ri) + chg_c_to_X_or_X (); - } + } - if (!p_ri && !curwin->w_cursor.col) - return _AYN; + if (!p_ri && !curwin->w_cursor.col) + return _AYN; - if (!p_ri) - dec_cursor(); + if (!p_ri) + dec_cursor(); - if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) - tempc = _AYN_; - else - tempc = _AYN; + if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) + tempc = _AYN_; + else + tempc = _AYN; - if (!p_ri) - inc_cursor(); + if (!p_ri) + inc_cursor(); break; case 'v': case 'V': - tempc = RE; + tempc = RE; break; case 'w': - tempc = _SAD; + tempc = _SAD; break; case 'x': case 'X': - tempc = _TA; + tempc = _TA; break; case 'y': if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { + { if (!p_ri && !F_is_TyE(tempc)) chg_c_to_X_orX_ (); if (p_ri) @@ -1418,36 +1338,36 @@ fkmap(c) break; case 'z': - tempc = _ZA; + tempc = _ZA; break; case 'Z': - tempc = _KAF_H; + tempc = _KAF_H; break; case ';': - tempc = _KAF; + tempc = _KAF; break; case '\'': - tempc = _GAF; + tempc = _GAF; break; case ',': - tempc = WAW; + tempc = WAW; break; case '[': - tempc = _JIM; + tempc = _JIM; break; case ']': - tempc = _CHE; + tempc = _CHE; break; } - if ((F_isalpha(tempc) || F_isdigit(tempc))) + if (F_isalpha(tempc) || F_isdigit(tempc)) { - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) - { + if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) + { if (!p_ri && !F_is_TyE(tempc)) - chg_c_to_X_orX_ (); + chg_c_to_X_orX_(); if (p_ri) - chg_c_to_X_or_X (); + chg_c_to_X_or_X(); } if (curwin->w_cursor.col) @@ -1456,9 +1376,9 @@ fkmap(c) dec_cursor(); if (F_is_TyE(tempc)) - chg_l_toXor_X (); + chg_l_toXor_X(); else - chg_l_to_X_orX_ (); + chg_l_to_X_orX_(); if (!p_ri) inc_cursor(); @@ -1470,11 +1390,10 @@ fkmap(c) } /* -** Convert a none leading Farsi char into a leading type. -*/ + * Convert a none leading Farsi char into a leading type. + */ static int -toF_leading(c) - int c; +toF_leading(int c) { switch (c) { @@ -1525,11 +1444,10 @@ toF_leading(c) } /* -** Convert a given Farsi char into right joining type. -*/ + * Convert a given Farsi char into right joining type. + */ static int -toF_Rjoin(c) - int c; +toF_Rjoin(int c) { switch (c) { @@ -1582,11 +1500,10 @@ toF_Rjoin(c) } /* -** Can a given Farsi character join via its left edj. -*/ + * Can a given Farsi character join via its left edj. + */ static int -canF_Ljoin(c) - int c; +canF_Ljoin(int c) { switch (c) { @@ -1657,11 +1574,10 @@ canF_Ljoin(c) } /* -** Can a given Farsi character join via its right edj. -*/ + * Can a given Farsi character join via its right edj. + */ static int -canF_Rjoin(c) - int c; +canF_Rjoin(int c) { switch (c) { @@ -1686,11 +1602,10 @@ canF_Rjoin(c) } /* -** is a given Farsi character a terminating type. -*/ + * is a given Farsi character a terminating type. + */ static int -F_isterm(c) - int c; +F_isterm(int c) { switch (c) { @@ -1714,88 +1629,55 @@ F_isterm(c) } /* -** Convert the given Farsi character into a ending type . -*/ + * Convert the given Farsi character into a ending type . + */ static int -toF_ending(c) - int c; +toF_ending(int c) { - switch (c) { - case _BE: - return BE; - case _PE: - return PE; - case _TE: - return TE; - case _SE: - return SE; - case _JIM: - return JIM; - case _CHE: - return CHE; - case _HE_J: - return HE_J; - case _XE: - return XE; - case _SIN: - return SIN; - case _SHIN: - return SHIN; - case _SAD: - return SAD; - case _ZAD: - return ZAD; - case _AYN: - return AYN; - case _AYN_: - return AYN_; - case _GHAYN: - return GHAYN; - case _GHAYN_: - return GHAYN_; - case _FE: - return FE; - case _GHAF: - return GHAF; + case _BE: return BE; + case _PE: return PE; + case _TE: return TE; + case _SE: return SE; + case _JIM: return JIM; + case _CHE: return CHE; + case _HE_J: return HE_J; + case _XE: return XE; + case _SIN: return SIN; + case _SHIN: return SHIN; + case _SAD: return SAD; + case _ZAD: return ZAD; + case _AYN: return AYN; + case _AYN_: return AYN_; + case _GHAYN: return GHAYN; + case _GHAYN_: return GHAYN_; + case _FE: return FE; + case _GHAF: return GHAF; case _KAF_H: - case _KAF: - return KAF; - case _GAF: - return GAF; - case _LAM: - return LAM; - case _MIM: - return MIM; - case _NOON: - return NOON; - case _YE: - return YE_; - case YE_: - return YE; - case _YEE: - return YEE_; - case YEE_: - return YEE; - case TEE: - return TEE_; - case _IE: - return IE_; - case IE_: - return IE; + case _KAF: return KAF; + case _GAF: return GAF; + case _LAM: return LAM; + case _MIM: return MIM; + case _NOON: return NOON; + case _YE: return YE_; + case YE_: return YE; + case _YEE: return YEE_; + case YEE_: return YEE; + case TEE: return TEE_; + case _IE: return IE_; + case IE_: return IE; case _HE: - case _HE_: - return F_HE; + case _HE_: return F_HE; } return c; } /* -** Convert the Farsi 3342 standard into Farsi VIM. -*/ - void -conv_to_pvim() + * Convert the Farsi 3342 standard into Farsi VIM. + */ + static void +conv_to_pvim(void) { char_u *ptr; int lnum, llen, i; @@ -1806,14 +1688,14 @@ conv_to_pvim() llen = (int)STRLEN(ptr); - for ( i = 0; i < llen-1; i++) + for (i = 0; i < llen-1; i++) { if (canF_Ljoin(ptr[i]) && canF_Rjoin(ptr[i+1])) { ptr[i] = toF_leading(ptr[i]); ++i; - while (canF_Rjoin(ptr[i]) && i < llen) + while (i < llen && canF_Rjoin(ptr[i])) { ptr[i] = toF_Rjoin(ptr[i]); if (F_isterm(ptr[i]) || !F_isalpha(ptr[i])) @@ -1832,19 +1714,19 @@ conv_to_pvim() * Following lines contains Farsi encoded character. */ - do_cmdline_cmd((char_u *)"%s/\202\231/\232/g"); - do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/g"); + do_cmdline_cmd((char_u *)"%s/\202\231/\232/ge"); + do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/ge"); /* Assume the screen has been messed up: clear it and redraw. */ redraw_later(CLEAR); - MSG_ATTR(farsi_text_1, hl_attr(HLF_S)); + MSG_ATTR(farsi_text_1, HL_ATTR(HLF_S)); } /* * Convert the Farsi VIM into Farsi 3342 standard. */ - void -conv_to_pstd() + static void +conv_to_pstd(void) { char_u *ptr; int lnum, llen, i; @@ -1852,34 +1734,27 @@ conv_to_pstd() /* * Following line contains Farsi encoded character. */ - - do_cmdline_cmd((char_u *)"%s/\232/\202\231/g"); + do_cmdline_cmd((char_u *)"%s/\232/\202\231/ge"); for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { ptr = ml_get((linenr_T)lnum); - llen = (int)STRLEN(ptr); - for ( i = 0; i < llen; i++) - { + for (i = 0; i < llen; i++) ptr[i] = toF_TyA(ptr[i]); - - } } /* Assume the screen has been messed up: clear it and redraw. */ redraw_later(CLEAR); - MSG_ATTR(farsi_text_2, hl_attr(HLF_S)); + MSG_ATTR(farsi_text_2, HL_ATTR(HLF_S)); } /* * left-right swap the characters in buf[len]. */ static void -lrswapbuf(buf, len) - char_u *buf; - int len; +lrswapbuf(char_u *buf, int len) { char_u *s, *e; int c; @@ -1901,8 +1776,7 @@ lrswapbuf(buf, len) * swap all the characters in reverse direction */ char_u * -lrswap(ibuf) - char_u *ibuf; +lrswap(char_u *ibuf) { if (ibuf != NULL && *ibuf != NUL) lrswapbuf(ibuf, (int)STRLEN(ibuf)); @@ -1913,9 +1787,7 @@ lrswap(ibuf) * swap all the Farsi characters in reverse direction */ char_u * -lrFswap(cmdbuf, len) - char_u *cmdbuf; - int len; +lrFswap(char_u *cmdbuf, int len) { int i, cnt; @@ -1945,8 +1817,7 @@ lrFswap(cmdbuf, len) * TODO: handle different separator characters. Use skip_regexp(). */ char_u * -lrF_sub(ibuf) - char_u *ibuf; +lrF_sub(char_u *ibuf) { char_u *p, *ep; int i, cnt; @@ -1986,8 +1857,7 @@ lrF_sub(ibuf) * Map Farsi keyboard when in cmd_fkmap mode. */ int -cmdl_fkmap(c) - int c; +cmdl_fkmap(int c) { int tempc; @@ -2050,56 +1920,56 @@ cmdl_fkmap(c) case NL: case TAB: - switch ((tempc = cmd_gchar(AT_CURSOR))) - { - case _BE: - case _PE: - case _TE: - case _SE: - case _JIM: - case _CHE: - case _HE_J: - case _XE: - case _SIN: - case _SHIN: - case _SAD: - case _ZAD: - case _AYN: - case _GHAYN: - case _FE: - case _GHAF: - case _KAF: - case _GAF: - case _LAM: - case _MIM: - case _NOON: - case _HE: - case _HE_: - cmd_pchar(toF_TyA(tempc), AT_CURSOR); - break; - case _AYN_: - cmd_pchar(AYN_, AT_CURSOR); - break; - case _GHAYN_: - cmd_pchar(GHAYN_, AT_CURSOR); - break; - case _IE: - if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) - cmd_pchar(IE_, AT_CURSOR); - else - cmd_pchar(IE, AT_CURSOR); - break; - case _YEE: - if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) - cmd_pchar(YEE_, AT_CURSOR); - else - cmd_pchar(YEE, AT_CURSOR); - break; - case _YE: - if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) - cmd_pchar(YE_, AT_CURSOR); - else - cmd_pchar(YE, AT_CURSOR); + switch ((tempc = cmd_gchar(AT_CURSOR))) + { + case _BE: + case _PE: + case _TE: + case _SE: + case _JIM: + case _CHE: + case _HE_J: + case _XE: + case _SIN: + case _SHIN: + case _SAD: + case _ZAD: + case _AYN: + case _GHAYN: + case _FE: + case _GHAF: + case _KAF: + case _GAF: + case _LAM: + case _MIM: + case _NOON: + case _HE: + case _HE_: + cmd_pchar(toF_TyA(tempc), AT_CURSOR); + break; + case _AYN_: + cmd_pchar(AYN_, AT_CURSOR); + break; + case _GHAYN_: + cmd_pchar(GHAYN_, AT_CURSOR); + break; + case _IE: + if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) + cmd_pchar(IE_, AT_CURSOR); + else + cmd_pchar(IE, AT_CURSOR); + break; + case _YEE: + if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) + cmd_pchar(YEE_, AT_CURSOR); + else + cmd_pchar(YEE, AT_CURSOR); + break; + case _YE: + if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1)) + cmd_pchar(YE_, AT_CURSOR); + else + cmd_pchar(YE, AT_CURSOR); } switch (c) @@ -2170,7 +2040,7 @@ cmdl_fkmap(c) case 'f': return _BE; case 'g': return _LAM; case 'G': - if (cmd_gchar(AT_CURSOR) == _LAM ) + if (cmd_gchar(AT_CURSOR) == _LAM) { cmd_pchar(LAM, AT_CURSOR); return ALEF_U_H; @@ -2181,7 +2051,7 @@ cmdl_fkmap(c) else return ALEF_U_H; case 'h': - if (cmd_gchar(AT_CURSOR) == _LAM ) + if (cmd_gchar(AT_CURSOR) == _LAM) { cmd_pchar(LA, AT_CURSOR); redrawcmdline(); @@ -2237,19 +2107,18 @@ cmdl_fkmap(c) case ',': return WAW; case '[': return _JIM; case ']': return _CHE; - } + } - return c; + return c; } /* * F_isalpha returns TRUE if 'c' is a Farsi alphabet */ int -F_isalpha(c) - int c; +F_isalpha(int c) { - return (( c >= TEE_ && c <= _YE) + return ((c >= TEE_ && c <= _YE) || (c >= ALEF_A && c <= YE) || (c >= _IE && c <= YE_)); } @@ -2258,8 +2127,7 @@ F_isalpha(c) * F_isdigit returns TRUE if 'c' is a Farsi digit */ int -F_isdigit(c) - int c; +F_isdigit(int c) { return (c >= FARSI_0 && c <= FARSI_9); } @@ -2268,48 +2136,44 @@ F_isdigit(c) * F_ischar returns TRUE if 'c' is a Farsi character. */ int -F_ischar(c) - int c; +F_ischar(int c) { return (c >= TEE_ && c <= YE_); } void -farsi_fkey(cap) - cmdarg_T *cap; +farsi_f8(cmdarg_T *cap UNUSED) { - int c = cap->cmdchar; - - if (c == K_F8) + if (p_altkeymap) { - if (p_altkeymap) + if (curwin->w_farsi & W_R_L) { - if (curwin->w_farsi & W_R_L) - { - p_fkmap = 0; - do_cmdline_cmd((char_u *)"set norl"); - MSG(""); - } - else - { - p_fkmap = 1; - do_cmdline_cmd((char_u *)"set rl"); - MSG(""); - } - - curwin->w_farsi = curwin->w_farsi ^ W_R_L; + p_fkmap = 0; + do_cmdline_cmd((char_u *)"set norl"); + MSG(""); + } + else + { + p_fkmap = 1; + do_cmdline_cmd((char_u *)"set rl"); + MSG(""); } + + curwin->w_farsi = curwin->w_farsi ^ W_R_L; } +} - if (c == K_F9) + void +farsi_f9(cmdarg_T *cap UNUSED) +{ + if (p_altkeymap && curwin->w_p_rl) { - if (p_altkeymap && curwin->w_p_rl) - { - curwin->w_farsi = curwin->w_farsi ^ W_CONV; - if (curwin->w_farsi & W_CONV) - conv_to_pvim(); - else - conv_to_pstd(); - } + curwin->w_farsi = curwin->w_farsi ^ W_CONV; + if (curwin->w_farsi & W_CONV) + conv_to_pvim(); + else + conv_to_pstd(); } } + +#endif /* FEAT_FKMAP */ diff --git a/src/farsi.h b/src/farsi.h index ccd912ea0d..db6bda6d6a 100644 --- a/src/farsi.h +++ b/src/farsi.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/feature.h b/src/feature.h index 45d20f2878..8e94ba7fc4 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -54,17 +54,18 @@ #endif /* - * These executables are made available with the +big feature, because they - * are supposed to have enough RAM: Win32 (console & GUI), dos32, OS/2 and VMS. - * The dos16 version has very little RAM available, use +small. + * For Unix, Mac and Win32 use +huge by default. These days CPUs are fast and + * Memory is cheap. + * Use +big for older systems: Other MS-Windows and VMS. + * Otherwise use +normal */ #if !defined(FEAT_TINY) && !defined(FEAT_SMALL) && !defined(FEAT_NORMAL) \ && !defined(FEAT_BIG) && !defined(FEAT_HUGE) -# if defined(MSWIN) || defined(DJGPP) || defined(OS2) || defined(VMS) || defined(MACOS) || defined(AMIGA) -# define FEAT_BIG +# if defined(UNIX) || defined(WIN3264) || defined(MACOS_X) +# define FEAT_HUGE # else -# ifdef MSDOS -# define FEAT_SMALL +# if defined(MSWIN) || defined(VMS) || defined(AMIGA) +# define FEAT_BIG # else # define FEAT_NORMAL # endif @@ -93,31 +94,11 @@ */ /* + * These features used to be optional but are now always enabled. * +windows Multiple windows. Without this there is no help * window and no status lines. - */ -#ifdef FEAT_SMALL -# define FEAT_WINDOWS -#endif - -/* - * +listcmds Vim commands for the buffer list and the argument - * list. Without this there is no ":buffer" ":bnext", - * ":bdel", ":argdelete", etc. - */ -#ifdef FEAT_NORMAL -# define FEAT_LISTCMDS -#endif - -/* * +vertsplit Vertically split windows. */ -#ifdef FEAT_NORMAL -# define FEAT_VERTSPLIT -#endif -#if defined(FEAT_VERTSPLIT) && !defined(FEAT_WINDOWS) -# define FEAT_WINDOWS -#endif /* * +cmdhist Command line history. @@ -142,8 +123,8 @@ # define FEAT_JUMPLIST #endif -/* the cmdline-window requires FEAT_VERTSPLIT and FEAT_CMDHIST */ -#if defined(FEAT_VERTSPLIT) && defined(FEAT_CMDHIST) +/* the cmdline-window requires FEAT_CMDHIST */ +#if defined(FEAT_CMDHIST) # define FEAT_CMDWIN #endif @@ -247,13 +228,6 @@ # define FEAT_LINEBREAK #endif -/* - * +ex_extra ":retab", ":right", ":left", ":center", ":normal". - */ -#ifdef FEAT_NORMAL -# define FEAT_EX_EXTRA -#endif - /* * +extra_search 'hlsearch' and 'incsearch' options. */ @@ -321,7 +295,7 @@ * * Disabled for EBCDIC as it requires multibyte. */ -#if defined(FEAT_BIG) && !defined(WIN16) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) +#if defined(FEAT_BIG) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) # define FEAT_ARABIC #endif #ifdef FEAT_ARABIC @@ -347,7 +321,7 @@ * sorted by character values. I'm not sure how to fix this. Should we really * do a EBCDIC to ASCII conversion for this?? */ -#if defined(FEAT_NORMAL) && !defined(EBCDIC) +#if !defined(EBCDIC) # define FEAT_TAG_BINS #endif @@ -376,19 +350,16 @@ * +eval Built-in script language and expression evaluation, * ":let", ":if", etc. * +float Floating point variables. + * +num64 64-bit Number. */ #ifdef FEAT_NORMAL # define FEAT_EVAL -# if defined(HAVE_FLOAT_FUNCS) || defined(WIN3264) || defined(MACOS) +# if defined(HAVE_FLOAT_FUNCS) || defined(WIN3264) || defined(MACOS_X) # define FEAT_FLOAT # endif -#endif - -/* - * +python and +python3 require FEAT_EVAL. - */ -#if !defined(FEAT_EVAL) && (defined(FEAT_PYTHON3) || defined(FEAT_PYTHON)) -# define FEAT_EVAL +# if defined(HAVE_STDINT_H) || defined(WIN3264) || (VIM_SIZEOF_LONG >= 8) +# define FEAT_NUM64 +# endif #endif /* @@ -411,6 +382,13 @@ # define FEAT_RELTIME #endif +/* + * +timers timer_start() + */ +#if defined(FEAT_RELTIME) && (defined(UNIX) || defined(WIN32)) +# define FEAT_TIMERS +#endif + /* * +textobjects Text objects: "vaw", "das", etc. */ @@ -452,18 +430,11 @@ # define FEAT_MODIFY_FNAME #endif -/* - * +autocmd ":autocmd" command - */ -#ifdef FEAT_NORMAL -# define FEAT_AUTOCMD -#endif - /* * +diff Displaying diffs in a nice way. * Requires +windows and +autocmd. */ -#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) && defined(FEAT_AUTOCMD) +#if defined(FEAT_NORMAL) # define FEAT_DIFF #endif @@ -475,7 +446,7 @@ * and byte2line(). * Note: Required for Macintosh. */ -#if defined(FEAT_NORMAL) && !defined(MSDOS) +#if defined(FEAT_NORMAL) # define FEAT_TITLE #endif @@ -501,7 +472,7 @@ /* * +wildmenu 'wildmenu' option */ -#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) +#if defined(FEAT_NORMAL) # define FEAT_WILDMENU #endif @@ -549,7 +520,6 @@ * with HAVE_TGETENT defined). * * (nothing) Machine specific termcap entries will be included. - * This is default for win16 to save static data. * * SOME_BUILTIN_TCAPS Include most useful builtin termcap entries (used only * with NO_BUILTIN_TCAPS not defined). @@ -562,7 +532,7 @@ /* #define NO_BUILTIN_TCAPS */ #endif -#if !defined(NO_BUILTIN_TCAPS) && !defined(FEAT_GUI_W16) +#if !defined(NO_BUILTIN_TCAPS) # ifdef FEAT_BIG # define ALL_BUILTIN_TCAPS # else @@ -607,7 +577,7 @@ * +mksession ":mksession" command. * Requires +windows and +vertsplit. */ -#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) && defined(FEAT_VERTSPLIT) +#if defined(FEAT_NORMAL) # define FEAT_SESSION #endif @@ -633,8 +603,7 @@ */ #if (defined(FEAT_NORMAL) || defined(FEAT_GUI_GTK) || defined(FEAT_ARABIC) \ || defined(FEAT_GUI_MACVIM)) \ - && !defined(FEAT_MBYTE) && !defined(WIN16) \ - && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) + && !defined(FEAT_MBYTE) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) # define FEAT_MBYTE #endif @@ -651,7 +620,8 @@ /* #define FEAT_MBYTE_IME */ # endif -#if defined(FEAT_MBYTE_IME) && !defined(FEAT_MBYTE) +/* Input methods are only useful with +multi_byte. */ +#if (defined(FEAT_MBYTE_IME) || defined(FEAT_XIM)) && !defined(FEAT_MBYTE) # define FEAT_MBYTE #endif @@ -688,9 +658,6 @@ # define ESC_CHG_TO_ENG_MODE /* if defined, when ESC pressed, * turn to english mode */ -# if !defined(FEAT_XFONTSET) && defined(HAVE_X11) && !defined(FEAT_GUI_GTK) -# define FEAT_XFONTSET /* Hangul input requires xfontset */ -# endif # if defined(FEAT_XIM) && !defined(LINT) Error: You should select only ONE of XIM and HANGUL INPUT # endif @@ -698,7 +665,6 @@ #if defined(FEAT_HANGULIN) || defined(FEAT_XIM) /* # define X_LOCALE */ /* for OS with incomplete locale support, like old linux versions. */ -/* # define SLOW_XSERVER */ /* for extremely slow X server */ #endif /* @@ -724,20 +690,6 @@ # define FEAT_LIBCALL #endif -/* - * +scrollbind synchronization of split windows - */ -#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) -# define FEAT_SCROLLBIND -#endif - -/* - * +cursorbind synchronization of split windows - */ -#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) -# define FEAT_CURSORBIND -#endif - /* * +menu ":menu" command */ @@ -748,6 +700,13 @@ # endif #endif +/* + * popup menu in a terminal + */ +#if defined(FEAT_MENU) && !defined(ALWAYS_USE_GUI) && defined(FEAT_INS_EXPAND) +# define FEAT_TERM_POPUP_MENU +#endif + /* There are two ways to use XPM. */ #if (defined(HAVE_XM_XPMP_H) && defined(FEAT_GUI_MOTIF)) \ || defined(HAVE_X11_XPM_H) @@ -776,12 +735,12 @@ /* * GUI tabline */ -#if defined(FEAT_WINDOWS) && defined(FEAT_NORMAL) \ +#if defined(FEAT_NORMAL) \ && (defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_MACVIM) \ || (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \ || defined(FEAT_GUI_MAC) \ - || (defined(FEAT_GUI_MSWIN) && !defined(WIN16) \ + || (defined(FEAT_GUI_MSWIN) \ && (!defined(_MSC_VER) || _MSC_VER > 1020))) # define FEAT_GUI_TABLINE #endif @@ -802,7 +761,7 @@ * there is no terminal version, and on Windows we can't figure out how to * fork one off with :gui. */ -#if defined(FEAT_GUI_MSWIN) || (defined(FEAT_GUI_MAC) && !defined(MACOS_X_UNIX)) +#if defined(FEAT_GUI_MSWIN) || (defined(FEAT_GUI_MAC) && !defined(MACOS_X_DARWIN)) # define ALWAYS_USE_GUI #endif @@ -842,6 +801,13 @@ # endif #endif +/* + * +termguicolors 'termguicolors' option. + */ +#if (defined(FEAT_BIG) && defined(FEAT_SYN_HL)) && !defined(ALWAYS_USE_GUI) +# define FEAT_TERMGUICOLORS +#endif + /* Mac specific thing: Codewarrior interface. */ #ifdef FEAT_GUI_MAC # define FEAT_CW_EDITOR @@ -923,6 +889,11 @@ /* #define USR_VIMRC_FILE2 "~/bar/.vimrc" */ /* #define USR_VIMRC_FILE3 "$VIM/.vimrc" */ +/* + * VIM_DEFAULTS_FILE Name of the defaults.vim script file + */ +/* #define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" */ + /* * EVIM_FILE Name of the evim.vim script file */ @@ -1065,7 +1036,7 @@ * +mouse Any mouse support (any of the above enabled). */ /* OS/2 and Amiga console have no mouse support */ -#if !defined(AMIGA) && !defined(OS2) +#if !defined(AMIGA) # ifdef FEAT_NORMAL # define FEAT_MOUSE_XTERM # endif @@ -1081,7 +1052,7 @@ # ifdef FEAT_BIG # define FEAT_MOUSE_SGR # endif -# if defined(FEAT_NORMAL) && (defined(MSDOS) || defined(WIN3264)) +# if defined(FEAT_NORMAL) && defined(WIN3264) # define DOS_MOUSE # endif # if defined(FEAT_NORMAL) && defined(__QNX__) @@ -1188,6 +1159,20 @@ # define FEAT_CLIENTSERVER #endif +/* + * +autoservername Automatically generate a servername for clientserver + * when --servername is not passed on the command line. + */ +#if defined(FEAT_CLIENTSERVER) && !defined(FEAT_AUTOSERVERNAME) +# ifdef WIN3264 + /* Always enabled on MS-Windows. */ +# define FEAT_AUTOSERVERNAME +# else + /* Enable here if you don't use configure. */ +/* # define FEAT_AUTOSERVERNAME */ +# endif +#endif + /* * +termresponse send t_RV to obtain terminal response. Used for xterm * to check if mouse dragging can be used and if term @@ -1203,10 +1188,10 @@ */ #ifdef FEAT_NORMAL /* MS-DOS console and Win32 console can change cursor shape */ -# if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32)) +# if defined(WIN3264) && !defined(FEAT_GUI_W32) # define MCH_CURSOR_SHAPE # endif -# if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16) || defined(FEAT_GUI_MOTIF) \ +# if defined(FEAT_GUI_W32) || defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MACVIM) # define FEAT_MOUSESHAPE @@ -1253,9 +1238,9 @@ * +perl Perl interface: "--enable-perlinterp" * +python Python interface: "--enable-pythoninterp" * +tcl TCL interface: "--enable-tclinterp" - * +sniff Sniff interface: "--enable-sniff" * +sun_workshop Sun Workshop integration * +netbeans_intg Netbeans integration + * +channel Inter process communication */ /* @@ -1272,13 +1257,31 @@ #endif /* - * The Netbeans feature requires +listcmds and +eval. + * The Netbeans feature requires +eval. */ -#if (!defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \ - && defined(FEAT_NETBEANS_INTG) +#if !defined(FEAT_EVAL) && defined(FEAT_NETBEANS_INTG) # undef FEAT_NETBEANS_INTG #endif +/* + * The +channel feature requires +eval. + */ +#if !defined(FEAT_EVAL) && defined(FEAT_JOB_CHANNEL) +# undef FEAT_JOB_CHANNEL +#endif + +/* + * +terminal ":terminal" command. Runs a terminal in a window. + * requires +channel and +multibyte + */ +#if defined(FEAT_TERMINAL) && \ + !(defined(FEAT_JOB_CHANNEL) && defined(FEAT_MBYTE)) +# undef FEAT_TERMINAL +#endif +#if defined(FEAT_TERMINAL) && !defined(CURSOR_SHAPE) +# define CURSOR_SHAPE +#endif + /* * +signs Allow signs to be displayed to the left of text lines. * Adds the ":sign" command. @@ -1307,17 +1310,29 @@ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)) \ || defined(FEAT_SUN_WORKSHOP) \ || defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL)) -# define FEAT_BEVAL +# define FEAT_BEVAL_GUI # if !defined(FEAT_XFONTSET) && !defined(FEAT_GUI_GTK) \ && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_MACVIM) # define FEAT_XFONTSET # endif #endif -#if defined(FEAT_BEVAL) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) +#if defined(FEAT_BEVAL_GUI) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) # define FEAT_BEVAL_TIP /* balloon eval used for toolbar tooltip */ #endif +/* + * +balloon_eval_term Allow balloon expression evaluation in the terminal. + */ +#if defined(FEAT_HUGE) && defined(FEAT_TIMERS) && \ + (defined(UNIX) || (defined(WIN32) && !defined(FEAT_GUI_W32))) +# define FEAT_BEVAL_TERM +#endif + +#if defined(FEAT_BEVAL_GUI) || defined(FEAT_BEVAL_TERM) +# define FEAT_BEVAL +#endif + /* both Motif and Athena are X11 and share some code */ #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) # define FEAT_GUI_X11 @@ -1373,6 +1388,23 @@ # define FEAT_FILTERPIPE #endif +/* + * +vtp: Win32 virtual console. + */ +#if !defined(FEAT_GUI) && defined(WIN3264) +# define FEAT_VTP +#endif + +/* + * +migemo Regexp pattern expansion. See: + * http://migemo.namazu.org/ + * http://www.kaoriya.net/ + */ +/* Use migemo_open() when it's available */ +#if (defined(HAVE_MIGEMO_H) && defined(HAVE_MIGEMO)) || defined(DYNAMIC_MIGEMO) +# define USE_MIGEMO +#endif + /* * +transparency 'transparency' option. */ diff --git a/src/fileio.c b/src/fileio.c index 0f3b024048..03f4fa66a0 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -24,56 +24,35 @@ #define BUFSIZE 8192 /* size of normal write buffer */ #define SMBUFSIZE 256 /* size of emergency write buffer */ -#ifdef FEAT_CRYPT -/* crypt_magic[0] is pkzip crypt, crypt_magic[1] is sha2+blowfish */ -static char *crypt_magic[] = {"VimCrypt~01!", "VimCrypt~02!"}; -static char crypt_magic_head[] = "VimCrypt~"; -# define CRYPT_MAGIC_LEN 12 /* must be multiple of 4! */ - -/* For blowfish, after the magic header, we store 8 bytes of salt and then 8 - * bytes of seed (initialisation vector). */ -static int crypt_salt_len[] = {0, 8}; -static int crypt_seed_len[] = {0, 8}; -#define CRYPT_SALT_LEN_MAX 8 -#define CRYPT_SEED_LEN_MAX 8 -#endif - /* Is there any system that doesn't have access()? */ #define USE_MCH_ACCESS -#if defined(sun) && defined(S_ISCHR) -# define OPEN_CHR_FILES -static int is_dev_fd_file(char_u *fname); -#endif #ifdef FEAT_MBYTE -static char_u *next_fenc __ARGS((char_u **pp)); +static char_u *next_fenc(char_u **pp); # ifdef FEAT_EVAL -static char_u *readfile_charconvert __ARGS((char_u *fname, char_u *fenc, int *fdp)); +static char_u *readfile_charconvert(char_u *fname, char_u *fenc, int *fdp); # endif #endif #ifdef FEAT_VIMINFO -static void check_marks_read __ARGS((void)); +static void check_marks_read(void); #endif #ifdef FEAT_CRYPT -static int crypt_method_from_magic __ARGS((char *ptr, int len)); -static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, off_t *filesizep, int newfile, char_u *fname, int *did_ask)); +static char_u *check_for_cryptkey(char_u *cryptkey, char_u *ptr, long *sizep, off_T *filesizep, int newfile, char_u *fname, int *did_ask); #endif #ifdef UNIX -static void set_file_time __ARGS((char_u *fname, time_t atime, time_t mtime)); +static void set_file_time(char_u *fname, time_t atime, time_t mtime); #endif -static int set_rw_fname __ARGS((char_u *fname, char_u *sfname)); -static int msg_add_fileformat __ARGS((int eol_type)); -static void msg_add_eol __ARGS((void)); -static int check_mtime __ARGS((buf_T *buf, struct stat *s)); -static int time_differs __ARGS((long t1, long t2)); -#ifdef FEAT_AUTOCMD -static int apply_autocmds_exarg __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap)); -static int au_find_group __ARGS((char_u *name)); +static int set_rw_fname(char_u *fname, char_u *sfname); +static int msg_add_fileformat(int eol_type); +static void msg_add_eol(void); +static int check_mtime(buf_T *buf, stat_T *s); +static int time_differs(long t1, long t2); +static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap); +static int au_find_group(char_u *name); # define AUGROUP_DEFAULT -1 /* default autocmd group */ # define AUGROUP_ERROR -2 /* erroneous autocmd group */ # define AUGROUP_ALL -3 /* all autocmd groups */ -#endif #if defined(FEAT_CRYPT) || defined(FEAT_MBYTE) # define HAS_BW_FLAGS @@ -87,7 +66,7 @@ static int au_find_group __ARGS((char_u *name)); # define FIO_PUT_CP(x) (((x) & 0xffff) << 16) /* put codepage in top word */ # define FIO_GET_CP(x) (((x)>>16) & 0xffff) /* get codepage from top word */ # endif -# ifdef MACOS_X +# ifdef MACOS_CONVERT # define FIO_MACROMAN 0x20 /* convert MacRoman */ # endif # define FIO_ENDIAN_L 0x80 /* little endian */ @@ -116,6 +95,9 @@ struct bw_info #ifdef HAS_BW_FLAGS int bw_flags; /* FIO_ flags */ #endif +#ifdef FEAT_CRYPT + buf_T *bw_buffer; /* buffer being written */ +#endif #ifdef FEAT_MBYTE char_u bw_rest[CONV_RESTLEN]; /* not converted bytes */ int bw_restlen; /* nr of bytes in bw_rest[] */ @@ -131,36 +113,44 @@ struct bw_info #endif }; -static int buf_write_bytes __ARGS((struct bw_info *ip)); +static int buf_write_bytes(struct bw_info *ip); #ifdef FEAT_MBYTE -static linenr_T readfile_linenr __ARGS((linenr_T linecnt, char_u *p, char_u *endp)); -static int ucs2bytes __ARGS((unsigned c, char_u **pp, int flags)); -static int need_conversion __ARGS((char_u *fenc)); -static int get_fio_flags __ARGS((char_u *ptr)); -static char_u *check_for_bom __ARGS((char_u *p, long size, int *lenp, int flags)); -static int make_bom __ARGS((char_u *buf, char_u *name)); +static linenr_T readfile_linenr(linenr_T linecnt, char_u *p, char_u *endp); +static int ucs2bytes(unsigned c, char_u **pp, int flags); +static int need_conversion(char_u *fenc); +static int get_fio_flags(char_u *ptr); +static char_u *check_for_bom(char_u *p, long size, int *lenp, int flags); +static int make_bom(char_u *buf, char_u *name); # ifdef WIN3264 -static int get_win_fio_flags __ARGS((char_u *ptr)); +static int get_win_fio_flags(char_u *ptr); # endif -# ifdef MACOS_X -static int get_mac_fio_flags __ARGS((char_u *ptr)); +# ifdef MACOS_CONVERT +static int get_mac_fio_flags(char_u *ptr); # endif #endif -static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf)); +static int move_lines(buf_T *frombuf, buf_T *tobuf); #ifdef TEMPDIRNAMES -static void vim_settempdir __ARGS((char_u *tempdir)); +static void vim_settempdir(char_u *tempdir); #endif -#ifdef FEAT_AUTOCMD static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name"); -#endif + +/* + * Set by the apply_autocmds_group function if the given event is equal to + * EVENT_FILETYPE. Used by the readfile function in order to determine if + * EVENT_BUFREADPOST triggered the EVENT_FILETYPE. + * + * Relying on this value requires one to reset it prior calling + * apply_autocmds_group. + */ +static int au_did_filetype INIT(= FALSE); void -filemess(buf, name, s, attr) - buf_T *buf; - char_u *name; - char_u *s; - int attr; +filemess( + buf_T *buf, + char_u *name, + char_u *s, + int attr) { int msg_scroll_save; @@ -191,6 +181,248 @@ filemess(buf, name, s, attr) msg_scrolled_ign = FALSE; } +#if 0 +typedef struct encode_state encode_state; +typedef int (*encode_check)(encode_state* state, char_u d); +struct encode_state +{ + char_u name[32]; + int enable; + int score; + int mode; + encode_check check; +}; + + static int +guess_cp932_check(encode_state* state, char_u d) +{ + switch (state->mode) + { + default: + case 0: + if ((0x81 <= d && d <= 0x9f) || (0xe0 <= d && d <= 0xf0)) + state->mode = 1; + else if (d == 0x80 || 0xf1 <= d) + return 1; + else + ++state->score; + break; + case 1: + if ((0x40 <= d && d <= 0x7e) || (0x80 <= d && d <= 0xfc)) + { + ++state->score; + state->mode = 0; + } + else + return 1; + break; + } + return 0; +} + + static int +guess_eucjp_check(encode_state* state, char_u d) +{ + int is_euc_range = (0xa1 <= d && d <= 0xfe) ? 1 : 0; + switch (state->mode) + { + default: + case 0: + if (is_euc_range) + state->mode = 1; + else if (d < 0x80) + ++state->score; + else + return 1; + break; + case 1: + if (is_euc_range) + { + ++state->score; + state->mode = 0; + } + else + return 1; + break; + } + return 0; +} + + static int +guess_iso2022jp_check(encode_state* state, char_u d) +{ + /* TODO: Implement me. */ + return 1; +} + + static int +guess_utf8_check(encode_state* state, char_u d) +{ + if (state->mode < 1) + { + if ((d & 0x80) != 0) + { + if ((d & 0xe0) == 0xc0) + state->mode = 1; + else if ((d & 0xf0) == 0xe0) + state->mode = 2; + else if ((d & 0xf8) == 0xf0) + state->mode = 3; + else if ((d & 0xfc) == 0xf8) + state->mode = 4; + else if ((d & 0xfe) == 0xfc) + state->mode = 5; + else + return 1; + } + else + ++state->score; + } + else + { + if ((d & 0xc0) == 0x80) + { + --state->mode; + if (!state->mode == 0) + ++state->score; + } + else + return 1; + } + return 0; +} + +/* + * return 0 if no guess was made. otherwise return 1. + */ + static int +guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname) +{ + char_u* newenc = NULL; + FILE* fp = NULL; + encode_state enc_table[] = { + { "cp932", 1, 0, 0, guess_cp932_check }, + { "euc-jp", 1, 0, 0, guess_eucjp_check }, + { "iso-2022-jp", 1, 0, 0, guess_iso2022jp_check }, + { "utf-8", 1, 0, 0, guess_utf8_check }, + }; + int enc_count; + int enc_available; /* count of encodings be available. */ + char_u readbuf[1024]; + int readlen; + int i, j; + char_u d; + encode_state* pstate; + + if (p_verbose >= 1) + { + verbose_enter_scroll(); + smsg((char_u*)"guess_encode:"); + smsg((char_u*)" init: fenc=%s alloced=%d fname=%s", + *fenc, *fenc_alloced, fname); + verbose_leave_scroll(); + } + + /* open a file. */ + if (!fname) + return 0; /* not support to read from stdin. */ + fp = mch_fopen(fname, "r"); + if (!fp) + return 0; /* raise an error when failed to open file. */ + + /* initiate states of encode. */ + enc_count = sizeof(enc_table) / sizeof(enc_table[0]); + enc_available = enc_count; + + /* + * read bytes from the file and pass it to guess engines, until the + * encoding is determined. + */ + while (enc_available > 1 && !feof(fp)) + { + readlen = fread(readbuf, 1, sizeof(readbuf), fp); + if (p_verbose >= 2) + { + verbose_enter_scroll(); + smsg((char_u*)" read: len=%d", readlen); + verbose_leave_scroll(); + } + if (readlen <= 0) + break; + for (i = 0; enc_available > 1 && i < readlen; ++i) + { + d = readbuf[i]; + /* pass 'd' to all available encodings. */ + for (j = 0; enc_available > 1 && j < enc_count; ++j) + { + pstate = &enc_table[j]; + if (!pstate->enable || !pstate->check) + continue; + switch (pstate->check(pstate, d)) + { + case 0: /* keep "alive" state */ + break; + case 1: /* disable this encode. */ + pstate->enable = 0; + --enc_available; + break; + case 2: /* make this encode primary one. */ + enc_available = 1; + newenc = pstate->name; + break; + } + } + } + } + + /* determine newenc which have max score. */ + if (newenc == NULL) + { + int minscore = -1; + + for (i = 0; i < enc_count; ++i) + { + pstate = &enc_table[i]; + if (p_verbose >= 1) + { + verbose_enter_scroll(); + smsg(" check: name=%s enable=%d score=%d", + pstate->name, pstate->enable, pstate->score); + verbose_leave_scroll(); + } + if (pstate->enable + && (minscore < 0 || minscore > pstate->score || + (minscore == pstate->score + && STRCMP(pstate->name, p_enc) == 0))) + { + newenc = pstate->name; + minscore = pstate->score; + } + } + } + + /* close a file. */ + fclose(fp); + + if (newenc) + { + if (p_verbose >= 1) + { + verbose_enter_scroll(); + smsg(" result: newenc=%s", newenc); + verbose_leave_scroll(); + } + if (*fenc_alloced) + vim_free(*fenc); + *fenc = vim_strsave(newenc); + *fenc_alloced = TRUE; + } + return 1; +} +#else +extern int guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname); +#endif + /* * Read lines from file "fname" into the buffer after line "from". * @@ -212,18 +444,19 @@ filemess(buf, name, s, attr) * stdin) * READ_DUMMY read into a dummy buffer (to check if file contents changed) * READ_KEEP_UNDO don't clear undo info or read it from a file + * READ_FIFO read from fifo/socket instead of a file * - * return FAIL for failure, OK otherwise + * return FAIL for failure, NOTDONE for directory (failure), or OK */ int -readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) - char_u *fname; - char_u *sfname; - linenr_T from; - linenr_T lines_to_skip; - linenr_T lines_to_read; - exarg_T *eap; /* can be NULL! */ - int flags; +readfile( + char_u *fname, + char_u *sfname, + linenr_T from, + linenr_T lines_to_skip, + linenr_T lines_to_read, + exarg_T *eap, /* can be NULL! */ + int flags) { int fd = 0; int newfile = (flags & READ_NEW); @@ -231,6 +464,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) int filtering = (flags & READ_FILTER); int read_stdin = (flags & READ_STDIN); int read_buffer = (flags & READ_BUFFER); + int read_fifo = (flags & READ_FIFO); int set_options = newfile || read_buffer || (eap != NULL && eap->read_edit); linenr_T read_buf_lnum = 1; /* next line to read from curbuf */ @@ -245,12 +479,11 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) colnr_T len; long size = 0; char_u *p; - off_t filesize = 0; + off_T filesize = 0; int skip_read = FALSE; #ifdef FEAT_CRYPT char_u *cryptkey = NULL; int did_ask_for_key = FALSE; - int crypt_method_used; #endif #ifdef FEAT_PERSISTENT_UNDO context_sha256_T sha_ctx; @@ -270,16 +503,16 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #endif int fileformat = 0; /* end-of-line format */ int keep_fileformat = FALSE; - struct stat st; + stat_T st; int file_readonly; linenr_T skip_count = 0; linenr_T read_count = 0; int msg_save = msg_scroll; linenr_T read_no_eol_lnum = 0; /* non-zero lnum when last line of * last read was missing the eol */ - int try_mac = (vim_strchr(p_ffs, 'm') != NULL); - int try_dos = (vim_strchr(p_ffs, 'd') != NULL); - int try_unix = (vim_strchr(p_ffs, 'x') != NULL); + int try_mac; + int try_dos; + int try_unix; int file_rewind = FALSE; #ifdef FEAT_MBYTE int can_retry; @@ -310,13 +543,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) char_u conv_rest[CONV_RESTLEN]; int conv_restlen = 0; /* nr of bytes in conv_rest[] */ #endif -#ifdef FEAT_AUTOCMD buf_T *old_curbuf; char_u *old_b_ffname; char_u *old_b_fname; int using_b_ffname; int using_b_fname; -#endif + + au_did_filetype = FALSE; /* reset before triggering any autocommands */ curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */ @@ -336,7 +569,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) return FAIL; } -#ifdef FEAT_AUTOCMD /* Remember the initial values of curbuf, curbuf->b_ffname and * curbuf->b_fname to detect whether they are altered as a result of * executing nasty autocommands. Also check if "fname" and "sfname" @@ -347,7 +579,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) using_b_ffname = (fname == curbuf->b_ffname) || (sfname == curbuf->b_ffname); using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname); -#endif /* After reading a file the cursor line changes but we don't want to * display the line. */ @@ -364,11 +595,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) */ if (sfname == NULL) sfname = fname; -#if defined(UNIX) || defined(__EMX__) +#if defined(UNIX) fname = sfname; #endif -#ifdef FEAT_AUTOCMD /* * The BufReadCmd and FileReadCmd events intercept the reading process by * executing the associated commands instead. @@ -403,7 +633,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) curbuf->b_op_start = pos; } -#endif if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) msg_scroll = FALSE; /* overwrite previous file message */ @@ -428,7 +657,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) } } - if (!read_stdin && !read_buffer) + if (!read_stdin && !read_buffer && !read_fifo) { #ifdef UNIX /* @@ -449,16 +678,21 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) # endif ) { + int retval = FAIL; + if (S_ISDIR(perm)) + { filemess(curbuf, fname, (char_u *)_("is a directory"), 0); + retval = NOTDONE; + } else filemess(curbuf, fname, (char_u *)_("is not a file"), 0); msg_end(); msg_scroll = msg_save; - return FAIL; + return retval; } #endif -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* * MS-Windows allows opening a device, but we will probably get stuck * trying to read it. @@ -486,7 +720,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) if (check_readonly && !readonlymode) curbuf->b_p_ro = FALSE; - if (newfile && !read_stdin && !read_buffer) + if (newfile && !read_stdin && !read_buffer && !read_fifo) { /* Remember time of file. */ if (mch_stat((char *)fname, &st) >= 0) @@ -534,12 +768,12 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) /* * for UNIX: check readonly with perm and mch_access() - * for MSDOS and Amiga: check readonly by trying to open the file for writing + * for Amiga: check readonly by trying to open the file for writing */ file_readonly = FALSE; if (read_stdin) { -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* Force binary I/O on stdin to avoid CR-LF -> LF conversion. */ setmode(0, O_BINARY); #endif @@ -574,7 +808,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) msg_scroll = msg_save; #ifndef UNIX /* - * On MSDOS and Amiga we can't open a directory, check here. + * On Amiga we can't open a directory, check here. */ isdir_f = (mch_isdir(fname)); perm = mch_getperm(fname); /* check if the file exists */ @@ -607,7 +841,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #endif { check_need_swap(newfile); -#ifdef FEAT_AUTOCMD /* SwapExists autocommand may mess things up */ if (curbuf != old_curbuf || (using_b_ffname @@ -618,7 +851,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) EMSG(_(e_auchangedbuf)); return FAIL; } -#endif } if (dir_of_file_exists(fname)) filemess(curbuf, sfname, (char_u *)_("[New File]"), 0); @@ -635,14 +867,12 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) if (eap != NULL) set_forced_fenc(eap); #endif -#ifdef FEAT_AUTOCMD apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname, FALSE, curbuf, eap); -#endif /* remember the current fileformat */ save_file_ff(curbuf); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif @@ -695,7 +925,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #endif { check_need_swap(newfile); -#ifdef FEAT_AUTOCMD if (!read_stdin && (curbuf != old_curbuf || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) || (using_b_fname && (old_b_fname != curbuf->b_fname)))) @@ -705,12 +934,36 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) close(fd); return FAIL; } -#endif #ifdef UNIX /* Set swap file protection bits after creating it. */ if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL && curbuf->b_ml.ml_mfp->mf_fname != NULL) - (void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode); + { + char_u *swap_fname = curbuf->b_ml.ml_mfp->mf_fname; + + /* + * If the group-read bit is set but not the world-read bit, then + * the group must be equal to the group of the original file. If + * we can't make that happen then reset the group-read bit. This + * avoids making the swap file readable to more users when the + * primary group of the user is too permissive. + */ + if ((swap_mode & 044) == 040) + { + stat_T swap_st; + + if (mch_stat((char *)swap_fname, &swap_st) >= 0 + && st.st_gid != swap_st.st_gid +# ifdef HAVE_FCHOWN + && fchown(curbuf->b_ml.ml_mfp->mf_fd, -1, st.st_gid) + == -1 +# endif + ) + swap_mode &= 0600; + } + + (void)mch_setperm(swap_fname, (long)swap_mode); + } #endif } @@ -732,7 +985,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) curbuf->b_op_start.lnum = ((from == 0) ? 1 : from); curbuf->b_op_start.col = 0; -#ifdef FEAT_AUTOCMD + try_mac = (vim_strchr(p_ffs, 'm') != NULL); + try_dos = (vim_strchr(p_ffs, 'd') != NULL); + try_unix = (vim_strchr(p_ffs, 'x') != NULL); + if (!read_buffer) { int m = msg_scroll; @@ -763,6 +1019,11 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) else apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname, FALSE, NULL, eap); + /* autocommands may have changed it */ + try_mac = (vim_strchr(p_ffs, 'm') != NULL); + try_dos = (vim_strchr(p_ffs, 'd') != NULL); + try_unix = (vim_strchr(p_ffs, 'x') != NULL); + if (msg_scrolled == n) msg_scroll = m; @@ -797,7 +1058,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) return FAIL; } } -#endif /* FEAT_AUTOCMD */ /* Autocommands may add lines to the file, need to check if it is empty */ wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY); @@ -812,17 +1072,20 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) */ if (read_stdin) { + if (!is_not_a_term()) + { #ifndef ALWAYS_USE_GUI - mch_msg(_("Vim: Reading from stdin...\n")); + mch_msg(_("Vim: Reading from stdin...\n")); #endif #ifdef FEAT_GUI - /* Also write a message in the GUI window, if there is one. */ - if (gui.in_use && !gui.dying && !gui.starting) - { - p = (char_u *)_("Reading from stdin..."); - gui_write(p, (int)STRLEN(p)); - } + /* Also write a message in the GUI window, if there is one. */ + if (gui.in_use && !gui.dying && !gui.starting) + { + p = (char_u *)_("Reading from stdin..."); + gui_write(p, (int)STRLEN(p)); + } #endif + } } else if (!read_buffer) filemess(curbuf, sfname, (char_u *)"", 0); @@ -882,7 +1145,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) /* Read the first line (and a bit more). Immediately rewind to * the start of the file. If the read() fails "len" is -1. */ len = read_eintr(fd, firstline, 80); - lseek(fd, (off_t)0L, SEEK_SET); + vim_lseek(fd, (off_T)0L, SEEK_SET); for (p = firstline; p < firstline + len; ++p) if (*p >= 0x80) { @@ -946,7 +1209,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) read_buf_lnum = 1; read_buf_col = 0; } - else if (read_stdin || lseek(fd, (off_t)0L, SEEK_SET) != 0) + else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) { /* Can't rewind the file, give up. */ error = TRUE; @@ -966,13 +1229,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #endif } -#ifdef FEAT_CRYPT - if (cryptkey != NULL) - /* Need to reset the state, but keep the key, don't want to ask for it - * again. */ - crypt_pop_state(); -#endif - /* * When retrying with another "fenc" and the first time "fileformat" * will be reset. @@ -1040,11 +1296,21 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) if (tmpname != NULL) { mch_remove(tmpname); /* delete converted file */ - vim_free(tmpname); - tmpname = NULL; + VIM_CLEAR(tmpname); } } +# ifdef FEAT_EVAL + /* + * Try to guess encoding of the file. + */ + if (STRICMP(fenc, "guess") == 0) + { + if (guess_encode(&fenc, &fenc_alloced, fname) != 0) + set_internal_string_var((char_u *)"b:x_guessed_fileencoding", fenc); + } +# endif + /* * Conversion may be required when the encoding of the file is different * from 'encoding' or 'encoding' is UTF-16, UCS-2 or UCS-4. @@ -1080,7 +1346,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) fio_flags = get_win_fio_flags(fenc); # endif -# ifdef MACOS_X +# ifdef MACOS_CONVERT /* Conversion from Apple MacRoman to latin1 or UTF-8 */ if (fio_flags == 0) fio_flags = get_mac_fio_flags(fenc); @@ -1105,6 +1371,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) * and we can't do it internally or with iconv(). */ if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL + && !read_fifo # ifdef USE_ICONV && iconv_fd == (iconv_t)-1 # endif @@ -1153,7 +1420,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) /* Set "can_retry" when it's possible to rewind the file and try with * another "fenc" value. It's FALSE when no other "fenc" to try, reading * stdin or fixed at a specific encoding. */ - can_retry = (*fenc != NUL && !read_stdin && !keep_dest_enc); + can_retry = (*fenc != NUL && !read_stdin && !read_fifo && !keep_dest_enc); #endif if (!skip_read) @@ -1170,10 +1437,20 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) && curbuf->b_ffname != NULL && curbuf->b_p_udf && !filtering + && !read_fifo && !read_stdin && !read_buffer); if (read_undo_file) sha256_start(&sha_ctx); +#endif +#ifdef FEAT_CRYPT + if (curbuf->b_cryptstate != NULL) + { + /* Need to free the state, but keep the key, don't want to ask for + * it again. */ + crypt_free_state(curbuf->b_cryptstate); + curbuf->b_cryptstate = NULL; + } #endif } @@ -1185,28 +1462,42 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) * The amount is limited by the fact that read() only can read * upto max_unsigned characters (and other things). */ -#if VIM_SIZEOF_INT <= 2 - if (linerest >= 0x7ff0) - { - ++split; - *ptr = NL; /* split line by inserting a NL */ - size = 1; - } - else -#endif + if (!skip_read) { - if (!skip_read) - { #if VIM_SIZEOF_INT > 2 # if defined(SSIZE_MAX) && (SSIZE_MAX < 0x10000L) size = SSIZE_MAX; /* use max I/O size, 52K */ # else - size = 0x10000L; /* use buffer >= 64K */ + /* Use buffer >= 64K. Add linerest to double the size if the + * line gets very long, to avoid a lot of copying. But don't + * read more than 1 Mbyte at a time, so we can be interrupted. + */ + size = 0x10000L + linerest; + if (size > 0x100000L) + size = 0x100000L; # endif #else size = 0x7ff0L - linerest; /* limit buffer to 32K */ #endif + } + /* Protect against the argument of lalloc() going negative. */ + if ( +#if VIM_SIZEOF_INT <= 2 + linerest >= 0x7ff0 +#else + size < 0 || size + linerest + 1 < 0 || linerest >= MAXCOL +#endif + ) + { + ++split; + *ptr = NL; /* split line by inserting a NL */ + size = 1; + } + else + { + if (!skip_read) + { for ( ; size >= 10; size = (long)((long_u)size >> 1)) { if ((new_buffer = lalloc((long_u)(size + linerest + 1), @@ -1255,7 +1546,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) else if (fio_flags & FIO_CODEPAGE) size = size / ICONV_MULT; /* also worst case */ # endif -# ifdef MACOS_X +# ifdef MACOS_CONVERT else if (fio_flags & FIO_MACROMAN) size = size / ICONV_MULT; /* also worst case */ # endif @@ -1339,6 +1630,77 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) size = read_eintr(fd, ptr, size); } +#ifdef FEAT_CRYPT + /* + * At start of file: Check for magic number of encryption. + */ + if (filesize == 0 && size > 0) + cryptkey = check_for_cryptkey(cryptkey, ptr, &size, + &filesize, newfile, sfname, + &did_ask_for_key); + /* + * Decrypt the read bytes. This is done before checking for + * EOF because the crypt layer may be buffering. + */ + if (cryptkey != NULL && curbuf->b_cryptstate != NULL + && size > 0) + { + if (crypt_works_inplace(curbuf->b_cryptstate)) + { + crypt_decode_inplace(curbuf->b_cryptstate, ptr, size); + } + else + { + char_u *newptr = NULL; + int decrypted_size; + + decrypted_size = crypt_decode_alloc( + curbuf->b_cryptstate, ptr, size, &newptr); + + /* If the crypt layer is buffering, not producing + * anything yet, need to read more. */ + if (decrypted_size == 0) + continue; + + if (linerest == 0) + { + /* Simple case: reuse returned buffer (may be + * NULL, checked later). */ + new_buffer = newptr; + } + else + { + long_u new_size; + + /* Need new buffer to add bytes carried over. */ + new_size = (long_u)(decrypted_size + linerest + 1); + new_buffer = lalloc(new_size, FALSE); + if (new_buffer == NULL) + { + do_outofmem_msg(new_size); + error = TRUE; + break; + } + + mch_memmove(new_buffer, buffer, linerest); + if (newptr != NULL) + mch_memmove(new_buffer + linerest, newptr, + decrypted_size); + } + + if (new_buffer != NULL) + { + vim_free(buffer); + buffer = new_buffer; + new_buffer = NULL; + line_start = buffer; + ptr = buffer + linerest; + } + size = decrypted_size; + } + } +#endif + if (size <= 0) { if (size < 0) /* read error */ @@ -1403,21 +1765,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) } #endif } - -#ifdef FEAT_CRYPT - /* - * At start of file: Check for magic number of encryption. - */ - if (filesize == 0) - cryptkey = check_for_cryptkey(cryptkey, ptr, &size, - &filesize, newfile, sfname, - &did_ask_for_key); - /* - * Decrypt the read bytes. - */ - if (cryptkey != NULL && size > 0) - crypt_decode(ptr, size); -#endif } skip_read = FALSE; @@ -1430,10 +1777,9 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) */ if ((filesize == 0 # ifdef FEAT_CRYPT - || (filesize == (CRYPT_MAGIC_LEN - + crypt_salt_len[use_crypt_method] - + crypt_seed_len[use_crypt_method]) - && cryptkey != NULL) + || (cryptkey != NULL + && filesize == crypt_get_header_len( + crypt_get_method_nr(curbuf))) # endif ) && (fio_flags == FIO_UCSBOM @@ -1882,17 +2228,17 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) { if (fio_flags & FIO_ENDIAN_L) { - u8c = (*--p << 24); - u8c += (*--p << 16); - u8c += (*--p << 8); + u8c = (unsigned)*--p << 24; + u8c += (unsigned)*--p << 16; + u8c += (unsigned)*--p << 8; u8c += *--p; } else /* big endian */ { u8c = *--p; - u8c += (*--p << 8); - u8c += (*--p << 16); - u8c += (*--p << 24); + u8c += (unsigned)*--p << 8; + u8c += (unsigned)*--p << 16; + u8c += (unsigned)*--p << 24; } } else /* UTF-8 */ @@ -2056,6 +2402,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) /* First try finding a NL, for Dos and Unix */ if (try_dos || try_unix) { + /* Reset the carriage return counter. */ + if (try_mac) + try_mac = 1; + for (p = ptr; p < ptr + size; ++p) { if (*p == NL) @@ -2067,6 +2417,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) fileformat = EOL_UNIX; break; } + else if (*p == CAR && try_mac) + try_mac++; } /* Don't give in to EOL_UNIX if EOL_MAC is more likely */ @@ -2090,6 +2442,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) fileformat = EOL_MAC; } } + else if (fileformat == EOL_UNKNOWN && try_mac == 1) + /* Looking for CR but found no end-of-line markers at + * all: use the default format. */ + fileformat = default_fileformat(); } /* No NL found: may use Mac format */ @@ -2168,8 +2524,9 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) len = (colnr_T)(ptr - line_start + 1); if (fileformat == EOL_DOS) { - if (ptr[-1] == CAR) /* remove CR */ + if (ptr > line_start && ptr[-1] == CAR) { + /* remove CR before NL */ ptr[-1] = NUL; --len; } @@ -2184,7 +2541,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) if ( try_unix && !read_stdin && (read_buffer - || lseek(fd, (off_t)0L, SEEK_SET) == 0)) + || vim_lseek(fd, (off_T)0L, SEEK_SET) + == 0)) { fileformat = EOL_UNIX; if (set_options) @@ -2262,15 +2620,15 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) save_file_ff(curbuf); /* remember the current file format */ #ifdef FEAT_CRYPT - crypt_method_used = use_crypt_method; - if (cryptkey != NULL) + if (curbuf->b_cryptstate != NULL) { - crypt_pop_state(); - if (cryptkey != curbuf->b_p_key) - free_crypt_key(cryptkey); - /* don't set cryptkey to NULL, it's used below as a flag that - * encryption was used */ + crypt_free_state(curbuf->b_cryptstate); + curbuf->b_cryptstate = NULL; } + if (cryptkey != NULL && cryptkey != curbuf->b_p_key) + crypt_free_key(cryptkey); + /* Don't set cryptkey to NULL, it's used below as a flag that + * encryption was used. */ #endif #ifdef FEAT_MBYTE @@ -2297,7 +2655,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) { int fdflags = fcntl(fd, F_GETFD); if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0) - fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC); + (void)fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC); } #endif vim_free(buffer); @@ -2457,10 +2815,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #ifdef FEAT_CRYPT if (cryptkey != NULL) { - if (crypt_method_used == 1) - STRCAT(IObuff, _("[blowfish]")); - else - STRCAT(IObuff, _("[crypted]")); + crypt_append_msg(curbuf); c = TRUE; } #endif @@ -2489,15 +2844,12 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #ifdef FEAT_CRYPT if (cryptkey != NULL) msg_add_lines(c, (long)linecnt, filesize - - CRYPT_MAGIC_LEN - - crypt_salt_len[use_crypt_method] - - crypt_seed_len[use_crypt_method]); + - crypt_get_header_len(crypt_get_method_nr(curbuf))); else #endif msg_add_lines(c, (long)linecnt, filesize); - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; #ifdef ALWAYS_USE_GUI /* Don't show the message when reading stdin, it would end up in a @@ -2575,10 +2927,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #endif /* - * Trick: We remember if the last line of the read didn't have - * an eol even when 'binary' is off, for when writing it again with - * 'binary' on. This is required for - * ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work. + * We remember if the last line of the read didn't have + * an eol even when 'binary' is off, to support turning 'fixeol' off, + * or writing the read again with 'binary' on. The latter is required + * for ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work. */ curbuf->b_no_eol_lnum = read_no_eol_lnum; @@ -2600,8 +2952,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) } #endif -#ifdef FEAT_AUTOCMD - if (!read_stdin && !read_buffer) + if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL)) { int m = msg_scroll; int n = msg_scrolled; @@ -2620,9 +2971,18 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) if (filtering) apply_autocmds_exarg(EVENT_FILTERREADPOST, NULL, sfname, FALSE, curbuf, eap); - else if (newfile) + else if (newfile || (read_buffer && sfname != NULL)) + { apply_autocmds_exarg(EVENT_BUFREADPOST, NULL, sfname, FALSE, curbuf, eap); + if (!au_did_filetype && *curbuf->b_p_ft != NUL) + /* + * EVENT_FILETYPE was not triggered but the buffer already has a + * filetype. Trigger EVENT_FILETYPE using the existing filetype. + */ + apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname, + TRUE, curbuf); + } else apply_autocmds_exarg(EVENT_FILEREADPOST, sfname, sfname, FALSE, NULL, eap); @@ -2633,23 +2993,21 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) return FAIL; # endif } -#endif if (recoverymode && error) return FAIL; return OK; } -#ifdef OPEN_CHR_FILES +#if defined(OPEN_CHR_FILES) || defined(PROTO) /* * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", * which is the name of files used for process substitution output by * some shells on some operating systems, e.g., bash on SunOS. * Do not accept "/dev/fd/[012]", opening these may hang Vim. */ - static int -is_dev_fd_file(fname) - char_u *fname; + int +is_dev_fd_file(char_u *fname) { return (STRNCMP(fname, "/dev/fd/", 8) == 0 && VIM_ISDIGIT(fname[8]) @@ -2667,10 +3025,10 @@ is_dev_fd_file(fname) * Used for error messages that include a line number. */ static linenr_T -readfile_linenr(linecnt, p, endp) - linenr_T linecnt; /* line count before reading more bytes */ - char_u *p; /* start of more bytes read */ - char_u *endp; /* end of more bytes read */ +readfile_linenr( + linenr_T linecnt, /* line count before reading more bytes */ + char_u *p, /* start of more bytes read */ + char_u *endp) /* end of more bytes read */ { char_u *s; linenr_T lnum; @@ -2689,26 +3047,24 @@ readfile_linenr(linecnt, p, endp) * Returns OK or FAIL. */ int -prep_exarg(eap, buf) - exarg_T *eap; - buf_T *buf; +prep_exarg(exarg_T *eap, buf_T *buf) { - eap->cmd = alloc((unsigned)(STRLEN(buf->b_p_ff) + eap->cmd = alloc(15 #ifdef FEAT_MBYTE - + STRLEN(buf->b_p_fenc) + + (unsigned)STRLEN(buf->b_p_fenc) #endif - + 15)); + ); if (eap->cmd == NULL) return FAIL; #ifdef FEAT_MBYTE - sprintf((char *)eap->cmd, "e ++ff=%s ++enc=%s", buf->b_p_ff, buf->b_p_fenc); - eap->force_enc = 14 + (int)STRLEN(buf->b_p_ff); + sprintf((char *)eap->cmd, "e ++enc=%s", buf->b_p_fenc); + eap->force_enc = 8; eap->bad_char = buf->b_bad_char; #else - sprintf((char *)eap->cmd, "e ++ff=%s", buf->b_p_ff); + sprintf((char *)eap->cmd, "e"); #endif - eap->force_ff = 7; + eap->force_ff = *buf->b_p_ff; eap->force_bin = buf->b_p_bin ? FORCE_BIN : FORCE_NOBIN; eap->read_edit = FALSE; @@ -2720,9 +3076,7 @@ prep_exarg(eap, buf) * Set default or forced 'fileformat' and 'binary'. */ void -set_file_options(set_options, eap) - int set_options; - exarg_T *eap; +set_file_options(int set_options, exarg_T *eap) { /* set default 'fileformat' */ if (set_options) @@ -2748,8 +3102,7 @@ set_file_options(set_options, eap) * Set forced 'fileencoding'. */ void -set_forced_fenc(eap) - exarg_T *eap; +set_forced_fenc(exarg_T *eap) { if (eap->force_enc != 0) { @@ -2770,8 +3123,7 @@ set_forced_fenc(eap) * When *pp is not set to NULL, the result is in allocated memory. */ static char_u * -next_fenc(pp) - char_u **pp; +next_fenc(char_u **pp) { char_u *p; char_u *r; @@ -2816,15 +3168,15 @@ next_fenc(pp) * Returns NULL if the conversion failed ("*fdp" is not set) . */ static char_u * -readfile_charconvert(fname, fenc, fdp) - char_u *fname; /* name of input file */ - char_u *fenc; /* converted from */ - int *fdp; /* in/out: file descriptor of file */ +readfile_charconvert( + char_u *fname, /* name of input file */ + char_u *fenc, /* converted from */ + int *fdp) /* in/out: file descriptor of file */ { char_u *tmpname; char_u *errmsg = NULL; - tmpname = vim_tempname('r'); + tmpname = vim_tempname('r', FALSE); if (tmpname == NULL) errmsg = (char_u *)_("Can't find temp file for conversion"); else @@ -2847,8 +3199,7 @@ readfile_charconvert(fname, fenc, fdp) if (tmpname != NULL) { mch_remove(tmpname); /* delete converted file */ - vim_free(tmpname); - tmpname = NULL; + VIM_CLEAR(tmpname); } } @@ -2868,7 +3219,7 @@ readfile_charconvert(fname, fenc, fdp) * buffer marks and the buffer has a name. */ static void -check_marks_read() +check_marks_read(void) { if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0 && curbuf->b_ffname != NULL) @@ -2881,33 +3232,6 @@ check_marks_read() #endif #if defined(FEAT_CRYPT) || defined(PROTO) -/* - * Get the crypt method used for a file from "ptr[len]", the magic text at the - * start of the file. - * Returns -1 when no encryption used. - */ - static int -crypt_method_from_magic(ptr, len) - char *ptr; - int len; -{ - int i; - - for (i = 0; i < (int)(sizeof(crypt_magic) / sizeof(crypt_magic[0])); i++) - { - if (len < (CRYPT_MAGIC_LEN + crypt_salt_len[i] + crypt_seed_len[i])) - continue; - if (memcmp(ptr, crypt_magic[i], CRYPT_MAGIC_LEN) == 0) - return i; - } - - i = (int)STRLEN(crypt_magic_head); - if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) - EMSG(_("E821: File is encrypted with unknown method")); - - return -1; -} - /* * Check for magic number used for encryption. Applies to the current buffer. * If found, the magic number is removed from ptr[*sizep] and *sizep and @@ -2915,16 +3239,16 @@ crypt_method_from_magic(ptr, len) * Return the (new) encryption key, NULL for no encryption. */ static char_u * -check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) - char_u *cryptkey; /* previous encryption key or NULL */ - char_u *ptr; /* pointer to read bytes */ - long *sizep; /* length of read bytes */ - off_t *filesizep; /* nr of bytes used from file */ - int newfile; /* editing a new buffer */ - char_u *fname; /* file name to display */ - int *did_ask; /* flag: whether already asked for key */ +check_for_cryptkey( + char_u *cryptkey, /* previous encryption key or NULL */ + char_u *ptr, /* pointer to read bytes */ + long *sizep, /* length of read bytes */ + off_T *filesizep, /* nr of bytes used from file */ + int newfile, /* editing a new buffer */ + char_u *fname, /* file name to display */ + int *did_ask) /* flag: whether already asked for key */ { - int method = crypt_method_from_magic((char *)ptr, *sizep); + int method = crypt_method_nr_from_magic((char *)ptr, *sizep); int b_p_ro = curbuf->b_p_ro; if (method >= 0) @@ -2933,9 +3257,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Avoids accidentally overwriting the file with garbage. */ curbuf->b_p_ro = TRUE; - set_crypt_method(curbuf, method); - if (method > 0) - (void)blowfish_self_test(); + /* Set the cryptmethod local to the buffer. */ + crypt_set_cm_option(curbuf, method); if (cryptkey == NULL && !*did_ask) { if (*curbuf->b_p_key) @@ -2948,7 +3271,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Happens when retrying to detect encoding. */ smsg((char_u *)_(need_key_msg), fname); msg_scroll = TRUE; - cryptkey = get_crypt_key(newfile, FALSE); + crypt_check_method(method); + cryptkey = crypt_get_key(newfile, FALSE); *did_ask = TRUE; /* check if empty key entered */ @@ -2963,24 +3287,21 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) if (cryptkey != NULL) { - int seed_len = crypt_seed_len[method]; - int salt_len = crypt_salt_len[method]; + int header_len; - crypt_push_state(); - use_crypt_method = method; - if (method == 0) - crypt_init_keys(cryptkey); - else - { - bf_key_init(cryptkey, ptr + CRYPT_MAGIC_LEN, salt_len); - bf_cfb_init(ptr + CRYPT_MAGIC_LEN + salt_len, seed_len); - } + curbuf->b_cryptstate = crypt_create_from_header( + method, cryptkey, ptr); + crypt_set_cm_option(curbuf, method); + + /* Remove cryptmethod specific header from the text. */ + header_len = crypt_get_header_len(method); + if (*sizep <= header_len) + /* invalid header, buffer can't be encrypted */ + return NULL; + *filesizep += header_len; + *sizep -= header_len; + mch_memmove(ptr, ptr + header_len, (size_t)*sizep); - /* Remove magic number from the text */ - *filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len; - *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len; - mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len, - (size_t)*sizep); /* Restore the read-only flag. */ curbuf->b_p_ro = b_p_ro; } @@ -2992,93 +3313,14 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) return cryptkey; } - -/* - * Check for magic number used for encryption. Applies to the current buffer. - * If found and decryption is possible returns OK; - */ - int -prepare_crypt_read(fp) - FILE *fp; -{ - int method; - char_u buffer[CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX - + CRYPT_SEED_LEN_MAX + 2]; - - if (fread(buffer, CRYPT_MAGIC_LEN, 1, fp) != 1) - return FAIL; - method = crypt_method_from_magic((char *)buffer, - CRYPT_MAGIC_LEN + - CRYPT_SEED_LEN_MAX + - CRYPT_SALT_LEN_MAX); - if (method < 0 || method != get_crypt_method(curbuf)) - return FAIL; - - crypt_push_state(); - if (method == 0) - crypt_init_keys(curbuf->b_p_key); - else - { - int salt_len = crypt_salt_len[method]; - int seed_len = crypt_seed_len[method]; - - if (fread(buffer, salt_len + seed_len, 1, fp) != 1) - return FAIL; - bf_key_init(curbuf->b_p_key, buffer, salt_len); - bf_cfb_init(buffer + salt_len, seed_len); - } - return OK; -} - -/* - * Prepare for writing encrypted bytes for buffer "buf". - * Returns a pointer to an allocated header of length "*lenp". - * When out of memory returns NULL. - * Otherwise calls crypt_push_state(), call crypt_pop_state() later. - */ - char_u * -prepare_crypt_write(buf, lenp) - buf_T *buf; - int *lenp; -{ - char_u *header; - int seed_len = crypt_seed_len[get_crypt_method(buf)]; - int salt_len = crypt_salt_len[get_crypt_method(buf)]; - char_u *salt; - char_u *seed; - - header = alloc_clear(CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX - + CRYPT_SEED_LEN_MAX + 2); - if (header != NULL) - { - crypt_push_state(); - use_crypt_method = get_crypt_method(buf); /* select zip or blowfish */ - vim_strncpy(header, (char_u *)crypt_magic[use_crypt_method], - CRYPT_MAGIC_LEN); - if (use_crypt_method == 0) - crypt_init_keys(buf->b_p_key); - else - { - /* Using blowfish, add salt and seed. */ - salt = header + CRYPT_MAGIC_LEN; - seed = salt + salt_len; - sha2_seed(salt, salt_len, seed, seed_len); - bf_key_init(buf->b_p_key, salt, salt_len); - bf_cfb_init(seed, seed_len); - } - } - *lenp = CRYPT_MAGIC_LEN + salt_len + seed_len; - return header; -} - #endif /* FEAT_CRYPT */ #ifdef UNIX static void -set_file_time(fname, atime, mtime) - char_u *fname; - time_t atime; /* access time */ - time_t mtime; /* modification time */ +set_file_time( + char_u *fname, + time_t atime, /* access time */ + time_t mtime) /* modification time */ { # if defined(HAVE_UTIME) && defined(HAVE_UTIME_H) struct utimbuf buf; @@ -3113,9 +3355,9 @@ set_file_time(fname, atime, mtime) * Return TRUE if a file appears to be read-only from the file permissions. */ int -check_file_readonly(fname, perm) - char_u *fname; /* full path to file */ - int perm; /* known permissions on file */ +check_file_readonly( + char_u *fname, /* full path to file */ + int perm) /* known permissions on file */ { #ifndef USE_MCH_ACCESS int fd = 0; @@ -3152,18 +3394,18 @@ check_file_readonly(fname, perm) * return FAIL for failure, OK otherwise */ int -buf_write(buf, fname, sfname, start, end, eap, append, forceit, - reset_changed, filtering) - buf_T *buf; - char_u *fname; - char_u *sfname; - linenr_T start, end; - exarg_T *eap; /* for forced 'ff' and 'fenc', can be +buf_write( + buf_T *buf, + char_u *fname, + char_u *sfname, + linenr_T start, + linenr_T end, + exarg_T *eap, /* for forced 'ff' and 'fenc', can be NULL! */ - int append; /* append to the file */ - int forceit; - int reset_changed; - int filtering; + int append, /* append to the file */ + int forceit, + int reset_changed, + int filtering) { int fd; char_u *backup = NULL; @@ -3191,18 +3433,17 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int overwriting; /* TRUE if writing over original */ int no_eol = FALSE; /* no end-of-line written */ int device = FALSE; /* writing to a device */ - struct stat st_old; + stat_T st_old; int prev_got_int = got_int; + int checking_conversion; int file_readonly = FALSE; /* overwritten file is read-only */ static char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')"; -#if defined(UNIX) || defined(__EMX__XX) /*XXX fix me sometime? */ +#if defined(UNIX) /*XXX fix me sometime? */ int made_writable = FALSE; /* 'w' bit has been set */ #endif /* writing everything */ int whole = (start == 1 && end == buf->b_ml.ml_line_count); -#ifdef FEAT_AUTOCMD linenr_T old_line_count = buf->b_ml.ml_line_count; -#endif int attr; int fileformat; int write_bin; @@ -3224,9 +3465,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int write_undo_file = FALSE; context_sha256_T sha_ctx; #endif -#ifdef FEAT_CRYPT - int crypt_method_used; -#endif + unsigned int bkc = get_bkc_value(buf); if (fname == NULL || *fname == NUL) /* safety check */ return FAIL; @@ -3261,6 +3500,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, # ifdef USE_ICONV write_info.bw_iconv_fd = (iconv_t)-1; # endif +#endif +#ifdef FEAT_CRYPT + write_info.bw_buffer = buf; #endif /* After writing a file changedtick changes but we don't want to display @@ -3321,7 +3563,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, buf->b_op_end.lnum = end; buf->b_op_end.col = 0; -#ifdef FEAT_AUTOCMD { aco_save_T aco; int buf_ffname = FALSE; @@ -3331,6 +3572,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int did_cmd = FALSE; int nofile_err = FALSE; int empty_memline = (buf->b_ml.ml_mfp == NULL); + bufref_T bufref; /* * Apply PRE autocommands. @@ -3348,6 +3590,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* set curwin/curbuf to buf and save a few things */ aucmd_prepbuf(&aco, buf); + set_bufref(&bufref, buf); if (append) { @@ -3420,7 +3663,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, * 2. The autocommands abort script processing. * 3. If one of the "Cmd" autocommands was executed. */ - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) buf = NULL; if (buf == NULL || (buf->b_ml.ml_mfp == NULL && !empty_memline) || did_cmd || nofile_err @@ -3509,7 +3752,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, if (buf_fname_s) fname = buf->b_sfname; } -#endif #ifdef FEAT_NETBEANS_INTG if (netbeans_active() && isNetbeansBuffer(buf)) @@ -3573,7 +3815,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* * Get information about original file (if there is one). */ -#if defined(UNIX) && !defined(ARCHIE) +#if defined(UNIX) st_old.st_dev = 0; st_old.st_ino = 0; perm = -1; @@ -3616,7 +3858,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } if (c == NODE_WRITABLE) { -# if defined(MSDOS) || defined(MSWIN) || defined(OS2) +# if defined(MSWIN) /* MS-Windows allows opening a device, but we will probably get stuck * trying to write to it. */ if (!p_odev) @@ -3719,13 +3961,13 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, if (!(append && *p_pm == NUL) && !filtering && perm >= 0 && dobackup) { #if defined(UNIX) || defined(WIN32) - struct stat st; + stat_T st; #endif - if ((bkc_flags & BKC_YES) || append) /* "yes" */ + if ((bkc & BKC_YES) || append) /* "yes" */ backup_copy = TRUE; #if defined(UNIX) || defined(WIN32) - else if ((bkc_flags & BKC_AUTO)) /* "auto" */ + else if ((bkc & BKC_AUTO)) /* "auto" */ { int i; @@ -3813,7 +4055,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* * Break symlinks and/or hardlinks if we've been asked to. */ - if ((bkc_flags & BKC_BREAKSYMLINK) || (bkc_flags & BKC_BREAKHARDLINK)) + if ((bkc & BKC_BREAKSYMLINK) || (bkc & BKC_BREAKHARDLINK)) { # ifdef UNIX int lstat_res; @@ -3821,24 +4063,24 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, lstat_res = mch_lstat((char *)fname, &st); /* Symlinks. */ - if ((bkc_flags & BKC_BREAKSYMLINK) + if ((bkc & BKC_BREAKSYMLINK) && lstat_res == 0 && st.st_ino != st_old.st_ino) backup_copy = FALSE; /* Hardlinks. */ - if ((bkc_flags & BKC_BREAKHARDLINK) + if ((bkc & BKC_BREAKHARDLINK) && st_old.st_nlink > 1 && (lstat_res != 0 || st.st_ino == st_old.st_ino)) backup_copy = FALSE; # else # if defined(WIN32) /* Symlinks. */ - if ((bkc_flags & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) + if ((bkc & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) backup_copy = FALSE; /* Hardlinks. */ - if ((bkc_flags & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) + if ((bkc & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) backup_copy = FALSE; # endif # endif @@ -3858,11 +4100,12 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int bfd; char_u *copybuf, *wp; int some_error = FALSE; - struct stat st_new; + stat_T st_new; char_u *dirp; char_u *rootname; -#if defined(UNIX) && !defined(SHORT_FNAME) +#if defined(UNIX) int did_set_shortname; + mode_t umask_save; #endif copybuf = alloc(BUFSIZE + 1); @@ -3904,7 +4147,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, goto nobackup; } -#if defined(UNIX) && !defined(SHORT_FNAME) +#if defined(UNIX) did_set_shortname = FALSE; #endif @@ -3916,12 +4159,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* * Make backup file name. */ - backup = buf_modname( -#ifdef SHORT_FNAME - TRUE, -#else - (buf->b_p_sn || buf->b_shortname), -#endif + backup = buf_modname((buf->b_p_sn || buf->b_shortname), rootname, backup_ext, FALSE); if (backup == NULL) { @@ -3946,9 +4184,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, if (st_new.st_dev == st_old.st_dev && st_new.st_ino == st_old.st_ino) { - vim_free(backup); - backup = NULL; /* no backup file to delete */ -# ifndef SHORT_FNAME + VIM_CLEAR(backup); /* no backup file to delete */ /* * may try again with 'shortname' set */ @@ -3961,7 +4197,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* setting shortname didn't help */ if (did_set_shortname) buf->b_shortname = FALSE; -# endif break; } #endif @@ -3983,10 +4218,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, --*wp; /* They all exist??? Must be something wrong. */ if (*wp == 'a') - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); } } break; @@ -4001,22 +4233,27 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* remove old backup, if present */ mch_remove(backup); /* Open with O_EXCL to avoid the file being created while - * we were sleeping (symlink hacker attack?) */ + * we were sleeping (symlink hacker attack?). Reset umask + * if possible to avoid mch_setperm() below. */ +#ifdef UNIX + umask_save = umask(0); +#endif bfd = mch_open((char *)backup, O_WRONLY|O_CREAT|O_EXTRA|O_EXCL|O_NOFOLLOW, perm & 0777); +#ifdef UNIX + (void)umask(umask_save); +#endif if (bfd < 0) - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); else { - /* set file protection same as original file, but - * strip s-bit */ + /* Set file protection same as original file, but + * strip s-bit. Only needed if umask() wasn't used + * above. */ +#ifndef UNIX (void)mch_setperm(backup, perm & 0777); - -#ifdef UNIX +#else /* * Try to set the group of the backup same as the * original file. If this fails, set the protection @@ -4129,12 +4366,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, backup = NULL; else { - backup = buf_modname( -#ifdef SHORT_FNAME - TRUE, -#else - (buf->b_p_sn || buf->b_shortname), -#endif + backup = buf_modname((buf->b_p_sn || buf->b_shortname), rootname, backup_ext, FALSE); vim_free(rootname); } @@ -4156,10 +4388,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, --*p; /* They all exist??? Must be something wrong! */ if (*p == 'a') - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); } } if (backup != NULL) @@ -4177,8 +4406,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, if (vim_rename(fname, backup) == 0) break; - vim_free(backup); /* don't do the rename below */ - backup = NULL; + VIM_CLEAR(backup); /* don't do the rename below */ } } if (backup == NULL && !forceit) @@ -4189,7 +4417,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } } -#if defined(UNIX) && !defined(ARCHIE) +#if defined(UNIX) /* When using ":w!" and the file was read-only: make it writable */ if (forceit && perm >= 0 && !(perm & 0200) && st_old.st_uid == getuid() && vim_strchr(p_cpo, CPO_FWRITE) == NULL) @@ -4208,9 +4436,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, #ifdef FEAT_TITLE need_maketitle = TRUE; /* set window title later */ #endif -#ifdef FEAT_WINDOWS status_redraw_all(); /* redraw status lines later */ -#endif } if (end > buf->b_ml.ml_line_count) @@ -4236,20 +4462,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } } -#ifdef MACOS_CLASSIC /* TODO: Is it need for MACOS_X? (Dany) */ - /* - * Before risking to lose the original file verify if there's - * a resource fork to preserve, and if cannot be done warn - * the users. This happens when overwriting without backups. - */ - if (backup == NULL && overwriting && !append) - if (mch_has_resource_fork(fname)) - { - errmsg = (char_u *)_("E460: The resource fork would be lost (add ! to override)"); - goto restore_backup; - } -#endif - #ifdef VMS vms_remove_version(fname); /* remove version */ #endif @@ -4307,7 +4519,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } # endif -# ifdef MACOS_X +# ifdef MACOS_CONVERT if (converted && wb_flags == 0 && (wb_flags = get_mac_fio_flags(fenc)) != 0) { write_info.bw_conv_buflen = bufsize * 3; @@ -4351,7 +4563,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, */ if (*p_ccv != NUL) { - wfname = vim_tempname('w'); + wfname = vim_tempname('w', FALSE); if (wfname == NULL) /* Can't write without a tempfile! */ { errmsg = (char_u *)_("E214: Can't find temp file for writing"); @@ -4380,424 +4592,524 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, #endif /* - * Open the file "wfname" for writing. - * We may try to open the file twice: If we can't write to the - * file and forceit is TRUE we delete the existing file and try to create - * a new one. If this still fails we may have lost the original file! - * (this may happen when the user reached his quotum for number of files). - * Appending will fail if the file does not exist and forceit is FALSE. + * If conversion is taking place, we may first pretend to write and check + * for conversion errors. Then loop again to write for real. + * When not doing conversion this writes for real right away. */ - while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append - ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND) - : (O_CREAT | O_TRUNC)) - , perm < 0 ? 0666 : (perm & 0777))) < 0) + for (checking_conversion = TRUE; ; checking_conversion = FALSE) { /* - * A forced write will try to create a new file if the old one is - * still readonly. This may also happen when the directory is - * read-only. In that case the mch_remove() will fail. + * There is no need to check conversion when: + * - there is no conversion + * - we make a backup file, that can be restored in case of conversion + * failure. */ - if (errmsg == NULL) +#ifdef FEAT_MBYTE + if (!converted || dobackup) +#endif + checking_conversion = FALSE; + + if (checking_conversion) { -#ifdef UNIX - struct stat st; - - /* Don't delete the file when it's a hard or symbolic link. */ - if ((!newfile && st_old.st_nlink > 1) - || (mch_lstat((char *)fname, &st) == 0 - && (st.st_dev != st_old.st_dev - || st.st_ino != st_old.st_ino))) - errmsg = (char_u *)_("E166: Can't open linked file for writing"); - else + /* Make sure we don't write anything. */ + fd = -1; + write_info.bw_fd = fd; + } + else + { +#ifdef HAVE_FTRUNCATE +# define TRUNC_ON_OPEN 0 +#else +# define TRUNC_ON_OPEN O_TRUNC #endif + /* + * Open the file "wfname" for writing. + * We may try to open the file twice: If we can't write to the file + * and forceit is TRUE we delete the existing file and try to + * create a new one. If this still fails we may have lost the + * original file! (this may happen when the user reached his + * quotum for number of files). + * Appending will fail if the file does not exist and forceit is + * FALSE. + */ + while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append + ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND) + : (O_CREAT | TRUNC_ON_OPEN)) + , perm < 0 ? 0666 : (perm & 0777))) < 0) { - errmsg = (char_u *)_("E212: Can't open file for writing"); - if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL - && perm >= 0) + /* + * A forced write will try to create a new file if the old one + * is still readonly. This may also happen when the directory + * is read-only. In that case the mch_remove() will fail. + */ + if (errmsg == NULL) { #ifdef UNIX - /* we write to the file, thus it should be marked - writable after all */ - if (!(perm & 0200)) - made_writable = TRUE; - perm |= 0200; - if (st_old.st_uid != getuid() || st_old.st_gid != getgid()) - perm &= 0777; -#endif - if (!append) /* don't remove when appending */ - mch_remove(wfname); - continue; + stat_T st; + + /* Don't delete the file when it's a hard or symbolic link. + */ + if ((!newfile && st_old.st_nlink > 1) + || (mch_lstat((char *)fname, &st) == 0 + && (st.st_dev != st_old.st_dev + || st.st_ino != st_old.st_ino))) + errmsg = (char_u *)_("E166: Can't open linked file for writing"); + else +#endif + { + errmsg = (char_u *)_("E212: Can't open file for writing"); + if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL + && perm >= 0) + { +#ifdef UNIX + /* we write to the file, thus it should be marked + writable after all */ + if (!(perm & 0200)) + made_writable = TRUE; + perm |= 0200; + if (st_old.st_uid != getuid() + || st_old.st_gid != getgid()) + perm &= 0777; +#endif + if (!append) /* don't remove when appending */ + mch_remove(wfname); + continue; + } + } } - } - } restore_backup: - { - struct stat st; - - /* - * If we failed to open the file, we don't need a backup. Throw it - * away. If we moved or removed the original file try to put the - * backup in its place. - */ - if (backup != NULL && wfname == fname) - { - if (backup_copy) { + stat_T st; + /* - * There is a small chance that we removed the original, - * try to move the copy in its place. - * This may not work if the vim_rename() fails. - * In that case we leave the copy around. + * If we failed to open the file, we don't need a backup. + * Throw it away. If we moved or removed the original file + * try to put the backup in its place. + */ + if (backup != NULL && wfname == fname) + { + if (backup_copy) + { + /* + * There is a small chance that we removed the + * original, try to move the copy in its place. + * This may not work if the vim_rename() fails. + * In that case we leave the copy around. + */ + /* If file does not exist, put the copy in its + * place */ + if (mch_stat((char *)fname, &st) < 0) + vim_rename(backup, fname); + /* if original file does exist throw away the copy + */ + if (mch_stat((char *)fname, &st) >= 0) + mch_remove(backup); + } + else + { + /* try to put the original file back */ + vim_rename(backup, fname); + } + } + + /* if original file no longer exists give an extra warning */ - /* If file does not exist, put the copy in its place */ - if (mch_stat((char *)fname, &st) < 0) - vim_rename(backup, fname); - /* if original file does exist throw away the copy */ - if (mch_stat((char *)fname, &st) >= 0) - mch_remove(backup); + if (!newfile && mch_stat((char *)fname, &st) < 0) + end = 0; } - else + +#ifdef FEAT_MBYTE + if (wfname != fname) + vim_free(wfname); +#endif + goto fail; + } + write_info.bw_fd = fd; + +#if defined(UNIX) + { + stat_T st; + + /* Double check we are writing the intended file before making + * any changes. */ + if (overwriting + && (!dobackup || backup_copy) + && fname == wfname + && perm >= 0 + && mch_fstat(fd, &st) == 0 + && st.st_ino != st_old.st_ino) { - /* try to put the original file back */ - vim_rename(backup, fname); + close(fd); + errmsg = (char_u *)_("E949: File changed while writing"); + goto fail; } } - - /* if original file no longer exists give an extra warning */ - if (!newfile && mch_stat((char *)fname, &st) < 0) - end = 0; - } - -#ifdef FEAT_MBYTE - if (wfname != fname) - vim_free(wfname); #endif - goto fail; - } - errmsg = NULL; +#ifdef HAVE_FTRUNCATE + if (!append) + ignored = ftruncate(fd, (off_t)0); +#endif -#if defined(MACOS_CLASSIC) || defined(WIN3264) - /* TODO: Is it need for MACOS_X? (Dany) */ - /* - * On macintosh copy the original files attributes (i.e. the backup) - * This is done in order to preserve the resource fork and the - * Finder attribute (label, comments, custom icons, file creator) - */ - if (backup != NULL && overwriting && !append) - { - if (backup_copy) - (void)mch_copy_file_attribute(wfname, backup); - else - (void)mch_copy_file_attribute(backup, wfname); - } +#if defined(WIN3264) + if (backup != NULL && overwriting && !append) + { + if (backup_copy) + (void)mch_copy_file_attribute(wfname, backup); + else + (void)mch_copy_file_attribute(backup, wfname); + } - if (!overwriting && !append) - { - if (buf->b_ffname != NULL) - (void)mch_copy_file_attribute(buf->b_ffname, wfname); - /* Should copy resource fork */ - } + if (!overwriting && !append) + { + if (buf->b_ffname != NULL) + (void)mch_copy_file_attribute(buf->b_ffname, wfname); + /* Should copy resource fork */ + } #endif - write_info.bw_fd = fd; - #ifdef FEAT_CRYPT - if (*buf->b_p_key != NUL && !filtering) - { - char_u *header; - int header_len; + if (*buf->b_p_key != NUL && !filtering) + { + char_u *header; + int header_len; - header = prepare_crypt_write(buf, &header_len); - if (header == NULL) - end = 0; - else - { - /* Write magic number, so that Vim knows that this file is - * encrypted when reading it again. This also undergoes utf-8 to - * ucs-2/4 conversion when needed. */ - write_info.bw_buf = header; - write_info.bw_len = header_len; - write_info.bw_flags = FIO_NOCONVERT; - if (buf_write_bytes(&write_info) == FAIL) - end = 0; - wb_flags |= FIO_ENCRYPTED; - vim_free(header); - } - } + buf->b_cryptstate = crypt_create_for_writing( + crypt_get_method_nr(buf), + buf->b_p_key, &header, &header_len); + if (buf->b_cryptstate == NULL || header == NULL) + end = 0; + else + { + /* Write magic number, so that Vim knows how this file is + * encrypted when reading it back. */ + write_info.bw_buf = header; + write_info.bw_len = header_len; + write_info.bw_flags = FIO_NOCONVERT; + if (buf_write_bytes(&write_info) == FAIL) + end = 0; + wb_flags |= FIO_ENCRYPTED; + vim_free(header); + } + } #endif + } + errmsg = NULL; - write_info.bw_buf = buffer; - nchars = 0; + write_info.bw_buf = buffer; + nchars = 0; - /* use "++bin", "++nobin" or 'binary' */ - if (eap != NULL && eap->force_bin != 0) - write_bin = (eap->force_bin == FORCE_BIN); - else - write_bin = buf->b_p_bin; + /* use "++bin", "++nobin" or 'binary' */ + if (eap != NULL && eap->force_bin != 0) + write_bin = (eap->force_bin == FORCE_BIN); + else + write_bin = buf->b_p_bin; #ifdef FEAT_MBYTE - /* - * The BOM is written just after the encryption magic number. - * Skip it when appending and the file already existed, the BOM only makes - * sense at the start of the file. - */ - if (buf->b_p_bomb && !write_bin && (!append || perm < 0)) - { - write_info.bw_len = make_bom(buffer, fenc); - if (write_info.bw_len > 0) + /* + * The BOM is written just after the encryption magic number. + * Skip it when appending and the file already existed, the BOM only + * makes sense at the start of the file. + */ + if (buf->b_p_bomb && !write_bin && (!append || perm < 0)) { - /* don't convert, do encryption */ - write_info.bw_flags = FIO_NOCONVERT | wb_flags; - if (buf_write_bytes(&write_info) == FAIL) - end = 0; - else - nchars += write_info.bw_len; + write_info.bw_len = make_bom(buffer, fenc); + if (write_info.bw_len > 0) + { + /* don't convert, do encryption */ + write_info.bw_flags = FIO_NOCONVERT | wb_flags; + if (buf_write_bytes(&write_info) == FAIL) + end = 0; + else + nchars += write_info.bw_len; + } } - } - write_info.bw_start_lnum = start; + write_info.bw_start_lnum = start; #endif #ifdef FEAT_PERSISTENT_UNDO - write_undo_file = (buf->b_p_udf && overwriting && !append - && !filtering && reset_changed); - if (write_undo_file) - /* Prepare for computing the hash value of the text. */ - sha256_start(&sha_ctx); + write_undo_file = (buf->b_p_udf + && overwriting + && !append + && !filtering + && reset_changed + && !checking_conversion); + if (write_undo_file) + /* Prepare for computing the hash value of the text. */ + sha256_start(&sha_ctx); #endif - write_info.bw_len = bufsize; + write_info.bw_len = bufsize; #ifdef HAS_BW_FLAGS - write_info.bw_flags = wb_flags; + write_info.bw_flags = wb_flags; #endif - fileformat = get_fileformat_force(buf, eap); - s = buffer; - len = 0; - for (lnum = start; lnum <= end; ++lnum) - { - /* - * The next while loop is done once for each character written. - * Keep it fast! - */ - ptr = ml_get_buf(buf, lnum, FALSE) - 1; + fileformat = get_fileformat_force(buf, eap); + s = buffer; + len = 0; + for (lnum = start; lnum <= end; ++lnum) + { + /* + * The next while loop is done once for each character written. + * Keep it fast! + */ + ptr = ml_get_buf(buf, lnum, FALSE) - 1; #ifdef FEAT_PERSISTENT_UNDO - if (write_undo_file) - sha256_update(&sha_ctx, ptr + 1, (UINT32_T)(STRLEN(ptr + 1) + 1)); + if (write_undo_file) + sha256_update(&sha_ctx, ptr + 1, + (UINT32_T)(STRLEN(ptr + 1) + 1)); #endif - while ((c = *++ptr) != NUL) - { - if (c == NL) - *s = NUL; /* replace newlines with NULs */ - else if (c == CAR && fileformat == EOL_MAC) - *s = NL; /* Mac: replace CRs with NLs */ - else - *s = c; - ++s; - if (++len != bufsize) - continue; - if (buf_write_bytes(&write_info) == FAIL) + while ((c = *++ptr) != NUL) { - end = 0; /* write error: break loop */ - break; - } - nchars += bufsize; - s = buffer; - len = 0; + if (c == NL) + *s = NUL; /* replace newlines with NULs */ + else if (c == CAR && fileformat == EOL_MAC) + *s = NL; /* Mac: replace CRs with NLs */ + else + *s = c; + ++s; + if (++len != bufsize) + continue; + if (buf_write_bytes(&write_info) == FAIL) + { + end = 0; /* write error: break loop */ + break; + } + nchars += bufsize; + s = buffer; + len = 0; #ifdef FEAT_MBYTE - write_info.bw_start_lnum = lnum; + write_info.bw_start_lnum = lnum; #endif - } - /* write failed or last line has no EOL: stop here */ - if (end == 0 - || (lnum == end - && write_bin - && (lnum == buf->b_no_eol_lnum - || (lnum == buf->b_ml.ml_line_count && !buf->b_p_eol)))) - { - ++lnum; /* written the line, count it */ - no_eol = TRUE; - break; - } - if (fileformat == EOL_UNIX) - *s++ = NL; - else - { - *s++ = CAR; /* EOL_MAC or EOL_DOS: write CR */ - if (fileformat == EOL_DOS) /* write CR-NL */ + } + /* write failed or last line has no EOL: stop here */ + if (end == 0 + || (lnum == end + && (write_bin || !buf->b_p_fixeol) + && (lnum == buf->b_no_eol_lnum + || (lnum == buf->b_ml.ml_line_count + && !buf->b_p_eol)))) { - if (++len == bufsize) + ++lnum; /* written the line, count it */ + no_eol = TRUE; + break; + } + if (fileformat == EOL_UNIX) + *s++ = NL; + else + { + *s++ = CAR; /* EOL_MAC or EOL_DOS: write CR */ + if (fileformat == EOL_DOS) /* write CR-NL */ { - if (buf_write_bytes(&write_info) == FAIL) + if (++len == bufsize) { - end = 0; /* write error: break loop */ - break; + if (buf_write_bytes(&write_info) == FAIL) + { + end = 0; /* write error: break loop */ + break; + } + nchars += bufsize; + s = buffer; + len = 0; } - nchars += bufsize; - s = buffer; - len = 0; + *s++ = NL; } - *s++ = NL; } - } - if (++len == bufsize && end) - { - if (buf_write_bytes(&write_info) == FAIL) + if (++len == bufsize && end) { - end = 0; /* write error: break loop */ - break; - } - nchars += bufsize; - s = buffer; - len = 0; + if (buf_write_bytes(&write_info) == FAIL) + { + end = 0; /* write error: break loop */ + break; + } + nchars += bufsize; + s = buffer; + len = 0; - ui_breakcheck(); - if (got_int) - { - end = 0; /* Interrupted, break loop */ - break; + ui_breakcheck(); + if (got_int) + { + end = 0; /* Interrupted, break loop */ + break; + } } - } #ifdef VMS - /* - * On VMS there is a problem: newlines get added when writing blocks - * at a time. Fix it by writing a line at a time. - * This is much slower! - * Explanation: VAX/DECC RTL insists that records in some RMS - * structures end with a newline (carriage return) character, and if - * they don't it adds one. - * With other RMS structures it works perfect without this fix. - */ - if (buf->b_fab_rfm == FAB$C_VFC - || ((buf->b_fab_rat & (FAB$M_FTN | FAB$M_CR)) != 0)) - { - int b2write; + /* + * On VMS there is a problem: newlines get added when writing + * blocks at a time. Fix it by writing a line at a time. + * This is much slower! + * Explanation: VAX/DECC RTL insists that records in some RMS + * structures end with a newline (carriage return) character, and + * if they don't it adds one. + * With other RMS structures it works perfect without this fix. + */ + if (buf->b_fab_rfm == FAB$C_VFC + || ((buf->b_fab_rat & (FAB$M_FTN | FAB$M_CR)) != 0)) + { + int b2write; - buf->b_fab_mrs = (buf->b_fab_mrs == 0 - ? MIN(4096, bufsize) - : MIN(buf->b_fab_mrs, bufsize)); + buf->b_fab_mrs = (buf->b_fab_mrs == 0 + ? MIN(4096, bufsize) + : MIN(buf->b_fab_mrs, bufsize)); - b2write = len; - while (b2write > 0) - { - write_info.bw_len = MIN(b2write, buf->b_fab_mrs); - if (buf_write_bytes(&write_info) == FAIL) + b2write = len; + while (b2write > 0) { - end = 0; - break; + write_info.bw_len = MIN(b2write, buf->b_fab_mrs); + if (buf_write_bytes(&write_info) == FAIL) + { + end = 0; + break; + } + b2write -= MIN(b2write, buf->b_fab_mrs); } - b2write -= MIN(b2write, buf->b_fab_mrs); + write_info.bw_len = bufsize; + nchars += len; + s = buffer; + len = 0; } - write_info.bw_len = bufsize; +#endif + } + if (len > 0 && end > 0) + { + write_info.bw_len = len; + if (buf_write_bytes(&write_info) == FAIL) + end = 0; /* write error */ nchars += len; - s = buffer; - len = 0; } -#endif - } - if (len > 0 && end > 0) - { - write_info.bw_len = len; - if (buf_write_bytes(&write_info) == FAIL) - end = 0; /* write error */ - nchars += len; + + /* Stop when writing done or an error was encountered. */ + if (!checking_conversion || end == 0) + break; + + /* If no error happened until now, writing should be ok, so loop to + * really write the buffer. */ } -#if defined(UNIX) && defined(HAVE_FSYNC) - /* On many journalling file systems there is a bug that causes both the - * original and the backup file to be lost when halting the system right - * after writing the file. That's because only the meta-data is - * journalled. Syncing the file slows down the system, but assures it has - * been written to disk and we don't lose it. - * For a device do try the fsync() but don't complain if it does not work - * (could be a pipe). - * If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. */ - if (p_fs && fsync(fd) != 0 && !device) + /* If we started writing, finish writing. Also when an error was + * encountered. */ + if (!checking_conversion) { - errmsg = (char_u *)_("E667: Fsync failed"); - end = 0; - } +#if defined(UNIX) && defined(HAVE_FSYNC) + /* + * On many journalling file systems there is a bug that causes both the + * original and the backup file to be lost when halting the system + * right after writing the file. That's because only the meta-data is + * journalled. Syncing the file slows down the system, but assures it + * has been written to disk and we don't lose it. + * For a device do try the fsync() but don't complain if it does not + * work (could be a pipe). + * If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. + */ + if (p_fs && fsync(fd) != 0 && !device) + { + errmsg = (char_u *)_(e_fsync); + end = 0; + } #endif #if defined(HAVE_SELINUX) || defined(HAVE_SMACK) - /* Probably need to set the security context. */ - if (!backup_copy) - mch_copy_sec(backup, wfname); + /* Probably need to set the security context. */ + if (!backup_copy) + mch_copy_sec(backup, wfname); #endif #ifdef UNIX - /* When creating a new file, set its owner/group to that of the original - * file. Get the new device and inode number. */ - if (backup != NULL && !backup_copy) - { + /* When creating a new file, set its owner/group to that of the + * original file. Get the new device and inode number. */ + if (backup != NULL && !backup_copy) + { # ifdef HAVE_FCHOWN - struct stat st; + stat_T st; - /* don't change the owner when it's already OK, some systems remove - * permission or ACL stuff */ - if (mch_stat((char *)wfname, &st) < 0 - || st.st_uid != st_old.st_uid - || st.st_gid != st_old.st_gid) - { - ignored = fchown(fd, st_old.st_uid, st_old.st_gid); - if (perm >= 0) /* set permission again, may have changed */ - (void)mch_setperm(wfname, perm); - } + /* Don't change the owner when it's already OK, some systems remove + * permission or ACL stuff. */ + if (mch_stat((char *)wfname, &st) < 0 + || st.st_uid != st_old.st_uid + || st.st_gid != st_old.st_gid) + { + /* changing owner might not be possible */ + ignored = fchown(fd, st_old.st_uid, -1); + /* if changing group fails clear the group permissions */ + if (fchown(fd, -1, st_old.st_gid) == -1 && perm > 0) + perm &= ~070; + } # endif - buf_setino(buf); - } - else if (!buf->b_dev_valid) - /* Set the inode when creating a new file. */ - buf_setino(buf); + buf_setino(buf); + } + else if (!buf->b_dev_valid) + /* Set the inode when creating a new file. */ + buf_setino(buf); #endif - if (close(fd) != 0) - { - errmsg = (char_u *)_("E512: Close failed"); - end = 0; - } - #ifdef UNIX - if (made_writable) - perm &= ~0200; /* reset 'w' bit for security reasons */ + if (made_writable) + perm &= ~0200; /* reset 'w' bit for security reasons */ +#endif +#ifdef HAVE_FCHMOD + /* set permission of new file same as old file */ + if (perm >= 0) + (void)mch_fsetperm(fd, perm); +#endif + if (close(fd) != 0) + { + errmsg = (char_u *)_("E512: Close failed"); + end = 0; + } + +#ifndef HAVE_FCHMOD + /* set permission of new file same as old file */ + if (perm >= 0) + (void)mch_setperm(wfname, perm); #endif - if (perm >= 0) /* set perm. of new file same as old file */ - (void)mch_setperm(wfname, perm); #ifdef HAVE_ACL - /* Probably need to set the ACL before changing the user (can't set the - * ACL on a file the user doesn't own). */ - if (!backup_copy) - mch_set_acl(wfname, acl); + /* + * Probably need to set the ACL before changing the user (can't set the + * ACL on a file the user doesn't own). + * On Solaris, with ZFS and the aclmode property set to "discard" (the + * default), chmod() discards all part of a file's ACL that don't + * represent the mode of the file. It's non-trivial for us to discover + * whether we're in that situation, so we simply always re-set the ACL. + */ +# ifndef HAVE_SOLARIS_ZFS_ACL + if (!backup_copy) +# endif + mch_set_acl(wfname, acl); #endif #ifdef FEAT_CRYPT - crypt_method_used = use_crypt_method; - if (wb_flags & FIO_ENCRYPTED) - crypt_pop_state(); + if (buf->b_cryptstate != NULL) + { + crypt_free_state(buf->b_cryptstate); + buf->b_cryptstate = NULL; + } #endif - #if defined(FEAT_MBYTE) && defined(FEAT_EVAL) - if (wfname != fname) - { - /* - * The file was written to a temp file, now it needs to be converted - * with 'charconvert' to (overwrite) the output file. - */ - if (end != 0) + if (wfname != fname) { - if (eval_charconvert(enc_utf8 ? (char_u *)"utf-8" : p_enc, fenc, - wfname, fname) == FAIL) + /* + * The file was written to a temp file, now it needs to be + * converted with 'charconvert' to (overwrite) the output file. + */ + if (end != 0) { - write_info.bw_conv_error = TRUE; - end = 0; + if (eval_charconvert(enc_utf8 ? (char_u *)"utf-8" : p_enc, + fenc, wfname, fname) == FAIL) + { + write_info.bw_conv_error = TRUE; + end = 0; + } } + mch_remove(wfname); + vim_free(wfname); } - mch_remove(wfname); - vim_free(wfname); - } #endif + } if (end == 0) { + /* + * Error encountered. + */ if (errmsg == NULL) { #ifdef FEAT_MBYTE @@ -4924,10 +5236,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, #ifdef FEAT_CRYPT if (wb_flags & FIO_ENCRYPTED) { - if (crypt_method_used == 1) - STRCAT(IObuff, _("[blowfish]")); - else - STRCAT(IObuff, _("[crypted]")); + crypt_append_msg(buf); c = TRUE; } #endif @@ -4953,6 +5262,10 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, ) { unchanged(buf, TRUE); + /* b:changedtick is always incremented in unchanged() but that + * should not trigger a TextChanged event. */ + if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf)) + buf->b_last_changedtick = CHANGEDTICK(buf); u_unchanged(buf); u_update_save_nr(buf); } @@ -4976,17 +5289,12 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, */ if (*p_pm && dobackup) { - char *org = (char *)buf_modname( -#ifdef SHORT_FNAME - TRUE, -#else - (buf->b_p_sn || buf->b_shortname), -#endif + char *org = (char *)buf_modname((buf->b_p_sn || buf->b_shortname), fname, p_pm, FALSE); if (backup != NULL) { - struct stat st; + stat_T st; /* * If the original file does not exist yet @@ -4997,8 +5305,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, else if (mch_stat(org, &st) < 0) { vim_rename(backup, (char_u *)org); - vim_free(backup); /* don't delete the file */ - backup = NULL; + VIM_CLEAR(backup); /* don't delete the file */ #ifdef UNIX set_file_time((char_u *)org, st_old.st_atime, st_old.st_mtime); #endif @@ -5072,7 +5379,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, { int numlen = errnum != NULL ? (int)STRLEN(errnum) : 0; - attr = hl_attr(HLF_E); /* set highlight for error messages */ + attr = HL_ATTR(HLF_E); /* set highlight for error messages */ msg_add_fname(buf, #ifndef UNIX sfname @@ -5127,7 +5434,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, } #endif -#ifdef FEAT_AUTOCMD #ifdef FEAT_EVAL if (!should_abort(retval)) #else @@ -5165,14 +5471,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, retval = FALSE; #endif } -#endif got_int |= prev_got_int; -#ifdef MACOS_CLASSIC /* TODO: Is it need for MACOS_X? (Dany) */ - /* Update machine specific information. */ - mch_post_buffer_write(buf); -#endif #ifdef FEAT_ODB_EDITOR odb_post_buffer_write(buf); #endif @@ -5185,50 +5486,44 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, * name and a ":r" or ":w" command with a file name is used. */ static int -set_rw_fname(fname, sfname) - char_u *fname; - char_u *sfname; +set_rw_fname(char_u *fname, char_u *sfname) { -#ifdef FEAT_AUTOCMD buf_T *buf = curbuf; /* It's like the unnamed buffer is deleted.... */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; -# endif +#endif if (curbuf != buf) { /* We are in another buffer now, don't do the renaming. */ EMSG(_(e_auchangedbuf)); return FAIL; } -#endif if (setfname(curbuf, fname, sfname, FALSE) == OK) curbuf->b_flags |= BF_NOTEDITED; -#ifdef FEAT_AUTOCMD /* ....and a new named one is created */ apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf); if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; -# endif +#endif /* Do filetype detection now if 'filetype' is empty. */ if (*curbuf->b_p_ft == NUL) { if (au_has_group((char_u *)"filetypedetect")) - (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE); + (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL); do_modelines(0); } -#endif return OK; } @@ -5237,9 +5532,7 @@ set_rw_fname(fname, sfname) * Put file name into IObuff with quotes. */ void -msg_add_fname(buf, fname) - buf_T *buf; - char_u *fname; +msg_add_fname(buf_T *buf, char_u *fname) { if (fname == NULL) fname = (char_u *)"-stdin-"; @@ -5253,8 +5546,7 @@ msg_add_fname(buf, fname) * Return TRUE if something appended. */ static int -msg_add_fileformat(eol_type) - int eol_type; +msg_add_fileformat(int eol_type) { #ifndef USE_CRNL if (eol_type == EOL_DOS) @@ -5284,10 +5576,10 @@ msg_add_fileformat(eol_type) * Append line and character count to IObuff. */ void -msg_add_lines(insert_space, lnum, nchars) - int insert_space; - long lnum; - off_t nchars; +msg_add_lines( + int insert_space, + long lnum, + off_T nchars) { char_u *p; @@ -5296,14 +5588,8 @@ msg_add_lines(insert_space, lnum, nchars) if (insert_space) *p++ = ' '; if (shortmess(SHM_LINES)) - sprintf((char *)p, -#ifdef LONG_LONG_OFF_T - "%ldL, %lldC", lnum, (long long)nchars -#else - /* Explicit typecast avoids warning on Mac OS X 10.6 */ - "%ldL, %ldC", lnum, (long)nchars -#endif - ); + vim_snprintf((char *)p, IOSIZE - (p - IObuff), + "%ldL, %lldC", lnum, (long long)nchars); else { if (lnum == 1) @@ -5314,14 +5600,8 @@ msg_add_lines(insert_space, lnum, nchars) if (nchars == 1) STRCPY(p, _("1 character")); else - sprintf((char *)p, -#ifdef LONG_LONG_OFF_T - _("%lld characters"), (long long)nchars -#else - /* Explicit typecast avoids warning on Mac OS X 10.6 */ - _("%ld characters"), (long)nchars -#endif - ); + vim_snprintf((char *)p, IOSIZE - (p - IObuff), + _("%lld characters"), (long long)nchars); } } @@ -5329,7 +5609,7 @@ msg_add_lines(insert_space, lnum, nchars) * Append message for missing line separator to IObuff. */ static void -msg_add_eol() +msg_add_eol(void) { STRCAT(IObuff, shortmess(SHM_LAST) ? _("[noeol]") : _("[Incomplete last line]")); } @@ -5340,9 +5620,7 @@ msg_add_eol() * using the same timestamp but can't set the size. */ static int -check_mtime(buf, st) - buf_T *buf; - struct stat *st; +check_mtime(buf_T *buf, stat_T *st) { if (buf->b_mtime_read != 0 && time_differs((long)st->st_mtime, buf->b_mtime_read)) @@ -5351,7 +5629,7 @@ check_mtime(buf, st) msg_silent = 0; /* must give this prompt */ /* don't use emsg() here, don't want to flush the buffers */ MSG_ATTR(_("WARNING: The file has been changed since reading it!!!"), - hl_attr(HLF_E)); + HL_ATTR(HLF_E)); if (ask_yesno((char_u *)_("Do you really want to write to it"), TRUE) == 'n') return FAIL; @@ -5361,10 +5639,9 @@ check_mtime(buf, st) } static int -time_differs(t1, t2) - long t1, t2; +time_differs(long t1, long t2) { -#if defined(__linux__) || defined(MSDOS) || defined(MSWIN) +#if defined(__linux__) || defined(MSWIN) /* On a FAT filesystem, esp. under Linux, there are only 5 bits to store * the seconds. Since the roundoff is done when flushing the inode, the * time may change unexpectedly by one second!!! */ @@ -5381,8 +5658,7 @@ time_differs(t1, t2) * Return FAIL for failure, OK otherwise. */ static int -buf_write_bytes(ip) - struct bw_info *ip; +buf_write_bytes(struct bw_info *ip) { int wlen; char_u *buf = ip->bw_buf; /* data to write */ @@ -5743,9 +6019,31 @@ buf_write_bytes(ip) } #endif /* FEAT_MBYTE */ + if (ip->bw_fd < 0) + /* Only checking conversion, which is OK if we get here. */ + return OK; + #ifdef FEAT_CRYPT - if (flags & FIO_ENCRYPTED) /* encrypt the data */ - crypt_encode(buf, len, buf); + if (flags & FIO_ENCRYPTED) + { + /* Encrypt the data. Do it in-place if possible, otherwise use an + * allocated buffer. */ + if (crypt_works_inplace(ip->bw_buffer->b_cryptstate)) + { + crypt_encode_inplace(ip->bw_buffer->b_cryptstate, buf, len); + } + else + { + char_u *outbuf; + + len = crypt_encode_alloc(curbuf->b_cryptstate, buf, len, &outbuf); + if (len == 0) + return OK; /* Crypt layer is buffering, will flush later. */ + wlen = write_eintr(ip->bw_fd, outbuf, len); + vim_free(outbuf); + return (wlen < len) ? FAIL : OK; + } + } #endif wlen = write_eintr(ip->bw_fd, buf, len); @@ -5758,10 +6056,10 @@ buf_write_bytes(ip) * Return TRUE for an error, FALSE when it's OK. */ static int -ucs2bytes(c, pp, flags) - unsigned c; /* in: character */ - char_u **pp; /* in/out: pointer to result */ - int flags; /* FIO_ flags */ +ucs2bytes( + unsigned c, /* in: character */ + char_u **pp, /* in/out: pointer to result */ + int flags) /* FIO_ flags */ { char_u *p = *pp; int error = FALSE; @@ -5843,8 +6141,7 @@ ucs2bytes(c, pp, flags) * 'encoding'. */ static int -need_conversion(fenc) - char_u *fenc; +need_conversion(char_u *fenc) { int same_encoding; int enc_flags; @@ -5881,8 +6178,7 @@ need_conversion(fenc) * if "ptr" is an empty string, use 'encoding'. */ static int -get_fio_flags(ptr) - char_u *ptr; +get_fio_flags(char_u *ptr) { int prop; @@ -5925,8 +6221,7 @@ get_fio_flags(ptr) * Used for conversion between 'encoding' and 'fileencoding'. */ static int -get_win_fio_flags(ptr) - char_u *ptr; +get_win_fio_flags(char_u *ptr) { int cp; @@ -5948,14 +6243,13 @@ get_win_fio_flags(ptr) } #endif -#ifdef MACOS_X +#ifdef MACOS_CONVERT /* * Check "ptr" for a Carbon supported encoding and return the FIO_ flags * needed for the internal conversion to/from utf-8 or latin1. */ static int -get_mac_fio_flags(ptr) - char_u *ptr; +get_mac_fio_flags(char_u *ptr) { if ((enc_utf8 || STRCMP(p_enc, "latin1") == 0) && (enc_canon_props(ptr) & ENC_MACROMAN)) @@ -5971,11 +6265,11 @@ get_mac_fio_flags(ptr) * Returns NULL when no BOM found. */ static char_u * -check_for_bom(p, size, lenp, flags) - char_u *p; - long size; - int *lenp; - int flags; +check_for_bom( + char_u *p, + long size, + int *lenp, + int flags) { char *name = NULL; int len = 2; @@ -6025,9 +6319,7 @@ check_for_bom(p, size, lenp, flags) * Return the length of the BOM (zero when no BOM). */ static int -make_bom(buf, name) - char_u *buf; - char_u *name; +make_bom(char_u *buf, char_u *name) { int flags; char_u *p; @@ -6051,16 +6343,13 @@ make_bom(buf, name) } #endif -#if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ - defined(FEAT_QUICKFIX) || defined(FEAT_AUTOCMD) || defined(PROTO) /* * Try to find a shortname by comparing the fullname with the current * directory. * Returns "full_path" or pointer into "full_path" if shortened. */ char_u * -shorten_fname1(full_path) - char_u *full_path; +shorten_fname1(char_u *full_path) { char_u *dirname; char_u *p = full_path; @@ -6077,7 +6366,6 @@ shorten_fname1(full_path) vim_free(dirname); return p; } -#endif /* * Try to find a shortname by comparing the fullname with the current @@ -6086,9 +6374,7 @@ shorten_fname1(full_path) * otherwise. */ char_u * -shorten_fname(full_path, dir_name) - char_u *full_path; - char_u *dir_name; +shorten_fname(char_u *full_path, char_u *dir_name) { int len; char_u *p; @@ -6099,9 +6385,9 @@ shorten_fname(full_path, dir_name) if (fnamencmp(dir_name, full_path, len) == 0) { p = full_path + len; -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* - * MSDOS: when a file is in the root directory, dir_name will end in a + * MSWIN: when a file is in the root directory, dir_name will end in a * slash, since C: by itself does not define a specific dir. In this * case p may already be correct. <negri> */ @@ -6116,7 +6402,7 @@ shorten_fname(full_path, dir_name) #endif } } -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* * When using a file in the current drive, remove the drive name: * "A:\dir\file" -> "\dir\file". This helps when moving a session file on @@ -6134,7 +6420,7 @@ shorten_fname(full_path, dir_name) } /* - * Shorten filenames for all buffers. + * Shorten filename of a buffer. * When "force" is TRUE: Use full path from now on for files currently being * edited, both for file name and swap file name. Try to shorten the file * names a bit, if safe to do so. @@ -6143,45 +6429,51 @@ shorten_fname(full_path, dir_name) * name. */ void -shorten_fnames(force) - int force; +shorten_buf_fname(buf_T *buf, char_u *dirname, int force) { - char_u dirname[MAXPATHL]; - buf_T *buf; char_u *p; - mch_dirname(dirname, MAXPATHL); - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - { - if (buf->b_fname != NULL + if (buf->b_fname != NULL #ifdef FEAT_QUICKFIX - && !bt_nofile(buf) + && !bt_nofile(buf) #endif - && !path_with_url(buf->b_fname) - && (force - || buf->b_sfname == NULL - || mch_isFullName(buf->b_sfname))) + && !path_with_url(buf->b_fname) + && (force + || buf->b_sfname == NULL + || mch_isFullName(buf->b_sfname))) + { + VIM_CLEAR(buf->b_sfname); + p = shorten_fname(buf->b_ffname, dirname); + if (p != NULL) { - vim_free(buf->b_sfname); - buf->b_sfname = NULL; - p = shorten_fname(buf->b_ffname, dirname); - if (p != NULL) - { - buf->b_sfname = vim_strsave(p); - buf->b_fname = buf->b_sfname; - } - if (p == NULL || buf->b_fname == NULL) - buf->b_fname = buf->b_ffname; + buf->b_sfname = vim_strsave(p); + buf->b_fname = buf->b_sfname; } + if (p == NULL || buf->b_fname == NULL) + buf->b_fname = buf->b_ffname; + } +} + +/* + * Shorten filenames for all buffers. + */ + void +shorten_fnames(int force) +{ + char_u dirname[MAXPATHL]; + buf_T *buf; + + mch_dirname(dirname, MAXPATHL); + FOR_ALL_BUFFERS(buf) + { + shorten_buf_fname(buf, dirname, force); /* Always make the swap file name a full path, a "nofile" buffer may * also have a swap file. */ mf_fullname(buf->b_ml.ml_mfp); } -#ifdef FEAT_WINDOWS status_redraw_all(); redraw_tabline = TRUE; -#endif } #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ @@ -6193,9 +6485,7 @@ shorten_fnames(force) * Shorten all filenames in "fnames[count]" by current directory. */ void -shorten_filenames(fnames, count) - char_u **fnames; - int count; +shorten_filenames(char_u **fnames, int count) { int i; char_u dirname[MAXPATHL]; @@ -6231,24 +6521,21 @@ shorten_filenames(fnames, count) * Returns NULL when out of memory. */ char_u * -modname(fname, ext, prepend_dot) - char_u *fname, *ext; - int prepend_dot; /* may prepend a '.' to file name */ +modname( + char_u *fname, + char_u *ext, + int prepend_dot) /* may prepend a '.' to file name */ { - return buf_modname( -#ifdef SHORT_FNAME - TRUE, -#else - (curbuf->b_p_sn || curbuf->b_shortname), -#endif + return buf_modname((curbuf->b_p_sn || curbuf->b_shortname), fname, ext, prepend_dot); } char_u * -buf_modname(shortname, fname, ext, prepend_dot) - int shortname; /* use 8.3 file name */ - char_u *fname, *ext; - int prepend_dot; /* may prepend a '.' to file name */ +buf_modname( + int shortname, /* use 8.3 file name */ + char_u *fname, + char_u *ext, + int prepend_dot) /* may prepend a '.' to file name */ { char_u *retval; char_u *s; @@ -6278,9 +6565,7 @@ buf_modname(shortname, fname, ext, prepend_dot) retval[fnamelen++] = PATHSEP; retval[fnamelen] = NUL; } -#ifndef SHORT_FNAME prepend_dot = FALSE; /* nothing to prepend a dot to */ -#endif } else { @@ -6300,15 +6585,13 @@ buf_modname(shortname, fname, ext, prepend_dot) * Then truncate what is after the '/', '\' or ':' to 8 characters for * MSDOS and 26 characters for AMIGA, a lot more for UNIX. */ - for (ptr = retval + fnamelen; ptr > retval; mb_ptr_back(retval, ptr)) + for (ptr = retval + fnamelen; ptr > retval; MB_PTR_BACK(retval, ptr)) { if (*ext == '.' #ifdef USE_LONG_FNAME && (!USE_LONG_FNAME || shortname) #else -# ifndef SHORT_FNAME && shortname -# endif #endif ) if (*ptr == '.') /* replace '.' by '_' */ @@ -6321,10 +6604,8 @@ buf_modname(shortname, fname, ext, prepend_dot) } /* the file name has at most BASENAMELEN characters. */ -#ifndef SHORT_FNAME if (STRLEN(ptr) > (unsigned)BASENAMELEN) ptr[BASENAMELEN] = '\0'; -#endif s = ptr + STRLEN(ptr); @@ -6334,9 +6615,7 @@ buf_modname(shortname, fname, ext, prepend_dot) #ifdef USE_LONG_FNAME if (!USE_LONG_FNAME || shortname) #else -# ifndef SHORT_FNAME if (shortname) -# endif #endif { /* @@ -6375,7 +6654,7 @@ buf_modname(shortname, fname, ext, prepend_dot) else if ((int)STRLEN(e) + extlen > 4) s = e + 4 - extlen; } -#if defined(OS2) || defined(USE_LONG_FNAME) || defined(WIN3264) +#if defined(USE_LONG_FNAME) || defined(WIN3264) /* * If there is no file name, and the extension starts with '.', put a * '_' before the dot, because just ".ext" may be invalid if it's on a @@ -6391,7 +6670,6 @@ buf_modname(shortname, fname, ext, prepend_dot) */ STRCPY(s, ext); -#ifndef SHORT_FNAME /* * Prepend the dot. */ @@ -6404,7 +6682,6 @@ buf_modname(shortname, fname, ext, prepend_dot) STRMOVE(e + 1, e); *e = '.'; } -#endif /* * Check that, after appending the extension, the file name is really @@ -6430,12 +6707,10 @@ buf_modname(shortname, fname, ext, prepend_dot) /* * Like fgets(), but if the file line is too long, it is truncated and the * rest of the line is thrown away. Returns TRUE for end-of-file. + * If the line is truncated then buf[size - 2] will not be NUL. */ int -vim_fgets(buf, size, fp) - char_u *buf; - int size; - FILE *fp; +vim_fgets(char_u *buf, int size, FILE *fp) { char *eof; #define FGETS_SIZE 200 @@ -6472,10 +6747,7 @@ vim_fgets(buf, size, fp) * Only used for the Mac, because it's much slower than vim_fgets(). */ int -tag_fgets(buf, size, fp) - char_u *buf; - int size; - FILE *fp; +tag_fgets(char_u *buf, int size, FILE *fp) { int i = 0; int c; @@ -6515,9 +6787,7 @@ tag_fgets(buf, size, fp) * Return -1 for failure, 0 for success. */ int -vim_rename(from, to) - char_u *from; - char_u *to; +vim_rename(char_u *from, char_u *to) { int fd_in; int fd_out; @@ -6527,7 +6797,7 @@ vim_rename(from, to) #ifdef AMIGA BPTR flock; #endif - struct stat st; + stat_T st; long perm; #ifdef HAVE_ACL vim_acl_T acl; /* ACL from original file */ @@ -6555,7 +6825,7 @@ vim_rename(from, to) #ifdef UNIX { - struct stat st_to; + stat_T st_to; /* It's possible for the source and destination to be the same file. * This happens when "from" and "to" differ in case and are on a FAT32 @@ -6738,8 +7008,8 @@ static int default_reload_choice = 0; * cursor positioned). */ int -check_timestamps(focus) - int focus; /* called for GUI focus event */ +check_timestamps( + int focus) /* called for GUI focus event */ { buf_T *buf; int didit = 0; @@ -6760,10 +7030,7 @@ check_timestamps(focus) } if (!stuff_empty() || global_busy || !typebuf_typed() -#ifdef FEAT_AUTOCMD - || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 -#endif - ) + || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0) need_check_timestamps = TRUE; /* check later */ else { @@ -6773,15 +7040,18 @@ check_timestamps(focus) #ifdef FEAT_GUI_MACVIM default_reload_choice = 0; #endif - for (buf = firstbuf; buf != NULL; ) + FOR_ALL_BUFFERS(buf) { /* Only check buffers in a window. */ if (buf->b_nwindows > 0) { + bufref_T bufref; + + set_bufref(&bufref, buf); n = buf_check_timestamp(buf, focus); if (didit < n) didit = n; - if (n > 0 && !buf_valid(buf)) + if (n > 0 && !bufref_valid(&bufref)) { /* Autocommands have removed the buffer, start at the * first one again. */ @@ -6789,7 +7059,6 @@ check_timestamps(focus) continue; } } - buf = buf->b_next; } #ifdef FEAT_GUI_MACVIM default_reload_choice = 0; @@ -6812,9 +7081,7 @@ check_timestamps(focus) * empty. */ static int -move_lines(frombuf, tobuf) - buf_T *frombuf; - buf_T *tobuf; +move_lines(buf_T *frombuf, buf_T *tobuf) { buf_T *tbuf = curbuf; int retval = OK; @@ -6861,11 +7128,11 @@ move_lines(frombuf, tobuf) * return 0 otherwise. */ int -buf_check_timestamp(buf, focus) - buf_T *buf; - int focus UNUSED; /* called for GUI focus event */ +buf_check_timestamp( + buf_T *buf, + int focus UNUSED) /* called for GUI focus event */ { - struct stat st; + stat_T st; int stat_res; int retval = 0; char_u *path; @@ -6874,35 +7141,37 @@ buf_check_timestamp(buf, focus) char *mesg2 = ""; int helpmesg = FALSE; int reload = FALSE; + char *reason; #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) int can_reload = FALSE; #endif - off_t orig_size = buf->b_orig_size; + off_T orig_size = buf->b_orig_size; int orig_mode = buf->b_orig_mode; #ifdef FEAT_GUI int save_mouse_correct = need_mouse_correct; #endif -#ifdef FEAT_AUTOCMD static int busy = FALSE; int n; +#ifdef FEAT_EVAL char_u *s; #endif - char *reason; + bufref_T bufref; + + set_bufref(&bufref, buf); /* If there is no file name, the buffer is not loaded, 'buftype' is * set, we are in the middle of a save or being called recursively: ignore * this buffer. */ if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL -#if defined(FEAT_QUICKFIX) || *buf->b_p_bt != NUL -#endif || buf->b_saving -#ifdef FEAT_AUTOCMD || busy -#endif #ifdef FEAT_NETBEANS_INTG || isNetbeansBuffer(buf) +#endif +#ifdef FEAT_TERMINAL + || buf->b_term != NULL #endif ) return 0; @@ -6958,17 +7227,16 @@ buf_check_timestamp(buf, focus) else reason = "time"; -#ifdef FEAT_AUTOCMD /* * Only give the warning if there are no FileChangedShell * autocommands. * Avoid being called recursively by setting "busy". */ busy = TRUE; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1); set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1); -# endif +#endif ++allbuf_lock; n = apply_autocmds(EVENT_FILECHANGEDSHELL, buf->b_fname, buf->b_fname, FALSE, buf); @@ -6976,20 +7244,19 @@ buf_check_timestamp(buf, focus) busy = FALSE; if (n) { - if (!buf_valid(buf)) + if (!bufref_valid(&bufref)) EMSG(_("E246: FileChangedShell autocommand deleted buffer")); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') reload = TRUE; else if (STRCMP(s, "ask") == 0) n = FALSE; else -# endif +#endif return 2; } if (!n) -#endif { if (*reason == 'd') mesg = _("E211: File \"%s\" no longer available"); @@ -7105,23 +7372,21 @@ buf_check_timestamp(buf, focus) } else { -# ifdef FEAT_AUTOCMD if (!autocmd_busy) -# endif { msg_start(); - msg_puts_attr(tbuf, hl_attr(HLF_E) + MSG_HIST); + msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST); if (*mesg2 != NUL) msg_puts_attr((char_u *)mesg2, - hl_attr(HLF_W) + MSG_HIST); + HL_ATTR(HLF_W) + MSG_HIST); msg_clr_eos(); (void)msg_end(); if (emsg_silent == 0) { out_flush(); -# ifdef FEAT_GUI +#ifdef FEAT_GUI if (!focus) -# endif +#endif /* give the user some time to think about it */ ui_delay(1000L, TRUE); @@ -7156,12 +7421,10 @@ buf_check_timestamp(buf, focus) #endif } -#ifdef FEAT_AUTOCMD /* Trigger FileChangedShell when the file was changed in any way. */ - if (buf_valid(buf) && retval != 0) + if (bufref_valid(&bufref) && retval != 0) (void)apply_autocmds(EVENT_FILECHANGEDSHELLPOST, buf->b_fname, buf->b_fname, FALSE, buf); -#endif #ifdef FEAT_GUI /* restore this in case an autocommand has set it; it would break * 'mousefocus' */ @@ -7178,15 +7441,14 @@ buf_check_timestamp(buf, focus) * buf->b_orig_mode may have been reset already. */ void -buf_reload(buf, orig_mode) - buf_T *buf; - int orig_mode; +buf_reload(buf_T *buf, int orig_mode) { exarg_T ea; pos_T old_cursor; linenr_T old_topline; int old_ro = buf->b_p_ro; buf_T *savebuf; + bufref_T bufref; int saved = OK; aco_save_T aco; int flags = READ_NEW; @@ -7218,12 +7480,13 @@ buf_reload(buf, orig_mode) * the old contents. Can't use memory only, the file might be * too big. Use a hidden buffer to move the buffer contents to. */ - if (bufempty() || saved == FAIL) + if (BUFEMPTY() || saved == FAIL) savebuf = NULL; else { /* Allocate a buffer without putting it in the buffer list. */ savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); + set_bufref(&bufref, savebuf); if (savebuf != NULL && buf == curbuf) { /* Open the memline. */ @@ -7245,22 +7508,20 @@ buf_reload(buf, orig_mode) if (saved == OK) { curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */ -#ifdef FEAT_AUTOCMD keep_filetype = TRUE; /* don't detect 'filetype' */ -#endif if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, - (linenr_T)MAXLNUM, &ea, flags) == FAIL) + (linenr_T)MAXLNUM, &ea, flags) != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); - if (savebuf != NULL && buf_valid(savebuf) && buf == curbuf) + if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) { /* Put the text back from the save buffer. First * delete any lines that readfile() added. */ - while (!bufempty()) + while (!BUFEMPTY()) if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL) break; (void)move_lines(savebuf, buf); @@ -7284,7 +7545,7 @@ buf_reload(buf, orig_mode) } vim_free(ea.cmd); - if (savebuf != NULL && buf_valid(savebuf)) + if (savebuf != NULL && bufref_valid(&bufref)) wipe_buffer(savebuf, FALSE); #ifdef FEAT_DIFF @@ -7301,9 +7562,7 @@ buf_reload(buf, orig_mode) curwin->w_cursor = old_cursor; check_cursor(); update_topline(); -#ifdef FEAT_AUTOCMD keep_filetype = FALSE; -#endif #ifdef FEAT_FOLDING { win_T *wp; @@ -7332,10 +7591,7 @@ buf_reload(buf, orig_mode) } void -buf_store_time(buf, st, fname) - buf_T *buf; - struct stat *st; - char_u *fname UNUSED; +buf_store_time(buf_T *buf, stat_T *st, char_u *fname UNUSED) { buf->b_mtime = (long)st->st_mtime; buf->b_orig_size = st->st_size; @@ -7351,13 +7607,60 @@ buf_store_time(buf, st, fname) * Used for do_filter(), when the input lines for the filter are deleted. */ void -write_lnum_adjust(offset) - linenr_T offset; +write_lnum_adjust(linenr_T offset) { if (curbuf->b_no_eol_lnum != 0) /* only if there is a missing eol */ curbuf->b_no_eol_lnum += offset; } +#if defined(TEMPDIRNAMES) || defined(FEAT_EVAL) || defined(PROTO) +/* + * Delete "name" and everything in it, recursively. + * return 0 for succes, -1 if some file was not deleted. + */ + int +delete_recursive(char_u *name) +{ + int result = 0; + char_u **files; + int file_count; + int i; + char_u *exp; + + /* A symbolic link to a directory itself is deleted, not the directory it + * points to. */ + if ( +# if defined(UNIX) || defined(WIN32) + mch_isrealdir(name) +# else + mch_isdir(name) +# endif + ) + { + vim_snprintf((char *)NameBuff, MAXPATHL, "%s/*", name); + exp = vim_strsave(NameBuff); + if (exp == NULL) + return -1; + if (gen_expand_wildcards(1, &exp, &file_count, &files, + EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT|EW_EMPTYOK) == OK) + { + for (i = 0; i < file_count; ++i) + if (delete_recursive(files[i]) != 0) + result = -1; + FreeWild(file_count, files); + } + else + result = -1; + vim_free(exp); + (void)mch_rmdir(name); + } + else + result = mch_remove(name) == 0 ? 0 : -1; + + return result; +} +#endif + #if defined(TEMPDIRNAMES) || defined(PROTO) static long temp_count = 0; /* Temp filename counter. */ @@ -7365,40 +7668,24 @@ static long temp_count = 0; /* Temp filename counter. */ * Delete the temp directory and all files it contains. */ void -vim_deltempdir() +vim_deltempdir(void) { - char_u **files; - int file_count; - int i; - if (vim_tempdir != NULL) { - sprintf((char *)NameBuff, "%s*", vim_tempdir); - if (gen_expand_wildcards(1, &NameBuff, &file_count, &files, - EW_DIR|EW_FILE|EW_SILENT) == OK) - { - for (i = 0; i < file_count; ++i) - mch_remove(files[i]); - FreeWild(file_count, files); - } - gettail(NameBuff)[-1] = NUL; - (void)mch_rmdir(NameBuff); - - vim_free(vim_tempdir); - vim_tempdir = NULL; + /* remove the trailing path separator */ + gettail(vim_tempdir)[-1] = NUL; + delete_recursive(vim_tempdir); + VIM_CLEAR(vim_tempdir); } } -#endif -#ifdef TEMPDIRNAMES /* * Directory "tempdir" was created. Expand this name to a full path and put * it in "vim_tempdir". This avoids that using ":cd" would confuse us. * "tempdir" must be no longer than MAXPATHL. */ static void -vim_settempdir(tempdir) - char_u *tempdir; +vim_settempdir(char_u *tempdir) { char_u *buf; @@ -7407,12 +7694,7 @@ vim_settempdir(tempdir) { if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL) STRCPY(buf, tempdir); -# ifdef __EMX__ - if (vim_strchr(buf, '/') != NULL) - STRCAT(buf, "/"); - else -# endif - add_pathsep(buf); + add_pathsep(buf); vim_tempdir = vim_strsave(buf); vim_free(buf); } @@ -7422,14 +7704,16 @@ vim_settempdir(tempdir) /* * vim_tempname(): Return a unique name that can be used for a temp file. * - * The temp file is NOT created. + * The temp file is NOT guaranteed to be created. If "keep" is FALSE it is + * guaranteed to NOT be created. * * The returned pointer is to allocated memory. * The returned pointer is NULL if no valid name was found. */ char_u * -vim_tempname(extra_char) - int extra_char UNUSED; /* char to use in the name instead of '?' */ +vim_tempname( + int extra_char UNUSED, /* char to use in the name instead of '?' */ + int keep UNUSED) { #ifdef USE_TMPNAM char_u itmp[L_tmpnam]; /* use tmpnam() */ @@ -7441,7 +7725,7 @@ vim_tempname(extra_char) static char *(tempdirs[]) = {TEMPDIRNAMES}; int i; # ifndef EEXIST - struct stat st; + stat_T st; # endif /* @@ -7464,25 +7748,29 @@ vim_tempname(extra_char) long off; # endif - /* expand $TMP, leave room for "/v1100000/999999999" */ + /* Expand $TMP, leave room for "/v1100000/999999999". + * Skip the directory check if the expansion fails. */ expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20); - if (mch_isdir(itmp)) /* directory exists */ + if (itmp[0] != '$' && mch_isdir(itmp)) { -# ifdef __EMX__ - /* If $TMP contains a forward slash (perhaps using bash or - * tcsh), don't add a backslash, use a forward slash! - * Adding 2 backslashes didn't work. */ - if (vim_strchr(itmp, '/') != NULL) - STRCAT(itmp, "/"); - else -# endif - add_pathsep(itmp); + /* directory exists */ + add_pathsep(itmp); # ifdef HAVE_MKDTEMP - /* Leave room for filename */ - STRCAT(itmp, "vXXXXXX"); - if (mkdtemp((char *)itmp) != NULL) - vim_settempdir(itmp); + { +# if defined(UNIX) || defined(VMS) + /* Make sure the umask doesn't remove the executable bit. + * "repl" has been reported to use "177". */ + mode_t umask_save = umask(077); +# endif + /* Leave room for filename */ + STRCAT(itmp, "vXXXXXX"); + if (mkdtemp((char *)itmp) != NULL) + vim_settempdir(itmp); +# if defined(UNIX) || defined(VMS) + (void)umask(umask_save); +# endif + } # else /* Get an arbitrary number of up to 6 digits. When it's * unlikely that it already exists it will be faster, @@ -7563,10 +7851,11 @@ vim_tempname(extra_char) } strcpy(buf4, "VIM"); buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */ - if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0) + if (GetTempFileName(szTempFile, buf4, 0, (LPSTR)itmp) == 0) return NULL; - /* GetTempFileName() will create the file, we don't want that */ - (void)DeleteFile(itmp); + if (!keep) + /* GetTempFileName() will create the file, we don't want that */ + (void)DeleteFile((LPSTR)itmp); /* Backslashes in a temp file name cause problems when filtering with * "sh". NOTE: This also checks 'shellcmdflag' to help those people who @@ -7622,14 +7911,16 @@ vim_tempname(extra_char) #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO) /* - * Convert all backslashes in fname to forward slashes in-place. + * Convert all backslashes in fname to forward slashes in-place, unless when + * it looks like a URL. */ void -forward_slash(fname) - char_u *fname; +forward_slash(char_u *fname) { char_u *p; + if (path_with_url(fname)) + return; for (p = fname; *p != NUL; ++p) # ifdef FEAT_MBYTE /* The Big5 encoding can have '\' in the trail byte. */ @@ -7645,18 +7936,16 @@ forward_slash(fname) /* * Code for automatic commands. - * - * Only included when "FEAT_AUTOCMD" has been defined. */ -#if defined(FEAT_AUTOCMD) || defined(PROTO) - /* * The autocommands are stored in a list for each event. * Autocommands for the same pattern, that are consecutive, are joined * together, to avoid having to match the pattern too often. * The result is an array of Autopat lists, which point to AutoCmd lists: * + * last_autopat[0] -----------------------------+ + * V * first_autopat[0] --> Autopat.next --> Autopat.next --> NULL * Autopat.cmds Autopat.cmds * | | @@ -7669,6 +7958,8 @@ forward_slash(fname) * V * NULL * + * last_autopat[1] --------+ + * V * first_autopat[1] --> Autopat.next --> NULL * Autopat.cmds * | @@ -7696,11 +7987,12 @@ typedef struct AutoCmd typedef struct AutoPat { + struct AutoPat *next; /* next AutoPat in AutoPat list; MUST + * be the first entry */ char_u *pat; /* pattern as typed (NULL when pattern has been removed) */ regprog_T *reg_prog; /* compiled regprog for pattern */ AutoCmd *cmds; /* list of commands to do */ - struct AutoPat *next; /* next AutoPat in AutoPat list */ int group; /* group ID */ int patlen; /* strlen() of pat */ int buflocal_nr; /* !=0 for buffer-local AutoPat */ @@ -7736,15 +8028,22 @@ static struct event_name {"BufWritePost", EVENT_BUFWRITEPOST}, {"BufWritePre", EVENT_BUFWRITEPRE}, {"BufWriteCmd", EVENT_BUFWRITECMD}, + {"CmdlineChanged", EVENT_CMDLINECHANGED}, + {"CmdlineEnter", EVENT_CMDLINEENTER}, + {"CmdlineLeave", EVENT_CMDLINELEAVE}, {"CmdwinEnter", EVENT_CMDWINENTER}, {"CmdwinLeave", EVENT_CMDWINLEAVE}, + {"CmdUndefined", EVENT_CMDUNDEFINED}, {"ColorScheme", EVENT_COLORSCHEME}, + {"ColorSchemePre", EVENT_COLORSCHEMEPRE}, {"CompleteDone", EVENT_COMPLETEDONE}, {"CursorHold", EVENT_CURSORHOLD}, {"CursorHoldI", EVENT_CURSORHOLDI}, {"CursorMoved", EVENT_CURSORMOVED}, {"CursorMovedI", EVENT_CURSORMOVEDI}, + {"DirChanged", EVENT_DIRCHANGED}, {"EncodingChanged", EVENT_ENCODINGCHANGED}, + {"ExitPre", EVENT_EXITPRE}, {"FileEncoding", EVENT_ENCODINGCHANGED}, {"FileAppendPost", EVENT_FILEAPPENDPOST}, {"FileAppendPre", EVENT_FILEAPPENDPRE}, @@ -7773,6 +8072,7 @@ static struct event_name {"InsertLeave", EVENT_INSERTLEAVE}, {"InsertCharPre", EVENT_INSERTCHARPRE}, {"MenuPopup", EVENT_MENUPOPUP}, + {"OptionSet", EVENT_OPTIONSET}, {"QuickFixCmdPost", EVENT_QUICKFIXCMDPOST}, {"QuickFixCmdPre", EVENT_QUICKFIXCMDPRE}, {"QuitPre", EVENT_QUITPRE}, @@ -7787,19 +8087,25 @@ static struct event_name {"StdinReadPre", EVENT_STDINREADPRE}, {"SwapExists", EVENT_SWAPEXISTS}, {"Syntax", EVENT_SYNTAX}, + {"TabNew", EVENT_TABNEW}, + {"TabClosed", EVENT_TABCLOSED}, {"TabEnter", EVENT_TABENTER}, {"TabLeave", EVENT_TABLEAVE}, {"TermChanged", EVENT_TERMCHANGED}, + {"TerminalOpen", EVENT_TERMINALOPEN}, {"TermResponse", EVENT_TERMRESPONSE}, {"TextChanged", EVENT_TEXTCHANGED}, {"TextChangedI", EVENT_TEXTCHANGEDI}, + {"TextChangedP", EVENT_TEXTCHANGEDP}, {"User", EVENT_USER}, {"VimEnter", EVENT_VIMENTER}, {"VimLeave", EVENT_VIMLEAVE}, {"VimLeavePre", EVENT_VIMLEAVEPRE}, + {"WinNew", EVENT_WINNEW}, {"WinEnter", EVENT_WINENTER}, {"WinLeave", EVENT_WINLEAVE}, {"VimResized", EVENT_VIMRESIZED}, + {"TextYankPost", EVENT_TEXTYANKPOST}, {NULL, (event_T)0} }; @@ -7810,7 +8116,17 @@ static AutoPat *first_autopat[NUM_EVENTS] = NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + +static AutoPat *last_autopat[NUM_EVENTS] = +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /* @@ -7837,6 +8153,8 @@ static AutoPatCmd *active_apc_list = NULL; /* stack of active autocommands */ */ static garray_T augroups = {0, 0, sizeof(char_u *), 10, NULL}; #define AUGROUP_NAME(i) (((char_u **)augroups.ga_data)[i]) +/* use get_deleted_augroup() to get this */ +static char_u *deleted_augroup = NULL; /* * The ID of the current group. Group 0 is the default one. @@ -7845,33 +8163,40 @@ static int current_augroup = AUGROUP_DEFAULT; static int au_need_clean = FALSE; /* need to delete marked patterns */ -static void show_autocmd __ARGS((AutoPat *ap, event_T event)); -static void au_remove_pat __ARGS((AutoPat *ap)); -static void au_remove_cmds __ARGS((AutoPat *ap)); -static void au_cleanup __ARGS((void)); -static int au_new_group __ARGS((char_u *name)); -static void au_del_group __ARGS((char_u *name)); -static event_T event_name2nr __ARGS((char_u *start, char_u **end)); -static char_u *event_nr2name __ARGS((event_T event)); -static char_u *find_end_event __ARGS((char_u *arg, int have_group)); -static int event_ignored __ARGS((event_T event)); -static int au_get_grouparg __ARGS((char_u **argp)); -static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group)); -static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap)); -static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last)); +static void show_autocmd(AutoPat *ap, event_T event); +static void au_remove_pat(AutoPat *ap); +static void au_remove_cmds(AutoPat *ap); +static void au_cleanup(void); +static int au_new_group(char_u *name); +static void au_del_group(char_u *name); +static event_T event_name2nr(char_u *start, char_u **end); +static char_u *event_nr2name(event_T event); +static char_u *find_end_event(char_u *arg, int have_group); +static int event_ignored(event_T event); +static int au_get_grouparg(char_u **argp); +static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group); +static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap); +static void auto_next_pat(AutoPatCmd *apc, int stop_at_last); +static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs); static event_T last_event; static int last_group; static int autocmd_blocked = 0; /* block all autocmds */ + static char_u * +get_deleted_augroup(void) +{ + if (deleted_augroup == NULL) + deleted_augroup = (char_u *)_("--Deleted--"); + return deleted_augroup; +} + /* * Show the autocommands for one AutoPat. */ static void -show_autocmd(ap, event) - AutoPat *ap; - event_T event; +show_autocmd(AutoPat *ap, event_T event) { AutoCmd *ac; @@ -7890,12 +8215,12 @@ show_autocmd(ap, event) if (ap->group != AUGROUP_DEFAULT) { if (AUGROUP_NAME(ap->group) == NULL) - msg_puts_attr((char_u *)_("--Deleted--"), hl_attr(HLF_E)); + msg_puts_attr(get_deleted_augroup(), HL_ATTR(HLF_E)); else - msg_puts_attr(AUGROUP_NAME(ap->group), hl_attr(HLF_T)); + msg_puts_attr(AUGROUP_NAME(ap->group), HL_ATTR(HLF_T)); msg_puts((char_u *)" "); } - msg_puts_attr(event_nr2name(event), hl_attr(HLF_T)); + msg_puts_attr(event_nr2name(event), HL_ATTR(HLF_T)); last_event = event; last_group = ap->group; msg_putchar('\n'); @@ -7935,11 +8260,9 @@ show_autocmd(ap, event) * Mark an autocommand pattern for deletion. */ static void -au_remove_pat(ap) - AutoPat *ap; +au_remove_pat(AutoPat *ap) { - vim_free(ap->pat); - ap->pat = NULL; + VIM_CLEAR(ap->pat); ap->buflocal_nr = -1; au_need_clean = TRUE; } @@ -7948,16 +8271,12 @@ au_remove_pat(ap) * Mark all commands for a pattern for deletion. */ static void -au_remove_cmds(ap) - AutoPat *ap; +au_remove_cmds(AutoPat *ap) { AutoCmd *ac; for (ac = ap->cmds; ac != NULL; ac = ac->next) - { - vim_free(ac->cmd); - ac->cmd = NULL; - } + VIM_CLEAR(ac->cmd); au_need_clean = TRUE; } @@ -7966,7 +8285,7 @@ au_remove_cmds(ap) * This is only done when not executing autocommands. */ static void -au_cleanup() +au_cleanup(void) { AutoPat *ap, **prev_ap; AutoCmd *ac, **prev_ac; @@ -8002,6 +8321,15 @@ au_cleanup() /* remove the pattern if it has been marked for deletion */ if (ap->pat == NULL) { + if (ap->next == NULL) + { + if (prev_ap == &(first_autopat[(int)event])) + last_autopat[(int)event] = NULL; + else + /* this depends on the "next" field being the first in + * the struct */ + last_autopat[(int)event] = (AutoPat *)prev_ap; + } *prev_ap = ap->next; vim_regfree(ap->reg_prog); vim_free(ap); @@ -8019,8 +8347,7 @@ au_cleanup() * autocmds. */ void -aubuflocal_remove(buf) - buf_T *buf; +aubuflocal_remove(buf_T *buf) { AutoPat *ap; event_T event; @@ -8056,8 +8383,7 @@ aubuflocal_remove(buf) * Return it's ID. Returns AUGROUP_ERROR (< 0) for error. */ static int -au_new_group(name) - char_u *name; +au_new_group(char_u *name) { int i; @@ -8082,18 +8408,40 @@ au_new_group(name) } static void -au_del_group(name) - char_u *name; +au_del_group(char_u *name) { int i; i = au_find_group(name); if (i == AUGROUP_ERROR) /* the group doesn't exist */ EMSG2(_("E367: No such group: \"%s\""), name); + else if (i == current_augroup) + EMSG(_("E936: Cannot delete the current group")); else { + event_T event; + AutoPat *ap; + int in_use = FALSE; + + for (event = (event_T)0; (int)event < (int)NUM_EVENTS; + event = (event_T)((int)event + 1)) + { + for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) + if (ap->group == i && ap->pat != NULL) + { + give_warning((char_u *)_("W19: Deleting augroup that is still in use"), TRUE); + in_use = TRUE; + event = NUM_EVENTS; + break; + } + } vim_free(AUGROUP_NAME(i)); - AUGROUP_NAME(i) = NULL; + if (in_use) + { + AUGROUP_NAME(i) = get_deleted_augroup(); + } + else + AUGROUP_NAME(i) = NULL; } } @@ -8102,13 +8450,13 @@ au_del_group(name) * Return it's ID. Returns AUGROUP_ERROR (< 0) for error. */ static int -au_find_group(name) - char_u *name; +au_find_group(char_u *name) { int i; for (i = 0; i < augroups.ga_len; ++i) - if (AUGROUP_NAME(i) != NULL && STRCMP(AUGROUP_NAME(i), name) == 0) + if (AUGROUP_NAME(i) != NULL && AUGROUP_NAME(i) != get_deleted_augroup() + && STRCMP(AUGROUP_NAME(i), name) == 0) return i; return AUGROUP_ERROR; } @@ -8117,8 +8465,7 @@ au_find_group(name) * Return TRUE if augroup "name" exists. */ int -au_has_group(name) - char_u *name; +au_has_group(char_u *name) { return au_find_group(name) != AUGROUP_ERROR; } @@ -8127,9 +8474,7 @@ au_has_group(name) * ":augroup {name}". */ void -do_augroup(arg, del_group) - char_u *arg; - int del_group; +do_augroup(char_u *arg, int del_group) { int i; @@ -8166,12 +8511,22 @@ do_augroup(arg, del_group) #if defined(EXITFREE) || defined(PROTO) void -free_all_autocmds() +free_all_autocmds(void) { + int i; + char_u *s; + for (current_augroup = -1; current_augroup < augroups.ga_len; ++current_augroup) do_autocmd((char_u *)"", TRUE); - ga_clear_strings(&augroups); + + for (i = 0; i < augroups.ga_len; ++i) + { + s = ((char_u **)(augroups.ga_data))[i]; + if (s != get_deleted_augroup()) + vim_free(s); + } + ga_clear(&augroups); } #endif @@ -8181,16 +8536,14 @@ free_all_autocmds() * Return a pointer to the next event name in "end". */ static event_T -event_name2nr(start, end) - char_u *start; - char_u **end; +event_name2nr(char_u *start, char_u **end) { char_u *p; int i; int len; - /* the event name ends with end of line, a blank or a comma */ - for (p = start; *p && !vim_iswhite(*p) && *p != ','; ++p) + /* the event name ends with end of line, '|', a blank or a comma */ + for (p = start; *p && !VIM_ISWHITE(*p) && *p != ',' && *p != '|'; ++p) ; for (i = 0; event_names[i].name != NULL; ++i) { @@ -8210,8 +8563,7 @@ event_name2nr(start, end) * Return the name for event "event". */ static char_u * -event_nr2name(event) - event_T event; +event_nr2name(event_T event) { int i; @@ -8225,16 +8577,16 @@ event_nr2name(event) * Scan over the events. "*" stands for all events. */ static char_u * -find_end_event(arg, have_group) - char_u *arg; - int have_group; /* TRUE when group name was found */ +find_end_event( + char_u *arg, + int have_group) /* TRUE when group name was found */ { char_u *pat; char_u *p; if (*arg == '*') { - if (arg[1] && !vim_iswhite(arg[1])) + if (arg[1] && !VIM_ISWHITE(arg[1])) { EMSG2(_("E215: Illegal character after *: %s"), arg); return NULL; @@ -8243,7 +8595,7 @@ find_end_event(arg, have_group) } else { - for (pat = arg; *pat && !vim_iswhite(*pat); pat = p) + for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p) { if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS) { @@ -8262,8 +8614,7 @@ find_end_event(arg, have_group) * Return TRUE if "event" is included in 'eventignore'. */ static int -event_ignored(event) - event_T event; +event_ignored(event_T event) { char_u *p = p_ei; @@ -8282,7 +8633,7 @@ event_ignored(event) * Return OK when the contents of p_ei is valid, FAIL otherwise. */ int -check_ei() +check_ei(void) { char_u *p = p_ei; @@ -8309,8 +8660,7 @@ check_ei() * Returns the old value of 'eventignore' in allocated memory. */ char_u * -au_event_disable(what) - char *what; +au_event_disable(char *what) { char_u *new_ei; char_u *save_ei; @@ -8334,8 +8684,7 @@ au_event_disable(what) } void -au_event_restore(old_ei) - char_u *old_ei; +au_event_restore(char_u *old_ei) { if (old_ei != NULL) { @@ -8379,10 +8728,9 @@ au_event_restore(old_ei) * Mostly a {group} argument can optionally appear before <event>. */ void -do_autocmd(arg, forceit) - char_u *arg; - int forceit; +do_autocmd(char_u *arg_in, int forceit) { + char_u *arg = arg_in; char_u *pat; char_u *envpat = NULL; char_u *cmd; @@ -8391,12 +8739,20 @@ do_autocmd(arg, forceit) int nested = FALSE; int group; - /* - * Check for a legal group name. If not, use AUGROUP_ALL. - */ - group = au_get_grouparg(&arg); - if (arg == NULL) /* out of memory */ - return; + if (*arg == '|') + { + arg = (char_u *)""; + group = AUGROUP_ALL; /* no argument, use all groups */ + } + else + { + /* + * Check for a legal group name. If not, use AUGROUP_ALL. + */ + group = au_get_grouparg(&arg); + if (arg == NULL) /* out of memory */ + return; + } /* * Scan over the events. @@ -8406,53 +8762,61 @@ do_autocmd(arg, forceit) if (pat == NULL) return; - /* - * Scan over the pattern. Put a NUL at the end. - */ pat = skipwhite(pat); - cmd = pat; - while (*cmd && (!vim_iswhite(*cmd) || cmd[-1] == '\\')) - cmd++; - if (*cmd) - *cmd++ = NUL; - - /* Expand environment variables in the pattern. Set 'shellslash', we want - * forward slashes here. */ - if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL) + if (*pat == '|') + { + pat = (char_u *)""; + cmd = (char_u *)""; + } + else { + /* + * Scan over the pattern. Put a NUL at the end. + */ + cmd = pat; + while (*cmd && (!VIM_ISWHITE(*cmd) || cmd[-1] == '\\')) + cmd++; + if (*cmd) + *cmd++ = NUL; + + /* Expand environment variables in the pattern. Set 'shellslash', we want + * forward slashes here. */ + if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL) + { #ifdef BACKSLASH_IN_FILENAME - int p_ssl_save = p_ssl; + int p_ssl_save = p_ssl; - p_ssl = TRUE; + p_ssl = TRUE; #endif - envpat = expand_env_save(pat); + envpat = expand_env_save(pat); #ifdef BACKSLASH_IN_FILENAME - p_ssl = p_ssl_save; + p_ssl = p_ssl_save; #endif - if (envpat != NULL) - pat = envpat; - } + if (envpat != NULL) + pat = envpat; + } - /* - * Check for "nested" flag. - */ - cmd = skipwhite(cmd); - if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && vim_iswhite(cmd[6])) - { - nested = TRUE; - cmd = skipwhite(cmd + 6); - } + /* + * Check for "nested" flag. + */ + cmd = skipwhite(cmd); + if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6])) + { + nested = TRUE; + cmd = skipwhite(cmd + 6); + } - /* - * Find the start of the commands. - * Expand <sfile> in it. - */ - if (*cmd != NUL) - { - cmd = expand_sfile(cmd); - if (cmd == NULL) /* some error */ - return; - need_free = TRUE; + /* + * Find the start of the commands. + * Expand <sfile> in it. + */ + if (*cmd != NUL) + { + cmd = expand_sfile(cmd); + if (cmd == NULL) /* some error */ + return; + need_free = TRUE; + } } /* @@ -8469,7 +8833,7 @@ do_autocmd(arg, forceit) */ last_event = (event_T)-1; /* for listing the event name */ last_group = AUGROUP_ERROR; /* for listing the group name */ - if (*arg == '*' || *arg == NUL) + if (*arg == '*' || *arg == NUL || *arg == '|') { for (event = (event_T)0; (int)event < (int)NUM_EVENTS; event = (event_T)((int)event + 1)) @@ -8479,7 +8843,7 @@ do_autocmd(arg, forceit) } else { - while (*arg && !vim_iswhite(*arg)) + while (*arg && *arg != '|' && !VIM_ISWHITE(*arg)) if (do_autocmd_event(event_name2nr(arg, &arg), pat, nested, cmd, forceit, group) == FAIL) break; @@ -8497,15 +8861,15 @@ do_autocmd(arg, forceit) * Returns the group ID, AUGROUP_ERROR for error (out of memory). */ static int -au_get_grouparg(argp) - char_u **argp; +au_get_grouparg(char_u **argp) { char_u *group_name; char_u *p; char_u *arg = *argp; int group = AUGROUP_ALL; - p = skiptowhite(arg); + for (p = arg; *p && !VIM_ISWHITE(*p) && *p != '|'; ++p) + ; if (p > arg) { group_name = vim_strnsave(arg, (int)(p - arg)); @@ -8529,13 +8893,13 @@ au_get_grouparg(argp) * If group is not AUGROUP_ALL, only use this group. */ static int -do_autocmd_event(event, pat, nested, cmd, forceit, group) - event_T event; - char_u *pat; - int nested; - char_u *cmd; - int forceit; - int group; +do_autocmd_event( + event_T event, + char_u *pat, + int nested, + char_u *cmd, + int forceit, + int group) { AutoPat *ap; AutoPat **prev_ap; @@ -8584,7 +8948,7 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group) */ brace_level = 0; for (endpat = pat; *endpat && (*endpat != ',' || brace_level - || endpat[-1] == '\\'); ++endpat) + || (endpat > pat && endpat[-1] == '\\')); ++endpat) { if (*endpat == '{') brace_level++; @@ -8601,21 +8965,22 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group) is_buflocal = FALSE; buflocal_nr = 0; - if (patlen >= 7 && STRNCMP(pat, "<buffer", 7) == 0 + if (patlen >= 8 && STRNCMP(pat, "<buffer", 7) == 0 && pat[patlen - 1] == '>') { - /* Error will be printed only for addition. printing and removing - * will proceed silently. */ + /* "<buffer...>": Error will be printed only for addition. + * printing and removing will proceed silently. */ is_buflocal = TRUE; if (patlen == 8) + /* "<buffer>" */ buflocal_nr = curbuf->b_fnum; else if (patlen > 9 && pat[7] == '=') { - /* <buffer=abuf> */ - if (patlen == 13 && STRNICMP(pat, "<buffer=abuf>", 13)) + if (patlen == 13 && STRNICMP(pat, "<buffer=abuf>", 13) == 0) + /* "<buffer=abuf>" */ buflocal_nr = autocmd_bufnr; - /* <buffer=123> */ else if (skipdigits(pat + 8) == pat + patlen - 1) + /* "<buffer=123>" */ buflocal_nr = atoi((char *)pat + 8); } } @@ -8629,9 +8994,13 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group) } /* - * Find AutoPat entries with this pattern. + * Find AutoPat entries with this pattern. When adding a command it + * always goes at or after the last one, so start at the end. */ - prev_ap = &first_autopat[(int)event]; + if (!forceit && *cmd != NUL && last_autopat[(int)event] != NULL) + prev_ap = &last_autopat[(int)event]; + else + prev_ap = &first_autopat[(int)event]; while ((ap = *prev_ap) != NULL) { if (ap->pat != NULL) @@ -8737,6 +9106,7 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group) } ap->cmds = NULL; *prev_ap = ap; + last_autopat[(int)event] = ap; ap->next = NULL; if (group == AUGROUP_ALL) ap->group = current_augroup; @@ -8777,14 +9147,18 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group) * Return OK for success, FAIL for failure; */ int -do_doautocmd(arg, do_msg) - char_u *arg; - int do_msg; /* give message for no matching autocmds? */ +do_doautocmd( + char_u *arg, + int do_msg, /* give message for no matching autocmds? */ + int *did_something) { char_u *fname; int nothing_done = TRUE; int group; + if (did_something != NULL) + *did_something = FALSE; + /* * Check for a legal group name. If not, use AUGROUP_ALL. */ @@ -8811,13 +9185,15 @@ do_doautocmd(arg, do_msg) /* * Loop over the events. */ - while (*arg && !vim_iswhite(*arg)) + while (*arg && !ends_excmd(*arg) && !VIM_ISWHITE(*arg)) if (apply_autocmds_group(event_name2nr(arg, &arg), fname, NULL, TRUE, group, curbuf, NULL)) nothing_done = FALSE; if (nothing_done && do_msg) MSG(_("No matching autocommands")); + if (did_something != NULL) + *did_something = !nothing_done; #ifdef FEAT_EVAL return aborting() ? FAIL : OK; @@ -8830,14 +9206,15 @@ do_doautocmd(arg, do_msg) * ":doautoall": execute autocommands for each loaded buffer. */ void -ex_doautoall(eap) - exarg_T *eap; +ex_doautoall(exarg_T *eap) { int retval; aco_save_T aco; buf_T *buf; + bufref_T bufref; char_u *arg = eap->arg; int call_do_modelines = check_nomodeline(&arg); + int did_aucmd; /* * This is a bit tricky: For some commands curwin->w_buffer needs to be @@ -8846,17 +9223,18 @@ ex_doautoall(eap) * gives problems when the autocommands make changes to the list of * buffers or windows... */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL) { /* find a window for this buffer and save some values */ aucmd_prepbuf(&aco, buf); + set_bufref(&bufref, buf); /* execute the autocommands for this buffer */ - retval = do_doautocmd(arg, FALSE); + retval = do_doautocmd(arg, FALSE, &did_aucmd); - if (call_do_modelines) + if (call_do_modelines && did_aucmd) { /* Execute the modeline settings, but don't set window-local * options if we are using the current window for another @@ -8868,7 +9246,7 @@ ex_doautoall(eap) aucmd_restbuf(&aco); /* stop if there is some error or buffer was deleted */ - if (retval == FAIL || !buf_valid(buf)) + if (retval == FAIL || !bufref_valid(&bufref)) break; } } @@ -8882,8 +9260,7 @@ ex_doautoall(eap) * Thus return TRUE when do_modelines() should be called. */ int -check_nomodeline(argp) - char_u **argp; +check_nomodeline(char_u **argp) { if (STRNCMP(*argp, "<nomodeline>", 12) == 0) { @@ -8898,17 +9275,14 @@ check_nomodeline(argp) * Search for a visible window containing the current buffer. If there isn't * one then use "aucmd_win". * Set "curbuf" and "curwin" to match "buf". - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void -aucmd_prepbuf(aco, buf) - aco_save_T *aco; /* structure to save values in */ - buf_T *buf; /* new curbuf */ +aucmd_prepbuf( + aco_save_T *aco, /* structure to save values in */ + buf_T *buf) /* new curbuf */ { win_T *win; -#ifdef FEAT_WINDOWS int save_ea; -#endif #ifdef FEAT_AUTOCHDIR int save_acd; #endif @@ -8917,13 +9291,9 @@ aucmd_prepbuf(aco, buf) if (buf == curbuf) /* be quick when buf is curbuf */ win = curwin; else -#ifdef FEAT_WINDOWS - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) if (win->w_buffer == buf) break; -#else - win = NULL; -#endif /* Allocate "aucmd_win" when needed. If this fails (out of memory) fall * back to using the current window. */ @@ -8957,19 +9327,19 @@ aucmd_prepbuf(aco, buf) aco->use_aucmd_win = TRUE; aucmd_win_used = TRUE; aucmd_win->w_buffer = buf; +#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) aucmd_win->w_s = &buf->b_s; +#endif ++buf->b_nwindows; win_init_empty(aucmd_win); /* set cursor and topline to safe values */ /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in * win_enter_ext(). */ - vim_free(aucmd_win->w_localdir); - aucmd_win->w_localdir = NULL; + VIM_CLEAR(aucmd_win->w_localdir); aco->globaldir = globaldir; globaldir = NULL; -#ifdef FEAT_WINDOWS /* Split the current window, put the aucmd_win in the upper half. * We don't want the BufEnter or WinEnter autocommands. */ block_autocmds(); @@ -8977,44 +9347,39 @@ aucmd_prepbuf(aco, buf) save_ea = p_ea; p_ea = FALSE; -# ifdef FEAT_AUTOCHDIR +#ifdef FEAT_AUTOCHDIR /* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */ save_acd = p_acd; p_acd = FALSE; -# endif +#endif (void)win_split_ins(0, WSP_TOP, aucmd_win, 0); (void)win_comp_pos(); /* recompute window positions */ p_ea = save_ea; -# ifdef FEAT_AUTOCHDIR +#ifdef FEAT_AUTOCHDIR p_acd = save_acd; -# endif - unblock_autocmds(); #endif + unblock_autocmds(); curwin = aucmd_win; } curbuf = buf; aco->new_curwin = curwin; - aco->new_curbuf = curbuf; + set_bufref(&aco->new_curbuf, curbuf); } /* * Cleanup after executing autocommands for a (hidden) buffer. * Restore the window as it was (if possible). - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void -aucmd_restbuf(aco) - aco_save_T *aco; /* structure holding saved values */ +aucmd_restbuf( + aco_save_T *aco) /* structure holding saved values */ { -#ifdef FEAT_WINDOWS int dummy; -#endif if (aco->use_aucmd_win) { --curbuf->b_nwindows; -#ifdef FEAT_WINDOWS /* Find "aucmd_win", it can't be closed, but it may be in another tab * page. Do not trigger autocommands here. */ block_autocmds(); @@ -9041,6 +9406,11 @@ aucmd_restbuf(aco) win_remove(curwin, NULL); aucmd_win_used = FALSE; last_status(FALSE); /* may need to remove last status line */ + + if (!valid_tabpage_win(curtab)) + /* no valid window in current tabpage */ + close_tabpage(curtab); + restore_snapshot(SNAP_AUCMD_IDX, FALSE); (void)win_comp_pos(); /* recompute window positions */ unblock_autocmds(); @@ -9050,12 +9420,9 @@ aucmd_restbuf(aco) else /* Hmm, original window disappeared. Just use the first one. */ curwin = firstwin; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL vars_clear(&aucmd_win->w_vars->dv_hashtab); /* free all w: variables */ hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */ -# endif -#else - curwin = aco->save_curwin; #endif curbuf = curwin->w_buffer; @@ -9081,30 +9448,31 @@ aucmd_restbuf(aco) else { /* restore curwin */ -#ifdef FEAT_WINDOWS if (win_valid(aco->save_curwin)) -#endif { /* Restore the buffer which was previously edited by curwin, if * it was changed, we are still the same window and the buffer is * valid. */ if (curwin == aco->new_curwin - && curbuf != aco->new_curbuf - && buf_valid(aco->new_curbuf) - && aco->new_curbuf->b_ml.ml_mfp != NULL) + && curbuf != aco->new_curbuf.br_buf + && bufref_valid(&aco->new_curbuf) + && aco->new_curbuf.br_buf->b_ml.ml_mfp != NULL) { # if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) if (curwin->w_s == &curbuf->b_s) - curwin->w_s = &aco->new_curbuf->b_s; + curwin->w_s = &aco->new_curbuf.br_buf->b_s; # endif --curbuf->b_nwindows; - curbuf = aco->new_curbuf; + curbuf = aco->new_curbuf.br_buf; curwin->w_buffer = curbuf; ++curbuf->b_nwindows; } curwin = aco->save_curwin; curbuf = curwin->w_buffer; + /* In case the autocommand move the cursor to a position that that + * not exist in curbuf. */ + check_cursor(); } } } @@ -9116,12 +9484,12 @@ static int autocmd_nested = FALSE; * Return TRUE if some commands were executed. */ int -apply_autocmds(event, fname, fname_io, force, buf) - event_T event; - char_u *fname; /* NULL or empty means use actual file name */ - char_u *fname_io; /* fname to use for <afile> on cmdline */ - int force; /* when TRUE, ignore autocmd_busy */ - buf_T *buf; /* buffer for <abuf> */ +apply_autocmds( + event_T event, + char_u *fname, /* NULL or empty means use actual file name */ + char_u *fname_io, /* fname to use for <afile> on cmdline */ + int force, /* when TRUE, ignore autocmd_busy */ + buf_T *buf) /* buffer for <abuf> */ { return apply_autocmds_group(event, fname, fname_io, force, AUGROUP_ALL, buf, NULL); @@ -9132,13 +9500,13 @@ apply_autocmds(event, fname, fname_io, force, buf) * setting v:filearg. */ static int -apply_autocmds_exarg(event, fname, fname_io, force, buf, eap) - event_T event; - char_u *fname; - char_u *fname_io; - int force; - buf_T *buf; - exarg_T *eap; +apply_autocmds_exarg( + event_T event, + char_u *fname, + char_u *fname_io, + int force, + buf_T *buf, + exarg_T *eap) { return apply_autocmds_group(event, fname, fname_io, force, AUGROUP_ALL, buf, eap); @@ -9151,13 +9519,13 @@ apply_autocmds_exarg(event, fname, fname_io, force, buf, eap) * cause the script to be aborted, retval is set to FAIL. */ int -apply_autocmds_retval(event, fname, fname_io, force, buf, retval) - event_T event; - char_u *fname; /* NULL or empty means use actual file name */ - char_u *fname_io; /* fname to use for <afile> on cmdline */ - int force; /* when TRUE, ignore autocmd_busy */ - buf_T *buf; /* buffer for <abuf> */ - int *retval; /* pointer to caller's retval */ +apply_autocmds_retval( + event_T event, + char_u *fname, /* NULL or empty means use actual file name */ + char_u *fname_io, /* fname to use for <afile> on cmdline */ + int force, /* when TRUE, ignore autocmd_busy */ + buf_T *buf, /* buffer for <abuf> */ + int *retval) /* pointer to caller's retval */ { int did_cmd; @@ -9181,7 +9549,7 @@ apply_autocmds_retval(event, fname, fname_io, force, buf, retval) * Return TRUE when there is a CursorHold autocommand defined. */ int -has_cursorhold() +has_cursorhold(void) { return (first_autopat[(int)(get_real_state() == NORMAL_BUSY ? EVENT_CURSORHOLD : EVENT_CURSORHOLDI)] != NULL); @@ -9191,13 +9559,13 @@ has_cursorhold() * Return TRUE if the CursorHold event can be triggered. */ int -trigger_cursorhold() +trigger_cursorhold(void) { int state; if (!did_cursorhold && has_cursorhold() - && !Recording + && reg_recording == 0 && typebuf.tb_len == 0 #ifdef FEAT_INS_EXPAND && !ins_compl_active() @@ -9215,7 +9583,7 @@ trigger_cursorhold() * Return TRUE when there is a CursorMoved autocommand defined. */ int -has_cursormoved() +has_cursormoved(void) { return (first_autopat[(int)EVENT_CURSORMOVED] != NULL); } @@ -9224,7 +9592,7 @@ has_cursormoved() * Return TRUE when there is a CursorMovedI autocommand defined. */ int -has_cursormovedI() +has_cursormovedI(void) { return (first_autopat[(int)EVENT_CURSORMOVEDI] != NULL); } @@ -9233,7 +9601,7 @@ has_cursormovedI() * Return TRUE when there is a TextChanged autocommand defined. */ int -has_textchanged() +has_textchanged(void) { return (first_autopat[(int)EVENT_TEXTCHANGED] != NULL); } @@ -9242,30 +9610,70 @@ has_textchanged() * Return TRUE when there is a TextChangedI autocommand defined. */ int -has_textchangedI() +has_textchangedI(void) { return (first_autopat[(int)EVENT_TEXTCHANGEDI] != NULL); } +/* + * Return TRUE when there is a TextChangedP autocommand defined. + */ + int +has_textchangedP(void) +{ + return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL); +} + /* * Return TRUE when there is an InsertCharPre autocommand defined. */ int -has_insertcharpre() +has_insertcharpre(void) { return (first_autopat[(int)EVENT_INSERTCHARPRE] != NULL); } +/* + * Return TRUE when there is an CmdUndefined autocommand defined. + */ + int +has_cmdundefined(void) +{ + return (first_autopat[(int)EVENT_CMDUNDEFINED] != NULL); +} + +/* + * Return TRUE when there is an FuncUndefined autocommand defined. + */ + int +has_funcundefined(void) +{ + return (first_autopat[(int)EVENT_FUNCUNDEFINED] != NULL); +} + +/* + * Return TRUE when there is a TextYankPost autocommand defined. + */ + int +has_textyankpost(void) +{ + return (first_autopat[(int)EVENT_TEXTYANKPOST] != NULL); +} + +/* + * Execute autocommands for "event" and file name "fname". + * Return TRUE if some commands were executed. + */ static int -apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) - event_T event; - char_u *fname; /* NULL or empty means use actual file name */ - char_u *fname_io; /* fname to use for <afile> on cmdline, NULL means +apply_autocmds_group( + event_T event, + char_u *fname, /* NULL or empty means use actual file name */ + char_u *fname_io, /* fname to use for <afile> on cmdline, NULL means use fname */ - int force; /* when TRUE, ignore autocmd_busy */ - int group; /* group ID, or AUGROUP_ALL */ - buf_T *buf; /* buffer for <abuf> */ - exarg_T *eap; /* command arguments */ + int force, /* when TRUE, ignore autocmd_busy */ + int group, /* group ID, or AUGROUP_ALL */ + buf_T *buf, /* buffer for <abuf> */ + exarg_T *eap UNUSED) /* command arguments */ { char_u *sfname = NULL; /* short file name */ char_u *tail; @@ -9293,12 +9701,16 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) #ifdef FEAT_PROFILE proftime_T wait_time; #endif + int did_save_redobuff = FALSE; + save_redo_T save_redo; + int save_KeyTyped = KeyTyped; /* * Quickly return if there are no autocommands for this event or * autocommands are blocked. */ - if (first_autopat[(int)event] == NULL || autocmd_blocked > 0) + if (event == NUM_EVENTS || first_autopat[(int)event] == NULL + || autocmd_blocked > 0) goto BYPASS_AU; /* @@ -9369,9 +9781,10 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) */ if (fname_io == NULL) { - if (event == EVENT_COLORSCHEME) + if (event == EVENT_COLORSCHEME || event == EVENT_COLORSCHEMEPRE + || event == EVENT_OPTIONSET) autocmd_fname = NULL; - else if (fname != NULL && *fname != NUL) + else if (fname != NULL && !ends_excmd(*fname)) autocmd_fname = fname; else if (buf != NULL) autocmd_fname = buf->b_ffname; @@ -9425,16 +9838,28 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) { sfname = vim_strsave(fname); /* Don't try expanding FileType, Syntax, FuncUndefined, WindowID, - * ColorScheme or QuickFixCmd* */ + * ColorScheme, QuickFixCmd* or DirChanged */ if (event == EVENT_FILETYPE || event == EVENT_SYNTAX + || event == EVENT_CMDLINECHANGED + || event == EVENT_CMDLINEENTER + || event == EVENT_CMDLINELEAVE + || event == EVENT_CMDWINENTER + || event == EVENT_CMDWINLEAVE + || event == EVENT_CMDUNDEFINED || event == EVENT_FUNCUNDEFINED || event == EVENT_REMOTEREPLY || event == EVENT_SPELLFILEMISSING || event == EVENT_QUICKFIXCMDPRE || event == EVENT_COLORSCHEME - || event == EVENT_QUICKFIXCMDPOST) + || event == EVENT_COLORSCHEMEPRE + || event == EVENT_OPTIONSET + || event == EVENT_QUICKFIXCMDPOST + || event == EVENT_DIRCHANGED) + { fname = vim_strsave(fname); + autocmd_fname_full = TRUE; /* don't expand it later */ + } else fname = FullName_save(fname, FALSE); } @@ -9493,7 +9918,13 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) if (!autocmd_busy) { save_search_patterns(); - saveRedobuff(); +#ifdef FEAT_INS_EXPAND + if (!ins_compl_active()) +#endif + { + saveRedobuff(&save_redo); + did_save_redobuff = TRUE; + } did_filetype = keep_filetype; } @@ -9531,7 +9962,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) #ifdef FEAT_EVAL /* set v:cmdarg (only when there is a matching pattern) */ - save_cmdbang = get_vim_var_nr(VV_CMDBANG); + save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG); if (eap != NULL) { save_cmdarg = set_cmdarg(eap, NULL); @@ -9581,6 +10012,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) prof_child_exit(&wait_time); # endif #endif + KeyTyped = save_KeyTyped; vim_free(fname); vim_free(sfname); --nesting; /* see matching increment above */ @@ -9593,7 +10025,8 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) if (!autocmd_busy) { restore_search_patterns(); - restoreRedobuff(); + if (did_save_redobuff) + restoreRedobuff(&save_redo); did_filetype = FALSE; while (au_pending_free_buf != NULL) { @@ -9635,6 +10068,9 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) if (event == EVENT_BUFWIPEOUT && buf != NULL) aubuflocal_remove(buf); + if (retval == OK && event == EVENT_FILETYPE) + au_did_filetype = TRUE; + return retval; } @@ -9647,7 +10083,7 @@ static char_u *old_termresponse = NULL; * Can be used recursively, so long as it's symmetric. */ void -block_autocmds() +block_autocmds(void) { # ifdef FEAT_EVAL /* Remember the value of v:termresponse. */ @@ -9658,7 +10094,7 @@ block_autocmds() } void -unblock_autocmds() +unblock_autocmds(void) { --autocmd_blocked; @@ -9673,7 +10109,7 @@ unblock_autocmds() } int -is_autocmd_blocked() +is_autocmd_blocked(void) { return autocmd_blocked != 0; } @@ -9682,17 +10118,16 @@ is_autocmd_blocked() * Find next autocommand pattern that matches. */ static void -auto_next_pat(apc, stop_at_last) - AutoPatCmd *apc; - int stop_at_last; /* stop when 'last' flag is set */ +auto_next_pat( + AutoPatCmd *apc, + int stop_at_last) /* stop when 'last' flag is set */ { AutoPat *ap; AutoCmd *cp; char_u *name; char *s; - vim_free(sourcing_name); - sourcing_name = NULL; + VIM_CLEAR(sourcing_name); for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next) { @@ -9706,7 +10141,7 @@ auto_next_pat(apc, stop_at_last) { /* execution-condition */ if (ap->buflocal_nr == 0 - ? (match_file_pat(NULL, ap->reg_prog, apc->fname, + ? (match_file_pat(NULL, &ap->reg_prog, apc->fname, apc->sfname, apc->tail, ap->allow_dirs)) : ap->buflocal_nr == apc->arg_bufnr) { @@ -9748,10 +10183,7 @@ auto_next_pat(apc, stop_at_last) * Returns allocated string, or NULL for end of autocommands. */ char_u * -getnextac(c, cookie, indent) - int c UNUSED; - void *cookie; - int indent UNUSED; +getnextac(int c UNUSED, void *cookie, int indent UNUSED) { AutoPatCmd *acp = (AutoPatCmd *)cookie; char_u *retval; @@ -9812,10 +10244,7 @@ getnextac(c, cookie, indent) * in which buffer the file will be opened. */ int -has_autocmd(event, sfname, buf) - event_T event; - char_u *sfname; - buf_T *buf; +has_autocmd(event_T event, char_u *sfname, buf_T *buf) { AutoPat *ap; char_u *fname; @@ -9840,7 +10269,7 @@ has_autocmd(event, sfname, buf) for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) if (ap->pat != NULL && ap->cmds != NULL && (ap->buflocal_nr == 0 - ? match_file_pat(NULL, ap->reg_prog, + ? match_file_pat(NULL, &ap->reg_prog, fname, sfname, tail, ap->allow_dirs) : buf != NULL && ap->buflocal_nr == buf->b_fnum )) @@ -9863,15 +10292,14 @@ has_autocmd(event, sfname, buf) * names. */ char_u * -get_augroup_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_augroup_name(expand_T *xp UNUSED, int idx) { if (idx == augroups.ga_len) /* add "END" add the end */ return (char_u *)"END"; if (idx >= augroups.ga_len) /* end of list */ return NULL; - if (AUGROUP_NAME(idx) == NULL) /* skip deleted entries */ + if (AUGROUP_NAME(idx) == NULL || AUGROUP_NAME(idx) == get_deleted_augroup()) + /* skip deleted entries */ return (char_u *)""; return AUGROUP_NAME(idx); /* return a name */ } @@ -9879,10 +10307,10 @@ get_augroup_name(xp, idx) static int include_groups = FALSE; char_u * -set_context_in_autocmd(xp, arg, doautocmd) - expand_T *xp; - char_u *arg; - int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */ +set_context_in_autocmd( + expand_T *xp, + char_u *arg, + int doautocmd) /* TRUE for :doauto*, FALSE for :autocmd */ { char_u *p; int group; @@ -9894,14 +10322,14 @@ set_context_in_autocmd(xp, arg, doautocmd) if (group == AUGROUP_ERROR) return NULL; /* If there only is a group name that's what we expand. */ - if (*arg == NUL && group != AUGROUP_ALL && !vim_iswhite(arg[-1])) + if (*arg == NUL && group != AUGROUP_ALL && !VIM_ISWHITE(arg[-1])) { arg = p; group = AUGROUP_ALL; } /* skip over event name */ - for (p = arg; *p != NUL && !vim_iswhite(*p); ++p) + for (p = arg; *p != NUL && !VIM_ISWHITE(*p); ++p) if (*p == ',') arg = p + 1; if (*p == NUL) @@ -9915,7 +10343,7 @@ set_context_in_autocmd(xp, arg, doautocmd) /* skip over pattern */ arg = skipwhite(p); - while (*arg && (!vim_iswhite(*arg) || arg[-1] == '\\')) + while (*arg && (!VIM_ISWHITE(*arg) || arg[-1] == '\\')) arg++; if (*arg) return arg; /* expand (next) command */ @@ -9931,13 +10359,12 @@ set_context_in_autocmd(xp, arg, doautocmd) * Function given to ExpandGeneric() to obtain the list of event names. */ char_u * -get_event_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_event_name(expand_T *xp UNUSED, int idx) { if (idx < augroups.ga_len) /* First list group names, if wanted */ { - if (!include_groups || AUGROUP_NAME(idx) == NULL) + if (!include_groups || AUGROUP_NAME(idx) == NULL + || AUGROUP_NAME(idx) == get_deleted_augroup()) return (char_u *)""; /* skip deleted entries */ return AUGROUP_NAME(idx); /* return a name */ } @@ -9950,8 +10377,7 @@ get_event_name(xp, idx) * Return TRUE if autocmd is supported. */ int -autocmd_supported(name) - char_u *name; +autocmd_supported(char_u *name) { char_u *p; @@ -9971,8 +10397,7 @@ autocmd_supported(name) * exists("#Event#pat") */ int -au_exists(arg) - char_u *arg; +au_exists(char_u *arg) { char_u *arg_save; char_u *pattern = NULL; @@ -10057,43 +10482,7 @@ au_exists(arg) return retval; } -#else /* FEAT_AUTOCMD */ - -/* - * Prepare for executing commands for (hidden) buffer "buf". - * This is the non-autocommand version, it simply saves "curbuf" and sets - * "curbuf" and "curwin" to match "buf". - */ - void -aucmd_prepbuf(aco, buf) - aco_save_T *aco; /* structure to save values in */ - buf_T *buf; /* new curbuf */ -{ - aco->save_curbuf = curbuf; - --curbuf->b_nwindows; - curbuf = buf; - curwin->w_buffer = buf; - ++curbuf->b_nwindows; -} - -/* - * Restore after executing commands for a (hidden) buffer. - * This is the non-autocommand version. - */ - void -aucmd_restbuf(aco) - aco_save_T *aco; /* structure holding saved values */ -{ - --curbuf->b_nwindows; - curbuf = aco->save_curbuf; - curwin->w_buffer = curbuf; - ++curbuf->b_nwindows; -} - -#endif /* FEAT_AUTOCMD */ - -#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO) /* * Try matching a filename with a "pattern" ("prog" is NULL), or use the * precompiled regprog "prog" ("pattern" is NULL). That avoids calling @@ -10101,68 +10490,23 @@ aucmd_restbuf(aco) * Used for autocommands and 'wildignore'. * Returns TRUE if there is a match, FALSE otherwise. */ - int -match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) - char_u *pattern; /* pattern to match with */ - regprog_T *prog; /* pre-compiled regprog or NULL */ - char_u *fname; /* full path of file name */ - char_u *sfname; /* short file name or NULL */ - char_u *tail; /* tail of path */ - int allow_dirs; /* allow matching with dir */ + static int +match_file_pat( + char_u *pattern, /* pattern to match with */ + regprog_T **prog, /* pre-compiled regprog or NULL */ + char_u *fname, /* full path of file name */ + char_u *sfname, /* short file name or NULL */ + char_u *tail, /* tail of path */ + int allow_dirs) /* allow matching with dir */ { regmatch_T regmatch; int result = FALSE; -#ifdef FEAT_OSFILETYPE - int no_pattern = FALSE; /* TRUE if check is filetype only */ - char_u *type_start; - char_u c; - int match = FALSE; -#endif regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */ -#ifdef FEAT_OSFILETYPE - if (*pattern == '<') - { - /* There is a filetype condition specified with this pattern. - * Check the filetype matches first. If not, don't bother with the - * pattern (set regprog to NULL). - * Always use magic for the regexp. - */ - - for (type_start = pattern + 1; (c = *pattern); pattern++) - { - if ((c == ';' || c == '>') && match == FALSE) - { - *pattern = NUL; /* Terminate the string */ - /* TODO: match with 'filetype' of buffer that "fname" comes - * from. */ - match = mch_check_filetype(fname, type_start); - *pattern = c; /* Restore the terminator */ - type_start = pattern + 1; - } - if (c == '>') - break; - } - - /* (c should never be NUL, but check anyway) */ - if (match == FALSE || c == NUL) - regmatch.regprog = NULL; /* Doesn't match - don't check pat. */ - else if (*pattern == NUL) - { - regmatch.regprog = NULL; /* Vim will try to free regprog later */ - no_pattern = TRUE; /* Always matches - don't check pat. */ - } - else - regmatch.regprog = vim_regcomp(pattern + 1, RE_MAGIC); - } + if (prog != NULL) + regmatch.regprog = *prog; else -#endif - { - if (prog != NULL) - regmatch.regprog = prog; - else - regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); - } + regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); /* * Try for a match with the pattern with: @@ -10170,26 +10514,20 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) * 2. the short file name, when the pattern has a '/'. * 3. the tail of the file name, when the pattern has no '/'. */ - if ( -#ifdef FEAT_OSFILETYPE - /* If the check is for a filetype only and we don't care - * about the path then skip all the regexp stuff. - */ - no_pattern || -#endif - (regmatch.regprog != NULL + if (regmatch.regprog != NULL && ((allow_dirs && (vim_regexec(®match, fname, (colnr_T)0) || (sfname != NULL && vim_regexec(®match, sfname, (colnr_T)0)))) - || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0))))) + || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0)))) result = TRUE; - if (prog == NULL) + if (prog != NULL) + *prog = regmatch.regprog; + else vim_regfree(regmatch.regprog); return result; } -#endif #if defined(FEAT_WILDIGN) || defined(PROTO) /* @@ -10198,10 +10536,7 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) * "sfname" is the short file name or NULL, "ffname" the long file name. */ int -match_file_list(list, sfname, ffname) - char_u *list; - char_u *sfname; - char_u *ffname; +match_file_list(char_u *list, char_u *sfname, char_u *ffname) { char_u buf[100]; char_u *tail; @@ -10237,66 +10572,28 @@ match_file_list(list, sfname, ffname) * allow_dirs, otherwise FALSE is put there -- webb. * Handle backslashes before special characters, like "\*" and "\ ". * - * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg: - * '<html>myfile' becomes '<html>^myfile$' -- leonard. - * * Returns NULL when out of memory. */ char_u * -file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) - char_u *pat; - char_u *pat_end; /* first char after pattern or NULL */ - char *allow_dirs; /* Result passed back out in here */ - int no_bslash UNUSED; /* Don't use a backward slash as pathsep */ +file_pat_to_reg_pat( + char_u *pat, + char_u *pat_end, /* first char after pattern or NULL */ + char *allow_dirs, /* Result passed back out in here */ + int no_bslash UNUSED) /* Don't use a backward slash as pathsep */ { - int size; + int size = 2; /* '^' at start, '$' at end */ char_u *endp; char_u *reg_pat; char_u *p; int i; int nested = 0; int add_dollar = TRUE; -#ifdef FEAT_OSFILETYPE - int check_length = 0; -#endif if (allow_dirs != NULL) *allow_dirs = FALSE; if (pat_end == NULL) pat_end = pat + STRLEN(pat); -#ifdef FEAT_OSFILETYPE - /* Find out how much of the string is the filetype check */ - if (*pat == '<') - { - /* Count chars until the next '>' */ - for (p = pat + 1; p < pat_end && *p != '>'; p++) - ; - if (p < pat_end) - { - /* Pattern is of the form <.*>.* */ - check_length = p - pat + 1; - if (p + 1 >= pat_end) - { - /* The 'pattern' is a filetype check ONLY */ - reg_pat = (char_u *)alloc(check_length + 1); - if (reg_pat != NULL) - { - mch_memmove(reg_pat, pat, (size_t)check_length); - reg_pat[check_length] = NUL; - } - return reg_pat; - } - } - /* else: there was no closing '>' - assume it was a normal pattern */ - - } - pat += check_length; - size = 2 + check_length; -#else - size = 2; /* '^' at start, '$' at end */ -#endif - for (p = pat; p < pat_end; p++) { switch (*p) @@ -10317,7 +10614,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) #endif default: size++; -# ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) { ++p; @@ -10331,14 +10628,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) if (reg_pat == NULL) return NULL; -#ifdef FEAT_OSFILETYPE - /* Copy the type check in to the start. */ - if (check_length) - mch_memmove(reg_pat, pat - check_length, (size_t)check_length); - i = check_length; -#else i = 0; -#endif if (pat[0] == '*') while (pat[0] == '*' && pat < pat_end - 1) @@ -10346,7 +10636,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) else reg_pat[i++] = '^'; endp = pat_end - 1; - if (*endp == '*') + if (endp >= pat && *endp == '*') { while (endp - pat > 0 && *endp == '*') endp--; @@ -10413,7 +10703,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) reg_pat[i++] = '?'; else if (*p == ',' || *p == '%' || *p == '#' - || *p == ' ' || *p == '{' || *p == '}') + || vim_isspace(*p) || *p == '{' || *p == '}') reg_pat[i++] = *p; else if (*p == '\\' && p[1] == '\\' && p[2] == '{') { @@ -10483,8 +10773,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) EMSG(_("E219: Missing {.")); else EMSG(_("E220: Missing }.")); - vim_free(reg_pat); - reg_pat = NULL; + VIM_CLEAR(reg_pat); } return reg_pat; } @@ -10495,10 +10784,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) * by a SIGWINCH). */ long -read_eintr(fd, buf, bufsize) - int fd; - void *buf; - size_t bufsize; +read_eintr(int fd, void *buf, size_t bufsize) { long ret; @@ -10516,10 +10802,7 @@ read_eintr(fd, buf, bufsize) * by a SIGWINCH). */ long -write_eintr(fd, buf, bufsize) - int fd; - void *buf; - size_t bufsize; +write_eintr(int fd, void *buf, size_t bufsize) { long ret = 0; long wlen; diff --git a/src/fold.c b/src/fold.c index 41fcee0fd6..bc79accb66 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1,4 +1,4 @@ -/* vim:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * vim600:fdm=marker fdl=1 fdc=3: * * VIM - Vi IMproved by Bram Moolenaar @@ -43,27 +43,27 @@ typedef struct #define MAX_LEVEL 20 /* maximum fold depth */ /* static functions {{{2 */ -static void newFoldLevelWin __ARGS((win_T *wp)); -static int checkCloseRec __ARGS((garray_T *gap, linenr_T lnum, int level)); -static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp)); -static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum)); -static void checkupdate __ARGS((win_T *wp)); -static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open)); -static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep)); -static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)); -static void foldOpenNested __ARGS((fold_T *fpr)); -static void deleteFoldEntry __ARGS((garray_T *gap, int idx, int recursive)); -static void foldMarkAdjustRecurse __ARGS((garray_T *gap, linenr_T line1, linenr_T line2, long amount, long amount_after)); -static int getDeepestNestingRecurse __ARGS((garray_T *gap)); -static int check_closed __ARGS((win_T *win, fold_T *fp, int *use_levelp, int level, int *maybe_smallp, linenr_T lnum_off)); -static void checkSmall __ARGS((win_T *wp, fold_T *fp, linenr_T lnum_off)); -static void setSmallMaybe __ARGS((garray_T *gap)); -static void foldCreateMarkers __ARGS((linenr_T start, linenr_T end)); -static void foldAddMarker __ARGS((linenr_T lnum, char_u *marker, int markerlen)); -static void deleteFoldMarkers __ARGS((fold_T *fp, int recursive, linenr_T lnum_off)); -static void foldDelMarker __ARGS((linenr_T lnum, char_u *marker, int markerlen)); -static void foldUpdateIEMS __ARGS((win_T *wp, linenr_T top, linenr_T bot)); -static void parseMarker __ARGS((win_T *wp)); +static void newFoldLevelWin(win_T *wp); +static int checkCloseRec(garray_T *gap, linenr_T lnum, int level); +static int foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp); +static int foldLevelWin(win_T *wp, linenr_T lnum); +static void checkupdate(win_T *wp); +static void setFoldRepeat(linenr_T lnum, long count, int do_open); +static linenr_T setManualFold(linenr_T lnum, int opening, int recurse, int *donep); +static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, int opening, int recurse, int *donep); +static void foldOpenNested(fold_T *fpr); +static void deleteFoldEntry(garray_T *gap, int idx, int recursive); +static void foldMarkAdjustRecurse(garray_T *gap, linenr_T line1, linenr_T line2, long amount, long amount_after); +static int getDeepestNestingRecurse(garray_T *gap); +static int check_closed(win_T *win, fold_T *fp, int *use_levelp, int level, int *maybe_smallp, linenr_T lnum_off); +static void checkSmall(win_T *wp, fold_T *fp, linenr_T lnum_off); +static void setSmallMaybe(garray_T *gap); +static void foldCreateMarkers(linenr_T start, linenr_T end); +static void foldAddMarker(linenr_T lnum, char_u *marker, int markerlen); +static void deleteFoldMarkers(fold_T *fp, int recursive, linenr_T lnum_off); +static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen); +static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot); +static void parseMarker(win_T *wp); static char *e_nofold = N_("E490: No fold found"); @@ -95,28 +95,24 @@ static int foldendmarkerlen; /* Exported folding functions. {{{1 */ /* copyFoldingState() {{{2 */ -#if defined(FEAT_WINDOWS) || defined(PROTO) + /* * Copy that folding state from window "wp_from" to window "wp_to". */ void -copyFoldingState(wp_from, wp_to) - win_T *wp_from; - win_T *wp_to; +copyFoldingState(win_T *wp_from, win_T *wp_to) { wp_to->w_fold_manual = wp_from->w_fold_manual; wp_to->w_foldinvalid = wp_from->w_foldinvalid; cloneFoldGrowArray(&wp_from->w_folds, &wp_to->w_folds); } -#endif /* hasAnyFolding() {{{2 */ /* * Return TRUE if there may be folded lines in the current window. */ int -hasAnyFolding(win) - win_T *win; +hasAnyFolding(win_T *win) { /* very simple now, but can become more complex later */ return (win->w_p_fen @@ -131,23 +127,20 @@ hasAnyFolding(win) * lnum of the sequence of folded lines (skipped when NULL). */ int -hasFolding(lnum, firstp, lastp) - linenr_T lnum; - linenr_T *firstp; - linenr_T *lastp; +hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp) { return hasFoldingWin(curwin, lnum, firstp, lastp, TRUE, NULL); } /* hasFoldingWin() {{{2 */ int -hasFoldingWin(win, lnum, firstp, lastp, cache, infop) - win_T *win; - linenr_T lnum; - linenr_T *firstp; - linenr_T *lastp; - int cache; /* when TRUE: use cached values of window */ - foldinfo_T *infop; /* where to store fold info */ +hasFoldingWin( + win_T *win, + linenr_T lnum, + linenr_T *firstp, + linenr_T *lastp, + int cache, /* when TRUE: use cached values of window */ + foldinfo_T *infop) /* where to store fold info */ { int had_folded = FALSE; linenr_T first = 0; @@ -159,7 +152,7 @@ hasFoldingWin(win, lnum, firstp, lastp, cache, infop) int use_level = FALSE; int maybe_small = FALSE; garray_T *gap; - int low_level = 0;; + int low_level = 0; checkupdate(win); /* @@ -234,6 +227,8 @@ hasFoldingWin(win, lnum, firstp, lastp, cache, infop) return FALSE; } + if (last > win->w_buffer->b_ml.ml_line_count) + last = win->w_buffer->b_ml.ml_line_count; if (lastp != NULL) *lastp = last; if (firstp != NULL) @@ -252,8 +247,7 @@ hasFoldingWin(win, lnum, firstp, lastp, cache, infop) * Return fold level at line number "lnum" in the current window. */ int -foldLevel(lnum) - linenr_T lnum; +foldLevel(linenr_T lnum) { /* While updating the folds lines between invalid_top and invalid_bot have * an undefined fold level. Otherwise update the folds first. */ @@ -279,9 +273,7 @@ foldLevel(lnum) * Return MAYBE if the line is folded when next to a folded line. */ int -lineFolded(win, lnum) - win_T *win; - linenr_T lnum; +lineFolded(win_T *win, linenr_T lnum) { return foldedCount(win, lnum, NULL) != 0; } @@ -296,10 +288,7 @@ lineFolded(win, lnum) * When "infop" is not NULL, fills *infop with the fold level info. */ long -foldedCount(win, lnum, infop) - win_T *win; - linenr_T lnum; - foldinfo_T *infop; +foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop) { linenr_T last; @@ -313,8 +302,7 @@ foldedCount(win, lnum, infop) * Return TRUE if 'foldmethod' is "manual" */ int -foldmethodIsManual(wp) - win_T *wp; +foldmethodIsManual(win_T *wp) { return (wp->w_p_fdm[3] == 'u'); } @@ -324,8 +312,7 @@ foldmethodIsManual(wp) * Return TRUE if 'foldmethod' is "indent" */ int -foldmethodIsIndent(wp) - win_T *wp; +foldmethodIsIndent(win_T *wp) { return (wp->w_p_fdm[0] == 'i'); } @@ -335,8 +322,7 @@ foldmethodIsIndent(wp) * Return TRUE if 'foldmethod' is "expr" */ int -foldmethodIsExpr(wp) - win_T *wp; +foldmethodIsExpr(win_T *wp) { return (wp->w_p_fdm[1] == 'x'); } @@ -346,8 +332,7 @@ foldmethodIsExpr(wp) * Return TRUE if 'foldmethod' is "marker" */ int -foldmethodIsMarker(wp) - win_T *wp; +foldmethodIsMarker(win_T *wp) { return (wp->w_p_fdm[2] == 'r'); } @@ -357,8 +342,7 @@ foldmethodIsMarker(wp) * Return TRUE if 'foldmethod' is "syntax" */ int -foldmethodIsSyntax(wp) - win_T *wp; +foldmethodIsSyntax(win_T *wp) { return (wp->w_p_fdm[0] == 's'); } @@ -368,8 +352,7 @@ foldmethodIsSyntax(wp) * Return TRUE if 'foldmethod' is "diff" */ int -foldmethodIsDiff(wp) - win_T *wp; +foldmethodIsDiff(win_T *wp) { return (wp->w_p_fdm[0] == 'd'); } @@ -380,9 +363,7 @@ foldmethodIsDiff(wp) * Repeat "count" times. */ void -closeFold(lnum, count) - linenr_T lnum; - long count; +closeFold(linenr_T lnum, long count) { setFoldRepeat(lnum, count, FALSE); } @@ -392,8 +373,7 @@ closeFold(lnum, count) * Close fold for current window at line "lnum" recursively. */ void -closeFoldRecurse(lnum) - linenr_T lnum; +closeFoldRecurse(linenr_T lnum) { (void)setManualFold(lnum, FALSE, TRUE, NULL); } @@ -404,12 +384,12 @@ closeFoldRecurse(lnum) * Used for "zo", "zO", "zc" and "zC" in Visual mode. */ void -opFoldRange(first, last, opening, recurse, had_visual) - linenr_T first; - linenr_T last; - int opening; /* TRUE to open, FALSE to close */ - int recurse; /* TRUE to do it recursively */ - int had_visual; /* TRUE when Visual selection used */ +opFoldRange( + linenr_T first, + linenr_T last, + int opening, /* TRUE to open, FALSE to close */ + int recurse, /* TRUE to do it recursively */ + int had_visual) /* TRUE when Visual selection used */ { int done = DONE_NOTHING; /* avoid error messages */ linenr_T lnum; @@ -441,9 +421,7 @@ opFoldRange(first, last, opening, recurse, had_visual) * Repeat "count" times. */ void -openFold(lnum, count) - linenr_T lnum; - long count; +openFold(linenr_T lnum, long count) { setFoldRepeat(lnum, count, TRUE); } @@ -453,8 +431,7 @@ openFold(lnum, count) * Open fold for current window at line "lnum" recursively. */ void -openFoldRecurse(lnum) - linenr_T lnum; +openFoldRecurse(linenr_T lnum) { (void)setManualFold(lnum, TRUE, TRUE, NULL); } @@ -464,7 +441,7 @@ openFoldRecurse(lnum) * Open folds until the cursor line is not in a closed fold. */ void -foldOpenCursor() +foldOpenCursor(void) { int done; @@ -484,7 +461,7 @@ foldOpenCursor() * Set new foldlevel for current window. */ void -newFoldLevel() +newFoldLevel(void) { newFoldLevelWin(curwin); @@ -509,8 +486,7 @@ newFoldLevel() } static void -newFoldLevelWin(wp) - win_T *wp; +newFoldLevelWin(win_T *wp) { fold_T *fp; int i; @@ -534,7 +510,7 @@ newFoldLevelWin(wp) * Apply 'foldlevel' to all folds that don't contain the cursor. */ void -foldCheckClose() +foldCheckClose(void) { if (*p_fcl != NUL) /* can only be "all" right now */ { @@ -547,10 +523,7 @@ foldCheckClose() /* checkCloseRec() {{{2 */ static int -checkCloseRec(gap, lnum, level) - garray_T *gap; - linenr_T lnum; - int level; +checkCloseRec(garray_T *gap, linenr_T lnum, int level) { fold_T *fp; int retval = FALSE; @@ -582,8 +555,7 @@ checkCloseRec(gap, lnum, level) * Give an error message and return FALSE if not. */ int -foldManualAllowed(create) - int create; +foldManualAllowed(int create) { if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) return TRUE; @@ -600,9 +572,7 @@ foldManualAllowed(create) * window. */ void -foldCreate(start, end) - linenr_T start; - linenr_T end; +foldCreate(linenr_T start, linenr_T end) { fold_T *fp; garray_T *gap; @@ -727,11 +697,11 @@ foldCreate(start, end) * When "recursive" is TRUE delete recursively. */ void -deleteFold(start, end, recursive, had_visual) - linenr_T start; - linenr_T end; - int recursive; - int had_visual; /* TRUE when Visual selection used */ +deleteFold( + linenr_T start, + linenr_T end, + int recursive, + int had_visual) /* TRUE when Visual selection used */ { garray_T *gap; fold_T *fp; @@ -822,8 +792,7 @@ deleteFold(start, end, recursive, had_visual) * Remove all folding for window "win". */ void -clearFolding(win) - win_T *win; +clearFolding(win_T *win) { deleteFoldRecurse(&win->w_folds); win->w_foldinvalid = FALSE; @@ -837,16 +806,16 @@ clearFolding(win) * The changes in lines from top to bot (inclusive). */ void -foldUpdate(wp, top, bot) - win_T *wp; - linenr_T top; - linenr_T bot; +foldUpdate(win_T *wp, linenr_T top, linenr_T bot) { fold_T *fp; + if (disable_fold_update > 0) + return; + /* Mark all folds from top to bot as maybe-small. */ - (void)foldFind(&curwin->w_folds, top, &fp); - while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len + (void)foldFind(&wp->w_folds, top, &fp); + while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len && fp->fd_top < bot) { fp->fd_small = MAYBE; @@ -878,8 +847,7 @@ foldUpdate(wp, top, bot) * every time a setting is changed or a syntax item is added. */ void -foldUpdateAll(win) - win_T *win; +foldUpdateAll(win_T *win) { win->w_foldinvalid = TRUE; redraw_win_later(win, NOT_VALID); @@ -892,10 +860,10 @@ foldUpdateAll(win) * If not moved return FAIL. */ int -foldMoveTo(updown, dir, count) - int updown; - int dir; /* FORWARD or BACKWARD */ - long count; +foldMoveTo( + int updown, + int dir, /* FORWARD or BACKWARD */ + long count) { long n; int retval = FAIL; @@ -1029,8 +997,7 @@ foldMoveTo(updown, dir, count) * Init the fold info in a new window. */ void -foldInitWin(new_win) - win_T *new_win; +foldInitWin(win_T *new_win) { ga_init2(&new_win->w_folds, (int)sizeof(fold_T), 10); } @@ -1043,9 +1010,7 @@ foldInitWin(new_win) * Returns index of entry or -1 if not found. */ int -find_wl_entry(win, lnum) - win_T *win; - linenr_T lnum; +find_wl_entry(win_T *win, linenr_T lnum) { int i; @@ -1065,7 +1030,7 @@ find_wl_entry(win, lnum) * Adjust the Visual area to include any fold at the start or end completely. */ void -foldAdjustVisual() +foldAdjustVisual(void) { pos_T *start, *end; char_u *ptr; @@ -1073,7 +1038,7 @@ foldAdjustVisual() if (!VIsual_active || !hasAnyFolding(curwin)) return; - if (ltoreq(VIsual, curwin->w_cursor)) + if (LTOREQ_POS(VIsual, curwin->w_cursor)) { start = &VIsual; end = &curwin->w_cursor; @@ -1104,7 +1069,7 @@ foldAdjustVisual() * Move the cursor to the first line of a closed fold. */ void -foldAdjustCursor() +foldAdjustCursor(void) { (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); } @@ -1117,9 +1082,7 @@ foldAdjustCursor() * Return FAIL if the operation cannot be completed, otherwise OK. */ void -cloneFoldGrowArray(from, to) - garray_T *from; - garray_T *to; +cloneFoldGrowArray(garray_T *from, garray_T *to) { int i; fold_T *from_p; @@ -1153,10 +1116,7 @@ cloneFoldGrowArray(from, to) * Returns FALSE when there is no fold that contains "lnum". */ static int -foldFind(gap, lnum, fpp) - garray_T *gap; - linenr_T lnum; - fold_T **fpp; +foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp) { linenr_T low, high; fold_T *fp; @@ -1195,9 +1155,7 @@ foldFind(gap, lnum, fpp) * Return fold level at line number "lnum" in window "wp". */ static int -foldLevelWin(wp, lnum) - win_T *wp; - linenr_T lnum; +foldLevelWin(win_T *wp, linenr_T lnum) { fold_T *fp; linenr_T lnum_rel = lnum; @@ -1224,8 +1182,7 @@ foldLevelWin(wp, lnum) * Check if the folds in window "wp" are invalid and update them if needed. */ static void -checkupdate(wp) - win_T *wp; +checkupdate(win_T *wp) { if (wp->w_foldinvalid) { @@ -1240,10 +1197,7 @@ checkupdate(wp) * Repeat "count" times. */ static void -setFoldRepeat(lnum, count, do_open) - linenr_T lnum; - long count; - int do_open; +setFoldRepeat(linenr_T lnum, long count, int do_open) { int done; long n; @@ -1268,11 +1222,11 @@ setFoldRepeat(lnum, count, do_open) * Also does this for other windows in diff mode when needed. */ static linenr_T -setManualFold(lnum, opening, recurse, donep) - linenr_T lnum; - int opening; /* TRUE when opening, FALSE when closing */ - int recurse; /* TRUE when closing/opening recursive */ - int *donep; +setManualFold( + linenr_T lnum, + int opening, /* TRUE when opening, FALSE when closing */ + int recurse, /* TRUE when closing/opening recursive */ + int *donep) { #ifdef FEAT_DIFF if (foldmethodIsDiff(curwin) && curwin->w_p_scb) @@ -1310,12 +1264,12 @@ setManualFold(lnum, opening, recurse, donep) * It's only valid when "opening" is TRUE! */ static linenr_T -setManualFoldWin(wp, lnum, opening, recurse, donep) - win_T *wp; - linenr_T lnum; - int opening; /* TRUE when opening, FALSE when closing */ - int recurse; /* TRUE when closing/opening recursive */ - int *donep; +setManualFoldWin( + win_T *wp, + linenr_T lnum, + int opening, /* TRUE when opening, FALSE when closing */ + int recurse, /* TRUE when closing/opening recursive */ + int *donep) { fold_T *fp; fold_T *fp2; @@ -1421,8 +1375,7 @@ setManualFoldWin(wp, lnum, opening, recurse, donep) * Open all nested folds in fold "fpr" recursively. */ static void -foldOpenNested(fpr) - fold_T *fpr; +foldOpenNested(fold_T *fpr) { int i; fold_T *fp; @@ -1442,10 +1395,7 @@ foldOpenNested(fpr) * When "recursive" is FALSE contained folds are moved one level up. */ static void -deleteFoldEntry(gap, idx, recursive) - garray_T *gap; - int idx; - int recursive; +deleteFoldEntry(garray_T *gap, int idx, int recursive) { fold_T *fp; int i; @@ -1499,8 +1449,7 @@ deleteFoldEntry(gap, idx, recursive) * Delete nested folds in a fold. */ void -deleteFoldRecurse(gap) - garray_T *gap; +deleteFoldRecurse(garray_T *gap) { int i; @@ -1514,12 +1463,12 @@ deleteFoldRecurse(gap) * Update line numbers of folds for inserted/deleted lines. */ void -foldMarkAdjust(wp, line1, line2, amount, amount_after) - win_T *wp; - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +foldMarkAdjust( + win_T *wp, + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) { /* If deleting marks from line1 to line2, but not deleting all those * lines, set line2 so that only deleted lines have their folds removed. */ @@ -1534,12 +1483,12 @@ foldMarkAdjust(wp, line1, line2, amount, amount_after) /* foldMarkAdjustRecurse() {{{2 */ static void -foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after) - garray_T *gap; - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +foldMarkAdjustRecurse( + garray_T *gap, + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) { fold_T *fp; int i; @@ -1626,16 +1575,23 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after) { /* 5. fold is below line1 and contains line2; need to * correct nested folds too */ - foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, - line2 - fp->fd_top, amount, - amount_after + (fp->fd_top - top)); if (amount == MAXLNUM) { + foldMarkAdjustRecurse(&fp->fd_nested, + line1 - fp->fd_top, + line2 - fp->fd_top, + amount, + amount_after + (fp->fd_top - top)); fp->fd_len -= line2 - fp->fd_top + 1; fp->fd_top = line1; } else { + foldMarkAdjustRecurse(&fp->fd_nested, + line1 - fp->fd_top, + line2 - fp->fd_top, + amount, + amount_after - amount); fp->fd_len += amount_after - amount; fp->fd_top += amount; } @@ -1651,15 +1607,14 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after) * current window open. */ int -getDeepestNesting() +getDeepestNesting(void) { checkupdate(curwin); return getDeepestNestingRecurse(&curwin->w_folds); } static int -getDeepestNestingRecurse(gap) - garray_T *gap; +getDeepestNestingRecurse(garray_T *gap) { int i; int level; @@ -1682,13 +1637,13 @@ getDeepestNestingRecurse(gap) * Check if a fold is closed and update the info needed to check nested folds. */ static int -check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off) - win_T *win; - fold_T *fp; - int *use_levelp; /* TRUE: outer fold had FD_LEVEL */ - int level; /* folding depth */ - int *maybe_smallp; /* TRUE: outer this had fd_small == MAYBE */ - linenr_T lnum_off; /* line number offset for fp->fd_top */ +check_closed( + win_T *win, + fold_T *fp, + int *use_levelp, /* TRUE: outer fold had FD_LEVEL */ + int level, /* folding depth */ + int *maybe_smallp, /* TRUE: outer this had fd_small == MAYBE */ + linenr_T lnum_off) /* line number offset for fp->fd_top */ { int closed = FALSE; @@ -1722,10 +1677,10 @@ check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off) * Update fd_small field of fold "fp". */ static void -checkSmall(wp, fp, lnum_off) - win_T *wp; - fold_T *fp; - linenr_T lnum_off; /* offset for fp->fd_top */ +checkSmall( + win_T *wp, + fold_T *fp, + linenr_T lnum_off) /* offset for fp->fd_top */ { int count; int n; @@ -1759,8 +1714,7 @@ checkSmall(wp, fp, lnum_off) * Set small flags in "gap" to MAYBE. */ static void -setSmallMaybe(gap) - garray_T *gap; +setSmallMaybe(garray_T *gap) { int i; fold_T *fp; @@ -1776,9 +1730,7 @@ setSmallMaybe(gap) * window by adding markers. */ static void -foldCreateMarkers(start, end) - linenr_T start; - linenr_T end; +foldCreateMarkers(linenr_T start, linenr_T end) { if (!curbuf->b_p_ma) { @@ -1800,16 +1752,14 @@ foldCreateMarkers(start, end) * Add "marker[markerlen]" in 'commentstring' to line "lnum". */ static void -foldAddMarker(lnum, marker, markerlen) - linenr_T lnum; - char_u *marker; - int markerlen; +foldAddMarker(linenr_T lnum, char_u *marker, int markerlen) { char_u *cms = curbuf->b_p_cms; char_u *line; int line_len; char_u *newline; char_u *p = (char_u *)strstr((char *)curbuf->b_p_cms, "%s"); + int line_is_comment = FALSE; /* Allocate a new line: old-line + 'cms'-start + marker + 'cms'-end */ line = ml_get(lnum); @@ -1817,11 +1767,16 @@ foldAddMarker(lnum, marker, markerlen) if (u_save(lnum - 1, lnum + 1) == OK) { +#if defined(FEAT_COMMENTS) + /* Check if the line ends with an unclosed comment */ + (void)skip_comment(line, FALSE, FALSE, &line_is_comment); +#endif newline = alloc((unsigned)(line_len + markerlen + STRLEN(cms) + 1)); if (newline == NULL) return; STRCPY(newline, line); - if (p == NULL) + /* Append the marker to the end of the line */ + if (p == NULL || line_is_comment) vim_strncpy(newline + line_len, marker, markerlen); else { @@ -1839,10 +1794,10 @@ foldAddMarker(lnum, marker, markerlen) * Delete the markers for a fold, causing it to be deleted. */ static void -deleteFoldMarkers(fp, recursive, lnum_off) - fold_T *fp; - int recursive; - linenr_T lnum_off; /* offset for fp->fd_top */ +deleteFoldMarkers( + fold_T *fp, + int recursive, + linenr_T lnum_off) /* offset for fp->fd_top */ { int i; @@ -1863,10 +1818,7 @@ deleteFoldMarkers(fp, recursive, lnum_off) * close-marker. */ static void -foldDelMarker(lnum, marker, markerlen) - linenr_T lnum; - char_u *marker; - int markerlen; +foldDelMarker(linenr_T lnum, char_u *marker, int markerlen) { char_u *line; char_u *newline; @@ -1913,15 +1865,16 @@ foldDelMarker(lnum, marker, markerlen) /* get_foldtext() {{{2 */ /* * Return the text for a closed fold at line "lnum", with last line "lnume". - * When 'foldtext' isn't set puts the result in "buf[51]". Otherwise the - * result is in allocated memory. + * When 'foldtext' isn't set puts the result in "buf[FOLD_TEXT_LEN]". + * Otherwise the result is in allocated memory. */ char_u * -get_foldtext(wp, lnum, lnume, foldinfo, buf) - win_T *wp; - linenr_T lnum, lnume; - foldinfo_T *foldinfo; - char_u *buf; +get_foldtext( + win_T *wp, + linenr_T lnum, + linenr_T lnume, + foldinfo_T *foldinfo, + char_u *buf) { char_u *text = NULL; #ifdef FEAT_EVAL @@ -2019,8 +1972,12 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf) if (text == NULL) #endif { - sprintf((char *)buf, _("+--%3ld lines folded "), - (long)(lnume - lnum + 1)); + long count = (long)(lnume - lnum + 1); + + vim_snprintf((char *)buf, FOLD_TEXT_LEN, + NGETTEXT("+--%3ld line folded ", + "+--%3ld lines folded ", count), + count); text = buf; } return text; @@ -2031,8 +1988,7 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf) * Remove 'foldmarker' and 'commentstring' from "str" (in-place). */ void -foldtext_cleanup(str) - char_u *str; +foldtext_cleanup(char_u *str) { char_u *cms_start; /* first part or the whole comment */ int cms_slen = 0; /* length of cms_start */ @@ -2047,7 +2003,7 @@ foldtext_cleanup(str) /* Ignore leading and trailing white space in 'commentstring'. */ cms_start = skipwhite(curbuf->b_p_cms); cms_slen = (int)STRLEN(cms_start); - while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1])) + while (cms_slen > 0 && VIM_ISWHITE(cms_start[cms_slen - 1])) --cms_slen; /* locate "%s" in 'commentstring', use the part before and after it. */ @@ -2058,7 +2014,7 @@ foldtext_cleanup(str) cms_slen = (int)(cms_end - cms_start); /* exclude white space before "%s" */ - while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1])) + while (cms_slen > 0 && VIM_ISWHITE(cms_start[cms_slen - 1])) --cms_slen; /* skip "%s" and white space after it */ @@ -2082,7 +2038,7 @@ foldtext_cleanup(str) /* May remove 'commentstring' start. Useful when it's a double * quote and we already removed a double quote. */ - for (p = s; p > str && vim_iswhite(p[-1]); --p) + for (p = s; p > str && VIM_ISWHITE(p[-1]); --p) ; if (p >= str + cms_slen && STRNCMP(p - cms_slen, cms_start, cms_slen) == 0) @@ -2107,13 +2063,13 @@ foldtext_cleanup(str) } if (len != 0) { - while (vim_iswhite(s[len])) + while (VIM_ISWHITE(s[len])) ++len; STRMOVE(s, s + len); } else { - mb_ptr_adv(s); + MB_PTR_ADV(s); } } } @@ -2140,18 +2096,18 @@ typedef struct static int fold_changed; /* Function declarations. {{{2 */ -static linenr_T foldUpdateIEMSRecurse __ARGS((garray_T *gap, int level, linenr_T startlnum, fline_T *flp, void (*getlevel)__ARGS((fline_T *)), linenr_T bot, int topflags)); -static int foldInsert __ARGS((garray_T *gap, int i)); -static void foldSplit __ARGS((garray_T *gap, int i, linenr_T top, linenr_T bot)); -static void foldRemove __ARGS((garray_T *gap, linenr_T top, linenr_T bot)); -static void foldMerge __ARGS((fold_T *fp1, garray_T *gap, fold_T *fp2)); -static void foldlevelIndent __ARGS((fline_T *flp)); +static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level, linenr_T startlnum, fline_T *flp, void (*getlevel)(fline_T *), linenr_T bot, int topflags); +static int foldInsert(garray_T *gap, int i); +static void foldSplit(garray_T *gap, int i, linenr_T top, linenr_T bot); +static void foldRemove(garray_T *gap, linenr_T top, linenr_T bot); +static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2); +static void foldlevelIndent(fline_T *flp); #ifdef FEAT_DIFF -static void foldlevelDiff __ARGS((fline_T *flp)); +static void foldlevelDiff(fline_T *flp); #endif -static void foldlevelExpr __ARGS((fline_T *flp)); -static void foldlevelMarker __ARGS((fline_T *flp)); -static void foldlevelSyntax __ARGS((fline_T *flp)); +static void foldlevelExpr(fline_T *flp); +static void foldlevelMarker(fline_T *flp); +static void foldlevelSyntax(fline_T *flp); /* foldUpdateIEMS() {{{2 */ /* @@ -2159,15 +2115,12 @@ static void foldlevelSyntax __ARGS((fline_T *flp)); * Return TRUE if any folds did change. */ static void -foldUpdateIEMS(wp, top, bot) - win_T *wp; - linenr_T top; - linenr_T bot; +foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot) { linenr_T start; linenr_T end; fline_T fline; - void (*getlevel)__ARGS((fline_T *)); + void (*getlevel)(fline_T *); int level; fold_T *fp; @@ -2415,14 +2368,14 @@ foldUpdateIEMS(wp, top, bot) * updated as a result of a detected change in the fold. */ static linenr_T -foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) - garray_T *gap; - int level; - linenr_T startlnum; - fline_T *flp; - void (*getlevel)__ARGS((fline_T *)); - linenr_T bot; - int topflags; /* flags used by containing fold */ +foldUpdateIEMSRecurse( + garray_T *gap, + int level, + linenr_T startlnum, + fline_T *flp, + void (*getlevel)(fline_T *), + linenr_T bot, + int topflags) /* flags used by containing fold */ { linenr_T ll; fold_T *fp = NULL; @@ -2444,7 +2397,7 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) if (getlevel == foldlevelMarker && flp->start <= flp->lvl - level && flp->lvl > 0) { - foldFind(gap, startlnum - 1, &fp); + (void)foldFind(gap, startlnum - 1, &fp); if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len || fp->fd_top >= startlnum) fp = NULL; @@ -2506,7 +2459,7 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) } if (lvl < level + i) { - foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2); + (void)foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2); if (fp2 != NULL) bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top; } @@ -2557,7 +2510,11 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) * before where we started looking, extend it. If it * starts at another line, update nested folds to keep * their position, compensating for the new fd_top. */ - if (fp->fd_top >= startlnum && fp->fd_top != firstlnum) + if (fp->fd_top == firstlnum) + { + /* have found a fold beginning where we want */ + } + else if (fp->fd_top >= startlnum) { if (fp->fd_top > firstlnum) /* like lines are inserted */ @@ -2575,18 +2532,44 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) fp->fd_top = firstlnum; fold_changed = TRUE; } - else if (flp->start != 0 && lvl == level - && fp->fd_top != firstlnum) + else if ((flp->start != 0 && lvl == level) + || firstlnum != startlnum) { - /* Existing fold that includes startlnum must stop - * if we find the start of a new fold at the same - * level. Split it. Delete contained folds at - * this point to split them too. */ - foldRemove(&fp->fd_nested, flp->lnum - fp->fd_top, - flp->lnum - fp->fd_top); + linenr_T breakstart; + linenr_T breakend; + + /* + * Before there was a fold spanning from above + * startlnum to below firstlnum. This fold is valid + * above startlnum (because we are not updating + * that range), but there should now be a break in + * it. + * If the break is because we are now forced to + * start a new fold at the level "level" at line + * fline->lnum, then we need to split the fold at + * fline->lnum. + * If the break is because the range + * [startlnum, firstlnum) is now at a lower indent + * than "level", we need to split the fold in this + * range. + * Any splits have to be done recursively. + */ + if (firstlnum != startlnum) + { + breakstart = startlnum; + breakend = firstlnum; + } + else + { + breakstart = flp->lnum; + breakend = flp->lnum; + } + foldRemove(&fp->fd_nested, breakstart - fp->fd_top, + breakend - fp->fd_top); i = (int)(fp - (fold_T *)gap->ga_data); - foldSplit(gap, i, flp->lnum, flp->lnum - 1); + foldSplit(gap, i, breakstart, breakend - 1); fp = (fold_T *)gap->ga_data + i + 1; + /* If using the "marker" or "syntax" method, we * need to continue until the end of the fold is * found. */ @@ -2595,6 +2578,20 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) || getlevel == foldlevelSyntax) finish = TRUE; } + + if (fp->fd_top == startlnum && concat) + { + i = (int)(fp - (fold_T *)gap->ga_data); + if (i != 0) + { + fp2 = fp - 1; + if (fp2->fd_top + fp2->fd_len == fp->fd_top) + { + foldMerge(fp2, gap, fp); + fp = fp2; + } + } + } break; } if (fp->fd_top >= startlnum) @@ -2757,7 +2754,7 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) /* End of fold found, update the length when it got shorter. */ if (fp->fd_len != flp->lnum - fp->fd_top) { - if (fp->fd_top + fp->fd_len > bot + 1) + if (fp->fd_top + fp->fd_len - 1 > bot) { /* fold continued below bot */ if (getlevel == foldlevelMarker @@ -2829,9 +2826,7 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) * Returns OK for success, FAIL for failure. */ static int -foldInsert(gap, i) - garray_T *gap; - int i; +foldInsert(garray_T *gap, int i) { fold_T *fp; @@ -2854,11 +2849,11 @@ foldInsert(gap, i) * "bot"! */ static void -foldSplit(gap, i, top, bot) - garray_T *gap; - int i; - linenr_T top; - linenr_T bot; +foldSplit( + garray_T *gap, + int i, + linenr_T top, + linenr_T bot) { fold_T *fp; fold_T *fp2; @@ -2918,10 +2913,7 @@ foldSplit(gap, i, top, bot) * 6: not changed */ static void -foldRemove(gap, top, bot) - garray_T *gap; - linenr_T top; - linenr_T bot; +foldRemove(garray_T *gap, linenr_T top, linenr_T bot) { fold_T *fp = NULL; @@ -2935,7 +2927,7 @@ foldRemove(gap, top, bot) { /* 2: or 3: need to delete nested folds */ foldRemove(&fp->fd_nested, top - fp->fd_top, bot - fp->fd_top); - if (fp->fd_top + fp->fd_len > bot + 1) + if (fp->fd_top + fp->fd_len - 1 > bot) { /* 3: need to split it. */ foldSplit(gap, (int)(fp - (fold_T *)gap->ga_data), top, bot); @@ -2975,6 +2967,191 @@ foldRemove(gap, top, bot) } } +/* foldReverseOrder() {{{2 */ + static void +foldReverseOrder(garray_T *gap, linenr_T start_arg, linenr_T end_arg) +{ + fold_T *left, *right; + fold_T tmp; + linenr_T start = start_arg; + linenr_T end = end_arg; + + for (; start < end; start++, end--) + { + left = (fold_T *)gap->ga_data + start; + right = (fold_T *)gap->ga_data + end; + tmp = *left; + *left = *right; + *right = tmp; + } +} + +/* foldMoveRange() {{{2 */ +/* + * Move folds within the inclusive range "line1" to "line2" to after "dest" + * requires "line1" <= "line2" <= "dest" + * + * There are the following situations for the first fold at or below line1 - 1. + * 1 2 3 4 + * 1 2 3 4 + * line1 2 3 4 + * 2 3 4 5 6 7 + * line2 3 4 5 6 7 + * 3 4 6 7 8 9 + * dest 4 7 8 9 + * 4 7 8 10 + * 4 7 8 10 + * + * In the following descriptions, "moved" means moving in the buffer, *and* in + * the fold array. + * Meanwhile, "shifted" just means moving in the buffer. + * 1. not changed + * 2. truncated above line1 + * 3. length reduced by line2 - line1, folds starting between the end of 3 and + * dest are truncated and shifted up + * 4. internal folds moved (from [line1, line2] to dest) + * 5. moved to dest. + * 6. truncated below line2 and moved. + * 7. length reduced by line2 - dest, folds starting between line2 and dest are + * removed, top is moved down by move_len. + * 8. truncated below dest and shifted up. + * 9. shifted up + * 10. not changed + */ + + static void +truncate_fold(fold_T *fp, linenr_T end) +{ + end += 1; + foldRemove(&fp->fd_nested, end - fp->fd_top, MAXLNUM); + fp->fd_len = end - fp->fd_top; +} + +#define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1) +#define valid_fold(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) +#define fold_index(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) + + void +foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest) +{ + fold_T *fp; + linenr_T range_len = line2 - line1 + 1; + linenr_T move_len = dest - line2; + int at_start = foldFind(gap, line1 - 1, &fp); + size_t move_start = 0, move_end = 0, dest_index = 0; + + if (at_start) + { + if (fold_end(fp) > dest) + { + /* Case 4 + * don't have to change this fold, but have to move nested folds. + */ + foldMoveRange(&fp->fd_nested, line1 - fp->fd_top, line2 - + fp->fd_top, dest - fp->fd_top); + return; + } + else if (fold_end(fp) > line2) + { + /* Case 3 + * Remove nested folds between line1 and line2 & reduce the + * length of fold by "range_len". + * Folds after this one must be dealt with. + */ + foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, line2 - + fp->fd_top, MAXLNUM, -range_len); + fp->fd_len -= range_len; + } + else + /* Case 2 truncate fold, folds after this one must be dealt with. */ + truncate_fold(fp, line1 - 1); + + /* Look at the next fold, and treat that one as if it were the first + * after "line1" (because now it is). */ + fp = fp + 1; + } + + if (!valid_fold(fp, gap) || fp->fd_top > dest) + { + /* Case 10 + * No folds after "line1" and before "dest" + */ + return; + } + else if (fp->fd_top > line2) + { + for (; valid_fold(fp, gap) && fold_end(fp) <= dest; fp++) + /* Case 9. (for all case 9's) -- shift up. */ + fp->fd_top -= range_len; + + if (valid_fold(fp, gap) && fp->fd_top <= dest) + { + /* Case 8. -- ensure truncated at dest, shift up */ + truncate_fold(fp, dest); + fp->fd_top -= range_len; + } + return; + } + else if (fold_end(fp) > dest) + { + /* Case 7 -- remove nested folds and shrink */ + foldMarkAdjustRecurse(&fp->fd_nested, line2 + 1 - fp->fd_top, dest - + fp->fd_top, MAXLNUM, -move_len); + fp->fd_len -= move_len; + fp->fd_top += move_len; + return; + } + + /* Case 5 or 6 + * changes rely on whether there are folds between the end of + * this fold and "dest". + */ + move_start = fold_index(fp, gap); + + for (; valid_fold(fp, gap) && fp->fd_top <= dest; fp++) + { + if (fp->fd_top <= line2) + { + /* 1. 2. or 3. */ + if (fold_end(fp) > line2) + /* 2. or 3., truncate before moving */ + truncate_fold(fp, line2); + + fp->fd_top += move_len; + continue; + } + + /* Record index of the first fold after the moved range. */ + if (move_end == 0) + move_end = fold_index(fp, gap); + + if (fold_end(fp) > dest) + truncate_fold(fp, dest); + + fp->fd_top -= range_len; + } + + dest_index = fold_index(fp, gap); + + /* + * All folds are now correct, but not necessarily in the correct order. We + * must swap folds in the range [move_end, dest_index) with those in the + * range [move_start, move_end). + */ + if (move_end == 0) + /* There are no folds after those moved, hence no folds have been moved + * out of order. */ + return; + foldReverseOrder(gap, (linenr_T)move_start, (linenr_T)dest_index - 1); + foldReverseOrder(gap, (linenr_T)move_start, + (linenr_T)(move_start + dest_index - move_end - 1)); + foldReverseOrder(gap, (linenr_T)(move_start + dest_index - move_end), + (linenr_T)(dest_index - 1)); +} +#undef fold_end +#undef valid_fold +#undef fold_index + /* foldMerge() {{{2 */ /* * Merge two adjacent folds (and the nested ones in them). @@ -2984,10 +3161,7 @@ foldRemove(gap, top, bot) * Fold entry "fp2" in "gap" is deleted. */ static void -foldMerge(fp1, gap, fp2) - fold_T *fp1; - garray_T *gap; - fold_T *fp2; +foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2) { fold_T *fp3; fold_T *fp4; @@ -3025,8 +3199,7 @@ foldMerge(fp1, gap, fp2) * Returns a level of -1 if the foldlevel depends on surrounding lines. */ static void -foldlevelIndent(flp) - fline_T *flp; +foldlevelIndent(fline_T *flp) { char_u *s; buf_T *buf; @@ -3062,8 +3235,7 @@ foldlevelIndent(flp) * Doesn't use any caching. */ static void -foldlevelDiff(flp) - fline_T *flp; +foldlevelDiff(fline_T *flp) { if (diff_infold(flp->wp, flp->lnum + flp->off)) flp->lvl = 1; @@ -3079,8 +3251,7 @@ foldlevelDiff(flp) * Returns a level of -1 if the foldlevel depends on surrounding lines. */ static void -foldlevelExpr(flp) - fline_T *flp; +foldlevelExpr(fline_T *flp) { #ifndef FEAT_EVAL flp->start = FALSE; @@ -3106,7 +3277,7 @@ foldlevelExpr(flp) /* KeyTyped may be reset to 0 when calling a function which invokes * do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */ save_keytyped = KeyTyped; - n = eval_foldexpr(flp->wp->w_p_fde, &c); + n = (int)eval_foldexpr(flp->wp->w_p_fde, &c); KeyTyped = save_keytyped; switch (c) @@ -3182,8 +3353,7 @@ foldlevelExpr(flp) * Relies on the option value to have been checked for correctness already. */ static void -parseMarker(wp) - win_T *wp; +parseMarker(win_T *wp) { foldendmarker = vim_strchr(wp->w_p_fmr, ','); foldstartmarkerlen = (int)(foldendmarker++ - wp->w_p_fmr); @@ -3201,8 +3371,7 @@ parseMarker(wp) * Sets flp->start when a start marker was found. */ static void -foldlevelMarker(flp) - fline_T *flp; +foldlevelMarker(fline_T *flp) { char_u *startmarker; int cstart; @@ -3270,7 +3439,7 @@ foldlevelMarker(flp) --flp->lvl_next; } else - mb_ptr_adv(s); + MB_PTR_ADV(s); } /* The level can't go negative, must be missing a start marker. */ @@ -3284,8 +3453,7 @@ foldlevelMarker(flp) * Doesn't use any caching. */ static void -foldlevelSyntax(flp) - fline_T *flp; +foldlevelSyntax(fline_T *flp) { #ifndef FEAT_SYN_HL flp->start = 0; @@ -3312,18 +3480,16 @@ foldlevelSyntax(flp) /* functions for storing the fold state in a View {{{1 */ /* put_folds() {{{2 */ #if defined(FEAT_SESSION) || defined(PROTO) -static int put_folds_recurse __ARGS((FILE *fd, garray_T *gap, linenr_T off)); -static int put_foldopen_recurse __ARGS((FILE *fd, win_T *wp, garray_T *gap, linenr_T off)); -static int put_fold_open_close __ARGS((FILE *fd, fold_T *fp, linenr_T off)); +static int put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off); +static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off); +static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off); /* * Write commands to "fd" to restore the manual folds in window "wp". * Return FAIL if writing fails. */ int -put_folds(fd, wp) - FILE *fd; - win_T *wp; +put_folds(FILE *fd, win_T *wp) { if (foldmethodIsManual(wp)) { @@ -3345,10 +3511,7 @@ put_folds(fd, wp) * Returns FAIL when writing failed. */ static int -put_folds_recurse(fd, gap, off) - FILE *fd; - garray_T *gap; - linenr_T off; +put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off) { int i; fold_T *fp; @@ -3374,11 +3537,11 @@ put_folds_recurse(fd, gap, off) * Returns FAIL when writing failed. */ static int -put_foldopen_recurse(fd, wp, gap, off) - FILE *fd; - win_T *wp; - garray_T *gap; - linenr_T off; +put_foldopen_recurse( + FILE *fd, + win_T *wp, + garray_T *gap, + linenr_T off) { int i; int level; @@ -3431,10 +3594,7 @@ put_foldopen_recurse(fd, wp, gap, off) * Returns FAIL when writing failed. */ static int -put_fold_open_close(fd, fp, off) - FILE *fd; - fold_T *fp; - linenr_T off; +put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off) { if (fprintf(fd, "%ld", fp->fd_top + off) < 0 || put_eol(fd) == FAIL diff --git a/src/getchar.c b/src/getchar.c index dbf273d881..8470c3c064 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -42,10 +42,6 @@ static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0}; static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0}; -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) -static buffheader_T save_redobuff = {{NULL, {NUL}}, NULL, 0, 0}; -static buffheader_T save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0}; -#endif static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0}; static int typeahead_char = 0; /* typeahead char that's not flushed */ @@ -63,7 +59,7 @@ static int block_redo = FALSE; * Returns a value between 0 and 255, index in maphash. * Put Normal/Visual mode mappings mostly separately from Insert/Cmdline mode. */ -#define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + SELECTMODE + OP_PENDING)) ? (c1) : ((c1) ^ 0x80)) +#define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + SELECTMODE + OP_PENDING + TERMINAL)) ? (c1) : ((c1) ^ 0x80)) /* * Each mapping is put in one of the 256 hash lists, to speed up finding it. @@ -79,7 +75,7 @@ static mapblock_T *first_abbr = NULL; /* first entry in abbrlist */ static int KeyNoremap = 0; /* remapping flags */ /* - * variables used by vgetorpeek() and flush_buffers() + * Variables used by vgetorpeek() and flush_buffers(). * * typebuf.tb_buf[] contains all characters that are not consumed yet. * typebuf.tb_buf[typebuf.tb_off] is the first valid character. @@ -112,33 +108,33 @@ static char_u noremapbuf_init[TYPELEN_INIT]; /* initial typebuf.tb_noremap */ static int last_recorded_len = 0; /* number of last recorded chars */ -static char_u *get_buffcont __ARGS((buffheader_T *, int)); -static void add_buff __ARGS((buffheader_T *, char_u *, long n)); -static void add_num_buff __ARGS((buffheader_T *, long)); -static void add_char_buff __ARGS((buffheader_T *, int)); -static int read_readbuffers __ARGS((int advance)); -static int read_readbuf __ARGS((buffheader_T *buf, int advance)); -static void start_stuff __ARGS((void)); -static int read_redo __ARGS((int, int)); -static void copy_redo __ARGS((int)); -static void init_typebuf __ARGS((void)); -static void gotchars __ARGS((char_u *, int)); -static void may_sync_undo __ARGS((void)); -static void closescript __ARGS((void)); -static int vgetorpeek __ARGS((int)); -static void map_free __ARGS((mapblock_T **)); -static void validate_maphash __ARGS((void)); -static void showmap __ARGS((mapblock_T *mp, int local)); +static char_u *get_buffcont(buffheader_T *, int); +static void add_buff(buffheader_T *, char_u *, long n); +static void add_num_buff(buffheader_T *, long); +static void add_char_buff(buffheader_T *, int); +static int read_readbuffers(int advance); +static int read_readbuf(buffheader_T *buf, int advance); +static void start_stuff(void); +static int read_redo(int, int); +static void copy_redo(int); +static void init_typebuf(void); +static void gotchars(char_u *, int); +static void may_sync_undo(void); +static void closescript(void); +static int vgetorpeek(int); +static void map_free(mapblock_T **); +static void validate_maphash(void); +static void showmap(mapblock_T *mp, int local); +static int inchar(char_u *buf, int maxlen, long wait_time); #ifdef FEAT_EVAL -static char_u *eval_map_expr __ARGS((char_u *str, int c)); +static char_u *eval_map_expr(char_u *str, int c); #endif /* * Free and clear a buffer. */ void -free_buff(buf) - buffheader_T *buf; +free_buff(buffheader_T *buf) { buffblock_T *p, *np; @@ -155,9 +151,9 @@ free_buff(buf) * K_SPECIAL and CSI in the returned string are escaped. */ static char_u * -get_buffcont(buffer, dozero) - buffheader_T *buffer; - int dozero; /* count == zero is not an error */ +get_buffcont( + buffheader_T *buffer, + int dozero) /* count == zero is not an error */ { long_u count = 0; char_u *p = NULL; @@ -186,7 +182,7 @@ get_buffcont(buffer, dozero) * K_SPECIAL and CSI in the returned string are escaped. */ char_u * -get_recorded() +get_recorded(void) { char_u *p; size_t len; @@ -220,7 +216,7 @@ get_recorded() * K_SPECIAL and CSI in the returned string are escaped. */ char_u * -get_inserted() +get_inserted(void) { return get_buffcont(&redobuff, FALSE); } @@ -230,10 +226,10 @@ get_inserted() * K_SPECIAL and CSI should have been escaped already. */ static void -add_buff(buf, s, slen) - buffheader_T *buf; - char_u *s; - long slen; /* length of "s" or -1 */ +add_buff( + buffheader_T *buf, + char_u *s, + long slen) /* length of "s" or -1 */ { buffblock_T *p; long_u len; @@ -250,7 +246,7 @@ add_buff(buf, s, slen) } else if (buf->bh_curr == NULL) /* buffer has already been read */ { - EMSG(_("E222: Add to read buffer")); + IEMSG(_("E222: Add to read buffer")); return; } else if (buf->bh_index != 0) @@ -289,9 +285,7 @@ add_buff(buf, s, slen) * Add number "n" to buffer "buf". */ static void -add_num_buff(buf, n) - buffheader_T *buf; - long n; +add_num_buff(buffheader_T *buf, long n) { char_u number[32]; @@ -304,9 +298,7 @@ add_num_buff(buf, n) * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters. */ static void -add_char_buff(buf, c) - buffheader_T *buf; - int c; +add_char_buff(buffheader_T *buf, int c) { #ifdef FEAT_MBYTE char_u bytes[MB_MAXBYTES + 1]; @@ -368,8 +360,7 @@ static buffheader_T readbuf2 = {{NULL, {NUL}}, NULL, 0, 0}; * No translation is done K_SPECIAL and CSI are escaped. */ static int -read_readbuffers(advance) - int advance; +read_readbuffers(int advance) { int c; @@ -380,9 +371,7 @@ read_readbuffers(advance) } static int -read_readbuf(buf, advance) - buffheader_T *buf; - int advance; +read_readbuf(buffheader_T *buf, int advance) { char_u c; buffblock_T *curr; @@ -409,7 +398,7 @@ read_readbuf(buf, advance) * Prepare the read buffers for reading (if they contain something). */ static void -start_stuff() +start_stuff(void) { if (readbuf1.bh_first.b_next != NULL) { @@ -427,7 +416,7 @@ start_stuff() * Return TRUE if the stuff buffer is empty. */ int -stuff_empty() +stuff_empty(void) { return (readbuf1.bh_first.b_next == NULL && readbuf2.bh_first.b_next == NULL); @@ -438,7 +427,7 @@ stuff_empty() * redbuf2. */ int -readbuf1_empty() +readbuf1_empty(void) { return (readbuf1.bh_first.b_next == NULL); } @@ -447,8 +436,7 @@ readbuf1_empty() * Set a typeahead character that won't be flushed. */ void -typeahead_noflush(c) - int c; +typeahead_noflush(int c) { typeahead_char = c; } @@ -459,8 +447,7 @@ typeahead_noflush(c) * flush all typeahead characters (used when interrupted by a CTRL-C). */ void -flush_buffers(flush_typeahead) - int flush_typeahead; +flush_buffers(int flush_typeahead) { init_typebuf(); @@ -475,11 +462,15 @@ flush_buffers(flush_typeahead) * of an escape sequence. * In an xterm we get one char at a time and we have to get them all. */ - while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L, - typebuf.tb_change_cnt) != 0) + while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0) ; typebuf.tb_off = MAXMAPLEN; typebuf.tb_len = 0; +#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) + /* Reset the flag that text received from a client or from feedkeys() + * was inserted in the typeahead buffer. */ + typebuf_was_filled = FALSE; +#endif } else /* remove mapped characters at the start only */ { @@ -497,7 +488,7 @@ flush_buffers(flush_typeahead) * This is used for the CTRL-O <.> command in insert mode. */ void -ResetRedobuff() +ResetRedobuff(void) { if (!block_redo) { @@ -512,7 +503,7 @@ ResetRedobuff() * buffer. */ void -CancelRedo() +CancelRedo(void) { if (!block_redo) { @@ -525,32 +516,26 @@ CancelRedo() } } -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff. * Used before executing autocommands and user functions. */ -static int save_level = 0; - void -saveRedobuff() +saveRedobuff(save_redo_T *save_redo) { char_u *s; - if (save_level++ == 0) - { - save_redobuff = redobuff; - redobuff.bh_first.b_next = NULL; - save_old_redobuff = old_redobuff; - old_redobuff.bh_first.b_next = NULL; + save_redo->sr_redobuff = redobuff; + redobuff.bh_first.b_next = NULL; + save_redo->sr_old_redobuff = old_redobuff; + old_redobuff.bh_first.b_next = NULL; - /* Make a copy, so that ":normal ." in a function works. */ - s = get_buffcont(&save_redobuff, FALSE); - if (s != NULL) - { - add_buff(&redobuff, s, -1L); - vim_free(s); - } + /* Make a copy, so that ":normal ." in a function works. */ + s = get_buffcont(&save_redo->sr_redobuff, FALSE); + if (s != NULL) + { + add_buff(&redobuff, s, -1L); + vim_free(s); } } @@ -559,25 +544,20 @@ saveRedobuff() * Used after executing autocommands and user functions. */ void -restoreRedobuff() +restoreRedobuff(save_redo_T *save_redo) { - if (--save_level == 0) - { - free_buff(&redobuff); - redobuff = save_redobuff; - free_buff(&old_redobuff); - old_redobuff = save_old_redobuff; - } + free_buff(&redobuff); + redobuff = save_redo->sr_redobuff; + free_buff(&old_redobuff); + old_redobuff = save_redo->sr_old_redobuff; } -#endif /* * Append "s" to the redo buffer. * K_SPECIAL and CSI should already have been escaped. */ void -AppendToRedobuff(s) - char_u *s; +AppendToRedobuff(char_u *s) { if (!block_redo) add_buff(&redobuff, s, -1L); @@ -588,9 +568,9 @@ AppendToRedobuff(s) * K_SPECIAL and CSI are escaped as well. */ void -AppendToRedobuffLit(str, len) - char_u *str; - int len; /* length of "str" or -1 for up to the NUL */ +AppendToRedobuffLit( + char_u *str, + int len) /* length of "str" or -1 for up to the NUL */ { char_u *s = str; int c; @@ -649,8 +629,7 @@ AppendToRedobuffLit(str, len) * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters. */ void -AppendCharToRedobuff(c) - int c; +AppendCharToRedobuff(int c) { if (!block_redo) add_char_buff(&redobuff, c); @@ -660,8 +639,7 @@ AppendCharToRedobuff(c) * Append a number to the redo buffer. */ void -AppendNumberToRedobuff(n) - long n; +AppendNumberToRedobuff(long n) { if (!block_redo) add_num_buff(&redobuff, n); @@ -672,16 +650,23 @@ AppendNumberToRedobuff(n) * CSI and K_SPECIAL must already have been escaped. */ void -stuffReadbuff(s) - char_u *s; +stuffReadbuff(char_u *s) { add_buff(&readbuf1, s, -1L); } +/* + * Append string "s" to the redo stuff buffer. + * CSI and K_SPECIAL must already have been escaped. + */ void -stuffReadbuffLen(s, len) - char_u *s; - long len; +stuffRedoReadbuff(char_u *s) +{ + add_buff(&readbuf2, s, -1L); +} + + void +stuffReadbuffLen(char_u *s, long len) { add_buff(&readbuf1, s, len); } @@ -693,8 +678,7 @@ stuffReadbuffLen(s, len) * Change CR, LF and ESC into a space. */ void -stuffReadbuffSpec(s) - char_u *s; +stuffReadbuffSpec(char_u *s) { int c; @@ -726,8 +710,7 @@ stuffReadbuffSpec(s) * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters. */ void -stuffcharReadbuff(c) - int c; +stuffcharReadbuff(int c) { add_char_buff(&readbuf1, c); } @@ -736,8 +719,7 @@ stuffcharReadbuff(c) * Append a number to the stuff buffer. */ void -stuffnumReadbuff(n) - long n; +stuffnumReadbuff(long n) { add_num_buff(&readbuf1, n); } @@ -751,9 +733,7 @@ stuffnumReadbuff(n) * If old is TRUE, use old_redobuff instead of redobuff. */ static int -read_redo(init, old_redo) - int init; - int old_redo; +read_redo(int init, int old_redo) { static buffblock_T *bp; static char_u *p; @@ -826,8 +806,7 @@ read_redo(init, old_redo) * The escaped K_SPECIAL and CSI are copied without translation. */ static void -copy_redo(old_redo) - int old_redo; +copy_redo(int old_redo) { int c; @@ -845,9 +824,7 @@ copy_redo(old_redo) * return FAIL for failure, OK otherwise */ int -start_redo(count, old_redo) - long count; - int old_redo; +start_redo(long count, int old_redo) { int c; @@ -867,6 +844,14 @@ start_redo(count, old_redo) if (c >= '1' && c < '9') ++c; add_char_buff(&readbuf2, c); + + /* the expression register should be re-evaluated */ + if (c == '=') + { + add_char_buff(&readbuf2, CAR); + cmd_silent = TRUE; + } + c = read_redo(FALSE, old_redo); } @@ -900,7 +885,7 @@ start_redo(count, old_redo) * return FAIL for failure, OK otherwise */ int -start_redo_ins() +start_redo_ins(void) { int c; @@ -926,7 +911,7 @@ start_redo_ins() } void -stop_redo_ins() +stop_redo_ins(void) { block_redo = FALSE; } @@ -937,7 +922,7 @@ stop_redo_ins() * be impossible to type anything. */ static void -init_typebuf() +init_typebuf(void) { if (typebuf.tb_buf == NULL) { @@ -945,14 +930,14 @@ init_typebuf() typebuf.tb_noremap = noremapbuf_init; typebuf.tb_buflen = TYPELEN_INIT; typebuf.tb_len = 0; - typebuf.tb_off = 0; + typebuf.tb_off = MAXMAPLEN + 4; typebuf.tb_change_cnt = 1; } } /* - * insert a string in position 'offset' in the typeahead buffer (for "@r" - * and ":normal" command, vgetorpeek() and check_termcode()) + * Insert a string in position 'offset' in the typeahead buffer (for "@r" + * and ":normal" command, vgetorpeek() and check_termcode()). * * If noremap is REMAP_YES, new string can be mapped again. * If noremap is REMAP_NONE, new string cannot be mapped again. @@ -970,12 +955,12 @@ init_typebuf() * return FAIL for failure, OK otherwise */ int -ins_typebuf(str, noremap, offset, nottyped, silent) - char_u *str; - int noremap; - int offset; - int nottyped; - int silent; +ins_typebuf( + char_u *str, + int noremap, + int offset, + int nottyped, + int silent) { char_u *s1, *s2; int newlen; @@ -991,23 +976,32 @@ ins_typebuf(str, noremap, offset, nottyped, silent) addlen = (int)STRLEN(str); - /* - * Easy case: there is room in front of typebuf.tb_buf[typebuf.tb_off] - */ if (offset == 0 && addlen <= typebuf.tb_off) { + /* + * Easy case: there is room in front of typebuf.tb_buf[typebuf.tb_off] + */ typebuf.tb_off -= addlen; mch_memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen); } - - /* - * Need to allocate a new buffer. - * In typebuf.tb_buf there must always be room for 3 * MAXMAPLEN + 4 - * characters. We add some extra room to avoid having to allocate too - * often. - */ + else if (typebuf.tb_len == 0 && typebuf.tb_buflen + >= addlen + 3 * (MAXMAPLEN + 4)) + { + /* + * Buffer is empty and string fits in the existing buffer. + * Leave some space before and after, if possible. + */ + typebuf.tb_off = (typebuf.tb_buflen - addlen - 3 * (MAXMAPLEN + 4)) / 2; + mch_memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen); + } else { + /* + * Need to allocate a new buffer. + * In typebuf.tb_buf there must always be room for 3 * (MAXMAPLEN + 4) + * characters. We add some extra room to avoid having to allocate too + * often. + */ newoff = MAXMAPLEN + 4; newlen = typebuf.tb_len + addlen + newoff + 4 * (MAXMAPLEN + 4); if (newlen < 0) /* string is getting too long */ @@ -1103,8 +1097,7 @@ ins_typebuf(str, noremap, offset, nottyped, silent) * the char. */ void -ins_char_typebuf(c) - int c; +ins_char_typebuf(int c) { #ifdef FEAT_MBYTE char_u buf[MB_MAXBYTES + 1]; @@ -1140,8 +1133,8 @@ ins_char_typebuf(c) * that was just added. */ int -typebuf_changed(tb_change_cnt) - int tb_change_cnt; /* old value of typebuf.tb_change_cnt */ +typebuf_changed( + int tb_change_cnt) /* old value of typebuf.tb_change_cnt */ { return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) @@ -1155,7 +1148,7 @@ typebuf_changed(tb_change_cnt) * not been typed (result from a mapping or come from ":normal"). */ int -typebuf_typed() +typebuf_typed(void) { return typebuf.tb_maplen == 0; } @@ -1164,7 +1157,7 @@ typebuf_typed() * Return the number of characters that are mapped (or not typed). */ int -typebuf_maplen() +typebuf_maplen(void) { return typebuf.tb_maplen; } @@ -1173,9 +1166,7 @@ typebuf_maplen() * remove "len" characters from typebuf.tb_buf[typebuf.tb_off + offset] */ void -del_typebuf(len, offset) - int len; - int offset; +del_typebuf(int len, int offset) { int i; @@ -1253,9 +1244,7 @@ del_typebuf(len, offset) * If recording is on put the character in the recordbuffer. */ static void -gotchars(chars, len) - char_u *chars; - int len; +gotchars(char_u *chars, int len) { char_u *s = chars; int c; @@ -1263,7 +1252,7 @@ gotchars(chars, len) int todo = len; /* remember how many chars were last recorded */ - if (Recording) + if (reg_recording != 0) last_recorded_len += len; buf[1] = NUL; @@ -1273,7 +1262,7 @@ gotchars(chars, len) c = *s++; updatescript(c); - if (Recording) + if (reg_recording != 0) { buf[0] = c; add_buff(&recordbuff, buf, 1L); @@ -1300,7 +1289,7 @@ gotchars(chars, len) * - When no_u_sync is non-zero. */ static void -may_sync_undo() +may_sync_undo(void) { if ((!(State & (INSERT + CMDLINE)) || arrow_used) && scriptin[curscript] == NULL) @@ -1312,7 +1301,7 @@ may_sync_undo() * Returns FAIL when out of memory. */ int -alloc_typebuf() +alloc_typebuf(void) { typebuf.tb_buf = alloc(TYPELEN_INIT); typebuf.tb_noremap = alloc(TYPELEN_INIT); @@ -1322,7 +1311,7 @@ alloc_typebuf() return FAIL; } typebuf.tb_buflen = TYPELEN_INIT; - typebuf.tb_off = 0; + typebuf.tb_off = MAXMAPLEN + 4; /* can insert without realloc */ typebuf.tb_len = 0; typebuf.tb_maplen = 0; typebuf.tb_silent = 0; @@ -1336,14 +1325,14 @@ alloc_typebuf() * Free the buffers of "typebuf". */ void -free_typebuf() +free_typebuf(void) { if (typebuf.tb_buf == typebuf_init) - EMSG2(_(e_intern2), "Free typebuf 1"); + internal_error("Free typebuf 1"); else vim_free(typebuf.tb_buf); if (typebuf.tb_noremap == noremapbuf_init) - EMSG2(_(e_intern2), "Free typebuf 2"); + internal_error("Free typebuf 2"); else vim_free(typebuf.tb_noremap); } @@ -1355,7 +1344,7 @@ free_typebuf() static typebuf_T saved_typebuf[NSCRIPT]; int -save_typebuf() +save_typebuf(void) { init_typebuf(); saved_typebuf[curscript] = typebuf; @@ -1375,14 +1364,11 @@ static int old_mouse_row; /* mouse_row related to old_char */ static int old_mouse_col; /* mouse_col related to old_char */ #endif -#if defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) || defined(PROTO) - /* * Save all three kinds of typeahead, so that the user must type at a prompt. */ void -save_typeahead(tp) - tasave_T *tp; +save_typeahead(tasave_T *tp) { tp->save_typebuf = typebuf; tp->typebuf_valid = (alloc_typebuf() == OK); @@ -1407,8 +1393,7 @@ save_typeahead(tp) * The allocated memory is freed, can only be called once! */ void -restore_typeahead(tp) - tasave_T *tp; +restore_typeahead(tasave_T *tp) { if (tp->typebuf_valid) { @@ -1427,15 +1412,14 @@ restore_typeahead(tp) set_input_buf(tp->save_inputbuf); # endif } -#endif /* * Open a new script file for the ":source!" command. */ void -openscript(name, directly) - char_u *name; - int directly; /* when TRUE execute directly */ +openscript( + char_u *name, + int directly) /* when TRUE execute directly */ { if (curscript + 1 == NSCRIPT) { @@ -1506,7 +1490,7 @@ openscript(name, directly) * Close the currently active input script. */ static void -closescript() +closescript(void) { free_typebuf(); typebuf = saved_typebuf[curscript]; @@ -1519,7 +1503,7 @@ closescript() #if defined(EXITFREE) || defined(PROTO) void -close_all_scripts() +close_all_scripts(void) { while (scriptin[0] != NULL) closescript(); @@ -1531,7 +1515,7 @@ close_all_scripts() * Return TRUE when reading keys from a script file. */ int -using_script() +using_script(void) { return scriptin[curscript] != NULL; } @@ -1542,12 +1526,12 @@ using_script() * waiting 'updatetime' for a character to arrive. */ void -before_blocking() +before_blocking(void) { updatescript(0); #ifdef FEAT_EVAL if (may_garbage_collect) - garbage_collect(); + garbage_collect(FALSE); #endif } @@ -1559,8 +1543,7 @@ before_blocking() * characters reaches 'updatecount' and 'updatecount' is non-zero. */ void -updatescript(c) - int c; +updatescript(int c) { static int count = 0; @@ -1583,7 +1566,7 @@ updatescript(c) * Returns the modifiers in the global "mod_mask". */ int -vgetc() +vgetc(void) { int c, c2; #ifdef FEAT_MBYTE @@ -1596,7 +1579,7 @@ vgetc() /* Do garbage collection when garbagecollect() was called previously and * we are now at the toplevel. */ if (may_garbage_collect && want_garbage_collect) - garbage_collect(); + garbage_collect(FALSE); #endif /* @@ -1619,13 +1602,21 @@ vgetc() last_recorded_len = 0; for (;;) /* this is done twice if there are modifiers */ { - if (mod_mask) /* no mapping after modifier has been read */ + int did_inc = FALSE; + + if (mod_mask +#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) + || im_is_preediting() +#endif + ) { + /* no mapping after modifier has been read */ ++no_mapping; ++allow_keys; + did_inc = TRUE; /* mod_mask may change value */ } c = vgetorpeek(TRUE); - if (mod_mask) + if (did_inc) { --no_mapping; --allow_keys; @@ -1699,15 +1690,6 @@ vgetc() c = CSI; #endif } -#ifdef MSDOS - /* - * If K_NUL was typed, it is replaced by K_NUL, 3 in mch_inchar(). - * Delete the 3 here. - */ - else if (c == K_NUL && vpeekc() == 3) - (void)vgetorpeek(TRUE); -#endif - /* a keypad or special function key was not mapped, use it like * its ASCII equivalent */ switch (c) @@ -1816,6 +1798,14 @@ vgetc() */ may_garbage_collect = FALSE; #endif +#ifdef FEAT_BEVAL_TERM + if (c != K_MOUSEMOVE && c != K_IGNORE) + { + /* Don't trigger 'balloonexpr' unless only the mouse was moved. */ + bevalexpr_due_set = FALSE; + ui_remove_balloon(); + } +#endif return c; } @@ -1825,7 +1815,7 @@ vgetc() * directly from the user (ignoring typeahead). */ int -safe_vgetc() +safe_vgetc(void) { int c; @@ -1840,7 +1830,7 @@ safe_vgetc() * Also ignore scrollbar events. */ int -plain_vgetc() +plain_vgetc(void) { int c; @@ -1848,6 +1838,12 @@ plain_vgetc() { c = safe_vgetc(); } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); + + if (c == K_PS) + /* Only handle the first pasted character. Drop the rest, since we + * don't know what to do with it. */ + c = bracketed_paste(PASTE_ONE_CHAR, FALSE, NULL); + return c; } @@ -1857,20 +1853,20 @@ plain_vgetc() * character is not valid!. */ int -vpeekc() +vpeekc(void) { if (old_char != -1) return old_char; return vgetorpeek(FALSE); } -#if defined(FEAT_TERMRESPONSE) || defined(PROTO) +#if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO) /* * Like vpeekc(), but don't allow mapping. Do allow checking for terminal * codes. */ int -vpeekc_nomap() +vpeekc_nomap(void) { int c; @@ -1890,7 +1886,7 @@ vpeekc_nomap() * buffer, it must be an ESC that is recognized as the start of a key code. */ int -vpeekc_any() +vpeekc_any(void) { int c; @@ -1906,19 +1902,27 @@ vpeekc_any() * Return TRUE if a character is available, FALSE otherwise. */ int -char_avail() +char_avail(void) { int retval; +#ifdef FEAT_EVAL + /* When test_override("char_avail", 1) was called pretend there is no + * typeahead. */ + if (disable_char_avail_for_testing) + return FALSE; +#endif ++no_mapping; retval = vpeekc(); --no_mapping; return (retval != NUL); } +/* + * unget one character (can only be done once!) + */ void -vungetc(c) /* unget one character (can only be done once!) */ - int c; +vungetc(int c) { old_char = c; old_mod_mask = mod_mask; @@ -1929,7 +1933,7 @@ vungetc(c) /* unget one character (can only be done once!) */ } /* - * get a character: + * Get a character: * 1. from the stuffbuffer * This is used for abbreviated commands like "D" -> "d$". * Also used to redo a command for ".". @@ -1941,7 +1945,7 @@ vungetc(c) /* unget one character (can only be done once!) */ * This may do a blocking wait if "advance" is TRUE. * * if "advance" is TRUE (vgetc()): - * really get the character. + * Really get the character. * KeyTyped is set to TRUE in the case the user typed the key. * KeyStuffed is TRUE if the character comes from the stuff buffer. * if "advance" is FALSE (vpeekc()): @@ -1952,8 +1956,7 @@ vungetc(c) /* unget one character (can only be done once!) */ * K_SPECIAL and CSI may be escaped, need to get two more bytes then. */ static int -vgetorpeek(advance) - int advance; +vgetorpeek(int advance) { int c, c1; int keylen; @@ -1999,11 +2002,7 @@ vgetorpeek(advance) * Using ":normal" can also do this, but it saves the typeahead buffer, * thus it should be OK. But don't get a key from the user then. */ - if (vgetc_busy > 0 -#ifdef FEAT_EX_EXTRA - && ex_normal_busy == 0 -#endif - ) + if (vgetc_busy > 0 && ex_normal_busy == 0) return NUL; local_State = get_real_state(); @@ -2016,7 +2015,7 @@ vgetorpeek(advance) init_typebuf(); start_stuff(); if (advance && typebuf.tb_maplen == 0) - Exec_reg = FALSE; + reg_executing = 0; do { /* @@ -2036,7 +2035,7 @@ vgetorpeek(advance) { /* KeyTyped = FALSE; When the command that stuffed something * was typed, behave like the stuffed command was typed. - * needed for CTRL-W CTRl-] to open a fold, for example. */ + * needed for CTRL-W CTRL-] to open a fold, for example. */ KeyStuffed = TRUE; } if (typebuf.tb_no_abbr_cnt == 0) @@ -2065,11 +2064,10 @@ vgetorpeek(advance) if (got_int) { /* flush all input */ - c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L, - typebuf.tb_change_cnt); + c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L); /* * If inchar() returns TRUE (script file was active) or we - * are inside a mapping, get out of insert mode. + * are inside a mapping, get out of Insert mode. * Otherwise we behave like having gotten a CTRL-C. * As a result typing CTRL-C in insert mode will * really insert a CTRL-C. @@ -2123,7 +2121,8 @@ vgetorpeek(advance) && State != ASKMORE && State != CONFIRM #ifdef FEAT_INS_EXPAND - && !((ctrl_x_mode != 0 && vim_is_ctrl_x_key(c1)) + && !((ctrl_x_mode_not_default() + && vim_is_ctrl_x_key(c1)) || ((compl_cont_status & CONT_LOCAL) && (c1 == Ctrl_N || c1 == Ctrl_P))) #endif @@ -2134,7 +2133,9 @@ vgetorpeek(advance) nolmaplen = 2; else { - LANGMAP_ADJUST(c1, TRUE); + LANGMAP_ADJUST(c1, + (State & (CMDLINE | INSERT)) == 0 + && get_real_state() != SELECTMODE); nolmaplen = 0; } #endif @@ -2304,10 +2305,8 @@ vgetorpeek(advance) msg_row = Rows - 1; msg_clr_eos(); /* clear ruler */ } -#ifdef FEAT_WINDOWS status_redraw_all(); redraw_statuslines(); -#endif showmode(); setcursor(); continue; @@ -2605,7 +2604,7 @@ vgetorpeek(advance) * get a character: 3. from the user - handle <Esc> in Insert mode */ /* - * special case: if we get an <ESC> in insert mode and there + * Special case: if we get an <ESC> in insert mode and there * are no more characters at once, we pretend to go out of * insert mode. This prevents the one second delay after * typing an <ESC>. If we get something after all, we may @@ -2621,16 +2620,13 @@ vgetorpeek(advance) && typebuf.tb_len == 1 && typebuf.tb_buf[typebuf.tb_off] == ESC && !no_mapping -#ifdef FEAT_EX_EXTRA && ex_normal_busy == 0 -#endif && typebuf.tb_maplen == 0 && (State & INSERT) && (p_timeout || (keylen == KEYLEN_PART_KEY && p_ttimeout)) && (c = inchar(typebuf.tb_buf + typebuf.tb_off - + typebuf.tb_len, 3, 25L, - typebuf.tb_change_cnt)) == 0) + + typebuf.tb_len, 3, 25L)) == 0) { colnr_T col = 0, vcol; char_u *ptr; @@ -2641,8 +2637,8 @@ vgetorpeek(advance) mode_deleted = TRUE; } #ifdef FEAT_GUI - /* may show different cursor shape */ - if (gui.in_use) + /* may show a different cursor shape */ + if (gui.in_use && State != NORMAL && !cmd_silent) { int save_State; @@ -2673,7 +2669,7 @@ vgetorpeek(advance) ptr = ml_get_curline(); while (col < curwin->w_cursor.col) { - if (!vim_iswhite(ptr[col])) + if (!VIM_ISWHITE(ptr[col])) curwin->w_wcol = vcol; vcol += lbr_chartabsize(ptr, ptr + col, (colnr_T)vcol); @@ -2685,8 +2681,8 @@ vgetorpeek(advance) ++col; } curwin->w_wrow = curwin->w_cline_row - + curwin->w_wcol / W_WIDTH(curwin); - curwin->w_wcol %= W_WIDTH(curwin); + + curwin->w_wcol / curwin->w_width; + curwin->w_wcol %= curwin->w_width; curwin->w_wcol += curwin_col_off(); #ifdef FEAT_MBYTE col = 0; /* no correction needed */ @@ -2703,7 +2699,7 @@ vgetorpeek(advance) else if (curwin->w_p_wrap && curwin->w_wrow) { --curwin->w_wrow; - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; #ifdef FEAT_MBYTE col = curwin->w_cursor.col - 1; #endif @@ -2745,12 +2741,11 @@ vgetorpeek(advance) continue; } -#ifdef FEAT_EX_EXTRA if (ex_normal_busy > 0) { -# ifdef FEAT_CMDWIN +#ifdef FEAT_CMDWIN static int tc = 0; -# endif +#endif /* No typeahead left and inside ":normal". Must return * something to avoid getting stuck. When an incomplete @@ -2768,20 +2763,23 @@ vgetorpeek(advance) * cmdline window. */ if (p_im && (State & INSERT)) c = Ctrl_L; +#ifdef FEAT_TERMINAL + else if (terminal_is_active()) + c = K_CANCEL; +#endif else if ((State & CMDLINE) -# ifdef FEAT_CMDWIN +#ifdef FEAT_CMDWIN || (cmdwin_type > 0 && tc == ESC) -# endif +#endif ) c = Ctrl_C; else c = ESC; -# ifdef FEAT_CMDWIN +#ifdef FEAT_CMDWIN tc = c; -# endif +#endif break; } -#endif /* * get a character: 3. from the user - update display @@ -2858,6 +2856,11 @@ vgetorpeek(advance) /* * get a character: 3. from the user - get it */ + if (typebuf.tb_len == 0) + // timedout may have been set while waiting for a mapping + // that has a <Nop> RHS. + timedout = FALSE; + wait_tb_len = typebuf.tb_len; c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1, @@ -2869,7 +2872,7 @@ vgetorpeek(advance) ? -1L : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0) ? p_ttm - : p_tm)), typebuf.tb_change_cnt); + : p_tm))); #ifdef FEAT_CMDL_INFO if (i != 0) @@ -2903,7 +2906,7 @@ vgetorpeek(advance) + typebuf.tb_len] != NUL) typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD /* Get IM status right after getting keys, not after the * timeout for a mapping (focus may be lost by then). */ vgetc_im_active = im_get_status(); @@ -2912,8 +2915,8 @@ vgetorpeek(advance) } /* for (;;) */ } /* if (!character from stuffbuf) */ - /* if advance is FALSE don't loop on NULs */ - } while (c < 0 || (advance && c == NUL)); + /* if advance is FALSE don't loop on NULs */ + } while ((c < 0 && c != K_CANCEL) || (advance && c == NUL)); /* * The "INSERT" message is taken care of here: @@ -2971,30 +2974,24 @@ vgetorpeek(advance) * Return the number of obtained characters. * Return -1 when end of input script reached. */ - int -inchar(buf, maxlen, wait_time, tb_change_cnt) - char_u *buf; - int maxlen; - long wait_time; /* milli seconds */ - int tb_change_cnt; + static int +inchar( + char_u *buf, + int maxlen, + long wait_time) /* milli seconds */ { int len = 0; /* init for GCC */ int retesc = FALSE; /* return ESC with gotint */ int script_char; + int tb_change_cnt = typebuf.tb_change_cnt; if (wait_time == -1L || wait_time > 100L) /* flush output before waiting */ { cursor_on(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(FALSE, FALSE); -# ifdef FEAT_MOUSESHAPE - if (postponed_mouseshape) - update_mouseshape(-1); -# endif - } + out_flush_cursor(FALSE, FALSE); +#if defined(FEAT_GUI) && defined(FEAT_MOUSESHAPE) + if (gui.in_use && postponed_mouseshape) + update_mouseshape(-1); #endif } @@ -3022,9 +3019,8 @@ inchar(buf, maxlen, wait_time, tb_change_cnt) ) { -#if defined(FEAT_NETBEANS_INTG) - /* Process the queued netbeans messages. */ - netbeans_parse_messages(); +#ifdef MESSAGE_QUEUE + parse_queued_messages(); #endif if (got_int || (script_char = getc(scriptin[curscript])) < 0) @@ -3087,10 +3083,18 @@ inchar(buf, maxlen, wait_time, tb_change_cnt) len = ui_inchar(buf, maxlen / 3, wait_time, tb_change_cnt); } + /* If the typebuf was changed further down, it is like nothing was added by + * this call. */ if (typebuf_changed(tb_change_cnt)) return 0; - return fix_input_buffer(buf, len, script_char >= 0); + /* Note the change in the typeahead buffer, this matters for when + * vgetorpeek() is called recursively, e.g. using getchar(1) in a timer + * function. */ + if (len > 0 && ++typebuf.tb_change_cnt == 0) + typebuf.tb_change_cnt = 1; + + return fix_input_buffer(buf, len); } /* @@ -3099,10 +3103,7 @@ inchar(buf, maxlen, wait_time, tb_change_cnt) * Returns the new length. */ int -fix_input_buffer(buf, len, script) - char_u *buf; - int len; - int script; /* TRUE when reading from a script */ +fix_input_buffer(char_u *buf, int len) { int i; char_u *p = buf; @@ -3113,7 +3114,6 @@ fix_input_buffer(buf, len, script) * Replace NUL by K_SPECIAL KS_ZERO KE_FILLER * Replace K_SPECIAL by K_SPECIAL KS_SPECIAL KE_FILLER * Replace CSI by K_SPECIAL KS_EXTRA KE_CSI - * Don't replace K_SPECIAL when reading a script file. */ for (i = len; --i >= 0; ++p) { @@ -3136,11 +3136,9 @@ fix_input_buffer(buf, len, script) } else #endif - if (p[0] == NUL || (p[0] == K_SPECIAL && !script -#ifdef FEAT_AUTOCMD + if (p[0] == NUL || (p[0] == K_SPECIAL /* timeout may generate K_CURSORHOLD */ && (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD) -#endif #if defined(WIN3264) && !defined(FEAT_GUI) /* Win32 console passes modifiers */ && (i < 2 || p[1] != KS_MODIFIER) @@ -3167,7 +3165,7 @@ fix_input_buffer(buf, len, script) * waiting for input to arrive. */ int -input_available() +input_available(void) { return (!vim_is_input_buf_empty() # if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) @@ -3204,6 +3202,7 @@ input_available() * for :xmap mode is VISUAL * for :smap mode is SELECTMODE * for :omap mode is OP_PENDING + * for :tmap mode is TERMINAL * * for :abbr mode is INSERT + CMDLINE * for :iabbr mode is INSERT @@ -3216,11 +3215,11 @@ input_available() * 5 for entry not unique */ int -do_map(maptype, arg, mode, abbrev) - int maptype; - char_u *arg; - int mode; - int abbrev; /* not a mapping but an abbreviation */ +do_map( + int maptype, + char_u *arg, + int mode, + int abbrev) /* not a mapping but an abbreviation */ { char_u *keys; mapblock_T *mp, **mpp; @@ -3353,7 +3352,7 @@ do_map(maptype, arg, mode, abbrev) */ p = keys; do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL); - while (*p && (maptype == 1 || !vim_iswhite(*p))) + while (*p && (maptype == 1 || !VIM_ISWHITE(*p))) { if ((p[0] == Ctrl_V || (do_backslash && p[0] == '\\')) && p[1] != NUL) @@ -3458,7 +3457,7 @@ do_map(maptype, arg, mode, abbrev) } /* An abbreviation cannot contain white space. */ for (n = 0; n < len; ++n) - if (vim_iswhite(keys[n])) + if (VIM_ISWHITE(keys[n])) { retval = 1; goto theend; @@ -3696,6 +3695,16 @@ do_map(maptype, arg, mode, abbrev) { if (!did_it) retval = 2; /* no match */ + else if (*keys == Ctrl_C) + { + /* If CTRL-C has been unmapped, reuse it for Interrupting. */ +#ifdef FEAT_LOCALMAP + if (map_table == curbuf->b_maphash) + curbuf->b_mapped_ctrl_c &= ~mode; + else +#endif + mapped_ctrl_c &= ~mode; + } goto theend; } @@ -3728,9 +3737,16 @@ do_map(maptype, arg, mode, abbrev) goto theend; } - /* If CTRL-C has been mapped, don't always use it for Interrupting */ + /* If CTRL-C has been mapped, don't always use it for Interrupting. */ if (*keys == Ctrl_C) - mapped_ctrl_c = TRUE; + { +#ifdef FEAT_LOCALMAP + if (map_table == curbuf->b_maphash) + curbuf->b_mapped_ctrl_c |= mode; + else +#endif + mapped_ctrl_c |= mode; + } mp->m_keys = vim_strsave(keys); mp->m_str = vim_strsave(rhs); @@ -3778,8 +3794,7 @@ do_map(maptype, arg, mode, abbrev) * "mpp" is a pointer to the m_next field of the PREVIOUS entry! */ static void -map_free(mpp) - mapblock_T **mpp; +map_free(mapblock_T **mpp) { mapblock_T *mp; @@ -3795,7 +3810,7 @@ map_free(mpp) * Initialize maphash[] for first use. */ static void -validate_maphash() +validate_maphash(void) { if (!maphash_valid) { @@ -3808,9 +3823,7 @@ validate_maphash() * Get the mapping mode from the command name. */ int -get_map_mode(cmdp, forceit) - char_u **cmdp; - int forceit; +get_map_mode(char_u **cmdp, int forceit) { char_u *p; int modec; @@ -3834,6 +3847,8 @@ get_map_mode(cmdp, forceit) mode = SELECTMODE; /* :smap */ else if (modec == 'o') mode = OP_PENDING; /* :omap */ + else if (modec == 't') + mode = TERMINAL; /* :tmap */ else { --p; @@ -3852,11 +3867,11 @@ get_map_mode(cmdp, forceit) * 'abbr' should be FALSE for mappings, TRUE for abbreviations. */ void -map_clear(cmdp, arg, forceit, abbr) - char_u *cmdp; - char_u *arg UNUSED; - int forceit; - int abbr; +map_clear( + char_u *cmdp, + char_u *arg UNUSED, + int forceit, + int abbr) { int mode; #ifdef FEAT_LOCALMAP @@ -3884,11 +3899,11 @@ map_clear(cmdp, arg, forceit, abbr) * Clear all mappings in "mode". */ void -map_clear_int(buf, mode, local, abbr) - buf_T *buf UNUSED; /* buffer for local mappings */ - int mode; /* mode in which to delete */ - int local UNUSED; /* TRUE for buffer-local mappings */ - int abbr; /* TRUE for abbreviations */ +map_clear_int( + buf_T *buf UNUSED, /* buffer for local mappings */ + int mode, /* mode in which to delete */ + int local UNUSED, /* TRUE for buffer-local mappings */ + int abbr) /* TRUE for abbreviations */ { mapblock_T *mp, **mpp; int hash; @@ -3961,8 +3976,7 @@ map_clear_int(buf, mode, local, abbr) * Returns NULL when out of memory. */ char_u * -map_mode_to_chars(mode) - int mode; +map_mode_to_chars(int mode) { garray_T mapmode; @@ -4001,13 +4015,16 @@ map_mode_to_chars(mode) } static void -showmap(mp, local) - mapblock_T *mp; - int local; /* TRUE for buffer-local map */ +showmap( + mapblock_T *mp, + int local) /* TRUE for buffer-local map */ { int len = 1; char_u *mapchars; + if (message_filtered(mp->m_keys) && message_filtered(mp->m_str)) + return; + if (msg_didout || msg_silent != 0) { msg_putchar('\n'); @@ -4035,9 +4052,9 @@ showmap(mp, local) } while (len < 12); if (mp->m_noremap == REMAP_NONE) - msg_puts_attr((char_u *)"*", hl_attr(HLF_8)); + msg_puts_attr((char_u *)"*", HL_ATTR(HLF_8)); else if (mp->m_noremap == REMAP_SCRIPT) - msg_puts_attr((char_u *)"&", hl_attr(HLF_8)); + msg_puts_attr((char_u *)"&", HL_ATTR(HLF_8)); else msg_putchar(' '); @@ -4049,7 +4066,7 @@ showmap(mp, local) /* Use FALSE below if we only want things like <Up> to show up as such on * the rhs, and not M-x etc, TRUE gets both -- webb */ if (*mp->m_str == NUL) - msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8)); + msg_puts_attr((char_u *)"<Nop>", HL_ATTR(HLF_8)); else { /* Remove escaping of CSI, because "m_str" is in a format to be used @@ -4076,10 +4093,7 @@ showmap(mp, local) * Also checks mappings local to the current buffer. */ int -map_to_exists(str, modechars, abbr) - char_u *str; - char_u *modechars; - int abbr; +map_to_exists(char_u *str, char_u *modechars, int abbr) { int mode = 0; char_u *rhs; @@ -4117,15 +4131,12 @@ map_to_exists(str, modechars, abbr) * Also checks mappings local to the current buffer. */ int -map_to_exists_mode(rhs, mode, abbr) - char_u *rhs; - int mode; - int abbr; +map_to_exists_mode(char_u *rhs, int mode, int abbr) { mapblock_T *mp; int hash; # ifdef FEAT_LOCALMAP - int expand_buffer = FALSE; + int exp_buffer = FALSE; validate_maphash(); @@ -4140,14 +4151,14 @@ map_to_exists_mode(rhs, mode, abbr) if (hash > 0) /* there is only one abbr list */ break; #ifdef FEAT_LOCALMAP - if (expand_buffer) + if (exp_buffer) mp = curbuf->b_first_abbr; else #endif mp = first_abbr; } # ifdef FEAT_LOCALMAP - else if (expand_buffer) + else if (exp_buffer) mp = curbuf->b_maphash[hash]; # endif else @@ -4160,9 +4171,9 @@ map_to_exists_mode(rhs, mode, abbr) } } # ifdef FEAT_LOCALMAP - if (expand_buffer) + if (exp_buffer) break; - expand_buffer = TRUE; + exp_buffer = TRUE; } # endif @@ -4184,14 +4195,14 @@ static int expand_buffer = FALSE; * or abbreviation names. */ char_u * -set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap, cmdidx) - expand_T *xp; - char_u *cmd; - char_u *arg; - int forceit; /* TRUE if '!' given */ - int isabbrev; /* TRUE if abbreviation */ - int isunmap; /* TRUE if unmap/unabbrev command */ - cmdidx_T cmdidx; +set_context_in_map_cmd( + expand_T *xp, + char_u *cmd, + char_u *arg, + int forceit, /* TRUE if '!' given */ + int isabbrev, /* TRUE if abbreviation */ + int isunmap, /* TRUE if unmap/unabbrev command */ + cmdidx_T cmdidx) { if (forceit && cmdidx != CMD_map && cmdidx != CMD_unmap) xp->xp_context = EXPAND_NOTHING; @@ -4235,6 +4246,11 @@ set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap, cmdidx) arg = skipwhite(arg + 8); continue; } + if (STRNCMP(arg, "<special>", 9) == 0) + { + arg = skipwhite(arg + 9); + continue; + } #ifdef FEAT_EVAL if (STRNCMP(arg, "<script>", 8) == 0) { @@ -4261,10 +4277,10 @@ set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap, cmdidx) * Return OK if matches found, FAIL otherwise. */ int -ExpandMappings(regmatch, num_file, file) - regmatch_T *regmatch; - int *num_file; - char_u ***file; +ExpandMappings( + regmatch_T *regmatch, + int *num_file, + char_u ***file) { mapblock_T *mp; int hash; @@ -4286,7 +4302,7 @@ ExpandMappings(regmatch, num_file, file) { count = 0; - for (i = 0; i < 6; ++i) + for (i = 0; i < 7; ++i) { if (i == 0) p = (char_u *)"<silent>"; @@ -4304,6 +4320,8 @@ ExpandMappings(regmatch, num_file, file) #endif else if (i == 5) p = (char_u *)"<nowait>"; + else if (i == 6) + p = (char_u *)"<special>"; else continue; @@ -4394,7 +4412,9 @@ ExpandMappings(regmatch, num_file, file) /* * Check for an abbreviation. - * Cursor is at ptr[col]. When inserting, mincol is where insert started. + * Cursor is at ptr[col]. + * When inserting, mincol is where insert started. + * For the command line, mincol is what is to be skipped over. * "c" is the character typed before check_abbr was called. It may have * ABBR_OFF added to avoid prepending a CTRL-V to it. * @@ -4409,11 +4429,11 @@ ExpandMappings(regmatch, num_file, file) * return TRUE if there is an abbreviation, FALSE if not */ int -check_abbr(c, ptr, col, mincol) - int c; - char_u *ptr; - int col; - int mincol; +check_abbr( + int c, + char_u *ptr, + int col, + int mincol) { int len; int scol; /* starting column of the abbr. */ @@ -4512,10 +4532,30 @@ check_abbr(c, ptr, col, mincol) #endif (mp = mp->m_next)) { + int qlen = mp->m_keylen; + char_u *q = mp->m_keys; + int match; + + if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) + { + char_u *qe = vim_strsave(mp->m_keys); + + /* might have CSI escaped mp->m_keys */ + if (qe != NULL) + { + q = qe; + vim_unescape_csi(q); + qlen = (int)STRLEN(q); + } + } + /* find entries with right mode and keys */ - if ( (mp->m_mode & State) - && mp->m_keylen == len - && !STRNCMP(mp->m_keys, ptr, (size_t)len)) + match = (mp->m_mode & State) + && qlen == len + && !STRNCMP(q, ptr, (size_t)len); + if (q != mp->m_keys) + vim_free(q); + if (match) break; } if (mp != NULL) @@ -4601,9 +4641,9 @@ check_abbr(c, ptr, col, mincol) * special characters. */ static char_u * -eval_map_expr(str, c) - char_u *str; - int c; /* NUL or typed character for abbreviation */ +eval_map_expr( + char_u *str, + int c) /* NUL or typed character for abbreviation */ { char_u *res; char_u *p; @@ -4630,18 +4670,14 @@ eval_map_expr(str, c) /* Forbid changing text or using ":normal" to avoid most of the bad side * effects. Also restore the cursor position. */ ++textlock; -#ifdef FEAT_EX_EXTRA ++ex_normal_lock; -#endif set_vim_var_char(c); /* set v:char to the typed character */ save_cursor = curwin->w_cursor; save_msg_col = msg_col; save_msg_row = msg_row; p = eval_to_string(expr, NULL, FALSE); --textlock; -#ifdef FEAT_EX_EXTRA --ex_normal_lock; -#endif curwin->w_cursor = save_cursor; msg_col = save_msg_col; msg_row = save_msg_row; @@ -4665,14 +4701,22 @@ eval_map_expr(str, c) * Returns NULL when out of memory. */ char_u * -vim_strsave_escape_csi(p) - char_u *p; +vim_strsave_escape_csi( + char_u *p) { char_u *res; char_u *s, *d; - /* Need a buffer to hold up to three times as much. */ - res = alloc((unsigned)(STRLEN(p) * 3) + 1); + /* Need a buffer to hold up to three times as much. Four in case of an + * illegal utf-8 byte: + * 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER */ + res = alloc((unsigned)(STRLEN(p) * +#ifdef FEAT_MBYTE + 4 +#else + 3 +#endif + ) + 1); if (res != NULL) { d = res; @@ -4687,22 +4731,10 @@ vim_strsave_escape_csi(p) } else { -#ifdef FEAT_MBYTE - int len = mb_char2len(PTR2CHAR(s)); - int len2 = mb_ptr2len(s); -#endif /* Add character, possibly multi-byte to destination, escaping - * CSI and K_SPECIAL. */ + * CSI and K_SPECIAL. Be careful, it can be an illegal byte! */ d = add_char2buf(PTR2CHAR(s), d); -#ifdef FEAT_MBYTE - while (len < len2) - { - /* add following combining char */ - d = add_char2buf(PTR2CHAR(s + len), d); - len += mb_char2len(PTR2CHAR(s + len)); - } -#endif - mb_ptr_adv(s); + s += MB_CPTR2LEN(s); } } *d = NUL; @@ -4715,8 +4747,7 @@ vim_strsave_escape_csi(p) * vim_strsave_escape_csi(). Works in-place. */ void -vim_unescape_csi(p) - char_u *p; +vim_unescape_csi(char_u *p) { char_u *s = p, *d = p; @@ -4744,9 +4775,9 @@ vim_unescape_csi(p) * Return FAIL on error, OK otherwise. */ int -makemap(fd, buf) - FILE *fd; - buf_T *buf; /* buffer for local mappings or NULL */ +makemap( + FILE *fd, + buf_T *buf) /* buffer for local mappings or NULL */ { mapblock_T *mp; char_u c1, c2, c3; @@ -4882,8 +4913,11 @@ makemap(fd, buf) case LANGMAP: c1 = 'l'; break; + case TERMINAL: + c1 = 't'; + break; default: - EMSG(_("E228: makemap: Illegal mode")); + IEMSG(_("E228: makemap: Illegal mode")); return FAIL; } do /* do this twice if c2 is set, 3 times with c3 */ @@ -4957,10 +4991,7 @@ makemap(fd, buf) * return FAIL for failure, OK otherwise */ int -put_escstr(fd, strstart, what) - FILE *fd; - char_u *strstart; - int what; +put_escstr(FILE *fd, char_u *strstart, int what) { char_u *str = strstart; int c; @@ -5049,7 +5080,7 @@ put_escstr(fd, strstart, what) * interpreted as the start of a special key name. * A space in the lhs of a :map needs a CTRL-V. */ - if (what == 2 && (vim_iswhite(c) || c == '"' || c == '\\')) + if (what == 2 && (VIM_ISWHITE(c) || c == '"' || c == '\\')) { if (putc('\\', fd) < 0) return FAIL; @@ -5073,7 +5104,7 @@ put_escstr(fd, strstart, what) * Used after ":set term=xxx". */ void -check_map_keycodes() +check_map_keycodes(void) { mapblock_T *mp; char_u *p; @@ -5165,14 +5196,14 @@ check_map_keycodes() * NULL when no mapping found. */ char_u * -check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr) - char_u *keys; - int mode; - int exact; /* require exact match */ - int ign_mod; /* ignore preceding modifier */ - int abbr; /* do abbreviations */ - mapblock_T **mp_ptr; /* return: pointer to mapblock or NULL */ - int *local_ptr; /* return: buffer-local mapping or NULL */ +check_map( + char_u *keys, + int mode, + int exact, /* require exact match */ + int ign_mod, /* ignore preceding modifier */ + int abbr, /* do abbreviations */ + mapblock_T **mp_ptr, /* return: pointer to mapblock or NULL */ + int *local_ptr) /* return: buffer-local mapping or NULL */ { int hash; int len, minlen; @@ -5246,7 +5277,7 @@ check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr) } #endif -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) +#if defined(MSWIN) || defined(MACOS_X) #define VIS_SEL (VISUAL+SELECTMODE) /* abbreviation */ @@ -5259,7 +5290,7 @@ static struct initmap int mode; } initmappings[] = { -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* Use the Windows (CUA) keybindings. */ # ifdef FEAT_GUI /* paste, copy and cut */ @@ -5279,17 +5310,6 @@ static struct initmap /* paste, copy and cut */ # ifdef FEAT_CLIPBOARD -# ifdef DJGPP - {(char_u *)"\316\122 \"*P", NORMAL}, /* SHIFT-Insert is "*P */ - {(char_u *)"\316\122 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */ - {(char_u *)"\316\122 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */ - {(char_u *)"\316\222 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */ -# if 0 /* Shift-Del produces the same code as Del */ - {(char_u *)"\316\123 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */ -# endif - {(char_u *)"\316\223 \"*d", VIS_SEL}, /* CTRL-Del is "*d */ - {(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */ -# else {(char_u *)"\316\324 \"*P", NORMAL}, /* SHIFT-Insert is "*P */ {(char_u *)"\316\324 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */ {(char_u *)"\316\324 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */ @@ -5297,7 +5317,6 @@ static struct initmap {(char_u *)"\316\327 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */ {(char_u *)"\316\330 \"*d", VIS_SEL}, /* CTRL-Del is "*d */ {(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */ -# endif # else {(char_u *)"\316\324 P", NORMAL}, /* SHIFT-Insert is P */ {(char_u *)"\316\324 \"-dP", VIS_SEL}, /* SHIFT-Insert is "-dP */ @@ -5309,7 +5328,7 @@ static struct initmap # endif #endif -#if defined(MACOS) +#if defined(MACOS_X) # if !defined(FEAT_GUI_MACVIM) /* Use the Standard MacOS binding. */ /* paste, copy and cut */ @@ -5331,26 +5350,24 @@ static struct initmap * Set up default mappings. */ void -init_mappings() +init_mappings(void) { -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) +#if defined(MSWIN) || defined(MACOS_X) int i; - for (i = 0; i < sizeof(initmappings) / sizeof(struct initmap); ++i) + for (i = 0; i < (int)(sizeof(initmappings) / sizeof(struct initmap)); ++i) add_map(initmappings[i].arg, initmappings[i].mode); #endif } -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) \ - || defined(FEAT_CMDWIN) || defined(MACOS) || defined(PROTO) +#if defined(MSWIN) || defined(FEAT_CMDWIN) || defined(MACOS_X) \ + || defined(PROTO) /* * Add a mapping "map" for mode "mode". * Need to put string in allocated memory, because do_map() will modify it. */ void -add_map(map, mode) - char_u *map; - int mode; +add_map(char_u *map, int mode) { char_u *s; char_u *cpo_save = p_cpo; diff --git a/src/glbl_ime.cpp b/src/glbl_ime.cpp index 3cca0b79d5..af13ad2bca 100644 --- a/src/glbl_ime.cpp +++ b/src/glbl_ime.cpp @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/glbl_ime.h b/src/glbl_ime.h index 711f9e53ec..45ed07fb3c 100644 --- a/src/glbl_ime.h +++ b/src/glbl_ime.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/globals.h b/src/globals.h index b9324896d8..8fb4e35d9d 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,7 +19,7 @@ */ EXTERN long Rows /* nr of rows in the screen */ #ifdef DO_INIT -# if defined(MSDOS) || defined(WIN3264) || defined(OS2) +# if defined(WIN3264) = 25L # else = 24L @@ -63,7 +63,6 @@ EXTERN int Screen_mco INIT(= 0); /* value of p_mco used when EXTERN schar_T *ScreenLines2 INIT(= NULL); #endif -#ifdef FEAT_WINDOWS /* * Indexes for tab page line: * N > 0 for label of tab page N @@ -72,7 +71,6 @@ EXTERN schar_T *ScreenLines2 INIT(= NULL); * N == -999 for closing current tab page */ EXTERN short *TabPageIdxs INIT(= NULL); -#endif EXTERN int screen_Rows INIT(= 0); /* actual size of ScreenLines[] */ EXTERN int screen_Columns INIT(= 0); /* actual size of ScreenLines[] */ @@ -97,6 +95,7 @@ EXTERN int cmdline_row; EXTERN int redraw_cmdline INIT(= FALSE); /* cmdline must be redrawn */ EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */ EXTERN int mode_displayed INIT(= FALSE); /* mode is being displayed */ +EXTERN int no_win_do_lines_ins INIT(= FALSE); /* don't insert lines */ #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) EXTERN int cmdline_star INIT(= FALSE); /* cmdline is crypted */ #endif @@ -105,10 +104,6 @@ EXTERN int exec_from_reg INIT(= FALSE); /* executing register */ EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */ -#ifdef FEAT_CRYPT -EXTERN int use_crypt_method INIT(= 0); -#endif - /* * When '$' is included in 'cpoptions' option set: * When a change command is given that deletes only part of a line, a dollar @@ -185,6 +180,11 @@ EXTERN dict_T globvardict; /* Dictionary with g: variables */ #endif EXTERN int did_emsg; /* set by emsg() when the message is displayed or thrown */ +#ifdef FEAT_EVAL +EXTERN int called_vim_beep; /* set if vim_beep() is called */ +EXTERN int did_uncaught_emsg; /* emsg() was called and did not + cause an exception */ +#endif EXTERN int did_emsg_syntax; /* did_emsg set because of a syntax error */ EXTERN int called_emsg; /* always set by emsg() */ @@ -201,7 +201,7 @@ EXTERN int need_maketitle INIT(= TRUE); /* call maketitle() soon */ #endif EXTERN int quit_more INIT(= FALSE); /* 'q' hit at "--more--" msg */ -#if defined(UNIX) || defined(__EMX__) || defined(VMS) || defined(MACOS_X) +#if defined(UNIX) || defined(VMS) || defined(MACOS_X) EXTERN int newline_on_exit INIT(= FALSE); /* did msg in altern. screen */ EXTERN int intr_char INIT(= 0); /* extra interrupt character */ #endif @@ -235,6 +235,7 @@ EXTERN int ex_nesting_level INIT(= 0); /* nesting level */ EXTERN int debug_break_level INIT(= -1); /* break below this level */ EXTERN int debug_did_msg INIT(= FALSE); /* did "debug mode" message */ EXTERN int debug_tick INIT(= 0); /* breakpoint change count */ +EXTERN int debug_backtrace_level INIT(= 0); /* breakpoint backtrace level */ # ifdef FEAT_PROFILE EXTERN int do_profiling INIT(= PROF_NONE); /* PROF_ values */ # endif @@ -328,11 +329,11 @@ EXTERN int garbage_collect_at_exit INIT(= FALSE); EXTERN scid_T current_SID INIT(= 0); #endif -#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) +EXTERN int did_source_packages INIT(= FALSE); + /* Magic number used for hashitem "hi_key" value indicating a deleted item. * Only the address is used. */ EXTERN char_u hash_removed; -#endif EXTERN int scroll_region INIT(= FALSE); /* term supports scroll region */ @@ -364,6 +365,10 @@ EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */ EXTERN int highlight_user[9]; /* User[1-9] attributes */ # ifdef FEAT_STL_OPT EXTERN int highlight_stlnc[9]; /* On top of user */ +# ifdef FEAT_TERMINAL +EXTERN int highlight_stlterm[9]; /* On top of user */ +EXTERN int highlight_stltermnc[9]; /* On top of user */ +# endif # endif #endif #ifdef FEAT_GUI @@ -372,8 +377,14 @@ EXTERN char_u *use_gvimrc INIT(= NULL); /* "-U" cmdline argument */ EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0); EXTERN int cterm_normal_bg_color INIT(= 0); +#ifdef FEAT_TERMGUICOLORS +EXTERN guicolor_T cterm_normal_fg_gui_color INIT(= INVALCOLOR); +EXTERN guicolor_T cterm_normal_bg_gui_color INIT(= INVALCOLOR); +#endif +#ifdef FEAT_TERMRESPONSE +EXTERN int is_mac_terminal INIT(= FALSE); /* recognized Terminal.app */ +#endif -#ifdef FEAT_AUTOCMD EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ @@ -385,7 +396,7 @@ EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when /* When deleting the current buffer, another one must be loaded. If we know * which one is preferred, au_new_curbuf is set to it */ -EXTERN buf_T *au_new_curbuf INIT(= NULL); +EXTERN bufref_T au_new_curbuf INIT(= {NULL COMMA 0 COMMA 0}); /* When deleting a buffer/window and autocmd_busy is TRUE, do not free the * buffer/window. but link it in the list starting with @@ -393,7 +404,6 @@ EXTERN buf_T *au_new_curbuf INIT(= NULL); * Free the buffer/window when autocmd_busy is being set to FALSE. */ EXTERN buf_T *au_pending_free_buf INIT(= NULL); EXTERN win_T *au_pending_free_win INIT(= NULL); -#endif #ifdef FEAT_MOUSE /* @@ -430,9 +440,7 @@ EXTERN int gui_prev_topfill INIT(= 0); EXTERN int drag_status_line INIT(= FALSE); /* dragging the status line */ EXTERN int postponed_mouseshape INIT(= FALSE); /* postponed updating the mouse pointer shape */ -# ifdef FEAT_VERTSPLIT EXTERN int drag_sep_line INIT(= FALSE); /* dragging vert separator */ -# endif # endif #endif @@ -533,20 +541,24 @@ EXTERN int clip_autoselect_plus INIT(= FALSE); EXTERN int clip_autoselectml INIT(= FALSE); EXTERN int clip_html INIT(= FALSE); EXTERN regprog_T *clip_exclude_prog INIT(= NULL); +EXTERN int clip_unnamed_saved INIT(= 0); #endif /* * All windows are linked in a list. firstwin points to the first entry, * lastwin to the last entry (can be the same as firstwin) and curwin to the * currently active window. - * Without the FEAT_WINDOWS they are all equal. */ -#ifdef FEAT_WINDOWS EXTERN win_T *firstwin; /* first window */ EXTERN win_T *lastwin; /* last window */ EXTERN win_T *prevwin INIT(= NULL); /* previous window */ +# define ONE_WINDOW (firstwin == lastwin) # define W_NEXT(wp) ((wp)->w_next) # define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next) +# define FOR_ALL_TABPAGES(tp) for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) +# define FOR_ALL_WINDOWS_IN_TAB(tp, wp) \ + for ((wp) = ((tp) == NULL || (tp) == curtab) \ + ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next) /* * When using this macro "break" only breaks out of the inner loop. Use "goto" * to break out of the tabpage loop. @@ -555,20 +567,11 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */ for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \ for ((wp) = ((tp) == curtab) \ ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next) -#else -# define firstwin curwin -# define lastwin curwin -# define W_NEXT(wp) NULL -# define FOR_ALL_WINDOWS(wp) wp = curwin; -# define FOR_ALL_TAB_WINDOWS(tp, wp) wp = curwin; -#endif EXTERN win_T *curwin; /* currently active window */ -#ifdef FEAT_AUTOCMD EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */ EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */ -#endif /* * The window layout is kept in a tree of frames. topframe points to the top @@ -576,7 +579,6 @@ EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */ */ EXTERN frame_T *topframe; /* top of the window frame tree */ -#ifdef FEAT_WINDOWS /* * Tab pages are alternative topframes. "first_tabpage" points to the first * one in the list, "curtab" is the current one. @@ -584,7 +586,6 @@ EXTERN frame_T *topframe; /* top of the window frame tree */ EXTERN tabpage_T *first_tabpage; EXTERN tabpage_T *curtab; EXTERN int redraw_tabline INIT(= FALSE); /* need to redraw tabline */ -#endif /* * All buffers are linked in a list. 'firstbuf' points to the first entry, @@ -594,6 +595,8 @@ EXTERN buf_T *firstbuf INIT(= NULL); /* first buffer */ EXTERN buf_T *lastbuf INIT(= NULL); /* last buffer */ EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */ +#define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf = buf->b_next) + /* Flag that is set when switching off 'swapfile'. It means that all blocks * are to be loaded into memory. Shouldn't be global... */ EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */ @@ -632,6 +635,16 @@ EXTERN int exiting INIT(= FALSE); EXTERN int really_exiting INIT(= FALSE); /* TRUE when we are sure to exit, e.g., after * a deadly signal */ +EXTERN int v_dying INIT(= 0); /* internal value of v:dying */ +EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */ + +#if defined(FEAT_AUTOCHDIR) +EXTERN int test_autochdir INIT(= FALSE); +#endif +#if defined(EXITFREE) +EXTERN int entered_free_all_mem INIT(= FALSE); + /* TRUE when in or after free_all_mem() */ +#endif /* volatile because it is used in signal handler deathtrap(). */ EXTERN volatile int full_screen INIT(= FALSE); /* TRUE when doing full-screen output @@ -648,7 +661,6 @@ EXTERN int textlock INIT(= 0); /* non-zero when changing text and jumping to * another window or buffer is not allowed */ -#ifdef FEAT_AUTOCMD EXTERN int curbuf_lock INIT(= 0); /* non-zero when the current buffer can't be * changed. Used for FileChangedRO. */ @@ -657,7 +669,6 @@ EXTERN int allbuf_lock INIT(= 0); * changed, no buffer can be deleted and * current directory can't be changed. * Used for SwapExists et al. */ -#endif #ifdef FEAT_EVAL # define HAVE_SANDBOX EXTERN int sandbox INIT(= 0); @@ -717,7 +728,6 @@ EXTERN colnr_T ai_col INIT(= 0); EXTERN int end_comment_pending INIT(= NUL); #endif -#ifdef FEAT_SCROLLBIND /* * This flag is set after a ":syncbind" to let the check_scrollbind() function * know that it should not attempt to perform scrollbinding due to the scroll @@ -725,7 +735,6 @@ EXTERN int end_comment_pending INIT(= NUL); * undo some of the work done by ":syncbind.") -ralston */ EXTERN int did_syncbind INIT(= FALSE); -#endif #ifdef FEAT_SMARTINDENT /* @@ -846,19 +855,19 @@ EXTERN vimconv_T output_conv; /* type of output conversion */ * The value is set in mb_init(); */ /* length of char in bytes, including following composing chars */ -EXTERN int (*mb_ptr2len) __ARGS((char_u *p)) INIT(= latin_ptr2len); +EXTERN int (*mb_ptr2len)(char_u *p) INIT(= latin_ptr2len); /* idem, with limit on string length */ -EXTERN int (*mb_ptr2len_len) __ARGS((char_u *p, int size)) INIT(= latin_ptr2len_len); +EXTERN int (*mb_ptr2len_len)(char_u *p, int size) INIT(= latin_ptr2len_len); /* byte length of char */ -EXTERN int (*mb_char2len) __ARGS((int c)) INIT(= latin_char2len); +EXTERN int (*mb_char2len)(int c) INIT(= latin_char2len); /* convert char to bytes, return the length */ -EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes); -EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells); -EXTERN int (*mb_ptr2cells_len) __ARGS((char_u *p, int size)) INIT(= latin_ptr2cells_len); -EXTERN int (*mb_char2cells) __ARGS((int c)) INIT(= latin_char2cells); -EXTERN int (*mb_off2cells) __ARGS((unsigned off, unsigned max_off)) INIT(= latin_off2cells); -EXTERN int (*mb_ptr2char) __ARGS((char_u *p)) INIT(= latin_ptr2char); -EXTERN int (*mb_head_off) __ARGS((char_u *base, char_u *p)) INIT(= latin_head_off); +EXTERN int (*mb_char2bytes)(int c, char_u *buf) INIT(= latin_char2bytes); +EXTERN int (*mb_ptr2cells)(char_u *p) INIT(= latin_ptr2cells); +EXTERN int (*mb_ptr2cells_len)(char_u *p, int size) INIT(= latin_ptr2cells_len); +EXTERN int (*mb_char2cells)(int c) INIT(= latin_char2cells); +EXTERN int (*mb_off2cells)(unsigned off, unsigned max_off) INIT(= latin_off2cells); +EXTERN int (*mb_ptr2char)(char_u *p) INIT(= latin_ptr2char); +EXTERN int (*mb_head_off)(char_u *base, char_u *p) INIT(= latin_head_off); # if defined(USE_ICONV) && defined(DYNAMIC_ICONV) /* Pointers to functions and variables to be loaded at runtime */ @@ -909,21 +918,25 @@ EXTERN char_u composing_hangul_buffer[5]; * "Visual_mode" When State is NORMAL or INSERT. * "finish_op" When State is NORMAL, after typing the operator and before * typing the motion command. + * "debug_mode" Debug mode. */ EXTERN int State INIT(= NORMAL); /* This is the current state of the * command interpreter. */ +#ifdef FEAT_EVAL +EXTERN int debug_mode INIT(= FALSE); +#endif EXTERN int finish_op INIT(= FALSE);/* TRUE while an operator is pending */ -EXTERN int opcount INIT(= 0); /* count for pending operator */ +EXTERN long opcount INIT(= 0); /* count for pending operator */ /* - * ex mode (Q) state + * Ex mode (Q) state */ EXTERN int exmode_active INIT(= 0); /* zero, EXMODE_NORMAL or EXMODE_VIM */ EXTERN int ex_no_reprint INIT(= FALSE); /* no need to print after z or p */ -EXTERN int Recording INIT(= FALSE); /* TRUE when recording into a reg. */ -EXTERN int Exec_reg INIT(= FALSE); /* TRUE when executing a register */ +EXTERN int reg_recording INIT(= 0); /* register for recording or zero */ +EXTERN int reg_executing INIT(= 0); /* register being executed or zero */ EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */ EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */ @@ -947,13 +960,9 @@ EXTERN char_u *edit_submode INIT(= NULL); /* msg for CTRL-X submode */ EXTERN char_u *edit_submode_pre INIT(= NULL); /* prepended to edit_submode */ EXTERN char_u *edit_submode_extra INIT(= NULL);/* appended to edit_submode */ EXTERN hlf_T edit_submode_highl; /* highl. method for extra info */ -EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */ #endif EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */ -#ifdef MSDOS -EXTERN int beep_count INIT(= 0); /* nr of beeps since last char typed */ -#endif #ifdef USE_EXE_NAME EXTERN char_u *exe_name; /* the name of the executable */ @@ -962,24 +971,22 @@ EXTERN char_u *exe_name; /* the name of the executable */ #ifdef USE_ON_FLY_SCROLL EXTERN int dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */ #endif -EXTERN int mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */ +EXTERN int mapped_ctrl_c INIT(= FALSE); /* modes where CTRL-C is mapped */ EXTERN int ctrl_c_interrupts INIT(= TRUE); /* CTRL-C sets got_int */ EXTERN cmdmod_T cmdmod; /* Ex command modifiers */ EXTERN int msg_silent INIT(= 0); /* don't print messages */ EXTERN int emsg_silent INIT(= 0); /* don't print error messages */ +EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */ -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \ - || defined(FEAT_AUTOCMD) # define HAS_SWAP_EXISTS_ACTION EXTERN int swap_exists_action INIT(= SEA_NONE); /* For dialog when swap file already * exists. */ EXTERN int swap_exists_did_quit INIT(= FALSE); /* Selected "quit" at the dialog. */ -#endif EXTERN char_u *IObuff; /* sprintf's are done in this buffer, size is IOSIZE */ @@ -998,10 +1005,8 @@ EXTERN typebuf_T typebuf /* typeahead buffer */ = {NULL, NULL, 0, 0, 0, 0, 0, 0, 0} #endif ; -#ifdef FEAT_EX_EXTRA EXTERN int ex_normal_busy INIT(= 0); /* recursiveness of ex_normal() */ EXTERN int ex_normal_lock INIT(= 0); /* forbid use of ex_normal() */ -#endif #ifdef FEAT_EVAL EXTERN int ignore_script INIT(= FALSE); /* ignore script input */ #endif @@ -1009,21 +1014,17 @@ EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */ EXTERN int KeyTyped; /* TRUE if user typed current char */ EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD EXTERN int vgetc_im_active; /* Input Method was active for last character obtained from vgetc() */ #endif EXTERN int maptick INIT(= 0); /* tick for each non-mapped char */ -EXTERN char_u chartab[256]; /* table used in charset.c; See - init_chartab() for explanation */ - EXTERN int must_redraw INIT(= 0); /* type of redraw necessary */ EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */ EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */ EXTERN int need_highlight_changed INIT(= TRUE); -EXTERN char_u *use_viminfo INIT(= NULL); /* name of viminfo file to use */ #define NSCRIPT 15 EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */ @@ -1066,7 +1067,6 @@ EXTERN char_u *repeat_cmdline INIT(= NULL); /* command line for "." */ #ifdef FEAT_CMDHIST EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */ #endif -#ifdef FEAT_AUTOCMD EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */ EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */ @@ -1077,18 +1077,13 @@ EXTERN pos_T last_cursormoved /* for CursorMoved event */ = INIT_POS_T(0, 0, 0) # endif ; -EXTERN int last_changedtick INIT(= 0); /* for TextChanged event */ -EXTERN buf_T *last_changedtick_buf INIT(= NULL); -#endif -#ifdef FEAT_WINDOWS EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */ EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */ EXTERN int postponed_split_tab INIT(= 0); /* cmdmod.tab */ -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX EXTERN int g_do_tagpreview INIT(= 0); /* for tag preview commands: height of preview window */ -# endif #endif EXTERN int replace_offset INIT(= 0); /* offset for replace_push() */ @@ -1109,6 +1104,7 @@ EXTERN FILE *redir_fd INIT(= NULL); /* message redirection file */ #ifdef FEAT_EVAL EXTERN int redir_reg INIT(= 0); /* message redirection register */ EXTERN int redir_vname INIT(= 0); /* message redirection variable */ +EXTERN int redir_execute INIT(= 0); /* execute() redirection */ #endif #ifdef FEAT_LANGMAP @@ -1167,23 +1163,23 @@ EXTERN int lcs_eol INIT(= '$'); EXTERN int lcs_ext INIT(= NUL); EXTERN int lcs_prec INIT(= NUL); EXTERN int lcs_nbsp INIT(= NUL); +EXTERN int lcs_space INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); #ifdef FEAT_CONCEAL -EXTERN int lcs_conceal INIT(= '-'); +EXTERN int lcs_conceal INIT(= ' '); #endif -#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \ - || defined(FEAT_FOLDING) /* Characters from 'fillchars' option */ EXTERN int fill_stl INIT(= ' '); EXTERN int fill_stlnc INIT(= ' '); -#endif -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) EXTERN int fill_vert INIT(= ' '); EXTERN int fill_fold INIT(= '-'); EXTERN int fill_diff INIT(= '-'); + +#ifdef FEAT_FOLDING +EXTERN int disable_fold_update INIT(= 0); #endif /* Whether 'keymodel' contains "stopsel" and "startsel". */ @@ -1223,6 +1219,7 @@ EXTERN int no_hlsearch INIT(= FALSE); #if defined(FEAT_BEVAL) && !defined(NO_X11_INCLUDES) EXTERN BalloonEval *balloonEval INIT(= NULL); +EXTERN int balloonEvalForTerm INIT(= FALSE); # if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP) EXTERN int bevalServers INIT(= 0); # define BEVAL_NETBEANS 0x01 @@ -1340,18 +1337,12 @@ EXTERN int clientWindow INIT(= 0); #if defined(UNIX) || defined(VMS) EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */ #endif -#if defined(UNIX) -EXTERN int xterm_conflict_mouse INIT(= FALSE); -#endif #ifdef BACKSLASH_IN_FILENAME EXTERN char psepc INIT(= '\\'); /* normal path separator character */ EXTERN char psepcN INIT(= '/'); /* abnormal path separator character */ -EXTERN char pseps[2] /* normal path separator string */ -# ifdef DO_INIT - = {'\\', 0} -# endif - ; +/* normal path separator string */ +EXTERN char pseps[2] INIT(= {'\\' COMMA 0}); #endif #ifdef FEAT_VIRTUALEDIT @@ -1425,18 +1416,22 @@ EXTERN char_u e_failed[] INIT(= N_("E472: Command failed")); #if defined(FEAT_GUI) && defined(FEAT_XFONTSET) EXTERN char_u e_fontset[] INIT(= N_("E234: Unknown fontset: %s")); #endif -#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(MACOS) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) +#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) \ + || defined(FEAT_GUI_MACVIM) EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s")); #endif #if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) EXTERN char_u e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); #endif EXTERN char_u e_internal[] INIT(= N_("E473: Internal error")); +EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s")); EXTERN char_u e_interr[] INIT(= N_("Interrupted")); EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address")); EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument")); EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); +EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s")); +EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s")); #ifdef FEAT_EVAL EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); #endif @@ -1448,6 +1443,9 @@ EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); #ifdef FEAT_LIBCALL EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); #endif +#ifdef HAVE_FSYNC +EXTERN char_u e_fsync[] INIT(= N_("E667: Fsync failed")); +#endif #if defined(DYNAMIC_PERL) \ || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \ || defined(DYNAMIC_RUBY) \ @@ -1491,9 +1489,7 @@ EXTERN char_u e_nopresub[] INIT(= N_("E33: No previous substitute regular expres EXTERN char_u e_noprev[] INIT(= N_("E34: No previous command")); EXTERN char_u e_noprevre[] INIT(= N_("E35: No previous regular expression")); EXTERN char_u e_norange[] INIT(= N_("E481: No range allowed")); -#ifdef FEAT_WINDOWS EXTERN char_u e_noroom[] INIT(= N_("E36: Not enough room")); -#endif #ifdef FEAT_CLIENTSERVER EXTERN char_u e_noserver[] INIT(= N_("E247: no registered server named \"%s\"")); #endif @@ -1501,10 +1497,8 @@ EXTERN char_u e_notcreate[] INIT(= N_("E482: Can't create file %s")); EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name")); EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s")); EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s")); -EXTERN char_u e_nowrtmsg[] INIT(= N_("E37: No write since last change (add ! to override)")); -EXTERN char_u e_nowrtmsg_nobang[] INIT(= N_("E37: No write since last change")); EXTERN char_u e_null[] INIT(= N_("E38: Null argument")); -#ifdef FEAT_DIGRAPHS +#if defined(FEAT_DIGRAPHS) || defined(FEAT_TIMERS) EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected")); #endif #ifdef FEAT_QUICKFIX @@ -1533,6 +1527,13 @@ EXTERN char_u e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to ov #ifdef FEAT_EVAL EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\"")); EXTERN char_u e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); +EXTERN char_u e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); +EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required")); +EXTERN char_u e_listidx[] INIT(= N_("E684: list index out of range: %ld")); +EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); +EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); +EXTERN char_u e_listreq[] INIT(= N_("E714: List required")); +EXTERN char_u e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); #endif #ifdef FEAT_QUICKFIX EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); @@ -1541,8 +1542,8 @@ EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox")); #endif EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here")); -#if defined(AMIGA) || defined(MACOS) || defined(MSWIN) \ - || defined(UNIX) || defined(VMS) || defined(OS2) +#if defined(AMIGA) || defined(MACOS_X) || defined(MSWIN) \ + || defined(UNIX) || defined(VMS) EXTERN char_u e_screenmode[] INIT(= N_("E359: Screen mode setting not supported")); #endif EXTERN char_u e_scroll[] INIT(= N_("E49: Invalid scroll size")); @@ -1559,14 +1560,10 @@ EXTERN char_u e_toomany[] INIT(= N_("E77: Too many file names")); EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters")); EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark")); EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards")); -#ifdef FEAT_WINDOWS EXTERN char_u e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'")); -# ifdef FEAT_VERTSPLIT EXTERN char_u e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'")); -# endif -#endif EXTERN char_u e_write[] INIT(= N_("E80: Error while writing")); -EXTERN char_u e_zerocount[] INIT(= N_("Zero count")); +EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required")); #ifdef FEAT_EVAL EXTERN char_u e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context")); #endif @@ -1577,13 +1574,11 @@ EXTERN char_u e_invexprmsg[] INIT(= N_("E449: Invalid expression received")); EXTERN char_u e_guarded[] INIT(= N_("E463: Region is guarded, cannot modify")); EXTERN char_u e_nbreadonly[] INIT(= N_("E744: NetBeans does not allow changes in read-only files")); #endif -EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s")); EXTERN char_u e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'")); EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer")); +EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %ld does not exist")); -#ifdef FEAT_EX_EXTRA EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); -#endif EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); #if defined(FEAT_SYN_HL) || \ (defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC)) @@ -1592,8 +1587,10 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set")); #ifndef FEAT_CLIPBOARD EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); #endif +EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); +EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); -#ifdef MACOS_X_UNIX +#ifdef FEAT_GUI_MAC EXTERN short disallow_gui INIT(= FALSE); #endif @@ -1612,7 +1609,7 @@ EXTERN int xsmp_icefd INIT(= -1); /* The actual connection */ #endif /* For undo we need to know the lowest time possible. */ -EXTERN time_t starttime; +EXTERN time_T starttime; #ifdef STARTUPTIME EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */ @@ -1626,6 +1623,45 @@ EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */ EXTERN int ignored; EXTERN char *ignoredp; +#ifdef FEAT_EVAL +/* set by alloc_fail(): ID */ +EXTERN alloc_id_T alloc_fail_id INIT(= aid_none); +/* set by alloc_fail(), when zero alloc() returns NULL */ +EXTERN int alloc_fail_countdown INIT(= -1); +/* set by alloc_fail(), number of times alloc() returns NULL */ +EXTERN int alloc_fail_repeat INIT(= 0); + +/* flags set by test_override() */ +EXTERN int disable_char_avail_for_testing INIT(= 0); +EXTERN int disable_redraw_for_testing INIT(= 0); + +EXTERN int in_free_unref_items INIT(= FALSE); +#endif + +#ifdef FEAT_TIMERS +EXTERN int did_add_timer INIT(= FALSE); +EXTERN int timer_busy INIT(= 0); /* when timer is inside vgetc() then > 0 */ +#endif + +#ifdef FEAT_BEVAL_TERM +EXTERN int bevalexpr_due_set INIT(= FALSE); +EXTERN proftime_T bevalexpr_due; +#endif + +#ifdef FEAT_EVAL +EXTERN time_T time_for_testing INIT(= 0); + +/* Abort conversion to string after a recursion error. */ +EXTERN int did_echo_string_emsg INIT(= FALSE); + +/* Used for checking if local variables or arguments used in a lambda. */ +EXTERN int *eval_lavars_used INIT(= NULL); +#endif + +#ifdef WIN3264 +EXTERN int ctrl_break_was_pressed INIT(= FALSE); +#endif + /* * Optional Farsi support. Include it here, so EXTERN and INIT are defined. */ diff --git a/src/guess.c b/src/guess.c new file mode 100644 index 0000000000..2371f2d39d --- /dev/null +++ b/src/guess.c @@ -0,0 +1,205 @@ +/* + * guess.c - guessing character encoding + * + * Copyright (c) 2000-2009 Shiro Kawai <shiro@acm.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the authors nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id: guess.c,v 1.6 2008-05-10 13:35:37 shirok Exp $ + */ + +#include <stdio.h> +#include <string.h> +#include "vim.h" + +typedef struct guess_arc_rec { + unsigned int next; /* next state */ + double score; /* score */ +} guess_arc; + +typedef struct guess_dfa_rec { + signed char (*states)[256]; + guess_arc *arcs; + int state; + double score; +} guess_dfa; + +#define DFA_INIT(st, ar) \ + { st, ar, 0, 1.0 } + +#define DFA_NEXT(dfa, ch) \ + do { \ + int arc__; \ + if (dfa.state >= 0) { \ + arc__ = dfa.states[dfa.state][ch]; \ + if (arc__ < 0) { \ + dfa.state = -1; \ + } else { \ + dfa.state = dfa.arcs[arc__].next; \ + dfa.score *= dfa.arcs[arc__].score; \ + } \ + } \ + } while (0) + +#define DFA_ALIVE(dfa) (dfa.state >= 0) + +/* include DFA table generated by guess.scm */ +#include "guess_tab.c" + +static const char *guess_jp(FILE *in, const char *def) +{ + int c; + guess_dfa eucj = DFA_INIT(guess_eucj_st, guess_eucj_ar); + guess_dfa sjis = DFA_INIT(guess_sjis_st, guess_sjis_ar); + guess_dfa utf8 = DFA_INIT(guess_utf8_st, guess_utf8_ar); + guess_dfa *top = NULL; + int sjis_halfwidth_alive = 1; + + while ((c = fgetc(in)) != EOF) { + + /* special treatment of jis escape sequence */ + if (c == 0x1b) { + c = fgetc(in); + if (c == EOF) + break; + if (c == '$' || c == '(') return "iso-2022-jp"; + } + + if (c >= 0x80 && (c < 0xa1 || c > 0xdf)) + sjis_halfwidth_alive = 0; + + if (DFA_ALIVE(eucj)) { + if (!DFA_ALIVE(sjis) && !DFA_ALIVE(utf8)) return "euc-jp"; + DFA_NEXT(eucj, c); + } + if (DFA_ALIVE(sjis)) { + if (!DFA_ALIVE(eucj) && !DFA_ALIVE(utf8)) return "cp932"; + DFA_NEXT(sjis, c); + } + if (DFA_ALIVE(utf8)) { + if (!DFA_ALIVE(sjis) && !DFA_ALIVE(eucj)) return "utf-8"; + DFA_NEXT(utf8, c); + } + + if (!DFA_ALIVE(eucj) && !DFA_ALIVE(sjis) && !DFA_ALIVE(utf8)) { + /* we ran out the possibilities */ + return NULL; + } + } + + if (DFA_ALIVE(eucj) && DFA_ALIVE(sjis) && !DFA_ALIVE(utf8) && + sjis_halfwidth_alive) { + /* non-ASCII chars are only cp932 half width chars */ + return "cp932"; + } + + /* Now, we have ambigous code. Pick the highest score. If more than + one candidate tie, pick the default encoding. */ + if (DFA_ALIVE(eucj)) top = &eucj; + if (DFA_ALIVE(utf8)) { + if (top) { + if (top->score <= utf8.score) top = &utf8; + } else { + top = &utf8; + } + } + if (DFA_ALIVE(sjis)) { + if (top) { + if (top->score < sjis.score) top = &sjis; + } else { + top = &sjis; + } + } + + if (top == &eucj) return "euc-jp"; + if (top == &utf8) return "utf-8"; + if (top == &sjis) return "cp932"; + return NULL; +} + +static const char *guess_bom(FILE *in) +{ + int c, c2, c3; + + c = fgetc(in); + if (c == 0xFE || c == 0xFF) { + c2 = fgetc(in); + if (c == 0xFE && c2 == 0xFF) return "ucs-bom"; + if (c == 0xFF && c2 == 0xFE) return "ucs-bom"; + ungetc(c2, in); + } else if (c == 0xEF) { + c2 = fgetc(in); + c3 = fgetc(in); + if (c2 == 0xBB && c3 == 0xBF) return "ucs-bom"; + ungetc(c3, in); + ungetc(c2, in); + } + ungetc(c, in); + return NULL; +} + +int guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname) +{ + FILE *in; + const char *enc; + + if (p_verbose >= 1) + { + verbose_enter(); + smsg((char_u*)"guess_encode:"); + smsg((char_u*)" init: fenc=%s alloced=%d fname=%s\n", + *fenc, *fenc_alloced, fname); + verbose_leave(); + } + + if (!fname) + return 0; + in = mch_fopen((const char *)fname, "r"); + if (!in) + return 0; + + enc = guess_bom(in); + if (!enc) + enc = guess_jp(in, "utf-8"); + fclose(in); + + if (enc) + { + if (p_verbose >= 1) + { + verbose_enter(); + smsg((char_u*)" result: newenc=%s\n", enc); + verbose_leave(); + } + if (*fenc_alloced) + vim_free(*fenc); + *fenc = vim_strsave((char_u*)enc); + *fenc_alloced = TRUE; + } + return 1; +} diff --git a/src/guess_tab.c b/src/guess_tab.c new file mode 100644 index 0000000000..0d6c154bc3 --- /dev/null +++ b/src/guess_tab.c @@ -0,0 +1,261 @@ +/* State transition table for character code guessing */ +/* This file is automatically generated by guess.scm */ + +static signed char guess_eucj_st[][256] = { + { /* state init */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1, + }, + { /* state jis0201_kana */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, + { /* state jis0213_1 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, + }, + { /* state jis0213_2 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, -1, + }, +}; + +static guess_arc guess_eucj_ar[] = { + { 0, 1.0 }, /* init -> init */ + { 1, 0.8 }, /* init -> jis0201_kana */ + { 3, 0.95 }, /* init -> jis0213_2 */ + { 2, 1.0 }, /* init -> jis0213_1 */ + { 0, 1.0 }, /* jis0201_kana -> init */ + { 0, 1.0 }, /* jis0213_1 -> init */ + { 0, 1.0 }, /* jis0213_2 -> init */ +}; + +static signed char guess_sjis_st[][256] = { + { /* state init */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, + }, + { /* state jis0213 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, -1, -1, + }, +}; + +static guess_arc guess_sjis_ar[] = { + { 0, 1.0 }, /* init -> init */ + { 1, 1.0 }, /* init -> jis0213 */ + { 0, 0.8 }, /* init -> init */ + { 1, 0.95 }, /* init -> jis0213 */ + { 0, 0.8 }, /* init -> init */ + { 0, 1.0 }, /* jis0213 -> init */ +}; + +static signed char guess_utf8_st[][256] = { + { /* state init */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, -1, -1, + }, + { /* state 1byte_more */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, + { /* state 2byte_more */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, + { /* state 3byte_more */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, + { /* state 4byte_more */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, + { /* state 5byte_more */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }, +}; + +static guess_arc guess_utf8_ar[] = { + { 0, 1.0 }, /* init -> init */ + { 1, 1.0 }, /* init -> 1byte_more */ + { 2, 1.0 }, /* init -> 2byte_more */ + { 3, 1.0 }, /* init -> 3byte_more */ + { 4, 1.0 }, /* init -> 4byte_more */ + { 5, 1.0 }, /* init -> 5byte_more */ + { 0, 1.0 }, /* 1byte_more -> init */ + { 1, 1.0 }, /* 2byte_more -> 1byte_more */ + { 2, 1.0 }, /* 3byte_more -> 2byte_more */ + { 3, 1.0 }, /* 4byte_more -> 3byte_more */ + { 4, 1.0 }, /* 5byte_more -> 4byte_more */ +}; + diff --git a/src/gui.c b/src/gui.c index 57c2b20985..39d296bfd9 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -14,34 +14,33 @@ gui_T gui; #if defined(FEAT_MBYTE) && !defined(FEAT_GUI_GTK) -static void set_guifontwide __ARGS((char_u *font_name)); +static void set_guifontwide(char_u *font_name); #endif -static void gui_check_pos __ARGS((void)); -static void gui_position_components __ARGS((int)); -static void gui_outstr __ARGS((char_u *, int)); -static int gui_screenchar __ARGS((int off, int flags, guicolor_T fg, guicolor_T bg, int back)); +static void gui_check_pos(void); +static void gui_position_components(int); +static void gui_outstr(char_u *, int); +static int gui_screenchar(int off, int flags, guicolor_T fg, guicolor_T bg, int back); #ifdef FEAT_GUI_GTK -static int gui_screenstr __ARGS((int off, int len, int flags, guicolor_T fg, guicolor_T bg, int back)); +static int gui_screenstr(int off, int len, int flags, guicolor_T fg, guicolor_T bg, int back); #endif -static void gui_delete_lines __ARGS((int row, int count)); -static void gui_insert_lines __ARGS((int row, int count)); -static void fill_mouse_coord __ARGS((char_u *p, int col, int row)); +static void gui_delete_lines(int row, int count); +static void gui_insert_lines(int row, int count); +static void fill_mouse_coord(char_u *p, int col, int row); #if defined(FEAT_GUI_TABLINE) || defined(PROTO) -static int gui_has_tabline __ARGS((void)); +static int gui_has_tabline(void); #endif -static void gui_do_scrollbar __ARGS((win_T *wp, int which, int enable)); -static colnr_T scroll_line_len __ARGS((linenr_T lnum)); -static linenr_T gui_find_longest_lnum __ARGS((void)); -static void gui_update_horiz_scrollbar __ARGS((int)); -static void gui_set_fg_color __ARGS((char_u *name)); -static void gui_set_bg_color __ARGS((char_u *name)); -static win_T *xy2win __ARGS((int x, int y)); +static void gui_do_scrollbar(win_T *wp, int which, int enable); +static colnr_T scroll_line_len(linenr_T lnum); +static linenr_T gui_find_longest_lnum(void); +static void gui_update_horiz_scrollbar(int); +static void gui_set_fg_color(char_u *name); +static void gui_set_bg_color(char_u *name); +static win_T *xy2win(int x, int y); -#if defined(UNIX) && !defined(MACOS_X) && !defined(__APPLE__) -# define MAY_FORK -static void gui_do_fork __ARGS((void)); +#ifdef GUI_MAY_FORK +static void gui_do_fork(void); -static int gui_read_child_pipe __ARGS((int fd)); +static int gui_read_child_pipe(int fd); /* Return values for gui_read_child_pipe */ enum { @@ -49,12 +48,12 @@ enum { GUI_CHILD_OK, GUI_CHILD_FAILED }; +#endif -#endif /* MAY_FORK */ - -static void gui_attempt_start __ARGS((void)); +static void gui_attempt_start(void); static int can_update_cursor = TRUE; /* can display the cursor */ +static int disable_flush = 0; /* If > 0, gui_mch_flush() is disabled. */ /* * The Athena scrollbars can move the thumb to after the end of the scrollbar, @@ -73,7 +72,7 @@ static int can_update_cursor = TRUE; /* can display the cursor */ * recursive call. */ void -gui_start() +gui_start(void) { char_u *old_term; static int recursive = 0; @@ -87,14 +86,20 @@ gui_start() ++recursive; -#ifdef MAY_FORK +#ifdef GUI_MAY_FORK /* * Quit the current process and continue in the child. * Makes "gvim file" disconnect from the shell it was started in. * Don't do this when Vim was started with "-f" or the 'f' flag is present * in 'guioptions'. + * Don't do this when there is a running job, we can only get the status + * of a child from the parent. */ - if (gui.dofork && !vim_strchr(p_go, GO_FORG) && recursive <= 1) + if (gui.dofork && !vim_strchr(p_go, GO_FORG) && recursive <= 1 +# ifdef FEAT_JOB_CHANNEL + && !job_any_running() +# endif + ) { gui_do_fork(); } @@ -105,7 +110,7 @@ gui_start() /* If there is 'f' in 'guioptions' and specify -g argument, * gui_mch_init_check() was not called yet. */ if (gui_mch_init_check() != OK) - exit(1); + getout_preserve_modified(1); #endif gui_attempt_start(); } @@ -131,13 +136,11 @@ gui_start() vim_free(old_term); -#ifdef FEAT_AUTOCMD /* If the GUI started successfully, trigger the GUIEnter event, otherwise * the GUIFailed event. */ gui_mch_update(); apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED, NULL, NULL, FALSE, curbuf); -#endif --recursive; } @@ -152,7 +155,7 @@ gui_start() * full_screen will be set to TRUE again by a successful termcapinit(). */ static void -gui_attempt_start() +gui_attempt_start(void) { static int recursive = 0; @@ -184,7 +187,7 @@ gui_attempt_start() --recursive; } -#ifdef MAY_FORK +#ifdef GUI_MAY_FORK /* for waitpid() */ # if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT) @@ -204,7 +207,7 @@ gui_attempt_start() * and the child will return. */ static void -gui_do_fork() +gui_do_fork(void) { int pipefd[2]; /* pipe between parent and child */ int pipe_error; @@ -272,7 +275,7 @@ gui_do_fork() #ifdef FEAT_GUI_GTK /* Call gtk_init_check() here after fork(). See gui_init_check(). */ if (gui_mch_init_check() != OK) - exit(1); + getout_preserve_modified(1); #endif # if defined(HAVE_SETSID) || defined(HAVE_SETPGID) @@ -309,7 +312,7 @@ gui_do_fork() /* If we failed to start the GUI, exit now. */ if (!gui.in_use) - exit(1); + getout_preserve_modified(1); } /* @@ -339,15 +342,13 @@ gui_read_child_pipe(int fd) return GUI_CHILD_FAILED; } -#endif /* MAY_FORK */ +#endif /* GUI_MAY_FORK */ /* * Call this when vim starts up, whether or not the GUI is started */ void -gui_prepare(argc, argv) - int *argc; - char **argv; +gui_prepare(int *argc, char **argv) { gui.in_use = FALSE; /* No GUI yet (maybe later) */ gui.starting = FALSE; /* No GUI yet (maybe later) */ @@ -361,7 +362,7 @@ gui_prepare(argc, argv) * Returns FAIL or OK. */ int -gui_init_check() +gui_init_check(void) { static int result = MAYBE; @@ -449,7 +450,7 @@ gui_init_check() * See gui_do_fork(). * Use a simpler check if the GUI window can probably be opened. */ - result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check(); + result = gui.dofork ? gui_mch_early_init_check(TRUE) : gui_mch_init_check(); # else result = gui_mch_init_check(); # endif @@ -461,7 +462,7 @@ gui_init_check() * This is the call which starts the GUI. */ void -gui_init() +gui_init(void) { win_T *wp; static int recursive = 0; @@ -573,7 +574,7 @@ gui_init() { #ifdef UNIX { - struct stat s; + stat_T s; /* if ".gvimrc" file is not owned by user, set 'secure' * mode */ @@ -632,7 +633,7 @@ gui_init() * where Vim was started. */ emsg_on_display = FALSE; msg_scrolled = 0; - clear_sb_text(); + clear_sb_text(TRUE); need_wait_return = FALSE; msg_didany = FALSE; @@ -695,7 +696,7 @@ gui_init() #ifndef FEAT_GUI_GTK /* Set the shell size, adjusted for the screen size. For GTK this only * works after the shell has been opened, thus it is further down. */ - gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); + gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH); #endif #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) /* Need to set the size of the menubar after all the menus have been @@ -734,15 +735,18 @@ gui_init() # endif /* Now make sure the shell fits on the screen. */ - gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); + gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH); #endif /* When 'lines' was set while starting up the topframe may have to be * resized. */ win_new_shellsize(); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI /* Always create the Balloon Evaluation area, but disable it when - * 'ballooneval' is off */ + * 'ballooneval' is off. */ + if (balloonEval != NULL) + vim_free(balloonEval); + balloonEvalForTerm = FALSE; # ifdef FEAT_GUI_GTK balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL, &general_beval_cb, NULL); @@ -792,8 +796,7 @@ gui_init() void -gui_exit(rc) - int rc; +gui_exit(int rc) { /* don't free the fonts, it leads to a BUS error * richard@whitequeen.com Jul 99 */ @@ -813,7 +816,7 @@ gui_exit(rc) * When this function returns, Vim should NOT exit! */ void -gui_shell_closed() +gui_shell_closed(void) { cmdmod_T save_cmdmod; @@ -829,7 +832,7 @@ gui_shell_closed() # endif /* If there are changed buffers, present the user with a dialog if * possible, otherwise give an error message. */ - if (!check_changed_any(FALSE)) + if (!check_changed_any(FALSE, FALSE)) getout(0); exiting = FALSE; @@ -847,9 +850,7 @@ gui_shell_closed() * the fonts are unchanged. */ int -gui_init_font(font_list, fontset) - char_u *font_list; - int fontset UNUSED; +gui_init_font(char_u *font_list, int fontset UNUSED) { #define FONTLEN 320 char_u font_name[FONTLEN]; @@ -929,7 +930,7 @@ gui_init_font(font_list, fontset) # endif gui_mch_set_font(gui.norm_font); #endif - gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); + gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH); } return ret; @@ -941,8 +942,7 @@ gui_init_font(font_list, fontset) * Try setting 'guifontwide' to a font twice as wide as "name". */ static void -set_guifontwide(name) - char_u *name; +set_guifontwide(char_u *name) { int i = 0; char_u wide_name[FONTLEN + 10]; /* room for 2 * width and '*' */ @@ -991,7 +991,7 @@ set_guifontwide(name) * Return FAIL for an invalid font name. */ int -gui_get_wide_font() +gui_get_wide_font(void) { GuiFont font = NOFONT; char_u font_name[FONTLEN]; @@ -1039,9 +1039,7 @@ gui_get_wide_font() #endif void -gui_set_cursor(row, col) - int row; - int col; +gui_set_cursor(int row, int col) { gui.row = row; gui.col = col; @@ -1051,7 +1049,7 @@ gui_set_cursor(row, col) * gui_check_pos - check if the cursor is on the screen. */ static void -gui_check_pos() +gui_check_pos(void) { if (gui.row >= screen_Rows) gui.row = screen_Rows - 1; @@ -1067,15 +1065,19 @@ gui_check_pos() * otherwise this goes wrong. May need to call out_flush() first. */ void -gui_update_cursor(force, clear_selection) - int force; /* when TRUE, update even when not moved */ - int clear_selection;/* clear selection under cursor */ +gui_update_cursor( + int force, /* when TRUE, update even when not moved */ + int clear_selection)/* clear selection under cursor */ { int cur_width = 0; int cur_height = 0; int old_hl_mask; - int idx; + cursorentry_T *shape; int id; +#ifdef FEAT_TERMINAL + guicolor_T shape_fg = INVALCOLOR; + guicolor_T shape_bg = INVALCOLOR; +#endif guicolor_T cfg, cbg, cc; /* cursor fore-/background color */ int cattr; /* cursor attributes */ int attr; @@ -1094,7 +1096,7 @@ gui_update_cursor(force, clear_selection) gui_undraw_cursor(); if (gui.row < 0) return; -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD if (gui.row != gui.cursor_row || gui.col != gui.cursor_col) im_set_position(gui.row, gui.col); #endif @@ -1117,30 +1119,48 @@ gui_update_cursor(force, clear_selection) /* * How the cursor is drawn depends on the current mode. + * When in a terminal window use the shape/color specified there. */ - idx = get_shape_idx(FALSE); +#ifdef FEAT_TERMINAL + if (terminal_is_active()) + shape = term_get_cursor_shape(&shape_fg, &shape_bg); + else +#endif + shape = &shape_table[get_shape_idx(FALSE)]; if (State & LANGMAP) - id = shape_table[idx].id_lm; + id = shape->id_lm; else - id = shape_table[idx].id; + id = shape->id; /* get the colors and attributes for the cursor. Default is inverted */ cfg = INVALCOLOR; cbg = INVALCOLOR; cattr = HL_INVERSE; - gui_mch_set_blinking(shape_table[idx].blinkwait, - shape_table[idx].blinkon, - shape_table[idx].blinkoff); + gui_mch_set_blinking(shape->blinkwait, + shape->blinkon, + shape->blinkoff); + if (shape->blinkwait == 0 || shape->blinkon == 0 + || shape->blinkoff == 0) + gui_mch_stop_blink(FALSE); +#ifdef FEAT_TERMINAL + if (shape_bg != INVALCOLOR) + { + cattr = 0; + cfg = shape_fg; + cbg = shape_bg; + } + else +#endif if (id > 0) { cattr = syn_id2colors(id, &cfg, &cbg); -#if defined(USE_IM_CONTROL) || defined(FEAT_HANGULIN) +#if defined(HAVE_INPUT_METHOD) || defined(FEAT_HANGULIN) { static int iid; guicolor_T fg, bg; if ( -# if defined(FEAT_GUI_GTK) && !defined(FEAT_HANGULIN) +# if defined(FEAT_GUI_GTK) && defined(FEAT_XIM) && !defined(FEAT_HANGULIN) preedit_get_status() # else im_get_status() @@ -1225,7 +1245,7 @@ gui_update_cursor(force, clear_selection) } old_hl_mask = gui.highlight_mask; - if (shape_table[idx].shape == SHAPE_BLOCK + if (shape->shape == SHAPE_BLOCK #ifdef FEAT_HANGULIN || composing_hangul #endif @@ -1238,8 +1258,19 @@ gui_update_cursor(force, clear_selection) gui.highlight_mask = (cattr | attr); #ifdef FEAT_HANGULIN if (composing_hangul) - (void)gui_outstr_nowrap(composing_hangul_buffer, 2, - GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, cfg, cbg, 0); + { + char_u *comp_buf; + int comp_len; + + comp_buf = hangul_composing_buffer_get(&comp_len); + if (comp_buf) + { + (void)gui_outstr_nowrap(comp_buf, comp_len, + GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, + cfg, cbg, 0); + vim_free(comp_buf); + } + } else #endif (void)gui_screenchar(LineOffset[gui.row] + gui.col, @@ -1254,16 +1285,14 @@ gui_update_cursor(force, clear_selection) * First draw the partial cursor, then overwrite with the text * character, using a transparent background. */ - if (shape_table[idx].shape == SHAPE_VER) + if (shape->shape == SHAPE_VER) { cur_height = gui.char_height; - cur_width = (gui.char_width * shape_table[idx].percentage - + 99) / 100; + cur_width = (gui.char_width * shape->percentage + 99) / 100; } else { - cur_height = (gui.char_height * shape_table[idx].percentage - + 99) / 100; + cur_height = (gui.char_height * shape->percentage + 99) / 100; cur_width = gui.char_width; } #ifdef FEAT_MBYTE @@ -1271,7 +1300,7 @@ gui_update_cursor(force, clear_selection) LineOffset[gui.row] + screen_Columns) > 1) { /* Double wide character. */ - if (shape_table[idx].shape != SHAPE_VER) + if (shape->shape != SHAPE_VER) cur_width += gui.char_width; # ifdef FEAT_RIGHTLEFT if (CURSOR_BAR_RIGHT) @@ -1305,7 +1334,7 @@ gui_update_cursor(force, clear_selection) #if defined(FEAT_MENU) || defined(PROTO) void -gui_position_menu() +gui_position_menu(void) { # if !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_MACVIM)) @@ -1320,8 +1349,7 @@ gui_position_menu() * scrollbars are NOT handled here. See gui_update_scrollbars(). */ static void -gui_position_components(total_width) - int total_width UNUSED; +gui_position_components(int total_width UNUSED) { int text_area_x; int text_area_y; @@ -1394,7 +1422,7 @@ gui_position_components(total_width) * Get the width of the widgets and decorations to the side of the text area. */ int -gui_get_base_width() +gui_get_base_width(void) { int base_width; @@ -1410,7 +1438,7 @@ gui_get_base_width() * Get the height of the widgets and decorations above and below the text area. */ int -gui_get_base_height() +gui_get_base_height(void) { int base_height; @@ -1455,9 +1483,7 @@ gui_get_base_height() * the new width and height of the shell in pixels. */ void -gui_resize_shell(pixel_width, pixel_height) - int pixel_width; - int pixel_height; +gui_resize_shell(int pixel_width, int pixel_height) { static int busy = FALSE; @@ -1476,6 +1502,8 @@ gui_resize_shell(pixel_width, pixel_height) } again: + new_pixel_width = 0; + new_pixel_height = 0; busy = TRUE; /* Flush pending output before redrawing */ @@ -1485,8 +1513,8 @@ gui_resize_shell(pixel_width, pixel_height) gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height; gui_position_components(pixel_width); - gui_reset_scroll_region(); + /* * At the "more" and ":confirm" prompt there is no redraw, put the cursor * at the last line here (why does it have to be one row too low?). @@ -1508,17 +1536,22 @@ gui_resize_shell(pixel_width, pixel_height) busy = FALSE; - /* - * We could have been called again while redrawing the screen. - * Need to do it all again with the latest size then. - */ + /* We may have been called again while redrawing the screen. + * Need to do it all again with the latest size then. But only if the size + * actually changed. */ if (new_pixel_height) { - pixel_width = new_pixel_width; - pixel_height = new_pixel_height; - new_pixel_width = 0; - new_pixel_height = 0; - goto again; + if (pixel_width == new_pixel_width && pixel_height == new_pixel_height) + { + new_pixel_width = 0; + new_pixel_height = 0; + } + else + { + pixel_width = new_pixel_width; + pixel_height = new_pixel_height; + goto again; + } } } @@ -1526,24 +1559,16 @@ gui_resize_shell(pixel_width, pixel_height) * Check if gui_resize_shell() must be called. */ void -gui_may_resize_shell() +gui_may_resize_shell(void) { - int h, w; - if (new_pixel_height) - { /* careful: gui_resize_shell() may postpone the resize again if we * were called indirectly by it */ - w = new_pixel_width; - h = new_pixel_height; - new_pixel_width = 0; - new_pixel_height = 0; - gui_resize_shell(w, h); - } + gui_resize_shell(new_pixel_width, new_pixel_height); } int -gui_get_shellsize() +gui_get_shellsize(void) { Rows = gui.num_rows; Columns = gui.num_cols; @@ -1554,12 +1579,14 @@ gui_get_shellsize() * Set the size of the Vim shell according to Rows and Columns. * If "fit_to_display" is TRUE then the size may be reduced to fit the window * on the screen. + * When "mustset" is TRUE the size was set by the user. When FALSE a UI + * component was added or removed (e.g., a scrollbar). */ void -gui_set_shellsize(mustset, fit_to_display, direction) - int mustset UNUSED; /* set by the user */ - int fit_to_display; - int direction; /* RESIZE_HOR, RESIZE_VER */ +gui_set_shellsize( + int mustset UNUSED, + int fit_to_display, + int direction) /* RESIZE_HOR, RESIZE_VER */ { int base_width; int base_height; @@ -1581,7 +1608,8 @@ gui_set_shellsize(mustset, fit_to_display, direction) #if defined(MSWIN) || defined(FEAT_GUI_GTK) /* If not setting to a user specified size and maximized, calculate the * number of characters that fit in the maximized window. */ - if (!mustset && gui_mch_maximized()) + if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL + || gui_mch_maximized())) { gui_mch_newfont(); return; @@ -1592,7 +1620,7 @@ gui_set_shellsize(mustset, fit_to_display, direction) base_height = gui_get_base_height(); if (fit_to_display) /* Remember the original window position. */ - gui_mch_get_winpos(&x, &y); + (void)gui_mch_get_winpos(&x, &y); #ifdef USE_SUN_WORKSHOP if (!mustset && usingSunWorkShop @@ -1643,9 +1671,7 @@ gui_set_shellsize(mustset, fit_to_display, direction) min_width = base_width + MIN_COLUMNS * gui.char_width; min_height = base_height + MIN_LINES * gui.char_height; -#ifdef FEAT_WINDOWS min_height += tabline_height() * gui.char_height; -#endif #ifdef FEAT_GUI_GTK if (un_maximize) @@ -1682,7 +1708,7 @@ gui_set_shellsize(mustset, fit_to_display, direction) * Called when Rows and/or Columns has changed. */ void -gui_new_shellsize() +gui_new_shellsize(void) { gui_reset_scroll_region(); } @@ -1691,7 +1717,7 @@ gui_new_shellsize() * Make scroll region cover whole screen. */ void -gui_reset_scroll_region() +gui_reset_scroll_region(void) { gui.scroll_region_top = 0; gui.scroll_region_bot = gui.num_rows - 1; @@ -1700,8 +1726,7 @@ gui_reset_scroll_region() } void -gui_start_highlight(mask) - int mask; +gui_start_highlight(int mask) { if (mask > HL_ALL) /* highlight code */ gui.highlight_mask = mask; @@ -1710,8 +1735,7 @@ gui_start_highlight(mask) } void -gui_stop_highlight(mask) - int mask; +gui_stop_highlight(int mask) { if (mask > HL_ALL) /* highlight code */ gui.highlight_mask = HL_NORMAL; @@ -1724,11 +1748,11 @@ gui_stop_highlight(mask) * (row2, col2) inclusive. */ void -gui_clear_block(row1, col1, row2, col2) - int row1; - int col1; - int row2; - int col2; +gui_clear_block( + int row1, + int col1, + int row2, + int col2) { /* Clear the selection if we are about to write over it */ clip_may_clear_selection(row1, row2); @@ -1746,15 +1770,15 @@ gui_clear_block(row1, col1, row2, col2) * output buffer before calling gui_update_cursor(). */ void -gui_update_cursor_later() +gui_update_cursor_later(void) { OUT_STR(IF_EB("\033|s", ESC_STR "|s")); } void -gui_write(s, len) - char_u *s; - int len; +gui_write( + char_u *s, + int len) { char_u *p; int arg1 = 0, arg2 = 0; @@ -1792,7 +1816,7 @@ gui_write(s, len) if (s[0] == ESC && s[1] == '|') { p = s + 2; - if (VIM_ISDIGIT(*p)) + if (VIM_ISDIGIT(*p) || (*p == '-' && VIM_ISDIGIT(*(p + 1)))) { arg1 = getdigits(&p); if (p > s + len) @@ -1831,7 +1855,6 @@ gui_write(s, len) gui.scroll_region_bot = arg1; } break; -#ifdef FEAT_VERTSPLIT case 'V': /* Set vertical scroll region */ if (arg1 < arg2) { @@ -1844,7 +1867,6 @@ gui_write(s, len) gui.scroll_region_right = arg1; } break; -#endif case 'd': /* Delete line */ gui_delete_lines(gui.row, 1); break; @@ -1974,7 +1996,7 @@ gui_write(s, len) gui.dragged_sb = SBAR_NONE; #endif - gui_mch_flush(); /* In case vim decides to take a nap */ + gui_may_flush(); /* In case vim decides to take a nap */ } /* @@ -1983,28 +2005,55 @@ gui_write(s, len) * gui_can_update_cursor() afterwards. */ void -gui_dont_update_cursor() +gui_dont_update_cursor(int undraw) { if (gui.in_use) { /* Undraw the cursor now, we probably can't do it after the change. */ - gui_undraw_cursor(); + if (undraw) + gui_undraw_cursor(); can_update_cursor = FALSE; } } void -gui_can_update_cursor() +gui_can_update_cursor(void) { can_update_cursor = TRUE; /* No need to update the cursor right now, there is always more output * after scrolling. */ } +/* + * Disable issuing gui_mch_flush(). + */ + void +gui_disable_flush(void) +{ + ++disable_flush; +} + +/* + * Enable issuing gui_mch_flush(). + */ + void +gui_enable_flush(void) +{ + --disable_flush; +} + +/* + * Issue gui_mch_flush() if it is not disabled. + */ + void +gui_may_flush(void) +{ + if (disable_flush == 0) + gui_mch_flush(); +} + static void -gui_outstr(s, len) - char_u *s; - int len; +gui_outstr(char_u *s, int len) { int this_len; #ifdef FEAT_MBYTE @@ -2066,11 +2115,12 @@ gui_outstr(s, len) * Returns FAIL or OK, just like gui_outstr_nowrap(). */ static int -gui_screenchar(off, flags, fg, bg, back) - int off; /* Offset from start of screen */ - int flags; - guicolor_T fg, bg; /* colors for cursor */ - int back; /* backup this many chars when using bold trick */ +gui_screenchar( + int off, /* Offset from start of screen */ + int flags, + guicolor_T fg, /* colors for cursor */ + guicolor_T bg, /* colors for cursor */ + int back) /* backup this many chars when using bold trick */ { #ifdef FEAT_MBYTE char_u buf[MB_MAXBYTES + 1]; @@ -2107,12 +2157,13 @@ gui_screenchar(off, flags, fg, bg, back) * as possible to work nicely. It's a lot faster as well. */ static int -gui_screenstr(off, len, flags, fg, bg, back) - int off; /* Offset from start of screen */ - int len; /* string length in screen cells */ - int flags; - guicolor_T fg, bg; /* colors for cursor */ - int back; /* backup this many chars when using bold trick */ +gui_screenstr( + int off, /* Offset from start of screen */ + int len, /* string length in screen cells */ + int flags, + guicolor_T fg, /* colors for cursor */ + guicolor_T bg, /* colors for cursor */ + int back) /* backup this many chars when using bold trick */ { char_u *buf; int outlen = 0; @@ -2190,19 +2241,20 @@ gui_screenstr(off, len, flags, fg, bg, back) * FAIL (the caller should start drawing "back" chars back). */ int -gui_outstr_nowrap(s, len, flags, fg, bg, back) - char_u *s; - int len; - int flags; - guicolor_T fg, bg; /* colors for cursor */ - int back; /* backup this many chars when using bold trick */ +gui_outstr_nowrap( + char_u *s, + int len, + int flags, + guicolor_T fg, /* colors for cursor */ + guicolor_T bg, /* colors for cursor */ + int back) /* backup this many chars when using bold trick */ { long_u highlight_mask; long_u hl_mask_todo; guicolor_T fg_color; guicolor_T bg_color; guicolor_T sp_color; -#if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK) +#if !defined(FEAT_GUI_GTK) GuiFont font = NOFONT; # ifdef FEAT_MBYTE GuiFont wide_font = NOFONT; @@ -2259,7 +2311,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) highlight_mask = gui.highlight_mask; hl_mask_todo = highlight_mask; -#if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK) +#if !defined(FEAT_GUI_GTK) /* Set the font */ if (aep != NULL && aep->ae_u.gui.font != NOFONT) font = aep->ae_u.gui.font; @@ -2376,11 +2428,9 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) clip_may_clear_selection(gui.row, gui.row); -#ifndef MSWIN16_FASTTEXT /* If there's no bold font, then fake it */ if (hl_mask_todo & (HL_BOLD | HL_STANDOUT)) draw_flags |= DRAW_BOLD; -#endif /* * When drawing bold or italic characters the spill-over from the left @@ -2399,19 +2449,25 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) /* Do we underline the text? */ if (hl_mask_todo & HL_UNDERLINE) draw_flags |= DRAW_UNDERL; + +# if defined(FEAT_GUI_MACVIM) + /* Do we thick underline the text? */ + if (hl_mask_todo & HL_THICKUNDERLINE) + draw_flags |= DRAW_TUNDERL; +# endif #else /* Do we underline the text? */ - if ((hl_mask_todo & HL_UNDERLINE) -# ifndef MSWIN16_FASTTEXT - || (hl_mask_todo & HL_ITALIC) -# endif - ) + if ((hl_mask_todo & HL_UNDERLINE) || (hl_mask_todo & HL_ITALIC)) draw_flags |= DRAW_UNDERL; #endif /* Do we undercurl the text? */ if (hl_mask_todo & HL_UNDERCURL) draw_flags |= DRAW_UNDERC; + /* Do we strikethrough the text? */ + if (hl_mask_todo & HL_STRIKETHROUGH) + draw_flags |= DRAW_STRIKE; + /* Do we draw transparently? */ if (flags & GUI_MON_TRS_CURSOR) draw_flags |= DRAW_TRANSP; @@ -2422,16 +2478,11 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) #ifdef FEAT_GUI_GTK /* The value returned is the length in display cells */ len = gui_gtk2_draw_string(gui.row, col, s, len, draw_flags); +#elif defined(FEAT_GUI_MACVIM) + /* The value returned is the length in display cells */ + len = gui_macvim_draw_string(gui.row, col, s, len, draw_flags); #else # ifdef FEAT_MBYTE -# ifdef FEAT_GUI_MACVIM - if (use_gui_macvim_draw_string) - { - /* The value returned is the length in display cells */ - len = gui_macvim_draw_string(gui.row, col, s, len, draw_flags); - } - else -# endif if (enc_utf8) { int start; /* index of bytes to be drawn */ @@ -2443,9 +2494,14 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) int cl; /* byte length of current char */ int comping; /* current char is composing */ int scol = col; /* screen column */ - int curr_wide; /* use 'guifontwide' */ + int curr_wide = FALSE; /* use 'guifontwide' */ int prev_wide = FALSE; int wide_changed; +# ifdef WIN3264 + int sep_comp = FALSE; /* Don't separate composing chars. */ +# else + int sep_comp = TRUE; /* Separate composing chars. */ +# endif /* Break the string at a composing character, it has to be drawn on * top of the previous character. */ @@ -2455,21 +2511,20 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) { c = utf_ptr2char(s + i); cn = utf_char2cells(c); -# ifdef FEAT_GUI_MACVIM - curr_wide = (cn > 1); -# else - if (cn > 1 -# ifdef FEAT_XFONTSET - && fontset == NOFONTSET -# endif - && wide_font != NOFONT) - curr_wide = TRUE; - else - curr_wide = FALSE; -# endif comping = utf_iscomposing(c); if (!comping) /* count cells from non-composing chars */ cells += cn; + if (!comping || sep_comp) + { + if (cn > 1 +# ifdef FEAT_XFONTSET + && fontset == NOFONTSET +# endif + && wide_font != NOFONT) + curr_wide = TRUE; + else + curr_wide = FALSE; + } cl = utf_ptr2len(s + i); if (cl == 0) /* hit end of string */ len = i + cl; /* len must be wrong "cannot happen" */ @@ -2478,7 +2533,8 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) /* Print the string so far if it's the last character or there is * a composing character. */ - if (i + cl >= len || (comping && i > start) || wide_changed + if (i + cl >= len || (comping && sep_comp && i > start) + || wide_changed # if defined(FEAT_GUI_X11) || (cn > 1 # ifdef FEAT_XFONTSET @@ -2490,7 +2546,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) # endif ) { - if (comping || wide_changed) + if ((comping && sep_comp) || wide_changed) thislen = i - start; else thislen = i - start + cl; @@ -2499,13 +2555,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) if (prev_wide) gui_mch_set_font(wide_font); gui_mch_draw_string(gui.row, scol, s + start, thislen, -# ifdef FEAT_GUI_MACVIM - cells, - draw_flags | (prev_wide ? DRAW_WIDE : 0) -# else - draw_flag -# endif - ); + draw_flags); if (prev_wide) gui_mch_set_font(font); start += thislen; @@ -2514,7 +2564,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) cells = 0; /* Adjust to not draw a character which width is changed * against with last one. */ - if (wide_changed && !comping) + if (wide_changed && !(comping && sep_comp)) { scol -= cn; cl = 0; @@ -2533,19 +2583,15 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) # endif } /* Draw a composing char on top of the previous char. */ - if (comping) + if (comping && sep_comp) { -# if !defined(FEAT_GUI_MACVIM) && \ - (defined(__APPLE_CC__) || defined(__MRC__)) && TARGET_API_MAC_CARBON +# if defined(__APPLE_CC__) && TARGET_API_MAC_CARBON /* Carbon ATSUI autodraws composing char over previous char */ gui_mch_draw_string(gui.row, scol, s + i, cl, draw_flags | DRAW_TRANSP); # else gui_mch_draw_string(gui.row, scol - cn, s + i, cl, -# ifdef FEAT_GUI_MACVIM - 0, -# endif - draw_flags | DRAW_TRANSP | DRAW_COMP); + draw_flags | DRAW_TRANSP); # endif start = i + cl; } @@ -2557,11 +2603,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) else # endif { - gui_mch_draw_string(gui.row, col, s, len, -# ifdef FEAT_GUI_MACVIM - len, -# endif - draw_flags); + gui_mch_draw_string(gui.row, col, s, len, draw_flags); # ifdef FEAT_MBYTE if (enc_dbcs == DBCS_JPNU) { @@ -2608,16 +2650,26 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) * position. The character just before it too, for when it was in bold. */ void -gui_undraw_cursor() +gui_undraw_cursor(void) { if (gui.cursor_is_valid) { #ifdef FEAT_HANGULIN if (composing_hangul && gui.col == gui.cursor_col && gui.row == gui.cursor_row) - (void)gui_outstr_nowrap(composing_hangul_buffer, 2, - GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, - gui.norm_pixel, gui.back_pixel, 0); + { + char_u *comp_buf; + int comp_len; + + comp_buf = hangul_composing_buffer_get(&comp_len); + if (comp_buf) + { + (void)gui_outstr_nowrap(comp_buf, comp_len, + GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, + gui.norm_pixel, gui.back_pixel, 0); + vim_free(comp_buf); + } + } else { #endif @@ -2639,11 +2691,11 @@ gui_undraw_cursor() } void -gui_redraw(x, y, w, h) - int x; - int y; - int w; - int h; +gui_redraw( + int x, + int y, + int w, + int h) { int row1, col1, row2, col2; @@ -2672,12 +2724,12 @@ gui_redraw(x, y, w, h) * different attributes (may have to be redrawn too). */ int -gui_redraw_block(row1, col1, row2, col2, flags) - int row1; - int col1; - int row2; - int col2; - int flags; /* flags for gui_outstr_nowrap() */ +gui_redraw_block( + int row1, + int col1, + int row2, + int col2, + int flags) /* flags for gui_outstr_nowrap() */ { int old_row, old_col; long_u old_hl_mask; @@ -2836,9 +2888,7 @@ gui_redraw_block(row1, col1, row2, col2, flags) } static void -gui_delete_lines(row, count) - int row; - int count; +gui_delete_lines(int row, int count) { if (count <= 0) return; @@ -2866,9 +2916,7 @@ gui_delete_lines(row, count) } static void -gui_insert_lines(row, count) - int row; - int count; +gui_insert_lines(int row, int count) { if (count <= 0) return; @@ -2893,6 +2941,34 @@ gui_insert_lines(row, count) } } +#ifdef FEAT_TIMERS +/* + * Passed to ui_wait_for_chars_or_timer(), ignoring extra arguments. + */ + static int +gui_wait_for_chars_3( + long wtime, + int *interrupted UNUSED, + int ignore_input UNUSED) +{ + return gui_mch_wait_for_chars(wtime); +} +#endif + +/* + * Returns OK if a character was found to be available within the given time, + * or FAIL otherwise. + */ + static int +gui_wait_for_chars_or_timer(long wtime) +{ +#ifdef FEAT_TIMERS + return ui_wait_for_chars_or_timer(wtime, gui_wait_for_chars_3, NULL, 0); +#else + return gui_mch_wait_for_chars(wtime); +#endif +} + /* * The main GUI input routine. Waits for a character from the keyboard. * wtime == -1 Wait forever. @@ -2902,10 +2978,12 @@ gui_insert_lines(row, count) * or FAIL otherwise. */ int -gui_wait_for_chars(wtime) - long wtime; +gui_wait_for_chars(long wtime, int tb_change_cnt) { int retval; +#if defined(ELAPSED_FUNC) + ELAPSED_TYPE start_tv; +#endif #ifdef FEAT_MENU /* @@ -2930,11 +3008,15 @@ gui_wait_for_chars(wtime) /* Blink when waiting for a character. Probably only does something * for showmatch() */ gui_mch_start_blink(); - retval = gui_mch_wait_for_chars(wtime); - gui_mch_stop_blink(); + retval = gui_wait_for_chars_or_timer(wtime); + gui_mch_stop_blink(TRUE); return retval; } +#if defined(ELAPSED_FUNC) + ELAPSED_INIT(start_tv); +#endif + /* * While we are waiting indefinitely for a character, blink the cursor. */ @@ -2943,13 +3025,16 @@ gui_wait_for_chars(wtime) retval = FAIL; /* * We may want to trigger the CursorHold event. First wait for - * 'updatetime' and if nothing is typed within that time put the - * K_CURSORHOLD key in the input buffer. + * 'updatetime' and if nothing is typed within that time, and feedkeys() + * wasn't used, put the K_CURSORHOLD key in the input buffer. */ - if (gui_mch_wait_for_chars(p_ut) == OK) + if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; -#ifdef FEAT_AUTOCMD - else if (trigger_cursorhold()) + else if (trigger_cursorhold() +#ifdef ELAPSED_FUNC + && ELAPSED_FUNC(start_tv) >= p_ut +#endif + && typebuf.tb_change_cnt == tb_change_cnt) { char_u buf[3]; @@ -2961,27 +3046,39 @@ gui_wait_for_chars(wtime) retval = OK; } -#endif - if (retval == FAIL) + if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt) { /* Blocking wait. */ before_blocking(); - retval = gui_mch_wait_for_chars(-1L); + retval = gui_wait_for_chars_or_timer(-1L); } - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); return retval; } +/* + * Equivalent of mch_inchar() for the GUI. + */ + int +gui_inchar( + char_u *buf, + int maxlen, + long wtime, /* milli seconds */ + int tb_change_cnt) +{ + if (gui_wait_for_chars(wtime, tb_change_cnt) + && !typebuf_changed(tb_change_cnt)) + return read_from_input_buf(buf, (long)maxlen); + return 0; +} + /* * Fill p[4] with mouse coordinates encoded for check_termcode(). */ static void -fill_mouse_coord(p, col, row) - char_u *p; - int col; - int row; +fill_mouse_coord(char_u *p, int col, int row) { p[0] = (char_u)(col / 128 + ' ' + 1); p[1] = (char_u)(col % 128 + ' ' + 1); @@ -3006,12 +3103,12 @@ fill_mouse_coord(p, col, row) * character. */ void -gui_send_mouse_event(button, x, y, repeated_click, modifiers) - int button; - int x; - int y; - int repeated_click; - int_u modifiers; +gui_send_mouse_event( + int button, + int x, + int y, + int repeated_click, + int_u modifiers) { static int prev_row = 0, prev_col = 0; static int prev_button = -1; @@ -3096,15 +3193,18 @@ gui_send_mouse_event(button, x, y, repeated_click, modifiers) { case NORMAL_BUSY: case OP_PENDING: +# ifdef FEAT_TERMINAL + case TERMINAL: +# endif case NORMAL: checkfor = MOUSE_NORMAL; break; case VISUAL: checkfor = MOUSE_VISUAL; break; case SELECTMODE: checkfor = MOUSE_VISUAL; break; case REPLACE: case REPLACE+LANGMAP: -#ifdef FEAT_VREPLACE +# ifdef FEAT_VREPLACE case VREPLACE: case VREPLACE+LANGMAP: -#endif +# endif case INSERT: case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break; case ASKMORE: @@ -3140,16 +3240,11 @@ gui_send_mouse_event(button, x, y, repeated_click, modifiers) * Visual selection. */ if ((State == NORMAL || State == NORMAL_BUSY || (State & INSERT)) - && Y_2_ROW(y) >= topframe->fr_height -# ifdef FEAT_WINDOWS - + firstwin->w_winrow -# endif + && Y_2_ROW(y) >= topframe->fr_height + firstwin->w_winrow && button != MOUSE_DRAG # ifdef FEAT_MOUSESHAPE && !drag_status_line -# ifdef FEAT_VERTSPLIT && !drag_sep_line -# endif # endif ) checkfor = MOUSE_NONE; @@ -3321,10 +3416,7 @@ gui_send_mouse_event(button, x, y, repeated_click, modifiers) * returns column in "*colp" and row as return value; */ int -gui_xy2colrow(x, y, colp) - int x; - int y; - int *colp; +gui_xy2colrow(int x, int y, int *colp) { int col = check_col(X_2_COL(x)); int row = check_row(Y_2_ROW(y)); @@ -3342,8 +3434,7 @@ gui_xy2colrow(x, y, colp) * Callback function for when a menu entry has been selected. */ void -gui_menu_cb(menu) - vimmenu_T *menu; +gui_menu_cb(vimmenu_T *menu) { char_u bytes[sizeof(long_u)]; @@ -3368,8 +3459,7 @@ static int prev_which_scrollbars[3]; * in p_go. */ void -gui_init_which_components(oldval) - char_u *oldval UNUSED; +gui_init_which_components(char_u *oldval UNUSED) { #ifdef FEAT_MENU static int prev_menu_is_active = -1; @@ -3385,10 +3475,12 @@ gui_init_which_components(oldval) static int prev_footer = -1; int using_footer = FALSE; #endif -#if defined(FEAT_MENU) && !defined(WIN16) +#if defined(FEAT_MENU) static int prev_tearoff = -1; int using_tearoff = FALSE; #endif + static int prev_nocaption = -1; + int using_caption = TRUE; char_u *p; int i; @@ -3430,7 +3522,6 @@ gui_init_which_components(oldval) case GO_RIGHT: gui.which_scrollbars[SBAR_RIGHT] = TRUE; break; -#ifdef FEAT_VERTSPLIT case GO_VLEFT: if (win_hasvertsplit()) gui.which_scrollbars[SBAR_LEFT] = TRUE; @@ -3439,7 +3530,6 @@ gui_init_which_components(oldval) if (win_hasvertsplit()) gui.which_scrollbars[SBAR_RIGHT] = TRUE; break; -#endif case GO_BOT: gui.which_scrollbars[SBAR_BOTTOM] = TRUE; break; @@ -3462,10 +3552,13 @@ gui_init_which_components(oldval) break; #endif case GO_TEAROFF: -#if defined(FEAT_MENU) && !defined(WIN16) +#if defined(FEAT_MENU) using_tearoff = TRUE; #endif break; + case GO_NOCAPTION: + using_caption = FALSE; + break; default: /* Ignore options that are not supported */ break; @@ -3502,11 +3595,8 @@ gui_init_which_components(oldval) * shown/unshown. Thus we need two places to remember whether a * scrollbar is there or not. */ if (gui.which_scrollbars[i] != prev_which_scrollbars[i] -#ifdef FEAT_WINDOWS || gui.which_scrollbars[i] - != curtab->tp_prev_which_scrollbars[i] -#endif - ) + != curtab->tp_prev_which_scrollbars[i]) { if (i == SBAR_BOTTOM) gui_mch_enable_scrollbar(&gui.bottom_sbar, @@ -3528,9 +3618,7 @@ gui_init_which_components(oldval) fix_size = TRUE; } } -#ifdef FEAT_WINDOWS curtab->tp_prev_which_scrollbars[i] = gui.which_scrollbars[i]; -#endif prev_which_scrollbars[i] = gui.which_scrollbars[i]; } @@ -3569,13 +3657,21 @@ gui_init_which_components(oldval) fix_size = TRUE; } #endif -#if defined(FEAT_MENU) && !defined(WIN16) && !(defined(WIN3264) && !defined(FEAT_TEAROFF)) +#if defined(FEAT_MENU) && !(defined(WIN3264) && !defined(FEAT_TEAROFF)) if (using_tearoff != prev_tearoff) { gui_mch_toggle_tearoffs(using_tearoff); prev_tearoff = using_tearoff; } #endif + if (using_caption != prev_nocaption) + { +#if defined(WIN3264) + gui_mch_show_caption(using_caption); +#endif + prev_nocaption = using_caption; + need_set_size = TRUE; + } if (need_set_size != 0) { #ifdef FEAT_GUI_GTK @@ -3606,12 +3702,10 @@ gui_init_which_components(oldval) Columns = prev_Columns; #endif } -#ifdef FEAT_WINDOWS /* When the console tabline appears or disappears the window positions * change. */ if (firstwin->w_winrow != tabline_height()) shell_new_rows(); /* recompute window positions and heights */ -#endif } } @@ -3621,7 +3715,7 @@ gui_init_which_components(oldval) * It may still be hidden if 'showtabline' is zero. */ int -gui_use_tabline() +gui_use_tabline(void) { return gui.in_use && vim_strchr(p_go, GO_TABLINE) != NULL; } @@ -3631,7 +3725,7 @@ gui_use_tabline() * This uses 'showtabline'. */ static int -gui_has_tabline() +gui_has_tabline(void) { if (!gui_use_tabline() || p_stal == 0 @@ -3645,7 +3739,7 @@ gui_has_tabline() * This may display/undisplay the tabline and update the labels. */ void -gui_update_tabline() +gui_update_tabline(void) { int showit = gui_has_tabline(); int shown = gui_mch_showing_tabline(); @@ -3655,7 +3749,6 @@ gui_update_tabline() /* Updating the tabline uses direct GUI commands, flush * outstanding instructions first. (esp. clear screen) */ out_flush(); - gui_mch_flush(); if (!showit != !shown) gui_mch_show_tabline(showit); @@ -3673,9 +3766,9 @@ gui_update_tabline() * Get the label or tooltip for tab page "tp" into NameBuff[]. */ void -get_tabline_label(tp, tooltip) - tabpage_T *tp; - int tooltip; /* TRUE: get tooltip */ +get_tabline_label( + tabpage_T *tp, + int tooltip) /* TRUE: get tooltip */ { int modified = FALSE; char_u buf[40]; @@ -3766,8 +3859,7 @@ get_tabline_label(tp, tooltip) * that tab page or the cmdline window is open. */ int -send_tabline_event(nr) - int nr; +send_tabline_event(int nr) { char_u string[3]; @@ -3799,9 +3891,7 @@ send_tabline_event(nr) * Send a tabline menu event */ void -send_tabline_menu_event(tabidx, event) - int tabidx; - int event; +send_tabline_menu_event(int tabidx, int event) { char_u string[3]; @@ -3824,12 +3914,11 @@ send_tabline_menu_event(tabidx, event) * Scrollbar stuff: */ -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Remove all scrollbars. Used before switching to another tab page. */ void -gui_remove_scrollbars() +gui_remove_scrollbars(void) { int i; win_T *wp; @@ -3848,13 +3937,9 @@ gui_remove_scrollbars() curtab->tp_prev_which_scrollbars[i] = -1; } } -#endif void -gui_create_scrollbar(sb, type, wp) - scrollbar_T *sb; - int type; - win_T *wp; +gui_create_scrollbar(scrollbar_T *sb, int type, win_T *wp) { #ifdef FEAT_GUI_MACVIM /* This is passed over to another process, make sure it fits in 32 bit */ @@ -3874,9 +3959,7 @@ gui_create_scrollbar(sb, type, wp) sb->max = 1; sb->top = 0; sb->height = 0; -#ifdef FEAT_VERTSPLIT sb->width = 0; -#endif sb->status_height = 0; gui_mch_create_scrollbar(sb, (wp == NULL) ? SBAR_HORIZ : SBAR_VERT); } @@ -3885,8 +3968,7 @@ gui_create_scrollbar(sb, type, wp) * Find the scrollbar with the given index. */ scrollbar_T * -gui_find_scrollbar(ident) - long ident; +gui_find_scrollbar(long ident) { win_T *wp; @@ -3918,20 +4000,13 @@ gui_find_scrollbar(ident) * are still characters to be processed. */ void -gui_drag_scrollbar(sb, value, still_dragging) - scrollbar_T *sb; - long value; - int still_dragging; +gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging) { -#ifdef FEAT_WINDOWS win_T *wp; -#endif int sb_num; #ifdef USE_ON_FLY_SCROLL colnr_T old_leftcol = curwin->w_leftcol; -# ifdef FEAT_SCROLLBIND linenr_T old_topline = curwin->w_topline; -# endif # ifdef FEAT_DIFF int old_topfill = curwin->w_topfill; # endif @@ -4017,15 +4092,10 @@ gui_drag_scrollbar(sb, value, still_dragging) if (sb->wp != NULL) /* vertical scrollbar */ { sb_num = 0; -#ifdef FEAT_WINDOWS for (wp = firstwin; wp != sb->wp && wp != NULL; wp = wp->w_next) sb_num++; if (wp == NULL) return; -#else - if (sb->wp != curwin) - return; -#endif #ifdef USE_ON_FLY_SCROLL current_scrollbar = sb_num; @@ -4101,28 +4171,25 @@ gui_drag_scrollbar(sb, value, still_dragging) } #ifdef USE_ON_FLY_SCROLL -# ifdef FEAT_SCROLLBIND /* * synchronize other windows, as necessary according to 'scrollbind' */ if (curwin->w_p_scb && ((sb->wp == NULL && curwin->w_leftcol != old_leftcol) || (sb->wp == curwin && (curwin->w_topline != old_topline -# ifdef FEAT_DIFF +# ifdef FEAT_DIFF || curwin->w_topfill != old_topfill -# endif +# endif )))) { do_check_scrollbind(TRUE); /* need to update the window right here */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_redr_type > 0) updateWindow(wp); setcursor(); } -# endif - out_flush(); - gui_update_cursor(FALSE, TRUE); + out_flush_cursor(FALSE, TRUE); #else add_to_input_buf(bytes, byte_count); add_long_to_buf((long_u)value, bytes); @@ -4134,12 +4201,11 @@ gui_drag_scrollbar(sb, value, still_dragging) * Scrollbar stuff: */ -#if defined(FEAT_AUTOCMD) || defined(FEAT_WINDOWS) || defined(PROTO) /* * Called when something in the window layout has changed. */ void -gui_may_update_scrollbars() +gui_may_update_scrollbars(void) { if (gui.in_use && starting == 0) { @@ -4149,20 +4215,17 @@ gui_may_update_scrollbars() } need_mouse_correct = TRUE; } -#endif void -gui_update_scrollbars(force) - int force; /* Force all scrollbars to get updated */ +gui_update_scrollbars( + int force) /* Force all scrollbars to get updated */ { win_T *wp; scrollbar_T *sb; long val, size, max; /* need 32 bits here */ int which_sb; int h, y; -#ifdef FEAT_VERTSPLIT static win_T *prev_curwin = NULL; -#endif /* Update the horizontal scrollbar */ gui_update_horiz_scrollbar(force); @@ -4255,26 +4318,17 @@ gui_update_scrollbars(force) continue; } if (force || sb->height != wp->w_height -#ifdef FEAT_WINDOWS || sb->top != wp->w_winrow || sb->status_height != wp->w_status_height -# ifdef FEAT_VERTSPLIT || sb->width != wp->w_width - || prev_curwin != curwin -# endif -#endif - ) + || prev_curwin != curwin) { /* Height, width or position of scrollbar has changed. For * vertical split: curwin changed. */ sb->height = wp->w_height; -#ifdef FEAT_WINDOWS sb->top = wp->w_winrow; sb->status_height = wp->w_status_height; -# ifdef FEAT_VERTSPLIT sb->width = wp->w_width; -# endif -#endif /* Calculate height and position in pixels */ h = (sb->height + sb->status_height) * gui.char_height; @@ -4301,9 +4355,7 @@ gui_update_scrollbars(force) y += gui.tabline_height; #endif -#ifdef FEAT_WINDOWS if (wp->w_winrow == 0) -#endif { /* Height of top scrollbar includes width of top border */ h += gui.border_offset; @@ -4356,9 +4408,7 @@ gui_update_scrollbars(force) val, size, max); } } -#ifdef FEAT_VERTSPLIT prev_curwin = curwin; -#endif --hold_gui_events; } @@ -4368,12 +4418,11 @@ gui_update_scrollbars(force) * sometimes. */ static void -gui_do_scrollbar(wp, which, enable) - win_T *wp; - int which; /* SBAR_LEFT or SBAR_RIGHT */ - int enable; /* TRUE to enable scrollbar */ +gui_do_scrollbar( + win_T *wp, + int which, /* SBAR_LEFT or SBAR_RIGHT */ + int enable) /* TRUE to enable scrollbar */ { -#ifdef FEAT_VERTSPLIT int midcol = curwin->w_wincol + curwin->w_width / 2; int has_midcol = (wp->w_wincol <= midcol && wp->w_wincol + wp->w_width >= midcol); @@ -4404,7 +4453,6 @@ gui_do_scrollbar(wp, which, enable) enable = FALSE; } } -#endif gui_mch_enable_scrollbar(&wp->w_scrollbars[which], enable); } @@ -4414,7 +4462,7 @@ gui_do_scrollbar(wp, which, enable) * or FALSE otherwise. */ int -gui_do_scroll() +gui_do_scroll(void) { win_T *wp, *save_wp; int i; @@ -4470,9 +4518,7 @@ gui_do_scroll() } if (old_cursor.lnum != wp->w_cursor.lnum) coladvance(wp->w_curswant); -#ifdef FEAT_SCROLLBIND wp->w_scbind_pos = wp->w_topline; -#endif } /* Make sure wp->w_leftcol and wp->w_skipcol are correct. */ @@ -4505,7 +4551,9 @@ gui_do_scroll() * disappear when losing focus after a scrollbar drag. */ if (wp->w_redr_type < type) wp->w_redr_type = type; + mch_disable_flush(); updateWindow(wp); /* update window, status line, and cmdline */ + mch_enable_flush(); } #ifdef FEAT_INS_EXPAND @@ -4514,7 +4562,7 @@ gui_do_scroll() pum_redraw(); #endif - return (wp == curwin && !equalpos(curwin->w_cursor, old_cursor)); + return (wp == curwin && !EQUAL_POS(curwin->w_cursor, old_cursor)); } @@ -4526,8 +4574,7 @@ gui_do_scroll() * Return length of line "lnum" for horizontal scrolling. */ static colnr_T -scroll_line_len(lnum) - linenr_T lnum; +scroll_line_len(linenr_T lnum) { char_u *p; colnr_T col; @@ -4539,7 +4586,7 @@ scroll_line_len(lnum) for (;;) { w = chartabsize(p, col); - mb_ptr_adv(p); + MB_PTR_ADV(p); if (*p == NUL) /* don't count the last character */ break; col += w; @@ -4556,7 +4603,7 @@ static linenr_T longest_lnum = 0; * by setting 'h' in "guioptions") then the current line number is returned. */ static linenr_T -gui_find_longest_lnum() +gui_find_longest_lnum(void) { linenr_T ret = 0; @@ -4597,8 +4644,7 @@ gui_find_longest_lnum() } static void -gui_update_horiz_scrollbar(force) - int force; +gui_update_horiz_scrollbar(int force) { long value, size, max; /* need 32 bit ints here */ @@ -4621,14 +4667,14 @@ gui_update_horiz_scrollbar(force) return; } - size = W_WIDTH(curwin); + size = curwin->w_width; if (curwin->w_p_wrap) { value = 0; #ifdef SCROLL_PAST_END max = 0; #else - max = W_WIDTH(curwin) - 1; + max = curwin->w_width - 1; #endif } else @@ -4648,7 +4694,7 @@ gui_update_horiz_scrollbar(force) #endif #ifndef SCROLL_PAST_END - max += W_WIDTH(curwin) - 1; + max += curwin->w_width - 1; #endif /* The line number isn't scrolled, thus there is less space when * 'number' or 'relativenumber' is set (also for 'foldcolumn'). */ @@ -4690,9 +4736,7 @@ gui_update_horiz_scrollbar(force) * Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise. */ int -gui_do_horiz_scroll(leftcol, compute_longest_lnum) - long_u leftcol; - int compute_longest_lnum; +gui_do_horiz_scroll(long_u leftcol, int compute_longest_lnum) { /* no wrapping, no scrolling */ if (curwin->w_p_wrap) @@ -4730,7 +4774,7 @@ gui_do_horiz_scroll(leftcol, compute_longest_lnum) * Check that none of the colors are the same as the background color */ void -gui_check_colors() +gui_check_colors(void) { if (gui.norm_pixel == gui.back_pixel || gui.norm_pixel == INVALCOLOR) { @@ -4741,16 +4785,14 @@ gui_check_colors() } static void -gui_set_fg_color(name) - char_u *name; +gui_set_fg_color(char_u *name) { gui.norm_pixel = gui_get_color(name); hl_set_fg_color_name(vim_strsave(name)); } static void -gui_set_bg_color(name) - char_u *name; +gui_set_bg_color(char_u *name) { gui.back_pixel = gui_get_color(name); hl_set_bg_color_name(vim_strsave(name)); @@ -4761,8 +4803,7 @@ gui_set_bg_color(name) * Returns INVALCOLOR and gives an error message when failed. */ guicolor_T -gui_get_color(name) - char_u *name; +gui_get_color(char_u *name) { guicolor_T t; @@ -4783,10 +4824,9 @@ gui_get_color(name) * Return the grey value of a color (range 0-255). */ int -gui_get_lightness(pixel) - guicolor_T pixel; +gui_get_lightness(guicolor_T pixel) { - long_u rgb = gui_mch_get_rgb(pixel); + long_u rgb = (long_u)gui_mch_get_rgb(pixel); return (int)( (((rgb >> 16) & 0xff) * 299) + (((rgb >> 8) & 0xff) * 587) @@ -4795,7 +4835,7 @@ gui_get_lightness(pixel) #if defined(FEAT_GUI_X11) || defined(PROTO) void -gui_new_scrollbar_colors() +gui_new_scrollbar_colors(void) { win_T *wp; @@ -4816,8 +4856,7 @@ gui_new_scrollbar_colors() * Call this when focus has changed. */ void -gui_focus_change(in_focus) - int in_focus; +gui_focus_change(int in_focus) { /* * Skip this code to avoid drawing the cursor when debugging and switching @@ -4825,8 +4864,7 @@ gui_focus_change(in_focus) */ #if 1 gui.in_focus = in_focus; - out_flush(); /* make sure output has been written */ - gui_update_cursor(TRUE, FALSE); + out_flush_cursor(TRUE, FALSE); # ifdef FEAT_XIM xim_set_focus(in_focus); @@ -4851,9 +4889,7 @@ gui_focus_change(in_focus) * Called when the mouse moved (but not when dragging). */ void -gui_mouse_moved(x, y) - int x; - int y; +gui_mouse_moved(int x, int y) { win_T *wp; char_u st[8]; @@ -4885,11 +4921,9 @@ gui_mouse_moved(x, y) if (wp == curwin || wp == NULL) return; /* still in the same old window, or none at all */ -#ifdef FEAT_WINDOWS /* Ignore position in the tab pages line. */ if (Y_2_ROW(y) < tabline_height()) return; -#endif /* * format a mouse click on status line input @@ -4908,11 +4942,7 @@ gui_mouse_moved(x, y) st[2] = KE_FILLER; st[3] = (char_u)MOUSE_LEFT; fill_mouse_coord(st + 4, -#ifdef FEAT_VERTSPLIT wp->w_wincol == 0 ? -1 : wp->w_wincol + MOUSE_COLOFF, -#else - -1, -#endif wp->w_height + W_WINROW(wp)); add_to_input_buf(st, 8); @@ -4930,7 +4960,7 @@ gui_mouse_moved(x, y) * Called when mouse should be moved to window with focus. */ void -gui_mouse_correct() +gui_mouse_correct(void) { int x, y; win_T *wp = NULL; @@ -4944,11 +4974,7 @@ gui_mouse_correct() /* Don't move the mouse when it's left or right of the Vim window */ if (x < 0 || x > Columns * gui.char_width) return; - if (y >= 0 -# ifdef FEAT_WINDOWS - && Y_2_ROW(y) >= tabline_height() -# endif - ) + if (y >= 0 && Y_2_ROW(y) >= tabline_height()) wp = xy2win(x, y); if (wp != curwin && wp != NULL) /* If in other than current window */ { @@ -4960,14 +4986,11 @@ gui_mouse_correct() } /* - * Find window where the mouse pointer "y" coordinate is in. + * Find window where the mouse pointer "x" / "y" coordinate is in. */ static win_T * -xy2win(x, y) - int x UNUSED; - int y UNUSED; +xy2win(int x UNUSED, int y UNUSED) { -#ifdef FEAT_WINDOWS int row; int col; win_T *wp; @@ -4986,7 +5009,9 @@ xy2win(x, y) return NULL; # endif wp = mouse_find_win(&row, &col); -# ifdef FEAT_MOUSESHAPE + if (wp == NULL) + return NULL; +#ifdef FEAT_MOUSESHAPE if (State == HITRETURN || State == ASKMORE) { if (Y_2_ROW(y) >= msg_row) @@ -4996,21 +5021,16 @@ xy2win(x, y) } else if (row > wp->w_height) /* below status line */ update_mouseshape(SHAPE_IDX_CLINE); -# ifdef FEAT_VERTSPLIT - else if (!(State & CMDLINE) && W_VSEP_WIDTH(wp) > 0 && col == wp->w_width + else if (!(State & CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width && (row != wp->w_height || !stl_connected(wp)) && msg_scrolled == 0) update_mouseshape(SHAPE_IDX_VSEP); -# endif - else if (!(State & CMDLINE) && W_STATUS_HEIGHT(wp) > 0 + else if (!(State & CMDLINE) && wp->w_status_height > 0 && row == wp->w_height && msg_scrolled == 0) update_mouseshape(SHAPE_IDX_STATUS); else update_mouseshape(-2); -# endif - return wp; -#else - return firstwin; #endif + return wp; } /* @@ -5018,8 +5038,7 @@ xy2win(x, y) * File names may be given to redefine the args list. */ void -ex_gui(eap) - exarg_T *eap; +ex_gui(exarg_T *eap) { char_u *arg = eap->arg; @@ -5032,7 +5051,7 @@ ex_gui(eap) */ if (arg[0] == '-' && (arg[1] == 'f' || arg[1] == 'b') - && (arg[2] == NUL || vim_iswhite(arg[2]))) + && (arg[2] == NUL || VIM_ISWHITE(arg[2]))) { gui.dofork = (arg[1] == 'b'); eap->arg = skipwhite(eap->arg + 2); @@ -5043,8 +5062,8 @@ ex_gui(eap) * of the argument ending up after the shell prompt. */ msg_clr_eos_force(); gui_start(); -#ifdef FEAT_NETBEANS_INTG - netbeans_gui_register(); +#ifdef FEAT_JOB_CHANNEL + channel_gui_register_all(); #endif } if (!ends_excmd(*eap->arg)) @@ -5057,15 +5076,13 @@ ex_gui(eap) /* * This is shared between Athena, Motif and GTK. */ -static void gfp_setname __ARGS((char_u *fname, void *cookie)); +static void gfp_setname(char_u *fname, void *cookie); /* * Callback function for do_in_runtimepath(). */ static void -gfp_setname(fname, cookie) - char_u *fname; - void *cookie; +gfp_setname(char_u *fname, void *cookie) { char_u *gfp_buffer = cookie; @@ -5080,15 +5097,12 @@ gfp_setname(fname, cookie) * Return FAIL for failure and OK if buffer[MAXPATHL] contains the result. */ int -gui_find_bitmap(name, buffer, ext) - char_u *name; - char_u *buffer; - char *ext; +gui_find_bitmap(char_u *name, char_u *buffer, char *ext) { if (STRLEN(name) > MAXPATHL - 14) return FAIL; vim_snprintf((char *)buffer, MAXPATHL, "bitmaps/%s.%s", name, ext); - if (do_in_runtimepath(buffer, FALSE, gfp_setname, buffer) == FAIL + if (do_in_runtimepath(buffer, 0, gfp_setname, buffer) == FAIL || *buffer == NUL) return FAIL; return OK; @@ -5103,10 +5117,7 @@ gui_find_bitmap(name, buffer, ext) * contains "name". */ void -gui_find_iconfile(name, buffer, ext) - char_u *name; - char_u *buffer; - char *ext; +gui_find_iconfile(char_u *name, char_u *buffer, char *ext) { char_u buf[MAXPATHL + 1]; @@ -5119,7 +5130,7 @@ gui_find_iconfile(name, buffer, ext) #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(PROTO) void -display_errors() +display_errors(void) { char_u *p; @@ -5151,7 +5162,7 @@ display_errors() * allow typing on stdin. */ int -no_console_input() +no_console_input(void) { return ((!gui.in_use || gui.starting) # ifndef NO_CONSOLE @@ -5168,36 +5179,26 @@ no_console_input() * Update the current window and the screen. */ void -gui_update_screen() +gui_update_screen(void) { -#ifdef FEAT_CONCEAL +# ifdef FEAT_CONCEAL linenr_T conceal_old_cursor_line = 0; linenr_T conceal_new_cursor_line = 0; int conceal_update_lines = FALSE; -#endif +# endif update_topline(); validate_cursor(); -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. */ - if (!finish_op && ( -# ifdef FEAT_AUTOCMD - has_cursormoved() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif + if (!finish_op && (has_cursormoved() # ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 + || curwin->w_p_cole > 0 # endif - ) - && !equalpos(last_cursormoved, curwin->w_cursor)) + ) && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { -# ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); -# endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { @@ -5208,11 +5209,10 @@ gui_update_screen() # endif last_cursormoved = curwin->w_cursor; } -#endif update_screen(0); /* may need to update the screen */ setcursor(); -# if defined(FEAT_CONCEAL) +# ifdef FEAT_CONCEAL if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) @@ -5224,25 +5224,21 @@ gui_update_screen() curwin->w_valid &= ~VALID_CROW; } # endif - out_flush(); /* make sure output has been written */ - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); + out_flush_cursor(TRUE, FALSE); } #endif #if defined(FIND_REPLACE_DIALOG) || defined(PROTO) -static void concat_esc __ARGS((garray_T *gap, char_u *text, int what)); - /* * Get the text to use in a find/replace dialog. Uses the last search pattern * if the argument is empty. * Returns an allocated string. */ char_u * -get_find_dialog_text(arg, wwordp, mcasep) - char_u *arg; - int *wwordp; /* return: TRUE if \< \> found */ - int *mcasep; /* return: TRUE if \C found */ +get_find_dialog_text( + char_u *arg, + int *wwordp, /* return: TRUE if \< \> found */ + int *mcasep) /* return: TRUE if \C found */ { char_u *text; @@ -5296,44 +5292,16 @@ get_find_dialog_text(arg, wwordp, mcasep) return text; } -/* - * Concatenate "text" to grow array "gap", escaping "what" with a backslash. - */ - static void -concat_esc(gap, text, what) - garray_T *gap; - char_u *text; - int what; -{ - while (*text != NUL) - { -#ifdef FEAT_MBYTE - int l = (*mb_ptr2len)(text); - - if (l > 1) - { - while (--l >= 0) - ga_append(gap, *text++); - continue; - } -#endif - if (*text == what) - ga_append(gap, '\\'); - ga_append(gap, *text); - ++text; - } -} - /* * Handle the press of a button in the find-replace dialog. * Return TRUE when something was added to the input buffer. */ int -gui_do_findrepl(flags, find_text, repl_text, down) - int flags; /* one of FRD_REPLACE, FRD_FINDNEXT, etc. */ - char_u *find_text; - char_u *repl_text; - int down; /* Search downwards. */ +gui_do_findrepl( + int flags, /* one of FRD_REPLACE, FRD_FINDNEXT, etc. */ + char_u *find_text, + char_u *repl_text, + int down) /* Search downwards. */ { garray_T ga; int i; @@ -5366,10 +5334,11 @@ gui_do_findrepl(flags, find_text, repl_text, down) ga_concat(&ga, (char_u *)"\\c"); if (flags & FRD_WHOLE_WORD) ga_concat(&ga, (char_u *)"\\<"); - if (type == FRD_REPLACEALL || down) - concat_esc(&ga, find_text, '/'); /* escape slashes */ - else - concat_esc(&ga, find_text, '?'); /* escape '?' */ + /* escape / and \ */ + p = vim_strsave_escaped(find_text, (char_u *)"/\\"); + if (p != NULL) + ga_concat(&ga, p); + vim_free(p); if (flags & FRD_WHOLE_WORD) ga_concat(&ga, (char_u *)"\\>"); @@ -5425,10 +5394,27 @@ gui_do_findrepl(flags, find_text, repl_text, down) } else { - /* Search for the next match. */ + int searchflags = SEARCH_MSG + SEARCH_MARK; + + /* Search for the next match. + * Don't skip text under cursor for single replace. */ + if (type == FRD_REPLACE) + searchflags += SEARCH_START; i = msg_scroll; - do_search(NULL, down ? '/' : '?', ga.ga_data, 1L, - SEARCH_MSG + SEARCH_MARK, NULL); + if (down) + { + (void)do_search(NULL, '/', ga.ga_data, 1L, searchflags, NULL, NULL); + } + else + { + /* We need to escape '?' if and only if we are searching in the up + * direction */ + p = vim_strsave_escaped(ga.ga_data, (char_u *)"?"); + if (p != NULL) + (void)do_search(NULL, '?', p, 1L, searchflags, NULL, NULL); + vim_free(p); + } + msg_scroll = i; /* don't let an error message set msg_scroll */ } @@ -5456,16 +5442,13 @@ gui_do_findrepl(flags, find_text, repl_text, down) || defined(PROTO) \ || defined(FEAT_GUI_MACVIM) -#ifdef FEAT_WINDOWS -static void gui_wingoto_xy __ARGS((int x, int y)); +static void gui_wingoto_xy(int x, int y); /* * Jump to the window at specified point (x, y). */ static void -gui_wingoto_xy(x, y) - int x; - int y; +gui_wingoto_xy(int x, int y) { int row = Y_2_ROW(y); int col = X_2_COL(x); @@ -5478,7 +5461,6 @@ gui_wingoto_xy(x, y) win_goto(wp); } } -#endif /* * Process file drop. Mouse cursor position, key modifiers, name of files @@ -5487,12 +5469,12 @@ gui_wingoto_xy(x, y) * fnames after call this function. */ void -gui_handle_drop(x, y, modifiers, fnames, count) - int x UNUSED; - int y UNUSED; - int_u modifiers; - char_u **fnames; - int count; +gui_handle_drop( + int x UNUSED, + int y UNUSED, + int_u modifiers, + char_u **fnames, + int count) { int i; char_u *p; @@ -5541,9 +5523,7 @@ gui_handle_drop(x, y, modifiers, fnames, count) { /* Go to the window under mouse cursor, then shorten given "fnames" by * current window, because a window can have local current dir. */ -# ifdef FEAT_WINDOWS gui_wingoto_xy(x, y); -# endif shorten_filenames(fnames, count); /* If Shift held down, remember the first item. */ @@ -5574,7 +5554,7 @@ gui_handle_drop(x, y, modifiers, fnames, count) if (mch_chdir((char *)p) == 0) shorten_fnames(TRUE); } - else if (vim_chdirfile(p) == OK) + else if (vim_chdirfile(p, "drop") == OK) shorten_fnames(TRUE); vim_free(p); } @@ -5588,9 +5568,7 @@ gui_handle_drop(x, y, modifiers, fnames, count) maketitle(); #endif setcursor(); - out_flush(); - gui_update_cursor(FALSE, FALSE); - gui_mch_flush(); + out_flush_cursor(FALSE, FALSE); } entered = FALSE; diff --git a/src/gui.h b/src/gui.h index f787408bf9..8d664f45fe 100644 --- a/src/gui.h +++ b/src/gui.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Motif support by Robert Webb @@ -16,10 +16,6 @@ # include <X11/StringDefs.h> #endif -#ifdef FEAT_BEVAL -# include "gui_beval.h" -#endif - #ifdef FEAT_GUI_GTK # ifdef VMS /* undef MIN and MAX because Intrinsic.h redefines them anyway */ # ifdef MAX @@ -41,7 +37,7 @@ # include <Events.h> # include <Menus.h> # if !(defined (TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON)) -# include <Windows.h> +# include <Windows.h> # endif # include <Controls.h> /*# include <TextEdit.h>*/ @@ -143,21 +139,18 @@ # define DRAW_ITALIC 0x10 /* draw italic text */ #endif #define DRAW_CURSOR 0x20 /* drawing block cursor (win32) */ -#define DRAW_WIDE 0x40 /* drawing wide char (MacVim) */ -#define DRAW_COMP 0x80 /* drawing composing char (MacVim) */ +#define DRAW_STRIKE 0x40 /* strikethrough */ +#define DRAW_WIDE 0x80 /* drawing wide char (MacVim) */ +#define DRAW_COMP 0x100 /* drawing composing char (MacVim) */ +#define DRAW_TUNDERL 0x200 /* drawing thick underline text (MacVim) */ /* For our own tearoff menu item */ #define TEAR_STRING "-->Detach" #define TEAR_LEN (9) /* length of above string */ /* for the toolbar */ -#ifdef FEAT_GUI_W16 -# define TOOLBAR_BUTTON_HEIGHT 15 -# define TOOLBAR_BUTTON_WIDTH 16 -#else -# define TOOLBAR_BUTTON_HEIGHT 18 -# define TOOLBAR_BUTTON_WIDTH 18 -#endif +#define TOOLBAR_BUTTON_HEIGHT 18 +#define TOOLBAR_BUTTON_WIDTH 18 #define TOOLBAR_BORDER_HEIGHT 12 /* room above+below buttons for MSWindows */ #ifdef FEAT_GUI_MSWIN @@ -187,9 +180,7 @@ typedef struct GuiScrollbar /* Values measured in characters: */ int top; /* Top of scroll bar (chars from row 0) */ int height; /* Current height of scroll bar in rows */ -#ifdef FEAT_VERTSPLIT int width; /* Current width of scroll bar in cols */ -#endif int status_height; /* Height of status line */ #ifdef FEAT_GUI_X11 Widget id; /* Id of real scroll bar */ @@ -220,6 +211,8 @@ typedef long guicolor_T; /* handle for a GUI color; for X11 this should #define INVALCOLOR (guicolor_T)-11111 /* number for invalid color; on 32 bit displays there is a tiny chance this is an actual color */ +#define CTERMCOLOR (guicolor_T)-11110 /* only used for cterm.bg_rgb and + cterm.fg_rgb: use cterm color */ #if defined(FEAT_GUI_MACVIM) typedef void *GuiFont; @@ -372,7 +365,9 @@ typedef struct Gui #endif #ifdef FEAT_GUI_GTK +# ifndef USE_GTK3 int visibility; /* Is shell partially/fully obscured? */ +# endif GdkCursor *blank_pointer; /* Blank pointer */ /* X Resources */ @@ -391,10 +386,21 @@ typedef struct Gui GtkWidget *menubar_h; /* menubar handle */ GtkWidget *toolbar_h; /* toolbar handle */ # endif +# ifdef USE_GTK3 + GdkRGBA *fgcolor; /* GDK-styled foreground color */ + GdkRGBA *bgcolor; /* GDK-styled background color */ + GdkRGBA *spcolor; /* GDK-styled special color */ +# else GdkColor *fgcolor; /* GDK-styled foreground color */ GdkColor *bgcolor; /* GDK-styled background color */ GdkColor *spcolor; /* GDK-styled special color */ +# endif +# ifdef USE_GTK3 + cairo_surface_t *surface; /* drawarea surface */ + gboolean by_signal; /* cause of draw operation */ +# else GdkGC *text_gc; /* cached GC for normal text */ +# endif PangoContext *text_context; /* the context used for all text */ PangoFont *ascii_font; /* cached font for ASCII strings */ PangoGlyphString *ascii_glyphs; /* cached code point -> glyph map */ @@ -545,3 +551,33 @@ typedef enum # define CONVERT_FROM_UTF8(String) (String) # define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL) #endif /* FEAT_GUI_GTK */ + +#ifdef FEAT_GUI_GTK +/* + * The second parameter of g_signal_handlers_disconnect_by_func() is supposed + * to be a function pointer which was passed to g_signal_connect_*() somewhere + * previously, and hence it must be of type GCallback, i.e., void (*)(void). + * + * Meanwhile, g_signal_handlers_disconnect_by_func() is a macro calling + * g_signal_handlers_disconnect_matched(), and the second parameter of the + * former is to be passed to the sixth parameter of the latter the type of + * which, however, is declared as void * in the function signature. + * + * While the ISO C Standard does not require that function pointers be + * interconvertible to void *, widely-used compilers such as gcc and clang + * do such conversion implicitly and automatically on some platforms without + * issuing any warning. + * + * For Solaris Studio, that is not the case. An explicit type cast is needed + * to suppress warnings on that particular conversion. + */ +# if defined(__SUNPRO_C) && defined(USE_GTK3) +# define FUNC2GENERIC(func) (void *)(func) +# else +# define FUNC2GENERIC(func) G_CALLBACK(func) +# endif +#endif /* FEAT_GUI_GTK */ + +#if defined(UNIX) && !(defined(FEAT_GUI_MAC) || defined(FEAT_GUI_MACVIM)) +# define GUI_MAY_FORK +#endif diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c index 2d73885aa4..26b96e07ca 100644 --- a/src/gui_at_fs.c +++ b/src/gui_at_fs.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: */ +/* vi:set ts=8 sts=4 sw=4 noet: */ /* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan @@ -172,36 +172,36 @@ static int SFstatus = SEL_FILE_NULL; /***************** static functions */ -static void SFsetText __ARGS((char *path)); -static void SFtextChanged __ARGS((void)); -static char *SFgetText __ARGS((void)); -static void SFupdatePath __ARGS((void)); -static int SFgetDir __ARGS((SFDir *dir)); -static void SFdrawLists __ARGS((int doScroll)); -static void SFdrawList __ARGS((int n, int doScroll)); -static void SFclearList __ARGS((int n, int doScroll)); -static void SFbuttonPressList __ARGS((Widget w, int n, XButtonPressedEvent *event)); -static void SFbuttonReleaseList __ARGS((Widget w, int n, XButtonReleasedEvent *event)); -static void SFdirModTimer __ARGS((XtPointer cl, XtIntervalId *id)); -static char SFstatChar __ARGS((struct stat *statBuf)); -static void SFdrawStrings __ARGS((Window w, SFDir *dir, int from, int to)); -static int SFnewInvertEntry __ARGS((int n, XMotionEvent *event)); -static void SFinvertEntry __ARGS((int n)); -static void SFenterList __ARGS((Widget w, int n, XEnterWindowEvent *event)); -static void SFleaveList __ARGS((Widget w, int n, XEvent *event)); -static void SFmotionList __ARGS((Widget w, int n, XMotionEvent *event)); -static void SFvFloatSliderMovedCallback __ARGS((Widget w, XtPointer n, XtPointer fnew)); -static void SFvSliderMovedCallback __ARGS((Widget w, int n, int nw)); -static void SFvAreaSelectedCallback __ARGS((Widget w, XtPointer n, XtPointer pnew)); -static void SFhSliderMovedCallback __ARGS((Widget w, XtPointer n, XtPointer nw)); -static void SFhAreaSelectedCallback __ARGS((Widget w, XtPointer n, XtPointer pnew)); -static void SFpathSliderMovedCallback __ARGS((Widget w, XtPointer client_data, XtPointer nw)); -static void SFpathAreaSelectedCallback __ARGS((Widget w, XtPointer client_data, XtPointer pnew)); -static Boolean SFworkProc __ARGS((void)); -static int SFcompareEntries __ARGS((const void *p, const void *q)); -static void SFprepareToReturn __ARGS((void)); -static void SFcreateWidgets __ARGS((Widget toplevel, char *prompt, char *ok, char *cancel)); -static void SFsetColors __ARGS((guicolor_T bg, guicolor_T fg, guicolor_T scroll_bg, guicolor_T scrollfg)); +static void SFsetText(char *path); +static void SFtextChanged(void); +static char *SFgetText(void); +static void SFupdatePath(void); +static int SFgetDir(SFDir *dir); +static void SFdrawLists(int doScroll); +static void SFdrawList(int n, int doScroll); +static void SFclearList(int n, int doScroll); +static void SFbuttonPressList(Widget w, int n, XButtonPressedEvent *event); +static void SFbuttonReleaseList(Widget w, int n, XButtonReleasedEvent *event); +static void SFdirModTimer(XtPointer cl, XtIntervalId *id); +static char SFstatChar(stat_T *statBuf); +static void SFdrawStrings(Window w, SFDir *dir, int from, int to); +static int SFnewInvertEntry(int n, XMotionEvent *event); +static void SFinvertEntry(int n); +static void SFenterList(Widget w, int n, XEnterWindowEvent *event); +static void SFleaveList(Widget w, int n, XEvent *event); +static void SFmotionList(Widget w, int n, XMotionEvent *event); +static void SFvFloatSliderMovedCallback(Widget w, XtPointer n, XtPointer fnew); +static void SFvSliderMovedCallback(Widget w, int n, int nw); +static void SFvAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew); +static void SFhSliderMovedCallback(Widget w, XtPointer n, XtPointer nw); +static void SFhAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew); +static void SFpathSliderMovedCallback(Widget w, XtPointer client_data, XtPointer nw); +static void SFpathAreaSelectedCallback(Widget w, XtPointer client_data, XtPointer pnew); +static Boolean SFworkProc(void); +static int SFcompareEntries(const void *p, const void *q); +static void SFprepareToReturn(void); +static void SFcreateWidgets(Widget toplevel, char *prompt, char *ok, char *cancel); +static void SFsetColors(guicolor_T bg, guicolor_T fg, guicolor_T scroll_bg, guicolor_T scrollfg); /***************** xstat.h */ @@ -237,11 +237,10 @@ static SFLogin *SFlogins; static int SFtwiddle = 0; -static int SFchdir __ARGS((char *path)); +static int SFchdir(char *path); static int -SFchdir(path) - char *path; +SFchdir(char *path) { int result; @@ -257,11 +256,10 @@ SFchdir(path) return result; } -static void SFfree __ARGS((int i)); +static void SFfree(int i); static void -SFfree(i) - int i; +SFfree(int i) { SFDir *dir; int j; @@ -281,21 +279,18 @@ SFfree(i) dir->dir = NULL; } -static void SFstrdup __ARGS((char **s1, char *s2)); +static void SFstrdup(char **s1, char *s2); static void -SFstrdup(s1, s2) - char **s1; - char *s2; +SFstrdup(char **s1, char *s2) { *s1 = strcpy(XtMalloc((unsigned)(strlen(s2) + 1)), s2); } -static void SFunreadableDir __ARGS((SFDir *dir)); +static void SFunreadableDir(SFDir *dir); static void -SFunreadableDir(dir) - SFDir *dir; +SFunreadableDir(SFDir *dir) { char *cannotOpen = _("<cannot open> "); @@ -307,12 +302,10 @@ SFunreadableDir(dir) dir->nChars = strlen(cannotOpen); } -static void SFreplaceText __ARGS((SFDir *dir, char *str)); +static void SFreplaceText(SFDir *dir, char *str); static void -SFreplaceText(dir, str) - SFDir *dir; - char *str; +SFreplaceText(SFDir *dir, char *str) { int len; @@ -330,11 +323,10 @@ SFreplaceText(dir, str) SFtextChanged(); } -static void SFexpand __ARGS((char *str)); +static void SFexpand(char *str); static void -SFexpand(str) - char *str; +SFexpand(char *str) { int len; int cmp; @@ -387,12 +379,10 @@ SFexpand(str) XtFree(growing); } -static int SFfindFile __ARGS((SFDir *dir, char *str)); +static int SFfindFile(SFDir *dir, char *str); static int -SFfindFile(dir, str) - SFDir *dir; - char *str; +SFfindFile(SFDir *dir, char *str) { int i, last, max; char *name, save; @@ -488,10 +478,10 @@ SFfindFile(dir, str) return 0; } -static void SFunselect __ARGS((void)); +static void SFunselect(void); static void -SFunselect() +SFunselect(void) { SFDir *dir; @@ -502,19 +492,18 @@ SFunselect() dir->endSelection = -1; } -static int SFcompareLogins __ARGS((const void *p, const void *q)); +static int SFcompareLogins(const void *p, const void *q); static int -SFcompareLogins(p, q) - const void *p, *q; +SFcompareLogins(const void *p, const void *q) { return strcmp(((SFLogin *)p)->name, ((SFLogin *)q)->name); } -static void SFgetHomeDirs __ARGS((void)); +static void SFgetHomeDirs(void); static void -SFgetHomeDirs() +SFgetHomeDirs(void) { struct passwd *pw; int Alloc; @@ -579,11 +568,10 @@ SFgetHomeDirs() (void)strcat(entries[i].real, "/"); } -static int SFfindHomeDir __ARGS((char *begin, char *end)); +static int SFfindHomeDir(char *begin, char *end); static int -SFfindHomeDir(begin, end) - char *begin, *end; +SFfindHomeDir(char *begin, char *end) { char save; char *theRest; @@ -613,7 +601,7 @@ SFfindHomeDir(begin, end) } static void -SFupdatePath() +SFupdatePath(void) { static int Alloc; static int wasTwiddle = 0; @@ -807,8 +795,7 @@ SFupdatePath() #ifdef XtNinternational static int -WcsLen(p) - wchar_t *p; +WcsLen(wchar_t *p) { int i = 0; while (*p++ != 0) @@ -818,8 +805,7 @@ WcsLen(p) #endif static void -SFsetText(path) - char *path; +SFsetText(char *path) { XawTextBlock text; @@ -852,19 +838,19 @@ SFsetText(path) } static void -SFbuttonPressList(w, n, event) - Widget w UNUSED; - int n UNUSED; - XButtonPressedEvent *event UNUSED; +SFbuttonPressList( + Widget w UNUSED, + int n UNUSED, + XButtonPressedEvent *event UNUSED) { SFbuttonPressed = 1; } static void -SFbuttonReleaseList(w, n, event) - Widget w; - int n; - XButtonReleasedEvent *event; +SFbuttonReleaseList( + Widget w, + int n, + XButtonReleasedEvent *event) { SFDir *dir; @@ -882,14 +868,12 @@ SFbuttonReleaseList(w, n, event) } } -static int SFcheckDir __ARGS((int n, SFDir *dir)); +static int SFcheckDir(int n, SFDir *dir); static int -SFcheckDir(n, dir) - int n; - SFDir *dir; +SFcheckDir(int n, SFDir *dir) { - struct stat statBuf; + stat_T statBuf; int i; if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime)) @@ -948,11 +932,10 @@ SFcheckDir(n, dir) return 0; } -static int SFcheckFiles __ARGS((SFDir *dir)); +static int SFcheckFiles(SFDir *dir); static int -SFcheckFiles(dir) - SFDir *dir; +SFcheckFiles(SFDir *dir) { int from, to; int result; @@ -960,7 +943,7 @@ SFcheckFiles(dir) int i; char *str; int last; - struct stat statBuf; + stat_T statBuf; result = 0; @@ -988,9 +971,7 @@ SFcheckFiles(dir) } static void -SFdirModTimer(cl, id) - XtPointer cl UNUSED; - XtIntervalId *id UNUSED; +SFdirModTimer(XtPointer cl UNUSED, XtIntervalId *id UNUSED) { static int n = -1; static int f = 0; @@ -1036,8 +1017,7 @@ SFdirModTimer(cl, id) /* Return a single character describing what kind of file STATBUF is. */ static char -SFstatChar(statBuf) - struct stat *statBuf; +SFstatChar(stat_T *statBuf) { if (S_ISDIR (statBuf->st_mode)) return '/'; @@ -1097,10 +1077,10 @@ static int SFcurrentListY; static XtIntervalId SFscrollTimerId; -static void SFinitFont __ARGS((void)); +static void SFinitFont(void); static void -SFinitFont() +SFinitFont(void) { TextData *data; #ifdef FEAT_XFONTSET @@ -1148,10 +1128,10 @@ SFinitFont() #endif } -static void SFcreateGC __ARGS((void)); +static void SFcreateGC(void); static void -SFcreateGC() +SFcreateGC(void) { XGCValues gcValues; XRectangle rectangles[1]; @@ -1209,9 +1189,7 @@ SFcreateGC() } static void -SFclearList(n, doScroll) - int n; - int doScroll; +SFclearList(int n, int doScroll) { SFDir *dir; @@ -1283,12 +1261,10 @@ SFclearList(n, doScroll) } } -static void SFdeleteEntry __ARGS((SFDir *dir, SFEntry *entry)); +static void SFdeleteEntry(SFDir *dir, SFEntry *entry); static void -SFdeleteEntry(dir, entry) - SFDir *dir; - SFEntry *entry; +SFdeleteEntry(SFDir *dir, SFEntry *entry) { SFEntry *e; SFEntry *end; @@ -1337,25 +1313,23 @@ SFdeleteEntry(dir, entry) #endif } -static void SFwriteStatChar __ARGS((char *name, int last, struct stat *statBuf)); +static void SFwriteStatChar(char *name, int last, stat_T *statBuf); static void -SFwriteStatChar(name, last, statBuf) - char *name; - int last; - struct stat *statBuf; +SFwriteStatChar( + char *name, + int last, + stat_T *statBuf) { name[last] = SFstatChar(statBuf); } -static int SFstatAndCheck __ARGS((SFDir *dir, SFEntry *entry)); +static int SFstatAndCheck(SFDir *dir, SFEntry *entry); static int -SFstatAndCheck(dir, entry) - SFDir *dir; - SFEntry *entry; +SFstatAndCheck(SFDir *dir, SFEntry *entry) { - struct stat statBuf; + stat_T statBuf; char save; int last; @@ -1414,11 +1388,11 @@ SFstatAndCheck(dir, entry) static void -SFdrawStrings(w, dir, from, to) - Window w; - SFDir *dir; - int from; - int to; +SFdrawStrings( + Window w, + SFDir *dir, + int from, + int to) { int i; SFEntry *entry; @@ -1501,9 +1475,7 @@ SFdrawStrings(w, dir, from, to) } static void -SFdrawList(n, doScroll) - int n; - int doScroll; +SFdrawList(int n, int doScroll) { SFDir *dir; Window w; @@ -1539,8 +1511,7 @@ SFdrawList(n, doScroll) } static void -SFdrawLists(doScroll) - int doScroll; +SFdrawLists(int doScroll) { int i; @@ -1549,8 +1520,7 @@ SFdrawLists(doScroll) } static void -SFinvertEntry(n) - int n; +SFinvertEntry(int n) { XFillRectangle( SFdisplay, @@ -1562,10 +1532,10 @@ SFinvertEntry(n) SFentryHeight); } -static unsigned long SFscrollTimerInterval __ARGS((void)); +static unsigned long SFscrollTimerInterval(void); static unsigned long -SFscrollTimerInterval() +SFscrollTimerInterval(void) { static int maxVal = 200; static int varyDist = 50; @@ -1591,12 +1561,10 @@ SFscrollTimerInterval() return (unsigned long)t; } -static void SFscrollTimer __ARGS((XtPointer p, XtIntervalId *id)); +static void SFscrollTimer(XtPointer p, XtIntervalId *id); static void -SFscrollTimer(p, id) - XtPointer p; - XtIntervalId *id UNUSED; +SFscrollTimer(XtPointer p, XtIntervalId *id UNUSED) { SFDir *dir; int save; @@ -1646,9 +1614,7 @@ SFscrollTimer(p, id) } static int -SFnewInvertEntry(n, event) - int n; - XMotionEvent *event; +SFnewInvertEntry(int n, XMotionEvent *event) { int x, y; int nw; @@ -1693,10 +1659,7 @@ SFnewInvertEntry(n, event) } static void -SFenterList(w, n, event) - Widget w UNUSED; - int n; - XEnterWindowEvent *event; +SFenterList(Widget w UNUSED, int n, XEnterWindowEvent *event) { int nw; @@ -1716,10 +1679,7 @@ SFenterList(w, n, event) } static void -SFleaveList(w, n, event) - Widget w UNUSED; - int n; - XEvent *event UNUSED; +SFleaveList(Widget w UNUSED, int n, XEvent *event UNUSED) { if (SFcurrentInvert[n] != -1) { @@ -1729,10 +1689,7 @@ SFleaveList(w, n, event) } static void -SFmotionList(w, n, event) - Widget w UNUSED; - int n; - XMotionEvent *event; +SFmotionList(Widget w UNUSED, int n, XMotionEvent *event) { int nw; @@ -1749,10 +1706,7 @@ SFmotionList(w, n, event) } static void -SFvFloatSliderMovedCallback(w, n, fnew) - Widget w; - XtPointer n; - XtPointer fnew; +SFvFloatSliderMovedCallback(Widget w, XtPointer n, XtPointer fnew) { int nw; @@ -1761,10 +1715,7 @@ SFvFloatSliderMovedCallback(w, n, fnew) } static void -SFvSliderMovedCallback(w, n, nw) - Widget w UNUSED; - int n; - int nw; +SFvSliderMovedCallback(Widget w UNUSED, int n, int nw) { int old; Window win; @@ -1846,10 +1797,7 @@ SFvSliderMovedCallback(w, n, nw) } static void -SFvAreaSelectedCallback(w, n, pnew) - Widget w; - XtPointer n; - XtPointer pnew; +SFvAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew) { SFDir *dir; int nw = (int)(long)pnew; @@ -1906,10 +1854,7 @@ SFvAreaSelectedCallback(w, n, pnew) } static void -SFhSliderMovedCallback(w, n, nw) - Widget w UNUSED; - XtPointer n; - XtPointer nw; +SFhSliderMovedCallback(Widget w UNUSED, XtPointer n, XtPointer nw) { SFDir *dir; int save; @@ -1924,10 +1869,7 @@ SFhSliderMovedCallback(w, n, nw) } static void -SFhAreaSelectedCallback(w, n, pnew) - Widget w; - XtPointer n; - XtPointer pnew; +SFhAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew) { SFDir *dir; int nw = (int)(long)pnew; @@ -1984,10 +1926,10 @@ SFhAreaSelectedCallback(w, n, pnew) } static void -SFpathSliderMovedCallback(w, client_data, nw) - Widget w UNUSED; - XtPointer client_data UNUSED; - XtPointer nw; +SFpathSliderMovedCallback( + Widget w UNUSED, + XtPointer client_data UNUSED, + XtPointer nw) { SFDir *dir; int n; @@ -2020,10 +1962,10 @@ SFpathSliderMovedCallback(w, client_data, nw) } static void -SFpathAreaSelectedCallback(w, client_data, pnew) - Widget w; - XtPointer client_data UNUSED; - XtPointer pnew; +SFpathAreaSelectedCallback( + Widget w, + XtPointer client_data UNUSED, + XtPointer pnew) { int nw = (int)(long)pnew; float f; @@ -2071,7 +2013,7 @@ SFpathAreaSelectedCallback(w, client_data, pnew) } static Boolean -SFworkProc() +SFworkProc(void) { SFDir *dir; SFEntry *entry; @@ -2100,16 +2042,14 @@ SFworkProc() /***************** Dir.c */ static int -SFcompareEntries(p, q) - const void *p; - const void *q; +SFcompareEntries(const void *p, const void *q) { - return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real); + return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real); } static int -SFgetDir(dir) - SFDir *dir; +SFgetDir( + SFDir *dir) { SFEntry *result = NULL; int Alloc = 0; @@ -2119,7 +2059,7 @@ SFgetDir(dir) char *str; int len; int maxChars; - struct stat statBuf; + stat_T statBuf; maxChars = strlen(dir->dir) - 1; @@ -2191,14 +2131,14 @@ static char *oneLineTextEditTranslations = "\ Ctrl<Key>M: redraw-display()\n\ "; -static void SFexposeList __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont)); +static void SFexposeList(Widget w, XtPointer n, XEvent *event, Boolean *cont); static void -SFexposeList(w, n, event, cont) - Widget w UNUSED; - XtPointer n; - XEvent *event; - Boolean *cont UNUSED; +SFexposeList( + Widget w UNUSED, + XtPointer n, + XEvent *event, + Boolean *cont UNUSED) { if ((event->type == NoExpose) || event->xexpose.count) return; @@ -2206,14 +2146,14 @@ SFexposeList(w, n, event, cont) SFdrawList((int)(long)n, SF_DO_NOT_SCROLL); } -static void SFmodVerifyCallback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont)); +static void SFmodVerifyCallback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); static void -SFmodVerifyCallback(w, client_data, event, cont) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *cont UNUSED; +SFmodVerifyCallback( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *cont UNUSED) { char buf[2]; @@ -2224,13 +2164,10 @@ SFmodVerifyCallback(w, client_data, event, cont) SFstatus = SEL_FILE_TEXT; } -static void SFokCallback __ARGS((Widget w, XtPointer cl, XtPointer cd)); +static void SFokCallback(Widget w, XtPointer cl, XtPointer cd); static void -SFokCallback(w, cl, cd) - Widget w UNUSED; - XtPointer cl UNUSED; - XtPointer cd UNUSED; +SFokCallback(Widget w UNUSED, XtPointer cl UNUSED, XtPointer cd UNUSED) { SFstatus = SEL_FILE_OK; } @@ -2241,13 +2178,10 @@ static XtCallbackRec SFokSelect[] = { NULL, (XtPointer) NULL }, }; -static void SFcancelCallback __ARGS((Widget w, XtPointer cl, XtPointer cd)); +static void SFcancelCallback(Widget w, XtPointer cl, XtPointer cd); static void -SFcancelCallback(w, cl, cd) - Widget w UNUSED; - XtPointer cl UNUSED; - XtPointer cd UNUSED; +SFcancelCallback(Widget w UNUSED, XtPointer cl UNUSED, XtPointer cd UNUSED) { SFstatus = SEL_FILE_CANCEL; } @@ -2258,14 +2192,14 @@ static XtCallbackRec SFcancelSelect[] = { NULL, (XtPointer) NULL }, }; -static void SFdismissAction __ARGS((Widget w, XEvent *event, String *params, Cardinal *num_params)); +static void SFdismissAction(Widget w, XEvent *event, String *params, Cardinal *num_params); static void -SFdismissAction(w, event, params, num_params) - Widget w UNUSED; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +SFdismissAction( + Widget w UNUSED, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { if (event->type == ClientMessage && (Atom)event->xclient.data.l[0] != SFwmDeleteWindow) @@ -2284,11 +2218,11 @@ static XtActionsRec actions[] = }; static void -SFsetColors(bg, fg, scroll_bg, scroll_fg) - guicolor_T bg; - guicolor_T fg; - guicolor_T scroll_bg; - guicolor_T scroll_fg; +SFsetColors( + guicolor_T bg, + guicolor_T fg, + guicolor_T scroll_bg, + guicolor_T scroll_fg) { if (selFileForm) { @@ -2366,11 +2300,11 @@ SFsetColors(bg, fg, scroll_bg, scroll_fg) } static void -SFcreateWidgets(toplevel, prompt, ok, cancel) - Widget toplevel; - char *prompt; - char *ok; - char *cancel; +SFcreateWidgets( + Widget toplevel, + char *prompt, + char *ok, + char *cancel) { Cardinal n; int listWidth, listHeight; @@ -2686,7 +2620,7 @@ SFcreateWidgets(toplevel, prompt, ok, cancel) } static void -SFtextChanged() +SFtextChanged(void) { #if defined(FEAT_XFONTSET) && defined(XtNinternational) if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide) @@ -2730,7 +2664,7 @@ SFtextChanged() } static char * -SFgetText() +SFgetText(void) { #if defined(FEAT_XFONTSET) && defined(XtNinternational) char *buf; @@ -2756,7 +2690,7 @@ SFgetText() } static void -SFprepareToReturn() +SFprepareToReturn(void) { SFstatus = SEL_FILE_NULL; XtRemoveGrab(selFile); @@ -2770,14 +2704,17 @@ SFprepareToReturn() } char * -vim_SelFile(toplevel, prompt, init_path, show_entry, x, y, fg, bg, scroll_fg, scroll_bg) - Widget toplevel; - char *prompt; - char *init_path; - int (*show_entry)(); - int x, y; - guicolor_T fg, bg; - guicolor_T scroll_fg, scroll_bg; /* The "Scrollbar" group colors */ +vim_SelFile( + Widget toplevel, + char *prompt, + char *init_path, + int (*show_entry)(), + int x, + int y, + guicolor_T fg, + guicolor_T bg, + guicolor_T scroll_fg, + guicolor_T scroll_bg) /* The "Scrollbar" group colors */ { static int firstTime = 1; XEvent event; diff --git a/src/gui_at_sb.c b/src/gui_at_sb.c index 6cf1e7b5a6..1816daa09e 100644 --- a/src/gui_at_sb.c +++ b/src/gui_at_sb.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: */ +/* vi:set ts=8 sts=4 sw=4 noet: */ /* * MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) * Modifications Copyright 1992 by Mitch Trachtenberg @@ -60,11 +60,12 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* created by weissman, Mon Jul 7 13:20:03 1986 */ /* converted by swick, Thu Aug 27 1987 */ +#include "vim.h" + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <X11/Xaw/XawInit.h> -#include "vim.h" #include "gui_at_sb.h" #include <X11/Xmu/Drawing.h> @@ -125,27 +126,27 @@ static XtResource resources[] = }; #undef Offset -static void ClassInitialize __ARGS((void)); -static void Initialize __ARGS((Widget, Widget, ArgList, Cardinal *)); -static void Destroy __ARGS((Widget)); -static void Realize __ARGS((Widget, Mask *, XSetWindowAttributes *)); -static void Resize __ARGS((Widget)); -static void Redisplay __ARGS((Widget, XEvent *, Region)); -static Boolean SetValues __ARGS((Widget, Widget, Widget, ArgList, Cardinal *)); - -static void HandleThumb __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void MoveThumb __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void NotifyThumb __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void NotifyScroll __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void EndScroll __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void ScrollOneLineUp __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void ScrollOneLineDown __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void ScrollPageUp __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void ScrollPageDown __ARGS((Widget, XEvent *, String *, Cardinal *)); -static void ScrollSome __ARGS((Widget w, XEvent *event, int call_data)); -static void _Xaw3dDrawShadows __ARGS((Widget, XEvent *, Region, int)); -static void AllocTopShadowGC __ARGS((Widget)); -static void AllocBotShadowGC __ARGS((Widget)); +static void ClassInitialize(void); +static void Initialize(Widget, Widget, ArgList, Cardinal *); +static void Destroy(Widget); +static void Realize(Widget, Mask *, XSetWindowAttributes *); +static void Resize(Widget); +static void Redisplay(Widget, XEvent *, Region); +static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); + +static void HandleThumb(Widget, XEvent *, String *, Cardinal *); +static void MoveThumb(Widget, XEvent *, String *, Cardinal *); +static void NotifyThumb(Widget, XEvent *, String *, Cardinal *); +static void NotifyScroll(Widget, XEvent *, String *, Cardinal *); +static void EndScroll(Widget, XEvent *, String *, Cardinal *); +static void ScrollOneLineUp(Widget, XEvent *, String *, Cardinal *); +static void ScrollOneLineDown(Widget, XEvent *, String *, Cardinal *); +static void ScrollPageUp(Widget, XEvent *, String *, Cardinal *); +static void ScrollPageDown(Widget, XEvent *, String *, Cardinal *); +static void ScrollSome(Widget w, XEvent *event, int call_data); +static void _Xaw3dDrawShadows(Widget, XEvent *, Region, int); +static void AllocTopShadowGC(Widget); +static void AllocBotShadowGC(Widget); static XtActionsRec actions[] = { @@ -222,7 +223,7 @@ WidgetClass vim_scrollbarWidgetClass = (WidgetClass)&vim_scrollbarClassRec; #define PAGE_REPEAT 250 static void -ClassInitialize() +ClassInitialize(void) { XawInitializeWidgetSet(); XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, @@ -232,11 +233,12 @@ ClassInitialize() #define MARGIN(sbw) (sbw)->scrollbar.thickness + (sbw)->scrollbar.shadow_width static void -FillArea(sbw, top, bottom, fill, draw_shadow) - ScrollbarWidget sbw; - Position top, bottom; - int fill; - int draw_shadow; +FillArea( + ScrollbarWidget sbw, + Position top, + Position bottom, + int fill, + int draw_shadow) { int tlen = bottom - top; /* length of thumb in pixels */ int sw, margin, floor; @@ -340,8 +342,7 @@ FillArea(sbw, top, bottom, fill, draw_shadow) */ static void -PaintThumb(sbw) - ScrollbarWidget sbw; +PaintThumb(ScrollbarWidget sbw) { Position oldtop, oldbot, newtop, newbot; Dimension margin, tzl; @@ -374,8 +375,7 @@ PaintThumb(sbw) } static void -PaintArrows(sbw) - ScrollbarWidget sbw; +PaintArrows(ScrollbarWidget sbw) { XPoint point[6]; Dimension thickness = sbw->scrollbar.thickness - 1; @@ -454,8 +454,7 @@ PaintArrows(sbw) } static void -Destroy(w) - Widget w; +Destroy(Widget w) { ScrollbarWidget sbw = (ScrollbarWidget) w; if (sbw->scrollbar.timer_id != (XtIntervalId) 0) @@ -466,8 +465,7 @@ Destroy(w) } static void -CreateGC(w) - Widget w; +CreateGC(Widget w) { ScrollbarWidget sbw = (ScrollbarWidget) w; XGCValues gcValues; @@ -505,8 +503,7 @@ CreateGC(w) } static void -SetDimensions(sbw) - ScrollbarWidget sbw; +SetDimensions(ScrollbarWidget sbw) { if (sbw->scrollbar.orientation == XtorientVertical) { @@ -521,11 +518,11 @@ SetDimensions(sbw) } static void -Initialize(request, new, args, num_args) - Widget request UNUSED; /* what the client asked for */ - Widget new; /* what we're going to give him */ - ArgList args UNUSED; - Cardinal *num_args UNUSED; +Initialize( + Widget request UNUSED, /* what the client asked for */ + Widget new, /* what we're going to give him */ + ArgList args UNUSED, + Cardinal *num_args UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget) new; @@ -549,10 +546,10 @@ Initialize(request, new, args, num_args) } static void -Realize(w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; +Realize( + Widget w, + Mask *valueMask, + XSetWindowAttributes *attributes) { /* The Simple widget actually stuffs the value in the valuemask. */ (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize) @@ -560,12 +557,12 @@ Realize(w, valueMask, attributes) } static Boolean -SetValues(current, request, desired, args, num_args) - Widget current; /* what I am */ - Widget request UNUSED; /* what he wants me to be */ - Widget desired; /* what I will become */ - ArgList args UNUSED; - Cardinal *num_args UNUSED; +SetValues( + Widget current, /* what I am */ + Widget request UNUSED, /* what he wants me to be */ + Widget desired, /* what I will become */ + ArgList args UNUSED, + Cardinal *num_args UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget) current; ScrollbarWidget dsbw = (ScrollbarWidget) desired; @@ -601,8 +598,7 @@ SetValues(current, request, desired, args, num_args) } static void -Resize(w) - Widget w; +Resize(Widget w) { /* ForgetGravity has taken care of background, but thumb may * have to move as a result of the new size. */ @@ -612,10 +608,7 @@ Resize(w) static void -Redisplay(w, event, region) - Widget w; - XEvent *event; - Region region; +Redisplay(Widget w, XEvent *event, Region region) { ScrollbarWidget sbw = (ScrollbarWidget) w; int x, y; @@ -650,10 +643,13 @@ Redisplay(w, event, region) static Boolean -CompareEvents(oldEvent, newEvent) - XEvent *oldEvent, *newEvent; +CompareEvents(XEvent *oldEvent, XEvent *newEvent) { -#define Check(field) if (newEvent->field != oldEvent->field) return False; +#define Check(field) \ + do { \ + if (newEvent->field != oldEvent->field) \ + return False; \ + } while (0) Check(xany.display); Check(xany.type); @@ -693,10 +689,7 @@ struct EventData }; static Bool -PeekNotifyEvent(dpy, event, args) - Display *dpy; - XEvent *event; - char *args; +PeekNotifyEvent(Display *dpy, XEvent *event, char *args) { struct EventData *eventData = (struct EventData*)args; @@ -706,9 +699,7 @@ PeekNotifyEvent(dpy, event, args) static Boolean -LookAhead(w, event) - Widget w; - XEvent *event; +LookAhead(Widget w, XEvent *event) { XEvent newEvent; struct EventData eventData; @@ -726,10 +717,11 @@ LookAhead(w, event) static void -ExtractPosition(event, x, y, state) - XEvent *event; - Position *x, *y; /* RETURN */ - unsigned int *state; /* RETURN */ +ExtractPosition( + XEvent *event, + Position *x, /* RETURN */ + Position *y, /* RETURN */ + unsigned int *state) /* RETURN */ { switch (event->type) { @@ -768,11 +760,11 @@ ExtractPosition(event, x, y, state) } static void -HandleThumb(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +HandleThumb( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { Position x, y, loc; ScrollbarWidget sbw = (ScrollbarWidget) w; @@ -791,9 +783,7 @@ HandleThumb(w, event, params, num_params) } static void -RepeatNotify(client_data, idp) - XtPointer client_data; - XtIntervalId *idp UNUSED; +RepeatNotify(XtPointer client_data, XtIntervalId *idp UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget) client_data; int call_data; @@ -833,57 +823,56 @@ RepeatNotify(client_data, idp) * Same as above, but for floating numbers. */ static float -FloatInRange(num, small, big) - float num, small, big; +FloatInRange(float num, float small, float big) { return (num < small) ? small : ((num > big) ? big : num); } static void -ScrollOneLineUp(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +ScrollOneLineUp( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollSome(w, event, -ONE_LINE_DATA); } static void -ScrollOneLineDown(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +ScrollOneLineDown( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollSome(w, event, ONE_LINE_DATA); } static void -ScrollPageDown(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +ScrollPageDown( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollSome(w, event, ONE_PAGE_DATA); } static void -ScrollPageUp(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +ScrollPageUp( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollSome(w, event, -ONE_PAGE_DATA); } static void -ScrollSome(w, event, call_data) - Widget w; - XEvent *event; - int call_data; +ScrollSome( + Widget w, + XEvent *event, + int call_data) { ScrollbarWidget sbw = (ScrollbarWidget) w; @@ -898,11 +887,11 @@ ScrollSome(w, event, call_data) } static void -NotifyScroll(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +NotifyScroll( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget) w; Position x, y, loc; @@ -987,11 +976,11 @@ NotifyScroll(w, event, params, num_params) } static void -EndScroll(w, event, params, num_params) - Widget w; - XEvent *event UNUSED; - String *params UNUSED; - Cardinal *num_params UNUSED; +EndScroll( + Widget w, + XEvent *event UNUSED, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget) w; @@ -1002,9 +991,7 @@ EndScroll(w, event, params, num_params) } static float -FractionLoc(sbw, x, y) - ScrollbarWidget sbw; - int x, y; +FractionLoc(ScrollbarWidget sbw, int x, int y) { int margin; float height, width; @@ -1018,11 +1005,11 @@ FractionLoc(sbw, x, y) } static void -MoveThumb(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +MoveThumb( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget)w; Position x, y; @@ -1063,11 +1050,11 @@ MoveThumb(w, event, params, num_params) static void -NotifyThumb(w, event, params, num_params) - Widget w; - XEvent *event; - String *params UNUSED; - Cardinal *num_params UNUSED; +NotifyThumb( + Widget w, + XEvent *event, + String *params UNUSED, + Cardinal *num_params UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget)w; /* Use a union to avoid a warning for the weird conversion from float to @@ -1089,8 +1076,7 @@ NotifyThumb(w, event, params, num_params) } static void -AllocTopShadowGC(w) - Widget w; +AllocTopShadowGC(Widget w) { ScrollbarWidget sbw = (ScrollbarWidget) w; XtGCMask valuemask; @@ -1102,8 +1088,7 @@ AllocTopShadowGC(w) } static void -AllocBotShadowGC(w) - Widget w; +AllocBotShadowGC(Widget w) { ScrollbarWidget sbw = (ScrollbarWidget) w; XtGCMask valuemask; @@ -1115,11 +1100,11 @@ AllocBotShadowGC(w) } static void -_Xaw3dDrawShadows(gw, event, region, out) - Widget gw; - XEvent *event UNUSED; - Region region; - int out; +_Xaw3dDrawShadows( + Widget gw, + XEvent *event UNUSED, + Region region, + int out) { XPoint pt[6]; ScrollbarWidget sbw = (ScrollbarWidget) gw; @@ -1187,9 +1172,7 @@ _Xaw3dDrawShadows(gw, event, region, out) * Set the scroll bar to the given location. */ void -vim_XawScrollbarSetThumb(w, top, shown, max) - Widget w; - double top, shown, max; +vim_XawScrollbarSetThumb(Widget w, double top, double shown, double max) { ScrollbarWidget sbw = (ScrollbarWidget) w; diff --git a/src/gui_at_sb.h b/src/gui_at_sb.h index 90940f5529..ce3694cd46 100644 --- a/src/gui_at_sb.h +++ b/src/gui_at_sb.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: */ +/* vi:set ts=8 sts=4 sw=4 noet: */ /* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ /* Modifications Copyright 1992 by Mitch Trachtenberg */ /* Rights, permissions, and disclaimer of warranty are as in the */ @@ -94,7 +94,7 @@ typedef struct _ScrollbarClassRec *ScrollbarWidgetClass; extern WidgetClass vim_scrollbarWidgetClass; -extern void vim_XawScrollbarSetThumb __ARGS((Widget, double, double, double)); +extern void vim_XawScrollbarSetThumb(Widget, double, double, double); typedef struct { diff --git a/src/gui_athena.c b/src/gui_athena.c index 03fea90024..b6ad2ce7ec 100644 --- a/src/gui_athena.c +++ b/src/gui_athena.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -9,6 +9,8 @@ * See README.txt for an overview of the Vim source code. */ +#include "vim.h" + #include <X11/StringDefs.h> #include <X11/Intrinsic.h> #ifdef FEAT_GUI_NEXTAW @@ -34,7 +36,6 @@ # include <X11/Xaw/AsciiText.h> #endif /* FEAT_GUI_NEXTAW */ -#include "vim.h" #ifndef FEAT_GUI_NEXTAW # include "gui_at_sb.h" #endif @@ -49,15 +50,15 @@ static XtIntervalId timer = 0; /* 0 = expired, otherwise active */ /* Used to figure out menu ordering */ static vimmenu_T *a_cur_menu = NULL; -static Cardinal athena_calculate_ins_pos __ARGS((Widget)); - -static Pixmap gui_athena_create_pullright_pixmap __ARGS((Widget)); -static void gui_athena_menu_timeout __ARGS((XtPointer, XtIntervalId *)); -static void gui_athena_popup_callback __ARGS((Widget, XtPointer, XtPointer)); -static void gui_athena_delayed_arm_action __ARGS((Widget, XEvent *, String *, - Cardinal *)); -static void gui_athena_popdown_submenus_action __ARGS((Widget, XEvent *, - String *, Cardinal *)); +static Cardinal athena_calculate_ins_pos(Widget); + +static Pixmap gui_athena_create_pullright_pixmap(Widget); +static void gui_athena_menu_timeout(XtPointer, XtIntervalId *); +static void gui_athena_popup_callback(Widget, XtPointer, XtPointer); +static void gui_athena_delayed_arm_action(Widget, XEvent *, String *, + Cardinal *); +static void gui_athena_popdown_submenus_action(Widget, XEvent *, + String *, Cardinal *); static XtActionsRec pullAction[2] = { { "menu-delayedpopup", (XtActionProc)gui_athena_delayed_arm_action}, { "menu-popdownsubmenus", (XtActionProc)gui_athena_popdown_submenus_action} @@ -65,16 +66,16 @@ static XtActionsRec pullAction[2] = { #endif #ifdef FEAT_TOOLBAR -static void gui_mch_reset_focus __ARGS((void)); +static void gui_mch_reset_focus(void); static Widget toolBar = (Widget)0; #endif -static void gui_athena_scroll_cb_jump __ARGS((Widget, XtPointer, XtPointer)); -static void gui_athena_scroll_cb_scroll __ARGS((Widget, XtPointer, XtPointer)); +static void gui_athena_scroll_cb_jump(Widget, XtPointer, XtPointer); +static void gui_athena_scroll_cb_scroll(Widget, XtPointer, XtPointer); #if defined(FEAT_GUI_DIALOG) || defined(FEAT_MENU) -static void gui_athena_menu_colors __ARGS((Widget id)); +static void gui_athena_menu_colors(Widget id); #endif -static void gui_athena_scroll_colors __ARGS((Widget id)); +static void gui_athena_scroll_colors(Widget id); #ifdef FEAT_MENU static XtTranslations popupTrans, parentTrans, menuTrans, supermenuTrans; @@ -87,9 +88,10 @@ static int puller_width = 0; * left or middle mouse button. */ static void -gui_athena_scroll_cb_jump(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data, call_data; +gui_athena_scroll_cb_jump( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data) { scrollbar_T *sb, *sb_info; long value; @@ -122,9 +124,10 @@ gui_athena_scroll_cb_jump(w, client_data, call_data) * right mouse buttons. */ static void -gui_athena_scroll_cb_scroll(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data, call_data; +gui_athena_scroll_cb_scroll( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data) { scrollbar_T *sb, *sb_info; long value; @@ -228,7 +231,7 @@ gui_athena_scroll_cb_scroll(w, client_data, call_data) * Create all the Athena widgets necessary. */ void -gui_x11_create_widgets() +gui_x11_create_widgets(void) { /* * We don't have any borders handled internally by the textArea to worry @@ -325,8 +328,7 @@ gui_x11_create_widgets() * Calculates the Pixmap based on the size of the current menu font. */ static Pixmap -gui_athena_create_pullright_pixmap(w) - Widget w; +gui_athena_create_pullright_pixmap(Widget w) { Pixmap retval; #ifdef FONTSET_ALWAYS @@ -425,7 +427,7 @@ gui_athena_create_pullright_pixmap(w) * Called when the GUI is not going to start after all. */ void -gui_x11_destroy_widgets() +gui_x11_destroy_widgets(void) { textArea = NULL; #ifdef FEAT_MENU @@ -442,17 +444,15 @@ gui_x11_destroy_widgets() # include <X11/xpm.h> # endif -static void createXpmImages __ARGS((char_u *path, char **xpm, Pixmap *sen)); -static void get_toolbar_pixmap __ARGS((vimmenu_T *menu, Pixmap *sen)); +static void createXpmImages(char_u *path, char **xpm, Pixmap *sen); +static void get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen); /* * Allocated a pixmap for toolbar menu "menu". * Return in "sen". */ static void -get_toolbar_pixmap(menu, sen) - vimmenu_T *menu; - Pixmap *sen; +get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen) { char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ char **xpm = NULL; /* xpm array */ @@ -492,10 +492,7 @@ get_toolbar_pixmap(menu, sen) * insensitive Pixmap too. */ static void -createXpmImages(path, xpm, sen) - char_u *path; - char **xpm; - Pixmap *sen; +createXpmImages(char_u *path, char **xpm, Pixmap *sen) { Window rootWindow; XpmAttributes attrs; @@ -566,11 +563,11 @@ createXpmImages(path, xpm, sen) } void -gui_mch_set_toolbar_pos(x, y, w, h) - int x; - int y; - int w; - int h; +gui_mch_set_toolbar_pos( + int x, + int y, + int w, + int h) { Dimension border; int height; @@ -595,11 +592,11 @@ gui_mch_set_toolbar_pos(x, y, w, h) #endif void -gui_mch_set_text_area_pos(x, y, w, h) - int x; - int y; - int w; - int h; +gui_mch_set_text_area_pos( + int x, + int y, + int w, + int h) { XtUnmanageChild(textArea); XtVaSetValues(textArea, @@ -622,7 +619,7 @@ gui_mch_set_text_area_pos(x, y, w, h) * input go to the editor window, not the button */ static void -gui_mch_reset_focus() +gui_mch_reset_focus(void) { XtSetKeyboardFocus(vimForm, textArea); } @@ -630,7 +627,7 @@ gui_mch_reset_focus() void -gui_x11_set_back_color() +gui_x11_set_back_color(void) { if (textArea != NULL) XtVaSetValues(textArea, @@ -643,17 +640,16 @@ gui_x11_set_back_color() * Menu stuff. */ -static char_u *make_pull_name __ARGS((char_u * name)); -static Widget get_popup_entry __ARGS((Widget w)); -static Widget submenu_widget __ARGS((Widget)); -static Boolean has_submenu __ARGS((Widget)); -static void gui_mch_submenu_change __ARGS((vimmenu_T *mp, int colors)); -static void gui_athena_menu_font __ARGS((Widget id)); -static Boolean gui_athena_menu_has_submenus __ARGS((Widget, Widget)); +static char_u *make_pull_name(char_u * name); +static Widget get_popup_entry(Widget w); +static Widget submenu_widget(Widget); +static Boolean has_submenu(Widget); +static void gui_mch_submenu_change(vimmenu_T *mp, int colors); +static void gui_athena_menu_font(Widget id); +static Boolean gui_athena_menu_has_submenus(Widget, Widget); void -gui_mch_enable_menu(flag) - int flag; +gui_mch_enable_menu(int flag) { if (flag) { @@ -685,11 +681,11 @@ gui_mch_enable_menu(flag) } void -gui_mch_set_menu_pos(x, y, w, h) - int x; - int y; - int w; - int h; +gui_mch_set_menu_pos( + int x, + int y, + int w, + int h) { Dimension border; int height; @@ -717,8 +713,7 @@ gui_mch_set_menu_pos(x, y, w, h) * numChildren (end of children). */ static Cardinal -athena_calculate_ins_pos(widget) - Widget widget; +athena_calculate_ins_pos(Widget widget) { /* Assume that if the parent of the vimmenu_T is NULL, then we can get * to this menu by traversing "next", starting at "root_menu". @@ -764,9 +759,7 @@ athena_calculate_ins_pos(widget) } void -gui_mch_add_menu(menu, idx) - vimmenu_T *menu; - int idx UNUSED; +gui_mch_add_menu(vimmenu_T *menu, int idx UNUSED) { char_u *pullright_name; Dimension height, space, border; @@ -884,9 +877,7 @@ gui_mch_add_menu(menu, idx) * Ignore widget "ignore" in the pane. */ static Boolean -gui_athena_menu_has_submenus(id, ignore) - Widget id; - Widget ignore; +gui_athena_menu_has_submenus(Widget id, Widget ignore) { WidgetList children; Cardinal num_children; @@ -906,8 +897,7 @@ gui_athena_menu_has_submenus(id, ignore) } static void -gui_athena_menu_font(id) - Widget id; +gui_athena_menu_font(Widget id) { #ifdef FONTSET_ALWAYS if (gui.menu_fontset != NOFONTSET) @@ -954,7 +944,7 @@ gui_athena_menu_font(id) void -gui_mch_new_menu_font() +gui_mch_new_menu_font(void) { Pixmap oldpuller = None; @@ -1029,9 +1019,9 @@ gui_mch_new_menu_font() XFreePixmap(gui.dpy, oldpuller); } -#if defined(FEAT_BEVAL) || defined(PROTO) +#if defined(FEAT_BEVAL_GUI) || defined(PROTO) void -gui_mch_new_tooltip_font() +gui_mch_new_tooltip_font(void) { # ifdef FEAT_TOOLBAR vimmenu_T *menu; @@ -1046,7 +1036,7 @@ gui_mch_new_tooltip_font() } void -gui_mch_new_tooltip_colors() +gui_mch_new_tooltip_colors(void) { # ifdef FEAT_TOOLBAR vimmenu_T *menu; @@ -1062,9 +1052,9 @@ gui_mch_new_tooltip_colors() #endif static void -gui_mch_submenu_change(menu, colors) - vimmenu_T *menu; - int colors; /* TRUE for colors, FALSE for font */ +gui_mch_submenu_change( + vimmenu_T *menu, + int colors) /* TRUE for colors, FALSE for font */ { vimmenu_T *mp; @@ -1086,7 +1076,7 @@ gui_mch_submenu_change(menu, colors) XtVaSetValues(mp->id, XtNbitmap, mp->image, NULL); } -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI /* If we have a tooltip, then we need to change it's colors */ if (mp->tip != NULL) { @@ -1104,7 +1094,7 @@ gui_mch_submenu_change(menu, colors) else { gui_athena_menu_font(mp->id); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI /* If we have a tooltip, then we need to change it's font */ /* Assume XtNinternational == True (in createBalloonEvalWindow) */ @@ -1141,8 +1131,7 @@ gui_mch_submenu_change(menu, colors) * Replace '.' by '_', can't include '.' in the submenu name. */ static char_u * -make_pull_name(name) - char_u * name; +make_pull_name(char_u * name) { char_u *pname; char_u *p; @@ -1158,9 +1147,7 @@ make_pull_name(name) } void -gui_mch_add_menu_item(menu, idx) - vimmenu_T *menu; - int idx UNUSED; +gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED) { vimmenu_T *parent = menu->parent; @@ -1214,7 +1201,7 @@ gui_mch_add_menu_item(menu, idx) XtSetValues(menu->id, args, n); gui_athena_menu_colors(menu->id); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI gui_mch_menu_set_tip(menu); #endif @@ -1404,7 +1391,7 @@ gui_mch_show_toolbar(int showit) int -gui_mch_compute_toolbar_height() +gui_mch_compute_toolbar_height(void) { Dimension height; /* total Toolbar height */ Dimension whgt; /* height of each widget */ @@ -1439,12 +1426,12 @@ gui_mch_compute_toolbar_height() } void -gui_mch_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp) - Pixel *bgp; - Pixel *fgp; - Pixel *bsp; - Pixel *tsp; - Pixel *hsp; +gui_mch_get_toolbar_colors( + Pixel *bgp, + Pixel *fgp, + Pixel *bsp, + Pixel *tsp, + Pixel *hsp) { XtVaGetValues(toolBar, XtNbackground, bgp, XtNborderColor, fgp, NULL); *bsp = *bgp; @@ -1455,14 +1442,13 @@ gui_mch_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp) void -gui_mch_toggle_tearoffs(enable) - int enable UNUSED; +gui_mch_toggle_tearoffs(int enable UNUSED) { /* no tearoff menus */ } void -gui_mch_new_menu_colors() +gui_mch_new_menu_colors(void) { if (menuBar == (Widget)0) return; @@ -1480,8 +1466,7 @@ gui_mch_new_menu_colors() * Destroy the machine specific menu widget. */ void -gui_mch_destroy_menu(menu) - vimmenu_T *menu; +gui_mch_destroy_menu(vimmenu_T *menu) { Widget parent; @@ -1553,7 +1538,7 @@ gui_mch_destroy_menu(menu) XtVaGetValues(menu->id, XtNheight, &height, NULL); -#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL) +#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) if (parent == toolBar && menu->tip != NULL) { /* We try to destroy this before the actual menu, because there are @@ -1626,9 +1611,9 @@ gui_mch_destroy_menu(menu) } static void -gui_athena_menu_timeout(client_data, id) - XtPointer client_data; - XtIntervalId *id UNUSED; +gui_athena_menu_timeout( + XtPointer client_data, + XtIntervalId *id UNUSED) { Widget w = (Widget)client_data; Widget popup; @@ -1658,10 +1643,10 @@ gui_athena_menu_timeout(client_data, id) * This is called when XtPopup() is called. */ static void -gui_athena_popup_callback(w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data UNUSED; +gui_athena_popup_callback( + Widget w, + XtPointer client_data, + XtPointer call_data UNUSED) { /* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */ vimmenu_T *menu = (vimmenu_T *)client_data; @@ -1690,11 +1675,11 @@ gui_athena_popup_callback(w, client_data, call_data) } static void -gui_athena_popdown_submenus_action(w, event, args, nargs) - Widget w; - XEvent *event; - String *args; - Cardinal *nargs; +gui_athena_popdown_submenus_action( + Widget w, + XEvent *event, + String *args, + Cardinal *nargs) { WidgetList children; Cardinal num_children; @@ -1719,8 +1704,7 @@ gui_athena_popdown_submenus_action(w, event, args, nargs) /* Used to determine if the given widget has a submenu that can be popped up. */ static Boolean -has_submenu(widget) - Widget widget; +has_submenu(Widget widget) { if ((widget != NULL) && XtIsSubclass(widget,smeBSBObjectClass)) { @@ -1734,11 +1718,11 @@ has_submenu(widget) } static void -gui_athena_delayed_arm_action(w, event, args, nargs) - Widget w; - XEvent *event; - String *args; - Cardinal *nargs; +gui_athena_delayed_arm_action( + Widget w, + XEvent *event, + String *args, + Cardinal *nargs) { Dimension width, height; @@ -1778,8 +1762,7 @@ gui_athena_delayed_arm_action(w, event, args, nargs) } static Widget -get_popup_entry(w) - Widget w; +get_popup_entry(Widget w) { Widget menuw; @@ -1794,8 +1777,7 @@ get_popup_entry(w) * that is to be popped up. */ static Widget -submenu_widget(widget) - Widget widget; +submenu_widget(Widget widget) { /* Precondition: has_submenu(widget) == True * XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True @@ -1814,8 +1796,7 @@ submenu_widget(widget) } void -gui_mch_show_popupmenu(menu) - vimmenu_T *menu; +gui_mch_show_popupmenu(vimmenu_T *menu) { int rootx, rooty, winx, winy; Window root, child; @@ -1850,7 +1831,7 @@ gui_mch_show_popupmenu(menu) * Set the menu and scrollbar colors to their default values. */ void -gui_mch_def_colors() +gui_mch_def_colors(void) { /* * Get the colors ourselves. Using the automatic conversion doesn't @@ -1862,7 +1843,7 @@ gui_mch_def_colors() gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name); gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name); gui.scroll_bg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_bg_name); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); gui.tooltip_bg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_bg_name); #endif @@ -1875,11 +1856,11 @@ gui_mch_def_colors() */ void -gui_mch_set_scrollbar_thumb(sb, val, size, max) - scrollbar_T *sb; - long val; - long size; - long max; +gui_mch_set_scrollbar_thumb( + scrollbar_T *sb, + long val, + long size, + long max) { double v, s; @@ -1911,12 +1892,12 @@ gui_mch_set_scrollbar_thumb(sb, val, size, max) } void -gui_mch_set_scrollbar_pos(sb, x, y, w, h) - scrollbar_T *sb; - int x; - int y; - int w; - int h; +gui_mch_set_scrollbar_pos( + scrollbar_T *sb, + int x, + int y, + int w, + int h) { if (sb->id == (Widget)0) return; @@ -1932,9 +1913,7 @@ gui_mch_set_scrollbar_pos(sb, x, y, w, h) } void -gui_mch_enable_scrollbar(sb, flag) - scrollbar_T *sb; - int flag; +gui_mch_enable_scrollbar(scrollbar_T *sb, int flag) { if (sb->id != (Widget)0) { @@ -1946,9 +1925,9 @@ gui_mch_enable_scrollbar(sb, flag) } void -gui_mch_create_scrollbar(sb, orient) - scrollbar_T *sb; - int orient; /* SBAR_VERT or SBAR_HORIZ */ +gui_mch_create_scrollbar( + scrollbar_T *sb, + int orient) /* SBAR_VERT or SBAR_HORIZ */ { sb->id = XtVaCreateWidget("scrollBar", #ifdef FEAT_GUI_NEXTAW @@ -1982,19 +1961,15 @@ gui_mch_create_scrollbar(sb, orient) #endif } -#if defined(FEAT_WINDOWS) || defined(PROTO) void -gui_mch_destroy_scrollbar(sb) - scrollbar_T *sb; +gui_mch_destroy_scrollbar(scrollbar_T *sb) { if (sb->id != (Widget)0) XtDestroyWidget(sb->id); } -#endif void -gui_mch_set_scrollbar_colors(sb) - scrollbar_T *sb; +gui_mch_set_scrollbar_colors(scrollbar_T *sb) { if (sb->id != (Widget)0) XtVaSetValues(sb->id, @@ -2011,7 +1986,7 @@ gui_mch_set_scrollbar_colors(sb) * Miscellaneous stuff: */ Window -gui_x11_get_wid() +gui_x11_get_wid(void) { return XtWindow(textArea); } @@ -2022,13 +1997,13 @@ gui_x11_get_wid() * Returns the selected name in allocated memory, or NULL for Cancel. */ char_u * -gui_mch_browse(saving, title, dflt, ext, initdir, filter) - int saving UNUSED; /* select file to write */ - char_u *title; /* title for the window */ - char_u *dflt; /* default name */ - char_u *ext UNUSED; /* extension added */ - char_u *initdir; /* initial directory, NULL for current dir */ - char_u *filter UNUSED; /* file name filter */ +gui_mch_browse( + int saving UNUSED, /* select file to write */ + char_u *title, /* title for the window */ + char_u *dflt, /* default name */ + char_u *ext UNUSED, /* extension added */ + char_u *initdir, /* initial directory, NULL for current dir */ + char_u *filter UNUSED) /* file name filter */ { Position x, y; char_u dirbuf[MAXPATHL]; @@ -2066,20 +2041,20 @@ gui_mch_browse(saving, title, dflt, ext, initdir, filter) static int dialogStatus; static Atom dialogatom; -static void keyhit_callback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont)); -static void butproc __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void dialog_wm_handler __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *dum)); +static void keyhit_callback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); +static void butproc(Widget w, XtPointer client_data, XtPointer call_data); +static void dialog_wm_handler(Widget w, XtPointer client_data, XEvent *event, Boolean *dum); /* * Callback function for the textfield. When CR is hit this works like * hitting the "OK" button, ESC like "Cancel". */ static void -keyhit_callback(w, client_data, event, cont) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *cont UNUSED; +keyhit_callback( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *cont UNUSED) { char buf[2]; @@ -2093,10 +2068,10 @@ keyhit_callback(w, client_data, event, cont) } static void -butproc(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +butproc( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { dialogStatus = (int)(long)client_data + 1; } @@ -2105,11 +2080,11 @@ butproc(w, client_data, call_data) * Function called when dialog window closed. */ static void -dialog_wm_handler(w, client_data, event, dum) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *dum UNUSED; +dialog_wm_handler( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *dum UNUSED) { if (event->type == ClientMessage && (Atom)((XClientMessageEvent *)event)->data.l[0] == dialogatom) @@ -2117,14 +2092,14 @@ dialog_wm_handler(w, client_data, event, dum) } int -gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd) - int type UNUSED; - char_u *title; - char_u *message; - char_u *buttons; - int dfltbutton UNUSED; - char_u *textfield; - int ex_cmd UNUSED; +gui_mch_dialog( + int type UNUSED, + char_u *title, + char_u *message, + char_u *buttons, + int dfltbutton UNUSED, + char_u *textfield, + int ex_cmd UNUSED) { char_u *buts; char_u *p, *next; @@ -2305,8 +2280,7 @@ gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd) * Set the colors of Widget "id" to the menu colors. */ static void -gui_athena_menu_colors(id) - Widget id; +gui_athena_menu_colors(Widget id) { if (gui.menu_bg_pixel != INVALCOLOR) XtVaSetValues(id, XtNbackground, gui.menu_bg_pixel, NULL); @@ -2319,8 +2293,7 @@ gui_athena_menu_colors(id) * Set the colors of Widget "id" to the scroll colors. */ static void -gui_athena_scroll_colors(id) - Widget id; +gui_athena_scroll_colors(Widget id) { if (gui.scroll_bg_pixel != INVALCOLOR) XtVaSetValues(id, XtNbackground, gui.scroll_bg_pixel, NULL); diff --git a/src/gui_beval.c b/src/gui_beval.c index f95603987c..1d822500f7 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -10,110 +10,17 @@ #include "vim.h" -#if defined(FEAT_BEVAL) || defined(PROTO) - -/* - * Common code, invoked when the mouse is resting for a moment. - */ - void -general_beval_cb(beval, state) - BalloonEval *beval; - int state UNUSED; -{ -#ifdef FEAT_EVAL - win_T *wp; - int col; - int use_sandbox; - linenr_T lnum; - char_u *text; - static char_u *result = NULL; - long winnr = 0; - char_u *bexpr; - buf_T *save_curbuf; -# ifdef FEAT_WINDOWS - win_T *cw; -# endif -#endif - static int recursive = FALSE; - - /* Don't do anything when 'ballooneval' is off, messages scrolled the - * windows up or we have no beval area. */ - if (!p_beval || balloonEval == NULL || msg_scrolled > 0) - return; - - /* Don't do this recursively. Happens when the expression evaluation - * takes a long time and invokes something that checks for CTRL-C typed. */ - if (recursive) - return; - recursive = TRUE; - -#ifdef FEAT_EVAL - if (get_beval_info(balloonEval, TRUE, &wp, &lnum, &text, &col) == OK) - { - bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr - : wp->w_buffer->b_p_bexpr; - if (*bexpr != NUL) - { -# ifdef FEAT_WINDOWS - /* Convert window pointer to number. */ - for (cw = firstwin; cw != wp; cw = cw->w_next) - ++winnr; -# endif - - set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); - set_vim_var_nr(VV_BEVAL_WINNR, winnr); - set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); - set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); - set_vim_var_string(VV_BEVAL_TEXT, text, -1); - vim_free(text); - - /* - * Temporarily change the curbuf, so that we can determine whether - * the buffer-local balloonexpr option was set insecurely. - */ - save_curbuf = curbuf; - curbuf = wp->w_buffer; - use_sandbox = was_set_insecurely((char_u *)"balloonexpr", - *curbuf->b_p_bexpr == NUL ? 0 : OPT_LOCAL); - curbuf = save_curbuf; - if (use_sandbox) - ++sandbox; - ++textlock; - - vim_free(result); - result = eval_to_string(bexpr, NULL, TRUE); - - if (use_sandbox) - --sandbox; - --textlock; - - set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); - if (result != NULL && result[0] != NUL) - { - gui_mch_post_balloon(beval, result); - recursive = FALSE; - return; - } - } - } -#endif -#ifdef FEAT_NETBEANS_INTG - if (bevalServers & BEVAL_NETBEANS) - netbeans_beval_cb(beval, state); -#endif -#ifdef FEAT_SUN_WORKSHOP - if (bevalServers & BEVAL_WORKSHOP) - workshop_beval_cb(beval, state); -#endif - - recursive = FALSE; -} +#if defined(FEAT_BEVAL_GUI) || defined(PROTO) /* on Win32 and MacVim only get_beval_info() is required */ #if !(defined(FEAT_GUI_W32) || defined(FEAT_GUI_MACVIM)) || defined(PROTO) #ifdef FEAT_GUI_GTK -# include <gdk/gdkkeysyms.h> +# if GTK_CHECK_VERSION(3,0,0) +# include <gdk/gdkkeysyms-compat.h> +# else +# include <gdk/gdkkeysyms.h> +# endif # include <gtk/gtk.h> #else # include <X11/keysym.h> @@ -135,8 +42,6 @@ general_beval_cb(beval, state) # endif #endif -#include "gui_beval.h" - #ifndef FEAT_GUI_GTK extern Widget vimShell; @@ -149,28 +54,34 @@ static BalloonEval *current_beval = NULL; #endif #ifdef FEAT_GUI_GTK -static void addEventHandler __ARGS((GtkWidget *, BalloonEval *)); -static void removeEventHandler __ARGS((BalloonEval *)); -static gint target_event_cb __ARGS((GtkWidget *, GdkEvent *, gpointer)); -static gint mainwin_event_cb __ARGS((GtkWidget *, GdkEvent *, gpointer)); -static void pointer_event __ARGS((BalloonEval *, int, int, unsigned)); -static void key_event __ARGS((BalloonEval *, unsigned, int)); -static gint timeout_cb __ARGS((gpointer)); -static gint balloon_expose_event_cb __ARGS((GtkWidget *, GdkEventExpose *, gpointer)); +static void addEventHandler(GtkWidget *, BalloonEval *); +static void removeEventHandler(BalloonEval *); +static gint target_event_cb(GtkWidget *, GdkEvent *, gpointer); +static gint mainwin_event_cb(GtkWidget *, GdkEvent *, gpointer); +static void pointer_event(BalloonEval *, int, int, unsigned); +static void key_event(BalloonEval *, unsigned, int); +# if GTK_CHECK_VERSION(3,0,0) +static gboolean timeout_cb(gpointer); +# else +static gint timeout_cb(gpointer); +# endif +# if GTK_CHECK_VERSION(3,0,0) +static gboolean balloon_draw_event_cb (GtkWidget *, cairo_t *, gpointer); +# else +static gint balloon_expose_event_cb (GtkWidget *, GdkEventExpose *, gpointer); +# endif #else -static void addEventHandler __ARGS((Widget, BalloonEval *)); -static void removeEventHandler __ARGS((BalloonEval *)); -static void pointerEventEH __ARGS((Widget, XtPointer, XEvent *, Boolean *)); -static void pointerEvent __ARGS((BalloonEval *, XEvent *)); -static void timerRoutine __ARGS((XtPointer, XtIntervalId *)); +static void addEventHandler(Widget, BalloonEval *); +static void removeEventHandler(BalloonEval *); +static void pointerEventEH(Widget, XtPointer, XEvent *, Boolean *); +static void pointerEvent(BalloonEval *, XEvent *); +static void timerRoutine(XtPointer, XtIntervalId *); #endif -static void cancelBalloon __ARGS((BalloonEval *)); -static void requestBalloon __ARGS((BalloonEval *)); -static void drawBalloon __ARGS((BalloonEval *)); -static void undrawBalloon __ARGS((BalloonEval *beval)); -static void createBalloonEvalWindow __ARGS((BalloonEval *)); - - +static void cancelBalloon(BalloonEval *); +static void requestBalloon(BalloonEval *); +static void drawBalloon(BalloonEval *); +static void undrawBalloon(BalloonEval *beval); +static void createBalloonEvalWindow(BalloonEval *); /* * Create a balloon-evaluation area for a Widget. @@ -181,11 +92,11 @@ static void createBalloonEvalWindow __ARGS((BalloonEval *)); * Returns a pointer to the resulting object (NULL when out of memory). */ BalloonEval * -gui_mch_create_beval_area(target, mesg, mesgCB, clientData) - void *target; - char_u *mesg; - void (*mesgCB)__ARGS((BalloonEval *, int)); - void *clientData; +gui_mch_create_beval_area( + void *target, + char_u *mesg, + void (*mesgCB)(BalloonEval *, int), + void *clientData) { #ifndef FEAT_GUI_GTK char *display_name; /* get from gui.dpy */ @@ -196,7 +107,7 @@ gui_mch_create_beval_area(target, mesg, mesgCB, clientData) if (mesg != NULL && mesgCB != NULL) { - EMSG(_("E232: Cannot create BalloonEval with both message and callback")); + IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } @@ -251,8 +162,7 @@ gui_mch_create_beval_area(target, mesg, mesgCB, clientData) * Destroy a balloon-eval and free its associated memory. */ void -gui_mch_destroy_beval_area(beval) - BalloonEval *beval; +gui_mch_destroy_beval_area(BalloonEval *beval) { cancelBalloon(beval); removeEventHandler(beval); @@ -267,16 +177,14 @@ gui_mch_destroy_beval_area(beval) #endif void -gui_mch_enable_beval_area(beval) - BalloonEval *beval; +gui_mch_enable_beval_area(BalloonEval *beval) { if (beval != NULL) addEventHandler(beval->target, beval); } void -gui_mch_disable_beval_area(beval) - BalloonEval *beval; +gui_mch_disable_beval_area(BalloonEval *beval) { if (beval != NULL) removeEventHandler(beval); @@ -290,7 +198,7 @@ gui_mch_disable_beval_area(beval) * Assumption: Only one tooltip can be shown at a time. */ BalloonEval * -gui_mch_currently_showing_beval() +gui_mch_currently_showing_beval(void) { return current_beval; } @@ -299,126 +207,13 @@ gui_mch_currently_showing_beval() #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) \ || defined(FEAT_EVAL) || defined(PROTO) -/* - * Get the text and position to be evaluated for "beval". - * If "getword" is true the returned text is not the whole line but the - * relevant word in allocated memory. - * Returns OK or FAIL. - */ - int -get_beval_info(beval, getword, winp, lnump, textp, colp) - BalloonEval *beval; - int getword; - win_T **winp; - linenr_T *lnump; - char_u **textp; - int *colp; -{ - win_T *wp; - int row, col; - char_u *lbuf; - linenr_T lnum; - - *textp = NULL; - row = Y_2_ROW(beval->y); - col = X_2_COL(beval->x); -#ifdef FEAT_WINDOWS - wp = mouse_find_win(&row, &col); -#else - wp = firstwin; -#endif - if (wp != NULL && row < wp->w_height && col < W_WIDTH(wp)) - { - /* Found a window and the cursor is in the text. Now find the line - * number. */ - if (!mouse_comp_pos(wp, &row, &col, &lnum)) - { - /* Not past end of the file. */ - lbuf = ml_get_buf(wp->w_buffer, lnum, FALSE); - if (col <= win_linetabsize(wp, lbuf, (colnr_T)MAXCOL)) - { - /* Not past end of line. */ - if (getword) - { - /* For Netbeans we get the relevant part of the line - * instead of the whole line. */ - int len; - pos_T *spos = NULL, *epos = NULL; - - if (VIsual_active) - { - if (lt(VIsual, curwin->w_cursor)) - { - spos = &VIsual; - epos = &curwin->w_cursor; - } - else - { - spos = &curwin->w_cursor; - epos = &VIsual; - } - } - - col = vcol2col(wp, lnum, col); - - if (VIsual_active - && wp->w_buffer == curwin->w_buffer - && (lnum == spos->lnum - ? col >= (int)spos->col - : lnum > spos->lnum) - && (lnum == epos->lnum - ? col <= (int)epos->col - : lnum < epos->lnum)) - { - /* Visual mode and pointing to the line with the - * Visual selection: return selected text, with a - * maximum of one line. */ - if (spos->lnum != epos->lnum || spos->col == epos->col) - return FAIL; - - lbuf = ml_get_buf(curwin->w_buffer, VIsual.lnum, FALSE); - len = epos->col - spos->col; - if (*p_sel != 'e') - len += MB_PTR2LEN(lbuf + epos->col); - lbuf = vim_strnsave(lbuf + spos->col, len); - lnum = spos->lnum; - col = spos->col; - } - else - { - /* Find the word under the cursor. */ - ++emsg_off; - len = find_ident_at_pos(wp, lnum, (colnr_T)col, &lbuf, - FIND_IDENT + FIND_STRING + FIND_EVAL); - --emsg_off; - if (len == 0) - return FAIL; - lbuf = vim_strnsave(lbuf, len); - } - } - - *winp = wp; - *lnump = lnum; - *textp = lbuf; - *colp = col; - beval->ts = wp->w_buffer->b_p_ts; - return OK; - } - } - } - - return FAIL; -} - # if !(defined(FEAT_GUI_W32) || defined(FEAT_GUI_MACVIM)) || defined(PROTO) /* * Show a balloon with "mesg". */ void -gui_mch_post_balloon(beval, mesg) - BalloonEval *beval; - char_u *mesg; +gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { beval->msg = mesg; if (mesg != NULL) @@ -426,7 +221,7 @@ gui_mch_post_balloon(beval, mesg) else undrawBalloon(beval); } -# endif /* FEAT_GUI_W32 || FEAT_GUI_MACVIM */ +# endif /* !(FEAT_GUI_W32 || FEAT_GUI_MACVIM) */ #endif /* FEAT_SUN_WORKSHOP || FEAT_NETBEANS_INTG || PROTO */ #if !(defined(FEAT_GUI_W32) || defined(FEAT_GUI_MACVIM)) || defined(PROTO) @@ -435,18 +230,13 @@ gui_mch_post_balloon(beval, mesg) * Hide the given balloon. */ void -gui_mch_unpost_balloon(beval) - BalloonEval *beval; +gui_mch_unpost_balloon(BalloonEval *beval) { undrawBalloon(beval); } #endif #ifdef FEAT_GUI_GTK -/* - * We can unconditionally use ANSI-style prototypes here since - * GTK+ requires an ANSI C compiler anyway. - */ static void addEventHandler(GtkWidget *target, BalloonEval *beval) { @@ -456,10 +246,16 @@ addEventHandler(GtkWidget *target, BalloonEval *beval) * This allows us to catch events independently of the signal handlers * in gui_gtk_x11.c. */ +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(target), "event", + G_CALLBACK(target_event_cb), + beval); +# else /* Should use GTK_OBJECT() here, but that causes a lint warning... */ gtk_signal_connect((GtkObject*)(target), "event", GTK_SIGNAL_FUNC(target_event_cb), beval); +# endif /* * Nasty: Key press events go to the main window thus the drawing area * will never see them. This means we have to connect to the main window @@ -468,9 +264,15 @@ addEventHandler(GtkWidget *target, BalloonEval *beval) if (gtk_socket_id == 0 && gui.mainwin != NULL && gtk_widget_is_ancestor(target, gui.mainwin)) { +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.mainwin), "event", + G_CALLBACK(mainwin_event_cb), + beval); +# else gtk_signal_connect((GtkObject*)(gui.mainwin), "event", GTK_SIGNAL_FUNC(mainwin_event_cb), beval); +# endif } } @@ -478,17 +280,29 @@ addEventHandler(GtkWidget *target, BalloonEval *beval) removeEventHandler(BalloonEval *beval) { /* LINTED: avoid warning: dubious operation on enum */ +# if GTK_CHECK_VERSION(3,0,0) + g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), + FUNC2GENERIC(target_event_cb), + beval); +# else gtk_signal_disconnect_by_func((GtkObject*)(beval->target), GTK_SIGNAL_FUNC(target_event_cb), beval); +# endif if (gtk_socket_id == 0 && gui.mainwin != NULL && gtk_widget_is_ancestor(beval->target, gui.mainwin)) { /* LINTED: avoid warning: dubious operation on enum */ +# if GTK_CHECK_VERSION(3,0,0) + g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin), + FUNC2GENERIC(mainwin_event_cb), + beval); +# else gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), GTK_SIGNAL_FUNC(mainwin_event_cb), beval); +# endif } } @@ -514,7 +328,22 @@ target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) * GDK_POINTER_MOTION_HINT_MASK is set, thus we cannot obtain * the coordinates from the GdkEventMotion struct directly. */ +# if GTK_CHECK_VERSION(3,0,0) + { + GdkWindow * const win = gtk_widget_get_window(widget); + GdkDisplay * const dpy = gdk_window_get_display(win); +# if GTK_CHECK_VERSION(3,20,0) + GdkSeat * const seat = gdk_display_get_default_seat(dpy); + GdkDevice * const dev = gdk_seat_get_pointer(seat); +# else + GdkDeviceManager * const mngr = gdk_display_get_device_manager(dpy); + GdkDevice * const dev = gdk_device_manager_get_client_pointer(mngr); +# endif + gdk_window_get_device_position(win, dev , &x, &y, &state); + } +# else gdk_window_get_pointer(widget->window, &x, &y, &state); +# endif pointer_event(beval, x, y, (unsigned int)state); } else @@ -606,8 +435,13 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state) } else { +# if GTK_CHECK_VERSION(3,0,0) + beval->timerID = g_timeout_add((guint)p_bdlay, + &timeout_cb, beval); +# else beval->timerID = gtk_timeout_add((guint32)p_bdlay, &timeout_cb, beval); +# endif } } } @@ -644,7 +478,11 @@ key_event(BalloonEval *beval, unsigned keyval, int is_keypress) cancelBalloon(beval); } +# if GTK_CHECK_VERSION(3,0,0) + static gboolean +# else static gint +# endif timeout_cb(gpointer data) { BalloonEval *beval = (BalloonEval *)data; @@ -660,6 +498,37 @@ timeout_cb(gpointer data) return FALSE; /* don't call me again */ } +# if GTK_CHECK_VERSION(3,0,0) + static gboolean +balloon_draw_event_cb(GtkWidget *widget, + cairo_t *cr, + gpointer data UNUSED) +{ + GtkStyleContext *context = NULL; + gint width = -1, height = -1; + + if (widget == NULL) + return TRUE; + + context = gtk_widget_get_style_context(widget); + width = gtk_widget_get_allocated_width(widget); + height = gtk_widget_get_allocated_height(widget); + + gtk_style_context_save(context); + + gtk_style_context_add_class(context, "tooltip"); + gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL); + + cairo_save(cr); + gtk_render_frame(context, cr, 0, 0, width, height); + gtk_render_background(context, cr, 0, 0, width, height); + cairo_restore(cr); + + gtk_style_context_restore(context); + + return FALSE; +} +# else static gint balloon_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, @@ -672,13 +541,12 @@ balloon_expose_event_cb(GtkWidget *widget, return FALSE; /* continue emission */ } +# endif /* !GTK_CHECK_VERSION(3,0,0) */ #else /* !FEAT_GUI_GTK */ static void -addEventHandler(target, beval) - Widget target; - BalloonEval *beval; +addEventHandler(Widget target, BalloonEval *beval) { XtAddEventHandler(target, PointerMotionMask | EnterWindowMask | @@ -689,8 +557,7 @@ addEventHandler(target, beval) } static void -removeEventHandler(beval) - BalloonEval *beval; +removeEventHandler(BalloonEval *beval) { XtRemoveEventHandler(beval->target, PointerMotionMask | EnterWindowMask | @@ -705,11 +572,11 @@ removeEventHandler(beval) * The X event handler. All it does is call the real event handler. */ static void -pointerEventEH(w, client_data, event, unused) - Widget w UNUSED; - XtPointer client_data; - XEvent *event; - Boolean *unused UNUSED; +pointerEventEH( + Widget w UNUSED, + XtPointer client_data, + XEvent *event, + Boolean *unused UNUSED) { BalloonEval *beval = (BalloonEval *)client_data; pointerEvent(beval, event); @@ -722,9 +589,7 @@ pointerEventEH(w, client_data, event, unused) */ static void -pointerEvent(beval, event) - BalloonEval *beval; - XEvent *event; +pointerEvent(BalloonEval *beval, XEvent *event) { Position distance; /* a measure of how much the pointer moved */ Position delta; /* used to compute distance */ @@ -855,9 +720,7 @@ pointerEvent(beval, event) } static void -timerRoutine(dx, id) - XtPointer dx; - XtIntervalId *id UNUSED; +timerRoutine(XtPointer dx, XtIntervalId *id UNUSED) { BalloonEval *beval = (BalloonEval *)dx; @@ -874,8 +737,7 @@ timerRoutine(dx, id) #endif /* !FEAT_GUI_GTK */ static void -requestBalloon(beval) - BalloonEval *beval; +requestBalloon(BalloonEval *beval) { if (beval->showState != ShS_PENDING) { @@ -956,14 +818,30 @@ set_printable_label_text(GtkLabel *label, char_u *text) attrentry_T *aep; PangoAttribute *attr; guicolor_T pixel; +#if GTK_CHECK_VERSION(3,0,0) + GdkRGBA color = { 0.0, 0.0, 0.0, 1.0 }; +# if PANGO_VERSION_CHECK(1,38,0) + PangoAttribute *attr_alpha; +# endif +#else GdkColor color = { 0, 0, 0, 0 }; +#endif /* Look up the RGB values of the SpecialKey foreground color. */ - aep = syn_gui_attr2entry(hl_attr(HLF_8)); + aep = syn_gui_attr2entry(HL_ATTR(HLF_8)); pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR; if (pixel != INVALCOLOR) +# if GTK_CHECK_VERSION(3,0,0) + { + color.red = ((pixel & 0xff0000) >> 16) / 255.0; + color.green = ((pixel & 0xff00) >> 8) / 255.0; + color.blue = (pixel & 0xff) / 255.0; + color.alpha = 1.0; + } +# else gdk_colormap_query_color(gtk_widget_get_colormap(gui.drawarea), (unsigned long)pixel, &color); +# endif pdest = buf; p = text; @@ -1007,11 +885,31 @@ set_printable_label_text(GtkLabel *label, char_u *text) } if (pixel != INVALCOLOR) { +#if GTK_CHECK_VERSION(3,0,0) +# define DOUBLE2UINT16(val) ((guint16)((val) * 65535 + 0.5)) + attr = pango_attr_foreground_new( + DOUBLE2UINT16(color.red), + DOUBLE2UINT16(color.green), + DOUBLE2UINT16(color.blue)); +# if PANGO_VERSION_CHECK(1,38,0) + attr_alpha = pango_attr_foreground_alpha_new( + DOUBLE2UINT16(color.alpha)); +# endif +# undef DOUBLE2UINT16 +#else attr = pango_attr_foreground_new( color.red, color.green, color.blue); +#endif attr->start_index = pdest - buf; attr->end_index = pdest - buf + outlen; pango_attr_list_insert(attr_list, attr); +#if GTK_CHECK_VERSION(3,0,0) +# if PANGO_VERSION_CHECK(1,38,0) + attr_alpha->start_index = pdest - buf; + attr_alpha->end_index = pdest - buf + outlen; + pango_attr_list_insert(attr_list, attr_alpha); +# endif +#endif } pdest += outlen; p += charlen; @@ -1053,19 +951,19 @@ drawBalloon(BalloonEval *beval) int x_offset = EVAL_OFFSET_X; int y_offset = EVAL_OFFSET_Y; PangoLayout *layout; -# ifdef HAVE_GTK_MULTIHEAD + +# if !GTK_CHECK_VERSION(3,22,2) GdkScreen *screen; screen = gtk_widget_get_screen(beval->target); gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); - screen_w = gdk_screen_get_width(screen); - screen_h = gdk_screen_get_height(screen); -# else - screen_w = gdk_screen_width(); - screen_h = gdk_screen_height(); # endif + gui_gtk_get_screen_size_of_win(beval->balloonShell, + &screen_w, &screen_h); +# if !GTK_CHECK_VERSION(3,0,0) gtk_widget_ensure_style(beval->balloonShell); gtk_widget_ensure_style(beval->balloonLabel); +# endif set_printable_label_text(GTK_LABEL(beval->balloonLabel), beval->msg); /* @@ -1086,10 +984,18 @@ drawBalloon(BalloonEval *beval) MAX(20, screen_w - 20))); /* Calculate the balloon's width and height. */ +# if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL); +# else gtk_widget_size_request(beval->balloonShell, &requisition); +# endif /* Compute position of the balloon area */ +# if GTK_CHECK_VERSION(3,0,0) + gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y); +# else gdk_window_get_origin(beval->target->window, &x, &y); +# endif x += beval->x; y += beval->y; @@ -1104,7 +1010,11 @@ drawBalloon(BalloonEval *beval) y = CLAMP(y + y_offset, 0, MAX(0, screen_h - requisition.height)); /* Show the balloon */ +# if GTK_CHECK_VERSION(3,0,0) + gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); +# else gtk_widget_set_uposition(beval->balloonShell, x, y); +# endif gtk_widget_show(beval->balloonShell); beval->showState = ShS_SHOWING; @@ -1131,7 +1041,11 @@ cancelBalloon(BalloonEval *beval) if (beval->timerID != 0) { +# if GTK_CHECK_VERSION(3,0,0) + g_source_remove(beval->timerID); +# else gtk_timeout_remove(beval->timerID); +# endif beval->timerID = 0; } beval->showState = ShS_NEUTRAL; @@ -1143,17 +1057,42 @@ createBalloonEvalWindow(BalloonEval *beval) beval->balloonShell = gtk_window_new(GTK_WINDOW_POPUP); gtk_widget_set_app_paintable(beval->balloonShell, TRUE); +# if GTK_CHECK_VERSION(3,0,0) + gtk_window_set_resizable(GTK_WINDOW(beval->balloonShell), FALSE); +# else gtk_window_set_policy(GTK_WINDOW(beval->balloonShell), FALSE, FALSE, TRUE); +# endif gtk_widget_set_name(beval->balloonShell, "gtk-tooltips"); +# if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(beval->balloonShell), 4); +# else gtk_container_border_width(GTK_CONTAINER(beval->balloonShell), 4); +# endif +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(beval->balloonShell), "draw", + G_CALLBACK(balloon_draw_event_cb), NULL); +# else gtk_signal_connect((GtkObject*)(beval->balloonShell), "expose_event", GTK_SIGNAL_FUNC(balloon_expose_event_cb), NULL); +# endif beval->balloonLabel = gtk_label_new(NULL); gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE); gtk_label_set_justify(GTK_LABEL(beval->balloonLabel), GTK_JUSTIFY_LEFT); +# if GTK_CHECK_VERSION(3,16,0) + gtk_label_set_xalign(GTK_LABEL(beval->balloonLabel), 0.5); + gtk_label_set_yalign(GTK_LABEL(beval->balloonLabel), 0.5); +# elif GTK_CHECK_VERSION(3,14,0) + GValue align_val = G_VALUE_INIT; + g_value_init(&align_val, G_TYPE_FLOAT); + g_value_set_float(&align_val, 0.5); + g_object_set_property(G_OBJECT(beval->balloonLabel), "xalign", &align_val); + g_object_set_property(G_OBJECT(beval->balloonLabel), "yalign", &align_val); + g_value_unset(&align_val); +# else gtk_misc_set_alignment(GTK_MISC(beval->balloonLabel), 0.5f, 0.5f); +# endif gtk_widget_set_name(beval->balloonLabel, "vim-balloon-label"); gtk_widget_show(beval->balloonLabel); @@ -1166,8 +1105,7 @@ createBalloonEvalWindow(BalloonEval *beval) * Draw a balloon. */ static void -drawBalloon(beval) - BalloonEval *beval; +drawBalloon(BalloonEval *beval) { Dimension w; Dimension h; @@ -1270,8 +1208,7 @@ drawBalloon(beval) * Undraw a balloon. */ static void -undrawBalloon(beval) - BalloonEval *beval; +undrawBalloon(BalloonEval *beval) { if (beval->balloonShell != (Widget)0) XtPopdown(beval->balloonShell); @@ -1281,8 +1218,7 @@ undrawBalloon(beval) } static void -cancelBalloon(beval) - BalloonEval *beval; +cancelBalloon(BalloonEval *beval) { if (beval->showState == ShS_SHOWING || beval->showState == ShS_UPDATE_PENDING) @@ -1298,8 +1234,7 @@ cancelBalloon(beval) static void -createBalloonEvalWindow(beval) - BalloonEval *beval; +createBalloonEvalWindow(BalloonEval *beval) { Arg args[12]; int n; @@ -1342,4 +1277,4 @@ createBalloonEvalWindow(beval) #endif /* !FEAT_GUI_GTK */ #endif /* !(FEAT_GUI_W32 || FEAT_GUI_MACVIM) */ -#endif /* FEAT_BEVAL */ +#endif /* FEAT_BEVAL_GUI */ diff --git a/src/gui_beval.h b/src/gui_beval.h deleted file mode 100644 index 461bde0c90..0000000000 --- a/src/gui_beval.h +++ /dev/null @@ -1,80 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * Visual Workshop integration by Gordon Prieur - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -#if !defined(GUI_BEVAL_H) && (defined(FEAT_BEVAL) || defined(PROTO)) -#define GUI_BEVAL_H - -#ifdef FEAT_GUI_GTK -# include <gtk/gtkwidget.h> -#else -# if defined(FEAT_GUI_X11) -# include <X11/Intrinsic.h> -# endif -#endif - -typedef enum -{ - ShS_NEUTRAL, /* nothing showing or pending */ - ShS_PENDING, /* data requested from debugger */ - ShS_UPDATE_PENDING, /* switching information displayed */ - ShS_SHOWING /* the balloon is being displayed */ -} BeState; - -typedef struct BalloonEvalStruct -{ -#ifdef FEAT_GUI_GTK - GtkWidget *target; /* widget we are monitoring */ - GtkWidget *balloonShell; - GtkWidget *balloonLabel; - unsigned int timerID; /* timer for run */ - BeState showState; /* tells us whats currently going on */ - int x; - int y; - unsigned int state; /* Button/Modifier key state */ -#elif defined(FEAT_GUI_MACVIM) - int x; - int y; -#else -# if !defined(FEAT_GUI_W32) - Widget target; /* widget we are monitoring */ - Widget balloonShell; - Widget balloonLabel; - XtIntervalId timerID; /* timer for run */ - BeState showState; /* tells us whats currently going on */ - XtAppContext appContext; /* used in event handler */ - Position x; - Position y; - Position x_root; - Position y_root; - int state; /* Button/Modifier key state */ -# else - HWND target; - HWND balloon; - int x; - int y; - BeState showState; /* tells us whats currently going on */ -# endif -#endif - int ts; /* tabstop setting for this buffer */ - char_u *msg; - void (*msgCB)__ARGS((struct BalloonEvalStruct *, int)); - void *clientData; /* For callback */ -#if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32) \ - && !defined(FEAT_GUI_MACVIM) - Dimension screen_width; /* screen width in pixels */ - Dimension screen_height; /* screen height in pixels */ -#endif -} BalloonEval; - -#define EVAL_OFFSET_X 15 /* displacement of beval topleft corner from pointer */ -#define EVAL_OFFSET_Y 10 - -#include "gui_beval.pro" - -#endif /* GUI_BEVAL_H and FEAT_BEVAL */ diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp new file mode 100644 index 0000000000..8e03dff64e --- /dev/null +++ b/src/gui_dwrite.cpp @@ -0,0 +1,1345 @@ +/* vi:set ts=8 sts=4 sw=4 noet: */ +/* + * Author: MURAOKA Taro <koron.kaoriya@gmail.com> + * + * Contributors: + * - Ken Takata + * - Yasuhiro Matsumoto + * + * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com> + * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + */ + +#define WIN32_LEAN_AND_MEAN + +#ifndef DYNAMIC_DIRECTX +# if WINVER < 0x0600 +# error WINVER must be 0x0600 or above to use DirectWrite(DirectX) +# endif +#endif + +#include <windows.h> +#include <crtdbg.h> +#include <assert.h> +#include <math.h> +#include <d2d1.h> +#include <d2d1helper.h> + +// Disable these macros to compile with old VC and newer SDK (V8.1 or later). +#if defined(_MSC_VER) && (_MSC_VER < 1700) +# define _COM_Outptr_ __out +# define _In_reads_(s) +# define _In_reads_opt_(s) +# define _Maybenull_ +# define _Out_writes_(s) +# define _Out_writes_opt_(s) +# define _Out_writes_to_(x, y) +# define _Out_writes_to_opt_(x, y) +# define _Outptr_ +#endif + +#ifdef FEAT_DIRECTX_COLOR_EMOJI +# include <dwrite_2.h> +#else +# include <dwrite.h> +#endif + +#include "gui_dwrite.h" + +#ifdef __MINGW32__ +# define __maybenull SAL__maybenull +# define __in SAL__in +# define __out SAL__out +#endif + +#if (defined(_MSC_VER) && (_MSC_VER >= 1700)) || (__cplusplus >= 201103L) +# define FINAL final +#else +# define FINAL +#endif + +#ifdef DYNAMIC_DIRECTX +extern "C" HINSTANCE vimLoadLib(char *name); + +typedef int (WINAPI *PGETUSERDEFAULTLOCALENAME)(LPWSTR, int); +typedef HRESULT (WINAPI *PD2D1CREATEFACTORY)(D2D1_FACTORY_TYPE, + REFIID, const D2D1_FACTORY_OPTIONS *, void **); +typedef HRESULT (WINAPI *PDWRITECREATEFACTORY)(DWRITE_FACTORY_TYPE, + REFIID, IUnknown **); + +static HINSTANCE hD2D1DLL = NULL; +static HINSTANCE hDWriteDLL = NULL; + +static PGETUSERDEFAULTLOCALENAME pGetUserDefaultLocaleName = NULL; +static PD2D1CREATEFACTORY pD2D1CreateFactory = NULL; +static PDWRITECREATEFACTORY pDWriteCreateFactory = NULL; + +#define GetUserDefaultLocaleName (*pGetUserDefaultLocaleName) +#define D2D1CreateFactory (*pD2D1CreateFactory) +#define DWriteCreateFactory (*pDWriteCreateFactory) + + static void +unload(HINSTANCE &hinst) +{ + if (hinst != NULL) + { + FreeLibrary(hinst); + hinst = NULL; + } +} +#endif // DYNAMIC_DIRECTX + +template <class T> inline void SafeRelease(T **ppT) +{ + if (*ppT) + { + (*ppT)->Release(); + *ppT = NULL; + } +} + + static DWRITE_PIXEL_GEOMETRY +ToPixelGeometry(int value) +{ + switch (value) + { + default: + case 0: + return DWRITE_PIXEL_GEOMETRY_FLAT; + case 1: + return DWRITE_PIXEL_GEOMETRY_RGB; + case 2: + return DWRITE_PIXEL_GEOMETRY_BGR; + } +} + + static int +ToInt(DWRITE_PIXEL_GEOMETRY value) +{ + switch (value) + { + case DWRITE_PIXEL_GEOMETRY_FLAT: + return 0; + case DWRITE_PIXEL_GEOMETRY_RGB: + return 1; + case DWRITE_PIXEL_GEOMETRY_BGR: + return 2; + default: + return -1; + } +} + + static DWRITE_RENDERING_MODE +ToRenderingMode(int value) +{ + switch (value) + { + default: + case 0: + return DWRITE_RENDERING_MODE_DEFAULT; + case 1: + return DWRITE_RENDERING_MODE_ALIASED; + case 2: + return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC; + case 3: + return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL; + case 4: + return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL; + case 5: + return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; + case 6: + return DWRITE_RENDERING_MODE_OUTLINE; + } +} + + static D2D1_TEXT_ANTIALIAS_MODE +ToTextAntialiasMode(int value) +{ + switch (value) + { + default: + case 0: + return D2D1_TEXT_ANTIALIAS_MODE_DEFAULT; + case 1: + return D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE; + case 2: + return D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE; + case 3: + return D2D1_TEXT_ANTIALIAS_MODE_ALIASED; + } +} + + static int +ToInt(DWRITE_RENDERING_MODE value) +{ + switch (value) + { + case DWRITE_RENDERING_MODE_DEFAULT: + return 0; + case DWRITE_RENDERING_MODE_ALIASED: + return 1; + case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC: + return 2; + case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL: + return 3; + case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL: + return 4; + case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC: + return 5; + case DWRITE_RENDERING_MODE_OUTLINE: + return 6; + default: + return -1; + } +} + +class FontCache { +public: + struct Item { + HFONT hFont; + IDWriteTextFormat* pTextFormat; + DWRITE_FONT_WEIGHT fontWeight; + DWRITE_FONT_STYLE fontStyle; + Item() : hFont(NULL), pTextFormat(NULL) {} + }; + +private: + int mSize; + Item *mItems; + +public: + FontCache(int size = 2) : + mSize(size), + mItems(new Item[size]) + { + } + + ~FontCache() + { + for (int i = 0; i < mSize; ++i) + SafeRelease(&mItems[i].pTextFormat); + delete[] mItems; + } + + bool get(HFONT hFont, Item &item) + { + int n = find(hFont); + if (n < 0) + return false; + item = mItems[n]; + slide(n); + return true; + } + + void put(const Item& item) + { + int n = find(item.hFont); + if (n < 0) + n = mSize - 1; + if (mItems[n].pTextFormat != item.pTextFormat) + { + SafeRelease(&mItems[n].pTextFormat); + item.pTextFormat->AddRef(); + } + mItems[n] = item; + slide(n); + } + +private: + int find(HFONT hFont) + { + for (int i = 0; i < mSize; ++i) + { + if (mItems[i].hFont == hFont) + return i; + } + return -1; + } + + void slide(int nextTop) + { + if (nextTop == 0) + return; + Item tmp = mItems[nextTop]; + for (int i = nextTop - 1; i >= 0; --i) + mItems[i + 1] = mItems[i]; + mItems[0] = tmp; + } +}; + +enum DrawingMode { + DM_GDI = 0, + DM_DIRECTX = 1, + DM_INTEROP = 2, +}; + +struct DWriteContext { + HDC mHDC; + RECT mBindRect; + DrawingMode mDMode; + HDC mInteropHDC; + bool mDrawing; + bool mFallbackDC; + + ID2D1Factory *mD2D1Factory; + + ID2D1DCRenderTarget *mRT; + ID2D1GdiInteropRenderTarget *mGDIRT; + ID2D1SolidColorBrush *mBrush; + ID2D1Bitmap *mBitmap; + + IDWriteFactory *mDWriteFactory; +#ifdef FEAT_DIRECTX_COLOR_EMOJI + IDWriteFactory2 *mDWriteFactory2; +#endif + + IDWriteGdiInterop *mGdiInterop; + IDWriteRenderingParams *mRenderingParams; + + FontCache mFontCache; + IDWriteTextFormat *mTextFormat; + DWRITE_FONT_WEIGHT mFontWeight; + DWRITE_FONT_STYLE mFontStyle; + + D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode; + + // METHODS + + DWriteContext(); + + virtual ~DWriteContext(); + + HRESULT CreateDeviceResources(); + + void DiscardDeviceResources(); + + HRESULT CreateTextFormatFromLOGFONT(const LOGFONTW &logFont, + IDWriteTextFormat **ppTextFormat); + + HRESULT SetFontByLOGFONT(const LOGFONTW &logFont); + + void SetFont(HFONT hFont); + + void Rebind(); + + void BindDC(HDC hdc, const RECT *rect); + + HRESULT SetDrawingMode(DrawingMode mode); + + ID2D1Brush* SolidBrush(COLORREF color); + + void DrawText(const WCHAR *text, int len, + int x, int y, int w, int h, int cellWidth, COLORREF color, + UINT fuOptions, const RECT *lprc, const INT *lpDx); + + void FillRect(const RECT *rc, COLORREF color); + + void DrawLine(int x1, int y1, int x2, int y2, COLORREF color); + + void SetPixel(int x, int y, COLORREF color); + + void Scroll(int x, int y, const RECT *rc); + + void Flush(); + + void SetRenderingParams( + const DWriteRenderingParams *params); + + DWriteRenderingParams *GetRenderingParams( + DWriteRenderingParams *params); +}; + +class AdjustedGlyphRun : public DWRITE_GLYPH_RUN +{ +private: + FLOAT &mAccum; + FLOAT mDelta; + FLOAT *mAdjustedAdvances; + +public: + AdjustedGlyphRun( + const DWRITE_GLYPH_RUN *glyphRun, + FLOAT cellWidth, + FLOAT &accum) : + DWRITE_GLYPH_RUN(*glyphRun), + mAccum(accum), + mDelta(0.0f), + mAdjustedAdvances(new FLOAT[glyphRun->glyphCount]) + { + assert(cellWidth != 0.0f); + for (UINT32 i = 0; i < glyphRun->glyphCount; ++i) + { + FLOAT orig = glyphRun->glyphAdvances[i]; + FLOAT adjusted = adjustToCell(orig, cellWidth); + mAdjustedAdvances[i] = adjusted; + mDelta += adjusted - orig; + } + glyphAdvances = mAdjustedAdvances; + } + + ~AdjustedGlyphRun() + { + mAccum += mDelta; + delete[] mAdjustedAdvances; + } + + static FLOAT adjustToCell(FLOAT value, FLOAT cellWidth) + { + int cellCount = int(floor(value / cellWidth + 0.5f)); + if (cellCount < 1) + cellCount = 1; + return cellCount * cellWidth; + } +}; + +struct TextRendererContext { + // const fields. + COLORREF color; + FLOAT cellWidth; + + // working fields. + FLOAT offsetX; +}; + +class TextRenderer FINAL : public IDWriteTextRenderer +{ +public: + TextRenderer( + DWriteContext* pDWC) : + cRefCount_(0), + pDWC_(pDWC) + { + AddRef(); + } + + // add "virtual" to avoid a compiler warning + virtual ~TextRenderer() + { + } + + IFACEMETHOD(IsPixelSnappingDisabled)( + __maybenull void* clientDrawingContext, + __out BOOL* isDisabled) + { + *isDisabled = FALSE; + return S_OK; + } + + IFACEMETHOD(GetCurrentTransform)( + __maybenull void* clientDrawingContext, + __out DWRITE_MATRIX* transform) + { + // forward the render target's transform + pDWC_->mRT->GetTransform( + reinterpret_cast<D2D1_MATRIX_3X2_F*>(transform)); + return S_OK; + } + + IFACEMETHOD(GetPixelsPerDip)( + __maybenull void* clientDrawingContext, + __out FLOAT* pixelsPerDip) + { + float dpiX, unused; + pDWC_->mRT->GetDpi(&dpiX, &unused); + *pixelsPerDip = dpiX / 96.0f; + return S_OK; + } + + IFACEMETHOD(DrawUnderline)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_UNDERLINE const* underline, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + + IFACEMETHOD(DrawStrikethrough)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_STRIKETHROUGH const* strikethrough, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + + IFACEMETHOD(DrawInlineObject)( + __maybenull void* clientDrawingContext, + FLOAT originX, + FLOAT originY, + IDWriteInlineObject* inlineObject, + BOOL isSideways, + BOOL isRightToLeft, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + + IFACEMETHOD(DrawGlyphRun)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, + IUnknown* clientDrawingEffect) + { + TextRendererContext *context = + reinterpret_cast<TextRendererContext*>(clientDrawingContext); + + AdjustedGlyphRun adjustedGlyphRun(glyphRun, context->cellWidth, + context->offsetX); + +#ifdef FEAT_DIRECTX_COLOR_EMOJI + if (pDWC_->mDWriteFactory2 != NULL) + { + IDWriteColorGlyphRunEnumerator *enumerator = NULL; + HRESULT hr = pDWC_->mDWriteFactory2->TranslateColorGlyphRun( + baselineOriginX + context->offsetX, + baselineOriginY, + &adjustedGlyphRun, + NULL, + DWRITE_MEASURING_MODE_GDI_NATURAL, + NULL, + 0, + &enumerator); + if (SUCCEEDED(hr)) + { + // Draw by IDWriteFactory2 for color emoji + BOOL hasRun = TRUE; + enumerator->MoveNext(&hasRun); + while (hasRun) + { + const DWRITE_COLOR_GLYPH_RUN* colorGlyphRun; + enumerator->GetCurrentRun(&colorGlyphRun); + + pDWC_->mBrush->SetColor(colorGlyphRun->runColor); + pDWC_->mRT->DrawGlyphRun( + D2D1::Point2F( + colorGlyphRun->baselineOriginX, + colorGlyphRun->baselineOriginY), + &colorGlyphRun->glyphRun, + pDWC_->mBrush, + DWRITE_MEASURING_MODE_NATURAL); + enumerator->MoveNext(&hasRun); + } + SafeRelease(&enumerator); + return S_OK; + } + } +#endif + + // Draw by IDWriteFactory (without color emoji) + pDWC_->mRT->DrawGlyphRun( + D2D1::Point2F( + baselineOriginX + context->offsetX, + baselineOriginY), + &adjustedGlyphRun, + pDWC_->SolidBrush(context->color), + DWRITE_MEASURING_MODE_NATURAL); + return S_OK; + } + +public: + IFACEMETHOD_(unsigned long, AddRef) () + { + return InterlockedIncrement(&cRefCount_); + } + + IFACEMETHOD_(unsigned long, Release) () + { + long newCount = InterlockedDecrement(&cRefCount_); + + if (newCount == 0) + { + delete this; + return 0; + } + return newCount; + } + + IFACEMETHOD(QueryInterface)( + IID const& riid, + void** ppvObject) + { + if (__uuidof(IDWriteTextRenderer) == riid) + { + *ppvObject = this; + } + else if (__uuidof(IDWritePixelSnapping) == riid) + { + *ppvObject = this; + } + else if (__uuidof(IUnknown) == riid) + { + *ppvObject = this; + } + else + { + *ppvObject = NULL; + return E_FAIL; + } + + return S_OK; + } + +private: + long cRefCount_; + DWriteContext* pDWC_; +}; + +DWriteContext::DWriteContext() : + mHDC(NULL), + mBindRect(), + mDMode(DM_GDI), + mInteropHDC(NULL), + mDrawing(false), + mFallbackDC(false), + mD2D1Factory(NULL), + mRT(NULL), + mGDIRT(NULL), + mBrush(NULL), + mBitmap(NULL), + mDWriteFactory(NULL), +#ifdef FEAT_DIRECTX_COLOR_EMOJI + mDWriteFactory2(NULL), +#endif + mGdiInterop(NULL), + mRenderingParams(NULL), + mFontCache(8), + mTextFormat(NULL), + mFontWeight(DWRITE_FONT_WEIGHT_NORMAL), + mFontStyle(DWRITE_FONT_STYLE_NORMAL), + mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT) +{ + HRESULT hr; + + hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, + __uuidof(ID2D1Factory), NULL, + reinterpret_cast<void**>(&mD2D1Factory)); + _RPT2(_CRT_WARN, "D2D1CreateFactory: hr=%p p=%p\n", hr, mD2D1Factory); + + if (SUCCEEDED(hr)) + { + hr = DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory), + reinterpret_cast<IUnknown**>(&mDWriteFactory)); + _RPT2(_CRT_WARN, "DWriteCreateFactory: hr=%p p=%p\n", hr, + mDWriteFactory); + } + +#ifdef FEAT_DIRECTX_COLOR_EMOJI + if (SUCCEEDED(hr)) + { + DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory2), + reinterpret_cast<IUnknown**>(&mDWriteFactory2)); + _RPT1(_CRT_WARN, "IDWriteFactory2: %s\n", SUCCEEDED(hr) ? "available" : "not available"); + } +#endif + + if (SUCCEEDED(hr)) + { + hr = mDWriteFactory->GetGdiInterop(&mGdiInterop); + _RPT2(_CRT_WARN, "GetGdiInterop: hr=%p p=%p\n", hr, mGdiInterop); + } + + if (SUCCEEDED(hr)) + { + hr = mDWriteFactory->CreateRenderingParams(&mRenderingParams); + _RPT2(_CRT_WARN, "CreateRenderingParams: hr=%p p=%p\n", hr, + mRenderingParams); + } +} + +DWriteContext::~DWriteContext() +{ + SafeRelease(&mTextFormat); + SafeRelease(&mRenderingParams); + SafeRelease(&mGdiInterop); + SafeRelease(&mDWriteFactory); +#ifdef FEAT_DIRECTX_COLOR_EMOJI + SafeRelease(&mDWriteFactory2); +#endif + SafeRelease(&mBitmap); + SafeRelease(&mBrush); + SafeRelease(&mGDIRT); + SafeRelease(&mRT); + SafeRelease(&mD2D1Factory); +} + + HRESULT +DWriteContext::CreateDeviceResources() +{ + HRESULT hr; + + if (mRT != NULL) + return S_OK; + + D2D1_RENDER_TARGET_PROPERTIES props = { + D2D1_RENDER_TARGET_TYPE_DEFAULT, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE }, + 0, 0, + D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE, + D2D1_FEATURE_LEVEL_DEFAULT + }; + hr = mD2D1Factory->CreateDCRenderTarget(&props, &mRT); + _RPT2(_CRT_WARN, "CreateDCRenderTarget: hr=%p p=%p\n", hr, mRT); + + if (SUCCEEDED(hr)) + { + // This always succeeds. + mRT->QueryInterface( + __uuidof(ID2D1GdiInteropRenderTarget), + reinterpret_cast<void**>(&mGDIRT)); + _RPT1(_CRT_WARN, "GdiInteropRenderTarget: p=%p\n", mGDIRT); + } + + if (SUCCEEDED(hr)) + { + hr = mRT->CreateSolidColorBrush( + D2D1::ColorF(D2D1::ColorF::Black), + &mBrush); + _RPT2(_CRT_WARN, "CreateSolidColorBrush: hr=%p p=%p\n", hr, mBrush); + } + + if (SUCCEEDED(hr)) + Rebind(); + + return hr; +} + + void +DWriteContext::DiscardDeviceResources() +{ + SafeRelease(&mBitmap); + SafeRelease(&mBrush); + SafeRelease(&mGDIRT); + SafeRelease(&mRT); +} + + HRESULT +DWriteContext::CreateTextFormatFromLOGFONT(const LOGFONTW &logFont, + IDWriteTextFormat **ppTextFormat) +{ + // Most of this function is copied from: https://github.com/Microsoft/Windows-classic-samples/blob/master/Samples/Win7Samples/multimedia/DirectWrite/RenderTest/TextHelpers.cpp + HRESULT hr = S_OK; + IDWriteTextFormat *pTextFormat = NULL; + + IDWriteFont *font = NULL; + IDWriteFontFamily *fontFamily = NULL; + IDWriteLocalizedStrings *localizedFamilyNames = NULL; + float fontSize = 0; + + if (SUCCEEDED(hr)) + { + hr = mGdiInterop->CreateFontFromLOGFONT(&logFont, &font); + } + + // Get the font family to which this font belongs. + if (SUCCEEDED(hr)) + { + hr = font->GetFontFamily(&fontFamily); + } + + // Get the family names. This returns an object that encapsulates one or + // more names with the same meaning but in different languages. + if (SUCCEEDED(hr)) + { + hr = fontFamily->GetFamilyNames(&localizedFamilyNames); + } + + // Get the family name at index zero. If we were going to display the name + // we'd want to try to find one that matched the use locale, but for + // purposes of creating a text format object any language will do. + + wchar_t familyName[100]; + if (SUCCEEDED(hr)) + { + hr = localizedFamilyNames->GetString(0, familyName, + ARRAYSIZE(familyName)); + } + + if (SUCCEEDED(hr)) + { + // Use lfHeight of the LOGFONT as font size. + fontSize = float(logFont.lfHeight); + + if (fontSize < 0) + { + // Negative lfHeight represents the size of the em unit. + fontSize = -fontSize; + } + else + { + // Positive lfHeight represents the cell height (ascent + + // descent). + DWRITE_FONT_METRICS fontMetrics; + font->GetMetrics(&fontMetrics); + + // Convert the cell height (ascent + descent) from design units + // to ems. + float cellHeight = static_cast<float>( + fontMetrics.ascent + fontMetrics.descent) + / fontMetrics.designUnitsPerEm; + + // Divide the font size by the cell height to get the font em + // size. + fontSize /= cellHeight; + } + } + + // The text format includes a locale name. Ideally, this would be the + // language of the text, which may or may not be the same as the primary + // language of the user. However, for our purposes the user locale will do. + wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; + if (SUCCEEDED(hr)) + { + if (GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) == 0) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + // Create the text format object. + hr = mDWriteFactory->CreateTextFormat( + familyName, + NULL, // no custom font collection + font->GetWeight(), + font->GetStyle(), + font->GetStretch(), + fontSize, + localeName, + &pTextFormat); + } + + if (SUCCEEDED(hr)) + hr = pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); + + if (SUCCEEDED(hr)) + hr = pTextFormat->SetParagraphAlignment( + DWRITE_PARAGRAPH_ALIGNMENT_CENTER); + + if (SUCCEEDED(hr)) + hr = pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); + + SafeRelease(&localizedFamilyNames); + SafeRelease(&fontFamily); + SafeRelease(&font); + + if (SUCCEEDED(hr)) + *ppTextFormat = pTextFormat; + else + SafeRelease(&pTextFormat); + + return hr; +} + + HRESULT +DWriteContext::SetFontByLOGFONT(const LOGFONTW &logFont) +{ + HRESULT hr = S_OK; + IDWriteTextFormat *pTextFormat = NULL; + + hr = CreateTextFormatFromLOGFONT(logFont, &pTextFormat); + + if (SUCCEEDED(hr)) + { + SafeRelease(&mTextFormat); + mTextFormat = pTextFormat; + mFontWeight = static_cast<DWRITE_FONT_WEIGHT>(logFont.lfWeight); + mFontStyle = logFont.lfItalic ? DWRITE_FONT_STYLE_ITALIC + : DWRITE_FONT_STYLE_NORMAL; + } + + return hr; +} + + void +DWriteContext::SetFont(HFONT hFont) +{ + FontCache::Item item; + if (mFontCache.get(hFont, item)) + { + if (item.pTextFormat != NULL) + { + item.pTextFormat->AddRef(); + SafeRelease(&mTextFormat); + mTextFormat = item.pTextFormat; + mFontWeight = item.fontWeight; + mFontStyle = item.fontStyle; + mFallbackDC = false; + } + else + mFallbackDC = true; + return; + } + + HRESULT hr = E_FAIL; + LOGFONTW lf; + if (GetObjectW(hFont, sizeof(lf), &lf)) + hr = SetFontByLOGFONT(lf); + + item.hFont = hFont; + if (SUCCEEDED(hr)) + { + item.pTextFormat = mTextFormat; + item.fontWeight = mFontWeight; + item.fontStyle = mFontStyle; + mFallbackDC = false; + } + else + mFallbackDC = true; + mFontCache.put(item); +} + + void +DWriteContext::Rebind() +{ + SafeRelease(&mBitmap); + + mRT->BindDC(mHDC, &mBindRect); + mRT->SetTransform(D2D1::IdentityMatrix()); + + D2D1_BITMAP_PROPERTIES props = { + {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}, + 96.0f, 96.0f + }; + mRT->CreateBitmap( + D2D1::SizeU(mBindRect.right - mBindRect.left, + mBindRect.bottom - mBindRect.top), + props, &mBitmap); +} + + void +DWriteContext::BindDC(HDC hdc, const RECT *rect) +{ + mHDC = hdc; + mBindRect = *rect; + + if (mRT == NULL) + CreateDeviceResources(); + else + { + Flush(); + Rebind(); + } +} + + HRESULT +DWriteContext::SetDrawingMode(DrawingMode mode) +{ + HRESULT hr = S_OK; + + switch (mode) + { + default: + case DM_GDI: + if (mInteropHDC != NULL) + { + mGDIRT->ReleaseDC(NULL); + mInteropHDC = NULL; + } + if (mDrawing) + { + hr = mRT->EndDraw(); + if (hr == D2DERR_RECREATE_TARGET) + { + hr = S_OK; + DiscardDeviceResources(); + CreateDeviceResources(); + } + mDrawing = false; + } + break; + + case DM_DIRECTX: + if (mInteropHDC != NULL) + { + mGDIRT->ReleaseDC(NULL); + mInteropHDC = NULL; + } + else if (mDrawing == false) + { + CreateDeviceResources(); + mRT->BeginDraw(); + mDrawing = true; + } + break; + + case DM_INTEROP: + if (mDrawing == false) + { + CreateDeviceResources(); + mRT->BeginDraw(); + mDrawing = true; + } + if (mInteropHDC == NULL) + hr = mGDIRT->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &mInteropHDC); + break; + } + mDMode = mode; + return hr; +} + + ID2D1Brush* +DWriteContext::SolidBrush(COLORREF color) +{ + mBrush->SetColor(D2D1::ColorF(UINT32(GetRValue(color)) << 16 | + UINT32(GetGValue(color)) << 8 | UINT32(GetBValue(color)))); + return mBrush; +} + + void +DWriteContext::DrawText(const WCHAR *text, int len, + int x, int y, int w, int h, int cellWidth, COLORREF color, + UINT fuOptions, const RECT *lprc, const INT *lpDx) +{ + if (mFallbackDC) + { + // Fall back to GDI rendering. + HRESULT hr = SetDrawingMode(DM_INTEROP); + if (SUCCEEDED(hr)) + { + HGDIOBJ hFont = ::GetCurrentObject(mHDC, OBJ_FONT); + HGDIOBJ hOldFont = ::SelectObject(mInteropHDC, hFont); + ::SetTextColor(mInteropHDC, color); + ::SetBkMode(mInteropHDC, ::GetBkMode(mHDC)); + ::ExtTextOutW(mInteropHDC, x, y, fuOptions, lprc, text, len, lpDx); + ::SelectObject(mInteropHDC, hOldFont); + } + return; + } + + HRESULT hr; + IDWriteTextLayout *textLayout = NULL; + + SetDrawingMode(DM_DIRECTX); + + hr = mDWriteFactory->CreateTextLayout(text, len, mTextFormat, + FLOAT(w), FLOAT(h), &textLayout); + + if (SUCCEEDED(hr)) + { + DWRITE_TEXT_RANGE textRange = { 0, UINT32(len) }; + textLayout->SetFontWeight(mFontWeight, textRange); + textLayout->SetFontStyle(mFontStyle, textRange); + + TextRenderer renderer(this); + TextRendererContext context = { color, FLOAT(cellWidth), 0.0f }; + textLayout->Draw(&context, &renderer, FLOAT(x), FLOAT(y) - 0.5f); + } + + SafeRelease(&textLayout); +} + + void +DWriteContext::FillRect(const RECT *rc, COLORREF color) +{ + if (mDMode == DM_INTEROP) + { + // GDI functions are used before this call. Keep using GDI. + // (Switching to Direct2D causes terrible slowdown.) + HBRUSH hbr = ::CreateSolidBrush(color); + ::FillRect(mInteropHDC, rc, hbr); + ::DeleteObject(HGDIOBJ(hbr)); + } + else + { + SetDrawingMode(DM_DIRECTX); + mRT->FillRectangle( + D2D1::RectF(FLOAT(rc->left), FLOAT(rc->top), + FLOAT(rc->right), FLOAT(rc->bottom)), + SolidBrush(color)); + } +} + + void +DWriteContext::DrawLine(int x1, int y1, int x2, int y2, COLORREF color) +{ + if (mDMode == DM_INTEROP) + { + // GDI functions are used before this call. Keep using GDI. + // (Switching to Direct2D causes terrible slowdown.) + HPEN hpen = ::CreatePen(PS_SOLID, 1, color); + HGDIOBJ old_pen = ::SelectObject(mInteropHDC, HGDIOBJ(hpen)); + ::MoveToEx(mInteropHDC, x1, y1, NULL); + ::LineTo(mInteropHDC, x2, y2); + ::SelectObject(mInteropHDC, old_pen); + ::DeleteObject(HGDIOBJ(hpen)); + } + else + { + SetDrawingMode(DM_DIRECTX); + mRT->DrawLine( + D2D1::Point2F(FLOAT(x1), FLOAT(y1) + 0.5f), + D2D1::Point2F(FLOAT(x2), FLOAT(y2) + 0.5f), + SolidBrush(color)); + } +} + + void +DWriteContext::SetPixel(int x, int y, COLORREF color) +{ + if (mDMode == DM_INTEROP) + { + // GDI functions are used before this call. Keep using GDI. + // (Switching to Direct2D causes terrible slowdown.) + ::SetPixel(mInteropHDC, x, y, color); + } + else + { + SetDrawingMode(DM_DIRECTX); + // Direct2D doesn't have SetPixel API. Use DrawLine instead. + mRT->DrawLine( + D2D1::Point2F(FLOAT(x), FLOAT(y) + 0.5f), + D2D1::Point2F(FLOAT(x+1), FLOAT(y) + 0.5f), + SolidBrush(color)); + } +} + + void +DWriteContext::Scroll(int x, int y, const RECT *rc) +{ + SetDrawingMode(DM_DIRECTX); + mRT->Flush(); + + D2D1_RECT_U srcRect; + D2D1_POINT_2U destPoint; + if (x >= 0) + { + srcRect.left = rc->left; + srcRect.right = rc->right - x; + destPoint.x = rc->left + x; + } + else + { + srcRect.left = rc->left - x; + srcRect.right = rc->right; + destPoint.x = rc->left; + } + if (y >= 0) + { + srcRect.top = rc->top; + srcRect.bottom = rc->bottom - y; + destPoint.y = rc->top + y; + } + else + { + srcRect.top = rc->top - y; + srcRect.bottom = rc->bottom; + destPoint.y = rc->top; + } + mBitmap->CopyFromRenderTarget(&destPoint, mRT, &srcRect); + + D2D1_RECT_F destRect = { + FLOAT(destPoint.x), FLOAT(destPoint.y), + FLOAT(destPoint.x + srcRect.right - srcRect.left), + FLOAT(destPoint.y + srcRect.bottom - srcRect.top) + }; + mRT->DrawBitmap(mBitmap, destRect, 1.0F, + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, destRect); +} + + void +DWriteContext::Flush() +{ + SetDrawingMode(DM_GDI); +} + + void +DWriteContext::SetRenderingParams( + const DWriteRenderingParams *params) +{ + if (mDWriteFactory == NULL) + return; + + IDWriteRenderingParams *renderingParams = NULL; + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT; + HRESULT hr; + if (params != NULL) + { + hr = mDWriteFactory->CreateCustomRenderingParams(params->gamma, + params->enhancedContrast, params->clearTypeLevel, + ToPixelGeometry(params->pixelGeometry), + ToRenderingMode(params->renderingMode), &renderingParams); + textAntialiasMode = ToTextAntialiasMode(params->textAntialiasMode); + } + else + hr = mDWriteFactory->CreateRenderingParams(&renderingParams); + if (SUCCEEDED(hr) && renderingParams != NULL) + { + SafeRelease(&mRenderingParams); + mRenderingParams = renderingParams; + mTextAntialiasMode = textAntialiasMode; + + Flush(); + mRT->SetTextRenderingParams(mRenderingParams); + mRT->SetTextAntialiasMode(mTextAntialiasMode); + } +} + + DWriteRenderingParams * +DWriteContext::GetRenderingParams( + DWriteRenderingParams *params) +{ + if (params != NULL && mRenderingParams != NULL) + { + params->gamma = mRenderingParams->GetGamma(); + params->enhancedContrast = mRenderingParams->GetEnhancedContrast(); + params->clearTypeLevel = mRenderingParams->GetClearTypeLevel(); + params->pixelGeometry = ToInt(mRenderingParams->GetPixelGeometry()); + params->renderingMode = ToInt(mRenderingParams->GetRenderingMode()); + params->textAntialiasMode = mTextAntialiasMode; + } + return params; +} + +//////////////////////////////////////////////////////////////////////////// +// PUBLIC C INTERFACES + + void +DWrite_Init(void) +{ +#ifdef DYNAMIC_DIRECTX + // Load libraries. + hD2D1DLL = vimLoadLib(const_cast<char*>("d2d1.dll")); + hDWriteDLL = vimLoadLib(const_cast<char*>("dwrite.dll")); + if (hD2D1DLL == NULL || hDWriteDLL == NULL) + { + DWrite_Final(); + return; + } + // Get address of procedures. + pGetUserDefaultLocaleName = (PGETUSERDEFAULTLOCALENAME)GetProcAddress( + GetModuleHandle("kernel32.dll"), "GetUserDefaultLocaleName"); + pD2D1CreateFactory = (PD2D1CREATEFACTORY)GetProcAddress(hD2D1DLL, + "D2D1CreateFactory"); + pDWriteCreateFactory = (PDWRITECREATEFACTORY)GetProcAddress(hDWriteDLL, + "DWriteCreateFactory"); +#endif +} + + void +DWrite_Final(void) +{ +#ifdef DYNAMIC_DIRECTX + pGetUserDefaultLocaleName = NULL; + pD2D1CreateFactory = NULL; + pDWriteCreateFactory = NULL; + unload(hDWriteDLL); + unload(hD2D1DLL); +#endif +} + + DWriteContext * +DWriteContext_Open(void) +{ +#ifdef DYNAMIC_DIRECTX + if (pGetUserDefaultLocaleName == NULL || pD2D1CreateFactory == NULL + || pDWriteCreateFactory == NULL) + return NULL; +#endif + return new DWriteContext(); +} + + void +DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, const RECT *rect) +{ + if (ctx != NULL) + ctx->BindDC(hdc, rect); +} + + void +DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont) +{ + if (ctx != NULL) + ctx->SetFont(hFont); +} + + void +DWriteContext_DrawText( + DWriteContext *ctx, + const WCHAR *text, + int len, + int x, + int y, + int w, + int h, + int cellWidth, + COLORREF color, + UINT fuOptions, + const RECT *lprc, + const INT *lpDx) +{ + if (ctx != NULL) + ctx->DrawText(text, len, x, y, w, h, cellWidth, color, + fuOptions, lprc, lpDx); +} + + void +DWriteContext_FillRect(DWriteContext *ctx, const RECT *rc, COLORREF color) +{ + if (ctx != NULL) + ctx->FillRect(rc, color); +} + + void +DWriteContext_DrawLine(DWriteContext *ctx, int x1, int y1, int x2, int y2, + COLORREF color) +{ + if (ctx != NULL) + ctx->DrawLine(x1, y1, x2, y2, color); +} + + void +DWriteContext_SetPixel(DWriteContext *ctx, int x, int y, COLORREF color) +{ + if (ctx != NULL) + ctx->SetPixel(x, y, color); +} + + void +DWriteContext_Scroll(DWriteContext *ctx, int x, int y, const RECT *rc) +{ + if (ctx != NULL) + ctx->Scroll(x, y, rc); +} + + void +DWriteContext_Flush(DWriteContext *ctx) +{ + if (ctx != NULL) + ctx->Flush(); +} + + void +DWriteContext_Close(DWriteContext *ctx) +{ + delete ctx; +} + + void +DWriteContext_SetRenderingParams( + DWriteContext *ctx, + const DWriteRenderingParams *params) +{ + if (ctx != NULL) + ctx->SetRenderingParams(params); +} + + DWriteRenderingParams * +DWriteContext_GetRenderingParams( + DWriteContext *ctx, + DWriteRenderingParams *params) +{ + if (ctx != NULL) + return ctx->GetRenderingParams(params); + else + return NULL; +} diff --git a/src/gui_dwrite.h b/src/gui_dwrite.h new file mode 100644 index 0000000000..5de06f92b1 --- /dev/null +++ b/src/gui_dwrite.h @@ -0,0 +1,92 @@ +/* vi:set ts=8 sts=4 sw=4 noet: */ +/* + * Author: MURAOKA Taro <koron.kaoriya@gmail.com> + * + * Contributors: + * - Ken Takata + * - Yasuhiro Matsumoto + * + * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com> + * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + */ + +#ifndef GUI_DWRITE_H +#define GUI_DWRITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct DWriteContext DWriteContext; + +typedef struct DWriteRenderingParams { + float gamma; + float enhancedContrast; + float clearTypeLevel; + /* + * pixelGeometry: + * 0 - DWRITE_PIXEL_GEOMETRY_FLAT + * 1 - DWRITE_PIXEL_GEOMETRY_RGB + * 2 - DWRITE_PIXEL_GEOMETRY_BGR + */ + int pixelGeometry; + /* + * renderingMode: + * 0 - DWRITE_RENDERING_MODE_DEFAULT + * 1 - DWRITE_RENDERING_MODE_ALIASED + * 2 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC + * 3 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL + * 4 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL + * 5 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC + * 6 - DWRITE_RENDERING_MODE_OUTLINE + */ + int renderingMode; + /* + * antialiasMode: + * 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT + * 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE + * 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE + * 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED + */ + int textAntialiasMode; +} DWriteRenderingParams; + +void DWrite_Init(void); +void DWrite_Final(void); + +DWriteContext *DWriteContext_Open(void); +void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, const RECT *rect); +void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont); +void DWriteContext_DrawText( + DWriteContext *ctx, + const WCHAR *text, + int len, + int x, + int y, + int w, + int h, + int cellWidth, + COLORREF color, + UINT fuOptions, + const RECT *lprc, + const INT *lpDx); +void DWriteContext_FillRect(DWriteContext *ctx, const RECT *rc, COLORREF color); +void DWriteContext_DrawLine(DWriteContext *ctx, int x1, int y1, int x2, int y2, + COLORREF color); +void DWriteContext_SetPixel(DWriteContext *ctx, int x, int y, COLORREF color); +void DWriteContext_Scroll(DWriteContext *ctx, int x, int y, const RECT *rc); +void DWriteContext_Flush(DWriteContext *ctx); +void DWriteContext_Close(DWriteContext *ctx); + +void DWriteContext_SetRenderingParams( + DWriteContext *ctx, + const DWriteRenderingParams *params); + +DWriteRenderingParams *DWriteContext_GetRenderingParams( + DWriteContext *ctx, + DWriteRenderingParams *params); + +#ifdef __cplusplus +} +#endif +#endif/*GUI_DWRITE_H*/ diff --git a/src/gui_gtk.c b/src/gui_gtk.c index 48537f4490..ed539e386c 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -22,8 +22,17 @@ * * Best supporting actor (He helped somewhat, aesthetically speaking): * Maxime Romano <verbophobe@hotmail.com> + * + * Support for GTK+ 3 was added by: + * + * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> + * + * With the help of Marius Gedminas and the word of Bram Moolenaar, + * "Let's give this some time to mature." */ +#include "vim.h" + #ifdef FEAT_GUI_GTK # include "gui_gtk_f.h" #endif @@ -37,8 +46,6 @@ # undef MAX #endif -#include "vim.h" - #ifdef FEAT_GUI_GNOME /* Gnome redefines _() and N_(). Grrr... */ # ifdef _ @@ -63,7 +70,11 @@ #endif #ifdef FEAT_GUI_GTK -# include <gdk/gdkkeysyms.h> +# if GTK_CHECK_VERSION(3,0,0) +# include <gdk/gdkkeysyms-compat.h> +# else +# include <gdk/gdkkeysyms.h> +# endif # include <gdk/gdk.h> # ifdef WIN3264 # include <gdk/gdkwin32.h> @@ -104,6 +115,70 @@ static void recent_func_log_func( * match toolbar_names[] in menu.c! All stock icons including the "vim-*" * ones can be overridden in your gtkrc file. */ +# if GTK_CHECK_VERSION(3,10,0) +static const char * const menu_themed_names[] = +{ + /* 00 */ "document-new", /* sub. GTK_STOCK_NEW */ + /* 01 */ "document-open", /* sub. GTK_STOCK_OPEN */ + /* 02 */ "document-save", /* sub. GTK_STOCK_SAVE */ + /* 03 */ "edit-undo", /* sub. GTK_STOCK_UNDO */ + /* 04 */ "edit-redo", /* sub. GTK_STOCK_REDO */ + /* 05 */ "edit-cut", /* sub. GTK_STOCK_CUT */ + /* 06 */ "edit-copy", /* sub. GTK_STOCK_COPY */ + /* 07 */ "edit-paste", /* sub. GTK_STOCK_PASTE */ + /* 08 */ "document-print", /* sub. GTK_STOCK_PRINT */ + /* 09 */ "help-browser", /* sub. GTK_STOCK_HELP */ + /* 10 */ "edit-find", /* sub. GTK_STOCK_FIND */ +# if GTK_CHECK_VERSION(3,14,0) + /* Use the file names in gui_gtk_res.xml, cutting off the extension. + * Similar changes follow. */ + /* 11 */ "stock_vim_save_all", + /* 12 */ "stock_vim_session_save", + /* 13 */ "stock_vim_session_new", + /* 14 */ "stock_vim_session_load", +# else + /* 11 */ "vim-save-all", + /* 12 */ "vim-session-save", + /* 13 */ "vim-session-new", + /* 14 */ "vim-session-load", +# endif + /* 15 */ "system-run", /* sub. GTK_STOCK_EXECUTE */ + /* 16 */ "edit-find-replace", /* sub. GTK_STOCK_FIND_AND_REPLACE */ + /* 17 */ "window-close", /* sub. GTK_STOCK_CLOSE, FIXME: fuzzy */ +# if GTK_CHECK_VERSION(3,14,0) + /* 18 */ "stock_vim_window_maximize", + /* 19 */ "stock_vim_window_minimize", + /* 20 */ "stock_vim_window_split", + /* 21 */ "stock_vim_shell", +# else + /* 18 */ "vim-window-maximize", + /* 19 */ "vim-window-minimize", + /* 20 */ "vim-window-split", + /* 21 */ "vim-shell", +# endif + /* 22 */ "go-previous", /* sub. GTK_STOCK_GO_BACK */ + /* 23 */ "go-next", /* sub. GTK_STOCK_GO_FORWARD */ +# if GTK_CHECK_VERSION(3,14,0) + /* 24 */ "stock_vim_find_help", +# else + /* 24 */ "vim-find-help", +# endif + /* 25 */ "gtk-convert", /* sub. GTK_STOCK_CONVERT */ + /* 26 */ "go-jump", /* sub. GTK_STOCK_JUMP_TO */ +# if GTK_CHECK_VERSION(3,14,0) + /* 27 */ "stock_vim_build_tags", + /* 28 */ "stock_vim_window_split_vertical", + /* 29 */ "stock_vim_window_maximize_width", + /* 30 */ "stock_vim_window_minimize_width", +# else + /* 27 */ "vim-build-tags", + /* 28 */ "vim-window-split-vertical", + /* 29 */ "vim-window-maximize-width", + /* 30 */ "vim-window-minimize-width", +# endif + /* 31 */ "application-exit", /* GTK_STOCK_QUIT */ +}; +# else /* !GTK_CHECK_VERSION(3,10,0) */ static const char * const menu_stock_ids[] = { /* 00 */ GTK_STOCK_NEW, @@ -139,7 +214,35 @@ static const char * const menu_stock_ids[] = /* 30 */ "vim-window-minimize-width", /* 31 */ GTK_STOCK_QUIT }; +# endif /* !GTK_CHECK_VERSION(3,10,0) */ + +# ifdef USE_GRESOURCE +# if !GTK_CHECK_VERSION(3,10,0) +typedef struct IconNames { + const char *icon_name; + const char *file_name; +} IconNames; + +static IconNames stock_vim_icons[] = { + { "vim-build-tags", "stock_vim_build_tags.png" }, + { "vim-find-help", "stock_vim_find_help.png" }, + { "vim-save-all", "stock_vim_save_all.png" }, + { "vim-session-load", "stock_vim_session_load.png" }, + { "vim-session-new", "stock_vim_session_new.png" }, + { "vim-session-save", "stock_vim_session_save.png" }, + { "vim-shell", "stock_vim_shell.png" }, + { "vim-window-maximize", "stock_vim_window_maximize.png" }, + { "vim-window-maximize-width", "stock_vim_window_maximize_width.png" }, + { "vim-window-minimize", "stock_vim_window_minimize.png" }, + { "vim-window-minimize-width", "stock_vim_window_minimize_width.png" }, + { "vim-window-split", "stock_vim_window_split.png" }, + { "vim-window-split-vertical", "stock_vim_window_split_vertical.png" }, + { NULL, NULL } +}; +# endif +# endif /* USE_G_RESOURCE */ +# ifndef USE_GRESOURCE static void add_stock_icon(GtkIconFactory *factory, const char *stock_id, @@ -157,6 +260,7 @@ add_stock_icon(GtkIconFactory *factory, gtk_icon_set_unref(icon_set); g_object_unref(pixbuf); } +# endif static int lookup_menu_iconfile(char_u *iconfile, char_u *dest) @@ -188,6 +292,52 @@ lookup_menu_iconfile(char_u *iconfile, char_u *dest) load_menu_iconfile(char_u *name, GtkIconSize icon_size) { GtkWidget *image = NULL; +# if GTK_CHECK_VERSION(3,10,0) + int pixel_size = -1; + + switch (icon_size) + { + case GTK_ICON_SIZE_MENU: + pixel_size = 16; + break; + case GTK_ICON_SIZE_SMALL_TOOLBAR: + pixel_size = 16; + break; + case GTK_ICON_SIZE_LARGE_TOOLBAR: + pixel_size = 24; + break; + case GTK_ICON_SIZE_BUTTON: + pixel_size = 16; + break; + case GTK_ICON_SIZE_DND: + pixel_size = 32; + break; + case GTK_ICON_SIZE_DIALOG: + pixel_size = 48; + break; + case GTK_ICON_SIZE_INVALID: + /* FALLTHROUGH */ + default: + pixel_size = 0; + break; + } + + if (pixel_size > 0 || pixel_size == -1) + { + GdkPixbuf * const pixbuf + = gdk_pixbuf_new_from_file_at_scale((const char *)name, + pixel_size, pixel_size, TRUE, NULL); + if (pixbuf != NULL) + { + image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(pixbuf); + } + } + if (image == NULL) + image = gtk_image_new_from_icon_name("image-missing", icon_size); + + return image; +# else /* !GTK_CHECK_VERSION(3,10,0) */ GtkIconSet *icon_set; GtkIconSource *icon_source; @@ -208,6 +358,7 @@ load_menu_iconfile(char_u *name, GtkIconSize icon_size) gtk_icon_set_unref(icon_set); return image; +# endif /* !GTK_CHECK_VERSION(3,10,0) */ } static GtkWidget * @@ -228,6 +379,17 @@ create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) /* Still not found? Then use a builtin icon, a blank one as fallback. */ if (image == NULL) { +# if GTK_CHECK_VERSION(3,10,0) + const char *icon_name = NULL; + const int n_names = G_N_ELEMENTS(menu_themed_names); + + if (menu->iconidx >= 0 && menu->iconidx < n_names) + icon_name = menu_themed_names[menu->iconidx]; + if (icon_name == NULL) + icon_name = "image-missing"; + + image = gtk_image_new_from_icon_name(icon_name, icon_size); +# else const char *stock_id; const int n_ids = G_N_ELEMENTS(menu_stock_ids); @@ -237,6 +399,7 @@ create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) stock_id = GTK_STOCK_MISSING_IMAGE; image = gtk_image_new_from_stock(stock_id, icon_size); +# endif } return image; @@ -262,11 +425,12 @@ toolbar_button_focus_in_event(GtkWidget *widget UNUSED, void gui_gtk_register_stock_icons(void) { -# include "../pixmaps/stock_icons.h" +# ifndef USE_GRESOURCE +# include "../pixmaps/stock_icons.h" GtkIconFactory *factory; factory = gtk_icon_factory_new(); -# define ADD_ICON(Name, Data) add_stock_icon(factory, Name, Data, (int)sizeof(Data)) +# define ADD_ICON(Name, Data) add_stock_icon(factory, Name, Data, (int)sizeof(Data)) ADD_ICON("vim-build-tags", stock_vim_build_tags); ADD_ICON("vim-find-help", stock_vim_find_help); @@ -282,14 +446,91 @@ gui_gtk_register_stock_icons(void) ADD_ICON("vim-window-split", stock_vim_window_split); ADD_ICON("vim-window-split-vertical", stock_vim_window_split_vertical); -# undef ADD_ICON +# undef ADD_ICON + gtk_icon_factory_add_default(factory); g_object_unref(factory); +# else /* defined(USE_GRESOURCE) */ + const char * const path_prefix = "/org/vim/gui/icon"; +# if GTK_CHECK_VERSION(3,14,0) + GdkScreen *screen = NULL; + GtkIconTheme *icon_theme = NULL; + + if (GTK_IS_WIDGET(gui.mainwin)) + screen = gtk_widget_get_screen(gui.mainwin); + else + screen = gdk_screen_get_default(); + icon_theme = gtk_icon_theme_get_for_screen(screen); + gtk_icon_theme_add_resource_path(icon_theme, path_prefix); +# elif GTK_CHECK_VERSION(3,0,0) + IconNames *names; + + for (names = stock_vim_icons; names->icon_name != NULL; names++) + { + char path[MAXPATHL]; + + vim_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); + GdkPixbuf *pixbuf = NULL; + pixbuf = gdk_pixbuf_new_from_resource(path, NULL); + if (pixbuf != NULL) + { + const gint size = MAX(gdk_pixbuf_get_width(pixbuf), + gdk_pixbuf_get_height(pixbuf)); + if (size > 16) + { + /* An icon theme is supposed to provide fixed-size + * image files for each size, e.g., 16, 22, 24, ... + * Naturally, in contrast to GtkIconSet, GtkIconTheme + * won't prepare size variants for us out of a single + * fixed-size image. + * + * Currently, Vim provides 24x24 images only while the + * icon size on the menu and the toolbar is set to 16x16 + * by default. + * + * Resize them by ourselves until we have our own fully + * fledged icon theme. */ + GdkPixbuf *src = pixbuf; + pixbuf = gdk_pixbuf_scale_simple(src, + 16, 16, + GDK_INTERP_BILINEAR); + if (pixbuf == NULL) + pixbuf = src; + else + g_object_unref(src); + } + gtk_icon_theme_add_builtin_icon(names->icon_name, size, pixbuf); + g_object_unref(pixbuf); + } + } +# else /* !GTK_CHECK_VERSION(3,0.0) */ + GtkIconFactory * const factory = gtk_icon_factory_new(); + IconNames *names; + + for (names = stock_vim_icons; names->icon_name != NULL; names++) + { + char path[MAXPATHL]; + GdkPixbuf *pixbuf; + + vim_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); + pixbuf = gdk_pixbuf_new_from_resource(path, NULL); + if (pixbuf != NULL) + { + GtkIconSet *icon_set = gtk_icon_set_new_from_pixbuf(pixbuf); + gtk_icon_factory_add(factory, names->icon_name, icon_set); + gtk_icon_set_unref(icon_set); + g_object_unref(pixbuf); + } + } + + gtk_icon_factory_add_default(factory); + g_object_unref(factory); +# endif /* !GTK_CHECK_VERSION(3,0,0) */ +# endif /* defined(USE_GRESOURCE) */ } #endif /* FEAT_TOOLBAR */ - #if defined(FEAT_MENU) || defined(PROTO) /* @@ -360,7 +601,12 @@ menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget) * changes to Vim's menu system. Not to mention that all the translations * had to be updated. */ menu->id = gtk_menu_item_new(); +# if GTK_CHECK_VERSION(3,2,0) + box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20); + gtk_box_set_homogeneous(GTK_BOX(box), FALSE); +# else box = gtk_hbox_new(FALSE, 20); +# endif use_mnemonic = (p_wak[0] != 'n' || !GTK_IS_MENU_BAR(parent_widget)); text = translate_mnemonic_tag(menu->name, use_mnemonic); @@ -406,9 +652,11 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) parent_widget = (parent != NULL) ? parent->submenu_id : gui.menubar; menu_item_new(menu, parent_widget); +# if !GTK_CHECK_VERSION(3,4,0) /* since the tearoff should always appear first, increment idx */ if (parent != NULL && !menu_is_popup(parent->name)) ++idx; +# endif gtk_menu_shell_insert(GTK_MENU_SHELL(parent_widget), menu->id, idx); @@ -417,10 +665,17 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) gtk_menu_set_accel_group(GTK_MENU(menu->submenu_id), gui.accel_group); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->id), menu->submenu_id); +# if !GTK_CHECK_VERSION(3,4,0) menu->tearoff_handle = gtk_tearoff_menu_item_new(); if (vim_strchr(p_go, GO_TEAROFF) != NULL) gtk_widget_show(menu->tearoff_handle); +# if GTK_CHECK_VERSION(3,0,0) + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu->submenu_id), + menu->tearoff_handle); +# else gtk_menu_prepend(GTK_MENU(menu->submenu_id), menu->tearoff_handle); +# endif +# endif } static void @@ -446,7 +701,17 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) if (menu_is_separator(menu->name)) { +# if GTK_CHECK_VERSION(3,0,0) + GtkToolItem *item = gtk_separator_tool_item_new(); + gtk_separator_tool_item_set_draw(GTK_SEPARATOR_TOOL_ITEM(item), + TRUE); + gtk_tool_item_set_expand(GTK_TOOL_ITEM(item), FALSE); + gtk_widget_show(GTK_WIDGET(item)); + + gtk_toolbar_insert(toolbar, item, idx); +# else gtk_toolbar_insert_space(toolbar, idx); +# endif menu->id = NULL; } else @@ -461,6 +726,24 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) * a nasty GTK error message, skip the tooltip. */ CONVERT_TO_UTF8_FREE(tooltip); +# if GTK_CHECK_VERSION(3,0,0) + { + GtkWidget *icon; + GtkToolItem *item; + + icon = create_menu_icon(menu, + gtk_toolbar_get_icon_size(toolbar)); + item = gtk_tool_button_new(icon, (const gchar *)text); + gtk_tool_item_set_tooltip_text(item, (const gchar *)tooltip); + g_signal_connect(G_OBJECT(item), "clicked", + G_CALLBACK(&menu_item_activate), menu); + gtk_widget_show_all(GTK_WIDGET(item)); + + gtk_toolbar_insert(toolbar, item, idx); + + menu->id = GTK_WIDGET(item); + } +# else menu->id = gtk_toolbar_insert_item( toolbar, (const char *)text, @@ -470,10 +753,16 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) G_CALLBACK(&menu_item_activate), menu, idx); +# endif if (gtk_socket_id != 0) +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(menu->id), "focus-in-event", + G_CALLBACK(toolbar_button_focus_in_event), NULL); +# else gtk_signal_connect(GTK_OBJECT(menu->id), "focus_in_event", GTK_SIGNAL_FUNC(toolbar_button_focus_in_event), NULL); +# endif CONVERT_TO_UTF8_FREE(text); CONVERT_TO_UTF8_FREE(tooltip); @@ -486,18 +775,29 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) if (parent == NULL || parent->submenu_id == NULL) return; +# if !GTK_CHECK_VERSION(3,4,0) /* Make place for the possible tearoff handle item. Not in the popup * menu, it doesn't have a tearoff item. */ if (!menu_is_popup(parent->name)) ++idx; +# endif if (menu_is_separator(menu->name)) { /* Separator: Just add it */ +# if GTK_CHECK_VERSION(3,0,0) + menu->id = gtk_separator_menu_item_new(); +# else menu->id = gtk_menu_item_new(); gtk_widget_set_sensitive(menu->id, FALSE); +# endif gtk_widget_show(menu->id); +# if GTK_CHECK_VERSION(3,0,0) + gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), + menu->id, idx); +# else gtk_menu_insert(GTK_MENU(parent->submenu_id), menu->id, idx); +# endif return; } @@ -505,11 +805,21 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) /* Add textual menu item. */ menu_item_new(menu, parent->submenu_id); gtk_widget_show(menu->id); +# if GTK_CHECK_VERSION(3,0,0) + gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), + menu->id, idx); +# else gtk_menu_insert(GTK_MENU(parent->submenu_id), menu->id, idx); +# endif if (menu->id != NULL) +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(menu->id), "activate", + G_CALLBACK(menu_item_activate), menu); +# else gtk_signal_connect(GTK_OBJECT(menu->id), "activate", GTK_SIGNAL_FUNC(menu_item_activate), menu); +# endif } } #endif /* FEAT_MENU */ @@ -544,6 +854,7 @@ gui_gtk_set_mnemonics(int enable) } } +# if !GTK_CHECK_VERSION(3,4,0) static void recurse_tearoffs(vimmenu_T *menu, int val) { @@ -560,12 +871,21 @@ recurse_tearoffs(vimmenu_T *menu, int val) recurse_tearoffs(menu->children, val); } } +# endif +# if GTK_CHECK_VERSION(3,4,0) + void +gui_mch_toggle_tearoffs(int enable UNUSED) +{ + /* Do nothing */ +} +# else void gui_mch_toggle_tearoffs(int enable) { recurse_tearoffs(root_menu, enable); } +# endif #endif /* FEAT_MENU */ #if defined(FEAT_TOOLBAR) @@ -596,10 +916,15 @@ gui_mch_menu_set_tip(vimmenu_T *menu) char_u *tooltip; tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); - if (tooltip == NULL || utf_valid_string(tooltip, NULL)) + if (tooltip != NULL && utf_valid_string(tooltip, NULL)) +# if GTK_CHECK_VERSION(3,0,0) /* Only set the tooltip when it's valid utf-8. */ - gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips, - menu->id, (const char *)tooltip, NULL); + gtk_widget_set_tooltip_text(menu->id, (const gchar *)tooltip); +# else + /* Only set the tooltip when it's valid utf-8. */ + gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips, + menu->id, (const char *)tooltip, NULL); +# endif CONVERT_TO_UTF8_FREE(tooltip); } } @@ -628,8 +953,20 @@ gui_mch_destroy_menu(vimmenu_T *menu) if (menu->parent != NULL && menu_is_toolbar(menu->parent->name)) { if (menu_is_separator(menu->name)) +# if GTK_CHECK_VERSION(3,0,0) + { + GtkToolItem *item = NULL; + + item = gtk_toolbar_get_nth_item(GTK_TOOLBAR(gui.toolbar), + get_menu_position(menu)); + if (item != NULL) + gtk_container_remove(GTK_CONTAINER(gui.toolbar), + GTK_WIDGET(item)); + } +# else gtk_toolbar_remove_space(GTK_TOOLBAR(gui.toolbar), get_menu_position(menu)); +# endif else if (menu->id != NULL) gtk_widget_destroy(menu->id); } @@ -663,18 +1000,42 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max) adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id)); +#if GTK_CHECK_VERSION(3,0,0) + gtk_adjustment_set_lower(adjustment, 0.0); + gtk_adjustment_set_value(adjustment, val); + gtk_adjustment_set_upper(adjustment, max + 1); + gtk_adjustment_set_page_size(adjustment, size); + gtk_adjustment_set_page_increment(adjustment, + size < 3L ? 1L : size - 2L); + gtk_adjustment_set_step_increment(adjustment, 1.0); +#else adjustment->lower = 0.0; adjustment->value = val; adjustment->upper = max + 1; adjustment->page_size = size; adjustment->page_increment = size < 3L ? 1L : size - 2L; adjustment->step_increment = 1.0; +#endif +#if GTK_CHECK_VERSION(3,0,0) + g_signal_handler_block(G_OBJECT(adjustment), + (gulong)sb->handler_id); +#else g_signal_handler_block(GTK_OBJECT(adjustment), (gulong)sb->handler_id); +#endif + +#if !GTK_CHECK_VERSION(3,18,0) gtk_adjustment_changed(adjustment); +#endif + +#if GTK_CHECK_VERSION(3,0,0) + g_signal_handler_unblock(G_OBJECT(adjustment), + (gulong)sb->handler_id); +#else g_signal_handler_unblock(GTK_OBJECT(adjustment), (gulong)sb->handler_id); +#endif } } @@ -702,7 +1063,12 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data) #endif sb = gui_find_scrollbar((long)data); +#if GTK_CHECK_VERSION(3,0,0) + value = gtk_adjustment_get_value(adjustment); +#else value = (long)adjustment->value; +#endif +#if !GTK_CHECK_VERSION(3,0,0) /* * The dragging argument must be right for the scrollbar to work with * closed folds. This isn't documented, hopefully this will keep on @@ -745,7 +1111,7 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data) } } } - +#endif /* !GTK_CHECK_VERSION(3,0,0) */ gui_drag_scrollbar(sb, value, dragging); } @@ -754,28 +1120,46 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data) gui_mch_create_scrollbar(scrollbar_T *sb, int orient) { if (orient == SBAR_HORIZ) +#if GTK_CHECK_VERSION(3,2,0) + sb->id = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL); +#else sb->id = gtk_hscrollbar_new(NULL); +#endif else if (orient == SBAR_VERT) +#if GTK_CHECK_VERSION(3,2,0) + sb->id = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL); +#else sb->id = gtk_vscrollbar_new(NULL); +#endif if (sb->id != NULL) { GtkAdjustment *adjustment; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_focus(sb->id, FALSE); +#else GTK_WIDGET_UNSET_FLAGS(sb->id, GTK_CAN_FOCUS); +#endif gtk_form_put(GTK_FORM(gui.formwin), sb->id, 0, 0); adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id)); +#if GTK_CHECK_VERSION(3,0,0) + sb->handler_id = g_signal_connect( + G_OBJECT(adjustment), "value-changed", + G_CALLBACK(adjustment_value_changed), + GINT_TO_POINTER(sb->ident)); +#else sb->handler_id = gtk_signal_connect( GTK_OBJECT(adjustment), "value_changed", GTK_SIGNAL_FUNC(adjustment_value_changed), GINT_TO_POINTER(sb->ident)); +#endif gui_mch_update(); } } -#if defined(FEAT_WINDOWS) || defined(PROTO) void gui_mch_destroy_scrollbar(scrollbar_T *sb) { @@ -786,7 +1170,6 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb) } gui_mch_update(); } -#endif #if defined(FEAT_BROWSE) || defined(PROTO) /* @@ -884,8 +1267,13 @@ gui_mch_browse(int saving UNUSED, GTK_WINDOW(gui.mainwin), saving ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_OPEN, +# if GTK_CHECK_VERSION(3,10,0) + _("_Cancel"), GTK_RESPONSE_CANCEL, + saving ? _("_Save") : _("_Open"), GTK_RESPONSE_ACCEPT, +# else GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, saving ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, +# endif NULL); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), (const gchar *)dirbuf); @@ -943,7 +1331,7 @@ gui_mch_browse(int saving UNUSED, } gtk_widget_destroy(GTK_WIDGET(fc)); -#else +#else /* !USE_FILE_CHOOSER */ if (gui.filedlg == NULL) { @@ -979,7 +1367,7 @@ gui_mch_browse(int saving UNUSED, gtk_widget_show(gui.filedlg); gtk_main(); -#endif +#endif /* !USE_FILE_CHOOSER */ g_log_remove_handler(domain, log_handler); CONVERT_TO_UTF8_FREE(title); @@ -1014,8 +1402,13 @@ gui_mch_browsedir( (const gchar *)title, GTK_WINDOW(gui.mainwin), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, +# if GTK_CHECK_VERSION(3,10,0) + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_OK"), GTK_RESPONSE_ACCEPT, +# else GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, +# endif NULL); CONVERT_TO_UTF8_FREE(title); @@ -1048,10 +1441,10 @@ gui_mch_browsedir( g_free(dirname); return p; -# else +# else /* !defined(GTK_FILE_CHOOSER) */ /* For GTK 2.2 and earlier: fall back to ordinary file selector. */ return gui_mch_browse(0, title, NULL, NULL, initdir, NULL); -# endif +# endif /* !defined(GTK_FILE_CHOOSER) */ } @@ -1128,7 +1521,7 @@ split_button_string(char_u *button_string, int *n_buttons) else if (*p == DLG_HOTKEY_CHAR) *p++ = '_'; else - mb_ptr_adv(p); + MB_PTR_ADV(p); } array[count] = NULL; /* currently not relied upon, but doesn't hurt */ } @@ -1218,6 +1611,11 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) /* Check 'v' flag in 'guioptions': vertical button placement. */ if (vim_strchr(p_go, GO_VERTICAL) != NULL) { +# if GTK_CHECK_VERSION(3,0,0) + /* Add GTK+ 3 code if necessary. */ + /* N.B. GTK+ 3 doesn't allow you to access vbox and action_area via + * the C API. */ +# else GtkWidget *vbutton_box; vbutton_box = gtk_vbutton_box_new(); @@ -1226,6 +1624,7 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) vbutton_box, TRUE, FALSE, 0); /* Overrule the "action_area" value, hopefully this works... */ GTK_DIALOG(dialog)->action_area = vbutton_box; +# endif } /* @@ -1260,6 +1659,16 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) */ if (ok != NULL && ync != NULL) /* almost impossible to fail */ { +# if GTK_CHECK_VERSION(3,10,0) + if (button_equal(label, ok[0])) label = _("OK"); + else if (button_equal(label, ync[0])) label = _("Yes"); + else if (button_equal(label, ync[1])) label = _("No"); + else if (button_equal(label, ync[2])) label = _("Cancel"); + else if (button_equal(label, "Ok")) label = _("OK"); + else if (button_equal(label, "Yes")) label = _("Yes"); + else if (button_equal(label, "No")) label = _("No"); + else if (button_equal(label, "Cancel")) label = _("Cancel"); +# else if (button_equal(label, ok[0])) label = GTK_STOCK_OK; else if (button_equal(label, ync[0])) label = GTK_STOCK_YES; else if (button_equal(label, ync[1])) label = GTK_STOCK_NO; @@ -1268,6 +1677,7 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) else if (button_equal(label, "Yes")) label = GTK_STOCK_YES; else if (button_equal(label, "No")) label = GTK_STOCK_NO; else if (button_equal(label, "Cancel")) label = GTK_STOCK_CANCEL; +# endif } label8 = CONVERT_TO_UTF8((char_u *)label); gtk_dialog_add_button(dialog, (const gchar *)label8, idx); @@ -1360,14 +1770,32 @@ gui_mch_dialog(int type, /* type of dialog */ gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text); CONVERT_TO_UTF8_FREE(text); +# if GTK_CHECK_VERSION(3,14,0) + gtk_widget_set_halign(GTK_WIDGET(entry), GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(entry), GTK_ALIGN_CENTER); + gtk_widget_set_hexpand(GTK_WIDGET(entry), TRUE); + gtk_widget_set_vexpand(GTK_WIDGET(entry), TRUE); + + alignment = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); +# else alignment = gtk_alignment_new((float)0.5, (float)0.5, (float)1.0, (float)1.0); +# endif gtk_container_add(GTK_CONTAINER(alignment), entry); gtk_container_set_border_width(GTK_CONTAINER(alignment), 5); gtk_widget_show(alignment); +# if GTK_CHECK_VERSION(3,0,0) + { + GtkWidget * const vbox + = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + gtk_box_pack_start(GTK_BOX(vbox), + alignment, TRUE, FALSE, 0); + } +# else gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), alignment, TRUE, FALSE, 0); +# endif dialoginfo.noalt = FALSE; } else @@ -1425,6 +1853,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) * Append a submenu for selecting an input method. This is * currently the only way to switch input methods at runtime. */ +# if !GTK_CHECK_VERSION(3,10,0) if (xic != NULL && g_object_get_data(G_OBJECT(menu->submenu_id), "vim-has-im-menu") == NULL) { @@ -1451,12 +1880,39 @@ gui_mch_show_popupmenu(vimmenu_T *menu) g_object_set_data(G_OBJECT(menu->submenu_id), "vim-has-im-menu", GINT_TO_POINTER(TRUE)); } +# endif # endif /* FEAT_XIM */ +# if GTK_CHECK_VERSION(3,22,2) + { + GdkEventButton trigger; + + /* A pseudo event to have gtk_menu_popup_at_pointer() work. Since the + * function calculates the popup menu position on the basis of the + * actual pointer position when it is invoked, the fields x, y, x_root + * and y_root are set to zero for convenience. */ + trigger.type = GDK_BUTTON_PRESS; + trigger.window = gtk_widget_get_window(gui.drawarea); + trigger.send_event = FALSE; + trigger.time = gui.event_time; + trigger.x = 0.0; + trigger.y = 0.0; + trigger.axes = NULL; + trigger.state = 0; + trigger.button = 3; + trigger.device = NULL; + trigger.x_root = 0.0; + trigger.y_root = 0.0; + + gtk_menu_popup_at_pointer(GTK_MENU(menu->submenu_id), + (GdkEvent *)&trigger); + } +#else gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL, (GtkMenuPositionFunc)NULL, NULL, 3U, gui.event_time); +#endif } /* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to @@ -1476,7 +1932,11 @@ popup_menu_position_func(GtkMenu *menu UNUSED, gboolean *push_in UNUSED, gpointer user_data UNUSED) { +# if GTK_CHECK_VERSION(3,0,0) + gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), x, y); +# else gdk_window_get_origin(gui.drawarea->window, x, y); +# endif if (popup_mouse_pos) { @@ -1486,10 +1946,15 @@ popup_menu_position_func(GtkMenu *menu UNUSED, *x += mx; *y += my; } +# if GTK_CHECK_VERSION(3,0,0) + else if (curwin != NULL && gui.drawarea != NULL && + gtk_widget_get_window(gui.drawarea) != NULL) +# else else if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL) +# endif { /* Find the cursor position in the current window */ - *x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1; + *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; } } @@ -1505,10 +1970,55 @@ gui_make_popup(char_u *path_name, int mouse_pos) if (menu != NULL && menu->submenu_id != NULL) { +# if GTK_CHECK_VERSION(3,22,2) + GdkWindow * const win = gtk_widget_get_window(gui.drawarea); + GdkEventButton trigger; + + /* A pseudo event to have gtk_menu_popup_at_*() functions work. Since + * the position where the menu pops up is automatically adjusted by + * the functions, none of the fields x, y, x_root and y_root has to be + * set to a specific value here; therefore, they are set to zero for + * convenience.*/ + trigger.type = GDK_BUTTON_PRESS; + trigger.window = win; + trigger.send_event = FALSE; + trigger.time = GDK_CURRENT_TIME; + trigger.x = 0.0; + trigger.y = 0.0; + trigger.axes = NULL; + trigger.state = 0; + trigger.button = 0; + trigger.device = NULL; + trigger.x_root = 0.0; + trigger.y_root = 0.0; + + if (mouse_pos) + gtk_menu_popup_at_pointer(GTK_MENU(menu->submenu_id), + (GdkEvent *)&trigger); + else + { + gint origin_x, origin_y; + GdkRectangle rect = { 0, 0, 0, 0 }; + + gdk_window_get_origin(win, &origin_x, &origin_y); + popup_menu_position_func(NULL, &rect.x, &rect.y, NULL, NULL); + + rect.x -= origin_x; + rect.y -= origin_y; + + gtk_menu_popup_at_rect(GTK_MENU(menu->submenu_id), + win, + &rect, + GDK_GRAVITY_SOUTH_EAST, + GDK_GRAVITY_NORTH_WEST, + (GdkEvent *)&trigger); + } +# else gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL, &popup_menu_position_func, NULL, 0U, (guint32)GDK_CURRENT_TIME); +# endif } } @@ -1564,7 +2074,13 @@ find_key_press_event( } static GtkWidget * -create_image_button(const char *stock_id, const char *label) +#if GTK_CHECK_VERSION(3,10,0) +create_image_button(const char *stock_id UNUSED, + const char *label) +#else +create_image_button(const char *stock_id, + const char *label) +#endif { char_u *text; GtkWidget *box; @@ -1573,18 +2089,35 @@ create_image_button(const char *stock_id, const char *label) text = CONVERT_TO_UTF8((char_u *)label); +#if GTK_CHECK_VERSION(3,2,0) + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3); + gtk_box_set_homogeneous(GTK_BOX(box), FALSE); +#else box = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(box), - gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_BUTTON), - FALSE, FALSE, 0); +#endif +#if !GTK_CHECK_VERSION(3,10,0) + if (stock_id != NULL) + gtk_box_pack_start(GTK_BOX(box), + gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_BUTTON), + FALSE, FALSE, 0); +#endif gtk_box_pack_start(GTK_BOX(box), gtk_label_new((const char *)text), FALSE, FALSE, 0); CONVERT_TO_UTF8_FREE(text); +#if GTK_CHECK_VERSION(3,14,0) + gtk_widget_set_halign(GTK_WIDGET(box), GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(box), GTK_ALIGN_CENTER); + gtk_widget_set_hexpand(GTK_WIDGET(box), TRUE); + gtk_widget_set_vexpand(GTK_WIDGET(box), TRUE); + + alignment = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); +#else alignment = gtk_alignment_new((float)0.5, (float)0.5, (float)0.0, (float)0.0); +#endif gtk_container_add(GTK_CONTAINER(alignment), box); gtk_widget_show_all(alignment); @@ -1611,6 +2144,37 @@ convert_localized_message(char_u **buffer, const char *message) return (const char *)*buffer; } +/* + * Returns the number of characters in GtkEntry. + */ + static unsigned long +entry_get_text_length(GtkEntry *entry) +{ + g_return_val_if_fail(entry != NULL, 0); + g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0); + +#if GTK_CHECK_VERSION(2,18,0) + /* 2.18 introduced a new object GtkEntryBuffer to handle text data for + * GtkEntry instead of letting each instance of the latter have its own + * storage for that. The code below is almost identical to the + * implementation of gtk_entry_get_text_length() for the versions >= 2.18. + */ + return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry)); +#elif GTK_CHECK_VERSION(2,14,0) + /* 2.14 introduced a new function to avoid memory management bugs which can + * happen when gtk_entry_get_text() is used without due care and attention. + */ + return gtk_entry_get_text_length(entry); +#else + /* gtk_entry_get_text() returns the pointer to the storage allocated + * internally by the widget. Accordingly, use the one with great care: + * Don't free it nor modify the contents it points to; call the function + * every time you need the pointer since its value may have been changed + * by the widget. */ + return g_utf8_strlen(gtk_entry_get_text(entry), -1); +#endif +} + static void find_replace_dialog_create(char_u *arg, int do_replace) { @@ -1647,18 +2211,37 @@ find_replace_dialog_create(char_u *arg, int do_replace) if (entry_text != NULL) { gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text); +#if GTK_CHECK_VERSION(3,0,0) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword), + (gboolean)wword); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), + (gboolean)mcase); +#else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword), (gboolean)wword); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase), (gboolean)mcase); +#endif } gtk_window_present(GTK_WINDOW(frdp->dialog)); + + /* For :promptfind dialog, always give keyboard focus to 'what' entry. + * For :promptrepl dialog, give it to 'with' entry if 'what' has an + * non-empty entry; otherwise, to 'what' entry. */ + gtk_widget_grab_focus(frdp->what); + if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) + gtk_widget_grab_focus(frdp->with); + vim_free(entry_text); return; } frdp->dialog = gtk_dialog_new(); +#if GTK_CHECK_VERSION(3,0,0) + /* Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. */ +#else gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE); +#endif gtk_window_set_transient_for(GTK_WINDOW(frdp->dialog), GTK_WINDOW(gui.mainwin)); gtk_window_set_destroy_with_parent(GTK_WINDOW(frdp->dialog), TRUE); @@ -1673,164 +2256,402 @@ find_replace_dialog_create(char_u *arg, int do_replace) CONV(_("VIM - Search..."))); } +#if GTK_CHECK_VERSION(3,2,0) + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE); +#else hbox = gtk_hbox_new(FALSE, 0); +#endif gtk_container_set_border_width(GTK_CONTAINER(hbox), 10); +#if GTK_CHECK_VERSION(3,0,0) + { + GtkWidget * const dialog_vbox + = gtk_dialog_get_content_area(GTK_DIALOG(frdp->dialog)); + gtk_container_add(GTK_CONTAINER(dialog_vbox), hbox); + } +#else gtk_container_add(GTK_CONTAINER(GTK_DIALOG(frdp->dialog)->vbox), hbox); +#endif if (do_replace) +#if GTK_CHECK_VERSION(3,4,0) + table = gtk_grid_new(); +#else table = gtk_table_new(1024, 4, FALSE); +#endif else +#if GTK_CHECK_VERSION(3,4,0) + table = gtk_grid_new(); +#else table = gtk_table_new(1024, 3, FALSE); +#endif gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(table), 4); +#else gtk_container_border_width(GTK_CONTAINER(table), 4); +#endif tmp = gtk_label_new(CONV(_("Find what:"))); +#if GTK_CHECK_VERSION(3,16,0) + gtk_label_set_xalign(GTK_LABEL(tmp), 0.0); + gtk_label_set_yalign(GTK_LABEL(tmp), 0.5); +#elif GTK_CHECK_VERSION(3,14,0) + { + GValue align_val = G_VALUE_INIT; + + g_value_init(&align_val, G_TYPE_FLOAT); + + g_value_set_float(&align_val, 0.0); + g_object_set_property(G_OBJECT(tmp), "xalign", &align_val); + + g_value_set_float(&align_val, 0.5); + g_object_set_property(G_OBJECT(tmp), "yalign", &align_val); + + g_value_unset(&align_val); + } +#else gtk_misc_set_alignment(GTK_MISC(tmp), (gfloat)0.0, (gfloat)0.5); +#endif +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), tmp, 0, 0, 2, 1); +#else gtk_table_attach(GTK_TABLE(table), tmp, 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 2, 2); +#endif frdp->what = gtk_entry_new(); sensitive = (entry_text != NULL && entry_text[0] != NUL); if (entry_text != NULL) gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->what), "changed", + G_CALLBACK(entry_changed_cb), frdp->dialog); + g_signal_connect_after(G_OBJECT(frdp->what), "key-press-event", + G_CALLBACK(find_key_press_event), + (gpointer) frdp); +#else gtk_signal_connect(GTK_OBJECT(frdp->what), "changed", GTK_SIGNAL_FUNC(entry_changed_cb), frdp->dialog); gtk_signal_connect_after(GTK_OBJECT(frdp->what), "key_press_event", GTK_SIGNAL_FUNC(find_key_press_event), (gpointer) frdp); +#endif +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->what, 2, 0, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->what, 1, 1024, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 2, 2); +#endif if (do_replace) { tmp = gtk_label_new(CONV(_("Replace with:"))); +#if GTK_CHECK_VERSION(3,16,0) + gtk_label_set_xalign(GTK_LABEL(tmp), 0.0); + gtk_label_set_yalign(GTK_LABEL(tmp), 0.5); +#elif GTK_CHECK_VERSION(3,14,0) + { + GValue align_val = G_VALUE_INIT; + + g_value_init(&align_val, G_TYPE_FLOAT); + + g_value_set_float(&align_val, 0.0); + g_object_set_property(G_OBJECT(tmp), "xalign", &align_val); + + g_value_set_float(&align_val, 0.5); + g_object_set_property(G_OBJECT(tmp), "yalign", &align_val); + + g_value_unset(&align_val); + } +#else gtk_misc_set_alignment(GTK_MISC(tmp), (gfloat)0.0, (gfloat)0.5); +#endif +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), tmp, 0, 1, 2, 1); +#else gtk_table_attach(GTK_TABLE(table), tmp, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 2, 2); +#endif frdp->with = gtk_entry_new(); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->with), "activate", + G_CALLBACK(find_replace_cb), + GINT_TO_POINTER(FRD_R_FINDNEXT)); + g_signal_connect_after(G_OBJECT(frdp->with), "key-press-event", + G_CALLBACK(find_key_press_event), + (gpointer) frdp); +#else gtk_signal_connect(GTK_OBJECT(frdp->with), "activate", GTK_SIGNAL_FUNC(find_replace_cb), GINT_TO_POINTER(FRD_R_FINDNEXT)); gtk_signal_connect_after(GTK_OBJECT(frdp->with), "key_press_event", GTK_SIGNAL_FUNC(find_key_press_event), (gpointer) frdp); +#endif +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->with, 2, 1, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->with, 1, 1024, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 2, 2); +#endif /* * Make the entry activation only change the input focus onto the * with item. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->what), "activate", + G_CALLBACK(entry_activate_cb), frdp->with); +#else gtk_signal_connect(GTK_OBJECT(frdp->what), "activate", GTK_SIGNAL_FUNC(entry_activate_cb), frdp->with); +#endif } else { /* * Make the entry activation do the search. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->what), "activate", + G_CALLBACK(find_replace_cb), + GINT_TO_POINTER(FRD_FINDNEXT)); +#else gtk_signal_connect(GTK_OBJECT(frdp->what), "activate", GTK_SIGNAL_FUNC(find_replace_cb), GINT_TO_POINTER(FRD_FINDNEXT)); +#endif } /* whole word only button */ frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only"))); +#if GTK_CHECK_VERSION(3,0,0) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword), + (gboolean)wword); +#else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword), (gboolean)wword); +#endif if (do_replace) +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->wword, 0, 2, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 2, 3, GTK_FILL, GTK_EXPAND, 2, 2); +#endif else +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->wword, 0, 3, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 1, 2, GTK_FILL, GTK_EXPAND, 2, 2); +#endif /* match case button */ frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case"))); +#if GTK_CHECK_VERSION(3,0,0) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), + (gboolean)mcase); +#else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase), (gboolean)mcase); +#endif if (do_replace) +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->mcase, 0, 3, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->mcase, 0, 1023, 3, 4, GTK_FILL, GTK_EXPAND, 2, 2); +#endif else +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), frdp->mcase, 0, 4, 5, 1); +#else gtk_table_attach(GTK_TABLE(table), frdp->mcase, 0, 1023, 2, 3, GTK_FILL, GTK_EXPAND, 2, 2); +#endif tmp = gtk_frame_new(CONV(_("Direction"))); if (do_replace) +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), tmp, 5, 2, 2, 4); +#else gtk_table_attach(GTK_TABLE(table), tmp, 1023, 1024, 2, 4, GTK_FILL, GTK_FILL, 2, 2); +#endif else +#if GTK_CHECK_VERSION(3,4,0) + gtk_grid_attach(GTK_GRID(table), tmp, 5, 2, 1, 3); +#else gtk_table_attach(GTK_TABLE(table), tmp, 1023, 1024, 1, 3, GTK_FILL, GTK_FILL, 2, 2); +#endif +#if GTK_CHECK_VERSION(3,2,0) + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE); +#else vbox = gtk_vbox_new(FALSE, 0); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); +#else gtk_container_border_width(GTK_CONTAINER(vbox), 0); +#endif gtk_container_add(GTK_CONTAINER(tmp), vbox); /* 'Up' and 'Down' buttons */ frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up"))); gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(3,0,0) + frdp->down = gtk_radio_button_new_with_label( + gtk_radio_button_get_group(GTK_RADIO_BUTTON(frdp->up)), + CONV(_("Down"))); +#else frdp->down = gtk_radio_button_new_with_label( gtk_radio_button_group(GTK_RADIO_BUTTON(frdp->up)), CONV(_("Down"))); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->down), TRUE); +#else gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->down), TRUE); +#endif gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0); /* vbox to hold the action buttons */ +#if GTK_CHECK_VERSION(3,2,0) + actionarea = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); +#else actionarea = gtk_vbutton_box_new(); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2); +#else gtk_container_border_width(GTK_CONTAINER(actionarea), 2); +#endif gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0); /* 'Find Next' button */ +#if GTK_CHECK_VERSION(3,10,0) + frdp->find = create_image_button(NULL, _("Find Next")); +#else frdp->find = create_image_button(GTK_STOCK_FIND, _("Find Next")); +#endif gtk_widget_set_sensitive(frdp->find, sensitive); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->find), "clicked", + G_CALLBACK(find_replace_cb), + (do_replace) ? GINT_TO_POINTER(FRD_R_FINDNEXT) + : GINT_TO_POINTER(FRD_FINDNEXT)); +#else gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked", GTK_SIGNAL_FUNC(find_replace_cb), (do_replace) ? GINT_TO_POINTER(FRD_R_FINDNEXT) : GINT_TO_POINTER(FRD_FINDNEXT)); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_default(frdp->find, TRUE); +#else GTK_WIDGET_SET_FLAGS(frdp->find, GTK_CAN_DEFAULT); +#endif gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0); gtk_widget_grab_default(frdp->find); if (do_replace) { /* 'Replace' button */ +#if GTK_CHECK_VERSION(3,10,0) + frdp->replace = create_image_button(NULL, _("Replace")); +#else frdp->replace = create_image_button(GTK_STOCK_CONVERT, _("Replace")); +#endif gtk_widget_set_sensitive(frdp->replace, sensitive); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_default(frdp->find, TRUE); +#else GTK_WIDGET_SET_FLAGS(frdp->replace, GTK_CAN_DEFAULT); +#endif gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->replace), "clicked", + G_CALLBACK(find_replace_cb), + GINT_TO_POINTER(FRD_REPLACE)); +#else gtk_signal_connect(GTK_OBJECT(frdp->replace), "clicked", GTK_SIGNAL_FUNC(find_replace_cb), GINT_TO_POINTER(FRD_REPLACE)); +#endif /* 'Replace All' button */ +#if GTK_CHECK_VERSION(3,10,0) + frdp->all = create_image_button(NULL, _("Replace All")); +#else frdp->all = create_image_button(GTK_STOCK_CONVERT, _("Replace All")); +#endif gtk_widget_set_sensitive(frdp->all, sensitive); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_default(frdp->all, TRUE); +#else GTK_WIDGET_SET_FLAGS(frdp->all, GTK_CAN_DEFAULT); +#endif gtk_box_pack_start(GTK_BOX(actionarea), frdp->all, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(frdp->all), "clicked", + G_CALLBACK(find_replace_cb), + GINT_TO_POINTER(FRD_REPLACEALL)); +#else gtk_signal_connect(GTK_OBJECT(frdp->all), "clicked", GTK_SIGNAL_FUNC(find_replace_cb), GINT_TO_POINTER(FRD_REPLACEALL)); +#endif } /* 'Cancel' button */ +#if GTK_CHECK_VERSION(3,10,0) + tmp = gtk_button_new_with_mnemonic(_("_Close")); +#else tmp = gtk_button_new_from_stock(GTK_STOCK_CLOSE); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_default(tmp, TRUE); +#else GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_DEFAULT); +#endif gtk_box_pack_end(GTK_BOX(actionarea), tmp, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect_swapped(G_OBJECT(tmp), + "clicked", G_CALLBACK(gtk_widget_hide), + G_OBJECT(frdp->dialog)); + g_signal_connect_swapped(G_OBJECT(frdp->dialog), + "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), + G_OBJECT(frdp->dialog)); +#else gtk_signal_connect_object(GTK_OBJECT(tmp), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(frdp->dialog)); gtk_signal_connect_object(GTK_OBJECT(frdp->dialog), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_OBJECT(frdp->dialog)); +#endif +#if GTK_CHECK_VERSION(3,2,0) + tmp = gtk_separator_new(GTK_ORIENTATION_VERTICAL); +#else tmp = gtk_vseparator_new(); +#endif gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10); /* Suppress automatic show of the unused action area */ +#if GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,12,0) + gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(frdp->dialog))); +# endif +#else gtk_widget_hide(GTK_DIALOG(frdp->dialog)->action_area); +#endif gtk_widget_show_all(hbox); gtk_widget_show(frdp->dialog); @@ -1880,11 +2701,23 @@ find_replace_cb(GtkWidget *widget UNUSED, gpointer data) } find_text = (char_u *)gtk_entry_get_text(GTK_ENTRY(sfr->what)); +#if GTK_CHECK_VERSION(3,0,0) + direction_down = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->down)); +#else direction_down = GTK_TOGGLE_BUTTON(sfr->down)->active; +#endif +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->wword))) +#else if (GTK_TOGGLE_BUTTON(sfr->wword)->active) +#endif flags |= FRD_WHOLE_WORD; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->mcase))) +#else if (GTK_TOGGLE_BUTTON(sfr->mcase)->active) +#endif flags |= FRD_MATCH_CASE; repl_text = CONVERT_FROM_UTF8(repl_text); @@ -1940,8 +2773,7 @@ entry_changed_cb(GtkWidget * entry, GtkWidget * dialog) * ":helpfind" */ void -ex_helpfind(eap) - exarg_T *eap UNUSED; +ex_helpfind(exarg_T *eap UNUSED) { /* This will fail when menus are not loaded. Well, it's only for * backwards compatibility anyway. */ diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c index 0eb50652ca..bb4c632b02 100644 --- a/src/gui_gtk_f.c +++ b/src/gui_gtk_f.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,13 +19,19 @@ * children at arbitrary positions width arbitrary sizes. This finally puts * an end on our resize problems with which we where struggling for such a * long time. + * + * Support for GTK+ 3 was added by: + * + * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> */ #include "vim.h" #include <gtk/gtk.h> /* without this it compiles, but gives errors at runtime! */ #include "gui_gtk_f.h" -#include <gtk/gtksignal.h> +#if !GTK_CHECK_VERSION(3,0,0) +# include <gtk/gtksignal.h> +#endif #ifdef WIN3264 # include <gdk/gdkwin32.h> #else @@ -52,10 +58,23 @@ static void gtk_form_unrealize(GtkWidget *widget); static void gtk_form_map(GtkWidget *widget); static void gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition); +#if GTK_CHECK_VERSION(3,0,0) +static void gtk_form_get_preferred_width(GtkWidget *widget, + gint *minimal_width, + gint *natural_width); +static void gtk_form_get_preferred_height(GtkWidget *widget, + gint *minimal_height, + gint *natural_height); +#endif static void gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation); +#if GTK_CHECK_VERSION(3,0,0) +static gboolean gtk_form_draw(GtkWidget *widget, + cairo_t *cr); +#else static gint gtk_form_expose(GtkWidget *widget, GdkEventExpose *event); +#endif static void gtk_form_remove(GtkContainer *container, GtkWidget *widget); @@ -73,22 +92,14 @@ static void gtk_form_position_child(GtkForm *form, gboolean force_allocate); static void gtk_form_position_children(GtkForm *form); -static GdkFilterReturn gtk_form_filter(GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data); -static GdkFilterReturn gtk_form_main_filter(GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data); - -static void gtk_form_set_static_gravity(GdkWindow *window, - gboolean use_static); - static void gtk_form_send_configure(GtkForm *form); static void gtk_form_child_map(GtkWidget *widget, gpointer user_data); static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data); +#if !GTK_CHECK_VERSION(3,0,0) static GtkWidgetClass *parent_class = NULL; +#endif /* Public interface */ @@ -98,7 +109,11 @@ gtk_form_new(void) { GtkForm *form; +#if GTK_CHECK_VERSION(3,0,0) + form = g_object_new(GTK_TYPE_FORM, NULL); +#else form = gtk_type_new(gtk_form_get_type()); +#endif return GTK_WIDGET(form); } @@ -120,8 +135,12 @@ gtk_form_put(GtkForm *form, child->window = NULL; child->x = x; child->y = y; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_size_request(child->widget, -1, -1); +#else child->widget->requisition.width = 0; child->widget->requisition.height = 0; +#endif child->mapped = FALSE; form->children = g_list_append(form->children, child); @@ -131,13 +150,21 @@ gtk_form_put(GtkForm *form, * that gtk_widget_set_parent() realizes the widget if it's visible * and its parent is mapped. */ +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_realized(GTK_WIDGET(form))) +#else if (GTK_WIDGET_REALIZED(form)) +#endif gtk_form_attach_child_window(form, child); gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); - gtk_widget_size_request(child->widget, NULL); +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_realized(GTK_WIDGET(form)) + && !gtk_widget_get_realized(child_widget)) +#else if (GTK_WIDGET_REALIZED(form) && !GTK_WIDGET_REALIZED(child_widget)) +#endif gtk_form_realize_child(form, child); gtk_form_position_child(form, child, TRUE); @@ -193,6 +220,9 @@ gtk_form_thaw(GtkForm *form) /* Basic Object handling procedures */ +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) +#else GtkType gtk_form_get_type(void) { @@ -213,6 +243,7 @@ gtk_form_get_type(void) } return form_type; } +#endif /* !GTK_CHECK_VERSION(3,0,0) */ static void gtk_form_class_init(GtkFormClass *klass) @@ -223,14 +254,25 @@ gtk_form_class_init(GtkFormClass *klass) widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; +#if !GTK_CHECK_VERSION(3,0,0) parent_class = gtk_type_class(gtk_container_get_type()); +#endif widget_class->realize = gtk_form_realize; widget_class->unrealize = gtk_form_unrealize; widget_class->map = gtk_form_map; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->get_preferred_width = gtk_form_get_preferred_width; + widget_class->get_preferred_height = gtk_form_get_preferred_height; +#else widget_class->size_request = gtk_form_size_request; +#endif widget_class->size_allocate = gtk_form_size_allocate; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->draw = gtk_form_draw; +#else widget_class->expose_event = gtk_form_expose; +#endif container_class->remove = gtk_form_remove; container_class->forall = gtk_form_forall; @@ -239,16 +281,11 @@ gtk_form_class_init(GtkFormClass *klass) static void gtk_form_init(GtkForm *form) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); +#endif form->children = NULL; - - form->width = 1; - form->height = 1; - form->bin_window = NULL; - - form->configure_serial = 0; - form->visibility = GDK_VISIBILITY_PARTIAL; - form->freeze_count = 0; } @@ -267,40 +304,83 @@ gtk_form_realize(GtkWidget *widget) g_return_if_fail(GTK_IS_FORM(widget)); form = GTK_FORM(widget); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_realized(widget, TRUE); +#else GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED); +#endif attributes.window_type = GDK_WINDOW_CHILD; +#if GTK_CHECK_VERSION(3,0,0) + { + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; + } +#else attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; +#endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); +#if GTK_CHECK_VERSION(3,0,0) + attributes.event_mask = GDK_EXPOSURE_MASK; +#else attributes.colormap = gtk_widget_get_colormap(widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; +#endif +#if GTK_CHECK_VERSION(3,0,0) + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; +#else attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; +#endif +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_window(widget, + gdk_window_new(gtk_widget_get_parent_window(widget), + &attributes, attributes_mask)); + gdk_window_set_user_data(gtk_widget_get_window(widget), widget); +#else widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gdk_window_set_user_data(widget->window, widget); +#endif attributes.x = 0; attributes.y = 0; attributes.event_mask = gtk_widget_get_events(widget); +#if GTK_CHECK_VERSION(3,0,0) + form->bin_window = gdk_window_new(gtk_widget_get_window(widget), + &attributes, attributes_mask); +#else form->bin_window = gdk_window_new(widget->window, &attributes, attributes_mask); +#endif gdk_window_set_user_data(form->bin_window, widget); - gtk_form_set_static_gravity(form->bin_window, TRUE); - +#if GTK_CHECK_VERSION(3,0,0) + { + GtkStyleContext * const sctx = gtk_widget_get_style_context(widget); + + gtk_style_context_add_class(sctx, "gtk-form"); + gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL); +# if !GTK_CHECK_VERSION(3,18,0) + gtk_style_context_set_background(sctx, gtk_widget_get_window(widget)); + gtk_style_context_set_background(sctx, form->bin_window); +# endif + } +#else widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background(widget->style, form->bin_window, GTK_STATE_NORMAL); - - gdk_window_add_filter(widget->window, gtk_form_main_filter, form); - gdk_window_add_filter(form->bin_window, gtk_form_filter, form); +#endif for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) { @@ -308,7 +388,11 @@ gtk_form_realize(GtkWidget *widget) gtk_form_attach_child_window(form, child); +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_visible(child->widget)) +#else if (GTK_WIDGET_VISIBLE(child->widget)) +#endif gtk_form_realize_child(form, child); } } @@ -332,17 +416,30 @@ gtk_form_map(GtkWidget *widget) form = GTK_FORM(widget); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_mapped(widget, TRUE); +#else GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_show(gtk_widget_get_window(widget)); +#else gdk_window_show(widget->window); +#endif gdk_window_show(form->bin_window); for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) { GtkFormChild *child = tmp_list->data; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_visible(child->widget) + && !gtk_widget_get_mapped(child->widget)) +#else if (GTK_WIDGET_VISIBLE(child->widget) && !GTK_WIDGET_MAPPED(child->widget)) +#endif gtk_widget_map(child->widget); } } @@ -369,12 +466,21 @@ gtk_form_unrealize(GtkWidget *widget) if (child->window != NULL) { +#if GTK_CHECK_VERSION(3,0,0) + g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), + FUNC2GENERIC(gtk_form_child_map), + child); + g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), + FUNC2GENERIC(gtk_form_child_unmap), + child); +#else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), - GTK_SIGNAL_FUNC(gtk_form_child_map), - child); + GTK_SIGNAL_FUNC(gtk_form_child_map), + child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), - GTK_SIGNAL_FUNC(gtk_form_child_unmap), - child); + GTK_SIGNAL_FUNC(gtk_form_child_unmap), + child); +#endif gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); @@ -385,32 +491,52 @@ gtk_form_unrealize(GtkWidget *widget) tmp_list = tmp_list->next; } +#if GTK_CHECK_VERSION(3,0,0) + if (GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) + (* GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (widget); +#else if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); +#endif } static void gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition) { - GList *tmp_list; - GtkForm *form; - g_return_if_fail(GTK_IS_FORM(widget)); + g_return_if_fail(requisition != NULL); - form = GTK_FORM(widget); + requisition->width = 1; + requisition->height = 1; +} - requisition->width = form->width; - requisition->height = form->height; +#if GTK_CHECK_VERSION(3,0,0) + static void +gtk_form_get_preferred_width(GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; - tmp_list = form->children; + gtk_form_size_request(widget, &requisition); - while (tmp_list) - { - GtkFormChild *child = tmp_list->data; - gtk_widget_size_request(child->widget, NULL); - tmp_list = tmp_list->next; - } + *minimal_width = requisition.width; + *natural_width = requisition.width; +} + + static void +gtk_form_get_preferred_height(GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + + gtk_form_size_request(widget, &requisition); + + *minimal_height = requisition.height; + *natural_height = requisition.height; } +#endif /* GTK_CHECK_VERSION(3,0,0) */ static void gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) @@ -418,17 +544,34 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) GList *tmp_list; GtkForm *form; gboolean need_reposition; +#if GTK_CHECK_VERSION(3,0,0) + GtkAllocation cur_alloc; +#endif g_return_if_fail(GTK_IS_FORM(widget)); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_allocation(widget, &cur_alloc); + + if (cur_alloc.x == allocation->x + && cur_alloc.y == allocation->y + && cur_alloc.width == allocation->width + && cur_alloc.height == allocation->height) +#else if (widget->allocation.x == allocation->x && widget->allocation.y == allocation->y && widget->allocation.width == allocation->width && widget->allocation.height == allocation->height) +#endif return; +#if GTK_CHECK_VERSION(3,0,0) + need_reposition = cur_alloc.width != allocation->width + || cur_alloc.height != allocation->height; +#else need_reposition = widget->allocation.width != allocation->width || widget->allocation.height != allocation->height; +#endif form = GTK_FORM(widget); if (need_reposition) @@ -444,20 +587,81 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) } } +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_realized(widget)) +#else if (GTK_WIDGET_REALIZED(widget)) +#endif { +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_move_resize(gtk_widget_get_window(widget), + allocation->x, allocation->y, + allocation->width, allocation->height); +#else gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); +#endif gdk_window_move_resize(GTK_FORM(widget)->bin_window, 0, 0, allocation->width, allocation->height); } +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_allocation(widget, allocation); +#else widget->allocation = *allocation; +#endif if (need_reposition) gtk_form_send_configure(form); } +#if GTK_CHECK_VERSION(3,0,0) + static void +gtk_form_render_background(GtkWidget *widget, cairo_t *cr) +{ + gtk_render_background(gtk_widget_get_style_context(widget), cr, + 0, 0, + gtk_widget_get_allocated_width(widget), + gtk_widget_get_allocated_height(widget)); +} + + static gboolean +gtk_form_draw(GtkWidget *widget, cairo_t *cr) +{ + GList *tmp_list = NULL; + GtkForm *form = NULL; + + g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); + + gtk_form_render_background(widget, cr); + + form = GTK_FORM(widget); + for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) + { + GtkFormChild * const formchild = tmp_list->data; + + if (!gtk_widget_get_has_window(formchild->widget) && + gtk_cairo_should_draw_window(cr, formchild->window)) + { + /* To get gtk_widget_draw() to work, it is required to call + * gtk_widget_size_allocate() in advance with a well-posed + * allocation for a given child widget in order to set a + * certain private GtkWidget variable, called + * widget->priv->alloc_need, to the proper value; othewise, + * gtk_widget_draw() fails and the relevant scrollbar won't + * appear on the screen. + * + * Calling gtk_form_position_child() like this is one of ways + * to make sure of that. */ + gtk_form_position_child(form, formchild, TRUE); + + gtk_form_render_background(formchild->widget, cr); + } + } + + return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); +} +#else /* !GTK_CHECK_VERSION(3,0,0) */ static gint gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -472,31 +676,13 @@ gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) return FALSE; for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) - { - GtkFormChild *formchild = tmp_list->data; - GtkWidget *child = formchild->widget; - /* - * The following chunk of code is taken from gtkcontainer.c. The - * gtk1.x code synthesized expose events directly on the child widgets, - * which can't be done in gtk2 - */ - if (GTK_WIDGET_DRAWABLE(child) && GTK_WIDGET_NO_WINDOW(child) - && child->window == event->window) - { - GdkEventExpose child_event; - child_event = *event; - - child_event.region = gtk_widget_region_intersect(child, event->region); - if (!gdk_region_empty(child_event.region)) - { - gdk_region_get_clipbox(child_event.region, &child_event.area); - gtk_widget_send_expose(child, (GdkEvent *)&child_event); - } - } - } + gtk_container_propagate_expose(GTK_CONTAINER(widget), + GTK_WIDGET(((GtkFormChild *)tmp_list->data)->widget), + event); return FALSE; } +#endif /* !GTK_CHECK_VERSION(3,0,0) */ /* Container method */ @@ -522,12 +708,22 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget) if (tmp_list) { +#if GTK_CHECK_VERSION(3,0,0) + const gboolean was_visible = gtk_widget_get_visible(widget); +#endif if (child->window) { +#if GTK_CHECK_VERSION(3,0,0) + g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), + FUNC2GENERIC(>k_form_child_map), child); + g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), + FUNC2GENERIC(>k_form_child_unmap), child); +#else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), - GTK_SIGNAL_FUNC(>k_form_child_map), child); + GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), - GTK_SIGNAL_FUNC(>k_form_child_unmap), child); + GTK_SIGNAL_FUNC(>k_form_child_unmap), child); +#endif /* FIXME: This will cause problems for reparenting NO_WINDOW * widgets out of a GtkForm @@ -536,7 +732,10 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget) gdk_window_destroy(child->window); } gtk_widget_unparent(widget); - +#if GTK_CHECK_VERSION(3,0,0) + if (was_visible) + gtk_widget_queue_resize(GTK_WIDGET(container)); +#endif form->children = g_list_remove_link(form->children, tmp_list); g_list_free_1(tmp_list); g_free(child); @@ -577,7 +776,11 @@ gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) if (child->window != NULL) return; /* been there, done that */ +#if GTK_CHECK_VERSION(3,0,0) + if (!gtk_widget_get_has_window(child->widget)) +#else if (GTK_WIDGET_NO_WINDOW(child->widget)) +#endif { GtkWidget *widget; GdkWindowAttr attributes; @@ -588,34 +791,72 @@ gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) attributes.window_type = GDK_WINDOW_CHILD; attributes.x = child->x; attributes.y = child->y; +#if GTK_CHECK_VERSION(3,0,0) + { + GtkRequisition requisition; + + gtk_widget_get_preferred_size(child->widget, &requisition, NULL); + + attributes.width = requisition.width; + attributes.height = requisition.height; + } +#else attributes.width = child->widget->requisition.width; attributes.height = child->widget->requisition.height; +#endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); +#if !GTK_CHECK_VERSION(3,0,0) attributes.colormap = gtk_widget_get_colormap(widget); +#endif attributes.event_mask = GDK_EXPOSURE_MASK; +#if GTK_CHECK_VERSION(3,0,0) + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; +#else attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; +#endif child->window = gdk_window_new(form->bin_window, &attributes, attributes_mask); gdk_window_set_user_data(child->window, widget); +#if GTK_CHECK_VERSION(3,0,0) + { + GtkStyleContext * const sctx = gtk_widget_get_style_context(widget); + + gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL); +# if !GTK_CHECK_VERSION(3,18,0) + gtk_style_context_set_background(sctx, child->window); +# endif + } +#else gtk_style_set_background(widget->style, child->window, GTK_STATE_NORMAL); +#endif gtk_widget_set_parent_window(child->widget, child->window); - gtk_form_set_static_gravity(child->window, TRUE); /* * Install signal handlers to map/unmap child->window * alongside with the actual widget. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(child->widget), "map", + G_CALLBACK(>k_form_child_map), child); + g_signal_connect(G_OBJECT(child->widget), "unmap", + G_CALLBACK(>k_form_child_unmap), child); +#else gtk_signal_connect(GTK_OBJECT(child->widget), "map", GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_connect(GTK_OBJECT(child->widget), "unmap", GTK_SIGNAL_FUNC(>k_form_child_unmap), child); +#endif } +#if GTK_CHECK_VERSION(3,0,0) + else if (!gtk_widget_get_realized(child->widget)) +#else else if (!GTK_WIDGET_REALIZED(child->widget)) +#endif { gtk_widget_set_parent_window(child->widget, form->bin_window); } @@ -626,9 +867,6 @@ gtk_form_realize_child(GtkForm *form, GtkFormChild *child) { gtk_form_attach_child_window(form, child); gtk_widget_realize(child->widget); - - if (child->window == NULL) /* might be already set, see above */ - gtk_form_set_static_gravity(child->widget->window, TRUE); } static void @@ -646,9 +884,18 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child, { if (!child->mapped) { +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_mapped(GTK_WIDGET(form)) + && gtk_widget_get_visible(child->widget)) +#else if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget)) +#endif { +#if GTK_CHECK_VERSION(3,0,0) + if (!gtk_widget_get_mapped(child->widget)) +#else if (!GTK_WIDGET_MAPPED(child->widget)) +#endif gtk_widget_map(child->widget); child->mapped = TRUE; @@ -659,15 +906,31 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child, if (force_allocate) { GtkAllocation allocation; +#if GTK_CHECK_VERSION(3,0,0) + GtkRequisition requisition; + + gtk_widget_get_preferred_size(child->widget, &requisition, NULL); +#endif +#if GTK_CHECK_VERSION(3,0,0) + if (!gtk_widget_get_has_window(child->widget)) +#else if (GTK_WIDGET_NO_WINDOW(child->widget)) +#endif { if (child->window) { +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_move_resize(child->window, + x, y, + requisition.width, + requisition.height); +#else gdk_window_move_resize(child->window, x, y, child->widget->requisition.width, child->widget->requisition.height); +#endif } allocation.x = 0; @@ -679,8 +942,13 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child, allocation.y = y; } +#if GTK_CHECK_VERSION(3,0,0) + allocation.width = requisition.width; + allocation.height = requisition.height; +#else allocation.width = child->widget->requisition.width; allocation.height = child->widget->requisition.height; +#endif gtk_widget_size_allocate(child->widget, &allocation); } @@ -691,7 +959,11 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child, { child->mapped = FALSE; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_mapped(child->widget)) +#else if (GTK_WIDGET_MAPPED(child->widget)) +#endif gtk_widget_unmap(child->widget); } } @@ -706,98 +978,16 @@ gtk_form_position_children(GtkForm *form) gtk_form_position_child(form, tmp_list->data, FALSE); } -/* Callbacks */ - -/* The main event filter. Actually, we probably don't really need - * to install this as a filter at all, since we are calling it - * directly above in the expose-handling hack. - * - * This routine identifies expose events that are generated when - * we've temporarily moved the bin_window_origin, and translates - * them or discards them, depending on whether we are obscured - * or not. - */ - static GdkFilterReturn -gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event UNUSED, gpointer data) -{ - XEvent *xevent; - GtkForm *form; - - xevent = (XEvent *) gdk_xevent; - form = GTK_FORM(data); - - switch (xevent->type) - { - case Expose: - if (xevent->xexpose.serial == form->configure_serial) - { - if (form->visibility == GDK_VISIBILITY_UNOBSCURED) - return GDK_FILTER_REMOVE; - else - break; - } - break; - - case ConfigureNotify: - if ((xevent->xconfigure.x != 0) || (xevent->xconfigure.y != 0)) - form->configure_serial = xevent->xconfigure.serial; - break; - } - - return GDK_FILTER_CONTINUE; -} - -/* Although GDK does have a GDK_VISIBILITY_NOTIFY event, - * there is no corresponding event in GTK, so we have - * to get the events from a filter - */ - static GdkFilterReturn -gtk_form_main_filter(GdkXEvent *gdk_xevent, - GdkEvent *event UNUSED, - gpointer data) -{ - XEvent *xevent; - GtkForm *form; - - xevent = (XEvent *) gdk_xevent; - form = GTK_FORM(data); - - if (xevent->type == VisibilityNotify) - { - switch (xevent->xvisibility.state) - { - case VisibilityFullyObscured: - form->visibility = GDK_VISIBILITY_FULLY_OBSCURED; - break; - - case VisibilityPartiallyObscured: - form->visibility = GDK_VISIBILITY_PARTIAL; - break; - - case VisibilityUnobscured: - form->visibility = GDK_VISIBILITY_UNOBSCURED; - break; - } - - return GDK_FILTER_REMOVE; - } - return GDK_FILTER_CONTINUE; -} - - static void -gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static) -{ - /* We don't check if static gravity is actually supported, because it - * results in an annoying assertion error message. */ - gdk_window_set_static_gravities(window, use_static); -} - void gtk_form_move_resize(GtkForm *form, GtkWidget *widget, gint x, gint y, gint w, gint h) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_size_request(widget, w, h); +#else widget->requisition.width = w; widget->requisition.height = h; +#endif gtk_form_move(form, widget, x, y); } @@ -811,11 +1001,24 @@ gtk_form_send_configure(GtkForm *form) widget = GTK_WIDGET(form); event.type = GDK_CONFIGURE; +#if GTK_CHECK_VERSION(3,0,0) + event.window = gtk_widget_get_window(widget); + { + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + event.x = allocation.x; + event.y = allocation.y; + event.width = allocation.width; + event.height = allocation.height; + } +#else event.window = widget->window; event.x = widget->allocation.x; event.y = widget->allocation.y; event.width = widget->allocation.width; event.height = widget->allocation.height; +#endif gtk_main_do_event((GdkEvent*)&event); } @@ -841,4 +1044,3 @@ gtk_form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data) child->mapped = FALSE; gdk_window_hide(child->window); } - diff --git a/src/gui_gtk_f.h b/src/gui_gtk_f.h index 73b0024f8c..be7693a4da 100644 --- a/src/gui_gtk_f.h +++ b/src/gui_gtk_f.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -9,8 +9,12 @@ #ifndef __GTK_FORM_H__ #define __GTK_FORM_H__ +#ifdef USE_GTK3 +#include <gtk/gtk.h> +#else #include <gdk/gdk.h> #include <gtk/gtkcontainer.h> +#endif #ifdef __cplusplus @@ -18,10 +22,17 @@ extern "C" { #endif #define GTK_TYPE_FORM (gtk_form_get_type ()) +#ifdef USE_GTK3 +#define GTK_FORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FORM, GtkForm)) +#define GTK_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FORM, GtkFormClass)) +#define GTK_IS_FORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FORM)) +#define GTK_IS_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FORM)) +#else #define GTK_FORM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FORM, GtkForm)) #define GTK_FORM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FORM, GtkFormClass)) #define GTK_IS_FORM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FORM)) #define GTK_IS_FORM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FORM)) +#endif typedef struct _GtkForm GtkForm; @@ -32,15 +43,7 @@ struct _GtkForm GtkContainer container; GList *children; - - guint width; - guint height; - GdkWindow *bin_window; - - GdkVisibilityState visibility; - gulong configure_serial; - gint freeze_count; }; @@ -49,7 +52,11 @@ struct _GtkFormClass GtkContainerClass parent_class; }; +#ifdef USE_GTK3 +GType gtk_form_get_type(void); +#else GtkType gtk_form_get_type(void); +#endif GtkWidget *gtk_form_new(void); diff --git a/src/gui_gtk_res.xml b/src/gui_gtk_res.xml new file mode 100644 index 0000000000..d6c7a592b4 --- /dev/null +++ b/src/gui_gtk_res.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/vim/gui/icon"> + <file>stock_vim_build_tags.png</file> + <file>stock_vim_find_help.png</file> + <file>stock_vim_save_all.png</file> + <file>stock_vim_session_load.png</file> + <file>stock_vim_session_new.png</file> + <file>stock_vim_session_save.png</file> + <file>stock_vim_shell.png</file> + <file>stock_vim_window_maximize.png</file> + <file>stock_vim_window_maximize_width.png</file> + <file>stock_vim_window_minimize.png</file> + <file>stock_vim_window_minimize_width.png</file> + <file>stock_vim_window_split.png</file> + <file>stock_vim_window_split_vertical.png</file> + </gresource> +</gresources> diff --git a/src/gui_gtk_vms.h b/src/gui_gtk_vms.h index 4109e2d1fc..268c9f30e4 100644 --- a/src/gui_gtk_vms.h +++ b/src/gui_gtk_vms.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 97ad6b0689..9c7e8d5648 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,9 +19,16 @@ * * (C) 2002,2003 Jason Hildebrand <jason@peaceworks.ca> * Daniel Elstner <daniel.elstner@gmx.net> + * + * Support for GTK+ 3 was added by: + * + * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> */ #include "vim.h" +#ifdef USE_GRESOURCE +#include "auto/gui_gtk_gresources.h" +#endif #ifdef FEAT_GUI_GNOME /* Gnome redefines _() and N_(). Grrr... */ @@ -72,14 +79,18 @@ extern void bonobo_dock_item_set_behavior(BonoboDockItem *dock_item, BonoboDockI # define GdkEventConfigure int # define GdkEventClient int #else -# include <gdk/gdkkeysyms.h> +# if GTK_CHECK_VERSION(3,0,0) +# include <gdk/gdkkeysyms-compat.h> +# include <gtk/gtkx.h> +# else +# include <gdk/gdkkeysyms.h> +# endif # include <gdk/gdk.h> # ifdef WIN3264 # include <gdk/gdkwin32.h> # else # include <gdk/gdkx.h> # endif - # include <gtk/gtk.h> # include "gui_gtk_f.h" #endif @@ -91,12 +102,8 @@ extern void bonobo_dock_item_set_behavior(BonoboDockItem *dock_item, BonoboDockI /* * Easy-to-use macro for multihead support. */ -#ifdef HAVE_GTK_MULTIHEAD -# define GET_X_ATOM(atom) gdk_x11_atom_to_xatom_for_display( \ +#define GET_X_ATOM(atom) gdk_x11_atom_to_xatom_for_display( \ gtk_widget_get_display(gui.mainwin), atom) -#else -# define GET_X_ATOM(atom) ((Atom)(atom)) -#endif /* Selection type distinguishers */ enum @@ -531,8 +538,10 @@ gui_mch_prepare(int *argc, char **argv) } /* These arguments make gnome_program_init() print a message and exit. - * Must start the GUI for this, otherwise ":gui" will exit later! */ - if (option->flags & ARG_NEEDS_GUI) + * Must start the GUI for this, otherwise ":gui" will exit later! + * Only when the GUI can start. */ + if ((option->flags & ARG_NEEDS_GUI) + && gui_mch_early_init_check(FALSE) == OK) gui.starting = TRUE; if (option->flags & ARG_KEEP) @@ -568,7 +577,7 @@ gui_mch_prepare(int *argc, char **argv) #if defined(EXITFREE) || defined(PROTO) void -gui_mch_free_all() +gui_mch_free_all(void) { vim_free(gui_argv); #if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION) @@ -577,6 +586,7 @@ gui_mch_free_all() } #endif +#if !GTK_CHECK_VERSION(3,0,0) /* * This should be maybe completely removed. * Doesn't seem possible, since check_copy_area() relies on @@ -598,10 +608,122 @@ visibility_event(GtkWidget *widget UNUSED, gui.visibility != GDK_VISIBILITY_UNOBSCURED); return FALSE; } +#endif /* !GTK_CHECK_VERSION(3,0,0) */ /* * Redraw the corresponding portions of the screen. */ +#if GTK_CHECK_VERSION(3,0,0) +static gboolean is_key_pressed = FALSE; +static gboolean blink_mode = TRUE; + +static gboolean gui_gtk_is_blink_on(void); +static void gui_gtk_window_clear(GdkWindow *win); + + static void +gui_gtk3_redraw(int x, int y, int width, int height) +{ + /* Range checks are left to gui_redraw_block() */ + gui_redraw_block(Y_2_ROW(y), X_2_COL(x), + Y_2_ROW(y + height - 1), X_2_COL(x + width - 1), + GUI_MON_NOCLEAR); +} + + static void +gui_gtk3_update_cursor(cairo_t *cr) +{ + if (gui.row == gui.cursor_row) + { + gui.by_signal = TRUE; + if (State & CMDLINE) + gui_update_cursor(TRUE, FALSE); + else + gui_update_cursor(TRUE, TRUE); + gui.by_signal = FALSE; + cairo_paint(cr); + } +} + + static gboolean +gui_gtk3_should_draw_cursor(void) +{ + unsigned int cond = 0; + cond |= gui_gtk_is_blink_on(); + if (gui.cursor_col >= gui.col) + cond |= is_key_pressed; + cond |= gui.in_focus == FALSE; + return cond; +} + + static gboolean +draw_event(GtkWidget *widget UNUSED, + cairo_t *cr, + gpointer user_data UNUSED) +{ + /* Skip this when the GUI isn't set up yet, will redraw later. */ + if (gui.starting) + return FALSE; + + out_flush(); /* make sure all output has been processed */ + /* for GTK+ 3, may induce other draw events. */ + + cairo_set_source_surface(cr, gui.surface, 0, 0); + + /* Draw the window without the cursor. */ + gui.by_signal = TRUE; + { + cairo_rectangle_list_t *list = NULL; + + list = cairo_copy_clip_rectangle_list(cr); + if (list->status != CAIRO_STATUS_CLIP_NOT_REPRESENTABLE) + { + int i; + + /* First clear all the blocks and then redraw them. Just in case + * some blocks overlap. */ + for (i = 0; i < list->num_rectangles; i++) + { + const cairo_rectangle_t rect = list->rectangles[i]; + + gui_mch_clear_block(Y_2_ROW((int)rect.y), 0, + Y_2_ROW((int)(rect.y + rect.height)) - 1, Columns - 1); + } + + for (i = 0; i < list->num_rectangles; i++) + { + const cairo_rectangle_t rect = list->rectangles[i]; + + if (blink_mode) + gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height); + else + { + if (get_real_state() & VISUAL) + gui_gtk3_redraw(rect.x, rect.y, + rect.width, rect.height); + else + gui_redraw(rect.x, rect.y, rect.width, rect.height); + } + } + } + cairo_rectangle_list_destroy(list); + + if (get_real_state() & VISUAL) + { + if (gui.cursor_row == gui.row && gui.cursor_col >= gui.col) + gui_update_cursor(TRUE, TRUE); + } + + cairo_paint(cr); + } + gui.by_signal = FALSE; + + /* Add the cursor to the window if necessary.*/ + if (gui_gtk3_should_draw_cursor() && blink_mode) + gui_gtk3_update_cursor(cr); + + return FALSE; +} +#else /* !GTK_CHECK_VERSION(3,0,0) */ static gint expose_event(GtkWidget *widget UNUSED, GdkEventExpose *event, @@ -628,6 +750,7 @@ expose_event(GtkWidget *widget UNUSED, return FALSE; } +#endif /* !GTK_CHECK_VERSION(3,0,0) */ #ifdef FEAT_CLIENTSERVER /* @@ -640,7 +763,11 @@ property_event(GtkWidget *widget, { if (event->type == GDK_PROPERTY_NOTIFY && event->state == (int)GDK_PROPERTY_NEW_VALUE +# if GTK_CHECK_VERSION(3,0,0) + && GDK_WINDOW_XID(event->window) == commWindow +# else && GDK_WINDOW_XWINDOW(event->window) == commWindow +# endif && GET_X_ATOM(event->atom) == commProperty) { XEvent xev; @@ -650,11 +777,47 @@ property_event(GtkWidget *widget, xev.xproperty.atom = commProperty; xev.xproperty.window = commWindow; xev.xproperty.state = PropertyNewValue; - serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev); +# if GTK_CHECK_VERSION(3,0,0) + serverEventProc(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)), + &xev, 0); +# else + serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev, 0); +# endif } return FALSE; } +#endif /* defined(FEAT_CLIENTSERVER) */ + + +#if GTK_CHECK_VERSION(3,0,0) +typedef gboolean timeout_cb_type; +#else +typedef gint timeout_cb_type; +#endif + +/* + * Start a timer that will invoke the specified callback. + * Returns the ID of the timer. + */ + static guint +timeout_add(int time, timeout_cb_type (*callback)(gpointer), int *flagp) +{ +#if GTK_CHECK_VERSION(3,0,0) + return g_timeout_add((guint)time, (GSourceFunc)callback, flagp); +#else + return gtk_timeout_add((guint32)time, (GtkFunction)callback, flagp); +#endif +} + + static void +timeout_remove(guint timer) +{ +#if GTK_CHECK_VERSION(3,0,0) + g_source_remove(timer); +#else + gtk_timeout_remove(timer); #endif +} /**************************************************************************** @@ -679,47 +842,88 @@ static long_u blink_ontime = 400; static long_u blink_offtime = 250; static guint blink_timer = 0; +#if GTK_CHECK_VERSION(3,0,0) + static gboolean +gui_gtk_is_blink_on(void) +{ + return blink_state == BLINK_ON; +} +#endif + + int +gui_mch_is_blinking(void) +{ + return blink_state != BLINK_NONE; +} + + int +gui_mch_is_blink_off(void) +{ + return blink_state == BLINK_OFF; +} + void gui_mch_set_blinking(long waittime, long on, long off) { +#if GTK_CHECK_VERSION(3,0,0) + if (waittime == 0 || on == 0 || off == 0) + { + blink_mode = FALSE; + + blink_waittime = 700; + blink_ontime = 400; + blink_offtime = 250; + } + else + { + blink_mode = TRUE; + + blink_waittime = waittime; + blink_ontime = on; + blink_offtime = off; + } +#else blink_waittime = waittime; blink_ontime = on; blink_offtime = off; +#endif } /* * Stop the cursor blinking. Show the cursor if it wasn't shown. */ void -gui_mch_stop_blink(void) +gui_mch_stop_blink(int may_call_gui_update_cursor) { if (blink_timer) { - gtk_timeout_remove(blink_timer); + timeout_remove(blink_timer); blink_timer = 0; } - if (blink_state == BLINK_OFF) + if (blink_state == BLINK_OFF && may_call_gui_update_cursor) + { gui_update_cursor(TRUE, FALSE); + gui_mch_flush(); + } blink_state = BLINK_NONE; } - static gint + static timeout_cb_type blink_cb(gpointer data UNUSED) { if (blink_state == BLINK_ON) { gui_undraw_cursor(); blink_state = BLINK_OFF; - blink_timer = gtk_timeout_add((guint32)blink_offtime, - (GtkFunction) blink_cb, NULL); + blink_timer = timeout_add(blink_offtime, blink_cb, NULL); } else { gui_update_cursor(TRUE, FALSE); blink_state = BLINK_ON; - blink_timer = gtk_timeout_add((guint32)blink_ontime, - (GtkFunction) blink_cb, NULL); + blink_timer = timeout_add(blink_ontime, blink_cb, NULL); } + gui_mch_flush(); return FALSE; /* don't happen again */ } @@ -733,16 +937,16 @@ gui_mch_start_blink(void) { if (blink_timer) { - gtk_timeout_remove(blink_timer); + timeout_remove(blink_timer); blink_timer = 0; } /* Only switch blinking on if none of the times is zero */ if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { - blink_timer = gtk_timeout_add((guint32)blink_waittime, - (GtkFunction) blink_cb, NULL); + blink_timer = timeout_add(blink_waittime, blink_cb, NULL); blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); + gui_mch_flush(); } } @@ -755,7 +959,11 @@ enter_notify_event(GtkWidget *widget UNUSED, gui_mch_start_blink(); /* make sure keyboard input goes there */ +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_socket_id == 0 || !gtk_widget_has_focus(gui.drawarea)) +#else if (gtk_socket_id == 0 || !GTK_WIDGET_HAS_FOCUS(gui.drawarea)) +#endif gtk_widget_grab_focus(gui.drawarea); return FALSE; @@ -767,7 +975,7 @@ leave_notify_event(GtkWidget *widget UNUSED, gpointer data UNUSED) { if (blink_state != BLINK_NONE) - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); return FALSE; } @@ -798,7 +1006,7 @@ focus_out_event(GtkWidget *widget UNUSED, gui_focus_change(FALSE); if (blink_state != BLINK_NONE) - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); return TRUE; } @@ -935,6 +1143,11 @@ key_press_event(GtkWidget *widget UNUSED, guint state; char_u *s, *d; +#if GTK_CHECK_VERSION(3,0,0) + is_key_pressed = TRUE; + gui_mch_stop_blink(TRUE); +#endif + gui.event_time = event->time; key_sym = event->keyval; state = event->state; @@ -1124,12 +1337,17 @@ key_press_event(GtkWidget *widget UNUSED, return TRUE; } -#if defined(FEAT_XIM) +#if defined(FEAT_XIM) || GTK_CHECK_VERSION(3,0,0) static gboolean key_release_event(GtkWidget *widget UNUSED, GdkEventKey *event, gpointer data UNUSED) { +# if GTK_CHECK_VERSION(3,0,0) + is_key_pressed = FALSE; + gui_mch_start_blink(); +# endif +# if defined(FEAT_XIM) gui.event_time = event->time; /* * GTK+ 2 input methods may do fancy stuff on key release events too. @@ -1137,6 +1355,9 @@ key_release_event(GtkWidget *widget UNUSED, * by holding down CTRL-SHIFT and typing hexadecimal digits. */ return xim_queue_key_press_event(event, FALSE); +# else + return TRUE; +# endif } #endif @@ -1145,15 +1366,21 @@ key_release_event(GtkWidget *widget UNUSED, * Selection handlers: */ +/* Remember when clip_lose_selection was called from here, we must not call + * gtk_selection_owner_set() then. */ +static int in_selection_clear_event = FALSE; + static gint selection_clear_event(GtkWidget *widget UNUSED, GdkEventSelection *event, gpointer user_data UNUSED) { + in_selection_clear_event = TRUE; if (event->selection == clip_plus.gtk_sel_atom) clip_lose_selection(&clip_plus); else clip_lose_selection(&clip_star); + in_selection_clear_event = FALSE; return TRUE; } @@ -1176,13 +1403,22 @@ selection_received_cb(GtkWidget *widget UNUSED, int len; int motion_type = MAUTO; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_selection_data_get_selection(data) == clip_plus.gtk_sel_atom) +#else if (data->selection == clip_plus.gtk_sel_atom) +#endif cbd = &clip_plus; else cbd = &clip_star; +#if GTK_CHECK_VERSION(3,0,0) + text = (char_u *)gtk_selection_data_get_data(data); + len = gtk_selection_data_get_length(data); +#else text = (char_u *)data->data; len = data->length; +#endif if (text == NULL || len <= 0) { @@ -1192,13 +1428,20 @@ selection_received_cb(GtkWidget *widget UNUSED, return; } +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_selection_data_get_data_type(data) == vim_atom) +#else if (data->type == vim_atom) +#endif { motion_type = *text++; --len; } - +#if GTK_CHECK_VERSION(3,0,0) + else if (gtk_selection_data_get_data_type(data) == vimenc_atom) +#else else if (data->type == vimenc_atom) +#endif { char_u *enc; vimconv_T conv; @@ -1289,7 +1532,12 @@ selection_get_cb(GtkWidget *widget UNUSED, GdkAtom type; VimClipboard *cbd; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_selection_data_get_selection(selection_data) + == clip_plus.gtk_sel_atom) +#else if (selection_data->selection == clip_plus.gtk_sel_atom) +#endif cbd = &clip_plus; else cbd = &clip_star; @@ -1358,8 +1606,12 @@ selection_get_cb(GtkWidget *widget UNUSED, string = tmpbuf; length += 2; +#if !GTK_CHECK_VERSION(3,0,0) + /* Looks redundant even for GTK2 because these values are + * overwritten by gtk_selection_data_set() that follows. */ selection_data->type = selection_data->target; selection_data->format = 16; /* 16 bits per char */ +#endif gtk_selection_data_set(selection_data, html_atom, 16, string, length); vim_free(string); @@ -1408,9 +1660,12 @@ selection_get_cb(GtkWidget *widget UNUSED, if (string != NULL) { +#if !GTK_CHECK_VERSION(3,0,0) + /* Looks redundant even for GTK2 because these values are + * overwritten by gtk_selection_data_set() that follows. */ selection_data->type = selection_data->target; selection_data->format = 8; /* 8 bits per char */ - +#endif gtk_selection_data_set(selection_data, type, 8, string, length); vim_free(string); } @@ -1422,7 +1677,7 @@ selection_get_cb(GtkWidget *widget UNUSED, * Return OK or FAIL. */ int -gui_mch_early_init_check(void) +gui_mch_early_init_check(int give_message) { char_u *p; @@ -1431,7 +1686,8 @@ gui_mch_early_init_check(void) if (p == NULL || *p == NUL) { gui.dying = TRUE; - EMSG(_((char *)e_opendisp)); + if (give_message) + EMSG(_((char *)e_opendisp)); return FAIL; } return OK; @@ -1445,6 +1701,24 @@ gui_mch_early_init_check(void) int gui_mch_init_check(void) { +#ifdef USE_GRESOURCE + static int res_registered = FALSE; + + if (!res_registered) + { + /* Call this function in the GUI process; otherwise, the resources + * won't be available. Don't call it twice. */ + res_registered = TRUE; + gui_gtk_register_resource(); + } +#endif + +#if GTK_CHECK_VERSION(3,10,0) + /* Vim currently assumes that Gtk means X11, so it cannot use native Gtk + * support for other backends such as Wayland. */ + gdk_set_allowed_backends ("x11"); +#endif + #ifdef FEAT_GUI_GNOME if (gtk_socket_id == 0) using_gnome = 1; @@ -1466,7 +1740,6 @@ gui_mch_init_check(void) return OK; } - /**************************************************************************** * Mouse handling callbacks */ @@ -1478,7 +1751,7 @@ static int mouse_timed_out = TRUE; /* * Timer used to recognize multiple clicks of the mouse button */ - static gint + static timeout_cb_type mouse_click_timer_cb(gpointer data) { /* we don't use this information currently */ @@ -1488,15 +1761,18 @@ mouse_click_timer_cb(gpointer data) return FALSE; /* don't happen again */ } -static guint motion_repeat_timer = 0; -static int motion_repeat_offset = FALSE; -static gint motion_repeat_timer_cb(gpointer); +static guint motion_repeat_timer = 0; +static int motion_repeat_offset = FALSE; +static timeout_cb_type motion_repeat_timer_cb(gpointer); static void process_motion_notify(int x, int y, GdkModifierType state) { int button; int_u vim_modifiers; +#if GTK_CHECK_VERSION(3,0,0) + GtkAllocation allocation; +#endif button = (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | @@ -1523,9 +1799,17 @@ process_motion_notify(int x, int y, GdkModifierType state) /* * Auto repeat timer handling. */ +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_allocation(gui.drawarea, &allocation); + + if (x < 0 || y < 0 + || x >= allocation.width + || y >= allocation.height) +#else if (x < 0 || y < 0 || x >= gui.drawarea->allocation.width || y >= gui.drawarea->allocation.height) +#endif { int dx; @@ -1536,8 +1820,13 @@ process_motion_notify(int x, int y, GdkModifierType state) /* Calculate the maximal distance of the cursor from the drawing area. * (offshoot can't become negative here!). */ +#if GTK_CHECK_VERSION(3,0,0) + dx = x < 0 ? -x : x - allocation.width; + dy = y < 0 ? -y : y - allocation.height; +#else dx = x < 0 ? -x : x - gui.drawarea->allocation.width; dy = y < 0 ? -y : y - gui.drawarea->allocation.height; +#endif offshoot = dx > dy ? dx : dy; @@ -1562,22 +1851,64 @@ process_motion_notify(int x, int y, GdkModifierType state) /* shoot again */ if (!motion_repeat_timer) - motion_repeat_timer = gtk_timeout_add((guint32)delay, - motion_repeat_timer_cb, NULL); + motion_repeat_timer = timeout_add(delay, motion_repeat_timer_cb, + NULL); } } +#if GTK_CHECK_VERSION(3,0,0) + static GdkDevice * +gui_gtk_get_pointer_device(GtkWidget *widget) +{ + GdkWindow * const win = gtk_widget_get_window(widget); + GdkDisplay * const dpy = gdk_window_get_display(win); +# if GTK_CHECK_VERSION(3,20,0) + GdkSeat * const seat = gdk_display_get_default_seat(dpy); + return gdk_seat_get_pointer(seat); +# else + GdkDeviceManager * const mngr = gdk_display_get_device_manager(dpy); + return gdk_device_manager_get_client_pointer(mngr); +# endif +} + + static GdkWindow * +gui_gtk_get_pointer(GtkWidget *widget, + gint *x, + gint *y, + GdkModifierType *state) +{ + GdkWindow * const win = gtk_widget_get_window(widget); + GdkDevice * const dev = gui_gtk_get_pointer_device(widget); + return gdk_window_get_device_position(win, dev , x, y, state); +} + +# if defined(FEAT_GUI_TABLINE) || defined(PROTO) + static GdkWindow * +gui_gtk_window_at_position(GtkWidget *widget, + gint *x, + gint *y) +{ + GdkDevice * const dev = gui_gtk_get_pointer_device(widget); + return gdk_device_get_window_at_position(dev, x, y); +} +# endif +#endif + /* * Timer used to recognize multiple clicks of the mouse button. */ - static gint + static timeout_cb_type motion_repeat_timer_cb(gpointer data UNUSED) { int x; int y; GdkModifierType state; +#if GTK_CHECK_VERSION(3,0,0) + gui_gtk_get_pointer(gui.drawarea, &x, &y, &state); +#else gdk_window_get_pointer(gui.drawarea->window, &x, &y, &state); +#endif if (!(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | @@ -1622,7 +1953,11 @@ motion_notify_event(GtkWidget *widget, int y; GdkModifierType state; +#if GTK_CHECK_VERSION(3,0,0) + gui_gtk_get_pointer(widget, &x, &y, &state); +#else gdk_window_get_pointer(widget->window, &x, &y, &state); +#endif process_motion_notify(x, y, state); } else @@ -1653,7 +1988,11 @@ button_press_event(GtkWidget *widget, gui.event_time = event->time; /* Make sure we have focus now we've been selected */ +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget)) +#else if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget)) +#endif gtk_widget_grab_focus(widget); /* @@ -1669,28 +2008,26 @@ button_press_event(GtkWidget *widget, /* Handle multiple clicks */ if (!mouse_timed_out && mouse_click_timer) { - gtk_timeout_remove(mouse_click_timer); + timeout_remove(mouse_click_timer); mouse_click_timer = 0; repeated_click = TRUE; } mouse_timed_out = FALSE; - mouse_click_timer = gtk_timeout_add((guint32)p_mouset, - mouse_click_timer_cb, &mouse_timed_out); + mouse_click_timer = timeout_add(p_mouset, mouse_click_timer_cb, + &mouse_timed_out); switch (event->button) { - case 1: - button = MOUSE_LEFT; - break; - case 2: - button = MOUSE_MIDDLE; - break; - case 3: - button = MOUSE_RIGHT; - break; - default: - return FALSE; /* Unknown button */ + /* Keep in sync with gui_x11.c. + * Buttons 4-7 are handled in scroll_event() */ + case 1: button = MOUSE_LEFT; break; + case 2: button = MOUSE_MIDDLE; break; + case 3: button = MOUSE_RIGHT; break; + case 8: button = MOUSE_X1; break; + case 9: button = MOUSE_X2; break; + default: + return FALSE; /* Unknown button */ } #ifdef FEAT_XIM @@ -1717,7 +2054,11 @@ scroll_event(GtkWidget *widget, int button; int_u vim_modifiers; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget)) +#else if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget)) +#endif gtk_widget_grab_focus(widget); switch (event->direction) @@ -1768,7 +2109,7 @@ button_release_event(GtkWidget *widget UNUSED, area .*/ if (motion_repeat_timer) { - gtk_timeout_remove(motion_repeat_timer); + timeout_remove(motion_repeat_timer); motion_repeat_timer = 0; } @@ -1859,7 +2200,7 @@ parse_uri_list(int *count, char_u *data, int len) { int n = 0; char_u *tmp = NULL; - char_u **array = NULL;; + char_u **array = NULL; if (data != NULL && len > 0 && (tmp = (char_u *)alloc(len + 1)) != NULL) { @@ -1883,7 +2224,13 @@ drag_handle_uri_list(GdkDragContext *context, char_u **fnames; int nfiles = 0; +# if GTK_CHECK_VERSION(3,0,0) + fnames = parse_uri_list(&nfiles, + (char_u *)gtk_selection_data_get_data(data), + gtk_selection_data_get_length(data)); +# else fnames = parse_uri_list(&nfiles, data->data, data->length); +# endif if (fnames != NULL && nfiles > 0) { @@ -1910,10 +2257,19 @@ drag_handle_text(GdkDragContext *context, int len; char_u *tmpbuf = NULL; +# if GTK_CHECK_VERSION(3,0,0) + text = (char_u *)gtk_selection_data_get_data(data); + len = gtk_selection_data_get_length(data); +# else text = data->data; len = data->length; +# endif +# if GTK_CHECK_VERSION(3,0,0) + if (gtk_selection_data_get_data_type(data) == utf8_string_atom) +# else if (data->type == utf8_string_atom) +# endif { if (input_conv.vc_type != CONV_NONE) tmpbuf = string_convert(&input_conv, text, &len); @@ -1949,10 +2305,21 @@ drag_data_received_cb(GtkWidget *widget, GdkModifierType state; /* Guard against trash */ +# if GTK_CHECK_VERSION(3,0,0) + const guchar * const data_data = gtk_selection_data_get_data(data); + const gint data_length = gtk_selection_data_get_length(data); + const gint data_format = gtk_selection_data_get_format(data); + + if (data_data == NULL + || data_length <= 0 + || data_format != 8 + || data_data[data_length] != '\0') +# else if (data->data == NULL || data->length <= 0 || data->format != 8 || data->data[data->length] != '\0') +# endif { gtk_drag_finish(context, FALSE, FALSE, time_); return; @@ -1960,7 +2327,11 @@ drag_data_received_cb(GtkWidget *widget, /* Get the current modifier state for proper distinguishment between * different operations later. */ +#if GTK_CHECK_VERSION(3,0,0) + gui_gtk_get_pointer(widget, NULL, NULL, &state); +# else gdk_window_get_pointer(widget->window, NULL, NULL, &state); +# endif /* Not sure about the role of "text/plain" here... */ if (info == (guint)TARGET_TEXT_URI_LIST) @@ -1999,7 +2370,7 @@ sm_client_check_changed_any(GnomeClient *client UNUSED, * If there are changed buffers, present the user with * a dialog if possible, otherwise give an error message. */ - shutdown_cancelled = check_changed_any(FALSE); + shutdown_cancelled = check_changed_any(FALSE, FALSE); exiting = FALSE; cmdmod = save_cmdmod; @@ -2211,10 +2582,10 @@ setup_save_yourself(void) * GTK tells us that XSMP needs attention */ static gboolean -local_xsmp_handle_requests(source, condition, data) - GIOChannel *source UNUSED; - GIOCondition condition; - gpointer data; +local_xsmp_handle_requests( + GIOChannel *source UNUSED, + GIOCondition condition, + gpointer data) { if (condition == G_IO_IN) { @@ -2240,7 +2611,7 @@ setup_save_yourself(void) Atom *existing_atoms = NULL; int count = 0; -#ifdef USE_XSMP +# ifdef USE_XSMP if (xsmp_icefd != -1) { /* @@ -2251,16 +2622,25 @@ setup_save_yourself(void) g_io_add_watch(g_io, G_IO_IN | G_IO_ERR | G_IO_HUP, local_xsmp_handle_requests, (gpointer)g_io); + g_io_channel_unref(g_io); } else -#endif +# endif { /* Fall back to old method */ /* first get the existing value */ +# if GTK_CHECK_VERSION(3,0,0) + GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); + + if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), + GDK_WINDOW_XID(mainwin_win), + &existing_atoms, &count)) +# else if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(gui.mainwin->window), GDK_WINDOW_XWINDOW(gui.mainwin->window), &existing_atoms, &count)) +# endif { Atom *new_atoms; Atom save_yourself_xatom; @@ -2282,8 +2662,13 @@ setup_save_yourself(void) { memcpy(new_atoms, existing_atoms, count * sizeof(Atom)); new_atoms[count] = save_yourself_xatom; +# if GTK_CHECK_VERSION(3,0,0) + XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), + GDK_WINDOW_XID(mainwin_win), +# else XSetWMProtocols(GDK_WINDOW_XDISPLAY(gui.mainwin->window), GDK_WINDOW_XWINDOW(gui.mainwin->window), +# endif new_atoms, count + 1); vim_free(new_atoms); } @@ -2328,8 +2713,13 @@ global_event_filter(GdkXEvent *xev, * know we are done saving ourselves. We don't want to be * restarted, thus set argv to NULL. */ +# if GTK_CHECK_VERSION(3,0,0) + XSetCommand(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)), + GDK_WINDOW_XID(gtk_widget_get_window(gui.mainwin)), +# else XSetCommand(GDK_WINDOW_XDISPLAY(gui.mainwin->window), GDK_WINDOW_XWINDOW(gui.mainwin->window), +# endif NULL, 0); return GDK_FILTER_REMOVE; } @@ -2363,10 +2753,18 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) #undef magick # undef static +#if GTK_CHECK_VERSION(3,0,0) + GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); +#endif + /* When started with "--echo-wid" argument, write window ID on stdout. */ if (echo_wid_arg) { +#if GTK_CHECK_VERSION(3,0,0) + printf("WID: %ld\n", (long)GDK_WINDOW_XID(mainwin_win)); +#else printf("WID: %ld\n", (long)GDK_WINDOW_XWINDOW(gui.mainwin->window)); +#endif fflush(stdout); } @@ -2403,24 +2801,41 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) if (serverName == NULL && serverDelayedStartName != NULL) { /* This is a :gui command in a plain vim with no previous server */ +# if GTK_CHECK_VERSION(3,0,0) + commWindow = GDK_WINDOW_XID(mainwin_win); + + (void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win), + serverDelayedStartName); +# else commWindow = GDK_WINDOW_XWINDOW(gui.mainwin->window); (void)serverRegisterName(GDK_WINDOW_XDISPLAY(gui.mainwin->window), serverDelayedStartName); +# endif } else { /* * Cannot handle "XLib-only" windows with gtk event routines, we'll * have to change the "server" registration to that of the main window - * If we have not registered a name yet, remember the window + * If we have not registered a name yet, remember the window. */ +# if GTK_CHECK_VERSION(3,0,0) + serverChangeRegisteredWindow(GDK_WINDOW_XDISPLAY(mainwin_win), + GDK_WINDOW_XID(mainwin_win)); +# else serverChangeRegisteredWindow(GDK_WINDOW_XDISPLAY(gui.mainwin->window), GDK_WINDOW_XWINDOW(gui.mainwin->window)); +# endif } gtk_widget_add_events(gui.mainwin, GDK_PROPERTY_CHANGE_MASK); +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.mainwin), "property-notify-event", + G_CALLBACK(property_event), NULL); +# else gtk_signal_connect(GTK_OBJECT(gui.mainwin), "property_notify_event", GTK_SIGNAL_FUNC(property_event), NULL); +# endif #endif } @@ -2428,26 +2843,65 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) create_blank_pointer(void) { GdkWindow *root_window = NULL; +#if GTK_CHECK_VERSION(3,0,0) + GdkPixbuf *blank_mask; +#else GdkPixmap *blank_mask; +#endif GdkCursor *cursor; +#if GTK_CHECK_VERSION(3,0,0) + GdkRGBA color = { 0.0, 0.0, 0.0, 1.0 }; +#else GdkColor color = { 0, 0, 0, 0 }; char blank_data[] = { 0x0 }; +#endif -#ifdef HAVE_GTK_MULTIHEAD +#if GTK_CHECK_VERSION(3,12,0) + { + GdkWindow * const win = gtk_widget_get_window(gui.mainwin); + GdkScreen * const scrn = gdk_window_get_screen(win); + root_window = gdk_screen_get_root_window(scrn); + } +#else root_window = gtk_widget_get_root_window(gui.mainwin); #endif /* Create a pseudo blank pointer, which is in fact one pixel by one pixel * in size. */ +#if GTK_CHECK_VERSION(3,0,0) + { + cairo_surface_t *surf; + cairo_t *cr; + + surf = cairo_image_surface_create(CAIRO_FORMAT_A1, 1, 1); + cr = cairo_create(surf); + + cairo_set_source_rgba(cr, + color.red, + color.green, + color.blue, + color.alpha); + cairo_rectangle(cr, 0, 0, 1, 1); + cairo_fill(cr); + cairo_destroy(cr); + + blank_mask = gdk_pixbuf_get_from_surface(surf, 0, 0, 1, 1); + cairo_surface_destroy(surf); + + cursor = gdk_cursor_new_from_pixbuf(gdk_window_get_display(root_window), + blank_mask, 0, 0); + g_object_unref(blank_mask); + } +#else blank_mask = gdk_bitmap_create_from_data(root_window, blank_data, 1, 1); cursor = gdk_cursor_new_from_pixmap(blank_mask, blank_mask, &color, &color, 0, 0); gdk_bitmap_unref(blank_mask); +#endif return cursor; } -#ifdef HAVE_GTK_MULTIHEAD static void mainwin_screen_changed_cb(GtkWidget *widget, GdkScreen *previous_screen UNUSED, @@ -2460,12 +2914,22 @@ mainwin_screen_changed_cb(GtkWidget *widget, * Recreate the invisible mouse cursor. */ if (gui.blank_pointer != NULL) +#if GTK_CHECK_VERSION(3,0,0) + g_object_unref(G_OBJECT(gui.blank_pointer)); +#else gdk_cursor_unref(gui.blank_pointer); +#endif gui.blank_pointer = create_blank_pointer(); +#if GTK_CHECK_VERSION(3,0,0) + if (gui.pointer_hidden && gtk_widget_get_window(gui.drawarea) != NULL) + gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), + gui.blank_pointer); +#else if (gui.pointer_hidden && gui.drawarea->window != NULL) gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer); +#endif /* * Create a new PangoContext for this screen, and initialize it @@ -2480,10 +2944,9 @@ mainwin_screen_changed_cb(GtkWidget *widget, if (gui.norm_font != NULL) { gui_mch_init_font(p_guifont, FALSE); - gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); + gui_set_shellsize(TRUE, FALSE, RESIZE_BOTH); } } -#endif /* HAVE_GTK_MULTIHEAD */ /* * After the drawing area comes up, we calculate all colors and create the @@ -2496,28 +2959,54 @@ mainwin_screen_changed_cb(GtkWidget *widget, drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED) { GtkWidget *sbar; +#if GTK_CHECK_VERSION(3,0,0) + GtkAllocation allocation; +#endif #ifdef FEAT_XIM xim_init(); #endif gui_mch_new_colors(); +#if GTK_CHECK_VERSION(3,0,0) + gui.surface = gdk_window_create_similar_surface( + gtk_widget_get_window(widget), + CAIRO_CONTENT_COLOR_ALPHA, + gtk_widget_get_allocated_width(widget), + gtk_widget_get_allocated_height(widget)); +#else gui.text_gc = gdk_gc_new(gui.drawarea->window); +#endif gui.blank_pointer = create_blank_pointer(); if (gui.pointer_hidden) +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_set_cursor(gtk_widget_get_window(widget), gui.blank_pointer); +#else gdk_window_set_cursor(widget->window, gui.blank_pointer); +#endif /* get the actual size of the scrollbars, if they are realized */ sbar = firstwin->w_scrollbars[SBAR_LEFT].id; if (!sbar || (!gui.which_scrollbars[SBAR_LEFT] && firstwin->w_scrollbars[SBAR_RIGHT].id)) sbar = firstwin->w_scrollbars[SBAR_RIGHT].id; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_allocation(sbar, &allocation); + if (sbar && gtk_widget_get_realized(sbar) && allocation.width) + gui.scrollbar_width = allocation.width; +#else if (sbar && GTK_WIDGET_REALIZED(sbar) && sbar->allocation.width) gui.scrollbar_width = sbar->allocation.width; +#endif sbar = gui.bottom_sbar.id; +#if GTK_CHECK_VERSION(3,0,0) + if (sbar && gtk_widget_get_realized(sbar) && allocation.height) + gui.scrollbar_height = allocation.height; +#else if (sbar && GTK_WIDGET_REALIZED(sbar) && sbar->allocation.height) gui.scrollbar_height = sbar->allocation.height; +#endif } /* @@ -2545,43 +3034,122 @@ drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED) g_object_unref(gui.text_context); gui.text_context = NULL; +#if GTK_CHECK_VERSION(3,0,0) + if (gui.surface != NULL) + { + cairo_surface_destroy(gui.surface); + gui.surface = NULL; + } +#else g_object_unref(gui.text_gc); gui.text_gc = NULL; +#endif +#if GTK_CHECK_VERSION(3,0,0) + g_object_unref(G_OBJECT(gui.blank_pointer)); +#else gdk_cursor_unref(gui.blank_pointer); +#endif gui.blank_pointer = NULL; } +#if GTK_CHECK_VERSION(3,22,2) + static void +drawarea_style_updated_cb(GtkWidget *widget UNUSED, + gpointer data UNUSED) +#else static void drawarea_style_set_cb(GtkWidget *widget UNUSED, GtkStyle *previous_style UNUSED, gpointer data UNUSED) +#endif { gui_mch_new_colors(); } -/* - * Callback routine for the "delete_event" signal on the toplevel window. - * Tries to vim gracefully, or refuses to exit with changed buffers. - */ - static gint -delete_event_cb(GtkWidget *widget UNUSED, - GdkEventAny *event UNUSED, - gpointer data UNUSED) +#if GTK_CHECK_VERSION(3,0,0) + static gboolean +drawarea_configure_event_cb(GtkWidget *widget, + GdkEventConfigure *event, + gpointer data UNUSED) { - gui_shell_closed(); - return TRUE; -} + static int cur_width = 0; + static int cur_height = 0; -#if defined(FEAT_MENU) || defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) - static int -get_item_dimensions(GtkWidget *widget, GtkOrientation orientation) -{ - GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL; + g_return_val_if_fail(event + && event->width >= 1 && event->height >= 1, TRUE); -#ifdef FEAT_GUI_GNOME - if (using_gnome && widget != NULL) - { +# if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4) + /* As of 3.22.2, GdkWindows have started distributing configure events to + * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + * + * As can be seen from the implementation of move_native_children() and + * configure_native_child() in gdkwindow.c, those functions actually + * propagate configure events to every child, failing to distinguish + * "native" one from non-native one. + * + * Naturally, configure events propagated to here like that are fallacious + * and, as a matter of fact, they trigger a geometric collapse of + * gui.drawarea in fullscreen and miximized modes. + * + * To filter out such nuisance events, we are making use of the fact that + * the field send_event of such GdkEventConfigures is set to FALSE in + * configure_native_child(). + * + * Obviously, this is a terrible hack making GVim depend on GTK's + * implementation details. Therefore, watch out any relevant internal + * changes happening in GTK in the feature (sigh). + */ + /* Follow-up + * After a few weeks later, the GdkWindow change mentioned above was + * reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). + * The corresponding official release is 3.22.4. */ + if (event->send_event == FALSE) + return TRUE; +# endif + + if (event->width == cur_width && event->height == cur_height) + return TRUE; + + cur_width = event->width; + cur_height = event->height; + + if (gui.surface != NULL) + cairo_surface_destroy(gui.surface); + + gui.surface = gdk_window_create_similar_surface( + gtk_widget_get_window(widget), + CAIRO_CONTENT_COLOR_ALPHA, + event->width, event->height); + + gtk_widget_queue_draw(widget); + + return TRUE; +} +#endif + +/* + * Callback routine for the "delete_event" signal on the toplevel window. + * Tries to vim gracefully, or refuses to exit with changed buffers. + */ + static gint +delete_event_cb(GtkWidget *widget UNUSED, + GdkEventAny *event UNUSED, + gpointer data UNUSED) +{ + gui_shell_closed(); + return TRUE; +} + +#if defined(FEAT_MENU) || defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) + static int +get_item_dimensions(GtkWidget *widget, GtkOrientation orientation) +{ +# ifdef FEAT_GUI_GNOME + GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL; + + if (using_gnome && widget != NULL) + { GtkWidget *parent; BonoboDockItem *dockitem; @@ -2598,16 +3166,37 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation) item_orientation = bonobo_dock_item_get_orientation(dockitem); } } -#endif +# else +# define item_orientation GTK_ORIENTATION_HORIZONTAL +# endif + +# if GTK_CHECK_VERSION(3,0,0) + if (widget != NULL + && item_orientation == orientation + && gtk_widget_get_realized(widget) + && gtk_widget_get_visible(widget)) +# else if (widget != NULL && item_orientation == orientation && GTK_WIDGET_REALIZED(widget) && GTK_WIDGET_VISIBLE(widget)) +# endif { +# if GTK_CHECK_VERSION(3,0,0) + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + return allocation.height; +# else +# ifdef FEAT_GUI_GNOME if (orientation == GTK_ORIENTATION_HORIZONTAL) return widget->allocation.height; else return widget->allocation.width; +# else + return widget->allocation.height; +# endif +# endif } return 0; } @@ -2761,6 +3350,17 @@ icon_size_changed_foreach(GtkWidget *widget, gpointer user_data) { GtkImage *image = (GtkImage *)widget; +# if GTK_CHECK_VERSION(3,10,0) + if (gtk_image_get_storage_type(image) == GTK_IMAGE_ICON_NAME) + { + const GtkIconSize icon_size = GPOINTER_TO_INT(user_data); + const gchar *icon_name; + + gtk_image_get_icon_name(image, &icon_name, NULL); + + gtk_image_set_from_icon_name(image, icon_name, icon_size); + } +# else /* User-defined icons are stored in a GtkIconSet */ if (gtk_image_get_storage_type(image) == GTK_IMAGE_ICON_SET) { @@ -2774,6 +3374,7 @@ icon_size_changed_foreach(GtkWidget *widget, gpointer user_data) gtk_image_set_from_icon_set(image, icon_set, icon_size); gtk_icon_set_unref(icon_set); } +# endif } else if (GTK_IS_CONTAINER(widget)) { @@ -2802,7 +3403,9 @@ set_toolbar_style(GtkToolbar *toolbar) style = GTK_TOOLBAR_ICONS; gtk_toolbar_set_style(toolbar, style); +# if !GTK_CHECK_VERSION(3,0,0) gtk_toolbar_set_tooltips(toolbar, (toolbar_flags & TOOLBAR_TOOLTIPS) != 0); +# endif switch (tbis_flags) { @@ -2810,6 +3413,8 @@ set_toolbar_style(GtkToolbar *toolbar) case TBIS_SMALL: size = GTK_ICON_SIZE_SMALL_TOOLBAR; break; case TBIS_MEDIUM: size = GTK_ICON_SIZE_BUTTON; break; case TBIS_LARGE: size = GTK_ICON_SIZE_LARGE_TOOLBAR; break; + case TBIS_HUGE: size = GTK_ICON_SIZE_DND; break; + case TBIS_GIANT: size = GTK_ICON_SIZE_DIALOG; break; default: size = GTK_ICON_SIZE_INVALID; break; } oldsize = gtk_toolbar_get_icon_size(toolbar); @@ -2834,7 +3439,9 @@ set_toolbar_style(GtkToolbar *toolbar) #if defined(FEAT_GUI_TABLINE) || defined(PROTO) static int ignore_tabline_evt = FALSE; static GtkWidget *tabline_menu; +# if !GTK_CHECK_VERSION(3,0,0) static GtkTooltips *tabline_tooltip; +# endif static int clicked_page; /* page clicked in tab line */ /* @@ -2859,9 +3466,15 @@ add_tabline_menu_item(GtkWidget *menu, char_u *text, int resp) CONVERT_TO_UTF8_FREE(utf_text); gtk_container_add(GTK_CONTAINER(menu), item); +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(item), "activate", + G_CALLBACK(tabline_menu_handler), + GINT_TO_POINTER(resp)); +# else gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(tabline_menu_handler), (gpointer)(long)resp); +# endif } /* @@ -2873,7 +3486,9 @@ create_tabline_menu(void) GtkWidget *menu; menu = gtk_menu_new(); - add_tabline_menu_item(menu, (char_u *)_("Close"), TABLINE_MENU_CLOSE); + if (first_tabpage->tp_next != NULL) + add_tabline_menu_item(menu, (char_u *)_("Close tab"), + TABLINE_MENU_CLOSE); add_tabline_menu_item(menu, (char_u *)_("New tab"), TABLINE_MENU_NEW); add_tabline_menu_item(menu, (char_u *)_("Open Tab..."), TABLINE_MENU_OPEN); @@ -2901,16 +3516,30 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event) ) return TRUE; +# if GTK_CHECK_VERSION(3,0,0) + tabwin = gui_gtk_window_at_position(gui.mainwin, &x, &y); +# else tabwin = gdk_window_at_pointer(&x, &y); +# endif + gdk_window_get_user_data(tabwin, (gpointer)&tabwidget); +# if GTK_CHECK_VERSION(3,0,0) + clicked_page = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tabwidget), + "tab_num")); +# else clicked_page = (int)(long)gtk_object_get_user_data( GTK_OBJECT(tabwidget)); +# endif /* If the event was generated for 3rd button popup the menu. */ if (bevent->button == 3) { +# if GTK_CHECK_VERSION(3,22,2) + gtk_menu_popup_at_pointer(GTK_MENU(widget), event); +# else gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL, bevent->button, bevent->time); +# endif /* We handled the event. */ return TRUE; } @@ -2935,13 +3564,38 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event) static void on_select_tab( GtkNotebook *notebook UNUSED, +# if GTK_CHECK_VERSION(3,0,0) + gpointer *page UNUSED, +# else GtkNotebookPage *page UNUSED, +# endif gint idx, gpointer data UNUSED) { if (!ignore_tabline_evt) - { send_tabline_event(idx + 1); +} + +/* + * Handle reordering the tabs (using D&D). + */ + static void +on_tab_reordered( + GtkNotebook *notebook UNUSED, +# if GTK_CHECK_VERSION(3,0,0) + gpointer *page UNUSED, +# else + GtkNotebookPage *page UNUSED, +# endif + gint idx, + gpointer data UNUSED) +{ + if (!ignore_tabline_evt) + { + if ((tabpage_index(curtab) - 1) < idx) + tabpage_move(idx + 1); + else + tabpage_move(idx); } } @@ -2960,7 +3614,11 @@ gui_mch_show_tabline(int showit) gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit); update_window_manager_hints(0, 0); if (showit) +# if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_focus(GTK_WIDGET(gui.tabline), FALSE); +# else GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(gui.tabline), GTK_CAN_FOCUS); +# endif } gui_mch_update(); @@ -3008,24 +3666,43 @@ gui_mch_update_tabline(void) if (page == NULL) { /* Add notebook page */ +# if GTK_CHECK_VERSION(3,2,0) + page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous(GTK_BOX(page), FALSE); +# else page = gtk_vbox_new(FALSE, 0); +# endif gtk_widget_show(page); event_box = gtk_event_box_new(); gtk_widget_show(event_box); label = gtk_label_new("-Empty-"); +# if !GTK_CHECK_VERSION(3,14,0) gtk_misc_set_padding(GTK_MISC(label), 2, 2); +# endif gtk_container_add(GTK_CONTAINER(event_box), label); gtk_widget_show(label); gtk_notebook_insert_page(GTK_NOTEBOOK(gui.tabline), page, event_box, nr++); + gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), + page, + TRUE); } event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page); +# if GTK_CHECK_VERSION(3,0,0) + g_object_set_data(G_OBJECT(event_box), "tab_num", + GINT_TO_POINTER(tab_num)); +# else gtk_object_set_user_data(GTK_OBJECT(event_box), (gpointer)(long)tab_num); +# endif +# if GTK_CHECK_VERSION(3,0,0) + label = gtk_bin_get_child(GTK_BIN(event_box)); +# else label = GTK_BIN(event_box)->child; +# endif get_tabline_label(tp, FALSE); labeltext = CONVERT_TO_UTF8(NameBuff); gtk_label_set_text(GTK_LABEL(label), (const char *)labeltext); @@ -3033,8 +3710,12 @@ gui_mch_update_tabline(void) get_tabline_label(tp, TRUE); labeltext = CONVERT_TO_UTF8(NameBuff); +# if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_tooltip_text(event_box, (const gchar *)labeltext); +# else gtk_tooltips_set_tip(GTK_TOOLTIPS(tabline_tooltip), event_box, (const char *)labeltext, NULL); +# endif CONVERT_TO_UTF8_FREE(labeltext); } @@ -3042,8 +3723,13 @@ gui_mch_update_tabline(void) while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui.tabline), nr) != NULL) gtk_notebook_remove_page(GTK_NOTEBOOK(gui.tabline), nr); +# if GTK_CHECK_VERSION(3,0,0) + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(gui.tabline)) != curtabidx) + gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), curtabidx); +# else if (gtk_notebook_current_page(GTK_NOTEBOOK(gui.tabline)) != curtabidx) gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline), curtabidx); +# endif /* Make sure everything is in place before drawing text. */ gui_mch_update(); @@ -3055,15 +3741,19 @@ gui_mch_update_tabline(void) * Set the current tab to "nr". First tab is 1. */ void -gui_mch_set_curtab(nr) - int nr; +gui_mch_set_curtab(int nr) { if (gui.tabline == NULL) return; ignore_tabline_evt = TRUE; +# if GTK_CHECK_VERSION(3,0,0) + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(gui.tabline)) != nr - 1) + gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), nr - 1); +# else if (gtk_notebook_current_page(GTK_NOTEBOOK(gui.tabline)) != nr - 1) gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline), nr - 1); +# endif ignore_tabline_evt = FALSE; } @@ -3154,8 +3844,7 @@ gui_mch_init(void) # endif } #endif - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); #if GLIB_CHECK_VERSION(2,1,3) /* Set the human-readable application name */ @@ -3173,20 +3862,28 @@ gui_mch_init(void) #endif /* FIXME: Need to install the classic icons and a gtkrc.classic file. * The hard part is deciding install locations and the Makefile magic. */ -#if 0 +#if !GTK_CHECK_VERSION(3,0,0) +# if 0 gtk_rc_parse("gtkrc"); +# endif #endif /* Initialize values */ gui.border_width = 2; gui.scrollbar_width = SB_DEFAULT_WIDTH; gui.scrollbar_height = SB_DEFAULT_WIDTH; +#if GTK_CHECK_VERSION(3,0,0) + gui.fgcolor = g_new(GdkRGBA, 1); + gui.bgcolor = g_new(GdkRGBA, 1); + gui.spcolor = g_new(GdkRGBA, 1); +#else /* LINTED: avoid warning: conversion to 'unsigned long' */ gui.fgcolor = g_new0(GdkColor, 1); /* LINTED: avoid warning: conversion to 'unsigned long' */ gui.bgcolor = g_new0(GdkColor, 1); /* LINTED: avoid warning: conversion to 'unsigned long' */ gui.spcolor = g_new0(GdkColor, 1); +#endif /* Initialise atoms */ html_atom = gdk_atom_intern("text/html", FALSE); @@ -3201,13 +3898,13 @@ gui_mch_init(void) GtkWidget *plug; /* Use GtkSocket from another app. */ -#ifdef HAVE_GTK_MULTIHEAD plug = gtk_plug_new_for_display(gdk_display_get_default(), gtk_socket_id); +#if GTK_CHECK_VERSION(3,0,0) + if (plug != NULL && gtk_plug_get_socket_window(GTK_PLUG(plug)) != NULL) #else - plug = gtk_plug_new(gtk_socket_id); -#endif if (plug != NULL && GTK_PLUG(plug)->socket_window != NULL) +#endif { gui.mainwin = plug; } @@ -3242,23 +3939,40 @@ gui_mch_init(void) gui.text_context = gtk_widget_create_pango_context(gui.mainwin); pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR); +#if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(gui.mainwin), 0); +#else gtk_container_border_width(GTK_CONTAINER(gui.mainwin), 0); +#endif gtk_widget_add_events(gui.mainwin, GDK_VISIBILITY_NOTIFY_MASK); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.mainwin), "delete-event", + G_CALLBACK(&delete_event_cb), NULL); + + g_signal_connect(G_OBJECT(gui.mainwin), "realize", + G_CALLBACK(&mainwin_realize), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.mainwin), "delete_event", GTK_SIGNAL_FUNC(&delete_event_cb), NULL); gtk_signal_connect(GTK_OBJECT(gui.mainwin), "realize", GTK_SIGNAL_FUNC(&mainwin_realize), NULL); -#ifdef HAVE_GTK_MULTIHEAD - g_signal_connect(G_OBJECT(gui.mainwin), "screen_changed", - G_CALLBACK(&mainwin_screen_changed_cb), NULL); #endif + + g_signal_connect(G_OBJECT(gui.mainwin), "screen-changed", + G_CALLBACK(&mainwin_screen_changed_cb), NULL); + gui.accel_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(gui.mainwin), gui.accel_group); /* A vertical box holds the menubar, toolbar and main text window. */ +#if GTK_CHECK_VERSION(3,2,0) + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE); +#else vbox = gtk_vbox_new(FALSE, 0); +#endif #ifdef FEAT_GUI_GNOME if (using_gnome) @@ -3321,11 +4035,17 @@ gui_mch_init(void) * Create the toolbar and handle */ /* some aesthetics on the toolbar */ +# ifdef USE_GTK3 + /* TODO: Add GTK+ 3 code here using GtkCssProvider if necessary. */ + /* N.B. Since the default value of GtkToolbar::button-relief is + * GTK_RELIEF_NONE, there's no need to specify that, probably. */ +# else gtk_rc_parse_string( "style \"vim-toolbar-style\" {\n" " GtkToolbar::button_relief = GTK_RELIEF_NONE\n" "}\n" "widget \"*.vim-toolbar\" style \"vim-toolbar-style\"\n"); +# endif gui.toolbar = gtk_toolbar_new(); gtk_widget_set_name(gui.toolbar, "vim-toolbar"); set_toolbar_style(GTK_TOOLBAR(gui.toolbar)); @@ -3367,42 +4087,85 @@ gui_mch_init(void) gtk_notebook_set_show_border(GTK_NOTEBOOK(gui.tabline), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), FALSE); gtk_notebook_set_scrollable(GTK_NOTEBOOK(gui.tabline), TRUE); +# if !GTK_CHECK_VERSION(3,0,0) gtk_notebook_set_tab_border(GTK_NOTEBOOK(gui.tabline), FALSE); +# endif +# if !GTK_CHECK_VERSION(3,0,0) tabline_tooltip = gtk_tooltips_new(); gtk_tooltips_enable(GTK_TOOLTIPS(tabline_tooltip)); +# endif { GtkWidget *page, *label, *event_box; /* Add the first tab. */ +# if GTK_CHECK_VERSION(3,2,0) + page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous(GTK_BOX(page), FALSE); +# else page = gtk_vbox_new(FALSE, 0); +# endif gtk_widget_show(page); gtk_container_add(GTK_CONTAINER(gui.tabline), page); label = gtk_label_new("-Empty-"); gtk_widget_show(label); event_box = gtk_event_box_new(); gtk_widget_show(event_box); +# if GTK_CHECK_VERSION(3,0,0) + g_object_set_data(G_OBJECT(event_box), "tab_num", GINT_TO_POINTER(1L)); +# else gtk_object_set_user_data(GTK_OBJECT(event_box), (gpointer)1L); +# endif +# if !GTK_CHECK_VERSION(3,14,0) gtk_misc_set_padding(GTK_MISC(label), 2, 2); +# endif gtk_container_add(GTK_CONTAINER(event_box), label); gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, event_box); + gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE); } +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.tabline), "switch-page", + G_CALLBACK(on_select_tab), NULL); + g_signal_connect(G_OBJECT(gui.tabline), "page-reordered", + G_CALLBACK(on_tab_reordered), NULL); +# else gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page", GTK_SIGNAL_FUNC(on_select_tab), NULL); + gtk_signal_connect(GTK_OBJECT(gui.tabline), "page-reordered", + GTK_SIGNAL_FUNC(on_tab_reordered), NULL); +# endif /* Create a popup menu for the tab line and connect it. */ tabline_menu = create_tabline_menu(); +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect_swapped(G_OBJECT(gui.tabline), "button-press-event", + G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu)); +# else gtk_signal_connect_object(GTK_OBJECT(gui.tabline), "button_press_event", GTK_SIGNAL_FUNC(on_tabline_menu), GTK_OBJECT(tabline_menu)); -#endif +# endif +#endif /* FEAT_GUI_TABLINE */ gui.formwin = gtk_form_new(); +#if GTK_CHECK_VERSION(3,0,0) + gtk_container_set_border_width(GTK_CONTAINER(gui.formwin), 0); +#else gtk_container_border_width(GTK_CONTAINER(gui.formwin), 0); +#endif +#if !GTK_CHECK_VERSION(3,0,0) gtk_widget_set_events(gui.formwin, GDK_EXPOSURE_MASK); +#endif gui.drawarea = gtk_drawing_area_new(); +#if GTK_CHECK_VERSION(3,22,2) + gtk_widget_set_name(gui.drawarea, "vim-gui-drawarea"); +#endif +#if GTK_CHECK_VERSION(3,0,0) + gui.surface = NULL; + gui.by_signal = FALSE; +#endif /* Determine which events we will filter. */ gtk_widget_set_events(gui.drawarea, @@ -3424,18 +4187,40 @@ gui_mch_init(void) /* For GtkSockets, key-presses must go to the focus widget (drawarea) * and not the window. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin) + : G_OBJECT(gui.drawarea), + "key-press-event", + G_CALLBACK(key_press_event), NULL); +#else gtk_signal_connect((gtk_socket_id == 0) ? GTK_OBJECT(gui.mainwin) : GTK_OBJECT(gui.drawarea), "key_press_event", GTK_SIGNAL_FUNC(key_press_event), NULL); -#if defined(FEAT_XIM) +#endif +#if defined(FEAT_XIM) || GTK_CHECK_VERSION(3,0,0) /* Also forward key release events for the benefit of GTK+ 2 input * modules. Try CTRL-SHIFT-xdigits to enter a Unicode code point. */ g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin) : G_OBJECT(gui.drawarea), - "key_release_event", + "key-release-event", G_CALLBACK(&key_release_event), NULL); #endif +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "realize", + G_CALLBACK(drawarea_realize_cb), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "unrealize", + G_CALLBACK(drawarea_unrealize_cb), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "configure-event", + G_CALLBACK(drawarea_configure_event_cb), NULL); +# if GTK_CHECK_VERSION(3,22,2) + g_signal_connect_after(G_OBJECT(gui.drawarea), "style-updated", + G_CALLBACK(&drawarea_style_updated_cb), NULL); +# else + g_signal_connect_after(G_OBJECT(gui.drawarea), "style-set", + G_CALLBACK(&drawarea_style_set_cb), NULL); +# endif +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "realize", GTK_SIGNAL_FUNC(drawarea_realize_cb), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "unrealize", @@ -3443,8 +4228,11 @@ gui_mch_init(void) gtk_signal_connect_after(GTK_OBJECT(gui.drawarea), "style_set", GTK_SIGNAL_FUNC(&drawarea_style_set_cb), NULL); +#endif +#if !GTK_CHECK_VERSION(3,0,0) gui.visibility = GDK_VISIBILITY_UNOBSCURED; +#endif #if !(defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)) wm_protocols_atom = gdk_atom_intern("WM_PROTOCOLS", FALSE); @@ -3453,7 +4241,11 @@ gui_mch_init(void) if (gtk_socket_id != 0) /* make sure keyboard input can go to the drawarea */ +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_can_focus(gui.drawarea, TRUE); +#else GTK_WIDGET_SET_FLAGS(gui.drawarea, GTK_CAN_FOCUS); +#endif /* * Set clipboard specific atoms @@ -3468,10 +4260,15 @@ gui_mch_init(void) */ gui.border_offset = gui.border_width; +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "draw", + G_CALLBACK(draw_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.mainwin), "visibility_notify_event", GTK_SIGNAL_FUNC(visibility_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "expose_event", GTK_SIGNAL_FUNC(expose_event), NULL); +#endif /* * Only install these enter/leave callbacks when 'p' in 'guioptions'. @@ -3479,10 +4276,17 @@ gui_mch_init(void) */ if (vim_strchr(p_go, GO_POINTER) != NULL) { +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "leave-notify-event", + G_CALLBACK(leave_notify_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "enter-notify-event", + G_CALLBACK(enter_notify_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "leave_notify_event", GTK_SIGNAL_FUNC(leave_notify_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "enter_notify_event", GTK_SIGNAL_FUNC(enter_notify_event), NULL); +#endif } /* Real windows can get focus ... GtkPlug, being a mere container can't, @@ -3491,25 +4295,56 @@ gui_mch_init(void) */ if (gtk_socket_id == 0) { +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.mainwin), "focus-out-event", + G_CALLBACK(focus_out_event), NULL); + g_signal_connect(G_OBJECT(gui.mainwin), "focus-in-event", + G_CALLBACK(focus_in_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_out_event", GTK_SIGNAL_FUNC(focus_out_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_in_event", GTK_SIGNAL_FUNC(focus_in_event), NULL); +#endif } else { +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "focus-out-event", + G_CALLBACK(focus_out_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "focus-in-event", + G_CALLBACK(focus_in_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_out_event", GTK_SIGNAL_FUNC(focus_out_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_in_event", GTK_SIGNAL_FUNC(focus_in_event), NULL); +#endif #ifdef FEAT_GUI_TABLINE +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.tabline), "focus-out-event", + G_CALLBACK(focus_out_event), NULL); + g_signal_connect(G_OBJECT(gui.tabline), "focus-in-event", + G_CALLBACK(focus_in_event), NULL); +# else gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_out_event", GTK_SIGNAL_FUNC(focus_out_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_in_event", GTK_SIGNAL_FUNC(focus_in_event), NULL); +# endif #endif /* FEAT_GUI_TABLINE */ } +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "motion-notify-event", + G_CALLBACK(motion_notify_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "button-press-event", + G_CALLBACK(button_press_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "button-release-event", + G_CALLBACK(button_release_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "scroll-event", + G_CALLBACK(&scroll_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "motion_notify_event", GTK_SIGNAL_FUNC(motion_notify_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "button_press_event", @@ -3518,19 +4353,32 @@ gui_mch_init(void) GTK_SIGNAL_FUNC(button_release_event), NULL); g_signal_connect(G_OBJECT(gui.drawarea), "scroll_event", G_CALLBACK(&scroll_event), NULL); +#endif /* * Add selection handler functions. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "selection-clear-event", + G_CALLBACK(selection_clear_event), NULL); + g_signal_connect(G_OBJECT(gui.drawarea), "selection-received", + G_CALLBACK(selection_received_cb), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_clear_event", GTK_SIGNAL_FUNC(selection_clear_event), NULL); gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received", GTK_SIGNAL_FUNC(selection_received_cb), NULL); +#endif gui_gtk_set_selection_targets(); +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "selection-get", + G_CALLBACK(selection_get_cb), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get", GTK_SIGNAL_FUNC(selection_get_cb), NULL); +#endif /* Pretend we don't have input focus, we will get an event if we do. */ gui.in_focus = FALSE; @@ -3558,6 +4406,26 @@ gui_mch_forked(void) } #endif /* FEAT_GUI_GNOME && FEAT_SESSION */ +#if GTK_CHECK_VERSION(3,0,0) + static GdkRGBA +color_to_rgba(guicolor_T color) +{ + GdkRGBA rgba; + rgba.red = ((color & 0xff0000) >> 16) / 255.0; + rgba.green = ((color & 0xff00) >> 8) / 255.0; + rgba.blue = ((color & 0xff)) / 255.0; + rgba.alpha = 1.0; + return rgba; +} + + static void +set_cairo_source_rgba_from_color(cairo_t *cr, guicolor_T color) +{ + const GdkRGBA rgba = color_to_rgba(color); + cairo_set_source_rgba(cr, rgba.red, rgba.green, rgba.blue, rgba.alpha); +} +#endif /* GTK_CHECK_VERSION(3,0,0) */ + /* * Called when the foreground or background color has been changed. * This used to change the graphics contexts directly but we are @@ -3566,12 +4434,59 @@ gui_mch_forked(void) void gui_mch_new_colors(void) { +#if GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,22,2) + GdkWindow * const da_win = gtk_widget_get_window(gui.drawarea); +# endif + + if (gui.drawarea != NULL && gtk_widget_get_window(gui.drawarea) != NULL) +#else if (gui.drawarea != NULL && gui.drawarea->window != NULL) +#endif { +#if GTK_CHECK_VERSION(3,22,2) + GtkStyleContext * const context + = gtk_widget_get_style_context(gui.drawarea); + GtkCssProvider * const provider = gtk_css_provider_new(); + gchar * const css = g_strdup_printf( + "widget#vim-gui-drawarea {\n" + " background-color: #%.2lx%.2lx%.2lx;\n" + "}\n", + (gui.back_pixel >> 16) & 0xff, + (gui.back_pixel >> 8) & 0xff, + gui.back_pixel & 0xff); + + gtk_css_provider_load_from_data(provider, css, -1, NULL); + gtk_style_context_add_provider(context, + GTK_STYLE_PROVIDER(provider), G_MAXUINT); + + g_free(css); + g_object_unref(provider); +#elif GTK_CHECK_VERSION(3,4,0) /* !GTK_CHECK_VERSION(3,22,2) */ + GdkRGBA rgba; + + rgba = color_to_rgba(gui.back_pixel); + { + cairo_pattern_t * const pat = cairo_pattern_create_rgba( + rgba.red, rgba.green, rgba.blue, rgba.alpha); + if (pat != NULL) + { + gdk_window_set_background_pattern(da_win, pat); + cairo_pattern_destroy(pat); + } + else + gdk_window_set_background_rgba(da_win, &rgba); + } +#else /* !GTK_CHECK_VERSION(3,4,0) */ GdkColor color = { 0, 0, 0, 0 }; color.pixel = gui.back_pixel; +# if GTK_CHECK_VERSION(3,0,0) + gdk_window_set_background(da_win, &color); +# else gdk_window_set_background(gui.drawarea->window, &color); +# endif +#endif /* !GTK_CHECK_VERSION(3,22,2) */ } } @@ -3585,6 +4500,30 @@ form_configure_event(GtkWidget *widget UNUSED, { int usable_height = event->height; +#if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4) + /* As of 3.22.2, GdkWindows have started distributing configure events to + * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + * + * As can be seen from the implementation of move_native_children() and + * configure_native_child() in gdkwindow.c, those functions actually + * propagate configure events to every child, failing to distinguish + * "native" one from non-native one. + * + * Naturally, configure events propagated to here like that are fallacious + * and, as a matter of fact, they trigger a geometric collapse of + * gui.formwin. + * + * To filter out such fallacious events, check if the given event is the + * one that was sent out to the right place. Ignore it if not. + */ + /* Follow-up + * After a few weeks later, the GdkWindow change mentioned above was + * reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). + * The corresponding official release is 3.22.4. */ + if (event->window != gtk_widget_get_window(gui.formwin)) + return TRUE; +#endif + /* When in a GtkPlug, we can't guarantee valid heights (as a round * no. of char-heights), so we have to manually sanitise them. * Widths seem to sort themselves out, don't ask me why. @@ -3604,8 +4543,13 @@ form_configure_event(GtkWidget *widget UNUSED, * We can't do much more here than to trying to preserve what had been done, * since the window is already inevitably going away. */ +#if GTK_CHECK_VERSION(3,0,0) + static void +mainwin_destroy_cb(GObject *object UNUSED, gpointer data UNUSED) +#else static void mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED) +#endif { /* Don't write messages to the GUI anymore */ full_screen = FALSE; @@ -3620,6 +4564,9 @@ mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED) IOSIZE - 1); preserve_exit(); } +#ifdef USE_GRESOURCE + gui_gtk_unregister_resource(); +#endif } @@ -3631,11 +4578,11 @@ mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED) * plug's window 'min hints to set *it's* minimum size, but that's also the * only way we have of making ourselves bigger (by set lines/columns). * Thus set hints at start-up to ensure correct init. size, then a - * second after the final attempt to reset the real minimum hinst (done by - * scrollbar init.), actually do the standard hinst and stop the timer. + * second after the final attempt to reset the real minimum hints (done by + * scrollbar init.), actually do the standard hints and stop the timer. * We'll not let the default hints be set while this timer's active. */ - static gboolean + static timeout_cb_type check_startup_plug_hints(gpointer data UNUSED) { if (init_window_hints_state == 1) @@ -3726,8 +4673,7 @@ gui_mch_open(void) y += hh - pixel_height; gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); } - vim_free(gui.geom); - gui.geom = NULL; + VIM_CLEAR(gui.geom); /* From now until everyone's stopped trying to set the window hints * to their correct minimum values, stop them being set as we need @@ -3738,7 +4684,7 @@ gui_mch_open(void) { update_window_manager_hints(pixel_width, pixel_height); init_window_hints_state = 1; - g_timeout_add(1000, check_startup_plug_hints, NULL); + timeout_add(1000, check_startup_plug_hints, NULL); } } @@ -3782,8 +4728,13 @@ gui_mch_open(void) * changed them). */ highlight_gui_started(); /* re-init colors and fonts */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.mainwin), "destroy", + G_CALLBACK(mainwin_destroy_cb), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.mainwin), "destroy", GTK_SIGNAL_FUNC(mainwin_destroy_cb), NULL); +#endif #ifdef FEAT_HANGULIN hangul_keyboard_set(); @@ -3799,15 +4750,25 @@ gui_mch_open(void) * manager upon us and should not interfere with what VIM is requesting * upon startup. */ +#if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.formwin), "configure-event", + G_CALLBACK(form_configure_event), NULL); +#else gtk_signal_connect(GTK_OBJECT(gui.formwin), "configure_event", GTK_SIGNAL_FUNC(form_configure_event), NULL); +#endif #ifdef FEAT_DND /* Set up for receiving DND items. */ gui_gtk_set_dnd_targets(); +# if GTK_CHECK_VERSION(3,0,0) + g_signal_connect(G_OBJECT(gui.drawarea), "drag-data-received", + G_CALLBACK(drag_data_received_cb), NULL); +# else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received", GTK_SIGNAL_FUNC(drag_data_received_cb), NULL); +# endif #endif /* With GTK+ 2, we need to iconify the window before calling show() @@ -3884,7 +4845,8 @@ gui_mch_set_winpos(int x, int y) gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); } -#if 0 +#if !GTK_CHECK_VERSION(3,0,0) +# if 0 static int resize_idle_installed = FALSE; /* * Idle handler to force resize. Used by gui_mch_set_shellsize() to ensure @@ -3920,35 +4882,43 @@ force_shell_resize_idle(gpointer data) resize_idle_installed = FALSE; return FALSE; /* don't call me again */ } -#endif +# endif +#endif /* !GTK_CHECK_VERSION(3,0,0) */ /* * Return TRUE if the main window is maximized. */ int -gui_mch_maximized() +gui_mch_maximized(void) { +#if GTK_CHECK_VERSION(3,0,0) + return (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL + && (gdk_window_get_state(gtk_widget_get_window(gui.mainwin)) + & GDK_WINDOW_STATE_MAXIMIZED)); +#else return (gui.mainwin != NULL && gui.mainwin->window != NULL && (gdk_window_get_state(gui.mainwin->window) & GDK_WINDOW_STATE_MAXIMIZED)); +#endif } /* * Unmaximize the main window */ void -gui_mch_unmaximize() +gui_mch_unmaximize(void) { if (gui.mainwin != NULL) gtk_window_unmaximize(GTK_WINDOW(gui.mainwin)); } /* - * Called when the font changed while the window is maximized. Compute the - * new Rows and Columns. This is like resizing the window. + * Called when the font changed while the window is maximized or GO_KEEPWINSIZE + * is set. Compute the new Rows and Columns. This is like resizing the + * window. */ void -gui_mch_newfont() +gui_mch_newfont(void) { int w, h; @@ -3985,14 +4955,16 @@ gui_mch_set_shellsize(int width, int height, else update_window_manager_hints(width, height); -# if 0 +# if !GTK_CHECK_VERSION(3,0,0) +# if 0 if (!resize_idle_installed) { g_idle_add_full(GDK_PRIORITY_EVENTS + 10, &force_shell_resize_idle, NULL, NULL); resize_idle_installed = TRUE; } -# endif +# endif +# endif /* !GTK_CHECK_VERSION(3,0,0) */ /* * Wait until all events are processed to prevent a crash because the * real size of the drawing area doesn't reflect Vim's internal ideas. @@ -4003,6 +4975,29 @@ gui_mch_set_shellsize(int width, int height, gui_mch_update(); } + void +gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height) +{ +#if GTK_CHECK_VERSION(3,22,0) + GdkDisplay *dpy = gtk_widget_get_display(wid); + GdkWindow *win = gtk_widget_get_window(wid); + GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); + GdkRectangle geometry; + + gdk_monitor_get_geometry(monitor, &geometry); + *width = geometry.width; + *height = geometry.height; +#else + GdkScreen* screen; + + if (wid != NULL && gtk_widget_has_screen(wid)) + screen = gtk_widget_get_screen(wid); + else + screen = gdk_screen_get_default(); + *width = gdk_screen_get_width(screen); + *height = gdk_screen_get_height(screen); +#endif +} /* * The screen size is used to make sure the initial window doesn't get bigger @@ -4012,22 +5007,11 @@ gui_mch_set_shellsize(int width, int height, void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) { -#ifdef HAVE_GTK_MULTIHEAD - GdkScreen* screen; - - if (gui.mainwin != NULL && gtk_widget_has_screen(gui.mainwin)) - screen = gtk_widget_get_screen(gui.mainwin); - else - screen = gdk_screen_get_default(); + gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h); - *screen_w = gdk_screen_get_width(screen); - *screen_h = gdk_screen_get_height(screen) - p_ghr; -#else - *screen_w = gdk_screen_width(); /* Subtract 'guiheadroom' from the height to allow some room for the * window manager (task list and window title bar). */ - *screen_h = gdk_screen_height() - p_ghr; -#endif + *screen_h -= p_ghr; /* * FIXME: dirty trick: Because the gui_get_base_height() doesn't include @@ -4067,7 +5051,11 @@ gui_mch_enable_menu(int showit) widget = gui.menubar; /* Do not disable the menu while starting up, otherwise F10 doesn't work. */ +# if GTK_CHECK_VERSION(3,0,0) + if (!showit != !gtk_widget_get_visible(widget) && !gui.starting) +# else if (!showit != !GTK_WIDGET_VISIBLE(widget) && !gui.starting) +# endif { if (showit) gtk_widget_show(widget); @@ -4098,7 +5086,11 @@ gui_mch_show_toolbar(int showit) if (showit) set_toolbar_style(GTK_TOOLBAR(gui.toolbar)); +# if GTK_CHECK_VERSION(3,0,0) + if (!showit != !gtk_widget_get_visible(widget)) +# else if (!showit != !GTK_WIDGET_VISIBLE(widget)) +# endif { if (showit) gtk_widget_show(widget); @@ -4183,6 +5175,17 @@ gui_mch_adjust_charheight(void) return OK; } +#if GTK_CHECK_VERSION(3,0,0) +/* Callback function used in gui_mch_font_dialog() */ + static gboolean +font_filter(const PangoFontFamily *family, + const PangoFontFace *face UNUSED, + gpointer data UNUSED) +{ + return pango_font_family_is_monospace((PangoFontFamily *)family); +} +#endif + /* * Put up a font dialog and return the selected font name in allocated memory. * "oldval" is the previous value. Return NULL when cancelled. @@ -4200,7 +5203,13 @@ gui_mch_font_dialog(char_u *oldval) char_u *fontname = NULL; char_u *oldname; +#if GTK_CHECK_VERSION(3,2,0) + dialog = gtk_font_chooser_dialog_new(NULL, NULL); + gtk_font_chooser_set_filter_func(GTK_FONT_CHOOSER(dialog), font_filter, + NULL, NULL); +#else dialog = gtk_font_selection_dialog_new(NULL); +#endif gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gui.mainwin)); gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); @@ -4227,15 +5236,25 @@ gui_mch_font_dialog(char_u *oldval) } } +#if GTK_CHECK_VERSION(3,2,0) + gtk_font_chooser_set_font( + GTK_FONT_CHOOSER(dialog), (const gchar *)oldname); +#else gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG(dialog), (const char *)oldname); +#endif if (oldname != oldval) vim_free(oldname); } else +#if GTK_CHECK_VERSION(3,2,0) + gtk_font_chooser_set_font( + GTK_FONT_CHOOSER(dialog), DEFAULT_FONT); +#else gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG(dialog), DEFAULT_FONT); +#endif response = gtk_dialog_run(GTK_DIALOG(dialog)); @@ -4243,8 +5262,12 @@ gui_mch_font_dialog(char_u *oldval) { char *name; +#if GTK_CHECK_VERSION(3,2,0) + name = gtk_font_chooser_get_font(GTK_FONT_CHOOSER(dialog)); +#else name = gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG(dialog)); +#endif if (name != NULL) { char_u *p; @@ -4323,7 +5346,7 @@ static PangoEngineShape *default_shape_engine = NULL; static void ascii_glyph_table_init(void) { - char_u ascii_chars[128]; + char_u ascii_chars[2 * 128]; PangoAttrList *attr_list; GList *item_list; int i; @@ -4336,12 +5359,16 @@ ascii_glyph_table_init(void) gui.ascii_glyphs = NULL; gui.ascii_font = NULL; - /* For safety, fill in question marks for the control characters. */ - for (i = 0; i < 32; ++i) - ascii_chars[i] = '?'; - for (; i < 127; ++i) - ascii_chars[i] = i; - ascii_chars[i] = '?'; + /* For safety, fill in question marks for the control characters. + * Put a space between characters to avoid shaping. */ + for (i = 0; i < 128; ++i) + { + if (i >= 32 && i < 127) + ascii_chars[2 * i] = i; + else + ascii_chars[2 * i] = '?'; + ascii_chars[2 * i + 1] = ' '; + } attr_list = pango_attr_list_new(); item_list = pango_itemize(gui.text_context, (const char *)ascii_chars, @@ -4573,81 +5600,56 @@ gui_mch_free_font(GuiFont font) } /* - * Return the Pixel value (color) for the given color name. This routine was - * pretty much taken from example code in the Silicon Graphics OSF/Motif - * Programmer's Guide. + * Return the Pixel value (color) for the given color name. + * * Return INVALCOLOR for error. */ guicolor_T gui_mch_get_color(char_u *name) { - /* A number of colors that some X11 systems don't have */ - static const char *const vimnames[][2] = - { - {"LightRed", "#FFBBBB"}, - {"LightGreen", "#88FF88"}, - {"LightMagenta","#FFBBFF"}, - {"DarkCyan", "#008888"}, - {"DarkBlue", "#0000BB"}, - {"DarkRed", "#BB0000"}, - {"DarkMagenta", "#BB00BB"}, - {"DarkGrey", "#BBBBBB"}, - {"DarkYellow", "#BBBB00"}, - {"Gray10", "#1A1A1A"}, - {"Grey10", "#1A1A1A"}, - {"Gray20", "#333333"}, - {"Grey20", "#333333"}, - {"Gray30", "#4D4D4D"}, - {"Grey30", "#4D4D4D"}, - {"Gray40", "#666666"}, - {"Grey40", "#666666"}, - {"Gray50", "#7F7F7F"}, - {"Grey50", "#7F7F7F"}, - {"Gray60", "#999999"}, - {"Grey60", "#999999"}, - {"Gray70", "#B3B3B3"}, - {"Grey70", "#B3B3B3"}, - {"Gray80", "#CCCCCC"}, - {"Grey80", "#CCCCCC"}, - {"Gray90", "#E5E5E5"}, - {"Grey90", "#E5E5E5"}, - {NULL, NULL} - }; + guicolor_T color = INVALCOLOR; if (!gui.in_use) /* can't do this when GUI not running */ + return color; + + if (name != NULL) + color = gui_get_color_cmn(name); + +#if GTK_CHECK_VERSION(3,0,0) + return color; +#else + if (color == INVALCOLOR) return INVALCOLOR; - while (name != NULL) - { - GdkColor color; - int parsed; - int i; + return gui_mch_get_rgb_color( + (color & 0xff0000) >> 16, + (color & 0xff00) >> 8, + color & 0xff); +#endif +} - parsed = gdk_color_parse((const char *)name, &color); +/* + * Return the Pixel value (color) for the given RGB values. + * Return INVALCOLOR for error. + */ + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ +#if GTK_CHECK_VERSION(3,0,0) + return gui_get_rgb_color_cmn(r, g, b); +#else + GdkColor gcolor; + int ret; - if (parsed) - { - gdk_colormap_alloc_color(gtk_widget_get_colormap(gui.drawarea), - &color, FALSE, TRUE); - return (guicolor_T)color.pixel; - } - /* add a few builtin names and try again */ - for (i = 0; ; ++i) - { - if (vimnames[i][0] == NULL) - { - name = NULL; - break; - } - if (STRICMP(name, vimnames[i][0]) == 0) - { - name = (char_u *)vimnames[i][1]; - break; - } - } - } + gcolor.red = (guint16)(r / 255.0 * 65535 + 0.5); + gcolor.green = (guint16)(g / 255.0 * 65535 + 0.5); + gcolor.blue = (guint16)(b / 255.0 * 65535 + 0.5); - return INVALCOLOR; + ret = gdk_colormap_alloc_color(gtk_widget_get_colormap(gui.drawarea), + &gcolor, FALSE, TRUE); + + return ret != 0 ? (guicolor_T)gcolor.pixel : INVALCOLOR; +#endif } /* @@ -4656,7 +5658,11 @@ gui_mch_get_color(char_u *name) void gui_mch_set_fg_color(guicolor_T color) { +#if GTK_CHECK_VERSION(3,0,0) + *gui.fgcolor = color_to_rgba(color); +#else gui.fgcolor->pixel = (unsigned long)color; +#endif } /* @@ -4665,7 +5671,11 @@ gui_mch_set_fg_color(guicolor_T color) void gui_mch_set_bg_color(guicolor_T color) { +#if GTK_CHECK_VERSION(3,0,0) + *gui.bgcolor = color_to_rgba(color); +#else gui.bgcolor->pixel = (unsigned long)color; +#endif } /* @@ -4674,7 +5684,11 @@ gui_mch_set_bg_color(guicolor_T color) void gui_mch_set_sp_color(guicolor_T color) { +#if GTK_CHECK_VERSION(3,0,0) + *gui.spcolor = color_to_rgba(color); +#else gui.spcolor->pixel = (unsigned long)color; +#endif } /* @@ -4821,12 +5835,28 @@ setup_zero_width_cluster(PangoItem *item, PangoGlyphInfo *glyph, glyph->geometry.x_offset = -width + MAX(0, width - ink_rect.width) / 2; } +#if GTK_CHECK_VERSION(3,0,0) + static void +draw_glyph_string(int row, int col, int num_cells, int flags, + PangoFont *font, PangoGlyphString *glyphs, + cairo_t *cr) +#else static void draw_glyph_string(int row, int col, int num_cells, int flags, PangoFont *font, PangoGlyphString *glyphs) +#endif { if (!(flags & DRAW_TRANSP)) { +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_source_rgba(cr, + gui.bgcolor->red, gui.bgcolor->green, gui.bgcolor->blue, + gui.bgcolor->alpha); + cairo_rectangle(cr, + FILL_X(col), FILL_Y(row), + num_cells * gui.char_width, gui.char_height); + cairo_fill(cr); +#else gdk_gc_set_foreground(gui.text_gc, gui.bgcolor); gdk_draw_rectangle(gui.drawarea->window, @@ -4836,8 +5866,16 @@ draw_glyph_string(int row, int col, int num_cells, int flags, FILL_Y(row), num_cells * gui.char_width, gui.char_height); +#endif } +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); + cairo_move_to(cr, TEXT_X(col), TEXT_Y(row)); + pango_cairo_show_glyph_string(cr, font, glyphs); +#else gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); gdk_draw_glyphs(gui.drawarea->window, @@ -4846,22 +5884,38 @@ draw_glyph_string(int row, int col, int num_cells, int flags, TEXT_X(col), TEXT_Y(row), glyphs); +#endif /* redraw the contents with an offset of 1 to emulate bold */ if ((flags & DRAW_BOLD) && !gui.font_can_bold) +#if GTK_CHECK_VERSION(3,0,0) + { + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); + cairo_move_to(cr, TEXT_X(col) + 1, TEXT_Y(row)); + pango_cairo_show_glyph_string(cr, font, glyphs); + } +#else gdk_draw_glyphs(gui.drawarea->window, gui.text_gc, font, TEXT_X(col) + 1, TEXT_Y(row), glyphs); +#endif } /* * Draw underline and undercurl at the bottom of the character cell. */ +#if GTK_CHECK_VERSION(3,0,0) + static void +draw_under(int flags, int row, int col, int cells, cairo_t *cr) +#else static void draw_under(int flags, int row, int col, int cells) +#endif { int i; int offset; @@ -4871,6 +5925,19 @@ draw_under(int flags, int row, int col, int cells) /* Undercurl: draw curl at the bottom of the character cell. */ if (flags & DRAW_UNDERC) { +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_line_width(cr, 1.0); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); + cairo_set_source_rgba(cr, + gui.spcolor->red, gui.spcolor->green, gui.spcolor->blue, + gui.spcolor->alpha); + for (i = FILL_X(col); i < FILL_X(col + cells); ++i) + { + offset = val[i % 8]; + cairo_line_to(cr, i, y - offset + 0.5); + } + cairo_stroke(cr); +#else gdk_gc_set_foreground(gui.text_gc, gui.spcolor); for (i = FILL_X(col); i < FILL_X(col + cells); ++i) { @@ -4878,6 +5945,28 @@ draw_under(int flags, int row, int col, int cells) gdk_draw_point(gui.drawarea->window, gui.text_gc, i, y - offset); } gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); +#endif + } + + /* Draw a strikethrough line */ + if (flags & DRAW_STRIKE) + { +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_line_width(cr, 1.0); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); + cairo_set_source_rgba(cr, + gui.spcolor->red, gui.spcolor->green, gui.spcolor->blue, + gui.spcolor->alpha); + cairo_move_to(cr, FILL_X(col), y + 1 - gui.char_height/2 + 0.5); + cairo_line_to(cr, FILL_X(col + cells), y + 1 - gui.char_height/2 + 0.5); + cairo_stroke(cr); +#else + gdk_gc_set_foreground(gui.text_gc, gui.spcolor); + gdk_draw_line(gui.drawarea->window, gui.text_gc, + FILL_X(col), y + 1 - gui.char_height/2, + FILL_X(col + cells), y + 1 - gui.char_height/2); + gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); +#endif } /* Underline: draw a line at the bottom of the character cell. */ @@ -4887,9 +5976,20 @@ draw_under(int flags, int row, int col, int cells) * Otherwise put the line just below the character. */ if (p_linespace > 1) y -= p_linespace - 1; +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_line_width(cr, 1.0); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); + cairo_move_to(cr, FILL_X(col), y + 0.5); + cairo_line_to(cr, FILL_X(col + cells), y + 0.5); + cairo_stroke(cr); +#else gdk_draw_line(gui.drawarea->window, gui.text_gc, FILL_X(col), y, FILL_X(col + cells) - 1, y); +#endif } } @@ -4905,8 +6005,15 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) int convlen; char_u *sp, *bp; int plen; +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr; +#endif +#if GTK_CHECK_VERSION(3,0,0) + if (gui.text_context == NULL || gtk_widget_get_window(gui.drawarea) == NULL) +#else if (gui.text_context == NULL || gui.drawarea->window == NULL) +#endif return len; if (output_conv.vc_type != CONV_NONE) @@ -4959,8 +6066,14 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) area.width = gui.num_cols * gui.char_width; area.height = gui.char_height; +#if GTK_CHECK_VERSION(3,0,0) + cr = cairo_create(gui.surface); + cairo_rectangle(cr, area.x, area.y, area.width, area.height); + cairo_clip(cr); +#else gdk_gc_set_clip_origin(gui.text_gc, 0, 0); gdk_gc_set_clip_rectangle(gui.text_gc, &area); +#endif glyphs = pango_glyph_string_new(); @@ -4983,11 +6096,15 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) for (i = 0; i < len; ++i) { - glyphs->glyphs[i] = gui.ascii_glyphs->glyphs[s[i]]; + glyphs->glyphs[i] = gui.ascii_glyphs->glyphs[2 * s[i]]; glyphs->log_clusters[i] = i; } +#if GTK_CHECK_VERSION(3,0,0) + draw_glyph_string(row, col, len, flags, gui.ascii_font, glyphs, cr); +#else draw_glyph_string(row, col, len, flags, gui.ascii_font, glyphs); +#endif column_offset = len; } @@ -5061,8 +6178,13 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) * done, because drawing the cursor would change the display. */ item->analysis.shape_engine = default_shape_engine; +#ifdef HAVE_PANGO_SHAPE_FULL + pango_shape_full((const char *)s + item->offset, item->length, + (const char *)s, len, &item->analysis, glyphs); +#else pango_shape((const char *)s + item->offset, item->length, &item->analysis, glyphs); +#endif /* * Fixed-width hack: iterate over the array and assign a fixed * width to each glyph, thus overriding the choice made by the @@ -5140,8 +6262,14 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) } /*** Aaaaand action! ***/ +#if GTK_CHECK_VERSION(3,0,0) + draw_glyph_string(row, col + column_offset, item_cells, + flags, item->analysis.font, glyphs, + cr); +#else draw_glyph_string(row, col + column_offset, item_cells, flags, item->analysis.font, glyphs); +#endif pango_item_free(item); @@ -5153,12 +6281,23 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) skipitall: /* Draw underline and undercurl. */ +#if GTK_CHECK_VERSION(3,0,0) + draw_under(flags, row, col, column_offset, cr); +#else draw_under(flags, row, col, column_offset); +#endif pango_glyph_string_free(glyphs); vim_free(conv_buf); +#if GTK_CHECK_VERSION(3,0,0) + cairo_destroy(cr); + if (!gui.by_signal) + gdk_window_invalidate_rect(gtk_widget_get_window(gui.drawarea), + &area, FALSE); +#else gdk_gc_set_clip_rectangle(gui.text_gc, NULL); +#endif return column_offset; } @@ -5185,10 +6324,19 @@ gui_mch_haskey(char_u *name) int gui_get_x11_windis(Window *win, Display **dis) { +#if GTK_CHECK_VERSION(3,0,0) + if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL) +#else if (gui.mainwin != NULL && gui.mainwin->window != NULL) +#endif { +#if GTK_CHECK_VERSION(3,0,0) + *dis = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)); + *win = GDK_WINDOW_XID(gtk_widget_get_window(gui.mainwin)); +#else *dis = GDK_WINDOW_XDISPLAY(gui.mainwin->window); *win = GDK_WINDOW_XWINDOW(gui.mainwin->window); +#endif return OK; } @@ -5204,8 +6352,13 @@ gui_get_x11_windis(Window *win, Display **dis) Display * gui_mch_get_display(void) { +#if GTK_CHECK_VERSION(3,0,0) + if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL) + return GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)); +#else if (gui.mainwin != NULL && gui.mainwin->window != NULL) return GDK_WINDOW_XDISPLAY(gui.mainwin->window); +#endif else return NULL; } @@ -5214,24 +6367,28 @@ gui_mch_get_display(void) void gui_mch_beep(void) { -#ifdef HAVE_GTK_MULTIHEAD GdkDisplay *display; +#if GTK_CHECK_VERSION(3,0,0) + if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin)) +#else if (gui.mainwin != NULL && GTK_WIDGET_REALIZED(gui.mainwin)) +#endif display = gtk_widget_get_display(gui.mainwin); else display = gdk_display_get_default(); if (display != NULL) gdk_display_beep(display); -#else - gdk_beep(); -#endif } void gui_mch_flash(int msec) { +#if GTK_CHECK_VERSION(3,0,0) + /* TODO Replace GdkGC with Cairo */ + (void)msec; +#else GdkGCValues values; GdkGC *invert_gc; @@ -5271,6 +6428,7 @@ gui_mch_flash(int msec) FILL_Y((int)Rows) + gui.border_offset); gdk_gc_destroy(invert_gc); +#endif } /* @@ -5279,6 +6437,27 @@ gui_mch_flash(int msec) void gui_mch_invert_rectangle(int r, int c, int nr, int nc) { +#if GTK_CHECK_VERSION(3,0,0) + const GdkRectangle rect = { + FILL_X(c), FILL_Y(r), nc * gui.char_width, nr * gui.char_height + }; + cairo_t * const cr = cairo_create(gui.surface); + + set_cairo_source_rgba_from_color(cr, gui.norm_pixel ^ gui.back_pixel); +# if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,2) + cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE); +# else + /* Give an implementation for older cairo versions if necessary. */ +# endif + gdk_cairo_rectangle(cr, &rect); + cairo_fill(cr); + + cairo_destroy(cr); + + if (!gui.by_signal) + gtk_widget_queue_draw_area(gui.drawarea, rect.x, rect.y, + rect.width, rect.height); +#else GdkGCValues values; GdkGC *invert_gc; @@ -5300,6 +6479,7 @@ gui_mch_invert_rectangle(int r, int c, int nr, int nc) FILL_X(c), FILL_Y(r), (nc) * gui.char_width, (nr) * gui.char_height); gdk_gc_destroy(invert_gc); +#endif } /* @@ -5329,19 +6509,46 @@ gui_mch_set_foreground(void) gui_mch_draw_hollow_cursor(guicolor_T color) { int i = 1; +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr; +#endif +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) == NULL) +#else if (gui.drawarea->window == NULL) +#endif return; +#if GTK_CHECK_VERSION(3,0,0) + cr = cairo_create(gui.surface); +#endif + gui_mch_set_fg_color(color); +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); +#else gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); +#endif if (mb_lefthalve(gui.row, gui.col)) i = 2; +#if GTK_CHECK_VERSION(3,0,0) + cairo_set_line_width(cr, 1.0); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); + cairo_rectangle(cr, + FILL_X(gui.col) + 0.5, FILL_Y(gui.row) + 0.5, + i * gui.char_width - 1, gui.char_height - 1); + cairo_stroke(cr); + cairo_destroy(cr); +#else gdk_draw_rectangle(gui.drawarea->window, gui.text_gc, FALSE, FILL_X(gui.col), FILL_Y(gui.row), i * gui.char_width - 1, gui.char_height - 1); +#endif } /* @@ -5351,21 +6558,45 @@ gui_mch_draw_hollow_cursor(guicolor_T color) void gui_mch_draw_part_cursor(int w, int h, guicolor_T color) { +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) == NULL) +#else if (gui.drawarea->window == NULL) +#endif return; gui_mch_set_fg_color(color); +#if GTK_CHECK_VERSION(3,0,0) + { + cairo_t *cr; + + cr = cairo_create(gui.surface); + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); + cairo_rectangle(cr, +# ifdef FEAT_RIGHTLEFT + /* vertical line should be on the right of current point */ + CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : +# endif + FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h, + w, h); + cairo_fill(cr); + cairo_destroy(cr); + } +#else /* !GTK_CHECK_VERSION(3,0,0) */ gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); gdk_draw_rectangle(gui.drawarea->window, gui.text_gc, TRUE, -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT /* vertical line should be on the right of current point */ CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : -#endif +# endif FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h, w, h); +#endif /* !GTK_CHECK_VERSION(3,0,0) */ } @@ -5382,7 +6613,7 @@ gui_mch_update(void) g_main_context_iteration(NULL, TRUE); } - static gint + static timeout_cb_type input_timer_cb(gpointer data) { int *timed_out = (int *) data; @@ -5393,19 +6624,16 @@ input_timer_cb(gpointer data) return FALSE; /* don't happen again */ } -#ifdef FEAT_SNIFF -/* - * Callback function, used when data is available on the SNiFF connection. - */ - static void -sniff_request_cb( - gpointer data, - gint source_fd, - GdkInputCondition condition) +#ifdef FEAT_JOB_CHANNEL + static timeout_cb_type +channel_poll_cb(gpointer data UNUSED) { - static char_u bytes[3] = {CSI, (int)KS_EXTRA, (int)KE_SNIFF}; + /* Using an event handler for a channel that may be disconnected does + * not work, it hangs. Instead poll for messages. */ + channel_handle_events(TRUE); + parse_queued_messages(); - add_to_input_buf(bytes, 3); + return TRUE; /* repeat */ } #endif @@ -5421,40 +6649,30 @@ sniff_request_cb( int gui_mch_wait_for_chars(long wtime) { - int focus; - guint timer; - static int timed_out; -#ifdef FEAT_SNIFF - static int sniff_on = 0; - static gint sniff_input_id = 0; -#endif - -#ifdef FEAT_SNIFF - if (sniff_on && !want_sniff_request) - { - if (sniff_input_id) - gdk_input_remove(sniff_input_id); - sniff_on = 0; - } - else if (!sniff_on && want_sniff_request) - { - /* Add fd_from_sniff to watch for available data in main loop. */ - sniff_input_id = gdk_input_add(fd_from_sniff, - GDK_INPUT_READ, sniff_request_cb, NULL); - sniff_on = 1; - } + int focus; + guint timer; + static int timed_out; + int retval = FAIL; +#ifdef FEAT_JOB_CHANNEL + guint channel_timer = 0; #endif timed_out = FALSE; /* this timeout makes sure that we will return if no characters arrived in * time */ - if (wtime > 0) - timer = gtk_timeout_add((guint32)wtime, input_timer_cb, &timed_out); + timer = timeout_add(wtime, input_timer_cb, &timed_out); else timer = 0; +#ifdef FEAT_JOB_CHANNEL + /* If there is a channel with the keep_open flag we need to poll for input + * on them. */ + if (channel_any_keep_open()) + channel_timer = timeout_add(20, channel_poll_cb, NULL); +#endif + focus = gui.in_focus; do @@ -5465,13 +6683,20 @@ gui_mch_wait_for_chars(long wtime) if (gui.in_focus) gui_mch_start_blink(); else - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); focus = gui.in_focus; } -#if defined(FEAT_NETBEANS_INTG) - /* Process any queued netbeans messages. */ - netbeans_parse_messages(); +#ifdef MESSAGE_QUEUE +# ifdef FEAT_TIMERS + did_add_timer = FALSE; +# endif + parse_queued_messages(); +# ifdef FEAT_TIMERS + if (did_add_timer) + /* Need to recompute the waiting time. */ + goto theend; +# endif #endif /* @@ -5485,9 +6710,8 @@ gui_mch_wait_for_chars(long wtime) /* Got char, return immediately */ if (input_available()) { - if (timer != 0 && !timed_out) - gtk_timeout_remove(timer); - return OK; + retval = OK; + goto theend; } } while (wtime < 0 || !timed_out); @@ -5496,7 +6720,15 @@ gui_mch_wait_for_chars(long wtime) */ gui_mch_update(); - return FAIL; +theend: + if (timer != 0 && !timed_out) + timeout_remove(timer); +#ifdef FEAT_JOB_CHANNEL + if (channel_timer != 0) + timeout_remove(channel_timer); +#endif + + return retval; } @@ -5509,16 +6741,12 @@ gui_mch_wait_for_chars(long wtime) void gui_mch_flush(void) { -#ifdef HAVE_GTK_MULTIHEAD - if (gui.mainwin != NULL && GTK_WIDGET_REALIZED(gui.mainwin)) - gdk_display_sync(gtk_widget_get_display(gui.mainwin)); +#if GTK_CHECK_VERSION(3,0,0) + if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin)) #else - gdk_flush(); /* historical misnomer: calls XSync(), not XFlush() */ + if (gui.mainwin != NULL && GTK_WIDGET_REALIZED(gui.mainwin)) #endif - /* This happens to actually do what gui_mch_flush() is supposed to do, - * according to the comment above. */ - if (gui.drawarea != NULL && gui.drawarea->window != NULL) - gdk_window_process_updates(gui.drawarea->window, FALSE); + gdk_display_flush(gtk_widget_get_display(gui.mainwin)); } /* @@ -5526,15 +6754,54 @@ gui_mch_flush(void) * (row2, col2) inclusive. */ void -gui_mch_clear_block(int row1, int col1, int row2, int col2) +gui_mch_clear_block(int row1arg, int col1arg, int row2arg, int col2arg) { + + int col1 = check_col(col1arg); + int col2 = check_col(col2arg); + int row1 = check_row(row1arg); + int row2 = check_row(row2arg); + +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) == NULL) + return; +#else GdkColor color; if (gui.drawarea->window == NULL) return; color.pixel = gui.back_pixel; +#endif +#if GTK_CHECK_VERSION(3,0,0) + { + /* Add one pixel to the far right column in case a double-stroked + * bold glyph may sit there. */ + const GdkRectangle rect = { + FILL_X(col1), FILL_Y(row1), + (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1), + (row2 - row1 + 1) * gui.char_height + }; + GdkWindow * const win = gtk_widget_get_window(gui.drawarea); + cairo_t * const cr = cairo_create(gui.surface); +# if GTK_CHECK_VERSION(3,22,2) + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# else + cairo_pattern_t * const pat = gdk_window_get_background_pattern(win); + if (pat != NULL) + cairo_set_source(cr, pat); + else + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# endif + gdk_cairo_rectangle(cr, &rect); + cairo_fill(cr); + cairo_destroy(cr); + + if (!gui.by_signal) + gdk_window_invalidate_rect(win, &rect, FALSE); + } +#else /* !GTK_CHECK_VERSION(3,0,0) */ gdk_gc_set_foreground(gui.text_gc, &color); /* Clear one extra pixel at the far right, for when bold characters have @@ -5544,15 +6811,48 @@ gui_mch_clear_block(int row1, int col1, int row2, int col2) (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1), (row2 - row1 + 1) * gui.char_height); +#endif /* !GTK_CHECK_VERSION(3,0,0) */ +} + +#if GTK_CHECK_VERSION(3,0,0) + static void +gui_gtk_window_clear(GdkWindow *win) +{ + const GdkRectangle rect = { + 0, 0, gdk_window_get_width(win), gdk_window_get_height(win) + }; + cairo_t * const cr = cairo_create(gui.surface); +# if GTK_CHECK_VERSION(3,22,2) + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# else + cairo_pattern_t * const pat = gdk_window_get_background_pattern(win); + if (pat != NULL) + cairo_set_source(cr, pat); + else + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# endif + gdk_cairo_rectangle(cr, &rect); + cairo_fill(cr); + cairo_destroy(cr); + + if (!gui.by_signal) + gdk_window_invalidate_rect(win, &rect, FALSE); } +#endif void gui_mch_clear_all(void) { +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) != NULL) + gui_gtk_window_clear(gtk_widget_get_window(gui.drawarea)); +#else if (gui.drawarea->window != NULL) gdk_window_clear(gui.drawarea->window); +#endif } +#if !GTK_CHECK_VERSION(3,0,0) /* * Redraw any text revealed by scrolling up/down. */ @@ -5569,7 +6869,7 @@ check_copy_area(void) * we don't want it to be. I'm not sure if it's correct to call * gui_dont_update_cursor() at this point but it works as a quick * fix for now. */ - gui_dont_update_cursor(); + gui_dont_update_cursor(TRUE); do { @@ -5589,6 +6889,27 @@ check_copy_area(void) gui_can_update_cursor(); } +#endif /* !GTK_CHECK_VERSION(3,0,0) */ + +#if GTK_CHECK_VERSION(3,0,0) + static void +gui_gtk_surface_copy_rect(int dest_x, int dest_y, + int src_x, int src_y, + int width, int height) +{ + cairo_t * const cr = cairo_create(gui.surface); + + cairo_rectangle(cr, dest_x, dest_y, width, height); + cairo_clip(cr); + cairo_push_group(cr); + cairo_set_source_surface(cr, gui.surface, dest_x - src_x, dest_y - src_y); + cairo_paint(cr); + cairo_pop_group_to_source(cr); + cairo_paint(cr); + + cairo_destroy(cr); +} +#endif /* * Delete the given number of lines from the given row, scrolling up any @@ -5597,6 +6918,26 @@ check_copy_area(void) void gui_mch_delete_lines(int row, int num_lines) { +#if GTK_CHECK_VERSION(3,0,0) + const int ncols = gui.scroll_region_right - gui.scroll_region_left + 1; + const int nrows = gui.scroll_region_bot - row + 1; + const int src_nrows = nrows - num_lines; + + gui_gtk_surface_copy_rect( + FILL_X(gui.scroll_region_left), FILL_Y(row), + FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), + gui.char_width * ncols + 1, gui.char_height * src_nrows); + gui_clear_block( + gui.scroll_region_bot - num_lines + 1, gui.scroll_region_left, + gui.scroll_region_bot, gui.scroll_region_right); + gui_gtk3_redraw( + FILL_X(gui.scroll_region_left), FILL_Y(row), + gui.char_width * ncols + 1, gui.char_height * nrows); + if (!gui.by_signal) + gtk_widget_queue_draw_area(gui.drawarea, + FILL_X(gui.scroll_region_left), FILL_Y(row), + gui.char_width * ncols + 1, gui.char_height * nrows); +#else if (gui.visibility == GDK_VISIBILITY_FULLY_OBSCURED) return; /* Can't see the window */ @@ -5617,6 +6958,7 @@ gui_mch_delete_lines(int row, int num_lines) gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right); check_copy_area(); +#endif /* !GTK_CHECK_VERSION(3,0,0) */ } /* @@ -5626,6 +6968,26 @@ gui_mch_delete_lines(int row, int num_lines) void gui_mch_insert_lines(int row, int num_lines) { +#if GTK_CHECK_VERSION(3,0,0) + const int ncols = gui.scroll_region_right - gui.scroll_region_left + 1; + const int nrows = gui.scroll_region_bot - row + 1; + const int src_nrows = nrows - num_lines; + + gui_gtk_surface_copy_rect( + FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), + FILL_X(gui.scroll_region_left), FILL_Y(row), + gui.char_width * ncols + 1, gui.char_height * src_nrows); + gui_mch_clear_block( + row, gui.scroll_region_left, + row + num_lines - 1, gui.scroll_region_right); + gui_gtk3_redraw( + FILL_X(gui.scroll_region_left), FILL_Y(row), + gui.char_width * ncols + 1, gui.char_height * nrows); + if (!gui.by_signal) + gtk_widget_queue_draw_area(gui.drawarea, + FILL_X(gui.scroll_region_left), FILL_Y(row), + gui.char_width * ncols + 1, gui.char_height * nrows); +#else if (gui.visibility == GDK_VISIBILITY_FULLY_OBSCURED) return; /* Can't see the window */ @@ -5644,6 +7006,7 @@ gui_mch_insert_lines(int row, int num_lines) gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right); check_copy_area(); +#endif /* !GTK_CHECK_VERSION(3,0,0) */ } /* @@ -5679,7 +7042,12 @@ clip_mch_request_selection(VimClipboard *cbd) } /* Final fallback position - use the X CUT_BUFFER0 store */ +#if GTK_CHECK_VERSION(3,0,0) + yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)), + cbd); +#else yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gui.mainwin->window), cbd); +#endif } /* @@ -5688,8 +7056,11 @@ clip_mch_request_selection(VimClipboard *cbd) void clip_mch_lose_selection(VimClipboard *cbd UNUSED) { - gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); - gui_mch_update(); + if (!in_selection_clear_event) + { + gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); + gui_mch_update(); + } } /* @@ -5737,7 +7108,11 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey) gui_mch_menu_hidden(menu, FALSE); /* Be clever about bitfields versus true booleans here! */ +# if GTK_CHECK_VERSION(3,0,0) + if (!gtk_widget_get_sensitive(menu->id) == !grey) +# else if (!GTK_WIDGET_SENSITIVE(menu->id) == !grey) +# endif { gtk_widget_set_sensitive(menu->id, !grey); gui_mch_update(); @@ -5755,7 +7130,11 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden) if (hidden) { +# if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_visible(menu->id)) +# else if (GTK_WIDGET_VISIBLE(menu->id)) +# endif { gtk_widget_hide(menu->id); gui_mch_update(); @@ -5763,7 +7142,11 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden) } else { +# if GTK_CHECK_VERSION(3,0,0) + if (!gtk_widget_get_visible(menu->id)) +# else if (!GTK_WIDGET_VISIBLE(menu->id)) +# endif { gtk_widget_show(menu->id); gui_mch_update(); @@ -5791,10 +7174,14 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag) if (sb->id == NULL) return; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_visible(sb->id, flag); +#else if (flag) gtk_widget_show(sb->id); else gtk_widget_hide(sb->id); +#endif update_window_manager_hints(0, 0); } @@ -5803,16 +7190,22 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag) /* * Return the RGB value of a pixel as long. */ - long_u + guicolor_T gui_mch_get_rgb(guicolor_T pixel) { +#if GTK_CHECK_VERSION(3,0,0) + return (long_u)pixel; +#else GdkColor color; + gdk_colormap_query_color(gtk_widget_get_colormap(gui.drawarea), (unsigned long)pixel, &color); - return (((unsigned)color.red & 0xff00) << 8) + return (guicolor_T)( + (((unsigned)color.red & 0xff00) << 8) | ((unsigned)color.green & 0xff00) - | (((unsigned)color.blue & 0xff00) >> 8); + | (((unsigned)color.blue & 0xff00) >> 8)); +#endif } /* @@ -5821,7 +7214,11 @@ gui_mch_get_rgb(guicolor_T pixel) void gui_mch_getmouse(int *x, int *y) { +#if GTK_CHECK_VERSION(3,0,0) + gui_gtk_get_pointer(gui.drawarea, x, y, NULL); +#else gdk_window_get_pointer(gui.drawarea->window, x, y, NULL); +#endif } void @@ -5830,9 +7227,15 @@ gui_mch_setmouse(int x, int y) /* Sorry for the Xlib call, but we can't avoid it, since there is no * internal GDK mechanism present to accomplish this. (and for good * reason...) */ +#if GTK_CHECK_VERSION(3,0,0) + XWarpPointer(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.drawarea)), + (Window)0, GDK_WINDOW_XID(gtk_widget_get_window(gui.drawarea)), + 0, 0, 0U, 0U, x, y); +#else XWarpPointer(GDK_WINDOW_XDISPLAY(gui.drawarea->window), (Window)0, GDK_WINDOW_XWINDOW(gui.drawarea->window), 0, 0, 0U, 0U, x, y); +#endif } @@ -5853,13 +7256,24 @@ gui_mch_mousehide(int hide) if (gui.pointer_hidden != hide) { gui.pointer_hidden = hide; +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL) +#else if (gui.drawarea->window && gui.blank_pointer != NULL) +#endif { if (hide) +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), + gui.blank_pointer); +#else gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer); +#endif else #ifdef FEAT_MOUSESHAPE mch_set_mouse_shape(last_shape); +#elif GTK_CHECK_VERSION(3,0,0) + gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), NULL); #else gdk_window_set_cursor(gui.drawarea->window, NULL); #endif @@ -5898,11 +7312,20 @@ mch_set_mouse_shape(int shape) int id; GdkCursor *c; +# if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_window(gui.drawarea) == NULL) +# else if (gui.drawarea->window == NULL) +# endif return; if (shape == MSHAPE_HIDE || gui.pointer_hidden) +# if GTK_CHECK_VERSION(3,0,0) + gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), + gui.blank_pointer); +# else gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer); +# endif else { if (shape >= MSHAPE_NUMBERED) @@ -5917,14 +7340,18 @@ mch_set_mouse_shape(int shape) id = mshape_ids[shape]; else return; -# ifdef HAVE_GTK_MULTIHEAD c = gdk_cursor_new_for_display( gtk_widget_get_display(gui.drawarea), (GdkCursorType)id); +# if GTK_CHECK_VERSION(3,0,0) + gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), c); # else - c = gdk_cursor_new((GdkCursorType)id); -# endif gdk_window_set_cursor(gui.drawarea->window, c); +# endif +# if GTK_CHECK_VERSION(3,0,0) + g_object_unref(G_OBJECT(c)); +# else gdk_cursor_destroy(c); /* Unref, actually. Bloody GTK+ 1. */ +# endif } if (shape != MSHAPE_HIDE) last_shape = shape; @@ -5951,7 +7378,12 @@ gui_mch_drawsign(int row, int col, int typenr) sign = (GdkPixbuf *)sign_get_image(typenr); +# if GTK_CHECK_VERSION(3,0,0) + if (sign != NULL && gui.drawarea != NULL + && gtk_widget_get_window(gui.drawarea) != NULL) +# else if (sign != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL) +# endif { int width; int height; @@ -6015,6 +7447,51 @@ gui_mch_drawsign(int row, int col, int typenr) xoffset = (width - SIGN_WIDTH) / 2; yoffset = (height - SIGN_HEIGHT) / 2; +# if GTK_CHECK_VERSION(3,0,0) + { + cairo_t *cr; + cairo_surface_t *bg_surf; + cairo_t *bg_cr; + cairo_surface_t *sign_surf; + cairo_t *sign_cr; + + cr = cairo_create(gui.surface); + + bg_surf = cairo_surface_create_similar(gui.surface, + cairo_surface_get_content(gui.surface), + SIGN_WIDTH, SIGN_HEIGHT); + bg_cr = cairo_create(bg_surf); + cairo_set_source_rgba(bg_cr, + gui.bgcolor->red, gui.bgcolor->green, gui.bgcolor->blue, + gui.bgcolor->alpha); + cairo_paint(bg_cr); + + sign_surf = cairo_surface_create_similar(gui.surface, + cairo_surface_get_content(gui.surface), + SIGN_WIDTH, SIGN_HEIGHT); + sign_cr = cairo_create(sign_surf); + gdk_cairo_set_source_pixbuf(sign_cr, sign, -xoffset, -yoffset); + cairo_paint(sign_cr); + + cairo_set_operator(sign_cr, CAIRO_OPERATOR_DEST_OVER); + cairo_set_source_surface(sign_cr, bg_surf, 0, 0); + cairo_paint(sign_cr); + + cairo_set_source_surface(cr, sign_surf, FILL_X(col), FILL_Y(row)); + cairo_paint(cr); + + cairo_destroy(sign_cr); + cairo_surface_destroy(sign_surf); + cairo_destroy(bg_cr); + cairo_surface_destroy(bg_surf); + cairo_destroy(cr); + + if (!gui.by_signal) + gtk_widget_queue_draw_area(gui.drawarea, + FILL_X(col), FILL_Y(col), width, height); + + } +# else /* !GTK_CHECK_VERSION(3,0,0) */ gdk_gc_set_foreground(gui.text_gc, gui.bgcolor); gdk_draw_rectangle(gui.drawarea->window, @@ -6037,6 +7514,7 @@ gui_mch_drawsign(int row, int col, int typenr) 127, GDK_RGB_DITHER_NORMAL, 0, 0); +# endif /* !GTK_CHECK_VERSION(3,0,0) */ if (need_scale) g_object_unref(sign); } diff --git a/src/gui_mac.c b/src/gui_mac.c index 54087c518b..6927246879 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -61,13 +61,13 @@ SInt32 gMacSystemVersion; # define USE_CARBONKEYHANDLER static int im_is_active = FALSE; -#if 0 +# if 0 /* TODO: Implement me! */ static int im_start_row = 0; static int im_start_col = 0; -#endif +# endif -#define NR_ELEMS(x) (sizeof(x) / sizeof(x[0])) +# define NR_ELEMS(x) (sizeof(x) / sizeof(x[0])) static TSMDocumentID gTSMDocument; @@ -267,9 +267,7 @@ static struct /* {XK_Help, '%', '1'}, */ /* {XK_Undo, '&', '8'}, */ /* {XK_BackSpace, 'k', 'b'}, */ -#ifndef MACOS_X - {vk_Delete, 'k', 'b'}, -#endif +/* {vk_Delete, 'k', 'b'}, */ {vk_Insert, 'k', 'I'}, {vk_FwdDelete, 'k', 'D'}, {vk_Home, 'k', 'h'}, @@ -633,7 +631,7 @@ Handle_KAHL_SRCH_AE( if (error) return error; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ml.ml_mfp != NULL && SearchData.theFile.parID == buf->b_FSSpec.parID && SearchData.theFile.name[0] == buf->b_FSSpec.name[0] @@ -725,7 +723,7 @@ Handle_KAHL_MOD_AE( #endif numFiles = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ml.ml_mfp != NULL) { /* Add this file to the list */ @@ -807,7 +805,7 @@ Handle_KAHL_GTTX_AE( if (error) return error; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ml.ml_mfp != NULL) if (GetTextData.theFile.parID == buf->b_FSSpec.parID) { @@ -1107,7 +1105,8 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) } /* Change directory to the location of the first file. */ - if (GARGCOUNT > 0 && vim_chdirfile(alist_name(&GARGLIST[0])) == OK) + if (GARGCOUNT > 0 + && vim_chdirfile(alist_name(&GARGLIST[0]), "drop") == OK) shorten_fnames(TRUE); goto finished; @@ -1612,7 +1611,7 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode) else /* Bottom scrollbar */ { sb_info = sb; - page = W_WIDTH(curwin) - 5; + page = curwin->w_width - 5; } switch (partCode) @@ -2026,15 +2025,15 @@ gui_mac_handle_window_activate( switch (eventKind) { case kEventWindowActivated: -#if defined(USE_IM_CONTROL) +# if defined(FEAT_MBYTE) im_on_window_switch(TRUE); -#endif +# endif return noErr; case kEventWindowDeactivated: -#if defined(USE_IM_CONTROL) +# if defined(FEAT_MBYTE) im_on_window_switch(FALSE); -#endif +# endif return noErr; } } @@ -2607,8 +2606,7 @@ gui_mch_mousehide(int hide) * the menu that we should display */ void -gui_mac_handle_contextual_menu(event) - EventRecord *event; +gui_mac_handle_contextual_menu(EventRecord *event) { /* * Clone PopUp to use menu @@ -3510,7 +3508,7 @@ gui_mch_init_font(char_u *font_name, int fontset) GetFontInfo(&font_info); gui.char_ascent = font_info.ascent; - gui.char_width = CharWidth('_'); + gui.char_width = p_columnspace + CharWidth('_'); gui.char_height = font_info.ascent + font_info.descent + p_linespace; #ifdef USE_ATSUI_DRAWING @@ -3535,6 +3533,16 @@ gui_mch_adjust_charheight(void) return OK; } +/* + * Adjust gui.char_width (after 'columnspace' was changed). + */ + int +gui_mch_adjust_charwidth(void) +{ + gui.char_width = p_columnspace + CharWidth('_'); + return OK; +} + /* * Get a font structure for highlighting. */ @@ -3697,8 +3705,7 @@ gui_mch_set_font(GuiFont font) * If a font is not going to be used, free its structure. */ void -gui_mch_free_font(font) - GuiFont font; +gui_mch_free_font(GuiFont font) { /* * Free font when "font" is not 0. @@ -3707,17 +3714,6 @@ gui_mch_free_font(font) */ } - static int -hex_digit(int c) -{ - if (isdigit(c)) - return c - '0'; - c = TOLOWER_ASC(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - return -1000; -} - /* * Return the Pixel value (color) for the given color name. This routine was * pretty much taken from example code in the Silicon Graphics OSF/Motif @@ -3730,146 +3726,19 @@ gui_mch_get_color(char_u *name) /* TODO: Add support for the new named color of MacOS 8 */ RGBColor MacColor; -// guicolor_T color = 0; - - typedef struct guicolor_tTable - { - char *name; - guicolor_T color; - } guicolor_tTable; - - /* - * The comment at the end of each line is the source - * (Mac, Window, Unix) and the number is the unix rgb.txt value - */ - static guicolor_tTable table[] = - { - {"Black", RGB(0x00, 0x00, 0x00)}, - {"darkgray", RGB(0x80, 0x80, 0x80)}, /*W*/ - {"darkgrey", RGB(0x80, 0x80, 0x80)}, /*W*/ - {"Gray", RGB(0xC0, 0xC0, 0xC0)}, /*W*/ - {"Grey", RGB(0xC0, 0xC0, 0xC0)}, /*W*/ - {"lightgray", RGB(0xE0, 0xE0, 0xE0)}, /*W*/ - {"lightgrey", RGB(0xE0, 0xE0, 0xE0)}, /*W*/ - {"gray10", RGB(0x1A, 0x1A, 0x1A)}, /*W*/ - {"grey10", RGB(0x1A, 0x1A, 0x1A)}, /*W*/ - {"gray20", RGB(0x33, 0x33, 0x33)}, /*W*/ - {"grey20", RGB(0x33, 0x33, 0x33)}, /*W*/ - {"gray30", RGB(0x4D, 0x4D, 0x4D)}, /*W*/ - {"grey30", RGB(0x4D, 0x4D, 0x4D)}, /*W*/ - {"gray40", RGB(0x66, 0x66, 0x66)}, /*W*/ - {"grey40", RGB(0x66, 0x66, 0x66)}, /*W*/ - {"gray50", RGB(0x7F, 0x7F, 0x7F)}, /*W*/ - {"grey50", RGB(0x7F, 0x7F, 0x7F)}, /*W*/ - {"gray60", RGB(0x99, 0x99, 0x99)}, /*W*/ - {"grey60", RGB(0x99, 0x99, 0x99)}, /*W*/ - {"gray70", RGB(0xB3, 0xB3, 0xB3)}, /*W*/ - {"grey70", RGB(0xB3, 0xB3, 0xB3)}, /*W*/ - {"gray80", RGB(0xCC, 0xCC, 0xCC)}, /*W*/ - {"grey80", RGB(0xCC, 0xCC, 0xCC)}, /*W*/ - {"gray90", RGB(0xE5, 0xE5, 0xE5)}, /*W*/ - {"grey90", RGB(0xE5, 0xE5, 0xE5)}, /*W*/ - {"white", RGB(0xFF, 0xFF, 0xFF)}, - {"darkred", RGB(0x80, 0x00, 0x00)}, /*W*/ - {"red", RGB(0xDD, 0x08, 0x06)}, /*M*/ - {"lightred", RGB(0xFF, 0xA0, 0xA0)}, /*W*/ - {"DarkBlue", RGB(0x00, 0x00, 0x80)}, /*W*/ - {"Blue", RGB(0x00, 0x00, 0xD4)}, /*M*/ - {"lightblue", RGB(0xA0, 0xA0, 0xFF)}, /*W*/ - {"DarkGreen", RGB(0x00, 0x80, 0x00)}, /*W*/ - {"Green", RGB(0x00, 0x64, 0x11)}, /*M*/ - {"lightgreen", RGB(0xA0, 0xFF, 0xA0)}, /*W*/ - {"DarkCyan", RGB(0x00, 0x80, 0x80)}, /*W ?0x307D7E */ - {"cyan", RGB(0x02, 0xAB, 0xEA)}, /*M*/ - {"lightcyan", RGB(0xA0, 0xFF, 0xFF)}, /*W*/ - {"darkmagenta", RGB(0x80, 0x00, 0x80)}, /*W*/ - {"magenta", RGB(0xF2, 0x08, 0x84)}, /*M*/ - {"lightmagenta",RGB(0xF0, 0xA0, 0xF0)}, /*W*/ - {"brown", RGB(0x80, 0x40, 0x40)}, /*W*/ - {"yellow", RGB(0xFC, 0xF3, 0x05)}, /*M*/ - {"lightyellow", RGB(0xFF, 0xFF, 0xA0)}, /*M*/ - {"darkyellow", RGB(0xBB, 0xBB, 0x00)}, /*U*/ - {"SeaGreen", RGB(0x2E, 0x8B, 0x57)}, /*W 0x4E8975 */ - {"orange", RGB(0xFC, 0x80, 0x00)}, /*W 0xF87A17 */ - {"Purple", RGB(0xA0, 0x20, 0xF0)}, /*W 0x8e35e5 */ - {"SlateBlue", RGB(0x6A, 0x5A, 0xCD)}, /*W 0x737CA1 */ - {"Violet", RGB(0x8D, 0x38, 0xC9)}, /*U*/ - }; - int r, g, b; - int i; - - if (name[0] == '#' && strlen((char *) name) == 7) + if (STRICMP(name, "hilite") == 0) { - /* Name is in "#rrggbb" format */ - r = hex_digit(name[1]) * 16 + hex_digit(name[2]); - g = hex_digit(name[3]) * 16 + hex_digit(name[4]); - b = hex_digit(name[5]) * 16 + hex_digit(name[6]); - if (r < 0 || g < 0 || b < 0) - return INVALCOLOR; - return RGB(r, g, b); - } - else - { - if (STRICMP(name, "hilite") == 0) - { - LMGetHiliteRGB(&MacColor); - return (RGB(MacColor.red >> 8, MacColor.green >> 8, MacColor.blue >> 8)); - } - /* Check if the name is one of the colors we know */ - for (i = 0; i < sizeof(table) / sizeof(table[0]); i++) - if (STRICMP(name, table[i].name) == 0) - return table[i].color; - } - - /* - * Last attempt. Look in the file "$VIM/rgb.txt". - */ - { -#define LINE_LEN 100 - FILE *fd; - char line[LINE_LEN]; - char_u *fname; - - fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); - if (fname == NULL) - return INVALCOLOR; - - fd = fopen((char *)fname, "rt"); - vim_free(fname); - if (fd == NULL) - return INVALCOLOR; - - while (!feof(fd)) - { - int len; - int pos; - char *color; - - fgets(line, LINE_LEN, fd); - len = strlen(line); - - if (len <= 1 || line[len-1] != '\n') - continue; - - line[len-1] = '\0'; - - i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); - if (i != 3) - continue; - - color = line + pos; - - if (STRICMP(color, name) == 0) - { - fclose(fd); - return (guicolor_T) RGB(r, g, b); - } - } - fclose(fd); + LMGetHiliteRGB(&MacColor); + return (RGB(MacColor.red >> 8, MacColor.green >> 8, MacColor.blue >> 8)); } + return gui_get_color_cmn(name); +} - return INVALCOLOR; + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ + return gui_get_rgb_color_cmn(r, g, b); } /* @@ -4039,6 +3908,11 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags) MoveTo(FILL_X(col), FILL_Y(row + 1) - 1); LineTo(FILL_X(col + len) - 1, FILL_Y(row + 1) - 1); } + if (flags & DRAW_STRIKE) + { + MoveTo(FILL_X(col), FILL_Y(row + 1) - gui.char_height/2); + LineTo(FILL_X(col + len) - 1, FILL_Y(row + 1) - gui.char_height/2); + } } if (flags & DRAW_UNDERC) @@ -4976,7 +4850,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) char_u *p_actext; p_actext = menu->actext; - key = find_special_key(&p_actext, &modifiers, FALSE, FALSE); + key = find_special_key(&p_actext, &modifiers, FALSE, FALSE, FALSE); if (*p_actext != 0) key = 0; /* error: trailing text */ /* find_special_key() returns a keycode with as many of the @@ -5186,7 +5060,7 @@ gui_mch_set_scrollbar_thumb( SetControl32BitValue (sb->id, val); SetControlViewSize (sb->id, size); #ifdef DEBUG_MAC_SB - printf("thumb_sb (%x) %x, %x,%x\n",sb->id, val, size, max); + printf("thumb_sb (%x) %lx, %lx,%lx\n",sb->id, val, size, max); #endif } @@ -5260,6 +5134,17 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb) #endif } + int +gui_mch_is_blinking(void) +{ + return FALSE; +} + + int +gui_mch_is_blink_off(void) +{ + return FALSE; +} /* * Cursor blink functions. @@ -5282,9 +5167,10 @@ gui_mch_set_blinking(long wait, long on, long off) * Stop the cursor blinking. Show the cursor if it wasn't shown. */ void -gui_mch_stop_blink(void) +gui_mch_stop_blink(int may_call_gui_update_cursor) { - gui_update_cursor(TRUE, FALSE); + if (may_call_gui_update_cursor) + gui_update_cursor(TRUE, FALSE); /* TODO: TODO: TODO: TODO: */ /* gui_w32_rm_blink_timer(); if (blink_state == BLINK_OFF) @@ -5316,10 +5202,10 @@ gui_mch_start_blink(void) /* * Return the RGB value of a pixel as long. */ - long_u + guicolor_T gui_mch_get_rgb(guicolor_T pixel) { - return (Red(pixel) << 16) + (Green(pixel) << 8) + Blue(pixel); + return (guicolor_T)((Red(pixel) << 16) + (Green(pixel) << 8) + Blue(pixel)); } @@ -6356,7 +6242,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file) #endif } -#if (defined(USE_IM_CONTROL) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER) +#if (defined(FEAT_MBYTE) && defined(USE_CARBONKEYHANDLER)) || defined(PROTO) /* * Input Method Control functions. */ @@ -6367,11 +6253,11 @@ char_u *FullPathFromFSSpec_save(FSSpec file) void im_set_position(int row, int col) { -#if 0 +# if 0 /* TODO: Implement me! */ im_start_row = row; im_start_col = col; -#endif +# endif } static ScriptLanguageRecord gTSLWindow; @@ -6443,7 +6329,7 @@ im_set_active(int active) ScriptLanguageRecord *slptr = NULL; OSStatus err; - if (! gui.in_use) + if (!gui.in_use) return; if (im_initialized == 0) @@ -6505,7 +6391,7 @@ im_get_status(void) return im_is_active; } -#endif /* defined(USE_IM_CONTROL) || defined(PROTO) */ +#endif /* defined(FEAT_MBYTE) || defined(PROTO) */ @@ -6515,7 +6401,7 @@ im_get_status(void) static MenuRef contextMenu = NULL; enum { - kTabContextMenuId = 42, + kTabContextMenuId = 42 }; // the caller has to CFRelease() the returned string @@ -6557,7 +6443,7 @@ getTabCount(void) tabpage_T *tp; int numTabs = 0; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) ++numTabs; return numTabs; } @@ -6819,7 +6705,8 @@ initialise_tabline(void) // create tabline popup menu required by vim docs (see :he tabline-menu) CreateNewMenu(kTabContextMenuId, 0, &contextMenu); - AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close"), 0, + if (first_tabpage->tp_next != NULL) + AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close Tab"), 0, TABLINE_MENU_CLOSE, NULL); AppendMenuItemTextWithCFString(contextMenu, CFSTR("New Tab"), 0, TABLINE_MENU_NEW, NULL); @@ -6896,8 +6783,7 @@ gui_mch_update_tabline(void) * Set the current tab to "nr". First tab is 1. */ void -gui_mch_set_curtab(nr) - int nr; +gui_mch_set_curtab(int nr) { DataBrowserItemID item = nr; SetDataBrowserSelectedItems(dataBrowser, 1, &item, kDataBrowserItemsAssign); diff --git a/src/gui_motif.c b/src/gui_motif.c index 57f264df95..dc167c9fba 100644 --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -8,6 +8,8 @@ * See README.txt for an overview of the Vim source code. */ +#include "vim.h" + #include <Xm/Form.h> #include <Xm/RowColumn.h> #include <Xm/PushB.h> @@ -33,8 +35,6 @@ #include <X11/StringDefs.h> #include <X11/Intrinsic.h> -#include "vim.h" - #ifdef HAVE_X11_XPM_H # include <X11/xpm.h> #else @@ -83,29 +83,29 @@ static int tearoff_val = (int)XmTEAR_OFF_ENABLED; static Widget menuBar; #endif -static void scroll_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); +static void scroll_cb(Widget w, XtPointer client_data, XtPointer call_data); #ifdef FEAT_GUI_TABLINE -static void tabline_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void tabline_button_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void tabline_menu_cb __ARGS((Widget w, XtPointer closure, XEvent *e, Boolean *continue_dispatch)); -static void tabline_balloon_cb __ARGS((BalloonEval *beval, int state)); +static void tabline_cb(Widget w, XtPointer client_data, XtPointer call_data); +static void tabline_button_cb(Widget w, XtPointer client_data, XtPointer call_data); +static void tabline_menu_cb(Widget w, XtPointer closure, XEvent *e, Boolean *continue_dispatch); +static void tabline_balloon_cb(BalloonEval *beval, int state); #endif #ifdef FEAT_TOOLBAR # ifdef FEAT_FOOTER -static void toolbarbutton_enter_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); -static void toolbarbutton_leave_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); +static void toolbarbutton_enter_cb(Widget, XtPointer, XEvent *, Boolean *); +static void toolbarbutton_leave_cb(Widget, XtPointer, XEvent *, Boolean *); # endif -static void reset_focus __ARGS((void)); +static void reset_focus(void); #endif #ifdef FEAT_FOOTER -static int gui_mch_compute_footer_height __ARGS((void)); +static int gui_mch_compute_footer_height(void); #endif #ifdef WSDEBUG static void attachDump(Widget, char *); #endif -static void gui_motif_menu_colors __ARGS((Widget id)); -static void gui_motif_scroll_colors __ARGS((Widget id)); +static void gui_motif_menu_colors(Widget id); +static void gui_motif_scroll_colors(Widget id); #if (XmVersion >= 1002) # define STRING_TAG XmFONTLIST_DEFAULT_TAG @@ -118,9 +118,7 @@ static void gui_motif_scroll_colors __ARGS((Widget id)); */ static void -scroll_cb(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data, call_data; +scroll_cb(Widget w UNUSED, XtPointer client_data, XtPointer call_data) { scrollbar_T *sb; long value; @@ -136,10 +134,10 @@ scroll_cb(w, client_data, call_data) #ifdef FEAT_GUI_TABLINE static void -tabline_cb(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data UNUSED; - XtPointer call_data; +tabline_cb( + Widget w UNUSED, + XtPointer client_data UNUSED, + XtPointer call_data) { XmNotebookCallbackStruct *nptr; @@ -149,10 +147,10 @@ tabline_cb(w, client_data, call_data) } static void -tabline_button_cb(w, client_data, call_data) - Widget w; - XtPointer client_data UNUSED; - XtPointer call_data UNUSED; +tabline_button_cb( + Widget w, + XtPointer client_data UNUSED, + XtPointer call_data UNUSED) { int cmd, tab_idx; @@ -166,9 +164,9 @@ tabline_button_cb(w, client_data, call_data) * Tabline single mouse click timeout handler */ static void -motif_tabline_timer_cb (timed_out, interval_id) - XtPointer timed_out; - XtIntervalId *interval_id UNUSED; +motif_tabline_timer_cb ( + XtPointer timed_out, + XtIntervalId *interval_id UNUSED) { *((int *)timed_out) = TRUE; } @@ -177,9 +175,9 @@ motif_tabline_timer_cb (timed_out, interval_id) * check if the tabline tab scroller is clicked */ static int -tabline_scroller_clicked(scroller_name, event) - char *scroller_name; - XButtonPressedEvent *event; +tabline_scroller_clicked( + char *scroller_name, + XButtonPressedEvent *event) { Widget tab_scroll_w; Position pos_x, pos_y; @@ -202,11 +200,11 @@ tabline_scroller_clicked(scroller_name, event) } static void -tabline_menu_cb(w, closure, e, continue_dispatch) - Widget w; - XtPointer closure UNUSED; - XEvent *e; - Boolean *continue_dispatch UNUSED; +tabline_menu_cb( + Widget w, + XtPointer closure UNUSED, + XEvent *e, + Boolean *continue_dispatch UNUSED) { Widget tab_w; XButtonPressedEvent *event; @@ -275,9 +273,7 @@ tabline_menu_cb(w, closure, e, continue_dispatch) } static void -tabline_balloon_cb(beval, state) - BalloonEval *beval; - int state UNUSED; +tabline_balloon_cb(BalloonEval *beval, int state UNUSED) { int nr; tabpage_T *tp; @@ -310,13 +306,10 @@ tabline_balloon_cb(beval, state) static XtExposeProc old_label_expose = NULL; -static void label_expose __ARGS((Widget _w, XEvent *_event, Region _region)); +static void label_expose(Widget _w, XEvent *_event, Region _region); static void -label_expose(_w, _event, _region) - Widget _w; - XEvent *_event; - Region _region; +label_expose(Widget _w, XEvent *_event, Region _region) { GC insensitiveGC; XmLabelWidget lw = (XmLabelWidget)_w; @@ -396,7 +389,7 @@ label_expose(_w, _event, _region) * Create all the motif widgets necessary. */ void -gui_x11_create_widgets() +gui_x11_create_widgets(void) { #ifdef FEAT_GUI_TABLINE Widget button, scroller; @@ -540,14 +533,17 @@ gui_x11_create_widgets() tabLine_menu = XmCreatePopupMenu(tabLine, "tabline popup", NULL, 0); /* Add the buttons to the menu */ - n = 0; - XtSetArg(args[n], XmNuserData, TABLINE_MENU_CLOSE); n++; - xms = XmStringCreate((char *)"Close tab", STRING_TAG); - XtSetArg(args[n], XmNlabelString, xms); n++; - button = XmCreatePushButton(tabLine_menu, "Close", args, n); - XtAddCallback(button, XmNactivateCallback, - (XtCallbackProc)tabline_button_cb, NULL); - XmStringFree(xms); + if (first_tabpage->tp_next != NULL) + { + n = 0; + XtSetArg(args[n], XmNuserData, TABLINE_MENU_CLOSE); n++; + xms = XmStringCreate((char *)"Close tab", STRING_TAG); + XtSetArg(args[n], XmNlabelString, xms); n++; + button = XmCreatePushButton(tabLine_menu, "Close", args, n); + XtAddCallback(button, XmNactivateCallback, + (XtCallbackProc)tabline_button_cb, NULL); + XmStringFree(xms); + } n = 0; XtSetArg(args[n], XmNuserData, TABLINE_MENU_NEW); n++; @@ -630,7 +626,7 @@ gui_x11_create_widgets() * Called when the GUI is not going to start after all. */ void -gui_x11_destroy_widgets() +gui_x11_destroy_widgets(void) { textArea = NULL; #ifdef FEAT_MENU @@ -639,11 +635,11 @@ gui_x11_destroy_widgets() } void -gui_mch_set_text_area_pos(x, y, w, h) - int x UNUSED; - int y UNUSED; - int w UNUSED; - int h UNUSED; +gui_mch_set_text_area_pos( + int x UNUSED, + int y UNUSED, + int w UNUSED, + int h UNUSED) { #ifdef FEAT_TOOLBAR /* Give keyboard focus to the textArea instead of the toolbar. */ @@ -652,7 +648,7 @@ gui_mch_set_text_area_pos(x, y, w, h) } void -gui_x11_set_back_color() +gui_x11_set_back_color(void) { if (textArea != NULL) #if (XmVersion >= 1002) @@ -669,8 +665,7 @@ gui_x11_set_back_color() * well. */ void -manage_centered(dialog_child) - Widget dialog_child; +manage_centered(Widget dialog_child) { Widget shell = XtParent(dialog_child); Window root, child; @@ -728,8 +723,7 @@ manage_centered(dialog_child) * Encapsulate the way an XmFontList is created. */ XmFontList -gui_motif_create_fontlist(font) - XFontStruct *font; +gui_motif_create_fontlist(XFontStruct *font) { XmFontList font_list; @@ -750,8 +744,7 @@ gui_motif_create_fontlist(font) # if ((XmVersion > 1001) && defined(FEAT_XFONTSET)) || defined(PROTO) XmFontList -gui_motif_fontset2fontlist(fontset) - XFontSet *fontset; +gui_motif_fontset2fontlist(XFontSet *fontset) { XmFontList font_list; @@ -774,19 +767,18 @@ gui_motif_fontset2fontlist(fontset) * Menu stuff. */ -static void gui_motif_add_actext __ARGS((vimmenu_T *menu)); +static void gui_motif_add_actext(vimmenu_T *menu); #if (XmVersion >= 1002) -static void toggle_tearoff __ARGS((Widget wid)); -static void gui_mch_recurse_tearoffs __ARGS((vimmenu_T *menu)); +static void toggle_tearoff(Widget wid); +static void gui_mch_recurse_tearoffs(vimmenu_T *menu); #endif -static void submenu_change __ARGS((vimmenu_T *mp, int colors)); +static void submenu_change(vimmenu_T *mp, int colors); -static void do_set_mnemonics __ARGS((int enable)); +static void do_set_mnemonics(int enable); static int menu_enabled = TRUE; void -gui_mch_enable_menu(flag) - int flag; +gui_mch_enable_menu(int flag) { if (flag) { @@ -897,8 +889,7 @@ gui_mch_enable_menu(flag) * Enable or disable mnemonics for the toplevel menus. */ void -gui_motif_set_mnemonics(enable) - int enable; +gui_motif_set_mnemonics(int enable) { /* * Don't enable menu mnemonics when the menu bar is disabled, LessTif @@ -910,8 +901,7 @@ gui_motif_set_mnemonics(enable) } static void -do_set_mnemonics(enable) - int enable; +do_set_mnemonics(int enable) { vimmenu_T *menu; @@ -923,9 +913,7 @@ do_set_mnemonics(enable) } void -gui_mch_add_menu(menu, idx) - vimmenu_T *menu; - int idx; +gui_mch_add_menu(vimmenu_T *menu, int idx) { XmString label; Widget shell; @@ -1033,8 +1021,7 @@ gui_mch_add_menu(menu, idx) * Add mnemonic and accelerator text to a menu button. */ static void -gui_motif_add_actext(menu) - vimmenu_T *menu; +gui_motif_add_actext(vimmenu_T *menu) { XmString label; @@ -1050,8 +1037,7 @@ gui_motif_add_actext(menu) } void -gui_mch_toggle_tearoffs(enable) - int enable; +gui_mch_toggle_tearoffs(int enable) { #if (XmVersion >= 1002) if (enable) @@ -1069,8 +1055,7 @@ gui_mch_toggle_tearoffs(enable) * tearoff widget. */ static void -toggle_tearoff(wid) - Widget wid; +toggle_tearoff(Widget wid) { Widget w; @@ -1081,8 +1066,7 @@ toggle_tearoff(wid) } static void -gui_mch_recurse_tearoffs(menu) - vimmenu_T *menu; +gui_mch_recurse_tearoffs(vimmenu_T *menu) { while (menu != NULL) { @@ -1098,7 +1082,7 @@ gui_mch_recurse_tearoffs(menu) #endif int -gui_mch_text_area_extra_height() +gui_mch_text_area_extra_height(void) { Dimension shadowHeight; @@ -1112,8 +1096,8 @@ gui_mch_text_area_extra_height() * there are several rows, and/or some characters extend higher or lower. */ void -gui_mch_compute_menu_height(id) - Widget id; /* can be NULL when deleting menu */ +gui_mch_compute_menu_height( + Widget id) /* can be NULL when deleting menu */ { Dimension y, maxy; Dimension margin, shadow; @@ -1189,16 +1173,15 @@ gui_mch_compute_menu_height(id) */ #include "gui_x11_pm.h" -static int check_xpm __ARGS((char_u *path)); -static char **get_toolbar_pixmap __ARGS((vimmenu_T *menu, char **fname)); -static int add_pixmap_args __ARGS((vimmenu_T *menu, Arg *args, int n)); +static int check_xpm(char_u *path); +static char **get_toolbar_pixmap(vimmenu_T *menu, char **fname); +static int add_pixmap_args(vimmenu_T *menu, Arg *args, int n); /* * Read an Xpm file. Return OK or FAIL. */ static int -check_xpm(path) - char_u *path; +check_xpm(char_u *path) { XpmAttributes attrs; int status; @@ -1226,9 +1209,7 @@ check_xpm(path) * Return a blank pixmap if it fails. */ static char ** -get_toolbar_pixmap(menu, fname) - vimmenu_T *menu; - char **fname; +get_toolbar_pixmap(vimmenu_T *menu, char **fname) { char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ char **xpm = NULL; /* xpm array */ @@ -1269,10 +1250,7 @@ get_toolbar_pixmap(menu, fname) * Add arguments for the toolbar pixmap to a menu item. */ static int -add_pixmap_args(menu, args, n) - vimmenu_T *menu; - Arg *args; - int n; +add_pixmap_args(vimmenu_T *menu, Arg *args, int n) { vim_free(menu->xpm_fname); menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname); @@ -1294,9 +1272,7 @@ add_pixmap_args(menu, args, n) #endif /* FEAT_TOOLBAR */ void -gui_mch_add_menu_item(menu, idx) - vimmenu_T *menu; - int idx; +gui_mch_add_menu_item(vimmenu_T *menu, int idx) { XmString label; vimmenu_T *parent = menu->parent; @@ -1384,7 +1360,7 @@ gui_mch_add_menu_item(menu, idx) if (xms != NULL) XmStringFree(xms); -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI gui_mch_menu_set_tip(menu); # endif @@ -1454,8 +1430,7 @@ gui_mch_add_menu_item(menu, idx) * there exists a popup menu but it isn't managed. */ void -gui_motif_update_mousemodel(menu) - vimmenu_T *menu; +gui_motif_update_mousemodel(vimmenu_T *menu) { int idx = 0; @@ -1497,7 +1472,7 @@ gui_motif_update_mousemodel(menu) #endif void -gui_mch_new_menu_colors() +gui_mch_new_menu_colors(void) { if (menuBar == (Widget)0) return; @@ -1511,7 +1486,7 @@ gui_mch_new_menu_colors() } void -gui_mch_new_menu_font() +gui_mch_new_menu_font(void) { if (menuBar == (Widget)0) return; @@ -1534,9 +1509,9 @@ gui_mch_new_menu_font() ui_new_shellsize(); } -#if defined(FEAT_BEVAL) || defined(PROTO) +#if defined(FEAT_BEVAL_GUI) || defined(PROTO) void -gui_mch_new_tooltip_font() +gui_mch_new_tooltip_font(void) { # ifdef FEAT_TOOLBAR vimmenu_T *menu; @@ -1551,7 +1526,7 @@ gui_mch_new_tooltip_font() } void -gui_mch_new_tooltip_colors() +gui_mch_new_tooltip_colors(void) { # ifdef FEAT_TOOLBAR vimmenu_T *toolbar; @@ -1567,9 +1542,9 @@ gui_mch_new_tooltip_colors() #endif static void -submenu_change(menu, colors) - vimmenu_T *menu; - int colors; /* TRUE for colors, FALSE for font */ +submenu_change( + vimmenu_T *menu, + int colors) /* TRUE for colors, FALSE for font */ { vimmenu_T *mp; @@ -1591,7 +1566,7 @@ submenu_change(menu, colors) n = add_pixmap_args(mp, args, n); XtSetValues(mp->id, args, n); } -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI /* If we have a tooltip, then we need to change it's font */ if (mp->tip != NULL) { @@ -1609,7 +1584,7 @@ submenu_change(menu, colors) else { gui_motif_menu_fontlist(mp->id); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI /* If we have a tooltip, then we need to change it's font */ if (mp->tip != NULL) { @@ -1647,8 +1622,7 @@ submenu_change(menu, colors) * Destroy the machine specific menu widget. */ void -gui_mch_destroy_menu(menu) - vimmenu_T *menu; +gui_mch_destroy_menu(vimmenu_T *menu) { /* Please be sure to destroy the parent widget first (i.e. menu->id). * On the other hand, problems have been reported that the submenu must be @@ -1668,7 +1642,7 @@ gui_mch_destroy_menu(menu) Widget parent; parent = XtParent(menu->id); -#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL) +#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) if (parent == toolBar && menu->tip != NULL) { /* We try to destroy this before the actual menu, because there are @@ -1705,8 +1679,7 @@ gui_mch_destroy_menu(menu) } void -gui_mch_show_popupmenu(menu) - vimmenu_T *menu UNUSED; +gui_mch_show_popupmenu(vimmenu_T *menu UNUSED) { #ifdef MOTIF_POPUP XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event()); @@ -1720,7 +1693,7 @@ gui_mch_show_popupmenu(menu) * Set the menu and scrollbar colors to their default values. */ void -gui_mch_def_colors() +gui_mch_def_colors(void) { if (gui.in_use) { @@ -1730,7 +1703,7 @@ gui_mch_def_colors() gui.menu_bg_pixel = gui.menu_def_bg_pixel; gui.scroll_fg_pixel = gui.scroll_def_fg_pixel; gui.scroll_bg_pixel = gui.scroll_def_bg_pixel; -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); gui.tooltip_bg_pixel = @@ -1745,11 +1718,11 @@ gui_mch_def_colors() */ void -gui_mch_set_scrollbar_thumb(sb, val, size, max) - scrollbar_T *sb; - long val; - long size; - long max; +gui_mch_set_scrollbar_thumb( + scrollbar_T *sb, + long val, + long size, + long max) { if (sb->id != (Widget)0) XtVaSetValues(sb->id, @@ -1761,12 +1734,12 @@ gui_mch_set_scrollbar_thumb(sb, val, size, max) } void -gui_mch_set_scrollbar_pos(sb, x, y, w, h) - scrollbar_T *sb; - int x; - int y; - int w; - int h; +gui_mch_set_scrollbar_pos( + scrollbar_T *sb, + int x, + int y, + int w, + int h) { if (sb->id != (Widget)0) { @@ -1795,9 +1768,7 @@ gui_mch_set_scrollbar_pos(sb, x, y, w, h) } void -gui_mch_enable_scrollbar(sb, flag) - scrollbar_T *sb; - int flag; +gui_mch_enable_scrollbar(scrollbar_T *sb, int flag) { Arg args[16]; int n; @@ -1852,9 +1823,9 @@ gui_mch_enable_scrollbar(sb, flag) } void -gui_mch_create_scrollbar(sb, orient) - scrollbar_T *sb; - int orient; /* SBAR_VERT or SBAR_HORIZ */ +gui_mch_create_scrollbar( + scrollbar_T *sb, + int orient) /* SBAR_VERT or SBAR_HORIZ */ { Arg args[16]; int n; @@ -1908,19 +1879,15 @@ gui_mch_create_scrollbar(sb, orient) } } -#if defined(FEAT_WINDOWS) || defined(PROTO) void -gui_mch_destroy_scrollbar(sb) - scrollbar_T *sb; +gui_mch_destroy_scrollbar(scrollbar_T *sb) { if (sb->id != (Widget)0) XtDestroyWidget(sb->id); } -#endif void -gui_mch_set_scrollbar_colors(sb) - scrollbar_T *sb; +gui_mch_set_scrollbar_colors(scrollbar_T *sb) { if (sb->id != (Widget)0) { @@ -1954,7 +1921,7 @@ gui_mch_set_scrollbar_colors(sb) */ Window -gui_x11_get_wid() +gui_x11_get_wid(void) { return(XtWindow(textArea)); } @@ -2121,14 +2088,13 @@ suppress_dialog_mnemonics(Widget dialog) } #if defined(FEAT_BROWSE) || defined(FEAT_GUI_DIALOG) -static void set_fontlist __ARGS((Widget wg)); +static void set_fontlist(Widget wg); /* * Use the 'guifont' or 'guifontset' as a fontlist for a dialog widget. */ static void -set_fontlist(id) - Widget id; +set_fontlist(Widget id) { XmFontList fl; @@ -2194,8 +2160,8 @@ static char *browse_fname = NULL; static XmStringCharSet charset = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET; /* used to set up XmStrings */ -static void DialogCancelCB __ARGS((Widget, XtPointer, XtPointer)); -static void DialogAcceptCB __ARGS((Widget, XtPointer, XtPointer)); +static void DialogCancelCB(Widget, XtPointer, XtPointer); +static void DialogAcceptCB(Widget, XtPointer, XtPointer); /* * This function is used to translate the predefined label text of the @@ -2206,13 +2172,10 @@ static void DialogAcceptCB __ARGS((Widget, XtPointer, XtPointer)); * - equalize the messages between different GUI implementations as far as * possible. */ -static void set_predefined_label __ARGS((Widget parent, String name, char *new_label)); +static void set_predefined_label(Widget parent, String name, char *new_label); -static void -set_predefined_label(parent, name, new_label) - Widget parent; - String name; - char *new_label; + static void +set_predefined_label(Widget parent, String name, char *new_label) { XmString str; Widget w; @@ -2255,10 +2218,8 @@ set_predefined_label(parent, name, new_label) gui_motif_menu_fontlist(w); } -static void -set_predefined_fontlist(parent, name) - Widget parent; - String name; + static void +set_predefined_fontlist(Widget parent, String name) { Widget w; w = XtNameToWidget(parent, name); @@ -2274,13 +2235,13 @@ set_predefined_fontlist(parent, name) * Returns the selected name in allocated memory, or NULL for Cancel. */ char_u * -gui_mch_browse(saving, title, dflt, ext, initdir, filter) - int saving UNUSED; /* select file to write */ - char_u *title; /* title for the window */ - char_u *dflt; /* default name */ - char_u *ext UNUSED; /* not used (extension added) */ - char_u *initdir; /* initial directory, NULL for current dir */ - char_u *filter; /* file name filter */ +gui_mch_browse( + int saving UNUSED, /* select file to write */ + char_u *title, /* title for the window */ + char_u *dflt, /* default name */ + char_u *ext UNUSED, /* not used (extension added) */ + char_u *initdir, /* initial directory, NULL for current dir */ + char_u *filter) /* file name filter */ { char_u dirbuf[MAXPATHL]; char_u dfltbuf[MAXPATHL]; @@ -2399,10 +2360,10 @@ gui_mch_browse(saving, title, dflt, ext, initdir, filter) * Process callback from Dialog cancel actions. */ static void -DialogCancelCB(w, client_data, call_data) - Widget w UNUSED; /* widget id */ - XtPointer client_data UNUSED; /* data from application */ - XtPointer call_data UNUSED; /* data from widget class */ +DialogCancelCB( + Widget w UNUSED, /* widget id */ + XtPointer client_data UNUSED, /* data from application */ + XtPointer call_data UNUSED) /* data from widget class */ { if (browse_fname != NULL) { @@ -2416,10 +2377,10 @@ DialogCancelCB(w, client_data, call_data) * Process callback from Dialog actions. */ static void -DialogAcceptCB(w, client_data, call_data) - Widget w UNUSED; /* widget id */ - XtPointer client_data UNUSED; /* data from application */ - XtPointer call_data; /* data from widget class */ +DialogAcceptCB( + Widget w UNUSED, /* widget id */ + XtPointer client_data UNUSED, /* data from application */ + XtPointer call_data) /* data from widget class */ { XmFileSelectionBoxCallbackStruct *fcb; @@ -2443,19 +2404,19 @@ DialogAcceptCB(w, client_data, call_data) static int dialogStatus; -static void keyhit_callback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont)); -static void butproc __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); +static void keyhit_callback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); +static void butproc(Widget w, XtPointer client_data, XtPointer call_data); /* * Callback function for the textfield. When CR is hit this works like * hitting the "OK" button, ESC like "Cancel". */ static void -keyhit_callback(w, client_data, event, cont) - Widget w; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *cont UNUSED; +keyhit_callback( + Widget w, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *cont UNUSED) { char buf[2]; KeySym key_sym; @@ -2473,10 +2434,10 @@ keyhit_callback(w, client_data, event, cont) } static void -butproc(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +butproc( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { dialogStatus = (int)(long)client_data + 1; } @@ -2486,12 +2447,12 @@ butproc(w, client_data, call_data) static Widget create_pixmap_label(Widget parent, String name, char **data, ArgList args, Cardinal arg); static Widget -create_pixmap_label(parent, name, data, args, arg) - Widget parent; - String name; - char **data; - ArgList args; - Cardinal arg; +create_pixmap_label( + Widget parent, + String name, + char **data, + ArgList args, + Cardinal arg) { Widget label; Display *dsp; @@ -2549,14 +2510,14 @@ create_pixmap_label(parent, name, data, args, arg) #endif int -gui_mch_dialog(type, title, message, button_names, dfltbutton, textfield, ex_cmd) - int type UNUSED; - char_u *title; - char_u *message; - char_u *button_names; - int dfltbutton; - char_u *textfield; /* buffer of size IOSIZE */ - int ex_cmd UNUSED; +gui_mch_dialog( + int type UNUSED, + char_u *title, + char_u *message, + char_u *button_names, + int dfltbutton, + char_u *textfield, /* buffer of size IOSIZE */ + int ex_cmd UNUSED) { char_u *buts; char_u *p, *next; @@ -2924,7 +2885,7 @@ gui_mch_dialog(type, title, message, button_names, dfltbutton, textfield, ex_cmd #if defined(FEAT_FOOTER) || defined(PROTO) static int -gui_mch_compute_footer_height() +gui_mch_compute_footer_height(void) { Dimension height; /* total Toolbar height */ Dimension top; /* XmNmarginTop */ @@ -2942,8 +2903,7 @@ gui_mch_compute_footer_height() } void -gui_mch_enable_footer(showit) - int showit; +gui_mch_enable_footer(int showit) { if (showit) { @@ -2959,8 +2919,7 @@ gui_mch_enable_footer(showit) } void -gui_mch_set_footer(s) - char_u *s; +gui_mch_set_footer(char_u *s) { XmString xms; @@ -3132,14 +3091,14 @@ gui_mch_show_toolbar(int showit) * input go to the editor window, not the button */ static void -reset_focus() +reset_focus(void) { if (textArea != NULL) XmProcessTraversal(textArea, XmTRAVERSE_CURRENT); } int -gui_mch_compute_toolbar_height() +gui_mch_compute_toolbar_height(void) { Dimension borders; Dimension height; /* total Toolbar height */ @@ -3186,12 +3145,12 @@ gui_mch_compute_toolbar_height() } void -motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp) - Pixel *bgp; - Pixel *fgp; - Pixel *bsp; - Pixel *tsp; - Pixel *hsp; +motif_get_toolbar_colors( + Pixel *bgp, + Pixel *fgp, + Pixel *bsp, + Pixel *tsp, + Pixel *hsp) { XtVaGetValues(toolBar, XmNbackground, bgp, @@ -3209,11 +3168,11 @@ motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp) * get implemented and the user will have a choice. */ static void -toolbarbutton_enter_cb(w, client_data, event, cont) - Widget w UNUSED; - XtPointer client_data; - XEvent *event UNUSED; - Boolean *cont UNUSED; +toolbarbutton_enter_cb( + Widget w UNUSED, + XtPointer client_data, + XEvent *event UNUSED, + Boolean *cont UNUSED) { vimmenu_T *menu = (vimmenu_T *) client_data; @@ -3225,11 +3184,11 @@ toolbarbutton_enter_cb(w, client_data, event, cont) } static void -toolbarbutton_leave_cb(w, client_data, event, cont) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event UNUSED; - Boolean *cont UNUSED; +toolbarbutton_leave_cb( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event UNUSED, + Boolean *cont UNUSED) { gui_mch_set_footer((char_u *) ""); } @@ -3410,8 +3369,7 @@ gui_mch_update_tabline(void) * Set the current tab to "nr". First tab is 1. */ void -gui_mch_set_curtab(nr) - int nr; +gui_mch_set_curtab(int nr) { int currentpage; @@ -3428,8 +3386,7 @@ gui_mch_set_curtab(nr) * Set the colors of Widget "id" to the menu colors. */ static void -gui_motif_menu_colors(id) - Widget id; +gui_motif_menu_colors(Widget id) { if (gui.menu_bg_pixel != INVALCOLOR) #if (XmVersion >= 1002) @@ -3445,8 +3402,7 @@ gui_motif_menu_colors(id) * Set the colors of Widget "id" to the scrollbar colors. */ static void -gui_motif_scroll_colors(id) - Widget id; +gui_motif_scroll_colors(Widget id) { if (gui.scroll_bg_pixel != INVALCOLOR) #if (XmVersion >= 1002) @@ -3462,8 +3418,7 @@ gui_motif_scroll_colors(id) * Set the fontlist for Widget "id" to use gui.menu_fontset or gui.menu_font. */ void -gui_motif_menu_fontlist(id) - Widget id UNUSED; +gui_motif_menu_fontlist(Widget id UNUSED) { #ifdef FEAT_MENU #ifdef FONTSET_ALWAYS @@ -3537,18 +3492,18 @@ typedef struct _SharedFindReplace static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static void find_replace_destroy_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void find_replace_dismiss_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void entry_activate_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void find_replace_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -static void find_replace_keypress __ARGS((Widget w, SharedFindReplace * frdp, XKeyEvent * event)); -static void find_replace_dialog_create __ARGS((char_u *entry_text, int do_replace)); +static void find_replace_destroy_callback(Widget w, XtPointer client_data, XtPointer call_data); +static void find_replace_dismiss_callback(Widget w, XtPointer client_data, XtPointer call_data); +static void entry_activate_callback(Widget w, XtPointer client_data, XtPointer call_data); +static void find_replace_callback(Widget w, XtPointer client_data, XtPointer call_data); +static void find_replace_keypress(Widget w, SharedFindReplace * frdp, XKeyEvent * event); +static void find_replace_dialog_create(char_u *entry_text, int do_replace); static void -find_replace_destroy_callback(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +find_replace_destroy_callback( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { SharedFindReplace *cd = (SharedFindReplace *)client_data; @@ -3558,10 +3513,10 @@ find_replace_destroy_callback(w, client_data, call_data) } static void -find_replace_dismiss_callback(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +find_replace_dismiss_callback( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { SharedFindReplace *cd = (SharedFindReplace *)client_data; @@ -3570,19 +3525,19 @@ find_replace_dismiss_callback(w, client_data, call_data) } static void -entry_activate_callback(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +entry_activate_callback( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { XmProcessTraversal((Widget)client_data, XmTRAVERSE_CURRENT); } static void -find_replace_callback(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +find_replace_callback( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { long_u flags = (long_u)client_data; char *find_text, *repl_text; @@ -3633,10 +3588,10 @@ find_replace_callback(w, client_data, call_data) } static void -find_replace_keypress(w, frdp, event) - Widget w UNUSED; - SharedFindReplace *frdp; - XKeyEvent *event; +find_replace_keypress( + Widget w UNUSED, + SharedFindReplace *frdp, + XKeyEvent *event) { KeySym keysym; @@ -3651,9 +3606,7 @@ find_replace_keypress(w, frdp, event) } static void -set_label(w, label) - Widget w; - char *label; +set_label(Widget w, char *label) { XmString str; char_u *p, *next; @@ -3693,9 +3646,7 @@ set_label(w, label) } static void -find_replace_dialog_create(arg, do_replace) - char_u *arg; - int do_replace; +find_replace_dialog_create(char_u *arg, int do_replace) { SharedFindReplace *frdp; Widget separator; @@ -4047,8 +3998,7 @@ find_replace_dialog_create(arg, do_replace) } void -gui_mch_find_dialog(eap) - exarg_T *eap; +gui_mch_find_dialog(exarg_T *eap) { if (!gui.in_use) return; @@ -4058,8 +4008,7 @@ gui_mch_find_dialog(eap) void -gui_mch_replace_dialog(eap) - exarg_T *eap; +gui_mch_replace_dialog(exarg_T *eap) { if (!gui.in_use) return; @@ -4071,7 +4020,7 @@ gui_mch_replace_dialog(eap) * Synchronize all gui elements, which are dependant upon the * main text font used. Those are in esp. the find/replace dialogs. * If you don't understand why this should be needed, please try to - * search for "pi" in iso8859-2. + * search for "pi\xea\xb6\xe6" in iso8859-2. */ void gui_motif_synch_fonts(void) diff --git a/src/gui_photon.c b/src/gui_photon.c index aa99dd74af..327b356514 100644 --- a/src/gui_photon.c +++ b/src/gui_photon.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sw=4 sts=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Photon GUI support by Julian Kinraid @@ -383,7 +383,7 @@ gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) else { gui_focus_change(FALSE); - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); } break; @@ -1040,8 +1040,7 @@ gui_ph_pg_remove_buffer(char *name) PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, &empty_title, 1); - vim_free(panel_titles); - panel_titles = NULL; + VIM_CLEAR(panel_titles); } } @@ -1111,9 +1110,7 @@ gui_ph_encoding_changed(int new_encoding) /****************************************************************************/ void -gui_mch_prepare(argc, argv) - int *argc; - char **argv; +gui_mch_prepare(int *argc, char **argv) { PtInit(NULL); } @@ -1720,7 +1717,7 @@ gui_mch_iconify(void) * Bring the Vim window to the foreground. */ void -gui_mch_set_foreground() +gui_mch_set_foreground(void) { PhWindowEvent_t event; @@ -1860,8 +1857,7 @@ static int mshape_ids[] = }; void -mch_set_mouse_shape(shape) - int shape; +mch_set_mouse_shape(int shape) { int id; @@ -1936,10 +1932,11 @@ gui_mch_setmouse(int x, int y) /* * Return the RGB value of a pixel as a long. */ - long_u + guicolor_T gui_mch_get_rgb(guicolor_T pixel) { - return PgRGB(PgRedValue(pixel), PgGreenValue(pixel), PgBlueValue(pixel)); + return (guicolor_T)(PgRGB(PgRedValue(pixel), + PgGreenValue(pixel), PgBlueValue(pixel))); } void @@ -1974,18 +1971,6 @@ gui_mch_new_colors(void) PtSetResource(gui.vimTextArea, Pt_ARG_FILL_COLOR, gui.back_pixel, 0); } - static int -hex_digit(int c) -{ - if (VIM_ISDIGIT(c)) - return c - '0'; - c = TOLOWER_ASC(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - return -1000; -} - - /* * This should be split out into a separate file, * every port does basically the same thing. @@ -1997,136 +1982,13 @@ hex_digit(int c) guicolor_T gui_mch_get_color(char_u *name) { - int i; - int r, g, b; - - - typedef struct GuiColourTable - { - char *name; - guicolor_T colour; - } GuiColourTable; - - static GuiColourTable table[] = - { - {"Black", RGB(0x00, 0x00, 0x00)}, - {"DarkGray", RGB(0xA9, 0xA9, 0xA9)}, - {"DarkGrey", RGB(0xA9, 0xA9, 0xA9)}, - {"Gray", RGB(0xC0, 0xC0, 0xC0)}, - {"Grey", RGB(0xC0, 0xC0, 0xC0)}, - {"LightGray", RGB(0xD3, 0xD3, 0xD3)}, - {"LightGrey", RGB(0xD3, 0xD3, 0xD3)}, - {"Gray10", RGB(0x1A, 0x1A, 0x1A)}, - {"Grey10", RGB(0x1A, 0x1A, 0x1A)}, - {"Gray20", RGB(0x33, 0x33, 0x33)}, - {"Grey20", RGB(0x33, 0x33, 0x33)}, - {"Gray30", RGB(0x4D, 0x4D, 0x4D)}, - {"Grey30", RGB(0x4D, 0x4D, 0x4D)}, - {"Gray40", RGB(0x66, 0x66, 0x66)}, - {"Grey40", RGB(0x66, 0x66, 0x66)}, - {"Gray50", RGB(0x7F, 0x7F, 0x7F)}, - {"Grey50", RGB(0x7F, 0x7F, 0x7F)}, - {"Gray60", RGB(0x99, 0x99, 0x99)}, - {"Grey60", RGB(0x99, 0x99, 0x99)}, - {"Gray70", RGB(0xB3, 0xB3, 0xB3)}, - {"Grey70", RGB(0xB3, 0xB3, 0xB3)}, - {"Gray80", RGB(0xCC, 0xCC, 0xCC)}, - {"Grey80", RGB(0xCC, 0xCC, 0xCC)}, - {"Gray90", RGB(0xE5, 0xE5, 0xE5)}, - {"Grey90", RGB(0xE5, 0xE5, 0xE5)}, - {"White", RGB(0xFF, 0xFF, 0xFF)}, - {"DarkRed", RGB(0x80, 0x00, 0x00)}, - {"Red", RGB(0xFF, 0x00, 0x00)}, - {"LightRed", RGB(0xFF, 0xA0, 0xA0)}, - {"DarkBlue", RGB(0x00, 0x00, 0x80)}, - {"Blue", RGB(0x00, 0x00, 0xFF)}, - {"LightBlue", RGB(0xAD, 0xD8, 0xE6)}, - {"DarkGreen", RGB(0x00, 0x80, 0x00)}, - {"Green", RGB(0x00, 0xFF, 0x00)}, - {"LightGreen", RGB(0x90, 0xEE, 0x90)}, - {"DarkCyan", RGB(0x00, 0x80, 0x80)}, - {"Cyan", RGB(0x00, 0xFF, 0xFF)}, - {"LightCyan", RGB(0xE0, 0xFF, 0xFF)}, - {"DarkMagenta", RGB(0x80, 0x00, 0x80)}, - {"Magenta", RGB(0xFF, 0x00, 0xFF)}, - {"LightMagenta", RGB(0xFF, 0xA0, 0xFF)}, - {"Brown", RGB(0x80, 0x40, 0x40)}, - {"Yellow", RGB(0xFF, 0xFF, 0x00)}, - {"LightYellow", RGB(0xFF, 0xFF, 0xE0)}, - {"SeaGreen", RGB(0x2E, 0x8B, 0x57)}, - {"Orange", RGB(0xFF, 0xA5, 0x00)}, - {"Purple", RGB(0xA0, 0x20, 0xF0)}, - {"SlateBlue", RGB(0x6A, 0x5A, 0xCD)}, - {"Violet", RGB(0xEE, 0x82, 0xEE)}, - }; - - /* is name #rrggbb format? */ - if (name[0] == '#' && STRLEN(name) == 7) - { - r = hex_digit(name[1]) * 16 + hex_digit(name[2]); - g = hex_digit(name[3]) * 16 + hex_digit(name[4]); - b = hex_digit(name[5]) * 16 + hex_digit(name[6]); - if (r < 0 || g < 0 || b < 0) - return INVALCOLOR; - return RGB(r, g, b); - } - - for (i = 0; i < ARRAY_LENGTH(table); i++) - { - if (STRICMP(name, table[i].name) == 0) - return table[i].colour; - } - - /* - * Last attempt. Look in the file "$VIMRUNTIME/rgb.txt". - */ - { -#define LINE_LEN 100 - FILE *fd; - char line[LINE_LEN]; - char_u *fname; - - fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); - if (fname == NULL) - return INVALCOLOR; - - fd = fopen((char *)fname, "rt"); - vim_free(fname); - if (fd == NULL) - return INVALCOLOR; - - while (!feof(fd)) - { - int len; - int pos; - char *color; - - fgets(line, LINE_LEN, fd); - len = STRLEN(line); - - if (len <= 1 || line[len-1] != '\n') - continue; - - line[len-1] = '\0'; - - i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); - if (i != 3) - continue; - - color = line + pos; - - if (STRICMP(color, name) == 0) - { - fclose(fd); - return (guicolor_T)RGB(r, g, b); - } - } - - fclose(fd); - } - + return gui_get_color_cmn(name); +} - return INVALCOLOR; + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ + return gui_get_rgb_color_cmn(r, g, b); } void @@ -2184,7 +2046,7 @@ gui_mch_clear_block(int row1, int col1, int row2, int col2) } void -gui_mch_clear_all() +gui_mch_clear_all(void) { PhRect_t text_rect = { { gui.border_width, gui.border_width }, @@ -2376,6 +2238,18 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color) DRAW_END; } + int +gui_mch_is_blinking(void) +{ + return blink_state != BLINK_NONE; +} + + int +gui_mch_is_blink_off(void) +{ + return blink_state == BLINK_OFF; +} + void gui_mch_set_blinking(long wait, long on, long off) { @@ -2398,11 +2272,11 @@ gui_mch_start_blink(void) } void -gui_mch_stop_blink(void) +gui_mch_stop_blink(int may_call_gui_update_cursor) { PtSetResource(gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL, 0, 0); - if (blink_state == BLINK_OFF) + if (blink_state == BLINK_OFF && may_call_gui_update_cursor) gui_update_cursor(TRUE, FALSE); blink_state = BLINK_NONE; @@ -3078,9 +2952,7 @@ gui_mch_get_font(char_u *vim_font_name, int report_error) * Don't know how to get the actual name, thus use the provided name. */ char_u * -gui_mch_get_fontname(font, name) - GuiFont font; - char_u *name; +gui_mch_get_fontname(GuiFont font, char_u *name) { if (name == NULL) return NULL; diff --git a/src/gui_w16.c b/src/gui_w16.c deleted file mode 100644 index b8d1e0e513..0000000000 --- a/src/gui_w16.c +++ /dev/null @@ -1,1564 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * GUI support by Robert Webb - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ -/* - * gui_w16.c - * - * GUI support for Microsoft Windows 3.1x - * - * George V. Reilly <george@reilly.org> wrote the original Win32 GUI. - * Robert Webb reworked it to use the existing GUI stuff and added menu, - * scrollbars, etc. - * - * Vince Negri then butchered the code to get it compiling for - * 16-bit windows. - * - */ - -/* Win16 doesn't use the "W" methods. */ -#define pDispatchMessage DispatchMessage -#define pGetMessage GetMessage -#define pIsDialogMessage IsDialogMessage -#define pPeekMessage PeekMessage - -/* - * Include the common stuff for MS-Windows GUI. - */ -#include "gui_w48.c" - -#include "guiw16rc.h" - -/* Undocumented Windows Message - not even defined in some SDK headers */ -#define WM_EXITSIZEMOVE 0x0232 - - -#ifdef FEAT_TOOLBAR -# define CMD_TB_BASE (99) -# include <vimtbar.h> -#endif - -#ifdef PROTO -# define WINAPI -#endif - -#define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HDROP)(wParam)), 0L) - - -/* Local variables: */ - -#ifdef FEAT_MENU -static UINT s_menu_id = 100; -#endif - - -#define VIM_NAME "vim" -#define VIM_CLASS "Vim" - -#define DLG_ALLOC_SIZE 16 * 1024 - -/* - * stuff for dialogs, menus, tearoffs etc. - */ -#if defined(FEAT_GUI_DIALOG) || defined(PROTO) -static BOOL CALLBACK dialog_callback(HWND, UINT, WPARAM, LPARAM); - -static LPWORD -add_dialog_element( - LPWORD p, - DWORD lStyle, - WORD x, - WORD y, - WORD w, - WORD h, - WORD Id, - BYTE clss, - const char *caption); - -static int dialog_default_button = -1; -#endif - -static void get_dialog_font_metrics(void); - -#ifdef FEAT_TOOLBAR -static void initialise_toolbar(void); -#endif - - -#ifdef FEAT_MENU -/* - * Figure out how high the menu bar is at the moment. - */ - static int -gui_mswin_get_menu_height( - int fix_window) /* If TRUE, resize window if menu height changed */ -{ - static int old_menu_height = -1; - - int num; - int menu_height; - - if (gui.menu_is_active) - num = GetMenuItemCount(s_menuBar); - else - num = 0; - - if (num == 0) - menu_height = 0; - else if (gui.starting) - menu_height = GetSystemMetrics(SM_CYMENU); - else - { - RECT r1, r2; - int frameht = GetSystemMetrics(SM_CYFRAME); - int capht = GetSystemMetrics(SM_CYCAPTION); - - /* get window rect of s_hwnd - * get client rect of s_hwnd - * get cap height - * subtract from window rect, the sum of client height, - * (if not maximized)frame thickness, and caption height. - */ - GetWindowRect(s_hwnd, &r1); - GetClientRect(s_hwnd, &r2); - menu_height = r1.bottom - r1.top - (r2.bottom-r2.top + - 2 * frameht * (!IsZoomed(s_hwnd)) + capht); - } - - if (fix_window && menu_height != old_menu_height) - { - old_menu_height = menu_height; - gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); - } - - return menu_height; -} -#endif /*FEAT_MENU*/ - - -/* - * Even though we have _DuringSizing() which makes the rubber band a valid - * size, we need this for when the user maximises the window. - * TODO: Doesn't seem to adjust the width though for some reason. - */ - static BOOL -_OnWindowPosChanging( - HWND hwnd, - LPWINDOWPOS lpwpos) -{ - - if (!IsIconic(hwnd) && !(lpwpos->flags & SWP_NOSIZE)) - { - gui_mswin_get_valid_dimensions(lpwpos->cx, lpwpos->cy, - &lpwpos->cx, &lpwpos->cy); - } - return 0; -} - - - - - - static LRESULT CALLBACK -_WndProc( - HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - /* - TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", - hwnd, uMsg, wParam, lParam); - */ - - HandleMouseHide(uMsg, lParam); - - s_uMsg = uMsg; - s_wParam = wParam; - s_lParam = lParam; - - switch (uMsg) - { - HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); - HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); - /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ - HANDLE_MSG(hwnd, WM_CHAR, _OnChar); - HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); - /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ - HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); - HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); - HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); - HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); -#ifdef FEAT_MENU - HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); -#endif - /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ - /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ - HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); - HANDLE_MSG(hwnd, WM_SIZE, _OnSize); - /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ - /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ - HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); - HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); - HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); - - case WM_QUERYENDSESSION: /* System wants to go down. */ - gui_shell_closed(); /* Will exit when no changed buffers. */ - return FALSE; /* Do NOT allow system to go down. */ - - case WM_ENDSESSION: - if (wParam) /* system only really goes down when wParam is TRUE */ - _OnEndSession(); - break; - - case WM_SYSCHAR: - /* - * if 'winaltkeys' is "no", or it's "menu" and it's not a menu - * shortcut key, handle like a typed ALT key, otherwise call Windows - * ALT key handling. - */ -#ifdef FEAT_MENU - if ( !gui.menu_is_active - || p_wak[0] == 'n' - || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) - ) -#endif - return HANDLE_WM_SYSCHAR((hwnd), (wParam), (lParam), (_OnSysChar)); -#ifdef FEAT_MENU - else - return MyWindowProc(hwnd, uMsg, wParam, lParam); -#endif - - case WM_SYSKEYUP: -#ifdef FEAT_MENU - /* Only when menu is active, ALT key is used for that. */ - if (gui.menu_is_active) - { - return MyWindowProc(hwnd, uMsg, wParam, lParam); - } - else -#endif - return 0; - -#if defined(MENUHINTS) && defined(FEAT_MENU) - case WM_MENUSELECT: - if (((UINT) LOWORD(lParam) - & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) - == MF_HILITE - && (State & CMDLINE) == 0) - { - UINT idButton; - int idx; - vimmenu_T *pMenu; - - idButton = (UINT)LOWORD(wParam); - pMenu = gui_mswin_find_menu(root_menu, idButton); - if (pMenu) - { - idx = MENU_INDEX_TIP; - msg_clr_cmdline(); - if (pMenu->strings[idx]) - msg(pMenu->strings[idx]); - else - msg(""); - setcursor(); - out_flush(); - } - } - break; -#endif - case WM_NCHITTEST: - { - LRESULT result; - int x, y; - int xPos = GET_X_LPARAM(lParam); - - result = MyWindowProc(hwnd, uMsg, wParam, lParam); - if (result == HTCLIENT) - { - gui_mch_get_winpos(&x, &y); - xPos -= x; - - if (xPos < 48) /*<VN> TODO should use system metric?*/ - return HTBOTTOMLEFT; - else - return HTBOTTOMRIGHT; - } - else - return result; - } - /* break; */ - default: -#ifdef MSWIN_FIND_REPLACE - if (uMsg == s_findrep_msg && s_findrep_msg != 0) - { - _OnFindRepl(); - } -#endif - return MyWindowProc(hwnd, uMsg, wParam, lParam); - } - - return 1; -} - - - -/* - * End of call-back routines - */ - - -/* - * Parse the GUI related command-line arguments. Any arguments used are - * deleted from argv, and *argc is decremented accordingly. This is called - * when vim is started, whether or not the GUI has been started. - */ - void -gui_mch_prepare(int *argc, char **argv) -{ - /* No special args for win16 GUI at the moment. */ - -} - -/* - * Initialise the GUI. Create all the windows, set up all the call-backs - * etc. - */ - int -gui_mch_init(void) -{ - const char szVimWndClass[] = VIM_CLASS; - const char szTextAreaClass[] = "VimTextArea"; - WNDCLASS wndclass; - -#ifdef WIN16_3DLOOK - Ctl3dRegister(s_hinst); - Ctl3dAutoSubclass(s_hinst); -#endif - - /* Display any pending error messages */ - display_errors(); - - gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); - gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); -#ifdef FEAT_MENU - gui.menu_height = 0; /* Windows takes care of this */ -#endif - gui.border_width = 0; - - gui.currBgColor = INVALCOLOR; - - s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - - if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) { - wndclass.style = 0; - wndclass.lpfnWndProc = _WndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = s_hinst; - wndclass.hIcon = LoadIcon(wndclass.hInstance, MAKEINTRESOURCE(IDR_VIM)); - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = s_brush; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szVimWndClass; - - if (( -#ifdef GLOBAL_IME - atom = -#endif - RegisterClass(&wndclass)) == 0) - return FAIL; - } - - s_hwnd = CreateWindow( - szVimWndClass, "Vim MSWindows GUI", - WS_OVERLAPPEDWINDOW, - gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, - gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, - 100, /* Any value will do */ - 100, /* Any value will do */ - NULL, NULL, - s_hinst, NULL); - - if (s_hwnd == NULL) - return FAIL; - -#ifdef GLOBAL_IME - global_ime_init(atom, s_hwnd); -#endif - - /* Create the text area window */ - if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0) { - wndclass.style = CS_OWNDC; - wndclass.lpfnWndProc = _TextAreaWndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = s_hinst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szTextAreaClass; - - if (RegisterClass(&wndclass) == 0) - return FAIL; - } - s_textArea = CreateWindow( - szTextAreaClass, "Vim text area", - WS_CHILD | WS_VISIBLE, 0, 0, - 100, /* Any value will do for now */ - 100, /* Any value will do for now */ - s_hwnd, NULL, - s_hinst, NULL); - - if (s_textArea == NULL) - return FAIL; - -#ifdef FEAT_MENU - s_menuBar = CreateMenu(); -#endif - s_hdc = GetDC(s_textArea); - -#ifdef MSWIN16_FASTTEXT - SetBkMode(s_hdc, OPAQUE); -#endif - - DragAcceptFiles(s_hwnd, TRUE); - - /* Do we need to bother with this? */ - /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ - - /* Get background/foreground colors from the system */ - gui_mch_def_colors(); - - /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc - * file) */ - set_normal_colors(); - - /* - * Check that none of the colors are the same as the background color. - * Then store the current values as the defaults. - */ - gui_check_colors(); - gui.def_norm_pixel = gui.norm_pixel; - gui.def_back_pixel = gui.back_pixel; - - /* Get the colors for the highlight groups (gui_check_colors() might have - * changed them) */ - highlight_gui_started(); - - /* - * Start out by adding the configured border width into the border offset - */ - gui.border_offset = gui.border_width; - - - /* - * compute a couple of metrics used for the dialogs - */ - get_dialog_font_metrics(); -#ifdef FEAT_TOOLBAR - /* - * Create the toolbar - */ - initialise_toolbar(); -#endif -#ifdef MSWIN_FIND_REPLACE - /* - * Initialise the dialog box stuff - */ - s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); - - /* Initialise the struct */ - s_findrep_struct.lStructSize = sizeof(s_findrep_struct); - s_findrep_struct.lpstrFindWhat = alloc(MSWIN_FR_BUFSIZE); - s_findrep_struct.lpstrFindWhat[0] = NUL; - s_findrep_struct.lpstrReplaceWith = alloc(MSWIN_FR_BUFSIZE); - s_findrep_struct.lpstrReplaceWith[0] = NUL; - s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; - s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; -#endif - - return OK; -} - - -/* - * Set the size of the window to the given width and height in pixels. - */ - void -gui_mch_set_shellsize(int width, int height, - int min_width, int min_height, int base_width, int base_height, - int direction) -{ - RECT workarea_rect; - int win_width, win_height; - int win_xpos, win_ypos; - WINDOWPLACEMENT wndpl; - - /* try to keep window completely on screen */ - /* get size of the screen work area - use SM_CYFULLSCREEN - * instead of SM_CYSCREEN so that we don't overlap the - * taskbar if someone fires us up on Win95/NT */ - workarea_rect.left = 0; - workarea_rect.top = 0; - workarea_rect.right = GetSystemMetrics(SM_CXSCREEN); - workarea_rect.bottom = GetSystemMetrics(SM_CYFULLSCREEN); - - /* get current position of our window */ - wndpl.length = sizeof(WINDOWPLACEMENT); - GetWindowPlacement(s_hwnd, &wndpl); - if (wndpl.showCmd == SW_SHOWNORMAL) - { - win_xpos = wndpl.rcNormalPosition.left; - win_ypos = wndpl.rcNormalPosition.top; - } - else - { - win_xpos = workarea_rect.left; - win_ypos = workarea_rect.top; - } - - /* compute the size of the outside of the window */ - win_width = width + GetSystemMetrics(SM_CXFRAME) * 2; - win_height = height + GetSystemMetrics(SM_CYFRAME) * 2 - + GetSystemMetrics(SM_CYCAPTION) -#ifdef FEAT_MENU - + gui_mswin_get_menu_height(FALSE) -#endif - ; - - /* if the window is going off the screen, move it on to the screen */ - if ((direction & RESIZE_HOR) && win_xpos + win_width > workarea_rect.right) - win_xpos = workarea_rect.right - win_width; - - if ((direction & RESIZE_HOR) && win_xpos < workarea_rect.left) - win_xpos = workarea_rect.left; - - if ((direction & RESIZE_VERT) - && win_ypos + win_height > workarea_rect.bottom) - win_ypos = workarea_rect.bottom - win_height; - - if ((direction & RESIZE_VERT) && win_ypos < workarea_rect.top) - win_ypos = workarea_rect.top; - - /* set window position */ - SetWindowPos(s_hwnd, NULL, win_xpos, win_ypos, win_width, win_height, - SWP_NOZORDER | SWP_NOACTIVATE); - -#ifdef FEAT_MENU - /* Menu may wrap differently now */ - gui_mswin_get_menu_height(!gui.starting); -#endif -} - - void -gui_mch_set_scrollbar_thumb( - scrollbar_T *sb, - long val, - long size, - long max) -{ - sb->scroll_shift = 0; - while (max > 32767) - { - max = (max + 1) >> 1; - val >>= 1; - size >>= 1; - ++sb->scroll_shift; - } - - if (sb->scroll_shift > 0) - ++size; - - SetScrollRange(sb->id, SB_CTL, 0, (int) max, FALSE); - SetScrollPos(sb->id, SB_CTL, (int) val, TRUE); -} - - -/* - * Set the current text font. - */ - void -gui_mch_set_font(GuiFont font) -{ - gui.currFont = font; - SelectFont(s_hdc, gui.currFont); -} - -/* - * Set the current text foreground color. - */ - void -gui_mch_set_fg_color(guicolor_T color) -{ - gui.currFgColor = color; - SetTextColor(s_hdc, gui.currFgColor); -} - -/* - * Set the current text background color. - */ - void -gui_mch_set_bg_color(guicolor_T color) -{ - if (gui.currBgColor == color) - return; - - gui.currBgColor = color; - SetBkColor(s_hdc, gui.currBgColor); -} - -/* - * Set the current text special color. - */ - void -gui_mch_set_sp_color(guicolor_T color) -{ - /* TODO */ -} - - - - void -gui_mch_draw_string( - int row, - int col, - char_u *text, - int len, - int flags) -{ -#ifndef MSWIN16_FASTTEXT - static int *padding = NULL; - static int pad_size = 0; - int i; -#endif - HPEN hpen, old_pen; - int y; - -#ifndef MSWIN16_FASTTEXT - /* - * Italic and bold text seems to have an extra row of pixels at the bottom - * (below where the bottom of the character should be). If we draw the - * characters with a solid background, the top row of pixels in the - * character below will be overwritten. We can fix this by filling in the - * background ourselves, to the correct character proportions, and then - * writing the character in transparent mode. Still have a problem when - * the character is "_", which gets written on to the character below. - * New fix: set gui.char_ascent to -1. This shifts all characters up one - * pixel in their slots, which fixes the problem with the bottom row of - * pixels. We still need this code because otherwise the top row of pixels - * becomes a problem. - webb. - */ - HBRUSH hbr; - RECT rc; - - if (!(flags & DRAW_TRANSP)) - { - /* - * Clear background first. - * Note: FillRect() excludes right and bottom of rectangle. - */ - rc.left = FILL_X(col); - rc.top = FILL_Y(row); -#ifdef FEAT_MBYTE - if (has_mbyte) - { - /* Compute the length in display cells. */ - rc.right = FILL_X(col + mb_string2cells(text, len)); - } - else -#endif - rc.right = FILL_X(col + len); - rc.bottom = FILL_Y(row + 1); - hbr = CreateSolidBrush(gui.currBgColor); - FillRect(s_hdc, &rc, hbr); - DeleteBrush(hbr); - - SetBkMode(s_hdc, TRANSPARENT); - - /* - * When drawing block cursor, prevent inverted character spilling - * over character cell (can happen with bold/italic) - */ - if (flags & DRAW_CURSOR) - { - pcliprect = &rc; - foptions = ETO_CLIPPED; - } - } -#else - /* - * Alternative: write the characters in opaque mode, since we have blocked - * bold or italic fonts. - */ - /* The OPAQUE mode and backcolour have already been set */ -#endif - /* The forecolor and font have already been set */ - -#ifndef MSWIN16_FASTTEXT - - if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) - { - vim_free(padding); - pad_size = Columns; - - padding = (int *)alloc(pad_size * sizeof(int)); - if (padding != NULL) - for (i = 0; i < pad_size; i++) - padding[i] = gui.char_width; - } -#endif - - /* - * We have to provide the padding argument because italic and bold versions - * of fixed-width fonts are often one pixel or so wider than their normal - * versions. - * No check for DRAW_BOLD, Windows will have done it already. - */ -#ifndef MSWIN16_FASTTEXT - ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), 0, NULL, - (char *)text, len, padding); -#else - TextOut(s_hdc, TEXT_X(col), TEXT_Y(row), (char *)text, len); -#endif - - if (flags & DRAW_UNDERL) - { - hpen = CreatePen(PS_SOLID, 1, gui.currFgColor); - old_pen = SelectObject(s_hdc, hpen); - /* When p_linespace is 0, overwrite the bottom row of pixels. - * Otherwise put the line just below the character. */ - y = FILL_Y(row + 1) - 1; -#ifndef MSWIN16_FASTTEXT - if (p_linespace > 1) - y -= p_linespace - 1; -#endif - MoveToEx(s_hdc, FILL_X(col), y, NULL); - /* Note: LineTo() excludes the last pixel in the line. */ - LineTo(s_hdc, FILL_X(col + len), y); - DeleteObject(SelectObject(s_hdc, old_pen)); - } -} - - -/* - * Output routines. - */ - -/* Flush any output to the screen */ - void -gui_mch_flush(void) -{ - /* Is anything needed here? */ -} - - static void -clear_rect(RECT *rcp) -{ - /* Use trick for fast rect clear */ - gui_mch_set_bg_color(gui.back_pixel); - ExtTextOut(s_hdc, 0, 0, ETO_CLIPPED | ETO_OPAQUE, rcp, NULL, 0, NULL); -} - - - void -gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) -{ - - *screen_w = GetSystemMetrics(SM_CXFULLSCREEN) - - GetSystemMetrics(SM_CXFRAME) * 2; - /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include - * the menubar for MSwin, we subtract it from the screen height, so that - * the window size can be made to fit on the screen. */ - *screen_h = GetSystemMetrics(SM_CYFULLSCREEN) - - GetSystemMetrics(SM_CYFRAME) * 2 -#ifdef FEAT_MENU - - gui_mswin_get_menu_height(FALSE) -#endif - ; -} - - -#if defined(FEAT_MENU) || defined(PROTO) -/* - * Add a sub menu to the menu bar. - */ - void -gui_mch_add_menu( - vimmenu_T *menu, - int pos) -{ - vimmenu_T *parent = menu->parent; - - menu->submenu_id = CreatePopupMenu(); - menu->id = s_menu_id++; - - if (menu_is_menubar(menu->name)) - { - InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id, - (UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION, - (UINT)menu->submenu_id, menu->name); - } - - /* Fix window size if menu may have wrapped */ - if (parent == NULL) - gui_mswin_get_menu_height(!gui.starting); -} - - void -gui_mch_show_popupmenu(vimmenu_T *menu) -{ - POINT mp; - - (void)GetCursorPos((LPPOINT)&mp); - gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); -} - - void -gui_make_popup(char_u *path_name, int mouse_pos) -{ - vimmenu_T *menu = gui_find_menu(path_name); - - if (menu != NULL) - { - /* Find the position of the current cursor */ - DWORD temp_p; - POINT p; - temp_p = GetDCOrg(s_hdc); - p.x = LOWORD(temp_p); - p.y = HIWORD(temp_p); - if (mouse_pos) - { - int mx, my; - - gui_mch_getmouse(&mx, &my); - p.x += mx; - p.y += my; - } - else if (curwin != NULL) - { - p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); - p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); - } - msg_scroll = FALSE; - gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); - } -} - -/* - * Add a menu item to a menu - */ - void -gui_mch_add_menu_item( - vimmenu_T *menu, - int idx) -{ - vimmenu_T *parent = menu->parent; - - menu->id = s_menu_id++; - menu->submenu_id = NULL; - -#ifdef FEAT_TOOLBAR - if (menu_is_toolbar(parent->name)) - { - TBBUTTON newtb; - - vim_memset(&newtb, 0, sizeof(newtb)); - if (menu_is_separator(menu->name)) - { - newtb.iBitmap = 0; - newtb.fsStyle = TBSTYLE_SEP; - } - else - { - if (menu->iconidx >= TOOLBAR_BITMAP_COUNT) - newtb.iBitmap = -1; - else - newtb.iBitmap = menu->iconidx; - newtb.fsStyle = TBSTYLE_BUTTON; - } - newtb.idCommand = menu->id; - newtb.fsState = TBSTATE_ENABLED; - SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, - (LPARAM)&newtb); - menu->submenu_id = (HMENU)-1; - } - else -#endif - { - InsertMenu(parent->submenu_id, (UINT)idx, - (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) - | MF_BYPOSITION, - (UINT)menu->id, menu->name); - } -} - -/* - * Destroy the machine specific menu widget. - */ - void -gui_mch_destroy_menu(vimmenu_T *menu) -{ - UINT i, j; - char pants[80]; /*<VN> hack*/ -#ifdef FEAT_TOOLBAR - /* - * is this a toolbar button? - */ - if (menu->submenu_id == (HMENU)-1) - { - int iButton; - - iButton = SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, (WPARAM)menu->id, 0); - SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); - } - else -#endif - { - /* - * negri: horrible API bug when running 16-bit programs under Win9x or - * NT means that we can't use MF_BYCOMMAND for menu items which have - * submenus, including the top-level headings. We have to find the menu - * item and use MF_BYPOSITION instead. :-p - */ - if (menu->parent != NULL - && menu_is_popup(menu->parent->dname) - && menu->parent->submenu_id != NULL) - RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); - else if (menu->submenu_id == NULL) - RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); - else if (menu->parent != NULL) - { - i = GetMenuItemCount(menu->parent->submenu_id); - for (j = 0; j < i; ++j) - { - GetMenuString(menu->parent->submenu_id, j, - pants, 80, MF_BYPOSITION); - if (strcmp(pants, menu->name) == 0) - { - RemoveMenu(menu->parent->submenu_id, j, MF_BYPOSITION); - break; - } - } - } - else - { - i = GetMenuItemCount(s_menuBar); - for (j = 0; j < i; ++j) - { - GetMenuString(s_menuBar, j, pants, 80, MF_BYPOSITION); - if (strcmp(pants, menu->name) == 0) - { - RemoveMenu(s_menuBar, j, MF_BYPOSITION); - break; - } - } - } - - if (menu->submenu_id != NULL) - DestroyMenu(menu->submenu_id); - } - DrawMenuBar(s_hwnd); -} - - -/* - * Make a menu either grey or not grey. - */ - void -gui_mch_menu_grey( - vimmenu_T *menu, - int grey) -{ -#ifdef FEAT_TOOLBAR - /* - * is this a toolbar button? - */ - if (menu->submenu_id == (HMENU)-1) - { - SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, - (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); - } - else -#endif - if (grey) - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_GRAYED); - else - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED); - -} - - -#endif /*FEAT_MENU*/ - - -/* define some macros used to make the dialogue creation more readable */ - -#define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) -#define add_word(x) *p++ = (x) -#define add_byte(x) *((LPSTR)p)++ = (x) -#define add_long(x) *((LPDWORD)p)++ = (x) - -#if defined(FEAT_GUI_DIALOG) || defined(PROTO) -/* - * stuff for dialogs - */ - -/* - * The callback routine used by all the dialogs. Very simple. First, - * acknowledges the INITDIALOG message so that Windows knows to do standard - * dialog stuff (Return = default, Esc = cancel....) Second, if a button is - * pressed, return that button's ID - IDCANCEL (2), which is the button's - * number. - */ - static BOOL CALLBACK -dialog_callback( - HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) -{ - if (message == WM_INITDIALOG) - { - CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); - /* Set focus to the dialog. Set the default button, if specified. */ - (void)SetFocus(hwnd); - if (dialog_default_button > IDCANCEL) - (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); -// if (dialog_default_button > 0) -// (void)SetFocus(GetDlgItem(hwnd, dialog_default_button + IDCANCEL)); - return FALSE; - } - - if (message == WM_COMMAND) - { - int button = LOWORD(wParam); - - /* Don't end the dialog if something was selected that was - * not a button. - */ - if (button >= DLG_NONBUTTON_CONTROL) - return TRUE; - - /* If the edit box exists, copy the string. */ - if (s_textfield != NULL) - GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, - s_textfield, IOSIZE); - - /* - * Need to check for IDOK because if the user just hits Return to - * accept the default value, some reason this is what we get. - */ - if (button == IDOK) - EndDialog(hwnd, dialog_default_button); - else - EndDialog(hwnd, button - IDCANCEL); - return TRUE; - } - - if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) - { - EndDialog(hwnd, 0); - return TRUE; - } - return FALSE; -} - -/* - * Create a dialog dynamically from the parameter strings. - * type = type of dialog (question, alert, etc.) - * title = dialog title. may be NULL for default title. - * message = text to display. Dialog sizes to accommodate it. - * buttons = '\n' separated list of button captions, default first. - * dfltbutton = number of default button. - * - * This routine returns 1 if the first button is pressed, - * 2 for the second, etc. - * - * 0 indicates Esc was pressed. - * -1 for unexpected error - * - * If stubbing out this fn, return 1. - */ - -static const char_u dlg_icons[] = /* must match names in resource file */ -{ - IDR_VIM, - IDR_VIM_ERROR, - IDR_VIM_ALERT, - IDR_VIM_INFO, - IDR_VIM_QUESTION -}; - - int -gui_mch_dialog( - int type, - char_u *title, - char_u *message, - char_u *buttons, - int dfltbutton, - char_u *textfield, - int ex_cmd) -{ - FARPROC dp; - LPWORD p, pnumitems; - int numButtons; - int *buttonWidths, *buttonPositions; - int buttonYpos; - int nchar, i; - DWORD lStyle; - int dlgwidth = 0; - int dlgheight; - int editboxheight; - int horizWidth; - int msgheight; - char_u *pstart; - char_u *pend; - char_u *tbuffer; - RECT rect; - HWND hwnd; - HDC hdc; - HFONT oldFont; - TEXTMETRIC fontInfo; - int fontHeight; - int textWidth, minButtonWidth, messageWidth; - int maxDialogWidth; - int vertical; - int dlgPaddingX; - int dlgPaddingY; - HGLOBAL hglbDlgTemp; - -#ifndef NO_CONSOLE - /* Don't output anything in silent mode ("ex -s") */ - if (silent_mode) - return dfltbutton; /* return default option */ -#endif - - /* If there is no window yet, open it. */ - if (s_hwnd == NULL && gui_mch_init() == FAIL) - return dfltbutton; - - if ((type < 0) || (type > VIM_LAST_TYPE)) - type = 0; - - /* allocate some memory for dialog template */ - /* TODO should compute this really*/ - - hglbDlgTemp = GlobalAlloc(GHND, DLG_ALLOC_SIZE); - if (hglbDlgTemp == NULL) - return -1; - - p = (LPWORD) GlobalLock(hglbDlgTemp); - - if (p == NULL) - return -1; - - /* - * make a copy of 'buttons' to fiddle with it. compiler grizzles because - * vim_strsave() doesn't take a const arg (why not?), so cast away the - * const. - */ - tbuffer = vim_strsave(buttons); - if (tbuffer == NULL) - return -1; - - --dfltbutton; /* Change from one-based to zero-based */ - - /* Count buttons */ - numButtons = 1; - for (i = 0; tbuffer[i] != '\0'; i++) - { - if (tbuffer[i] == DLG_BUTTON_SEP) - numButtons++; - } - if (dfltbutton >= numButtons) - dfltbutton = 0; - - /* Allocate array to hold the width of each button */ - buttonWidths = (int *) lalloc(numButtons * sizeof(int), TRUE); - if (buttonWidths == NULL) - return -1; - - /* Allocate array to hold the X position of each button */ - buttonPositions = (int *) lalloc(numButtons * sizeof(int), TRUE); - if (buttonPositions == NULL) - return -1; - - /* - * Calculate how big the dialog must be. - */ - hwnd = GetDesktopWindow(); - hdc = GetWindowDC(hwnd); - oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); - dlgPaddingX = DLG_OLD_STYLE_PADDING_X; - dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; - - GetTextMetrics(hdc, &fontInfo); - fontHeight = fontInfo.tmHeight; - - /* Minimum width for horizontal button */ - minButtonWidth = GetTextWidth(hdc, "Cancel", 6); - - /* Maximum width of a dialog, if possible */ - GetWindowRect(s_hwnd, &rect); - maxDialogWidth = rect.right - rect.left - - GetSystemMetrics(SM_CXFRAME) * 2; - if (maxDialogWidth < DLG_MIN_MAX_WIDTH) - maxDialogWidth = DLG_MIN_MAX_WIDTH; - - /* Set dlgwidth to width of message */ - pstart = message; - messageWidth = 0; - msgheight = 0; - do - { - pend = vim_strchr(pstart, DLG_BUTTON_SEP); - if (pend == NULL) - pend = pstart + STRLEN(pstart); /* Last line of message. */ - msgheight += fontHeight; - textWidth = GetTextWidth(hdc, pstart, pend - pstart); - if (textWidth > messageWidth) - messageWidth = textWidth; - pstart = pend + 1; - } while (*pend != NUL); - dlgwidth = messageWidth; - - /* Add width of icon to dlgwidth, and some space */ - dlgwidth += DLG_ICON_WIDTH + 3 * dlgPaddingX; - - if (msgheight < DLG_ICON_HEIGHT) - msgheight = DLG_ICON_HEIGHT; - - /* - * Check button names. A long one will make the dialog wider. - */ - vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL); - if (!vertical) - { - // Place buttons horizontally if they fit. - horizWidth = dlgPaddingX; - pstart = tbuffer; - i = 0; - do - { - pend = vim_strchr(pstart, DLG_BUTTON_SEP); - if (pend == NULL) - pend = pstart + STRLEN(pstart); // Last button name. - textWidth = GetTextWidth(hdc, pstart, pend - pstart); - if (textWidth < minButtonWidth) - textWidth = minButtonWidth; - textWidth += dlgPaddingX; /* Padding within button */ - buttonWidths[i] = textWidth; - buttonPositions[i++] = horizWidth; - horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ - pstart = pend + 1; - } while (*pend != NUL); - - if (horizWidth > maxDialogWidth) - vertical = TRUE; // Too wide to fit on the screen. - else if (horizWidth > dlgwidth) - dlgwidth = horizWidth; - } - - if (vertical) - { - // Stack buttons vertically. - pstart = tbuffer; - do - { - pend = vim_strchr(pstart, DLG_BUTTON_SEP); - if (pend == NULL) - pend = pstart + STRLEN(pstart); // Last button name. - textWidth = GetTextWidth(hdc, pstart, pend - pstart); - textWidth += dlgPaddingX; /* Padding within button */ - textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ - if (textWidth > dlgwidth) - dlgwidth = textWidth; - pstart = pend + 1; - } while (*pend != NUL); - } - - if (dlgwidth < DLG_MIN_WIDTH) - dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ - - /* start to fill in the dlgtemplate information. addressing by WORDs */ - lStyle = DS_MODALFRAME | WS_CAPTION | WS_VISIBLE ; - - add_long(lStyle); - pnumitems = p; /*save where the number of items must be stored*/ - add_byte(0); // NumberOfItems(will change later) - add_word(10); // x - add_word(10); // y - add_word(PixelToDialogX(dlgwidth)); - - // Dialog height. - if (vertical) - dlgheight = msgheight + 2 * dlgPaddingY + - DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; - else - dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; - - // Dialog needs to be taller if contains an edit box. - editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; - if (textfield != NULL) - dlgheight += editboxheight; - - add_word(PixelToDialogY(dlgheight)); - - add_byte(0); //menu - add_byte(0); //class - - /* copy the title of the dialog */ - add_string(title ? title : ("Vim"VIM_VERSION_MEDIUM)); - - buttonYpos = msgheight + 2 * dlgPaddingY; - - if (textfield != NULL) - buttonYpos += editboxheight; - - pstart = tbuffer; //dflt_text - horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ - for (i = 0; i < numButtons; i++) - { - /* get end of this button. */ - for ( pend = pstart; - *pend && (*pend != DLG_BUTTON_SEP); - pend++) - ; - - if (*pend) - *pend = '\0'; - - /* - * NOTE: - * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets - * the focus to the first tab-able button and in so doing makes that - * the default!! Grrr. Workaround: Make the default button the only - * one with WS_TABSTOP style. Means user can't tab between buttons, but - * he/she can use arrow keys. - * - * NOTE (Thore): Setting BS_DEFPUSHBUTTON works fine when it's the - * first one, so I changed the correct button to be this style. This - * is necessary because when an edit box is added, we need a button to - * be default. The edit box will be the default control, and when the - * user presses enter from the edit box we want the default button to - * be pressed. - */ - if (vertical) - { - p = add_dialog_element(p, - ((i == dfltbutton || dfltbutton < 0) && textfield != NULL - ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, - PixelToDialogX(DLG_VERT_PADDING_X), - PixelToDialogY(buttonYpos /* TBK */ - + 2 * fontHeight * i), - PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), - (WORD)(PixelToDialogY(2 * fontHeight) - 1), - (WORD)(IDCANCEL + 1 + i), (BYTE)0x80, pstart); - } - else - { - p = add_dialog_element(p, - ((i == dfltbutton || dfltbutton < 0) && textfield != NULL - ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, - PixelToDialogX(horizWidth + buttonPositions[i]), - PixelToDialogY(buttonYpos), /* TBK */ - PixelToDialogX(buttonWidths[i]), - (WORD)(PixelToDialogY(2 * fontHeight) - 1), - (WORD)(IDCANCEL + 1 + i), (BYTE)0x80, pstart); - } - - pstart = pend + 1; /*next button*/ - - } - *pnumitems += numButtons; - - /* Vim icon */ - p = add_dialog_element(p, SS_ICON, - PixelToDialogX(dlgPaddingX), - PixelToDialogY(dlgPaddingY), - PixelToDialogX(DLG_ICON_WIDTH), - PixelToDialogY(DLG_ICON_HEIGHT), - DLG_NONBUTTON_CONTROL + 0, (BYTE)0x82, - &dlg_icons[type]); - - - /* Dialog message */ - p = add_dialog_element(p, SS_LEFT, - PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), - PixelToDialogY(dlgPaddingY), - (WORD)(PixelToDialogX(messageWidth) + 1), - PixelToDialogY(msgheight), - DLG_NONBUTTON_CONTROL + 1, (BYTE)0x82, message); - - /* Edit box */ - if (textfield != NULL) - { - p = add_dialog_element(p, ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP | WS_BORDER, - PixelToDialogX(2 * dlgPaddingX), - PixelToDialogY(2 * dlgPaddingY + msgheight), - PixelToDialogX(dlgwidth - 4 * dlgPaddingX), - PixelToDialogY(fontHeight + dlgPaddingY), - DLG_NONBUTTON_CONTROL + 2, (BYTE)0x81, textfield); - *pnumitems += 1; - } - - *pnumitems += 2; - - SelectFont(hdc, oldFont); - ReleaseDC(hwnd, hdc); - dp = MakeProcInstance((FARPROC)dialog_callback, s_hinst); - - - /* Let the dialog_callback() function know which button to make default - * If we have an edit box, make that the default. We also need to tell - * dialog_callback() if this dialog contains an edit box or not. We do - * this by setting s_textfield if it does. - */ - if (textfield != NULL) - { - dialog_default_button = DLG_NONBUTTON_CONTROL + 2; - s_textfield = textfield; - } - else - { - dialog_default_button = IDCANCEL + 1 + dfltbutton; - s_textfield = NULL; - } - - /*show the dialog box modally and get a return value*/ - nchar = DialogBoxIndirect( - s_hinst, - (HGLOBAL) hglbDlgTemp, - s_hwnd, - (DLGPROC)dp); - - FreeProcInstance( dp ); - GlobalUnlock(hglbDlgTemp); - GlobalFree(hglbDlgTemp); - vim_free(tbuffer); - vim_free(buttonWidths); - vim_free(buttonPositions); - - - return nchar; -} - -/* - * Put a simple element (basic class) onto a dialog template in memory. - * return a pointer to where the next item should be added. - * - * parameters: - * lStyle = additional style flags - * x,y = x & y positions IN DIALOG UNITS - * w,h = width and height IN DIALOG UNITS - * Id = ID used in messages - * clss = class ID, e.g 0x80 for a button, 0x82 for a static - * caption = usually text or resource name - * - * TODO: use the length information noted here to enable the dialog creation - * routines to work out more exactly how much memory they need to alloc. - */ - static LPWORD -add_dialog_element( - LPWORD p, - DWORD lStyle, - WORD x, - WORD y, - WORD w, - WORD h, - WORD Id, - BYTE clss, - const char *caption) -{ - - lStyle = lStyle | WS_VISIBLE | WS_CHILD; - - add_word(x); - add_word(y); - add_word(w); - add_word(h); - add_word(Id); - add_long(lStyle); - add_byte(clss); - if (((lStyle & SS_ICON) != 0) && (clss == 0x82)) - { - /* Use resource ID */ - add_byte(0xff); - add_byte(*caption); - } - else - add_string(caption); - - add_byte(0); //# of extra bytes following - - - return p; -} - -#undef add_byte -#undef add_string -#undef add_long -#undef add_word - -#endif /* FEAT_GUI_DIALOG */ - - static void -get_dialog_font_metrics(void) -{ - DWORD dlgFontSize; - dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ - s_dlgfntwidth = LOWORD(dlgFontSize); - s_dlgfntheight = HIWORD(dlgFontSize); -} - - -#if defined(FEAT_TOOLBAR) || defined(PROTO) - -/* cproto fails on missing include files */ -#ifndef PROTO -# include "gui_w3~1.h" -#endif - -/* - * Create the toolbar, initially unpopulated. - * (just like the menu, there are no defaults, it's all - * set up through menu.vim) - */ - static void -initialise_toolbar(void) -{ - s_toolbarhwnd = CreateToolbar( - s_hwnd, - WS_CHILD | WS_VISIBLE, - CMD_TB_BASE, /*<vn>*/ - 31, //number of images in initial bitmap - s_hinst, - IDR_TOOLBAR1, // id of initial bitmap - NULL, - 0 // initial number of buttons - ); - - gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); -} -#endif - -#if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) -/* - * Make the GUI window come to the foreground. - */ - void -gui_mch_set_foreground(void) -{ - if (IsIconic(s_hwnd)) - SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); - SetActiveWindow(s_hwnd); -} -#endif diff --git a/src/gui_w32.c b/src/gui_w32.c index 2d57fbb272..be1f919a46 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI support by Robert Webb @@ -10,14 +10,14 @@ /* * Windows GUI. * - * GUI support for Microsoft Windows. Win32 initially; maybe Win16 later + * GUI support for Microsoft Windows, aka Win32. Also for Win64. * * George V. Reilly <george@reilly.org> wrote the original Win32 GUI. * Robert Webb reworked it to use the existing GUI stuff and added menu, * scrollbars, etc. * * Note: Clipboard stuff, for cutting and pasting text to other windows, is in - * os_win32.c. (It can also be done from the terminal version). + * winclip.c. (It can also be done from the terminal version). * * TODO: Some of the function signatures ought to be updated for Win64; * e.g., replace LONG with LONG_PTR, etc. @@ -25,26 +25,4176 @@ #include "vim.h" +#if defined(FEAT_DIRECTX) +# include "gui_dwrite.h" +#endif + +#if defined(FEAT_DIRECTX) +# ifndef FEAT_MBYTE +# error FEAT_MBYTE is required for FEAT_DIRECTX. +# endif +static DWriteContext *s_dwc = NULL; +static int s_directx_enabled = 0; +static int s_directx_load_attempted = 0; +# define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8) +static int directx_enabled(void); +static void directx_binddc(void); +#endif + +#ifdef FEAT_MENU +static int gui_mswin_get_menu_height(int fix_window); +#endif + +#if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) + int +gui_mch_set_rendering_options(char_u *s) +{ +# ifdef FEAT_DIRECTX + char_u *p, *q; + + int dx_enable = 0; + int dx_flags = 0; + float dx_gamma = 0.0f; + float dx_contrast = 0.0f; + float dx_level = 0.0f; + int dx_geom = 0; + int dx_renmode = 0; + int dx_taamode = 0; + + /* parse string as rendering options. */ + for (p = s; p != NULL && *p != NUL; ) + { + char_u item[256]; + char_u name[128]; + char_u value[128]; + + copy_option_part(&p, item, sizeof(item), ","); + if (p == NULL) + break; + q = &item[0]; + copy_option_part(&q, name, sizeof(name), ":"); + if (q == NULL) + return FAIL; + copy_option_part(&q, value, sizeof(value), ":"); + + if (STRCMP(name, "type") == 0) + { + if (STRCMP(value, "directx") == 0) + dx_enable = 1; + else + return FAIL; + } + else if (STRCMP(name, "gamma") == 0) + { + dx_flags |= 1 << 0; + dx_gamma = (float)atof((char *)value); + } + else if (STRCMP(name, "contrast") == 0) + { + dx_flags |= 1 << 1; + dx_contrast = (float)atof((char *)value); + } + else if (STRCMP(name, "level") == 0) + { + dx_flags |= 1 << 2; + dx_level = (float)atof((char *)value); + } + else if (STRCMP(name, "geom") == 0) + { + dx_flags |= 1 << 3; + dx_geom = atoi((char *)value); + if (dx_geom < 0 || dx_geom > 2) + return FAIL; + } + else if (STRCMP(name, "renmode") == 0) + { + dx_flags |= 1 << 4; + dx_renmode = atoi((char *)value); + if (dx_renmode < 0 || dx_renmode > 6) + return FAIL; + } + else if (STRCMP(name, "taamode") == 0) + { + dx_flags |= 1 << 5; + dx_taamode = atoi((char *)value); + if (dx_taamode < 0 || dx_taamode > 3) + return FAIL; + } + else if (STRCMP(name, "scrlines") == 0) + { + /* Deprecated. Simply ignore it. */ + } + else + return FAIL; + } + + if (!gui.in_use) + return OK; /* only checking the syntax of the value */ + + /* Enable DirectX/DirectWrite */ + if (dx_enable) + { + if (!directx_enabled()) + return FAIL; + DWriteContext_SetRenderingParams(s_dwc, NULL); + if (dx_flags) + { + DWriteRenderingParams param; + DWriteContext_GetRenderingParams(s_dwc, ¶m); + if (dx_flags & (1 << 0)) + param.gamma = dx_gamma; + if (dx_flags & (1 << 1)) + param.enhancedContrast = dx_contrast; + if (dx_flags & (1 << 2)) + param.clearTypeLevel = dx_level; + if (dx_flags & (1 << 3)) + param.pixelGeometry = dx_geom; + if (dx_flags & (1 << 4)) + param.renderingMode = dx_renmode; + if (dx_flags & (1 << 5)) + param.textAntialiasMode = dx_taamode; + DWriteContext_SetRenderingParams(s_dwc, ¶m); + } + } + s_directx_enabled = dx_enable; + + return OK; +# else + return FAIL; +# endif +} +#endif + +/* + * These are new in Windows ME/XP, only defined in recent compilers. + */ +#ifndef HANDLE_WM_XBUTTONUP +# define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#endif +#ifndef HANDLE_WM_XBUTTONDOWN +# define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#endif +#ifndef HANDLE_WM_XBUTTONDBLCLK +# define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#endif + + +#include "version.h" /* used by dialog box routine for default title */ +#ifdef DEBUG +# include <tchar.h> +#endif + +/* cproto fails on missing include files */ +#ifndef PROTO + +#ifndef __MINGW32__ +# include <shellapi.h> +#endif +#if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE) +# include <commctrl.h> +#endif +#include <windowsx.h> + +#ifdef GLOBAL_IME +# include "glbl_ime.h" +#endif + +#endif /* PROTO */ + +#ifdef FEAT_MENU +# define MENUHINTS /* show menu hints in command line */ +#endif + +/* Some parameters for dialog boxes. All in pixels. */ +#define DLG_PADDING_X 10 +#define DLG_PADDING_Y 10 +#define DLG_OLD_STYLE_PADDING_X 5 +#define DLG_OLD_STYLE_PADDING_Y 5 +#define DLG_VERT_PADDING_X 4 /* For vertical buttons */ +#define DLG_VERT_PADDING_Y 4 +#define DLG_ICON_WIDTH 34 +#define DLG_ICON_HEIGHT 34 +#define DLG_MIN_WIDTH 150 +#define DLG_FONT_NAME "MS Sans Serif" +#define DLG_FONT_POINT_SIZE 8 +#define DLG_MIN_MAX_WIDTH 400 +#define DLG_MIN_MAX_HEIGHT 400 + +#define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */ + +#ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */ +# define WM_XBUTTONDOWN 0x020B +# define WM_XBUTTONUP 0x020C +# define WM_XBUTTONDBLCLK 0x020D +# define MK_XBUTTON1 0x0020 +# define MK_XBUTTON2 0x0040 +#endif + +#ifdef PROTO +/* + * Define a few things for generating prototypes. This is just to avoid + * syntax errors, the defines do not need to be correct. + */ +# define APIENTRY +# define CALLBACK +# define CONST +# define FAR +# define NEAR +# undef _cdecl +# define _cdecl +typedef int BOOL; +typedef int BYTE; +typedef int DWORD; +typedef int WCHAR; +typedef int ENUMLOGFONT; +typedef int FINDREPLACE; +typedef int HANDLE; +typedef int HBITMAP; +typedef int HBRUSH; +typedef int HDROP; +typedef int INT; +typedef int LOGFONT[]; +typedef int LPARAM; +typedef int LPCREATESTRUCT; +typedef int LPCSTR; +typedef int LPCTSTR; +typedef int LPRECT; +typedef int LPSTR; +typedef int LPWINDOWPOS; +typedef int LPWORD; +typedef int LRESULT; +typedef int HRESULT; +# undef MSG +typedef int MSG; +typedef int NEWTEXTMETRIC; +typedef int OSVERSIONINFO; +typedef int PWORD; +typedef int RECT; +typedef int UINT; +typedef int WORD; +typedef int WPARAM; +typedef int POINT; +typedef void *HINSTANCE; +typedef void *HMENU; +typedef void *HWND; +typedef void *HDC; +typedef void VOID; +typedef int LPNMHDR; +typedef int LONG; +typedef int WNDPROC; +typedef int UINT_PTR; +typedef int COLORREF; +typedef int HCURSOR; +#endif + +#ifndef GET_X_LPARAM +# define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#endif + +static void _OnPaint( HWND hwnd); +static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color); +static void clear_rect(RECT *rcp); + +static WORD s_dlgfntheight; /* height of the dialog font */ +static WORD s_dlgfntwidth; /* width of the dialog font */ + +#ifdef FEAT_MENU +static HMENU s_menuBar = NULL; +#endif +#ifdef FEAT_TEAROFF +static void rebuild_tearoff(vimmenu_T *menu); +static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */ +#endif + +/* Flag that is set while processing a message that must not be interrupted by + * processing another message. */ +static int s_busy_processing = FALSE; + +static int destroying = FALSE; /* call DestroyWindow() ourselves */ + +#ifdef MSWIN_FIND_REPLACE +static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ +static FINDREPLACE s_findrep_struct; +# ifdef FEAT_MBYTE +static FINDREPLACEW s_findrep_struct_w; +# endif +static HWND s_findrep_hwnd = NULL; +static int s_findrep_is_find; /* TRUE for find dialog, FALSE + for find/replace dialog */ +#endif + +static HINSTANCE s_hinst = NULL; +#if !defined(FEAT_GUI) +static +#endif +HWND s_hwnd = NULL; +static HDC s_hdc = NULL; +static HBRUSH s_brush = NULL; + +#ifdef FEAT_TOOLBAR +static HWND s_toolbarhwnd = NULL; +static WNDPROC s_toolbar_wndproc = NULL; +#endif + +#ifdef FEAT_GUI_TABLINE +static HWND s_tabhwnd = NULL; +static WNDPROC s_tabline_wndproc = NULL; +static int showing_tabline = 0; +#endif + +static WPARAM s_wParam = 0; +static LPARAM s_lParam = 0; + +static HWND s_textArea = NULL; +static UINT s_uMsg = 0; + +static char_u *s_textfield; /* Used by dialogs to pass back strings */ + +static int s_need_activate = FALSE; + +/* This variable is set when waiting for an event, which is the only moment + * scrollbar dragging can be done directly. It's not allowed while commands + * are executed, because it may move the cursor and that may cause unexpected + * problems (e.g., while ":s" is working). + */ +static int allow_scrollbar = FALSE; + +#ifdef GLOBAL_IME +# define MyTranslateMessage(x) global_ime_TranslateMessage(x) +#else +# define MyTranslateMessage(x) TranslateMessage(x) +#endif + +#if defined(FEAT_DIRECTX) + static int +directx_enabled(void) +{ + if (s_dwc != NULL) + return 1; + else if (s_directx_load_attempted) + return 0; + /* load DirectX */ + DWrite_Init(); + s_directx_load_attempted = 1; + s_dwc = DWriteContext_Open(); + directx_binddc(); + return s_dwc != NULL ? 1 : 0; +} + + static void +directx_binddc(void) +{ + if (s_textArea != NULL) + { + RECT rect; + GetClientRect(s_textArea, &rect); + DWriteContext_BindDC(s_dwc, s_hdc, &rect); + } +} +#endif + +#if defined(FEAT_MBYTE) || defined(GLOBAL_IME) + /* use of WindowProc depends on wide_WindowProc */ +# define MyWindowProc vim_WindowProc +#else + /* use ordinary WindowProc */ +# define MyWindowProc DefWindowProc +#endif + +extern int current_font_height; /* this is in os_mswin.c */ + +static struct +{ + UINT key_sym; + char_u vim_code0; + char_u vim_code1; +} special_keys[] = +{ + {VK_UP, 'k', 'u'}, + {VK_DOWN, 'k', 'd'}, + {VK_LEFT, 'k', 'l'}, + {VK_RIGHT, 'k', 'r'}, + + {VK_F1, 'k', '1'}, + {VK_F2, 'k', '2'}, + {VK_F3, 'k', '3'}, + {VK_F4, 'k', '4'}, + {VK_F5, 'k', '5'}, + {VK_F6, 'k', '6'}, + {VK_F7, 'k', '7'}, + {VK_F8, 'k', '8'}, + {VK_F9, 'k', '9'}, + {VK_F10, 'k', ';'}, + + {VK_F11, 'F', '1'}, + {VK_F12, 'F', '2'}, + {VK_F13, 'F', '3'}, + {VK_F14, 'F', '4'}, + {VK_F15, 'F', '5'}, + {VK_F16, 'F', '6'}, + {VK_F17, 'F', '7'}, + {VK_F18, 'F', '8'}, + {VK_F19, 'F', '9'}, + {VK_F20, 'F', 'A'}, + + {VK_F21, 'F', 'B'}, +#ifdef FEAT_NETBEANS_INTG + {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */ +#endif + {VK_F22, 'F', 'C'}, + {VK_F23, 'F', 'D'}, + {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */ + + {VK_HELP, '%', '1'}, + {VK_BACK, 'k', 'b'}, + {VK_INSERT, 'k', 'I'}, + {VK_DELETE, 'k', 'D'}, + {VK_HOME, 'k', 'h'}, + {VK_END, '@', '7'}, + {VK_PRIOR, 'k', 'P'}, + {VK_NEXT, 'k', 'N'}, + {VK_PRINT, '%', '9'}, + {VK_ADD, 'K', '6'}, + {VK_SUBTRACT, 'K', '7'}, + {VK_DIVIDE, 'K', '8'}, + {VK_MULTIPLY, 'K', '9'}, + {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ + {VK_DECIMAL, 'K', 'B'}, + + {VK_NUMPAD0, 'K', 'C'}, + {VK_NUMPAD1, 'K', 'D'}, + {VK_NUMPAD2, 'K', 'E'}, + {VK_NUMPAD3, 'K', 'F'}, + {VK_NUMPAD4, 'K', 'G'}, + {VK_NUMPAD5, 'K', 'H'}, + {VK_NUMPAD6, 'K', 'I'}, + {VK_NUMPAD7, 'K', 'J'}, + {VK_NUMPAD8, 'K', 'K'}, + {VK_NUMPAD9, 'K', 'L'}, + + /* Keys that we want to be able to use any modifier with: */ + {VK_SPACE, ' ', NUL}, + {VK_TAB, TAB, NUL}, + {VK_ESCAPE, ESC, NUL}, + {NL, NL, NUL}, + {CAR, CAR, NUL}, + + /* End of list marker: */ + {0, 0, 0} +}; + +/* Local variables */ +static int s_button_pending = -1; + +/* s_getting_focus is set when we got focus but didn't see mouse-up event yet, + * so don't reset s_button_pending. */ +static int s_getting_focus = FALSE; + +static int s_x_pending; +static int s_y_pending; +static UINT s_kFlags_pending; +static UINT s_wait_timer = 0; // Timer for get char from user +static int s_timed_out = FALSE; +static int dead_key = 0; // 0: no dead key, 1: dead key pressed +static UINT surrogate_pending_ch = 0; // 0: no surrogate pending, + // else a high surrogate + +#ifdef FEAT_BEVAL_GUI +/* balloon-eval WM_NOTIFY_HANDLER */ +static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); +static void TrackUserActivity(UINT uMsg); +#endif + +/* + * For control IME. + * + * These LOGFONT used for IME. + */ +#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) +/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */ +static LOGFONT norm_logfont; +#endif +#ifdef FEAT_MBYTE_IME +/* holds LOGFONT for 'guifont' always. */ +static LOGFONT sub_logfont; +#endif + +#ifdef FEAT_MBYTE_IME +static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData); +#endif + +#if defined(FEAT_BROWSE) +static char_u *convert_filter(char_u *s); +#endif + +#ifdef DEBUG_PRINT_ERROR +/* + * Print out the last Windows error message + */ + static void +print_windows_error(void) +{ + LPVOID lpMsgBuf; + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, 0, NULL); + TRACE1("Error: %s\n", lpMsgBuf); + LocalFree(lpMsgBuf); +} +#endif + +/* + * Cursor blink functions. + * + * This is a simple state machine: + * BLINK_NONE not blinking at all + * BLINK_OFF blinking, cursor is not shown + * BLINK_ON blinking, cursor is shown + */ + +#define BLINK_NONE 0 +#define BLINK_OFF 1 +#define BLINK_ON 2 + +static int blink_state = BLINK_NONE; +static long_u blink_waittime = 700; +static long_u blink_ontime = 400; +static long_u blink_offtime = 250; +static UINT blink_timer = 0; + + int +gui_mch_is_blinking(void) +{ + return blink_state != BLINK_NONE; +} + + int +gui_mch_is_blink_off(void) +{ + return blink_state == BLINK_OFF; +} + + void +gui_mch_set_blinking(long wait, long on, long off) +{ + blink_waittime = wait; + blink_ontime = on; + blink_offtime = off; +} + + static VOID CALLBACK +_OnBlinkTimer( + HWND hwnd, + UINT uMsg UNUSED, + UINT idEvent, + DWORD dwTime UNUSED) +{ + MSG msg; + + /* + TRACE2("Got timer event, id %d, blink_timer %d\n", idEvent, blink_timer); + */ + + KillTimer(NULL, idEvent); + + /* Eat spurious WM_TIMER messages */ + while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) + ; + + if (blink_state == BLINK_ON) + { + gui_undraw_cursor(); + blink_state = BLINK_OFF; + blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_offtime, + (TIMERPROC)_OnBlinkTimer); + } + else + { + gui_update_cursor(TRUE, FALSE); + blink_state = BLINK_ON; + blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, + (TIMERPROC)_OnBlinkTimer); + } + gui_mch_flush(); +} + + static void +gui_mswin_rm_blink_timer(void) +{ + MSG msg; + + if (blink_timer != 0) + { + KillTimer(NULL, blink_timer); + /* Eat spurious WM_TIMER messages */ + while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) + ; + blink_timer = 0; + } +} + +/* + * Stop the cursor blinking. Show the cursor if it wasn't shown. + */ + void +gui_mch_stop_blink(int may_call_gui_update_cursor) +{ + gui_mswin_rm_blink_timer(); + if (blink_state == BLINK_OFF && may_call_gui_update_cursor) + { + gui_update_cursor(TRUE, FALSE); + gui_mch_flush(); + } + blink_state = BLINK_NONE; +} + +/* + * Start the cursor blinking. If it was already blinking, this restarts the + * waiting time and shows the cursor. + */ + void +gui_mch_start_blink(void) +{ + gui_mswin_rm_blink_timer(); + + /* Only switch blinking on if none of the times is zero */ + if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) + { + blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime, + (TIMERPROC)_OnBlinkTimer); + blink_state = BLINK_ON; + gui_update_cursor(TRUE, FALSE); + gui_mch_flush(); + } +} + +/* + * Call-back routines. + */ + + static VOID CALLBACK +_OnTimer( + HWND hwnd, + UINT uMsg UNUSED, + UINT idEvent, + DWORD dwTime UNUSED) +{ + MSG msg; + + /* + TRACE2("Got timer event, id %d, s_wait_timer %d\n", idEvent, s_wait_timer); + */ + KillTimer(NULL, idEvent); + s_timed_out = TRUE; + + /* Eat spurious WM_TIMER messages */ + while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) + ; + if (idEvent == s_wait_timer) + s_wait_timer = 0; +} + + static void +_OnDeadChar( + HWND hwnd UNUSED, + UINT ch UNUSED, + int cRepeat UNUSED) +{ + dead_key = 1; +} + +/* + * Convert Unicode character "ch" to bytes in "string[slen]". + * When "had_alt" is TRUE the ALT key was included in "ch". + * Return the length. + * Because the Windows API uses UTF-16, we have to deal with surrogate + * pairs; this is where we choose to deal with them: if "ch" is a high + * surrogate, it will be stored, and the length returned will be zero; the next + * char_to_string call will then include the high surrogate, decoding the pair + * of UTF-16 code units to a single Unicode code point, presuming it is the + * matching low surrogate. + */ + static int +char_to_string(int ch, char_u *string, int slen, int had_alt) +{ + int len; + int i; +#ifdef FEAT_MBYTE + WCHAR wstring[2]; + char_u *ws = NULL; + + if (surrogate_pending_ch != 0) + { + /* We don't guarantee ch is a low surrogate to match the high surrogate + * we already have; it should be, but if it isn't, tough luck. */ + wstring[0] = surrogate_pending_ch; + wstring[1] = ch; + surrogate_pending_ch = 0; + len = 2; + } + else if (ch >= 0xD800 && ch <= 0xDBFF) /* high surrogate */ + { + /* We don't have the entire code point yet, only the first UTF-16 code + * unit; so just remember it and use it in the next call. */ + surrogate_pending_ch = ch; + return 0; + } + else + { + wstring[0] = ch; + len = 1; + } + + /* "ch" is a UTF-16 character. Convert it to a string of bytes. When + * "enc_codepage" is non-zero use the standard Win32 function, + * otherwise use our own conversion function (e.g., for UTF-8). */ + if (enc_codepage > 0) + { + len = WideCharToMultiByte(enc_codepage, 0, wstring, len, + (LPSTR)string, slen, 0, NULL); + /* If we had included the ALT key into the character but now the + * upper bit is no longer set, that probably means the conversion + * failed. Convert the original character and set the upper bit + * afterwards. */ + if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80) + { + wstring[0] = ch & 0x7f; + len = WideCharToMultiByte(enc_codepage, 0, wstring, len, + (LPSTR)string, slen, 0, NULL); + if (len == 1) /* safety check */ + string[0] |= 0x80; + } + } + else + { + ws = utf16_to_enc(wstring, &len); + if (ws == NULL) + len = 0; + else + { + if (len > slen) /* just in case */ + len = slen; + mch_memmove(string, ws, len); + vim_free(ws); + } + } + + if (len == 0) +#endif + { + string[0] = ch; + len = 1; + } + + for (i = 0; i < len; ++i) + if (string[i] == CSI && len <= slen - 2) + { + /* Insert CSI as K_CSI. */ + mch_memmove(string + i + 3, string + i + 1, len - i - 1); + string[++i] = KS_EXTRA; + string[++i] = (int)KE_CSI; + len += 2; + } + + return len; +} + +/* + * Key hit, add it to the input buffer. + */ + static void +_OnChar( + HWND hwnd UNUSED, + UINT ch, + int cRepeat UNUSED) +{ + char_u string[40]; + int len = 0; + + dead_key = 0; + + len = char_to_string(ch, string, 40, FALSE); + if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts) + { + trash_input_buf(); + got_int = TRUE; + } + + add_to_input_buf(string, len); +} + +/* + * Alt-Key hit, add it to the input buffer. + */ + static void +_OnSysChar( + HWND hwnd UNUSED, + UINT cch, + int cRepeat UNUSED) +{ + char_u string[40]; /* Enough for multibyte character */ + int len; + int modifiers; + int ch = cch; /* special keys are negative */ + + dead_key = 0; + + /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */ + + /* OK, we have a character key (given by ch) which was entered with the + * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note + * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless + * CAPSLOCK is pressed) at this point. + */ + modifiers = MOD_MASK_ALT; + if (GetKeyState(VK_SHIFT) & 0x8000) + modifiers |= MOD_MASK_SHIFT; + if (GetKeyState(VK_CONTROL) & 0x8000) + modifiers |= MOD_MASK_CTRL; + + ch = simplify_key(ch, &modifiers); + /* remove the SHIFT modifier for keys where it's already included, e.g., + * '(' and '*' */ + if (ch < 0x100 && !isalpha(ch) && isprint(ch)) + modifiers &= ~MOD_MASK_SHIFT; + + /* Interpret the ALT key as making the key META, include SHIFT, etc. */ + ch = extract_modifiers(ch, &modifiers); + if (ch == CSI) + ch = K_CSI; + + len = 0; + if (modifiers) + { + string[len++] = CSI; + string[len++] = KS_MODIFIER; + string[len++] = modifiers; + } + + if (IS_SPECIAL((int)ch)) + { + string[len++] = CSI; + string[len++] = K_SECOND((int)ch); + string[len++] = K_THIRD((int)ch); + } + else + { + /* Although the documentation isn't clear about it, we assume "ch" is + * a Unicode character. */ + len += char_to_string(ch, string + len, 40 - len, TRUE); + } + + add_to_input_buf(string, len); +} + + static void +_OnMouseEvent( + int button, + int x, + int y, + int repeated_click, + UINT keyFlags) +{ + int vim_modifiers = 0x0; + + s_getting_focus = FALSE; + + if (keyFlags & MK_SHIFT) + vim_modifiers |= MOUSE_SHIFT; + if (keyFlags & MK_CONTROL) + vim_modifiers |= MOUSE_CTRL; + if (GetKeyState(VK_MENU) & 0x8000) + vim_modifiers |= MOUSE_ALT; + + gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); +} + + static void +_OnMouseButtonDown( + HWND hwnd UNUSED, + BOOL fDoubleClick UNUSED, + int x, + int y, + UINT keyFlags) +{ + static LONG s_prevTime = 0; + + LONG currentTime = GetMessageTime(); + int button = -1; + int repeated_click; + + /* Give main window the focus: this is so the cursor isn't hollow. */ + (void)SetFocus(s_hwnd); + + if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK) + button = MOUSE_LEFT; + else if (s_uMsg == WM_MBUTTONDOWN || s_uMsg == WM_MBUTTONDBLCLK) + button = MOUSE_MIDDLE; + else if (s_uMsg == WM_RBUTTONDOWN || s_uMsg == WM_RBUTTONDBLCLK) + button = MOUSE_RIGHT; + else if (s_uMsg == WM_XBUTTONDOWN || s_uMsg == WM_XBUTTONDBLCLK) + { +#ifndef GET_XBUTTON_WPARAM +# define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) +#endif + button = ((GET_XBUTTON_WPARAM(s_wParam) == 1) ? MOUSE_X1 : MOUSE_X2); + } + else if (s_uMsg == WM_CAPTURECHANGED) + { + /* on W95/NT4, somehow you get in here with an odd Msg + * if you press one button while holding down the other..*/ + if (s_button_pending == MOUSE_LEFT) + button = MOUSE_RIGHT; + else + button = MOUSE_LEFT; + } + if (button >= 0) + { + repeated_click = ((int)(currentTime - s_prevTime) < p_mouset); + + /* + * Holding down the left and right buttons simulates pushing the middle + * button. + */ + if (repeated_click + && ((button == MOUSE_LEFT && s_button_pending == MOUSE_RIGHT) + || (button == MOUSE_RIGHT + && s_button_pending == MOUSE_LEFT))) + { + /* + * Hmm, gui.c will ignore more than one button down at a time, so + * pretend we let go of it first. + */ + gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, 0x0); + button = MOUSE_MIDDLE; + repeated_click = FALSE; + s_button_pending = -1; + _OnMouseEvent(button, x, y, repeated_click, keyFlags); + } + else if ((repeated_click) + || (mouse_model_popup() && (button == MOUSE_RIGHT))) + { + if (s_button_pending > -1) + { + _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); + s_button_pending = -1; + } + /* TRACE("Button down at x %d, y %d\n", x, y); */ + _OnMouseEvent(button, x, y, repeated_click, keyFlags); + } + else + { + /* + * If this is the first press (i.e. not a multiple click) don't + * action immediately, but store and wait for: + * i) button-up + * ii) mouse move + * iii) another button press + * before using it. + * This enables us to make left+right simulate middle button, + * without left or right being actioned first. The side-effect is + * that if you click and hold the mouse without dragging, the + * cursor doesn't move until you release the button. In practice + * this is hardly a problem. + */ + s_button_pending = button; + s_x_pending = x; + s_y_pending = y; + s_kFlags_pending = keyFlags; + } + + s_prevTime = currentTime; + } +} + + static void +_OnMouseMoveOrRelease( + HWND hwnd UNUSED, + int x, + int y, + UINT keyFlags) +{ + int button; + + s_getting_focus = FALSE; + if (s_button_pending > -1) + { + /* Delayed action for mouse down event */ + _OnMouseEvent(s_button_pending, s_x_pending, + s_y_pending, FALSE, s_kFlags_pending); + s_button_pending = -1; + } + if (s_uMsg == WM_MOUSEMOVE) + { + /* + * It's only a MOUSE_DRAG if one or more mouse buttons are being held + * down. + */ + if (!(keyFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON + | MK_XBUTTON1 | MK_XBUTTON2))) + { + gui_mouse_moved(x, y); + return; + } + + /* + * While button is down, keep grabbing mouse move events when + * the mouse goes outside the window + */ + SetCapture(s_textArea); + button = MOUSE_DRAG; + /* TRACE(" move at x %d, y %d\n", x, y); */ + } + else + { + ReleaseCapture(); + button = MOUSE_RELEASE; + /* TRACE(" up at x %d, y %d\n", x, y); */ + } + + _OnMouseEvent(button, x, y, FALSE, keyFlags); +} + + static void +_OnSizeTextArea( + HWND hwnd UNUSED, + UINT state UNUSED, + int cx UNUSED, + int cy UNUSED) +{ +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + directx_binddc(); +#endif +} + +#ifdef FEAT_MENU +/* + * Find the vimmenu_T with the given id + */ + static vimmenu_T * +gui_mswin_find_menu( + vimmenu_T *pMenu, + int id) +{ + vimmenu_T *pChildMenu; + + while (pMenu) + { + if (pMenu->id == (UINT)id) + break; + if (pMenu->children != NULL) + { + pChildMenu = gui_mswin_find_menu(pMenu->children, id); + if (pChildMenu) + { + pMenu = pChildMenu; + break; + } + } + pMenu = pMenu->next; + } + return pMenu; +} + + static void +_OnMenu( + HWND hwnd UNUSED, + int id, + HWND hwndCtl UNUSED, + UINT codeNotify UNUSED) +{ + vimmenu_T *pMenu; + + pMenu = gui_mswin_find_menu(root_menu, id); + if (pMenu) + gui_menu_cb(pMenu); +} +#endif + +#ifdef MSWIN_FIND_REPLACE +# ifdef FEAT_MBYTE +/* + * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW + */ + static void +findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) +{ + WCHAR *wp; + + lpfrw->hwndOwner = lpfr->hwndOwner; + lpfrw->Flags = lpfr->Flags; + + wp = enc_to_utf16((char_u *)lpfr->lpstrFindWhat, NULL); + wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1); + vim_free(wp); + + /* the field "lpstrReplaceWith" doesn't need to be copied */ +} + +/* + * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE + */ + static void +findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw) +{ + char_u *p; + + lpfr->Flags = lpfrw->Flags; + + p = utf16_to_enc((short_u*)lpfrw->lpstrFindWhat, NULL); + vim_strncpy((char_u *)lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1); + vim_free(p); + + p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL); + vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1); + vim_free(p); +} +# endif + +/* + * Handle a Find/Replace window message. + */ + static void +_OnFindRepl(void) +{ + int flags = 0; + int down; + +# ifdef FEAT_MBYTE + /* If the OS is Windows NT, and 'encoding' differs from active codepage: + * convert text from wide string. */ + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); + } +# endif + + if (s_findrep_struct.Flags & FR_DIALOGTERM) + /* Give main window the focus back. */ + (void)SetFocus(s_hwnd); + + if (s_findrep_struct.Flags & FR_FINDNEXT) + { + flags = FRD_FINDNEXT; + + /* Give main window the focus back: this is so the cursor isn't + * hollow. */ + (void)SetFocus(s_hwnd); + } + else if (s_findrep_struct.Flags & FR_REPLACE) + { + flags = FRD_REPLACE; + + /* Give main window the focus back: this is so the cursor isn't + * hollow. */ + (void)SetFocus(s_hwnd); + } + else if (s_findrep_struct.Flags & FR_REPLACEALL) + { + flags = FRD_REPLACEALL; + } + + if (flags != 0) + { + /* Call the generic GUI function to do the actual work. */ + if (s_findrep_struct.Flags & FR_WHOLEWORD) + flags |= FRD_WHOLE_WORD; + if (s_findrep_struct.Flags & FR_MATCHCASE) + flags |= FRD_MATCH_CASE; + down = (s_findrep_struct.Flags & FR_DOWN) != 0; + gui_do_findrepl(flags, (char_u *)s_findrep_struct.lpstrFindWhat, + (char_u *)s_findrep_struct.lpstrReplaceWith, down); + } +} +#endif + + static void +HandleMouseHide(UINT uMsg, LPARAM lParam) +{ + static LPARAM last_lParam = 0L; + + /* We sometimes get a mousemove when the mouse didn't move... */ + if (uMsg == WM_MOUSEMOVE || uMsg == WM_NCMOUSEMOVE) + { + if (lParam == last_lParam) + return; + last_lParam = lParam; + } + + /* Handle specially, to centralise coding. We need to be sure we catch all + * possible events which should cause us to restore the cursor (as it is a + * shared resource, we take full responsibility for it). + */ + switch (uMsg) + { + case WM_KEYUP: + case WM_CHAR: + /* + * blank out the pointer if necessary + */ + if (p_mh) + gui_mch_mousehide(TRUE); + break; + + case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */ + case WM_SYSCHAR: + case WM_MOUSEMOVE: /* show the pointer on any mouse action */ + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_XBUTTONDOWN: + case WM_XBUTTONUP: + case WM_NCMOUSEMOVE: + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONUP: + case WM_NCMBUTTONDOWN: + case WM_NCMBUTTONUP: + case WM_NCRBUTTONDOWN: + case WM_NCRBUTTONUP: + case WM_KILLFOCUS: + /* + * if the pointer is currently hidden, then we should show it. + */ + gui_mch_mousehide(FALSE); + break; + } +} + + static LRESULT CALLBACK +_TextAreaWndProc( + HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + /* + TRACE("TextAreaWndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", + hwnd, uMsg, wParam, lParam); + */ + + HandleMouseHide(uMsg, lParam); + + s_uMsg = uMsg; + s_wParam = wParam; + s_lParam = lParam; + +#ifdef FEAT_BEVAL_GUI + TrackUserActivity(uMsg); +#endif + + switch (uMsg) + { + HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); + HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); + HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); + HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); + HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); + HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); + HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); + HANDLE_MSG(hwnd, WM_SIZE, _OnSizeTextArea); + +#ifdef FEAT_BEVAL_GUI + case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); + return TRUE; +#endif + default: + return MyWindowProc(hwnd, uMsg, wParam, lParam); + } +} + +#if defined(FEAT_MBYTE) \ + || defined(GLOBAL_IME) \ + || defined(PROTO) +# ifdef PROTO +typedef int WINAPI; +# endif + + LRESULT WINAPI +vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ +# ifdef GLOBAL_IME + return global_ime_DefWindowProc(hwnd, message, wParam, lParam); +# else + if (wide_WindowProc) + return DefWindowProcW(hwnd, message, wParam, lParam); + return DefWindowProc(hwnd, message, wParam, lParam); +#endif +} +#endif + +/* + * Called when the foreground or background color has been changed. + */ + void +gui_mch_new_colors(void) +{ + /* nothing to do? */ +} + +/* + * Set the colors to their default values. + */ + void +gui_mch_def_colors(void) +{ + gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); + gui.back_pixel = GetSysColor(COLOR_WINDOW); + gui.def_norm_pixel = gui.norm_pixel; + gui.def_back_pixel = gui.back_pixel; +} + +/* + * Open the GUI window which was created by a call to gui_mch_init(). + */ + int +gui_mch_open(void) +{ +#ifndef SW_SHOWDEFAULT +# define SW_SHOWDEFAULT 10 /* Borland 5.0 doesn't have it */ +#endif + /* Actually open the window, if not already visible + * (may be done already in gui_mch_set_shellsize) */ + if (!IsWindowVisible(s_hwnd)) + ShowWindow(s_hwnd, SW_SHOWDEFAULT); + +#ifdef MSWIN_FIND_REPLACE + /* Init replace string here, so that we keep it when re-opening the + * dialog. */ + s_findrep_struct.lpstrReplaceWith[0] = NUL; +#endif + + return OK; +} + +/* + * Get the position of the top left corner of the window. + */ + int +gui_mch_get_winpos(int *x, int *y) +{ + RECT rect; + + GetWindowRect(s_hwnd, &rect); + *x = rect.left; + *y = rect.top; + return OK; +} + +/* + * Set the position of the top left corner of the window to the given + * coordinates. + */ + void +gui_mch_set_winpos(int x, int y) +{ + SetWindowPos(s_hwnd, NULL, x, y, 0, 0, + SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); +} + void +gui_mch_set_text_area_pos(int x, int y, int w, int h) +{ + static int oldx = 0; + static int oldy = 0; + + SetWindowPos(s_textArea, NULL, x, y, w, h, SWP_NOZORDER | SWP_NOACTIVATE); + +#ifdef FEAT_TOOLBAR + if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + SendMessage(s_toolbarhwnd, WM_SIZE, + (WPARAM)0, (LPARAM)(w + ((long)(TOOLBAR_BUTTON_HEIGHT+8)<<16))); +#endif +#if defined(FEAT_GUI_TABLINE) + if (showing_tabline) + { + int top = 0; + RECT rect; + +# ifdef FEAT_TOOLBAR + if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + top = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; +# endif + GetClientRect(s_hwnd, &rect); + MoveWindow(s_tabhwnd, 0, top, rect.right, gui.tabline_height, TRUE); + } +#endif + + /* When side scroll bar is unshown, the size of window will change. + * then, the text area move left or right. thus client rect should be + * forcedly redrawn. (Yasuhiro Matsumoto) */ + if (oldx != x || oldy != y) + { + InvalidateRect(s_hwnd, NULL, FALSE); + oldx = x; + oldy = y; + } +} + + +/* + * Scrollbar stuff: + */ + + void +gui_mch_enable_scrollbar( + scrollbar_T *sb, + int flag) +{ + ShowScrollBar(sb->id, SB_CTL, flag); + + /* TODO: When the window is maximized, the size of the window stays the + * same, thus the size of the text area changes. On Win98 it's OK, on Win + * NT 4.0 it's not... */ +} + + void +gui_mch_set_scrollbar_pos( + scrollbar_T *sb, + int x, + int y, + int w, + int h) +{ + SetWindowPos(sb->id, NULL, x, y, w, h, + SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); +} + + void +gui_mch_create_scrollbar( + scrollbar_T *sb, + int orient) /* SBAR_VERT or SBAR_HORIZ */ +{ + sb->id = CreateWindow( + "SCROLLBAR", "Scrollbar", + WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0, + 10, /* Any value will do for now */ + 10, /* Any value will do for now */ + s_hwnd, NULL, + s_hinst, NULL); +} + +/* + * Find the scrollbar with the given hwnd. + */ + static scrollbar_T * +gui_mswin_find_scrollbar(HWND hwnd) +{ + win_T *wp; + + if (gui.bottom_sbar.id == hwnd) + return &gui.bottom_sbar; + FOR_ALL_WINDOWS(wp) + { + if (wp->w_scrollbars[SBAR_LEFT].id == hwnd) + return &wp->w_scrollbars[SBAR_LEFT]; + if (wp->w_scrollbars[SBAR_RIGHT].id == hwnd) + return &wp->w_scrollbars[SBAR_RIGHT]; + } + return NULL; +} + +/* + * Get the character size of a font. + */ + static void +GetFontSize(GuiFont font) +{ + HWND hwnd = GetDesktopWindow(); + HDC hdc = GetWindowDC(hwnd); + HFONT hfntOld = SelectFont(hdc, (HFONT)font); + TEXTMETRIC tm; + + GetTextMetrics(hdc, &tm); + gui.char_width = tm.tmAveCharWidth + tm.tmOverhang; + + gui.char_height = tm.tmHeight + p_linespace; + + SelectFont(hdc, hfntOld); + + ReleaseDC(hwnd, hdc); +} + +/* + * Adjust gui.char_height (after 'linespace' was changed). + */ + int +gui_mch_adjust_charheight(void) +{ + GetFontSize(gui.norm_font); + return OK; +} + + static GuiFont +get_font_handle(LOGFONT *lf) +{ + HFONT font = NULL; + + /* Load the font */ + font = CreateFontIndirect(lf); + + if (font == NULL) + return NOFONT; + + return (GuiFont)font; +} + + static int +pixels_to_points(int pixels, int vertical) +{ + int points; + HWND hwnd; + HDC hdc; + + hwnd = GetDesktopWindow(); + hdc = GetWindowDC(hwnd); + + points = MulDiv(pixels, 72, + GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); + + ReleaseDC(hwnd, hdc); + + return points; +} + + GuiFont +gui_mch_get_font( + char_u *name, + int giveErrorIfMissing) +{ + LOGFONT lf; + GuiFont font = NOFONT; + + if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) + font = get_font_handle(&lf); + if (font == NOFONT && giveErrorIfMissing) + EMSG2(_(e_font), name); + return font; +} + +#if defined(FEAT_EVAL) || defined(PROTO) +/* + * Return the name of font "font" in allocated memory. + * Don't know how to get the actual name, thus use the provided name. + */ + char_u * +gui_mch_get_fontname(GuiFont font UNUSED, char_u *name) +{ + if (name == NULL) + return NULL; + return vim_strsave(name); +} +#endif + + void +gui_mch_free_font(GuiFont font) +{ + if (font) + DeleteObject((HFONT)font); +} + +/* + * Return the Pixel value (color) for the given color name. + * Return INVALCOLOR for error. + */ + guicolor_T +gui_mch_get_color(char_u *name) +{ + int i; + + typedef struct SysColorTable + { + char *name; + int color; + } SysColorTable; + + static SysColorTable sys_table[] = + { + {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, + {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, +#ifdef COLOR_3DHIGHLIGHT + {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, +#endif + {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, + {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, + {"SYS_3DLIGHT", COLOR_3DLIGHT}, + {"SYS_3DSHADOW", COLOR_3DSHADOW}, + {"SYS_DESKTOP", COLOR_DESKTOP}, + {"SYS_INFOBK", COLOR_INFOBK}, + {"SYS_INFOTEXT", COLOR_INFOTEXT}, + {"SYS_3DFACE", COLOR_3DFACE}, + {"SYS_BTNFACE", COLOR_BTNFACE}, + {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, + {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, + {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, + {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, + {"SYS_BACKGROUND", COLOR_BACKGROUND}, + {"SYS_BTNTEXT", COLOR_BTNTEXT}, + {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, + {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, + {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, + {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, + {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, + {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, + {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, + {"SYS_MENU", COLOR_MENU}, + {"SYS_MENUTEXT", COLOR_MENUTEXT}, + {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, + {"SYS_WINDOW", COLOR_WINDOW}, + {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, + {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} + }; + + /* + * Try to look up a system colour. + */ + for (i = 0; i < sizeof(sys_table) / sizeof(sys_table[0]); i++) + if (STRICMP(name, sys_table[i].name) == 0) + return GetSysColor(sys_table[i].color); + + return gui_get_color_cmn(name); +} + + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ + return gui_get_rgb_color_cmn(r, g, b); +} + +/* + * Return OK if the key with the termcap name "name" is supported. + */ + int +gui_mch_haskey(char_u *name) +{ + int i; + + for (i = 0; special_keys[i].vim_code1 != NUL; i++) + if (name[0] == special_keys[i].vim_code0 && + name[1] == special_keys[i].vim_code1) + return OK; + return FAIL; +} + + void +gui_mch_beep(void) +{ + MessageBeep(MB_OK); +} +/* + * Invert a rectangle from row r, column c, for nr rows and nc columns. + */ + void +gui_mch_invert_rectangle( + int r, + int c, + int nr, + int nc) +{ + RECT rc; + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + + /* + * Note: InvertRect() excludes right and bottom of rectangle. + */ + rc.left = FILL_X(c); + rc.top = FILL_Y(r); + rc.right = rc.left + nc * gui.char_width; + rc.bottom = rc.top + nr * gui.char_height; + InvertRect(s_hdc, &rc); +} + +/* + * Iconify the GUI window. + */ + void +gui_mch_iconify(void) +{ + ShowWindow(s_hwnd, SW_MINIMIZE); +} + +/* + * Draw a cursor without focus. + */ + void +gui_mch_draw_hollow_cursor(guicolor_T color) +{ + HBRUSH hbr; + RECT rc; + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + + /* + * Note: FrameRect() excludes right and bottom of rectangle. + */ + rc.left = FILL_X(gui.col); + rc.top = FILL_Y(gui.row); + rc.right = rc.left + gui.char_width; +#ifdef FEAT_MBYTE + if (mb_lefthalve(gui.row, gui.col)) + rc.right += gui.char_width; +#endif + rc.bottom = rc.top + gui.char_height; + hbr = CreateSolidBrush(color); + FrameRect(s_hdc, &rc, hbr); + DeleteBrush(hbr); +} +/* + * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using + * color "color". + */ + void +gui_mch_draw_part_cursor( + int w, + int h, + guicolor_T color) +{ + RECT rc; + + /* + * Note: FillRect() excludes right and bottom of rectangle. + */ + rc.left = +#ifdef FEAT_RIGHTLEFT + /* vertical line should be on the right of current point */ + CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : +#endif + FILL_X(gui.col); + rc.top = FILL_Y(gui.row) + gui.char_height - h; + rc.right = rc.left + w; + rc.bottom = rc.top + h; + + fill_rect(&rc, NULL, color); +} + + +/* + * Generates a VK_SPACE when the internal dead_key flag is set to output the + * dead key's nominal character and re-post the original message. + */ + static void +outputDeadKey_rePost(MSG originalMsg) +{ + static MSG deadCharExpel; + + if (!dead_key) + return; + + dead_key = 0; + + /* Make Windows generate the dead key's character */ + deadCharExpel.message = originalMsg.message; + deadCharExpel.hwnd = originalMsg.hwnd; + deadCharExpel.wParam = VK_SPACE; + + MyTranslateMessage(&deadCharExpel); + + /* re-generate the current character free of the dead char influence */ + PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam, + originalMsg.lParam); +} + + +/* + * Process a single Windows message. + * If one is not available we hang until one is. + */ + static void +process_message(void) +{ + MSG msg; + UINT vk = 0; /* Virtual key */ + char_u string[40]; + int i; + int modifiers = 0; + int key; +#ifdef FEAT_MENU + static char_u k10[] = {K_SPECIAL, 'k', ';', 0}; +#endif + + pGetMessage(&msg, NULL, 0, 0); + +#ifdef FEAT_OLE + /* Look after OLE Automation commands */ + if (msg.message == WM_OLE) + { + char_u *str = (char_u *)msg.lParam; + if (str == NULL || *str == NUL) + { + /* Message can't be ours, forward it. Fixes problem with Ultramon + * 3.0.4 */ + pDispatchMessage(&msg); + } + else + { + add_to_input_buf(str, (int)STRLEN(str)); + vim_free(str); /* was allocated in CVim::SendKeys() */ + } + return; + } +#endif + +#ifdef MSWIN_FIND_REPLACE + /* Don't process messages used by the dialog */ + if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg)) + { + HandleMouseHide(msg.message, msg.lParam); + return; + } +#endif + + /* + * Check if it's a special key that we recognise. If not, call + * TranslateMessage(). + */ + if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) + { + vk = (int) msg.wParam; + + /* + * Handle dead keys in special conditions in other cases we let Windows + * handle them and do not interfere. + * + * The dead_key flag must be reset on several occasions: + * - in _OnChar() (or _OnSysChar()) as any dead key was necessarily + * consumed at that point (This is when we let Windows combine the + * dead character on its own) + * + * - Before doing something special such as regenerating keypresses to + * expel the dead character as this could trigger an infinite loop if + * for some reason MyTranslateMessage() do not trigger a call + * immediately to _OnChar() (or _OnSysChar()). + */ + if (dead_key) + { + /* + * If a dead key was pressed and the user presses VK_SPACE, + * VK_BACK, or VK_ESCAPE it means that he actually wants to deal + * with the dead char now, so do nothing special and let Windows + * handle it. + * + * Note that VK_SPACE combines with the dead_key's character and + * only one WM_CHAR will be generated by TranslateMessage(), in + * the two other cases two WM_CHAR will be generated: the dead + * char and VK_BACK or VK_ESCAPE. That is most likely what the + * user expects. + */ + if ((vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE)) + { + dead_key = 0; + MyTranslateMessage(&msg); + return; + } + /* In modes where we are not typing, dead keys should behave + * normally */ + else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE))) + { + outputDeadKey_rePost(msg); + return; + } + } + + /* Check for CTRL-BREAK */ + if (vk == VK_CANCEL) + { + trash_input_buf(); + got_int = TRUE; + ctrl_break_was_pressed = TRUE; + string[0] = Ctrl_C; + add_to_input_buf(string, 1); + } + + for (i = 0; special_keys[i].key_sym != 0; i++) + { + /* ignore VK_SPACE when ALT key pressed: system menu */ + if (special_keys[i].key_sym == vk + && (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000))) + { + /* + * Behave as expected if we have a dead key and the special key + * is a key that would normally trigger the dead key nominal + * character output (such as a NUMPAD printable character or + * the TAB key, etc...). + */ + if (dead_key && (special_keys[i].vim_code0 == 'K' + || vk == VK_TAB || vk == CAR)) + { + outputDeadKey_rePost(msg); + return; + } + +#ifdef FEAT_MENU + /* Check for <F10>: Windows selects the menu. When <F10> is + * mapped we want to use the mapping instead. */ + if (vk == VK_F10 + && gui.menu_is_active + && check_map(k10, State, FALSE, TRUE, FALSE, + NULL, NULL) == NULL) + break; +#endif + if (GetKeyState(VK_SHIFT) & 0x8000) + modifiers |= MOD_MASK_SHIFT; + /* + * Don't use caps-lock as shift, because these are special keys + * being considered here, and we only want letters to get + * shifted -- webb + */ + /* + if (GetKeyState(VK_CAPITAL) & 0x0001) + modifiers ^= MOD_MASK_SHIFT; + */ + if (GetKeyState(VK_CONTROL) & 0x8000) + modifiers |= MOD_MASK_CTRL; + if (GetKeyState(VK_MENU) & 0x8000) + modifiers |= MOD_MASK_ALT; + + if (special_keys[i].vim_code1 == NUL) + key = special_keys[i].vim_code0; + else + key = TO_SPECIAL(special_keys[i].vim_code0, + special_keys[i].vim_code1); + key = simplify_key(key, &modifiers); + if (key == CSI) + key = K_CSI; + + if (modifiers) + { + string[0] = CSI; + string[1] = KS_MODIFIER; + string[2] = modifiers; + add_to_input_buf(string, 3); + } + + if (IS_SPECIAL(key)) + { + string[0] = CSI; + string[1] = K_SECOND(key); + string[2] = K_THIRD(key); + add_to_input_buf(string, 3); + } + else + { + int len; + + /* Handle "key" as a Unicode character. */ + len = char_to_string(key, string, 40, FALSE); + add_to_input_buf(string, len); + } + break; + } + } + if (special_keys[i].key_sym == 0) + { + /* Some keys need C-S- where they should only need C-. + * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since + * system startup (Helmut Stiegler, 2003 Oct 3). */ + if (vk != 0xff + && (GetKeyState(VK_CONTROL) & 0x8000) + && !(GetKeyState(VK_SHIFT) & 0x8000) + && !(GetKeyState(VK_MENU) & 0x8000)) + { + /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */ + if (vk == '6' || MapVirtualKey(vk, 2) == (UINT)'^') + { + string[0] = Ctrl_HAT; + add_to_input_buf(string, 1); + } + /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */ + else if (vk == 0xBD) /* QWERTY for CTRL-'-' */ + { + string[0] = Ctrl__; + add_to_input_buf(string, 1); + } + /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */ + else if (vk == '2' || MapVirtualKey(vk, 2) == (UINT)'@') + { + string[0] = Ctrl_AT; + add_to_input_buf(string, 1); + } + else + MyTranslateMessage(&msg); + } + else + MyTranslateMessage(&msg); + } + } +#ifdef FEAT_MBYTE_IME + else if (msg.message == WM_IME_NOTIFY) + _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam); + else if (msg.message == WM_KEYUP && im_get_status()) + /* added for non-MS IME (Yasuhiro Matsumoto) */ + MyTranslateMessage(&msg); +#endif +#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) +/* GIME_TEST */ + else if (msg.message == WM_IME_STARTCOMPOSITION) + { + POINT point; + + global_ime_set_font(&norm_logfont); + point.x = FILL_X(gui.col); + point.y = FILL_Y(gui.row); + MapWindowPoints(s_textArea, s_hwnd, &point, 1); + global_ime_set_position(&point); + } +#endif + +#ifdef FEAT_MENU + /* Check for <F10>: Default effect is to select the menu. When <F10> is + * mapped we need to stop it here to avoid strange effects (e.g., for the + * key-up event) */ + if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE, + NULL, NULL) == NULL) +#endif + pDispatchMessage(&msg); +} + +/* + * Catch up with any queued events. This may put keyboard input into the + * input buffer, call resize call-backs, trigger timers etc. If there is + * nothing in the event queue (& no timers pending), then we return + * immediately. + */ + void +gui_mch_update(void) +{ + MSG msg; + + if (!s_busy_processing) + while (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) + && !vim_is_input_buf_full()) + process_message(); +} + + static void +remove_any_timer(void) +{ + MSG msg; + + if (s_wait_timer != 0 && !s_timed_out) + { + KillTimer(NULL, s_wait_timer); + + /* Eat spurious WM_TIMER messages */ + while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) + ; + s_wait_timer = 0; + } +} + +/* + * GUI input routine called by gui_wait_for_chars(). Waits for a character + * from the keyboard. + * wtime == -1 Wait forever. + * wtime == 0 This should never happen. + * wtime > 0 Wait wtime milliseconds for a character. + * Returns OK if a character was found to be available within the given time, + * or FAIL otherwise. + */ + int +gui_mch_wait_for_chars(int wtime) +{ + int focus; + + s_timed_out = FALSE; + + if (wtime > 0) + { + /* Don't do anything while processing a (scroll) message. */ + if (s_busy_processing) + return FAIL; + s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)wtime, + (TIMERPROC)_OnTimer); + } + + allow_scrollbar = TRUE; + + focus = gui.in_focus; + while (!s_timed_out) + { + /* Stop or start blinking when focus changes */ + if (gui.in_focus != focus) + { + if (gui.in_focus) + gui_mch_start_blink(); + else + gui_mch_stop_blink(TRUE); + focus = gui.in_focus; + } + + if (s_need_activate) + { + (void)SetForegroundWindow(s_hwnd); + s_need_activate = FALSE; + } + +#ifdef FEAT_TIMERS + did_add_timer = FALSE; +#endif +#ifdef MESSAGE_QUEUE + /* Check channel I/O while waiting for a message. */ + for (;;) + { + MSG msg; + + parse_queued_messages(); + + if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + { + process_message(); + break; + } + else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) + != WAIT_TIMEOUT) + break; + } +#else + /* + * Don't use gui_mch_update() because then we will spin-lock until a + * char arrives, instead we use GetMessage() to hang until an + * event arrives. No need to check for input_buf_full because we are + * returning as soon as it contains a single char -- webb + */ + process_message(); +#endif + + if (input_available()) + { + remove_any_timer(); + allow_scrollbar = FALSE; + + /* Clear pending mouse button, the release event may have been + * taken by the dialog window. But don't do this when getting + * focus, we need the mouse-up event then. */ + if (!s_getting_focus) + s_button_pending = -1; + + return OK; + } + +#ifdef FEAT_TIMERS + if (did_add_timer) + { + /* Need to recompute the waiting time. */ + remove_any_timer(); + break; + } +#endif + } + allow_scrollbar = FALSE; + return FAIL; +} + +/* + * Clear a rectangular region of the screen from text pos (row1, col1) to + * (row2, col2) inclusive. + */ + void +gui_mch_clear_block( + int row1, + int col1, + int row2, + int col2) +{ + RECT rc; + + /* + * Clear one extra pixel at the far right, for when bold characters have + * spilled over to the window border. + * Note: FillRect() excludes right and bottom of rectangle. + */ + rc.left = FILL_X(col1); + rc.top = FILL_Y(row1); + rc.right = FILL_X(col2 + 1) + (col2 == Columns - 1); + rc.bottom = FILL_Y(row2 + 1); + clear_rect(&rc); +} + +/* + * Clear the whole text window. + */ + void +gui_mch_clear_all(void) +{ + RECT rc; + + rc.left = 0; + rc.top = 0; + rc.right = Columns * gui.char_width + 2 * gui.border_width; + rc.bottom = Rows * gui.char_height + 2 * gui.border_width; + clear_rect(&rc); +} +/* + * Menu stuff. + */ + + void +gui_mch_enable_menu(int flag) +{ +#ifdef FEAT_MENU + SetMenu(s_hwnd, flag ? s_menuBar : NULL); +#endif +} + + void +gui_mch_set_menu_pos( + int x UNUSED, + int y UNUSED, + int w UNUSED, + int h UNUSED) +{ + /* It will be in the right place anyway */ +} + +#if defined(FEAT_MENU) || defined(PROTO) +/* + * Make menu item hidden or not hidden + */ + void +gui_mch_menu_hidden( + vimmenu_T *menu, + int hidden) +{ + /* + * This doesn't do what we want. Hmm, just grey the menu items for now. + */ + /* + if (hidden) + EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_DISABLED); + else + EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED); + */ + gui_mch_menu_grey(menu, hidden); +} + +/* + * This is called after setting all the menus to grey/hidden or not. + */ + void +gui_mch_draw_menubar(void) +{ + DrawMenuBar(s_hwnd); +} +#endif /*FEAT_MENU*/ + +#ifndef PROTO +void +#ifdef VIMDLL +_export +#endif +_cdecl +SaveInst(HINSTANCE hInst) +{ + s_hinst = hInst; +} +#endif + +/* + * Return the RGB value of a pixel as a long. + */ + guicolor_T +gui_mch_get_rgb(guicolor_T pixel) +{ + return (guicolor_T)((GetRValue(pixel) << 16) + (GetGValue(pixel) << 8) + + GetBValue(pixel)); +} + +#if defined(FEAT_GUI_DIALOG) || defined(PROTO) +/* Convert pixels in X to dialog units */ + static WORD +PixelToDialogX(int numPixels) +{ + return (WORD)((numPixels * 4) / s_dlgfntwidth); +} + +/* Convert pixels in Y to dialog units */ + static WORD +PixelToDialogY(int numPixels) +{ + return (WORD)((numPixels * 8) / s_dlgfntheight); +} + +/* Return the width in pixels of the given text in the given DC. */ + static int +GetTextWidth(HDC hdc, char_u *str, int len) +{ + SIZE size; + + GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); + return size.cx; +} + +#ifdef FEAT_MBYTE +/* + * Return the width in pixels of the given text in the given DC, taking care + * of 'encoding' to active codepage conversion. + */ + static int +GetTextWidthEnc(HDC hdc, char_u *str, int len) +{ + SIZE size; + WCHAR *wstr; + int n; + int wlen = len; + + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + /* 'encoding' differs from active codepage: convert text and use wide + * function */ + wstr = enc_to_utf16(str, &wlen); + if (wstr != NULL) + { + n = GetTextExtentPointW(hdc, wstr, wlen, &size); + vim_free(wstr); + if (n) + return size.cx; + } + } + + return GetTextWidth(hdc, str, len); +} +#else +# define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l)) +#endif + +static void get_work_area(RECT *spi_rect); + +/* + * A quick little routine that will center one window over another, handy for + * dialog boxes. Taken from the Win32SDK samples and modified for multiple + * monitors. + */ + static BOOL +CenterWindow( + HWND hwndChild, + HWND hwndParent) +{ + HMONITOR mon; + MONITORINFO moninfo; + RECT rChild, rParent, rScreen; + int wChild, hChild, wParent, hParent; + int xNew, yNew; + HDC hdc; + + GetWindowRect(hwndChild, &rChild); + wChild = rChild.right - rChild.left; + hChild = rChild.bottom - rChild.top; + + /* If Vim is minimized put the window in the middle of the screen. */ + if (hwndParent == NULL || IsMinimized(hwndParent)) + get_work_area(&rParent); + else + GetWindowRect(hwndParent, &rParent); + wParent = rParent.right - rParent.left; + hParent = rParent.bottom - rParent.top; + + moninfo.cbSize = sizeof(MONITORINFO); + mon = MonitorFromWindow(hwndChild, MONITOR_DEFAULTTOPRIMARY); + if (mon != NULL && GetMonitorInfo(mon, &moninfo)) + { + rScreen = moninfo.rcWork; + } + else + { + hdc = GetDC(hwndChild); + rScreen.left = 0; + rScreen.top = 0; + rScreen.right = GetDeviceCaps(hdc, HORZRES); + rScreen.bottom = GetDeviceCaps(hdc, VERTRES); + ReleaseDC(hwndChild, hdc); + } + + xNew = rParent.left + ((wParent - wChild) / 2); + if (xNew < rScreen.left) + xNew = rScreen.left; + else if ((xNew + wChild) > rScreen.right) + xNew = rScreen.right - wChild; + + yNew = rParent.top + ((hParent - hChild) / 2); + if (yNew < rScreen.top) + yNew = rScreen.top; + else if ((yNew + hChild) > rScreen.bottom) + yNew = rScreen.bottom - hChild; + + return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0, + SWP_NOSIZE | SWP_NOZORDER); +} +#endif /* FEAT_GUI_DIALOG */ + +void +gui_mch_activate_window(void) +{ + (void)SetActiveWindow(s_hwnd); +} + +#if defined(FEAT_TOOLBAR) || defined(PROTO) + void +gui_mch_show_toolbar(int showit) +{ + if (s_toolbarhwnd == NULL) + return; + + if (showit) + { +# ifdef FEAT_MBYTE +# ifndef TB_SETUNICODEFORMAT + /* For older compilers. We assume this never changes. */ +# define TB_SETUNICODEFORMAT 0x2005 +# endif + /* Enable/disable unicode support */ + int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); + SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); +# endif + ShowWindow(s_toolbarhwnd, SW_SHOW); + } + else + ShowWindow(s_toolbarhwnd, SW_HIDE); +} + +/* Then number of bitmaps is fixed. Exit is missing! */ +#define TOOLBAR_BITMAP_COUNT 31 + +#endif + +#if defined(FEAT_GUI_TABLINE) || defined(PROTO) + static void +add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text) +{ +#ifdef FEAT_MBYTE + WCHAR *wn = NULL; + + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + /* 'encoding' differs from active codepage: convert menu name + * and use wide function */ + wn = enc_to_utf16(item_text, NULL); + if (wn != NULL) + { + MENUITEMINFOW infow; + + infow.cbSize = sizeof(infow); + infow.fMask = MIIM_TYPE | MIIM_ID; + infow.wID = item_id; + infow.fType = MFT_STRING; + infow.dwTypeData = wn; + infow.cch = (UINT)wcslen(wn); + InsertMenuItemW(pmenu, item_id, FALSE, &infow); + vim_free(wn); + } + } + + if (wn == NULL) +#endif + { + MENUITEMINFO info; + + info.cbSize = sizeof(info); + info.fMask = MIIM_TYPE | MIIM_ID; + info.wID = item_id; + info.fType = MFT_STRING; + info.dwTypeData = (LPTSTR)item_text; + info.cch = (UINT)STRLEN(item_text); + InsertMenuItem(pmenu, item_id, FALSE, &info); + } +} + + static void +show_tabline_popup_menu(void) +{ + HMENU tab_pmenu; + long rval; + POINT pt; + + /* When ignoring events don't show the menu. */ + if (hold_gui_events +# ifdef FEAT_CMDWIN + || cmdwin_type != 0 +# endif + ) + return; + + tab_pmenu = CreatePopupMenu(); + if (tab_pmenu == NULL) + return; + + if (first_tabpage->tp_next != NULL) + add_tabline_popup_menu_entry(tab_pmenu, + TABLINE_MENU_CLOSE, (char_u *)_("Close tab")); + add_tabline_popup_menu_entry(tab_pmenu, + TABLINE_MENU_NEW, (char_u *)_("New tab")); + add_tabline_popup_menu_entry(tab_pmenu, + TABLINE_MENU_OPEN, (char_u *)_("Open tab...")); + + GetCursorPos(&pt); + rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd, + NULL); + + DestroyMenu(tab_pmenu); + + /* Add the string cmd into input buffer */ + if (rval > 0) + { + TCHITTESTINFO htinfo; + int idx; + + if (ScreenToClient(s_tabhwnd, &pt) == 0) + return; + + htinfo.pt.x = pt.x; + htinfo.pt.y = pt.y; + idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx == -1) + idx = 0; + else + idx += 1; + + send_tabline_menu_event(idx, (int)rval); + } +} + +/* + * Show or hide the tabline. + */ + void +gui_mch_show_tabline(int showit) +{ + if (s_tabhwnd == NULL) + return; + + if (!showit != !showing_tabline) + { + if (showit) + ShowWindow(s_tabhwnd, SW_SHOW); + else + ShowWindow(s_tabhwnd, SW_HIDE); + showing_tabline = showit; + } +} + +/* + * Return TRUE when tabline is displayed. + */ + int +gui_mch_showing_tabline(void) +{ + return s_tabhwnd != NULL && showing_tabline; +} + +/* + * Update the labels of the tabline. + */ + void +gui_mch_update_tabline(void) +{ + tabpage_T *tp; + TCITEM tie; + int nr = 0; + int curtabidx = 0; + int tabadded = 0; +#ifdef FEAT_MBYTE + static int use_unicode = FALSE; + int uu; + WCHAR *wstr = NULL; +#endif + + if (s_tabhwnd == NULL) + return; + +#ifdef FEAT_MBYTE +# ifndef CCM_SETUNICODEFORMAT + /* For older compilers. We assume this never changes. */ +# define CCM_SETUNICODEFORMAT 0x2005 +# endif + uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); + if (uu != use_unicode) + { + /* Enable/disable unicode support */ + SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); + use_unicode = uu; + } +#endif + + tie.mask = TCIF_TEXT; + tie.iImage = -1; + + /* Disable redraw for tab updates to eliminate O(N^2) draws. */ + SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0); + + /* Add a label for each tab page. They all contain the same text area. */ + for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) + { + if (tp == curtab) + curtabidx = nr; + + if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) + { + /* Add the tab */ + tie.pszText = "-Empty-"; + TabCtrl_InsertItem(s_tabhwnd, nr, &tie); + tabadded = 1; + } + + get_tabline_label(tp, FALSE); + tie.pszText = (LPSTR)NameBuff; +#ifdef FEAT_MBYTE + wstr = NULL; + if (use_unicode) + { + /* Need to go through Unicode. */ + wstr = enc_to_utf16(NameBuff, NULL); + if (wstr != NULL) + { + TCITEMW tiw; + + tiw.mask = TCIF_TEXT; + tiw.iImage = -1; + tiw.pszText = wstr; + SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); + vim_free(wstr); + } + } + if (wstr == NULL) +#endif + { + TabCtrl_SetItem(s_tabhwnd, nr, &tie); + } + } + + /* Remove any old labels. */ + while (nr < TabCtrl_GetItemCount(s_tabhwnd)) + TabCtrl_DeleteItem(s_tabhwnd, nr); + + if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) + TabCtrl_SetCurSel(s_tabhwnd, curtabidx); + + /* Re-enable redraw and redraw. */ + SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0); + RedrawWindow(s_tabhwnd, NULL, NULL, + RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + + if (tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) + TabCtrl_SetCurSel(s_tabhwnd, curtabidx); +} + +/* + * Set the current tab to "nr". First tab is 1. + */ + void +gui_mch_set_curtab(int nr) +{ + if (s_tabhwnd == NULL) + return; + + if (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1) + TabCtrl_SetCurSel(s_tabhwnd, nr - 1); +} + +#endif + +/* + * ":simalt" command. + */ + void +ex_simalt(exarg_T *eap) +{ + char_u *keys = eap->arg; + int fill_typebuf = FALSE; + char_u key_name[4]; + + PostMessage(s_hwnd, WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)0); + while (*keys) + { + if (*keys == '~') + *keys = ' '; /* for showing system menu */ + PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0); + keys++; + fill_typebuf = TRUE; + } + if (fill_typebuf) + { + /* Put a NOP in the typeahead buffer so that the message will get + * processed. */ + key_name[0] = K_SPECIAL; + key_name[1] = KS_EXTRA; + key_name[2] = KE_NOP; + key_name[3] = NUL; + typebuf_was_filled = TRUE; + (void)ins_typebuf(key_name, REMAP_NONE, 0, TRUE, FALSE); + } +} + +/* + * Create the find & replace dialogs. + * You can't have both at once: ":find" when replace is showing, destroys + * the replace dialog first, and the other way around. + */ +#ifdef MSWIN_FIND_REPLACE + static void +initialise_findrep(char_u *initial_string) +{ + int wword = FALSE; + int mcase = !p_ic; + char_u *entry_text; + + /* Get the search string to use. */ + entry_text = get_find_dialog_text(initial_string, &wword, &mcase); + + s_findrep_struct.hwndOwner = s_hwnd; + s_findrep_struct.Flags = FR_DOWN; + if (mcase) + s_findrep_struct.Flags |= FR_MATCHCASE; + if (wword) + s_findrep_struct.Flags |= FR_WHOLEWORD; + if (entry_text != NULL && *entry_text != NUL) + vim_strncpy((char_u *)s_findrep_struct.lpstrFindWhat, entry_text, + s_findrep_struct.wFindWhatLen - 1); + vim_free(entry_text); +} +#endif + + static void +set_window_title(HWND hwnd, char *title) +{ +#ifdef FEAT_MBYTE + if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) + { + WCHAR *wbuf; + + /* Convert the title from 'encoding' to UTF-16. */ + wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL); + if (wbuf != NULL) + { + SetWindowTextW(hwnd, wbuf); + vim_free(wbuf); + } + return; + } +#endif + (void)SetWindowText(hwnd, (LPCSTR)title); +} + + void +gui_mch_find_dialog(exarg_T *eap) +{ +#ifdef MSWIN_FIND_REPLACE + if (s_findrep_msg != 0) + { + if (IsWindow(s_findrep_hwnd) && !s_findrep_is_find) + DestroyWindow(s_findrep_hwnd); + + if (!IsWindow(s_findrep_hwnd)) + { + initialise_findrep(eap->arg); +# ifdef FEAT_MBYTE + /* If the OS is Windows NT, and 'encoding' differs from active + * codepage: convert text and use wide function. */ + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + findrep_atow(&s_findrep_struct_w, &s_findrep_struct); + s_findrep_hwnd = FindTextW( + (LPFINDREPLACEW) &s_findrep_struct_w); + } + else +# endif + s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); + } + + set_window_title(s_findrep_hwnd, + _("Find string (use '\\\\' to find a '\\')")); + (void)SetFocus(s_findrep_hwnd); + + s_findrep_is_find = TRUE; + } +#endif +} + + + void +gui_mch_replace_dialog(exarg_T *eap) +{ +#ifdef MSWIN_FIND_REPLACE + if (s_findrep_msg != 0) + { + if (IsWindow(s_findrep_hwnd) && s_findrep_is_find) + DestroyWindow(s_findrep_hwnd); + + if (!IsWindow(s_findrep_hwnd)) + { + initialise_findrep(eap->arg); +# ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + findrep_atow(&s_findrep_struct_w, &s_findrep_struct); + s_findrep_hwnd = ReplaceTextW( + (LPFINDREPLACEW) &s_findrep_struct_w); + } + else +# endif + s_findrep_hwnd = ReplaceText( + (LPFINDREPLACE) &s_findrep_struct); + } + + set_window_title(s_findrep_hwnd, + _("Find & Replace (use '\\\\' to find a '\\')")); + (void)SetFocus(s_findrep_hwnd); + + s_findrep_is_find = FALSE; + } +#endif +} + + +/* + * Set visibility of the pointer. + */ + void +gui_mch_mousehide(int hide) +{ + if (hide != gui.pointer_hidden) + { + ShowCursor(!hide); + gui.pointer_hidden = hide; + } +} + +#ifdef FEAT_MENU + static void +gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y) +{ + /* Unhide the mouse, we don't get move events here. */ + gui_mch_mousehide(FALSE); + + (void)TrackPopupMenu( + (HMENU)menu->submenu_id, + TPM_LEFTALIGN | TPM_LEFTBUTTON, + x, y, + (int)0, /*reserved param*/ + s_hwnd, + NULL); + /* + * NOTE: The pop-up menu can eat the mouse up event. + * We deal with this in normal.c. + */ +} +#endif + +/* + * Got a message when the system will go down. + */ + static void +_OnEndSession(void) +{ + getout_preserve_modified(1); +} + +/* + * Get this message when the user clicks on the cross in the top right corner + * of a Windows95 window. + */ + static void +_OnClose(HWND hwnd UNUSED) +{ + gui_shell_closed(); +} + +/* + * Get a message when the window is being destroyed. + */ + static void +_OnDestroy(HWND hwnd) +{ + if (!destroying) + _OnClose(hwnd); +} + + static void +_OnPaint( + HWND hwnd) +{ + if (!IsMinimized(hwnd)) + { + PAINTSTRUCT ps; + + out_flush(); /* make sure all output has been processed */ + (void)BeginPaint(hwnd, &ps); + +#ifdef FEAT_MBYTE + /* prevent multi-byte characters from misprinting on an invalid + * rectangle */ + if (has_mbyte) + { + RECT rect; + + GetClientRect(hwnd, &rect); + ps.rcPaint.left = rect.left; + ps.rcPaint.right = rect.right; + } +#endif + + if (!IsRectEmpty(&ps.rcPaint)) + { + gui_redraw(ps.rcPaint.left, ps.rcPaint.top, + ps.rcPaint.right - ps.rcPaint.left + 1, + ps.rcPaint.bottom - ps.rcPaint.top + 1); + } + + EndPaint(hwnd, &ps); + } +} + + static void +_OnSize( + HWND hwnd, + UINT state UNUSED, + int cx, + int cy) +{ + if (!IsMinimized(hwnd)) + { + gui_resize_shell(cx, cy); + +#ifdef FEAT_MENU + /* Menu bar may wrap differently now */ + gui_mswin_get_menu_height(TRUE); +#endif + } +} + + static void +_OnSetFocus( + HWND hwnd, + HWND hwndOldFocus) +{ + gui_focus_change(TRUE); + s_getting_focus = TRUE; + (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); +} + + static void +_OnKillFocus( + HWND hwnd, + HWND hwndNewFocus) +{ + gui_focus_change(FALSE); + s_getting_focus = FALSE; + (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); +} + +/* + * Get a message when the user switches back to vim + */ + static LRESULT +_OnActivateApp( + HWND hwnd, + BOOL fActivate, + DWORD dwThreadId) +{ + /* we call gui_focus_change() in _OnSetFocus() */ + /* gui_focus_change((int)fActivate); */ + return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); +} + + void +gui_mch_destroy_scrollbar(scrollbar_T *sb) +{ + DestroyWindow(sb->id); +} + +/* + * Get current mouse coordinates in text window. + */ + void +gui_mch_getmouse(int *x, int *y) +{ + RECT rct; + POINT mp; + + (void)GetWindowRect(s_textArea, &rct); + (void)GetCursorPos((LPPOINT)&mp); + *x = (int)(mp.x - rct.left); + *y = (int)(mp.y - rct.top); +} + +/* + * Move mouse pointer to character at (x, y). + */ + void +gui_mch_setmouse(int x, int y) +{ + RECT rct; + + (void)GetWindowRect(s_textArea, &rct); + (void)SetCursorPos(x + gui.border_offset + rct.left, + y + gui.border_offset + rct.top); +} + + static void +gui_mswin_get_valid_dimensions( + int w, + int h, + int *valid_w, + int *valid_h) +{ + int base_width, base_height; + + base_width = gui_get_base_width() + + (GetSystemMetrics(SM_CXFRAME) + + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + + get_caption_width_adjustment(); + base_height = gui_get_base_height() + + (GetSystemMetrics(SM_CYFRAME) + + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + + get_caption_height() +#ifdef FEAT_MENU + + gui_mswin_get_menu_height(FALSE) +#endif + ; + *valid_w = base_width + + ((w - base_width) / gui.char_width) * gui.char_width; + *valid_h = base_height + + ((h - base_height) / gui.char_height) * gui.char_height; +} + + void +gui_mch_flash(int msec) +{ + RECT rc; + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + + /* + * Note: InvertRect() excludes right and bottom of rectangle. + */ + rc.left = 0; + rc.top = 0; + rc.right = gui.num_cols * gui.char_width; + rc.bottom = gui.num_rows * gui.char_height; + InvertRect(s_hdc, &rc); + gui_mch_flush(); /* make sure it's displayed */ + + ui_delay((long)msec, TRUE); /* wait for a few msec */ + + InvertRect(s_hdc, &rc); +} + +/* + * Return flags used for scrolling. + * The SW_INVALIDATE is required when part of the window is covered or + * off-screen. Refer to MS KB Q75236. + */ + static int +get_scroll_flags(void) +{ + HWND hwnd; + RECT rcVim, rcOther, rcDest; + + GetWindowRect(s_hwnd, &rcVim); + + /* Check if the window is partly above or below the screen. We don't care + * about partly left or right of the screen, it is not relevant when + * scrolling up or down. */ + if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN)) + return SW_INVALIDATE; + + /* Check if there is an window (partly) on top of us. */ + for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; ) + if (IsWindowVisible(hwnd)) + { + GetWindowRect(hwnd, &rcOther); + if (IntersectRect(&rcDest, &rcVim, &rcOther)) + return SW_INVALIDATE; + } + return 0; +} + +/* + * On some Intel GPUs, the regions drawn just prior to ScrollWindowEx() + * may not be scrolled out properly. + * For gVim, when _OnScroll() is repeated, the character at the + * previous cursor position may be left drawn after scroll. + * The problem can be avoided by calling GetPixel() to get a pixel in + * the region before ScrollWindowEx(). + */ + static void +intel_gpu_workaround(void) +{ + GetPixel(s_hdc, FILL_X(gui.col), FILL_Y(gui.row)); +} + +/* + * Delete the given number of lines from the given row, scrolling up any + * text further down within the scroll region. + */ + void +gui_mch_delete_lines( + int row, + int num_lines) +{ + RECT rc; + + rc.left = FILL_X(gui.scroll_region_left); + rc.right = FILL_X(gui.scroll_region_right + 1); + rc.top = FILL_Y(row); + rc.bottom = FILL_Y(gui.scroll_region_bot + 1); + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + { + DWriteContext_Scroll(s_dwc, 0, -num_lines * gui.char_height, &rc); + DWriteContext_Flush(s_dwc); + } + else +#endif + { + intel_gpu_workaround(); + ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, + &rc, &rc, NULL, NULL, get_scroll_flags()); + UpdateWindow(s_textArea); + } + + /* This seems to be required to avoid the cursor disappearing when + * scrolling such that the cursor ends up in the top-left character on + * the screen... But why? (Webb) */ + /* It's probably fixed by disabling drawing the cursor while scrolling. */ + /* gui.cursor_is_valid = FALSE; */ + + gui_clear_block(gui.scroll_region_bot - num_lines + 1, + gui.scroll_region_left, + gui.scroll_region_bot, gui.scroll_region_right); +} + +/* + * Insert the given number of lines before the given row, scrolling down any + * following text within the scroll region. + */ + void +gui_mch_insert_lines( + int row, + int num_lines) +{ + RECT rc; + + rc.left = FILL_X(gui.scroll_region_left); + rc.right = FILL_X(gui.scroll_region_right + 1); + rc.top = FILL_Y(row); + rc.bottom = FILL_Y(gui.scroll_region_bot + 1); + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + { + DWriteContext_Scroll(s_dwc, 0, num_lines * gui.char_height, &rc); + DWriteContext_Flush(s_dwc); + } + else +#endif + { + intel_gpu_workaround(); + /* The SW_INVALIDATE is required when part of the window is covered or + * off-screen. How do we avoid it when it's not needed? */ + ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, + &rc, &rc, NULL, NULL, get_scroll_flags()); + UpdateWindow(s_textArea); + } + + gui_clear_block(row, gui.scroll_region_left, + row + num_lines - 1, gui.scroll_region_right); +} + + + void +gui_mch_exit(int rc UNUSED) +{ +#if defined(FEAT_DIRECTX) + DWriteContext_Close(s_dwc); + DWrite_Final(); + s_dwc = NULL; +#endif + + ReleaseDC(s_textArea, s_hdc); + DeleteObject(s_brush); + +#ifdef FEAT_TEAROFF + /* Unload the tearoff bitmap */ + (void)DeleteObject((HGDIOBJ)s_htearbitmap); +#endif + + /* Destroy our window (if we have one). */ + if (s_hwnd != NULL) + { + destroying = TRUE; /* ignore WM_DESTROY message now */ + DestroyWindow(s_hwnd); + } + +#ifdef GLOBAL_IME + global_ime_end(); +#endif +} + + static char_u * +logfont2name(LOGFONT lf) +{ + char *p; + char *res; + char *charset_name; + char *quality_name; + char *font_name = lf.lfFaceName; + + charset_name = charset_id2name((int)lf.lfCharSet); +#ifdef FEAT_MBYTE + /* Convert a font name from the current codepage to 'encoding'. + * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */ + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + int len; + acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName), + (char_u **)&font_name, &len); + } +#endif + quality_name = quality_id2name((int)lf.lfQuality); + + res = (char *)alloc((unsigned)(strlen(font_name) + 20 + + (charset_name == NULL ? 0 : strlen(charset_name) + 2))); + if (res != NULL) + { + p = res; + /* make a normal font string out of the lf thing:*/ + sprintf((char *)p, "%s:h%d", font_name, pixels_to_points( + lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE)); + while (*p) + { + if (*p == ' ') + *p = '_'; + ++p; + } + if (lf.lfItalic) + STRCAT(p, ":i"); + if (lf.lfWeight >= FW_BOLD) + STRCAT(p, ":b"); + if (lf.lfUnderline) + STRCAT(p, ":u"); + if (lf.lfStrikeOut) + STRCAT(p, ":s"); + if (charset_name != NULL) + { + STRCAT(p, ":c"); + STRCAT(p, charset_name); + } + if (quality_name != NULL) + { + STRCAT(p, ":q"); + STRCAT(p, quality_name); + } + } + +#ifdef FEAT_MBYTE + if (font_name != lf.lfFaceName) + vim_free(font_name); +#endif + return (char_u *)res; +} + + +#ifdef FEAT_MBYTE_IME +/* + * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use + * 'guifont' + */ + static void +update_im_font(void) +{ + LOGFONT lf_wide; + + if (p_guifontwide != NULL && *p_guifontwide != NUL + && gui.wide_font != NOFONT + && GetObject((HFONT)gui.wide_font, sizeof(lf_wide), &lf_wide)) + norm_logfont = lf_wide; + else + norm_logfont = sub_logfont; + im_set_font(&norm_logfont); +} +#endif + +#ifdef FEAT_MBYTE +/* + * Handler of gui.wide_font (p_guifontwide) changed notification. + */ + void +gui_mch_wide_font_changed(void) +{ + LOGFONT lf; + +# ifdef FEAT_MBYTE_IME + update_im_font(); +# endif + + gui_mch_free_font(gui.wide_ital_font); + gui.wide_ital_font = NOFONT; + gui_mch_free_font(gui.wide_bold_font); + gui.wide_bold_font = NOFONT; + gui_mch_free_font(gui.wide_boldital_font); + gui.wide_boldital_font = NOFONT; + + if (gui.wide_font + && GetObject((HFONT)gui.wide_font, sizeof(lf), &lf)) + { + if (!lf.lfItalic) + { + lf.lfItalic = TRUE; + gui.wide_ital_font = get_font_handle(&lf); + lf.lfItalic = FALSE; + } + if (lf.lfWeight < FW_BOLD) + { + lf.lfWeight = FW_BOLD; + gui.wide_bold_font = get_font_handle(&lf); + if (!lf.lfItalic) + { + lf.lfItalic = TRUE; + gui.wide_boldital_font = get_font_handle(&lf); + } + } + } +} +#endif + +/* + * Initialise vim to use the font with the given name. + * Return FAIL if the font could not be loaded, OK otherwise. + */ + int +gui_mch_init_font(char_u *font_name, int fontset UNUSED) +{ + LOGFONT lf; + GuiFont font = NOFONT; + char_u *p; + + /* Load the font */ + if (get_logfont(&lf, font_name, NULL, TRUE) == OK) + font = get_font_handle(&lf); + if (font == NOFONT) + return FAIL; + + if (font_name == NULL) + font_name = (char_u *)lf.lfFaceName; +#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) + norm_logfont = lf; +#endif +#ifdef FEAT_MBYTE_IME + sub_logfont = lf; +#endif +#ifdef FEAT_MBYTE_IME + update_im_font(); +#endif + gui_mch_free_font(gui.norm_font); + gui.norm_font = font; + current_font_height = lf.lfHeight; + GetFontSize(font); + + p = logfont2name(lf); + if (p != NULL) + { + hl_set_font_name(p); + + /* When setting 'guifont' to "*" replace it with the actual font name. + * */ + if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0) + { + vim_free(p_guifont); + p_guifont = p; + } + else + vim_free(p); + } + + gui_mch_free_font(gui.ital_font); + gui.ital_font = NOFONT; + gui_mch_free_font(gui.bold_font); + gui.bold_font = NOFONT; + gui_mch_free_font(gui.boldital_font); + gui.boldital_font = NOFONT; + + if (!lf.lfItalic) + { + lf.lfItalic = TRUE; + gui.ital_font = get_font_handle(&lf); + lf.lfItalic = FALSE; + } + if (lf.lfWeight < FW_BOLD) + { + lf.lfWeight = FW_BOLD; + gui.bold_font = get_font_handle(&lf); + if (!lf.lfItalic) + { + lf.lfItalic = TRUE; + gui.boldital_font = get_font_handle(&lf); + } + } + + return OK; +} + +#ifndef WPF_RESTORETOMAXIMIZED +# define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */ +#endif + +/* + * Return TRUE if the GUI window is maximized, filling the whole screen. + */ + int +gui_mch_maximized(void) +{ + WINDOWPLACEMENT wp; + + wp.length = sizeof(WINDOWPLACEMENT); + if (GetWindowPlacement(s_hwnd, &wp)) + return wp.showCmd == SW_SHOWMAXIMIZED + || (wp.showCmd == SW_SHOWMINIMIZED + && wp.flags == WPF_RESTORETOMAXIMIZED); + + return 0; +} + +/* + * Called when the font changed while the window is maximized or GO_KEEPWINSIZE + * is set. Compute the new Rows and Columns. This is like resizing the + * window. + */ + void +gui_mch_newfont(void) +{ + RECT rect; + + GetWindowRect(s_hwnd, &rect); + if (win_socket_id == 0) + { + gui_resize_shell(rect.right - rect.left + - get_caption_width_adjustment() + - (GetSystemMetrics(SM_CXFRAME) + + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, + rect.bottom - rect.top + - (GetSystemMetrics(SM_CYFRAME) + + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + - get_caption_height() +#ifdef FEAT_MENU + - gui_mswin_get_menu_height(FALSE) +#endif + ); + } + else + { + /* Inside another window, don't use the frame and border. */ + gui_resize_shell(rect.right - rect.left, + rect.bottom - rect.top +#ifdef FEAT_MENU + - gui_mswin_get_menu_height(FALSE) +#endif + ); + } +} + +/* + * Set the window title + */ + void +gui_mch_settitle( + char_u *title, + char_u *icon UNUSED) +{ + set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title)); +} + +#if defined(FEAT_MOUSESHAPE) || defined(PROTO) +/* Table for shape IDCs. Keep in sync with the mshape_names[] table in + * misc2.c! */ +static LPCSTR mshape_idcs[] = +{ + IDC_ARROW, /* arrow */ + MAKEINTRESOURCE(0), /* blank */ + IDC_IBEAM, /* beam */ + IDC_SIZENS, /* updown */ + IDC_SIZENS, /* udsizing */ + IDC_SIZEWE, /* leftright */ + IDC_SIZEWE, /* lrsizing */ + IDC_WAIT, /* busy */ + IDC_NO, /* no */ + IDC_ARROW, /* crosshair */ + IDC_ARROW, /* hand1 */ + IDC_ARROW, /* hand2 */ + IDC_ARROW, /* pencil */ + IDC_ARROW, /* question */ + IDC_ARROW, /* right-arrow */ + IDC_UPARROW, /* up-arrow */ + IDC_ARROW /* last one */ +}; + + void +mch_set_mouse_shape(int shape) +{ + LPCSTR idc; + + if (shape == MSHAPE_HIDE) + ShowCursor(FALSE); + else + { + if (shape >= MSHAPE_NUMBERED) + idc = IDC_ARROW; + else + idc = mshape_idcs[shape]; +#ifdef SetClassLongPtr + SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc)); +#else + SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc)); +#endif + if (!p_mh) + { + POINT mp; + + /* Set the position to make it redrawn with the new shape. */ + (void)GetCursorPos((LPPOINT)&mp); + (void)SetCursorPos(mp.x, mp.y); + ShowCursor(TRUE); + } + } +} +#endif + +#if defined(FEAT_BROWSE) || defined(PROTO) /* - * These are new in Windows ME/XP, only defined in recent compilers. + * The file browser exists in two versions: with "W" uses wide characters, + * without "W" the current codepage. When FEAT_MBYTE is defined and on + * Windows NT/2000/XP the "W" functions are used. */ -#ifndef HANDLE_WM_XBUTTONUP -# define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) -#endif -#ifndef HANDLE_WM_XBUTTONDOWN -# define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) + +# ifdef FEAT_MBYTE +/* + * Wide version of convert_filter(). + */ + static WCHAR * +convert_filterW(char_u *s) +{ + char_u *tmp; + int len; + WCHAR *res; + + tmp = convert_filter(s); + if (tmp == NULL) + return NULL; + len = (int)STRLEN(s) + 3; + res = enc_to_utf16(tmp, &len); + vim_free(tmp); + return res; +} + +/* + * Wide version of gui_mch_browse(). Keep in sync! + */ + static char_u * +gui_mch_browseW( + int saving, + char_u *title, + char_u *dflt, + char_u *ext, + char_u *initdir, + char_u *filter) +{ + /* We always use the wide function. This means enc_to_utf16() must work, + * otherwise it fails miserably! */ + OPENFILENAMEW fileStruct; + WCHAR fileBuf[MAXPATHL]; + WCHAR *wp; + int i; + WCHAR *titlep = NULL; + WCHAR *extp = NULL; + WCHAR *initdirp = NULL; + WCHAR *filterp; + char_u *p; + + if (dflt == NULL) + fileBuf[0] = NUL; + else + { + wp = enc_to_utf16(dflt, NULL); + if (wp == NULL) + fileBuf[0] = NUL; + else + { + for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i) + fileBuf[i] = wp[i]; + fileBuf[i] = NUL; + vim_free(wp); + } + } + + /* Convert the filter to Windows format. */ + filterp = convert_filterW(filter); + + vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); +# ifdef OPENFILENAME_SIZE_VERSION_400W + /* be compatible with Windows NT 4.0 */ + fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; +# else + fileStruct.lStructSize = sizeof(fileStruct); +# endif + + if (title != NULL) + titlep = enc_to_utf16(title, NULL); + fileStruct.lpstrTitle = titlep; + + if (ext != NULL) + extp = enc_to_utf16(ext, NULL); + fileStruct.lpstrDefExt = extp; + + fileStruct.lpstrFile = fileBuf; + fileStruct.nMaxFile = MAXPATHL; + fileStruct.lpstrFilter = filterp; + fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ + /* has an initial dir been specified? */ + if (initdir != NULL && *initdir != NUL) + { + /* Must have backslashes here, no matter what 'shellslash' says */ + initdirp = enc_to_utf16(initdir, NULL); + if (initdirp != NULL) + { + for (wp = initdirp; *wp != NUL; ++wp) + if (*wp == '/') + *wp = '\\'; + } + fileStruct.lpstrInitialDir = initdirp; + } + + /* + * TODO: Allow selection of multiple files. Needs another arg to this + * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. + * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on + * files that don't exist yet, so I haven't put it in. What about + * OFN_PATHMUSTEXIST? + * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. + */ + fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); +# ifdef FEAT_SHORTCUT + if (curbuf->b_p_bin) + fileStruct.Flags |= OFN_NODEREFERENCELINKS; +# endif + if (saving) + { + if (!GetSaveFileNameW(&fileStruct)) + return NULL; + } + else + { + if (!GetOpenFileNameW(&fileStruct)) + return NULL; + } + + vim_free(filterp); + vim_free(initdirp); + vim_free(titlep); + vim_free(extp); + + /* Convert from UCS2 to 'encoding'. */ + p = utf16_to_enc(fileBuf, NULL); + if (p != NULL) + /* when out of memory we get garbage for non-ASCII chars */ + STRCPY(fileBuf, p); + vim_free(p); + + /* Give focus back to main window (when using MDI). */ + SetFocus(s_hwnd); + + /* Shorten the file name if possible */ + return vim_strsave(shorten_fname1((char_u *)fileBuf)); +} +# endif /* FEAT_MBYTE */ + + +/* + * Convert the string s to the proper format for a filter string by replacing + * the \t and \n delimiters with \0. + * Returns the converted string in allocated memory. + * + * Keep in sync with convert_filterW() above! + */ + static char_u * +convert_filter(char_u *s) +{ + char_u *res; + unsigned s_len = (unsigned)STRLEN(s); + unsigned i; + + res = alloc(s_len + 3); + if (res != NULL) + { + for (i = 0; i < s_len; ++i) + if (s[i] == '\t' || s[i] == '\n') + res[i] = '\0'; + else + res[i] = s[i]; + res[s_len] = NUL; + /* Add two extra NULs to make sure it's properly terminated. */ + res[s_len + 1] = NUL; + res[s_len + 2] = NUL; + } + return res; +} + +/* + * Select a directory. + */ + char_u * +gui_mch_browsedir(char_u *title, char_u *initdir) +{ + /* We fake this: Use a filter that doesn't select anything and a default + * file name that won't be used. */ + return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL, + initdir, (char_u *)_("Directory\t*.nothing\n")); +} + +/* + * Pop open a file browser and return the file selected, in allocated memory, + * or NULL if Cancel is hit. + * saving - TRUE if the file will be saved to, FALSE if it will be opened. + * title - Title message for the file browser dialog. + * dflt - Default name of file. + * ext - Default extension to be added to files without extensions. + * initdir - directory in which to open the browser (NULL = current dir) + * filter - Filter for matched files to choose from. + * + * Keep in sync with gui_mch_browseW() above! + */ + char_u * +gui_mch_browse( + int saving, + char_u *title, + char_u *dflt, + char_u *ext, + char_u *initdir, + char_u *filter) +{ +# ifdef FEAT_MBYTE + return gui_mch_browseW(saving, title, dflt, ext, initdir, filter); +# else + OPENFILENAME fileStruct; + char_u fileBuf[MAXPATHL]; + char_u *initdirp = NULL; + char_u *filterp; + char_u *p; + + if (dflt == NULL) + fileBuf[0] = NUL; + else + vim_strncpy(fileBuf, dflt, MAXPATHL - 1); + + /* Convert the filter to Windows format. */ + filterp = convert_filter(filter); + + vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); +# ifdef OPENFILENAME_SIZE_VERSION_400 + /* be compatible with Windows NT 4.0 */ + fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; +# else + fileStruct.lStructSize = sizeof(fileStruct); +# endif + + fileStruct.lpstrTitle = (LPSTR)title; + fileStruct.lpstrDefExt = (LPSTR)ext; + + fileStruct.lpstrFile = (LPSTR)fileBuf; + fileStruct.nMaxFile = MAXPATHL; + fileStruct.lpstrFilter = (LPSTR)filterp; + fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ + /* has an initial dir been specified? */ + if (initdir != NULL && *initdir != NUL) + { + /* Must have backslashes here, no matter what 'shellslash' says */ + initdirp = vim_strsave(initdir); + if (initdirp != NULL) + for (p = initdirp; *p != NUL; ++p) + if (*p == '/') + *p = '\\'; + fileStruct.lpstrInitialDir = (LPSTR)initdirp; + } + + /* + * TODO: Allow selection of multiple files. Needs another arg to this + * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. + * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on + * files that don't exist yet, so I haven't put it in. What about + * OFN_PATHMUSTEXIST? + * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. + */ + fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); +# ifdef FEAT_SHORTCUT + if (curbuf->b_p_bin) + fileStruct.Flags |= OFN_NODEREFERENCELINKS; +# endif + if (saving) + { + if (!GetSaveFileName(&fileStruct)) + return NULL; + } + else + { + if (!GetOpenFileName(&fileStruct)) + return NULL; + } + + vim_free(filterp); + vim_free(initdirp); + + /* Give focus back to main window (when using MDI). */ + SetFocus(s_hwnd); + + /* Shorten the file name if possible */ + return vim_strsave(shorten_fname1((char_u *)fileBuf)); +# endif +} +#endif /* FEAT_BROWSE */ + + static void +_OnDropFiles( + HWND hwnd UNUSED, + HDROP hDrop) +{ +#define BUFPATHLEN _MAX_PATH +#define DRAGQVAL 0xFFFFFFFF +#ifdef FEAT_MBYTE + WCHAR wszFile[BUFPATHLEN]; #endif -#ifndef HANDLE_WM_XBUTTONDBLCLK -# define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) + char szFile[BUFPATHLEN]; + UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); + UINT i; + char_u **fnames; + POINT pt; + int_u modifiers = 0; + + /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */ + + /* Obtain dropped position */ + DragQueryPoint(hDrop, &pt); + MapWindowPoints(s_hwnd, s_textArea, &pt, 1); + + reset_VIsual(); + + fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); + + if (fnames != NULL) + for (i = 0; i < cFiles; ++i) + { +#ifdef FEAT_MBYTE + if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) + fnames[i] = utf16_to_enc(wszFile, NULL); + else #endif + { + DragQueryFile(hDrop, i, szFile, BUFPATHLEN); + fnames[i] = vim_strsave((char_u *)szFile); + } + } + + DragFinish(hDrop); + + if (fnames != NULL) + { + if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) + modifiers |= MOUSE_SHIFT; + if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) + modifiers |= MOUSE_CTRL; + if ((GetKeyState(VK_MENU) & 0x8000) != 0) + modifiers |= MOUSE_ALT; + + gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles); + + s_need_activate = TRUE; + } +} + + static int +_OnScroll( + HWND hwnd UNUSED, + HWND hwndCtl, + UINT code, + int pos) +{ + static UINT prev_code = 0; /* code of previous call */ + scrollbar_T *sb, *sb_info; + long val; + int dragging = FALSE; + int dont_scroll_save = dont_scroll; + SCROLLINFO si; + + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + + sb = gui_mswin_find_scrollbar(hwndCtl); + if (sb == NULL) + return 0; + + if (sb->wp != NULL) /* Left or right scrollbar */ + { + /* + * Careful: need to get scrollbar info out of first (left) scrollbar + * for window, but keep real scrollbar too because we must pass it to + * gui_drag_scrollbar(). + */ + sb_info = &sb->wp->w_scrollbars[0]; + } + else /* Bottom scrollbar */ + sb_info = sb; + val = sb_info->value; + + switch (code) + { + case SB_THUMBTRACK: + val = pos; + dragging = TRUE; + if (sb->scroll_shift > 0) + val <<= sb->scroll_shift; + break; + case SB_LINEDOWN: + val++; + break; + case SB_LINEUP: + val--; + break; + case SB_PAGEDOWN: + val += (sb_info->size > 2 ? sb_info->size - 2 : 1); + break; + case SB_PAGEUP: + val -= (sb_info->size > 2 ? sb_info->size - 2 : 1); + break; + case SB_TOP: + val = 0; + break; + case SB_BOTTOM: + val = sb_info->max; + break; + case SB_ENDSCROLL: + if (prev_code == SB_THUMBTRACK) + { + /* + * "pos" only gives us 16-bit data. In case of large file, + * use GetScrollPos() which returns 32-bit. Unfortunately it + * is not valid while the scrollbar is being dragged. + */ + val = GetScrollPos(hwndCtl, SB_CTL); + if (sb->scroll_shift > 0) + val <<= sb->scroll_shift; + } + break; + + default: + /* TRACE("Unknown scrollbar event %d\n", code); */ + return 0; + } + prev_code = code; + + si.nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val; + SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); + + /* + * When moving a vertical scrollbar, move the other vertical scrollbar too. + */ + if (sb->wp != NULL) + { + scrollbar_T *sba = sb->wp->w_scrollbars; + HWND id = sba[ (sb == sba + SBAR_LEFT) ? SBAR_RIGHT : SBAR_LEFT].id; + + SetScrollInfo(id, SB_CTL, &si, TRUE); + } + + /* Don't let us be interrupted here by another message. */ + s_busy_processing = TRUE; + + /* When "allow_scrollbar" is FALSE still need to remember the new + * position, but don't actually scroll by setting "dont_scroll". */ + dont_scroll = !allow_scrollbar; + + mch_disable_flush(); + gui_drag_scrollbar(sb, val, dragging); + mch_enable_flush(); + gui_may_flush(); + + s_busy_processing = FALSE; + dont_scroll = dont_scroll_save; + + return 0; +} + /* - * Include the common stuff for MS-Windows GUI. + * Get command line arguments. + * Use "prog" as the name of the program and "cmdline" as the arguments. + * Copy the arguments to allocated memory. + * Return the number of arguments (including program name). + * Return pointers to the arguments in "argvp". Memory is allocated with + * malloc(), use free() instead of vim_free(). + * Return pointer to buffer in "tofree". + * Returns zero when out of memory. */ -#include "gui_w48.c" + int +get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree) +{ + int i; + char *p; + char *progp; + char *pnew = NULL; + char *newcmdline; + int inquote; + int argc; + char **argv = NULL; + int round; + + *tofree = NULL; + +#ifdef FEAT_MBYTE + /* Try using the Unicode version first, it takes care of conversion when + * 'encoding' is changed. */ + argc = get_cmd_argsW(&argv); + if (argc != 0) + goto done; +#endif + + /* Handle the program name. Remove the ".exe" extension, and find the 1st + * non-space. */ + p = strrchr(prog, '.'); + if (p != NULL) + *p = NUL; + for (progp = prog; *progp == ' '; ++progp) + ; + + /* The command line is copied to allocated memory, so that we can change + * it. Add the size of the string, the separating NUL and a terminating + * NUL. */ + newcmdline = malloc(STRLEN(cmdline) + STRLEN(progp) + 2); + if (newcmdline == NULL) + return 0; + + /* + * First round: count the number of arguments ("pnew" == NULL). + * Second round: produce the arguments. + */ + for (round = 1; round <= 2; ++round) + { + /* First argument is the program name. */ + if (pnew != NULL) + { + argv[0] = pnew; + strcpy(pnew, progp); + pnew += strlen(pnew); + *pnew++ = NUL; + } + + /* + * Isolate each argument and put it in argv[]. + */ + p = cmdline; + argc = 1; + while (*p != NUL) + { + inquote = FALSE; + if (pnew != NULL) + argv[argc] = pnew; + ++argc; + while (*p != NUL && (inquote || (*p != ' ' && *p != '\t'))) + { + /* Backslashes are only special when followed by a double + * quote. */ + i = (int)strspn(p, "\\"); + if (p[i] == '"') + { + /* Halve the number of backslashes. */ + if (i > 1 && pnew != NULL) + { + vim_memset(pnew, '\\', i / 2); + pnew += i / 2; + } + + /* Even nr of backslashes toggles quoting, uneven copies + * the double quote. */ + if ((i & 1) == 0) + inquote = !inquote; + else if (pnew != NULL) + *pnew++ = '"'; + p += i + 1; + } + else if (i > 0) + { + /* Copy span of backslashes unmodified. */ + if (pnew != NULL) + { + vim_memset(pnew, '\\', i); + pnew += i; + } + p += i; + } + else + { + if (pnew != NULL) + *pnew++ = *p; +#ifdef FEAT_MBYTE + /* Can't use mb_* functions, because 'encoding' is not + * initialized yet here. */ + if (IsDBCSLeadByte(*p)) + { + ++p; + if (pnew != NULL) + *pnew++ = *p; + } +#endif + ++p; + } + } + + if (pnew != NULL) + *pnew++ = NUL; + while (*p == ' ' || *p == '\t') + ++p; /* advance until a non-space */ + } + + if (round == 1) + { + argv = (char **)malloc((argc + 1) * sizeof(char *)); + if (argv == NULL ) + { + free(newcmdline); + return 0; /* malloc error */ + } + pnew = newcmdline; + *tofree = newcmdline; + } + } + +#ifdef FEAT_MBYTE +done: +#endif + argv[argc] = NULL; /* NULL-terminated list */ + *argvp = argv; + return argc; +} #ifdef FEAT_XPM_W32 # include "xpm_w32.h" @@ -179,7 +4329,7 @@ #endif -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI # define ID_BEVAL_TOOLTIP 200 # define BEVAL_TEXT_LEN MAXPATHL @@ -190,9 +4340,9 @@ # define UINT_PTR UINT #endif -static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); -static void delete_tooltip __ARGS((BalloonEval *beval)); -static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)); +static void make_tooltip(BalloonEval *beval, char *text, POINT pt); +static void delete_tooltip(BalloonEval *beval); +static VOID CALLBACK BevalTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); static BalloonEval *cur_beval = NULL; static UINT_PTR BevalTimerId = 0; @@ -258,7 +4408,7 @@ typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); # define TTN_GETDISPINFO (TTN_FIRST - 0) #endif -#endif /* defined(FEAT_BEVAL) */ +#endif /* defined(FEAT_BEVAL_GUI) */ #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define @@ -318,7 +4468,9 @@ static UINT s_menu_id = 100; * stuff for dialogs, menus, tearoffs etc. */ static LRESULT APIENTRY dialog_callback(HWND, UINT, WPARAM, LPARAM); +#ifdef FEAT_TEAROFF static LRESULT APIENTRY tearoff_callback(HWND, UINT, WPARAM, LPARAM); +#endif static PWORD add_dialog_element( PWORD p, @@ -331,15 +4483,16 @@ add_dialog_element( WORD clss, const char *caption); static LPWORD lpwAlign(LPWORD); -static int nCopyAnsiToWideChar(LPWORD, LPSTR); +static int nCopyAnsiToWideChar(LPWORD, LPSTR, BOOL); +#if defined(FEAT_MENU) && defined(FEAT_TEAROFF) static void gui_mch_tearoff(char_u *title, vimmenu_T *menu, int initX, int initY); +#endif static void get_dialog_font_metrics(void); static int dialog_default_button = -1; /* Intellimouse support */ static int mouse_scroll_lines = 0; -static UINT msh_msgmousewheel = 0; static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ #ifdef FEAT_TOOLBAR @@ -396,50 +4549,6 @@ static void dyn_imm_load(void); # define pImmSetConversionStatus ImmSetConversionStatus #endif -#ifndef ETO_IGNORELANGUAGE -# define ETO_IGNORELANGUAGE 0x1000 -#endif - -/* multi monitor support */ -typedef struct _MONITORINFOstruct -{ - DWORD cbSize; - RECT rcMonitor; - RECT rcWork; - DWORD dwFlags; -} _MONITORINFO; - -typedef HANDLE _HMONITOR; -typedef _HMONITOR (WINAPI *TMonitorFromWindow)(HWND, DWORD); -typedef BOOL (WINAPI *TGetMonitorInfo)(_HMONITOR, _MONITORINFO *); - -static TMonitorFromWindow pMonitorFromWindow = NULL; -static TGetMonitorInfo pGetMonitorInfo = NULL; -static HANDLE user32_lib = NULL; -#ifdef FEAT_NETBEANS_INTG -int WSInitialized = FALSE; /* WinSock is initialized */ -#endif -/* - * Return TRUE when running under Windows NT 3.x or Win32s, both of which have - * less fancy GUI APIs. - */ - static int -is_winnt_3(void) -{ - return ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && os_version.dwMajorVersion == 3) - || (os_version.dwPlatformId == VER_PLATFORM_WIN32s)); -} - -/* - * Return TRUE when running under Win32s. - */ - int -gui_is_win32s(void) -{ - return (os_version.dwPlatformId == VER_PLATFORM_WIN32s); -} - #ifdef FEAT_MENU /* * Figure out how high the menu bar is at the moment. @@ -461,55 +4570,38 @@ gui_mswin_get_menu_height( if (num == 0) menu_height = 0; + else if (IsMinimized(s_hwnd)) + { + /* The height of the menu cannot be determined while the window is + * minimized. Take the previous height if the menu is changed in that + * state, to avoid that Vim's vertical window size accidentally + * increases due to the unaccounted-for menu height. */ + menu_height = old_menu_height == -1 ? 0 : old_menu_height; + } else { - if (is_winnt_3()) /* for NT 3.xx */ - { - if (gui.starting) - menu_height = GetSystemMetrics(SM_CYMENU); - else - { - RECT r1, r2; - int frameht = GetSystemMetrics(SM_CYFRAME); - int capht = GetSystemMetrics(SM_CYCAPTION); - - /* get window rect of s_hwnd - * get client rect of s_hwnd - * get cap height - * subtract from window rect, the sum of client height, - * (if not maximized)frame thickness, and caption height. - */ - GetWindowRect(s_hwnd, &r1); - GetClientRect(s_hwnd, &r2); - menu_height = r1.bottom - r1.top - (r2.bottom - r2.top - + 2 * frameht * (!IsZoomed(s_hwnd)) + capht); - } - } - else /* win95 and variants (NT 4.0, I guess) */ + /* + * In case 'lines' is set in _vimrc/_gvimrc window width doesn't + * seem to have been set yet, so menu wraps in default window + * width which is very narrow. Instead just return height of a + * single menu item. Will still be wrong when the menu really + * should wrap over more than one line. + */ + GetMenuItemRect(s_hwnd, s_menuBar, 0, &rc1); + if (gui.starting) + menu_height = rc1.bottom - rc1.top + 1; + else { - /* - * In case 'lines' is set in _vimrc/_gvimrc window width doesn't - * seem to have been set yet, so menu wraps in default window - * width which is very narrow. Instead just return height of a - * single menu item. Will still be wrong when the menu really - * should wrap over more than one line. - */ - GetMenuItemRect(s_hwnd, s_menuBar, 0, &rc1); - if (gui.starting) - menu_height = rc1.bottom - rc1.top + 1; - else - { - GetMenuItemRect(s_hwnd, s_menuBar, num - 1, &rc2); - menu_height = rc2.bottom - rc1.top + 1; - } + GetMenuItemRect(s_hwnd, s_menuBar, num - 1, &rc2); + menu_height = rc2.bottom - rc1.top + 1; } } if (fix_window && menu_height != old_menu_height) { - old_menu_height = menu_height; gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); } + old_menu_height = menu_height; return menu_height; } @@ -535,42 +4627,11 @@ init_mouse_wheel(void) #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" - HWND hdl_mswheel; - UINT msh_msgscrolllines; - - msh_msgmousewheel = 0; mouse_scroll_lines = 3; /* reasonable default */ - if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && os_version.dwMajorVersion >= 4) - || (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS - && ((os_version.dwMajorVersion == 4 - && os_version.dwMinorVersion >= 10) - || os_version.dwMajorVersion >= 5))) - { - /* if NT 4.0+ (or Win98) get scroll lines directly from system */ - SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, - &mouse_scroll_lines, 0); - } - else if (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS - || (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && os_version.dwMajorVersion < 4)) - { /* - * If Win95 or NT 3.51, - * try to find the hidden point32 window. - */ - hdl_mswheel = FindWindow(VMOUSEZ_CLASSNAME, VMOUSEZ_TITLE); - if (hdl_mswheel) - { - msh_msgscrolllines = RegisterWindowMessage(VMSH_SCROLL_LINES); - if (msh_msgscrolllines) - { - mouse_scroll_lines = (int)SendMessage(hdl_mswheel, - msh_msgscrolllines, 0, 0); - msh_msgmousewheel = RegisterWindowMessage(VMSH_MOUSEWHEEL); - } - } - } + /* if NT 4.0+ (or Win98) get scroll lines directly from system */ + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, + &mouse_scroll_lines, 0); } @@ -602,6 +4663,7 @@ _OnMouseWheel( if (mouse_scroll_lines == 0) init_mouse_wheel(); + mch_disable_flush(); if (mouse_scroll_lines > 0 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) { @@ -610,6 +4672,8 @@ _OnMouseWheel( } else _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); + mch_enable_flush(); + gui_may_flush(); } #ifdef USE_SYSMENU_FONT @@ -699,6 +4763,7 @@ _OnWindowPosChanged( const LPWINDOWPOS lpwpos) { static int x = 0, y = 0, cx = 0, cy = 0; + extern int WSInitialized; if (WSInitialized && (lpwpos->x != x || lpwpos->y != y || lpwpos->cx != cx || lpwpos->cy != cy)) @@ -906,8 +4971,7 @@ _WndProc( char_u *str = NULL; static void *tt_text = NULL; - vim_free(tt_text); - tt_text = NULL; + VIM_CLEAR(tt_text); # ifdef FEAT_GUI_TABLINE if (gui_mch_showing_tabline() @@ -988,7 +5052,7 @@ _WndProc( if (STRLEN(str) < sizeof(lpdi->szText) || ((tt_text = vim_strsave(str)) == NULL)) - vim_strncpy(lpdi->szText, str, + vim_strncpy((char_u *)lpdi->szText, str, sizeof(lpdi->szText) - 1); else lpdi->lpszText = tt_text; @@ -1082,7 +5146,7 @@ _WndProc( return result; } #endif - gui_mch_get_winpos(&x, &y); + (void)gui_mch_get_winpos(&x, &y); xPos -= x; if (xPos < 48) /* <VN> TODO should use system metric? */ @@ -1108,13 +5172,8 @@ _WndProc( #endif default: - if (uMsg == msh_msgmousewheel && msh_msgmousewheel != 0) - { /* handle MSH_MOUSEWHEEL messages for Intellimouse */ - _OnMouseWheel(hwnd, HIWORD(wParam)); - return 0L; - } #ifdef MSWIN_FIND_REPLACE - else if (uMsg == s_findrep_msg && s_findrep_msg != 0) + if (uMsg == s_findrep_msg && s_findrep_msg != 0) { _OnFindRepl(); } @@ -1275,41 +5334,22 @@ gui_mch_prepare(int *argc, char **argv) } #endif - /* get the OS version info */ - os_version.dwOSVersionInfoSize = sizeof(os_version); - GetVersionEx(&os_version); /* this call works on Win32s, Win95 and WinNT */ - - /* try and load the user32.dll library and get the entry points for - * multi-monitor-support. */ - if ((user32_lib = vimLoadLib("User32.dll")) != NULL) - { - pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib, - "MonitorFromWindow"); - - /* there are ...A and ...W version of GetMonitorInfo - looking at - * winuser.h, they have exactly the same declaration. */ - pGetMonitorInfo = (TGetMonitorInfo)GetProcAddress(user32_lib, - "GetMonitorInfoA"); - } - -#ifdef FEAT_MBYTE - /* If the OS is Windows NT, use wide functions; - * this enables common dialogs input unicode from IME. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - pDispatchMessage = DispatchMessageW; - pGetMessage = GetMessageW; - pIsDialogMessage = IsDialogMessageW; - pPeekMessage = PeekMessageW; - } - else + /* + * Some embeded languages (if_*) require to initialize WinSock2 by hosting + * application. + */ { - pDispatchMessage = DispatchMessageA; - pGetMessage = GetMessageA; - pIsDialogMessage = IsDialogMessageA; - pPeekMessage = PeekMessageA; - } + WSADATA wsaData; + int wsaerr; + extern int WSInitialized; + + /* Init WinSock */ + wsaerr = WSAStartup(MAKEWORD(2, 2), &wsaData); +#ifdef FEAT_JOB_CHANNEL + if (wsaerr == 0) + WSInitialized = TRUE; #endif + } } /* @@ -1373,12 +5413,7 @@ gui_mch_init(void) atom = #endif RegisterClassW(&wndclassw)) == 0) - { - if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return FAIL; - - /* Must be Windows 98, fall back to non-wide function. */ - } + return FAIL; else wide_WindowProc = TRUE; } @@ -1469,6 +5504,8 @@ gui_mch_init(void) if (s_hwnd == NULL) return FAIL; + w32_set_transparency(s_hwnd, 255); + #ifdef GLOBAL_IME global_ime_init(atom, s_hwnd); #endif @@ -1516,7 +5553,7 @@ gui_mch_init(void) return FAIL; } s_textArea = CreateWindowEx( - WS_EX_CLIENTEDGE, + 0, szTextAreaClass, "Vim text area", WS_CHILD | WS_VISIBLE, 0, 0, 100, /* Any value will do for now */ @@ -1527,18 +5564,22 @@ gui_mch_init(void) if (s_textArea == NULL) return FAIL; +#ifdef FEAT_LIBCALL + /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ + { + HANDLE hIcon = NULL; + + if (mch_icon_load(&hIcon) == OK && hIcon != NULL) + SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + } +#endif + #ifdef FEAT_MENU s_menuBar = CreateMenu(); #endif s_hdc = GetDC(s_textArea); -#ifdef MSWIN16_FASTTEXT - SetBkMode(s_hdc, OPAQUE); -#endif - -#ifdef FEAT_WINDOWS DragAcceptFiles(s_hwnd, TRUE); -#endif /* Do we need to bother with this? */ /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ @@ -1563,9 +5604,9 @@ gui_mch_init(void) highlight_gui_started(); /* - * Start out by adding the configured border width into the border offset + * Start out by adding the configured border width into the border offset. */ - gui.border_offset = gui.border_width + 2; /*CLIENT EDGE*/ + gui.border_offset = gui.border_width; /* * Set up for Intellimouse processing @@ -1596,13 +5637,13 @@ gui_mch_init(void) /* Initialise the struct */ s_findrep_struct.lStructSize = sizeof(s_findrep_struct); - s_findrep_struct.lpstrFindWhat = alloc(MSWIN_FR_BUFSIZE); + s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE); s_findrep_struct.lpstrFindWhat[0] = NUL; - s_findrep_struct.lpstrReplaceWith = alloc(MSWIN_FR_BUFSIZE); + s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); s_findrep_struct.lpstrReplaceWith[0] = NUL; s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; -# if defined(FEAT_MBYTE) && defined(WIN3264) +# ifdef FEAT_MBYTE s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); s_findrep_struct_w.lpstrFindWhat = (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); @@ -1616,14 +5657,21 @@ gui_mch_init(void) #endif #ifdef FEAT_EVAL -# ifndef HandleToLong -/* HandleToLong() only exists in compilers that can do 64 bit builds */ -# define HandleToLong(h) ((long)(h)) +# if !defined(_MSC_VER) || (_MSC_VER < 1400) +/* Define HandleToLong for old MS and non-MS compilers if not defined. */ +# ifndef HandleToLong +# define HandleToLong(h) ((long)(intptr_t)(h)) +# endif # endif /* set the v:windowid variable */ set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); #endif +#ifdef FEAT_RENDER_OPTIONS + if (p_rop) + (void)gui_mch_set_rendering_options(p_rop); +#endif + theend: /* Display any pending error messages */ display_errors(); @@ -1638,22 +5686,18 @@ gui_mch_init(void) static void get_work_area(RECT *spi_rect) { - _HMONITOR mon; - _MONITORINFO moninfo; + HMONITOR mon; + MONITORINFO moninfo; - /* use these functions only if available */ - if (pMonitorFromWindow != NULL && pGetMonitorInfo != NULL) + /* work out which monitor the window is on, and get *it's* work area */ + mon = MonitorFromWindow(s_hwnd, MONITOR_DEFAULTTOPRIMARY); + if (mon != NULL) { - /* work out which monitor the window is on, and get *it's* work area */ - mon = pMonitorFromWindow(s_hwnd, 1 /*MONITOR_DEFAULTTOPRIMARY*/); - if (mon != NULL) + moninfo.cbSize = sizeof(MONITORINFO); + if (GetMonitorInfo(mon, &moninfo)) { - moninfo.cbSize = sizeof(_MONITORINFO); - if (pGetMonitorInfo(mon, &moninfo)) - { - *spi_rect = moninfo.rcWork; - return; - } + *spi_rect = moninfo.rcWork; + return; } } /* this is the old method... */ @@ -1663,42 +5707,40 @@ get_work_area(RECT *spi_rect) /* * Set the size of the window to the given width and height in pixels. */ -/*ARGSUSED*/ void -gui_mch_set_shellsize(int width, int height, - int min_width, int min_height, int base_width, int base_height, +gui_mch_set_shellsize( + int width, + int height, + int min_width UNUSED, + int min_height UNUSED, + int base_width UNUSED, + int base_height UNUSED, int direction) { RECT workarea_rect; + RECT window_rect; int win_width, win_height; - WINDOWPLACEMENT wndpl; /* Try to keep window completely on screen. */ /* Get position of the screen work area. This is the part that is not * used by the taskbar or appbars. */ get_work_area(&workarea_rect); - /* Get current position of our window. Note that the .left and .top are - * relative to the work area. */ - wndpl.length = sizeof(WINDOWPLACEMENT); - GetWindowPlacement(s_hwnd, &wndpl); - /* Resizing a maximized window looks very strange, unzoom it first. * But don't do it when still starting up, it may have been requested in * the shortcut. */ - if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) - { + if (IsZoomed(s_hwnd) && starting == 0) ShowWindow(s_hwnd, SW_SHOWNORMAL); - /* Need to get the settings of the normal window. */ - GetWindowPlacement(s_hwnd, &wndpl); - } + + GetWindowRect(s_hwnd, &window_rect); /* compute the size of the outside of the window */ win_width = width + (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + + get_caption_width_adjustment(); win_height = height + (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 - + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + + get_caption_height() #ifdef FEAT_MENU + gui_mswin_get_menu_height(FALSE) #endif @@ -1707,34 +5749,24 @@ gui_mch_set_shellsize(int width, int height, /* The following should take care of keeping Vim on the same monitor, no * matter if the secondary monitor is left or right of the primary * monitor. */ - wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; - wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; + window_rect.right = window_rect.left + win_width; + window_rect.bottom = window_rect.top + win_height; /* If the window is going off the screen, move it on to the screen. */ - if ((direction & RESIZE_HOR) - && wndpl.rcNormalPosition.right > workarea_rect.right) - OffsetRect(&wndpl.rcNormalPosition, - workarea_rect.right - wndpl.rcNormalPosition.right, 0); - - if ((direction & RESIZE_HOR) - && wndpl.rcNormalPosition.left < workarea_rect.left) - OffsetRect(&wndpl.rcNormalPosition, - workarea_rect.left - wndpl.rcNormalPosition.left, 0); - - if ((direction & RESIZE_VERT) - && wndpl.rcNormalPosition.bottom > workarea_rect.bottom) - OffsetRect(&wndpl.rcNormalPosition, - 0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom); - - if ((direction & RESIZE_VERT) - && wndpl.rcNormalPosition.top < workarea_rect.top) - OffsetRect(&wndpl.rcNormalPosition, - 0, workarea_rect.top - wndpl.rcNormalPosition.top); - - /* set window position - we should use SetWindowPlacement rather than - * SetWindowPos as the MSDN docs say the coord systems returned by - * these two are not compatible. */ - SetWindowPlacement(s_hwnd, &wndpl); + if ((direction & RESIZE_HOR) && window_rect.right > workarea_rect.right) + OffsetRect(&window_rect, workarea_rect.right - window_rect.right, 0); + + if ((direction & RESIZE_HOR) && window_rect.left < workarea_rect.left) + OffsetRect(&window_rect, workarea_rect.left - window_rect.left, 0); + + if ((direction & RESIZE_VERT) && window_rect.bottom > workarea_rect.bottom) + OffsetRect(&window_rect, 0, workarea_rect.bottom - window_rect.bottom); + + if ((direction & RESIZE_VERT) && window_rect.top < workarea_rect.top) + OffsetRect(&window_rect, 0, workarea_rect.top - window_rect.top); + + MoveWindow(s_hwnd, window_rect.left, window_rect.top, + win_width, win_height, TRUE); SetActiveWindow(s_hwnd); SetFocus(s_hwnd); @@ -1814,22 +5846,21 @@ gui_mch_set_sp_color(guicolor_T color) gui.currSpColor = color; } -#if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME) +#ifdef FEAT_MBYTE_IME /* * Multi-byte handling, originally by Sung-Hoon Baek. * First static functions (no prototypes generated). */ -#ifdef _MSC_VER -# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */ -#endif -#include <imm.h> +# ifdef _MSC_VER +# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */ +# endif +# include <imm.h> /* * handle WM_IME_NOTIFY message */ -/*ARGSUSED*/ static LRESULT -_OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) +_OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) { LRESULT lResult = 0; HIMC hImc; @@ -1848,7 +5879,7 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) State &= ~LANGMAP; if (State & INSERT) { -#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) +#if defined(FEAT_KEYMAP) /* Unshown 'keymap' in status lines */ if (curbuf->b_p_iminsert == B_IMODE_LMAP) { @@ -1870,6 +5901,7 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) } } gui_update_cursor(TRUE, FALSE); + gui_mch_flush(); lResult = 0; break; } @@ -1877,9 +5909,8 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) return lResult; } -/*ARGSUSED*/ static LRESULT -_OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param) +_OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) { char_u *ret; int len; @@ -1941,7 +5972,7 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) pImmGetCompositionStringA(hIMC, GCS, buf, ret); /* convert from codepage to UCS-2 */ - MultiByteToWideChar_alloc(GetACP(), 0, buf, ret, &wbuf, lenp); + MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); vim_free(buf); return (short_u *)wbuf; @@ -1976,7 +6007,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp) #endif /* For global functions we need prototypes. */ -#if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO) +#if defined(FEAT_MBYTE_IME) || defined(PROTO) /* * set font to IM. @@ -2088,7 +6119,7 @@ im_set_active(int active) * Get IM status. When IM is on, return not 0. Else return 0. */ int -im_get_status() +im_get_status(void) { int status = 0; HIMC hImc; @@ -2101,7 +6132,7 @@ im_get_status() return status; } -#endif /* FEAT_MBYTE && FEAT_MBYTE_IME */ +#endif /* FEAT_MBYTE_IME */ #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) /* Win32 with GLOBAL IME */ @@ -2134,7 +6165,7 @@ im_set_active(int active) * Get IM status. When IM is on, return not 0. Else return 0. */ int -im_get_status() +im_get_status(void) { return global_ime_get_status(); } @@ -2192,31 +6223,73 @@ RevOut( HDC s_hdc, CONST INT *padding) { int ix; - static int special = -1; - - if (special == -1) - { - /* Check windows version: special treatment is needed if it is NT 5 or - * Win98 or higher. */ - if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && os_version.dwMajorVersion >= 5) - || (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS - && (os_version.dwMajorVersion > 4 - || (os_version.dwMajorVersion == 4 - && os_version.dwMinorVersion > 0)))) - special = 1; - else - special = 0; + + for (ix = 0; ix < (int)len; ++ix) + ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, + pcliprect, text + ix, 1, padding); +} +#endif + + static void +draw_line( + int x1, + int y1, + int x2, + int y2, + COLORREF color) +{ +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_DrawLine(s_dwc, x1, y1, x2, y2, color); + else +#endif + { + HPEN hpen = CreatePen(PS_SOLID, 1, color); + HPEN old_pen = SelectObject(s_hdc, hpen); + MoveToEx(s_hdc, x1, y1, NULL); + /* Note: LineTo() excludes the last pixel in the line. */ + LineTo(s_hdc, x2, y2); + DeleteObject(SelectObject(s_hdc, old_pen)); } +} - if (special) - for (ix = 0; ix < (int)len; ++ix) - ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, - pcliprect, text + ix, 1, padding); + static void +set_pixel( + int x, + int y, + COLORREF color) +{ +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_SetPixel(s_dwc, x, y, color); else - ExtTextOut(s_hdc, col, row, foptions, pcliprect, text, len, padding); +#endif + SetPixel(s_hdc, x, y, color); } + + static void +fill_rect( + const RECT *rcp, + HBRUSH hbr, + COLORREF color) +{ +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_FillRect(s_dwc, rcp, color); + else #endif + { + HBRUSH hbr2; + + if (hbr == NULL) + hbr2 = CreateSolidBrush(color); + else + hbr2 = hbr; + FillRect(s_hdc, rcp, hbr2); + if (hbr == NULL) + DeleteBrush(hbr2); + } +} void gui_mch_draw_string( @@ -2237,10 +6310,8 @@ gui_mch_draw_string( static int unibuflen = 0; int n = 0; #endif - HPEN hpen, old_pen; int y; -#ifndef MSWIN16_FASTTEXT /* * Italic and bold text seems to have an extra row of pixels at the bottom * (below where the bottom of the character should be). If we draw the @@ -2300,7 +6371,8 @@ gui_mch_draw_string( hbr = hbr_cache[brush_lru]; brush_lru = !brush_lru; } - FillRect(s_hdc, &rc, hbr); + + fill_rect(&rc, hbr, gui.currBgColor); SetBkMode(s_hdc, TRANSPARENT); @@ -2314,18 +6386,14 @@ gui_mch_draw_string( foptions = ETO_CLIPPED; } } -#else - /* - * The alternative would be to write the characters in opaque mode, but - * when the text is not exactly the same proportions as normal text, too - * big or too little a rectangle gets drawn for the background. - */ - SetBkMode(s_hdc, OPAQUE); - SetBkColor(s_hdc, gui.currBgColor); -#endif SetTextColor(s_hdc, gui.currFgColor); SelectFont(s_hdc, gui.currFont); +#ifdef FEAT_DIRECTX + if (IS_ENABLE_DIRECTX()) + DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); +#endif + if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) { vim_free(padding); @@ -2339,12 +6407,6 @@ gui_mch_draw_string( padding[i] = gui.char_width; } - /* On NT, tell the font renderer not to "help" us with Hebrew and Arabic - * text. This doesn't work in 9x, so we have to deal with it manually on - * those systems. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) - foptions |= ETO_IGNORELANGUAGE; - /* * We have to provide the padding argument because italic and bold versions * of fixed-width fonts are often one pixel or so wider than their normal @@ -2360,6 +6422,14 @@ gui_mch_draw_string( if (text[n] >= 0x80) break; +# if defined(FEAT_DIRECTX) + /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is + * required that unicode drawing routine, currently. So this forces it + * enabled. */ + if (IS_ENABLE_DIRECTX()) + n = 0; /* Keep n < len, to enter block for unicode. */ +# endif + /* Check if the Unicode buffer exists and is big enough. Create it * with the same length as the multi-byte string, the number of wide * characters is always equal or smaller. */ @@ -2379,8 +6449,8 @@ gui_mch_draw_string( if (enc_utf8 && n < len && unicodebuf != NULL) { - /* Output UTF-8 characters. Caller has already separated - * composing characters. */ + /* Output UTF-8 characters. Composing characters should be + * handled here. */ int i; int wlen; /* string length in words */ int clen; /* string length in characters */ @@ -2404,22 +6474,46 @@ gui_mch_draw_string( { unicodebuf[wlen++] = c; } - cw = utf_char2cells(c); - if (cw > 2) /* don't use 4 for unprintable char */ - cw = 1; + + if (utf_iscomposing(c)) + cw = 0; + else + { + cw = utf_char2cells(c); + if (cw > 2) /* don't use 4 for unprintable char */ + cw = 1; + } + if (unicodepdy != NULL) { /* Use unicodepdy to make characters fit as we expect, even * when the font uses different widths (e.g., bold character * is wider). */ - unicodepdy[clen] = cw * gui.char_width; + if (c >= 0x10000) + { + unicodepdy[wlen - 2] = cw * gui.char_width; + unicodepdy[wlen - 1] = 0; + } + else + unicodepdy[wlen - 1] = cw * gui.char_width; } cells += cw; - i += utfc_ptr2len_len(text + i, len - i); + i += utf_ptr2len_len(text + i, len - i); ++clen; } - ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), - foptions, pcliprect, unicodebuf, wlen, unicodepdy); +# if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + { + /* Add one to "cells" for italics. */ + DWriteContext_DrawText(s_dwc, unicodebuf, wlen, + TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), + gui.char_width, gui.currFgColor, + foptions, pcliprect, unicodepdy); + } + else +# endif + ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), + foptions, pcliprect, unicodebuf, wlen, unicodepdy); len = cells; /* used for underlining */ } else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) @@ -2462,10 +6556,9 @@ gui_mch_draw_string( #endif { #ifdef FEAT_RIGHTLEFT - /* If we can't use ETO_IGNORELANGUAGE, we can't tell Windows not to - * mess up RL text, so we have to draw it character-by-character. - * Only do this if RL is on, since it's slow. */ - if (curwin->w_p_rl && !(foptions & ETO_IGNORELANGUAGE)) + /* Windows will mess up RL text, so we have to draw it character by + * character. Only do this if RL is on, since it's slow. */ + if (curwin->w_p_rl) RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), foptions, pcliprect, (char *)text, len, padding); else @@ -2477,19 +6570,19 @@ gui_mch_draw_string( /* Underline */ if (flags & DRAW_UNDERL) { - hpen = CreatePen(PS_SOLID, 1, gui.currFgColor); - old_pen = SelectObject(s_hdc, hpen); /* When p_linespace is 0, overwrite the bottom row of pixels. * Otherwise put the line just below the character. */ y = FILL_Y(row + 1) - 1; -#ifndef MSWIN16_FASTTEXT if (p_linespace > 1) y -= p_linespace - 1; -#endif - MoveToEx(s_hdc, FILL_X(col), y, NULL); - /* Note: LineTo() excludes the last pixel in the line. */ - LineTo(s_hdc, FILL_X(col + len), y); - DeleteObject(SelectObject(s_hdc, old_pen)); + draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor); + } + + /* Strikethrough */ + if (flags & DRAW_STRIKE) + { + y = FILL_Y(row + 1) - gui.char_height/2; + draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currSpColor); } /* Undercurl */ @@ -2503,7 +6596,7 @@ gui_mch_draw_string( for (x = FILL_X(col); x < FILL_X(col + len); ++x) { offset = val[x % 8]; - SetPixel(s_hdc, x, y - offset, gui.currSpColor); + set_pixel(x, y - offset, gui.currSpColor); } } } @@ -2526,17 +6619,18 @@ gui_mch_flush(void) BOOL __stdcall GdiFlush(void); # endif +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + GdiFlush(); } static void clear_rect(RECT *rcp) { - HBRUSH hbr; - - hbr = CreateSolidBrush(gui.back_pixel); - FillRect(s_hdc, rcp, hbr); - DeleteBrush(hbr); + fill_rect(rcp, NULL, gui.back_pixel); } @@ -2549,15 +6643,16 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) *screen_w = workarea_rect.right - workarea_rect.left - (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + - get_caption_width_adjustment(); /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include * the menubar for MSwin, we subtract it from the screen height, so that * the window size can be made to fit on the screen. */ *screen_h = workarea_rect.bottom - workarea_rect.top - (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 - - GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + - get_caption_height() #ifdef FEAT_MENU - gui_mswin_get_menu_height(FALSE) #endif @@ -2581,63 +6676,50 @@ gui_mch_add_menu( if (menu_is_menubar(menu->name)) { - if (is_winnt_3()) - { - InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id, - (UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION, - (long_u)menu->submenu_id, (LPCTSTR) menu->name); - } - else - { #ifdef FEAT_MBYTE - WCHAR *wn = NULL; - int n; + WCHAR *wn = NULL; - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + /* 'encoding' differs from active codepage: convert menu name + * and use wide function */ + wn = enc_to_utf16(menu->name, NULL); + if (wn != NULL) { - /* 'encoding' differs from active codepage: convert menu name - * and use wide function */ - wn = enc_to_utf16(menu->name, NULL); - if (wn != NULL) - { - MENUITEMINFOW infow; - - infow.cbSize = sizeof(infow); - infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID - | MIIM_SUBMENU; - infow.dwItemData = (long_u)menu; - infow.wID = menu->id; - infow.fType = MFT_STRING; - infow.dwTypeData = wn; - infow.cch = (UINT)wcslen(wn); - infow.hSubMenu = menu->submenu_id; - n = InsertMenuItemW((parent == NULL) - ? s_menuBar : parent->submenu_id, - (UINT)pos, TRUE, &infow); - vim_free(wn); - if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - /* Failed, try using non-wide function. */ - wn = NULL; - } + MENUITEMINFOW infow; + + infow.cbSize = sizeof(infow); + infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID + | MIIM_SUBMENU; + infow.dwItemData = (long_u)menu; + infow.wID = menu->id; + infow.fType = MFT_STRING; + infow.dwTypeData = wn; + infow.cch = (UINT)wcslen(wn); + infow.hSubMenu = menu->submenu_id; + InsertMenuItemW((parent == NULL) + ? s_menuBar : parent->submenu_id, + (UINT)pos, TRUE, &infow); + vim_free(wn); } + } - if (wn == NULL) + if (wn == NULL) #endif - { - MENUITEMINFO info; - - info.cbSize = sizeof(info); - info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; - info.dwItemData = (long_u)menu; - info.wID = menu->id; - info.fType = MFT_STRING; - info.dwTypeData = (LPTSTR)menu->name; - info.cch = (UINT)STRLEN(menu->name); - info.hSubMenu = menu->submenu_id; - InsertMenuItem((parent == NULL) - ? s_menuBar : parent->submenu_id, - (UINT)pos, TRUE, &info); - } + { + MENUITEMINFO info; + + info.cbSize = sizeof(info); + info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; + info.dwItemData = (long_u)menu; + info.wID = menu->id; + info.fType = MFT_STRING; + info.dwTypeData = (LPTSTR)menu->name; + info.cch = (UINT)STRLEN(menu->name); + info.hSubMenu = menu->submenu_id; + InsertMenuItem((parent == NULL) + ? s_menuBar : parent->submenu_id, + (UINT)pos, TRUE, &info); } } @@ -2680,7 +6762,7 @@ gui_make_popup(char_u *path_name, int mouse_pos) } else if (curwin != NULL) { - p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); + p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1); p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); } msg_scroll = FALSE; @@ -2753,7 +6835,6 @@ gui_mch_add_menu_item( { #ifdef FEAT_MBYTE WCHAR *wn = NULL; - int n; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { @@ -2762,14 +6843,11 @@ gui_mch_add_menu_item( wn = enc_to_utf16(menu->name, NULL); if (wn != NULL) { - n = InsertMenuW(parent->submenu_id, (UINT)idx, + InsertMenuW(parent->submenu_id, (UINT)idx, (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, (UINT)menu->id, wn); vim_free(wn); - if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - /* Failed, try using non-wide function. */ - wn = NULL; } } if (wn == NULL) @@ -2842,7 +6920,7 @@ rebuild_tearoff(vimmenu_T *menu) HWND thwnd = menu->tearoff_handle; - GetWindowText(thwnd, tbuf, 127); + GetWindowText(thwnd, (LPSTR)tbuf, 127); if (GetWindowRect(thwnd, &trect) && GetWindowRect(s_hwnd, &rct) && GetClientRect(s_hwnd, &roct)) @@ -2888,10 +6966,8 @@ gui_mch_menu_grey( } else #endif - if (grey) - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_GRAYED); - else - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED); + (void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar, + menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); #ifdef FEAT_TEAROFF if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) @@ -2935,13 +7011,12 @@ gui_mch_menu_grey( * pressed, return that button's ID - IDCANCEL (2), which is the button's * number. */ -/*ARGSUSED*/ static LRESULT CALLBACK dialog_callback( HWND hwnd, UINT message, WPARAM wParam, - LPARAM lParam) + LPARAM lParam UNUSED) { if (message == WM_INITDIALOG) { @@ -2970,11 +7045,10 @@ dialog_callback( /* If the edit box exists, copy the string. */ if (s_textfield != NULL) { -# if defined(FEAT_MBYTE) && defined(WIN3264) +# ifdef FEAT_MBYTE /* If the OS is Windows NT, and 'encoding' differs from active * codepage: use wide function and convert text. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && enc_codepage >= 0 && (int)GetACP() != enc_codepage) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); char_u *p; @@ -2988,7 +7062,7 @@ dialog_callback( else # endif GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, - s_textfield, IOSIZE); + (LPSTR)s_textfield, IOSIZE); } /* @@ -3030,7 +7104,7 @@ dialog_callback( * If stubbing out this fn, return 1. */ -static const char_u *dlg_icons[] = /* must match names in resource file */ +static const char *dlg_icons[] = /* must match names in resource file */ { "IDR_VIM", "IDR_VIM_ERROR", @@ -3167,7 +7241,7 @@ gui_mch_dialog( fontHeight = fontInfo.tmHeight; /* Minimum width for horizontal button */ - minButtonWidth = GetTextWidth(hdc, "Cancel", 6); + minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); /* Maximum width of a dialog, if possible */ if (s_hwnd == NULL) @@ -3188,13 +7262,13 @@ gui_mch_dialog( GetWindowRect(s_hwnd, &rect); maxDialogWidth = rect.right - rect.left - (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; if (maxDialogWidth < DLG_MIN_MAX_WIDTH) maxDialogWidth = DLG_MIN_MAX_WIDTH; maxDialogHeight = rect.bottom - rect.top - (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 + GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 - GetSystemMetrics(SM_CYCAPTION); if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) maxDialogHeight = DLG_MIN_MAX_HEIGHT; @@ -3223,7 +7297,7 @@ gui_mch_dialog( #else l = 1; #endif - if (l == 1 && vim_iswhite(*pend) + if (l == 1 && VIM_ISWHITE(*pend) && textWidth > maxDialogWidth * 3 / 4) last_white = pend; textWidth += GetTextWidthEnc(hdc, pend, l); @@ -3351,11 +7425,11 @@ gui_mch_dialog( /* Restrict the size to a maximum. Causes a scrollbar to show up. */ if (dlgheight > maxDialogHeight) { - msgheight = msgheight - (dlgheight - maxDialogHeight); - dlgheight = maxDialogHeight; - scroll_flag = WS_VSCROLL; - /* Make sure scrollbar doesn't appear in the middle of the dialog */ - messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; + msgheight = msgheight - (dlgheight - maxDialogHeight); + dlgheight = maxDialogHeight; + scroll_flag = WS_VSCROLL; + /* Make sure scrollbar doesn't appear in the middle of the dialog */ + messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; } add_word(PixelToDialogY(dlgheight)); @@ -3364,9 +7438,8 @@ gui_mch_dialog( add_word(0); // Class /* copy the title of the dialog */ - nchar = nCopyAnsiToWideChar(p, (title ? - (LPSTR)title : - (LPSTR)("Vim "VIM_VERSION_MEDIUM))); + nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title + : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); p += nchar; if (s_usenewlook) @@ -3378,13 +7451,13 @@ gui_mch_dialog( /* point size */ *p++ = -MulDiv(lfSysmenu.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); - nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); + nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE); } else #endif { *p++ = DLG_FONT_POINT_SIZE; // point size - nchar = nCopyAnsiToWideChar(p, TEXT(DLG_FONT_NAME)); + nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); } p += nchar; } @@ -3431,7 +7504,7 @@ gui_mch_dialog( + 2 * fontHeight * i), PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), (WORD)(PixelToDialogY(2 * fontHeight) - 1), - (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart); + (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); } else { @@ -3442,7 +7515,7 @@ gui_mch_dialog( PixelToDialogY(buttonYpos), /* TBK */ PixelToDialogX(buttonWidths[i]), (WORD)(PixelToDialogY(2 * fontHeight) - 1), - (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart); + (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); } pstart = pend + 1; /*next button*/ } @@ -3463,7 +7536,7 @@ gui_mch_dialog( PixelToDialogY(dlgPaddingY), (WORD)(PixelToDialogX(messageWidth) + 1), PixelToDialogY(msgheight), - DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, message); + DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); /* Edit box */ if (textfield != NULL) @@ -3473,7 +7546,7 @@ gui_mch_dialog( PixelToDialogY(2 * dlgPaddingY + msgheight), PixelToDialogX(dlgwidth - 4 * dlgPaddingX), PixelToDialogY(fontHeight + dlgPaddingY), - DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, textfield); + DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); *pnumitems += 1; } @@ -3565,7 +7638,7 @@ add_dialog_element( *p++ = (WORD)0xffff; *p++ = clss; //2 more here - nchar = nCopyAnsiToWideChar(p, (LPSTR)caption); //strlen(caption)+1 + nchar = nCopyAnsiToWideChar(p, (LPSTR)caption, TRUE); //strlen(caption)+1 p += nchar; *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more @@ -3597,11 +7670,13 @@ lpwAlign( * parameter as wide character (16-bits / char) string, and returns integer * number of wide characters (words) in string (including the trailing wide * char NULL). Partly taken from the Win32SDK samples. - */ + * If "use_enc" is TRUE, 'encoding' is used for "lpAnsiIn". If FALSE, current + * ACP is used for "lpAnsiIn". */ static int nCopyAnsiToWideChar( LPWORD lpWCStr, - LPSTR lpAnsiIn) + LPSTR lpAnsiIn, + BOOL use_enc) { int nChar = 0; #ifdef FEAT_MBYTE @@ -3609,10 +7684,10 @@ nCopyAnsiToWideChar( int i; WCHAR *wn; - if (enc_codepage == 0 && (int)GetACP() != enc_codepage) + if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) { /* Not a codepage, use our own conversion function. */ - wn = enc_to_utf16(lpAnsiIn, NULL); + wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); if (wn != NULL) { wcscpy(lpWCStr, wn); @@ -3646,6 +7721,26 @@ nCopyAnsiToWideChar( #ifdef FEAT_TEAROFF +/* + * Lookup menu handle from "menu_id". + */ + static HMENU +tearoff_lookup_menuhandle( + vimmenu_T *menu, + WORD menu_id) +{ + for ( ; menu != NULL; menu = menu->next) + { + if (menu->modes == 0) /* this menu has just been deleted */ + continue; + if (menu_is_separator(menu->dname)) + continue; + if ((WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000) == menu_id) + return menu->submenu_id; + } + return NULL; +} + /* * The callback function for all the modeless dialogs that make up the * "tearoff menus" Very simple - forward button presses (to fool Vim into @@ -3659,7 +7754,10 @@ tearoff_callback( LPARAM lParam) { if (message == WM_INITDIALOG) + { + SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); return (TRUE); + } /* May show the mouse pointer again. */ HandleMouseHide(message, lParam); @@ -3673,8 +7771,11 @@ tearoff_callback( if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) { + vimmenu_T *menu; + + menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); (void)TrackPopupMenu( - (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), + tearoff_lookup_menuhandle(menu, LOWORD(wParam)), TPM_LEFTALIGN | TPM_LEFTBUTTON, (int)rect.right - 8, (int)mp.y, @@ -3731,38 +7832,31 @@ get_dialog_font_metrics(void) s_usenewlook = FALSE; - /* - * For NT3.51 and Win32s, we stick with the old look - * because it matches everything else. - */ - if (!is_winnt_3()) - { #ifdef USE_SYSMENU_FONT - if (gui_w32_get_menu_font(&lfSysmenu) == OK) - hfontTools = CreateFontIndirect(&lfSysmenu); - else + if (gui_w32_get_menu_font(&lfSysmenu) == OK) + hfontTools = CreateFontIndirect(&lfSysmenu); + else #endif hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME); - if (hfontTools) - { - hdc = GetDC(s_hwnd); - SelectObject(hdc, hfontTools); - /* - * GetTextMetrics() doesn't return the right value in - * tmAveCharWidth, so we have to figure out the dialog base units - * ourselves. - */ - GetTextExtentPoint(hdc, - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", - 52, &size); - ReleaseDC(s_hwnd, hdc); - - s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); - s_dlgfntheight = (WORD)size.cy; - s_usenewlook = TRUE; - } + if (hfontTools) + { + hdc = GetDC(s_hwnd); + SelectObject(hdc, hfontTools); + /* + * GetTextMetrics() doesn't return the right value in + * tmAveCharWidth, so we have to figure out the dialog base units + * ourselves. + */ + GetTextExtentPoint(hdc, + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", + 52, &size); + ReleaseDC(s_hwnd, hdc); + + s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); + s_dlgfntheight = (WORD)size.cy; + s_usenewlook = TRUE; } if (!s_usenewlook) @@ -3793,6 +7887,7 @@ gui_mch_tearoff( WORD dlgwidth; WORD menuID; vimmenu_T *pmenu; + vimmenu_T *top_menu; vimmenu_T *the_menu = menu; HWND hwnd; HDC hdc; @@ -3857,7 +7952,7 @@ gui_mch_tearoff( /* Calculate width of a single space. Used for padding columns to the * right width. */ - spaceWidth = GetTextWidth(hdc, " ", 1); + spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); /* Figure out max width of the text column, the accelerator column and the * optional submenu column. */ @@ -3900,7 +7995,7 @@ gui_mch_tearoff( textWidth = columnWidths[0] + columnWidths[1]; if (submenuWidth != 0) { - submenuWidth = GetTextWidth(hdc, TEAROFF_SUBMENU_LABEL, + submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, (int)STRLEN(TEAROFF_SUBMENU_LABEL)); textWidth += submenuWidth; } @@ -3909,10 +8004,6 @@ gui_mch_tearoff( dlgwidth = textWidth; dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; - /* W95 can't do thin dialogs, they look v. weird! */ - if (mch_windows95() && dlgwidth < TEAROFF_MIN_WIDTH) - dlgwidth = TEAROFF_MIN_WIDTH; - /* start to fill in the dlgtemplate information. addressing by WORDs */ if (s_usenewlook) lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; @@ -3943,8 +8034,8 @@ gui_mch_tearoff( /* copy the title of the dialog */ nchar = nCopyAnsiToWideChar(p, ((*title) - ? (LPSTR)title - : (LPSTR)("Vim "VIM_VERSION_MEDIUM))); + ? (LPSTR)title + : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); p += nchar; if (s_usenewlook) @@ -3956,13 +8047,13 @@ gui_mch_tearoff( /* point size */ *p++ = -MulDiv(lfSysmenu.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); - nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); + nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE); } else #endif { *p++ = DLG_FONT_POINT_SIZE; // point size - nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME)); + nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); } p += nchar; } @@ -3975,6 +8066,7 @@ gui_mch_tearoff( menu = menu->children->next; else menu = menu->children; + top_menu = menu; for ( ; menu != NULL; menu = menu->next) { if (menu->modes == 0) /* this menu has just been deleted */ @@ -4076,7 +8168,7 @@ gui_mch_tearoff( (WORD)(sepPadding + 1 + 13 * (*pnumitems)), (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), (WORD)12, - menuID, (WORD)0x0080, label); + menuID, (WORD)0x0080, (char *)label); vim_free(label); (*pnumitems)++; } @@ -4085,11 +8177,12 @@ gui_mch_tearoff( /* show modelessly */ - the_menu->tearoff_handle = CreateDialogIndirect( + the_menu->tearoff_handle = CreateDialogIndirectParam( s_hinst, (LPDLGTEMPLATE)pdlgtemplate, s_hwnd, - (DLGPROC)tearoff_callback); + (DLGPROC)tearoff_callback, + (LPARAM)top_menu); LocalFree(LocalHandle(pdlgtemplate)); SelectFont(hdc, oldFont); @@ -4164,7 +8257,7 @@ get_toolbar_bitmap(vimmenu_T *menu) /* * Check user bitmaps first, unless builtin is specified. */ - if (!is_winnt_3() && !menu->icon_builtin) + if (!menu->icon_builtin) { char_u fname[MAXPATHL]; HANDLE hbitmap = NULL; @@ -4174,7 +8267,7 @@ get_toolbar_bitmap(vimmenu_T *menu) gui_find_iconfile(menu->iconfile, fname, "bmp"); hbitmap = LoadImage( NULL, - fname, + (LPCSTR)fname, IMAGE_BITMAP, TOOLBAR_BUTTON_WIDTH, TOOLBAR_BUTTON_HEIGHT, @@ -4195,7 +8288,7 @@ get_toolbar_bitmap(vimmenu_T *menu) menu->dname, fname, "bmp") == OK)) hbitmap = LoadImage( NULL, - fname, + (LPCSTR)fname, IMAGE_BITMAP, TOOLBAR_BUTTON_WIDTH, TOOLBAR_BUTTON_HEIGHT, @@ -4241,6 +8334,34 @@ initialise_tabline(void) # endif } +/* + * Get tabpage_T from POINT. + */ + static tabpage_T * +GetTabFromPoint( + HWND hWnd, + POINT pt) +{ + tabpage_T *ptp = NULL; + + if (gui_mch_showing_tabline()) + { + TCHITTESTINFO htinfo; + htinfo.pt = pt; + /* ignore if a window under cusor is not tabcontrol. */ + if (s_tabhwnd == hWnd) + { + int idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx != -1) + ptp = find_tabpage(idx + 1); + } + } + return ptp; +} + +static POINT s_pt = {0, 0}; +static HCURSOR s_hCursor = NULL; + static LRESULT CALLBACK tabline_wndproc( HWND hwnd, @@ -4248,7 +8369,73 @@ tabline_wndproc( WPARAM wParam, LPARAM lParam) { + POINT pt; + tabpage_T *tp; + RECT rect; + int nCenter; + int idx0; + int idx1; + HandleMouseHide(uMsg, lParam); + + switch (uMsg) + { + case WM_LBUTTONDOWN: + { + s_pt.x = GET_X_LPARAM(lParam); + s_pt.y = GET_Y_LPARAM(lParam); + SetCapture(hwnd); + s_hCursor = GetCursor(); /* backup default cursor */ + break; + } + case WM_MOUSEMOVE: + if (GetCapture() == hwnd + && ((wParam & MK_LBUTTON)) != 0) + { + pt.x = GET_X_LPARAM(lParam); + pt.y = s_pt.y; + if (abs(pt.x - s_pt.x) > GetSystemMetrics(SM_CXDRAG)) + { + SetCursor(LoadCursor(NULL, IDC_SIZEWE)); + + tp = GetTabFromPoint(hwnd, pt); + if (tp != NULL) + { + idx0 = tabpage_index(curtab) - 1; + idx1 = tabpage_index(tp) - 1; + + TabCtrl_GetItemRect(hwnd, idx1, &rect); + nCenter = rect.left + (rect.right - rect.left) / 2; + + /* Check if the mouse cursor goes over the center of + * the next tab to prevent "flickering". */ + if ((idx0 < idx1) && (nCenter < pt.x)) + { + tabpage_move(idx1 + 1); + update_screen(0); + } + else if ((idx1 < idx0) && (pt.x < nCenter)) + { + tabpage_move(idx1); + update_screen(0); + } + } + } + } + break; + case WM_LBUTTONUP: + { + if (GetCapture() == hwnd) + { + SetCursor(s_hCursor); + ReleaseCapture(); + } + break; + } + default: + break; + } + return CallWindowProc(s_tabline_wndproc, hwnd, uMsg, wParam, lParam); } #endif @@ -4339,10 +8526,7 @@ typedef struct _signicon_t } signicon_t; void -gui_mch_drawsign(row, col, typenr) - int row; - int col; - int typenr; +gui_mch_drawsign(int row, int col, int typenr) { signicon_t *sign; int x, y, w, h; @@ -4350,6 +8534,11 @@ gui_mch_drawsign(row, col, typenr) if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) return; +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + x = TEXT_X(col); y = TEXT_Y(row); w = gui.char_width * 2; @@ -4419,18 +8608,11 @@ close_signicon_image(signicon_t *sign) } void * -gui_mch_register_sign(signfile) - char_u *signfile; +gui_mch_register_sign(char_u *signfile) { signicon_t sign, *psign; char_u *ext; - if (is_winnt_3()) - { - EMSG(_(e_signdata)); - return NULL; - } - sign.hImage = NULL; ext = signfile + STRLEN(signfile) - 4; /* get extension */ if (ext > signfile) @@ -4447,14 +8629,15 @@ gui_mch_register_sign(signfile) do_load = 0; if (do_load) - sign.hImage = (HANDLE)LoadImage(NULL, signfile, sign.uType, + sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, gui.char_width * 2, gui.char_height, LR_LOADFROMFILE | LR_CREATEDIBSECTION); #ifdef FEAT_XPM_W32 if (!STRICMP(ext, ".xpm")) { sign.uType = IMAGE_XPM; - LoadXpmImage(signfile, (HBITMAP *)&sign.hImage, (HBITMAP *)&sign.hShape); + LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, + (HBITMAP *)&sign.hShape); } #endif } @@ -4475,8 +8658,7 @@ gui_mch_register_sign(signfile) } void -gui_mch_destroy_sign(sign) - void *sign; +gui_mch_destroy_sign(void *sign) { if (sign) { @@ -4486,12 +8668,12 @@ gui_mch_destroy_sign(sign) } #endif -#if defined(FEAT_BEVAL) || defined(PROTO) +#if defined(FEAT_BEVAL_GUI) || defined(PROTO) /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. * Added by Sergey Khorev <sergey.khorev@gmail.com> * - * The only reused thing is gui_beval.h and get_beval_info() + * The only reused thing is beval.h and get_beval_info() * from gui_beval.c (note it uses x and y of the BalloonEval struct * to get current mouse position). * @@ -4559,13 +8741,13 @@ multiline_balloon_available(void) UINT vlen = 0; void *data = alloc(len); - if (data != NULL + if ((data != NULL && GetFileVersionInfo(comctl_dll, 0, len, data) && VerQueryValue(data, "\\", (void **)&ver, &vlen) && vlen - && HIWORD(ver->dwFileVersionMS) > 4 - || (HIWORD(ver->dwFileVersionMS) == 4 - && LOWORD(ver->dwFileVersionMS) >= 70)) + && HIWORD(ver->dwFileVersionMS) > 4) + || ((HIWORD(ver->dwFileVersionMS) == 4 + && LOWORD(ver->dwFileVersionMS) >= 70))) { vim_free(data); multiline_tip = TRUE; @@ -4580,10 +8762,7 @@ multiline_balloon_available(void) } static void -make_tooltip(beval, text, pt) - BalloonEval *beval; - char *text; - POINT pt; +make_tooltip(BalloonEval *beval, char *text, POINT pt) { TOOLINFO *pti; int ToolInfoSize; @@ -4647,19 +8826,17 @@ make_tooltip(beval, text, pt) } static void -delete_tooltip(beval) - BalloonEval *beval; +delete_tooltip(BalloonEval *beval) { - DestroyWindow(beval->balloon); + PostMessage(beval->balloon, WM_CLOSE, 0, 0); } -/*ARGSUSED*/ static VOID CALLBACK -BevalTimerProc(hwnd, uMsg, idEvent, dwTime) - HWND hwnd; - UINT uMsg; - UINT_PTR idEvent; - DWORD dwTime; +BevalTimerProc( + HWND hwnd UNUSED, + UINT uMsg UNUSED, + UINT_PTR idEvent UNUSED, + DWORD dwTime) { POINT pt; RECT rect; @@ -4695,20 +8872,16 @@ BevalTimerProc(hwnd, uMsg, idEvent, dwTime) } } -/*ARGSUSED*/ void -gui_mch_disable_beval_area(beval) - BalloonEval *beval; +gui_mch_disable_beval_area(BalloonEval *beval UNUSED) { // TRACE0("gui_mch_disable_beval_area {{{"); KillTimer(s_textArea, BevalTimerId); // TRACE0("gui_mch_disable_beval_area }}}"); } -/*ARGSUSED*/ void -gui_mch_enable_beval_area(beval) - BalloonEval *beval; +gui_mch_enable_beval_area(BalloonEval *beval) { // TRACE0("gui_mch_enable_beval_area |||"); if (beval == NULL) @@ -4719,11 +8892,10 @@ gui_mch_enable_beval_area(beval) } void -gui_mch_post_balloon(beval, mesg) - BalloonEval *beval; - char_u *mesg; +gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { POINT pt; + // TRACE0("gui_mch_post_balloon {{{"); if (beval->showState == ShS_SHOWING) return; @@ -4731,29 +8903,28 @@ gui_mch_post_balloon(beval, mesg) ScreenToClient(s_textArea, &pt); if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) - /* cursor is still here */ { + /* cursor is still here */ gui_mch_disable_beval_area(cur_beval); beval->showState = ShS_SHOWING; - make_tooltip(beval, mesg, pt); + make_tooltip(beval, (char *)mesg, pt); } // TRACE0("gui_mch_post_balloon }}}"); } -/*ARGSUSED*/ BalloonEval * -gui_mch_create_beval_area(target, mesg, mesgCB, clientData) - void *target; /* ignored, always use s_textArea */ - char_u *mesg; - void (*mesgCB)__ARGS((BalloonEval *, int)); - void *clientData; +gui_mch_create_beval_area( + void *target, /* ignored, always use s_textArea */ + char_u *mesg, + void (*mesgCB)(BalloonEval *, int), + void *clientData) { /* partially stolen from gui_beval.c */ BalloonEval *beval; if (mesg != NULL && mesgCB != NULL) { - EMSG(_("E232: Cannot create BalloonEval with both message and callback")); + IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } @@ -4780,9 +8951,8 @@ gui_mch_create_beval_area(target, mesg, mesgCB, clientData) return beval; } -/*ARGSUSED*/ static void -Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh) +Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) { if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ return; @@ -4824,12 +8994,11 @@ TrackUserActivity(UINT uMsg) } void -gui_mch_destroy_beval_area(beval) - BalloonEval *beval; +gui_mch_destroy_beval_area(BalloonEval *beval) { vim_free(beval); } -#endif /* FEAT_BEVAL */ +#endif /* FEAT_BEVAL_GUI */ #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) /* @@ -4849,6 +9018,11 @@ netbeans_draw_multisign_indicator(int row) x = 0; y = TEXT_Y(row); +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_Flush(s_dwc); +#endif + for (i = 0; i < gui.char_height - 3; i++) SetPixel(s_hdc, x+2, y++, gui.currFgColor); @@ -4860,21 +9034,55 @@ netbeans_draw_multisign_indicator(int row) SetPixel(s_hdc, x+3, y++, gui.currFgColor); SetPixel(s_hdc, x+2, y, gui.currFgColor); } +#endif -/* - * Initialize the Winsock dll. - */ - void -netbeans_init_winsock() +#ifdef USE_AMBIWIDTH_AUTO +#define CHARWIDE_CACHESIZE 65536 +static GuiFont last_font = 0; + + int +gui_mch_get_charwidth(int c) { - WSADATA wsaData; - int wsaerr; + static char cache[CHARWIDE_CACHESIZE]; + GuiFont usingfont = gui.wide_font ? gui.wide_font : gui.norm_font; - if (WSInitialized) - return; + /* Check validity of charwide cache */ + if (last_font != usingfont) + { + /* Update cache. -1 is mark for uninitialized cell */ + TRACE("Charwide cache will be updated (base=%d)\n", gui.char_width); + last_font = usingfont; + memset(cache, -1, sizeof(cache)); + } + if (usingfont && 0 <= c && c < CHARWIDE_CACHESIZE) + { + if (cache[c] >= 0) + return cache[c]; /* Use cached value */ + else + { + /* + * Get true character width in dot, convert to cells and save + * it. + */ + int len; + ABC fontABC; + HFONT hfntOld = SelectFont(s_hdc, usingfont); - wsaerr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (wsaerr == 0) - WSInitialized = TRUE; + if (!GetCharABCWidthsW(s_hdc, c, c, &fontABC) || + (len = fontABC.abcA + fontABC.abcB + fontABC.abcC) <= 0) + { + TRACE("GetCharABCWidthsW() failed for %08X\n", c); + cache[c] = 0; + } + else + cache[c] = (char)((len + (gui.char_width >> 1)) + / gui.char_width); + SelectFont(s_hdc, hfntOld); + + return cache[c]; + } + } + else + return 0; } #endif diff --git a/src/gui_w48.c b/src/gui_w48.c deleted file mode 100644 index 89b60908e5..0000000000 --- a/src/gui_w48.c +++ /dev/null @@ -1,4021 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * GUI support by Robert Webb - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ -/* - * gui_w48.c: This file is included in gui_w16.c and gui_w32.c. - * - * GUI support for Microsoft Windows (Win16 + Win32 = Win48 :-) - * - * The combined efforts of: - * George V. Reilly <george@reilly.org> - * Robert Webb - * Vince Negri - * ...and contributions from many others - * - */ - -#include "vim.h" -#include "version.h" /* used by dialog box routine for default title */ -#ifdef DEBUG -# include <tchar.h> -#endif - -/* cproto fails on missing include files */ -#ifndef PROTO - -#ifndef __MINGW32__ -# include <shellapi.h> -#endif -#if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL) || defined(FEAT_GUI_TABLINE) -# include <commctrl.h> -#endif -#ifdef WIN16 -# include <commdlg.h> -# include <shellapi.h> -# ifdef WIN16_3DLOOK -# include <ctl3d.h> -# endif -#endif -#include <windowsx.h> - -#ifdef GLOBAL_IME -# include "glbl_ime.h" -#endif - -#endif /* PROTO */ - -#ifdef FEAT_MENU -# define MENUHINTS /* show menu hints in command line */ -#endif - -/* Some parameters for dialog boxes. All in pixels. */ -#define DLG_PADDING_X 10 -#define DLG_PADDING_Y 10 -#define DLG_OLD_STYLE_PADDING_X 5 -#define DLG_OLD_STYLE_PADDING_Y 5 -#define DLG_VERT_PADDING_X 4 /* For vertical buttons */ -#define DLG_VERT_PADDING_Y 4 -#define DLG_ICON_WIDTH 34 -#define DLG_ICON_HEIGHT 34 -#define DLG_MIN_WIDTH 150 -#define DLG_FONT_NAME "MS Sans Serif" -#define DLG_FONT_POINT_SIZE 8 -#define DLG_MIN_MAX_WIDTH 400 -#define DLG_MIN_MAX_HEIGHT 400 - -#define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */ - -#ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */ -# define WM_XBUTTONDOWN 0x020B -# define WM_XBUTTONUP 0x020C -# define WM_XBUTTONDBLCLK 0x020D -# define MK_XBUTTON1 0x0020 -# define MK_XBUTTON2 0x0040 -#endif - -#ifdef PROTO -/* - * Define a few things for generating prototypes. This is just to avoid - * syntax errors, the defines do not need to be correct. - */ -# define APIENTRY -# define CALLBACK -# define CONST -# define FAR -# define NEAR -# define _cdecl -typedef int BOOL; -typedef int BYTE; -typedef int DWORD; -typedef int WCHAR; -typedef int ENUMLOGFONT; -typedef int FINDREPLACE; -typedef int HANDLE; -typedef int HBITMAP; -typedef int HBRUSH; -typedef int HDROP; -typedef int INT; -typedef int LOGFONT[]; -typedef int LPARAM; -typedef int LPCREATESTRUCT; -typedef int LPCSTR; -typedef int LPCTSTR; -typedef int LPRECT; -typedef int LPSTR; -typedef int LPWINDOWPOS; -typedef int LPWORD; -typedef int LRESULT; -typedef int HRESULT; -# undef MSG -typedef int MSG; -typedef int NEWTEXTMETRIC; -typedef int OSVERSIONINFO; -typedef int PWORD; -typedef int RECT; -typedef int UINT; -typedef int WORD; -typedef int WPARAM; -typedef int POINT; -typedef void *HINSTANCE; -typedef void *HMENU; -typedef void *HWND; -typedef void *HDC; -typedef void VOID; -typedef int LPNMHDR; -typedef int LONG; -typedef int WNDPROC; -#endif - -#ifndef GET_X_LPARAM -# define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) -#endif - -static void _OnPaint( HWND hwnd); -static void clear_rect(RECT *rcp); -static int gui_mswin_get_menu_height(int fix_window); - -static WORD s_dlgfntheight; /* height of the dialog font */ -static WORD s_dlgfntwidth; /* width of the dialog font */ - -#ifdef FEAT_MENU -static HMENU s_menuBar = NULL; -#endif -#ifdef FEAT_TEAROFF -static void rebuild_tearoff(vimmenu_T *menu); -static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */ -#endif - -/* Flag that is set while processing a message that must not be interrupted by - * processing another message. */ -static int s_busy_processing = FALSE; - -static int destroying = FALSE; /* call DestroyWindow() ourselves */ - -#ifdef MSWIN_FIND_REPLACE -static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ -static FINDREPLACE s_findrep_struct; -# if defined(FEAT_MBYTE) && defined(WIN3264) -static FINDREPLACEW s_findrep_struct_w; -# endif -static HWND s_findrep_hwnd = NULL; -static int s_findrep_is_find; /* TRUE for find dialog, FALSE - for find/replace dialog */ -#endif - -static HINSTANCE s_hinst = NULL; -#if !defined(FEAT_SNIFF) && !defined(FEAT_GUI) -static -#endif -HWND s_hwnd = NULL; -static HDC s_hdc = NULL; -static HBRUSH s_brush = NULL; - -#ifdef FEAT_TOOLBAR -static HWND s_toolbarhwnd = NULL; -static WNDPROC s_toolbar_wndproc = NULL; -#endif - -#ifdef FEAT_GUI_TABLINE -static HWND s_tabhwnd = NULL; -static WNDPROC s_tabline_wndproc = NULL; -static int showing_tabline = 0; -#endif - -static WPARAM s_wParam = 0; -static LPARAM s_lParam = 0; - -static HWND s_textArea = NULL; -static UINT s_uMsg = 0; - -static char_u *s_textfield; /* Used by dialogs to pass back strings */ - -static int s_need_activate = FALSE; - -/* This variable is set when waiting for an event, which is the only moment - * scrollbar dragging can be done directly. It's not allowed while commands - * are executed, because it may move the cursor and that may cause unexpected - * problems (e.g., while ":s" is working). - */ -static int allow_scrollbar = FALSE; - -#ifdef GLOBAL_IME -# define MyTranslateMessage(x) global_ime_TranslateMessage(x) -#else -# define MyTranslateMessage(x) TranslateMessage(x) -#endif - -#if (defined(WIN3264) && defined(FEAT_MBYTE)) || defined(GLOBAL_IME) - /* use of WindowProc depends on wide_WindowProc */ -# define MyWindowProc vim_WindowProc -#else - /* use ordinary WindowProc */ -# define MyWindowProc DefWindowProc -#endif - -extern int current_font_height; /* this is in os_mswin.c */ - -static struct -{ - UINT key_sym; - char_u vim_code0; - char_u vim_code1; -} special_keys[] = -{ - {VK_UP, 'k', 'u'}, - {VK_DOWN, 'k', 'd'}, - {VK_LEFT, 'k', 'l'}, - {VK_RIGHT, 'k', 'r'}, - - {VK_F1, 'k', '1'}, - {VK_F2, 'k', '2'}, - {VK_F3, 'k', '3'}, - {VK_F4, 'k', '4'}, - {VK_F5, 'k', '5'}, - {VK_F6, 'k', '6'}, - {VK_F7, 'k', '7'}, - {VK_F8, 'k', '8'}, - {VK_F9, 'k', '9'}, - {VK_F10, 'k', ';'}, - - {VK_F11, 'F', '1'}, - {VK_F12, 'F', '2'}, - {VK_F13, 'F', '3'}, - {VK_F14, 'F', '4'}, - {VK_F15, 'F', '5'}, - {VK_F16, 'F', '6'}, - {VK_F17, 'F', '7'}, - {VK_F18, 'F', '8'}, - {VK_F19, 'F', '9'}, - {VK_F20, 'F', 'A'}, - - {VK_F21, 'F', 'B'}, -#ifdef FEAT_NETBEANS_INTG - {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */ -#endif - {VK_F22, 'F', 'C'}, - {VK_F23, 'F', 'D'}, - {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */ - - {VK_HELP, '%', '1'}, - {VK_BACK, 'k', 'b'}, - {VK_INSERT, 'k', 'I'}, - {VK_DELETE, 'k', 'D'}, - {VK_HOME, 'k', 'h'}, - {VK_END, '@', '7'}, - {VK_PRIOR, 'k', 'P'}, - {VK_NEXT, 'k', 'N'}, - {VK_PRINT, '%', '9'}, - {VK_ADD, 'K', '6'}, - {VK_SUBTRACT, 'K', '7'}, - {VK_DIVIDE, 'K', '8'}, - {VK_MULTIPLY, 'K', '9'}, - {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ - {VK_DECIMAL, 'K', 'B'}, - - {VK_NUMPAD0, 'K', 'C'}, - {VK_NUMPAD1, 'K', 'D'}, - {VK_NUMPAD2, 'K', 'E'}, - {VK_NUMPAD3, 'K', 'F'}, - {VK_NUMPAD4, 'K', 'G'}, - {VK_NUMPAD5, 'K', 'H'}, - {VK_NUMPAD6, 'K', 'I'}, - {VK_NUMPAD7, 'K', 'J'}, - {VK_NUMPAD8, 'K', 'K'}, - {VK_NUMPAD9, 'K', 'L'}, - - /* Keys that we want to be able to use any modifier with: */ - {VK_SPACE, ' ', NUL}, - {VK_TAB, TAB, NUL}, - {VK_ESCAPE, ESC, NUL}, - {NL, NL, NUL}, - {CAR, CAR, NUL}, - - /* End of list marker: */ - {0, 0, 0} -}; - -/* Local variables */ -static int s_button_pending = -1; - -/* s_getting_focus is set when we got focus but didn't see mouse-up event yet, - * so don't reset s_button_pending. */ -static int s_getting_focus = FALSE; - -static int s_x_pending; -static int s_y_pending; -static UINT s_kFlags_pending; -static UINT s_wait_timer = 0; /* Timer for get char from user */ -static int s_timed_out = FALSE; -static int dead_key = 0; /* 0 - no dead key, 1 - dead key pressed */ - -#ifdef WIN3264 -static OSVERSIONINFO os_version; /* like it says. Init in gui_mch_init() */ -#endif - -#ifdef FEAT_BEVAL -/* balloon-eval WM_NOTIFY_HANDLER */ -static void Handle_WM_Notify __ARGS((HWND hwnd, LPNMHDR pnmh)); -static void TrackUserActivity __ARGS((UINT uMsg)); -#endif - -/* - * For control IME. - * - * These LOGFONT used for IME. - */ -#ifdef FEAT_MBYTE -# ifdef USE_IM_CONTROL -/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */ -static LOGFONT norm_logfont; -/* holds LOGFONT for 'guifont' always. */ -static LOGFONT sub_logfont; -# endif -#endif - -#ifdef FEAT_MBYTE_IME -static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData); -#endif - -#if defined(FEAT_MBYTE) && defined(WIN3264) -static char_u *convert_filter(char_u *s); -#endif - -#ifdef DEBUG_PRINT_ERROR -/* - * Print out the last Windows error message - */ - static void -print_windows_error(void) -{ - LPVOID lpMsgBuf; - - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, 0, NULL); - TRACE1("Error: %s\n", lpMsgBuf); - LocalFree(lpMsgBuf); -} -#endif - -/* - * Cursor blink functions. - * - * This is a simple state machine: - * BLINK_NONE not blinking at all - * BLINK_OFF blinking, cursor is not shown - * BLINK_ON blinking, cursor is shown - */ - -#define BLINK_NONE 0 -#define BLINK_OFF 1 -#define BLINK_ON 2 - -static int blink_state = BLINK_NONE; -static long_u blink_waittime = 700; -static long_u blink_ontime = 400; -static long_u blink_offtime = 250; -static UINT blink_timer = 0; - - void -gui_mch_set_blinking(long wait, long on, long off) -{ - blink_waittime = wait; - blink_ontime = on; - blink_offtime = off; -} - -/* ARGSUSED */ - static VOID CALLBACK -_OnBlinkTimer( - HWND hwnd, - UINT uMsg, - UINT idEvent, - DWORD dwTime) -{ - MSG msg; - - /* - TRACE2("Got timer event, id %d, blink_timer %d\n", idEvent, blink_timer); - */ - - KillTimer(NULL, idEvent); - - /* Eat spurious WM_TIMER messages */ - while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) - ; - - if (blink_state == BLINK_ON) - { - gui_undraw_cursor(); - blink_state = BLINK_OFF; - blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_offtime, - (TIMERPROC)_OnBlinkTimer); - } - else - { - gui_update_cursor(TRUE, FALSE); - blink_state = BLINK_ON; - blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, - (TIMERPROC)_OnBlinkTimer); - } -} - - static void -gui_mswin_rm_blink_timer(void) -{ - MSG msg; - - if (blink_timer != 0) - { - KillTimer(NULL, blink_timer); - /* Eat spurious WM_TIMER messages */ - while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) - ; - blink_timer = 0; - } -} - -/* - * Stop the cursor blinking. Show the cursor if it wasn't shown. - */ - void -gui_mch_stop_blink(void) -{ - gui_mswin_rm_blink_timer(); - if (blink_state == BLINK_OFF) - gui_update_cursor(TRUE, FALSE); - blink_state = BLINK_NONE; -} - -/* - * Start the cursor blinking. If it was already blinking, this restarts the - * waiting time and shows the cursor. - */ - void -gui_mch_start_blink(void) -{ - gui_mswin_rm_blink_timer(); - - /* Only switch blinking on if none of the times is zero */ - if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) - { - blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime, - (TIMERPROC)_OnBlinkTimer); - blink_state = BLINK_ON; - gui_update_cursor(TRUE, FALSE); - } -} - -/* - * Call-back routines. - */ - -/*ARGSUSED*/ - static VOID CALLBACK -_OnTimer( - HWND hwnd, - UINT uMsg, - UINT idEvent, - DWORD dwTime) -{ - MSG msg; - - /* - TRACE2("Got timer event, id %d, s_wait_timer %d\n", idEvent, s_wait_timer); - */ - KillTimer(NULL, idEvent); - s_timed_out = TRUE; - - /* Eat spurious WM_TIMER messages */ - while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) - ; - if (idEvent == s_wait_timer) - s_wait_timer = 0; -} - -/*ARGSUSED*/ - static void -_OnDeadChar( - HWND hwnd, - UINT ch, - int cRepeat) -{ - dead_key = 1; -} - -/* - * Convert Unicode character "ch" to bytes in "string[slen]". - * When "had_alt" is TRUE the ALT key was included in "ch". - * Return the length. - */ - static int -char_to_string(int ch, char_u *string, int slen, int had_alt) -{ - int len; - int i; -#ifdef FEAT_MBYTE - WCHAR wstring[2]; - char_u *ws = NULL;; - - if (os_version.dwPlatformId != VER_PLATFORM_WIN32_NT) - { - /* On Windows 95/98 we apparently get the character in the active - * codepage, not in UCS-2. If conversion is needed convert it to - * UCS-2 first. */ - if ((int)GetACP() == enc_codepage) - len = 0; /* no conversion required */ - else - { - string[0] = ch; - len = MultiByteToWideChar(GetACP(), 0, string, 1, wstring, 2); - } - } - else - { - wstring[0] = ch; - len = 1; - } - - if (len > 0) - { - /* "ch" is a UTF-16 character. Convert it to a string of bytes. When - * "enc_codepage" is non-zero use the standard Win32 function, - * otherwise use our own conversion function (e.g., for UTF-8). */ - if (enc_codepage > 0) - { - len = WideCharToMultiByte(enc_codepage, 0, wstring, len, - string, slen, 0, NULL); - /* If we had included the ALT key into the character but now the - * upper bit is no longer set, that probably means the conversion - * failed. Convert the original character and set the upper bit - * afterwards. */ - if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80) - { - wstring[0] = ch & 0x7f; - len = WideCharToMultiByte(enc_codepage, 0, wstring, len, - string, slen, 0, NULL); - if (len == 1) /* safety check */ - string[0] |= 0x80; - } - } - else - { - len = 1; - ws = utf16_to_enc(wstring, &len); - if (ws == NULL) - len = 0; - else - { - if (len > slen) /* just in case */ - len = slen; - mch_memmove(string, ws, len); - vim_free(ws); - } - } - } - - if (len == 0) -#endif - { - string[0] = ch; - len = 1; - } - - for (i = 0; i < len; ++i) - if (string[i] == CSI && len <= slen - 2) - { - /* Insert CSI as K_CSI. */ - mch_memmove(string + i + 3, string + i + 1, len - i - 1); - string[++i] = KS_EXTRA; - string[++i] = (int)KE_CSI; - len += 2; - } - - return len; -} - -/* - * Key hit, add it to the input buffer. - */ -/*ARGSUSED*/ - static void -_OnChar( - HWND hwnd, - UINT ch, - int cRepeat) -{ - char_u string[40]; - int len = 0; - - len = char_to_string(ch, string, 40, FALSE); - if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts) - { - trash_input_buf(); - got_int = TRUE; - } - - add_to_input_buf(string, len); -} - -/* - * Alt-Key hit, add it to the input buffer. - */ -/*ARGSUSED*/ - static void -_OnSysChar( - HWND hwnd, - UINT cch, - int cRepeat) -{ - char_u string[40]; /* Enough for multibyte character */ - int len; - int modifiers; - int ch = cch; /* special keys are negative */ - - /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */ - - /* OK, we have a character key (given by ch) which was entered with the - * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note - * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless - * CAPSLOCK is pressed) at this point. - */ - modifiers = MOD_MASK_ALT; - if (GetKeyState(VK_SHIFT) & 0x8000) - modifiers |= MOD_MASK_SHIFT; - if (GetKeyState(VK_CONTROL) & 0x8000) - modifiers |= MOD_MASK_CTRL; - - ch = simplify_key(ch, &modifiers); - /* remove the SHIFT modifier for keys where it's already included, e.g., - * '(' and '*' */ - if (ch < 0x100 && !isalpha(ch) && isprint(ch)) - modifiers &= ~MOD_MASK_SHIFT; - - /* Interpret the ALT key as making the key META, include SHIFT, etc. */ - ch = extract_modifiers(ch, &modifiers); - if (ch == CSI) - ch = K_CSI; - - len = 0; - if (modifiers) - { - string[len++] = CSI; - string[len++] = KS_MODIFIER; - string[len++] = modifiers; - } - - if (IS_SPECIAL((int)ch)) - { - string[len++] = CSI; - string[len++] = K_SECOND((int)ch); - string[len++] = K_THIRD((int)ch); - } - else - { - /* Although the documentation isn't clear about it, we assume "ch" is - * a Unicode character. */ - len += char_to_string(ch, string + len, 40 - len, TRUE); - } - - add_to_input_buf(string, len); -} - - static void -_OnMouseEvent( - int button, - int x, - int y, - int repeated_click, - UINT keyFlags) -{ - int vim_modifiers = 0x0; - - s_getting_focus = FALSE; - - if (keyFlags & MK_SHIFT) - vim_modifiers |= MOUSE_SHIFT; - if (keyFlags & MK_CONTROL) - vim_modifiers |= MOUSE_CTRL; - if (GetKeyState(VK_MENU) & 0x8000) - vim_modifiers |= MOUSE_ALT; - - gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); -} - -/*ARGSUSED*/ - static void -_OnMouseButtonDown( - HWND hwnd, - BOOL fDoubleClick, - int x, - int y, - UINT keyFlags) -{ - static LONG s_prevTime = 0; - - LONG currentTime = GetMessageTime(); - int button = -1; - int repeated_click; - - /* Give main window the focus: this is so the cursor isn't hollow. */ - (void)SetFocus(s_hwnd); - - if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK) - button = MOUSE_LEFT; - else if (s_uMsg == WM_MBUTTONDOWN || s_uMsg == WM_MBUTTONDBLCLK) - button = MOUSE_MIDDLE; - else if (s_uMsg == WM_RBUTTONDOWN || s_uMsg == WM_RBUTTONDBLCLK) - button = MOUSE_RIGHT; -#ifndef WIN16 /*<VN>*/ - else if (s_uMsg == WM_XBUTTONDOWN || s_uMsg == WM_XBUTTONDBLCLK) - { -#ifndef GET_XBUTTON_WPARAM -# define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) -#endif - button = ((GET_XBUTTON_WPARAM(s_wParam) == 1) ? MOUSE_X1 : MOUSE_X2); - } - else if (s_uMsg == WM_CAPTURECHANGED) - { - /* on W95/NT4, somehow you get in here with an odd Msg - * if you press one button while holding down the other..*/ - if (s_button_pending == MOUSE_LEFT) - button = MOUSE_RIGHT; - else - button = MOUSE_LEFT; - } -#endif - if (button >= 0) - { - repeated_click = ((int)(currentTime - s_prevTime) < p_mouset); - - /* - * Holding down the left and right buttons simulates pushing the middle - * button. - */ - if (repeated_click - && ((button == MOUSE_LEFT && s_button_pending == MOUSE_RIGHT) - || (button == MOUSE_RIGHT - && s_button_pending == MOUSE_LEFT))) - { - /* - * Hmm, gui.c will ignore more than one button down at a time, so - * pretend we let go of it first. - */ - gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, 0x0); - button = MOUSE_MIDDLE; - repeated_click = FALSE; - s_button_pending = -1; - _OnMouseEvent(button, x, y, repeated_click, keyFlags); - } - else if ((repeated_click) - || (mouse_model_popup() && (button == MOUSE_RIGHT))) - { - if (s_button_pending > -1) - { - _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); - s_button_pending = -1; - } - /* TRACE("Button down at x %d, y %d\n", x, y); */ - _OnMouseEvent(button, x, y, repeated_click, keyFlags); - } - else - { - /* - * If this is the first press (i.e. not a multiple click) don't - * action immediately, but store and wait for: - * i) button-up - * ii) mouse move - * iii) another button press - * before using it. - * This enables us to make left+right simulate middle button, - * without left or right being actioned first. The side-effect is - * that if you click and hold the mouse without dragging, the - * cursor doesn't move until you release the button. In practice - * this is hardly a problem. - */ - s_button_pending = button; - s_x_pending = x; - s_y_pending = y; - s_kFlags_pending = keyFlags; - } - - s_prevTime = currentTime; - } -} - -/*ARGSUSED*/ - static void -_OnMouseMoveOrRelease( - HWND hwnd, - int x, - int y, - UINT keyFlags) -{ - int button; - - s_getting_focus = FALSE; - if (s_button_pending > -1) - { - /* Delayed action for mouse down event */ - _OnMouseEvent(s_button_pending, s_x_pending, - s_y_pending, FALSE, s_kFlags_pending); - s_button_pending = -1; - } - if (s_uMsg == WM_MOUSEMOVE) - { - /* - * It's only a MOUSE_DRAG if one or more mouse buttons are being held - * down. - */ - if (!(keyFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON - | MK_XBUTTON1 | MK_XBUTTON2))) - { - gui_mouse_moved(x, y); - return; - } - - /* - * While button is down, keep grabbing mouse move events when - * the mouse goes outside the window - */ - SetCapture(s_textArea); - button = MOUSE_DRAG; - /* TRACE(" move at x %d, y %d\n", x, y); */ - } - else - { - ReleaseCapture(); - button = MOUSE_RELEASE; - /* TRACE(" up at x %d, y %d\n", x, y); */ - } - - _OnMouseEvent(button, x, y, FALSE, keyFlags); -} - -#ifdef FEAT_MENU -/* - * Find the vimmenu_T with the given id - */ - static vimmenu_T * -gui_mswin_find_menu( - vimmenu_T *pMenu, - int id) -{ - vimmenu_T *pChildMenu; - - while (pMenu) - { - if (pMenu->id == (UINT)id) - break; - if (pMenu->children != NULL) - { - pChildMenu = gui_mswin_find_menu(pMenu->children, id); - if (pChildMenu) - { - pMenu = pChildMenu; - break; - } - } - pMenu = pMenu->next; - } - return pMenu; -} - -/*ARGSUSED*/ - static void -_OnMenu( - HWND hwnd, - int id, - HWND hwndCtl, - UINT codeNotify) -{ - vimmenu_T *pMenu; - - pMenu = gui_mswin_find_menu(root_menu, id); - if (pMenu) - gui_menu_cb(pMenu); -} -#endif - -#ifdef MSWIN_FIND_REPLACE -# if defined(FEAT_MBYTE) && defined(WIN3264) -/* - * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW - */ - static void -findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) -{ - WCHAR *wp; - - lpfrw->hwndOwner = lpfr->hwndOwner; - lpfrw->Flags = lpfr->Flags; - - wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL); - wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1); - vim_free(wp); - - /* the field "lpstrReplaceWith" doesn't need to be copied */ -} - -/* - * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE - */ - static void -findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw) -{ - char_u *p; - - lpfr->Flags = lpfrw->Flags; - - p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL); - vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1); - vim_free(p); - - p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL); - vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1); - vim_free(p); -} -# endif - -/* - * Handle a Find/Replace window message. - */ - static void -_OnFindRepl(void) -{ - int flags = 0; - int down; - -# if defined(FEAT_MBYTE) && defined(WIN3264) - /* If the OS is Windows NT, and 'encoding' differs from active codepage: - * convert text from wide string. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); - } -# endif - - if (s_findrep_struct.Flags & FR_DIALOGTERM) - /* Give main window the focus back. */ - (void)SetFocus(s_hwnd); - - if (s_findrep_struct.Flags & FR_FINDNEXT) - { - flags = FRD_FINDNEXT; - - /* Give main window the focus back: this is so the cursor isn't - * hollow. */ - (void)SetFocus(s_hwnd); - } - else if (s_findrep_struct.Flags & FR_REPLACE) - { - flags = FRD_REPLACE; - - /* Give main window the focus back: this is so the cursor isn't - * hollow. */ - (void)SetFocus(s_hwnd); - } - else if (s_findrep_struct.Flags & FR_REPLACEALL) - { - flags = FRD_REPLACEALL; - } - - if (flags != 0) - { - /* Call the generic GUI function to do the actual work. */ - if (s_findrep_struct.Flags & FR_WHOLEWORD) - flags |= FRD_WHOLE_WORD; - if (s_findrep_struct.Flags & FR_MATCHCASE) - flags |= FRD_MATCH_CASE; - down = (s_findrep_struct.Flags & FR_DOWN) != 0; - gui_do_findrepl(flags, s_findrep_struct.lpstrFindWhat, - s_findrep_struct.lpstrReplaceWith, down); - } -} -#endif - - static void -HandleMouseHide(UINT uMsg, LPARAM lParam) -{ - static LPARAM last_lParam = 0L; - - /* We sometimes get a mousemove when the mouse didn't move... */ - if (uMsg == WM_MOUSEMOVE || uMsg == WM_NCMOUSEMOVE) - { - if (lParam == last_lParam) - return; - last_lParam = lParam; - } - - /* Handle specially, to centralise coding. We need to be sure we catch all - * possible events which should cause us to restore the cursor (as it is a - * shared resource, we take full responsibility for it). - */ - switch (uMsg) - { - case WM_KEYUP: - case WM_CHAR: - /* - * blank out the pointer if necessary - */ - if (p_mh) - gui_mch_mousehide(TRUE); - break; - - case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */ - case WM_SYSCHAR: - case WM_MOUSEMOVE: /* show the pointer on any mouse action */ - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_XBUTTONDOWN: - case WM_XBUTTONUP: - case WM_NCMOUSEMOVE: - case WM_NCLBUTTONDOWN: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONDOWN: - case WM_NCMBUTTONUP: - case WM_NCRBUTTONDOWN: - case WM_NCRBUTTONUP: - case WM_KILLFOCUS: - /* - * if the pointer is currently hidden, then we should show it. - */ - gui_mch_mousehide(FALSE); - break; - } -} - - static LRESULT CALLBACK -_TextAreaWndProc( - HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - /* - TRACE("TextAreaWndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", - hwnd, uMsg, wParam, lParam); - */ - - HandleMouseHide(uMsg, lParam); - - s_uMsg = uMsg; - s_wParam = wParam; - s_lParam = lParam; - -#ifdef FEAT_BEVAL - TrackUserActivity(uMsg); -#endif - - switch (uMsg) - { - HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); - HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); - HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); - HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); - HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); -#ifndef WIN16 /*<VN>*/ - HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); - HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); -#endif - -#ifdef FEAT_BEVAL - case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); - return TRUE; -#endif - default: - return MyWindowProc(hwnd, uMsg, wParam, lParam); - } -} - -#if (defined(WIN3264) && defined(FEAT_MBYTE)) \ - || defined(GLOBAL_IME) \ - || defined(PROTO) -# ifdef PROTO -typedef int WINAPI; -# endif - - LRESULT WINAPI -vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ -# ifdef GLOBAL_IME - return global_ime_DefWindowProc(hwnd, message, wParam, lParam); -# else - if (wide_WindowProc) - return DefWindowProcW(hwnd, message, wParam, lParam); - return DefWindowProc(hwnd, message, wParam, lParam); -#endif -} -#endif - -/* - * Called when the foreground or background color has been changed. - */ - void -gui_mch_new_colors(void) -{ - /* nothing to do? */ -} - -/* - * Set the colors to their default values. - */ - void -gui_mch_def_colors() -{ - gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); - gui.back_pixel = GetSysColor(COLOR_WINDOW); - gui.def_norm_pixel = gui.norm_pixel; - gui.def_back_pixel = gui.back_pixel; -} - -/* - * Open the GUI window which was created by a call to gui_mch_init(). - */ - int -gui_mch_open(void) -{ -#ifndef SW_SHOWDEFAULT -# define SW_SHOWDEFAULT 10 /* Borland 5.0 doesn't have it */ -#endif - /* Actually open the window, if not already visible - * (may be done already in gui_mch_set_shellsize) */ - if (!IsWindowVisible(s_hwnd)) - ShowWindow(s_hwnd, SW_SHOWDEFAULT); - -#ifdef MSWIN_FIND_REPLACE - /* Init replace string here, so that we keep it when re-opening the - * dialog. */ - s_findrep_struct.lpstrReplaceWith[0] = NUL; -#endif - - return OK; -} - -/* - * Get the position of the top left corner of the window. - */ - int -gui_mch_get_winpos(int *x, int *y) -{ - RECT rect; - - GetWindowRect(s_hwnd, &rect); - *x = rect.left; - *y = rect.top; - return OK; -} - -/* - * Set the position of the top left corner of the window to the given - * coordinates. - */ - void -gui_mch_set_winpos(int x, int y) -{ - SetWindowPos(s_hwnd, NULL, x, y, 0, 0, - SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); -} - void -gui_mch_set_text_area_pos(int x, int y, int w, int h) -{ - static int oldx = 0; - static int oldy = 0; - - SetWindowPos(s_textArea, NULL, x, y, w, h, SWP_NOZORDER | SWP_NOACTIVATE); - -#ifdef FEAT_TOOLBAR - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) - SendMessage(s_toolbarhwnd, WM_SIZE, - (WPARAM)0, (LPARAM)(w + ((long)(TOOLBAR_BUTTON_HEIGHT+8)<<16))); -#endif -#if defined(FEAT_GUI_TABLINE) - if (showing_tabline) - { - int top = 0; - RECT rect; - -# ifdef FEAT_TOOLBAR - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) - top = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; -# endif - GetClientRect(s_hwnd, &rect); - MoveWindow(s_tabhwnd, 0, top, rect.right, gui.tabline_height, TRUE); - } -#endif - - /* When side scroll bar is unshown, the size of window will change. - * then, the text area move left or right. thus client rect should be - * forcedly redrawn. (Yasuhiro Matsumoto) */ - if (oldx != x || oldy != y) - { - InvalidateRect(s_hwnd, NULL, FALSE); - oldx = x; - oldy = y; - } -} - - -/* - * Scrollbar stuff: - */ - - void -gui_mch_enable_scrollbar( - scrollbar_T *sb, - int flag) -{ - ShowScrollBar(sb->id, SB_CTL, flag); - - /* TODO: When the window is maximized, the size of the window stays the - * same, thus the size of the text area changes. On Win98 it's OK, on Win - * NT 4.0 it's not... */ -} - - void -gui_mch_set_scrollbar_pos( - scrollbar_T *sb, - int x, - int y, - int w, - int h) -{ - SetWindowPos(sb->id, NULL, x, y, w, h, - SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); -} - - void -gui_mch_create_scrollbar( - scrollbar_T *sb, - int orient) /* SBAR_VERT or SBAR_HORIZ */ -{ - sb->id = CreateWindow( - "SCROLLBAR", "Scrollbar", - WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0, - 10, /* Any value will do for now */ - 10, /* Any value will do for now */ - s_hwnd, NULL, - s_hinst, NULL); -} - -/* - * Find the scrollbar with the given hwnd. - */ - static scrollbar_T * -gui_mswin_find_scrollbar(HWND hwnd) -{ - win_T *wp; - - if (gui.bottom_sbar.id == hwnd) - return &gui.bottom_sbar; - FOR_ALL_WINDOWS(wp) - { - if (wp->w_scrollbars[SBAR_LEFT].id == hwnd) - return &wp->w_scrollbars[SBAR_LEFT]; - if (wp->w_scrollbars[SBAR_RIGHT].id == hwnd) - return &wp->w_scrollbars[SBAR_RIGHT]; - } - return NULL; -} - -/* - * Get the character size of a font. - */ - static void -GetFontSize(GuiFont font) -{ - HWND hwnd = GetDesktopWindow(); - HDC hdc = GetWindowDC(hwnd); - HFONT hfntOld = SelectFont(hdc, (HFONT)font); - TEXTMETRIC tm; - - GetTextMetrics(hdc, &tm); - gui.char_width = tm.tmAveCharWidth + tm.tmOverhang; - - gui.char_height = tm.tmHeight -#ifndef MSWIN16_FASTTEXT - + p_linespace -#endif - ; - - SelectFont(hdc, hfntOld); - - ReleaseDC(hwnd, hdc); -} - -/* - * Adjust gui.char_height (after 'linespace' was changed). - */ - int -gui_mch_adjust_charheight(void) -{ - GetFontSize(gui.norm_font); - return OK; -} - - static GuiFont -get_font_handle(LOGFONT *lf) -{ - HFONT font = NULL; - - /* Load the font */ - font = CreateFontIndirect(lf); - - if (font == NULL) - return NOFONT; - - return (GuiFont)font; -} - - static int -pixels_to_points(int pixels, int vertical) -{ - int points; - HWND hwnd; - HDC hdc; - - hwnd = GetDesktopWindow(); - hdc = GetWindowDC(hwnd); - - points = MulDiv(pixels, 72, - GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); - - ReleaseDC(hwnd, hdc); - - return points; -} - - GuiFont -gui_mch_get_font( - char_u *name, - int giveErrorIfMissing) -{ - LOGFONT lf; - GuiFont font = NOFONT; - - if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) - font = get_font_handle(&lf); - if (font == NOFONT && giveErrorIfMissing) - EMSG2(_(e_font), name); - return font; -} - -#if defined(FEAT_EVAL) || defined(PROTO) -/* - * Return the name of font "font" in allocated memory. - * Don't know how to get the actual name, thus use the provided name. - */ -/*ARGSUSED*/ - char_u * -gui_mch_get_fontname(font, name) - GuiFont font; - char_u *name; -{ - if (name == NULL) - return NULL; - return vim_strsave(name); -} -#endif - - void -gui_mch_free_font(GuiFont font) -{ - if (font) - DeleteObject((HFONT)font); -} - - static int -hex_digit(int c) -{ - if (VIM_ISDIGIT(c)) - return c - '0'; - c = TOLOWER_ASC(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - return -1000; -} -/* - * Return the Pixel value (color) for the given color name. - * Return INVALCOLOR for error. - */ - guicolor_T -gui_mch_get_color(char_u *name) -{ - typedef struct guicolor_tTable - { - char *name; - COLORREF color; - } guicolor_tTable; - - static guicolor_tTable table[] = - { - {"Black", RGB(0x00, 0x00, 0x00)}, - {"DarkGray", RGB(0xA9, 0xA9, 0xA9)}, - {"DarkGrey", RGB(0xA9, 0xA9, 0xA9)}, - {"Gray", RGB(0xC0, 0xC0, 0xC0)}, - {"Grey", RGB(0xC0, 0xC0, 0xC0)}, - {"LightGray", RGB(0xD3, 0xD3, 0xD3)}, - {"LightGrey", RGB(0xD3, 0xD3, 0xD3)}, - {"Gray10", RGB(0x1A, 0x1A, 0x1A)}, - {"Grey10", RGB(0x1A, 0x1A, 0x1A)}, - {"Gray20", RGB(0x33, 0x33, 0x33)}, - {"Grey20", RGB(0x33, 0x33, 0x33)}, - {"Gray30", RGB(0x4D, 0x4D, 0x4D)}, - {"Grey30", RGB(0x4D, 0x4D, 0x4D)}, - {"Gray40", RGB(0x66, 0x66, 0x66)}, - {"Grey40", RGB(0x66, 0x66, 0x66)}, - {"Gray50", RGB(0x7F, 0x7F, 0x7F)}, - {"Grey50", RGB(0x7F, 0x7F, 0x7F)}, - {"Gray60", RGB(0x99, 0x99, 0x99)}, - {"Grey60", RGB(0x99, 0x99, 0x99)}, - {"Gray70", RGB(0xB3, 0xB3, 0xB3)}, - {"Grey70", RGB(0xB3, 0xB3, 0xB3)}, - {"Gray80", RGB(0xCC, 0xCC, 0xCC)}, - {"Grey80", RGB(0xCC, 0xCC, 0xCC)}, - {"Gray90", RGB(0xE5, 0xE5, 0xE5)}, - {"Grey90", RGB(0xE5, 0xE5, 0xE5)}, - {"White", RGB(0xFF, 0xFF, 0xFF)}, - {"DarkRed", RGB(0x80, 0x00, 0x00)}, - {"Red", RGB(0xFF, 0x00, 0x00)}, - {"LightRed", RGB(0xFF, 0xA0, 0xA0)}, - {"DarkBlue", RGB(0x00, 0x00, 0x80)}, - {"Blue", RGB(0x00, 0x00, 0xFF)}, - {"LightBlue", RGB(0xAD, 0xD8, 0xE6)}, - {"DarkGreen", RGB(0x00, 0x80, 0x00)}, - {"Green", RGB(0x00, 0xFF, 0x00)}, - {"LightGreen", RGB(0x90, 0xEE, 0x90)}, - {"DarkCyan", RGB(0x00, 0x80, 0x80)}, - {"Cyan", RGB(0x00, 0xFF, 0xFF)}, - {"LightCyan", RGB(0xE0, 0xFF, 0xFF)}, - {"DarkMagenta", RGB(0x80, 0x00, 0x80)}, - {"Magenta", RGB(0xFF, 0x00, 0xFF)}, - {"LightMagenta", RGB(0xFF, 0xA0, 0xFF)}, - {"Brown", RGB(0x80, 0x40, 0x40)}, - {"Yellow", RGB(0xFF, 0xFF, 0x00)}, - {"LightYellow", RGB(0xFF, 0xFF, 0xE0)}, - {"DarkYellow", RGB(0xBB, 0xBB, 0x00)}, - {"SeaGreen", RGB(0x2E, 0x8B, 0x57)}, - {"Orange", RGB(0xFF, 0xA5, 0x00)}, - {"Purple", RGB(0xA0, 0x20, 0xF0)}, - {"SlateBlue", RGB(0x6A, 0x5A, 0xCD)}, - {"Violet", RGB(0xEE, 0x82, 0xEE)}, - }; - - typedef struct SysColorTable - { - char *name; - int color; - } SysColorTable; - - static SysColorTable sys_table[] = - { -#ifdef WIN3264 - {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, - {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, -#ifndef __MINGW32__ - {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, -#endif - {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, - {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, - {"SYS_3DLIGHT", COLOR_3DLIGHT}, - {"SYS_3DSHADOW", COLOR_3DSHADOW}, - {"SYS_DESKTOP", COLOR_DESKTOP}, - {"SYS_INFOBK", COLOR_INFOBK}, - {"SYS_INFOTEXT", COLOR_INFOTEXT}, - {"SYS_3DFACE", COLOR_3DFACE}, -#endif - {"SYS_BTNFACE", COLOR_BTNFACE}, - {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, - {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, - {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, - {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, - {"SYS_BACKGROUND", COLOR_BACKGROUND}, - {"SYS_BTNTEXT", COLOR_BTNTEXT}, - {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, - {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, - {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, - {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, - {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, - {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, - {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, - {"SYS_MENU", COLOR_MENU}, - {"SYS_MENUTEXT", COLOR_MENUTEXT}, - {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, - {"SYS_WINDOW", COLOR_WINDOW}, - {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, - {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} - }; - - int r, g, b; - int i; - - if (name[0] == '#' && strlen(name) == 7) - { - /* Name is in "#rrggbb" format */ - r = hex_digit(name[1]) * 16 + hex_digit(name[2]); - g = hex_digit(name[3]) * 16 + hex_digit(name[4]); - b = hex_digit(name[5]) * 16 + hex_digit(name[6]); - if (r < 0 || g < 0 || b < 0) - return INVALCOLOR; - return RGB(r, g, b); - } - else - { - /* Check if the name is one of the colors we know */ - for (i = 0; i < sizeof(table) / sizeof(table[0]); i++) - if (STRICMP(name, table[i].name) == 0) - return table[i].color; - } - - /* - * Try to look up a system colour. - */ - for (i = 0; i < sizeof(sys_table) / sizeof(sys_table[0]); i++) - if (STRICMP(name, sys_table[i].name) == 0) - return GetSysColor(sys_table[i].color); - - /* - * Last attempt. Look in the file "$VIMRUNTIME/rgb.txt". - */ - { -#define LINE_LEN 100 - FILE *fd; - char line[LINE_LEN]; - char_u *fname; - - fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); - if (fname == NULL) - return INVALCOLOR; - - fd = mch_fopen((char *)fname, "rt"); - vim_free(fname); - if (fd == NULL) - return INVALCOLOR; - - while (!feof(fd)) - { - int len; - int pos; - char *color; - - fgets(line, LINE_LEN, fd); - len = (int)STRLEN(line); - - if (len <= 1 || line[len-1] != '\n') - continue; - - line[len-1] = '\0'; - - i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); - if (i != 3) - continue; - - color = line + pos; - - if (STRICMP(color, name) == 0) - { - fclose(fd); - return (guicolor_T) RGB(r, g, b); - } - } - - fclose(fd); - } - - return INVALCOLOR; -} -/* - * Return OK if the key with the termcap name "name" is supported. - */ - int -gui_mch_haskey(char_u *name) -{ - int i; - - for (i = 0; special_keys[i].vim_code1 != NUL; i++) - if (name[0] == special_keys[i].vim_code0 && - name[1] == special_keys[i].vim_code1) - return OK; - return FAIL; -} - - void -gui_mch_beep(void) -{ - MessageBeep(MB_OK); -} -/* - * Invert a rectangle from row r, column c, for nr rows and nc columns. - */ - void -gui_mch_invert_rectangle( - int r, - int c, - int nr, - int nc) -{ - RECT rc; - - /* - * Note: InvertRect() excludes right and bottom of rectangle. - */ - rc.left = FILL_X(c); - rc.top = FILL_Y(r); - rc.right = rc.left + nc * gui.char_width; - rc.bottom = rc.top + nr * gui.char_height; - InvertRect(s_hdc, &rc); -} - -/* - * Iconify the GUI window. - */ - void -gui_mch_iconify(void) -{ - ShowWindow(s_hwnd, SW_MINIMIZE); -} - -/* - * Draw a cursor without focus. - */ - void -gui_mch_draw_hollow_cursor(guicolor_T color) -{ - HBRUSH hbr; - RECT rc; - - /* - * Note: FrameRect() excludes right and bottom of rectangle. - */ - rc.left = FILL_X(gui.col); - rc.top = FILL_Y(gui.row); - rc.right = rc.left + gui.char_width; -#ifdef FEAT_MBYTE - if (mb_lefthalve(gui.row, gui.col)) - rc.right += gui.char_width; -#endif - rc.bottom = rc.top + gui.char_height; - hbr = CreateSolidBrush(color); - FrameRect(s_hdc, &rc, hbr); - DeleteBrush(hbr); -} -/* - * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using - * color "color". - */ - void -gui_mch_draw_part_cursor( - int w, - int h, - guicolor_T color) -{ - HBRUSH hbr; - RECT rc; - - /* - * Note: FillRect() excludes right and bottom of rectangle. - */ - rc.left = -#ifdef FEAT_RIGHTLEFT - /* vertical line should be on the right of current point */ - CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : -#endif - FILL_X(gui.col); - rc.top = FILL_Y(gui.row) + gui.char_height - h; - rc.right = rc.left + w; - rc.bottom = rc.top + h; - hbr = CreateSolidBrush(color); - FillRect(s_hdc, &rc, hbr); - DeleteBrush(hbr); -} - -/* - * Process a single Windows message. - * If one is not available we hang until one is. - */ - static void -process_message(void) -{ - MSG msg; - UINT vk = 0; /* Virtual key */ - char_u string[40]; - int i; - int modifiers = 0; - int key; -#ifdef FEAT_MENU - static char_u k10[] = {K_SPECIAL, 'k', ';', 0}; -#endif - - pGetMessage(&msg, NULL, 0, 0); - -#ifdef FEAT_OLE - /* Look after OLE Automation commands */ - if (msg.message == WM_OLE) - { - char_u *str = (char_u *)msg.lParam; - if (str == NULL || *str == NUL) - { - /* Message can't be ours, forward it. Fixes problem with Ultramon - * 3.0.4 */ - pDispatchMessage(&msg); - } - else - { - add_to_input_buf(str, (int)STRLEN(str)); - vim_free(str); /* was allocated in CVim::SendKeys() */ - } - return; - } -#endif - -#ifdef FEAT_NETBEANS_INTG - if (msg.message == WM_NETBEANS) - { - netbeans_read(); - return; - } -#endif - -#ifdef FEAT_SNIFF - if (sniff_request_waiting && want_sniff_request) - { - static char_u bytes[3] = {CSI, (char_u)KS_EXTRA, (char_u)KE_SNIFF}; - add_to_input_buf(bytes, 3); /* K_SNIFF */ - sniff_request_waiting = 0; - want_sniff_request = 0; - /* request is handled in normal.c */ - } - if (msg.message == WM_USER) - { - MyTranslateMessage(&msg); - pDispatchMessage(&msg); - return; - } -#endif - -#ifdef MSWIN_FIND_REPLACE - /* Don't process messages used by the dialog */ - if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg)) - { - HandleMouseHide(msg.message, msg.lParam); - return; - } -#endif - - /* - * Check if it's a special key that we recognise. If not, call - * TranslateMessage(). - */ - if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) - { - vk = (int) msg.wParam; - /* handle key after dead key, but ignore shift, alt and control */ - if (dead_key && vk != VK_SHIFT && vk != VK_MENU && vk != VK_CONTROL) - { - dead_key = 0; - /* handle non-alphabetic keys (ones that hopefully cannot generate - * umlaut-characters), unless when control is down */ - if (vk < 'A' || vk > 'Z' || (GetKeyState(VK_CONTROL) & 0x8000)) - { - MSG dm; - - dm.message = msg.message; - dm.hwnd = msg.hwnd; - dm.wParam = VK_SPACE; - MyTranslateMessage(&dm); /* generate dead character */ - if (vk != VK_SPACE) /* and send current character once more */ - PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam); - return; - } - } - - /* Check for CTRL-BREAK */ - if (vk == VK_CANCEL) - { - trash_input_buf(); - got_int = TRUE; - string[0] = Ctrl_C; - add_to_input_buf(string, 1); - } - - for (i = 0; special_keys[i].key_sym != 0; i++) - { - /* ignore VK_SPACE when ALT key pressed: system menu */ - if (special_keys[i].key_sym == vk - && (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000))) - { -#ifdef FEAT_MENU - /* Check for <F10>: Windows selects the menu. When <F10> is - * mapped we want to use the mapping instead. */ - if (vk == VK_F10 - && gui.menu_is_active - && check_map(k10, State, FALSE, TRUE, FALSE, - NULL, NULL) == NULL) - break; -#endif - if (GetKeyState(VK_SHIFT) & 0x8000) - modifiers |= MOD_MASK_SHIFT; - /* - * Don't use caps-lock as shift, because these are special keys - * being considered here, and we only want letters to get - * shifted -- webb - */ - /* - if (GetKeyState(VK_CAPITAL) & 0x0001) - modifiers ^= MOD_MASK_SHIFT; - */ - if (GetKeyState(VK_CONTROL) & 0x8000) - modifiers |= MOD_MASK_CTRL; - if (GetKeyState(VK_MENU) & 0x8000) - modifiers |= MOD_MASK_ALT; - - if (special_keys[i].vim_code1 == NUL) - key = special_keys[i].vim_code0; - else - key = TO_SPECIAL(special_keys[i].vim_code0, - special_keys[i].vim_code1); - key = simplify_key(key, &modifiers); - if (key == CSI) - key = K_CSI; - - if (modifiers) - { - string[0] = CSI; - string[1] = KS_MODIFIER; - string[2] = modifiers; - add_to_input_buf(string, 3); - } - - if (IS_SPECIAL(key)) - { - string[0] = CSI; - string[1] = K_SECOND(key); - string[2] = K_THIRD(key); - add_to_input_buf(string, 3); - } - else - { - int len; - - /* Handle "key" as a Unicode character. */ - len = char_to_string(key, string, 40, FALSE); - add_to_input_buf(string, len); - } - break; - } - } - if (special_keys[i].key_sym == 0) - { - /* Some keys need C-S- where they should only need C-. - * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since - * system startup (Helmut Stiegler, 2003 Oct 3). */ - if (vk != 0xff - && (GetKeyState(VK_CONTROL) & 0x8000) - && !(GetKeyState(VK_SHIFT) & 0x8000) - && !(GetKeyState(VK_MENU) & 0x8000)) - { - /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */ - if (vk == '6' || MapVirtualKey(vk, 2) == (UINT)'^') - { - string[0] = Ctrl_HAT; - add_to_input_buf(string, 1); - } - /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */ - else if (vk == 0xBD) /* QWERTY for CTRL-'-' */ - { - string[0] = Ctrl__; - add_to_input_buf(string, 1); - } - /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */ - else if (vk == '2' || MapVirtualKey(vk, 2) == (UINT)'@') - { - string[0] = Ctrl_AT; - add_to_input_buf(string, 1); - } - else - MyTranslateMessage(&msg); - } - else - MyTranslateMessage(&msg); - } - } -#ifdef FEAT_MBYTE_IME - else if (msg.message == WM_IME_NOTIFY) - _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam); - else if (msg.message == WM_KEYUP && im_get_status()) - /* added for non-MS IME (Yasuhiro Matsumoto) */ - MyTranslateMessage(&msg); -#endif -#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) -/* GIME_TEST */ - else if (msg.message == WM_IME_STARTCOMPOSITION) - { - POINT point; - - global_ime_set_font(&norm_logfont); - point.x = FILL_X(gui.col); - point.y = FILL_Y(gui.row); - MapWindowPoints(s_textArea, s_hwnd, &point, 1); - global_ime_set_position(&point); - } -#endif - -#ifdef FEAT_MENU - /* Check for <F10>: Default effect is to select the menu. When <F10> is - * mapped we need to stop it here to avoid strange effects (e.g., for the - * key-up event) */ - if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE, - NULL, NULL) == NULL) -#endif - pDispatchMessage(&msg); -} - -/* - * Catch up with any queued events. This may put keyboard input into the - * input buffer, call resize call-backs, trigger timers etc. If there is - * nothing in the event queue (& no timers pending), then we return - * immediately. - */ - void -gui_mch_update(void) -{ - MSG msg; - - if (!s_busy_processing) - while (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) - && !vim_is_input_buf_full()) - process_message(); -} - -/* - * GUI input routine called by gui_wait_for_chars(). Waits for a character - * from the keyboard. - * wtime == -1 Wait forever. - * wtime == 0 This should never happen. - * wtime > 0 Wait wtime milliseconds for a character. - * Returns OK if a character was found to be available within the given time, - * or FAIL otherwise. - */ - int -gui_mch_wait_for_chars(int wtime) -{ - MSG msg; - int focus; - - s_timed_out = FALSE; - - if (wtime > 0) - { - /* Don't do anything while processing a (scroll) message. */ - if (s_busy_processing) - return FAIL; - s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)wtime, - (TIMERPROC)_OnTimer); - } - - allow_scrollbar = TRUE; - - focus = gui.in_focus; - while (!s_timed_out) - { - /* Stop or start blinking when focus changes */ - if (gui.in_focus != focus) - { - if (gui.in_focus) - gui_mch_start_blink(); - else - gui_mch_stop_blink(); - focus = gui.in_focus; - } - - if (s_need_activate) - { -#ifdef WIN32 - (void)SetForegroundWindow(s_hwnd); -#else - (void)SetActiveWindow(s_hwnd); -#endif - s_need_activate = FALSE; - } - -#ifdef FEAT_NETBEANS_INTG - /* Process the queued netbeans messages. */ - netbeans_parse_messages(); -#endif - - /* - * Don't use gui_mch_update() because then we will spin-lock until a - * char arrives, instead we use GetMessage() to hang until an - * event arrives. No need to check for input_buf_full because we are - * returning as soon as it contains a single char -- webb - */ - process_message(); - - if (input_available()) - { - if (s_wait_timer != 0 && !s_timed_out) - { - KillTimer(NULL, s_wait_timer); - - /* Eat spurious WM_TIMER messages */ - while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) - ; - s_wait_timer = 0; - } - allow_scrollbar = FALSE; - - /* Clear pending mouse button, the release event may have been - * taken by the dialog window. But don't do this when getting - * focus, we need the mouse-up event then. */ - if (!s_getting_focus) - s_button_pending = -1; - - return OK; - } - } - allow_scrollbar = FALSE; - return FAIL; -} - -/* - * Clear a rectangular region of the screen from text pos (row1, col1) to - * (row2, col2) inclusive. - */ - void -gui_mch_clear_block( - int row1, - int col1, - int row2, - int col2) -{ - RECT rc; - - /* - * Clear one extra pixel at the far right, for when bold characters have - * spilled over to the window border. - * Note: FillRect() excludes right and bottom of rectangle. - */ - rc.left = FILL_X(col1); - rc.top = FILL_Y(row1); - rc.right = FILL_X(col2 + 1) + (col2 == Columns - 1); - rc.bottom = FILL_Y(row2 + 1); - clear_rect(&rc); -} - -/* - * Clear the whole text window. - */ - void -gui_mch_clear_all(void) -{ - RECT rc; - - rc.left = 0; - rc.top = 0; - rc.right = Columns * gui.char_width + 2 * gui.border_width; - rc.bottom = Rows * gui.char_height + 2 * gui.border_width; - clear_rect(&rc); -} -/* - * Menu stuff. - */ - - void -gui_mch_enable_menu(int flag) -{ -#ifdef FEAT_MENU - SetMenu(s_hwnd, flag ? s_menuBar : NULL); -#endif -} - -/*ARGSUSED*/ - void -gui_mch_set_menu_pos( - int x, - int y, - int w, - int h) -{ - /* It will be in the right place anyway */ -} - -#if defined(FEAT_MENU) || defined(PROTO) -/* - * Make menu item hidden or not hidden - */ - void -gui_mch_menu_hidden( - vimmenu_T *menu, - int hidden) -{ - /* - * This doesn't do what we want. Hmm, just grey the menu items for now. - */ - /* - if (hidden) - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_DISABLED); - else - EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED); - */ - gui_mch_menu_grey(menu, hidden); -} - -/* - * This is called after setting all the menus to grey/hidden or not. - */ - void -gui_mch_draw_menubar(void) -{ - DrawMenuBar(s_hwnd); -} -#endif /*FEAT_MENU*/ - -#ifndef PROTO -void -#ifdef VIMDLL -_export -#endif -_cdecl -SaveInst(HINSTANCE hInst) -{ - s_hinst = hInst; -} -#endif - -/* - * Return the RGB value of a pixel as a long. - */ - long_u -gui_mch_get_rgb(guicolor_T pixel) -{ - return (GetRValue(pixel) << 16) + (GetGValue(pixel) << 8) - + GetBValue(pixel); -} - -#if defined(FEAT_GUI_DIALOG) || defined(PROTO) -/* Convert pixels in X to dialog units */ - static WORD -PixelToDialogX(int numPixels) -{ - return (WORD)((numPixels * 4) / s_dlgfntwidth); -} - -/* Convert pixels in Y to dialog units */ - static WORD -PixelToDialogY(int numPixels) -{ - return (WORD)((numPixels * 8) / s_dlgfntheight); -} - -/* Return the width in pixels of the given text in the given DC. */ - static int -GetTextWidth(HDC hdc, char_u *str, int len) -{ - SIZE size; - - GetTextExtentPoint(hdc, str, len, &size); - return size.cx; -} - -#ifdef FEAT_MBYTE -/* - * Return the width in pixels of the given text in the given DC, taking care - * of 'encoding' to active codepage conversion. - */ - static int -GetTextWidthEnc(HDC hdc, char_u *str, int len) -{ - SIZE size; - WCHAR *wstr; - int n; - int wlen = len; - - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - /* 'encoding' differs from active codepage: convert text and use wide - * function */ - wstr = enc_to_utf16(str, &wlen); - if (wstr != NULL) - { - n = GetTextExtentPointW(hdc, wstr, wlen, &size); - vim_free(wstr); - if (n) - return size.cx; - } - } - - return GetTextWidth(hdc, str, len); -} -#else -# define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l)) -#endif - -/* - * A quick little routine that will center one window over another, handy for - * dialog boxes. Taken from the Win32SDK samples. - */ - static BOOL -CenterWindow( - HWND hwndChild, - HWND hwndParent) -{ - RECT rChild, rParent; - int wChild, hChild, wParent, hParent; - int wScreen, hScreen, xNew, yNew; - HDC hdc; - - GetWindowRect(hwndChild, &rChild); - wChild = rChild.right - rChild.left; - hChild = rChild.bottom - rChild.top; - - /* If Vim is minimized put the window in the middle of the screen. */ - if (hwndParent == NULL || IsMinimized(hwndParent)) - { -#ifdef WIN16 - rParent.left = 0; - rParent.top = 0; - rParent.right = GetSystemMetrics(SM_CXSCREEN); - rParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN); -#else - SystemParametersInfo(SPI_GETWORKAREA, 0, &rParent, 0); -#endif - } - else - GetWindowRect(hwndParent, &rParent); - wParent = rParent.right - rParent.left; - hParent = rParent.bottom - rParent.top; - - hdc = GetDC(hwndChild); - wScreen = GetDeviceCaps (hdc, HORZRES); - hScreen = GetDeviceCaps (hdc, VERTRES); - ReleaseDC(hwndChild, hdc); - - xNew = rParent.left + ((wParent - wChild) /2); - if (xNew < 0) - { - xNew = 0; - } - else if ((xNew+wChild) > wScreen) - { - xNew = wScreen - wChild; - } - - yNew = rParent.top + ((hParent - hChild) /2); - if (yNew < 0) - yNew = 0; - else if ((yNew+hChild) > hScreen) - yNew = hScreen - hChild; - - return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0, - SWP_NOSIZE | SWP_NOZORDER); -} -#endif /* FEAT_GUI_DIALOG */ - -void -gui_mch_activate_window(void) -{ - (void)SetActiveWindow(s_hwnd); -} - -#if defined(FEAT_TOOLBAR) || defined(PROTO) - void -gui_mch_show_toolbar(int showit) -{ - if (s_toolbarhwnd == NULL) - return; - - if (showit) - { -# ifdef FEAT_MBYTE -# ifndef TB_SETUNICODEFORMAT - /* For older compilers. We assume this never changes. */ -# define TB_SETUNICODEFORMAT 0x2005 -# endif - /* Enable/disable unicode support */ - int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); - SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); -# endif - ShowWindow(s_toolbarhwnd, SW_SHOW); - } - else - ShowWindow(s_toolbarhwnd, SW_HIDE); -} - -/* Then number of bitmaps is fixed. Exit is missing! */ -#define TOOLBAR_BITMAP_COUNT 31 - -#endif - -#if defined(FEAT_GUI_TABLINE) || defined(PROTO) - static void -add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text) -{ -#ifdef FEAT_MBYTE - WCHAR *wn = NULL; - int n; - - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - /* 'encoding' differs from active codepage: convert menu name - * and use wide function */ - wn = enc_to_utf16(item_text, NULL); - if (wn != NULL) - { - MENUITEMINFOW infow; - - infow.cbSize = sizeof(infow); - infow.fMask = MIIM_TYPE | MIIM_ID; - infow.wID = item_id; - infow.fType = MFT_STRING; - infow.dwTypeData = wn; - infow.cch = (UINT)wcslen(wn); - n = InsertMenuItemW(pmenu, item_id, FALSE, &infow); - vim_free(wn); - if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - /* Failed, try using non-wide function. */ - wn = NULL; - } - } - - if (wn == NULL) -#endif - { - MENUITEMINFO info; - - info.cbSize = sizeof(info); - info.fMask = MIIM_TYPE | MIIM_ID; - info.wID = item_id; - info.fType = MFT_STRING; - info.dwTypeData = item_text; - info.cch = (UINT)STRLEN(item_text); - InsertMenuItem(pmenu, item_id, FALSE, &info); - } -} - - static void -show_tabline_popup_menu(void) -{ - HMENU tab_pmenu; - long rval; - POINT pt; - - /* When ignoring events don't show the menu. */ - if (hold_gui_events -# ifdef FEAT_CMDWIN - || cmdwin_type != 0 -# endif - ) - return; - - tab_pmenu = CreatePopupMenu(); - if (tab_pmenu == NULL) - return; - - add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_CLOSE, _("Close tab")); - add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_NEW, _("New tab")); - add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_OPEN, - _("Open tab...")); - - GetCursorPos(&pt); - rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd, - NULL); - - DestroyMenu(tab_pmenu); - - /* Add the string cmd into input buffer */ - if (rval > 0) - { - TCHITTESTINFO htinfo; - int idx; - - if (ScreenToClient(s_tabhwnd, &pt) == 0) - return; - - htinfo.pt.x = pt.x; - htinfo.pt.y = pt.y; - idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); - if (idx == -1) - idx = 0; - else - idx += 1; - - send_tabline_menu_event(idx, (int)rval); - } -} - -/* - * Show or hide the tabline. - */ - void -gui_mch_show_tabline(int showit) -{ - if (s_tabhwnd == NULL) - return; - - if (!showit != !showing_tabline) - { - if (showit) - ShowWindow(s_tabhwnd, SW_SHOW); - else - ShowWindow(s_tabhwnd, SW_HIDE); - showing_tabline = showit; - } -} - -/* - * Return TRUE when tabline is displayed. - */ - int -gui_mch_showing_tabline(void) -{ - return s_tabhwnd != NULL && showing_tabline; -} - -/* - * Update the labels of the tabline. - */ - void -gui_mch_update_tabline(void) -{ - tabpage_T *tp; - TCITEM tie; - int nr = 0; - int curtabidx = 0; - int tabadded = 0; -#ifdef FEAT_MBYTE - static int use_unicode = FALSE; - int uu; - WCHAR *wstr = NULL; -#endif - - if (s_tabhwnd == NULL) - return; - -#if defined(FEAT_MBYTE) -# ifndef CCM_SETUNICODEFORMAT - /* For older compilers. We assume this never changes. */ -# define CCM_SETUNICODEFORMAT 0x2005 -# endif - uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); - if (uu != use_unicode) - { - /* Enable/disable unicode support */ - SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); - use_unicode = uu; - } -#endif - - tie.mask = TCIF_TEXT; - tie.iImage = -1; - - /* Disable redraw for tab updates to eliminate O(N^2) draws. */ - SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0); - - /* Add a label for each tab page. They all contain the same text area. */ - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) - { - if (tp == curtab) - curtabidx = nr; - - if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) - { - /* Add the tab */ - tie.pszText = "-Empty-"; - TabCtrl_InsertItem(s_tabhwnd, nr, &tie); - tabadded = 1; - } - - get_tabline_label(tp, FALSE); - tie.pszText = NameBuff; -#ifdef FEAT_MBYTE - wstr = NULL; - if (use_unicode) - { - /* Need to go through Unicode. */ - wstr = enc_to_utf16(NameBuff, NULL); - if (wstr != NULL) - { - TCITEMW tiw; - - tiw.mask = TCIF_TEXT; - tiw.iImage = -1; - tiw.pszText = wstr; - SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); - vim_free(wstr); - } - } - if (wstr == NULL) -#endif - { - TabCtrl_SetItem(s_tabhwnd, nr, &tie); - } - } - - /* Remove any old labels. */ - while (nr < TabCtrl_GetItemCount(s_tabhwnd)) - TabCtrl_DeleteItem(s_tabhwnd, nr); - - if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) - TabCtrl_SetCurSel(s_tabhwnd, curtabidx); - - /* Re-enable redraw and redraw. */ - SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0); - RedrawWindow(s_tabhwnd, NULL, NULL, - RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); - - if (tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) - TabCtrl_SetCurSel(s_tabhwnd, curtabidx); -} - -/* - * Set the current tab to "nr". First tab is 1. - */ - void -gui_mch_set_curtab(nr) - int nr; -{ - if (s_tabhwnd == NULL) - return; - - if (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1) - TabCtrl_SetCurSel(s_tabhwnd, nr - 1); -} - -#endif - -/* - * ":simalt" command. - */ - void -ex_simalt(exarg_T *eap) -{ - char_u *keys = eap->arg; - - PostMessage(s_hwnd, WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)0); - while (*keys) - { - if (*keys == '~') - *keys = ' '; /* for showing system menu */ - PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0); - keys++; - } -} - -/* - * Create the find & replace dialogs. - * You can't have both at once: ":find" when replace is showing, destroys - * the replace dialog first, and the other way around. - */ -#ifdef MSWIN_FIND_REPLACE - static void -initialise_findrep(char_u *initial_string) -{ - int wword = FALSE; - int mcase = !p_ic; - char_u *entry_text; - - /* Get the search string to use. */ - entry_text = get_find_dialog_text(initial_string, &wword, &mcase); - - s_findrep_struct.hwndOwner = s_hwnd; - s_findrep_struct.Flags = FR_DOWN; - if (mcase) - s_findrep_struct.Flags |= FR_MATCHCASE; - if (wword) - s_findrep_struct.Flags |= FR_WHOLEWORD; - if (entry_text != NULL && *entry_text != NUL) - vim_strncpy(s_findrep_struct.lpstrFindWhat, entry_text, - s_findrep_struct.wFindWhatLen - 1); - vim_free(entry_text); -} -#endif - - static void -set_window_title(HWND hwnd, char *title) -{ -#ifdef FEAT_MBYTE - if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) - { - WCHAR *wbuf; - int n; - - /* Convert the title from 'encoding' to UTF-16. */ - wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL); - if (wbuf != NULL) - { - n = SetWindowTextW(hwnd, wbuf); - vim_free(wbuf); - if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return; - /* Retry with non-wide function (for Windows 98). */ - } - } -#endif - (void)SetWindowText(hwnd, (LPCSTR)title); -} - - void -gui_mch_find_dialog(exarg_T *eap) -{ -#ifdef MSWIN_FIND_REPLACE - if (s_findrep_msg != 0) - { - if (IsWindow(s_findrep_hwnd) && !s_findrep_is_find) - DestroyWindow(s_findrep_hwnd); - - if (!IsWindow(s_findrep_hwnd)) - { - initialise_findrep(eap->arg); -# if defined(FEAT_MBYTE) && defined(WIN3264) - /* If the OS is Windows NT, and 'encoding' differs from active - * codepage: convert text and use wide function. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - findrep_atow(&s_findrep_struct_w, &s_findrep_struct); - s_findrep_hwnd = FindTextW( - (LPFINDREPLACEW) &s_findrep_struct_w); - } - else -# endif - s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); - } - - set_window_title(s_findrep_hwnd, - _("Find string (use '\\\\' to find a '\\')")); - (void)SetFocus(s_findrep_hwnd); - - s_findrep_is_find = TRUE; - } -#endif -} - - - void -gui_mch_replace_dialog(exarg_T *eap) -{ -#ifdef MSWIN_FIND_REPLACE - if (s_findrep_msg != 0) - { - if (IsWindow(s_findrep_hwnd) && s_findrep_is_find) - DestroyWindow(s_findrep_hwnd); - - if (!IsWindow(s_findrep_hwnd)) - { - initialise_findrep(eap->arg); -# if defined(FEAT_MBYTE) && defined(WIN3264) - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT - && enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - findrep_atow(&s_findrep_struct_w, &s_findrep_struct); - s_findrep_hwnd = ReplaceTextW( - (LPFINDREPLACEW) &s_findrep_struct_w); - } - else -# endif - s_findrep_hwnd = ReplaceText( - (LPFINDREPLACE) &s_findrep_struct); - } - - set_window_title(s_findrep_hwnd, - _("Find & Replace (use '\\\\' to find a '\\')")); - (void)SetFocus(s_findrep_hwnd); - - s_findrep_is_find = FALSE; - } -#endif -} - - -/* - * Set visibility of the pointer. - */ - void -gui_mch_mousehide(int hide) -{ - if (hide != gui.pointer_hidden) - { - ShowCursor(!hide); - gui.pointer_hidden = hide; - } -} - -#ifdef FEAT_MENU - static void -gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y) -{ - /* Unhide the mouse, we don't get move events here. */ - gui_mch_mousehide(FALSE); - - (void)TrackPopupMenu( - (HMENU)menu->submenu_id, - TPM_LEFTALIGN | TPM_LEFTBUTTON, - x, y, - (int)0, /*reserved param*/ - s_hwnd, - NULL); - /* - * NOTE: The pop-up menu can eat the mouse up event. - * We deal with this in normal.c. - */ -} -#endif - -/* - * Got a message when the system will go down. - */ - static void -_OnEndSession(void) -{ - getout_preserve_modified(1); -} - -/* - * Get this message when the user clicks on the cross in the top right corner - * of a Windows95 window. - */ -/*ARGSUSED*/ - static void -_OnClose( - HWND hwnd) -{ - gui_shell_closed(); -} - -/* - * Get a message when the window is being destroyed. - */ - static void -_OnDestroy( - HWND hwnd) -{ -#ifdef WIN16_3DLOOK - Ctl3dUnregister(s_hinst); -#endif - if (!destroying) - _OnClose(hwnd); -} - - static void -_OnPaint( - HWND hwnd) -{ - if (!IsMinimized(hwnd)) - { - PAINTSTRUCT ps; - - out_flush(); /* make sure all output has been processed */ - (void)BeginPaint(hwnd, &ps); - -#ifdef FEAT_MBYTE - /* prevent multi-byte characters from misprinting on an invalid - * rectangle */ - if (has_mbyte) - { - RECT rect; - - GetClientRect(hwnd, &rect); - ps.rcPaint.left = rect.left; - ps.rcPaint.right = rect.right; - } -#endif - - if (!IsRectEmpty(&ps.rcPaint)) - gui_redraw(ps.rcPaint.left, ps.rcPaint.top, - ps.rcPaint.right - ps.rcPaint.left + 1, - ps.rcPaint.bottom - ps.rcPaint.top + 1); - EndPaint(hwnd, &ps); - } -} - -/*ARGSUSED*/ - static void -_OnSize( - HWND hwnd, - UINT state, - int cx, - int cy) -{ - if (!IsMinimized(hwnd)) - { - gui_resize_shell(cx, cy); - -#ifdef FEAT_MENU - /* Menu bar may wrap differently now */ - gui_mswin_get_menu_height(TRUE); -#endif - } -} - - static void -_OnSetFocus( - HWND hwnd, - HWND hwndOldFocus) -{ - gui_focus_change(TRUE); - s_getting_focus = TRUE; - (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); -} - - static void -_OnKillFocus( - HWND hwnd, - HWND hwndNewFocus) -{ - gui_focus_change(FALSE); - s_getting_focus = FALSE; - (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); -} - -/* - * Get a message when the user switches back to vim - */ -#ifdef WIN16 - static BOOL -#else - static LRESULT -#endif -_OnActivateApp( - HWND hwnd, - BOOL fActivate, -#ifdef WIN16 - HTASK dwThreadId -#else - DWORD dwThreadId -#endif - ) -{ - /* we call gui_focus_change() in _OnSetFocus() */ - /* gui_focus_change((int)fActivate); */ - return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); -} - -#if defined(FEAT_WINDOWS) || defined(PROTO) - void -gui_mch_destroy_scrollbar(scrollbar_T *sb) -{ - DestroyWindow(sb->id); -} -#endif - -/* - * Get current mouse coordinates in text window. - */ - void -gui_mch_getmouse(int *x, int *y) -{ - RECT rct; - POINT mp; - - (void)GetWindowRect(s_textArea, &rct); - (void)GetCursorPos((LPPOINT)&mp); - *x = (int)(mp.x - rct.left); - *y = (int)(mp.y - rct.top); -} - -/* - * Move mouse pointer to character at (x, y). - */ - void -gui_mch_setmouse(int x, int y) -{ - RECT rct; - - (void)GetWindowRect(s_textArea, &rct); - (void)SetCursorPos(x + gui.border_offset + rct.left, - y + gui.border_offset + rct.top); -} - - static void -gui_mswin_get_valid_dimensions( - int w, - int h, - int *valid_w, - int *valid_h) -{ - int base_width, base_height; - - base_width = gui_get_base_width() - + (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; - base_height = gui_get_base_height() - + (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 - + GetSystemMetrics(SM_CYCAPTION) -#ifdef FEAT_MENU - + gui_mswin_get_menu_height(FALSE) -#endif - ; - *valid_w = base_width + - ((w - base_width) / gui.char_width) * gui.char_width; - *valid_h = base_height + - ((h - base_height) / gui.char_height) * gui.char_height; -} - - void -gui_mch_flash(int msec) -{ - RECT rc; - - /* - * Note: InvertRect() excludes right and bottom of rectangle. - */ - rc.left = 0; - rc.top = 0; - rc.right = gui.num_cols * gui.char_width; - rc.bottom = gui.num_rows * gui.char_height; - InvertRect(s_hdc, &rc); - gui_mch_flush(); /* make sure it's displayed */ - - ui_delay((long)msec, TRUE); /* wait for a few msec */ - - InvertRect(s_hdc, &rc); -} - -/* - * Return flags used for scrolling. - * The SW_INVALIDATE is required when part of the window is covered or - * off-screen. Refer to MS KB Q75236. - */ - static int -get_scroll_flags(void) -{ - HWND hwnd; - RECT rcVim, rcOther, rcDest; - - GetWindowRect(s_hwnd, &rcVim); - - /* Check if the window is partly above or below the screen. We don't care - * about partly left or right of the screen, it is not relevant when - * scrolling up or down. */ - if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN)) - return SW_INVALIDATE; - - /* Check if there is an window (partly) on top of us. */ - for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; ) - if (IsWindowVisible(hwnd)) - { - GetWindowRect(hwnd, &rcOther); - if (IntersectRect(&rcDest, &rcVim, &rcOther)) - return SW_INVALIDATE; - } - return 0; -} - -/* - * Delete the given number of lines from the given row, scrolling up any - * text further down within the scroll region. - */ - void -gui_mch_delete_lines( - int row, - int num_lines) -{ - RECT rc; - - rc.left = FILL_X(gui.scroll_region_left); - rc.right = FILL_X(gui.scroll_region_right + 1); - rc.top = FILL_Y(row); - rc.bottom = FILL_Y(gui.scroll_region_bot + 1); - - ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, - &rc, &rc, NULL, NULL, get_scroll_flags()); - - UpdateWindow(s_textArea); - /* This seems to be required to avoid the cursor disappearing when - * scrolling such that the cursor ends up in the top-left character on - * the screen... But why? (Webb) */ - /* It's probably fixed by disabling drawing the cursor while scrolling. */ - /* gui.cursor_is_valid = FALSE; */ - - gui_clear_block(gui.scroll_region_bot - num_lines + 1, - gui.scroll_region_left, - gui.scroll_region_bot, gui.scroll_region_right); -} - -/* - * Insert the given number of lines before the given row, scrolling down any - * following text within the scroll region. - */ - void -gui_mch_insert_lines( - int row, - int num_lines) -{ - RECT rc; - - rc.left = FILL_X(gui.scroll_region_left); - rc.right = FILL_X(gui.scroll_region_right + 1); - rc.top = FILL_Y(row); - rc.bottom = FILL_Y(gui.scroll_region_bot + 1); - /* The SW_INVALIDATE is required when part of the window is covered or - * off-screen. How do we avoid it when it's not needed? */ - ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, - &rc, &rc, NULL, NULL, get_scroll_flags()); - - UpdateWindow(s_textArea); - - gui_clear_block(row, gui.scroll_region_left, - row + num_lines - 1, gui.scroll_region_right); -} - - -/*ARGSUSED*/ - void -gui_mch_exit(int rc) -{ - ReleaseDC(s_textArea, s_hdc); - DeleteObject(s_brush); - -#ifdef FEAT_TEAROFF - /* Unload the tearoff bitmap */ - (void)DeleteObject((HGDIOBJ)s_htearbitmap); -#endif - - /* Destroy our window (if we have one). */ - if (s_hwnd != NULL) - { - destroying = TRUE; /* ignore WM_DESTROY message now */ - DestroyWindow(s_hwnd); - } - -#ifdef GLOBAL_IME - global_ime_end(); -#endif -} - - static char_u * -logfont2name(LOGFONT lf) -{ - char *p; - char *res; - char *charset_name; - char *font_name = lf.lfFaceName; - - charset_name = charset_id2name((int)lf.lfCharSet); -#ifdef FEAT_MBYTE - /* Convert a font name from the current codepage to 'encoding'. - * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */ - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { - int len; - acp_to_enc(lf.lfFaceName, (int)strlen(lf.lfFaceName), - (char_u **)&font_name, &len); - } -#endif - res = alloc((unsigned)(strlen(font_name) + 20 - + (charset_name == NULL ? 0 : strlen(charset_name) + 2))); - if (res != NULL) - { - p = res; - /* make a normal font string out of the lf thing:*/ - sprintf((char *)p, "%s:h%d", font_name, pixels_to_points( - lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE)); - while (*p) - { - if (*p == ' ') - *p = '_'; - ++p; - } -#ifndef MSWIN16_FASTTEXT - if (lf.lfItalic) - STRCAT(p, ":i"); - if (lf.lfWeight >= FW_BOLD) - STRCAT(p, ":b"); -#endif - if (lf.lfUnderline) - STRCAT(p, ":u"); - if (lf.lfStrikeOut) - STRCAT(p, ":s"); - if (charset_name != NULL) - { - STRCAT(p, ":c"); - STRCAT(p, charset_name); - } - } - -#ifdef FEAT_MBYTE - if (font_name != lf.lfFaceName) - vim_free(font_name); -#endif - return res; -} - - -#ifdef FEAT_MBYTE_IME -/* - * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use - * 'guifont' - */ - static void -update_im_font(void) -{ - LOGFONT lf_wide; - - if (p_guifontwide != NULL && *p_guifontwide != NUL - && gui.wide_font != NOFONT - && GetObject((HFONT)gui.wide_font, sizeof(lf_wide), &lf_wide)) - norm_logfont = lf_wide; - else - norm_logfont = sub_logfont; - im_set_font(&norm_logfont); -} -#endif - -#ifdef FEAT_MBYTE -/* - * Handler of gui.wide_font (p_guifontwide) changed notification. - */ - void -gui_mch_wide_font_changed() -{ -# ifndef MSWIN16_FASTTEXT - LOGFONT lf; -# endif - -# ifdef FEAT_MBYTE_IME - update_im_font(); -# endif - -# ifndef MSWIN16_FASTTEXT - gui_mch_free_font(gui.wide_ital_font); - gui.wide_ital_font = NOFONT; - gui_mch_free_font(gui.wide_bold_font); - gui.wide_bold_font = NOFONT; - gui_mch_free_font(gui.wide_boldital_font); - gui.wide_boldital_font = NOFONT; - - if (gui.wide_font - && GetObject((HFONT)gui.wide_font, sizeof(lf), &lf)) - { - if (!lf.lfItalic) - { - lf.lfItalic = TRUE; - gui.wide_ital_font = get_font_handle(&lf); - lf.lfItalic = FALSE; - } - if (lf.lfWeight < FW_BOLD) - { - lf.lfWeight = FW_BOLD; - gui.wide_bold_font = get_font_handle(&lf); - if (!lf.lfItalic) - { - lf.lfItalic = TRUE; - gui.wide_boldital_font = get_font_handle(&lf); - } - } - } -# endif -} -#endif - -/* - * Initialise vim to use the font with the given name. - * Return FAIL if the font could not be loaded, OK otherwise. - */ -/*ARGSUSED*/ - int -gui_mch_init_font(char_u *font_name, int fontset) -{ - LOGFONT lf; - GuiFont font = NOFONT; - char_u *p; - - /* Load the font */ - if (get_logfont(&lf, font_name, NULL, TRUE) == OK) - font = get_font_handle(&lf); - if (font == NOFONT) - return FAIL; - - if (font_name == NULL) - font_name = lf.lfFaceName; -#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) - norm_logfont = lf; - sub_logfont = lf; -#endif -#ifdef FEAT_MBYTE_IME - update_im_font(); -#endif - gui_mch_free_font(gui.norm_font); - gui.norm_font = font; - current_font_height = lf.lfHeight; - GetFontSize(font); - - p = logfont2name(lf); - if (p != NULL) - { - hl_set_font_name(p); - - /* When setting 'guifont' to "*" replace it with the actual font name. - * */ - if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0) - { - vim_free(p_guifont); - p_guifont = p; - } - else - vim_free(p); - } - -#ifndef MSWIN16_FASTTEXT - gui_mch_free_font(gui.ital_font); - gui.ital_font = NOFONT; - gui_mch_free_font(gui.bold_font); - gui.bold_font = NOFONT; - gui_mch_free_font(gui.boldital_font); - gui.boldital_font = NOFONT; - - if (!lf.lfItalic) - { - lf.lfItalic = TRUE; - gui.ital_font = get_font_handle(&lf); - lf.lfItalic = FALSE; - } - if (lf.lfWeight < FW_BOLD) - { - lf.lfWeight = FW_BOLD; - gui.bold_font = get_font_handle(&lf); - if (!lf.lfItalic) - { - lf.lfItalic = TRUE; - gui.boldital_font = get_font_handle(&lf); - } - } -#endif - - return OK; -} - -#ifndef WPF_RESTORETOMAXIMIZED -# define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */ -#endif - -/* - * Return TRUE if the GUI window is maximized, filling the whole screen. - */ - int -gui_mch_maximized() -{ - WINDOWPLACEMENT wp; - - wp.length = sizeof(WINDOWPLACEMENT); - if (GetWindowPlacement(s_hwnd, &wp)) - return wp.showCmd == SW_SHOWMAXIMIZED - || (wp.showCmd == SW_SHOWMINIMIZED - && wp.flags == WPF_RESTORETOMAXIMIZED); - - return 0; -} - -/* - * Called when the font changed while the window is maximized. Compute the - * new Rows and Columns. This is like resizing the window. - */ - void -gui_mch_newfont() -{ - RECT rect; - - GetWindowRect(s_hwnd, &rect); - gui_resize_shell(rect.right - rect.left - - (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, - rect.bottom - rect.top - - (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 - - GetSystemMetrics(SM_CYCAPTION) -#ifdef FEAT_MENU - - gui_mswin_get_menu_height(FALSE) -#endif - ); -} - -/* - * Set the window title - */ -/*ARGSUSED*/ - void -gui_mch_settitle( - char_u *title, - char_u *icon) -{ - set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title)); -} - -#ifdef FEAT_MOUSESHAPE -/* Table for shape IDCs. Keep in sync with the mshape_names[] table in - * misc2.c! */ -static LPCSTR mshape_idcs[] = -{ - IDC_ARROW, /* arrow */ - MAKEINTRESOURCE(0), /* blank */ - IDC_IBEAM, /* beam */ - IDC_SIZENS, /* updown */ - IDC_SIZENS, /* udsizing */ - IDC_SIZEWE, /* leftright */ - IDC_SIZEWE, /* lrsizing */ - IDC_WAIT, /* busy */ -#ifdef WIN3264 - IDC_NO, /* no */ -#else - IDC_ICON, /* no */ -#endif - IDC_ARROW, /* crosshair */ - IDC_ARROW, /* hand1 */ - IDC_ARROW, /* hand2 */ - IDC_ARROW, /* pencil */ - IDC_ARROW, /* question */ - IDC_ARROW, /* right-arrow */ - IDC_UPARROW, /* up-arrow */ - IDC_ARROW /* last one */ -}; - - void -mch_set_mouse_shape(int shape) -{ - LPCSTR idc; - - if (shape == MSHAPE_HIDE) - ShowCursor(FALSE); - else - { - if (shape >= MSHAPE_NUMBERED) - idc = IDC_ARROW; - else - idc = mshape_idcs[shape]; -#ifdef SetClassLongPtr - SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc)); -#else -# ifdef WIN32 - SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc)); -# else /* Win16 */ - SetClassWord(s_textArea, GCW_HCURSOR, (WORD)LoadCursor(NULL, idc)); -# endif -#endif - if (!p_mh) - { - POINT mp; - - /* Set the position to make it redrawn with the new shape. */ - (void)GetCursorPos((LPPOINT)&mp); - (void)SetCursorPos(mp.x, mp.y); - ShowCursor(TRUE); - } - } -} -#endif - -#ifdef FEAT_BROWSE -/* - * The file browser exists in two versions: with "W" uses wide characters, - * without "W" the current codepage. When FEAT_MBYTE is defined and on - * Windows NT/2000/XP the "W" functions are used. - */ - -# if defined(FEAT_MBYTE) && defined(WIN3264) -/* - * Wide version of convert_filter(). - */ - static WCHAR * -convert_filterW(char_u *s) -{ - char_u *tmp; - int len; - WCHAR *res; - - tmp = convert_filter(s); - if (tmp == NULL) - return NULL; - len = (int)STRLEN(s) + 3; - res = enc_to_utf16(tmp, &len); - vim_free(tmp); - return res; -} - -/* - * Wide version of gui_mch_browse(). Keep in sync! - */ - static char_u * -gui_mch_browseW( - int saving, - char_u *title, - char_u *dflt, - char_u *ext, - char_u *initdir, - char_u *filter) -{ - /* We always use the wide function. This means enc_to_utf16() must work, - * otherwise it fails miserably! */ - OPENFILENAMEW fileStruct; - WCHAR fileBuf[MAXPATHL]; - WCHAR *wp; - int i; - WCHAR *titlep = NULL; - WCHAR *extp = NULL; - WCHAR *initdirp = NULL; - WCHAR *filterp; - char_u *p; - - if (dflt == NULL) - fileBuf[0] = NUL; - else - { - wp = enc_to_utf16(dflt, NULL); - if (wp == NULL) - fileBuf[0] = NUL; - else - { - for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i) - fileBuf[i] = wp[i]; - fileBuf[i] = NUL; - vim_free(wp); - } - } - - /* Convert the filter to Windows format. */ - filterp = convert_filterW(filter); - - vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); -#ifdef OPENFILENAME_SIZE_VERSION_400 - /* be compatible with Windows NT 4.0 */ - /* TODO: what to use for OPENFILENAMEW??? */ - fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; -#else - fileStruct.lStructSize = sizeof(fileStruct); -#endif - - if (title != NULL) - titlep = enc_to_utf16(title, NULL); - fileStruct.lpstrTitle = titlep; - - if (ext != NULL) - extp = enc_to_utf16(ext, NULL); - fileStruct.lpstrDefExt = extp; - - fileStruct.lpstrFile = fileBuf; - fileStruct.nMaxFile = MAXPATHL; - fileStruct.lpstrFilter = filterp; - fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ - /* has an initial dir been specified? */ - if (initdir != NULL && *initdir != NUL) - { - /* Must have backslashes here, no matter what 'shellslash' says */ - initdirp = enc_to_utf16(initdir, NULL); - if (initdirp != NULL) - { - for (wp = initdirp; *wp != NUL; ++wp) - if (*wp == '/') - *wp = '\\'; - } - fileStruct.lpstrInitialDir = initdirp; - } - - /* - * TODO: Allow selection of multiple files. Needs another arg to this - * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. - * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on - * files that don't exist yet, so I haven't put it in. What about - * OFN_PATHMUSTEXIST? - * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. - */ - fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); -#ifdef FEAT_SHORTCUT - if (curbuf->b_p_bin) - fileStruct.Flags |= OFN_NODEREFERENCELINKS; -#endif - if (saving) - { - if (!GetSaveFileNameW(&fileStruct)) - return NULL; - } - else - { - if (!GetOpenFileNameW(&fileStruct)) - return NULL; - } - - vim_free(filterp); - vim_free(initdirp); - vim_free(titlep); - vim_free(extp); - - /* Convert from UCS2 to 'encoding'. */ - p = utf16_to_enc(fileBuf, NULL); - if (p != NULL) - /* when out of memory we get garbage for non-ASCII chars */ - STRCPY(fileBuf, p); - vim_free(p); - - /* Give focus back to main window (when using MDI). */ - SetFocus(s_hwnd); - - /* Shorten the file name if possible */ - return vim_strsave(shorten_fname1((char_u *)fileBuf)); -} -# endif /* FEAT_MBYTE */ - - -/* - * Convert the string s to the proper format for a filter string by replacing - * the \t and \n delimiters with \0. - * Returns the converted string in allocated memory. - * - * Keep in sync with convert_filterW() above! - */ - static char_u * -convert_filter(char_u *s) -{ - char_u *res; - unsigned s_len = (unsigned)STRLEN(s); - unsigned i; - - res = alloc(s_len + 3); - if (res != NULL) - { - for (i = 0; i < s_len; ++i) - if (s[i] == '\t' || s[i] == '\n') - res[i] = '\0'; - else - res[i] = s[i]; - res[s_len] = NUL; - /* Add two extra NULs to make sure it's properly terminated. */ - res[s_len + 1] = NUL; - res[s_len + 2] = NUL; - } - return res; -} - -/* - * Select a directory. - */ - char_u * -gui_mch_browsedir(char_u *title, char_u *initdir) -{ - /* We fake this: Use a filter that doesn't select anything and a default - * file name that won't be used. */ - return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL, - initdir, (char_u *)_("Directory\t*.nothing\n")); -} - -/* - * Pop open a file browser and return the file selected, in allocated memory, - * or NULL if Cancel is hit. - * saving - TRUE if the file will be saved to, FALSE if it will be opened. - * title - Title message for the file browser dialog. - * dflt - Default name of file. - * ext - Default extension to be added to files without extensions. - * initdir - directory in which to open the browser (NULL = current dir) - * filter - Filter for matched files to choose from. - * - * Keep in sync with gui_mch_browseW() above! - */ - char_u * -gui_mch_browse( - int saving, - char_u *title, - char_u *dflt, - char_u *ext, - char_u *initdir, - char_u *filter) -{ - OPENFILENAME fileStruct; - char_u fileBuf[MAXPATHL]; - char_u *initdirp = NULL; - char_u *filterp; - char_u *p; - -# if defined(FEAT_MBYTE) && defined(WIN3264) - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) - return gui_mch_browseW(saving, title, dflt, ext, initdir, filter); -# endif - - if (dflt == NULL) - fileBuf[0] = NUL; - else - vim_strncpy(fileBuf, dflt, MAXPATHL - 1); - - /* Convert the filter to Windows format. */ - filterp = convert_filter(filter); - - vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); -#ifdef OPENFILENAME_SIZE_VERSION_400 - /* be compatible with Windows NT 4.0 */ - fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; -#else - fileStruct.lStructSize = sizeof(fileStruct); -#endif - - fileStruct.lpstrTitle = title; - fileStruct.lpstrDefExt = ext; - - fileStruct.lpstrFile = fileBuf; - fileStruct.nMaxFile = MAXPATHL; - fileStruct.lpstrFilter = filterp; - fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ - /* has an initial dir been specified? */ - if (initdir != NULL && *initdir != NUL) - { - /* Must have backslashes here, no matter what 'shellslash' says */ - initdirp = vim_strsave(initdir); - if (initdirp != NULL) - for (p = initdirp; *p != NUL; ++p) - if (*p == '/') - *p = '\\'; - fileStruct.lpstrInitialDir = initdirp; - } - - /* - * TODO: Allow selection of multiple files. Needs another arg to this - * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. - * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on - * files that don't exist yet, so I haven't put it in. What about - * OFN_PATHMUSTEXIST? - * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. - */ - fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); -#ifdef FEAT_SHORTCUT - if (curbuf->b_p_bin) - fileStruct.Flags |= OFN_NODEREFERENCELINKS; -#endif - if (saving) - { - if (!GetSaveFileName(&fileStruct)) - return NULL; - } - else - { - if (!GetOpenFileName(&fileStruct)) - return NULL; - } - - vim_free(filterp); - vim_free(initdirp); - - /* Give focus back to main window (when using MDI). */ - SetFocus(s_hwnd); - - /* Shorten the file name if possible */ - return vim_strsave(shorten_fname1((char_u *)fileBuf)); -} -#endif /* FEAT_BROWSE */ - -/*ARGSUSED*/ - static void -_OnDropFiles( - HWND hwnd, - HDROP hDrop) -{ -#ifdef FEAT_WINDOWS -#ifdef WIN3264 -# define BUFPATHLEN _MAX_PATH -# define DRAGQVAL 0xFFFFFFFF -#else -# define BUFPATHLEN MAXPATHL -# define DRAGQVAL 0xFFFF -#endif -#ifdef FEAT_MBYTE - WCHAR wszFile[BUFPATHLEN]; -#endif - char szFile[BUFPATHLEN]; - UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); - UINT i; - char_u **fnames; - POINT pt; - int_u modifiers = 0; - - /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */ - - /* Obtain dropped position */ - DragQueryPoint(hDrop, &pt); - MapWindowPoints(s_hwnd, s_textArea, &pt, 1); - - reset_VIsual(); - - fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); - - if (fnames != NULL) - for (i = 0; i < cFiles; ++i) - { -#ifdef FEAT_MBYTE - if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) - fnames[i] = utf16_to_enc(wszFile, NULL); - else -#endif - { - DragQueryFile(hDrop, i, szFile, BUFPATHLEN); - fnames[i] = vim_strsave(szFile); - } - } - - DragFinish(hDrop); - - if (fnames != NULL) - { - if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) - modifiers |= MOUSE_SHIFT; - if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) - modifiers |= MOUSE_CTRL; - if ((GetKeyState(VK_MENU) & 0x8000) != 0) - modifiers |= MOUSE_ALT; - - gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles); - - s_need_activate = TRUE; - } -#endif -} - -/*ARGSUSED*/ - static int -_OnScroll( - HWND hwnd, - HWND hwndCtl, - UINT code, - int pos) -{ - static UINT prev_code = 0; /* code of previous call */ - scrollbar_T *sb, *sb_info; - long val; - int dragging = FALSE; - int dont_scroll_save = dont_scroll; -#ifndef WIN3264 - int nPos; -#else - SCROLLINFO si; - - si.cbSize = sizeof(si); - si.fMask = SIF_POS; -#endif - - sb = gui_mswin_find_scrollbar(hwndCtl); - if (sb == NULL) - return 0; - - if (sb->wp != NULL) /* Left or right scrollbar */ - { - /* - * Careful: need to get scrollbar info out of first (left) scrollbar - * for window, but keep real scrollbar too because we must pass it to - * gui_drag_scrollbar(). - */ - sb_info = &sb->wp->w_scrollbars[0]; - } - else /* Bottom scrollbar */ - sb_info = sb; - val = sb_info->value; - - switch (code) - { - case SB_THUMBTRACK: - val = pos; - dragging = TRUE; - if (sb->scroll_shift > 0) - val <<= sb->scroll_shift; - break; - case SB_LINEDOWN: - val++; - break; - case SB_LINEUP: - val--; - break; - case SB_PAGEDOWN: - val += (sb_info->size > 2 ? sb_info->size - 2 : 1); - break; - case SB_PAGEUP: - val -= (sb_info->size > 2 ? sb_info->size - 2 : 1); - break; - case SB_TOP: - val = 0; - break; - case SB_BOTTOM: - val = sb_info->max; - break; - case SB_ENDSCROLL: - if (prev_code == SB_THUMBTRACK) - { - /* - * "pos" only gives us 16-bit data. In case of large file, - * use GetScrollPos() which returns 32-bit. Unfortunately it - * is not valid while the scrollbar is being dragged. - */ - val = GetScrollPos(hwndCtl, SB_CTL); - if (sb->scroll_shift > 0) - val <<= sb->scroll_shift; - } - break; - - default: - /* TRACE("Unknown scrollbar event %d\n", code); */ - return 0; - } - prev_code = code; - -#ifdef WIN3264 - si.nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val; - SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); -#else - nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val; - SetScrollPos(hwndCtl, SB_CTL, nPos, TRUE); -#endif - - /* - * When moving a vertical scrollbar, move the other vertical scrollbar too. - */ - if (sb->wp != NULL) - { - scrollbar_T *sba = sb->wp->w_scrollbars; - HWND id = sba[ (sb == sba + SBAR_LEFT) ? SBAR_RIGHT : SBAR_LEFT].id; - -#ifdef WIN3264 - SetScrollInfo(id, SB_CTL, &si, TRUE); -#else - SetScrollPos(id, SB_CTL, nPos, TRUE); -#endif - } - - /* Don't let us be interrupted here by another message. */ - s_busy_processing = TRUE; - - /* When "allow_scrollbar" is FALSE still need to remember the new - * position, but don't actually scroll by setting "dont_scroll". */ - dont_scroll = !allow_scrollbar; - - gui_drag_scrollbar(sb, val, dragging); - - s_busy_processing = FALSE; - dont_scroll = dont_scroll_save; - - return 0; -} - - -/* - * Get command line arguments. - * Use "prog" as the name of the program and "cmdline" as the arguments. - * Copy the arguments to allocated memory. - * Return the number of arguments (including program name). - * Return pointers to the arguments in "argvp". Memory is allocated with - * malloc(), use free() instead of vim_free(). - * Return pointer to buffer in "tofree". - * Returns zero when out of memory. - */ -/*ARGSUSED*/ - int -get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree) -{ - int i; - char *p; - char *progp; - char *pnew = NULL; - char *newcmdline; - int inquote; - int argc; - char **argv = NULL; - int round; - - *tofree = NULL; - -#ifdef FEAT_MBYTE - /* Try using the Unicode version first, it takes care of conversion when - * 'encoding' is changed. */ - argc = get_cmd_argsW(&argv); - if (argc != 0) - goto done; -#endif - - /* Handle the program name. Remove the ".exe" extension, and find the 1st - * non-space. */ - p = strrchr(prog, '.'); - if (p != NULL) - *p = NUL; - for (progp = prog; *progp == ' '; ++progp) - ; - - /* The command line is copied to allocated memory, so that we can change - * it. Add the size of the string, the separating NUL and a terminating - * NUL. */ - newcmdline = malloc(STRLEN(cmdline) + STRLEN(progp) + 2); - if (newcmdline == NULL) - return 0; - - /* - * First round: count the number of arguments ("pnew" == NULL). - * Second round: produce the arguments. - */ - for (round = 1; round <= 2; ++round) - { - /* First argument is the program name. */ - if (pnew != NULL) - { - argv[0] = pnew; - strcpy(pnew, progp); - pnew += strlen(pnew); - *pnew++ = NUL; - } - - /* - * Isolate each argument and put it in argv[]. - */ - p = cmdline; - argc = 1; - while (*p != NUL) - { - inquote = FALSE; - if (pnew != NULL) - argv[argc] = pnew; - ++argc; - while (*p != NUL && (inquote || (*p != ' ' && *p != '\t'))) - { - /* Backslashes are only special when followed by a double - * quote. */ - i = (int)strspn(p, "\\"); - if (p[i] == '"') - { - /* Halve the number of backslashes. */ - if (i > 1 && pnew != NULL) - { - vim_memset(pnew, '\\', i / 2); - pnew += i / 2; - } - - /* Even nr of backslashes toggles quoting, uneven copies - * the double quote. */ - if ((i & 1) == 0) - inquote = !inquote; - else if (pnew != NULL) - *pnew++ = '"'; - p += i + 1; - } - else if (i > 0) - { - /* Copy span of backslashes unmodified. */ - if (pnew != NULL) - { - vim_memset(pnew, '\\', i); - pnew += i; - } - p += i; - } - else - { - if (pnew != NULL) - *pnew++ = *p; -#ifdef FEAT_MBYTE - /* Can't use mb_* functions, because 'encoding' is not - * initialized yet here. */ - if (IsDBCSLeadByte(*p)) - { - ++p; - if (pnew != NULL) - *pnew++ = *p; - } -#endif - ++p; - } - } - - if (pnew != NULL) - *pnew++ = NUL; - while (*p == ' ' || *p == '\t') - ++p; /* advance until a non-space */ - } - - if (round == 1) - { - argv = (char **)malloc((argc + 1) * sizeof(char *)); - if (argv == NULL ) - { - free(newcmdline); - return 0; /* malloc error */ - } - pnew = newcmdline; - *tofree = newcmdline; - } - } - -#ifdef FEAT_MBYTE -done: -#endif - argv[argc] = NULL; /* NULL-terminated list */ - *argvp = argv; - return argc; -} diff --git a/src/gui_x11.c b/src/gui_x11.c index ed71b26ce8..7a5cae03ec 100644 --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -12,6 +12,8 @@ * Not used for GTK. */ +#include "vim.h" + #include <X11/keysym.h> #include <X11/Xatom.h> #include <X11/StringDefs.h> @@ -19,8 +21,6 @@ #include <X11/Shell.h> #include <X11/cursorfont.h> -#include "vim.h" - /* * For Workshop XpmP.h is preferred, because it makes the signs drawn with a * transparent background instead of black. @@ -50,10 +50,6 @@ # include <X11/Xmu/Editres.h> #endif -#ifdef FEAT_BEVAL_TIP -# include "gui_beval.h" -#endif - #define VIM_NAME "vim" #define VIM_CLASS "Vim" @@ -71,16 +67,16 @@ # define DFLT_MENU_FG_COLOR "black" # define DFLT_SCROLL_BG_COLOR "gray60" # define DFLT_SCROLL_FG_COLOR "gray77" -# define DFLT_TOOLTIP_BG_COLOR "#ffffffff9191" -# define DFLT_TOOLTIP_FG_COLOR "#000000000000" +# define DFLT_TOOLTIP_BG_COLOR "#ffff91" +# define DFLT_TOOLTIP_FG_COLOR "#000000" #else /* use the default (CDE) colors */ # define DFLT_MENU_BG_COLOR "" # define DFLT_MENU_FG_COLOR "" # define DFLT_SCROLL_BG_COLOR "" # define DFLT_SCROLL_FG_COLOR "" -# define DFLT_TOOLTIP_BG_COLOR "#ffffffff9191" -# define DFLT_TOOLTIP_FG_COLOR "#000000000000" +# define DFLT_TOOLTIP_BG_COLOR "#ffff91" +# define DFLT_TOOLTIP_FG_COLOR "#000000" #endif Widget vimShell = (Widget)0; @@ -123,9 +119,9 @@ static XFontSet current_fontset = NULL; XDrawImageString16(dpy, win, gc, x, y, (XChar2b *)str, n); \ } while (0) -static int check_fontset_sanity __ARGS((XFontSet fs)); -static int fontset_width __ARGS((XFontSet fs)); -static int fontset_ascent __ARGS((XFontSet fs)); +static int check_fontset_sanity(XFontSet fs); +static int fontset_width(XFontSet fs); +static int fontset_ascent(XFontSet fs); #endif static guicolor_T prev_fg_color = INVALCOLOR; @@ -136,26 +132,13 @@ static guicolor_T prev_sp_color = INVALCOLOR; static XButtonPressedEvent last_mouse_event; #endif -static int find_closest_color __ARGS((Colormap colormap, XColor *colorPtr)); -static void gui_x11_timer_cb __ARGS((XtPointer timed_out, XtIntervalId *interval_id)); -static void gui_x11_visibility_cb __ARGS((Widget w, XtPointer dud, XEvent *event, Boolean *dum)); -static void gui_x11_expose_cb __ARGS((Widget w, XtPointer dud, XEvent *event, Boolean *dum)); -static void gui_x11_resize_window_cb __ARGS((Widget w, XtPointer dud, XEvent *event, Boolean *dum)); -static void gui_x11_focus_change_cb __ARGS((Widget w, XtPointer data, XEvent *event, Boolean *dum)); -static void gui_x11_enter_cb __ARGS((Widget w, XtPointer data, XEvent *event, Boolean *dum)); -static void gui_x11_leave_cb __ARGS((Widget w, XtPointer data, XEvent *event, Boolean *dum)); -static void gui_x11_mouse_cb __ARGS((Widget w, XtPointer data, XEvent *event, Boolean *dum)); -#ifdef FEAT_SNIFF -static void gui_x11_sniff_request_cb __ARGS((XtPointer closure, int *source, XtInputId *id)); -#endif -static void gui_x11_check_copy_area __ARGS((void)); +static void gui_x11_check_copy_area(void); #ifdef FEAT_CLIENTSERVER -static void gui_x11_send_event_handler __ARGS((Widget, XtPointer, XEvent *, Boolean *)); +static void gui_x11_send_event_handler(Widget, XtPointer, XEvent *, Boolean *); #endif -static void gui_x11_wm_protocol_handler __ARGS((Widget, XtPointer, XEvent *, Boolean *)); -static void gui_x11_blink_cb __ARGS((XtPointer timed_out, XtIntervalId *interval_id)); -static Cursor gui_x11_create_blank_mouse __ARGS((void)); -static void draw_curl __ARGS((int row, int col, int cells)); +static void gui_x11_wm_protocol_handler(Widget, XtPointer, XEvent *, Boolean *); +static Cursor gui_x11_create_blank_mouse(void); +static void draw_curl(int row, int col, int cells); /* @@ -459,7 +442,7 @@ static XtResource vim_resources[] = XtRString, DFLT_SCROLL_BG_COLOR }, -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI { XtNtooltipForeground, XtCTooltipForeground, @@ -497,7 +480,7 @@ static XtResource vim_resources[] = XtRImmediate, (XtPointer)NOFONTSET }, -#endif /* FEAT_BEVAL */ +#endif /* FEAT_BEVAL_GUI */ #ifdef FEAT_XIM { "preeditType", @@ -571,19 +554,38 @@ static char **gui_argv = NULL; */ static void -gui_x11_timer_cb(timed_out, interval_id) - XtPointer timed_out; - XtIntervalId *interval_id UNUSED; +gui_x11_timer_cb( + XtPointer timed_out, + XtIntervalId *interval_id UNUSED) { *((int *)timed_out) = TRUE; } +#ifdef FEAT_JOB_CHANNEL static void -gui_x11_visibility_cb(w, dud, event, dum) - Widget w UNUSED; - XtPointer dud UNUSED; - XEvent *event; - Boolean *dum UNUSED; +channel_poll_cb( + XtPointer client_data, + XtIntervalId *interval_id UNUSED) +{ + XtIntervalId *channel_timer = (XtIntervalId *)client_data; + + /* Using an event handler for a channel that may be disconnected does + * not work, it hangs. Instead poll for messages. */ + channel_handle_events(TRUE); + parse_queued_messages(); + + /* repeat */ + *channel_timer = XtAppAddTimeOut(app_context, (long_u)20, + channel_poll_cb, client_data); +} +#endif + + static void +gui_x11_visibility_cb( + Widget w UNUSED, + XtPointer dud UNUSED, + XEvent *event, + Boolean *dum UNUSED) { if (event->type != VisibilityNotify) return; @@ -602,11 +604,11 @@ gui_x11_visibility_cb(w, dud, event, dum) } static void -gui_x11_expose_cb(w, dud, event, dum) - Widget w UNUSED; - XtPointer dud UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_expose_cb( + Widget w UNUSED, + XtPointer dud UNUSED, + XEvent *event, + Boolean *dum UNUSED) { XExposeEvent *gevent; int new_x; @@ -678,11 +680,11 @@ shellRectangle(Widget shell, XRectangle *r) #endif static void -gui_x11_resize_window_cb(w, dud, event, dum) - Widget w UNUSED; - XtPointer dud UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_resize_window_cb( + Widget w UNUSED, + XtPointer dud UNUSED, + XEvent *event, + Boolean *dum UNUSED) { static int lastWidth, lastHeight; @@ -724,31 +726,31 @@ gui_x11_resize_window_cb(w, dud, event, dum) } static void -gui_x11_focus_change_cb(w, data, event, dum) - Widget w UNUSED; - XtPointer data UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_focus_change_cb( + Widget w UNUSED, + XtPointer data UNUSED, + XEvent *event, + Boolean *dum UNUSED) { gui_focus_change(event->type == FocusIn); } static void -gui_x11_enter_cb(w, data, event, dum) - Widget w UNUSED; - XtPointer data UNUSED; - XEvent *event UNUSED; - Boolean *dum UNUSED; +gui_x11_enter_cb( + Widget w UNUSED, + XtPointer data UNUSED, + XEvent *event UNUSED, + Boolean *dum UNUSED) { gui_focus_change(TRUE); } static void -gui_x11_leave_cb(w, data, event, dum) - Widget w UNUSED; - XtPointer data UNUSED; - XEvent *event UNUSED; - Boolean *dum UNUSED; +gui_x11_leave_cb( + Widget w UNUSED, + XtPointer data UNUSED, + XEvent *event UNUSED, + Boolean *dum UNUSED) { gui_focus_change(FALSE); } @@ -760,11 +762,11 @@ gui_x11_leave_cb(w, data, event, dum) #endif void -gui_x11_key_hit_cb(w, dud, event, dum) - Widget w UNUSED; - XtPointer dud UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_key_hit_cb( + Widget w UNUSED, + XtPointer dud UNUSED, + XEvent *event, + Boolean *dum UNUSED) { XKeyPressedEvent *ev_press; #ifdef FEAT_XIM @@ -824,7 +826,7 @@ gui_x11_key_hit_cb(w, dud, event, dum) # endif ) { - int maxlen = len * 4 + 40; /* guessed */ + int maxlen = len * 4 + 40; /* guessed */ char_u *p = (char_u *)XtMalloc(maxlen); mch_memmove(p, string, len); @@ -1071,11 +1073,11 @@ gui_x11_key_hit_cb(w, dud, event, dum) } static void -gui_x11_mouse_cb(w, dud, event, dum) - Widget w UNUSED; - XtPointer dud UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_mouse_cb( + Widget w UNUSED, + XtPointer dud UNUSED, + XEvent *event, + Boolean *dum UNUSED) { static XtIntervalId timer = (XtIntervalId)0; static int timed_out = TRUE; @@ -1127,11 +1129,16 @@ gui_x11_mouse_cb(w, dud, event, dum) gui_x11_timer_cb, &timed_out); switch (event->xbutton.button) { + /* keep in sync with gui_gtk_x11.c */ case Button1: button = MOUSE_LEFT; break; case Button2: button = MOUSE_MIDDLE; break; case Button3: button = MOUSE_RIGHT; break; case Button4: button = MOUSE_4; break; case Button5: button = MOUSE_5; break; + case 6: button = MOUSE_7; break; + case 7: button = MOUSE_6; break; + case 8: button = MOUSE_X1; break; + case 9: button = MOUSE_X2; break; default: return; /* Unknown button */ } @@ -1158,20 +1165,6 @@ gui_x11_mouse_cb(w, dud, event, dum) gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); } -#ifdef FEAT_SNIFF -/* ARGSUSED */ - static void -gui_x11_sniff_request_cb(closure, source, id) - XtPointer closure UNUSED; - int *source UNUSED; - XtInputId *id UNUSED; -{ - static char_u bytes[3] = {CSI, (int)KS_EXTRA, (int)KE_SNIFF}; - - add_to_input_buf(bytes, 3); -} -#endif - /* * End of call-back routines */ @@ -1182,9 +1175,7 @@ gui_x11_sniff_request_cb(closure, source, id) * when vim is started, whether or not the GUI has been started. */ void -gui_mch_prepare(argc, argv) - int *argc; - char **argv; +gui_mch_prepare(int *argc, char **argv) { int arg; int i; @@ -1280,7 +1271,7 @@ gui_mch_prepare(argc, argv) * Return OK or FAIL. */ int -gui_mch_init_check() +gui_mch_init_check(void) { #ifdef FEAT_XIM XtSetLanguageProc(NULL, NULL, NULL); @@ -1291,6 +1282,17 @@ gui_mch_init_check() cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); +# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) + { + /* The call to XtOpenDisplay() may have set the locale from the + * environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a + * decimal point, not a comma. */ + char *p = setlocale(LC_NUMERIC, NULL); + + if (p == NULL || strcmp(p, "C") != 0) + setlocale(LC_NUMERIC, "C"); + } +# endif if (app_context == NULL || gui.dpy == NULL) { gui.dying = TRUE; @@ -1307,13 +1309,13 @@ gui_mch_init_check() */ static XtInputId _xsmp_xtinputid; -static void local_xsmp_handle_requests __ARGS((XtPointer c, int *s, XtInputId *i)); +static void local_xsmp_handle_requests(XtPointer c, int *s, XtInputId *i); static void -local_xsmp_handle_requests(c, s, i) - XtPointer c UNUSED; - int *s UNUSED; - XtInputId *i UNUSED; +local_xsmp_handle_requests( + XtPointer c UNUSED, + int *s UNUSED, + XtInputId *i UNUSED) { if (xsmp_handle_requests() == FAIL) XtRemoveInput(_xsmp_xtinputid); @@ -1326,7 +1328,7 @@ local_xsmp_handle_requests(c, s, i) * Returns OK for success, FAIL when the GUI can't be started. */ int -gui_mch_init() +gui_mch_init(void) { XtGCMask gc_mask; XGCValues gc_vals; @@ -1360,7 +1362,7 @@ gui_mch_init() gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name); gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name); gui.scroll_bg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_bg_name); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); gui.tooltip_bg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_bg_name); #endif @@ -1549,7 +1551,7 @@ gui_mch_init() workshop_connect(app_context); #endif -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI gui_init_tooltip_font(); #endif #ifdef FEAT_MENU @@ -1570,21 +1572,20 @@ gui_mch_init() * Called when starting the GUI fails after calling gui_mch_init(). */ void -gui_mch_uninit() +gui_mch_uninit(void) { gui_x11_destroy_widgets(); XtCloseDisplay(gui.dpy); gui.dpy = NULL; vimShell = (Widget)0; - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); } /* * Called when the foreground or background color has been changed. */ void -gui_mch_new_colors() +gui_mch_new_colors(void) { long_u gc_mask; XGCValues gc_vals; @@ -1614,7 +1615,7 @@ gui_mch_new_colors() * Open the GUI window which was created by a call to gui_mch_init(). */ int -gui_mch_open() +gui_mch_open(void) { /* Actually open the window */ XtRealizeWidget(vimShell); @@ -1690,12 +1691,12 @@ gui_mch_open() return OK; } -#if defined(FEAT_BEVAL) || defined(PROTO) +#if defined(FEAT_BEVAL_GUI) || defined(PROTO) /* * Convert the tooltip fontset name to an XFontSet. */ void -gui_init_tooltip_font() +gui_init_tooltip_font(void) { XrmValue from, to; @@ -1714,7 +1715,7 @@ gui_init_tooltip_font() #if defined(FEAT_MENU) || defined(PROTO) /* Convert the menu font/fontset name to an XFontStruct/XFontset */ void -gui_init_menu_font() +gui_init_menu_font(void) { XrmValue from, to; @@ -1743,24 +1744,21 @@ gui_init_menu_font() #endif void -gui_mch_exit(rc) - int rc UNUSED; +gui_mch_exit(int rc UNUSED) { #if 0 /* Lesstif gives an error message here, and so does Solaris. The man page * says that this isn't needed when exiting, so just skip it. */ XtCloseDisplay(gui.dpy); #endif - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); } /* * Get the position of the top left corner of the window. */ int -gui_mch_get_winpos(x, y) - int *x, *y; +gui_mch_get_winpos(int *x, int *y) { Dimension xpos, ypos; @@ -1778,8 +1776,7 @@ gui_mch_get_winpos(x, y) * coordinates. */ void -gui_mch_set_winpos(x, y) - int x, y; +gui_mch_set_winpos(int x, int y) { XtVaSetValues(vimShell, XtNx, x, @@ -1788,15 +1785,14 @@ gui_mch_set_winpos(x, y) } void -gui_mch_set_shellsize(width, height, min_width, min_height, - base_width, base_height, direction) - int width; - int height; - int min_width; - int min_height; - int base_width; - int base_height; - int direction UNUSED; +gui_mch_set_shellsize( + int width, + int height, + int min_width, + int min_height, + int base_width, + int base_height, + int direction UNUSED) { #ifdef FEAT_XIM height += xim_get_status_area_height(), @@ -1820,9 +1816,9 @@ gui_mch_set_shellsize(width, height, min_width, min_height, * Is there no way in X to find out how wide the borders really are? */ void -gui_mch_get_screen_dimensions(screen_w, screen_h) - int *screen_w; - int *screen_h; +gui_mch_get_screen_dimensions( + int *screen_w, + int *screen_h) { *screen_w = DisplayWidth(gui.dpy, DefaultScreen(gui.dpy)) - 10; *screen_h = DisplayHeight(gui.dpy, DefaultScreen(gui.dpy)) - p_ghr; @@ -1835,9 +1831,9 @@ gui_mch_get_screen_dimensions(screen_w, screen_h) * Return FAIL if the font could not be loaded, OK otherwise. */ int -gui_mch_init_font(font_name, do_fontset) - char_u *font_name; - int do_fontset UNUSED; +gui_mch_init_font( + char_u *font_name, + int do_fontset UNUSED) { XFontStruct *font = NULL; @@ -1965,13 +1961,11 @@ gui_mch_init_font(font_name, do_fontset) * Get a font structure for highlighting. */ GuiFont -gui_mch_get_font(name, giveErrorIfMissing) - char_u *name; - int giveErrorIfMissing; +gui_mch_get_font(char_u *name, int giveErrorIfMissing) { XFontStruct *font; - if (!gui.in_use || name == NULL) /* can't do this when GUI not running */ + if (!gui.in_use || name == NULL) /* can't do this when GUI not running */ return NOFONT; font = XLoadQueryFont(gui.dpy, (char *)name); @@ -2013,16 +2007,40 @@ gui_mch_get_font(name, giveErrorIfMissing) #if defined(FEAT_EVAL) || defined(PROTO) /* * Return the name of font "font" in allocated memory. - * Don't know how to get the actual name, thus use the provided name. */ char_u * -gui_mch_get_fontname(font, name) - GuiFont font UNUSED; - char_u *name; +gui_mch_get_fontname(GuiFont font, char_u *name) { - if (name == NULL) - return NULL; - return vim_strsave(name); + char_u *ret = NULL; + + if (name != NULL && font == NULL) + { + /* In this case, there's no way other than doing this. */ + ret = vim_strsave(name); + } + else if (font != NULL) + { + /* In this case, try to retrieve the XLFD corresponding to 'font'->fid; + * if failed, use 'name' unless it's NULL. */ + unsigned long value = 0L; + + if (XGetFontProperty(font, XA_FONT, &value)) + { + char *xa_font_name = NULL; + + xa_font_name = XGetAtomName(gui.dpy, value); + if (xa_font_name != NULL) + { + ret = vim_strsave((char_u *)xa_font_name); + XFree(xa_font_name); + } + else if (name != NULL) + ret = vim_strsave(name); + } + else if (name != NULL) + ret = vim_strsave(name); + } + return ret; } #endif @@ -2030,7 +2048,7 @@ gui_mch_get_fontname(font, name) * Adjust gui.char_height (after 'linespace' was changed). */ int -gui_mch_adjust_charheight() +gui_mch_adjust_charheight(void) { #ifdef FEAT_XFONTSET if (gui.fontset != NOFONTSET) @@ -2054,8 +2072,7 @@ gui_mch_adjust_charheight() * Set the current text font. */ void -gui_mch_set_font(font) - GuiFont font; +gui_mch_set_font(GuiFont font) { static Font prev_font = (Font)-1; Font fid = ((XFontStruct *)font)->fid; @@ -2078,8 +2095,7 @@ gui_mch_set_font(font) * Adjust the ascent, in case it's different. */ void -gui_mch_set_fontset(fontset) - GuiFontset fontset; +gui_mch_set_fontset(GuiFontset fontset) { current_fontset = (XFontSet)fontset; gui.char_ascent = fontset_ascent(current_fontset) + p_linespace / 2; @@ -2090,8 +2106,7 @@ gui_mch_set_fontset(fontset) * If a font is not going to be used, free its structure. */ void -gui_mch_free_font(font) - GuiFont font; +gui_mch_free_font(GuiFont font) { if (font != NOFONT) XFreeFont(gui.dpy, (XFontStruct *)font); @@ -2102,8 +2117,7 @@ gui_mch_free_font(font) * If a fontset is not going to be used, free its structure. */ void -gui_mch_free_fontset(fontset) - GuiFontset fontset; +gui_mch_free_fontset(GuiFontset fontset) { if (fontset != NOFONTSET) XFreeFontSet(gui.dpy, (XFontSet)fontset); @@ -2114,10 +2128,10 @@ gui_mch_free_fontset(fontset) * Return a reference to the fontset, or NOFONTSET when failing. */ GuiFontset -gui_mch_get_fontset(name, giveErrorIfMissing, fixed_width) - char_u *name; - int giveErrorIfMissing; - int fixed_width; +gui_mch_get_fontset( + char_u *name, + int giveErrorIfMissing, + int fixed_width) { XFontSet fontset; char **missing, *def_str; @@ -2160,8 +2174,7 @@ gui_mch_get_fontset(name, giveErrorIfMissing, fixed_width) * Check if fontset "fs" is fixed width. */ static int -check_fontset_sanity(fs) - XFontSet fs; +check_fontset_sanity(XFontSet fs) { XFontStruct **xfs; char **font_name; @@ -2211,15 +2224,14 @@ check_fontset_sanity(fs) } static int -fontset_width(fs) - XFontSet fs; +fontset_width(XFontSet fs) { - return XmbTextEscapement(fs, "Vim", 3) / 3; + return XmbTextEscapement(fs, "Vim", 3) / 3; } int -fontset_height(fs) - XFontSet fs; +fontset_height( + XFontSet fs) { XFontSetExtents *extents; @@ -2234,8 +2246,7 @@ fontset_height(fs) * characters in all fonts of the fontset. */ int -fontset_height2(fs) - XFontSet fs; +fontset_height2(XFontSet fs) { XFontSetExtents *extents; @@ -2246,8 +2257,7 @@ fontset_height2(fs) /* NOT USED YET static int -fontset_descent(fs) - XFontSet fs; +fontset_descent(XFontSet fs) { XFontSetExtents *extents; @@ -2257,8 +2267,7 @@ fontset_descent(fs) */ static int -fontset_ascent(fs) - XFontSet fs; +fontset_ascent(XFontSet fs) { XFontSetExtents *extents; @@ -2273,182 +2282,58 @@ fontset_ascent(fs) * Return INVALCOLOR for error. */ guicolor_T -gui_mch_get_color(reqname) - char_u *reqname; +gui_mch_get_color(char_u *name) { - int i; - char_u *name = reqname; - Colormap colormap; - XColor color; - static char *(vimnames[][2]) = - { - /* A number of colors that some X11 systems don't have */ - {"LightRed", "#FFBBBB"}, - {"LightGreen", "#88FF88"}, - {"LightMagenta","#FFBBFF"}, - {"DarkCyan", "#008888"}, - {"DarkBlue", "#0000BB"}, - {"DarkRed", "#BB0000"}, - {"DarkMagenta", "#BB00BB"}, - {"DarkGrey", "#BBBBBB"}, - {"DarkYellow", "#BBBB00"}, - {"Gray10", "#1A1A1A"}, - {"Grey10", "#1A1A1A"}, - {"Gray20", "#333333"}, - {"Grey20", "#333333"}, - {"Gray30", "#4D4D4D"}, - {"Grey30", "#4D4D4D"}, - {"Gray40", "#666666"}, - {"Grey40", "#666666"}, - {"Gray50", "#7F7F7F"}, - {"Grey50", "#7F7F7F"}, - {"Gray60", "#999999"}, - {"Grey60", "#999999"}, - {"Gray70", "#B3B3B3"}, - {"Grey70", "#B3B3B3"}, - {"Gray80", "#CCCCCC"}, - {"Grey80", "#CCCCCC"}, - {"Gray90", "#E5E5E5"}, - {"Grey90", "#E5E5E5"}, - {NULL, NULL} - }; + guicolor_T requested; /* can't do this when GUI not running */ - if (!gui.in_use || *reqname == NUL) + if (!gui.in_use || name == NULL || *name == NUL) return INVALCOLOR; - colormap = DefaultColormap(gui.dpy, XDefaultScreen(gui.dpy)); - - /* Do this twice if the name isn't recognized. */ - while (name != NULL) - { - i = XParseColor(gui.dpy, colormap, (char *)name, &color); - -#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) - if (i == 0) - { - char *old; - - /* The X11 system is trying to resolve named colors only by names - * corresponding to the current locale language. But Vim scripts - * usually contain the English color names. Therefore we have to - * try a second time here with the native "C" locale set. - * Hopefully, restoring the old locale this way works on all - * systems... - */ - old = setlocale(LC_ALL, NULL); - if (old != NULL && STRCMP(old, "C") != 0) - { - old = (char *)vim_strsave((char_u *)old); - setlocale(LC_ALL, "C"); - i = XParseColor(gui.dpy, colormap, (char *)name, &color); - setlocale(LC_ALL, old); - vim_free(old); - } - } -#endif - if (i != 0 && (XAllocColor(gui.dpy, colormap, &color) != 0 - || find_closest_color(colormap, &color) == OK)) - return (guicolor_T)color.pixel; - - /* check for a few builtin names */ - for (i = 0; ; ++i) - { - if (vimnames[i][0] == NULL) - { - name = NULL; - break; - } - if (STRICMP(name, vimnames[i][0]) == 0) - { - name = (char_u *)vimnames[i][1]; - break; - } - } - } + requested = gui_get_color_cmn(name); + if (requested == INVALCOLOR) + return INVALCOLOR; - return INVALCOLOR; + return gui_mch_get_rgb_color( + (requested & 0xff0000) >> 16, + (requested & 0xff00) >> 8, + requested & 0xff); } /* - * Find closest color for "colorPtr" in "colormap". set "colorPtr" to the - * resulting color. - * Based on a similar function in TCL. - * Return FAIL if not able to find or allocate a color. + * Return the Pixel value (color) for the given RGB values. + * Return INVALCOLOR for error. */ - static int -find_closest_color(colormap, colorPtr) + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b) +{ + XColor available; Colormap colormap; - XColor *colorPtr; -{ - double tmp, distance, closestDistance; - int i, closest, numFound, cmap_size; - XColor *colortable; - XVisualInfo template, *visInfoPtr; - - template.visualid = XVisualIDFromVisual(DefaultVisual(gui.dpy, - XDefaultScreen(gui.dpy))); - visInfoPtr = XGetVisualInfo(gui.dpy, (long)VisualIDMask, - &template, &numFound); - if (numFound < 1) - /* FindClosestColor couldn't lookup visual */ - return FAIL; - - cmap_size = visInfoPtr->colormap_size; - XFree((char *)visInfoPtr); - colortable = (XColor *)alloc((unsigned)(cmap_size * sizeof(XColor))); - if (!colortable) - return FAIL; /* out of memory */ - for (i = 0; i < cmap_size; i++) - colortable[i].pixel = (unsigned long)i; - XQueryColors (gui.dpy, colormap, colortable, cmap_size); - - /* - * Find the color that best approximates the desired one, then - * try to allocate that color. If that fails, it must mean that - * the color was read-write (so we can't use it, since it's owner - * might change it) or else it was already freed. Try again, - * over and over again, until something succeeds. - */ - closestDistance = 1e30; - closest = 0; - for (i = 0; i < cmap_size; i++) - { - /* - * Use Euclidean distance in RGB space, weighted by Y (of YIQ) - * as the objective function; this accounts for differences - * in the color sensitivity of the eye. - */ - tmp = .30 * (((int)colorPtr->red) - (int)colortable[i].red); - distance = tmp * tmp; - tmp = .61 * (((int)colorPtr->green) - (int)colortable[i].green); - distance += tmp * tmp; - tmp = .11 * (((int)colorPtr->blue) - (int)colortable[i].blue); - distance += tmp * tmp; - if (distance < closestDistance) - { - closest = i; - closestDistance = distance; - } - } +/* Using XParseColor() is very slow, put rgb in XColor directly. - if (XAllocColor(gui.dpy, colormap, &colortable[closest]) != 0) - { - gui.color_approx = TRUE; - *colorPtr = colortable[closest]; - } + char spec[8]; // space enough to hold "#RRGGBB" + vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b); + if (XParseColor(gui.dpy, colormap, (char *)spec, &available) != 0 + && XAllocColor(gui.dpy, colormap, &available) != 0) + return (guicolor_T)available.pixel; +*/ + colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy)); + vim_memset(&available, 0, sizeof(XColor)); + available.red = r << 8; + available.green = g << 8; + available.blue = b << 8; + if (XAllocColor(gui.dpy, colormap, &available) != 0) + return (guicolor_T)available.pixel; - vim_free(colortable); - return OK; + return INVALCOLOR; } /* * Set the current text foreground color. */ void -gui_mch_set_fg_color(color) - guicolor_T color; +gui_mch_set_fg_color(guicolor_T color) { if (color != prev_fg_color) { @@ -2461,8 +2346,7 @@ gui_mch_set_fg_color(color) * Set the current text background color. */ void -gui_mch_set_bg_color(color) - guicolor_T color; +gui_mch_set_bg_color(guicolor_T color) { if (color != prev_bg_color) { @@ -2475,8 +2359,7 @@ gui_mch_set_bg_color(color) * Set the current text special color. */ void -gui_mch_set_sp_color(color) - guicolor_T color; +gui_mch_set_sp_color(guicolor_T color) { prev_sp_color = color; } @@ -2485,7 +2368,7 @@ gui_mch_set_sp_color(color) * create a mouse pointer that is blank */ static Cursor -gui_x11_create_blank_mouse() +gui_x11_create_blank_mouse(void) { Pixmap blank_pixmap = XCreatePixmap(gui.dpy, gui.wid, 1, 1, 1); GC gc = XCreateGC(gui.dpy, blank_pixmap, (unsigned long)0, (XGCValues*)0); @@ -2499,10 +2382,7 @@ gui_x11_create_blank_mouse() * Draw a curled line at the bottom of the character cell. */ static void -draw_curl(row, col, cells) - int row; - int col; - int cells; +draw_curl(int row, int col, int cells) { int i; int offset; @@ -2519,12 +2399,12 @@ draw_curl(row, col, cells) } void -gui_mch_draw_string(row, col, s, len, flags) - int row; - int col; - char_u *s; - int len; - int flags; +gui_mch_draw_string( + int row, + int col, + char_u *s, + int len, + int flags) { int cells = len; #ifdef FEAT_MBYTE @@ -2676,6 +2556,16 @@ gui_mch_draw_string(row, col, s, len, flags) y, FILL_X(col + cells) - 1, y); } + if (flags & DRAW_STRIKE) + { + int y = FILL_Y(row + 1) - gui.char_height/2; + + XSetForeground(gui.dpy, gui.text_gc, prev_sp_color); + XDrawLine(gui.dpy, gui.wid, gui.text_gc, FILL_X(col), + y, FILL_X(col + cells) - 1, y); + XSetForeground(gui.dpy, gui.text_gc, prev_fg_color); + } + #ifdef FEAT_XFONTSET if (current_fontset != NULL) XSetClipMask(gui.dpy, gui.text_gc, None); @@ -2686,8 +2576,7 @@ gui_mch_draw_string(row, col, s, len, flags) * Return OK if the key with the termcap name "name" is supported. */ int -gui_mch_haskey(name) - char_u *name; +gui_mch_haskey(char_u *name) { int i; @@ -2702,9 +2591,7 @@ gui_mch_haskey(name) * Return the text window-id and display. Only required for X-based GUI's */ int -gui_get_x11_windis(win, dis) - Window *win; - Display **dis; +gui_get_x11_windis(Window *win, Display **dis) { *win = XtWindow(vimShell); *dis = gui.dpy; @@ -2712,14 +2599,13 @@ gui_get_x11_windis(win, dis) } void -gui_mch_beep() +gui_mch_beep(void) { XBell(gui.dpy, 0); } void -gui_mch_flash(msec) - int msec; +gui_mch_flash(int msec) { /* Do a visual beep by reversing the foreground and background colors */ XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, 0, 0, @@ -2736,11 +2622,11 @@ gui_mch_flash(msec) * Invert a rectangle from row r, column c, for nr rows and nc columns. */ void -gui_mch_invert_rectangle(r, c, nr, nc) - int r; - int c; - int nr; - int nc; +gui_mch_invert_rectangle( + int r, + int c, + int nr, + int nc) { XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, FILL_X(c), FILL_Y(r), (nc) * gui.char_width, (nr) * gui.char_height); @@ -2750,7 +2636,7 @@ gui_mch_invert_rectangle(r, c, nr, nc) * Iconify the GUI window. */ void -gui_mch_iconify() +gui_mch_iconify(void) { XIconifyWindow(gui.dpy, XtWindow(vimShell), DefaultScreen(gui.dpy)); } @@ -2760,7 +2646,7 @@ gui_mch_iconify() * Bring the Vim window to the foreground. */ void -gui_mch_set_foreground() +gui_mch_set_foreground(void) { XMapRaised(gui.dpy, XtWindow(vimShell)); } @@ -2770,8 +2656,7 @@ gui_mch_set_foreground() * Draw a cursor without focus. */ void -gui_mch_draw_hollow_cursor(color) - guicolor_T color; +gui_mch_draw_hollow_cursor(guicolor_T color) { int w = 1; @@ -2789,10 +2674,7 @@ gui_mch_draw_hollow_cursor(color) * color "color". */ void -gui_mch_draw_part_cursor(w, h, color) - int w; - int h; - guicolor_T color; +gui_mch_draw_part_cursor(int w, int h, guicolor_T color) { gui_mch_set_fg_color(color); @@ -2813,7 +2695,7 @@ gui_mch_draw_part_cursor(w, h, color) * immediately. */ void -gui_mch_update() +gui_mch_update(void) { XtInputMask mask, desired; @@ -2838,10 +2720,10 @@ gui_mch_update() * or FAIL otherwise. */ int -gui_mch_wait_for_chars(wtime) - long wtime; +gui_mch_wait_for_chars(long wtime) { - int focus; + int focus; + int retval = FAIL; /* * Make this static, in case gui_x11_timer_cb is called after leaving @@ -2850,31 +2732,22 @@ gui_mch_wait_for_chars(wtime) static int timed_out; XtIntervalId timer = (XtIntervalId)0; XtInputMask desired; -#ifdef FEAT_SNIFF - static int sniff_on = 0; - static XtInputId sniff_input_id = 0; +#ifdef FEAT_JOB_CHANNEL + XtIntervalId channel_timer = (XtIntervalId)0; #endif timed_out = FALSE; -#ifdef FEAT_SNIFF - if (sniff_on && !want_sniff_request) - { - if (sniff_input_id) - XtRemoveInput(sniff_input_id); - sniff_on = 0; - } - else if (!sniff_on && want_sniff_request) - { - sniff_input_id = XtAppAddInput(app_context, fd_from_sniff, - (XtPointer)XtInputReadMask, gui_x11_sniff_request_cb, 0); - sniff_on = 1; - } -#endif - if (wtime > 0) timer = XtAppAddTimeOut(app_context, (long_u)wtime, gui_x11_timer_cb, &timed_out); +#ifdef FEAT_JOB_CHANNEL + /* If there is a channel with the keep_open flag we need to poll for input + * on them. */ + if (channel_any_keep_open()) + channel_timer = XtAppAddTimeOut(app_context, (long_u)20, + channel_poll_cb, (XtPointer)&channel_timer); +#endif focus = gui.in_focus; #ifdef ALT_X_INPUT @@ -2891,13 +2764,20 @@ gui_mch_wait_for_chars(wtime) if (gui.in_focus) gui_mch_start_blink(); else - gui_mch_stop_blink(); + gui_mch_stop_blink(TRUE); focus = gui.in_focus; } -#if defined(FEAT_NETBEANS_INTG) - /* Process any queued netbeans messages. */ - netbeans_parse_messages(); +#ifdef MESSAGE_QUEUE +# ifdef FEAT_TIMERS + did_add_timer = FALSE; +# endif + parse_queued_messages(); +# ifdef FEAT_TIMERS + if (did_add_timer) + /* Need to recompute the waiting time. */ + break; +# endif #endif /* @@ -2912,12 +2792,19 @@ gui_mch_wait_for_chars(wtime) if (input_available()) { - if (timer != (XtIntervalId)0 && !timed_out) - XtRemoveTimeOut(timer); - return OK; + retval = OK; + break; } } - return FAIL; + + if (timer != (XtIntervalId)0 && !timed_out) + XtRemoveTimeOut(timer); +#ifdef FEAT_JOB_CHANNEL + if (channel_timer != (XtIntervalId)0) + XtRemoveTimeOut(channel_timer); +#endif + + return retval; } /* @@ -2926,7 +2813,7 @@ gui_mch_wait_for_chars(wtime) /* Flush any output to the screen */ void -gui_mch_flush() +gui_mch_flush(void) { XFlush(gui.dpy); } @@ -2936,11 +2823,11 @@ gui_mch_flush() * (row2, col2) inclusive. */ void -gui_mch_clear_block(row1, col1, row2, col2) - int row1; - int col1; - int row2; - int col2; +gui_mch_clear_block( + int row1, + int col1, + int row2, + int col2) { int x; @@ -2954,7 +2841,7 @@ gui_mch_clear_block(row1, col1, row2, col2) } void -gui_mch_clear_all() +gui_mch_clear_all(void) { XClearArea(gui.dpy, gui.wid, 0, 0, 0, 0, False); } @@ -2964,9 +2851,7 @@ gui_mch_clear_all() * text further down within the scroll region. */ void -gui_mch_delete_lines(row, num_lines) - int row; - int num_lines; +gui_mch_delete_lines(int row, int num_lines) { if (gui.visibility == VisibilityFullyObscured) return; /* Can't see the window */ @@ -2991,9 +2876,7 @@ gui_mch_delete_lines(row, num_lines) * following text within the scroll region. */ void -gui_mch_insert_lines(row, num_lines) - int row; - int num_lines; +gui_mch_insert_lines(int row, int num_lines) { if (gui.visibility == VisibilityFullyObscured) return; /* Can't see the window */ @@ -3016,7 +2899,7 @@ gui_mch_insert_lines(row, num_lines) * Update the region revealed by scrolling up/down. */ static void -gui_x11_check_copy_area() +gui_x11_check_copy_area(void) { XEvent event; XGraphicsExposeEvent *gevent; @@ -3048,29 +2931,26 @@ gui_x11_check_copy_area() */ void -clip_mch_lose_selection(cbd) - VimClipboard *cbd; +clip_mch_lose_selection(VimClipboard *cbd) { clip_x11_lose_selection(vimShell, cbd); } int -clip_mch_own_selection(cbd) - VimClipboard *cbd; +clip_mch_own_selection(VimClipboard *cbd) { return clip_x11_own_selection(vimShell, cbd); } void -clip_mch_request_selection(cbd) - VimClipboard *cbd; +clip_mch_request_selection(VimClipboard *cbd) { - clip_x11_request_selection(vimShell, gui.dpy, cbd); + clip_x11_request_selection(vimShell, gui.dpy, cbd); } void -clip_mch_set_selection(cbd) - VimClipboard *cbd; +clip_mch_set_selection( + VimClipboard *cbd) { clip_x11_set_selection(cbd); } @@ -3084,9 +2964,7 @@ clip_mch_set_selection(cbd) * Make a menu either grey or not grey. */ void -gui_mch_menu_grey(menu, grey) - vimmenu_T *menu; - int grey; +gui_mch_menu_grey(vimmenu_T *menu, int grey) { if (menu->id != (Widget)0) { @@ -3106,9 +2984,7 @@ gui_mch_menu_grey(menu, grey) * Make menu item hidden or not hidden */ void -gui_mch_menu_hidden(menu, hidden) - vimmenu_T *menu; - int hidden; +gui_mch_menu_hidden(vimmenu_T *menu, int hidden) { if (menu->id != (Widget)0) { @@ -3123,16 +2999,16 @@ gui_mch_menu_hidden(menu, hidden) * This is called after setting all the menus to grey/hidden or not. */ void -gui_mch_draw_menubar() +gui_mch_draw_menubar(void) { /* Nothing to do in X */ } void -gui_x11_menu_cb(w, client_data, call_data) - Widget w UNUSED; - XtPointer client_data; - XtPointer call_data UNUSED; +gui_x11_menu_cb( + Widget w UNUSED, + XtPointer client_data, + XtPointer call_data UNUSED) { gui_menu_cb((vimmenu_T *)client_data); } @@ -3146,11 +3022,11 @@ gui_x11_menu_cb(w, client_data, call_data) * Should put up a requester! */ static void -gui_x11_wm_protocol_handler(w, client_data, event, dum) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_wm_protocol_handler( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *dum UNUSED) { /* * Only deal with Client messages. @@ -3188,18 +3064,18 @@ gui_x11_wm_protocol_handler(w, client_data, event, dum) * Function called when property changed. Check for incoming commands */ static void -gui_x11_send_event_handler(w, client_data, event, dum) - Widget w UNUSED; - XtPointer client_data UNUSED; - XEvent *event; - Boolean *dum UNUSED; +gui_x11_send_event_handler( + Widget w UNUSED, + XtPointer client_data UNUSED, + XEvent *event, + Boolean *dum UNUSED) { XPropertyEvent *e = (XPropertyEvent *) event; if (e->type == PropertyNotify && e->window == commWindow && e->atom == commProperty && e->state == PropertyNewValue) { - serverEventProc(gui.dpy, event); + serverEventProc(gui.dpy, event, 0); } } #endif @@ -3223,9 +3099,20 @@ static long_u blink_ontime = 400; static long_u blink_offtime = 250; static XtIntervalId blink_timer = (XtIntervalId)0; + int +gui_mch_is_blinking(void) +{ + return blink_state != BLINK_NONE; +} + + int +gui_mch_is_blink_off(void) +{ + return blink_state == BLINK_OFF; +} + void -gui_mch_set_blinking(waittime, on, off) - long waittime, on, off; +gui_mch_set_blinking(long waittime, long on, long off) { blink_waittime = waittime; blink_ontime = on; @@ -3236,41 +3123,22 @@ gui_mch_set_blinking(waittime, on, off) * Stop the cursor blinking. Show the cursor if it wasn't shown. */ void -gui_mch_stop_blink() +gui_mch_stop_blink(int may_call_gui_update_cursor) { if (blink_timer != (XtIntervalId)0) { XtRemoveTimeOut(blink_timer); blink_timer = (XtIntervalId)0; } - if (blink_state == BLINK_OFF) + if (blink_state == BLINK_OFF && may_call_gui_update_cursor) gui_update_cursor(TRUE, FALSE); blink_state = BLINK_NONE; } -/* - * Start the cursor blinking. If it was already blinking, this restarts the - * waiting time and shows the cursor. - */ - void -gui_mch_start_blink() -{ - if (blink_timer != (XtIntervalId)0) - XtRemoveTimeOut(blink_timer); - /* Only switch blinking on if none of the times is zero */ - if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) - { - blink_timer = XtAppAddTimeOut(app_context, blink_waittime, - gui_x11_blink_cb, NULL); - blink_state = BLINK_ON; - gui_update_cursor(TRUE, FALSE); - } -} - static void -gui_x11_blink_cb(timed_out, interval_id) - XtPointer timed_out UNUSED; - XtIntervalId *interval_id UNUSED; +gui_x11_blink_cb( + XtPointer timed_out UNUSED, + XtIntervalId *interval_id UNUSED) { if (blink_state == BLINK_ON) { @@ -3288,12 +3156,30 @@ gui_x11_blink_cb(timed_out, interval_id) } } +/* + * Start the cursor blinking. If it was already blinking, this restarts the + * waiting time and shows the cursor. + */ + void +gui_mch_start_blink(void) +{ + if (blink_timer != (XtIntervalId)0) + XtRemoveTimeOut(blink_timer); + /* Only switch blinking on if none of the times is zero */ + if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) + { + blink_timer = XtAppAddTimeOut(app_context, blink_waittime, + gui_x11_blink_cb, NULL); + blink_state = BLINK_ON; + gui_update_cursor(TRUE, FALSE); + } +} + /* * Return the RGB value of a pixel as a long. */ - long_u -gui_mch_get_rgb(pixel) - guicolor_T pixel; + guicolor_T +gui_mch_get_rgb(guicolor_T pixel) { XColor xc; Colormap colormap; @@ -3302,17 +3188,15 @@ gui_mch_get_rgb(pixel) xc.pixel = pixel; XQueryColor(gui.dpy, colormap, &xc); - return ((xc.red & 0xff00) << 8) + (xc.green & 0xff00) - + ((unsigned)xc.blue >> 8); + return (guicolor_T)(((xc.red & 0xff00) << 8) + (xc.green & 0xff00) + + ((unsigned)xc.blue >> 8)); } /* * Add the callback functions. */ void -gui_x11_callbacks(textArea, vimForm) - Widget textArea; - Widget vimForm; +gui_x11_callbacks(Widget textArea, Widget vimForm) { XtAddEventHandler(textArea, VisibilityChangeMask, FALSE, gui_x11_visibility_cb, (XtPointer)0); @@ -3375,9 +3259,7 @@ gui_mch_getmouse(int *x, int *y) } void -gui_mch_setmouse(x, y) - int x; - int y; +gui_mch_setmouse(int x, int y) { if (gui.wid) XWarpPointer(gui.dpy, (Window)0, gui.wid, 0, 0, 0, 0, x, y); @@ -3385,7 +3267,7 @@ gui_mch_setmouse(x, y) #if (defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)) || defined(PROTO) XButtonPressedEvent * -gui_x11_get_last_mouse_event() +gui_x11_get_last_mouse_event(void) { return &last_mouse_event; } @@ -3398,10 +3280,7 @@ gui_x11_get_last_mouse_event() # define SIGN_WIDTH (gui.char_width * 2) void -gui_mch_drawsign(row, col, typenr) - int row; - int col; - int typenr; +gui_mch_drawsign(int row, int col, int typenr) { XImage *sign; @@ -3417,8 +3296,7 @@ gui_mch_drawsign(row, col, typenr) } void * -gui_mch_register_sign(signfile) - char_u *signfile; +gui_mch_register_sign(char_u *signfile) { XpmAttributes attrs; XImage *sign = NULL; @@ -3458,8 +3336,7 @@ gui_mch_register_sign(signfile) } void -gui_mch_destroy_sign(sign) - void *sign; +gui_mch_destroy_sign(void *sign) { XDestroyImage((XImage*)sign); } @@ -3476,8 +3353,8 @@ static int last_shape = 0; * Use the blank mouse pointer or not. */ void -gui_mch_mousehide(hide) - int hide; /* TRUE = use blank ptr, FALSE = use parent ptr */ +gui_mch_mousehide( + int hide) /* TRUE = use blank ptr, FALSE = use parent ptr */ { if (gui.pointer_hidden != hide) { @@ -3519,8 +3396,7 @@ static int mshape_ids[] = }; void -mch_set_mouse_shape(shape) - int shape; +mch_set_mouse_shape(int shape) { int id; @@ -3549,15 +3425,14 @@ mch_set_mouse_shape(shape) } #endif -#if (defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL)) || defined(PROTO) +#if (defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI)) || defined(PROTO) /* * Set the balloon-eval used for the tooltip of a toolbar menu item. * The check for a non-toolbar item was added, because there is a crash when * passing a normal menu item here. Can't explain that, but better avoid it. */ void -gui_mch_menu_set_tip(menu) - vimmenu_T *menu; +gui_mch_menu_set_tip(vimmenu_T *menu) { if (menu->id != NULL && menu->parent != NULL && menu_is_toolbar(menu->parent->name)) diff --git a/src/gui_x11_pm.h b/src/gui_x11_pm.h index 315cfe9c01..24cd2cae82 100644 --- a/src/gui_x11_pm.h +++ b/src/gui_x11_pm.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb diff --git a/src/gui_xmdlg.c b/src/gui_xmdlg.c index 73142e28c9..01e536c1e0 100644 --- a/src/gui_xmdlg.c +++ b/src/gui_xmdlg.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -16,6 +16,8 @@ * when using a dynamic scrollbar policy. */ +#include "vim.h" + #include <Xm/Form.h> #include <Xm/PushBG.h> #include <Xm/Text.h> @@ -36,8 +38,6 @@ #include <X11/StringDefs.h> #include <X11/Intrinsic.h> -#include "vim.h" - extern Widget vimShell; #ifdef FEAT_MENU diff --git a/src/gui_xmebw.c b/src/gui_xmebw.c index 3760f7260b..9ea020f914 100644 --- a/src/gui_xmebw.c +++ b/src/gui_xmebw.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/gui_xmebw.h b/src/gui_xmebw.h index da4812ea7a..aaf5c72503 100644 --- a/src/gui_xmebw.h +++ b/src/gui_xmebw.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/gui_xmebwp.h b/src/gui_xmebwp.h index a3e3e3d6ec..9dcdf31cac 100644 --- a/src/gui_xmebwp.h +++ b/src/gui_xmebwp.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/guiw16rc.h b/src/guiw16rc.h deleted file mode 100644 index 1e55200bdc..0000000000 --- a/src/guiw16rc.h +++ /dev/null @@ -1,17 +0,0 @@ - -#define IDR_VIM 150 - -#define IDR_VIM_ERROR 151 -#define IDR_VIM_ALERT 152 -#define IDR_VIM_INFO 153 -#define IDR_VIM_QUESTION 154 - -#define IDR_ICOBUDDYBASE 200 - -#define IDR_ICOBUDDY_DEF1 (IDR_ICOBUDDYBASE + 3) -#define IDR_ICOBUDDY_DEF2 (IDR_ICOBUDDYBASE + 0) -#define IDR_ICOBUDDY_DEF3 (IDR_ICOBUDDYBASE + 1) -#define IDR_ICOBUDDY_DEF4 (IDR_ICOBUDDYBASE + 2) - -#define IDR_ICOBUDDY_GRIN (IDR_ICOBUDDYBASE + 4) -#define IDR_ICOBUDDY_ALARM (IDR_ICOBUDDYBASE + 5) diff --git a/src/gvim.exe.mnf b/src/gvim.exe.mnf index 206fd2b12e..dd8f22596f 100644 --- a/src/gvim.exe.mnf +++ b/src/gvim.exe.mnf @@ -2,7 +2,7 @@ <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > <assemblyIdentity processorArchitecture="*" - version="7.4.0.0" + version="8.1.0.0" type="win32" name="Vim" /> diff --git a/src/hangulin.c b/src/hangulin.c index 4ae16a18ee..60b3577ffa 100644 --- a/src/hangulin.c +++ b/src/hangulin.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -35,10 +35,10 @@ static char_u stack[20] = {0}; static int last_l = -1, last_ll = -1; static int hangul_keyboard_type = HANGUL_DEFAULT_KEYBOARD; -static void convert_ks_to_3 __ARGS((const char_u *src, int *fp, int *mp, int *lp)); -static int convert_3_to_ks __ARGS((int fv, int mv, int lv, char_u *des)); -static int hangul_automata2 __ARGS((char_u *buf, unsigned int *c)); -static int hangul_automata3 __ARGS((char_u *buf, unsigned int *c)); +static void convert_ks_to_3(const char_u *src, int *fp, int *mp, int *lp); +static int convert_3_to_ks(int fv, int mv, int lv, char_u *des); +static int hangul_automata2(char_u *buf, unsigned int *c); +static int hangul_automata3(char_u *buf, unsigned int *c); #define push(x) {stack[ sp++ ] = *(x); stack[sp++] = *((x)+1);} #define pop(x) {*((x) + 1) = stack[--sp]; *(x) = stack[--sp];} @@ -96,9 +96,7 @@ static short_u kind_table_for_3[] = */ static int -comfcon3(v, c) - int v; - int c; +comfcon3(int v, int c) { if (v == 2 && c == 2) return 3; @@ -118,9 +116,7 @@ comfcon3(v, c) */ static int -comvow3(v, c) - int v; - int c; +comvow3(int v, int c) { switch (v) { @@ -159,9 +155,7 @@ comvow3(v, c) */ static int -comcon3(k, c) - int k; - int c; +comcon3(int k, int c) { switch (k) { @@ -217,8 +211,7 @@ comcon3(k, c) /**********************************************************************/ static int -kind_table_for_2(c) - int c; +kind_table_for_2(int c) { static char_u table[] = { @@ -241,8 +234,7 @@ kind_table_for_2(c) * : ʼ ƴϸ 0 (If it is not initial sound, return 0). */ static int -fcon(c) - int c; +fcon(int c) { static char_u table[] = { @@ -266,8 +258,7 @@ fcon(c) * : ߼ ƴϸ 0 (If it is not medial vowel, return 0). */ static int -vow(c) - int c; +vow(int c) { static char_u table[] = { @@ -289,8 +280,7 @@ vow(c) * : ħ ƴϸ 0 (If not prop, return 0) */ static int -lcon(c) - int c; +lcon(int c) { static char_u table[] = { @@ -312,9 +302,7 @@ lcon(c) */ static int -comcon2(k, c) - int k; - int c; +comcon2(int k, int c) { switch (k) { @@ -369,9 +357,7 @@ comcon2(k, c) */ static int -comvow2(v, c) - int v; - int c; +comvow2(int v, int c) { switch (v) { @@ -408,27 +394,26 @@ comvow2(v, c) } int -hangul_input_state_get() +hangul_input_state_get(void) { return hangul_input_state; } void -hangul_input_state_set(state) - int state; +hangul_input_state_set(int state) { hangul_input_state = state; hangul_input_clear(); } int -im_get_status() +im_get_status(void) { return hangul_input_state_get(); } void -hangul_input_state_toggle() +hangul_input_state_toggle(void) { if (hangul_input_state_get()) { @@ -452,9 +437,7 @@ hangul_input_state_toggle() } static int -hangul_automata2(buf, c) - char_u *buf; - int_u *c; +hangul_automata2(char_u *buf, int_u *c) { int t,t2; @@ -607,16 +590,14 @@ hangul_automata2(buf, c) return AUTOMATA_CORRECT_NEW; default: - EMSG(_("E256: Hangul automata ERROR")); + IEMSG(_("E256: Hangul automata ERROR")); break; } return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ } static int -hangul_automata3(buf, c) - char_u *buf; - int_u *c; +hangul_automata3(char_u *buf, int_u *c) { int t, t2; @@ -725,7 +706,7 @@ hangul_automata3(buf, c) } void -hangul_keyboard_set() +hangul_keyboard_set(void) { int keyboard; char *s; @@ -746,9 +727,7 @@ hangul_keyboard_set() } int -hangul_input_process(s, len) - char_u *s; - int len; +hangul_input_process(char_u *s, int len) { int n; unsigned int c; @@ -824,14 +803,14 @@ hangul_input_process(s, len) } else if (n == AUTOMATA_ERROR) { - vim_beep(); + vim_beep(BO_HANGUL); return 0; } return len; } void -hangul_input_clear() +hangul_input_clear(void) { sp = 0; f = F_NULL; @@ -1503,11 +1482,11 @@ static const char_u johab_lcon_to_wan[] = }; static void -convert_ks_to_3(src, fp, mp, lp) - const char_u *src; - int *fp; - int *mp; - int *lp; +convert_ks_to_3( + const char_u *src, + int *fp, + int *mp, + int *lp) { int h = *src; int low = *(src + 1); @@ -1515,7 +1494,7 @@ convert_ks_to_3(src, fp, mp, lp) int i; if ((i = han_index(h, low)) >= 0 - && i < sizeof(ks_table1)/sizeof(ks_table1[0])) + && i < (int)(sizeof(ks_table1)/sizeof(ks_table1[0]))) { *fp = ks_table1[i][0]; *mp = ks_table1[i][1]; @@ -1539,11 +1518,11 @@ convert_ks_to_3(src, fp, mp, lp) } static int -convert_3_to_ks(fv, mv, lv, des) - int fv; - int mv; - int lv; - char_u *des; +convert_3_to_ks( + int fv, + int mv, + int lv, + char_u *des) { char_u key[3]; register int hi, lo, mi = 0, result, found; @@ -1619,3 +1598,46 @@ convert_3_to_ks(fv, mv, lv, des) *des++ = johab_lcon_to_wan[lv]; return 8; } + + char_u * +hangul_string_convert(char_u *buf, int *p_len) +{ + char_u *tmpbuf = NULL; + vimconv_T vc; + + if (enc_utf8) + { + vc.vc_type = CONV_NONE; + if (convert_setup(&vc, (char_u *)"euc-kr", p_enc) == OK) + { + tmpbuf = string_convert(&vc, buf, p_len); + convert_setup(&vc, NULL, NULL); + } + } + + return tmpbuf; +} + + char_u * +hangul_composing_buffer_get(int *p_len) +{ + char_u *tmpbuf = NULL; + + if (composing_hangul) + { + int len = 2; + + tmpbuf = hangul_string_convert(composing_hangul_buffer, &len); + if (tmpbuf != NULL) + { + *p_len = len; + } + else + { + tmpbuf = vim_strnsave(composing_hangul_buffer, 2); + *p_len = 2; + } + } + + return tmpbuf; +} diff --git a/src/hardcopy.c b/src/hardcopy.c index 1df2fda72a..420ceb7638 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -135,21 +135,21 @@ typedef struct int ff; /* seen form feed character */ } prt_pos_T; -static char_u *parse_list_options __ARGS((char_u *option_str, option_table_T *table, int table_size)); +static char_u *parse_list_options(char_u *option_str, option_table_T *table, int table_size); #ifdef FEAT_SYN_HL -static long_u darken_rgb __ARGS((long_u rgb)); -static long_u prt_get_term_color __ARGS((int colorindex)); +static long_u darken_rgb(long_u rgb); +static long_u prt_get_term_color(int colorindex); #endif -static void prt_set_fg __ARGS((long_u fg)); -static void prt_set_bg __ARGS((long_u bg)); -static void prt_set_font __ARGS((int bold, int italic, int underline)); -static void prt_line_number __ARGS((prt_settings_T *psettings, int page_line, linenr_T lnum)); -static void prt_header __ARGS((prt_settings_T *psettings, int pagenum, linenr_T lnum)); -static void prt_message __ARGS((char_u *s)); -static colnr_T hardcopy_line __ARGS((prt_settings_T *psettings, int page_line, prt_pos_T *ppos)); +static void prt_set_fg(long_u fg); +static void prt_set_bg(long_u bg); +static void prt_set_font(int bold, int italic, int underline); +static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T lnum); +static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum); +static void prt_message(char_u *s); +static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T *ppos); #ifdef FEAT_SYN_HL -static void prt_get_attr __ARGS((int hl_id, prt_text_attr_T* pattr, int modec)); +static void prt_get_attr(int hl_id, prt_text_attr_T* pattr, int modec); #endif /* @@ -157,18 +157,18 @@ static void prt_get_attr __ARGS((int hl_id, prt_text_attr_T* pattr, int modec)); * Returns an error message or NULL; */ char_u * -parse_printoptions() +parse_printoptions(void) { return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS); } #if (defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)) || defined(PROTO) /* - * Parse 'printoptions' and set the flags in "printer_opts". + * Parse 'printmbfont' and set the flags in "mbfont_opts". * Returns an error message or NULL; */ char_u * -parse_printmbfont() +parse_printmbfont(void) { return parse_list_options(p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS); } @@ -184,11 +184,13 @@ parse_printmbfont() * Only used for the printer at the moment... */ static char_u * -parse_list_options(option_str, table, table_size) - char_u *option_str; - option_table_T *table; - int table_size; +parse_list_options( + char_u *option_str, + option_table_T *table, + int table_size) { + option_table_T *old_opts; + char_u *ret = NULL; char_u *stringp; char_u *colonp; char_u *commap; @@ -196,8 +198,16 @@ parse_list_options(option_str, table, table_size) int idx = 0; /* init for GCC */ int len; + /* Save the old values, so that they can be restored in case of an error. */ + old_opts = (option_table_T *)alloc(sizeof(option_table_T) * table_size); + if (old_opts == NULL) + return NULL; + for (idx = 0; idx < table_size; ++idx) + { + old_opts[idx] = table[idx]; table[idx].present = FALSE; + } /* * Repeat for all comma separated parts. @@ -207,7 +217,10 @@ parse_list_options(option_str, table, table_size) { colonp = vim_strchr(stringp, ':'); if (colonp == NULL) - return (char_u *)N_("E550: Missing colon"); + { + ret = (char_u *)N_("E550: Missing colon"); + break; + } commap = vim_strchr(stringp, ','); if (commap == NULL) commap = option_str + STRLEN(option_str); @@ -219,15 +232,20 @@ parse_list_options(option_str, table, table_size) break; if (idx == table_size) - return (char_u *)N_("E551: Illegal component"); - + { + ret = (char_u *)N_("E551: Illegal component"); + break; + } p = colonp + 1; table[idx].present = TRUE; if (table[idx].hasnum) { if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E552: digit expected"); + { + ret = (char_u *)N_("E552: digit expected"); + break; + } table[idx].number = getdigits(&p); /*advances p*/ } @@ -240,7 +258,14 @@ parse_list_options(option_str, table, table_size) ++stringp; } - return NULL; + if (ret != NULL) + { + /* Restore old options in case of error */ + for (idx = 0; idx < table_size; ++idx) + table[idx] = old_opts[idx]; + } + vim_free(old_opts); + return ret; } @@ -250,8 +275,7 @@ parse_list_options(option_str, table, table_size) * up well on white paper, so reduce their brightness. */ static long_u -darken_rgb(rgb) - long_u rgb; +darken_rgb(long_u rgb) { return ((rgb >> 17) << 16) + (((rgb & 0xff00) >> 9) << 8) @@ -259,8 +283,7 @@ darken_rgb(rgb) } static long_u -prt_get_term_color(colorindex) - int colorindex; +prt_get_term_color(int colorindex) { /* TODO: Should check for xterm with 88 or 256 colors. */ if (t_colors > 8) @@ -269,10 +292,10 @@ prt_get_term_color(colorindex) } static void -prt_get_attr(hl_id, pattr, modec) - int hl_id; - prt_text_attr_T *pattr; - int modec; +prt_get_attr( + int hl_id, + prt_text_attr_T *pattr, + int modec) { int colorindex; long_u fg_color; @@ -284,8 +307,8 @@ prt_get_attr(hl_id, pattr, modec) pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL); pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL); -# ifdef FEAT_GUI - if (gui.in_use) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (USE_24BIT) { bg_color = highlight_gui_color_rgb(hl_id, FALSE); if (bg_color == PRCOLOR_BLACK) @@ -321,8 +344,7 @@ prt_get_attr(hl_id, pattr, modec) #endif /* FEAT_SYN_HL */ static void -prt_set_fg(fg) - long_u fg; +prt_set_fg(long_u fg) { if (fg != curr_fg) { @@ -332,8 +354,7 @@ prt_set_fg(fg) } static void -prt_set_bg(bg) - long_u bg; +prt_set_bg(long_u bg) { if (bg != curr_bg) { @@ -343,10 +364,7 @@ prt_set_bg(bg) } static void -prt_set_font(bold, italic, underline) - int bold; - int italic; - int underline; +prt_set_font(int bold, int italic, int underline) { if (curr_bold != bold || curr_italic != italic @@ -363,10 +381,10 @@ prt_set_font(bold, italic, underline) * Print the line number in the left margin. */ static void -prt_line_number(psettings, page_line, lnum) - prt_settings_T *psettings; - int page_line; - linenr_T lnum; +prt_line_number( + prt_settings_T *psettings, + int page_line, + linenr_T lnum) { int i; char_u tbuf[20]; @@ -400,7 +418,7 @@ prt_line_number(psettings, page_line, lnum) * Get the currently effective header height. */ int -prt_header_height() +prt_header_height(void) { if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) return printer_opts[OPT_PRINT_HEADERHEIGHT].number; @@ -411,7 +429,7 @@ prt_header_height() * Return TRUE if using a line number for printing. */ int -prt_use_number() +prt_use_number(void) { return (printer_opts[OPT_PRINT_NUMBER].present && TOLOWER_ASC(printer_opts[OPT_PRINT_NUMBER].string[0]) == 'y'); @@ -422,8 +440,7 @@ prt_use_number() * Returns PRT_UNIT_NONE if not recognized. */ int -prt_get_unit(idx) - int idx; +prt_get_unit(int idx) { int u = PRT_UNIT_NONE; int i; @@ -443,10 +460,10 @@ prt_get_unit(idx) * Print the page header. */ static void -prt_header(psettings, pagenum, lnum) - prt_settings_T *psettings; - int pagenum; - linenr_T lnum UNUSED; +prt_header( + prt_settings_T *psettings, + int pagenum, + linenr_T lnum UNUSED) { int width = psettings->chars_per_line; int page_line; @@ -549,17 +566,15 @@ prt_header(psettings, pagenum, lnum) * Display a print status message. */ static void -prt_message(s) - char_u *s; +prt_message(char_u *s) { screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); - screen_puts(s, (int)Rows - 1, 0, hl_attr(HLF_R)); + screen_puts(s, (int)Rows - 1, 0, HL_ATTR(HLF_R)); out_flush(); } void -ex_hardcopy(eap) - exarg_T *eap; +ex_hardcopy(exarg_T *eap) { linenr_T lnum; int collated_copies, uncollated_copies; @@ -825,10 +840,10 @@ ex_hardcopy(eap) * Return the next column to print, or zero if the line is finished. */ static colnr_T -hardcopy_line(psettings, page_line, ppos) - prt_settings_T *psettings; - int page_line; - prt_pos_T *ppos; +hardcopy_line( + prt_settings_T *psettings, + int page_line, + prt_pos_T *ppos) { colnr_T col; char_u *line; @@ -1337,47 +1352,47 @@ static struct prt_dsc_comment_S prt_dsc_table[] = PRT_DSC_ENDCOMMENTS_TYPE} }; -static void prt_write_file_raw_len __ARGS((char_u *buffer, int bytes)); -static void prt_write_file __ARGS((char_u *buffer)); -static void prt_write_file_len __ARGS((char_u *buffer, int bytes)); -static void prt_write_string __ARGS((char *s)); -static void prt_write_int __ARGS((int i)); -static void prt_write_boolean __ARGS((int b)); -static void prt_def_font __ARGS((char *new_name, char *encoding, int height, char *font)); -static void prt_real_bits __ARGS((double real, int precision, int *pinteger, int *pfraction)); -static void prt_write_real __ARGS((double val, int prec)); -static void prt_def_var __ARGS((char *name, double value, int prec)); -static void prt_flush_buffer __ARGS((void)); -static void prt_resource_name __ARGS((char_u *filename, void *cookie)); -static int prt_find_resource __ARGS((char *name, struct prt_ps_resource_S *resource)); -static int prt_open_resource __ARGS((struct prt_ps_resource_S *resource)); -static int prt_check_resource __ARGS((struct prt_ps_resource_S *resource, char_u *version)); -static void prt_dsc_start __ARGS((void)); -static void prt_dsc_noarg __ARGS((char *comment)); -static void prt_dsc_textline __ARGS((char *comment, char *text)); -static void prt_dsc_text __ARGS((char *comment, char *text)); -static void prt_dsc_ints __ARGS((char *comment, int count, int *ints)); -static void prt_dsc_requirements __ARGS((int duplex, int tumble, int collate, int color, int num_copies)); -static void prt_dsc_docmedia __ARGS((char *paper_name, double width, double height, double weight, char *colour, char *type)); -static void prt_dsc_resources __ARGS((char *comment, char *type, char *strings)); -static void prt_dsc_font_resource __ARGS((char *resource, struct prt_ps_font_S *ps_font)); -static float to_device_units __ARGS((int idx, double physsize, int def_number)); -static void prt_page_margins __ARGS((double width, double height, double *left, double *right, double *top, double *bottom)); -static void prt_font_metrics __ARGS((int font_scale)); -static int prt_get_cpl __ARGS((void)); -static int prt_get_lpp __ARGS((void)); -static int prt_add_resource __ARGS((struct prt_ps_resource_S *resource)); -static int prt_resfile_next_line __ARGS((void)); -static int prt_resfile_strncmp __ARGS((int offset, char *string, int len)); -static int prt_resfile_skip_nonws __ARGS((int offset)); -static int prt_resfile_skip_ws __ARGS((int offset)); -static int prt_next_dsc __ARGS((struct prt_dsc_line_S *p_dsc_line)); +static void prt_write_file_raw_len(char_u *buffer, int bytes); +static void prt_write_file(char_u *buffer); +static void prt_write_file_len(char_u *buffer, int bytes); +static void prt_write_string(char *s); +static void prt_write_int(int i); +static void prt_write_boolean(int b); +static void prt_def_font(char *new_name, char *encoding, int height, char *font); +static void prt_real_bits(double real, int precision, int *pinteger, int *pfraction); +static void prt_write_real(double val, int prec); +static void prt_def_var(char *name, double value, int prec); +static void prt_flush_buffer(void); +static void prt_resource_name(char_u *filename, void *cookie); +static int prt_find_resource(char *name, struct prt_ps_resource_S *resource); +static int prt_open_resource(struct prt_ps_resource_S *resource); +static int prt_check_resource(struct prt_ps_resource_S *resource, char_u *version); +static void prt_dsc_start(void); +static void prt_dsc_noarg(char *comment); +static void prt_dsc_textline(char *comment, char *text); +static void prt_dsc_text(char *comment, char *text); +static void prt_dsc_ints(char *comment, int count, int *ints); +static void prt_dsc_requirements(int duplex, int tumble, int collate, int color, int num_copies); +static void prt_dsc_docmedia(char *paper_name, double width, double height, double weight, char *colour, char *type); +static void prt_dsc_resources(char *comment, char *type, char *strings); +static void prt_dsc_font_resource(char *resource, struct prt_ps_font_S *ps_font); +static float to_device_units(int idx, double physsize, int def_number); +static void prt_page_margins(double width, double height, double *left, double *right, double *top, double *bottom); +static void prt_font_metrics(int font_scale); +static int prt_get_cpl(void); +static int prt_get_lpp(void); +static int prt_add_resource(struct prt_ps_resource_S *resource); +static int prt_resfile_next_line(void); +static int prt_resfile_strncmp(int offset, char *string, int len); +static int prt_resfile_skip_nonws(int offset); +static int prt_resfile_skip_ws(int offset); +static int prt_next_dsc(struct prt_dsc_line_S *p_dsc_line); #ifdef FEAT_MBYTE -static int prt_build_cid_fontname __ARGS((int font, char_u *name, int name_len)); -static void prt_def_cidfont __ARGS((char *new_name, int height, char *cidfont)); -static void prt_dup_cidfont __ARGS((char *original_name, char *new_name)); -static int prt_match_encoding __ARGS((char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc)); -static int prt_match_charset __ARGS((char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar)); +static int prt_build_cid_fontname(int font, char_u *name, int name_len); +static void prt_def_cidfont(char *new_name, int height, char *cidfont); +static void prt_dup_cidfont(char *original_name, char *new_name); +static int prt_match_encoding(char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc); +static int prt_match_charset(char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar); #endif /* @@ -1458,9 +1473,7 @@ static char_u prt_hexchar[] = "0123456789abcdef"; # endif static void -prt_write_file_raw_len(buffer, bytes) - char_u *buffer; - int bytes; +prt_write_file_raw_len(char_u *buffer, int bytes) { if (!prt_file_error && fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) @@ -1472,16 +1485,13 @@ prt_write_file_raw_len(buffer, bytes) } static void -prt_write_file(buffer) - char_u *buffer; +prt_write_file(char_u *buffer) { prt_write_file_len(buffer, (int)STRLEN(buffer)); } static void -prt_write_file_len(buffer, bytes) - char_u *buffer; - int bytes; +prt_write_file_len(char_u *buffer, int bytes) { #ifdef EBCDIC ebcdic2ascii(buffer, bytes); @@ -1493,8 +1503,7 @@ prt_write_file_len(buffer, bytes) * Write a string. */ static void -prt_write_string(s) - char *s; +prt_write_string(char *s) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%s", s); prt_write_file(prt_line_buffer); @@ -1504,8 +1513,7 @@ prt_write_string(s) * Write an int and a space. */ static void -prt_write_int(i) - int i; +prt_write_int(int i) { sprintf((char *)prt_line_buffer, "%d ", i); prt_write_file(prt_line_buffer); @@ -1515,8 +1523,7 @@ prt_write_int(i) * Write a boolean and a space. */ static void -prt_write_boolean(b) - int b; +prt_write_boolean(int b) { sprintf((char *)prt_line_buffer, "%s ", (b ? "T" : "F")); prt_write_file(prt_line_buffer); @@ -1526,11 +1533,11 @@ prt_write_boolean(b) * Write PostScript to re-encode and define the font. */ static void -prt_def_font(new_name, encoding, height, font) - char *new_name; - char *encoding; - int height; - char *font; +prt_def_font( + char *new_name, + char *encoding, + int height, + char *font) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/_%s /VIM-%s /%s ref\n", new_name, encoding, font); @@ -1551,10 +1558,7 @@ prt_def_font(new_name, encoding, height, font) * Write a line to define the CID font. */ static void -prt_def_cidfont(new_name, height, cidfont) - char *new_name; - int height; - char *cidfont; +prt_def_cidfont(char *new_name, int height, char *cidfont) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/_%s /%s[/%s] vim_composefont\n", new_name, prt_cmap, cidfont); @@ -1568,9 +1572,7 @@ prt_def_cidfont(new_name, height, cidfont) * Write a line to define a duplicate of a CID font */ static void -prt_dup_cidfont(original_name, new_name) - char *original_name; - char *new_name; +prt_dup_cidfont(char *original_name, char *new_name) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s %s d\n", new_name, original_name); @@ -1584,11 +1586,11 @@ prt_dup_cidfont(original_name, new_name) * is also rounded based on the precision + 1'th fractional digit. */ static void -prt_real_bits(real, precision, pinteger, pfraction) - double real; - int precision; - int *pinteger; - int *pfraction; +prt_real_bits( + double real, + int precision, + int *pinteger, + int *pfraction) { int i; int integer; @@ -1611,9 +1613,7 @@ prt_real_bits(real, precision, pinteger, pfraction) * what decimal point character to use, but PS always requires a '.'. */ static void -prt_write_real(val, prec) - double val; - int prec; +prt_write_real(double val, int prec) { int integer; int fraction; @@ -1643,10 +1643,7 @@ prt_write_real(val, prec) * Write a line to define a numeric variable. */ static void -prt_def_var(name, value, prec) - char *name; - double value; - int prec; +prt_def_var(char *name, double value, int prec) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s ", name); @@ -1660,7 +1657,7 @@ prt_def_var(name, value, prec) #define PRT_PS_FONT_TO_USER(scale, size) ((size) * ((scale)/1000.0)) static void -prt_flush_buffer() +prt_flush_buffer(void) { if (prt_ps_buffer.ga_len > 0) { @@ -1742,9 +1739,7 @@ prt_flush_buffer() static void -prt_resource_name(filename, cookie) - char_u *filename; - void *cookie; +prt_resource_name(char_u *filename, void *cookie) { char_u *resource_filename = cookie; @@ -1755,9 +1750,7 @@ prt_resource_name(filename, cookie) } static int -prt_find_resource(name, resource) - char *name; - struct prt_ps_resource_S *resource; +prt_find_resource(char *name, struct prt_ps_resource_S *resource) { char_u *buffer; int retval; @@ -1773,7 +1766,7 @@ prt_find_resource(name, resource) vim_strcat(buffer, (char_u *)name, MAXPATHL); vim_strcat(buffer, (char_u *)".ps", MAXPATHL); resource->filename[0] = NUL; - retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name, + retval = (do_in_runtimepath(buffer, 0, prt_resource_name, resource->filename) && resource->filename[0] != NUL); vim_free(buffer); @@ -1798,7 +1791,7 @@ struct prt_resfile_buffer_S static struct prt_resfile_buffer_S prt_resfile; static int -prt_resfile_next_line() +prt_resfile_next_line(void) { int idx; @@ -1824,10 +1817,7 @@ prt_resfile_next_line() } static int -prt_resfile_strncmp(offset, string, len) - int offset; - char *string; - int len; +prt_resfile_strncmp(int offset, char *string, int len) { /* Force not equal if string is longer than remainder of line */ if (len > (prt_resfile.line_end - (prt_resfile.line_start + offset))) @@ -1838,8 +1828,7 @@ prt_resfile_strncmp(offset, string, len) } static int -prt_resfile_skip_nonws(offset) - int offset; +prt_resfile_skip_nonws(int offset) { int idx; @@ -1854,8 +1843,7 @@ prt_resfile_skip_nonws(offset) } static int -prt_resfile_skip_ws(offset) - int offset; +prt_resfile_skip_ws(int offset) { int idx; @@ -1872,8 +1860,7 @@ prt_resfile_skip_ws(offset) /* prt_next_dsc() - returns detail on next DSC comment line found. Returns true * if a DSC comment is found, else false */ static int -prt_next_dsc(p_dsc_line) - struct prt_dsc_line_S *p_dsc_line; +prt_next_dsc(struct prt_dsc_line_S *p_dsc_line) { int comment; int offset; @@ -1922,8 +1909,7 @@ prt_next_dsc(p_dsc_line) * PS resource file so the file details can be added to the DSC header comments. */ static int -prt_open_resource(resource) - struct prt_ps_resource_S *resource; +prt_open_resource(struct prt_ps_resource_S *resource) { int offset; int seen_all; @@ -2048,9 +2034,7 @@ prt_open_resource(resource) } static int -prt_check_resource(resource, version) - struct prt_ps_resource_S *resource; - char_u *version; +prt_check_resource(struct prt_ps_resource_S *resource, char_u *version) { /* Version number m.n should match, the revision number does not matter */ if (STRNCMP(resource->version, version, STRLEN(version))) @@ -2065,14 +2049,13 @@ prt_check_resource(resource, version) } static void -prt_dsc_start() +prt_dsc_start(void) { prt_write_string("%!PS-Adobe-3.0\n"); } static void -prt_dsc_noarg(comment) - char *comment; +prt_dsc_noarg(char *comment) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s\n", comment); @@ -2080,9 +2063,7 @@ prt_dsc_noarg(comment) } static void -prt_dsc_textline(comment, text) - char *comment; - char *text; +prt_dsc_textline(char *comment, char *text) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s: %s\n", comment, text); @@ -2090,9 +2071,7 @@ prt_dsc_textline(comment, text) } static void -prt_dsc_text(comment, text) - char *comment; - char *text; +prt_dsc_text(char *comment, char *text) { /* TODO - should scan 'text' for any chars needing escaping! */ vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), @@ -2103,10 +2082,7 @@ prt_dsc_text(comment, text) #define prt_dsc_atend(c) prt_dsc_text((c), "atend") static void -prt_dsc_ints(comment, count, ints) - char *comment; - int count; - int *ints; +prt_dsc_ints(char *comment, int count, int *ints) { int i; @@ -2124,10 +2100,10 @@ prt_dsc_ints(comment, count, ints) } static void -prt_dsc_resources(comment, type, string) - char *comment; /* if NULL add to previous */ - char *type; - char *string; +prt_dsc_resources( + char *comment, /* if NULL add to previous */ + char *type, + char *string) { if (comment != NULL) vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), @@ -2143,9 +2119,7 @@ prt_dsc_resources(comment, type, string) } static void -prt_dsc_font_resource(resource, ps_font) - char *resource; - struct prt_ps_font_S *ps_font; +prt_dsc_font_resource(char *resource, struct prt_ps_font_S *ps_font) { int i; @@ -2157,12 +2131,12 @@ prt_dsc_font_resource(resource, ps_font) } static void -prt_dsc_requirements(duplex, tumble, collate, color, num_copies) - int duplex; - int tumble; - int collate; - int color; - int num_copies; +prt_dsc_requirements( + int duplex, + int tumble, + int collate, + int color, + int num_copies) { /* Only output the comment if we need to. * Note: tumble is ignored if we are not duplexing @@ -2195,13 +2169,13 @@ prt_dsc_requirements(duplex, tumble, collate, color, num_copies) } static void -prt_dsc_docmedia(paper_name, width, height, weight, colour, type) - char *paper_name; - double width; - double height; - double weight; - char *colour; - char *type; +prt_dsc_docmedia( + char *paper_name, + double width, + double height, + double weight, + char *colour, + char *type) { vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%DocumentMedia: %s ", paper_name); @@ -2222,7 +2196,7 @@ prt_dsc_docmedia(paper_name, width, height, weight, colour, type) } void -mch_print_cleanup() +mch_print_cleanup(void) { #ifdef FEAT_MBYTE if (prt_out_mbyte) @@ -2236,8 +2210,7 @@ mch_print_cleanup() for (i = PRT_PS_FONT_ROMAN; i <= PRT_PS_FONT_BOLDOBLIQUE; i++) { if (prt_ps_mb_font.ps_fontname[i] != NULL) - vim_free(prt_ps_mb_font.ps_fontname[i]); - prt_ps_mb_font.ps_fontname[i] = NULL; + VIM_CLEAR(prt_ps_mb_font.ps_fontname[i]); } } @@ -2254,17 +2227,11 @@ mch_print_cleanup() prt_file_error = FALSE; } if (prt_ps_file_name != NULL) - { - vim_free(prt_ps_file_name); - prt_ps_file_name = NULL; - } + VIM_CLEAR(prt_ps_file_name); } static float -to_device_units(idx, physsize, def_number) - int idx; - double physsize; - int def_number; +to_device_units(int idx, double physsize, int def_number) { float ret; int u; @@ -2303,13 +2270,13 @@ to_device_units(idx, physsize, def_number) * Calculate margins for given width and height from printoptions settings. */ static void -prt_page_margins(width, height, left, right, top, bottom) - double width; - double height; - double *left; - double *right; - double *top; - double *bottom; +prt_page_margins( + double width, + double height, + double *left, + double *right, + double *top, + double *bottom) { *left = to_device_units(OPT_PRINT_LEFT, width, 10); *right = width - to_device_units(OPT_PRINT_RIGHT, width, 5); @@ -2318,8 +2285,7 @@ prt_page_margins(width, height, left, right, top, bottom) } static void -prt_font_metrics(font_scale) - int font_scale; +prt_font_metrics(int font_scale) { prt_line_height = (float)font_scale; prt_char_width = (float)PRT_PS_FONT_TO_USER(font_scale, prt_ps_font->wx); @@ -2327,7 +2293,7 @@ prt_font_metrics(font_scale) static int -prt_get_cpl() +prt_get_cpl(void) { if (prt_use_number()) { @@ -2349,10 +2315,7 @@ prt_get_cpl() #ifdef FEAT_MBYTE static int -prt_build_cid_fontname(font, name, name_len) - int font; - char_u *name; - int name_len; +prt_build_cid_fontname(int font, char_u *name, int name_len) { char *fontname; @@ -2370,7 +2333,7 @@ prt_build_cid_fontname(font, name, name_len) * Get number of lines of text that fit on a page (excluding the header). */ static int -prt_get_lpp() +prt_get_lpp(void) { int lpp; @@ -2402,10 +2365,10 @@ prt_get_lpp() #ifdef FEAT_MBYTE static int -prt_match_encoding(p_encoding, p_cmap, pp_mbenc) - char *p_encoding; - struct prt_ps_mbfont_S *p_cmap; - struct prt_ps_encoding_S **pp_mbenc; +prt_match_encoding( + char *p_encoding, + struct prt_ps_mbfont_S *p_cmap, + struct prt_ps_encoding_S **pp_mbenc) { int mbenc; int enc_len; @@ -2428,10 +2391,10 @@ prt_match_encoding(p_encoding, p_cmap, pp_mbenc) } static int -prt_match_charset(p_charset, p_cmap, pp_mbchar) - char *p_charset; - struct prt_ps_mbfont_S *p_cmap; - struct prt_ps_charset_S **pp_mbchar; +prt_match_charset( + char *p_charset, + struct prt_ps_mbfont_S *p_cmap, + struct prt_ps_charset_S **pp_mbchar) { int mbchar; int char_len; @@ -2456,10 +2419,10 @@ prt_match_charset(p_charset, p_cmap, pp_mbchar) #endif int -mch_print_init(psettings, jobname, forceit) - prt_settings_T *psettings; - char_u *jobname; - int forceit UNUSED; +mch_print_init( + prt_settings_T *psettings, + char_u *jobname, + int forceit UNUSED) { int i; char *paper_name; @@ -2513,13 +2476,18 @@ mch_print_init(psettings, jobname, forceit) props = enc_canon_props(p_encoding); if (!(props & ENC_8BIT) && ((*p_pmcs != NUL) || !(props & ENC_UNICODE))) { + int cmap_first = 0; + p_mbenc_first = NULL; for (cmap = 0; cmap < (int)NUM_ELEMENTS(prt_ps_mbfonts); cmap++) if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap], &p_mbenc)) { if (p_mbenc_first == NULL) + { p_mbenc_first = p_mbenc; + cmap_first = cmap; + } if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar)) break; @@ -2527,7 +2495,10 @@ mch_print_init(psettings, jobname, forceit) /* Use first encoding matched if no charset matched */ if (p_mbchar == NULL && p_mbenc_first != NULL) + { p_mbenc = p_mbenc_first; + cmap = cmap_first; + } } prt_out_mbyte = (p_mbenc != NULL); @@ -2751,7 +2722,7 @@ mch_print_init(psettings, jobname, forceit) /* If the user didn't specify a file name, use a temp file. */ if (psettings->outfile == NULL) { - prt_ps_file_name = vim_tempname('p'); + prt_ps_file_name = vim_tempname('p', TRUE); if (prt_ps_file_name == NULL) { EMSG(_(e_notmp)); @@ -2797,8 +2768,7 @@ mch_print_init(psettings, jobname, forceit) } static int -prt_add_resource(resource) - struct prt_ps_resource_S *resource; +prt_add_resource(struct prt_ps_resource_S *resource) { FILE* fd_resource; char_u resource_buffer[512]; @@ -2845,8 +2815,7 @@ prt_add_resource(resource) } int -mch_print_begin(psettings) - prt_settings_T *psettings; +mch_print_begin(prt_settings_T *psettings) { time_t now; int bbox[4]; @@ -2960,12 +2929,12 @@ mch_print_begin(psettings) if (!prt_find_resource("prolog", res_prolog)) { EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\"")); - return FALSE; + goto theend; } if (!prt_open_resource(res_prolog)) - return FALSE; + goto theend; if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION)) - return FALSE; + goto theend; #ifdef FEAT_MBYTE if (prt_out_mbyte) { @@ -2973,12 +2942,12 @@ mch_print_begin(psettings) if (!prt_find_resource("cidfont", res_cidfont)) { EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); - return FALSE; + goto theend; } if (!prt_open_resource(res_cidfont)) - return FALSE; + goto theend; if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION)) - return FALSE; + goto theend; } #endif @@ -3012,12 +2981,12 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), p_encoding); - return FALSE; + goto theend; } } } if (!prt_open_resource(res_encoding)) - return FALSE; + goto theend; /* For the moment there are no checks on encoding resource files to * perform */ #ifdef FEAT_MBYTE @@ -3034,10 +3003,10 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_ascii_encoding); - return FALSE; + goto theend; } if (!prt_open_resource(res_encoding)) - return FALSE; + goto theend; /* For the moment there are no checks on encoding resource files to * perform */ } @@ -3050,7 +3019,7 @@ mch_print_begin(psettings) { EMSG2(_("E620: Unable to convert to print encoding \"%s\""), p_encoding); - return FALSE; + goto theend; } prt_do_conv = TRUE; } @@ -3063,10 +3032,10 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_cmap); - return FALSE; + goto theend; } if (!prt_open_resource(res_cmap)) - return FALSE; + goto theend; } #endif @@ -3140,15 +3109,15 @@ mch_print_begin(psettings) /* Add required procsets - NOTE: order is important! */ if (!prt_add_resource(res_prolog)) - return FALSE; + goto theend; #ifdef FEAT_MBYTE if (prt_out_mbyte) { /* Add CID font procset, and any user supplied CMap */ if (!prt_add_resource(res_cidfont)) - return FALSE; + goto theend; if (prt_custom_cmap && !prt_add_resource(res_cmap)) - return FALSE; + goto theend; } #endif @@ -3158,7 +3127,7 @@ mch_print_begin(psettings) /* There will be only one Roman font encoding to be included in the PS * file. */ if (!prt_add_resource(res_encoding)) - return FALSE; + goto theend; prt_dsc_noarg("EndProlog"); @@ -3287,8 +3256,7 @@ mch_print_begin(psettings) } void -mch_print_end(psettings) - prt_settings_T *psettings; +mch_print_end(prt_settings_T *psettings) { prt_dsc_noarg("Trailer"); @@ -3325,7 +3293,7 @@ mch_print_end(psettings) } int -mch_print_end_page() +mch_print_end_page(void) { prt_flush_buffer(); @@ -3337,8 +3305,7 @@ mch_print_end_page() } int -mch_print_begin_page(str) - char_u *str UNUSED; +mch_print_begin_page(char_u *str UNUSED) { int page_num[2]; @@ -3379,7 +3346,7 @@ mch_print_begin_page(str) } int -mch_print_blank_page() +mch_print_blank_page(void) { return (mch_print_begin_page(NULL) ? (mch_print_end_page()) : FALSE); } @@ -3388,9 +3355,7 @@ static float prt_pos_x = 0; static float prt_pos_y = 0; void -mch_print_start_line(margin, page_line) - int margin; - int page_line; +mch_print_start_line(int margin, int page_line) { prt_pos_x = prt_left_margin; if (margin) @@ -3407,10 +3372,9 @@ mch_print_start_line(margin, page_line) } int -mch_print_text_out(p, len) - char_u *p; - int len UNUSED; +mch_print_text_out(char_u *textp, int len UNUSED) { + char_u *p = textp; int need_break; char_u ch; char_u ch_buff[8]; @@ -3419,6 +3383,7 @@ mch_print_text_out(p, len) #ifdef FEAT_MBYTE int in_ascii; int half_width; + char_u *tofree = NULL; #endif char_width = prt_char_width; @@ -3546,9 +3511,12 @@ mch_print_text_out(p, len) if (prt_do_conv) { /* Convert from multi-byte to 8-bit encoding */ - p = string_convert(&prt_conv, p, &len); + tofree = p = string_convert(&prt_conv, p, &len); if (p == NULL) + { p = (char_u *)""; + len = 0; + } } if (prt_out_mbyte) @@ -3556,7 +3524,7 @@ mch_print_text_out(p, len) /* Multi-byte character strings are represented more efficiently as hex * strings when outputting clean 8 bit PS. */ - do + while (len-- > 0) { ch = prt_hexchar[(unsigned)(*p) >> 4]; ga_append(&prt_ps_buffer, ch); @@ -3564,7 +3532,6 @@ mch_print_text_out(p, len) ga_append(&prt_ps_buffer, ch); p++; } - while (--len); } else #endif @@ -3611,8 +3578,7 @@ mch_print_text_out(p, len) #ifdef FEAT_MBYTE /* Need to free any translated characters */ - if (prt_do_conv && (*p != NUL)) - vim_free(p); + vim_free(tofree); #endif prt_text_run += char_width; @@ -3630,10 +3596,7 @@ mch_print_text_out(p, len) } void -mch_print_set_font(iBold, iItalic, iUnderline) - int iBold; - int iItalic; - int iUnderline; +mch_print_set_font(int iBold, int iItalic, int iUnderline) { int font = 0; @@ -3657,8 +3620,7 @@ mch_print_set_font(iBold, iItalic, iUnderline) } void -mch_print_set_bg(bgcol) - long_u bgcol; +mch_print_set_bg(long_u bgcol) { prt_bgcol = (int)bgcol; prt_attribute_change = TRUE; @@ -3666,8 +3628,7 @@ mch_print_set_bg(bgcol) } void -mch_print_set_fg(fgcol) - long_u fgcol; +mch_print_set_fg(long_u fgcol) { if (fgcol != (long_u)prt_fgcol) { diff --git a/src/hashtab.c b/src/hashtab.c index a47fa94b2d..4bf41e0dab 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -29,8 +29,6 @@ #include "vim.h" -#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO) - #if 0 # define HT_DEBUG /* extra checks for table consistency and statistics */ @@ -41,7 +39,7 @@ static long hash_count_perturb = 0; /* count number of "misses" */ /* Magic value for algorithm that walks through the array. */ #define PERTURB_SHIFT 5 -static int hash_may_resize __ARGS((hashtab_T *ht, int minitems)); +static int hash_may_resize(hashtab_T *ht, int minitems); #if 0 /* currently not used */ /* @@ -49,7 +47,7 @@ static int hash_may_resize __ARGS((hashtab_T *ht, int minitems)); * Returns NULL when out of memory. */ hashtab_T * -hash_create() +hash_create(void) { hashtab_T *ht; @@ -64,8 +62,7 @@ hash_create() * Initialize an empty hash table. */ void -hash_init(ht) - hashtab_T *ht; +hash_init(hashtab_T *ht) { /* This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray". */ vim_memset(ht, 0, sizeof(hashtab_T)); @@ -78,8 +75,7 @@ hash_init(ht) * If "ht" is not freed then you should call hash_init() next! */ void -hash_clear(ht) - hashtab_T *ht; +hash_clear(hashtab_T *ht) { if (ht->ht_array != ht->ht_smallarray) vim_free(ht->ht_array); @@ -91,9 +87,7 @@ hash_clear(ht) * memory to the location of the key (it's always positive). */ void -hash_clear_all(ht, off) - hashtab_T *ht; - int off; +hash_clear_all(hashtab_T *ht, int off) { long todo; hashitem_T *hi; @@ -119,9 +113,7 @@ hash_clear_all(ht, off) * (adding, setting or removing an item)! */ hashitem_T * -hash_find(ht, key) - hashtab_T *ht; - char_u *key; +hash_find(hashtab_T *ht, char_u *key) { return hash_lookup(ht, key, hash_hash(key)); } @@ -130,10 +122,7 @@ hash_find(ht, key) * Like hash_find(), but caller computes "hash". */ hashitem_T * -hash_lookup(ht, key, hash) - hashtab_T *ht; - char_u *key; - hash_T hash; +hash_lookup(hashtab_T *ht, char_u *key, hash_T hash) { hash_T perturb; hashitem_T *freeitem; @@ -195,7 +184,7 @@ hash_lookup(ht, key, hash) * Called when exiting. */ void -hash_debug_results() +hash_debug_results(void) { #ifdef HT_DEBUG fprintf(stderr, "\r\n\r\n\r\n\r\n"); @@ -211,9 +200,7 @@ hash_debug_results() * Returns FAIL when out of memory or the key is already present. */ int -hash_add(ht, key) - hashtab_T *ht; - char_u *key; +hash_add(hashtab_T *ht, char_u *key) { hash_T hash = hash_hash(key); hashitem_T *hi; @@ -221,7 +208,7 @@ hash_add(ht, key) hi = hash_lookup(ht, key, hash); if (!HASHITEM_EMPTY(hi)) { - EMSG2(_(e_intern2), "hash_add()"); + internal_error("hash_add()"); return FAIL; } return hash_add_item(ht, hi, key, hash); @@ -234,11 +221,11 @@ hash_add(ht, key) * Returns OK or FAIL (out of memory). */ int -hash_add_item(ht, hi, key, hash) - hashtab_T *ht; - hashitem_T *hi; - char_u *key; - hash_T hash; +hash_add_item( + hashtab_T *ht, + hashitem_T *hi, + char_u *key, + hash_T hash) { /* If resizing failed before and it fails again we can't add an item. */ if (ht->ht_error && hash_may_resize(ht, 0) == FAIL) @@ -265,9 +252,7 @@ hash_add_item(ht, hi, key, hash) * "hi" is invalid after this! */ void -hash_set(hi, key) - hashitem_T *hi; - char_u *key; +hash_set(hashitem_T *hi, char_u *key) { hi->hi_key = key; } @@ -279,9 +264,7 @@ hash_set(hi, key) * The caller must take care of freeing the item itself. */ void -hash_remove(ht, hi) - hashtab_T *ht; - hashitem_T *hi; +hash_remove(hashtab_T *ht, hashitem_T *hi) { --ht->ht_used; hi->hi_key = HI_KEY_REMOVED; @@ -294,8 +277,7 @@ hash_remove(ht, hi) * Must call hash_unlock() later. */ void -hash_lock(ht) - hashtab_T *ht; +hash_lock(hashtab_T *ht) { ++ht->ht_locked; } @@ -307,9 +289,7 @@ hash_lock(ht) * Must call hash_unlock() later. */ void -hash_lock_size(ht, size) - hashtab_T *ht; - int size; +hash_lock_size(hashtab_T *ht, int size) { (void)hash_may_resize(ht, size); ++ht->ht_locked; @@ -322,8 +302,7 @@ hash_lock_size(ht, size) * This must balance a call to hash_lock(). */ void -hash_unlock(ht) - hashtab_T *ht; +hash_unlock(hashtab_T *ht) { --ht->ht_locked; (void)hash_may_resize(ht, 0); @@ -335,9 +314,9 @@ hash_unlock(ht) * Returns OK or FAIL (out of memory). */ static int -hash_may_resize(ht, minitems) - hashtab_T *ht; - int minitems; /* minimal number of items */ +hash_may_resize( + hashtab_T *ht, + int minitems) /* minimal number of items */ { hashitem_T temparray[HT_INIT_SIZE]; hashitem_T *oldarray, *newarray; @@ -481,15 +460,13 @@ hash_may_resize(ht, minitems) * lower the percentage the better. */ hash_T -hash_hash(key) - char_u *key; +hash_hash(char_u *key) { hash_T hash; char_u *p; if ((hash = *key) == 0) - return (hash_T)0; /* Empty keys are not allowed, but we don't - want to crash if we get one. */ + return (hash_T)0; p = key + 1; /* A simplistic algorithm that appears to do very well. @@ -499,5 +476,3 @@ hash_hash(key) return hash; } - -#endif diff --git a/src/if_cscope.c b/src/if_cscope.c index 09982e6477..986663d951 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com> * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com> @@ -20,43 +20,43 @@ #endif #include "if_cscope.h" -static void cs_usage_msg __ARGS((csid_e x)); -static int cs_add __ARGS((exarg_T *eap)); -static void cs_stat_emsg __ARGS((char *fname)); -static int cs_add_common __ARGS((char *, char *, char *)); -static int cs_check_for_connections __ARGS((void)); -static int cs_check_for_tags __ARGS((void)); -static int cs_cnt_connections __ARGS((void)); -static void cs_reading_emsg __ARGS((int idx)); -static int cs_cnt_matches __ARGS((int idx)); -static char * cs_create_cmd __ARGS((char *csoption, char *pattern)); -static int cs_create_connection __ARGS((int i)); -static void do_cscope_general __ARGS((exarg_T *eap, int make_split)); +static void cs_usage_msg(csid_e x); +static int cs_add(exarg_T *eap); +static void cs_stat_emsg(char *fname); +static int cs_add_common(char *, char *, char *); +static int cs_check_for_connections(void); +static int cs_check_for_tags(void); +static int cs_cnt_connections(void); +static void cs_reading_emsg(int idx); +static int cs_cnt_matches(int idx); +static char * cs_create_cmd(char *csoption, char *pattern); +static int cs_create_connection(int i); +static void do_cscope_general(exarg_T *eap, int make_split); #ifdef FEAT_QUICKFIX -static void cs_file_results __ARGS((FILE *, int *)); +static void cs_file_results(FILE *, int *); #endif -static void cs_fill_results __ARGS((char *, int , int *, char ***, - char ***, int *)); -static int cs_find __ARGS((exarg_T *eap)); -static int cs_find_common __ARGS((char *opt, char *pat, int, int, int, char_u *cmdline)); -static int cs_help __ARGS((exarg_T *eap)); -static void clear_csinfo __ARGS((int i)); -static int cs_insert_filelist __ARGS((char *, char *, char *, - struct stat *)); -static int cs_kill __ARGS((exarg_T *eap)); -static void cs_kill_execute __ARGS((int, char *)); -static cscmd_T * cs_lookup_cmd __ARGS((exarg_T *eap)); -static char * cs_make_vim_style_matches __ARGS((char *, char *, - char *, char *)); -static char * cs_manage_matches __ARGS((char **, char **, int, mcmd_e)); -static char * cs_parse_results __ARGS((int cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search)); -static char * cs_pathcomponents __ARGS((char *path)); -static void cs_print_tags_priv __ARGS((char **, char **, int)); -static int cs_read_prompt __ARGS((int)); -static void cs_release_csp __ARGS((int, int freefnpp)); -static int cs_reset __ARGS((exarg_T *eap)); -static char * cs_resolve_file __ARGS((int, char *)); -static int cs_show __ARGS((exarg_T *eap)); +static void cs_fill_results(char *, int , int *, char ***, + char ***, int *); +static int cs_find(exarg_T *eap); +static int cs_find_common(char *opt, char *pat, int, int, int, char_u *cmdline); +static int cs_help(exarg_T *eap); +static void clear_csinfo(int i); +static int cs_insert_filelist(char *, char *, char *, + stat_T *); +static int cs_kill(exarg_T *eap); +static void cs_kill_execute(int, char *); +static cscmd_T * cs_lookup_cmd(exarg_T *eap); +static char * cs_make_vim_style_matches(char *, char *, + char *, char *); +static char * cs_manage_matches(char **, char **, int, mcmd_e); +static char * cs_parse_results(int cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search); +static char * cs_pathcomponents(char *path); +static void cs_print_tags_priv(char **, char **, int); +static int cs_read_prompt(int); +static void cs_release_csp(int, int freefnpp); +static int cs_reset(exarg_T *eap); +static char * cs_resolve_file(int, char *); +static int cs_show(exarg_T *eap); static csinfo_T * csinfo = NULL; @@ -70,7 +70,7 @@ static cscmd_T cs_cmds[] = { "add", cs_add, N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 }, { "find", cs_find, - N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 }, + N_("Query for a pattern"), "find a|c|d|e|f|g|i|s|t name", 1 }, { "help", cs_help, N_("Show this message"), "help", 0 }, { "kill", cs_kill, @@ -83,8 +83,7 @@ static cscmd_T cs_cmds[] = }; static void -cs_usage_msg(x) - csid_e x; +cs_usage_msg(csid_e x) { (void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage); } @@ -104,9 +103,7 @@ static enum * expansion. */ char_u * -get_cscope_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_cscope_name(expand_T *xp UNUSED, int idx) { int current_idx; int i; @@ -129,12 +126,12 @@ get_cscope_name(xp, idx) { const char *query_type[] = { - "c", "d", "e", "f", "g", "i", "s", "t", NULL + "a", "c", "d", "e", "f", "g", "i", "s", "t", NULL }; /* Complete with query type of ":cscope find {query_type}". - * {query_type} can be letters (c, d, ... t) or numbers (0, 1, - * ..., 8) but only complete with letters, since numbers are + * {query_type} can be letters (c, d, ... a) or numbers (0, 1, + * ..., 9) but only complete with letters, since numbers are * redundant. */ return (char_u *)query_type[idx]; } @@ -167,10 +164,10 @@ get_cscope_name(xp, idx) * Handle command line completion for :cscope command. */ void -set_context_in_cscope_cmd(xp, arg, cmdidx) - expand_T *xp; - char_u *arg; - cmdidx_T cmdidx; +set_context_in_cscope_cmd( + expand_T *xp, + char_u *arg, + cmdidx_T cmdidx) { char_u *p; @@ -204,15 +201,13 @@ set_context_in_cscope_cmd(xp, arg, cmdidx) #endif /* FEAT_CMDL_COMPL */ /* - * PRIVATE: do_cscope_general - * * Find the command, print help if invalid, and then call the corresponding * command function. */ static void -do_cscope_general(eap, make_split) - exarg_T *eap; - int make_split; /* whether to split window */ +do_cscope_general( + exarg_T *eap, + int make_split UNUSED) /* whether to split window */ { cscmd_T *cmdp; @@ -222,7 +217,6 @@ do_cscope_general(eap, make_split) return; } -#ifdef FEAT_WINDOWS if (make_split) { if (!cmdp->cansplit) @@ -234,45 +228,36 @@ do_cscope_general(eap, make_split) postponed_split_flags = cmdmod.split; postponed_split_tab = cmdmod.tab; } -#endif cmdp->func(eap); -#ifdef FEAT_WINDOWS postponed_split_flags = 0; postponed_split_tab = 0; -#endif } /* - * PUBLIC: do_cscope + * Implementation of ":cscope" and ":lcscope" */ void -do_cscope(eap) - exarg_T *eap; +ex_cscope(exarg_T *eap) { do_cscope_general(eap, FALSE); } /* - * PUBLIC: do_scscope - * - * same as do_cscope, but splits window, too. + * Implementation of ":scscope". Same as ex_cscope(), but splits window, too. */ void -do_scscope(eap) - exarg_T *eap; +ex_scscope(exarg_T *eap) { do_cscope_general(eap, TRUE); } /* - * PUBLIC: do_cstag - * + * Implementation of ":cstag" */ void -do_cstag(eap) - exarg_T *eap; +ex_cstag(exarg_T *eap) { int ret = FALSE; @@ -337,26 +322,22 @@ do_cstag(eap) if (!ret) { (void)EMSG(_("E257: cstag: tag not found")); -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif } -} /* do_cscope */ +} /* - * PUBLIC: cs_find - * - * this simulates a vim_fgets(), but for cscope, returns the next line + * This simulates a vim_fgets(), but for cscope, returns the next line * from the cscope output. should only be called from find_tags() * * returns TRUE if eof, FALSE otherwise */ int -cs_fgets(buf, size) - char_u *buf; - int size; +cs_fgets(char_u *buf, int size) { char *p; @@ -369,24 +350,20 @@ cs_fgets(buf, size) /* - * PUBLIC: cs_free_tags - * - * called only from do_tag(), when popping the tag stack + * Called only from do_tag(), when popping the tag stack. */ void -cs_free_tags() +cs_free_tags(void) { cs_manage_matches(NULL, NULL, -1, Free); } /* - * PUBLIC: cs_print_tags - * - * called from do_tag() + * Called from do_tag(). */ void -cs_print_tags() +cs_print_tags(void) { cs_manage_matches(NULL, NULL, -1, Print); } @@ -421,10 +398,7 @@ cs_print_tags() */ #if defined(FEAT_EVAL) || defined(PROTO) int -cs_connection(num, dbpath, ppath) - int num; - char_u *dbpath; - char_u *ppath; +cs_connection(int num, char_u *dbpath, char_u *ppath) { int i; @@ -478,16 +452,11 @@ cs_connection(num, dbpath, ppath) ****************************************************************************/ /* - * PRIVATE: cs_add - * - * add cscope database or a directory name (to look for cscope.out) - * to the cscope connection list - * - * MAXPATHL 256 + * Add cscope database or a directory name (to look for cscope.out) + * to the cscope connection list. */ static int -cs_add(eap) - exarg_T *eap UNUSED; +cs_add(exarg_T *eap UNUSED) { char *fname, *ppath, *flags = NULL; @@ -503,8 +472,7 @@ cs_add(eap) } static void -cs_stat_emsg(fname) - char *fname; +cs_stat_emsg(char *fname) { char *stat_emsg = _("E563: stat(%s) error: %d"); char *buf = (char *)alloc((unsigned)strlen(stat_emsg) + MAXPATHL + 10); @@ -521,19 +489,17 @@ cs_stat_emsg(fname) /* - * PRIVATE: cs_add_common - * - * the common routine to add a new cscope connection. called by - * cs_add() and cs_reset(). i really don't like to do this, but this + * The common routine to add a new cscope connection. Called by + * cs_add() and cs_reset(). I really don't like to do this, but this * routine uses a number of goto statements. */ static int -cs_add_common(arg1, arg2, flags) - char *arg1; /* filename - may contain environment variables */ - char *arg2; /* prepend path - may contain environment variables */ - char *flags; +cs_add_common( + char *arg1, /* filename - may contain environment variables */ + char *arg2, /* prepend path - may contain environment variables */ + char *flags) { - struct stat statbuf; + stat_T statbuf; int ret; char *fname = NULL; char *fname2 = NULL; @@ -560,7 +526,7 @@ cs_add_common(arg1, arg2, flags) fname = (char *)vim_strnsave((char_u *)fname, len); vim_free(fbuf); #endif - ret = stat(fname, &statbuf); + ret = mch_stat(fname, &statbuf); if (ret < 0) { staterr: @@ -572,13 +538,13 @@ cs_add_common(arg1, arg2, flags) /* get the prepend path (arg2), expand it, and try to stat it */ if (arg2 != NULL) { - struct stat statbuf2; + stat_T statbuf2; if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL) goto add_err; expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL); - ret = stat(ppath, &statbuf2); + ret = mch_stat(ppath, &statbuf2); if (ret < 0) goto staterr; } @@ -605,7 +571,7 @@ cs_add_common(arg1, arg2, flags) else (void)sprintf(fname2, "%s/%s", fname, CSCOPE_DBFILE); - ret = stat(fname2, &statbuf); + ret = mch_stat(fname2, &statbuf); if (ret < 0) { if (p_csverbose) @@ -645,7 +611,7 @@ cs_add_common(arg1, arg2, flags) if (p_csverbose) { msg_clr_eos(); - (void)smsg_attr(hl_attr(HLF_R), + (void)smsg_attr(HL_ATTR(HLF_R), (char_u *)_("Added cscope database %s"), csinfo[i].fname); } @@ -665,26 +631,24 @@ cs_add_common(arg1, arg2, flags) static int -cs_check_for_connections() +cs_check_for_connections(void) { return (cs_cnt_connections() > 0); } /* cs_check_for_connections */ static int -cs_check_for_tags() +cs_check_for_tags(void) { return (p_tags[0] != NUL && curbuf->b_p_tags != NULL); } /* cs_check_for_tags */ /* - * PRIVATE: cs_cnt_connections - * - * count the number of cscope connections + * Count the number of cscope connections. */ static int -cs_cnt_connections() +cs_cnt_connections(void) { short i; short cnt = 0; @@ -698,25 +662,22 @@ cs_cnt_connections() } /* cs_cnt_connections */ static void -cs_reading_emsg(idx) - int idx; /* connection index */ +cs_reading_emsg( + int idx) /* connection index */ { EMSGN(_("E262: error reading cscope connection %ld"), idx); } #define CSREAD_BUFSIZE 2048 /* - * PRIVATE: cs_cnt_matches - * - * count the number of matches for a given cscope connection. + * Count the number of matches for a given cscope connection. */ static int -cs_cnt_matches(idx) - int idx; +cs_cnt_matches(int idx) { char *stok; char *buf; - int nlines; + int nlines = 0; buf = (char *)alloc(CSREAD_BUFSIZE); if (buf == NULL) @@ -739,7 +700,10 @@ cs_cnt_matches(idx) * cscope will output error messages before the number-of-lines output. * Display/discard any output that doesn't match what we want. * Accept "\S*cscope: X lines", also matches "mlcscope". + * Bail out for the "Unable to search" error. */ + if (strstr((const char *)buf, "Unable to search database") != NULL) + break; if ((stok = strtok(buf, (const char *)" ")) == NULL) continue; if (strstr((const char *)stok, "cscope:") == NULL) @@ -768,14 +732,10 @@ cs_cnt_matches(idx) /* - * PRIVATE: cs_create_cmd - * * Creates the actual cscope command query from what the user entered. */ static char * -cs_create_cmd(csoption, pattern) - char *csoption; - char *pattern; +cs_create_cmd(char *csoption, char *pattern) { char *cmd; short search; @@ -807,6 +767,9 @@ cs_create_cmd(csoption, pattern) case '8' : case 'i' : search = 8; break; + case '9' : case 'a' : + search = 9; + break; default : (void)EMSG(_("E561: unknown cscope search type")); cs_usage_msg(Find); @@ -817,7 +780,7 @@ cs_create_cmd(csoption, pattern) * they may want to use the leading white space. */ pat = pattern; if (search != 4 && search != 6) - while vim_iswhite(*pat) + while VIM_ISWHITE(*pat) ++pat; if ((cmd = (char *)alloc((unsigned)(strlen(pat) + 2))) == NULL) @@ -830,14 +793,11 @@ cs_create_cmd(csoption, pattern) /* - * PRIVATE: cs_create_connection - * * This piece of code was taken/adapted from nvi. do we need to add * the BSD license notice? */ static int -cs_create_connection(i) - int i; +cs_create_connection(int i) { #ifdef UNIX int to_cs[2], from_cs[2]; @@ -853,14 +813,10 @@ cs_create_connection(i) HANDLE stdin_rd, stdout_rd; HANDLE stdout_wr, stdin_wr; BOOL created; -# ifdef __BORLANDC__ -# define OPEN_OH_ARGTYPE long +# if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) +# define OPEN_OH_ARGTYPE intptr_t # else -# if (_MSC_VER >= 1300) -# define OPEN_OH_ARGTYPE intptr_t -# else -# define OPEN_OH_ARGTYPE long -# endif +# define OPEN_OH_ARGTYPE long # endif #endif @@ -1074,16 +1030,13 @@ cs_create_connection(i) /* - * PRIVATE: cs_find - * - * query cscope using command line interface. parse the output and use tselect - * to allow choices. like Nvi, creates a pipe to send to/from query/cscope. + * Query cscope using command line interface. Parse the output and use tselect + * to allow choices. Like Nvi, creates a pipe to send to/from query/cscope. * * returns TRUE if we jump to a tag or abort, FALSE if not. */ static int -cs_find(eap) - exarg_T *eap; +cs_find(exarg_T *eap) { char *opt, *pat; int i; @@ -1121,18 +1074,16 @@ cs_find(eap) /* - * PRIVATE: cs_find_common - * - * common code for cscope find, shared by cs_find() and do_cstag() + * Common code for cscope find, shared by cs_find() and ex_cstag(). */ static int -cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) - char *opt; - char *pat; - int forceit; - int verbose; - int use_ll; - char_u *cmdline; +cs_find_common( + char *opt, + char *pat, + int forceit, + int verbose, + int use_ll UNUSED, + char_u *cmdline UNUSED) { int i; char *cmd; @@ -1169,6 +1120,9 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) case '8' : cmdletter = 'i'; break; + case '9' : + cmdletter = 'a'; + break; default : cmdletter = opt[0]; } @@ -1193,17 +1147,15 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) return FALSE; } -# ifdef FEAT_AUTOCMD - if (*qfpos != '0') + if (*qfpos != '0' + && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", - curbuf->b_fname, TRUE, curbuf); -# ifdef FEAT_EVAL - if (did_throw || force_abort) +# ifdef FEAT_EVAL + if (aborting()) return FALSE; -# endif - } # endif + } } #endif @@ -1214,7 +1166,10 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) nummatches = (int *)alloc(sizeof(int)*csinfo_size); if (nummatches == NULL) + { + vim_free(cmd); return FALSE; + } /* Send query to all open connections, then count the total number * of matches so we can alloc all in one swell foop. */ @@ -1269,7 +1224,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) { /* fill error list */ FILE *f; - char_u *tmp = vim_tempname('c'); + char_u *tmp = vim_tempname('c', TRUE); qf_info_T *qi = NULL; win_T *wp = NULL; @@ -1284,22 +1239,18 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) wp = curwin; /* '-' starts a new error list */ if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m", - *qfpos == '-', cmdline) > 0) + *qfpos == '-', cmdline, NULL) > 0) { -# ifdef FEAT_WINDOWS if (postponed_split != 0) { - win_split(postponed_split > 0 ? postponed_split : 0, + (void)win_split(postponed_split > 0 ? postponed_split : 0, postponed_split_flags); RESET_BINDING(curwin); postponed_split = 0; } -# endif -# ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf); -# endif if (use_ll) /* * In the location list window, use the displayed location @@ -1336,13 +1287,10 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) } /* cs_find_common */ /* - * PRIVATE: cs_help - * - * print help + * Print help. */ static int -cs_help(eap) - exarg_T *eap UNUSED; +cs_help(exarg_T *eap UNUSED) { cscmd_T *cmdp = cs_cmds; @@ -1361,6 +1309,7 @@ cs_help(eap) cmdp->usage); if (strcmp(cmdp->name, "find") == 0) MSG_PUTS(_("\n" + " a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -1379,8 +1328,7 @@ cs_help(eap) static void -clear_csinfo(i) - int i; +clear_csinfo(int i) { csinfo[i].fname = NULL; csinfo[i].ppath = NULL; @@ -1402,10 +1350,10 @@ clear_csinfo(i) } #ifndef UNIX -static char *GetWin32Error __ARGS((void)); +static char *GetWin32Error(void); static char * -GetWin32Error() +GetWin32Error(void) { char *msg = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, @@ -1422,26 +1370,21 @@ GetWin32Error() #endif /* - * PRIVATE: cs_insert_filelist - * - * insert a new cscope database filename into the filelist + * Insert a new cscope database filename into the filelist. */ static int -cs_insert_filelist(fname, ppath, flags, sb) - char *fname; - char *ppath; - char *flags; - struct stat *sb UNUSED; +cs_insert_filelist( + char *fname, + char *ppath, + char *flags, + stat_T *sb UNUSED) { short i, j; #ifndef UNIX BY_HANDLE_FILE_INFORMATION bhfi; - /* On windows 9x GetFileInformationByHandle doesn't work, so skip it */ - if (!mch_windows95()) + switch (win32_fileinfo((char_u *)fname, &bhfi)) { - switch (win32_fileinfo(fname, &bhfi)) - { case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */ case FILEINFO_READ_FAIL: /* CreateFile() failed */ if (p_csverbose) @@ -1464,7 +1407,6 @@ cs_insert_filelist(fname, ppath, flags, sb) if (p_csverbose) (void)EMSG(_("E626: cannot get cscope database information")); return -1; - } } #endif @@ -1476,10 +1418,10 @@ cs_insert_filelist(fname, ppath, flags, sb) && csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino #else /* compare pathnames first */ - && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME) - /* if not Windows 9x, test index file attributes too */ - || (!mch_windows95() - && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber + && ((fullpathcmp((char_u *)csinfo[j].fname, + (char_u *)fname, FALSE) & FPC_SAME) + /* test index file attributes too */ + || (csinfo[j].nVolume == bhfi.dwVolumeSerialNumber && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh && csinfo[j].nIndexLow == bhfi.nFileIndexLow)) #endif @@ -1507,9 +1449,16 @@ cs_insert_filelist(fname, ppath, flags, sb) } else { + csinfo_T *t_csinfo = csinfo; + /* Reallocate space for more connections. */ csinfo_size *= 2; csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size); + if (csinfo == NULL) + { + vim_free(t_csinfo); + csinfo_size = 0; + } } if (csinfo == NULL) return -1; @@ -1526,8 +1475,7 @@ cs_insert_filelist(fname, ppath, flags, sb) { if ((csinfo[i].ppath = (char *)alloc((unsigned)strlen(ppath) + 1)) == NULL) { - vim_free(csinfo[i].fname); - csinfo[i].fname = NULL; + VIM_CLEAR(csinfo[i].fname); return -1; } (void)strcpy(csinfo[i].ppath, (const char *)ppath); @@ -1538,10 +1486,8 @@ cs_insert_filelist(fname, ppath, flags, sb) { if ((csinfo[i].flags = (char *)alloc((unsigned)strlen(flags) + 1)) == NULL) { - vim_free(csinfo[i].fname); - vim_free(csinfo[i].ppath); - csinfo[i].fname = NULL; - csinfo[i].ppath = NULL; + VIM_CLEAR(csinfo[i].fname); + VIM_CLEAR(csinfo[i].ppath); return -1; } (void)strcpy(csinfo[i].flags, (const char *)flags); @@ -1562,13 +1508,10 @@ cs_insert_filelist(fname, ppath, flags, sb) /* - * PRIVATE: cs_lookup_cmd - * - * find cscope command in command table + * Find cscope command in command table. */ static cscmd_T * -cs_lookup_cmd(eap) - exarg_T *eap; +cs_lookup_cmd(exarg_T *eap) { cscmd_T *cmdp; char *stok; @@ -1594,13 +1537,10 @@ cs_lookup_cmd(eap) /* - * PRIVATE: cs_kill - * - * nuke em + * Nuke em. */ static int -cs_kill(eap) - exarg_T *eap UNUSED; +cs_kill(exarg_T *eap UNUSED) { char *stok; short i; @@ -1652,19 +1592,17 @@ cs_kill(eap) /* - * PRIVATE: cs_kill_execute - * * Actually kills a specific cscope connection. */ static void -cs_kill_execute(i, cname) - int i; /* cscope table index */ - char *cname; /* cscope database name */ +cs_kill_execute( + int i, /* cscope table index */ + char *cname) /* cscope database name */ { if (p_csverbose) { msg_clr_eos(); - (void)smsg_attr(hl_attr(HLF_R) | MSG_HIST, + (void)smsg_attr(HL_ATTR(HLF_R) | MSG_HIST, (char_u *)_("cscope connection %s closed"), cname); } cs_release_csp(i, TRUE); @@ -1672,31 +1610,29 @@ cs_kill_execute(i, cname) /* - * PRIVATE: cs_make_vim_style_matches - * - * convert the cscope output into a ctags style entry (as might be found + * Convert the cscope output into a ctags style entry (as might be found * in a ctags tags file). there's one catch though: cscope doesn't tell you * the type of the tag you are looking for. for example, in Darren Hiebert's * ctags (the one that comes with vim), #define's use a line number to find the * tag in a file while function definitions use a regexp search pattern. * - * i'm going to always use the line number because cscope does something + * I'm going to always use the line number because cscope does something * quirky (and probably other things i don't know about): * * if you have "# define" in your source file, which is * perfectly legal, cscope thinks you have "#define". this * will result in a failed regexp search. :( * - * besides, even if this particular case didn't happen, the search pattern + * Besides, even if this particular case didn't happen, the search pattern * would still have to be modified to escape all the special regular expression * characters to comply with ctags formatting. */ static char * -cs_make_vim_style_matches(fname, slno, search, tagstr) - char *fname; - char *slno; - char *search; - char *tagstr; +cs_make_vim_style_matches( + char *fname, + char *slno, + char *search, + char *tagstr) { /* vim style is ctags: * @@ -1734,9 +1670,7 @@ cs_make_vim_style_matches(fname, slno, search, tagstr) /* - * PRIVATE: cs_manage_matches - * - * this is kind of hokey, but i don't see an easy way round this.. + * This is kind of hokey, but i don't see an easy way round this. * * Store: keep a ptr to the (malloc'd) memory of matches originally * generated from cs_find(). the matches are originally lines directly @@ -1752,11 +1686,11 @@ cs_make_vim_style_matches(fname, slno, search, tagstr) * Print: prints the tags */ static char * -cs_manage_matches(matches, contexts, totmatches, cmd) - char **matches; - char **contexts; - int totmatches; - mcmd_e cmd; +cs_manage_matches( + char **matches, + char **contexts, + int totmatches, + mcmd_e cmd) { static char **mp = NULL; static char **cp = NULL; @@ -1805,7 +1739,7 @@ cs_manage_matches(matches, contexts, totmatches, cmd) cs_print_tags_priv(mp, cp, cnt); break; default: /* should not reach here */ - (void)EMSG(_("E570: fatal error in cs_manage_matches")); + IEMSG(_("E570: fatal error in cs_manage_matches")); return NULL; } @@ -1814,18 +1748,16 @@ cs_manage_matches(matches, contexts, totmatches, cmd) /* - * PRIVATE: cs_parse_results - * - * parse cscope output + * Parse cscope output. */ static char * -cs_parse_results(cnumber, buf, bufsize, context, linenumber, search) - int cnumber; - char *buf; - int bufsize; - char **context; - char **linenumber; - char **search; +cs_parse_results( + int cnumber, + char *buf, + int bufsize, + char **context, + char **linenumber, + char **search) { int ch; char *p; @@ -1877,14 +1809,10 @@ cs_parse_results(cnumber, buf, bufsize, context, linenumber, search) #ifdef FEAT_QUICKFIX /* - * PRIVATE: cs_file_results - * - * write cscope find results to file + * Write cscope find results to file. */ static void -cs_file_results(f, nummatches_a) - FILE *f; - int *nummatches_a; +cs_file_results(FILE *f, int *nummatches_a) { int i, j; char *buf; @@ -1934,20 +1862,18 @@ cs_file_results(f, nummatches_a) #endif /* - * PRIVATE: cs_fill_results - * - * get parsed cscope output and calls cs_make_vim_style_matches to convert - * into ctags format + * Get parsed cscope output and calls cs_make_vim_style_matches to convert + * into ctags format. * When there are no matches sets "*matches_p" to NULL. */ static void -cs_fill_results(tagstr, totmatches, nummatches_a, matches_p, cntxts_p, matched) - char *tagstr; - int totmatches; - int *nummatches_a; - char ***matches_p; - char ***cntxts_p; - int *matched; +cs_fill_results( + char *tagstr, + int totmatches, + int *nummatches_a, + char ***matches_p, + char ***cntxts_p, + int *matched) { int i, j; char *buf; @@ -2006,10 +1932,8 @@ cs_fill_results(tagstr, totmatches, nummatches_a, matches_p, cntxts_p, matched) if (totsofar == 0) { /* No matches, free the arrays and return NULL in "*matches_p". */ - vim_free(matches); - matches = NULL; - vim_free(cntxts); - cntxts = NULL; + VIM_CLEAR(matches); + VIM_CLEAR(cntxts); } *matched = totsofar; *matches_p = matches; @@ -2021,8 +1945,7 @@ cs_fill_results(tagstr, totmatches, nummatches_a, matches_p, cntxts_p, matched) /* get the requested path components */ static char * -cs_pathcomponents(path) - char *path; +cs_pathcomponents(char *path) { int i; char *s; @@ -2048,17 +1971,13 @@ cs_pathcomponents(path) } /* - * PRIVATE: cs_print_tags_priv - * - * called from cs_manage_matches() + * Called from cs_manage_matches(). */ static void -cs_print_tags_priv(matches, cntxts, num_matches) - char **matches; - char **cntxts; - int num_matches; +cs_print_tags_priv(char **matches, char **cntxts, int num_matches) { char *buf = NULL; + char *t_buf; int bufsize = 0; /* Track available bufsize */ int newsize = 0; char *ptag; @@ -2070,13 +1989,18 @@ cs_print_tags_priv(matches, cntxts, num_matches) char *cstag_msg = _("Cscope tag: %s"); char *csfmt_str = "%4d %6s "; - assert (num_matches > 0); + assert(num_matches > 0); if ((tbuf = (char *)alloc((unsigned)strlen(matches[0]) + 1)) == NULL) return; strcpy(tbuf, matches[0]); ptag = strtok(tbuf, "\t"); + if (ptag == NULL) + { + vim_free(tbuf); + return; + } newsize = (int)(strlen(cstag_msg) + strlen(ptag)); buf = (char *)alloc(newsize); @@ -2084,14 +2008,14 @@ cs_print_tags_priv(matches, cntxts, num_matches) { bufsize = newsize; (void)sprintf(buf, cstag_msg, ptag); - MSG_PUTS_ATTR(buf, hl_attr(HLF_T)); + MSG_PUTS_ATTR(buf, HL_ATTR(HLF_T)); } vim_free(tbuf); - MSG_PUTS_ATTR(_("\n # line"), hl_attr(HLF_T)); /* strlen is 7 */ + MSG_PUTS_ATTR(_("\n # line"), HL_ATTR(HLF_T)); /* strlen is 7 */ msg_advance(msg_col + 2); - MSG_PUTS_ATTR(_("filename / context / line\n"), hl_attr(HLF_T)); + MSG_PUTS_ATTR(_("filename / context / line\n"), HL_ATTR(HLF_T)); num = 1; for (i = 0; i < num_matches; i++) @@ -2106,12 +2030,13 @@ cs_print_tags_priv(matches, cntxts, num_matches) continue; (void)strcpy(tbuf, matches[idx]); - if (strtok(tbuf, (const char *)"\t") == NULL) - continue; - if ((fname = strtok(NULL, (const char *)"\t")) == NULL) - continue; - if ((lno = strtok(NULL, (const char *)"\t")) == NULL) + if (strtok(tbuf, (const char *)"\t") == NULL + || (fname = strtok(NULL, (const char *)"\t")) == NULL + || (lno = strtok(NULL, (const char *)"\t")) == NULL) + { + vim_free(tbuf); continue; + } extra = strtok(NULL, (const char *)"\t"); lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ @@ -2120,9 +2045,13 @@ cs_print_tags_priv(matches, cntxts, num_matches) newsize = (int)(strlen(csfmt_str) + 16 + strlen(lno)); if (bufsize < newsize) { + t_buf = buf; buf = (char *)vim_realloc(buf, newsize); if (buf == NULL) + { bufsize = 0; + vim_free(t_buf); + } else bufsize = newsize; } @@ -2130,9 +2059,9 @@ cs_print_tags_priv(matches, cntxts, num_matches) { /* csfmt_str = "%4d %6s "; */ (void)sprintf(buf, csfmt_str, num, lno); - MSG_PUTS_ATTR(buf, hl_attr(HLF_CM)); + MSG_PUTS_ATTR(buf, HL_ATTR(HLF_CM)); } - MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM)); + MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), HL_ATTR(HLF_CM)); /* compute the required space for the context */ if (cntxts[idx] != NULL) @@ -2143,9 +2072,13 @@ cs_print_tags_priv(matches, cntxts, num_matches) if (bufsize < newsize) { + t_buf = buf; buf = (char *)vim_realloc(buf, newsize); if (buf == NULL) + { bufsize = 0; + vim_free(t_buf); + } else bufsize = newsize; } @@ -2186,13 +2119,10 @@ cs_print_tags_priv(matches, cntxts, num_matches) /* - * PRIVATE: cs_read_prompt - * - * read a cscope prompt (basically, skip over the ">> ") + * Read a cscope prompt (basically, skip over the ">> "). */ static int -cs_read_prompt(i) - int i; +cs_read_prompt(int i) { int ch; char *buf = NULL; /* buffer for possible error message from cscope */ @@ -2285,15 +2215,11 @@ sig_handler SIGDEFARG(sigarg) #endif /* - * PRIVATE: cs_release_csp - * * Does the actual free'ing for the cs ptr with an optional flag of whether * or not to free the filename. Called by cs_kill and cs_reset. */ static void -cs_release_csp(i, freefnpp) - int i; - int freefnpp; +cs_release_csp(int i, int freefnpp) { /* * Trying to exit normally (not sure whether it is fit to UNIX cscope @@ -2415,13 +2341,10 @@ cs_release_csp(i, freefnpp) /* - * PRIVATE: cs_reset - * - * calls cs_kill on all cscope connections then reinits + * Calls cs_kill on all cscope connections then reinits. */ static int -cs_reset(eap) - exarg_T *eap UNUSED; +cs_reset(exarg_T *eap UNUSED) { char **dblist = NULL, **pplist = NULL, **fllist = NULL; int i; @@ -2464,7 +2387,7 @@ cs_reset(eap) * "Added cscope database..." */ sprintf(buf, " (#%d)", i); - MSG_PUTS_ATTR(buf, hl_attr(HLF_R)); + MSG_PUTS_ATTR(buf, HL_ATTR(HLF_R)); } } vim_free(dblist[i]); @@ -2476,14 +2399,12 @@ cs_reset(eap) vim_free(fllist); if (p_csverbose) - MSG_ATTR(_("All cscope databases reset"), hl_attr(HLF_R) | MSG_HIST); + MSG_ATTR(_("All cscope databases reset"), HL_ATTR(HLF_R) | MSG_HIST); return CSCOPE_SUCCESS; } /* cs_reset */ /* - * PRIVATE: cs_resolve_file - * * Construct the full pathname to a file found in the cscope database. * (Prepends ppath, if there is one and if it's not already prepended, * otherwise just uses the name found.) @@ -2493,9 +2414,7 @@ cs_reset(eap) * Contrast this with my development system (Digital Unix), which does. */ static char * -cs_resolve_file(i, name) - int i; - char *name; +cs_resolve_file(int i, char *name) { char *fullname; int len; @@ -2517,7 +2436,7 @@ cs_resolve_file(i, name) if (csdir != NULL) { vim_strncpy(csdir, (char_u *)csinfo[i].fname, - gettail((char_u *)csinfo[i].fname) + gettail((char_u *)csinfo[i].fname) - (char_u *)csinfo[i].fname); len += (int)STRLEN(csdir); } @@ -2554,13 +2473,10 @@ cs_resolve_file(i, name) /* - * PRIVATE: cs_show - * - * show all cscope connections + * Show all cscope connections. */ static int -cs_show(eap) - exarg_T *eap UNUSED; +cs_show(exarg_T *eap UNUSED) { short i; if (cs_cnt_connections() == 0) @@ -2569,7 +2485,7 @@ cs_show(eap) { MSG_PUTS_ATTR( _(" # pid database name prepend path\n"), - hl_attr(HLF_T)); + HL_ATTR(HLF_T)); for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname == NULL) @@ -2590,12 +2506,10 @@ cs_show(eap) /* - * PUBLIC: cs_end - * * Only called when VIM exits to quit any cscope sessions. */ void -cs_end() +cs_end(void) { int i; diff --git a/src/if_cscope.h b/src/if_cscope.h index 5620eb3a2b..419c469467 100644 --- a/src/if_cscope.h +++ b/src/if_cscope.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com> * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com> @@ -11,16 +11,11 @@ #if defined(FEAT_CSCOPE) || defined(PROTO) -#if defined(UNIX) -# include <sys/types.h> /* pid_t */ -# include <sys/stat.h> /* dev_t, ino_t */ -#else -# if defined (WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include <windows.h> +#if defined (WIN32) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN # endif +# include <windows.h> #endif #define CSCOPE_SUCCESS 0 @@ -30,21 +25,12 @@ #define CSCOPE_PROMPT ">> " /* - * s 0name Find this C symbol - * g 1name Find this definition - * d 2name Find functions called by this function - * c 3name Find functions calling this function - * t 4string find text string (cscope 12.9) - * t 4name Find assignments to (cscope 13.3) - * 5pattern change pattern -- NOT USED - * e 6pattern Find this egrep pattern - * f 7name Find this file - * i 8name Find files #including this file + * See ":help cscope-find" for the possible queries. */ typedef struct { char * name; - int (*func) __ARGS((exarg_T *eap)); + int (*func)(exarg_T *eap); char * help; char * usage; int cansplit; /* if supports splitting window */ diff --git a/src/if_lua.c b/src/if_lua.c index 7efd2cba65..7236a05d95 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -9,6 +9,22 @@ * See README.txt for an overview of the Vim source code. */ +#ifdef HAVE_CONFIG_H +# include "auto/config.h" +#endif + +#if defined(FEAT_LUA52) && !defined(FEAT_LUA52_COMPILING) +#define lua_enabled lua51_enabled +#define lua_end lua51_end +#define ex_lua ex_lua51 +#define ex_luado ex_lua51do +#define ex_luafile ex_lua51file +#define lua_buffer_free lua51_buffer_free +#define lua_window_free lua51_window_free +#define do_luaeval do_lua51eval +#define set_ref_in_lua set_ref_in_lua51 +#endif + #include "vim.h" #include <lua.h> @@ -119,13 +135,19 @@ static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic); #define lua_getglobal dll_lua_getglobal #define lua_setglobal dll_lua_setglobal #endif +#if LUA_VERSION_NUM <= 502 +#define lua_replace dll_lua_replace +#define lua_remove dll_lua_remove +#endif +#if LUA_VERSION_NUM >= 503 +#define lua_rotate dll_lua_rotate +#define lua_copy dll_lua_copy +#endif #define lua_typename dll_lua_typename #define lua_close dll_lua_close #define lua_gettop dll_lua_gettop #define lua_settop dll_lua_settop #define lua_pushvalue dll_lua_pushvalue -#define lua_replace dll_lua_replace -#define lua_remove dll_lua_remove #define lua_isnumber dll_lua_isnumber #define lua_isstring dll_lua_isstring #define lua_type dll_lua_type @@ -205,13 +227,19 @@ int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, void (*dll_lua_getglobal) (lua_State *L, const char *var); void (*dll_lua_setglobal) (lua_State *L, const char *var); #endif +#if LUA_VERSION_NUM <= 502 +void (*dll_lua_replace) (lua_State *L, int idx); +void (*dll_lua_remove) (lua_State *L, int idx); +#endif +#if LUA_VERSION_NUM >= 503 +void (*dll_lua_rotate) (lua_State *L, int idx, int n); +void (*dll_lua_copy) (lua_State *L, int fromidx, int toidx); +#endif const char *(*dll_lua_typename) (lua_State *L, int tp); void (*dll_lua_close) (lua_State *L); int (*dll_lua_gettop) (lua_State *L); void (*dll_lua_settop) (lua_State *L, int idx); void (*dll_lua_pushvalue) (lua_State *L, int idx); -void (*dll_lua_replace) (lua_State *L, int idx); -void (*dll_lua_remove) (lua_State *L, int idx); int (*dll_lua_isnumber) (lua_State *L, int idx); int (*dll_lua_isstring) (lua_State *L, int idx); int (*dll_lua_type) (lua_State *L, int idx); @@ -295,14 +323,20 @@ static const luaV_Reg luaV_dll[] = { {"lua_pcallk", (luaV_function) &dll_lua_pcallk}, {"lua_getglobal", (luaV_function) &dll_lua_getglobal}, {"lua_setglobal", (luaV_function) &dll_lua_setglobal}, +#endif +#if LUA_VERSION_NUM <= 502 + {"lua_replace", (luaV_function) &dll_lua_replace}, + {"lua_remove", (luaV_function) &dll_lua_remove}, +#endif +#if LUA_VERSION_NUM >= 503 + {"lua_rotate", (luaV_function) &dll_lua_rotate}, + {"lua_copy", (luaV_function) &dll_lua_copy}, #endif {"lua_typename", (luaV_function) &dll_lua_typename}, {"lua_close", (luaV_function) &dll_lua_close}, {"lua_gettop", (luaV_function) &dll_lua_gettop}, {"lua_settop", (luaV_function) &dll_lua_settop}, {"lua_pushvalue", (luaV_function) &dll_lua_pushvalue}, - {"lua_replace", (luaV_function) &dll_lua_replace}, - {"lua_remove", (luaV_function) &dll_lua_remove}, {"lua_isnumber", (luaV_function) &dll_lua_isnumber}, {"lua_isstring", (luaV_function) &dll_lua_isstring}, {"lua_type", (luaV_function) &dll_lua_type}, @@ -380,14 +414,15 @@ lua_link_init(char *libname, int verbose) } return OK; } +#endif /* DYNAMIC_LUA */ +#if defined(DYNAMIC_LUA) || defined(PROTO) int lua_enabled(int verbose) { - return lua_link_init(DYNAMIC_LUA_DLL, verbose) == OK; + return lua_link_init((char *)p_luadll, verbose) == OK; } - -#endif /* DYNAMIC_LUA */ +#endif #if LUA_VERSION_NUM > 501 static int @@ -481,6 +516,12 @@ luaV_pushtypval(lua_State *L, typval_T *tv) case VAR_DICT: luaV_pushdict(L, tv->vval.v_dict); break; + case VAR_SPECIAL: + if (tv->vval.v_number <= VVAL_TRUE) + lua_pushinteger(L, (int) tv->vval.v_number); + else + lua_pushnil(L); + break; default: lua_pushnil(L); } @@ -492,7 +533,7 @@ luaV_totypval (lua_State *L, int pos, typval_T *tv) { switch(lua_type(L, pos)) { case LUA_TBOOLEAN: - tv->v_type = VAR_NUMBER; + tv->v_type = VAR_SPECIAL; tv->vval.v_number = (varnumber_T) lua_toboolean(L, pos); break; case LUA_TSTRING: @@ -774,7 +815,7 @@ luaV_list_insert (lua_State *L) { luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST); list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis); - long pos = luaL_optlong(L, 3, 0); + long pos = (long) luaL_optinteger(L, 3, 0); listitem_T *li = NULL; typval_T v; if (l->lv_lock) @@ -1153,10 +1194,8 @@ luaV_window_index(lua_State *L) lua_pushinteger(L, w->w_cursor.lnum); else if (strncmp(s, "col", 3) == 0) lua_pushinteger(L, w->w_cursor.col + 1); -#ifdef FEAT_VERTSPLIT else if (strncmp(s, "width", 5) == 0) - lua_pushinteger(L, W_WIDTH(w)); -#endif + lua_pushinteger(L, w->w_width); else if (strncmp(s, "height", 6) == 0) lua_pushinteger(L, w->w_height); /* methods */ @@ -1196,7 +1235,6 @@ luaV_window_newindex (lua_State *L) w->w_cursor.col = v - 1; update_screen(VALID); } -#ifdef FEAT_VERTSPLIT else if (strncmp(s, "width", 5) == 0) { win_T *win = curwin; @@ -1207,7 +1245,6 @@ luaV_window_newindex (lua_State *L) win_setwidth(v); curwin = win; } -#endif else if (strncmp(s, "height", 6) == 0) { win_T *win = curwin; @@ -1336,7 +1373,7 @@ luaV_eval(lua_State *L) static int luaV_beep(lua_State *L UNUSED) { - vim_beep(); + vim_beep(BO_LANG); return 0; } @@ -1378,13 +1415,13 @@ luaV_buffer(lua_State *L) if (lua_isnumber(L, 1)) /* by number? */ { int n = lua_tointeger(L, 1); - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_fnum == n) break; } else { /* by name */ size_t l; const char *s = lua_tolstring(L, 1, &l); - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ffname == NULL || buf->b_sfname == NULL) { @@ -1523,28 +1560,33 @@ luaV_luaeval (lua_State *L) static int luaV_setref (lua_State *L) { - int copyID = lua_tointeger(L, 1); - typval_T tv; + int copyID = lua_tointeger(L, 1); + int abort = FALSE; + typval_T tv; + luaV_getfield(L, LUAVIM_LIST); luaV_getfield(L, LUAVIM_DICT); lua_pushnil(L); - while (lua_next(L, lua_upvalueindex(1)) != 0) /* traverse cache table */ + /* traverse cache table */ + while (!abort && lua_next(L, lua_upvalueindex(1)) != 0) { lua_getmetatable(L, -1); if (lua_rawequal(L, -1, 2)) /* list? */ { tv.v_type = VAR_LIST; tv.vval.v_list = (list_T *) lua_touserdata(L, 4); /* key */ + abort = set_ref_in_item(&tv, copyID, NULL, NULL); } else if (lua_rawequal(L, -1, 3)) /* dict? */ { tv.v_type = VAR_DICT; tv.vval.v_dict = (dict_T *) lua_touserdata(L, 4); /* key */ + abort = set_ref_in_item(&tv, copyID, NULL, NULL); } lua_pop(L, 2); /* metatable and value */ - set_ref_in_item(&tv, copyID); } - return 0; + lua_pushinteger(L, abort); + return 1; } static int @@ -1686,6 +1728,8 @@ ex_luado(exarg_T *eap) const char *s = (const char *) eap->arg; luaL_Buffer b; size_t len; + buf_T *was_curbuf = curbuf; + if (lua_init() == FAIL) return; if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL) { @@ -1709,6 +1753,10 @@ ex_luado(exarg_T *eap) lua_replace(L, -2); /* function -> body */ for (l = eap->line1; l <= eap->line2; l++) { + /* Check the line number, the command my have deleted lines. */ + if (l > curbuf->b_ml.ml_line_count) + break; + lua_pushvalue(L, -1); /* function */ luaV_pushline(L, curbuf, l); /* current line as arg */ lua_pushinteger(L, l); /* current line number as arg */ @@ -1717,6 +1765,9 @@ ex_luado(exarg_T *eap) luaV_emsg(L); break; } + /* Catch the command switching to another buffer. */ + if (curbuf != was_curbuf) + break; if (lua_isstring(L, -1)) /* update line? */ { #ifdef HAVE_SANDBOX @@ -1770,13 +1821,133 @@ do_luaeval (char_u *str, typval_T *arg, typval_T *rettv) lua_call(L, 3, 0); } - void + int set_ref_in_lua (int copyID) { - if (!lua_isopen()) return; - luaV_getfield(L, LUAVIM_SETREF); - lua_pushinteger(L, copyID); - lua_call(L, 1, 0); + int aborted = 0; + + if (lua_isopen()) + { + luaV_getfield(L, LUAVIM_SETREF); + /* call the function with 1 arg, getting 1 result back */ + lua_pushinteger(L, copyID); + lua_call(L, 1, 1); + /* get the result */ + aborted = lua_tointeger(L, -1); + /* pop result off the stack */ + lua_pop(L, 1); + } + return aborted; +} + +#if defined(FEAT_LUA52) && !defined(FEAT_LUA52_COMPILING) + +#undef lua_enabled +#undef lua_end +#undef ex_lua +#undef ex_luado +#undef ex_luafile +#undef lua_buffer_free +#undef lua_window_free +#undef do_luaeval +#undef set_ref_in_lua + +enum { + DYNAMIC_LUA_NOT_INITIALIZED, + DYNAMIC_LUA_NOT_AVAILABLE, + DYNAMIC_LUA_VER51, + DYNAMIC_LUA_VER52, +}; + +static int dynamic_lua_version = DYNAMIC_LUA_NOT_INITIALIZED; + +static int ensure_lua_initialized(void) +{ + if (dynamic_lua_version == DYNAMIC_LUA_NOT_INITIALIZED) { + if (lua52_enabled(FALSE) == TRUE) + dynamic_lua_version = DYNAMIC_LUA_VER52; + else if (lua51_enabled(FALSE) == TRUE) + dynamic_lua_version = DYNAMIC_LUA_VER51; + else + dynamic_lua_version = DYNAMIC_LUA_NOT_AVAILABLE; + } + return dynamic_lua_version; +} + +void ex_lua(exarg_T *eap) +{ + switch (ensure_lua_initialized()) { + case DYNAMIC_LUA_VER51: ex_lua51(eap); return; + case DYNAMIC_LUA_VER52: ex_lua52(eap); return; + } +} + +void ex_luado(exarg_T *eap) +{ + switch (ensure_lua_initialized()) { + case DYNAMIC_LUA_VER51: ex_lua51do(eap); return; + case DYNAMIC_LUA_VER52: ex_lua52do(eap); return; + } +} + +void ex_luafile(exarg_T *eap) +{ + switch (ensure_lua_initialized()) { + case DYNAMIC_LUA_VER51: ex_lua51file(eap); return; + case DYNAMIC_LUA_VER52: ex_lua52file(eap); return; + } +} + +void lua_buffer_free(buf_T *buf) +{ + switch (dynamic_lua_version) { + case DYNAMIC_LUA_VER51: lua51_buffer_free(buf); return; + case DYNAMIC_LUA_VER52: lua52_buffer_free(buf); return; + } } +int lua_enabled(int verbose) +{ + switch (ensure_lua_initialized()) { + case DYNAMIC_LUA_VER51: return TRUE; + case DYNAMIC_LUA_VER52: return TRUE; + default: return FALSE; + } +} + +void lua_end() +{ + switch (dynamic_lua_version) { + case DYNAMIC_LUA_VER51: lua51_end(); return; + case DYNAMIC_LUA_VER52: lua52_end(); return; + } +} + +void lua_window_free(win_T *win) +{ + switch (dynamic_lua_version) { + case DYNAMIC_LUA_VER51: lua51_window_free(win); return; + case DYNAMIC_LUA_VER52: lua52_window_free(win); return; + } +} + +void do_luaeval(char_u *str, typval_T *arg, typval_T *rettv) +{ + switch (dynamic_lua_version) { + case DYNAMIC_LUA_VER51: do_lua51eval(str, arg, rettv); return; + case DYNAMIC_LUA_VER52: do_lua52eval(str, arg, rettv); return; + } +} + +int set_ref_in_lua(int copyID) +{ + switch (dynamic_lua_version) { + case DYNAMIC_LUA_VER51: return set_ref_in_lua51(copyID); + case DYNAMIC_LUA_VER52: return set_ref_in_lua52(copyID); + default: return 0; + } +} + +#endif + #endif diff --git a/src/if_lua52.c b/src/if_lua52.c new file mode 100644 index 0000000000..d0c9152429 --- /dev/null +++ b/src/if_lua52.c @@ -0,0 +1,16 @@ +#define FEAT_LUA52_COMPILING + +#define DYNAMIC_LUA_DLL DYNAMIC_LUA52_DLL +#define DYNAMIC_LUA_VER DYNAMIC_LUA52_VER + +#define lua_enabled lua52_enabled +#define lua_end lua52_end +#define ex_lua ex_lua52 +#define ex_luado ex_lua52do +#define ex_luafile ex_lua52file +#define lua_buffer_free lua52_buffer_free +#define lua_window_free lua52_window_free +#define do_luaeval do_lua52eval +#define set_ref_in_lua set_ref_in_lua52 + +#include "if_lua.c" diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 8dd2134313..54474bd807 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * MzScheme interface by Sergey Khorev <sergey.khorev@gmail.com> * Based on work by Brent Fulgham <bfulgham@debian.org> @@ -29,6 +29,40 @@ * depend". */ #if defined(FEAT_MZSCHEME) || defined(PROTO) +#ifdef PROTO +typedef int Scheme_Object; +typedef int Scheme_Closed_Prim; +typedef int Scheme_Env; +typedef int Scheme_Hash_Table; +typedef int Scheme_Type; +typedef int Scheme_Thread; +typedef int Scheme_Closed_Prim; +typedef int mzshort; +typedef int Scheme_Prim; +typedef int HINSTANCE; +#endif + +/* + * scheme_register_tls_space is only available on 32-bit Windows until + * racket-6.3. See + * http://docs.racket-lang.org/inside/im_memoryalloc.html?q=scheme_register_tls_space + */ +#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) \ + && defined(USE_THREAD_LOCAL) \ + && (!defined(_WIN64) || MZSCHEME_VERSION_MAJOR >= 603) +# define HAVE_TLS_SPACE 1 +#endif + +/* + * Since version 4.x precise GC requires trampolined startup. + * Futures and places in version 5.x need it too. + */ +#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \ + || MZSCHEME_VERSION_MAJOR >= 500 \ + && (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES)) +# define TRAMPOLINED_MZVIM_STARTUP +#endif + /* Base data structures */ #define SCHEME_VIMBUFFERP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type) #define SCHEME_VIMWINDOWP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_window_type) @@ -111,10 +145,8 @@ static Scheme_Object *get_window_num(void *, int, Scheme_Object **); static Scheme_Object *get_window_buffer(void *, int, Scheme_Object **); static Scheme_Object *get_window_height(void *, int, Scheme_Object **); static Scheme_Object *set_window_height(void *, int, Scheme_Object **); -#ifdef FEAT_VERTSPLIT static Scheme_Object *get_window_width(void *, int, Scheme_Object **); static Scheme_Object *set_window_width(void *, int, Scheme_Object **); -#endif static Scheme_Object *get_cursor(void *, int, Scheme_Object **); static Scheme_Object *set_cursor(void *, int, Scheme_Object **); static Scheme_Object *get_window_list(void *, int, Scheme_Object **); @@ -138,9 +170,9 @@ static Scheme_Object *vim_window_validp(void *data, int, Scheme_Object **); */ static int vim_error_check(void); static int do_mzscheme_command(exarg_T *, void *, Scheme_Closed_Prim *what); -static void startup_mzscheme(void); +static int startup_mzscheme(void); static char *string_to_line(Scheme_Object *obj); -#if MZSCHEME_VERSION_MAJOR >= 500 +#if MZSCHEME_VERSION_MAJOR >= 501 # define OUTPUT_LEN_TYPE intptr_t #else # define OUTPUT_LEN_TYPE long @@ -227,7 +259,7 @@ static int window_fixup_proc(void *obj) # define BUFFER_REF(buf) (vim_mz_buffer *)((buf)->b_mzscheme_ref) #endif -#ifdef DYNAMIC_MZSCHEME +#if defined(DYNAMIC_MZSCHEME) || defined(PROTO) static Scheme_Object *dll_scheme_eof; static Scheme_Object *dll_scheme_false; static Scheme_Object *dll_scheme_void; @@ -237,7 +269,7 @@ static Scheme_Object *dll_scheme_true; static Scheme_Thread **dll_scheme_current_thread_ptr; static void (**dll_scheme_console_printf_ptr)(char *str, ...); -static void (**dll_scheme_console_output_ptr)(char *str, long len); +static void (**dll_scheme_console_output_ptr)(char *str, OUTPUT_LEN_TYPE len); static void (**dll_scheme_notify_multithread_ptr)(int on); static void *(*dll_GC_malloc)(size_t size_in_bytes); @@ -255,6 +287,7 @@ static Scheme_Object *(*dll_scheme_apply)(Scheme_Object *rator, int num_rands, static Scheme_Object *(*dll_scheme_builtin_value)(const char *name); # if MZSCHEME_VERSION_MAJOR >= 299 static Scheme_Object *(*dll_scheme_byte_string_to_char_string)(Scheme_Object *s); +static Scheme_Object *(*dll_scheme_make_path)(const char *chars); # endif static void (*dll_scheme_close_input_port)(Scheme_Object *port); static void (*dll_scheme_count_lines)(Scheme_Object *port); @@ -264,7 +297,7 @@ static Scheme_Object *(*dll_scheme_current_continuation_marks)(void); static Scheme_Object *(*dll_scheme_current_continuation_marks)(Scheme_Object *prompt_tag); #endif static void (*dll_scheme_display)(Scheme_Object *obj, Scheme_Object *port); -static char *(*dll_scheme_display_to_string)(Scheme_Object *obj, long *len); +static char *(*dll_scheme_display_to_string)(Scheme_Object *obj, OUTPUT_LEN_TYPE *len); static int (*dll_scheme_eq)(Scheme_Object *obj1, Scheme_Object *obj2); static Scheme_Object *(*dll_scheme_do_eval)(Scheme_Object *obj, int _num_rands, Scheme_Object **rands, int val); @@ -280,7 +313,7 @@ static char *(*dll_scheme_format)(char *format, int flen, int argc, Scheme_Object **argv, long *rlen); # else static char *(*dll_scheme_format_utf8)(char *format, int flen, int argc, - Scheme_Object **argv, long *rlen); + Scheme_Object **argv, OUTPUT_LEN_TYPE *rlen); static Scheme_Object *(*dll_scheme_get_param)(Scheme_Config *c, int pos); # endif static void (*dll_scheme_gc_ptr_ok)(void *p); @@ -289,7 +322,7 @@ static char *(*dll_scheme_get_sized_string_output)(Scheme_Object *, long *len); # else static char *(*dll_scheme_get_sized_byte_string_output)(Scheme_Object *, - long *len); + OUTPUT_LEN_TYPE *len); # endif static Scheme_Object *(*dll_scheme_intern_symbol)(const char *name); static Scheme_Object *(*dll_scheme_lookup_global)(Scheme_Object *symbol, @@ -354,11 +387,37 @@ static void (*dll_scheme_hash_set)(Scheme_Hash_Table *table, static Scheme_Object *(*dll_scheme_hash_get)(Scheme_Hash_Table *table, Scheme_Object *key); static Scheme_Object *(*dll_scheme_make_double)(double d); -# ifdef INCLUDE_MZSCHEME_BASE static Scheme_Object *(*dll_scheme_make_sized_byte_string)(char *chars, long len, int copy); static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req); +static Scheme_Object *(*dll_scheme_dynamic_wind)(void (*pre)(void *), Scheme_Object *(* volatile act)(void *), void (* volatile post)(void *), Scheme_Object *(*jmp_handler)(void *), void * volatile data); +# ifdef MZ_PRECISE_GC +static void *(*dll_GC_malloc_one_tagged)(size_t size_in_bytes); +static void (*dll_GC_register_traversers)(short tag, Size_Proc size, Mark_Proc mark, Fixup_Proc fixup, int is_constant_size, int is_atomic); +# endif +# if MZSCHEME_VERSION_MAJOR >= 400 +static void (*dll_scheme_init_collection_paths)(Scheme_Env *global_env, Scheme_Object *extra_dirs); +static void **(*dll_scheme_malloc_immobile_box)(void *p); +static void (*dll_scheme_free_immobile_box)(void **b); # endif +# if MZSCHEME_VERSION_MAJOR >= 500 +# ifdef TRAMPOLINED_MZVIM_STARTUP +static int (*dll_scheme_main_setup)(int no_auto_statics, Scheme_Env_Main _main, int argc, char **argv); +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 +static void (*dll_scheme_register_tls_space)(void *tls_space, int _tls_index); +# endif +# endif +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) +static Thread_Local_Variables *(*dll_scheme_external_get_thread_local_variables)(void); +# endif +# endif +# if MZSCHEME_VERSION_MAJOR >= 600 +static void (*dll_scheme_embedded_load)(intptr_t len, const char *s, int predefined); +static void (*dll_scheme_register_embedded_load)(intptr_t len, const char *s); +static void (*dll_scheme_set_config_path)(Scheme_Object *p); +# endif + +#if defined(DYNAMIC_MZSCHEME) /* not when defined(PROTO) */ /* arrays are imported directly */ # define scheme_eof dll_scheme_eof @@ -368,7 +427,9 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req); # define scheme_true dll_scheme_true /* pointers are GetProceAddress'ed as pointers to pointer */ -# define scheme_current_thread (*dll_scheme_current_thread_ptr) +#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) +# define scheme_current_thread (*dll_scheme_current_thread_ptr) +# endif # define scheme_console_printf (*dll_scheme_console_printf_ptr) # define scheme_console_output (*dll_scheme_console_output_ptr) # define scheme_notify_multithread (*dll_scheme_notify_multithread_ptr) @@ -384,6 +445,7 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req); # define scheme_builtin_value dll_scheme_builtin_value # if MZSCHEME_VERSION_MAJOR >= 299 # define scheme_byte_string_to_char_string dll_scheme_byte_string_to_char_string +# define scheme_make_path dll_scheme_make_path # endif # define scheme_check_threads dll_scheme_check_threads # define scheme_close_input_port dll_scheme_close_input_port @@ -455,11 +517,43 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req); # define scheme_hash_set dll_scheme_hash_set # define scheme_hash_get dll_scheme_hash_get # define scheme_make_double dll_scheme_make_double -# ifdef INCLUDE_MZSCHEME_BASE -# define scheme_make_sized_byte_string dll_scheme_make_sized_byte_string -# define scheme_namespace_require dll_scheme_namespace_require +# define scheme_make_sized_byte_string dll_scheme_make_sized_byte_string +# define scheme_namespace_require dll_scheme_namespace_require +# define scheme_dynamic_wind dll_scheme_dynamic_wind +# ifdef MZ_PRECISE_GC +# define GC_malloc_one_tagged dll_GC_malloc_one_tagged +# define GC_register_traversers dll_GC_register_traversers +# endif +# if MZSCHEME_VERSION_MAJOR >= 400 +# ifdef TRAMPOLINED_MZVIM_STARTUP +# define scheme_main_setup dll_scheme_main_setup +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 +# define scheme_register_tls_space dll_scheme_register_tls_space +# endif +# endif +# define scheme_init_collection_paths dll_scheme_init_collection_paths +# define scheme_malloc_immobile_box dll_scheme_malloc_immobile_box +# define scheme_free_immobile_box dll_scheme_free_immobile_box +# endif +# if MZSCHEME_VERSION_MAJOR >= 600 +# define scheme_embedded_load dll_scheme_embedded_load +# define scheme_register_embedded_load dll_scheme_register_embedded_load +# define scheme_set_config_path dll_scheme_set_config_path # endif +# if MZSCHEME_VERSION_MAJOR >= 500 +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) +/* define as function for macro in schthread.h */ +Thread_Local_Variables * +scheme_external_get_thread_local_variables(void) +{ + return dll_scheme_external_get_thread_local_variables(); +} +# endif +# endif + +#endif + typedef struct { char *name; @@ -477,7 +571,9 @@ static Thunk_Info mzsch_imports[] = { {"scheme_void", (void **)&dll_scheme_void}, {"scheme_null", (void **)&dll_scheme_null}, {"scheme_true", (void **)&dll_scheme_true}, +#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) {"scheme_current_thread", (void **)&dll_scheme_current_thread_ptr}, +#endif {"scheme_console_printf", (void **)&dll_scheme_console_printf_ptr}, {"scheme_console_output", (void **)&dll_scheme_console_output_ptr}, {"scheme_notify_multithread", @@ -488,6 +584,7 @@ static Thunk_Info mzsch_imports[] = { {"scheme_basic_env", (void **)&dll_scheme_basic_env}, # if MZSCHEME_VERSION_MAJOR >= 299 {"scheme_byte_string_to_char_string", (void **)&dll_scheme_byte_string_to_char_string}, + {"scheme_make_path", (void **)&dll_scheme_make_path}, # endif {"scheme_builtin_value", (void **)&dll_scheme_builtin_value}, {"scheme_check_threads", (void **)&dll_scheme_check_threads}, @@ -564,10 +661,34 @@ static Thunk_Info mzsch_imports[] = { {"scheme_hash_set", (void **)&dll_scheme_hash_set}, {"scheme_hash_get", (void **)&dll_scheme_hash_get}, {"scheme_make_double", (void **)&dll_scheme_make_double}, -# ifdef INCLUDE_MZSCHEME_BASE {"scheme_make_sized_byte_string", (void **)&dll_scheme_make_sized_byte_string}, {"scheme_namespace_require", (void **)&dll_scheme_namespace_require}, -#endif + {"scheme_dynamic_wind", (void **)&dll_scheme_dynamic_wind}, +# ifdef MZ_PRECISE_GC + {"GC_malloc_one_tagged", (void **)&dll_GC_malloc_one_tagged}, + {"GC_register_traversers", (void **)&dll_GC_register_traversers}, +# endif +# if MZSCHEME_VERSION_MAJOR >= 400 +# ifdef TRAMPOLINED_MZVIM_STARTUP + {"scheme_main_setup", (void **)&dll_scheme_main_setup}, +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 + {"scheme_register_tls_space", (void **)&dll_scheme_register_tls_space}, +# endif +# endif + {"scheme_init_collection_paths", (void **)&dll_scheme_init_collection_paths}, + {"scheme_malloc_immobile_box", (void **)&dll_scheme_malloc_immobile_box}, + {"scheme_free_immobile_box", (void **)&dll_scheme_free_immobile_box}, +# endif +# if MZSCHEME_VERSION_MAJOR >= 500 +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) + {"scheme_external_get_thread_local_variables", (void **)&dll_scheme_external_get_thread_local_variables}, +# endif +# endif +# if MZSCHEME_VERSION_MAJOR >= 600 + {"scheme_embedded_load", (void **)&dll_scheme_embedded_load}, + {"scheme_register_embedded_load", (void **)&dll_scheme_register_embedded_load}, + {"scheme_set_config_path", (void **)&dll_scheme_set_config_path}, +# endif {NULL, NULL}}; static HINSTANCE hMzGC = 0; @@ -636,7 +757,7 @@ mzscheme_runtime_link_init(char *sch_dll, char *gc_dll, int verbose) mzscheme_enabled(int verbose) { return mzscheme_runtime_link_init( - DYNAMIC_MZSCH_DLL, DYNAMIC_MZGC_DLL, verbose) == OK; + (char *)p_mzschemedll, (char *)p_mzschemegcdll, verbose) == OK; } static void @@ -687,8 +808,6 @@ guaranteed_byte_string_arg(char *proc, int num, int argc, Scheme_Object **argv) /* need to put it here for dynamic stuff to work */ #if defined(INCLUDE_MZSCHEME_BASE) # include "mzscheme_base.c" -#elif MZSCHEME_VERSION_MAJOR >= 400 -# error MzScheme >=4 must include mzscheme_base.c, for MinGW32 you need to define MZSCHEME_GENERATE_BASE=yes #endif /* @@ -701,6 +820,10 @@ static Scheme_Type mz_buffer_type; static Scheme_Type mz_window_type; static int initialized = FALSE; +#ifdef DYNAMIC_MZSCHEME +static int disabled = FALSE; +#endif +static int load_base_module_failed = FALSE; /* global environment */ static Scheme_Env *environment = NULL; @@ -724,10 +847,14 @@ static long range_end; static int mz_threads_allow = 0; #if defined(FEAT_GUI_W32) -static void CALLBACK timer_proc(HWND, UINT, UINT, DWORD); +static void CALLBACK timer_proc(HWND, UINT, UINT_PTR, DWORD); static UINT timer_id = 0; #elif defined(FEAT_GUI_GTK) +# if GTK_CHECK_VERSION(3,0,0) +static gboolean timer_proc(gpointer); +# else static gint timer_proc(gpointer); +# endif static guint timer_id = 0; #elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) static void timer_proc(XtPointer, XtIntervalId *); @@ -758,16 +885,20 @@ mzvim_check_threads(void) } #endif -#ifdef MZSCHEME_GUI_THREADS +#if defined(MZSCHEME_GUI_THREADS) || defined(PROTO) static void setup_timer(void); static void remove_timer(void); /* timers are presented in GUI only */ # if defined(FEAT_GUI_W32) static void CALLBACK -timer_proc(HWND hwnd UNUSED, UINT uMsg UNUSED, UINT idEvent UNUSED, DWORD dwTime UNUSED) +timer_proc(HWND hwnd UNUSED, UINT uMsg UNUSED, UINT_PTR idEvent UNUSED, DWORD dwTime UNUSED) # elif defined(FEAT_GUI_GTK) +# if GTK_CHECK_VERSION(3,0,0) + static gboolean +# else static gint +# endif timer_proc(gpointer data UNUSED) # elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) static void @@ -794,7 +925,11 @@ setup_timer(void) # if defined(FEAT_GUI_W32) timer_id = SetTimer(NULL, 0, p_mzq, timer_proc); # elif defined(FEAT_GUI_GTK) +# if GTK_CHECK_VERSION(3,0,0) + timer_id = g_timeout_add((guint)p_mzq, (GSourceFunc)timer_proc, NULL); +# else timer_id = gtk_timeout_add((guint32)p_mzq, (GtkFunction)timer_proc, NULL); +# endif # elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) timer_id = XtAppAddTimeOut(app_context, p_mzq, timer_proc, NULL); # elif defined(FEAT_GUI_MAC) @@ -810,7 +945,11 @@ remove_timer(void) # if defined(FEAT_GUI_W32) KillTimer(NULL, timer_id); # elif defined(FEAT_GUI_GTK) +# if GTK_CHECK_VERSION(3,0,0) + g_source_remove(timer_id); +# else gtk_timeout_remove(timer_id); +# endif # elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) XtRemoveTimeOut(timer_id); # elif defined(FEAT_GUI_MAC) @@ -846,44 +985,62 @@ notify_multithread(int on) void mzscheme_end(void) { + /* We can not unload the DLL. Racket's thread might be still alive. */ +#if 0 #ifdef DYNAMIC_MZSCHEME dynamic_mzscheme_end(); #endif +#endif } -#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL) +#if HAVE_TLS_SPACE +# if defined(_MSC_VER) static __declspec(thread) void *tls_space; +extern intptr_t _tls_index; +# elif defined(__MINGW32__) +static __thread void *tls_space; +extern intptr_t _tls_index; +# else +static THREAD_LOCAL void *tls_space; +static intptr_t _tls_index = 0; +# endif #endif /* - * Since version 4.x precise GC requires trampolined startup. - * Futures and places in version 5.x need it too. + * mzscheme_main() is called early in main(). + * We may call scheme_main_setup() which calls mzscheme_env_main() which then + * trampolines into vim_main2(), which never returns. */ -#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \ - || MZSCHEME_VERSION_MAJOR >= 500 && (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES)) -# ifdef DYNAMIC_MZSCHEME -# error Precise GC v.4+ or Racket with futures/places do not support dynamic MzScheme -# endif -# define TRAMPOLINED_MZVIM_STARTUP -#endif - int -mzscheme_main(int argc, char** argv) +mzscheme_main(void) { -#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL) - scheme_register_tls_space(&tls_space, 0); + int argc = 0; + char *argv = NULL; + +#ifdef DYNAMIC_MZSCHEME + /* + * Racket requires trampolined startup. We can not load it later. + * If dynamic dll loading is failed, disable it. + */ + if (!mzscheme_enabled(FALSE)) + { + disabled = TRUE; + return vim_main2(); + } +#endif +#ifdef HAVE_TLS_SPACE + scheme_register_tls_space(&tls_space, _tls_index); #endif #ifdef TRAMPOLINED_MZVIM_STARTUP - return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv); + return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv); #else - return mzscheme_env_main(NULL, argc, argv); + return mzscheme_env_main(NULL, argc, &argv); #endif } static int -mzscheme_env_main(Scheme_Env *env, int argc, char **argv) +mzscheme_env_main(Scheme_Env *env, int argc UNUSED, char **argv UNUSED) { - int vim_main_result; #ifdef TRAMPOLINED_MZVIM_STARTUP /* Scheme has created the environment for us */ environment = env; @@ -900,20 +1057,27 @@ mzscheme_env_main(Scheme_Env *env, int argc, char **argv) # endif #endif - /* mzscheme_main is called as a trampoline from main. - * We trampoline into vim_main2 - * Passing argc, argv through from mzscheme_main - */ - vim_main_result = vim_main2(argc, argv); -#if !defined(TRAMPOLINED_MZVIM_STARTUP) && defined(MZ_PRECISE_GC) - /* releasing dummy */ - MZ_GC_REG(); - MZ_GC_UNREG(); -#endif - return vim_main_result; + vim_main2(); + /* not reached, vim_main2() will loop until exit() */ + + return 0; } - static void + static Scheme_Object* +load_base_module(void *data) +{ + scheme_namespace_require(scheme_intern_symbol((char *)data)); + return scheme_null; +} + + static Scheme_Object * +load_base_module_on_error(void *data UNUSED) +{ + load_base_module_failed = TRUE; + return scheme_null; +} + + static int startup_mzscheme(void) { #ifndef TRAMPOLINED_MZVIM_STARTUP @@ -936,87 +1100,45 @@ startup_mzscheme(void) MZ_GC_CHECK(); #ifdef INCLUDE_MZSCHEME_BASE - { - /* - * versions 4.x do not provide Scheme bindings by default - * we need to add them explicitly - */ - Scheme_Object *scheme_base_symbol = NULL; - MZ_GC_DECL_REG(1); - MZ_GC_VAR_IN_REG(0, scheme_base_symbol); - MZ_GC_REG(); - /* invoke function from generated and included mzscheme_base.c */ - declare_modules(environment); - scheme_base_symbol = scheme_intern_symbol("scheme/base"); - MZ_GC_CHECK(); - scheme_namespace_require(scheme_base_symbol); - MZ_GC_CHECK(); - MZ_GC_UNREG(); - } + /* invoke function from generated and included mzscheme_base.c */ + declare_modules(environment); #endif - register_vim_exn(); - /* use new environment to initialise exception handling */ - init_exn_catching_apply(); - - /* redirect output */ - scheme_console_output = do_output; - scheme_console_printf = do_printf; -#ifdef MZSCHEME_COLLECTS /* setup 'current-library-collection-paths' parameter */ # if MZSCHEME_VERSION_MAJOR >= 299 -# ifdef MACOS { - Scheme_Object *coll_byte_string = NULL; - Scheme_Object *coll_char_string = NULL; - Scheme_Object *coll_path = NULL; - - MZ_GC_DECL_REG(3); - MZ_GC_VAR_IN_REG(0, coll_byte_string); - MZ_GC_VAR_IN_REG(1, coll_char_string); - MZ_GC_VAR_IN_REG(2, coll_path); - MZ_GC_REG(); - coll_byte_string = scheme_make_byte_string(MZSCHEME_COLLECTS); - MZ_GC_CHECK(); - coll_char_string = scheme_byte_string_to_char_string(coll_byte_string); - MZ_GC_CHECK(); - coll_path = scheme_char_string_to_path(coll_char_string); - MZ_GC_CHECK(); - scheme_set_collects_path(coll_path); - MZ_GC_CHECK(); - MZ_GC_UNREG(); - } -# else - { - Scheme_Object *coll_byte_string = NULL; - Scheme_Object *coll_char_string = NULL; - Scheme_Object *coll_path = NULL; - Scheme_Object *coll_pair = NULL; - Scheme_Config *config = NULL; + Scheme_Object *coll_path = NULL; + int mustfree = FALSE; + char_u *s; - MZ_GC_DECL_REG(5); - MZ_GC_VAR_IN_REG(0, coll_byte_string); - MZ_GC_VAR_IN_REG(1, coll_char_string); - MZ_GC_VAR_IN_REG(2, coll_path); - MZ_GC_VAR_IN_REG(3, coll_pair); - MZ_GC_VAR_IN_REG(4, config); + MZ_GC_DECL_REG(1); + MZ_GC_VAR_IN_REG(0, coll_path); MZ_GC_REG(); - coll_byte_string = scheme_make_byte_string(MZSCHEME_COLLECTS); - MZ_GC_CHECK(); - coll_char_string = scheme_byte_string_to_char_string(coll_byte_string); - MZ_GC_CHECK(); - coll_path = scheme_char_string_to_path(coll_char_string); - MZ_GC_CHECK(); - coll_pair = scheme_make_pair(coll_path, scheme_null); - MZ_GC_CHECK(); - config = scheme_current_config(); - MZ_GC_CHECK(); - scheme_set_param(config, MZCONFIG_COLLECTION_PATHS, coll_pair); - MZ_GC_CHECK(); + /* workaround for dynamic loading on windows */ + s = vim_getenv((char_u *)"PLTCOLLECTS", &mustfree); + if (s != NULL) + { + coll_path = scheme_make_path((char *)s); + MZ_GC_CHECK(); + if (mustfree) + vim_free(s); + } +# ifdef MZSCHEME_COLLECTS + if (coll_path == NULL) + { + coll_path = scheme_make_path(MZSCHEME_COLLECTS); + MZ_GC_CHECK(); + } +# endif + if (coll_path != NULL) + { + scheme_set_collects_path(coll_path); + MZ_GC_CHECK(); + } MZ_GC_UNREG(); } -# endif # else +# ifdef MZSCHEME_COLLECTS { Scheme_Object *coll_string = NULL; Scheme_Object *coll_pair = NULL; @@ -1039,6 +1161,71 @@ startup_mzscheme(void) } # endif #endif + +# if MZSCHEME_VERSION_MAJOR >= 600 + { + Scheme_Object *config_path = NULL; + int mustfree = FALSE; + char_u *s; + + MZ_GC_DECL_REG(1); + MZ_GC_VAR_IN_REG(0, config_path); + MZ_GC_REG(); + /* workaround for dynamic loading on windows */ + s = vim_getenv((char_u *)"PLTCONFIGDIR", &mustfree); + if (s != NULL) + { + config_path = scheme_make_path((char *)s); + MZ_GC_CHECK(); + if (mustfree) + vim_free(s); + } +#ifdef MZSCHEME_CONFIGDIR + if (config_path == NULL) + { + config_path = scheme_make_path(MZSCHEME_CONFIGDIR); + MZ_GC_CHECK(); + } +#endif + if (config_path != NULL) + { + scheme_set_config_path(config_path); + MZ_GC_CHECK(); + } + MZ_GC_UNREG(); + } +# endif + +#if MZSCHEME_VERSION_MAJOR >= 400 + scheme_init_collection_paths(environment, scheme_null); +#endif + + /* + * versions 4.x do not provide Scheme bindings by default + * we need to add them explicitly + */ + { + /* use error handler to avoid abort */ + scheme_dynamic_wind(NULL, load_base_module, NULL, + load_base_module_on_error, "racket/base"); + if (load_base_module_failed) + { + load_base_module_failed = FALSE; + scheme_dynamic_wind(NULL, load_base_module, NULL, + load_base_module_on_error, "scheme/base"); + if (load_base_module_failed) + return -1; + } + } + + register_vim_exn(); + /* use new environment to initialise exception handling */ + init_exn_catching_apply(); + + /* redirect output */ + scheme_console_output = do_output; + scheme_console_printf = do_printf; + #ifdef HAVE_SANDBOX { Scheme_Object *make_security_guard = NULL; @@ -1112,6 +1299,8 @@ startup_mzscheme(void) * whether thread scheduling is (or not) required */ scheme_notify_multithread = notify_multithread; + + return 0; } /* @@ -1124,13 +1313,17 @@ mzscheme_init(void) if (!initialized) { #ifdef DYNAMIC_MZSCHEME - if (!mzscheme_enabled(TRUE)) + if (disabled || !mzscheme_enabled(TRUE)) { EMSG(_("E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded.")); return -1; } #endif - startup_mzscheme(); + if (load_base_module_failed || startup_mzscheme()) + { + EMSG(_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded.")); + return -1; + } initialized = TRUE; } { @@ -1563,7 +1756,7 @@ get_range_end(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) static Scheme_Object * mzscheme_beep(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { - vim_beep(); + vim_beep(BO_LANG); return scheme_void; } @@ -1718,11 +1911,9 @@ get_curr_win(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) get_window_count(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { int n = 0; -#ifdef FEAT_WINDOWS win_T *w; - for (w = firstwin; w != NULL; w = w->w_next) -#endif + FOR_ALL_WINDOWS(w) ++n; return scheme_make_integer(n); } @@ -1739,9 +1930,7 @@ get_window_list(void *data, int argc, Scheme_Object **argv) buf = get_buffer_arg(prim->name, 0, argc, argv); list = scheme_null; -#ifdef FEAT_WINDOWS for ( ; w != NULL; w = w->w_next) -#endif if (w->w_buffer == buf->buf) { list = scheme_make_pair(window_new(w), list); @@ -1793,13 +1982,11 @@ window_new(win_T *win) get_window_num(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { int nr = 1; -#ifdef FEAT_WINDOWS Vim_Prim *prim = (Vim_Prim *)data; win_T *win = get_window_arg(prim->name, 0, argc, argv)->win; win_T *wp; for (wp = firstwin; wp != win; wp = wp->w_next) -#endif ++nr; return scheme_make_integer(nr); @@ -1817,9 +2004,7 @@ get_window_by_num(void *data, int argc, Scheme_Object **argv) if (fnum < 1) scheme_signal_error(_("window index is out of range")); -#ifdef FEAT_WINDOWS for ( ; win != NULL; win = win->w_next, --fnum) -#endif if (fnum == 1) /* to be 1-based */ return window_new(win); @@ -1871,7 +2056,6 @@ set_window_height(void *data, int argc, Scheme_Object **argv) return scheme_void; } -#ifdef FEAT_VERTSPLIT /* (get-win-width [window]) */ static Scheme_Object * get_window_width(void *data, int argc, Scheme_Object **argv) @@ -1879,7 +2063,7 @@ get_window_width(void *data, int argc, Scheme_Object **argv) Vim_Prim *prim = (Vim_Prim *)data; vim_mz_window *win = get_window_arg(prim->name, 0, argc, argv); - return scheme_make_integer(W_WIDTH(win->win)); + return scheme_make_integer(win->win->w_width); } /* (set-win-width {width} [window]) */ @@ -1906,7 +2090,6 @@ set_window_width(void *data, int argc, Scheme_Object **argv) raise_if_error(); return scheme_void; } -#endif /* (get-cursor [window]) -> (line . col) */ static Scheme_Object * @@ -2002,7 +2185,7 @@ get_buffer_by_num(void *data, int argc, Scheme_Object **argv) fnum = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0)); - for (buf = firstbuf; buf; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_fnum == fnum) return buffer_new(buf); @@ -2025,7 +2208,7 @@ get_buffer_by_name(void *data, int argc, Scheme_Object **argv) fname = GUARANTEED_STRING_ARG(prim->name, 0); buffer = scheme_false; - for (buf = firstbuf; buf; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ffname == NULL || buf->b_sfname == NULL) /* empty string */ @@ -2088,7 +2271,7 @@ get_buffer_count(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED buf_T *b; int n = 0; - for (b = firstbuf; b; b = b->b_next) ++n; + FOR_ALL_BUFFERS(b) ++n; return scheme_make_integer(n); } @@ -2530,7 +2713,8 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) * Adjust marks. Invalidate any which lie in the * changed range, and move any in the remainder of the buffer. */ - mark_adjust((linenr_T)lo, (linenr_T)(hi - 1), (long)MAXLNUM, (long)extra); + mark_adjust((linenr_T)lo, (linenr_T)(hi - 1), + (long)MAXLNUM, (long)extra); changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra); if (buf->buf == curwin->w_buffer) @@ -2914,6 +3098,7 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited) MZ_GC_VAR_IN_REG(0, funcname); MZ_GC_REG(); + /* FIXME: func_ref() and func_unref() are needed. */ funcname = scheme_make_byte_string((char *)vim_value->vval.v_string); MZ_GC_CHECK(); result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, @@ -2922,6 +3107,38 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited) MZ_GC_UNREG(); } + else if (vim_value->v_type == VAR_PARTIAL) + { + if (vim_value->vval.v_partial == NULL) + result = scheme_null; + else + { + Scheme_Object *funcname = NULL; + + MZ_GC_DECL_REG(1); + MZ_GC_VAR_IN_REG(0, funcname); + MZ_GC_REG(); + + /* FIXME: func_ref() and func_unref() are needed. */ + /* TODO: Support pt_dict and pt_argv. */ + funcname = scheme_make_byte_string( + (char *)partial_name(vim_value->vval.v_partial)); + MZ_GC_CHECK(); + result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, + (const char *)BYTE_STRING_VALUE(funcname), 0, -1); + MZ_GC_CHECK(); + + MZ_GC_UNREG(); + } + } + else if (vim_value->v_type == VAR_SPECIAL) + { + if (vim_value->vval.v_number <= VVAL_TRUE) + result = scheme_make_integer((long)vim_value->vval.v_number); + else + result = scheme_null; + MZ_GC_CHECK(); + } else { result = scheme_void; @@ -2986,8 +3203,8 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, copy_tv(found, tv); else if (SCHEME_VOIDP(obj)) { - tv->v_type = VAR_NUMBER; - tv->vval.v_number = 0; + tv->v_type = VAR_SPECIAL; + tv->vval.v_number = VVAL_NULL; } else if (SCHEME_INTP(obj)) { @@ -2996,7 +3213,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, } else if (SCHEME_BOOLP(obj)) { - tv->v_type = VAR_NUMBER; + tv->v_type = VAR_SPECIAL; tv->vval.v_number = SCHEME_TRUEP(obj); } # ifdef FEAT_FLOAT @@ -3343,7 +3560,7 @@ raise_vim_exn(const char *add_info) info = scheme_make_byte_string(add_info); MZ_GC_CHECK(); - c_string = scheme_format_utf8(fmt, STRLEN(fmt), 1, &info, NULL); + c_string = scheme_format_utf8(fmt, (int)STRLEN(fmt), 1, &info, NULL); MZ_GC_CHECK(); byte_string = scheme_make_byte_string(c_string); MZ_GC_CHECK(); @@ -3515,10 +3732,8 @@ static Vim_Prim prims[]= {get_window_buffer, "get-win-buffer", 0, 1}, {get_window_height, "get-win-height", 0, 1}, {set_window_height, "set-win-height", 1, 2}, -#ifdef FEAT_VERTSPLIT {get_window_width, "get-win-width", 0, 1}, {set_window_width, "set-win-width", 1, 2}, -#endif {get_cursor, "get-cursor", 0, 1}, {set_cursor, "set-cursor", 1, 2}, {get_window_list, "get-win-list", 0, 1}, @@ -3562,7 +3777,7 @@ get_vim_curr_window(void) } static void -make_modules() +make_modules(void) { int i; Scheme_Env *mod = NULL; diff --git a/src/if_mzsch.h b/src/if_mzsch.h index 7c1766ebbc..952b0849ba 100644 --- a/src/if_mzsch.h +++ b/src/if_mzsch.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * MzScheme interface for Vim, wrapper around scheme.h */ @@ -10,6 +10,11 @@ # include <stdint.h> #endif +#ifdef PROTO +/* avoid syntax error for defining Thread_Local_Variables. */ +# define __thread /* empty */ +#endif + /* #ifdef needed for "make depend" */ #ifdef FEAT_MZSCHEME # include <schvers.h> diff --git a/src/if_ole.cpp b/src/if_ole.cpp index aabf6bb84b..aaa3868ef6 100644 --- a/src/if_ole.cpp +++ b/src/if_ole.cpp @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -34,6 +34,12 @@ extern HWND s_hwnd; extern HWND vim_parent_hwnd; } +#if (defined(_MSC_VER) && (_MSC_VER >= 1700)) || (__cplusplus >= 201103L) +# define FINAL final +#else +# define FINAL +#endif + #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) /* Work around old versions of basetsd.h which wrongly declares * UINT_PTR as unsigned long */ @@ -93,10 +99,10 @@ static CVim *app = 0; * ---------- */ -class CVim : public IVim +class CVim FINAL : public IVim { public: - ~CVim(); + virtual ~CVim(); static CVim *Create(int *pbDoRestart); // IUnknown members @@ -428,10 +434,11 @@ CVim::Eval(BSTR expr, BSTR *result) * ---------- */ -class CVimCF : public IClassFactory +class CVimCF FINAL : public IClassFactory { public: static CVimCF *Create(); + virtual ~CVimCF() {}; STDMETHOD(QueryInterface)(REFIID riid, void ** ppv); STDMETHOD_(unsigned long, AddRef)(void); diff --git a/src/if_perl.xs b/src/if_perl.xs index 286ceb7d71..1d32630f0a 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -49,10 +49,31 @@ # define __inline__ __inline #endif +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +#endif + #include <EXTERN.h> #include <perl.h> #include <XSUB.h> +#if defined(PERLIO_LAYERS) && !defined(USE_SFIO) +# include <perliol.h> +#endif +/* Workaround for perl < 5.8.7 */ +#ifndef PERLIO_FUNCS_DECL +# ifdef PERLIO_FUNCS_CONST +# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs +# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) +# else +# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs +# define PERLIO_FUNCS_CAST(funcs) (funcs) +# endif +#endif +#ifndef SvREFCNT_inc_void_NN +# define SvREFCNT_inc_void_NN SvREFCNT_inc +#endif /* * Work around clashes between Perl and Vim namespace. proto.h doesn't @@ -61,10 +82,10 @@ * if_perl.h, because we get all sorts of name clashes then. */ #ifndef PROTO -#ifndef __MINGW32__ -# include "proto/if_perl.pro" -# include "proto/if_perlsfio.pro" -#endif +# ifndef __MINGW32__ +# include "proto/if_perl.pro" +# include "proto/if_perlsfio.pro" +# endif #endif /* Perl compatibility stuff. This should ensure compatibility with older @@ -72,10 +93,10 @@ */ #ifndef PERL_VERSION -# include <patchlevel.h> -# define PERL_REVISION 5 -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION +# include <patchlevel.h> +# define PERL_REVISION 5 +# define PERL_VERSION PATCHLEVEL +# define PERL_SUBVERSION SUBVERSION #endif /* @@ -106,56 +127,56 @@ #endif #ifndef pTHX -# define pTHX void -# define pTHX_ +# define pTHX void +# define pTHX_ #endif #ifndef EXTERN_C # define EXTERN_C #endif -#if (PERL_REVISION == 5) && (PERL_VERSION >= 14) && defined(_MSC_VER) -/* Using PL_errgv to get the error message after perl_eval_sv() causes a crash - * with MSVC and Perl version 5.14. */ -# define AVOID_PL_ERRGV -#endif - /* Compatibility hacks over */ static PerlInterpreter *perl_interp = NULL; -static void xs_init __ARGS((pTHX)); -static void VIM_init __ARGS((void)); -EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*)); +static void xs_init(pTHX); +static void VIM_init(void); +EXTERN_C void boot_DynaLoader(pTHX_ CV*); /* * For dynamic linked perl. */ #if defined(DYNAMIC_PERL) || defined(PROTO) -#ifndef DYNAMIC_PERL /* just generating prototypes */ -#ifdef WIN3264 +# ifndef DYNAMIC_PERL /* just generating prototypes */ +# ifdef WIN3264 typedef int HANDLE; -#endif +# endif typedef int XSINIT_t; typedef int XSUBADDR_t; -#endif -#ifndef USE_ITHREADS +# endif +# ifndef USE_ITHREADS typedef int perl_key; -#endif +# endif -#ifndef WIN3264 -#include <dlfcn.h> -#define HANDLE void* -#define PERL_PROC void* -#define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) -#define symbol_from_dll dlsym -#define close_dll dlclose -#else -#define PERL_PROC FARPROC -#define load_dll vimLoadLib -#define symbol_from_dll GetProcAddress -#define close_dll FreeLibrary -#endif +# ifndef WIN3264 +# include <dlfcn.h> +# define HANDLE void* +# define PERL_PROC void* +# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) +# define symbol_from_dll dlsym +# define close_dll dlclose +# if defined(MACOS_X_UNIX) +# define DYNAMIC_PERL_DLL \ + "/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE/libperl.dylib" +# else +# define DYNAMIC_PERL_DLL "libperl.so" +# endif +# else +# define PERL_PROC FARPROC +# define load_dll vimLoadLib +# define symbol_from_dll GetProcAddress +# define close_dll FreeLibrary +# endif /* * Wrapper defines */ @@ -197,10 +218,12 @@ typedef int perl_key; # define Perl_stack_grow dll_Perl_stack_grow # define Perl_set_context dll_Perl_set_context # if (PERL_REVISION == 5) && (PERL_VERSION >= 14) -# define Perl_sv_2bool_flags dll_Perl_sv_2bool_flags -# define Perl_xs_apiversion_bootcheck dll_Perl_xs_apiversion_bootcheck +# define Perl_sv_2bool_flags dll_Perl_sv_2bool_flags +# if (PERL_REVISION == 5) && (PERL_VERSION < 22) +# define Perl_xs_apiversion_bootcheck dll_Perl_xs_apiversion_bootcheck +# endif # else -# define Perl_sv_2bool dll_Perl_sv_2bool +# define Perl_sv_2bool dll_Perl_sv_2bool # endif # define Perl_sv_2iv dll_Perl_sv_2iv # define Perl_sv_2mortal dll_Perl_sv_2mortal @@ -216,10 +239,10 @@ typedef int perl_key; # else # define Perl_sv_catpvn dll_Perl_sv_catpvn # endif -#ifdef PERL589_OR_LATER +# ifdef PERL589_OR_LATER # define Perl_sv_2iv_flags dll_Perl_sv_2iv_flags # define Perl_newXS_flags dll_Perl_newXS_flags -#endif +# endif # define Perl_sv_free dll_Perl_sv_free # if (PERL_REVISION == 5) && (PERL_VERSION >= 10) # define Perl_sv_free2 dll_Perl_sv_free2 @@ -268,11 +291,29 @@ typedef int perl_key; # define Perl_call_list dll_Perl_call_list # define Perl_Iscopestack_ix_ptr dll_Perl_Iscopestack_ix_ptr # define Perl_Iunitcheckav_ptr dll_Perl_Iunitcheckav_ptr +# if (PERL_REVISION == 5) && (PERL_VERSION >= 22) +# define Perl_xs_handshake dll_Perl_xs_handshake +# define Perl_xs_boot_epilog dll_Perl_xs_boot_epilog +# endif # if (PERL_REVISION == 5) && (PERL_VERSION >= 14) # ifdef USE_ITHREADS # define PL_thr_key *dll_PL_thr_key # endif # endif +# define Perl_hv_iternext_flags dll_Perl_hv_iternext_flags +# define Perl_hv_iterinit dll_Perl_hv_iterinit +# define Perl_hv_iterkey dll_Perl_hv_iterkey +# define Perl_hv_iterval dll_Perl_hv_iterval +# define Perl_av_fetch dll_Perl_av_fetch +# define Perl_av_len dll_Perl_av_len +# define Perl_sv_2nv_flags dll_Perl_sv_2nv_flags +# if defined(PERLIO_LAYERS) && !defined(USE_SFIO) +# define PerlIOBase_pushed dll_PerlIOBase_pushed +# define PerlIO_define_layer dll_PerlIO_define_layer +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 24) +# define Perl_savetmps dll_Perl_savetmps +# endif /* * Declare HANDLE for perl.dll and function pointers. @@ -286,20 +327,26 @@ static void (*perl_free)(PerlInterpreter*); static int (*perl_run)(PerlInterpreter*); static int (*perl_parse)(PerlInterpreter*, XSINIT_t, int, char**, char**); static void* (*Perl_get_context)(void); -static void (*Perl_croak)(pTHX_ const char*, ...); -#ifdef PERL5101_OR_LATER +static void (*Perl_croak)(pTHX_ const char*, ...) __attribute__noreturn__; +# ifdef PERL5101_OR_LATER /* Perl-5.18 has a different Perl_croak_xs_usage signature. */ -# if (PERL_REVISION == 5) && (PERL_VERSION >= 18) -static void (*Perl_croak_xs_usage)(const CV *const, const char *const params); -# else -static void (*Perl_croak_xs_usage)(pTHX_ const CV *const, const char *const params); +# if (PERL_REVISION == 5) && (PERL_VERSION >= 18) +static void (*Perl_croak_xs_usage)(const CV *const, const char *const params) + __attribute__noreturn__; +# else +static void (*Perl_croak_xs_usage)(pTHX_ const CV *const, const char *const params) + __attribute__noreturn__; +# endif # endif -#endif -static void (*Perl_croak_nocontext)(const char*, ...); +static void (*Perl_croak_nocontext)(const char*, ...) __attribute__noreturn__; static I32 (*Perl_dowantarray)(pTHX); static void (*Perl_free_tmps)(pTHX); static HV* (*Perl_gv_stashpv)(pTHX_ const char*, I32); +# if (PERL_REVISION == 5) && (PERL_VERSION >= 22) +static I32* (*Perl_markstack_grow)(pTHX); +# else static void (*Perl_markstack_grow)(pTHX); +# endif static MAGIC* (*Perl_mg_find)(pTHX_ SV*, int); static CV* (*Perl_newXS)(pTHX_ char*, XSUBADDR_t, char*); static SV* (*Perl_newSV)(pTHX_ STRLEN); @@ -314,48 +361,50 @@ static SV* (*Perl_call_method)(pTHX_ const char*, I32); static void (*Perl_pop_scope)(pTHX); static void (*Perl_push_scope)(pTHX); static void (*Perl_save_int)(pTHX_ int*); -#if (PERL_REVISION == 5) && (PERL_VERSION >= 20) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 20) static void (*Perl_save_strlen)(pTHX_ STRLEN* ptr); -#endif +# endif static SV** (*Perl_stack_grow)(pTHX_ SV**, SV**p, int); static SV** (*Perl_set_context)(void*); -#if (PERL_REVISION == 5) && (PERL_VERSION >= 14) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) static bool (*Perl_sv_2bool_flags)(pTHX_ SV*, I32); +# if (PERL_REVISION == 5) && (PERL_VERSION < 22) static void (*Perl_xs_apiversion_bootcheck)(pTHX_ SV *module, const char *api_p, STRLEN api_len); -#else +# endif +# else static bool (*Perl_sv_2bool)(pTHX_ SV*); -#endif +# endif static IV (*Perl_sv_2iv)(pTHX_ SV*); static SV* (*Perl_sv_2mortal)(pTHX_ SV*); -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) static char* (*Perl_sv_2pv_flags)(pTHX_ SV*, STRLEN*, I32); static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*); -#else +# else static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*); -#endif +# endif static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*); -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) static void (*Perl_sv_catpvn_flags)(pTHX_ SV* , const char*, STRLEN, I32); -#else +# else static void (*Perl_sv_catpvn)(pTHX_ SV*, const char*, STRLEN); -#endif -#ifdef PERL589_OR_LATER +# endif +# ifdef PERL589_OR_LATER static IV (*Perl_sv_2iv_flags)(pTHX_ SV* sv, I32 flags); static CV * (*Perl_newXS_flags)(pTHX_ const char *name, XSUBADDR_t subaddr, const char *const filename, const char *const proto, U32 flags); -#endif +# endif static void (*Perl_sv_free)(pTHX_ SV*); static int (*Perl_sv_isa)(pTHX_ SV*, const char*); static void (*Perl_sv_magic)(pTHX_ SV*, SV*, int, const char*, I32); static void (*Perl_sv_setiv)(pTHX_ SV*, IV); static void (*Perl_sv_setpv)(pTHX_ SV*, const char*); static void (*Perl_sv_setpvn)(pTHX_ SV*, const char*, STRLEN); -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) static void (*Perl_sv_setsv_flags)(pTHX_ SV*, SV*, I32); -#else +# else static void (*Perl_sv_setsv)(pTHX_ SV*, SV*); -#endif +# endif static bool (*Perl_sv_upgrade)(pTHX_ SV*, U32); -#if (PERL_REVISION == 5) && (PERL_VERSION < 10) +# if (PERL_REVISION == 5) && (PERL_VERSION < 10) static SV*** (*Perl_Tstack_sp_ptr)(register PerlInterpreter*); static OP** (*Perl_Top_ptr)(register PerlInterpreter*); static SV*** (*Perl_Tstack_base_ptr)(register PerlInterpreter*); @@ -367,18 +416,18 @@ static I32** (*Perl_Tmarkstack_max_ptr)(register PerlInterpreter*); static SV** (*Perl_TSv_ptr)(register PerlInterpreter*); static XPV** (*Perl_TXpv_ptr)(register PerlInterpreter*); static STRLEN* (*Perl_Tna_ptr)(register PerlInterpreter*); -#else +# else /* Perl-5.18 has a different Perl_sv_free2 signature. */ -# if (PERL_REVISION == 5) && (PERL_VERSION >= 18) +# if (PERL_REVISION == 5) && (PERL_VERSION >= 18) static void (*Perl_sv_free2)(pTHX_ SV*, const U32); -# else +# else static void (*Perl_sv_free2)(pTHX_ SV*); -# endif +# endif static void (*Perl_sys_init)(int* argc, char*** argv); static void (*Perl_sys_term)(void); static void (*Perl_call_list)(pTHX_ I32, AV*); -# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) -# else +# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) +# else static SV** (*Perl_ISv_ptr)(register PerlInterpreter*); static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*); static SV*** (*Perl_Istack_base_ptr)(register PerlInterpreter*); @@ -392,20 +441,38 @@ static SV*** (*Perl_Istack_sp_ptr)(register PerlInterpreter*); static OP** (*Perl_Iop_ptr)(register PerlInterpreter*); static I32* (*Perl_Iscopestack_ix_ptr)(register PerlInterpreter*); static AV** (*Perl_Iunitcheckav_ptr)(register PerlInterpreter*); +# endif +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 22) +static I32 (*Perl_xs_handshake)(const U32, void *, const char *, ...); +static void (*Perl_xs_boot_epilog)(pTHX_ const U32); # endif -#endif -#if (PERL_REVISION == 5) && (PERL_VERSION >= 14) -# ifdef USE_ITHREADS +# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) +# ifdef USE_ITHREADS static perl_key* dll_PL_thr_key; -# endif -#else +# endif +# else static GV** (*Perl_Idefgv_ptr)(register PerlInterpreter*); static GV** (*Perl_Ierrgv_ptr)(register PerlInterpreter*); static SV* (*Perl_Isv_yes_ptr)(register PerlInterpreter*); static perl_key* (*Perl_Gthr_key_ptr)_((pTHX)); -#endif +# endif static void (*boot_DynaLoader)_((pTHX_ CV*)); +static HE * (*Perl_hv_iternext_flags)(pTHX_ HV *, I32); +static I32 (*Perl_hv_iterinit)(pTHX_ HV *); +static char * (*Perl_hv_iterkey)(pTHX_ HE *, I32 *); +static SV * (*Perl_hv_iterval)(pTHX_ HV *, HE *); +static SV** (*Perl_av_fetch)(pTHX_ AV *, SSize_t, I32); +static SSize_t (*Perl_av_len)(pTHX_ AV *); +static NV (*Perl_sv_2nv_flags)(pTHX_ SV *const, const I32); +# if defined(PERLIO_LAYERS) && !defined(USE_SFIO) +static IV (*PerlIOBase_pushed)(pTHX_ PerlIO *, const char *, SV *, PerlIO_funcs *); +static void (*PerlIO_define_layer)(pTHX_ PerlIO_funcs *); +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 24) +static void (*Perl_savetmps)(pTHX); +# endif /* * Table of name to function pointer of perl. @@ -413,135 +480,189 @@ static void (*boot_DynaLoader)_((pTHX_ CV*)); static struct { char* name; PERL_PROC* ptr; + int ignorable; } perl_funcname_table[] = { - {"perl_alloc", (PERL_PROC*)&perl_alloc}, - {"perl_construct", (PERL_PROC*)&perl_construct}, - {"perl_destruct", (PERL_PROC*)&perl_destruct}, - {"perl_free", (PERL_PROC*)&perl_free}, - {"perl_run", (PERL_PROC*)&perl_run}, - {"perl_parse", (PERL_PROC*)&perl_parse}, - {"Perl_get_context", (PERL_PROC*)&Perl_get_context}, - {"Perl_croak", (PERL_PROC*)&Perl_croak}, -#ifdef PERL5101_OR_LATER - {"Perl_croak_xs_usage", (PERL_PROC*)&Perl_croak_xs_usage}, -#endif -#ifdef PERL_IMPLICIT_CONTEXT - {"Perl_croak_nocontext", (PERL_PROC*)&Perl_croak_nocontext}, -#endif - {"Perl_dowantarray", (PERL_PROC*)&Perl_dowantarray}, - {"Perl_free_tmps", (PERL_PROC*)&Perl_free_tmps}, - {"Perl_gv_stashpv", (PERL_PROC*)&Perl_gv_stashpv}, - {"Perl_markstack_grow", (PERL_PROC*)&Perl_markstack_grow}, - {"Perl_mg_find", (PERL_PROC*)&Perl_mg_find}, - {"Perl_newXS", (PERL_PROC*)&Perl_newXS}, - {"Perl_newSV", (PERL_PROC*)&Perl_newSV}, - {"Perl_newSViv", (PERL_PROC*)&Perl_newSViv}, - {"Perl_newSVpv", (PERL_PROC*)&Perl_newSVpv}, - {"Perl_call_argv", (PERL_PROC*)&Perl_call_argv}, - {"Perl_call_pv", (PERL_PROC*)&Perl_call_pv}, - {"Perl_eval_sv", (PERL_PROC*)&Perl_eval_sv}, - {"Perl_get_sv", (PERL_PROC*)&Perl_get_sv}, - {"Perl_eval_pv", (PERL_PROC*)&Perl_eval_pv}, - {"Perl_call_method", (PERL_PROC*)&Perl_call_method}, - {"Perl_pop_scope", (PERL_PROC*)&Perl_pop_scope}, - {"Perl_push_scope", (PERL_PROC*)&Perl_push_scope}, - {"Perl_save_int", (PERL_PROC*)&Perl_save_int}, -#if (PERL_REVISION == 5) && (PERL_VERSION >= 20) - {"Perl_save_strlen", (PERL_PROC*)&Perl_save_strlen}, -#endif - {"Perl_stack_grow", (PERL_PROC*)&Perl_stack_grow}, - {"Perl_set_context", (PERL_PROC*)&Perl_set_context}, -#if (PERL_REVISION == 5) && (PERL_VERSION >= 14) - {"Perl_sv_2bool_flags", (PERL_PROC*)&Perl_sv_2bool_flags}, - {"Perl_xs_apiversion_bootcheck",(PERL_PROC*)&Perl_xs_apiversion_bootcheck}, -#else - {"Perl_sv_2bool", (PERL_PROC*)&Perl_sv_2bool}, -#endif - {"Perl_sv_2iv", (PERL_PROC*)&Perl_sv_2iv}, - {"Perl_sv_2mortal", (PERL_PROC*)&Perl_sv_2mortal}, -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) - {"Perl_sv_2pv_flags", (PERL_PROC*)&Perl_sv_2pv_flags}, - {"Perl_sv_2pv_nolen", (PERL_PROC*)&Perl_sv_2pv_nolen}, -#else - {"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv}, -#endif -#ifdef PERL589_OR_LATER - {"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags}, - {"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags}, -#endif - {"Perl_sv_bless", (PERL_PROC*)&Perl_sv_bless}, -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) - {"Perl_sv_catpvn_flags", (PERL_PROC*)&Perl_sv_catpvn_flags}, -#else - {"Perl_sv_catpvn", (PERL_PROC*)&Perl_sv_catpvn}, -#endif - {"Perl_sv_free", (PERL_PROC*)&Perl_sv_free}, - {"Perl_sv_isa", (PERL_PROC*)&Perl_sv_isa}, - {"Perl_sv_magic", (PERL_PROC*)&Perl_sv_magic}, - {"Perl_sv_setiv", (PERL_PROC*)&Perl_sv_setiv}, - {"Perl_sv_setpv", (PERL_PROC*)&Perl_sv_setpv}, - {"Perl_sv_setpvn", (PERL_PROC*)&Perl_sv_setpvn}, -#if (PERL_REVISION == 5) && (PERL_VERSION >= 8) - {"Perl_sv_setsv_flags", (PERL_PROC*)&Perl_sv_setsv_flags}, -#else - {"Perl_sv_setsv", (PERL_PROC*)&Perl_sv_setsv}, -#endif - {"Perl_sv_upgrade", (PERL_PROC*)&Perl_sv_upgrade}, -#if (PERL_REVISION == 5) && (PERL_VERSION < 10) - {"Perl_Tstack_sp_ptr", (PERL_PROC*)&Perl_Tstack_sp_ptr}, - {"Perl_Top_ptr", (PERL_PROC*)&Perl_Top_ptr}, - {"Perl_Tstack_base_ptr", (PERL_PROC*)&Perl_Tstack_base_ptr}, - {"Perl_Tstack_max_ptr", (PERL_PROC*)&Perl_Tstack_max_ptr}, - {"Perl_Ttmps_ix_ptr", (PERL_PROC*)&Perl_Ttmps_ix_ptr}, - {"Perl_Ttmps_floor_ptr", (PERL_PROC*)&Perl_Ttmps_floor_ptr}, - {"Perl_Tmarkstack_ptr_ptr", (PERL_PROC*)&Perl_Tmarkstack_ptr_ptr}, - {"Perl_Tmarkstack_max_ptr", (PERL_PROC*)&Perl_Tmarkstack_max_ptr}, - {"Perl_TSv_ptr", (PERL_PROC*)&Perl_TSv_ptr}, - {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr}, - {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr}, -#else - {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2}, - {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init}, - {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term}, - {"Perl_call_list", (PERL_PROC*)&Perl_call_list}, + {"perl_alloc", (PERL_PROC*)&perl_alloc, FALSE}, + {"perl_construct", (PERL_PROC*)&perl_construct, FALSE}, + {"perl_destruct", (PERL_PROC*)&perl_destruct, FALSE}, + {"perl_free", (PERL_PROC*)&perl_free, FALSE}, + {"perl_run", (PERL_PROC*)&perl_run, FALSE}, + {"perl_parse", (PERL_PROC*)&perl_parse, FALSE}, + {"Perl_get_context", (PERL_PROC*)&Perl_get_context, FALSE}, + {"Perl_croak", (PERL_PROC*)&Perl_croak, FALSE}, +# ifdef PERL5101_OR_LATER + {"Perl_croak_xs_usage", (PERL_PROC*)&Perl_croak_xs_usage, TRUE}, +# endif +# ifdef PERL_IMPLICIT_CONTEXT + {"Perl_croak_nocontext", (PERL_PROC*)&Perl_croak_nocontext, FALSE}, +# endif + {"Perl_dowantarray", (PERL_PROC*)&Perl_dowantarray, FALSE}, + {"Perl_free_tmps", (PERL_PROC*)&Perl_free_tmps, FALSE}, + {"Perl_gv_stashpv", (PERL_PROC*)&Perl_gv_stashpv, FALSE}, + {"Perl_markstack_grow", (PERL_PROC*)&Perl_markstack_grow, FALSE}, + {"Perl_mg_find", (PERL_PROC*)&Perl_mg_find, FALSE}, + {"Perl_newXS", (PERL_PROC*)&Perl_newXS, FALSE}, + {"Perl_newSV", (PERL_PROC*)&Perl_newSV, FALSE}, + {"Perl_newSViv", (PERL_PROC*)&Perl_newSViv, FALSE}, + {"Perl_newSVpv", (PERL_PROC*)&Perl_newSVpv, FALSE}, + {"Perl_call_argv", (PERL_PROC*)&Perl_call_argv, FALSE}, + {"Perl_call_pv", (PERL_PROC*)&Perl_call_pv, FALSE}, + {"Perl_eval_sv", (PERL_PROC*)&Perl_eval_sv, FALSE}, + {"Perl_get_sv", (PERL_PROC*)&Perl_get_sv, FALSE}, + {"Perl_eval_pv", (PERL_PROC*)&Perl_eval_pv, FALSE}, + {"Perl_call_method", (PERL_PROC*)&Perl_call_method, FALSE}, + {"Perl_pop_scope", (PERL_PROC*)&Perl_pop_scope, FALSE}, + {"Perl_push_scope", (PERL_PROC*)&Perl_push_scope, FALSE}, + {"Perl_save_int", (PERL_PROC*)&Perl_save_int, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION >= 20) + {"Perl_save_strlen", (PERL_PROC*)&Perl_save_strlen, FALSE}, +# endif + {"Perl_stack_grow", (PERL_PROC*)&Perl_stack_grow, FALSE}, + {"Perl_set_context", (PERL_PROC*)&Perl_set_context, FALSE}, # if (PERL_REVISION == 5) && (PERL_VERSION >= 14) + {"Perl_sv_2bool_flags", (PERL_PROC*)&Perl_sv_2bool_flags, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION < 22) + {"Perl_xs_apiversion_bootcheck",(PERL_PROC*)&Perl_xs_apiversion_bootcheck, FALSE}, +# endif # else - {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr}, - {"Perl_Istack_max_ptr", (PERL_PROC*)&Perl_Istack_max_ptr}, - {"Perl_Istack_base_ptr", (PERL_PROC*)&Perl_Istack_base_ptr}, - {"Perl_IXpv_ptr", (PERL_PROC*)&Perl_IXpv_ptr}, - {"Perl_Itmps_ix_ptr", (PERL_PROC*)&Perl_Itmps_ix_ptr}, - {"Perl_Itmps_floor_ptr", (PERL_PROC*)&Perl_Itmps_floor_ptr}, - {"Perl_Ina_ptr", (PERL_PROC*)&Perl_Ina_ptr}, - {"Perl_Imarkstack_ptr_ptr", (PERL_PROC*)&Perl_Imarkstack_ptr_ptr}, - {"Perl_Imarkstack_max_ptr", (PERL_PROC*)&Perl_Imarkstack_max_ptr}, - {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr}, - {"Perl_Iop_ptr", (PERL_PROC*)&Perl_Iop_ptr}, - {"Perl_Iscopestack_ix_ptr", (PERL_PROC*)&Perl_Iscopestack_ix_ptr}, - {"Perl_Iunitcheckav_ptr", (PERL_PROC*)&Perl_Iunitcheckav_ptr}, + {"Perl_sv_2bool", (PERL_PROC*)&Perl_sv_2bool, FALSE}, # endif -#endif -#if (PERL_REVISION == 5) && (PERL_VERSION >= 14) + {"Perl_sv_2iv", (PERL_PROC*)&Perl_sv_2iv, FALSE}, + {"Perl_sv_2mortal", (PERL_PROC*)&Perl_sv_2mortal, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) + {"Perl_sv_2pv_flags", (PERL_PROC*)&Perl_sv_2pv_flags, FALSE}, + {"Perl_sv_2pv_nolen", (PERL_PROC*)&Perl_sv_2pv_nolen, FALSE}, +# else + {"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv, FALSE}, +# endif +# ifdef PERL589_OR_LATER + {"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags, FALSE}, + {"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags, FALSE}, +# endif + {"Perl_sv_bless", (PERL_PROC*)&Perl_sv_bless, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) + {"Perl_sv_catpvn_flags", (PERL_PROC*)&Perl_sv_catpvn_flags, FALSE}, +# else + {"Perl_sv_catpvn", (PERL_PROC*)&Perl_sv_catpvn, FALSE}, +# endif + {"Perl_sv_free", (PERL_PROC*)&Perl_sv_free, FALSE}, + {"Perl_sv_isa", (PERL_PROC*)&Perl_sv_isa, FALSE}, + {"Perl_sv_magic", (PERL_PROC*)&Perl_sv_magic, FALSE}, + {"Perl_sv_setiv", (PERL_PROC*)&Perl_sv_setiv, FALSE}, + {"Perl_sv_setpv", (PERL_PROC*)&Perl_sv_setpv, FALSE}, + {"Perl_sv_setpvn", (PERL_PROC*)&Perl_sv_setpvn, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION >= 8) + {"Perl_sv_setsv_flags", (PERL_PROC*)&Perl_sv_setsv_flags, FALSE}, +# else + {"Perl_sv_setsv", (PERL_PROC*)&Perl_sv_setsv, FALSE}, +# endif + {"Perl_sv_upgrade", (PERL_PROC*)&Perl_sv_upgrade, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION < 10) + {"Perl_Tstack_sp_ptr", (PERL_PROC*)&Perl_Tstack_sp_ptr, FALSE}, + {"Perl_Top_ptr", (PERL_PROC*)&Perl_Top_ptr, FALSE}, + {"Perl_Tstack_base_ptr", (PERL_PROC*)&Perl_Tstack_base_ptr, FALSE}, + {"Perl_Tstack_max_ptr", (PERL_PROC*)&Perl_Tstack_max_ptr, FALSE}, + {"Perl_Ttmps_ix_ptr", (PERL_PROC*)&Perl_Ttmps_ix_ptr, FALSE}, + {"Perl_Ttmps_floor_ptr", (PERL_PROC*)&Perl_Ttmps_floor_ptr, FALSE}, + {"Perl_Tmarkstack_ptr_ptr", (PERL_PROC*)&Perl_Tmarkstack_ptr_ptr, FALSE}, + {"Perl_Tmarkstack_max_ptr", (PERL_PROC*)&Perl_Tmarkstack_max_ptr, FALSE}, + {"Perl_TSv_ptr", (PERL_PROC*)&Perl_TSv_ptr, FALSE}, + {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr, FALSE}, + {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr, FALSE}, +# else + {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2, FALSE}, + {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init, FALSE}, + {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term, FALSE}, + {"Perl_call_list", (PERL_PROC*)&Perl_call_list, FALSE}, +# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) +# else + {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr, FALSE}, + {"Perl_Istack_max_ptr", (PERL_PROC*)&Perl_Istack_max_ptr, FALSE}, + {"Perl_Istack_base_ptr", (PERL_PROC*)&Perl_Istack_base_ptr, FALSE}, + {"Perl_IXpv_ptr", (PERL_PROC*)&Perl_IXpv_ptr, FALSE}, + {"Perl_Itmps_ix_ptr", (PERL_PROC*)&Perl_Itmps_ix_ptr, FALSE}, + {"Perl_Itmps_floor_ptr", (PERL_PROC*)&Perl_Itmps_floor_ptr, FALSE}, + {"Perl_Ina_ptr", (PERL_PROC*)&Perl_Ina_ptr, FALSE}, + {"Perl_Imarkstack_ptr_ptr", (PERL_PROC*)&Perl_Imarkstack_ptr_ptr, FALSE}, + {"Perl_Imarkstack_max_ptr", (PERL_PROC*)&Perl_Imarkstack_max_ptr, FALSE}, + {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr, FALSE}, + {"Perl_Iop_ptr", (PERL_PROC*)&Perl_Iop_ptr, FALSE}, + {"Perl_Iscopestack_ix_ptr", (PERL_PROC*)&Perl_Iscopestack_ix_ptr, FALSE}, + {"Perl_Iunitcheckav_ptr", (PERL_PROC*)&Perl_Iunitcheckav_ptr, FALSE}, +# endif +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 22) + {"Perl_xs_handshake", (PERL_PROC*)&Perl_xs_handshake}, + {"Perl_xs_boot_epilog", (PERL_PROC*)&Perl_xs_boot_epilog}, +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 14) # ifdef USE_ITHREADS {"PL_thr_key", (PERL_PROC*)&dll_PL_thr_key}, # endif -#else - {"Perl_Idefgv_ptr", (PERL_PROC*)&Perl_Idefgv_ptr}, - {"Perl_Ierrgv_ptr", (PERL_PROC*)&Perl_Ierrgv_ptr}, - {"Perl_Isv_yes_ptr", (PERL_PROC*)&Perl_Isv_yes_ptr}, - {"Perl_Gthr_key_ptr", (PERL_PROC*)&Perl_Gthr_key_ptr}, -#endif - {"boot_DynaLoader", (PERL_PROC*)&boot_DynaLoader}, +# else + {"Perl_Idefgv_ptr", (PERL_PROC*)&Perl_Idefgv_ptr, FALSE}, + {"Perl_Ierrgv_ptr", (PERL_PROC*)&Perl_Ierrgv_ptr, FALSE}, + {"Perl_Isv_yes_ptr", (PERL_PROC*)&Perl_Isv_yes_ptr, FALSE}, + {"Perl_Gthr_key_ptr", (PERL_PROC*)&Perl_Gthr_key_ptr, FALSE}, +# endif + {"boot_DynaLoader", (PERL_PROC*)&boot_DynaLoader, FALSE}, + {"Perl_hv_iternext_flags", (PERL_PROC*)&Perl_hv_iternext_flags, FALSE}, + {"Perl_hv_iterinit", (PERL_PROC*)&Perl_hv_iterinit, FALSE}, + {"Perl_hv_iterkey", (PERL_PROC*)&Perl_hv_iterkey, FALSE}, + {"Perl_hv_iterval", (PERL_PROC*)&Perl_hv_iterval, FALSE}, + {"Perl_av_fetch", (PERL_PROC*)&Perl_av_fetch, FALSE}, + {"Perl_av_len", (PERL_PROC*)&Perl_av_len, FALSE}, + {"Perl_sv_2nv_flags", (PERL_PROC*)&Perl_sv_2nv_flags, FALSE}, +# if defined(PERLIO_LAYERS) && !defined(USE_SFIO) + {"PerlIOBase_pushed", (PERL_PROC*)&PerlIOBase_pushed, FALSE}, + {"PerlIO_define_layer", (PERL_PROC*)&PerlIO_define_layer, FALSE}, +# endif +# if (PERL_REVISION == 5) && (PERL_VERSION >= 24) + {"Perl_savetmps", (PERL_PROC*)&Perl_savetmps}, +# endif {"", NULL}, }; /* Work around for perl-5.18. - * The definitions of S_SvREFCNT_inc and S_SvREFCNT_dec are needed, so include - * "perl\lib\CORE\inline.h", after Perl_sv_free2 is defined. - * The linker won't complain about undefined __impl_Perl_sv_free2. */ -#if (PERL_REVISION == 5) && (PERL_VERSION >= 18) -# include <inline.h> -#endif + * For now, only the definitions of S_SvREFCNT_dec are needed in + * "perl\lib\CORE\inline.h". */ +# if (PERL_REVISION == 5) && (PERL_VERSION >= 18) +static void +S_SvREFCNT_dec(pTHX_ SV *sv) +{ + if (LIKELY(sv != NULL)) { + U32 rc = SvREFCNT(sv); + if (LIKELY(rc > 1)) + SvREFCNT(sv) = rc - 1; + else + Perl_sv_free2(aTHX_ sv, rc); + } +} +# endif + +/* perl-5.26 also needs S_TOPMARK and S_POPMARK. */ +# if (PERL_REVISION == 5) && (PERL_VERSION >= 26) +PERL_STATIC_INLINE I32 +S_TOPMARK(pTHX) +{ + DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, + "MARK top %p %" IVdf "\n", + PL_markstack_ptr, + (IV)*PL_markstack_ptr))); + return *PL_markstack_ptr; +} + +PERL_STATIC_INLINE I32 +S_POPMARK(pTHX) +{ + DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, + "MARK pop %p %" IVdf "\n", + (PL_markstack_ptr-1), + (IV)*(PL_markstack_ptr-1)))); + assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow"); + return *PL_markstack_ptr--; +} +# endif /* * Make all runtime-links of perl. @@ -569,7 +690,8 @@ perl_runtime_link_init(char *libname, int verbose) for (i = 0; perl_funcname_table[i].ptr; ++i) { if (!(*perl_funcname_table[i].ptr = symbol_from_dll(hPerlLib, - perl_funcname_table[i].name))) + perl_funcname_table[i].name)) && + !perl_funcname_table[i].ignorable) { close_dll(hPerlLib); hPerlLib = NULL; @@ -586,20 +708,23 @@ perl_runtime_link_init(char *libname, int verbose) * There were no DLL loaded, return FALSE. */ int -perl_enabled(verbose) - int verbose; +perl_enabled(int verbose) { - return perl_runtime_link_init(DYNAMIC_PERL_DLL, verbose) == OK; + return perl_runtime_link_init((char *)p_perldll, verbose) == OK; } #endif /* DYNAMIC_PERL */ +#if defined(PERLIO_LAYERS) && !defined(USE_SFIO) +static void vim_IOLayer_init(void); +#endif + /* * perl_init(): initialize perl interpreter * We have to call perl_parse to initialize some structures, * there's nothing to actually parse. */ static void -perl_init() +perl_init(void) { char *bootargs[] = { "VI", NULL }; int argc = 3; @@ -618,6 +743,8 @@ perl_init() sfdisc(PerlIO_stderr(), sfdcnewvim()); sfsetbuf(PerlIO_stdout(), NULL, 0); sfsetbuf(PerlIO_stderr(), NULL, 0); +#elif defined(PERLIO_LAYERS) + vim_IOLayer_init(); #endif } @@ -625,7 +752,7 @@ perl_init() * perl_end(): clean up after ourselves */ void -perl_end() +perl_end(void) { if (perl_interp) { @@ -634,7 +761,7 @@ perl_end() perl_free(perl_interp); perl_interp = NULL; #if (PERL_REVISION == 5) && (PERL_VERSION >= 10) - Perl_sys_term(); + Perl_sys_term(); #endif } #ifdef DYNAMIC_PERL @@ -651,9 +778,9 @@ perl_end() * split at '\n' first though. */ void -msg_split(s, attr) - char_u *s; - int attr; /* highlighting attributes */ +msg_split( + char_u *s, + int attr) /* highlighting attributes */ { char *next; char *token = (char *)s; @@ -674,10 +801,10 @@ msg_split(s, attr) * work properly. */ char_u * -eval_to_string(arg, nextcmd, dolist) - char_u *arg UNUSED; - char_u **nextcmd UNUSED; - int dolist UNUSED; +eval_to_string( + char_u *arg UNUSED, + char_u **nextcmd UNUSED, + int dolist UNUSED) { return NULL; } @@ -695,9 +822,7 @@ eval_to_string(arg, nextcmd, dolist) */ static SV * -newWINrv(rv, ptr) - SV *rv; - win_T *ptr; +newWINrv(SV *rv, win_T *ptr) { sv_upgrade(rv, SVt_RV); if (ptr->w_perl_private == NULL) @@ -706,16 +831,14 @@ newWINrv(rv, ptr) sv_setiv(ptr->w_perl_private, PTR2IV(ptr)); } else - SvREFCNT_inc(ptr->w_perl_private); + SvREFCNT_inc_void_NN(ptr->w_perl_private); SvRV(rv) = ptr->w_perl_private; SvROK_on(rv); return sv_bless(rv, gv_stashpv("VIWIN", TRUE)); } static SV * -newBUFrv(rv, ptr) - SV *rv; - buf_T *ptr; +newBUFrv(SV *rv, buf_T *ptr) { sv_upgrade(rv, SVt_RV); if (ptr->b_perl_private == NULL) @@ -724,7 +847,7 @@ newBUFrv(rv, ptr) sv_setiv(ptr->b_perl_private, PTR2IV(ptr)); } else - SvREFCNT_inc(ptr->b_perl_private); + SvREFCNT_inc_void_NN(ptr->b_perl_private); SvRV(rv) = ptr->b_perl_private; SvROK_on(rv); return sv_bless(rv, gv_stashpv("VIBUF", TRUE)); @@ -735,8 +858,7 @@ newBUFrv(rv, ptr) * Remove all references to the window to be destroyed */ void -perl_win_free(wp) - win_T *wp; +perl_win_free(win_T *wp) { if (wp->w_perl_private) sv_setiv((SV *)wp->w_perl_private, 0); @@ -744,8 +866,7 @@ perl_win_free(wp) } void -perl_buf_free(bp) - buf_T *bp; +perl_buf_free(buf_T *bp) { if (bp->b_perl_private) sv_setiv((SV *)bp->b_perl_private, 0); @@ -757,7 +878,7 @@ perl_buf_free(bp) I32 cur_val(pTHX_ IV iv, SV *sv); # else I32 cur_val(IV iv, SV *sv); -#endif +# endif /* * Handler for the magic variables $main::curwin and $main::curbuf. @@ -777,6 +898,7 @@ I32 cur_val(IV iv, SV *sv) else rv = newBUFrv(newSV(0), curbuf); sv_setsv(sv, rv); + SvREFCNT_dec(SvRV(rv)); return 0; } #endif /* !PROTO */ @@ -789,7 +911,7 @@ struct ufuncs cb_funcs = { cur_val, 0, 1 }; * Make the magical main::curwin and main::curbuf variables */ static void -VIM_init() +VIM_init(void) { static char cw[] = "main::curwin"; static char cb[] = "main::curbuf"; @@ -821,8 +943,7 @@ static char *e_noperl = N_("Sorry, this command is disabled: the Perl library co * ":perl" */ void -ex_perl(eap) - exarg_T *eap; +ex_perl(exarg_T *eap) { char *err; char *script; @@ -888,11 +1009,7 @@ ex_perl(eap) SvREFCNT_dec(sv); -#ifdef AVOID_PL_ERRGV - err = SvPV(perl_get_sv("@", GV_ADD), length); -#else err = SvPV(GvSV(PL_errgv), length); -#endif FREETMPS; LEAVE; @@ -906,8 +1023,7 @@ ex_perl(eap) } static int -replace_line(line, end) - linenr_T *line, *end; +replace_line(linenr_T *line, linenr_T *end) { char *str; @@ -927,19 +1043,281 @@ replace_line(line, end) return OK; } +static struct ref_map_S { + void *vim_ref; + SV *perl_ref; + struct ref_map_S *next; +} *ref_map = NULL; + + static void +ref_map_free(void) +{ + struct ref_map_S *tofree; + struct ref_map_S *refs = ref_map; + + while (refs) { + tofree = refs; + refs = refs->next; + vim_free(tofree); + } + ref_map = NULL; +} + + static struct ref_map_S * +ref_map_find_SV(SV *const sv) +{ + struct ref_map_S *refs = ref_map; + int count = 350; + + while (refs) { + if (refs->perl_ref == sv) + break; + refs = refs->next; + count--; + } + + if (!refs && count > 0) { + refs = (struct ref_map_S *)alloc(sizeof(struct ref_map_S)); + if (!refs) + return NULL; + refs->perl_ref = sv; + refs->vim_ref = NULL; + refs->next = ref_map; + ref_map = refs; + } + + return refs; +} + + static int +perl_to_vim(SV *sv, typval_T *rettv) +{ + if (SvROK(sv)) + sv = SvRV(sv); + + switch (SvTYPE(sv)) { + case SVt_NULL: + break; + case SVt_NV: /* float */ +#ifdef FEAT_FLOAT + rettv->v_type = VAR_FLOAT; + rettv->vval.v_float = SvNV(sv); + break; +#endif + case SVt_IV: /* integer */ + if (!SvROK(sv)) { /* references should be string */ + rettv->vval.v_number = SvIV(sv); + break; + } + /* FALLTHROUGH */ + case SVt_PV: /* string */ + { + size_t len = 0; + char * str_from = SvPV(sv, len); + char_u *str_to = (char_u*)alloc( + (unsigned)(sizeof(char_u) * (len + 1))); + + if (str_to) { + str_to[len] = '\0'; + + while (len--) { + if (str_from[len] == '\0') + str_to[len] = '\n'; + else + str_to[len] = str_from[len]; + } + } + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = str_to; + break; + } + case SVt_PVAV: /* list */ + { + SSize_t size; + listitem_T * item; + SV ** item2; + list_T * list; + struct ref_map_S * refs; + + if ((refs = ref_map_find_SV(sv)) == NULL) + return FAIL; + + if (refs->vim_ref) + list = (list_T *) refs->vim_ref; + else + { + if ((list = list_alloc()) == NULL) + return FAIL; + refs->vim_ref = list; + + for (size = av_len((AV*)sv); size >= 0; size--) + { + if ((item = listitem_alloc()) == NULL) + break; + + item->li_tv.v_type = VAR_NUMBER; + item->li_tv.v_lock = 0; + item->li_tv.vval.v_number = 0; + list_insert(list, item, list->lv_first); + + item2 = av_fetch((AV *)sv, size, 0); + + if (item2 == NULL || *item2 == NULL || + perl_to_vim(*item2, &item->li_tv) == FAIL) + break; + } + } + + rettv_list_set(rettv, list); + break; + } + case SVt_PVHV: /* dictionary */ + { + HE * entry; + I32 key_len; + char * key; + dictitem_T * item; + SV * item2; + dict_T * dict; + struct ref_map_S * refs; + + if ((refs = ref_map_find_SV(sv)) == NULL) + return FAIL; + + if (refs->vim_ref) + dict = (dict_T *) refs->vim_ref; + else + { + + if ((dict = dict_alloc()) == NULL) + return FAIL; + refs->vim_ref = dict; + + hv_iterinit((HV *)sv); + + for (entry = hv_iternext((HV *)sv); entry; entry = hv_iternext((HV *)sv)) + { + key_len = 0; + key = hv_iterkey(entry, &key_len); + + if (!key || !key_len || strlen(key) < (size_t)key_len) { + EMSG2("Malformed key Dictionary '%s'", key && *key ? key : "(empty)"); + break; + } + + if ((item = dictitem_alloc((char_u *)key)) == NULL) + break; + + item->di_tv.v_type = VAR_NUMBER; + item->di_tv.v_lock = 0; + item->di_tv.vval.v_number = 0; + + if (dict_add(dict, item) == FAIL) { + dictitem_free(item); + break; + } + item2 = hv_iterval((HV *)sv, entry); + if (item2 == NULL || perl_to_vim(item2, &item->di_tv) == FAIL) + break; + } + } + + rettv_dict_set(rettv, dict); + break; + } + default: /* not convertible */ + { + char *val = SvPV_nolen(sv); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = val ? vim_strsave((char_u *)val) : NULL; + break; + } + } + return OK; +} + +/* + * "perleval()" + */ + void +do_perleval(char_u *str, typval_T *rettv) +{ + char *err = NULL; + STRLEN err_len = 0; + SV *sv = NULL; +#ifdef HAVE_SANDBOX + SV *safe; +#endif + + if (perl_interp == NULL) + { +#ifdef DYNAMIC_PERL + if (!perl_enabled(TRUE)) + { + EMSG(_(e_noperl)); + return; + } +#endif + perl_init(); + } + + { + dSP; + ENTER; + SAVETMPS; + +#ifdef HAVE_SANDBOX + if (sandbox) + { + safe = get_sv("VIM::safe", FALSE); +# ifndef MAKE_TEST /* avoid a warning for unreachable code */ + if (safe == NULL || !SvTRUE(safe)) + EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); + else +# endif + { + sv = newSVpv((char *)str, 0); + PUSHMARK(SP); + XPUSHs(safe); + XPUSHs(sv); + PUTBACK; + call_method("reval", G_SCALAR); + SPAGAIN; + SvREFCNT_dec(sv); + sv = POPs; + } + } + else +#endif /* HAVE_SANDBOX */ + sv = eval_pv((char *)str, 0); + + if (sv) { + perl_to_vim(sv, rettv); + ref_map_free(); + err = SvPV(GvSV(PL_errgv), err_len); + } + PUTBACK; + FREETMPS; + LEAVE; + } + if (err_len) + msg_split((char_u *)err, highlight_attr[HLF_E]); +} + /* * ":perldo". */ void -ex_perldo(eap) - exarg_T *eap; +ex_perldo(exarg_T *eap) { STRLEN length; SV *sv; char *str; linenr_T i; + buf_T *was_curbuf = curbuf; - if (bufempty()) + if (BUFEMPTY()) return; if (perl_interp == NULL) @@ -962,11 +1340,7 @@ ex_perldo(eap) sv_catpvn(sv, "}", 1); perl_eval_sv(sv, G_DISCARD | G_NOARGS); SvREFCNT_dec(sv); -#ifdef AVOID_PL_ERRGV - str = SvPV(perl_get_sv("@", GV_ADD), length); -#else str = SvPV(GvSV(PL_errgv), length); -#endif if (length) goto err; @@ -977,15 +1351,14 @@ ex_perldo(eap) SAVETMPS; for (i = eap->line1; i <= eap->line2; i++) { + /* Check the line number, the command my have deleted lines. */ + if (i > curbuf->b_ml.ml_line_count) + break; sv_setpv(GvSV(PL_defgv), (char *)ml_get(i)); PUSHMARK(sp); perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL); -#ifdef AVOID_PL_ERRGV - str = SvPV(perl_get_sv("@", GV_ADD), length); -#else str = SvPV(GvSV(PL_errgv), length); -#endif - if (length) + if (length || curbuf != was_curbuf) break; SPAGAIN; if (SvTRUEx(POPs)) @@ -1011,11 +1384,78 @@ err: } } -#ifndef FEAT_WINDOWS -int win_valid(win_T *w) { return TRUE; } -int win_count() { return 1; } -win_T *win_find_nr(int n) { return curwin; } -#endif +#if defined(PERLIO_LAYERS) && !defined(USE_SFIO) +typedef struct { + struct _PerlIO base; + int attr; +} PerlIOVim; + + static IV +PerlIOVim_pushed(pTHX_ PerlIO *f, const char *mode, + SV *arg, PerlIO_funcs *tab) +{ + PerlIOVim *s = PerlIOSelf(f, PerlIOVim); + s->attr = 0; + if (arg && SvPOK(arg)) + s->attr = syn_name2attr((char_u *)SvPV_nolen(arg)); + return PerlIOBase_pushed(aTHX_ f, mode, (SV *)NULL, tab); +} + + static SSize_t +PerlIOVim_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) +{ + char_u *str; + PerlIOVim * s = PerlIOSelf(f, PerlIOVim); + + str = vim_strnsave((char_u *)vbuf, (int)count); + if (str == NULL) + return 0; + msg_split((char_u *)str, s->attr); + vim_free(str); + + return (SSize_t)count; +} + +static PERLIO_FUNCS_DECL(PerlIO_Vim) = { + sizeof(PerlIO_funcs), + "Vim", + sizeof(PerlIOVim), + PERLIO_K_DUMMY, /* flags */ + PerlIOVim_pushed, + NULL, /* popped */ + NULL, /* open */ + NULL, /* binmode */ + NULL, /* arg */ + NULL, /* fileno */ + NULL, /* dup */ + NULL, /* read */ + NULL, /* unread */ + PerlIOVim_write, + NULL, /* seek */ + NULL, /* tell */ + NULL, /* close */ + NULL, /* flush */ + NULL, /* fill */ + NULL, /* eof */ + NULL, /* error */ + NULL, /* clearerr */ + NULL, /* setlinebuf */ + NULL, /* get_base */ + NULL, /* get_bufsiz */ + NULL, /* get_ptr */ + NULL, /* get_cnt */ + NULL /* set_ptrcnt */ +}; + +/* Use Vim routine for print operator */ + static void +vim_IOLayer_init(void) +{ + PerlIO_define_layer(aTHX_ PERLIO_FUNCS_CAST(&PerlIO_Vim)); + (void)eval_pv( "binmode(STDOUT, ':Vim')" + " && binmode(STDERR, ':Vim(ErrorMsg)');", 0); +} +#endif /* PERLIO_LAYERS && !USE_SFIO */ XS(boot_VIM); @@ -1041,18 +1481,13 @@ Msg(text, hl=NULL) PREINIT: int attr; - int id; PPCODE: if (text != NULL) { attr = 0; if (hl != NULL) - { - id = syn_name2id((char_u *)hl); - if (id != 0) - attr = syn_id2attr(id); - } + attr = syn_name2attr((char_u *)hl); msg_split((char_u *)text, attr); } @@ -1106,14 +1541,14 @@ Buffers(...) if (GIMME == G_SCALAR) { i = 0; - for (vimbuf = firstbuf; vimbuf; vimbuf = vimbuf->b_next) + FOR_ALL_BUFFERS(vimbuf) ++i; XPUSHs(sv_2mortal(newSViv(i))); } else { - for (vimbuf = firstbuf; vimbuf; vimbuf = vimbuf->b_next) + FOR_ALL_BUFFERS(vimbuf) XPUSHs(newBUFrv(newSV(0), vimbuf)); } } @@ -1131,7 +1566,7 @@ Buffers(...) pat = (char_u *)SvPV(sv, len); ++emsg_off; - b = buflist_findpat(pat, pat+len, FALSE, FALSE, FALSE); + b = buflist_findpat(pat, pat + len, TRUE, FALSE, FALSE); --emsg_off; } @@ -1158,7 +1593,7 @@ Windows(...) XPUSHs(sv_2mortal(newSViv(win_count()))); else { - for (vimwin = firstwin; vimwin != NULL; vimwin = W_NEXT(vimwin)) + FOR_ALL_WINDOWS(vimwin) XPUSHs(newWINrv(newSV(0), vimwin)); } } @@ -1432,3 +1867,6 @@ Append(vimbuf, ...) } } +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif diff --git a/src/if_perl_msvc/stdbool.h b/src/if_perl_msvc/stdbool.h new file mode 100644 index 0000000000..de89e3b05e --- /dev/null +++ b/src/if_perl_msvc/stdbool.h @@ -0,0 +1,3 @@ +/* A stub stdbool.h for VC2012 or earlier. + * ActivePerl 5.20+ requires stdbool.h but VC2012 doesn't have it. */ +#define bool char diff --git a/src/if_perlsfio.c b/src/if_perlsfio.c index 0ae1b956dc..528a1b4f11 100644 --- a/src/if_perlsfio.c +++ b/src/if_perlsfio.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -25,11 +25,11 @@ #define NIL(type) ((type)0) static int -sfvimwrite(f, buf, n, disc) - Sfio_t *f; /* stream involved */ - char *buf; /* buffer to read from */ - int n; /* number of bytes to write */ - Sfdisc_t *disc; /* discipline */ +sfvimwrite( + Sfio_t *f, /* stream involved */ + char *buf, /* buffer to read from */ + int n, /* number of bytes to write */ + Sfdisc_t *disc) /* discipline */ { char_u *str; @@ -47,7 +47,7 @@ sfvimwrite(f, buf, n, disc) * Create Vim discipline */ Sfdisc_t * -sfdcnewvim() +sfdcnewvim(void) { Sfdisc_t *disc; diff --git a/src/if_py_both.h b/src/if_py_both.h index bf5ea4cf38..526cbd7848 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -72,6 +72,7 @@ typedef void (*runner)(const char *, void * static int ConvertFromPyObject(PyObject *, typval_T *); static int _ConvertFromPyObject(PyObject *, typval_T *, PyObject *); static int ConvertFromPyMapping(PyObject *, typval_T *); +static int ConvertFromPySequence(PyObject *, typval_T *); static PyObject *WindowNew(win_T *, tabpage_T *); static PyObject *BufferNew (buf_T *); static PyObject *LineToString(const char *); @@ -465,20 +466,44 @@ OutputWritelines(OutputObject *self, PyObject *seq) } static PyObject * -OutputFlush(PyObject *self UNUSED) +AlwaysNone(PyObject *self UNUSED) { /* do nothing */ Py_INCREF(Py_None); return Py_None; } + static PyObject * +AlwaysFalse(PyObject *self UNUSED) +{ + /* do nothing */ + PyObject *ret = Py_False; + Py_INCREF(ret); + return ret; +} + + static PyObject * +AlwaysTrue(PyObject *self UNUSED) +{ + /* do nothing */ + PyObject *ret = Py_True; + Py_INCREF(ret); + return ret; +} + /***************/ static struct PyMethodDef OutputMethods[] = { /* name, function, calling, doc */ {"write", (PyCFunction)OutputWrite, METH_O, ""}, {"writelines", (PyCFunction)OutputWritelines, METH_O, ""}, - {"flush", (PyCFunction)OutputFlush, METH_NOARGS, ""}, + {"flush", (PyCFunction)AlwaysNone, METH_NOARGS, ""}, + {"close", (PyCFunction)AlwaysNone, METH_NOARGS, ""}, + {"isatty", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, + {"readable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, + {"seekable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, + {"writable", (PyCFunction)AlwaysTrue, METH_NOARGS, ""}, + {"closed", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} }; @@ -557,9 +582,9 @@ VimTryStart(void) VimTryEnd(void) { --trylevel; - /* Without this it stops processing all subsequent VimL commands and - * generates strange error messages if I e.g. try calling Test() in a - * cycle */ + /* Without this it stops processing all subsequent Vim script commands and + * generates strange error messages if I e.g. try calling Test() in a cycle + */ did_emsg = FALSE; /* Keyboard interrupt should be preferred over anything else */ if (got_int) @@ -600,7 +625,7 @@ VimTryEnd(void) discard_current_exception(); return -1; } - /* Finally transform VimL exception to python one */ + /* Finally transform Vim script exception to python one */ else { PyErr_SetVim((char *)current_exception->value); @@ -747,12 +772,14 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) else if (our_tv->v_type == VAR_DICT) { - hashtab_T *ht = &our_tv->vval.v_dict->dv_hashtab; - long_u todo = ht->ht_used; + hashtab_T *ht; + long_u todo; hashitem_T *hi; dictitem_T *di; + if (our_tv->vval.v_dict == NULL) return NULL; + ht = &our_tv->vval.v_dict->dv_hashtab; if (!(ret = PyDict_New())) return NULL; @@ -763,6 +790,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) return NULL; } + todo = ht->ht_used; for (hi = ht->ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) @@ -784,6 +812,25 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) } } } + else if (our_tv->v_type == VAR_SPECIAL) + { + if (our_tv->vval.v_number == VVAL_FALSE) + { + ret = Py_False; + Py_INCREF(ret); + } + else if (our_tv->vval.v_number == VVAL_TRUE) + { + ret = Py_True; + Py_INCREF(ret); + } + else + { + Py_INCREF(Py_None); + ret = Py_None; + } + return ret; + } else { Py_INCREF(Py_None); @@ -1016,7 +1063,7 @@ VimForeachRTP(PyObject *self UNUSED, PyObject *callable) data.callable = callable; data.result = NULL; - do_in_runtimepath(NULL, FALSE, &map_rtp_callback, &data); + do_in_runtimepath(NULL, 0, &map_rtp_callback, &data); if (data.result == NULL) { @@ -1105,7 +1152,7 @@ Vim_GetPaths(PyObject *self UNUSED) if (!(ret = PyList_New(0))) return NULL; - do_in_runtimepath(NULL, FALSE, &map_finder_callback, ret); + do_in_runtimepath(NULL, 0, &map_finder_callback, ret); if (PyErr_Occurred()) { @@ -1388,6 +1435,7 @@ typedef struct pylinkedlist_S { static pylinkedlist_T *lastdict = NULL; static pylinkedlist_T *lastlist = NULL; +static pylinkedlist_T *lastfunc = NULL; static void pyll_remove(pylinkedlist_T *ref, pylinkedlist_T **last) @@ -1948,6 +1996,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) PyObject *todecref; char_u *key; dictitem_T *di; + hashitem_T *hi; if (!(fast = PySequence_Fast(item, ""))) { @@ -2004,7 +2053,8 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) Py_DECREF(fast); - if (dict_add(dict, di) == FAIL) + hi = hash_find(&dict->dv_hashtab, di->di_key); + if (!HASHITEM_EMPTY(hi) || dict_add(dict, di) == FAIL) { RAISE_KEY_ADD_FAIL(di->di_key); Py_DECREF(iterator); @@ -2783,14 +2833,21 @@ typedef struct { PyObject_HEAD char_u *name; + int argc; + typval_T *argv; + dict_T *self; + pylinkedlist_T ref; + int auto_rebind; } FunctionObject; static PyTypeObject FunctionType; -#define NEW_FUNCTION(name) FunctionNew(&FunctionType, name) +#define NEW_FUNCTION(name, argc, argv, self, pt_auto) \ + FunctionNew(&FunctionType, (name), (argc), (argv), (self), (pt_auto)) static PyObject * -FunctionNew(PyTypeObject *subtype, char_u *name) +FunctionNew(PyTypeObject *subtype, char_u *name, int argc, typval_T *argv, + dict_T *selfdict, int auto_rebind) { FunctionObject *self; @@ -2808,7 +2865,6 @@ FunctionNew(PyTypeObject *subtype, char_u *name) return NULL; } self->name = vim_strsave(name); - func_ref(self->name); } else if ((self->name = get_expanded_name(name, @@ -2820,6 +2876,15 @@ FunctionNew(PyTypeObject *subtype, char_u *name) return NULL; } + func_ref(self->name); + self->argc = argc; + self->argv = argv; + self->self = selfdict; + self->auto_rebind = selfdict == NULL ? TRUE : auto_rebind; + + if (self->argv || self->self) + pyll_add((PyObject *)(self), &self->ref, &lastfunc); + return (PyObject *)(self); } @@ -2827,19 +2892,83 @@ FunctionNew(PyTypeObject *subtype, char_u *name) FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) { PyObject *self; + PyObject *selfdictObject; + PyObject *autoRebindObject; + PyObject *argsObject = NULL; char_u *name; + typval_T selfdicttv; + typval_T argstv; + list_T *argslist = NULL; + dict_T *selfdict = NULL; + int argc = 0; + int auto_rebind = TRUE; + typval_T *argv = NULL; + typval_T *curtv; + listitem_T *li; - if (kwargs) + if (kwargs != NULL) { - PyErr_SET_STRING(PyExc_TypeError, - N_("function constructor does not accept keyword arguments")); - return NULL; + selfdictObject = PyDict_GetItemString(kwargs, "self"); + if (selfdictObject != NULL) + { + if (ConvertFromPyMapping(selfdictObject, &selfdicttv) == -1) + return NULL; + selfdict = selfdicttv.vval.v_dict; + } + argsObject = PyDict_GetItemString(kwargs, "args"); + if (argsObject != NULL) + { + if (ConvertFromPySequence(argsObject, &argstv) == -1) + { + dict_unref(selfdict); + return NULL; + } + argslist = argstv.vval.v_list; + + argc = argslist->lv_len; + if (argc != 0) + { + argv = PyMem_New(typval_T, (size_t) argc); + if (argv == NULL) + { + PyErr_NoMemory(); + dict_unref(selfdict); + list_unref(argslist); + return NULL; + } + curtv = argv; + for (li = argslist->lv_first; li != NULL; li = li->li_next) + copy_tv(&li->li_tv, curtv++); + } + list_unref(argslist); + } + if (selfdict != NULL) + { + auto_rebind = FALSE; + autoRebindObject = PyDict_GetItemString(kwargs, "auto_rebind"); + if (autoRebindObject != NULL) + { + auto_rebind = PyObject_IsTrue(autoRebindObject); + if (auto_rebind == -1) + { + dict_unref(selfdict); + list_unref(argslist); + return NULL; + } + } + } } if (!PyArg_ParseTuple(args, "et", "ascii", &name)) + { + dict_unref(selfdict); + while (argc--) + clear_tv(&argv[argc]); + PyMem_Free(argv); return NULL; + } - self = FunctionNew(subtype, name); + self = FunctionNew(subtype, name, argc, argv, selfdict, auto_rebind); PyMem_Free(name); @@ -2849,14 +2978,21 @@ FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) static void FunctionDestructor(FunctionObject *self) { + int i; func_unref(self->name); vim_free(self->name); + for (i = 0; i < self->argc; ++i) + clear_tv(&self->argv[i]); + PyMem_Free(self->argv); + dict_unref(self->self); + if (self->argv || self->self) + pyll_remove(&self->ref, &lastfunc); DESTRUCTOR_FINISH(self); } static char *FunctionAttrs[] = { - "softspace", + "softspace", "args", "self", "auto_rebind", NULL }; @@ -2866,6 +3002,73 @@ FunctionDir(PyObject *self) return ObjectDir(self, FunctionAttrs); } + static PyObject * +FunctionAttr(FunctionObject *self, char *name) +{ + list_T *list; + int i; + if (strcmp(name, "name") == 0) + return PyString_FromString((char *)(self->name)); + else if (strcmp(name, "args") == 0) + { + if (self->argv == NULL || (list = list_alloc()) == NULL) + return AlwaysNone(NULL); + + for (i = 0; i < self->argc; ++i) + list_append_tv(list, &self->argv[i]); + return NEW_LIST(list); + } + else if (strcmp(name, "self") == 0) + return self->self == NULL + ? AlwaysNone(NULL) + : NEW_DICTIONARY(self->self); + else if (strcmp(name, "auto_rebind") == 0) + return self->auto_rebind + ? AlwaysTrue(NULL) + : AlwaysFalse(NULL); + else if (strcmp(name, "__members__") == 0) + return ObjectDir(NULL, FunctionAttrs); + return NULL; +} + +/* Populate partial_T given function object. + * + * "exported" should be set to true when it is needed to construct a partial + * that may be stored in a variable (i.e. may be freed by Vim). + */ + static void +set_partial(FunctionObject *self, partial_T *pt, int exported) +{ + int i; + + pt->pt_name = self->name; + if (self->argv) + { + pt->pt_argc = self->argc; + if (exported) + { + pt->pt_argv = (typval_T *)alloc_clear( + sizeof(typval_T) * self->argc); + for (i = 0; i < pt->pt_argc; ++i) + copy_tv(&self->argv[i], &pt->pt_argv[i]); + } + else + pt->pt_argv = self->argv; + } + else + { + pt->pt_argc = 0; + pt->pt_argv = NULL; + } + pt->pt_auto = self->auto_rebind || !exported; + pt->pt_dict = self->self; + if (exported && self->self) + ++pt->pt_dict->dv_refcount; + if (exported) + pt->pt_name = vim_strsave(pt->pt_name); + pt->pt_refcount = 1; +} + static PyObject * FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) { @@ -2877,8 +3080,10 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) PyObject *selfdictObject; PyObject *ret; int error; + partial_T pt; + partial_T *pt_ptr = NULL; - if (ConvertFromPyObject(argsObject, &args) == -1) + if (ConvertFromPySequence(argsObject, &args) == -1) return NULL; if (kwargs != NULL) @@ -2895,11 +3100,18 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) } } + if (self->argv || self->self) + { + vim_memset(&pt, 0, sizeof(partial_T)); + set_partial(self, &pt, FALSE); + pt_ptr = &pt; + } + Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); VimTryStart(); - error = func_call(name, &args, selfdict, &rettv); + error = func_call(name, &args, pt_ptr, selfdict, &rettv); Python_Release_Vim(); Py_END_ALLOW_THREADS @@ -2925,14 +3137,51 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) static PyObject * FunctionRepr(FunctionObject *self) { -#ifdef Py_TRACE_REFS - /* For unknown reason self->name may be NULL after calling - * Finalize */ - return PyString_FromFormat("<vim.Function '%s'>", - (self->name == NULL ? "<NULL>" : (char *)self->name)); -#else - return PyString_FromFormat("<vim.Function '%s'>", (char *)self->name); -#endif + PyObject *ret; + garray_T repr_ga; + int i; + char_u *tofree = NULL; + typval_T tv; + char_u numbuf[NUMBUFLEN]; + + ga_init2(&repr_ga, (int)sizeof(char), 70); + ga_concat(&repr_ga, (char_u *)"<vim.Function '"); + if (self->name) + ga_concat(&repr_ga, self->name); + else + ga_concat(&repr_ga, (char_u *)"<NULL>"); + ga_append(&repr_ga, '\''); + if (self->argv) + { + ga_concat(&repr_ga, (char_u *)", args=["); + ++emsg_silent; + for (i = 0; i < self->argc; i++) + { + if (i != 0) + ga_concat(&repr_ga, (char_u *)", "); + ga_concat(&repr_ga, tv2string(&self->argv[i], &tofree, numbuf, + get_copyID())); + vim_free(tofree); + } + --emsg_silent; + ga_append(&repr_ga, ']'); + } + if (self->self) + { + ga_concat(&repr_ga, (char_u *)", self="); + tv.v_type = VAR_DICT; + tv.vval.v_dict = self->self; + ++emsg_silent; + ga_concat(&repr_ga, tv2string(&tv, &tofree, numbuf, get_copyID())); + --emsg_silent; + vim_free(tofree); + if (self->auto_rebind) + ga_concat(&repr_ga, (char_u *)", auto_rebind=True"); + } + ga_append(&repr_ga, '>'); + ret = PyString_FromString((char *)repr_ga.ga_data); + ga_clear(&repr_ga); + return ret; } static struct PyMethodDef FunctionMethods[] = { @@ -3162,7 +3411,7 @@ set_option_value_for( { win_T *save_curwin = NULL; tabpage_T *save_curtab = NULL; - buf_T *save_curbuf = NULL; + bufref_T save_curbuf; int set_ret = 0; VimTryStart(); @@ -3172,6 +3421,7 @@ set_option_value_for( if (switch_win(&save_curwin, &save_curtab, (win_T *)from, win_find_tabpage((win_T *)from), FALSE) == FAIL) { + restore_win(save_curwin, save_curtab, TRUE); if (VimTryEnd()) return -1; PyErr_SET_VIM(N_("problem while switching windows")); @@ -3183,7 +3433,7 @@ set_option_value_for( case SREQ_BUF: switch_buffer(&save_curbuf, (buf_T *)from); set_ret = set_option_value_err(key, numval, stringval, opt_flags); - restore_buffer(save_curbuf); + restore_buffer(&save_curbuf); break; case SREQ_GLOBAL: set_ret = set_option_value_err(key, numval, stringval, opt_flags); @@ -3586,9 +3836,20 @@ get_firstwin(TabPageObject *tabObject) else return firstwin; } + +// Use the same order as in the WindowAttr() function. static char *WindowAttrs[] = { - "buffer", "cursor", "height", "vars", "options", "number", "row", "col", - "tabpage", "valid", + "buffer", + "cursor", + "height", + "row", + "width", + "col", + "vars", + "options", + "number", + "tabpage", + "valid", NULL }; @@ -3624,16 +3885,12 @@ WindowAttr(WindowObject *self, char *name) } else if (strcmp(name, "height") == 0) return PyLong_FromLong((long)(self->win->w_height)); -#ifdef FEAT_WINDOWS else if (strcmp(name, "row") == 0) return PyLong_FromLong((long)(self->win->w_winrow)); -#endif -#ifdef FEAT_VERTSPLIT else if (strcmp(name, "width") == 0) - return PyLong_FromLong((long)(W_WIDTH(self->win))); + return PyLong_FromLong((long)(self->win->w_width)); else if (strcmp(name, "col") == 0) - return PyLong_FromLong((long)(W_WINCOL(self->win))); -#endif + return PyLong_FromLong((long)(self->win->w_wincol)); else if (strcmp(name, "vars") == 0) return NEW_DICTIONARY(self->win->w_vars); else if (strcmp(name, "options") == 0) @@ -3719,7 +3976,6 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject) return 0; } -#ifdef FEAT_VERTSPLIT else if (strcmp(name, "width") == 0) { long width; @@ -3742,7 +3998,6 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject) return 0; } -#endif else { PyErr_SetString(PyExc_AttributeError, name); @@ -4016,39 +4271,6 @@ py_fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra) invalidate_botline(); } -/* - * Find a window that contains "buf" and switch to it. - * If there is no such window, use the current window and change "curbuf". - * Caller must initialize save_curbuf to NULL. - * restore_win_for_buf() MUST be called later! - */ - static void -switch_to_win_for_buf( - buf_T *buf, - win_T **save_curwinp, - tabpage_T **save_curtabp, - buf_T **save_curbufp) -{ - win_T *wp; - tabpage_T *tp; - - if (find_win_for_buf(buf, &wp, &tp) == FAIL - || switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) - switch_buffer(save_curbufp, buf); -} - - static void -restore_win_for_buf( - win_T *save_curwin, - tabpage_T *save_curtab, - buf_T *save_curbuf) -{ - if (save_curbuf == NULL) - restore_win(save_curwin, save_curtab, TRUE); - else - restore_buffer(save_curbuf); -} - /* * Replace a line in the specified buffer. The line number is * in Vim format (1-based). The replacement line is given as @@ -4061,7 +4283,7 @@ restore_win_for_buf( static int SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) { - buf_T *save_curbuf = NULL; + bufref_T save_curbuf = {NULL, 0, 0}; win_T *save_curwin = NULL; tabpage_T *save_curtab = NULL; @@ -4086,13 +4308,13 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) { if (buf == curbuf) py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1); - if (save_curbuf == NULL) + if (save_curbuf.br_buf == NULL) /* Only adjust marks if we managed to switch to a window that * holds the buffer, otherwise line numbers will be invalid. */ deleted_lines_mark((linenr_T)n, 1L); } - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); if (VimTryEnd()) return FAIL; @@ -4128,7 +4350,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) else changed_bytes((linenr_T)n, 0); - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); /* Check that the cursor is not beyond the end of the line now. */ if (buf == curbuf) @@ -4165,7 +4387,7 @@ SetBufferLineList( PyObject *list, PyInt *len_change) { - buf_T *save_curbuf = NULL; + bufref_T save_curbuf = {NULL, 0, 0}; win_T *save_curwin = NULL; tabpage_T *save_curtab = NULL; @@ -4196,15 +4418,18 @@ SetBufferLineList( break; } } - if (buf == curbuf) + if (buf == curbuf && (save_curwin != NULL + || save_curbuf.br_buf == NULL)) + /* Using an existing window for the buffer, adjust the cursor + * position. */ py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n); - if (save_curbuf == NULL) + if (save_curbuf.br_buf == NULL) /* Only adjust marks if we managed to switch to a window that * holds the buffer, otherwise line numbers will be invalid. */ deleted_lines_mark((linenr_T)lo, (long)i); } - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); if (VimTryEnd()) return FAIL; @@ -4326,7 +4551,7 @@ SetBufferLineList( * changed range, and move any in the remainder of the buffer. * Only adjust marks if we managed to switch to a window that holds * the buffer, otherwise line numbers will be invalid. */ - if (save_curbuf == NULL) + if (save_curbuf.br_buf == NULL) mark_adjust((linenr_T)lo, (linenr_T)(hi - 1), (long)MAXLNUM, (long)extra); changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra); @@ -4335,7 +4560,7 @@ SetBufferLineList( py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra); /* END of region without "return". */ - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); if (VimTryEnd()) return FAIL; @@ -4363,7 +4588,7 @@ SetBufferLineList( static int InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) { - buf_T *save_curbuf = NULL; + bufref_T save_curbuf = {NULL, 0, 0}; win_T *save_curwin = NULL; tabpage_T *save_curtab = NULL; @@ -4385,13 +4610,13 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) RAISE_UNDO_FAIL; else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL) RAISE_INSERT_LINE_FAIL; - else if (save_curbuf == NULL) + else if (save_curbuf.br_buf == NULL) /* Only adjust marks if we managed to switch to a window that * holds the buffer, otherwise line numbers will be invalid. */ appended_lines_mark((linenr_T)n, 1L); vim_free(str); - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); update_screen(VALID); if (VimTryEnd()) @@ -4452,7 +4677,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) } vim_free(array[i]); } - if (i > 0 && save_curbuf == NULL) + if (i > 0 && save_curbuf.br_buf == NULL) /* Only adjust marks if we managed to switch to a window that * holds the buffer, otherwise line numbers will be invalid. */ appended_lines_mark((linenr_T)n, (long)i); @@ -4461,7 +4686,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) /* Free the array of lines. All of its contents have now * been freed. */ PyMem_Free(array); - restore_win_for_buf(save_curwin, save_curtab, save_curbuf); + restore_win_for_buf(save_curwin, save_curtab, &save_curbuf); update_screen(VALID); @@ -4964,7 +5189,7 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) pos_T *posp; char_u *pmark; char_u mark; - buf_T *savebuf; + bufref_T savebuf; PyObject *todecref; if (CheckBuffer(self)) @@ -4988,7 +5213,7 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) VimTryStart(); switch_buffer(&savebuf, self->buf); posp = getmark(mark, FALSE); - restore_buffer(savebuf); + restore_buffer(&savebuf); if (VimTryEnd()) return NULL; @@ -5366,6 +5591,7 @@ run_do(const char *cmd, void *arg UNUSED int status; PyObject *pyfunc, *pymain; PyObject *run_ret; + buf_T *was_curbuf = curbuf; if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK) { @@ -5418,7 +5644,9 @@ run_do(const char *cmd, void *arg UNUSED #ifdef PY_CAN_RECURSE *pygilstate = PyGILState_Ensure(); #endif - if (!(line = GetBufferLine(curbuf, lnum))) + /* Check the line number, the command my have deleted lines. */ + if (lnum > curbuf->b_ml.ml_line_count + || !(line = GetBufferLine(curbuf, lnum))) goto err; if (!(linenr = PyInt_FromLong((long) lnum))) { @@ -5431,9 +5659,19 @@ run_do(const char *cmd, void *arg UNUSED if (!ret) goto err; + /* Check that the command didn't switch to another buffer. */ + if (curbuf != was_curbuf) + { + Py_XDECREF(ret); + goto err; + } + if (ret != Py_None) if (SetBufferLine(curbuf, lnum, ret, NULL) == FAIL) + { + Py_XDECREF(ret); goto err; + } Py_XDECREF(ret); PythonIO_Flush(); @@ -5495,34 +5733,61 @@ run_eval(const char *cmd, typval_T *rettv PyErr_Clear(); } - static void + static int set_ref_in_py(const int copyID) { pylinkedlist_T *cur; dict_T *dd; list_T *ll; + int i; + int abort = FALSE; + FunctionObject *func; if (lastdict != NULL) - for(cur = lastdict ; cur != NULL ; cur = cur->pll_prev) + { + for (cur = lastdict ; !abort && cur != NULL ; cur = cur->pll_prev) { dd = ((DictionaryObject *) (cur->pll_obj))->dict; if (dd->dv_copyID != copyID) { dd->dv_copyID = copyID; - set_ref_in_ht(&dd->dv_hashtab, copyID); + abort = abort || set_ref_in_ht(&dd->dv_hashtab, copyID, NULL); } } + } if (lastlist != NULL) - for(cur = lastlist ; cur != NULL ; cur = cur->pll_prev) + { + for (cur = lastlist ; !abort && cur != NULL ; cur = cur->pll_prev) { ll = ((ListObject *) (cur->pll_obj))->list; if (ll->lv_copyID != copyID) { ll->lv_copyID = copyID; - set_ref_in_list(ll, copyID); + abort = abort || set_ref_in_list(ll, copyID, NULL); } } + } + + if (lastfunc != NULL) + { + for (cur = lastfunc ; !abort && cur != NULL ; cur = cur->pll_prev) + { + func = (FunctionObject *) cur->pll_obj; + if (func->self != NULL && func->self->dv_copyID != copyID) + { + func->self->dv_copyID = copyID; + abort = abort || set_ref_in_ht( + &func->self->dv_hashtab, copyID, NULL); + } + if (func->argc) + for (i = 0; !abort && i < func->argc; ++i) + abort = abort + || set_ref_in_item(&func->argv[i], copyID, NULL, NULL); + } + } + + return abort; } static int @@ -5742,7 +6007,7 @@ convert_dl(PyObject *obj, typval_T *tv, PyObject *capsule; char hexBuf[sizeof(void *) * 2 + 3]; - sprintf(hexBuf, "%p", obj); + sprintf(hexBuf, "%p", (void *)obj); # ifdef PY_USE_CAPSULE capsule = PyDict_GetItemString(lookup_dict, hexBuf); @@ -5772,11 +6037,10 @@ convert_dl(PyObject *obj, typval_T *tv, } /* As we are not using copy_tv which increments reference count we must * do it ourself. */ - switch(tv->v_type) - { - case VAR_DICT: ++tv->vval.v_dict->dv_refcount; break; - case VAR_LIST: ++tv->vval.v_list->lv_refcount; break; - } + if (tv->v_type == VAR_DICT) + ++tv->vval.v_dict->dv_refcount; + else if (tv->v_type == VAR_LIST) + ++tv->vval.v_list->lv_refcount; } else { @@ -5823,6 +6087,35 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv) return ret; } + static int +ConvertFromPySequence(PyObject *obj, typval_T *tv) +{ + PyObject *lookup_dict; + int ret; + + if (!(lookup_dict = PyDict_New())) + return -1; + + if (PyType_IsSubtype(obj->ob_type, &ListType)) + { + tv->v_type = VAR_LIST; + tv->vval.v_list = (((ListObject *)(obj))->list); + ++tv->vval.v_list->lv_refcount; + ret = 0; + } + else if (PyIter_Check(obj) || PySequence_Check(obj)) + ret = convert_dl(obj, tv, pyseq_to_tv, lookup_dict); + else + { + PyErr_FORMAT(PyExc_TypeError, + N_("unable to convert %s to vim list"), + Py_TYPE_NAME(obj)); + ret = -1; + } + Py_DECREF(lookup_dict); + return ret; +} + static int ConvertFromPyObject(PyObject *obj, typval_T *tv) { @@ -5853,11 +6146,22 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) } else if (PyType_IsSubtype(obj->ob_type, &FunctionType)) { - if (set_string_copy(((FunctionObject *) (obj))->name, tv) == -1) - return -1; + FunctionObject *func = (FunctionObject *) obj; + if (func->self != NULL || func->argv != NULL) + { + partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T)); + set_partial(func, pt, TRUE); + tv->vval.v_partial = pt; + tv->v_type = VAR_PARTIAL; + } + else + { + if (set_string_copy(func->name, tv) == -1) + return -1; - tv->v_type = VAR_FUNC; - func_ref(tv->vval.v_string); + tv->v_type = VAR_FUNC; + } + func_ref(func->name); } else if (PyBytes_Check(obj)) { @@ -5940,6 +6244,11 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) Py_DECREF(num); } + else if (obj == Py_None) + { + tv->v_type = VAR_SPECIAL; + tv->vval.v_number = VVAL_NONE; + } else { PyErr_FORMAT(PyExc_TypeError, @@ -5953,6 +6262,8 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) static PyObject * ConvertToPyObject(typval_T *tv) { + typval_T *argv; + int i; if (tv == NULL) { PyErr_SET_VIM(N_("internal error: NULL reference passed")); @@ -5975,14 +6286,41 @@ ConvertToPyObject(typval_T *tv) return NEW_DICTIONARY(tv->vval.v_dict); case VAR_FUNC: return NEW_FUNCTION(tv->vval.v_string == NULL - ? (char_u *)"" : tv->vval.v_string); + ? (char_u *)"" : tv->vval.v_string, + 0, NULL, NULL, TRUE); + case VAR_PARTIAL: + if (tv->vval.v_partial->pt_argc) + { + argv = PyMem_New(typval_T, (size_t)tv->vval.v_partial->pt_argc); + for (i = 0; i < tv->vval.v_partial->pt_argc; i++) + copy_tv(&tv->vval.v_partial->pt_argv[i], &argv[i]); + } + else + argv = NULL; + if (tv->vval.v_partial->pt_dict != NULL) + tv->vval.v_partial->pt_dict->dv_refcount++; + return NEW_FUNCTION(tv->vval.v_partial == NULL + ? (char_u *)"" : partial_name(tv->vval.v_partial), + tv->vval.v_partial->pt_argc, argv, + tv->vval.v_partial->pt_dict, + tv->vval.v_partial->pt_auto); case VAR_UNKNOWN: + case VAR_CHANNEL: + case VAR_JOB: Py_INCREF(Py_None); return Py_None; - default: + case VAR_SPECIAL: + switch (tv->vval.v_number) + { + case VVAL_FALSE: return AlwaysFalse(NULL); + case VVAL_TRUE: return AlwaysTrue(NULL); + case VVAL_NONE: + case VVAL_NULL: return AlwaysNone(NULL); + } PyErr_SET_VIM(N_("internal error: invalid value type")); return NULL; } + return NULL; } typedef struct @@ -6006,9 +6344,12 @@ init_structs(void) OutputType.tp_alloc = call_PyType_GenericAlloc; OutputType.tp_new = call_PyType_GenericNew; OutputType.tp_free = call_PyObject_Free; + OutputType.tp_base = &PyStdPrinter_Type; #else OutputType.tp_getattr = (getattrfunc)OutputGetattr; OutputType.tp_setattr = (setattrfunc)OutputSetattr; + // Disabled, because this causes a crash in test86 + // OutputType.tp_base = &PyFile_Type; #endif vim_memset(&IterType, 0, sizeof(IterType)); @@ -6423,8 +6764,13 @@ populate_module(PyObject *m) return -1; ADD_OBJECT(m, "os", other_module); +#if PY_MAJOR_VERSION >= 3 if (!(py_getcwd = PyObject_GetAttrString(other_module, "getcwd"))) return -1; +#else + if (!(py_getcwd = PyObject_GetAttrString(other_module, "getcwdu"))) + return -1; +#endif ADD_OBJECT(m, "_getcwd", py_getcwd) if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir"))) diff --git a/src/if_python.c b/src/if_python.c index b356bf71dc..ede6e46bb6 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -39,10 +39,28 @@ # undef HAVE_FCNTL_H #endif +#if defined(DYNAMIC_PYTHON) && !defined(_WIN32) +typedef void *HINSTANCE; +typedef void *FARPROC; +# include <dlfcn.h> +# define LoadLibrary(a) dlopen(a,RTLD_NOW|RTLD_GLOBAL) +# define FreeLibrary(a) dlclose(a) +# define GetProcAddress dlsym +#endif + #ifdef _DEBUG # undef _DEBUG #endif +#ifdef HAVE_STRFTIME +# undef HAVE_STRFTIME +#endif +#ifdef HAVE_STRING_H +# undef HAVE_STRING_H +#endif +#ifdef HAVE_PUTENV +# undef HAVE_PUTENV +#endif #ifdef HAVE_STDARG_H # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ #endif @@ -55,25 +73,17 @@ #define PY_SSIZE_T_CLEAN -#ifdef FEAT_GUI_MACVIM -# include <Python/Python.h> -#else -# include <Python.h> -#endif +#include <Python.h> #if !defined(PY_VERSION_HEX) || PY_VERSION_HEX < 0x02050000 # undef PY_SSIZE_T_CLEAN #endif -#if defined(MACOS) && !defined(MACOS_X_UNIX) -# include "macglue.h" -# include <CodeFragments.h> -#endif #undef main /* Defined in python.h - aargh */ #undef HAVE_FCNTL_H /* Clash with os_win32.h */ #define PyBytes_FromString PyString_FromString -#define PyBytes_Check PyString_Check +#define PyBytes_Check PyString_Check #define PyBytes_AsStringAndSize PyString_AsStringAndSize #if !defined(FEAT_PYTHON) && defined(PROTO) @@ -246,6 +256,7 @@ struct PyMethodDef { Py_ssize_t a; }; # define PySys_GetObject dll_PySys_GetObject # define PySys_SetArgv dll_PySys_SetArgv # define PyType_Type (*dll_PyType_Type) +# define PyFile_Type (*dll_PyFile_Type) # define PySlice_Type (*dll_PySlice_Type) # define PyType_Ready (*dll_PyType_Ready) # define PyType_GenericAlloc dll_PyType_GenericAlloc @@ -394,6 +405,7 @@ static int(*dll_PySys_SetObject)(char *, PyObject *); static PyObject *(*dll_PySys_GetObject)(char *); static int(*dll_PySys_SetArgv)(int, char **); static PyTypeObject* dll_PyType_Type; +static PyTypeObject* dll_PyFile_Type; static PyTypeObject* dll_PySlice_Type; static int (*dll_PyType_Ready)(PyTypeObject *type); static PyObject* (*dll_PyType_GenericAlloc)(PyTypeObject *type, PyInt nitems); @@ -579,6 +591,7 @@ static struct {"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject}, {"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv}, {"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type}, + {"PyFile_Type", (PYTHON_PROC*)&dll_PyFile_Type}, {"PySlice_Type", (PYTHON_PROC*)&dll_PySlice_Type}, {"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready}, {"PyType_GenericAlloc", (PYTHON_PROC*)&dll_PyType_GenericAlloc}, @@ -671,7 +684,8 @@ end_dynamic_python(void) python_runtime_link_init(char *libname, int verbose) { int i; - void *ucs_as_encoded_string; + PYTHON_PROC *ucs_as_encoded_string = + (PYTHON_PROC*)&py_PyUnicode_AsEncodedString; #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) /* Can't have Python and Python3 loaded at the same time. @@ -710,14 +724,12 @@ python_runtime_link_init(char *libname, int verbose) /* Load unicode functions separately as only the ucs2 or the ucs4 functions * will be present in the library. */ - ucs_as_encoded_string = symbol_from_dll(hinstPython, + *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS2_AsEncodedString"); - if (ucs_as_encoded_string == NULL) - ucs_as_encoded_string = symbol_from_dll(hinstPython, + if (*ucs_as_encoded_string == NULL) + *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS4_AsEncodedString"); - if (ucs_as_encoded_string != NULL) - py_PyUnicode_AsEncodedString = ucs_as_encoded_string; - else + if (*ucs_as_encoded_string == NULL) { close_dll(hinstPython); hinstPython = 0; @@ -736,7 +748,7 @@ python_runtime_link_init(char *libname, int verbose) int python_enabled(int verbose) { - return python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose) == OK; + return python_runtime_link_init((char *)p_pydll, verbose) == OK; } /* @@ -774,6 +786,7 @@ get_exceptions(void) static int initialised = 0; #define PYINITIALISED initialised +static int python_end_called = FALSE; #define DESTRUCTOR_FINISH(self) self->ob_type->tp_free((PyObject*)self); @@ -865,7 +878,7 @@ Python_RestoreThread(void) #endif void -python_end() +python_end(void) { static int recurse = 0; @@ -873,6 +886,7 @@ python_end() if (recurse != 0) return; + python_end_called = TRUE; ++recurse; #ifdef DYNAMIC_PYTHON @@ -903,12 +917,14 @@ python_end() #if (defined(DYNAMIC_PYTHON) && defined(FEAT_PYTHON3)) || defined(PROTO) int -python_loaded() +python_loaded(void) { return (hinstPython != 0); } #endif +static char *py_home_buf = NULL; + static int Python_Init(void) { @@ -924,10 +940,22 @@ Python_Init(void) EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); goto fail; } -#endif + if (*p_pyhome != NUL) + { + /* The string must not change later, make a copy in static memory. */ + py_home_buf = (char *)vim_strsave(p_pyhome); + if (py_home_buf != NULL) + Py_SetPythonHome(py_home_buf); + } #ifdef PYTHON_HOME + else if (mch_getenv((char_u *)"PYTHONHOME") == NULL) + Py_SetPythonHome(PYTHON_HOME); +# endif +#else +# ifdef PYTHON_HOME Py_SetPythonHome(PYTHON_HOME); +# endif #endif init_structs(); @@ -938,11 +966,7 @@ Python_Init(void) Py_NoSiteFlag++; #endif -#if !defined(MACOS) || defined(MACOS_X_UNIX) Py_Initialize(); -#else - PyMac_Initialize(); -#endif #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000 /* 'import site' explicitly. */ @@ -1014,9 +1038,6 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) #ifndef PY_CAN_RECURSE static int recursive = 0; #endif -#if defined(MACOS) && !defined(MACOS_X_UNIX) - GrafPtr oldPort; -#endif #if defined(HAVE_LOCALE_H) || defined(X_LOCALE) char *saved_locale; #endif @@ -1032,13 +1053,9 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) } ++recursive; #endif + if (python_end_called) + return; -#if defined(MACOS) && !defined(MACOS_X_UNIX) - GetPort(&oldPort); - /* Check if the Python library is available */ - if ((Ptr)PyMac_Initialize == (Ptr)kUnresolvedCFragSymbolAddress) - goto theend; -#endif if (Python_Init()) goto theend; @@ -1087,9 +1104,6 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) Python_Lock_Vim(); /* enter vim */ PythonIO_Flush(); -#if defined(MACOS) && !defined(MACOS_X_UNIX) - SetPort(oldPort); -#endif theend: #ifndef PY_CAN_RECURSE @@ -1106,6 +1120,9 @@ ex_python(exarg_T *eap) { char_u *script; + if (p_pyx == 0) + p_pyx = 2; + script = script_get(eap, eap->arg); if (!eap->skip) { @@ -1129,6 +1146,9 @@ ex_pyfile(exarg_T *eap) const char *file = (char *)eap->arg; char *p; + if (p_pyx == 0) + p_pyx = 2; + /* Have to do it like this. PyRun_SimpleFile requires you to pass a * stdio file pointer, but Vim and the Python DLL are compiled with * different options under Windows, meaning that stdio pointers aren't @@ -1167,6 +1187,9 @@ ex_pyfile(exarg_T *eap) void ex_pydo(exarg_T *eap) { + if (p_pyx == 0) + p_pyx = 2; + DoPyCommand((char *)eap->arg, (rangeinitializer) init_range_cmd, (runner)run_do, @@ -1187,7 +1210,10 @@ OutputGetattr(PyObject *self, char *name) return PyInt_FromLong(((OutputObject *)(self))->softspace); else if (strcmp(name, "__members__") == 0) return ObjectDir(NULL, OutputAttrs); - + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return Py_FindMethod(OutputMethods, self, name); } @@ -1414,7 +1440,6 @@ python_buffer_free(buf_T *buf) } } -#if defined(FEAT_WINDOWS) || defined(PROTO) void python_window_free(win_T *win) { @@ -1436,7 +1461,6 @@ python_tabpage_free(tabpage_T *tab) TAB_PYTHON_REF(tab) = NULL; } } -#endif static int PythonMod_Init(void) @@ -1531,12 +1555,12 @@ ListGetattr(PyObject *self, char *name) static PyObject * FunctionGetattr(PyObject *self, char *name) { - FunctionObject *this = (FunctionObject *)(self); + PyObject *r; - if (strcmp(name, "name") == 0) - return PyString_FromString((char *)(this->name)); - else if (strcmp(name, "__members__") == 0) - return ObjectDir(NULL, FunctionAttrs); + r = FunctionAttr((FunctionObject *)(self), name); + + if (r || PyErr_Occurred()) + return r; else return Py_FindMethod(FunctionMethods, self, name); } @@ -1548,15 +1572,23 @@ do_pyeval (char_u *str, typval_T *rettv) (rangeinitializer) init_range_eval, (runner) run_eval, (void *) rettv); - switch(rettv->v_type) + switch (rettv->v_type) { case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break; case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break; case VAR_FUNC: func_ref(rettv->vval.v_string); break; + case VAR_PARTIAL: ++rettv->vval.v_partial->pt_refcount; break; case VAR_UNKNOWN: rettv->v_type = VAR_NUMBER; rettv->vval.v_number = 0; break; + case VAR_NUMBER: + case VAR_STRING: + case VAR_FLOAT: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + break; } } @@ -1571,8 +1603,8 @@ Py_GetProgramName(void) } #endif /* Python 1.4 */ - void + int set_ref_in_python (int copyID) { - set_ref_in_py(copyID); + return set_ref_in_py(copyID); } diff --git a/src/if_python3.c b/src/if_python3.c index 374641d82e..f713f56235 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -34,11 +34,6 @@ #include <limits.h> -/* Python.h defines _POSIX_THREADS itself (if needed) */ -#ifdef _POSIX_THREADS -# undef _POSIX_THREADS -#endif - #if defined(_WIN32) && defined(HAVE_FCNTL_H) # undef HAVE_FCNTL_H #endif @@ -51,6 +46,15 @@ # undef F_BLANK #endif +#ifdef HAVE_STRFTIME +# undef HAVE_STRFTIME +#endif +#ifdef HAVE_STRING_H +# undef HAVE_STRING_H +#endif +#ifdef HAVE_PUTENV +# undef HAVE_PUTENV +#endif #ifdef HAVE_STDARG_H # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ #endif @@ -65,10 +69,6 @@ #include <Python.h> -#if defined(MACOS) && !defined(MACOS_X_UNIX) -# include "macglue.h" -# include <CodeFragments.h> -#endif #undef main /* Defined in python.h - aargh */ #undef HAVE_FCNTL_H /* Clash with os_win32.h */ @@ -231,6 +231,7 @@ typedef PySliceObject PySliceObject_T; # define PyFloat_AsDouble py3_PyFloat_AsDouble # define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr # define PyType_Type (*py3_PyType_Type) +# define PyStdPrinter_Type (*py3_PyStdPrinter_Type) # define PySlice_Type (*py3_PySlice_Type) # define PyFloat_Type (*py3_PyFloat_Type) # define PyNumber_Check (*py3_PyNumber_Check) @@ -388,6 +389,7 @@ static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name); static PyObject* (*py3_PyType_GenericAlloc)(PyTypeObject *type, Py_ssize_t nitems); static PyObject* (*py3_PyType_GenericNew)(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyTypeObject* py3_PyType_Type; +static PyTypeObject* py3_PyStdPrinter_Type; static PyTypeObject* py3_PySlice_Type; static PyTypeObject* py3_PyFloat_Type; static PyTypeObject* py3_PyBool_Type; @@ -548,6 +550,7 @@ static struct {"PyType_GenericAlloc", (PYTHON_PROC*)&py3_PyType_GenericAlloc}, {"PyType_GenericNew", (PYTHON_PROC*)&py3_PyType_GenericNew}, {"PyType_Type", (PYTHON_PROC*)&py3_PyType_Type}, + {"PyStdPrinter_Type", (PYTHON_PROC*)&py3_PyStdPrinter_Type}, {"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type}, {"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type}, {"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type}, @@ -600,7 +603,10 @@ end_dynamic_python3(void) py3_runtime_link_init(char *libname, int verbose) { int i; - void *ucs_from_string, *ucs_decode, *ucs_as_encoded_string; + PYTHON_PROC *ucs_from_string = (PYTHON_PROC *)&py3_PyUnicode_FromString; + PYTHON_PROC *ucs_decode = (PYTHON_PROC *)&py3_PyUnicode_Decode; + PYTHON_PROC *ucs_as_encoded_string = + (PYTHON_PROC *)&py3_PyUnicode_AsEncodedString; # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON) /* Can't have Python and Python3 loaded at the same time. @@ -641,33 +647,29 @@ py3_runtime_link_init(char *libname, int verbose) /* Load unicode functions separately as only the ucs2 or the ucs4 functions * will be present in the library. */ # if PY_VERSION_HEX >= 0x030300f0 - ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString"); + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode"); + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicode_AsEncodedString"); # else - ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_AsEncodedString"); - if (!ucs_from_string || !ucs_decode || !ucs_as_encoded_string) + if (*ucs_from_string == NULL || *ucs_decode == NULL + || *ucs_as_encoded_string == NULL) { - ucs_from_string = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_AsEncodedString"); } # endif - if (ucs_from_string && ucs_decode && ucs_as_encoded_string) - { - py3_PyUnicode_FromString = ucs_from_string; - py3_PyUnicode_Decode = ucs_decode; - py3_PyUnicode_AsEncodedString = ucs_as_encoded_string; - } - else + if (*ucs_from_string == NULL || *ucs_decode == NULL + || *ucs_as_encoded_string == NULL) { close_dll(hinstPy3); hinstPy3 = 0; @@ -686,16 +688,16 @@ py3_runtime_link_init(char *libname, int verbose) int python3_enabled(int verbose) { - return py3_runtime_link_init(DYNAMIC_PYTHON3_DLL, verbose) == OK; + return py3_runtime_link_init((char *)p_py3dll, verbose) == OK; } /* Load the standard Python exceptions - don't import the symbols from the * DLL, as this can cause errors (importing data symbols is not reliable). */ -static void get_py3_exceptions __ARGS((void)); +static void get_py3_exceptions(void); static void -get_py3_exceptions() +get_py3_exceptions(void) { PyObject *exmod = PyImport_ImportModule("builtins"); PyObject *exdict = PyModule_GetDict(exmod); @@ -724,8 +726,8 @@ get_py3_exceptions() #endif /* DYNAMIC_PYTHON3 */ static int py3initialised = 0; - #define PYINITIALISED py3initialised +static int python_end_called = FALSE; #define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self) @@ -800,7 +802,7 @@ static PyObject *Py3Init_vim(void); */ void -python3_end() +python3_end(void) { static int recurse = 0; @@ -808,6 +810,7 @@ python3_end() if (recurse != 0) return; + python_end_called = TRUE; ++recurse; #ifdef DYNAMIC_PYTHON3 @@ -815,7 +818,7 @@ python3_end() #endif if (Py_IsInitialized()) { - // acquire lock before finalizing + /* acquire lock before finalizing */ PyGILState_Ensure(); Py_Finalize(); @@ -828,14 +831,16 @@ python3_end() --recurse; } -#if (defined(DYNAMIC_PYTHON) && defined(FEAT_PYTHON)) || defined(PROTO) +#if (defined(DYNAMIC_PYTHON3) && defined(DYNAMIC_PYTHON) && defined(FEAT_PYTHON) && defined(UNIX)) || defined(PROTO) int -python3_loaded() +python3_loaded(void) { return (hinstPy3 != 0); } #endif +static wchar_t *py_home_buf = NULL; + static int Python3_Init(void) { @@ -851,18 +856,25 @@ Python3_Init(void) init_structs(); + if (*p_py3home != NUL) + { + size_t len = mbstowcs(NULL, (char *)p_py3home, 0) + 1; + /* The string must not change later, make a copy in static memory. */ + py_home_buf = (wchar_t *)alloc(len * sizeof(wchar_t)); + if (py_home_buf != NULL && mbstowcs( + py_home_buf, (char *)p_py3home, len) != (size_t)-1) + Py_SetPythonHome(py_home_buf); + } #ifdef PYTHON3_HOME - Py_SetPythonHome(PYTHON3_HOME); + else if (mch_getenv((char_u *)"PYTHONHOME") == NULL) + Py_SetPythonHome(PYTHON3_HOME); #endif PyImport_AppendInittab("vim", Py3Init_vim); -#if !defined(MACOS) || defined(MACOS_X_UNIX) Py_Initialize(); -#else - PyMac_Initialize(); -#endif + /* Initialise threads, and below save the state using * PyEval_SaveThread. Without the call to PyEval_SaveThread, thread * specific state (such as the system trace hook), will be lost @@ -916,9 +928,6 @@ Python3_Init(void) static void DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) { -#if defined(MACOS) && !defined(MACOS_X_UNIX) - GrafPtr oldPort; -#endif #if defined(HAVE_LOCALE_H) || defined(X_LOCALE) char *saved_locale; #endif @@ -926,12 +935,9 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) PyObject *cmdbytes; PyGILState_STATE pygilstate; -#if defined(MACOS) && !defined(MACOS_X_UNIX) - GetPort(&oldPort); - /* Check if the Python library is available */ - if ((Ptr)PyMac_Initialize == (Ptr)kUnresolvedCFragSymbolAddress) + if (python_end_called) goto theend; -#endif + if (Python3_Init()) goto theend; @@ -976,9 +982,6 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg) Python_Lock_Vim(); /* enter vim */ PythonIO_Flush(); -#if defined(MACOS) && !defined(MACOS_X_UNIX) - SetPort(oldPort); -#endif theend: return; /* keeps lint happy */ @@ -992,6 +995,9 @@ ex_py3(exarg_T *eap) { char_u *script; + if (p_pyx == 0) + p_pyx = 3; + script = script_get(eap, eap->arg); if (!eap->skip) { @@ -1016,6 +1022,9 @@ ex_py3file(exarg_T *eap) char *p; int i; + if (p_pyx == 0) + p_pyx = 3; + /* Have to do it like this. PyRun_SimpleFile requires you to pass a * stdio file pointer, but Vim and the Python DLL are compiled with * different options under Windows, meaning that stdio pointers aren't @@ -1068,6 +1077,9 @@ ex_py3file(exarg_T *eap) void ex_py3do(exarg_T *eap) { + if (p_pyx == 0) + p_pyx = 3; + DoPyCommand((char *)eap->arg, (rangeinitializer)init_range_cmd, (runner)run_do, @@ -1088,6 +1100,10 @@ OutputGetattro(PyObject *self, PyObject *nameobj) if (strcmp(name, "softspace") == 0) return PyLong_FromLong(((OutputObject *)(self))->softspace); + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return PyObject_GenericGetAttr(self, nameobj); } @@ -1516,14 +1532,16 @@ ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val) static PyObject * FunctionGetattro(PyObject *self, PyObject *nameobj) { + PyObject *r; FunctionObject *this = (FunctionObject *)(self); GET_ATTR_STRING(name, nameobj); - if (strcmp(name, "name") == 0) - return PyUnicode_FromString((char *)(this->name)); - - return PyObject_GenericGetAttr(self, nameobj); + r = FunctionAttr(this, name); + if (r || PyErr_Occurred()) + return r; + else + return PyObject_GenericGetAttr(self, nameobj); } /* External interface @@ -1540,7 +1558,6 @@ python3_buffer_free(buf_T *buf) } } -#if defined(FEAT_WINDOWS) || defined(PROTO) void python3_window_free(win_T *win) { @@ -1562,7 +1579,6 @@ python3_tabpage_free(tabpage_T *tab) TAB_PYTHON_REF(tab) = NULL; } } -#endif static PyObject * Py3Init_vim(void) @@ -1642,15 +1658,23 @@ do_py3eval (char_u *str, typval_T *rettv) case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break; case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break; case VAR_FUNC: func_ref(rettv->vval.v_string); break; + case VAR_PARTIAL: ++rettv->vval.v_partial->pt_refcount; break; case VAR_UNKNOWN: rettv->v_type = VAR_NUMBER; rettv->vval.v_number = 0; break; + case VAR_NUMBER: + case VAR_STRING: + case VAR_FLOAT: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + break; } } - void + int set_ref_in_python3 (int copyID) { - set_ref_in_py(copyID); + return set_ref_in_py(copyID); } diff --git a/src/if_ruby.c b/src/if_ruby.c index 4fc093ac95..eb79077bda 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -31,6 +31,10 @@ # define RUBYEXTERN extern #endif +#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 24 +# define USE_RUBY_INTEGER +#endif + #ifdef DYNAMIC_RUBY /* * This is tricky. In ruby.h there is (inline) function rb_class_of() @@ -39,6 +43,9 @@ */ # define rb_cFalseClass (*dll_rb_cFalseClass) # define rb_cFixnum (*dll_rb_cFixnum) +# if defined(USE_RUBY_INTEGER) +# define rb_cInteger (*dll_rb_cInteger) +# endif # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 # define rb_cFloat (*dll_rb_cFloat) # endif @@ -81,6 +88,11 @@ # define RUBY19_OR_LATER 1 #endif +#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \ + || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20) +# define RUBY20_OR_LATER 1 +#endif + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 /* Ruby 1.9 defines a number of static functions which use rb_num2long and * rb_int2big */ @@ -96,23 +108,18 @@ # define rb_num2int rb_num2int_stub #endif -# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21 +#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 /* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses * rb_gc_writebarrier_unprotect_promoted if USE_RGENGC */ -# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub -# endif - -#ifdef FEAT_GUI_MACVIM -# include <Ruby/ruby.h> -#else -# include <ruby.h> +# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub +#endif +#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 +# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub #endif + +#include <ruby.h> #ifdef RUBY19_OR_LATER -# ifdef FEAT_GUI_MACVIM -# include <Ruby/ruby/encoding.h> -# else -# include <ruby/encoding.h> -# endif +# include <ruby/encoding.h> #endif #undef off_t /* ruby defines off_t as _int64, Mingw uses long */ @@ -120,12 +127,22 @@ #undef _ /* T_DATA defined both by Ruby and Mac header files, hack around it... */ -#if defined(MACOS_X_UNIX) || defined(macintosh) +#if defined(MACOS_X) # define __OPENTRANSPORT__ # define __OPENTRANSPORTPROTOCOL__ # define __OPENTRANSPORTPROVIDERS__ #endif +/* + * The TypedData_XXX macro family can be used since Ruby 1.9.2 but + * rb_data_type_t changed in 1.9.3, therefore require at least 2.0. + * The old Data_XXX macro family was deprecated on Ruby 2.2. + * Use TypedData_XXX if available. + */ +#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER) +# define USE_TYPEDDATA 1 +#endif + /* * Backward compatibility for Ruby 1.8 and earlier. * Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided. @@ -148,6 +165,10 @@ # define RSTRING_PTR(s) RSTRING(s)->ptr #endif +#ifdef HAVE_DUP +# undef HAVE_DUP +#endif + #include "vim.h" #include "version.h" @@ -179,7 +200,7 @@ static void ruby_vim_init(void); #endif #if defined(DYNAMIC_RUBY) || defined(PROTO) -# ifdef PROTO +# if defined(PROTO) && !defined(HINSTANCE) # define HINSTANCE int /* for generating prototypes */ # endif @@ -189,8 +210,19 @@ static void ruby_vim_init(void); # define rb_assoc_new dll_rb_assoc_new # define rb_cObject (*dll_rb_cObject) # define rb_check_type dll_rb_check_type +# ifdef USE_TYPEDDATA +# define rb_check_typeddata dll_rb_check_typeddata +# endif # define rb_class_path dll_rb_class_path -# define rb_data_object_alloc dll_rb_data_object_alloc +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 +# define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap +# else +# define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc +# endif +# else +# define rb_data_object_alloc dll_rb_data_object_alloc +# endif # define rb_define_class_under dll_rb_define_class_under # define rb_define_const dll_rb_define_const # define rb_define_global_function dll_rb_define_global_function @@ -219,7 +251,8 @@ static void ruby_vim_init(void); # endif # define rb_lastline_get dll_rb_lastline_get # define rb_lastline_set dll_rb_lastline_set -# define rb_load_protect dll_rb_load_protect +# define rb_protect dll_rb_protect +# define rb_load dll_rb_load # ifndef RUBY19_OR_LATER # define rb_num2long dll_rb_num2long # endif @@ -232,6 +265,7 @@ static void ruby_vim_init(void); # define rb_raise dll_rb_raise # define rb_str_cat dll_rb_str_cat # define rb_str_concat dll_rb_str_concat +# undef rb_str_new # define rb_str_new dll_rb_str_new # ifdef rb_str_new2 /* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */ @@ -270,6 +304,7 @@ static void ruby_vim_init(void); # define ruby_init_loadpath dll_ruby_init_loadpath # ifdef WIN3264 # define NtInitialize dll_NtInitialize +# define ruby_sysinit dll_ruby_sysinit # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 # define rb_w32_snprintf dll_rb_w32_snprintf # endif @@ -279,10 +314,11 @@ static void ruby_vim_init(void); # define ruby_script dll_ruby_script # define rb_enc_find_index dll_rb_enc_find_index # define rb_enc_find dll_rb_enc_find -# define rb_enc_str_new dll_rb_enc_str_new +# undef rb_enc_str_new +# define rb_enc_str_new dll_rb_enc_str_new # define rb_sprintf dll_rb_sprintf # define rb_require dll_rb_require -# define ruby_process_options dll_ruby_process_options +# define ruby_options dll_ruby_options # endif /* @@ -291,6 +327,9 @@ static void ruby_vim_init(void); static VALUE (*dll_rb_assoc_new) (VALUE, VALUE); VALUE *dll_rb_cFalseClass; VALUE *dll_rb_cFixnum; +# if defined(USE_RUBY_INTEGER) +VALUE *dll_rb_cInteger; +# endif # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 VALUE *dll_rb_cFloat; # endif @@ -299,8 +338,19 @@ static VALUE *dll_rb_cObject; VALUE *dll_rb_cSymbol; VALUE *dll_rb_cTrueClass; static void (*dll_rb_check_type) (VALUE,int); +# ifdef USE_TYPEDDATA +static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); +# endif static VALUE (*dll_rb_class_path) (VALUE); +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 +static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *); +# else +static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *); +# endif +# else static VALUE (*dll_rb_data_object_alloc) (VALUE, void*, RUBY_DATA_FUNC, RUBY_DATA_FUNC); +# endif static VALUE (*dll_rb_define_class_under) (VALUE, const char*, VALUE); static void (*dll_rb_define_const) (VALUE,const char*,VALUE); static void (*dll_rb_define_global_function) (const char*,VALUE(*)(),int); @@ -327,7 +377,8 @@ static unsigned long (*dll_rb_num2uint) (VALUE); # endif static VALUE (*dll_rb_lastline_get) (void); static void (*dll_rb_lastline_set) (VALUE); -static void (*dll_rb_load_protect) (VALUE, int, int*); +static VALUE (*dll_rb_protect) (VALUE (*)(VALUE), VALUE, int*); +static void (*dll_rb_load) (VALUE, int); static long (*dll_rb_num2long) (VALUE); static unsigned long (*dll_rb_num2ulong) (VALUE); static VALUE (*dll_rb_obj_alloc) (VALUE); @@ -357,6 +408,7 @@ static void (*dll_ruby_init) (void); static void (*dll_ruby_init_loadpath) (void); # ifdef WIN3264 static void (*dll_NtInitialize) (int*, char***); +static void (*dll_ruby_sysinit) (int*, char***); # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...); # endif @@ -386,15 +438,23 @@ static rb_encoding* (*dll_rb_enc_find) (const char*); static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*); static VALUE (*dll_rb_sprintf) (const char*, ...); static VALUE (*dll_rb_require) (const char*); -static void* (*ruby_process_options)(int, char**); +static void* (*ruby_options)(int, char**); # endif # if defined(USE_RGENGC) && USE_RGENGC +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE); +# else +static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj); +# endif # endif # if defined(RUBY19_OR_LATER) && !defined(PROTO) +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 +long rb_num2long_stub(VALUE x) +# else SIGNED_VALUE rb_num2long_stub(VALUE x) +# endif { return dll_rb_num2long(x); } @@ -419,18 +479,30 @@ rb_float_new_in_heap(double d) { return dll_rb_float_new(d); } +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 +unsigned long rb_num2ulong(VALUE x) +# else VALUE rb_num2ulong(VALUE x) +# endif { return (long)RSHIFT((SIGNED_VALUE)(x),1); } # endif # endif -# if defined(USE_RGENGC) && USE_RGENGC + /* Do not generate a prototype here, VALUE isn't always defined. */ +# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO) +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) { - return dll_rb_gc_writebarrier_unprotect_promoted(obj); + dll_rb_gc_writebarrier_unprotect_promoted(obj); +} +# else +void rb_gc_writebarrier_unprotect_stub(VALUE obj) +{ + dll_rb_gc_writebarrier_unprotect(obj); } +# endif # endif static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */ @@ -446,7 +518,11 @@ static struct { {"rb_assoc_new", (RUBY_PROC*)&dll_rb_assoc_new}, {"rb_cFalseClass", (RUBY_PROC*)&dll_rb_cFalseClass}, +# if defined(USE_RUBY_INTEGER) + {"rb_cInteger", (RUBY_PROC*)&dll_rb_cInteger}, +# else {"rb_cFixnum", (RUBY_PROC*)&dll_rb_cFixnum}, +# endif # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 {"rb_cFloat", (RUBY_PROC*)&dll_rb_cFloat}, # endif @@ -455,8 +531,19 @@ static struct {"rb_cSymbol", (RUBY_PROC*)&dll_rb_cSymbol}, {"rb_cTrueClass", (RUBY_PROC*)&dll_rb_cTrueClass}, {"rb_check_type", (RUBY_PROC*)&dll_rb_check_type}, +# ifdef USE_TYPEDDATA + {"rb_check_typeddata", (RUBY_PROC*)&dll_rb_check_typeddata}, +# endif {"rb_class_path", (RUBY_PROC*)&dll_rb_class_path}, +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 + {"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap}, +# else + {"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc}, +# endif +# else {"rb_data_object_alloc", (RUBY_PROC*)&dll_rb_data_object_alloc}, +# endif {"rb_define_class_under", (RUBY_PROC*)&dll_rb_define_class_under}, {"rb_define_const", (RUBY_PROC*)&dll_rb_define_const}, {"rb_define_global_function", (RUBY_PROC*)&dll_rb_define_global_function}, @@ -483,7 +570,8 @@ static struct # endif {"rb_lastline_get", (RUBY_PROC*)&dll_rb_lastline_get}, {"rb_lastline_set", (RUBY_PROC*)&dll_rb_lastline_set}, - {"rb_load_protect", (RUBY_PROC*)&dll_rb_load_protect}, + {"rb_protect", (RUBY_PROC*)&dll_rb_protect}, + {"rb_load", (RUBY_PROC*)&dll_rb_load}, {"rb_num2long", (RUBY_PROC*)&dll_rb_num2long}, {"rb_num2ulong", (RUBY_PROC*)&dll_rb_num2ulong}, {"rb_obj_alloc", (RUBY_PROC*)&dll_rb_obj_alloc}, @@ -511,13 +599,11 @@ static struct {"ruby_init", (RUBY_PROC*)&dll_ruby_init}, {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath}, # ifdef WIN3264 - { # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19 - "NtInitialize", + {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize}, # else - "ruby_sysinit", + {"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit}, # endif - (RUBY_PROC*)&dll_NtInitialize}, # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf}, # endif @@ -540,7 +626,7 @@ static struct {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new}, {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf}, {"rb_require", (RUBY_PROC*)&dll_rb_require}, - {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options}, + {"ruby_options", (RUBY_PROC*)&dll_ruby_options}, # endif # if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) # ifdef __ia64 @@ -549,7 +635,11 @@ static struct {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, # endif # if defined(USE_RGENGC) && USE_RGENGC +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 {"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted}, +# else + {"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect}, +# endif # endif {"", NULL}, }; @@ -558,7 +648,7 @@ static struct * Free ruby.dll */ static void -end_dynamic_ruby() +end_dynamic_ruby(void) { if (hinstRuby) { @@ -607,15 +697,14 @@ ruby_runtime_link_init(char *libname, int verbose) * else FALSE. */ int -ruby_enabled(verbose) - int verbose; +ruby_enabled(int verbose) { - return ruby_runtime_link_init(DYNAMIC_RUBY_DLL, verbose) == OK; + return ruby_runtime_link_init((char *)p_rubydll, verbose) == OK; } #endif /* defined(DYNAMIC_RUBY) || defined(PROTO) */ void -ruby_end() +ruby_end(void) { #ifdef DYNAMIC_RUBY end_dynamic_ruby(); @@ -659,8 +748,9 @@ vim_str2rb_enc_str(const char *s) { enc = rb_enc_find((char *)sval); vim_free(sval); - if (enc) { - return rb_enc_str_new(s, strlen(s), enc); + if (enc) + { + return rb_enc_str_new(s, (long)strlen(s), enc); } } #endif @@ -696,24 +786,33 @@ void ex_rubydo(exarg_T *eap) { int state; linenr_T i; + buf_T *was_curbuf = curbuf; if (ensure_ruby_initialized()) { if (u_save(eap->line1 - 1, eap->line2 + 1) != OK) return; - for (i = eap->line1; i <= eap->line2; i++) { + for (i = eap->line1; i <= eap->line2; i++) + { VALUE line; + if (i > curbuf->b_ml.ml_line_count) + break; line = vim_str2rb_enc_str((char *)ml_get(i)); rb_lastline_set(line); eval_enc_string_protect((char *) eap->arg, &state); - if (state) { + if (state) + { error_print(state); break; } + if (was_curbuf != curbuf) + break; line = rb_lastline_get(); - if (!NIL_P(line)) { - if (TYPE(line) != T_STRING) { + if (!NIL_P(line)) + { + if (TYPE(line) != T_STRING) + { EMSG(_("E265: $_ must be an instance of String")); return; } @@ -729,14 +828,22 @@ void ex_rubydo(exarg_T *eap) } } +static VALUE rb_load_wrap(VALUE file_to_load) +{ + rb_load(file_to_load, 0); + return Qnil; +} + void ex_rubyfile(exarg_T *eap) { int state; if (ensure_ruby_initialized()) { - rb_load_protect(rb_str_new2((char *) eap->arg), 0, &state); - if (state) error_print(state); + VALUE file_to_load = rb_str_new2((const char *)eap->arg); + rb_protect(rb_load_wrap, file_to_load, &state); + if (state) + error_print(state); } } @@ -770,7 +877,12 @@ static int ensure_ruby_initialized(void) /* suggested by Ariya Mizutani */ int argc = 1; char *argv[] = {"gvim.exe"}; - NtInitialize(&argc, &argv); + char **argvp = argv; +# ifdef RUBY19_OR_LATER + ruby_sysinit(&argc, &argvp); +# else + NtInitialize(&argc, &argvp); +# endif #endif { #if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) @@ -781,8 +893,8 @@ static int ensure_ruby_initialized(void) #ifdef RUBY19_OR_LATER { int dummy_argc = 2; - char *dummy_argv[] = {"vim-ruby", "-e0"}; - ruby_process_options(dummy_argc, dummy_argv); + char *dummy_argv[] = {"vim-ruby", "-e_=0"}; + ruby_options(dummy_argc, dummy_argv); } ruby_script("vim-ruby"); #else @@ -825,7 +937,8 @@ static void error_print(int state) #define TAG_FATAL 0x8 #define TAG_MASK 0xf - switch (state) { + switch (state) + { case TAG_RETURN: EMSG(_("E267: unexpected return")); break; @@ -850,10 +963,12 @@ static void error_print(int state) eclass = CLASS_OF(ruby_errinfo); einfo = rb_obj_as_string(ruby_errinfo); #endif - if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { + if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) + { EMSG(_("E272: unhandled exception")); } - else { + else + { VALUE epath; char *p; @@ -880,7 +995,7 @@ static VALUE vim_message(VALUE self UNUSED, VALUE str) if (RSTRING_LEN(str) > 0) { /* Only do this when the string isn't empty, alloc(0) causes trouble. */ - buff = ALLOCA_N(char, RSTRING_LEN(str)); + buff = ALLOCA_N(char, RSTRING_LEN(str) + 1); strcpy(buff, RSTRING_PTR(str)); p = strchr(buff, '\n'); if (p) *p = '\0'; @@ -964,6 +1079,11 @@ static VALUE vim_to_ruby(typval_T *tv) } } } + } + else if (tv->v_type == VAR_SPECIAL) + { + if (tv->vval.v_number <= VVAL_TRUE) + result = INT2NUM(tv->vval.v_number); } /* else return Qnil; */ return result; @@ -991,6 +1111,24 @@ static VALUE vim_evaluate(VALUE self UNUSED, VALUE str) #endif } +#ifdef USE_TYPEDDATA +static size_t buffer_dsize(const void *buf); + +static const rb_data_type_t buffer_type = { + "vim_buffer", + {0, 0, buffer_dsize, {0, 0}}, + 0, 0, +# ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, +# endif +}; + +static size_t buffer_dsize(const void *buf UNUSED) +{ + return sizeof(buf_T); +} +#endif + static VALUE buffer_new(buf_T *buf) { if (buf->b_ruby_ref) @@ -999,7 +1137,11 @@ static VALUE buffer_new(buf_T *buf) } else { +#ifdef USE_TYPEDDATA + VALUE obj = TypedData_Wrap_Struct(cBuffer, &buffer_type, buf); +#else VALUE obj = Data_Wrap_Struct(cBuffer, 0, 0, buf); +#endif buf->b_ruby_ref = (void *) obj; rb_hash_aset(objtbl, rb_obj_id(obj), obj); return obj; @@ -1010,23 +1152,27 @@ static buf_T *get_buf(VALUE obj) { buf_T *buf; +#ifdef USE_TYPEDDATA + TypedData_Get_Struct(obj, buf_T, &buffer_type, buf); +#else Data_Get_Struct(obj, buf_T, buf); +#endif if (buf == NULL) rb_raise(eDeletedBufferError, "attempt to refer to deleted buffer"); return buf; } -static VALUE buffer_s_current() +static VALUE buffer_s_current(void) { return buffer_new(curbuf); } -static VALUE buffer_s_count() +static VALUE buffer_s_count(void) { buf_T *b; int n = 0; - for (b = firstbuf; b != NULL; b = b->b_next) + FOR_ALL_BUFFERS(b) { /* Deleted buffers should not be counted * SegPhault - 01/07/05 */ @@ -1042,7 +1188,7 @@ static VALUE buffer_s_aref(VALUE self UNUSED, VALUE num) buf_T *b; int n = NUM2INT(num); - for (b = firstbuf; b != NULL; b = b->b_next) + FOR_ALL_BUFFERS(b) { /* Deleted buffers should not be counted * SegPhault - 01/07/05 */ @@ -1104,7 +1250,8 @@ static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_savesub(n) == OK) { + if (u_savesub(n) == OK) + { ml_replace(n, (char_u *)line, TRUE); changed(); #ifdef SYNTAX_HL @@ -1145,7 +1292,8 @@ static VALUE buffer_delete(VALUE self, VALUE num) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_savedel(n, 1) == OK) { + if (u_savedel(n, 1) == OK) + { ml_delete(n, 0); /* Changes to non-active buffers should properly refresh @@ -1184,7 +1332,8 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_inssub(n + 1) == OK) { + if (u_inssub(n + 1) == OK) + { ml_append(n, (char_u *) line, (colnr_T) 0, FALSE); /* Changes to non-active buffers should properly refresh screen @@ -1207,6 +1356,24 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str) return str; } +#ifdef USE_TYPEDDATA +static size_t window_dsize(const void *buf); + +static const rb_data_type_t window_type = { + "vim_window", + {0, 0, window_dsize, {0, 0}}, + 0, 0, +# ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, +# endif +}; + +static size_t window_dsize(const void *win UNUSED) +{ + return sizeof(win_T); +} +#endif + static VALUE window_new(win_T *win) { if (win->w_ruby_ref) @@ -1215,7 +1382,11 @@ static VALUE window_new(win_T *win) } else { +#ifdef USE_TYPEDDATA + VALUE obj = TypedData_Wrap_Struct(cVimWindow, &window_type, win); +#else VALUE obj = Data_Wrap_Struct(cVimWindow, 0, 0, win); +#endif win->w_ruby_ref = (void *) obj; rb_hash_aset(objtbl, rb_obj_id(obj), obj); return obj; @@ -1226,13 +1397,17 @@ static win_T *get_win(VALUE obj) { win_T *win; +#ifdef USE_TYPEDDATA + TypedData_Get_Struct(obj, win_T, &window_type, win); +#else Data_Get_Struct(obj, win_T, win); +#endif if (win == NULL) rb_raise(eDeletedWindowError, "attempt to refer to deleted window"); return win; } -static VALUE window_s_current() +static VALUE window_s_current(void) { return window_new(curwin); } @@ -1241,7 +1416,7 @@ static VALUE window_s_current() * Added line manipulation functions * SegPhault - 03/07/05 */ -static VALUE line_s_current() +static VALUE line_s_current(void) { return get_buffer_line(curbuf, curwin->w_cursor.lnum); } @@ -1251,25 +1426,21 @@ static VALUE set_current_line(VALUE self UNUSED, VALUE str) return set_buffer_line(curbuf, curwin->w_cursor.lnum, str); } -static VALUE current_line_number() +static VALUE current_line_number(void) { return INT2FIX((int)curwin->w_cursor.lnum); } -static VALUE window_s_count() +static VALUE window_s_count(void) { -#ifdef FEAT_WINDOWS win_T *w; int n = 0; - for (w = firstwin; w != NULL; w = w->w_next) + FOR_ALL_WINDOWS(w) n++; return INT2NUM(n); -#else - return INT2NUM(1); -#endif } static VALUE window_s_aref(VALUE self UNUSED, VALUE num) @@ -1277,11 +1448,7 @@ static VALUE window_s_aref(VALUE self UNUSED, VALUE num) win_T *w; int n = NUM2INT(num); -#ifndef FEAT_WINDOWS - w = curwin; -#else for (w = firstwin; w != NULL; w = w->w_next, --n) -#endif if (n == 0) return window_new(w); return Qnil; @@ -1314,19 +1481,17 @@ static VALUE window_set_height(VALUE self, VALUE height) static VALUE window_width(VALUE self UNUSED) { - return INT2NUM(W_WIDTH(get_win(self))); + return INT2NUM(get_win(self)->w_width); } static VALUE window_set_width(VALUE self UNUSED, VALUE width) { -#ifdef FEAT_VERTSPLIT win_T *win = get_win(self); win_T *savewin = curwin; curwin = win; win_setwidth(NUM2INT(width)); curwin = savewin; -#endif return width; } @@ -1364,7 +1529,8 @@ static VALUE f_p(int argc, VALUE *argv, VALUE self UNUSED) int i; VALUE str = rb_str_new("", 0); - for (i = 0; i < argc; i++) { + for (i = 0; i < argc; i++) + { if (i > 0) rb_str_cat(str, ", ", 2); rb_str_concat(str, rb_inspect(argv[i])); } diff --git a/src/if_sniff.c b/src/if_sniff.c deleted file mode 100644 index 5cacb72f66..0000000000 --- a/src/if_sniff.c +++ /dev/null @@ -1,1216 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * if_sniff.c Interface between Vim and SNiFF+ - * - * See README.txt for an overview of the Vim source code. - */ - -#include "vim.h" - -#ifdef WIN32 -# include <stdio.h> -# include <process.h> -# include <string.h> -# include <assert.h> -#else -# ifdef FEAT_GUI_X11 -# include "gui_x11.pro" -# endif -# include "os_unixx.h" -#endif - -static int sniffemacs_pid; - -int fd_from_sniff; -int sniff_connected = 0; -int sniff_request_waiting = 0; -int want_sniff_request = 0; - -#define MAX_REQUEST_LEN 512 - -#define NEED_SYMBOL 2 -#define EMPTY_SYMBOL 4 -#define NEED_FILE 8 -#define SILENT 16 -#define DISCONNECT 32 -#define CONNECT 64 - -#define RQ_NONE 0 -#define RQ_SIMPLE 1 -#define RQ_CONTEXT NEED_FILE + NEED_SYMBOL -#define RQ_SCONTEXT NEED_FILE + NEED_SYMBOL + EMPTY_SYMBOL -#define RQ_NOSYMBOL NEED_FILE -#define RQ_SILENT RQ_NOSYMBOL + SILENT -#define RQ_CONNECT RQ_NONE + CONNECT -#define RQ_DISCONNECT RQ_SIMPLE + DISCONNECT - -struct sn_cmd -{ - char *cmd_name; - char cmd_code; - char *cmd_msg; - int cmd_type; -}; - -struct sn_cmd_list -{ - struct sn_cmd* sniff_cmd; - struct sn_cmd_list* next_cmd; -}; - -static struct sn_cmd sniff_cmds[] = -{ - { "toggle", 'e', N_("Toggle implementation/definition"),RQ_SCONTEXT }, - { "superclass", 's', N_("Show base class of"), RQ_CONTEXT }, - { "overridden", 'm', N_("Show overridden member function"),RQ_SCONTEXT }, - { "retrieve-file", 'r', N_("Retrieve from file"), RQ_CONTEXT }, - { "retrieve-project",'p', N_("Retrieve from project"), RQ_CONTEXT }, - { "retrieve-all-projects", - 'P', N_("Retrieve from all projects"), RQ_CONTEXT }, - { "retrieve-next", 'R', N_("Retrieve"), RQ_CONTEXT }, - { "goto-symbol", 'g', N_("Show source of"), RQ_CONTEXT }, - { "find-symbol", 'f', N_("Find symbol"), RQ_CONTEXT }, - { "browse-class", 'w', N_("Browse class"), RQ_CONTEXT }, - { "hierarchy", 't', N_("Show class in hierarchy"), RQ_CONTEXT }, - { "restr-hier", 'T', N_("Show class in restricted hierarchy"),RQ_CONTEXT }, - { "xref-to", 'x', N_("Xref refers to"), RQ_CONTEXT }, - { "xref-by", 'X', N_("Xref referred by"), RQ_CONTEXT }, - { "xref-has", 'c', N_("Xref has a"), RQ_CONTEXT }, - { "xref-used-by", 'C', N_("Xref used by"), RQ_CONTEXT }, - { "show-docu", 'd', N_("Show docu of"), RQ_CONTEXT }, - { "gen-docu", 'D', N_("Generate docu for"), RQ_CONTEXT }, - { "connect", 'y', NULL, RQ_CONNECT }, - { "disconnect", 'q', NULL, RQ_DISCONNECT }, - { "font-info", 'z', NULL, RQ_SILENT }, - { "update", 'u', NULL, RQ_SILENT }, - { NULL, '\0', NULL, 0} -}; - - -static char *SniffEmacs[2] = {"sniffemacs", (char *)NULL}; /* Yes, Emacs! */ -static int fd_to_sniff; -static int sniff_will_disconnect = 0; -static char msg_sniff_disconnect[] = N_("Cannot connect to SNiFF+. Check environment (sniffemacs must be found in $PATH).\n"); -static char sniff_rq_sep[] = " "; -static struct sn_cmd_list *sniff_cmd_ext = NULL; - -/* Initializing vim commands - * executed each time vim connects to Sniff - */ -static char *init_cmds[]= { - "augroup sniff", - "autocmd BufWritePost * sniff update", - "autocmd BufReadPost * sniff font-info", - "autocmd VimLeave * sniff disconnect", - "augroup END", - - "let g:sniff_connected = 1", - - "if ! exists('g:sniff_mappings_sourced')|" - "if ! exists('g:sniff_mappings')|" - "if exists('$SNIFF_DIR4')|" - "let g:sniff_mappings='$SNIFF_DIR4/config/integrations/vim/sniff.vim'|" - "else|" - "let g:sniff_mappings='$SNIFF_DIR/config/sniff.vim'|" - "endif|" - "endif|" - "let g:sniff_mappings=expand(g:sniff_mappings)|" - "if filereadable(g:sniff_mappings)|" - "execute 'source' g:sniff_mappings|" - "let g:sniff_mappings_sourced=1|" - "endif|" - "endif", - - NULL -}; - -/*-------- Function Prototypes ----------------------------------*/ - -static int ConnectToSniffEmacs __ARGS((void)); -static void sniff_connect __ARGS((void)); -static void HandleSniffRequest __ARGS((char* buffer)); -static int get_request __ARGS((int fd, char *buf, int maxlen)); -static void WriteToSniff __ARGS((char *str)); -static void SendRequest __ARGS((struct sn_cmd *command, char* symbol)); -static void vi_msg __ARGS((char *)); -static void vi_error_msg __ARGS((char *)); -static char *vi_symbol_under_cursor __ARGS((void)); -static void vi_open_file __ARGS((char *)); -static char *vi_buffer_name __ARGS((void)); -static buf_T *vi_find_buffer __ARGS((char *)); -static void vi_exec_cmd __ARGS((char *)); -static void vi_set_cursor_pos __ARGS((long char_nr)); -static long vi_cursor_pos __ARGS((void)); - -/* debug trace */ -#if 0 -static FILE* _tracefile = NULL; -#define SNIFF_TRACE_OPEN(file) if (!_tracefile) _tracefile = fopen(file, "w") -#define SNIFF_TRACE(msg) fprintf(_tracefile, msg); fflush(_tracefile); -#define SNIFF_TRACE1(msg, arg) fprintf(_tracefile, msg,arg); fflush(_tracefile); -#define SNIFF_TRACE_CLOSE fclose(_tracefile); _tracefile=NULL; -#else -#define SNIFF_TRACE_OPEN(file) -#define SNIFF_TRACE(msg) -#define SNIFF_TRACE1(msg, arg) -#define SNIFF_TRACE_CLOSE -#endif - -/*-------- Windows Only Declarations -----------------------------*/ -#ifdef WIN32 - -static int sniff_request_processed=1; -static HANDLE sniffemacs_handle=NULL; -static HANDLE readthread_handle=NULL; -static HANDLE handle_to_sniff=NULL; -static HANDLE handle_from_sniff=NULL; - -struct sniffBufNode -{ - struct sniffBufNode *next; - int bufLen; - char buf[MAX_REQUEST_LEN]; -}; -static struct sniffBufNode *sniffBufStart=NULL; -static struct sniffBufNode *sniffBufEnd=NULL; -static HANDLE hBufferMutex=NULL; - -# ifdef FEAT_GUI_W32 - extern HWND s_hwnd; /* gvim's Window handle */ -# endif -/* - * some helper functions for Windows port only - */ - - static HANDLE -ExecuteDetachedProgram(char *szBinary, char *szCmdLine, - HANDLE hStdInput, HANDLE hStdOutput) -{ - BOOL bResult; - DWORD nError; - PROCESS_INFORMATION aProcessInformation; - PROCESS_INFORMATION *pProcessInformation= &aProcessInformation; - STARTUPINFO aStartupInfo; - STARTUPINFO *pStartupInfo= &aStartupInfo; - DWORD dwCreationFlags= 0; - char szPath[512]; - HINSTANCE hResult; - - hResult = FindExecutable(szBinary, ".", szPath); - if ((int)hResult <= 32) - { - /* can't find the exe file */ - return NULL; - } - - ZeroMemory(pStartupInfo, sizeof(*pStartupInfo)); - pStartupInfo->dwFlags= STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; - pStartupInfo->hStdInput = hStdInput; - pStartupInfo->hStdOutput = hStdOutput; - pStartupInfo->wShowWindow= SW_HIDE; - pStartupInfo->cb = sizeof(STARTUPINFO); - - bResult= CreateProcess( - szPath, - szCmdLine, - NULL, /* security attr for process */ - NULL, /* security attr for primary thread */ - TRUE, /* DO inherit stdin and stdout */ - dwCreationFlags, /* creation flags */ - NULL, /* environment */ - ".", /* current directory */ - pStartupInfo, /* startup info: NULL crashes */ - pProcessInformation /* process information: NULL crashes */ - ); - nError= GetLastError(); - if (bResult) - { - CloseHandle(pProcessInformation->hThread); - CloseHandle(hStdInput); - CloseHandle(hStdOutput); - return(pProcessInformation->hProcess); - } - else - return(NULL); -} - -/* - * write to the internal Thread / Thread communications buffer. - * Return TRUE if successful, FALSE else. - */ - static BOOL -writeToBuffer(char *msg, int len) -{ - DWORD dwWaitResult; /* Request ownership of mutex. */ - struct sniffBufNode *bn; - int bnSize; - - SNIFF_TRACE1("writeToBuffer %d\n", len); - bnSize = sizeof(struct sniffBufNode) - MAX_REQUEST_LEN + len + 1; - if (bnSize < 128) bnSize = 128; /* minimum length to avoid fragmentation */ - bn = (struct sniffBufNode *)malloc(bnSize); - if (!bn) - return FALSE; - - memcpy(bn->buf, msg, len); - bn->buf[len]='\0'; /* terminate CString for added safety */ - bn->next = NULL; - bn->bufLen = len; - /* now, acquire a Mutex for adding the string to our linked list */ - dwWaitResult = WaitForSingleObject( - hBufferMutex, /* handle of mutex */ - 1000L); /* one-second time-out interval */ - if (dwWaitResult == WAIT_OBJECT_0) - { - /* The thread got mutex ownership. */ - if (sniffBufEnd) - { - sniffBufEnd->next = bn; - sniffBufEnd = bn; - } - else - sniffBufStart = sniffBufEnd = bn; - /* Release ownership of the mutex object. */ - if (! ReleaseMutex(hBufferMutex)) - { - /* Deal with error. */ - } - return TRUE; - } - - /* Cannot get mutex ownership due to time-out or mutex object abandoned. */ - free(bn); - return FALSE; -} - -/* - * read from the internal Thread / Thread communications buffer. - * Return TRUE if successful, FALSE else. - */ - static int -ReadFromBuffer(char *buf, int maxlen) -{ - DWORD dwWaitResult; /* Request ownership of mutex. */ - int theLen; - struct sniffBufNode *bn; - - dwWaitResult = WaitForSingleObject( - hBufferMutex, /* handle of mutex */ - 1000L); /* one-second time-out interval */ - if (dwWaitResult == WAIT_OBJECT_0) - { - if (!sniffBufStart) - { - /* all pending Requests Processed */ - theLen = 0; - } - else - { - bn = sniffBufStart; - theLen = bn->bufLen; - SNIFF_TRACE1("ReadFromBuffer %d\n", theLen); - if (theLen >= maxlen) - { - /* notify the user of buffer overflow? */ - theLen = maxlen-1; - } - memcpy(buf, bn->buf, theLen); - buf[theLen] = '\0'; - if (! (sniffBufStart = bn->next)) - { - sniffBufEnd = NULL; - sniff_request_processed = 1; - } - free(bn); - } - if (! ReleaseMutex(hBufferMutex)) - { - /* Deal with error. */ - } - return theLen; - } - - /* Cannot get mutex ownership due to time-out or mutex object abandoned. */ - return -1; -} - -/* on Win32, a separate Thread reads the input pipe. get_request is not needed here. */ - static void __cdecl -SniffEmacsReadThread(void *dummy) -{ - static char ReadThreadBuffer[MAX_REQUEST_LEN]; - int ReadThreadLen=0; - int result=0; - int msgLen=0; - char *msgStart, *msgCur; - - SNIFF_TRACE("begin thread\n"); - /* Read from the pipe to SniffEmacs */ - while (sniff_connected) - { - if (!ReadFile(handle_from_sniff, - ReadThreadBuffer + ReadThreadLen, /* acknowledge rest in buffer */ - MAX_REQUEST_LEN - ReadThreadLen, - &result, - NULL)) - { - DWORD err = GetLastError(); - result = -1; - } - - if (result < 0) - { - /* probably sniffemacs died... log the Error? */ - sniff_disconnect(1); - } - else if (result > 0) - { - ReadThreadLen += result-1; /* total length of valid chars */ - for(msgCur=msgStart=ReadThreadBuffer; ReadThreadLen > 0; msgCur++, ReadThreadLen--) - { - if (*msgCur == '\0' || *msgCur == '\r' || *msgCur == '\n') - { - msgLen = msgCur-msgStart; /* don't add the CR/LF chars */ - if (msgLen > 0) - writeToBuffer(msgStart, msgLen); - msgStart = msgCur + 1; /* over-read single CR/LF chars */ - } - } - - /* move incomplete message to beginning of buffer */ - ReadThreadLen = msgCur - msgStart; - if (ReadThreadLen > 0) - mch_memmove(ReadThreadBuffer, msgStart, ReadThreadLen); - - if (sniff_request_processed) - { - /* notify others that new data has arrived */ - sniff_request_processed = 0; - sniff_request_waiting = 1; -#ifdef FEAT_GUI_W32 - PostMessage(s_hwnd, WM_USER, (WPARAM)0, (LPARAM)0); -#endif - } - } - } - SNIFF_TRACE("end thread\n"); -} -#endif /* WIN32 */ -/*-------- End of Windows Only Declarations ------------------------*/ - - -/* ProcessSniffRequests - * Function that should be called from outside - * to process the waiting sniff requests - */ - void -ProcessSniffRequests() -{ - static char buf[MAX_REQUEST_LEN]; - int len; - - while (sniff_connected) - { -#ifdef WIN32 - len = ReadFromBuffer(buf, sizeof(buf)); -#else - len = get_request(fd_from_sniff, buf, sizeof(buf)); -#endif - if (len < 0) - { - vi_error_msg(_("E274: Sniff: Error during read. Disconnected")); - sniff_disconnect(1); - break; - } - else if (len > 0) - HandleSniffRequest( buf ); - else - break; - } - - if (sniff_will_disconnect) /* Now the last msg has been processed */ - sniff_disconnect(1); -} - - static struct sn_cmd * -find_sniff_cmd(cmd) - char *cmd; -{ - struct sn_cmd *sniff_cmd = NULL; - int i; - for(i=0; sniff_cmds[i].cmd_name; i++) - { - if (!strcmp(cmd, sniff_cmds[i].cmd_name)) - { - sniff_cmd = &sniff_cmds[i]; - break; - } - } - if (!sniff_cmd) - { - struct sn_cmd_list *list = sniff_cmd_ext; - while (list) - { - if (!strcmp(cmd, list->sniff_cmd->cmd_name)) - { - sniff_cmd = list->sniff_cmd; - break; - } - list = list->next_cmd; - } - } - return sniff_cmd; -} - - static int -add_sniff_cmd(cmd, def, msg) - char *cmd; - char *def; - char *msg; -{ - int rc = 0; - if (def != NULL && def[0] != NUL && find_sniff_cmd(cmd) == NULL) - { - struct sn_cmd_list *list = sniff_cmd_ext; - struct sn_cmd *sniff_cmd = (struct sn_cmd*)malloc(sizeof(struct sn_cmd)); - struct sn_cmd_list *cmd_node = (struct sn_cmd_list*)malloc(sizeof(struct sn_cmd_list)); - int rq_type = 0; - - /* unescape message text */ - char *p = msg; - char *end = p+strlen(msg); - while (*p) - { - if (*p == '\\') - mch_memmove(p,p+1,end-p); - p++; - } - SNIFF_TRACE1("request name = %s\n",cmd); - SNIFF_TRACE1("request def = %s\n",def); - SNIFF_TRACE1("request msg = %s\n",msg); - - while (list && list->next_cmd) - list = list->next_cmd; - if (!list) - sniff_cmd_ext = cmd_node; - else - list->next_cmd = cmd_node; - - sniff_cmd->cmd_name = cmd; - sniff_cmd->cmd_code = def[0]; - sniff_cmd->cmd_msg = msg; - switch(def[1]) - { - case 'f': - rq_type = RQ_NOSYMBOL; - break; - case 's': - rq_type = RQ_CONTEXT; - break; - case 'S': - rq_type = RQ_SCONTEXT; - break; - default: - rq_type = RQ_SIMPLE; - break; - } - sniff_cmd->cmd_type = rq_type; - cmd_node->sniff_cmd = sniff_cmd; - cmd_node->next_cmd = NULL; - rc = 1; - } - return rc; -} - -/* ex_sniff - * Handle ":sniff" command - */ - void -ex_sniff(eap) - exarg_T *eap; -{ - char_u *arg = eap->arg; - char_u *symbol = NULL; - char_u *cmd = NULL; - - SNIFF_TRACE_OPEN("if_sniff.log"); - if (ends_excmd(*arg)) /* no request: print available commands */ - { - int i; - msg_start(); - msg_outtrans_attr((char_u *)"-- SNiFF+ commands --", hl_attr(HLF_T)); - for(i=0; sniff_cmds[i].cmd_name; i++) - { - msg_putchar('\n'); - msg_outtrans((char_u *)":sniff "); - msg_outtrans((char_u *)sniff_cmds[i].cmd_name); - } - msg_putchar('\n'); - msg_outtrans((char_u *)_("SNiFF+ is currently ")); - if (!sniff_connected) - msg_outtrans((char_u *)_("not ")); - msg_outtrans((char_u *)_("connected")); - msg_end(); - } - else /* extract command name and symbol if present */ - { - symbol = skiptowhite(arg); - cmd = vim_strnsave(arg, (int)(symbol-arg)); - symbol = skipwhite(symbol); - if (ends_excmd(*symbol)) - symbol = NULL; - if (!strcmp((char *)cmd, "addcmd")) - { - char_u *def = skiptowhite(symbol); - char_u *name = vim_strnsave(symbol, (int)(def-symbol)); - char_u *msg; - def = skipwhite(def); - msg = skiptowhite(def); - def = vim_strnsave(def, (int)(msg-def)); - msg = skipwhite(msg); - if (ends_excmd(*msg)) - msg = vim_strsave(name); - else - msg = vim_strnsave(msg, (int)(skiptowhite_esc(msg)-msg)); - if (!add_sniff_cmd((char*)name, (char*)def, (char*)msg)) - { - vim_free(msg); - vim_free(def); - vim_free(name); - } - } - else - { - struct sn_cmd* sniff_cmd = find_sniff_cmd((char*)cmd); - if (sniff_cmd) - SendRequest(sniff_cmd, (char *)symbol); - else - EMSG2(_("E275: Unknown SNiFF+ request: %s"), cmd); - } - vim_free(cmd); - } -} - - - static void -sniff_connect() -{ - if (sniff_connected) - return; - if (ConnectToSniffEmacs()) - vi_error_msg(_("E276: Error connecting to SNiFF+")); - else - { - int i; - - for (i = 0; init_cmds[i]; i++) - vi_exec_cmd(init_cmds[i]); - } -} - - void -sniff_disconnect(immediately) - int immediately; -{ - if (!sniff_connected) - return; - if (immediately) - { - vi_exec_cmd("augroup sniff"); - vi_exec_cmd("au!"); - vi_exec_cmd("augroup END"); - vi_exec_cmd("unlet g:sniff_connected"); - sniff_connected = 0; - want_sniff_request = 0; - sniff_will_disconnect = 0; -#ifdef FEAT_GUI - if (gui.in_use) - gui_mch_wait_for_chars(0L); -#endif -#ifdef WIN32 - while (sniffBufStart != NULL) - { - struct sniffBufNode *node = sniffBufStart; - sniffBufStart = sniffBufStart->next; - free(node); - } - sniffBufStart = sniffBufEnd = NULL; - sniff_request_processed = 1; - CloseHandle(handle_to_sniff); - CloseHandle(handle_from_sniff); - WaitForSingleObject(sniffemacs_handle, 1000L); - CloseHandle(sniffemacs_handle); - sniffemacs_handle = NULL; - WaitForSingleObject(readthread_handle, 1000L); - readthread_handle = NULL; - CloseHandle(hBufferMutex); - hBufferMutex = NULL; - SNIFF_TRACE_CLOSE; -#else - close(fd_to_sniff); - close(fd_from_sniff); - wait(NULL); -#endif - } - else - { -#ifdef WIN32 - _sleep(2); - if (!sniff_request_processed) - ProcessSniffRequests(); -#else - sleep(2); /* Incoming msg could disturb edit */ -#endif - sniff_will_disconnect = 1; /* We expect disconnect msg in 2 secs */ - } -} - - -/* ConnectToSniffEmacs - * Connect to Sniff: returns 1 on error - */ - static int -ConnectToSniffEmacs() -{ -#ifdef WIN32 /* Windows Version of the Code */ - HANDLE ToSniffEmacs[2], FromSniffEmacs[2]; - SECURITY_ATTRIBUTES sa; - - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; - - if (! CreatePipe(&ToSniffEmacs[0], &ToSniffEmacs[1], &sa, 0)) - return 1; - if (! CreatePipe(&FromSniffEmacs[0], &FromSniffEmacs[1], &sa, 0)) - return 1; - - sniffemacs_handle = ExecuteDetachedProgram(SniffEmacs[0], SniffEmacs[0], - ToSniffEmacs[0], FromSniffEmacs[1]); - - if (sniffemacs_handle) - { - handle_to_sniff = ToSniffEmacs[1]; - handle_from_sniff = FromSniffEmacs[0]; - sniff_connected = 1; - hBufferMutex = CreateMutex( - NULL, /* no security attributes */ - FALSE, /* initially not owned */ - "SniffReadBufferMutex"); /* name of mutex */ - if (hBufferMutex == NULL) - { - /* Check for error. */ - } - readthread_handle = (HANDLE)_beginthread(SniffEmacsReadThread, 0, NULL); - return 0; - } - else - { - /* error in spawn() */ - return 1; - } - -#else /* UNIX Version of the Code */ - int ToSniffEmacs[2], FromSniffEmacs[2]; - - if (pipe(ToSniffEmacs) != 0) - return 1; - if (pipe(FromSniffEmacs) != 0) - return 1; - - /* fork */ - if ((sniffemacs_pid=fork()) == 0) - { - /* child */ - - /* prepare communication pipes */ - close(ToSniffEmacs[1]); - close(FromSniffEmacs[0]); - - dup2(ToSniffEmacs[0],fileno(stdin)); /* write to ToSniffEmacs[1] */ - dup2(FromSniffEmacs[1],fileno(stdout));/* read from FromSniffEmacs[0] */ - - close(ToSniffEmacs[0]); - close(FromSniffEmacs[1]); - - /* start sniffemacs */ - execvp (SniffEmacs[0], SniffEmacs); - { -/* FILE *out = fdopen(FromSniffEmacs[1], "w"); */ - sleep(1); - fputs(_(msg_sniff_disconnect), stdout); - fflush(stdout); - sleep(3); -#ifdef FEAT_GUI - if (gui.in_use) - gui_exit(1); -#endif - exit(1); - } - return 1; - } - else if (sniffemacs_pid > 0) - { - /* parent process */ - close(ToSniffEmacs[0]); - fd_to_sniff = ToSniffEmacs[1]; - close(FromSniffEmacs[1]); - fd_from_sniff = FromSniffEmacs[0]; - sniff_connected = 1; - return 0; - } - else /* error in fork() */ - return 1; -#endif /* UNIX Version of the Code */ -} - - -/* HandleSniffRequest - * Handle one request from SNiFF+ - */ - static void -HandleSniffRequest(buffer) - char *buffer; -{ - char VICommand[MAX_REQUEST_LEN]; - char command; - char *arguments; - char *token; - char *argv[3]; - int argc = 0; - buf_T *buf; - - const char *SetTab = "set tabstop=%d"; - const char *SelectBuf = "buf %s"; - const char *DeleteBuf = "bd %s"; - const char *UnloadBuf = "bun %s"; - const char *GotoLine = "%d"; - - command = buffer[0]; - arguments = &buffer[1]; - token = strtok(arguments, sniff_rq_sep); - while (argc <3) - { - if (token) - { - argv[argc] = (char*)vim_strsave((char_u *)token); - token = strtok(0, sniff_rq_sep); - } - else - argv[argc] = strdup(""); - argc++; - } - - switch (command) - { - case 'o' : /* visit file at char pos */ - case 'O' : /* visit file at line number */ - { - char *file = argv[0]; - int position = atoi(argv[1]); - - buf = vi_find_buffer(file); - setpcmark(); /* insert current pos in jump list [mark.c]*/ - if (!buf) - vi_open_file(file); - else if (buf!=curbuf) - { - vim_snprintf(VICommand, sizeof(VICommand), - (char *)SelectBuf, file); - vi_exec_cmd(VICommand); - } - if (command == 'o') - vi_set_cursor_pos((long)position); - else - { - vim_snprintf(VICommand, sizeof(VICommand), - (char *)GotoLine, (int)position); - vi_exec_cmd(VICommand); - } - checkpcmark(); /* [mark.c] */ -#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_W32) - if (gui.in_use && !gui.in_focus) /* Raise Vim Window */ - { -# ifdef FEAT_GUI_W32 - SetForegroundWindow(s_hwnd); -# else - extern Widget vimShell; - - XSetInputFocus(gui.dpy, XtWindow(vimShell), RevertToNone, - CurrentTime); - XRaiseWindow(gui.dpy, XtWindow(vimShell)); -# endif - } -#endif - break; - } - case 'p' : /* path of file has changed */ - /* when changing from shared to private WS (checkout) */ - { - char *file = argv[0]; - char *new_path = argv[1]; - - buf = vi_find_buffer(file); - if (buf && !buf->b_changed) /* delete buffer only if not modified */ - { - vim_snprintf(VICommand, sizeof(VICommand), - (char *)DeleteBuf, file); - vi_exec_cmd(VICommand); - } - vi_open_file(new_path); - break; - } - case 'w' : /* writability has changed */ - /* Sniff sends request twice, - * but only the last one is the right one */ - { - char *file = argv[0]; - int writable = atoi(argv[1]); - - buf = vi_find_buffer(file); - if (buf) - { - buf->b_p_ro = !writable; - if (buf != curbuf) - { - buf->b_flags |= BF_CHECK_RO + BF_NEVERLOADED; - if (writable && !buf->b_changed) - { - vim_snprintf(VICommand, sizeof(VICommand), - (char *)UnloadBuf, file); - vi_exec_cmd(VICommand); - } - } - else if (writable && !buf->b_changed) - { - vi_exec_cmd("e"); - } - } - break; - } - case 'h' : /* highlight info */ - break; /* not implemented */ - - case 't' : /* Set tab width */ - { - int tab_width = atoi(argv[1]); - - if (tab_width > 0 && tab_width <= 16) - { - vim_snprintf(VICommand, sizeof(VICommand), - (char *)SetTab, tab_width); - vi_exec_cmd(VICommand); - } - break; - } - case '|': - { - /* change the request separator */ - sniff_rq_sep[0] = arguments[0]; - /* echo the request */ - WriteToSniff(buffer); - break; - } - case 'A' : /* Warning/Info msg */ - vi_msg(arguments); - if (!strncmp(arguments, "Disconnected", 12)) - sniff_disconnect(1); /* unexpected disconnection */ - break; - case 'a' : /* Error msg */ - vi_error_msg(arguments); - if (!strncmp(arguments, "Cannot connect", 14)) - sniff_disconnect(1); - break; - - default : - break; - } - while (argc) - vim_free(argv[--argc]); -} - - -#ifndef WIN32 -/* get_request - * read string from fd up to next newline (excluding the nl), - * returns length of string - * 0 if no data available or no complete line - * <0 on error - */ - static int -get_request(fd, buf, maxlen) - int fd; - char *buf; - int maxlen; -{ - static char inbuf[1024]; - static int pos = 0, bytes = 0; - int len; -#ifdef HAVE_SELECT - struct timeval tval; - fd_set rfds; - - FD_ZERO(&rfds); - FD_SET(fd, &rfds); - tval.tv_sec = 0; - tval.tv_usec = 0; -#else - struct pollfd fds; - - fds.fd = fd; - fds.events = POLLIN; -#endif - - for (len = 0; len < maxlen; len++) - { - if (pos >= bytes) /* end of buffer reached? */ - { -#ifdef HAVE_SELECT - if (select(fd + 1, &rfds, NULL, NULL, &tval) > 0) -#else - if (poll(&fds, 1, 0) > 0) -#endif - { - pos = 0; - bytes = read(fd, inbuf, sizeof(inbuf)); - if (bytes <= 0) - return bytes; - } - else - { - pos = pos-len; - buf[0] = '\0'; - return 0; - } - } - if ((buf[len] = inbuf[pos++]) =='\n') - break; - } - buf[len] = '\0'; - return len; -} -#endif /* WIN32 */ - - - static void -SendRequest(command, symbol) - struct sn_cmd *command; - char *symbol; -{ - int cmd_type = command->cmd_type; - static char cmdstr[MAX_REQUEST_LEN]; - static char msgtxt[MAX_REQUEST_LEN]; - char *buffer_name = NULL; - - if (cmd_type == RQ_CONNECT) - { - sniff_connect(); - return; - } - if (!sniff_connected && !(cmd_type & SILENT)) - { - vi_error_msg(_("E278: SNiFF+ not connected")); - return; - } - - if (cmd_type & NEED_FILE) - { - if (!curbuf->b_sniff) - { - if (!(cmd_type & SILENT)) - vi_error_msg(_("E279: Not a SNiFF+ buffer")); - return; - } - buffer_name = vi_buffer_name(); - if (buffer_name == NULL) - return; - if (cmd_type & NEED_SYMBOL) - { - if (cmd_type & EMPTY_SYMBOL) - symbol = " "; - else if (!symbol && !(symbol = vi_symbol_under_cursor())) - return; /* error msg already displayed */ - } - - if (symbol) - vim_snprintf(cmdstr, sizeof(cmdstr), "%c%s%s%ld%s%s\n", - command->cmd_code, - buffer_name, - sniff_rq_sep, - vi_cursor_pos(), - sniff_rq_sep, - symbol - ); - else - vim_snprintf(cmdstr, sizeof(cmdstr), "%c%s\n", - command->cmd_code, buffer_name); - } - else /* simple request */ - { - cmdstr[0] = command->cmd_code; - cmdstr[1] = '\n'; - cmdstr[2] = '\0'; - } - if (command->cmd_msg && !(cmd_type & SILENT)) - { - if ((cmd_type & NEED_SYMBOL) && !(cmd_type & EMPTY_SYMBOL)) - { - vim_snprintf(msgtxt, sizeof(msgtxt), "%s: %s", - _(command->cmd_msg), symbol); - vi_msg(msgtxt); - } - else - vi_msg(_(command->cmd_msg)); - } - WriteToSniff(cmdstr); - if (cmd_type & DISCONNECT) - sniff_disconnect(0); -} - - - - static void -WriteToSniff(str) - char *str; -{ - int bytes; -#ifdef WIN32 - if (! WriteFile(handle_to_sniff, str, strlen(str), &bytes, NULL)) - { - DWORD err=GetLastError(); - bytes = -1; - } -#else - bytes = write(fd_to_sniff, str, strlen(str)); -#endif - if (bytes<0) - { - vi_msg(_("Sniff: Error during write. Disconnected")); - sniff_disconnect(1); - } -} - -/*-------- vim helping functions --------------------------------*/ - - static void -vi_msg(str) - char *str; -{ - if (str != NULL && *str != NUL) - MSG((char_u *)str); -} - - static void -vi_error_msg(str) - char *str; -{ - if (str != NULL && *str != NUL) - EMSG((char_u *)str); -} - - static void -vi_open_file(fname) - char *fname; -{ - ++no_wait_return; - do_ecmd(0, (char_u *)fname, NULL, NULL, ECMD_ONE, ECMD_HIDE+ECMD_OLDBUF, - curwin); - curbuf->b_sniff = TRUE; - --no_wait_return; /* [ex_docmd.c] */ -} - - static buf_T * -vi_find_buffer(fname) - char *fname; -{ /* derived from buflist_findname() [buffer.c] */ - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_sfname != NULL && fnamecmp(fname, buf->b_sfname) == 0) - return (buf); - return NULL; -} - - - static char * -vi_symbol_under_cursor() -{ - int len; - char *symbolp; - char *p; - static char sniff_symbol[256]; - - len = find_ident_under_cursor((char_u **)&symbolp, FIND_IDENT); - /* [normal.c] */ - if (len <= 0) - return NULL; - for (p=sniff_symbol; len; len--) - *p++ = *symbolp++; - *p = '\0'; - return sniff_symbol; -} - - - static char * -vi_buffer_name() -{ - return (char *)curbuf->b_sfname; -} - - static void -vi_exec_cmd(vicmd) - char *vicmd; -{ - do_cmdline_cmd((char_u *)vicmd); /* [ex_docmd.c] */ -} - -/* - * Set cursor on character position - * derived from cursor_pos_info() [buffer.c] - */ - static void -vi_set_cursor_pos(char_pos) - long char_pos; -{ - linenr_T lnum; - long char_count = 1; /* first position = 1 */ - int line_size; - int eol_size; - - if (char_pos == 0) - { - char_pos = 1; - } - if (get_fileformat(curbuf) == EOL_DOS) - eol_size = 2; - else - eol_size = 1; - for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) - { - line_size = STRLEN(ml_get(lnum)) + eol_size; - if (char_count+line_size > char_pos) break; - char_count += line_size; - } - curwin->w_cursor.lnum = lnum; - curwin->w_cursor.col = char_pos - char_count; -} - - static long -vi_cursor_pos() -{ - linenr_T lnum; - long char_count=1; /* sniff starts with pos 1 */ - int line_size; - int eol_size; - - if (curbuf->b_p_tx) - eol_size = 2; - else - eol_size = 1; - for (lnum = 1; lnum < curwin->w_cursor.lnum; ++lnum) - { - line_size = STRLEN(ml_get(lnum)) + eol_size; - char_count += line_size; - } - return char_count + curwin->w_cursor.col; -} diff --git a/src/if_sniff.h b/src/if_sniff.h deleted file mode 100644 index 16cce4109d..0000000000 --- a/src/if_sniff.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * if_sniff.h Interface between Vim and SNiFF+ - */ - -#ifndef __if_sniff_h__ -#define __if_sniff_h__ - -extern int want_sniff_request; -extern int sniff_request_waiting; -extern int sniff_connected; -extern int fd_from_sniff; -extern void sniff_disconnect __ARGS((int immediately)); -extern void ProcessSniffRequests __ARGS((void)); -extern void ex_sniff __ARGS((exarg_T *eap)); - -#endif diff --git a/src/if_tcl.c b/src/if_tcl.c index b798ea59ab..690c6392b1 100644 --- a/src/if_tcl.c +++ b/src/if_tcl.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -160,6 +160,20 @@ static struct ref refsdeleted; /* dummy object for deleted ref list */ typedef int HANDLE; # endif +# ifndef WIN3264 +# include <dlfcn.h> +# define HANDLE void* +# define TCL_PROC void* +# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) +# define symbol_from_dll dlsym +# define close_dll dlclose +# else +# define TCL_PROC FARPROC +# define load_dll vimLoadLib +# define symbol_from_dll GetProcAddress +# define close_dll FreeLibrary +# endif + /* * Declare HANDLE for tcl.dll and function pointers. */ @@ -170,7 +184,6 @@ void (*dll_Tcl_FindExecutable)(const void *); /* * Table of name to function pointer of tcl. */ -#define TCL_PROC FARPROC static struct { char* name; TCL_PROC* ptr; @@ -197,7 +210,7 @@ tcl_runtime_link_init(char *libname, int verbose) if (hTclLib) return OK; - if (!(hTclLib = vimLoadLib(libname))) + if (!(hTclLib = load_dll(libname))) { if (verbose) EMSG2(_(e_loadlib), libname); @@ -205,10 +218,10 @@ tcl_runtime_link_init(char *libname, int verbose) } for (i = 0; tcl_funcname_table[i].ptr; ++i) { - if (!(*tcl_funcname_table[i].ptr = GetProcAddress(hTclLib, + if (!(*tcl_funcname_table[i].ptr = symbol_from_dll(hTclLib, tcl_funcname_table[i].name))) { - FreeLibrary(hTclLib); + close_dll(hTclLib); hTclLib = NULL; if (verbose) EMSG2(_(e_loadfunc), tcl_funcname_table[i].name); @@ -224,8 +237,7 @@ static char *find_executable_arg = NULL; #endif void -vim_tcl_init(arg) - char *arg; +vim_tcl_init(char *arg) { #ifndef DYNAMIC_TCL Tcl_FindExecutable(arg); @@ -242,17 +254,16 @@ static int stubs_initialized = FALSE; * Return TRUE if the TCL interface can be used. */ int -tcl_enabled(verbose) - int verbose; +tcl_enabled(int verbose) { if (!stubs_initialized && find_executable_arg != NULL - && tcl_runtime_link_init(DYNAMIC_TCL_DLL, verbose) == OK) + && tcl_runtime_link_init((char *)p_tcldll, verbose) == OK) { Tcl_Interp *interp; dll_Tcl_FindExecutable(find_executable_arg); - if (interp = dll_Tcl_CreateInterp()) + if ((interp = dll_Tcl_CreateInterp()) != NULL) { if (Tcl_InitStubs(interp, DYNAMIC_TCL_VER, 0)) { @@ -267,12 +278,12 @@ tcl_enabled(verbose) #endif void -tcl_end() +tcl_end(void) { #ifdef DYNAMIC_TCL if (hTclLib) { - FreeLibrary(hTclLib); + close_dll(hTclLib); hTclLib = NULL; } #endif @@ -297,11 +308,11 @@ tcl_end() * useless for this routine to return the exit code via Tcl_SetResult(). */ static int -exitcmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +exitcmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int value = 0; @@ -326,18 +337,18 @@ exitcmd(dummy, interp, objc, objv) * "::vim::beep" - what Vi[m] does best :-) */ static int -beepcmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +beepcmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - vim_beep(); + vim_beep(BO_LANG); return TCL_OK; } @@ -348,11 +359,11 @@ beepcmd(dummy, interp, objc, objv) * "::vim::buffer new" - create a new buffer (not implemented) */ static int -buffercmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +buffercmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { char *name; buf_T *buf; @@ -377,7 +388,7 @@ buffercmd(dummy, interp, objc, objv) Tcl_WrongNumArgs(interp, 1, objv, "bufNumber"); return TCL_ERROR; } - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_fnum == n) { @@ -405,7 +416,7 @@ buffercmd(dummy, interp, objc, objv) err = TCL_ERROR; break; } - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { name = tclgetbuffer(interp, buf); if (name == NULL) @@ -444,11 +455,11 @@ buffercmd(dummy, interp, objc, objv) * "::vim::window list" - create list of window commands. */ static int -windowcmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +windowcmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { char *what, *string; win_T *win; @@ -485,11 +496,11 @@ windowcmd(dummy, interp, objc, objv) * This function implements the buffer commands. */ static int -bufselfcmd(ref, interp, objc, objv) - ClientData ref; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +bufselfcmd( + ClientData ref, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int opt, err, idx, flags; int val1, val2, n, i; @@ -924,11 +935,11 @@ bufselfcmd(ref, interp, objc, objv) * This function implements the window commands. */ static int -winselfcmd(ref, interp, objc, objv) - ClientData ref; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +winselfcmd( + ClientData ref, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int err, idx, flags; int val1, val2; @@ -1098,11 +1109,11 @@ winselfcmd(ref, interp, objc, objv) static int -commandcmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +commandcmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int err; @@ -1112,11 +1123,11 @@ commandcmd(dummy, interp, objc, objv) } static int -optioncmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +optioncmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int err; @@ -1126,11 +1137,11 @@ optioncmd(dummy, interp, objc, objv) } static int -exprcmd(dummy, interp, objc, objv) - ClientData dummy UNUSED; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +exprcmd( + ClientData dummy UNUSED, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { return tclvimexpr(interp, objc, objv, 1); } @@ -1143,11 +1154,11 @@ exprcmd(dummy, interp, objc, objv) * Get a line number from 'obj' and convert it to vim's range. */ static int -tclgetlinenum(interp, obj, valueP, buf) - Tcl_Interp *interp; - Tcl_Obj *obj; - int *valueP; - buf_T *buf; +tclgetlinenum( + Tcl_Interp *interp, + Tcl_Obj *obj, + int *valueP, + buf_T *buf) { int err, i; @@ -1196,8 +1207,7 @@ tclgetlinenum(interp, obj, valueP, buf) * Find the first window in the window list that displays the buffer. */ static win_T * -tclfindwin(buf) - buf_T *buf; +tclfindwin(buf_T *buf) { win_T *win; @@ -1213,11 +1223,11 @@ tclfindwin(buf) * Do-it-all function for "::vim::command", "$buf command" and "$win command". */ static int -tcldoexcommand(interp, objc, objv, objn) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - int objn; +tcldoexcommand( + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + int objn) { tcl_info saveinfo; int err, flag, nobjs; @@ -1271,11 +1281,11 @@ tcldoexcommand(interp, objc, objv, objn) * Do-it-all function for "::vim::option", "$buf option" and "$win option". */ static int -tclsetoption(interp, objc, objv, objn) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - int objn; +tclsetoption( + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + int objn) { int err, nobjs, idx; char_u *option; @@ -1352,11 +1362,11 @@ tclsetoption(interp, objc, objv, objn) * Do-it-all function for "::vim::expr", "$buf expr" and "$win expr". */ static int -tclvimexpr(interp, objc, objv, objn) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - int objn; +tclvimexpr( + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + int objn) { #ifdef FEAT_EVAL char *expr, *str; @@ -1389,8 +1399,7 @@ tclvimexpr(interp, objc, objv, objn) * Check for internal vim errors. */ static int -vimerror(interp) - Tcl_Interp *interp; +vimerror(Tcl_Interp *interp) { if (got_int) { @@ -1414,8 +1423,7 @@ vimerror(interp) * tclsetdelcmd() - add Tcl callback command to a vim object */ static void -delref(cref) - ClientData cref; +delref(ClientData cref) { struct ref *ref = (struct ref *)cref; @@ -1428,13 +1436,13 @@ delref(cref) } static char * -tclgetref(interp, refstartP, prefix, vimobj, proc) - Tcl_Interp *interp; - void **refstartP; /* ptr to w_tcl_ref/b_tcl-ref member of +tclgetref( + Tcl_Interp *interp, + void **refstartP, /* ptr to w_tcl_ref/b_tcl-ref member of win_T/buf_T struct */ - char *prefix; /* "win" or "buf" */ - void *vimobj; /* win_T* or buf_T* */ - Tcl_ObjCmdProc *proc; /* winselfcmd or bufselfcmd */ + char *prefix, /* "win" or "buf" */ + void *vimobj, /* win_T* or buf_T* */ + Tcl_ObjCmdProc *proc) /* winselfcmd or bufselfcmd */ { struct ref *ref, *unused = NULL; static char name[VARNAME_SIZE]; @@ -1488,27 +1496,23 @@ tclgetref(interp, refstartP, prefix, vimobj, proc) } static char * -tclgetwindow(interp, win) - Tcl_Interp *interp; - win_T *win; +tclgetwindow(Tcl_Interp *interp, win_T *win) { return tclgetref(interp, &(win->w_tcl_ref), "win", (void *)win, winselfcmd); } static char * -tclgetbuffer(interp, buf) - Tcl_Interp *interp; - buf_T *buf; +tclgetbuffer(Tcl_Interp *interp, buf_T *buf) { return tclgetref(interp, &(buf->b_tcl_ref), "buf", (void *)buf, bufselfcmd); } static int -tclsetdelcmd(interp, reflist, vimobj, delcmd) - Tcl_Interp *interp; - struct ref *reflist; - void *vimobj; - Tcl_Obj *delcmd; +tclsetdelcmd( + Tcl_Interp *interp, + struct ref *reflist, + void *vimobj, + Tcl_Obj *delcmd) { if (reflist == &refsdeleted) { @@ -1542,9 +1546,7 @@ tclsetdelcmd(interp, reflist, vimobj, delcmd) ********************************************/ static int -channel_close(instance, interp) - ClientData instance; - Tcl_Interp *interp UNUSED; +tcl_channel_close(ClientData instance, Tcl_Interp *interp UNUSED) { int err = 0; @@ -1559,11 +1561,11 @@ channel_close(instance, interp) } static int -channel_input(instance, buf, bufsiz, errptr) - ClientData instance UNUSED; - char *buf UNUSED; - int bufsiz UNUSED; - int *errptr; +tcl_channel_input( + ClientData instance UNUSED, + char *buf UNUSED, + int bufsiz UNUSED, + int *errptr) { /* input is currently not supported */ @@ -1575,11 +1577,11 @@ channel_input(instance, buf, bufsiz, errptr) } static int -channel_output(instance, buf, bufsiz, errptr) - ClientData instance; - char *buf; - int bufsiz; - int *errptr; +tcl_channel_output( + ClientData instance, + const char *buf, + int bufsiz, + int *errptr) { char_u *str; int result; @@ -1615,36 +1617,34 @@ channel_output(instance, buf, bufsiz, errptr) } static void -channel_watch(instance, mask) - ClientData instance UNUSED; - int mask UNUSED; +tcl_channel_watch(ClientData instance UNUSED, int mask UNUSED) { Tcl_SetErrno(EINVAL); } static int -channel_gethandle(instance, direction, handleptr) - ClientData instance UNUSED; - int direction UNUSED; - ClientData *handleptr UNUSED; +tcl_channel_gethandle( + ClientData instance UNUSED, + int direction UNUSED, + ClientData *handleptr UNUSED) { Tcl_SetErrno(EINVAL); return EINVAL; } -static Tcl_ChannelType channel_type = +static Tcl_ChannelType tcl_channel_type = { "vimmessage", /* typeName */ TCL_CHANNEL_VERSION_2, /* version */ - channel_close, /* closeProc */ - channel_input, /* inputProc */ - channel_output, /* outputProc */ + tcl_channel_close, /* closeProc */ + tcl_channel_input, /* inputProc */ + tcl_channel_output, /* outputProc */ NULL, /* seekProc */ NULL, /* setOptionProc */ NULL, /* getOptionProc */ - channel_watch, /* watchProc */ - channel_gethandle, /* getHandleProc */ + tcl_channel_watch, /* watchProc */ + tcl_channel_gethandle, /* getHandleProc */ NULL, /* close2Proc */ NULL, /* blockModeProc */ #ifdef TCL_CHANNEL_VERSION_2 @@ -1669,7 +1669,7 @@ static Tcl_ChannelType channel_type = **********************************/ static void -tclupdatevars() +tclupdatevars(void) { char varname[VARNAME_SIZE]; /* must be writeable */ char *name; @@ -1697,8 +1697,7 @@ tclupdatevars() static int -tclinit(eap) - exarg_T *eap; +tclinit(exarg_T *eap) { char varname[VARNAME_SIZE]; /* Tcl_LinkVar requires writeable varname */ char *name; @@ -1719,8 +1718,8 @@ tclinit(eap) /* Create replacement channels for stdout and stderr; this has to be * done each time an interpreter is created since the channels are closed * when the interpreter is deleted */ - ch1 = Tcl_CreateChannel(&channel_type, "vimout", VIMOUT, TCL_WRITABLE); - ch2 = Tcl_CreateChannel(&channel_type, "vimerr", VIMERR, TCL_WRITABLE); + ch1 = Tcl_CreateChannel(&tcl_channel_type, "vimout", VIMOUT, TCL_WRITABLE); + ch2 = Tcl_CreateChannel(&tcl_channel_type, "vimerr", VIMERR, TCL_WRITABLE); Tcl_SetStdChannel(ch1, TCL_STDOUT); Tcl_SetStdChannel(ch2, TCL_STDERR); @@ -1807,8 +1806,7 @@ tclinit(eap) } static void -tclerrmsg(text) - char *text; +tclerrmsg(char *text) { char *next; @@ -1823,8 +1821,7 @@ tclerrmsg(text) } static void -tclmsg(text) - char *text; +tclmsg(char *text) { char *next; @@ -1839,7 +1836,7 @@ tclmsg(text) } static void -tcldelthisinterp() +tcldelthisinterp(void) { if (!Tcl_InterpDeleted(tclinfo.interp)) Tcl_DeleteInterp(tclinfo.interp); @@ -1861,8 +1858,7 @@ tcldelthisinterp() } static int -tclexit(error) - int error; +tclexit(int error) { int newerr = OK; @@ -1910,8 +1906,7 @@ tclexit(error) * ":tcl" */ void -ex_tcl(eap) - exarg_T *eap; +ex_tcl(exarg_T *eap) { char_u *script; int err; @@ -1937,8 +1932,7 @@ ex_tcl(eap) * ":tclfile" */ void -ex_tclfile(eap) - exarg_T *eap; +ex_tclfile(exarg_T *eap) { char *file = (char *)eap->arg; int err; @@ -1956,8 +1950,7 @@ ex_tclfile(eap) * ":tcldo" */ void -ex_tcldo(eap) - exarg_T *eap; +ex_tcldo(exarg_T *eap) { char *script, *line; int err, rs, re, lnum; @@ -1965,6 +1958,7 @@ ex_tcldo(eap) char var_line[VARNAME_SIZE]; linenr_T first_line = 0; linenr_T last_line = 0; + buf_T *was_curbuf = curbuf; rs = eap->line1; re = eap->line2; @@ -1986,6 +1980,8 @@ ex_tcldo(eap) } while (err == TCL_OK && rs <= re) { + if ((linenr_T)rs > curbuf->b_ml.ml_line_count) + break; line = (char *)ml_get_buf(curbuf, (linenr_T)rs, FALSE); if (!line) { @@ -2001,7 +1997,7 @@ ex_tcldo(eap) #if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8 || Tcl_LimitExceeded(tclinfo.interp) #endif - ) + || curbuf != was_curbuf) break; line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0); if (line) @@ -2032,13 +2028,18 @@ ex_tcldo(eap) } static void -tcldelallrefs(ref) - struct ref *ref; +tcldelallrefs(struct ref *ref) { struct ref *next; int err; char *result; +#ifdef DYNAMIC_TCL + /* TODO: this code currently crashes Vim on exit */ + if (exiting) + return; +#endif + while (ref != NULL) { next = ref->next; @@ -2064,8 +2065,7 @@ tcldelallrefs(ref) } void -tcl_buffer_free(buf) - buf_T *buf; +tcl_buffer_free(buf_T *buf) { struct ref *reflist; @@ -2083,10 +2083,8 @@ tcl_buffer_free(buf) } } -#if defined(FEAT_WINDOWS) || defined(PROTO) void -tcl_window_free(win) - win_T *win; +tcl_window_free(win_T *win) { struct ref *reflist; @@ -2103,6 +2101,5 @@ tcl_window_free(win) win->w_tcl_ref = NULL; } } -#endif /* The End */ diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c index 302912b9c7..526756a838 100644 --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * X command server by Flemming Madsen @@ -168,25 +168,40 @@ struct ServerReply static garray_T serverReply = { 0, 0, 0, 0, 0 }; enum ServerReplyOp { SROP_Find, SROP_Add, SROP_Delete }; -typedef int (*EndCond) __ARGS((void *)); +typedef int (*EndCond)(void *); + +struct x_cmdqueue +{ + char_u *propInfo; + long_u len; + struct x_cmdqueue *next; + struct x_cmdqueue *prev; +}; + +typedef struct x_cmdqueue x_queue_T; + +/* dummy node, header for circular queue */ +static x_queue_T head = {NULL, 0, NULL, NULL}; /* * Forward declarations for procedures defined later in this file: */ -static Window LookupName __ARGS((Display *dpy, char_u *name, int delete, char_u **loose)); -static int SendInit __ARGS((Display *dpy)); -static int DoRegisterName __ARGS((Display *dpy, char_u *name)); -static void DeleteAnyLingerer __ARGS((Display *dpy, Window w)); -static int GetRegProp __ARGS((Display *dpy, char_u **regPropp, long_u *numItemsp, int domsg)); -static int WaitForPend __ARGS((void *p)); -static int WaitForReply __ARGS((void *p)); -static int WindowValid __ARGS((Display *dpy, Window w)); -static void ServerWait __ARGS((Display *dpy, Window w, EndCond endCond, void *endData, int localLoop, int seconds)); -static struct ServerReply *ServerReplyFind __ARGS((Window w, enum ServerReplyOp op)); -static int AppendPropCarefully __ARGS((Display *display, Window window, Atom property, char_u *value, int length)); -static int x_error_check __ARGS((Display *dpy, XErrorEvent *error_event)); -static int IsSerialName __ARGS((char_u *name)); +static Window LookupName(Display *dpy, char_u *name, int delete, char_u **loose); +static int SendInit(Display *dpy); +static int DoRegisterName(Display *dpy, char_u *name); +static void DeleteAnyLingerer(Display *dpy, Window w); +static int GetRegProp(Display *dpy, char_u **regPropp, long_u *numItemsp, int domsg); +static int WaitForPend(void *p); +static int WaitForReply(void *p); +static int WindowValid(Display *dpy, Window w); +static void ServerWait(Display *dpy, Window w, EndCond endCond, void *endData, int localLoop, int seconds); +static struct ServerReply *ServerReplyFind(Window w, enum ServerReplyOp op); +static int AppendPropCarefully(Display *display, Window window, Atom property, char_u *value, int length); +static int x_error_check(Display *dpy, XErrorEvent *error_event); +static int IsSerialName(char_u *name); +static void save_in_queue(char_u *buf, long_u len); +static void server_parse_message(Display *dpy, char_u *propInfo, long_u numItems); /* Private variables for the "server" functionality */ static Atom registryProperty = None; @@ -200,9 +215,9 @@ static char_u *empty_prop = (char_u *)""; /* empty GetRegProp() result */ * Returns FAIL or OK. */ int -serverRegisterName(dpy, name) - Display *dpy; /* display to register with */ - char_u *name; /* the name that will be used as a base */ +serverRegisterName( + Display *dpy, /* display to register with */ + char_u *name) /* the name that will be used as a base */ { int i; int res; @@ -217,7 +232,7 @@ serverRegisterName(dpy, name) if (res < -1 || i >= 1000) { MSG_ATTR(_("Unable to register a command server name"), - hl_attr(HLF_W)); + HL_ATTR(HLF_W)); return FAIL; } if (p == NULL) @@ -238,9 +253,7 @@ serverRegisterName(dpy, name) } static int -DoRegisterName(dpy, name) - Display *dpy; - char_u *name; +DoRegisterName(Display *dpy, char_u *name) { Window w; XErrorHandler old_handler; @@ -318,9 +331,9 @@ DoRegisterName(dpy, name) * Change any registered window ID. */ void -serverChangeRegisteredWindow(dpy, newwin) - Display *dpy; /* Display to register with */ - Window newwin; /* Re-register to this ID */ +serverChangeRegisteredWindow( + Display *dpy, /* Display to register with */ + Window newwin) /* Re-register to this ID */ { char_u propInfo[MAX_NAME_LENGTH + 20]; @@ -354,15 +367,16 @@ serverChangeRegisteredWindow(dpy, newwin) * Returns 0 for OK, negative for an error. */ int -serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) - Display *dpy; /* Where to send. */ - char_u *name; /* Where to send. */ - char_u *cmd; /* What to send. */ - char_u **result; /* Result of eval'ed expression */ - Window *server; /* Actual ID of receiving app */ - Bool asExpr; /* Interpret as keystrokes or expr ? */ - Bool localLoop; /* Throw away everything but result */ - int silent; /* don't complain about no server */ +serverSendToVim( + Display *dpy, /* Where to send. */ + char_u *name, /* Where to send. */ + char_u *cmd, /* What to send. */ + char_u **result, /* Result of eval'ed expression */ + Window *server, /* Actual ID of receiving app */ + Bool asExpr, /* Interpret as keystrokes or expr ? */ + int timeout, /* seconds to wait or zero */ + Bool localLoop, /* Throw away everything but result */ + int silent) /* don't complain about no server */ { Window w; char_u *property; @@ -387,27 +401,7 @@ serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) /* Execute locally if no display or target is ourselves */ if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0)) - { - if (asExpr) - { - char_u *ret; - - ret = eval_client_expr_to_string(cmd); - if (result != NULL) - { - if (ret == NULL) - *result = vim_strsave((char_u *)_(e_invexprmsg)); - else - *result = ret; - } - else - vim_free(ret); - return ret == NULL ? -1 : 0; - } - else - server_to_input_buf(cmd); - return 0; - } + return sendToLocalVim(cmd, asExpr, result); /* * Bind the server name to a communication window. @@ -427,6 +421,7 @@ serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) { LookupName(dpy, loosename ? loosename : name, /*DELETE=*/TRUE, NULL); + vim_free(loosename); continue; } } @@ -493,7 +488,8 @@ serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) pending.nextPtr = pendingCommands; pendingCommands = &pending; - ServerWait(dpy, w, WaitForPend, &pending, localLoop, 600); + ServerWait(dpy, w, WaitForPend, &pending, localLoop, + timeout > 0 ? timeout : 600); /* * Unregister the information about the pending command @@ -521,8 +517,7 @@ serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) } static int -WaitForPend(p) - void *p; +WaitForPend(void *p) { PendingCommand *pending = (PendingCommand *) p; return pending->result != NULL; @@ -532,9 +527,7 @@ WaitForPend(p) * Return TRUE if window "w" exists and has a "Vim" property on it. */ static int -WindowValid(dpy, w) - Display *dpy; - Window w; +WindowValid(Display *dpy, Window w) { XErrorHandler old_handler; Atom *plist; @@ -563,13 +556,13 @@ WindowValid(dpy, w) * Enter a loop processing X events & polling chars until we see a result */ static void -ServerWait(dpy, w, endCond, endData, localLoop, seconds) - Display *dpy; - Window w; - EndCond endCond; - void *endData; - int localLoop; - int seconds; +ServerWait( + Display *dpy, + Window w, + EndCond endCond, + void *endData, + int localLoop, + int seconds) { time_t start; time_t now; @@ -596,7 +589,8 @@ ServerWait(dpy, w, endCond, endData, localLoop, seconds) while (TRUE) { while (XCheckWindowEvent(dpy, commWindow, PropertyChangeMask, &event)) - serverEventProc(dpy, &event); + serverEventProc(dpy, &event, 1); + server_parse_messages(); if (endCond(endData) != 0) break; @@ -606,6 +600,10 @@ ServerWait(dpy, w, endCond, endData, localLoop, seconds) if (seconds >= 0 && (now - start) >= seconds) break; +#ifdef FEAT_TIMERS + check_due_timer(); +#endif + /* Just look out for the answer without calling back into Vim */ if (localLoop) { @@ -635,8 +633,7 @@ ServerWait(dpy, w, endCond, endData, localLoop, seconds) * Returns a newline separated list in allocated memory or NULL. */ char_u * -serverGetVimNames(dpy) - Display *dpy; +serverGetVimNames(Display *dpy) { char_u *regProp; char_u *entry; @@ -690,9 +687,7 @@ serverGetVimNames(dpy) */ static struct ServerReply * -ServerReplyFind(w, op) - Window w; - enum ServerReplyOp op; +ServerReplyFind(Window w, enum ServerReplyOp op) { struct ServerReply *p; struct ServerReply e; @@ -734,8 +729,7 @@ ServerReplyFind(w, op) * Issue an error if the id is invalid. */ Window -serverStrToWin(str) - char_u *str; +serverStrToWin(char_u *str) { unsigned id = None; @@ -751,9 +745,7 @@ serverStrToWin(str) * Return -1 if the window is invalid. */ int -serverSendReply(name, str) - char_u *name; - char_u *str; +serverSendReply(char_u *name, char_u *str) { char_u *property; int length; @@ -793,30 +785,33 @@ serverSendReply(name, str) } static int -WaitForReply(p) - void *p; +WaitForReply(void *p) { Window *w = (Window *) p; + return ServerReplyFind(*w, SROP_Find) != NULL; } /* * Wait for replies from id (win) + * When "timeout" is non-zero wait up to this many seconds. * Return 0 and the malloc'ed string when a reply is available. * Return -1 if the window becomes invalid while waiting. */ int -serverReadReply(dpy, win, str, localLoop) - Display *dpy; - Window win; - char_u **str; - int localLoop; +serverReadReply( + Display *dpy, + Window win, + char_u **str, + int localLoop, + int timeout) { int len; char_u *s; struct ServerReply *p; - ServerWait(dpy, win, WaitForReply, &win, localLoop, -1); + ServerWait(dpy, win, WaitForReply, &win, localLoop, + timeout > 0 ? timeout : -1); if ((p = ServerReplyFind(win, SROP_Find)) != NULL && p->strings.ga_len > 0) { @@ -844,10 +839,7 @@ serverReadReply(dpy, win, str, localLoop) * Return TRUE and a non-malloc'ed string if there is. Else return FALSE. */ int -serverPeekReply(dpy, win, str) - Display *dpy; - Window win; - char_u **str; +serverPeekReply(Display *dpy, Window win, char_u **str) { struct ServerReply *p; @@ -868,8 +860,7 @@ serverPeekReply(dpy, win, str) * results. */ static int -SendInit(dpy) - Display *dpy; +SendInit(Display *dpy) { XErrorHandler old_handler; @@ -925,11 +916,11 @@ SendInit(dpy) * removed from the registry property. */ static Window -LookupName(dpy, name, delete, loose) - Display *dpy; /* Display whose registry to check. */ - char_u *name; /* Name of a server. */ - int delete; /* If non-zero, delete info about name. */ - char_u **loose; /* Do another search matching -999 if not found +LookupName( + Display *dpy, /* Display whose registry to check. */ + char_u *name, /* Name of a server. */ + int delete, /* If non-zero, delete info about name. */ + char_u **loose) /* Do another search matching -999 if not found Return result here if a match is found */ { char_u *regProp, *entry; @@ -1019,9 +1010,9 @@ LookupName(dpy, name, delete, loose) * 3. The window will mistakenly be regarded valid because of own commWindow */ static void -DeleteAnyLingerer(dpy, win) - Display *dpy; /* Display whose registry to check. */ - Window win; /* Window to remove */ +DeleteAnyLingerer( + Display *dpy, /* Display whose registry to check. */ + Window win) /* Window to remove */ { char_u *regProp, *entry = NULL; char_u *p; @@ -1081,11 +1072,11 @@ DeleteAnyLingerer(dpy, win) * Return OK when successful. */ static int -GetRegProp(dpy, regPropp, numItemsp, domsg) - Display *dpy; - char_u **regPropp; - long_u *numItemsp; - int domsg; /* When TRUE give error message. */ +GetRegProp( + Display *dpy, + char_u **regPropp, + long_u *numItemsp, + int domsg) /* When TRUE give error message. */ { int result, actualFormat; long_u bytesAfter; @@ -1128,22 +1119,25 @@ GetRegProp(dpy, regPropp, numItemsp, domsg) return OK; } + /* * This procedure is invoked by the various X event loops throughout Vims when * a property changes on the communication window. This procedure reads the - * property and handles command requests and responses. + * property and enqueues command requests and responses. If immediate is true, + * it runs the event immediately instead of enqueuing it. Immediate can cause + * unintended behavior and should only be used for code that blocks for a + * response. */ void -serverEventProc(dpy, eventPtr) - Display *dpy; - XEvent *eventPtr; /* Information about event. */ +serverEventProc( + Display *dpy, + XEvent *eventPtr, /* Information about event. */ + int immediate) /* Run event immediately. Should mostly be 0. */ { char_u *propInfo; - char_u *p; - int result, actualFormat, code; + int result, actualFormat; long_u numItems, bytesAfter; Atom actualType; - char_u *tofree; if (eventPtr != NULL) { @@ -1169,6 +1163,84 @@ serverEventProc(dpy, eventPtr) XFree(propInfo); return; } + if (immediate) + server_parse_message(dpy, propInfo, numItems); + else + save_in_queue(propInfo, numItems); +} + +/* + * Saves x clientserver commands in a queue so that they can be called when + * vim is idle. + */ + static void +save_in_queue(char_u *propInfo, long_u len) +{ + x_queue_T *node; + + node = (x_queue_T *)alloc(sizeof(x_queue_T)); + if (node == NULL) + return; /* out of memory */ + node->propInfo = propInfo; + node->len = len; + + if (head.next == NULL) /* initialize circular queue */ + { + head.next = &head; + head.prev = &head; + } + + /* insert node at tail of queue */ + node->next = &head; + node->prev = head.prev; + head.prev->next = node; + head.prev = node; +} + +/* + * Parses queued clientserver messages. + */ + void +server_parse_messages(void) +{ + x_queue_T *node; + + if (!X_DISPLAY) + return; /* cannot happen? */ + while (head.next != NULL && head.next != &head) + { + node = head.next; + head.next = node->next; + node->next->prev = node->prev; + server_parse_message(X_DISPLAY, node->propInfo, node->len); + vim_free(node); + } +} + +/* + * Returns a non-zero value if there are clientserver messages waiting + * int the queue. + */ + int +server_waiting(void) +{ + return head.next != NULL && head.next != &head; +} + +/* + * Prases a single clientserver message. A single message may contain multiple + * commands. + * "propInfo" will be freed. + */ + static void +server_parse_message( + Display *dpy, + char_u *propInfo, /* A string containing 0 or more X commands */ + long_u numItems) /* The size of propInfo in bytes. */ +{ + char_u *p; + int code; + char_u *tofree; /* * Several commands and results could arrive in the property at @@ -1249,16 +1321,16 @@ serverEventProc(dpy, eventPtr) if (script == NULL || name == NULL) continue; - if (serverName != NULL && STRICMP(name, serverName) == 0) - { - script = serverConvert(enc, script, &tofree); - if (asKeys) - server_to_input_buf(script); - else - { - char_u *res; + if (serverName != NULL && STRICMP(name, serverName) == 0) + { + script = serverConvert(enc, script, &tofree); + if (asKeys) + server_to_input_buf(script); + else + { + char_u *res; - res = eval_client_expr_to_string(script); + res = eval_client_expr_to_string(script); if (resWindow != None) { garray_T reply; @@ -1266,12 +1338,12 @@ serverEventProc(dpy, eventPtr) /* Initialize the result property. */ ga_init2(&reply, 1, 100); #ifdef FEAT_MBYTE - ga_grow(&reply, 50 + STRLEN(p_enc)); + (void)ga_grow(&reply, 50 + STRLEN(p_enc)); sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ", 0, 0, p_enc, 0, serial, 0); reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial); #else - ga_grow(&reply, 50); + (void)ga_grow(&reply, 50); sprintf(reply.ga_data, "%cr%c-s %s%c-r ", 0, 0, serial, 0); reply.ga_len = 10 + STRLEN(serial); @@ -1291,10 +1363,10 @@ serverEventProc(dpy, eventPtr) reply.ga_data, reply.ga_len); ga_clear(&reply); } - vim_free(res); - } - vim_free(tofree); - } + vim_free(res); + } + vim_free(tofree); + } } else if (*p == 'r' && p[1] == 0) { @@ -1352,15 +1424,10 @@ serverEventProc(dpy, eventPtr) continue; pcPtr->code = code; - if (res != NULL) - { - res = serverConvert(enc, res, &tofree); - if (tofree == NULL) - res = vim_strsave(res); - pcPtr->result = res; - } - else - pcPtr->result = vim_strsave((char_u *)""); + res = serverConvert(enc, res, &tofree); + if (tofree == NULL) + res = vim_strsave(res); + pcPtr->result = res; break; } } @@ -1374,8 +1441,8 @@ serverEventProc(dpy, eventPtr) char_u *enc; /* - * This is a (n)otification. Sent with serverreply_send in VimL. - * Execute any autocommand and save it for later retrieval + * This is a (n)otification. Sent with serverreply_send in Vim + * script. Execute any autocommand and save it for later retrieval */ p += 2; gotWindow = 0; @@ -1414,14 +1481,12 @@ serverEventProc(dpy, eventPtr) ga_concat(&(r->strings), str); ga_append(&(r->strings), NUL); } -#ifdef FEAT_AUTOCMD { char_u winstr[30]; sprintf((char *)winstr, "0x%x", (unsigned int)win); apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } -#endif vim_free(tofree); } else @@ -1447,12 +1512,12 @@ serverEventProc(dpy, eventPtr) * Return: 0 for OK, -1 for error */ static int -AppendPropCarefully(dpy, window, property, value, length) - Display *dpy; /* Display on which to operate. */ - Window window; /* Window whose property is to be modified. */ - Atom property; /* Name of property. */ - char_u *value; /* Characters to append to property. */ - int length; /* How much to append */ +AppendPropCarefully( + Display *dpy, /* Display on which to operate. */ + Window window, /* Window whose property is to be modified. */ + Atom property, /* Name of property. */ + char_u *value, /* Characters to append to property. */ + int length) /* How much to append */ { XErrorHandler old_handler; @@ -1470,9 +1535,7 @@ AppendPropCarefully(dpy, window, property, value, length) * Another X Error handler, just used to check for errors. */ static int -x_error_check(dpy, error_event) - Display *dpy UNUSED; - XErrorEvent *error_event UNUSED; +x_error_check(Display *dpy UNUSED, XErrorEvent *error_event UNUSED) { got_x_error = TRUE; return 0; @@ -1483,8 +1546,7 @@ x_error_check(dpy, error_event) * Actually just checks if the name ends in a digit. */ static int -IsSerialName(str) - char_u *str; +IsSerialName(char_u *str) { int len = STRLEN(str); diff --git a/src/install-sh b/src/install-sh new file mode 100644 index 0000000000..0b0fdcbba6 --- /dev/null +++ b/src/install-sh @@ -0,0 +1,501 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2013-12-25.23; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/installman.sh b/src/installman.sh index 0ac6c46a14..a2f09ad35e 100755 --- a/src/installman.sh +++ b/src/installman.sh @@ -39,7 +39,7 @@ tutorsubloc=$scriptloc/tutor if test $what = "install" -o $what = "xxd"; then if test ! -d $destdir; then echo creating $destdir - ./mkinstalldirs $destdir + /bin/sh install-sh -c -d $destdir fi fi diff --git a/src/installml.sh b/src/installml.sh index e6dc3d8f32..8649c6ff56 100644 --- a/src/installml.sh +++ b/src/installml.sh @@ -49,7 +49,7 @@ eviewname=$9 if test $what = "install" -a \( -f $destdir/$vimname.1 -o -f $destdir/$vimdiffname.1 -o -f $destdir/$eviewname.1 \); then if test ! -d $destdir; then echo creating $destdir - ./mkinstalldirs $destdir + /bin/sh install-sh -c -d $destdir fi # ex diff --git a/src/integration.c b/src/integration.c index 3f38c55e5b..064ff05fd3 100644 --- a/src/integration.c +++ b/src/integration.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sw=8: +/* vi:set ts=8 sw=8 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -620,8 +620,8 @@ adjust_sign_name(char *filename) if you want to do things differently if the editor is started standalone or in WorkShop mode. For example, in standalone mode you may not want to add a footer/message area or a sign gutter. */ -int -workshop_invoked() + int +workshop_invoked(void) { static int result = -1; if (result == -1) { @@ -735,7 +735,7 @@ void workshop_connect(XtAppContext context) dummy = write(sd, buf, strlen(buf)); } -void workshop_disconnect() +void workshop_disconnect(void) { /* Probably need to send some message here */ @@ -805,7 +805,7 @@ widgetIsIconified( if (XtWindow(w) != 0) { /* only check if window exists! */ XGetWindowProperty(XtDisplay(w), XtWindow(w), wm_state, 0L, 2L, False, AnyPropertyType, &act_type, &act_fmt, &nitems_ret, - &bytes_after, (u_char **) &property); + &bytes_after, (char_u **) &property); if (nitems_ret == 2 && property[0] == IconicState) { return True; } @@ -1077,7 +1077,7 @@ void workshop_perform_verb(char *verb, void *clientData) } /* Send a message to eserve */ -#if defined(NOHANDS_SUPPORT_FUNCTIONS) || defined(FEAT_BEVAL) +#if defined(NOHANDS_SUPPORT_FUNCTIONS) || defined(FEAT_BEVAL_GUI) void workshop_send_message(char *buf) { dummy = write(sd, buf, strlen(buf)); diff --git a/src/integration.h b/src/integration.h index 65daea77d4..817b683f65 100644 --- a/src/integration.h +++ b/src/integration.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur diff --git a/src/iscygpty.c b/src/iscygpty.c new file mode 100644 index 0000000000..b018a1de62 --- /dev/null +++ b/src/iscygpty.c @@ -0,0 +1,183 @@ +/* + * iscygpty.c -- part of ptycheck + * https://github.com/k-takata/ptycheck + * + * Copyright (c) 2015-2017 K.Takata + * + * You can redistribute it and/or modify it under the terms of either + * the MIT license (as described below) or the Vim license. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef _WIN32 + +#include <ctype.h> +#include <io.h> +#include <wchar.h> +#include <windows.h> + +#ifdef USE_FILEEXTD +/* VC 7.1 or earlier doesn't support SAL. */ +# if !defined(_MSC_VER) || (_MSC_VER < 1400) +# define __out +# define __in +# define __in_opt +# endif +/* Win32 FileID API Library: + * http://www.microsoft.com/en-us/download/details.aspx?id=22599 + * Needed for WinXP. */ +# include <fileextd.h> +#else /* USE_FILEEXTD */ +/* VC 8 or earlier. */ +# if defined(_MSC_VER) && (_MSC_VER < 1500) +# ifdef ENABLE_STUB_IMPL +# define STUB_IMPL +# else +# error "Win32 FileID API Library is required for VC2005 or earlier." +# endif +# endif +#endif /* USE_FILEEXTD */ + + +#include "iscygpty.h" + +//#define USE_DYNFILEID +#ifdef USE_DYNFILEID +typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize); +static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; + +# ifndef USE_FILEEXTD +static BOOL WINAPI stub_GetFileInformationByHandleEx( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize) +{ + return FALSE; +} +# endif + +static void setup_fileid_api(void) +{ + if (pGetFileInformationByHandleEx != NULL) { + return; + } + pGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx) + GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), + "GetFileInformationByHandleEx"); + if (pGetFileInformationByHandleEx == NULL) { +# ifdef USE_FILEEXTD + pGetFileInformationByHandleEx = GetFileInformationByHandleEx; +# else + pGetFileInformationByHandleEx = stub_GetFileInformationByHandleEx; +# endif + } +} +#else +# define pGetFileInformationByHandleEx GetFileInformationByHandleEx +# define setup_fileid_api() +#endif + + +#define is_wprefix(s, prefix) \ + (wcsncmp((s), (prefix), sizeof(prefix) / sizeof(WCHAR) - 1) == 0) + +/* Check if the fd is a cygwin/msys's pty. */ +int is_cygpty(int fd) +{ +#ifdef STUB_IMPL + return 0; +#else + HANDLE h; + int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); + FILE_NAME_INFO *nameinfo; + WCHAR *p = NULL; + + setup_fileid_api(); + + h = (HANDLE) _get_osfhandle(fd); + if (h == INVALID_HANDLE_VALUE) { + return 0; + } + /* Cygwin/msys's pty is a pipe. */ + if (GetFileType(h) != FILE_TYPE_PIPE) { + return 0; + } + nameinfo = malloc(size + sizeof(WCHAR)); + if (nameinfo == NULL) { + return 0; + } + /* Check the name of the pipe: + * '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' */ + if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) { + nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0'; + p = nameinfo->FileName; + if (is_wprefix(p, L"\\cygwin-")) { /* Cygwin */ + p += 8; + } else if (is_wprefix(p, L"\\msys-")) { /* MSYS and MSYS2 */ + p += 6; + } else { + p = NULL; + } + if (p != NULL) { + while (*p && isxdigit(*p)) /* Skip 16-digit hexadecimal. */ + ++p; + if (is_wprefix(p, L"-pty")) { + p += 4; + } else { + p = NULL; + } + } + if (p != NULL) { + while (*p && isdigit(*p)) /* Skip pty number. */ + ++p; + if (is_wprefix(p, L"-from-master")) { + //p += 12; + } else if (is_wprefix(p, L"-to-master")) { + //p += 10; + } else { + p = NULL; + } + } + } + free(nameinfo); + return (p != NULL); +#endif /* STUB_IMPL */ +} + +/* Check if at least one cygwin/msys pty is used. */ +int is_cygpty_used(void) +{ + int fd, ret = 0; + + for (fd = 0; fd < 3; fd++) { + ret |= is_cygpty(fd); + } + return ret; +} + +#endif /* _WIN32 */ + +/* vim: set ts=4 sw=4: */ diff --git a/src/iscygpty.h b/src/iscygpty.h new file mode 100644 index 0000000000..82fd0affbd --- /dev/null +++ b/src/iscygpty.h @@ -0,0 +1,41 @@ +/* + * iscygpty.h -- part of ptycheck + * https://github.com/k-takata/ptycheck + * + * Copyright (c) 2015-2017 K.Takata + * + * You can redistribute it and/or modify it under the terms of either + * the MIT license (as described below) or the Vim license. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _ISCYGPTY_H +#define _ISCYGPTY_H + +#ifdef _WIN32 +int is_cygpty(int fd); +int is_cygpty_used(void); +#else +#define is_cygpty(fd) 0 +#define is_cygpty_used() 0 +#endif + +#endif /* _ISCYGPTY_H */ diff --git a/src/json.c b/src/json.c new file mode 100644 index 0000000000..cc756488d8 --- /dev/null +++ b/src/json.c @@ -0,0 +1,1092 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * json.c: Encoding and decoding JSON. + * + * Follows this standard: https://tools.ietf.org/html/rfc7159.html + */ +#define USING_FLOAT_STUFF + +#include "vim.h" + +#if defined(FEAT_EVAL) || defined(PROTO) + +static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options); +static int json_decode_item(js_read_T *reader, typval_T *res, int options); + +/* + * Encode "val" into a JSON format string. + * The result is added to "gap" + * Returns FAIL on failure and makes gap->ga_data empty. + */ + static int +json_encode_gap(garray_T *gap, typval_T *val, int options) +{ + if (json_encode_item(gap, val, get_copyID(), options) == FAIL) + { + ga_clear(gap); + gap->ga_data = vim_strsave((char_u *)""); + return FAIL; + } + return OK; +} + +/* + * Encode "val" into a JSON format string. + * The result is in allocated memory. + * The result is empty when encoding fails. + * "options" can contain JSON_JS, JSON_NO_NONE and JSON_NL. + */ + char_u * +json_encode(typval_T *val, int options) +{ + garray_T ga; + + /* Store bytes in the growarray. */ + ga_init2(&ga, 1, 4000); + json_encode_gap(&ga, val, options); + return ga.ga_data; +} + +/* + * Encode ["nr", "val"] into a JSON format string in allocated memory. + * "options" can contain JSON_JS, JSON_NO_NONE and JSON_NL. + * Returns NULL when out of memory. + */ + char_u * +json_encode_nr_expr(int nr, typval_T *val, int options) +{ + typval_T listtv; + typval_T nrtv; + garray_T ga; + + nrtv.v_type = VAR_NUMBER; + nrtv.vval.v_number = nr; + if (rettv_list_alloc(&listtv) == FAIL) + return NULL; + if (list_append_tv(listtv.vval.v_list, &nrtv) == FAIL + || list_append_tv(listtv.vval.v_list, val) == FAIL) + { + list_unref(listtv.vval.v_list); + return NULL; + } + + ga_init2(&ga, 1, 4000); + if (json_encode_gap(&ga, &listtv, options) == OK && (options & JSON_NL)) + ga_append(&ga, '\n'); + list_unref(listtv.vval.v_list); + return ga.ga_data; +} + + static void +write_string(garray_T *gap, char_u *str) +{ + char_u *res = str; + char_u numbuf[NUMBUFLEN]; + + if (res == NULL) + ga_concat(gap, (char_u *)"\"\""); + else + { +#if defined(FEAT_MBYTE) && defined(USE_ICONV) + vimconv_T conv; + char_u *converted = NULL; + + if (!enc_utf8) + { + /* Convert the text from 'encoding' to utf-8, the JSON string is + * always utf-8. */ + conv.vc_type = CONV_NONE; + convert_setup(&conv, p_enc, (char_u*)"utf-8"); + if (conv.vc_type != CONV_NONE) + converted = res = string_convert(&conv, res, NULL); + convert_setup(&conv, NULL, NULL); + } +#endif + ga_append(gap, '"'); + while (*res != NUL) + { + int c; +#ifdef FEAT_MBYTE + /* always use utf-8 encoding, ignore 'encoding' */ + c = utf_ptr2char(res); +#else + c = *res; +#endif + + switch (c) + { + case 0x08: + ga_append(gap, '\\'); ga_append(gap, 'b'); break; + case 0x09: + ga_append(gap, '\\'); ga_append(gap, 't'); break; + case 0x0a: + ga_append(gap, '\\'); ga_append(gap, 'n'); break; + case 0x0c: + ga_append(gap, '\\'); ga_append(gap, 'f'); break; + case 0x0d: + ga_append(gap, '\\'); ga_append(gap, 'r'); break; + case 0x22: /* " */ + case 0x5c: /* \ */ + ga_append(gap, '\\'); + ga_append(gap, c); + break; + default: + if (c >= 0x20) + { +#ifdef FEAT_MBYTE + numbuf[utf_char2bytes(c, numbuf)] = NUL; +#else + numbuf[0] = c; + numbuf[1] = NUL; +#endif + ga_concat(gap, numbuf); + } + else + { + vim_snprintf((char *)numbuf, NUMBUFLEN, + "\\u%04lx", (long)c); + ga_concat(gap, numbuf); + } + } +#ifdef FEAT_MBYTE + res += utf_ptr2len(res); +#else + ++res; +#endif + } + ga_append(gap, '"'); +#if defined(FEAT_MBYTE) && defined(USE_ICONV) + vim_free(converted); +#endif + } +} + +/* + * Return TRUE if "key" can be used without quotes. + * That is when it starts with a letter and only contains letters, digits and + * underscore. + */ + static int +is_simple_key(char_u *key) +{ + char_u *p; + + if (!ASCII_ISALPHA(*key)) + return FALSE; + for (p = key + 1; *p != NUL; ++p) + if (!ASCII_ISALPHA(*p) && *p != '_' && !vim_isdigit(*p)) + return FALSE; + return TRUE; +} + +/* + * Encode "val" into "gap". + * Return FAIL or OK. + */ + static int +json_encode_item(garray_T *gap, typval_T *val, int copyID, int options) +{ + char_u numbuf[NUMBUFLEN]; + char_u *res; + list_T *l; + dict_T *d; + + switch (val->v_type) + { + case VAR_SPECIAL: + switch (val->vval.v_number) + { + case VVAL_FALSE: ga_concat(gap, (char_u *)"false"); break; + case VVAL_TRUE: ga_concat(gap, (char_u *)"true"); break; + case VVAL_NONE: if ((options & JSON_JS) != 0 + && (options & JSON_NO_NONE) == 0) + /* empty item */ + break; + /* FALLTHROUGH */ + case VVAL_NULL: ga_concat(gap, (char_u *)"null"); break; + } + break; + + case VAR_NUMBER: + vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld", + (long long)val->vval.v_number); + ga_concat(gap, numbuf); + break; + + case VAR_STRING: + res = val->vval.v_string; + write_string(gap, res); + break; + + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_JOB: + case VAR_CHANNEL: + /* no JSON equivalent TODO: better error */ + EMSG(_(e_invarg)); + return FAIL; + + case VAR_LIST: + l = val->vval.v_list; + if (l == NULL) + ga_concat(gap, (char_u *)"[]"); + else + { + if (l->lv_copyID == copyID) + ga_concat(gap, (char_u *)"[]"); + else + { + listitem_T *li; + + l->lv_copyID = copyID; + ga_append(gap, '['); + for (li = l->lv_first; li != NULL && !got_int; ) + { + if (json_encode_item(gap, &li->li_tv, copyID, + options & JSON_JS) == FAIL) + return FAIL; + if ((options & JSON_JS) + && li->li_next == NULL + && li->li_tv.v_type == VAR_SPECIAL + && li->li_tv.vval.v_number == VVAL_NONE) + /* add an extra comma if the last item is v:none */ + ga_append(gap, ','); + li = li->li_next; + if (li != NULL) + ga_append(gap, ','); + } + ga_append(gap, ']'); + l->lv_copyID = 0; + } + } + break; + + case VAR_DICT: + d = val->vval.v_dict; + if (d == NULL) + ga_concat(gap, (char_u *)"{}"); + else + { + if (d->dv_copyID == copyID) + ga_concat(gap, (char_u *)"{}"); + else + { + int first = TRUE; + int todo = (int)d->dv_hashtab.ht_used; + hashitem_T *hi; + + d->dv_copyID = copyID; + ga_append(gap, '{'); + + for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; + ++hi) + if (!HASHITEM_EMPTY(hi)) + { + --todo; + if (first) + first = FALSE; + else + ga_append(gap, ','); + if ((options & JSON_JS) + && is_simple_key(hi->hi_key)) + ga_concat(gap, hi->hi_key); + else + write_string(gap, hi->hi_key); + ga_append(gap, ':'); + if (json_encode_item(gap, &dict_lookup(hi)->di_tv, + copyID, options | JSON_NO_NONE) == FAIL) + return FAIL; + } + ga_append(gap, '}'); + d->dv_copyID = 0; + } + } + break; + + case VAR_FLOAT: +#ifdef FEAT_FLOAT +# if defined(HAVE_MATH_H) + if (isnan(val->vval.v_float)) + ga_concat(gap, (char_u *)"NaN"); + else if (isinf(val->vval.v_float)) + ga_concat(gap, (char_u *)"Infinity"); + else +# endif + { + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", + val->vval.v_float); + ga_concat(gap, numbuf); + } + break; +#endif + case VAR_UNKNOWN: + internal_error("json_encode_item()"); + return FAIL; + } + return OK; +} + +/* + * When "reader" has less than NUMBUFLEN bytes available, call the fill + * callback to get more. + */ + static void +fill_numbuflen(js_read_T *reader) +{ + if (reader->js_fill != NULL && (int)(reader->js_end - reader->js_buf) + - reader->js_used < NUMBUFLEN) + { + if (reader->js_fill(reader)) + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + } +} + +/* + * Skip white space in "reader". All characters <= space are considered white + * space. + * Also tops up readahead when needed. + */ + static void +json_skip_white(js_read_T *reader) +{ + int c; + + for (;;) + { + c = reader->js_buf[reader->js_used]; + if (reader->js_fill != NULL && c == NUL) + { + if (reader->js_fill(reader)) + { + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + continue; + } + } + if (c == NUL || c > ' ') + break; + ++reader->js_used; + } + fill_numbuflen(reader); +} + + static int +json_decode_string(js_read_T *reader, typval_T *res, int quote) +{ + garray_T ga; + int len; + char_u *p; + int c; + varnumber_T nr; + + if (res != NULL) + ga_init2(&ga, 1, 200); + + p = reader->js_buf + reader->js_used + 1; /* skip over " or ' */ + while (*p != quote) + { + /* The JSON is always expected to be utf-8, thus use utf functions + * here. The string is converted below if needed. */ + if (*p == NUL || p[1] == NUL +#ifdef FEAT_MBYTE + || utf_ptr2len(p) < utf_byte2len(*p) +#endif + ) + { + /* Not enough bytes to make a character or end of the string. Get + * more if possible. */ + if (reader->js_fill == NULL) + break; + len = (int)(reader->js_end - p); + reader->js_used = (int)(p - reader->js_buf); + if (!reader->js_fill(reader)) + break; /* didn't get more */ + p = reader->js_buf + reader->js_used; + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + continue; + } + + if (*p == '\\') + { + c = -1; + switch (p[1]) + { + case '\\': c = '\\'; break; + case '"': c = '"'; break; + case 'b': c = BS; break; + case 't': c = TAB; break; + case 'n': c = NL; break; + case 'f': c = FF; break; + case 'r': c = CAR; break; + case 'u': + if (reader->js_fill != NULL + && (int)(reader->js_end - p) < NUMBUFLEN) + { + reader->js_used = (int)(p - reader->js_buf); + if (reader->js_fill(reader)) + { + p = reader->js_buf + reader->js_used; + reader->js_end = reader->js_buf + + STRLEN(reader->js_buf); + } + } + nr = 0; + len = 0; + vim_str2nr(p + 2, NULL, &len, + STR2NR_HEX + STR2NR_FORCE, &nr, NULL, 4); + p += len + 2; + if (0xd800 <= nr && nr <= 0xdfff + && (int)(reader->js_end - p) >= 6 + && *p == '\\' && *(p+1) == 'u') + { + varnumber_T nr2 = 0; + + /* decode surrogate pair: \ud812\u3456 */ + len = 0; + vim_str2nr(p + 2, NULL, &len, + STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4); + if (0xdc00 <= nr2 && nr2 <= 0xdfff) + { + p += len + 2; + nr = (((nr - 0xd800) << 10) | + ((nr2 - 0xdc00) & 0x3ff)) + 0x10000; + } + } + if (res != NULL) + { +#ifdef FEAT_MBYTE + char_u buf[NUMBUFLEN]; + buf[utf_char2bytes((int)nr, buf)] = NUL; + ga_concat(&ga, buf); +#else + ga_append(&ga, (int)nr); +#endif + } + break; + default: + /* not a special char, skip over \ */ + ++p; + continue; + } + if (c > 0) + { + p += 2; + if (res != NULL) + ga_append(&ga, c); + } + } + else + { +#ifdef FEAT_MBYTE + len = utf_ptr2len(p); +#else + len = 1; +#endif + if (res != NULL) + { + if (ga_grow(&ga, len) == FAIL) + { + ga_clear(&ga); + return FAIL; + } + mch_memmove((char *)ga.ga_data + ga.ga_len, p, (size_t)len); + ga.ga_len += len; + } + p += len; + } + } + + reader->js_used = (int)(p - reader->js_buf); + if (*p == quote) + { + ++reader->js_used; + if (res != NULL) + { + ga_append(&ga, NUL); + res->v_type = VAR_STRING; +#if defined(FEAT_MBYTE) && defined(USE_ICONV) + if (!enc_utf8) + { + vimconv_T conv; + + /* Convert the utf-8 string to 'encoding'. */ + conv.vc_type = CONV_NONE; + convert_setup(&conv, (char_u*)"utf-8", p_enc); + if (conv.vc_type != CONV_NONE) + { + res->vval.v_string = + string_convert(&conv, ga.ga_data, NULL); + vim_free(ga.ga_data); + } + convert_setup(&conv, NULL, NULL); + } + else +#endif + res->vval.v_string = ga.ga_data; + } + return OK; + } + if (res != NULL) + { + res->v_type = VAR_SPECIAL; + res->vval.v_number = VVAL_NONE; + ga_clear(&ga); + } + return MAYBE; +} + +typedef enum { + JSON_ARRAY, /* parsing items in an array */ + JSON_OBJECT_KEY, /* parsing key of an object */ + JSON_OBJECT /* parsing item in an object, after the key */ +} json_decode_T; + +typedef struct { + json_decode_T jd_type; + typval_T jd_tv; /* the list or dict */ + typval_T jd_key_tv; + char_u *jd_key; +} json_dec_item_T; + +/* + * Decode one item and put it in "res". If "res" is NULL only advance. + * Must already have skipped white space. + * + * Return FAIL for a decoding error (and give an error). + * Return MAYBE for an incomplete message. + */ + static int +json_decode_item(js_read_T *reader, typval_T *res, int options) +{ + char_u *p; + int len; + int retval; + garray_T stack; + typval_T item; + typval_T *cur_item; + json_dec_item_T *top_item; + char_u key_buf[NUMBUFLEN]; + + ga_init2(&stack, sizeof(json_dec_item_T), 100); + cur_item = res; + init_tv(&item); + if (res != NULL) + init_tv(res); + + fill_numbuflen(reader); + p = reader->js_buf + reader->js_used; + for (;;) + { + top_item = NULL; + if (stack.ga_len > 0) + { + top_item = ((json_dec_item_T *)stack.ga_data) + stack.ga_len - 1; + json_skip_white(reader); + p = reader->js_buf + reader->js_used; + if (*p == NUL) + { + retval = MAYBE; + if (top_item->jd_type == JSON_OBJECT) + /* did get the key, clear it */ + clear_tv(&top_item->jd_key_tv); + goto theend; + } + if (top_item->jd_type == JSON_OBJECT_KEY + || top_item->jd_type == JSON_ARRAY) + { + /* Check for end of object or array. */ + if (*p == (top_item->jd_type == JSON_ARRAY ? ']' : '}')) + { + ++reader->js_used; /* consume the ']' or '}' */ + --stack.ga_len; + if (stack.ga_len == 0) + { + retval = OK; + goto theend; + } + if (cur_item != NULL) + cur_item = &top_item->jd_tv; + goto item_end; + } + } + } + + if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY + && (options & JSON_JS) + && reader->js_buf[reader->js_used] != '"' + && reader->js_buf[reader->js_used] != '\'' + && reader->js_buf[reader->js_used] != '[' + && reader->js_buf[reader->js_used] != '{') + { + char_u *key; + + /* accept an object key that is not in quotes */ + key = p = reader->js_buf + reader->js_used; + while (*p != NUL && *p != ':' && *p > ' ') + ++p; + if (cur_item != NULL) + { + cur_item->v_type = VAR_STRING; + cur_item->vval.v_string = vim_strnsave(key, (int)(p - key)); + top_item->jd_key = cur_item->vval.v_string; + } + reader->js_used += (int)(p - key); + } + else + { + switch (*p) + { + case '[': /* start of array */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } + if (ga_grow(&stack, 1) == FAIL) + { + retval = FAIL; + break; + } + if (cur_item != NULL && rettv_list_alloc(cur_item) == FAIL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_NONE; + retval = FAIL; + break; + } + + ++reader->js_used; /* consume the '[' */ + top_item = ((json_dec_item_T *)stack.ga_data) + + stack.ga_len; + top_item->jd_type = JSON_ARRAY; + ++stack.ga_len; + if (cur_item != NULL) + { + top_item->jd_tv = *cur_item; + cur_item = &item; + } + continue; + + case '{': /* start of object */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } + if (ga_grow(&stack, 1) == FAIL) + { + retval = FAIL; + break; + } + if (cur_item != NULL && rettv_dict_alloc(cur_item) == FAIL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_NONE; + retval = FAIL; + break; + } + + ++reader->js_used; /* consume the '{' */ + top_item = ((json_dec_item_T *)stack.ga_data) + + stack.ga_len; + top_item->jd_type = JSON_OBJECT_KEY; + ++stack.ga_len; + if (cur_item != NULL) + { + top_item->jd_tv = *cur_item; + cur_item = &top_item->jd_key_tv; + } + continue; + + case '"': /* string */ + retval = json_decode_string(reader, cur_item, *p); + break; + + case '\'': + if (options & JSON_JS) + retval = json_decode_string(reader, cur_item, *p); + else + { + EMSG(_(e_invarg)); + retval = FAIL; + } + break; + + case ',': /* comma: empty item */ + if ((options & JSON_JS) == 0) + { + EMSG(_(e_invarg)); + retval = FAIL; + break; + } + /* FALLTHROUGH */ + case NUL: /* empty */ + if (cur_item != NULL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_NONE; + } + retval = OK; + break; + + default: + if (VIM_ISDIGIT(*p) || *p == '-') + { +#ifdef FEAT_FLOAT + char_u *sp = p; + + if (*sp == '-') + { + ++sp; + if (*sp == NUL) + { + retval = MAYBE; + break; + } + if (!VIM_ISDIGIT(*sp)) + { + EMSG(_(e_invarg)); + retval = FAIL; + break; + } + } + sp = skipdigits(sp); + if (*sp == '.' || *sp == 'e' || *sp == 'E') + { + if (cur_item == NULL) + { + float_T f; + + len = string2float(p, &f); + } + else + { + cur_item->v_type = VAR_FLOAT; + len = string2float(p, &cur_item->vval.v_float); + } + } + else +#endif + { + varnumber_T nr; + + vim_str2nr(reader->js_buf + reader->js_used, + NULL, &len, 0, /* what */ + &nr, NULL, 0); + if (cur_item != NULL) + { + cur_item->v_type = VAR_NUMBER; + cur_item->vval.v_number = nr; + } + } + reader->js_used += len; + retval = OK; + break; + } + if (STRNICMP((char *)p, "false", 5) == 0) + { + reader->js_used += 5; + if (cur_item != NULL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_FALSE; + } + retval = OK; + break; + } + if (STRNICMP((char *)p, "true", 4) == 0) + { + reader->js_used += 4; + if (cur_item != NULL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_TRUE; + } + retval = OK; + break; + } + if (STRNICMP((char *)p, "null", 4) == 0) + { + reader->js_used += 4; + if (cur_item != NULL) + { + cur_item->v_type = VAR_SPECIAL; + cur_item->vval.v_number = VVAL_NULL; + } + retval = OK; + break; + } +#ifdef FEAT_FLOAT + if (STRNICMP((char *)p, "NaN", 3) == 0) + { + reader->js_used += 3; + if (cur_item != NULL) + { + cur_item->v_type = VAR_FLOAT; + cur_item->vval.v_float = NAN; + } + retval = OK; + break; + } + if (STRNICMP((char *)p, "Infinity", 8) == 0) + { + reader->js_used += 8; + if (cur_item != NULL) + { + cur_item->v_type = VAR_FLOAT; + cur_item->vval.v_float = INFINITY; + } + retval = OK; + break; + } +#endif + /* check for truncated name */ + len = (int)(reader->js_end - (reader->js_buf + reader->js_used)); + if ( + (len < 5 && STRNICMP((char *)p, "false", len) == 0) +#ifdef FEAT_FLOAT + || (len < 8 && STRNICMP((char *)p, "Infinity", len) == 0) + || (len < 3 && STRNICMP((char *)p, "NaN", len) == 0) +#endif + || (len < 4 && (STRNICMP((char *)p, "true", len) == 0 + || STRNICMP((char *)p, "null", len) == 0))) + + retval = MAYBE; + else + retval = FAIL; + break; + } + + /* We are finished when retval is FAIL or MAYBE and when at the + * toplevel. */ + if (retval == FAIL) + break; + if (retval == MAYBE || stack.ga_len == 0) + goto theend; + + if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY + && cur_item != NULL) + { + top_item->jd_key = get_tv_string_buf_chk(cur_item, key_buf); + if (top_item->jd_key == NULL) + { + clear_tv(cur_item); + EMSG(_(e_invarg)); + retval = FAIL; + goto theend; + } + } + } + +item_end: + top_item = ((json_dec_item_T *)stack.ga_data) + stack.ga_len - 1; + switch (top_item->jd_type) + { + case JSON_ARRAY: + if (res != NULL) + { + listitem_T *li = listitem_alloc(); + + if (li == NULL) + { + clear_tv(cur_item); + retval = FAIL; + goto theend; + } + li->li_tv = *cur_item; + list_append(top_item->jd_tv.vval.v_list, li); + } + if (cur_item != NULL) + cur_item = &item; + + json_skip_white(reader); + p = reader->js_buf + reader->js_used; + if (*p == ',') + ++reader->js_used; + else if (*p != ']') + { + if (*p == NUL) + retval = MAYBE; + else + { + EMSG(_(e_invarg)); + retval = FAIL; + } + goto theend; + } + break; + + case JSON_OBJECT_KEY: + json_skip_white(reader); + p = reader->js_buf + reader->js_used; + if (*p != ':') + { + if (cur_item != NULL) + clear_tv(cur_item); + if (*p == NUL) + retval = MAYBE; + else + { + EMSG(_(e_invarg)); + retval = FAIL; + } + goto theend; + } + ++reader->js_used; + json_skip_white(reader); + top_item->jd_type = JSON_OBJECT; + if (cur_item != NULL) + cur_item = &item; + break; + + case JSON_OBJECT: + if (cur_item != NULL + && dict_find(top_item->jd_tv.vval.v_dict, + top_item->jd_key, -1) != NULL) + { + EMSG2(_("E938: Duplicate key in JSON: \"%s\""), + top_item->jd_key); + clear_tv(&top_item->jd_key_tv); + clear_tv(cur_item); + retval = FAIL; + goto theend; + } + + if (cur_item != NULL) + { + dictitem_T *di = dictitem_alloc(top_item->jd_key); + + clear_tv(&top_item->jd_key_tv); + if (di == NULL) + { + clear_tv(cur_item); + retval = FAIL; + goto theend; + } + di->di_tv = *cur_item; + di->di_tv.v_lock = 0; + if (dict_add(top_item->jd_tv.vval.v_dict, di) == FAIL) + { + dictitem_free(di); + retval = FAIL; + goto theend; + } + } + + json_skip_white(reader); + p = reader->js_buf + reader->js_used; + if (*p == ',') + ++reader->js_used; + else if (*p != '}') + { + if (*p == NUL) + retval = MAYBE; + else + { + EMSG(_(e_invarg)); + retval = FAIL; + } + goto theend; + } + top_item->jd_type = JSON_OBJECT_KEY; + if (cur_item != NULL) + cur_item = &top_item->jd_key_tv; + break; + } + } + + /* Get here when parsing failed. */ + if (res != NULL) + { + clear_tv(res); + res->v_type = VAR_SPECIAL; + res->vval.v_number = VVAL_NONE; + } + EMSG(_(e_invarg)); + +theend: + ga_clear(&stack); + return retval; +} + +/* + * Decode the JSON from "reader" and store the result in "res". + * "options" can be JSON_JS or zero; + * Return FAIL if not the whole message was consumed. + */ + int +json_decode_all(js_read_T *reader, typval_T *res, int options) +{ + int ret; + + /* We find the end once, to avoid calling strlen() many times. */ + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + json_skip_white(reader); + ret = json_decode_item(reader, res, options); + if (ret != OK) + { + if (ret == MAYBE) + EMSG(_(e_invarg)); + return FAIL; + } + json_skip_white(reader); + if (reader->js_buf[reader->js_used] != NUL) + { + EMSG(_(e_trailing)); + return FAIL; + } + return OK; +} + +/* + * Decode the JSON from "reader" and store the result in "res". + * "options" can be JSON_JS or zero; + * Return FAIL for a decoding error. + * Return MAYBE for an incomplete message. + * Consumes the message anyway. + */ + int +json_decode(js_read_T *reader, typval_T *res, int options) +{ + int ret; + + /* We find the end once, to avoid calling strlen() many times. */ + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + json_skip_white(reader); + ret = json_decode_item(reader, res, options); + json_skip_white(reader); + + return ret; +} + +/* + * Decode the JSON from "reader" to find the end of the message. + * "options" can be JSON_JS or zero. + * This is only used for testing. + * Return FAIL if the message has a decoding error. + * Return MAYBE if the message is truncated, need to read more. + * This only works reliable if the message contains an object, array or + * string. A number might be trucated without knowing. + * Does not advance the reader. + */ + int +json_find_end(js_read_T *reader, int options) +{ + int used_save = reader->js_used; + int ret; + + /* We find the end once, to avoid calling strlen() many times. */ + reader->js_end = reader->js_buf + STRLEN(reader->js_buf); + json_skip_white(reader); + ret = json_decode_item(reader, NULL, options); + reader->js_used = used_save; + return ret; +} +#endif diff --git a/src/json_test.c b/src/json_test.c new file mode 100644 index 0000000000..47bec8ee65 --- /dev/null +++ b/src/json_test.c @@ -0,0 +1,203 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * json_test.c: Unittests for json.c + */ + +#undef NDEBUG +#include <assert.h> + +/* Must include main.c because it contains much more than just main() */ +#define NO_VIM_MAIN +#include "main.c" + +/* This file has to be included because the tested functions are static */ +#include "json.c" + +#if defined(FEAT_EVAL) +/* + * Test json_find_end() with imcomplete items. + */ + static void +test_decode_find_end(void) +{ + js_read_T reader; + + reader.js_fill = NULL; + reader.js_used = 0; + + /* string and incomplete string */ + reader.js_buf = (char_u *)"\"hello\""; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" \"hello\" "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"\"hello"; + assert(json_find_end(&reader, 0) == MAYBE); + + /* number and dash (incomplete number) */ + reader.js_buf = (char_u *)"123"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"-"; + assert(json_find_end(&reader, 0) == MAYBE); + + /* false, true and null, also incomplete */ + reader.js_buf = (char_u *)"false"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"f"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"fa"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"fal"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"fals"; + assert(json_find_end(&reader, 0) == MAYBE); + + reader.js_buf = (char_u *)"true"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"t"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"tr"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"tru"; + assert(json_find_end(&reader, 0) == MAYBE); + + reader.js_buf = (char_u *)"null"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"n"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"nu"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"nul"; + assert(json_find_end(&reader, 0) == MAYBE); + + /* object without white space */ + reader.js_buf = (char_u *)"{\"a\":123}"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"{\"a\":123"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"{\"a\":"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"{\"a\""; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"{\"a"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"{\""; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"{"; + assert(json_find_end(&reader, 0) == MAYBE); + + /* object with white space */ + reader.js_buf = (char_u *)" { \"a\" : 123 } "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" { \"a\" : 123 "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" { \"a\" : "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" { \"a\" "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" { \"a "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" { "; + assert(json_find_end(&reader, 0) == MAYBE); + + /* JS object with white space */ + reader.js_buf = (char_u *)" { a : 123 } "; + assert(json_find_end(&reader, JSON_JS) == OK); + reader.js_buf = (char_u *)" { a : "; + assert(json_find_end(&reader, JSON_JS) == MAYBE); + + /* array without white space */ + reader.js_buf = (char_u *)"[\"a\",123]"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)"[\"a\",123"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"[\"a\","; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"[\"a\""; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"[\"a"; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"[\""; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)"["; + assert(json_find_end(&reader, 0) == MAYBE); + + /* array with white space */ + reader.js_buf = (char_u *)" [ \"a\" , 123 ] "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" [ \"a\" , 123 "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" [ \"a\" , "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" [ \"a\" "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" [ \"a "; + assert(json_find_end(&reader, 0) == MAYBE); + reader.js_buf = (char_u *)" [ "; + assert(json_find_end(&reader, 0) == MAYBE); +} + + static int +fill_from_cookie(js_read_T *reader) +{ + reader->js_buf = reader->js_cookie; + return TRUE; +} + +/* + * Test json_find_end with an incomplete array, calling the fill function. + */ + static void +test_fill_called_on_find_end(void) +{ + js_read_T reader; + + reader.js_fill = fill_from_cookie; + reader.js_used = 0; + reader.js_buf = (char_u *)" [ \"a\" , 123 "; + reader.js_cookie = " [ \"a\" , 123 ] "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" [ \"a\" , "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" [ \"a\" "; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" [ \"a"; + assert(json_find_end(&reader, 0) == OK); + reader.js_buf = (char_u *)" [ "; + assert(json_find_end(&reader, 0) == OK); +} + +/* + * Test json_find_end with an incomplete string, calling the fill function. + */ + static void +test_fill_called_on_string(void) +{ + js_read_T reader; + + reader.js_fill = fill_from_cookie; + reader.js_used = 0; + reader.js_buf = (char_u *)" \"foo"; + reader.js_end = reader.js_buf + STRLEN(reader.js_buf); + reader.js_cookie = " \"foobar\" "; + assert(json_decode_string(&reader, NULL, '"') == OK); +} +#endif + + int +main(void) +{ +#if defined(FEAT_EVAL) + test_decode_find_end(); + test_fill_called_on_find_end(); + test_fill_called_on_string(); +#endif + return 0; +} diff --git a/src/keymap.h b/src/keymap.h index 4dcfa65b25..69b59e401e 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -112,6 +112,7 @@ /* Used for the sgr mouse. */ #define KS_SGR_MOUSE 237 +#define KS_SGR_MOUSE_RELEASE 236 /* * Filler used after KS_SPECIAL and others @@ -139,6 +140,8 @@ /* * Codes for keys that do not have a termcap name. + * The numbers are fixed to make sure that recorded key sequences remain valid. + * Add new entries at the end, not halfway. * * K_SPECIAL KS_EXTRA KE_xxx */ @@ -146,133 +149,134 @@ enum key_extra { KE_NAME = 3 /* name of this terminal entry */ - , KE_S_UP /* shift-up */ - , KE_S_DOWN /* shift-down */ - - , KE_S_F1 /* shifted function keys */ - , KE_S_F2 - , KE_S_F3 - , KE_S_F4 - , KE_S_F5 - , KE_S_F6 - , KE_S_F7 - , KE_S_F8 - , KE_S_F9 - , KE_S_F10 - - , KE_S_F11 - , KE_S_F12 - , KE_S_F13 - , KE_S_F14 - , KE_S_F15 - , KE_S_F16 - , KE_S_F17 - , KE_S_F18 - , KE_S_F19 - , KE_S_F20 - - , KE_S_F21 - , KE_S_F22 - , KE_S_F23 - , KE_S_F24 - , KE_S_F25 - , KE_S_F26 - , KE_S_F27 - , KE_S_F28 - , KE_S_F29 - , KE_S_F30 - - , KE_S_F31 - , KE_S_F32 - , KE_S_F33 - , KE_S_F34 - , KE_S_F35 - , KE_S_F36 - , KE_S_F37 - - , KE_MOUSE /* mouse event start */ + , KE_S_UP = 4 /* shift-up */ + , KE_S_DOWN = 5 /* shift-down */ + + , KE_S_F1 = 6 /* shifted function keys */ + , KE_S_F2 = 7 + , KE_S_F3 = 8 + , KE_S_F4 = 9 + , KE_S_F5 = 10 + , KE_S_F6 = 11 + , KE_S_F7 = 12 + , KE_S_F8 = 13 + , KE_S_F9 = 14 + , KE_S_F10 = 15 + + , KE_S_F11 = 16 + , KE_S_F12 = 17 + , KE_S_F13 = 18 + , KE_S_F14 = 19 + , KE_S_F15 = 20 + , KE_S_F16 = 21 + , KE_S_F17 = 22 + , KE_S_F18 = 23 + , KE_S_F19 = 24 + , KE_S_F20 = 25 + + , KE_S_F21 = 26 + , KE_S_F22 = 27 + , KE_S_F23 = 28 + , KE_S_F24 = 29 + , KE_S_F25 = 30 + , KE_S_F26 = 31 + , KE_S_F27 = 32 + , KE_S_F28 = 33 + , KE_S_F29 = 34 + , KE_S_F30 = 35 + + , KE_S_F31 = 36 + , KE_S_F32 = 37 + , KE_S_F33 = 38 + , KE_S_F34 = 39 + , KE_S_F35 = 40 + , KE_S_F36 = 41 + , KE_S_F37 = 42 + + , KE_MOUSE = 43 /* mouse event start */ /* * Symbols for pseudo keys which are translated from the real key symbols * above. */ - , KE_LEFTMOUSE /* Left mouse button click */ - , KE_LEFTDRAG /* Drag with left mouse button down */ - , KE_LEFTRELEASE /* Left mouse button release */ - , KE_MIDDLEMOUSE /* Middle mouse button click */ - , KE_MIDDLEDRAG /* Drag with middle mouse button down */ - , KE_MIDDLERELEASE /* Middle mouse button release */ - , KE_RIGHTMOUSE /* Right mouse button click */ - , KE_RIGHTDRAG /* Drag with right mouse button down */ - , KE_RIGHTRELEASE /* Right mouse button release */ - - , KE_IGNORE /* Ignored mouse drag/release */ - - , KE_TAB /* unshifted TAB key */ - , KE_S_TAB_OLD /* shifted TAB key (no longer used) */ - - , KE_SNIFF /* SNiFF+ input waiting */ - - , KE_XF1 /* extra vt100 function keys for xterm */ - , KE_XF2 - , KE_XF3 - , KE_XF4 - , KE_XEND /* extra (vt100) end key for xterm */ - , KE_ZEND /* extra (vt100) end key for xterm */ - , KE_XHOME /* extra (vt100) home key for xterm */ - , KE_ZHOME /* extra (vt100) home key for xterm */ - , KE_XUP /* extra vt100 cursor keys for xterm */ - , KE_XDOWN - , KE_XLEFT - , KE_XRIGHT - - , KE_LEFTMOUSE_NM /* non-mappable Left mouse button click */ - , KE_LEFTRELEASE_NM /* non-mappable left mouse button release */ - - , KE_S_XF1 /* extra vt100 shifted function keys for xterm */ - , KE_S_XF2 - , KE_S_XF3 - , KE_S_XF4 + , KE_LEFTMOUSE = 44 /* Left mouse button click */ + , KE_LEFTDRAG = 45 /* Drag with left mouse button down */ + , KE_LEFTRELEASE = 46 /* Left mouse button release */ + , KE_MIDDLEMOUSE = 47 /* Middle mouse button click */ + , KE_MIDDLEDRAG = 48 /* Drag with middle mouse button down */ + , KE_MIDDLERELEASE = 49 /* Middle mouse button release */ + , KE_RIGHTMOUSE = 50 /* Right mouse button click */ + , KE_RIGHTDRAG = 51 /* Drag with right mouse button down */ + , KE_RIGHTRELEASE = 52 /* Right mouse button release */ + + , KE_IGNORE = 53 /* Ignored mouse drag/release */ + + , KE_TAB = 54 /* unshifted TAB key */ + , KE_S_TAB_OLD = 55 /* shifted TAB key (no longer used) */ + + , KE_SNIFF_UNUSED = 56 /* obsolete */ + , KE_XF1 = 57 /* extra vt100 function keys for xterm */ + , KE_XF2 = 58 + , KE_XF3 = 59 + , KE_XF4 = 60 + , KE_XEND = 61 /* extra (vt100) end key for xterm */ + , KE_ZEND = 62 /* extra (vt100) end key for xterm */ + , KE_XHOME = 63 /* extra (vt100) home key for xterm */ + , KE_ZHOME = 64 /* extra (vt100) home key for xterm */ + , KE_XUP = 65 /* extra vt100 cursor keys for xterm */ + , KE_XDOWN = 66 + , KE_XLEFT = 67 + , KE_XRIGHT = 68 + + , KE_LEFTMOUSE_NM = 69 /* non-mappable Left mouse button click */ + , KE_LEFTRELEASE_NM = 70 /* non-mappable left mouse button release */ + + , KE_S_XF1 = 71 /* vt100 shifted function keys for xterm */ + , KE_S_XF2 = 72 + , KE_S_XF3 = 73 + , KE_S_XF4 = 74 /* NOTE: The scroll wheel events are inverted: i.e. UP is the same as * moving the actual scroll wheel down, LEFT is the same as moving the * scroll wheel right. */ - , KE_MOUSEDOWN /* scroll wheel pseudo-button Down */ - , KE_MOUSEUP /* scroll wheel pseudo-button Up */ - , KE_MOUSELEFT /* scroll wheel pseudo-button Left */ - , KE_MOUSERIGHT /* scroll wheel pseudo-button Right */ - - , KE_KINS /* keypad Insert key */ - , KE_KDEL /* keypad Delete key */ - - , KE_CSI /* CSI typed directly */ - , KE_SNR /* <SNR> */ - , KE_PLUG /* <Plug> */ - , KE_CMDWIN /* open command-line window from Command-line Mode */ - - , KE_C_LEFT /* control-left */ - , KE_C_RIGHT /* control-right */ - , KE_C_HOME /* control-home */ - , KE_C_END /* control-end */ - - , KE_X1MOUSE /* X1/X2 mouse-buttons */ - , KE_X1DRAG - , KE_X1RELEASE - , KE_X2MOUSE - , KE_X2DRAG - , KE_X2RELEASE - - , KE_DROP /* DnD data is available */ - , KE_CURSORHOLD /* CursorHold event */ - , KE_NOP /* doesn't do something */ - , KE_FOCUSGAINED /* focus gained */ - , KE_FOCUSLOST /* focus lost */ + , KE_MOUSEDOWN = 75 /* scroll wheel pseudo-button Down */ + , KE_MOUSEUP = 76 /* scroll wheel pseudo-button Up */ + , KE_MOUSELEFT = 77 /* scroll wheel pseudo-button Left */ + , KE_MOUSERIGHT = 78 /* scroll wheel pseudo-button Right */ + + , KE_KINS = 79 /* keypad Insert key */ + , KE_KDEL = 80 /* keypad Delete key */ + + , KE_CSI = 81 /* CSI typed directly */ + , KE_SNR = 82 /* <SNR> */ + , KE_PLUG = 83 /* <Plug> */ + , KE_CMDWIN = 84 /* open command-line window from Command-line Mode */ + + , KE_C_LEFT = 85 /* control-left */ + , KE_C_RIGHT = 86 /* control-right */ + , KE_C_HOME = 87 /* control-home */ + , KE_C_END = 88 /* control-end */ + + , KE_X1MOUSE = 89 /* X1/X2 mouse-buttons */ + , KE_X1DRAG = 90 + , KE_X1RELEASE = 91 + , KE_X2MOUSE = 92 + , KE_X2DRAG = 93 + , KE_X2RELEASE = 94 + + , KE_DROP = 95 /* DnD data is available */ + , KE_CURSORHOLD = 96 /* CursorHold event */ + , KE_NOP = 97 /* doesn't do something */ + , KE_FOCUSGAINED = 98 /* focus gained */ + , KE_FOCUSLOST = 99 /* focus lost */ + , KE_MOUSEMOVE = 100 /* mouse moved with no button down */ + , KE_CANCEL = 101 /* return from vgetc() */ #ifdef FEAT_GUI_MACVIM - , KE_SWIPELEFT /* Swipe trackpad left */ - , KE_SWIPERIGHT /* Swipe trackpad right */ - , KE_SWIPEUP /* Swipe trackpad up */ - , KE_SWIPEDOWN /* Swipe trackpad down */ + , KE_SWIPELEFT = 102 /* Swipe trackpad left */ + , KE_SWIPERIGHT = 103 /* Swipe trackpad right */ + , KE_SWIPEUP = 104 /* Swipe trackpad up */ + , KE_SWIPEDOWN = 105 /* Swipe trackpad down */ #endif }; @@ -400,6 +404,8 @@ enum key_extra #define K_KMULTIPLY TERMCAP2KEY('K', '9') /* keypad * */ #define K_KENTER TERMCAP2KEY('K', 'A') /* keypad Enter */ #define K_KPOINT TERMCAP2KEY('K', 'B') /* keypad . or ,*/ +#define K_PS TERMCAP2KEY('P', 'S') /* paste start */ +#define K_PE TERMCAP2KEY('P', 'E') /* paste end */ #define K_K0 TERMCAP2KEY('K', 'C') /* keypad 0 */ #define K_K1 TERMCAP2KEY('K', 'D') /* keypad 1 */ @@ -423,6 +429,7 @@ enum key_extra #define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER) #define K_URXVT_MOUSE TERMCAP2KEY(KS_URXVT_MOUSE, KE_FILLER) #define K_SGR_MOUSE TERMCAP2KEY(KS_SGR_MOUSE, KE_FILLER) +#define K_SGR_MOUSERELEASE TERMCAP2KEY(KS_SGR_MOUSE_RELEASE, KE_FILLER) #define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER) #define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, KE_FILLER) @@ -439,6 +446,7 @@ enum key_extra #define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG) #define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE) #define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM) +#define K_MOUSEMOVE TERMCAP2KEY(KS_EXTRA, KE_MOUSEMOVE) #define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE) #define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG) #define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE) @@ -455,8 +463,7 @@ enum key_extra #define K_IGNORE TERMCAP2KEY(KS_EXTRA, KE_IGNORE) #define K_NOP TERMCAP2KEY(KS_EXTRA, KE_NOP) - -#define K_SNIFF TERMCAP2KEY(KS_EXTRA, KE_SNIFF) +#define K_CANCEL TERMCAP2KEY(KS_EXTRA, KE_CANCEL) #define K_MOUSEDOWN TERMCAP2KEY(KS_EXTRA, KE_MOUSEDOWN) #define K_MOUSEUP TERMCAP2KEY(KS_EXTRA, KE_MOUSEUP) @@ -490,7 +497,7 @@ enum key_extra #define MOD_MASK_2CLICK 0x20 /* use MOD_MASK_MULTI_CLICK */ #define MOD_MASK_3CLICK 0x40 /* use MOD_MASK_MULTI_CLICK */ #define MOD_MASK_4CLICK 0x60 /* use MOD_MASK_MULTI_CLICK */ -#ifdef MACOS +#ifdef MACOS_X # define MOD_MASK_CMD 0x80 #endif @@ -498,9 +505,10 @@ enum key_extra /* * The length of the longest special key name, including modifiers. - * Current longest is <M-C-S-T-4-MiddleRelease> (length includes '<' and '>'). + * Current longest is <M-C-S-T-D-A-4-ScrollWheelRight> (length includes '<' and + * '>'). */ -#define MAX_KEY_NAME_LEN 25 +#define MAX_KEY_NAME_LEN 32 /* Maximum length of a special key event as tokens. This includes modifiers. * The longest event is something like <M-C-S-T-4-LeftDrag> which would be the diff --git a/src/kword_test.c b/src/kword_test.c new file mode 100644 index 0000000000..2e6640b8b1 --- /dev/null +++ b/src/kword_test.c @@ -0,0 +1,85 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * kword_test.c: Unittests for vim_iswordc() and vim_iswordp(). + */ + +#undef NDEBUG +#include <assert.h> + +/* Must include main.c because it contains much more than just main() */ +#define NO_VIM_MAIN +#include "main.c" + +/* This file has to be included because the tested functions are static */ +#include "charset.c" + +#ifdef FEAT_MBYTE +/* + * Test the results of vim_iswordc() and vim_iswordp() are matched. + */ + static void +test_isword_funcs_utf8(void) +{ + buf_T buf; + int c; + + vim_memset(&buf, 0, sizeof(buf)); + p_enc = (char_u *)"utf-8"; + p_isi = (char_u *)""; + p_isp = (char_u *)""; + p_isf = (char_u *)""; + buf.b_p_isk = (char_u *)"@,48-57,_,128-167,224-235"; + + curbuf = &buf; + mb_init(); /* calls init_chartab() */ + + for (c = 0; c < 0x10000; ++c) + { + char_u p[4] = {0}; + int c1; + int retc; + int retp; + + utf_char2bytes(c, p); + c1 = utf_ptr2char(p); + if (c != c1) + { + fprintf(stderr, "Failed: "); + fprintf(stderr, + "[c = %#04x, p = {%#02x, %#02x, %#02x}] ", + c, p[0], p[1], p[2]); + fprintf(stderr, "c != utf_ptr2char(p) (=%#04x)\n", c1); + abort(); + } + retc = vim_iswordc_buf(c, &buf); + retp = vim_iswordp_buf(p, &buf); + if (retc != retp) + { + fprintf(stderr, "Failed: "); + fprintf(stderr, + "[c = %#04x, p = {%#02x, %#02x, %#02x}] ", + c, p[0], p[1], p[2]); + fprintf(stderr, "vim_iswordc(c) (=%d) != vim_iswordp(p) (=%d)\n", + retc, retp); + abort(); + } + } +} +#endif + + int +main(void) +{ +#ifdef FEAT_MBYTE + test_isword_funcs_utf8(); +#endif + return 0; +} diff --git a/src/libvterm/.bzrignore b/src/libvterm/.bzrignore new file mode 100644 index 0000000000..e58c036693 --- /dev/null +++ b/src/libvterm/.bzrignore @@ -0,0 +1,13 @@ +.libs +*.lo +*.la + +bin/* +!bin/*.c + +pangoterm +t/test +t/suites.h +t/externs.h +t/harness +src/encoding/*.inc diff --git a/src/libvterm/.gitignore b/src/libvterm/.gitignore new file mode 100644 index 0000000000..5e5e30813a --- /dev/null +++ b/src/libvterm/.gitignore @@ -0,0 +1,17 @@ +*~ +*.swp + +tags +src/*.o +src/*.lo + +libvterm.la +bin/unterm +bin/vterm-ctrl +bin/vterm-dump + +t/harness +t/harness.lo +t/harness.o + +.libs/ diff --git a/src/libvterm/LICENSE b/src/libvterm/LICENSE new file mode 100644 index 0000000000..0d051634b2 --- /dev/null +++ b/src/libvterm/LICENSE @@ -0,0 +1,23 @@ + + +The MIT License + +Copyright (c) 2008 Paul Evans <leonerd@leonerd.org.uk> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/libvterm/Makefile b/src/libvterm/Makefile new file mode 100644 index 0000000000..05f68dd605 --- /dev/null +++ b/src/libvterm/Makefile @@ -0,0 +1,145 @@ +ifeq ($(shell uname),Darwin) + LIBTOOL ?= glibtool +else + LIBTOOL ?= libtool +endif + +ifneq ($(VERBOSE),1) + LIBTOOL +=--quiet +endif + +# override CFLAGS +=-Wall -Iinclude -std=c99 -DINLINE="static inline" -DUSE_INLINE +override CFLAGS +=-Wall -Iinclude -std=c90 -Wpedantic -DINLINE="" + +ifeq ($(shell uname),SunOS) + override CFLAGS +=-D__EXTENSIONS__ -D_XPG6 -D__XOPEN_OR_POSIX +endif + +ifeq ($(DEBUG),1) + override CFLAGS +=-ggdb -DDEBUG +endif + +ifeq ($(PROFILE),1) + override CFLAGS +=-pg + override LDFLAGS+=-pg +endif + +CFILES=$(sort $(wildcard src/*.c)) +HFILES=$(sort $(wildcard include/*.h)) +OBJECTS=$(CFILES:.c=.lo) +LIBRARY=libvterm.la + +BINFILES_SRC=$(sort $(wildcard bin/*.c)) +BINFILES=$(BINFILES_SRC:.c=) + +TBLFILES=$(sort $(wildcard src/encoding/*.tbl)) +INCFILES=$(TBLFILES:.tbl=.inc) + +HFILES_INT=$(sort $(wildcard src/*.h)) $(HFILES) + +VERSION_MAJOR=0 +VERSION_MINOR=0 + +VERSION_CURRENT=0 +VERSION_REVISION=0 +VERSION_AGE=0 + +VERSION=0 + +PREFIX=/usr/local +BINDIR=$(PREFIX)/bin +LIBDIR=$(PREFIX)/lib +INCDIR=$(PREFIX)/include +MANDIR=$(PREFIX)/share/man +MAN3DIR=$(MANDIR)/man3 + +all: $(LIBRARY) $(BINFILES) + +$(LIBRARY): $(OBJECTS) + @echo LINK $@ + @$(LIBTOOL) --mode=link --tag=CC $(CC) -rpath $(LIBDIR) -version-info $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) -o $@ $^ $(LDFLAGS) + +src/%.lo: src/%.c $(HFILES_INT) + @echo CC $< + @$(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $< + +src/encoding/%.inc: src/encoding/%.tbl + @echo TBL $< + @perl -CSD tbl2inc_c.pl $< >$@ + +src/encoding.lo: $(INCFILES) + +bin/%: bin/%.c $(LIBRARY) + @echo CC $< + @$(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) -o $@ $< -lvterm $(LDFLAGS) + +t/harness.lo: t/harness.c $(HFILES) + @echo CC $< + @$(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $< + +t/harness: t/harness.lo $(LIBRARY) + @echo LINK $@ + @$(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +.PHONY: test +test: $(LIBRARY) t/harness + for T in `ls t/[0-9]*.test`; do echo "** $$T **"; perl t/run-test.pl $$T $(if $(VALGRIND),--valgrind) || exit 1; done + +.PHONY: clean +clean: + $(LIBTOOL) --mode=clean rm -f $(OBJECTS) $(INCFILES) + $(LIBTOOL) --mode=clean rm -f t/harness.lo t/harness + $(LIBTOOL) --mode=clean rm -f $(LIBRARY) $(BINFILES) + +.PHONY: install +install: install-inc install-lib install-bin + +install-inc: + install -d $(DESTDIR)$(INCDIR) + install -m644 $(HFILES) $(DESTDIR)$(INCDIR) + install -d $(DESTDIR)$(LIBDIR)/pkgconfig + sed -e "s,@PREFIX@,$(PREFIX)," -e "s,@LIBDIR@,$(LIBDIR)," -e "s,@VERSION@,$(VERSION)," <vterm.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/vterm.pc + +install-lib: $(LIBRARY) + install -d $(DESTDIR)$(LIBDIR) + $(LIBTOOL) --mode=install install $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY) + $(LIBTOOL) --mode=finish $(DESTDIR)$(LIBDIR) + +install-bin: $(BINFILES) + install -d $(DESTDIR)$(BINDIR) + $(LIBTOOL) --mode=install install $(BINFILES) $(DESTDIR)$(BINDIR)/ + +# DIST CUT + +VERSION=$(VERSION_MAJOR).$(VERSION_MINOR) + +DISTDIR=libvterm-$(VERSION) + +distdir: $(INCFILES) + mkdir __distdir + cp LICENSE __distdir + mkdir __distdir/src + cp src/*.c src/*.h __distdir/src + mkdir __distdir/src/encoding + cp src/encoding/*.inc __distdir/src/encoding + mkdir __distdir/include + cp include/*.h __distdir/include + mkdir __distdir/bin + cp bin/*.c __distdir/bin + mkdir __distdir/t + cp t/*.test t/harness.c t/run-test.pl __distdir/t + sed "s,@VERSION@,$(VERSION)," <vterm.pc.in >__distdir/vterm.pc.in + sed "/^# DIST CUT/Q" <Makefile >__distdir/Makefile + mv __distdir $(DISTDIR) + +TARBALL=$(DISTDIR).tar.gz + +dist: distdir + tar -czf $(TARBALL) $(DISTDIR) + rm -rf $(DISTDIR) + +dist+bzr: + $(MAKE) dist VERSION=$(VERSION)+bzr`bzr revno` + +distdir+bzr: + $(MAKE) distdir VERSION=$(VERSION)+bzr`bzr revno` diff --git a/src/libvterm/README b/src/libvterm/README new file mode 100644 index 0000000000..208066bdeb --- /dev/null +++ b/src/libvterm/README @@ -0,0 +1,30 @@ +This is a MODIFIED version of libvterm. + +The original can be found: +- on the original site (tar archive and Bazaar repository): + http://www.leonerd.org.uk/code/libvterm/ +- cloned on Github: + https://github.com/neovim/libvterm + +Modifications: +- Add a .gitignore file. +- Convert from C99 to C90. +- Other changes to support embedding in Vim. + + +To merge in changes from Github, do this: +- Commit any pending changes. +- Setup the merge tool: + git config merge.tool vimdiff + git config merge.conflictstyle diff3 + git config mergetool.prompt false +- Run the merge tool: + git mergetool + This will open a four-way diff between: + LOCAL - your current version + BASE - version as it was at your last sync + REMOTE - version at head on Github + MERGED - best-effort merge of LOCAL and REMOTE + Now find places where automatic merge didn't work, they are marked with + <<<<<<<<, ======= and >>>>>>> + Fix those places in MERGED, remove the markers, and save the file :wqall. diff --git a/src/libvterm/bin/unterm.c b/src/libvterm/bin/unterm.c new file mode 100644 index 0000000000..5c310d7955 --- /dev/null +++ b/src/libvterm/bin/unterm.c @@ -0,0 +1,288 @@ +#include <stdio.h> +#include <string.h> + +#include <errno.h> +#include <fcntl.h> +#include <getopt.h> +#include <unistd.h> + +#include "vterm.h" + +#define DEFINE_INLINES +#include "../src/utf8.h" // fill_utf8 + +#define streq(a,b) (!strcmp(a,b)) + +static VTerm *vt; +static VTermScreen *vts; + +static int cols; +static int rows; + +static enum { + FORMAT_PLAIN, + FORMAT_SGR, +} format = FORMAT_PLAIN; + +static int col2index(VTermColor target) +{ + int index; + + for(index = 0; index < 256; index++) { + VTermColor col; + vterm_state_get_palette_color(NULL, index, &col); + if(col.red == target.red && col.green == target.green && col.blue == target.blue) + return index; + } + return -1; +} + +static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevcell) +{ + switch(format) { + case FORMAT_PLAIN: + break; + case FORMAT_SGR: + { + // If all 7 attributes change, that means 7 SGRs max + // Each colour could consume up to 3 + int sgr[7 + 2*3]; int sgri = 0; + + if(!prevcell->attrs.bold && cell->attrs.bold) + sgr[sgri++] = 1; + if(prevcell->attrs.bold && !cell->attrs.bold) + sgr[sgri++] = 22; + + if(!prevcell->attrs.underline && cell->attrs.underline) + sgr[sgri++] = 4; + if(prevcell->attrs.underline && !cell->attrs.underline) + sgr[sgri++] = 24; + + if(!prevcell->attrs.italic && cell->attrs.italic) + sgr[sgri++] = 3; + if(prevcell->attrs.italic && !cell->attrs.italic) + sgr[sgri++] = 23; + + if(!prevcell->attrs.blink && cell->attrs.blink) + sgr[sgri++] = 5; + if(prevcell->attrs.blink && !cell->attrs.blink) + sgr[sgri++] = 25; + + if(!prevcell->attrs.reverse && cell->attrs.reverse) + sgr[sgri++] = 7; + if(prevcell->attrs.reverse && !cell->attrs.reverse) + sgr[sgri++] = 27; + + if(!prevcell->attrs.strike && cell->attrs.strike) + sgr[sgri++] = 9; + if(prevcell->attrs.strike && !cell->attrs.strike) + sgr[sgri++] = 29; + + if(!prevcell->attrs.font && cell->attrs.font) + sgr[sgri++] = 10 + cell->attrs.font; + if(prevcell->attrs.font && !cell->attrs.font) + sgr[sgri++] = 10; + + if(prevcell->fg.red != cell->fg.red || + prevcell->fg.green != cell->fg.green || + prevcell->fg.blue != cell->fg.blue) { + int index = col2index(cell->fg); + if(index == -1) + sgr[sgri++] = 39; + else if(index < 8) + sgr[sgri++] = 30 + index; + else if(index < 16) + sgr[sgri++] = 90 + (index - 8); + else { + sgr[sgri++] = 38; + sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE; + sgr[sgri++] = index | CSI_ARG_FLAG_MORE; + } + } + + if(prevcell->bg.red != cell->bg.red || + prevcell->bg.green != cell->bg.green || + prevcell->bg.blue != cell->bg.blue) { + int index = col2index(cell->bg); + if(index == -1) + sgr[sgri++] = 49; + else if(index < 8) + sgr[sgri++] = 40 + index; + else if(index < 16) + sgr[sgri++] = 100 + (index - 8); + else { + sgr[sgri++] = 48; + sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE; + sgr[sgri++] = index | CSI_ARG_FLAG_MORE; + } + } + + if(!sgri) + break; + + printf("\x1b["); + { + int i; + for(i = 0; i < sgri; i++) + printf(!i ? "%d" : + CSI_ARG_HAS_MORE(sgr[i]) ? ":%d" : + ";%d", + CSI_ARG(sgr[i])); + } + printf("m"); + } + break; + } + + { + int i; + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell->chars[i]; i++) { + char bytes[6]; + bytes[fill_utf8(cell->chars[i], bytes)] = 0; + printf("%s", bytes); + } + } +} + +static void dump_eol(const VTermScreenCell *prevcell) +{ + switch(format) { + case FORMAT_PLAIN: + break; + case FORMAT_SGR: + if(prevcell->attrs.bold || prevcell->attrs.underline || prevcell->attrs.italic || + prevcell->attrs.blink || prevcell->attrs.reverse || prevcell->attrs.strike || + prevcell->attrs.font) + printf("\x1b[m"); + break; + } + + printf("\n"); +} + +void dump_row(int row) +{ + VTermPos pos; + VTermScreenCell prevcell; + pos.row = row; + pos.col = 0; + memset(&prevcell, 0, sizeof(prevcell)); + vterm_state_get_default_colors(vterm_obtain_state(vt), &prevcell.fg, &prevcell.bg); + + while(pos.col < cols) { + VTermScreenCell cell; + vterm_screen_get_cell(vts, pos, &cell); + + dump_cell(&cell, &prevcell); + + pos.col += cell.width; + prevcell = cell; + } + + dump_eol(&prevcell); +} + +static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user) +{ + VTermScreenCell prevcell; + int col; + + memset(&prevcell, 0, sizeof(prevcell)); + vterm_state_get_default_colors(vterm_obtain_state(vt), &prevcell.fg, &prevcell.bg); + + for(col = 0; col < cols; col++) { + dump_cell(cells + col, &prevcell); + prevcell = cells[col]; + } + + dump_eol(&prevcell); + + return 1; +} + +static int screen_resize(int new_rows, int new_cols, void *user) +{ + rows = new_rows; + cols = new_cols; + return 1; +} + +static VTermScreenCallbacks cb_screen = { + NULL, /* damage */ + NULL, /* moverect */ + NULL, /* movecursor */ + NULL, /* settermprop */ + NULL, /* bell */ + &screen_resize, /* resize */ + &screen_sb_pushline, /* sb_pushline */ + NULL, /* popline */ +}; + +int main(int argc, char *argv[]) +{ + int opt; + const char *file; + int fd; + int len; + char buffer[1024]; + int row; + + rows = 25; + cols = 80; + + while((opt = getopt(argc, argv, "f:l:c:")) != -1) { + switch(opt) { + case 'f': + if(streq(optarg, "plain")) + format = FORMAT_PLAIN; + else if(streq(optarg, "sgr")) + format = FORMAT_SGR; + else { + fprintf(stderr, "Unrecognised format '%s'\n", optarg); + exit(1); + } + break; + + case 'l': + rows = atoi(optarg); + if(!rows) + rows = 25; + break; + + case 'c': + cols = atoi(optarg); + if(!cols) + cols = 80; + break; + } + } + + file = argv[optind++]; + fd = open(file, O_RDONLY); + if(fd == -1) { + fprintf(stderr, "Cannot open %s - %s\n", file, strerror(errno)); + exit(1); + } + + vt = vterm_new(rows, cols); + vterm_set_utf8(vt, TRUE); + + vts = vterm_obtain_screen(vt); + vterm_screen_set_callbacks(vts, &cb_screen, NULL); + + vterm_screen_reset(vts, 1); + + while((len = read(fd, buffer, sizeof(buffer))) > 0) { + vterm_input_write(vt, buffer, len); + } + + for(row = 0; row < rows; row++) { + dump_row(row); + } + + close(fd); + + vterm_free(vt); + + return 0; +} diff --git a/src/libvterm/bin/vterm-ctrl.c b/src/libvterm/bin/vterm-ctrl.c new file mode 100644 index 0000000000..7c08fe1f9e --- /dev/null +++ b/src/libvterm/bin/vterm-ctrl.c @@ -0,0 +1,368 @@ +#define _XOPEN_SOURCE 500 /* strdup */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#define streq(a,b) (strcmp(a,b)==0) +#define TRUE 1 +#define FALSE 0 + +#include <termios.h> + +static char *getvalue(int *argip, int argc, char *argv[]) +{ + if(*argip >= argc) { + fprintf(stderr, "Expected an option value\n"); + exit(1); + } + + return argv[(*argip)++]; +} + +static int getchoice(int *argip, int argc, char *argv[], const char *options[]) +{ + const char *arg = getvalue(argip, argc, argv); + + int value = -1; + while(options[++value]) + if(streq(arg, options[value])) + return value; + + fprintf(stderr, "Unrecognised option value %s\n", arg); + exit(1); +} + +typedef enum { + OFF, + ON, + QUERY, +} BoolQuery; + +static BoolQuery getboolq(int *argip, int argc, char *argv[]) +{ + const char *choices[] = {"off", "on", "query", NULL}; + return getchoice(argip, argc, argv, choices); +} + +static char *helptext[] = { + "reset", + "s8c1t [off|on]", + "keypad [app|num]", + "screen [off|on|query]", + "cursor [off|on|query]", + "curblink [off|on|query]", + "curshape [block|under|bar|query]", + "mouse [off|click|clickdrag|motion]", + "reportfocus [off|on|query]", + "altscreen [off|on|query]", + "bracketpaste [off|on|query]", + "icontitle [STR]", + "icon [STR]", + "title [STR]", + NULL +}; + +static int seticanon(int icanon, int echo) +{ + struct termios termios; + int ret; + + tcgetattr(0, &termios); + + ret = (termios.c_lflag & ICANON); + + if(icanon) termios.c_lflag |= ICANON; + else termios.c_lflag &= ~ICANON; + + if(echo) termios.c_lflag |= ECHO; + else termios.c_lflag &= ~ECHO; + + tcsetattr(0, TCSANOW, &termios); + + return ret; +} + +static void await_c1(unsigned char c1) +{ + unsigned char c; + + /* await CSI - 8bit or 2byte 7bit form */ + int in_esc = FALSE; + while((c = getchar())) { + if(c == c1) + break; + if(in_esc && c == (char)(c1 - 0x40)) + break; + if(!in_esc && c == 0x1b) + in_esc = TRUE; + else + in_esc = FALSE; + } +} + +static char *read_csi() +{ + unsigned char csi[32]; + int i = 0; + + await_c1(0x9B); // CSI + + /* TODO: This really should be a more robust CSI parser + */ + for(; i < sizeof(csi)-1; i++) { + int c = csi[i] = getchar(); + if(c >= 0x40 && c <= 0x7e) + break; + } + csi[++i] = 0; + + // TODO: returns longer than 32? + + return strdup((char *)csi); +} + +static char *read_dcs() +{ + unsigned char dcs[32]; + int in_esc = FALSE; + int i; + + await_c1(0x90); + + for(i = 0; i < sizeof(dcs)-1; ) { + char c = getchar(); + if(c == 0x9c) // ST + break; + if(in_esc && c == 0x5c) + break; + if(!in_esc && c == 0x1b) + in_esc = TRUE; + else { + dcs[i++] = c; + in_esc = FALSE; + } + } + dcs[++i] = 0; + + return strdup((char *)dcs); +} + +static void usage(int exitcode) +{ + char **p; + + fprintf(stderr, "Control a libvterm-based terminal\n" + "\n" + "Options:\n"); + + for(p = helptext; *p; p++) + fprintf(stderr, " %s\n", *p); + + exit(exitcode); +} + +static int query_dec_mode(int mode) +{ + char *s = NULL; + + printf("\x1b[?%d$p", mode); + + do { + int reply_mode, reply_value; + char reply_cmd; + + if(s) + free(s); + s = read_csi(); + + /* expect "?" mode ";" value "$y" */ + + /* If the sscanf format string ends in a literal, we can't tell from + * its return value if it matches. Hence we'll %c the cmd and check it + * explicitly + */ + if(sscanf(s, "?%d;%d$%c", &reply_mode, &reply_value, &reply_cmd) < 3) + continue; + if(reply_cmd != 'y') + continue; + + if(reply_mode != mode) + continue; + + free(s); + + if(reply_value == 1 || reply_value == 3) + return TRUE; + if(reply_value == 2 || reply_value == 4) + return FALSE; + + printf("Unrecognised reply to DECRQM: %d\n", reply_value); + return FALSE; + } while(1); +} + +static void do_dec_mode(int mode, BoolQuery val, const char *name) +{ + switch(val) { + case OFF: + case ON: + printf("\x1b[?%d%c", mode, val == ON ? 'h' : 'l'); + break; + + case QUERY: + if(query_dec_mode(mode)) + printf("%s on\n", name); + else + printf("%s off\n", name); + break; + } +} + +static int query_rqss_numeric(char *cmd) +{ + char *s = NULL; + + printf("\x1bP$q%s\x1b\\", cmd); + + do { + int num; + + if(s) + free(s); + s = read_dcs(); + + if(!s) + return -1; + if(strlen(s) < strlen(cmd)) + return -1; + if(strcmp(s + strlen(s) - strlen(cmd), cmd) != 0) { + printf("No match\n"); + continue; + } + + if(s[0] != '1' || s[1] != '$' || s[2] != 'r') + return -1; + + if(sscanf(s + 3, "%d", &num) != 1) + return -1; + + return num; + } while(1); +} + +int wasicanon; + +void restoreicanon(void) +{ + seticanon(wasicanon, TRUE); +} + +int main(int argc, char *argv[]) +{ + int argi = 1; + + if(argc == 1) + usage(0); + + wasicanon = seticanon(FALSE, FALSE); + atexit(restoreicanon); + + while(argi < argc) { + const char *arg = argv[argi++]; + + if(streq(arg, "reset")) { + printf("\x1b" "c"); + } + else if(streq(arg, "s8c1t")) { + const char *choices[] = {"off", "on", NULL}; + switch(getchoice(&argi, argc, argv, choices)) { + case 0: + printf("\x1b F"); break; + case 1: + printf("\x1b G"); break; + } + } + else if(streq(arg, "keypad")) { + const char *choices[] = {"app", "num", NULL}; + switch(getchoice(&argi, argc, argv, choices)) { + case 0: + printf("\x1b="); break; + case 1: + printf("\x1b>"); break; + } + } + else if(streq(arg, "screen")) { + do_dec_mode(5, getboolq(&argi, argc, argv), "screen"); + } + else if(streq(arg, "cursor")) { + do_dec_mode(25, getboolq(&argi, argc, argv), "cursor"); + } + else if(streq(arg, "curblink")) { + do_dec_mode(12, getboolq(&argi, argc, argv), "curblink"); + } + else if(streq(arg, "curshape")) { + // TODO: This ought to query the current value of DECSCUSR because it + // may need blinking on or off + const char *choices[] = {"block", "under", "bar", "query", NULL}; + int shape = getchoice(&argi, argc, argv, choices); + switch(shape) { + case 3: // query + shape = query_rqss_numeric(" q"); + switch(shape) { + case 1: case 2: + printf("curshape block\n"); + break; + case 3: case 4: + printf("curshape under\n"); + break; + case 5: case 6: + printf("curshape bar\n"); + break; + } + break; + + case 0: + case 1: + case 2: + printf("\x1b[%d q", 1 + (shape * 2)); + break; + } + } + else if(streq(arg, "mouse")) { + const char *choices[] = {"off", "click", "clickdrag", "motion", NULL}; + switch(getchoice(&argi, argc, argv, choices)) { + case 0: + printf("\x1b[?1000l"); break; + case 1: + printf("\x1b[?1000h"); break; + case 2: + printf("\x1b[?1002h"); break; + case 3: + printf("\x1b[?1003h"); break; + } + } + else if(streq(arg, "reportfocus")) { + do_dec_mode(1004, getboolq(&argi, argc, argv), "reportfocus"); + } + else if(streq(arg, "altscreen")) { + do_dec_mode(1049, getboolq(&argi, argc, argv), "altscreen"); + } + else if(streq(arg, "bracketpaste")) { + do_dec_mode(2004, getboolq(&argi, argc, argv), "bracketpaste"); + } + else if(streq(arg, "icontitle")) { + printf("\x1b]0;%s\a", getvalue(&argi, argc, argv)); + } + else if(streq(arg, "icon")) { + printf("\x1b]1;%s\a", getvalue(&argi, argc, argv)); + } + else if(streq(arg, "title")) { + printf("\x1b]2;%s\a", getvalue(&argi, argc, argv)); + } + else { + fprintf(stderr, "Unrecognised command %s\n", arg); + exit(1); + } + } + return 0; +} diff --git a/src/libvterm/bin/vterm-dump.c b/src/libvterm/bin/vterm-dump.c new file mode 100644 index 0000000000..a299d9c938 --- /dev/null +++ b/src/libvterm/bin/vterm-dump.c @@ -0,0 +1,232 @@ +// Require getopt(3) +#define _XOPEN_SOURCE + +#include <stdio.h> +#include <string.h> +#define streq(a,b) (strcmp(a,b)==0) + +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#include "vterm.h" + +static const char *special_begin = "{"; +static const char *special_end = "}"; + +static int parser_text(const char bytes[], size_t len, void *user) +{ + unsigned char *b = (unsigned char *)bytes; + + int i; + for(i = 0; i < len; /* none */) { + if(b[i] < 0x20) // C0 + break; + else if(b[i] < 0x80) // ASCII + i++; + else if(b[i] < 0xa0) // C1 + break; + else if(b[i] < 0xc0) // UTF-8 continuation + break; + else if(b[i] < 0xe0) { // UTF-8 2-byte + // 2-byte UTF-8 + if(len < i+2) break; + i += 2; + } + else if(b[i] < 0xf0) { // UTF-8 3-byte + if(len < i+3) break; + i += 3; + } + else if(b[i] < 0xf8) { // UTF-8 4-byte + if(len < i+4) break; + i += 4; + } + else // otherwise invalid + break; + } + + printf("%.*s", i, b); + return i; +} + +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +static const char *name_c0[] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "LS0", "LS1", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", +}; +static const char *name_c1[] = { + NULL, NULL, "BPH", "NBH", NULL, "NEL", "SSA", "ESA", "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", + "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", "SOS", NULL, "SCI", "CSI", "ST", "OSC", "PM", "APC", +}; + +static int parser_control(unsigned char control, void *user) +{ + if(control < 0x20) + printf("%s%s%s", special_begin, name_c0[control], special_end); + else if(control >= 0x80 && control < 0xa0 && name_c1[control - 0x80]) + printf("%s%s%s", special_begin, name_c1[control - 0x80], special_end); + else + printf("%sCONTROL 0x%02x%s", special_begin, control, special_end); + + if(control == 0x0a) + printf("\n"); + return 1; +} + +static int parser_escape(const char bytes[], size_t len, void *user) +{ + if(bytes[0] >= 0x20 && bytes[0] < 0x30) { + if(len < 2) + return -1; + len = 2; + } + else { + len = 1; + } + + printf("%sESC %.*s%s", special_begin, (int)len, bytes, special_end); + + return len; +} + +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ +static const char *name_csi_plain[] = { + "ICH", "CUU", "CUD", "CUF", "CUB", "CNL", "CPL", "CHA", "CUP", "CHT", "ED", "EL", "IL", "DL", "EF", "EA", + "DCH", "SSE", "CPR", "SU", "SD", "NP", "PP", "CTC", "ECH", "CVT", "CBT", "SRS", "PTX", "SDS", "SIMD",NULL, + "HPA", "HPR", "REP", "DA", "VPA", "VPR", "HVP", "TBC", "SM", "MC", "HPB", "VPB", "RM", "SGR", "DSR", "DAQ", +}; + +/*0 4 8 B */ +static const int newline_csi_plain[] = { + 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, +}; + +static int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) +{ + const char *name = NULL; + if(!leader && !intermed && command < 0x70) + name = name_csi_plain[command - 0x40]; + else if(leader && streq(leader, "?") && !intermed) { + /* DEC */ + switch(command) { + case 'h': name = "DECSM"; break; + case 'l': name = "DECRM"; break; + } + if(name) + leader = NULL; + } + + if(!leader && !intermed && command < 0x70 && newline_csi_plain[command - 0x40]) + printf("\n"); + + if(name) + printf("%s%s", special_begin, name); + else + printf("%sCSI", special_begin); + + if(leader && leader[0]) + printf(" %s", leader); + + { + int i; + for(i = 0; i < argcount; i++) { + printf(i ? "," : " "); + } + + if(args[i] == CSI_ARG_MISSING) + printf("*"); + else { + while(CSI_ARG_HAS_MORE(args[i])) + printf("%ld+", CSI_ARG(args[i++])); + printf("%ld", CSI_ARG(args[i])); + } + } + + if(intermed && intermed[0]) + printf(" %s", intermed); + + if(name) + printf("%s", special_end); + else + printf(" %c%s", command, special_end); + + return 1; +} + +static int parser_osc(const char *command, size_t cmdlen, void *user) +{ + printf("%sOSC %.*s%s", special_begin, (int)cmdlen, command, special_end); + + return 1; +} + +static int parser_dcs(const char *command, size_t cmdlen, void *user) +{ + printf("%sDCS %.*s%s", special_begin, (int)cmdlen, command, special_end); + + return 1; +} + +static VTermParserCallbacks parser_cbs = { + &parser_text, /* text */ + &parser_control, /* control */ + &parser_escape, /* escape */ + &parser_csi, /* csi */ + &parser_osc, /* osc */ + &parser_dcs, /* dcs */ + NULL /* resize */ +}; + +int main(int argc, char *argv[]) +{ + int use_colour = isatty(1); + const char *file; + int fd; + VTerm *vt; + int len; + char buffer[1024]; + + int opt; + while((opt = getopt(argc, argv, "c")) != -1) { + switch(opt) { + case 'c': use_colour = 1; break; + } + } + + file = argv[optind++]; + + if(!file || streq(file, "-")) + fd = 0; // stdin + else { + fd = open(file, O_RDONLY); + if(fd == -1) { + fprintf(stderr, "Cannot open %s - %s\n", file, strerror(errno)); + exit(1); + } + } + + if(use_colour) { + special_begin = "\x1b[7m{"; + special_end = "}\x1b[m"; + } + + /* Size matters not for the parser */ + vt = vterm_new(25, 80); + vterm_set_utf8(vt, 1); + vterm_parser_set_callbacks(vt, &parser_cbs, NULL); + + while((len = read(fd, buffer, sizeof(buffer))) > 0) { + vterm_input_write(vt, buffer, len); + } + + printf("\n"); + + close(fd); + vterm_free(vt); + + return 0; +} diff --git a/src/libvterm/doc/URLs b/src/libvterm/doc/URLs new file mode 100644 index 0000000000..8380f5c727 --- /dev/null +++ b/src/libvterm/doc/URLs @@ -0,0 +1,14 @@ +ECMA-48: + http://www.ecma-international.org/publications/standards/Ecma-048.htm + +Xterm Control Sequences: + http://invisible-island.net/xterm/ctlseqs/ctlseqs.html + +Digital VT100 User Guide: + http://vt100.net/docs/vt100-ug/ + +Digital VT220 Programmer Reference Manual + http://vt100.net/docs/vt220-rm/ + +Summary of ANSI standards for ASCII terminals + http://www.inwap.com/pdp10/ansicode.txt diff --git a/src/libvterm/doc/seqs.txt b/src/libvterm/doc/seqs.txt new file mode 100644 index 0000000000..c26dc44990 --- /dev/null +++ b/src/libvterm/doc/seqs.txt @@ -0,0 +1,227 @@ +Sequences documented in parens are implicit ones from parser.c, which move +between states. + +1 = VT100 +2 = VT220 +3 = VT320 + + C0 controls + +123 0x00 = NUL +123 0x07 = BEL +123 0x08 = BS +123 0x09 = HT +123 0x0A = LF +123 0x0B = VT +123 0x0C = FF +123 0x0D = CR +123 0x0E = LS1 +123 0x0F = LS0 + (0x18 = CAN) + (0x1A = SUB) + (0x1B = ESC) + +123 0x7f = DEL (ignored) + + C1 controls + +123 0x84 = IND +123 0x85 = NEL +123 0x88 = HTS +123 0x8D = RI + 23 0x8e = SS2 + 23 0x8f = SS3 + (0x90 = DCS) + (0x9B = CSI) + (0x9C = ST) + (0x9D = OSC) + + Escape sequences + - excluding sequences that are C1 aliases + +123 ESC () = SCS, select character set (G0, G1) + 23 ESC *+ = SCS, select character set (G2, G3) +123 ESC 7 = DECSC - save cursor +123 ESC 8 = DECRC - restore cursor +123 ESC # 3 = DECDHL, double-height line (top half) +123 ESC # 4 = DECDHL, double-height line (bottom half) +123 ESC # 5 = DECSWL, single-width single-height line +123 ESC # 6 = DECDWL, double-width single-height line +123 ESC # 8 = DECALN +123 ESC < = Ignored (used by VT100 to exit VT52 mode) +123 ESC = = DECKPAM, keypad application mode +123 ESC > = DECKPNM, keypad numeric mode + 23 ESC Sp F = S7C1T + 23 ESC Sp G = S8C1T + (ESC P = DCS) + (ESC [ = CSI) + (ESC \ = ST) + (ESC ] = OSC) +123 ESC c = RIS, reset initial state + 3 ESC n = LS2 + 3 ESC o = LS3 + 3 ESC ~ = LS1R + 3 ESC } = LS2R + 3 ESC | = LS3R + + DCSes + + 3 DCS $ q ST = DECRQSS + 3 m = Request SGR + Sp q = Request DECSCUSR + 3 " q = Request DECSCA + 3 r = Request DECSTBM + s = Request DECSLRM + + CSIs + 23 CSI @ = ICH +123 CSI A = CUU +123 CSI B = CUD +123 CSI C = CUF +123 CSI D = CUB + CSI E = CNL + CSI F = CPL + CSI G = CHA +123 CSI H = CUP + CSI I = CHT +123 CSI J = ED + 23 CSI ? J = DECSED, selective erase in display +123 CSI K = EL + 23 CSI ? K = DECSEL, selective erase in line + 23 CSI L = IL + 23 CSI M = DL + 23 CSI P = DCH + CSI S = SU + CSI T = SD + 23 CSI X = ECH + CSI Z = CBT + CSI ` = HPA + CSI a = HPR +123 CSI c = DA, device attributes +123 0 = DA + 23 CSI > c = DECSDA + 23 0 = SDA + CSI d = VPA + CSI e = VPR +123 CSI f = HVP +123 CSI g = TBC +123 CSI h = SM, Set mode +123 CSI ? h = DECSM, DEC set mode + CSI j = HPB + CSI k = VPB +123 CSI l = RM, Reset mode +123 CSI ? l = DECRM, DEC reset mode +123 CSI m = SGR, Set Graphic Rendition +123 CSI n = DSR, Device Status Report + 23 5 = operating status + 23 6 = CPR = cursor position + 23 CSI ? n = DECDSR; behaves as DSR but uses CSI ? instead of CSI to respond + 23 CSI ! p = DECSTR, soft terminal reset + 3 CSI ? $ p = DECRQM, request mode + CSI Sp q = DECSCUSR (odd numbers blink, even numbers solid) + 1 or 2 = block + 3 or 4 = underline + 5 or 6 = I-beam to left + 23 CSI " q = DECSCA, select character attributes +123 CSI r = DECSTBM + CSI s = DECSLRM + CSI ' } = DECIC + CSI ' ~ = DECDC + + OSCs + + OSC 0; = Set icon name and title + OSC 1; = Set icon name + OSC 2; = Set title + + Standard modes + + 23 SM 4 = IRM +123 SM 20 = NLM, linefeed/newline + + DEC modes + +123 DECSM 1 = DECCKM, cursor keys +123 DECSM 5 = DECSCNM, screen +123 DECSM 6 = DECOM, origin +123 DECSM 7 = DECAWM, autowrap + DECSM 12 = Cursor blink + 23 DECSM 25 = DECTCEM, text cursor enable + DECSM 69 = DECVSSM, vertical screen split + DECSM 1000 = Mouse click/release tracking + DECSM 1002 = Mouse click/release/drag tracking + DECSM 1003 = Mouse all movements tracking + DECSM 1004 = Focus in/out reporting + DECSM 1005 = Mouse protocol extended (UTF-8) - not recommended + DECSM 1006 = Mouse protocol SGR + DECSM 1015 = Mouse protocol rxvt + DECSM 1047 = Altscreen + DECSM 1048 = Save cursor + DECSM 1049 = 1047 + 1048 + DECSM 2004 = Bracketed paste + + Graphic Renditions + +123 SGR 0 = Reset +123 SGR 1 = Bold on + SGR 3 = Italic on +123 SGR 4 = Underline single +123 SGR 5 = Blink on +123 SGR 7 = Reverse on + SGR 9 = Strikethrough on + SGR 10-19 = Select font + SGR 21 = Underline double + 23 SGR 22 = Bold off + SGR 23 = Italic off + 23 SGR 24 = Underline off + 23 SGR 25 = Blink off + 23 SGR 27 = Reverse off + SGR 29 = Strikethrough off + SGR 30-37 = Foreground ANSI + SGR 38 = Foreground alternative palette + SGR 39 = Foreground default + SGR 40-47 = Background ANSI + SGR 48 = Background alternative palette + SGR 49 = Background default + SGR 90-97 = Foreground ANSI high-intensity + SGR 100-107 = Background ANSI high-intensity + +The state storage used by ESC 7 and DECSM 1048/1049 is shared. + + Unimplemented sequences: + +The following sequences are not recognised by libvterm. + +123 0x05 = ENQ + 3 0x11 = DC1 (XON) + 3 0x13 = DC3 (XOFF) +12 ESC Z = DECID, identify terminal + DCS $ q = [DECRQSS] + 3 " p = Request DECSCL + 3 $ } = Request DECSASD + 3 $ ~ = Request DECSSDT + 23 DCS { = DECDLD, down-line-loadable character set + 23 DCS | = DECUDK, user-defined key + 23 CSI i = DEC printer control + 23 CSI " p = DECSCL, set compatibility level +1 CSI q = DECLL, load LEDs + 3 CSI $ u = DECRQTSR, request terminal state report + 3 1 = terminal state report + 3 CSI & u = DECRQUPSS, request user-preferred supplemental set + 3 CSI $ w = DECRQPSR, request presentation state report + 3 1 = cursor information report + 3 2 = tab stop report +1 CSI x = DECREQTPARM, request terminal parameters +123 CSI y = DECTST, invoke confidence test + 3 CSI $ } = DECSASD, select active status display + 3 CSI $ ~ = DECSSDT, select status line type + 23 SM 2 = KAM, keyboard action +123 SM 12 = SRM, send/receive +123 DECSM 2 = DECANM, ANSI/VT52 +123 DECSM 3 = DECCOLM, 132 column +123 DECSM 4 = DECSCLM, scrolling +123 DECSM 8 = DECARM, auto-repeat +12 DECSM 9 = DECINLM, interlace + 23 DECSM 18 = DECPFF, print form feed + 23 DECSM 19 = DECPEX, print extent + 23 DECSM 42 = DECNRCM, national/multinational character diff --git a/src/libvterm/include/vterm.h b/src/libvterm/include/vterm.h new file mode 100644 index 0000000000..3b77cd2d57 --- /dev/null +++ b/src/libvterm/include/vterm.h @@ -0,0 +1,435 @@ +/* + * NOTE: This is a MODIFIED version of libvterm, see the README file. + */ +#ifndef __VTERM_H__ +#define __VTERM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdlib.h> + +#include "vterm_keycodes.h" + +#define TRUE 1 +#define FALSE 0 + +/* from stdint.h */ +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; + +typedef struct VTerm VTerm; +typedef struct VTermState VTermState; +typedef struct VTermScreen VTermScreen; + +/* Specifies a screen point. */ +typedef struct { + int row; + int col; +} VTermPos; + +/* + * Some small utility functions; we can just keep these static here. + */ + +/* + * Order points by on-screen flow order: + * Return < 0 if "a" is before "b" + * Return 0 if "a" and "b" are equal + * Return > 0 if "a" is after "b". + */ +int vterm_pos_cmp(VTermPos a, VTermPos b); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE int vterm_pos_cmp(VTermPos a, VTermPos b) +{ + return (a.row == b.row) ? a.col - b.col : a.row - b.row; +} +#endif + +/* Specifies a rectangular screen area. */ +typedef struct { + int start_row; + int end_row; + int start_col; + int end_col; +} VTermRect; + +/* Return true if the rect "r" contains the point "p". */ +int vterm_rect_contains(VTermRect r, VTermPos p); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE int vterm_rect_contains(VTermRect r, VTermPos p) +{ + return p.row >= r.start_row && p.row < r.end_row && + p.col >= r.start_col && p.col < r.end_col; +} +#endif + +/* Move "rect" "row_delta" down and "col_delta" right. + * Does not check boundaries. */ +void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta) +{ + rect->start_row += row_delta; rect->end_row += row_delta; + rect->start_col += col_delta; rect->end_col += col_delta; +} +#endif + +/* The ansi_index is used for the lower 16 colors, which can be set to any + * color. */ +#define VTERM_ANSI_INDEX_DEFAULT 0 /* color cleared */ +#define VTERM_ANSI_INDEX_MIN 1 +#define VTERM_ANSI_INDEX_MAX 16 +#define VTERM_ANSI_INDEX_NONE 255 /* non-ANSI color, use red/green/blue */ + +typedef struct { + uint8_t red, green, blue; + uint8_t ansi_index; +} VTermColor; + +typedef enum { + /* VTERM_VALUETYPE_NONE = 0 */ + VTERM_VALUETYPE_BOOL = 1, + VTERM_VALUETYPE_INT, + VTERM_VALUETYPE_STRING, + VTERM_VALUETYPE_COLOR, + + VTERM_N_VALUETYPES +} VTermValueType; + +typedef union { + int boolean; + int number; + char *string; + VTermColor color; +} VTermValue; + +typedef enum { + /* VTERM_ATTR_NONE = 0 */ + VTERM_ATTR_BOLD = 1, // bool: 1, 22 + VTERM_ATTR_UNDERLINE, // number: 4, 21, 24 + VTERM_ATTR_ITALIC, // bool: 3, 23 + VTERM_ATTR_BLINK, // bool: 5, 25 + VTERM_ATTR_REVERSE, // bool: 7, 27 + VTERM_ATTR_STRIKE, // bool: 9, 29 + VTERM_ATTR_FONT, // number: 10-19 + VTERM_ATTR_FOREGROUND, // color: 30-39 90-97 + VTERM_ATTR_BACKGROUND, // color: 40-49 100-107 + + VTERM_N_ATTRS +} VTermAttr; + +typedef enum { + /* VTERM_PROP_NONE = 0 */ + VTERM_PROP_CURSORVISIBLE = 1, // bool + VTERM_PROP_CURSORBLINK, // bool + VTERM_PROP_ALTSCREEN, // bool + VTERM_PROP_TITLE, // string + VTERM_PROP_ICONNAME, // string + VTERM_PROP_REVERSE, // bool + VTERM_PROP_CURSORSHAPE, // number + VTERM_PROP_MOUSE, // number + VTERM_PROP_CURSORCOLOR, // string + + VTERM_N_PROPS +} VTermProp; + +enum { + VTERM_PROP_CURSORSHAPE_BLOCK = 1, + VTERM_PROP_CURSORSHAPE_UNDERLINE, + VTERM_PROP_CURSORSHAPE_BAR_LEFT, + + VTERM_N_PROP_CURSORSHAPES +}; + +enum { + VTERM_PROP_MOUSE_NONE = 0, + VTERM_PROP_MOUSE_CLICK, + VTERM_PROP_MOUSE_DRAG, + VTERM_PROP_MOUSE_MOVE, + + VTERM_N_PROP_MOUSES +}; + +typedef struct { + const uint32_t *chars; + int width; + unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */ + unsigned int dwl:1; /* DECDWL or DECDHL double-width line */ + unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */ +} VTermGlyphInfo; + +typedef struct { + unsigned int doublewidth:1; /* DECDWL or DECDHL line */ + unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */ +} VTermLineInfo; + +typedef struct { + /* libvterm relies on the allocated memory to be zeroed out before it is + * returned by the allocator. */ + void *(*malloc)(size_t size, void *allocdata); + void (*free)(void *ptr, void *allocdata); +} VTermAllocatorFunctions; + +/* Allocate and initialize a new terminal with default allocators. */ +VTerm *vterm_new(int rows, int cols); + +/* Allocate and initialize a new terminal with specified allocators. */ +VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata); + +/* Free and cleanup a terminal and all its data. */ +void vterm_free(VTerm* vt); + +/* Get the current size of the terminal and store in "rowsp" and "colsp". */ +void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp); + +void vterm_set_size(VTerm *vt, int rows, int cols); + +int vterm_get_utf8(const VTerm *vt); +void vterm_set_utf8(VTerm *vt, int is_utf8); + +size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len); + +size_t vterm_output_get_buffer_size(const VTerm *vt); +size_t vterm_output_get_buffer_current(const VTerm *vt); +size_t vterm_output_get_buffer_remaining(const VTerm *vt); + +size_t vterm_output_read(VTerm *vt, char *buffer, size_t len); + +void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod); +void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod); + +void vterm_keyboard_start_paste(VTerm *vt); +void vterm_keyboard_end_paste(VTerm *vt); + +void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod); +/* "button" is 1 for left, 2 for middle, 3 for right. + * Button 4 is scroll wheel down, button 5 is scroll wheel up. */ +void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod); + +// ------------ +// Parser layer +// ------------ + +/* Flag to indicate non-final subparameters in a single CSI parameter. + * Consider + * CSI 1;2:3:4;5a + * 1 4 and 5 are final. + * 2 and 3 are non-final and will have this bit set + * + * Don't confuse this with the final byte of the CSI escape; 'a' in this case. + */ +#define CSI_ARG_FLAG_MORE (1U<<31) +#define CSI_ARG_MASK (~(1U<<31)) + +#define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE) +#define CSI_ARG(a) ((a) & CSI_ARG_MASK) + +/* Can't use -1 to indicate a missing argument; use this instead */ +#define CSI_ARG_MISSING ((1<<30)-1) + +#define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING) +#define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a)) +#define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a)) + +typedef struct { + int (*text)(const char *bytes, size_t len, void *user); + int (*control)(unsigned char control, void *user); + int (*escape)(const char *bytes, size_t len, void *user); + int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); + int (*osc)(const char *command, size_t cmdlen, void *user); + int (*dcs)(const char *command, size_t cmdlen, void *user); + int (*resize)(int rows, int cols, void *user); +} VTermParserCallbacks; + +void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); +void *vterm_parser_get_cbdata(VTerm *vt); + +// ----------- +// State layer +// ----------- + +typedef struct { + int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user); + int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); + int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user); + int (*moverect)(VTermRect dest, VTermRect src, void *user); + int (*erase)(VTermRect rect, int selective, void *user); + int (*initpen)(void *user); + int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user); + /* Callback for setting various properties. Must return 1 if the property + * was accepted, 0 otherwise. */ + int (*settermprop)(VTermProp prop, VTermValue *val, void *user); + int (*bell)(void *user); + int (*resize)(int rows, int cols, VTermPos *delta, void *user); + int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user); +} VTermStateCallbacks; + +typedef struct { + VTermPos pos; + int buttons; +#define MOUSE_BUTTON_LEFT 0x01 +#define MOUSE_BUTTON_MIDDLE 0x02 +#define MOUSE_BUTTON_RIGHT 0x04 + int flags; +#define MOUSE_WANT_CLICK 0x01 +#define MOUSE_WANT_DRAG 0x02 +#define MOUSE_WANT_MOVE 0x04 + /* useful to add protocol? */ +} VTermMouseState; + +VTermState *vterm_obtain_state(VTerm *vt); + +void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user); +void *vterm_state_get_cbdata(VTermState *state); + +// Only invokes control, csi, osc, dcs +void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user); +void *vterm_state_get_unrecognised_fbdata(VTermState *state); + +/* Initialize the state. */ +void vterm_state_reset(VTermState *state, int hard); + +void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos); +void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate); +void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg); +void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col); +void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg); +void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col); +void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright); +int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val); +int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val); +void vterm_state_focus_in(VTermState *state); +void vterm_state_focus_out(VTermState *state); +const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row); + +// ------------ +// Screen layer +// ------------ + +typedef struct { + unsigned int bold : 1; + unsigned int underline : 2; + unsigned int italic : 1; + unsigned int blink : 1; + unsigned int reverse : 1; + unsigned int strike : 1; + unsigned int font : 4; /* 0 to 9 */ + unsigned int dwl : 1; /* On a DECDWL or DECDHL line */ + unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */ +} VTermScreenCellAttrs; + +typedef struct { +#define VTERM_MAX_CHARS_PER_CELL 6 + uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; + char width; + VTermScreenCellAttrs attrs; + VTermColor fg, bg; +} VTermScreenCell; + +/* All fields are optional, NULL when not used. */ +typedef struct { + int (*damage)(VTermRect rect, void *user); + int (*moverect)(VTermRect dest, VTermRect src, void *user); + int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); + int (*settermprop)(VTermProp prop, VTermValue *val, void *user); + int (*bell)(void *user); + int (*resize)(int rows, int cols, void *user); + /* A line was pushed off the top of the window. + * "cells[cols]" contains the cells of that line. + * Return value is unused. */ + int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user); + int (*sb_popline)(int cols, VTermScreenCell *cells, void *user); +} VTermScreenCallbacks; + +/* Return the screen of the vterm. */ +VTermScreen *vterm_obtain_screen(VTerm *vt); + +/* + * Install screen callbacks. These are invoked when the screen contents is + * changed. "user" is passed into to the callback. + */ +void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); +void *vterm_screen_get_cbdata(VTermScreen *screen); + +// Only invokes control, csi, osc, dcs +void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user); +void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); + +/* Enable support for using the alternate screen if "altscreen" is non-zero. + * Before that switching to the alternate screen won't work. + * Calling with "altscreen" zero has no effect. */ +void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen); + +typedef enum { + VTERM_DAMAGE_CELL, /* every cell */ + VTERM_DAMAGE_ROW, /* entire rows */ + VTERM_DAMAGE_SCREEN, /* entire screen */ + VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */ + + VTERM_N_DAMAGES +} VTermDamageSize; + +/* Invoke the relevant callbacks to update the screen. */ +void vterm_screen_flush_damage(VTermScreen *screen); + +void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size); + +/* + * Reset the screen. Also invokes vterm_state_reset(). + * Must be called before the terminal can be used. + */ +void vterm_screen_reset(VTermScreen *screen, int hard); + +/* Neither of these functions NUL-terminate the buffer */ +size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect); +size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect); + +typedef enum { + VTERM_ATTR_BOLD_MASK = 1 << 0, + VTERM_ATTR_UNDERLINE_MASK = 1 << 1, + VTERM_ATTR_ITALIC_MASK = 1 << 2, + VTERM_ATTR_BLINK_MASK = 1 << 3, + VTERM_ATTR_REVERSE_MASK = 1 << 4, + VTERM_ATTR_STRIKE_MASK = 1 << 5, + VTERM_ATTR_FONT_MASK = 1 << 6, + VTERM_ATTR_FOREGROUND_MASK = 1 << 7, + VTERM_ATTR_BACKGROUND_MASK = 1 << 8, + + VTERM_ALL_ATTRS_MASK = (1 << 9) - 1 +} VTermAttrMask; + +int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs); + +int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell); + +int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos); + +// --------- +// Utilities +// --------- + +VTermValueType vterm_get_attr_type(VTermAttr attr); +VTermValueType vterm_get_prop_type(VTermProp prop); + +void vterm_scroll_rect(VTermRect rect, + int downward, + int rightward, + int (*moverect)(VTermRect src, VTermRect dest, void *user), + int (*eraserect)(VTermRect rect, int selective, void *user), + void *user); + +void vterm_copy_cells(VTermRect dest, + VTermRect src, + void (*copycell)(VTermPos dest, VTermPos src, void *user), + void *user); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/libvterm/include/vterm_keycodes.h b/src/libvterm/include/vterm_keycodes.h new file mode 100644 index 0000000000..22bdf918b6 --- /dev/null +++ b/src/libvterm/include/vterm_keycodes.h @@ -0,0 +1,64 @@ +#ifndef __VTERM_INPUT_H__ +#define __VTERM_INPUT_H__ + +typedef enum { + VTERM_MOD_NONE = 0x00, + VTERM_MOD_SHIFT = 0x01, + VTERM_MOD_ALT = 0x02, + VTERM_MOD_CTRL = 0x04, + + VTERM_ALL_MODS_MASK = 0x07 +} VTermModifier; + +/* The order here must match keycodes[] in src/keyboard.c! */ +typedef enum { + VTERM_KEY_NONE, + + VTERM_KEY_ENTER, + VTERM_KEY_TAB, + VTERM_KEY_BACKSPACE, + VTERM_KEY_ESCAPE, + + VTERM_KEY_UP, + VTERM_KEY_DOWN, + VTERM_KEY_LEFT, + VTERM_KEY_RIGHT, + + VTERM_KEY_INS, + VTERM_KEY_DEL, + VTERM_KEY_HOME, + VTERM_KEY_END, + VTERM_KEY_PAGEUP, + VTERM_KEY_PAGEDOWN, + + /* F1 is VTERM_KEY_FUNCTION(1), F2 VTERM_KEY_FUNCTION(2), etc. */ + VTERM_KEY_FUNCTION_0 = 256, + VTERM_KEY_FUNCTION_MAX = VTERM_KEY_FUNCTION_0 + 255, + + /* keypad keys */ + VTERM_KEY_KP_0, + VTERM_KEY_KP_1, + VTERM_KEY_KP_2, + VTERM_KEY_KP_3, + VTERM_KEY_KP_4, + VTERM_KEY_KP_5, + VTERM_KEY_KP_6, + VTERM_KEY_KP_7, + VTERM_KEY_KP_8, + VTERM_KEY_KP_9, + VTERM_KEY_KP_MULT, + VTERM_KEY_KP_PLUS, + VTERM_KEY_KP_COMMA, + VTERM_KEY_KP_MINUS, + VTERM_KEY_KP_PERIOD, + VTERM_KEY_KP_DIVIDE, + VTERM_KEY_KP_ENTER, + VTERM_KEY_KP_EQUAL, + + VTERM_KEY_MAX, // Must be last + VTERM_N_KEYS = VTERM_KEY_MAX +} VTermKey; + +#define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n)) + +#endif diff --git a/src/libvterm/src/encoding.c b/src/libvterm/src/encoding.c new file mode 100644 index 0000000000..dbe129c1ed --- /dev/null +++ b/src/libvterm/src/encoding.c @@ -0,0 +1,234 @@ +#include "vterm_internal.h" + +#define UNICODE_INVALID 0xFFFD + +#if defined(DEBUG) && DEBUG > 1 +# define DEBUG_PRINT_UTF8 +#endif + +struct UTF8DecoderData { + // number of bytes remaining in this codepoint + int bytes_remaining; + + // number of bytes total in this codepoint once it's finished + // (for detecting overlongs) + int bytes_total; + + int this_cp; +}; + +static void init_utf8(VTermEncoding *enc UNUSED, void *data_) +{ + struct UTF8DecoderData *data = data_; + + data->bytes_remaining = 0; + data->bytes_total = 0; +} + +static void decode_utf8(VTermEncoding *enc UNUSED, void *data_, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + struct UTF8DecoderData *data = data_; + +#ifdef DEBUG_PRINT_UTF8 + printf("BEGIN UTF-8\n"); +#endif + + for(; *pos < bytelen && *cpi < cplen; (*pos)++) { + unsigned char c = bytes[*pos]; + +#ifdef DEBUG_PRINT_UTF8 + printf(" pos=%zd c=%02x rem=%d\n", *pos, c, data->bytes_remaining); +#endif + + if(c < 0x20) // C0 + return; + + else if(c >= 0x20 && c < 0x7f) { + if(data->bytes_remaining) { + data->bytes_remaining = 0; + cp[(*cpi)++] = UNICODE_INVALID; + if (*cpi >= cplen) + break; + } + cp[(*cpi)++] = c; +#ifdef DEBUG_PRINT_UTF8 + printf(" UTF-8 char: U+%04x\n", c); +#endif + } + + else if(c == 0x7f) // DEL + return; + + else if(c >= 0x80 && c < 0xc0) { + if(!data->bytes_remaining) { + cp[(*cpi)++] = UNICODE_INVALID; + continue; + } + + data->this_cp <<= 6; + data->this_cp |= c & 0x3f; + data->bytes_remaining--; + + if(!data->bytes_remaining) { +#ifdef DEBUG_PRINT_UTF8 + printf(" UTF-8 raw char U+%04x bytelen=%d ", data->this_cp, data->bytes_total); +#endif + // Check for overlong sequences + switch(data->bytes_total) { + case 2: + if(data->this_cp < 0x0080) data->this_cp = UNICODE_INVALID; + break; + case 3: + if(data->this_cp < 0x0800) data->this_cp = UNICODE_INVALID; + break; + case 4: + if(data->this_cp < 0x10000) data->this_cp = UNICODE_INVALID; + break; + case 5: + if(data->this_cp < 0x200000) data->this_cp = UNICODE_INVALID; + break; + case 6: + if(data->this_cp < 0x4000000) data->this_cp = UNICODE_INVALID; + break; + } + // Now look for plain invalid ones + if((data->this_cp >= 0xD800 && data->this_cp <= 0xDFFF) || + data->this_cp == 0xFFFE || + data->this_cp == 0xFFFF) + data->this_cp = UNICODE_INVALID; +#ifdef DEBUG_PRINT_UTF8 + printf(" char: U+%04x\n", data->this_cp); +#endif + cp[(*cpi)++] = data->this_cp; + } + } + + else if(c >= 0xc0 && c < 0xe0) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x1f; + data->bytes_total = 2; + data->bytes_remaining = 1; + } + + else if(c >= 0xe0 && c < 0xf0) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x0f; + data->bytes_total = 3; + data->bytes_remaining = 2; + } + + else if(c >= 0xf0 && c < 0xf8) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x07; + data->bytes_total = 4; + data->bytes_remaining = 3; + } + + else if(c >= 0xf8 && c < 0xfc) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x03; + data->bytes_total = 5; + data->bytes_remaining = 4; + } + + else if(c >= 0xfc && c < 0xfe) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x01; + data->bytes_total = 6; + data->bytes_remaining = 5; + } + + else { + cp[(*cpi)++] = UNICODE_INVALID; + } + } +} + +static VTermEncoding encoding_utf8 = { + &init_utf8, /* init */ + &decode_utf8 /* decode */ +}; + +static void decode_usascii(VTermEncoding *enc UNUSED, void *data UNUSED, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + int is_gr = bytes[*pos] & 0x80; + + for(; *pos < bytelen && *cpi < cplen; (*pos)++) { + unsigned char c = bytes[*pos] ^ is_gr; + + if(c < 0x20 || c == 0x7f || c >= 0x80) + return; + + cp[(*cpi)++] = c; + } +} + +static VTermEncoding encoding_usascii = { + NULL, /* init */ + &decode_usascii /* decode */ +}; + +struct StaticTableEncoding { + const VTermEncoding enc; + const uint32_t chars[128]; +}; + +static void decode_table(VTermEncoding *enc, void *data UNUSED, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + struct StaticTableEncoding *table = (struct StaticTableEncoding *)enc; + int is_gr = bytes[*pos] & 0x80; + + for(; *pos < bytelen && *cpi < cplen; (*pos)++) { + unsigned char c = bytes[*pos] ^ is_gr; + + if(c < 0x20 || c == 0x7f || c >= 0x80) + return; + + if(table->chars[c]) + cp[(*cpi)++] = table->chars[c]; + else + cp[(*cpi)++] = c; + } +} + +#include "encoding/DECdrawing.inc" +#include "encoding/uk.inc" + +static struct { + VTermEncodingType type; + char designation; + VTermEncoding *enc; +} +encodings[] = { + { ENC_UTF8, 'u', &encoding_utf8 }, + { ENC_SINGLE_94, '0', (VTermEncoding*)&encoding_DECdrawing }, + { ENC_SINGLE_94, 'A', (VTermEncoding*)&encoding_uk }, + { ENC_SINGLE_94, 'B', &encoding_usascii }, + { 0, 0, NULL }, +}; + +/* This ought to be INTERNAL but isn't because it's used by unit testing */ +VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation) +{ + int i; + for(i = 0; encodings[i].designation; i++) + if(encodings[i].type == type && encodings[i].designation == designation) + return encodings[i].enc; + return NULL; +} diff --git a/src/libvterm/src/encoding/DECdrawing.inc b/src/libvterm/src/encoding/DECdrawing.inc new file mode 100644 index 0000000000..978f98c183 --- /dev/null +++ b/src/libvterm/src/encoding/DECdrawing.inc @@ -0,0 +1,136 @@ +static const struct StaticTableEncoding encoding_DECdrawing = { + { + NULL, /* init */ + &decode_table /* decode */ + }, + { + 0x0, /* 0 */ + 0x0, /* 1 */ + 0x0, /* 2 */ + 0x0, /* 3 */ + 0x0, /* 4 */ + 0x0, /* 5 */ + 0x0, /* 6 */ + 0x0, /* 7 */ + 0x0, /* 8 */ + 0x0, /* 9 */ + 0x0, /* 10 */ + 0x0, /* 11 */ + 0x0, /* 12 */ + 0x0, /* 13 */ + 0x0, /* 14 */ + 0x0, /* 15 */ + 0x0, /* 16 */ + 0x0, /* 17 */ + 0x0, /* 18 */ + 0x0, /* 19 */ + 0x0, /* 20 */ + 0x0, /* 21 */ + 0x0, /* 22 */ + 0x0, /* 23 */ + 0x0, /* 24 */ + 0x0, /* 25 */ + 0x0, /* 26 */ + 0x0, /* 27 */ + 0x0, /* 28 */ + 0x0, /* 29 */ + 0x0, /* 30 */ + 0x0, /* 31 */ + 0x0, /* 32 */ + 0x0, /* 33 */ + 0x0, /* 34 */ + 0x0, /* 35 */ + 0x0, /* 36 */ + 0x0, /* 37 */ + 0x0, /* 38 */ + 0x0, /* 39 */ + 0x0, /* 40 */ + 0x0, /* 41 */ + 0x0, /* 42 */ + 0x0, /* 43 */ + 0x0, /* 44 */ + 0x0, /* 45 */ + 0x0, /* 46 */ + 0x0, /* 47 */ + 0x0, /* 48 */ + 0x0, /* 49 */ + 0x0, /* 50 */ + 0x0, /* 51 */ + 0x0, /* 52 */ + 0x0, /* 53 */ + 0x0, /* 54 */ + 0x0, /* 55 */ + 0x0, /* 56 */ + 0x0, /* 57 */ + 0x0, /* 58 */ + 0x0, /* 59 */ + 0x0, /* 60 */ + 0x0, /* 61 */ + 0x0, /* 62 */ + 0x0, /* 63 */ + 0x0, /* 64 */ + 0x0, /* 65 */ + 0x0, /* 66 */ + 0x0, /* 67 */ + 0x0, /* 68 */ + 0x0, /* 69 */ + 0x0, /* 70 */ + 0x0, /* 71 */ + 0x0, /* 72 */ + 0x0, /* 73 */ + 0x0, /* 74 */ + 0x0, /* 75 */ + 0x0, /* 76 */ + 0x0, /* 77 */ + 0x0, /* 78 */ + 0x0, /* 79 */ + 0x0, /* 80 */ + 0x0, /* 81 */ + 0x0, /* 82 */ + 0x0, /* 83 */ + 0x0, /* 84 */ + 0x0, /* 85 */ + 0x0, /* 86 */ + 0x0, /* 87 */ + 0x0, /* 88 */ + 0x0, /* 89 */ + 0x0, /* 90 */ + 0x0, /* 91 */ + 0x0, /* 92 */ + 0x0, /* 93 */ + 0x0, /* 94 */ + 0x0, /* 95 */ + 0x25C6, /* 96 */ + 0x2592, /* 97 */ + 0x2409, /* 98 */ + 0x240C, /* 99 */ + 0x240D, /* 100 */ + 0x240A, /* 101 */ + 0x00B0, /* 102 */ + 0x00B1, /* 103 */ + 0x2424, /* 104 */ + 0x240B, /* 105 */ + 0x2518, /* 106 */ + 0x2510, /* 107 */ + 0x250C, /* 108 */ + 0x2514, /* 109 */ + 0x253C, /* 110 */ + 0x23BA, /* 111 */ + 0x23BB, /* 112 */ + 0x2500, /* 113 */ + 0x23BC, /* 114 */ + 0x23BD, /* 115 */ + 0x251C, /* 116 */ + 0x2524, /* 117 */ + 0x2534, /* 118 */ + 0x252C, /* 119 */ + 0x2502, /* 120 */ + 0x2A7D, /* 121 */ + 0x2A7E, /* 122 */ + 0x03C0, /* 123 */ + 0x2260, /* 124 */ + 0x00A3, /* 125 */ + 0x00B7, /* 126 */ + 0x0, /* 127 */ + } +}; diff --git a/src/libvterm/src/encoding/DECdrawing.tbl b/src/libvterm/src/encoding/DECdrawing.tbl new file mode 100644 index 0000000000..6e19c5066e --- /dev/null +++ b/src/libvterm/src/encoding/DECdrawing.tbl @@ -0,0 +1,31 @@ +6/0 = U+25C6 # BLACK DIAMOND +6/1 = U+2592 # MEDIUM SHADE (checkerboard) +6/2 = U+2409 # SYMBOL FOR HORIZONTAL TAB +6/3 = U+240C # SYMBOL FOR FORM FEED +6/4 = U+240D # SYMBOL FOR CARRIAGE RETURN +6/5 = U+240A # SYMBOL FOR LINE FEED +6/6 = U+00B0 # DEGREE SIGN +6/7 = U+00B1 # PLUS-MINUS SIGN (plus or minus) +6/8 = U+2424 # SYMBOL FOR NEW LINE +6/9 = U+240B # SYMBOL FOR VERTICAL TAB +6/10 = U+2518 # BOX DRAWINGS LIGHT UP AND LEFT (bottom-right corner) +6/11 = U+2510 # BOX DRAWINGS LIGHT DOWN AND LEFT (top-right corner) +6/12 = U+250C # BOX DRAWINGS LIGHT DOWN AND RIGHT (top-left corner) +6/13 = U+2514 # BOX DRAWINGS LIGHT UP AND RIGHT (bottom-left corner) +6/14 = U+253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL (crossing lines) +6/15 = U+23BA # HORIZONTAL SCAN LINE-1 +7/0 = U+23BB # HORIZONTAL SCAN LINE-3 +7/1 = U+2500 # BOX DRAWINGS LIGHT HORIZONTAL +7/2 = U+23BC # HORIZONTAL SCAN LINE-7 +7/3 = U+23BD # HORIZONTAL SCAN LINE-9 +7/4 = U+251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT +7/5 = U+2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT +7/6 = U+2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL +7/7 = U+252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +7/8 = U+2502 # BOX DRAWINGS LIGHT VERTICAL +7/9 = U+2A7D # LESS-THAN OR SLANTED EQUAL-TO +7/10 = U+2A7E # GREATER-THAN OR SLANTED EQUAL-TO +7/11 = U+03C0 # GREEK SMALL LETTER PI +7/12 = U+2260 # NOT EQUAL TO +7/13 = U+00A3 # POUND SIGN +7/14 = U+00B7 # MIDDLE DOT diff --git a/src/libvterm/src/encoding/uk.inc b/src/libvterm/src/encoding/uk.inc new file mode 100644 index 0000000000..49ced5a213 --- /dev/null +++ b/src/libvterm/src/encoding/uk.inc @@ -0,0 +1,136 @@ +static const struct StaticTableEncoding encoding_uk = { + { + NULL, /* init */ + &decode_table /* decode */ + }, + { + 0x0, /* 0 */ + 0x0, /* 1 */ + 0x0, /* 2 */ + 0x0, /* 3 */ + 0x0, /* 4 */ + 0x0, /* 5 */ + 0x0, /* 6 */ + 0x0, /* 7 */ + 0x0, /* 8 */ + 0x0, /* 9 */ + 0x0, /* 10 */ + 0x0, /* 11 */ + 0x0, /* 12 */ + 0x0, /* 13 */ + 0x0, /* 14 */ + 0x0, /* 15 */ + 0x0, /* 16 */ + 0x0, /* 17 */ + 0x0, /* 18 */ + 0x0, /* 19 */ + 0x0, /* 20 */ + 0x0, /* 21 */ + 0x0, /* 22 */ + 0x0, /* 23 */ + 0x0, /* 24 */ + 0x0, /* 25 */ + 0x0, /* 26 */ + 0x0, /* 27 */ + 0x0, /* 28 */ + 0x0, /* 29 */ + 0x0, /* 30 */ + 0x0, /* 31 */ + 0x0, /* 32 */ + 0x0, /* 33 */ + 0x0, /* 34 */ + 0x00a3, /* 35 */ + 0x0, /* 36 */ + 0x0, /* 37 */ + 0x0, /* 38 */ + 0x0, /* 39 */ + 0x0, /* 40 */ + 0x0, /* 41 */ + 0x0, /* 42 */ + 0x0, /* 43 */ + 0x0, /* 44 */ + 0x0, /* 45 */ + 0x0, /* 46 */ + 0x0, /* 47 */ + 0x0, /* 48 */ + 0x0, /* 49 */ + 0x0, /* 50 */ + 0x0, /* 51 */ + 0x0, /* 52 */ + 0x0, /* 53 */ + 0x0, /* 54 */ + 0x0, /* 55 */ + 0x0, /* 56 */ + 0x0, /* 57 */ + 0x0, /* 58 */ + 0x0, /* 59 */ + 0x0, /* 60 */ + 0x0, /* 61 */ + 0x0, /* 62 */ + 0x0, /* 63 */ + 0x0, /* 64 */ + 0x0, /* 65 */ + 0x0, /* 66 */ + 0x0, /* 67 */ + 0x0, /* 68 */ + 0x0, /* 69 */ + 0x0, /* 70 */ + 0x0, /* 71 */ + 0x0, /* 72 */ + 0x0, /* 73 */ + 0x0, /* 74 */ + 0x0, /* 75 */ + 0x0, /* 76 */ + 0x0, /* 77 */ + 0x0, /* 78 */ + 0x0, /* 79 */ + 0x0, /* 80 */ + 0x0, /* 81 */ + 0x0, /* 82 */ + 0x0, /* 83 */ + 0x0, /* 84 */ + 0x0, /* 85 */ + 0x0, /* 86 */ + 0x0, /* 87 */ + 0x0, /* 88 */ + 0x0, /* 89 */ + 0x0, /* 90 */ + 0x0, /* 91 */ + 0x0, /* 92 */ + 0x0, /* 93 */ + 0x0, /* 94 */ + 0x0, /* 95 */ + 0x0, /* 96 */ + 0x0, /* 97 */ + 0x0, /* 98 */ + 0x0, /* 99 */ + 0x0, /* 100 */ + 0x0, /* 101 */ + 0x0, /* 102 */ + 0x0, /* 103 */ + 0x0, /* 104 */ + 0x0, /* 105 */ + 0x0, /* 106 */ + 0x0, /* 107 */ + 0x0, /* 108 */ + 0x0, /* 109 */ + 0x0, /* 110 */ + 0x0, /* 111 */ + 0x0, /* 112 */ + 0x0, /* 113 */ + 0x0, /* 114 */ + 0x0, /* 115 */ + 0x0, /* 116 */ + 0x0, /* 117 */ + 0x0, /* 118 */ + 0x0, /* 119 */ + 0x0, /* 120 */ + 0x0, /* 121 */ + 0x0, /* 122 */ + 0x0, /* 123 */ + 0x0, /* 124 */ + 0x0, /* 125 */ + 0x0, /* 126 */ + 0x0, /* 127 */ + } +}; diff --git a/src/libvterm/src/encoding/uk.tbl b/src/libvterm/src/encoding/uk.tbl new file mode 100644 index 0000000000..b27b1a2193 --- /dev/null +++ b/src/libvterm/src/encoding/uk.tbl @@ -0,0 +1 @@ +2/3 = "£" diff --git a/src/libvterm/src/keyboard.c b/src/libvterm/src/keyboard.c new file mode 100644 index 0000000000..8cc781f305 --- /dev/null +++ b/src/libvterm/src/keyboard.c @@ -0,0 +1,229 @@ +#include "vterm_internal.h" + +#include <stdio.h> + +#include "utf8.h" + +void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod) +{ + int needs_CSIu; + + /* The shift modifier is never important for Unicode characters + * apart from Space + */ + if(c != ' ') + mod &= ~VTERM_MOD_SHIFT; + + if(mod == 0) { + // Normal text - ignore just shift + char str[6]; + int seqlen = fill_utf8(c, str); + vterm_push_output_bytes(vt, str, seqlen); + return; + } + + switch(c) { + /* Special Ctrl- letters that can't be represented elsewise */ + case 'i': case 'j': case 'm': case '[': + needs_CSIu = 1; + break; + /* Ctrl-\ ] ^ _ don't need CSUu */ + case '\\': case ']': case '^': case '_': + needs_CSIu = 0; + break; + /* Shift-space needs CSIu */ + case ' ': + needs_CSIu = !!(mod & VTERM_MOD_SHIFT); + break; + /* All other characters needs CSIu except for letters a-z */ + default: + needs_CSIu = (c < 'a' || c > 'z'); + } + + /* ALT we can just prefix with ESC; anything else requires CSI u */ + if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) { + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1); + return; + } + + if(mod & VTERM_MOD_CTRL) + c &= 0x1f; + + vterm_push_output_sprintf(vt, "%s%c", mod & VTERM_MOD_ALT ? ESC_S : "", c); +} + +typedef struct { + enum { + KEYCODE_NONE, + KEYCODE_LITERAL, + KEYCODE_TAB, + KEYCODE_ENTER, + KEYCODE_SS3, + KEYCODE_CSI, + KEYCODE_CSI_CURSOR, + KEYCODE_CSINUM, + KEYCODE_KEYPAD, + } type; + char literal; + int csinum; +} keycodes_s; + +/* Order here must be exactly the same as VTermKey enum! */ +static keycodes_s keycodes[] = { + { KEYCODE_NONE, 0, 0 }, // NONE + + { KEYCODE_ENTER, '\r', 0 }, // ENTER + { KEYCODE_TAB, '\t', 0 }, // TAB + { KEYCODE_LITERAL, '\x7f', 0 }, // BACKSPACE == ASCII DEL + { KEYCODE_LITERAL, '\x1b', 0 }, // ESCAPE + + { KEYCODE_CSI_CURSOR, 'A', 0 }, // UP + { KEYCODE_CSI_CURSOR, 'B', 0 }, // DOWN + { KEYCODE_CSI_CURSOR, 'D', 0 }, // LEFT + { KEYCODE_CSI_CURSOR, 'C', 0 }, // RIGHT + + { KEYCODE_CSINUM, '~', 2 }, // INS + { KEYCODE_CSINUM, '~', 3 }, // DEL + { KEYCODE_CSI_CURSOR, 'H', 0 }, // HOME + { KEYCODE_CSI_CURSOR, 'F', 0 }, // END + { KEYCODE_CSINUM, '~', 5 }, // PAGEUP + { KEYCODE_CSINUM, '~', 6 }, // PAGEDOWN +}; + +static keycodes_s keycodes_fn[] = { + { KEYCODE_NONE, 0, 0 }, // F0 - shouldn't happen + { KEYCODE_CSI_CURSOR, 'P', 0 }, // F1 + { KEYCODE_CSI_CURSOR, 'Q', 0 }, // F2 + { KEYCODE_CSI_CURSOR, 'R', 0 }, // F3 + { KEYCODE_CSI_CURSOR, 'S', 0 }, // F4 + { KEYCODE_CSINUM, '~', 15 }, // F5 + { KEYCODE_CSINUM, '~', 17 }, // F6 + { KEYCODE_CSINUM, '~', 18 }, // F7 + { KEYCODE_CSINUM, '~', 19 }, // F8 + { KEYCODE_CSINUM, '~', 20 }, // F9 + { KEYCODE_CSINUM, '~', 21 }, // F10 + { KEYCODE_CSINUM, '~', 23 }, // F11 + { KEYCODE_CSINUM, '~', 24 }, // F12 +}; + +static keycodes_s keycodes_kp[] = { + { KEYCODE_KEYPAD, '0', 'p' }, // KP_0 + { KEYCODE_KEYPAD, '1', 'q' }, // KP_1 + { KEYCODE_KEYPAD, '2', 'r' }, // KP_2 + { KEYCODE_KEYPAD, '3', 's' }, // KP_3 + { KEYCODE_KEYPAD, '4', 't' }, // KP_4 + { KEYCODE_KEYPAD, '5', 'u' }, // KP_5 + { KEYCODE_KEYPAD, '6', 'v' }, // KP_6 + { KEYCODE_KEYPAD, '7', 'w' }, // KP_7 + { KEYCODE_KEYPAD, '8', 'x' }, // KP_8 + { KEYCODE_KEYPAD, '9', 'y' }, // KP_9 + { KEYCODE_KEYPAD, '*', 'j' }, // KP_MULT + { KEYCODE_KEYPAD, '+', 'k' }, // KP_PLUS + { KEYCODE_KEYPAD, ',', 'l' }, // KP_COMMA + { KEYCODE_KEYPAD, '-', 'm' }, // KP_MINUS + { KEYCODE_KEYPAD, '.', 'n' }, // KP_PERIOD + { KEYCODE_KEYPAD, '/', 'o' }, // KP_DIVIDE + { KEYCODE_KEYPAD, '\n', 'M' }, // KP_ENTER + { KEYCODE_KEYPAD, '=', 'X' }, // KP_EQUAL +}; + +void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod) +{ + keycodes_s k; + + if(key == VTERM_KEY_NONE) + return; + + if(key < VTERM_KEY_FUNCTION_0) { + if(key >= sizeof(keycodes)/sizeof(keycodes[0])) + return; + k = keycodes[key]; + } + else if(key >= VTERM_KEY_FUNCTION_0 && key <= VTERM_KEY_FUNCTION_MAX) { + if((key - VTERM_KEY_FUNCTION_0) >= sizeof(keycodes_fn)/sizeof(keycodes_fn[0])) + return; + k = keycodes_fn[key - VTERM_KEY_FUNCTION_0]; + } + else if(key >= VTERM_KEY_KP_0) { + if((key - VTERM_KEY_KP_0) >= sizeof(keycodes_kp)/sizeof(keycodes_kp[0])) + return; + k = keycodes_kp[key - VTERM_KEY_KP_0]; + } + + switch(k.type) { + case KEYCODE_NONE: + break; + + case KEYCODE_TAB: + /* Shift-Tab is CSI Z but plain Tab is 0x09 */ + if(mod == VTERM_MOD_SHIFT) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "Z"); + else if(mod & VTERM_MOD_SHIFT) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%dZ", mod+1); + else + goto case_LITERAL; + break; + + case KEYCODE_ENTER: + /* Enter is CRLF in newline mode, but just LF in linefeed */ + if(vt->state->mode.newline) + vterm_push_output_sprintf(vt, "\r\n"); + else + goto case_LITERAL; + break; + + case KEYCODE_LITERAL: case_LITERAL: + if(mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL)) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", k.literal, mod+1); + else + vterm_push_output_sprintf(vt, mod & VTERM_MOD_ALT ? ESC_S "%c" : "%c", k.literal); + break; + + case KEYCODE_SS3: case_SS3: + if(mod == 0) + vterm_push_output_sprintf_ctrl(vt, C1_SS3, "%c", k.literal); + else + goto case_CSI; + break; + + case KEYCODE_CSI: case_CSI: + if(mod == 0) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%c", k.literal); + else + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%d%c", mod + 1, k.literal); + break; + + case KEYCODE_CSINUM: + if(mod == 0) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d%c", k.csinum, k.literal); + else + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%d%c", k.csinum, mod + 1, k.literal); + break; + + case KEYCODE_CSI_CURSOR: + if(vt->state->mode.cursor) + goto case_SS3; + else + goto case_CSI; + + case KEYCODE_KEYPAD: + if(vt->state->mode.keypad) { + k.literal = k.csinum; + goto case_SS3; + } + else + goto case_LITERAL; + } +} + +void vterm_keyboard_start_paste(VTerm *vt) +{ + if(vt->state->mode.bracketpaste) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "200~"); +} + +void vterm_keyboard_end_paste(VTerm *vt) +{ + if(vt->state->mode.bracketpaste) + vterm_push_output_sprintf_ctrl(vt, C1_CSI, "201~"); +} diff --git a/src/libvterm/src/mouse.c b/src/libvterm/src/mouse.c new file mode 100644 index 0000000000..4e363134eb --- /dev/null +++ b/src/libvterm/src/mouse.c @@ -0,0 +1,98 @@ +#include "vterm_internal.h" + +#include "utf8.h" + +static void output_mouse(VTermState *state, int code, int pressed, int modifiers, int col, int row) +{ + modifiers <<= 2; + + switch(state->mouse_protocol) { + case MOUSE_X10: + if(col + 0x21 > 0xff) + col = 0xff - 0x21; + if(row + 0x21 > 0xff) + row = 0xff - 0x21; + + if(!pressed) + code = 3; + + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%c%c%c", + (code | modifiers) + 0x20, col + 0x21, row + 0x21); + break; + + case MOUSE_UTF8: + { + char utf8[18]; size_t len = 0; + + if(!pressed) + code = 3; + + len += fill_utf8((code | modifiers) + 0x20, utf8 + len); + len += fill_utf8(col + 0x21, utf8 + len); + len += fill_utf8(row + 0x21, utf8 + len); + utf8[len] = 0; + + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%s", utf8); + } + break; + + case MOUSE_SGR: + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "<%d;%d;%d%c", + code | modifiers, col + 1, row + 1, pressed ? 'M' : 'm'); + break; + + case MOUSE_RXVT: + if(!pressed) + code = 3; + + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%d;%d;%dM", + code | modifiers, col + 1, row + 1); + break; + } +} + +void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod) +{ + VTermState *state = vt->state; + + if(col == state->mouse_col && row == state->mouse_row) + return; + + state->mouse_col = col; + state->mouse_row = row; + + if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) || + (state->mouse_flags & MOUSE_WANT_MOVE)) { + int button = state->mouse_buttons & MOUSE_BUTTON_LEFT ? 1 : + state->mouse_buttons & MOUSE_BUTTON_MIDDLE ? 2 : + state->mouse_buttons & MOUSE_BUTTON_RIGHT ? 3 : 4; + output_mouse(state, button-1 + 0x20, 1, mod, col, row); + } +} + +void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod) +{ + VTermState *state = vt->state; + + int old_buttons = state->mouse_buttons; + + if(button > 0 && button <= 3) { + if(pressed) + state->mouse_buttons |= (1 << (button-1)); + else + state->mouse_buttons &= ~(1 << (button-1)); + } + + /* Most of the time we don't get button releases from 4/5 */ + if(state->mouse_buttons == old_buttons && button < 4) + return; + if (!(state->mouse_flags & MOUSE_WANT_CLICK)) + return; + + if(button < 4) { + output_mouse(state, button-1, pressed, mod, state->mouse_col, state->mouse_row); + } + else if(button < 6) { + output_mouse(state, button-4 + 0x40, pressed, mod, state->mouse_col, state->mouse_row); + } +} diff --git a/src/libvterm/src/parser.c b/src/libvterm/src/parser.c new file mode 100644 index 0000000000..db45692d59 --- /dev/null +++ b/src/libvterm/src/parser.c @@ -0,0 +1,346 @@ +#include "vterm_internal.h" + +#include <stdio.h> +#include <string.h> + +#undef DEBUG_PARSER + +static int is_intermed(unsigned char c) +{ + return c >= 0x20 && c <= 0x2f; +} + +static void do_control(VTerm *vt, unsigned char control) +{ + if(vt->parser.callbacks && vt->parser.callbacks->control) + if((*vt->parser.callbacks->control)(control, vt->parser.cbdata)) + return; + + DEBUG_LOG1("libvterm: Unhandled control 0x%02x\n", control); +} + +static void do_csi(VTerm *vt, char command) +{ +#ifdef DEBUG_PARSER + printf("Parsed CSI args as:\n", arglen, args); + printf(" leader: %s\n", vt->parser.csi_leader); + for(int argi = 0; argi < vt->parser.csi_argi; argi++) { + printf(" %lu", CSI_ARG(vt->parser.csi_args[argi])); + if(!CSI_ARG_HAS_MORE(vt->parser.csi_args[argi])) + printf("\n"); + printf(" intermed: %s\n", vt->parser.intermed); + } +#endif + + if(vt->parser.callbacks && vt->parser.callbacks->csi) + if((*vt->parser.callbacks->csi)( + vt->parser.csi_leaderlen ? vt->parser.csi_leader : NULL, + vt->parser.csi_args, + vt->parser.csi_argi, + vt->parser.intermedlen ? vt->parser.intermed : NULL, + command, + vt->parser.cbdata)) + return; + + DEBUG_LOG1("libvterm: Unhandled CSI %c\n", command); +} + +static void do_escape(VTerm *vt, char command) +{ + char seq[INTERMED_MAX+1]; + + size_t len = vt->parser.intermedlen; + strncpy(seq, vt->parser.intermed, len); + seq[len++] = command; + seq[len] = 0; + + if(vt->parser.callbacks && vt->parser.callbacks->escape) + if((*vt->parser.callbacks->escape)(seq, len, vt->parser.cbdata)) + return; + + DEBUG_LOG1("libvterm: Unhandled escape ESC 0x%02x\n", command); +} + +static void append_strbuffer(VTerm *vt, const char *str, size_t len) +{ + if(len > vt->parser.strbuffer_len - vt->parser.strbuffer_cur) { + len = vt->parser.strbuffer_len - vt->parser.strbuffer_cur; + DEBUG_LOG1("Truncating strbuffer preserve to %zd bytes\n", len); + } + + if(len > 0) { + strncpy(vt->parser.strbuffer + vt->parser.strbuffer_cur, str, len); + vt->parser.strbuffer_cur += len; + } +} + +static void start_string(VTerm *vt, VTermParserStringType type) +{ + vt->parser.stringtype = type; + + vt->parser.strbuffer_cur = 0; +} + +static void more_string(VTerm *vt, const char *str, size_t len) +{ + append_strbuffer(vt, str, len); +} + +static void done_string(VTerm *vt, const char *str, size_t len) +{ + if(vt->parser.strbuffer_cur) { + if(str) + append_strbuffer(vt, str, len); + + str = vt->parser.strbuffer; + len = vt->parser.strbuffer_cur; + } + else if(!str) { + DEBUG_LOG("parser.c: TODO: No strbuffer _and_ no final fragment???\n"); + len = 0; + } + + switch(vt->parser.stringtype) { + case VTERM_PARSER_OSC: + if(vt->parser.callbacks && vt->parser.callbacks->osc) + if((*vt->parser.callbacks->osc)(str, len, vt->parser.cbdata)) + return; + + DEBUG_LOG2("libvterm: Unhandled OSC %.*s\n", (int)len, str); + return; + + case VTERM_PARSER_DCS: + if(vt->parser.callbacks && vt->parser.callbacks->dcs) + if((*vt->parser.callbacks->dcs)(str, len, vt->parser.cbdata)) + return; + + DEBUG_LOG2("libvterm: Unhandled DCS %.*s\n", (int)len, str); + return; + + case VTERM_N_PARSER_TYPES: + return; + } +} + +size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len) +{ + size_t pos = 0; + const char *string_start = NULL; /* init to avoid gcc warning */ + + switch(vt->parser.state) { + case NORMAL: + case CSI_LEADER: + case CSI_ARGS: + case CSI_INTERMED: + case ESC: + string_start = NULL; + break; + case STRING: + case ESC_IN_STRING: + string_start = bytes; + break; + } + +#define ENTER_STRING_STATE() do { vt->parser.state = STRING; string_start = bytes + pos + 1; } while(0) +#define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0) +#define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL) + + for( ; pos < len; pos++) { + unsigned char c = bytes[pos]; + + if(c == 0x00 || c == 0x7f) { // NUL, DEL + if(vt->parser.state >= STRING) { + more_string(vt, string_start, bytes + pos - string_start); + string_start = bytes + pos + 1; + } + continue; + } + if(c == 0x18 || c == 0x1a) { // CAN, SUB + ENTER_NORMAL_STATE(); + continue; + } + else if(c == 0x1b) { // ESC + vt->parser.intermedlen = 0; + if(vt->parser.state == STRING) + vt->parser.state = ESC_IN_STRING; + else + ENTER_STATE(ESC); + continue; + } + else if(c == 0x07 && // BEL, can stand for ST in OSC or DCS state + vt->parser.state == STRING) { + // fallthrough + } + else if(c < 0x20) { // other C0 + if(vt->parser.state >= STRING) + more_string(vt, string_start, bytes + pos - string_start); + do_control(vt, c); + if(vt->parser.state >= STRING) + string_start = bytes + pos + 1; + continue; + } + // else fallthrough + + switch(vt->parser.state) { + case ESC_IN_STRING: + if(c == 0x5c) { // ST + vt->parser.state = STRING; + done_string(vt, string_start, bytes + pos - string_start - 1); + ENTER_NORMAL_STATE(); + break; + } + vt->parser.state = ESC; + // else fallthrough + + case ESC: + switch(c) { + case 0x50: // DCS + start_string(vt, VTERM_PARSER_DCS); + ENTER_STRING_STATE(); + break; + case 0x5b: // CSI + vt->parser.csi_leaderlen = 0; + ENTER_STATE(CSI_LEADER); + break; + case 0x5d: // OSC + start_string(vt, VTERM_PARSER_OSC); + ENTER_STRING_STATE(); + break; + default: + if(is_intermed(c)) { + if(vt->parser.intermedlen < INTERMED_MAX-1) + vt->parser.intermed[vt->parser.intermedlen++] = c; + } + else if(!vt->parser.intermedlen && c >= 0x40 && c < 0x60) { + do_control(vt, c + 0x40); + ENTER_NORMAL_STATE(); + } + else if(c >= 0x30 && c < 0x7f) { + do_escape(vt, c); + ENTER_NORMAL_STATE(); + } + else { + DEBUG_LOG1("TODO: Unhandled byte %02x in Escape\n", c); + } + } + break; + + case CSI_LEADER: + /* Extract leader bytes 0x3c to 0x3f */ + if(c >= 0x3c && c <= 0x3f) { + if(vt->parser.csi_leaderlen < CSI_LEADER_MAX-1) + vt->parser.csi_leader[vt->parser.csi_leaderlen++] = c; + break; + } + + /* else fallthrough */ + vt->parser.csi_leader[vt->parser.csi_leaderlen] = 0; + + vt->parser.csi_argi = 0; + vt->parser.csi_args[0] = CSI_ARG_MISSING; + vt->parser.state = CSI_ARGS; + + /* fallthrough */ + case CSI_ARGS: + /* Numerical value of argument */ + if(c >= '0' && c <= '9') { + if(vt->parser.csi_args[vt->parser.csi_argi] == CSI_ARG_MISSING) + vt->parser.csi_args[vt->parser.csi_argi] = 0; + vt->parser.csi_args[vt->parser.csi_argi] *= 10; + vt->parser.csi_args[vt->parser.csi_argi] += c - '0'; + break; + } + if(c == ':') { + vt->parser.csi_args[vt->parser.csi_argi] |= CSI_ARG_FLAG_MORE; + c = ';'; + } + if(c == ';') { + vt->parser.csi_argi++; + vt->parser.csi_args[vt->parser.csi_argi] = CSI_ARG_MISSING; + break; + } + + /* else fallthrough */ + vt->parser.csi_argi++; + vt->parser.intermedlen = 0; + vt->parser.state = CSI_INTERMED; + /* fallthrough */ + case CSI_INTERMED: + if(is_intermed(c)) { + if(vt->parser.intermedlen < INTERMED_MAX-1) + vt->parser.intermed[vt->parser.intermedlen++] = c; + break; + } + else if(c == 0x1b) { + /* ESC in CSI cancels */ + } + else if(c >= 0x40 && c <= 0x7e) { + vt->parser.intermed[vt->parser.intermedlen] = 0; + do_csi(vt, c); + } + /* else was invalid CSI */ + + ENTER_NORMAL_STATE(); + break; + + case STRING: + if(c == 0x07 || (c == 0x9c && !vt->mode.utf8)) { + done_string(vt, string_start, bytes + pos - string_start); + ENTER_NORMAL_STATE(); + } + else if (pos + 1 == len) { + /* end of input but OSC string isn't finished yet, copy it to + * vt->parser.strbuffer to continue it later */ + more_string(vt, string_start, bytes + pos + 1 - string_start); + } + break; + + case NORMAL: + if(c >= 0x80 && c < 0xa0 && !vt->mode.utf8) { + switch(c) { + case 0x90: // DCS + start_string(vt, VTERM_PARSER_DCS); + ENTER_STRING_STATE(); + break; + case 0x9b: // CSI + ENTER_STATE(CSI_LEADER); + break; + case 0x9d: // OSC + start_string(vt, VTERM_PARSER_OSC); + ENTER_STRING_STATE(); + break; + default: + do_control(vt, c); + break; + } + } + else { + size_t eaten = 0; + if(vt->parser.callbacks && vt->parser.callbacks->text) + eaten = (*vt->parser.callbacks->text)(bytes + pos, len - pos, vt->parser.cbdata); + + if(!eaten) { + DEBUG_LOG("libvterm: Text callback did not consume any input\n"); + /* force it to make progress */ + eaten = 1; + } + + pos += (eaten - 1); // we'll ++ it again in a moment + } + break; + } + } + + return len; +} + +void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user) +{ + vt->parser.callbacks = callbacks; + vt->parser.cbdata = user; +} + +void *vterm_parser_get_cbdata(VTerm *vt) +{ + return vt->parser.cbdata; +} diff --git a/src/libvterm/src/pen.c b/src/libvterm/src/pen.c new file mode 100644 index 0000000000..b7800950e3 --- /dev/null +++ b/src/libvterm/src/pen.c @@ -0,0 +1,516 @@ +#include "vterm_internal.h" + +#include <stdio.h> + +static const VTermColor ansi_colors[] = { + /* R G B index */ + { 0, 0, 0, 1 }, // black + { 224, 0, 0, 2 }, // red + { 0, 224, 0, 3 }, // green + { 224, 224, 0, 4 }, // yellow + { 0, 0, 224, 5 }, // blue + { 224, 0, 224, 6 }, // magenta + { 0, 224, 224, 7 }, // cyan + { 224, 224, 224, 8 }, // white == light grey + + // high intensity + { 128, 128, 128, 9 }, // black + { 255, 64, 64, 10 }, // red + { 64, 255, 64, 11 }, // green + { 255, 255, 64, 12 }, // yellow + { 64, 64, 255, 13 }, // blue + { 255, 64, 255, 14 }, // magenta + { 64, 255, 255, 15 }, // cyan + { 255, 255, 255, 16 }, // white for real +}; + +static int ramp6[] = { + 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF, +}; + +/* Use 0x81 instead of 0x80 to be able to distinguish from ansi black */ +static int ramp24[] = { + 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, + 0x81, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE, +}; + +static int lookup_colour_ansi(const VTermState *state, long index, VTermColor *col) +{ + if(index >= 0 && index < 16) { + *col = state->colors[index]; + return TRUE; + } + + return FALSE; +} + +static int lookup_colour_palette(const VTermState *state, long index, VTermColor *col) +{ + if(index >= 0 && index < 16) { + // Normal 8 colours or high intensity - parse as palette 0 + return lookup_colour_ansi(state, index, col); + } + else if(index >= 16 && index < 232) { + // 216-colour cube + index -= 16; + + col->blue = ramp6[index % 6]; + col->green = ramp6[index/6 % 6]; + col->red = ramp6[index/6/6 % 6]; + col->ansi_index = VTERM_ANSI_INDEX_NONE; + + return TRUE; + } + else if(index >= 232 && index < 256) { + // 24 greyscales + index -= 232; + + col->blue = ramp24[index]; + col->green = ramp24[index]; + col->red = ramp24[index]; + col->ansi_index = VTERM_ANSI_INDEX_NONE; + + return TRUE; + } + + return FALSE; +} + +static int lookup_colour(const VTermState *state, int palette, const long args[], int argcount, VTermColor *col, int *index) +{ + switch(palette) { + case 2: // RGB mode - 3 args contain colour values directly + if(argcount < 3) + return argcount; + + col->red = (uint8_t)CSI_ARG(args[0]); + col->green = (uint8_t)CSI_ARG(args[1]); + col->blue = (uint8_t)CSI_ARG(args[2]); + col->ansi_index = VTERM_ANSI_INDEX_NONE; + + return 3; + + case 5: // XTerm 256-colour mode + if(index) + *index = CSI_ARG_OR(args[0], -1); + + lookup_colour_palette(state, argcount ? CSI_ARG_OR(args[0], -1) : -1, col); + + return argcount ? 1 : 0; + + default: + DEBUG_LOG1("Unrecognised colour palette %d\n", palette); + return 0; + } +} + +// Some conveniences + +static void setpenattr(VTermState *state, VTermAttr attr, VTermValueType type UNUSED, VTermValue *val) +{ +#ifdef DEBUG + if(type != vterm_get_attr_type(attr)) { + DEBUG_LOG3("Cannot set attr %d as it has type %d, not type %d\n", + attr, vterm_get_attr_type(attr), type); + return; + } +#endif + if(state->callbacks && state->callbacks->setpenattr) + (*state->callbacks->setpenattr)(attr, val, state->cbdata); +} + +static void setpenattr_bool(VTermState *state, VTermAttr attr, int boolean) +{ + VTermValue val; + val.boolean = boolean; + setpenattr(state, attr, VTERM_VALUETYPE_BOOL, &val); +} + +static void setpenattr_int(VTermState *state, VTermAttr attr, int number) +{ + VTermValue val; + val.number = number; + setpenattr(state, attr, VTERM_VALUETYPE_INT, &val); +} + +static void setpenattr_col(VTermState *state, VTermAttr attr, VTermColor color) +{ + VTermValue val; + val.color = color; + setpenattr(state, attr, VTERM_VALUETYPE_COLOR, &val); +} + +static void set_pen_col_ansi(VTermState *state, VTermAttr attr, long col) +{ + VTermColor *colp = (attr == VTERM_ATTR_BACKGROUND) ? &state->pen.bg : &state->pen.fg; + + lookup_colour_ansi(state, col, colp); + + setpenattr_col(state, attr, *colp); +} + +INTERNAL void vterm_state_newpen(VTermState *state) +{ + int col; + + // 90% grey so that pure white is brighter + state->default_fg.red = state->default_fg.green = state->default_fg.blue = 240; + state->default_fg.ansi_index = VTERM_ANSI_INDEX_DEFAULT; + state->default_bg.red = state->default_bg.green = state->default_bg.blue = 0; + state->default_bg.ansi_index = VTERM_ANSI_INDEX_DEFAULT; + + for(col = 0; col < 16; col++) + state->colors[col] = ansi_colors[col]; +} + +INTERNAL void vterm_state_resetpen(VTermState *state) +{ + state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); + state->pen.underline = 0; setpenattr_int( state, VTERM_ATTR_UNDERLINE, 0); + state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); + state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); + state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); + state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); + state->pen.font = 0; setpenattr_int( state, VTERM_ATTR_FONT, 0); + + state->fg_index = -1; + state->bg_index = -1; + state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg); + state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->default_bg); +} + +INTERNAL void vterm_state_savepen(VTermState *state, int save) +{ + if(save) { + state->saved.pen = state->pen; + } + else { + state->pen = state->saved.pen; + + setpenattr_bool(state, VTERM_ATTR_BOLD, state->pen.bold); + setpenattr_int( state, VTERM_ATTR_UNDERLINE, state->pen.underline); + setpenattr_bool(state, VTERM_ATTR_ITALIC, state->pen.italic); + setpenattr_bool(state, VTERM_ATTR_BLINK, state->pen.blink); + setpenattr_bool(state, VTERM_ATTR_REVERSE, state->pen.reverse); + setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike); + setpenattr_int( state, VTERM_ATTR_FONT, state->pen.font); + setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg); + setpenattr_col( state, VTERM_ATTR_BACKGROUND, state->pen.bg); + } +} + +void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg) +{ + *default_fg = state->default_fg; + *default_bg = state->default_bg; +} + +void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col) +{ + lookup_colour_palette(state, index, col); +} + +void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg) +{ + state->default_fg = *default_fg; + state->default_bg = *default_bg; +} + +void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col) +{ + if(index >= 0 && index < 16) + { + state->colors[index] = *col; + state->colors[index].ansi_index = index + VTERM_ANSI_INDEX_MIN; + } +} + +void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright) +{ + state->bold_is_highbright = bold_is_highbright; +} + +INTERNAL void vterm_state_setpen(VTermState *state, const long args[], int argcount) +{ + // SGR - ECMA-48 8.3.117 + + int argi = 0; + int value; + + while(argi < argcount) { + // This logic is easier to do 'done' backwards; set it true, and make it + // false again in the 'default' case + int done = 1; + + long arg; + switch(arg = CSI_ARG(args[argi])) { + case CSI_ARG_MISSING: + case 0: // Reset + vterm_state_resetpen(state); + break; + + case 1: // Bold on + state->pen.bold = 1; + setpenattr_bool(state, VTERM_ATTR_BOLD, 1); + if(state->fg_index > -1 && state->fg_index < 8 && state->bold_is_highbright) + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, state->fg_index + (state->pen.bold ? 8 : 0)); + break; + + case 3: // Italic on + state->pen.italic = 1; + setpenattr_bool(state, VTERM_ATTR_ITALIC, 1); + break; + + case 4: // Underline single + state->pen.underline = 1; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 1); + break; + + case 5: // Blink + state->pen.blink = 1; + setpenattr_bool(state, VTERM_ATTR_BLINK, 1); + break; + + case 7: // Reverse on + state->pen.reverse = 1; + setpenattr_bool(state, VTERM_ATTR_REVERSE, 1); + break; + + case 9: // Strikethrough on + state->pen.strike = 1; + setpenattr_bool(state, VTERM_ATTR_STRIKE, 1); + break; + + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: case 19: // Select font + state->pen.font = CSI_ARG(args[argi]) - 10; + setpenattr_int(state, VTERM_ATTR_FONT, state->pen.font); + break; + + case 21: // Underline double + state->pen.underline = 2; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 2); + break; + + case 22: // Bold off + state->pen.bold = 0; + setpenattr_bool(state, VTERM_ATTR_BOLD, 0); + break; + + case 23: // Italic and Gothic (currently unsupported) off + state->pen.italic = 0; + setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); + break; + + case 24: // Underline off + state->pen.underline = 0; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 0); + break; + + case 25: // Blink off + state->pen.blink = 0; + setpenattr_bool(state, VTERM_ATTR_BLINK, 0); + break; + + case 27: // Reverse off + state->pen.reverse = 0; + setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); + break; + + case 29: // Strikethrough off + state->pen.strike = 0; + setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); + break; + + case 30: case 31: case 32: case 33: + case 34: case 35: case 36: case 37: // Foreground colour palette + value = CSI_ARG(args[argi]) - 30; + state->fg_index = value; + if(state->pen.bold && state->bold_is_highbright) + value += 8; + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); + break; + + case 38: // Foreground colour alternative palette + state->fg_index = -1; + if(argcount - argi < 1) + return; + argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.fg, &state->fg_index); + setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); + break; + + case 39: // Foreground colour default + state->fg_index = -1; + state->pen.fg = state->default_fg; + setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); + break; + + case 40: case 41: case 42: case 43: + case 44: case 45: case 46: case 47: // Background colour palette + value = CSI_ARG(args[argi]) - 40; + state->bg_index = value; + set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); + break; + + case 48: // Background colour alternative palette + state->bg_index = -1; + if(argcount - argi < 1) + return; + argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.bg, &state->bg_index); + setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); + break; + + case 49: // Default background + state->bg_index = -1; + state->pen.bg = state->default_bg; + setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); + break; + + case 90: case 91: case 92: case 93: + case 94: case 95: case 96: case 97: // Foreground colour high-intensity palette + value = CSI_ARG(args[argi]) - 90 + 8; + state->fg_index = value; + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); + break; + + case 100: case 101: case 102: case 103: + case 104: case 105: case 106: case 107: // Background colour high-intensity palette + value = CSI_ARG(args[argi]) - 100 + 8; + state->bg_index = value; + set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); + break; + + default: + done = 0; + break; + } + + if(!done) + { + DEBUG_LOG1("libvterm: Unhandled CSI SGR %lu\n", arg); + } + + while(CSI_ARG_HAS_MORE(args[argi++])); + } +} + +INTERNAL int vterm_state_getpen(VTermState *state, long args[], int argcount UNUSED) +{ + int argi = 0; + + if(state->pen.bold) + args[argi++] = 1; + + if(state->pen.italic) + args[argi++] = 3; + + if(state->pen.underline == 1) + args[argi++] = 4; + + if(state->pen.blink) + args[argi++] = 5; + + if(state->pen.reverse) + args[argi++] = 7; + + if(state->pen.strike) + args[argi++] = 9; + + if(state->pen.font) + args[argi++] = 10 + state->pen.font; + + if(state->pen.underline == 2) + args[argi++] = 21; + + if(state->fg_index >= 0 && state->fg_index < 8) + args[argi++] = 30 + state->fg_index; + else if(state->fg_index >= 8 && state->fg_index < 16) + args[argi++] = 90 + state->fg_index - 8; + else if(state->fg_index >= 16 && state->fg_index < 256) { + args[argi++] = CSI_ARG_FLAG_MORE|38; + args[argi++] = CSI_ARG_FLAG_MORE|5; + args[argi++] = state->fg_index; + } + else if(state->fg_index == -1) { + // Send palette 2 if the actual FG colour is not default + if(state->pen.fg.red != state->default_fg.red || + state->pen.fg.green != state->default_fg.green || + state->pen.fg.blue != state->default_fg.blue ) { + args[argi++] = CSI_ARG_FLAG_MORE|38; + args[argi++] = CSI_ARG_FLAG_MORE|2; + args[argi++] = CSI_ARG_FLAG_MORE | state->pen.fg.red; + args[argi++] = CSI_ARG_FLAG_MORE | state->pen.fg.green; + args[argi++] = state->pen.fg.blue; + } + } + + if(state->bg_index >= 0 && state->bg_index < 8) + args[argi++] = 40 + state->bg_index; + else if(state->bg_index >= 8 && state->bg_index < 16) + args[argi++] = 100 + state->bg_index - 8; + else if(state->bg_index >= 16 && state->bg_index < 256) { + args[argi++] = CSI_ARG_FLAG_MORE|48; + args[argi++] = CSI_ARG_FLAG_MORE|5; + args[argi++] = state->bg_index; + } + else if(state->bg_index == -1) { + // Send palette 2 if the actual BG colour is not default + if(state->pen.bg.red != state->default_bg.red || + state->pen.bg.green != state->default_bg.green || + state->pen.bg.blue != state->default_bg.blue ) { + args[argi++] = CSI_ARG_FLAG_MORE|48; + args[argi++] = CSI_ARG_FLAG_MORE|2; + args[argi++] = CSI_ARG_FLAG_MORE | state->pen.bg.red; + args[argi++] = CSI_ARG_FLAG_MORE | state->pen.bg.green; + args[argi++] = state->pen.bg.blue; + } + } + + return argi; +} + +int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val) +{ + switch(attr) { + case VTERM_ATTR_BOLD: + val->boolean = state->pen.bold; + return 1; + + case VTERM_ATTR_UNDERLINE: + val->number = state->pen.underline; + return 1; + + case VTERM_ATTR_ITALIC: + val->boolean = state->pen.italic; + return 1; + + case VTERM_ATTR_BLINK: + val->boolean = state->pen.blink; + return 1; + + case VTERM_ATTR_REVERSE: + val->boolean = state->pen.reverse; + return 1; + + case VTERM_ATTR_STRIKE: + val->boolean = state->pen.strike; + return 1; + + case VTERM_ATTR_FONT: + val->number = state->pen.font; + return 1; + + case VTERM_ATTR_FOREGROUND: + val->color = state->pen.fg; + return 1; + + case VTERM_ATTR_BACKGROUND: + val->color = state->pen.bg; + return 1; + + case VTERM_N_ATTRS: + return 0; + } + + return 0; +} diff --git a/src/libvterm/src/rect.h b/src/libvterm/src/rect.h new file mode 100644 index 0000000000..2114f24c1b --- /dev/null +++ b/src/libvterm/src/rect.h @@ -0,0 +1,56 @@ +/* + * Some utility functions on VTermRect structures + */ + +#define STRFrect "(%d,%d-%d,%d)" +#define ARGSrect(r) (r).start_row, (r).start_col, (r).end_row, (r).end_col + +/* Expand dst to contain src as well */ +static void rect_expand(VTermRect *dst, VTermRect *src) +{ + if(dst->start_row > src->start_row) dst->start_row = src->start_row; + if(dst->start_col > src->start_col) dst->start_col = src->start_col; + if(dst->end_row < src->end_row) dst->end_row = src->end_row; + if(dst->end_col < src->end_col) dst->end_col = src->end_col; +} + +/* Clip the dst to ensure it does not step outside of bounds */ +static void rect_clip(VTermRect *dst, VTermRect *bounds) +{ + if(dst->start_row < bounds->start_row) dst->start_row = bounds->start_row; + if(dst->start_col < bounds->start_col) dst->start_col = bounds->start_col; + if(dst->end_row > bounds->end_row) dst->end_row = bounds->end_row; + if(dst->end_col > bounds->end_col) dst->end_col = bounds->end_col; + /* Ensure it doesn't end up negatively-sized */ + if(dst->end_row < dst->start_row) dst->end_row = dst->start_row; + if(dst->end_col < dst->start_col) dst->end_col = dst->start_col; +} + +/* True if the two rectangles are equal */ +static int rect_equal(VTermRect *a, VTermRect *b) +{ + return (a->start_row == b->start_row) && + (a->start_col == b->start_col) && + (a->end_row == b->end_row) && + (a->end_col == b->end_col); +} + +/* True if small is contained entirely within big */ +static int rect_contains(VTermRect *big, VTermRect *small) +{ + if(small->start_row < big->start_row) return 0; + if(small->start_col < big->start_col) return 0; + if(small->end_row > big->end_row) return 0; + if(small->end_col > big->end_col) return 0; + return 1; +} + +/* True if the rectangles overlap at all */ +static int rect_intersects(VTermRect *a, VTermRect *b) +{ + if(a->start_row > b->end_row || b->start_row > a->end_row) + return 0; + if(a->start_col > b->end_col || b->start_col > a->end_col) + return 0; + return 1; +} diff --git a/src/libvterm/src/screen.c b/src/libvterm/src/screen.c new file mode 100644 index 0000000000..cfae088ba7 --- /dev/null +++ b/src/libvterm/src/screen.c @@ -0,0 +1,935 @@ +#include "vterm_internal.h" + +#include <stdio.h> +#include <string.h> + +#include "rect.h" +#include "utf8.h" + +#define UNICODE_SPACE 0x20 +#define UNICODE_LINEFEED 0x0a + +/* State of the pen at some moment in time, also used in a cell */ +typedef struct +{ + /* After the bitfield */ + VTermColor fg, bg; + + unsigned int bold : 1; + unsigned int underline : 2; + unsigned int italic : 1; + unsigned int blink : 1; + unsigned int reverse : 1; + unsigned int strike : 1; + unsigned int font : 4; /* 0 to 9 */ + + /* Extra state storage that isn't strictly pen-related */ + unsigned int protected_cell : 1; + unsigned int dwl : 1; /* on a DECDWL or DECDHL line */ + unsigned int dhl : 2; /* on a DECDHL line (1=top 2=bottom) */ +} ScreenPen; + +/* Internal representation of a screen cell */ +typedef struct +{ + uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; + ScreenPen pen; +} ScreenCell; + +static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell); + +struct VTermScreen +{ + VTerm *vt; + VTermState *state; + + const VTermScreenCallbacks *callbacks; + void *cbdata; + + VTermDamageSize damage_merge; + /* start_row == -1 => no damage */ + VTermRect damaged; + VTermRect pending_scrollrect; + int pending_scroll_downward, pending_scroll_rightward; + + int rows; + int cols; + int global_reverse; + + /* Primary and Altscreen. buffers[1] is lazily allocated as needed */ + ScreenCell *buffers[2]; + + /* buffer will == buffers[0] or buffers[1], depending on altscreen */ + ScreenCell *buffer; + + /* buffer for a single screen row used in scrollback storage callbacks */ + VTermScreenCell *sb_buffer; + + ScreenPen pen; +}; + +static ScreenCell *getcell(const VTermScreen *screen, int row, int col) +{ + if(row < 0 || row >= screen->rows) + return NULL; + if(col < 0 || col >= screen->cols) + return NULL; + return screen->buffer + (screen->cols * row) + col; +} + +static ScreenCell *realloc_buffer(VTermScreen *screen, ScreenCell *buffer, int new_rows, int new_cols) +{ + ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); + int row, col; + + for(row = 0; row < new_rows; row++) { + for(col = 0; col < new_cols; col++) { + ScreenCell *new_cell = new_buffer + row*new_cols + col; + + if(buffer && row < screen->rows && col < screen->cols) + *new_cell = buffer[row * screen->cols + col]; + else { + new_cell->chars[0] = 0; + new_cell->pen = screen->pen; + } + } + } + + if(buffer) + vterm_allocator_free(screen->vt, buffer); + + return new_buffer; +} + +static void damagerect(VTermScreen *screen, VTermRect rect) +{ + VTermRect emit; + + switch(screen->damage_merge) { + case VTERM_DAMAGE_CELL: + /* Always emit damage event */ + emit = rect; + break; + + case VTERM_DAMAGE_ROW: + /* Emit damage longer than one row. Try to merge with existing damage in + * the same row */ + if(rect.end_row > rect.start_row + 1) { + // Bigger than 1 line - flush existing, emit this + vterm_screen_flush_damage(screen); + emit = rect; + } + else if(screen->damaged.start_row == -1) { + // None stored yet + screen->damaged = rect; + return; + } + else if(rect.start_row == screen->damaged.start_row) { + // Merge with the stored line + if(screen->damaged.start_col > rect.start_col) + screen->damaged.start_col = rect.start_col; + if(screen->damaged.end_col < rect.end_col) + screen->damaged.end_col = rect.end_col; + return; + } + else { + // Emit the currently stored line, store a new one + emit = screen->damaged; + screen->damaged = rect; + } + break; + + case VTERM_DAMAGE_SCREEN: + case VTERM_DAMAGE_SCROLL: + /* Never emit damage event */ + if(screen->damaged.start_row == -1) + screen->damaged = rect; + else { + rect_expand(&screen->damaged, &rect); + } + return; + + default: + DEBUG_LOG1("TODO: Maybe merge damage for level %d\n", screen->damage_merge); + return; + } + + if(screen->callbacks && screen->callbacks->damage) + (*screen->callbacks->damage)(emit, screen->cbdata); +} + +static void damagescreen(VTermScreen *screen) +{ + VTermRect rect = {0,0,0,0}; + rect.end_row = screen->rows; + rect.end_col = screen->cols; + + damagerect(screen, rect); +} + +static int putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) +{ + int i; + int col; + VTermRect rect; + + VTermScreen *screen = user; + ScreenCell *cell = getcell(screen, pos.row, pos.col); + + if(!cell) + return 0; + + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++) { + cell->chars[i] = info->chars[i]; + cell->pen = screen->pen; + } + if(i < VTERM_MAX_CHARS_PER_CELL) + cell->chars[i] = 0; + + for(col = 1; col < info->width; col++) + getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1; + + rect.start_row = pos.row; + rect.end_row = pos.row+1; + rect.start_col = pos.col; + rect.end_col = pos.col+info->width; + + cell->pen.protected_cell = info->protected_cell; + cell->pen.dwl = info->dwl; + cell->pen.dhl = info->dhl; + + damagerect(screen, rect); + + return 1; +} + +static int moverect_internal(VTermRect dest, VTermRect src, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->sb_pushline && + dest.start_row == 0 && dest.start_col == 0 && // starts top-left corner + dest.end_col == screen->cols && // full width + screen->buffer == screen->buffers[0]) { // not altscreen + VTermPos pos; + for(pos.row = 0; pos.row < src.start_row; pos.row++) { + for(pos.col = 0; pos.col < screen->cols; pos.col++) + (void)vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col); + + (screen->callbacks->sb_pushline)(screen->cols, screen->sb_buffer, screen->cbdata); + } + } + + { + int cols = src.end_col - src.start_col; + int downward = src.start_row - dest.start_row; + int init_row, test_row, inc_row; + int row; + + if(downward < 0) { + init_row = dest.end_row - 1; + test_row = dest.start_row - 1; + inc_row = -1; + } + else { + init_row = dest.start_row; + test_row = dest.end_row; + inc_row = +1; + } + + for(row = init_row; row != test_row; row += inc_row) + memmove(getcell(screen, row, dest.start_col), + getcell(screen, row + downward, src.start_col), + cols * sizeof(ScreenCell)); + } + + return 1; +} + +static int moverect_user(VTermRect dest, VTermRect src, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->moverect) { + if(screen->damage_merge != VTERM_DAMAGE_SCROLL) + // Avoid an infinite loop + vterm_screen_flush_damage(screen); + + if((*screen->callbacks->moverect)(dest, src, screen->cbdata)) + return 1; + } + + damagerect(screen, dest); + + return 1; +} + +static int erase_internal(VTermRect rect, int selective, void *user) +{ + VTermScreen *screen = user; + int row, col; + + for(row = rect.start_row; row < screen->state->rows && row < rect.end_row; row++) { + const VTermLineInfo *info = vterm_state_get_lineinfo(screen->state, row); + + for(col = rect.start_col; col < rect.end_col; col++) { + ScreenCell *cell = getcell(screen, row, col); + + if(selective && cell->pen.protected_cell) + continue; + + cell->chars[0] = 0; + cell->pen = screen->pen; + cell->pen.dwl = info->doublewidth; + cell->pen.dhl = info->doubleheight; + } + } + + return 1; +} + +static int erase_user(VTermRect rect, int selective UNUSED, void *user) +{ + VTermScreen *screen = user; + + damagerect(screen, rect); + + return 1; +} + +static int erase(VTermRect rect, int selective, void *user) +{ + erase_internal(rect, selective, user); + return erase_user(rect, 0, user); +} + +static int scrollrect(VTermRect rect, int downward, int rightward, void *user) +{ + VTermScreen *screen = user; + + if(screen->damage_merge != VTERM_DAMAGE_SCROLL) { + vterm_scroll_rect(rect, downward, rightward, + moverect_internal, erase_internal, screen); + + vterm_screen_flush_damage(screen); + + vterm_scroll_rect(rect, downward, rightward, + moverect_user, erase_user, screen); + + return 1; + } + + if(screen->damaged.start_row != -1 && + !rect_intersects(&rect, &screen->damaged)) { + vterm_screen_flush_damage(screen); + } + + if(screen->pending_scrollrect.start_row == -1) { + screen->pending_scrollrect = rect; + screen->pending_scroll_downward = downward; + screen->pending_scroll_rightward = rightward; + } + else if(rect_equal(&screen->pending_scrollrect, &rect) && + ((screen->pending_scroll_downward == 0 && downward == 0) || + (screen->pending_scroll_rightward == 0 && rightward == 0))) { + screen->pending_scroll_downward += downward; + screen->pending_scroll_rightward += rightward; + } + else { + vterm_screen_flush_damage(screen); + + screen->pending_scrollrect = rect; + screen->pending_scroll_downward = downward; + screen->pending_scroll_rightward = rightward; + } + + vterm_scroll_rect(rect, downward, rightward, + moverect_internal, erase_internal, screen); + + if(screen->damaged.start_row == -1) + return 1; + + if(rect_contains(&rect, &screen->damaged)) { + /* Scroll region entirely contains the damage; just move it */ + vterm_rect_move(&screen->damaged, -downward, -rightward); + rect_clip(&screen->damaged, &rect); + } + /* There are a number of possible cases here, but lets restrict this to only + * the common case where we might actually gain some performance by + * optimising it. Namely, a vertical scroll that neatly cuts the damage + * region in half. + */ + else if(rect.start_col <= screen->damaged.start_col && + rect.end_col >= screen->damaged.end_col && + rightward == 0) { + if(screen->damaged.start_row >= rect.start_row && + screen->damaged.start_row < rect.end_row) { + screen->damaged.start_row -= downward; + if(screen->damaged.start_row < rect.start_row) + screen->damaged.start_row = rect.start_row; + if(screen->damaged.start_row > rect.end_row) + screen->damaged.start_row = rect.end_row; + } + if(screen->damaged.end_row >= rect.start_row && + screen->damaged.end_row < rect.end_row) { + screen->damaged.end_row -= downward; + if(screen->damaged.end_row < rect.start_row) + screen->damaged.end_row = rect.start_row; + if(screen->damaged.end_row > rect.end_row) + screen->damaged.end_row = rect.end_row; + } + } + else { + DEBUG_LOG2("TODO: Just flush and redo damaged=" STRFrect " rect=" STRFrect "\n", + ARGSrect(screen->damaged), ARGSrect(rect)); + } + + return 1; +} + +static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->movecursor) + return (*screen->callbacks->movecursor)(pos, oldpos, visible, screen->cbdata); + + return 0; +} + +static int setpenattr(VTermAttr attr, VTermValue *val, void *user) +{ + VTermScreen *screen = user; + + switch(attr) { + case VTERM_ATTR_BOLD: + screen->pen.bold = val->boolean; + return 1; + case VTERM_ATTR_UNDERLINE: + screen->pen.underline = val->number; + return 1; + case VTERM_ATTR_ITALIC: + screen->pen.italic = val->boolean; + return 1; + case VTERM_ATTR_BLINK: + screen->pen.blink = val->boolean; + return 1; + case VTERM_ATTR_REVERSE: + screen->pen.reverse = val->boolean; + return 1; + case VTERM_ATTR_STRIKE: + screen->pen.strike = val->boolean; + return 1; + case VTERM_ATTR_FONT: + screen->pen.font = val->number; + return 1; + case VTERM_ATTR_FOREGROUND: + screen->pen.fg = val->color; + return 1; + case VTERM_ATTR_BACKGROUND: + screen->pen.bg = val->color; + return 1; + + case VTERM_N_ATTRS: + return 0; + } + + return 0; +} + +static int settermprop(VTermProp prop, VTermValue *val, void *user) +{ + VTermScreen *screen = user; + + switch(prop) { + case VTERM_PROP_ALTSCREEN: + if(val->boolean && !screen->buffers[1]) + return 0; + + screen->buffer = val->boolean ? screen->buffers[1] : screen->buffers[0]; + /* only send a damage event on disable; because during enable there's an + * erase that sends a damage anyway + */ + if(!val->boolean) + damagescreen(screen); + break; + case VTERM_PROP_REVERSE: + screen->global_reverse = val->boolean; + damagescreen(screen); + break; + default: + ; /* ignore */ + } + + if(screen->callbacks && screen->callbacks->settermprop) + return (*screen->callbacks->settermprop)(prop, val, screen->cbdata); + + return 1; +} + +static int bell(void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->bell) + return (*screen->callbacks->bell)(screen->cbdata); + + return 0; +} + +static int resize(int new_rows, int new_cols, VTermPos *delta, void *user) +{ + VTermScreen *screen = user; + + int is_altscreen = (screen->buffers[1] && screen->buffer == screen->buffers[1]); + + int old_rows = screen->rows; + int old_cols = screen->cols; + int first_blank_row; + + if(!is_altscreen && new_rows < old_rows) { + // Fewer rows - determine if we're going to scroll at all, and if so, push + // those lines to scrollback + VTermPos pos = { 0, 0 }; + VTermPos cursor = screen->state->pos; + // Find the first blank row after the cursor. + for(pos.row = old_rows - 1; pos.row >= new_rows; pos.row--) + if(!vterm_screen_is_eol(screen, pos) || cursor.row == pos.row) + break; + + first_blank_row = pos.row + 1; + if(first_blank_row > new_rows) { + VTermRect rect = {0,0,0,0}; + rect.end_row = old_rows; + rect.end_col = old_cols; + scrollrect(rect, first_blank_row - new_rows, 0, user); + vterm_screen_flush_damage(screen); + + delta->row -= first_blank_row - new_rows; + } + } + + screen->buffers[0] = realloc_buffer(screen, screen->buffers[0], new_rows, new_cols); + if(screen->buffers[1]) + screen->buffers[1] = realloc_buffer(screen, screen->buffers[1], new_rows, new_cols); + + screen->buffer = is_altscreen ? screen->buffers[1] : screen->buffers[0]; + + screen->rows = new_rows; + screen->cols = new_cols; + + if(screen->sb_buffer) + vterm_allocator_free(screen->vt, screen->sb_buffer); + + screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols); + + if(new_cols > old_cols) { + VTermRect rect; + rect.start_row = 0; + rect.end_row = old_rows; + rect.start_col = old_cols; + rect.end_col = new_cols; + damagerect(screen, rect); + } + + if(new_rows > old_rows) { + if(!is_altscreen && screen->callbacks && screen->callbacks->sb_popline) { + int rows = new_rows - old_rows; + while(rows) { + VTermRect rect = {0,0,0,0}; + VTermPos pos = { 0, 0 }; + if(!(screen->callbacks->sb_popline(screen->cols, screen->sb_buffer, screen->cbdata))) + break; + + rect.end_row = screen->rows; + rect.end_col = screen->cols; + scrollrect(rect, -1, 0, user); + + for(pos.col = 0; pos.col < screen->cols; pos.col += screen->sb_buffer[pos.col].width) + vterm_screen_set_cell(screen, pos, screen->sb_buffer + pos.col); + + rect.end_row = 1; + damagerect(screen, rect); + + vterm_screen_flush_damage(screen); + + rows--; + delta->row++; + } + } + + { + VTermRect rect; + rect.start_row = old_rows; + rect.end_row = new_rows; + rect.start_col = 0; + rect.end_col = new_cols; + damagerect(screen, rect); + } + } + + if(screen->callbacks && screen->callbacks->resize) + return (*screen->callbacks->resize)(new_rows, new_cols, screen->cbdata); + + return 1; +} + +static int setlineinfo(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user) +{ + VTermScreen *screen = user; + int col; + VTermRect rect; + + if(newinfo->doublewidth != oldinfo->doublewidth || + newinfo->doubleheight != oldinfo->doubleheight) { + for(col = 0; col < screen->cols; col++) { + ScreenCell *cell = getcell(screen, row, col); + cell->pen.dwl = newinfo->doublewidth; + cell->pen.dhl = newinfo->doubleheight; + } + + rect.start_row = row; + rect.end_row = row + 1; + rect.start_col = 0; + rect.end_col = newinfo->doublewidth ? screen->cols / 2 : screen->cols; + damagerect(screen, rect); + + if(newinfo->doublewidth) { + rect.start_col = screen->cols / 2; + rect.end_col = screen->cols; + + erase_internal(rect, 0, user); + } + } + + return 1; +} + +static VTermStateCallbacks state_cbs = { + &putglyph, /* putglyph */ + &movecursor, /* movecursor */ + &scrollrect, /* scrollrect */ + NULL, /* moverect */ + &erase, /* erase */ + NULL, /* initpen */ + &setpenattr, /* setpenattr */ + &settermprop, /* settermprop */ + &bell, /* bell */ + &resize, /* resize */ + &setlineinfo /* setlineinfo */ +}; + +static VTermScreen *screen_new(VTerm *vt) +{ + VTermState *state = vterm_obtain_state(vt); + VTermScreen *screen; + int rows, cols; + + if(!state) + return NULL; + + screen = vterm_allocator_malloc(vt, sizeof(VTermScreen)); + + vterm_get_size(vt, &rows, &cols); + + screen->vt = vt; + screen->state = state; + + screen->damage_merge = VTERM_DAMAGE_CELL; + screen->damaged.start_row = -1; + screen->pending_scrollrect.start_row = -1; + + screen->rows = rows; + screen->cols = cols; + + screen->callbacks = NULL; + screen->cbdata = NULL; + + screen->buffers[0] = realloc_buffer(screen, NULL, rows, cols); + + screen->buffer = screen->buffers[0]; + + screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * cols); + + vterm_state_set_callbacks(screen->state, &state_cbs, screen); + + return screen; +} + +INTERNAL void vterm_screen_free(VTermScreen *screen) +{ + vterm_allocator_free(screen->vt, screen->buffers[0]); + if(screen->buffers[1]) + vterm_allocator_free(screen->vt, screen->buffers[1]); + + vterm_allocator_free(screen->vt, screen->sb_buffer); + + vterm_allocator_free(screen->vt, screen); +} + +void vterm_screen_reset(VTermScreen *screen, int hard) +{ + screen->damaged.start_row = -1; + screen->pending_scrollrect.start_row = -1; + vterm_state_reset(screen->state, hard); + vterm_screen_flush_damage(screen); +} + +static size_t _get_chars(const VTermScreen *screen, const int utf8, void *buffer, size_t len, const VTermRect rect) +{ + size_t outpos = 0; + int padding = 0; + int row, col; + +#define PUT(c) \ + if(utf8) { \ + size_t thislen = utf8_seqlen(c); \ + if(buffer && outpos + thislen <= len) \ + outpos += fill_utf8((c), (char *)buffer + outpos); \ + else \ + outpos += thislen; \ + } \ + else { \ + if(buffer && outpos + 1 <= len) \ + ((uint32_t*)buffer)[outpos++] = (c); \ + else \ + outpos++; \ + } + + for(row = rect.start_row; row < rect.end_row; row++) { + for(col = rect.start_col; col < rect.end_col; col++) { + ScreenCell *cell = getcell(screen, row, col); + int i; + + if(cell->chars[0] == 0) + // Erased cell, might need a space + padding++; + else if(cell->chars[0] == (uint32_t)-1) + // Gap behind a double-width char, do nothing + ; + else { + while(padding) { + PUT(UNICODE_SPACE); + padding--; + } + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell->chars[i]; i++) { + PUT(cell->chars[i]); + } + } + } + + if(row < rect.end_row - 1) { + PUT(UNICODE_LINEFEED); + padding = 0; + } + } + + return outpos; +} + +size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect) +{ + return _get_chars(screen, 0, chars, len, rect); +} + +size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect) +{ + return _get_chars(screen, 1, str, len, rect); +} + +/* Copy internal to external representation of a screen cell */ +int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell) +{ + ScreenCell *intcell = getcell(screen, pos.row, pos.col); + int i; + + if(!intcell) + return 0; + + for(i = 0; ; i++) { + cell->chars[i] = intcell->chars[i]; + if(!intcell->chars[i]) + break; + } + + cell->attrs.bold = intcell->pen.bold; + cell->attrs.underline = intcell->pen.underline; + cell->attrs.italic = intcell->pen.italic; + cell->attrs.blink = intcell->pen.blink; + cell->attrs.reverse = intcell->pen.reverse ^ screen->global_reverse; + cell->attrs.strike = intcell->pen.strike; + cell->attrs.font = intcell->pen.font; + + cell->attrs.dwl = intcell->pen.dwl; + cell->attrs.dhl = intcell->pen.dhl; + + cell->fg = intcell->pen.fg; + cell->bg = intcell->pen.bg; + + if(pos.col < (screen->cols - 1) && + getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) + cell->width = 2; + else + cell->width = 1; + + return 1; +} + +/* Copy external to internal representation of a screen cell */ +/* static because it's only used internally for sb_popline during resize */ +static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell) +{ + ScreenCell *intcell = getcell(screen, pos.row, pos.col); + int i; + + if(!intcell) + return 0; + + for(i = 0; ; i++) { + intcell->chars[i] = cell->chars[i]; + if(!cell->chars[i]) + break; + } + + intcell->pen.bold = cell->attrs.bold; + intcell->pen.underline = cell->attrs.underline; + intcell->pen.italic = cell->attrs.italic; + intcell->pen.blink = cell->attrs.blink; + intcell->pen.reverse = cell->attrs.reverse ^ screen->global_reverse; + intcell->pen.strike = cell->attrs.strike; + intcell->pen.font = cell->attrs.font; + + intcell->pen.fg = cell->fg; + intcell->pen.bg = cell->bg; + + if(cell->width == 2) + getcell(screen, pos.row, pos.col + 1)->chars[0] = (uint32_t)-1; + + return 1; +} + +int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos) +{ + /* This cell is EOL if this and every cell to the right is black */ + for(; pos.col < screen->cols; pos.col++) { + ScreenCell *cell = getcell(screen, pos.row, pos.col); + if(cell->chars[0] != 0) + return 0; + } + + return 1; +} + +VTermScreen *vterm_obtain_screen(VTerm *vt) +{ + if(!vt->screen) + vt->screen = screen_new(vt); + return vt->screen; +} + +void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen) +{ + + if(!screen->buffers[1] && altscreen) { + int rows, cols; + vterm_get_size(screen->vt, &rows, &cols); + + screen->buffers[1] = realloc_buffer(screen, NULL, rows, cols); + } +} + +void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user) +{ + screen->callbacks = callbacks; + screen->cbdata = user; +} + +void *vterm_screen_get_cbdata(VTermScreen *screen) +{ + return screen->cbdata; +} + +void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user) +{ + vterm_state_set_unrecognised_fallbacks(screen->state, fallbacks, user); +} + +void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen) +{ + return vterm_state_get_unrecognised_fbdata(screen->state); +} + +void vterm_screen_flush_damage(VTermScreen *screen) +{ + if(screen->pending_scrollrect.start_row != -1) { + vterm_scroll_rect(screen->pending_scrollrect, screen->pending_scroll_downward, screen->pending_scroll_rightward, + moverect_user, erase_user, screen); + + screen->pending_scrollrect.start_row = -1; + } + + if(screen->damaged.start_row != -1) { + if(screen->callbacks && screen->callbacks->damage) + (*screen->callbacks->damage)(screen->damaged, screen->cbdata); + + screen->damaged.start_row = -1; + } +} + +void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size) +{ + vterm_screen_flush_damage(screen); + screen->damage_merge = size; +} + +static int attrs_differ(VTermAttrMask attrs, ScreenCell *a, ScreenCell *b) +{ + if((attrs & VTERM_ATTR_BOLD_MASK) && (a->pen.bold != b->pen.bold)) + return 1; + if((attrs & VTERM_ATTR_UNDERLINE_MASK) && (a->pen.underline != b->pen.underline)) + return 1; + if((attrs & VTERM_ATTR_ITALIC_MASK) && (a->pen.italic != b->pen.italic)) + return 1; + if((attrs & VTERM_ATTR_BLINK_MASK) && (a->pen.blink != b->pen.blink)) + return 1; + if((attrs & VTERM_ATTR_REVERSE_MASK) && (a->pen.reverse != b->pen.reverse)) + return 1; + if((attrs & VTERM_ATTR_STRIKE_MASK) && (a->pen.strike != b->pen.strike)) + return 1; + if((attrs & VTERM_ATTR_FONT_MASK) && (a->pen.font != b->pen.font)) + return 1; + if((attrs & VTERM_ATTR_FOREGROUND_MASK) && !vterm_color_equal(a->pen.fg, b->pen.fg)) + return 1; + if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_equal(a->pen.bg, b->pen.bg)) + return 1; + + return 0; +} + +int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs) +{ + int col; + + ScreenCell *target = getcell(screen, pos.row, pos.col); + + // TODO: bounds check + extent->start_row = pos.row; + extent->end_row = pos.row + 1; + + if(extent->start_col < 0) + extent->start_col = 0; + if(extent->end_col < 0) + extent->end_col = screen->cols; + + for(col = pos.col - 1; col >= extent->start_col; col--) + if(attrs_differ(attrs, target, getcell(screen, pos.row, col))) + break; + extent->start_col = col + 1; + + for(col = pos.col + 1; col < extent->end_col; col++) + if(attrs_differ(attrs, target, getcell(screen, pos.row, col))) + break; + extent->end_col = col - 1; + + return 1; +} diff --git a/src/libvterm/src/state.c b/src/libvterm/src/state.c new file mode 100644 index 0000000000..a707831618 --- /dev/null +++ b/src/libvterm/src/state.c @@ -0,0 +1,1917 @@ +#include "vterm_internal.h" + +#include <stdio.h> +#include <string.h> + +#define strneq(a,b,n) (strncmp(a,b,n)==0) + +#if defined(DEBUG) && DEBUG > 1 +# define DEBUG_GLYPH_COMBINE +#endif + +static int on_resize(int rows, int cols, void *user); + +/* Some convenient wrappers to make callback functions easier */ + +static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos) +{ + VTermGlyphInfo info; + info.chars = chars; + info.width = width; + info.protected_cell = state->protected_cell; + info.dwl = state->lineinfo[pos.row].doublewidth; + info.dhl = state->lineinfo[pos.row].doubleheight; + + if(state->callbacks && state->callbacks->putglyph) + if((*state->callbacks->putglyph)(&info, pos, state->cbdata)) + return; + + DEBUG_LOG3("libvterm: Unhandled putglyph U+%04x at (%d,%d)\n", chars[0], pos.col, pos.row); +} + +static void updatecursor(VTermState *state, VTermPos *oldpos, int cancel_phantom) +{ + if(state->pos.col == oldpos->col && state->pos.row == oldpos->row) + return; + + if(cancel_phantom) + state->at_phantom = 0; + + if(state->callbacks && state->callbacks->movecursor) + if((*state->callbacks->movecursor)(state->pos, *oldpos, state->mode.cursor_visible, state->cbdata)) + return; +} + +static void erase(VTermState *state, VTermRect rect, int selective) +{ + if(state->callbacks && state->callbacks->erase) + if((*state->callbacks->erase)(rect, selective, state->cbdata)) + return; +} + +static VTermState *vterm_state_new(VTerm *vt) +{ + VTermState *state = vterm_allocator_malloc(vt, sizeof(VTermState)); + + state->vt = vt; + + state->rows = vt->rows; + state->cols = vt->cols; + + state->mouse_col = 0; + state->mouse_row = 0; + state->mouse_buttons = 0; + + state->mouse_protocol = MOUSE_X10; + + state->callbacks = NULL; + state->cbdata = NULL; + + vterm_state_newpen(state); + + state->bold_is_highbright = 0; + + return state; +} + +INTERNAL void vterm_state_free(VTermState *state) +{ + vterm_allocator_free(state->vt, state->tabstops); + vterm_allocator_free(state->vt, state->lineinfo); + vterm_allocator_free(state->vt, state->combine_chars); + vterm_allocator_free(state->vt, state); +} + +static void scroll(VTermState *state, VTermRect rect, int downward, int rightward) +{ + int rows; + int cols; + if(!downward && !rightward) + return; + + rows = rect.end_row - rect.start_row; + if(downward > rows) + downward = rows; + else if(downward < -rows) + downward = -rows; + + cols = rect.end_col - rect.start_col; + if(rightward > cols) + rightward = cols; + else if(rightward < -cols) + rightward = -cols; + + // Update lineinfo if full line + if(rect.start_col == 0 && rect.end_col == state->cols && rightward == 0) { + int height = rect.end_row - rect.start_row - abs(downward); + + if(downward > 0) + memmove(state->lineinfo + rect.start_row, + state->lineinfo + rect.start_row + downward, + height * sizeof(state->lineinfo[0])); + else + memmove(state->lineinfo + rect.start_row - downward, + state->lineinfo + rect.start_row, + height * sizeof(state->lineinfo[0])); + } + + if(state->callbacks && state->callbacks->scrollrect) + if((*state->callbacks->scrollrect)(rect, downward, rightward, state->cbdata)) + return; + + if(state->callbacks) + vterm_scroll_rect(rect, downward, rightward, + state->callbacks->moverect, state->callbacks->erase, state->cbdata); +} + +static void linefeed(VTermState *state) +{ + if(state->pos.row == SCROLLREGION_BOTTOM(state) - 1) { + VTermRect rect; + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, 1, 0); + } + else if(state->pos.row < state->rows-1) + state->pos.row++; +} + +static void grow_combine_buffer(VTermState *state) +{ + size_t new_size = state->combine_chars_size * 2; + uint32_t *new_chars = vterm_allocator_malloc(state->vt, new_size * sizeof(new_chars[0])); + + memcpy(new_chars, state->combine_chars, state->combine_chars_size * sizeof(new_chars[0])); + + vterm_allocator_free(state->vt, state->combine_chars); + + state->combine_chars = new_chars; + state->combine_chars_size = new_size; +} + +static void set_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + state->tabstops[col >> 3] |= mask; +} + +static void clear_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + state->tabstops[col >> 3] &= ~mask; +} + +static int is_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + return state->tabstops[col >> 3] & mask; +} + +static int is_cursor_in_scrollregion(const VTermState *state) +{ + if(state->pos.row < state->scrollregion_top || + state->pos.row >= SCROLLREGION_BOTTOM(state)) + return 0; + if(state->pos.col < SCROLLREGION_LEFT(state) || + state->pos.col >= SCROLLREGION_RIGHT(state)) + return 0; + + return 1; +} + +static void tab(VTermState *state, int count, int direction) +{ + while(count > 0) { + if(direction > 0) { + if(state->pos.col >= THISROWWIDTH(state)-1) + return; + + state->pos.col++; + } + else if(direction < 0) { + if(state->pos.col < 1) + return; + + state->pos.col--; + } + + if(is_col_tabstop(state, state->pos.col)) + count--; + } +} + +#define NO_FORCE 0 +#define FORCE 1 + +#define DWL_OFF 0 +#define DWL_ON 1 + +#define DHL_OFF 0 +#define DHL_TOP 1 +#define DHL_BOTTOM 2 + +static void set_lineinfo(VTermState *state, int row, int force, int dwl, int dhl) +{ + VTermLineInfo info = state->lineinfo[row]; + + if(dwl == DWL_OFF) + info.doublewidth = DWL_OFF; + else if(dwl == DWL_ON) + info.doublewidth = DWL_ON; + // else -1 to ignore + + if(dhl == DHL_OFF) + info.doubleheight = DHL_OFF; + else if(dhl == DHL_TOP) + info.doubleheight = DHL_TOP; + else if(dhl == DHL_BOTTOM) + info.doubleheight = DHL_BOTTOM; + + if((state->callbacks && + state->callbacks->setlineinfo && + (*state->callbacks->setlineinfo)(row, &info, state->lineinfo + row, state->cbdata)) + || force) + state->lineinfo[row] = info; +} + +static int on_text(const char bytes[], size_t len, void *user) +{ + VTermState *state = user; + uint32_t *codepoints; + int npoints = 0; + size_t eaten = 0; + VTermEncodingInstance *encoding; + int i = 0; + + VTermPos oldpos = state->pos; + + // We'll have at most len codepoints, plus one from a previous incomplete + // sequence. + codepoints = vterm_allocator_malloc(state->vt, (len + 1) * sizeof(uint32_t)); + + encoding = + state->gsingle_set ? &state->encoding[state->gsingle_set] : + !(bytes[eaten] & 0x80) ? &state->encoding[state->gl_set] : + state->vt->mode.utf8 ? &state->encoding_utf8 : + &state->encoding[state->gr_set]; + + (*encoding->enc->decode)(encoding->enc, encoding->data, + codepoints, &npoints, state->gsingle_set ? 1 : (int)len, + bytes, &eaten, len); + + /* There's a chance an encoding (e.g. UTF-8) hasn't found enough bytes yet + * for even a single codepoint + */ + if(!npoints) + { + vterm_allocator_free(state->vt, codepoints); + return eaten; + } + + if(state->gsingle_set && npoints) + state->gsingle_set = 0; + + /* This is a combining char. that needs to be merged with the previous + * glyph output */ + if(vterm_unicode_is_combining(codepoints[i])) { + /* See if the cursor has moved since */ + if(state->pos.row == state->combine_pos.row && state->pos.col == state->combine_pos.col + state->combine_width) { +#ifdef DEBUG_GLYPH_COMBINE + int printpos; + printf("DEBUG: COMBINING SPLIT GLYPH of chars {"); + for(printpos = 0; state->combine_chars[printpos]; printpos++) + printf("U+%04x ", state->combine_chars[printpos]); + printf("} + {"); +#endif + + /* Find where we need to append these combining chars */ + int saved_i = 0; + while(state->combine_chars[saved_i]) + saved_i++; + + /* Add extra ones */ + while(i < npoints && vterm_unicode_is_combining(codepoints[i])) { + if(saved_i >= (int)state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[saved_i++] = codepoints[i++]; + } + if(saved_i >= (int)state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[saved_i] = 0; + +#ifdef DEBUG_GLYPH_COMBINE + for(; state->combine_chars[printpos]; printpos++) + printf("U+%04x ", state->combine_chars[printpos]); + printf("}\n"); +#endif + + /* Now render it */ + putglyph(state, state->combine_chars, state->combine_width, state->combine_pos); + } + else { + DEBUG_LOG("libvterm: TODO: Skip over split char+combining\n"); + } + } + + for(; i < npoints; i++) { + // Try to find combining characters following this + int glyph_starts = i; + int glyph_ends; + int width = 0; + uint32_t *chars; + + for(glyph_ends = i + 1; glyph_ends < npoints; glyph_ends++) + if(!vterm_unicode_is_combining(codepoints[glyph_ends])) + break; + + chars = vterm_allocator_malloc(state->vt, (glyph_ends - glyph_starts + 1) * sizeof(uint32_t)); + + for( ; i < glyph_ends; i++) { + int this_width; + chars[i - glyph_starts] = codepoints[i]; + this_width = vterm_unicode_width(codepoints[i]); +#ifdef DEBUG + if(this_width < 0) { + fprintf(stderr, "Text with negative-width codepoint U+%04x\n", codepoints[i]); + abort(); + } +#endif + width += this_width; + } + + chars[glyph_ends - glyph_starts] = 0; + i--; + +#ifdef DEBUG_GLYPH_COMBINE + int printpos; + printf("DEBUG: COMBINED GLYPH of %d chars {", glyph_ends - glyph_starts); + for(printpos = 0; printpos < glyph_ends - glyph_starts; printpos++) + printf("U+%04x ", chars[printpos]); + printf("}, onscreen width %d\n", width); +#endif + + if(state->at_phantom || state->pos.col + width > THISROWWIDTH(state)) { + linefeed(state); + state->pos.col = 0; + state->at_phantom = 0; + } + + if(state->mode.insert) { + /* TODO: This will be a little inefficient for large bodies of text, as + * it'll have to 'ICH' effectively before every glyph. We should scan + * ahead and ICH as many times as required + */ + VTermRect rect; + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + rect.end_col = THISROWWIDTH(state); + scroll(state, rect, 0, -1); + } + + putglyph(state, chars, width, state->pos); + + if(i == npoints - 1) { + /* End of the buffer. Save the chars in case we have to combine with + * more on the next call */ + int save_i; + for(save_i = 0; chars[save_i]; save_i++) { + if(save_i >= (int)state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[save_i] = chars[save_i]; + } + if(save_i >= (int)state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[save_i] = 0; + state->combine_width = width; + state->combine_pos = state->pos; + } + + if(state->pos.col + width >= THISROWWIDTH(state)) { + if(state->mode.autowrap) + state->at_phantom = 1; + } + else { + state->pos.col += width; + } + vterm_allocator_free(state->vt, chars); + } + + updatecursor(state, &oldpos, 0); + +#ifdef DEBUG + if(state->pos.row < 0 || state->pos.row >= state->rows || + state->pos.col < 0 || state->pos.col >= state->cols) { + fprintf(stderr, "Position out of bounds after text: (%d,%d)\n", + state->pos.row, state->pos.col); + abort(); + } +#endif + + vterm_allocator_free(state->vt, codepoints); + return (int)eaten; +} + +static int on_control(unsigned char control, void *user) +{ + VTermState *state = user; + + VTermPos oldpos = state->pos; + + switch(control) { + case 0x07: // BEL - ECMA-48 8.3.3 + if(state->callbacks && state->callbacks->bell) + (*state->callbacks->bell)(state->cbdata); + break; + + case 0x08: // BS - ECMA-48 8.3.5 + if(state->pos.col > 0) + state->pos.col--; + break; + + case 0x09: // HT - ECMA-48 8.3.60 + tab(state, 1, +1); + break; + + case 0x0a: // LF - ECMA-48 8.3.74 + case 0x0b: // VT + case 0x0c: // FF + linefeed(state); + if(state->mode.newline) + state->pos.col = 0; + break; + + case 0x0d: // CR - ECMA-48 8.3.15 + state->pos.col = 0; + break; + + case 0x0e: // LS1 - ECMA-48 8.3.76 + state->gl_set = 1; + break; + + case 0x0f: // LS0 - ECMA-48 8.3.75 + state->gl_set = 0; + break; + + case 0x84: // IND - DEPRECATED but implemented for completeness + linefeed(state); + break; + + case 0x85: // NEL - ECMA-48 8.3.86 + linefeed(state); + state->pos.col = 0; + break; + + case 0x88: // HTS - ECMA-48 8.3.62 + set_col_tabstop(state, state->pos.col); + break; + + case 0x8d: // RI - ECMA-48 8.3.104 + if(state->pos.row == state->scrollregion_top) { + VTermRect rect; + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, -1, 0); + } + else if(state->pos.row > 0) + state->pos.row--; + break; + + case 0x8e: // SS2 - ECMA-48 8.3.141 + state->gsingle_set = 2; + break; + + case 0x8f: // SS3 - ECMA-48 8.3.142 + state->gsingle_set = 3; + break; + + default: + if(state->fallbacks && state->fallbacks->control) + if((*state->fallbacks->control)(control, state->fbdata)) + return 1; + + return 0; + } + + updatecursor(state, &oldpos, 1); + +#ifdef DEBUG + if(state->pos.row < 0 || state->pos.row >= state->rows || + state->pos.col < 0 || state->pos.col >= state->cols) { + fprintf(stderr, "Position out of bounds after Ctrl %02x: (%d,%d)\n", + control, state->pos.row, state->pos.col); + abort(); + } +#endif + + return 1; +} + +static int settermprop_bool(VTermState *state, VTermProp prop, int v) +{ + VTermValue val; + val.boolean = v; + return vterm_state_set_termprop(state, prop, &val); +} + +static int settermprop_int(VTermState *state, VTermProp prop, int v) +{ + VTermValue val; + val.number = v; + return vterm_state_set_termprop(state, prop, &val); +} + +static int settermprop_string(VTermState *state, VTermProp prop, const char *str, size_t len) +{ + char *strvalue; + int r; + VTermValue val; + strvalue = vterm_allocator_malloc(state->vt, (len+1) * sizeof(char)); + strncpy(strvalue, str, len); + strvalue[len] = 0; + + val.string = strvalue; + r = vterm_state_set_termprop(state, prop, &val); + vterm_allocator_free(state->vt, strvalue); + return r; +} + +static void savecursor(VTermState *state, int save) +{ + if(save) { + state->saved.pos = state->pos; + state->saved.mode.cursor_visible = state->mode.cursor_visible; + state->saved.mode.cursor_blink = state->mode.cursor_blink; + state->saved.mode.cursor_shape = state->mode.cursor_shape; + + vterm_state_savepen(state, 1); + } + else { + VTermPos oldpos = state->pos; + + state->pos = state->saved.pos; + + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, state->saved.mode.cursor_visible); + settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->saved.mode.cursor_blink); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->saved.mode.cursor_shape); + + vterm_state_savepen(state, 0); + + updatecursor(state, &oldpos, 1); + } +} + +static int on_escape(const char *bytes, size_t len, void *user) +{ + VTermState *state = user; + + /* Easier to decode this from the first byte, even though the final + * byte terminates it + */ + switch(bytes[0]) { + case ' ': + if(len != 2) + return 0; + + switch(bytes[1]) { + case 'F': // S7C1T + state->vt->mode.ctrl8bit = 0; + break; + + case 'G': // S8C1T + state->vt->mode.ctrl8bit = 1; + break; + + default: + return 0; + } + return 2; + + case '#': + if(len != 2) + return 0; + + switch(bytes[1]) { + case '3': // DECDHL top + if(state->mode.leftrightmargin) + break; + set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_TOP); + break; + + case '4': // DECDHL bottom + if(state->mode.leftrightmargin) + break; + set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_BOTTOM); + break; + + case '5': // DECSWL + if(state->mode.leftrightmargin) + break; + set_lineinfo(state, state->pos.row, NO_FORCE, DWL_OFF, DHL_OFF); + break; + + case '6': // DECDWL + if(state->mode.leftrightmargin) + break; + set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_OFF); + break; + + case '8': // DECALN + { + VTermPos pos; + uint32_t E[] = { 'E', 0 }; + for(pos.row = 0; pos.row < state->rows; pos.row++) + for(pos.col = 0; pos.col < ROWWIDTH(state, pos.row); pos.col++) + putglyph(state, E, 1, pos); + break; + } + + default: + return 0; + } + return 2; + + case '(': case ')': case '*': case '+': // SCS + if(len != 2) + return 0; + + { + int setnum = bytes[0] - 0x28; + VTermEncoding *newenc = vterm_lookup_encoding(ENC_SINGLE_94, bytes[1]); + + if(newenc) { + state->encoding[setnum].enc = newenc; + + if(newenc->init) + (*newenc->init)(newenc, state->encoding[setnum].data); + } + } + + return 2; + + case '7': // DECSC + savecursor(state, 1); + return 1; + + case '8': // DECRC + savecursor(state, 0); + return 1; + + case '<': // Ignored by VT100. Used in VT52 mode to switch up to VT100 + return 1; + + case '=': // DECKPAM + state->mode.keypad = 1; + return 1; + + case '>': // DECKPNM + state->mode.keypad = 0; + return 1; + + case 'c': // RIS - ECMA-48 8.3.105 + { + VTermPos oldpos = state->pos; + vterm_state_reset(state, 1); + if(state->callbacks && state->callbacks->movecursor) + (*state->callbacks->movecursor)(state->pos, oldpos, state->mode.cursor_visible, state->cbdata); + return 1; + } + + case 'n': // LS2 - ECMA-48 8.3.78 + state->gl_set = 2; + return 1; + + case 'o': // LS3 - ECMA-48 8.3.80 + state->gl_set = 3; + return 1; + + case '~': // LS1R - ECMA-48 8.3.77 + state->gr_set = 1; + return 1; + + case '}': // LS2R - ECMA-48 8.3.79 + state->gr_set = 2; + return 1; + + case '|': // LS3R - ECMA-48 8.3.81 + state->gr_set = 3; + return 1; + + default: + return 0; + } +} + +static void set_mode(VTermState *state, int num, int val) +{ + switch(num) { + case 4: // IRM - ECMA-48 7.2.10 + state->mode.insert = val; + break; + + case 20: // LNM - ANSI X3.4-1977 + state->mode.newline = val; + break; + + default: + DEBUG_LOG1("libvterm: Unknown mode %d\n", num); + return; + } +} + +static void set_dec_mode(VTermState *state, int num, int val) +{ + switch(num) { + case 1: + state->mode.cursor = val; + break; + + case 5: // DECSCNM - screen mode + settermprop_bool(state, VTERM_PROP_REVERSE, val); + break; + + case 6: // DECOM - origin mode + { + VTermPos oldpos = state->pos; + state->mode.origin = val; + state->pos.row = state->mode.origin ? state->scrollregion_top : 0; + state->pos.col = state->mode.origin ? SCROLLREGION_LEFT(state) : 0; + updatecursor(state, &oldpos, 1); + } + break; + + case 7: + state->mode.autowrap = val; + break; + + case 12: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, val); + break; + + case 25: + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val); + break; + + case 69: // DECVSSM - vertical split screen mode + // DECLRMM - left/right margin mode + state->mode.leftrightmargin = val; + if(val) { + int row; + + // Setting DECVSSM must clear doublewidth/doubleheight state of every line + for(row = 0; row < state->rows; row++) + set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); + } + + break; + + case 1000: + case 1002: + case 1003: + settermprop_int(state, VTERM_PROP_MOUSE, + !val ? VTERM_PROP_MOUSE_NONE : + (num == 1000) ? VTERM_PROP_MOUSE_CLICK : + (num == 1002) ? VTERM_PROP_MOUSE_DRAG : + VTERM_PROP_MOUSE_MOVE); + break; + + case 1004: + state->mode.report_focus = val; + break; + + case 1005: + state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10; + break; + + case 1006: + state->mouse_protocol = val ? MOUSE_SGR : MOUSE_X10; + break; + + case 1015: + state->mouse_protocol = val ? MOUSE_RXVT : MOUSE_X10; + break; + + case 1047: + settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); + break; + + case 1048: + savecursor(state, val); + break; + + case 1049: + settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); + savecursor(state, val); + break; + + case 2004: + state->mode.bracketpaste = val; + break; + + default: + DEBUG_LOG1("libvterm: Unknown DEC mode %d\n", num); + return; + } +} + +static void request_dec_mode(VTermState *state, int num) +{ + int reply; + + switch(num) { + case 1: + reply = state->mode.cursor; + break; + + case 5: + reply = state->mode.screen; + break; + + case 6: + reply = state->mode.origin; + break; + + case 7: + reply = state->mode.autowrap; + break; + + case 12: + reply = state->mode.cursor_blink; + break; + + case 25: + reply = state->mode.cursor_visible; + break; + + case 69: + reply = state->mode.leftrightmargin; + break; + + case 1000: + reply = state->mouse_flags == MOUSE_WANT_CLICK; + break; + + case 1002: + reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_DRAG); + break; + + case 1003: + reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_MOVE); + break; + + case 1004: + reply = state->mode.report_focus; + break; + + case 1005: + reply = state->mouse_protocol == MOUSE_UTF8; + break; + + case 1006: + reply = state->mouse_protocol == MOUSE_SGR; + break; + + case 1015: + reply = state->mouse_protocol == MOUSE_RXVT; + break; + + case 1047: + reply = state->mode.alt_screen; + break; + + case 2004: + reply = state->mode.bracketpaste; + break; + + default: + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, 0); + return; + } + + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, reply ? 1 : 2); +} + +static int on_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) +{ + VTermState *state = user; + int leader_byte = 0; + int intermed_byte = 0; + VTermPos oldpos = state->pos; + + /* Some temporaries for later code */ + int count, val; + int row, col; + VTermRect rect; + int selective; + + if(leader && leader[0]) { + if(leader[1]) // longer than 1 char + return 0; + + switch(leader[0]) { + case '?': + case '>': + leader_byte = leader[0]; + break; + default: + return 0; + } + } + + if(intermed && intermed[0]) { + if(intermed[1]) // longer than 1 char + return 0; + + switch(intermed[0]) { + case ' ': + case '"': + case '$': + case '\'': + intermed_byte = intermed[0]; + break; + default: + return 0; + } + } + + oldpos = state->pos; + +#define LBOUND(v,min) if((v) < (min)) (v) = (min) +#define UBOUND(v,max) if((v) > (max)) (v) = (max) + +#define LEADER(l,b) ((l << 8) | b) +#define INTERMED(i,b) ((i << 16) | b) + + switch(intermed_byte << 16 | leader_byte << 8 | command) { + case 0x40: // ICH - ECMA-48 8.3.64 + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + if(state->mode.leftrightmargin) + rect.end_col = SCROLLREGION_RIGHT(state); + else + rect.end_col = THISROWWIDTH(state); + + scroll(state, rect, 0, -count); + + break; + + case 0x41: // CUU - ECMA-48 8.3.22 + count = CSI_ARG_COUNT(args[0]); + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x42: // CUD - ECMA-48 8.3.19 + count = CSI_ARG_COUNT(args[0]); + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x43: // CUF - ECMA-48 8.3.20 + count = CSI_ARG_COUNT(args[0]); + state->pos.col += count; + state->at_phantom = 0; + break; + + case 0x44: // CUB - ECMA-48 8.3.18 + count = CSI_ARG_COUNT(args[0]); + state->pos.col -= count; + state->at_phantom = 0; + break; + + case 0x45: // CNL - ECMA-48 8.3.12 + count = CSI_ARG_COUNT(args[0]); + state->pos.col = 0; + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x46: // CPL - ECMA-48 8.3.13 + count = CSI_ARG_COUNT(args[0]); + state->pos.col = 0; + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x47: // CHA - ECMA-48 8.3.9 + val = CSI_ARG_OR(args[0], 1); + state->pos.col = val-1; + state->at_phantom = 0; + break; + + case 0x48: // CUP - ECMA-48 8.3.21 + row = CSI_ARG_OR(args[0], 1); + col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); + // zero-based + state->pos.row = row-1; + state->pos.col = col-1; + if(state->mode.origin) { + state->pos.row += state->scrollregion_top; + state->pos.col += SCROLLREGION_LEFT(state); + } + state->at_phantom = 0; + break; + + case 0x49: // CHT - ECMA-48 8.3.10 + count = CSI_ARG_COUNT(args[0]); + tab(state, count, +1); + break; + + case 0x4a: // ED - ECMA-48 8.3.39 + case LEADER('?', 0x4a): // DECSED - Selective Erase in Display + selective = (leader_byte == '?'); + switch(CSI_ARG(args[0])) { + case CSI_ARG_MISSING: + case 0: + rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; rect.end_col = state->cols; + if(rect.end_col > rect.start_col) + erase(state, rect, selective); + + rect.start_row = state->pos.row + 1; rect.end_row = state->rows; + rect.start_col = 0; + for(row = rect.start_row; row < rect.end_row; row++) + set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); + if(rect.end_row > rect.start_row) + erase(state, rect, selective); + break; + + case 1: + rect.start_row = 0; rect.end_row = state->pos.row; + rect.start_col = 0; rect.end_col = state->cols; + for(row = rect.start_row; row < rect.end_row; row++) + set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); + if(rect.end_col > rect.start_col) + erase(state, rect, selective); + + rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; + rect.end_col = state->pos.col + 1; + if(rect.end_row > rect.start_row) + erase(state, rect, selective); + break; + + case 2: + rect.start_row = 0; rect.end_row = state->rows; + rect.start_col = 0; rect.end_col = state->cols; + for(row = rect.start_row; row < rect.end_row; row++) + set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); + erase(state, rect, selective); + break; + } + break; + + case 0x4b: // EL - ECMA-48 8.3.41 + case LEADER('?', 0x4b): // DECSEL - Selective Erase in Line + selective = (leader_byte == '?'); + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + + switch(CSI_ARG(args[0])) { + case CSI_ARG_MISSING: + case 0: + rect.start_col = state->pos.col; rect.end_col = THISROWWIDTH(state); break; + case 1: + rect.start_col = 0; rect.end_col = state->pos.col + 1; break; + case 2: + rect.start_col = 0; rect.end_col = THISROWWIDTH(state); break; + default: + return 0; + } + + if(rect.end_col > rect.start_col) + erase(state, rect, selective); + + break; + + case 0x4c: // IL - ECMA-48 8.3.67 + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->pos.row; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, -count, 0); + + break; + + case 0x4d: // DL - ECMA-48 8.3.32 + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->pos.row; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, count, 0); + + break; + + case 0x50: // DCH - ECMA-48 8.3.26 + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + if(state->mode.leftrightmargin) + rect.end_col = SCROLLREGION_RIGHT(state); + else + rect.end_col = THISROWWIDTH(state); + + scroll(state, rect, 0, count); + + break; + + case 0x53: // SU - ECMA-48 8.3.147 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, count, 0); + + break; + + case 0x54: // SD - ECMA-48 8.3.113 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = SCROLLREGION_LEFT(state); + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, -count, 0); + + break; + + case 0x58: // ECH - ECMA-48 8.3.38 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + rect.end_col = state->pos.col + count; + UBOUND(rect.end_col, THISROWWIDTH(state)); + + erase(state, rect, 0); + break; + + case 0x5a: // CBT - ECMA-48 8.3.7 + count = CSI_ARG_COUNT(args[0]); + tab(state, count, -1); + break; + + case 0x60: // HPA - ECMA-48 8.3.57 + col = CSI_ARG_OR(args[0], 1); + state->pos.col = col-1; + state->at_phantom = 0; + break; + + case 0x61: // HPR - ECMA-48 8.3.59 + count = CSI_ARG_COUNT(args[0]); + state->pos.col += count; + state->at_phantom = 0; + break; + + case 0x63: // DA - ECMA-48 8.3.24 + val = CSI_ARG_OR(args[0], 0); + if(val == 0) + // DEC VT100 response + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?1;2c"); + break; + + case LEADER('>', 0x63): // DEC secondary Device Attributes + // This returns xterm version number 100. + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">%d;%d;%dc", 0, 100, 0); + break; + + case 0x64: // VPA - ECMA-48 8.3.158 + row = CSI_ARG_OR(args[0], 1); + state->pos.row = row-1; + if(state->mode.origin) + state->pos.row += state->scrollregion_top; + state->at_phantom = 0; + break; + + case 0x65: // VPR - ECMA-48 8.3.160 + count = CSI_ARG_COUNT(args[0]); + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x66: // HVP - ECMA-48 8.3.63 + row = CSI_ARG_OR(args[0], 1); + col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); + // zero-based + state->pos.row = row-1; + state->pos.col = col-1; + if(state->mode.origin) { + state->pos.row += state->scrollregion_top; + state->pos.col += SCROLLREGION_LEFT(state); + } + state->at_phantom = 0; + break; + + case 0x67: // TBC - ECMA-48 8.3.154 + val = CSI_ARG_OR(args[0], 0); + + switch(val) { + case 0: + clear_col_tabstop(state, state->pos.col); + break; + case 3: + case 5: + for(col = 0; col < state->cols; col++) + clear_col_tabstop(state, col); + break; + case 1: + case 2: + case 4: + break; + /* TODO: 1, 2 and 4 aren't meaningful yet without line tab stops */ + default: + return 0; + } + break; + + case 0x68: // SM - ECMA-48 8.3.125 + if(!CSI_ARG_IS_MISSING(args[0])) + set_mode(state, CSI_ARG(args[0]), 1); + break; + + case LEADER('?', 0x68): // DEC private mode set + if(!CSI_ARG_IS_MISSING(args[0])) + set_dec_mode(state, CSI_ARG(args[0]), 1); + break; + + case 0x6a: // HPB - ECMA-48 8.3.58 + count = CSI_ARG_COUNT(args[0]); + state->pos.col -= count; + state->at_phantom = 0; + break; + + case 0x6b: // VPB - ECMA-48 8.3.159 + count = CSI_ARG_COUNT(args[0]); + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x6c: // RM - ECMA-48 8.3.106 + if(!CSI_ARG_IS_MISSING(args[0])) + set_mode(state, CSI_ARG(args[0]), 0); + break; + + case LEADER('?', 0x6c): // DEC private mode reset + if(!CSI_ARG_IS_MISSING(args[0])) + set_dec_mode(state, CSI_ARG(args[0]), 0); + break; + + case 0x6d: // SGR - ECMA-48 8.3.117 + vterm_state_setpen(state, args, argcount); + break; + + case 0x6e: // DSR - ECMA-48 8.3.35 + case LEADER('?', 0x6e): // DECDSR + val = CSI_ARG_OR(args[0], 0); + + { + char *qmark = (leader_byte == '?') ? "?" : ""; + + switch(val) { + case 0: case 1: case 2: case 3: case 4: + // ignore - these are replies + break; + case 5: + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s0n", qmark); + break; + case 6: // CPR - cursor position report + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s%d;%dR", qmark, state->pos.row + 1, state->pos.col + 1); + break; + } + } + break; + + + case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset + vterm_state_reset(state, 0); + break; + + case LEADER('?', INTERMED('$', 0x70)): + request_dec_mode(state, CSI_ARG(args[0])); + break; + + case INTERMED(' ', 0x71): // DECSCUSR - DEC set cursor shape + val = CSI_ARG_OR(args[0], 1); + + switch(val) { + case 0: case 1: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); + break; + case 2: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); + break; + case 3: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); + break; + case 4: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); + break; + case 5: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); + break; + case 6: + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); + break; + } + + break; + + case INTERMED('"', 0x71): // DECSCA - DEC select character protection attribute + val = CSI_ARG_OR(args[0], 0); + + switch(val) { + case 0: case 2: + state->protected_cell = 0; + break; + case 1: + state->protected_cell = 1; + break; + } + + break; + + case 0x72: // DECSTBM - DEC custom + state->scrollregion_top = CSI_ARG_OR(args[0], 1) - 1; + state->scrollregion_bottom = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); + LBOUND(state->scrollregion_top, 0); + UBOUND(state->scrollregion_top, state->rows); + LBOUND(state->scrollregion_bottom, -1); + if(state->scrollregion_top == 0 && state->scrollregion_bottom == state->rows) + state->scrollregion_bottom = -1; + else + UBOUND(state->scrollregion_bottom, state->rows); + + if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { + // Invalid + state->scrollregion_top = 0; + state->scrollregion_bottom = -1; + } + + break; + + case 0x73: // DECSLRM - DEC custom + // Always allow setting these margins, just they won't take effect without DECVSSM + state->scrollregion_left = CSI_ARG_OR(args[0], 1) - 1; + state->scrollregion_right = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); + LBOUND(state->scrollregion_left, 0); + UBOUND(state->scrollregion_left, state->cols); + LBOUND(state->scrollregion_right, -1); + if(state->scrollregion_left == 0 && state->scrollregion_right == state->cols) + state->scrollregion_right = -1; + else + UBOUND(state->scrollregion_right, state->cols); + + if(state->scrollregion_right > -1 && + state->scrollregion_right <= state->scrollregion_left) { + // Invalid + state->scrollregion_left = 0; + state->scrollregion_right = -1; + } + + break; + + case 0x74: + switch(CSI_ARG(args[0])) { + case 8: /* CSI 8 ; rows ; cols t set size */ + if (argcount == 3) + on_resize(CSI_ARG(args[1]), CSI_ARG(args[2]), state); + } + break; + + case INTERMED('\'', 0x7D): // DECIC + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = state->pos.col; + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, 0, -count); + + break; + + case INTERMED('\'', 0x7E): // DECDC + count = CSI_ARG_COUNT(args[0]); + + if(!is_cursor_in_scrollregion(state)) + break; + + rect.start_row = state->scrollregion_top; + rect.end_row = SCROLLREGION_BOTTOM(state); + rect.start_col = state->pos.col; + rect.end_col = SCROLLREGION_RIGHT(state); + + scroll(state, rect, 0, count); + + break; + + default: + if(state->fallbacks && state->fallbacks->csi) + if((*state->fallbacks->csi)(leader, args, argcount, intermed, command, state->fbdata)) + return 1; + + return 0; + } + + if(state->mode.origin) { + LBOUND(state->pos.row, state->scrollregion_top); + UBOUND(state->pos.row, SCROLLREGION_BOTTOM(state)-1); + LBOUND(state->pos.col, SCROLLREGION_LEFT(state)); + UBOUND(state->pos.col, SCROLLREGION_RIGHT(state)-1); + } + else { + LBOUND(state->pos.row, 0); + UBOUND(state->pos.row, state->rows-1); + LBOUND(state->pos.col, 0); + UBOUND(state->pos.col, THISROWWIDTH(state)-1); + } + + updatecursor(state, &oldpos, 1); + +#ifdef DEBUG + if(state->pos.row < 0 || state->pos.row >= state->rows || + state->pos.col < 0 || state->pos.col >= state->cols) { + fprintf(stderr, "Position out of bounds after CSI %c: (%d,%d)\n", + command, state->pos.row, state->pos.col); + abort(); + } + + if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { + fprintf(stderr, "Scroll region height out of bounds after CSI %c: %d <= %d\n", + command, SCROLLREGION_BOTTOM(state), state->scrollregion_top); + abort(); + } + + if(SCROLLREGION_RIGHT(state) <= SCROLLREGION_LEFT(state)) { + fprintf(stderr, "Scroll region width out of bounds after CSI %c: %d <= %d\n", + command, SCROLLREGION_RIGHT(state), SCROLLREGION_LEFT(state)); + abort(); + } +#endif + + return 1; +} + +static int on_osc(const char *command, size_t cmdlen, void *user) +{ + VTermState *state = user; + + if(cmdlen < 2) + return 0; + + if(strneq(command, "0;", 2)) { + settermprop_string(state, VTERM_PROP_ICONNAME, command + 2, cmdlen - 2); + settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2); + return 1; + } + else if(strneq(command, "1;", 2)) { + settermprop_string(state, VTERM_PROP_ICONNAME, command + 2, cmdlen - 2); + return 1; + } + else if(strneq(command, "2;", 2)) { + settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2); + return 1; + } + else if(strneq(command, "10;", 3)) { + /* request foreground color: <Esc>]10;?<0x07> */ + int red = state->default_fg.red; + int blue = state->default_fg.blue; + int green = state->default_fg.green; + vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "10;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); + return 1; + } + else if(strneq(command, "11;", 3)) { + /* request background color: <Esc>]11;?<0x07> */ + int red = state->default_bg.red; + int blue = state->default_bg.blue; + int green = state->default_bg.green; + vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "11;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); + return 1; + } + else if(strneq(command, "12;", 3)) { + settermprop_string(state, VTERM_PROP_CURSORCOLOR, command + 3, cmdlen - 3); + return 1; + } + else if(state->fallbacks && state->fallbacks->osc) + if((*state->fallbacks->osc)(command, cmdlen, state->fbdata)) + return 1; + + return 0; +} + +static void request_status_string(VTermState *state, const char *command, size_t cmdlen) +{ + if(cmdlen == 1) + switch(command[0]) { + case 'm': // Query SGR + { + long args[20]; + int argc = vterm_state_getpen(state, args, sizeof(args)/sizeof(args[0])); + int argi; + vterm_push_output_sprintf_ctrl(state->vt, C1_DCS, "1$r"); + for(argi = 0; argi < argc; argi++) + vterm_push_output_sprintf(state->vt, + argi == argc - 1 ? "%d" : + CSI_ARG_HAS_MORE(args[argi]) ? "%d:" : + "%d;", + CSI_ARG(args[argi])); + vterm_push_output_sprintf(state->vt, "m"); + vterm_push_output_sprintf_ctrl(state->vt, C1_ST, ""); + } + return; + case 'r': // Query DECSTBM + vterm_push_output_sprintf_dcs(state->vt, "1$r%d;%dr", state->scrollregion_top+1, SCROLLREGION_BOTTOM(state)); + return; + case 's': // Query DECSLRM + vterm_push_output_sprintf_dcs(state->vt, "1$r%d;%ds", SCROLLREGION_LEFT(state)+1, SCROLLREGION_RIGHT(state)); + return; + } + + if(cmdlen == 2) { + if(strneq(command, " q", 2)) { + int reply; + switch(state->mode.cursor_shape) { + case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break; + case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break; + default: /* VTERM_PROP_CURSORSHAPE_BAR_LEFT */ reply = 6; break; + } + if(state->mode.cursor_blink) + reply--; + vterm_push_output_sprintf_dcs(state->vt, "1$r%d q", reply); + return; + } + else if(strneq(command, "\"q", 2)) { + vterm_push_output_sprintf_dcs(state->vt, "1$r%d\"q", state->protected_cell ? 1 : 2); + return; + } + } + + vterm_push_output_sprintf_dcs(state->vt, "0$r%.s", (int)cmdlen, command); +} + +static int on_dcs(const char *command, size_t cmdlen, void *user) +{ + VTermState *state = user; + + if(cmdlen >= 2 && strneq(command, "$q", 2)) { + request_status_string(state, command+2, cmdlen-2); + return 1; + } + else if(state->fallbacks && state->fallbacks->dcs) + if((*state->fallbacks->dcs)(command, cmdlen, state->fbdata)) + return 1; + + return 0; +} + +static int on_resize(int rows, int cols, void *user) +{ + VTermState *state = user; + VTermPos oldpos = state->pos; + VTermPos delta = { 0, 0 }; + + if(cols != state->cols) { + unsigned char *newtabstops = vterm_allocator_malloc(state->vt, (cols + 7) / 8); + + /* TODO: This can all be done much more efficiently bytewise */ + int col; + for(col = 0; col < state->cols && col < cols; col++) { + unsigned char mask = 1 << (col & 7); + if(state->tabstops[col >> 3] & mask) + newtabstops[col >> 3] |= mask; + else + newtabstops[col >> 3] &= ~mask; + } + + for( ; col < cols; col++) { + unsigned char mask = 1 << (col & 7); + if(col % 8 == 0) + newtabstops[col >> 3] |= mask; + else + newtabstops[col >> 3] &= ~mask; + } + + vterm_allocator_free(state->vt, state->tabstops); + state->tabstops = newtabstops; + } + + if(rows != state->rows) { + VTermLineInfo *newlineinfo = vterm_allocator_malloc(state->vt, rows * sizeof(VTermLineInfo)); + + int row; + for(row = 0; row < state->rows && row < rows; row++) { + newlineinfo[row] = state->lineinfo[row]; + } + + for( ; row < rows; row++) { + newlineinfo[row].doublewidth = 0; + newlineinfo[row].doubleheight = 0; + } + + vterm_allocator_free(state->vt, state->lineinfo); + state->lineinfo = newlineinfo; + } + + state->rows = rows; + state->cols = cols; + + if(state->scrollregion_bottom > -1) + UBOUND(state->scrollregion_bottom, state->rows); + if(state->scrollregion_right > -1) + UBOUND(state->scrollregion_right, state->cols); + + if(state->callbacks && state->callbacks->resize) + (*state->callbacks->resize)(rows, cols, &delta, state->cbdata); + + if(state->at_phantom && state->pos.col < cols-1) { + state->at_phantom = 0; + state->pos.col++; + } + + state->pos.row += delta.row; + state->pos.col += delta.col; + + if(state->pos.row >= rows) + state->pos.row = rows - 1; + if(state->pos.col >= cols) + state->pos.col = cols - 1; + + updatecursor(state, &oldpos, 1); + + return 1; +} + +static const VTermParserCallbacks parser_callbacks = { + on_text, /* text */ + on_control, /* control */ + on_escape, /* escape */ + on_csi, /* csi */ + on_osc, /* osc */ + on_dcs, /* dcs */ + on_resize /* resize */ +}; + +VTermState *vterm_obtain_state(VTerm *vt) +{ + VTermState *state; + if(vt->state) + return vt->state; + + state = vterm_state_new(vt); + vt->state = state; + + state->combine_chars_size = 16; + state->combine_chars = vterm_allocator_malloc(state->vt, state->combine_chars_size * sizeof(state->combine_chars[0])); + + state->tabstops = vterm_allocator_malloc(state->vt, (state->cols + 7) / 8); + + state->lineinfo = vterm_allocator_malloc(state->vt, state->rows * sizeof(VTermLineInfo)); + + state->encoding_utf8.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); + if(*state->encoding_utf8.enc->init != NULL) + (*state->encoding_utf8.enc->init)(state->encoding_utf8.enc, state->encoding_utf8.data); + + vterm_parser_set_callbacks(vt, &parser_callbacks, state); + + return state; +} + +void vterm_state_reset(VTermState *state, int hard) +{ + VTermEncoding *default_enc; + + state->scrollregion_top = 0; + state->scrollregion_bottom = -1; + state->scrollregion_left = 0; + state->scrollregion_right = -1; + + state->mode.keypad = 0; + state->mode.cursor = 0; + state->mode.autowrap = 1; + state->mode.insert = 0; + state->mode.newline = 0; + state->mode.alt_screen = 0; + state->mode.origin = 0; + state->mode.leftrightmargin = 0; + state->mode.bracketpaste = 0; + state->mode.report_focus = 0; + + state->vt->mode.ctrl8bit = 0; + + { + int col; + for(col = 0; col < state->cols; col++) + if(col % 8 == 0) + set_col_tabstop(state, col); + else + clear_col_tabstop(state, col); + } + + { + int row; + for(row = 0; row < state->rows; row++) + set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); + } + + if(state->callbacks && state->callbacks->initpen) + (*state->callbacks->initpen)(state->cbdata); + + vterm_state_resetpen(state); + + default_enc = state->vt->mode.utf8 ? + vterm_lookup_encoding(ENC_UTF8, 'u') : + vterm_lookup_encoding(ENC_SINGLE_94, 'B'); + + { + int i; + for(i = 0; i < 4; i++) { + state->encoding[i].enc = default_enc; + if(default_enc->init) + (*default_enc->init)(default_enc, state->encoding[i].data); + } + } + + state->gl_set = 0; + state->gr_set = 1; + state->gsingle_set = 0; + + state->protected_cell = 0; + + // Initialise the props + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, 1); + settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); + + if(hard) { + VTermRect rect = { 0, 0, 0, 0 }; + + state->pos.row = 0; + state->pos.col = 0; + state->at_phantom = 0; + + rect.end_row = state->rows; + rect.end_col = state->cols; + erase(state, rect, 0); + } +} + +void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos) +{ + *cursorpos = state->pos; +} + +void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate) +{ + mousestate->pos.col = state->mouse_col; + mousestate->pos.row = state->mouse_row; + mousestate->buttons = state->mouse_buttons; + mousestate->flags = state->mouse_flags; +} + +void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user) +{ + if(callbacks) { + state->callbacks = callbacks; + state->cbdata = user; + + if(state->callbacks && state->callbacks->initpen) + (*state->callbacks->initpen)(state->cbdata); + } + else { + state->callbacks = NULL; + state->cbdata = NULL; + } +} + +void *vterm_state_get_cbdata(VTermState *state) +{ + return state->cbdata; +} + +void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user) +{ + if(fallbacks) { + state->fallbacks = fallbacks; + state->fbdata = user; + } + else { + state->fallbacks = NULL; + state->fbdata = NULL; + } +} + +void *vterm_state_get_unrecognised_fbdata(VTermState *state) +{ + return state->fbdata; +} + +int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val) +{ + /* Only store the new value of the property if usercode said it was happy. + * This is especially important for altscreen switching */ + if(state->callbacks && state->callbacks->settermprop) + if(!(*state->callbacks->settermprop)(prop, val, state->cbdata)) + return 0; + + switch(prop) { + case VTERM_PROP_TITLE: + case VTERM_PROP_ICONNAME: + case VTERM_PROP_CURSORCOLOR: + // we don't store these, just transparently pass through + return 1; + case VTERM_PROP_CURSORVISIBLE: + state->mode.cursor_visible = val->boolean; + return 1; + case VTERM_PROP_CURSORBLINK: + state->mode.cursor_blink = val->boolean; + return 1; + case VTERM_PROP_CURSORSHAPE: + state->mode.cursor_shape = val->number; + return 1; + case VTERM_PROP_REVERSE: + state->mode.screen = val->boolean; + return 1; + case VTERM_PROP_ALTSCREEN: + state->mode.alt_screen = val->boolean; + if(state->mode.alt_screen) { + VTermRect rect = {0, 0, 0, 0}; + rect.end_row = state->rows; + rect.end_col = state->cols; + erase(state, rect, 0); + } + return 1; + case VTERM_PROP_MOUSE: + state->mouse_flags = 0; + if(val->number) + state->mouse_flags |= MOUSE_WANT_CLICK; + if(val->number == VTERM_PROP_MOUSE_DRAG) + state->mouse_flags |= MOUSE_WANT_DRAG; + if(val->number == VTERM_PROP_MOUSE_MOVE) + state->mouse_flags |= MOUSE_WANT_MOVE; + return 1; + + case VTERM_N_PROPS: + return 0; + } + + return 0; +} + +void vterm_state_focus_in(VTermState *state) +{ + if(state->mode.report_focus) + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "I"); +} + +void vterm_state_focus_out(VTermState *state) +{ + if(state->mode.report_focus) + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "O"); +} + +const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row) +{ + return state->lineinfo + row; +} diff --git a/src/libvterm/src/unicode.c b/src/libvterm/src/unicode.c new file mode 100644 index 0000000000..48d4a852a7 --- /dev/null +++ b/src/libvterm/src/unicode.c @@ -0,0 +1,349 @@ +#include "vterm_internal.h" + +// ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c +// With modifications: +// made functions static +// moved 'combining' table to file scope, so other functions can see it +// ################################################################### + +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +#if !defined(IS_COMBINING_FUNCTION) || !defined(WCWIDTH_FUNCTION) +struct interval { + int first; + int last; +}; + +/* sorted list of non-overlapping intervals of non-spacing characters */ +/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ +static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(uint32_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if ((int)ucs < table[0].first || (int)ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if ((int)ucs > table[mid].last) + min = mid + 1; + else if ((int)ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} +#endif + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that uint32_t characters are encoded + * in ISO 10646. + */ + +#ifdef WCWIDTH_FUNCTION +/* use a provided wcwidth() function */ +int WCWIDTH_FUNCTION(uint32_t ucs); +#else +# define WCWIDTH_FUNCTION mk_wcwidth + +static int mk_wcwidth(uint32_t ucs) +{ + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + (ucs >= 0x20000 && ucs <= 0x2fffd) || + (ucs >= 0x30000 && ucs <= 0x3fffd))); +} +#endif + +#if 0 /* unused */ +static int mk_wcswidth(const uint32_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +static int mk_wcwidth_cjk(uint32_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + +static int mk_wcswidth_cjk(const uint32_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} +#endif + +#ifdef IS_COMBINING_FUNCTION +/* Use a provided is_combining() function. */ +int IS_COMBINING_FUNCTION(uint32_t codepoint); +#else +# define IS_COMBINING_FUNCTION vterm_is_combining + static int +vterm_is_combining(uint32_t codepoint) +{ + return bisearch(codepoint, combining, sizeof(combining) / sizeof(struct interval) - 1); +} +#endif + +// ################################ +// ### The rest added by Paul Evans + +INTERNAL int vterm_unicode_width(uint32_t codepoint) +{ + return WCWIDTH_FUNCTION(codepoint); +} + +INTERNAL int vterm_unicode_is_combining(uint32_t codepoint) +{ + return IS_COMBINING_FUNCTION(codepoint); +} diff --git a/src/libvterm/src/utf8.h b/src/libvterm/src/utf8.h new file mode 100644 index 0000000000..886a1ca5a6 --- /dev/null +++ b/src/libvterm/src/utf8.h @@ -0,0 +1,47 @@ +/* The following functions copied and adapted from libtermkey + * + * http://www.leonerd.org.uk/code/libtermkey/ + */ +unsigned int utf8_seqlen(long codepoint); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE unsigned int utf8_seqlen(long codepoint) +{ + if(codepoint < 0x0000080) return 1; + if(codepoint < 0x0000800) return 2; + if(codepoint < 0x0010000) return 3; + if(codepoint < 0x0200000) return 4; + if(codepoint < 0x4000000) return 5; + return 6; +} +#endif + +/* Does NOT NUL-terminate the buffer */ +int fill_utf8(long codepoint, char *str); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE int fill_utf8(long codepoint, char *str) +{ + int nbytes = utf8_seqlen(codepoint); + + // This is easier done backwards + int b = nbytes; + while(b > 1) { + b--; + str[b] = 0x80 | (codepoint & 0x3f); + codepoint >>= 6; + } + + switch(nbytes) { + case 1: str[0] = (codepoint & 0x7f); break; + case 2: str[0] = 0xc0 | (codepoint & 0x1f); break; + case 3: str[0] = 0xe0 | (codepoint & 0x0f); break; + case 4: str[0] = 0xf0 | (codepoint & 0x07); break; + case 5: str[0] = 0xf8 | (codepoint & 0x03); break; + case 6: str[0] = 0xfc | (codepoint & 0x01); break; + } + + return nbytes; +} +#endif +/* end copy */ diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c new file mode 100644 index 0000000000..28613b9b06 --- /dev/null +++ b/src/libvterm/src/vterm.c @@ -0,0 +1,407 @@ +#define DEFINE_INLINES + +#include "vterm_internal.h" + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> + +#include "utf8.h" + +/***************** + * API functions * + *****************/ + +static void *default_malloc(size_t size, void *allocdata UNUSED) +{ + void *ptr = malloc(size); + if(ptr) + memset(ptr, 0, size); + return ptr; +} + +static void default_free(void *ptr, void *allocdata UNUSED) +{ + free(ptr); +} + +static VTermAllocatorFunctions default_allocator = { + &default_malloc, // malloc + &default_free // free +}; + +VTerm *vterm_new(int rows, int cols) +{ + return vterm_new_with_allocator(rows, cols, &default_allocator, NULL); +} + +VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata) +{ + /* Need to bootstrap using the allocator function directly */ + VTerm *vt = (*funcs->malloc)(sizeof(VTerm), allocdata); + + vt->allocator = funcs; + vt->allocdata = allocdata; + + vt->rows = rows; + vt->cols = cols; + + vt->parser.state = NORMAL; + + vt->parser.callbacks = NULL; + vt->parser.cbdata = NULL; + + vt->parser.strbuffer_len = 500; /* should be able to hold an OSC string */ + vt->parser.strbuffer_cur = 0; + vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len); + + vt->outbuffer_len = 200; + vt->outbuffer_cur = 0; + vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len); + + return vt; +} + +void vterm_free(VTerm *vt) +{ + if(vt->screen) + vterm_screen_free(vt->screen); + + if(vt->state) + vterm_state_free(vt->state); + + vterm_allocator_free(vt, vt->parser.strbuffer); + vterm_allocator_free(vt, vt->outbuffer); + + vterm_allocator_free(vt, vt); +} + +INTERNAL void *vterm_allocator_malloc(VTerm *vt, size_t size) +{ + return (*vt->allocator->malloc)(size, vt->allocdata); +} + +INTERNAL void vterm_allocator_free(VTerm *vt, void *ptr) +{ + (*vt->allocator->free)(ptr, vt->allocdata); +} + +void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp) +{ + if(rowsp) + *rowsp = vt->rows; + if(colsp) + *colsp = vt->cols; +} + +void vterm_set_size(VTerm *vt, int rows, int cols) +{ + vt->rows = rows; + vt->cols = cols; + + if(vt->parser.callbacks && vt->parser.callbacks->resize) + (*vt->parser.callbacks->resize)(rows, cols, vt->parser.cbdata); +} + +int vterm_get_utf8(const VTerm *vt) +{ + return vt->mode.utf8; +} + +void vterm_set_utf8(VTerm *vt, int is_utf8) +{ + vt->mode.utf8 = is_utf8; +} + +INTERNAL void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len) +{ + if(len > vt->outbuffer_len - vt->outbuffer_cur) { + DEBUG_LOG("vterm_push_output(): buffer overflow; truncating output\n"); + len = vt->outbuffer_len - vt->outbuffer_cur; + } + + memcpy(vt->outbuffer + vt->outbuffer_cur, bytes, len); + vt->outbuffer_cur += len; +} + +static int outbuffer_is_full(VTerm *vt) +{ + return vt->outbuffer_cur >= vt->outbuffer_len - 1; +} + +#if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) \ + || defined(_ISOC99_SOURCE) || defined(_BSD_SOURCE) +# undef VSNPRINTF +# define VSNPRINTF vsnprintf +#else +# ifdef VSNPRINTF +/* Use a provided vsnprintf() function. */ +int VSNPRINTF(char *str, size_t str_m, const char *fmt, va_list ap); +# endif +#endif + + +INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args) +{ + int written; +#ifndef VSNPRINTF + /* When vsnprintf() is not available (C90) fall back to vsprintf(). */ + char buffer[1024]; /* 1Kbyte is enough for everybody, right? */ +#endif + + if(outbuffer_is_full(vt)) { + DEBUG_LOG("vterm_push_output(): buffer overflow; truncating output\n"); + return; + } + +#ifdef VSNPRINTF + written = VSNPRINTF(vt->outbuffer + vt->outbuffer_cur, + vt->outbuffer_len - vt->outbuffer_cur, + format, args); + + if(written == (int)(vt->outbuffer_len - vt->outbuffer_cur)) { + /* output was truncated */ + vt->outbuffer_cur = vt->outbuffer_len - 1; + } + else + vt->outbuffer_cur += written; +#else + written = vsprintf(buffer, format, args); + + if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) { + /* output was truncated */ + written = vt->outbuffer_len - vt->outbuffer_cur; + } + if (written > 0) + { + strncpy(vt->outbuffer + vt->outbuffer_cur, buffer, written + 1); + vt->outbuffer_cur += written; + } +#endif +} + +INTERNAL void vterm_push_output_sprintf(VTerm *vt, const char *format, ...) +{ + va_list args; + va_start(args, format); + vterm_push_output_vsprintf(vt, format, args); + va_end(args); +} + +INTERNAL void vterm_push_output_sprintf_ctrl(VTerm *vt, unsigned char ctrl, const char *fmt, ...) +{ + size_t orig_cur = vt->outbuffer_cur; + va_list args; + + if(ctrl >= 0x80 && !vt->mode.ctrl8bit) + vterm_push_output_sprintf(vt, ESC_S "%c", ctrl - 0x40); + else + vterm_push_output_sprintf(vt, "%c", ctrl); + + va_start(args, fmt); + vterm_push_output_vsprintf(vt, fmt, args); + va_end(args); + + if(outbuffer_is_full(vt)) + vt->outbuffer_cur = orig_cur; +} + +INTERNAL void vterm_push_output_sprintf_dcs(VTerm *vt, const char *fmt, ...) +{ + size_t orig_cur = vt->outbuffer_cur; + va_list args; + + if(!vt->mode.ctrl8bit) + vterm_push_output_sprintf(vt, ESC_S "%c", C1_DCS - 0x40); + else + vterm_push_output_sprintf(vt, "%c", C1_DCS); + + va_start(args, fmt); + vterm_push_output_vsprintf(vt, fmt, args); + va_end(args); + + vterm_push_output_sprintf_ctrl(vt, C1_ST, ""); + + if(outbuffer_is_full(vt)) + vt->outbuffer_cur = orig_cur; +} + +size_t vterm_output_get_buffer_size(const VTerm *vt) +{ + return vt->outbuffer_len; +} + +size_t vterm_output_get_buffer_current(const VTerm *vt) +{ + return vt->outbuffer_cur; +} + +size_t vterm_output_get_buffer_remaining(const VTerm *vt) +{ + return vt->outbuffer_len - vt->outbuffer_cur; +} + +size_t vterm_output_read(VTerm *vt, char *buffer, size_t len) +{ + if(len > vt->outbuffer_cur) + len = vt->outbuffer_cur; + + memcpy(buffer, vt->outbuffer, len); + + if(len < vt->outbuffer_cur) + memmove(vt->outbuffer, vt->outbuffer + len, vt->outbuffer_cur - len); + + vt->outbuffer_cur -= len; + + return len; +} + +VTermValueType vterm_get_attr_type(VTermAttr attr) +{ + switch(attr) { + case VTERM_ATTR_BOLD: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_UNDERLINE: return VTERM_VALUETYPE_INT; + case VTERM_ATTR_ITALIC: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_BLINK: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_REVERSE: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_STRIKE: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_FONT: return VTERM_VALUETYPE_INT; + case VTERM_ATTR_FOREGROUND: return VTERM_VALUETYPE_COLOR; + case VTERM_ATTR_BACKGROUND: return VTERM_VALUETYPE_COLOR; + + case VTERM_N_ATTRS: return 0; + } + return 0; /* UNREACHABLE */ +} + +VTermValueType vterm_get_prop_type(VTermProp prop) +{ + switch(prop) { + case VTERM_PROP_CURSORVISIBLE: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_CURSORBLINK: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_ALTSCREEN: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_TITLE: return VTERM_VALUETYPE_STRING; + case VTERM_PROP_ICONNAME: return VTERM_VALUETYPE_STRING; + case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; + case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT; + case VTERM_PROP_CURSORCOLOR: return VTERM_VALUETYPE_STRING; + + case VTERM_N_PROPS: return 0; + } + return 0; /* UNREACHABLE */ +} + +void vterm_scroll_rect(VTermRect rect, + int downward, + int rightward, + int (*moverect)(VTermRect src, VTermRect dest, void *user), + int (*eraserect)(VTermRect rect, int selective, void *user), + void *user) +{ + VTermRect src; + VTermRect dest; + + if(abs(downward) >= rect.end_row - rect.start_row || + abs(rightward) >= rect.end_col - rect.start_col) { + /* Scroll more than area; just erase the lot */ + (*eraserect)(rect, 0, user); + return; + } + + if(rightward >= 0) { + /* rect: [XXX................] + * src: [----------------] + * dest: [----------------] + */ + dest.start_col = rect.start_col; + dest.end_col = rect.end_col - rightward; + src.start_col = rect.start_col + rightward; + src.end_col = rect.end_col; + } + else { + /* rect: [................XXX] + * src: [----------------] + * dest: [----------------] + */ + int leftward = -rightward; + dest.start_col = rect.start_col + leftward; + dest.end_col = rect.end_col; + src.start_col = rect.start_col; + src.end_col = rect.end_col - leftward; + } + + if(downward >= 0) { + dest.start_row = rect.start_row; + dest.end_row = rect.end_row - downward; + src.start_row = rect.start_row + downward; + src.end_row = rect.end_row; + } + else { + int upward = -downward; + dest.start_row = rect.start_row + upward; + dest.end_row = rect.end_row; + src.start_row = rect.start_row; + src.end_row = rect.end_row - upward; + } + + if(moverect) + (*moverect)(dest, src, user); + + if(downward > 0) + rect.start_row = rect.end_row - downward; + else if(downward < 0) + rect.end_row = rect.start_row - downward; + + if(rightward > 0) + rect.start_col = rect.end_col - rightward; + else if(rightward < 0) + rect.end_col = rect.start_col - rightward; + + (*eraserect)(rect, 0, user); +} + +void vterm_copy_cells(VTermRect dest, + VTermRect src, + void (*copycell)(VTermPos dest, VTermPos src, void *user), + void *user) +{ + int downward = src.start_row - dest.start_row; + int rightward = src.start_col - dest.start_col; + + int init_row, test_row, init_col, test_col; + int inc_row, inc_col; + + VTermPos pos; + + if(downward < 0) { + init_row = dest.end_row - 1; + test_row = dest.start_row - 1; + inc_row = -1; + } + else /* downward >= 0 */ { + init_row = dest.start_row; + test_row = dest.end_row; + inc_row = +1; + } + + if(rightward < 0) { + init_col = dest.end_col - 1; + test_col = dest.start_col - 1; + inc_col = -1; + } + else /* rightward >= 0 */ { + init_col = dest.start_col; + test_col = dest.end_col; + inc_col = +1; + } + + for(pos.row = init_row; pos.row != test_row; pos.row += inc_row) + for(pos.col = init_col; pos.col != test_col; pos.col += inc_col) { + VTermPos srcpos; + srcpos.row = pos.row + downward; + srcpos.col = pos.col + rightward; + (*copycell)(pos, srcpos, user); + } +} diff --git a/src/libvterm/src/vterm_internal.h b/src/libvterm/src/vterm_internal.h new file mode 100644 index 0000000000..2ef358ce9a --- /dev/null +++ b/src/libvterm/src/vterm_internal.h @@ -0,0 +1,263 @@ +#ifndef __VTERM_INTERNAL_H__ +#define __VTERM_INTERNAL_H__ + +#include "vterm.h" + +#include <stdarg.h> + +#if defined(__GNUC__) && !defined(__MINGW32__) +# define INTERNAL __attribute__((visibility("internal"))) +# define UNUSED __attribute__((unused)) +#else +# define INTERNAL +# define UNUSED +#endif + +#ifdef DEBUG +# define DEBUG_LOG(s) fprintf(stderr, s) +# define DEBUG_LOG1(s, a) fprintf(stderr, s, a) +# define DEBUG_LOG2(s, a, b) fprintf(stderr, s, a, b) +# define DEBUG_LOG3(s, a, b, c) fprintf(stderr, s, a, b, c) +#else +# define DEBUG_LOG(s) +# define DEBUG_LOG1(s, a) +# define DEBUG_LOG2(s, a, b) +# define DEBUG_LOG3(s, a, b, c) +#endif + +#define ESC_S "\x1b" + +#define INTERMED_MAX 16 + +#define CSI_ARGS_MAX 16 +#define CSI_LEADER_MAX 16 + +typedef struct VTermEncoding VTermEncoding; + +typedef struct { + VTermEncoding *enc; + + // This size should be increased if required by other stateful encodings + char data[4*sizeof(uint32_t)]; +} VTermEncodingInstance; + +struct VTermPen +{ + VTermColor fg; + VTermColor bg; + unsigned int bold:1; + unsigned int underline:2; + unsigned int italic:1; + unsigned int blink:1; + unsigned int reverse:1; + unsigned int strike:1; + unsigned int font:4; /* To store 0-9 */ +}; + +int vterm_color_equal(VTermColor a, VTermColor b); + +#if defined(DEFINE_INLINES) || USE_INLINE +INLINE int vterm_color_equal(VTermColor a, VTermColor b) +{ + return a.red == b.red && a.green == b.green && a.blue == b.blue; +} +#endif + +struct VTermState +{ + VTerm *vt; + + const VTermStateCallbacks *callbacks; + void *cbdata; + + const VTermParserCallbacks *fallbacks; + void *fbdata; + + int rows; + int cols; + + /* Current cursor position */ + VTermPos pos; + + int at_phantom; /* True if we're on the "81st" phantom column to defer a wraparound */ + + int scrollregion_top; + int scrollregion_bottom; /* -1 means unbounded */ +#define SCROLLREGION_BOTTOM(state) ((state)->scrollregion_bottom > -1 ? (state)->scrollregion_bottom : (state)->rows) + int scrollregion_left; +#define SCROLLREGION_LEFT(state) ((state)->mode.leftrightmargin ? (state)->scrollregion_left : 0) + int scrollregion_right; /* -1 means unbounded */ +#define SCROLLREGION_RIGHT(state) ((state)->mode.leftrightmargin && (state)->scrollregion_right > -1 ? (state)->scrollregion_right : (state)->cols) + + /* Bitvector of tab stops */ + unsigned char *tabstops; + + VTermLineInfo *lineinfo; +#define ROWWIDTH(state,row) ((state)->lineinfo[(row)].doublewidth ? ((state)->cols / 2) : (state)->cols) +#define THISROWWIDTH(state) ROWWIDTH(state, (state)->pos.row) + + /* Mouse state */ + int mouse_col, mouse_row; + int mouse_buttons; + int mouse_flags; + + enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol; + + /* Last glyph output, for Unicode recombining purposes */ + uint32_t *combine_chars; + size_t combine_chars_size; // Number of ELEMENTS in the above + int combine_width; // The width of the glyph above + VTermPos combine_pos; // Position before movement + + struct { + unsigned int keypad:1; + unsigned int cursor:1; + unsigned int autowrap:1; + unsigned int insert:1; + unsigned int newline:1; + unsigned int cursor_visible:1; + unsigned int cursor_blink:1; + unsigned int cursor_shape:2; + unsigned int alt_screen:1; + unsigned int origin:1; + unsigned int screen:1; + unsigned int leftrightmargin:1; + unsigned int bracketpaste:1; + unsigned int report_focus:1; + } mode; + + VTermEncodingInstance encoding[4], encoding_utf8; + int gl_set, gr_set, gsingle_set; + + struct VTermPen pen; + + VTermColor default_fg; + VTermColor default_bg; + VTermColor colors[16]; // Store the 8 ANSI and the 8 ANSI high-brights only + + int fg_index; + int bg_index; + int bold_is_highbright; + + unsigned int protected_cell : 1; + + /* Saved state under DEC mode 1048/1049 */ + struct { + VTermPos pos; + struct VTermPen pen; + + struct { + unsigned int cursor_visible:1; + unsigned int cursor_blink:1; + unsigned int cursor_shape:2; + } mode; + } saved; +}; + +typedef enum { + VTERM_PARSER_OSC, + VTERM_PARSER_DCS, + + VTERM_N_PARSER_TYPES +} VTermParserStringType; + +struct VTerm +{ + VTermAllocatorFunctions *allocator; + void *allocdata; + + int rows; + int cols; + + struct { + unsigned int utf8:1; + unsigned int ctrl8bit:1; + } mode; + + struct { + enum VTermParserState { + NORMAL, + CSI_LEADER, + CSI_ARGS, + CSI_INTERMED, + ESC, + /* below here are the "string states" */ + STRING, + ESC_IN_STRING, + } state; + + int intermedlen; + char intermed[INTERMED_MAX]; + + int csi_leaderlen; + char csi_leader[CSI_LEADER_MAX]; + + int csi_argi; + long csi_args[CSI_ARGS_MAX]; + + const VTermParserCallbacks *callbacks; + void *cbdata; + + VTermParserStringType stringtype; + char *strbuffer; + size_t strbuffer_len; + size_t strbuffer_cur; + } parser; + + /* len == malloc()ed size; cur == number of valid bytes */ + + char *outbuffer; + size_t outbuffer_len; + size_t outbuffer_cur; + + VTermState *state; + VTermScreen *screen; +}; + +struct VTermEncoding { + void (*init) (VTermEncoding *enc, void *data); + void (*decode)(VTermEncoding *enc, void *data, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t len); +}; + +typedef enum { + ENC_UTF8, + ENC_SINGLE_94 +} VTermEncodingType; + +void *vterm_allocator_malloc(VTerm *vt, size_t size); +void vterm_allocator_free(VTerm *vt, void *ptr); + +void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len); +void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args); +void vterm_push_output_sprintf(VTerm *vt, const char *format, ...); +void vterm_push_output_sprintf_ctrl(VTerm *vt, unsigned char ctrl, const char *fmt, ...); +void vterm_push_output_sprintf_dcs(VTerm *vt, const char *fmt, ...); + +void vterm_state_free(VTermState *state); + +void vterm_state_newpen(VTermState *state); +void vterm_state_resetpen(VTermState *state); +void vterm_state_setpen(VTermState *state, const long args[], int argcount); +int vterm_state_getpen(VTermState *state, long args[], int argcount); +void vterm_state_savepen(VTermState *state, int save); + +enum { + C1_SS3 = 0x8f, + C1_DCS = 0x90, + C1_CSI = 0x9b, + C1_ST = 0x9c, + C1_OSC = 0x9d, +}; + +void vterm_state_push_output_sprintf_CSI(VTermState *vts, const char *format, ...); + +void vterm_screen_free(VTermScreen *screen); + +VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation); + +int vterm_unicode_width(uint32_t codepoint); +int vterm_unicode_is_combining(uint32_t codepoint); + +#endif diff --git a/src/libvterm/t/02parser.test b/src/libvterm/t/02parser.test new file mode 100644 index 0000000000..66d487dad9 --- /dev/null +++ b/src/libvterm/t/02parser.test @@ -0,0 +1,200 @@ +INIT +UTF8 0 +WANTPARSER + +!Basic text +PUSH "hello" + text 0x68, 0x65, 0x6c, 0x6c, 0x6f + +!C0 +PUSH "\x03" + control 3 + +PUSH "\x1f" + control 0x1f + +!C1 8bit +PUSH "\x83" + control 0x83 + +PUSH "\x9f" + control 0x9f + +!C1 7bit +PUSH "\e\x43" + control 0x83 + +PUSH "\e\x5f" + control 0x9f + +!High bytes +PUSH "\xa0\xcc\xfe" + text 0xa0, 0xcc, 0xfe + +!Mixed +PUSH "1\n2" + text 0x31 + control 10 + text 0x32 + +!Escape +PUSH "\e=" + escape "=" + +!Escape 2-byte +PUSH "\e(X" + escape "(X" + +!Split write Escape +PUSH "\e(" +PUSH "Y" + escape "(Y" + +!Escape cancels Escape, starts another +PUSH "\e(\e)Z" + escape ")Z" + +!CAN cancels Escape, returns to normal mode +PUSH "\e(\x{18}AB" + text 0x41, 0x42 + +!C0 in Escape interrupts and continues +PUSH "\e(\nX" + control 10 + escape "(X" + +!CSI 0 args +PUSH "\e[a" + csi 0x61 * + +!CSI 1 arg +PUSH "\e[9b" + csi 0x62 9 + +!CSI 2 args +PUSH "\e[3;4c" + csi 0x63 3,4 + +!CSI 1 arg 1 sub +PUSH "\e[1:2c" + csi 0x63 1+,2 + +!CSI many digits +PUSH "\e[678d" + csi 0x64 678 + +!CSI leading zero +PUSH "\e[007e" + csi 0x65 7 + +!CSI qmark +PUSH "\e[?2;7f" + csi 0x66 L=3f 2,7 + +!CSI greater +PUSH "\e[>c" + csi 0x63 L=3e * + +!CSI SP +PUSH "\e[12 q" + csi 0x71 12 I=20 + +!Mixed CSI +PUSH "A\e[8mB" + text 0x41 + csi 0x6d 8 + text 0x42 + +!Split write +PUSH "\e" +PUSH "[a" + csi 0x61 * +PUSH "foo\e[" + text 0x66, 0x6f, 0x6f +PUSH "4b" + csi 0x62 4 +PUSH "\e[12;" +PUSH "3c" + csi 0x63 12,3 + +!Escape cancels CSI, starts Escape +PUSH "\e[123\e9" + escape "9" + +!CAN cancels CSI, returns to normal mode +PUSH "\e[12\x{18}AB" + text 0x41, 0x42 + +!C0 in Escape interrupts and continues +PUSH "\e[12\n;3X" + control 10 + csi 0x58 12,3 + +!OSC BEL +PUSH "\e]1;Hello\x07" + osc "1;Hello" + +!OSC ST (7bit) +PUSH "\e]1;Hello\e\\" + osc "1;Hello" + +!OSC ST (8bit) +PUSH "\x{9d}1;Hello\x9c" + osc "1;Hello" + +!Escape cancels OSC, starts Escape +PUSH "\e]Something\e9" + escape "9" + +!CAN cancels OSC, returns to normal mode +PUSH "\e]12\x{18}AB" + text 0x41, 0x42 + +!C0 in OSC interrupts and continues +PUSH "\e]2;\nBye\x07" + control 10 + osc "2;Bye" + +!DCS BEL +PUSH "\ePHello\x07" + dcs "Hello" + +!DCS ST (7bit) +PUSH "\ePHello\e\\" + dcs "Hello" + +!DCS ST (8bit) +PUSH "\x{90}Hello\x9c" + dcs "Hello" + +!Escape cancels DCS, starts Escape +PUSH "\ePSomething\e9" + escape "9" + +!CAN cancels DCS, returns to normal mode +PUSH "\eP12\x{18}AB" + text 0x41, 0x42 + +!C0 in OSC interrupts and continues +PUSH "\ePBy\ne\x07" + control 10 + dcs "Bye" + +!NUL ignored +PUSH "\x{00}" + +!NUL ignored within CSI +PUSH "\e[12\x{00}3m" + csi 0x6d 123 + +!DEL ignored +PUSH "\x{7f}" + +!DEL ignored within CSI +PUSH "\e[12\x{7f}3m" + csi 0x6d 123 + +!DEL inside text" +PUSH "AB\x{7f}C" + text 0x41,0x42 + text 0x43 diff --git a/src/libvterm/t/03encoding_utf8.test b/src/libvterm/t/03encoding_utf8.test new file mode 100644 index 0000000000..7ee16ac641 --- /dev/null +++ b/src/libvterm/t/03encoding_utf8.test @@ -0,0 +1,122 @@ +INIT +WANTENCODING + +!Low +ENCIN "123" + encout 0x31,0x32,0x33 + +# We want to prove the UTF-8 parser correctly handles all the sequences. +# Easy way to do this is to check it does low/high boundary cases, as that +# leaves only two for each sequence length +# +# These ranges are therefore: +# +# Two bytes: +# U+0080 = 000 10000000 => 00010 000000 +# => 11000010 10000000 = C2 80 +# U+07FF = 111 11111111 => 11111 111111 +# => 11011111 10111111 = DF BF +# +# Three bytes: +# U+0800 = 00001000 00000000 => 0000 100000 000000 +# => 11100000 10100000 10000000 = E0 A0 80 +# U+FFFD = 11111111 11111101 => 1111 111111 111101 +# => 11101111 10111111 10111101 = EF BF BD +# (We avoid U+FFFE and U+FFFF as they're invalid codepoints) +# +# Four bytes: +# U+10000 = 00001 00000000 00000000 => 000 010000 000000 000000 +# => 11110000 10010000 10000000 10000000 = F0 90 80 80 +# U+1FFFFF = 11111 11111111 11111111 => 111 111111 111111 111111 +# => 11110111 10111111 10111111 10111111 = F7 BF BF BF + +!2 byte +ENCIN "\xC2\x80\xDF\xBF" + encout 0x0080, 0x07FF + +!3 byte +ENCIN "\xE0\xA0\x80\xEF\xBF\xBD" + encout 0x0800,0xFFFD + +!4 byte +ENCIN "\xF0\x90\x80\x80\xF7\xBF\xBF\xBF" + encout 0x10000,0x1fffff + +# Next up, we check some invalid sequences +# + Early termination (back to low bytes too soon) +# + Early restart (another sequence introduction before the previous one was finished) + +!Early termination +ENCIN "\xC2!" + encout 0xfffd,0x21 + +ENCIN "\xE0!\xE0\xA0!" + encout 0xfffd,0x21,0xfffd,0x21 + +ENCIN "\xF0!\xF0\x90!\xF0\x90\x80!" + encout 0xfffd,0x21,0xfffd,0x21,0xfffd,0x21 + +!Early restart +ENCIN "\xC2\xC2\x90" + encout 0xfffd,0x0090 + +ENCIN "\xE0\xC2\x90\xE0\xA0\xC2\x90" + encout 0xfffd,0x0090,0xfffd,0x0090 + +ENCIN "\xF0\xC2\x90\xF0\x90\xC2\x90\xF0\x90\x80\xC2\x90" + encout 0xfffd,0x0090,0xfffd,0x0090,0xfffd,0x0090 + +# Test the overlong sequences by giving an overlong encoding of U+0000 and +# an encoding of the highest codepoint still too short +# +# Two bytes: +# U+0000 = C0 80 +# U+007F = 000 01111111 => 00001 111111 => +# => 11000001 10111111 => C1 BF +# +# Three bytes: +# U+0000 = E0 80 80 +# U+07FF = 00000111 11111111 => 0000 011111 111111 +# => 11100000 10011111 10111111 = E0 9F BF +# +# Four bytes: +# U+0000 = F0 80 80 80 +# U+FFFF = 11111111 11111111 => 000 001111 111111 111111 +# => 11110000 10001111 10111111 10111111 = F0 8F BF BF + +!Overlong +ENCIN "\xC0\x80\xC1\xBF" + encout 0xfffd,0xfffd + +ENCIN "\xE0\x80\x80\xE0\x9F\xBF" + encout 0xfffd,0xfffd + +ENCIN "\xF0\x80\x80\x80\xF0\x8F\xBF\xBF" + encout 0xfffd,0xfffd + +# UTF-16 surrogates U+D800 and U+DFFF +!UTF-16 Surrogates +ENCIN "\xED\xA0\x80\xED\xBF\xBF" + encout 0xfffd,0xfffd + +!Split write +ENCIN "\xC2" +ENCIN "\xA0" + encout 0x000A0 + +ENCIN "\xE0" +ENCIN "\xA0\x80" + encout 0x00800 +ENCIN "\xE0\xA0" +ENCIN "\x80" + encout 0x00800 + +ENCIN "\xF0" +ENCIN "\x90\x80\x80" + encout 0x10000 +ENCIN "\xF0\x90" +ENCIN "\x80\x80" + encout 0x10000 +ENCIN "\xF0\x90\x80" +ENCIN "\x80" + encout 0x10000 diff --git a/src/libvterm/t/10state_putglyph.test b/src/libvterm/t/10state_putglyph.test new file mode 100644 index 0000000000..6d5d56a38d --- /dev/null +++ b/src/libvterm/t/10state_putglyph.test @@ -0,0 +1,61 @@ +INIT +UTF8 1 +WANTSTATE g + +!Low +RESET +PUSH "ABC" + putglyph 0x41 1 0,0 + putglyph 0x42 1 0,1 + putglyph 0x43 1 0,2 + +!UTF-8 1 char +# U+00C1 = 0xC3 0x81 name: LATIN CAPITAL LETTER A WITH ACUTE +# U+00E9 = 0xC3 0xA9 name: LATIN SMALL LETTER E WITH ACUTE +RESET +PUSH "\xC3\x81\xC3\xA9" + putglyph 0xc1 1 0,0 + putglyph 0xe9 1 0,1 + +!UTF-8 split writes +RESET +PUSH "\xC3" +PUSH "\x81" + putglyph 0xc1 1 0,0 + +!UTF-8 wide char +# U+FF10 = 0xEF 0xBC 0x90 name: FULLWIDTH DIGIT ZERO +RESET +PUSH "\xEF\xBC\x90 " + putglyph 0xff10 2 0,0 + putglyph 0x20 1 0,2 + +!UTF-8 combining chars +# U+0301 = 0xCC 0x81 name: COMBINING ACUTE +RESET +PUSH "e\xCC\x81Z" + putglyph 0x65,0x301 1 0,0 + putglyph 0x5a 1 0,1 + +!Combining across buffers +RESET +PUSH "e" + putglyph 0x65 1 0,0 +PUSH "\xCC\x81Z" + putglyph 0x65,0x301 1 0,0 + putglyph 0x5a 1 0,1 + +RESET +PUSH "e" + putglyph 0x65 1 0,0 +PUSH "\xCC\x81" + putglyph 0x65,0x301 1 0,0 +PUSH "\xCC\x82" + putglyph 0x65,0x301,0x302 1 0,0 + +!DECSCA protected +RESET +PUSH "A\e[1\"qB\e[2\"qC" + putglyph 0x41 1 0,0 + putglyph 0x42 1 0,1 prot + putglyph 0x43 1 0,2 diff --git a/src/libvterm/t/11state_movecursor.test b/src/libvterm/t/11state_movecursor.test new file mode 100644 index 0000000000..c1d72b2a61 --- /dev/null +++ b/src/libvterm/t/11state_movecursor.test @@ -0,0 +1,224 @@ +INIT +UTF8 1 +WANTSTATE + +!Implicit +PUSH "ABC" + ?cursor = 0,3 +!Backspace +PUSH "\b" + ?cursor = 0,2 +!Horizontal Tab +PUSH "\t" + ?cursor = 0,8 +!Carriage Return +PUSH "\r" + ?cursor = 0,0 +!Linefeed +PUSH "\n" + ?cursor = 1,0 + +!Backspace bounded by lefthand edge +PUSH "\e[4;2H" + ?cursor = 3,1 +PUSH "\b" + ?cursor = 3,0 +PUSH "\b" + ?cursor = 3,0 + +!Backspace cancels phantom +PUSH "\e[4;80H" + ?cursor = 3,79 +PUSH "X" + ?cursor = 3,79 +PUSH "\b" + ?cursor = 3,78 + +!HT bounded by righthand edge +PUSH "\e[1;78H" + ?cursor = 0,77 +PUSH "\t" + ?cursor = 0,79 +PUSH "\t" + ?cursor = 0,79 + +RESET + +!Index +PUSH "ABC\eD" + ?cursor = 1,3 +!Reverse Index +PUSH "\eM" + ?cursor = 0,3 +!Newline +PUSH "\eE" + ?cursor = 1,0 + +RESET + +!Cursor Forward +PUSH "\e[B" + ?cursor = 1,0 +PUSH "\e[3B" + ?cursor = 4,0 +PUSH "\e[0B" + ?cursor = 5,0 + +!Cursor Down +PUSH "\e[C" + ?cursor = 5,1 +PUSH "\e[3C" + ?cursor = 5,4 +PUSH "\e[0C" + ?cursor = 5,5 + +!Cursor Up +PUSH "\e[A" + ?cursor = 4,5 +PUSH "\e[3A" + ?cursor = 1,5 +PUSH "\e[0A" + ?cursor = 0,5 + +!Cursor Backward +PUSH "\e[D" + ?cursor = 0,4 +PUSH "\e[3D" + ?cursor = 0,1 +PUSH "\e[0D" + ?cursor = 0,0 + +!Cursor Next Line +PUSH " " + ?cursor = 0,3 +PUSH "\e[E" + ?cursor = 1,0 +PUSH " " + ?cursor = 1,3 +PUSH "\e[2E" + ?cursor = 3,0 +PUSH "\e[0E" + ?cursor = 4,0 + +!Cursor Previous Line +PUSH " " + ?cursor = 4,3 +PUSH "\e[F" + ?cursor = 3,0 +PUSH " " + ?cursor = 3,3 +PUSH "\e[2F" + ?cursor = 1,0 +PUSH "\e[0F" + ?cursor = 0,0 + +!Cursor Horizonal Absolute +PUSH "\n" + ?cursor = 1,0 +PUSH "\e[20G" + ?cursor = 1,19 +PUSH "\e[G" + ?cursor = 1,0 + +!Cursor Position +PUSH "\e[10;5H" + ?cursor = 9,4 +PUSH "\e[8H" + ?cursor = 7,0 +PUSH "\e[H" + ?cursor = 0,0 + +!Cursor Position cancels phantom +PUSH "\e[10;78H" + ?cursor = 9,77 +PUSH "ABC" + ?cursor = 9,79 +PUSH "\e[10;80H" +PUSH "C" + ?cursor = 9,79 +PUSH "X" + ?cursor = 10,1 + +RESET + +!Bounds Checking +PUSH "\e[A" + ?cursor = 0,0 +PUSH "\e[D" + ?cursor = 0,0 +PUSH "\e[25;80H" + ?cursor = 24,79 +PUSH "\e[B" + ?cursor = 24,79 +PUSH "\e[C" + ?cursor = 24,79 +PUSH "\e[E" + ?cursor = 24,0 +PUSH "\e[H" + ?cursor = 0,0 +PUSH "\e[F" + ?cursor = 0,0 +PUSH "\e[999G" + ?cursor = 0,79 +PUSH "\e[99;99H" + ?cursor = 24,79 + +RESET + +!Horizontal Position Absolute +PUSH "\e[5`" + ?cursor = 0,4 + +!Horizontal Position Relative +PUSH "\e[3a" + ?cursor = 0,7 + +!Horizontal Position Backward +PUSH "\e[3j" + ?cursor = 0,4 + +!Horizontal and Vertical Position +PUSH "\e[3;3f" + ?cursor = 2,2 + +!Vertical Position Absolute +PUSH "\e[5d" + ?cursor = 4,2 + +!Vertical Position Relative +PUSH "\e[2e" + ?cursor = 6,2 + +!Vertical Position Backward +PUSH "\e[2k" + ?cursor = 4,2 + +RESET + +!Horizontal Tab +PUSH "\t" + ?cursor = 0,8 +PUSH " " + ?cursor = 0,11 +PUSH "\t" + ?cursor = 0,16 +PUSH " " + ?cursor = 0,23 +PUSH "\t" + ?cursor = 0,24 +PUSH " " + ?cursor = 0,32 +PUSH "\t" + ?cursor = 0,40 + +!Cursor Horizontal Tab +PUSH "\e[I" + ?cursor = 0,48 +PUSH "\e[2I" + ?cursor = 0,64 + +!Cursor Backward Tab +PUSH "\e[Z" + ?cursor = 0,56 +PUSH "\e[2Z" + ?cursor = 0,40 diff --git a/src/libvterm/t/12state_scroll.test b/src/libvterm/t/12state_scroll.test new file mode 100644 index 0000000000..ca305d499b --- /dev/null +++ b/src/libvterm/t/12state_scroll.test @@ -0,0 +1,150 @@ +INIT +UTF8 1 +WANTSTATE s + +!Linefeed +PUSH "\n"x24 + ?cursor = 24,0 +PUSH "\n" + scrollrect 0..25,0..80 => +1,+0 + ?cursor = 24,0 + +RESET + +!Index +PUSH "\e[25H" +PUSH "\eD" + scrollrect 0..25,0..80 => +1,+0 + +RESET + +!Reverse Index +PUSH "\eM" + scrollrect 0..25,0..80 => -1,+0 + +RESET + +!Linefeed in DECSTBM +PUSH "\e[1;10r" + ?cursor = 0,0 +PUSH "\n"x9 + ?cursor = 9,0 +PUSH "\n" + scrollrect 0..10,0..80 => +1,+0 + ?cursor = 9,0 + +!Linefeed outside DECSTBM +PUSH "\e[20H" + ?cursor = 19,0 +PUSH "\n" + ?cursor = 20,0 + +!Index in DECSTBM +PUSH "\e[10H" +PUSH "\e[9;10r" +PUSH "\eM" + ?cursor = 8,0 +PUSH "\eM" + scrollrect 8..10,0..80 => -1,+0 + +!Reverse Index in DECSTBM +PUSH "\e[25H" + ?cursor = 24,0 +PUSH "\n" + # no scrollrect + ?cursor = 24,0 + +!Linefeed in DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[3;10r\e[10;40s" +PUSH "\e[10;10H\n" + scrollrect 2..10,9..40 => +1,+0 + +!IND/RI in DECSTBM+DECSLRM +PUSH "\eD" + scrollrect 2..10,9..40 => +1,+0 +PUSH "\e[3;10H\eM" + scrollrect 2..10,9..40 => -1,+0 + +!DECRQSS on DECSTBM +PUSH "\eP\$qr\e\\" + output "\eP1\$r3;10r\e\\" + +!DECRQSS on DECSLRM +PUSH "\eP\$qs\e\\" + output "\eP1\$r10;40s\e\\" + +!Setting invalid DECSLRM with !DECVSSM is still rejected +PUSH "\e[?69l\e[;0s\e[?69h" + +RESET + +!Scroll Down +PUSH "\e[S" + scrollrect 0..25,0..80 => +1,+0 + ?cursor = 0,0 +PUSH "\e[2S" + scrollrect 0..25,0..80 => +2,+0 + ?cursor = 0,0 +PUSH "\e[100S" + scrollrect 0..25,0..80 => +25,+0 + +!Scroll Up +PUSH "\e[T" + scrollrect 0..25,0..80 => -1,+0 + ?cursor = 0,0 +PUSH "\e[2T" + scrollrect 0..25,0..80 => -2,+0 + ?cursor = 0,0 +PUSH "\e[100T" + scrollrect 0..25,0..80 => -25,+0 + +!SD/SU in DECSTBM +PUSH "\e[5;20r" +PUSH "\e[S" + scrollrect 4..20,0..80 => +1,+0 +PUSH "\e[T" + scrollrect 4..20,0..80 => -1,+0 + +RESET + +!SD/SU in DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[3;10r\e[10;40s" + ?cursor = 0,0 +PUSH "\e[3;10H" + ?cursor = 2,9 +PUSH "\e[S" + scrollrect 2..10,9..40 => +1,+0 +PUSH "\e[?69l" +PUSH "\e[S" + scrollrect 2..10,0..80 => +1,+0 + +!Invalid boundaries +RESET + +PUSH "\e[100;105r\eD" +PUSH "\e[5;2r\eD" + +RESET +WANTSTATE -s+me + +!Scroll Down move+erase emulation +PUSH "\e[S" + moverect 1..25,0..80 -> 0..24,0..80 + erase 24..25,0..80 + ?cursor = 0,0 +PUSH "\e[2S" + moverect 2..25,0..80 -> 0..23,0..80 + erase 23..25,0..80 + ?cursor = 0,0 + +!Scroll Up move+erase emulation +PUSH "\e[T" + moverect 0..24,0..80 -> 1..25,0..80 + erase 0..1,0..80 + ?cursor = 0,0 +PUSH "\e[2T" + moverect 0..23,0..80 -> 2..25,0..80 + erase 0..2,0..80 + ?cursor = 0,0 diff --git a/src/libvterm/t/13state_edit.test b/src/libvterm/t/13state_edit.test new file mode 100644 index 0000000000..b435655e8b --- /dev/null +++ b/src/libvterm/t/13state_edit.test @@ -0,0 +1,300 @@ +INIT +UTF8 1 +WANTSTATE se + +!ICH +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ACD" +PUSH "\e[2D" + ?cursor = 0,1 +PUSH "\e[@" + scrollrect 0..1,1..80 => +0,-1 + ?cursor = 0,1 +PUSH "B" + ?cursor = 0,2 +PUSH "\e[3@" + scrollrect 0..1,2..80 => +0,-3 + +!ICH with DECSLRM +PUSH "\e[?69h" +PUSH "\e[;50s" +PUSH "\e[20G\e[@" + scrollrect 0..1,19..50 => +0,-1 + +!ICH outside DECSLRM +PUSH "\e[70G\e[@" + # nothing happens + +!DCH +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABBC" +PUSH "\e[3D" + ?cursor = 0,1 +PUSH "\e[P" + scrollrect 0..1,1..80 => +0,+1 + ?cursor = 0,1 +PUSH "\e[3P" + scrollrect 0..1,1..80 => +0,+3 + ?cursor = 0,1 + +!DCH with DECSLRM +PUSH "\e[?69h" +PUSH "\e[;50s" +PUSH "\e[20G\e[P" + scrollrect 0..1,19..50 => +0,+1 + +!DCH outside DECSLRM +PUSH "\e[70G\e[P" + # nothing happens + +!ECH +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABC" +PUSH "\e[2D" + ?cursor = 0,1 +PUSH "\e[X" + erase 0..1,1..2 + ?cursor = 0,1 +PUSH "\e[3X" + erase 0..1,1..4 + ?cursor = 0,1 +# ECH more columns than there are should be bounded +PUSH "\e[100X" + erase 0..1,1..80 + +!IL +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "A\r\nC" + ?cursor = 1,1 +PUSH "\e[L" + scrollrect 1..25,0..80 => -1,+0 + # TODO: ECMA-48 says we should move to line home, but neither xterm nor + # xfce4-terminal do this + ?cursor = 1,1 +PUSH "\rB" + ?cursor = 1,1 +PUSH "\e[3L" + scrollrect 1..25,0..80 => -3,+0 + +!IL with DECSTBM +PUSH "\e[5;15r" +PUSH "\e[5H\e[L" + scrollrect 4..15,0..80 => -1,+0 + +!IL outside DECSTBM +PUSH "\e[20H\e[L" + # nothing happens + +!IL with DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[10;50s" +PUSH "\e[5;10H\e[L" + scrollrect 4..15,9..50 => -1,+0 + +!DL +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "A\r\nB\r\nB\r\nC" + ?cursor = 3,1 +PUSH "\e[2H" + ?cursor = 1,0 +PUSH "\e[M" + scrollrect 1..25,0..80 => +1,+0 + ?cursor = 1,0 +PUSH "\e[3M" + scrollrect 1..25,0..80 => +3,+0 + ?cursor = 1,0 + +!DL with DECSTBM +PUSH "\e[5;15r" +PUSH "\e[5H\e[M" + scrollrect 4..15,0..80 => +1,+0 + +!DL outside DECSTBM +PUSH "\e[20H\e[M" + # nothing happens + +!DL with DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[10;50s" +PUSH "\e[5;10H\e[M" + scrollrect 4..15,9..50 => +1,+0 + +!DECIC +RESET + erase 0..25,0..80 +PUSH "\e[20G\e[5'}" + scrollrect 0..25,19..80 => +0,-5 + +!DECIC with DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[4;20r\e[20;60s" +PUSH "\e[4;20H\e[3'}" + scrollrect 3..20,19..60 => +0,-3 + +!DECIC outside DECSLRM +PUSH "\e[70G\e['}" + # nothing happens + +!DECDC +RESET + erase 0..25,0..80 +PUSH "\e[20G\e[5'~" + scrollrect 0..25,19..80 => +0,+5 + +!DECDC with DECSTBM+DECSLRM +PUSH "\e[?69h" +PUSH "\e[4;20r\e[20;60s" +PUSH "\e[4;20H\e[3'~" + scrollrect 3..20,19..60 => +0,+3 + +!DECDC outside DECSLRM +PUSH "\e[70G\e['~" + # nothing happens + +!EL 0 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABCDE" +PUSH "\e[3D" + ?cursor = 0,2 +PUSH "\e[0K" + erase 0..1,2..80 + ?cursor = 0,2 + +!EL 1 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABCDE" +PUSH "\e[3D" + ?cursor = 0,2 +PUSH "\e[1K" + erase 0..1,0..3 + ?cursor = 0,2 + +!EL 2 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABCDE" +PUSH "\e[3D" + ?cursor = 0,2 +PUSH "\e[2K" + erase 0..1,0..80 + ?cursor = 0,2 + +!SEL +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[11G" + ?cursor = 0,10 +PUSH "\e[?0K" + erase 0..1,10..80 selective + ?cursor = 0,10 +PUSH "\e[?1K" + erase 0..1,0..11 selective + ?cursor = 0,10 +PUSH "\e[?2K" + erase 0..1,0..80 selective + ?cursor = 0,10 + +!ED 0 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[2;2H" + ?cursor = 1,1 +PUSH "\e[0J" + erase 1..2,1..80 + erase 2..25,0..80 + ?cursor = 1,1 + +!ED 1 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[2;2H" + ?cursor = 1,1 +PUSH "\e[1J" + erase 0..1,0..80 + erase 1..2,0..2 + ?cursor = 1,1 + +!ED 2 +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[2;2H" + ?cursor = 1,1 +PUSH "\e[2J" + erase 0..25,0..80 + ?cursor = 1,1 + +!SED +RESET + erase 0..25,0..80 +PUSH "\e[5;5H" + ?cursor = 4,4 +PUSH "\e[?0J" + erase 4..5,4..80 selective + erase 5..25,0..80 selective + ?cursor = 4,4 +PUSH "\e[?1J" + erase 0..4,0..80 selective + erase 4..5,0..5 selective + ?cursor = 4,4 +PUSH "\e[?2J" + erase 0..25,0..80 selective + ?cursor = 4,4 + +!DECRQSS on DECSCA +PUSH "\e[2\"q" +PUSH "\eP\$q\"q\e\\" + output "\eP1\$r2\"q\e\\" + +WANTSTATE -s+m + +!ICH move+erase emuation +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ACD" +PUSH "\e[2D" + ?cursor = 0,1 +PUSH "\e[@" + moverect 0..1,1..79 -> 0..1,2..80 + erase 0..1,1..2 + ?cursor = 0,1 +PUSH "B" + ?cursor = 0,2 +PUSH "\e[3@" + moverect 0..1,2..77 -> 0..1,5..80 + erase 0..1,2..5 + +!DCH move+erase emulation +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "ABBC" +PUSH "\e[3D" + ?cursor = 0,1 +PUSH "\e[P" + moverect 0..1,2..80 -> 0..1,1..79 + erase 0..1,79..80 + ?cursor = 0,1 +PUSH "\e[3P" + moverect 0..1,4..80 -> 0..1,1..77 + erase 0..1,77..80 + ?cursor = 0,1 diff --git a/src/libvterm/t/14state_encoding.test b/src/libvterm/t/14state_encoding.test new file mode 100644 index 0000000000..b1f5d69853 --- /dev/null +++ b/src/libvterm/t/14state_encoding.test @@ -0,0 +1,105 @@ +INIT +WANTSTATE g + +!Default +RESET +PUSH "#" + putglyph 0x23 1 0,0 + +!Designate G0=UK +RESET +PUSH "\e(A" +PUSH "#" + putglyph 0x00a3 1 0,0 + +!Designate G0=DEC drawing +RESET +PUSH "\e(0" +PUSH "a" + putglyph 0x2592 1 0,0 + +!Designate G1 + LS1 +RESET +PUSH "\e)0" +PUSH "a" + putglyph 0x61 1 0,0 +PUSH "\x0e" +PUSH "a" + putglyph 0x2592 1 0,1 +!LS0 +PUSH "\x0f" +PUSH "a" + putglyph 0x61 1 0,2 + +!Designate G2 + LS2 +PUSH "\e*0" +PUSH "a" + putglyph 0x61 1 0,3 +PUSH "\en" +PUSH "a" + putglyph 0x2592 1 0,4 +PUSH "\x0f" +PUSH "a" + putglyph 0x61 1 0,5 + +!Designate G3 + LS3 +PUSH "\e+0" +PUSH "a" + putglyph 0x61 1 0,6 +PUSH "\eo" +PUSH "a" + putglyph 0x2592 1 0,7 +PUSH "\x0f" +PUSH "a" + putglyph 0x61 1 0,8 + +!SS2 +PUSH "a\x{8e}aa" + putglyph 0x61 1 0,9 + putglyph 0x2592 1 0,10 + putglyph 0x61 1 0,11 + +!SS3 +PUSH "a\x{8f}aa" + putglyph 0x61 1 0,12 + putglyph 0x2592 1 0,13 + putglyph 0x61 1 0,14 + +!LS1R +RESET +PUSH "\e~" +PUSH "\xe1" + putglyph 0x61 1 0,0 +PUSH "\e)0" +PUSH "\xe1" + putglyph 0x2592 1 0,1 + +!LS2R +RESET +PUSH "\e}" +PUSH "\xe1" + putglyph 0x61 1 0,0 +PUSH "\e*0" +PUSH "\xe1" + putglyph 0x2592 1 0,1 + +!LS3R +RESET +PUSH "\e|" +PUSH "\xe1" + putglyph 0x61 1 0,0 +PUSH "\e+0" +PUSH "\xe1" + putglyph 0x2592 1 0,1 + +UTF8 1 + +!Mixed US-ASCII and UTF-8 +# U+0108 == 0xc4 0x88 +RESET +PUSH "\e(B" +PUSH "AB\xc4\x88D" + putglyph 0x0041 1 0,0 + putglyph 0x0042 1 0,1 + putglyph 0x0108 1 0,2 + putglyph 0x0044 1 0,3 diff --git a/src/libvterm/t/15state_mode.test b/src/libvterm/t/15state_mode.test new file mode 100644 index 0000000000..b7917adb20 --- /dev/null +++ b/src/libvterm/t/15state_mode.test @@ -0,0 +1,86 @@ +INIT +UTF8 1 +WANTSTATE gme + +!Insert/Replace Mode +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "AC\e[DB" + putglyph 0x41 1 0,0 + putglyph 0x43 1 0,1 + putglyph 0x42 1 0,1 +PUSH "\e[4h" +PUSH "\e[G" +PUSH "AC\e[DB" + moverect 0..1,0..79 -> 0..1,1..80 + erase 0..1,0..1 + putglyph 0x41 1 0,0 + moverect 0..1,1..79 -> 0..1,2..80 + erase 0..1,1..2 + putglyph 0x43 1 0,1 + moverect 0..1,1..79 -> 0..1,2..80 + erase 0..1,1..2 + putglyph 0x42 1 0,1 + +!Insert mode only happens once for UTF-8 combining +PUSH "e" + moverect 0..1,2..79 -> 0..1,3..80 + erase 0..1,2..3 + putglyph 0x65 1 0,2 +PUSH "\xCC\x81" + putglyph 0x65,0x301 1 0,2 + +!Newline/Linefeed mode +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[5G\n" + ?cursor = 1,4 +PUSH "\e[20h" +PUSH "\e[5G\n" + ?cursor = 2,0 + +!DEC origin mode +RESET + erase 0..25,0..80 + ?cursor = 0,0 +PUSH "\e[5;15r" +PUSH "\e[H" + ?cursor = 0,0 +PUSH "\e[3;3H" + ?cursor = 2,2 +PUSH "\e[?6h" +PUSH "\e[H" + ?cursor = 4,0 +PUSH "\e[3;3H" + ?cursor = 6,2 + +!DECRQM on DECOM +PUSH "\e[?6h" +PUSH "\e[?6\$p" + output "\e[?6;1\$y" +PUSH "\e[?6l" +PUSH "\e[?6\$p" + output "\e[?6;2\$y" + +!Origin mode with DECSLRM +PUSH "\e[?6h" +PUSH "\e[?69h" +PUSH "\e[20;60s" +PUSH "\e[H" + ?cursor = 4,19 + +PUSH "\e[?69l" + +!Origin mode bounds cursor to scrolling region +PUSH "\e[H" +PUSH "\e[10A" + ?cursor = 4,0 +PUSH "\e[20B" + ?cursor = 14,0 + +!Origin mode without scroll region +PUSH "\e[?6l" +PUSH "\e[r\e[?6h" + ?cursor = 0,0 diff --git a/src/libvterm/t/16state_resize.test b/src/libvterm/t/16state_resize.test new file mode 100644 index 0000000000..42c77c787c --- /dev/null +++ b/src/libvterm/t/16state_resize.test @@ -0,0 +1,48 @@ +INIT +WANTSTATE g + +!Placement +RESET +PUSH "AB\e[79GCDE" + putglyph 0x41 1 0,0 + putglyph 0x42 1 0,1 + putglyph 0x43 1 0,78 + putglyph 0x44 1 0,79 + putglyph 0x45 1 1,0 + +!Resize +RESET +RESIZE 27,85 +PUSH "AB\e[79GCDE" + putglyph 0x41 1 0,0 + putglyph 0x42 1 0,1 + putglyph 0x43 1 0,78 + putglyph 0x44 1 0,79 + putglyph 0x45 1 0,80 + ?cursor = 0,81 + +!Resize without reset +RESIZE 28,90 + ?cursor = 0,81 +PUSH "FGHI" + putglyph 0x46 1 0,81 + putglyph 0x47 1 0,82 + putglyph 0x48 1 0,83 + putglyph 0x49 1 0,84 + ?cursor = 0,85 + +!Resize shrink moves cursor +RESIZE 25,80 + ?cursor = 0,79 + +!Resize grow doesn't cancel phantom +RESET +PUSH "\e[79GAB" + putglyph 0x41 1 0,78 + putglyph 0x42 1 0,79 + ?cursor = 0,79 +RESIZE 30,100 + ?cursor = 0,80 +PUSH "C" + putglyph 0x43 1 0,80 + ?cursor = 0,81 diff --git a/src/libvterm/t/17state_mouse.test b/src/libvterm/t/17state_mouse.test new file mode 100644 index 0000000000..c39f56b822 --- /dev/null +++ b/src/libvterm/t/17state_mouse.test @@ -0,0 +1,172 @@ +INIT +WANTSTATE p + +!DECRQM on with mouse off +PUSH "\e[?1000\$p" + output "\e[?1000;2\$y" +PUSH "\e[?1002\$p" + output "\e[?1002;2\$y" +PUSH "\e[?1003\$p" + output "\e[?1003;2\$y" + +!Mouse in simple button report mode +RESET + settermprop 1 true + settermprop 2 true + settermprop 7 1 +PUSH "\e[?1000h" + settermprop 8 1 + +!Press 1 +MOUSEMOVE 0,0 0 +MOUSEBTN d 1 0 + output "\e[M\x20\x21\x21" + +!Release 1 +MOUSEBTN u 1 0 + output "\e[M\x23\x21\x21" + +!Ctrl-Press 1 +MOUSEBTN d 1 C + output "\e[M\x30\x21\x21" +MOUSEBTN u 1 C + output "\e[M\x33\x21\x21" + +!Button 2 +MOUSEBTN d 2 0 + output "\e[M\x21\x21\x21" +MOUSEBTN u 2 0 + output "\e[M\x23\x21\x21" + +!Position +MOUSEMOVE 10,20 0 +MOUSEBTN d 1 0 + output "\e[M\x20\x35\x2b" + +MOUSEBTN u 1 0 + output "\e[M\x23\x35\x2b" +MOUSEMOVE 10,21 0 + # no output + +!Wheel events +MOUSEBTN d 4 0 + output "\e[M\x60\x36\x2b" +MOUSEBTN d 4 0 + output "\e[M\x60\x36\x2b" +MOUSEBTN d 5 0 + output "\e[M\x61\x36\x2b" + +!DECRQM on mouse button mode +PUSH "\e[?1000\$p" + output "\e[?1000;1\$y" +PUSH "\e[?1002\$p" + output "\e[?1002;2\$y" +PUSH "\e[?1003\$p" + output "\e[?1003;2\$y" + +!Drag events +RESET + settermprop 1 true + settermprop 2 true + settermprop 7 1 +PUSH "\e[?1002h" + settermprop 8 2 + +MOUSEMOVE 5,5 0 +MOUSEBTN d 1 0 + output "\e[M\x20\x26\x26" +MOUSEMOVE 5,6 0 + output "\e[M\x40\x27\x26" +MOUSEMOVE 6,6 0 + output "\e[M\x40\x27\x27" +MOUSEMOVE 6,6 0 + # no output +MOUSEBTN u 1 0 + output "\e[M\x23\x27\x27" +MOUSEMOVE 6,7 + # no output + +!DECRQM on mouse drag mode +PUSH "\e[?1000\$p" + output "\e[?1000;2\$y" +PUSH "\e[?1002\$p" + output "\e[?1002;1\$y" +PUSH "\e[?1003\$p" + output "\e[?1003;2\$y" + +!Non-drag motion events +PUSH "\e[?1003h" + settermprop 8 3 + +MOUSEMOVE 6,8 0 + output "\e[M\x43\x29\x27" + +!DECRQM on mouse motion mode +PUSH "\e[?1000\$p" + output "\e[?1000;2\$y" +PUSH "\e[?1002\$p" + output "\e[?1002;2\$y" +PUSH "\e[?1003\$p" + output "\e[?1003;1\$y" + +!Bounds checking +MOUSEMOVE 300,300 0 + output "\e[M\x43\xff\xff" +MOUSEBTN d 1 0 + output "\e[M\x20\xff\xff" +MOUSEBTN u 1 0 + output "\e[M\x23\xff\xff" + +!DECRQM on standard encoding mode +PUSH "\e[?1005\$p" + output "\e[?1005;2\$y" +PUSH "\e[?1006\$p" + output "\e[?1006;2\$y" +PUSH "\e[?1015\$p" + output "\e[?1015;2\$y" + +!UTF-8 extended encoding mode +# 300 + 32 + 1 = 333 = U+014d = \xc5\x8d +PUSH "\e[?1005h" +MOUSEBTN d 1 0 + output "\e[M\x20\xc5\x8d\xc5\x8d" +MOUSEBTN u 1 0 + output "\e[M\x23\xc5\x8d\xc5\x8d" + +!DECRQM on UTF-8 extended encoding mode +PUSH "\e[?1005\$p" + output "\e[?1005;1\$y" +PUSH "\e[?1006\$p" + output "\e[?1006;2\$y" +PUSH "\e[?1015\$p" + output "\e[?1015;2\$y" + +!SGR extended encoding mode +PUSH "\e[?1006h" +MOUSEBTN d 1 0 + output "\e[<0;301;301M" +MOUSEBTN u 1 0 + output "\e[<0;301;301m" + +!DECRQM on SGR extended encoding mode +PUSH "\e[?1005\$p" + output "\e[?1005;2\$y" +PUSH "\e[?1006\$p" + output "\e[?1006;1\$y" +PUSH "\e[?1015\$p" + output "\e[?1015;2\$y" + +!rxvt extended encoding mode +PUSH "\e[?1015h" +MOUSEBTN d 1 0 + output "\e[0;301;301M" +MOUSEBTN u 1 0 + output "\e[3;301;301M" + +!DECRQM on rxvt extended encoding mode +PUSH "\e[?1005\$p" + output "\e[?1005;2\$y" +PUSH "\e[?1006\$p" + output "\e[?1006;2\$y" +PUSH "\e[?1015\$p" + output "\e[?1015;1\$y" diff --git a/src/libvterm/t/18state_termprops.test b/src/libvterm/t/18state_termprops.test new file mode 100644 index 0000000000..9e6928a21e --- /dev/null +++ b/src/libvterm/t/18state_termprops.test @@ -0,0 +1,36 @@ +INIT +WANTSTATE p + +RESET + settermprop 1 true + settermprop 2 true + settermprop 7 1 + +!Cursor visibility +PUSH "\e[?25h" + settermprop 1 true +PUSH "\e[?25\$p" + output "\e[?25;1\$y" +PUSH "\e[?25l" + settermprop 1 false +PUSH "\e[?25\$p" + output "\e[?25;2\$y" + +!Cursor blink +PUSH "\e[?12h" + settermprop 2 true +PUSH "\e[?12\$p" + output "\e[?12;1\$y" +PUSH "\e[?12l" + settermprop 2 false +PUSH "\e[?12\$p" + output "\e[?12;2\$y" + +!Cursor shape +PUSH "\e[3 q" + settermprop 2 true + settermprop 7 2 + +!Title +PUSH "\e]2;Here is my title\a" + settermprop 4 "Here is my title" diff --git a/src/libvterm/t/20state_wrapping.test b/src/libvterm/t/20state_wrapping.test new file mode 100644 index 0000000000..606fa06368 --- /dev/null +++ b/src/libvterm/t/20state_wrapping.test @@ -0,0 +1,69 @@ +INIT +UTF8 1 +WANTSTATE gm + +!79th Column +PUSH "\e[75G" +PUSH "A"x5 + putglyph 0x41 1 0,74 + putglyph 0x41 1 0,75 + putglyph 0x41 1 0,76 + putglyph 0x41 1 0,77 + putglyph 0x41 1 0,78 + ?cursor = 0,79 + +!80th Column Phantom +PUSH "A" + putglyph 0x41 1 0,79 + ?cursor = 0,79 + +!Line Wraparound +PUSH "B" + putglyph 0x42 1 1,0 + ?cursor = 1,1 + +!Line Wraparound during combined write +PUSH "\e[78G" +PUSH "BBBCC" + putglyph 0x42 1 1,77 + putglyph 0x42 1 1,78 + putglyph 0x42 1 1,79 + putglyph 0x43 1 2,0 + putglyph 0x43 1 2,1 + ?cursor = 2,2 + +!DEC Auto Wrap Mode +RESET +PUSH "\e[?7l" +PUSH "\e[75G" +PUSH "D"x6 + putglyph 0x44 1 0,74 + putglyph 0x44 1 0,75 + putglyph 0x44 1 0,76 + putglyph 0x44 1 0,77 + putglyph 0x44 1 0,78 + putglyph 0x44 1 0,79 + ?cursor = 0,79 +PUSH "D" + putglyph 0x44 1 0,79 + ?cursor = 0,79 +PUSH "\e[?7h" + +!80th column causes linefeed on wraparound +PUSH "\e[25;78HABC" + putglyph 0x41 1 24,77 + putglyph 0x42 1 24,78 + putglyph 0x43 1 24,79 + ?cursor = 24,79 +PUSH "D" + moverect 1..25,0..80 -> 0..24,0..80 + putglyph 0x44 1 24,0 + +!80th column phantom linefeed phantom cancelled by explicit cursor move +PUSH "\e[25;78HABC" + putglyph 0x41 1 24,77 + putglyph 0x42 1 24,78 + putglyph 0x43 1 24,79 + ?cursor = 24,79 +PUSH "\e[25;1HD" + putglyph 0x44 1 24,0 diff --git a/src/libvterm/t/21state_tabstops.test b/src/libvterm/t/21state_tabstops.test new file mode 100644 index 0000000000..df4a5897ce --- /dev/null +++ b/src/libvterm/t/21state_tabstops.test @@ -0,0 +1,60 @@ +INIT +WANTSTATE g + +!Initial +RESET +PUSH "\tX" + putglyph 0x58 1 0,8 +PUSH "\tX" + putglyph 0x58 1 0,16 + ?cursor = 0,17 + +!HTS +PUSH "\e[5G\eH" +PUSH "\e[G\tX" + putglyph 0x58 1 0,4 + ?cursor = 0,5 + +!TBC 0 +PUSH "\e[9G\e[g" +PUSH "\e[G\tX\tX" + putglyph 0x58 1 0,4 + putglyph 0x58 1 0,16 + ?cursor = 0,17 + +!TBC 3 +PUSH "\e[3g\e[50G\eH\e[G" + ?cursor = 0,0 +PUSH "\tX" + putglyph 0x58 1 0,49 + ?cursor = 0,50 + +!Tabstops after resize +RESET +RESIZE 30,100 +# Should be 100/8 = 12 tabstops +PUSH "\tX" + putglyph 0x58 1 0,8 +PUSH "\tX" + putglyph 0x58 1 0,16 +PUSH "\tX" + putglyph 0x58 1 0,24 +PUSH "\tX" + putglyph 0x58 1 0,32 +PUSH "\tX" + putglyph 0x58 1 0,40 +PUSH "\tX" + putglyph 0x58 1 0,48 +PUSH "\tX" + putglyph 0x58 1 0,56 +PUSH "\tX" + putglyph 0x58 1 0,64 +PUSH "\tX" + putglyph 0x58 1 0,72 +PUSH "\tX" + putglyph 0x58 1 0,80 +PUSH "\tX" + putglyph 0x58 1 0,88 +PUSH "\tX" + putglyph 0x58 1 0,96 + ?cursor = 0,97 diff --git a/src/libvterm/t/22state_save.test b/src/libvterm/t/22state_save.test new file mode 100644 index 0000000000..81e9226320 --- /dev/null +++ b/src/libvterm/t/22state_save.test @@ -0,0 +1,64 @@ +INIT +WANTSTATE p + +RESET + settermprop 1 true + settermprop 2 true + settermprop 7 1 + +!Set up state +PUSH "\e[2;2H" + ?cursor = 1,1 +PUSH "\e[1m" + ?pen bold = on + +!Save +PUSH "\e[?1048h" + +!Change state +PUSH "\e[5;5H" + ?cursor = 4,4 +PUSH "\e[4 q" + settermprop 2 false + settermprop 7 2 +PUSH "\e[22;4m" + ?pen bold = off + ?pen underline = 1 + +!Restore +PUSH "\e[?1048l" + settermprop 1 true + settermprop 2 true + settermprop 7 1 + ?cursor = 1,1 + ?pen bold = on + ?pen underline = 0 + +!Save/restore using DECSC/DECRC +PUSH "\e[2;2H\e7" + ?cursor = 1,1 + +PUSH "\e[5;5H" + ?cursor = 4,4 +PUSH "\e8" + settermprop 1 true + settermprop 2 true + settermprop 7 1 + ?cursor = 1,1 + +!Save twice, restore twice happens on both edge transitions +PUSH "\e[2;10H\e[?1048h\e[6;10H\e[?1048h" +PUSH "\e[H" + ?cursor = 0,0 +PUSH "\e[?1048l" + settermprop 1 true + settermprop 2 true + settermprop 7 1 + ?cursor = 5,9 +PUSH "\e[H" + ?cursor = 0,0 +PUSH "\e[?1048l" + settermprop 1 true + settermprop 2 true + settermprop 7 1 + ?cursor = 5,9 diff --git a/src/libvterm/t/25state_input.test b/src/libvterm/t/25state_input.test new file mode 100644 index 0000000000..a5119fbd87 --- /dev/null +++ b/src/libvterm/t/25state_input.test @@ -0,0 +1,143 @@ +INIT +WANTSTATE + +!Unmodified ASCII +INCHAR 0 41 + output "A" +INCHAR 0 61 + output "a" + +!Ctrl modifier on ASCII letters +INCHAR C 41 + output "\e[65;5u" +INCHAR C 61 + output "\x01" + +!Alt modifier on ASCII letters +INCHAR A 41 + output "\eA" +INCHAR A 61 + output "\ea" + +!Ctrl-Alt modifier on ASCII letters +INCHAR CA 41 + output "\e[65;7u" +INCHAR CA 61 + output "\e\x01" + +!Special handling of Ctrl-I +INCHAR 0 49 + output "I" +INCHAR 0 69 + output "i" +INCHAR C 49 + output "\e[73;5u" +INCHAR C 69 + output "\e[105;5u" +INCHAR A 49 + output "\eI" +INCHAR A 69 + output "\ei" +INCHAR CA 49 + output "\e[73;7u" +INCHAR CA 69 + output "\e[105;7u" + +!Special handling of Space +INCHAR 0 20 + output " " +INCHAR S 20 + output "\e[32;2u" +INCHAR C 20 + output "\0" +INCHAR SC 20 + output "\e[32;6u" +INCHAR A 20 + output "\e " +INCHAR SA 20 + output "\e[32;4u" +INCHAR CA 20 + output "\e\0" +INCHAR SCA 20 + output "\e[32;8u" + +!Cursor keys in reset (cursor) mode +INKEY 0 Up + output "\e[A" +INKEY S Up + output "\e[1;2A" +INKEY C Up + output "\e[1;5A" +INKEY SC Up + output "\e[1;6A" +INKEY A Up + output "\e[1;3A" +INKEY SA Up + output "\e[1;4A" +INKEY CA Up + output "\e[1;7A" +INKEY SCA Up + output "\e[1;8A" + +!Cursor keys in application mode +PUSH "\e[?1h" +# Plain "Up" should be SS3 A now +INKEY 0 Up + output "\eOA" +# Modified keys should still use CSI +INKEY S Up + output "\e[1;2A" +INKEY C Up + output "\e[1;5A" + +!Shift-Tab should be different +INKEY 0 Tab + output "\x09" +INKEY S Tab + output "\e[Z" +INKEY C Tab + output "\e[9;5u" +INKEY A Tab + output "\e\x09" +INKEY CA Tab + output "\e[9;7u" + +!Enter in linefeed mode +INKEY 0 Enter + output "\x0d" + +!Enter in newline mode +PUSH "\e[20h" +INKEY 0 Enter + output "\x0d\x0a" + +!Keypad in DECKPNM +INKEY 0 KP0 + output "0" + +!Keypad in DECKPAM +PUSH "\e=" +INKEY 0 KP0 + output "\eOp" + +!Bracketed paste mode off +PASTE START +PASTE END + +!Bracketed paste mode on +PUSH "\e[?2004h" +PASTE START + output "\e[200~" +PASTE END + output "\e[201~" + +!Focus reporting disabled +FOCUS IN +FOCUS OUT + +!Focus reporting enabled +PUSH "\e[?1004h" +FOCUS IN + output "\e[I" +FOCUS OUT + output "\e[O" diff --git a/src/libvterm/t/26state_query.test b/src/libvterm/t/26state_query.test new file mode 100644 index 0000000000..3ace2d5323 --- /dev/null +++ b/src/libvterm/t/26state_query.test @@ -0,0 +1,62 @@ +INIT +WANTSTATE + +!DA +RESET +PUSH "\e[c" + output "\e[?1;2c" + +!DSR +RESET +PUSH "\e[5n" + output "\e[0n" + +!CPR +PUSH "\e[6n" + output "\e[1;1R" +PUSH "\e[10;10H\e[6n" + output "\e[10;10R" + +!DECCPR +PUSH "\e[?6n" + output "\e[?10;10R" + +!DECRQSS on DECSCUSR +PUSH "\e[3 q" +PUSH "\eP\$q q\e\\" + output "\eP1\$r3 q\e\\" + +!DECRQSS on SGR +PUSH "\e[1;5;7m" +PUSH "\eP\$qm\e\\" + output "\eP1\$r1;5;7m\e\\" + +!DECRQSS on SGR ANSI colours +PUSH "\e[0;31;42m" +PUSH "\eP\$qm\e\\" + output "\eP1\$r31;42m\e\\" + +!DECRQSS on SGR ANSI hi-bright colours +PUSH "\e[0;93;104m" +PUSH "\eP\$qm\e\\" + output "\eP1\$r93;104m\e\\" + +!DECRQSS on SGR 256-palette colours +PUSH "\e[0;38:5:56;48:5:78m" +PUSH "\eP\$qm\e\\" + output "\eP1\$r38:5:56;48:5:78m\e\\" + +!DECRQSS on SGR RGB8 colours +PUSH "\e[0;38:2:24:68:112;48:2:13:57:101m" +PUSH "\eP\$qm\e\\" + output "\eP1\$r38:2:24:68:112;48:2:13:57:101m\e\\" + +!S8C1T on DSR +PUSH "\e G" +PUSH "\e[5n" + output "\x{9b}0n" +PUSH "\e F" + +!Truncation on attempted buffer overflow +PUSH "\e[6n" x 30 + output "\e[10;10R" x 24 diff --git a/src/libvterm/t/27state_reset.test b/src/libvterm/t/27state_reset.test new file mode 100644 index 0000000000..254f994409 --- /dev/null +++ b/src/libvterm/t/27state_reset.test @@ -0,0 +1,32 @@ +INIT +WANTSTATE + +RESET + +!RIS homes cursor +PUSH "\e[5;5H" + ?cursor = 4,4 +WANTSTATE +m +PUSH "\ec" + ?cursor = 0,0 +WANTSTATE -m + +!RIS cancels scrolling region +PUSH "\e[5;10r" +WANTSTATE +s +PUSH "\ec\e[25H\n" + scrollrect 0..25,0..80 => +1,+0 +WANTSTATE -s + +!RIS erases screen +PUSH "ABCDE" +WANTSTATE +e +PUSH "\ec" + erase 0..25,0..80 +WANTSTATE -e + +!RIS clears tabstops +PUSH "\e[5G\eH\e[G\t" + ?cursor = 0,4 +PUSH "\ec\t" + ?cursor = 0,8 diff --git a/src/libvterm/t/28state_dbl_wh.test b/src/libvterm/t/28state_dbl_wh.test new file mode 100644 index 0000000000..596194d6ca --- /dev/null +++ b/src/libvterm/t/28state_dbl_wh.test @@ -0,0 +1,61 @@ +INIT +WANTSTATE g + +!Single Width, Single Height +RESET +PUSH "\e#5" +PUSH "Hello" + putglyph 0x48 1 0,0 + putglyph 0x65 1 0,1 + putglyph 0x6c 1 0,2 + putglyph 0x6c 1 0,3 + putglyph 0x6f 1 0,4 + +!Double Width, Single Height +RESET +PUSH "\e#6" +PUSH "Hello" + putglyph 0x48 1 0,0 dwl + putglyph 0x65 1 0,1 dwl + putglyph 0x6c 1 0,2 dwl + putglyph 0x6c 1 0,3 dwl + putglyph 0x6f 1 0,4 dwl + ?cursor = 0,5 +PUSH "\e[40GAB" + putglyph 0x41 1 0,39 dwl + putglyph 0x42 1 1,0 + ?cursor = 1,1 + +!Double Height +RESET +PUSH "\e#3" +PUSH "Hello" + putglyph 0x48 1 0,0 dwl dhl-top + putglyph 0x65 1 0,1 dwl dhl-top + putglyph 0x6c 1 0,2 dwl dhl-top + putglyph 0x6c 1 0,3 dwl dhl-top + putglyph 0x6f 1 0,4 dwl dhl-top + ?cursor = 0,5 +PUSH "\r\n\e#4" +PUSH "Hello" + putglyph 0x48 1 1,0 dwl dhl-bottom + putglyph 0x65 1 1,1 dwl dhl-bottom + putglyph 0x6c 1 1,2 dwl dhl-bottom + putglyph 0x6c 1 1,3 dwl dhl-bottom + putglyph 0x6f 1 1,4 dwl dhl-bottom + ?cursor = 1,5 + +!Double Width scrolling +RESET +PUSH "\e[20H\e#6ABC" + putglyph 0x41 1 19,0 dwl + putglyph 0x42 1 19,1 dwl + putglyph 0x43 1 19,2 dwl +PUSH "\e[25H\n" +PUSH "\e[19;4HDE" + putglyph 0x44 1 18,3 dwl + putglyph 0x45 1 18,4 dwl +PUSH "\e[H\eM" +PUSH "\e[20;6HFG" + putglyph 0x46 1 19,5 dwl + putglyph 0x47 1 19,6 dwl diff --git a/src/libvterm/t/29state_fallback.test b/src/libvterm/t/29state_fallback.test new file mode 100644 index 0000000000..adf1c233ab --- /dev/null +++ b/src/libvterm/t/29state_fallback.test @@ -0,0 +1,19 @@ +INIT +WANTSTATE f +RESET + +!Unrecognised control +PUSH "\x03" + control 03 + +!Unrecognised CSI +PUSH "\e[?15;2z" + csi 0x7a L=3f 15,2 + +!Unrecognised OSC +PUSH "\e]27;Something\e\\" + osc "27;Something" + +!Unrecognised DCS +PUSH "\ePz123\e\\" + dcs "z123" diff --git a/src/libvterm/t/30pen.test b/src/libvterm/t/30pen.test new file mode 100644 index 0000000000..7a671e7530 --- /dev/null +++ b/src/libvterm/t/30pen.test @@ -0,0 +1,106 @@ +INIT +UTF8 1 +WANTSTATE + +!Reset +PUSH "\e[m" + ?pen bold = off + ?pen underline = 0 + ?pen italic = off + ?pen blink = off + ?pen reverse = off + ?pen font = 0 + ?pen foreground = rgb(240,240,240) + ?pen background = rgb(0,0,0) + +!Bold +PUSH "\e[1m" + ?pen bold = on +PUSH "\e[22m" + ?pen bold = off +PUSH "\e[1m\e[m" + ?pen bold = off + +!Underline +PUSH "\e[4m" + ?pen underline = 1 +PUSH "\e[21m" + ?pen underline = 2 +PUSH "\e[24m" + ?pen underline = 0 +PUSH "\e[4m\e[m" + ?pen underline = 0 + +!Italic +PUSH "\e[3m" + ?pen italic = on +PUSH "\e[23m" + ?pen italic = off +PUSH "\e[3m\e[m" + ?pen italic = off + +!Blink +PUSH "\e[5m" + ?pen blink = on +PUSH "\e[25m" + ?pen blink = off +PUSH "\e[5m\e[m" + ?pen blink = off + +!Reverse +PUSH "\e[7m" + ?pen reverse = on +PUSH "\e[27m" + ?pen reverse = off +PUSH "\e[7m\e[m" + ?pen reverse = off + +!Font Selection +PUSH "\e[11m" + ?pen font = 1 +PUSH "\e[19m" + ?pen font = 9 +PUSH "\e[10m" + ?pen font = 0 +PUSH "\e[11m\e[m" + ?pen font = 0 + +!Foreground +PUSH "\e[31m" + ?pen foreground = rgb(224,0,0) +PUSH "\e[32m" + ?pen foreground = rgb(0,224,0) +PUSH "\e[34m" + ?pen foreground = rgb(0,0,224) +PUSH "\e[91m" + ?pen foreground = rgb(255,64,64) +PUSH "\e[38:2:10:20:30m" + ?pen foreground = rgb(10,20,30) +PUSH "\e[38:5:1m" + ?pen foreground = rgb(224,0,0) +PUSH "\e[39m" + ?pen foreground = rgb(240,240,240) + +!Background +PUSH "\e[41m" + ?pen background = rgb(224,0,0) +PUSH "\e[42m" + ?pen background = rgb(0,224,0) +PUSH "\e[44m" + ?pen background = rgb(0,0,224) +PUSH "\e[101m" + ?pen background = rgb(255,64,64) +PUSH "\e[48:2:10:20:30m" + ?pen background = rgb(10,20,30) +PUSH "\e[48:5:1m" + ?pen background = rgb(224,0,0) +PUSH "\e[49m" + ?pen background = rgb(0,0,0) + +!Bold+ANSI colour == highbright +PUSH "\e[m\e[1;37m" + ?pen bold = on + ?pen foreground = rgb(255,255,255) +PUSH "\e[m\e[37;1m" + ?pen bold = on + ?pen foreground = rgb(255,255,255) diff --git a/src/libvterm/t/40screen_ascii.test b/src/libvterm/t/40screen_ascii.test new file mode 100644 index 0000000000..c2f48fabf3 --- /dev/null +++ b/src/libvterm/t/40screen_ascii.test @@ -0,0 +1,69 @@ +INIT +WANTSCREEN c + +!Get +RESET +PUSH "ABC" + movecursor 0,3 + ?screen_chars 0,0,1,3 = 0x41,0x42,0x43 + ?screen_chars 0,0,1,80 = 0x41,0x42,0x43 + ?screen_text 0,0,1,3 = 0x41,0x42,0x43 + ?screen_text 0,0,1,80 = 0x41,0x42,0x43 + ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_cell 0,1 = {0x42} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_cell 0,2 = {0x43} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_row 0 = "ABC" + ?screen_eol 0,0 = 0 + ?screen_eol 0,2 = 0 + ?screen_eol 0,3 = 1 +PUSH "\e[H" + movecursor 0,0 + ?screen_chars 0,0,1,80 = 0x41,0x42,0x43 + ?screen_text 0,0,1,80 = 0x41,0x42,0x43 +PUSH "E" + movecursor 0,1 + ?screen_chars 0,0,1,80 = 0x45,0x42,0x43 + ?screen_text 0,0,1,80 = 0x45,0x42,0x43 + +WANTSCREEN -c + +!Erase +RESET +PUSH "ABCDE\e[H\e[K" + ?screen_chars 0,0,1,80 = + ?screen_text 0,0,1,80 = + +!Copycell +RESET +PUSH "ABC\e[H\e[@" +PUSH "1" + ?screen_chars 0,0,1,80 = 0x31,0x41,0x42,0x43 + +RESET +PUSH "ABC\e[H\e[P" + ?screen_chars 0,0,1,1 = 0x42 + ?screen_chars 0,1,1,2 = 0x43 + ?screen_chars 0,0,1,80 = 0x42,0x43 + +!Space padding +RESET +PUSH "Hello\e[CWorld" + ?screen_chars 0,0,1,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,0x72,0x6c,0x64 + ?screen_text 0,0,1,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,0x72,0x6c,0x64 + +!Linefeed padding +RESET +PUSH "Hello\r\nWorld" + ?screen_chars 0,0,2,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x0a,0x57,0x6f,0x72,0x6c,0x64 + ?screen_text 0,0,2,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x0a,0x57,0x6f,0x72,0x6c,0x64 + +!Altscreen +RESET +PUSH "P" + ?screen_chars 0,0,1,80 = 0x50 +PUSH "\e[?1049h" + ?screen_chars 0,0,1,80 = +PUSH "\e[2K\e[HA" + ?screen_chars 0,0,1,80 = 0x41 +PUSH "\e[?1049l" + ?screen_chars 0,0,1,80 = 0x50 diff --git a/src/libvterm/t/41screen_unicode.test b/src/libvterm/t/41screen_unicode.test new file mode 100644 index 0000000000..79dcb68623 --- /dev/null +++ b/src/libvterm/t/41screen_unicode.test @@ -0,0 +1,47 @@ +INIT +UTF8 1 +WANTSCREEN + +!Single width UTF-8 +# U+00C1 = 0xC3 0x81 name: LATIN CAPITAL LETTER A WITH ACUTE +# U+00E9 = 0xC3 0xA9 name: LATIN SMALL LETTER E WITH ACUTE +RESET +PUSH "\xC3\x81\xC3\xA9" + ?screen_chars 0,0,1,80 = 0xc1,0xe9 + ?screen_text 0,0,1,80 = 0xc3,0x81,0xc3,0xa9 + ?screen_cell 0,0 = {0xc1} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Wide char +# U+FF10 = 0xEF 0xBC 0x90 name: FULLWIDTH DIGIT ZERO +RESET +PUSH "0123\e[H" +PUSH "\xEF\xBC\x90" + ?screen_chars 0,0,1,80 = 0xff10,0x32,0x33 + ?screen_text 0,0,1,80 = 0xef,0xbc,0x90,0x32,0x33 + ?screen_cell 0,0 = {0xff10} width=2 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Combining char +# U+0301 = 0xCC 0x81 name: COMBINING ACUTE +RESET +PUSH "0123\e[H" +PUSH "e\xCC\x81" + ?screen_chars 0,0,1,80 = 0x65,0x301,0x31,0x32,0x33 + ?screen_text 0,0,1,80 = 0x65,0xcc,0x81,0x31,0x32,0x33 + ?screen_cell 0,0 = {0x65,0x301} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!10 combining accents should not crash +RESET +PUSH "e\xCC\x81\xCC\x82\xCC\x83\xCC\x84\xCC\x85\xCC\x86\xCC\x87\xCC\x88\xCC\x89\xCC\x8A" + ?screen_cell 0,0 = {0x65,0x301,0x302,0x303,0x304,0x305} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!40 combining accents in two split writes of 20 should not crash +RESET +PUSH "e\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81" +PUSH "\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81\xCC\x81" + ?screen_cell 0,0 = {0x65,0x301,0x301,0x301,0x301,0x301} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Outputing CJK doublewidth in 80th column should wraparound to next line and not crash" +RESET +PUSH "\e[80G\xEF\xBC\x90" + ?screen_cell 0,79 = {} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_cell 1,0 = {0xff10} width=2 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) diff --git a/src/libvterm/t/42screen_damage.test b/src/libvterm/t/42screen_damage.test new file mode 100644 index 0000000000..791a96cdb9 --- /dev/null +++ b/src/libvterm/t/42screen_damage.test @@ -0,0 +1,155 @@ +INIT +WANTSCREEN Db + +!Putglyph +RESET + damage 0..25,0..80 +PUSH "123" + damage 0..1,0..1 = 0<31> + damage 0..1,1..2 = 0<32> + damage 0..1,2..3 = 0<33> + +!Erase +PUSH "\e[H" +PUSH "\e[3X" + damage 0..1,0..3 + +!Scroll damages entire line in two chunks +PUSH "\e[H\e[5@" + damage 0..1,5..80 + damage 0..1,0..5 + +!Scroll down damages entire screen in two chunks +PUSH "\e[T" + damage 1..25,0..80 + damage 0..1,0..80 + +!Altscreen damages entire area +PUSH "\e[?1049h" + damage 0..25,0..80 +PUSH "\e[?1049l" + damage 0..25,0..80 + +WANTSCREEN m + +!Scroll invokes moverect but not damage +PUSH "\e[5@" + moverect 0..1,0..75 -> 0..1,5..80 + damage 0..1,0..5 + +WANTSCREEN -m + +!Merge to cells +RESET + damage 0..25,0..80 +DAMAGEMERGE CELL + +PUSH "A" + damage 0..1,0..1 = 0<41> +PUSH "B" + damage 0..1,1..2 = 0<42> +PUSH "C" + damage 0..1,2..3 = 0<43> + +!Merge entire rows +RESET + damage 0..25,0..80 +DAMAGEMERGE ROW + +PUSH "ABCDE\r\nEFGH" + damage 0..1,0..5 = 0<41 42 43 44 45> +DAMAGEFLUSH + damage 1..2,0..4 = 1<45 46 47 48> +PUSH "\e[3;6r\e[6H\eD" + damage 2..5,0..80 +DAMAGEFLUSH + damage 5..6,0..80 + +!Merge entire screen +RESET + damage 0..25,0..80 +DAMAGEMERGE SCREEN + +PUSH "ABCDE\r\nEFGH" +DAMAGEFLUSH + damage 0..2,0..5 = 0<41 42 43 44 45> 1<45 46 47 48> +PUSH "\e[3;6r\e[6H\eD" +DAMAGEFLUSH + damage 2..6,0..80 + +!Merge entire screen with moverect +WANTSCREEN m + +RESET + damage 0..25,0..80 +DAMAGEMERGE SCREEN + +PUSH "ABCDE\r\nEFGH" +PUSH "\e[3;6r\e[6H\eD" + damage 0..2,0..5 = 0<41 42 43 44 45> 1<45 46 47 48> + moverect 3..6,0..80 -> 2..5,0..80 +DAMAGEFLUSH + damage 5..6,0..80 + +!Merge scroll +RESET + damage 0..25,0..80 +DAMAGEMERGE SCROLL + +PUSH "\e[H1\r\n2\r\n3" +PUSH "\e[25H\n\n\n" + sb_pushline 80 = 31 + sb_pushline 80 = 32 + sb_pushline 80 = 33 +DAMAGEFLUSH + moverect 3..25,0..80 -> 0..22,0..80 + damage 0..25,0..80 + +!Merge scroll with damage +PUSH "\e[25H" +PUSH "ABCDE\r\nEFGH\r\n" + sb_pushline 80 = + sb_pushline 80 = +DAMAGEFLUSH + moverect 2..25,0..80 -> 0..23,0..80 + damage 22..25,0..80 = 22<41 42 43 44 45> 23<45 46 47 48> + +!Merge scroll with damage past region +PUSH "\e[3;6r\e[6H1\r\n2\r\n3\r\n4\r\n5" +DAMAGEFLUSH + damage 2..6,0..80 = 2<32> 3<33> 4<34> 5<35> + +!Damage entirely outside scroll region +PUSH "\e[HABC\e[3;6r\e[6H\r\n6" + damage 0..1,0..3 = 0<41 42 43> +DAMAGEFLUSH + moverect 3..6,0..80 -> 2..5,0..80 + damage 5..6,0..80 = 5<36> + +!Damage overlapping scroll region +PUSH "\e[H\e[2J" +DAMAGEFLUSH + damage 0..25,0..80 + +PUSH "\e[HABCD\r\nEFGH\r\nIJKL\e[2;5r\e[5H\r\nMNOP" +DAMAGEFLUSH + moverect 2..5,0..80 -> 1..4,0..80 + damage 0..5,0..80 = 0<41 42 43 44> 1<49 4A 4B 4C> + ## TODO: is this right? + +!Merge scroll*2 with damage +RESET + damage 0..25,0..80 +DAMAGEMERGE SCROLL + +PUSH "\e[25H\r\nABCDE\b\b\b\e[2P\r\n" + sb_pushline 80 = + moverect 1..25,0..80 -> 0..24,0..80 + damage 24..25,0..80 = 24<41 42 43 44 45> + moverect 24..25,4..80 -> 24..25,2..78 + damage 24..25,78..80 + sb_pushline 80 = +DAMAGEFLUSH + moverect 1..25,0..80 -> 0..24,0..80 + damage 24..25,0..80 + ?screen_chars 23,0,24,5 = 0x41,0x42,0x45 diff --git a/src/libvterm/t/43screen_resize.test b/src/libvterm/t/43screen_resize.test new file mode 100644 index 0000000000..9e5e5b206a --- /dev/null +++ b/src/libvterm/t/43screen_resize.test @@ -0,0 +1,90 @@ +INIT +WANTSTATE +WANTSCREEN + +!Resize wider preserves cells +RESET +RESIZE 25,80 +PUSH "AB\r\nCD" + ?screen_chars 0,0,1,80 = 0x41,0x42 + ?screen_chars 1,0,2,80 = 0x43,0x44 +RESIZE 25,100 + ?screen_chars 0,0,1,100 = 0x41,0x42 + ?screen_chars 1,0,2,100 = 0x43,0x44 + +!Resize wider allows print in new area +RESET +RESIZE 25,80 +PUSH "AB\e[79GCD" + ?screen_chars 0,0,1,2 = 0x41,0x42 + ?screen_chars 0,78,1,80 = 0x43,0x44 +RESIZE 25,100 + ?screen_chars 0,0,1,2 = 0x41,0x42 + ?screen_chars 0,78,1,80 = 0x43,0x44 +PUSH "E" + ?screen_chars 0,78,1,81 = 0x43,0x44,0x45 + +!Resize shorter with blanks just truncates +RESET +RESIZE 25,80 +PUSH "Top\e[10HLine 10" + ?screen_chars 0,0,1,80 = 0x54,0x6f,0x70 + ?screen_chars 9,0,10,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31,0x30 + ?cursor = 9,7 +RESIZE 20,80 + ?screen_chars 0,0,1,80 = 0x54,0x6f,0x70 + ?screen_chars 9,0,10,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31,0x30 + ?cursor = 9,7 + +!Resize shorter with content must scroll +RESET +RESIZE 25,80 +PUSH "Top\e[25HLine 25\e[15H" + ?screen_chars 0,0,1,80 = 0x54,0x6f,0x70 + ?screen_chars 24,0,25,80 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35 + ?cursor = 14,0 +WANTSCREEN b +RESIZE 20,80 + sb_pushline 80 = 54 6F 70 + sb_pushline 80 = + sb_pushline 80 = + sb_pushline 80 = + sb_pushline 80 = + ?screen_chars 0,0,1,80 = + ?screen_chars 19,0,20,80 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35 + ?cursor = 9,0 + +!Resize shorter does not lose line with cursor +# See also https://github.com/neovim/libvterm/commit/1b745d29d45623aa8d22a7b9288c7b0e331c7088 +RESET +WANTSCREEN -b +RESIZE 25,80 +WANTSCREEN b +PUSH "\e[24HLine 24\r\nLine 25\r\n" + sb_pushline 80 = + ?screen_chars 23,0,24,10 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35 + ?cursor = 24,0 +RESIZE 24,80 + sb_pushline 80 = + ?screen_chars 22,0,23,10 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35 + ?cursor = 23,0 + +!Resize taller attempts to pop scrollback +RESET +WANTSCREEN -b +RESIZE 25,80 +PUSH "Line 1\e[25HBottom\e[15H" + ?screen_chars 0,0,1,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31 + ?screen_chars 24,0,25,80 = 0x42,0x6f,0x74,0x74,0x6f,0x6d + ?cursor = 14,0 +WANTSCREEN b +RESIZE 30,80 + sb_popline 80 + sb_popline 80 + sb_popline 80 + sb_popline 80 + sb_popline 80 + ?screen_chars 0,0,1,80 = 0x41,0x42,0x43,0x44,0x45 + ?screen_chars 5,0,6,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31 + ?screen_chars 29,0,30,80 = 0x42,0x6f,0x74,0x74,0x6f,0x6d + ?cursor = 19,0 diff --git a/src/libvterm/t/44screen_pen.test b/src/libvterm/t/44screen_pen.test new file mode 100644 index 0000000000..f1ee639ac7 --- /dev/null +++ b/src/libvterm/t/44screen_pen.test @@ -0,0 +1,55 @@ +INIT +WANTSCREEN + +RESET + +!Plain +PUSH "A" + ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Bold +PUSH "\e[1mB" + ?screen_cell 0,1 = {0x42} width=1 attrs={B} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Italic +PUSH "\e[3mC" + ?screen_cell 0,2 = {0x43} width=1 attrs={BI} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Underline +PUSH "\e[4mD" + ?screen_cell 0,3 = {0x44} width=1 attrs={BU1I} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Reset +PUSH "\e[mE" + ?screen_cell 0,4 = {0x45} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Font +PUSH "\e[11mF\e[m" + ?screen_cell 0,5 = {0x46} width=1 attrs={F1} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Foreground +PUSH "\e[31mG\e[m" + ?screen_cell 0,6 = {0x47} width=1 attrs={} fg=rgb(224,0,0) bg=rgb(0,0,0) + +!Background +PUSH "\e[42mH\e[m" + ?screen_cell 0,7 = {0x48} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,224,0) + +!EL sets reverse and colours to end of line +PUSH "\e[H\e[7;33;44m\e[K" + ?screen_cell 0,0 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224) + ?screen_cell 0,79 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224) + +!DECSCNM xors reverse for entire screen +PUSH "\e[?5h" + ?screen_cell 0,0 = {} width=1 attrs={} fg=rgb(224,224,0) bg=rgb(0,0,224) + ?screen_cell 0,79 = {} width=1 attrs={} fg=rgb(224,224,0) bg=rgb(0,0,224) + ?screen_cell 1,0 = {} width=1 attrs={R} fg=rgb(240,240,240) bg=rgb(0,0,0) +PUSH "\e[?5\$p" + output "\e[?5;1\$y" +PUSH "\e[?5l" + ?screen_cell 0,0 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224) + ?screen_cell 0,79 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224) + ?screen_cell 1,0 = {} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) +PUSH "\e[?5\$p" + output "\e[?5;2\$y" diff --git a/src/libvterm/t/45screen_protect.test b/src/libvterm/t/45screen_protect.test new file mode 100644 index 0000000000..718f853fc6 --- /dev/null +++ b/src/libvterm/t/45screen_protect.test @@ -0,0 +1,16 @@ +INIT +WANTSCREEN + +!Selective erase +RESET +PUSH "A\e[1\"qB\e[\"qC" + ?screen_chars 0,0,1,3 = 0x41,0x42,0x43 +PUSH "\e[G\e[?J" + ?screen_chars 0,0,1,3 = 0x20,0x42 + +!Non-selective erase +RESET +PUSH "A\e[1\"qB\e[\"qC" + ?screen_chars 0,0,1,3 = 0x41,0x42,0x43 +PUSH "\e[G\e[J" + ?screen_chars 0,0,1,3 = diff --git a/src/libvterm/t/46screen_extent.test b/src/libvterm/t/46screen_extent.test new file mode 100644 index 0000000000..a126cece8f --- /dev/null +++ b/src/libvterm/t/46screen_extent.test @@ -0,0 +1,11 @@ +INIT +WANTSCREEN + +!Bold extent +RESET +PUSH "AB\e[1mCD\e[mE" + ?screen_attrs_extent 0,0 = 0,0-1,1 + ?screen_attrs_extent 0,1 = 0,0-1,1 + ?screen_attrs_extent 0,2 = 0,2-1,3 + ?screen_attrs_extent 0,3 = 0,2-1,3 + ?screen_attrs_extent 0,4 = 0,4-1,79 diff --git a/src/libvterm/t/47screen_dbl_wh.test b/src/libvterm/t/47screen_dbl_wh.test new file mode 100644 index 0000000000..7d17d9a8c3 --- /dev/null +++ b/src/libvterm/t/47screen_dbl_wh.test @@ -0,0 +1,32 @@ +INIT +WANTSCREEN + +RESET + +!Single Width, Single Height +RESET +PUSH "\e#5" +PUSH "abcde" + ?screen_cell 0,0 = {0x61} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Double Width, Single Height +RESET +PUSH "\e#6" +PUSH "abcde" + ?screen_cell 0,0 = {0x61} width=1 attrs={} dwl fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Double Height +RESET +PUSH "\e#3" +PUSH "abcde" +PUSH "\r\n\e#4" +PUSH "abcde" + ?screen_cell 0,0 = {0x61} width=1 attrs={} dwl dhl-top fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_cell 1,0 = {0x61} width=1 attrs={} dwl dhl-bottom fg=rgb(240,240,240) bg=rgb(0,0,0) + +!Late change +RESET +PUSH "abcde" + ?screen_cell 0,0 = {0x61} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) +PUSH "\e#6" + ?screen_cell 0,0 = {0x61} width=1 attrs={} dwl fg=rgb(240,240,240) bg=rgb(0,0,0) diff --git a/src/libvterm/t/48screen_termprops.test b/src/libvterm/t/48screen_termprops.test new file mode 100644 index 0000000000..adf7ec2f74 --- /dev/null +++ b/src/libvterm/t/48screen_termprops.test @@ -0,0 +1,17 @@ +INIT +WANTSCREEN p + +RESET + settermprop 1 true + settermprop 2 true + settermprop 7 1 + +!Cursor visibility +PUSH "\e[?25h" + settermprop 1 true +PUSH "\e[?25l" + settermprop 1 false + +!Title +PUSH "\e]2;Here is my title\a" + settermprop 4 "Here is my title" diff --git a/src/libvterm/t/90vttest_01-movement-1.test b/src/libvterm/t/90vttest_01-movement-1.test new file mode 100644 index 0000000000..c1a8cb9194 --- /dev/null +++ b/src/libvterm/t/90vttest_01-movement-1.test @@ -0,0 +1,87 @@ +INIT +WANTSTATE +WANTSCREEN + +RESET + +PUSH "\e#8" + +PUSH "\e[9;10H\e[1J" +PUSH "\e[18;60H\e[0J\e[1K" +PUSH "\e[9;71H\e[0K" + +$SEQ 10 16: PUSH "\e[\#;10H\e[1K\e[\#;71H\e[0K" + +PUSH "\e[17;30H\e[2K" + +$SEQ 1 80: PUSH "\e[24;\#f*\e[1;\#f*" + +PUSH "\e[2;2H" + +$REP 22: PUSH "+\e[1D\eD" + +PUSH "\e[23;79H" +$REP 22: PUSH "+\e[1D\eM" + +PUSH "\e[2;1H" +$SEQ 2 23: PUSH "*\e[\#;80H*\e[10D\eE" + +PUSH "\e[2;10H\e[42D\e[2C" +$REP 76: PUSH "+\e[0C\e[2D\e[1C" + +PUSH "\e[23;70H\e[42C\e[2D" + +$REP 76: PUSH "+\e[1D\e[1C\e[0D\b" + +PUSH "\e[1;1H" +PUSH "\e[10A" +PUSH "\e[1A" +PUSH "\e[0A" +PUSH "\e[24;80H" +PUSH "\e[10B" +PUSH "\e[1B" +PUSH "\e[0B" +PUSH "\e[10;12H" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +$REP 58: PUSH " " +PUSH "\e[1B\e[58D" + +PUSH "\e[5A\e[1CThe screen should be cleared, and have an unbroken bor-" +PUSH "\e[12;13Hder of *'s and +'s around the edge, and exactly in the" +PUSH "\e[13;13Hmiddle there should be a frame of E's around this text" +PUSH "\e[14;13Hwith one (1) free position around it. Push <RETURN>" + +# And the result is... + +!Output + ?screen_row 0 = "********************************************************************************" + ?screen_row 1 = "*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*" +$SEQ 2 7: ?screen_row \# = "*+ +*" + ?screen_row 8 = "*+ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +*" + ?screen_row 9 = "*+ E E +*" + ?screen_row 10 = "*+ E The screen should be cleared, and have an unbroken bor- E +*" + ?screen_row 11 = "*+ E der of *'s and +'s around the edge, and exactly in the E +*" + ?screen_row 12 = "*+ E middle there should be a frame of E's around this text E +*" + ?screen_row 13 = "*+ E with one (1) free position around it. Push <RETURN> E +*" + ?screen_row 14 = "*+ E E +*" + ?screen_row 15 = "*+ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +*" +$SEQ 16 21: ?screen_row \# = "*+ +*" + ?screen_row 22 = "*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*" + ?screen_row 23 = "********************************************************************************" + +?cursor = 13,67 diff --git a/src/libvterm/t/90vttest_01-movement-2.test b/src/libvterm/t/90vttest_01-movement-2.test new file mode 100644 index 0000000000..3a515e3c4b --- /dev/null +++ b/src/libvterm/t/90vttest_01-movement-2.test @@ -0,0 +1,40 @@ +INIT +WANTSTATE +WANTSCREEN + +RESET + +PUSH "\e[3;21r" +PUSH "\e[?6h" + +PUSH "\e[19;1HA\e[19;80Ha\x0a\e[18;80HaB\e[19;80HB\b b\x0a\e[19;80HC\b\b\t\tc\e[19;2H\bC\x0a\e[19;80H\x0a\e[18;1HD\e[18;80Hd" +PUSH "\e[19;1HE\e[19;80He\x0a\e[18;80HeF\e[19;80HF\b f\x0a\e[19;80HG\b\b\t\tg\e[19;2H\bG\x0a\e[19;80H\x0a\e[18;1HH\e[18;80Hh" +PUSH "\e[19;1HI\e[19;80Hi\x0a\e[18;80HiJ\e[19;80HJ\b j\x0a\e[19;80HK\b\b\t\tk\e[19;2H\bK\x0a\e[19;80H\x0a\e[18;1HL\e[18;80Hl" +PUSH "\e[19;1HM\e[19;80Hm\x0a\e[18;80HmN\e[19;80HN\b n\x0a\e[19;80HO\b\b\t\to\e[19;2H\bO\x0a\e[19;80H\x0a\e[18;1HP\e[18;80Hp" +PUSH "\e[19;1HQ\e[19;80Hq\x0a\e[18;80HqR\e[19;80HR\b r\x0a\e[19;80HS\b\b\t\ts\e[19;2H\bS\x0a\e[19;80H\x0a\e[18;1HT\e[18;80Ht" +PUSH "\e[19;1HU\e[19;80Hu\x0a\e[18;80HuV\e[19;80HV\b v\x0a\e[19;80HW\b\b\t\tw\e[19;2H\bW\x0a\e[19;80H\x0a\e[18;1HX\e[18;80Hx" +PUSH "\e[19;1HY\e[19;80Hy\x0a\e[18;80HyZ\e[19;80HZ\b z\x0a" + +!Output + +?screen_row 2 = "I i" +?screen_row 3 = "J j" +?screen_row 4 = "K k" +?screen_row 5 = "L l" +?screen_row 6 = "M m" +?screen_row 7 = "N n" +?screen_row 8 = "O o" +?screen_row 9 = "P p" +?screen_row 10 = "Q q" +?screen_row 11 = "R r" +?screen_row 12 = "S s" +?screen_row 13 = "T t" +?screen_row 14 = "U u" +?screen_row 15 = "V v" +?screen_row 16 = "W w" +?screen_row 17 = "X x" +?screen_row 18 = "Y y" +?screen_row 19 = "Z z" +?screen_row 20 = "" + +?cursor = 20,79 diff --git a/src/libvterm/t/90vttest_01-movement-3.test b/src/libvterm/t/90vttest_01-movement-3.test new file mode 100644 index 0000000000..f9a99bfc97 --- /dev/null +++ b/src/libvterm/t/90vttest_01-movement-3.test @@ -0,0 +1,21 @@ +# Test of cursor-control characters inside ESC sequences +INIT +WANTSTATE +WANTSCREEN + +RESET + +PUSH "A B C D E F G H I" +PUSH "\x0d\x0a" +PUSH "A\e[2\bCB\e[2\bCC\e[2\bCD\e[2\bCE\e[2\bCF\e[2\bCG\e[2\bCH\e[2\bCI" +PUSH "\x0d\x0a" +PUSH "A \e[\x0d2CB\e[\x0d4CC\e[\x0d6CD\e[\x0d8CE\e[\x0d10CF\e[\x0d12CG\e[\x0d14CH\e[\x0d16CI" +PUSH "\x0d\x0a" +PUSH "A \e[1\x0bAB \e[1\x0bAC \e[1\x0bAD \e[1\x0bAE \e[1\x0bAF \e[1\x0bAG \e[1\x0bAH \e[1\x0bAI \e[1\x0bA" + +!Output + +$SEQ 0 2: ?screen_row \# = "A B C D E F G H I" + ?screen_row 3 = "A B C D E F G H I " + +?cursor = 3,18 diff --git a/src/libvterm/t/90vttest_01-movement-4.test b/src/libvterm/t/90vttest_01-movement-4.test new file mode 100644 index 0000000000..0dab3c7d49 --- /dev/null +++ b/src/libvterm/t/90vttest_01-movement-4.test @@ -0,0 +1,36 @@ +# Test of leading zeroes in ESC sequences +INIT +WANTSCREEN + +RESET + +PUSH "\e[00000000004;000000001HT" +PUSH "\e[00000000004;000000002Hh" +PUSH "\e[00000000004;000000003Hi" +PUSH "\e[00000000004;000000004Hs" +PUSH "\e[00000000004;000000005H " +PUSH "\e[00000000004;000000006Hi" +PUSH "\e[00000000004;000000007Hs" +PUSH "\e[00000000004;000000008H " +PUSH "\e[00000000004;000000009Ha" +PUSH "\e[00000000004;0000000010H " +PUSH "\e[00000000004;0000000011Hc" +PUSH "\e[00000000004;0000000012Ho" +PUSH "\e[00000000004;0000000013Hr" +PUSH "\e[00000000004;0000000014Hr" +PUSH "\e[00000000004;0000000015He" +PUSH "\e[00000000004;0000000016Hc" +PUSH "\e[00000000004;0000000017Ht" +PUSH "\e[00000000004;0000000018H " +PUSH "\e[00000000004;0000000019Hs" +PUSH "\e[00000000004;0000000020He" +PUSH "\e[00000000004;0000000021Hn" +PUSH "\e[00000000004;0000000022Ht" +PUSH "\e[00000000004;0000000023He" +PUSH "\e[00000000004;0000000024Hn" +PUSH "\e[00000000004;0000000025Hc" +PUSH "\e[00000000004;0000000026He" + +!Output + +?screen_row 3 = "This is a correct sentence" diff --git a/src/libvterm/t/90vttest_02-screen-1.test b/src/libvterm/t/90vttest_02-screen-1.test new file mode 100644 index 0000000000..003d56f8a8 --- /dev/null +++ b/src/libvterm/t/90vttest_02-screen-1.test @@ -0,0 +1,18 @@ +# Test of WRAP AROUND mode setting. +INIT +WANTSCREEN + +RESET + +PUSH "\e[?7h" +$REP 170: PUSH "*" + +PUSH "\e[?7l\e[3;1H" +$REP 177: PUSH "*" + +PUSH "\e[?7h\e[5;1HOK" + +!Output +$SEQ 0 2: ?screen_row \# = "********************************************************************************" + ?screen_row 3 = "" + ?screen_row 4 = "OK" diff --git a/src/libvterm/t/90vttest_02-screen-2.test b/src/libvterm/t/90vttest_02-screen-2.test new file mode 100644 index 0000000000..1c3a6a7c99 --- /dev/null +++ b/src/libvterm/t/90vttest_02-screen-2.test @@ -0,0 +1,29 @@ +# TAB setting/resetting +INIT +WANTSTATE +WANTSCREEN + +RESET + +PUSH "\e[2J\e[3g" + +PUSH "\e[1;1H" +$REP 26: PUSH "\e[3C\eH" + +PUSH "\e[1;4H" +$REP 13: PUSH "\e[0g\e[6C" + +PUSH "\e[1;7H" +PUSH "\e[1g\e[2g" + +PUSH "\e[1;1H" +$REP 13: PUSH "\t*" + +PUSH "\e[2;2H" +$REP 13: PUSH " *" + +!Output +?screen_row 0 = " * * * * * * * * * * * * *" +?screen_row 1 = " * * * * * * * * * * * * *" + +?cursor = 1,79 diff --git a/src/libvterm/t/90vttest_02-screen-3.test b/src/libvterm/t/90vttest_02-screen-3.test new file mode 100644 index 0000000000..8cdf8df467 --- /dev/null +++ b/src/libvterm/t/90vttest_02-screen-3.test @@ -0,0 +1,16 @@ +# Origin mode +INIT +WANTSCREEN + +RESET + +PUSH "\e[?6h" +PUSH "\e[23;24r" +PUSH "\n" +PUSH "Bottom" +PUSH "\e[1;1H" +PUSH "Above" + +!Output +?screen_row 22 = "Above" +?screen_row 23 = "Bottom" diff --git a/src/libvterm/t/90vttest_02-screen-4.test b/src/libvterm/t/90vttest_02-screen-4.test new file mode 100644 index 0000000000..44d51f168c --- /dev/null +++ b/src/libvterm/t/90vttest_02-screen-4.test @@ -0,0 +1,17 @@ +# Origin mode (2) +INIT +WANTSCREEN + +RESET + +PUSH "\e[?6l" +PUSH "\e[23;24r" +PUSH "\e[24;1H" +PUSH "Bottom" +PUSH "\e[1;1H" +PUSH "Top" + +!Output +?screen_row 23 = "Bottom" +?screen_row 0 = "Top" + diff --git a/src/libvterm/t/92lp1640917.test b/src/libvterm/t/92lp1640917.test new file mode 100644 index 0000000000..70de439e1c --- /dev/null +++ b/src/libvterm/t/92lp1640917.test @@ -0,0 +1,13 @@ +INIT +WANTSTATE + +!Mouse reporting should not break by idempotent DECSM 1002 +PUSH "\e[?1002h" +MOUSEMOVE 0,0 0 +MOUSEBTN d 1 0 + output "\e[M\x20\x21\x21" +MOUSEMOVE 1,0 0 + output "\e[M\x40\x21\x22" +PUSH "\e[?1002h" +MOUSEMOVE 2,0 0 + output "\e[M\x40\x21\x23" diff --git a/src/libvterm/t/harness.c b/src/libvterm/t/harness.c new file mode 100644 index 0000000000..e2c729555f --- /dev/null +++ b/src/libvterm/t/harness.c @@ -0,0 +1,945 @@ +#include "vterm.h" +#include "../src/vterm_internal.h" /* We pull in some internal bits too */ + +#include <stdio.h> +#include <string.h> + +#define streq(a,b) (!strcmp(a,b)) +#define strstartswith(a,b) (!strncmp(a,b,strlen(b))) + +static size_t inplace_hex2bytes(char *s) +{ + char *inpos = s, *outpos = s; + + while(*inpos) { + unsigned int ch; + sscanf(inpos, "%2x", &ch); + *outpos = ch; + outpos += 1; inpos += 2; + } + + return outpos - s; +} + +static VTermModifier strpe_modifiers(char **strp) +{ + VTermModifier state = 0; + + while((*strp)[0]) { + switch(((*strp)++)[0]) { + case 'S': state |= VTERM_MOD_SHIFT; break; + case 'C': state |= VTERM_MOD_CTRL; break; + case 'A': state |= VTERM_MOD_ALT; break; + default: return state; + } + } + + return state; +} + +static VTermKey strp_key(char *str) +{ + static struct { + char *name; + VTermKey key; + } keys[] = { + { "Up", VTERM_KEY_UP }, + { "Tab", VTERM_KEY_TAB }, + { "Enter", VTERM_KEY_ENTER }, + { "KP0", VTERM_KEY_KP_0 }, + { NULL, VTERM_KEY_NONE }, + }; + int i; + + for(i = 0; keys[i].name; i++) { + if(streq(str, keys[i].name)) + return keys[i].key; + } + + return VTERM_KEY_NONE; +} + +static VTerm *vt; +static VTermState *state; +static VTermScreen *screen; + +static VTermEncodingInstance encoding; + +static int parser_text(const char bytes[], size_t len, void *user) +{ + int i; + + printf("text "); + for(i = 0; i < len; i++) { + unsigned char b = bytes[i]; + if(b < 0x20 || b == 0x7f || (b >= 0x80 && b < 0xa0)) + break; + printf(i ? ",%x" : "%x", b); + } + printf("\n"); + + return i; +} + +static int parser_control(unsigned char control, void *user) +{ + printf("control %02x\n", control); + + return 1; +} + +static int parser_escape(const char bytes[], size_t len, void *user) +{ + int i; + + if(bytes[0] >= 0x20 && bytes[0] < 0x30) { + if(len < 2) + return -1; + len = 2; + } + else { + len = 1; + } + + printf("escape "); + for(i = 0; i < len; i++) + printf("%02x", bytes[i]); + printf("\n"); + + return len; +} + +static int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) +{ + int i; + printf("csi %02x", command); + + if(leader && leader[0]) { + printf(" L="); + for(i = 0; leader[i]; i++) + printf("%02x", leader[i]); + } + + for(i = 0; i < argcount; i++) { + char sep = i ? ',' : ' '; + + if(args[i] == CSI_ARG_MISSING) + printf("%c*", sep); + else + printf("%c%ld%s", sep, CSI_ARG(args[i]), CSI_ARG_HAS_MORE(args[i]) ? "+" : ""); + } + + if(intermed && intermed[0]) { + printf(" I="); + for(i = 0; intermed[i]; i++) + printf("%02x", intermed[i]); + } + + printf("\n"); + + return 1; +} + +static int parser_osc(const char *command, size_t cmdlen, void *user) +{ + int i; + printf("osc "); + for(i = 0; i < cmdlen; i++) + printf("%02x", command[i]); + printf("\n"); + + return 1; +} + +static int parser_dcs(const char *command, size_t cmdlen, void *user) +{ + int i; + printf("dcs "); + for(i = 0; i < cmdlen; i++) + printf("%02x", command[i]); + printf("\n"); + + return 1; +} + +static VTermParserCallbacks parser_cbs = { + parser_text, /* text */ + parser_control, /* control */ + parser_escape, /* escape */ + parser_csi, /* csi */ + parser_osc, /* osc */ + parser_dcs, /* dcs */ + NULL /* resize */ +}; + +/* These callbacks are shared by State and Screen */ + +static int want_movecursor = 0; +static VTermPos state_pos; +static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user) +{ + state_pos = pos; + + if(want_movecursor) + printf("movecursor %d,%d\n", pos.row, pos.col); + + return 1; +} + +static int want_scrollrect = 0; +static int scrollrect(VTermRect rect, int downward, int rightward, void *user) +{ + if(!want_scrollrect) + return 0; + + printf("scrollrect %d..%d,%d..%d => %+d,%+d\n", + rect.start_row, rect.end_row, rect.start_col, rect.end_col, + downward, rightward); + + return 1; +} + +static int want_moverect = 0; +static int moverect(VTermRect dest, VTermRect src, void *user) +{ + if(!want_moverect) + return 0; + + printf("moverect %d..%d,%d..%d -> %d..%d,%d..%d\n", + src.start_row, src.end_row, src.start_col, src.end_col, + dest.start_row, dest.end_row, dest.start_col, dest.end_col); + + return 1; +} + +static int want_settermprop = 0; +static int settermprop(VTermProp prop, VTermValue *val, void *user) +{ + VTermValueType type; + if(!want_settermprop) + return 1; + + type = vterm_get_prop_type(prop); + switch(type) { + case VTERM_VALUETYPE_BOOL: + printf("settermprop %d %s\n", prop, val->boolean ? "true" : "false"); + return 1; + case VTERM_VALUETYPE_INT: + printf("settermprop %d %d\n", prop, val->number); + return 1; + case VTERM_VALUETYPE_STRING: + printf("settermprop %d \"%s\"\n", prop, val->string); + return 1; + case VTERM_VALUETYPE_COLOR: + printf("settermprop %d rgb(%d,%d,%d)\n", prop, val->color.red, val->color.green, val->color.blue); + return 1; + + case VTERM_N_VALUETYPES: + return 0; + } + + return 0; +} + +/* These callbacks are for State */ + +static int want_state_putglyph = 0; +static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) +{ + int i; + if(!want_state_putglyph) + return 1; + + printf("putglyph "); + for(i = 0; info->chars[i]; i++) + printf(i ? ",%x" : "%x", info->chars[i]); + printf(" %d %d,%d", info->width, pos.row, pos.col); + if(info->protected_cell) + printf(" prot"); + if(info->dwl) + printf(" dwl"); + if(info->dhl) + printf(" dhl-%s", info->dhl == 1 ? "top" : info->dhl == 2 ? "bottom" : "?" ); + printf("\n"); + + return 1; +} + +static int want_state_erase = 0; +static int state_erase(VTermRect rect, int selective, void *user) +{ + if(!want_state_erase) + return 1; + + printf("erase %d..%d,%d..%d%s\n", + rect.start_row, rect.end_row, rect.start_col, rect.end_col, + selective ? " selective" : ""); + + return 1; +} + +static struct { + int bold; + int underline; + int italic; + int blink; + int reverse; + int strike; + int font; + VTermColor foreground; + VTermColor background; +} state_pen; +static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user) +{ + switch(attr) { + case VTERM_ATTR_BOLD: + state_pen.bold = val->boolean; + break; + case VTERM_ATTR_UNDERLINE: + state_pen.underline = val->number; + break; + case VTERM_ATTR_ITALIC: + state_pen.italic = val->boolean; + break; + case VTERM_ATTR_BLINK: + state_pen.blink = val->boolean; + break; + case VTERM_ATTR_REVERSE: + state_pen.reverse = val->boolean; + break; + case VTERM_ATTR_STRIKE: + state_pen.strike = val->boolean; + break; + case VTERM_ATTR_FONT: + state_pen.font = val->number; + break; + case VTERM_ATTR_FOREGROUND: + state_pen.foreground = val->color; + break; + case VTERM_ATTR_BACKGROUND: + state_pen.background = val->color; + break; + + case VTERM_N_ATTRS: + return 0; + } + + return 1; +} + +static int state_setlineinfo(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user) +{ + return 1; +} + +VTermStateCallbacks state_cbs = { + state_putglyph, /* putglyph */ + movecursor, /* movecursor */ + scrollrect, /* scrollrect */ + moverect, /* moverect */ + state_erase, /* erase */ + NULL, /* initpen */ + state_setpenattr, /* setpenattr */ + settermprop, /* settermprop */ + NULL, /* bell */ + NULL, /* resize */ + state_setlineinfo, /* setlineinfo */ +}; + +static int want_screen_damage = 0; +static int want_screen_damage_cells = 0; +static int screen_damage(VTermRect rect, void *user) +{ + if(!want_screen_damage) + return 1; + + printf("damage %d..%d,%d..%d", + rect.start_row, rect.end_row, rect.start_col, rect.end_col); + + if(want_screen_damage_cells) { + int equals = FALSE; + int row; + int col; + + for(row = rect.start_row; row < rect.end_row; row++) { + int eol = rect.end_col; + while(eol > rect.start_col) { + VTermScreenCell cell; + VTermPos pos; + pos.row = row; + pos.col = eol-1; + vterm_screen_get_cell(screen, pos, &cell); + if(cell.chars[0]) + break; + + eol--; + } + + if(eol == rect.start_col) + break; + + if(!equals) + printf(" ="), equals = TRUE; + + printf(" %d<", row); + for(col = rect.start_col; col < eol; col++) { + VTermScreenCell cell; + VTermPos pos; + pos.row = row; + pos.col = col; + vterm_screen_get_cell(screen, pos, &cell); + printf(col == rect.start_col ? "%02X" : " %02X", cell.chars[0]); + } + printf(">"); + } + } + + printf("\n"); + + return 1; +} + +static int want_screen_scrollback = 0; +static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user) +{ + int eol; + int c; + + if(!want_screen_scrollback) + return 1; + + eol = cols; + while(eol && !cells[eol-1].chars[0]) + eol--; + + printf("sb_pushline %d =", cols); + for(c = 0; c < eol; c++) + printf(" %02X", cells[c].chars[0]); + printf("\n"); + + return 1; +} + +static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user) +{ + int col; + + if(!want_screen_scrollback) + return 0; + + /* All lines of scrollback contain "ABCDE" */ + for(col = 0; col < cols; col++) { + if(col < 5) + cells[col].chars[0] = 'A' + col; + else + cells[col].chars[0] = 0; + + cells[col].width = 1; + } + + printf("sb_popline %d\n", cols); + return 1; +} + +VTermScreenCallbacks screen_cbs = { + screen_damage, /* damage */ + moverect, /* moverect */ + movecursor, /* movecursor */ + settermprop, /* settermprop */ + NULL, /* bell */ + NULL, /* resize */ + screen_sb_pushline, /* sb_pushline */ + screen_sb_popline /* sb_popline */ +}; + +int main(int argc, char **argv) +{ + char line[1024] = {0}; + int flag; + + int err; + + setvbuf(stdout, NULL, _IONBF, 0); + + while(fgets(line, sizeof line, stdin)) { + char *nl; + size_t outlen; + err = 0; + + if((nl = strchr(line, '\n'))) + *nl = '\0'; + + if(streq(line, "INIT")) { + if(!vt) + vt = vterm_new(25, 80); + } + + else if(streq(line, "WANTPARSER")) { + vterm_parser_set_callbacks(vt, &parser_cbs, NULL); + } + + else if(strstartswith(line, "WANTSTATE") && (line[9] == '\0' || line[9] == ' ')) { + int i = 9; + int sense = 1; + if(!state) { + state = vterm_obtain_state(vt); + vterm_state_set_callbacks(state, &state_cbs, NULL); + vterm_state_set_bold_highbright(state, 1); + vterm_state_reset(state, 1); + } + + while(line[i] == ' ') + i++; + for( ; line[i]; i++) + switch(line[i]) { + case '+': + sense = 1; + break; + case '-': + sense = 0; + break; + case 'g': + want_state_putglyph = sense; + break; + case 's': + want_scrollrect = sense; + break; + case 'm': + want_moverect = sense; + break; + case 'e': + want_state_erase = sense; + break; + case 'p': + want_settermprop = sense; + break; + case 'f': + vterm_state_set_unrecognised_fallbacks(state, sense ? &parser_cbs : NULL, NULL); + break; + default: + fprintf(stderr, "Unrecognised WANTSTATE flag '%c'\n", line[i]); + } + } + + else if(strstartswith(line, "WANTSCREEN") && (line[10] == '\0' || line[10] == ' ')) { + int i = 10; + int sense = 1; + if(!screen) + screen = vterm_obtain_screen(vt); + vterm_screen_enable_altscreen(screen, 1); + vterm_screen_set_callbacks(screen, &screen_cbs, NULL); + + while(line[i] == ' ') + i++; + for( ; line[i]; i++) + switch(line[i]) { + case '-': + sense = 0; + break; + case 'd': + want_screen_damage = sense; + break; + case 'D': + want_screen_damage = sense; + want_screen_damage_cells = sense; + break; + case 'm': + want_moverect = sense; + break; + case 'c': + want_movecursor = sense; + break; + case 'p': + want_settermprop = 1; + break; + case 'b': + want_screen_scrollback = sense; + break; + default: + fprintf(stderr, "Unrecognised WANTSCREEN flag '%c'\n", line[i]); + } + } + + else if(sscanf(line, "UTF8 %d", &flag)) { + vterm_set_utf8(vt, flag); + } + + else if(streq(line, "RESET")) { + if(state) { + vterm_state_reset(state, 1); + vterm_state_get_cursorpos(state, &state_pos); + } + if(screen) { + vterm_screen_reset(screen, 1); + } + } + + else if(strstartswith(line, "RESIZE ")) { + int rows, cols; + char *linep = line + 7; + while(linep[0] == ' ') + linep++; + sscanf(linep, "%d, %d", &rows, &cols); + vterm_set_size(vt, rows, cols); + } + + else if(strstartswith(line, "PUSH ")) { + char *bytes = line + 5; + size_t len = inplace_hex2bytes(bytes); + size_t written = vterm_input_write(vt, bytes, len); + if(written < len) + fprintf(stderr, "! short write\n"); + } + + else if(streq(line, "WANTENCODING")) { + /* This isn't really external API but it's hard to get this out any + * other way + */ + encoding.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); + if(encoding.enc->init) + (*encoding.enc->init)(encoding.enc, encoding.data); + } + + else if(strstartswith(line, "ENCIN ")) { + char *bytes = line + 6; + size_t len = inplace_hex2bytes(bytes); + + uint32_t cp[1024]; + int cpi = 0; + size_t pos = 0; + + (*encoding.enc->decode)(encoding.enc, encoding.data, + cp, &cpi, len, bytes, &pos, len); + + if(cpi > 0) { + int i; + printf("encout "); + for(i = 0; i < cpi; i++) { + printf(i ? ",%x" : "%x", cp[i]); + } + printf("\n"); + } + } + + else if(strstartswith(line, "INCHAR ")) { + char *linep = line + 7; + unsigned int c = 0; + VTermModifier mod; + while(linep[0] == ' ') + linep++; + mod = strpe_modifiers(&linep); + sscanf(linep, " %x", &c); + + vterm_keyboard_unichar(vt, c, mod); + } + + else if(strstartswith(line, "INKEY ")) { + VTermModifier mod; + VTermKey key; + char *linep = line + 6; + while(linep[0] == ' ') + linep++; + mod = strpe_modifiers(&linep); + while(linep[0] == ' ') + linep++; + key = strp_key(linep); + + vterm_keyboard_key(vt, key, mod); + } + + else if(strstartswith(line, "PASTE ")) { + char *linep = line + 6; + if(streq(linep, "START")) + vterm_keyboard_start_paste(vt); + else if(streq(linep, "END")) + vterm_keyboard_end_paste(vt); + else + goto abort_line; + } + + else if(strstartswith(line, "FOCUS ")) { + char *linep = line + 6; + if(streq(linep, "IN")) + vterm_state_focus_in(state); + else if(streq(linep, "OUT")) + vterm_state_focus_out(state); + else + goto abort_line; + } + + else if(strstartswith(line, "MOUSEMOVE ")) { + char *linep = line + 10; + int row, col, len; + VTermModifier mod; + while(linep[0] == ' ') + linep++; + sscanf(linep, "%d,%d%n", &row, &col, &len); + linep += len; + while(linep[0] == ' ') + linep++; + mod = strpe_modifiers(&linep); + vterm_mouse_move(vt, row, col, mod); + } + + else if(strstartswith(line, "MOUSEBTN ")) { + char *linep = line + 9; + char press; + int button, len; + VTermModifier mod; + while(linep[0] == ' ') + linep++; + sscanf(linep, "%c %d%n", &press, &button, &len); + linep += len; + while(linep[0] == ' ') + linep++; + mod = strpe_modifiers(&linep); + vterm_mouse_button(vt, button, (press == 'd' || press == 'D'), mod); + } + + else if(strstartswith(line, "DAMAGEMERGE ")) { + char *linep = line + 12; + while(linep[0] == ' ') + linep++; + if(streq(linep, "CELL")) + vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_CELL); + else if(streq(linep, "ROW")) + vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_ROW); + else if(streq(linep, "SCREEN")) + vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_SCREEN); + else if(streq(linep, "SCROLL")) + vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_SCROLL); + } + + else if(strstartswith(line, "DAMAGEFLUSH")) { + vterm_screen_flush_damage(screen); + } + + else if(line[0] == '?') { + if(streq(line, "?cursor")) { + VTermPos pos; + vterm_state_get_cursorpos(state, &pos); + if(pos.row != state_pos.row) + printf("! row mismatch: state=%d,%d event=%d,%d\n", + pos.row, pos.col, state_pos.row, state_pos.col); + else if(pos.col != state_pos.col) + printf("! col mismatch: state=%d,%d event=%d,%d\n", + pos.row, pos.col, state_pos.row, state_pos.col); + else + printf("%d,%d\n", state_pos.row, state_pos.col); + } + else if(strstartswith(line, "?pen ")) { + VTermValue val; + char *linep = line + 5; + while(linep[0] == ' ') + linep++; + +#define BOOLSTR(v) ((v) ? "on" : "off") + + if(streq(linep, "bold")) { + vterm_state_get_penattr(state, VTERM_ATTR_BOLD, &val); + if(val.boolean != state_pen.bold) + printf("! pen bold mismatch; state=%s, event=%s\n", + BOOLSTR(val.boolean), BOOLSTR(state_pen.bold)); + else + printf("%s\n", BOOLSTR(state_pen.bold)); + } + else if(streq(linep, "underline")) { + vterm_state_get_penattr(state, VTERM_ATTR_UNDERLINE, &val); + if(val.boolean != state_pen.underline) + printf("! pen underline mismatch; state=%d, event=%d\n", + val.boolean, state_pen.underline); + else + printf("%d\n", state_pen.underline); + } + else if(streq(linep, "italic")) { + vterm_state_get_penattr(state, VTERM_ATTR_ITALIC, &val); + if(val.boolean != state_pen.italic) + printf("! pen italic mismatch; state=%s, event=%s\n", + BOOLSTR(val.boolean), BOOLSTR(state_pen.italic)); + else + printf("%s\n", BOOLSTR(state_pen.italic)); + } + else if(streq(linep, "blink")) { + vterm_state_get_penattr(state, VTERM_ATTR_BLINK, &val); + if(val.boolean != state_pen.blink) + printf("! pen blink mismatch; state=%s, event=%s\n", + BOOLSTR(val.boolean), BOOLSTR(state_pen.blink)); + else + printf("%s\n", BOOLSTR(state_pen.blink)); + } + else if(streq(linep, "reverse")) { + vterm_state_get_penattr(state, VTERM_ATTR_REVERSE, &val); + if(val.boolean != state_pen.reverse) + printf("! pen reverse mismatch; state=%s, event=%s\n", + BOOLSTR(val.boolean), BOOLSTR(state_pen.reverse)); + else + printf("%s\n", BOOLSTR(state_pen.reverse)); + } + else if(streq(linep, "font")) { + vterm_state_get_penattr(state, VTERM_ATTR_FONT, &val); + if(val.boolean != state_pen.font) + printf("! pen font mismatch; state=%d, event=%d\n", + val.boolean, state_pen.font); + else + printf("%d\n", state_pen.font); + } + else if(streq(linep, "foreground")) { + printf("rgb(%d,%d,%d)\n", state_pen.foreground.red, state_pen.foreground.green, state_pen.foreground.blue); + } + else if(streq(linep, "background")) { + printf("rgb(%d,%d,%d)\n", state_pen.background.red, state_pen.background.green, state_pen.background.blue); + } + else + printf("?\n"); + } + else if(strstartswith(line, "?screen_chars ")) { + char *linep = line + 13; + VTermRect rect; + size_t len; + while(linep[0] == ' ') + linep++; + if(sscanf(linep, "%d,%d,%d,%d", &rect.start_row, &rect.start_col, &rect.end_row, &rect.end_col) < 4) { + printf("! screen_chars unrecognised input\n"); + goto abort_line; + } + len = vterm_screen_get_chars(screen, NULL, 0, rect); + if(len == (size_t)-1) + printf("! screen_chars error\n"); + else if(len == 0) + printf("\n"); + else { + uint32_t *chars = malloc(sizeof(uint32_t) * len); + size_t i; + vterm_screen_get_chars(screen, chars, len, rect); + for(i = 0; i < len; i++) { + printf("0x%02x%s", chars[i], i < len-1 ? "," : "\n"); + } + free(chars); + } + } + else if(strstartswith(line, "?screen_text ")) { + char *linep = line + 12; + VTermRect rect; + size_t len; + while(linep[0] == ' ') + linep++; + if(sscanf(linep, "%d,%d,%d,%d", &rect.start_row, &rect.start_col, &rect.end_row, &rect.end_col) < 4) { + printf("! screen_text unrecognised input\n"); + goto abort_line; + } + len = vterm_screen_get_text(screen, NULL, 0, rect); + if(len == (size_t)-1) + printf("! screen_text error\n"); + else if(len == 0) + printf("\n"); + else { + /* Put an overwrite guard at both ends of the buffer */ + unsigned char *buffer = malloc(len + 4); + unsigned char *text = buffer + 2; + text[-2] = 0x55; text[-1] = 0xAA; + text[len] = 0x55; text[len+1] = 0xAA; + + vterm_screen_get_text(screen, (char *)text, len, rect); + + if(text[-2] != 0x55 || text[-1] != 0xAA) + printf("! screen_get_text buffer overrun left [%02x,%02x]\n", text[-2], text[-1]); + else if(text[len] != 0x55 || text[len+1] != 0xAA) + printf("! screen_get_text buffer overrun right [%02x,%02x]\n", text[len], text[len+1]); + else + { + size_t i; + for(i = 0; i < len; i++) { + printf("0x%02x%s", text[i], i < len-1 ? "," : "\n"); + } + } + + free(buffer); + } + } + else if(strstartswith(line, "?screen_cell ")) { + char *linep = line + 12; + int i; + VTermPos pos; + VTermScreenCell cell; + while(linep[0] == ' ') + linep++; + if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { + printf("! screen_cell unrecognised input\n"); + goto abort_line; + } + if(!vterm_screen_get_cell(screen, pos, &cell)) + goto abort_line; + printf("{"); + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell.chars[i]; i++) { + printf("%s0x%x", i ? "," : "", cell.chars[i]); + } + printf("} width=%d attrs={", cell.width); + if(cell.attrs.bold) printf("B"); + if(cell.attrs.underline) printf("U%d", cell.attrs.underline); + if(cell.attrs.italic) printf("I"); + if(cell.attrs.blink) printf("K"); + if(cell.attrs.reverse) printf("R"); + if(cell.attrs.font) printf("F%d", cell.attrs.font); + printf("} "); + if(cell.attrs.dwl) printf("dwl "); + if(cell.attrs.dhl) printf("dhl-%s ", cell.attrs.dhl == 2 ? "bottom" : "top"); + printf("fg=rgb(%d,%d,%d) ", cell.fg.red, cell.fg.green, cell.fg.blue); + printf("bg=rgb(%d,%d,%d)\n", cell.bg.red, cell.bg.green, cell.bg.blue); + } + else if(strstartswith(line, "?screen_eol ")) { + VTermPos pos; + char *linep = line + 12; + while(linep[0] == ' ') + linep++; + if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { + printf("! screen_eol unrecognised input\n"); + goto abort_line; + } + printf("%d\n", vterm_screen_is_eol(screen, pos)); + } + else if(strstartswith(line, "?screen_attrs_extent ")) { + VTermPos pos; + VTermRect rect; + char *linep = line + 21; + while(linep[0] == ' ') + linep++; + if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { + printf("! screen_attrs_extent unrecognised input\n"); + goto abort_line; + } + rect.start_col = 0; + rect.end_col = -1; + if(!vterm_screen_get_attrs_extent(screen, &rect, pos, ~0)) { + printf("! screen_attrs_extent failed\n"); + goto abort_line; + } + printf("%d,%d-%d,%d\n", rect.start_row, rect.start_col, rect.end_row, rect.end_col); + } + else + printf("?\n"); + + memset(line, 0, sizeof line); + continue; + } + + else + abort_line: err = 1; + + outlen = vterm_output_get_buffer_current(vt); + if(outlen > 0) { + int i; + char outbuff[1024]; + vterm_output_read(vt, outbuff, outlen); + + printf("output "); + for(i = 0; i < outlen; i++) + printf("%x%s", (unsigned char)outbuff[i], i < outlen-1 ? "," : "\n"); + } + + printf(err ? "?\n" : "DONE\n"); + } + + vterm_free(vt); + + return 0; +} diff --git a/src/libvterm/t/run-test.pl b/src/libvterm/t/run-test.pl new file mode 100644 index 0000000000..4ef0f26d47 --- /dev/null +++ b/src/libvterm/t/run-test.pl @@ -0,0 +1,196 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Getopt::Long; +use IO::Handle; +use IPC::Open2 qw( open2 ); +use POSIX qw( WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG ); + +my $VALGRIND = 0; +GetOptions( + 'valgrind|v+' => \$VALGRIND, +) or exit 1; + +my ( $hin, $hout, $hpid ); +{ + local $ENV{LD_LIBRARY_PATH} = ".libs"; + my @command = "t/.libs/harness"; + unshift @command, "valgrind", "--quiet", "--error-exitcode=126" if $VALGRIND; + + $hpid = open2 $hout, $hin, @command or die "Cannot open2 harness - $!"; +} + +my $exitcode = 0; + +my $command; +my @expect; + +sub do_onetest +{ + $hin->print( "$command\n" ); + undef $command; + + my $fail_printed = 0; + + while( my $outline = <$hout> ) { + last if $outline eq "DONE\n" or $outline eq "?\n"; + + chomp $outline; + + if( !@expect ) { + print "# Test failed\n" unless $fail_printed++; + print "# expected nothing more\n" . + "# Actual: $outline\n"; + next; + } + + my $expectation = shift @expect; + + next if $expectation eq $outline; + + print "# Test failed\n" unless $fail_printed++; + print "# Expected: $expectation\n" . + "# Actual: $outline\n"; + } + + if( @expect ) { + print "# Test failed\n" unless $fail_printed++; + print "# Expected: $_\n" . + "# didn't happen\n" for @expect; + } + + $exitcode = 1 if $fail_printed; +} + +sub do_line +{ + my ( $line ) = @_; + + if( $line =~ m/^!(.*)/ ) { + do_onetest if defined $command; + print "> $1\n"; + } + + # Commands have capitals + elsif( $line =~ m/^([A-Z]+)/ ) { + # Some convenience formatting + if( $line =~ m/^(PUSH|ENCIN) (.*)$/ ) { + # we're evil + my $string = eval($2); + $line = "$1 " . unpack "H*", $string; + } + + do_onetest if defined $command; + + $command = $line; + undef @expect; + } + # Expectations have lowercase + elsif( $line =~ m/^([a-z]+)/ ) { + # Convenience formatting + if( $line =~ m/^(text|encout) (.*)$/ ) { + $line = "$1 " . join ",", map sprintf("%x", $_), eval($2); + } + elsif( $line =~ m/^(output) (.*)$/ ) { + $line = "$1 " . join ",", map sprintf("%x", $_), unpack "C*", eval($2); + } + elsif( $line =~ m/^control (.*)$/ ) { + $line = sprintf "control %02x", eval($1); + } + elsif( $line =~ m/^csi (\S+) (.*)$/ ) { + $line = sprintf "csi %02x %s", eval($1), $2; # TODO + } + elsif( $line =~ m/^(escape|osc|dcs) (.*)$/ ) { + $line = "$1 " . join "", map sprintf("%02x", $_), unpack "C*", eval($2); + } + elsif( $line =~ m/^putglyph (\S+) (.*)$/ ) { + $line = "putglyph " . join( ",", map sprintf("%x", $_), eval($1) ) . " $2"; + } + elsif( $line =~ m/^(?:movecursor|scrollrect|moverect|erase|damage|sb_pushline|sb_popline|settermprop|setmousefunc) / ) { + # no conversion + } + else { + warn "Unrecognised test expectation '$line'\n"; + } + + push @expect, $line; + } + # ?screen_row assertion is emulated here + elsif( $line =~ s/^\?screen_row\s+(\d+)\s*=\s*// ) { + my $row = $1; + my $row1 = $row + 1; + my $want = eval($line); + + do_onetest if defined $command; + + # TODO: may not be 80 + $hin->print( "\?screen_chars $row,0,$row1,80\n" ); + my $response = <$hout>; + chomp $response; + + $response = pack "C*", map hex, split m/,/, $response; + if( $response ne $want ) { + print "# Assert ?screen_row $row failed:\n" . + "# Expected: $want\n" . + "# Actual: $response\n"; + $exitcode = 1; + } + } + # Assertions start with '?' + elsif( $line =~ s/^\?([a-z]+.*?=)\s+// ) { + do_onetest if defined $command; + + my ( $assertion ) = $1 =~ m/^(.*)\s+=/; + + $hin->print( "\?$assertion\n" ); + my $response = <$hout>; defined $response or wait, die "Test harness failed - $?\n"; + chomp $response; + + if( $response ne $line ) { + print "# Assert $assertion failed:\n" . + "# Expected: $line\n" . + "# Actual: $response\n"; + $exitcode = 1; + } + } + # Test controls start with '$' + elsif( $line =~ s/\$SEQ\s+(\d+)\s+(\d+):\s*// ) { + my ( $low, $high ) = ( $1, $2 ); + foreach my $val ( $low .. $high ) { + ( my $inner = $line ) =~ s/\\#/$val/g; + do_line( $inner ); + } + } + elsif( $line =~ s/\$REP\s+(\d+):\s*// ) { + my $count = $1; + do_line( $line ) for 1 .. $count; + } + else { + die "Unrecognised TEST line $line\n"; + } +} + +open my $test, "<", $ARGV[0] or die "Cannot open test script $ARGV[0] - $!"; + +while( my $line = <$test> ) { + $line =~ s/^\s+//; + next if $line =~ m/^(?:#|$)/; + + chomp $line; + do_line( $line ); +} + +do_onetest if defined $command; + +close $hin; +close $hout; + +waitpid $hpid, 0; +if( $? ) { + printf STDERR "Harness exited %d\n", WEXITSTATUS($?) if WIFEXITED($?); + printf STDERR "Harness exit signal %d\n", WTERMSIG($?) if WIFSIGNALED($?); + $exitcode = WIFEXITED($?) ? WEXITSTATUS($?) : 125; +} + +exit $exitcode; diff --git a/src/libvterm/tbl2inc_c.pl b/src/libvterm/tbl2inc_c.pl new file mode 100644 index 0000000000..527fc9829f --- /dev/null +++ b/src/libvterm/tbl2inc_c.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my ( $encname ) = $ARGV[0] =~ m{/([^/.]+).tbl} + or die "Cannot parse encoding name out of $ARGV[0]\n"; + +print <<"EOF"; +static const struct StaticTableEncoding encoding_$encname = { + { + NULL, /* init */ + &decode_table /* decode */ + }, + { +EOF + +my $row = 0; +while( <> ) { + s/\s*#.*//; # strip comment + + if ($_ =~ m{^\d+/\d+}) { + my ($up, $low) = ($_ =~ m{^(\d+)/(\d+)}); + my $thisrow = $up * 16 + $low; + while ($row < $thisrow) { + print " 0x0, /* $row */\n"; + ++$row; + } + } + + s{^(\d+)/(\d+)}{""}e; # Remove 3/1 + s{ = }{""}e; # Remove " = " + s{"(.)"}{sprintf "0x%04x", ord $1}e; # Convert "A" to 0x41 + s{U\+}{0x}; # Convert U+0041 to 0x0041 + + s{$}{, /* $row */}; # append comma and index + + print " $_"; + + ++$row; +} + +while ($row < 128) { + print " 0x0, /* $row */\n"; + ++$row; +} + +print <<"EOF"; + } +}; +EOF diff --git a/src/libvterm/vterm.pc.in b/src/libvterm/vterm.pc.in new file mode 100644 index 0000000000..c64c72ddfc --- /dev/null +++ b/src/libvterm/vterm.pc.in @@ -0,0 +1,9 @@ +prefix=@PREFIX@ +libdir=@LIBDIR@ +includedir=${prefix}/include + +Name: vterm +Description: Abstract VT220/Xterm/ECMA-48 emulation library +Version: @VERSION@ +Libs: -L${libdir} -lvterm +Cflags: -I${includedir} diff --git a/src/list.c b/src/list.c new file mode 100644 index 0000000000..1dfaa210e6 --- /dev/null +++ b/src/list.c @@ -0,0 +1,985 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * list.c: List support + */ + +#include "vim.h" + +#if defined(FEAT_EVAL) || defined(PROTO) + +/* List heads for garbage collection. */ +static list_T *first_list = NULL; /* list of all lists */ + +/* + * Add a watcher to a list. + */ + void +list_add_watch(list_T *l, listwatch_T *lw) +{ + lw->lw_next = l->lv_watch; + l->lv_watch = lw; +} + +/* + * Remove a watcher from a list. + * No warning when it isn't found... + */ + void +list_rem_watch(list_T *l, listwatch_T *lwrem) +{ + listwatch_T *lw, **lwp; + + lwp = &l->lv_watch; + for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next) + { + if (lw == lwrem) + { + *lwp = lw->lw_next; + break; + } + lwp = &lw->lw_next; + } +} + +/* + * Just before removing an item from a list: advance watchers to the next + * item. + */ + void +list_fix_watch(list_T *l, listitem_T *item) +{ + listwatch_T *lw; + + for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next) + if (lw->lw_item == item) + lw->lw_item = item->li_next; +} + +/* + * Allocate an empty header for a list. + * Caller should take care of the reference count. + */ + list_T * +list_alloc(void) +{ + list_T *l; + + l = (list_T *)alloc_clear(sizeof(list_T)); + if (l != NULL) + { + /* Prepend the list to the list of lists for garbage collection. */ + if (first_list != NULL) + first_list->lv_used_prev = l; + l->lv_used_prev = NULL; + l->lv_used_next = first_list; + first_list = l; + } + return l; +} + +/* + * Allocate an empty list for a return value, with reference count set. + * Returns OK or FAIL. + */ + int +rettv_list_alloc(typval_T *rettv) +{ + list_T *l = list_alloc(); + + if (l == NULL) + return FAIL; + + rettv->v_lock = 0; + rettv_list_set(rettv, l); + return OK; +} + +/* + * Set a list as the return value + */ + void +rettv_list_set(typval_T *rettv, list_T *l) +{ + rettv->v_type = VAR_LIST; + rettv->vval.v_list = l; + if (l != NULL) + ++l->lv_refcount; +} + +/* + * Unreference a list: decrement the reference count and free it when it + * becomes zero. + */ + void +list_unref(list_T *l) +{ + if (l != NULL && --l->lv_refcount <= 0) + list_free(l); +} + +/* + * Free a list, including all non-container items it points to. + * Ignores the reference count. + */ + static void +list_free_contents(list_T *l) +{ + listitem_T *item; + + for (item = l->lv_first; item != NULL; item = l->lv_first) + { + /* Remove the item before deleting it. */ + l->lv_first = item->li_next; + clear_tv(&item->li_tv); + vim_free(item); + } +} + +/* + * Go through the list of lists and free items without the copyID. + * But don't free a list that has a watcher (used in a for loop), these + * are not referenced anywhere. + */ + int +list_free_nonref(int copyID) +{ + list_T *ll; + int did_free = FALSE; + + for (ll = first_list; ll != NULL; ll = ll->lv_used_next) + if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK) + && ll->lv_watch == NULL) + { + /* Free the List and ordinary items it contains, but don't recurse + * into Lists and Dictionaries, they will be in the list of dicts + * or list of lists. */ + list_free_contents(ll); + did_free = TRUE; + } + return did_free; +} + + static void +list_free_list(list_T *l) +{ + /* Remove the list from the list of lists for garbage collection. */ + if (l->lv_used_prev == NULL) + first_list = l->lv_used_next; + else + l->lv_used_prev->lv_used_next = l->lv_used_next; + if (l->lv_used_next != NULL) + l->lv_used_next->lv_used_prev = l->lv_used_prev; + + vim_free(l); +} + + void +list_free_items(int copyID) +{ + list_T *ll, *ll_next; + + for (ll = first_list; ll != NULL; ll = ll_next) + { + ll_next = ll->lv_used_next; + if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK) + && ll->lv_watch == NULL) + { + /* Free the List and ordinary items it contains, but don't recurse + * into Lists and Dictionaries, they will be in the list of dicts + * or list of lists. */ + list_free_list(ll); + } + } +} + + void +list_free(list_T *l) +{ + if (!in_free_unref_items) + { + list_free_contents(l); + list_free_list(l); + } +} + +/* + * Allocate a list item. + * It is not initialized, don't forget to set v_lock. + */ + listitem_T * +listitem_alloc(void) +{ + return (listitem_T *)alloc(sizeof(listitem_T)); +} + +/* + * Free a list item. Also clears the value. Does not notify watchers. + */ + void +listitem_free(listitem_T *item) +{ + clear_tv(&item->li_tv); + vim_free(item); +} + +/* + * Remove a list item from a List and free it. Also clears the value. + */ + void +listitem_remove(list_T *l, listitem_T *item) +{ + vimlist_remove(l, item, item); + listitem_free(item); +} + +/* + * Get the number of items in a list. + */ + long +list_len(list_T *l) +{ + if (l == NULL) + return 0L; + return l->lv_len; +} + +/* + * Return TRUE when two lists have exactly the same values. + */ + int +list_equal( + list_T *l1, + list_T *l2, + int ic, /* ignore case for strings */ + int recursive) /* TRUE when used recursively */ +{ + listitem_T *item1, *item2; + + if (l1 == NULL || l2 == NULL) + return FALSE; + if (l1 == l2) + return TRUE; + if (list_len(l1) != list_len(l2)) + return FALSE; + + for (item1 = l1->lv_first, item2 = l2->lv_first; + item1 != NULL && item2 != NULL; + item1 = item1->li_next, item2 = item2->li_next) + if (!tv_equal(&item1->li_tv, &item2->li_tv, ic, recursive)) + return FALSE; + return item1 == NULL && item2 == NULL; +} + +/* + * Locate item with index "n" in list "l" and return it. + * A negative index is counted from the end; -1 is the last item. + * Returns NULL when "n" is out of range. + */ + listitem_T * +list_find(list_T *l, long n) +{ + listitem_T *item; + long idx; + + if (l == NULL) + return NULL; + + /* Negative index is relative to the end. */ + if (n < 0) + n = l->lv_len + n; + + /* Check for index out of range. */ + if (n < 0 || n >= l->lv_len) + return NULL; + + /* When there is a cached index may start search from there. */ + if (l->lv_idx_item != NULL) + { + if (n < l->lv_idx / 2) + { + /* closest to the start of the list */ + item = l->lv_first; + idx = 0; + } + else if (n > (l->lv_idx + l->lv_len) / 2) + { + /* closest to the end of the list */ + item = l->lv_last; + idx = l->lv_len - 1; + } + else + { + /* closest to the cached index */ + item = l->lv_idx_item; + idx = l->lv_idx; + } + } + else + { + if (n < l->lv_len / 2) + { + /* closest to the start of the list */ + item = l->lv_first; + idx = 0; + } + else + { + /* closest to the end of the list */ + item = l->lv_last; + idx = l->lv_len - 1; + } + } + + while (n > idx) + { + /* search forward */ + item = item->li_next; + ++idx; + } + while (n < idx) + { + /* search backward */ + item = item->li_prev; + --idx; + } + + /* cache the used index */ + l->lv_idx = idx; + l->lv_idx_item = item; + + return item; +} + +/* + * Get list item "l[idx]" as a number. + */ + long +list_find_nr( + list_T *l, + long idx, + int *errorp) /* set to TRUE when something wrong */ +{ + listitem_T *li; + + li = list_find(l, idx); + if (li == NULL) + { + if (errorp != NULL) + *errorp = TRUE; + return -1L; + } + return (long)get_tv_number_chk(&li->li_tv, errorp); +} + +/* + * Get list item "l[idx - 1]" as a string. Returns NULL for failure. + */ + char_u * +list_find_str(list_T *l, long idx) +{ + listitem_T *li; + + li = list_find(l, idx - 1); + if (li == NULL) + { + EMSGN(_(e_listidx), idx); + return NULL; + } + return get_tv_string(&li->li_tv); +} + +/* + * Locate "item" list "l" and return its index. + * Returns -1 when "item" is not in the list. + */ + long +list_idx_of_item(list_T *l, listitem_T *item) +{ + long idx = 0; + listitem_T *li; + + if (l == NULL) + return -1; + idx = 0; + for (li = l->lv_first; li != NULL && li != item; li = li->li_next) + ++idx; + if (li == NULL) + return -1; + return idx; +} + +/* + * Append item "item" to the end of list "l". + */ + void +list_append(list_T *l, listitem_T *item) +{ + if (l->lv_last == NULL) + { + /* empty list */ + l->lv_first = item; + l->lv_last = item; + item->li_prev = NULL; + } + else + { + l->lv_last->li_next = item; + item->li_prev = l->lv_last; + l->lv_last = item; + } + ++l->lv_len; + item->li_next = NULL; +} + +/* + * Append typval_T "tv" to the end of list "l". + * Return FAIL when out of memory. + */ + int +list_append_tv(list_T *l, typval_T *tv) +{ + listitem_T *li = listitem_alloc(); + + if (li == NULL) + return FAIL; + copy_tv(tv, &li->li_tv); + list_append(l, li); + return OK; +} + +/* + * Add a dictionary to a list. Used by getqflist(). + * Return FAIL when out of memory. + */ + int +list_append_dict(list_T *list, dict_T *dict) +{ + listitem_T *li = listitem_alloc(); + + if (li == NULL) + return FAIL; + li->li_tv.v_type = VAR_DICT; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_dict = dict; + list_append(list, li); + ++dict->dv_refcount; + return OK; +} + +/* + * Append list2 to list1. + * Return FAIL when out of memory. + */ + int +list_append_list(list1, list2) + list_T *list1; + list_T *list2; +{ + listitem_T *li = listitem_alloc(); + + if (li == NULL) + return FAIL; + li->li_tv.v_type = VAR_LIST; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_list = list2; + list_append(list1, li); + ++list2->lv_refcount; + return OK; +} + +/* + * Make a copy of "str" and append it as an item to list "l". + * When "len" >= 0 use "str[len]". + * Returns FAIL when out of memory. + */ + int +list_append_string(list_T *l, char_u *str, int len) +{ + listitem_T *li = listitem_alloc(); + + if (li == NULL) + return FAIL; + list_append(l, li); + li->li_tv.v_type = VAR_STRING; + li->li_tv.v_lock = 0; + if (str == NULL) + li->li_tv.vval.v_string = NULL; + else if ((li->li_tv.vval.v_string = (len >= 0 ? vim_strnsave(str, len) + : vim_strsave(str))) == NULL) + return FAIL; + return OK; +} + +/* + * Append "n" to list "l". + * Returns FAIL when out of memory. + */ + int +list_append_number(list_T *l, varnumber_T n) +{ + listitem_T *li; + + li = listitem_alloc(); + if (li == NULL) + return FAIL; + li->li_tv.v_type = VAR_NUMBER; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_number = n; + list_append(l, li); + return OK; +} + +/* + * Insert typval_T "tv" in list "l" before "item". + * If "item" is NULL append at the end. + * Return FAIL when out of memory. + */ + int +list_insert_tv(list_T *l, typval_T *tv, listitem_T *item) +{ + listitem_T *ni = listitem_alloc(); + + if (ni == NULL) + return FAIL; + copy_tv(tv, &ni->li_tv); + list_insert(l, ni, item); + return OK; +} + + void +list_insert(list_T *l, listitem_T *ni, listitem_T *item) +{ + if (item == NULL) + /* Append new item at end of list. */ + list_append(l, ni); + else + { + /* Insert new item before existing item. */ + ni->li_prev = item->li_prev; + ni->li_next = item; + if (item->li_prev == NULL) + { + l->lv_first = ni; + ++l->lv_idx; + } + else + { + item->li_prev->li_next = ni; + l->lv_idx_item = NULL; + } + item->li_prev = ni; + ++l->lv_len; + } +} + +/* + * Extend "l1" with "l2". + * If "bef" is NULL append at the end, otherwise insert before this item. + * Returns FAIL when out of memory. + */ + int +list_extend(list_T *l1, list_T *l2, listitem_T *bef) +{ + listitem_T *item; + int todo = l2->lv_len; + + /* We also quit the loop when we have inserted the original item count of + * the list, avoid a hang when we extend a list with itself. */ + for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next) + if (list_insert_tv(l1, &item->li_tv, bef) == FAIL) + return FAIL; + return OK; +} + +/* + * Concatenate lists "l1" and "l2" into a new list, stored in "tv". + * Return FAIL when out of memory. + */ + int +list_concat(list_T *l1, list_T *l2, typval_T *tv) +{ + list_T *l; + + if (l1 == NULL || l2 == NULL) + return FAIL; + + /* make a copy of the first list. */ + l = list_copy(l1, FALSE, 0); + if (l == NULL) + return FAIL; + tv->v_type = VAR_LIST; + tv->vval.v_list = l; + + /* append all items from the second list */ + return list_extend(l, l2, NULL); +} + +/* + * Make a copy of list "orig". Shallow if "deep" is FALSE. + * The refcount of the new list is set to 1. + * See item_copy() for "copyID". + * Returns NULL when out of memory. + */ + list_T * +list_copy(list_T *orig, int deep, int copyID) +{ + list_T *copy; + listitem_T *item; + listitem_T *ni; + + if (orig == NULL) + return NULL; + + copy = list_alloc(); + if (copy != NULL) + { + if (copyID != 0) + { + /* Do this before adding the items, because one of the items may + * refer back to this list. */ + orig->lv_copyID = copyID; + orig->lv_copylist = copy; + } + for (item = orig->lv_first; item != NULL && !got_int; + item = item->li_next) + { + ni = listitem_alloc(); + if (ni == NULL) + break; + if (deep) + { + if (item_copy(&item->li_tv, &ni->li_tv, deep, copyID) == FAIL) + { + vim_free(ni); + break; + } + } + else + copy_tv(&item->li_tv, &ni->li_tv); + list_append(copy, ni); + } + ++copy->lv_refcount; + if (item != NULL) + { + list_unref(copy); + copy = NULL; + } + } + + return copy; +} + +/* + * Remove items "item" to "item2" from list "l". + * Does not free the listitem or the value! + * This used to be called list_remove, but that conflicts with a Sun header + * file. + */ + void +vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2) +{ + listitem_T *ip; + + /* notify watchers */ + for (ip = item; ip != NULL; ip = ip->li_next) + { + --l->lv_len; + list_fix_watch(l, ip); + if (ip == item2) + break; + } + + if (item2->li_next == NULL) + l->lv_last = item->li_prev; + else + item2->li_next->li_prev = item->li_prev; + if (item->li_prev == NULL) + l->lv_first = item2->li_next; + else + item->li_prev->li_next = item2->li_next; + l->lv_idx_item = NULL; +} + +/* + * Return an allocated string with the string representation of a list. + * May return NULL. + */ + char_u * +list2string(typval_T *tv, int copyID, int restore_copyID) +{ + garray_T ga; + + if (tv->vval.v_list == NULL) + return NULL; + ga_init2(&ga, (int)sizeof(char), 80); + ga_append(&ga, '['); + if (list_join(&ga, tv->vval.v_list, (char_u *)", ", + FALSE, restore_copyID, copyID) == FAIL) + { + vim_free(ga.ga_data); + return NULL; + } + ga_append(&ga, ']'); + ga_append(&ga, NUL); + return (char_u *)ga.ga_data; +} + +typedef struct join_S { + char_u *s; + char_u *tofree; +} join_T; + + static int +list_join_inner( + garray_T *gap, /* to store the result in */ + list_T *l, + char_u *sep, + int echo_style, + int restore_copyID, + int copyID, + garray_T *join_gap) /* to keep each list item string */ +{ + int i; + join_T *p; + int len; + int sumlen = 0; + int first = TRUE; + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + listitem_T *item; + char_u *s; + + /* Stringify each item in the list. */ + for (item = l->lv_first; item != NULL && !got_int; item = item->li_next) + { + s = echo_string_core(&item->li_tv, &tofree, numbuf, copyID, + echo_style, restore_copyID, !echo_style); + if (s == NULL) + return FAIL; + + len = (int)STRLEN(s); + sumlen += len; + + (void)ga_grow(join_gap, 1); + p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++); + if (tofree != NULL || s != numbuf) + { + p->s = s; + p->tofree = tofree; + } + else + { + p->s = vim_strnsave(s, len); + p->tofree = p->s; + } + + line_breakcheck(); + if (did_echo_string_emsg) /* recursion error, bail out */ + break; + } + + /* Allocate result buffer with its total size, avoid re-allocation and + * multiple copy operations. Add 2 for a tailing ']' and NUL. */ + if (join_gap->ga_len >= 2) + sumlen += (int)STRLEN(sep) * (join_gap->ga_len - 1); + if (ga_grow(gap, sumlen + 2) == FAIL) + return FAIL; + + for (i = 0; i < join_gap->ga_len && !got_int; ++i) + { + if (first) + first = FALSE; + else + ga_concat(gap, sep); + p = ((join_T *)join_gap->ga_data) + i; + + if (p->s != NULL) + ga_concat(gap, p->s); + line_breakcheck(); + } + + return OK; +} + +/* + * Join list "l" into a string in "*gap", using separator "sep". + * When "echo_style" is TRUE use String as echoed, otherwise as inside a List. + * Return FAIL or OK. + */ + int +list_join( + garray_T *gap, + list_T *l, + char_u *sep, + int echo_style, + int restore_copyID, + int copyID) +{ + garray_T join_ga; + int retval; + join_T *p; + int i; + + if (l->lv_len < 1) + return OK; /* nothing to do */ + ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len); + retval = list_join_inner(gap, l, sep, echo_style, restore_copyID, + copyID, &join_ga); + + /* Dispose each item in join_ga. */ + if (join_ga.ga_data != NULL) + { + p = (join_T *)join_ga.ga_data; + for (i = 0; i < join_ga.ga_len; ++i) + { + vim_free(p->tofree); + ++p; + } + ga_clear(&join_ga); + } + + return retval; +} + +/* + * Allocate a variable for a List and fill it from "*arg". + * Return OK or FAIL. + */ + int +get_list_tv(char_u **arg, typval_T *rettv, int evaluate) +{ + list_T *l = NULL; + typval_T tv; + listitem_T *item; + + if (evaluate) + { + l = list_alloc(); + if (l == NULL) + return FAIL; + } + + *arg = skipwhite(*arg + 1); + while (**arg != ']' && **arg != NUL) + { + if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ + goto failret; + if (evaluate) + { + item = listitem_alloc(); + if (item != NULL) + { + item->li_tv = tv; + item->li_tv.v_lock = 0; + list_append(l, item); + } + else + clear_tv(&tv); + } + + if (**arg == ']') + break; + if (**arg != ',') + { + EMSG2(_("E696: Missing comma in List: %s"), *arg); + goto failret; + } + *arg = skipwhite(*arg + 1); + } + + if (**arg != ']') + { + EMSG2(_("E697: Missing end of List ']': %s"), *arg); +failret: + if (evaluate) + list_free(l); + return FAIL; + } + + *arg = skipwhite(*arg + 1); + if (evaluate) + rettv_list_set(rettv, l); + + return OK; +} + +/* + * Write "list" of strings to file "fd". + */ + int +write_list(FILE *fd, list_T *list, int binary) +{ + listitem_T *li; + int c; + int ret = OK; + char_u *s; + + for (li = list->lv_first; li != NULL; li = li->li_next) + { + for (s = get_tv_string(&li->li_tv); *s != NUL; ++s) + { + if (*s == '\n') + c = putc(NUL, fd); + else + c = putc(*s, fd); + if (c == EOF) + { + ret = FAIL; + break; + } + } + if (!binary || li->li_next != NULL) + if (putc('\n', fd) == EOF) + { + ret = FAIL; + break; + } + if (ret == FAIL) + { + EMSG(_(e_write)); + break; + } + } + return ret; +} + +/* + * Initialize a static list with 10 items. + */ + void +init_static_list(staticList10_T *sl) +{ + list_T *l = &sl->sl_list; + int i; + + memset(sl, 0, sizeof(staticList10_T)); + l->lv_first = &sl->sl_items[0]; + l->lv_last = &sl->sl_items[9]; + l->lv_refcount = DO_NOT_FREE_CNT; + l->lv_lock = VAR_FIXED; + sl->sl_list.lv_len = 10; + + for (i = 0; i < 10; ++i) + { + listitem_T *li = &sl->sl_items[i]; + + if (i == 0) + li->li_prev = NULL; + else + li->li_prev = li - 1; + if (i == 9) + li->li_next = NULL; + else + li->li_next = li + 1; + } +} + +#endif /* defined(FEAT_EVAL) */ diff --git a/src/macros.h b/src/macros.h index 2706a02524..fcd1a829da 100644 --- a/src/macros.h +++ b/src/macros.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -8,49 +8,58 @@ /* * macros.h: macro definitions for often used code + * + * Macros should be ALL_CAPS. An exception is for where a function is + * replaced and an argument is not used more than once. */ /* - * pchar(lp, c) - put character 'c' at position 'lp' + * PCHAR(lp, c) - put character 'c' at position 'lp' */ -#define pchar(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c)) +#define PCHAR(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c)) /* * Position comparisons */ #ifdef FEAT_VIRTUALEDIT -# define lt(a, b) (((a).lnum != (b).lnum) \ +# define LT_POS(a, b) (((a).lnum != (b).lnum) \ ? (a).lnum < (b).lnum \ : (a).col != (b).col \ ? (a).col < (b).col \ : (a).coladd < (b).coladd) -# define ltp(a, b) (((a)->lnum != (b)->lnum) \ +# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \ ? (a)->lnum < (b)->lnum \ : (a)->col != (b)->col \ ? (a)->col < (b)->col \ : (a)->coladd < (b)->coladd) -# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd)) -# define clearpos(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;} +# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd)) +# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;} #else -# define lt(a, b) (((a).lnum != (b).lnum) \ +# define LT_POS(a, b) (((a).lnum != (b).lnum) \ ? ((a).lnum < (b).lnum) : ((a).col < (b).col)) -# define ltp(a, b) (((a)->lnum != (b)->lnum) \ +# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \ ? ((a)->lnum < (b)->lnum) : ((a)->col < (b)->col)) -# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col)) -# define clearpos(a) {(a)->lnum = 0; (a)->col = 0;} +# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col)) +# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0;} #endif -#define ltoreq(a, b) (lt(a, b) || equalpos(a, b)) +#define LTOREQ_POS(a, b) (LT_POS(a, b) || EQUAL_POS(a, b)) /* - * lineempty() - return TRUE if the line is empty + * VIM_ISWHITE() is used for "^" and the like. It differs from isspace() + * because it doesn't include <CR> and <LF> and the like. */ -#define lineempty(p) (*ml_get(p) == NUL) +#define VIM_ISWHITE(x) ((x) == ' ' || (x) == '\t') /* - * bufempty() - return TRUE if the current buffer is empty + * LINEEMPTY() - return TRUE if the line is empty */ -#define bufempty() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL) +#define LINEEMPTY(p) (*ml_get(p) == NUL) + +/* + * BUFEMPTY() - return TRUE if the current buffer is empty + */ +#define BUFEMPTY() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL) /* * toupper() and tolower() that use the current locale. @@ -118,23 +127,26 @@ # define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || VIM_ISDIGIT(c)) #endif -/* macro version of chartab(). - * Only works with values 0-255! - * Doesn't work for UTF-8 mode with chars >= 0x80. */ -#define CHARSIZE(c) (chartab[c] & CT_CELL_MASK) +/* Returns empty string if it is NULL. */ +#define EMPTY_IF_NULL(x) ((x) ? (x) : (char_u *)"") #ifdef FEAT_LANGMAP /* * Adjust chars in a language according to 'langmap' option. * NOTE that there is no noticeable overhead if 'langmap' is not set. * When set the overhead for characters < 256 is small. - * Don't apply 'langmap' if the character comes from the Stuff buffer. + * Don't apply 'langmap' if the character comes from the Stuff buffer or from + * a mapping and the langnoremap option was set. * The do-while is just to ignore a ';' after the macro. */ # ifdef FEAT_MBYTE # define LANGMAP_ADJUST(c, condition) \ do { \ - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \ + if (*p_langmap \ + && (condition) \ + && (p_lrm || (!p_lrm && KeyTyped)) \ + && !KeyStuffed \ + && (c) >= 0) \ { \ if ((c) < 256) \ c = langmap_mapchar[c]; \ @@ -145,7 +157,11 @@ # else # define LANGMAP_ADJUST(c, condition) \ do { \ - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \ + if (*p_langmap \ + && (condition) \ + && (p_lrm || (!p_lrm && KeyTyped)) \ + && !KeyStuffed \ + && (c) >= 0 && (c) < 256) \ c = langmap_mapchar[c]; \ } while (0) # endif @@ -154,10 +170,10 @@ #endif /* - * vim_isbreak() is used very often if 'linebreak' is set, use a macro to make - * it work fast. + * VIM_ISBREAK() is used very often if 'linebreak' is set, use a macro to make + * it work fast. Only works for single byte characters! */ -#define vim_isbreak(c) (breakat_flags[(char_u)(c)]) +#define VIM_ISBREAK(c) ((c) < 256 && breakat_flags[(char_u)(c)]) /* * On VMS file names are different and require a translation. @@ -170,21 +186,17 @@ # define mch_fstat(n, p) fstat(vms_fixfilename(n), (p)) /* VMS does not have lstat() */ # define mch_stat(n, p) stat(vms_fixfilename(n), (p)) +# define mch_rmdir(n) rmdir(vms_fixfilename(n)) #else # ifndef WIN32 # define mch_access(n, p) access((n), (p)) # endif -# if !(defined(FEAT_MBYTE) && defined(WIN3264)) -# define mch_fopen(n, p) fopen((n), (p)) -# endif # define mch_fstat(n, p) fstat((n), (p)) # ifdef MSWIN /* has it's own mch_stat() function */ # define mch_stat(n, p) vim_stat((n), (p)) # else # ifdef STAT_IGNORES_SLASH - /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if - * the name ends in "/" and it's not a directory. */ -# define mch_stat(n, p) (illegal_slash(n) ? -1 : stat((n), (p))) +# define mch_stat(n, p) vim_stat((n), (p)) # else # define mch_stat(n, p) stat((n), (p)) # endif @@ -197,29 +209,20 @@ # define mch_lstat(n, p) mch_stat((n), (p)) #endif -#ifdef MACOS_CLASSIC -/* MacOS classic doesn't support perm but MacOS X does. */ -# define mch_open(n, m, p) open((n), (m)) -#else -# ifdef VMS +#ifdef VMS /* * It is possible to force some record format with: * # define mch_open(n, m, p) open(vms_fixfilename(n), (m), (p)), "rat=cr", "rfm=stmlf", "mrs=0") * but it is not recommended, because it can destroy indexes etc. */ -# define mch_open(n, m, p) open(vms_fixfilename(n), (m), (p)) -# else -# if !(defined(FEAT_MBYTE) && defined(WIN3264)) -# define mch_open(n, m, p) open((n), (m), (p)) -# endif -# endif +# define mch_open(n, m, p) open(vms_fixfilename(n), (m), (p)) #endif /* mch_open_rw(): invoke mch_open() with third argument for user R/W. */ #if defined(UNIX) || defined(VMS) /* open in rw------- mode */ # define mch_open_rw(n, f) mch_open((n), (f), (mode_t)0600) #else -# if defined(MSDOS) || defined(MSWIN) || defined(OS2) /* open read/write */ +# if defined(MSWIN) /* open read/write */ # define mch_open_rw(n, f) mch_open((n), (f), S_IREAD | S_IWRITE) # else # define mch_open_rw(n, f) mch_open((n), (f), 0) @@ -227,9 +230,9 @@ #endif #ifdef STARTUPTIME -# define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); } +# define TIME_MSG(s) do { if (time_fd != NULL) time_msg(s, NULL); } while (0) #else -# define TIME_MSG(s) +# define TIME_MSG(s) do { /**/ } while (0) #endif #ifdef FEAT_VREPLACE @@ -250,24 +253,24 @@ #endif /* - * mb_ptr_adv(): advance a pointer to the next character, taking care of + * MB_PTR_ADV(): advance a pointer to the next character, taking care of * multi-byte characters if needed. - * mb_ptr_back(): backup a pointer to the previous character, taking care of + * MB_PTR_BACK(): backup a pointer to the previous character, taking care of * multi-byte characters if needed. * MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers. * PTR2CHAR(): get character from pointer. */ #ifdef FEAT_MBYTE -/* Get the length of the character p points to */ -# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1) +/* Get the length of the character p points to, including composing chars */ +# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1) /* Advance multi-byte pointer, skip over composing chars. */ -# define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1 +# define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1 /* Advance multi-byte pointer, do not skip over composing chars. */ -# define mb_cptr_adv(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1 +# define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1 /* Backup multi-byte pointer. Only use with "p" > "s" ! */ -# define mb_ptr_back(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1 +# define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1 /* get length of multi-byte char, not including composing chars */ -# define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) +# define MB_CPTR2LEN(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) # define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++ # define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p)) @@ -275,9 +278,10 @@ # define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p)) #else # define MB_PTR2LEN(p) 1 -# define mb_ptr_adv(p) ++p -# define mb_cptr_adv(p) ++p -# define mb_ptr_back(s, p) --p +# define MB_CPTR2LEN(p) 1 +# define MB_PTR_ADV(p) ++p +# define MB_CPTR_ADV(p) ++p +# define MB_PTR_BACK(s, p) --p # define MB_COPY_CHAR(f, t) *t++ = *f++ # define MB_CHARLEN(p) STRLEN(p) # define MB_CHAR2LEN(c) 1 @@ -285,21 +289,92 @@ #endif #ifdef FEAT_AUTOCHDIR -# define DO_AUTOCHDIR if (p_acd) do_autochdir(); +# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0) #else -# define DO_AUTOCHDIR +# define DO_AUTOCHDIR do { /**/ } while (0) #endif -#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND) -# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE +#define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE + +#ifdef FEAT_DIFF +# define PLINES_NOFILL(x) plines_nofill(x) #else -# if defined(FEAT_SCROLLBIND) -# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE -# else -# if defined(FEAT_CURSORBIND) -# define RESET_BINDING(wp) (wp)->w_p_crb = FALSE +# define PLINES_NOFILL(x) plines(x) +#endif + +#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_CLIENTSERVER) +# define MESSAGE_QUEUE +#endif + +#if defined(FEAT_EVAL) && defined(FEAT_FLOAT) +# include <float.h> +# if defined(HAVE_MATH_H) + /* for isnan() and isinf() */ +# include <math.h> +# endif +# ifdef USING_FLOAT_STUFF +# if defined(WIN32) +# ifndef isnan +# define isnan(x) _isnan(x) + static __inline int isinf(double x) { return !_finite(x) && !_isnan(x); } +# endif # else -# define RESET_BINDING(wp) +# ifndef HAVE_ISNAN + static inline int isnan(double x) { return x != x; } +# endif +# ifndef HAVE_ISINF + static inline int isinf(double x) { return !isnan(x) && isnan(x - x); } +# endif +# endif +# if !defined(INFINITY) +# if defined(DBL_MAX) +# ifdef VMS +# define INFINITY DBL_MAX +# else +# define INFINITY (DBL_MAX+DBL_MAX) +# endif +# else +# define INFINITY (1.0 / 0.0) +# endif +# endif +# if !defined(NAN) +# define NAN (INFINITY-INFINITY) +# endif +# if !defined(DBL_EPSILON) +# define DBL_EPSILON 2.2204460492503131e-16 # endif # endif #endif + +/* + * In a hashtab item "hi_key" points to "di_key" in a dictitem. + * This avoids adding a pointer to the hashtab item. + * DI2HIKEY() converts a dictitem pointer to a hashitem key pointer. + * HIKEY2DI() converts a hashitem key pointer to a dictitem pointer. + * HI2DI() converts a hashitem pointer to a dictitem pointer. + */ +#define DI2HIKEY(di) ((di)->di_key) +#define HIKEY2DI(p) ((dictitem_T *)(p - offsetof(dictitem_T, di_key))) +#define HI2DI(hi) HIKEY2DI((hi)->hi_key) + +/* + * Flush control functions. + */ +#ifdef FEAT_GUI +# define mch_enable_flush() gui_enable_flush() +# define mch_disable_flush() gui_disable_flush() +#else +# define mch_enable_flush() +# define mch_disable_flush() +#endif + +/* + * Like vim_free(), and also set the pointer to NULL. + */ +#define VIM_CLEAR(p) \ + do { \ + if ((p) != NULL) { \ + vim_free(p); \ + (p) = NULL; \ + } \ + } while (0) diff --git a/src/main.aap b/src/main.aap index 3c91d39fbe..19bc97de55 100644 --- a/src/main.aap +++ b/src/main.aap @@ -22,11 +22,11 @@ # A U T O C O N F # - # Run autoconf when configure.in has been changed since it was last run. + # Run autoconf when configure.ac has been changed since it was last run. # This is skipped when the signatures in "mysign" are up-to-date. When # there is no autoconf program skip this (the signature is often the only # thing that's outdated) - auto/configure {signfile = mysign} : configure.in + auto/configure {signfile = mysign} : configure.ac @if not program_path("autoconf"): :print Can't find autoconf, using existing configure script. @else: @@ -69,7 +69,7 @@ --with-mac-arch=$arch --cache-file=auto/config.cache - # Configure arguments: create an empty "config.arg" file when its missing + # Configure arguments: create an empty "config.arg" file when it's missing config.arg: :touch {exist} config.arg @@ -347,7 +347,6 @@ Source = $PYTHON_SRC $TCL_SRC $RUBY_SRC - $SNIFF_SRC $WORKSHOP_SRC Objects = diff --git a/src/main.c b/src/main.c index 5f458ba5e6..bd28b13622 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,10 +10,6 @@ #define EXTERN #include "vim.h" -#ifdef SPAWNO -# include <spawno.h> /* special MS-DOS swapping library */ -#endif - #ifdef __CYGWIN__ # ifndef WIN32 # include <cygwin/version.h> @@ -23,67 +19,9 @@ # include <limits.h> #endif -/* Maximum number of commands from + or -c arguments. */ -#define MAX_ARG_CMDS 10 - -/* values for "window_layout" */ -#define WIN_HOR 1 /* "-o" horizontally split windows */ -#define WIN_VER 2 /* "-O" vertically split windows */ -#define WIN_TABS 3 /* "-p" windows on tab pages */ - -/* Struct for various parameters passed between main() and other functions. */ -typedef struct -{ - int argc; - char **argv; - - int evim_mode; /* started as "evim" */ - char_u *use_vimrc; /* vimrc from -u argument */ - - int n_commands; /* no. of commands from + or -c */ - char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ - char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ - int n_pre_commands; /* no. of commands from --cmd */ - char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */ - - int edit_type; /* type of editing to do */ - char_u *tagname; /* tag from -t argument */ -#ifdef FEAT_QUICKFIX - char_u *use_ef; /* 'errorfile' from -q argument */ -#endif - - int want_full_screen; - int stdout_isatty; /* is stdout a terminal? */ - char_u *term; /* specified terminal name */ -#ifdef FEAT_CRYPT - int ask_for_key; /* -x argument */ -#endif - int no_swap_file; /* "-n" argument used */ -#ifdef FEAT_EVAL - int use_debug_break_level; -#endif -#ifdef FEAT_WINDOWS - int window_count; /* number of windows to use */ - int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */ -#endif - -#ifdef FEAT_CLIENTSERVER - int serverArg; /* TRUE when argument for a server */ - char_u *serverName_arg; /* cmdline arg for server name */ - char_u *serverStr; /* remote server command */ - char_u *serverStrEnc; /* encoding of serverStr */ - char_u *servername; /* allocated name for our server */ -#endif -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) - int literal; /* don't expand file names */ -#endif -#ifdef MSWIN - int full_path; /* file name argument was full path */ -#endif -#ifdef FEAT_DIFF - int diff_mode; /* start with 'diff' set */ +#if defined(WIN3264) && !defined(FEAT_GUI_W32) +# include "iscygpty.h" #endif -} mparm_T; /* Values for edit_type. */ #define EDIT_NONE 0 /* no edit type yet */ @@ -93,37 +31,38 @@ typedef struct #define EDIT_QF 4 /* start in quickfix mode */ #if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) -static int file_owned __ARGS((char *fname)); +static int file_owned(char *fname); #endif -static void mainerr __ARGS((int, char_u *)); -#ifndef NO_VIM_MAIN -static void main_msg __ARGS((char *s)); -static void usage __ARGS((void)); -static int get_number_arg __ARGS((char_u *p, int *idx, int def)); +static void mainerr(int, char_u *); # if defined(HAVE_LOCALE_H) || defined(X_LOCALE) -static void init_locale __ARGS((void)); -# endif -static void parse_command_name __ARGS((mparm_T *parmp)); -static void early_arg_scan __ARGS((mparm_T *parmp)); -static void command_line_scan __ARGS((mparm_T *parmp)); -static void check_tty __ARGS((mparm_T *parmp)); -static void read_stdin __ARGS((void)); -static void create_windows __ARGS((mparm_T *parmp)); -# ifdef FEAT_WINDOWS -static void edit_buffers __ARGS((mparm_T *parmp)); +static void init_locale(void); # endif -static void exe_pre_commands __ARGS((mparm_T *parmp)); -static void exe_commands __ARGS((mparm_T *parmp)); -static void source_startup_scripts __ARGS((mparm_T *parmp)); -static void main_start_gui __ARGS((void)); +static void early_arg_scan(mparm_T *parmp); +#ifndef NO_VIM_MAIN +static void main_msg(char *s); +static void usage(void); +static int get_number_arg(char_u *p, int *idx, int def); +static void parse_command_name(mparm_T *parmp); +static void command_line_scan(mparm_T *parmp); +static void check_tty(mparm_T *parmp); +static void read_stdin(void); +static void create_windows(mparm_T *parmp); +static void edit_buffers(mparm_T *parmp, char_u *cwd); +static void exe_pre_commands(mparm_T *parmp); +static void exe_commands(mparm_T *parmp); +static void source_startup_scripts(mparm_T *parmp); +static void main_start_gui(void); # if defined(HAS_SWAP_EXISTS_ACTION) -static void check_swap_exists_action __ARGS((void)); +static void check_swap_exists_action(void); +# endif +# ifdef FEAT_EVAL +static void set_progpath(char_u *argv0); # endif # if defined(FEAT_CLIENTSERVER) || defined(PROTO) -static void exec_on_server __ARGS((mparm_T *parmp)); -static void prepare_server __ARGS((mparm_T *parmp)); -static void cmdsrv_main __ARGS((int *argc, char **argv, char_u *serverName_arg, char_u **serverStr)); -static char_u *serverMakeName __ARGS((char_u *arg, char *cmd)); +static void exec_on_server(mparm_T *parmp); +static void prepare_server(mparm_T *parmp); +static void cmdsrv_main(int *argc, char **argv, char_u *serverName_arg, char_u **serverStr); +static char_u *serverMakeName(char_u *arg, char *cmd); # endif #endif @@ -148,7 +87,16 @@ static char *(main_errors[]) = }; #ifndef PROTO /* don't want a prototype for main() */ + +/* Various parameters passed between main() and other functions. */ +static mparm_T params; + #ifndef NO_VIM_MAIN /* skip this for unittests */ + +static char_u *start_dir = NULL; /* current working dir on startup */ + +static int has_dash_c_arg = FALSE; + int # ifdef VIMDLL _export @@ -161,14 +109,9 @@ VimMain # else main # endif -(argc, argv) - int argc; - char **argv; +(int argc, char **argv) { - char_u *fname = NULL; /* file name from command line */ - mparm_T params; /* various parameters passed between - * main() and other functions. */ -#ifdef STARTUPTIME +#if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH) int i; #endif @@ -185,6 +128,14 @@ main */ mch_early_init(); +#if defined(WIN32) && defined(FEAT_MBYTE) + /* + * MinGW expands command line arguments, which confuses our code to + * convert when 'encoding' changes. Get the unexpanded arguments. + */ + argc = get_cmd_argsW(&argv); +#endif + /* Many variables are in "params" so that we can pass them to invoked * functions without a lot of arguments. "argc" and "argv" are also * copied, so that they can be changed. */ @@ -195,9 +146,7 @@ main #ifdef FEAT_EVAL params.use_debug_break_level = -1; #endif -#ifdef FEAT_WINDOWS params.window_count = -1; -#endif #ifdef FEAT_RUBY { @@ -215,136 +164,27 @@ main #endif #ifdef STARTUPTIME - for (i = 1; i < argc; ++i) - { - if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc) + /* Need to find "--startuptime" before actually parsing arguments. */ + for (i = 1; i < argc - 1; ++i) + if (STRICMP(argv[i], "--startuptime") == 0) { time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); break; } - } #endif starttime = time(NULL); -#ifdef __EMX__ - _wildcard(¶ms.argc, ¶ms.argv); -#endif - -#ifdef FEAT_MBYTE - (void)mb_init(); /* init mb_bytelen_tab[] to ones */ -#endif -#ifdef FEAT_EVAL - eval_init(); /* init global variables */ -#endif - -#ifdef __QNXNTO__ - qnx_init(); /* PhAttach() for clipboard, (and gui) */ -#endif - -#ifdef MAC_OS_CLASSIC - /* Prepare for possibly starting GUI sometime */ - /* Macintosh needs this before any memory is allocated. */ - gui_prepare(¶ms.argc, params.argv); - TIME_MSG("GUI prepared"); -#endif - - /* Init the table of Normal mode commands. */ - init_normal_cmds(); - -#if defined(HAVE_DATE_TIME) && defined(VMS) && defined(VAXC) - make_version(); /* Construct the long version string. */ -#endif - - /* - * Allocate space for the generic buffers (needed for set_init_1() and - * EMSG2()). - */ - if ((IObuff = alloc(IOSIZE)) == NULL - || (NameBuff = alloc(MAXPATHL)) == NULL) - mch_exit(0); - TIME_MSG("Allocated generic buffers"); - -#ifdef NBDEBUG - /* Wait a moment for debugging NetBeans. Must be after allocating - * NameBuff. */ - nbdebug_log_init("SPRO_GVIM_DEBUG", "SPRO_GVIM_DLEVEL"); - nbdebug_wait(WT_ENV | WT_WAIT | WT_STOP, "SPRO_GVIM_WAIT", 20); - TIME_MSG("NetBeans debug wait"); -#endif - -#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) - /* - * Setup to use the current locale (for ctype() and many other things). - * NOTE: Translated messages with encodings other than latin1 will not - * work until set_init_1() has been called! - */ - init_locale(); - TIME_MSG("locale set"); -#endif - -#ifdef FEAT_GUI - gui.dofork = TRUE; /* default is to use fork() */ -#endif - - /* - * Do a first scan of the arguments in "argv[]": - * -display or --display - * --server... - * --socketid - * --windowid - */ - early_arg_scan(¶ms); - -#ifdef FEAT_SUN_WORKSHOP - findYourself(params.argv[0]); -#endif -#if defined(FEAT_GUI) && !defined(MAC_OS_CLASSIC) - /* Prepare for possibly starting GUI sometime */ - gui_prepare(¶ms.argc, params.argv); - TIME_MSG("GUI prepared"); -#endif - -#ifdef FEAT_CLIPBOARD - clip_init(FALSE); /* Initialise clipboard stuff */ - TIME_MSG("clipboard setup"); -#endif - - /* - * Check if we have an interactive window. - * On the Amiga: If there is no window, we open one with a newcli command - * (needed for :! to * work). mch_check_win() will also handle the -d or - * -dev argument. - */ - params.stdout_isatty = (mch_check_win(params.argc, params.argv) != FAIL); - TIME_MSG("window checked"); - - /* - * Allocate the first window and buffer. - * Can't do anything without it, exit when it fails. - */ - if (win_alloc_first() == FAIL) - mch_exit(0); - - init_yank(); /* init yank buffers */ - - alist_init(&global_alist); /* Init the argument list to empty. */ - global_alist.id = 0; - - /* - * Set the default values for the options. - * NOTE: Non-latin1 translated messages are working only after this, - * because this is where "has_mbyte" will be set, which is used by - * msg_outtrans_len_attr(). - * First find out the home directory, needed to expand "~" in options. - */ - init_homedir(); /* find real value of $HOME */ - set_init_1(); - TIME_MSG("inits 1"); - -#ifdef FEAT_EVAL - set_lang_var(); /* set v:lang and v:ctype */ +#ifdef CLEAN_RUNTIMEPATH + /* Need to find "--clean" before actually parsing arguments. */ + for (i = 1; i < argc; ++i) + if (STRICMP(argv[i], "--clean") == 0) + { + params.clean = TRUE; + break; + } #endif + common_init(¶ms); #ifdef FEAT_CLIENTSERVER /* @@ -405,21 +245,26 @@ main if (GARGCOUNT > 0) { -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) +#ifdef EXPAND_FILENAMES /* * Expand wildcards in file names. */ if (!params.literal) { + start_dir = alloc(MAXPATHL); + if (start_dir != NULL) + mch_dirname(start_dir, MAXPATHL); /* Temporarily add '(' and ')' to 'isfname'. These are valid * filename characters but are excluded from 'isfname' to make * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ do_cmdline_cmd((char_u *)":set isf+=(,)"); alist_expand(NULL, 0); do_cmdline_cmd((char_u *)":set isf&"); + if (start_dir != NULL) + mch_chdir((char *)start_dir); } #endif - fname = alist_name(&GARGLIST[0]); + params.fname = alist_name(&GARGLIST[0]); } #if defined(WIN32) && defined(FEAT_MBYTE) @@ -441,7 +286,9 @@ main * Hint: to avoid this when typing a command use a forward slash. * If the cd fails, it doesn't matter. */ - (void)vim_chdirfile(fname); + (void)vim_chdirfile(params.fname, "drop"); + if (start_dir != NULL) + mch_dirname(start_dir, MAXPATHL); } #endif TIME_MSG("expanding arguments"); @@ -457,7 +304,7 @@ main /* * When listing swap file names, don't do cursor positioning et. al. */ - if (recoverymode && fname == NULL) + if (recoverymode && params.fname == NULL) params.want_full_screen = FALSE; /* @@ -475,7 +322,7 @@ main params.want_full_screen = FALSE; #endif -#if defined(FEAT_GUI_MAC) && defined(MACOS_X_UNIX) +#if defined(FEAT_GUI_MAC) && defined(MACOS_X_DARWIN) /* When the GUI is started from Finder, need to display messages in a * message box. isatty(2) returns TRUE anyway, thus we need to check the * name to know we're not started from a terminal. */ @@ -489,21 +336,22 @@ main if (getcwd((char *)NameBuff, MAXPATHL) != NULL && STRCMP(NameBuff, "/") == 0) { - if (fname != NULL) - (void)vim_chdirfile(fname); + if (params.fname != NULL) + (void)vim_chdirfile(params.fname, "drop"); else { expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); vim_chdir(NameBuff); } + if (start_dir != NULL) + mch_dirname(start_dir, MAXPATHL); } } #endif /* * mch_init() sets up the terminal (window) for use. This must be - * done after resetting full_screen, otherwise it may move the cursor - * (MSDOS). + * done after resetting full_screen, otherwise it may move the cursor. * Note that we may use mch_exit() before mch_init()! */ mch_init(); @@ -534,6 +382,13 @@ main */ check_tty(¶ms); +#ifdef _IOLBF + /* Ensure output works usefully without a tty: buffer lines instead of + * fully buffered. */ + if (silent_mode) + setvbuf(stdout, NULL, _IOLBF, 0); +#endif + /* This message comes before term inits, but after setting "silent_mode" * when the input is not a tty. */ if (GARGCOUNT > 1 && !silent_mode) @@ -578,49 +433,51 @@ main debug_break_level = params.use_debug_break_level; #endif + /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments. + * Allows for setting 'loadplugins' there. */ + if (params.use_vimrc != NULL + && (STRCMP(params.use_vimrc, "NONE") == 0 + || STRCMP(params.use_vimrc, "DEFAULTS") == 0)) + p_lpl = FALSE; + + /* Execute --cmd arguments. */ + exe_pre_commands(¶ms); + + /* Source startup scripts. */ + source_startup_scripts(¶ms); + +#ifdef FEAT_GUI_MACVIM + gui_macvim_release_autoreleasepool(autoreleasePool); +#endif + #ifdef FEAT_MZSCHEME /* * Newer version of MzScheme (Racket) require earlier (trampolined) * initialisation via scheme_main_setup. * Implement this by initialising it as early as possible - * and splitting off remaining Vim main into vim_main2 + * and splitting off remaining Vim main into vim_main2(). + * Do source startup scripts, so that 'mzschemedll' can be set. */ - { - /* Pack up preprocessed command line arguments. - * It is safe because Scheme does not access argc/argv. */ - char *args[2]; - args[0] = (char *)fname; - args[1] = (char *)¶ms; - return mzscheme_main(2, args); - } -} + return mzscheme_main(); +#else + return vim_main2(); #endif +} #endif /* NO_VIM_MAIN */ +#endif /* PROTO */ -/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when - * NO_VIM_MAIN is defined. */ -#ifdef FEAT_MZSCHEME +/* + * vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep + * things simple. + * It is also defined when NO_VIM_MAIN is defined, but then it's empty. + */ int -vim_main2(int argc UNUSED, char **argv UNUSED) +vim_main2(void) { -# ifndef NO_VIM_MAIN - char_u *fname = (char_u *)argv[0]; - mparm_T params; - - memcpy(¶ms, argv[1], sizeof(params)); -# else - return 0; -} -# endif -#endif - #ifndef NO_VIM_MAIN - /* Execute --cmd arguments. */ - exe_pre_commands(¶ms); - - /* Source startup scripts. */ - source_startup_scripts(¶ms); - +#ifdef FEAT_GUI_MACVIM + void *autoreleasePool = gui_macvim_new_autoreleasepool(); +#endif #ifdef FEAT_EVAL /* * Read all the plugin files. @@ -628,12 +485,42 @@ vim_main2(int argc UNUSED, char **argv UNUSED) */ if (p_lpl) { + char_u *rtp_copy = NULL; + + /* First add all package directories to 'runtimepath', so that their + * autoload directories can be found. Only if not done already with a + * :packloadall command. + * Make a copy of 'runtimepath', so that source_runtime does not use + * the pack directories. */ + if (!did_source_packages) + { + rtp_copy = vim_strsave(p_rtp); + add_pack_start_dirs(); + } + + source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy, # ifdef VMS /* Somehow VMS doesn't handle the "**". */ - source_runtime((char_u *)"plugin/*.vim", TRUE); + (char_u *)"plugin/*.vim", # else - source_runtime((char_u *)"plugin/**/*.vim", TRUE); + (char_u *)"plugin/**/*.vim", # endif + DIP_ALL | DIP_NOAFTER); TIME_MSG("loading plugins"); + vim_free(rtp_copy); + + /* Only source "start" packages if not done already with a :packloadall + * command. */ + if (!did_source_packages) + load_start_packages(); + TIME_MSG("loading packages"); + +# ifdef VMS /* Somehow VMS doesn't handle the "**". */ + source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_AFTER); +# else + source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER); +# endif + TIME_MSG("loading after plugins"); + } #endif @@ -653,7 +540,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) * This uses the 'dir' option, therefore it must be after the * initializations. */ - if (recoverymode && fname == NULL) + if (recoverymode && params.fname == NULL) { recover_names(NULL, TRUE, 0, NULL); mch_exit(0); @@ -704,10 +591,6 @@ vim_main2(int argc UNUSED, char **argv UNUSED) } #endif -#ifdef SPAWNO /* special MSDOS swapping library */ - init_SPAWNO("", SWAP_ANY); -#endif - #ifdef FEAT_VIMINFO /* * Read in registers, history etc, but not marks, from the viminfo file. @@ -732,11 +615,16 @@ vim_main2(int argc UNUSED, char **argv UNUSED) */ if (params.edit_type == EDIT_QF) { + char_u *enc = NULL; + +# ifdef FEAT_MBYTE + enc = p_menc; +# endif if (params.use_ef != NULL) set_string_option_direct((char_u *)"ef", -1, params.use_ef, OPT_FREE, SID_CARG); vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); - if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff) < 0) + if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff, enc) < 0) { out_char('\n'); mch_exit(3); @@ -768,7 +656,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) # ifdef FEAT_SUN_WORKSHOP if (!usingSunWorkShop) # endif - gui_wait_for_chars(50L); + gui_wait_for_chars(50L, typebuf.tb_change_cnt); TIME_MSG("GUI delay"); } #endif @@ -833,9 +721,6 @@ vim_main2(int argc UNUSED, char **argv UNUSED) starttermcap(); /* start termcap if not done by wait_return() */ TIME_MSG("start termcap"); -#if defined(FEAT_TERMRESPONSE) && defined(FEAT_MBYTE) - may_req_ambiguous_char_width(); -#endif #ifdef FEAT_MOUSE setmouse(); /* may start using the mouse */ @@ -862,8 +747,8 @@ vim_main2(int argc UNUSED, char **argv UNUSED) #ifdef FEAT_CRYPT if (params.ask_for_key) { - (void)blowfish_self_test(); - (void)get_crypt_key(TRUE, TRUE); + crypt_check_current_method(); + (void)crypt_get_key(TRUE, TRUE); TIME_MSG("getting crypt key"); } #endif @@ -913,10 +798,8 @@ vim_main2(int argc UNUSED, char **argv UNUSED) if (exmode_active) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("BufEnter autocommands"); -#endif setpcmark(); #ifdef FEAT_QUICKFIX @@ -930,13 +813,12 @@ vim_main2(int argc UNUSED, char **argv UNUSED) } #endif -#ifdef FEAT_WINDOWS /* * If opened more than one window, start editing files in the other * windows. */ - edit_buffers(¶ms); -#endif + edit_buffers(¶ms, start_dir); + vim_free(start_dir); #ifdef FEAT_DIFF if (params.diff_mode) @@ -944,7 +826,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) win_T *wp; /* set options in each window for "vimdiff". */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) diff_win_options(wp, TRUE); } #endif @@ -979,25 +861,38 @@ vim_main2(int argc UNUSED, char **argv UNUSED) if (params.n_commands > 0) exe_commands(¶ms); + /* Must come before the may_req_ calls. */ + starting = 0; + +#if defined(FEAT_TERMRESPONSE) && defined(FEAT_MBYTE) + /* Must be done before redrawing, puts a few characters on the screen. */ + may_req_ambiguous_char_width(); +#endif + RedrawingDisabled = 0; redraw_all_later(NOT_VALID); no_wait_return = FALSE; - starting = 0; + + /* 'autochdir' has been postponed */ + DO_AUTOCHDIR; #ifdef FEAT_TERMRESPONSE /* Requesting the termresponse is postponed until here, so that a "-c q" * argument doesn't make it appear in the shell Vim was started from. */ may_req_termresponse(); + + may_req_bg_color(); #endif /* start in insert mode */ if (p_im) need_start_insertmode = TRUE; -#ifdef FEAT_AUTOCMD +#ifdef FEAT_EVAL + set_vim_var_nr(VV_VIM_DID_ENTER, 1L); +#endif apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("VimEnter autocommands"); -#endif #if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) /* Adjust default register name for "unnamed" in 'clipboard'. Can only be @@ -1006,12 +901,13 @@ vim_main2(int argc UNUSED, char **argv UNUSED) * main loop. */ { int default_regname = 0; + adjust_clip_reg(&default_regname); set_reg_var(default_regname); } #endif -#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND) +#if defined(FEAT_DIFF) /* When a startup script or session file setup for diff'ing and * scrollbind, sync the scrollbind now. */ if (curwin->w_p_diff && curwin->w_p_scb) @@ -1026,7 +922,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) mch_set_winsize_now(); /* Allow winsize changes from now on */ #endif -#if defined(FEAT_GUI) && defined(FEAT_WINDOWS) +#if defined(FEAT_GUI) /* When tab pages were created, may need to update the tab pages line and * scrollbars. This is skipped while creating them. */ if (first_tabpage->tp_next != NULL) @@ -1081,11 +977,135 @@ vim_main2(int argc UNUSED, char **argv UNUSED) #ifdef FEAT_GUI_MACVIM gui_macvim_release_autoreleasepool(autoreleasePool); #endif +#endif /* NO_VIM_MAIN */ return 0; } -#endif /* NO_VIM_MAIN */ -#endif /* PROTO */ + +/* + * Initialisation shared by main() and some tests. + */ + void +common_init(mparm_T *paramp) +{ + +#ifdef FEAT_MBYTE + (void)mb_init(); /* init mb_bytelen_tab[] to ones */ +#endif +#ifdef FEAT_EVAL + eval_init(); /* init global variables */ +#endif + +#ifdef __QNXNTO__ + qnx_init(); /* PhAttach() for clipboard, (and gui) */ +#endif + + /* Init the table of Normal mode commands. */ + init_normal_cmds(); + +#if defined(HAVE_DATE_TIME) && defined(VMS) && defined(VAXC) + make_version(); /* Construct the long version string. */ +#endif + + /* + * Allocate space for the generic buffers (needed for set_init_1() and + * EMSG2()). + */ + if ((IObuff = alloc(IOSIZE)) == NULL + || (NameBuff = alloc(MAXPATHL)) == NULL) + mch_exit(0); + TIME_MSG("Allocated generic buffers"); + +#ifdef NBDEBUG + /* Wait a moment for debugging NetBeans. Must be after allocating + * NameBuff. */ + nbdebug_log_init("SPRO_GVIM_DEBUG", "SPRO_GVIM_DLEVEL"); + nbdebug_wait(WT_ENV | WT_WAIT | WT_STOP, "SPRO_GVIM_WAIT", 20); + TIME_MSG("NetBeans debug wait"); +#endif + +#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) + /* + * Setup to use the current locale (for ctype() and many other things). + * NOTE: Translated messages with encodings other than latin1 will not + * work until set_init_1() has been called! + */ + init_locale(); + TIME_MSG("locale set"); +#endif + +#ifdef FEAT_GUI + gui.dofork = TRUE; /* default is to use fork() */ +#endif + + /* + * Do a first scan of the arguments in "argv[]": + * -display or --display + * --server... + * --socketid + * --windowid + */ + early_arg_scan(paramp); + +#ifdef FEAT_SUN_WORKSHOP + findYourself(paramp->argv[0]); +#endif +#if defined(FEAT_GUI) + /* Prepare for possibly starting GUI sometime */ + gui_prepare(¶mp->argc, paramp->argv); + TIME_MSG("GUI prepared"); +#endif + +#ifdef FEAT_CLIPBOARD + clip_init(FALSE); /* Initialise clipboard stuff */ + TIME_MSG("clipboard setup"); +#endif + + /* + * Check if we have an interactive window. + * On the Amiga: If there is no window, we open one with a newcli command + * (needed for :! to * work). mch_check_win() will also handle the -d or + * -dev argument. + */ + stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL); + TIME_MSG("window checked"); + + /* + * Allocate the first window and buffer. + * Can't do anything without it, exit when it fails. + */ + if (win_alloc_first() == FAIL) + mch_exit(0); + + init_yank(); /* init yank buffers */ + + alist_init(&global_alist); /* Init the argument list to empty. */ + global_alist.id = 0; + + /* + * Set the default values for the options. + * NOTE: Non-latin1 translated messages are working only after this, + * because this is where "has_mbyte" will be set, which is used by + * msg_outtrans_len_attr(). + * First find out the home directory, needed to expand "~" in options. + */ + init_homedir(); /* find real value of $HOME */ + set_init_1(paramp->clean); + TIME_MSG("inits 1"); + +#ifdef FEAT_EVAL + set_lang_var(); /* set v:lang and v:ctype */ +#endif +} + +/* + * Return TRUE when the --not-a-term argument was found. + */ + int +is_not_a_term() +{ + return params.not_a_term; +} /* * Main loop: Execute Normal mode commands until exiting Vim. @@ -1095,16 +1115,17 @@ vim_main2(int argc UNUSED, char **argv UNUSED) * commands, return when entering Ex mode. "noexmode" is TRUE then. */ void -main_loop(cmdwin, noexmode) - int cmdwin; /* TRUE when working in the command-line window */ - int noexmode; /* TRUE when return on entering Ex mode */ +main_loop( + int cmdwin, /* TRUE when working in the command-line window */ + int noexmode) /* TRUE when return on entering Ex mode */ { - oparg_T oa; /* operator arguments */ - int previous_got_int = FALSE; /* "got_int" was TRUE */ + oparg_T oa; /* operator arguments */ + volatile int previous_got_int = FALSE; /* "got_int" was TRUE */ #ifdef FEAT_CONCEAL - linenr_T conceal_old_cursor_line = 0; - linenr_T conceal_new_cursor_line = 0; - int conceal_update_lines = FALSE; + /* these are static to avoid a compiler warning */ + static linenr_T conceal_old_cursor_line = 0; + static linenr_T conceal_new_cursor_line = 0; + static int conceal_update_lines = FALSE; #endif #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) @@ -1206,26 +1227,22 @@ main_loop(cmdwin, noexmode) skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) +#ifdef FEAT_GUI + /* If ui_breakcheck() was used a resize may have been postponed. */ + gui_may_resize_shell(); +#endif /* Trigger CursorMoved if the cursor moved. */ if (!finish_op && ( -# ifdef FEAT_AUTOCMD has_cursormoved() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif -# ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 -# endif +#ifdef FEAT_CONCEAL + || curwin->w_p_cole > 0 +#endif ) - && !equalpos(last_cursormoved, curwin->w_cursor)) + && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { -# ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); -# endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { @@ -1236,22 +1253,16 @@ main_loop(cmdwin, noexmode) # endif last_cursormoved = curwin->w_cursor; } -#endif -#ifdef FEAT_AUTOCMD - /* Trigger TextChanged if b_changedtick differs. */ + /* Trigger TextChanged if b:changedtick differs. */ if (!finish_op && has_textchanged() - && last_changedtick != curbuf->b_changedtick) + && curbuf->b_last_changedtick != CHANGEDTICK(curbuf)) { - if (last_changedtick_buf == curbuf) - apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, - FALSE, curbuf); - last_changedtick_buf = curbuf; - last_changedtick = curbuf->b_changedtick; + apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, FALSE, curbuf); + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } -#endif -#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND) +#if defined(FEAT_DIFF) /* Scroll-binding for diff mode may have been postponed until * here. Avoids doing it for every change. */ if (diff_need_scrollbind) @@ -1289,15 +1300,20 @@ main_loop(cmdwin, noexmode) if (VIsual_active) update_curbuf(INVERTED);/* update inverted part */ else if (must_redraw) + { + mch_disable_flush(); /* Stop issuing gui_mch_flush(). */ update_screen(0); + mch_enable_flush(); + } else if (redraw_cmdline || clear_cmdline) showmode(); -#ifdef FEAT_WINDOWS redraw_statuslines(); -#endif #ifdef FEAT_TITLE if (need_maketitle) maketitle(); +#endif +#ifdef FEAT_VIMINFO + curbuf->b_last_used = vim_time(); #endif /* display message after redraw */ if (keep_msg != NULL) @@ -1305,9 +1321,9 @@ main_loop(cmdwin, noexmode) char_u *p; /* msg_attr_keep() will set keep_msg to NULL, must free the - * string here. */ + * string here. Don't reset keep_msg, msg_attr_keep() uses it + * to check for duplicates. */ p = keep_msg; - keep_msg = NULL; msg_attr(p, keep_msg_attr); vim_free(p); } @@ -1323,20 +1339,22 @@ main_loop(cmdwin, noexmode) may_clear_sb_text(); /* clear scroll-back text on next msg */ showruler(FALSE); -# if defined(FEAT_CONCEAL) +#if defined(FEAT_CONCEAL) if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) || need_cursor_line_redraw)) { + mch_disable_flush(); /* Stop issuing gui_mch_flush(). */ if (conceal_old_cursor_line != conceal_new_cursor_line && conceal_old_cursor_line <= curbuf->b_ml.ml_line_count) update_single_line(curwin, conceal_old_cursor_line); update_single_line(curwin, conceal_new_cursor_line); + mch_enable_flush(); curwin->w_valid &= ~VALID_CROW; } -# endif +#endif setcursor(); cursor_on(); @@ -1386,7 +1404,22 @@ main_loop(cmdwin, noexmode) do_exmode(exmode_active == EXMODE_VIM); } else - normal_cmd(&oa, TRUE); + { +#ifdef FEAT_TERMINAL + if (term_use_loop() + && oa.op_type == OP_NOP && oa.regname == NUL + && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. With FAIL we first need to position the + * cursor and the screen needs to be redrawn. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else +#endif + normal_cmd(&oa, TRUE); + } #ifdef FEAT_GUI_MACVIM // TODO! Make sure there are no continue statements that will cause @@ -1397,14 +1430,12 @@ main_loop(cmdwin, noexmode) } -#if defined(USE_XSMP) || defined(FEAT_GUI_MSWIN) || defined(PROTO) \ - || defined(FEAT_GUI_MACVIM) +#if defined(USE_XSMP) || defined(FEAT_GUI) || defined(PROTO) /* * Exit, but leave behind swap files for modified buffers. */ void -getout_preserve_modified(exitval) - int exitval; +getout_preserve_modified(int exitval) { # if defined(SIGHUP) && defined(SIG_IGN) /* Ignore SIGHUP, because a dropped connection causes a read error, which @@ -1421,18 +1452,16 @@ getout_preserve_modified(exitval) #endif -/* Exit properly */ +/* + * Exit properly. + */ void -getout(exitval) - int exitval; +getout(int exitval) { -#ifdef FEAT_AUTOCMD - buf_T *buf; - win_T *wp; - tabpage_T *tp, *next_tp; -#endif - exiting = TRUE; +#if defined(FEAT_JOB_CHANNEL) + ch_log(NULL, "Exiting..."); +#endif /* When running in Ex mode an error causes us to exit with a non-zero exit * code. POSIX requires this, although it's not 100% clear from the @@ -1455,49 +1484,55 @@ getout(exitval) msg_didany = FALSE; #endif -#ifdef FEAT_AUTOCMD - if (get_vim_var_nr(VV_DYING) <= 1) + if (v_dying <= 1) { + tabpage_T *tp; + tabpage_T *next_tp; + buf_T *buf; + win_T *wp; + /* Trigger BufWinLeave for all windows, but only once per buffer. */ -# if defined FEAT_WINDOWS for (tp = first_tabpage; tp != NULL; tp = next_tp) { next_tp = tp->tp_next; - for (wp = (tp == curtab) - ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS_IN_TAB(tp, wp) { if (wp->w_buffer == NULL) /* Autocmd must have close the buffer already, skip. */ continue; buf = wp->w_buffer; - if (buf->b_changedtick != -1) + if (CHANGEDTICK(buf) != -1) { + bufref_T bufref; + + set_bufref(&bufref, buf); apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, FALSE, buf); - buf->b_changedtick = -1; /* note that we did it already */ + if (bufref_valid(&bufref)) + CHANGEDTICK(buf) = -1; /* note we did it already */ + /* start all over, autocommands may mess up the lists */ next_tp = first_tabpage; break; } } } -# else - apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname, - FALSE, curbuf); -# endif /* Trigger BufUnload for buffers that are loaded */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ml.ml_mfp != NULL) { + bufref_T bufref; + + set_bufref(&bufref, buf); apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf); - if (!buf_valid(buf)) /* autocmd may delete the buffer */ + if (!bufref_valid(&bufref)) + /* autocmd deleted the buffer */ break; } apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); } -#endif #ifdef FEAT_VIMINFO if (*p_viminfo != NUL) @@ -1505,10 +1540,8 @@ getout(exitval) write_viminfo(NULL, FALSE); #endif -#ifdef FEAT_AUTOCMD - if (get_vim_var_nr(VV_DYING) <= 1) + if (v_dying <= 1) apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf); -#endif #ifdef FEAT_PROFILE profile_dump(); @@ -1525,14 +1558,15 @@ getout(exitval) wait_return(FALSE); } -#ifdef FEAT_AUTOCMD /* Position the cursor again, the autocommands may have moved it */ -# ifdef FEAT_GUI +#ifdef FEAT_GUI if (!gui.in_use) -# endif - windgoto((int)Rows - 1, 0); #endif + windgoto((int)Rows - 1, 0); +#ifdef FEAT_JOB_CHANNEL + job_stop_on_exit(); +#endif #ifdef FEAT_LUA lua_end(); #endif @@ -1554,6 +1588,9 @@ getout(exitval) #ifdef FEAT_PERL perl_end(); #endif +#ifdef USE_MIGEMO + reset_migemo(TRUE); +#endif #if defined(USE_ICONV) && defined(DYNAMIC_ICONV) iconv_end(); #endif @@ -1568,10 +1605,157 @@ getout(exitval) #endif #ifdef FEAT_EVAL if (garbage_collect_at_exit) - garbage_collect(); + garbage_collect(FALSE); +#endif +#if defined(WIN32) && defined(FEAT_MBYTE) + free_cmd_argsW(); +#endif + + mch_exit(exitval); +} + +#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) +/* + * Setup to use the current locale (for ctype() and many other things). + */ + static void +init_locale(void) +{ + setlocale(LC_ALL, ""); + +# ifdef FEAT_GUI_GTK + /* Tell Gtk not to change our locale settings. */ + gtk_disable_setlocale(); +# endif +# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) + /* Make sure strtod() uses a decimal point, not a comma. */ + setlocale(LC_NUMERIC, "C"); +# endif + +# ifdef WIN32 + /* Apparently MS-Windows printf() may cause a crash when we give it 8-bit + * text while it's expecting text in the current locale. This call avoids + * that. */ + setlocale(LC_CTYPE, "C"); +# endif + +# ifdef FEAT_GETTEXT + { + int mustfree = FALSE; + char_u *p; + +# ifdef DYNAMIC_GETTEXT + /* Initialize the gettext library */ + dyn_libintl_init(); +# endif + /* expand_env() doesn't work yet, because g_chartab[] is not + * initialized yet, call vim_getenv() directly */ + p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); + if (p != NULL && *p != NUL) + { + vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); + bindtextdomain(VIMPACKAGE, (char *)NameBuff); + } + if (mustfree) + vim_free(p); + textdomain(VIMPACKAGE); + } +# endif +} #endif - mch_exit(exitval); +/* + * Get the name of the display, before gui_prepare() removes it from + * argv[]. Used for the xterm-clipboard display. + * + * Also find the --server... arguments and --socketid and --windowid + */ + static void +early_arg_scan(mparm_T *parmp UNUSED) +{ +#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \ + || !defined(FEAT_NETBEANS_INTG) + int argc = parmp->argc; + char **argv = parmp->argv; + int i; + + for (i = 1; i < argc; i++) + { + if (STRCMP(argv[i], "--") == 0) + break; +# ifdef FEAT_XCLIPBOARD + else if (STRICMP(argv[i], "-display") == 0 +# if defined(FEAT_GUI_GTK) + || STRICMP(argv[i], "--display") == 0 +# endif + ) + { + if (i == argc - 1) + mainerr_arg_missing((char_u *)argv[i]); + xterm_display = argv[++i]; + } +# endif +# ifdef FEAT_CLIENTSERVER + else if (STRICMP(argv[i], "--servername") == 0) + { + if (i == argc - 1) + mainerr_arg_missing((char_u *)argv[i]); + parmp->serverName_arg = (char_u *)argv[++i]; + } + else if (STRICMP(argv[i], "--serverlist") == 0) + parmp->serverArg = TRUE; + else if (STRNICMP(argv[i], "--remote", 8) == 0) + { + parmp->serverArg = TRUE; +# ifdef FEAT_GUI + if (strstr(argv[i], "-wait") != 0) + /* don't fork() when starting the GUI to edit files ourself */ + gui.dofork = FALSE; +# endif + } +# endif + +# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) +# ifdef FEAT_GUI_W32 + else if (STRICMP(argv[i], "--windowid") == 0) +# else + else if (STRICMP(argv[i], "--socketid") == 0) +# endif + { + long_u id; + int count; + + if (i == argc - 1) + mainerr_arg_missing((char_u *)argv[i]); + if (STRNICMP(argv[i+1], "0x", 2) == 0) + count = sscanf(&(argv[i + 1][2]), SCANF_HEX_LONG_U, &id); + else + count = sscanf(argv[i + 1], SCANF_DECIMAL_LONG_U, &id); + if (count != 1) + mainerr(ME_INVALID_ARG, (char_u *)argv[i]); + else +# ifdef FEAT_GUI_W32 + win_socket_id = id; +# else + gtk_socket_id = id; +# endif + i++; + } +# endif +# ifdef FEAT_GUI_GTK + else if (STRICMP(argv[i], "--echo-wid") == 0) + echo_wid_arg = TRUE; +# endif +# ifndef FEAT_NETBEANS_INTG + else if (strncmp(argv[i], "-nb", (size_t)3) == 0) + { + mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); + mch_exit(2); + } +# endif + + } +#endif } #ifndef NO_VIM_MAIN @@ -1579,10 +1763,10 @@ getout(exitval) * Get a (optional) count for a Vim argument. */ static int -get_number_arg(p, idx, def) - char_u *p; /* pointer to argument */ - int *idx; /* index in argument, is incremented */ - int def; /* default value */ +get_number_arg( + char_u *p, /* pointer to argument */ + int *idx, /* index in argument, is incremented */ + int def) /* default value */ { if (vim_isdigit(p[*idx])) { @@ -1593,56 +1777,6 @@ get_number_arg(p, idx, def) return def; } -#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) -/* - * Setup to use the current locale (for ctype() and many other things). - */ - static void -init_locale() -{ - setlocale(LC_ALL, ""); - -# ifdef FEAT_GUI_GTK - /* Tell Gtk not to change our locale settings. */ - gtk_disable_setlocale(); -# endif -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) - /* Make sure strtod() uses a decimal point, not a comma. */ - setlocale(LC_NUMERIC, "C"); -# endif - -# ifdef WIN32 - /* Apparently MS-Windows printf() may cause a crash when we give it 8-bit - * text while it's expecting text in the current locale. This call avoids - * that. */ - setlocale(LC_CTYPE, "C"); -# endif - -# ifdef FEAT_GETTEXT - { - int mustfree = FALSE; - char_u *p; - -# ifdef DYNAMIC_GETTEXT - /* Initialize the gettext library */ - dyn_libintl_init(NULL); -# endif - /* expand_env() doesn't work yet, because chartab[] is not initialized - * yet, call vim_getenv() directly */ - p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); - if (p != NULL && *p != NUL) - { - vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); - bindtextdomain(VIMPACKAGE, (char *)NameBuff); - } - if (mustfree) - vim_free(p); - textdomain(VIMPACKAGE); - } -# endif -} -#endif - /* * Check for: [r][e][g][vi|vim|view][diff][ex[im]] * If the executable name starts with "r" we disable shell commands. @@ -1654,14 +1788,13 @@ init_locale() * by "im" use improved Ex mode. */ static void -parse_command_name(parmp) - mparm_T *parmp; +parse_command_name(mparm_T *parmp) { char_u *initstr; initstr = gettail((char_u *)parmp->argv[0]); -#ifdef MACOS_X_UNIX +#ifdef FEAT_GUI_MAC /* An issue has been seen when launching Vim in such a way that * $PWD/$ARGV[0] or $ARGV[0] is not the absolute path to the * executable or a symbolic link of it. Until this issue is resolved @@ -1676,7 +1809,7 @@ parse_command_name(parmp) #ifdef FEAT_EVAL set_vim_var_string(VV_PROGNAME, initstr, -1); - set_vim_var_string(VV_PROGPATH, (char_u *)parmp->argv[0], -1); + set_progpath((char_u *)parmp->argv[0]); #endif if (TOLOWER_ASC(initstr[0]) == 'r') @@ -1738,107 +1871,11 @@ parse_command_name(parmp) } } -/* - * Get the name of the display, before gui_prepare() removes it from - * argv[]. Used for the xterm-clipboard display. - * - * Also find the --server... arguments and --socketid and --windowid - */ - static void -early_arg_scan(parmp) - mparm_T *parmp UNUSED; -{ -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \ - || !defined(FEAT_NETBEANS_INTG) - int argc = parmp->argc; - char **argv = parmp->argv; - int i; - - for (i = 1; i < argc; i++) - { - if (STRCMP(argv[i], "--") == 0) - break; -# ifdef FEAT_XCLIPBOARD - else if (STRICMP(argv[i], "-display") == 0 -# if defined(FEAT_GUI_GTK) - || STRICMP(argv[i], "--display") == 0 -# endif - ) - { - if (i == argc - 1) - mainerr_arg_missing((char_u *)argv[i]); - xterm_display = argv[++i]; - } -# endif -# ifdef FEAT_CLIENTSERVER - else if (STRICMP(argv[i], "--servername") == 0) - { - if (i == argc - 1) - mainerr_arg_missing((char_u *)argv[i]); - parmp->serverName_arg = (char_u *)argv[++i]; - } - else if (STRICMP(argv[i], "--serverlist") == 0) - parmp->serverArg = TRUE; - else if (STRNICMP(argv[i], "--remote", 8) == 0) - { - parmp->serverArg = TRUE; -# ifdef FEAT_GUI - if (strstr(argv[i], "-wait") != 0) - /* don't fork() when starting the GUI to edit files ourself */ - gui.dofork = FALSE; -# endif - } -# endif - -# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) -# ifdef FEAT_GUI_W32 - else if (STRICMP(argv[i], "--windowid") == 0) -# else - else if (STRICMP(argv[i], "--socketid") == 0) -# endif - { - long_u id; - int count; - - if (i == argc - 1) - mainerr_arg_missing((char_u *)argv[i]); - if (STRNICMP(argv[i+1], "0x", 2) == 0) - count = sscanf(&(argv[i + 1][2]), SCANF_HEX_LONG_U, &id); - else - count = sscanf(argv[i + 1], SCANF_DECIMAL_LONG_U, &id); - if (count != 1) - mainerr(ME_INVALID_ARG, (char_u *)argv[i]); - else -# ifdef FEAT_GUI_W32 - win_socket_id = id; -# else - gtk_socket_id = id; -# endif - i++; - } -# endif -# ifdef FEAT_GUI_GTK - else if (STRICMP(argv[i], "--echo-wid") == 0) - echo_wid_arg = TRUE; -# endif -# ifndef FEAT_NETBEANS_INTG - else if (strncmp(argv[i], "-nb", (size_t)3) == 0) - { - mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); - mch_exit(2); - } -# endif - - } -#endif -} - /* * Scan the command line arguments. */ static void -command_line_scan(parmp) - mparm_T *parmp; +command_line_scan(mparm_T *parmp) { int argc = parmp->argc; char **argv = parmp->argv; @@ -1907,8 +1944,11 @@ command_line_scan(parmp) case '-': /* "--" don't take any more option arguments */ /* "--help" give help message */ /* "--version" give version message */ + /* "--clean" clean context */ /* "--literal" take files literally */ /* "--nofork" don't fork */ + /* "--not-a-term" don't warn for not a term */ + /* "--ttyfail" exit if not a term */ /* "--noplugin[s]" skip plugins */ /* "--cmd <cmd>" execute cmd before vimrc */ if (STRICMP(argv[0] + argv_idx, "help") == 0) @@ -1922,9 +1962,18 @@ command_line_scan(parmp) msg_didout = FALSE; mch_exit(0); } + else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) + { + parmp->use_vimrc = (char_u *)"DEFAULTS"; +#ifdef FEAT_GUI + use_gvimrc = (char_u *)"NONE"; +#endif + parmp->clean = TRUE; + set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0); + } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) { -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) +#ifdef EXPAND_FILENAMES parmp->literal = TRUE; #endif } @@ -1936,6 +1985,10 @@ command_line_scan(parmp) } else if (STRNICMP(argv[0] + argv_idx, "noplugin", 8) == 0) p_lpl = FALSE; + else if (STRNICMP(argv[0] + argv_idx, "not-a-term", 10) == 0) + parmp->not_a_term = TRUE; + else if (STRNICMP(argv[0] + argv_idx, "ttyfail", 7) == 0) + parmp->tty_fail = TRUE; else if (STRNICMP(argv[0] + argv_idx, "cmd", 3) == 0) { want_argument = TRUE; @@ -2016,6 +2069,7 @@ command_line_scan(parmp) case 'C': /* "-C" Compatible */ change_compatible(TRUE); + has_dash_c_arg = TRUE; break; case 'e': /* "-e" Ex mode */ @@ -2047,6 +2101,7 @@ command_line_scan(parmp) #endif break; + case '?': /* "-?" give help message (for MS-Windows) */ case 'h': /* "-h" give help message */ #ifdef FEAT_GUI_GNOME /* Tell usage() to exit for "gvim". */ @@ -2116,30 +2171,24 @@ command_line_scan(parmp) break; } #endif -#ifdef FEAT_WINDOWS /* default is 0: open window for each file */ parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0); parmp->window_layout = WIN_TABS; -#endif break; case 'o': /* "-o[N]" open N horizontal split windows */ -#ifdef FEAT_WINDOWS /* default is 0: open window for each file */ parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0); parmp->window_layout = WIN_HOR; -#endif break; case 'O': /* "-O[N]" open N vertical split windows */ -#if defined(FEAT_VERTSPLIT) && defined(FEAT_WINDOWS) /* default is 0: open window for each file */ parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0); parmp->window_layout = WIN_VER; -#endif break; #ifdef FEAT_QUICKFIX @@ -2260,7 +2309,7 @@ command_line_scan(parmp) argv_idx = -1; break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'S': /* "-S {file}" execute Vim script */ case 'i': /* "-i {viminfo}" use for viminfo */ #ifndef FEAT_DIFF @@ -2355,7 +2404,7 @@ command_line_scan(parmp) #endif case 'i': /* "-i {viminfo}" use for viminfo */ - use_viminfo = (char_u *)argv[0]; + set_option_value((char_u *)"vif", 0L, (char_u *)argv[0], 0); break; case 's': /* "-s {scriptin}" read from script file */ @@ -2418,7 +2467,7 @@ command_line_scan(parmp) argv_idx = -1; break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'W': /* "-W {scriptout}" overwrite script file */ if (scriptout != NULL) goto scripterror; @@ -2487,10 +2536,10 @@ command_line_scan(parmp) */ if (vim_strpbrk(p, "\\:") != NULL && !path_with_url(p)) { - char posix_path[PATH_MAX]; + char posix_path[MAXPATHL]; # if CYGWIN_VERSION_DLL_MAJOR >= 1007 - cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, PATH_MAX); + cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, MAXPATHL); # else cygwin_conv_to_posix_path(p, posix_path); # endif @@ -2507,7 +2556,7 @@ command_line_scan(parmp) #endif alist_add(&global_alist, p, -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) +#ifdef EXPAND_FILENAMES parmp->literal ? 2 : 0 /* add buffer nr after exp. */ #else 2 /* add buffer number now and use curbuf */ @@ -2560,11 +2609,10 @@ command_line_scan(parmp) /* * Print a warning if stdout is not a terminal. - * When starting in Ex mode and commands come from a file, set Silent mode. + * When starting in Ex mode and commands come from a file, set silent_mode. */ static void -check_tty(parmp) - mparm_T *parmp; +check_tty(mparm_T *parmp) { int input_isatty; /* is active input a terminal? */ @@ -2574,12 +2622,12 @@ check_tty(parmp) if (!input_isatty) silent_mode = TRUE; } - else if (parmp->want_full_screen && (!parmp->stdout_isatty || !input_isatty) + else if (parmp->want_full_screen && (!stdout_isatty || !input_isatty) #ifdef FEAT_GUI /* don't want the delay when started from the desktop */ && !gui.starting #endif - ) + && !parmp->not_a_term) { #ifdef NBDEBUG /* @@ -2589,17 +2637,41 @@ check_tty(parmp) * input buffer so fast I can't even kill the process in under 2 * minutes (and it beeps continuously the whole time :-) */ - if (netbeans_active() && (!parmp->stdout_isatty || !input_isatty)) + if (netbeans_active() && (!stdout_isatty || !input_isatty)) { mch_errmsg(_("Vim: Error: Failure to start gvim from NetBeans\n")); exit(1); } #endif - if (!parmp->stdout_isatty) +#if defined(WIN3264) && !defined(FEAT_GUI_W32) + if (is_cygpty_used()) + { +# if defined(FEAT_MBYTE) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) \ + && defined(FEAT_GETTEXT) + char *s, *tofree = NULL; + + /* Set the encoding of the error message based on $LC_ALL or + * other environment variables instead of 'encoding'. + * Note that the message is shown on a Cygwin terminal (e.g. + * mintty) which encoding is based on $LC_ALL or etc., not the + * current codepage used by normal Win32 console programs. */ + tofree = s = (char *)enc_locale_env(NULL); + if (s == NULL) + s = "utf-8"; /* Use "utf-8" by default. */ + (void)bind_textdomain_codeset(VIMPACKAGE, s); + vim_free(tofree); +# endif + mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n")); + exit(1); + } +#endif + if (!stdout_isatty) mch_errmsg(_("Vim: Warning: Output is not to a terminal\n")); if (!input_isatty) mch_errmsg(_("Vim: Warning: Input is not from a terminal\n")); out_flush(); + if (parmp->tty_fail && (!stdout_isatty || !input_isatty)) + exit(1); if (scriptin[0] == NULL) ui_delay(2000L, TRUE); TIME_MSG("Warning delay"); @@ -2610,7 +2682,7 @@ check_tty(parmp) * Read text from stdin. */ static void -read_stdin() +read_stdin(void) { int i; @@ -2628,7 +2700,7 @@ read_stdin() #if defined(HAS_SWAP_EXISTS_ACTION) check_swap_exists_action(); #endif -#if !(defined(AMIGA) || defined(MACOS)) +#if !(defined(AMIGA) || defined(MACOS_X)) /* * Close stdin and dup it from stderr. Required for GPM to work * properly, and for running external commands. @@ -2644,10 +2716,8 @@ read_stdin() * Also does recovery if "recoverymode" set. */ static void -create_windows(parmp) - mparm_T *parmp UNUSED; +create_windows(mparm_T *parmp UNUSED) { -#ifdef FEAT_WINDOWS int dorewind; int done = 0; @@ -2680,7 +2750,6 @@ create_windows(parmp) } else parmp->window_count = 1; -#endif if (recoverymode) /* do recover */ { @@ -2697,14 +2766,11 @@ create_windows(parmp) * Commands in the .vimrc might have loaded a file or split the window. * Watch out for autocommands that delete a window. */ -#ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; -#endif -#ifdef FEAT_WINDOWS dorewind = TRUE; while (done++ < 1000) { @@ -2728,7 +2794,6 @@ create_windows(parmp) curwin = curwin->w_next; } dorewind = FALSE; -#endif curbuf = curwin->w_buffer; if (curbuf->b_ml.ml_mfp == NULL) { @@ -2765,11 +2830,8 @@ create_windows(parmp) else handle_swap_exists(NULL); #endif -#ifdef FEAT_AUTOCMD dorewind = TRUE; /* start again */ -#endif } -#ifdef FEAT_WINDOWS ui_breakcheck(); if (got_int) { @@ -2777,42 +2839,35 @@ create_windows(parmp) break; } } -#endif -#ifdef FEAT_WINDOWS if (parmp->window_layout == WIN_TABS) goto_tabpage(1); else curwin = firstwin; curbuf = curwin->w_buffer; -#endif -#ifdef FEAT_AUTOCMD --autocmd_no_enter; --autocmd_no_leave; -#endif } } -#ifdef FEAT_WINDOWS /* * If opened more than one window, start editing files in the other * windows. make_windows() has already opened the windows. */ static void -edit_buffers(parmp) - mparm_T *parmp; +edit_buffers( + mparm_T *parmp, + char_u *cwd) /* current working dir */ { int arg_idx; /* index in argument list */ int i; int advance = TRUE; win_T *win; -# ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; -# endif /* When w_arg_idx is -1 remove the window (see create_windows()). */ if (curwin->w_arg_idx == -1) @@ -2824,6 +2879,8 @@ edit_buffers(parmp) arg_idx = 1; for (i = 1; i < parmp->window_count; ++i) { + if (cwd != NULL) + mch_chdir((char *)cwd); /* When w_arg_idx is -1 remove the window (see create_windows()). */ if (curwin->w_arg_idx == -1) { @@ -2891,13 +2948,11 @@ edit_buffers(parmp) if (parmp->window_layout == WIN_TABS) goto_tabpage(1); -# ifdef FEAT_AUTOCMD --autocmd_no_enter; -# endif /* make the first window the current window */ win = firstwin; -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* Avoid making a preview window the current window. */ while (win->w_p_pvw) { @@ -2911,21 +2966,17 @@ edit_buffers(parmp) #endif win_enter(win, FALSE); -# ifdef FEAT_AUTOCMD --autocmd_no_leave; -# endif TIME_MSG("editing files in windows"); if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS) win_equal(curwin, FALSE, 'b'); /* adjust heights */ } -#endif /* FEAT_WINDOWS */ /* * Execute the commands from --cmd arguments "cmds[cnt]". */ static void -exe_pre_commands(parmp) - mparm_T *parmp; +exe_pre_commands(mparm_T *parmp) { char_u **cmds = parmp->pre_commands; int cnt = parmp->n_pre_commands; @@ -2952,8 +3003,7 @@ exe_pre_commands(parmp) * Execute "+", "-c" and "-S" arguments. */ static void -exe_commands(parmp) - mparm_T *parmp; +exe_commands(mparm_T *parmp) { int i; @@ -2997,8 +3047,7 @@ exe_commands(parmp) * Source startup scripts. */ static void -source_startup_scripts(parmp) - mparm_T *parmp; +source_startup_scripts(mparm_T *parmp) { int i; @@ -3018,15 +3067,15 @@ source_startup_scripts(parmp) */ if (parmp->use_vimrc != NULL) { - if (STRCMP(parmp->use_vimrc, "NONE") == 0 + if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) + do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE); + else if (STRCMP(parmp->use_vimrc, "NONE") == 0 || STRCMP(parmp->use_vimrc, "NORC") == 0) { #ifdef FEAT_GUI if (use_gvimrc == NULL) /* don't load gvimrc either */ use_gvimrc = parmp->use_vimrc; #endif - if (parmp->use_vimrc[2] == 'N') - p_lpl = FALSE; /* don't load plugins either */ } else { @@ -3080,11 +3129,14 @@ source_startup_scripts(parmp) DOSO_VIMRC) == FAIL #endif && process_env((char_u *)"EXINIT", FALSE) == FAIL - && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL) - { + && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL #ifdef USR_EXRC_FILE2 - (void)do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE); + && do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE) == FAIL #endif + && !has_dash_c_arg) + { + /* When no .vimrc file was found: source defaults.vim. */ + do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE); } } @@ -3092,7 +3144,7 @@ source_startup_scripts(parmp) * Read initialization commands from ".vimrc" or ".exrc" in current * directory. This is only done if the 'exrc' option is set. * Because of security reasons we disallow shell and write commands - * now, except for unix if the file is owned by the user or 'secure' + * now, except for Unix if the file is owned by the user or 'secure' * option has been reset in environment of global ".exrc" or ".vimrc". * Only do this if VIMRC_FILE is not the same as USR_VIMRC_FILE or * SYS_VIMRC_FILE. @@ -3156,7 +3208,7 @@ source_startup_scripts(parmp) * Setup to start using the GUI. Exit with an error when not available. */ static void -main_start_gui() +main_start_gui(void) { #ifdef FEAT_GUI gui.starting = TRUE; /* start GUI a bit later */ @@ -3174,9 +3226,9 @@ main_start_gui() * Returns FAIL if the environment variable was not executed, OK otherwise. */ int -process_env(env, is_viminit) - char_u *env; - int is_viminit; /* when TRUE, called for VIMINIT */ +process_env( + char_u *env, + int is_viminit) /* when TRUE, called for VIMINIT */ { char_u *initstr; char_u *save_sourcing_name; @@ -3201,7 +3253,7 @@ process_env(env, is_viminit) sourcing_name = save_sourcing_name; sourcing_lnum = save_sourcing_lnum; #ifdef FEAT_EVAL - current_SID = save_sid;; + current_SID = save_sid; #endif return OK; } @@ -3215,10 +3267,9 @@ process_env(env, is_viminit) * Use both stat() and lstat() for extra security. */ static int -file_owned(fname) - char *fname; +file_owned(char *fname) { - struct stat s; + stat_T s; # ifdef UNIX uid_t uid = getuid(); # else /* VMS */ @@ -3237,11 +3288,11 @@ file_owned(fname) * Give an error message main_errors["n"] and exit. */ static void -mainerr(n, str) - int n; /* one of the ME_ defines */ - char_u *str; /* extra argument or NULL */ +mainerr( + int n, /* one of the ME_ defines */ + char_u *str) /* extra argument or NULL */ { -#if defined(UNIX) || defined(__EMX__) || defined(VMS) +#if defined(UNIX) || defined(VMS) reset_signals(); /* kill us with CTRL-C here, if you like */ #endif @@ -3260,8 +3311,7 @@ mainerr(n, str) } void -mainerr_arg_missing(str) - char_u *str; +mainerr_arg_missing(char_u *str) { mainerr(ME_ARG_MISSING, str); } @@ -3271,8 +3321,7 @@ mainerr_arg_missing(str) * print a message with three spaces prepended and '\n' appended. */ static void -main_msg(s) - char *s; +main_msg(char *s) { mch_msg(" "); mch_msg(s); @@ -3283,7 +3332,7 @@ main_msg(s) * Print messages for "vim -h" or "vim --help" and exit. */ static void -usage() +usage(void) { int i; static char *(use[]) = @@ -3296,7 +3345,7 @@ usage() #endif }; -#if defined(UNIX) || defined(__EMX__) || defined(VMS) +#if defined(UNIX) || defined(VMS) reset_signals(); /* kill us with CTRL-C here, if you like */ #endif @@ -3316,7 +3365,7 @@ usage() mch_msg(_("\n\nArguments:\n")); main_msg(_("--\t\t\tOnly file names after this")); -#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) +#ifdef EXPAND_FILENAMES main_msg(_("--literal\t\tDon't expand wildcards")); #endif #ifdef FEAT_OLE @@ -3367,16 +3416,16 @@ usage() main_msg(_("-F\t\t\tStart in Farsi mode")); #endif main_msg(_("-T <terminal>\tSet terminal type to <terminal>")); + main_msg(_("--not-a-term\t\tSkip warning for input/output not being a terminal")); + main_msg(_("--ttyfail\t\tExit if input or output is not a terminal")); main_msg(_("-u <vimrc>\t\tUse <vimrc> instead of any .vimrc")); #ifdef FEAT_GUI main_msg(_("-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc")); #endif main_msg(_("--noplugin\t\tDon't load plugin scripts")); -#ifdef FEAT_WINDOWS main_msg(_("-p[N]\t\tOpen N tab pages (default: one for each file)")); main_msg(_("-o[N]\t\tOpen N windows (default: one for each file)")); main_msg(_("-O[N]\t\tLike -o but split vertically")); -#endif main_msg(_("+\t\t\tStart at end of file")); main_msg(_("+<lnum>\t\tStart at line <lnum>")); main_msg(_("--cmd <command>\tExecute <command> before loading any vimrc file")); @@ -3399,9 +3448,7 @@ usage() main_msg(_("--remote-silent <files> Same, don't complain if there is no server")); main_msg(_("--remote-wait <files> As --remote but wait for files to have been edited")); main_msg(_("--remote-wait-silent <files> Same, don't complain if there is no server")); -# ifdef FEAT_WINDOWS main_msg(_("--remote-tab[-wait][-silent] <files> As --remote but use tab page per file")); -# endif main_msg(_("--remote-send <keys>\tSend <keys> to a Vim server and exit")); main_msg(_("--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result")); main_msg(_("--serverlist\t\tList available Vim server names and exit")); @@ -3413,6 +3460,7 @@ usage() #ifdef FEAT_VIMINFO main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo")); #endif + main_msg(_("--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo")); main_msg(_("-h or --help\tPrint Help (this message) and exit")); main_msg(_("--version\t\tPrint version information and exit")); @@ -3479,7 +3527,7 @@ usage() * When "Recover" selected, recover the file. */ static void -check_swap_exists_action() +check_swap_exists_action(void) { if (swap_exists_action == SEA_QUIT) getout(1); @@ -3487,10 +3535,10 @@ check_swap_exists_action() } #endif -#endif +#endif /* NO_VIM_MAIN */ #if defined(STARTUPTIME) || defined(PROTO) -static void time_diff __ARGS((struct timeval *then, struct timeval *now)); +static void time_diff(struct timeval *then, struct timeval *now); static struct timeval prev_timeval; @@ -3513,8 +3561,7 @@ gettimeofday(struct timeval *tv, char *dummy) * set "*tv_rel" to the time elapsed so far. */ void -time_push(tv_rel, tv_start) - void *tv_rel, *tv_start; +time_push(void *tv_rel, void *tv_start) { *((struct timeval *)tv_rel) = prev_timeval; gettimeofday(&prev_timeval, NULL); @@ -3537,8 +3584,8 @@ time_push(tv_rel, tv_start) * have struct timeval. */ void -time_pop(tp) - void *tp; /* actually (struct timeval *) */ +time_pop( + void *tp) /* actually (struct timeval *) */ { prev_timeval.tv_usec -= ((struct timeval *)tp)->tv_usec; prev_timeval.tv_sec -= ((struct timeval *)tp)->tv_sec; @@ -3550,9 +3597,7 @@ time_pop(tp) } static void -time_diff(then, now) - struct timeval *then; - struct timeval *now; +time_diff(struct timeval *then, struct timeval *now) { long usec; long msec; @@ -3564,9 +3609,9 @@ time_diff(then, now) } void -time_msg(mesg, tv_start) - char *mesg; - void *tv_start; /* only for do_source: start time; actually +time_msg( + char *mesg, + void *tv_start) /* only for do_source: start time; actually (struct timeval *) */ { static struct timeval start; @@ -3598,20 +3643,65 @@ time_msg(mesg, tv_start) #endif +#if !defined(NO_VIM_MAIN) && defined(FEAT_EVAL) + static void +set_progpath(char_u *argv0) +{ + char_u *val = argv0; + +# if defined(WIN32) + /* A relative path containing a "/" will become invalid when using ":cd", + * turn it into a full path. + * On MS-Windows "vim" should be expanded to "vim.exe", thus always do + * this. */ + char_u *path = NULL; + + if (mch_can_exe(argv0, &path, FALSE) && path != NULL) + val = path; +# else + char_u buf[MAXPATHL + 1]; +# ifdef PROC_EXE_LINK + char linkbuf[MAXPATHL + 1]; + ssize_t len; + + len = readlink(PROC_EXE_LINK, linkbuf, MAXPATHL); + if (len > 0) + { + linkbuf[len] = NUL; + val = (char_u *)linkbuf; + } +# endif + + if (!mch_isFullName(val)) + { + if (gettail(val) != val + && vim_FullName(val, buf, MAXPATHL, TRUE) != FAIL) + val = buf; + } +# endif + + set_vim_var_string(VV_PROGPATH, val, -1); + +# ifdef WIN32 + vim_free(path); +# endif +} + +#endif /* NO_VIM_MAIN */ + #if (defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN)) || defined(PROTO) /* * Common code for the X command server and the Win32 command server. */ -static char_u *build_drop_cmd __ARGS((int filec, char **filev, int tabs, int sendReply)); +static char_u *build_drop_cmd(int filec, char **filev, int tabs, int sendReply); /* * Do the client-server stuff, unless "--servername ''" was used. */ static void -exec_on_server(parmp) - mparm_T *parmp; +exec_on_server(mparm_T *parmp) { if (parmp->serverName_arg == NULL || *parmp->serverName_arg != NUL) { @@ -3653,19 +3743,24 @@ exec_on_server(parmp) * Prepare for running as a Vim server. */ static void -prepare_server(parmp) - mparm_T *parmp; +prepare_server(mparm_T *parmp) { # if defined(FEAT_X11) /* * Register for remote command execution with :serversend and --remote * unless there was a -X or a --servername '' on the command line. - * Only register nongui-vim's with an explicit --servername argument. + * Only register nongui-vim's with an explicit --servername argument, + * or when compiling with autoservername. * When running as root --servername is also required. */ if (X_DISPLAY != NULL && parmp->servername != NULL && ( -# ifdef FEAT_GUI - (gui.in_use +# if defined(FEAT_AUTOSERVERNAME) || defined(FEAT_GUI) + ( +# if defined(FEAT_AUTOSERVERNAME) + 1 +# else + gui.in_use +# endif # ifdef UNIX && getuid() != ROOT_UID # endif @@ -3696,11 +3791,11 @@ prepare_server(parmp) } static void -cmdsrv_main(argc, argv, serverName_arg, serverStr) - int *argc; - char **argv; - char_u *serverName_arg; - char_u **serverStr; +cmdsrv_main( + int *argc, + char **argv, + char_u *serverName_arg, + char_u **serverStr) { char_u *res; int i; @@ -3813,10 +3908,10 @@ cmdsrv_main(argc, argv, serverName_arg, serverStr) } else ret = serverSendToVim(xterm_dpy, sname, *serverStr, - NULL, &srv, 0, 0, silent); -# elif defined(WIN32) || defined(MAC_CLIENTSERVER) + NULL, &srv, 0, 0, 0, silent); +# else /* Win32 always works? */ - ret = serverSendToVim(sname, *serverStr, NULL, &srv, 0, silent); + ret = serverSendToVim(sname, *serverStr, NULL, &srv, 0, 0, silent); # endif if (ret < 0) { @@ -3876,15 +3971,15 @@ cmdsrv_main(argc, argv, serverName_arg, serverStr) while (memchr(done, 0, numFiles) != NULL) { # ifdef WIN32 - p = serverGetReply(srv, NULL, TRUE, TRUE); + p = serverGetReply(srv, NULL, TRUE, TRUE, 0); if (p == NULL) break; -# elif defined(FEAT_X11) - if (serverReadReply(xterm_dpy, srv, &p, TRUE) < 0) - break; # elif defined(MAC_CLIENTSERVER) if (serverReadReply(srv, &p) < 0) break; +# else + if (serverReadReply(xterm_dpy, srv, &p, TRUE, -1) < 0) + break; # endif j = atoi((char *)p); if (j >= 0 && j < numFiles) @@ -3907,26 +4002,22 @@ cmdsrv_main(argc, argv, serverName_arg, serverStr) { if (i == *argc - 1) mainerr_arg_missing((char_u *)argv[i]); -# ifdef WIN32 +# if defined(WIN32) || defined(MAC_CLIENTSERVER) /* Win32 always works? */ if (serverSendToVim(sname, (char_u *)argv[i + 1], - &res, NULL, 1, FALSE) < 0) -# elif defined(FEAT_X11) + &res, NULL, 1, 0, FALSE) < 0) +# else if (xterm_dpy == NULL) mch_errmsg(_("No display: Send expression failed.\n")); else if (serverSendToVim(xterm_dpy, sname, (char_u *)argv[i + 1], - &res, NULL, 1, 1, FALSE) < 0) -# elif defined(MAC_CLIENTSERVER) - if (serverSendToVim(sname, (char_u *)argv[i + 1], - &res, NULL, 1, FALSE) < 0) + &res, NULL, 1, 0, 1, FALSE) < 0) # endif { if (res != NULL && *res != NUL) { /* Output error from remote */ mch_errmsg((char *)res); - vim_free(res); - res = NULL; + VIM_CLEAR(res); } mch_errmsg(_(": Send expression failed.\n")); } @@ -3980,16 +4071,17 @@ cmdsrv_main(argc, argv, serverName_arg, serverStr) * Build a ":drop" command to send to a Vim server. */ static char_u * -build_drop_cmd(filec, filev, tabs, sendReply) - int filec; - char **filev; - int tabs; /* Use ":tab drop" instead of ":drop". */ - int sendReply; +build_drop_cmd( + int filec, + char **filev, + int tabs, /* Use ":tab drop" instead of ":drop". */ + int sendReply) { garray_T ga; int i; char_u *inicmd = NULL; char_u *p; + char_u *cdp; char_u *cwd; if (filec > 0 && filev[0][0] == '+') @@ -4011,20 +4103,19 @@ build_drop_cmd(filec, filev, tabs, sendReply) vim_free(cwd); return NULL; } - p = vim_strsave_escaped_ext(cwd, + cdp = vim_strsave_escaped_ext(cwd, #ifdef BACKSLASH_IN_FILENAME - "", /* rem_backslash() will tell what chars to escape */ + (char_u *)"", /* rem_backslash() will tell what chars to escape */ #else PATH_ESC_CHARS, #endif '\\', TRUE); vim_free(cwd); - if (p == NULL) + if (cdp == NULL) return NULL; ga_init2(&ga, 1, 100); ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); - ga_concat(&ga, p); - vim_free(p); + ga_concat(&ga, cdp); /* Call inputsave() so that a prompt for an encryption key works. */ ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|"); @@ -4060,8 +4151,21 @@ build_drop_cmd(filec, filev, tabs, sendReply) /* Switch back to the correct current directory (prior to temporary path * switch) unless 'autochdir' is set, in which case it will already be - * correct after the :drop command. */ - ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>"); + * correct after the :drop command. With line breaks and spaces: + * if !exists('+acd') || !&acd + * if haslocaldir() + * cd - + * lcd - + * elseif getcwd() ==# 'current path' + * cd - + * endif + * endif + */ + ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|"); + ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# '"); + ga_concat(&ga, cdp); + ga_concat(&ga, (char_u *)"'|cd -|endif|endif<CR>"); + vim_free(cdp); if (sendReply) ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>"); @@ -4087,9 +4191,7 @@ build_drop_cmd(filec, filev, tabs, sendReply) * Return the name in allocated memory. This doesn't include a serial number. */ static char_u * -serverMakeName(arg, cmd) - char_u *arg; - char *cmd; +serverMakeName(char_u *arg, char *cmd) { char_u *p; @@ -4111,8 +4213,7 @@ serverMakeName(arg, cmd) * Replace termcodes such as <CR> and insert as key presses if there is room. */ void -server_to_input_buf(str) - char_u *str; +server_to_input_buf(char_u *str) { char_u *ptr = NULL; char_u *cpo_save = p_cpo; @@ -4153,12 +4254,17 @@ server_to_input_buf(str) * Evaluate an expression that the client sent to a string. */ char_u * -eval_client_expr_to_string(expr) - char_u *expr; +eval_client_expr_to_string(char_u *expr) { char_u *res; int save_dbl = debug_break_level; int save_ro = redir_off; + void *fc = NULL; + + /* Evaluate the expression at the toplevel, don't use variables local to + * the calling function. Except when in debug mode. */ + if (!debug_mode) + fc = clear_current_funccal(); /* Disable debugging, otherwise Vim hangs, waiting for "cont" to be * typed. */ @@ -4175,29 +4281,62 @@ eval_client_expr_to_string(expr) --emsg_silent; if (emsg_silent < 0) emsg_silent = 0; + if (fc != NULL) + restore_current_funccal(fc); /* A client can tell us to redraw, but not to display the cursor, so do * that here. */ setcursor(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - gui_update_cursor(FALSE, FALSE); -#endif + out_flush_cursor(FALSE, FALSE); return res; } +/* + * Evaluate a command or expression sent to ourselves. + */ + int +sendToLocalVim(char_u *cmd, int asExpr, char_u **result) +{ + if (asExpr) + { + char_u *ret; + + ret = eval_client_expr_to_string(cmd); + if (result != NULL) + { + if (ret == NULL) + { + char *err = _(e_invexprmsg); + size_t len = STRLEN(cmd) + STRLEN(err) + 5; + char_u *msg; + + msg = alloc((unsigned)len); + if (msg != NULL) + vim_snprintf((char *)msg, len, "%s: \"%s\"", err, cmd); + *result = msg; + } + else + *result = ret; + } + else + vim_free(ret); + return ret == NULL ? -1 : 0; + } + server_to_input_buf(cmd); + return 0; +} + /* * If conversion is needed, convert "data" from "client_enc" to 'encoding' and * return an allocated string. Otherwise return "data". * "*tofree" is set to the result when it needs to be freed later. */ char_u * -serverConvert(client_enc, data, tofree) - char_u *client_enc UNUSED; - char_u *data; - char_u **tofree; +serverConvert( + char_u *client_enc UNUSED, + char_u *data, + char_u **tofree) { char_u *res = data; @@ -4223,17 +4362,3 @@ serverConvert(client_enc, data, tofree) return res; } #endif - -/* - * When FEAT_FKMAP is defined, also compile the Farsi source code. - */ -#if defined(FEAT_FKMAP) || defined(PROTO) -# include "farsi.c" -#endif - -/* - * When FEAT_ARABIC is defined, also compile the Arabic source code. - */ -#if defined(FEAT_ARABIC) || defined(PROTO) -# include "arabic.c" -#endif diff --git a/src/mark.c b/src/mark.c index ef9ddc07ea..dd714d800d 100644 --- a/src/mark.c +++ b/src/mark.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -27,24 +27,21 @@ #define EXTRA_MARKS 10 /* marks 0-9 */ static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */ -static void fname2fnum __ARGS((xfmark_T *fm)); -static void fmarks_check_one __ARGS((xfmark_T *fm, char_u *name, buf_T *buf)); -static char_u *mark_line __ARGS((pos_T *mp, int lead_len)); -static void show_one_mark __ARGS((int, char_u *, pos_T *, char_u *, int current)); -#ifdef FEAT_JUMPLIST -static void cleanup_jumplist __ARGS((void)); -#endif +static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf); +static char_u *mark_line(pos_T *mp, int lead_len); +static void show_one_mark(int, char_u *, pos_T *, char_u *, int current); #ifdef FEAT_VIMINFO -static void write_one_filemark __ARGS((FILE *fp, xfmark_T *fm, int c1, int c2)); +static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2); #endif +static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, + long amount_after, int adjust_folds); /* * Set named mark "c" at current cursor position. * Returns OK on success, FAIL if bad name given. */ int -setmark(c) - int c; +setmark(int c) { return setmark_pos(c, &curwin->w_cursor, curbuf->b_fnum); } @@ -55,12 +52,10 @@ setmark(c) * Returns OK on success, FAIL if bad name given. */ int -setmark_pos(c, pos, fnum) - int c; - pos_T *pos; - int fnum; +setmark_pos(int c, pos_T *pos, int fnum) { int i; + buf_T *buf; /* Check for a special key (may cause islower() to crash). */ if (c < 0) @@ -79,9 +74,13 @@ setmark_pos(c, pos, fnum) return OK; } + buf = buflist_findnr(fnum); + if (buf == NULL) + return FAIL; + if (c == '"') { - curbuf->b_last_cursor = *pos; + buf->b_last_cursor = *pos; return OK; } @@ -89,45 +88,45 @@ setmark_pos(c, pos, fnum) * file. */ if (c == '[') { - curbuf->b_op_start = *pos; + buf->b_op_start = *pos; return OK; } if (c == ']') { - curbuf->b_op_end = *pos; + buf->b_op_end = *pos; return OK; } if (c == '<' || c == '>') { if (c == '<') - curbuf->b_visual.vi_start = *pos; + buf->b_visual.vi_start = *pos; else - curbuf->b_visual.vi_end = *pos; - if (curbuf->b_visual.vi_mode == NUL) + buf->b_visual.vi_end = *pos; + if (buf->b_visual.vi_mode == NUL) /* Visual_mode has not yet been set, use a sane default. */ - curbuf->b_visual.vi_mode = 'v'; + buf->b_visual.vi_mode = 'v'; return OK; } -#ifndef EBCDIC - if (c > 'z') /* some islower() and isupper() cannot handle - characters above 127 */ - return FAIL; -#endif - if (islower(c)) + if (ASCII_ISLOWER(c)) { i = c - 'a'; - curbuf->b_namedm[i] = *pos; + buf->b_namedm[i] = *pos; return OK; } - if (isupper(c)) + if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) { - i = c - 'A'; + if (VIM_ISDIGIT(c)) + i = c - '0' + NMARKS; + else + i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; - vim_free(namedfm[i].fname); - namedfm[i].fname = NULL; + VIM_CLEAR(namedfm[i].fname); +#ifdef FEAT_VIMINFO + namedfm[i].time_set = vim_time(); +#endif return OK; } return FAIL; @@ -138,7 +137,7 @@ setmark_pos(c, pos, fnum) * jump list. */ void -setpcmark() +setpcmark(void) { #ifdef FEAT_JUMPLIST int i; @@ -188,6 +187,9 @@ setpcmark() fm->fmark.mark = curwin->w_pcmark; fm->fmark.fnum = curbuf->b_fnum; fm->fname = NULL; +# ifdef FEAT_VIMINFO + fm->time_set = vim_time(); +# endif #endif } @@ -198,10 +200,10 @@ setpcmark() * If pcmark was deleted (with "dG") the previous mark is restored. */ void -checkpcmark() +checkpcmark(void) { if (curwin->w_prev_pcmark.lnum != 0 - && (equalpos(curwin->w_pcmark, curwin->w_cursor) + && (EQUAL_POS(curwin->w_pcmark, curwin->w_cursor) || curwin->w_pcmark.lnum == 0)) { curwin->w_pcmark = curwin->w_prev_pcmark; @@ -214,13 +216,12 @@ checkpcmark() * move "count" positions in the jump list (count may be negative) */ pos_T * -movemark(count) - int count; +movemark(int count) { pos_T *pos; xfmark_T *jmp; - cleanup_jumplist(); + cleanup_jumplist(curwin, TRUE); if (curwin->w_jumplistlen == 0) /* nothing to jump to */ return (pos_T *)NULL; @@ -274,8 +275,7 @@ movemark(count) * Move "count" positions in the changelist (count may be negative). */ pos_T * -movechangelist(count) - int count; +movechangelist(int count) { int n; @@ -314,28 +314,23 @@ movechangelist(count) * - -1 if mark is in other file and jumped there (only if changefile is TRUE) */ pos_T * -getmark_buf(buf, c, changefile) - buf_T *buf; - int c; - int changefile; +getmark_buf(buf_T *buf, int c, int changefile) { return getmark_buf_fnum(buf, c, changefile, NULL); } pos_T * -getmark(c, changefile) - int c; - int changefile; +getmark(int c, int changefile) { return getmark_buf_fnum(curbuf, c, changefile, NULL); } pos_T * -getmark_buf_fnum(buf, c, changefile, fnum) - buf_T *buf; - int c; - int changefile; - int *fnum; +getmark_buf_fnum( + buf_T *buf, + int c, + int changefile, + int *fnum) { pos_T *posp; pos_T *startp, *endp; @@ -403,7 +398,8 @@ getmark_buf_fnum(buf, c, changefile, fnum) { startp = &buf->b_visual.vi_start; endp = &buf->b_visual.vi_end; - if ((c == '<') == lt(*startp, *endp)) + if (((c == '<') == LT_POS(*startp, *endp) || endp->lnum == 0) + && startp->lnum != 0) posp = startp; else posp = endp; @@ -472,10 +468,10 @@ getmark_buf_fnum(buf, c, changefile, fnum) * Returns pointer to pos_T of the next mark or NULL if no mark is found. */ pos_T * -getnextmark(startpos, dir, begin_line) - pos_T *startpos; /* where to start */ - int dir; /* direction for search */ - int begin_line; +getnextmark( + pos_T *startpos, /* where to start */ + int dir, /* direction for search */ + int begin_line) { int i; pos_T *result = NULL; @@ -498,14 +494,14 @@ getnextmark(startpos, dir, begin_line) { if (dir == FORWARD) { - if ((result == NULL || lt(curbuf->b_namedm[i], *result)) - && lt(pos, curbuf->b_namedm[i])) + if ((result == NULL || LT_POS(curbuf->b_namedm[i], *result)) + && LT_POS(pos, curbuf->b_namedm[i])) result = &curbuf->b_namedm[i]; } else { - if ((result == NULL || lt(*result, curbuf->b_namedm[i])) - && lt(curbuf->b_namedm[i], pos)) + if ((result == NULL || LT_POS(*result, curbuf->b_namedm[i])) + && LT_POS(curbuf->b_namedm[i], pos)) result = &curbuf->b_namedm[i]; } } @@ -519,9 +515,8 @@ getnextmark(startpos, dir, begin_line) * This is used for marks obtained from the .viminfo file. It's postponed * until the mark is used to avoid a long startup delay. */ - static void -fname2fnum(fm) - xfmark_T *fm; + void +fname2fnum(xfmark_T *fm) { char_u *p; @@ -561,8 +556,7 @@ fname2fnum(fm) * Used for marks that come from the .viminfo file. */ void -fmarks_check_names(buf) - buf_T *buf; +fmarks_check_names(buf_T *buf) { char_u *name; int i; @@ -592,18 +586,14 @@ fmarks_check_names(buf) } static void -fmarks_check_one(fm, name, buf) - xfmark_T *fm; - char_u *name; - buf_T *buf; +fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf) { if (fm->fmark.fnum == 0 && fm->fname != NULL && fnamecmp(name, fm->fname) == 0) { fm->fmark.fnum = buf->b_fnum; - vim_free(fm->fname); - fm->fname = NULL; + VIM_CLEAR(fm->fname); } } @@ -612,8 +602,7 @@ fmarks_check_one(fm, name, buf) * Give and error message and return FAIL if not. */ int -check_mark(pos) - pos_T *pos; +check_mark(pos_T *pos) { if (pos == NULL) { @@ -642,8 +631,7 @@ check_mark(pos) * Used mainly when trashing the entire buffer during ":e" type commands */ void -clrallmarks(buf) - buf_T *buf; +clrallmarks(buf_T *buf) { static int i = -1; @@ -652,6 +640,9 @@ clrallmarks(buf) { namedfm[i].fmark.mark.lnum = 0; namedfm[i].fname = NULL; +#ifdef FEAT_VIMINFO + namedfm[i].time_set = 0; +#endif } for (i = 0; i < NMARKS; i++) @@ -676,9 +667,7 @@ clrallmarks(buf) * Returns an allocated string. */ char_u * -fm_getname(fmark, lead_len) - fmark_T *fmark; - int lead_len; +fm_getname(fmark_T *fmark, int lead_len) { if (fmark->fnum == curbuf->b_fnum) /* current buffer */ return mark_line(&(fmark->mark), lead_len); @@ -690,9 +679,7 @@ fm_getname(fmark, lead_len) * The returned string has been allocated. */ static char_u * -mark_line(mp, lead_len) - pos_T *mp; - int lead_len; +mark_line(pos_T *mp, int lead_len) { char_u *s, *p; int len; @@ -704,7 +691,7 @@ mark_line(mp, lead_len) return NULL; /* Truncate the line to fit it in the window */ len = 0; - for (p = s; *p != NUL; mb_ptr_adv(p)) + for (p = s; *p != NUL; MB_PTR_ADV(p)) { len += ptr2cells(p); if (len >= Columns - lead_len) @@ -718,8 +705,7 @@ mark_line(mp, lead_len) * print the marks */ void -do_marks(eap) - exarg_T *eap; +do_marks(exarg_T *eap) { char_u *arg = eap->arg; int i; @@ -757,12 +743,12 @@ do_marks(eap) } static void -show_one_mark(c, arg, p, name, current) - int c; - char_u *arg; - pos_T *p; - char_u *name; - int current; /* in current file */ +show_one_mark( + int c, + char_u *arg, + pos_T *p, + char_u *name, + int current) /* in current file */ { static int did_title = FALSE; int mustfree = FALSE; @@ -802,7 +788,7 @@ show_one_mark(c, arg, p, name, current) } if (name != NULL) { - msg_outtrans_attr(name, current ? hl_attr(HLF_D) : 0); + msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0); if (mustfree) vim_free(name); } @@ -815,8 +801,7 @@ show_one_mark(c, arg, p, name, current) * ":delmarks[!] [marks]" */ void -ex_delmarks(eap) - exarg_T *eap; +ex_delmarks(exarg_T *eap) { char_u *p; int from, to; @@ -871,8 +856,10 @@ ex_delmarks(eap) else n = i - 'A'; namedfm[n].fmark.mark.lnum = 0; - vim_free(namedfm[n].fname); - namedfm[n].fname = NULL; + VIM_CLEAR(namedfm[n].fname); +#ifdef FEAT_VIMINFO + namedfm[n].time_set = 0; +#endif } } } @@ -899,21 +886,19 @@ ex_delmarks(eap) * print the jumplist */ void -ex_jumps(eap) - exarg_T *eap UNUSED; +ex_jumps(exarg_T *eap UNUSED) { int i; char_u *name; - cleanup_jumplist(); + cleanup_jumplist(curwin, TRUE); + /* Highlight title */ MSG_PUTS_TITLE(_("\n jump line col file/text")); for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) { if (curwin->w_jumplist[i].fmark.mark.lnum != 0) { - if (curwin->w_jumplist[i].fmark.fnum == 0) - fname2fnum(&curwin->w_jumplist[i]); name = fm_getname(&curwin->w_jumplist[i].fmark, 16); if (name == NULL) /* file name not available */ continue; @@ -933,7 +918,7 @@ ex_jumps(eap) msg_outtrans(IObuff); msg_outtrans_attr(name, curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum - ? hl_attr(HLF_D) : 0); + ? HL_ATTR(HLF_D) : 0); vim_free(name); ui_breakcheck(); } @@ -943,12 +928,19 @@ ex_jumps(eap) MSG_PUTS("\n>"); } + void +ex_clearjumps(exarg_T *eap UNUSED) +{ + free_jumplist(curwin); + curwin->w_jumplistlen = 0; + curwin->w_jumplistidx = 0; +} + /* * print the changelist */ void -ex_changes(eap) - exarg_T *eap UNUSED; +ex_changes(exarg_T *eap UNUSED) { int i; char_u *name; @@ -973,7 +965,7 @@ ex_changes(eap) name = mark_line(&curbuf->b_changelist[i], 17); if (name == NULL) break; - msg_outtrans_attr(name, hl_attr(HLF_D)); + msg_outtrans_attr(name, HL_ATTR(HLF_D)); vim_free(name); ui_breakcheck(); } @@ -1025,19 +1017,38 @@ ex_changes(eap) * or: mark_adjust(56, 55, MAXLNUM, 2); */ void -mark_adjust(line1, line2, amount, amount_after) - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; +mark_adjust( + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) +{ + mark_adjust_internal(line1, line2, amount, amount_after, TRUE); +} + + void +mark_adjust_nofold( + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) +{ + mark_adjust_internal(line1, line2, amount, amount_after, FALSE); +} + + static void +mark_adjust_internal( + linenr_T line1, + linenr_T line2, + long amount, + long amount_after, + int adjust_folds UNUSED) { int i; int fnum = curbuf->b_fnum; linenr_T *lp; win_T *win; -#ifdef FEAT_WINDOWS tabpage_T *tab; -#endif static pos_T initpos = INIT_POS_T(1, 0, 0); if (line2 < line1 && amount_after == 0L) /* nothing to do */ @@ -1065,7 +1076,7 @@ mark_adjust(line1, line2, amount, amount_after) one_adjust(&(curbuf->b_last_change.lnum)); /* last cursor position, if it was set */ - if (!equalpos(curbuf->b_last_cursor, initpos)) + if (!EQUAL_POS(curbuf->b_last_cursor, initpos)) one_adjust(&(curbuf->b_last_cursor.lnum)); @@ -1176,7 +1187,8 @@ mark_adjust(line1, line2, amount, amount_after) #ifdef FEAT_FOLDING /* adjust folds */ - foldMarkAdjust(win, line1, line2, amount, amount_after); + if (adjust_folds) + foldMarkAdjust(win, line1, line2, amount, amount_after); #endif } } @@ -1207,11 +1219,11 @@ mark_adjust(line1, line2, amount, amount_after) * position. */ void -mark_col_adjust(lnum, mincol, lnum_amount, col_amount) - linenr_T lnum; - colnr_T mincol; - long lnum_amount; - long col_amount; +mark_col_adjust( + linenr_T lnum, + colnr_T mincol, + long lnum_amount, + long col_amount) { int i; int fnum = curbuf->b_fnum; @@ -1288,44 +1300,56 @@ mark_col_adjust(lnum, mincol, lnum_amount, col_amount) #ifdef FEAT_JUMPLIST /* * When deleting lines, this may create duplicate marks in the - * jumplist. They will be removed here for the current window. + * jumplist. They will be removed here for the specified window. + * When "loadfiles" is TRUE first ensure entries have the "fnum" field set + * (this may be a bit slow). */ - static void -cleanup_jumplist() + void +cleanup_jumplist(win_T *wp, int loadfiles) { int i; int from, to; + if (loadfiles) + { + /* If specified, load all the files from the jump list. This is + * needed to properly clean up duplicate entries, but will take some + * time. */ + for (i = 0; i < wp->w_jumplistlen; ++i) + { + if ((wp->w_jumplist[i].fmark.fnum == 0) && + (wp->w_jumplist[i].fmark.mark.lnum != 0)) + fname2fnum(&wp->w_jumplist[i]); + } + } + to = 0; - for (from = 0; from < curwin->w_jumplistlen; ++from) + for (from = 0; from < wp->w_jumplistlen; ++from) { - if (curwin->w_jumplistidx == from) - curwin->w_jumplistidx = to; - for (i = from + 1; i < curwin->w_jumplistlen; ++i) - if (curwin->w_jumplist[i].fmark.fnum - == curwin->w_jumplist[from].fmark.fnum - && curwin->w_jumplist[from].fmark.fnum != 0 - && curwin->w_jumplist[i].fmark.mark.lnum - == curwin->w_jumplist[from].fmark.mark.lnum) + if (wp->w_jumplistidx == from) + wp->w_jumplistidx = to; + for (i = from + 1; i < wp->w_jumplistlen; ++i) + if (wp->w_jumplist[i].fmark.fnum + == wp->w_jumplist[from].fmark.fnum + && wp->w_jumplist[from].fmark.fnum != 0 + && wp->w_jumplist[i].fmark.mark.lnum + == wp->w_jumplist[from].fmark.mark.lnum) break; - if (i >= curwin->w_jumplistlen) /* no duplicate */ - curwin->w_jumplist[to++] = curwin->w_jumplist[from]; + if (i >= wp->w_jumplistlen) /* no duplicate */ + wp->w_jumplist[to++] = wp->w_jumplist[from]; else - vim_free(curwin->w_jumplist[from].fname); + vim_free(wp->w_jumplist[from].fname); } - if (curwin->w_jumplistidx == curwin->w_jumplistlen) - curwin->w_jumplistidx = to; - curwin->w_jumplistlen = to; + if (wp->w_jumplistidx == wp->w_jumplistlen) + wp->w_jumplistidx = to; + wp->w_jumplistlen = to; } -# if defined(FEAT_WINDOWS) || defined(PROTO) /* * Copy the jumplist from window "from" to window "to". */ void -copy_jumplist(from, to) - win_T *from; - win_T *to; +copy_jumplist(win_T *from, win_T *to) { int i; @@ -1343,20 +1367,17 @@ copy_jumplist(from, to) * Free items in the jumplist of window "wp". */ void -free_jumplist(wp) - win_T *wp; +free_jumplist(win_T *wp) { int i; for (i = 0; i < wp->w_jumplistlen; ++i) vim_free(wp->w_jumplist[i].fname); } -# endif #endif /* FEAT_JUMPLIST */ void -set_last_cursor(win) - win_T *win; +set_last_cursor(win_T *win) { if (win->w_buffer != NULL) win->w_buffer->b_last_cursor = win->w_cursor; @@ -1364,7 +1385,7 @@ set_last_cursor(win) #if defined(EXITFREE) || defined(PROTO) void -free_all_marks() +free_all_marks(void) { int i; @@ -1376,9 +1397,7 @@ free_all_marks() #if defined(FEAT_VIMINFO) || defined(PROTO) int -read_viminfo_filemark(virp, force) - vir_T *virp; - int force; +read_viminfo_filemark(vir_T *virp, int force) { char_u *str; xfmark_T *fm; @@ -1432,32 +1451,251 @@ read_viminfo_filemark(virp, force) vim_free(fm->fname); fm->fname = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE); + fm->time_set = 0; } } return vim_fgets(virp->vir_line, LSIZE, virp->vir_fd); } +static xfmark_T *vi_namedfm = NULL; +#ifdef FEAT_JUMPLIST +static xfmark_T *vi_jumplist = NULL; +static int vi_jumplist_len = 0; +#endif + +/* + * Prepare for reading viminfo marks when writing viminfo later. + */ void -write_viminfo_filemarks(fp) - FILE *fp; +prepare_viminfo_marks(void) +{ + vi_namedfm = (xfmark_T *)alloc_clear((NMARKS + EXTRA_MARKS) + * (int)sizeof(xfmark_T)); +#ifdef FEAT_JUMPLIST + vi_jumplist = (xfmark_T *)alloc_clear(JUMPLISTSIZE + * (int)sizeof(xfmark_T)); + vi_jumplist_len = 0; +#endif +} + + void +finish_viminfo_marks(void) +{ + int i; + + if (vi_namedfm != NULL) + { + for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) + vim_free(vi_namedfm[i].fname); + VIM_CLEAR(vi_namedfm); + } +#ifdef FEAT_JUMPLIST + if (vi_jumplist != NULL) + { + for (i = 0; i < vi_jumplist_len; ++i) + vim_free(vi_jumplist[i].fname); + VIM_CLEAR(vi_jumplist); + } +#endif +} + +/* + * Accept a new style mark line from the viminfo, store it when it's new. + */ + void +handle_viminfo_mark(garray_T *values, int force) +{ + bval_T *vp = (bval_T *)values->ga_data; + int name; + linenr_T lnum; + colnr_T col; + time_t timestamp; + xfmark_T *fm = NULL; + + /* Check the format: + * |{bartype},{name},{lnum},{col},{timestamp},{filename} */ + if (values->ga_len < 5 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || vp[2].bv_type != BVAL_NR + || vp[3].bv_type != BVAL_NR + || vp[4].bv_type != BVAL_STRING) + return; + + name = vp[0].bv_nr; + if (name != '\'' && !VIM_ISDIGIT(name) && !ASCII_ISUPPER(name)) + return; + lnum = vp[1].bv_nr; + col = vp[2].bv_nr; + if (lnum <= 0 || col < 0) + return; + timestamp = (time_t)vp[3].bv_nr; + + if (name == '\'') + { +#ifdef FEAT_JUMPLIST + if (vi_jumplist != NULL) + { + if (vi_jumplist_len < JUMPLISTSIZE) + fm = &vi_jumplist[vi_jumplist_len++]; + } + else + { + int idx; + int i; + + /* If we have a timestamp insert it in the right place. */ + if (timestamp != 0) + { + for (idx = curwin->w_jumplistlen - 1; idx >= 0; --idx) + if (curwin->w_jumplist[idx].time_set < timestamp) + { + ++idx; + break; + } + /* idx cannot be zero now */ + if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE) + /* insert as the oldest entry */ + idx = 0; + } + else if (curwin->w_jumplistlen < JUMPLISTSIZE) + /* insert as oldest entry */ + idx = 0; + else + idx = -1; + + if (idx >= 0) + { + if (curwin->w_jumplistlen == JUMPLISTSIZE) + { + /* Drop the oldest entry. */ + --idx; + vim_free(curwin->w_jumplist[0].fname); + for (i = 0; i < idx; ++i) + curwin->w_jumplist[i] = curwin->w_jumplist[i + 1]; + } + else + { + /* Move newer entries forward. */ + for (i = curwin->w_jumplistlen; i > idx; --i) + curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; + ++curwin->w_jumplistidx; + ++curwin->w_jumplistlen; + } + fm = &curwin->w_jumplist[idx]; + fm->fmark.mark.lnum = 0; + fm->fname = NULL; + fm->time_set = 0; + } + } +#endif + } + else + { + int idx; + + if (VIM_ISDIGIT(name)) + { + if (vi_namedfm != NULL) + idx = name - '0' + NMARKS; + else + { + int i; + + /* Do not use the name from the viminfo file, insert in time + * order. */ + for (idx = NMARKS; idx < NMARKS + EXTRA_MARKS; ++idx) + if (namedfm[idx].time_set < timestamp) + break; + if (idx == NMARKS + EXTRA_MARKS) + /* All existing entries are newer. */ + return; + i = NMARKS + EXTRA_MARKS - 1; + + vim_free(namedfm[i].fname); + for ( ; i > idx; --i) + namedfm[i] = namedfm[i - 1]; + namedfm[idx].fname = NULL; + } + } + else + idx = name - 'A'; + if (vi_namedfm != NULL) + fm = &vi_namedfm[idx]; + else + fm = &namedfm[idx]; + } + + if (fm != NULL) + { + if (vi_namedfm != NULL || fm->fmark.mark.lnum == 0 + || fm->time_set < timestamp || force) + { + fm->fmark.mark.lnum = lnum; + fm->fmark.mark.col = col; +#ifdef FEAT_VIRTUALEDIT + fm->fmark.mark.coladd = 0; +#endif + fm->fmark.fnum = 0; + vim_free(fm->fname); + if (vp[4].bv_allocated) + { + fm->fname = vp[4].bv_string; + vp[4].bv_string = NULL; + } + else + fm->fname = vim_strsave(vp[4].bv_string); + fm->time_set = timestamp; + } + } +} + +/* + * Return TRUE if marks for "buf" should not be written. + */ + static int +skip_for_viminfo(buf_T *buf) +{ + return +#ifdef FEAT_TERMINAL + bt_terminal(buf) || +#endif + removable(buf->b_ffname); +} + + void +write_viminfo_filemarks(FILE *fp) { int i; char_u *name; buf_T *buf; xfmark_T *fm; + int vi_idx; + int idx; if (get_viminfo_parameter('f') == 0) return; fputs(_("\n# File marks:\n"), fp); + /* Write the filemarks 'A - 'Z */ + for (i = 0; i < NMARKS; i++) + { + if (vi_namedfm != NULL && (vi_namedfm[i].time_set > namedfm[i].time_set + || namedfm[i].fmark.mark.lnum == 0)) + fm = &vi_namedfm[i]; + else + fm = &namedfm[i]; + write_one_filemark(fp, fm, '\'', i + 'A'); + } + /* * Find a mark that is the same file and position as the cursor. * That one, or else the last one is deleted. * Move '0 to '1, '1 to '2, etc. until the matching one or '9 - * Set '0 mark to current cursor position. + * Set the '0 mark to current cursor position. */ - if (curbuf->b_ffname != NULL && !removable(curbuf->b_ffname)) + if (curbuf->b_ffname != NULL && !skip_for_viminfo(curbuf)) { name = buflist_nr2name(curbuf->b_fnum, TRUE, FALSE); for (i = NMARKS; i < NMARKS + EXTRA_MARKS - 1; ++i) @@ -1475,35 +1713,76 @@ write_viminfo_filemarks(fp) namedfm[NMARKS].fmark.mark = curwin->w_cursor; namedfm[NMARKS].fmark.fnum = curbuf->b_fnum; namedfm[NMARKS].fname = NULL; + namedfm[NMARKS].time_set = vim_time(); } - /* Write the filemarks '0 - '9 and 'A - 'Z */ - for (i = 0; i < NMARKS + EXTRA_MARKS; i++) - write_one_filemark(fp, &namedfm[i], '\'', - i < NMARKS ? i + 'A' : i - NMARKS + '0'); + /* Write the filemarks '0 - '9. Newest (highest timestamp) first. */ + vi_idx = NMARKS; + idx = NMARKS; + for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++) + { + xfmark_T *vi_fm = vi_namedfm != NULL ? &vi_namedfm[vi_idx] : NULL; + + if (vi_fm != NULL + && vi_fm->fmark.mark.lnum != 0 + && (vi_fm->time_set > namedfm[idx].time_set + || namedfm[idx].fmark.mark.lnum == 0)) + { + fm = vi_fm; + ++vi_idx; + } + else + { + fm = &namedfm[idx++]; + if (vi_fm != NULL + && vi_fm->fmark.mark.lnum == fm->fmark.mark.lnum + && vi_fm->time_set == fm->time_set + && ((vi_fm->fmark.fnum != 0 + && vi_fm->fmark.fnum == fm->fmark.fnum) + || (vi_fm->fname != NULL + && fm->fname != NULL + && STRCMP(vi_fm->fname, fm->fname) == 0))) + ++vi_idx; /* skip duplicate */ + } + write_one_filemark(fp, fm, '\'', i - NMARKS + '0'); + } #ifdef FEAT_JUMPLIST /* Write the jumplist with -' */ fputs(_("\n# Jumplist (newest first):\n"), fp); setpcmark(); /* add current cursor position */ - cleanup_jumplist(); - for (fm = &curwin->w_jumplist[curwin->w_jumplistlen - 1]; - fm >= &curwin->w_jumplist[0]; --fm) + cleanup_jumplist(curwin, FALSE); + vi_idx = 0; + idx = curwin->w_jumplistlen - 1; + for (i = 0; i < JUMPLISTSIZE; ++i) { + xfmark_T *vi_fm; + + fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL; + vi_fm = vi_idx < vi_jumplist_len ? &vi_jumplist[vi_idx] : NULL; + if (fm == NULL && vi_fm == NULL) + break; + if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set)) + { + fm = vi_fm; + ++vi_idx; + } + else + --idx; if (fm->fmark.fnum == 0 || ((buf = buflist_findnr(fm->fmark.fnum)) != NULL - && !removable(buf->b_ffname))) + && !skip_for_viminfo(buf))) write_one_filemark(fp, fm, '-', '\''); } #endif } static void -write_one_filemark(fp, fm, c1, c2) - FILE *fp; - xfmark_T *fm; - int c1; - int c2; +write_one_filemark( + FILE *fp, + xfmark_T *fm, + int c1, + int c2) { char_u *name; @@ -1519,6 +1798,14 @@ write_one_filemark(fp, fm, c1, c2) fprintf(fp, "%c%c %ld %ld ", c1, c2, (long)fm->fmark.mark.lnum, (long)fm->fmark.mark.col); viminfo_writestring(fp, name); + + /* Barline: |{bartype},{name},{lnum},{col},{timestamp},{filename} + * size up to filename: 8 + 3 * 20 */ + fprintf(fp, "|%d,%d,%ld,%ld,%ld,", BARTYPE_MARK, c2, + (long)fm->fmark.mark.lnum, (long)fm->fmark.mark.col, + (long)fm->time_set); + barline_writestring(fp, name, LSIZE - 70); + putc('\n', fp); } if (fm->fmark.fnum != 0) @@ -1529,8 +1816,7 @@ write_one_filemark(fp, fm, c1, c2) * Return TRUE if "name" is on removable media (depending on 'viminfo'). */ int -removable(name) - char_u *name; +removable(char_u *name) { char_u *p; char_u part[51]; @@ -1558,21 +1844,58 @@ removable(name) return retval; } -static void write_one_mark __ARGS((FILE *fp_out, int c, pos_T *pos)); + static void +write_one_mark(FILE *fp_out, int c, pos_T *pos) +{ + if (pos->lnum != 0) + fprintf(fp_out, "\t%c\t%ld\t%d\n", c, (long)pos->lnum, (int)pos->col); +} + + + static void +write_buffer_marks(buf_T *buf, FILE *fp_out) +{ + int i; + pos_T pos; + + home_replace(NULL, buf->b_ffname, IObuff, IOSIZE, TRUE); + fprintf(fp_out, "\n> "); + viminfo_writestring(fp_out, IObuff); + + /* Write the last used timestamp as the lnum of the non-existing mark '*'. + * Older Vims will ignore it and/or copy it. */ + pos.lnum = (linenr_T)buf->b_last_used; + pos.col = 0; + write_one_mark(fp_out, '*', &pos); + + write_one_mark(fp_out, '"', &buf->b_last_cursor); + write_one_mark(fp_out, '^', &buf->b_last_insert); + write_one_mark(fp_out, '.', &buf->b_last_change); +#ifdef FEAT_JUMPLIST + /* changelist positions are stored oldest first */ + for (i = 0; i < buf->b_changelistlen; ++i) + { + /* skip duplicates */ + if (i == 0 || !EQUAL_POS(buf->b_changelist[i - 1], + buf->b_changelist[i])) + write_one_mark(fp_out, '+', &buf->b_changelist[i]); + } +#endif + for (i = 0; i < NMARKS; i++) + write_one_mark(fp_out, 'a' + i, &buf->b_namedm[i]); +} /* * Write all the named marks for all buffers. - * Return the number of buffers for which marks have been written. + * When "buflist" is not NULL fill it with the buffers for which marks are to + * be written. */ - int -write_viminfo_marks(fp_out) - FILE *fp_out; + void +write_viminfo_marks(FILE *fp_out, garray_T *buflist) { - int count; buf_T *buf; int is_mark_set; int i; -#ifdef FEAT_WINDOWS win_T *win; tabpage_T *tp; @@ -1581,13 +1904,9 @@ write_viminfo_marks(fp_out) */ FOR_ALL_TAB_WINDOWS(tp, win) set_last_cursor(win); -#else - set_last_cursor(curwin); -#endif fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out); - count = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { /* * Only write something if buffer has been loaded and at least one @@ -1608,52 +1927,48 @@ write_viminfo_marks(fp_out) } } if (is_mark_set && buf->b_ffname != NULL - && buf->b_ffname[0] != NUL && !removable(buf->b_ffname)) + && buf->b_ffname[0] != NUL + && !skip_for_viminfo(buf)) { - home_replace(NULL, buf->b_ffname, IObuff, IOSIZE, TRUE); - fprintf(fp_out, "\n> "); - viminfo_writestring(fp_out, IObuff); - write_one_mark(fp_out, '"', &buf->b_last_cursor); - write_one_mark(fp_out, '^', &buf->b_last_insert); - write_one_mark(fp_out, '.', &buf->b_last_change); -#ifdef FEAT_JUMPLIST - /* changelist positions are stored oldest first */ - for (i = 0; i < buf->b_changelistlen; ++i) - write_one_mark(fp_out, '+', &buf->b_changelist[i]); -#endif - for (i = 0; i < NMARKS; i++) - write_one_mark(fp_out, 'a' + i, &buf->b_namedm[i]); - count++; + if (buflist == NULL) + write_buffer_marks(buf, fp_out); + else if (ga_grow(buflist, 1) == OK) + ((buf_T **)buflist->ga_data)[buflist->ga_len++] = buf; } } } - - return count; } - static void -write_one_mark(fp_out, c, pos) - FILE *fp_out; - int c; - pos_T *pos; +/* + * Compare functions for qsort() below, that compares b_last_used. + */ + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +buf_compare(const void *s1, const void *s2) { - if (pos->lnum != 0) - fprintf(fp_out, "\t%c\t%ld\t%d\n", c, (long)pos->lnum, (int)pos->col); + buf_T *buf1 = *(buf_T **)s1; + buf_T *buf2 = *(buf_T **)s2; + + if (buf1->b_last_used == buf2->b_last_used) + return 0; + return buf1->b_last_used > buf2->b_last_used ? -1 : 1; } /* * Handle marks in the viminfo file: - * fp_out != NULL: copy marks for buffers not in buffer list + * fp_out != NULL: copy marks, in time order with buffers in "buflist". * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles */ void -copy_viminfo_marks(virp, fp_out, count, eof, flags) - vir_T *virp; - FILE *fp_out; - int count; - int eof; - int flags; +copy_viminfo_marks( + vir_T *virp, + FILE *fp_out, + garray_T *buflist, + int eof, + int flags) { char_u *line = virp->vir_line; buf_T *buf; @@ -1668,11 +1983,22 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) #ifdef FEAT_EVAL list_T *list = NULL; #endif + int count = 0; + int buflist_used = 0; + buf_T *buflist_buf = NULL; if ((name_buf = alloc(LSIZE)) == NULL) return; *name_buf = NUL; + if (fp_out != NULL && buflist->ga_len > 0) + { + /* Sort the list of buffers on b_last_used. */ + qsort(buflist->ga_data, (size_t)buflist->ga_len, + sizeof(buf_T *), buf_compare); + buflist_buf = ((buf_T **)buflist->ga_data)[0]; + } + #ifdef FEAT_EVAL if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT))) { @@ -1735,7 +2061,7 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) else /* fp_out != NULL */ { /* This is slow if there are many buffers!! */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ffname != NULL) { home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE); @@ -1744,14 +2070,70 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) } /* - * copy marks if the buffer has not been loaded + * Copy marks if the buffer has not been loaded. */ if (buf == NULL || !buf->b_marks_read) { - copy_marks_out = TRUE; + int did_read_line = FALSE; + + if (buflist_buf != NULL) + { + /* Read the next line. If it has the "*" mark compare the + * time stamps. Write entries from "buflist" that are + * newer. */ + if (!(eof = viminfo_readline(virp)) && line[0] == TAB) + { + did_read_line = TRUE; + if (line[1] == '*') + { + long ltime; + + sscanf((char *)line + 2, "%ld ", <ime); + while ((time_T)ltime < buflist_buf->b_last_used) + { + write_buffer_marks(buflist_buf, fp_out); + if (++count >= num_marked_files) + break; + if (++buflist_used == buflist->ga_len) + { + buflist_buf = NULL; + break; + } + buflist_buf = + ((buf_T **)buflist->ga_data)[buflist_used]; + } + } + else + { + /* No timestamp, must be written by an older Vim. + * Assume all remaining buffers are older then + * ours. */ + while (count < num_marked_files + && buflist_used < buflist->ga_len) + { + buflist_buf = ((buf_T **)buflist->ga_data) + [buflist_used++]; + write_buffer_marks(buflist_buf, fp_out); + ++count; + } + buflist_buf = NULL; + } + + if (count >= num_marked_files) + { + vim_free(str); + break; + } + } + } + fputs("\n> ", fp_out); viminfo_writestring(fp_out, str); + if (did_read_line) + fputs((char *)line, fp_out); + count++; + copy_marks_out = TRUE; } } vim_free(str); @@ -1789,6 +2171,11 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) curbuf->b_changelistlen - 1] = pos; #endif break; + + /* Using the line number for the last-used + * timestamp. */ + case '*': curbuf->b_last_used = pos.lnum; break; + default: if ((i = line[1] - 'a') >= 0 && i < NMARKS) curbuf->b_namedm[i] = pos; } @@ -1797,6 +2184,7 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) else if (copy_marks_out) fputs((char *)line, fp_out); } + if (load_marks) { #ifdef FEAT_JUMPLIST @@ -1811,6 +2199,16 @@ copy_viminfo_marks(virp, fp_out, count, eof, flags) break; } } + + if (fp_out != NULL) + /* Write any remaining entries from buflist. */ + while (count < num_marked_files && buflist_used < buflist->ga_len) + { + buflist_buf = ((buf_T **)buflist->ga_data)[buflist_used++]; + write_buffer_marks(buflist_buf, fp_out); + ++count; + } + vim_free(name_buf); } #endif /* FEAT_VIMINFO */ diff --git a/src/mbyte.c b/src/mbyte.c index 9e05f0d91e..dd9d1ca416 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Multibyte extensions partly by Sung-Hoon Baek @@ -105,11 +105,18 @@ # include <X11/Intrinsic.h> #endif #ifdef X_LOCALE -#include <X11/Xlocale.h> +# include <X11/Xlocale.h> +# if !defined(HAVE_MBLEN) && !defined(mblen) +# define mblen _Xmblen +# endif #endif #if defined(FEAT_GUI_GTK) && defined(FEAT_XIM) -# include <gdk/gdkkeysyms.h> +# if GTK_CHECK_VERSION(3,0,0) +# include <gdk/gdkkeysyms-compat.h> +# else +# include <gdk/gdkkeysyms.h> +# endif # ifdef WIN3264 # include <gdk/gdkwin32.h> # else @@ -131,16 +138,16 @@ #if defined(FEAT_MBYTE) || defined(PROTO) -static int enc_canon_search __ARGS((char_u *name)); -static int dbcs_char2len __ARGS((int c)); -static int dbcs_char2bytes __ARGS((int c, char_u *buf)); -static int dbcs_ptr2len __ARGS((char_u *p)); -static int dbcs_ptr2len_len __ARGS((char_u *p, int size)); -static int utf_ptr2cells_len __ARGS((char_u *p, int size)); -static int dbcs_char2cells __ARGS((int c)); -static int dbcs_ptr2cells_len __ARGS((char_u *p, int size)); -static int dbcs_ptr2char __ARGS((char_u *p)); -static int utf_safe_read_char_adv __ARGS((char_u **s, size_t *n)); +static int enc_canon_search(char_u *name); +static int dbcs_char2len(int c); +static int dbcs_char2bytes(int c, char_u *buf); +static int dbcs_ptr2len(char_u *p); +static int dbcs_ptr2len_len(char_u *p, int size); +static int utf_ptr2cells_len(char_u *p, int size); +static int dbcs_char2cells(int c); +static int dbcs_ptr2cells_len(char_u *p, int size); +static int dbcs_ptr2char(char_u *p); +static int utf_safe_read_char_adv(char_u **s, size_t *n); /* * Lookup table to quickly get the length in bytes of a UTF-8 character from @@ -405,12 +412,13 @@ enc_alias_table[] = {"unix-jis", IDX_EUC_JP}, {"ujis", IDX_EUC_JP}, {"shift-jis", IDX_SJIS}, + {"pck", IDX_SJIS}, /* Sun: PCK */ {"euckr", IDX_EUC_KR}, {"5601", IDX_EUC_KR}, /* Sun: KS C 5601 */ {"euccn", IDX_EUC_CN}, {"gb2312", IDX_EUC_CN}, {"euctw", IDX_EUC_TW}, -#if defined(WIN3264) || defined(WIN32UNIX) || defined(MACOS) +#if defined(WIN3264) || defined(WIN32UNIX) || defined(MACOS_X) {"japan", IDX_CP932}, {"korea", IDX_CP949}, {"prc", IDX_CP936}, @@ -440,8 +448,7 @@ enc_alias_table[] = * Returns -1 if not found. */ static int -enc_canon_search(name) - char_u *name; +enc_canon_search(char_u *name) { int i; @@ -460,8 +467,7 @@ enc_canon_search(name) * Returns 0 if not found. */ int -enc_canon_props(name) - char_u *name; +enc_canon_props(char_u *name) { int i; @@ -474,7 +480,7 @@ enc_canon_props(name) CPINFO cpinfo; /* Get info on this codepage to find out what it is. */ - if (GetCPInfo(atoi(name + 2), &cpinfo) != 0) + if (GetCPInfo(atoi((char *)name + 2), &cpinfo) != 0) { if (cpinfo.MaxCharSize == 1) /* some single-byte encoding */ return ENC_8BIT; @@ -506,14 +512,14 @@ enc_canon_props(name) * anything. */ char_u * -mb_init() +mb_init(void) { int i; int idx; int n; int enc_dbcs_new = 0; #if defined(USE_ICONV) && !defined(WIN3264) && !defined(WIN32UNIX) \ - && !defined(MACOS) + && !defined(MACOS_CONVERT) # define LEN_FROM_CONV vimconv_T vimconv; char_u *p; @@ -536,7 +542,7 @@ mb_init() CPINFO cpinfo; /* Get info on this codepage to find out what it is. */ - if (GetCPInfo(atoi(p_enc + 2), &cpinfo) != 0) + if (GetCPInfo(atoi((char *)p_enc + 2), &cpinfo) != 0) { if (cpinfo.MaxCharSize == 1) { @@ -548,7 +554,7 @@ mb_init() && (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0)) { /* must be a DBCS encoding, check below */ - enc_dbcs_new = atoi(p_enc + 2); + enc_dbcs_new = atoi((char *)p_enc + 2); } else goto codepage_invalid; @@ -572,7 +578,7 @@ mb_init() #ifdef WIN3264 /* Windows: accept only valid codepage numbers, check below. */ if (p_enc[6] != 'c' || p_enc[7] != 'p' - || (enc_dbcs_new = atoi(p_enc + 8)) == 0) + || (enc_dbcs_new = atoi((char *)p_enc + 8)) == 0) return e_invarg; #else /* Unix: accept any "2byte-" name, assume current locale. */ @@ -708,7 +714,8 @@ mb_init() * API */ n = IsDBCSLeadByteEx(enc_dbcs, (WINBYTE)i) ? 2 : 1; #else -# if defined(MACOS) || defined(__amigaos4__) || defined(__ANDROID__) +# if defined(__amigaos4__) || defined(__ANDROID__) || \ + !(defined(HAVE_MBLEN) || defined(X_LOCALE)) /* * if mblen() is not available, character which MSB is turned on * are treated as leading byte character. (note : This assumption @@ -717,18 +724,14 @@ mb_init() n = (i & 0x80) ? 2 : 1; # else char buf[MB_MAXBYTES + 1]; -# ifdef X_LOCALE -# ifndef mblen -# define mblen _Xmblen -# endif -# endif + if (i == NUL) /* just in case mblen() can't handle "" */ n = 1; else { buf[0] = i; buf[1] = 0; -#ifdef LEN_FROM_CONV +# ifdef LEN_FROM_CONV if (vimconv.vc_type != CONV_NONE) { /* @@ -745,7 +748,7 @@ mb_init() n = 2; } else -#endif +# endif { /* * mblen() should return -1 for invalid (means the leading @@ -796,11 +799,9 @@ mb_init() fix_arg_enc(); #endif -#ifdef FEAT_AUTOCMD /* Fire an autocommand to let people do custom font setup. This must be * after Vim has been setup for the new encoding. */ apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); -#endif #ifdef FEAT_SPELL /* Need to reload spell dictionaries */ @@ -818,7 +819,7 @@ mb_init() * 3 - UTF-8 BOM */ int -bomb_size() +bomb_size(void) { int n = 0; @@ -849,8 +850,7 @@ bomb_size() * Remove all BOM from "s" by moving remaining text. */ void -remove_bom(s) - char_u *s; +remove_bom(char_u *s) { if (enc_utf8) { @@ -874,20 +874,17 @@ remove_bom(s) * >2 for other word characters */ int -mb_get_class(p) - char_u *p; +mb_get_class(char_u *p) { return mb_get_class_buf(p, curbuf); } int -mb_get_class_buf(p, buf) - char_u *p; - buf_T *buf; +mb_get_class_buf(char_u *p, buf_T *buf) { if (MB_BYTE2LEN(p[0]) == 1) { - if (p[0] == NUL || vim_iswhite(p[0])) + if (p[0] == NUL || VIM_ISWHITE(p[0])) return 0; if (vim_iswordc_buf(p[0], buf)) return 2; @@ -896,7 +893,7 @@ mb_get_class_buf(p, buf) if (enc_dbcs != 0 && p[0] != NUL && p[1] != NUL) return dbcs_class(p[0], p[1]); if (enc_utf8) - return utf_class(utf_ptr2char(p)); + return utf_class_buf(utf_ptr2char(p), buf); return 0; } @@ -905,9 +902,7 @@ mb_get_class_buf(p, buf) * TODO: Should return 1 for punctuation. */ int -dbcs_class(lead, trail) - unsigned lead; - unsigned trail; +dbcs_class(unsigned lead, unsigned trail) { switch (enc_dbcs) { @@ -921,7 +916,7 @@ dbcs_class(lead, trail) unsigned char tb = trail; /* convert process code to JIS */ -# if defined(WIN3264) || defined(WIN32UNIX) || defined(MACOS) +# if defined(WIN3264) || defined(WIN32UNIX) || defined(MACOS_X) /* process code is SJIS */ if (lb <= 0x9f) lb = (lb - 0x81) * 2 + 0x21; @@ -1081,15 +1076,14 @@ dbcs_class(lead, trail) * Returns 1 for a single-byte character. */ int -latin_char2len(c) - int c UNUSED; +latin_char2len(int c UNUSED) { return 1; } static int -dbcs_char2len(c) - int c; +dbcs_char2len( + int c) { if (c >= 0x100) return 2; @@ -1102,18 +1096,14 @@ dbcs_char2len(c) * Returns the length in bytes. */ int -latin_char2bytes(c, buf) - int c; - char_u *buf; +latin_char2bytes(int c, char_u *buf) { buf[0] = c; return 1; } static int -dbcs_char2bytes(c, buf) - int c; - char_u *buf; +dbcs_char2bytes(int c, char_u *buf) { if (c >= 0x100) { @@ -1136,15 +1126,14 @@ dbcs_char2bytes(c, buf) * Returns 0 when *p is NUL. */ int -latin_ptr2len(p) - char_u *p; +latin_ptr2len(char_u *p) { - return MB_BYTE2LEN(*p); + return MB_BYTE2LEN(*p); } static int -dbcs_ptr2len(p) - char_u *p; +dbcs_ptr2len( + char_u *p) { int len; @@ -1162,9 +1151,7 @@ dbcs_ptr2len(p) * Returns 1 for an illegal char or an incomplete byte sequence. */ int -latin_ptr2len_len(p, size) - char_u *p; - int size; +latin_ptr2len_len(char_u *p, int size) { if (size < 1 || *p == NUL) return 0; @@ -1172,9 +1159,7 @@ latin_ptr2len_len(p, size) } static int -dbcs_ptr2len_len(p, size) - char_u *p; - int size; +dbcs_ptr2len_len(char_u *p, int size) { int len; @@ -1194,16 +1179,12 @@ struct interval long first; long last; }; -static int intable __ARGS((struct interval *table, size_t size, int c)); /* * Return TRUE if "c" is in "table[size / sizeof(struct interval)]". */ static int -intable(table, size, c) - struct interval *table; - size_t size; - int c; +intable(struct interval *table, size_t size, int c) { int mid, bot, top; @@ -1227,6 +1208,204 @@ intable(table, size, c) return FALSE; } +/* Sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated with ../runtime/tools/unicode.vim. */ +static struct interval ambiguous[] = +{ + {0x00a1, 0x00a1}, + {0x00a4, 0x00a4}, + {0x00a7, 0x00a8}, + {0x00aa, 0x00aa}, + {0x00ad, 0x00ae}, + {0x00b0, 0x00b4}, + {0x00b6, 0x00ba}, + {0x00bc, 0x00bf}, + {0x00c6, 0x00c6}, + {0x00d0, 0x00d0}, + {0x00d7, 0x00d8}, + {0x00de, 0x00e1}, + {0x00e6, 0x00e6}, + {0x00e8, 0x00ea}, + {0x00ec, 0x00ed}, + {0x00f0, 0x00f0}, + {0x00f2, 0x00f3}, + {0x00f7, 0x00fa}, + {0x00fc, 0x00fc}, + {0x00fe, 0x00fe}, + {0x0101, 0x0101}, + {0x0111, 0x0111}, + {0x0113, 0x0113}, + {0x011b, 0x011b}, + {0x0126, 0x0127}, + {0x012b, 0x012b}, + {0x0131, 0x0133}, + {0x0138, 0x0138}, + {0x013f, 0x0142}, + {0x0144, 0x0144}, + {0x0148, 0x014b}, + {0x014d, 0x014d}, + {0x0152, 0x0153}, + {0x0166, 0x0167}, + {0x016b, 0x016b}, + {0x01ce, 0x01ce}, + {0x01d0, 0x01d0}, + {0x01d2, 0x01d2}, + {0x01d4, 0x01d4}, + {0x01d6, 0x01d6}, + {0x01d8, 0x01d8}, + {0x01da, 0x01da}, + {0x01dc, 0x01dc}, + {0x0251, 0x0251}, + {0x0261, 0x0261}, + {0x02c4, 0x02c4}, + {0x02c7, 0x02c7}, + {0x02c9, 0x02cb}, + {0x02cd, 0x02cd}, + {0x02d0, 0x02d0}, + {0x02d8, 0x02db}, + {0x02dd, 0x02dd}, + {0x02df, 0x02df}, + {0x0300, 0x036f}, + {0x0391, 0x03a1}, + {0x03a3, 0x03a9}, + {0x03b1, 0x03c1}, + {0x03c3, 0x03c9}, + {0x0401, 0x0401}, + {0x0410, 0x044f}, + {0x0451, 0x0451}, + {0x2010, 0x2010}, + {0x2013, 0x2016}, + {0x2018, 0x2019}, + {0x201c, 0x201d}, + {0x2020, 0x2022}, + {0x2024, 0x2027}, + {0x2030, 0x2030}, + {0x2032, 0x2033}, + {0x2035, 0x2035}, + {0x203b, 0x203b}, + {0x203e, 0x203e}, + {0x2074, 0x2074}, + {0x207f, 0x207f}, + {0x2081, 0x2084}, + {0x20ac, 0x20ac}, + {0x2103, 0x2103}, + {0x2105, 0x2105}, + {0x2109, 0x2109}, + {0x2113, 0x2113}, + {0x2116, 0x2116}, + {0x2121, 0x2122}, + {0x2126, 0x2126}, + {0x212b, 0x212b}, + {0x2153, 0x2154}, + {0x215b, 0x215e}, + {0x2160, 0x216b}, + {0x2170, 0x2179}, + {0x2189, 0x2189}, + {0x2190, 0x2199}, + {0x21b8, 0x21b9}, + {0x21d2, 0x21d2}, + {0x21d4, 0x21d4}, + {0x21e7, 0x21e7}, + {0x2200, 0x2200}, + {0x2202, 0x2203}, + {0x2207, 0x2208}, + {0x220b, 0x220b}, + {0x220f, 0x220f}, + {0x2211, 0x2211}, + {0x2215, 0x2215}, + {0x221a, 0x221a}, + {0x221d, 0x2220}, + {0x2223, 0x2223}, + {0x2225, 0x2225}, + {0x2227, 0x222c}, + {0x222e, 0x222e}, + {0x2234, 0x2237}, + {0x223c, 0x223d}, + {0x2248, 0x2248}, + {0x224c, 0x224c}, + {0x2252, 0x2252}, + {0x2260, 0x2261}, + {0x2264, 0x2267}, + {0x226a, 0x226b}, + {0x226e, 0x226f}, + {0x2282, 0x2283}, + {0x2286, 0x2287}, + {0x2295, 0x2295}, + {0x2299, 0x2299}, + {0x22a5, 0x22a5}, + {0x22bf, 0x22bf}, + {0x2312, 0x2312}, + {0x2460, 0x24e9}, + {0x24eb, 0x254b}, + {0x2550, 0x2573}, + {0x2580, 0x258f}, + {0x2592, 0x2595}, + {0x25a0, 0x25a1}, + {0x25a3, 0x25a9}, + {0x25b2, 0x25b3}, + {0x25b6, 0x25b7}, + {0x25bc, 0x25bd}, + {0x25c0, 0x25c1}, + {0x25c6, 0x25c8}, + {0x25cb, 0x25cb}, + {0x25ce, 0x25d1}, + {0x25e2, 0x25e5}, + {0x25ef, 0x25ef}, + {0x2605, 0x2606}, + {0x2609, 0x2609}, + {0x260e, 0x260f}, + {0x261c, 0x261c}, + {0x261e, 0x261e}, + {0x2640, 0x2640}, + {0x2642, 0x2642}, + {0x2660, 0x2661}, + {0x2663, 0x2665}, + {0x2667, 0x266a}, + {0x266c, 0x266d}, + {0x266f, 0x266f}, + {0x269e, 0x269f}, + {0x26bf, 0x26bf}, + {0x26c6, 0x26cd}, + {0x26cf, 0x26d3}, + {0x26d5, 0x26e1}, + {0x26e3, 0x26e3}, + {0x26e8, 0x26e9}, + {0x26eb, 0x26f1}, + {0x26f4, 0x26f4}, + {0x26f6, 0x26f9}, + {0x26fb, 0x26fc}, + {0x26fe, 0x26ff}, + {0x273d, 0x273d}, + {0x2776, 0x277f}, + {0x2b56, 0x2b59}, + {0x3248, 0x324f}, + {0xe000, 0xf8ff}, + {0xfe00, 0xfe0f}, + {0xfffd, 0xfffd}, + {0x1f100, 0x1f10a}, + {0x1f110, 0x1f12d}, + {0x1f130, 0x1f169}, + {0x1f170, 0x1f18d}, + {0x1f18f, 0x1f190}, + {0x1f19b, 0x1f1ac}, + {0xe0100, 0xe01ef}, + {0xf0000, 0xffffd}, + {0x100000, 0x10fffd} +}; + +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * utf_char2cells() with different argument type for libvterm. + */ + int +utf_uint2cells(UINT32_T c) +{ + if (c >= 0x100 && utf_iscomposing((int)c)) + return 0; + return utf_char2cells((int)c); +} +#endif + /* * For UTF-8 character "c" return 2 for a double-width character, 1 for others. * Returns 4 or 6 for an unprintable character. @@ -1235,28 +1414,57 @@ intable(table, size, c) * class 'A'(mbiguous). */ int -utf_char2cells(c) - int c; +utf_char2cells(int c) { /* Sorted list of non-overlapping intervals of East Asian double width * characters, generated with ../runtime/tools/unicode.vim. */ static struct interval doublewidth[] = { {0x1100, 0x115f}, - {0x11a3, 0x11a7}, - {0x11fa, 0x11ff}, + {0x231a, 0x231b}, {0x2329, 0x232a}, + {0x23e9, 0x23ec}, + {0x23f0, 0x23f0}, + {0x23f3, 0x23f3}, + {0x25fd, 0x25fe}, + {0x2614, 0x2615}, + {0x2648, 0x2653}, + {0x267f, 0x267f}, + {0x2693, 0x2693}, + {0x26a1, 0x26a1}, + {0x26aa, 0x26ab}, + {0x26bd, 0x26be}, + {0x26c4, 0x26c5}, + {0x26ce, 0x26ce}, + {0x26d4, 0x26d4}, + {0x26ea, 0x26ea}, + {0x26f2, 0x26f3}, + {0x26f5, 0x26f5}, + {0x26fa, 0x26fa}, + {0x26fd, 0x26fd}, + {0x2705, 0x2705}, + {0x270a, 0x270b}, + {0x2728, 0x2728}, + {0x274c, 0x274c}, + {0x274e, 0x274e}, + {0x2753, 0x2755}, + {0x2757, 0x2757}, + {0x2795, 0x2797}, + {0x27b0, 0x27b0}, + {0x27bf, 0x27bf}, + {0x2b1b, 0x2b1c}, + {0x2b50, 0x2b50}, + {0x2b55, 0x2b55}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, - {0x3000, 0x3029}, - {0x3030, 0x303e}, + {0x3000, 0x303e}, {0x3041, 0x3096}, - {0x309b, 0x30ff}, - {0x3105, 0x312d}, + {0x3099, 0x30ff}, + {0x3105, 0x312e}, {0x3131, 0x318e}, - {0x3190, 0x31b7}, + {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e}, {0x3220, 0x3247}, @@ -1266,8 +1474,6 @@ utf_char2cells(c) {0xa490, 0xa4c6}, {0xa960, 0xa97c}, {0xac00, 0xd7a3}, - {0xd7b0, 0xd7c6}, - {0xd7cb, 0xd7fb}, {0xf900, 0xfaff}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, @@ -1275,199 +1481,112 @@ utf_char2cells(c) {0xfe68, 0xfe6b}, {0xff01, 0xff60}, {0xffe0, 0xffe6}, - {0x1f200, 0x1f200}, - {0x1f210, 0x1f231}, + {0x16fe0, 0x16fe1}, + {0x17000, 0x187ec}, + {0x18800, 0x18af2}, + {0x1b000, 0x1b11e}, + {0x1b170, 0x1b2fb}, + {0x1f004, 0x1f004}, + {0x1f0cf, 0x1f0cf}, + {0x1f18e, 0x1f18e}, + {0x1f191, 0x1f19a}, + {0x1f200, 0x1f202}, + {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, + {0x1f250, 0x1f251}, + {0x1f260, 0x1f265}, + {0x1f300, 0x1f320}, + {0x1f32d, 0x1f335}, + {0x1f337, 0x1f37c}, + {0x1f37e, 0x1f393}, + {0x1f3a0, 0x1f3ca}, + {0x1f3cf, 0x1f3d3}, + {0x1f3e0, 0x1f3f0}, + {0x1f3f4, 0x1f3f4}, + {0x1f3f8, 0x1f43e}, + {0x1f440, 0x1f440}, + {0x1f442, 0x1f4fc}, + {0x1f4ff, 0x1f53d}, + {0x1f54b, 0x1f54e}, + {0x1f550, 0x1f567}, + {0x1f57a, 0x1f57a}, + {0x1f595, 0x1f596}, + {0x1f5a4, 0x1f5a4}, + {0x1f5fb, 0x1f64f}, + {0x1f680, 0x1f6c5}, + {0x1f6cc, 0x1f6cc}, + {0x1f6d0, 0x1f6d2}, + {0x1f6eb, 0x1f6ec}, + {0x1f6f4, 0x1f6f8}, + {0x1f910, 0x1f93e}, + {0x1f940, 0x1f94c}, + {0x1f950, 0x1f96b}, + {0x1f980, 0x1f997}, + {0x1f9c0, 0x1f9c0}, + {0x1f9d0, 0x1f9e6}, {0x20000, 0x2fffd}, {0x30000, 0x3fffd} }; - /* Sorted list of non-overlapping intervals of East Asian Ambiguous - * characters, generated with ../runtime/tools/unicode.vim. */ - static struct interval ambiguous[] = + + /* Sorted list of non-overlapping intervals of Emoji characters that don't + * have ambiguous or double width, + * based on http://unicode.org/emoji/charts/emoji-list.html */ + static struct interval emoji_width[] = { - {0x00a1, 0x00a1}, - {0x00a4, 0x00a4}, - {0x00a7, 0x00a8}, - {0x00aa, 0x00aa}, - {0x00ad, 0x00ae}, - {0x00b0, 0x00b4}, - {0x00b6, 0x00ba}, - {0x00bc, 0x00bf}, - {0x00c6, 0x00c6}, - {0x00d0, 0x00d0}, - {0x00d7, 0x00d8}, - {0x00de, 0x00e1}, - {0x00e6, 0x00e6}, - {0x00e8, 0x00ea}, - {0x00ec, 0x00ed}, - {0x00f0, 0x00f0}, - {0x00f2, 0x00f3}, - {0x00f7, 0x00fa}, - {0x00fc, 0x00fc}, - {0x00fe, 0x00fe}, - {0x0101, 0x0101}, - {0x0111, 0x0111}, - {0x0113, 0x0113}, - {0x011b, 0x011b}, - {0x0126, 0x0127}, - {0x012b, 0x012b}, - {0x0131, 0x0133}, - {0x0138, 0x0138}, - {0x013f, 0x0142}, - {0x0144, 0x0144}, - {0x0148, 0x014b}, - {0x014d, 0x014d}, - {0x0152, 0x0153}, - {0x0166, 0x0167}, - {0x016b, 0x016b}, - {0x01ce, 0x01ce}, - {0x01d0, 0x01d0}, - {0x01d2, 0x01d2}, - {0x01d4, 0x01d4}, - {0x01d6, 0x01d6}, - {0x01d8, 0x01d8}, - {0x01da, 0x01da}, - {0x01dc, 0x01dc}, - {0x0251, 0x0251}, - {0x0261, 0x0261}, - {0x02c4, 0x02c4}, - {0x02c7, 0x02c7}, - {0x02c9, 0x02cb}, - {0x02cd, 0x02cd}, - {0x02d0, 0x02d0}, - {0x02d8, 0x02db}, - {0x02dd, 0x02dd}, - {0x02df, 0x02df}, - {0x0391, 0x03a1}, - {0x03a3, 0x03a9}, - {0x03b1, 0x03c1}, - {0x03c3, 0x03c9}, - {0x0401, 0x0401}, - {0x0410, 0x044f}, - {0x0451, 0x0451}, - {0x2010, 0x2010}, - {0x2013, 0x2016}, - {0x2018, 0x2019}, - {0x201c, 0x201d}, - {0x2020, 0x2022}, - {0x2024, 0x2027}, - {0x2030, 0x2030}, - {0x2032, 0x2033}, - {0x2035, 0x2035}, - {0x203b, 0x203b}, - {0x203e, 0x203e}, - {0x2074, 0x2074}, - {0x207f, 0x207f}, - {0x2081, 0x2084}, - {0x20ac, 0x20ac}, - {0x2103, 0x2103}, - {0x2105, 0x2105}, - {0x2109, 0x2109}, - {0x2113, 0x2113}, - {0x2116, 0x2116}, - {0x2121, 0x2122}, - {0x2126, 0x2126}, - {0x212b, 0x212b}, - {0x2153, 0x2154}, - {0x215b, 0x215e}, - {0x2160, 0x216b}, - {0x2170, 0x2179}, - {0x2189, 0x2189}, - {0x2190, 0x2199}, - {0x21b8, 0x21b9}, - {0x21d2, 0x21d2}, - {0x21d4, 0x21d4}, - {0x21e7, 0x21e7}, - {0x2200, 0x2200}, - {0x2202, 0x2203}, - {0x2207, 0x2208}, - {0x220b, 0x220b}, - {0x220f, 0x220f}, - {0x2211, 0x2211}, - {0x2215, 0x2215}, - {0x221a, 0x221a}, - {0x221d, 0x2220}, - {0x2223, 0x2223}, - {0x2225, 0x2225}, - {0x2227, 0x222c}, - {0x222e, 0x222e}, - {0x2234, 0x2237}, - {0x223c, 0x223d}, - {0x2248, 0x2248}, - {0x224c, 0x224c}, - {0x2252, 0x2252}, - {0x2260, 0x2261}, - {0x2264, 0x2267}, - {0x226a, 0x226b}, - {0x226e, 0x226f}, - {0x2282, 0x2283}, - {0x2286, 0x2287}, - {0x2295, 0x2295}, - {0x2299, 0x2299}, - {0x22a5, 0x22a5}, - {0x22bf, 0x22bf}, - {0x2312, 0x2312}, - {0x2460, 0x24e9}, - {0x24eb, 0x254b}, - {0x2550, 0x2573}, - {0x2580, 0x258f}, - {0x2592, 0x2595}, - {0x25a0, 0x25a1}, - {0x25a3, 0x25a9}, - {0x25b2, 0x25b3}, - {0x25b6, 0x25b7}, - {0x25bc, 0x25bd}, - {0x25c0, 0x25c1}, - {0x25c6, 0x25c8}, - {0x25cb, 0x25cb}, - {0x25ce, 0x25d1}, - {0x25e2, 0x25e5}, - {0x25ef, 0x25ef}, - {0x2605, 0x2606}, - {0x2609, 0x2609}, - {0x260e, 0x260f}, - {0x2614, 0x2615}, - {0x261c, 0x261c}, - {0x261e, 0x261e}, - {0x2640, 0x2640}, - {0x2642, 0x2642}, - {0x2660, 0x2661}, - {0x2663, 0x2665}, - {0x2667, 0x266a}, - {0x266c, 0x266d}, - {0x266f, 0x266f}, - {0x269e, 0x269f}, - {0x26be, 0x26bf}, - {0x26c4, 0x26cd}, - {0x26cf, 0x26e1}, - {0x26e3, 0x26e3}, - {0x26e8, 0x26ff}, - {0x273d, 0x273d}, - {0x2757, 0x2757}, - {0x2776, 0x277f}, - {0x2b55, 0x2b59}, - {0x3248, 0x324f}, - {0xe000, 0xf8ff}, - {0xfffd, 0xfffd}, - {0x1f100, 0x1f10a}, - {0x1f110, 0x1f12d}, - {0x1f131, 0x1f131}, - {0x1f13d, 0x1f13d}, - {0x1f13f, 0x1f13f}, - {0x1f142, 0x1f142}, - {0x1f146, 0x1f146}, - {0x1f14a, 0x1f14e}, - {0x1f157, 0x1f157}, - {0x1f15f, 0x1f15f}, - {0x1f179, 0x1f179}, - {0x1f17b, 0x1f17c}, - {0x1f17f, 0x1f17f}, - {0x1f18a, 0x1f18d}, - {0x1f190, 0x1f190}, - {0xf0000, 0xffffd}, - {0x100000, 0x10fffd} + {0x1f1e6, 0x1f1ff}, + {0x1f321, 0x1f321}, + {0x1f324, 0x1f32c}, + {0x1f336, 0x1f336}, + {0x1f37d, 0x1f37d}, + {0x1f396, 0x1f397}, + {0x1f399, 0x1f39b}, + {0x1f39e, 0x1f39f}, + {0x1f3cb, 0x1f3ce}, + {0x1f3d4, 0x1f3df}, + {0x1f3f3, 0x1f3f5}, + {0x1f3f7, 0x1f3f7}, + {0x1f43f, 0x1f43f}, + {0x1f441, 0x1f441}, + {0x1f4fd, 0x1f4fd}, + {0x1f549, 0x1f54a}, + {0x1f56f, 0x1f570}, + {0x1f573, 0x1f579}, + {0x1f587, 0x1f587}, + {0x1f58a, 0x1f58d}, + {0x1f590, 0x1f590}, + {0x1f5a5, 0x1f5a5}, + {0x1f5a8, 0x1f5a8}, + {0x1f5b1, 0x1f5b2}, + {0x1f5bc, 0x1f5bc}, + {0x1f5c2, 0x1f5c4}, + {0x1f5d1, 0x1f5d3}, + {0x1f5dc, 0x1f5de}, + {0x1f5e1, 0x1f5e1}, + {0x1f5e3, 0x1f5e3}, + {0x1f5e8, 0x1f5e8}, + {0x1f5ef, 0x1f5ef}, + {0x1f5f3, 0x1f5f3}, + {0x1f5fa, 0x1f5fa}, + {0x1f6cb, 0x1f6cf}, + {0x1f6e0, 0x1f6e5}, + {0x1f6e9, 0x1f6e9}, + {0x1f6f0, 0x1f6f0}, + {0x1f6f3, 0x1f6f3} }; +#ifdef USE_AMBIWIDTH_AUTO + if (gui.in_use && *p_ambw == 'a') + { + int cell; + + /* This is required by screen.c implicitly. */ + if (c == 0) + return 1; + if ((cell = gui_mch_get_charwidth(c)) > 0) + return cell; + } +#endif + if (c >= 0x100) { #ifdef USE_WCHAR_FUNCTIONS @@ -1487,6 +1606,8 @@ utf_char2cells(c) if (intable(doublewidth, sizeof(doublewidth), c)) return 2; #endif + if (p_emoji && intable(emoji_width, sizeof(emoji_width), c)) + return 2; } /* Characters below 0x100 are influenced by 'isprint' option */ @@ -1505,15 +1626,14 @@ utf_char2cells(c) * This doesn't take care of unprintable characters, use ptr2cells() for that. */ int -latin_ptr2cells(p) - char_u *p UNUSED; +latin_ptr2cells(char_u *p UNUSED) { return 1; } int -utf_ptr2cells(p) - char_u *p; +utf_ptr2cells( + char_u *p) { int c; @@ -1533,8 +1653,7 @@ utf_ptr2cells(p) } int -dbcs_ptr2cells(p) - char_u *p; +dbcs_ptr2cells(char_u *p) { /* Number of cells is equal to number of bytes, except for euc-jp when * the first byte is 0x8e. */ @@ -1549,17 +1668,13 @@ dbcs_ptr2cells(p) * For an empty string or truncated character returns 1. */ int -latin_ptr2cells_len(p, size) - char_u *p UNUSED; - int size UNUSED; +latin_ptr2cells_len(char_u *p UNUSED, int size UNUSED) { return 1; } static int -utf_ptr2cells_len(p, size) - char_u *p; - int size; +utf_ptr2cells_len(char_u *p, int size) { int c; @@ -1581,9 +1696,7 @@ utf_ptr2cells_len(p, size) } static int -dbcs_ptr2cells_len(p, size) - char_u *p; - int size; +dbcs_ptr2cells_len(char_u *p, int size) { /* Number of cells is equal to number of bytes, except for euc-jp when * the first byte is 0x8e. */ @@ -1598,15 +1711,13 @@ dbcs_ptr2cells_len(p, size) * Only takes care of multi-byte chars, not "^C" and such. */ int -latin_char2cells(c) - int c UNUSED; +latin_char2cells(int c UNUSED) { return 1; } static int -dbcs_char2cells(c) - int c; +dbcs_char2cells(int c) { /* Number of cells is equal to number of bytes, except for euc-jp when * the first byte is 0x8e. */ @@ -1621,9 +1732,7 @@ dbcs_char2cells(c) * Stop at a NUL character. When "len" >= 0 stop at character "p[len]". */ int -mb_string2cells(p, len) - char_u *p; - int len; +mb_string2cells(char_u *p, int len) { int i; int clen = 0; @@ -1639,17 +1748,13 @@ mb_string2cells(p, len) * We make sure that the offset used is less than "max_off". */ int -latin_off2cells(off, max_off) - unsigned off UNUSED; - unsigned max_off UNUSED; +latin_off2cells(unsigned off UNUSED, unsigned max_off UNUSED) { return 1; } int -dbcs_off2cells(off, max_off) - unsigned off; - unsigned max_off; +dbcs_off2cells(unsigned off, unsigned max_off) { /* never check beyond end of the line */ if (off >= max_off) @@ -1663,9 +1768,7 @@ dbcs_off2cells(off, max_off) } int -utf_off2cells(off, max_off) - unsigned off; - unsigned max_off; +utf_off2cells(unsigned off, unsigned max_off) { return (off + 1 < max_off && ScreenLines[off + 1] == 0) ? 2 : 1; } @@ -1675,15 +1778,13 @@ utf_off2cells(off, max_off) * Convert a byte sequence into a character. */ int -latin_ptr2char(p) - char_u *p; +latin_ptr2char(char_u *p) { return *p; } static int -dbcs_ptr2char(p) - char_u *p; +dbcs_ptr2char(char_u *p) { if (MB_BYTE2LEN(*p) > 1 && p[1] != NUL) return (p[0] << 8) + p[1]; @@ -1694,11 +1795,11 @@ dbcs_ptr2char(p) * Convert a UTF-8 byte sequence to a wide character. * If the sequence is illegal or truncated by a NUL the first byte is * returned. + * For an overlong sequence this may return zero. * Does not include composing characters, of course. */ int -utf_ptr2char(p) - char_u *p; +utf_ptr2char(char_u *p) { int len; @@ -1755,9 +1856,7 @@ utf_ptr2char(p) * "s". */ static int -utf_safe_read_char_adv(s, n) - char_u **s; - size_t *n; +utf_safe_read_char_adv(char_u **s, size_t *n) { int c, k; @@ -1803,8 +1902,7 @@ utf_safe_read_char_adv(s, n) * Note: composing characters are skipped! */ int -mb_ptr2char_adv(pp) - char_u **pp; +mb_ptr2char_adv(char_u **pp) { int c; @@ -1818,8 +1916,7 @@ mb_ptr2char_adv(pp) * Note: composing characters are returned as separate characters. */ int -mb_cptr2char_adv(pp) - char_u **pp; +mb_cptr2char_adv(char_u **pp) { int c; @@ -1837,9 +1934,9 @@ mb_cptr2char_adv(pp) * Note: these are NOT really composing characters! */ int -arabic_combine(one, two) - int one; /* first character */ - int two; /* character just after "one" */ +arabic_combine( + int one, /* first character */ + int two) /* character just after "one" */ { if (one == a_LAM) return arabic_maycombine(two); @@ -1851,8 +1948,7 @@ arabic_combine(one, two) * Arabic combining character, need to check the character before this. */ int -arabic_maycombine(two) - int two; +arabic_maycombine(int two) { if (p_arshape && !p_tbidi) return (two == a_ALEF_MADDA @@ -1868,9 +1964,7 @@ arabic_maycombine(two) * behaves like a composing character. */ int -utf_composinglike(p1, p2) - char_u *p1; - char_u *p2; +utf_composinglike(char_u *p1, char_u *p2) { int c2; @@ -1888,9 +1982,9 @@ utf_composinglike(p1, p2) * composing characters. */ int -utfc_ptr2char(p, pcc) - char_u *p; - int *pcc; /* return: composing chars, last one is 0 */ +utfc_ptr2char( + char_u *p, + int *pcc) /* return: composing chars, last one is 0 */ { int len; int c; @@ -1928,10 +2022,10 @@ utfc_ptr2char(p, pcc) * composing characters. Use no more than p[maxlen]. */ int -utfc_ptr2char_len(p, pcc, maxlen) - char_u *p; - int *pcc; /* return: composing chars, last one is 0 */ - int maxlen; +utfc_ptr2char_len( + char_u *p, + int *pcc, /* return: composing chars, last one is 0 */ + int maxlen) { int len; int c; @@ -1974,9 +2068,7 @@ utfc_ptr2char_len(p, pcc, maxlen) * Returns the produced number of bytes. */ int -utfc_char2bytes(off, buf) - int off; - char_u *buf; +utfc_char2bytes(int off, char_u *buf) { int len; int i; @@ -1998,8 +2090,7 @@ utfc_char2bytes(off, buf) * Returns 1 for an illegal byte sequence. */ int -utf_ptr2len(p) - char_u *p; +utf_ptr2len(char_u *p) { int len; int i; @@ -2019,8 +2110,7 @@ utf_ptr2len(p) * Returns 1 for an invalid first byte value. */ int -utf_byte2len(b) - int b; +utf_byte2len(int b) { return utf8len_tab[b]; } @@ -2034,9 +2124,7 @@ utf_byte2len(b) * Never returns zero. */ int -utf_ptr2len_len(p, size) - char_u *p; - int size; +utf_ptr2len_len(char_u *p, int size) { int len; int i; @@ -2060,8 +2148,7 @@ utf_ptr2len_len(p, size) * This includes following composing characters. */ int -utfc_ptr2len(p) - char_u *p; +utfc_ptr2len(char_u *p) { int len; int b0 = *p; @@ -2108,9 +2195,7 @@ utfc_ptr2len(p) * Returns 1 for an illegal char or an incomplete byte sequence. */ int -utfc_ptr2len_len(p, size) - char_u *p; - int size; +utfc_ptr2len_len(char_u *p, int size) { int len; #ifdef FEAT_ARABIC @@ -2168,8 +2253,7 @@ utfc_ptr2len_len(p, size) * This does not include composing characters. */ int -utf_char2len(c) - int c; +utf_char2len(int c) { if (c < 0x80) return 1; @@ -2187,12 +2271,9 @@ utf_char2len(c) /* * Convert Unicode character "c" to UTF-8 string in "buf[]". * Returns the number of bytes. - * This does not include composing characters. */ int -utf_char2bytes(c, buf) - int c; - char_u *buf; +utf_char2bytes(int c, char_u *buf) { if (c < 0x80) /* 7 bits */ { @@ -2239,14 +2320,24 @@ utf_char2bytes(c, buf) return 6; } +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * utf_iscomposing() with different argument type for libvterm. + */ + int +utf_iscomposing_uint(UINT32_T c) +{ + return utf_iscomposing((int)c); +} +#endif + /* * Return TRUE if "c" is a composing UTF-8 character. This means it will be * drawn on top of the preceding character. * Based on code from Markus Kuhn. */ int -utf_iscomposing(c) - int c; +utf_iscomposing(int c) { /* Sorted list of non-overlapping intervals. * Generated by ../runtime/tools/unicode.vim. */ @@ -2260,10 +2351,10 @@ utf_iscomposing(c) {0x05c4, 0x05c5}, {0x05c7, 0x05c7}, {0x0610, 0x061a}, - {0x064b, 0x065e}, + {0x064b, 0x065f}, {0x0670, 0x0670}, {0x06d6, 0x06dc}, - {0x06de, 0x06e4}, + {0x06df, 0x06e4}, {0x06e7, 0x06e8}, {0x06ea, 0x06ed}, {0x0711, 0x0711}, @@ -2274,10 +2365,12 @@ utf_iscomposing(c) {0x081b, 0x0823}, {0x0825, 0x0827}, {0x0829, 0x082d}, - {0x0900, 0x0903}, - {0x093c, 0x093c}, - {0x093e, 0x094e}, - {0x0951, 0x0955}, + {0x0859, 0x085b}, + {0x08d4, 0x08e1}, + {0x08e3, 0x0903}, + {0x093a, 0x093c}, + {0x093e, 0x094f}, + {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0983}, {0x09bc, 0x09bc}, @@ -2300,6 +2393,7 @@ utf_iscomposing(c) {0x0ac7, 0x0ac9}, {0x0acb, 0x0acd}, {0x0ae2, 0x0ae3}, + {0x0afa, 0x0aff}, {0x0b01, 0x0b03}, {0x0b3c, 0x0b3c}, {0x0b3e, 0x0b44}, @@ -2312,20 +2406,21 @@ utf_iscomposing(c) {0x0bc6, 0x0bc8}, {0x0bca, 0x0bcd}, {0x0bd7, 0x0bd7}, - {0x0c01, 0x0c03}, + {0x0c00, 0x0c03}, {0x0c3e, 0x0c44}, {0x0c46, 0x0c48}, {0x0c4a, 0x0c4d}, {0x0c55, 0x0c56}, {0x0c62, 0x0c63}, - {0x0c82, 0x0c83}, + {0x0c81, 0x0c83}, {0x0cbc, 0x0cbc}, {0x0cbe, 0x0cc4}, {0x0cc6, 0x0cc8}, {0x0cca, 0x0ccd}, {0x0cd5, 0x0cd6}, {0x0ce2, 0x0ce3}, - {0x0d02, 0x0d03}, + {0x0d00, 0x0d03}, + {0x0d3b, 0x0d3c}, {0x0d3e, 0x0d44}, {0x0d46, 0x0d48}, {0x0d4a, 0x0d4d}, @@ -2351,7 +2446,7 @@ utf_iscomposing(c) {0x0f3e, 0x0f3f}, {0x0f71, 0x0f84}, {0x0f86, 0x0f87}, - {0x0f90, 0x0f97}, + {0x0f8d, 0x0f97}, {0x0f99, 0x0fbc}, {0x0fc6, 0x0fc6}, {0x102b, 0x103e}, @@ -2363,82 +2458,153 @@ utf_iscomposing(c) {0x1082, 0x108d}, {0x108f, 0x108f}, {0x109a, 0x109d}, - {0x135f, 0x135f}, + {0x135d, 0x135f}, {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, - {0x17b6, 0x17d3}, + {0x17b4, 0x17d3}, {0x17dd, 0x17dd}, {0x180b, 0x180d}, + {0x1885, 0x1886}, {0x18a9, 0x18a9}, {0x1920, 0x192b}, {0x1930, 0x193b}, - {0x19b0, 0x19c0}, - {0x19c8, 0x19c9}, {0x1a17, 0x1a1b}, {0x1a55, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a7f}, + {0x1ab0, 0x1abe}, {0x1b00, 0x1b04}, {0x1b34, 0x1b44}, {0x1b6b, 0x1b73}, {0x1b80, 0x1b82}, - {0x1ba1, 0x1baa}, + {0x1ba1, 0x1bad}, + {0x1be6, 0x1bf3}, {0x1c24, 0x1c37}, {0x1cd0, 0x1cd2}, {0x1cd4, 0x1ce8}, {0x1ced, 0x1ced}, - {0x1cf2, 0x1cf2}, - {0x1dc0, 0x1de6}, - {0x1dfd, 0x1dff}, + {0x1cf2, 0x1cf4}, + {0x1cf7, 0x1cf9}, + {0x1dc0, 0x1df9}, + {0x1dfb, 0x1dff}, {0x20d0, 0x20f0}, {0x2cef, 0x2cf1}, + {0x2d7f, 0x2d7f}, {0x2de0, 0x2dff}, {0x302a, 0x302f}, {0x3099, 0x309a}, {0xa66f, 0xa672}, - {0xa67c, 0xa67d}, + {0xa674, 0xa67d}, + {0xa69e, 0xa69f}, {0xa6f0, 0xa6f1}, {0xa802, 0xa802}, {0xa806, 0xa806}, {0xa80b, 0xa80b}, {0xa823, 0xa827}, {0xa880, 0xa881}, - {0xa8b4, 0xa8c4}, + {0xa8b4, 0xa8c5}, {0xa8e0, 0xa8f1}, {0xa926, 0xa92d}, {0xa947, 0xa953}, {0xa980, 0xa983}, {0xa9b3, 0xa9c0}, + {0xa9e5, 0xa9e5}, {0xaa29, 0xaa36}, {0xaa43, 0xaa43}, {0xaa4c, 0xaa4d}, - {0xaa7b, 0xaa7b}, + {0xaa7b, 0xaa7d}, {0xaab0, 0xaab0}, {0xaab2, 0xaab4}, {0xaab7, 0xaab8}, {0xaabe, 0xaabf}, {0xaac1, 0xaac1}, + {0xaaeb, 0xaaef}, + {0xaaf5, 0xaaf6}, {0xabe3, 0xabea}, {0xabec, 0xabed}, {0xfb1e, 0xfb1e}, {0xfe00, 0xfe0f}, - {0xfe20, 0xfe26}, + {0xfe20, 0xfe2f}, {0x101fd, 0x101fd}, + {0x102e0, 0x102e0}, + {0x10376, 0x1037a}, {0x10a01, 0x10a03}, {0x10a05, 0x10a06}, {0x10a0c, 0x10a0f}, {0x10a38, 0x10a3a}, {0x10a3f, 0x10a3f}, - {0x11080, 0x11082}, + {0x10ae5, 0x10ae6}, + {0x11000, 0x11002}, + {0x11038, 0x11046}, + {0x1107f, 0x11082}, {0x110b0, 0x110ba}, + {0x11100, 0x11102}, + {0x11127, 0x11134}, + {0x11173, 0x11173}, + {0x11180, 0x11182}, + {0x111b3, 0x111c0}, + {0x111ca, 0x111cc}, + {0x1122c, 0x11237}, + {0x1123e, 0x1123e}, + {0x112df, 0x112ea}, + {0x11300, 0x11303}, + {0x1133c, 0x1133c}, + {0x1133e, 0x11344}, + {0x11347, 0x11348}, + {0x1134b, 0x1134d}, + {0x11357, 0x11357}, + {0x11362, 0x11363}, + {0x11366, 0x1136c}, + {0x11370, 0x11374}, + {0x11435, 0x11446}, + {0x114b0, 0x114c3}, + {0x115af, 0x115b5}, + {0x115b8, 0x115c0}, + {0x115dc, 0x115dd}, + {0x11630, 0x11640}, + {0x116ab, 0x116b7}, + {0x1171d, 0x1172b}, + {0x11a01, 0x11a0a}, + {0x11a33, 0x11a39}, + {0x11a3b, 0x11a3e}, + {0x11a47, 0x11a47}, + {0x11a51, 0x11a5b}, + {0x11a8a, 0x11a99}, + {0x11c2f, 0x11c36}, + {0x11c38, 0x11c3f}, + {0x11c92, 0x11ca7}, + {0x11ca9, 0x11cb6}, + {0x11d31, 0x11d36}, + {0x11d3a, 0x11d3a}, + {0x11d3c, 0x11d3d}, + {0x11d3f, 0x11d45}, + {0x11d47, 0x11d47}, + {0x16af0, 0x16af4}, + {0x16b30, 0x16b36}, + {0x16f51, 0x16f7e}, + {0x16f8f, 0x16f92}, + {0x1bc9d, 0x1bc9e}, {0x1d165, 0x1d169}, {0x1d16d, 0x1d172}, {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0x1d242, 0x1d244}, + {0x1da00, 0x1da36}, + {0x1da3b, 0x1da6c}, + {0x1da75, 0x1da75}, + {0x1da84, 0x1da84}, + {0x1da9b, 0x1da9f}, + {0x1daa1, 0x1daaf}, + {0x1e000, 0x1e006}, + {0x1e008, 0x1e018}, + {0x1e01b, 0x1e021}, + {0x1e023, 0x1e024}, + {0x1e026, 0x1e02a}, + {0x1e8d0, 0x1e8d6}, + {0x1e944, 0x1e94a}, {0xe0100, 0xe01ef} }; @@ -2450,8 +2616,7 @@ utf_iscomposing(c) * Only for characters of 0x100 and above! */ int -utf_printable(c) - int c; +utf_printable(int c) { #ifdef USE_WCHAR_FUNCTIONS /* @@ -2472,6 +2637,152 @@ utf_printable(c) #endif } +/* Sorted list of non-overlapping intervals of all Emoji characters, + * based on http://unicode.org/emoji/charts/emoji-list.html */ +static struct interval emoji_all[] = +{ + {0x203c, 0x203c}, + {0x2049, 0x2049}, + {0x2122, 0x2122}, + {0x2139, 0x2139}, + {0x2194, 0x2199}, + {0x21a9, 0x21aa}, + {0x231a, 0x231b}, + {0x2328, 0x2328}, + {0x23cf, 0x23cf}, + {0x23e9, 0x23f3}, + {0x23f8, 0x23fa}, + {0x24c2, 0x24c2}, + {0x25aa, 0x25ab}, + {0x25b6, 0x25b6}, + {0x25c0, 0x25c0}, + {0x25fb, 0x25fe}, + {0x2600, 0x2604}, + {0x260e, 0x260e}, + {0x2611, 0x2611}, + {0x2614, 0x2615}, + {0x2618, 0x2618}, + {0x261d, 0x261d}, + {0x2620, 0x2620}, + {0x2622, 0x2623}, + {0x2626, 0x2626}, + {0x262a, 0x262a}, + {0x262e, 0x262f}, + {0x2638, 0x263a}, + {0x2640, 0x2640}, + {0x2642, 0x2642}, + {0x2648, 0x2653}, + {0x2660, 0x2660}, + {0x2663, 0x2663}, + {0x2665, 0x2666}, + {0x2668, 0x2668}, + {0x267b, 0x267b}, + {0x267f, 0x267f}, + {0x2692, 0x2697}, + {0x2699, 0x2699}, + {0x269b, 0x269c}, + {0x26a0, 0x26a1}, + {0x26aa, 0x26ab}, + {0x26b0, 0x26b1}, + {0x26bd, 0x26be}, + {0x26c4, 0x26c5}, + {0x26c8, 0x26c8}, + {0x26ce, 0x26cf}, + {0x26d1, 0x26d1}, + {0x26d3, 0x26d4}, + {0x26e9, 0x26ea}, + {0x26f0, 0x26f5}, + {0x26f7, 0x26fa}, + {0x26fd, 0x26fd}, + {0x2702, 0x2702}, + {0x2705, 0x2705}, + {0x2708, 0x270d}, + {0x270f, 0x270f}, + {0x2712, 0x2712}, + {0x2714, 0x2714}, + {0x2716, 0x2716}, + {0x271d, 0x271d}, + {0x2721, 0x2721}, + {0x2728, 0x2728}, + {0x2733, 0x2734}, + {0x2744, 0x2744}, + {0x2747, 0x2747}, + {0x274c, 0x274c}, + {0x274e, 0x274e}, + {0x2753, 0x2755}, + {0x2757, 0x2757}, + {0x2763, 0x2764}, + {0x2795, 0x2797}, + {0x27a1, 0x27a1}, + {0x27b0, 0x27b0}, + {0x27bf, 0x27bf}, + {0x2934, 0x2935}, + {0x2b05, 0x2b07}, + {0x2b1b, 0x2b1c}, + {0x2b50, 0x2b50}, + {0x2b55, 0x2b55}, + {0x3030, 0x3030}, + {0x303d, 0x303d}, + {0x3297, 0x3297}, + {0x3299, 0x3299}, + {0x1f004, 0x1f004}, + {0x1f0cf, 0x1f0cf}, + {0x1f170, 0x1f171}, + {0x1f17e, 0x1f17f}, + {0x1f18e, 0x1f18e}, + {0x1f191, 0x1f19a}, + {0x1f1e6, 0x1f1ff}, + {0x1f201, 0x1f202}, + {0x1f21a, 0x1f21a}, + {0x1f22f, 0x1f22f}, + {0x1f232, 0x1f23a}, + {0x1f250, 0x1f251}, + {0x1f300, 0x1f321}, + {0x1f324, 0x1f393}, + {0x1f396, 0x1f397}, + {0x1f399, 0x1f39b}, + {0x1f39e, 0x1f3f0}, + {0x1f3f3, 0x1f3f5}, + {0x1f3f7, 0x1f4fd}, + {0x1f4ff, 0x1f53d}, + {0x1f549, 0x1f54e}, + {0x1f550, 0x1f567}, + {0x1f56f, 0x1f570}, + {0x1f573, 0x1f57a}, + {0x1f587, 0x1f587}, + {0x1f58a, 0x1f58d}, + {0x1f590, 0x1f590}, + {0x1f595, 0x1f596}, + {0x1f5a4, 0x1f5a5}, + {0x1f5a8, 0x1f5a8}, + {0x1f5b1, 0x1f5b2}, + {0x1f5bc, 0x1f5bc}, + {0x1f5c2, 0x1f5c4}, + {0x1f5d1, 0x1f5d3}, + {0x1f5dc, 0x1f5de}, + {0x1f5e1, 0x1f5e1}, + {0x1f5e3, 0x1f5e3}, + {0x1f5e8, 0x1f5e8}, + {0x1f5ef, 0x1f5ef}, + {0x1f5f3, 0x1f5f3}, + {0x1f5fa, 0x1f64f}, + {0x1f680, 0x1f6c5}, + {0x1f6cb, 0x1f6d2}, + {0x1f6e0, 0x1f6e5}, + {0x1f6e9, 0x1f6e9}, + {0x1f6eb, 0x1f6ec}, + {0x1f6f0, 0x1f6f0}, + {0x1f6f3, 0x1f6f8}, + {0x1f910, 0x1f93a}, + {0x1f93c, 0x1f93e}, + {0x1f940, 0x1f945}, + {0x1f947, 0x1f94c}, + {0x1f950, 0x1f96b}, + {0x1f980, 0x1f997}, + {0x1f9c0, 0x1f9c0}, + {0x1f9d0, 0x1f9e6} +}; + /* * Get class of a Unicode character. * 0: white space @@ -2479,8 +2790,13 @@ utf_printable(c) * 2 or bigger: some class of word character. */ int -utf_class(c) - int c; +utf_class(int c) +{ + return utf_class_buf(c, curbuf); +} + + int +utf_class_buf(int c, buf_T *buf) { /* sorted list of non-overlapping intervals */ static struct clinterval @@ -2537,6 +2853,7 @@ utf_class(c) {0x2900, 0x2998, 1}, /* arrows, brackets, etc. */ {0x29d8, 0x29db, 1}, {0x29fc, 0x29fd, 1}, + {0x2e00, 0x2e7f, 1}, /* supplemental punctuation */ {0x3000, 0x3000, 0}, /* ideographic space */ {0x3001, 0x3020, 1}, /* ideographic punctuation */ {0x3030, 0x3030, 1}, @@ -2557,6 +2874,7 @@ utf_class(c) {0x2b740, 0x2b81f, 0x4e00}, /* CJK Ideographs */ {0x2f800, 0x2fa1f, 0x4e00}, /* CJK Ideographs */ }; + int bot = 0; int top = sizeof(classes) / sizeof(struct clinterval) - 1; int mid; @@ -2566,7 +2884,7 @@ utf_class(c) { if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) return 0; /* blank */ - if (vim_iswordc(c)) + if (vim_iswordc_buf(c, buf)) return 2; /* word character */ return 1; /* punctuation */ } @@ -2583,10 +2901,21 @@ utf_class(c) return (int)classes[mid].class; } + /* emoji */ + if (intable(emoji_all, sizeof(emoji_all), c)) + return 3; + /* most other characters are "word" characters */ return 2; } + int +utf_ambiguous_width(int c) +{ + return c >= 0x80 && (intable(ambiguous, sizeof(ambiguous), c) + || intable(emoji_all, sizeof(emoji_all), c)); +} + /* * Code for Unicode case-dependent operations. Based on notes in * http://www.unicode.org/Public/UNIDATA/CaseFolding.txt @@ -2677,6 +3006,7 @@ static convertStruct foldCase[] = {0x345,0x345,-1,116}, {0x370,0x372,2,1}, {0x376,0x376,-1,1}, + {0x37f,0x37f,-1,116}, {0x386,0x386,-1,38}, {0x388,0x38a,1,37}, {0x38c,0x38c,-1,64}, @@ -2704,9 +3034,19 @@ static convertStruct foldCase[] = {0x48a,0x4be,2,1}, {0x4c0,0x4c0,-1,15}, {0x4c1,0x4cd,2,1}, - {0x4d0,0x524,2,1}, + {0x4d0,0x52e,2,1}, {0x531,0x556,1,48}, {0x10a0,0x10c5,1,7264}, + {0x10c7,0x10cd,6,7264}, + {0x13f8,0x13fd,1,-8}, + {0x1c80,0x1c80,-1,-6222}, + {0x1c81,0x1c81,-1,-6221}, + {0x1c82,0x1c82,-1,-6212}, + {0x1c83,0x1c84,1,-6210}, + {0x1c85,0x1c85,-1,-6211}, + {0x1c86,0x1c86,-1,-6204}, + {0x1c87,0x1c87,-1,-6180}, + {0x1c88,0x1c88,-1,35267}, {0x1e00,0x1e94,2,1}, {0x1e9b,0x1e9b,-1,-58}, {0x1e9e,0x1e9e,-1,-7615}, @@ -2756,21 +3096,39 @@ static convertStruct foldCase[] = {0x2c7e,0x2c7f,1,-10815}, {0x2c80,0x2ce2,2,1}, {0x2ceb,0x2ced,2,1}, - {0xa640,0xa65e,2,1}, - {0xa662,0xa66c,2,1}, - {0xa680,0xa696,2,1}, + {0x2cf2,0xa640,31054,1}, + {0xa642,0xa66c,2,1}, + {0xa680,0xa69a,2,1}, {0xa722,0xa72e,2,1}, {0xa732,0xa76e,2,1}, {0xa779,0xa77b,2,1}, {0xa77d,0xa77d,-1,-35332}, {0xa77e,0xa786,2,1}, {0xa78b,0xa78b,-1,1}, + {0xa78d,0xa78d,-1,-42280}, + {0xa790,0xa792,2,1}, + {0xa796,0xa7a8,2,1}, + {0xa7aa,0xa7aa,-1,-42308}, + {0xa7ab,0xa7ab,-1,-42319}, + {0xa7ac,0xa7ac,-1,-42315}, + {0xa7ad,0xa7ad,-1,-42305}, + {0xa7ae,0xa7ae,-1,-42308}, + {0xa7b0,0xa7b0,-1,-42258}, + {0xa7b1,0xa7b1,-1,-42282}, + {0xa7b2,0xa7b2,-1,-42261}, + {0xa7b3,0xa7b3,-1,928}, + {0xa7b4,0xa7b6,2,1}, + {0xab70,0xabbf,1,-38864}, {0xff21,0xff3a,1,32}, - {0x10400,0x10427,1,40} + {0x10400,0x10427,1,40}, + {0x104b0,0x104d3,1,40}, + {0x10c80,0x10cb2,1,64}, + {0x118a0,0x118bf,1,32}, + {0x1e900,0x1e921,1,34} }; -static int utf_convert __ARGS((int a, convertStruct table[], int tableSize)); -static int utf_strnicmp __ARGS((char_u *s1, char_u *s2, size_t n1, size_t n2)); +static int utf_convert(int a, convertStruct table[], int tableSize); +static int utf_strnicmp(char_u *s1, char_u *s2, size_t n1, size_t n2); /* * Generic conversion function for case operations. @@ -2778,10 +3136,10 @@ static int utf_strnicmp __ARGS((char_u *s1, char_u *s2, size_t n1, size_t n2)); * the given conversion "table". Uses binary search on "table". */ static int -utf_convert(a, table, tableSize) - int a; - convertStruct table[]; - int tableSize; +utf_convert( + int a, + convertStruct table[], + int tableSize) { int start, mid, end; /* indices into table */ int entries = tableSize / sizeof(convertStruct); @@ -2811,9 +3169,11 @@ utf_convert(a, table, tableSize) * simple case folding. */ int -utf_fold(a) - int a; +utf_fold(int a) { + if (a < 0x80) + /* be fast for ASCII */ + return a >= 0x41 && a <= 0x5a ? a + 32 : a; return utf_convert(a, foldCase, (int)sizeof(foldCase)); } @@ -2883,6 +3243,7 @@ static convertStruct toLower[] = {0x246,0x24e,2,1}, {0x370,0x372,2,1}, {0x376,0x376,-1,1}, + {0x37f,0x37f,-1,116}, {0x386,0x386,-1,38}, {0x388,0x38a,1,37}, {0x38c,0x38c,-1,64}, @@ -2902,9 +3263,12 @@ static convertStruct toLower[] = {0x48a,0x4be,2,1}, {0x4c0,0x4c0,-1,15}, {0x4c1,0x4cd,2,1}, - {0x4d0,0x524,2,1}, + {0x4d0,0x52e,2,1}, {0x531,0x556,1,48}, {0x10a0,0x10c5,1,7264}, + {0x10c7,0x10cd,6,7264}, + {0x13a0,0x13ef,1,38864}, + {0x13f0,0x13f5,1,8}, {0x1e00,0x1e94,2,1}, {0x1e9e,0x1e9e,-1,-7615}, {0x1ea0,0x1efe,2,1}, @@ -2952,24 +3316,41 @@ static convertStruct toLower[] = {0x2c7e,0x2c7f,1,-10815}, {0x2c80,0x2ce2,2,1}, {0x2ceb,0x2ced,2,1}, - {0xa640,0xa65e,2,1}, - {0xa662,0xa66c,2,1}, - {0xa680,0xa696,2,1}, + {0x2cf2,0xa640,31054,1}, + {0xa642,0xa66c,2,1}, + {0xa680,0xa69a,2,1}, {0xa722,0xa72e,2,1}, {0xa732,0xa76e,2,1}, {0xa779,0xa77b,2,1}, {0xa77d,0xa77d,-1,-35332}, {0xa77e,0xa786,2,1}, {0xa78b,0xa78b,-1,1}, + {0xa78d,0xa78d,-1,-42280}, + {0xa790,0xa792,2,1}, + {0xa796,0xa7a8,2,1}, + {0xa7aa,0xa7aa,-1,-42308}, + {0xa7ab,0xa7ab,-1,-42319}, + {0xa7ac,0xa7ac,-1,-42315}, + {0xa7ad,0xa7ad,-1,-42305}, + {0xa7ae,0xa7ae,-1,-42308}, + {0xa7b0,0xa7b0,-1,-42258}, + {0xa7b1,0xa7b1,-1,-42282}, + {0xa7b2,0xa7b2,-1,-42261}, + {0xa7b3,0xa7b3,-1,928}, + {0xa7b4,0xa7b6,2,1}, {0xff21,0xff3a,1,32}, - {0x10400,0x10427,1,40} + {0x10400,0x10427,1,40}, + {0x104b0,0x104d3,1,40}, + {0x10c80,0x10cb2,1,64}, + {0x118a0,0x118bf,1,32}, + {0x1e900,0x1e921,1,34} }; static convertStruct toUpper[] = { {0x61,0x7a,1,-32}, {0xb5,0xb5,-1,743}, - {0xe0,0xf6,1,-32}, /* 0xdf (German sharp s) is not upper-cased */ + {0xe0,0xf6,1,-32}, {0xf8,0xfe,1,-32}, {0xff,0xff,-1,121}, {0x101,0x12f,2,-1}, @@ -3019,22 +3400,31 @@ static convertStruct toUpper[] = {0x256,0x257,1,-205}, {0x259,0x259,-1,-202}, {0x25b,0x25b,-1,-203}, + {0x25c,0x25c,-1,42319}, {0x260,0x260,-1,-205}, + {0x261,0x261,-1,42315}, {0x263,0x263,-1,-207}, + {0x265,0x265,-1,42280}, + {0x266,0x266,-1,42308}, {0x268,0x268,-1,-209}, {0x269,0x269,-1,-211}, + {0x26a,0x26a,-1,42308}, {0x26b,0x26b,-1,10743}, + {0x26c,0x26c,-1,42305}, {0x26f,0x26f,-1,-211}, {0x271,0x271,-1,10749}, {0x272,0x272,-1,-213}, {0x275,0x275,-1,-214}, {0x27d,0x27d,-1,10727}, {0x280,0x283,3,-218}, + {0x287,0x287,-1,42282}, {0x288,0x288,-1,-218}, {0x289,0x289,-1,-69}, {0x28a,0x28b,1,-217}, {0x28c,0x28c,-1,-71}, {0x292,0x292,-1,-219}, + {0x29d,0x29d,-1,42261}, + {0x29e,0x29e,-1,42258}, {0x345,0x345,-1,84}, {0x371,0x373,2,-1}, {0x377,0x377,-1,-1}, @@ -3055,6 +3445,7 @@ static convertStruct toUpper[] = {0x3f0,0x3f0,-1,-86}, {0x3f1,0x3f1,-1,-80}, {0x3f2,0x3f2,-1,7}, + {0x3f3,0x3f3,-1,-116}, {0x3f5,0x3f5,-1,-96}, {0x3f8,0x3fb,3,-1}, {0x430,0x44f,1,-32}, @@ -3063,8 +3454,17 @@ static convertStruct toUpper[] = {0x48b,0x4bf,2,-1}, {0x4c2,0x4ce,2,-1}, {0x4cf,0x4cf,-1,-15}, - {0x4d1,0x525,2,-1}, + {0x4d1,0x52f,2,-1}, {0x561,0x586,1,-48}, + {0x13f8,0x13fd,1,-8}, + {0x1c80,0x1c80,-1,-6254}, + {0x1c81,0x1c81,-1,-6253}, + {0x1c82,0x1c82,-1,-6244}, + {0x1c83,0x1c84,1,-6242}, + {0x1c85,0x1c85,-1,-6243}, + {0x1c86,0x1c86,-1,-6236}, + {0x1c87,0x1c87,-1,-6181}, + {0x1c88,0x1c88,-1,35266}, {0x1d79,0x1d79,-1,35332}, {0x1d7d,0x1d7d,-1,3814}, {0x1e01,0x1e95,2,-1}, @@ -3106,17 +3506,27 @@ static convertStruct toUpper[] = {0x2c73,0x2c76,3,-1}, {0x2c81,0x2ce3,2,-1}, {0x2cec,0x2cee,2,-1}, + {0x2cf3,0x2cf3,-1,-1}, {0x2d00,0x2d25,1,-7264}, - {0xa641,0xa65f,2,-1}, - {0xa663,0xa66d,2,-1}, - {0xa681,0xa697,2,-1}, + {0x2d27,0x2d2d,6,-7264}, + {0xa641,0xa66d,2,-1}, + {0xa681,0xa69b,2,-1}, {0xa723,0xa72f,2,-1}, {0xa733,0xa76f,2,-1}, {0xa77a,0xa77c,2,-1}, {0xa77f,0xa787,2,-1}, - {0xa78c,0xa78c,-1,-1}, + {0xa78c,0xa791,5,-1}, + {0xa793,0xa797,4,-1}, + {0xa799,0xa7a9,2,-1}, + {0xa7b5,0xa7b7,2,-1}, + {0xab53,0xab53,-1,-928}, + {0xab70,0xabbf,1,-38864}, {0xff41,0xff5a,1,-32}, - {0x10428,0x1044f,1,-40} + {0x10428,0x1044f,1,-40}, + {0x104d8,0x104fb,1,-40}, + {0x10cc0,0x10cf2,1,-64}, + {0x118c0,0x118df,1,-32}, + {0x1e922,0x1e943,1,-34} }; /* @@ -3124,8 +3534,7 @@ static convertStruct toUpper[] = * simple case folding. */ int -utf_toupper(a) - int a; +utf_toupper(int a) { /* If 'casemap' contains "keepascii" use ASCII style toupper(). */ if (a < 128 && (cmp_flags & CMP_KEEPASCII)) @@ -3146,8 +3555,7 @@ utf_toupper(a) } int -utf_islower(a) - int a; +utf_islower(int a) { /* German sharp s is lower case but has no upper case equivalent. */ return (utf_toupper(a) != a) || a == 0xdf; @@ -3158,8 +3566,7 @@ utf_islower(a) * simple case folding. */ int -utf_tolower(a) - int a; +utf_tolower(int a) { /* If 'casemap' contains "keepascii" use ASCII style tolower(). */ if (a < 128 && (cmp_flags & CMP_KEEPASCII)) @@ -3180,16 +3587,17 @@ utf_tolower(a) } int -utf_isupper(a) - int a; +utf_isupper(int a) { return (utf_tolower(a) != a); } static int -utf_strnicmp(s1, s2, n1, n2) - char_u *s1, *s2; - size_t n1, n2; +utf_strnicmp( + char_u *s1, + char_u *s2, + size_t n1, + size_t n2) { int c1, c2, cdiff; char_u buffer[6]; @@ -3269,9 +3677,7 @@ utf_strnicmp(s1, s2, n1, n2) * two characters otherwise. */ int -mb_strnicmp(s1, s2, nn) - char_u *s1, *s2; - size_t nn; +mb_strnicmp(char_u *s1, char_u *s2, size_t nn) { int i, l; int cdiff; @@ -3318,7 +3724,7 @@ mb_strnicmp(s1, s2, nn) * 'encoding' has been set to. */ void -show_utf8() +show_utf8(void) { int len; int rlen = 0; @@ -3367,17 +3773,13 @@ show_utf8() * Returns 0 when already at the first byte of a character. */ int -latin_head_off(base, p) - char_u *base UNUSED; - char_u *p UNUSED; +latin_head_off(char_u *base UNUSED, char_u *p UNUSED) { return 0; } int -dbcs_head_off(base, p) - char_u *base; - char_u *p; +dbcs_head_off(char_u *base, char_u *p) { char_u *q; @@ -3399,9 +3801,7 @@ dbcs_head_off(base, p) * single-width DBCS_JPNU characters are stored separately. */ int -dbcs_screen_head_off(base, p) - char_u *base; - char_u *p; +dbcs_screen_head_off(char_u *base, char_u *p) { char_u *q; @@ -3431,9 +3831,7 @@ dbcs_screen_head_off(base, p) } int -utf_head_off(base, p) - char_u *base; - char_u *p; +utf_head_off(char_u *base, char_u *p) { char_u *q; char_u *s; @@ -3492,9 +3890,7 @@ utf_head_off(base, p) * Copy a character from "*fp" to "*tp" and advance the pointers. */ void -mb_copy_char(fp, tp) - char_u **fp; - char_u **tp; +mb_copy_char(char_u **fp, char_u **tp) { int l = (*mb_ptr2len)(*fp); @@ -3509,9 +3905,7 @@ mb_copy_char(fp, tp) * character. Can start anywhere in a stream of bytes. */ int -mb_off_next(base, p) - char_u *base; - char_u *p; +mb_off_next(char_u *base, char_u *p) { int i; int j; @@ -3546,9 +3940,7 @@ mb_off_next(base, p) * into. Can start anywhere in a stream of bytes. */ int -mb_tail_off(base, p) - char_u *base; - char_u *p; +mb_tail_off(char_u *base, char_u *p) { int i; int j; @@ -3583,7 +3975,7 @@ mb_tail_off(base, p) * Find the next illegal byte sequence. */ void -utf_find_illegal() +utf_find_illegal(void) { pos_T pos = curwin->w_cursor; char_u *p; @@ -3662,9 +4054,7 @@ utf_find_illegal() * When "end" is positive stop there. */ int -utf_valid_string(s, end) - char_u *s; - char_u *end; +utf_valid_string(char_u *s, char_u *end) { int l; char_u *p = s; @@ -3690,9 +4080,7 @@ utf_valid_string(s, end) * Special version of mb_tail_off() for use in ScreenLines[]. */ int -dbcs_screen_tail_off(base, p) - char_u *base; - char_u *p; +dbcs_screen_tail_off(char_u *base, char_u *p) { /* It can't be the first byte if a double-byte when not using DBCS, at the * end of the string or the byte can't start a double-byte. @@ -3714,7 +4102,7 @@ dbcs_screen_tail_off(base, p) * Return TRUE when the cursor was adjusted. */ void -mb_adjust_cursor() +mb_adjust_cursor(void) { mb_adjustpos(curbuf, &curwin->w_cursor); } @@ -3724,9 +4112,7 @@ mb_adjust_cursor() * If it points to a tail byte it's moved backwards to the head byte. */ void -mb_adjustpos(buf, lp) - buf_T *buf; - pos_T *lp; +mb_adjustpos(buf_T *buf, pos_T *lp) { char_u *p; @@ -3737,7 +4123,10 @@ mb_adjustpos(buf, lp) ) { p = ml_get_buf(buf, lp->lnum, FALSE); - lp->col -= (*mb_head_off)(p, p + lp->col); + if (*p == NUL || (int)STRLEN(p) < lp->col) + lp->col = 0; + else + lp->col -= (*mb_head_off)(p, p + lp->col); #ifdef FEAT_VIRTUALEDIT /* Reset "coladd" when the cursor would be on the right half of a * double-wide character. */ @@ -3754,12 +4143,12 @@ mb_adjustpos(buf, lp) * Return a pointer to the character before "*p", if there is one. */ char_u * -mb_prevptr(line, p) - char_u *line; /* start of the string */ - char_u *p; +mb_prevptr( + char_u *line, /* start of the string */ + char_u *p) { if (p > line) - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); return p; } @@ -3768,8 +4157,7 @@ mb_prevptr(line, p) * following composing characters) counts as one. */ int -mb_charlen(str) - char_u *str; +mb_charlen(char_u *str) { char_u *p = str; int count; @@ -3788,9 +4176,7 @@ mb_charlen(str) * Like mb_charlen() but for a string with specified length. */ int -mb_charlen_len(str, len) - char_u *str; - int len; +mb_charlen_len(char_u *str, int len) { char_u *p = str; int count; @@ -3810,8 +4196,7 @@ mb_charlen_len(str, len) * Return NULL if no multi-byte char was found. */ char_u * -mb_unescape(pp) - char_u **pp; +mb_unescape(char_u **pp) { static char_u buf[6]; int n; @@ -3872,9 +4257,7 @@ mb_unescape(pp) * Caller must make sure "row" and "col" are not invalid! */ int -mb_lefthalve(row, col) - int row; - int col; +mb_lefthalve(int row, int col) { #ifdef FEAT_HANGULIN if (composing_hangul) @@ -3889,9 +4272,7 @@ mb_lefthalve(row, col) * char move it to the left half. Returns the corrected column. */ int -mb_fix_col(col, row) - int col; - int row; +mb_fix_col(int col, int row) { col = check_col(col); row = check_row(row); @@ -3907,14 +4288,13 @@ mb_fix_col(col, row) #endif #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) || defined(PROTO) -static int enc_alias_search __ARGS((char_u *name)); +static int enc_alias_search(char_u *name); /* * Skip the Vim specific head of a 'encoding' name. */ char_u * -enc_skip(p) - char_u *p; +enc_skip(char_u *p) { if (STRNCMP(p, "2byte-", 6) == 0) return p + 6; @@ -3930,8 +4310,7 @@ enc_skip(p) * Returns an allocated string. NULL for out-of-memory. */ char_u * -enc_canonize(enc) - char_u *enc; +enc_canonize(char_u *enc) { char_u *r; char_u *p, *s; @@ -4009,8 +4388,7 @@ enc_canonize(enc) * Returns -1 when not found. */ static int -enc_alias_search(name) - char_u *name; +enc_alias_search(char_u *name) { int i; @@ -4023,45 +4401,31 @@ enc_alias_search(name) #if defined(FEAT_MBYTE) || defined(PROTO) -#ifdef HAVE_LANGINFO_H -# include <langinfo.h> -#endif +# ifdef HAVE_LANGINFO_H +# include <langinfo.h> +# endif +# ifndef FEAT_GUI_W32 /* - * Get the canonicalized encoding of the current locale. + * Get the canonicalized encoding from the specified locale string "locale" + * or from the environment variables LC_ALL, LC_CTYPE and LANG. * Returns an allocated string when successful, NULL when not. */ char_u * -enc_locale() +enc_locale_env(char *locale) { -#ifndef WIN3264 - char *s; + char *s = locale; char *p; int i; -#endif char buf[50]; -#ifdef WIN3264 - long acp = GetACP(); - if (acp == 1200) - STRCPY(buf, "ucs-2le"); - else if (acp == 1252) /* cp1252 is used as latin1 */ - STRCPY(buf, "latin1"); - else - sprintf(buf, "cp%ld", acp); -#else -# ifdef HAVE_NL_LANGINFO_CODESET - if ((s = nl_langinfo(CODESET)) == NULL || *s == NUL) -# endif -# if defined(HAVE_LOCALE_H) || defined(X_LOCALE) - if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL) -# endif - if ((s = getenv("LC_ALL")) == NULL || *s == NUL) - if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL) - s = getenv("LANG"); + if (s == NULL || *s == NUL) + if ((s = getenv("LC_ALL")) == NULL || *s == NUL) + if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL) + s = getenv("LANG"); if (s == NULL || *s == NUL) - return FAIL; + return NULL; /* The most generic locale format is: * language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]] @@ -4086,7 +4450,7 @@ enc_locale() else s = p + 1; } - for (i = 0; s[i] != NUL && i < (int)sizeof(buf) - 1; ++i) + for (i = 0; i < (int)sizeof(buf) - 1 && s[i] != NUL; ++i) { if (s[i] == '_' || s[i] == '-') buf[i] = '-'; @@ -4096,19 +4460,52 @@ enc_locale() break; } buf[i] = NUL; -#endif return enc_canonize((char_u *)buf); } +# endif -#if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) +/* + * Get the canonicalized encoding of the current locale. + * Returns an allocated string when successful, NULL when not. + */ + char_u * +enc_locale(void) +{ +# ifdef WIN3264 + char buf[50]; + long acp = GetACP(); + + if (acp == 1200) + STRCPY(buf, "ucs-2le"); + else if (acp == 1252) /* cp1252 is used as latin1 */ + STRCPY(buf, "latin1"); + else + sprintf(buf, "cp%ld", acp); + + return enc_canonize((char_u *)buf); +# else + char *s; + +# ifdef HAVE_NL_LANGINFO_CODESET + if ((s = nl_langinfo(CODESET)) == NULL || *s == NUL) +# endif +# if defined(HAVE_LOCALE_H) || defined(X_LOCALE) + if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL) +# endif + s = NULL; + + return enc_locale_env(s); +# endif +} + +# if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) /* * Convert an encoding name to an MS-Windows codepage. * Returns zero if no codepage can be figured out. */ int -encname2codepage(name) - char_u *name; +encname2codepage(char_u *name) { int cp; char_u *p = name; @@ -4129,11 +4526,11 @@ encname2codepage(name) return cp; return 0; } -#endif +# endif # if defined(USE_ICONV) || defined(PROTO) -static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int *unconvlenp, int *resultlenp)); +static char_u *iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvlenp, int *resultlenp); /* * Call iconv_open() with a check if iconv() works properly (there are broken @@ -4142,9 +4539,7 @@ static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int * * (should return iconv_t, but that causes problems with prototypes). */ void * -my_iconv_open(to, from) - char_u *to; - char_u *from; +my_iconv_open(char_u *to, char_u *from) { iconv_t fd; #define ICONV_TESTLEN 400 @@ -4197,12 +4592,12 @@ my_iconv_open(to, from) * If resultlenp is not NULL, sets it to the result length in bytes. */ static char_u * -iconv_string(vcp, str, slen, unconvlenp, resultlenp) - vimconv_T *vcp; - char_u *str; - int slen; - int *unconvlenp; - int *resultlenp; +iconv_string( + vimconv_T *vcp, + char_u *str, + int slen, + int *unconvlenp, + int *resultlenp) { const char *from; size_t fromlen; @@ -4281,8 +4676,7 @@ iconv_string(vcp, str, slen, unconvlenp, resultlenp) else if (ICONV_ERRNO != ICONV_E2BIG) { /* conversion failed */ - vim_free(result); - result = NULL; + VIM_CLEAR(result); break; } /* Not enough room or skipping illegal sequence. */ @@ -4299,73 +4693,48 @@ iconv_string(vcp, str, slen, unconvlenp, resultlenp) * Dynamically load the "iconv.dll" on Win32. */ -#ifndef DYNAMIC_ICONV /* just generating prototypes */ -# define HINSTANCE int -#endif +# ifndef DYNAMIC_ICONV /* must be generating prototypes */ +# define HINSTANCE int +# endif static HINSTANCE hIconvDLL = 0; static HINSTANCE hMsvcrtDLL = 0; -# ifndef DYNAMIC_ICONV_DLL -# define DYNAMIC_ICONV_DLL "iconv.dll" -# define DYNAMIC_ICONV_DLL_ALT "libiconv.dll" -# endif -# ifndef DYNAMIC_MSVCRT_DLL -# define DYNAMIC_MSVCRT_DLL "msvcrt.dll" -# endif - -/* - * Get the address of 'funcname' which is imported by 'hInst' DLL. - */ - static void * -get_iconv_import_func(HINSTANCE hInst, const char *funcname) -{ - PBYTE pImage = (PBYTE)hInst; - PIMAGE_DOS_HEADER pDOS = (PIMAGE_DOS_HEADER)hInst; - PIMAGE_NT_HEADERS pPE; - PIMAGE_IMPORT_DESCRIPTOR pImpDesc; - PIMAGE_THUNK_DATA pIAT; /* Import Address Table */ - PIMAGE_THUNK_DATA pINT; /* Import Name Table */ - PIMAGE_IMPORT_BY_NAME pImpName; - - if (pDOS->e_magic != IMAGE_DOS_SIGNATURE) - return NULL; - pPE = (PIMAGE_NT_HEADERS)(pImage + pDOS->e_lfanew); - if (pPE->Signature != IMAGE_NT_SIGNATURE) - return NULL; - pImpDesc = (PIMAGE_IMPORT_DESCRIPTOR)(pImage - + pPE->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] - .VirtualAddress); - for (; pImpDesc->FirstThunk; ++pImpDesc) - { - if (!pImpDesc->OriginalFirstThunk) - continue; - pIAT = (PIMAGE_THUNK_DATA)(pImage + pImpDesc->FirstThunk); - pINT = (PIMAGE_THUNK_DATA)(pImage + pImpDesc->OriginalFirstThunk); - for (; pIAT->u1.Function; ++pIAT, ++pINT) - { - if (IMAGE_SNAP_BY_ORDINAL(pINT->u1.Ordinal)) - continue; - pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage - + (UINT_PTR)(pINT->u1.AddressOfData)); - if (strcmp(pImpName->Name, funcname) == 0) - return (void *)pIAT->u1.Function; - } - } - return NULL; -} +# ifndef DYNAMIC_ICONV_DLL +# define DYNAMIC_ICONV_DLL "iconv.dll" +# define DYNAMIC_ICONV_DLL_ALT1 "libiconv.dll" +# define DYNAMIC_ICONV_DLL_ALT2 "libiconv2.dll" +# define DYNAMIC_ICONV_DLL_ALT3 "libiconv-2.dll" +# endif +# ifndef DYNAMIC_MSVCRT_DLL +# define DYNAMIC_MSVCRT_DLL "msvcrt.dll" +# endif /* * Try opening the iconv.dll and return TRUE if iconv() can be used. */ int -iconv_enabled(verbose) - int verbose; +iconv_enabled(int verbose) { if (hIconvDLL != 0 && hMsvcrtDLL != 0) return TRUE; - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL); - if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */ - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT); + + /* The iconv DLL file goes under different names, try them all. + * Do the "2" version first, it's newer. */ +#ifdef DYNAMIC_ICONV_DLL_ALT2 + if (hIconvDLL == 0) + hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT2); +#endif +#ifdef DYNAMIC_ICONV_DLL_ALT3 + if (hIconvDLL == 0) + hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT3); +#endif + if (hIconvDLL == 0) + hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL); +#ifdef DYNAMIC_ICONV_DLL_ALT1 + if (hIconvDLL == 0) + hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT1); +#endif + if (hIconvDLL != 0) hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL); if (hIconvDLL == 0 || hMsvcrtDLL == 0) @@ -4387,7 +4756,7 @@ iconv_enabled(verbose) iconv_open = (void *)GetProcAddress(hIconvDLL, "libiconv_open"); iconv_close = (void *)GetProcAddress(hIconvDLL, "libiconv_close"); iconvctl = (void *)GetProcAddress(hIconvDLL, "libiconvctl"); - iconv_errno = get_iconv_import_func(hIconvDLL, "_errno"); + iconv_errno = get_dll_import_func(hIconvDLL, "_errno"); if (iconv_errno == NULL) iconv_errno = (void *)GetProcAddress(hMsvcrtDLL, "_errno"); if (iconv == NULL || iconv_open == NULL || iconv_close == NULL @@ -4406,7 +4775,7 @@ iconv_enabled(verbose) } void -iconv_end() +iconv_end(void) { /* Don't use iconv() when inputting or outputting characters. */ if (input_conv.vc_type == CONV_ICONV) @@ -4426,6 +4795,52 @@ iconv_end() #endif /* FEAT_MBYTE */ +#ifdef FEAT_GUI +# define USE_IMACTIVATEFUNC (!gui.in_use && *p_imaf != NUL) +# define USE_IMSTATUSFUNC (!gui.in_use && *p_imsf != NUL) +#else +# define USE_IMACTIVATEFUNC (*p_imaf != NUL) +# define USE_IMSTATUSFUNC (*p_imsf != NUL) +#endif + +#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \ + && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) +# ifdef FEAT_GUI_MACVIM + void +# else + static void +# endif +call_imactivatefunc(int active) +{ + typval_T argv[2]; + + argv[0].v_type = VAR_NUMBER; + argv[0].vval.v_number = active ? 1 : 0; + argv[1].v_type = VAR_UNKNOWN; + (void)call_func_retnr(p_imaf, 1, argv, FALSE); +} + +# ifdef FEAT_GUI_MACVIM + int +# else + static int +# endif +call_imstatusfunc(void) +{ + int is_active; + + /* FIXME: Don't execute user function in unsafe situation. */ + if (exiting || is_autocmd_blocked()) + return FALSE; + /* FIXME: :py print 'xxx' is shown duplicate result. + * Use silent to avoid it. */ + ++msg_silent; + is_active = call_func_retnr(p_imsf, 0, NULL, FALSE); + --msg_silent; + return (is_active > 0); +} +#endif + #if defined(FEAT_XIM) || defined(PROTO) # ifdef FEAT_GUI_MACVIM @@ -4446,7 +4861,7 @@ init_preedit_start_col(void) { if (State & CMDLINE) preedit_start_col = cmdline_getvcol_cursor(); - else if (curwin != NULL) + else if (curwin != NULL && curwin->w_buffer != NULL) getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL); /* Prevent that preediting marks the buffer as changed. */ xim_changed_while_preediting = curbuf->b_changed; @@ -4454,6 +4869,7 @@ init_preedit_start_col(void) static int im_is_active = FALSE; /* IM is enabled for current mode */ static int preedit_is_active = FALSE; +static int im_preedit_start = 0; /* start offset in characters */ static int im_preedit_cursor = 0; /* cursor offset in characters */ static int im_preedit_trailing = 0; /* number of characters after cursor */ @@ -4461,9 +4877,12 @@ static unsigned long im_commit_handler_id = 0; # ifndef FEAT_GUI_MACVIM static unsigned int im_activatekey_keyval = GDK_VoidSymbol; static unsigned int im_activatekey_state = 0; -# endif -# ifndef FEAT_GUI_MACVIM +static GtkWidget *preedit_window = NULL; +static GtkWidget *preedit_label = NULL; + +static void im_preedit_window_set_position(void); + void im_set_active(int active) { @@ -4505,6 +4924,9 @@ im_set_position(int row, int col) area.height = gui.char_height; gtk_im_context_set_cursor_location(xic, &area); + + if (p_imst == IM_OVER_THE_SPOT) + im_preedit_window_set_position(); } } # endif @@ -4538,13 +4960,189 @@ im_add_to_input(char_u *str, int len) # endif } +# ifndef FEAT_GUI_MACVIM + static void +im_preedit_window_set_position(void) +{ + int x, y, w, h, sw, sh; + + if (preedit_window == NULL) + return; + + gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh); +#if GTK_CHECK_VERSION(3,0,0) + gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y); +#else + gdk_window_get_origin(gui.drawarea->window, &x, &y); +#endif + gtk_window_get_size(GTK_WINDOW(preedit_window), &w, &h); + x = x + FILL_X(gui.col); + y = y + FILL_Y(gui.row); + if (x + w > sw) + x = sw - w; + if (y + h > sh) + y = sh - h; + gtk_window_move(GTK_WINDOW(preedit_window), x, y); +} + + static void +im_preedit_window_open() +{ + char *preedit_string; +#if !GTK_CHECK_VERSION(3,16,0) + char buf[8]; +#endif + PangoAttrList *attr_list; + PangoLayout *layout; +#if GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,16,0) + GdkRGBA color; +# endif +#else + GdkColor color; +#endif + gint w, h; + + if (preedit_window == NULL) + { + preedit_window = gtk_window_new(GTK_WINDOW_POPUP); + gtk_window_set_transient_for(GTK_WINDOW(preedit_window), + GTK_WINDOW(gui.mainwin)); + preedit_label = gtk_label_new(""); + gtk_widget_set_name(preedit_label, "vim-gui-preedit-area"); + gtk_container_add(GTK_CONTAINER(preedit_window), preedit_label); + } + +#if GTK_CHECK_VERSION(3,16,0) + { + GtkStyleContext * const context + = gtk_widget_get_style_context(gui.drawarea); + GtkCssProvider * const provider = gtk_css_provider_new(); + gchar *css = NULL; + const char * const fontname + = pango_font_description_get_family(gui.norm_font); + gint fontsize + = pango_font_description_get_size(gui.norm_font) / PANGO_SCALE; + gchar *fontsize_propval = NULL; + + if (!pango_font_description_get_size_is_absolute(gui.norm_font)) + { + /* fontsize was given in points. Convert it into that in pixels + * to use with CSS. */ + GdkScreen * const screen + = gdk_window_get_screen(gtk_widget_get_window(gui.mainwin)); + const gdouble dpi = gdk_screen_get_resolution(screen); + fontsize = dpi * fontsize / 72; + } + if (fontsize > 0) + fontsize_propval = g_strdup_printf("%dpx", fontsize); + else + fontsize_propval = g_strdup_printf("inherit"); + + css = g_strdup_printf( + "widget#vim-gui-preedit-area {\n" + " font-family: %s,monospace;\n" + " font-size: %s;\n" + " color: #%.2lx%.2lx%.2lx;\n" + " background-color: #%.2lx%.2lx%.2lx;\n" + "}\n", + fontname != NULL ? fontname : "inherit", + fontsize_propval, + (gui.norm_pixel >> 16) & 0xff, + (gui.norm_pixel >> 8) & 0xff, + gui.norm_pixel & 0xff, + (gui.back_pixel >> 16) & 0xff, + (gui.back_pixel >> 8) & 0xff, + gui.back_pixel & 0xff); + + gtk_css_provider_load_from_data(provider, css, -1, NULL); + gtk_style_context_add_provider(context, + GTK_STYLE_PROVIDER(provider), G_MAXUINT); + + g_free(css); + g_free(fontsize_propval); + g_object_unref(provider); + } +#elif GTK_CHECK_VERSION(3,0,0) + gtk_widget_override_font(preedit_label, gui.norm_font); + + vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel); + gdk_rgba_parse(&color, buf); + gtk_widget_override_color(preedit_label, GTK_STATE_FLAG_NORMAL, &color); + + vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel); + gdk_rgba_parse(&color, buf); + gtk_widget_override_background_color(preedit_label, GTK_STATE_FLAG_NORMAL, + &color); +#else + gtk_widget_modify_font(preedit_label, gui.norm_font); + + vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel); + gdk_color_parse(buf, &color); + gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color); + + vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel); + gdk_color_parse(buf, &color); + gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color); +#endif + + gtk_im_context_get_preedit_string(xic, &preedit_string, &attr_list, NULL); + + if (preedit_string[0] != NUL) + { + gtk_label_set_text(GTK_LABEL(preedit_label), preedit_string); + gtk_label_set_attributes(GTK_LABEL(preedit_label), attr_list); + + layout = gtk_label_get_layout(GTK_LABEL(preedit_label)); + pango_layout_get_pixel_size(layout, &w, &h); + h = MAX(h, gui.char_height); + gtk_window_resize(GTK_WINDOW(preedit_window), w, h); + + gtk_widget_show_all(preedit_window); + + im_preedit_window_set_position(); + } + + g_free(preedit_string); + pango_attr_list_unref(attr_list); +} + + static void +im_preedit_window_close() +{ + if (preedit_window != NULL) + gtk_widget_hide(preedit_window); +} + + static void +im_show_preedit() +{ + im_preedit_window_open(); + + if (p_mh) /* blank out the pointer if necessary */ + gui_mch_mousehide(TRUE); +} +# endif + static void im_delete_preedit(void) { char_u bskey[] = {CSI, 'k', 'b'}; char_u delkey[] = {CSI, 'k', 'D'}; - if (State & NORMAL) +# ifndef FEAT_GUI_MACVIM + if (p_imst == IM_OVER_THE_SPOT) + { + im_preedit_window_close(); + return; + } +# endif + + if (State & NORMAL +#ifdef FEAT_TERMINAL + && !term_use_loop() +#endif + ) { im_preedit_cursor = 0; return; @@ -4588,6 +5186,8 @@ static int xim_ignored_char = FALSE; im_show_info(void) { int old_vgetc_busy; + int old_row = gui.row; + int old_col = gui.col; old_vgetc_busy = vgetc_busy; vgetc_busy = TRUE; @@ -4596,6 +5196,8 @@ im_show_info(void) if ((State & NORMAL) || (State & INSERT)) setcursor(); out_flush(); + gui.row = old_row; + gui.col = old_col; } # ifndef FEAT_GUI_MACVIM @@ -4619,39 +5221,42 @@ im_commit_cb(GtkIMContext *context UNUSED, xim_log("im_commit_cb(): %s\n", str); #endif - /* The imhangul module doesn't reset the preedit string before - * committing. Call im_delete_preedit() to work around that. */ - im_delete_preedit(); - - /* Indicate that preediting has finished. */ - if (preedit_start_col == MAXCOL) + if (p_imst == IM_ON_THE_SPOT) { - init_preedit_start_col(); - commit_with_preedit = FALSE; - } + /* The imhangul module doesn't reset the preedit string before + * committing. Call im_delete_preedit() to work around that. */ + im_delete_preedit(); - /* The thing which setting "preedit_start_col" to MAXCOL means that - * "preedit_start_col" will be set forcedly when calling - * preedit_changed_cb() next time. - * "preedit_start_col" should not reset with MAXCOL on this part. Vim - * is simulating the preediting by using add_to_input_str(). when - * preedit begin immediately before committed, the typebuf is not - * flushed to screen, then it can't get correct "preedit_start_col". - * Thus, it should calculate the cells by adding cells of the committed - * string. */ - if (input_conv.vc_type != CONV_NONE) - { - im_str = string_convert(&input_conv, (char_u *)str, &len); - g_return_if_fail(im_str != NULL); - } - else - im_str = (char_u *)str; + /* Indicate that preediting has finished. */ + if (preedit_start_col == MAXCOL) + { + init_preedit_start_col(); + commit_with_preedit = FALSE; + } + + /* The thing which setting "preedit_start_col" to MAXCOL means that + * "preedit_start_col" will be set forcedly when calling + * preedit_changed_cb() next time. + * "preedit_start_col" should not reset with MAXCOL on this part. Vim + * is simulating the preediting by using add_to_input_str(). when + * preedit begin immediately before committed, the typebuf is not + * flushed to screen, then it can't get correct "preedit_start_col". + * Thus, it should calculate the cells by adding cells of the committed + * string. */ + if (input_conv.vc_type != CONV_NONE) + { + im_str = string_convert(&input_conv, (char_u *)str, &len); + g_return_if_fail(im_str != NULL); + } + else + im_str = (char_u *)str; - clen = mb_string2cells(im_str, len); + clen = mb_string2cells(im_str, len); - if (input_conv.vc_type != CONV_NONE) - vim_free(im_str); - preedit_start_col += clen; + if (input_conv.vc_type != CONV_NONE) + vim_free(im_str); + preedit_start_col += clen; + } /* Is this a single character that matches a keypad key that's just * been pressed? If so, we don't want it to be entered as such - let @@ -4676,14 +5281,17 @@ im_commit_cb(GtkIMContext *context UNUSED, if (add_to_input) im_add_to_input((char_u *)str, slen); - /* Inserting chars while "im_is_active" is set does not cause a change of - * buffer. When the chars are committed the buffer must be marked as - * changed. */ - if (!commit_with_preedit) - preedit_start_col = MAXCOL; - - /* This flag is used in changed() at next call. */ - xim_changed_while_preediting = TRUE; + if (p_imst == IM_ON_THE_SPOT) + { + /* Inserting chars while "im_is_active" is set does not cause a + * change of buffer. When the chars are committed the buffer must be + * marked as changed. */ + if (!commit_with_preedit) + preedit_start_col = MAXCOL; + + /* This flag is used in changed() at next call. */ + xim_changed_while_preediting = TRUE; + } if (gtk_main_level() > 0) gtk_main_quit(); @@ -4728,7 +5336,8 @@ im_preedit_end_macvim() im_delete_preedit(); /* Indicate that preediting has finished */ - preedit_start_col = MAXCOL; + if (p_imst == IM_ON_THE_SPOT) + preedit_start_col = MAXCOL; xim_has_preediting = FALSE; #if 0 @@ -4796,7 +5405,7 @@ im_preedit_abandon_macvim() im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED) # else void -im_preedit_changed_macvim(char *preedit_string, int cursor_index) +im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_index) # endif { # ifndef FEAT_GUI_MACVIM @@ -4809,9 +5418,14 @@ im_preedit_changed_macvim(char *preedit_string, int cursor_index) int i; # ifndef FEAT_GUI_MACVIM - gtk_im_context_get_preedit_string(context, - &preedit_string, NULL, - &cursor_index); + if (p_imst == IM_ON_THE_SPOT) + gtk_im_context_get_preedit_string(context, + &preedit_string, NULL, + &cursor_index); + else + gtk_im_context_get_preedit_string(context, + &preedit_string, NULL, + NULL); # endif #ifdef XIM_DEBUG @@ -4820,66 +5434,84 @@ im_preedit_changed_macvim(char *preedit_string, int cursor_index) g_return_if_fail(preedit_string != NULL); /* just in case */ - /* If preedit_start_col is MAXCOL set it to the current cursor position. */ - if (preedit_start_col == MAXCOL && preedit_string[0] != '\0') +# ifndef FEAT_GUI_MACVIM + if (p_imst == IM_OVER_THE_SPOT) { - xim_has_preediting = TRUE; - - /* Urgh, this breaks if the input buffer isn't empty now */ - init_preedit_start_col(); + if (preedit_string[0] == NUL) + { + xim_has_preediting = FALSE; + im_delete_preedit(); + } + else + { + xim_has_preediting = TRUE; + im_show_preedit(); + } } - else if (cursor_index == 0 && preedit_string[0] == '\0') + else +# endif { - xim_has_preediting = FALSE; + /* If preedit_start_col is MAXCOL set it to the current cursor position. */ + if (preedit_start_col == MAXCOL && preedit_string[0] != '\0') + { + xim_has_preediting = TRUE; - /* If at the start position (after typing backspace) - * preedit_start_col must be reset. */ - preedit_start_col = MAXCOL; - } + /* Urgh, this breaks if the input buffer isn't empty now */ + init_preedit_start_col(); + } + else if (cursor_index == 0 && preedit_string[0] == '\0') + { + xim_has_preediting = FALSE; - im_delete_preedit(); + /* If at the start position (after typing backspace) + * preedit_start_col must be reset. */ + preedit_start_col = MAXCOL; + } - /* - * Compute the end of the preediting area: "preedit_end_col". - * According to the documentation of gtk_im_context_get_preedit_string(), - * the cursor_pos output argument returns the offset in bytes. This is - * unfortunately not true -- real life shows the offset is in characters, - * and the GTK+ source code agrees with me. Will file a bug later. - */ - if (preedit_start_col != MAXCOL) - preedit_end_col = preedit_start_col; - str = (char_u *)preedit_string; - for (p = str, i = 0; *p != NUL; p += utf_byte2len(*p), ++i) - { - int is_composing; + im_delete_preedit(); - is_composing = ((*p & 0x80) != 0 && utf_iscomposing(utf_ptr2char(p))); /* - * These offsets are used as counters when generating <BS> and <Del> - * to delete the preedit string. So don't count composing characters - * unless 'delcombine' is enabled. + * Compute the end of the preediting area: "preedit_end_col". + * According to the documentation of gtk_im_context_get_preedit_string(), + * the cursor_pos output argument returns the offset in bytes. This is + * unfortunately not true -- real life shows the offset is in characters, + * and the GTK+ source code agrees with me. Will file a bug later. */ - if (!is_composing || p_deco) + if (preedit_start_col != MAXCOL) + preedit_end_col = preedit_start_col; + str = (char_u *)preedit_string; + for (p = str, i = 0; *p != NUL; p += utf_byte2len(*p), ++i) { - if (i < cursor_index) - ++im_preedit_cursor; - else - ++im_preedit_trailing; + int is_composing; + + is_composing = ((*p & 0x80) != 0 && utf_iscomposing(utf_ptr2char(p))); + /* + * These offsets are used as counters when generating <BS> and <Del> + * to delete the preedit string. So don't count composing characters + * unless 'delcombine' is enabled. + */ + if (!is_composing || p_deco) + { + if (i < cursor_index) + ++im_preedit_cursor; + else + ++im_preedit_trailing; + } + if (!is_composing && i >= cursor_index) + { + /* This is essentially the same as im_preedit_trailing, except + * composing characters are not counted even if p_deco is set. */ + ++num_move_back; + } + if (preedit_start_col != MAXCOL) + preedit_end_col += utf_ptr2cells(p); } - if (!is_composing && i >= cursor_index) + + if (p > str) { - /* This is essentially the same as im_preedit_trailing, except - * composing characters are not counted even if p_deco is set. */ - ++num_move_back; + im_add_to_input(str, (int)(p - str)); + im_correct_cursor(num_move_back); } - if (preedit_start_col != MAXCOL) - preedit_end_col += utf_ptr2cells(p); - } - - if (p > str) - { - im_add_to_input(str, (int)(p - str)); - im_correct_cursor(num_move_back); } # ifndef FEAT_GUI_MACVIM @@ -4984,7 +5616,10 @@ im_get_feedback_attr(int col) return char_attr; # else - return HL_UNDERLINE; + if (col >= im_preedit_start && col < im_preedit_cursor) + return HL_THICKUNDERLINE; + else + return HL_UNDERLINE; # endif } @@ -4997,7 +5632,11 @@ xim_init(void) # ifndef FEAT_GUI_MACVIM g_return_if_fail(gui.drawarea != NULL); +#if GTK_CHECK_VERSION(3,0,0) + g_return_if_fail(gtk_widget_get_window(gui.drawarea) != NULL); +#else g_return_if_fail(gui.drawarea->window != NULL); +#endif xic = gtk_im_multicontext_new(); g_object_ref(xic); @@ -5011,7 +5650,11 @@ xim_init(void) g_signal_connect(G_OBJECT(xic), "preedit_end", G_CALLBACK(&im_preedit_end_cb), NULL); +#if GTK_CHECK_VERSION(3,0,0) + gtk_im_context_set_client_window(xic, gtk_widget_get_window(gui.drawarea)); +#else gtk_im_context_set_client_window(xic, gui.drawarea->window); +#endif # endif } @@ -5032,7 +5675,8 @@ im_shutdown(void) # endif im_is_active = FALSE; im_commit_handler_id = 0; - preedit_start_col = MAXCOL; + if (p_imst == IM_ON_THE_SPOT) + preedit_start_col = MAXCOL; xim_has_preediting = FALSE; } @@ -5112,14 +5756,18 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state) { GdkEventKey *event; -# ifdef HAVE_GTK_MULTIHEAD event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS); - g_object_ref(gui.drawarea->window); /* unreffed by gdk_event_free() */ +# if GTK_CHECK_VERSION(3,0,0) + g_object_ref(gtk_widget_get_window(gui.drawarea)); + /* unreffed by gdk_event_free() */ # else - event = (GdkEventKey *)g_malloc0((gulong)sizeof(GdkEvent)); - event->type = GDK_KEY_PRESS; + g_object_ref(gui.drawarea->window); /* unreffed by gdk_event_free() */ # endif +# if GTK_CHECK_VERSION(3,0,0) + event->window = gtk_widget_get_window(gui.drawarea); +# else event->window = gui.drawarea->window; +# endif event->send_event = TRUE; event->time = GDK_CURRENT_TIME; event->state = state; @@ -5136,11 +5784,7 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state) event->send_event = FALSE; gtk_im_context_filter_keypress(xic, event); -# ifdef HAVE_GTK_MULTIHEAD gdk_event_free((GdkEvent *)event); -# else - g_free(event); -# endif } # endif // FEAT_GUI_MACVIM @@ -5148,6 +5792,11 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state) xim_reset(void) { # ifndef FEAT_GUI_MACVIM +# ifdef FEAT_EVAL + if (USE_IMACTIVATEFUNC) + call_imactivatefunc(im_is_active); + else +# endif if (xic != NULL) { gtk_im_context_reset(xic); @@ -5158,20 +5807,7 @@ xim_reset(void) { xim_set_focus(gui.in_focus); -# ifdef FEAT_EVAL - if (p_imaf[0] != NUL) - { - char_u *argv[1]; - - if (im_is_active) - argv[0] = (char_u *)"1"; - else - argv[0] = (char_u *)"0"; - (void)call_func_retnr(p_imaf, 1, argv, FALSE); - } - else -# endif - if (im_activatekey_keyval != GDK_VoidSymbol) + if (im_activatekey_keyval != GDK_VoidSymbol) { if (im_is_active) { @@ -5191,7 +5827,8 @@ xim_reset(void) } # endif - preedit_start_col = MAXCOL; + if (p_imst == IM_ON_THE_SPOT) + preedit_start_col = MAXCOL; xim_has_preediting = FALSE; } @@ -5297,19 +5934,22 @@ xim_queue_key_press_event(GdkEventKey *event, int down) { int imresult = gtk_im_context_filter_keypress(xic, event); - /* Some XIM send following sequence: - * 1. preedited string. - * 2. committed string. - * 3. line changed key. - * 4. preedited string. - * 5. remove preedited string. - * if 3, Vim can't move back the above line for 5. - * thus, this part should not parse the key. */ - if (!imresult && preedit_start_col != MAXCOL - && event->keyval == GDK_Return) + if (p_imst == IM_ON_THE_SPOT) { - im_synthesize_keypress(GDK_Return, 0U); - return FALSE; + /* Some XIM send following sequence: + * 1. preedited string. + * 2. committed string. + * 3. line changed key. + * 4. preedited string. + * 5. remove preedited string. + * if 3, Vim can't move back the above line for 5. + * thus, this part should not parse the key. */ + if (!imresult && preedit_start_col != MAXCOL + && event->keyval == GDK_Return) + { + im_synthesize_keypress(GDK_Return, 0U); + return FALSE; + } } /* If XIM tried to commit a keypad key as a single char., @@ -5336,24 +5976,8 @@ xim_queue_key_press_event(GdkEventKey *event, int down) im_get_status(void) { # ifdef FEAT_EVAL - if (p_imsf[0] != NUL) - { - int is_active; - - /* FIXME: Don't execute user function in unsafe situation. */ - if (exiting -# ifdef FEAT_AUTOCMD - || is_autocmd_blocked() -# endif - ) - return FALSE; - /* FIXME: :py print 'xxx' is shown duplicate result. - * Use silent to avoid it. */ - ++msg_silent; - is_active = call_func_retnr(p_imsf, 0, NULL, FALSE); - --msg_silent; - return (is_active > 0); - } + if (USE_IMSTATUSFUNC) + return call_imstatusfunc(); # endif return im_is_active; } @@ -5366,7 +5990,7 @@ preedit_get_status(void) } int -im_is_preediting() +im_is_preediting(void) { return xim_has_preediting; } @@ -5376,31 +6000,43 @@ im_is_preediting() static int xim_is_active = FALSE; /* XIM should be active in the current mode */ static int xim_has_focus = FALSE; /* XIM is really being used for Vim */ -#ifdef FEAT_GUI_X11 +# ifdef FEAT_GUI_X11 static XIMStyle input_style; static int status_area_enabled = TRUE; -#endif +# endif /* * Switch using XIM on/off. This is used by the code that changes "State". + * When 'imactivatefunc' is defined use that function instead. */ void -im_set_active(active) - int active; +im_set_active(int active_arg) { - if (xic == NULL) - return; + int active = active_arg; /* If 'imdisable' is set, XIM is never active. */ if (p_imdisable) active = FALSE; -#if !defined(FEAT_GUI_GTK) else if (input_style & XIMPreeditPosition) /* There is a problem in switching XIM off when preediting is used, * and it is not clear how this can be solved. For now, keep XIM on * all the time, like it was done in Vim 5.8. */ active = TRUE; -#endif + +# if defined(FEAT_EVAL) + if (USE_IMACTIVATEFUNC) + { + if (active != im_get_status()) + { + call_imactivatefunc(active); + xim_has_focus = active; + } + return; + } +# endif + + if (xic == NULL) + return; /* Remember the active state, it is needed when Vim gets keyboard focus. */ xim_is_active = active; @@ -5412,8 +6048,7 @@ im_set_active(active) * "xim_is_active" changes. */ void -xim_set_focus(focus) - int focus; +xim_set_focus(int focus) { if (xic == NULL) return; @@ -5441,9 +6076,7 @@ xim_set_focus(focus) } void -im_set_position(row, col) - int row UNUSED; - int col UNUSED; +im_set_position(int row UNUSED, int col UNUSED) { xim_set_preedit(); } @@ -5452,7 +6085,7 @@ im_set_position(row, col) * Set the XIM to the current cursor position. */ void -xim_set_preedit() +xim_set_preedit(void) { XVaNestedList attr_list; XRectangle spot_area; @@ -5505,34 +6138,33 @@ xim_set_preedit() } } -#if defined(FEAT_GUI_X11) +# if defined(FEAT_GUI_X11) static char e_xim[] = N_("E285: Failed to create input context"); -#endif +# endif -#if defined(FEAT_GUI_X11) || defined(PROTO) -# if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(sun) -# define USE_X11R6_XIM -# endif +# if defined(FEAT_GUI_X11) || defined(PROTO) +# if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(SUN_SYSTEM) +# define USE_X11R6_XIM +# endif -static int xim_real_init __ARGS((Window x11_window, Display *x11_display)); +static int xim_real_init(Window x11_window, Display *x11_display); -#ifdef USE_X11R6_XIM -static void xim_instantiate_cb __ARGS((Display *display, XPointer client_data, XPointer call_data)); -static void xim_destroy_cb __ARGS((XIM im, XPointer client_data, XPointer call_data)); +# ifdef USE_X11R6_XIM +static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data); static void -xim_instantiate_cb(display, client_data, call_data) - Display *display; - XPointer client_data UNUSED; - XPointer call_data UNUSED; +xim_instantiate_cb( + Display *display, + XPointer client_data UNUSED, + XPointer call_data UNUSED) { Window x11_window; Display *x11_display; -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_instantiate_cb()\n"); -#endif +# endif gui_get_x11_windis(&x11_window, &x11_display); if (display != x11_display) @@ -5546,17 +6178,17 @@ xim_instantiate_cb(display, client_data, call_data) } static void -xim_destroy_cb(im, client_data, call_data) - XIM im UNUSED; - XPointer client_data UNUSED; - XPointer call_data UNUSED; +xim_destroy_cb( + XIM im UNUSED, + XPointer client_data UNUSED, + XPointer call_data UNUSED) { Window x11_window; Display *x11_display; -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_destroy_cb()\n"); -#endif + #endif gui_get_x11_windis(&x11_window, &x11_display); xic = NULL; @@ -5567,17 +6199,17 @@ xim_destroy_cb(im, client_data, call_data) XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); } -#endif +# endif void -xim_init() +xim_init(void) { Window x11_window; Display *x11_display; -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_init()\n"); -#endif +# endif gui_get_x11_windis(&x11_window, &x11_display); @@ -5588,16 +6220,14 @@ xim_init() gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); -#ifdef USE_X11R6_XIM +# ifdef USE_X11R6_XIM XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); -#endif +# endif } static int -xim_real_init(x11_window, x11_display) - Window x11_window; - Display *x11_display; +xim_real_init(Window x11_window, Display *x11_display) { int i; char *p, @@ -5605,7 +6235,7 @@ xim_real_init(x11_window, x11_display) *ns, *end, tmp[1024]; -#define IMLEN_MAX 40 +# define IMLEN_MAX 40 char buf[IMLEN_MAX + 7]; XIM xim = NULL; XIMStyles *xim_styles; @@ -5670,7 +6300,7 @@ xim_real_init(x11_window, x11_display) return FALSE; } -#ifdef USE_X11R6_XIM +# ifdef USE_X11R6_XIM { XIMCallback destroy_cb; @@ -5679,7 +6309,7 @@ xim_real_init(x11_window, x11_display) if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) EMSG(_("E287: Warning: Could not set destroy callback to IM")); } -#endif +# endif if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { @@ -5755,7 +6385,7 @@ xim_real_init(x11_window, x11_display) /* A crash was reported when trying to pass gui.norm_font as XNFontSet, * thus that has been removed. Hopefully the default works... */ -#ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET if (gui.fontset != NOFONTSET) { preedit_list = XVaCreateNestedList(0, @@ -5771,7 +6401,7 @@ xim_real_init(x11_window, x11_display) NULL); } else -#endif +# endif { preedit_list = XVaCreateNestedList(0, XNSpotLocation, &over_spot, @@ -5805,7 +6435,8 @@ xim_real_init(x11_window, x11_display) } else { - EMSG(_(e_xim)); + if (!is_not_a_term()) + EMSG(_(e_xim)); XCloseIM(xim); return FALSE; } @@ -5813,7 +6444,7 @@ xim_real_init(x11_window, x11_display) return TRUE; } -#endif /* FEAT_GUI_X11 */ +# endif /* FEAT_GUI_X11 */ /* * Get IM status. When IM is on, return TRUE. Else return FALSE. @@ -5822,8 +6453,12 @@ xim_real_init(x11_window, x11_display) * tear-off menu item). */ int -im_get_status() +im_get_status(void) { +# ifdef FEAT_EVAL + if (USE_IMSTATUSFUNC) + return call_imstatusfunc(); +# endif return xim_has_focus; } @@ -5839,7 +6474,7 @@ im_get_status() * window... */ void -xim_set_status_area() +xim_set_status_area(void) { XVaNestedList preedit_list = 0, status_list = 0, list = 0; XRectangle pre_area, status_area; @@ -5936,7 +6571,7 @@ xim_set_status_area() } int -xim_get_status_area_height() +xim_get_status_area_height(void) { if (status_area_enabled) return gui.char_height; @@ -5944,6 +6579,43 @@ xim_get_status_area_height() } # endif +#else /* !defined(FEAT_XIM) */ + +# ifdef IME_WITHOUT_XIM +static int im_was_set_active = FALSE; + + int +im_get_status(void) +{ +# if defined(FEAT_MBYTE) && defined(FEAT_EVAL) + if (USE_IMSTATUSFUNC) + return call_imstatusfunc(); +# endif + return im_was_set_active; +} + + void +im_set_active(int active_arg) +{ +# if defined(FEAT_MBYTE) && defined(FEAT_EVAL) + int active = !p_imdisable && active_arg; + + if (USE_IMACTIVATEFUNC && active != im_get_status()) + { + call_imactivatefunc(active); + im_was_set_active = active; + } +# endif +} + +# ifdef FEAT_GUI + void +im_set_position(int row UNUSED, int col UNUSED) +{ +} +# endif +# endif + #endif /* FEAT_XIM */ #if defined(FEAT_MBYTE) || defined(PROTO) @@ -5958,10 +6630,7 @@ xim_get_status_area_height() * Return FAIL when conversion is not supported, OK otherwise. */ int -convert_setup(vcp, from, to) - vimconv_T *vcp; - char_u *from; - char_u *to; +convert_setup(vimconv_T *vcp, char_u *from, char_u *to) { return convert_setup_ext(vcp, from, TRUE, to, TRUE); } @@ -5971,12 +6640,12 @@ convert_setup(vcp, from, to) * "from" unicode charsets be considered utf-8. Same for "to". */ int -convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8) - vimconv_T *vcp; - char_u *from; - int from_unicode_is_utf8; - char_u *to; - int to_unicode_is_utf8; +convert_setup_ext( + vimconv_T *vcp, + char_u *from, + int from_unicode_is_utf8, + char_u *to, + int to_unicode_is_utf8) { int from_prop; int to_prop; @@ -6041,7 +6710,7 @@ convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8) vcp->vc_cpto = to_is_utf8 ? 0 : encname2codepage(to); } #endif -#ifdef MACOS_X +#ifdef MACOS_CONVERT else if ((from_prop & ENC_MACROMAN) && (to_prop & ENC_LATIN1)) { vcp->vc_type = CONV_MAC_LATIN1; @@ -6081,17 +6750,14 @@ convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8) } #if defined(FEAT_GUI) || defined(AMIGA) || defined(WIN3264) \ - || defined(MSDOS) || defined(PROTO) + || defined(PROTO) /* * Do conversion on typed input characters in-place. * The input and output are not NUL terminated! * Returns the length after conversion. */ int -convert_input(ptr, len, maxlen) - char_u *ptr; - int len; - int maxlen; +convert_input(char_u *ptr, int len, int maxlen) { return convert_input_safe(ptr, len, maxlen, NULL, NULL); } @@ -6103,12 +6769,12 @@ convert_input(ptr, len, maxlen) * the length. If "restp" is NULL it is not used. */ int -convert_input_safe(ptr, len, maxlen, restp, restlenp) - char_u *ptr; - int len; - int maxlen; - char_u **restp; - int *restlenp; +convert_input_safe( + char_u *ptr, + int len, + int maxlen, + char_u **restp, + int *restlenp) { char_u *d; int dlen = len; @@ -6147,10 +6813,10 @@ convert_input_safe(ptr, len, maxlen, restp, restlenp) * When something goes wrong, NULL is returned and "*lenp" is unchanged. */ char_u * -string_convert(vcp, ptr, lenp) - vimconv_T *vcp; - char_u *ptr; - int *lenp; +string_convert( + vimconv_T *vcp, + char_u *ptr, + int *lenp) { return string_convert_ext(vcp, ptr, lenp, NULL); } @@ -6161,11 +6827,11 @@ string_convert(vcp, ptr, lenp) * set to the number of remaining bytes. */ char_u * -string_convert_ext(vcp, ptr, lenp, unconvlenp) - vimconv_T *vcp; - char_u *ptr; - int *lenp; - int *unconvlenp; +string_convert_ext( + vimconv_T *vcp, + char_u *ptr, + int *lenp, + int *unconvlenp) { char_u *retval = NULL; char_u *d; @@ -6347,7 +7013,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp) { tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, unconvlenp ? MB_ERR_INVALID_CHARS : 0, - ptr, len, 0, 0); + (char *)ptr, len, 0, 0); if (tmp_len == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { @@ -6367,7 +7033,8 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp) if (vcp->vc_cpfrom == 0) utf8_to_utf16(ptr, len, tmp, unconvlenp); else - MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len); + MultiByteToWideChar(vcp->vc_cpfrom, 0, + (char *)ptr, len, tmp, tmp_len); /* 2. ucs-2 -> codepage/UTF-8. */ if (vcp->vc_cpto == 0) @@ -6382,7 +7049,8 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp) utf16_to_utf8(tmp, tmp_len, retval); else WideCharToMultiByte(vcp->vc_cpto, 0, - tmp, tmp_len, retval, retlen, 0, 0); + tmp, tmp_len, + (char *)retval, retlen, 0, 0); retval[retlen] = NUL; if (lenp != NULL) *lenp = retlen; diff --git a/src/memfile.c b/src/memfile.c index d1bc96a577..0d07b75586 100644 --- a/src/memfile.c +++ b/src/memfile.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -69,28 +69,28 @@ extern int dos2; /* this is in os_amiga.c */ static long_u total_mem_used = 0; /* total memory used for memfiles */ -static void mf_ins_hash __ARGS((memfile_T *, bhdr_T *)); -static void mf_rem_hash __ARGS((memfile_T *, bhdr_T *)); -static bhdr_T *mf_find_hash __ARGS((memfile_T *, blocknr_T)); -static void mf_ins_used __ARGS((memfile_T *, bhdr_T *)); -static void mf_rem_used __ARGS((memfile_T *, bhdr_T *)); -static bhdr_T *mf_release __ARGS((memfile_T *, int)); -static bhdr_T *mf_alloc_bhdr __ARGS((memfile_T *, int)); -static void mf_free_bhdr __ARGS((bhdr_T *)); -static void mf_ins_free __ARGS((memfile_T *, bhdr_T *)); -static bhdr_T *mf_rem_free __ARGS((memfile_T *)); -static int mf_read __ARGS((memfile_T *, bhdr_T *)); -static int mf_write __ARGS((memfile_T *, bhdr_T *)); -static int mf_write_block __ARGS((memfile_T *mfp, bhdr_T *hp, off_t offset, unsigned size)); -static int mf_trans_add __ARGS((memfile_T *, bhdr_T *)); -static void mf_do_open __ARGS((memfile_T *, char_u *, int)); -static void mf_hash_init __ARGS((mf_hashtab_T *)); -static void mf_hash_free __ARGS((mf_hashtab_T *)); -static void mf_hash_free_all __ARGS((mf_hashtab_T *)); -static mf_hashitem_T *mf_hash_find __ARGS((mf_hashtab_T *, blocknr_T)); -static void mf_hash_add_item __ARGS((mf_hashtab_T *, mf_hashitem_T *)); -static void mf_hash_rem_item __ARGS((mf_hashtab_T *, mf_hashitem_T *)); -static int mf_hash_grow __ARGS((mf_hashtab_T *)); +static void mf_ins_hash(memfile_T *, bhdr_T *); +static void mf_rem_hash(memfile_T *, bhdr_T *); +static bhdr_T *mf_find_hash(memfile_T *, blocknr_T); +static void mf_ins_used(memfile_T *, bhdr_T *); +static void mf_rem_used(memfile_T *, bhdr_T *); +static bhdr_T *mf_release(memfile_T *, int); +static bhdr_T *mf_alloc_bhdr(memfile_T *, int); +static void mf_free_bhdr(bhdr_T *); +static void mf_ins_free(memfile_T *, bhdr_T *); +static bhdr_T *mf_rem_free(memfile_T *); +static int mf_read(memfile_T *, bhdr_T *); +static int mf_write(memfile_T *, bhdr_T *); +static int mf_write_block(memfile_T *mfp, bhdr_T *hp, off_T offset, unsigned size); +static int mf_trans_add(memfile_T *, bhdr_T *); +static void mf_do_open(memfile_T *, char_u *, int); +static void mf_hash_init(mf_hashtab_T *); +static void mf_hash_free(mf_hashtab_T *); +static void mf_hash_free_all(mf_hashtab_T *); +static mf_hashitem_T *mf_hash_find(mf_hashtab_T *, blocknr_T); +static void mf_hash_add_item(mf_hashtab_T *, mf_hashitem_T *); +static void mf_hash_rem_item(mf_hashtab_T *, mf_hashitem_T *); +static int mf_hash_grow(mf_hashtab_T *); /* * The functions for using a memfile: @@ -121,12 +121,10 @@ static int mf_hash_grow __ARGS((mf_hashtab_T *)); * return value: identifier for this memory block file. */ memfile_T * -mf_open(fname, flags) - char_u *fname; - int flags; +mf_open(char_u *fname, int flags) { memfile_T *mfp; - off_t size; + off_T size; #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix) # define USE_FSTATFS struct STATFS stf; @@ -181,7 +179,7 @@ mf_open(fname, flags) #endif if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL)) - || (size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0) + || (size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) mfp->mf_blocknr_max = 0; /* no file or empty file */ else mfp->mf_blocknr_max = (blocknr_T)((size + mfp->mf_page_size - 1) @@ -223,9 +221,7 @@ mf_open(fname, flags) * return value: FAIL if file could not be opened, OK otherwise */ int -mf_open_file(mfp, fname) - memfile_T *mfp; - char_u *fname; +mf_open_file(memfile_T *mfp, char_u *fname) { mf_do_open(mfp, fname, O_RDWR|O_CREAT|O_EXCL); /* try to open the file */ @@ -240,9 +236,7 @@ mf_open_file(mfp, fname) * Close a memory file and delete the associated file if 'del_file' is TRUE. */ void -mf_close(mfp, del_file) - memfile_T *mfp; - int del_file; +mf_close(memfile_T *mfp, int del_file) { bhdr_T *hp, *nextp; @@ -275,9 +269,9 @@ mf_close(mfp, del_file) * Close the swap file for a memfile. Used when 'swapfile' is reset. */ void -mf_close_file(buf, getlines) - buf_T *buf; - int getlines; /* get all lines into memory? */ +mf_close_file( + buf_T *buf, + int getlines) /* get all lines into memory? */ { memfile_T *mfp; linenr_T lnum; @@ -303,10 +297,8 @@ mf_close_file(buf, getlines) if (mfp->mf_fname != NULL) { mch_remove(mfp->mf_fname); /* delete the swap file */ - vim_free(mfp->mf_fname); - vim_free(mfp->mf_ffname); - mfp->mf_fname = NULL; - mfp->mf_ffname = NULL; + VIM_CLEAR(mfp->mf_fname); + VIM_CLEAR(mfp->mf_ffname); } } @@ -315,9 +307,7 @@ mf_close_file(buf, getlines) * and the size it indicates differs from what was guessed. */ void -mf_new_page_size(mfp, new_size) - memfile_T *mfp; - unsigned new_size; +mf_new_page_size(memfile_T *mfp, unsigned new_size) { /* Correct the memory used for block 0 to the new size, because it will be * freed with that size later on. */ @@ -331,10 +321,7 @@ mf_new_page_size(mfp, new_size) * negative: TRUE if negative block number desired (data block) */ bhdr_T * -mf_new(mfp, negative, page_count) - memfile_T *mfp; - int negative; - int page_count; +mf_new(memfile_T *mfp, int negative, int page_count) { bhdr_T *hp; /* new bhdr_T */ bhdr_T *freep; /* first block in free list */ @@ -424,10 +411,7 @@ mf_new(mfp, negative, page_count) * Note: The caller should first check a negative nr with mf_trans_del() */ bhdr_T * -mf_get(mfp, nr, page_count) - memfile_T *mfp; - blocknr_T nr; - int page_count; +mf_get(memfile_T *mfp, blocknr_T nr, int page_count) { bhdr_T *hp; /* doesn't exist */ @@ -485,18 +469,18 @@ mf_get(mfp, nr, page_count) * no return value, function cannot fail */ void -mf_put(mfp, hp, dirty, infile) - memfile_T *mfp; - bhdr_T *hp; - int dirty; - int infile; +mf_put( + memfile_T *mfp, + bhdr_T *hp, + int dirty, + int infile) { int flags; flags = hp->bh_flags; if ((flags & BH_LOCKED) == 0) - EMSG(_("E293: block was not locked")); + IEMSG(_("E293: block was not locked")); flags &= ~BH_LOCKED; if (dirty) { @@ -512,9 +496,7 @@ mf_put(mfp, hp, dirty, infile) * block *hp is no longer in used, may put it in the free list of memfile *mfp */ void -mf_free(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_free(memfile_T *mfp, bhdr_T *hp) { vim_free(hp->bh_data); /* free the memory */ mf_rem_hash(mfp, hp); /* get *hp out of the hash list */ @@ -553,13 +535,11 @@ fdtofh(int filedescriptor) * Return FAIL for failure, OK otherwise */ int -mf_sync(mfp, flags) - memfile_T *mfp; - int flags; +mf_sync(memfile_T *mfp, int flags) { int status; bhdr_T *hp; -#if defined(SYNC_DUP_CLOSE) && !defined(MSDOS) +#if defined(SYNC_DUP_CLOSE) int fd; #endif int got_int_save = got_int; @@ -620,16 +600,7 @@ mf_sync(mfp, flags) # ifdef HAVE_FSYNC /* * most Unixes have the very useful fsync() function, just what we need. - * However, with OS/2 and EMX it is also available, but there are - * reports of bad problems with it (a bug in HPFS.IFS). - * So we disable use of it here in case someone tries to be smart - * and changes os_os2_cfg.h... (even though there is no __EMX__ test - * in the #if, as __EMX__ does not have sync(); we hope for a timely - * sync from the system itself). */ -# if defined(__EMX__) - error "Don't use fsync with EMX! Read emxdoc.doc or emxfix01.doc for info." -# endif if (STRCMP(p_sws, "fsync") == 0) { if (fsync(mfp->mf_fd)) @@ -639,7 +610,8 @@ mf_sync(mfp, flags) # endif /* OpenNT is strictly POSIX (Benzinger) */ /* Tandem/Himalaya NSK-OSS doesn't have sync() */ -# if defined(__OPENNT) || defined(__TANDEM) + /* No sync() on Stratus VOS */ +# if defined(__OPENNT) || defined(__TANDEM) || defined(__VOS__) fflush(NULL); # else sync(); @@ -652,18 +624,13 @@ mf_sync(mfp, flags) status = FAIL; } #endif -#ifdef MSDOS - if (_dos_commit(mfp->mf_fd)) - status = FAIL; -#else -# ifdef SYNC_DUP_CLOSE +#ifdef SYNC_DUP_CLOSE /* * Win32 is a bit more work: Duplicate the file handle and close it. * This should flush the file to disk. */ if ((fd = dup(mfp->mf_fd)) >= 0) close(fd); -# endif #endif #ifdef AMIGA # if defined(__AROS__) || defined(__amigaos4__) @@ -721,8 +688,7 @@ mf_sync(mfp, flags) * created swapfile. */ void -mf_set_dirty(mfp) - memfile_T *mfp; +mf_set_dirty(memfile_T *mfp) { bhdr_T *hp; @@ -736,9 +702,7 @@ mf_set_dirty(mfp) * insert block *hp in front of hashlist of memfile *mfp */ static void -mf_ins_hash(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_ins_hash(memfile_T *mfp, bhdr_T *hp) { mf_hash_add_item(&mfp->mf_hash, (mf_hashitem_T *)hp); } @@ -747,9 +711,7 @@ mf_ins_hash(mfp, hp) * remove block *hp from hashlist of memfile list *mfp */ static void -mf_rem_hash(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_rem_hash(memfile_T *mfp, bhdr_T *hp) { mf_hash_rem_item(&mfp->mf_hash, (mf_hashitem_T *)hp); } @@ -758,9 +720,7 @@ mf_rem_hash(mfp, hp) * look in hash lists of memfile *mfp for block header with number 'nr' */ static bhdr_T * -mf_find_hash(mfp, nr) - memfile_T *mfp; - blocknr_T nr; +mf_find_hash(memfile_T *mfp, blocknr_T nr) { return (bhdr_T *)mf_hash_find(&mfp->mf_hash, nr); } @@ -769,9 +729,7 @@ mf_find_hash(mfp, nr) * insert block *hp in front of used list of memfile *mfp */ static void -mf_ins_used(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_ins_used(memfile_T *mfp, bhdr_T *hp) { hp->bh_next = mfp->mf_used_first; mfp->mf_used_first = hp; @@ -788,9 +746,7 @@ mf_ins_used(mfp, hp) * remove block *hp from used list of memfile *mfp */ static void -mf_rem_used(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_rem_used(memfile_T *mfp, bhdr_T *hp) { if (hp->bh_next == NULL) /* last block in used list */ mfp->mf_used_last = hp->bh_prev; @@ -810,11 +766,11 @@ mf_rem_used(mfp, hp) * * Return the block header to the caller, including the memory block, so * it can be re-used. Make sure the page_count is right. + * + * Returns NULL if no block is released. */ static bhdr_T * -mf_release(mfp, page_count) - memfile_T *mfp; - int page_count; +mf_release(memfile_T *mfp, int page_count) { bhdr_T *hp; int need_release; @@ -838,7 +794,7 @@ mf_release(mfp, page_count) if (mfp->mf_fd < 0 && need_release && p_uc) { /* find for which buffer this memfile is */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf->b_ml.ml_mfp == mfp) break; if (buf != NULL && buf->b_may_swap) @@ -896,14 +852,14 @@ mf_release(mfp, page_count) * return TRUE if any memory was released */ int -mf_release_all() +mf_release_all(void) { buf_T *buf; memfile_T *mfp; bhdr_T *hp; int retval = FALSE; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { mfp = buf->b_ml.ml_mfp; if (mfp != NULL) @@ -940,9 +896,7 @@ mf_release_all() * Allocate a block header and a block of memory for it */ static bhdr_T * -mf_alloc_bhdr(mfp, page_count) - memfile_T *mfp; - int page_count; +mf_alloc_bhdr(memfile_T *mfp, int page_count) { bhdr_T *hp; @@ -963,8 +917,7 @@ mf_alloc_bhdr(mfp, page_count) * Free a block header and the block of memory for it */ static void -mf_free_bhdr(hp) - bhdr_T *hp; +mf_free_bhdr(bhdr_T *hp) { vim_free(hp->bh_data); vim_free(hp); @@ -974,9 +927,7 @@ mf_free_bhdr(hp) * insert entry *hp in the free list */ static void -mf_ins_free(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_ins_free(memfile_T *mfp, bhdr_T *hp) { hp->bh_next = mfp->mf_free_first; mfp->mf_free_first = hp; @@ -987,8 +938,7 @@ mf_ins_free(mfp, hp) * Note: caller must check that mfp->mf_free_first is not NULL! */ static bhdr_T * -mf_rem_free(mfp) - memfile_T *mfp; +mf_rem_free(memfile_T *mfp) { bhdr_T *hp; @@ -1003,11 +953,9 @@ mf_rem_free(mfp) * Return FAIL for failure, OK otherwise */ static int -mf_read(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_read(memfile_T *mfp, bhdr_T *hp) { - off_t offset; + off_T offset; unsigned page_size; unsigned size; @@ -1015,9 +963,9 @@ mf_read(mfp, hp) return FAIL; page_size = mfp->mf_page_size; - offset = (off_t)page_size * hp->bh_bnum; + offset = (off_T)page_size * hp->bh_bnum; size = page_size * hp->bh_page_count; - if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) { PERROR(_("E294: Seek error in swap file read")); return FAIL; @@ -1029,8 +977,9 @@ mf_read(mfp, hp) } #ifdef FEAT_CRYPT - /* Decrypt if 'key' is set and this is a data block. */ - if (*mfp->mf_buffer->b_p_key != NUL) + /* Decrypt if 'key' is set and this is a data block. And when changing the + * key. */ + if (*mfp->mf_buffer->b_p_key != NUL || mfp->mf_old_key != NULL) ml_decrypt_data(mfp, hp->bh_data, offset, size); #endif @@ -1043,11 +992,9 @@ mf_read(mfp, hp) * Return FAIL for failure, OK otherwise */ static int -mf_write(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_write(memfile_T *mfp, bhdr_T *hp) { - off_t offset; /* offset in the file */ + off_T offset; /* offset in the file */ blocknr_T nr; /* block nr which is being written */ bhdr_T *hp2; unsigned page_size; /* number of bytes in a page */ @@ -1080,8 +1027,8 @@ mf_write(mfp, hp) else hp2 = hp; - offset = (off_t)page_size * nr; - if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + offset = (off_T)page_size * nr; + if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) { PERROR(_("E296: Seek error in swap file write")); return FAIL; @@ -1122,11 +1069,11 @@ mf_write(mfp, hp) * Return FAIL or OK. */ static int -mf_write_block(mfp, hp, offset, size) - memfile_T *mfp; - bhdr_T *hp; - off_t offset UNUSED; - unsigned size; +mf_write_block( + memfile_T *mfp, + bhdr_T *hp, + off_T offset UNUSED, + unsigned size) { char_u *data = hp->bh_data; int result = OK; @@ -1158,9 +1105,7 @@ mf_write_block(mfp, hp, offset, size) * Return FAIL for failure, OK otherwise */ static int -mf_trans_add(mfp, hp) - memfile_T *mfp; - bhdr_T *hp; +mf_trans_add(memfile_T *mfp, bhdr_T *hp) { bhdr_T *freep; blocknr_T new_bnum; @@ -1218,14 +1163,12 @@ mf_trans_add(mfp, hp) } /* - * Lookup a translation from the trans lists and delete the entry + * Lookup a translation from the trans lists and delete the entry. * * Return the positive new number when found, the old number when not found */ blocknr_T -mf_trans_del(mfp, old_nr) - memfile_T *mfp; - blocknr_T old_nr; +mf_trans_del(memfile_T *mfp, blocknr_T old_nr) { NR_TRANS *np; blocknr_T new_bnum; @@ -1252,8 +1195,7 @@ mf_trans_del(mfp, old_nr) * name so we must work out the full path name. */ void -mf_set_ffname(mfp) - memfile_T *mfp; +mf_set_ffname(memfile_T *mfp) { mfp->mf_ffname = FullName_save(mfp->mf_fname, FALSE); } @@ -1263,8 +1205,7 @@ mf_set_ffname(mfp) * Used before doing a :cd */ void -mf_fullname(mfp) - memfile_T *mfp; +mf_fullname(memfile_T *mfp) { if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL) { @@ -1278,8 +1219,7 @@ mf_fullname(mfp) * return TRUE if there are any translations pending for 'mfp' */ int -mf_need_trans(mfp) - memfile_T *mfp; +mf_need_trans(memfile_T *mfp) { return (mfp->mf_fname != NULL && mfp->mf_neg_count > 0); } @@ -1290,13 +1230,13 @@ mf_need_trans(mfp) * error occurs). */ static void -mf_do_open(mfp, fname, flags) - memfile_T *mfp; - char_u *fname; - int flags; /* flags for open() */ +mf_do_open( + memfile_T *mfp, + char_u *fname, + int flags) /* flags for open() */ { #ifdef HAVE_LSTAT - struct stat sb; + stat_T sb; #endif mfp->mf_fname = fname; @@ -1307,7 +1247,7 @@ mf_do_open(mfp, fname, flags) * fname cannot be NameBuff, because it must have been allocated. */ mf_set_ffname(mfp); -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) /* * A ":!cd e:xxx" may change the directory without us knowing, use the * full pathname always. Careful: This frees fname! @@ -1346,17 +1286,15 @@ mf_do_open(mfp, fname, flags) */ if (mfp->mf_fd < 0) { - vim_free(mfp->mf_fname); - vim_free(mfp->mf_ffname); - mfp->mf_fname = NULL; - mfp->mf_ffname = NULL; + VIM_CLEAR(mfp->mf_fname); + VIM_CLEAR(mfp->mf_ffname); } else { #ifdef HAVE_FD_CLOEXEC int fdflags = fcntl(mfp->mf_fd, F_GETFD); if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0) - fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC); + (void)fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC); #endif #if defined(HAVE_SELINUX) || defined(HAVE_SMACK) mch_copy_sec(fname, mfp->mf_fname); @@ -1381,8 +1319,7 @@ mf_do_open(mfp, fname, flags) * Initialize an empty hash table. */ static void -mf_hash_init(mht) - mf_hashtab_T *mht; +mf_hash_init(mf_hashtab_T *mht) { vim_memset(mht, 0, sizeof(mf_hashtab_T)); mht->mht_buckets = mht->mht_small_buckets; @@ -1394,8 +1331,7 @@ mf_hash_init(mht) * The hash table must not be used again without another mf_hash_init() call. */ static void -mf_hash_free(mht) - mf_hashtab_T *mht; +mf_hash_free(mf_hashtab_T *mht) { if (mht->mht_buckets != mht->mht_small_buckets) vim_free(mht->mht_buckets); @@ -1405,8 +1341,7 @@ mf_hash_free(mht) * Free the array of a hash table and all the items it contains. */ static void -mf_hash_free_all(mht) - mf_hashtab_T *mht; +mf_hash_free_all(mf_hashtab_T *mht) { long_u idx; mf_hashitem_T *mhi; @@ -1427,9 +1362,7 @@ mf_hash_free_all(mht) * Returns a pointer to a mf_hashitem_T or NULL if the item was not found. */ static mf_hashitem_T * -mf_hash_find(mht, key) - mf_hashtab_T *mht; - blocknr_T key; +mf_hash_find(mf_hashtab_T *mht, blocknr_T key) { mf_hashitem_T *mhi; @@ -1445,9 +1378,7 @@ mf_hash_find(mht, key) * "mhi" must not be NULL. */ static void -mf_hash_add_item(mht, mhi) - mf_hashtab_T *mht; - mf_hashitem_T *mhi; +mf_hash_add_item(mf_hashtab_T *mht, mf_hashitem_T *mhi) { long_u idx; @@ -1480,9 +1411,7 @@ mf_hash_add_item(mht, mhi) * "mhi" must not be NULL and must have been inserted into "mht". */ static void -mf_hash_rem_item(mht, mhi) - mf_hashtab_T *mht; - mf_hashitem_T *mhi; +mf_hash_rem_item(mf_hashtab_T *mht, mf_hashitem_T *mhi) { if (mhi->mhi_prev == NULL) mht->mht_buckets[mhi->mhi_key & mht->mht_mask] = mhi->mhi_next; @@ -1504,8 +1433,7 @@ mf_hash_rem_item(mht, mhi) * Returns FAIL when out of memory. */ static int -mf_hash_grow(mht) - mf_hashtab_T *mht; +mf_hash_grow(mf_hashtab_T *mht) { long_u i, j; int shift; diff --git a/src/memfile_test.c b/src/memfile_test.c index e9f32b36ea..0fa1e14c40 100644 --- a/src/memfile_test.c +++ b/src/memfile_test.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -25,13 +25,11 @@ #define index_to_key(i) ((i) ^ 15167) #define TEST_COUNT 50000 -static void test_mf_hash __ARGS((void)); - /* * Test mf_hash_*() functions. */ static void -test_mf_hash() +test_mf_hash(void) { mf_hashtab_T ht; mf_hashitem_T *item; @@ -138,7 +136,7 @@ test_mf_hash() } int -main() +main(void) { test_mf_hash(); return 0; diff --git a/src/memline.c b/src/memline.c index fb438d273e..be395fce6b 100644 --- a/src/memline.c +++ b/src/memline.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -8,8 +8,8 @@ */ /* for debugging */ -/* #define CHECK(c, s) if (c) EMSG(s) */ -#define CHECK(c, s) +/* #define CHECK(c, s) do { if (c) EMSG(s); } while (0) */ +#define CHECK(c, s) do { /**/ } while (0) /* * memline.c: Contains the functions for appending, deleting and changing the @@ -63,6 +63,15 @@ typedef struct pointer_entry PTR_EN; /* block/line-count pair */ #define BLOCK0_ID1 '0' /* block 0 id 1 */ #define BLOCK0_ID1_C0 'c' /* block 0 id 1 'cm' 0 */ #define BLOCK0_ID1_C1 'C' /* block 0 id 1 'cm' 1 */ +#define BLOCK0_ID1_C2 'd' /* block 0 id 1 'cm' 2 */ + +#if defined(FEAT_CRYPT) +static int id1_codes[] = { + BLOCK0_ID1_C0, /* CRYPT_M_ZIP */ + BLOCK0_ID1_C1, /* CRYPT_M_BF */ + BLOCK0_ID1_C2, /* CRYPT_M_BF2 */ +}; +#endif /* * pointer to a block, used in a pointer block @@ -151,7 +160,7 @@ struct data_block struct block0 { char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and BLOCK0_ID1, - * BLOCK0_ID1_C0, BLOCK0_ID1_C1 */ + * BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc. */ char_u b0_version[10]; /* Vim version string */ char_u b0_page_size[4];/* number of bytes per page */ char_u b0_mtime[4]; /* last modification time of file */ @@ -226,40 +235,41 @@ typedef enum { } upd_block0_T; #ifdef FEAT_CRYPT -static void ml_set_b0_crypt __ARGS((buf_T *buf, ZERO_BL *b0p)); +static void ml_set_mfp_crypt(buf_T *buf); +static void ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p); #endif -static int ml_check_b0_id __ARGS((ZERO_BL *b0p)); -static void ml_upd_block0 __ARGS((buf_T *buf, upd_block0_T what)); -static void set_b0_fname __ARGS((ZERO_BL *, buf_T *buf)); -static void set_b0_dir_flag __ARGS((ZERO_BL *b0p, buf_T *buf)); +static int ml_check_b0_id(ZERO_BL *b0p); +static void ml_upd_block0(buf_T *buf, upd_block0_T what); +static void set_b0_fname(ZERO_BL *, buf_T *buf); +static void set_b0_dir_flag(ZERO_BL *b0p, buf_T *buf); #ifdef FEAT_MBYTE -static void add_b0_fenc __ARGS((ZERO_BL *b0p, buf_T *buf)); +static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf); #endif -static time_t swapfile_info __ARGS((char_u *)); -static int recov_file_names __ARGS((char_u **, char_u *, int prepend_dot)); -static int ml_append_int __ARGS((buf_T *, linenr_T, char_u *, colnr_T, int, int)); -static int ml_delete_int __ARGS((buf_T *, linenr_T, int)); -static char_u *findswapname __ARGS((buf_T *, char_u **, char_u *)); -static void ml_flush_line __ARGS((buf_T *)); -static bhdr_T *ml_new_data __ARGS((memfile_T *, int, int)); -static bhdr_T *ml_new_ptr __ARGS((memfile_T *)); -static bhdr_T *ml_find_line __ARGS((buf_T *, linenr_T, int)); -static int ml_add_stack __ARGS((buf_T *)); -static void ml_lineadd __ARGS((buf_T *, int)); -static int b0_magic_wrong __ARGS((ZERO_BL *)); +static time_t swapfile_info(char_u *); +static int recov_file_names(char_u **, char_u *, int prepend_dot); +static int ml_append_int(buf_T *, linenr_T, char_u *, colnr_T, int, int); +static int ml_delete_int(buf_T *, linenr_T, int); +static char_u *findswapname(buf_T *, char_u **, char_u *); +static void ml_flush_line(buf_T *); +static bhdr_T *ml_new_data(memfile_T *, int, int); +static bhdr_T *ml_new_ptr(memfile_T *); +static bhdr_T *ml_find_line(buf_T *, linenr_T, int); +static int ml_add_stack(buf_T *); +static void ml_lineadd(buf_T *, int); +static int b0_magic_wrong(ZERO_BL *); #ifdef CHECK_INODE -static int fnamecmp_ino __ARGS((char_u *, char_u *, long)); +static int fnamecmp_ino(char_u *, char_u *, long); #endif -static void long_to_char __ARGS((long, char_u *)); -static long char_to_long __ARGS((char_u *)); +static void long_to_char(long, char_u *); +static long char_to_long(char_u *); #if defined(UNIX) || defined(WIN3264) -static char_u *make_percent_swname __ARGS((char_u *dir, char_u *name)); +static char_u *make_percent_swname(char_u *dir, char_u *name); #endif #ifdef FEAT_CRYPT -static void ml_crypt_prepare __ARGS((memfile_T *mfp, off_t offset, int reading)); +static cryptstate_T *ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading); #endif #ifdef FEAT_BYTEOFF -static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype)); +static void ml_updatechunk(buf_T *buf, long line, long len, int updtype); #endif /* @@ -268,8 +278,7 @@ static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype) * Return FAIL for failure, OK otherwise. */ int -ml_open(buf) - buf_T *buf; +ml_open(buf_T *buf) { memfile_T *mfp; bhdr_T *hp = NULL; @@ -317,13 +326,6 @@ ml_open(buf) curwin->w_nrwidth_line_count = 0; #endif -#if defined(MSDOS) && !defined(DJGPP) - /* for 16 bit MS-DOS create a swapfile now, because we run out of - * memory very quickly */ - if (p_uc != 0) - ml_open_file(buf); -#endif - /* * fill block0 struct and write page 0 */ @@ -331,7 +333,7 @@ ml_open(buf) goto error; if (hp->bh_bnum != 0) { - EMSG(_("E298: Didn't get block nr 0?")); + IEMSG(_("E298: Didn't get block nr 0?")); goto error; } b0p = (ZERO_BL *)(hp->bh_data); @@ -342,7 +344,7 @@ ml_open(buf) b0p->b0_magic_int = (int)B0_MAGIC_INT; b0p->b0_magic_short = (short)B0_MAGIC_SHORT; b0p->b0_magic_char = B0_MAGIC_CHAR; - STRNCPY(b0p->b0_version, "VIM ", 4); + mch_memmove(b0p->b0_version, "VIM ", 4); STRNCPY(b0p->b0_version + 4, Version, 6); long_to_char((long)mfp->mf_page_size, b0p->b0_page_size); @@ -359,8 +361,7 @@ ml_open(buf) b0p->b0_hname[B0_HNAME_SIZE - 1] = NUL; long_to_char(mch_get_pid(), b0p->b0_pid); #ifdef FEAT_CRYPT - if (*buf->b_p_key != NUL) - ml_set_b0_crypt(buf, b0p); + ml_set_b0_crypt(buf, b0p); #endif } @@ -382,7 +383,7 @@ ml_open(buf) goto error; if (hp->bh_bnum != 1) { - EMSG(_("E298: Didn't get block nr 1?")); + IEMSG(_("E298: Didn't get block nr 1?")); goto error; } pp = (PTR_BL *)(hp->bh_data); @@ -400,7 +401,7 @@ ml_open(buf) goto error; if (hp->bh_bnum != 2) { - EMSG(_("E298: Didn't get block nr 2?")); + IEMSG(_("E298: Didn't get block nr 2?")); goto error; } @@ -424,23 +425,39 @@ ml_open(buf) } #if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Prepare encryption for "buf" for the current key and method. + */ + static void +ml_set_mfp_crypt(buf_T *buf) +{ + if (*buf->b_p_key != NUL) + { + int method_nr = crypt_get_method_nr(buf); + + if (method_nr > CRYPT_M_ZIP) + { + /* Generate a seed and store it in the memfile. */ + sha2_seed(buf->b_ml.ml_mfp->mf_seed, MF_SEED_LEN, NULL, 0); + } + } +} + /* * Prepare encryption for "buf" with block 0 "b0p". */ static void -ml_set_b0_crypt(buf, b0p) - buf_T *buf; - ZERO_BL *b0p; +ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p) { if (*buf->b_p_key == NUL) b0p->b0_id[1] = BLOCK0_ID1; else { - if (get_crypt_method(buf) == 0) - b0p->b0_id[1] = BLOCK0_ID1_C0; - else + int method_nr = crypt_get_method_nr(buf); + + b0p->b0_id[1] = id1_codes[method_nr]; + if (method_nr > CRYPT_M_ZIP) { - b0p->b0_id[1] = BLOCK0_ID1_C1; /* Generate a seed and store it in block 0 and in the memfile. */ sha2_seed(&b0p->b0_seed, MF_SEED_LEN, NULL, 0); mch_memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN); @@ -457,10 +474,10 @@ ml_set_b0_crypt(buf, b0p) * 'cryptmethod' when 'key' is changed. */ void -ml_set_crypt_key(buf, old_key, old_cm) - buf_T *buf; - char_u *old_key; - int old_cm; +ml_set_crypt_key( + buf_T *buf, + char_u *old_key, + char_u *old_cm) { memfile_T *mfp = buf->b_ml.ml_mfp; bhdr_T *hp; @@ -472,15 +489,30 @@ ml_set_crypt_key(buf, old_key, old_cm) DATA_BL *dp; blocknr_T bnum; int top; + int old_method; if (mfp == NULL) return; /* no memfile yet, nothing to do */ + old_method = crypt_method_nr_from_name(old_cm); + + /* First make sure the swapfile is in a consistent state, using the old + * key and method. */ + { + char_u *new_key = buf->b_p_key; + char_u *new_buf_cm = buf->b_p_cm; + + buf->b_p_key = old_key; + buf->b_p_cm = old_cm; + ml_preserve(buf, FALSE); + buf->b_p_key = new_key; + buf->b_p_cm = new_buf_cm; + } /* Set the key, method and seed to be used for reading, these must be the * old values. */ mfp->mf_old_key = old_key; - mfp->mf_old_cm = old_cm; - if (old_cm > 0) + mfp->mf_old_cm = old_method; + if (old_method > 0 && *old_key != NUL) mch_memmove(mfp->mf_old_seed, mfp->mf_seed, MF_SEED_LEN); /* Update block 0 with the crypt flag and may set a new seed. */ @@ -503,8 +535,7 @@ ml_set_crypt_key(buf, old_key, old_cm) idx = 0; /* start with first index in block 1 */ error = 0; buf->b_ml.ml_stack_top = 0; - vim_free(buf->b_ml.ml_stack); - buf->b_ml.ml_stack = NULL; + VIM_CLEAR(buf->b_ml.ml_stack); buf->b_ml.ml_stack_size = 0; /* no stack yet */ for ( ; !got_int; line_breakcheck()) @@ -533,8 +564,10 @@ ml_set_crypt_key(buf, old_key, old_cm) { if (pp->pb_pointer[idx].pe_bnum < 0) { - /* Skip data block with negative block number. */ - ++idx; /* get same block again for next index */ + /* Skip data block with negative block number. + * Should not happen, because of the ml_preserve() + * above. Get same block again for next index. */ + ++idx; continue; } @@ -551,6 +584,7 @@ ml_set_crypt_key(buf, old_key, old_cm) bnum = pp->pb_pointer[idx].pe_bnum; page_count = pp->pb_pointer[idx].pe_page_count; + idx = 0; continue; } } @@ -577,6 +611,8 @@ ml_set_crypt_key(buf, old_key, old_cm) idx = ip->ip_index + 1; /* go to next index */ page_count = 1; } + if (hp != NULL) + mf_put(mfp, hp, FALSE, FALSE); /* release previous block */ if (error > 0) EMSG(_("E843: Error while updating swap file crypt")); @@ -591,14 +627,13 @@ ml_set_crypt_key(buf, old_key, old_cm) * It may rename the swap file. */ void -ml_setname(buf) - buf_T *buf; +ml_setname(buf_T *buf) { int success = FALSE; memfile_T *mfp; char_u *fname; char_u *dirp; -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) char_u *p; #endif @@ -629,7 +664,7 @@ ml_setname(buf) if (fname == NULL) /* no file name found for this dir */ continue; -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) /* * Set full pathname for swap file now, because a ":!cd dir" may * change directory without us knowing it. @@ -661,7 +696,7 @@ ml_setname(buf) vim_free(mfp->mf_fname); mfp->mf_fname = fname; vim_free(mfp->mf_ffname); -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) mfp->mf_ffname = NULL; /* mf_fname is full pathname already */ #else mf_set_ffname(mfp); @@ -685,7 +720,7 @@ ml_setname(buf) { int fdflags = fcntl(mfp->mf_fd, F_GETFD); if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0) - fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC); + (void)fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC); } #endif } @@ -699,11 +734,11 @@ ml_setname(buf) * Used when 'updatecount' changes from zero to non-zero. */ void -ml_open_files() +ml_open_files(void) { buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (!buf->b_p_ro || buf->b_changed) ml_open_file(buf); } @@ -714,8 +749,7 @@ ml_open_files() * and the memfile will be in memory only (no recovery possible). */ void -ml_open_file(buf) - buf_T *buf; +ml_open_file(buf_T *buf) { memfile_T *mfp; char_u *fname; @@ -729,7 +763,7 @@ ml_open_file(buf) /* For a spell buffer use a temp file name. */ if (buf->b_spell) { - fname = vim_tempname('s'); + fname = vim_tempname('s', FALSE); if (fname != NULL) (void)mf_open_file(mfp, fname); /* consumes fname! */ buf->b_may_swap = FALSE; @@ -755,7 +789,7 @@ ml_open_file(buf) continue; if (mf_open_file(mfp, fname) == OK) /* consumes fname! */ { -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) /* * set full pathname for swap file now, because a ":!cd dir" may * change directory without us knowing it. @@ -796,8 +830,8 @@ ml_open_file(buf) * file, or reading into an existing buffer, create a swap file now. */ void -check_need_swap(newfile) - int newfile; /* reading file into new buffer */ +check_need_swap( + int newfile) /* reading file into new buffer */ { if (curbuf->b_may_swap && (!curbuf->b_p_ro || !newfile)) ml_open_file(curbuf); @@ -808,9 +842,7 @@ check_need_swap(newfile) * If 'del_file' is TRUE, delete the swap file */ void -ml_close(buf, del_file) - buf_T *buf; - int del_file; +ml_close(buf_T *buf, int del_file) { if (buf->b_ml.ml_mfp == NULL) /* not open */ return; @@ -819,8 +851,7 @@ ml_close(buf, del_file) vim_free(buf->b_ml.ml_line_ptr); vim_free(buf->b_ml.ml_stack); #ifdef FEAT_BYTEOFF - vim_free(buf->b_ml.ml_chunksize); - buf->b_ml.ml_chunksize = NULL; + VIM_CLEAR(buf->b_ml.ml_chunksize); #endif buf->b_ml.ml_mfp = NULL; @@ -836,12 +867,11 @@ ml_close(buf, del_file) * But don't delete files that were ":preserve"d when we are POSIX compatible. */ void -ml_close_all(del_file) - int del_file; +ml_close_all(int del_file) { buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0 || vim_strchr(p_cpo, CPO_PRESERVE) == NULL)); #ifdef FEAT_SPELL @@ -857,11 +887,11 @@ ml_close_all(del_file) * Only use just before exiting! */ void -ml_close_notmod() +ml_close_notmod(void) { buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (!bufIsChanged(buf)) ml_close(buf, TRUE); /* close all not-modified buffers */ } @@ -871,8 +901,7 @@ ml_close_notmod() * Used when the file has been written. */ void -ml_timestamp(buf) - buf_T *buf; +ml_timestamp(buf_T *buf) { ml_upd_block0(buf, UB_FNAME); } @@ -881,13 +910,13 @@ ml_timestamp(buf) * Return FAIL when the ID of "b0p" is wrong. */ static int -ml_check_b0_id(b0p) - ZERO_BL *b0p; +ml_check_b0_id(ZERO_BL *b0p) { if (b0p->b0_id[0] != BLOCK0_ID0 || (b0p->b0_id[1] != BLOCK0_ID1 && b0p->b0_id[1] != BLOCK0_ID1_C0 - && b0p->b0_id[1] != BLOCK0_ID1_C1) + && b0p->b0_id[1] != BLOCK0_ID1_C1 + && b0p->b0_id[1] != BLOCK0_ID1_C2) ) return FAIL; return OK; @@ -897,20 +926,29 @@ ml_check_b0_id(b0p) * Update the timestamp or the B0_SAME_DIR flag of the .swp file. */ static void -ml_upd_block0(buf, what) - buf_T *buf; - upd_block0_T what; +ml_upd_block0(buf_T *buf, upd_block0_T what) { memfile_T *mfp; bhdr_T *hp; ZERO_BL *b0p; mfp = buf->b_ml.ml_mfp; - if (mfp == NULL || (hp = mf_get(mfp, (blocknr_T)0, 1)) == NULL) + if (mfp == NULL) return; + hp = mf_get(mfp, (blocknr_T)0, 1); + if (hp == NULL) + { +#ifdef FEAT_CRYPT + /* Possibly update the seed in the memfile before there is a block0. */ + if (what == UB_CRYPT) + ml_set_mfp_crypt(buf); +#endif + return; + } + b0p = (ZERO_BL *)(hp->bh_data); if (ml_check_b0_id(b0p) == FAIL) - EMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); + IEMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); else { if (what == UB_FNAME) @@ -931,17 +969,15 @@ ml_upd_block0(buf, what) * Don't use NameBuff[]!!! */ static void -set_b0_fname(b0p, buf) - ZERO_BL *b0p; - buf_T *buf; +set_b0_fname(ZERO_BL *b0p, buf_T *buf) { - struct stat st; + stat_T st; if (buf->b_ffname == NULL) b0p->b0_fname[0] = NUL; else { -#if defined(MSDOS) || defined(MSWIN) || defined(AMIGA) +#if defined(MSWIN) || defined(AMIGA) /* Systems that cannot translate "~user" back into a path: copy the * file name unmodified. Do use slashes instead of backslashes for * portability. */ @@ -1012,9 +1048,7 @@ set_b0_fname(b0p, buf) * not set. */ static void -set_b0_dir_flag(b0p, buf) - ZERO_BL *b0p; - buf_T *buf; +set_b0_dir_flag(ZERO_BL *b0p, buf_T *buf) { if (same_directory(buf->b_ml.ml_mfp->mf_fname, buf->b_ffname)) b0p->b0_flags |= B0_SAME_DIR; @@ -1027,9 +1061,9 @@ set_b0_dir_flag(b0p, buf) * When there is room, add the 'fileencoding' to block zero. */ static void -add_b0_fenc(b0p, buf) - ZERO_BL *b0p; - buf_T *buf; +add_b0_fenc( + ZERO_BL *b0p, + buf_T *buf) { int n; int size = B0_FNAME_SIZE_NOCRYPT; @@ -1060,7 +1094,7 @@ add_b0_fenc(b0p, buf) * Try to recover curbuf from the .swp file. */ void -ml_recover() +ml_recover(void) { buf_T *buf = NULL; memfile_T *mfp = NULL; @@ -1078,7 +1112,7 @@ ml_recover() infoptr_T *ip; blocknr_T bnum; int page_count; - struct stat org_stat, swp_stat; + stat_T org_stat, swp_stat; int len; int directly; linenr_T lnum; @@ -1091,7 +1125,7 @@ ml_recover() int idx; int top; int txt_start; - off_t size; + off_T size; int called_from_main; int serious_error = TRUE; long mtime; @@ -1100,10 +1134,10 @@ ml_recover() recoverymode = TRUE; called_from_main = (curbuf->b_ml.ml_mfp == NULL); - attr = hl_attr(HLF_E); + attr = HL_ATTR(HLF_E); /* - * If the file name ends in ".s[uvw][a-z]" we assume this is the swap file. + * If the file name ends in ".s[a-w][a-z]" we assume this is the swap file. * Otherwise a search is done to find the swap file(s). */ fname = curbuf->b_fname; @@ -1112,12 +1146,13 @@ ml_recover() len = (int)STRLEN(fname); if (len >= 4 && #if defined(VMS) - STRNICMP(fname + len - 4, "_s" , 2) + STRNICMP(fname + len - 4, "_s", 2) #else - STRNICMP(fname + len - 4, ".s" , 2) + STRNICMP(fname + len - 4, ".s", 2) #endif - == 0 - && vim_strchr((char_u *)"UVWuvw", fname[len - 2]) != NULL + == 0 + && vim_strchr((char_u *)"abcdefghijklmnopqrstuvw", + TOLOWER_ASC(fname[len - 2])) != NULL && ASCII_ISALPHA(fname[len - 1])) { directly = TRUE; @@ -1237,7 +1272,7 @@ ml_recover() { msg_start(); msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) if (STRNCMP(b0p->b0_hname, "PC ", 3) == 0) MSG_PUTS_ATTR(_(" cannot be used with this version of Vim.\n"), attr | MSG_HIST); @@ -1255,14 +1290,12 @@ ml_recover() } #ifdef FEAT_CRYPT - if (b0p->b0_id[1] == BLOCK0_ID1_C0) - b0_cm = 0; - else if (b0p->b0_id[1] == BLOCK0_ID1_C1) - { - b0_cm = 1; + for (i = 0; i < (int)(sizeof(id1_codes) / sizeof(int)); ++i) + if (id1_codes[i] == b0p->b0_id[1]) + b0_cm = i; + if (b0_cm > 0) mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN); - } - set_crypt_method(buf, b0_cm); + crypt_set_cm_option(buf, b0_cm < 0 ? 0 : b0_cm); #else if (b0p->b0_id[1] != BLOCK0_ID1) { @@ -1289,7 +1322,7 @@ ml_recover() msg_end(); goto theend; } - if ((size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0) + if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) mfp->mf_blocknr_max = 0; /* no file or empty file */ else mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size); @@ -1389,7 +1422,7 @@ ml_recover() } else smsg((char_u *)_(need_key_msg), fname_used); - buf->b_p_key = get_crypt_key(FALSE, FALSE); + buf->b_p_key = crypt_get_key(FALSE, FALSE); if (buf->b_p_key == NULL) buf->b_p_key = curbuf->b_p_key; else if (*buf->b_p_key == NUL) @@ -1485,7 +1518,7 @@ ml_recover() line_count = pp->pb_pointer[idx].pe_line_count; if (readfile(curbuf->b_ffname, NULL, lnum, pp->pb_pointer[idx].pe_old_lnum - 1, - line_count, NULL, 0) == FAIL) + line_count, NULL, 0) != OK) cannot_open = TRUE; else lnum += line_count; @@ -1615,7 +1648,7 @@ ml_recover() if (!(curbuf->b_ml.ml_line_count == 2 && *ml_get(1) == NUL)) { changed_int(); - ++curbuf->b_changedtick; + ++CHANGEDTICK(curbuf); } } else @@ -1629,7 +1662,7 @@ ml_recover() if (i != 0) { changed_int(); - ++curbuf->b_changedtick; + ++CHANGEDTICK(curbuf); break; } } @@ -1699,13 +1732,11 @@ ml_recover() } if (serious_error && called_from_main) ml_close(curbuf, TRUE); -#ifdef FEAT_AUTOCMD else { apply_autocmds(EVENT_BUFREADPOST, NULL, curbuf->b_fname, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, curbuf->b_fname, FALSE, curbuf); } -#endif return; } @@ -1720,11 +1751,11 @@ ml_recover() * - find the name of the n'th swap file when recovering */ int -recover_names(fname, list, nr, fname_out) - char_u *fname; /* base for swap file name */ - int list; /* when TRUE, list the swap file names */ - int nr; /* when non-zero, return nr'th swap file name */ - char_u **fname_out; /* result when "nr" > 0 */ +recover_names( + char_u *fname, /* base for swap file name */ + int list, /* when TRUE, list the swap file names */ + int nr, /* when non-zero, return nr'th swap file name */ + char_u **fname_out) /* result when "nr" > 0 */ { int num_names; char_u *(names[6]); @@ -1829,8 +1860,10 @@ recover_names(fname, list, nr, fname_out) else { #if defined(UNIX) || defined(WIN3264) - p = dir_name + STRLEN(dir_name); - if (after_pathsep(dir_name, p) && p[-1] == p[-2]) + int len = (int)STRLEN(dir_name); + + p = dir_name + len; + if (after_pathsep(dir_name, p) && len > 1 && p[-1] == p[-2]) { /* Ends with '//', Use Full path for swap name */ tail = make_percent_swname(dir_name, fname_res); @@ -1874,7 +1907,7 @@ recover_names(fname, list, nr, fname_out) */ if (*dirp == NUL && file_count + num_files == 0 && fname != NULL) { - struct stat st; + stat_T st; char_u *swapname; swapname = modname(fname_res, @@ -1980,9 +2013,7 @@ recover_names(fname, list, nr, fname_out) * signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"") */ static char_u * -make_percent_swname(dir, name) - char_u *dir; - char_u *name; +make_percent_swname(char_u *dir, char_u *name) { char_u *d, *s, *f; @@ -1994,7 +2025,7 @@ make_percent_swname(dir, name) if (s != NULL) { STRCPY(s, f); - for (d = s; *d != NUL; mb_ptr_adv(d)) + for (d = s; *d != NUL; MB_PTR_ADV(d)) if (vim_ispathsep(*d)) *d = '%'; d = concat_fnames(dir, s, TRUE); @@ -2006,7 +2037,7 @@ make_percent_swname(dir, name) } #endif -#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) +#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) static int process_still_running; #endif @@ -2015,10 +2046,9 @@ static int process_still_running; * Returns timestamp (0 when unknown). */ static time_t -swapfile_info(fname) - char_u *fname; +swapfile_info(char_u *fname) { - struct stat st; + stat_T st; int fd; struct block0 b0; time_t x = (time_t)0; @@ -2095,7 +2125,7 @@ swapfile_info(fname) { MSG_PUTS(_("\n process ID: ")); msg_outnum(char_to_long(b0.b0_pid)); -#if defined(UNIX) || defined(__EMX__) +#if defined(UNIX) /* EMX kill() not working correctly, it seems */ if (kill((pid_t)char_to_long(b0.b0_pid), 0) == 0) { @@ -2109,7 +2139,7 @@ swapfile_info(fname) if (b0_magic_wrong(&b0)) { -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) if (STRNCMP(b0.b0_hname, "PC ", 3) == 0) MSG_PUTS(_("\n [not usable with this version of Vim]")); else @@ -2130,20 +2160,10 @@ swapfile_info(fname) } static int -recov_file_names(names, path, prepend_dot) - char_u **names; - char_u *path; - int prepend_dot; +recov_file_names(char_u **names, char_u *path, int prepend_dot) { int num_names; -#ifdef SHORT_FNAME - /* - * (MS-DOS) always short names - */ - names[0] = modname(path, (char_u *)".sw?", FALSE); - num_names = 1; -#else /* !SHORT_FNAME */ /* * (Win32 and Win64) never short names, but do prepend a dot. * (Not MS-DOS or Win32 or Win64) maybe short name, maybe not: Try both. @@ -2227,8 +2247,6 @@ recov_file_names(names, path, prepend_dot) curbuf->b_shortname = shortname; # endif -#endif /* !SHORT_FNAME */ - return num_names; } @@ -2240,14 +2258,12 @@ recov_file_names(names, path, prepend_dot) * always sync at least one block. */ void -ml_sync_all(check_file, check_char) - int check_file; - int check_char; +ml_sync_all(int check_file, int check_char) { buf_T *buf; - struct stat st; + stat_T st; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL) continue; /* no file */ @@ -2292,9 +2308,7 @@ ml_sync_all(check_file, check_char) * when message is TRUE the success of preserving is reported */ void -ml_preserve(buf, message) - buf_T *buf; - int message; +ml_preserve(buf_T *buf, int message) { bhdr_T *hp; linenr_T lnum; @@ -2378,8 +2392,7 @@ ml_preserve(buf, message) * having to check for error everywhere). */ char_u * -ml_get(lnum) - linenr_T lnum; +ml_get(linenr_T lnum) { return ml_get_buf(curbuf, lnum, FALSE); } @@ -2388,8 +2401,7 @@ ml_get(lnum) * Return pointer to position "pos". */ char_u * -ml_get_pos(pos) - pos_T *pos; +ml_get_pos(pos_T *pos) { return (ml_get_buf(curbuf, pos->lnum, FALSE) + pos->col); } @@ -2398,7 +2410,7 @@ ml_get_pos(pos) * Return pointer to cursor line. */ char_u * -ml_get_curline() +ml_get_curline(void) { return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE); } @@ -2407,7 +2419,7 @@ ml_get_curline() * Return pointer to cursor position. */ char_u * -ml_get_cursor() +ml_get_cursor(void) { return (ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE) + curwin->w_cursor.col); @@ -2420,10 +2432,10 @@ ml_get_cursor() * changed) */ char_u * -ml_get_buf(buf, lnum, will_change) - buf_T *buf; - linenr_T lnum; - int will_change; /* line will be changed */ +ml_get_buf( + buf_T *buf, + linenr_T lnum, + int will_change) /* line will be changed */ { bhdr_T *hp; DATA_BL *dp; @@ -2437,7 +2449,7 @@ ml_get_buf(buf, lnum, will_change) /* Avoid giving this message for a recursive call, may happen when * the GUI redraws part of the text. */ ++recursive; - EMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum); + IEMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum); --recursive; } errorret: @@ -2472,7 +2484,7 @@ ml_get_buf(buf, lnum, will_change) /* Avoid giving this message for a recursive call, may happen * when the GUI redraws part of the text. */ ++recursive; - EMSGN(_("E316: ml_get: cannot find line %ld"), lnum); + IEMSGN(_("E316: ml_get: cannot find line %ld"), lnum); --recursive; } goto errorret; @@ -2496,7 +2508,7 @@ ml_get_buf(buf, lnum, will_change) * is in allocated memory. */ int -ml_line_alloced() +ml_line_alloced(void) { return (curbuf->b_ml.ml_flags & ML_LINE_DIRTY); } @@ -2514,11 +2526,11 @@ ml_line_alloced() * return FAIL for failure, OK otherwise */ int -ml_append(lnum, line, len, newfile) - linenr_T lnum; /* append after this line (can be 0) */ - char_u *line; /* text of the new line */ - colnr_T len; /* length of new line, including NUL, or 0 */ - int newfile; /* flag, see above */ +ml_append( + linenr_T lnum, /* append after this line (can be 0) */ + char_u *line, /* text of the new line */ + colnr_T len, /* length of new line, including NUL, or 0 */ + int newfile) /* flag, see above */ { /* When starting up, we might still need to create the memfile */ if (curbuf->b_ml.ml_mfp == NULL && open_buffer(FALSE, NULL, 0) == FAIL) @@ -2529,18 +2541,18 @@ ml_append(lnum, line, len, newfile) return ml_append_int(curbuf, lnum, line, len, newfile, FALSE); } -#if defined(FEAT_SPELL) || defined(PROTO) +#if defined(FEAT_SPELL) || defined(FEAT_QUICKFIX) || defined(PROTO) /* * Like ml_append() but for an arbitrary buffer. The buffer must already have * a memline. */ int -ml_append_buf(buf, lnum, line, len, newfile) - buf_T *buf; - linenr_T lnum; /* append after this line (can be 0) */ - char_u *line; /* text of the new line */ - colnr_T len; /* length of new line, including NUL, or 0 */ - int newfile; /* flag, see above */ +ml_append_buf( + buf_T *buf, + linenr_T lnum, /* append after this line (can be 0) */ + char_u *line, /* text of the new line */ + colnr_T len, /* length of new line, including NUL, or 0 */ + int newfile) /* flag, see above */ { if (buf->b_ml.ml_mfp == NULL) return FAIL; @@ -2552,13 +2564,13 @@ ml_append_buf(buf, lnum, line, len, newfile) #endif static int -ml_append_int(buf, lnum, line, len, newfile, mark) - buf_T *buf; - linenr_T lnum; /* append after this line (can be 0) */ - char_u *line; /* text of the new line */ - colnr_T len; /* length of line, including NUL, or 0 */ - int newfile; /* flag, see above */ - int mark; /* mark the new line */ +ml_append_int( + buf_T *buf, + linenr_T lnum, /* append after this line (can be 0) */ + char_u *line, /* text of the new line */ + colnr_T len, /* length of line, including NUL, or 0 */ + int newfile, /* flag, see above */ + int mark) /* mark the new line */ { int i; int line_count; /* number of indexes in current block */ @@ -2886,7 +2898,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark) pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong 3")); + IEMSG(_("E317: pointer block id wrong 3")); mf_put(mfp, hp, FALSE, FALSE); return FAIL; } @@ -3028,7 +3040,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark) */ if (stack_idx < 0) { - EMSG(_("E318: Updated too many blocks?")); + IEMSG(_("E318: Updated too many blocks?")); buf->b_ml.ml_stack_top = 0; /* invalidate stack */ } } @@ -3046,6 +3058,11 @@ ml_append_int(buf, lnum, line, len, newfile, mark) (char_u *)"\n", 1); } #endif +#ifdef FEAT_JOB_CHANNEL + if (buf->b_write_to_channel) + channel_write_new_lines(buf); +#endif + return OK; } @@ -3061,10 +3078,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark) * return FAIL for failure, OK otherwise */ int -ml_replace(lnum, line, copy) - linenr_T lnum; - char_u *line; - int copy; +ml_replace(linenr_T lnum, char_u *line, int copy) { if (line == NULL) /* just checking... */ return FAIL; @@ -3094,7 +3108,8 @@ ml_replace(lnum, line, copy) } /* - * Delete line 'lnum' in the current buffer. + * Delete line "lnum" in the current buffer. + * When "message" is TRUE may give a "No lines in buffer" message. * * Check: The caller of this function should probably also call * deleted_lines() after this. @@ -3102,19 +3117,14 @@ ml_replace(lnum, line, copy) * return FAIL for failure, OK otherwise */ int -ml_delete(lnum, message) - linenr_T lnum; - int message; +ml_delete(linenr_T lnum, int message) { ml_flush_line(curbuf); return ml_delete_int(curbuf, lnum, message); } static int -ml_delete_int(buf, lnum, message) - buf_T *buf; - linenr_T lnum; - int message; +ml_delete_int(buf_T *buf, linenr_T lnum, int message) { bhdr_T *hp; memfile_T *mfp; @@ -3209,7 +3219,7 @@ ml_delete_int(buf, lnum, message) pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong 4")); + IEMSG(_("E317: pointer block id wrong 4")); mf_put(mfp, hp, FALSE, FALSE); return FAIL; } @@ -3274,8 +3284,7 @@ ml_delete_int(buf, lnum, message) * set the B_MARKED flag for line 'lnum' */ void -ml_setmarked(lnum) - linenr_T lnum; +ml_setmarked(linenr_T lnum) { bhdr_T *hp; DATA_BL *dp; @@ -3304,7 +3313,7 @@ ml_setmarked(lnum) * find the first line with its B_MARKED flag set */ linenr_T -ml_firstmarked() +ml_firstmarked(void) { bhdr_T *hp; DATA_BL *dp; @@ -3348,7 +3357,7 @@ ml_firstmarked() * clear all DB_MARKED flags */ void -ml_clearmarked() +ml_clearmarked(void) { bhdr_T *hp; DATA_BL *dp; @@ -3390,8 +3399,7 @@ ml_clearmarked() * flush ml_line if necessary */ static void -ml_flush_line(buf) - buf_T *buf; +ml_flush_line(buf_T *buf) { bhdr_T *hp; DATA_BL *dp; @@ -3423,7 +3431,7 @@ ml_flush_line(buf) hp = ml_find_line(buf, lnum, ML_FIND); if (hp == NULL) - EMSGN(_("E320: Cannot find line %ld"), lnum); + IEMSGN(_("E320: Cannot find line %ld"), lnum); else { dp = (DATA_BL *)(hp->bh_data); @@ -3496,10 +3504,7 @@ ml_flush_line(buf) * create a new, empty, data block */ static bhdr_T * -ml_new_data(mfp, negative, page_count) - memfile_T *mfp; - int negative; - int page_count; +ml_new_data(memfile_T *mfp, int negative, int page_count) { bhdr_T *hp; DATA_BL *dp; @@ -3520,8 +3525,7 @@ ml_new_data(mfp, negative, page_count) * create a new, empty, pointer block */ static bhdr_T * -ml_new_ptr(mfp) - memfile_T *mfp; +ml_new_ptr(memfile_T *mfp) { bhdr_T *hp; PTR_BL *pp; @@ -3554,10 +3558,7 @@ ml_new_ptr(mfp) * return: NULL for failure, pointer to block header otherwise */ static bhdr_T * -ml_find_line(buf, lnum, action) - buf_T *buf; - linenr_T lnum; - int action; +ml_find_line(buf_T *buf, linenr_T lnum, int action) { DATA_BL *dp; PTR_BL *pp; @@ -3672,7 +3673,7 @@ ml_find_line(buf, lnum, action) pp = (PTR_BL *)(dp); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong")); + IEMSG(_("E317: pointer block id wrong")); goto error_block; } @@ -3717,11 +3718,11 @@ ml_find_line(buf, lnum, action) if (idx >= (int)pp->pb_count) /* past the end: something wrong! */ { if (lnum > buf->b_ml.ml_line_count) - EMSGN(_("E322: line number out of range: %ld past the end"), + IEMSGN(_("E322: line number out of range: %ld past the end"), lnum - buf->b_ml.ml_line_count); else - EMSGN(_("E323: line count wrong in block %ld"), bnum); + IEMSGN(_("E323: line count wrong in block %ld"), bnum); goto error_block; } if (action == ML_DELETE) @@ -3759,8 +3760,7 @@ ml_find_line(buf, lnum, action) * return -1 for failure, number of the new entry otherwise */ static int -ml_add_stack(buf) - buf_T *buf; +ml_add_stack(buf_T *buf) { int top; infoptr_T *newstack; @@ -3776,7 +3776,8 @@ ml_add_stack(buf) (buf->b_ml.ml_stack_size + STACK_INCR)); if (newstack == NULL) return -1; - mch_memmove(newstack, buf->b_ml.ml_stack, + if (top > 0) + mch_memmove(newstack, buf->b_ml.ml_stack, (size_t)top * sizeof(infoptr_T)); vim_free(buf->b_ml.ml_stack); buf->b_ml.ml_stack = newstack; @@ -3798,9 +3799,7 @@ ml_add_stack(buf) * Count is the number of lines added, negative if lines have been deleted. */ static void -ml_lineadd(buf, count) - buf_T *buf; - int count; +ml_lineadd(buf_T *buf, int count) { int idx; infoptr_T *ip; @@ -3817,7 +3816,7 @@ ml_lineadd(buf, count) if (pp->pb_id != PTR_ID) { mf_put(mfp, hp, FALSE, FALSE); - EMSG(_("E317: pointer block id wrong 2")); + IEMSG(_("E317: pointer block id wrong 2")); break; } pp->pb_pointer[ip->ip_index].pe_line_count += count; @@ -3835,9 +3834,7 @@ ml_lineadd(buf, count) * Otherwise returns FAIL. */ int -resolve_symlink(fname, buf) - char_u *fname; - char_u *buf; +resolve_symlink(char_u *fname, char_u *buf) { char_u tmp[MAXPATHL]; int ret; @@ -3911,11 +3908,11 @@ resolve_symlink(fname, buf) * Returns pointer to allocated memory or NULL. */ char_u * -makeswapname(fname, ffname, buf, dir_name) - char_u *fname; - char_u *ffname UNUSED; - buf_T *buf; - char_u *dir_name; +makeswapname( + char_u *fname, + char_u *ffname UNUSED, + buf_T *buf, + char_u *dir_name) { char_u *r, *s; char_u *fname_res = fname; @@ -3924,8 +3921,10 @@ makeswapname(fname, ffname, buf, dir_name) #endif #if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */ - s = dir_name + STRLEN(dir_name); - if (after_pathsep(dir_name, s) && s[-1] == s[-2]) + int len = (int)STRLEN(dir_name); + + s = dir_name + len; + if (after_pathsep(dir_name, s) && len > 1 && s[-1] == s[-2]) { /* Ends with '//', Use Full path */ r = NULL; if ((s = make_percent_swname(dir_name, fname)) != NULL) @@ -3945,11 +3944,7 @@ makeswapname(fname, ffname, buf, dir_name) #endif r = buf_modname( -#ifdef SHORT_FNAME - TRUE, -#else (buf->b_p_sn || buf->b_shortname), -#endif fname_res, (char_u *) #if defined(VMS) @@ -3957,13 +3952,8 @@ makeswapname(fname, ffname, buf, dir_name) #else ".swp", #endif -#ifdef SHORT_FNAME /* always 8.3 file name */ - FALSE -#else /* Prepend a '.' to the swap file name for the current directory. */ - dir_name[0] == '.' && dir_name[1] == NUL -#endif - ); + dir_name[0] == '.' && dir_name[1] == NUL); if (r == NULL) /* out of memory */ return NULL; @@ -3985,9 +3975,9 @@ makeswapname(fname, ffname, buf, dir_name) * The return value is an allocated string and can be NULL. */ char_u * -get_file_in_dir(fname, dname) - char_u *fname; - char_u *dname; /* don't use "dirname", it is a global for Alpha */ +get_file_in_dir( + char_u *fname, + char_u *dname) /* don't use "dirname", it is a global for Alpha */ { char_u *t; char_u *tail; @@ -4022,7 +4012,7 @@ get_file_in_dir(fname, dname) #ifdef WIN3264 if (retval != NULL) - for (t = gettail(retval); *t != NUL; mb_ptr_adv(t)) + for (t = gettail(retval); *t != NUL; MB_PTR_ADV(t)) if (*t == ':') *t = '%'; #endif @@ -4030,17 +4020,17 @@ get_file_in_dir(fname, dname) return retval; } -static void attention_message __ARGS((buf_T *buf, char_u *fname)); +static void attention_message(buf_T *buf, char_u *fname); /* * Print the ATTENTION message: info about an existing swap file. */ static void -attention_message(buf, fname) - buf_T *buf; /* buffer being edited */ - char_u *fname; /* swap file name */ +attention_message( + buf_T *buf, /* buffer being edited */ + char_u *fname) /* swap file name */ { - struct stat st; + stat_T st; time_t x, sx; char *p; @@ -4067,8 +4057,7 @@ attention_message(buf, fname) } /* Some of these messages are long to allow translation to * other languages. */ - MSG_PUTS(_("\n(1) Another program may be editing the same file. If this is the case,\n be careful not to end up with two different instances of the same\n file when making changes.")); - MSG_PUTS(_(" Quit, or continue with caution.\n")); + MSG_PUTS(_("\n(1) Another program may be editing the same file. If this is the case,\n be careful not to end up with two different instances of the same\n file when making changes. Quit, or continue with caution.\n")); MSG_PUTS(_("(2) An edit session for this file crashed.\n")); MSG_PUTS(_(" If this is the case, use \":recover\" or \"vim -r ")); msg_outtrans(buf->b_fname); @@ -4080,8 +4069,8 @@ attention_message(buf, fname) --no_wait_return; } -#ifdef FEAT_AUTOCMD -static int do_swapexists __ARGS((buf_T *buf, char_u *fname)); +#if defined(FEAT_EVAL) +static int do_swapexists(buf_T *buf, char_u *fname); /* * Trigger the SwapExists autocommands. @@ -4095,9 +4084,7 @@ static int do_swapexists __ARGS((buf_T *buf, char_u *fname)); * 6: abort */ static int -do_swapexists(buf, fname) - buf_T *buf; - char_u *fname; +do_swapexists(buf_T *buf, char_u *fname) { set_vim_var_string(VV_SWAPNAME, fname, -1); set_vim_var_string(VV_SWAPCHOICE, NULL, -1); @@ -4136,10 +4123,10 @@ do_swapexists(buf, fname) * Note: May trigger SwapExists autocmd, pointers may change! */ static char_u * -findswapname(buf, dirp, old_fname) - buf_T *buf; - char_u **dirp; /* pointer to list of directories */ - char_u *old_fname; /* don't give warning for this file name */ +findswapname( + buf_T *buf, + char_u **dirp, /* pointer to list of directories */ + char_u *old_fname) /* don't give warning for this file name */ { char_u *fname; int n; @@ -4147,13 +4134,10 @@ findswapname(buf, dirp, old_fname) #ifdef AMIGA BPTR fh; #endif -#ifndef SHORT_FNAME int r; -#endif char_u *buf_fname = buf->b_fname; -#if !defined(SHORT_FNAME) \ - && ((!defined(UNIX) && !defined(OS2)) || defined(ARCHIE)) +#if !defined(UNIX) # define CREATE_DUMMY_FILE FILE *dummyfd = NULL; @@ -4167,7 +4151,7 @@ findswapname(buf, dirp, old_fname) if (buf_fname == NULL) buf_fname = buf->b_fname; else - for (t = gettail(buf_fname); *t != NUL; mb_ptr_adv(t)) + for (t = gettail(buf_fname); *t != NUL; MB_PTR_ADV(t)) if (*t == ':') *t = '%'; } @@ -4209,11 +4193,10 @@ findswapname(buf, dirp, old_fname) break; if ((n = (int)STRLEN(fname)) == 0) /* safety check */ { - vim_free(fname); - fname = NULL; + VIM_CLEAR(fname); break; } -#if (defined(UNIX) || defined(OS2)) && !defined(ARCHIE) && !defined(SHORT_FNAME) +#if defined(UNIX) /* * Some systems have a MS-DOS compatible filesystem that use 8.3 character * file names. If this is the first try and the swap file name does not fit in @@ -4224,7 +4207,7 @@ findswapname(buf, dirp, old_fname) { char_u *tail; char_u *fname2; - struct stat s1, s2; + stat_T s1, s2; int f1, f2; int created1 = FALSE, created2 = FALSE; int same = FALSE; @@ -4264,10 +4247,6 @@ findswapname(buf, dirp, old_fname) { f1 = mch_open_rw((char *)fname, O_RDWR|O_CREAT|O_EXCL|O_EXTRA); -#if defined(OS2) - if (f1 < 0 && errno == ENOENT) - same = TRUE; -#endif created1 = TRUE; } if (f1 >= 0) @@ -4317,7 +4296,7 @@ findswapname(buf, dirp, old_fname) if (mch_getperm(fname) < 0) /* it does not exist */ { #ifdef HAVE_LSTAT - struct stat sb; + stat_T sb; /* * Extra security check: When a swap file is a symbolic link, this @@ -4356,7 +4335,6 @@ findswapname(buf, dirp, old_fname) */ if (fname[n - 2] == 'w' && fname[n - 1] == 'p') /* first try */ { -#ifndef SHORT_FNAME /* * on MS-DOS compatible filesystems (e.g. messydos) file.doc.swp * and file.doc are the same file. To guess if this problem is @@ -4379,7 +4357,6 @@ findswapname(buf, dirp, old_fname) continue; /* try again with '.' replaced with '_' */ } } -#endif /* * If we get here the ".swp" file really exists. * Give an error message, unless recovering, no file name, we are @@ -4468,10 +4445,10 @@ findswapname(buf, dirp, old_fname) } #endif -#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) +#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) process_still_running = FALSE; #endif -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* * If there is an SwapExists autocommand and we can handle * the response, trigger it. It may return 0 to ask the @@ -4520,13 +4497,13 @@ findswapname(buf, dirp, old_fname) name == NULL ? (char_u *)_("Swap file already exists!") : name, -# if defined(UNIX) || defined(__EMX__) || defined(VMS) +# if defined(UNIX) || defined(VMS) process_still_running ? (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort") : # endif (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"), 1, NULL, FALSE); -# if defined(UNIX) || defined(__EMX__) || defined(VMS) +# if defined(UNIX) || defined(VMS) if (process_still_running && choice >= 4) choice++; /* Skip missing "Delete it" button */ # endif @@ -4596,8 +4573,7 @@ findswapname(buf, dirp, old_fname) if (fname[n - 2] == 'a') /* ".saa": tried enough, give up */ { EMSG(_("E326: Too many swap files found")); - vim_free(fname); - fname = NULL; + VIM_CLEAR(fname); break; } --fname[n - 2]; /* ".svz", ".suz", etc. */ @@ -4622,8 +4598,7 @@ findswapname(buf, dirp, old_fname) } static int -b0_magic_wrong(b0p) - ZERO_BL *b0p; +b0_magic_wrong(ZERO_BL *b0p) { return (b0p->b0_magic_long != (long)B0_MAGIC_LONG || b0p->b0_magic_int != (int)B0_MAGIC_INT @@ -4673,8 +4648,8 @@ b0_magic_wrong(b0p) * == 0 == 0 OK FAIL TRUE * * current file doesn't exist, inode for swap unknown, both file names not - * available -> probably same file - * == 0 == 0 FAIL FAIL FALSE + * available -> compare file names + * == 0 == 0 FAIL FAIL fname_c != fname_s * * Note that when the ino_t is 64 bits, only the last 32 will be used. This * can't be changed without making the block 0 incompatible with 32 bit @@ -4682,12 +4657,12 @@ b0_magic_wrong(b0p) */ static int -fnamecmp_ino(fname_c, fname_s, ino_block0) - char_u *fname_c; /* current file name */ - char_u *fname_s; /* file name from swap file */ - long ino_block0; +fnamecmp_ino( + char_u *fname_c, /* current file name */ + char_u *fname_s, /* file name from swap file */ + long ino_block0) { - struct stat st; + stat_T st; ino_t ino_c = 0; /* ino of current file */ ino_t ino_s; /* ino of file from swap file */ char_u buf_c[MAXPATHL]; /* full path of fname_c */ @@ -4718,14 +4693,15 @@ fnamecmp_ino(fname_c, fname_s, ino_block0) retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE); retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE); if (retval_c == OK && retval_s == OK) - return (STRCMP(buf_c, buf_s) != 0); + return STRCMP(buf_c, buf_s) != 0; /* * Can't compare inodes or file names, guess that the files are different, - * unless both appear not to exist at all. + * unless both appear not to exist at all, then compare with the file name + * in the swap file. */ if (ino_s == 0 && ino_c == 0 && retval_c == FAIL && retval_s == FAIL) - return FALSE; + return STRCMP(fname_c, fname_s) != 0; return TRUE; } #endif /* CHECK_INODE */ @@ -4735,9 +4711,7 @@ fnamecmp_ino(fname_c, fname_s, ino_block0) * Used for machine independency in block zero. */ static void -long_to_char(n, s) - long n; - char_u *s; +long_to_char(long n, char_u *s) { s[0] = (char_u)(n & 0xff); n = (unsigned)n >> 8; @@ -4749,8 +4723,7 @@ long_to_char(n, s) } static long -char_to_long(s) - char_u *s; +char_to_long(char_u *s) { long retval; @@ -4772,8 +4745,7 @@ char_to_long(s) * - 'fileencoding' */ void -ml_setflags(buf) - buf_T *buf; +ml_setflags(buf_T *buf) { bhdr_T *hp; ZERO_BL *b0p; @@ -4805,21 +4777,26 @@ ml_setflags(buf) * Otherwise return "data". */ char_u * -ml_encrypt_data(mfp, data, offset, size) - memfile_T *mfp; - char_u *data; - off_t offset; - unsigned size; +ml_encrypt_data( + memfile_T *mfp, + char_u *data, + off_T offset, + unsigned size) { DATA_BL *dp = (DATA_BL *)data; char_u *head_end; char_u *text_start; char_u *new_data; int text_len; + cryptstate_T *state; if (dp->db_id != DATA_ID) return data; + state = ml_crypt_prepare(mfp, offset, FALSE); + if (state == NULL) + return data; + new_data = (char_u *)alloc(size); if (new_data == NULL) return NULL; @@ -4831,10 +4808,8 @@ ml_encrypt_data(mfp, data, offset, size) mch_memmove(new_data, dp, head_end - (char_u *)dp); /* Encrypt the text. */ - crypt_push_state(); - ml_crypt_prepare(mfp, offset, FALSE); - crypt_encode(text_start, text_len, new_data + dp->db_txt_start); - crypt_pop_state(); + crypt_encode(state, text_start, text_len, new_data + dp->db_txt_start); + crypt_free_state(state); /* Clear the gap. */ if (head_end < text_start) @@ -4844,19 +4819,20 @@ ml_encrypt_data(mfp, data, offset, size) } /* - * Decrypt the text in "data" if it points to a data block. + * Decrypt the text in "data" if it points to an encrypted data block. */ void -ml_decrypt_data(mfp, data, offset, size) - memfile_T *mfp; - char_u *data; - off_t offset; - unsigned size; +ml_decrypt_data( + memfile_T *mfp, + char_u *data, + off_T offset, + unsigned size) { DATA_BL *dp = (DATA_BL *)data; char_u *head_end; char_u *text_start; int text_len; + cryptstate_T *state; if (dp->db_id == DATA_ID) { @@ -4868,57 +4844,58 @@ ml_decrypt_data(mfp, data, offset, size) || dp->db_txt_end > size) return; /* data was messed up */ - /* Decrypt the text in place. */ - crypt_push_state(); - ml_crypt_prepare(mfp, offset, TRUE); - crypt_decode(text_start, text_len); - crypt_pop_state(); + state = ml_crypt_prepare(mfp, offset, TRUE); + if (state != NULL) + { + /* Decrypt the text in place. */ + crypt_decode_inplace(state, text_start, text_len); + crypt_free_state(state); + } } } /* * Prepare for encryption/decryption, using the key, seed and offset. + * Return an allocated cryptstate_T *. */ - static void -ml_crypt_prepare(mfp, offset, reading) - memfile_T *mfp; - off_t offset; - int reading; + static cryptstate_T * +ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading) { buf_T *buf = mfp->mf_buffer; char_u salt[50]; - int method; + int method_nr; char_u *key; char_u *seed; if (reading && mfp->mf_old_key != NULL) { /* Reading back blocks with the previous key/method/seed. */ - method = mfp->mf_old_cm; + method_nr = mfp->mf_old_cm; key = mfp->mf_old_key; seed = mfp->mf_old_seed; } else { - method = get_crypt_method(buf); + method_nr = crypt_get_method_nr(buf); key = buf->b_p_key; seed = mfp->mf_seed; } + if (*key == NUL) + return NULL; - use_crypt_method = method; /* select pkzip or blowfish */ - if (method == 0) + if (method_nr == CRYPT_M_ZIP) { + /* For PKzip: Append the offset to the key, so that we use a different + * key for every block. */ vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset); - crypt_init_keys(salt); - } - else - { - /* Using blowfish, add salt and seed. We use the byte offset of the - * block for the salt. */ - vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); - bf_key_init(key, salt, (int)STRLEN(salt)); - bf_cfb_init(seed, MF_SEED_LEN); + return crypt_create(method_nr, salt, NULL, 0, NULL, 0); } + + /* Using blowfish or better: add salt and seed. We use the byte offset + * of the block for the salt. */ + vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); + return crypt_create(method_nr, key, salt, (int)STRLEN(salt), + seed, MF_SEED_LEN); } #endif @@ -4937,11 +4914,11 @@ ml_crypt_prepare(mfp, offset, reading) * ML_CHNK_UPDLINE: Add len to parent chunk, as a signed entity. */ static void -ml_updatechunk(buf, line, len, updtype) - buf_T *buf; - linenr_T line; - long len; - int updtype; +ml_updatechunk( + buf_T *buf, + linenr_T line, + long len, + int updtype) { static buf_T *ml_upd_lastbuf = NULL; static linenr_T ml_upd_lastline; @@ -5019,6 +4996,8 @@ ml_updatechunk(buf, line, len, updtype) /* May resize here so we don't have to do it in both cases below */ if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks) { + chunksize_T *t_chunksize = buf->b_ml.ml_chunksize; + buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2; buf->b_ml.ml_chunksize = (chunksize_T *) vim_realloc(buf->b_ml.ml_chunksize, @@ -5026,6 +5005,7 @@ ml_updatechunk(buf, line, len, updtype) if (buf->b_ml.ml_chunksize == NULL) { /* Hmmmm, Give up on offset for this buffer */ + vim_free(t_chunksize); buf->b_ml.ml_usedchunks = -1; return; } @@ -5176,10 +5156,7 @@ ml_updatechunk(buf, line, len, updtype) * return -1 if information is not available */ long -ml_find_line_or_offset(buf, lnum, offp) - buf_T *buf; - linenr_T lnum; - long *offp; +ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) { linenr_T curline; int curix; @@ -5292,8 +5269,10 @@ ml_find_line_or_offset(buf, lnum, offp) if (ffdos) size += lnum - 1; - /* Don't count the last line break if 'bin' and 'noeol'. */ - if (buf->b_p_bin && !buf->b_p_eol) + /* Don't count the last line break if 'noeol' and ('bin' or + * 'nofixeol'). */ + if ((!buf->b_p_fixeol || buf->b_p_bin) && !buf->b_p_eol + && buf->b_ml.ml_line_count == lnum) size -= ffdos + 1; } @@ -5304,8 +5283,7 @@ ml_find_line_or_offset(buf, lnum, offp) * Goto byte in buffer with offset 'cnt'. */ void -goto_byte(cnt) - long cnt; +goto_byte(long cnt) { long boff = cnt; linenr_T lnum; diff --git a/src/menu.c b/src/menu.c index 5f443a7fec..04353f1519 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI/Motif support by Robert Webb @@ -19,47 +19,43 @@ #define MENUDEPTH 10 /* maximum depth of menus */ #ifdef FEAT_GUI_W32 -static int add_menu_path __ARGS((char_u *, vimmenu_T *, int *, char_u *, int)); +static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *, int); #else -static int add_menu_path __ARGS((char_u *, vimmenu_T *, int *, char_u *)); -#endif -static int menu_nable_recurse __ARGS((vimmenu_T *menu, char_u *name, int modes, int enable)); -static int remove_menu __ARGS((vimmenu_T **, char_u *, int, int silent)); -static void free_menu __ARGS((vimmenu_T **menup)); -static void free_menu_string __ARGS((vimmenu_T *, int)); -static int show_menus __ARGS((char_u *, int)); -static void show_menus_recursive __ARGS((vimmenu_T *, int, int)); -static int menu_name_equal __ARGS((char_u *name, vimmenu_T *menu)); -static int menu_namecmp __ARGS((char_u *name, char_u *mname)); -static int get_menu_cmd_modes __ARGS((char_u *, int, int *, int *)); -static char_u *popup_mode_name __ARGS((char_u *name, int idx)); -static char_u *menu_text __ARGS((char_u *text, int *mnemonic, char_u **actext)); -#ifdef FEAT_GUI -static int get_menu_mode __ARGS((void)); -static void gui_update_menus_recurse __ARGS((vimmenu_T *, int)); -#endif +static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *); +#endif +static int menu_nable_recurse(vimmenu_T *menu, char_u *name, int modes, int enable); +static int remove_menu(vimmenu_T **, char_u *, int, int silent); +static void free_menu(vimmenu_T **menup); +static void free_menu_string(vimmenu_T *, int); +static int show_menus(char_u *, int); +static void show_menus_recursive(vimmenu_T *, int, int); +static int menu_name_equal(char_u *name, vimmenu_T *menu); +static int menu_namecmp(char_u *name, char_u *mname); +static int get_menu_cmd_modes(char_u *, int, int *, int *); +static char_u *popup_mode_name(char_u *name, int idx); +static char_u *menu_text(char_u *text, int *mnemonic, char_u **actext); #if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) -static void gui_create_tearoffs_recurse __ARGS((vimmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx)); -static void gui_add_tearoff __ARGS((char_u *tearpath, int *pri_tab, int pri_idx)); -static void gui_destroy_tearoffs_recurse __ARGS((vimmenu_T *menu)); +static void gui_create_tearoffs_recurse(vimmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx); +static void gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx); +static void gui_destroy_tearoffs_recurse(vimmenu_T *menu); static int s_tearoffs = FALSE; #endif -static int menu_is_hidden __ARGS((char_u *name)); +static int menu_is_hidden(char_u *name); #if defined(FEAT_CMDL_COMPL) || (defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF)) -static int menu_is_tearoff __ARGS((char_u *name)); +static int menu_is_tearoff(char_u *name); #endif #if defined(FEAT_MULTI_LANG) || defined(FEAT_TOOLBAR) -static char_u *menu_skip_part __ARGS((char_u *p)); +static char_u *menu_skip_part(char_u *p); #endif #ifdef FEAT_MULTI_LANG -static char_u *menutrans_lookup __ARGS((char_u *name, int len)); -static void menu_unescape_name __ARGS((char_u *p)); +static char_u *menutrans_lookup(char_u *name, int len); +static void menu_unescape_name(char_u *p); #endif -static char_u *menu_translate_tab_and_shift __ARGS((char_u *arg_start)); +static char_u *menu_translate_tab_and_shift(char_u *arg_start); /* The character for each menu mode */ static char_u menu_mode_chars[] = {'n', 'v', 's', 'o', 'i', 'c', 't'}; @@ -82,12 +78,37 @@ static const char *toolbar_names[] = # define TOOLBAR_NAME_COUNT (sizeof(toolbar_names) / sizeof(char *)) #endif +/* + * Return TRUE if "name" is a window toolbar menu name. + */ + static int +menu_is_winbar(char_u *name) +{ + return (STRNCMP(name, "WinBar", 6) == 0); +} + + int +winbar_height(win_T *wp) +{ + if (wp->w_winbar != NULL && wp->w_winbar->children != NULL) + return 1; + return 0; +} + + static vimmenu_T ** +get_root_menu(char_u *name) +{ + if (menu_is_winbar(name)) + return &curwin->w_winbar; + return &root_menu; +} + /* * Do the :menu command and relatives. */ void -ex_menu(eap) - exarg_T *eap; /* Ex command arguments */ +ex_menu( + exarg_T *eap) /* Ex command arguments */ { char_u *menu_path; int modes; @@ -102,7 +123,7 @@ ex_menu(eap) int i; #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) int old_menu_height; -# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_W16) +# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) int old_toolbar_height; # endif #endif @@ -113,6 +134,7 @@ ex_menu(eap) char_u *icon = NULL; #endif vimmenu_T menuarg; + vimmenu_T **root_menu_ptr; modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); arg = eap->arg; @@ -152,7 +174,7 @@ ex_menu(eap) { if (*arg == '\\') STRMOVE(arg, arg + 1); - mb_ptr_adv(arg); + MB_PTR_ADV(arg); } if (*arg != NUL) { @@ -167,9 +189,9 @@ ex_menu(eap) for (p = arg; *p; ++p) if (!VIM_ISDIGIT(*p) && *p != '.') break; - if (vim_iswhite(*p)) + if (VIM_ISWHITE(*p)) { - for (i = 0; i < MENUDEPTH && !vim_iswhite(*arg); ++i) + for (i = 0; i < MENUDEPTH && !VIM_ISWHITE(*arg); ++i) { pri_tab[i] = getdigits(&arg); if (pri_tab[i] == 0) @@ -193,12 +215,12 @@ ex_menu(eap) /* * Check for "disable" or "enable" argument. */ - if (STRNCMP(arg, "enable", 6) == 0 && vim_iswhite(arg[6])) + if (STRNCMP(arg, "enable", 6) == 0 && VIM_ISWHITE(arg[6])) { enable = TRUE; arg = skipwhite(arg + 6); } - else if (STRNCMP(arg, "disable", 7) == 0 && vim_iswhite(arg[7])) + else if (STRNCMP(arg, "disable", 7) == 0 && VIM_ISWHITE(arg[7])) { enable = FALSE; arg = skipwhite(arg + 7); @@ -275,11 +297,16 @@ ex_menu(eap) #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) \ || defined(FEAT_GUI_MACVIM)) old_menu_height = gui.menu_height; -# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_W16) +# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) old_toolbar_height = gui.toolbar_height; # endif #endif + root_menu_ptr = get_root_menu(menu_path); + if (root_menu_ptr == &curwin->w_winbar) + /* Assume the window toolbar menu will change. */ + redraw_later(NOT_VALID); + if (enable != MAYBE) { /* @@ -298,13 +325,13 @@ ex_menu(eap) p = popup_mode_name(menu_path, i); if (p != NULL) { - menu_nable_recurse(root_menu, p, MENU_ALL_MODES, + menu_nable_recurse(*root_menu_ptr, p, MENU_ALL_MODES, enable); vim_free(p); } } } - menu_nable_recurse(root_menu, menu_path, modes, enable); + menu_nable_recurse(*root_menu_ptr, menu_path, modes, enable); } else if (unmenu) { @@ -325,14 +352,14 @@ ex_menu(eap) p = popup_mode_name(menu_path, i); if (p != NULL) { - remove_menu(&root_menu, p, MENU_ALL_MODES, TRUE); + remove_menu(root_menu_ptr, p, MENU_ALL_MODES, TRUE); vim_free(p); } } } /* Careful: remove_menu() changes menu_path */ - remove_menu(&root_menu, menu_path, modes, FALSE); + remove_menu(root_menu_ptr, menu_path, modes, FALSE); } else { @@ -396,12 +423,25 @@ ex_menu(eap) /* If the menubar height changed, resize the window */ if (gui.in_use && (gui.menu_height != old_menu_height -# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_W16) +# if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) || gui.toolbar_height != old_toolbar_height # endif )) gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); #endif + if (root_menu_ptr == &curwin->w_winbar) + { + int h = winbar_height(curwin); + + if (h != curwin->w_winbar_height) + { + if (h == 0) + ++curwin->w_height; + else if (curwin->w_height > 0) + --curwin->w_height; + curwin->w_winbar_height = h; + } + } theend: ; @@ -411,19 +451,16 @@ ex_menu(eap) * Add the menu with the given name to the menu hierarchy */ static int -add_menu_path(menu_path, menuarg, pri_tab, call_data -#ifdef FEAT_GUI_W32 - , addtearoff -#endif - ) - char_u *menu_path; - vimmenu_T *menuarg; /* passes modes, iconfile, iconidx, +add_menu_path( + char_u *menu_path, + vimmenu_T *menuarg, /* passes modes, iconfile, iconidx, icon_builtin, silent[0], noremap[0] */ - int *pri_tab; - char_u *call_data; + int *pri_tab, + char_u *call_data #ifdef FEAT_GUI_W32 - int addtearoff; /* may add tearoff item */ + , int addtearoff /* may add tearoff item */ #endif + ) { char_u *path_name; int modes = menuarg->modes; @@ -449,12 +486,14 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data char_u *en_name; char_u *map_to = NULL; #endif + vimmenu_T **root_menu_ptr; /* Make a copy so we can stuff around with it, since it could be const */ path_name = vim_strsave(menu_path); if (path_name == NULL) return FAIL; - menup = &root_menu; + root_menu_ptr = get_root_menu(menu_path); + menup = root_menu_ptr; parent = NULL; name = path_name; while (*name) @@ -665,7 +704,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data STRCPY(tearpath, menu_path); idx = (int)(next_name - path_name - 1); - for (s = tearpath; *s && s < tearpath + idx; mb_ptr_adv(s)) + for (s = tearpath; *s && s < tearpath + idx; MB_PTR_ADV(s)) { if ((*s == '\\' || *s == Ctrl_V) && s[1]) { @@ -685,8 +724,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data menup = &menu->children; parent = menu; name = next_name; - vim_free(dname); - dname = NULL; + VIM_CLEAR(dname); if (pri_tab[pri_idx + 1] != -1) ++pri_idx; } @@ -774,7 +812,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data } #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) \ && !defined(FEAT_GUI_MACVIM) \ - && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) + && (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK)) /* Need to update the menu tip. */ if (modes & MENU_TIP_MODE) gui_mch_menu_set_tip(menu); @@ -791,7 +829,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data while (parent != NULL && parent->children == NULL) { if (parent->parent == NULL) - menup = &root_menu; + menup = root_menu_ptr; else menup = &parent->parent->children; for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next)) @@ -809,11 +847,11 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data * Called recursively. */ static int -menu_nable_recurse(menu, name, modes, enable) - vimmenu_T *menu; - char_u *name; - int modes; - int enable; +menu_nable_recurse( + vimmenu_T *menu, + char_u *name, + int modes, + int enable) { char_u *p; @@ -874,11 +912,11 @@ menu_nable_recurse(menu, name, modes, enable) * Called recursively. */ static int -remove_menu(menup, name, modes, silent) - vimmenu_T **menup; - char_u *name; - int modes; - int silent; /* don't give error messages */ +remove_menu( + vimmenu_T **menup, + char_u *name, + int modes, + int silent) /* don't give error messages */ { vimmenu_T *menu; vimmenu_T *child; @@ -970,7 +1008,7 @@ remove_menu(menup, name, modes, silent) free_menu_string(menu, MENU_INDEX_TIP); #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) \ && !defined(FEAT_GUI_MACVIM) \ - && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK)) + && (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK)) /* Need to update the menu tip. */ if (gui.in_use) gui_mch_menu_set_tip(menu); @@ -991,12 +1029,21 @@ remove_menu(menup, name, modes, silent) return OK; } +/* + * Remove the WinBar menu from window "wp". + */ + void +remove_winbar(win_T *wp) +{ + remove_menu(&wp->w_winbar, (char_u *)"", MENU_ALL_MODES, TRUE); + vim_free(wp->w_winbar_items); +} + /* * Free the given menu structure and remove it from the linked list. */ static void -free_menu(menup) - vimmenu_T **menup; +free_menu(vimmenu_T **menup) { int i; vimmenu_T *menu; @@ -1043,9 +1090,7 @@ free_menu(menup) * Free the menu->string with the given index. */ static void -free_menu_string(menu, idx) - vimmenu_T *menu; - int idx; +free_menu_string(vimmenu_T *menu, int idx) { int count = 0; int i; @@ -1062,19 +1107,17 @@ free_menu_string(menu, idx) * Show the mapping associated with a menu item or hierarchy in a sub-menu. */ static int -show_menus(path_name, modes) - char_u *path_name; - int modes; +show_menus(char_u *path_name, int modes) { char_u *p; char_u *name; vimmenu_T *menu; vimmenu_T *parent = NULL; - menu = root_menu; name = path_name = vim_strsave(path_name); if (path_name == NULL) return FAIL; + menu = *get_root_menu(path_name); /* First, find the (sub)menu with the given name */ while (*name) @@ -1125,10 +1168,7 @@ show_menus(path_name, modes) * Recursively show the mappings associated with the menus under the given one */ static void -show_menus_recursive(menu, modes, depth) - vimmenu_T *menu; - int modes; - int depth; +show_menus_recursive(vimmenu_T *menu, int modes, int depth) { int i; int bit; @@ -1149,7 +1189,7 @@ show_menus_recursive(menu, modes, depth) MSG_PUTS(" "); } /* Same highlighting as for directories!? */ - msg_outtrans_attr(menu->name, hl_attr(HLF_D)); + msg_outtrans_attr(menu->name, HL_ATTR(HLF_D)); } if (menu != NULL && menu->children == NULL) @@ -1179,7 +1219,7 @@ show_menus_recursive(menu, modes, depth) msg_putchar(' '); MSG_PUTS(" "); if (*menu->strings[bit] == NUL) - msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8)); + msg_puts_attr((char_u *)"<Nop>", HL_ATTR(HLF_8)); else msg_outtrans_special(menu->strings[bit], FALSE); } @@ -1207,6 +1247,7 @@ show_menus_recursive(menu, modes, depth) * Used when expanding menu names. */ static vimmenu_T *expand_menu = NULL; +static vimmenu_T *expand_menu_alt = NULL; static int expand_modes = 0x0; static int expand_emenu; /* TRUE for ":emenu" command */ @@ -1214,11 +1255,11 @@ static int expand_emenu; /* TRUE for ":emenu" command */ * Work out what to complete when doing command line completion of menu names. */ char_u * -set_context_in_menu_cmd(xp, cmd, arg, forceit) - expand_T *xp; - char_u *cmd; - char_u *arg; - int forceit; +set_context_in_menu_cmd( + expand_T *xp, + char_u *cmd, + char_u *arg, + int forceit) { char_u *after_dot; char_u *p; @@ -1236,24 +1277,24 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) if (!VIM_ISDIGIT(*p) && *p != '.') break; - if (!vim_iswhite(*p)) + if (!VIM_ISWHITE(*p)) { if (STRNCMP(arg, "enable", 6) == 0 - && (arg[6] == NUL || vim_iswhite(arg[6]))) + && (arg[6] == NUL || VIM_ISWHITE(arg[6]))) p = arg + 6; else if (STRNCMP(arg, "disable", 7) == 0 - && (arg[7] == NUL || vim_iswhite(arg[7]))) + && (arg[7] == NUL || VIM_ISWHITE(arg[7]))) p = arg + 7; else p = arg; } - while (*p != NUL && vim_iswhite(*p)) + while (*p != NUL && VIM_ISWHITE(*p)) ++p; arg = after_dot = p; - for (; *p && !vim_iswhite(*p); ++p) + for (; *p && !VIM_ISWHITE(*p); ++p) { if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) p++; @@ -1264,10 +1305,12 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) /* ":tearoff" and ":popup" only use menus, not entries */ expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); expand_emenu = (*cmd == 'e'); - if (expand_menus && vim_iswhite(*p)) + if (expand_menus && VIM_ISWHITE(*p)) return NULL; /* TODO: check for next command? */ if (*p == NUL) /* Complete the menu name */ { + int try_alt_menu = TRUE; + /* * With :unmenu, you only want to match menus for the appropriate mode. * With :menu though you might want to add a menu with the same name as @@ -1307,6 +1350,11 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) break; } menu = menu->next; + if (menu == NULL && try_alt_menu) + { + menu = curwin->w_winbar; + try_alt_menu = FALSE; + } } if (menu == NULL) { @@ -1316,12 +1364,17 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) } name = p; menu = menu->children; + try_alt_menu = FALSE; } vim_free(path_name); xp->xp_context = expand_menus ? EXPAND_MENUNAMES : EXPAND_MENUS; xp->xp_pattern = after_dot; expand_menu = menu; + if (expand_menu == root_menu) + expand_menu_alt = curwin->w_winbar; + else + expand_menu_alt = NULL; } else /* We're in the mapping part */ xp->xp_context = EXPAND_NOTHING; @@ -1333,11 +1386,10 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) * entries). */ char_u * -get_menu_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_menu_name(expand_T *xp UNUSED, int idx) { static vimmenu_T *menu = NULL; + static int did_alt_menu = FALSE; char_u *str; #ifdef FEAT_MULTI_LANG static int should_advance = FALSE; @@ -1346,6 +1398,7 @@ get_menu_name(xp, idx) if (idx == 0) /* first call: start at first item */ { menu = expand_menu; + did_alt_menu = FALSE; #ifdef FEAT_MULTI_LANG should_advance = FALSE; #endif @@ -1356,7 +1409,14 @@ get_menu_name(xp, idx) || menu_is_separator(menu->dname) || menu_is_tearoff(menu->dname) || menu->children == NULL)) + { menu = menu->next; + if (menu == NULL && !did_alt_menu) + { + menu = expand_menu_alt; + did_alt_menu = TRUE; + } + } if (menu == NULL) /* at end of linked list */ return NULL; @@ -1380,8 +1440,15 @@ get_menu_name(xp, idx) #ifdef FEAT_MULTI_LANG if (should_advance) #endif + { /* Advance to next menu entry. */ menu = menu->next; + if (menu == NULL && !did_alt_menu) + { + menu = expand_menu_alt; + did_alt_menu = TRUE; + } + } #ifdef FEAT_MULTI_LANG should_advance = !should_advance; @@ -1395,11 +1462,10 @@ get_menu_name(xp, idx) * entries. */ char_u * -get_menu_names(xp, idx) - expand_T *xp UNUSED; - int idx; +get_menu_names(expand_T *xp UNUSED, int idx) { static vimmenu_T *menu = NULL; + static int did_alt_menu = FALSE; #define TBUFFER_LEN 256 static char_u tbuffer[TBUFFER_LEN]; /*hack*/ char_u *str; @@ -1410,6 +1476,7 @@ get_menu_names(xp, idx) if (idx == 0) /* first call: start at first item */ { menu = expand_menu; + did_alt_menu = FALSE; #ifdef FEAT_MULTI_LANG should_advance = FALSE; #endif @@ -1424,7 +1491,14 @@ get_menu_names(xp, idx) || menu->dname[STRLEN(menu->dname) - 1] == '.' #endif )) + { menu = menu->next; + if (menu == NULL && !did_alt_menu) + { + menu = expand_menu_alt; + did_alt_menu = TRUE; + } + } if (menu == NULL) /* at end of linked list */ return NULL; @@ -1472,8 +1546,15 @@ get_menu_names(xp, idx) #ifdef FEAT_MULTI_LANG if (should_advance) #endif + { /* Advance to next menu entry. */ menu = menu->next; + if (menu == NULL && !did_alt_menu) + { + menu = expand_menu_alt; + did_alt_menu = TRUE; + } + } #ifdef FEAT_MULTI_LANG should_advance = !should_advance; @@ -1489,12 +1570,11 @@ get_menu_names(xp, idx) * "name" may be modified. */ char_u * -menu_name_skip(name) - char_u *name; +menu_name_skip(char_u *name) { char_u *p; - for (p = name; *p && *p != '.'; mb_ptr_adv(p)) + for (p = name; *p && *p != '.'; MB_PTR_ADV(p)) { if (*p == '\\' || *p == Ctrl_V) { @@ -1513,9 +1593,7 @@ menu_name_skip(name) * two ways: raw menu name and menu name without '&'. ignore part after a TAB. */ static int -menu_name_equal(name, menu) - char_u *name; - vimmenu_T *menu; +menu_name_equal(char_u *name, vimmenu_T *menu) { #ifdef FEAT_MULTI_LANG if (menu->en_name != NULL @@ -1527,9 +1605,7 @@ menu_name_equal(name, menu) } static int -menu_namecmp(name, mname) - char_u *name; - char_u *mname; +menu_namecmp(char_u *name, char_u *mname) { int i; @@ -1549,11 +1625,11 @@ menu_namecmp(name, mname) * whether the command is an "unmenu" command. */ static int -get_menu_cmd_modes(cmd, forceit, noremap, unmenu) - char_u *cmd; - int forceit; /* Was there a "!" after the command? */ - int *noremap; - int *unmenu; +get_menu_cmd_modes( + char_u *cmd, + int forceit, /* Was there a "!" after the command? */ + int *noremap, + int *unmenu) { int modes; @@ -1613,9 +1689,7 @@ get_menu_cmd_modes(cmd, forceit, noremap, unmenu) * Returns the name in allocated memory (NULL for failure). */ static char_u * -popup_mode_name(name, idx) - char_u *name; - int idx; +popup_mode_name(char_u *name, int idx) { char_u *p; int len = (int)STRLEN(name); @@ -1636,9 +1710,7 @@ popup_mode_name(name, idx) * given menu in the current mode. */ int -get_menu_index(menu, state) - vimmenu_T *menu; - int state; +get_menu_index(vimmenu_T *menu, int state) { int idx; @@ -1676,10 +1748,7 @@ get_menu_index(menu, state) * If actext != NULL, *actext is set to the text after the first TAB. */ static char_u * -menu_text(str, mnemonic, actext) - char_u *str; - int *mnemonic; - char_u **actext; +menu_text(char_u *str, int *mnemonic, char_u **actext) { char_u *p; char_u *text; @@ -1730,11 +1799,11 @@ menu_text(str, mnemonic, actext) * Return TRUE if "name" can be a menu in the MenuBar. */ int -menu_is_menubar(name) - char_u *name; +menu_is_menubar(char_u *name) { return (!menu_is_popup(name) && !menu_is_toolbar(name) + && !menu_is_winbar(name) && *name != MNU_HIDDEN_CHAR); } @@ -1742,8 +1811,7 @@ menu_is_menubar(name) * Return TRUE if "name" is a popup menu name. */ int -menu_is_popup(name) - char_u *name; +menu_is_popup(char_u *name) { return (STRNCMP(name, "PopUp", 5) == 0); } @@ -1753,8 +1821,7 @@ menu_is_popup(name) * Return TRUE if "name" is part of a popup menu. */ int -menu_is_child_of_popup(menu) - vimmenu_T *menu; +menu_is_child_of_popup(vimmenu_T *menu) { while (menu->parent != NULL) menu = menu->parent; @@ -1766,8 +1833,7 @@ menu_is_child_of_popup(menu) * Return TRUE if "name" is a toolbar menu name. */ int -menu_is_toolbar(name) - char_u *name; +menu_is_toolbar(char_u *name) { return (STRNCMP(name, "ToolBar", 7) == 0); } @@ -1777,8 +1843,7 @@ menu_is_toolbar(name) * with '-' */ int -menu_is_separator(name) - char_u *name; +menu_is_separator(char_u *name) { return (name[0] == '-' && name[STRLEN(name) - 1] == '-'); } @@ -1787,8 +1852,7 @@ menu_is_separator(name) * Return TRUE if the menu is hidden: Starts with ']' */ static int -menu_is_hidden(name) - char_u *name; +menu_is_hidden(char_u *name) { return (name[0] == ']') || (menu_is_popup(name) && name[5] != NUL); } @@ -1799,8 +1863,7 @@ menu_is_hidden(name) * Return TRUE if the menu is the tearoff menu. */ static int -menu_is_tearoff(name) - char_u *name UNUSED; +menu_is_tearoff(char_u *name UNUSED) { #ifdef FEAT_GUI return (STRCMP(name, TEAR_STRING) == 0); @@ -1810,10 +1873,10 @@ menu_is_tearoff(name) } #endif -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) static int -get_menu_mode() +get_menu_mode(void) { if (VIsual_active) { @@ -1834,6 +1897,68 @@ get_menu_mode() return MENU_INDEX_INVALID; } + int +get_menu_mode_flag(void) +{ + int mode = get_menu_mode(); + + if (mode == MENU_INDEX_INVALID) + return 0; + return 1 << mode; +} + +/* + * Display the Special "PopUp" menu as a pop-up at the current mouse + * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, + * etc. + */ + void +show_popupmenu(void) +{ + vimmenu_T *menu; + int mode; + + mode = get_menu_mode(); + if (mode == MENU_INDEX_INVALID) + return; + mode = menu_mode_chars[mode]; + + { + char_u ename[2]; + + ename[0] = mode; + ename[1] = NUL; + apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf); + } + + for (menu = root_menu; menu != NULL; menu = menu->next) + if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) + break; + + /* Only show a popup when it is defined and has entries */ + if (menu != NULL && menu->children != NULL) + { +# if defined(FEAT_GUI) + if (gui.in_use) + { + /* Update the menus now, in case the MenuPopup autocommand did + * anything. */ + gui_update_menus(0); + gui_mch_show_popupmenu(menu); + } +# endif +# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) + else +# endif +# if defined(FEAT_TERM_POPUP_MENU) + pum_show_popupmenu(menu); +# endif + } +} +#endif + +#if defined(FEAT_GUI) || defined(PROTO) + /* * Check that a pointer appears in the menu tree. Used to protect from using * a menu that was deleted after it was selected but before the event was @@ -1841,9 +1966,7 @@ get_menu_mode() * Return OK or FAIL. Used recursively. */ int -check_menu_pointer(root, menu_to_check) - vimmenu_T *root; - vimmenu_T *menu_to_check; +check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check) { vimmenu_T *p; @@ -1860,11 +1983,10 @@ check_menu_pointer(root, menu_to_check) * defined. This is done once here. add_menu_path() may have already been * called to define these menus, and may be called again. This function calls * itself recursively. Should be called at the top level with: - * gui_create_initial_menus(root_menu, NULL); + * gui_create_initial_menus(root_menu); */ void -gui_create_initial_menus(menu) - vimmenu_T *menu; +gui_create_initial_menus(vimmenu_T *menu) { int idx = 0; @@ -1890,37 +2012,35 @@ gui_create_initial_menus(menu) * Used recursively by gui_update_menus (see below) */ static void -gui_update_menus_recurse(menu, mode) - vimmenu_T *menu; - int mode; +gui_update_menus_recurse(vimmenu_T *menu, int mode) { int grey; while (menu) { if ((menu->modes & menu->enabled & mode) -#if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) +# if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) || menu_is_tearoff(menu->dname) -#endif +# endif ) grey = FALSE; else grey = TRUE; -#ifdef FEAT_GUI_ATHENA +# ifdef FEAT_GUI_ATHENA /* Hiding menus doesn't work for Athena, it can cause a crash. */ gui_mch_menu_grey(menu, grey); -#else +# else /* Never hide a toplevel menu, it may make the menubar resize or * disappear. Same problem for ToolBar items. */ if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR || menu_is_toolbar(menu->parent->name) -# endif +# endif ) gui_mch_menu_grey(menu, grey); else gui_mch_menu_hidden(menu, grey); -#endif +# endif gui_update_menus_recurse(menu->children, mode); menu = menu->next; } @@ -1932,8 +2052,7 @@ gui_update_menus_recurse(menu, mode) * since last time. If "modes" is not 0, then we use these modes instead. */ void -gui_update_menus(modes) - int modes; +gui_update_menus(int modes) { static int prev_mode = -1; int mode = 0; @@ -1941,13 +2060,7 @@ gui_update_menus(modes) if (modes != 0x0) mode = modes; else - { - mode = get_menu_mode(); - if (mode == MENU_INDEX_INVALID) - mode = 0; - else - mode = (1 << mode); - } + mode = get_menu_mode_flag(); if (force_menu_update || mode != prev_mode) { @@ -1955,23 +2068,22 @@ gui_update_menus(modes) gui_mch_draw_menubar(); prev_mode = mode; force_menu_update = FALSE; -#ifdef FEAT_GUI_W32 +# ifdef FEAT_GUI_W32 /* This can leave a tearoff as active window - make sure we * have the focus <negri>*/ gui_mch_activate_window(); -#endif +# endif } } -#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ +# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(PROTO) /* * Check if a key is used as a mnemonic for a toplevel menu. * Case of the key is ignored. */ int -gui_is_menu_shortcut(key) - int key; +gui_is_menu_shortcut(int key) { vimmenu_T *menu; @@ -1983,42 +2095,7 @@ gui_is_menu_shortcut(key) return TRUE; return FALSE; } -#endif - -/* - * Display the Special "PopUp" menu as a pop-up at the current mouse - * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, - * etc. - */ - void -gui_show_popupmenu() -{ - vimmenu_T *menu; - int mode; - - mode = get_menu_mode(); - if (mode == MENU_INDEX_INVALID) - return; - mode = menu_mode_chars[mode]; - -#ifdef FEAT_AUTOCMD - { - char_u ename[2]; - - ename[0] = mode; - ename[1] = NUL; - apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf); - } -#endif - - for (menu = root_menu; menu != NULL; menu = menu->next) - if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) - break; - - /* Only show a popup when it is defined and has entries */ - if (menu != NULL && menu->children != NULL) - gui_mch_show_popupmenu(menu); -} +# endif #endif /* FEAT_GUI */ #if (defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF)) || defined(PROTO) @@ -2050,11 +2127,11 @@ gui_mch_toggle_tearoffs(int enable) * Recursively add tearoff items */ static void -gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx) - vimmenu_T *menu; - const char_u *pname; - int *pri_tab; - int pri_idx; +gui_create_tearoffs_recurse( + vimmenu_T *menu, + const char_u *pname, + int *pri_tab, + int pri_idx) { char_u *newpname = NULL; int len; @@ -2108,10 +2185,7 @@ gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx) * "tearpath" is the menu path, and must have room to add TEAR_STRING. */ static void -gui_add_tearoff(tearpath, pri_tab, pri_idx) - char_u *tearpath; - int *pri_tab; - int pri_idx; +gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx) { char_u *tbuf; int t; @@ -2157,8 +2231,7 @@ gui_add_tearoff(tearpath, pri_tab, pri_idx) * Recursively destroy tearoff items */ static void -gui_destroy_tearoffs_recurse(menu) - vimmenu_T *menu; +gui_destroy_tearoffs_recurse(vimmenu_T *menu) { while (menu) { @@ -2180,66 +2253,19 @@ gui_destroy_tearoffs_recurse(menu) #endif /* FEAT_GUI_W32 && FEAT_TEAROFF */ /* - * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and - * execute it. + * Execute "menu". Use by ":emenu" and the window toolbar. + * "eap" is NULL for the window toolbar. */ void -ex_emenu(eap) - exarg_T *eap; +execute_menu(exarg_T *eap, vimmenu_T *menu) { - vimmenu_T *menu; - char_u *name; - char_u *saved_name; - char_u *p; - int idx; char_u *mode; + int idx = -1; #ifdef FEAT_GUI_MACVIM char_u *old_arg; #endif - saved_name = vim_strsave(eap->arg); - if (saved_name == NULL) - return; - - menu = root_menu; - name = saved_name; - while (*name) - { - /* Find in the menu hierarchy */ - p = menu_name_skip(name); - - while (menu != NULL) - { - if (menu_name_equal(name, menu)) - { - if (*p == NUL && menu->children != NULL) - { - EMSG(_("E333: Menu path must lead to a menu item")); - menu = NULL; - } - else if (*p != NUL && menu->children == NULL) - { - EMSG(_(e_notsubmenu)); - menu = NULL; - } - break; - } - menu = menu->next; - } - if (menu == NULL || *p == NUL) - break; - menu = menu->children; - name = p; - } - vim_free(saved_name); - if (menu == NULL) - { - EMSG2(_("E334: Menu not found: %s"), eap->arg); - return; - } - - /* Found the menu, so execute. - * Use the Insert mode entry when returning to Insert mode. */ + /* Use the Insert mode entry when returning to Insert mode. */ if (restart_edit #ifdef FEAT_EVAL && !current_SID @@ -2249,7 +2275,12 @@ ex_emenu(eap) mode = (char_u *)"Insert"; idx = MENU_INDEX_INSERT; } - else if (eap->addr_count) + else if (VIsual_active) + { + mode = (char_u *)"Visual"; + idx = MENU_INDEX_VISUAL; + } + else if (eap != NULL && eap->addr_count) { pos_T tpos; @@ -2296,7 +2327,9 @@ ex_emenu(eap) if (*p_sel == 'e' && gchar_cursor() != NUL) ++curwin->w_cursor.col; } - else + + /* For the WinBar menu always use the Normal mode menu. */ + if (idx == -1 || eap == NULL) { mode = (char_u *)"Normal"; idx = MENU_INDEX_NORMAL; @@ -2307,49 +2340,170 @@ ex_emenu(eap) { /* When executing a script or function execute the commands right now. + * Also for the window toolbar. * Otherwise put them in the typeahead buffer. */ + if (eap == NULL #ifdef FEAT_EVAL - if (current_SID != 0) - exec_normal_cmd(menu->strings[idx], menu->noremap[idx], + || current_SID != 0 +#endif + ) + { + save_state_T save_state; + + ++ex_normal_busy; + if (save_current_state(&save_state)) + exec_normal_cmd(menu->strings[idx], menu->noremap[idx], menu->silent[idx]); + restore_current_state(&save_state); + --ex_normal_busy; + } else -#endif ins_typebuf(menu->strings[idx], menu->noremap[idx], 0, TRUE, menu->silent[idx]); } + else if (eap != NULL) + { #ifdef FEAT_GUI_MACVIM - else if (menu->mac_action != NULL && menu->strings[idx][0] == NUL) + if (menu->mac_action != NULL && menu->strings[idx][0] == NUL) + { + /* This allows us to bind a menu to an action without mapping to + * anything so that pressing the menu's key equivalent and typing + * ":emenu ..." does the same thing. (HACK: We count on the fact + * that ex_macaction() only looks at eap->arg.) */ + old_arg = eap->arg; + eap->arg = menu->mac_action; + ex_macaction(eap); + eap->arg = old_arg; + } + else +#endif /* FEAT_GUI_MACVIM */ + EMSG2(_("E335: Menu not defined for %s mode"), mode); + } +} + +/* + * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and + * execute it. + */ + void +ex_emenu(exarg_T *eap) +{ + vimmenu_T *menu; + char_u *name; + char_u *saved_name; + char_u *p; + + saved_name = vim_strsave(eap->arg); + if (saved_name == NULL) + return; + + menu = *get_root_menu(saved_name); + name = saved_name; + while (*name) { - /* This allows us to bind a menu to an action without mapping to - * anything so that pressing the menu's key equivalent and typing - * ":emenu ..." does the same thing. (HACK: We count on the fact that - * ex_macaction() only looks at eap->arg.) */ - old_arg = eap->arg; - eap->arg = menu->mac_action; - ex_macaction(eap); - eap->arg = old_arg; + /* Find in the menu hierarchy */ + p = menu_name_skip(name); + + while (menu != NULL) + { + if (menu_name_equal(name, menu)) + { + if (*p == NUL && menu->children != NULL) + { + EMSG(_("E333: Menu path must lead to a menu item")); + menu = NULL; + } + else if (*p != NUL && menu->children == NULL) + { + EMSG(_(e_notsubmenu)); + menu = NULL; + } + break; + } + menu = menu->next; + } + if (menu == NULL || *p == NUL) + break; + menu = menu->children; + name = p; } -#endif /* FEAT_GUI_MACVIM */ - else - EMSG2(_("E335: Menu not defined for %s mode"), mode); + vim_free(saved_name); + if (menu == NULL) + { + EMSG2(_("E334: Menu not found: %s"), eap->arg); + return; + } + + /* Found the menu, so execute. */ + execute_menu(eap, menu); } -#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MACVIM)\ - || (defined(FEAT_GUI_GTK) && defined(FEAT_MENU)) \ +/* + * Handle a click in the window toolbar of "wp" at column "col". + */ + void +winbar_click(win_T *wp, int col) +{ + int idx; + + if (wp->w_winbar_items == NULL) + return; + for (idx = 0; wp->w_winbar_items[idx].wb_menu != NULL; ++idx) + { + winbar_item_T *item = &wp->w_winbar_items[idx]; + + if (col >= item->wb_startcol && col <= item->wb_endcol) + { + win_T *save_curwin = NULL; + pos_T save_visual = VIsual; + int save_visual_active = VIsual_active; + int save_visual_select = VIsual_select; + int save_visual_reselect = VIsual_reselect; + int save_visual_mode = VIsual_mode; + + if (wp != curwin) + { + /* Clicking in the window toolbar of a not-current window. + * Make that window the current one and save Visual mode. */ + save_curwin = curwin; + VIsual_active = FALSE; + curwin = wp; + curbuf = curwin->w_buffer; + check_cursor(); + } + + execute_menu(NULL, item->wb_menu); + + if (save_curwin != NULL) + { + curwin = save_curwin; + curbuf = curwin->w_buffer; + VIsual = save_visual; + VIsual_active = save_visual_active; + VIsual_select = save_visual_select; + VIsual_reselect = save_visual_reselect; + VIsual_mode = save_visual_mode; + } + } + } +} + +#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_TERM_POPUP_MENU) \ + || defined(FEAT_GUI_MACVIM) \ || defined(FEAT_BEVAL_TIP) || defined(PROTO) /* * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. */ vimmenu_T * -gui_find_menu(path_name) - char_u *path_name; +gui_find_menu(char_u *path_name) { vimmenu_T *menu = NULL; char_u *name; char_u *saved_name; char_u *p; - menu = root_menu; + menu = *get_root_menu(path_name); saved_name = vim_strsave(path_name); if (saved_name == NULL) @@ -2418,8 +2572,7 @@ static garray_T menutrans_ga = {0, 0, 0, 0, NULL}; * case the commands are ignored. */ void -ex_menutranslate(eap) - exarg_T *eap UNUSED; +ex_menutranslate(exarg_T *eap UNUSED) { #ifdef FEAT_MULTI_LANG char_u *arg = eap->arg; @@ -2497,10 +2650,9 @@ ex_menutranslate(eap) * Find the character just after one part of a menu name. */ static char_u * -menu_skip_part(p) - char_u *p; +menu_skip_part(char_u *p) { - while (*p != NUL && *p != '.' && !vim_iswhite(*p)) + while (*p != NUL && *p != '.' && !VIM_ISWHITE(*p)) { if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) ++p; @@ -2516,16 +2668,14 @@ menu_skip_part(p) * Return a pointer to the translation or NULL if not found. */ static char_u * -menutrans_lookup(name, len) - char_u *name; - int len; +menutrans_lookup(char_u *name, int len) { menutrans_T *tp = (menutrans_T *)menutrans_ga.ga_data; int i; char_u *dname; for (i = 0; i < menutrans_ga.ga_len; ++i) - if (STRNCMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL) + if (STRNICMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL) return tp[i].to; /* Now try again while ignoring '&' characters. */ @@ -2536,7 +2686,7 @@ menutrans_lookup(name, len) if (dname != NULL) { for (i = 0; i < menutrans_ga.ga_len; ++i) - if (STRCMP(dname, tp[i].from_noamp) == 0) + if (STRICMP(dname, tp[i].from_noamp) == 0) { vim_free(dname); return tp[i].to; @@ -2551,12 +2701,11 @@ menutrans_lookup(name, len) * Unescape the name in the translate dictionary table. */ static void -menu_unescape_name(name) - char_u *name; +menu_unescape_name(char_u *name) { char_u *p; - for (p = name; *p && *p != '.'; mb_ptr_adv(p)) + for (p = name; *p && *p != '.'; MB_PTR_ADV(p)) if (*p == '\\') STRMOVE(p, p + 1); } @@ -2567,12 +2716,11 @@ menu_unescape_name(name) * Skip the menu name, and translate <Tab> into a real TAB. */ static char_u * -menu_translate_tab_and_shift(arg_start) - char_u *arg_start; +menu_translate_tab_and_shift(char_u *arg_start) { char_u *arg = arg_start; - while (*arg && !vim_iswhite(*arg)) + while (*arg && !VIM_ISWHITE(*arg)) { if ((*arg == '\\' || *arg == Ctrl_V) && arg[1] != NUL) arg++; @@ -2646,6 +2794,27 @@ menu_for_path(char_u *menu_path) return menu; } + void +set_mac_menu_attrs( + vimmenu_T *menu, + char_u *action, + int set_alt, + int mac_alternate, + int set_key, + int mac_key, + int mac_mods) +{ + if (action) + menu->mac_action = action; + if (set_key) + { + menu->mac_key = mac_key; + menu->mac_mods = mac_mods; + } + if (set_alt) + menu->mac_alternate = mac_alternate; +} + /* * Handle the ":macmenu" command. */ @@ -2654,11 +2823,14 @@ ex_macmenu(eap) exarg_T *eap; { vimmenu_T *menu = NULL; + vimmenu_T *popup_menu_for_mode = NULL; char_u *arg; char_u *menu_path; char_u *p; char_u *keys; + int i; int len; + int modes; char_u *linep; char_u *key_start; char_u *key = NULL; @@ -2668,9 +2840,10 @@ ex_macmenu(eap) int mac_key = 0; int mac_mods = 0; int mac_alternate = 0; + int noremap; + int unmenu; char_u *last_dash; int bit; - int set_action = FALSE; int set_key = FALSE; int set_alt = FALSE; @@ -2706,7 +2879,7 @@ ex_macmenu(eap) /* * Isolate the key ("action", "alt", or "key"). */ - while (*linep && !vim_iswhite(*linep) && *linep != '=') + while (*linep && !VIM_ISWHITE(*linep) && *linep != '=') ++linep; vim_free(key); key = vim_strnsave_up(key_start, (int)(linep - key_start)); @@ -2768,7 +2941,6 @@ ex_macmenu(eap) break; } - set_action = TRUE; } else if (STRCMP(key, "ALT") == 0) { @@ -2884,15 +3056,23 @@ ex_macmenu(eap) */ if (!error) { - if (set_action) - menu->mac_action = action; - if (set_key) + set_mac_menu_attrs(menu, action, set_alt, mac_alternate, set_key, mac_key, mac_mods); + + modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); + if (menu_is_popup(menu_path)) { - menu->mac_key = mac_key; - menu->mac_mods = mac_mods; + for (i = 0; i < MENU_INDEX_TIP; ++i) + if (modes & (1 << i)) + { + p = popup_mode_name(menu_path, i); + if (p != NULL) + { + popup_menu_for_mode = menu_for_path(p); + set_mac_menu_attrs(popup_menu_for_mode, action, set_alt, mac_alternate, set_key, mac_key, mac_mods); + vim_free(p); + } + } } - if (set_alt) - menu->mac_alternate = mac_alternate; } else { diff --git a/src/message.c b/src/message.c index c736624c5b..e5541b6c2e 100644 --- a/src/message.c +++ b/src/message.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -12,39 +12,39 @@ */ #define MESSAGE_FILE /* don't include prototype for smsg() */ +#define USING_FLOAT_STUFF #include "vim.h" -#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) -# include <math.h> -#endif - -static int other_sourcing_name __ARGS((void)); -static char_u *get_emsg_source __ARGS((void)); -static char_u *get_emsg_lnum __ARGS((void)); -static void add_msg_hist __ARGS((char_u *s, int len, int attr)); -static void hit_return_msg __ARGS((void)); -static void msg_home_replace_attr __ARGS((char_u *fname, int attr)); +static int other_sourcing_name(void); +static char_u *get_emsg_source(void); +static char_u *get_emsg_lnum(void); +static void add_msg_hist(char_u *s, int len, int attr); +static void hit_return_msg(void); +static void msg_home_replace_attr(char_u *fname, int attr); #ifdef FEAT_MBYTE -static char_u *screen_puts_mbyte __ARGS((char_u *s, int l, int attr)); +static char_u *screen_puts_mbyte(char_u *s, int l, int attr); #endif -static void msg_puts_attr_len __ARGS((char_u *str, int maxlen, int attr)); -static void msg_puts_display __ARGS((char_u *str, int maxlen, int attr, int recurse)); -static void msg_scroll_up __ARGS((void)); -static void inc_msg_scrolled __ARGS((void)); -static void store_sb_text __ARGS((char_u **sb_str, char_u *s, int attr, int *sb_col, int finish)); -static void t_puts __ARGS((int *t_col, char_u *t_s, char_u *s, int attr)); -static void msg_puts_printf __ARGS((char_u *str, int maxlen)); -static int do_more_prompt __ARGS((int typed_char)); -static void msg_screen_putchar __ARGS((int c, int attr)); -static int msg_check_screen __ARGS((void)); -static void redir_write __ARGS((char_u *s, int maxlen)); +static void msg_puts_attr_len(char_u *str, int maxlen, int attr); +static void msg_puts_display(char_u *str, int maxlen, int attr, int recurse); +static void msg_scroll_up(void); +static void inc_msg_scrolled(void); +static void store_sb_text(char_u **sb_str, char_u *s, int attr, int *sb_col, int finish); +static void t_puts(int *t_col, char_u *t_s, char_u *s, int attr); +static void msg_puts_printf(char_u *str, int maxlen); +static int do_more_prompt(int typed_char); +static void msg_screen_putchar(int c, int attr); +static int msg_check_screen(void); +static void redir_write(char_u *s, int maxlen); #ifdef FEAT_CON_DIALOG -static char_u *msg_show_console_dialog __ARGS((char_u *message, char_u *buttons, int dfltbutton)); +static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfltbutton); static int confirm_msg_used = FALSE; /* displaying confirm_msg */ static char_u *confirm_msg = NULL; /* ":confirm" message */ static char_u *confirm_msg_tail; /* tail of confirm_msg */ #endif +#ifdef FEAT_JOB_CHANNEL +static int emsg_to_channel_log = FALSE; +#endif struct msg_hist { @@ -102,8 +102,7 @@ static int verbose_did_open = FALSE; * return TRUE if wait_return not called */ int -msg(s) - char_u *s; +msg(char_u *s) { return msg_attr_keep(s, 0, FALSE); } @@ -114,8 +113,7 @@ msg(s) * Like msg() but keep it silent when 'verbosefile' is set. */ int -verb_msg(s) - char_u *s; +verb_msg(char_u *s) { int n; @@ -128,23 +126,26 @@ verb_msg(s) #endif int -msg_attr(s, attr) - char_u *s; - int attr; +msg_attr(char_u *s, int attr) { return msg_attr_keep(s, attr, FALSE); } int -msg_attr_keep(s, attr, keep) - char_u *s; - int attr; - int keep; /* TRUE: set keep_msg if it doesn't scroll */ +msg_attr_keep( + char_u *s, + int attr, + int keep) /* TRUE: set keep_msg if it doesn't scroll */ { static int entered = 0; int retval; char_u *buf = NULL; + /* Skip messages not matching ":filter pattern". + * Don't filter when there is an error. */ + if (!emsg_on_display && message_filtered(s)) + return TRUE; + #ifdef FEAT_EVAL if (attr == 0) set_vim_var_string(VV_STATUSMSG, s, -1); @@ -168,6 +169,12 @@ msg_attr_keep(s, attr, keep) && STRCMP(s, last_msg_hist->msg))) add_msg_hist(s, -1, attr); +#ifdef FEAT_JOB_CHANNEL + if (emsg_to_channel_log) + /* Write message in the channel log. */ + ch_log(NULL, "ERROR: %s", (char *)s); +#endif + /* When displaying keep_msg, don't let msg_start() free it, caller must do * that. */ if (s == keep_msg) @@ -197,9 +204,9 @@ msg_attr_keep(s, attr, keep) * Returns an allocated string or NULL when no truncating is done. */ char_u * -msg_strtrunc(s, force) - char_u *s; - int force; /* always truncate */ +msg_strtrunc( + char_u *s, + int force) /* always truncate */ { char_u *buf = NULL; int len; @@ -242,21 +249,22 @@ msg_strtrunc(s, force) * "s" and "buf" may be equal. */ void -trunc_string(s, buf, room, buflen) - char_u *s; - char_u *buf; - int room; - int buflen; +trunc_string( + char_u *s, + char_u *buf, + int room_in, + int buflen) { - int half; - int len; + size_t room = room_in - 3; /* "..." takes 3 chars */ + size_t half; + size_t len = 0; int e; int i; int n; - room -= 3; + if (room_in < 3) + room = 0; half = room / 2; - len = 0; /* First part: Start of the string. */ for (e = 0; len < half && e < buflen; ++e) @@ -268,7 +276,7 @@ trunc_string(s, buf, room, buflen) return; } n = ptr2cells(s + e); - if (len + n >= half) + if (len + n > half) break; len += n; buf[e] = s[e]; @@ -305,13 +313,13 @@ trunc_string(s, buf, room, buflen) for (;;) { do - half = half - (*mb_head_off)(s, s + half - 1) - 1; - while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0); + half = half - utf_head_off(s, s + half - 1) - 1; + while (half > 0 && utf_iscomposing(utf_ptr2char(s + half))); n = ptr2cells(s + half); - if (len + n > room) + if (len + n > room || half == 0) break; len += n; - i = half; + i = (int)half; } } else @@ -321,19 +329,36 @@ trunc_string(s, buf, room, buflen) len += n; } - /* Set the middle and copy the last part. */ - if (e + 3 < buflen) + + if (i <= e + 3) { + /* text fits without truncating */ + if (s != buf) + { + len = STRLEN(s); + if (len >= (size_t)buflen) + len = buflen - 1; + len = len - e + 1; + if (len < 1) + buf[e - 1] = NUL; + else + mch_memmove(buf + e, s + e, len); + } + } + else if (e + 3 < buflen) + { + /* set the middle and copy the last part */ mch_memmove(buf + e, "...", (size_t)3); - len = (int)STRLEN(s + i) + 1; - if (len >= buflen - e - 3) + len = STRLEN(s + i) + 1; + if (len >= (size_t)buflen - e - 3) len = buflen - e - 3 - 1; mch_memmove(buf + e + 3, s + i, len); buf[e + 3 + len - 1] = NUL; } else { - buf[e - 1] = NUL; /* make sure it is truncated */ + /* can't fit in the "...", just truncate it */ + buf[e - 1] = NUL; } } @@ -343,90 +368,37 @@ trunc_string(s, buf, room, buflen) * shorter than IOSIZE!!! */ #ifndef PROTO -# ifndef HAVE_STDARG_H - -int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -smsg __ARGS((char_u *, long, long, long, - long, long, long, long, long, long, long)); -int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -smsg_attr __ARGS((int, char_u *, long, long, long, - long, long, long, long, long, long, long)); - -int vim_snprintf __ARGS((char *, size_t, char *, long, long, long, - long, long, long, long, long, long, long)); - -/* - * smsg(str, arg, ...) is like using sprintf(buf, str, arg, ...) and then - * calling msg(buf). - * The buffer used is IObuff, the message is truncated at IOSIZE. - */ - -/* VARARGS */ - int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -smsg(s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) - char_u *s; - long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; -{ - return smsg_attr(0, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); -} - -/* VARARGS */ - int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -smsg_attr(attr, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) - int attr; - char_u *s; - long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; -{ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); - return msg_attr(IObuff, attr); -} - -# else /* HAVE_STDARG_H */ int vim_snprintf(char *str, size_t str_m, char *fmt, ...); int -#ifdef __BORLANDC__ +# ifdef __BORLANDC__ _RTLENTRYF -#endif +# endif smsg(char_u *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); va_end(arglist); return msg(IObuff); } int -#ifdef __BORLANDC__ +# ifdef __BORLANDC__ _RTLENTRYF -#endif +# endif smsg_attr(int attr, char_u *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); va_end(arglist); return msg_attr(IObuff, attr); } -# endif /* HAVE_STDARG_H */ #endif /* @@ -441,10 +413,9 @@ static char_u *last_sourcing_name = NULL; * for the next error message; */ void -reset_last_sourcing() +reset_last_sourcing(void) { - vim_free(last_sourcing_name); - last_sourcing_name = NULL; + VIM_CLEAR(last_sourcing_name); last_sourcing_lnum = 0; } @@ -452,7 +423,7 @@ reset_last_sourcing() * Return TRUE if "sourcing_name" differs from "last_sourcing_name". */ static int -other_sourcing_name() +other_sourcing_name(void) { if (sourcing_name != NULL) { @@ -469,7 +440,7 @@ other_sourcing_name() * Returns NULL when no message is to be given. */ static char_u * -get_emsg_source() +get_emsg_source(void) { char_u *Buf, *p; @@ -490,7 +461,7 @@ get_emsg_source() * Returns NULL when no message is to be given. */ static char_u * -get_emsg_lnum() +get_emsg_lnum(void) { char_u *Buf, *p; @@ -515,8 +486,7 @@ get_emsg_lnum() * is only displayed if it changed. */ void -msg_source(attr) - int attr; +msg_source(int attr) { char_u *p; @@ -530,7 +500,7 @@ msg_source(attr) p = get_emsg_lnum(); if (p != NULL) { - msg_attr(p, hl_attr(HLF_N)); + msg_attr(p, HL_ATTR(HLF_N)); vim_free(p); last_sourcing_lnum = sourcing_lnum; /* only once for each line */ } @@ -554,7 +524,7 @@ msg_source(attr) * If "emsg_skip" is set: never do error messages. */ int -emsg_not_now() +emsg_not_now(void) { if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL && vim_strchr(p_debug, 't') == NULL) @@ -566,6 +536,46 @@ emsg_not_now() return FALSE; } +#if defined(FEAT_EVAL) || defined(PROTO) +static garray_T ignore_error_list = GA_EMPTY; + + void +ignore_error_for_testing(char_u *error) +{ + if (ignore_error_list.ga_itemsize == 0) + ga_init2(&ignore_error_list, sizeof(char_u *), 1); + + ga_add_string(&ignore_error_list, error); +} + + static int +ignore_error(char_u *msg) +{ + int i; + + for (i = 0; i < ignore_error_list.ga_len; ++i) + if (strstr((char *)msg, + (char *)((char_u **)(ignore_error_list.ga_data))[i]) != NULL) + return TRUE; + return FALSE; +} +#endif + +#if !defined(HAVE_STRERROR) || defined(PROTO) +/* + * Replacement for perror() that behaves more or less like emsg() was called. + * v:errmsg will be set and called_emsg will be set. + */ + void +do_perror(char *msg) +{ + perror(msg); + ++emsg_silent; + emsg((char_u *)msg); + --emsg_silent; +} +#endif + /* * emsg() - display an error message * @@ -575,11 +585,11 @@ emsg_not_now() * return TRUE if wait_return not called */ int -emsg(s) - char_u *s; +emsg(char_u *s) { int attr; char_u *p; + int r; #ifdef FEAT_EVAL int ignore = FALSE; int severe; @@ -589,14 +599,18 @@ emsg(s) if (emsg_not_now()) return TRUE; +#ifdef FEAT_EVAL + /* When testing some errors are turned into a normal message. */ + if (ignore_error(s)) + /* don't call msg() if it results in a dialog */ + return msg_use_printf() ? FALSE : msg(s); +#endif + called_emsg = TRUE; - ex_exitval = 1; - /* - * If "emsg_severe" is TRUE: When an error exception is to be thrown, - * prefer this message over previous messages for the same command. - */ #ifdef FEAT_EVAL + /* If "emsg_severe" is TRUE: When an error exception is to be thrown, + * prefer this message over previous messages for the same command. */ severe = emsg_severe; emsg_severe = FALSE; #endif @@ -628,26 +642,35 @@ emsg(s) */ if (emsg_silent != 0) { - msg_start(); - p = get_emsg_source(); - if (p != NULL) + if (emsg_noredir == 0) { - STRCAT(p, "\n"); - redir_write(p, -1); - vim_free(p); - } - p = get_emsg_lnum(); - if (p != NULL) - { - STRCAT(p, "\n"); - redir_write(p, -1); - vim_free(p); + msg_start(); + p = get_emsg_source(); + if (p != NULL) + { + STRCAT(p, "\n"); + redir_write(p, -1); + vim_free(p); + } + p = get_emsg_lnum(); + if (p != NULL) + { + STRCAT(p, "\n"); + redir_write(p, -1); + vim_free(p); + } + redir_write(s, -1); } - redir_write(s, -1); +#ifdef FEAT_JOB_CHANNEL + ch_log(NULL, "ERROR: %s", (char *)s); +#endif return TRUE; } - /* Reset msg_silent, an error causes messages to be switched back on. */ + ex_exitval = 1; + + /* Reset msg_silent, an error causes messages to be switched back on. + */ msg_silent = 0; cmd_silent = FALSE; @@ -659,17 +682,23 @@ emsg(s) else flush_buffers(FALSE); /* flush internal buffers */ did_emsg = TRUE; /* flag for DoOneCmd() */ +#ifdef FEAT_EVAL + did_uncaught_emsg = TRUE; +#endif } emsg_on_display = TRUE; /* remember there is an error message */ ++msg_scroll; /* don't overwrite a previous message */ - attr = hl_attr(HLF_E); /* set highlight mode for error messages */ + attr = HL_ATTR(HLF_E); /* set highlight mode for error messages */ if (msg_scrolled != 0) need_wait_return = TRUE; /* needed in case emsg() is called after * wait_return has reset need_wait_return * and a redraw is expected because * msg_scrolled is non-zero */ +#ifdef FEAT_JOB_CHANNEL + emsg_to_channel_log = TRUE; +#endif /* * Display name and line number for the source of the error. */ @@ -679,24 +708,106 @@ emsg(s) * Display the error message itself. */ msg_nowait = FALSE; /* wait for this msg */ - return msg_attr(s, attr); + r = msg_attr(s, attr); + +#ifdef FEAT_JOB_CHANNEL + emsg_to_channel_log = FALSE; +#endif + return r; } + /* * Print an error message with one "%s" and one string argument. */ int -emsg2(s, a1) - char_u *s, *a1; +emsg2(char_u *s, char_u *a1) { return emsg3(s, a1, NULL); } +/* + * Print an error message with one or two "%s" and one or two string arguments. + * This is not in message.c to avoid a warning for prototypes. + */ + int +emsg3(char_u *s, char_u *a1, char_u *a2) +{ + if (emsg_not_now()) + return TRUE; /* no error messages at the moment */ + vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); + return emsg(IObuff); +} + +/* + * Print an error message with one "%ld" and one long int argument. + * This is not in message.c to avoid a warning for prototypes. + */ + int +emsgn(char_u *s, long n) +{ + if (emsg_not_now()) + return TRUE; /* no error messages at the moment */ + vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); + return emsg(IObuff); +} + +/* + * Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsg(char_u *s) +{ + emsg(s); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + + +/* + * Same as emsg2(...) but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsg2(char_u *s, char_u *a1) +{ + emsg2(s, a1); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + +/* + * Same as emsgn(...) but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsgn(char_u *s, long n) +{ + emsgn(s, n); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + +/* + * Give an "Internal error" message. + */ + void +internal_error(char *where) +{ + IEMSG2(_(e_intern2), where); +} + /* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */ void -emsg_invreg(name) - int name; +emsg_invreg(int name) { EMSG2(_("E354: Invalid register name: '%s'"), transchar(name)); } @@ -708,10 +819,7 @@ emsg_invreg(name) * Returns a pointer to the printed message, if wait_return() not called. */ char_u * -msg_trunc_attr(s, force, attr) - char_u *s; - int force; - int attr; +msg_trunc_attr(char_u *s, int force, int attr) { int n; @@ -735,9 +843,7 @@ msg_trunc_attr(s, force, attr) * Note: May change the message by replacing a character with '<'. */ char_u * -msg_may_trunc(force, s) - int force; - char_u *s; +msg_may_trunc(int force, char_u *s) { int n; int room; @@ -770,10 +876,10 @@ msg_may_trunc(force, s) } static void -add_msg_hist(s, len, attr) - char_u *s; - int len; /* -1 for undetermined length */ - int attr; +add_msg_hist( + char_u *s, + int len, /* -1 for undetermined length */ + int attr) { struct msg_hist *p; @@ -815,7 +921,7 @@ add_msg_hist(s, len, attr) * Returns FAIL if there are no messages. */ int -delete_first_msg() +delete_first_msg(void) { struct msg_hist *p; @@ -835,21 +941,54 @@ delete_first_msg() * ":messages" command. */ void -ex_messages(eap) - exarg_T *eap UNUSED; +ex_messages(exarg_T *eap) { struct msg_hist *p; char_u *s; + int c = 0; + + if (STRCMP(eap->arg, "clear") == 0) + { + int keep = eap->addr_count == 0 ? 0 : eap->line2; + + while (msg_hist_len > keep) + (void)delete_first_msg(); + return; + } + + if (*eap->arg != NUL) + { + EMSG(_(e_invarg)); + return; + } msg_hist_off = TRUE; - s = mch_getenv((char_u *)"LANG"); - if (s != NULL && *s != NUL) - msg_attr((char_u *) - _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), - hl_attr(HLF_T)); + p = first_msg_hist; + if (eap->addr_count != 0) + { + /* Count total messages */ + for (; p != NULL && !got_int; p = p->next) + c++; + + c -= eap->line2; + + /* Skip without number of messages specified */ + for (p = first_msg_hist; p != NULL && !got_int && c > 0; + p = p->next, c--); + } + + if (p == first_msg_hist) + { + s = mch_getenv((char_u *)"LANG"); + if (s != NULL && *s != NUL) + msg_attr((char_u *) + _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), + HL_ATTR(HLF_T)); + } - for (p = first_msg_hist; p != NULL && !got_int; p = p->next) + /* Display what was not skipped. */ + for (; p != NULL && !got_int; p = p->next) if (p->msg != NULL) msg_attr(p->msg, p->attr); @@ -862,7 +1001,7 @@ ex_messages(eap) * and a delay. */ void -msg_end_prompt() +msg_end_prompt(void) { need_wait_return = FALSE; emsg_on_display = FALSE; @@ -880,14 +1019,13 @@ msg_end_prompt() * if 'redraw' is -1, don't redraw at all */ void -wait_return(redraw) - int redraw; +wait_return(int redraw) { int c; int oldState; int tmpState; int had_got_int; - int save_Recording; + int save_reg_recording; FILE *save_scriptout; if (redraw == TRUE) @@ -941,6 +1079,8 @@ wait_return(redraw) #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ #endif + cmdline_row = msg_row; + /* Avoid the sequence that the user types ":" at the hit-return prompt * to start an Ex command, but the file-changed dialog gets in the * way. */ @@ -963,16 +1103,16 @@ wait_return(redraw) /* Temporarily disable Recording. If Recording is active, the * character will be recorded later, since it will be added to the * typebuf after the loop */ - save_Recording = Recording; + save_reg_recording = reg_recording; save_scriptout = scriptout; - Recording = FALSE; + reg_recording = 0; scriptout = NULL; c = safe_vgetc(); if (had_got_int && !global_busy) got_int = FALSE; --no_mapping; --allow_keys; - Recording = save_Recording; + reg_recording = save_reg_recording; scriptout = save_scriptout; #ifdef FEAT_CLIPBOARD @@ -1038,6 +1178,7 @@ wait_return(redraw) || c == K_RIGHTDRAG || c == K_RIGHTRELEASE || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_MOUSEDOWN || c == K_MOUSEUP + || c == K_MOUSEMOVE || (!mouse_has(MOUSE_RETURN) && mouse_row < msg_row && (c == K_LEFTMOUSE @@ -1111,10 +1252,7 @@ wait_return(redraw) reset_last_sourcing(); if (keep_msg != NULL && vim_strsize(keep_msg) >= (Rows - cmdline_row - 1) * Columns + sc_col) - { - vim_free(keep_msg); - keep_msg = NULL; /* don't redisplay message, it's too long */ - } + VIM_CLEAR(keep_msg); /* don't redisplay message, it's too long */ if (tmpState == SETWSIZE) /* got resize event while in vgetc() */ { @@ -1133,7 +1271,7 @@ wait_return(redraw) * Write the hit-return prompt. */ static void -hit_return_msg() +hit_return_msg(void) { int save_p_more = p_more; @@ -1143,7 +1281,7 @@ hit_return_msg() if (got_int) MSG_PUTS(_("Interrupt: ")); - MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), hl_attr(HLF_R)); + MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), HL_ATTR(HLF_R)); if (!msg_use_printf()) msg_clr_eos(); p_more = save_p_more; @@ -1153,9 +1291,7 @@ hit_return_msg() * Set "keep_msg" to "s". Free the old value and check for NULL pointer. */ void -set_keep_msg(s, attr) - char_u *s; - int attr; +set_keep_msg(char_u *s, int attr) { vim_free(keep_msg); if (s != NULL && msg_silent == 0) @@ -1172,7 +1308,7 @@ set_keep_msg(s, attr) * that it will be displayed again after redraw. */ void -set_keep_msg_from_hist() +set_keep_msg_from_hist(void) { if (keep_msg == NULL && last_msg_hist != NULL && msg_scrolled == 0 && (State & NORMAL)) @@ -1184,15 +1320,12 @@ set_keep_msg_from_hist() * Prepare for outputting characters in the command line. */ void -msg_start() +msg_start(void) { int did_return = FALSE; if (!msg_silent) - { - vim_free(keep_msg); - keep_msg = NULL; /* don't display old message now */ - } + VIM_CLEAR(keep_msg); #ifdef FEAT_EVAL if (need_clr_eos) @@ -1237,23 +1370,20 @@ msg_start() * Note that the current msg position is where messages start. */ void -msg_starthere() +msg_starthere(void) { lines_left = cmdline_row; msg_didany = FALSE; } void -msg_putchar(c) - int c; +msg_putchar(int c) { msg_putchar_attr(c, 0); } void -msg_putchar_attr(c, attr) - int c; - int attr; +msg_putchar_attr(int c, int attr) { #ifdef FEAT_MBYTE char_u buf[MB_MAXBYTES + 1]; @@ -1281,8 +1411,7 @@ msg_putchar_attr(c, attr) } void -msg_outnum(n) - long n; +msg_outnum(long n) { char_u buf[20]; @@ -1291,25 +1420,21 @@ msg_outnum(n) } void -msg_home_replace(fname) - char_u *fname; +msg_home_replace(char_u *fname) { msg_home_replace_attr(fname, 0); } #if defined(FEAT_FIND_ID) || defined(PROTO) void -msg_home_replace_hl(fname) - char_u *fname; +msg_home_replace_hl(char_u *fname) { - msg_home_replace_attr(fname, hl_attr(HLF_D)); + msg_home_replace_attr(fname, HL_ATTR(HLF_D)); } #endif static void -msg_home_replace_attr(fname, attr) - char_u *fname; - int attr; +msg_home_replace_attr(char_u *fname, int attr) { char_u *name; @@ -1326,24 +1451,19 @@ msg_home_replace_attr(fname, attr) * Return the number of characters it takes on the screen. */ int -msg_outtrans(str) - char_u *str; +msg_outtrans(char_u *str) { return msg_outtrans_attr(str, 0); } int -msg_outtrans_attr(str, attr) - char_u *str; - int attr; +msg_outtrans_attr(char_u *str, int attr) { return msg_outtrans_len_attr(str, (int)STRLEN(str), attr); } int -msg_outtrans_len(str, len) - char_u *str; - int len; +msg_outtrans_len(char_u *str, int len) { return msg_outtrans_len_attr(str, len, 0); } @@ -1353,9 +1473,7 @@ msg_outtrans_len(str, len) * Handles multi-byte characters. */ char_u * -msg_outtrans_one(p, attr) - char_u *p; - int attr; +msg_outtrans_one(char_u *p, int attr) { #ifdef FEAT_MBYTE int l; @@ -1371,10 +1489,7 @@ msg_outtrans_one(p, attr) } int -msg_outtrans_len_attr(msgstr, len, attr) - char_u *msgstr; - int len; - int attr; +msg_outtrans_len_attr(char_u *msgstr, int len, int attr) { int retval = 0; char_u *str = msgstr; @@ -1427,7 +1542,7 @@ msg_outtrans_len_attr(msgstr, len, attr) msg_puts_attr_len(plain_start, (int)(str - plain_start), attr); plain_start = str + mb_l; - msg_puts_attr(transchar(c), attr == 0 ? hl_attr(HLF_8) : attr); + msg_puts_attr(transchar(c), attr == 0 ? HL_ATTR(HLF_8) : attr); retval += char2cells(c); } len -= mb_l - 1; @@ -1445,7 +1560,7 @@ msg_outtrans_len_attr(msgstr, len, attr) msg_puts_attr_len(plain_start, (int)(str - plain_start), attr); plain_start = str + 1; - msg_puts_attr(s, attr == 0 ? hl_attr(HLF_8) : attr); + msg_puts_attr(s, attr == 0 ? HL_ATTR(HLF_8) : attr); retval += (int)STRLEN(s); } else @@ -1463,8 +1578,7 @@ msg_outtrans_len_attr(msgstr, len, attr) #if defined(FEAT_QUICKFIX) || defined(PROTO) void -msg_make(arg) - char_u *arg; +msg_make(char_u *arg) { int i; static char_u *str = (char_u *)"eeffoc", *rs = (char_u *)"Plon#dqg#vxjduB"; @@ -1497,9 +1611,9 @@ msg_make(arg) * the character/string -- webb */ int -msg_outtrans_special(strstart, from) - char_u *strstart; - int from; /* TRUE for lhs of a mapping */ +msg_outtrans_special( + char_u *strstart, + int from) /* TRUE for lhs of a mapping */ { char_u *str = strstart; int retval = 0; @@ -1507,7 +1621,7 @@ msg_outtrans_special(strstart, from) int attr; int len; - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); while (*str != NUL) { /* Leading and trailing spaces need to be displayed in <> form. */ @@ -1536,9 +1650,9 @@ msg_outtrans_special(strstart, from) * strings, in an allocated string. */ char_u * -str2special_save(str, is_lhs) - char_u *str; - int is_lhs; /* TRUE for lhs, FALSE for rhs */ +str2special_save( + char_u *str, + int is_lhs) /* TRUE for lhs, FALSE for rhs */ { garray_T ga; char_u *p = str; @@ -1557,9 +1671,9 @@ str2special_save(str, is_lhs) * Advances "sp" to the next code. */ char_u * -str2special(sp, from) - char_u **sp; - int from; /* TRUE for lhs of mapping */ +str2special( + char_u **sp, + int from) /* TRUE for lhs of mapping */ { int c; static char_u buf[7]; @@ -1593,8 +1707,6 @@ str2special(sp, from) { c = TO_SPECIAL(str[1], str[2]); str += 2; - if (c == KS_ZERO) /* display <Nul> as ^@ or <Nul> */ - c = NUL; } if (IS_SPECIAL(c) || modifiers) /* special key */ special = TRUE; @@ -1634,10 +1746,7 @@ str2special(sp, from) * Translate a key sequence into special key names. */ void -str2specialbuf(sp, buf, len) - char_u *sp; - char_u *buf; - int len; +str2specialbuf(char_u *sp, char_u *buf, int len) { char_u *s; @@ -1654,9 +1763,7 @@ str2specialbuf(sp, buf, len) * print line for :print or :list command */ void -msg_prt_line(s, list) - char_u *s; - int list; +msg_prt_line(char_u *s, int list) { int c; int col = 0; @@ -1678,7 +1785,7 @@ msg_prt_line(s, list) if (list && lcs_trail) { trail = s + STRLEN(s); - while (trail > s && vim_iswhite(trail[-1])) + while (trail > s && VIM_ISWHITE(trail[-1])) --trail; } @@ -1701,7 +1808,9 @@ msg_prt_line(s, list) else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) { col += (*mb_ptr2cells)(s); - if (lcs_nbsp != NUL && list && mb_ptr2char(s) == 160) + if (lcs_nbsp != NUL && list + && (mb_ptr2char(s) == 160 + || mb_ptr2char(s) == 0x202f)) { mb_char2bytes(lcs_nbsp, buf); buf[(*mb_ptr2len)(buf)] = NUL; @@ -1733,13 +1842,13 @@ msg_prt_line(s, list) { c = lcs_tab1; c_extra = lcs_tab2; - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); } } else if (c == 160 && list && lcs_nbsp != NUL) { c = lcs_nbsp; - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); } else if (c == NUL && list && lcs_eol != NUL) { @@ -1747,7 +1856,7 @@ msg_prt_line(s, list) c_extra = NUL; n_extra = 1; c = lcs_eol; - attr = hl_attr(HLF_AT); + attr = HL_ATTR(HLF_AT); --s; } else if (c != NUL && (n = byte2cells(c)) > 1) @@ -1758,12 +1867,17 @@ msg_prt_line(s, list) c = *p_extra++; /* Use special coloring to be able to distinguish <hex> from * the same in plain text. */ - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); } else if (c == ' ' && trail != NULL && s > trail) { c = lcs_trail; - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); + } + else if (c == ' ' && list && lcs_space != NUL) + { + c = lcs_space; + attr = HL_ATTR(HLF_8); } } @@ -1782,10 +1896,7 @@ msg_prt_line(s, list) * Return the pointer "s" advanced to the next character. */ static char_u * -screen_puts_mbyte(s, l, attr) - char_u *s; - int l; - int attr; +screen_puts_mbyte(char_u *s, int l, int attr) { int cw; @@ -1798,7 +1909,7 @@ screen_puts_mbyte(s, l, attr) msg_col == Columns - 1)) { /* Doesn't fit, print a highlighted '>' to fill it up. */ - msg_screen_putchar('>', hl_attr(HLF_AT)); + msg_screen_putchar('>', HL_ATTR(HLF_AT)); return s; } @@ -1832,17 +1943,16 @@ screen_puts_mbyte(s, l, attr) * Update msg_row and msg_col for the next message. */ void -msg_puts(s) - char_u *s; +msg_puts(char_u *s) { msg_puts_attr(s, 0); } void -msg_puts_title(s) - char_u *s; +msg_puts_title( + char_u *s) { - msg_puts_attr(s, hl_attr(HLF_T)); + msg_puts_attr(s, HL_ATTR(HLF_T)); } /* @@ -1851,18 +1961,13 @@ msg_puts_title(s) * Does not handle multi-byte characters! */ void -msg_puts_long_attr(longstr, attr) - char_u *longstr; - int attr; +msg_puts_long_attr(char_u *longstr, int attr) { msg_puts_long_len_attr(longstr, (int)STRLEN(longstr), attr); } void -msg_puts_long_len_attr(longstr, len, attr) - char_u *longstr; - int len; - int attr; +msg_puts_long_len_attr(char_u *longstr, int len, int attr) { int slen = len; int room; @@ -1872,7 +1977,7 @@ msg_puts_long_len_attr(longstr, len, attr) { slen = (room - 3) / 2; msg_outtrans_len_attr(longstr, slen, attr); - msg_puts_attr((char_u *)"...", hl_attr(HLF_8)); + msg_puts_attr((char_u *)"...", HL_ATTR(HLF_8)); } msg_outtrans_len_attr(longstr + len - slen, slen, attr); } @@ -1881,9 +1986,7 @@ msg_puts_long_len_attr(longstr, len, attr) * Basic function for writing a message with highlight attributes. */ void -msg_puts_attr(s, attr) - char_u *s; - int attr; +msg_puts_attr(char_u *s, int attr) { msg_puts_attr_len(s, -1, attr); } @@ -1894,10 +1997,7 @@ msg_puts_attr(s, attr) * When "maxlen" is >= 0 the message is not put in the history. */ static void -msg_puts_attr_len(str, maxlen, attr) - char_u *str; - int maxlen; - int attr; +msg_puts_attr_len(char_u *str, int maxlen, int attr) { /* * If redirection is on, also write to the redirection file. @@ -1945,11 +2045,11 @@ msg_puts_attr_len(str, maxlen, attr) * May be called recursively to display scroll-back text. */ static void -msg_puts_display(str, maxlen, attr, recurse) - char_u *str; - int maxlen; - int attr; - int recurse; +msg_puts_display( + char_u *str, + int maxlen, + int attr, + int recurse) { char_u *s = str; char_u *t_s = str; /* string from "t_s" to "s" is still todo */ @@ -2042,8 +2142,6 @@ msg_puts_display(str, maxlen, attr, recurse) inc_msg_scrolled(); need_wait_return = TRUE; /* may need wait_return in main() */ - if (must_redraw < VALID) - must_redraw = VALID; redraw_cmdline = TRUE; if (cmdline_row > 0 && !exmode_active) --cmdline_row; @@ -2116,8 +2214,8 @@ msg_puts_display(str, maxlen, attr, recurse) msg_screen_putchar(' ', attr); while (msg_col & 7); } - else if (*s == BELL) /* beep (from ":sh") */ - vim_beep(); + else if (*s == BELL) /* beep (from ":sh") */ + vim_beep(BO_SH); else { #ifdef FEAT_MBYTE @@ -2185,11 +2283,26 @@ msg_puts_display(str, maxlen, attr, recurse) msg_check(); } +/* + * Return TRUE when ":filter pattern" was used and "msg" does not match + * "pattern". + */ + int +message_filtered(char_u *msg) +{ + int match; + + if (cmdmod.filter_regmatch.regprog == NULL) + return FALSE; + match = vim_regexec(&cmdmod.filter_regmatch, msg, (colnr_T)0); + return cmdmod.filter_force ? match : !match; +} + /* * Scroll the screen up one line for displaying the next message line. */ static void -msg_scroll_up() +msg_scroll_up(void) { #ifdef FEAT_GUI /* Remove the cursor before scrolling, ScreenLines[] is going @@ -2198,7 +2311,9 @@ msg_scroll_up() gui_undraw_cursor(); #endif /* scrolling up always works */ - screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL); + mch_disable_flush(); + screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL); + mch_enable_flush(); if (!can_clear((char_u *)" ")) { @@ -2219,7 +2334,7 @@ msg_scroll_up() * Increment "msg_scrolled". */ static void -inc_msg_scrolled() +inc_msg_scrolled(void) { #ifdef FEAT_EVAL if (*get_vim_var_str(VV_SCROLLSTART) == NUL) @@ -2248,6 +2363,8 @@ inc_msg_scrolled() } #endif ++msg_scrolled; + if (must_redraw < VALID) + must_redraw = VALID; } /* @@ -2267,28 +2384,37 @@ struct msgchunk_S static msgchunk_T *last_msgchunk = NULL; /* last displayed text */ -static msgchunk_T *msg_sb_start __ARGS((msgchunk_T *mps)); -static msgchunk_T *disp_sb_line __ARGS((int row, msgchunk_T *smp)); +static msgchunk_T *msg_sb_start(msgchunk_T *mps); +static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp); + +typedef enum { + SB_CLEAR_NONE = 0, + SB_CLEAR_ALL, + SB_CLEAR_CMDLINE_BUSY, + SB_CLEAR_CMDLINE_DONE +} sb_clear_T; -static int do_clear_sb_text = FALSE; /* clear text on next msg */ +/* When to clear text on next msg. */ +static sb_clear_T do_clear_sb_text = SB_CLEAR_NONE; /* * Store part of a printed message for displaying when scrolling back. */ static void -store_sb_text(sb_str, s, attr, sb_col, finish) - char_u **sb_str; /* start of string */ - char_u *s; /* just after string */ - int attr; - int *sb_col; - int finish; /* line ends */ +store_sb_text( + char_u **sb_str, /* start of string */ + char_u *s, /* just after string */ + int attr, + int *sb_col, + int finish) /* line ends */ { msgchunk_T *mp; - if (do_clear_sb_text) + if (do_clear_sb_text == SB_CLEAR_ALL + || do_clear_sb_text == SB_CLEAR_CMDLINE_DONE) { - clear_sb_text(); - do_clear_sb_text = FALSE; + clear_sb_text(do_clear_sb_text == SB_CLEAR_ALL); + do_clear_sb_text = SB_CLEAR_NONE; } if (s > *sb_str) @@ -2326,25 +2452,55 @@ store_sb_text(sb_str, s, attr, sb_col, finish) * Finished showing messages, clear the scroll-back text on the next message. */ void -may_clear_sb_text() +may_clear_sb_text(void) +{ + do_clear_sb_text = SB_CLEAR_ALL; +} + +/* + * Starting to edit the command line, do not clear messages now. + */ + void +sb_text_start_cmdline(void) { - do_clear_sb_text = TRUE; + do_clear_sb_text = SB_CLEAR_CMDLINE_BUSY; + msg_sb_eol(); +} + +/* + * Ending to edit the command line. Clear old lines but the last one later. + */ + void +sb_text_end_cmdline(void) +{ + do_clear_sb_text = SB_CLEAR_CMDLINE_DONE; } /* * Clear any text remembered for scrolling back. + * When "all" is FALSE keep the last line. * Called when redrawing the screen. */ void -clear_sb_text() +clear_sb_text(int all) { msgchunk_T *mp; + msgchunk_T **lastp; + + if (all) + lastp = &last_msgchunk; + else + { + if (last_msgchunk == NULL) + return; + lastp = &last_msgchunk->sb_prev; + } - while (last_msgchunk != NULL) + while (*lastp != NULL) { - mp = last_msgchunk->sb_prev; - vim_free(last_msgchunk); - last_msgchunk = mp; + mp = (*lastp)->sb_prev; + vim_free(*lastp); + *lastp = mp; } } @@ -2352,7 +2508,7 @@ clear_sb_text() * "g<" command. */ void -show_sb_text() +show_sb_text(void) { msgchunk_T *mp; @@ -2360,7 +2516,7 @@ show_sb_text() * weird, typing a command without output results in one line. */ mp = msg_sb_start(last_msgchunk); if (mp == NULL || mp->sb_prev == NULL) - vim_beep(); + vim_beep(BO_MESS); else { do_more_prompt('G'); @@ -2372,8 +2528,7 @@ show_sb_text() * Move to the start of screen line in already displayed text. */ static msgchunk_T * -msg_sb_start(mps) - msgchunk_T *mps; +msg_sb_start(msgchunk_T *mps) { msgchunk_T *mp = mps; @@ -2386,7 +2541,7 @@ msg_sb_start(mps) * Mark the last message chunk as finishing the line. */ void -msg_sb_eol() +msg_sb_eol(void) { if (last_msgchunk != NULL) last_msgchunk->sb_eol = TRUE; @@ -2397,9 +2552,7 @@ msg_sb_eol() * Returns a pointer to the text for the next line (can be NULL). */ static msgchunk_T * -disp_sb_line(row, smp) - int row; - msgchunk_T *smp; +disp_sb_line(int row, msgchunk_T *smp) { msgchunk_T *mp = smp; char_u *p; @@ -2423,11 +2576,11 @@ disp_sb_line(row, smp) * Output any postponed text for msg_puts_attr_len(). */ static void -t_puts(t_col, t_s, s, attr) - int *t_col; - char_u *t_s; - char_u *s; - int attr; +t_puts( + int *t_col, + char_u *t_s, + char_u *s, + int attr) { /* output postponed text */ msg_didout = TRUE; /* remember that line is not empty */ @@ -2456,7 +2609,7 @@ t_puts(t_col, t_s, s, attr) * cursor is. */ int -msg_use_printf() +msg_use_printf(void) { return (!msg_check_screen() #if defined(WIN3264) && !defined(FEAT_GUI_MSWIN) @@ -2470,28 +2623,45 @@ msg_use_printf() * Print a message when there is no valid screen. */ static void -msg_puts_printf(str, maxlen) - char_u *str; - int maxlen; +msg_puts_printf(char_u *str, int maxlen) { char_u *s = str; char_u buf[4]; char_u *p; - #ifdef WIN3264 +# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + char_u *ccp = NULL; + +# endif if (!(silent_mode && p_verbose == 0)) mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */ + +# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + if (enc_codepage >= 0 && (int)GetConsoleCP() != enc_codepage) + { + int inlen = (int)STRLEN(str); + int outlen; + WCHAR *widestr = (WCHAR *)enc_to_utf16(str, &inlen); + + if (widestr != NULL) + { + WideCharToMultiByte_alloc(GetConsoleCP(), 0, widestr, inlen, + (LPSTR *)&ccp, &outlen, 0, 0); + vim_free(widestr); + s = str = ccp; + } + } +# endif #endif - while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) + while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { if (!(silent_mode && p_verbose == 0)) { /* NL --> CR NL translation (for Unix, not for "--version") */ - /* NL --> CR translation (for Mac) */ p = &buf[0]; if (*s == '\n' && !info_message) *p++ = '\r'; -#if defined(USE_CR) && !defined(MACOS_X_UNIX) +#if defined(USE_CR) else #endif *p++ = *s; @@ -2524,6 +2694,9 @@ msg_puts_printf(str, maxlen) msg_didout = TRUE; /* assume that line is not empty */ #ifdef WIN3264 +# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + vim_free(ccp); +# endif if (!(silent_mode && p_verbose == 0)) mch_settmode(TMODE_RAW); #endif @@ -2537,9 +2710,9 @@ msg_puts_printf(str, maxlen) * Returns TRUE when jumping ahead to "confirm_msg_tail". */ static int -do_more_prompt(typed_char) - int typed_char; +do_more_prompt(int typed_char) { + static int entered = FALSE; int used_typed_char = typed_char; int oldState = State; int c; @@ -2551,6 +2724,13 @@ do_more_prompt(typed_char) msgchunk_T *mp; int i; + /* We get called recursively when a timer callback outputs a message. In + * that case don't show another prompt. Also when at the hit-Enter prompt + * and nothing was typed. */ + if (entered || (State == HITRETURN && typed_char == 0)) + return FALSE; + entered = TRUE; + if (typed_char == 'G') { /* "g<": Find first line on the last page. */ @@ -2655,7 +2835,7 @@ do_more_prompt(typed_char) skip_redraw = TRUE; /* skip redraw once */ need_wait_return = FALSE; /* don't wait in main() */ } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'q': /* quit */ case Ctrl_C: case ESC: @@ -2724,7 +2904,7 @@ do_more_prompt(typed_char) } if (toscroll == -1 && screen_ins_lines(0, 0, 1, - (int)Rows, NULL) == OK) + (int)Rows, 0, NULL) == OK) { /* display line at top */ (void)disp_sb_line(0, mp); @@ -2789,6 +2969,7 @@ do_more_prompt(typed_char) msg_col = Columns - 1; #endif + entered = FALSE; #ifdef FEAT_CON_DIALOG return retval; #else @@ -2811,8 +2992,7 @@ do_more_prompt(typed_char) * started and they can be displayed in a message box. */ void -mch_errmsg(str) - char *str; +mch_errmsg(char *str) { int len; @@ -2822,7 +3002,7 @@ mch_errmsg(str) * On Mac, when started from Finder, stderr is the console. */ if ( # ifdef UNIX -# ifdef MACOS_X_UNIX +# ifdef MACOS_X (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0) # else isatty(2) @@ -2880,8 +3060,7 @@ mch_errmsg(str) * can be displayed in a message box. */ void -mch_msg(str) - char *str; +mch_msg(char *str) { #if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) /* On Unix use stdout if we have a tty. This allows "vim -h | more" and @@ -2890,7 +3069,7 @@ mch_msg(str) * On Mac, when started from Finder, stderr is the console. */ if ( # ifdef UNIX -# ifdef MACOS_X_UNIX +# ifdef MACOS_X (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0) # else isatty(2) @@ -2917,9 +3096,7 @@ mch_msg(str) * to the next position. Only for printable ASCII! */ static void -msg_screen_putchar(c, attr) - int c; - int attr; +msg_screen_putchar(int c, int attr) { msg_didout = TRUE; /* remember that line is not empty */ screen_putchar(c, msg_row, msg_col, attr); @@ -2944,13 +3121,12 @@ msg_screen_putchar(c, attr) } void -msg_moremsg(full) - int full; +msg_moremsg(int full) { int attr; char_u *s = (char_u *)_("-- More --"); - attr = hl_attr(HLF_M); + attr = HL_ATTR(HLF_M); screen_puts(s, (int)Rows - 1, 0, attr); if (full) screen_puts((char_u *) @@ -2963,7 +3139,7 @@ msg_moremsg(full) * exmode_active. */ void -repeat_message() +repeat_message(void) { if (State == ASKMORE) { @@ -3004,7 +3180,7 @@ repeat_message() * output goes to the terminal. Don't use the terminal codes then. */ static int -msg_check_screen() +msg_check_screen(void) { if (!full_screen || !screen_valid(FALSE)) return FALSE; @@ -3021,7 +3197,7 @@ msg_check_screen() * Skip this when ":silent" was used, no need to clear for redirection. */ void -msg_clr_eos() +msg_clr_eos(void) { if (msg_silent == 0) msg_clr_eos_force(); @@ -3033,7 +3209,7 @@ msg_clr_eos() * for msg_check(). */ void -msg_clr_eos_force() +msg_clr_eos_force(void) { if (msg_use_printf()) { @@ -3067,7 +3243,7 @@ msg_clr_eos_force() * Clear the command line. */ void -msg_clr_cmdline() +msg_clr_cmdline(void) { msg_row = cmdline_row; msg_col = 0; @@ -3080,7 +3256,7 @@ msg_clr_cmdline() * return TRUE if wait_return not called. */ int -msg_end() +msg_end(void) { /* * If the string is larger than the window, @@ -3102,7 +3278,7 @@ msg_end() * wait for hit-return and redraw the window later. */ void -msg_check() +msg_check(void) { if (msg_row == Rows - 1 && msg_col >= sc_col) { @@ -3116,9 +3292,7 @@ msg_check() * When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes. */ static void -redir_write(str, maxlen) - char_u *str; - int maxlen; +redir_write(char_u *str, int maxlen) { char_u *s = str; static int cur_col = 0; @@ -3139,7 +3313,9 @@ redir_write(str, maxlen) while (cur_col < msg_col) { #ifdef FEAT_EVAL - if (redir_reg) + if (redir_execute) + execute_redir_str((char_u *)" ", -1); + else if (redir_reg) write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE); else if (redir_vname) var_redir_str((char_u *)" ", -1); @@ -3154,9 +3330,11 @@ redir_write(str, maxlen) } #ifdef FEAT_EVAL - if (redir_reg) + if (redir_execute) + execute_redir_str(s, maxlen); + else if (redir_reg) write_reg_contents(redir_reg, s, maxlen, TRUE); - if (redir_vname) + else if (redir_vname) var_redir_str(s, maxlen); #endif @@ -3164,7 +3342,7 @@ redir_write(str, maxlen) while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) { #ifdef FEAT_EVAL - if (!redir_reg && !redir_vname) + if (!redir_reg && !redir_vname && !redir_execute) #endif if (redir_fd != NULL) putc(*s, redir_fd); @@ -3185,11 +3363,11 @@ redir_write(str, maxlen) } int -redirecting() +redirecting(void) { return redir_fd != NULL || *p_vfile != NUL #ifdef FEAT_EVAL - || redir_reg || redir_vname + || redir_reg || redir_vname || redir_execute #endif ; } @@ -3199,7 +3377,7 @@ redirecting() * Must always be called paired with verbose_leave()! */ void -verbose_enter() +verbose_enter(void) { if (*p_vfile != NUL) ++msg_silent; @@ -3210,7 +3388,7 @@ verbose_enter() * Must always be called paired with verbose_enter()! */ void -verbose_leave() +verbose_leave(void) { if (*p_vfile != NUL) if (--msg_silent < 0) @@ -3221,7 +3399,7 @@ verbose_leave() * Like verbose_enter() and set msg_scroll when displaying the message. */ void -verbose_enter_scroll() +verbose_enter_scroll(void) { if (*p_vfile != NUL) ++msg_silent; @@ -3234,7 +3412,7 @@ verbose_enter_scroll() * Like verbose_leave() and set cmdline_row when displaying the message. */ void -verbose_leave_scroll() +verbose_leave_scroll(void) { if (*p_vfile != NUL) { @@ -3249,7 +3427,7 @@ verbose_leave_scroll() * Called when 'verbosefile' is set: stop writing to the file. */ void -verbose_stop() +verbose_stop(void) { if (verbose_fd != NULL) { @@ -3264,7 +3442,7 @@ verbose_stop() * Return FAIL or OK. */ int -verbose_open() +verbose_open(void) { if (verbose_fd == NULL && !verbose_did_open) { @@ -3286,9 +3464,7 @@ verbose_open() * Use 'w' highlighting and may repeat the message after redrawing */ void -give_warning(message, hl) - char_u *message; - int hl; +give_warning(char_u *message, int hl) { /* Don't do this for ":silent". */ if (msg_silent != 0) @@ -3300,10 +3476,9 @@ give_warning(message, hl) #ifdef FEAT_EVAL set_vim_var_string(VV_WARNINGMSG, message, -1); #endif - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); if (hl) - keep_msg_attr = hl_attr(HLF_W); + keep_msg_attr = HL_ATTR(HLF_W); else keep_msg_attr = 0; if (msg_attr(message, keep_msg_attr) && msg_scrolled == 0) @@ -3315,12 +3490,18 @@ give_warning(message, hl) --no_wait_return; } + void +give_warning2(char_u *message, char_u *a1, int hl) +{ + vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1); + give_warning(IObuff, hl); +} + /* * Advance msg cursor to column "col". */ void -msg_advance(col) - int col; +msg_advance(int col) { if (msg_silent != 0) /* nothing to advance to */ { @@ -3359,15 +3540,15 @@ msg_advance(col) * different letter. */ int -do_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd) - int type UNUSED; - char_u *title UNUSED; - char_u *message; - char_u *buttons; - int dfltbutton; - char_u *textfield UNUSED; /* IObuff for inputdialog(), NULL +do_dialog( + int type UNUSED, + char_u *title UNUSED, + char_u *message, + char_u *buttons, + int dfltbutton, + char_u *textfield UNUSED, /* IObuff for inputdialog(), NULL otherwise */ - int ex_cmd; /* when TRUE pressing : accepts default and starts + int ex_cmd) /* when TRUE pressing : accepts default and starts Ex command */ { int oldState; @@ -3480,17 +3661,17 @@ do_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd) return retval; } -static int copy_char __ARGS((char_u *from, char_u *to, int lowercase)); +static int copy_char(char_u *from, char_u *to, int lowercase); /* * Copy one character from "*from" to "*to", taking care of multi-byte * characters. Return the length of the character in bytes. */ static int -copy_char(from, to, lowercase) - char_u *from; - char_u *to; - int lowercase; /* make character lower case */ +copy_char( + char_u *from, + char_u *to, + int lowercase) /* make character lower case */ { #ifdef FEAT_MBYTE int len; @@ -3531,10 +3712,10 @@ copy_char(from, to, lowercase) * Returns an allocated string with hotkeys, or NULL for error. */ static char_u * -msg_show_console_dialog(message, buttons, dfltbutton) - char_u *message; - char_u *buttons; - int dfltbutton; +msg_show_console_dialog( + char_u *message, + char_u *buttons, + int dfltbutton) { int len = 0; #ifdef FEAT_MBYTE @@ -3630,7 +3811,7 @@ msg_show_console_dialog(message, buttons, dfltbutton) } /* advance to the next character */ - mb_ptr_adv(r); + MB_PTR_ADV(r); } if (copy) @@ -3691,12 +3872,12 @@ msg_show_console_dialog(message, buttons, dfltbutton) * Display the ":confirm" message. Also called when screen resized. */ void -display_confirm_msg() +display_confirm_msg(void) { /* avoid that 'q' at the more prompt truncates the message here */ ++confirm_msg_used; if (confirm_msg != NULL) - msg_puts_attr(confirm_msg, hl_attr(HLF_M)); + msg_puts_attr(confirm_msg, HL_ATTR(HLF_M)); --confirm_msg_used; } @@ -3705,11 +3886,11 @@ display_confirm_msg() #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) int -vim_dialog_yesno(type, title, message, dflt) - int type; - char_u *title; - char_u *message; - int dflt; +vim_dialog_yesno( + int type, + char_u *title, + char_u *message, + int dflt) { if (do_dialog(type, title == NULL ? (char_u *)_("Question") : title, @@ -3720,11 +3901,11 @@ vim_dialog_yesno(type, title, message, dflt) } int -vim_dialog_yesnocancel(type, title, message, dflt) - int type; - char_u *title; - char_u *message; - int dflt; +vim_dialog_yesnocancel( + int type, + char_u *title, + char_u *message, + int dflt) { switch (do_dialog(type, title == NULL ? (char_u *)_("Question") : title, @@ -3738,11 +3919,11 @@ vim_dialog_yesnocancel(type, title, message, dflt) } int -vim_dialog_yesnoallcancel(type, title, message, dflt) - int type; - char_u *title; - char_u *message; - int dflt; +vim_dialog_yesnoallcancel( + int type, + char_u *title, + char_u *message, + int dflt) { switch (do_dialog(type, title == NULL ? (char_u *)"Question" : title, @@ -3766,15 +3947,15 @@ vim_dialog_yesnoallcancel(type, title, message, dflt) * Later this may pop-up a non-GUI file selector (external command?). */ char_u * -do_browse(flags, title, dflt, ext, initdir, filter, buf) - int flags; /* BROWSE_SAVE and BROWSE_DIR */ - char_u *title; /* title for the window */ - char_u *dflt; /* default file name (may include directory) */ - char_u *ext; /* extension added */ - char_u *initdir; /* initial directory, NULL for current dir or +do_browse( + int flags, /* BROWSE_SAVE and BROWSE_DIR */ + char_u *title, /* title for the window */ + char_u *dflt, /* default file name (may include directory) */ + char_u *ext, /* extension added */ + char_u *initdir, /* initial directory, NULL for current dir or when using path from "dflt" */ - char_u *filter; /* file name filter */ - buf_T *buf; /* buffer to read/write for */ + char_u *filter, /* file name filter */ + buf_T *buf) /* buffer to read/write for */ { char_u *fname; static char_u *last_dir = NULL; /* last used directory */ @@ -3880,7 +4061,7 @@ do_browse(flags, title, dflt, ext, initdir, filter, buf) } else fname = gui_mch_browse(flags & BROWSE_SAVE, - title, dflt, ext, initdir, filter); + title, dflt, ext, initdir, (char_u *)_(filter)); /* We hang around in the dialog for a while, the user might do some * things to our files. The Win32 dialog allows deleting or renaming @@ -3922,25 +4103,23 @@ do_browse(flags, title, dflt, ext, initdir, filter, buf) } #endif -#if defined(HAVE_STDARG_H) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) static char *e_printf = N_("E766: Insufficient arguments for printf()"); -static long tv_nr __ARGS((typval_T *tvs, int *idxp)); -static char *tv_str __ARGS((typval_T *tvs, int *idxp)); +static varnumber_T tv_nr(typval_T *tvs, int *idxp); +static char *tv_str(typval_T *tvs, int *idxp, char_u **tofree); # ifdef FEAT_FLOAT -static double tv_float __ARGS((typval_T *tvs, int *idxp)); +static double tv_float(typval_T *tvs, int *idxp); # endif /* * Get number argument from "idxp" entry in "tvs". First entry is 1. */ - static long -tv_nr(tvs, idxp) - typval_T *tvs; - int *idxp; + static varnumber_T +tv_nr(typval_T *tvs, int *idxp) { int idx = *idxp - 1; - long n = 0; + varnumber_T n = 0; int err = FALSE; if (tvs[idx].v_type == VAR_UNKNOWN) @@ -3957,22 +4136,28 @@ tv_nr(tvs, idxp) /* * Get string argument from "idxp" entry in "tvs". First entry is 1. + * If "tofree" is NULL get_tv_string_chk() is used. Some types (e.g. List) + * are not converted to a string. + * If "tofree" is not NULL echo_string() is used. All types are converted to + * a string with the same format as ":echo". The caller must free "*tofree". * Returns NULL for an error. */ static char * -tv_str(tvs, idxp) - typval_T *tvs; - int *idxp; +tv_str(typval_T *tvs, int *idxp, char_u **tofree) { - int idx = *idxp - 1; - char *s = NULL; + int idx = *idxp - 1; + char *s = NULL; + static char_u numbuf[NUMBUFLEN]; if (tvs[idx].v_type == VAR_UNKNOWN) EMSG(_(e_printf)); else { ++*idxp; - s = (char *)get_tv_string_chk(&tvs[idx]); + if (tofree != NULL) + s = (char *)echo_string(&tvs[idx], tofree, numbuf, get_copyID()); + else + s = (char *)get_tv_string_chk(&tvs[idx]); } return s; } @@ -3982,9 +4167,7 @@ tv_str(tvs, idxp) * Get float argument from "idxp" entry in "tvs". First entry is 1. */ static double -tv_float(tvs, idxp) - typval_T *tvs; - int *idxp; +tv_float(typval_T *tvs, int *idxp) { int idx = *idxp - 1; double f = 0; @@ -3997,7 +4180,7 @@ tv_float(tvs, idxp) if (tvs[idx].v_type == VAR_FLOAT) f = tvs[idx].vval.v_float; else if (tvs[idx].v_type == VAR_NUMBER) - f = tvs[idx].vval.v_number; + f = (double)tvs[idx].vval.v_number; else EMSG(_("E807: Expected Float argument for printf()")); } @@ -4006,6 +4189,30 @@ tv_float(tvs, idxp) # endif #endif +#ifdef FEAT_FLOAT +/* + * Return the representation of infinity for printf() function: + * "-inf", "inf", "+inf", " inf", "-INF", "INF", "+INF" or " INF". + */ + static const char * +infinity_str(int positive, + char fmt_spec, + int force_sign, + int space_for_positive) +{ + static const char *table[] = + { + "-inf", "inf", "+inf", " inf", + "-INF", "INF", "+INF", " INF" + }; + int idx = positive * (1 + force_sign + force_sign * space_for_positive); + + if (ASCII_ISUPPER(fmt_spec)) + idx += 4; + return table[idx]; +} +#endif + /* * This code was included to provide a portable vsnprintf() and snprintf(). * Some systems may provide their own, but we always use this one for @@ -4022,10 +4229,10 @@ tv_float(tvs, idxp) * with flags: '-', '+', ' ', '0' and '#'. * An asterisk is supported for field width as well as precision. * - * Limited support for floating point was added: 'f', 'e', 'E', 'g', 'G'. + * Limited support for floating point was added: 'f', 'F', 'e', 'E', 'g', 'G'. * - * Length modifiers 'h' (short int) and 'l' (long int) are supported. - * 'll' (long long int) is not supported. + * Length modifiers 'h' (short int) and 'l' (long int) and 'll' (long long int) + * are supported. * * The locale is not used, the string is used as a byte string. This is only * relevant for double-byte encodings where the second byte may be '%'. @@ -4034,17 +4241,17 @@ tv_float(tvs, idxp) * pointer for resulting string argument if "str_m" is zero (as per ISO C99). * * The return value is the number of characters which would be generated - * for the given input, excluding the trailing null. If this value + * for the given input, excluding the trailing NUL. If this value * is greater or equal to "str_m", not all characters from the result * have been stored in str, output bytes beyond the ("str_m"-1) -th character * are discarded. If "str_m" is greater than zero it is guaranteed - * the resulting string will be null-terminated. + * the resulting string will be NUL-terminated. */ /* * When va_list is not supported we only define vim_snprintf(). * - * vim_vsnprintf() can be invoked with either "va_list" or a list of + * vim_vsnprintf_typval() can be invoked with either "va_list" or a list of * "typval_T". When the latter is not used it must be NULL. */ @@ -4052,7 +4259,6 @@ tv_float(tvs, idxp) * understand this. */ #ifndef PROTO -# ifdef HAVE_STDARG_H /* Like vim_vsnprintf() but append to the string. */ int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) @@ -4067,32 +4273,11 @@ vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) else space = str_m - len; va_start(ap, fmt); - str_l = vim_vsnprintf(str + len, space, fmt, ap, NULL); + str_l = vim_vsnprintf(str + len, space, fmt, ap); va_end(ap); return str_l; } -# else -/* Like vim_vsnprintf() but append to the string. */ - int -vim_snprintf_add(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) - char *str; - size_t str_m; - char *fmt; - long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; -{ - size_t len = STRLEN(str); - size_t space; - - if (str_m <= len) - space = 0; - else - space = str_m - len; - return vim_vsnprintf(str + len, space, fmt, - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); -} -# endif -# ifdef HAVE_STDARG_H int vim_snprintf(char *str, size_t str_m, char *fmt, ...) { @@ -4100,33 +4285,28 @@ vim_snprintf(char *str, size_t str_m, char *fmt, ...) int str_l; va_start(ap, fmt); - str_l = vim_vsnprintf(str, str_m, fmt, ap, NULL); + str_l = vim_vsnprintf(str, str_m, fmt, ap); va_end(ap); return str_l; } int -vim_vsnprintf(str, str_m, fmt, ap, tvs) -# else - /* clumsy way to work around missing va_list */ -# define get_a_arg(i) (++i, i == 2 ? a1 : i == 3 ? a2 : i == 4 ? a3 : i == 5 ? a4 : i == 6 ? a5 : i == 7 ? a6 : i == 8 ? a7 : i == 9 ? a8 : i == 10 ? a9 : a10) +vim_vsnprintf( + char *str, + size_t str_m, + char *fmt, + va_list ap) +{ + return vim_vsnprintf_typval(str, str_m, fmt, ap, NULL); +} -/* VARARGS */ int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -# endif - char *str; - size_t str_m; - char *fmt; -# ifdef HAVE_STDARG_H - va_list ap; - typval_T *tvs; -# else - long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; -# endif +vim_vsnprintf_typval( + char *str, + size_t str_m, + char *fmt, + va_list ap, + typval_T *tvs) { size_t str_l = 0; char *p = fmt; @@ -4165,13 +4345,15 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) char length_modifier = '\0'; /* temporary buffer for simple numeric->string conversion */ -#ifdef FEAT_FLOAT -# define TMP_LEN 350 /* On my system 1e308 is the biggest number possible. +# if defined(FEAT_FLOAT) +# define TMP_LEN 350 /* On my system 1e308 is the biggest number possible. * That sounds reasonable to use as the maximum * printable. */ -#else -# define TMP_LEN 32 -#endif +# elif defined(FEAT_NUM64) +# define TMP_LEN 66 +# else +# define TMP_LEN 34 +# endif char tmp[TMP_LEN]; /* string address in case of string argument */ @@ -4195,6 +4377,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) /* current conversion specifier character */ char fmt_spec = '\0'; + /* buffer for 's' and 'S' specs */ + char_u *tofree = NULL; + + str_arg = NULL; p++; /* skip '%' */ @@ -4226,14 +4412,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) p++; j = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); -#endif if (j >= 0) min_field_width = j; else @@ -4263,14 +4445,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) int j; j = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); -#endif p++; if (j >= 0) precision = j; @@ -4300,7 +4478,11 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) if (length_modifier == 'l' && *p == 'l') { /* double l = long long */ +# ifdef FEAT_NUM64 + length_modifier = 'L'; +# else length_modifier = 'l'; /* treat it as a single 'l' */ +# endif p++; } } @@ -4313,10 +4495,18 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case 'D': fmt_spec = 'd'; length_modifier = 'l'; break; case 'U': fmt_spec = 'u'; length_modifier = 'l'; break; case 'O': fmt_spec = 'o'; length_modifier = 'l'; break; - case 'F': fmt_spec = 'f'; break; default: break; } +# if defined(FEAT_EVAL) && defined(FEAT_NUM64) + switch (fmt_spec) + { + case 'd': case 'u': case 'o': case 'x': case 'X': + if (tvs != NULL && length_modifier == '\0') + length_modifier = 'L'; + } +# endif + /* get parameter value, do initial processing */ switch (fmt_spec) { @@ -4339,14 +4529,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) int j; j = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); -#endif /* standard demands unsigned char */ uchar_arg = (unsigned char)j; str_arg = (char *)&uchar_arg; @@ -4356,14 +4542,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case 's': case 'S': str_arg = -#ifndef HAVE_STDARG_H - (char *)get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) - tvs != NULL ? tv_str(tvs, &arg_idx) : + tvs != NULL ? tv_str(tvs, &arg_idx, &tofree) : # endif va_arg(ap, char *); -#endif if (str_arg == NULL) { str_arg = "[NULL]"; @@ -4380,18 +4562,18 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { /* Don't put the #if inside memchr(), it can be a * macro. */ -#if VIM_SIZEOF_INT <= 2 +# if VIM_SIZEOF_INT <= 2 char *q = memchr(str_arg, '\0', precision); -#else +# else /* memchr on HP does not like n > 2^31 !!! */ char *q = memchr(str_arg, '\0', precision <= (size_t)0x7fffffffL ? precision : (size_t)0x7fffffffL); -#endif +# endif str_arg_l = (q == NULL) ? precision : (size_t)(q - str_arg); } -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (fmt_spec == 'S') { if (min_field_width != 0) @@ -4408,7 +4590,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) str_arg_l = precision = p1 - (char_u *)str_arg; } } -#endif +# endif break; default: @@ -4416,9 +4598,13 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) } break; - case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': + case 'd': case 'u': + case 'b': case 'B': + case 'o': + case 'x': case 'X': + case 'p': { - /* NOTE: the u, o, x, X and p conversion specifiers + /* NOTE: the u, b, o, x, X and p conversion specifiers * imply the value is unsigned; d implies a signed * value */ @@ -4437,6 +4623,15 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) long int long_arg = 0; unsigned long int ulong_arg = 0; +# ifdef FEAT_NUM64 + /* only defined for length modifier ll */ + varnumber_T llong_arg = 0; + uvarnumber_T ullong_arg = 0; +# endif + + /* only defined for b conversion */ + uvarnumber_T bin_arg = 0; + /* pointer argument value -only defined for p * conversion */ void *ptr_arg = NULL; @@ -4445,17 +4640,25 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { length_modifier = '\0'; ptr_arg = -#ifndef HAVE_STDARG_H - (void *)get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) - tvs != NULL ? (void *)tv_str(tvs, &arg_idx) : + tvs != NULL ? (void *)tv_str(tvs, &arg_idx, + NULL) : # endif va_arg(ap, void *); -#endif if (ptr_arg != NULL) arg_sign = 1; } + else if (fmt_spec == 'b' || fmt_spec == 'B') + { + bin_arg = +# if defined(FEAT_EVAL) + tvs != NULL ? + (uvarnumber_T)tv_nr(tvs, &arg_idx) : +# endif + va_arg(ap, uvarnumber_T); + if (bin_arg != 0) + arg_sign = 1; + } else if (fmt_spec == 'd') { /* signed */ @@ -4465,14 +4668,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case 'h': /* char and short arguments are passed as int. */ int_arg = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); -#endif if (int_arg > 0) arg_sign = 1; else if (int_arg < 0) @@ -4480,19 +4679,28 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) break; case 'l': long_arg = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, long int); -#endif if (long_arg > 0) arg_sign = 1; else if (long_arg < 0) arg_sign = -1; break; +# ifdef FEAT_NUM64 + case 'L': + llong_arg = +# if defined(FEAT_EVAL) + tvs != NULL ? tv_nr(tvs, &arg_idx) : +# endif + va_arg(ap, varnumber_T); + if (llong_arg > 0) + arg_sign = 1; + else if (llong_arg < 0) + arg_sign = -1; + break; +# endif } } else @@ -4503,32 +4711,36 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case '\0': case 'h': uint_arg = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? (unsigned) tv_nr(tvs, &arg_idx) : # endif va_arg(ap, unsigned int); -#endif if (uint_arg != 0) arg_sign = 1; break; case 'l': ulong_arg = -#ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -#else # if defined(FEAT_EVAL) tvs != NULL ? (unsigned long) tv_nr(tvs, &arg_idx) : # endif va_arg(ap, unsigned long int); -#endif if (ulong_arg != 0) arg_sign = 1; break; +# ifdef FEAT_NUM64 + case 'L': + ullong_arg = +# if defined(FEAT_EVAL) + tvs != NULL ? (uvarnumber_T) + tv_nr(tvs, &arg_idx) : +# endif + va_arg(ap, uvarnumber_T); + if (ullong_arg != 0) + arg_sign = 1; + break; +# endif } } @@ -4553,7 +4765,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) else if (alternate_form) { if (arg_sign != 0 - && (fmt_spec == 'x' || fmt_spec == 'X') ) + && (fmt_spec == 'b' || fmt_spec == 'B' + || fmt_spec == 'x' || fmt_spec == 'X') ) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; @@ -4569,21 +4782,31 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { /* When zero value is formatted with an explicit * precision 0, the resulting formatted string is - * empty (d, i, u, o, x, X, p). */ + * empty (d, i, u, b, B, o, x, X, p). */ } else { - char f[5]; + char f[6]; int f_l = 0; /* construct a simple format string for sprintf */ f[f_l++] = '%'; if (!length_modifier) ; - else if (length_modifier == '2') + else if (length_modifier == 'L') { +# ifdef FEAT_NUM64 +# ifdef WIN3264 + f[f_l++] = 'I'; + f[f_l++] = '6'; + f[f_l++] = '4'; +# else f[f_l++] = 'l'; f[f_l++] = 'l'; +# endif +# else + f[f_l++] = 'l'; +# endif } else f[f_l++] = length_modifier; @@ -4592,6 +4815,22 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) if (fmt_spec == 'p') str_arg_l += sprintf(tmp + str_arg_l, f, ptr_arg); + else if (fmt_spec == 'b' || fmt_spec == 'B') + { + char b[8 * sizeof(uvarnumber_T)]; + size_t b_l = 0; + uvarnumber_T bn = bin_arg; + + do + { + b[sizeof(b) - ++b_l] = '0' + (bn & 0x1); + bn >>= 1; + } + while (bn != 0); + + memcpy(tmp + str_arg_l, b + sizeof(b) - b_l, b_l); + str_arg_l += b_l; + } else if (fmt_spec == 'd') { /* signed */ @@ -4604,6 +4843,11 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case 'l': str_arg_l += sprintf( tmp + str_arg_l, f, long_arg); break; +# ifdef FEAT_NUM64 + case 'L': str_arg_l += sprintf( + tmp + str_arg_l, f, llong_arg); + break; +# endif } } else @@ -4618,6 +4862,11 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) case 'l': str_arg_l += sprintf( tmp + str_arg_l, f, ulong_arg); break; +# ifdef FEAT_NUM64 + case 'L': str_arg_l += sprintf( + tmp + str_arg_l, f, ullong_arg); + break; +# endif } } @@ -4672,8 +4921,9 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) break; } -#ifdef FEAT_FLOAT +# ifdef FEAT_FLOAT case 'f': + case 'F': case 'e': case 'E': case 'g': @@ -4687,14 +4937,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) int remove_trailing_zeroes = FALSE; f = -# ifndef HAVE_STDARG_H - get_a_arg(arg_idx); -# else # if defined(FEAT_EVAL) tvs != NULL ? tv_float(tvs, &arg_idx) : # endif va_arg(ap, double); -# endif abs_f = f < 0 ? -f : f; if (fmt_spec == 'g' || fmt_spec == 'G') @@ -4703,43 +4949,68 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) * "1.0" as "1", we don't want that. */ if ((abs_f >= 0.001 && abs_f < 10000000.0) || abs_f == 0.0) - fmt_spec = 'f'; + fmt_spec = ASCII_ISUPPER(fmt_spec) ? 'F' : 'f'; else fmt_spec = fmt_spec == 'g' ? 'e' : 'E'; remove_trailing_zeroes = TRUE; } - if (fmt_spec == 'f' && -#ifdef VAX + if ((fmt_spec == 'f' || fmt_spec == 'F') && +# ifdef VAX abs_f > 1.0e38 -#else +# else abs_f > 1.0e307 -#endif +# endif ) { /* Avoid a buffer overflow */ - strcpy(tmp, "inf"); - str_arg_l = 3; + STRCPY(tmp, infinity_str(f > 0.0, fmt_spec, + force_sign, space_for_positive)); + str_arg_l = STRLEN(tmp); + zero_padding = 0; } else { - format[0] = '%'; - l = 1; - if (precision_specified) + if (isnan(f)) { - size_t max_prec = TMP_LEN - 10; - - /* Make sure we don't get more digits than we - * have room for. */ - if (fmt_spec == 'f' && abs_f > 1.0) - max_prec -= (size_t)log10(abs_f); - if (precision > max_prec) - precision = max_prec; - l += sprintf(format + 1, ".%d", (int)precision); + /* Not a number: nan or NAN */ + STRCPY(tmp, ASCII_ISUPPER(fmt_spec) ? "NAN" + : "nan"); + str_arg_l = 3; + zero_padding = 0; + } + else if (isinf(f)) + { + STRCPY(tmp, infinity_str(f > 0.0, fmt_spec, + force_sign, space_for_positive)); + str_arg_l = STRLEN(tmp); + zero_padding = 0; + } + else + { + /* Regular float number */ + format[0] = '%'; + l = 1; + if (force_sign) + format[l++] = space_for_positive ? ' ' : '+'; + if (precision_specified) + { + size_t max_prec = TMP_LEN - 10; + + /* Make sure we don't get more digits than we + * have room for. */ + if ((fmt_spec == 'f' || fmt_spec == 'F') + && abs_f > 1.0) + max_prec -= (size_t)log10(abs_f); + if (precision > max_prec) + precision = max_prec; + l += sprintf(format + l, ".%d", (int)precision); + } + format[l] = fmt_spec == 'F' ? 'f' : fmt_spec; + format[l + 1] = NUL; + + str_arg_l = sprintf(tmp, format, f); } - format[l] = fmt_spec; - format[l + 1] = NUL; - str_arg_l = sprintf(tmp, format, f); if (remove_trailing_zeroes) { @@ -4747,7 +5018,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) char *tp; /* Using %g or %G: remove superfluous zeroes. */ - if (fmt_spec == 'f') + if (fmt_spec == 'f' || fmt_spec == 'F') tp = tmp + str_arg_l - 1; else { @@ -4804,10 +5075,17 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) } } } + if (zero_padding && min_field_width > str_arg_l + && (tmp[0] == '-' || force_sign)) + { + /* padding 0's should be inserted after the sign */ + number_of_zeros_to_pad = min_field_width - str_arg_l; + zero_padding_insertion_ind = 1; + } str_arg = tmp; break; } -#endif +# endif default: /* unrecognized conversion specifier, keep format string @@ -4886,7 +5164,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { if (str_l < str_m) { - size_t avail = str_m-str_l; + size_t avail = str_m - str_l; vim_memset(str + str_l, '0', (size_t)zn > avail ? avail @@ -4935,6 +5213,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) str_l += pn; } } + vim_free(tofree); } } @@ -4946,10 +5225,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0'; } -#ifdef HAVE_STDARG_H if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) EMSG(_("E767: Too many arguments to printf()")); -#endif /* Return the number of characters formatted (excluding trailing nul * character), that is, the number of characters that would have been diff --git a/src/message_test.c b/src/message_test.c new file mode 100644 index 0000000000..55ca814107 --- /dev/null +++ b/src/message_test.c @@ -0,0 +1,107 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * message_test.c: Unittests for message.c + */ + +#undef NDEBUG +#include <assert.h> + +/* Must include main.c because it contains much more than just main() */ +#define NO_VIM_MAIN +#include "main.c" + +/* This file has to be included because some of the tested functions are + * static. */ +#include "message.c" + +/* + * Test trunc_string(). + */ + static void +test_trunc_string(void) +{ + char_u *buf; /*allocated every time to find uninit errors */ + char_u *s; + + /* in place */ + buf = alloc(40); + STRCPY(buf, "text"); + trunc_string(buf, buf, 20, 40); + assert(STRCMP(buf, "text") == 0); + vim_free(buf); + + buf = alloc(40); + STRCPY(buf, "a short text"); + trunc_string(buf, buf, 20, 40); + assert(STRCMP(buf, "a short text") == 0); + vim_free(buf); + + buf = alloc(40); + STRCPY(buf, "a text tha just fits"); + trunc_string(buf, buf, 20, 40); + assert(STRCMP(buf, "a text tha just fits") == 0); + vim_free(buf); + + buf = alloc(40); + STRCPY(buf, "a text that nott fits"); + trunc_string(buf, buf, 20, 40); + assert(STRCMP(buf, "a text t...nott fits") == 0); + vim_free(buf); + + /* copy from string to buf */ + buf = alloc(40); + s = vim_strsave((char_u *)"text"); + trunc_string(s, buf, 20, 40); + assert(STRCMP(buf, "text") == 0); + vim_free(buf); + vim_free(s); + + buf = alloc(40); + s = vim_strsave((char_u *)"a text that fits"); + trunc_string(s, buf, 34, 40); + assert(STRCMP(buf, "a text that fits") == 0); + vim_free(buf); + vim_free(s); + + buf = alloc(40); + s = vim_strsave((char_u *)"a short text"); + trunc_string(s, buf, 20, 40); + assert(STRCMP(buf, "a short text") == 0); + vim_free(buf); + vim_free(s); + + buf = alloc(40); + s = vim_strsave((char_u *)"a text tha just fits"); + trunc_string(s, buf, 20, 40); + assert(STRCMP(buf, "a text tha just fits") == 0); + vim_free(buf); + vim_free(s); + + buf = alloc(40); + s = vim_strsave((char_u *)"a text that nott fits"); + trunc_string(s, buf, 20, 40); + assert(STRCMP(buf, "a text t...nott fits") == 0); + vim_free(buf); + vim_free(s); +} + + int +main(int argc, char **argv) +{ + vim_memset(¶ms, 0, sizeof(params)); + params.argc = argc; + params.argv = argv; + common_init(¶ms); + init_chartab(); + + test_trunc_string(); + return 0; +} diff --git a/src/misc1.c b/src/misc1.c index e24d3b26cd..38da9457a5 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -14,12 +14,12 @@ #include "vim.h" #include "version.h" -static char_u *vim_version_dir __ARGS((char_u *vimdir)); -static char_u *remove_tail __ARGS((char_u *p, char_u *pend, char_u *name)); +static char_u *vim_version_dir(char_u *vimdir); +static char_u *remove_tail(char_u *p, char_u *pend, char_u *name); #if defined(FEAT_CMDL_COMPL) -static void init_users __ARGS((void)); +static void init_users(void); #endif -static int copy_indent __ARGS((int size, char_u *src)); +static int copy_indent(int size, char_u *src); /* All user names (for ~user completion as done by shell). */ #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -30,7 +30,7 @@ static garray_T ga_users; * Count the size (in window cells) of the indent in the current line. */ int -get_indent() +get_indent(void) { return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts, FALSE); } @@ -39,8 +39,7 @@ get_indent() * Count the size (in window cells) of the indent in line "lnum". */ int -get_indent_lnum(lnum) - linenr_T lnum; +get_indent_lnum(linenr_T lnum) { return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts, FALSE); } @@ -51,9 +50,7 @@ get_indent_lnum(lnum) * "buf". */ int -get_indent_buf(buf, lnum) - buf_T *buf; - linenr_T lnum; +get_indent_buf(buf_T *buf, linenr_T lnum) { return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE); } @@ -64,10 +61,10 @@ get_indent_buf(buf, lnum) * 'tabstop' at "ts" */ int -get_indent_str(ptr, ts, list) - char_u *ptr; - int ts; - int list; /* if TRUE, count only screen size for tabs */ +get_indent_str( + char_u *ptr, + int ts, + int list) /* if TRUE, count only screen size for tabs */ { int count = 0; @@ -78,7 +75,8 @@ get_indent_str(ptr, ts, list) if (!list || lcs_tab1) /* count a tab for what it is worth */ count += ts - (count % ts); else - /* in list mode, when tab is not set, count screen char width for Tab: ^I */ + /* In list mode, when tab is not set, count screen char width + * for Tab, displays: ^I */ count += ptr2cells(ptr); } else if (*ptr == ' ') @@ -100,9 +98,9 @@ get_indent_str(ptr, ts, list) * Returns TRUE if the line was changed. */ int -set_indent(size, flags) - int size; /* measured in spaces */ - int flags; +set_indent( + int size, /* measured in spaces */ + int flags) { char_u *p; char_u *newline; @@ -141,7 +139,7 @@ set_indent(size, flags) ind_done = 0; /* count as many characters as we can use */ - while (todo > 0 && vim_iswhite(*p)) + while (todo > 0 && VIM_ISWHITE(*p)) { if (*p == TAB) { @@ -204,7 +202,7 @@ set_indent(size, flags) } /* Return if the indent is OK already. */ - if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) + if (!doit && !VIM_ISWHITE(*p) && !(flags & SIN_INSERT)) return FALSE; /* Allocate memory for the new line. */ @@ -236,7 +234,7 @@ set_indent(size, flags) /* Skip over any additional white space (useful when newindent is less * than old) */ - while (vim_iswhite(*p)) + while (VIM_ISWHITE(*p)) ++p; } @@ -260,7 +258,7 @@ set_indent(size, flags) p = oldline; ind_done = 0; - while (todo > 0 && vim_iswhite(*p)) + while (todo > 0 && VIM_ISWHITE(*p)) { if (*p == TAB) { @@ -337,9 +335,7 @@ set_indent(size, flags) * Returns TRUE if the line was changed. */ static int -copy_indent(size, src) - int size; - char_u *src; +copy_indent(int size, char_u *src) { char_u *p = NULL; char_u *line = NULL; @@ -361,7 +357,7 @@ copy_indent(size, src) s = src; /* Count/copy the usable portion of the source line */ - while (todo > 0 && vim_iswhite(*s)) + while (todo > 0 && VIM_ISWHITE(*s)) { if (*s == TAB) { @@ -441,8 +437,7 @@ copy_indent(size, src) * Since a pattern is used it can actually handle more than numbers. */ int -get_number_indent(lnum) - linenr_T lnum; +get_number_indent(linenr_T lnum) { colnr_T col; pos_T pos; @@ -490,28 +485,28 @@ get_number_indent(lnum) * necessarily always the current one. */ int -get_breakindent_win(wp, line) - win_T *wp; - char_u *line; /* start of the line */ +get_breakindent_win( + win_T *wp, + char_u *line) /* start of the line */ { static int prev_indent = 0; /* cached indent value */ static long prev_ts = 0L; /* cached tabstop value */ static char_u *prev_line = NULL; /* cached pointer to line */ - static int prev_tick = 0; /* changedtick of cached value */ + static varnumber_T prev_tick = 0; /* changedtick of cached value */ int bri = 0; /* window width minus window margin space, i.e. what rests for text */ - const int eff_wwidth = W_WIDTH(wp) + const int eff_wwidth = wp->w_width - ((wp->w_p_nu || wp->w_p_rnu) && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0); /* used cached indent, unless pointer or 'tabstop' changed */ if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts - || prev_tick != wp->w_buffer->b_changedtick) + || prev_tick != CHANGEDTICK(wp->w_buffer)) { prev_line = line; prev_ts = wp->w_buffer->b_p_ts; - prev_tick = wp->w_buffer->b_changedtick; + prev_tick = CHANGEDTICK(wp->w_buffer); prev_indent = get_indent_str(line, (int)wp->w_buffer->b_p_ts, wp->w_p_list); } @@ -540,14 +535,13 @@ get_breakindent_win(wp, line) #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT) -static int cin_is_cinword __ARGS((char_u *line)); +static int cin_is_cinword(char_u *line); /* * Return TRUE if the string "line" starts with a word from 'cinwords'. */ static int -cin_is_cinword(line) - char_u *line; +cin_is_cinword(char_u *line) { char_u *cinw; char_u *cinw_buf; @@ -594,13 +588,13 @@ cin_is_cinword(line) * "second_line_indent": indent for after ^^D in Insert mode or if flag * OPENLINE_COM_LIST * - * Return TRUE for success, FALSE for failure + * Return OK for success, FAIL for failure */ int -open_line(dir, flags, second_line_indent) - int dir; /* FORWARD or BACKWARD */ - int flags; - int second_line_indent; +open_line( + int dir, /* FORWARD or BACKWARD */ + int flags, + int second_line_indent) { char_u *saved_line; /* copy of the original line */ char_u *next_line = NULL; /* copy of the next line */ @@ -612,7 +606,7 @@ open_line(dir, flags, second_line_indent) int newindent = 0; /* auto-indent of the new line */ int n; int trunc_line = FALSE; /* truncate current line afterwards */ - int retval = FALSE; /* return value, default is FAIL */ + int retval = FAIL; /* return value */ #ifdef FEAT_COMMENTS int extra_len = 0; /* length of p_extra string */ int lead_len; /* length of comment leader */ @@ -632,6 +626,9 @@ open_line(dir, flags, second_line_indent) int do_si = (!p_paste && curbuf->b_p_si # ifdef FEAT_CINDENT && !curbuf->b_p_cin +# endif +# ifdef FEAT_EVAL + && *curbuf->b_p_inde == NUL # endif ); int no_si = FALSE; /* reset did_si afterwards */ @@ -826,7 +823,7 @@ open_line(dir, flags, second_line_indent) { /* Find last non-blank in line */ p = ptr + STRLEN(ptr) - 1; - while (p > ptr && vim_iswhite(*p)) + while (p > ptr && VIM_ISWHITE(*p)) --p; last_char = *p; @@ -837,7 +834,7 @@ open_line(dir, flags, second_line_indent) { if (p > ptr) --p; - while (p > ptr && vim_iswhite(*p)) + while (p > ptr && VIM_ISWHITE(*p)) --p; } /* @@ -1026,7 +1023,7 @@ open_line(dir, flags, second_line_indent) * comment leader, then put a space after the middle * comment leader on the next line. */ - if (!vim_iswhite(saved_line[lead_len - 1]) + if (!VIM_ISWHITE(saved_line[lead_len - 1]) && ((p_extra != NULL && (int)curwin->w_cursor.col == lead_len) || (p_extra == NULL @@ -1130,7 +1127,7 @@ open_line(dir, flags, second_line_indent) { /* find last non-white in the leader to line up with */ for (p = leader + lead_len - 1; p > leader - && vim_iswhite(*p); --p) + && VIM_ISWHITE(*p); --p) ; ++p; @@ -1146,7 +1143,7 @@ open_line(dir, flags, second_line_indent) while (old_size < repl_size && p > leader) { - mb_ptr_back(leader, p); + MB_PTR_BACK(leader, p); old_size += ptr2cells(p); } l = lead_repl_len - (int)(endp - p); @@ -1186,7 +1183,7 @@ open_line(dir, flags, second_line_indent) } else #endif - if (!vim_iswhite(*p)) + if (!VIM_ISWHITE(*p)) *p = ' '; } } @@ -1203,7 +1200,7 @@ open_line(dir, flags, second_line_indent) int i; int l; - for (i = 0; p[i] != NUL && i < lead_len; i += l) + for (i = 0; i < lead_len && p[i] != NUL; i += l) { l = (*mb_ptr2len)(p + i); if (vim_strnsize(p, i + l) > repl_size) @@ -1223,7 +1220,7 @@ open_line(dir, flags, second_line_indent) * leader by spaces. Keep Tabs, the indent must * remain the same. */ for (p += lead_repl_len; p < leader + lead_len; ++p) - if (!vim_iswhite(*p)) + if (!VIM_ISWHITE(*p)) { /* Don't put a space before a TAB. */ if (p + 1 < leader + lead_len && p[1] == TAB) @@ -1288,7 +1285,7 @@ open_line(dir, flags, second_line_indent) /* If the leader ends in white space, don't add an * extra space */ - if (lead_len > 0 && vim_iswhite(leader[lead_len - 1])) + if (lead_len > 0 && VIM_ISWHITE(leader[lead_len - 1])) extra_space = FALSE; leader[lead_len] = NUL; } @@ -1311,7 +1308,7 @@ open_line(dir, flags, second_line_indent) #endif ) { - while (lead_len && vim_iswhite(*leader)) + while (lead_len && VIM_ISWHITE(*leader)) { --lead_len; --newcol; @@ -1431,8 +1428,15 @@ open_line(dir, flags, second_line_indent) == FAIL) goto theend; /* Postpone calling changed_lines(), because it would mess up folding - * with markers. */ - mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); + * with markers. + * Skip mark_adjust when adding a line after the last one, there can't + * be marks there. But still needed in diff mode. */ + if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + || curwin->w_p_diff +#endif + ) + mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); did_append = TRUE; } #ifdef FEAT_VREPLACE @@ -1585,8 +1589,7 @@ open_line(dir, flags, second_line_indent) && curbuf->b_p_ai) { fixthisline(get_lisp_indent); - p = ml_get_curline(); - ai_col = (colnr_T)(skipwhite(p) - p); + ai_col = (colnr_T)getwhitecols_curline(); } #endif #ifdef FEAT_CINDENT @@ -1604,8 +1607,7 @@ open_line(dir, flags, second_line_indent) : KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum))) { do_c_expr_indent(); - p = ml_get_curline(); - ai_col = (colnr_T)(skipwhite(p) - p); + ai_col = (colnr_T)getwhitecols_curline(); } #endif #if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT)) @@ -1640,7 +1642,7 @@ open_line(dir, flags, second_line_indent) } #endif - retval = TRUE; /* success! */ + retval = OK; /* success! */ theend: curbuf->b_p_pi = saved_pi; vim_free(saved_line); @@ -1661,11 +1663,11 @@ open_line(dir, flags, second_line_indent) * length. */ int -get_leader_len(line, flags, backward, include_space) - char_u *line; - char_u **flags; - int backward; - int include_space; +get_leader_len( + char_u *line, + char_u **flags, + int backward, + int include_space) { int i, j; int result; @@ -1679,7 +1681,7 @@ get_leader_len(line, flags, backward, include_space) char_u *saved_flags = NULL; result = i = 0; - while (vim_iswhite(line[i])) /* leading white space is ignored */ + while (VIM_ISWHITE(line[i])) /* leading white space is ignored */ ++i; /* @@ -1724,11 +1726,11 @@ get_leader_len(line, flags, backward, include_space) * When string starts with white space, must have some white space * (but the amount does not need to match, there might be a mix of * TABs and spaces). */ - if (vim_iswhite(string[0])) + if (VIM_ISWHITE(string[0])) { - if (i == 0 || !vim_iswhite(line[i - 1])) + if (i == 0 || !VIM_ISWHITE(line[i - 1])) continue; /* missing white space */ - while (vim_iswhite(string[0])) + while (VIM_ISWHITE(string[0])) ++string; } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) @@ -1739,7 +1741,7 @@ get_leader_len(line, flags, backward, include_space) /* When 'b' flag used, there must be white space or an * end-of-line after the string in the line. */ if (vim_strchr(part_buf, COM_BLANK) != NULL - && !vim_iswhite(line[i + j]) && line[i + j] != NUL) + && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL) continue; /* We have found a match, stop searching unless this is a middle @@ -1784,7 +1786,7 @@ get_leader_len(line, flags, backward, include_space) result = i; /* Include any trailing white space. */ - while (vim_iswhite(line[i])) + while (VIM_ISWHITE(line[i])) ++i; if (include_space) @@ -1806,9 +1808,7 @@ get_leader_len(line, flags, backward, include_space) * recognized comment leader. */ int -get_last_leader_offset(line, flags) - char_u *line; - char_u **flags; +get_last_leader_offset(char_u *line, char_u **flags) { int result = -1; int i, j; @@ -1854,11 +1854,11 @@ get_last_leader_offset(line, flags) * (but the amount does not need to match, there might be a mix of * TABs and spaces). */ - if (vim_iswhite(string[0])) + if (VIM_ISWHITE(string[0])) { - if (i == 0 || !vim_iswhite(line[i - 1])) + if (i == 0 || !VIM_ISWHITE(line[i - 1])) continue; - while (vim_iswhite(string[0])) + while (VIM_ISWHITE(string[0])) ++string; } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) @@ -1871,7 +1871,7 @@ get_last_leader_offset(line, flags) * end-of-line after the string in the line. */ if (vim_strchr(part_buf, COM_BLANK) != NULL - && !vim_iswhite(line[i + j]) && line[i + j] != NUL) + && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL) { continue; } @@ -1908,7 +1908,7 @@ get_last_leader_offset(line, flags) * the comment leader correctly. */ - while (vim_iswhite(*com_leader)) + while (VIM_ISWHITE(*com_leader)) ++com_leader; len1 = (int)STRLEN(com_leader); @@ -1921,7 +1921,7 @@ get_last_leader_offset(line, flags) continue; string = vim_strchr(part_buf2, ':'); ++string; - while (vim_iswhite(*string)) + while (VIM_ISWHITE(*string)) ++string; len2 = (int)STRLEN(string); if (len2 == 0) @@ -1949,17 +1949,16 @@ get_last_leader_offset(line, flags) * Return the number of window lines occupied by buffer line "lnum". */ int -plines(lnum) - linenr_T lnum; +plines(linenr_T lnum) { return plines_win(curwin, lnum, TRUE); } int -plines_win(wp, lnum, winheight) - win_T *wp; - linenr_T lnum; - int winheight; /* when TRUE limit to window height */ +plines_win( + win_T *wp, + linenr_T lnum, + int winheight) /* when TRUE limit to window height */ { #if defined(FEAT_DIFF) || defined(PROTO) /* Check for filler lines above this buffer line. When folded the result @@ -1968,17 +1967,16 @@ plines_win(wp, lnum, winheight) } int -plines_nofill(lnum) - linenr_T lnum; +plines_nofill(linenr_T lnum) { return plines_win_nofill(curwin, lnum, TRUE); } int -plines_win_nofill(wp, lnum, winheight) - win_T *wp; - linenr_T lnum; - int winheight; /* when TRUE limit to window height */ +plines_win_nofill( + win_T *wp, + linenr_T lnum, + int winheight) /* when TRUE limit to window height */ { #endif int lines; @@ -1986,10 +1984,8 @@ plines_win_nofill(wp, lnum, winheight) if (!wp->w_p_wrap) return 1; -#ifdef FEAT_VERTSPLIT if (wp->w_width == 0) return 1; -#endif #ifdef FEAT_FOLDING /* A folded lines is handled just like an empty line. */ @@ -2009,9 +2005,7 @@ plines_win_nofill(wp, lnum, winheight) * "wp". Does not care about folding, 'wrap' or 'diff'. */ int -plines_win_nofold(wp, lnum) - win_T *wp; - linenr_T lnum; +plines_win_nofold(win_T *wp, linenr_T lnum) { char_u *s; long col; @@ -2032,7 +2026,7 @@ plines_win_nofold(wp, lnum) /* * Add column offset for 'number', 'relativenumber' and 'foldcolumn'. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 32000; if (col <= width) @@ -2047,10 +2041,7 @@ plines_win_nofold(wp, lnum) * used from the start of the line to the given column number. */ int -plines_win_col(wp, lnum, column) - win_T *wp; - linenr_T lnum; - long column; +plines_win_col(win_T *wp, linenr_T lnum, long column) { long col; char_u *s; @@ -2067,10 +2058,8 @@ plines_win_col(wp, lnum, column) if (!wp->w_p_wrap) return lines + 1; -#ifdef FEAT_VERTSPLIT if (wp->w_width == 0) return lines + 1; -#endif line = s = ml_get_buf(wp->w_buffer, lnum, FALSE); @@ -2078,7 +2067,7 @@ plines_win_col(wp, lnum, column) while (*s != NUL && --column >= 0) { col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL); - mb_ptr_adv(s); + MB_PTR_ADV(s); } /* @@ -2094,7 +2083,7 @@ plines_win_col(wp, lnum, column) /* * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 9999; @@ -2105,9 +2094,7 @@ plines_win_col(wp, lnum, column) } int -plines_m_win(wp, first, last) - win_T *wp; - linenr_T first, last; +plines_m_win(win_T *wp, linenr_T first, linenr_T last) { int count = 0; @@ -2145,8 +2132,7 @@ plines_m_win(wp, first, last) * Handles Replace mode and multi-byte characters. */ void -ins_bytes(p) - char_u *p; +ins_bytes(char_u *p) { ins_bytes_len(p, (int)STRLEN(p)); } @@ -2159,9 +2145,7 @@ ins_bytes(p) * Handles Replace mode and multi-byte characters. */ void -ins_bytes_len(p, len) - char_u *p; - int len; +ins_bytes_len(char_u *p, int len) { int i; # ifdef FEAT_MBYTE @@ -2192,30 +2176,29 @@ ins_bytes_len(p, len) * convert bytes to a character. */ void -ins_char(c) - int c; +ins_char(int c) { -#if defined(FEAT_MBYTE) || defined(PROTO) char_u buf[MB_MAXBYTES + 1]; - int n; + int n = 1; +#ifdef FEAT_MBYTE n = (*mb_char2bytes)(c, buf); /* When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte. * Happens for CTRL-Vu9900. */ if (buf[0] == 0) buf[0] = '\n'; +#else + buf[0] = c; +#endif ins_char_bytes(buf, n); } void -ins_char_bytes(buf, charlen) - char_u *buf; - int charlen; +ins_char_bytes(char_u *buf, int charlen) { int c = buf[0]; -#endif int newlen; /* nr of bytes inserted */ int oldlen; /* nr of bytes deleted (0 when not replacing) */ char_u *p; @@ -2238,11 +2221,7 @@ ins_char_bytes(buf, charlen) /* The lengths default to the values for when not replacing. */ oldlen = 0; -#ifdef FEAT_MBYTE newlen = charlen; -#else - newlen = 1; -#endif if (State & REPLACE_FLAG) { @@ -2334,7 +2313,8 @@ ins_char_bytes(buf, charlen) /* Copy bytes after the changed character(s). */ p = newp + col; - mch_memmove(p + newlen, oldp + col + oldlen, + if (linelen > col + oldlen) + mch_memmove(p + newlen, oldp + col + oldlen, (size_t)(linelen - col - oldlen)); /* Insert or overwrite the new character. */ @@ -2397,8 +2377,7 @@ ins_char_bytes(buf, charlen) * Caller must have prepared for undo. */ void -ins_str(s) - char_u *s; +ins_str(char_u *s) { char_u *oldp, *newp; int newlen = (int)STRLEN(s); @@ -2435,8 +2414,7 @@ ins_str(s) * return FAIL for failure, OK otherwise */ int -del_char(fixpos) - int fixpos; +del_char(int fixpos) { #ifdef FEAT_MBYTE if (has_mbyte) @@ -2456,9 +2434,7 @@ del_char(fixpos) * Like del_bytes(), but delete characters instead of bytes. */ int -del_chars(count, fixpos) - long count; - int fixpos; +del_chars(long count, int fixpos) { long bytes = 0; long i; @@ -2481,13 +2457,13 @@ del_chars(count, fixpos) * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. * Caller must have prepared for undo. * - * return FAIL for failure, OK otherwise + * Return FAIL for failure, OK otherwise. */ int -del_bytes(count, fixpos_arg, use_delcombine) - long count; - int fixpos_arg; - int use_delcombine UNUSED; /* 'delcombine' option applies */ +del_bytes( + long count, + int fixpos_arg, + int use_delcombine UNUSED) /* 'delcombine' option applies */ { char_u *oldp, *newp; colnr_T oldlen; @@ -2500,12 +2476,21 @@ del_bytes(count, fixpos_arg, use_delcombine) oldp = ml_get(lnum); oldlen = (int)STRLEN(oldp); - /* - * Can't do anything when the cursor is on the NUL after the line. - */ + /* Can't do anything when the cursor is on the NUL after the line. */ if (col >= oldlen) return FAIL; + /* If "count" is zero there is nothing to do. */ + if (count == 0) + return OK; + + /* If "count" is negative the caller must be doing something wrong. */ + if (count < 1) + { + IEMSGN("E950: Invalid count for del_bytes(): %ld", count); + return FAIL; + } + #ifdef FEAT_MBYTE /* If 'delcombine' is set and deleting (less than) one character, only * delete the last combining character. */ @@ -2601,8 +2586,8 @@ del_bytes(count, fixpos_arg, use_delcombine) * return FAIL for failure, OK otherwise */ int -truncate_line(fixpos) - int fixpos; /* if TRUE fix the cursor position when done */ +truncate_line( + int fixpos) /* if TRUE fix the cursor position when done */ { char_u *newp; linenr_T lnum = curwin->w_cursor.lnum; @@ -2635,9 +2620,9 @@ truncate_line(fixpos) * Saves the lines for undo first if "undo" is TRUE. */ void -del_lines(nlines, undo) - long nlines; /* number of lines to delete */ - int undo; /* if TRUE, prepare for undo */ +del_lines( + long nlines, /* number of lines to delete */ + int undo) /* if TRUE, prepare for undo */ { long n; linenr_T first = curwin->w_cursor.lnum; @@ -2672,11 +2657,14 @@ del_lines(nlines, undo) } int -gchar_pos(pos) - pos_T *pos; +gchar_pos(pos_T *pos) { - char_u *ptr = ml_get_pos(pos); + char_u *ptr; + /* When searching columns is sometimes put at the end of a line. */ + if (pos->col == MAXCOL) + return NUL; + ptr = ml_get_pos(pos); #ifdef FEAT_MBYTE if (has_mbyte) return (*mb_ptr2char)(ptr); @@ -2685,7 +2673,7 @@ gchar_pos(pos) } int -gchar_cursor() +gchar_cursor(void) { #ifdef FEAT_MBYTE if (has_mbyte) @@ -2699,8 +2687,7 @@ gchar_cursor() * It is directly written into the block. */ void -pchar_cursor(c) - int c; +pchar_cursor(int c) { *(ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE) + curwin->w_cursor.col) = c; @@ -2713,13 +2700,12 @@ pchar_cursor(c) * the line. */ int -inindent(extra) - int extra; +inindent(int extra) { char_u *ptr; colnr_T col; - for (col = 0, ptr = ml_get_curline(); vim_iswhite(*ptr); ++col) + for (col = 0, ptr = ml_get_curline(); VIM_ISWHITE(*ptr); ++col) ++ptr; if (col >= curwin->w_cursor.col + extra) return TRUE; @@ -2731,8 +2717,7 @@ inindent(extra) * Skip to next part of an option argument: Skip space and comma. */ char_u * -skip_to_option_part(p) - char_u *p; +skip_to_option_part(char_u *p) { if (*p == ',') ++p; @@ -2750,15 +2735,18 @@ skip_to_option_part(p) * Careful: may trigger autocommands that reload the buffer. */ void -changed() +changed(void) { #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) - /* The text of the preediting area is inserted, but this doesn't - * mean a change of the buffer yet. That is delayed until the - * text is committed. (this means preedit becomes empty) */ - if (im_is_preediting() && !xim_changed_while_preediting) - return; - xim_changed_while_preediting = FALSE; + if (p_imst == IM_ON_THE_SPOT) + { + /* The text of the preediting area is inserted, but this doesn't + * mean a change of the buffer yet. That is delayed until the + * text is committed. (this means preedit becomes empty) */ + if (im_is_preediting() && !xim_changed_while_preediting) + return; + xim_changed_while_preediting = FALSE; + } #endif if (!curbuf->b_changed) @@ -2777,6 +2765,9 @@ changed() #endif ) { + int save_need_wait_return = need_wait_return; + + need_wait_return = FALSE; ml_open_file(curbuf); /* The ml_open_file() can cause an ATTENTION message. @@ -2790,32 +2781,32 @@ changed() wait_return(TRUE); msg_scroll = save_msg_scroll; } + else + need_wait_return = save_need_wait_return; } changed_int(); } - ++curbuf->b_changedtick; + ++CHANGEDTICK(curbuf); } /* * Internal part of changed(), no user interaction. */ void -changed_int() +changed_int(void) { curbuf->b_changed = TRUE; ml_setflags(curbuf); -#ifdef FEAT_WINDOWS check_status(curbuf); redraw_tabline = TRUE; -#endif #ifdef FEAT_TITLE need_maketitle = TRUE; /* set window title later */ #endif } -static void changedOneline __ARGS((buf_T *buf, linenr_T lnum)); -static void changed_lines_buf __ARGS((buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra)); -static void changed_common __ARGS((linenr_T lnum, colnr_T col, linenr_T lnume, long xtra)); +static void changedOneline(buf_T *buf, linenr_T lnum); +static void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra); +static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); /* * Changed bytes within a single line for the current buffer. @@ -2825,9 +2816,7 @@ static void changed_common __ARGS((linenr_T lnum, colnr_T col, linenr_T lnume, l * Careful: may trigger autocommands that reload the buffer. */ void -changed_bytes(lnum, col) - linenr_T lnum; - colnr_T col; +changed_bytes(linenr_T lnum, colnr_T col) { changedOneline(curbuf, lnum); changed_common(lnum, col, lnum + 1, 0L); @@ -2839,7 +2828,7 @@ changed_bytes(lnum, col) win_T *wp; linenr_T wlnum; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_p_diff && wp != curwin) { redraw_win_later(wp, VALID); @@ -2852,9 +2841,7 @@ changed_bytes(lnum, col) } static void -changedOneline(buf, lnum) - buf_T *buf; - linenr_T lnum; +changedOneline(buf_T *buf, linenr_T lnum) { if (buf->b_mod_set) { @@ -2880,9 +2867,7 @@ changedOneline(buf, lnum) * Takes care of marking the buffer to be redrawn and sets the changed flag. */ void -appended_lines(lnum, count) - linenr_T lnum; - long count; +appended_lines(linenr_T lnum, long count) { changed_lines(lnum + 1, 0, lnum + 1, count); } @@ -2891,11 +2876,16 @@ appended_lines(lnum, count) * Like appended_lines(), but adjust marks first. */ void -appended_lines_mark(lnum, count) - linenr_T lnum; - long count; +appended_lines_mark(linenr_T lnum, long count) { - mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); + /* Skip mark_adjust when adding a line after the last one, there can't + * be marks there. But it's still needed in diff mode. */ + if (lnum + count < curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + || curwin->w_p_diff +#endif + ) + mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); changed_lines(lnum + 1, 0, lnum + 1, count); } @@ -2905,9 +2895,7 @@ appended_lines_mark(lnum, count) * Takes care of marking the buffer to be redrawn and sets the changed flag. */ void -deleted_lines(lnum, count) - linenr_T lnum; - long count; +deleted_lines(linenr_T lnum, long count) { changed_lines(lnum, 0, lnum + count, -count); } @@ -2918,9 +2906,7 @@ deleted_lines(lnum, count) * be triggered to display the cursor. */ void -deleted_lines_mark(lnum, count) - linenr_T lnum; - long count; +deleted_lines_mark(linenr_T lnum, long count) { mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count); changed_lines(lnum, 0, lnum + count, -count); @@ -2939,11 +2925,11 @@ deleted_lines_mark(lnum, count) * Careful: may trigger autocommands that reload the buffer. */ void -changed_lines(lnum, col, lnume, xtra) - linenr_T lnum; /* first line with change */ - colnr_T col; /* column in first line with change */ - linenr_T lnume; /* line below last changed line */ - long xtra; /* number of extra lines (negative when deleting) */ +changed_lines( + linenr_T lnum, /* first line with change */ + colnr_T col, /* column in first line with change */ + linenr_T lnume, /* line below last changed line */ + long xtra) /* number of extra lines (negative when deleting) */ { changed_lines_buf(curbuf, lnum, lnume, xtra); @@ -2956,7 +2942,7 @@ changed_lines(lnum, col, lnume, xtra) win_T *wp; linenr_T wlnum; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_p_diff && wp != curwin) { redraw_win_later(wp, VALID); @@ -2972,11 +2958,11 @@ changed_lines(lnum, col, lnume, xtra) } static void -changed_lines_buf(buf, lnum, lnume, xtra) - buf_T *buf; - linenr_T lnum; /* first line with change */ - linenr_T lnume; /* line below last changed line */ - long xtra; /* number of extra lines (negative when deleting) */ +changed_lines_buf( + buf_T *buf, + linenr_T lnum, /* first line with change */ + linenr_T lnume, /* line below last changed line */ + long xtra) /* number of extra lines (negative when deleting) */ { if (buf->b_mod_set) { @@ -3010,16 +2996,14 @@ changed_lines_buf(buf, lnum, lnume, xtra) * Careful: may trigger autocommands that reload the buffer. */ static void -changed_common(lnum, col, lnume, xtra) - linenr_T lnum; - colnr_T col; - linenr_T lnume; - long xtra; +changed_common( + linenr_T lnum, + colnr_T col, + linenr_T lnume, + long xtra) { win_T *wp; -#ifdef FEAT_WINDOWS tabpage_T *tp; -#endif int i; #ifdef FEAT_JUMPLIST int cols; @@ -3199,21 +3183,19 @@ changed_common(lnum, col, lnume, xtra) if (must_redraw < VALID) must_redraw = VALID; -#ifdef FEAT_AUTOCMD /* when the cursor line is changed always trigger CursorMoved */ if (lnum <= curwin->w_cursor.lnum && lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum) last_cursormoved.lnum = 0; -#endif } /* * unchanged() is called when the changed flag must be reset for buffer 'buf' */ void -unchanged(buf, ff) - buf_T *buf; - int ff; /* also reset 'fileformat' */ +unchanged( + buf_T *buf, + int ff) /* also reset 'fileformat' */ { if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) { @@ -3221,32 +3203,28 @@ unchanged(buf, ff) ml_setflags(buf); if (ff) save_file_ff(buf); -#ifdef FEAT_WINDOWS check_status(buf); redraw_tabline = TRUE; -#endif #ifdef FEAT_TITLE need_maketitle = TRUE; /* set window title later */ #endif } - ++buf->b_changedtick; + ++CHANGEDTICK(buf); #ifdef FEAT_NETBEANS_INTG netbeans_unmodified(buf); #endif } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * check_status: called when the status bars for the buffer 'buf' * need to be updated */ void -check_status(buf) - buf_T *buf; +check_status(buf_T *buf) { win_T *wp; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_buffer == buf && wp->w_status_height) { wp->w_redr_status = TRUE; @@ -3254,7 +3232,6 @@ check_status(buf) must_redraw = VALID; } } -#endif /* * If the file is readonly, give a warning message with the first change. @@ -3265,26 +3242,22 @@ check_status(buf) * Careful: may trigger autocommands that reload the buffer. */ void -change_warning(col) - int col; /* column for message; non-zero when in insert +change_warning( + int col) /* column for message; non-zero when in insert mode and 'showmode' is on */ { static char *w_readonly = N_("W10: Warning: Changing a readonly file"); if (curbuf->b_did_warn == FALSE && curbufIsChanged() == 0 -#ifdef FEAT_AUTOCMD && !autocmd_busy -#endif && curbuf->b_p_ro) { -#ifdef FEAT_AUTOCMD ++curbuf_lock; apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); --curbuf_lock; if (!curbuf->b_p_ro) return; -#endif /* * Do what msg() does, but with a column offset if the warning should * be after the mode message. @@ -3292,14 +3265,18 @@ change_warning(col) msg_start(); if (msg_row == Rows - 1) msg_col = col; - msg_source(hl_attr(HLF_W)); - MSG_PUTS_ATTR(_(w_readonly), hl_attr(HLF_W) | MSG_HIST); + msg_source(HL_ATTR(HLF_W)); + MSG_PUTS_ATTR(_(w_readonly), HL_ATTR(HLF_W) | MSG_HIST); #ifdef FEAT_EVAL set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1); #endif msg_clr_eos(); (void)msg_end(); - if (msg_silent == 0 && !silent_mode) + if (msg_silent == 0 && !silent_mode +#ifdef FEAT_EVAL + && time_for_testing != 1 +#endif + ) { out_flush(); ui_delay(1000L, TRUE); /* give the user time to think about it */ @@ -3321,9 +3298,7 @@ change_warning(col) * return the 'y' or 'n' */ int -ask_yesno(str, direct) - char_u *str; - int direct; +ask_yesno(char_u *str, int direct) { int r = ' '; int save_State = State; @@ -3344,7 +3319,7 @@ ask_yesno(str, direct) while (r != 'y' && r != 'n') { /* same highlighting as for wait_return */ - smsg_attr(hl_attr(HLF_R), (char_u *)"%s (y/n)?", str); + smsg_attr(HL_ATTR(HLF_R), (char_u *)"%s (y/n)?", str); if (direct) r = get_keystroke(); else @@ -3370,14 +3345,14 @@ ask_yesno(str, direct) * Return TRUE if "c" is a mouse key. */ int -is_mouse_key(c) - int c; +is_mouse_key(int c) { return c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_LEFTDRAG || c == K_LEFTRELEASE || c == K_LEFTRELEASE_NM + || c == K_MOUSEMOVE || c == K_MIDDLEMOUSE || c == K_MIDDLEDRAG || c == K_MIDDLERELEASE @@ -3406,7 +3381,7 @@ is_mouse_key(c) * Translates the interrupt character for unix to ESC. */ int -get_keystroke() +get_keystroke(void) { char_u *buf = NULL; int buflen = 150; @@ -3430,10 +3405,14 @@ get_keystroke() buf = alloc(buflen); else if (maxlen < 10) { + char_u *t_buf = buf; + /* Need some more space. This might happen when receiving a long * escape sequence. */ buflen += 100; buf = vim_realloc(buf, buflen); + if (buf == NULL) + vim_free(t_buf); maxlen = (buflen - 6 - len) / 3; } if (buf == NULL) @@ -3448,7 +3427,7 @@ get_keystroke() if (n > 0) { /* Replace zero and CSI by a special key code. */ - n = fix_input_buffer(buf + len, n, FALSE); + n = fix_input_buffer(buf + len, n); len += n; waited = 0; } @@ -3532,9 +3511,9 @@ get_keystroke() * When "mouse_used" is not NULL allow using the mouse. */ int -get_number(colon, mouse_used) - int colon; /* allow colon to abort */ - int *mouse_used; +get_number( + int colon, /* allow colon to abort */ + int *mouse_used) { int n = 0; int c; @@ -3603,8 +3582,7 @@ get_number(colon, mouse_used) * the line number. */ int -prompt_for_number(mouse_used) - int *mouse_used; +prompt_for_number(int *mouse_used) { int i; int save_cmdline_row; @@ -3621,7 +3599,12 @@ prompt_for_number(mouse_used) save_cmdline_row = cmdline_row; cmdline_row = 0; save_State = State; - State = CMDLINE; + State = ASKMORE; /* prevents a screen update when using a timer */ +#ifdef FEAT_MOUSE + /* May show different mouse shape. */ + setmouse(); +#endif + i = get_number(TRUE, mouse_used); if (KeyTyped) @@ -3636,13 +3619,16 @@ prompt_for_number(mouse_used) else cmdline_row = save_cmdline_row; State = save_State; +#ifdef FEAT_MOUSE + /* May need to restore mouse shape. */ + setmouse(); +#endif return i; } void -msgmore(n) - long n; +msgmore(long n) { long pn; @@ -3695,59 +3681,78 @@ msgmore(n) * flush map and typeahead buffers and give a warning for an error */ void -beep_flush() +beep_flush(void) { if (emsg_silent == 0) { flush_buffers(FALSE); - vim_beep(); + vim_beep(BO_ERROR); } } /* - * give a warning for an error + * Give a warning for an error. */ void -vim_beep() +vim_beep( + unsigned val) /* one of the BO_ values, e.g., BO_OPER */ { +#ifdef FEAT_EVAL + called_vim_beep = TRUE; +#endif + if (emsg_silent == 0) { - if (p_vb -#ifdef FEAT_GUI - /* While the GUI is starting up the termcap is set for the GUI - * but the output still goes to a terminal. */ - && !(gui.in_use && gui.starting) -#endif - ) - { - out_str(T_VB); - } - else + if (!((bo_flags & val) || (bo_flags & BO_ALL))) { -#ifdef MSDOS - /* - * The number of beeps outputted is reduced to avoid having to wait - * for all the beeps to finish. This is only a problem on systems - * where the beeps don't overlap. - */ - if (beep_count == 0 || beep_count == 10) +#ifdef ELAPSED_FUNC + static int did_init = FALSE; + static ELAPSED_TYPE start_tv; + + /* Only beep once per half a second, otherwise a sequence of beeps + * would freeze Vim. */ + if (!did_init || ELAPSED_FUNC(start_tv) > 500) { - out_char(BELL); - beep_count = 1; + did_init = TRUE; + ELAPSED_INIT(start_tv); +#endif + if (p_vb +#ifdef FEAT_GUI + /* While the GUI is starting up the termcap is set for + * the GUI but the output still goes to a terminal. */ + && !(gui.in_use && gui.starting) +#endif + ) + { + out_str_cf(T_VB); +#ifdef FEAT_VTP + /* No restore color information, refresh the screen. */ + if (has_vtp_working() != 0 +# ifdef FEAT_TERMGUICOLORS + && (p_tgc || (!p_tgc && t_colors >= 256)) +# endif + ) + { + redraw_later(CLEAR); + update_screen(0); + redrawcmd(); + } +#endif + } + else + out_char(BELL); +#ifdef ELAPSED_FUNC } - else - ++beep_count; -#else - out_char(BELL); #endif } - /* When 'verbose' is set and we are sourcing a script or executing a - * function give the user a hint where the beep comes from. */ + /* When 'debug' contains "beep" produce a message. If we are sourcing + * a script or executing a function give the user a hint where the beep + * comes from. */ if (vim_strchr(p_debug, 'e') != NULL) { - msg_source(hl_attr(HLF_W)); - msg_attr((char_u *)_("Beep!"), hl_attr(HLF_W)); + msg_source(HL_ATTR(HLF_W)); + msg_attr((char_u *)_("Beep!"), HL_ATTR(HLF_W)); } } } @@ -3764,13 +3769,12 @@ vim_beep() static char_u *homedir = NULL; void -init_homedir() +init_homedir(void) { char_u *var; /* In case we are called a second time (when 'encoding' changes). */ - vim_free(homedir); - homedir = NULL; + VIM_CLEAR(homedir); #ifdef VMS var = mch_getenv((char_u *)"SYS$LOGIN"); @@ -3778,10 +3782,33 @@ init_homedir() var = mch_getenv((char_u *)"HOME"); #endif - if (var != NULL && *var == NUL) /* empty is same as not set */ - var = NULL; - #ifdef WIN3264 + /* + * Typically, $HOME is not defined on Windows, unless the user has + * specifically defined it for Vim's sake. However, on Windows NT + * platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for + * each user. Try constructing $HOME from these. + */ + if (var == NULL || *var == NUL) + { + char_u *homedrive, *homepath; + + homedrive = mch_getenv((char_u *)"HOMEDRIVE"); + homepath = mch_getenv((char_u *)"HOMEPATH"); + if (homepath == NULL || *homepath == NUL) + homepath = (char_u *)"\\"; + if (homedrive != NULL + && STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL) + { + sprintf((char *)NameBuff, "%s%s", homedrive, homepath); + if (NameBuff[0] != NUL) + var = NameBuff; + } + } + + if (var == NULL) + var = mch_getenv((char_u *)"USERPROFILE"); + /* * Weird but true: $HOME may contain an indirect reference to another * variable, esp. "%USERPROFILE%". Happens when $USERPROFILE isn't set @@ -3802,40 +3829,14 @@ init_homedir() { vim_snprintf((char *)NameBuff, MAXPATHL, "%s%s", exp, p + 1); var = NameBuff; - /* Also set $HOME, it's needed for _viminfo. */ - vim_setenv((char_u *)"HOME", NameBuff); } } } - /* - * Typically, $HOME is not defined on Windows, unless the user has - * specifically defined it for Vim's sake. However, on Windows NT - * platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for - * each user. Try constructing $HOME from these. - */ - if (var == NULL) - { - char_u *homedrive, *homepath; - - homedrive = mch_getenv((char_u *)"HOMEDRIVE"); - homepath = mch_getenv((char_u *)"HOMEPATH"); - if (homepath == NULL || *homepath == NUL) - homepath = "\\"; - if (homedrive != NULL - && STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL) - { - sprintf((char *)NameBuff, "%s%s", homedrive, homepath); - if (NameBuff[0] != NUL) - { - var = NameBuff; - /* Also set $HOME, it's needed for _viminfo. */ - vim_setenv((char_u *)"HOME", NameBuff); - } - } - } + if (var != NULL && *var == NUL) /* empty is same as not set */ + var = NULL; -# if defined(FEAT_MBYTE) +# ifdef FEAT_MBYTE if (enc_utf8 && var != NULL) { int len; @@ -3851,16 +3852,15 @@ init_homedir() } } # endif -#endif -#if defined(OS2) || defined(MSDOS) || defined(MSWIN) /* * Default home dir is C:/ * Best assumption we can make in such a situation. */ if (var == NULL) - var = "C:/"; + var = (char_u *)"C:/"; #endif + if (var != NULL) { #ifdef UNIX @@ -3883,14 +3883,14 @@ init_homedir() #if defined(EXITFREE) || defined(PROTO) void -free_homedir() +free_homedir(void) { vim_free(homedir); } # ifdef FEAT_CMDL_COMPL void -free_users() +free_users(void) { ga_clear_strings(&ga_users); } @@ -3903,8 +3903,7 @@ free_users() * again soon. */ char_u * -expand_env_save(src) - char_u *src; +expand_env_save(char_u *src) { return expand_env_save_opt(src, FALSE); } @@ -3914,9 +3913,7 @@ expand_env_save(src) * expand "~" at the start. */ char_u * -expand_env_save_opt(src, one) - char_u *src; - int one; +expand_env_save_opt(char_u *src, int one) { char_u *p; @@ -3933,22 +3930,22 @@ expand_env_save_opt(src, one) * If anything fails no expansion is done and dst equals src. */ void -expand_env(src, dst, dstlen) - char_u *src; /* input string e.g. "$HOME/vim.hlp" */ - char_u *dst; /* where to put the result */ - int dstlen; /* maximum length of the result */ +expand_env( + char_u *src, /* input string e.g. "$HOME/vim.hlp" */ + char_u *dst, /* where to put the result */ + int dstlen) /* maximum length of the result */ { expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL); } void -expand_env_esc(srcp, dst, dstlen, esc, one, startstr) - char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ - char_u *dst; /* where to put the result */ - int dstlen; /* maximum length of the result */ - int esc; /* escape spaces in expanded variables */ - int one; /* "srcp" is one file name */ - char_u *startstr; /* start again after this (can be NULL) */ +expand_env_esc( + char_u *srcp, /* input string e.g. "$HOME/vim.hlp" */ + char_u *dst, /* where to put the result */ + int dstlen, /* maximum length of the result */ + int esc, /* escape spaces in expanded variables */ + int one, /* "srcp" is one file name */ + char_u *startstr) /* start again after this (can be NULL) */ { char_u *src; char_u *tail; @@ -3966,13 +3963,33 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) --dstlen; /* leave one char space for "\," */ while (*src && dstlen > 0) { +#ifdef FEAT_EVAL + /* Skip over `=expr`. */ + if (src[0] == '`' && src[1] == '=') + { + size_t len; + + var = src; + src += 2; + (void)skip_expr(&src); + if (*src == '`') + ++src; + len = src - var; + if (len > (size_t)dstlen) + len = dstlen; + vim_strncpy(dst, var, len); + dst += len; + dstlen -= (int)len; + continue; + } +#endif copy_char = TRUE; if ((*src == '$' #ifdef VMS && at_start #endif ) -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) || *src == '%' #endif || (*src == '~' && at_start)) @@ -4001,21 +4018,16 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) #endif { while (c-- > 0 && *tail != NUL && ((vim_isIDc(*tail)) -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) || (*src == '%' && *tail != '%') #endif )) { -#ifdef OS2 /* env vars only in uppercase */ - *var++ = TOUPPER_LOC(*tail); - tail++; /* toupper() may be a macro! */ -#else *var++ = *tail++; -#endif } } -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(UNIX) +#if defined(MSWIN) || defined(UNIX) # ifdef UNIX if (src[1] == '{' && *tail != '}') # else @@ -4033,7 +4045,7 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) #endif *var = NUL; var = vim_getenv(dst, &mustfree); -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(UNIX) +#if defined(MSWIN) || defined(UNIX) } #endif } @@ -4069,15 +4081,12 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) */ # if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H) { - struct passwd *pw; - /* Note: memory allocated by getpwnam() is never freed. * Calling endpwent() apparently doesn't help. */ - pw = getpwnam((char *)dst + 1); - if (pw != NULL) - var = (char_u *)pw->pw_dir; - else - var = NULL; + struct passwd *pw = (*dst == NUL) + ? NULL : getpwnam((char *)dst + 1); + + var = (pw == NULL) ? NULL : (char_u *)pw->pw_dir; } if (var == NULL) # endif @@ -4099,7 +4108,7 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) { char_u test[MAXPATHL], paths[MAXPATHL]; char_u *path, *next_path, *ptr; - struct stat st; + stat_T st; STRCPY(paths, USER_HOME); next_path = paths; @@ -4199,13 +4208,18 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) } else if ((src[0] == ' ' || src[0] == ',') && !one) at_start = TRUE; - *dst++ = *src++; - --dstlen; + if (dstlen > 0) + { + *dst++ = *src++; + --dstlen; - if (startstr != NULL && src - startstr_len >= srcp - && STRNCMP(src - startstr_len, startstr, startstr_len) == 0) - at_start = TRUE; + if (startstr != NULL && src - startstr_len >= srcp + && STRNCMP(src - startstr_len, startstr, + startstr_len) == 0) + at_start = TRUE; + } } + } *dst = NUL; } @@ -4218,15 +4232,13 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr) * initialized to FALSE by the caller. */ char_u * -vim_getenv(name, mustfree) - char_u *name; - int *mustfree; +vim_getenv(char_u *name, int *mustfree) { char_u *p; char_u *pend; int vimruntime; -#if defined(OS2) || defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) /* use "C:/" when $HOME is not set */ if (STRCMP(name, "HOME") == 0) return homedir; @@ -4364,12 +4376,8 @@ vim_getenv(name, mustfree) } /* remove trailing path separator */ -#ifndef MACOS_CLASSIC - /* With MacOS path (with colons) the final colon is required */ - /* to avoid confusion between absolute and relative path */ if (pend > p && after_pathsep(p, pend)) --pend; -#endif #ifdef MACOS_X if (p == exe_name || p == p_hf) @@ -4378,10 +4386,7 @@ vim_getenv(name, mustfree) p = vim_strnsave(p, (int)(pend - p)); if (p != NULL && !mch_isdir(p)) - { - vim_free(p); - p = NULL; - } + VIM_CLEAR(p); else { #ifdef USE_EXE_NAME @@ -4446,8 +4451,7 @@ vim_getenv(name, mustfree) * Return NULL if not, return its name in allocated memory otherwise. */ static char_u * -vim_version_dir(vimdir) - char_u *vimdir; +vim_version_dir(char_u *vimdir) { char_u *p; @@ -4469,10 +4473,7 @@ vim_version_dir(vimdir) * the length of "name/". Otherwise return "pend". */ static char_u * -remove_tail(p, pend, name) - char_u *p; - char_u *pend; - char_u *name; +remove_tail(char_u *p, char_u *pend, char_u *name) { int len = (int)STRLEN(name) + 1; char_u *newend = pend - len; @@ -4484,13 +4485,22 @@ remove_tail(p, pend, name) return pend; } + void +vim_unsetenv(char_u *var) +{ +#ifdef HAVE_UNSETENV + unsetenv((char *)var); +#else + vim_setenv(var, (char_u *)""); +#endif +} + + /* * Our portable version of setenv. */ void -vim_setenv(name, val) - char_u *name; - char_u *val; +vim_setenv(char_u *name, char_u *val) { #ifdef HAVE_SETENV mch_setenv((char *)name, (char *)val, 1); @@ -4531,13 +4541,13 @@ vim_setenv(name, val) * Function given to ExpandGeneric() to obtain an environment variable name. */ char_u * -get_env_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_env_name( + expand_T *xp UNUSED, + int idx) { -# if defined(AMIGA) || defined(__MRC__) || defined(__SC__) +# if defined(AMIGA) /* - * No environ[] on the Amiga and on the Mac (using MPW). + * No environ[] on the Amiga. */ return NULL; # else @@ -4570,7 +4580,7 @@ get_env_name(xp, idx) * Done only once and then cached. */ static void -init_users() +init_users(void) { static int lazy_init_done = FALSE; @@ -4606,9 +4616,7 @@ init_users() * Function given to ExpandGeneric() to obtain an user names. */ char_u* -get_users(xp, idx) - expand_T *xp UNUSED; - int idx; +get_users(expand_T *xp UNUSED, int idx) { init_users(); if (idx < ga_users.ga_len) @@ -4622,8 +4630,7 @@ get_users(xp, idx) * 1 if name partially matches the beginning of a user name. * 2 is name fully matches a user name. */ -int match_user(name) - char_u* name; +int match_user(char_u* name) { int i; int n = (int)STRLEN(name); @@ -4647,12 +4654,12 @@ int match_user(name) * If anything fails (except when out of space) dst equals src. */ void -home_replace(buf, src, dst, dstlen, one) - buf_T *buf; /* when not NULL, check for help files */ - char_u *src; /* input file name */ - char_u *dst; /* where to put the result */ - int dstlen; /* maximum length of the result */ - int one; /* if TRUE, only replace one file name, include +home_replace( + buf_T *buf, /* when not NULL, check for help files */ + char_u *src, /* input file name */ + char_u *dst, /* where to put the result */ + int dstlen, /* maximum length of the result */ + int one) /* if TRUE, only replace one file name, include spaces and commas in the file name. */ { size_t dirlen = 0, envlen = 0; @@ -4671,7 +4678,7 @@ home_replace(buf, src, dst, dstlen, one) */ if (buf != NULL && buf->b_help) { - STRCPY(dst, gettail(src)); + vim_snprintf((char *)dst, dstlen, "%s", gettail(src)); return; } @@ -4686,6 +4693,10 @@ home_replace(buf, src, dst, dstlen, one) homedir_env_orig = homedir_env = mch_getenv((char_u *)"SYS$LOGIN"); #else homedir_env_orig = homedir_env = mch_getenv((char_u *)"HOME"); +#endif +#ifdef WIN3264 + if (homedir_env == NULL) + homedir_env_orig = homedir_env = mch_getenv((char_u *)"USERPROFILE"); #endif /* Empty is the same as not set. */ if (homedir_env != NULL && *homedir_env == NUL) @@ -4771,9 +4782,9 @@ home_replace(buf, src, dst, dstlen, one) * When something fails, NULL is returned. */ char_u * -home_replace_save(buf, src) - buf_T *buf; /* when not NULL, check for help files */ - char_u *src; /* input file name */ +home_replace_save( + buf_T *buf, /* when not NULL, check for help files */ + char_u *src) /* input file name */ { char_u *dst; unsigned len; @@ -4797,15 +4808,16 @@ home_replace_save(buf, src) * For the first name environment variables are expanded */ int -fullpathcmp(s1, s2, checkname) - char_u *s1, *s2; - int checkname; /* when both don't exist, check file names */ +fullpathcmp( + char_u *s1, + char_u *s2, + int checkname) /* when both don't exist, check file names */ { #ifdef UNIX char_u exp1[MAXPATHL]; char_u full1[MAXPATHL]; char_u full2[MAXPATHL]; - struct stat st1, st2; + stat_T st1, st2; int r1, r2; expand_env(s1, exp1, MAXPATHL); @@ -4873,8 +4885,7 @@ fullpathcmp(s1, s2, checkname) * Fail safe: never returns NULL. */ char_u * -gettail(fname) - char_u *fname; +gettail(char_u *fname) { char_u *p1, *p2; @@ -4884,13 +4895,13 @@ gettail(fname) { if (vim_ispathsep_nocolon(*p2)) p1 = p2 + 1; - mb_ptr_adv(p2); + MB_PTR_ADV(p2); } return p1; } #if defined(FEAT_SEARCHPATH) -static char_u *gettail_dir __ARGS((char_u *fname)); +static char_u *gettail_dir(char_u *fname); /* * Return the end of the directory name, on the first path @@ -4899,8 +4910,7 @@ static char_u *gettail_dir __ARGS((char_u *fname)); * ^ ^ ^ ^ */ static char_u * -gettail_dir(fname) - char_u *fname; +gettail_dir(char_u *fname) { char_u *dir_end = fname; char_u *next_dir_end = fname; @@ -4923,7 +4933,7 @@ gettail_dir(fname) dir_end = next_dir_end; look_for_sep = TRUE; } - mb_ptr_adv(p); + MB_PTR_ADV(p); } return dir_end; } @@ -4935,8 +4945,7 @@ gettail_dir(fname) * Always returns a valid pointer. */ char_u * -gettail_sep(fname) - char_u *fname; +gettail_sep(char_u *fname) { char_u *p; char_u *t; @@ -4956,11 +4965,10 @@ gettail_sep(fname) * get the next path component (just after the next path separator). */ char_u * -getnextcomp(fname) - char_u *fname; +getnextcomp(char_u *fname) { while (*fname && !vim_ispathsep(*fname)) - mb_ptr_adv(fname); + MB_PTR_ADV(fname); if (*fname) ++fname; return fname; @@ -4972,12 +4980,11 @@ getnextcomp(fname) * If there is no head, path is returned. */ char_u * -get_past_head(path) - char_u *path; +get_past_head(char_u *path) { char_u *retval; -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) /* may skip "c:" */ if (isalpha(path[0]) && path[1] == ':') retval = path + 2; @@ -5005,8 +5012,7 @@ get_past_head(path) * Note that for MS-Windows this includes the colon. */ int -vim_ispathsep(c) - int c; +vim_ispathsep(int c) { #ifdef UNIX return (c == '/'); /* UNIX has ':' inside file names */ @@ -5029,8 +5035,7 @@ vim_ispathsep(c) * Like vim_ispathsep(c), but exclude the colon for MS-Windows. */ int -vim_ispathsep_nocolon(c) - int c; +vim_ispathsep_nocolon(int c) { return vim_ispathsep(c) #ifdef BACKSLASH_IN_FILENAME @@ -5044,8 +5049,7 @@ vim_ispathsep_nocolon(c) * return TRUE if 'c' is a path list separator. */ int -vim_ispathlistsep(c) - int c; +vim_ispathlistsep(int c) { #ifdef UNIX return (c == ':'); @@ -5055,15 +5059,12 @@ vim_ispathlistsep(c) } #endif -#if defined(FEAT_GUI_TABLINE) || defined(FEAT_WINDOWS) \ - || defined(FEAT_EVAL) || defined(PROTO) /* * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname" * It's done in-place. */ void -shorten_dir(str) - char_u *str; +shorten_dir(char_u *str) { char_u *tail, *s, *d; int skip = FALSE; @@ -5100,7 +5101,6 @@ shorten_dir(str) } } } -#endif /* * Return TRUE if the directory of "fname" exists, FALSE otherwise. @@ -5108,8 +5108,7 @@ shorten_dir(str) * "fname" must be writable!. */ int -dir_of_file_exists(fname) - char_u *fname; +dir_of_file_exists(char_u *fname) { char_u *p; int c; @@ -5130,8 +5129,7 @@ dir_of_file_exists(fname) * and deal with 'fileignorecase'. */ int -vim_fnamecmp(x, y) - char_u *x, *y; +vim_fnamecmp(char_u *x, char_u *y) { #ifdef BACKSLASH_IN_FILENAME return vim_fnamencmp(x, y, MAXPATHL); @@ -5143,9 +5141,7 @@ vim_fnamecmp(x, y) } int -vim_fnamencmp(x, y, len) - char_u *x, *y; - size_t len; +vim_fnamencmp(char_u *x, char_u *y, size_t len) { #ifdef BACKSLASH_IN_FILENAME char_u *px = x; @@ -5181,10 +5177,7 @@ vim_fnamencmp(x, y, len) * Only add a '/' or '\\' when 'sep' is TRUE and it is necessary. */ char_u * -concat_fnames(fname1, fname2, sep) - char_u *fname1; - char_u *fname2; - int sep; +concat_fnames(char_u *fname1, char_u *fname2, int sep) { char_u *dest; @@ -5204,9 +5197,7 @@ concat_fnames(fname1, fname2, sep) * Returns NULL when out of memory. */ char_u * -concat_str(str1, str2) - char_u *str1; - char_u *str2; +concat_str(char_u *str1, char_u *str2) { char_u *dest; size_t l = STRLEN(str1); @@ -5225,8 +5216,7 @@ concat_str(str1, str2) * separator. */ void -add_pathsep(p) - char_u *p; +add_pathsep(char_u *p) { if (*p != NUL && !after_pathsep(p, p + STRLEN(p))) STRCAT(p, PATHSEPSTR); @@ -5237,9 +5227,9 @@ add_pathsep(p) * Returns NULL when out of memory. */ char_u * -FullName_save(fname, force) - char_u *fname; - int force; /* force expansion, even when it already looks +FullName_save( + char_u *fname, + int force) /* force expansion, even when it already looks * like a full path name */ { char_u *buf; @@ -5262,22 +5252,24 @@ FullName_save(fname, force) #if defined(FEAT_CINDENT) || defined(FEAT_SYN_HL) -static char_u *skip_string __ARGS((char_u *p)); -static pos_T *ind_find_start_comment __ARGS((void)); +static char_u *skip_string(char_u *p); +static pos_T *ind_find_start_comment(void); +static pos_T *ind_find_start_CORS(linenr_T *is_raw); +static pos_T *find_start_rawstring(int ind_maxcomment); /* * Find the start of a comment, not knowing if we are in a comment right now. * Search starts at w_cursor.lnum and goes backwards. + * Return NULL when not inside a comment. */ static pos_T * -ind_find_start_comment() /* XXX */ +ind_find_start_comment(void) /* XXX */ { return find_start_comment(curbuf->b_ind_maxcomment); } pos_T * -find_start_comment(ind_maxcomment) /* XXX */ - int ind_maxcomment; +find_start_comment(int ind_maxcomment) /* XXX */ { pos_T *pos; char_u *line; @@ -5309,13 +5301,87 @@ find_start_comment(ind_maxcomment) /* XXX */ return pos; } +/* + * Find the start of a comment or raw string, not knowing if we are in a + * comment or raw string right now. + * Search starts at w_cursor.lnum and goes backwards. + * If is_raw is given and returns start of raw_string, sets it to true. + * Return NULL when not inside a comment or raw string. + * "CORS" -> Comment Or Raw String + */ + static pos_T * +ind_find_start_CORS(linenr_T *is_raw) /* XXX */ +{ + static pos_T comment_pos_copy; + pos_T *comment_pos; + pos_T *rs_pos; + + comment_pos = find_start_comment(curbuf->b_ind_maxcomment); + if (comment_pos != NULL) + { + /* Need to make a copy of the static pos in findmatchlimit(), + * calling find_start_rawstring() may change it. */ + comment_pos_copy = *comment_pos; + comment_pos = &comment_pos_copy; + } + rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment); + + /* If comment_pos is before rs_pos the raw string is inside the comment. + * If rs_pos is before comment_pos the comment is inside the raw string. */ + if (comment_pos == NULL || (rs_pos != NULL + && LT_POS(*rs_pos, *comment_pos))) + { + if (is_raw != NULL && rs_pos != NULL) + *is_raw = rs_pos->lnum; + return rs_pos; + } + return comment_pos; +} + +/* + * Find the start of a raw string, not knowing if we are in one right now. + * Search starts at w_cursor.lnum and goes backwards. + * Return NULL when not inside a raw string. + */ + static pos_T * +find_start_rawstring(int ind_maxcomment) /* XXX */ +{ + pos_T *pos; + char_u *line; + char_u *p; + int cur_maxcomment = ind_maxcomment; + + for (;;) + { + pos = findmatchlimit(NULL, 'R', FM_BACKWARD, cur_maxcomment); + if (pos == NULL) + break; + + /* + * Check if the raw string start we found is inside a string. + * If it is then restrict the search to below this line and try again. + */ + line = ml_get(pos->lnum); + for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p) + p = skip_string(p); + if ((colnr_T)(p - line) <= pos->col) + break; + cur_maxcomment = curwin->w_cursor.lnum - pos->lnum - 1; + if (cur_maxcomment <= 0) + { + pos = NULL; + break; + } + } + return pos; +} + /* * Skip to the end of a "string" and a 'c' character. * If there is no string or character, return argument unmodified. */ static char_u * -skip_string(p) - char_u *p; +skip_string(char_u *p) { int i; @@ -5351,9 +5417,30 @@ skip_string(p) break; } if (p[0] == '"') - continue; + continue; /* continue for another string */ } - break; /* no string found */ + else if (p[0] == 'R' && p[1] == '"') + { + /* Raw string: R"[delim](...)[delim]" */ + char_u *delim = p + 2; + char_u *paren = vim_strchr(delim, '('); + + if (paren != NULL) + { + size_t delim_len = paren - delim; + + for (p += 3; *p; ++p) + if (p[0] == ')' && STRNCMP(p + 1, delim, delim_len) == 0 + && p[delim_len + 1] == '"') + { + p += delim_len + 1; + break; + } + if (p[0] == '"') + continue; /* continue for another string */ + } + } + break; /* no string found */ } if (!*p) --p; /* backup from NUL */ @@ -5367,7 +5454,7 @@ skip_string(p) * Do C or expression indenting on the current line. */ void -do_c_expr_indent() +do_c_expr_indent(void) { # ifdef FEAT_EVAL if (*curbuf->b_p_inde != NUL) @@ -5377,6 +5464,12 @@ do_c_expr_indent() fixthisline(get_c_indent); } +/* Find result cache for cpp_baseclass */ +typedef struct { + int found; + lpos_T lpos; +} cpp_baseclass_cache_T; + /* * Functions for C-indenting. * Most of this originally comes from Eric Fischer. @@ -5385,51 +5478,49 @@ do_c_expr_indent() * Below "XXX" means that this function may unlock the current line. */ -static char_u *cin_skipcomment __ARGS((char_u *)); -static int cin_nocode __ARGS((char_u *)); -static pos_T *find_line_comment __ARGS((void)); -static int cin_has_js_key __ARGS((char_u *text)); -static int cin_islabel_skip __ARGS((char_u **)); -static int cin_isdefault __ARGS((char_u *)); -static char_u *after_label __ARGS((char_u *l)); -static int get_indent_nolabel __ARGS((linenr_T lnum)); -static int skip_label __ARGS((linenr_T, char_u **pp)); -static int cin_first_id_amount __ARGS((void)); -static int cin_get_equal_amount __ARGS((linenr_T lnum)); -static int cin_ispreproc __ARGS((char_u *)); -static int cin_ispreproc_cont __ARGS((char_u **pp, linenr_T *lnump)); -static int cin_iscomment __ARGS((char_u *)); -static int cin_islinecomment __ARGS((char_u *)); -static int cin_isterminated __ARGS((char_u *, int, int)); -static int cin_isinit __ARGS((void)); -static int cin_isfuncdecl __ARGS((char_u **, linenr_T, linenr_T)); -static int cin_isif __ARGS((char_u *)); -static int cin_iselse __ARGS((char_u *)); -static int cin_isdo __ARGS((char_u *)); -static int cin_iswhileofdo __ARGS((char_u *, linenr_T)); -static int cin_is_if_for_while_before_offset __ARGS((char_u *line, int *poffset)); -static int cin_iswhileofdo_end __ARGS((int terminated)); -static int cin_isbreak __ARGS((char_u *)); -static int cin_is_cpp_baseclass __ARGS((colnr_T *col)); -static int get_baseclass_amount __ARGS((int col)); -static int cin_ends_in __ARGS((char_u *, char_u *, char_u *)); -static int cin_starts_with __ARGS((char_u *s, char *word)); -static int cin_skip2pos __ARGS((pos_T *trypos)); -static pos_T *find_start_brace __ARGS((void)); -static pos_T *find_match_paren __ARGS((int)); -static pos_T *find_match_char __ARGS((int c, int ind_maxparen)); -static int corr_ind_maxparen __ARGS((pos_T *startpos)); -static int find_last_paren __ARGS((char_u *l, int start, int end)); -static int find_match __ARGS((int lookfor, linenr_T ourscope)); -static int cin_is_cpp_namespace __ARGS((char_u *)); +static char_u *cin_skipcomment(char_u *); +static int cin_nocode(char_u *); +static pos_T *find_line_comment(void); +static int cin_has_js_key(char_u *text); +static int cin_islabel_skip(char_u **); +static int cin_isdefault(char_u *); +static char_u *after_label(char_u *l); +static int get_indent_nolabel(linenr_T lnum); +static int skip_label(linenr_T, char_u **pp); +static int cin_first_id_amount(void); +static int cin_get_equal_amount(linenr_T lnum); +static int cin_ispreproc(char_u *); +static int cin_iscomment(char_u *); +static int cin_islinecomment(char_u *); +static int cin_isterminated(char_u *, int, int); +static int cin_isinit(void); +static int cin_isfuncdecl(char_u **, linenr_T, linenr_T); +static int cin_isif(char_u *); +static int cin_iselse(char_u *); +static int cin_isdo(char_u *); +static int cin_iswhileofdo(char_u *, linenr_T); +static int cin_is_if_for_while_before_offset(char_u *line, int *poffset); +static int cin_iswhileofdo_end(int terminated); +static int cin_isbreak(char_u *); +static int cin_is_cpp_baseclass(cpp_baseclass_cache_T *cached); +static int get_baseclass_amount(int col); +static int cin_ends_in(char_u *, char_u *, char_u *); +static int cin_starts_with(char_u *s, char *word); +static int cin_skip2pos(pos_T *trypos); +static pos_T *find_start_brace(void); +static pos_T *find_match_paren(int); +static pos_T *find_match_char(int c, int ind_maxparen); +static int corr_ind_maxparen(pos_T *startpos); +static int find_last_paren(char_u *l, int start, int end); +static int find_match(int lookfor, linenr_T ourscope); +static int cin_is_cpp_namespace(char_u *); /* * Skip over white space and C comments within the line. * Also skip over Perl/shell comments if desired. */ static char_u * -cin_skipcomment(s) - char_u *s; +cin_skipcomment(char_u *s) { while (*s) { @@ -5469,8 +5560,7 @@ cin_skipcomment(s) * not considered code. */ static int -cin_nocode(s) - char_u *s; +cin_nocode(char_u *s) { return *cin_skipcomment(s) == NUL; } @@ -5479,7 +5569,7 @@ cin_nocode(s) * Check previous lines for a "//" line comment, skipping over blank lines. */ static pos_T * -find_line_comment() /* XXX */ +find_line_comment(void) /* XXX */ { static pos_T pos; char_u *line; @@ -5505,11 +5595,10 @@ find_line_comment() /* XXX */ * Return TRUE if "text" starts with "key:". */ static int -cin_has_js_key(text) - char_u *text; +cin_has_js_key(char_u *text) { char_u *s = skipwhite(text); - int quote = 0; + int quote = -1; if (*s == '\'' || *s == '"') { @@ -5536,8 +5625,7 @@ cin_has_js_key(text) * "*s" must point to the start of the label, if there is one. */ static int -cin_islabel_skip(s) - char_u **s; +cin_islabel_skip(char_u **s) { if (!vim_isIDc(**s)) /* need at least one ID character */ return FALSE; @@ -5556,7 +5644,7 @@ cin_islabel_skip(s) * Note: curwin->w_cursor must be where we are looking for the label. */ int -cin_islabel() /* XXX */ +cin_islabel(void) /* XXX */ { char_u *s; @@ -5587,10 +5675,11 @@ cin_islabel() /* XXX */ --curwin->w_cursor.lnum; /* - * If we're in a comment now, skip to the start of the comment. + * If we're in a comment or raw string now, skip to the start of + * it. */ curwin->w_cursor.col = 0; - if ((trypos = ind_find_start_comment()) != NULL) /* XXX */ + if ((trypos = ind_find_start_CORS(NULL)) != NULL) /* XXX */ curwin->w_cursor = *trypos; line = ml_get_curline(); @@ -5660,9 +5749,9 @@ cin_isinit(void) * Recognize a switch label: "case .*:" or "default:". */ int -cin_iscase(s, strict) - char_u *s; - int strict; /* Allow relaxed check of case statement for JS */ +cin_iscase( + char_u *s, + int strict) /* Allow relaxed check of case statement for JS */ { s = cin_skipcomment(s); if (cin_starts_with(s, "case")) @@ -5702,8 +5791,7 @@ cin_iscase(s, strict) * Recognize a "default" switch label. */ static int -cin_isdefault(s) - char_u *s; +cin_isdefault(char_u *s) { return (STRNCMP(s, "default", 7) == 0 && *(s = cin_skipcomment(s + 7)) == ':' @@ -5714,8 +5802,7 @@ cin_isdefault(s) * Recognize a "public/private/protected" scope declaration label. */ int -cin_isscopedecl(s) - char_u *s; +cin_isscopedecl(char_u *s) { int i; @@ -5738,11 +5825,11 @@ cin_isscopedecl(s) * Recognize a "namespace" scope declaration. */ static int -cin_is_cpp_namespace(s) - char_u *s; +cin_is_cpp_namespace(char_u *s) { char_u *p; int has_name = FALSE; + int has_name_start = FALSE; s = cin_skipcomment(s); if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) @@ -5750,7 +5837,7 @@ cin_is_cpp_namespace(s) p = cin_skipcomment(skipwhite(s + 9)); while (*p != NUL) { - if (vim_iswhite(*p)) + if (VIM_ISWHITE(*p)) { has_name = TRUE; /* found end of a name */ p = cin_skipcomment(skipwhite(p)); @@ -5761,10 +5848,18 @@ cin_is_cpp_namespace(s) } else if (vim_iswordc(*p)) { + has_name_start = TRUE; if (has_name) return FALSE; /* word character after skipping past name */ ++p; } + else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) + { + if (!has_name_start || has_name) + return FALSE; + /* C++ 17 nested namespace */ + p += 3; + } else { return FALSE; @@ -5775,6 +5870,54 @@ cin_is_cpp_namespace(s) return FALSE; } +/* + * Recognize a `extern "C"` or `extern "C++"` linkage specifications. + */ + static int +cin_is_cpp_extern_c(char_u *s) +{ + char_u *p; + int has_string_literal = FALSE; + + s = cin_skipcomment(s); + if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) + { + p = cin_skipcomment(skipwhite(s + 6)); + while (*p != NUL) + { + if (VIM_ISWHITE(*p)) + { + p = cin_skipcomment(skipwhite(p)); + } + else if (*p == '{') + { + break; + } + else if (p[0] == '"' && p[1] == 'C' && p[2] == '"') + { + if (has_string_literal) + return FALSE; + has_string_literal = TRUE; + p += 3; + } + else if (p[0] == '"' && p[1] == 'C' && p[2] == '+' && p[3] == '+' + && p[4] == '"') + { + if (has_string_literal) + return FALSE; + has_string_literal = TRUE; + p += 5; + } + else + { + return FALSE; + } + } + return has_string_literal ? TRUE : FALSE; + } + return FALSE; +} + /* * Return a pointer to the first non-empty non-comment character after a ':'. * Return NULL if not found. @@ -5782,8 +5925,7 @@ cin_is_cpp_namespace(s) * ^ */ static char_u * -after_label(l) - char_u *l; +after_label(char_u *l) { for ( ; *l; ++l) { @@ -5810,8 +5952,7 @@ after_label(l) * Return 0 if there is nothing after the label. */ static int -get_indent_nolabel(lnum) /* XXX */ - linenr_T lnum; +get_indent_nolabel (linenr_T lnum) /* XXX */ { char_u *l; pos_T fp; @@ -5836,9 +5977,7 @@ get_indent_nolabel(lnum) /* XXX */ * ^ */ static int -skip_label(lnum, pp) - linenr_T lnum; - char_u **pp; +skip_label(linenr_T lnum, char_u **pp) { char_u *l; int amount; @@ -5874,7 +6013,7 @@ skip_label(lnum, pp) * Returns zero when it doesn't look like a declaration. */ static int -cin_first_id_amount() +cin_first_id_amount(void) { char_u *line, *p, *s; int len; @@ -5897,15 +6036,15 @@ cin_first_id_amount() || (len == 6 && STRNCMP(p, "signed", 6) == 0)) { s = skipwhite(p + len); - if ((STRNCMP(s, "int", 3) == 0 && vim_iswhite(s[3])) - || (STRNCMP(s, "long", 4) == 0 && vim_iswhite(s[4])) - || (STRNCMP(s, "short", 5) == 0 && vim_iswhite(s[5])) - || (STRNCMP(s, "char", 4) == 0 && vim_iswhite(s[4]))) + if ((STRNCMP(s, "int", 3) == 0 && VIM_ISWHITE(s[3])) + || (STRNCMP(s, "long", 4) == 0 && VIM_ISWHITE(s[4])) + || (STRNCMP(s, "short", 5) == 0 && VIM_ISWHITE(s[5])) + || (STRNCMP(s, "char", 4) == 0 && VIM_ISWHITE(s[4]))) p = s; } for (len = 0; vim_isIDc(p[len]); ++len) ; - if (len == 0 || !vim_iswhite(p[len]) || cin_nocode(p)) + if (len == 0 || !VIM_ISWHITE(p[len]) || cin_nocode(p)) return 0; p = skipwhite(p + len); @@ -5925,8 +6064,7 @@ cin_first_id_amount() * here"; */ static int -cin_get_equal_amount(lnum) - linenr_T lnum; +cin_get_equal_amount(linenr_T lnum) { char_u *line; char_u *s; @@ -5968,8 +6106,7 @@ cin_get_equal_amount(lnum) * Recognize a preprocessor statement: Any line that starts with '#'. */ static int -cin_ispreproc(s) - char_u *s; +cin_ispreproc(char_u *s) { if (*skipwhite(s) == '#') return TRUE; @@ -5980,15 +6117,18 @@ cin_ispreproc(s) * Return TRUE if line "*pp" at "*lnump" is a preprocessor statement or a * continuation line of a preprocessor statement. Decrease "*lnump" to the * start and return the line in "*pp". + * Put the amount of indent in "*amount". */ static int -cin_ispreproc_cont(pp, lnump) - char_u **pp; - linenr_T *lnump; +cin_ispreproc_cont(char_u **pp, linenr_T *lnump, int *amount) { char_u *line = *pp; linenr_T lnum = *lnump; int retval = FALSE; + int candidate_amount = *amount; + + if (*line != NUL && line[STRLEN(line) - 1] == '\\') + candidate_amount = get_indent_lnum(lnum); for (;;) { @@ -6007,6 +6147,8 @@ cin_ispreproc_cont(pp, lnump) if (lnum != *lnump) *pp = ml_get(*lnump); + if (retval) + *amount = candidate_amount; return retval; } @@ -6014,8 +6156,7 @@ cin_ispreproc_cont(pp, lnump) * Recognize the start of a C or C++ comment. */ static int -cin_iscomment(p) - char_u *p; +cin_iscomment(char_u *p) { return (p[0] == '/' && (p[1] == '*' || p[1] == '/')); } @@ -6024,8 +6165,7 @@ cin_iscomment(p) * Recognize the start of a "//" comment. */ static int -cin_islinecomment(p) - char_u *p; +cin_islinecomment(char_u *p) { return (p[0] == '/' && p[1] == '/'); } @@ -6040,10 +6180,10 @@ cin_islinecomment(p) * both apply in order to determine initializations). */ static int -cin_isterminated(s, incl_open, incl_comma) - char_u *s; - int incl_open; /* include '{' at the end as terminator */ - int incl_comma; /* recognize a trailing comma */ +cin_isterminated( + char_u *s, + int incl_open, /* include '{' at the end as terminator */ + int incl_comma) /* recognize a trailing comma */ { char_u found_start = 0; unsigned n_open = 0; @@ -6088,17 +6228,18 @@ cin_isterminated(s, incl_open, incl_comma) * When a line ends in a comma we continue looking in the next line. * "sp" points to a string with the line. When looking at other lines it must * be restored to the line. When it's NULL fetch lines here. - * "lnum" is where we start looking. + * "first_lnum" is where we start looking. * "min_lnum" is the line before which we will not be looking. */ static int -cin_isfuncdecl(sp, first_lnum, min_lnum) - char_u **sp; - linenr_T first_lnum; - linenr_T min_lnum; +cin_isfuncdecl( + char_u **sp, + linenr_T first_lnum, + linenr_T min_lnum) { char_u *s; linenr_T lnum = first_lnum; + linenr_T save_lnum = curwin->w_cursor.lnum; int retval = FALSE; pos_T *trypos; int just_started = TRUE; @@ -6108,15 +6249,20 @@ cin_isfuncdecl(sp, first_lnum, min_lnum) else s = *sp; + curwin->w_cursor.lnum = lnum; if (find_last_paren(s, '(', ')') && (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL) { lnum = trypos->lnum; if (lnum < min_lnum) + { + curwin->w_cursor.lnum = save_lnum; return FALSE; + } s = ml_get(lnum); } + curwin->w_cursor.lnum = save_lnum; /* Ignore line starting with #. */ if (cin_ispreproc(s)) @@ -6126,6 +6272,19 @@ cin_isfuncdecl(sp, first_lnum, min_lnum) { if (cin_iscomment(s)) /* ignore comments */ s = cin_skipcomment(s); + else if (*s == ':') + { + if (*(s + 1) == ':') + s += 2; + else + /* To avoid a mistake in the following situation: + * A::A(int a, int b) + * : a(0) // <--not a function decl + * , b(0) + * {... + */ + return FALSE; + } else ++s; } @@ -6189,15 +6348,14 @@ cin_isfuncdecl(sp, first_lnum, min_lnum) } static int -cin_isif(p) - char_u *p; +cin_isif(char_u *p) { - return (STRNCMP(p, "if", 2) == 0 && !vim_isIDc(p[2])); + return (STRNCMP(p, "if", 2) == 0 && !vim_isIDc(p[2])); } static int -cin_iselse(p) - char_u *p; +cin_iselse( + char_u *p) { if (*p == '}') /* accept "} else" */ p = cin_skipcomment(p + 1); @@ -6205,8 +6363,7 @@ cin_iselse(p) } static int -cin_isdo(p) - char_u *p; +cin_isdo(char_u *p) { return (STRNCMP(p, "do", 2) == 0 && !vim_isIDc(p[2])); } @@ -6217,9 +6374,7 @@ cin_isdo(p) * ')' and ';'. The condition may be spread over several lines. */ static int -cin_iswhileofdo(p, lnum) /* XXX */ - char_u *p; - linenr_T lnum; +cin_iswhileofdo (char_u *p, linenr_T lnum) /* XXX */ { pos_T cursor_save; pos_T *trypos; @@ -6255,15 +6410,13 @@ cin_iswhileofdo(p, lnum) /* XXX */ * string was found. */ static int -cin_is_if_for_while_before_offset(line, poffset) - char_u *line; - int *poffset; +cin_is_if_for_while_before_offset(char_u *line, int *poffset) { int offset = *poffset; if (offset-- < 2) return 0; - while (offset > 2 && vim_iswhite(line[offset])) + while (offset > 2 && VIM_ISWHITE(line[offset])) --offset; offset -= 1; @@ -6303,8 +6456,7 @@ cin_is_if_for_while_before_offset(line, poffset) * Adjust the cursor to the line with "while". */ static int -cin_iswhileofdo_end(terminated) - int terminated; +cin_iswhileofdo_end(int terminated) { char_u *line; char_u *p; @@ -6353,8 +6505,7 @@ cin_iswhileofdo_end(terminated) } static int -cin_isbreak(p) - char_u *p; +cin_isbreak(char_u *p) { return (STRNCMP(p, "break", 5) == 0 && !vim_isIDc(p[5])); } @@ -6373,15 +6524,19 @@ cin_isbreak(p) * This is a lot of guessing. Watch out for "cond ? func() : foo". */ static int -cin_is_cpp_baseclass(col) - colnr_T *col; /* return: column to align with */ +cin_is_cpp_baseclass( + cpp_baseclass_cache_T *cached) /* input and output */ { + lpos_T *pos = &cached->lpos; /* find position */ char_u *s; int class_or_struct, lookfor_ctor_init, cpp_base_class; linenr_T lnum = curwin->w_cursor.lnum; char_u *line = ml_get_curline(); - *col = 0; + if (pos->lnum <= lnum) + return cached->found; /* Use the cached result */ + + pos->col = 0; s = skipwhite(line); if (*s == '#') /* skip #define FOO x ? (x) : x */ @@ -6425,8 +6580,9 @@ cin_is_cpp_baseclass(col) --lnum; } + pos->lnum = lnum; line = ml_get(lnum); - s = cin_skipcomment(line); + s = line; for (;;) { if (*s == NUL) @@ -6435,12 +6591,19 @@ cin_is_cpp_baseclass(col) break; /* Continue in the cursor line. */ line = ml_get(++lnum); + s = line; + } + if (s == line) + { + /* don't recognize "case (foo):" as a baseclass */ + if (cin_iscase(s, FALSE)) + break; s = cin_skipcomment(line); if (*s == NUL) continue; } - if (s[0] == '"') + if (s[0] == '"' || (s[0] == 'R' && s[1] == '"')) s = skip_string(s) + 1; else if (s[0] == ':') { @@ -6457,7 +6620,7 @@ cin_is_cpp_baseclass(col) * cpp-base-class-declaration or constructor-initialization */ cpp_base_class = TRUE; lookfor_ctor_init = class_or_struct = FALSE; - *col = 0; + pos->col = 0; s = cin_skipcomment(s + 1); } else @@ -6498,30 +6661,32 @@ cin_is_cpp_baseclass(col) class_or_struct = FALSE; lookfor_ctor_init = FALSE; } - else if (*col == 0) + else if (pos->col == 0) { /* it can't be a constructor-initialization any more */ lookfor_ctor_init = FALSE; /* the first statement starts here: lineup with this one... */ if (cpp_base_class) - *col = (colnr_T)(s - line); + pos->col = (colnr_T)(s - line); } /* When the line ends in a comma don't align with it. */ if (lnum == curwin->w_cursor.lnum && *s == ',' && cin_nocode(s + 1)) - *col = 0; + pos->col = 0; s = cin_skipcomment(s + 1); } } + cached->found = cpp_base_class; + if (cpp_base_class) + pos->lnum = lnum; return cpp_base_class; } static int -get_baseclass_amount(col) - int col; +get_baseclass_amount(int col) { int amount; colnr_T vcol; @@ -6553,10 +6718,7 @@ get_baseclass_amount(col) * Ignore "ignore" after "find" if it's not NULL. */ static int -cin_ends_in(s, find, ignore) - char_u *s; - char_u *find; - char_u *ignore; +cin_ends_in(char_u *s, char_u *find, char_u *ignore) { char_u *p = s; char_u *r; @@ -6583,9 +6745,7 @@ cin_ends_in(s, find, ignore) * Return TRUE when "s" starts with "word" and then a non-ID character. */ static int -cin_starts_with(s, word) - char_u *s; - char *word; +cin_starts_with(char_u *s, char *word) { int l = (int)STRLEN(word); @@ -6597,11 +6757,11 @@ cin_starts_with(s, word) * Return the column found. */ static int -cin_skip2pos(trypos) - pos_T *trypos; +cin_skip2pos(pos_T *trypos) { char_u *line; char_u *p; + char_u *new_p; p = line = ml_get(trypos->lnum); while (*p && (colnr_T)(p - line) < trypos->col) @@ -6610,8 +6770,11 @@ cin_skip2pos(trypos) p = cin_skipcomment(p); else { - p = skip_string(p); - ++p; + new_p = skip_string(p); + if (new_p == p) + ++p; + else + p = new_p; } } return (int)(p - line); @@ -6627,7 +6790,7 @@ cin_skip2pos(trypos) /* } */ static pos_T * -find_start_brace() /* XXX */ +find_start_brace(void) /* XXX */ { pos_T cursor_save; pos_T *trypos; @@ -6643,7 +6806,7 @@ find_start_brace() /* XXX */ pos = NULL; /* ignore the { if it's in a // or / * * / comment */ if ((colnr_T)cin_skip2pos(trypos) == trypos->col - && (pos = ind_find_start_comment()) == NULL) /* XXX */ + && (pos = ind_find_start_CORS(NULL)) == NULL) /* XXX */ break; if (pos != NULL) curwin->w_cursor.lnum = pos->lnum; @@ -6657,34 +6820,54 @@ find_start_brace() /* XXX */ * Return NULL if no match found. */ static pos_T * -find_match_paren(ind_maxparen) /* XXX */ - int ind_maxparen; +find_match_paren(int ind_maxparen) /* XXX */ { return find_match_char('(', ind_maxparen); } static pos_T * -find_match_char(c, ind_maxparen) /* XXX */ - int c; - int ind_maxparen; +find_match_char (int c, int ind_maxparen) /* XXX */ { pos_T cursor_save; pos_T *trypos; static pos_T pos_copy; + int ind_maxp_wk; cursor_save = curwin->w_cursor; - if ((trypos = findmatchlimit(NULL, c, 0, ind_maxparen)) != NULL) + ind_maxp_wk = ind_maxparen; +retry: + if ((trypos = findmatchlimit(NULL, c, 0, ind_maxp_wk)) != NULL) { /* check if the ( is in a // comment */ if ((colnr_T)cin_skip2pos(trypos) > trypos->col) + { + ind_maxp_wk = ind_maxparen - (int)(cursor_save.lnum - trypos->lnum); + if (ind_maxp_wk > 0) + { + curwin->w_cursor = *trypos; + curwin->w_cursor.col = 0; /* XXX */ + goto retry; + } trypos = NULL; + } else { + pos_T *trypos_wk; + pos_copy = *trypos; /* copy trypos, findmatch will change it */ trypos = &pos_copy; curwin->w_cursor = *trypos; - if (ind_find_start_comment() != NULL) /* XXX */ + if ((trypos_wk = ind_find_start_CORS(NULL)) != NULL) /* XXX */ + { + ind_maxp_wk = ind_maxparen - (int)(cursor_save.lnum + - trypos_wk->lnum); + if (ind_maxp_wk > 0) + { + curwin->w_cursor = *trypos_wk; + goto retry; + } trypos = NULL; + } } } curwin->w_cursor = cursor_save; @@ -6697,8 +6880,7 @@ find_match_char(c, ind_maxparen) /* XXX */ * Return NULL if no match found. */ static pos_T * -find_match_paren_after_brace(ind_maxparen) /* XXX */ - int ind_maxparen; +find_match_paren_after_brace (int ind_maxparen) /* XXX */ { pos_T *trypos = find_match_paren(ind_maxparen); @@ -6724,8 +6906,7 @@ find_match_paren_after_brace(ind_maxparen) /* XXX */ * looking a few lines further. */ static int -corr_ind_maxparen(startpos) - pos_T *startpos; +corr_ind_maxparen(pos_T *startpos) { long n = (long)startpos->lnum - (long)curwin->w_cursor.lnum; @@ -6739,9 +6920,7 @@ corr_ind_maxparen(startpos) * line "l". "l" must point to the start of the line. */ static int -find_last_paren(l, start, end) - char_u *l; - int start, end; +find_last_paren(char_u *l, int start, int end) { int i; int retval = FALSE; @@ -6774,8 +6953,7 @@ find_last_paren(l, start, end) * Must be called when 'cinoptions', 'shiftwidth' and/or 'tabstop' changes. */ void -parse_cino(buf) - buf_T *buf; +parse_cino(buf_T *buf) { char_u *p; char_u *l; @@ -6909,6 +7087,12 @@ parse_cino(buf) * while(). */ buf->b_ind_if_for_while = 0; + /* indentation for # comments */ + buf->b_ind_hash_comment = 0; + + /* Handle C++ extern "C" or "C++" */ + buf->b_ind_cpp_extern_c = 0; + for (p = buf->b_p_cino; *p; ) { l = p++; @@ -6983,14 +7167,19 @@ parse_cino(buf) case '#': buf->b_ind_hash_comment = n; break; case 'N': buf->b_ind_cpp_namespace = n; break; case 'k': buf->b_ind_if_for_while = n; break; + case 'E': buf->b_ind_cpp_extern_c = n; break; } if (*p == ',') ++p; } } +/* + * Return the desired indent for C code. + * Return -1 if the indent should be left alone (inside a raw string). + */ int -get_c_indent() +get_c_indent(void) { pos_T cur_curpos; int amount; @@ -7000,7 +7189,9 @@ get_c_indent() char_u *theline; char_u *linecopy; pos_T *trypos; + pos_T *comment_pos; pos_T *tryposBrace = NULL; + pos_T tryposCopy; pos_T our_paren_pos; char_u *start; int start_brace; @@ -7024,7 +7215,7 @@ get_c_indent() #define LOOKFOR_CPP_BASECLASS 9 #define LOOKFOR_ENUM_OR_INIT 10 #define LOOKFOR_JS_KEY 11 -#define LOOKFOR_NO_COMMA 12 +#define LOOKFOR_COMMA 12 int whilelevel; linenr_T lnum; @@ -7036,6 +7227,8 @@ get_c_indent() int original_line_islabel; int added_to_amount = 0; int js_cur_has_key = 0; + linenr_T raw_string_start = 0; + cpp_baseclass_cache_T cache_cpp_baseclass = { FALSE, { MAXLNUM, 0 } }; /* make a copy, value is changed below */ int ind_continuation = curbuf->b_ind_continuation; @@ -7043,7 +7236,7 @@ get_c_indent() /* remember where the cursor was when we started */ cur_curpos = curwin->w_cursor; - /* if we are at line 1 0 is fine, right? */ + /* if we are at line 1 zero indent is fine, right? */ if (cur_curpos.lnum == 1) return 0; @@ -7074,42 +7267,64 @@ get_c_indent() original_line_islabel = cin_islabel(); /* XXX */ + /* + * If we are inside a raw string don't change the indent. + * Ignore a raw string inside a comment. + */ + comment_pos = ind_find_start_comment(); + if (comment_pos != NULL) + { + /* findmatchlimit() static pos is overwritten, make a copy */ + tryposCopy = *comment_pos; + comment_pos = &tryposCopy; + } + trypos = find_start_rawstring(curbuf->b_ind_maxcomment); + if (trypos != NULL && (comment_pos == NULL + || LT_POS(*trypos, *comment_pos))) + { + amount = -1; + goto laterend; + } + /* * #defines and so on always go at the left when included in 'cinkeys'. */ if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE))) + { amount = curbuf->b_ind_hash_comment; + goto theend; + } /* * Is it a non-case label? Then that goes at the left margin too unless: * - JS flag is set. * - 'L' item has a positive value. */ - else if (original_line_islabel && !curbuf->b_ind_js + if (original_line_islabel && !curbuf->b_ind_js && curbuf->b_ind_jump_label < 0) { amount = 0; + goto theend; } /* * If we're inside a "//" comment and there is a "//" comment in a * previous line, lineup with that one. */ - else if (cin_islinecomment(theline) + if (cin_islinecomment(theline) && (trypos = find_line_comment()) != NULL) /* XXX */ { /* find how indented the line beginning the comment is */ getvcol(curwin, trypos, &col, NULL, NULL); amount = col; + goto theend; } /* * If we're inside a comment and not looking at the start of the * comment, try using the 'comments' option. */ - else if (!cin_iscomment(theline) - && (trypos = ind_find_start_comment()) != NULL) - /* XXX */ + if (!cin_iscomment(theline) && comment_pos != NULL) /* XXX */ { int lead_start_len = 2; int lead_middle_len = 1; @@ -7122,7 +7337,7 @@ get_c_indent() int done = FALSE; /* find how indented the line beginning the comment is */ - getvcol(curwin, trypos, &col, NULL, NULL); + getvcol(curwin, comment_pos, &col, NULL, NULL); amount = col; *lead_start = NUL; *lead_middle = NUL; @@ -7186,7 +7401,7 @@ get_c_indent() } /* If the start comment string doesn't match with the * start of the comment, skip this entry. XXX */ - else if (STRNCMP(ml_get(trypos->lnum) + trypos->col, + else if (STRNCMP(ml_get(comment_pos->lnum) + comment_pos->col, lead_start, lead_start_len) != 0) continue; } @@ -7234,7 +7449,7 @@ get_c_indent() * otherwise, add the amount specified by "c" in 'cino' */ amount = -1; - for (lnum = cur_curpos.lnum - 1; lnum > trypos->lnum; --lnum) + for (lnum = cur_curpos.lnum - 1; lnum > comment_pos->lnum; --lnum) { if (linewhite(lnum)) /* skip blank lines */ continue; @@ -7245,33 +7460,35 @@ get_c_indent() { if (!curbuf->b_ind_in_comment2) { - start = ml_get(trypos->lnum); - look = start + trypos->col + 2; /* skip / and * */ + start = ml_get(comment_pos->lnum); + look = start + comment_pos->col + 2; /* skip / and * */ if (*look != NUL) /* if something after it */ - trypos->col = (colnr_T)(skipwhite(look) - start); + comment_pos->col = (colnr_T)(skipwhite(look) - start); } - getvcol(curwin, trypos, &col, NULL, NULL); + getvcol(curwin, comment_pos, &col, NULL, NULL); amount = col; if (curbuf->b_ind_in_comment2 || *look == NUL) amount += curbuf->b_ind_in_comment; } } + goto theend; } /* * Are we looking at a ']' that has a match? */ - else if (*skipwhite(theline) == ']' + if (*skipwhite(theline) == ']' && (trypos = find_match_char('[', curbuf->b_ind_maxparen)) != NULL) { /* align with the line containing the '['. */ amount = get_indent_lnum(trypos->lnum); + goto theend; } /* * Are we inside parentheses or braces? */ /* XXX */ - else if (((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL + if (((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL && curbuf->b_ind_java == 0) || (tryposBrace = find_start_brace()) != NULL || trypos != NULL) @@ -7308,12 +7525,12 @@ get_c_indent() l = skipwhite(ml_get(lnum)); if (cin_nocode(l)) /* skip comment lines */ continue; - if (cin_ispreproc_cont(&l, &lnum)) + if (cin_ispreproc_cont(&l, &lnum, &amount)) continue; /* ignore #define, #if, etc. */ curwin->w_cursor.lnum = lnum; - /* Skip a comment. XXX */ - if ((trypos = ind_find_start_comment()) != NULL) + /* Skip a comment or raw string. XXX */ + if ((trypos = ind_find_start_CORS(NULL)) != NULL) { lnum = trypos->lnum + 1; continue; @@ -7446,7 +7663,7 @@ get_c_indent() else { col = our_paren_pos.col + 1; - while (vim_iswhite(l[col])) + while (VIM_ISWHITE(l[col])) col++; if (l[col] != NUL) /* In case of trailing space */ our_paren_pos.col = col; @@ -7538,7 +7755,11 @@ get_c_indent() /* * We are inside braces, there is a { before this line at the position * stored in tryposBrace. + * Make a copy of tryposBrace, it may point to pos_copy inside + * find_start_brace(), which may be changed somewhere. */ + tryposCopy = *tryposBrace; + tryposBrace = &tryposCopy; trypos = tryposBrace; ourscope = trypos->lnum; start = ml_get(ourscope); @@ -7662,6 +7883,8 @@ get_c_indent() l = skipwhite(ml_get_curline()); if (cin_is_cpp_namespace(l)) amount += curbuf->b_ind_cpp_namespace; + else if (cin_is_cpp_extern_c(l)) + amount += curbuf->b_ind_cpp_extern_c; } else { @@ -7717,10 +7940,10 @@ get_c_indent() */ if (curwin->w_cursor.lnum <= ourscope) { - /* we reached end of scope: - * if looking for a enum or structure initialization + /* We reached end of scope: + * If looking for a enum or structure initialization * go further back: - * if it is an initializer (enum xxx or xxx =), then + * If it is an initializer (enum xxx or xxx =), then * don't add ind_continuation, otherwise it is a variable * declaration: * int x, @@ -7745,10 +7968,10 @@ get_c_indent() l = ml_get_curline(); /* - * If we're in a comment now, skip to the start of the - * comment. + * If we're in a comment or raw string now, skip to + * the start of it. */ - trypos = ind_find_start_comment(); + trypos = ind_find_start_CORS(NULL); if (trypos != NULL) { curwin->w_cursor.lnum = trypos->lnum + 1; @@ -7759,7 +7982,8 @@ get_c_indent() /* * Skip preprocessor directives and blank lines. */ - if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum)) + if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, + &amount)) continue; if (cin_nocode(l)) @@ -7838,7 +8062,8 @@ get_c_indent() else { if (lookfor != LOOKFOR_TERM - && lookfor != LOOKFOR_CPP_BASECLASS) + && lookfor != LOOKFOR_CPP_BASECLASS + && lookfor != LOOKFOR_COMMA) { amount = scope_amount; if (theline[0] == '{') @@ -7864,9 +8089,9 @@ get_c_indent() l = ml_get_curline(); - /* If we're in a comment now, skip to the start of - * the comment. */ - trypos = ind_find_start_comment(); + /* If we're in a comment or raw string now, skip + * to the start of it. */ + trypos = ind_find_start_CORS(NULL); if (trypos != NULL) { curwin->w_cursor.lnum = trypos->lnum + 1; @@ -7875,7 +8100,8 @@ get_c_indent() } /* Skip preprocessor directives and blank lines. */ - if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum)) + if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, + &amount)) continue; /* Finally the actual check for "namespace". */ @@ -7885,6 +8111,12 @@ get_c_indent() - added_to_amount; break; } + else if (cin_is_cpp_extern_c(l)) + { + amount += curbuf->b_ind_cpp_extern_c + - added_to_amount; + break; + } if (cin_nocode(l)) continue; @@ -7894,9 +8126,10 @@ get_c_indent() } /* - * If we're in a comment now, skip to the start of the comment. + * If we're in a comment or raw string now, skip to the start + * of it. */ /* XXX */ - if ((trypos = ind_find_start_comment()) != NULL) + if ((trypos = ind_find_start_CORS(&raw_string_start)) != NULL) { curwin->w_cursor.lnum = trypos->lnum + 1; curwin->w_cursor.col = 0; @@ -8050,7 +8283,7 @@ get_c_indent() * unlocked it) */ l = ml_get_curline(); - if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum) + if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, &amount) || cin_nocode(l)) continue; @@ -8061,7 +8294,7 @@ get_c_indent() n = FALSE; if (lookfor != LOOKFOR_TERM && curbuf->b_ind_cpp_baseclass > 0) { - n = cin_is_cpp_baseclass(&col); + n = cin_is_cpp_baseclass(&cache_cpp_baseclass); l = ml_get_curline(); } if (n) @@ -8082,7 +8315,8 @@ get_c_indent() } else /* XXX */ - amount = get_baseclass_amount(col); + amount = get_baseclass_amount( + cache_cpp_baseclass.lpos.col); break; } else if (lookfor == LOOKFOR_CPP_BASECLASS) @@ -8130,23 +8364,32 @@ get_c_indent() amount = get_indent(); break; } - if (lookfor == LOOKFOR_NO_COMMA) + if (lookfor == LOOKFOR_COMMA) { - if (terminated != ',') + if (tryposBrace != NULL && tryposBrace->lnum + >= curwin->w_cursor.lnum) + break; + if (terminated == ',') /* line below current line is the one that starts a * (possibly broken) line ending in a comma. */ break; - amount = get_indent(); - if (curwin->w_cursor.lnum - 1 == ourscope) - /* line above is start of the scope, thus current line - * is the one that stars a (possibly broken) line - * ending in a comma. */ - break; + else + { + amount = get_indent(); + if (curwin->w_cursor.lnum - 1 == ourscope) + /* line above is start of the scope, thus current + * line is the one that stars a (possibly broken) + * line ending in a comma. */ + break; + } } if (terminated == 0 || (lookfor != LOOKFOR_UNTERM && terminated == ',')) { + if (lookfor != LOOKFOR_ENUM_OR_INIT && + (*skipwhite(l) == '[' || l[STRLEN(l) - 1] == '[')) + amount += ind_continuation; /* * if we're in the middle of a paren thing, * go back to the line that starts it so @@ -8385,8 +8628,14 @@ get_c_indent() * 100 + * -> here; */ + l = ml_get_curline(); amount = cur_amount; + n = (int)STRLEN(l); + if (terminated == ',' && (*skipwhite(l) == ']' + || (n >=2 && l[n - 2] == ']'))) + break; + /* * If previous line ends in ',', check whether we * are in an initialization or enum @@ -8414,8 +8663,9 @@ get_c_indent() * 5, * 6, */ - lookfor = LOOKFOR_NO_COMMA; - amount = get_indent(); /* XXX */ + if (cin_iscomment(skipwhite(l))) + break; + lookfor = LOOKFOR_COMMA; trypos = find_match_char('[', curbuf->b_ind_maxparen); if (trypos != NULL) @@ -8445,7 +8695,9 @@ get_c_indent() cont_amount = cin_get_equal_amount( curwin->w_cursor.lnum); if (lookfor != LOOKFOR_TERM - && lookfor != LOOKFOR_JS_KEY) + && lookfor != LOOKFOR_JS_KEY + && lookfor != LOOKFOR_COMMA + && raw_string_start != curwin->w_cursor.lnum) lookfor = LOOKFOR_UNTERM; } } @@ -8668,283 +8920,282 @@ get_c_indent() /* subtract extra left-shift for jump labels */ if (curbuf->b_ind_jump_label > 0 && original_line_islabel) amount -= curbuf->b_ind_jump_label; + + goto theend; } - else + + /* + * ok -- we're not inside any sort of structure at all! + * + * This means we're at the top level, and everything should + * basically just match where the previous line is, except + * for the lines immediately following a function declaration, + * which are K&R-style parameters and need to be indented. + * + * if our line starts with an open brace, forget about any + * prevailing indent and make sure it looks like the start + * of a function + */ + + if (theline[0] == '{') { - /* - * ok -- we're not inside any sort of structure at all! - * - * This means we're at the top level, and everything should - * basically just match where the previous line is, except - * for the lines immediately following a function declaration, - * which are K&R-style parameters and need to be indented. - * - * if our line starts with an open brace, forget about any - * prevailing indent and make sure it looks like the start - * of a function - */ + amount = curbuf->b_ind_first_open; + goto theend; + } - if (theline[0] == '{') + /* + * If the NEXT line is a function declaration, the current + * line needs to be indented as a function type spec. + * Don't do this if the current line looks like a comment or if the + * current line is terminated, ie. ends in ';', or if the current line + * contains { or }: "void f() {\n if (1)" + */ + if (cur_curpos.lnum < curbuf->b_ml.ml_line_count + && !cin_nocode(theline) + && vim_strchr(theline, '{') == NULL + && vim_strchr(theline, '}') == NULL + && !cin_ends_in(theline, (char_u *)":", NULL) + && !cin_ends_in(theline, (char_u *)",", NULL) + && cin_isfuncdecl(NULL, cur_curpos.lnum + 1, + cur_curpos.lnum + 1) + && !cin_isterminated(theline, FALSE, TRUE)) + { + amount = curbuf->b_ind_func_type; + goto theend; + } + + /* search backwards until we find something we recognize */ + amount = 0; + curwin->w_cursor = cur_curpos; + while (curwin->w_cursor.lnum > 1) + { + curwin->w_cursor.lnum--; + curwin->w_cursor.col = 0; + + l = ml_get_curline(); + + /* + * If we're in a comment or raw string now, skip to the start + * of it. + */ /* XXX */ + if ((trypos = ind_find_start_CORS(NULL)) != NULL) { - amount = curbuf->b_ind_first_open; + curwin->w_cursor.lnum = trypos->lnum + 1; + curwin->w_cursor.col = 0; + continue; } /* - * If the NEXT line is a function declaration, the current - * line needs to be indented as a function type spec. - * Don't do this if the current line looks like a comment or if the - * current line is terminated, ie. ends in ';', or if the current line - * contains { or }: "void f() {\n if (1)" - */ - else if (cur_curpos.lnum < curbuf->b_ml.ml_line_count - && !cin_nocode(theline) - && vim_strchr(theline, '{') == NULL - && vim_strchr(theline, '}') == NULL - && !cin_ends_in(theline, (char_u *)":", NULL) - && !cin_ends_in(theline, (char_u *)",", NULL) - && cin_isfuncdecl(NULL, cur_curpos.lnum + 1, - cur_curpos.lnum + 1) - && !cin_isterminated(theline, FALSE, TRUE)) - { - amount = curbuf->b_ind_func_type; + * Are we at the start of a cpp base class declaration or + * constructor initialization? + */ /* XXX */ + n = FALSE; + if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{') + { + n = cin_is_cpp_baseclass(&cache_cpp_baseclass); + l = ml_get_curline(); } - else + if (n) { - amount = 0; - curwin->w_cursor = cur_curpos; - - /* search backwards until we find something we recognize */ + /* XXX */ + amount = get_baseclass_amount(cache_cpp_baseclass.lpos.col); + break; + } - while (curwin->w_cursor.lnum > 1) - { - curwin->w_cursor.lnum--; - curwin->w_cursor.col = 0; + /* + * Skip preprocessor directives and blank lines. + */ + if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, &amount)) + continue; - l = ml_get_curline(); + if (cin_nocode(l)) + continue; - /* - * If we're in a comment now, skip to the start of the comment. - */ /* XXX */ - if ((trypos = ind_find_start_comment()) != NULL) - { - curwin->w_cursor.lnum = trypos->lnum + 1; - curwin->w_cursor.col = 0; - continue; - } + /* + * If the previous line ends in ',', use one level of + * indentation: + * int foo, + * bar; + * do this before checking for '}' in case of eg. + * enum foobar + * { + * ... + * } foo, + * bar; + */ + n = 0; + if (cin_ends_in(l, (char_u *)",", NULL) + || (*l != NUL && (n = l[STRLEN(l) - 1]) == '\\')) + { + /* take us back to opening paren */ + if (find_last_paren(l, '(', ')') + && (trypos = find_match_paren( + curbuf->b_ind_maxparen)) != NULL) + curwin->w_cursor = *trypos; - /* - * Are we at the start of a cpp base class declaration or - * constructor initialization? - */ /* XXX */ - n = FALSE; - if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{') - { - n = cin_is_cpp_baseclass(&col); - l = ml_get_curline(); - } - if (n) - { - /* XXX */ - amount = get_baseclass_amount(col); + /* For a line ending in ',' that is a continuation line go + * back to the first line with a backslash: + * char *foo = "bla\ + * bla", + * here; + */ + while (n == 0 && curwin->w_cursor.lnum > 1) + { + l = ml_get(curwin->w_cursor.lnum - 1); + if (*l == NUL || l[STRLEN(l) - 1] != '\\') break; - } - - /* - * Skip preprocessor directives and blank lines. - */ - if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum)) - continue; + --curwin->w_cursor.lnum; + curwin->w_cursor.col = 0; + } - if (cin_nocode(l)) - continue; + amount = get_indent(); /* XXX */ - /* - * If the previous line ends in ',', use one level of - * indentation: - * int foo, - * bar; - * do this before checking for '}' in case of eg. - * enum foobar - * { - * ... - * } foo, - * bar; - */ - n = 0; - if (cin_ends_in(l, (char_u *)",", NULL) - || (*l != NUL && (n = l[STRLEN(l) - 1]) == '\\')) - { - /* take us back to opening paren */ - if (find_last_paren(l, '(', ')') - && (trypos = find_match_paren( - curbuf->b_ind_maxparen)) != NULL) - curwin->w_cursor = *trypos; - - /* For a line ending in ',' that is a continuation line go - * back to the first line with a backslash: - * char *foo = "bla\ - * bla", - * here; - */ - while (n == 0 && curwin->w_cursor.lnum > 1) - { - l = ml_get(curwin->w_cursor.lnum - 1); - if (*l == NUL || l[STRLEN(l) - 1] != '\\') - break; - --curwin->w_cursor.lnum; - curwin->w_cursor.col = 0; - } + if (amount == 0) + amount = cin_first_id_amount(); + if (amount == 0) + amount = ind_continuation; + break; + } - amount = get_indent(); /* XXX */ + /* + * If the line looks like a function declaration, and we're + * not in a comment, put it the left margin. + */ + if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0)) /* XXX */ + break; + l = ml_get_curline(); - if (amount == 0) - amount = cin_first_id_amount(); - if (amount == 0) - amount = ind_continuation; - break; - } + /* + * Finding the closing '}' of a previous function. Put + * current line at the left margin. For when 'cino' has "fs". + */ + if (*skipwhite(l) == '}') + break; - /* - * If the line looks like a function declaration, and we're - * not in a comment, put it the left margin. - */ - if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0)) /* XXX */ - break; - l = ml_get_curline(); + /* (matching {) + * If the previous line ends on '};' (maybe followed by + * comments) align at column 0. For example: + * char *string_array[] = { "foo", + * / * x * / "b};ar" }; / * foobar * / + */ + if (cin_ends_in(l, (char_u *)"};", NULL)) + break; - /* - * Finding the closing '}' of a previous function. Put - * current line at the left margin. For when 'cino' has "fs". - */ - if (*skipwhite(l) == '}') - break; + /* + * If the previous line ends on '[' we are probably in an + * array constant: + * something = [ + * 234, <- extra indent + */ + if (cin_ends_in(l, (char_u *)"[", NULL)) + { + amount = get_indent() + ind_continuation; + break; + } - /* (matching {) - * If the previous line ends on '};' (maybe followed by - * comments) align at column 0. For example: - * char *string_array[] = { "foo", - * / * x * / "b};ar" }; / * foobar * / - */ - if (cin_ends_in(l, (char_u *)"};", NULL)) - break; + /* + * Find a line only has a semicolon that belongs to a previous + * line ending in '}', e.g. before an #endif. Don't increase + * indent then. + */ + if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1)) + { + pos_T curpos_save = curwin->w_cursor; - /* - * If the previous line ends on '[' we are probably in an - * array constant: - * something = [ - * 234, <- extra indent - */ - if (cin_ends_in(l, (char_u *)"[", NULL)) - { - amount = get_indent() + ind_continuation; + while (curwin->w_cursor.lnum > 1) + { + look = ml_get(--curwin->w_cursor.lnum); + if (!(cin_nocode(look) || cin_ispreproc_cont( + &look, &curwin->w_cursor.lnum, &amount))) break; - } - - /* - * Find a line only has a semicolon that belongs to a previous - * line ending in '}', e.g. before an #endif. Don't increase - * indent then. - */ - if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1)) - { - pos_T curpos_save = curwin->w_cursor; - - while (curwin->w_cursor.lnum > 1) - { - look = ml_get(--curwin->w_cursor.lnum); - if (!(cin_nocode(look) || cin_ispreproc_cont( - &look, &curwin->w_cursor.lnum))) - break; - } - if (curwin->w_cursor.lnum > 0 - && cin_ends_in(look, (char_u *)"}", NULL)) - break; + } + if (curwin->w_cursor.lnum > 0 + && cin_ends_in(look, (char_u *)"}", NULL)) + break; - curwin->w_cursor = curpos_save; - } + curwin->w_cursor = curpos_save; + } - /* - * If the PREVIOUS line is a function declaration, the current - * line (and the ones that follow) needs to be indented as - * parameters. - */ - if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0)) - { - amount = curbuf->b_ind_param; - break; - } + /* + * If the PREVIOUS line is a function declaration, the current + * line (and the ones that follow) needs to be indented as + * parameters. + */ + if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0)) + { + amount = curbuf->b_ind_param; + break; + } - /* - * If the previous line ends in ';' and the line before the - * previous line ends in ',' or '\', ident to column zero: - * int foo, - * bar; - * indent_to_0 here; - */ - if (cin_ends_in(l, (char_u *)";", NULL)) - { - l = ml_get(curwin->w_cursor.lnum - 1); - if (cin_ends_in(l, (char_u *)",", NULL) - || (*l != NUL && l[STRLEN(l) - 1] == '\\')) - break; - l = ml_get_curline(); - } + /* + * If the previous line ends in ';' and the line before the + * previous line ends in ',' or '\', ident to column zero: + * int foo, + * bar; + * indent_to_0 here; + */ + if (cin_ends_in(l, (char_u *)";", NULL)) + { + l = ml_get(curwin->w_cursor.lnum - 1); + if (cin_ends_in(l, (char_u *)",", NULL) + || (*l != NUL && l[STRLEN(l) - 1] == '\\')) + break; + l = ml_get_curline(); + } - /* - * Doesn't look like anything interesting -- so just - * use the indent of this line. - * - * Position the cursor over the rightmost paren, so that - * matching it will take us back to the start of the line. - */ - find_last_paren(l, '(', ')'); + /* + * Doesn't look like anything interesting -- so just + * use the indent of this line. + * + * Position the cursor over the rightmost paren, so that + * matching it will take us back to the start of the line. + */ + find_last_paren(l, '(', ')'); - if ((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL) - curwin->w_cursor = *trypos; - amount = get_indent(); /* XXX */ - break; - } + if ((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL) + curwin->w_cursor = *trypos; + amount = get_indent(); /* XXX */ + break; + } - /* add extra indent for a comment */ - if (cin_iscomment(theline)) - amount += curbuf->b_ind_comment; + /* add extra indent for a comment */ + if (cin_iscomment(theline)) + amount += curbuf->b_ind_comment; - /* add extra indent if the previous line ended in a backslash: - * "asdfasdf\ - * here"; - * char *foo = "asdf\ - * here"; - */ - if (cur_curpos.lnum > 1) - { - l = ml_get(cur_curpos.lnum - 1); - if (*l != NUL && l[STRLEN(l) - 1] == '\\') - { - cur_amount = cin_get_equal_amount(cur_curpos.lnum - 1); - if (cur_amount > 0) - amount = cur_amount; - else if (cur_amount == 0) - amount += ind_continuation; - } - } + /* add extra indent if the previous line ended in a backslash: + * "asdfasdf\ + * here"; + * char *foo = "asdf\ + * here"; + */ + if (cur_curpos.lnum > 1) + { + l = ml_get(cur_curpos.lnum - 1); + if (*l != NUL && l[STRLEN(l) - 1] == '\\') + { + cur_amount = cin_get_equal_amount(cur_curpos.lnum - 1); + if (cur_amount > 0) + amount = cur_amount; + else if (cur_amount == 0) + amount += ind_continuation; } } theend: + if (amount < 0) + amount = 0; + +laterend: /* put the cursor back where it belongs */ curwin->w_cursor = cur_curpos; vim_free(linecopy); - if (amount < 0) - return 0; return amount; } static int -find_match(lookfor, ourscope) - int lookfor; - linenr_T ourscope; +find_match(int lookfor, linenr_T ourscope) { char_u *look; pos_T *theirscope; @@ -9060,9 +9311,10 @@ find_match(lookfor, ourscope) * Get indent level from 'indentexpr'. */ int -get_expr_indent() +get_expr_indent(void) { - int indent; + int indent = -1; + char_u *inde_copy; pos_T save_pos; colnr_T save_curswant; int save_set_curswant; @@ -9079,7 +9331,16 @@ get_expr_indent() if (use_sandbox) ++sandbox; ++textlock; - indent = eval_to_number(curbuf->b_p_inde); + + /* Need to make a copy, the 'indentexpr' option could be changed while + * evaluating it. */ + inde_copy = vim_strsave(curbuf->b_p_inde); + if (inde_copy != NULL) + { + indent = (int)eval_to_number(inde_copy); + vim_free(inde_copy); + } + if (use_sandbox) --sandbox; --textlock; @@ -9107,11 +9368,10 @@ get_expr_indent() #if defined(FEAT_LISP) || defined(PROTO) -static int lisp_match __ARGS((char_u *p)); +static int lisp_match(char_u *p); static int -lisp_match(p) - char_u *p; +lisp_match(char_u *p) { char_u buf[LSIZE]; int len; @@ -9144,7 +9404,7 @@ lisp_match(p) * I tried to fix the first two issues. */ int -get_lisp_indent() +get_lisp_indent(void) { pos_T *pos, realpos, paren; int amount; @@ -9166,7 +9426,7 @@ get_lisp_indent() { paren = *pos; pos = findmatch(NULL, '['); - if (pos == NULL || ltp(pos, &paren)) + if (pos == NULL || LT_POSP(pos, &paren)) pos = &paren; } if (pos != NULL) @@ -9261,7 +9521,7 @@ get_lisp_indent() amount++; firsttry = amount; - while (vim_iswhite(*that)) + while (VIM_ISWHITE(*that)) { amount += lbr_chartabsize(line, that, (colnr_T)amount); ++that; @@ -9284,7 +9544,7 @@ get_lisp_indent() && (*that < '0' || *that > '9'))) { while (*that - && (!vim_iswhite(*that) + && (!VIM_ISWHITE(*that) || quotecount || parencount) && (!((*that == '(' || *that == '[') @@ -9307,7 +9567,7 @@ get_lisp_indent() line, &that, (colnr_T)amount); } } - while (vim_iswhite(*that)) + while (VIM_ISWHITE(*that)) { amount += lbr_chartabsize( line, that, (colnr_T)amount); @@ -9330,7 +9590,7 @@ get_lisp_indent() #endif /* FEAT_LISP */ void -prepare_to_exit() +prepare_to_exit(void) { #if defined(SIGHUP) && defined(SIG_IGN) /* Ignore SIGHUP, because a dropped connection causes a read error, which @@ -9355,10 +9615,7 @@ prepare_to_exit() * screen (if there are two screens). */ settmode(TMODE_COOK); -#ifdef WIN3264 - if (can_end_termcap_mode(FALSE) == TRUE) -#endif - stoptermcap(); + stoptermcap(); out_flush(); } } @@ -9370,7 +9627,7 @@ prepare_to_exit() * functions, such as allocating memory. */ void -preserve_exit() +preserve_exit(void) { buf_T *buf; @@ -9386,7 +9643,7 @@ preserve_exit() ml_close_notmod(); /* close all not-modified buffers */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { @@ -9409,10 +9666,9 @@ preserve_exit() * return TRUE if "fname" exists. */ int -vim_fexists(fname) - char_u *fname; +vim_fexists(char_u *fname) { - struct stat st; + stat_T st; if (mch_stat((char *)fname, &st)) return FALSE; @@ -9437,7 +9693,7 @@ vim_fexists(fname) static int breakcheck_count = 0; void -line_breakcheck() +line_breakcheck(void) { if (++breakcheck_count >= BREAKCHECK_SKIP) { @@ -9450,7 +9706,7 @@ line_breakcheck() * Like line_breakcheck() but check 10 times less often. */ void -fast_breakcheck() +fast_breakcheck(void) { if (++breakcheck_count >= BREAKCHECK_SKIP * 10) { @@ -9465,11 +9721,11 @@ fast_breakcheck() * Returns OK or FAIL. */ int -expand_wildcards_eval(pat, num_file, file, flags) - char_u **pat; /* pointer to input pattern */ - int *num_file; /* resulting number of files */ - char_u ***file; /* array of resulting files */ - int flags; /* EW_DIR, etc. */ +expand_wildcards_eval( + char_u **pat, /* pointer to input pattern */ + int *num_file, /* resulting number of files */ + char_u ***file, /* array of resulting files */ + int flags) /* EW_DIR, etc. */ { int ret = FAIL; char_u *eval_pat = NULL; @@ -9502,22 +9758,22 @@ expand_wildcards_eval(pat, num_file, file, flags) /* * Expand wildcards. Calls gen_expand_wildcards() and removes files matching * 'wildignore'. - * Returns OK or FAIL. When FAIL then "num_file" won't be set. + * Returns OK or FAIL. When FAIL then "num_files" won't be set. */ int -expand_wildcards(num_pat, pat, num_file, file, flags) - int num_pat; /* number of input patterns */ - char_u **pat; /* array of input patterns */ - int *num_file; /* resulting number of files */ - char_u ***file; /* array of resulting files */ - int flags; /* EW_DIR, etc. */ +expand_wildcards( + int num_pat, /* number of input patterns */ + char_u **pat, /* array of input patterns */ + int *num_files, /* resulting number of files */ + char_u ***files, /* array of resulting files */ + int flags) /* EW_DIR, etc. */ { int retval; int i, j; char_u *p; int non_suf_match; /* number without matching suffix */ - retval = gen_expand_wildcards(num_pat, pat, num_file, file, flags); + retval = gen_expand_wildcards(num_pat, pat, num_files, files, flags); /* When keeping all matches, return here */ if ((flags & EW_KEEPALL) || retval == FAIL) @@ -9531,47 +9787,54 @@ expand_wildcards(num_pat, pat, num_file, file, flags) { char_u *ffname; - /* check all files in (*file)[] */ - for (i = 0; i < *num_file; ++i) + /* check all files in (*files)[] */ + for (i = 0; i < *num_files; ++i) { - ffname = FullName_save((*file)[i], FALSE); + ffname = FullName_save((*files)[i], FALSE); if (ffname == NULL) /* out of memory */ break; # ifdef VMS vms_remove_version(ffname); # endif - if (match_file_list(p_wig, (*file)[i], ffname)) + if (match_file_list(p_wig, (*files)[i], ffname)) { /* remove this matching file from the list */ - vim_free((*file)[i]); - for (j = i; j + 1 < *num_file; ++j) - (*file)[j] = (*file)[j + 1]; - --*num_file; + vim_free((*files)[i]); + for (j = i; j + 1 < *num_files; ++j) + (*files)[j] = (*files)[j + 1]; + --*num_files; --i; } vim_free(ffname); } + + /* If the number of matches is now zero, we fail. */ + if (*num_files == 0) + { + VIM_CLEAR(*files); + return FAIL; + } } #endif /* * Move the names where 'suffixes' match to the end. */ - if (*num_file > 1) + if (*num_files > 1) { non_suf_match = 0; - for (i = 0; i < *num_file; ++i) + for (i = 0; i < *num_files; ++i) { - if (!match_suffix((*file)[i])) + if (!match_suffix((*files)[i])) { /* * Move the name without matching suffix to the front * of the list. */ - p = (*file)[i]; + p = (*files)[i]; for (j = i; j > non_suf_match; --j) - (*file)[j] = (*file)[j - 1]; - (*file)[non_suf_match++] = p; + (*files)[j] = (*files)[j - 1]; + (*files)[non_suf_match++] = p; } } } @@ -9583,8 +9846,7 @@ expand_wildcards(num_pat, pat, num_file, file, flags) * Return TRUE if "fname" matches with an entry in 'suffixes'. */ int -match_suffix(fname) - char_u *fname; +match_suffix(char_u *fname) { int fnamelen, setsuflen; char_u *setsuf; @@ -9622,17 +9884,17 @@ match_suffix(fname) #if !defined(NO_EXPANDPATH) || defined(PROTO) # ifdef VIM_BACKTICK -static int vim_backtick __ARGS((char_u *p)); -static int expand_backtick __ARGS((garray_T *gap, char_u *pat, int flags)); +static int vim_backtick(char_u *p); +static int expand_backtick(garray_T *gap, char_u *pat, int flags); # endif -# if defined(MSDOS) || defined(FEAT_GUI_W16) || defined(WIN3264) +# if defined(WIN3264) /* * File name expansion code for MS-DOS, Win16 and Win32. It's here because * it's shared between these systems. */ -# if defined(DJGPP) || defined(PROTO) -# define _cdecl /* DJGPP doesn't have this */ +# if defined(PROTO) +# define _cdecl # else # ifdef __BORLANDC__ # define _cdecl _RTLENTRYF @@ -9648,24 +9910,6 @@ pstrcmp(const void *a, const void *b) return (pathcmp(*(char **)a, *(char **)b, -1)); } -# ifndef WIN3264 - static void -namelowcpy( - char_u *d, - char_u *s) -{ -# ifdef DJGPP - if (USE_LONG_FNAME) /* don't lower case on Windows 95/NT systems */ - while (*s) - *d++ = *s++; - else -# endif - while (*s) - *d++ = TOLOWER_LOC(*s++); - *d = NUL; -} -# endif - /* * Recursively expand one path component into all matching files and/or * directories. Adds matches to "gap". Handles "*", "?", "[a-z]", "**", etc. @@ -9694,16 +9938,12 @@ dos_expandpath( int len; int starstar = FALSE; static int stardepth = 0; /* depth for "**" expansion */ -#ifdef WIN3264 WIN32_FIND_DATA fb; HANDLE hFind = (HANDLE)0; # ifdef FEAT_MBYTE WIN32_FIND_DATAW wfb; WCHAR *wn = NULL; /* UCS-2 name, NULL when not used. */ # endif -#else - struct ffblk fb; -#endif char_u *matchname; int ok; @@ -9715,8 +9955,9 @@ dos_expandpath( return 0; } - /* make room for file name */ - buf = alloc((int)STRLEN(path) + BASENAMELEN + 5); + /* Make room for file name. When doing encoding conversion the actual + * length may be quite a bit longer, thus use the maximum possible length. */ + buf = alloc((int)MAXPATHL); if (buf == NULL) return 0; @@ -9743,7 +9984,7 @@ dos_expandpath( else if (path_end >= path + wildoff && vim_strchr((char_u *)"*?[~", *path_end) != NULL) e = p; -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (has_mbyte) { len = (*mb_ptr2len)(path_end); @@ -9752,7 +9993,7 @@ dos_expandpath( path_end += len; } else -#endif +# endif *p++ = *path_end++; } e = p; @@ -9774,7 +10015,7 @@ dos_expandpath( if (p[0] == '*' && p[1] == '*') starstar = TRUE; - starts_with_dot = (*s == '.'); + starts_with_dot = *s == '.'; pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -9813,7 +10054,6 @@ dos_expandpath( /* Scan all files in the directory with "dir/ *.*" */ STRCPY(s, "*.*"); -#ifdef WIN3264 # ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { @@ -9826,49 +10066,35 @@ dos_expandpath( hFind = FindFirstFileW(wn, &wfb); if (hFind == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - vim_free(wn); - wn = NULL; - } + VIM_CLEAR(wn); } } if (wn == NULL) # endif - hFind = FindFirstFile(buf, &fb); + hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); -#else - /* If we are expanding wildcards we try both files and directories */ - ok = (findfirst((char *)buf, &fb, - (*path_end != NUL || (flags & EW_DIR)) ? FA_DIREC : 0) == 0); -#endif while (ok) { -#ifdef WIN3264 # ifdef FEAT_MBYTE if (wn != NULL) p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */ else # endif p = (char_u *)fb.cFileName; -#else - p = (char_u *)fb.ff_name; -#endif /* Ignore entries starting with a dot, unless when asked for. Accept * all entries found with "matchname". */ - if ((p[0] != '.' || starts_with_dot) + if ((p[0] != '.' || starts_with_dot + || ((flags & EW_DODOT) + && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) && (matchname == NULL || (regmatch.regprog != NULL && vim_regexec(®match, p, (colnr_T)0)) || ((flags & EW_NOTWILD) && fnamencmp(path + (s - buf), p, e - s) == 0))) { -#ifdef WIN3264 STRCPY(s, p); -#else - namelowcpy(s, p); -#endif len = (int)STRLEN(buf); if (starstar && stardepth < 100) @@ -9900,7 +10126,6 @@ dos_expandpath( } } -#ifdef WIN3264 # ifdef FEAT_MBYTE if (wn != NULL) { @@ -9910,16 +10135,12 @@ dos_expandpath( else # endif ok = FindNextFile(hFind, &fb); -#else - ok = (findnext(&fb) == 0); -#endif /* If no more matches and no match was used, try expanding the name * itself. Finds the long name of a short filename. */ if (!ok && matchname != NULL && gap->ga_len == start_len) { STRCPY(s, matchname); -#ifdef WIN3264 FindClose(hFind); # ifdef FEAT_MBYTE if (wn != NULL) @@ -9931,23 +10152,16 @@ dos_expandpath( } if (wn == NULL) # endif - hFind = FindFirstFile(buf, &fb); + hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); -#else - ok = (findfirst((char *)buf, &fb, - (*path_end != NUL || (flags & EW_DIR)) ? FA_DIREC : 0) == 0); -#endif - vim_free(matchname); - matchname = NULL; + VIM_CLEAR(matchname); } } -#ifdef WIN3264 FindClose(hFind); # ifdef FEAT_MBYTE vim_free(wn); # endif -#endif vim_free(buf); vim_regfree(regmatch.regprog); vim_free(matchname); @@ -9967,7 +10181,7 @@ mch_expandpath( { return dos_expandpath(gap, path, 0, flags, FALSE); } -# endif /* MSDOS || FEAT_GUI_W16 || WIN3264 */ +# endif /* WIN3264 */ #if (defined(UNIX) && !defined(VMS)) || defined(USE_UNIXFILENAME) \ || defined(PROTO) @@ -9975,11 +10189,10 @@ mch_expandpath( * Unix style wildcard expansion code. * It's here because it's used both for Unix and Mac. */ -static int pstrcmp __ARGS((const void *, const void *)); +static int pstrcmp(const void *, const void *); static int -pstrcmp(a, b) - const void *a, *b; +pstrcmp(const void *a, const void *b) { return (pathcmp(*(char **)a, *(char **)b, -1)); } @@ -9993,12 +10206,12 @@ pstrcmp(a, b) * NOTE: much of this is identical to dos_expandpath(), keep in sync! */ int -unix_expandpath(gap, path, wildoff, flags, didstar) - garray_T *gap; - char_u *path; - int wildoff; - int flags; /* EW_* flags */ - int didstar; /* expanded "**" once already */ +unix_expandpath( + garray_T *gap, + char_u *path, + int wildoff, + int flags, /* EW_* flags */ + int didstar) /* expanded "**" once already */ { char_u *buf; char_u *path_end; @@ -10086,7 +10299,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar) starstar = TRUE; /* convert the file pattern to a regexp pattern */ - starts_with_dot = (*s == '.'); + starts_with_dot = *s == '.'; pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { @@ -10135,7 +10348,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar) dp = readdir(dirp); if (dp == NULL) break; - if ((dp->d_name[0] != '.' || starts_with_dot) + if ((dp->d_name[0] != '.' || starts_with_dot + || ((flags & EW_DODOT) + && dp->d_name[1] != NUL + && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) && ((regmatch.regprog != NULL && vim_regexec(®match, (char_u *)dp->d_name, (colnr_T)0)) || ((flags & EW_NOTWILD) @@ -10164,11 +10380,15 @@ unix_expandpath(gap, path, wildoff, flags, didstar) } else { + stat_T sb; + /* no more wildcards, check if there is a match */ /* remove backslashes for the remaining components only */ if (*path_end != NUL) backslash_halve(buf + len + 1); - if (mch_getperm(buf) >= 0) /* add existing file */ + /* add existing file or symbolic link */ + if ((flags & EW_ALLLINKS) ? mch_lstat((char *)buf, &sb) >= 0 + : mch_getperm(buf) >= 0) { #ifdef MACOS_CONVERT size_t precomp_len = STRLEN(buf)+1; @@ -10202,21 +10422,19 @@ unix_expandpath(gap, path, wildoff, flags, didstar) #endif #if defined(FEAT_SEARCHPATH) -static int find_previous_pathsep __ARGS((char_u *path, char_u **psep)); -static int is_unique __ARGS((char_u *maybe_unique, garray_T *gap, int i)); -static void expand_path_option __ARGS((char_u *curdir, garray_T *gap)); -static char_u *get_path_cutoff __ARGS((char_u *fname, garray_T *gap)); -static void uniquefy_paths __ARGS((garray_T *gap, char_u *pattern)); -static int expand_in_path __ARGS((garray_T *gap, char_u *pattern, int flags)); +static int find_previous_pathsep(char_u *path, char_u **psep); +static int is_unique(char_u *maybe_unique, garray_T *gap, int i); +static void expand_path_option(char_u *curdir, garray_T *gap); +static char_u *get_path_cutoff(char_u *fname, garray_T *gap); +static void uniquefy_paths(garray_T *gap, char_u *pattern); +static int expand_in_path(garray_T *gap, char_u *pattern, int flags); /* * Moves "*psep" back to the previous path separator in "path". * Returns FAIL is "*psep" ends up at the beginning of "path". */ static int -find_previous_pathsep(path, psep) - char_u *path; - char_u **psep; +find_previous_pathsep(char_u *path, char_u **psep) { /* skip the current separator */ if (*psep > path && vim_ispathsep(**psep)) @@ -10227,7 +10445,7 @@ find_previous_pathsep(path, psep) { if (vim_ispathsep(**psep)) return OK; - mb_ptr_back(path, *psep); + MB_PTR_BACK(path, *psep); } return FAIL; @@ -10238,10 +10456,7 @@ find_previous_pathsep(path, psep) * "maybe_unique" is the end portion of "((char_u **)gap->ga_data)[i]". */ static int -is_unique(maybe_unique, gap, i) - char_u *maybe_unique; - garray_T *gap; - int i; +is_unique(char_u *maybe_unique, garray_T *gap, int i) { int j; int candidate_len; @@ -10278,9 +10493,7 @@ is_unique(maybe_unique, gap, i) * expanding each into their equivalent path(s). */ static void -expand_path_option(curdir, gap) - char_u *curdir; - garray_T *gap; +expand_path_option(char_u *curdir, garray_T *gap) { char_u *path_option = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; @@ -10334,7 +10547,7 @@ expand_path_option(curdir, gap) if (ga_grow(gap, 1) == FAIL) break; -# if defined(MSWIN) || defined(MSDOS) +# if defined(MSWIN) /* Avoid the path ending in a backslash, it fails when a comma is * appended. */ len = (int)STRLEN(buf); @@ -10360,9 +10573,7 @@ expand_path_option(curdir, gap) * returns: ^this */ static char_u * -get_path_cutoff(fname, gap) - char_u *fname; - garray_T *gap; +get_path_cutoff(char_u *fname, garray_T *gap) { int i; int maxlen = 0; @@ -10374,7 +10585,7 @@ get_path_cutoff(fname, gap) int j = 0; while ((fname[j] == path_part[i][j] -# if defined(MSWIN) || defined(MSDOS) +# if defined(MSWIN) || (vim_ispathsep(fname[j]) && vim_ispathsep(path_part[i][j])) #endif ) && fname[j] != NUL && path_part[i][j] != NUL) @@ -10389,7 +10600,7 @@ get_path_cutoff(fname, gap) /* skip to the file or directory name */ if (cutoff != NULL) while (vim_ispathsep(*cutoff)) - mb_ptr_adv(cutoff); + MB_PTR_ADV(cutoff); return cutoff; } @@ -10400,9 +10611,7 @@ get_path_cutoff(fname, gap) * that matches the pattern. Beware, this is at least O(n^2) wrt "gap->ga_len". */ static void -uniquefy_paths(gap, pattern) - garray_T *gap; - char_u *pattern; +uniquefy_paths(garray_T *gap, char_u *pattern) { int i; int len; @@ -10468,18 +10677,34 @@ uniquefy_paths(gap, pattern) /* Shorten the filename while maintaining its uniqueness */ path_cutoff = get_path_cutoff(path, &path_ga); - /* we start at the end of the path */ - pathsep_p = path + len - 1; + /* Don't assume all files can be reached without path when search + * pattern starts with star star slash, so only remove path_cutoff + * when possible. */ + if (pattern[0] == '*' && pattern[1] == '*' + && vim_ispathsep_nocolon(pattern[2]) + && path_cutoff != NULL + && vim_regexec(®match, path_cutoff, (colnr_T)0) + && is_unique(path_cutoff, gap, i)) + { + sort_again = TRUE; + mch_memmove(path, path_cutoff, STRLEN(path_cutoff) + 1); + } + else + { + /* Here all files can be reached without path, so get shortest + * unique path. We start at the end of the path. */ + pathsep_p = path + len - 1; - while (find_previous_pathsep(path, &pathsep_p)) - if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0) - && is_unique(pathsep_p + 1, gap, i) - && path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) - { - sort_again = TRUE; - mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p)); - break; - } + while (find_previous_pathsep(path, &pathsep_p)) + if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0) + && is_unique(pathsep_p + 1, gap, i) + && path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) + { + sort_again = TRUE; + mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p)); + break; + } + } if (mch_isFullName(path)) { @@ -10497,7 +10722,7 @@ uniquefy_paths(gap, pattern) */ short_name = shorten_fname(path, curdir); if (short_name != NULL && short_name > path + 1 -#if defined(MSWIN) || defined(MSDOS) +#if defined(MSWIN) /* On windows, * shorten_fname("c:\a\a.txt", "c:\a\b") * returns "\a\a.txt", which is not really the short @@ -10568,14 +10793,15 @@ uniquefy_paths(gap, pattern) * Returns the total number of matches. */ static int -expand_in_path(gap, pattern, flags) - garray_T *gap; - char_u *pattern; - int flags; /* EW_* flags */ +expand_in_path( + garray_T *gap, + char_u *pattern, + int flags) /* EW_* flags */ { char_u *curdir; garray_T path_ga; char_u *paths = NULL; + int glob_flags = 0; if ((curdir = alloc((unsigned)MAXPATHL)) == NULL) return 0; @@ -10592,7 +10818,11 @@ expand_in_path(gap, pattern, flags) if (paths == NULL) return 0; - globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0); + if (flags & EW_ICASE) + glob_flags |= WILD_ICASE; + if (flags & EW_ADDSLASH) + glob_flags |= WILD_ADD_SLASH; + globpath(paths, pattern, gap, glob_flags); vim_free(paths); return gap->ga_len; @@ -10605,8 +10835,7 @@ expand_in_path(gap, pattern, flags) * list of file names in allocated memory. */ void -remove_duplicates(gap) - garray_T *gap; +remove_duplicates(garray_T *gap) { int i; int j; @@ -10624,22 +10853,21 @@ remove_duplicates(gap) } #endif -static int has_env_var __ARGS((char_u *p)); +static int has_env_var(char_u *p); /* * Return TRUE if "p" contains what looks like an environment variable. * Allowing for escaping. */ static int -has_env_var(p) - char_u *p; +has_env_var(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (*p == '\\' && p[1] != NUL) ++p; else if (vim_strchr((char_u *) -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) "$%" #else "$" @@ -10651,18 +10879,18 @@ has_env_var(p) } #ifdef SPECIAL_WILDCHAR -static int has_special_wildchar __ARGS((char_u *p)); +static int has_special_wildchar(char_u *p); /* - * Return TRUE if "p" contains a special wildcard character. - * Allowing for escaping. + * Return TRUE if "p" contains a special wildcard character, one that Vim + * cannot expand, requires using a shell. */ static int -has_special_wildchar(p) - char_u *p; +has_special_wildchar(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { + /* Allow for escaping. */ if (*p == '\\' && p[1] != NUL) ++p; else if (vim_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL) @@ -10684,18 +10912,19 @@ has_special_wildchar(p) * matches, "file" to the array of matches. Call FreeWild() later. */ int -gen_expand_wildcards(num_pat, pat, num_file, file, flags) - int num_pat; /* number of input patterns */ - char_u **pat; /* array of input patterns */ - int *num_file; /* resulting number of files */ - char_u ***file; /* array of resulting files */ - int flags; /* EW_* flags */ +gen_expand_wildcards( + int num_pat, /* number of input patterns */ + char_u **pat, /* array of input patterns */ + int *num_file, /* resulting number of files */ + char_u ***file, /* array of resulting files */ + int flags) /* EW_* flags */ { int i; garray_T ga; char_u *p; static int recursive = FALSE; int add_pat; + int retval = OK; #if defined(FEAT_SEARCHPATH) int did_expand_in_path = FALSE; #endif @@ -10745,7 +10974,11 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) #ifdef VIM_BACKTICK if (vim_backtick(p)) + { add_pat = expand_backtick(&ga, p, flags); + if (add_pat == -1) + retval = FAIL; + } else #endif { @@ -10768,7 +11001,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) vim_free(p); ga_clear_strings(&ga); i = mch_expand_wildcards(num_pat, pat, num_file, file, - flags); + flags|EW_KEEPDOLLAR); recursive = FALSE; return i; } @@ -10809,14 +11042,11 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) { char_u *t = backslash_halve_save(p); -#if defined(MACOS_CLASSIC) - slash_to_colon(t); -#endif /* When EW_NOTFOUND is used, always add files and dirs. Makes * "vim c:/" work. */ if (flags & EW_NOTFOUND) addfile(&ga, t, flags | EW_DIR | EW_FILE); - else if (mch_getperm(t) >= 0) + else addfile(&ga, t, flags); vim_free(t); } @@ -10834,7 +11064,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) recursive = FALSE; - return (ga.ga_data != NULL) ? OK : FAIL; + return ((flags & EW_EMPTYOK) || ga.ga_data != NULL) ? retval : FAIL; } # ifdef VIM_BACKTICK @@ -10843,8 +11073,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) * Return TRUE if we can expand this backtick thing here. */ static int -vim_backtick(p) - char_u *p; +vim_backtick(char_u *p) { return (*p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`'); } @@ -10852,13 +11081,13 @@ vim_backtick(p) /* * Expand an item in `backticks` by executing it as a command. * Currently only works when pat[] starts and ends with a `. - * Returns number of file names found. + * Returns number of file names found, -1 if an error is encountered. */ static int -expand_backtick(gap, pat, flags) - garray_T *gap; - char_u *pat; - int flags; /* EW_* flags */ +expand_backtick( + garray_T *gap, + char_u *pat, + int flags) /* EW_* flags */ { char_u *p; char_u *cmd; @@ -10869,7 +11098,7 @@ expand_backtick(gap, pat, flags) /* Create the command: lop off the backticks. */ cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2); if (cmd == NULL) - return 0; + return -1; #ifdef FEAT_EVAL if (*cmd == '=') /* `={expr}`: Expand expression */ @@ -10880,7 +11109,7 @@ expand_backtick(gap, pat, flags) (flags & EW_SILENT) ? SHELL_SILENT : 0, NULL); vim_free(cmd); if (buffer == NULL) - return 0; + return -1; cmd = buffer; while (*cmd != NUL) @@ -10915,18 +11144,21 @@ expand_backtick(gap, pat, flags) * EW_EXEC add executable files * EW_NOTFOUND add even when it doesn't exist * EW_ADDSLASH add slash after directory name + * EW_ALLLINKS add symlink also when the referred file does not exist */ void -addfile(gap, f, flags) - garray_T *gap; - char_u *f; /* filename */ - int flags; +addfile( + garray_T *gap, + char_u *f, /* filename */ + int flags) { char_u *p; int isdir; + stat_T sb; - /* if the file/dir doesn't exist, may not add it */ - if (!(flags & EW_NOTFOUND) && mch_getperm(f) < 0) + /* if the file/dir/link doesn't exist, may not add it */ + if (!(flags & EW_NOTFOUND) && ((flags & EW_ALLLINKS) + ? mch_lstat((char *)f, &sb) < 0 : mch_getperm(f) < 0)) return; #ifdef FNAME_ILLEGAL @@ -10939,8 +11171,10 @@ addfile(gap, f, flags) if ((isdir && !(flags & EW_DIR)) || (!isdir && !(flags & EW_FILE))) return; - /* If the file isn't executable, may not add it. Do accept directories. */ - if (!isdir && (flags & EW_EXEC) && !mch_can_exe(f, NULL)) + /* If the file isn't executable, may not add it. Do accept directories. + * When invoked from expand_shellcmd() do not use $PATH. */ + if (!isdir && (flags & EW_EXEC) + && !mch_can_exe(f, NULL, !(flags & EW_SHELLCMD))) return; /* Make room for another item in the file list. */ @@ -10982,11 +11216,11 @@ addfile(gap, f, flags) * Returns an allocated string, or NULL for error. */ char_u * -get_cmd_output(cmd, infile, flags, ret_len) - char_u *cmd; - char_u *infile; /* optional input file name */ - int flags; /* can be SHELL_SILENT */ - int *ret_len; +get_cmd_output( + char_u *cmd, + char_u *infile, /* optional input file name */ + int flags, /* can be SHELL_SILENT */ + int *ret_len) { char_u *tempname; char_u *command; @@ -10999,7 +11233,7 @@ get_cmd_output(cmd, infile, flags, ret_len) return NULL; /* get a name for the temp file */ - if ((tempname = vim_tempname('o')) == NULL) + if ((tempname = vim_tempname('o', FALSE)) == NULL) { EMSG(_(e_notmp)); return NULL; @@ -11053,8 +11287,7 @@ get_cmd_output(cmd, infile, flags, ret_len) if (i != len) { EMSG2(_(e_notread), tempname); - vim_free(buffer); - buffer = NULL; + VIM_CLEAR(buffer); } else if (ret_len == NULL) { @@ -11079,23 +11312,13 @@ get_cmd_output(cmd, infile, flags, ret_len) * functions. */ void -FreeWild(count, files) - int count; - char_u **files; +FreeWild(int count, char_u **files) { if (count <= 0 || files == NULL) return; -#if defined(__EMX__) && defined(__ALWAYS_HAS_TRAILING_NULL_POINTER) /* XXX */ - /* - * Is this still OK for when other functions than expand_wildcards() have - * been used??? - */ - _fnexplodefree((char **)files); -#else while (count--) vim_free(files[count]); vim_free(files); -#endif } /* @@ -11104,7 +11327,7 @@ FreeWild(count, files) * Don't do this when inside a ":normal" command. */ int -goto_im() +goto_im(void) { return (p_im && stuff_empty() && typebuf_typed()); } @@ -11118,7 +11341,7 @@ goto_im() * But don't do that for Windows, it's common to have a space in the path. */ char_u * -get_isolated_shell_name() +get_isolated_shell_name(void) { char_u *p; @@ -11138,7 +11361,7 @@ get_isolated_shell_name() /* Find the last path separator before the space. */ p1 = p_sh; - for (p2 = p_sh; p2 < p; mb_ptr_adv(p2)) + for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2)) if (vim_ispathsep(*p2)) p1 = p2 + 1; p = vim_strnsave(p1, (int)(p - p1)); diff --git a/src/misc2.c b/src/misc2.c index dbbb61b761..a7aecd58ed 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -17,13 +17,13 @@ static char_u *username = NULL; /* cached result of mch_get_user_name() */ static char_u *ff_expand_buffer = NULL; /* used for expanding filenames */ #if defined(FEAT_VIRTUALEDIT) || defined(PROTO) -static int coladvance2 __ARGS((pos_T *pos, int addspaces, int finetune, colnr_T wcol)); +static int coladvance2(pos_T *pos, int addspaces, int finetune, colnr_T wcol); /* * Return TRUE if in the current mode we need to use virtual. */ int -virtual_active() +virtual_active(void) { /* While an operator is being executed we return "virtual_op", because * VIsual_active has already been reset, thus we can't check for "block" @@ -39,7 +39,7 @@ virtual_active() * Get the screen position of the cursor. */ int -getviscol() +getviscol(void) { colnr_T x; @@ -51,9 +51,7 @@ getviscol() * Get the screen position of character col with a coladd in the cursor line. */ int -getviscol2(col, coladd) - colnr_T col; - colnr_T coladd; +getviscol2(colnr_T col, colnr_T coladd) { colnr_T x; pos_T pos; @@ -71,8 +69,7 @@ getviscol2(col, coladd) * The caller must have saved the cursor line for undo! */ int -coladvance_force(wcol) - colnr_T wcol; +coladvance_force(colnr_T wcol) { int rc = coladvance2(&curwin->w_cursor, TRUE, FALSE, wcol); @@ -98,8 +95,7 @@ coladvance_force(wcol) * return OK if desired column is reached, FAIL if not */ int -coladvance(wcol) - colnr_T wcol; +coladvance(colnr_T wcol) { int rc = getvpos(&curwin->w_cursor, wcol); @@ -119,20 +115,18 @@ coladvance(wcol) * return OK if desired column is reached, FAIL if not */ int -getvpos(pos, wcol) - pos_T *pos; - colnr_T wcol; +getvpos(pos_T *pos, colnr_T wcol) { #ifdef FEAT_VIRTUALEDIT return coladvance2(pos, FALSE, virtual_active(), wcol); } static int -coladvance2(pos, addspaces, finetune, wcol) - pos_T *pos; - int addspaces; /* change the text to achieve our goal? */ - int finetune; /* change char offset for the exact column */ - colnr_T wcol; /* column to move to */ +coladvance2( + pos_T *pos, + int addspaces, /* change the text to achieve our goal? */ + int finetune, /* change char offset for the exact column */ + colnr_T wcol) /* column to move to */ { #endif int idx; @@ -171,13 +165,11 @@ coladvance2(pos, addspaces, finetune, wcol) else { #ifdef FEAT_VIRTUALEDIT - int width = W_WIDTH(curwin) - win_col_off(curwin); + int width = curwin->w_width - win_col_off(curwin); if (finetune && curwin->w_p_wrap -# ifdef FEAT_VERTSPLIT && curwin->w_width != 0 -# endif && wcol >= (colnr_T)width) { csize = linetabsize(line); @@ -202,7 +194,7 @@ coladvance2(pos, addspaces, finetune, wcol) /* Count a tab for what it's worth (if list mode not on) */ #ifdef FEAT_LINEBREAK csize = win_lbr_chartabsize(curwin, line, ptr, col, &head); - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); #else csize = lbr_chartabsize_adv(line, &ptr, col); #endif @@ -318,7 +310,7 @@ coladvance2(pos, addspaces, finetune, wcol) int b = (int)wcol - (int)col; /* The difference between wcol and col is used to set coladd. */ - if (b > 0 && b < (MAXCOL - 2 * W_WIDTH(curwin))) + if (b > 0 && b < (MAXCOL - 2 * curwin->w_width)) pos->coladd = b; col += b; @@ -341,7 +333,7 @@ coladvance2(pos, addspaces, finetune, wcol) * Increment the cursor position. See inc() for return values. */ int -inc_cursor() +inc_cursor(void) { return inc(&curwin->w_cursor); } @@ -354,27 +346,31 @@ inc_cursor() * Return 0 otherwise. */ int -inc(lp) - pos_T *lp; +inc(pos_T *lp) { - char_u *p = ml_get_pos(lp); + char_u *p; - if (*p != NUL) /* still within line, move to next char (may be NUL) */ + /* when searching position may be set to end of a line */ + if (lp->col != MAXCOL) { -#ifdef FEAT_MBYTE - if (has_mbyte) + p = ml_get_pos(lp); + if (*p != NUL) /* still within line, move to next char (may be NUL) */ { - int l = (*mb_ptr2len)(p); +#ifdef FEAT_MBYTE + if (has_mbyte) + { + int l = (*mb_ptr2len)(p); - lp->col += l; - return ((p[l] != NUL) ? 0 : 2); - } + lp->col += l; + return ((p[l] != NUL) ? 0 : 2); + } #endif - lp->col++; + lp->col++; #ifdef FEAT_VIRTUALEDIT - lp->coladd = 0; + lp->coladd = 0; #endif - return ((p[1] != NUL) ? 0 : 2); + return ((p[1] != NUL) ? 0 : 2); + } } if (lp->lnum != curbuf->b_ml.ml_line_count) /* there is a next line */ { @@ -392,8 +388,7 @@ inc(lp) * incl(lp): same as inc(), but skip the NUL at the end of non-empty lines */ int -incl(lp) - pos_T *lp; +incl(pos_T *lp) { int r; @@ -409,22 +404,34 @@ incl(lp) * Return 1 when crossing a line, -1 when at start of file, 0 otherwise. */ int -dec_cursor() +dec_cursor(void) { return dec(&curwin->w_cursor); } int -dec(lp) - pos_T *lp; +dec(pos_T *lp) { char_u *p; #ifdef FEAT_VIRTUALEDIT lp->coladd = 0; #endif - if (lp->col > 0) /* still within line */ + if (lp->col == MAXCOL) + { + /* past end of line */ + p = ml_get(lp->lnum); + lp->col = (colnr_T)STRLEN(p); +#ifdef FEAT_MBYTE + if (has_mbyte) + lp->col -= (*mb_head_off)(p, p + lp->col); +#endif + return 0; + } + + if (lp->col > 0) { + /* still within line */ lp->col--; #ifdef FEAT_MBYTE if (has_mbyte) @@ -435,8 +442,10 @@ dec(lp) #endif return 0; } - if (lp->lnum > 1) /* there is a prior line */ + + if (lp->lnum > 1) { + /* there is a prior line */ lp->lnum--; p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); @@ -446,15 +455,16 @@ dec(lp) #endif return 1; } - return -1; /* at start of file */ + + /* at start of file */ + return -1; } /* * decl(lp): same as dec(), but skip the NUL at the end of non-empty lines */ int -decl(lp) - pos_T *lp; +decl(pos_T *lp) { int r; @@ -469,9 +479,9 @@ decl(lp) * can be visible, folded lines don't count. */ linenr_T -get_cursor_rel_lnum(wp, lnum) - win_T *wp; - linenr_T lnum; /* line number to get the result for */ +get_cursor_rel_lnum( + win_T *wp, + linenr_T lnum) /* line number to get the result for */ { linenr_T cursor = wp->w_cursor.lnum; linenr_T retval = 0; @@ -514,11 +524,33 @@ get_cursor_rel_lnum(wp, lnum) return retval; } +/* + * Make sure "pos.lnum" and "pos.col" are valid in "buf". + * This allows for the col to be on the NUL byte. + */ + void +check_pos(buf_T *buf, pos_T *pos) +{ + char_u *line; + colnr_T len; + + if (pos->lnum > buf->b_ml.ml_line_count) + pos->lnum = buf->b_ml.ml_line_count; + + if (pos->col > 0) + { + line = ml_get_buf(buf, pos->lnum, FALSE); + len = (colnr_T)STRLEN(line); + if (pos->col > len) + pos->col = len; + } +} + /* * Make sure curwin->w_cursor.lnum is valid. */ void -check_cursor_lnum() +check_cursor_lnum(void) { if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { @@ -538,7 +570,7 @@ check_cursor_lnum() * Make sure curwin->w_cursor.col is valid. */ void -check_cursor_col() +check_cursor_col(void) { check_cursor_col_win(curwin); } @@ -547,8 +579,7 @@ check_cursor_col() * Make sure win->w_cursor.col is valid. */ void -check_cursor_col_win(win) - win_T *win; +check_cursor_col_win(win_T *win) { colnr_T len; #ifdef FEAT_VIRTUALEDIT @@ -594,7 +625,21 @@ check_cursor_col_win(win) else if (ve_flags == VE_ALL) { if (oldcoladd > win->w_cursor.col) + { win->w_cursor.coladd = oldcoladd - win->w_cursor.col; + + /* Make sure that coladd is not more than the char width. + * Not for the last character, coladd is then used when the cursor + * is actually after the last character. */ + if (win->w_cursor.col + 1 < len && win->w_cursor.coladd > 0) + { + int cs, ce; + + getvcol(win, &win->w_cursor, &cs, NULL, &ce); + if (win->w_cursor.coladd > ce - cs) + win->w_cursor.coladd = ce - cs; + } + } else /* avoid weird number when there is a miscalculation or overflow */ win->w_cursor.coladd = 0; @@ -606,7 +651,7 @@ check_cursor_col_win(win) * make sure curwin->w_cursor in on a valid character */ void -check_cursor() +check_cursor(void) { check_cursor_lnum(); check_cursor_col(); @@ -618,7 +663,7 @@ check_cursor() * Allow it when in Visual mode and 'selection' is not "old". */ void -adjust_cursor_col() +adjust_cursor_col(void) { if (curwin->w_cursor.col > 0 && (!VIsual_active || *p_sel == 'o') @@ -632,14 +677,14 @@ adjust_cursor_col() * Return TRUE if the cursor was moved. */ int -leftcol_changed() +leftcol_changed(void) { long lastcol; colnr_T s, e; int retval = FALSE; changed_cline_bef_curs(); - lastcol = curwin->w_leftcol + W_WIDTH(curwin) - curwin_col_off() - 1; + lastcol = curwin->w_leftcol + curwin->w_width - curwin_col_off() - 1; validate_virtcol(); /* @@ -699,29 +744,27 @@ static long_u mem_peak; static long_u num_alloc; static long_u num_freed; -static void mem_pre_alloc_s __ARGS((size_t *sizep)); -static void mem_pre_alloc_l __ARGS((long_u *sizep)); -static void mem_post_alloc __ARGS((void **pp, size_t size)); -static void mem_pre_free __ARGS((void **pp)); +static void mem_pre_alloc_s(size_t *sizep); +static void mem_pre_alloc_l(long_u *sizep); +static void mem_post_alloc(void **pp, size_t size); +static void mem_pre_free(void **pp); static void -mem_pre_alloc_s(sizep) - size_t *sizep; +mem_pre_alloc_s(size_t *sizep) { *sizep += sizeof(size_t); } static void -mem_pre_alloc_l(sizep) - long_u *sizep; +mem_pre_alloc_l(long_u *sizep) { *sizep += sizeof(size_t); } static void -mem_post_alloc(pp, size) - void **pp; - size_t size; +mem_post_alloc( + void **pp, + size_t size) { if (*pp == NULL) return; @@ -739,8 +782,7 @@ mem_post_alloc(pp, size) } static void -mem_pre_free(pp) - void **pp; +mem_pre_free(void **pp) { long_u size; @@ -758,7 +800,7 @@ mem_pre_free(pp) * called on exit via atexit() */ void -vim_mem_profile_dump() +vim_mem_profile_dump(void) { int i, j; @@ -797,16 +839,29 @@ vim_mem_profile_dump() #endif /* MEM_PROFILE */ +#ifdef FEAT_EVAL +static int alloc_does_fail(long_u size); + + static int +alloc_does_fail(long_u size) +{ + if (alloc_fail_countdown == 0) + { + if (--alloc_fail_repeat <= 0) + alloc_fail_id = 0; + do_outofmem_msg(size); + return TRUE; + } + --alloc_fail_countdown; + return FALSE; +} +#endif + /* * Some memory is reserved for error messages and for being able to * call mf_release_all(), which needs some memory for mf_trans_add(). */ -#if defined(MSDOS) && !defined(DJGPP) -# define SMALL_MEM -# define KEEP_ROOM 8192L -#else -# define KEEP_ROOM (2 * 8192L) -#endif +#define KEEP_ROOM (2 * 8192L) #define KEEP_ROOM_KB (KEEP_ROOM / 1024L) /* @@ -814,9 +869,21 @@ vim_mem_profile_dump() * Use lalloc for larger blocks. */ char_u * -alloc(size) - unsigned size; +alloc(unsigned size) +{ + return (lalloc((long_u)size, TRUE)); +} + +/* + * alloc() with an ID for alloc_fail(). + */ + char_u * +alloc_id(unsigned size, alloc_id_T id UNUSED) { +#ifdef FEAT_EVAL + if (alloc_fail_id == id && alloc_does_fail((long_u)size)) + return NULL; +#endif return (lalloc((long_u)size, TRUE)); } @@ -824,8 +891,7 @@ alloc(size) * Allocate memory and set all bytes to zero. */ char_u * -alloc_clear(size) - unsigned size; +alloc_clear(unsigned size) { char_u *p; @@ -839,10 +905,9 @@ alloc_clear(size) * alloc() with check for maximum line length */ char_u * -alloc_check(size) - unsigned size; +alloc_check(unsigned size) { -#if !defined(UNIX) && !defined(__EMX__) +#if !defined(UNIX) if (sizeof(int) == 2 && size > 0x7fff) { /* Don't hide this message */ @@ -858,9 +923,7 @@ alloc_check(size) * Allocate memory like lalloc() and set all bytes to zero. */ char_u * -lalloc_clear(size, message) - long_u size; - int message; +lalloc_clear(long_u size, int message) { char_u *p; @@ -875,14 +938,12 @@ lalloc_clear(size, message) * This is used often, KEEP IT FAST! */ char_u * -lalloc(size, message) - long_u size; - int message; +lalloc(long_u size, int message) { char_u *p; /* pointer to new storage space */ static int releasing = FALSE; /* don't do mf_release_all() recursive */ int try_again; -#if defined(HAVE_AVAIL_MEM) && !defined(SMALL_MEM) +#if defined(HAVE_AVAIL_MEM) static long_u allocated = 0; /* allocated since last avail check */ #endif @@ -891,7 +952,7 @@ lalloc(size, message) { /* Don't hide this message */ emsg_silent = 0; - EMSGN(_("E341: Internal error: lalloc(%ld, )"), size); + IEMSGN(_("E341: Internal error: lalloc(%ld, )"), size); return NULL; } @@ -899,12 +960,6 @@ lalloc(size, message) mem_pre_alloc_l(&size); #endif -#if defined(MSDOS) && !defined(DJGPP) - if (size >= 0xfff0) /* in MSDOS we can't deal with >64K blocks */ - p = NULL; - else -#endif - /* * Loop when out of memory: Try to release some memfile blocks and * if some blocks are released call malloc again. @@ -924,14 +979,13 @@ lalloc(size, message) /* 1. No check for available memory: Just return. */ goto theend; #else -# ifndef SMALL_MEM /* 2. Slow check for available memory: call mch_avail_mem() after * allocating (KEEP_ROOM / 2) amount of memory. */ allocated += size; if (allocated < KEEP_ROOM / 2) goto theend; allocated = 0; -# endif + /* 3. check for available memory: call mch_avail_mem() */ if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) { @@ -950,11 +1004,8 @@ lalloc(size, message) break; releasing = TRUE; - clear_sb_text(); /* free any scrollback text */ + clear_sb_text(TRUE); /* free any scrollback text */ try_again = mf_release_all(); /* release as many blocks as possible */ -#ifdef FEAT_EVAL - try_again |= garbage_collect(); /* cleanup recursive lists/dicts */ -#endif releasing = FALSE; if (!try_again) @@ -971,14 +1022,25 @@ lalloc(size, message) return p; } +/* + * lalloc() with an ID for alloc_fail(). + */ + char_u * +lalloc_id(long_u size, int message, alloc_id_T id UNUSED) +{ +#ifdef FEAT_EVAL + if (alloc_fail_id == id && alloc_does_fail(size)) + return NULL; +#endif + return (lalloc((long_u)size, message)); +} + #if defined(MEM_PROFILE) || defined(PROTO) /* * realloc() with memory profiling. */ void * -mem_realloc(ptr, size) - void *ptr; - size_t size; +mem_realloc(void *ptr, size_t size) { void *p; @@ -998,8 +1060,7 @@ mem_realloc(ptr, size) * Did_outofmem_msg is reset when a character is read. */ void -do_outofmem_msg(size) - long_u size; +do_outofmem_msg(long_u size) { if (!did_outofmem_msg) { @@ -1017,7 +1078,7 @@ do_outofmem_msg(size) #if defined(EXITFREE) || defined(PROTO) # if defined(FEAT_SEARCHPATH) -static void free_findfile __ARGS((void)); +static void free_findfile(void); # endif /* @@ -1028,35 +1089,35 @@ static void free_findfile __ARGS((void)); * Some things can't be freed, esp. things local to a library function. */ void -free_all_mem() +free_all_mem(void) { buf_T *buf, *nextbuf; - static int entered = FALSE; /* When we cause a crash here it is caught and Vim tries to exit cleanly. * Don't try freeing everything again. */ - if (entered) + if (entered_free_all_mem) return; - entered = TRUE; + entered_free_all_mem = TRUE; -# ifdef FEAT_AUTOCMD - block_autocmds(); /* don't want to trigger autocommands here */ -# endif + /* Don't want to trigger autocommands from here on. */ + block_autocmds(); -# ifdef FEAT_WINDOWS /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ p_ea = FALSE; if (first_tabpage->tp_next != NULL) do_cmdline_cmd((char_u *)"tabonly!"); - if (firstwin != lastwin) + if (!ONE_WINDOW) do_cmdline_cmd((char_u *)"only!"); -# endif # if defined(FEAT_SPELL) /* Free all spell info. */ spell_free_all(); # endif +#if defined(FEAT_INS_EXPAND) && defined(FEAT_BEVAL_TERM) + ui_remove_balloon(); +# endif + # if defined(FEAT_USR_CMDS) /* Clear user commands (before deleting buffers). */ ex_comclear(NULL); @@ -1094,11 +1155,8 @@ free_all_mem() # endif /* Obviously named calls. */ -# if defined(FEAT_AUTOCMD) free_all_autocmds(); -# endif clear_termcodes(); - free_all_options(); free_all_marks(); alist_clear(&global_alist); free_homedir(); @@ -1121,7 +1179,7 @@ free_all_mem() # ifdef FEAT_DIFF diff_clear(curtab); # endif - clear_sb_text(); /* free any scrollback text */ + clear_sb_text(TRUE); /* free any scrollback text */ /* Free some global vars. */ vim_free(username); @@ -1156,10 +1214,11 @@ free_all_mem() /* Close all script inputs. */ close_all_scripts(); -#if defined(FEAT_WINDOWS) /* Destroy all windows. Must come before freeing buffers. */ win_free_all(); -#endif + + /* Free all option values. Must come after closing windows. */ + free_all_options(); /* Free all buffers. Reset 'autochdir' to avoid accessing things that * were freed already. */ @@ -1168,9 +1227,12 @@ free_all_mem() #endif for (buf = firstbuf; buf != NULL; ) { + bufref_T bufref; + + set_bufref(&bufref, buf); nextbuf = buf->b_next; close_buffer(NULL, buf, DOBUF_WIPE, FALSE); - if (buf_valid(buf)) + if (bufref_valid(&bufref)) buf = nextbuf; /* didn't work, try next one */ else buf = firstbuf; @@ -1194,10 +1256,8 @@ free_all_mem() reset_last_sourcing(); -#ifdef FEAT_WINDOWS free_tabpage(first_tabpage); first_tabpage = NULL; -#endif # ifdef UNIX /* Machine-specific free. */ @@ -1209,9 +1269,20 @@ free_all_mem() if (delete_first_msg() == FAIL) break; +# ifdef FEAT_JOB_CHANNEL + channel_free_all(); +# endif +#ifdef FEAT_TIMERS + timer_free_all(); +#endif # ifdef FEAT_EVAL + /* must be after channel_free_all() with unrefs partials */ eval_clear(); # endif +# ifdef FEAT_JOB_CHANNEL + /* must be after eval_clear() with unrefs jobs */ + job_free_all(); +# endif free_termoptions(); @@ -1235,8 +1306,7 @@ free_all_mem() * Copy "string" into newly allocated memory. */ char_u * -vim_strsave(string) - char_u *string; +vim_strsave(char_u *string) { char_u *p; unsigned len; @@ -1255,9 +1325,7 @@ vim_strsave(string) * shorter. */ char_u * -vim_strnsave(string, len) - char_u *string; - int len; +vim_strnsave(char_u *string, int len) { char_u *p; @@ -1275,9 +1343,7 @@ vim_strnsave(string, len) * by a backslash. */ char_u * -vim_strsave_escaped(string, esc_chars) - char_u *string; - char_u *esc_chars; +vim_strsave_escaped(char_u *string, char_u *esc_chars) { return vim_strsave_escaped_ext(string, esc_chars, '\\', FALSE); } @@ -1288,11 +1354,11 @@ vim_strsave_escaped(string, esc_chars) * Escape the characters with "cc". */ char_u * -vim_strsave_escaped_ext(string, esc_chars, cc, bsl) - char_u *string; - char_u *esc_chars; - int cc; - int bsl; +vim_strsave_escaped_ext( + char_u *string, + char_u *esc_chars, + int cc, + int bsl) { char_u *p; char_u *p2; @@ -1349,7 +1415,7 @@ vim_strsave_escaped_ext(string, esc_chars, cc, bsl) * Return TRUE when 'shell' has "csh" in the tail. */ int -csh_like_shell() +csh_like_shell(void) { return (strstr((char *)gettail(p_sh), "csh") != NULL); } @@ -1365,10 +1431,7 @@ csh_like_shell() * Returns the result in allocated memory, NULL if we have run out. */ char_u * -vim_strsave_shellescape(string, do_special, do_newline) - char_u *string; - int do_special; - int do_newline; +vim_strsave_shellescape(char_u *string, int do_special, int do_newline) { unsigned length; char_u *p; @@ -1385,9 +1448,9 @@ vim_strsave_shellescape(string, do_special, do_newline) /* First count the number of extra bytes required. */ length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */ - for (p = string; *p != NUL; mb_ptr_adv(p)) + for (p = string; *p != NUL; MB_PTR_ADV(p)) { -# if defined(WIN32) || defined(WIN16) || defined(DOS) +# ifdef WIN32 if (!p_ssl) { if (*p == '"') @@ -1418,7 +1481,7 @@ vim_strsave_shellescape(string, do_special, do_newline) d = escaped_string; /* add opening quote */ -# if defined(WIN32) || defined(WIN16) || defined(DOS) +# ifdef WIN32 if (!p_ssl) *d++ = '"'; else @@ -1427,7 +1490,7 @@ vim_strsave_shellescape(string, do_special, do_newline) for (p = string; *p != NUL; ) { -# if defined(WIN32) || defined(WIN16) || defined(DOS) +# ifdef WIN32 if (!p_ssl) { if (*p == '"') @@ -1470,7 +1533,7 @@ vim_strsave_shellescape(string, do_special, do_newline) } /* add terminating quote and finish with a NUL */ -# if defined(WIN32) || defined(WIN16) || defined(DOS) +# ifdef WIN32 if (!p_ssl) *d++ = '"'; else @@ -1487,8 +1550,7 @@ vim_strsave_shellescape(string, do_special, do_newline) * This uses ASCII lower-to-upper case translation, language independent. */ char_u * -vim_strsave_up(string) - char_u *string; +vim_strsave_up(char_u *string) { char_u *p1; @@ -1502,9 +1564,7 @@ vim_strsave_up(string) * This uses ASCII lower-to-upper case translation, language independent. */ char_u * -vim_strnsave_up(string, len) - char_u *string; - int len; +vim_strnsave_up(char_u *string, int len) { char_u *p1; @@ -1517,8 +1577,8 @@ vim_strnsave_up(string, len) * ASCII lower-to-upper case translation, language independent. */ void -vim_strup(p) - char_u *p; +vim_strup( + char_u *p) { char_u *p2; int c; @@ -1542,8 +1602,7 @@ vim_strup(p) * Returns NULL when out of memory. */ char_u * -strup_save(orig) - char_u *orig; +strup_save(char_u *orig) { char_u *p; char_u *res; @@ -1563,17 +1622,26 @@ strup_save(orig) char_u *s; c = utf_ptr2char(p); + l = utf_ptr2len(p); + if (c == 0) + { + /* overlong sequence, use only the first byte */ + c = *p; + l = 1; + } uc = utf_toupper(c); /* Reallocate string when byte count changes. This is rare, * thus it's OK to do another malloc()/free(). */ - l = utf_ptr2len(p); newl = utf_char2len(uc); if (newl != l) { s = alloc((unsigned)STRLEN(res) + 1 + newl - l); if (s == NULL) - break; + { + vim_free(res); + return NULL; + } mch_memmove(s, res, p - res); STRCPY(s + (p - res) + newl, p + l); p = s + (p - res); @@ -1596,39 +1664,74 @@ strup_save(orig) return res; } -#endif /* - * copy a space a number of times + * Make string "s" all lower-case and return it in allocated memory. + * Handles multi-byte characters as well as possible. + * Returns NULL when out of memory. */ - void -copy_spaces(ptr, count) - char_u *ptr; - size_t count; + char_u * +strlow_save(char_u *orig) { - size_t i = count; - char_u *p = ptr; + char_u *p; + char_u *res; - while (i--) - *p++ = ' '; -} + res = p = vim_strsave(orig); -#if defined(FEAT_VISUALEXTRA) || defined(PROTO) -/* - * Copy a character a number of times. - * Does not work for multi-byte characters! - */ - void -copy_chars(ptr, count, c) - char_u *ptr; - size_t count; - int c; -{ - size_t i = count; - char_u *p = ptr; + if (res != NULL) + while (*p != NUL) + { +# ifdef FEAT_MBYTE + int l; - while (i--) - *p++ = c; + if (enc_utf8) + { + int c, lc; + int newl; + char_u *s; + + c = utf_ptr2char(p); + l = utf_ptr2len(p); + if (c == 0) + { + /* overlong sequence, use only the first byte */ + c = *p; + l = 1; + } + lc = utf_tolower(c); + + /* Reallocate string when byte count changes. This is rare, + * thus it's OK to do another malloc()/free(). */ + newl = utf_char2len(lc); + if (newl != l) + { + s = alloc((unsigned)STRLEN(res) + 1 + newl - l); + if (s == NULL) + { + vim_free(res); + return NULL; + } + mch_memmove(s, res, p - res); + STRCPY(s + (p - res) + newl, p + l); + p = s + (p - res); + vim_free(res); + res = s; + } + + utf_char2bytes(lc, p); + p += newl; + } + else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) + p += l; /* skip multi-byte character */ + else +# endif + { + *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ + p++; + } + } + + return res; } #endif @@ -1636,13 +1739,12 @@ copy_chars(ptr, count, c) * delete spaces at the end of a string */ void -del_trailing_spaces(ptr) - char_u *ptr; +del_trailing_spaces(char_u *ptr) { char_u *q; q = ptr + STRLEN(ptr); - while (--q > ptr && vim_iswhite(q[0]) && q[-1] != '\\' && q[-1] != Ctrl_V) + while (--q > ptr && VIM_ISWHITE(q[0]) && q[-1] != '\\' && q[-1] != Ctrl_V) *q = NUL; } @@ -1651,10 +1753,7 @@ del_trailing_spaces(ptr) * "to" must be "len + 1" long! */ void -vim_strncpy(to, from, len) - char_u *to; - char_u *from; - size_t len; +vim_strncpy(char_u *to, char_u *from, size_t len) { STRNCPY(to, from, len); to[len] = NUL; @@ -1662,13 +1761,10 @@ vim_strncpy(to, from, len) /* * Like strcat(), but make sure the result fits in "tosize" bytes and is - * always NUL terminated. + * always NUL terminated. "from" and "to" may overlap. */ void -vim_strcat(to, from, tosize) - char_u *to; - char_u *from; - size_t tosize; +vim_strcat(char_u *to, char_u *from, size_t tosize) { size_t tolen = STRLEN(to); size_t fromlen = STRLEN(from); @@ -1679,7 +1775,7 @@ vim_strcat(to, from, tosize) to[tosize - 1] = NUL; } else - STRCPY(to + tolen, from); + mch_memmove(to + tolen, from, fromlen + 1); } /* @@ -1690,11 +1786,11 @@ vim_strcat(to, from, tosize) * The length is returned. */ int -copy_option_part(option, buf, maxlen, sep_chars) - char_u **option; - char_u *buf; - int maxlen; - char *sep_chars; +copy_option_part( + char_u **option, + char_u *buf, + int maxlen, + char *sep_chars) { int len = 0; char_u *p = *option; @@ -1727,10 +1823,11 @@ copy_option_part(option, buf, maxlen, sep_chars) * Replacement for free() that ignores NULL pointers. * Also skip free() when exiting for sure, this helps when we caught a deadly * signal that was caused by a crash in free(). + * If you want to set NULL after calling this function, you should use + * VIM_CLEAR() instead. */ void -vim_free(x) - void *x; +vim_free(void *x) { if (x != NULL && !really_exiting) { @@ -1743,10 +1840,7 @@ vim_free(x) #ifndef HAVE_MEMSET void * -vim_memset(ptr, c, size) - void *ptr; - int c; - size_t size; +vim_memset(void *ptr, int c, size_t size) { char *p = ptr; @@ -1756,59 +1850,6 @@ vim_memset(ptr, c, size) } #endif -#ifdef VIM_MEMCMP -/* - * Return zero when "b1" and "b2" are the same for "len" bytes. - * Return non-zero otherwise. - */ - int -vim_memcmp(b1, b2, len) - void *b1; - void *b2; - size_t len; -{ - char_u *p1 = (char_u *)b1, *p2 = (char_u *)b2; - - for ( ; len > 0; --len) - { - if (*p1 != *p2) - return 1; - ++p1; - ++p2; - } - return 0; -} -#endif - -#ifdef VIM_MEMMOVE -/* - * Version of memmove() that handles overlapping source and destination. - * For systems that don't have a function that is guaranteed to do that (SYSV). - */ - void -mch_memmove(dst_arg, src_arg, len) - void *src_arg, *dst_arg; - size_t len; -{ - /* - * A void doesn't have a size, we use char pointers. - */ - char *dst = dst_arg, *src = src_arg; - - /* overlap, copy backwards */ - if (dst > src && dst < src + len) - { - src += len; - dst += len; - while (len-- > 0) - *--dst = *--src; - } - else /* copy forwards */ - while (len-- > 0) - *dst++ = *src++; -} -#endif - #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO) /* * Compare two strings, ignoring case, using current locale. @@ -1816,9 +1857,7 @@ mch_memmove(dst_arg, src_arg, len) * return 0 for match, < 0 for smaller, > 0 for bigger */ int -vim_stricmp(s1, s2) - char *s1; - char *s2; +vim_stricmp(char *s1, char *s2) { int i; @@ -1843,10 +1882,7 @@ vim_stricmp(s1, s2) * return 0 for match, < 0 for smaller, > 0 for bigger */ int -vim_strnicmp(s1, s2, len) - char *s1; - char *s2; - size_t len; +vim_strnicmp(char *s1, char *s2, size_t len) { int i; @@ -1871,9 +1907,7 @@ vim_strnicmp(s1, s2, len) * pointer to the NUL at the end of the string. */ char_u * -vim_strchr(string, c) - char_u *string; - int c; +vim_strchr(char_u *string, int c) { char_u *p; int b; @@ -1884,9 +1918,12 @@ vim_strchr(string, c) { while (*p != NUL) { - if (utf_ptr2char(p) == c) + int l = utfc_ptr2len(p); + + /* Avoid matching an illegal byte here. */ + if (utf_ptr2char(p) == c && l > 1) return p; - p += (*mb_ptr2len)(p); + p += l; } return NULL; } @@ -1929,9 +1966,7 @@ vim_strchr(string, c) * pointer to the NUL at the end of the string. */ char_u * -vim_strbyte(string, c) - char_u *string; - int c; +vim_strbyte(char_u *string, int c) { char_u *p = string; @@ -1950,9 +1985,7 @@ vim_strbyte(string, c) * Does not handle multi-byte char for "c"! */ char_u * -vim_strrchr(string, c) - char_u *string; - int c; +vim_strrchr(char_u *string, int c) { char_u *retval = NULL; char_u *p = string; @@ -1961,7 +1994,7 @@ vim_strrchr(string, c) { if (*p == c) retval = p; - mb_ptr_adv(p); + MB_PTR_ADV(p); } return retval; } @@ -1976,15 +2009,13 @@ vim_strrchr(string, c) # undef vim_strpbrk # endif char_u * -vim_strpbrk(s, charset) - char_u *s; - char_u *charset; +vim_strpbrk(char_u *s, char_u *charset) { while (*s) { if (vim_strchr(charset, *s) != NULL) return s; - mb_ptr_adv(s); + MB_PTR_ADV(s); } return NULL; } @@ -1996,8 +2027,7 @@ vim_strpbrk(s, charset) * can't handle characters above 128. */ int -vim_isspace(x) - int x; +vim_isspace(int x) { return ((x >= 9 && x <= 13) || x == ' '); } @@ -2010,8 +2040,7 @@ vim_isspace(x) * Clear an allocated growing array. */ void -ga_clear(gap) - garray_T *gap; +ga_clear(garray_T *gap) { vim_free(gap->ga_data); ga_init(gap); @@ -2021,8 +2050,7 @@ ga_clear(gap) * Clear a growing array that contains a list of strings. */ void -ga_clear_strings(gap) - garray_T *gap; +ga_clear_strings(garray_T *gap) { int i; @@ -2036,8 +2064,7 @@ ga_clear_strings(gap) * ga_growsize! Or use ga_init2(). */ void -ga_init(gap) - garray_T *gap; +ga_init(garray_T *gap) { gap->ga_data = NULL; gap->ga_maxlen = 0; @@ -2045,10 +2072,7 @@ ga_init(gap) } void -ga_init2(gap, itemsize, growsize) - garray_T *gap; - int itemsize; - int growsize; +ga_init2(garray_T *gap, int itemsize, int growsize) { ga_init(gap); gap->ga_itemsize = itemsize; @@ -2060,9 +2084,7 @@ ga_init2(gap, itemsize, growsize) * Return FAIL for failure, OK otherwise. */ int -ga_grow(gap, n) - garray_T *gap; - int n; +ga_grow(garray_T *gap, int n) { size_t old_len; size_t new_len; @@ -2091,9 +2113,7 @@ ga_grow(gap, n) * Returns NULL when out of memory. */ char_u * -ga_concat_strings(gap, sep) - garray_T *gap; - char *sep; +ga_concat_strings(garray_T *gap, char *sep) { int i; int len = 0; @@ -2123,17 +2143,39 @@ ga_concat_strings(gap, sep) return s; } +#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO) +/* + * Make a copy of string "p" and add it to "gap". + * When out of memory nothing changes. + */ + void +ga_add_string(garray_T *gap, char_u *p) +{ + char_u *cp = vim_strsave(p); + + if (cp != NULL) + { + if (ga_grow(gap, 1) == OK) + ((char_u **)(gap->ga_data))[gap->ga_len++] = cp; + else + vim_free(cp); + } +} +#endif + /* * Concatenate a string to a growarray which contains characters. + * When "s" is NULL does not do anything. * Note: Does NOT copy the NUL at the end! */ void -ga_concat(gap, s) - garray_T *gap; - char_u *s; +ga_concat(garray_T *gap, char_u *s) { - int len = (int)STRLEN(s); + int len; + if (s == NULL || *s == NUL) + return; + len = (int)STRLEN(s); if (ga_grow(gap, len) == OK) { mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len); @@ -2145,9 +2187,7 @@ ga_concat(gap, s) * Append one byte to a growarray which contains bytes. */ void -ga_append(gap, c) - garray_T *gap; - int c; +ga_append(garray_T *gap, int c) { if (ga_grow(gap, 1) == OK) { @@ -2162,8 +2202,7 @@ ga_append(gap, c) * Append the text in "gap" below the cursor line and clear "gap". */ void -append_ga_line(gap) - garray_T *gap; +append_ga_line(garray_T *gap) { /* Remove trailing CR. */ if (gap->ga_len > 0 @@ -2199,12 +2238,13 @@ static struct modmasktable {MOD_MASK_MULTI_CLICK, MOD_MASK_2CLICK, (char_u)'2'}, {MOD_MASK_MULTI_CLICK, MOD_MASK_3CLICK, (char_u)'3'}, {MOD_MASK_MULTI_CLICK, MOD_MASK_4CLICK, (char_u)'4'}, -#ifdef MACOS +#ifdef MACOS_X {MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D'}, #endif /* 'A' must be the last one */ {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A'}, {0, 0, NUL} + /* NOTE: when adding an entry, update MAX_KEY_NAME_LEN! */ }; /* @@ -2337,6 +2377,8 @@ static struct key_name_entry {K_XDOWN, (char_u *)"xDown"}, {K_XLEFT, (char_u *)"xLeft"}, {K_XRIGHT, (char_u *)"xRight"}, + {K_PS, (char_u *)"PasteStart"}, + {K_PE, (char_u *)"PasteEnd"}, {K_F1, (char_u *)"F1"}, {K_F2, (char_u *)"F2"}, @@ -2440,12 +2482,14 @@ static struct key_name_entry #endif #ifdef FEAT_MOUSE_SGR {K_SGR_MOUSE, (char_u *)"SgrMouse"}, + {K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"}, #endif {K_LEFTMOUSE, (char_u *)"LeftMouse"}, {K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"}, {K_LEFTDRAG, (char_u *)"LeftDrag"}, {K_LEFTRELEASE, (char_u *)"LeftRelease"}, {K_LEFTRELEASE_NM, (char_u *)"LeftReleaseNM"}, + {K_MOUSEMOVE, (char_u *)"MouseMove"}, {K_MIDDLEMOUSE, (char_u *)"MiddleMouse"}, {K_MIDDLEDRAG, (char_u *)"MiddleDrag"}, {K_MIDDLERELEASE, (char_u *)"MiddleRelease"}, @@ -2470,6 +2514,7 @@ static struct key_name_entry {K_SNR, (char_u *)"SNR"}, #endif {K_PLUG, (char_u *)"Plug"}, + {K_CURSORHOLD, (char_u *)"CursorHold"}, #ifdef FEAT_GUI_MACVIM {K_SWIPELEFT, (char_u *)"SwipeLeft"}, {K_SWIPERIGHT, (char_u *)"SwipeRight"}, @@ -2477,6 +2522,7 @@ static struct key_name_entry {K_SWIPEDOWN, (char_u *)"SwipeDown"}, #endif {0, NULL} + /* NOTE: When adding a long name update MAX_KEY_NAME_LEN. */ }; #define KEY_NAMES_TABLE_LEN (sizeof(key_names_table) / sizeof(struct key_name_entry)) @@ -2512,7 +2558,7 @@ static struct mousetable {(int)KE_X2DRAG, MOUSE_X2, FALSE, TRUE}, {(int)KE_X2RELEASE, MOUSE_X2, FALSE, FALSE}, /* DRAG without CLICK */ - {(int)KE_IGNORE, MOUSE_RELEASE, FALSE, TRUE}, + {(int)KE_MOUSEMOVE, MOUSE_RELEASE, FALSE, TRUE}, /* RELEASE without CLICK */ {(int)KE_IGNORE, MOUSE_RELEASE, FALSE, FALSE}, {0, 0, 0, 0}, @@ -2524,8 +2570,7 @@ static struct mousetable * modifier name ('S' for Shift, 'C' for Ctrl etc). */ int -name_to_mod_mask(c) - int c; +name_to_mod_mask(int c) { int i; @@ -2541,9 +2586,7 @@ name_to_mod_mask(c) * modifiers specified. */ int -simplify_key(key, modifiers) - int key; - int *modifiers; +simplify_key(int key, int *modifiers) { int i; int key0; @@ -2576,8 +2619,7 @@ simplify_key(key, modifiers) * Change <xHome> to <Home>, <xUp> to <Up>, etc. */ int -handle_x_keys(key) - int key; +handle_x_keys(int key) { switch (key) { @@ -2606,9 +2648,7 @@ handle_x_keys(key) * modifiers are down. */ char_u * -get_special_key_name(c, modifiers) - int c; - int modifiers; +get_special_key_name(int c, int modifiers) { static char_u string[MAX_KEY_NAME_LEN + 1]; @@ -2711,8 +2751,13 @@ get_special_key_name(c, modifiers) } else /* use name of special key */ { - STRCPY(string + idx, key_names_table[table_idx].name); - idx = (int)STRLEN(string); + size_t len = STRLEN(key_names_table[table_idx].name); + + if (len + idx + 2 <= MAX_KEY_NAME_LEN) + { + STRCPY(string + idx, key_names_table[table_idx].name); + idx += (int)len; + } } string[idx++] = '>'; string[idx] = NUL; @@ -2726,16 +2771,17 @@ get_special_key_name(c, modifiers) * dst[] must be big enough to hold the result (up to six characters)! */ int -trans_special(srcp, dst, keycode) - char_u **srcp; - char_u *dst; - int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ +trans_special( + char_u **srcp, + char_u *dst, + int keycode, /* prefer key code, e.g. K_DEL instead of DEL */ + int in_string) /* TRUE when inside a double quoted string */ { int modifiers = 0; int key; int dlen = 0; - key = find_special_key(srcp, &modifiers, keycode, FALSE); + key = find_special_key(srcp, &modifiers, keycode, FALSE, in_string); if (key == 0) return 0; @@ -2771,11 +2817,12 @@ trans_special(srcp, dst, keycode) * returns 0 if there is no match. */ int -find_special_key(srcp, modp, keycode, keep_x_key) - char_u **srcp; - int *modp; - int keycode; /* prefer key code, e.g. K_DEL instead of DEL */ - int keep_x_key; /* don't translate xHome to Home key */ +find_special_key( + char_u **srcp, + int *modp, + int keycode, /* prefer key code, e.g. K_DEL instead of DEL */ + int keep_x_key, /* don't translate xHome to Home key */ + int in_string) /* TRUE in string, double quote is escaped */ { char_u *last_dash; char_u *end_of_name; @@ -2784,7 +2831,7 @@ find_special_key(srcp, modp, keycode, keep_x_key) int modifiers; int bit; int key; - unsigned long n; + uvarnumber_T n; int l; src = *srcp; @@ -2806,15 +2853,21 @@ find_special_key(srcp, modp, keycode, keep_x_key) else #endif l = 1; - if (bp[l + 1] == '>') - bp += l; /* anything accepted, like <C-?> */ + /* Anything accepted, like <C-?>. + * <C-"> or <M-"> are not special in strings as " is + * the string delimiter. With a backslash it works: <M-\"> */ + if (!(in_string && bp[1] == '"') && bp[2] == '>') + bp += l; + else if (in_string && bp[1] == '\\' && bp[2] == '"' + && bp[3] == '>') + bp += 2; } } if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3]) bp += 3; /* skip t_xx, xx may be '-' or '>' */ else if (STRNICMP(bp, "char-", 5) == 0) { - vim_str2nr(bp + 5, NULL, &l, TRUE, TRUE, NULL, NULL); + vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0); bp += l + 5; break; } @@ -2846,25 +2899,27 @@ find_special_key(srcp, modp, keycode, keep_x_key) && VIM_ISDIGIT(last_dash[6])) { /* <Char-123> or <Char-033> or <Char-0x33> */ - vim_str2nr(last_dash + 6, NULL, NULL, TRUE, TRUE, NULL, &n); + vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0); key = (int)n; } else { - /* - * Modifier with single letter, or special key name. - */ + int off = 1; + + /* Modifier with single letter, or special key name. */ + if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') + off = 2; #ifdef FEAT_MBYTE if (has_mbyte) - l = mb_ptr2len(last_dash + 1); + l = mb_ptr2len(last_dash + off); else #endif l = 1; - if (modifiers != 0 && last_dash[l + 1] == '>') - key = PTR2CHAR(last_dash + 1); + if (modifiers != 0 && last_dash[l + off] == '>') + key = PTR2CHAR(last_dash + off); else { - key = get_special_key_code(last_dash + 1); + key = get_special_key_code(last_dash + off); if (!keep_x_key) key = handle_x_keys(key); } @@ -2911,13 +2966,11 @@ find_special_key(srcp, modp, keycode, keep_x_key) * Changes "Shift-a" to 'A', "Alt-A" to 0xc0, etc. */ int -extract_modifiers(key, modp) - int key; - int *modp; +extract_modifiers(int key, int *modp) { int modifiers = *modp; -#ifdef MACOS +#ifdef MACOS_X /* Command-key really special, no fancynest */ if (!(modifiers & MOD_MASK_CMD)) #endif @@ -2944,7 +2997,7 @@ extract_modifiers(key, modp) if (key == 0) key = K_ZERO; } -#ifdef MACOS +#ifdef MACOS_X /* Command-key really special, no fancynest */ if (!(modifiers & MOD_MASK_CMD)) #endif @@ -2967,8 +3020,7 @@ extract_modifiers(key, modp) * Return the index when found, -1 when not found. */ int -find_special_key_in_table(c) - int c; +find_special_key_in_table(int c) { int i; @@ -2988,8 +3040,7 @@ find_special_key_in_table(c) * Return the key code, or 0 if not found. */ int -get_special_key_code(name) - char_u *name; +get_special_key_code(char_u *name) { char_u *table_name; char_u string[3]; @@ -3021,8 +3072,7 @@ get_special_key_code(name) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) char_u * -get_key_name(i) - int i; +get_key_name(int i) { if (i >= (int)KEY_NAMES_TABLE_LEN) return NULL; @@ -3036,10 +3086,7 @@ get_key_name(i) * arguments. Return which button is down or was released. */ int -get_mouse_button(code, is_click, is_drag) - int code; - int *is_click; - int *is_drag; +get_mouse_button(int code, int *is_click, int *is_drag) { int i; @@ -3059,10 +3106,10 @@ get_mouse_button(code, is_click, is_drag) * mouse was clicked, dragged or released. */ int -get_pseudo_mouse_code(button, is_click, is_drag) - int button; /* eg MOUSE_LEFT */ - int is_click; - int is_drag; +get_pseudo_mouse_code( + int button, /* eg MOUSE_LEFT */ + int is_click, + int is_drag) { int i; @@ -3097,8 +3144,7 @@ get_pseudo_mouse_code(button, is_click, is_drag) * Return the current end-of-line type: EOL_DOS, EOL_UNIX or EOL_MAC. */ int -get_fileformat(buf) - buf_T *buf; +get_fileformat(buf_T *buf) { int c = *buf->b_p_ff; @@ -3114,14 +3160,14 @@ get_fileformat(buf) * argument. */ int -get_fileformat_force(buf, eap) - buf_T *buf; - exarg_T *eap; /* can be NULL! */ +get_fileformat_force( + buf_T *buf, + exarg_T *eap) /* can be NULL! */ { int c; if (eap != NULL && eap->force_ff != 0) - c = eap->cmd[eap->force_ff]; + c = eap->force_ff; else { if ((eap != NULL && eap->force_bin != 0) @@ -3142,9 +3188,9 @@ get_fileformat_force(buf, eap) * Note: Does _not_ set global value of 'textmode'! */ void -set_fileformat(t, opt_flags) - int t; - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +set_fileformat( + int t, + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { char *p = NULL; @@ -3167,11 +3213,9 @@ set_fileformat(t, opt_flags) set_string_option_direct((char_u *)"ff", -1, (char_u *)p, OPT_FREE | opt_flags, 0); -#ifdef FEAT_WINDOWS /* This may cause the buffer to become (un)modified. */ check_status(curbuf); redraw_tabline = TRUE; -#endif #ifdef FEAT_TITLE need_maketitle = TRUE; /* set window title later */ #endif @@ -3181,7 +3225,7 @@ set_fileformat(t, opt_flags) * Return the default fileformat from 'fileformats'. */ int -default_fileformat() +default_fileformat(void) { switch (*p_ffs) { @@ -3195,9 +3239,7 @@ default_fileformat() * Call shell. Calls mch_call_shell, with 'shellxquote' added. */ int -call_shell(cmd, opt) - char_u *cmd; - int opt; +call_shell(char_u *cmd, int opt) { char_u *ncmd; int retval; @@ -3293,7 +3335,7 @@ call_shell(cmd, opt) * NORMAL State with a condition. This function returns the real State. */ int -get_real_state() +get_real_state(void) { if (State & NORMAL) { @@ -3316,9 +3358,7 @@ get_real_state() * "b" must point to the start of the file name */ int -after_pathsep(b, p) - char_u *b; - char_u *p; +after_pathsep(char_u *b, char_u *p) { return p > b && vim_ispathsep(p[-1]) && (!has_mbyte || (*mb_head_off)(b, p - 1) == 0); @@ -3330,9 +3370,7 @@ after_pathsep(b, p) * "f1" may be a short name, "f2" must be a full path. */ int -same_directory(f1, f2) - char_u *f1; - char_u *f2; +same_directory(char_u *f1, char_u *f2) { char_u ffname[MAXPATHL]; char_u *t1; @@ -3350,8 +3388,7 @@ same_directory(f1, f2) } #if defined(FEAT_SESSION) || defined(MSWIN) || defined(FEAT_GUI_MAC) \ - || ((defined(FEAT_GUI_GTK)) \ - && ( defined(FEAT_WINDOWS) || defined(FEAT_DND)) ) \ + || defined(FEAT_GUI_GTK) \ || defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) \ || defined(PROTO) /* @@ -3360,14 +3397,18 @@ same_directory(f1, f2) * Return OK or FAIL. */ int -vim_chdirfile(fname) - char_u *fname; +vim_chdirfile(char_u *fname, char *trigger_autocmd UNUSED) { char_u dir[MAXPATHL]; + int res; vim_strncpy(dir, fname, MAXPATHL - 1); *gettail_sep(dir) = NUL; - return mch_chdir((char *)dir) == 0 ? OK : FAIL; + res = mch_chdir((char *)dir) == 0 ? OK : FAIL; + if (res == OK && trigger_autocmd != NULL) + apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, + dir, FALSE, curbuf); + return res; } #endif @@ -3377,9 +3418,8 @@ vim_chdirfile(fname) * Used for systems where stat() ignores a trailing slash on a file name. * The Vim code assumes a trailing slash is only ignored for a directory. */ - int -illegal_slash(name) - char *name; + static int +illegal_slash(const char *name) { if (name[0] == NUL) return FALSE; /* no file name is not illegal */ @@ -3389,6 +3429,17 @@ illegal_slash(name) return FALSE; /* trailing slash for a directory */ return TRUE; } + +/* + * Special implementation of mch_stat() for Solaris. + */ + int +vim_stat(const char *name, stat_T *stp) +{ + /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if + * the name ends in "/" and it's not a directory. */ + return illegal_slash(name) ? -1 : stat(name, stp); +} #endif #if defined(CURSOR_SHAPE) || defined(PROTO) @@ -3454,8 +3505,7 @@ static char * mshape_names[] = * Returns error message for an illegal option, NULL otherwise. */ char_u * -parse_shape_opt(what) - int what; +parse_shape_opt(int what) { char_u *modep; char_u *colonp; @@ -3487,11 +3537,12 @@ parse_shape_opt(what) while (*modep != NUL) { colonp = vim_strchr(modep, ':'); - if (colonp == NULL) + commap = vim_strchr(modep, ','); + + if (colonp == NULL || (commap != NULL && commap < colonp)) return (char_u *)N_("E545: Missing colon"); if (colonp == modep) return (char_u *)N_("E546: Illegal mode"); - commap = vim_strchr(modep, ','); /* * Repeat for all mode's before the colon. @@ -3701,8 +3752,7 @@ parse_shape_opt(what) * When "mouse" is TRUE, consider indexes valid for the mouse pointer. */ int -get_shape_idx(mouse) - int mouse; +get_shape_idx(int mouse) { #ifdef FEAT_MOUSESHAPE if (mouse && (State == HITRETURN || State == ASKMORE)) @@ -3717,10 +3767,8 @@ get_shape_idx(mouse) } if (mouse && drag_status_line) return SHAPE_IDX_SDRAG; -# ifdef FEAT_VERTSPLIT if (mouse && drag_sep_line) return SHAPE_IDX_VDRAG; -# endif #endif if (!mouse && State == SHOWMATCH) return SHAPE_IDX_SM; @@ -3764,8 +3812,7 @@ static int old_mouse_shape = 0; * when the mouse moves off the status or command line). */ void -update_mouseshape(shape_idx) - int shape_idx; +update_mouseshape(int shape_idx) { int new_mouse_shape; @@ -3809,335 +3856,19 @@ update_mouseshape(shape_idx) #endif /* CURSOR_SHAPE */ -#ifdef FEAT_CRYPT +/* TODO: make some #ifdef for this */ +/*--------[ file searching ]-------------------------------------------------*/ /* - * Optional encryption support. - * Mohsin Ahmed, mosh@sasi.com, 98-09-24 - * Based on zip/crypt sources. + * File searching functions for 'path', 'tags' and 'cdpath' options. + * External visible functions: + * vim_findfile_init() creates/initialises the search context + * vim_findfile_free_visited() free list of visited files/dirs of search + * context + * vim_findfile() find a file in the search context + * vim_findfile_cleanup() cleanup/free search context created by + * vim_findfile_init() * - * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to - * most countries. There are a few exceptions, but that still should not be a - * problem since this code was originally created in Europe and India. - * - * Blowfish addition originally made by Mohsin Ahmed, - * http://www.cs.albany.edu/~mosh 2010-03-14 - * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html) - * and sha256 by Christophe Devine. - */ - -/* from zip.h */ - -typedef unsigned short ush; /* unsigned 16-bit value */ -typedef unsigned long ulg; /* unsigned 32-bit value */ - -static void make_crc_tab __ARGS((void)); - -static ulg crc_32_tab[256]; - -/* - * Fill the CRC table. - */ - static void -make_crc_tab() -{ - ulg s,t,v; - static int done = FALSE; - - if (done) - return; - for (t = 0; t < 256; t++) - { - v = t; - for (s = 0; s < 8; s++) - v = (v >> 1) ^ ((v & 1) * (ulg)0xedb88320L); - crc_32_tab[t] = v; - } - done = TRUE; -} - -#define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) - -static ulg keys[3]; /* keys defining the pseudo-random sequence */ - -/* - * Return the next byte in the pseudo-random sequence. - */ -#define DECRYPT_BYTE_ZIP(t) { \ - ush temp; \ - \ - temp = (ush)keys[2] | 2; \ - t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \ -} - -/* - * Update the encryption keys with the next byte of plain text. - */ -#define UPDATE_KEYS_ZIP(c) { \ - keys[0] = CRC32(keys[0], (c)); \ - keys[1] += keys[0] & 0xff; \ - keys[1] = keys[1] * 134775813L + 1; \ - keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \ -} - -static int crypt_busy = 0; -static ulg saved_keys[3]; -static int saved_crypt_method; - -/* - * Return int value for crypt method string: - * 0 for "zip", the old method. Also for any non-valid value. - * 1 for "blowfish". - */ - int -crypt_method_from_string(s) - char_u *s; -{ - return *s == 'b' ? 1 : 0; -} - -/* - * Get the crypt method for buffer "buf" as a number. - */ - int -get_crypt_method(buf) - buf_T *buf; -{ - return crypt_method_from_string(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); -} - -/* - * Set the crypt method for buffer "buf" to "method" using the int value as - * returned by crypt_method_from_string(). - */ - void -set_crypt_method(buf, method) - buf_T *buf; - int method; -{ - free_string_option(buf->b_p_cm); - buf->b_p_cm = vim_strsave((char_u *)(method == 0 ? "zip" : "blowfish")); -} - -/* - * Prepare for initializing encryption. If already doing encryption then save - * the state. - * Must always be called symmetrically with crypt_pop_state(). - */ - void -crypt_push_state() -{ - if (crypt_busy == 1) - { - /* save the state */ - if (use_crypt_method == 0) - { - saved_keys[0] = keys[0]; - saved_keys[1] = keys[1]; - saved_keys[2] = keys[2]; - } - else - bf_crypt_save(); - saved_crypt_method = use_crypt_method; - } - else if (crypt_busy > 1) - EMSG2(_(e_intern2), "crypt_push_state()"); - ++crypt_busy; -} - -/* - * End encryption. If doing encryption before crypt_push_state() then restore - * the saved state. - * Must always be called symmetrically with crypt_push_state(). - */ - void -crypt_pop_state() -{ - --crypt_busy; - if (crypt_busy == 1) - { - use_crypt_method = saved_crypt_method; - if (use_crypt_method == 0) - { - keys[0] = saved_keys[0]; - keys[1] = saved_keys[1]; - keys[2] = saved_keys[2]; - } - else - bf_crypt_restore(); - } -} - -/* - * Encrypt "from[len]" into "to[len]". - * "from" and "to" can be equal to encrypt in place. - */ - void -crypt_encode(from, len, to) - char_u *from; - size_t len; - char_u *to; -{ - size_t i; - int ztemp, t; - - if (use_crypt_method == 0) - for (i = 0; i < len; ++i) - { - ztemp = from[i]; - DECRYPT_BYTE_ZIP(t); - UPDATE_KEYS_ZIP(ztemp); - to[i] = t ^ ztemp; - } - else - bf_crypt_encode(from, len, to); -} - -/* - * Decrypt "ptr[len]" in place. - */ - void -crypt_decode(ptr, len) - char_u *ptr; - long len; -{ - char_u *p; - - if (use_crypt_method == 0) - for (p = ptr; p < ptr + len; ++p) - { - ush temp; - - temp = (ush)keys[2] | 2; - temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); - UPDATE_KEYS_ZIP(*p ^= temp); - } - else - bf_crypt_decode(ptr, len); -} - -/* - * Initialize the encryption keys and the random header according to - * the given password. - * If "passwd" is NULL or empty, don't do anything. - */ - void -crypt_init_keys(passwd) - char_u *passwd; /* password string with which to modify keys */ -{ - if (passwd != NULL && *passwd != NUL) - { - if (use_crypt_method == 0) - { - char_u *p; - - make_crc_tab(); - keys[0] = 305419896L; - keys[1] = 591751049L; - keys[2] = 878082192L; - for (p = passwd; *p!= NUL; ++p) - { - UPDATE_KEYS_ZIP((int)*p); - } - } - else - bf_crypt_init_keys(passwd); - } -} - -/* - * Free an allocated crypt key. Clear the text to make sure it doesn't stay - * in memory anywhere. - */ - void -free_crypt_key(key) - char_u *key; -{ - char_u *p; - - if (key != NULL) - { - for (p = key; *p != NUL; ++p) - *p = 0; - vim_free(key); - } -} - -/* - * Ask the user for a crypt key. - * When "store" is TRUE, the new key is stored in the 'key' option, and the - * 'key' option value is returned: Don't free it. - * When "store" is FALSE, the typed key is returned in allocated memory. - * Returns NULL on failure. - */ - char_u * -get_crypt_key(store, twice) - int store; - int twice; /* Ask for the key twice. */ -{ - char_u *p1, *p2 = NULL; - int round; - - for (round = 0; ; ++round) - { - cmdline_star = TRUE; - cmdline_row = msg_row; - p1 = getcmdline_prompt(NUL, round == 0 - ? (char_u *)_("Enter encryption key: ") - : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING, - NULL); - cmdline_star = FALSE; - - if (p1 == NULL) - break; - - if (round == twice) - { - if (p2 != NULL && STRCMP(p1, p2) != 0) - { - MSG(_("Keys don't match!")); - free_crypt_key(p1); - free_crypt_key(p2); - p2 = NULL; - round = -1; /* do it again */ - continue; - } - - if (store) - { - set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL); - free_crypt_key(p1); - p1 = curbuf->b_p_key; - } - break; - } - p2 = p1; - } - - /* since the user typed this, no need to wait for return */ - if (msg_didout) - msg_putchar('\n'); - need_wait_return = FALSE; - msg_didout = FALSE; - - free_crypt_key(p2); - return p1; -} - -#endif /* FEAT_CRYPT */ - -/* TODO: make some #ifdef for this */ -/*--------[ file searching ]-------------------------------------------------*/ -/* - * File searching functions for 'path', 'tags' and 'cdpath' options. - * External visible functions: - * vim_findfile_init() creates/initialises the search context - * vim_findfile_free_visited() free list of visited files/dirs of search - * context - * vim_findfile() find a file in the search context - * vim_findfile_cleanup() cleanup/free search context created by - * vim_findfile_init() - * - * All static functions and variables start with 'ff_' + * All static functions and variables start with 'ff_' * * In general it works like this: * First you create yourself a search context by calling vim_findfile_init(). @@ -4305,28 +4036,28 @@ typedef struct ff_search_ctx_T /* locally needed functions */ #ifdef FEAT_PATH_EXTRA -static int ff_check_visited __ARGS((ff_visited_T **, char_u *, char_u *)); +static int ff_check_visited(ff_visited_T **, char_u *, char_u *); #else -static int ff_check_visited __ARGS((ff_visited_T **, char_u *)); +static int ff_check_visited(ff_visited_T **, char_u *); #endif -static void vim_findfile_free_visited_list __ARGS((ff_visited_list_hdr_T **list_headp)); -static void ff_free_visited_list __ARGS((ff_visited_T *vl)); -static ff_visited_list_hdr_T* ff_get_visited_list __ARGS((char_u *, ff_visited_list_hdr_T **list_headp)); +static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); +static void ff_free_visited_list(ff_visited_T *vl); +static ff_visited_list_hdr_T* ff_get_visited_list(char_u *, ff_visited_list_hdr_T **list_headp); #ifdef FEAT_PATH_EXTRA -static int ff_wc_equal __ARGS((char_u *s1, char_u *s2)); +static int ff_wc_equal(char_u *s1, char_u *s2); #endif -static void ff_push __ARGS((ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr)); -static ff_stack_T *ff_pop __ARGS((ff_search_ctx_T *search_ctx)); -static void ff_clear __ARGS((ff_search_ctx_T *search_ctx)); -static void ff_free_stack_element __ARGS((ff_stack_T *stack_ptr)); +static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr); +static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx); +static void ff_clear(ff_search_ctx_T *search_ctx); +static void ff_free_stack_element(ff_stack_T *stack_ptr); #ifdef FEAT_PATH_EXTRA -static ff_stack_T *ff_create_stack_element __ARGS((char_u *, char_u *, int, int)); +static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int); #else -static ff_stack_T *ff_create_stack_element __ARGS((char_u *, int, int)); +static ff_stack_T *ff_create_stack_element(char_u *, int, int); #endif #ifdef FEAT_PATH_EXTRA -static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **)); +static int ff_path_in_stoplist(char_u *, int, char_u **); #endif static char_u e_pathtoolong[] = N_("E854: path too long for completion"); @@ -4340,10 +4071,7 @@ static char_u e_pathtoolong[] = N_("E854: path too long for completion"); static void *ff_fn_search_context = NULL; char_u * -vim_findfirst(path, filename, level) - char_u *path; - char_u *filename; - int level; +vim_findfirst(char_u *path, char_u *filename, int level) { ff_fn_search_context = vim_findfile_init(path, filename, NULL, level, TRUE, FALSE, @@ -4355,7 +4083,7 @@ vim_findfirst(path, filename, level) } char_u * -vim_findnext() +vim_findnext(void) { char_u *ret = vim_findfile(ff_fn_search_context); @@ -4421,17 +4149,16 @@ vim_findnext() * limited functionality then. */ void * -vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what, - search_ctx_arg, tagfile, rel_fname) - char_u *path; - char_u *filename; - char_u *stopdirs UNUSED; - int level; - int free_visited; - int find_what; - void *search_ctx_arg; - int tagfile; /* expanding names of tags files */ - char_u *rel_fname; /* file name to use for "." */ +vim_findfile_init( + char_u *path, + char_u *filename, + char_u *stopdirs UNUSED, + int level, + int free_visited, + int find_what, + void *search_ctx_arg, + int tagfile, /* expanding names of tags files */ + char_u *rel_fname) /* file name to use for "." */ { #ifdef FEAT_PATH_EXTRA char_u *wc_part; @@ -4720,21 +4447,20 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what, temp = alloc((int)(STRLEN(search_ctx->ffsc_wc_path) + STRLEN(search_ctx->ffsc_fix_path + len) + 1)); - } + if (temp == NULL || wc_path == NULL) + { + vim_free(buf); + vim_free(temp); + vim_free(wc_path); + goto error_return; + } - if (temp == NULL || wc_path == NULL) - { - vim_free(buf); - vim_free(temp); + STRCPY(temp, search_ctx->ffsc_fix_path + len); + STRCAT(temp, search_ctx->ffsc_wc_path); + vim_free(search_ctx->ffsc_wc_path); vim_free(wc_path); - goto error_return; + search_ctx->ffsc_wc_path = temp; } - - STRCPY(temp, search_ctx->ffsc_fix_path + len); - STRCAT(temp, search_ctx->ffsc_wc_path); - vim_free(search_ctx->ffsc_wc_path); - vim_free(wc_path); - search_ctx->ffsc_wc_path = temp; } #endif vim_free(buf); @@ -4772,8 +4498,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what, * Get the stopdir string. Check that ';' is not escaped. */ char_u * -vim_findfile_stopdir(buf) - char_u *buf; +vim_findfile_stopdir(char_u *buf) { char_u *r_ptr = buf; @@ -4803,8 +4528,7 @@ vim_findfile_stopdir(buf) * Clean up the given search context. Can handle a NULL pointer. */ void -vim_findfile_cleanup(ctx) - void *ctx; +vim_findfile_cleanup(void *ctx) { if (ctx == NULL) return; @@ -4827,8 +4551,7 @@ vim_findfile_cleanup(ctx) * top of the list). */ char_u * -vim_findfile(search_ctx_arg) - void *search_ctx_arg; +vim_findfile(void *search_ctx_arg) { char_u *file_path; #ifdef FEAT_PATH_EXTRA @@ -4966,13 +4689,23 @@ vim_findfile(search_ctx_arg) if (!vim_isAbsName(stackp->ffs_fix_path) && search_ctx->ffsc_start_dir) { - STRCPY(file_path, search_ctx->ffsc_start_dir); - add_pathsep(file_path); + if (STRLEN(search_ctx->ffsc_start_dir) + 1 < MAXPATHL) + { + STRCPY(file_path, search_ctx->ffsc_start_dir); + add_pathsep(file_path); + } + else + goto fail; } /* append the fix part of the search path */ - STRCAT(file_path, stackp->ffs_fix_path); - add_pathsep(file_path); + if (STRLEN(file_path) + STRLEN(stackp->ffs_fix_path) + 1 < MAXPATHL) + { + STRCAT(file_path, stackp->ffs_fix_path); + add_pathsep(file_path); + } + else + goto fail; #ifdef FEAT_PATH_EXTRA rest_of_wildcards = stackp->ffs_wc_path; @@ -4989,7 +4722,10 @@ vim_findfile(search_ctx_arg) if (*p > 0) { (*p)--; - file_path[len++] = '*'; + if (len + 1 < MAXPATHL) + file_path[len++] = '*'; + else + goto fail; } if (*p == 0) @@ -5017,7 +4753,10 @@ vim_findfile(search_ctx_arg) */ while (*rest_of_wildcards && !vim_ispathsep(*rest_of_wildcards)) - file_path[len++] = *rest_of_wildcards++; + if (len + 1 < MAXPATHL) + file_path[len++] = *rest_of_wildcards++; + else + goto fail; file_path[len] = NUL; if (vim_ispathsep(*rest_of_wildcards)) @@ -5078,9 +4817,15 @@ vim_findfile(search_ctx_arg) /* prepare the filename to be checked for existence * below */ - STRCPY(file_path, stackp->ffs_filearray[i]); - add_pathsep(file_path); - STRCAT(file_path, search_ctx->ffsc_file_to_search); + if (STRLEN(stackp->ffs_filearray[i]) + 1 + + STRLEN(search_ctx->ffsc_file_to_search) < MAXPATHL) + { + STRCPY(file_path, stackp->ffs_filearray[i]); + add_pathsep(file_path); + STRCAT(file_path, search_ctx->ffsc_file_to_search); + } + else + goto fail; /* * Try without extra suffix and then with suffixes @@ -5253,9 +4998,15 @@ vim_findfile(search_ctx_arg) if (*search_ctx->ffsc_start_dir == 0) break; - STRCPY(file_path, search_ctx->ffsc_start_dir); - add_pathsep(file_path); - STRCAT(file_path, search_ctx->ffsc_fix_path); + if (STRLEN(search_ctx->ffsc_start_dir) + 1 + + STRLEN(search_ctx->ffsc_fix_path) < MAXPATHL) + { + STRCPY(file_path, search_ctx->ffsc_start_dir); + add_pathsep(file_path); + STRCAT(file_path, search_ctx->ffsc_fix_path); + } + else + goto fail; /* create a new stack entry */ sptr = ff_create_stack_element(file_path, @@ -5269,6 +5020,7 @@ vim_findfile(search_ctx_arg) } #endif +fail: vim_free(file_path); return NULL; } @@ -5278,8 +5030,7 @@ vim_findfile(search_ctx_arg) * Can handle it if the passed search_context is NULL; */ void -vim_findfile_free_visited(search_ctx_arg) - void *search_ctx_arg; +vim_findfile_free_visited(void *search_ctx_arg) { ff_search_ctx_T *search_ctx; @@ -5292,8 +5043,7 @@ vim_findfile_free_visited(search_ctx_arg) } static void -vim_findfile_free_visited_list(list_headp) - ff_visited_list_hdr_T **list_headp; +vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp) { ff_visited_list_hdr_T *vp; @@ -5310,8 +5060,7 @@ vim_findfile_free_visited_list(list_headp) } static void -ff_free_visited_list(vl) - ff_visited_T *vl; +ff_free_visited_list(ff_visited_T *vl) { ff_visited_T *vp; @@ -5332,9 +5081,9 @@ ff_free_visited_list(vl) * allocates a new one. */ static ff_visited_list_hdr_T* -ff_get_visited_list(filename, list_headp) - char_u *filename; - ff_visited_list_hdr_T **list_headp; +ff_get_visited_list( + char_u *filename, + ff_visited_list_hdr_T **list_headp) { ff_visited_list_hdr_T *retptr = NULL; @@ -5405,11 +5154,11 @@ ff_get_visited_list(filename, list_headp) * '**\20' is equal to '**\24' */ static int -ff_wc_equal(s1, s2) - char_u *s1; - char_u *s2; +ff_wc_equal(char_u *s1, char_u *s2) { - int i; + int i, j; + int c1 = NUL; + int c2 = NUL; int prev1 = NUL; int prev2 = NUL; @@ -5419,21 +5168,21 @@ ff_wc_equal(s1, s2) if (s1 == NULL || s2 == NULL) return FALSE; - if (STRLEN(s1) != STRLEN(s2)) - return FAIL; - - for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i)) + for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) { - int c1 = PTR2CHAR(s1 + i); - int c2 = PTR2CHAR(s2 + i); + c1 = PTR2CHAR(s1 + i); + c2 = PTR2CHAR(s2 + j); if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2) && (prev1 != '*' || prev2 != '*')) - return FAIL; + return FALSE; prev2 = prev1; prev1 = c1; + + i += MB_PTR2LEN(s1 + i); + j += MB_PTR2LEN(s2 + j); } - return TRUE; + return s1[i] == s2[j]; } #endif @@ -5447,20 +5196,17 @@ ff_wc_equal(s1, s2) * never. */ static int -ff_check_visited(visited_list, fname +ff_check_visited( + ff_visited_T **visited_list, + char_u *fname #ifdef FEAT_PATH_EXTRA - , wc_path -#endif - ) - ff_visited_T **visited_list; - char_u *fname; -#ifdef FEAT_PATH_EXTRA - char_u *wc_path; + , char_u *wc_path #endif + ) { ff_visited_T *vp; #ifdef UNIX - struct stat st; + stat_T st; int url = FALSE; #endif @@ -5547,17 +5293,13 @@ ff_check_visited(visited_list, fname * create stack element from given path pieces */ static ff_stack_T * -ff_create_stack_element(fix_part, -#ifdef FEAT_PATH_EXTRA - wc_part, -#endif - level, star_star_empty) - char_u *fix_part; +ff_create_stack_element( + char_u *fix_part, #ifdef FEAT_PATH_EXTRA - char_u *wc_part; + char_u *wc_part, #endif - int level; - int star_star_empty; + int level, + int star_star_empty) { ff_stack_T *new; @@ -5571,7 +5313,7 @@ ff_create_stack_element(fix_part, new->ffs_filearray_cur = 0; new->ffs_stage = 0; new->ffs_level = level; - new->ffs_star_star_empty = star_star_empty;; + new->ffs_star_star_empty = star_star_empty; /* the following saves NULL pointer checks in vim_findfile */ if (fix_part == NULL) @@ -5601,9 +5343,7 @@ ff_create_stack_element(fix_part, * Push a dir on the directory stack. */ static void -ff_push(search_ctx, stack_ptr) - ff_search_ctx_T *search_ctx; - ff_stack_T *stack_ptr; +ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr) { /* check for NULL pointer, not to return an error to the user, but * to prevent a crash */ @@ -5619,8 +5359,7 @@ ff_push(search_ctx, stack_ptr) * Returns NULL if stack is empty. */ static ff_stack_T * -ff_pop(search_ctx) - ff_search_ctx_T *search_ctx; +ff_pop(ff_search_ctx_T *search_ctx) { ff_stack_T *sptr; @@ -5635,8 +5374,7 @@ ff_pop(search_ctx) * free the given stack element */ static void -ff_free_stack_element(stack_ptr) - ff_stack_T *stack_ptr; +ff_free_stack_element(ff_stack_T *stack_ptr) { /* vim_free handles possible NULL pointers */ vim_free(stack_ptr->ffs_fix_path); @@ -5654,8 +5392,7 @@ ff_free_stack_element(stack_ptr) * Clear the search context, but NOT the visited list. */ static void -ff_clear(search_ctx) - ff_search_ctx_T *search_ctx; +ff_clear(ff_search_ctx_T *search_ctx) { ff_stack_T *sptr; @@ -5701,10 +5438,7 @@ ff_clear(search_ctx) * returns TRUE if yes else FALSE */ static int -ff_path_in_stoplist(path, path_len, stopdirs_v) - char_u *path; - int path_len; - char_u **stopdirs_v; +ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v) { int i = 0; @@ -5765,12 +5499,12 @@ ff_path_in_stoplist(path, path_len, stopdirs_v) * */ char_u * -find_file_in_path(ptr, len, options, first, rel_fname) - char_u *ptr; /* file name */ - int len; /* length of file name */ - int options; - int first; /* use count'th matching file name */ - char_u *rel_fname; /* file name searching relative to */ +find_file_in_path( + char_u *ptr, /* file name */ + int len, /* length of file name */ + int options, + int first, /* use count'th matching file name */ + char_u *rel_fname) /* file name searching relative to */ { return find_file_in_path_option(ptr, len, options, first, *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path, @@ -5782,7 +5516,7 @@ static void *fdip_search_ctx = NULL; #if defined(EXITFREE) static void -free_findfile() +free_findfile(void) { vim_free(ff_file_to_find); vim_findfile_cleanup(fdip_search_ctx); @@ -5794,32 +5528,33 @@ free_findfile() * * options: * FNAME_MESS give error message when not found + * FNAME_UNESC unescape backslashes. * * Uses NameBuff[]! * * Returns an allocated string for the file name. NULL for error. */ char_u * -find_directory_in_path(ptr, len, options, rel_fname) - char_u *ptr; /* file name */ - int len; /* length of file name */ - int options; - char_u *rel_fname; /* file name searching relative to */ +find_directory_in_path( + char_u *ptr, /* file name */ + int len, /* length of file name */ + int options, + char_u *rel_fname) /* file name searching relative to */ { return find_file_in_path_option(ptr, len, options, TRUE, p_cdpath, FINDFILE_DIR, rel_fname, (char_u *)""); } char_u * -find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_fname, suffixes) - char_u *ptr; /* file name */ - int len; /* length of file name */ - int options; - int first; /* use count'th matching file name */ - char_u *path_option; /* p_path or p_cdpath */ - int find_what; /* FINDFILE_FILE, _DIR or _BOTH */ - char_u *rel_fname; /* file name we are looking relative to. */ - char_u *suffixes; /* list of suffixes, 'suffixesadd' option */ +find_file_in_path_option( + char_u *ptr, /* file name */ + int len, /* length of file name */ + int options, + int first, /* use count'th matching file name */ + char_u *path_option, /* p_path or p_cdpath */ + int find_what, /* FINDFILE_FILE, _DIR or _BOTH */ + char_u *rel_fname, /* file name we are looking relative to. */ + char_u *suffixes) /* list of suffixes, 'suffixesadd' option */ { static char_u *dir; static int did_findfile_init = FALSE; @@ -5840,7 +5575,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f /* copy file name into NameBuff, expanding environment variables */ save_char = ptr[len]; ptr[len] = NUL; - expand_env(ptr, NameBuff, MAXPATHL); + expand_env_esc(ptr, NameBuff, MAXPATHL, FALSE, TRUE, NULL); ptr[len] = save_char; vim_free(ff_file_to_find); @@ -5850,6 +5585,13 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f file_name = NULL; goto theend; } + if (options & FNAME_UNESC) + { + /* Change all "\ " to " ". */ + for (ptr = ff_file_to_find; *ptr != NUL; ++ptr) + if (ptr[0] == '\\' && ptr[1] == ' ') + mch_memmove(ptr, ptr + 1, STRLEN(ptr)); + } } rel_to_curdir = (ff_file_to_find[0] == '.' @@ -5861,7 +5603,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f if (vim_isAbsName(ff_file_to_find) /* "..", "../path", "." and "./path": don't use the path_option */ || rel_to_curdir -#if defined(MSWIN) || defined(MSDOS) || defined(OS2) +#if defined(MSWIN) /* handle "\tmp" as absolute path */ || vim_ispathsep(ff_file_to_find[0]) /* handle "c:name" as absolute path */ @@ -5915,18 +5657,10 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f buf = suffixes; for (;;) { - if ( -#ifdef DJGPP - /* "C:" by itself will fail for mch_getperm(), - * assume it's always valid. */ - (find_what != FINDFILE_FILE && NameBuff[0] != NUL - && NameBuff[1] == ':' - && NameBuff[2] == NUL) || -#endif - (mch_getperm(NameBuff) >= 0 + if (mch_getperm(NameBuff) >= 0 && (find_what == FINDFILE_BOTH || ((find_what == FINDFILE_DIR) - == mch_isdir(NameBuff))))) + == mch_isdir(NameBuff)))) { file_name = vim_strsave(NameBuff); goto theend; @@ -6034,8 +5768,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f * 'cdpath' for relative directory names, otherwise just mch_chdir(). */ int -vim_chdir(new_dir) - char_u *new_dir; +vim_chdir(char_u *new_dir) { #ifndef FEAT_SEARCHPATH return mch_chdir((char *)new_dir); @@ -6061,9 +5794,7 @@ vim_chdir(new_dir) * Returns OK or FAIL. */ int -get_user_name(buf, len) - char_u *buf; - int len; +get_user_name(char_u *buf, int len) { if (username == NULL) { @@ -6082,11 +5813,11 @@ get_user_name(buf, len) * It's simple and slow. From the K&R C book. */ void -qsort(base, elm_count, elm_size, cmp) - void *base; - size_t elm_count; - size_t elm_size; - int (*cmp) __ARGS((const void *, const void *)); +qsort( + void *base, + size_t elm_count, + size_t elm_size, + int (*cmp)(const void *, const void *)) { char_u *buf; char_u *p1; @@ -6124,23 +5855,21 @@ static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_compare __ARGS((const void *s1, const void *s2)); +sort_compare(const void *s1, const void *s2); static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sort_compare(s1, s2) - const void *s1; - const void *s2; +sort_compare(const void *s1, const void *s2) { return STRCMP(*(char **)s1, *(char **)s2); } void -sort_strings(files, count) - char_u **files; - int count; +sort_strings( + char_u **files, + int count) { qsort((void *)files, (size_t)count, sizeof(char_u *), sort_compare); } @@ -6152,18 +5881,16 @@ sort_strings(files, count) * Return value like strcmp(p, q), but consider path separators. */ int -pathcmp(p, q, maxlen) - const char *p, *q; - int maxlen; +pathcmp(const char *p, const char *q, int maxlen) { - int i; + int i, j; int c1, c2; const char *s = NULL; - for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i)) + for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);) { c1 = PTR2CHAR((char_u *)p + i); - c2 = PTR2CHAR((char_u *)q + i); + c2 = PTR2CHAR((char_u *)q + j); /* End of "p": check if "q" also ends or just has a slash. */ if (c1 == NUL) @@ -6171,6 +5898,7 @@ pathcmp(p, q, maxlen) if (c2 == NUL) /* full match */ return 0; s = q; + i = j; break; } @@ -6196,8 +5924,11 @@ pathcmp(p, q, maxlen) return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2) : c1 - c2; /* no match */ } + + i += MB_PTR2LEN((char_u *)p + i); + j += MB_PTR2LEN((char_u *)q + j); } - if (s == NULL) /* "i" ran into "maxlen" */ + if (s == NULL) /* "i" or "j" ran into "maxlen" */ return 0; c1 = PTR2CHAR((char_u *)s + i); @@ -6250,18 +5981,14 @@ pathcmp(p, q, maxlen) #define EXTRASIZE 5 /* increment to add to env. size */ static int envsize = -1; /* current size of environment */ -#ifndef MACOS_CLASSIC -extern -#endif - char **environ; /* the global which is your env. */ +extern char **environ; /* the global which is your env. */ -static int findenv __ARGS((char *name)); /* look for a name in the env. */ -static int newenv __ARGS((void)); /* copy env. from stack to heap */ -static int moreenv __ARGS((void)); /* incr. size of env. */ +static int findenv(char *name); /* look for a name in the env. */ +static int newenv(void); /* copy env. from stack to heap */ +static int moreenv(void); /* incr. size of env. */ int -putenv(string) - const char *string; +putenv(const char *string) { int i; char *p; @@ -6300,8 +6027,7 @@ putenv(string) } static int -findenv(name) - char *name; +findenv(char *name) { char *namechar, *envchar; int i, found; @@ -6322,24 +6048,19 @@ findenv(name) } static int -newenv() +newenv(void) { char **env, *elem; int i, esize; -#ifdef MACOS - /* for Mac a new, empty environment is created */ - i = 0; -#else for (i = 0; environ[i]; i++) ; -#endif + esize = i + EXTRASIZE + 1; env = (char **)alloc((unsigned)(esize * sizeof (elem))); if (env == NULL) return -1; -#ifndef MACOS for (i = 0; environ[i]; i++) { elem = (char *)alloc((unsigned)(strlen(environ[i]) + 1)); @@ -6348,7 +6069,6 @@ newenv() env[i] = elem; strcpy(elem, environ[i]); } -#endif env[i] = 0; environ = env; @@ -6357,7 +6077,7 @@ newenv() } static int -moreenv() +moreenv(void) { int esize; char **env; @@ -6372,9 +6092,11 @@ moreenv() } # ifdef USE_VIMPTY_GETENV +/* + * Used for mch_getenv() for Mac. + */ char_u * -vimpty_getenv(string) - const char_u *string; +vimpty_getenv(const char_u *string) { int i; char_u *p; @@ -6400,8 +6122,7 @@ vimpty_getenv(string) * rights to write into. */ int -filewritable(fname) - char_u *fname; +filewritable(char_u *fname) { int retval = 0; #if defined(UNIX) || defined(VMS) @@ -6411,7 +6132,6 @@ filewritable(fname) #if defined(UNIX) || defined(VMS) perm = mch_getperm(fname); #endif -#ifndef MACOS_CLASSIC /* TODO: get either mch_writable or mch_access */ if ( # ifdef WIN3264 mch_writable(fname) && @@ -6422,7 +6142,6 @@ filewritable(fname) # endif mch_access((char *)fname, W_OK) == 0 ) -#endif { ++retval; if (mch_isdir(fname)) @@ -6432,99 +6151,86 @@ filewritable(fname) } #endif -/* - * Print an error message with one or two "%s" and one or two string arguments. - * This is not in message.c to avoid a warning for prototypes. - */ - int -emsg3(s, a1, a2) - char_u *s, *a1, *a2; -{ - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ -#ifdef HAVE_STDARG_H - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); -#else - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, (long_u)a1, (long_u)a2); -#endif - return emsg(IObuff); -} - -/* - * Print an error message with one "%ld" and one long int argument. - * This is not in message.c to avoid a warning for prototypes. - */ - int -emsgn(s, n) - char_u *s; - long n; -{ - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); - return emsg(IObuff); -} - #if defined(FEAT_SPELL) || defined(FEAT_PERSISTENT_UNDO) || defined(PROTO) /* * Read 2 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int -get2c(fd) - FILE *fd; +get2c(FILE *fd) { - int n; + int c, n; n = getc(fd); - n = (n << 8) + getc(fd); - return n; + if (n == EOF) return -1; + c = getc(fd); + if (c == EOF) return -1; + return (n << 8) + c; } /* * Read 3 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int -get3c(fd) - FILE *fd; +get3c(FILE *fd) { - int n; + int c, n; n = getc(fd); - n = (n << 8) + getc(fd); - n = (n << 8) + getc(fd); - return n; + if (n == EOF) return -1; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + c; + c = getc(fd); + if (c == EOF) return -1; + return (n << 8) + c; } /* * Read 4 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int -get4c(fd) - FILE *fd; +get4c(FILE *fd) { + int c; /* Use unsigned rather than int otherwise result is undefined * when left-shift sets the MSB. */ unsigned n; - n = (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); + c = getc(fd); + if (c == EOF) return -1; + n = (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; return (int)n; } /* - * Read 8 bytes from "fd" and turn them into a time_t, MSB first. + * Read 8 bytes from "fd" and turn them into a time_T, MSB first. + * Returns -1 when encountering EOF. */ - time_t -get8ctime(fd) - FILE *fd; + time_T +get8ctime(FILE *fd) { - time_t n = 0; + int c; + time_T n = 0; int i; for (i = 0; i < 8; ++i) - n = (n << 8) + getc(fd); + { + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + c; + } return n; } @@ -6533,9 +6239,7 @@ get8ctime(fd) * Returns NULL when out of memory or unable to read that many bytes. */ char_u * -read_string(fd, cnt) - FILE *fd; - int cnt; +read_string(FILE *fd, int cnt) { char_u *str; int i; @@ -6565,10 +6269,7 @@ read_string(fd, cnt) * Write a number to file "fd", MSB first, in "len" bytes. */ int -put_bytes(fd, nr, len) - FILE *fd; - long_u nr; - int len; +put_bytes(FILE *fd, long_u nr, int len) { int i; @@ -6587,29 +6288,41 @@ put_bytes(fd, nr, len) #endif /* - * Write time_t to file "fd" in 8 bytes. + * Write time_T to file "fd" in 8 bytes. + * Returns FAIL when the write failed. + */ + int +put_time(FILE *fd, time_T the_time) +{ + char_u buf[8]; + + time_to_bytes(the_time, buf); + return fwrite(buf, (size_t)8, (size_t)1, fd) == 1 ? OK : FAIL; +} + +/* + * Write time_T to "buf[8]". */ void -put_time(fd, the_time) - FILE *fd; - time_t the_time; +time_to_bytes(time_T the_time, char_u *buf) { int c; int i; - time_t wtime = the_time; + int bi = 0; + time_T wtime = the_time; - /* time_t can be up to 8 bytes in size, more than long_u, thus we + /* time_T can be up to 8 bytes in size, more than long_u, thus we * can't use put_bytes() here. * Another problem is that ">>" may do an arithmetic shift that keeps the * sign. This happens for large values of wtime. A cast to long_u may - * truncate if time_t is 8 bytes. So only use a cast when it is 4 bytes, + * truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes, * it's safe to assume that long_u is 4 bytes or more and when using 8 * bytes the top bit won't be set. */ for (i = 7; i >= 0; --i) { - if (i + 1 > (int)sizeof(time_t)) + if (i + 1 > (int)sizeof(time_T)) /* ">>" doesn't work well when shifting more bits than avail */ - putc(0, fd); + buf[bi++] = 0; else { #if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4 @@ -6617,7 +6330,7 @@ put_time(fd, the_time) #else c = (int)((long_u)wtime >> (i * 8)); #endif - putc(c, fd); + buf[bi++] = c; } } } @@ -6637,8 +6350,7 @@ put_time(fd, the_time) * When "s" is NULL FALSE is returned. */ int -has_non_ascii(s) - char_u *s; +has_non_ascii(char_u *s) { char_u *p; @@ -6649,3 +6361,229 @@ has_non_ascii(s) return FALSE; } #endif + +#if defined(MESSAGE_QUEUE) || defined(PROTO) +/* + * Process messages that have been queued for netbeans or clientserver. + * Also check if any jobs have ended. + * These functions can call arbitrary vimscript and should only be called when + * it is safe to do so. + */ + void +parse_queued_messages(void) +{ + win_T *old_curwin = curwin; + + /* For Win32 mch_breakcheck() does not check for input, do it here. */ +# if defined(WIN32) && defined(FEAT_JOB_CHANNEL) + channel_handle_events(FALSE); +# endif + +# if defined(FEAT_GUI_MACVIM) && defined(FEAT_JOB_CHANNEL) + if (gui.in_use) + gui_macvim_cleanup_job_all(); +# endif + +# ifdef FEAT_NETBEANS_INTG + /* Process the queued netbeans messages. */ + netbeans_parse_messages(); +# endif +# ifdef FEAT_JOB_CHANNEL + /* Write any buffer lines still to be written. */ + channel_write_any_lines(); + + /* Process the messages queued on channels. */ + channel_parse_messages(); +# endif +# if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) + /* Process the queued clientserver messages. */ + server_parse_messages(); +# endif +# ifdef FEAT_JOB_CHANNEL + /* Check if any jobs have ended. */ + job_check_ended(); +# endif + + /* If the current window changed we need to bail out of the waiting loop. + * E.g. when a job exit callback closes the terminal window. */ + if (curwin != old_curwin) + ins_char_typebuf(K_IGNORE); +} +#endif + +#ifndef PROTO /* proto is defined in vim.h */ +# ifdef ELAPSED_TIMEVAL +/* + * Return time in msec since "start_tv". + */ + long +elapsed(struct timeval *start_tv) +{ + struct timeval now_tv; + + gettimeofday(&now_tv, NULL); + return (now_tv.tv_sec - start_tv->tv_sec) * 1000L + + (now_tv.tv_usec - start_tv->tv_usec) / 1000L; +} +# endif + +# ifdef ELAPSED_TICKCOUNT +/* + * Return time in msec since "start_tick". + */ + long +elapsed(DWORD start_tick) +{ + DWORD now = GetTickCount(); + + return (long)now - (long)start_tick; +} +# endif +#endif + +#if defined(FEAT_JOB_CHANNEL) \ + || (defined(UNIX) && (!defined(USE_SYSTEM) \ + || (defined(FEAT_GUI) && defined(FEAT_TERMINAL)))) \ + || defined(PROTO) +/* + * Parse "cmd" and put the white-separated parts in "argv". + * "argv" is an allocated array with "argc" entries and room for 4 more. + * Returns FAIL when out of memory. + */ + int +mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) +{ + int i; + char_u *p, *d; + int inquote; + + /* + * Do this loop twice: + * 1: find number of arguments + * 2: separate them and build argv[] + */ + for (i = 0; i < 2; ++i) + { + p = skipwhite(cmd); + inquote = FALSE; + *argc = 0; + for (;;) + { + if (i == 1) + (*argv)[*argc] = (char *)p; + ++*argc; + d = p; + while (*p != NUL && (inquote || (*p != ' ' && *p != TAB))) + { + if (p[0] == '"') + /* quotes surrounding an argument and are dropped */ + inquote = !inquote; + else + { + if (p[0] == '\\' && p[1] != NUL) + { + /* First pass: skip over "\ " and "\"". + * Second pass: Remove the backslash. */ + ++p; + } + if (i == 1) + *d++ = *p; + } + ++p; + } + if (*p == NUL) + { + if (i == 1) + *d++ = NUL; + break; + } + if (i == 1) + *d++ = NUL; + p = skipwhite(p + 1); + } + if (*argv == NULL) + { + if (use_shcf) + { + /* Account for possible multiple args in p_shcf. */ + p = p_shcf; + for (;;) + { + p = skiptowhite(p); + if (*p == NUL) + break; + ++*argc; + p = skipwhite(p); + } + } + + *argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *))); + if (*argv == NULL) /* out of memory */ + return FAIL; + } + } + return OK; +} + +# if defined(FEAT_JOB_CHANNEL) || defined(PROTO) +/* + * Build "argv[argc]" from the string "cmd". + * "argv[argc]" is set to NULL; + * Return FAIL when out of memory. + */ + int +build_argv_from_string(char_u *cmd, char ***argv, int *argc) +{ + char_u *cmd_copy; + int i; + + /* Make a copy, parsing will modify "cmd". */ + cmd_copy = vim_strsave(cmd); + if (cmd_copy == NULL + || mch_parse_cmd(cmd_copy, FALSE, argv, argc) == FAIL) + { + vim_free(cmd_copy); + return FAIL; + } + for (i = 0; i < *argc; i++) + (*argv)[i] = (char *)vim_strsave((char_u *)(*argv)[i]); + (*argv)[*argc] = NULL; + vim_free(cmd_copy); + return OK; +} + +/* + * Build "argv[argc]" from the list "l". + * "argv[argc]" is set to NULL; + * Return FAIL when out of memory. + */ + int +build_argv_from_list(list_T *l, char ***argv, int *argc) +{ + listitem_T *li; + char_u *s; + + /* Pass argv[] to mch_call_shell(). */ + *argv = (char **)alloc(sizeof(char *) * (l->lv_len + 1)); + if (*argv == NULL) + return FAIL; + *argc = 0; + for (li = l->lv_first; li != NULL; li = li->li_next) + { + s = get_tv_string_chk(&li->li_tv); + if (s == NULL) + { + int i; + + for (i = 0; i < *argc; ++i) + vim_free((*argv)[i]); + return FAIL; + } + (*argv)[*argc] = (char *)vim_strsave(s); + *argc += 1; + } + (*argv)[*argc] = NULL; + return OK; +} +# endif +#endif diff --git a/src/mkinstalldirs b/src/mkinstalldirs deleted file mode 100755 index 68c4e738da..0000000000 --- a/src/mkinstalldirs +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/src/move.c b/src/move.c index 42f778438f..c9e0becb21 100644 --- a/src/move.c +++ b/src/move.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,13 +19,15 @@ #include "vim.h" -static void comp_botline __ARGS((win_T *wp)); -static void redraw_for_cursorline __ARGS((win_T *wp)); -static int scrolljump_value __ARGS((void)); -static int check_top_offset __ARGS((void)); -static void curs_rows __ARGS((win_T *wp, int do_botline)); -static void validate_botline_win __ARGS((win_T *wp)); -static void validate_cheight __ARGS((void)); +static void comp_botline(win_T *wp); +static void redraw_for_cursorline(win_T *wp); +#ifdef FEAT_GUI_MACVIM +static void redraw_for_ligatures(win_T *wp); +#endif +static int scrolljump_value(void); +static int check_top_offset(void); +static void curs_rows(win_T *wp); +static void validate_cheight(void); typedef struct { @@ -36,12 +38,12 @@ typedef struct int height; /* height of added line */ } lineoff_T; -static void topline_back __ARGS((lineoff_T *lp)); -static void botline_forw __ARGS((lineoff_T *lp)); +static void topline_back(lineoff_T *lp); +static void botline_forw(lineoff_T *lp); #ifdef FEAT_DIFF -static void botline_topline __ARGS((lineoff_T *lp)); -static void topline_botline __ARGS((lineoff_T *lp)); -static void max_topfill __ARGS((void)); +static void botline_topline(lineoff_T *lp); +static void topline_botline(lineoff_T *lp); +static void max_topfill(void); #endif /* @@ -49,8 +51,7 @@ static void max_topfill __ARGS((void)); * wp->w_topline changed. */ static void -comp_botline(wp) - win_T *wp; +comp_botline(win_T *wp) { int n; linenr_T lnum; @@ -130,8 +131,7 @@ comp_botline(wp) * set. */ static void -redraw_for_cursorline(wp) - win_T *wp; +redraw_for_cursorline(win_T *wp) { if ((wp->w_p_rnu #ifdef FEAT_SYN_HL @@ -146,12 +146,35 @@ redraw_for_cursorline(wp) redraw_win_later(wp, SOME_VALID); } +#ifdef FEAT_GUI_MACVIM +/* + * Redraw when 'macligatures' is set. + * This is basically the same as when 'cursorline' + * or 'relativenumber' is set but unconditional. + */ +static void +redraw_for_ligatures(wp) + win_T *wp; +{ + /* Only if ligatures are on but neither + * 'cursorline' nor 'relativenumber'. + */ + if (p_macligatures + && (wp->w_p_rnu == 0 +#ifdef FEAT_SYN_HL + && wp->w_p_cul == 0 +#endif + )) + redraw_win_later(wp, CLEAR); +} +#endif + /* * Update curwin->w_topline and redraw if necessary. * Used to update the screen before printing a message. */ void -update_topline_redraw() +update_topline_redraw(void) { update_topline(); if (must_redraw) @@ -162,7 +185,7 @@ update_topline_redraw() * Update curwin->w_topline to move the cursor onto the screen. */ void -update_topline() +update_topline(void) { long line_count; int halfheight; @@ -180,8 +203,16 @@ update_topline() int save_so = p_so; #endif - if (!screen_valid(TRUE)) + /* If there is no valid screen and when the window height is zero just use + * the cursor line. */ + if (!screen_valid(TRUE) || curwin->w_height == 0) + { + curwin->w_topline = curwin->w_cursor.lnum; + curwin->w_botline = curwin->w_topline; + curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; + curwin->w_scbind_pos = 1; return; + } check_cursor_moved(curwin); if (curwin->w_valid & VALID_TOPLINE) @@ -201,16 +232,14 @@ update_topline() /* * If the buffer is empty, always set topline to 1. */ - if (bufempty()) /* special case - file is empty */ + if (BUFEMPTY()) /* special case - file is empty */ { if (curwin->w_topline != 1) redraw_later(NOT_VALID); curwin->w_topline = 1; curwin->w_botline = 2; curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; -#ifdef FEAT_SCROLLBIND curwin->w_scbind_pos = 1; -#endif } /* @@ -409,7 +438,7 @@ update_topline() * When 'scrolljump' is negative use it as a percentage of the window height. */ static int -scrolljump_value() +scrolljump_value(void) { if (p_sj >= 0) return (int)p_sj; @@ -421,7 +450,7 @@ scrolljump_value() * current window. */ static int -check_top_offset() +check_top_offset(void) { lineoff_T loff; int n; @@ -459,7 +488,7 @@ check_top_offset() } void -update_curswant() +update_curswant(void) { if (curwin->w_set_curswant) { @@ -473,8 +502,7 @@ update_curswant() * Check if the cursor has moved. Set the w_valid flag accordingly. */ void -check_cursor_moved(wp) - win_T *wp; +check_cursor_moved(win_T *wp) { if (wp->w_cursor.lnum != wp->w_valid_cursor.lnum) { @@ -505,14 +533,13 @@ check_cursor_moved(wp) * be redrawn. E.g, when changing the 'wrap' option or folding. */ void -changed_window_setting() +changed_window_setting(void) { changed_window_setting_win(curwin); } void -changed_window_setting_win(wp) - win_T *wp; +changed_window_setting_win(win_T *wp) { wp->w_lines_valid = 0; changed_line_abv_curs_win(wp); @@ -524,9 +551,7 @@ changed_window_setting_win(wp) * Set wp->w_topline to a certain number. */ void -set_topline(wp, lnum) - win_T *wp; - linenr_T lnum; +set_topline(win_T *wp, linenr_T lnum) { #ifdef FEAT_FOLDING /* go to first of folded lines */ @@ -535,9 +560,7 @@ set_topline(wp, lnum) /* Approximate the value of w_botline */ wp->w_botline += lnum - wp->w_topline; wp->w_topline = lnum; -#ifdef FEAT_AUTOCMD wp->w_topline_was_set = TRUE; -#endif #ifdef FEAT_DIFF wp->w_topfill = 0; #endif @@ -552,15 +575,14 @@ set_topline(wp, lnum) * Need to take care of w_botline separately! */ void -changed_cline_bef_curs() +changed_cline_bef_curs(void) { curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL |VALID_CHEIGHT|VALID_TOPLINE); } void -changed_cline_bef_curs_win(wp) - win_T *wp; +changed_cline_bef_curs_win(win_T *wp) { wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL |VALID_CHEIGHT|VALID_TOPLINE); @@ -572,15 +594,14 @@ changed_cline_bef_curs_win(wp) * Need to take care of w_botline separately! */ void -changed_line_abv_curs() +changed_line_abv_curs(void) { curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL|VALID_CROW |VALID_CHEIGHT|VALID_TOPLINE); } void -changed_line_abv_curs_win(wp) - win_T *wp; +changed_line_abv_curs_win(win_T *wp) { wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL|VALID_CROW |VALID_CHEIGHT|VALID_TOPLINE); @@ -590,42 +611,30 @@ changed_line_abv_curs_win(wp) * Make sure the value of curwin->w_botline is valid. */ void -validate_botline() +validate_botline(void) { if (!(curwin->w_valid & VALID_BOTLINE)) comp_botline(curwin); } -/* - * Make sure the value of wp->w_botline is valid. - */ - static void -validate_botline_win(wp) - win_T *wp; -{ - if (!(wp->w_valid & VALID_BOTLINE)) - comp_botline(wp); -} - /* * Mark curwin->w_botline as invalid (because of some change in the buffer). */ void -invalidate_botline() +invalidate_botline(void) { curwin->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP); } void -invalidate_botline_win(wp) - win_T *wp; +invalidate_botline_win(win_T *wp) { wp->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP); } void -approximate_botline_win(wp) - win_T *wp; +approximate_botline_win( + win_T *wp) { wp->w_valid &= ~VALID_BOTLINE; } @@ -634,7 +643,7 @@ approximate_botline_win(wp) * Return TRUE if curwin->w_wrow and curwin->w_wcol are valid. */ int -cursor_valid() +cursor_valid(void) { check_cursor_moved(curwin); return ((curwin->w_valid & (VALID_WROW|VALID_WCOL)) == @@ -646,7 +655,7 @@ cursor_valid() * w_topline must be valid, you may need to call update_topline() first! */ void -validate_cursor() +validate_cursor(void) { check_cursor_moved(curwin); if ((curwin->w_valid & (VALID_WCOL|VALID_WROW)) != (VALID_WCOL|VALID_WROW)) @@ -658,7 +667,7 @@ validate_cursor() * validate w_cline_row. */ void -validate_cline_row() +validate_cline_row(void) { /* * First make sure that w_topline is valid (after moving the cursor). @@ -666,20 +675,16 @@ validate_cline_row() update_topline(); check_cursor_moved(curwin); if (!(curwin->w_valid & VALID_CROW)) - curs_rows(curwin, FALSE); + curs_rows(curwin); } #endif /* * Compute wp->w_cline_row and wp->w_cline_height, based on the current value * of wp->w_topline. - * - * Returns OK when cursor is in the window, FAIL when it isn't. */ static void -curs_rows(wp, do_botline) - win_T *wp; - int do_botline; /* also compute w_botline */ +curs_rows(win_T *wp) { linenr_T lnum; int i; @@ -796,18 +801,18 @@ curs_rows(wp, do_botline) } redraw_for_cursorline(curwin); +#ifdef FEAT_GUI_MACVIM + redraw_for_ligatures(curwin); +#endif wp->w_valid |= VALID_CROW|VALID_CHEIGHT; - /* validate botline too, if update_screen doesn't do it */ - if (do_botline && all_invalid) - validate_botline_win(wp); } /* * Validate curwin->w_virtcol only. */ void -validate_virtcol() +validate_virtcol(void) { validate_virtcol_win(curwin); } @@ -816,8 +821,7 @@ validate_virtcol() * Validate wp->w_virtcol only. */ void -validate_virtcol_win(wp) - win_T *wp; +validate_virtcol_win(win_T *wp) { check_cursor_moved(wp); if (!(wp->w_valid & VALID_VIRTCOL)) @@ -839,7 +843,7 @@ validate_virtcol_win(wp) * Validate curwin->w_cline_height only. */ static void -validate_cheight() +validate_cheight(void) { check_cursor_moved(curwin); if (!(curwin->w_valid & VALID_CHEIGHT)) @@ -862,7 +866,7 @@ validate_cheight() * Validate w_wcol and w_virtcol only. */ void -validate_cursor_col() +validate_cursor_col(void) { colnr_T off; colnr_T col; @@ -874,14 +878,14 @@ validate_cursor_col() col = curwin->w_virtcol; off = curwin_col_off(); col += off; - width = W_WIDTH(curwin) - off + curwin_col_off2(); + width = curwin->w_width - off + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ if (curwin->w_p_wrap - && col >= (colnr_T)W_WIDTH(curwin) + && col >= (colnr_T)curwin->w_width && width > 0) /* use same formula as what is used in curs_columns() */ - col -= ((col - W_WIDTH(curwin)) / width + 1) * width; + col -= ((col - curwin->w_width) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; else @@ -897,8 +901,7 @@ validate_cursor_col() * fold column and sign column (these don't move when scrolling horizontally). */ int -win_col_off(wp) - win_T *wp; +win_col_off(win_T *wp) { return (((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0) #ifdef FEAT_CMDWIN @@ -908,18 +911,13 @@ win_col_off(wp) + wp->w_p_fdc #endif #ifdef FEAT_SIGNS - + ( -# ifdef FEAT_NETBEANS_INTG - /* show glyph gutter in netbeans */ - netbeans_active() || -# endif - wp->w_buffer->b_signlist != NULL ? 2 : 0) + + (signcolumn_on(wp) ? 2 : 0) #endif ); } int -curwin_col_off() +curwin_col_off(void) { return win_col_off(curwin); } @@ -930,8 +928,7 @@ curwin_col_off() * 'cpoptions'. */ int -win_col_off2(wp) - win_T *wp; +win_col_off2(win_T *wp) { if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo, CPO_NUMCOL) != NULL) return number_width(wp) + 1; @@ -939,7 +936,7 @@ win_col_off2(wp) } int -curwin_col_off2() +curwin_col_off2(void) { return win_col_off2(curwin); } @@ -950,8 +947,8 @@ curwin_col_off2() * Also updates curwin->w_leftcol. */ void -curs_columns(may_scroll) - int may_scroll; /* when TRUE, may scroll horizontally */ +curs_columns( + int may_scroll) /* when TRUE, may scroll horizontally */ { int diff; int extra; /* offset for first screen line */ @@ -974,7 +971,7 @@ curs_columns(may_scroll) * Next make sure that w_cline_row is valid. */ if (!(curwin->w_valid & VALID_CROW)) - curs_rows(curwin, FALSE); + curs_rows(curwin); /* * Compute the number of virtual columns. @@ -1001,26 +998,22 @@ curs_columns(may_scroll) */ curwin->w_wrow = curwin->w_cline_row; - textwidth = W_WIDTH(curwin) - extra; + textwidth = curwin->w_width - extra; if (textwidth <= 0) { /* No room for text, put cursor in last char of window. */ - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; curwin->w_wrow = curwin->w_height - 1; } - else if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + else if (curwin->w_p_wrap && curwin->w_width != 0) { width = textwidth + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ - if (curwin->w_wcol >= W_WIDTH(curwin)) + if (curwin->w_wcol >= curwin->w_width) { /* this same formula is used in validate_cursor_col() */ - n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1; + n = (curwin->w_wcol - curwin->w_width) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; @@ -1051,7 +1044,7 @@ curs_columns(may_scroll) * extra */ off_left = (int)startcol - (int)curwin->w_leftcol - p_siso; - off_right = (int)endcol - (int)(curwin->w_leftcol + W_WIDTH(curwin) + off_right = (int)endcol - (int)(curwin->w_leftcol + curwin->w_width - p_siso) + 1; if (off_left < 0 || off_right > 0) { @@ -1115,10 +1108,7 @@ curs_columns(may_scroll) && curwin->w_height != 0 && curwin->w_cursor.lnum == curwin->w_topline && width > 0 -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + && curwin->w_width != 0) { /* Cursor past end of screen. Happens with a single line that does * not fit on screen. Find a skipcol to show the text around the @@ -1189,7 +1179,7 @@ curs_columns(may_scroll) if (extra > 0) win_ins_lines(curwin, 0, extra, FALSE, FALSE); else if (extra < 0) - win_del_lines(curwin, 0, -extra, FALSE, FALSE); + win_del_lines(curwin, 0, -extra, FALSE, FALSE, 0); } else curwin->w_skipcol = 0; @@ -1213,9 +1203,9 @@ curs_columns(may_scroll) * Scroll the current window down by "line_count" logical lines. "CTRL-Y" */ void -scrolldown(line_count, byfold) - long line_count; - int byfold UNUSED; /* TRUE: count a closed fold as one line */ +scrolldown( + long line_count, + int byfold UNUSED) /* TRUE: count a closed fold as one line */ { long done = 0; /* total # of physical lines done */ int wrow; @@ -1258,11 +1248,7 @@ scrolldown(line_count, byfold) } else #endif -#ifdef FEAT_DIFF - done += plines_nofill(curwin->w_topline); -#else - done += plines(curwin->w_topline); -#endif + done += PLINES_NOFILL(curwin->w_topline); } --curwin->w_botline; /* approximate w_botline */ invalidate_botline(); @@ -1281,16 +1267,12 @@ scrolldown(line_count, byfold) * and move the cursor onto the displayed part of the window. */ wrow = curwin->w_wrow; - if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + if (curwin->w_p_wrap && curwin->w_width != 0) { validate_virtcol(); validate_cheight(); wrow += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } while (wrow >= curwin->w_height && curwin->w_cursor.lnum > 1) { @@ -1324,9 +1306,9 @@ scrolldown(line_count, byfold) * Scroll the current window up by "line_count" logical lines. "CTRL-E" */ void -scrollup(line_count, byfold) - long line_count; - int byfold UNUSED; /* TRUE: count a closed fold as one line */ +scrollup( + long line_count, + int byfold UNUSED) /* TRUE: count a closed fold as one line */ { #if defined(FEAT_FOLDING) || defined(FEAT_DIFF) linenr_T lnum; @@ -1406,9 +1388,9 @@ scrollup(line_count, byfold) * Don't end up with too many filler lines in the window. */ void -check_topfill(wp, down) - win_T *wp; - int down; /* when TRUE scroll down when not enough space */ +check_topfill( + win_T *wp, + int down) /* when TRUE scroll down when not enough space */ { int n; @@ -1437,7 +1419,7 @@ check_topfill(wp, down) * is still visible. */ static void -max_topfill() +max_topfill(void) { int n; @@ -1459,7 +1441,7 @@ max_topfill() * cursor off the screen. */ void -scrolldown_clamp() +scrolldown_clamp(void) { int end_row; #ifdef FEAT_DIFF @@ -1490,16 +1472,12 @@ scrolldown_clamp() #else end_row += plines(curwin->w_topline - 1); #endif - if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + if (curwin->w_p_wrap && curwin->w_width != 0) { validate_cheight(); validate_virtcol(); end_row += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } if (end_row < curwin->w_height - p_so) { @@ -1518,7 +1496,7 @@ scrolldown_clamp() --curwin->w_topline; #endif #ifdef FEAT_FOLDING - hasFolding(curwin->w_topline, &curwin->w_topline, NULL); + (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif --curwin->w_botline; /* approximate w_botline */ curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); @@ -1530,7 +1508,7 @@ scrolldown_clamp() * off the screen. */ void -scrollup_clamp() +scrollup_clamp(void) { int start_row; @@ -1554,14 +1532,10 @@ scrollup_clamp() #else start_row = curwin->w_wrow - plines(curwin->w_topline); #endif - if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + if (curwin->w_p_wrap && curwin->w_width != 0) { validate_virtcol(); - start_row -= curwin->w_virtcol / W_WIDTH(curwin); + start_row -= curwin->w_virtcol / curwin->w_width; } if (start_row >= p_so) { @@ -1589,8 +1563,7 @@ scrollup_clamp() * Lines above the first one are incredibly high: MAXCOL. */ static void -topline_back(lp) - lineoff_T *lp; +topline_back(lineoff_T *lp) { #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum)) @@ -1615,13 +1588,7 @@ topline_back(lp) lp->height = 1; else #endif - { -#ifdef FEAT_DIFF - lp->height = plines_nofill(lp->lnum); -#else - lp->height = plines(lp->lnum); -#endif - } + lp->height = PLINES_NOFILL(lp->lnum); } } @@ -1632,8 +1599,7 @@ topline_back(lp) * Lines below the last one are incredibly high. */ static void -botline_forw(lp) - lineoff_T *lp; +botline_forw(lineoff_T *lp) { #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum + 1)) @@ -1659,11 +1625,7 @@ botline_forw(lp) else #endif { -#ifdef FEAT_DIFF - lp->height = plines_nofill(lp->lnum); -#else - lp->height = plines(lp->lnum); -#endif + lp->height = PLINES_NOFILL(lp->lnum); } } } @@ -1675,8 +1637,7 @@ botline_forw(lp) * When there are no filler lines nothing changes. */ static void -botline_topline(lp) - lineoff_T *lp; +botline_topline(lineoff_T *lp) { if (lp->fill > 0) { @@ -1691,8 +1652,7 @@ botline_topline(lp) * When there are no filler lines nothing changes. */ static void -topline_botline(lp) - lineoff_T *lp; +topline_botline(lineoff_T *lp) { if (lp->fill > 0) { @@ -1708,9 +1668,7 @@ topline_botline(lp) * If "always" is TRUE, always set topline (for "zt"). */ void -scroll_cursor_top(min_scroll, always) - int min_scroll; - int always; +scroll_cursor_top(int min_scroll, int always) { int scrolled = 0; int extra = 0; @@ -1738,7 +1696,7 @@ scroll_cursor_top(min_scroll, always) * - at least 'scrolloff' lines above and below the cursor */ validate_cheight(); - used = curwin->w_cline_height; + used = curwin->w_cline_height; /* includes filler lines above */ if (curwin->w_cursor.lnum < curwin->w_topline) scrolled = used; @@ -1757,10 +1715,10 @@ scroll_cursor_top(min_scroll, always) new_topline = top + 1; #ifdef FEAT_DIFF - /* count filler lines of the cursor window as context */ - i = diff_check_fill(curwin, curwin->w_cursor.lnum); - used += i; - extra += i; + /* "used" already contains the number of filler lines above, don't add it + * again. + * Hide filler lines above cursor line by adding them to "extra". */ + extra += diff_check_fill(curwin, curwin->w_cursor.lnum); #endif /* @@ -1775,7 +1733,7 @@ scroll_cursor_top(min_scroll, always) i = 1; else #endif - i = plines(top); + i = PLINES_NOFILL(top); used += i; if (extra + i <= off && bot < curbuf->b_ml.ml_line_count) { @@ -1848,9 +1806,7 @@ scroll_cursor_top(min_scroll, always) * screen lines for text lines. */ void -set_empty_rows(wp, used) - win_T *wp; - int used; +set_empty_rows(win_T *wp, int used) { #ifdef FEAT_DIFF wp->w_filler_rows = 0; @@ -1883,9 +1839,7 @@ set_empty_rows(wp, used) * This is messy stuff!!! */ void -scroll_cursor_bot(min_scroll, set_topbot) - int min_scroll; - int set_topbot; +scroll_cursor_bot(int min_scroll, int set_topbot) { int used; int scrolled = 0; @@ -2106,8 +2060,7 @@ scroll_cursor_bot(min_scroll, set_topbot) * If "atend" is TRUE, also put it halfway at the end of the file. */ void -scroll_cursor_halfway(atend) - int atend; +scroll_cursor_halfway(int atend) { int above = 0; linenr_T topline; @@ -2191,7 +2144,7 @@ scroll_cursor_halfway(atend) * When called topline must be valid! */ void -cursor_correct() +cursor_correct(void) { int above = 0; /* screen lines above topline */ linenr_T topline; @@ -2279,11 +2232,8 @@ cursor_correct() ++above; else #endif -#ifndef FEAT_DIFF - above += plines(topline); -#else - above += plines_nofill(topline); - + above += PLINES_NOFILL(topline); +#ifdef FEAT_DIFF /* Count filler lines below this line as context. */ if (topline < botline) above += diff_check_fill(curwin, topline + 1); @@ -2313,7 +2263,7 @@ cursor_correct() curwin->w_valid |= VALID_TOPLINE; } -static void get_scroll_overlap __ARGS((lineoff_T *lp, int dir)); +static void get_scroll_overlap(lineoff_T *lp, int dir); /* * move screen 'count' pages up or down and update screen @@ -2321,9 +2271,7 @@ static void get_scroll_overlap __ARGS((lineoff_T *lp, int dir)); * return FAIL for failure, OK otherwise */ int -onepage(dir, count) - int dir; - long count; +onepage(int dir, long count) { long n; int retval = OK; @@ -2365,7 +2313,7 @@ onepage(dir, count) #endif if (dir == FORWARD) { - if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1) + if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { /* Vi compatible scrolling */ if (p_window <= 2) @@ -2415,7 +2363,7 @@ onepage(dir, count) continue; } #endif - if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1) + if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { /* Vi compatible scrolling (sort of) */ if (p_window <= 2) @@ -2533,6 +2481,7 @@ onepage(dir, count) foldAdjustCursor(); #endif cursor_correct(); + check_cursor_col(); if (retval == OK) beginline(BL_SOL | BL_FIX); curwin->w_valid &= ~(VALID_WCOL|VALID_WROW|VALID_VIRTCOL); @@ -2572,9 +2521,7 @@ onepage(dir, count) * l3 etc. */ static void -get_scroll_overlap(lp, dir) - lineoff_T *lp; - int dir; +get_scroll_overlap(lineoff_T *lp, int dir) { int h1, h2, h3, h4; int min_height = curwin->w_height - 2; @@ -2634,9 +2581,7 @@ get_scroll_overlap(lp, dir) * Scroll 'scroll' lines up or down. */ void -halfpage(flag, Prenum) - int flag; - linenr_T Prenum; +halfpage(int flag, linenr_T Prenum) { long scrolled = 0; int i; @@ -2649,6 +2594,7 @@ halfpage(flag, Prenum) n = (curwin->w_p_scr <= curwin->w_height) ? curwin->w_p_scr : curwin->w_height; + update_topline(); validate_botline(); room = curwin->w_empty_rows; #ifdef FEAT_DIFF @@ -2672,11 +2618,7 @@ halfpage(flag, Prenum) else #endif { -#ifdef FEAT_DIFF - i = plines_nofill(curwin->w_topline); -#else - i = plines(curwin->w_topline); -#endif + i = PLINES_NOFILL(curwin->w_topline); n -= i; if (n < 0 && scrolled > 0) break; @@ -2782,11 +2724,7 @@ halfpage(flag, Prenum) else #endif { -#ifdef FEAT_DIFF - i = plines_nofill(curwin->w_topline - 1); -#else - i = plines(curwin->w_topline - 1); -#endif + i = PLINES_NOFILL(curwin->w_topline - 1); n -= i; if (n < 0 && scrolled > 0) break; @@ -2860,9 +2798,8 @@ halfpage(flag, Prenum) redraw_later(VALID); } -#if defined(FEAT_CURSORBIND) || defined(PROTO) void -do_check_cursorbind() +do_check_cursorbind(void) { linenr_T line = curwin->w_cursor.lnum; colnr_T col = curwin->w_cursor.col; @@ -2881,7 +2818,7 @@ do_check_cursorbind() * loop through the cursorbound windows */ VIsual_select = VIsual_active = 0; - for (curwin = firstwin; curwin; curwin = curwin->w_next) + FOR_ALL_WINDOWS(curwin) { curbuf = curwin->w_buffer; /* skip original window and windows with 'noscrollbind' */ @@ -2889,11 +2826,8 @@ do_check_cursorbind() { # ifdef FEAT_DIFF if (curwin->w_p_diff) - curwin->w_cursor.lnum - = diff_get_corresponding_line(old_curbuf, - line, - curbuf, - curwin->w_cursor.lnum); + curwin->w_cursor.lnum = + diff_get_corresponding_line(old_curbuf, line); else # endif curwin->w_cursor.lnum = line; @@ -2909,6 +2843,10 @@ do_check_cursorbind() restart_edit_save = restart_edit; restart_edit = TRUE; check_cursor(); +# ifdef FEAT_SYN_HL + if (curwin->w_p_cul || curwin->w_p_cuc) + validate_cursor(); +# endif restart_edit = restart_edit_save; # ifdef FEAT_MBYTE /* Correct cursor for multi-byte character. */ @@ -2920,9 +2858,7 @@ do_check_cursorbind() /* Only scroll when 'scrollbind' hasn't done this. */ if (!curwin->w_p_scb) update_topline(); -# ifdef FEAT_WINDOWS curwin->w_redr_status = TRUE; -# endif } } @@ -2934,4 +2870,3 @@ do_check_cursorbind() curwin = old_curwin; curbuf = old_curbuf; } -#endif /* FEAT_CURSORBIND */ diff --git a/src/msvc2015.bat b/src/msvc2015.bat new file mode 100644 index 0000000000..5621fca752 --- /dev/null +++ b/src/msvc2015.bat @@ -0,0 +1,33 @@ +@echo off +rem To be used on MS-Windows for Visual C++ 2015 (either Express or Community) +rem See INSTALLpc.txt for information. +rem +rem Usage: +rem For x86 builds run this without options: +rem msvc2015 +rem For x64 builds run this with "x86_amd64" option: +rem msvc2015 x86_amd64 +@echo on + +call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %* + +rem Use Windows SDK 7.1A for targeting Windows XP. +if "%ProgramFiles(x86)%"=="" ( + set "WinSdk71=%ProgramFiles%\Microsoft SDKs\Windows\v7.1A" +) else ( + set "WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A" +) +if not exist "%WinSdk71%" ( + echo Windows SDK 7.1A is not found. Targeting Windows Vista and later. + goto :eof +) + +set INCLUDE=%WinSdk71%\Include;%INCLUDE% +if "%Platform%"=="x64" ( + set "LIB=%WinSdk71%\Lib\x64;%LIB%" + set SUBSYSTEM_VER=5.02 +) else ( + set "LIB=%WinSdk71%\Lib;%LIB%" + set SUBSYSTEM_VER=5.01 +) +set CL=/D_USING_V110_SDK71_ diff --git a/src/mysign b/src/mysign index 42b6cbbcbf..fc751c01ea 100644 --- a/src/mysign +++ b/src/mysign @@ -1 +1 @@ -=auto/configure-lastupdate=1178970549.78-@buildcheck=dfc15c059b7ce88a951584995c49a201=configure.in@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9 +=auto/configure-lastupdate=1178970549.78-@buildcheck=dfc15c059b7ce88a951584995c49a201=configure.ac@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9 diff --git a/src/nbdebug.c b/src/nbdebug.c index 1b61c5896a..7c9768129e 100644 --- a/src/nbdebug.c +++ b/src/nbdebug.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=8 sw=8: +/* vi:set ts=8 sw=8 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -41,7 +41,7 @@ static int errorHandler(Display *, XErrorEvent *); /* * nbdebug_wait - This function can be used to delay or stop execution of vim. - * Its normally used to delay startup while attaching a + * It's normally used to delay startup while attaching a * debugger to a running process. Since workshop starts gvim * from a background process this is the only way to debug * startup problems. diff --git a/src/nbdebug.h b/src/nbdebug.h index 95109144c6..6331f49c3a 100644 --- a/src/nbdebug.h +++ b/src/nbdebug.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=8 sw=8: +/* vi:set ts=8 sw=8 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -44,8 +44,8 @@ typedef enum { void nbdbg(char *, ...); -void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs)); -void nbdebug_log_init __ARGS((char *log_var, char *level_var)); +void nbdebug_wait(u_int wait_flags, char *wait_var, u_int wait_secs); +void nbdebug_log_init(char *log_var, char *level_var); extern FILE *nb_debug; extern u_int nb_dlevel; /* nb_debug verbosity level */ diff --git a/src/netbeans.c b/src/netbeans.c index 70aa943b62..42adae1633 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Netbeans integration by David Weatherford @@ -27,43 +27,11 @@ #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) -/* TODO: when should this not be defined? */ -#define INET_SOCKETS - -/* Note: when making changes here also adjust configure.in. */ -#ifdef WIN32 -# ifdef DEBUG -# include <tchar.h> /* for _T definition for TRACEn macros */ -# endif -/* WinSock API is separated from C API, thus we can't use read(), write(), - * errno... */ -# define SOCK_ERRNO errno = WSAGetLastError() -# undef ECONNREFUSED -# define ECONNREFUSED WSAECONNREFUSED -# ifdef EINTR -# undef EINTR -# endif -# define EINTR WSAEINTR -# define sock_write(sd, buf, len) send(sd, buf, len, 0) -# define sock_read(sd, buf, len) recv(sd, buf, len, 0) -# define sock_close(sd) closesocket(sd) -# define sleep(t) Sleep(t*1000) /* WinAPI Sleep() accepts milliseconds */ -#else -# ifdef INET_SOCKETS -# include <netdb.h> -# include <netinet/in.h> -# else -# include <sys/un.h> -# endif - -# include <sys/socket.h> +#ifndef WIN32 +# include <netdb.h> # ifdef HAVE_LIBGEN_H # include <libgen.h> # endif -# define SOCK_ERRNO -# define sock_write(sd, buf, len) write(sd, buf, len) -# define sock_read(sd, buf, len) read(sd, buf, len) -# define sock_close(sd) close(sd) #endif #include "version.h" @@ -76,60 +44,29 @@ * protocol implemented here also supports A-A-P. */ static char *ExtEdProtocolVersion = "2.5"; -static long pos2off __ARGS((buf_T *, pos_T *)); -static pos_T *off2pos __ARGS((buf_T *, long)); -static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp)); -static long get_buf_size __ARGS((buf_T *)); -static int netbeans_keystring __ARGS((char_u *keystr)); -static void postpone_keycommand __ARGS((char_u *keystr)); -static void special_keys __ARGS((char_u *args)); - -static int netbeans_connect __ARGS((char *, int)); -static int getConnInfo __ARGS((char *file, char **host, char **port, char **password)); - -static void nb_init_graphics __ARGS((void)); -static void coloncmd __ARGS((char *cmd, ...)); -static void nb_set_curbuf __ARGS((buf_T *buf)); -#ifdef FEAT_GUI_X11 -static void messageFromNetbeans __ARGS((XtPointer, int *, XtInputId *)); -#endif -#ifdef FEAT_GUI_GTK -static void messageFromNetbeans __ARGS((gpointer, gint, GdkInputCondition)); -#endif -static void nb_parse_cmd __ARGS((char_u *)); -static int nb_do_cmd __ARGS((int, char_u *, int, int, char_u *)); -static void nb_send __ARGS((char *buf, char *fun)); -static void nb_free __ARGS((void)); +static long pos2off(buf_T *, pos_T *); +static pos_T *off2pos(buf_T *, long); +static pos_T *get_off_or_lnum(buf_T *buf, char_u **argp); +static long get_buf_size(buf_T *); +static int netbeans_keystring(char_u *keystr); +static void postpone_keycommand(char_u *keystr); +static void special_keys(char_u *args); -/* TRUE when netbeans is running with a GUI. */ -#ifdef FEAT_GUI -# define NB_HAS_GUI (gui.in_use || gui.starting) -#endif +static int netbeans_connect(char *, int); +static int getConnInfo(char *file, char **host, char **port, char **password); -#ifdef WIN64 -typedef __int64 NBSOCK; -#else -typedef int NBSOCK; -#endif +static void nb_init_graphics(void); +static void coloncmd(char *cmd, ...); +static void nb_set_curbuf(buf_T *buf); +static void nb_parse_cmd(char_u *); +static int nb_do_cmd(int, char_u *, int, int, char_u *); +static void nb_send(char *buf, char *fun); +static void nb_free(void); -static NBSOCK nbsock = -1; /* socket fd for Netbeans connection */ -#define NETBEANS_OPEN (nbsock != -1) +#define NETBEANS_OPEN (channel_can_write_to(nb_channel)) +static channel_T *nb_channel = NULL; -#ifdef FEAT_GUI_X11 -static XtInputId inputHandler = (XtInputId)NULL; /* Cookie for input */ -#endif -#ifdef FEAT_GUI_GTK -static gint inputHandler = 0; /* Cookie for input */ -#endif -#ifdef FEAT_GUI_W32 -static int inputHandler = -1; /* simply ret.value of WSAAsyncSelect() */ -extern HWND s_hwnd; /* Gvim's Window handle */ -#endif static int r_cmdno; /* current command number for reply */ -#ifdef FEAT_GUI_MACVIM -static int sock_select(int s); -#endif - static int dosetvisible = FALSE; /* @@ -143,44 +80,17 @@ static int needupdate = 0; static int inAtomic = 0; /* - * Close the socket and remove the input handlers. + * Callback invoked when the channel is closed. */ static void -nb_close_socket(void) +nb_channel_closed(void) { -#ifdef FEAT_GUI_X11 - if (inputHandler != (XtInputId)NULL) - { - XtRemoveInput(inputHandler); - inputHandler = (XtInputId)NULL; - } -#else -# ifdef FEAT_GUI_GTK - if (inputHandler != 0) - { - gdk_input_remove(inputHandler); - inputHandler = 0; - } -# else -# ifdef FEAT_GUI_W32 - if (inputHandler == 0) - { - WSAAsyncSelect(nbsock, s_hwnd, 0, 0); - inputHandler = -1; - } -# elif defined(FEAT_GUI_MACVIM) - gui_macvim_set_netbeans_socket(-1); -# endif -# endif -#endif - - sock_close(nbsock); - nbsock = -1; + nb_channel = NULL; } /* * Close the connection and cleanup. - * May be called when nb_close_socket() was called earlier. + * May be called when the socket was closed earlier. */ static void netbeans_close(void) @@ -188,10 +98,16 @@ netbeans_close(void) if (NETBEANS_OPEN) { netbeans_send_disconnect(); - nb_close_socket(); + if (nb_channel != NULL) + { + /* Close the socket and remove the input handlers. */ + channel_close(nb_channel, TRUE); + channel_clear(nb_channel); + } + nb_channel = NULL; } -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI bevalServers &= ~BEVAL_NETBEANS; #endif @@ -205,32 +121,9 @@ netbeans_close(void) update_screen(CLEAR); setcursor(); cursor_on(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); } -#if defined(FEAT_GUI_MACVIM) - static int -sock_select(int s) -{ - fd_set readset; - struct timeval timeout; - - FD_ZERO(&readset); - FD_SET(s, &readset); - timeout.tv_sec = 0; - timeout.tv_usec = 0; - - return select(s + 1, &readset, NULL, NULL, &timeout); -} -#endif /* FEAT_GUI_MACVIM */ - #define NB_DEF_HOST "localhost" #define NB_DEF_ADDR "3219" #define NB_DEF_PASS "changeme" @@ -238,18 +131,7 @@ sock_select(int s) static int netbeans_connect(char *params, int doabort) { -#ifdef INET_SOCKETS - struct sockaddr_in server; - struct hostent * host; -# ifdef FEAT_GUI_W32 - u_short port; -# else - int port; -# endif -#else - struct sockaddr_un server; -#endif - int sd; + int port; char buf[32]; char *hostname = NULL; char *address = NULL; @@ -260,8 +142,7 @@ netbeans_connect(char *params, int doabort) if (*params == '=') { /* "=fname": Read info from specified file. */ - if (getConnInfo(params + 1, &hostname, &address, &password) - == FAIL) + if (getConnInfo(params + 1, &hostname, &address, &password) == FAIL) return FAIL; } else @@ -325,128 +206,29 @@ netbeans_connect(char *params, int doabort) vim_free(password); password = (char *)vim_strsave((char_u *)NB_DEF_PASS); } - if (hostname == NULL || address == NULL || password == NULL) - goto theend; /* out of memory */ - -#ifdef FEAT_GUI_W32 - netbeans_init_winsock(); -#endif - -#ifdef INET_SOCKETS - port = atoi(address); - - if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1) + if (hostname != NULL && address != NULL && password != NULL) { - nbdebug(("error in socket() in netbeans_connect()\n")); - PERROR("socket() in netbeans_connect()"); - goto theend; - } - - /* Get the server internet address and put into addr structure */ - /* fill in the socket address structure and connect to server */ - vim_memset((char *)&server, '\0', sizeof(server)); - server.sin_family = AF_INET; - server.sin_port = htons(port); - if ((host = gethostbyname(hostname)) == NULL) - { - nbdebug(("error in gethostbyname() in netbeans_connect()\n")); - PERROR("gethostbyname() in netbeans_connect()"); - sock_close(sd); - goto theend; - } - memcpy((char *)&server.sin_addr, host->h_addr, host->h_length); -#else - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - { - nbdebug(("error in socket() in netbeans_connect()\n")); - PERROR("socket() in netbeans_connect()"); - goto theend; - } - - server.sun_family = AF_UNIX; - strcpy(server.sun_path, address); -#endif - /* Connect to server */ - if (connect(sd, (struct sockaddr *)&server, sizeof(server))) - { - SOCK_ERRNO; - nbdebug(("netbeans_connect: Connect failed with errno %d\n", errno)); - if (errno == ECONNREFUSED) + port = atoi(address); + nb_channel = channel_open(hostname, port, 3000, nb_channel_closed); + if (nb_channel != NULL) { - sock_close(sd); -#ifdef INET_SOCKETS - if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1) - { - SOCK_ERRNO; - nbdebug(("socket()#2 in netbeans_connect()\n")); - PERROR("socket()#2 in netbeans_connect()"); - goto theend; - } -#else - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - { - SOCK_ERRNO; - nbdebug(("socket()#2 in netbeans_connect()\n")); - PERROR("socket()#2 in netbeans_connect()"); - goto theend; - } -#endif - if (connect(sd, (struct sockaddr *)&server, sizeof(server))) - { - int retries = 36; - int success = FALSE; + /* success */ +# ifdef FEAT_BEVAL_GUI + bevalServers |= BEVAL_NETBEANS; +# endif - SOCK_ERRNO; - while (retries-- && ((errno == ECONNREFUSED) - || (errno == EINTR))) - { - nbdebug(("retrying...\n")); - mch_delay(3000L, TRUE); - ui_breakcheck(); - if (got_int) - { - errno = EINTR; - break; - } - if (connect(sd, (struct sockaddr *)&server, - sizeof(server)) == 0) - { - success = TRUE; - break; - } - SOCK_ERRNO; - } - if (!success) - { - /* Get here when the server can't be found. */ - nbdebug(("Cannot connect to Netbeans #2\n")); - PERROR(_("Cannot connect to Netbeans #2")); - sock_close(sd); - if (doabort) - getout(1); - goto theend; - } - } - } - else - { - nbdebug(("Cannot connect to Netbeans\n")); - PERROR(_("Cannot connect to Netbeans")); - sock_close(sd); - if (doabort) - getout(1); - goto theend; + /* success, login */ + vim_snprintf(buf, sizeof(buf), "AUTH %s\n", password); + nb_send(buf, "netbeans_connect"); + + sprintf(buf, "0:version=0 \"%s\"\n", ExtEdProtocolVersion); + nb_send(buf, "externaleditor_version"); } } - nbsock = sd; - vim_snprintf(buf, sizeof(buf), "AUTH %s\n", password); - nb_send(buf, "netbeans_connect"); - - sprintf(buf, "0:version=0 \"%s\"\n", ExtEdProtocolVersion); - nb_send(buf, "externaleditor_version"); + if (nb_channel == NULL && doabort) + getout(1); -theend: vim_free(hostname); vim_free(address); vim_free(password); @@ -467,7 +249,7 @@ getConnInfo(char *file, char **host, char **port, char **auth) char_u *lp; char_u *nlp; #ifdef UNIX - struct stat st; + stat_T st; /* * For Unix only accept the file when it's not accessible by others. @@ -587,270 +369,63 @@ handle_key_queue(void) } -struct cmdqueue -{ - char_u *buffer; - struct cmdqueue *next; - struct cmdqueue *prev; -}; - -typedef struct cmdqueue queue_T; - -static queue_T head; /* dummy node, header for circular queue */ - - -/* - * Put the buffer on the work queue; possibly save it to a file as well. - */ - static void -save(char_u *buf, int len) -{ - queue_T *node; - - node = (queue_T *)alloc(sizeof(queue_T)); - if (node == NULL) - return; /* out of memory */ - node->buffer = alloc(len + 1); - if (node->buffer == NULL) - { - vim_free(node); - return; /* out of memory */ - } - mch_memmove(node->buffer, buf, (size_t)len); - node->buffer[len] = NUL; - - if (head.next == NULL) /* initialize circular queue */ - { - head.next = &head; - head.prev = &head; - } - - /* insert node at tail of queue */ - node->next = &head; - node->prev = head.prev; - head.prev->next = node; - head.prev = node; - -#ifdef NBDEBUG - { - static int outfd = -2; - - /* possibly write buffer out to a file */ - if (outfd == -3) - return; - - if (outfd == -2) - { - char *file = getenv("__NETBEANS_SAVE"); - if (file == NULL) - outfd = -3; - else - outfd = mch_open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666); - } - - if (outfd >= 0) - write(outfd, buf, len); - } -#endif -} - - /* * While there's still a command in the work queue, parse and execute it. */ void netbeans_parse_messages(void) { + readq_T *node; + char_u *buffer; char_u *p; - queue_T *node; int own_node; - while (head.next != NULL && head.next != &head) + while (nb_channel != NULL) { - node = head.next; + node = channel_peek(nb_channel, PART_SOCK); + if (node == NULL) + break; /* nothing to read */ - /* Locate the first line in the first buffer. */ - p = vim_strchr(node->buffer, '\n'); + /* Locate the end of the first line in the first buffer. */ + p = channel_first_nl(node); if (p == NULL) { /* Command isn't complete. If there is no following buffer, * return (wait for more). If there is another buffer following, * prepend the text to that buffer and delete this one. */ - if (node->next == &head) + if (channel_collapse(nb_channel, PART_SOCK, TRUE) == FAIL) return; - p = alloc((unsigned)(STRLEN(node->buffer) - + STRLEN(node->next->buffer) + 1)); - if (p == NULL) - return; /* out of memory */ - STRCPY(p, node->buffer); - STRCAT(p, node->next->buffer); - vim_free(node->next->buffer); - node->next->buffer = p; - - /* dispose of the node and buffer */ - head.next = node->next; - node->next->prev = node->prev; - vim_free(node->buffer); - vim_free(node); + continue; + } + + /* There is a complete command at the start of the buffer. + * Terminate it with a NUL. When no more text is following unlink + * the buffer. Do this before executing, because new buffers can + * be added while busy handling the command. */ + *p++ = NUL; + if (*p == NUL) + { + own_node = TRUE; + buffer = channel_get(nb_channel, PART_SOCK); + /* "node" is now invalid! */ } else { - /* There is a complete command at the start of the buffer. - * Terminate it with a NUL. When no more text is following unlink - * the buffer. Do this before executing, because new buffers can - * be added while busy handling the command. */ - *p++ = NUL; - if (*p == NUL) - { - own_node = TRUE; - head.next = node->next; - node->next->prev = node->prev; - } - else - own_node = FALSE; - - /* now, parse and execute the commands */ - nb_parse_cmd(node->buffer); - - if (own_node) - { - /* buffer finished, dispose of the node and buffer */ - vim_free(node->buffer); - vim_free(node); - } - /* Check that "head" wasn't changed under our fingers, e.g. when a - * DETACH command was handled. */ - else if (head.next == node) - { - /* more follows, move to the start */ - STRMOVE(node->buffer, p); - } + own_node = FALSE; + buffer = node->rq_buffer; } - } -} - -/* Buffer size for reading incoming messages. */ -#define MAXMSGSIZE 4096 - -/* - * Read a command from netbeans. - */ -#ifdef FEAT_GUI_X11 - static void -messageFromNetbeans(XtPointer clientData UNUSED, - int *unused1 UNUSED, - XtInputId *unused2 UNUSED) -{ - netbeans_read(); -} -#endif -#ifdef FEAT_GUI_GTK - static void -messageFromNetbeans(gpointer clientData UNUSED, - gint unused1 UNUSED, - GdkInputCondition unused2 UNUSED) -{ - netbeans_read(); -} -#endif - -#define DETACH_MSG "DETACH\n" - - void -netbeans_read() -{ - static char_u *buf = NULL; - int len = 0; - int readlen = 0; -#ifdef HAVE_SELECT - struct timeval tval; - fd_set rfds; -#else -# ifdef HAVE_POLL - struct pollfd fds; -# endif -#endif - - if (!NETBEANS_OPEN) - { - nbdebug(("messageFromNetbeans() called without a socket\n")); - return; - } - -#ifdef FEAT_GUI_MACVIM - /* It may happen that socket is not readable because socket has been already - * read by timing of CFRunLoop callback. So check socket using select. */ - if (sock_select(nbsock) <= 0) - return; -#endif - - /* Allocate a buffer to read into. */ - if (buf == NULL) - { - buf = alloc(MAXMSGSIZE); - if (buf == NULL) - return; /* out of memory! */ - } - - /* Keep on reading for as long as there is something to read. - * Use select() or poll() to avoid blocking on a message that is exactly - * MAXMSGSIZE long. */ - for (;;) - { -#ifdef HAVE_SELECT - FD_ZERO(&rfds); - FD_SET(nbsock, &rfds); - tval.tv_sec = 0; - tval.tv_usec = 0; - if (select(nbsock + 1, &rfds, NULL, NULL, &tval) <= 0) - break; -#else -# ifdef HAVE_POLL - fds.fd = nbsock; - fds.events = POLLIN; - if (poll(&fds, 1, 0) <= 0) - break; -# endif -#endif - len = sock_read(nbsock, buf, MAXMSGSIZE); - if (len <= 0) - break; /* error or nothing more to read */ - - /* Store the read message in the queue. */ - save(buf, len); - readlen += len; - if (len < MAXMSGSIZE) - break; /* did read everything that's available */ - } + /* Now, parse and execute the commands. This may set nb_channel to + * NULL if the channel is closed. */ + nb_parse_cmd(buffer); - /* Reading a socket disconnection (readlen == 0), or a socket error. */ - if (readlen <= 0) - { - /* Queue a "DETACH" netbeans message in the command queue in order to - * terminate the netbeans session later. Do not end the session here - * directly as we may be running in the context of a call to - * netbeans_parse_messages(): - * netbeans_parse_messages - * -> autocmd triggered while processing the netbeans cmd - * -> ui_breakcheck - * -> gui event loop or select loop - * -> netbeans_read() - */ - save((char_u *)DETACH_MSG, (int)strlen(DETACH_MSG)); - nb_close_socket(); - - if (len < 0) - { - nbdebug(("read from Netbeans socket\n")); - PERROR(_("read from Netbeans socket")); - } + if (own_node) + /* buffer finished, dispose of it */ + vim_free(buffer); + else if (nb_channel != NULL) + /* more follows, move it to the start */ + channel_consume(nb_channel, PART_SOCK, (int)(p - buffer)); } - -#if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK) - if (NB_HAS_GUI && gtk_main_level() > 0) - gtk_main_quit(); -#endif } /* @@ -889,6 +464,11 @@ nb_parse_cmd(char_u *cmd) if (STRCMP(cmd, "DETACH") == 0) { + buf_T *buf; + + FOR_ALL_BUFFERS(buf) + buf->b_has_sign_column = FALSE; + /* The IDE is breaking the connection. */ netbeans_close(); return; @@ -969,12 +549,12 @@ static char **globalsignmap = NULL; static int globalsignmaplen = 0; static int globalsignmapused = 0; -static int mapsigntype __ARGS((nbbuf_T *, int localsigntype)); -static void addsigntype __ARGS((nbbuf_T *, int localsigntype, char_u *typeName, +static int mapsigntype(nbbuf_T *, int localsigntype); +static void addsigntype(nbbuf_T *, int localsigntype, char_u *typeName, char_u *tooltip, char_u *glyphfile, - char_u *fg, char_u *bg)); -static void print_read_msg __ARGS((nbbuf_T *buf)); -static void print_save_msg __ARGS((nbbuf_T *buf, off_t nchars)); + char_u *fg, char_u *bg); +static void print_read_msg(nbbuf_T *buf); +static void print_save_msg(nbbuf_T *buf, off_T nchars); static int curPCtype = -1; @@ -982,10 +562,9 @@ static int curPCtype = -1; * Free netbeans resources. */ static void -nb_free() +nb_free(void) { keyQ_T *key_node = keyHead.next; - queue_T *cmd_node = head.next; nbbuf_T buf; int i; @@ -1001,8 +580,7 @@ nb_free() buf.bufp->b_was_netbeans_file = FALSE; } } - vim_free(buf_list); - buf_list = NULL; + VIM_CLEAR(buf_list); buf_list_size = 0; buf_list_used = 0; @@ -1022,19 +600,8 @@ nb_free() } /* free the queued netbeans commands */ - while (cmd_node != NULL && cmd_node != &head) - { - queue_T *next = cmd_node->next; - vim_free(cmd_node->buffer); - vim_free(cmd_node); - if (next == &head) - { - head.next = &head; - head.prev = &head; - break; - } - cmd_node = next; - } + if (nb_channel != NULL) + channel_clear(nb_channel); } /* @@ -1109,10 +676,18 @@ nb_get_buf(int bufno) { if (bufno >= buf_list_size) /* grow list */ { + nbbuf_T *t_buf_list = buf_list; + incr = bufno - buf_list_size + 90; buf_list_size += incr; buf_list = (nbbuf_T *)vim_realloc( buf_list, buf_list_size * sizeof(nbbuf_T)); + if (buf_list == NULL) + { + vim_free(t_buf_list); + buf_list_size = 0; + return NULL; + } vim_memset(buf_list + buf_list_size - incr, 0, incr * sizeof(nbbuf_T)); } @@ -1138,7 +713,7 @@ count_changed_buffers(void) int n; n = 0; - for (bufp = firstbuf; bufp != NULL; bufp = bufp->b_next) + FOR_ALL_BUFFERS(bufp) if (bufp->b_changed) ++n; return n; @@ -1170,40 +745,20 @@ netbeans_end(void) sprintf(buf, "%d:killed=%d\n", i, r_cmdno); nbdebug(("EVT: %s", buf)); /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ - ignored = sock_write(nbsock, buf, (int)STRLEN(buf)); + nb_send(buf, NULL); } } /* * Send a message to netbeans. + * When "fun" is NULL no error is given. */ static void nb_send(char *buf, char *fun) { - /* Avoid giving pages full of error messages when the other side has - * exited, only mention the first error until the connection works again. */ - static int did_error = FALSE; - - if (!NETBEANS_OPEN) - { - if (!did_error) - { - nbdebug((" %s(): write while not connected\n", fun)); - EMSG2("E630: %s(): write while not connected", fun); - } - did_error = TRUE; - } - else if (sock_write(nbsock, buf, (int)STRLEN(buf)) != (int)STRLEN(buf)) - { - if (!did_error) - { - nbdebug((" %s(): write failed\n", fun)); - EMSG2("E631: %s(): write failed", fun); - } - did_error = TRUE; - } - else - did_error = FALSE; + if (nb_channel != NULL) + channel_send(nb_channel, PART_SOCK, (char_u *)buf, + (int)STRLEN(buf), fun); } /* @@ -1878,7 +1433,7 @@ nb_do_cmd( if (buf_was_empty) { if (ff_detected == EOL_UNKNOWN) -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) ff_detected = EOL_DOS; #else ff_detected = EOL_UNIX; @@ -1921,8 +1476,7 @@ nb_do_cmd( EMSG("E636: invalid buffer identifier in create"); return FAIL; } - vim_free(buf->displayname); - buf->displayname = NULL; + VIM_CLEAR(buf->displayname); netbeansReadFile = 0; /* don't try to open disk file */ do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); @@ -2027,9 +1581,7 @@ nb_do_cmd( do_update = 1; buf->initDone = TRUE; nb_set_curbuf(buf->bufp); -#if defined(FEAT_AUTOCMD) apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp); -#endif /* handle any postponed key commands */ handle_key_queue(); @@ -2179,7 +1731,7 @@ nb_do_cmd( buf->bufp->b_changed = TRUE; else { - struct stat st; + stat_T st; /* Assume NetBeans stored the file. Reset the timestamp to * avoid "file changed" warnings. */ @@ -2191,10 +1743,8 @@ nb_do_cmd( buf->modified = buf->bufp->b_changed; if (prev_b_changed != buf->bufp->b_changed) { -#ifdef FEAT_WINDOWS check_status(buf->bufp); redraw_tabline = TRUE; -#endif #ifdef FEAT_TITLE maketitle(); #endif @@ -2227,7 +1777,7 @@ nb_do_cmd( } else if (streq((char *)cmd, "showBalloon")) { -#if defined(FEAT_BEVAL) +#if defined(FEAT_BEVAL_GUI) static char *text = NULL; /* @@ -2287,14 +1837,8 @@ nb_do_cmd( update_screen(VALID); setcursor(); cursor_on(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); + /* Quit a hit-return or more prompt. */ if (State == HITRETURN || State == ASKMORE) { @@ -2593,7 +2137,7 @@ nb_do_cmd( else if (streq((char *)cmd, "save")) { /* - * NOTE - This command is obsolete wrt NetBeans. Its left in + * NOTE - This command is obsolete wrt NetBeans. It's left in * only for historical reasons. */ if (buf == NULL || buf->bufp == NULL) @@ -2614,12 +2158,13 @@ nb_do_cmd( #endif ) { + bufref_T bufref; + + set_bufref(&bufref, buf->bufp); buf_write_all(buf->bufp, FALSE); -#ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ - if (!buf_valid(buf->bufp)) + if (!bufref_valid(&bufref)) buf->bufp = NULL; -#endif } } else @@ -2674,7 +2219,7 @@ nb_do_cmd( /* * Is this needed? I moved the netbeans_Xt_connect() later during startup - * and it may no longer be necessary. If its not needed then needupdate + * and it may no longer be necessary. If it's not needed then needupdate * and do_update can also be removed. */ if (buf != NULL && buf->initDone && do_update) @@ -2682,14 +2227,8 @@ nb_do_cmd( update_screen(NOT_VALID); setcursor(); cursor_on(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); + /* Quit a hit-return or more prompt. */ if (State == HITRETURN || State == ASKMORE) { @@ -2712,8 +2251,13 @@ nb_do_cmd( static void nb_set_curbuf(buf_T *buf) { - if (curbuf != buf && buf_jump_open_win(buf) == NULL) + if (curbuf != buf) { + if (buf_jump_open_win(buf) != NULL) + return; + if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf) != NULL) + return; set_curbuf(buf, DOBUF_GOTO); + } } /* @@ -2726,7 +2270,7 @@ coloncmd(char *cmd, ...) va_list ap; va_start(ap, cmd); - vim_vsnprintf(buf, sizeof(buf), cmd, ap, NULL); + vim_vsnprintf(buf, sizeof(buf), cmd, ap); va_end(ap); nbdebug((" COLONCMD %s\n", buf)); @@ -2736,15 +2280,7 @@ coloncmd(char *cmd, ...) /* ALT_INPUT_LOCK_OFF; */ setcursor(); /* restore the cursor position */ - out_flush(); /* make sure output has been written */ - -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); } @@ -2757,7 +2293,8 @@ special_keys(char_u *args) char *save_str = nb_unquote(args, NULL); char *tok = strtok(save_str, " "); char *sep; - char keybuf[64]; +#define KEYBUFLEN 64 + char keybuf[KEYBUFLEN]; char cmdbuf[256]; while (tok != NULL) @@ -2784,32 +2321,33 @@ special_keys(char_u *args) tok++; } - strcpy(&keybuf[i], tok); - vim_snprintf(cmdbuf, sizeof(cmdbuf), - "<silent><%s> :nbkey %s<CR>", keybuf, keybuf); - do_map(0, (char_u *)cmdbuf, NORMAL, FALSE); + if (strlen(tok) + i < KEYBUFLEN) + { + strcpy(&keybuf[i], tok); + vim_snprintf(cmdbuf, sizeof(cmdbuf), + "<silent><%s> :nbkey %s<CR>", keybuf, keybuf); + do_map(0, (char_u *)cmdbuf, NORMAL, FALSE); + } tok = strtok(NULL, " "); } vim_free(save_str); } void -ex_nbclose(eap) - exarg_T *eap UNUSED; +ex_nbclose(exarg_T *eap UNUSED) { netbeans_close(); } void -ex_nbkey(eap) - exarg_T *eap; +ex_nbkey(exarg_T *eap) { (void)netbeans_keystring(eap->arg); } void -ex_nbstart(eap) - exarg_T *eap; +ex_nbstart( + exarg_T *eap) { #ifdef FEAT_GUI # if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \ @@ -2933,7 +2471,7 @@ netbeans_beval_cb( /* Don't do anything when 'ballooneval' is off, messages scrolled the * windows up or we have no connection. */ - if (!p_beval || msg_scrolled > 0 || !NETBEANS_OPEN) + if (!can_use_beval() || !NETBEANS_OPEN) return; if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK) @@ -2963,7 +2501,7 @@ netbeans_beval_cb( #endif /* - * Return TRUE when the netbeans connection is closed. + * Return TRUE when the netbeans connection is active. */ int netbeans_active(void) @@ -2971,67 +2509,6 @@ netbeans_active(void) return NETBEANS_OPEN; } -/* - * Return netbeans file descriptor. - */ - int -netbeans_filedesc(void) -{ - return nbsock; -} - -#if defined(FEAT_GUI) || defined(PROTO) -/* - * Register our file descriptor with the gui event handling system. - */ - void -netbeans_gui_register(void) -{ - if (!NB_HAS_GUI || !NETBEANS_OPEN) - return; - -# ifdef FEAT_GUI_X11 - /* tell notifier we are interested in being called - * when there is input on the editor connection socket - */ - if (inputHandler == (XtInputId)NULL) - inputHandler = XtAppAddInput((XtAppContext)app_context, nbsock, - (XtPointer)(XtInputReadMask + XtInputExceptMask), - messageFromNetbeans, NULL); -# else -# ifdef FEAT_GUI_GTK - /* - * Tell gdk we are interested in being called when there - * is input on the editor connection socket - */ - if (inputHandler == 0) - inputHandler = gdk_input_add((gint)nbsock, (GdkInputCondition) - ((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION), - messageFromNetbeans, NULL); -# else -# ifdef FEAT_GUI_W32 - /* - * Tell Windows we are interested in receiving message when there - * is input on the editor connection socket - */ - if (inputHandler == -1) - inputHandler = WSAAsyncSelect(nbsock, s_hwnd, WM_NETBEANS, FD_READ); -# elif defined(FEAT_GUI_MACVIM) - /* - * Tell Core Foundation we are interested in being called when there - * is input on the editor connection socket - */ - gui_macvim_set_netbeans_socket(nbsock); -# endif -# endif -# endif - -# ifdef FEAT_BEVAL - bevalServers |= BEVAL_NETBEANS; -# endif -} -#endif - /* * Tell netbeans that the window was opened, ready for commands. */ @@ -3048,9 +2525,6 @@ netbeans_open(char *params, int doabort) if (netbeans_connect(params, doabort) != OK) return; -#ifdef FEAT_GUI - netbeans_gui_register(); -#endif nbdebug(("EVT: %s", cmd)); nb_send(cmd, "netbeans_startup_done"); @@ -3060,14 +2534,7 @@ netbeans_open(char *params, int doabort) update_screen(CLEAR); setcursor(); cursor_on(); - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); } /* @@ -3075,7 +2542,7 @@ netbeans_open(char *params, int doabort) * before calling exit. */ void -netbeans_send_disconnect() +netbeans_send_disconnect(void) { char buf[128]; @@ -3087,6 +2554,23 @@ netbeans_send_disconnect() } } +#if defined(FEAT_EVAL) || defined(PROTO) + int +set_ref_in_nb_channel(int copyID) +{ + int abort = FALSE; + typval_T tv; + + if (nb_channel != NULL) + { + tv.v_type = VAR_CHANNEL; + tv.vval.v_channel = nb_channel; + abort = set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} +#endif + #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_W32) || defined(PROTO) /* * Tell netbeans that the window was moved or resized. @@ -3171,7 +2655,7 @@ netbeans_file_opened(buf_T *bufp) nbdebug(("EVT: %s", buffer)); nb_send(buffer, "netbeans_file_opened"); - if (p_acd && vim_chdirfile(bufp->b_ffname) == OK) + if (p_acd && vim_chdirfile(bufp->b_ffname, "auto") == OK) shorten_fnames(TRUE); } @@ -3330,7 +2814,7 @@ netbeans_unmodified(buf_T *bufp UNUSED) } /* - * Send a button release event back to netbeans. Its up to netbeans + * Send a button release event back to netbeans. It's up to netbeans * to decide what to do (if anything) with this event. */ void @@ -3346,7 +2830,7 @@ netbeans_button_release(int button) if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) { - int col = mouse_col - W_WINCOL(curwin) + int col = mouse_col - curwin->w_wincol - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1); long off = pos2off(curbuf, &curwin->w_cursor); @@ -3560,17 +3044,41 @@ netbeans_draw_multisign_indicator(int row) int i; int y; int x; +#if GTK_CHECK_VERSION(3,0,0) + cairo_t *cr = NULL; +#else GdkDrawable *drawable = gui.drawarea->window; +#endif if (!NETBEANS_OPEN) return; +#if GTK_CHECK_VERSION(3,0,0) + cr = cairo_create(gui.surface); + cairo_set_source_rgba(cr, + gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, + gui.fgcolor->alpha); +#endif + x = 0; y = row * gui.char_height + 2; for (i = 0; i < gui.char_height - 3; i++) +#if GTK_CHECK_VERSION(3,0,0) + cairo_rectangle(cr, x+2, y++, 1, 1); +#else gdk_draw_point(drawable, gui.text_gc, x+2, y++); +#endif +#if GTK_CHECK_VERSION(3,0,0) + cairo_rectangle(cr, x+0, y, 1, 1); + cairo_rectangle(cr, x+2, y, 1, 1); + cairo_rectangle(cr, x+4, y++, 1, 1); + cairo_rectangle(cr, x+1, y, 1, 1); + cairo_rectangle(cr, x+2, y, 1, 1); + cairo_rectangle(cr, x+3, y++, 1, 1); + cairo_rectangle(cr, x+2, y, 1, 1); +#else gdk_draw_point(drawable, gui.text_gc, x+0, y); gdk_draw_point(drawable, gui.text_gc, x+2, y); gdk_draw_point(drawable, gui.text_gc, x+4, y++); @@ -3578,6 +3086,11 @@ netbeans_draw_multisign_indicator(int row) gdk_draw_point(drawable, gui.text_gc, x+2, y); gdk_draw_point(drawable, gui.text_gc, x+3, y++); gdk_draw_point(drawable, gui.text_gc, x+2, y); +#endif + +#if GTK_CHECK_VERSION(3,0,0) + cairo_destroy(cr); +#endif } #endif /* FEAT_GUI_GTK */ @@ -3713,11 +3226,18 @@ addsigntype( { int incr; int oldlen = globalsignmaplen; + char **t_globalsignmap = globalsignmap; globalsignmaplen *= 2; incr = globalsignmaplen - oldlen; globalsignmap = (char **)vim_realloc(globalsignmap, globalsignmaplen * sizeof(char *)); + if (globalsignmap == NULL) + { + vim_free(t_globalsignmap); + globalsignmaplen = 0; + return; + } vim_memset(globalsignmap + oldlen, 0, incr * sizeof(char *)); } } @@ -3743,11 +3263,18 @@ addsigntype( { int incr; int oldlen = buf->signmaplen; + int *t_signmap = buf->signmap; buf->signmaplen *= 2; incr = buf->signmaplen - oldlen; buf->signmap = (int *)vim_realloc(buf->signmap, buf->signmaplen * sizeof(int)); + if (buf->signmap == NULL) + { + vim_free(t_signmap); + buf->signmaplen = 0; + return; + } vim_memset(buf->signmap + oldlen, 0, incr * sizeof(int)); } } @@ -3803,7 +3330,7 @@ get_buf_size(buf_T *bufp) } } /* Correction for when last line doesn't have an EOL. */ - if (!bufp->b_p_eol && bufp->b_p_bin) + if (!bufp->b_p_eol && (bufp->b_p_bin || !bufp->b_p_fixeol)) char_count -= eol_size; } @@ -3884,16 +3411,15 @@ pos2off(buf_T *buf, pos_T *pos) /* - * This message is printed after NetBeans opens a new file. Its + * This message is printed after NetBeans opens a new file. It's * similar to the message readfile() uses, but since NetBeans * doesn't normally call readfile, we do our own. */ static void -print_read_msg(buf) - nbbuf_T *buf; +print_read_msg(nbbuf_T *buf) { int lnum = buf->bufp->b_ml.ml_line_count; - off_t nchars = buf->bufp->b_orig_size; + off_T nchars = buf->bufp->b_orig_size; char_u c; msg_add_fname(buf->bufp, buf->bufp->b_ffname); @@ -3913,8 +3439,7 @@ print_read_msg(buf) msg_add_lines(c, (long)lnum, nchars); /* Now display it */ - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; msg_trunc_attr(IObuff, FALSE, 0); msg_scrolled_ign = FALSE; @@ -3927,9 +3452,7 @@ print_read_msg(buf) * writing a file. */ static void -print_save_msg(buf, nchars) - nbbuf_T *buf; - off_t nchars; +print_save_msg(nbbuf_T *buf, off_T nchars) { char_u c; char_u *p; @@ -3943,8 +3466,7 @@ print_save_msg(buf, nchars) msg_add_lines(c, buf->bufp->b_ml.ml_line_count, buf->bufp->b_orig_size); - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; p = msg_trunc_attr(IObuff, FALSE, 0); if ((msg_scrolled && !need_wait_return) || !buf->initDone) diff --git a/src/normal.c b/src/normal.c index 3f00eedbd5..ddce51ec70 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -25,30 +25,31 @@ static int VIsual_mode_orig = NUL; /* saved Visual mode */ static int restart_VIsual_select = 0; #ifdef FEAT_EVAL -static void set_vcount_ca __ARGS((cmdarg_T *cap, int *set_prevcount)); +static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount); #endif static int #ifdef __BORLANDC__ _RTLENTRYF #endif - nv_compare __ARGS((const void *s1, const void *s2)); -static int find_command __ARGS((int cmdchar)); -static void op_colon __ARGS((oparg_T *oap)); -static void op_function __ARGS((oparg_T *oap)); + nv_compare(const void *s1, const void *s2); +static int find_command(int cmdchar); +static void op_colon(oparg_T *oap); +static void op_function(oparg_T *oap); #if defined(FEAT_MOUSE) -static void find_start_of_word __ARGS((pos_T *)); -static void find_end_of_word __ARGS((pos_T *)); -static int get_mouse_class __ARGS((char_u *p)); -#endif -static void prep_redo_cmd __ARGS((cmdarg_T *cap)); -static void prep_redo __ARGS((int regname, long, int, int, int, int, int)); -static int checkclearop __ARGS((oparg_T *oap)); -static int checkclearopq __ARGS((oparg_T *oap)); -static void clearop __ARGS((oparg_T *oap)); -static void clearopbeep __ARGS((oparg_T *oap)); -static void unshift_special __ARGS((cmdarg_T *cap)); +static void find_start_of_word(pos_T *); +static void find_end_of_word(pos_T *); +static int get_mouse_class(char_u *p); +#endif +static void prep_redo_cmd(cmdarg_T *cap); +static void prep_redo(int regname, long, int, int, int, int, int); +static int checkclearop(oparg_T *oap); +static int checkclearopq(oparg_T *oap); +static void clearop(oparg_T *oap); +static void clearopbeep(oparg_T *oap); +static void unshift_special(cmdarg_T *cap); +static void may_clear_cmdline(void); #ifdef FEAT_CMDL_INFO -static void del_from_showcmd __ARGS((int)); +static void del_from_showcmd(int); #endif /* @@ -56,124 +57,120 @@ static void del_from_showcmd __ARGS((int)); * n_*(): functions called to handle Normal mode commands. * v_*(): functions called to handle Visual mode commands. */ -static void nv_ignore __ARGS((cmdarg_T *cap)); -static void nv_nop __ARGS((cmdarg_T *cap)); -static void nv_error __ARGS((cmdarg_T *cap)); -static void nv_help __ARGS((cmdarg_T *cap)); -static void nv_addsub __ARGS((cmdarg_T *cap)); -static void nv_page __ARGS((cmdarg_T *cap)); -static void nv_gd __ARGS((oparg_T *oap, int nchar, int thisblock)); -static int nv_screengo __ARGS((oparg_T *oap, int dir, long dist)); +static void nv_ignore(cmdarg_T *cap); +static void nv_nop(cmdarg_T *cap); +static void nv_error(cmdarg_T *cap); +static void nv_help(cmdarg_T *cap); +static void nv_addsub(cmdarg_T *cap); +static void nv_page(cmdarg_T *cap); +static void nv_gd(oparg_T *oap, int nchar, int thisblock); +static int nv_screengo(oparg_T *oap, int dir, long dist); #ifdef FEAT_MOUSE -static void nv_mousescroll __ARGS((cmdarg_T *cap)); -static void nv_mouse __ARGS((cmdarg_T *cap)); +static void nv_mousescroll(cmdarg_T *cap); +static void nv_mouse(cmdarg_T *cap); #endif -static void nv_scroll_line __ARGS((cmdarg_T *cap)); -static void nv_zet __ARGS((cmdarg_T *cap)); +static void nv_scroll_line(cmdarg_T *cap); +static void nv_zet(cmdarg_T *cap); #ifdef FEAT_GUI -static void nv_ver_scrollbar __ARGS((cmdarg_T *cap)); -static void nv_hor_scrollbar __ARGS((cmdarg_T *cap)); +static void nv_ver_scrollbar(cmdarg_T *cap); +static void nv_hor_scrollbar(cmdarg_T *cap); #endif #ifdef FEAT_GUI_TABLINE -static void nv_tabline __ARGS((cmdarg_T *cap)); -static void nv_tabmenu __ARGS((cmdarg_T *cap)); -#endif -static void nv_exmode __ARGS((cmdarg_T *cap)); -static void nv_colon __ARGS((cmdarg_T *cap)); -static void nv_ctrlg __ARGS((cmdarg_T *cap)); -static void nv_ctrlh __ARGS((cmdarg_T *cap)); -static void nv_clear __ARGS((cmdarg_T *cap)); -static void nv_ctrlo __ARGS((cmdarg_T *cap)); -static void nv_hat __ARGS((cmdarg_T *cap)); -static void nv_Zet __ARGS((cmdarg_T *cap)); -static void nv_ident __ARGS((cmdarg_T *cap)); -static void nv_tagpop __ARGS((cmdarg_T *cap)); -static void nv_scroll __ARGS((cmdarg_T *cap)); -static void nv_right __ARGS((cmdarg_T *cap)); -static void nv_left __ARGS((cmdarg_T *cap)); -static void nv_up __ARGS((cmdarg_T *cap)); -static void nv_down __ARGS((cmdarg_T *cap)); +static void nv_tabline(cmdarg_T *cap); +static void nv_tabmenu(cmdarg_T *cap); +#endif +static void nv_exmode(cmdarg_T *cap); +static void nv_colon(cmdarg_T *cap); +static void nv_ctrlg(cmdarg_T *cap); +static void nv_ctrlh(cmdarg_T *cap); +static void nv_clear(cmdarg_T *cap); +static void nv_ctrlo(cmdarg_T *cap); +static void nv_hat(cmdarg_T *cap); +static void nv_Zet(cmdarg_T *cap); +static void nv_ident(cmdarg_T *cap); +static void nv_tagpop(cmdarg_T *cap); +static void nv_scroll(cmdarg_T *cap); +static void nv_right(cmdarg_T *cap); +static void nv_left(cmdarg_T *cap); +static void nv_up(cmdarg_T *cap); +static void nv_down(cmdarg_T *cap); #ifdef FEAT_SEARCHPATH -static void nv_gotofile __ARGS((cmdarg_T *cap)); -#endif -static void nv_end __ARGS((cmdarg_T *cap)); -static void nv_dollar __ARGS((cmdarg_T *cap)); -static void nv_search __ARGS((cmdarg_T *cap)); -static void nv_next __ARGS((cmdarg_T *cap)); -static void normal_search __ARGS((cmdarg_T *cap, int dir, char_u *pat, int opt)); -static void nv_csearch __ARGS((cmdarg_T *cap)); -static void nv_brackets __ARGS((cmdarg_T *cap)); -static void nv_percent __ARGS((cmdarg_T *cap)); -static void nv_brace __ARGS((cmdarg_T *cap)); -static void nv_mark __ARGS((cmdarg_T *cap)); -static void nv_findpar __ARGS((cmdarg_T *cap)); -static void nv_undo __ARGS((cmdarg_T *cap)); -static void nv_kundo __ARGS((cmdarg_T *cap)); -static void nv_Replace __ARGS((cmdarg_T *cap)); +static void nv_gotofile(cmdarg_T *cap); +#endif +static void nv_end(cmdarg_T *cap); +static void nv_dollar(cmdarg_T *cap); +static void nv_search(cmdarg_T *cap); +static void nv_next(cmdarg_T *cap); +static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt); +static void nv_csearch(cmdarg_T *cap); +static void nv_brackets(cmdarg_T *cap); +static void nv_percent(cmdarg_T *cap); +static void nv_brace(cmdarg_T *cap); +static void nv_mark(cmdarg_T *cap); +static void nv_findpar(cmdarg_T *cap); +static void nv_undo(cmdarg_T *cap); +static void nv_kundo(cmdarg_T *cap); +static void nv_Replace(cmdarg_T *cap); #ifdef FEAT_VREPLACE -static void nv_vreplace __ARGS((cmdarg_T *cap)); -#endif -static void v_swap_corners __ARGS((int cmdchar)); -static void nv_replace __ARGS((cmdarg_T *cap)); -static void n_swapchar __ARGS((cmdarg_T *cap)); -static void nv_cursormark __ARGS((cmdarg_T *cap, int flag, pos_T *pos)); -static void v_visop __ARGS((cmdarg_T *cap)); -static void nv_subst __ARGS((cmdarg_T *cap)); -static void nv_abbrev __ARGS((cmdarg_T *cap)); -static void nv_optrans __ARGS((cmdarg_T *cap)); -static void nv_gomark __ARGS((cmdarg_T *cap)); -static void nv_pcmark __ARGS((cmdarg_T *cap)); -static void nv_regname __ARGS((cmdarg_T *cap)); -static void nv_visual __ARGS((cmdarg_T *cap)); -static void n_start_visual_mode __ARGS((int c)); -static void nv_window __ARGS((cmdarg_T *cap)); -static void nv_suspend __ARGS((cmdarg_T *cap)); -static void nv_g_cmd __ARGS((cmdarg_T *cap)); -static void n_opencmd __ARGS((cmdarg_T *cap)); -static void nv_dot __ARGS((cmdarg_T *cap)); -static void nv_redo __ARGS((cmdarg_T *cap)); -static void nv_Undo __ARGS((cmdarg_T *cap)); -static void nv_tilde __ARGS((cmdarg_T *cap)); -static void nv_operator __ARGS((cmdarg_T *cap)); +static void nv_vreplace(cmdarg_T *cap); +#endif +static void v_swap_corners(int cmdchar); +static void nv_replace(cmdarg_T *cap); +static void n_swapchar(cmdarg_T *cap); +static void nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos); +static void v_visop(cmdarg_T *cap); +static void nv_subst(cmdarg_T *cap); +static void nv_abbrev(cmdarg_T *cap); +static void nv_optrans(cmdarg_T *cap); +static void nv_gomark(cmdarg_T *cap); +static void nv_pcmark(cmdarg_T *cap); +static void nv_regname(cmdarg_T *cap); +static void nv_visual(cmdarg_T *cap); +static void n_start_visual_mode(int c); +static void nv_window(cmdarg_T *cap); +static void nv_suspend(cmdarg_T *cap); +static void nv_g_cmd(cmdarg_T *cap); +static void n_opencmd(cmdarg_T *cap); +static void nv_dot(cmdarg_T *cap); +static void nv_redo(cmdarg_T *cap); +static void nv_Undo(cmdarg_T *cap); +static void nv_tilde(cmdarg_T *cap); +static void nv_operator(cmdarg_T *cap); #ifdef FEAT_EVAL -static void set_op_var __ARGS((int optype)); -#endif -static void nv_lineop __ARGS((cmdarg_T *cap)); -static void nv_home __ARGS((cmdarg_T *cap)); -static void nv_pipe __ARGS((cmdarg_T *cap)); -static void nv_bck_word __ARGS((cmdarg_T *cap)); -static void nv_wordcmd __ARGS((cmdarg_T *cap)); -static void nv_beginline __ARGS((cmdarg_T *cap)); -static void adjust_cursor __ARGS((oparg_T *oap)); -static void adjust_for_sel __ARGS((cmdarg_T *cap)); -static int unadjust_for_sel __ARGS((void)); -static void nv_select __ARGS((cmdarg_T *cap)); -static void nv_goto __ARGS((cmdarg_T *cap)); -static void nv_normal __ARGS((cmdarg_T *cap)); -static void nv_esc __ARGS((cmdarg_T *oap)); -static void nv_edit __ARGS((cmdarg_T *cap)); -static void invoke_edit __ARGS((cmdarg_T *cap, int repl, int cmd, int startln)); +static void set_op_var(int optype); +#endif +static void nv_lineop(cmdarg_T *cap); +static void nv_home(cmdarg_T *cap); +static void nv_pipe(cmdarg_T *cap); +static void nv_bck_word(cmdarg_T *cap); +static void nv_wordcmd(cmdarg_T *cap); +static void nv_beginline(cmdarg_T *cap); +static void adjust_cursor(oparg_T *oap); +static void adjust_for_sel(cmdarg_T *cap); +static int unadjust_for_sel(void); +static void nv_select(cmdarg_T *cap); +static void nv_goto(cmdarg_T *cap); +static void nv_normal(cmdarg_T *cap); +static void nv_esc(cmdarg_T *oap); +static void nv_edit(cmdarg_T *cap); +static void invoke_edit(cmdarg_T *cap, int repl, int cmd, int startln); #ifdef FEAT_TEXTOBJ -static void nv_object __ARGS((cmdarg_T *cap)); -#endif -static void nv_record __ARGS((cmdarg_T *cap)); -static void nv_at __ARGS((cmdarg_T *cap)); -static void nv_halfpage __ARGS((cmdarg_T *cap)); -static void nv_join __ARGS((cmdarg_T *cap)); -static void nv_put __ARGS((cmdarg_T *cap)); -static void nv_open __ARGS((cmdarg_T *cap)); -#ifdef FEAT_SNIFF -static void nv_sniff __ARGS((cmdarg_T *cap)); -#endif +static void nv_object(cmdarg_T *cap); +#endif +static void nv_record(cmdarg_T *cap); +static void nv_at(cmdarg_T *cap); +static void nv_halfpage(cmdarg_T *cap); +static void nv_join(cmdarg_T *cap); +static void nv_put(cmdarg_T *cap); +static void nv_open(cmdarg_T *cap); #ifdef FEAT_NETBEANS_INTG -static void nv_nbcmd __ARGS((cmdarg_T *cap)); +static void nv_nbcmd(cmdarg_T *cap); #endif #ifdef FEAT_DND -static void nv_drop __ARGS((cmdarg_T *cap)); -#endif -#ifdef FEAT_AUTOCMD -static void nv_cursorhold __ARGS((cmdarg_T *cap)); +static void nv_drop(cmdarg_T *cap); #endif +static void nv_cursorhold(cmdarg_T *cap); +static void get_op_vcol(oparg_T *oap, colnr_T col, int initial); static char *e_noident = N_("E349: No identifier under cursor"); @@ -181,7 +178,7 @@ static char *e_noident = N_("E349: No identifier under cursor"); * Function to be called for a Normal or Visual mode command. * The argument is a cmdarg_T. */ -typedef void (*nv_func_T) __ARGS((cmdarg_T *cap)); +typedef void (*nv_func_T)(cmdarg_T *cap); /* Values for cmd_flags. */ #define NV_NCH 0x01 /* may need to get a second char */ @@ -359,6 +356,7 @@ static const struct nv_cmd {K_LEFTDRAG, nv_mouse, 0, 0}, {K_LEFTRELEASE, nv_mouse, 0, 0}, {K_LEFTRELEASE_NM, nv_mouse, 0, 0}, + {K_MOUSEMOVE, nv_mouse, 0, 0}, {K_MIDDLEMOUSE, nv_mouse, 0, 0}, {K_MIDDLEDRAG, nv_mouse, 0, 0}, {K_MIDDLERELEASE, nv_mouse, 0, 0}, @@ -415,11 +413,8 @@ static const struct nv_cmd {K_TABMENU, nv_tabmenu, 0, 0}, #endif #ifdef FEAT_FKMAP - {K_F8, farsi_fkey, 0, 0}, - {K_F9, farsi_fkey, 0, 0}, -#endif -#ifdef FEAT_SNIFF - {K_SNIFF, nv_sniff, 0, 0}, + {K_F8, farsi_f8, 0, 0}, + {K_F9, farsi_f9, 0, 0}, #endif #ifdef FEAT_NETBEANS_INTG {K_F21, nv_nbcmd, NV_NCH_ALW, 0}, @@ -427,9 +422,8 @@ static const struct nv_cmd #ifdef FEAT_DND {K_DROP, nv_drop, NV_STS, 0}, #endif -#ifdef FEAT_AUTOCMD {K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0}, -#endif + {K_PS, nv_edit, 0, 0}, }; /* Number of commands in nv_cmds[]. */ @@ -450,9 +444,7 @@ static int nv_max_linear; #ifdef __BORLANDC__ _RTLENTRYF #endif -nv_compare(s1, s2) - const void *s1; - const void *s2; +nv_compare(const void *s1, const void *s2) { int c1, c2; @@ -470,7 +462,7 @@ nv_compare(s1, s2) * Initialize the nv_cmd_idx[] table. */ void -init_normal_cmds() +init_normal_cmds(void) { int i; @@ -493,8 +485,7 @@ init_normal_cmds() * Returns -1 for invalid command. */ static int -find_command(cmdchar) - int cmdchar; +find_command(int cmdchar) { int i; int idx; @@ -544,9 +535,9 @@ find_command(cmdchar) * Execute a command in Normal mode. */ void -normal_cmd(oap, toplevel) - oparg_T *oap; - int toplevel UNUSED; /* TRUE when called from main() */ +normal_cmd( + oparg_T *oap, + int toplevel UNUSED) /* TRUE when called from main() */ { cmdarg_T ca; /* command arguments */ int c; @@ -571,10 +562,6 @@ normal_cmd(oap, toplevel) * remembered in "opcount". */ ca.opcount = opcount; -#ifdef FEAT_SNIFF - want_sniff_request = sniff_connected; -#endif - /* * If there is an operator pending, then the command we take this time * will terminate it. Finish_op tells us to finish the operation before @@ -604,7 +591,6 @@ normal_cmd(oap, toplevel) #endif } -#ifdef FEAT_AUTOCMD /* Restore counts from before receiving K_CURSORHOLD. This means after * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not * "3 * 2". */ @@ -615,7 +601,6 @@ normal_cmd(oap, toplevel) oap->prev_opcount = 0; oap->prev_count0 = 0; } -#endif mapped_len = typebuf_maplen(); @@ -636,7 +621,7 @@ normal_cmd(oap, toplevel) * Get the command character from the user. */ c = safe_vgetc(); - LANGMAP_ADJUST(c, TRUE); + LANGMAP_ADJUST(c, get_real_state() != SELECTMODE); /* * If a mapping was started in Visual or Select mode, remember the length @@ -746,7 +731,6 @@ normal_cmd(oap, toplevel) } } -#ifdef FEAT_AUTOCMD if (c == K_CURSORHOLD) { /* Save the count values so that ca.opcount and ca.count0 are exactly @@ -754,9 +738,7 @@ normal_cmd(oap, toplevel) oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } - else -#endif - if (ca.opcount != 0) + else if (ca.opcount != 0) { /* * If we're in the middle of an operator (including after entering a @@ -817,10 +799,8 @@ normal_cmd(oap, toplevel) text_locked_msg(); goto normal_end; } -#ifdef FEAT_AUTOCMD if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked()) goto normal_end; -#endif /* * In Visual/Select mode, a few keys are handled in a special way. @@ -891,8 +871,8 @@ normal_cmd(oap, toplevel) || (nv_cmds[idx].cmd_flags & NV_NCH_ALW) == NV_NCH_ALW || (ca.cmdchar == 'q' && oap->op_type == OP_NOP - && !Recording - && !Exec_reg) + && reg_recording == 0 + && reg_executing == 0) || ((ca.cmdchar == 'a' || ca.cmdchar == 'i') && (oap->op_type != OP_NOP || VIsual_active)))) { @@ -901,17 +881,15 @@ normal_cmd(oap, toplevel) int lit = FALSE; /* get extra character literally */ int langmap_active = FALSE; /* using :lmap mappings */ int lang; /* getting a text character */ -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD int save_smd; /* saved value of p_smd */ #endif ++no_mapping; ++allow_keys; /* no mapping for nchar, but allow key codes */ -#ifdef FEAT_AUTOCMD /* Don't generate a CursorHold event here, most commands can't handle * it, e.g., nv_replace(), nv_csearch(). */ did_cursorhold = TRUE; -#endif if (ca.cmdchar == 'g') { /* @@ -966,7 +944,7 @@ normal_cmd(oap, toplevel) State = LANGMAP; langmap_active = TRUE; } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD save_smd = p_smd; p_smd = FALSE; /* Don't let the IM code show the mode here */ if (lang && curbuf->b_p_iminsert == B_IMODE_IM) @@ -982,7 +960,7 @@ normal_cmd(oap, toplevel) ++allow_keys; State = NORMAL_BUSY; } -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD if (lang) { if (curbuf->b_p_iminsert != B_IMODE_LMAP) @@ -1111,10 +1089,8 @@ normal_cmd(oap, toplevel) if (need_flushbuf) out_flush(); #endif -#ifdef FEAT_AUTOCMD if (ca.cmdchar != K_IGNORE) did_cursorhold = FALSE; -#endif State = NORMAL; @@ -1287,10 +1263,7 @@ normal_cmd(oap, toplevel) #ifdef FEAT_CMDL_INFO if (oap->op_type == OP_NOP && oap->regname == 0 -# ifdef FEAT_AUTOCMD - && ca.cmdchar != K_CURSORHOLD -# endif - ) + && ca.cmdchar != K_CURSORHOLD) clear_showcmd(); #endif @@ -1302,20 +1275,22 @@ normal_cmd(oap, toplevel) mb_adjust_cursor(); #endif -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb && toplevel) { validate_cursor(); /* may need to update w_leftcol */ do_check_scrollbind(TRUE); } -#endif -#ifdef FEAT_CURSORBIND if (curwin->w_p_crb && toplevel) { validate_cursor(); /* may need to update w_leftcol */ do_check_cursorbind(); } + +#ifdef FEAT_TERMINAL + /* don't go to Insert mode if a terminal has a running job */ + if (term_job_running(curbuf->b_term)) + restart_edit = 0; #endif /* @@ -1353,9 +1328,7 @@ normal_cmd(oap, toplevel) * Set v:prevcount only when "set_prevcount" is TRUE. */ static void -set_vcount_ca(cap, set_prevcount) - cmdarg_T *cap; - int *set_prevcount; +set_vcount_ca(cmdarg_T *cap, int *set_prevcount) { long count = cap->count0; @@ -1371,21 +1344,22 @@ set_vcount_ca(cap, set_prevcount) * Handle an operator after visual mode or when the movement is finished */ void -do_pending_operator(cap, old_col, gui_yank) - cmdarg_T *cap; - int old_col; - int gui_yank; +do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) { oparg_T *oap = cap->oap; pos_T old_cursor; int empty_region_error; int restart_edit_save; +#ifdef FEAT_LINEBREAK + int lbr_saved = curwin->w_p_lbr; +#endif /* The visual area is remembered for redo */ static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ static linenr_T redo_VIsual_line_count; /* number of lines */ static colnr_T redo_VIsual_vcol; /* number of cols or end column */ static long redo_VIsual_count; /* count for Visual operator */ + static int redo_VIsual_arg; /* extra argument */ #ifdef FEAT_VIRTUALEDIT int include_line_break = FALSE; #endif @@ -1413,6 +1387,12 @@ do_pending_operator(cap, old_col, gui_yank) */ if ((finish_op || VIsual_active) && oap->op_type != OP_NOP) { +#ifdef FEAT_LINEBREAK + /* Avoid a problem with unwanted linebreaks in block mode. */ + if (curwin->w_p_lbr) + curwin->w_valid &= ~VALID_VIRTCOL; + curwin->w_p_lbr = FALSE; +#endif oap->is_VIsual = VIsual_active; if (oap->motion_force == 'V') oap->motion_type = MLINE; @@ -1480,8 +1460,7 @@ do_pending_operator(cap, old_col, gui_yank) { AppendToRedobuffLit(repeat_cmdline, -1); AppendToRedobuff(NL_STR); - vim_free(repeat_cmdline); - repeat_cmdline = NULL; + VIM_CLEAR(repeat_cmdline); } } } @@ -1540,10 +1519,12 @@ do_pending_operator(cap, old_col, gui_yank) } /* In Select mode, a linewise selection is operated upon like a - * characterwise selection. */ - if (VIsual_select && VIsual_mode == 'V') + * characterwise selection. + * Special case: gH<Del> deletes the last line. */ + if (VIsual_select && VIsual_mode == 'V' + && cap->oap->op_type != OP_DELETE) { - if (lt(VIsual, curwin->w_cursor)) + if (LT_POS(VIsual, curwin->w_cursor)) { VIsual.col = 0; curwin->w_cursor.col = @@ -1568,14 +1549,19 @@ do_pending_operator(cap, old_col, gui_yank) oap->start = VIsual; if (VIsual_mode == 'V') + { oap->start.col = 0; +# ifdef FEAT_VIRTUALEDIT + oap->start.coladd = 0; +# endif + } } /* * Set oap->start to the first position of the operated text, oap->end * to the end of the operated text. w_cursor is equal to oap->start. */ - if (lt(oap->start, curwin->w_cursor)) + if (LT_POS(oap->start, curwin->w_cursor)) { #ifdef FEAT_FOLDING /* Include folded lines completely. */ @@ -1613,6 +1599,8 @@ do_pending_operator(cap, old_col, gui_yank) oap->start = curwin->w_cursor; } + /* Just in case lines were deleted that make the position invalid. */ + check_pos(curwin->w_buffer, &oap->end); oap->line_count = oap->end.lnum - oap->start.lnum + 1; #ifdef FEAT_VIRTUALEDIT @@ -1622,61 +1610,7 @@ do_pending_operator(cap, old_col, gui_yank) if (VIsual_active || redo_VIsual_busy) { - if (VIsual_mode == Ctrl_V) /* block mode */ - { - colnr_T start, end; - - oap->block_mode = TRUE; - - getvvcol(curwin, &(oap->start), - &oap->start_vcol, NULL, &oap->end_vcol); - if (!redo_VIsual_busy) - { - getvvcol(curwin, &(oap->end), &start, NULL, &end); - - if (start < oap->start_vcol) - oap->start_vcol = start; - if (end > oap->end_vcol) - { - if (*p_sel == 'e' && start >= 1 - && start - 1 >= oap->end_vcol) - oap->end_vcol = start - 1; - else - oap->end_vcol = end; - } - } - - /* if '$' was used, get oap->end_vcol from longest line */ - if (curwin->w_curswant == MAXCOL) - { - curwin->w_cursor.col = MAXCOL; - oap->end_vcol = 0; - for (curwin->w_cursor.lnum = oap->start.lnum; - curwin->w_cursor.lnum <= oap->end.lnum; - ++curwin->w_cursor.lnum) - { - getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &end); - if (end > oap->end_vcol) - oap->end_vcol = end; - } - } - else if (redo_VIsual_busy) - oap->end_vcol = oap->start_vcol + redo_VIsual_vcol - 1; - /* - * Correct oap->end.col and oap->start.col to be the - * upper-left and lower-right corner of the block area. - * - * (Actually, this does convert column positions into character - * positions) - */ - curwin->w_cursor.lnum = oap->end.lnum; - coladvance(oap->end_vcol); - oap->end = curwin->w_cursor; - - curwin->w_cursor = oap->start; - coladvance(oap->start_vcol); - oap->start = curwin->w_cursor; - } + get_op_vcol(oap, redo_VIsual_vcol, TRUE); if (!redo_VIsual_busy && !gui_yank) { @@ -1728,17 +1662,26 @@ do_pending_operator(cap, old_col, gui_yank) get_op_char(oap->op_type), get_extra_op_char(oap->op_type), oap->motion_force, cap->cmdchar, cap->nchar); else if (cap->cmdchar != ':') + { + int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL; + + /* reverse what nv_replace() did */ + if (nchar == REPLACE_CR_NCHAR) + nchar = CAR; + else if (nchar == REPLACE_NL_NCHAR) + nchar = NL; prep_redo(oap->regname, 0L, NUL, 'v', get_op_char(oap->op_type), get_extra_op_char(oap->op_type), - oap->op_type == OP_REPLACE - ? cap->nchar : NUL); + nchar); + } if (!redo_VIsual_busy) { redo_VIsual_mode = resel_VIsual_mode; redo_VIsual_vcol = resel_VIsual_vcol; redo_VIsual_line_count = resel_VIsual_line_count; redo_VIsual_count = cap->count0; + redo_VIsual_arg = cap->arg; } } @@ -1763,24 +1706,16 @@ do_pending_operator(cap, old_col, gui_yank) oap->inclusive = FALSE; /* Try to include the newline, unless it's an operator * that works on lines only. */ - if (*p_sel != 'o' && !op_on_lines(oap->op_type)) + if (*p_sel != 'o' + && !op_on_lines(oap->op_type) + && oap->end.lnum < curbuf->b_ml.ml_line_count) { - if (oap->end.lnum < curbuf->b_ml.ml_line_count) - { - ++oap->end.lnum; - oap->end.col = 0; + ++oap->end.lnum; + oap->end.col = 0; #ifdef FEAT_VIRTUALEDIT - oap->end.coladd = 0; + oap->end.coladd = 0; #endif - ++oap->line_count; - } - else - { - /* Cannot move below the last line, make the op - * inclusive to tell the operation to include the - * line break. */ - oap->inclusive = TRUE; - } + ++oap->line_count; } } } @@ -1801,18 +1736,19 @@ do_pending_operator(cap, old_col, gui_yank) setmouse(); mouse_dragging = 0; #endif - if (mode_displayed) - clear_cmdline = TRUE; /* unshow visual mode later */ -#ifdef FEAT_CMDL_INFO - else - clear_showcmd(); -#endif + may_clear_cmdline(); if ((oap->op_type == OP_YANK || oap->op_type == OP_COLON || oap->op_type == OP_FUNCTION || oap->op_type == OP_FILTER) && oap->motion_force == NUL) + { +#ifdef FEAT_LINEBREAK + /* make sure redrawing is correct */ + curwin->w_p_lbr = lbr_saved; +#endif redraw_curbuf_later(INVERTED); + } } } @@ -1837,7 +1773,7 @@ do_pending_operator(cap, old_col, gui_yank) && (!oap->inclusive || (oap->op_type == OP_YANK && gchar_pos(&oap->end) == NUL)) - && equalpos(oap->start, oap->end) + && EQUAL_POS(oap->start, oap->end) #ifdef FEAT_VIRTUALEDIT && !(virtual_op && oap->start.coladd != oap->end.coladd) #endif @@ -1856,7 +1792,12 @@ do_pending_operator(cap, old_col, gui_yank) || oap->op_type == OP_FOLD #endif )) + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif redraw_curbuf_later(INVERTED); + } /* * If the end of an operator is in column one while oap->motion_type @@ -1918,7 +1859,7 @@ do_pending_operator(cap, old_col, gui_yank) VIsual_reselect = FALSE; /* don't reselect now */ if (empty_region_error) { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } else @@ -1935,12 +1876,17 @@ do_pending_operator(cap, old_col, gui_yank) { if (!gui_yank) { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } } else + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif (void)op_yank(oap, FALSE, !gui_yank); + } check_cursor_col(); break; @@ -1948,7 +1894,7 @@ do_pending_operator(cap, old_col, gui_yank) VIsual_reselect = FALSE; /* don't reselect now */ if (empty_region_error) { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } else @@ -1962,6 +1908,15 @@ do_pending_operator(cap, old_col, gui_yank) else restart_edit_save = 0; restart_edit = 0; +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as + * before. */ + if (curwin->w_p_lbr != lbr_saved) + { + curwin->w_p_lbr = lbr_saved; + get_op_vcol(oap, redo_VIsual_mode, FALSE); + } +#endif /* Reset finish_op now, don't want it set inside edit(). */ finish_op = FALSE; if (op_change(oap)) /* will call edit() */ @@ -1976,6 +1931,7 @@ do_pending_operator(cap, old_col, gui_yank) AppendToRedobuff((char_u *)"!\r"); /* use any last used !cmd */ else bangredo = TRUE; /* do_bang() will put cmd in redo buffer */ + /* FALLTHROUGH */ case OP_INDENT: case OP_COLON: @@ -2013,7 +1969,7 @@ do_pending_operator(cap, old_col, gui_yank) case OP_ROT13: if (empty_region_error) { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } else @@ -2027,7 +1983,7 @@ do_pending_operator(cap, old_col, gui_yank) op_formatexpr(oap); /* use expression */ else #endif - if (*p_fp != NUL) + if (*p_fp != NUL || *curbuf->b_p_fp != NUL) op_colon(oap); /* use external command */ else op_format(oap, FALSE); /* use internal function */ @@ -2038,6 +1994,11 @@ do_pending_operator(cap, old_col, gui_yank) break; case OP_FUNCTION: +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as + * before. */ + curwin->w_p_lbr = lbr_saved; +#endif op_function(oap); /* call 'operatorfunc' */ break; @@ -2047,7 +2008,7 @@ do_pending_operator(cap, old_col, gui_yank) #ifdef FEAT_VISUALEXTRA if (empty_region_error) { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } else @@ -2057,8 +2018,20 @@ do_pending_operator(cap, old_col, gui_yank) * Visual mode. But do this only once. */ restart_edit_save = restart_edit; restart_edit = 0; - +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as + * before. */ + if (curwin->w_p_lbr != lbr_saved) + { + curwin->w_p_lbr = lbr_saved; + get_op_vcol(oap, redo_VIsual_mode, FALSE); + } +#endif op_insert(oap, cap->count1); +#ifdef FEAT_LINEBREAK + /* Reset linebreak, so that formatting works correctly. */ + curwin->w_p_lbr = FALSE; +#endif /* TODO: when inserting in several lines, should format all * the lines. */ @@ -2066,9 +2039,11 @@ do_pending_operator(cap, old_col, gui_yank) if (restart_edit == 0) restart_edit = restart_edit_save; + else + cap->retval |= CA_COMMAND_BUSY; } #else - vim_beep(); + vim_beep(BO_OPER); #endif break; @@ -2078,12 +2053,23 @@ do_pending_operator(cap, old_col, gui_yank) if (empty_region_error) #endif { - vim_beep(); + vim_beep(BO_OPER); CancelRedo(); } #ifdef FEAT_VISUALEXTRA else + { +# ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as + * before. */ + if (curwin->w_p_lbr != lbr_saved) + { + curwin->w_p_lbr = lbr_saved; + get_op_vcol(oap, redo_VIsual_mode, FALSE); + } +# endif op_replace(oap, cap->nchar); + } #endif break; @@ -2113,6 +2099,24 @@ do_pending_operator(cap, old_col, gui_yank) oap->op_type == OP_FOLDDELREC, oap->is_VIsual); break; #endif + case OP_NR_ADD: + case OP_NR_SUB: + if (empty_region_error) + { + vim_beep(BO_OPER); + CancelRedo(); + } + else + { + VIsual_active = TRUE; +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif + op_addsub(oap, cap->count1, redo_VIsual_arg); + VIsual_active = FALSE; + } + check_cursor_col(); + break; default: clearopbeep(oap); } @@ -2127,7 +2131,12 @@ do_pending_operator(cap, old_col, gui_yank) if (!p_sol && oap->motion_type == MLINE && !oap->end_adjusted && (oap->op_type == OP_LSHIFT || oap->op_type == OP_RSHIFT || oap->op_type == OP_DELETE)) + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = FALSE; +#endif coladvance(curwin->w_curswant = old_col); + } } else { @@ -2136,14 +2145,16 @@ do_pending_operator(cap, old_col, gui_yank) oap->block_mode = FALSE; clearop(oap); } +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif } /* * Handle indent and format operators and visual mode ":". */ static void -op_colon(oap) - oparg_T *oap; +op_colon(oparg_T *oap) { stuffcharReadbuff(':'); if (oap->is_VIsual) @@ -2187,10 +2198,12 @@ op_colon(oap) } else if (oap->op_type == OP_FORMAT) { - if (*p_fp == NUL) - stuffReadbuff((char_u *)"fmt"); - else + if (*curbuf->b_p_fp != NUL) + stuffReadbuff(curbuf->b_p_fp); + else if (*p_fp != NUL) stuffReadbuff(p_fp); + else + stuffReadbuff((char_u *)"fmt"); stuffReadbuff((char_u *)"\n']"); } @@ -2203,11 +2216,10 @@ op_colon(oap) * Handle the "g@" operator: call 'operatorfunc'. */ static void -op_function(oap) - oparg_T *oap UNUSED; +op_function(oparg_T *oap UNUSED) { #ifdef FEAT_EVAL - char_u *(argv[1]); + typval_T argv[2]; # ifdef FEAT_VIRTUALEDIT int save_virtual_op = virtual_op; # endif @@ -2223,12 +2235,14 @@ op_function(oap) /* Exclude the end position. */ decl(&curbuf->b_op_end); + argv[0].v_type = VAR_STRING; if (oap->block_mode) - argv[0] = (char_u *)"block"; + argv[0].vval.v_string = (char_u *)"block"; else if (oap->motion_type == MLINE) - argv[0] = (char_u *)"line"; + argv[0].vval.v_string = (char_u *)"line"; else - argv[0] = (char_u *)"char"; + argv[0].vval.v_string = (char_u *)"char"; + argv[1].v_type = VAR_UNKNOWN; # ifdef FEAT_VIRTUALEDIT /* Reset virtual_op so that 'virtualedit' can be changed in the @@ -2252,12 +2266,12 @@ op_function(oap) * Do the appropriate action for the current mouse click in the current mode. * Not used for Command-line mode. * - * Normal Mode: + * Normal and Visual Mode: * event modi- position visual change action * fier cursor window * left press - yes end yes * left press C yes end yes "^]" (2) - * left press S yes end yes "*" (2) + * left press S yes end (popup: extend) yes "*" (2) * left drag - yes start if moved no * left relse - yes start if moved no * middle press - yes if not active no put register @@ -2285,12 +2299,12 @@ op_function(oap) * Return TRUE if start_arrow() should be called for edit mode. */ int -do_mouse(oap, c, dir, count, fixindent) - oparg_T *oap; /* operator argument, can be NULL */ - int c; /* K_LEFTMOUSE, etc */ - int dir; /* Direction to 'put' if necessary */ - long count; - int fixindent; /* PUT_FIXINDENT if fixing indent necessary */ +do_mouse( + oparg_T *oap, /* operator argument, can be NULL */ + int c, /* K_LEFTMOUSE, etc */ + int dir, /* Direction to 'put' if necessary */ + long count, + int fixindent) /* PUT_FIXINDENT if fixing indent necessary */ { static int do_always = FALSE; /* ignore 'mouse' setting next time */ static int got_click = FALSE; /* got a click some time back */ @@ -2302,12 +2316,8 @@ do_mouse(oap, c, dir, count, fixindent) pos_T start_visual; int moved; /* Has cursor moved? */ int in_status_line; /* mouse in status line */ -#ifdef FEAT_WINDOWS static int in_tab_line = FALSE; /* mouse clicked in tab line */ -#endif -#ifdef FEAT_VERTSPLIT int in_sep_line; /* mouse in vertical separator line */ -#endif int c1, c2; #if defined(FEAT_FOLDING) pos_T save_cursor; @@ -2374,6 +2384,20 @@ do_mouse(oap, c, dir, count, fixindent) break; } + if (c == K_MOUSEMOVE) + { + /* Mouse moved without a button pressed. */ +#ifdef FEAT_BEVAL_TERM + ui_may_remove_balloon(); + if (p_bevalterm && !VIsual_active) + { + profile_setlimit(p_bdlay, &bevalexpr_due); + bevalexpr_due_set = TRUE; + } +#endif + return FALSE; + } + #ifdef FEAT_MOUSESHAPE /* May have stopped dragging the status or separator line. The pointer is * most likely still on the status or separator line. */ @@ -2382,13 +2406,11 @@ do_mouse(oap, c, dir, count, fixindent) drag_status_line = FALSE; update_mouseshape(SHAPE_IDX_STATUS); } -# ifdef FEAT_VERTSPLIT if (!is_drag && drag_sep_line) { drag_sep_line = FALSE; update_mouseshape(SHAPE_IDX_VSEP); } -# endif #endif /* @@ -2403,13 +2425,11 @@ do_mouse(oap, c, dir, count, fixindent) if (!is_drag) /* release, reset got_click */ { got_click = FALSE; -#ifdef FEAT_WINDOWS if (in_tab_line) { in_tab_line = FALSE; return FALSE; } -#endif } } @@ -2549,7 +2569,6 @@ do_mouse(oap, c, dir, count, fixindent) start_visual.lnum = 0; -#ifdef FEAT_WINDOWS /* Check for clicking in the tab page line. */ if (mouse_row == 0 && firstwin->w_winrow > 0) { @@ -2558,7 +2577,8 @@ do_mouse(oap, c, dir, count, fixindent) if (in_tab_line) { c1 = TabPageIdxs[mouse_col]; - tabpage_move(c1 <= 0 ? 9999 : c1 - 1); + tabpage_move(c1 <= 0 ? 9999 : c1 < tabpage_index(curtab) + ? c1 - 1 : c1); } return FALSE; } @@ -2592,7 +2612,7 @@ do_mouse(oap, c, dir, count, fixindent) end_visual_mode(); } } - else if (c1 < 0) + else { tabpage_T *tp; @@ -2619,8 +2639,6 @@ do_mouse(oap, c, dir, count, fixindent) return FALSE; } -#endif - /* * When 'mousemodel' is "popup" or "popup_setpos", translate mouse events: * right button up -> pop-up menu @@ -2632,84 +2650,95 @@ do_mouse(oap, c, dir, count, fixindent) if (which_button == MOUSE_RIGHT && !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) { - /* - * NOTE: Ignore right button down and drag mouse events. - * Windows only shows the popup menu on the button up event. - */ -#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) \ - || defined(FEAT_GUI_MACVIM) - if (!is_click) - return FALSE; -#endif -#if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) - if (is_click || is_drag) - return FALSE; -#endif #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_TERM_POPUP_MENU) \ || defined(FEAT_GUI_MACVIM) +# ifdef FEAT_GUI if (gui.in_use) { - jump_flags = 0; - if (STRCMP(p_mousem, "popup_setpos") == 0) +# if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) + if (!is_click) + /* Ignore right button release events, only shows the popup + * menu on the button down event. */ + return FALSE; +# endif +# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) + if (is_click || is_drag) + /* Ignore right button down and drag mouse events. Windows + * only shows the popup menu on the button up event. */ + return FALSE; +# endif + } +# endif +# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) + else +# endif +# if defined(FEAT_TERM_POPUP_MENU) + if (!is_click) + /* Ignore right button release events, only shows the popup + * menu on the button down event. */ + return FALSE; +#endif + + jump_flags = 0; + if (STRCMP(p_mousem, "popup_setpos") == 0) + { + /* First set the cursor position before showing the popup + * menu. */ + if (VIsual_active) { - /* First set the cursor position before showing the popup - * menu. */ - if (VIsual_active) + pos_T m_pos; + + /* + * set MOUSE_MAY_STOP_VIS if we are outside the + * selection or the current window (might have false + * negative here) + */ + if (mouse_row < curwin->w_winrow + || mouse_row + > (curwin->w_winrow + curwin->w_height)) + jump_flags = MOUSE_MAY_STOP_VIS; + else if (get_fpos_of_mouse(&m_pos) != IN_BUFFER) + jump_flags = MOUSE_MAY_STOP_VIS; + else { - pos_T m_pos; - - /* - * set MOUSE_MAY_STOP_VIS if we are outside the - * selection or the current window (might have false - * negative here) - */ - if (mouse_row < W_WINROW(curwin) - || mouse_row - > (W_WINROW(curwin) + curwin->w_height)) - jump_flags = MOUSE_MAY_STOP_VIS; - else if (get_fpos_of_mouse(&m_pos) != IN_BUFFER) + if ((LT_POS(curwin->w_cursor, VIsual) + && (LT_POS(m_pos, curwin->w_cursor) + || LT_POS(VIsual, m_pos))) + || (LT_POS(VIsual, curwin->w_cursor) + && (LT_POS(m_pos, VIsual) + || LT_POS(curwin->w_cursor, m_pos)))) + { jump_flags = MOUSE_MAY_STOP_VIS; - else + } + else if (VIsual_mode == Ctrl_V) { - if ((lt(curwin->w_cursor, VIsual) - && (lt(m_pos, curwin->w_cursor) - || lt(VIsual, m_pos))) - || (lt(VIsual, curwin->w_cursor) - && (lt(m_pos, VIsual) - || lt(curwin->w_cursor, m_pos)))) - { + getvcols(curwin, &curwin->w_cursor, &VIsual, + &leftcol, &rightcol); + getvcol(curwin, &m_pos, NULL, &m_pos.col, NULL); + if (m_pos.col < leftcol || m_pos.col > rightcol) jump_flags = MOUSE_MAY_STOP_VIS; - } - else if (VIsual_mode == Ctrl_V) - { - getvcols(curwin, &curwin->w_cursor, &VIsual, - &leftcol, &rightcol); - getvcol(curwin, &m_pos, NULL, &m_pos.col, NULL); - if (m_pos.col < leftcol || m_pos.col > rightcol) - jump_flags = MOUSE_MAY_STOP_VIS; - } } } - else - jump_flags = MOUSE_MAY_STOP_VIS; - } - if (jump_flags) - { - jump_flags = jump_to_mouse(jump_flags, NULL, which_button); - update_curbuf(VIsual_active ? INVERTED : VALID); - setcursor(); - out_flush(); /* Update before showing popup menu */ } + else + jump_flags = MOUSE_MAY_STOP_VIS; + } + if (jump_flags) + { + jump_flags = jump_to_mouse(jump_flags, NULL, which_button); + update_curbuf(VIsual_active ? INVERTED : VALID); + setcursor(); + out_flush(); /* Update before showing popup menu */ + } # ifdef FEAT_MENU - gui_show_popupmenu(); + show_popupmenu(); + got_click = FALSE; /* ignore release events */ # endif - return (jump_flags & CURSOR_MOVED) != 0; - } - else - return FALSE; + return (jump_flags & CURSOR_MOVED) != 0; #else return FALSE; #endif @@ -2745,7 +2774,7 @@ do_mouse(oap, c, dir, count, fixindent) * Remember the start and end of visual before moving the * cursor. */ - if (lt(curwin->w_cursor, VIsual)) + if (LT_POS(curwin->w_cursor, VIsual)) { start_visual = curwin->w_cursor; end_visual = VIsual; @@ -2781,11 +2810,15 @@ do_mouse(oap, c, dir, count, fixindent) */ jump_flags = jump_to_mouse(jump_flags, oap == NULL ? NULL : &(oap->inclusive), which_button); + +#ifdef FEAT_MENU + /* A click in the window toolbar has no side effects. */ + if (jump_flags & MOUSE_WINBAR) + return FALSE; +#endif moved = (jump_flags & CURSOR_MOVED); in_status_line = (jump_flags & IN_STATUS_LINE); -#ifdef FEAT_VERTSPLIT in_sep_line = (jump_flags & IN_SEP_LINE); -#endif #ifdef FEAT_NETBEANS_INTG if (isNetbeansBuffer(curbuf) @@ -2864,10 +2897,8 @@ do_mouse(oap, c, dir, count, fixindent) end_visual.col = leftcol; else end_visual.col = rightcol; - if (curwin->w_cursor.lnum < + if (curwin->w_cursor.lnum >= (start_visual.lnum + end_visual.lnum) / 2) - end_visual.lnum = end_visual.lnum; - else end_visual.lnum = start_visual.lnum; /* move VIsual to the right column */ @@ -2884,9 +2915,9 @@ do_mouse(oap, c, dir, count, fixindent) * If the click is after the end of visual, change the end. If * the click is inside the visual, change the closest side. */ - if (lt(curwin->w_cursor, start_visual)) + if (LT_POS(curwin->w_cursor, start_visual)) VIsual = end_visual; - else if (lt(end_visual, curwin->w_cursor)) + else if (LT_POS(end_visual, curwin->w_cursor)) VIsual = start_visual; else { @@ -2966,7 +2997,7 @@ do_mouse(oap, c, dir, count, fixindent) do_put(regname, dir, count, fixindent | PUT_CURSEND); } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* * Ctrl-Mouse click or double click in a quickfix window jumps to the * error under the mouse pointer. @@ -2975,12 +3006,10 @@ do_mouse(oap, c, dir, count, fixindent) || (mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) && bt_quickfix(curbuf)) { - if (State & INSERT) - stuffcharReadbuff(Ctrl_O); if (curwin->w_llist_ref == NULL) /* quickfix window */ - stuffReadbuff((char_u *)":.cc\n"); + do_cmdline_cmd((char_u *)".cc"); else /* location list window */ - stuffReadbuff((char_u *)":.ll\n"); + do_cmdline_cmd((char_u *)".ll"); got_click = FALSE; /* ignore drag&release now */ } #endif @@ -3023,18 +3052,16 @@ do_mouse(oap, c, dir, count, fixindent) } #endif } -#ifdef FEAT_VERTSPLIT else if (in_sep_line) { -# ifdef FEAT_MOUSESHAPE +#ifdef FEAT_MOUSESHAPE if ((is_drag || is_click) && !drag_sep_line) { drag_sep_line = TRUE; update_mouseshape(-1); } -# endif - } #endif + } else if ((mod_mask & MOD_MASK_MULTI_CLICK) && (State & (NORMAL | INSERT)) && mouse_has(MOUSE_VISUAL)) { @@ -3085,14 +3112,14 @@ do_mouse(oap, c, dir, count, fixindent) * not a word character, try finding a match and select a (), * {}, [], #if/#endif, etc. block. */ end_visual = curwin->w_cursor; - while (gc = gchar_pos(&end_visual), vim_iswhite(gc)) + while (gc = gchar_pos(&end_visual), VIM_ISWHITE(gc)) inc(&end_visual); if (oap != NULL) oap->motion_type = MCHAR; if (oap != NULL && VIsual_mode == 'v' && !vim_iswordc(gchar_pos(&end_visual)) - && equalpos(curwin->w_cursor, VIsual) + && EQUAL_POS(curwin->w_cursor, VIsual) && (pos = findmatch(oap, NUL)) != NULL) { curwin->w_cursor = *pos; @@ -3100,7 +3127,7 @@ do_mouse(oap, c, dir, count, fixindent) VIsual_mode = 'V'; else if (*p_sel == 'e') { - if (lt(curwin->w_cursor, VIsual)) + if (LT_POS(curwin->w_cursor, VIsual)) ++VIsual.col; else ++curwin->w_cursor.col; @@ -3112,7 +3139,7 @@ do_mouse(oap, c, dir, count, fixindent) { /* When not found a match or when dragging: extend to include * a word. */ - if (lt(curwin->w_cursor, orig_cursor)) + if (LT_POS(curwin->w_cursor, orig_cursor)) { find_start_of_word(&curwin->w_cursor); find_end_of_word(&VIsual); @@ -3156,8 +3183,7 @@ do_mouse(oap, c, dir, count, fixindent) * Move "pos" back to the start of the word it's in. */ static void -find_start_of_word(pos) - pos_T *pos; +find_start_of_word(pos_T *pos) { char_u *line; int cclass; @@ -3183,8 +3209,7 @@ find_start_of_word(pos) * When 'selection' is "exclusive", the position is just after the word. */ static void -find_end_of_word(pos) - pos_T *pos; +find_end_of_word(pos_T *pos) { char_u *line; int cclass; @@ -3224,8 +3249,7 @@ find_end_of_word(pos) * >2: multi-byte word character. */ static int -get_mouse_class(p) - char_u *p; +get_mouse_class(char_u *p) { int c; @@ -3258,13 +3282,13 @@ get_mouse_class(p) * if not. */ void -check_visual_highlight() +check_visual_highlight(void) { static int did_check = FALSE; if (full_screen) { - if (!did_check && hl_attr(HLF_V) == 0) + if (!did_check && HL_ATTR(HLF_V) == 0) MSG(_("Warning: terminal cannot highlight")); did_check = TRUE; } @@ -3276,7 +3300,7 @@ check_visual_highlight() * do_pending_operator(). */ void -end_visual_mode() +end_visual_mode(void) { #ifdef FEAT_CLIPBOARD /* @@ -3307,13 +3331,7 @@ end_visual_mode() if (!virtual_active()) curwin->w_cursor.coladd = 0; #endif - - if (mode_displayed) - clear_cmdline = TRUE; /* unshow visual mode later */ -#ifdef FEAT_CMDL_INFO - else - clear_showcmd(); -#endif + may_clear_cmdline(); adjust_cursor_eol(); } @@ -3322,7 +3340,7 @@ end_visual_mode() * Reset VIsual_active and VIsual_reselect. */ void -reset_VIsual_and_resel() +reset_VIsual_and_resel(void) { if (VIsual_active) { @@ -3336,7 +3354,7 @@ reset_VIsual_and_resel() * Reset VIsual_active and VIsual_reselect if it's set. */ void -reset_VIsual() +reset_VIsual(void) { if (VIsual_active) { @@ -3346,9 +3364,6 @@ reset_VIsual() } } -#if defined(FEAT_BEVAL) -static int find_is_eval_item __ARGS((char_u *ptr, int *colp, int *nbp, int dir)); - /* * Check for a balloon-eval special item to include when searching for an * identifier. When "dir" is BACKWARD "ptr[-1]" must be valid! @@ -3358,11 +3373,11 @@ static int find_is_eval_item __ARGS((char_u *ptr, int *colp, int *nbp, int dir)) * "bnp" points to a counter for square brackets. */ static int -find_is_eval_item(ptr, colp, bnp, dir) - char_u *ptr; - int *colp; - int *bnp; - int dir; +find_is_eval_item( + char_u *ptr, + int *colp, + int *bnp, + int dir) { /* Accept everything inside []. */ if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD)) @@ -3387,7 +3402,6 @@ find_is_eval_item(ptr, colp, bnp, dir) } return FALSE; } -#endif /* * Find the identifier under or to the right of the cursor. @@ -3411,9 +3425,7 @@ find_is_eval_item(ptr, colp, bnp, dir) * string is not always NUL terminated. */ int -find_ident_under_cursor(string, find_type) - char_u **string; - int find_type; +find_ident_under_cursor(char_u **string, int find_type) { return find_ident_at_pos(curwin, curwin->w_cursor.lnum, curwin->w_cursor.col, string, find_type); @@ -3424,12 +3436,12 @@ find_ident_under_cursor(string, find_type) * However: Uses 'iskeyword' from the current window!. */ int -find_ident_at_pos(wp, lnum, startcol, string, find_type) - win_T *wp; - linenr_T lnum; - colnr_T startcol; - char_u **string; - int find_type; +find_ident_at_pos( + win_T *wp, + linenr_T lnum, + colnr_T startcol, + char_u **string, + int find_type) { char_u *ptr; int col = 0; /* init to shut up GCC */ @@ -3439,9 +3451,7 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) int prev_class; int prevcol; #endif -#if defined(FEAT_BEVAL) int bn = 0; /* bracket nesting */ -#endif /* * if i == 0: try to find an identifier @@ -3459,11 +3469,9 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) { while (ptr[col] != NUL) { -# if defined(FEAT_BEVAL) /* Stop at a ']' to evaluate "a[x]". */ if ((find_type & FIND_EVAL) && ptr[col] == ']') break; -# endif this_class = mb_get_class(ptr + col); if (this_class != 0 && (i == 1 || this_class != 1)) break; @@ -3473,17 +3481,13 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) else #endif while (ptr[col] != NUL - && (i == 0 ? !vim_iswordc(ptr[col]) : vim_iswhite(ptr[col])) -# if defined(FEAT_BEVAL) + && (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col])) && (!(find_type & FIND_EVAL) || ptr[col] != ']') -# endif ) ++col; -#if defined(FEAT_BEVAL) /* When starting on a ']' count it, so that we include the '['. */ bn = ptr[col] == ']'; -#endif /* * 2. Back up to start of identifier/string. @@ -3492,11 +3496,9 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) if (has_mbyte) { /* Remember class of character under cursor. */ -# if defined(FEAT_BEVAL) if ((find_type & FIND_EVAL) && ptr[col] == ']') this_class = mb_get_class((char_u *)"a"); else -# endif this_class = mb_get_class(ptr + col); while (col > 0 && this_class != 0) { @@ -3506,12 +3508,10 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) && (i == 0 || prev_class == 0 || (find_type & FIND_IDENT)) -# if defined(FEAT_BEVAL) && (!(find_type & FIND_EVAL) || prevcol == 0 || !find_is_eval_item(ptr + prevcol, &prevcol, &bn, BACKWARD)) -# endif ) break; col = prevcol; @@ -3530,15 +3530,13 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) while (col > 0 && ((i == 0 ? vim_iswordc(ptr[col - 1]) - : (!vim_iswhite(ptr[col - 1]) + : (!VIM_ISWHITE(ptr[col - 1]) && (!(find_type & FIND_IDENT) || !vim_iswordc(ptr[col - 1])))) -#if defined(FEAT_BEVAL) || ((find_type & FIND_EVAL) && col > 1 && find_is_eval_item(ptr + col - 1, &col, &bn, BACKWARD)) -#endif )) --col; @@ -3570,10 +3568,8 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) /* * 3. Find the end if the identifier/string. */ -#if defined(FEAT_BEVAL) bn = 0; startcol -= col; -#endif col = 0; #ifdef FEAT_MBYTE if (has_mbyte) @@ -3583,23 +3579,19 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) while (ptr[col] != NUL && ((i == 0 ? mb_get_class(ptr + col) == this_class : mb_get_class(ptr + col) != 0) -# if defined(FEAT_BEVAL) || ((find_type & FIND_EVAL) && col <= (int)startcol && find_is_eval_item(ptr + col, &col, &bn, FORWARD)) -# endif )) col += (*mb_ptr2len)(ptr + col); } else #endif while ((i == 0 ? vim_iswordc(ptr[col]) - : (ptr[col] != NUL && !vim_iswhite(ptr[col]))) -# if defined(FEAT_BEVAL) + : (ptr[col] != NUL && !VIM_ISWHITE(ptr[col]))) || ((find_type & FIND_EVAL) && col <= (int)startcol && find_is_eval_item(ptr + col, &col, &bn, FORWARD)) -# endif ) { ++col; @@ -3612,8 +3604,7 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type) * Prepare for redo of a normal command. */ static void -prep_redo_cmd(cap) - cmdarg_T *cap; +prep_redo_cmd(cmdarg_T *cap) { prep_redo(cap->oap->regname, cap->count0, NUL, cap->cmdchar, NUL, NUL, cap->nchar); @@ -3624,14 +3615,14 @@ prep_redo_cmd(cap) * Note that only the last argument can be a multi-byte char. */ static void -prep_redo(regname, num, cmd1, cmd2, cmd3, cmd4, cmd5) - int regname; - long num; - int cmd1; - int cmd2; - int cmd3; - int cmd4; - int cmd5; +prep_redo( + int regname, + long num, + int cmd1, + int cmd2, + int cmd3, + int cmd4, + int cmd5) { ResetRedobuff(); if (regname != 0) /* yank from specified buffer */ @@ -3660,8 +3651,7 @@ prep_redo(regname, num, cmd1, cmd2, cmd3, cmd4, cmd5) * return TRUE if operator was active */ static int -checkclearop(oap) - oparg_T *oap; +checkclearop(oparg_T *oap) { if (oap->op_type == OP_NOP) return FALSE; @@ -3675,8 +3665,7 @@ checkclearop(oap) * Return TRUE if operator or Visual was active. */ static int -checkclearopq(oap) - oparg_T *oap; +checkclearopq(oparg_T *oap) { if (oap->op_type == OP_NOP && !VIsual_active) return FALSE; @@ -3685,8 +3674,7 @@ checkclearopq(oap) } static void -clearop(oap) - oparg_T *oap; +clearop(oparg_T *oap) { oap->op_type = OP_NOP; oap->regname = 0; @@ -3695,8 +3683,7 @@ clearop(oap) } static void -clearopbeep(oap) - oparg_T *oap; +clearopbeep(oparg_T *oap) { clearop(oap); beep_flush(); @@ -3706,8 +3693,7 @@ clearopbeep(oap) * Remove the shift modifier from a special key. */ static void -unshift_special(cap) - cmdarg_T *cap; +unshift_special(cmdarg_T *cap) { switch (cap->cmdchar) { @@ -3721,6 +3707,21 @@ unshift_special(cap) cap->cmdchar = simplify_key(cap->cmdchar, &mod_mask); } +/* + * If the mode is currently displayed clear the command line or update the + * command displayed. + */ + static void +may_clear_cmdline(void) +{ + if (mode_displayed) + clear_cmdline = TRUE; /* unshow visual mode later */ +#ifdef FEAT_CMDL_INFO + else + clear_showcmd(); +#endif +} + #if defined(FEAT_CMDL_INFO) || defined(PROTO) /* * Routines for displaying a partly typed command @@ -3732,17 +3733,17 @@ static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; /* For push_showcmd() */ static int showcmd_is_clear = TRUE; static int showcmd_visual = FALSE; -static void display_showcmd __ARGS((void)); +static void display_showcmd(void); void -clear_showcmd() +clear_showcmd(void) { if (!p_sc) return; if (VIsual_active && !char_avail()) { - int cursor_bot = lt(VIsual, curwin->w_cursor); + int cursor_bot = LT_POS(VIsual, curwin->w_cursor); long lines; colnr_T leftcol, rightcol; linenr_T top, bot; @@ -3760,8 +3761,8 @@ clear_showcmd() } # ifdef FEAT_FOLDING /* Include closed folds as a whole. */ - hasFolding(top, &top, NULL); - hasFolding(bot, NULL, &bot); + (void)hasFolding(top, &top, NULL); + (void)hasFolding(bot, NULL, &bot); # endif lines = bot - top + 1; @@ -3842,8 +3843,7 @@ clear_showcmd() * Return TRUE if output has been written (and setcursor() has been called). */ int -add_to_showcmd(c) - int c; +add_to_showcmd(int c) { char_u *p; int old_len; @@ -3857,8 +3857,8 @@ add_to_showcmd(c) K_VER_SCROLLBAR, K_HOR_SCROLLBAR, K_LEFTMOUSE_NM, K_LEFTRELEASE_NM, # endif - K_IGNORE, - K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, + K_IGNORE, K_PS, + K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE, K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE, K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE, K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT, @@ -3908,8 +3908,7 @@ add_to_showcmd(c) } void -add_to_showcmd_c(c) - int c; +add_to_showcmd_c(int c) { if (!add_to_showcmd(c)) setcursor(); @@ -3919,8 +3918,7 @@ add_to_showcmd_c(c) * Delete 'len' characters from the end of the shown command. */ static void -del_from_showcmd(len) - int len; +del_from_showcmd(int len) { int old_len; @@ -3941,14 +3939,14 @@ del_from_showcmd(len) * something and there is a partial mapping. */ void -push_showcmd() +push_showcmd(void) { if (p_sc) STRCPY(old_showcmd_buf, showcmd_buf); } void -pop_showcmd() +pop_showcmd(void) { if (!p_sc) return; @@ -3959,7 +3957,7 @@ pop_showcmd() } static void -display_showcmd() +display_showcmd(void) { int len; @@ -3984,15 +3982,13 @@ display_showcmd() } #endif -#ifdef FEAT_SCROLLBIND /* * When "check" is FALSE, prepare for commands that scroll the window. * When "check" is TRUE, take care of scroll-binding after the window has * scrolled. Called from normal_cmd() and edit(). */ void -do_check_scrollbind(check) - int check; +do_check_scrollbind(int check) { static win_T *old_curwin = NULL; static linenr_T old_topline = 0; @@ -4062,9 +4058,7 @@ do_check_scrollbind(check) * (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>) */ void -check_scrollbind(topline_diff, leftcol_diff) - linenr_T topline_diff; - long leftcol_diff; +check_scrollbind(linenr_T topline_diff, long leftcol_diff) { int want_ver; int want_hor; @@ -4089,7 +4083,7 @@ check_scrollbind(topline_diff, leftcol_diff) * loop through the scrollbound windows and scroll accordingly */ VIsual_select = VIsual_active = 0; - for (curwin = firstwin; curwin; curwin = curwin->w_next) + FOR_ALL_WINDOWS(curwin) { curbuf = curwin->w_buffer; /* skip original window and windows with 'noscrollbind' */ @@ -4124,9 +4118,7 @@ check_scrollbind(topline_diff, leftcol_diff) redraw_later(VALID); cursor_correct(); -#ifdef FEAT_WINDOWS curwin->w_redr_status = TRUE; -#endif } /* @@ -4148,7 +4140,6 @@ check_scrollbind(topline_diff, leftcol_diff) curwin = old_curwin; curbuf = old_curbuf; } -#endif /* #ifdef FEAT_SCROLLBIND */ /* * Command character that's ignored. @@ -4156,8 +4147,7 @@ check_scrollbind(topline_diff, leftcol_diff) * xon/xoff. */ static void -nv_ignore(cap) - cmdarg_T *cap; +nv_ignore(cmdarg_T *cap) { cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } @@ -4167,8 +4157,7 @@ nv_ignore(cap) * start edit(). Used for "startinsert" executed while starting up. */ static void -nv_nop(cap) - cmdarg_T *cap UNUSED; +nv_nop(cmdarg_T *cap UNUSED) { } @@ -4176,8 +4165,7 @@ nv_nop(cap) * Command character doesn't exist. */ static void -nv_error(cap) - cmdarg_T *cap; +nv_error(cmdarg_T *cap) { clearopbeep(cap->oap); } @@ -4186,8 +4174,7 @@ nv_error(cap) * <Help> and <F1> commands. */ static void -nv_help(cap) - cmdarg_T *cap; +nv_help(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) ex_help(NULL); @@ -4197,24 +4184,34 @@ nv_help(cap) * CTRL-A and CTRL-X: Add or subtract from letter or number under cursor. */ static void -nv_addsub(cap) - cmdarg_T *cap; +nv_addsub(cmdarg_T *cap) { - if (!checkclearopq(cap->oap) - && do_addsub((int)cap->cmdchar, cap->count1) == OK) +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && !prompt_curpos_editable()) + clearopbeep(cap->oap); + else +#endif + if (!VIsual_active && cap->oap->op_type == OP_NOP) + { prep_redo_cmd(cap); + cap->oap->op_type = cap->cmdchar == Ctrl_A ? OP_NR_ADD : OP_NR_SUB; + op_addsub(cap->oap, cap->count1, cap->arg); + cap->oap->op_type = OP_NOP; + } + else if (VIsual_active) + nv_operator(cap); + else + clearop(cap->oap); } /* * CTRL-F, CTRL-B, etc: Scroll page up or down. */ static void -nv_page(cap) - cmdarg_T *cap; +nv_page(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { -#ifdef FEAT_WINDOWS if (mod_mask & MOD_MASK_CTRL) { /* <C-PageUp>: tab page back; <C-PageDown>: tab page forward */ @@ -4224,8 +4221,7 @@ nv_page(cap) goto_tabpage((int)cap->count0); } else -#endif - (void)onepage(cap->arg, cap->count1); + (void)onepage(cap->arg, cap->count1); } } @@ -4233,16 +4229,17 @@ nv_page(cap) * Implementation of "gd" and "gD" command. */ static void -nv_gd(oap, nchar, thisblock) - oparg_T *oap; - int nchar; - int thisblock; /* 1 for "1gd" and "1gD" */ +nv_gd( + oparg_T *oap, + int nchar, + int thisblock) /* 1 for "1gd" and "1gD" */ { int len; char_u *ptr; if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0 - || find_decl(ptr, len, nchar == 'd', thisblock, 0) == FAIL) + || find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START) + == FAIL) clearopbeep(oap); #ifdef FEAT_FOLDING else if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP) @@ -4250,6 +4247,52 @@ nv_gd(oap, nchar, thisblock) #endif } +/* + * Return TRUE if line[offset] is not inside a C-style comment or string, FALSE + * otherwise. + */ + static int +is_ident(char_u *line, int offset) +{ + int i; + int incomment = FALSE; + int instring = 0; + int prev = 0; + + for (i = 0; i < offset && line[i] != NUL; i++) + { + if (instring != 0) + { + if (prev != '\\' && line[i] == instring) + instring = 0; + } + else if ((line[i] == '"' || line[i] == '\'') && !incomment) + { + instring = line[i]; + } + else + { + if (incomment) + { + if (prev == '*' && line[i] == '/') + incomment = FALSE; + } + else if (prev == '/' && line[i] == '*') + { + incomment = TRUE; + } + else if (prev == '/' && line[i] == '/') + { + return FALSE; + } + } + + prev = line[i]; + } + + return incomment == FALSE && instring == 0; +} + /* * Search for variable declaration of "ptr[len]". * When "locally" is TRUE in the current function ("gd"), otherwise in the @@ -4258,12 +4301,12 @@ nv_gd(oap, nchar, thisblock) * Return FAIL when not found. */ int -find_decl(ptr, len, locally, thisblock, searchflags) - char_u *ptr; - int len; - int locally; - int thisblock; - int searchflags; /* flags passed to searchit() */ +find_decl( + char_u *ptr, + int len, + int locally, + int thisblock, + int flags_arg) /* flags passed to searchit() */ { char_u *pat; pos_T old_pos; @@ -4274,6 +4317,8 @@ find_decl(ptr, len, locally, thisblock, searchflags) int save_p_scs; int retval = OK; int incll; + int searchflags = flags_arg; + int valid; if ((pat = alloc(len + 7)) == NULL) return FAIL; @@ -4308,11 +4353,12 @@ find_decl(ptr, len, locally, thisblock, searchflags) curwin->w_cursor.col = 0; /* Search forward for the identifier, ignore comment lines. */ - clearpos(&found_pos); + CLEAR_POS(&found_pos); for (;;) { + valid = FALSE; t = searchit(curwin, curbuf, &curwin->w_cursor, FORWARD, - pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL); + pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL, NULL); if (curwin->w_cursor.lnum >= old_pos.lnum) t = FAIL; /* match after start is failure too */ @@ -4325,7 +4371,12 @@ find_decl(ptr, len, locally, thisblock, searchflags) if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL && pos->lnum < old_pos.lnum) + { + /* There can't be a useful match before the end of this block. + * Skip to the end. */ + curwin->w_cursor = *pos; continue; + } } if (t == FAIL) @@ -4347,9 +4398,20 @@ find_decl(ptr, len, locally, thisblock, searchflags) continue; } #endif - if (!locally) /* global search: use first match found */ + valid = is_ident(ml_get_curline(), curwin->w_cursor.col); + + /* If the current position is not a valid identifier and a previous + * match is present, favor that one instead. */ + if (!valid && found_pos.lnum != 0) + { + curwin->w_cursor = found_pos; + break; + } + + /* Global search: use first valid match found */ + if (valid && !locally) break; - if (curwin->w_cursor.lnum >= par_pos.lnum) + if (valid && curwin->w_cursor.lnum >= par_pos.lnum) { /* If we previously found a valid position, use it. */ if (found_pos.lnum != 0) @@ -4357,10 +4419,18 @@ find_decl(ptr, len, locally, thisblock, searchflags) break; } - /* For finding a local variable and the match is before the "{" search - * to find a later match. For K&R style function declarations this - * skips the function header without types. */ - found_pos = curwin->w_cursor; + /* For finding a local variable and the match is before the "{" or + * inside a comment, continue searching. For K&R style function + * declarations this skips the function header without types. */ + if (!valid) + { + CLEAR_POS(&found_pos); + } + else + found_pos = curwin->w_cursor; + /* Remove SEARCH_START from flags to avoid getting stuck at one + * position. */ + searchflags &= ~SEARCH_START; } if (t == FAIL) @@ -4390,10 +4460,7 @@ find_decl(ptr, len, locally, thisblock, searchflags) * Return OK if able to move cursor, FAIL otherwise. */ static int -nv_screengo(oap, dir, dist) - oparg_T *oap; - int dir; - long dist; +nv_screengo(oparg_T *oap, int dir, long dist) { int linelen = linetabsize(ml_get_curline()); int retval = OK; @@ -4409,13 +4476,13 @@ nv_screengo(oap, dir, dist) col_off1 = curwin_col_off(); col_off2 = col_off1 - curwin_col_off2(); - width1 = W_WIDTH(curwin) - col_off1; - width2 = W_WIDTH(curwin) - col_off2; + width1 = curwin->w_width - col_off1; + width2 = curwin->w_width - col_off2; + if (width2 == 0) + width2 = 1; /* avoid divide by zero */ -#ifdef FEAT_VERTSPLIT if (curwin->w_width != 0) { -#endif /* * Instead of sticking at the last character of the buffer line we * try to stick in the last column of the screen. @@ -4502,9 +4569,7 @@ nv_screengo(oap, dir, dist) } } } -#ifdef FEAT_VERTSPLIT } -#endif if (virtual_active() && atend) coladvance(MAXCOL); @@ -4514,13 +4579,21 @@ nv_screengo(oap, dir, dist) #if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE) if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) { + colnr_T virtcol; + /* * Check for landing on a character that got split at the end of the * last line. We want to advance a screenline, not end up in the same * screenline or move two screenlines. */ validate_virtcol(); - if (curwin->w_virtcol > curwin->w_curswant + virtcol = curwin->w_virtcol; +# if defined(FEAT_LINEBREAK) + if (virtcol > (colnr_T)width1 && *p_sbr != NUL) + virtcol -= vim_strsize(p_sbr); +# endif + + if (virtcol > curwin->w_curswant && (curwin->w_curswant < (colnr_T)width1 ? (curwin->w_curswant > (colnr_T)width1 / 2) : ((curwin->w_curswant - width1) % width2 @@ -4543,14 +4616,12 @@ nv_screengo(oap, dir, dist) * K_MOUSELEFT (cap->arg == -1) or K_MOUSERIGHT (cap->arg == -2) */ static void -nv_mousescroll(cap) - cmdarg_T *cap; +nv_mousescroll(cmdarg_T *cap) { # ifdef FEAT_GUI_SCROLL_WHEEL_FORCE int scroll_wheel_force = 0; # endif -# ifdef FEAT_WINDOWS - win_T *old_curwin = curwin; + win_T *old_curwin = curwin, *wp; if (mouse_row >= 0 && mouse_col >= 0) { @@ -4560,10 +4631,12 @@ nv_mousescroll(cap) col = mouse_col; /* find the window at the pointer coordinates */ - curwin = mouse_find_win(&row, &col); + wp = mouse_find_win(&row, &col); + if (wp == NULL) + return; + curwin = wp; curbuf = curwin->w_buffer; } -# endif # ifdef FEAT_GUI_SCROLL_WHEEL_FORCE if (gui.in_use && gui.scroll_wheel_force >= 1) { @@ -4576,6 +4649,13 @@ nv_mousescroll(cap) if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN) { +# ifdef FEAT_TERMINAL + if (term_use_loop()) + /* This window is a terminal window, send the mouse event there. + * Set "typed" to FALSE to avoid an endless loop. */ + send_keys_to_term(curbuf->b_term, cap->cmdchar, FALSE); + else +# endif if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { (void)onepage(cap->arg ? FORWARD : BACKWARD, 1L); @@ -4604,7 +4684,7 @@ nv_mousescroll(cap) step = scroll_wheel_force; # endif if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = W_WIDTH(curwin); + step = curwin->w_width; val = curwin->w_leftcol + (cap->arg == MSCR_RIGHT ? -step : +step); if (val < 0) val = 0; @@ -4614,20 +4694,17 @@ nv_mousescroll(cap) } # endif -# ifdef FEAT_WINDOWS curwin->w_redr_status = TRUE; curwin = old_curwin; curbuf = curwin->w_buffer; -# endif } /* * Mouse clicks and drags. */ static void -nv_mouse(cap) - cmdarg_T *cap; +nv_mouse(cmdarg_T *cap) { (void)do_mouse(cap->oap, cap->cmdchar, BACKWARD, cap->count1, 0); } @@ -4638,8 +4715,7 @@ nv_mouse(cap) * cap->arg must be TRUE for CTRL-E. */ static void -nv_scroll_line(cap) - cmdarg_T *cap; +nv_scroll_line(cmdarg_T *cap) { if (!checkclearop(cap->oap)) scroll_redraw(cap->arg, cap->count1); @@ -4649,9 +4725,7 @@ nv_scroll_line(cap) * Scroll "count" lines up or down, and redraw. */ void -scroll_redraw(up, count) - int up; - long count; +scroll_redraw(int up, long count) { linenr_T prev_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -4708,8 +4782,7 @@ scroll_redraw(up, count) * Commands that start with "z". */ static void -nv_zet(cap) - cmdarg_T *cap; +nv_zet(cmdarg_T *cap) { long n; colnr_T col; @@ -4826,6 +4899,7 @@ nv_zet(cap) case 't': scroll_cursor_top(0, TRUE); redraw_later(VALID); + set_fraction(curwin); break; /* "z." and "zz": put cursor in middle of screen */ @@ -4834,6 +4908,7 @@ nv_zet(cap) case 'z': scroll_cursor_halfway(TRUE); redraw_later(VALID); + set_fraction(curwin); break; /* "z^", "z-" and "zb": put cursor at bottom of screen */ @@ -4856,11 +4931,12 @@ nv_zet(cap) case 'b': scroll_cursor_bot(0, TRUE); redraw_later(VALID); + set_fraction(curwin); break; /* "zH" - scroll screen right half-page */ case 'H': - cap->count1 *= W_WIDTH(curwin) / 2; + cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zh" - scroll screen to the right */ @@ -4877,7 +4953,7 @@ nv_zet(cap) break; /* "zL" - scroll screen left half-page */ - case 'L': cap->count1 *= W_WIDTH(curwin) / 2; + case 'L': cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zl" - scroll screen to the left */ @@ -4921,7 +4997,7 @@ nv_zet(cap) else #endif getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); - n = W_WIDTH(curwin) - curwin_col_off(); + n = curwin->w_width - curwin_col_off(); if ((long)col + p_siso < n) col = 0; else @@ -5062,7 +5138,11 @@ nv_zet(cap) /* "zm": fold more */ case 'm': if (curwin->w_p_fdl > 0) - --curwin->w_p_fdl; + { + curwin->w_p_fdl -= cap->count1; + if (curwin->w_p_fdl < 0) + curwin->w_p_fdl = 0; + } old_fdl = -1; /* force an update */ curwin->w_p_fen = TRUE; break; @@ -5074,7 +5154,13 @@ nv_zet(cap) break; /* "zr": reduce folding */ - case 'r': ++curwin->w_p_fdl; + case 'r': curwin->w_p_fdl += cap->count1; + { + int d = getDeepestNesting(); + + if (curwin->w_p_fdl >= d) + curwin->w_p_fdl = d; + } break; /* "zR": open all folds */ @@ -5108,7 +5194,7 @@ nv_zet(cap) break; } undo = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'g': /* "zg": add good word to word list */ case 'w': /* "zw": add wrong word to word list */ @@ -5191,8 +5277,7 @@ nv_zet(cap) * Vertical scrollbar movement. */ static void -nv_ver_scrollbar(cap) - cmdarg_T *cap; +nv_ver_scrollbar(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); @@ -5205,8 +5290,7 @@ nv_ver_scrollbar(cap) * Horizontal scrollbar movement. */ static void -nv_hor_scrollbar(cap) - cmdarg_T *cap; +nv_hor_scrollbar(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); @@ -5221,8 +5305,7 @@ nv_hor_scrollbar(cap) * Click in GUI tab. */ static void -nv_tabline(cap) - cmdarg_T *cap; +nv_tabline(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); @@ -5235,8 +5318,7 @@ nv_tabline(cap) * Selected item in tab line menu. */ static void -nv_tabmenu(cap) - cmdarg_T *cap; +nv_tabmenu(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); @@ -5250,7 +5332,7 @@ nv_tabmenu(cap) * Used in Normal and Insert mode. */ void -handle_tabmenu() +handle_tabmenu(void) { switch (current_tabmenu) { @@ -5275,15 +5357,25 @@ handle_tabmenu() break; case TABLINE_MENU_NEW: - vim_snprintf((char *)IObuff, IOSIZE, "%dtabnew", - current_tab > 0 ? current_tab - 1 : 999); - do_cmdline_cmd(IObuff); + if (current_tab == 0) + do_cmdline_cmd((char_u *)"$tabnew"); + else + { + vim_snprintf((char *)IObuff, IOSIZE, "%dtabnew", + current_tab - 1); + do_cmdline_cmd(IObuff); + } break; case TABLINE_MENU_OPEN: - vim_snprintf((char *)IObuff, IOSIZE, "browse %dtabnew", - current_tab > 0 ? current_tab - 1 : 999); - do_cmdline_cmd(IObuff); + if (current_tab == 0) + do_cmdline_cmd((char_u *)"browse $tabnew"); + else + { + vim_snprintf((char *)IObuff, IOSIZE, "browse %dtabnew", + current_tab - 1); + do_cmdline_cmd(IObuff); + } break; } } @@ -5293,14 +5385,13 @@ handle_tabmenu() * "Q" command. */ static void -nv_exmode(cap) - cmdarg_T *cap; +nv_exmode(cmdarg_T *cap) { /* * Ignore 'Q' in Visual mode, just give a beep. */ if (VIsual_active) - vim_beep(); + vim_beep(BO_EX); else if (!checkclearop(cap->oap)) do_exmode(FALSE); } @@ -5309,8 +5400,7 @@ nv_exmode(cap) * Handle a ":" command. */ static void -nv_colon(cap) - cmdarg_T *cap; +nv_colon(cmdarg_T *cap) { int old_p_im; int cmd_result; @@ -5374,8 +5464,7 @@ nv_colon(cap) * Handle CTRL-G command. */ static void -nv_ctrlg(cap) - cmdarg_T *cap; +nv_ctrlg(cmdarg_T *cap) { if (VIsual_active) /* toggle Selection/Visual mode */ { @@ -5391,8 +5480,7 @@ nv_ctrlg(cap) * Handle CTRL-H <Backspace> command. */ static void -nv_ctrlh(cap) - cmdarg_T *cap; +nv_ctrlh(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { @@ -5407,8 +5495,7 @@ nv_ctrlh(cap) * CTRL-L: clear screen and redraw. */ static void -nv_clear(cap) - cmdarg_T *cap; +nv_clear(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { @@ -5423,6 +5510,14 @@ nv_clear(cap) #ifdef FEAT_SYN_HL /* Clear all syntax states to force resyncing. */ syn_stack_free_all(curwin->w_s); +# ifdef FEAT_RELTIME + { + win_T *wp; + + FOR_ALL_WINDOWS(wp) + wp->w_s->b_syn_slow = FALSE; + } +# endif #endif redraw_later(CLEAR); } @@ -5433,8 +5528,7 @@ nv_clear(cap) * Otherwise: Go to older pcmark. */ static void -nv_ctrlo(cap) - cmdarg_T *cap; +nv_ctrlo(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { @@ -5453,8 +5547,7 @@ nv_ctrlo(cap) * CTRL-^ command, short for ":e #" */ static void -nv_hat(cap) - cmdarg_T *cap; +nv_hat(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) (void)buflist_getfile((int)cap->count0, (linenr_T)0, @@ -5465,8 +5558,7 @@ nv_hat(cap) * "Z" commands. */ static void -nv_Zet(cap) - cmdarg_T *cap; +nv_Zet(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { @@ -5485,14 +5577,11 @@ nv_Zet(cap) } } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Call nv_ident() as if "c1" was used, with "c2" as next character. */ void -do_nv_ident(c1, c2) - int c1; - int c2; +do_nv_ident(int c1, int c2) { oparg_T oa; cmdarg_T ca; @@ -5504,7 +5593,6 @@ do_nv_ident(c1, c2) ca.nchar = c2; nv_ident(&ca); } -#endif /* * Handle the commands that use the word under the cursor. @@ -5515,15 +5603,16 @@ do_nv_ident(c1, c2) * g ']' :tselect for current identifier */ static void -nv_ident(cap) - cmdarg_T *cap; +nv_ident(cmdarg_T *cap) { char_u *ptr = NULL; char_u *buf; + unsigned buflen; char_u *newbuf; char_u *p; char_u *kp; /* value of 'keywordprg' */ - int kp_help; /* 'keywordprg' is ":help" */ + int kp_help; /* 'keywordprg' is ":he" */ + int kp_ex; /* 'keywordprg' starts with ":" */ int n = 0; /* init for GCC */ int cmdchar; int g_cmd; /* "g" command */ @@ -5571,7 +5660,14 @@ nv_ident(cap) kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp); kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); - buf = alloc((unsigned)(n * 2 + 30 + STRLEN(kp))); + if (kp_help && *skipwhite(ptr) == NUL) + { + EMSG(_(e_noident)); /* found white space only */ + return; + } + kp_ex = (*kp == ':'); + buflen = (unsigned)(n * 2 + 30 + STRLEN(kp)); + buf = alloc(buflen); if (buf == NULL) return; buf[0] = NUL; @@ -5597,6 +5693,15 @@ nv_ident(cap) case 'K': if (kp_help) STRCPY(buf, "he! "); + else if (kp_ex) + { + if (cap->count0 != 0) + vim_snprintf((char *)buf, buflen, "%s %ld", + kp, cap->count0); + else + STRCPY(buf, kp); + STRCAT(buf, " "); + } else { /* An external command will probably use an argument starting @@ -5662,9 +5767,13 @@ nv_ident(cap) */ if (cmdchar == 'K' && !kp_help) { - /* Escape the argument properly for a shell command */ ptr = vim_strnsave(ptr, n); - p = vim_strsave_shellescape(ptr, TRUE, TRUE); + if (kp_ex) + /* Escape the argument properly for an Ex command */ + p = vim_strsave_fnameescape(ptr, FALSE); + else + /* Escape the argument properly for a shell command */ + p = vim_strsave_shellescape(ptr, TRUE, TRUE); vim_free(ptr); if (p == NULL) { @@ -5738,7 +5847,7 @@ nv_ident(cap) init_history(); add_to_history(HIST_SEARCH, buf, TRUE, NUL); #endif - normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0); + (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0); } else do_cmdline_cmd(buf); @@ -5751,10 +5860,10 @@ nv_ident(cap) * Returns FAIL if more than one line selected. */ int -get_visual_text(cap, pp, lenp) - cmdarg_T *cap; - char_u **pp; /* return: start of selected text */ - int *lenp; /* return: length of selected text */ +get_visual_text( + cmdarg_T *cap, + char_u **pp, /* return: start of selected text */ + int *lenp) /* return: length of selected text */ { if (VIsual_mode != 'V') unadjust_for_sel(); @@ -5771,7 +5880,7 @@ get_visual_text(cap, pp, lenp) } else { - if (lt(curwin->w_cursor, VIsual)) + if (LT_POS(curwin->w_cursor, VIsual)) { *pp = ml_get_pos(&curwin->w_cursor); *lenp = VIsual.col - curwin->w_cursor.col + 1; @@ -5795,8 +5904,7 @@ get_visual_text(cap, pp, lenp) * CTRL-T: backwards in tag stack */ static void -nv_tagpop(cap) - cmdarg_T *cap; +nv_tagpop(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) do_tag((char_u *)"", DT_POP, (int)cap->count1, FALSE, TRUE); @@ -5806,8 +5914,7 @@ nv_tagpop(cap) * Handle scrolling command 'H', 'L' and 'M'. */ static void -nv_scroll(cap) - cmdarg_T *cap; +nv_scroll(cmdarg_T *cap) { int used = 0; long n; @@ -5888,7 +5995,7 @@ nv_scroll(cap) lnum = curwin->w_topline; while (n-- > 0 && lnum < curwin->w_botline - 1) { - hasFolding(lnum, NULL, &lnum); + (void)hasFolding(lnum, NULL, &lnum); ++lnum; } n = lnum - curwin->w_topline; @@ -5900,7 +6007,9 @@ nv_scroll(cap) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; } - cursor_correct(); /* correct for 'so' */ + /* Correct for 'so', except when an operator is pending. */ + if (cap->oap->op_type == OP_NOP) + cursor_correct(); beginline(BL_SOL | BL_FIX); } @@ -5908,8 +6017,7 @@ nv_scroll(cap) * Cursor right commands. */ static void -nv_right(cap) - cmdarg_T *cap; +nv_right(cmdarg_T *cap) { long n; int past_line; @@ -5960,7 +6068,7 @@ nv_right(cap) * included, move to next line after that */ if ( cap->oap->op_type != OP_NOP && !cap->oap->inclusive - && !lineempty(curwin->w_cursor.lnum)) + && !LINEEMPTY(curwin->w_cursor.lnum)) cap->oap->inclusive = TRUE; else { @@ -5982,7 +6090,7 @@ nv_right(cap) } else { - if (!lineempty(curwin->w_cursor.lnum)) + if (!LINEEMPTY(curwin->w_cursor.lnum)) cap->oap->inclusive = TRUE; } break; @@ -6019,8 +6127,7 @@ nv_right(cap) * Returns TRUE when operator end should not be adjusted. */ static void -nv_left(cap) - cmdarg_T *cap; +nv_left(cmdarg_T *cap) { long n; @@ -6062,7 +6169,7 @@ nv_left(cap) * Don't adjust op_end now, otherwise it won't work. */ if ( (cap->oap->op_type == OP_DELETE || cap->oap->op_type == OP_CHANGE) - && !lineempty(curwin->w_cursor.lnum)) + && !LINEEMPTY(curwin->w_cursor.lnum)) { char_u *cp = ml_get_cursor(); @@ -6097,8 +6204,7 @@ nv_left(cap) * cap->arg is TRUE for "-": Move cursor to first non-blank. */ static void -nv_up(cap) - cmdarg_T *cap; +nv_up(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { @@ -6121,8 +6227,7 @@ nv_up(cap) * cap->arg is TRUE for CR and "+": Move cursor to first non-blank. */ static void -nv_down(cap) - cmdarg_T *cap; +nv_down(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { @@ -6131,13 +6236,15 @@ nv_down(cap) nv_page(cap); } else -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* In a quickfix window a <CR> jumps to the error under the cursor. */ if (bt_quickfix(curbuf) && cap->cmdchar == CAR) + { if (curwin->w_llist_ref == NULL) do_cmdline_cmd((char_u *)".cc"); /* quickfix window */ else do_cmdline_cmd((char_u *)".ll"); /* location list window */ + } else #endif { @@ -6146,6 +6253,17 @@ nv_down(cap) if (cmdwin_type != 0 && cap->cmdchar == CAR) cmdwin_result = CAR; else +#endif +#ifdef FEAT_JOB_CHANNEL + /* In a prompt buffer a <CR> in the last line invokes the callback. */ + if (bt_prompt(curbuf) && cap->cmdchar == CAR + && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) + { + invoke_prompt_callback(); + if (restart_edit == 0) + restart_edit = 'a'; + } + else #endif { cap->oap->motion_type = MLINE; @@ -6162,8 +6280,7 @@ nv_down(cap) * Grab the file name under the cursor and edit it. */ static void -nv_gotofile(cap) - cmdarg_T *cap; +nv_gotofile(cmdarg_T *cap) { char_u *ptr; linenr_T lnum = -1; @@ -6174,25 +6291,23 @@ nv_gotofile(cap) text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) { clearop(cap->oap); return; } -#endif ptr = grab_file_name(cap->count1, &lnum); if (ptr != NULL) { /* do autowrite if necessary */ - if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !P_HID(curbuf)) - autowrite(curbuf, FALSE); + if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !buf_hide(curbuf)) + (void)autowrite(curbuf, FALSE); setpcmark(); - (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST, - P_HID(curbuf) ? ECMD_HIDE : 0, curwin); - if (cap->nchar == 'F' && lnum >= 0) + if (do_ecmd(0, ptr, NULL, NULL, ECMD_LAST, + buf_hide(curbuf) ? ECMD_HIDE : 0, curwin) == OK + && cap->nchar == 'F' && lnum >= 0) { curwin->w_cursor.lnum = lnum; check_cursor_lnum(); @@ -6209,8 +6324,7 @@ nv_gotofile(cap) * <End> command: to end of current line or last line. */ static void -nv_end(cap) - cmdarg_T *cap; +nv_end(cmdarg_T *cap) { if (cap->arg || (mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ { @@ -6225,8 +6339,7 @@ nv_end(cap) * Handle the "$" command. */ static void -nv_dollar(cap) - cmdarg_T *cap; +nv_dollar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; @@ -6252,10 +6365,10 @@ nv_dollar(cap) * If cap->arg is TRUE don't set PC mark. */ static void -nv_search(cap) - cmdarg_T *cap; +nv_search(cmdarg_T *cap) { oparg_T *oap = cap->oap; + pos_T save_cursor = curwin->w_cursor; if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) { @@ -6266,7 +6379,14 @@ nv_search(cap) return; } + /* When using 'incsearch' the cursor may be moved to set a different search + * start position. */ +#ifdef USE_MIGEMO + cap->searchbuf = getcmdline(cap->cmdchar, + (cap->nchar == 'g' ? -cap->count1 - 1 : cap->count1), 0); +#else cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0); +#endif if (cap->searchbuf == NULL) { @@ -6274,8 +6394,12 @@ nv_search(cap) return; } - normal_search(cap, cap->cmdchar, cap->searchbuf, - (cap->arg ? 0 : SEARCH_MARK)); + (void)normal_search(cap, cap->cmdchar, cap->searchbuf, +#ifdef USE_MIGEMO + (cap->nchar == 'g' ? SEARCH_MIGEMO : 0) | +#endif + ((cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor)) + ? 0 : SEARCH_MARK)); } /* @@ -6283,22 +6407,33 @@ nv_search(cap) * cap->arg is SEARCH_REV for "N", 0 for "n". */ static void -nv_next(cap) - cmdarg_T *cap; +nv_next(cmdarg_T *cap) { - normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg); + pos_T old = curwin->w_cursor; + int i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg); + + if (i == 1 && EQUAL_POS(old, curwin->w_cursor)) + { + /* Avoid getting stuck on the current cursor position, which can + * happen when an offset is given and the cursor is on the last char + * in the buffer: Repeat with count + 1. */ + cap->count1 += 1; + (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg); + cap->count1 -= 1; + } } /* * Search for "pat" in direction "dir" ('/' or '?', 0 for repeat). * Uses only cap->count1 and cap->oap from "cap". + * Return 0 for failure, 1 for found, 2 for found and line offset added. */ - static void -normal_search(cap, dir, pat, opt) - cmdarg_T *cap; - int dir; - char_u *pat; - int opt; /* extra flags for do_search() */ + static int +normal_search( + cmdarg_T *cap, + int dir, + char_u *pat, + int opt) /* extra flags for do_search() */ { int i; @@ -6308,7 +6443,7 @@ normal_search(cap, dir, pat, opt) curwin->w_set_curswant = TRUE; i = do_search(cap->oap, dir, pat, cap->count1, - opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL); + opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL, NULL); if (i == 0) clearop(cap->oap); else @@ -6327,6 +6462,7 @@ normal_search(cap, dir, pat, opt) /* "/$" will put the cursor after the end of the line, may need to * correct that here */ check_cursor(); + return i; } /* @@ -6336,8 +6472,7 @@ normal_search(cap, dir, pat, opt) * cap->nchar is NUL for ',' and ';' (repeat the search) */ static void -nv_csearch(cap) - cmdarg_T *cap; +nv_csearch(cmdarg_T *cap) { int t_cmd; @@ -6378,8 +6513,7 @@ nv_csearch(cap) * cap->arg is BACKWARD for "[" and FORWARD for "]". */ static void -nv_brackets(cap) - cmdarg_T *cap; +nv_brackets(cmdarg_T *cap) { pos_T new_pos = INIT_POS_T(0, 0, 0); pos_T prev_pos; @@ -6620,9 +6754,9 @@ nv_brackets(cap) if (VIsual_active) { - start = ltoreq(VIsual, curwin->w_cursor) + start = LTOREQ_POS(VIsual, curwin->w_cursor) ? VIsual : curwin->w_cursor; - end = equalpos(start,VIsual) ? curwin->w_cursor : VIsual; + end = EQUAL_POS(start,VIsual) ? curwin->w_cursor : VIsual; curwin->w_cursor = (dir == BACKWARD ? start : end); } # ifdef FEAT_CLIPBOARD @@ -6732,6 +6866,8 @@ nv_brackets(cap) clearopbeep(cap->oap); break; } + else + curwin->w_set_curswant = TRUE; # ifdef FEAT_FOLDING if (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped) foldOpenCursor(); @@ -6748,8 +6884,7 @@ nv_brackets(cap) * Handle Normal mode "%" command. */ static void -nv_percent(cap) - cmdarg_T *cap; +nv_percent(cmdarg_T *cap) { pos_T *pos; #if defined(FEAT_FOLDING) @@ -6809,8 +6944,7 @@ nv_percent(cap) * cap->arg is BACKWARD for "(" and FORWARD for ")". */ static void -nv_brace(cap) - cmdarg_T *cap; +nv_brace(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; @@ -6838,8 +6972,7 @@ nv_brace(cap) * "m" command: Mark a position. */ static void -nv_mark(cap) - cmdarg_T *cap; +nv_mark(cmdarg_T *cap) { if (!checkclearop(cap->oap)) { @@ -6853,8 +6986,7 @@ nv_mark(cap) * cmd->arg is BACKWARD for "{" and FORWARD for "}". */ static void -nv_findpar(cap) - cmdarg_T *cap; +nv_findpar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -6878,8 +7010,7 @@ nv_findpar(cap) * "u" command: Undo or make lower case. */ static void -nv_undo(cap) - cmdarg_T *cap; +nv_undo(cmdarg_T *cap) { if (cap->oap->op_type == OP_LOWER || VIsual_active) { @@ -6896,11 +7027,17 @@ nv_undo(cap) * <Undo> command. */ static void -nv_kundo(cap) - cmdarg_T *cap; +nv_kundo(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf)) + { + clearopbeep(cap->oap); + return; + } +#endif u_undo((int)cap->count1); curwin->w_set_curswant = TRUE; } @@ -6910,8 +7047,7 @@ nv_kundo(cap) * Handle the "r" command. */ static void -nv_replace(cap) - cmdarg_T *cap; +nv_replace(cmdarg_T *cap) { char_u *ptr; int had_ctrl_v; @@ -6919,6 +7055,13 @@ nv_replace(cap) if (checkclearop(cap->oap)) return; +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && !prompt_curpos_editable()) + { + clearopbeep(cap->oap); + return; + } +#endif /* get another character */ if (cap->nchar == Ctrl_V) @@ -6946,10 +7089,12 @@ nv_replace(cap) reset_VIsual(); if (had_ctrl_v) { - if (cap->nchar == '\r') - cap->nchar = -1; - else if (cap->nchar == '\n') - cap->nchar = -2; + /* Use a special (negative) number to make a difference between a + * literal CR or NL and a line break. */ + if (cap->nchar == CAR) + cap->nchar = REPLACE_CR_NCHAR; + else if (cap->nchar == NL) + cap->nchar = REPLACE_NL_NCHAR; } nv_operator(cap); return; @@ -7126,8 +7271,7 @@ nv_replace(cap) * 'O': same, but in block mode exchange left and right corners. */ static void -v_swap_corners(cmdchar) - int cmdchar; +v_swap_corners(int cmdchar) { pos_T old_cursor; colnr_T left, right; @@ -7178,8 +7322,7 @@ v_swap_corners(cmdchar) * "R" (cap->arg is FALSE) and "gR" (cap->arg is TRUE). */ static void -nv_Replace(cap) - cmdarg_T *cap; +nv_Replace(cmdarg_T *cap) { if (VIsual_active) /* "R" is replace lines */ { @@ -7209,8 +7352,7 @@ nv_Replace(cap) * "gr". */ static void -nv_vreplace(cap) - cmdarg_T *cap; +nv_vreplace(cmdarg_T *cap) { if (VIsual_active) { @@ -7242,8 +7384,7 @@ nv_vreplace(cap) * Swap case for "~" command, when it does not work like an operator. */ static void -n_swapchar(cap) - cmdarg_T *cap; +n_swapchar(cmdarg_T *cap) { long n; pos_T startpos; @@ -7257,7 +7398,7 @@ n_swapchar(cap) if (checkclearopq(cap->oap)) return; - if (lineempty(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL) + if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL) { clearopbeep(cap->oap); return; @@ -7338,10 +7479,7 @@ n_swapchar(cap) * Move cursor to mark. */ static void -nv_cursormark(cap, flag, pos) - cmdarg_T *cap; - int flag; - pos_T *pos; +nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos) { if (check_mark(pos) == FAIL) clearop(cap->oap); @@ -7369,8 +7507,7 @@ nv_cursormark(cap, flag, pos) * Handle commands that are operators in Visual mode. */ static void -v_visop(cap) - cmdarg_T *cap; +v_visop(cmdarg_T *cap) { static char_u trans[] = "YyDdCcxdXdAAIIrr"; @@ -7394,9 +7531,20 @@ v_visop(cap) * "s" and "S" commands. */ static void -nv_subst(cap) - cmdarg_T *cap; +nv_subst(cmdarg_T *cap) { +#ifdef FEAT_TERMINAL + /* When showing output of term_dumpdiff() swap the top and botom. */ + if (term_swap_diff() == OK) + return; +#endif +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && !prompt_curpos_editable()) + { + clearopbeep(cap->oap); + return; + } +#endif if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ { if (cap->cmdchar == 'S') @@ -7415,8 +7563,7 @@ nv_subst(cap) * Abbreviated commands. */ static void -nv_abbrev(cap) - cmdarg_T *cap; +nv_abbrev(cmdarg_T *cap) { if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL) cap->cmdchar = 'x'; /* DEL key behaves like 'x' */ @@ -7432,8 +7579,7 @@ nv_abbrev(cap) * Translate a command into another command. */ static void -nv_optrans(cap) - cmdarg_T *cap; +nv_optrans(cmdarg_T *cap) { static char_u *(ar[8]) = {(char_u *)"dl", (char_u *)"dh", (char_u *)"d$", (char_u *)"c$", @@ -7473,8 +7619,7 @@ nv_optrans(cap) * cap->arg is TRUE for "'" and "g'". */ static void -nv_gomark(cap) - cmdarg_T *cap; +nv_gomark(cmdarg_T *cap) { pos_T *pos; int c; @@ -7506,10 +7651,11 @@ nv_gomark(cap) if (!virtual_active()) curwin->w_cursor.coladd = 0; #endif + check_cursor_col(); #ifdef FEAT_FOLDING if (cap->oap->op_type == OP_NOP && pos != NULL - && (pos == (pos_T *)-1 || !equalpos(old_cursor, *pos)) + && (pos == (pos_T *)-1 || !EQUAL_POS(old_cursor, *pos)) && (fdo_flags & FDO_MARK) && old_KeyTyped) foldOpenCursor(); @@ -7520,8 +7666,7 @@ nv_gomark(cap) * Handle CTRL-O, CTRL-I, "g;" and "g," commands. */ static void -nv_pcmark(cap) - cmdarg_T *cap; +nv_pcmark(cmdarg_T *cap) { #ifdef FEAT_JUMPLIST pos_T *pos; @@ -7571,8 +7716,7 @@ nv_pcmark(cap) * Handle '"' command. */ static void -nv_regname(cap) - cmdarg_T *cap; +nv_regname(cmdarg_T *cap) { if (checkclearop(cap->oap)) return; @@ -7599,8 +7743,7 @@ nv_regname(cap) * Handle CTRL-Q just like CTRL-V. */ static void -nv_visual(cap) - cmdarg_T *cap; +nv_visual(cmdarg_T *cap) { if (cap->cmdchar == Ctrl_Q) cap->cmdchar = Ctrl_V; @@ -7708,7 +7851,7 @@ nv_visual(cap) * Start selection for Shift-movement keys. */ void -start_selection() +start_selection(void) { /* if 'selectmode' contains "key", start Select mode */ may_start_select('k'); @@ -7719,8 +7862,7 @@ start_selection() * Start Select mode, if "c" is in 'selectmode' and not in a mapping or menu. */ void -may_start_select(c) - int c; +may_start_select(int c) { VIsual_select = (stuff_empty() && typebuf_typed() && (vim_strchr(p_slm, c) != NULL)); @@ -7731,12 +7873,11 @@ may_start_select(c) * Should set VIsual_select before calling this. */ static void -n_start_visual_mode(c) - int c; +n_start_visual_mode(int c) { #ifdef FEAT_CONCEAL /* Check for redraw before changing the state. */ - conceal_check_cursur_line(); + conceal_check_cursor_line(); #endif VIsual_mode = c; @@ -7763,7 +7904,7 @@ n_start_visual_mode(c) #endif #ifdef FEAT_CONCEAL /* Check for redraw after changing the state. */ - conceal_check_cursur_line(); + conceal_check_cursor_line(); #endif if (p_smd && msg_silent == 0) @@ -7788,23 +7929,24 @@ n_start_visual_mode(c) * CTRL-W: Window commands */ static void -nv_window(cap) - cmdarg_T *cap; +nv_window(cmdarg_T *cap) { -#ifdef FEAT_WINDOWS - if (!checkclearop(cap->oap)) + if (cap->nchar == ':') + { + /* "CTRL-W :" is the same as typing ":"; useful in a terminal window */ + cap->cmdchar = ':'; + cap->nchar = NUL; + nv_colon(cap); + } + else if (!checkclearop(cap->oap)) do_window(cap->nchar, cap->count0, NUL); /* everything is in window.c */ -#else - (void)checkclearop(cap->oap); -#endif } /* * CTRL-Z: Suspend */ static void -nv_suspend(cap) - cmdarg_T *cap; +nv_suspend(cmdarg_T *cap) { clearop(cap->oap); if (VIsual_active) @@ -7816,8 +7958,7 @@ nv_suspend(cap) * Commands starting with "g". */ static void -nv_g_cmd(cap) - cmdarg_T *cap; +nv_g_cmd(cmdarg_T *cap) { oparg_T *oap = cap->oap; pos_T tpos; @@ -7826,14 +7967,29 @@ nv_g_cmd(cap) switch (cap->nchar) { + case Ctrl_A: + case Ctrl_X: #ifdef MEM_PROFILE /* * "g^A": dump log of used memory. */ - case Ctrl_A: - vim_mem_profile_dump(); - break; + if (!VIsual_active && cap->nchar == Ctrl_A) + vim_mem_profile_dump(); + else #endif + /* + * "g^A/g^X": sequentially increment visually selected region + */ + if (VIsual_active) + { + cap->arg = TRUE; + cap->cmdchar = cap->nchar; + cap->nchar = NUL; + nv_addsub(cap); + } + else + clearopbeep(oap); + break; #ifdef FEAT_VREPLACE /* @@ -8027,13 +8183,9 @@ nv_g_cmd(cap) case K_KHOME: oap->motion_type = MCHAR; oap->inclusive = FALSE; - if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + if (curwin->w_p_wrap && curwin->w_width != 0) { - int width1 = W_WIDTH(curwin) - curwin_col_off(); + int width1 = curwin->w_width - curwin_col_off(); int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8047,7 +8199,7 @@ nv_g_cmd(cap) * 'relativenumber' is on and lines are wrapping the middle can be more * to the left. */ if (cap->nchar == 'm') - i += (W_WIDTH(curwin) - curwin_col_off() + i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) ? curwin_col_off2() : 0)) / 2; coladvance((colnr_T)i); @@ -8055,7 +8207,7 @@ nv_g_cmd(cap) { do i = gchar_cursor(); - while (vim_iswhite(i) && oneright() == OK); + while (VIM_ISWHITE(i) && oneright() == OK); } curwin->w_set_curswant = TRUE; break; @@ -8079,7 +8231,7 @@ nv_g_cmd(cap) /* Decrease the cursor column until it's on a non-blank. */ while (curwin->w_cursor.col > 0 - && vim_iswhite(ptr[curwin->w_cursor.col])) + && VIM_ISWHITE(ptr[curwin->w_cursor.col])) --curwin->w_cursor.col; curwin->w_set_curswant = TRUE; adjust_for_sel(cap); @@ -8094,16 +8246,12 @@ nv_g_cmd(cap) oap->motion_type = MCHAR; oap->inclusive = TRUE; - if (curwin->w_p_wrap -#ifdef FEAT_VERTSPLIT - && curwin->w_width != 0 -#endif - ) + if (curwin->w_p_wrap && curwin->w_width != 0) { curwin->w_curswant = MAXCOL; /* so we stay at the end */ if (cap->count1 == 1) { - int width1 = W_WIDTH(curwin) - col_off; + int width1 = curwin->w_width - col_off; int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8135,7 +8283,7 @@ nv_g_cmd(cap) } else { - i = curwin->w_leftcol + W_WIDTH(curwin) - col_off - 1; + i = curwin->w_leftcol + curwin->w_width - col_off - 1; coladvance((colnr_T)i); /* Make sure we stick in this column. */ @@ -8175,7 +8323,7 @@ nv_g_cmd(cap) * "g CTRL-G": display info about cursor position */ case Ctrl_G: - cursor_pos_info(); + cursor_pos_info(NULL); break; /* @@ -8223,7 +8371,7 @@ nv_g_cmd(cap) /* "g'm" and "g`m": jump to mark without setting pcmark */ case '\'': cap->arg = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case '`': nv_gomark(cap); break; @@ -8257,6 +8405,7 @@ nv_g_cmd(cap) break; #endif + /* "g<": show scrollback text */ case '<': show_sb_text(); break; @@ -8283,11 +8432,13 @@ nv_g_cmd(cap) case 'q': case 'w': oap->cursor_start = curwin->w_cursor; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case '~': case 'u': case 'U': +#ifndef USE_MIGEMO case '?': +#endif case '@': nv_operator(cap); break; @@ -8312,6 +8463,7 @@ nv_g_cmd(cap) case K_LEFTMOUSE: case K_LEFTDRAG: case K_LEFTRELEASE: + case K_MOUSEMOVE: case K_RIGHTMOUSE: case K_RIGHTDRAG: case K_RIGHTRELEASE: @@ -8368,7 +8520,6 @@ nv_g_cmd(cap) break; #endif -#ifdef FEAT_WINDOWS case 't': if (!checkclearop(oap)) goto_tabpage((int)cap->count0); @@ -8377,7 +8528,6 @@ nv_g_cmd(cap) if (!checkclearop(oap)) goto_tabpage(-(int)cap->count1); break; -#endif case '+': case '-': /* "g+" and "g-": undo or redo along the timeline */ @@ -8386,6 +8536,25 @@ nv_g_cmd(cap) FALSE, FALSE, FALSE); break; +#ifdef USE_MIGEMO + case '/': + cap->cmdchar = '/'; + cap->nchar = 'g'; + nv_search(cap); + break; + + case '?': + if (curbuf->b_p_migemo) + { + cap->cmdchar = '?'; + cap->nchar = 'g'; + nv_search(cap); + } + else + nv_operator(cap); + break; +#endif + default: clearopbeep(oap); break; @@ -8396,8 +8565,7 @@ nv_g_cmd(cap) * Handle "o" and "O" commands. */ static void -n_opencmd(cap) - cmdarg_T *cap; +n_opencmd(cmdarg_T *cap) { #ifdef FEAT_CONCEAL linenr_T oldline = curwin->w_cursor.lnum; @@ -8424,7 +8592,7 @@ n_opencmd(cap) #ifdef FEAT_COMMENTS has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : #endif - 0, 0)) + 0, 0) == OK) { #ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) @@ -8433,6 +8601,11 @@ n_opencmd(cap) /* When '#' is in 'cpoptions' ignore the count. */ if (vim_strchr(p_cpo, CPO_HASH) != NULL) cap->count1 = 1; +#ifdef FEAT_SYN_HL + if (curwin->w_p_cul) + /* force redraw of cursorline */ + curwin->w_valid &= ~VALID_CROW; +#endif invoke_edit(cap, FALSE, cap->cmdchar, TRUE); } } @@ -8442,8 +8615,7 @@ n_opencmd(cap) * "." command: redo last change. */ static void -nv_dot(cap) - cmdarg_T *cap; +nv_dot(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { @@ -8461,8 +8633,7 @@ nv_dot(cap) * CTRL-R: undo undo */ static void -nv_redo(cap) - cmdarg_T *cap; +nv_redo(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) { @@ -8475,8 +8646,7 @@ nv_redo(cap) * Handle "U" command. */ static void -nv_Undo(cap) - cmdarg_T *cap; +nv_Undo(cmdarg_T *cap) { /* In Visual mode and typing "gUU" triggers an operator */ if (cap->oap->op_type == OP_UPPER || VIsual_active) @@ -8498,11 +8668,19 @@ nv_Undo(cap) * single character. */ static void -nv_tilde(cap) - cmdarg_T *cap; +nv_tilde(cmdarg_T *cap) { if (!p_to && !VIsual_active && cap->oap->op_type != OP_TILDE) + { +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && !prompt_curpos_editable()) + { + clearopbeep(cap->oap); + return; + } +#endif n_swapchar(cap); + } else nv_operator(cap); } @@ -8512,12 +8690,18 @@ nv_tilde(cap) * The actual work is done by do_pending_operator(). */ static void -nv_operator(cap) - cmdarg_T *cap; +nv_operator(cmdarg_T *cap) { int op_type; op_type = get_op_type(cap->cmdchar, cap->nchar); +#ifdef FEAT_JOB_CHANNEL + if (bt_prompt(curbuf) && op_is_change(op_type) && !prompt_curpos_editable()) + { + clearopbeep(cap->oap); + return; + } +#endif if (op_type == cap->oap->op_type) /* double operator works on lines */ nv_lineop(cap); @@ -8536,8 +8720,7 @@ nv_operator(cap) * Set v:operator to the characters for "optype". */ static void -set_op_var(optype) - int optype; +set_op_var(int optype) { char_u opchars[3]; @@ -8563,8 +8746,7 @@ set_op_var(optype) * "d3_" works to delete 3 lines. */ static void -nv_lineop(cap) - cmdarg_T *cap; +nv_lineop(cmdarg_T *cap) { cap->oap->motion_type = MLINE; if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL) @@ -8583,8 +8765,7 @@ nv_lineop(cap) * <Home> command. */ static void -nv_home(cap) - cmdarg_T *cap; +nv_home(cmdarg_T *cap) { /* CTRL-HOME is like "gg" */ if (mod_mask & MOD_MASK_CTRL) @@ -8602,8 +8783,7 @@ nv_home(cap) * "|" command. */ static void -nv_pipe(cap) - cmdarg_T *cap; +nv_pipe(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -8625,8 +8805,7 @@ nv_pipe(cap) * cap->arg is 1 for "B" */ static void -nv_bck_word(cap) - cmdarg_T *cap; +nv_bck_word(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -8644,8 +8823,7 @@ nv_bck_word(cap) * cap->arg is TRUE for "E" and "W". */ static void -nv_wordcmd(cap) - cmdarg_T *cap; +nv_wordcmd(cmdarg_T *cap) { int n; int word_end; @@ -8669,7 +8847,7 @@ nv_wordcmd(cap) n = gchar_cursor(); if (n != NUL) /* not an empty line */ { - if (vim_iswhite(n)) + if (VIM_ISWHITE(n)) { /* * Reproduce a funny Vi behaviour: "cw" on a blank only @@ -8713,7 +8891,7 @@ nv_wordcmd(cap) /* Don't leave the cursor on the NUL past the end of line. Unless we * didn't move it forward. */ - if (lt(startpos, curwin->w_cursor)) + if (LT_POS(startpos, curwin->w_cursor)) adjust_cursor(cap->oap); if (n == FAIL && cap->oap->op_type == OP_NOP) @@ -8734,8 +8912,7 @@ nv_wordcmd(cap) * inclusive. */ static void -adjust_cursor(oap) - oparg_T *oap; +adjust_cursor(oparg_T *oap) { /* The cursor cannot remain on the NUL when: * - the column is > 0 @@ -8764,8 +8941,7 @@ adjust_cursor(oap) * cap->arg is the argument for beginline(). */ static void -nv_beginline(cap) - cmdarg_T *cap; +nv_beginline(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; @@ -8782,11 +8958,10 @@ nv_beginline(cap) * In exclusive Visual mode, may include the last character. */ static void -adjust_for_sel(cap) - cmdarg_T *cap; +adjust_for_sel(cmdarg_T *cap) { if (VIsual_active && cap->oap->inclusive && *p_sel == 'e' - && gchar_cursor() != NUL && lt(VIsual, curwin->w_cursor)) + && gchar_cursor() != NUL && LT_POS(VIsual, curwin->w_cursor)) { #ifdef FEAT_MBYTE if (has_mbyte) @@ -8804,13 +8979,13 @@ adjust_for_sel(cap) * Returns TRUE when backed up to the previous line. */ static int -unadjust_for_sel() +unadjust_for_sel(void) { pos_T *pp; - if (*p_sel == 'e' && !equalpos(VIsual, curwin->w_cursor)) + if (*p_sel == 'e' && !EQUAL_POS(VIsual, curwin->w_cursor)) { - if (lt(VIsual, curwin->w_cursor)) + if (LT_POS(VIsual, curwin->w_cursor)) pp = &curwin->w_cursor; else pp = &VIsual; @@ -8840,8 +9015,7 @@ unadjust_for_sel() * SELECT key in Normal or Visual mode: end of Select mode mapping. */ static void -nv_select(cap) - cmdarg_T *cap; +nv_select(cmdarg_T *cap) { if (VIsual_active) VIsual_select = TRUE; @@ -8859,8 +9033,7 @@ nv_select(cap) * cap->arg is TRUE for "G". */ static void -nv_goto(cap) - cmdarg_T *cap; +nv_goto(cmdarg_T *cap) { linenr_T lnum; @@ -8890,8 +9063,7 @@ nv_goto(cap) * CTRL-\ in Normal mode. */ static void -nv_normal(cap) - cmdarg_T *cap; +nv_normal(cmdarg_T *cap) { if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G) { @@ -8921,8 +9093,7 @@ nv_normal(cap) * Don't even beep if we are canceling a command. */ static void -nv_esc(cap) - cmdarg_T *cap; +nv_esc(cmdarg_T *cap) { int no_reason; @@ -8940,7 +9111,7 @@ nv_esc(cap) #endif && !VIsual_active && no_reason) - MSG(_("Type :quit<Enter> to exit Vim")); + MSG(_("Type :qa! and press <Enter> to abandon all changes and exit Vim")); /* Don't reset "restart_edit" when 'insertmode' is set, it won't be * set again below when halfway a mapping. */ @@ -8964,25 +9135,21 @@ nv_esc(cap) redraw_curbuf_later(INVERTED); } else if (no_reason) - vim_beep(); + vim_beep(BO_ESC); clearop(cap->oap); /* A CTRL-C is often used at the start of a menu. When 'insertmode' is * set return to Insert mode afterwards. */ - if (restart_edit == 0 && goto_im() -#ifdef FEAT_EX_EXTRA - && ex_normal_busy == 0 -#endif - ) + if (restart_edit == 0 && goto_im() && ex_normal_busy == 0) restart_edit = 'a'; } /* * Handle "A", "a", "I", "i" and <Insert> commands. + * Also handle K_PS, start bracketed paste. */ static void -nv_edit(cap) - cmdarg_T *cap; +nv_edit(cmdarg_T *cap) { /* <Insert> is equal to "i" */ if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) @@ -8990,7 +9157,18 @@ nv_edit(cap) /* in Visual mode "A" and "I" are an operator */ if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I')) + { +#ifdef FEAT_TERMINAL + if (term_in_normal_mode()) + { + end_visual_mode(); + clearop(cap->oap); + term_enter_job_mode(); + return; + } +#endif v_visop(cap); + } /* in Visual mode and after an operator "a" and "i" are for text objects */ else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i') @@ -9002,11 +9180,50 @@ nv_edit(cap) clearopbeep(cap->oap); #endif } +#ifdef FEAT_TERMINAL + else if (term_in_normal_mode()) + { + clearop(cap->oap); + term_enter_job_mode(); + return; + } +#endif else if (!curbuf->b_p_ma && !p_im) { /* Only give this error when 'insertmode' is off. */ EMSG(_(e_modifiable)); clearop(cap->oap); + if (cap->cmdchar == K_PS) + /* drop the pasted text */ + bracketed_paste(PASTE_INSERT, TRUE, NULL); + } + else if (cap->cmdchar == K_PS && VIsual_active) + { + pos_T old_pos = curwin->w_cursor; + pos_T old_visual = VIsual; + + /* In Visual mode the selected text is deleted. */ + if (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum) + { + shift_delete_registers(); + cap->oap->regname = '1'; + } + else + cap->oap->regname = '-'; + cap->cmdchar = 'd'; + cap->nchar = NUL; + nv_operator(cap); + do_pending_operator(cap, 0, FALSE); + cap->cmdchar = K_PS; + + /* When the last char in the line was deleted then append. Detect this + * by checking if the cursor moved to before the Visual area. */ + if (*ml_get_cursor() != NUL && LT_POS(curwin->w_cursor, old_pos) + && LT_POS(curwin->w_cursor, old_visual)) + inc_cursor(); + + /* Insert to replace the deleted text with the pasted text. */ + invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } else if (!checkclearopq(cap->oap)) { @@ -9037,6 +9254,13 @@ nv_edit(cap) beginline(BL_WHITE|BL_FIX); break; + case K_PS: + /* Bracketed paste works like "a"ppend, unless the cursor is in + * the first column, then it inserts. */ + if (curwin->w_cursor.col == 0) + break; + /* FALLTHROUGH */ + case 'a': /* "a"ppend is like "i"nsert on the next character. */ #ifdef FEAT_VIRTUALEDIT /* increment coladd when in virtual space, increment the @@ -9068,17 +9292,20 @@ nv_edit(cap) invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } + else if (cap->cmdchar == K_PS) + /* drop the pasted text */ + bracketed_paste(PASTE_INSERT, TRUE, NULL); } /* * Invoke edit() and take care of "restart_edit" and the return value. */ static void -invoke_edit(cap, repl, cmd, startln) - cmdarg_T *cap; - int repl; /* "r" or "gr" command */ - int cmd; - int startln; +invoke_edit( + cmdarg_T *cap, + int repl, /* "r" or "gr" command */ + int cmd, + int startln) { int restart_edit_save = 0; @@ -9105,8 +9332,8 @@ invoke_edit(cap, repl, cmd, startln) * "a" or "i" while an operator is pending or in Visual mode: object motion. */ static void -nv_object(cap) - cmdarg_T *cap; +nv_object( + cmdarg_T *cap) { int flag; int include; @@ -9148,6 +9375,14 @@ nv_object(cap) flag = current_block(cap->oap, cap->count1, include, '<', '>'); break; case 't': /* "at" = a tag block (xml and html) */ + /* Do not adjust oap->end in do_pending_operator() + * otherwise there are different results for 'dit' + * (note leading whitespace in last line): + * 1) <b> 2) <b> + * foobar foobar + * </b> </b> + */ + cap->retval |= CA_NO_ADJ_OP_END; flag = current_tagblock(cap->oap, cap->count1, include); break; case 'p': /* "ap" = a paragraph */ @@ -9185,8 +9420,7 @@ nv_object(cap) * "q:", "q/", "q?": edit command-line in command-line window. */ static void -nv_record(cap) - cmdarg_T *cap; +nv_record(cmdarg_T *cap) { if (cap->oap->op_type == OP_FORMAT) { @@ -9207,7 +9441,7 @@ nv_record(cap) #endif /* (stop) recording into a named register, unless executing a * register */ - if (!Exec_reg && do_record(cap->nchar) == FAIL) + if (reg_executing == 0 && do_record(cap->nchar) == FAIL) clearopbeep(cap->oap); } } @@ -9216,8 +9450,7 @@ nv_record(cap) * Handle the "@r" command. */ static void -nv_at(cap) - cmdarg_T *cap; +nv_at(cmdarg_T *cap) { if (checkclearop(cap->oap)) return; @@ -9243,8 +9476,7 @@ nv_at(cap) * Handle the CTRL-U and CTRL-D commands. */ static void -nv_halfpage(cap) - cmdarg_T *cap; +nv_halfpage(cmdarg_T *cap) { if ((cap->cmdchar == Ctrl_U && curwin->w_cursor.lnum == 1) || (cap->cmdchar == Ctrl_D @@ -9258,8 +9490,7 @@ nv_halfpage(cap) * Handle "J" or "gJ" command. */ static void -nv_join(cap) - cmdarg_T *cap; +nv_join(cmdarg_T *cap) { if (VIsual_active) /* join the visual lines */ nv_operator(cap); @@ -9269,13 +9500,20 @@ nv_join(cap) cap->count0 = 2; /* default for join is two lines! */ if (curwin->w_cursor.lnum + cap->count0 - 1 > curbuf->b_ml.ml_line_count) - clearopbeep(cap->oap); /* beyond last line */ - else { - prep_redo(cap->oap->regname, cap->count0, - NUL, cap->cmdchar, NUL, NUL, cap->nchar); - (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE); + /* can't join when on the last line */ + if (cap->count0 <= 2) + { + clearopbeep(cap->oap); + return; + } + cap->count0 = curbuf->b_ml.ml_line_count + - curwin->w_cursor.lnum + 1; } + + prep_redo(cap->oap->regname, cap->count0, + NUL, cap->cmdchar, NUL, NUL, cap->nchar); + (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE); } } @@ -9283,8 +9521,7 @@ nv_join(cap) * "P", "gP", "p" and "gp" commands. */ static void -nv_put(cap) - cmdarg_T *cap; +nv_put(cmdarg_T *cap) { int regname = 0; void *reg1 = NULL, *reg2 = NULL; @@ -9300,12 +9537,18 @@ nv_put(cap) if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p') { clearop(cap->oap); - nv_diffgetput(TRUE); + nv_diffgetput(TRUE, cap->opcount); } else #endif clearopbeep(cap->oap); } +#ifdef FEAT_JOB_CHANNEL + else if (bt_prompt(curbuf) && !prompt_curpos_editable()) + { + clearopbeep(cap->oap); + } +#endif else { dir = (cap->cmdchar == 'P' @@ -9391,6 +9634,9 @@ nv_put(cap) { curbuf->b_visual.vi_start = curbuf->b_op_start; curbuf->b_visual.vi_end = curbuf->b_op_end; + /* need to adjust cursor position */ + if (*p_sel == 'e') + inc(&curbuf->b_visual.vi_end); } /* When all lines were selected and deleted do_put() leaves an empty @@ -9415,37 +9661,32 @@ nv_put(cap) * "o" and "O" commands. */ static void -nv_open(cap) - cmdarg_T *cap; +nv_open(cmdarg_T *cap) { #ifdef FEAT_DIFF /* "do" is ":diffget" */ if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o') { clearop(cap->oap); - nv_diffgetput(FALSE); + nv_diffgetput(FALSE, cap->opcount); } else #endif if (VIsual_active) /* switch start and end of visual */ v_swap_corners(cap->cmdchar); +#ifdef FEAT_JOB_CHANNEL + else if (bt_prompt(curbuf)) + { + clearopbeep(cap->oap); + } +#endif else n_opencmd(cap); } -#ifdef FEAT_SNIFF - static void -nv_sniff(cap) - cmdarg_T *cap UNUSED; -{ - ProcessSniffRequests(); -} -#endif - #ifdef FEAT_NETBEANS_INTG static void -nv_nbcmd(cap) - cmdarg_T *cap; +nv_nbcmd(cmdarg_T *cap) { netbeans_keycommand(cap->nchar); } @@ -9453,25 +9694,94 @@ nv_nbcmd(cap) #ifdef FEAT_DND static void -nv_drop(cap) - cmdarg_T *cap UNUSED; +nv_drop(cmdarg_T *cap UNUSED) { do_put('~', BACKWARD, 1L, PUT_CURSEND); } #endif -#ifdef FEAT_AUTOCMD /* * Trigger CursorHold event. * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the * input buffer. "did_cursorhold" is set to avoid retriggering. */ static void -nv_cursorhold(cap) - cmdarg_T *cap; +nv_cursorhold(cmdarg_T *cap) { apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } + +/* + * Calculate start/end virtual columns for operating in block mode. + */ + static void +get_op_vcol( + oparg_T *oap, + colnr_T redo_VIsual_vcol, + int initial) /* when TRUE adjust position for 'selectmode' */ +{ + colnr_T start, end; + + if (VIsual_mode != Ctrl_V + || (!initial && oap->end.col < curwin->w_width)) + return; + + oap->block_mode = TRUE; + +#ifdef FEAT_MBYTE + /* prevent from moving onto a trail byte */ + if (has_mbyte) + mb_adjustpos(curwin->w_buffer, &oap->end); #endif + + getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol); + + if (!redo_VIsual_busy) + { + getvvcol(curwin, &(oap->end), &start, NULL, &end); + + if (start < oap->start_vcol) + oap->start_vcol = start; + if (end > oap->end_vcol) + { + if (initial && *p_sel == 'e' && start >= 1 + && start - 1 >= oap->end_vcol) + oap->end_vcol = start - 1; + else + oap->end_vcol = end; + } + } + + /* if '$' was used, get oap->end_vcol from longest line */ + if (curwin->w_curswant == MAXCOL) + { + curwin->w_cursor.col = MAXCOL; + oap->end_vcol = 0; + for (curwin->w_cursor.lnum = oap->start.lnum; + curwin->w_cursor.lnum <= oap->end.lnum; + ++curwin->w_cursor.lnum) + { + getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &end); + if (end > oap->end_vcol) + oap->end_vcol = end; + } + } + else if (redo_VIsual_busy) + oap->end_vcol = oap->start_vcol + redo_VIsual_vcol - 1; + /* + * Correct oap->end.col and oap->start.col to be the + * upper-left and lower-right corner of the block area. + * + * (Actually, this does convert column positions into character + * positions) + */ + curwin->w_cursor.lnum = oap->end.lnum; + coladvance(oap->end_vcol); + oap->end = curwin->w_cursor; + + curwin->w_cursor = oap->start; + coladvance(oap->start_vcol); + oap->start = curwin->w_cursor; +} diff --git a/src/ops.c b/src/ops.c index 265cf3a854..65fc75e20b 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -50,19 +50,24 @@ #endif /* - * Each yank register is an array of pointers to lines. + * Each yank register has an array of pointers to lines. */ -static struct yankreg +typedef struct { char_u **y_array; /* pointer to array of line pointers */ linenr_T y_size; /* number of lines in y_array */ char_u y_type; /* MLINE, MCHAR or MBLOCK */ colnr_T y_width; /* only set if y_type == MBLOCK */ -} y_regs[NUM_REGISTERS]; +#ifdef FEAT_VIMINFO + time_t y_time_set; +#endif +} yankreg_T; -static struct yankreg *y_current; /* ptr to current yankreg */ +static yankreg_T y_regs[NUM_REGISTERS]; + +static yankreg_T *y_current; /* ptr to current yankreg */ static int y_append; /* TRUE when appending */ -static struct yankreg *y_previous = NULL; /* ptr to last written yankreg */ +static yankreg_T *y_previous = NULL; /* ptr to last written yankreg */ /* * structure used by block_prep, op_delete and op_yank for blockwise operators @@ -89,75 +94,79 @@ struct block_def }; #ifdef FEAT_VISUALEXTRA -static void shift_block __ARGS((oparg_T *oap, int amount)); -static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp)); -#endif -static int stuff_yank __ARGS((int, char_u *)); -static void put_reedit_in_typebuf __ARGS((int silent)); -static int put_in_typebuf __ARGS((char_u *s, int esc, int colon, - int silent)); -static void stuffescaped __ARGS((char_u *arg, int literally)); +static void shift_block(oparg_T *oap, int amount); +static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp); +#endif +static int stuff_yank(int, char_u *); +static void put_reedit_in_typebuf(int silent); +static int put_in_typebuf(char_u *s, int esc, int colon, + int silent); +static void stuffescaped(char_u *arg, int literally); #ifdef FEAT_MBYTE -static void mb_adjust_opend __ARGS((oparg_T *oap)); +static void mb_adjust_opend(oparg_T *oap); #endif -static void free_yank __ARGS((long)); -static void free_yank_all __ARGS((void)); -static int yank_copy_line __ARGS((struct block_def *bd, long y_idx)); +static void free_yank(long); +static void free_yank_all(void); +static int yank_copy_line(struct block_def *bd, long y_idx); #ifdef FEAT_CLIPBOARD -static void copy_yank_reg __ARGS((struct yankreg *reg)); -static void may_set_selection __ARGS((void)); -#endif -static void dis_msg __ARGS((char_u *p, int skip_esc)); -#if defined(FEAT_COMMENTS) || defined(PROTO) -static char_u *skip_comment __ARGS((char_u *line, int process, int include_space, int *is_comment)); +static void copy_yank_reg(yankreg_T *reg); +static void may_set_selection(void); #endif -static void block_prep __ARGS((oparg_T *oap, struct block_def *, linenr_T, int)); +static void dis_msg(char_u *p, int skip_esc); +static void block_prep(oparg_T *oap, struct block_def *, linenr_T, int); +static int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1); #if defined(FEAT_CLIPBOARD) || defined(FEAT_EVAL) -static void str_to_reg __ARGS((struct yankreg *y_ptr, int yank_type, char_u *str, long len, long blocklen, int str_list)); +static void str_to_reg(yankreg_T *y_ptr, int yank_type, char_u *str, long len, long blocklen, int str_list); #endif -static int ends_in_white __ARGS((linenr_T lnum)); +static int ends_in_white(linenr_T lnum); #ifdef FEAT_COMMENTS -static int same_leader __ARGS((linenr_T lnum, int, char_u *, int, char_u *)); -static int fmt_check_par __ARGS((linenr_T, int *, char_u **, int do_comments)); +static int same_leader(linenr_T lnum, int, char_u *, int, char_u *); +static int fmt_check_par(linenr_T, int *, char_u **, int do_comments); #else -static int fmt_check_par __ARGS((linenr_T)); +static int fmt_check_par(linenr_T); #endif +// Flags for third item in "opchars". +#define OPF_LINES 1 // operator always works on lines +#define OPF_CHANGE 2 // operator changes text + /* * The names of operators. * IMPORTANT: Index must correspond with defines in vim.h!!! - * The third field indicates whether the operator always works on lines. + * The third field holds OPF_ flags. */ static char opchars[][3] = { - {NUL, NUL, FALSE}, /* OP_NOP */ - {'d', NUL, FALSE}, /* OP_DELETE */ - {'y', NUL, FALSE}, /* OP_YANK */ - {'c', NUL, FALSE}, /* OP_CHANGE */ - {'<', NUL, TRUE}, /* OP_LSHIFT */ - {'>', NUL, TRUE}, /* OP_RSHIFT */ - {'!', NUL, TRUE}, /* OP_FILTER */ - {'g', '~', FALSE}, /* OP_TILDE */ - {'=', NUL, TRUE}, /* OP_INDENT */ - {'g', 'q', TRUE}, /* OP_FORMAT */ - {':', NUL, TRUE}, /* OP_COLON */ - {'g', 'U', FALSE}, /* OP_UPPER */ - {'g', 'u', FALSE}, /* OP_LOWER */ - {'J', NUL, TRUE}, /* DO_JOIN */ - {'g', 'J', TRUE}, /* DO_JOIN_NS */ - {'g', '?', FALSE}, /* OP_ROT13 */ - {'r', NUL, FALSE}, /* OP_REPLACE */ - {'I', NUL, FALSE}, /* OP_INSERT */ - {'A', NUL, FALSE}, /* OP_APPEND */ - {'z', 'f', TRUE}, /* OP_FOLD */ - {'z', 'o', TRUE}, /* OP_FOLDOPEN */ - {'z', 'O', TRUE}, /* OP_FOLDOPENREC */ - {'z', 'c', TRUE}, /* OP_FOLDCLOSE */ - {'z', 'C', TRUE}, /* OP_FOLDCLOSEREC */ - {'z', 'd', TRUE}, /* OP_FOLDDEL */ - {'z', 'D', TRUE}, /* OP_FOLDDELREC */ - {'g', 'w', TRUE}, /* OP_FORMAT2 */ - {'g', '@', FALSE}, /* OP_FUNCTION */ + {NUL, NUL, 0}, // OP_NOP + {'d', NUL, OPF_CHANGE}, // OP_DELETE + {'y', NUL, 0}, // OP_YANK + {'c', NUL, OPF_CHANGE}, // OP_CHANGE + {'<', NUL, OPF_LINES | OPF_CHANGE}, // OP_LSHIFT + {'>', NUL, OPF_LINES | OPF_CHANGE}, // OP_RSHIFT + {'!', NUL, OPF_LINES | OPF_CHANGE}, // OP_FILTER + {'g', '~', OPF_CHANGE}, // OP_TILDE + {'=', NUL, OPF_LINES | OPF_CHANGE}, // OP_INDENT + {'g', 'q', OPF_LINES | OPF_CHANGE}, // OP_FORMAT + {':', NUL, OPF_LINES}, // OP_COLON + {'g', 'U', OPF_CHANGE}, // OP_UPPER + {'g', 'u', OPF_CHANGE}, // OP_LOWER + {'J', NUL, OPF_LINES | OPF_CHANGE}, // DO_JOIN + {'g', 'J', OPF_LINES | OPF_CHANGE}, // DO_JOIN_NS + {'g', '?', OPF_CHANGE}, // OP_ROT13 + {'r', NUL, OPF_CHANGE}, // OP_REPLACE + {'I', NUL, OPF_CHANGE}, // OP_INSERT + {'A', NUL, OPF_CHANGE}, // OP_APPEND + {'z', 'f', OPF_LINES}, // OP_FOLD + {'z', 'o', OPF_LINES}, // OP_FOLDOPEN + {'z', 'O', OPF_LINES}, // OP_FOLDOPENREC + {'z', 'c', OPF_LINES}, // OP_FOLDCLOSE + {'z', 'C', OPF_LINES}, // OP_FOLDCLOSEREC + {'z', 'd', OPF_LINES}, // OP_FOLDDEL + {'z', 'D', OPF_LINES}, // OP_FOLDDELREC + {'g', 'w', OPF_LINES | OPF_CHANGE}, // OP_FORMAT2 + {'g', '@', OPF_CHANGE}, // OP_FUNCTION + {Ctrl_A, NUL, OPF_CHANGE}, // OP_NR_ADD + {Ctrl_X, NUL, OPF_CHANGE}, // OP_NR_SUB }; /* @@ -165,9 +174,7 @@ static char opchars[][3] = * Must only be called with a valid operator name! */ int -get_op_type(char1, char2) - int char1; - int char2; +get_op_type(int char1, int char2) { int i; @@ -175,9 +182,20 @@ get_op_type(char1, char2) return OP_REPLACE; if (char1 == '~') /* when tilde is an operator */ return OP_TILDE; + if (char1 == 'g' && char2 == Ctrl_A) /* add */ + return OP_NR_ADD; + if (char1 == 'g' && char2 == Ctrl_X) /* subtract */ + return OP_NR_SUB; for (i = 0; ; ++i) + { if (opchars[i][0] == char1 && opchars[i][1] == char2) break; + if (i == (int)(sizeof(opchars) / sizeof(char [3]) - 1)) + { + internal_error("get_op_type()"); + break; + } + } return i; } @@ -185,10 +203,18 @@ get_op_type(char1, char2) * Return TRUE if operator "op" always works on whole lines. */ int -op_on_lines(op) - int op; +op_on_lines(int op) { - return opchars[op][2]; + return opchars[op][2] & OPF_LINES; +} + +/* + * Return TRUE if operator "op" changes text. + */ + int +op_is_change(int op) +{ + return opchars[op][2] & OPF_CHANGE; } /* @@ -196,8 +222,7 @@ op_on_lines(op) * Returns 'g' or 'z' if there is another command character. */ int -get_op_char(optype) - int optype; +get_op_char(int optype) { return opchars[optype][0]; } @@ -206,8 +231,7 @@ get_op_char(optype) * Get second operator command character. */ int -get_extra_op_char(optype) - int optype; +get_extra_op_char(int optype) { return opchars[optype][1]; } @@ -216,10 +240,7 @@ get_extra_op_char(optype) * op_shift - handle a shift operation */ void -op_shift(oap, curs_top, amount) - oparg_T *oap; - int curs_top; - int amount; +op_shift(oparg_T *oap, int curs_top, int amount) { long i; int first_char; @@ -255,11 +276,6 @@ op_shift(oap, curs_top, amount) } changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); -#ifdef FEAT_FOLDING - /* The cursor line is not in a closed fold */ - foldOpenCursor(); -#endif - if (oap->block_mode) { curwin->w_cursor.lnum = oap->start.lnum; @@ -273,6 +289,12 @@ op_shift(oap, curs_top, amount) else --curwin->w_cursor.lnum; /* put cursor on last line, for ":>" */ +#ifdef FEAT_FOLDING + /* The cursor line is not in a closed fold */ + foldOpenCursor(); +#endif + + if (oap->line_count > p_report) { if (oap->op_type == OP_RSHIFT) @@ -313,11 +335,11 @@ op_shift(oap, curs_top, amount) * leaves cursor on first blank in the line */ void -shift_line(left, round, amount, call_changed_bytes) - int left; - int round; - int amount; - int call_changed_bytes; /* call changed_bytes() */ +shift_line( + int left, + int round, + int amount, + int call_changed_bytes) /* call changed_bytes() */ { int count; int i, j; @@ -368,9 +390,7 @@ shift_line(left, round, amount, call_changed_bytes) * Leaves cursor on first character in block. */ static void -shift_block(oap, amount) - oparg_T *oap; - int amount; +shift_block(oparg_T *oap, int amount) { int left = (oap->op_type == OP_LSHIFT); int oldstate = State; @@ -396,7 +416,10 @@ shift_block(oap, amount) return; /* total is number of screen columns to be inserted/removed */ - total = amount * p_sw; + total = (int)((unsigned)amount * (unsigned)p_sw); + if ((total / p_sw) != amount) + return; /* multiplication overflow */ + oldp = ml_get_curline(); if (!left) @@ -413,12 +436,20 @@ shift_block(oap, amount) { #ifdef FEAT_MBYTE if (has_mbyte) - bd.textstart += (*mb_ptr2len)(bd.textstart); + { + if ((*mb_ptr2len)(bd.textstart) == 1) + ++bd.textstart; + else + { + ws_vcol = 0; + bd.startspaces = 0; + } + } else #endif ++bd.textstart; } - for ( ; vim_iswhite(*bd.textstart); ) + for ( ; VIM_ISWHITE(*bd.textstart); ) { /* TODO: is passing bd.textstart for start of the line OK? */ incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, @@ -442,8 +473,8 @@ shift_block(oap, amount) return; vim_memset(newp, NUL, (size_t)(bd.textcol + i + j + len)); mch_memmove(newp, oldp, (size_t)bd.textcol); - copy_chars(newp + bd.textcol, (size_t)i, TAB); - copy_spaces(newp + bd.textcol + i, (size_t)j); + vim_memset(newp + bd.textcol, TAB, (size_t)i); + vim_memset(newp + bd.textcol + i, ' ', (size_t)j); /* the end */ mch_memmove(newp + bd.textcol + i + j, bd.textstart, (size_t)len); } @@ -475,12 +506,12 @@ shift_block(oap, amount) * the part of which is displayed at the block's beginning. Let's start * searching from the next character. */ if (bd.startspaces) - mb_ptr_adv(non_white); + MB_PTR_ADV(non_white); /* The character's column is in "bd.start_vcol". */ non_white_col = bd.start_vcol; - while (vim_iswhite(*non_white)) + while (VIM_ISWHITE(*non_white)) { incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col); non_white_col += incr; @@ -515,7 +546,7 @@ shift_block(oap, amount) if (verbatim_copy_width + incr > destination_col) break; verbatim_copy_width += incr; - mb_ptr_adv(verbatim_copy_end); + MB_PTR_ADV(verbatim_copy_end); } /* If "destination_col" is different from the width of the initial @@ -535,7 +566,7 @@ shift_block(oap, amount) if (newp == NULL) return; mch_memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp)); - copy_spaces(newp + (verbatim_copy_end - oldp), (size_t)fill); + vim_memset(newp + (verbatim_copy_end - oldp), ' ', (size_t)fill); STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white); } /* replace the line */ @@ -555,11 +586,11 @@ shift_block(oap, amount) * Caller must prepare for undo. */ static void -block_insert(oap, s, b_insert, bdp) - oparg_T *oap; - char_u *s; - int b_insert; - struct block_def *bdp; +block_insert( + oparg_T *oap, + char_u *s, + int b_insert, + struct block_def *bdp) { int p_ts; int count = 0; /* extra spaces to replace a cut TAB */ @@ -609,6 +640,26 @@ block_insert(oap, s, b_insert, bdp) } } +#ifdef FEAT_MBYTE + if (has_mbyte && spaces > 0) + { + int off; + + /* Avoid starting halfway a multi-byte character. */ + if (b_insert) + { + off = (*mb_head_off)(oldp, oldp + offset + spaces); + } + else + { + off = (*mb_off_next)(oldp, oldp + offset); + offset += off; + } + spaces -= off; + count -= off; + } +#endif + newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1); if (newp == NULL) continue; @@ -618,7 +669,7 @@ block_insert(oap, s, b_insert, bdp) oldp += offset; /* insert pre-padding */ - copy_spaces(newp + offset, (size_t)spaces); + vim_memset(newp + offset, ' ', (size_t)spaces); /* copy the new text */ mch_memmove(newp + offset + spaces, s, (size_t)s_len); @@ -627,7 +678,7 @@ block_insert(oap, s, b_insert, bdp) if (spaces && !bdp->is_short) { /* insert post-padding */ - copy_spaces(newp + offset + spaces, (size_t)(p_ts - spaces)); + vim_memset(newp + offset + spaces, ' ', (size_t)(p_ts - spaces)); /* We're splitting a TAB, don't copy it. */ oldp++; /* We allowed for that TAB, remember this now */ @@ -660,13 +711,11 @@ block_insert(oap, s, b_insert, bdp) * op_reindent - handle reindenting a block of lines. */ void -op_reindent(oap, how) - oparg_T *oap; - int (*how) __ARGS((void)); +op_reindent(oparg_T *oap, int (*how)(void)) { long i; char_u *l; - int count; + int amount; linenr_T first_changed = 0; linenr_T last_changed = 0; linenr_T start_lnum = curwin->w_cursor.lnum; @@ -699,11 +748,11 @@ op_reindent(oap, how) { l = skipwhite(ml_get_curline()); if (*l == NUL) /* empty or blank line */ - count = 0; + amount = 0; else - count = how(); /* get the indent for this line */ + amount = how(); /* get the indent for this line */ - if (set_indent(count, SIN_UNDO)) + if (amount >= 0 && set_indent(amount, SIN_UNDO)) { /* did change the indent, call changed_lines() later */ if (first_changed == 0) @@ -754,7 +803,7 @@ static char_u *expr_line = NULL; * Returns '=' when OK, NUL otherwise. */ int -get_expr_register() +get_expr_register(void) { char_u *new_line; @@ -773,8 +822,7 @@ get_expr_register() * Argument must be an allocated string. */ void -set_expr_line(new_line) - char_u *new_line; +set_expr_line(char_u *new_line) { vim_free(expr_line); expr_line = new_line; @@ -785,7 +833,7 @@ set_expr_line(new_line) * Returns a pointer to allocated memory, or NULL for failure. */ char_u * -get_expr_line() +get_expr_line(void) { char_u *expr_copy; char_u *rv; @@ -816,7 +864,7 @@ get_expr_line() * Get the '=' register expression itself, without evaluating it. */ char_u * -get_expr_line_src() +get_expr_line_src(void) { if (expr_line == NULL) return NULL; @@ -829,18 +877,19 @@ get_expr_line_src() * Note: There is no check for 0 (default register), caller should do this */ int -valid_yank_reg(regname, writing) - int regname; - int writing; /* if TRUE check for writable registers */ +valid_yank_reg( + int regname, + int writing) /* if TRUE check for writable registers */ { if ( (regname > 0 && ASCII_ISALNUM(regname)) || (!writing && vim_strchr((char_u *) #ifdef FEAT_EVAL - "/.%#:=" + "/.%:=" #else - "/.%#:" + "/.%:" #endif , regname) != NULL) + || regname == '#' || regname == '"' || regname == '-' || regname == '_' @@ -863,19 +912,21 @@ valid_yank_reg(regname, writing) * * If regname is 0 and writing, use register 0 * If regname is 0 and reading, use previous register + * + * Return TRUE when the register should be inserted literally (selection or + * clipboard). */ - void -get_yank_register(regname, writing) - int regname; - int writing; + int +get_yank_register(int regname, int writing) { int i; + int ret = FALSE; y_append = FALSE; if ((regname == 0 || regname == '"') && !writing && y_previous != NULL) { y_current = y_previous; - return; + return ret; } i = regname; if (VIM_ISDIGIT(i)) @@ -892,10 +943,16 @@ get_yank_register(regname, writing) #ifdef FEAT_CLIPBOARD /* When selection is not available, use register 0 instead of '*' */ else if (clip_star.available && regname == '*') + { i = STAR_REGISTER; + ret = TRUE; + } /* When clipboard is not available, use register 0 instead of '+' */ else if (clip_plus.available && regname == '+') + { i = PLUS_REGISTER; + ret = TRUE; + } #endif #ifdef FEAT_DND else if (!writing && regname == '~') @@ -906,6 +963,7 @@ get_yank_register(regname, writing) y_current = &(y_regs[i]); if (writing) /* remember the register we write into for do_put() */ y_previous = y_current; + return ret; } #if defined(FEAT_CLIPBOARD) || defined(PROTO) @@ -914,8 +972,7 @@ get_yank_register(regname, writing) * available return zero, otherwise return "regname". */ int -may_get_selection(regname) - int regname; +may_get_selection(int regname) { if (regname == '*') { @@ -940,12 +997,12 @@ may_get_selection(regname) * The returned pointer has allocated memory, use put_register() later. */ void * -get_register(name, copy) - int name; - int copy; /* make a copy, if FALSE make register empty. */ +get_register( + int name, + int copy) /* make a copy, if FALSE make register empty. */ { - struct yankreg *reg; - int i; + yankreg_T *reg; + int i; #ifdef FEAT_CLIPBOARD /* When Visual area changed, may have to update selection. Obtain the @@ -965,7 +1022,7 @@ get_register(name, copy) #endif get_yank_register(name, 0); - reg = (struct yankreg *)alloc((unsigned)sizeof(struct yankreg)); + reg = (yankreg_T *)alloc((unsigned)sizeof(yankreg_T)); if (reg != NULL) { *reg = *y_current; @@ -993,13 +1050,11 @@ get_register(name, copy) * Put "reg" into register "name". Free any previous contents and "reg". */ void -put_register(name, reg) - int name; - void *reg; +put_register(int name, void *reg) { get_yank_register(name, 0); free_yank_all(); - *y_current = *(struct yankreg *)reg; + *y_current = *(yankreg_T *)reg; vim_free(reg); #ifdef FEAT_CLIPBOARD @@ -1009,13 +1064,12 @@ put_register(name, reg) } void -free_register(reg) - void *reg; +free_register(void *reg) { - struct yankreg tmp; + yankreg_T tmp; tmp = *y_current; - *y_current = *(struct yankreg *)reg; + *y_current = *(yankreg_T *)reg; free_yank_all(); vim_free(reg); *y_current = tmp; @@ -1026,8 +1080,7 @@ free_register(reg) * return TRUE if the current yank register has type MLINE */ int -yank_register_mline(regname) - int regname; +yank_register_mline(int regname) { if (regname != 0 && !valid_yank_reg(regname, FALSE)) return FALSE; @@ -1044,22 +1097,21 @@ yank_register_mline(regname) * Return FAIL for failure, OK otherwise. */ int -do_record(c) - int c; +do_record(int c) { char_u *p; static int regname; - struct yankreg *old_y_previous, *old_y_current; + yankreg_T *old_y_previous, *old_y_current; int retval; - if (Recording == FALSE) /* start recording */ + if (reg_recording == 0) /* start recording */ { - /* registers 0-9, a-z and " are allowed */ + /* registers 0-9, a-z and " are allowed */ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) retval = FAIL; else { - Recording = TRUE; + reg_recording = c; showmode(); regname = c; retval = OK; @@ -1072,7 +1124,7 @@ do_record(c) * needs to be removed again to put it in a register. exec_reg then * adds the escaping back later. */ - Recording = FALSE; + reg_recording = 0; MSG(""); p = get_recorded(); if (p == NULL) @@ -1105,9 +1157,7 @@ do_record(c) * return FAIL for failure, OK otherwise */ static int -stuff_yank(regname, p) - int regname; - char_u *p; +stuff_yank(int regname, char_u *p) { char_u *lp; char_u **pp; @@ -1151,6 +1201,9 @@ stuff_yank(regname, p) y_current->y_array[0] = p; y_current->y_size = 1; y_current->y_type = MCHAR; /* used to be MLINE, why? */ +#ifdef FEAT_VIMINFO + y_current->y_time_set = vim_time(); +#endif } return OK; } @@ -1158,16 +1211,16 @@ stuff_yank(regname, p) static int execreg_lastc = NUL; /* - * execute a yank register: copy it into the stuff buffer + * Execute a yank register: copy it into the stuff buffer. * - * return FAIL for failure, OK otherwise + * Return FAIL for failure, OK otherwise. */ int -do_execreg(regname, colon, addcr, silent) - int regname; - int colon; /* insert ':' before each line */ - int addcr; /* always add '\n' to end of line */ - int silent; /* set "silent" flag in typeahead buffer */ +do_execreg( + int regname, + int colon, /* insert ':' before each line */ + int addcr, /* always add '\n' to end of line */ + int silent) /* set "silent" flag in typeahead buffer */ { long i; char_u *p; @@ -1206,8 +1259,7 @@ do_execreg(regname, colon, addcr, silent) EMSG(_(e_nolastcmd)); return FAIL; } - vim_free(new_last_cmdline); /* don't keep the cmdline containing @: */ - new_last_cmdline = NULL; + VIM_CLEAR(new_last_cmdline); /* don't keep the cmdline containing @: */ /* Escape all control characters with a CTRL-V */ p = vim_strsave_escaped_ext(last_cmdline, (char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); @@ -1279,7 +1331,7 @@ do_execreg(regname, colon, addcr, silent) == FAIL) return FAIL; } - Exec_reg = TRUE; /* disable the 'q' command */ + reg_executing = regname == 0 ? '"' : regname; // disable "q" command } return retval; } @@ -1289,8 +1341,7 @@ do_execreg(regname, colon, addcr, silent) * used only after other typeahead has been processed. */ static void -put_reedit_in_typebuf(silent) - int silent; +put_reedit_in_typebuf(int silent) { char_u buf[3]; @@ -1319,11 +1370,11 @@ put_reedit_in_typebuf(silent) * no remapping. */ static int -put_in_typebuf(s, esc, colon, silent) - char_u *s; - int esc; - int colon; /* add ':' before the line */ - int silent; +put_in_typebuf( + char_u *s, + int esc, + int colon, /* add ':' before the line */ + int silent) { int retval = OK; @@ -1358,14 +1409,15 @@ put_in_typebuf(s, esc, colon, silent) * return FAIL for failure, OK otherwise */ int -insert_reg(regname, literally) - int regname; - int literally; /* insert literally, not as if typed */ +insert_reg( + int regname, + int literally_arg) /* insert literally, not as if typed */ { long i; int retval = OK; char_u *arg; int allocated; + int literally = literally_arg; /* * It is possible to get into an endless loop by having CTRL-R a in @@ -1396,7 +1448,8 @@ insert_reg(regname, literally) } else /* name or number register */ { - get_yank_register(regname, FALSE); + if (get_yank_register(regname, FALSE)) + literally = TRUE; if (y_current->y_array == NULL) retval = FAIL; else @@ -1422,9 +1475,7 @@ insert_reg(regname, literally) * literally ("literally" TRUE) or interpret is as typed characters. */ static void -stuffescaped(arg, literally) - char_u *arg; - int literally; +stuffescaped(char_u *arg, int literally) { int c; char_u *start; @@ -1466,11 +1517,11 @@ stuffescaped(arg, literally) * value in "argp". */ int -get_spec_reg(regname, argp, allocated, errmsg) - int regname; - char_u **argp; - int *allocated; /* return: TRUE when value was allocated */ - int errmsg; /* give error message when failing */ +get_spec_reg( + int regname, + char_u **argp, + int *allocated, /* return: TRUE when value was allocated */ + int errmsg) /* give error message when failing */ { int cnt; @@ -1535,6 +1586,14 @@ get_spec_reg(regname, argp, allocated, errmsg) *allocated = TRUE; return TRUE; + case Ctrl_L: /* Line under cursor */ + if (!errmsg) + return FALSE; + + *argp = ml_get_buf(curwin->w_buffer, + curwin->w_cursor.lnum, FALSE); + return TRUE; + case '_': /* black hole: always empty */ *argp = (char_u *)""; return TRUE; @@ -1553,14 +1612,16 @@ get_spec_reg(regname, argp, allocated, errmsg) * return FAIL for failure, OK otherwise */ int -cmdline_paste_reg(regname, literally, remcr) - int regname; - int literally; /* Insert text literally instead of "as typed" */ - int remcr; /* don't add trailing CR */ +cmdline_paste_reg( + int regname, + int literally_arg, /* Insert text literally instead of "as typed" */ + int remcr) /* don't add CR characters */ { long i; + int literally = literally_arg; - get_yank_register(regname, FALSE); + if (get_yank_register(regname, FALSE)) + literally = TRUE; if (y_current->y_array == NULL) return FAIL; @@ -1569,12 +1630,8 @@ cmdline_paste_reg(regname, literally, remcr) cmdline_paste_str(y_current->y_array[i], literally); /* Insert ^M between lines and after last line if type is MLINE. - * Don't do this when "remcr" is TRUE and the next line is empty. */ - if (y_current->y_type == MLINE - || (i < y_current->y_size - 1 - && !(remcr - && i == y_current->y_size - 2 - && *y_current->y_array[i + 1] == NUL))) + * Don't do this when "remcr" is TRUE. */ + if ((y_current->y_type == MLINE || i < y_current->y_size - 1) && !remcr) cmdline_paste_str((char_u *)"\r", literally); /* Check for CTRL-C, in case someone tries to paste a few thousand @@ -1592,14 +1649,19 @@ cmdline_paste_reg(regname, literally, remcr) * used always and the clipboard being available. */ void -adjust_clip_reg(rp) - int *rp; +adjust_clip_reg(int *rp) { /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard', * use '*' or '+' reg, respectively. "unnamedplus" prevails. */ - if (*rp == 0 && clip_unnamed != 0) - *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available) + if (*rp == 0 && (clip_unnamed != 0 || clip_unnamed_saved != 0)) + { + if (clip_unnamed != 0) + *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available) + ? '+' : '*'; + else + *rp = ((clip_unnamed_saved & CLIP_UNNAMED_PLUS) && clip_plus.available) ? '+' : '*'; + } if (!clip_star.available && *rp == '*') *rp = 0; if (!clip_plus.available && *rp == '+') @@ -1607,14 +1669,92 @@ adjust_clip_reg(rp) } #endif +/* + * Shift the delete registers: "9 is cleared, "8 becomes "9, etc. + */ + void +shift_delete_registers() +{ + int n; + + y_current = &y_regs[9]; + free_yank_all(); /* free register nine */ + for (n = 9; n > 1; --n) + y_regs[n] = y_regs[n - 1]; + y_current = &y_regs[1]; + if (!y_append) + y_previous = y_current; + y_regs[1].y_array = NULL; /* set register one to empty */ +} + +#if defined(FEAT_EVAL) + static void +yank_do_autocmd(oparg_T *oap, yankreg_T *reg) +{ + static int recursive = FALSE; + dict_T *v_event; + list_T *list; + int n; + char_u buf[NUMBUFLEN + 2]; + long reglen = 0; + + if (recursive) + return; + + v_event = get_vim_var_dict(VV_EVENT); + + list = list_alloc(); + if (list == NULL) + return; + for (n = 0; n < reg->y_size; n++) + list_append_string(list, reg->y_array[n], -1); + list->lv_lock = VAR_FIXED; + dict_add_list(v_event, "regcontents", list); + + buf[0] = (char_u)oap->regname; + buf[1] = NUL; + dict_add_nr_str(v_event, "regname", 0, buf); + + buf[0] = get_op_char(oap->op_type); + buf[1] = get_extra_op_char(oap->op_type); + buf[2] = NUL; + dict_add_nr_str(v_event, "operator", 0, buf); + + buf[0] = NUL; + buf[1] = NUL; + switch (get_reg_type(oap->regname, ®len)) + { + case MLINE: buf[0] = 'V'; break; + case MCHAR: buf[0] = 'v'; break; + case MBLOCK: + vim_snprintf((char *)buf, sizeof(buf), "%c%ld", Ctrl_V, + reglen + 1); + break; + } + dict_add_nr_str(v_event, "regtype", 0, buf); + + /* Lock the dictionary and its keys */ + dict_set_items_ro(v_event); + + recursive = TRUE; + textlock++; + apply_autocmds(EVENT_TEXTYANKPOST, NULL, NULL, FALSE, curbuf); + textlock--; + recursive = FALSE; + + /* Empty the dictionary, v:event is still valid */ + dict_free_contents(v_event); + hash_init(&v_event->dv_hashtab); +} +#endif + /* * Handle a delete operation. * * Return FAIL if undo failed, OK otherwise. */ int -op_delete(oap) - oparg_T *oap; +op_delete(oparg_T *oap) { int n; linenr_T lnum; @@ -1720,12 +1860,7 @@ op_delete(oap) if (orig_regname != 0 || oap->motion_type == MLINE || oap->line_count > 1 || oap->use_reg_one) { - y_current = &y_regs[9]; - free_yank_all(); /* free register nine */ - for (n = 9; n > 1; --n) - y_regs[n] = y_regs[n - 1]; - y_previous = y_current = &y_regs[1]; - y_regs[1].y_array = NULL; /* set register one to empty */ + shift_delete_registers(); if (op_yank(oap, TRUE, FALSE) == OK) did_yank = TRUE; } @@ -1766,6 +1901,11 @@ op_delete(oap) return FAIL; } } + +#if defined(FEAT_EVAL) + if (did_yank && has_textyankpost()) + yank_do_autocmd(oap, y_current); +#endif } /* @@ -1804,7 +1944,7 @@ op_delete(oap) /* copy up to deleted part */ mch_memmove(newp, oldp, (size_t)bd.textcol); /* insert spaces */ - copy_spaces(newp + bd.textcol, + vim_memset(newp + bd.textcol, ' ', (size_t)(bd.startspaces + bd.endspaces)); /* copy the part after the deleted part */ oldp += bd.textcol + bd.textlen; @@ -1932,60 +2072,31 @@ op_delete(oap) curwin->w_cursor.coladd = 0; } #endif - if (oap->op_type == OP_DELETE - && oap->inclusive - && oap->end.lnum == curbuf->b_ml.ml_line_count - && n > (int)STRLEN(ml_get(oap->end.lnum))) - { - /* Special case: gH<Del> deletes the last line. */ - del_lines(1L, FALSE); - } - else - { - (void)del_bytes((long)n, !virtual_op, - oap->op_type == OP_DELETE && !oap->is_VIsual); - } + (void)del_bytes((long)n, !virtual_op, + oap->op_type == OP_DELETE && !oap->is_VIsual); } else /* delete characters between lines */ { pos_T curpos; - int delete_last_line; /* save deleted and changed lines for undo */ if (u_save((linenr_T)(curwin->w_cursor.lnum - 1), (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL) return FAIL; - delete_last_line = (oap->end.lnum == curbuf->b_ml.ml_line_count); truncate_line(TRUE); /* delete from cursor to end of line */ curpos = curwin->w_cursor; /* remember curwin->w_cursor */ ++curwin->w_cursor.lnum; del_lines((long)(oap->line_count - 2), FALSE); - if (delete_last_line) - oap->end.lnum = curbuf->b_ml.ml_line_count; - + /* delete from start of line until op_end */ n = (oap->end.col + 1 - !oap->inclusive); - if (oap->inclusive && delete_last_line - && n > (int)STRLEN(ml_get(oap->end.lnum))) - { - /* Special case: gH<Del> deletes the last line. */ - del_lines(1L, FALSE); - curwin->w_cursor = curpos; /* restore curwin->w_cursor */ - if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; - } - else - { - /* delete from start of line until op_end */ - curwin->w_cursor.col = 0; - (void)del_bytes((long)n, !virtual_op, - oap->op_type == OP_DELETE && !oap->is_VIsual); - curwin->w_cursor = curpos; /* restore curwin->w_cursor */ - } - if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) - (void)do_join(2, FALSE, FALSE, FALSE, FALSE); + curwin->w_cursor.col = 0; + (void)del_bytes((long)n, !virtual_op, + oap->op_type == OP_DELETE && !oap->is_VIsual); + curwin->w_cursor = curpos; /* restore curwin->w_cursor */ + (void)do_join(2, FALSE, FALSE, FALSE, FALSE); } } @@ -2012,8 +2123,7 @@ op_delete(oap) * Used for deletion. */ static void -mb_adjust_opend(oap) - oparg_T *oap; +mb_adjust_opend(oparg_T *oap) { char_u *p; @@ -2030,9 +2140,7 @@ mb_adjust_opend(oap) * Replace a whole area with one character. */ int -op_replace(oap, c) - oparg_T *oap; - int c; +op_replace(oparg_T *oap, int c) { int n, numc; #ifdef FEAT_MBYTE @@ -2042,13 +2150,21 @@ op_replace(oap, c) size_t oldlen; struct block_def bd; char_u *after_p = NULL; - int had_ctrl_v_cr = (c == -1 || c == -2); + int had_ctrl_v_cr = FALSE; if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty) return OK; /* nothing to do */ - if (had_ctrl_v_cr) - c = (c == -1 ? '\r' : '\n'); + if (c == REPLACE_CR_NCHAR) + { + had_ctrl_v_cr = TRUE; + c = CAR; + } + else if (c == REPLACE_NL_NCHAR) + { + had_ctrl_v_cr = TRUE; + c = NL; + } #ifdef FEAT_MBYTE if (has_mbyte) @@ -2134,9 +2250,10 @@ op_replace(oap, c) mch_memmove(newp, oldp, (size_t)bd.textcol); oldp += bd.textcol + bd.textlen; /* insert pre-spaces */ - copy_spaces(newp + bd.textcol, (size_t)bd.startspaces); + vim_memset(newp + bd.textcol, ' ', (size_t)bd.startspaces); /* insert replacement chars CHECK FOR ALLOCATED SPACE */ - /* -1/-2 is used for entering CR literally. */ + /* REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR + * literally. */ if (had_ctrl_v_cr || (c != '\r' && c != '\n')) { #ifdef FEAT_MBYTE @@ -2148,11 +2265,11 @@ op_replace(oap, c) } else #endif - copy_chars(newp + STRLEN(newp), (size_t)numc, c); + vim_memset(newp + STRLEN(newp), c, (size_t)numc); if (!bd.is_short) { /* insert post-spaces */ - copy_spaces(newp + STRLEN(newp), (size_t)bd.endspaces); + vim_memset(newp + STRLEN(newp), ' ', (size_t)bd.endspaces); /* copy the part after the changed part */ STRMOVE(newp + STRLEN(newp), oldp); } @@ -2192,7 +2309,7 @@ op_replace(oap, c) else if (!oap->inclusive) dec(&(oap->end)); - while (ltoreq(curwin->w_cursor, oap->end)) + while (LTOREQ_POS(curwin->w_cursor, oap->end)) { n = gchar_cursor(); if (n != NUL) @@ -2231,7 +2348,7 @@ op_replace(oap, c) getvpos(&oap->end, end_vcol); } #endif - pchar(curwin->w_cursor, c); + PCHAR(curwin->w_cursor, c); } } #ifdef FEAT_VIRTUALEDIT @@ -2250,7 +2367,7 @@ op_replace(oap, c) curwin->w_cursor.col -= (virtcols + 1); for (; virtcols >= 0; virtcols--) { - pchar(curwin->w_cursor, c); + PCHAR(curwin->w_cursor, c); if (inc(&curwin->w_cursor) == -1) break; } @@ -2275,14 +2392,13 @@ op_replace(oap, c) } #endif -static int swapchars __ARGS((int op_type, pos_T *pos, int length)); +static int swapchars(int op_type, pos_T *pos, int length); /* * Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?". */ void -op_tilde(oap) - oparg_T *oap; +op_tilde(oparg_T *oap) { pos_T pos; struct block_def bd; @@ -2341,7 +2457,7 @@ op_tilde(oap) did_change |= swapchars(oap->op_type, &pos, pos.lnum == oap->end.lnum ? oap->end.col + 1: (int)STRLEN(ml_get_pos(&pos))); - if (ltoreq(oap->end, pos) || inc(&pos) == -1) + if (LTOREQ_POS(oap->end, pos) || inc(&pos) == -1) break; } if (did_change) @@ -2402,10 +2518,7 @@ op_tilde(oap) * Returns TRUE if some character was changed. */ static int -swapchars(op_type, pos, length) - int op_type; - pos_T *pos; - int length; +swapchars(int op_type, pos_T *pos, int length) { int todo; int did_change = 0; @@ -2437,9 +2550,7 @@ swapchars(op_type, pos, length) * returns TRUE when something actually changed. */ int -swapchar(op_type, pos) - int op_type; - pos_T *pos; +swapchar(int op_type, pos_T *pos) { int c; int nc; @@ -2498,7 +2609,7 @@ swapchar(op_type, pos) } else #endif - pchar(*pos, nc); + PCHAR(*pos, nc); return TRUE; } return FALSE; @@ -2509,14 +2620,14 @@ swapchar(op_type, pos) * op_insert - Insert and append operators for Visual mode. */ void -op_insert(oap, count1) - oparg_T *oap; - long count1; +op_insert(oparg_T *oap, long count1) { long ins_len, pre_textlen = 0; char_u *firstline, *ins_text; + colnr_T ind_pre = 0, ind_post; struct block_def bd; int i; + pos_T t1; /* edit() changes this - record it for OP_APPEND */ bd.is_MAX = (curwin->w_curswant == MAXCOL); @@ -2548,7 +2659,10 @@ op_insert(oap, count1) #endif /* Get the info about the block before entering the text */ block_prep(oap, &bd, oap->start.lnum, TRUE); + /* Get indent information */ + ind_pre = (colnr_T)getwhitecols_curline(); firstline = ml_get(oap->start.lnum) + bd.textcol; + if (oap->op_type == OP_APPEND) firstline += bd.textlen; pre_textlen = (long)STRLEN(firstline); @@ -2584,13 +2698,21 @@ op_insert(oap, count1) check_cursor_col(); /* Works just like an 'i'nsert on the next character. */ - if (!lineempty(curwin->w_cursor.lnum) + if (!LINEEMPTY(curwin->w_cursor.lnum) && oap->start_vcol != oap->end_vcol) inc_cursor(); } } - edit(NUL, FALSE, (linenr_T)count1); + t1 = oap->start; + (void)edit(NUL, FALSE, (linenr_T)count1); + + /* When a tab was inserted, and the characters in front of the tab + * have been converted to a tab as well, the column of the cursor + * might have actually been reduced, so need to adjust here. */ + if (t1.lnum == curbuf->b_op_start_orig.lnum + && LT_POS(curbuf->b_op_start_orig, t1)) + oap->start = curbuf->b_op_start_orig; /* If user has moved off this line, we don't know what to do, so do * nothing. @@ -2601,10 +2723,25 @@ op_insert(oap, count1) if (oap->block_mode) { struct block_def bd2; + int did_indent = FALSE; + size_t len; + int add; + + /* If indent kicked in, the firstline might have changed + * but only do that, if the indent actually increased. */ + ind_post = (colnr_T)getwhitecols_curline(); + if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre) + { + bd.textcol += ind_post - ind_pre; + bd.start_vcol += ind_post - ind_pre; + did_indent = TRUE; + } /* The user may have moved the cursor before inserting something, try - * to adjust the block for that. */ - if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX) + * to adjust the block for that. But only do it, if the difference + * does not come from indent kicking in. */ + if (oap->start.lnum == curbuf->b_op_start_orig.lnum + && !bd.is_MAX && !did_indent) { if (oap->op_type == OP_INSERT && oap->start.col @@ -2617,10 +2754,11 @@ op_insert(oap, count1) #endif ) { + int t = getviscol2(curbuf->b_op_start_orig.col, + curbuf->b_op_start_orig.coladd); oap->start.col = curbuf->b_op_start_orig.col; - pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) - - oap->start_vcol; - oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); + pre_textlen -= t - oap->start_vcol; + oap->start_vcol = t; } else if (oap->op_type == OP_APPEND && oap->end.col @@ -2633,12 +2771,13 @@ op_insert(oap, count1) #endif ) { + int t = getviscol2(curbuf->b_op_start_orig.col, + curbuf->b_op_start_orig.coladd); oap->start.col = curbuf->b_op_start_orig.col; /* reset pre_textlen to the value of OP_INSERT */ pre_textlen += bd.textlen; - pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) - - oap->start_vcol; - oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); + pre_textlen -= t - oap->start_vcol; + oap->start_vcol = t; oap->op_type = OP_INSERT; } } @@ -2665,9 +2804,15 @@ op_insert(oap, count1) * Subsequent calls to ml_get() flush the firstline data - take a * copy of the required string. */ - firstline = ml_get(oap->start.lnum) + bd.textcol; + firstline = ml_get(oap->start.lnum); + len = STRLEN(firstline); + add = bd.textcol; if (oap->op_type == OP_APPEND) - firstline += bd.textlen; + add += bd.textlen; + if ((size_t)add > len) + firstline += len; // short line, point to the NUL + else + firstline += add; if (pre_textlen >= 0 && (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { @@ -2695,8 +2840,7 @@ op_insert(oap, count1) * return TRUE if edit() returns because of a CTRL-O command */ int -op_change(oap) - oparg_T *oap; +op_change(oparg_T *oap) { colnr_T l; int retval; @@ -2735,7 +2879,7 @@ op_change(oap) else if (op_delete(oap) == FAIL) return FALSE; - if ((l > curwin->w_cursor.col) && !lineempty(curwin->w_cursor.lnum) + if ((l > curwin->w_cursor.col) && !LINEEMPTY(curwin->w_cursor.lnum) && !virtual_op) inc_cursor(); @@ -2752,7 +2896,7 @@ op_change(oap) # endif firstline = ml_get(oap->start.lnum); pre_textlen = (long)STRLEN(firstline); - pre_indent = (long)(skipwhite(firstline) - firstline); + pre_indent = (long)getwhitecols(firstline); bd.textcol = curwin->w_cursor.col; } #endif @@ -2777,7 +2921,7 @@ op_change(oap) firstline = ml_get(oap->start.lnum); if (bd.textcol > (colnr_T)pre_indent) { - long new_indent = (long)(skipwhite(firstline) - firstline); + long new_indent = (long)getwhitecols(firstline); pre_textlen += new_indent - pre_indent; bd.textcol += new_indent - pre_indent; @@ -2822,7 +2966,7 @@ op_change(oap) mch_memmove(newp, oldp, (size_t)bd.textcol); offset = bd.textcol; # ifdef FEAT_VIRTUALEDIT - copy_spaces(newp + offset, (size_t)vpos.coladd); + vim_memset(newp + offset, ' ', (size_t)vpos.coladd); offset += vpos.coladd; # endif mch_memmove(newp + offset, ins_text, (size_t)ins_len); @@ -2848,7 +2992,7 @@ op_change(oap) * set all the yank registers to empty (called from main()) */ void -init_yank() +init_yank(void) { int i; @@ -2858,7 +3002,7 @@ init_yank() #if defined(EXITFREE) || defined(PROTO) void -clear_registers() +clear_registers(void) { int i; @@ -2876,8 +3020,7 @@ clear_registers() * Called for normal freeing and in case of error. */ static void -free_yank(n) - long n; +free_yank(long n) { if (y_current->y_array != NULL) { @@ -2901,8 +3044,7 @@ free_yank(n) #endif vim_free(y_current->y_array[i]); } - vim_free(y_current->y_array); - y_current->y_array = NULL; + VIM_CLEAR(y_current->y_array); #ifdef AMIGA if (n >= 1000) MSG(""); @@ -2911,7 +3053,7 @@ free_yank(n) } static void -free_yank_all() +free_yank_all(void) { free_yank(y_current->y_size); } @@ -2925,14 +3067,11 @@ free_yank_all() * Return FAIL for failure, OK otherwise. */ int -op_yank(oap, deleting, mess) - oparg_T *oap; - int deleting; - int mess; +op_yank(oparg_T *oap, int deleting, int mess) { long y_idx; /* index in y_array[] */ - struct yankreg *curr; /* copy of y_current */ - struct yankreg newreg; /* new yank register when appending */ + yankreg_T *curr; /* copy of y_current */ + yankreg_T newreg; /* new yank register when appending */ char_u **new_ptr; linenr_T lnum; /* current line number */ long j; @@ -2994,12 +3133,14 @@ op_yank(oap, deleting, mess) y_current->y_width = 0; y_current->y_array = (char_u **)lalloc_clear((long_u)(sizeof(char_u *) * yanklines), TRUE); - if (y_current->y_array == NULL) { y_current = curr; return FAIL; } +#ifdef FEAT_VIMINFO + y_current->y_time_set = vim_time(); +#endif y_idx = 0; lnum = oap->start.lnum; @@ -3126,6 +3267,9 @@ op_yank(oap, deleting, mess) new_ptr[j] = curr->y_array[j]; vim_free(curr->y_array); curr->y_array = new_ptr; +#ifdef FEAT_VIMINFO + curr->y_time_set = vim_time(); +#endif if (yanktype == MLINE) /* MLINE overrides MCHAR and MBLOCK */ curr->y_type = MLINE; @@ -3167,19 +3311,29 @@ op_yank(oap, deleting, mess) /* Some versions of Vi use ">=" here, some don't... */ if (yanklines > p_report) { + char namebuf[100]; + + if (oap->regname == NUL) + *namebuf = NUL; + else + vim_snprintf(namebuf, sizeof(namebuf), + _(" into \"%c"), oap->regname); + /* redisplay now, so message is not deleted */ update_topline_redraw(); if (yanklines == 1) { if (oap->block_mode) - MSG(_("block of 1 line yanked")); + smsg((char_u *)_("block of 1 line yanked%s"), namebuf); else - MSG(_("1 line yanked")); + smsg((char_u *)_("1 line yanked%s"), namebuf); } else if (oap->block_mode) - smsg((char_u *)_("block of %ld lines yanked"), yanklines); + smsg((char_u *)_("block of %ld lines yanked%s"), + yanklines, namebuf); else - smsg((char_u *)_("%ld lines yanked"), yanklines); + smsg((char_u *)_("%ld lines yanked%s"), yanklines, + namebuf); } } @@ -3203,7 +3357,7 @@ op_yank(oap, deleting, mess) if (clip_star.available && (curr == &(y_regs[STAR_REGISTER]) || (!deleting && oap->regname == 0 - && (clip_unnamed & CLIP_UNNAMED)))) + && ((clip_unnamed | clip_unnamed_saved) & CLIP_UNNAMED)))) { if (curr != &(y_regs[STAR_REGISTER])) /* Copy the text from register 0 to the clipboard register. */ @@ -3224,7 +3378,8 @@ op_yank(oap, deleting, mess) if (clip_plus.available && (curr == &(y_regs[PLUS_REGISTER]) || (!deleting && oap->regname == 0 - && (clip_unnamed & CLIP_UNNAMED_PLUS)))) + && ((clip_unnamed | clip_unnamed_saved) & + CLIP_UNNAMED_PLUS)))) { if (curr != &(y_regs[PLUS_REGISTER])) /* Copy the text from register 0 to the clipboard register. */ @@ -3232,8 +3387,8 @@ op_yank(oap, deleting, mess) clip_own_selection(&clip_plus); clip_gen_set_selection(&clip_plus); - if (!clip_isautosel_star() && !did_star - && curr == &(y_regs[PLUS_REGISTER])) + if (!clip_isautosel_star() && !clip_isautosel_plus() + && !did_star && curr == &(y_regs[PLUS_REGISTER])) { copy_yank_reg(&(y_regs[STAR_REGISTER])); clip_own_selection(&clip_star); @@ -3243,6 +3398,11 @@ op_yank(oap, deleting, mess) # endif #endif +#if defined(FEAT_EVAL) + if (!deleting && has_textyankpost()) + yank_do_autocmd(oap, y_current); +#endif + return OK; fail: /* free the allocated lines */ @@ -3252,9 +3412,7 @@ op_yank(oap, deleting, mess) } static int -yank_copy_line(bd, y_idx) - struct block_def *bd; - long y_idx; +yank_copy_line(struct block_def *bd, long y_idx) { char_u *pnew; @@ -3262,11 +3420,11 @@ yank_copy_line(bd, y_idx) == NULL) return FAIL; y_current->y_array[y_idx] = pnew; - copy_spaces(pnew, (size_t)bd->startspaces); + vim_memset(pnew, ' ', (size_t)bd->startspaces); pnew += bd->startspaces; mch_memmove(pnew, bd->textstart, (size_t)bd->textlen); pnew += bd->textlen; - copy_spaces(pnew, (size_t)bd->endspaces); + vim_memset(pnew, ' ', (size_t)bd->endspaces); pnew += bd->endspaces; *pnew = NUL; return OK; @@ -3277,11 +3435,10 @@ yank_copy_line(bd, y_idx) * Make a copy of the y_current register to register "reg". */ static void -copy_yank_reg(reg) - struct yankreg *reg; +copy_yank_reg(yankreg_T *reg) { - struct yankreg *curr = y_current; - long j; + yankreg_T *curr = y_current; + long j; y_current = reg; free_yank_all(); @@ -3310,11 +3467,11 @@ copy_yank_reg(reg) * PUT_LINE force linewise put (":put") */ void -do_put(regname, dir, count, flags) - int regname; - int dir; /* BACKWARD for 'P', FORWARD for 'p' */ - long count; - int flags; +do_put( + int regname, + int dir, /* BACKWARD for 'P', FORWARD for 'p' */ + long count, + int flags) { char_u *ptr; char_u *newp, *oldp; @@ -3363,6 +3520,8 @@ do_put(regname, dir, count, flags) */ if (regname == '.') { + if (VIsual_active) + stuffcharReadbuff(VIsual_mode); (void)stuff_inserted((dir == FORWARD ? (count == -1 ? 'o' : 'a') : (count == -1 ? 'O' : 'i')), count, FALSE); /* Putting the text is done later, so can't really move the cursor to @@ -3382,11 +3541,9 @@ do_put(regname, dir, count, flags) return; } -#ifdef FEAT_AUTOCMD /* Autocommands may be executed when saving lines for undo, which may make * y_array invalid. Start undo now to avoid that. */ u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1); -#endif if (insert_string != NULL) { @@ -3449,17 +3606,26 @@ do_put(regname, dir, count, flags) { if (flags & PUT_LINE_SPLIT) { + char_u *p; + /* "p" or "P" in Visual mode: split the lines to put the text in * between. */ if (u_save_cursor() == FAIL) goto end; - ptr = vim_strsave(ml_get_cursor()); + p = ml_get_cursor(); + if (dir == FORWARD && *p != NUL) + MB_PTR_ADV(p); + ptr = vim_strsave(p); if (ptr == NULL) goto end; ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE); vim_free(ptr); - ptr = vim_strnsave(ml_get_curline(), curwin->w_cursor.col); + oldp = ml_get_curline(); + p = oldp + curwin->w_cursor.col; + if (dir == FORWARD && *p != NUL) + MB_PTR_ADV(p); + ptr = vim_strnsave(oldp, p - oldp); if (ptr == NULL) goto end; ml_replace(curwin->w_cursor.lnum, ptr, FALSE); @@ -3509,7 +3675,7 @@ do_put(regname, dir, count, flags) ++lnum; /* In an empty buffer the empty line is going to be replaced, include * it in the saved lines. */ - if ((bufempty() ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL) + if ((BUFEMPTY() ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL) goto end; #ifdef FEAT_FOLDING if (dir == FORWARD) @@ -3551,7 +3717,7 @@ do_put(regname, dir, count, flags) */ if (y_type == MBLOCK) { - char c = gchar_cursor(); + int c = gchar_cursor(); colnr_T endcol2 = 0; if (dir == FORWARD && c != NUL) @@ -3671,7 +3837,7 @@ do_put(regname, dir, count, flags) mch_memmove(ptr, oldp, (size_t)bd.textcol); ptr += bd.textcol; /* may insert some spaces before the new text */ - copy_spaces(ptr, (size_t)bd.startspaces); + vim_memset(ptr, ' ', (size_t)bd.startspaces); ptr += bd.startspaces; /* insert the new text */ for (j = 0; j < count; ++j) @@ -3682,12 +3848,12 @@ do_put(regname, dir, count, flags) /* insert block's trailing spaces only if there's text behind */ if ((j < count - 1 || !shortline) && spaces) { - copy_spaces(ptr, (size_t)spaces); + vim_memset(ptr, ' ', (size_t)spaces); ptr += spaces; } } /* may insert some spaces after the new text */ - copy_spaces(ptr, (size_t)bd.endspaces); + vim_memset(ptr, ' ', (size_t)bd.endspaces); ptr += bd.endspaces; /* move the text after the cursor to the end of the line. */ mch_memmove(ptr, oldp + bd.textcol + delcount, @@ -3775,11 +3941,25 @@ do_put(regname, dir, count, flags) */ if (y_type == MCHAR && y_size == 1) { + linenr_T end_lnum = 0; /* init for gcc */ + + if (VIsual_active) + { + end_lnum = curbuf->b_visual.vi_end.lnum; + if (end_lnum < curbuf->b_visual.vi_start.lnum) + end_lnum = curbuf->b_visual.vi_start.lnum; + } + do { totlen = count * yanklen; if (totlen > 0) { oldp = ml_get(lnum); + if (VIsual_active && col > (int)STRLEN(oldp)) + { + lnum++; + continue; + } newp = alloc_check((unsigned)(STRLEN(oldp) + totlen + 1)); if (newp == NULL) goto end; /* alloc() gave an error message */ @@ -3802,7 +3982,10 @@ do_put(regname, dir, count, flags) } if (VIsual_active) lnum++; - } while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum); + } while (VIsual_active && lnum <= end_lnum); + + if (VIsual_active) /* reset lnum to the last visual line */ + lnum--; curbuf->b_op_end = curwin->w_cursor; /* For "CTRL-O p" in Insert mode, put cursor after last char */ @@ -3899,7 +4082,15 @@ do_put(regname, dir, count, flags) if (dir == FORWARD) curbuf->b_op_start.lnum++; } - mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR), + /* Skip mark_adjust when adding lines after the last one, there + * can't be marks there. But still needed in diff mode. */ + if (curbuf->b_op_start.lnum + (y_type == MCHAR) - 1 + nr_lines + < curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + || curwin->w_p_diff +#endif + ) + mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR), (linenr_T)MAXLNUM, nr_lines, 0L); /* note changed text for displaying and folding */ @@ -3975,7 +4166,7 @@ do_put(regname, dir, count, flags) * there move it left. */ void -adjust_cursor_eol() +adjust_cursor_eol(void) { if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL @@ -4005,7 +4196,7 @@ adjust_cursor_eol() * Return TRUE if lines starting with '#' should be left aligned. */ int -preprocs_left() +preprocs_left(void) { return # ifdef FEAT_SMARTINDENT @@ -4023,10 +4214,11 @@ preprocs_left() } #endif -/* Return the character name of the register with the given number */ +/* + * Return the character name of the register with the given number. + */ int -get_register_name(num) - int num; +get_register_name(int num) { if (num == -1) return '"'; @@ -4062,25 +4254,24 @@ get_register_name(num) * ":dis" and ":registers": Display the contents of the yank registers. */ void -ex_display(eap) - exarg_T *eap; +ex_display(exarg_T *eap) { - int i, n; - long j; - char_u *p; - struct yankreg *yb; - int name; - int attr; - char_u *arg = eap->arg; + int i, n; + long j; + char_u *p; + yankreg_T *yb; + int name; + int attr; + char_u *arg = eap->arg; #ifdef FEAT_MBYTE - int clen; + int clen; #else # define clen 1 #endif if (arg != NULL && *arg == NUL) arg = NULL; - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); /* Highlight title */ MSG_PUTS_TITLE(_("\n--- Registers ---")); @@ -4226,9 +4417,9 @@ ex_display(eap) * truncate at end of screen line */ static void -dis_msg(p, skip_esc) - char_u *p; - int skip_esc; /* if TRUE, ignore trailing ESC */ +dis_msg( + char_u *p, + int skip_esc) /* if TRUE, ignore trailing ESC */ { int n; #ifdef FEAT_MBYTE @@ -4266,12 +4457,12 @@ dis_msg(p, skip_esc) * is_comment - will indicate whether the current line ends with an unclosed * comment. */ - static char_u * -skip_comment(line, process, include_space, is_comment) - char_u *line; - int process; - int include_space; - int *is_comment; + char_u * +skip_comment( + char_u *line, + int process, + int include_space, + int *is_comment) { char_u *comment_flags = NULL; int lead_len; @@ -4339,12 +4530,12 @@ skip_comment(line, process, include_space, is_comment) * return FAIL for failure, OK otherwise */ int -do_join(count, insert_space, save_undo, use_formatoptions, setmark) - long count; - int insert_space; - int save_undo; - int use_formatoptions UNUSED; - int setmark; +do_join( + long count, + int insert_space, + int save_undo, + int use_formatoptions UNUSED, + int setmark) { char_u *curr = NULL; char_u *curr_start = NULL; @@ -4454,11 +4645,11 @@ do_join(count, insert_space, save_undo, use_formatoptions, setmark) if (has_mbyte) { cend = curr + currsize; - mb_ptr_back(curr, cend); + MB_PTR_BACK(curr, cend); endcurr1 = (*mb_ptr2char)(cend); if (cend > curr) { - mb_ptr_back(curr, cend); + MB_PTR_BACK(curr, cend); endcurr2 = (*mb_ptr2char)(cend); } } @@ -4500,7 +4691,7 @@ do_join(count, insert_space, save_undo, use_formatoptions, setmark) if (spaces[t] > 0) { cend -= spaces[t]; - copy_spaces(cend, (size_t)(spaces[t])); + vim_memset(cend, ' ', (size_t)(spaces[t])); } mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t, (long)(cend - newp + spaces[t] - (curr - curr_start))); @@ -4569,12 +4760,12 @@ do_join(count, insert_space, save_undo, use_formatoptions, setmark) * 'leader1' must match 'leader2_len' characters from 'leader2' -- webb */ static int -same_leader(lnum, leader1_len, leader1_flags, leader2_len, leader2_flags) - linenr_T lnum; - int leader1_len; - char_u *leader1_flags; - int leader2_len; - char_u *leader2_flags; +same_leader( + linenr_T lnum, + int leader1_len, + char_u *leader1_flags, + int leader2_len, + char_u *leader2_flags) { int idx1 = 0, idx2 = 0; char_u *p; @@ -4620,18 +4811,18 @@ same_leader(lnum, leader1_len, leader1_flags, leader2_len, leader2_flags) line1 = vim_strsave(ml_get(lnum)); if (line1 != NULL) { - for (idx1 = 0; vim_iswhite(line1[idx1]); ++idx1) + for (idx1 = 0; VIM_ISWHITE(line1[idx1]); ++idx1) ; line2 = ml_get(lnum + 1); for (idx2 = 0; idx2 < leader2_len; ++idx2) { - if (!vim_iswhite(line2[idx2])) + if (!VIM_ISWHITE(line2[idx2])) { if (line1[idx1++] != line2[idx2]) break; } else - while (vim_iswhite(line1[idx1])) + while (VIM_ISWHITE(line1[idx1])) ++idx1; } vim_free(line1); @@ -4644,9 +4835,9 @@ same_leader(lnum, leader1_len, leader1_flags, leader2_len, leader2_flags) * Implementation of the format operator 'gq'. */ void -op_format(oap, keep_cursor) - oparg_T *oap; - int keep_cursor; /* keep cursor on same text char */ +op_format( + oparg_T *oap, + int keep_cursor) /* keep cursor on same text char */ { long old_line_count = curbuf->b_ml.ml_line_count; @@ -4717,8 +4908,7 @@ op_format(oap, keep_cursor) * Implementation of the format operator 'gq' for when using 'formatexpr'. */ void -op_formatexpr(oap) - oparg_T *oap; +op_formatexpr(oparg_T *oap) { if (oap->is_VIsual) /* When there is no change: need to remove the Visual selection */ @@ -4731,14 +4921,15 @@ op_formatexpr(oap) } int -fex_format(lnum, count, c) - linenr_T lnum; - long count; - int c; /* character to be inserted */ +fex_format( + linenr_T lnum, + long count, + int c) /* character to be inserted */ { int use_sandbox = was_set_insecurely((char_u *)"formatexpr", OPT_LOCAL); int r; + char_u *fex; /* * Set v:lnum to the first line number and v:count to the number of lines. @@ -4748,16 +4939,22 @@ fex_format(lnum, count, c) set_vim_var_nr(VV_COUNT, count); set_vim_var_char(c); + /* Make a copy, the option could be changed while calling it. */ + fex = vim_strsave(curbuf->b_p_fex); + if (fex == NULL) + return 0; + /* * Evaluate the function. */ if (use_sandbox) ++sandbox; - r = eval_to_number(curbuf->b_p_fex); + r = (int)eval_to_number(fex); if (use_sandbox) --sandbox; set_vim_var_string(VV_CHAR, NULL, -1); + vim_free(fex); return r; } @@ -4770,9 +4967,9 @@ fex_format(lnum, count, c) * first line. */ void -format_lines(line_count, avoid_fex) - linenr_T line_count; - int avoid_fex; /* don't use 'formatexpr' */ +format_lines( + linenr_T line_count, + int avoid_fex) /* don't use 'formatexpr' */ { int max_len; int is_not_par; /* current line not part of parag. */ @@ -4895,7 +5092,7 @@ format_lines(line_count, avoid_fex) && prev_is_end_par && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { - if (do_second_indent && !lineempty(curwin->w_cursor.lnum + 1)) + if (do_second_indent && !LINEEMPTY(curwin->w_cursor.lnum + 1)) { #ifdef FEAT_COMMENTS if (leader_len == 0 && next_leader_len == 0) @@ -5012,8 +5209,7 @@ format_lines(line_count, avoid_fex) #endif if (second_indent > 0) /* the "leader" for FO_Q_SECOND */ { - char_u *p = ml_get_curline(); - int indent = (int)(skipwhite(p) - p); + int indent = getwhitecols_curline(); if (indent > 0) { @@ -5044,18 +5240,17 @@ format_lines(line_count, avoid_fex) * Return TRUE if line "lnum" ends in a white character. */ static int -ends_in_white(lnum) - linenr_T lnum; +ends_in_white(linenr_T lnum) { char_u *s = ml_get(lnum); size_t l; if (*s == NUL) return FALSE; - /* Don't use STRLEN() inside vim_iswhite(), SAS/C complains: "macro + /* Don't use STRLEN() inside VIM_ISWHITE(), SAS/C complains: "macro * invocation may call function multiple times". */ l = STRLEN(s) - 1; - return vim_iswhite(s[l]); + return VIM_ISWHITE(s[l]); } /* @@ -5068,11 +5263,11 @@ ends_in_white(lnum) */ #ifdef FEAT_COMMENTS static int -fmt_check_par(lnum, leader_len, leader_flags, do_comments) - linenr_T lnum; - int *leader_len; - char_u **leader_flags; - int do_comments; +fmt_check_par( + linenr_T lnum, + int *leader_len, + char_u **leader_flags, + int do_comments) { char_u *flags = NULL; /* init for GCC */ char_u *ptr; @@ -5099,8 +5294,7 @@ fmt_check_par(lnum, leader_len, leader_flags, do_comments) } #else static int -fmt_check_par(lnum) - linenr_T lnum; +fmt_check_par(linenr_T lnum) { return (*skipwhite(ml_get(lnum)) == NUL || startPS(lnum, NUL, FALSE)); } @@ -5111,8 +5305,7 @@ fmt_check_par(lnum) * previous line is in the same paragraph. Used for auto-formatting. */ int -paragraph_start(lnum) - linenr_T lnum; +paragraph_start(linenr_T lnum) { char_u *p; #ifdef FEAT_COMMENTS @@ -5176,11 +5369,11 @@ paragraph_start(lnum) * that are to be yanked. */ static void -block_prep(oap, bdp, lnum, is_del) - oparg_T *oap; - struct block_def *bdp; - linenr_T lnum; - int is_del; +block_prep( + oparg_T *oap, + struct block_def *bdp, + linenr_T lnum, + int is_del) { int incr = 0; char_u *pend; @@ -5212,7 +5405,7 @@ block_prep(oap, bdp, lnum, is_del) incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol); bdp->start_vcol += incr; #ifdef FEAT_VISUALEXTRA - if (vim_iswhite(*pstart)) + if (VIM_ISWHITE(*pstart)) { bdp->pre_whitesp += incr; bdp->pre_whitesp_c++; @@ -5224,7 +5417,7 @@ block_prep(oap, bdp, lnum, is_del) } #endif prev_pstart = pstart; - mb_ptr_adv(pstart); + MB_PTR_ADV(pstart); } bdp->start_char_vcols = incr; if (bdp->start_vcol < oap->start_vcol) /* line too short */ @@ -5278,10 +5471,7 @@ block_prep(oap, bdp, lnum, is_del) { /* Count a tab for what it's worth (if list mode not on) */ prev_pend = pend; - /* TODO: is passing prev_pend for start of the line OK? - * perhaps it should be "line". */ - incr = lbr_chartabsize_adv(prev_pend, &pend, - (colnr_T)bdp->end_vcol); + incr = lbr_chartabsize_adv(line, &pend, (colnr_T)bdp->end_vcol); bdp->end_vcol += incr; } if (bdp->end_vcol <= oap->end_vcol @@ -5324,124 +5514,313 @@ block_prep(oap, bdp, lnum, is_del) bdp->textstart = pstart; } -#ifdef FEAT_RIGHTLEFT -static void reverse_line __ARGS((char_u *s)); - - static void -reverse_line(s) - char_u *s; +/* + * Handle the add/subtract operator. + */ + void +op_addsub( + oparg_T *oap, + linenr_T Prenum1, /* Amount of add/subtract */ + int g_cmd) /* was g<c-a>/g<c-x> */ { - int i, j; - char_u c; - - if ((i = (int)STRLEN(s) - 1) <= 0) - return; + pos_T pos; + struct block_def bd; + int change_cnt = 0; + linenr_T amount = Prenum1; - curwin->w_cursor.col = i - curwin->w_cursor.col; - for (j = 0; j < i; j++, i--) + if (!VIsual_active) { - c = s[i]; s[i] = s[j]; s[j] = c; + pos = curwin->w_cursor; + if (u_save_cursor() == FAIL) + return; + change_cnt = do_addsub(oap->op_type, &pos, 0, amount); + if (change_cnt) + changed_lines(pos.lnum, 0, pos.lnum + 1, 0L); } -} + else + { + int one_change; + int length; + pos_T startpos; -# define RLADDSUBFIX(ptr) if (curwin->w_p_rl) reverse_line(ptr); -#else -# define RLADDSUBFIX(ptr) + if (u_save((linenr_T)(oap->start.lnum - 1), + (linenr_T)(oap->end.lnum + 1)) == FAIL) + return; + + pos = oap->start; + for (; pos.lnum <= oap->end.lnum; ++pos.lnum) + { + if (oap->block_mode) /* Visual block mode */ + { + block_prep(oap, &bd, pos.lnum, FALSE); + pos.col = bd.textcol; + length = bd.textlen; + } + else if (oap->motion_type == MLINE) + { + curwin->w_cursor.col = 0; + pos.col = 0; + length = (colnr_T)STRLEN(ml_get(pos.lnum)); + } + else /* oap->motion_type == MCHAR */ + { + if (pos.lnum == oap->start.lnum && !oap->inclusive) + dec(&(oap->end)); + length = (colnr_T)STRLEN(ml_get(pos.lnum)); + pos.col = 0; + if (pos.lnum == oap->start.lnum) + { + pos.col += oap->start.col; + length -= oap->start.col; + } + if (pos.lnum == oap->end.lnum) + { + length = (int)STRLEN(ml_get(oap->end.lnum)); + if (oap->end.col >= length) + oap->end.col = length - 1; + length = oap->end.col - pos.col + 1; + } + } + one_change = do_addsub(oap->op_type, &pos, length, amount); + if (one_change) + { + /* Remember the start position of the first change. */ + if (change_cnt == 0) + startpos = curbuf->b_op_start; + ++change_cnt; + } + +#ifdef FEAT_NETBEANS_INTG + if (netbeans_active() && one_change) + { + char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); + + netbeans_removed(curbuf, pos.lnum, pos.col, (long)length); + netbeans_inserted(curbuf, pos.lnum, pos.col, + &ptr[pos.col], length); + } #endif + if (g_cmd && one_change) + amount += Prenum1; + } + if (change_cnt) + changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); + + if (!change_cnt && oap->is_VIsual) + /* No change: need to remove the Visual selection */ + redraw_curbuf_later(INVERTED); + + /* Set '[ mark if something changed. Keep the last end + * position from do_addsub(). */ + if (change_cnt > 0) + curbuf->b_op_start = startpos; + + if (change_cnt > p_report) + { + if (change_cnt == 1) + MSG(_("1 line changed")); + else + smsg((char_u *)_("%ld lines changed"), change_cnt); + } + } +} /* - * add or subtract 'Prenum1' from a number in a line - * 'command' is CTRL-A for add, CTRL-X for subtract + * Add or subtract 'Prenum1' from a number in a line + * op_type is OP_NR_ADD or OP_NR_SUB * - * return FAIL for failure, OK otherwise + * Returns TRUE if some character was changed. */ - int -do_addsub(command, Prenum1) - int command; - linenr_T Prenum1; + static int +do_addsub( + int op_type, + pos_T *pos, + int length, + linenr_T Prenum1) { int col; char_u *buf1; char_u buf2[NUMBUFLEN]; - int hex; /* 'X' or 'x': hex; '0': octal */ + int pre; /* 'X'/'x': hex; '0': octal; 'B'/'b': bin */ static int hexupper = FALSE; /* 0xABC */ - unsigned long n; - long_u oldn; + uvarnumber_T n; + uvarnumber_T oldn; char_u *ptr; int c; - int length = 0; /* character length of the number */ int todel; int dohex; int dooct; + int dobin; int doalp; int firstdigit; - int negative; int subtract; + int negative = FALSE; + int was_positive = TRUE; + int visual = VIsual_active; + int did_change = FALSE; + pos_T save_cursor = curwin->w_cursor; + int maxlen = 0; + pos_T startpos; + pos_T endpos; dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); /* "heX" */ dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); /* "Octal" */ + dobin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); /* "Bin" */ doalp = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); /* "alPha" */ - ptr = ml_get_curline(); - RLADDSUBFIX(ptr); + curwin->w_cursor = *pos; + ptr = ml_get(pos->lnum); + col = pos->col; + + if (*ptr == NUL) + goto theend; /* * First check if we are on a hexadecimal number, after the "0x". */ - col = curwin->w_cursor.col; - if (dohex) - while (col > 0 && vim_isxdigit(ptr[col])) - --col; - if ( dohex - && col > 0 - && (ptr[col] == 'X' - || ptr[col] == 'x') - && ptr[col - 1] == '0' - && vim_isxdigit(ptr[col + 1])) + if (!VIsual_active) { - /* - * Found hexadecimal number, move to its start. - */ - --col; + if (dobin) + while (col > 0 && vim_isbdigit(ptr[col])) + { + --col; +#ifdef FEAT_MBYTE + if (has_mbyte) + col -= (*mb_head_off)(ptr, ptr + col); +#endif + } + + if (dohex) + while (col > 0 && vim_isxdigit(ptr[col])) + { + --col; +#ifdef FEAT_MBYTE + if (has_mbyte) + col -= (*mb_head_off)(ptr, ptr + col); +#endif + } + + if ( dobin + && dohex + && ! ((col > 0 + && (ptr[col] == 'X' + || ptr[col] == 'x') + && ptr[col - 1] == '0' +#ifdef FEAT_MBYTE + && (!has_mbyte || + !(*mb_head_off)(ptr, ptr + col - 1)) +#endif + && vim_isxdigit(ptr[col + 1])))) + { + + /* In case of binary/hexadecimal pattern overlap match, rescan */ + + col = pos->col; + + while (col > 0 && vim_isdigit(ptr[col])) + { + col--; +#ifdef FEAT_MBYTE + if (has_mbyte) + col -= (*mb_head_off)(ptr, ptr + col); +#endif + } + } + + if (( dohex + && col > 0 + && (ptr[col] == 'X' + || ptr[col] == 'x') + && ptr[col - 1] == '0' +#ifdef FEAT_MBYTE + && (!has_mbyte || + !(*mb_head_off)(ptr, ptr + col - 1)) +#endif + && vim_isxdigit(ptr[col + 1])) || + ( dobin + && col > 0 + && (ptr[col] == 'B' + || ptr[col] == 'b') + && ptr[col - 1] == '0' +#ifdef FEAT_MBYTE + && (!has_mbyte || + !(*mb_head_off)(ptr, ptr + col - 1)) +#endif + && vim_isbdigit(ptr[col + 1]))) + { + /* Found hexadecimal or binary number, move to its start. */ + --col; +#ifdef FEAT_MBYTE + if (has_mbyte) + col -= (*mb_head_off)(ptr, ptr + col); +#endif + } + else + { + /* + * Search forward and then backward to find the start of number. + */ + col = pos->col; + + while (ptr[col] != NUL + && !vim_isdigit(ptr[col]) + && !(doalp && ASCII_ISALPHA(ptr[col]))) + col += MB_PTR2LEN(ptr + col); + + while (col > 0 + && vim_isdigit(ptr[col - 1]) + && !(doalp && ASCII_ISALPHA(ptr[col]))) + { + --col; +#ifdef FEAT_MBYTE + if (has_mbyte) + col -= (*mb_head_off)(ptr, ptr + col); +#endif + } + } } - else - { - /* - * Search forward and then backward to find the start of number. - */ - col = curwin->w_cursor.col; - while (ptr[col] != NUL + if (visual) + { + while (ptr[col] != NUL && length > 0 && !vim_isdigit(ptr[col]) && !(doalp && ASCII_ISALPHA(ptr[col]))) - ++col; + { + int mb_len = MB_PTR2LEN(ptr + col); - while (col > 0 - && vim_isdigit(ptr[col - 1]) - && !(doalp && ASCII_ISALPHA(ptr[col]))) - --col; + col += mb_len; + length -= mb_len; + } + + if (length == 0) + goto theend; + + if (col > pos->col && ptr[col - 1] == '-' +#ifdef FEAT_MBYTE + && (!has_mbyte || + !(*mb_head_off)(ptr, ptr + col - 1)) +#endif + ) + { + negative = TRUE; + was_positive = FALSE; + } } /* * If a number was found, and saving for undo works, replace the number. */ firstdigit = ptr[col]; - RLADDSUBFIX(ptr); - if ((!VIM_ISDIGIT(firstdigit) && !(doalp && ASCII_ISALPHA(firstdigit))) - || u_save_cursor() != OK) + if (!VIM_ISDIGIT(firstdigit) && !(doalp && ASCII_ISALPHA(firstdigit))) { beep_flush(); - return FAIL; + goto theend; } - /* get ptr again, because u_save() may have changed it */ - ptr = ml_get_curline(); - RLADDSUBFIX(ptr); - if (doalp && ASCII_ISALPHA(firstdigit)) { /* decrement or increment alphabetic character */ - if (command == Ctrl_X) + if (op_type == OP_NR_SUB) { if (CharOrd(firstdigit) < Prenum1) { @@ -5474,58 +5853,75 @@ do_addsub(command, Prenum1) #endif } curwin->w_cursor.col = col; + if (!did_change) + startpos = curwin->w_cursor; + did_change = TRUE; (void)del_char(FALSE); ins_char(firstdigit); + endpos = curwin->w_cursor; + curwin->w_cursor.col = col; } else { - negative = FALSE; - if (col > 0 && ptr[col - 1] == '-') /* negative number */ + if (col > 0 && ptr[col - 1] == '-' +#ifdef FEAT_MBYTE + && (!has_mbyte || + !(*mb_head_off)(ptr, ptr + col - 1)) +#endif + && !visual) { + /* negative number */ --col; negative = TRUE; } - /* get the number value (unsigned) */ - vim_str2nr(ptr + col, &hex, &length, dooct, dohex, NULL, &n); + if (visual && VIsual_mode != 'V') + maxlen = (curbuf->b_visual.vi_curswant == MAXCOL + ? (int)STRLEN(ptr) - col + : length); - /* ignore leading '-' for hex and octal numbers */ - if (hex && negative) + vim_str2nr(ptr + col, &pre, &length, + 0 + (dobin ? STR2NR_BIN : 0) + + (dooct ? STR2NR_OCT : 0) + + (dohex ? STR2NR_HEX : 0), + NULL, &n, maxlen); + + /* ignore leading '-' for hex and octal and bin numbers */ + if (pre && negative) { ++col; --length; negative = FALSE; } - /* add or subtract */ subtract = FALSE; - if (command == Ctrl_X) + if (op_type == OP_NR_SUB) subtract ^= TRUE; if (negative) subtract ^= TRUE; oldn = n; if (subtract) - n -= (unsigned long)Prenum1; + n -= (uvarnumber_T)Prenum1; else - n += (unsigned long)Prenum1; - + n += (uvarnumber_T)Prenum1; /* handle wraparound for decimal numbers */ - if (!hex) + if (!pre) { if (subtract) { if (n > oldn) { - n = 1 + (n ^ (unsigned long)-1); + n = 1 + (n ^ (uvarnumber_T)-1); negative ^= TRUE; } } - else /* add */ + else { + /* add */ if (n < oldn) { - n = (n ^ (unsigned long)-1); + n = (n ^ (uvarnumber_T)-1); negative ^= TRUE; } } @@ -5533,15 +5929,25 @@ do_addsub(command, Prenum1) negative = FALSE; } + if (visual && !was_positive && !negative && col > 0) + { + /* need to remove the '-' */ + col--; + length++; + } + /* * Delete the old number. */ curwin->w_cursor.col = col; + if (!did_change) + startpos = curwin->w_cursor; + did_change = TRUE; todel = length; c = gchar_cursor(); /* - * Don't include the '-' in the length, only the length of the part - * after it is kept the same. + * Don't include the '-' in the length, only the length of the + * part after it is kept the same. */ if (c == '-') --length; @@ -5561,39 +5967,59 @@ do_addsub(command, Prenum1) /* * Prepare the leading characters in buf1[]. - * When there are many leading zeros it could be very long. Allocate - * a bit too much. + * When there are many leading zeros it could be very long. + * Allocate a bit too much. */ buf1 = alloc((unsigned)length + NUMBUFLEN); if (buf1 == NULL) - return FAIL; + goto theend; ptr = buf1; - if (negative) + if (negative && (!visual || was_positive)) { *ptr++ = '-'; } - if (hex) + if (pre) { *ptr++ = '0'; --length; } - if (hex == 'x' || hex == 'X') + if (pre == 'b' || pre == 'B' || + pre == 'x' || pre == 'X') { - *ptr++ = hex; + *ptr++ = pre; --length; } /* * Put the number characters in buf2[]. */ - if (hex == 0) - sprintf((char *)buf2, "%lu", n); - else if (hex == '0') - sprintf((char *)buf2, "%lo", n); - else if (hex && hexupper) - sprintf((char *)buf2, "%lX", n); + if (pre == 'b' || pre == 'B') + { + int i; + int bit = 0; + int bits = sizeof(uvarnumber_T) * 8; + + /* leading zeros */ + for (bit = bits; bit > 0; bit--) + if ((n >> (bit - 1)) & 0x1) break; + + for (i = 0; bit > 0; bit--) + buf2[i++] = ((n >> (bit - 1)) & 0x1) ? '1' : '0'; + + buf2[i] = '\0'; + } + else if (pre == 0) + vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", + (long long unsigned)n); + else if (pre == '0') + vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", + (long long unsigned)n); + else if (pre && hexupper) + vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", + (long long unsigned)n); else - sprintf((char *)buf2, "%lx", n); + vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", + (long long unsigned)n); length -= (int)STRLEN(buf2); /* @@ -5602,28 +6028,74 @@ do_addsub(command, Prenum1) * Don't do this when * the result may look like an octal number. */ - if (firstdigit == '0' && !(dooct && hex == 0)) + if (firstdigit == '0' && !(dooct && pre == 0)) while (length-- > 0) *ptr++ = '0'; *ptr = NUL; STRCAT(buf1, buf2); ins_str(buf1); /* insert the new number */ vim_free(buf1); + endpos = curwin->w_cursor; + if (did_change && curwin->w_cursor.col) + --curwin->w_cursor.col; } - --curwin->w_cursor.col; - curwin->w_set_curswant = TRUE; -#ifdef FEAT_RIGHTLEFT - ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE); - RLADDSUBFIX(ptr); -#endif - return OK; + + if (did_change) + { + /* set the '[ and '] marks */ + curbuf->b_op_start = startpos; + curbuf->b_op_end = endpos; + if (curbuf->b_op_end.col > 0) + --curbuf->b_op_end.col; + } + +theend: + if (visual) + curwin->w_cursor = save_cursor; + else if (did_change) + curwin->w_set_curswant = TRUE; + + return did_change; } #ifdef FEAT_VIMINFO + +static yankreg_T *y_read_regs = NULL; + +#define REG_PREVIOUS 1 +#define REG_EXEC 2 + +/* + * Prepare for reading viminfo registers when writing viminfo later. + */ + void +prepare_viminfo_registers(void) +{ + y_read_regs = (yankreg_T *)alloc_clear(NUM_REGISTERS + * (int)sizeof(yankreg_T)); +} + + void +finish_viminfo_registers(void) +{ + int i; + int j; + + if (y_read_regs != NULL) + { + for (i = 0; i < NUM_REGISTERS; ++i) + if (y_read_regs[i].y_array != NULL) + { + for (j = 0; j < y_read_regs[i].y_size; j++) + vim_free(y_read_regs[i].y_array[j]); + vim_free(y_read_regs[i].y_array); + } + VIM_CLEAR(y_read_regs); + } +} + int -read_viminfo_register(virp, force) - vir_T *virp; - int force; +read_viminfo_register(vir_T *virp, int force) { int eof; int do_it = TRUE; @@ -5633,6 +6105,8 @@ read_viminfo_register(virp, force) int set_prev = FALSE; char_u *str; char_u **array = NULL; + int new_type = MCHAR; /* init to shut up compiler */ + colnr_T new_width = 0; /* init to shut up compiler */ /* We only get here (hopefully) if line[0] == '"' */ str = virp->vir_line + 1; @@ -5665,21 +6139,25 @@ read_viminfo_register(virp, force) limit = 100; /* Optimized for registers containing <= 100 lines */ if (do_it) { + /* + * Build the new register in array[]. + * y_array is kept as-is until done. + * The "do_it" flag is reset when something is wrong, in which case + * array[] needs to be freed. + */ if (set_prev) y_previous = y_current; - vim_free(y_current->y_array); - array = y_current->y_array = - (char_u **)alloc((unsigned)(limit * sizeof(char_u *))); + array = (char_u **)alloc((unsigned)(limit * sizeof(char_u *))); str = skipwhite(skiptowhite(str)); if (STRNCMP(str, "CHAR", 4) == 0) - y_current->y_type = MCHAR; + new_type = MCHAR; else if (STRNCMP(str, "BLOCK", 5) == 0) - y_current->y_type = MBLOCK; + new_type = MBLOCK; else - y_current->y_type = MLINE; + new_type = MLINE; /* get the block width; if it's missing we get a zero, which is OK */ str = skipwhite(skiptowhite(str)); - y_current->y_width = getdigits(&str); + new_width = getdigits(&str); } while (!(eof = viminfo_readline(virp)) @@ -5687,54 +6165,172 @@ read_viminfo_register(virp, force) { if (do_it) { - if (size >= limit) + if (size == limit) { - y_current->y_array = (char_u **) + char_u **new_array = (char_u **) alloc((unsigned)(limit * 2 * sizeof(char_u *))); + + if (new_array == NULL) + { + do_it = FALSE; + break; + } for (i = 0; i < limit; i++) - y_current->y_array[i] = array[i]; + new_array[i] = array[i]; vim_free(array); + array = new_array; limit *= 2; - array = y_current->y_array; } str = viminfo_readstring(virp, 1, TRUE); if (str != NULL) array[size++] = str; else + /* error, don't store the result */ do_it = FALSE; } } + if (do_it) { + /* free y_array[] */ + for (i = 0; i < y_current->y_size; i++) + vim_free(y_current->y_array[i]); + vim_free(y_current->y_array); + + y_current->y_type = new_type; + y_current->y_width = new_width; + y_current->y_size = size; + y_current->y_time_set = 0; if (size == 0) { - vim_free(array); y_current->y_array = NULL; } - else if (size < limit) + else { + /* Move the lines from array[] to y_array[]. */ y_current->y_array = (char_u **)alloc((unsigned)(size * sizeof(char_u *))); for (i = 0; i < size; i++) - y_current->y_array[i] = array[i]; - vim_free(array); + { + if (y_current->y_array == NULL) + vim_free(array[i]); + else + y_current->y_array[i] = array[i]; + } } - y_current->y_size = size; } + else + { + /* Free array[] if it was filled. */ + for (i = 0; i < size; i++) + vim_free(array[i]); + } + vim_free(array); + return eof; } +/* + * Accept a new style register line from the viminfo, store it when it's new. + */ void -write_viminfo_registers(fp) - FILE *fp; +handle_viminfo_register(garray_T *values, int force) { - int i, j; - char_u *type; - char_u c; - int num_lines; - int max_num_lines; - int max_kbyte; - long len; + bval_T *vp = (bval_T *)values->ga_data; + int flags; + int name; + int type; + int linecount; + int width; + time_t timestamp; + yankreg_T *y_ptr; + int i; + + /* Check the format: + * |{bartype},{flags},{name},{type}, + * {linecount},{width},{timestamp},"line1","line2" + */ + if (values->ga_len < 6 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || vp[2].bv_type != BVAL_NR + || vp[3].bv_type != BVAL_NR + || vp[4].bv_type != BVAL_NR + || vp[5].bv_type != BVAL_NR) + return; + flags = vp[0].bv_nr; + name = vp[1].bv_nr; + if (name < 0 || name >= NUM_REGISTERS) + return; + type = vp[2].bv_nr; + if (type != MCHAR && type != MLINE && type != MBLOCK) + return; + linecount = vp[3].bv_nr; + if (values->ga_len < 6 + linecount) + return; + width = vp[4].bv_nr; + if (width < 0) + return; + + if (y_read_regs != NULL) + /* Reading viminfo for merging and writing. Store the register + * content, don't update the current registers. */ + y_ptr = &y_read_regs[name]; + else + y_ptr = &y_regs[name]; + + /* Do not overwrite unless forced or the timestamp is newer. */ + timestamp = (time_t)vp[5].bv_nr; + if (y_ptr->y_array != NULL && !force + && (timestamp == 0 || y_ptr->y_time_set > timestamp)) + return; + + if (y_ptr->y_array != NULL) + for (i = 0; i < y_ptr->y_size; i++) + vim_free(y_ptr->y_array[i]); + vim_free(y_ptr->y_array); + + if (y_read_regs == NULL) + { + if (flags & REG_PREVIOUS) + y_previous = y_ptr; + if ((flags & REG_EXEC) && (force || execreg_lastc == NUL)) + execreg_lastc = get_register_name(name); + } + y_ptr->y_type = type; + y_ptr->y_width = width; + y_ptr->y_size = linecount; + y_ptr->y_time_set = timestamp; + if (linecount == 0) + y_ptr->y_array = NULL; + else + { + y_ptr->y_array = + (char_u **)alloc((unsigned)(linecount * sizeof(char_u *))); + for (i = 0; i < linecount; i++) + { + if (vp[i + 6].bv_allocated) + { + y_ptr->y_array[i] = vp[i + 6].bv_string; + vp[i + 6].bv_string = NULL; + } + else + y_ptr->y_array[i] = vim_strsave(vp[i + 6].bv_string); + } + } +} + + void +write_viminfo_registers(FILE *fp) +{ + int i, j; + char_u *type; + char_u c; + int num_lines; + int max_num_lines; + int max_kbyte; + long len; + yankreg_T *y_ptr; fputs(_("\n# Registers:\n"), fp); @@ -5750,8 +6346,6 @@ write_viminfo_registers(fp) for (i = 0; i < NUM_REGISTERS; i++) { - if (y_regs[i].y_array == NULL) - continue; #ifdef FEAT_CLIPBOARD /* Skip '*'/'+' register, we don't want them back next time */ if (i == STAR_REGISTER || i == PLUS_REGISTER) @@ -5762,11 +6356,23 @@ write_viminfo_registers(fp) if (i == TILDE_REGISTER) continue; #endif + /* When reading viminfo for merging and writing: Use the register from + * viminfo if it's newer. */ + if (y_read_regs != NULL + && y_read_regs[i].y_array != NULL + && (y_regs[i].y_array == NULL || + y_read_regs[i].y_time_set > y_regs[i].y_time_set)) + y_ptr = &y_read_regs[i]; + else if (y_regs[i].y_array == NULL) + continue; + else + y_ptr = &y_regs[i]; + /* Skip empty registers. */ - num_lines = y_regs[i].y_size; + num_lines = y_ptr->y_size; if (num_lines == 0 - || (num_lines == 1 && y_regs[i].y_type == MCHAR - && *y_regs[i].y_array[0] == NUL)) + || (num_lines == 1 && y_ptr->y_type == MCHAR + && *y_ptr->y_array[0] == NUL)) continue; if (max_kbyte > 0) @@ -5774,12 +6380,12 @@ write_viminfo_registers(fp) /* Skip register if there is more text than the maximum size. */ len = 0; for (j = 0; j < num_lines; j++) - len += (long)STRLEN(y_regs[i].y_array[j]) + 1L; + len += (long)STRLEN(y_ptr->y_array[j]) + 1L; if (len > (long)max_kbyte * 1024L) continue; } - switch (y_regs[i].y_type) + switch (y_ptr->y_type) { case MLINE: type = (char_u *)"LINE"; @@ -5792,7 +6398,7 @@ write_viminfo_registers(fp) break; default: sprintf((char *)IObuff, _("E574: Unknown register type %d"), - y_regs[i].y_type); + y_ptr->y_type); emsg(IObuff); type = (char_u *)"LINE"; break; @@ -5803,7 +6409,7 @@ write_viminfo_registers(fp) fprintf(fp, "\"%c", c); if (c == execreg_lastc) fprintf(fp, "@"); - fprintf(fp, "\t%s\t%d\n", type, (int)y_regs[i].y_width); + fprintf(fp, "\t%s\t%d\n", type, (int)y_ptr->y_width); /* If max_num_lines < 0, then we save ALL the lines in the register */ if (max_num_lines > 0 && num_lines > max_num_lines) @@ -5811,7 +6417,36 @@ write_viminfo_registers(fp) for (j = 0; j < num_lines; j++) { putc('\t', fp); - viminfo_writestring(fp, y_regs[i].y_array[j]); + viminfo_writestring(fp, y_ptr->y_array[j]); + } + + { + int flags = 0; + int remaining; + + /* New style with a bar line. Format: + * |{bartype},{flags},{name},{type}, + * {linecount},{width},{timestamp},"line1","line2" + * flags: REG_PREVIOUS - register is y_previous + * REG_EXEC - used for @@ + */ + if (y_previous == &y_regs[i]) + flags |= REG_PREVIOUS; + if (c == execreg_lastc) + flags |= REG_EXEC; + fprintf(fp, "|%d,%d,%d,%d,%d,%d,%ld", BARTYPE_REGISTER, flags, + i, y_ptr->y_type, num_lines, (int)y_ptr->y_width, + (long)y_ptr->y_time_set); + /* 11 chars for type/flags/name/type, 3 * 20 for numbers */ + remaining = LSIZE - 71; + for (j = 0; j < num_lines; j++) + { + putc(',', fp); + --remaining; + remaining = barline_writestring(fp, y_ptr->y_array[j], + remaining); + } + putc('\n', fp); } } } @@ -5838,16 +6473,16 @@ write_viminfo_registers(fp) /* * Routine to export any final X selection we had to the environment - * so that the text is still available after vim has exited. X selections + * so that the text is still available after Vim has exited. X selections * only exist while the owning application exists, so we write to the * permanent (while X runs) store CUT_BUFFER0. * Dump the CLIPBOARD selection if we own it (it's logically the more * 'permanent' of the two), otherwise the PRIMARY one. * For now, use a hard-coded sanity limit of 1Mb of data. */ -#if defined(FEAT_X11) && defined(FEAT_CLIPBOARD) +#if (defined(FEAT_X11) && defined(FEAT_CLIPBOARD)) || defined(PROTO) void -x11_export_final_selection() +x11_export_final_selection(void) { Display *dpy; char_u *str = NULL; @@ -5927,10 +6562,9 @@ x11_export_final_selection() #endif void -clip_free_selection(cbd) - VimClipboard *cbd; +clip_free_selection(VimClipboard *cbd) { - struct yankreg *y_ptr = y_current; + yankreg_T *y_ptr = y_current; if (cbd == &clip_plus) y_current = &y_regs[PLUS_REGISTER]; @@ -5945,10 +6579,9 @@ clip_free_selection(cbd) * Get the selected text and put it in the gui selection register '*' or '+'. */ void -clip_get_selection(cbd) - VimClipboard *cbd; +clip_get_selection(VimClipboard *cbd) { - struct yankreg *old_y_previous, *old_y_current; + yankreg_T *old_y_previous, *old_y_current; pos_T old_cursor; pos_T old_visual; int old_visual_mode; @@ -5994,7 +6627,7 @@ clip_get_selection(cbd) VIsual = old_visual; VIsual_mode = old_visual_mode; } - else + else if (!is_clipboard_needs_update()) { clip_free_selection(cbd); @@ -6007,13 +6640,13 @@ clip_get_selection(cbd) * Convert from the GUI selection string into the '*'/'+' register. */ void -clip_yank_selection(type, str, len, cbd) - int type; - char_u *str; - long len; - VimClipboard *cbd; +clip_yank_selection( + int type, + char_u *str, + long len, + VimClipboard *cbd) { - struct yankreg *y_ptr; + yankreg_T *y_ptr; if (cbd == &clip_plus) y_ptr = &y_regs[PLUS_REGISTER]; @@ -6031,16 +6664,13 @@ clip_yank_selection(type, str, len, cbd) * Returns the motion type, or -1 for failure. */ int -clip_convert_selection(str, len, cbd) - char_u **str; - long_u *len; - VimClipboard *cbd; +clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd) { char_u *p; int lnum; int i, j; int_u eolsize; - struct yankreg *y_ptr; + yankreg_T *y_ptr; if (cbd == &clip_plus) y_ptr = &y_regs[PLUS_REGISTER]; @@ -6099,7 +6729,7 @@ clip_convert_selection(str, len, cbd) * If we have written to a clipboard register, send the text to the clipboard. */ static void -may_set_selection() +may_set_selection(void) { if (y_current == &(y_regs[STAR_REGISTER]) && clip_star.available) { @@ -6121,11 +6751,9 @@ may_set_selection() * Replace the contents of the '~' register with str. */ void -dnd_yank_drag_data(str, len) - char_u *str; - long len; +dnd_yank_drag_data(char_u *str, long len) { - struct yankreg *curr; + yankreg_T *curr; curr = y_current; y_current = &y_regs[TILDE_REGISTER]; @@ -6143,9 +6771,7 @@ dnd_yank_drag_data(str, len) * Returns MAUTO for error. */ char_u -get_reg_type(regname, reglen) - int regname; - long *reglen; +get_reg_type(int regname, long *reglen) { switch (regname) { @@ -6170,7 +6796,7 @@ get_reg_type(regname, reglen) #endif if (regname != NUL && !valid_yank_reg(regname, FALSE)) - return MAUTO; + return MAUTO; get_yank_register(regname, FALSE); @@ -6183,16 +6809,14 @@ get_reg_type(regname, reglen) return MAUTO; } -static char_u *getreg_wrap_one_line __ARGS((char_u *s, int flags)); +static char_u *getreg_wrap_one_line(char_u *s, int flags); /* * When "flags" has GREG_LIST return a list with text "s". * Otherwise just return "s". */ static char_u * -getreg_wrap_one_line(s, flags) - char_u *s; - int flags; +getreg_wrap_one_line(char_u *s, int flags) { if (flags & GREG_LIST) { @@ -6202,7 +6826,7 @@ getreg_wrap_one_line(s, flags) { if (list_append_string(list, NULL, -1) == FAIL) { - list_free(list, TRUE); + list_free(list); return NULL; } list->lv_first->li_tv.vval.v_string = s; @@ -6223,9 +6847,7 @@ getreg_wrap_one_line(s, flags) * GREG_LIST Return a list of lines in place of a single string. */ char_u * -get_reg_contents(regname, flags) - int regname; - int flags; +get_reg_contents(int regname, int flags) { long i; char_u *retval; @@ -6278,7 +6900,7 @@ get_reg_contents(regname, flags) error = TRUE; if (error) { - list_free(list, TRUE); + list_free(list); return NULL; } return (char_u *)list; @@ -6326,12 +6948,12 @@ get_reg_contents(regname, flags) } static int -init_write_reg(name, old_y_previous, old_y_current, must_append, yank_type) - int name; - struct yankreg **old_y_previous; - struct yankreg **old_y_current; - int must_append; - int *yank_type UNUSED; +init_write_reg( + int name, + yankreg_T **old_y_previous, + yankreg_T **old_y_current, + int must_append, + int *yank_type UNUSED) { if (!valid_yank_reg(name, TRUE)) /* check for valid reg name */ { @@ -6350,10 +6972,10 @@ init_write_reg(name, old_y_previous, old_y_current, must_append, yank_type) } static void -finish_write_reg(name, old_y_previous, old_y_current) - int name; - struct yankreg *old_y_previous; - struct yankreg *old_y_current; +finish_write_reg( + int name, + yankreg_T *old_y_previous, + yankreg_T *old_y_current) { # ifdef FEAT_CLIPBOARD /* Send text of clipboard register to the clipboard. */ @@ -6376,25 +6998,25 @@ finish_write_reg(name, old_y_previous, old_y_current) * If "str" ends in '\n' or '\r', use linewise, otherwise use characterwise. */ void -write_reg_contents(name, str, maxlen, must_append) - int name; - char_u *str; - int maxlen; - int must_append; +write_reg_contents( + int name, + char_u *str, + int maxlen, + int must_append) { write_reg_contents_ex(name, str, maxlen, must_append, MAUTO, 0L); } void -write_reg_contents_lst(name, strings, maxlen, must_append, yank_type, block_len) - int name; - char_u **strings; - int maxlen UNUSED; - int must_append; - int yank_type; - long block_len; +write_reg_contents_lst( + int name, + char_u **strings, + int maxlen UNUSED, + int must_append, + int yank_type, + long block_len) { - struct yankreg *old_y_previous, *old_y_current; + yankreg_T *old_y_previous, *old_y_current; if (name == '/' #ifdef FEAT_EVAL @@ -6431,16 +7053,16 @@ write_reg_contents_lst(name, strings, maxlen, must_append, yank_type, block_len) } void -write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len) - int name; - char_u *str; - int maxlen; - int must_append; - int yank_type; - long block_len; +write_reg_contents_ex( + int name, + char_u *str, + int maxlen, + int must_append, + int yank_type, + long block_len) { - struct yankreg *old_y_previous, *old_y_current; - long len; + yankreg_T *old_y_previous, *old_y_current; + long len; if (maxlen >= 0) len = maxlen; @@ -6454,6 +7076,27 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len) return; } + if (name == '#') + { + buf_T *buf; + + if (VIM_ISDIGIT(*str)) + { + int num = atoi((char *)str); + + buf = buflist_findnr(num); + if (buf == NULL) + EMSGN(_(e_nobufnr), (long)num); + } + else + buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str), + TRUE, FALSE, FALSE)); + if (buf == NULL) + return; + curwin->w_alt_fnum = buf->b_fnum; + return; + } + #ifdef FEAT_EVAL if (name == '=') { @@ -6492,13 +7135,13 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len) * is appended. */ static void -str_to_reg(y_ptr, yank_type, str, len, blocklen, str_list) - struct yankreg *y_ptr; /* pointer to yank register */ - int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */ - char_u *str; /* string to put in register */ - long len; /* length of string */ - long blocklen; /* width of Visual block */ - int str_list; /* TRUE if str is char_u ** */ +str_to_reg( + yankreg_T *y_ptr, /* pointer to yank register */ + int yank_type, /* MCHAR, MLINE, MBLOCK, MAUTO */ + char_u *str, /* string to put in register */ + long len, /* length of string */ + long blocklen, /* width of Visual block */ + int str_list) /* TRUE if str is char_u ** */ { int type; /* MCHAR, MLINE or MBLOCK */ int lnum; @@ -6549,6 +7192,13 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen, str_list) } } + /* Without any lines make the register empty. */ + if (y_ptr->y_size + newlines == 0) + { + VIM_CLEAR(y_ptr->y_array); + return; + } + /* * Allocate an array to hold the pointers to the new register lines. * If the register was not empty, move the existing lines to the new array. @@ -6620,17 +7270,19 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen, str_list) y_ptr->y_width = (blocklen < 0 ? maxlen - 1 : blocklen); else y_ptr->y_width = 0; +#ifdef FEAT_VIMINFO + y_ptr->y_time_set = vim_time(); +#endif } #endif /* FEAT_CLIPBOARD || FEAT_EVAL || PROTO */ void -clear_oparg(oap) - oparg_T *oap; +clear_oparg(oparg_T *oap) { vim_memset(oap, 0, sizeof(oparg_T)); } -static long line_count_info __ARGS((char_u *line, long *wc, long *cc, long limit, int eol_size)); +static varnumber_T line_count_info(char_u *line, varnumber_T *wc, varnumber_T *cc, varnumber_T limit, int eol_size); /* * Count the number of bytes, characters and "words" in a line. @@ -6646,17 +7298,17 @@ static long line_count_info __ARGS((char_u *line, long *wc, long *cc, long limit * case, eol_size will be added to the character count to account for * the size of the EOL character. */ - static long -line_count_info(line, wc, cc, limit, eol_size) - char_u *line; - long *wc; - long *cc; - long limit; - int eol_size; + static varnumber_T +line_count_info( + char_u *line, + varnumber_T *wc, + varnumber_T *cc, + varnumber_T limit, + int eol_size) { - long i; - long words = 0; - long chars = 0; + varnumber_T i; + varnumber_T words = 0; + varnumber_T chars = 0; int is_word = 0; for (i = 0; i < limit && line[i] != NUL; ) @@ -6697,22 +7349,26 @@ line_count_info(line, wc, cc, limit, eol_size) * Give some info about the position of the cursor (for "g CTRL-G"). * In Visual mode, give some info about the selected region. (In this case, * the *_count_cursor variables store running totals for the selection.) + * When "dict" is not NULL store the info there instead of showing it. */ void -cursor_pos_info() +cursor_pos_info(dict_T *dict) { char_u *p; char_u buf1[50]; char_u buf2[40]; linenr_T lnum; - long byte_count = 0; - long byte_count_cursor = 0; - long char_count = 0; - long char_count_cursor = 0; - long word_count = 0; - long word_count_cursor = 0; + varnumber_T byte_count = 0; +#ifdef FEAT_MBYTE + varnumber_T bom_count = 0; +#endif + varnumber_T byte_count_cursor = 0; + varnumber_T char_count = 0; + varnumber_T char_count_cursor = 0; + varnumber_T word_count = 0; + varnumber_T word_count_cursor = 0; int eol_size; - long last_check = 100000L; + varnumber_T last_check = 100000L; long line_count_selected = 0; pos_T min_pos, max_pos; oparg_T oparg; @@ -6723,7 +7379,11 @@ cursor_pos_info() */ if (curbuf->b_ml.ml_flags & ML_EMPTY) { - MSG(_(no_lines_msg)); + if (dict == NULL) + { + MSG(_(no_lines_msg)); + return; + } } else { @@ -6734,7 +7394,7 @@ cursor_pos_info() if (VIsual_active) { - if (lt(VIsual, curwin->w_cursor)) + if (LT_POS(VIsual, curwin->w_cursor)) { min_pos = VIsual; max_pos = curwin->w_cursor; @@ -6829,7 +7489,7 @@ cursor_pos_info() &char_count_cursor, len, eol_size); if (lnum == curbuf->b_ml.ml_line_count && !curbuf->b_p_eol - && curbuf->b_p_bin + && (curbuf->b_p_bin || !curbuf->b_p_fixeol) && (long)STRLEN(s) < len) byte_count_cursor -= eol_size; } @@ -6844,86 +7504,117 @@ cursor_pos_info() byte_count_cursor = byte_count + line_count_info(ml_get(lnum), &word_count_cursor, &char_count_cursor, - (long)(curwin->w_cursor.col + 1), eol_size); + (varnumber_T)(curwin->w_cursor.col + 1), + eol_size); } } /* Add to the running totals */ byte_count += line_count_info(ml_get(lnum), &word_count, - &char_count, (long)MAXCOL, eol_size); + &char_count, (varnumber_T)MAXCOL, + eol_size); } /* Correction for when last line doesn't have an EOL. */ - if (!curbuf->b_p_eol && curbuf->b_p_bin) + if (!curbuf->b_p_eol && (curbuf->b_p_bin || !curbuf->b_p_fixeol)) byte_count -= eol_size; - if (VIsual_active) + if (dict == NULL) { - if (VIsual_mode == Ctrl_V && curwin->w_curswant < MAXCOL) + if (VIsual_active) { - getvcols(curwin, &min_pos, &max_pos, &min_pos.col, - &max_pos.col); - vim_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "), - (long)(oparg.end_vcol - oparg.start_vcol + 1)); + if (VIsual_mode == Ctrl_V && curwin->w_curswant < MAXCOL) + { + getvcols(curwin, &min_pos, &max_pos, &min_pos.col, + &max_pos.col); + vim_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "), + (long)(oparg.end_vcol - oparg.start_vcol + 1)); + } + else + buf1[0] = NUL; + + if (char_count_cursor == byte_count_cursor + && char_count == byte_count) + vim_snprintf((char *)IObuff, IOSIZE, + _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes"), + buf1, line_count_selected, + (long)curbuf->b_ml.ml_line_count, + (long long)word_count_cursor, + (long long)word_count, + (long long)byte_count_cursor, + (long long)byte_count); + else + vim_snprintf((char *)IObuff, IOSIZE, + _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of %lld Bytes"), + buf1, line_count_selected, + (long)curbuf->b_ml.ml_line_count, + (long long)word_count_cursor, + (long long)word_count, + (long long)char_count_cursor, + (long long)char_count, + (long long)byte_count_cursor, + (long long)byte_count); } else - buf1[0] = NUL; - - if (char_count_cursor == byte_count_cursor - && char_count == byte_count) - vim_snprintf((char *)IObuff, IOSIZE, - _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"), - buf1, line_count_selected, + { + p = ml_get_curline(); + validate_virtcol(); + col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1, + (int)curwin->w_virtcol + 1); + col_print(buf2, sizeof(buf2), (int)STRLEN(p), + linetabsize(p)); + + if (char_count_cursor == byte_count_cursor + && char_count == byte_count) + vim_snprintf((char *)IObuff, IOSIZE, + _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"), + (char *)buf1, (char *)buf2, + (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - byte_count_cursor, byte_count); - else - vim_snprintf((char *)IObuff, IOSIZE, - _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"), - buf1, line_count_selected, + (long long)word_count_cursor, (long long)word_count, + (long long)byte_count_cursor, (long long)byte_count); + else + vim_snprintf((char *)IObuff, IOSIZE, + _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %lld of %lld"), + (char *)buf1, (char *)buf2, + (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - char_count_cursor, char_count, - byte_count_cursor, byte_count); - } - else - { - p = ml_get_curline(); - validate_virtcol(); - col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1, - (int)curwin->w_virtcol + 1); - col_print(buf2, sizeof(buf2), (int)STRLEN(p), - linetabsize(p)); - - if (char_count_cursor == byte_count_cursor - && char_count == byte_count) - vim_snprintf((char *)IObuff, IOSIZE, - _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"), - (char *)buf1, (char *)buf2, - (long)curwin->w_cursor.lnum, - (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - byte_count_cursor, byte_count); - else - vim_snprintf((char *)IObuff, IOSIZE, - _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld"), - (char *)buf1, (char *)buf2, - (long)curwin->w_cursor.lnum, - (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - char_count_cursor, char_count, - byte_count_cursor, byte_count); + (long long)word_count_cursor, (long long)word_count, + (long long)char_count_cursor, (long long)char_count, + (long long)byte_count_cursor, (long long)byte_count); + } } #ifdef FEAT_MBYTE - byte_count = bomb_size(); - if (byte_count > 0) - sprintf((char *)IObuff + STRLEN(IObuff), _("(+%ld for BOM)"), - byte_count); -#endif - /* Don't shorten this message, the user asked for it. */ - p = p_shm; - p_shm = (char_u *)""; - msg(IObuff); - p_shm = p; + bom_count = bomb_size(); + if (bom_count > 0) + vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, + _("(+%lld for BOM)"), (long long)bom_count); +#endif + if (dict == NULL) + { + /* Don't shorten this message, the user asked for it. */ + p = p_shm; + p_shm = (char_u *)""; + msg(IObuff); + p_shm = p; + } } +#if defined(FEAT_EVAL) + if (dict != NULL) + { + dict_add_nr_str(dict, "words", word_count, NULL); + dict_add_nr_str(dict, "chars", char_count, NULL); + dict_add_nr_str(dict, "bytes", byte_count +# ifdef FEAT_MBYTE + + bom_count +# endif + , NULL); + dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes", + byte_count_cursor, NULL); + dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars", + char_count_cursor, NULL); + dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words", + word_count_cursor, NULL); + } +#endif } diff --git a/src/option.c b/src/option.c index e815218272..8f1e13e467 100644 --- a/src/option.c +++ b/src/option.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -22,7 +22,7 @@ * - If it's a list of flags, add some code in do_set(), search for WW_ALL. * - When adding an option with expansion (P_EXPAND), but with a different * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. - * - Add documentation! One line in doc/help.txt, full description in + * - Add documentation! One line in doc/quickref.txt, full description in * options.txt, and any other related places. * - Add an entry in runtime/optwin.vim. * When making changes: @@ -56,9 +56,10 @@ */ #define PV_AI OPT_BUF(BV_AI) #define PV_AR OPT_BOTH(OPT_BUF(BV_AR)) +#define PV_BKC OPT_BOTH(OPT_BUF(BV_BKC)) +#define PV_BH OPT_BUF(BV_BH) +#define PV_BT OPT_BUF(BV_BT) #ifdef FEAT_QUICKFIX -# define PV_BH OPT_BUF(BV_BH) -# define PV_BT OPT_BUF(BV_BT) # define PV_EFM OPT_BOTH(OPT_BUF(BV_EFM)) # define PV_GP OPT_BOTH(OPT_BUF(BV_GP)) # define PV_MP OPT_BOTH(OPT_BUF(BV_MP)) @@ -97,6 +98,7 @@ # define PV_INC OPT_BOTH(OPT_BUF(BV_INC)) #endif #define PV_EOL OPT_BUF(BV_EOL) +#define PV_FIXEOL OPT_BUF(BV_FIXEOL) #define PV_EP OPT_BOTH(OPT_BUF(BV_EP)) #define PV_ET OPT_BUF(BV_ET) #ifdef FEAT_MBYTE @@ -105,15 +107,14 @@ #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR)) #endif +#define PV_FP OPT_BOTH(OPT_BUF(BV_FP)) #ifdef FEAT_EVAL # define PV_FEX OPT_BUF(BV_FEX) #endif #define PV_FF OPT_BUF(BV_FF) #define PV_FLP OPT_BUF(BV_FLP) #define PV_FO OPT_BUF(BV_FO) -#ifdef FEAT_AUTOCMD -# define PV_FT OPT_BUF(BV_FT) -#endif +#define PV_FT OPT_BUF(BV_FT) #define PV_IMI OPT_BUF(BV_IMI) #define PV_IMS OPT_BUF(BV_IMS) #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) @@ -136,7 +137,13 @@ # define PV_LISP OPT_BUF(BV_LISP) # define PV_LW OPT_BOTH(OPT_BUF(BV_LW)) #endif +#ifdef FEAT_MBYTE +# define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC)) +#endif #define PV_MA OPT_BUF(BV_MA) +#ifdef USE_MIGEMO +# define PV_MIG OPT_BUF(BV_MIG) +#endif #define PV_ML OPT_BUF(BV_ML) #define PV_MOD OPT_BUF(BV_MOD) #define PV_MPS OPT_BUF(BV_MPS) @@ -156,9 +163,7 @@ #ifdef FEAT_SMARTINDENT # define PV_SI OPT_BUF(BV_SI) #endif -#ifndef SHORT_FNAME -# define PV_SN OPT_BUF(BV_SN) -#endif +#define PV_SN OPT_BUF(BV_SN) #ifdef FEAT_SYN_HL # define PV_SMC OPT_BUF(BV_SMC) # define PV_SYN OPT_BUF(BV_SYN) @@ -175,6 +180,7 @@ #define PV_SW OPT_BUF(BV_SW) #define PV_SWF OPT_BUF(BV_SWF) #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS)) +#define PV_TC OPT_BOTH(OPT_BUF(BV_TC)) #define PV_TS OPT_BUF(BV_TS) #define PV_TW OPT_BUF(BV_TW) #define PV_TX OPT_BUF(BV_TX) @@ -220,16 +226,14 @@ #ifdef FEAT_LINEBREAK # define PV_NUW OPT_WIN(WV_NUW) #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) # define PV_PVW OPT_WIN(WV_PVW) #endif #ifdef FEAT_RIGHTLEFT # define PV_RL OPT_WIN(WV_RL) # define PV_RLC OPT_WIN(WV_RLC) #endif -#ifdef FEAT_SCROLLBIND -# define PV_SCBIND OPT_WIN(WV_SCBIND) -#endif +#define PV_SCBIND OPT_WIN(WV_SCBIND) #define PV_SCROLL OPT_WIN(WV_SCROLL) #ifdef FEAT_SPELL # define PV_SPELL OPT_WIN(WV_SPELL) @@ -243,20 +247,22 @@ # define PV_STL OPT_BOTH(OPT_WIN(WV_STL)) #endif #define PV_UL OPT_BOTH(OPT_BUF(BV_UL)) -#ifdef FEAT_WINDOWS # define PV_WFH OPT_WIN(WV_WFH) -#endif -#ifdef FEAT_VERTSPLIT # define PV_WFW OPT_WIN(WV_WFW) -#endif #define PV_WRAP OPT_WIN(WV_WRAP) -#ifdef FEAT_CURSORBIND -# define PV_CRBIND OPT_WIN(WV_CRBIND) -#endif +#define PV_CRBIND OPT_WIN(WV_CRBIND) #ifdef FEAT_CONCEAL # define PV_COCU OPT_WIN(WV_COCU) # define PV_COLE OPT_WIN(WV_COLE) #endif +#ifdef FEAT_TERMINAL +# define PV_TWK OPT_WIN(WV_TWK) +# define PV_TWS OPT_WIN(WV_TWS) +# define PV_TWSL OPT_BUF(BV_TWSL) +#endif +#ifdef FEAT_SIGNS +# define PV_SCL OPT_WIN(WV_SCL) +#endif /* WV_ and BV_ values get typecasted to this for the "indir" field */ typedef enum @@ -280,10 +286,8 @@ static int p_bin; #ifdef FEAT_MBYTE static int p_bomb; #endif -#if defined(FEAT_QUICKFIX) static char_u *p_bh; static char_u *p_bt; -#endif static int p_bl; static int p_ci; #ifdef FEAT_CINDENT @@ -308,6 +312,7 @@ static char_u *p_cfu; static char_u *p_ofu; #endif static int p_eol; +static int p_fixeol; static int p_et; #ifdef FEAT_MBYTE static char_u *p_fenc; @@ -315,9 +320,7 @@ static char_u *p_fenc; static char_u *p_ff; static char_u *p_fo; static char_u *p_flp; -#ifdef FEAT_AUTOCMD static char_u *p_ft; -#endif static long p_iminsert; static long p_imsearch; #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) @@ -342,6 +345,7 @@ static int p_ml; static int p_ma; #ifdef FEAT_GUI_MACVIM static int p_mmta; +static int p_mpfont; #endif static int p_mod; static char_u *p_mps; @@ -354,9 +358,7 @@ static int p_ro; #ifdef FEAT_SMARTINDENT static int p_si; #endif -#ifndef SHORT_FNAME static int p_sn; -#endif static long p_sts; #if defined(FEAT_SEARCHPATH) static char_u *p_sua; @@ -382,6 +384,9 @@ static long p_wm; #ifdef FEAT_KEYMAP static char_u *p_keymap; #endif +#ifdef FEAT_TERMINAL +static long p_twsl; /* 'termwinscroll' */ +#endif /* Saved values for when 'bin' is set. */ static int p_et_nobin; @@ -390,10 +395,11 @@ static long p_tw_nobin; static long p_wm_nobin; /* Saved values for when 'paste' is set */ +static int p_ai_nopaste; +static int p_et_nopaste; +static long p_sts_nopaste; static long p_tw_nopaste; static long p_wm_nopaste; -static long p_sts_nopaste; -static int p_ai_nopaste; struct vimoption { @@ -439,44 +445,51 @@ struct vimoption /* when option changed, what to display: */ #define P_RSTAT 0x1000 /* redraw status lines */ -#define P_RWIN 0x2000 /* redraw current window */ -#define P_RBUF 0x4000 /* redraw current buffer */ +#define P_RWIN 0x2000 /* redraw current window and recompute text */ +#define P_RBUF 0x4000 /* redraw current buffer and recompute text */ #define P_RALL 0x6000 /* redraw all windows */ #define P_RCLR 0x7000 /* clear and redraw all */ -#define P_COMMA 0x8000 /* comma separated list */ -#define P_NODUP 0x10000L /* don't allow duplicate strings */ -#define P_FLAGLIST 0x20000L /* list of single-char flags */ - -#define P_SECURE 0x40000L /* cannot change in modeline or secure mode */ -#define P_GETTEXT 0x80000L /* expand default value with _() */ -#define P_NOGLOB 0x100000L /* do not use local value for global vimrc */ -#define P_NFNAME 0x200000L /* only normal file name chars allowed */ -#define P_INSECURE 0x400000L /* option was set from a modeline */ -#define P_PRI_MKRC 0x800000L /* priority for :mkvimrc (setting option has - side effects) */ -#define P_NO_ML 0x1000000L /* not allowed in modeline */ -#define P_CURSWANT 0x2000000L /* update curswant required; not needed when +#define P_COMMA 0x8000 /* comma separated list */ +#define P_ONECOMMA 0x18000L /* P_COMMA and cannot have two consecutive + * commas */ +#define P_NODUP 0x20000L /* don't allow duplicate strings */ +#define P_FLAGLIST 0x40000L /* list of single-char flags */ + +#define P_SECURE 0x80000L /* cannot change in modeline or secure mode */ +#define P_GETTEXT 0x100000L /* expand default value with _() */ +#define P_NOGLOB 0x200000L /* do not use local value for global vimrc */ +#define P_NFNAME 0x400000L /* only normal file name chars allowed */ +#define P_INSECURE 0x800000L /* option was set from a modeline */ +#define P_PRI_MKRC 0x1000000L /* priority for :mkvimrc (setting option has + side effects) */ +#define P_NO_ML 0x2000000L /* not allowed in modeline */ +#define P_CURSWANT 0x4000000L /* update curswant required; not needed when * there is a redraw flag */ +#define P_NDNAME 0x8000000L /* only normal dir name chars allowed */ +#define P_RWINONLY 0x10000000L /* only redraw current window */ #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used * for the currency sign. */ -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) # define ISP_LATIN1 (char_u *)"@,~-255" #else # define ISP_LATIN1 (char_u *)"@,161-255" #endif -/* The 16 bit MS-DOS version is low on space, make the string as short as - * possible when compiling with few features. */ -#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \ - || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \ - || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL) -# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn" +# define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC" + +/* Default python version for pyx* commands */ +#if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) +# define DEFAULT_PYTHON_VER 0 +#elif defined(FEAT_PYTHON3) +# define DEFAULT_PYTHON_VER 3 +#elif defined(FEAT_PYTHON) +# define DEFAULT_PYTHON_VER 2 #else -# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" +# define DEFAULT_PYTHON_VER 0 #endif /* @@ -487,11 +500,7 @@ struct vimoption * The options with a NULL variable are 'hidden': a set command for them is * ignored and they are not printed. */ -static struct vimoption -#ifdef FEAT_GUI_W16 - _far -#endif - options[] = +static struct vimoption options[] = { {"aleph", "al", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_RIGHTLEFT @@ -500,7 +509,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif { -#if (defined(MSDOS) || defined(WIN3264) || defined(OS2)) && !defined(FEAT_GUI_W32) +#if (defined(WIN3264)) && !defined(FEAT_GUI_W32) (char_u *)128L, #else (char_u *)224L, @@ -513,9 +522,9 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif #if FEAT_GUI_MACVIM - {(char_u *)TRUE, (char_u *)0L} + {(char_u *)TRUE, (char_u *)FALSE} #else - {(char_u *)FALSE, (char_u *)0L} + {(char_u *)FALSE, (char_u *)FALSE} #endif SCRIPTID_INIT}, {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM|P_CURSWANT, @@ -555,11 +564,15 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, -#ifdef FEAT_AUTOCHDIR {"autochdir", "acd", P_BOOL|P_VI_DEF, +#ifdef FEAT_AUTOCHDIR (char_u *)&p_acd, PV_NONE, - {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)FALSE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif + SCRIPTID_INIT}, {"autoindent", "ai", P_BOOL|P_VI_DEF, (char_u *)&p_ai, PV_AI, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, @@ -578,27 +591,28 @@ static struct vimoption {"background", "bg", P_STRING|P_VI_DEF|P_RCLR, (char_u *)&p_bg, PV_NONE, { -#if (defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI) +#if (defined(WIN3264)) && !defined(FEAT_GUI) (char_u *)"dark", #else (char_u *)"light", #endif (char_u *)0L} SCRIPTID_INIT}, - {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_COMMA|P_NODUP, + {"backspace", "bs", P_STRING|P_VI_DEF|P_VIM|P_ONECOMMA|P_NODUP, (char_u *)&p_bs, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_bk, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP, - (char_u *)&p_bkc, PV_NONE, + {"backupcopy", "bkc", P_STRING|P_VIM|P_ONECOMMA|P_NODUP, + (char_u *)&p_bkc, PV_BKC, #ifdef UNIX {(char_u *)"yes", (char_u *)"auto"} #else {(char_u *)"auto", (char_u *)"auto"} #endif SCRIPTID_INIT}, - {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE, + {"backupdir", "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA + |P_NODUP|P_SECURE, (char_u *)&p_bdir, PV_NONE, {(char_u *)DFLT_BDIR, (char_u *)0L} SCRIPTID_INIT}, {"backupext", "bex", P_STRING|P_VI_DEF|P_NFNAME, @@ -610,7 +624,7 @@ static struct vimoption (char_u *)"~", #endif (char_u *)0L} SCRIPTID_INIT}, - {"backupskip", "bsk", P_STRING|P_VI_DEF|P_COMMA, + {"backupskip", "bsk", P_STRING|P_VI_DEF|P_ONECOMMA, #ifdef FEAT_WILDIGN (char_u *)&p_bsk, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -619,32 +633,61 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, -#ifdef FEAT_BEVAL {"balloondelay","bdlay",P_NUM|P_VI_DEF, +#ifdef FEAT_BEVAL (char_u *)&p_bdlay, PV_NONE, - {(char_u *)600L, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)600L, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC, +#ifdef FEAT_BEVAL_GUI (char_u *)&p_beval, PV_NONE, - {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, -# ifdef FEAT_EVAL + {(char_u *)FALSE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"balloonevalterm", "bevalterm",P_BOOL|P_VI_DEF|P_NO_MKRC, +#ifdef FEAT_BEVAL_TERM + (char_u *)&p_bevalterm, PV_NONE, + {(char_u *)FALSE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, +#if defined(FEAT_BEVAL) && defined(FEAT_EVAL) (char_u *)&p_bexpr, PV_BEXPR, - {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, -# endif + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif + SCRIPTID_INIT}, {"beautify", "bf", P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {"belloff", "bo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + (char_u *)&p_bo, PV_NONE, + {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"binary", "bin", P_BOOL|P_VI_DEF|P_RSTAT, (char_u *)&p_bin, PV_BIN, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"bioskey", "biosk",P_BOOL|P_VI_DEF, -#ifdef MSDOS - (char_u *)&p_biosk, PV_NONE, + (char_u *)NULL, PV_NONE, + {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {"blurradius", "blur", P_NUM|P_VIM, +#ifdef FEAT_GUI_MACVIM + (char_u *)&p_blur, PV_NONE, #else (char_u *)NULL, PV_NONE, #endif - {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)0L, (char_u *)0L} }, {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, #ifdef FEAT_MBYTE (char_u *)&p_bomb, PV_BOMB, @@ -670,7 +713,8 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_COMMA|P_NODUP, + {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF + |P_ONECOMMA|P_NODUP, #ifdef FEAT_LINEBREAK (char_u *)VAR_WIN, PV_BRIOPT, {(char_u *)"", (char_u *)NULL} @@ -689,28 +733,18 @@ static struct vimoption #endif SCRIPTID_INIT}, {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, -#if defined(FEAT_QUICKFIX) (char_u *)&p_bh, PV_BH, {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB, (char_u *)&p_bl, PV_BL, {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, -#if defined(FEAT_QUICKFIX) (char_u *)&p_bt, PV_BT, {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, - {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_MBYTE (char_u *)&p_cmp, PV_NONE, {(char_u *)"internal,keepascii", (char_u *)0L} @@ -746,6 +780,14 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, + {"charspace", "csp", P_NUM|P_NODEFAULT|P_VIM|P_RCLR, +#ifdef FEAT_GUI + (char_u *)&p_charspace, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)0L, (char_u *)0L} + SCRIPTID_INIT}, {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM, #ifdef FEAT_CINDENT (char_u *)&p_cin, PV_CIN, @@ -753,7 +795,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_CINDENT (char_u *)&p_cink, PV_CINK, {(char_u *)"0{,0},0),:,0#,!^F,o,O,e", (char_u *)0L} @@ -762,14 +804,14 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"cinoptions", "cino", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_CINDENT (char_u *)&p_cino, PV_CINO, #else (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"cinwords", "cinw", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) (char_u *)&p_cinw, PV_CINW, {(char_u *)"if,else,while,do,for,switch", @@ -779,7 +821,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"clipboard", "cb", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_CLIPBOARD (char_u *)&p_cb, PV_NONE, # ifdef FEAT_XCLIPBOARD @@ -803,7 +845,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)7L, (char_u *)0L} SCRIPTID_INIT}, - {"colorcolumn", "cc", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN, + {"colorcolumn", "cc", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_RWIN, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CC, #else @@ -813,7 +855,15 @@ static struct vimoption {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Columns, PV_NONE, {(char_u *)80L, (char_u *)0L} SCRIPTID_INIT}, - {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, + {"columnspace", "csp", P_NUM|P_VI_DEF|P_RCLR, +#ifdef FEAT_GUI_MACVIM + (char_u *)&p_columnspace, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA + |P_NODUP|P_CURSWANT, #ifdef FEAT_COMMENTS (char_u *)&p_com, PV_COM, {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-", @@ -837,7 +887,7 @@ static struct vimoption {"compatible", "cp", P_BOOL|P_RALL, (char_u *)&p_cp, PV_NONE, {(char_u *)TRUE, (char_u *)FALSE} SCRIPTID_INIT}, - {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_INS_EXPAND (char_u *)&p_cpt, PV_CPT, {(char_u *)".,w,b,u,t,i", (char_u *)0L} @@ -872,7 +922,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"completeopt", "cot", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"completeopt", "cot", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_INS_EXPAND (char_u *)&p_cot, PV_NONE, {(char_u *)"menu,preview", (char_u *)0L} @@ -889,11 +939,7 @@ static struct vimoption #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"conskey", "consk",P_BOOL|P_VI_DEF, -#ifdef MSDOS - (char_u *)&p_consk, PV_NONE, -#else (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_ci, PV_CI, @@ -927,7 +973,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"cscopequickfix", "csqf", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX) (char_u *)&p_csqf, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -965,11 +1011,7 @@ static struct vimoption #endif {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"cursorbind", "crb", P_BOOL|P_VI_DEF, -#ifdef FEAT_CURSORBIND (char_u *)VAR_WIN, PV_CRBIND, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN, #ifdef FEAT_SYN_HL @@ -978,7 +1020,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWIN, + {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWINONLY, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CUL, #else @@ -1004,7 +1046,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, + {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, #ifdef FEAT_INS_EXPAND (char_u *)&p_dict, PV_DICT, #else @@ -1027,7 +1069,8 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_COMMA|P_NODUP, + {"diffopt", "dip", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN|P_ONECOMMA + |P_NODUP, #ifdef FEAT_DIFF (char_u *)&p_dip, PV_NONE, {(char_u *)"filler", (char_u *)NULL} @@ -1043,24 +1086,29 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE, + {"directory", "dir", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA + |P_NODUP|P_SECURE, (char_u *)&p_dir, PV_NONE, {(char_u *)DFLT_DIR, (char_u *)0L} SCRIPTID_INIT}, - {"display", "dy", P_STRING|P_VI_DEF|P_COMMA|P_RALL|P_NODUP, + {"display", "dy", P_STRING|P_VI_DEF|P_ONECOMMA|P_RALL|P_NODUP, (char_u *)&p_dy, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"eadirection", "ead", P_STRING|P_VI_DEF, -#ifdef FEAT_VERTSPLIT (char_u *)&p_ead, PV_NONE, {(char_u *)"both", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)NULL, (char_u *)0L} -#endif SCRIPTID_INIT}, {"edcompatible","ed", P_BOOL|P_VI_DEF, (char_u *)&p_ed, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {"emoji", "emo", P_BOOL|P_VI_DEF|P_RCLR, +#if defined(FEAT_MBYTE) + (char_u *)&p_emoji, PV_NONE, + {(char_u *)TRUE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML, #ifdef FEAT_MBYTE (char_u *)&p_enc, PV_NONE, @@ -1091,7 +1139,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"errorformat", "efm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"errorformat", "efm", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_QUICKFIX (char_u *)&p_efm, PV_EFM, {(char_u *)DFLT_EFM, (char_u *)0L} @@ -1103,12 +1151,8 @@ static struct vimoption {"esckeys", "ek", P_BOOL|P_VIM, (char_u *)&p_ek, PV_NONE, {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, - {"eventignore", "ei", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, -#ifdef FEAT_AUTOCMD + {"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_ei, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_et, PV_ET, @@ -1116,7 +1160,8 @@ static struct vimoption {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE, (char_u *)&p_exrc, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF|P_NO_MKRC, + {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF + |P_NO_MKRC, #ifdef FEAT_MBYTE (char_u *)&p_fenc, PV_FENC, {(char_u *)"", (char_u *)0L} @@ -1125,7 +1170,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"fileencodings","fencs", P_STRING|P_VI_DEF|P_COMMA, + {"fileencodings","fencs", P_STRING|P_VI_DEF|P_ONECOMMA, #ifdef FEAT_MBYTE (char_u *)&p_fencs, PV_NONE, {(char_u *)"ucs-bom", (char_u *)0L} @@ -1134,10 +1179,11 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC|P_CURSWANT, + {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC + |P_CURSWANT, (char_u *)&p_ff, PV_FF, {(char_u *)DFLT_FF, (char_u *)0L} SCRIPTID_INIT}, - {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP, + {"fileformats", "ffs", P_STRING|P_VIM|P_ONECOMMA|P_NODUP, (char_u *)&p_ffs, PV_NONE, {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM} SCRIPTID_INIT}, @@ -1151,23 +1197,16 @@ static struct vimoption #endif (char_u *)0L} SCRIPTID_INIT}, {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, -#ifdef FEAT_AUTOCMD (char_u *)&p_ft, PV_FT, {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, - {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) + {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, (char_u *)&p_fcs, PV_NONE, {(char_u *)"vert:|,fold:-", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)"", (char_u *)0L} -#endif SCRIPTID_INIT}, + {"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT, + (char_u *)&p_fixeol, PV_FIXEOL, + {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"fkmap", "fk", P_BOOL|P_VI_DEF, #ifdef FEAT_FKMAP (char_u *)&p_fkmap, PV_NONE, @@ -1178,62 +1217,125 @@ static struct vimoption {"flash", "fl", P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {"foldclose", "fcl", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_RWIN, #ifdef FEAT_FOLDING - {"foldclose", "fcl", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN, (char_u *)&p_fcl, PV_NONE, - {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDC, - {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)FALSE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FEN, - {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)TRUE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, -# ifdef FEAT_EVAL +#if defined(FEAT_FOLDING) && defined(FEAT_EVAL) (char_u *)VAR_WIN, PV_FDE, {(char_u *)"0", (char_u *)NULL} -# else +#else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} -# endif +#endif SCRIPTID_INIT}, {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDI, - {(char_u *)"#", (char_u *)NULL} SCRIPTID_INIT}, + {(char_u *)"#", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDL, - {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)0L, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT, +#ifdef FEAT_FOLDING (char_u *)&p_fdls, PV_NONE, - {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)-1L, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| - P_RWIN|P_COMMA|P_NODUP, + P_RWIN|P_ONECOMMA|P_NODUP, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FMR, {(char_u *)"{{{,}}}", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif SCRIPTID_INIT}, {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDM, - {(char_u *)"manual", (char_u *)NULL} SCRIPTID_INIT}, + {(char_u *)"manual", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FML, - {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)1L, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, +#ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDN, - {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, - {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, + {(char_u *)20L, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"foldopen", "fdo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_CURSWANT, +#ifdef FEAT_FOLDING (char_u *)&p_fdo, PV_NONE, {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", - (char_u *)0L} SCRIPTID_INIT}, + (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, -# ifdef FEAT_EVAL +#if defined(FEAT_FOLDING) && defined(FEAT_EVAL) (char_u *)VAR_WIN, PV_FDT, {(char_u *)"foldtext()", (char_u *)NULL} -# else +#else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} -# endif - SCRIPTID_INIT}, #endif + SCRIPTID_INIT}, {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, #ifdef FEAT_EVAL (char_u *)&p_fex, PV_FEX, @@ -1252,7 +1354,7 @@ static struct vimoption {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u *)0L} SCRIPTID_INIT}, {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, - (char_u *)&p_fp, PV_NONE, + (char_u *)&p_fp, PV_FP, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"fsync", "fs", P_BOOL|P_SECURE|P_VI_DEF, #ifdef HAVE_FSYNC @@ -1266,10 +1368,11 @@ static struct vimoption {"fullscreen", "fu", P_BOOL|P_NO_MKRC, #ifdef FEAT_FULLSCREEN (char_u *)&p_fullscreen, PV_NONE, + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, #else (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} SCRIPTID_INIT}, #endif - {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"fuoptions", "fuopt", P_STRING|P_COMMA|P_NODUP|P_VI_DEF, #ifdef FEAT_FULLSCREEN (char_u *)&p_fuoptions, PV_NONE, @@ -1285,7 +1388,7 @@ static struct vimoption {"graphic", "gr", P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"grepformat", "gfm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"grepformat", "gfm", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_QUICKFIX (char_u *)&p_gefm, PV_NONE, {(char_u *)DFLT_GREPFORMAT, (char_u *)0L} @@ -1320,13 +1423,13 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guicursor", "gcr", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"guicursor", "gcr", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef CURSOR_SHAPE (char_u *)&p_guicursor, PV_NONE, { # ifdef FEAT_GUI (char_u *)"n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175", -# else /* MSDOS or Win32 console */ +# else /* Win32 console */ (char_u *)"n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block", # endif (char_u *)0L} @@ -1335,7 +1438,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, + {"guifont", "gfn", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP, #ifdef FEAT_GUI (char_u *)&p_guifont, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -1344,7 +1447,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_COMMA, + {"guifontset", "gfs", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA, #if defined(FEAT_GUI) && defined(FEAT_XFONTSET) (char_u *)&p_guifontset, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -1353,7 +1456,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, + {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP, #if defined(FEAT_GUI) && defined(FEAT_MBYTE) (char_u *)&p_guifontwide, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -1378,10 +1481,10 @@ static struct vimoption , #if defined(FEAT_GUI) (char_u *)&p_go, PV_NONE, -# if defined(UNIX) && !defined(MACOS) - {(char_u *)"aegimrLtT", (char_u *)0L} -# elif defined(FEAT_GUI_MACVIM) +# if defined(FEAT_GUI_MACVIM) {(char_u *)"egmrL", (char_u *)0L} +# elif defined(UNIX) && !defined(FEAT_GUI_MAC) + {(char_u *)"aegimrLtT", (char_u *)0L} # else {(char_u *)"egmrLtT", (char_u *)0L} # endif @@ -1423,13 +1526,9 @@ static struct vimoption {(char_u *)DFLT_HELPFILE, (char_u *)0L} SCRIPTID_INIT}, {"helpheight", "hh", P_NUM|P_VI_DEF, -#ifdef FEAT_WINDOWS (char_u *)&p_hh, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, - {"helplang", "hlg", P_STRING|P_VI_DEF|P_COMMA, + {"helplang", "hlg", P_STRING|P_VI_DEF|P_ONECOMMA, #ifdef FEAT_MULTI_LANG (char_u *)&p_hlg, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -1441,7 +1540,7 @@ static struct vimoption {"hidden", "hid", P_BOOL|P_VI_DEF, (char_u *)&p_hid, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, + {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP, (char_u *)&p_hl, PV_NONE, {(char_u *)HIGHLIGHT_INIT, (char_u *)0L} SCRIPTID_INIT}, @@ -1483,7 +1582,7 @@ static struct vimoption (char_u *)&p_ic, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE, -# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK) +#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) (char_u *)&p_imaf, PV_NONE, {(char_u *)"", (char_u *)NULL} # else @@ -1499,14 +1598,14 @@ static struct vimoption #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"imcmdline", "imc", P_BOOL|P_VI_DEF, -#ifdef USE_IM_CONTROL +#ifdef FEAT_MBYTE (char_u *)&p_imcmdline, PV_NONE, #else (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"imdisable", "imd", P_BOOL|P_VI_DEF, -#ifdef USE_IM_CONTROL +#ifdef FEAT_MBYTE (char_u *)&p_imdisable, PV_NONE, #else (char_u *)NULL, PV_NONE, @@ -1517,30 +1616,43 @@ static struct vimoption {(char_u *)FALSE, (char_u *)0L} #endif SCRIPTID_INIT}, + {"imdisableactivate", "imda", P_BOOL|P_VI_DEF, +#ifdef USE_IM_CONTROL + (char_u *)&p_imdisableactivate, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)FALSE, (char_u *)0L} + SCRIPTID_INIT}, {"iminsert", "imi", P_NUM|P_VI_DEF, (char_u *)&p_iminsert, PV_IMI, -#ifdef B_IMODE_IM - {(char_u *)B_IMODE_IM, (char_u *)0L} -#else {(char_u *)B_IMODE_NONE, (char_u *)0L} -#endif SCRIPTID_INIT}, {"imsearch", "ims", P_NUM|P_VI_DEF, (char_u *)&p_imsearch, PV_IMS, -#ifdef B_IMODE_IM - {(char_u *)B_IMODE_IM, (char_u *)0L} -#else - {(char_u *)B_IMODE_NONE, (char_u *)0L} -#endif + {(char_u *)B_IMODE_USE_INSERT, (char_u *)0L} SCRIPTID_INIT}, {"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE, -# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK) +#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) (char_u *)&p_imsf, PV_NONE, {(char_u *)"", (char_u *)NULL} -# else +#else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"imstyle", "imst", P_NUM|P_VI_DEF|P_SECURE, +#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(FEAT_GUI_MACVIM) + (char_u *)&p_imst, PV_NONE, +# if defined(FEAT_GUI_MACVIM) + {(char_u *)IM_ON_THE_SPOT, (char_u *)0L} +# else + {(char_u *)IM_OVER_THE_SPOT, (char_u *)0L} # endif +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif SCRIPTID_INIT}, {"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_FIND_ID @@ -1572,7 +1684,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"indentkeys", "indk", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) (char_u *)&p_indk, PV_INDK, {(char_u *)"0{,0},:,0#,!^F,o,O,e", (char_u *)0L} @@ -1613,7 +1725,7 @@ static struct vimoption {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, (char_u *)&p_isi, PV_NONE, { -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) (char_u *)"@,48-57,_,128-167,224-235", #else # ifdef EBCDIC @@ -1639,7 +1751,7 @@ static struct vimoption "251-254", #else (char_u *)"@,48-57,_", -# if defined(MSDOS) || defined(MSWIN) || defined(OS2) +# if defined(MSWIN) (char_u *)"@,48-57,_,128-167,224-235" # else ISK_LATIN1 @@ -1649,9 +1761,7 @@ static struct vimoption {"isprint", "isp", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, (char_u *)&p_isp, PV_NONE, { -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) \ - || (defined(MACOS) && !defined(MACOS_X)) \ - || defined(VMS) +#if defined(MSWIN) || defined(VMS) (char_u *)"@,~-255", #else # ifdef EBCDIC @@ -1683,20 +1793,17 @@ static struct vimoption {(char_u *)"", (char_u *)0L} #endif SCRIPTID_INIT}, - {"keymodel", "km", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"keymodel", "km", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_km, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, (char_u *)&p_kp, PV_KP, { -#if defined(MSDOS) || defined(MSWIN) +#ifdef MSWIN (char_u *)":help", #else -#ifdef VMS +# ifdef VMS (char_u *)"help", -#else -# if defined(OS2) - (char_u *)"view /", # else # ifdef USEMAN_S (char_u *)"man -s", @@ -1704,10 +1811,9 @@ static struct vimoption (char_u *)"man", # endif # endif -#endif #endif (char_u *)0L} SCRIPTID_INIT}, - {"langmap", "lmap", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE, + {"langmap", "lmap", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_SECURE, #ifdef FEAT_LANGMAP (char_u *)&p_langmap, PV_NONE, {(char_u *)"", /* unmatched } */ @@ -1723,12 +1829,22 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL, -#ifdef FEAT_WINDOWS - (char_u *)&p_ls, PV_NONE, + {"langnoremap", "lnr", P_BOOL|P_VI_DEF, +#ifdef FEAT_LANGMAP + (char_u *)&p_lnr, PV_NONE, #else (char_u *)NULL, PV_NONE, #endif + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {"langremap", "lrm", P_BOOL|P_VI_DEF, +#ifdef FEAT_LANGMAP + (char_u *)&p_lrm, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL, + (char_u *)&p_ls, PV_NONE, {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"lazyredraw", "lz", P_BOOL|P_VI_DEF, (char_u *)&p_lz, PV_NONE, @@ -1743,7 +1859,7 @@ static struct vimoption {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Rows, PV_NONE, { -#if defined(MSDOS) || defined(WIN3264) || defined(OS2) +#if defined(WIN3264) (char_u *)25L, #else (char_u *)24L, @@ -1768,7 +1884,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"lispwords", "lw", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_LISP (char_u *)&p_lispwords, PV_LW, {(char_u *)LISPWORD_VALUE, (char_u *)0L} @@ -1780,20 +1896,57 @@ static struct vimoption {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_LIST, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, + {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, (char_u *)&p_lcs, PV_NONE, {(char_u *)"eol:$", (char_u *)0L} SCRIPTID_INIT}, {"loadplugins", "lpl", P_BOOL|P_VI_DEF, (char_u *)&p_lpl, PV_NONE, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, -#ifdef FEAT_GUI_MAC + {"luadll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_LUA) + (char_u *)&p_luadll, PV_NONE, + {(char_u *)DYNAMIC_LUA_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)"", (char_u *)0L} +#endif + SCRIPTID_INIT}, {"macatsui", NULL, P_BOOL|P_VI_DEF|P_RCLR, +#ifdef FEAT_GUI_MAC (char_u *)&p_macatsui, PV_NONE, - {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)TRUE, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)"", (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"macligatures", NULL, P_BOOL|P_VI_DEF|P_RCLR, +#ifdef FEAT_GUI_MACVIM + (char_u *)&p_macligatures, PV_NONE, + {(char_u *)FALSE, (char_u *)0L}}, +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L}}, #endif {"macmeta", "mmta", P_BOOL|P_VI_DEF, #ifdef FEAT_GUI_MACVIM (char_u *)&p_mmta, PV_MMTA, + {(char_u *)FALSE, (char_u *)0L}}, +#else + (char_u *)NULL, PV_MMTA, + {(char_u *)NULL, (char_u *)0L}}, +#endif + {"macthinstrokes", NULL, P_BOOL|P_VI_DEF|P_RCLR, +#ifdef FEAT_GUI_MACVIM + (char_u *)&p_macthinstrokes, PV_NONE, + {(char_u *)FALSE, (char_u *)0L}}, +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L}}, +#endif + {"macproportionalfont", "mpf", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, +#ifdef FEAT_GUI_MACVIM + (char_u *)&p_mpfont, PV_NONE, #else (char_u *)NULL, PV_NONE, #endif @@ -1808,6 +1961,15 @@ static struct vimoption #else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"makeencoding","menc", P_STRING|P_VI_DEF, +#ifdef FEAT_MBYTE + (char_u *)&p_menc, PV_MENC, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, @@ -1823,7 +1985,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_mps, PV_MPS, {(char_u *)"(:),{:},[:]", (char_u *)0L} SCRIPTID_INIT}, @@ -1868,6 +2030,14 @@ static struct vimoption {"mesg", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, +#ifdef USE_MIGEMO + {"migemo", "mgm", P_BOOL|P_VI_DEF|P_VIM, + (char_u *)&p_migemo, PV_MIG, + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {"migemodict", "mgd", P_STRING|P_EXPAND|P_VI_DEF|P_VIM, + (char_u *)&p_migdict, PV_NONE, + {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, +#endif /* USE_MIGEMO */ {"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE, #ifdef FEAT_SPELL (char_u *)&p_msm, PV_NONE, @@ -1895,7 +2065,7 @@ static struct vimoption {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST, (char_u *)&p_mouse, PV_NONE, { -#if defined(MSDOS) || defined(WIN3264) +#if defined(WIN3264) (char_u *)"a", #else (char_u *)"", @@ -1918,17 +2088,17 @@ static struct vimoption {"mousemodel", "mousem", P_STRING|P_VI_DEF, (char_u *)&p_mousem, PV_NONE, { -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) (char_u *)"popup", #else -# if defined(MACOS) +# if defined(MACOS_X) (char_u *)"popup_setpos", # else (char_u *)"extend", # endif #endif (char_u *)0L} SCRIPTID_INIT}, - {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"mouseshape", "mouses", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_MOUSESHAPE (char_u *)&p_mouseshape, PV_NONE, {(char_u *)"i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow", (char_u *)0L} @@ -1940,6 +2110,24 @@ static struct vimoption {"mousetime", "mouset", P_NUM|P_VI_DEF, (char_u *)&p_mouset, PV_NONE, {(char_u *)500L, (char_u *)0L} SCRIPTID_INIT}, + {"mzschemedll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_MZSCHEME) + (char_u *)&p_mzschemedll, PV_NONE, + {(char_u *)DYNAMIC_MZSCH_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)"", (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"mzschemegcdll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_MZSCHEME) + (char_u *)&p_mzschemegcdll, PV_NONE, + {(char_u *)DYNAMIC_MZGC_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)"", (char_u *)0L} +#endif + SCRIPTID_INIT}, {"mzquantum", "mzq", P_NUM, #ifdef FEAT_MZSCHEME (char_u *)&p_mzq, PV_NONE, @@ -1950,9 +2138,9 @@ static struct vimoption {"novice", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"nrformats", "nf", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_nf, PV_NF, - {(char_u *)"octal,hex", (char_u *)0L} + {(char_u *)"bin,octal,hex", (char_u *)0L} SCRIPTID_INIT}, {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_NU, @@ -1977,7 +2165,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"opendevice", "odev", P_BOOL|P_VI_DEF, -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) (char_u *)&p_odev, PV_NONE, #else (char_u *)NULL, PV_NONE, @@ -1993,6 +2181,11 @@ static struct vimoption {"osfiletype", "oft", P_STRING|P_ALLOCED|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {"packpath", "pp", P_STRING|P_VI_DEF|P_EXPAND|P_ONECOMMA|P_NODUP + |P_SECURE, + (char_u *)&p_pp, PV_NONE, + {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L} + SCRIPTID_INIT}, {"paragraphs", "para", P_STRING|P_VI_DEF, (char_u *)&p_para, PV_NONE, {(char_u *)"IPLPPPQPP TPHPLIPpLpItpplpipbp", @@ -2018,28 +2211,33 @@ static struct vimoption {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, (char_u *)&p_path, PV_PATH, { -#if defined AMIGA || defined MSDOS || defined MSWIN +#if defined(AMIGA) || defined(MSWIN) (char_u *)".,,", #else -# if defined(__EMX__) - (char_u *)".,/emx/include,,", -# else /* Unix, probably */ (char_u *)".,/usr/include,,", -# endif #endif (char_u *)0L} SCRIPTID_INIT}, + {"perldll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_PERL) + (char_u *)&p_perldll, PV_NONE, + {(char_u *)DYNAMIC_PERL_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_pi, PV_PI, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"previewheight", "pvh", P_NUM|P_VI_DEF, -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) (char_u *)&p_pvh, PV_NONE, #else (char_u *)NULL, PV_NONE, #endif {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) (char_u *)VAR_WIN, PV_PVW, #else (char_u *)NULL, PV_NONE, @@ -2063,7 +2261,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"printexpr", "pexpr", P_STRING|P_VI_DEF, + {"printexpr", "pexpr", P_STRING|P_VI_DEF|P_SECURE, #ifdef FEAT_POSTSCRIPT (char_u *)&p_pexpr, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -2090,7 +2288,9 @@ static struct vimoption {"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT, #ifdef FEAT_PRINTER (char_u *)&p_header, PV_NONE, - {(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L} + /* untranslated to avoid problems when 'encoding' + * is changed */ + {(char_u *)"%<%f%h%m%=Page %N", (char_u *)0L} #else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} @@ -2114,7 +2314,7 @@ static struct vimoption {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"printoptions", "popt", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"printoptions", "popt", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_PRINTER (char_u *)&p_popt, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -2133,6 +2333,57 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {"pumwidth", "pw", P_NUM|P_VI_DEF, +#ifdef FEAT_INS_EXPAND + (char_u *)&p_pw, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)15L, (char_u *)15L} SCRIPTID_INIT}, + {"pythonthreedll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_PYTHON3) + (char_u *)&p_py3dll, PV_NONE, + {(char_u *)DYNAMIC_PYTHON3_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"pythonthreehome", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(FEAT_PYTHON3) + (char_u *)&p_py3home, PV_NONE, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"pythondll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_PYTHON) + (char_u *)&p_pydll, PV_NONE, + {(char_u *)DYNAMIC_PYTHON_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"pythonhome", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(FEAT_PYTHON) + (char_u *)&p_pyhome, PV_NONE, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"pyxversion", "pyx", P_NUM|P_VI_DEF|P_SECURE, +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) + (char_u *)&p_pyx, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)DEFAULT_PYTHON_VER, (char_u *)0L} + SCRIPTID_INIT}, {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_TEXTOBJ (char_u *)&p_qe, PV_QE, @@ -2164,6 +2415,15 @@ static struct vimoption {"remap", NULL, P_BOOL|P_VI_DEF, (char_u *)&p_remap, PV_NONE, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {"renderoptions", "rop", P_STRING|P_ONECOMMA|P_RCLR|P_VI_DEF, +#ifdef FEAT_RENDER_OPTIONS + (char_u *)&p_rop, PV_NONE, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"report", NULL, P_NUM|P_VI_DEF, (char_u *)&p_report, PV_NONE, {(char_u *)2L, (char_u *)0L} SCRIPTID_INIT}, @@ -2195,6 +2455,15 @@ static struct vimoption #else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"rubydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_RUBY) + (char_u *)&p_rubydll, PV_NONE, + {(char_u *)DYNAMIC_RUBY_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT, @@ -2211,19 +2480,16 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_COMMA|P_NODUP|P_SECURE, + {"runtimepath", "rtp", P_STRING|P_VI_DEF|P_EXPAND|P_ONECOMMA|P_NODUP + |P_SECURE, (char_u *)&p_rtp, PV_NONE, {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L} SCRIPTID_INIT}, {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF, (char_u *)VAR_WIN, PV_SCROLL, - {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"scrollbind", "scb", P_BOOL|P_VI_DEF, -#ifdef FEAT_SCROLLBIND (char_u *)VAR_WIN, PV_SCBIND, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM, (char_u *)&p_sj, PV_NONE, @@ -2231,14 +2497,9 @@ static struct vimoption {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL, (char_u *)&p_so, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, - {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, -#ifdef FEAT_SCROLLBIND + {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_sbo, PV_NONE, {(char_u *)"ver,jump", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, {"sections", "sect", P_STRING|P_VI_DEF, (char_u *)&p_sections, PV_NONE, @@ -2251,13 +2512,13 @@ static struct vimoption (char_u *)&p_sel, PV_NONE, {(char_u *)"inclusive", (char_u *)0L} SCRIPTID_INIT}, - {"selectmode", "slm", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"selectmode", "slm", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_slm, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_SESSION (char_u *)&p_ssop, PV_NONE, - {(char_u *)"blank,buffers,curdir,folds,help,options,tabpages,winsize", + {(char_u *)"blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal", (char_u *)0L} #else (char_u *)NULL, PV_NONE, @@ -2270,52 +2531,28 @@ static struct vimoption #ifdef VMS (char_u *)"-", #else -# if defined(MSDOS) - (char_u *)"command", -# else -# if defined(WIN16) - (char_u *)"command.com", -# else -# if defined(WIN3264) +# if defined(WIN3264) (char_u *)"", /* set in set_init_1() */ -# else -# if defined(OS2) - (char_u *)"cmd.exe", -# else -# if defined(ARCHIE) - (char_u *)"gos", -# else +# else (char_u *)"sh", -# endif -# endif -# endif -# endif # endif #endif /* VMS */ (char_u *)0L} SCRIPTID_INIT}, {"shellcmdflag","shcf", P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_shcf, PV_NONE, { -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) (char_u *)"/c", #else -# if defined(OS2) - (char_u *)"/c", -# else (char_u *)"-c", -# endif #endif (char_u *)0L} SCRIPTID_INIT}, {"shellpipe", "sp", P_STRING|P_VI_DEF|P_SECURE, #ifdef FEAT_QUICKFIX (char_u *)&p_sp, PV_NONE, { -#if defined(UNIX) || defined(OS2) -# ifdef ARCHIE - (char_u *)"2>", -# else +#if defined(UNIX) (char_u *)"| tee", -# endif #else (char_u *)">", #endif @@ -2351,7 +2588,7 @@ static struct vimoption {"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_sxq, PV_NONE, { -#if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__) +#if defined(UNIX) && defined(USE_SYSTEM) (char_u *)"\"", #else (char_u *)"", @@ -2360,7 +2597,7 @@ static struct vimoption {"shellxescape", "sxe", P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_sxe, PV_NONE, { -#if defined(MSDOS) || defined(WIN16) || defined(WIN3264) +#if defined(WIN3264) (char_u *)"\"&|<>()@^", #else (char_u *)"", @@ -2377,11 +2614,7 @@ static struct vimoption {(char_u *)"", (char_u *)"filnxtToO"} SCRIPTID_INIT}, {"shortname", "sn", P_BOOL|P_VI_DEF, -#ifdef SHORT_FNAME - (char_u *)NULL, PV_NONE, -#else (char_u *)&p_sn, PV_SN, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"showbreak", "sbr", P_STRING|P_VI_DEF|P_RALL, #ifdef FEAT_LINEBREAK @@ -2413,11 +2646,7 @@ static struct vimoption (char_u *)&p_smd, PV_NONE, {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, {"showtabline", "stal", P_NUM|P_VI_DEF|P_RALL, -#ifdef FEAT_WINDOWS (char_u *)&p_stal, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"sidescroll", "ss", P_NUM|P_VI_DEF, (char_u *)&p_ss, PV_NONE, @@ -2425,6 +2654,15 @@ static struct vimoption {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF, (char_u *)&p_siso, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {"signcolumn", "scl", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN, +#ifdef FEAT_SIGNS + (char_u *)VAR_WIN, PV_SCL, + {(char_u *)"auto", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"slowopen", "slow", P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, @@ -2463,7 +2701,8 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE|P_COMMA, + {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE + |P_ONECOMMA, #ifdef FEAT_SPELL (char_u *)&p_spf, PV_SPF, {(char_u *)"", (char_u *)0L} @@ -2472,7 +2711,8 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND, + {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA + |P_RBUF|P_EXPAND, #ifdef FEAT_SPELL (char_u *)&p_spl, PV_SPL, {(char_u *)"en", (char_u *)0L} @@ -2481,7 +2721,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE|P_COMMA, + {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE|P_ONECOMMA, #ifdef FEAT_SPELL (char_u *)&p_sps, PV_NONE, {(char_u *)"best", (char_u *)0L} @@ -2491,18 +2731,10 @@ static struct vimoption #endif SCRIPTID_INIT}, {"splitbelow", "sb", P_BOOL|P_VI_DEF, -#ifdef FEAT_WINDOWS (char_u *)&p_sb, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"splitright", "spr", P_BOOL|P_VI_DEF, -#ifdef FEAT_VERTSPLIT (char_u *)&p_spr, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_sol, PV_NONE, @@ -2514,11 +2746,11 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"suffixes", "su", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"suffixes", "su", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_su, PV_NONE, {(char_u *)".bak,~,.o,.h,.info,.swp,.obj", (char_u *)0L} SCRIPTID_INIT}, - {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_COMMA|P_NODUP, + {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_ONECOMMA|P_NODUP, #ifdef FEAT_SEARCHPATH (char_u *)&p_sua, PV_SUA, {(char_u *)"", (char_u *)0L} @@ -2533,7 +2765,7 @@ static struct vimoption {"swapsync", "sws", P_STRING|P_VI_DEF, (char_u *)&p_sws, PV_NONE, {(char_u *)"fsync", (char_u *)0L} SCRIPTID_INIT}, - {"switchbuf", "swb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"switchbuf", "swb", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_swb, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"synmaxcol", "smc", P_NUM|P_VI_DEF|P_RBUF, @@ -2562,11 +2794,7 @@ static struct vimoption #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"tabpagemax", "tpm", P_NUM|P_VI_DEF, -#ifdef FEAT_WINDOWS (char_u *)&p_tpm, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)10L, (char_u *)0L} SCRIPTID_INIT}, {"tabstop", "ts", P_NUM|P_VI_DEF|P_RBUF, (char_u *)&p_ts, PV_TS, @@ -2579,13 +2807,16 @@ static struct vimoption {(char_u *)TRUE, (char_u *)0L} #endif SCRIPTID_INIT}, + {"tagcase", "tc", P_STRING|P_VIM, + (char_u *)&p_tc, PV_TC, + {(char_u *)"followic", (char_u *)"followic"} SCRIPTID_INIT}, {"taglength", "tl", P_NUM|P_VI_DEF, (char_u *)&p_tl, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"tagrelative", "tr", P_BOOL|P_VIM, (char_u *)&p_tr, PV_NONE, {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, - {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, + {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_tags, PV_TAGS, { #if defined(FEAT_EMACS_TAGS) && !defined(CASE_INSENSITIVE_FILENAME) @@ -2597,6 +2828,15 @@ static struct vimoption {"tagstack", "tgst", P_BOOL|P_VI_DEF, (char_u *)&p_tgst, PV_NONE, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {"tcldll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(DYNAMIC_TCL) + (char_u *)&p_tcldll, PV_NONE, + {(char_u *)DYNAMIC_TCL_DLL, (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL, (char_u *)&T_NAME, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, @@ -2614,6 +2854,42 @@ static struct vimoption #else (char_u *)NULL, PV_NONE, {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, +#ifdef FEAT_TERMGUICOLORS + (char_u *)&p_tgc, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#else + (char_u*)NULL, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#endif + SCRIPTID_INIT}, + {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, +#ifdef FEAT_TERMINAL + (char_u *)VAR_WIN, PV_TWK, + {(char_u *)"", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termwinscroll", "twsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF, +#ifdef FEAT_TERMINAL + (char_u *)&p_twsl, PV_TWSL, + {(char_u *)10000L, (char_u *)10000L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termwinsize", "tws", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, +#ifdef FEAT_TERMINAL + (char_u *)VAR_WIN, PV_TWS, + {(char_u *)"", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, {"terse", NULL, P_BOOL|P_VI_DEF, @@ -2635,7 +2911,7 @@ static struct vimoption {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF, (char_u *)&p_tw, PV_TW, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, - {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, + {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, #ifdef FEAT_INS_EXPAND (char_u *)&p_tsr, PV_TSR, #else @@ -2682,17 +2958,24 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, + {"toolbar", "tb", P_STRING|P_ONECOMMA|P_VI_DEF|P_NODUP, #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) - {"toolbar", "tb", P_STRING|P_COMMA|P_VI_DEF|P_NODUP, (char_u *)&p_toolbar, PV_NONE, {(char_u *)"icons,tooltips", (char_u *)0L} - SCRIPTID_INIT}, +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif -#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) + SCRIPTID_INIT}, {"toolbariconsize", "tbis", P_STRING|P_VI_DEF, +#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) (char_u *)&p_tbis, PV_NONE, - {(char_u *)"small", (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)"small", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif + SCRIPTID_INIT}, {"transparency", "transp", P_NUM|P_VIM|P_RCLR, #ifdef FEAT_TRANSPARENCY (char_u *)&p_transp, PV_NONE, @@ -2725,7 +3008,8 @@ static struct vimoption {"ttytype", "tty", P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL, (char_u *)&T_NAME, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"undodir", "udir", P_STRING|P_EXPAND|P_COMMA|P_NODUP|P_SECURE|P_VI_DEF, + {"undodir", "udir", P_STRING|P_EXPAND|P_ONECOMMA|P_NODUP|P_SECURE + |P_VI_DEF, #ifdef FEAT_PERSISTENT_UNDO (char_u *)&p_udir, PV_NONE, {(char_u *)".", (char_u *)0L} @@ -2744,7 +3028,7 @@ static struct vimoption {"undolevels", "ul", P_NUM|P_VI_DEF, (char_u *)&p_ul, PV_UL, { -#if defined(UNIX) || defined(WIN3264) || defined(OS2) || defined(VMS) +#if defined(UNIX) || defined(WIN3264) || defined(VMS) (char_u *)1000L, #else (char_u *)100L, @@ -2774,19 +3058,20 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"viewoptions", "vop", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"viewoptions", "vop", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_SESSION (char_u *)&p_vop, PV_NONE, - {(char_u *)"folds,options,cursor", (char_u *)0L} + {(char_u *)"folds,options,cursor,curdir", + (char_u *)0L} #else (char_u *)NULL, PV_NONE, {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"viminfo", "vi", P_STRING|P_COMMA|P_NODUP|P_SECURE, + {"viminfo", "vi", P_STRING|P_ONECOMMA|P_NODUP|P_SECURE, #ifdef FEAT_VIMINFO (char_u *)&p_viminfo, PV_NONE, -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} #else # ifdef AMIGA @@ -2801,7 +3086,17 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM|P_CURSWANT, + {"viminfofile", "vif", P_STRING|P_ONECOMMA|P_NODUP|P_SECURE|P_VI_DEF, +#ifdef FEAT_VIMINFO + (char_u *)&p_viminfofile, PV_NONE, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"virtualedit", "ve", P_STRING|P_ONECOMMA|P_NODUP|P_VI_DEF + |P_VIM|P_CURSWANT, #ifdef FEAT_VIRTUALEDIT (char_u *)&p_ve, PV_NONE, {(char_u *)"", (char_u *)""} @@ -2828,7 +3123,7 @@ static struct vimoption {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR, (char_u *)&p_wiv, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"whichwrap", "ww", P_STRING|P_VIM|P_COMMA|P_FLAGLIST, + {"whichwrap", "ww", P_STRING|P_VIM|P_ONECOMMA|P_FLAGLIST, (char_u *)&p_ww, PV_NONE, {(char_u *)"", (char_u *)"b,s"} SCRIPTID_INIT}, {"wildchar", "wc", P_NUM|P_VIM, @@ -2838,7 +3133,7 @@ static struct vimoption {"wildcharm", "wcm", P_NUM|P_VI_DEF, (char_u *)&p_wcm, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, - {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"wildignore", "wig", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_WILDIGN (char_u *)&p_wig, PV_NONE, #else @@ -2855,7 +3150,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"wildmode", "wim", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"wildmode", "wim", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)&p_wim, PV_NONE, {(char_u *)"full", (char_u *)0L} SCRIPTID_INIT}, {"wildoptions", "wop", P_STRING|P_VI_DEF, @@ -2880,46 +3175,36 @@ static struct vimoption (char_u *)&p_window, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"winheight", "wh", P_NUM|P_VI_DEF, -#ifdef FEAT_WINDOWS (char_u *)&p_wh, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT, -#ifdef FEAT_WINDOWS (char_u *)VAR_WIN, PV_WFH, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"winfixwidth", "wfw", P_BOOL|P_VI_DEF|P_RSTAT, -#ifdef FEAT_VERTSPLIT (char_u *)VAR_WIN, PV_WFW, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"winminheight", "wmh", P_NUM|P_VI_DEF, -#ifdef FEAT_WINDOWS (char_u *)&p_wmh, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"winminwidth", "wmw", P_NUM|P_VI_DEF, -#ifdef FEAT_VERTSPLIT (char_u *)&p_wmw, PV_NONE, + {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, + {"winptydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, +#if defined(WIN3264) && defined(FEAT_TERMINAL) + (char_u *)&p_winptydll, PV_NONE, { +# ifdef _WIN64 + (char_u *)"winpty64.dll", +# else + (char_u *)"winpty32.dll", +# endif + (char_u *)0L} #else (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} #endif - {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, + SCRIPTID_INIT}, {"winwidth", "wiw", P_NUM|P_VI_DEF, -#ifdef FEAT_VERTSPLIT (char_u *)&p_wiw, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_WRAP, @@ -2959,22 +3244,26 @@ static struct vimoption p_term("t_AL", T_CAL) p_term("t_al", T_AL) p_term("t_bc", T_BC) + p_term("t_BE", T_BE) + p_term("t_BD", T_BD) p_term("t_cd", T_CD) p_term("t_ce", T_CE) p_term("t_cl", T_CL) p_term("t_cm", T_CM) + p_term("t_Ce", T_UCE) p_term("t_Co", T_CCO) p_term("t_CS", T_CCS) + p_term("t_Cs", T_UCS) p_term("t_cs", T_CS) -#ifdef FEAT_VERTSPLIT p_term("t_CV", T_CSV) -#endif - p_term("t_ut", T_UT) p_term("t_da", T_DA) p_term("t_db", T_DB) p_term("t_DL", T_CDL) p_term("t_dl", T_DL) + p_term("t_EC", T_CEC) + p_term("t_EI", T_CEI) p_term("t_fs", T_FS) + p_term("t_GP", T_CGP) p_term("t_IE", T_CIE) p_term("t_IS", T_CIS) p_term("t_ke", T_KE) @@ -2987,30 +3276,43 @@ static struct vimoption p_term("t_ms", T_MS) p_term("t_nd", T_ND) p_term("t_op", T_OP) + p_term("t_RF", T_RFG) + p_term("t_RB", T_RBG) + p_term("t_RC", T_CRC) p_term("t_RI", T_CRI) + p_term("t_RS", T_CRS) p_term("t_RV", T_CRV) - p_term("t_u7", T_U7) p_term("t_Sb", T_CSB) - p_term("t_Sf", T_CSF) + p_term("t_SC", T_CSC) p_term("t_se", T_SE) + p_term("t_Sf", T_CSF) + p_term("t_SH", T_CSH) + p_term("t_SI", T_CSI) p_term("t_so", T_SO) + p_term("t_SR", T_CSR) p_term("t_sr", T_SR) - p_term("t_ts", T_TS) + p_term("t_Te", T_STE) p_term("t_te", T_TE) p_term("t_ti", T_TI) + p_term("t_Ts", T_STS) + p_term("t_ts", T_TS) + p_term("t_u7", T_U7) p_term("t_ue", T_UE) p_term("t_us", T_US) + p_term("t_ut", T_UT) p_term("t_vb", T_VB) p_term("t_ve", T_VE) p_term("t_vi", T_VI) + p_term("t_VS", T_CVS) p_term("t_vs", T_VS) p_term("t_WP", T_CWP) p_term("t_WS", T_CWS) - p_term("t_SI", T_CSI) - p_term("t_EI", T_CEI) + p_term("t_xn", T_XN) p_term("t_xs", T_XS) p_term("t_ZH", T_CZH) p_term("t_ZR", T_CZR) + p_term("t_8f", T_8F) + p_term("t_8b", T_8B) /* terminal key codes are not in here */ @@ -3021,13 +3323,17 @@ static struct vimoption #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption)) #ifdef FEAT_MBYTE -static char *(p_ambw_values[]) = {"single", "double", NULL}; +static char *(p_ambw_values[]) = {"single", "double", +# ifdef USE_AMBIWIDTH_AUTO + "auto", +# endif + NULL}; #endif static char *(p_bg_values[]) = {"light", "dark", NULL}; -static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL}; +static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL}; static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL}; #ifdef FEAT_CRYPT -static char *(p_cm_values[]) = {"zip", "blowfish", NULL}; +static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL}; #endif #ifdef FEAT_CMDL_COMPL static char *(p_wop_values[]) = {"tagfile", NULL}; @@ -3042,21 +3348,11 @@ static char *(p_km_values[]) = {"startsel", "stopsel", NULL}; #ifdef FEAT_BROWSE static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL}; #endif -#ifdef FEAT_SCROLLBIND static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL}; -#endif static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; -#ifdef FEAT_VERTSPLIT static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; -#endif -#if defined(FEAT_QUICKFIX) -# ifdef FEAT_AUTOCMD -static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL}; -# else -static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL}; -# endif +static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", "prompt", NULL}; static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; -#endif static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; #ifdef FEAT_FOLDING static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", @@ -3067,85 +3363,91 @@ static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", static char *(p_fcl_values[]) = {"all", NULL}; #endif #ifdef FEAT_INS_EXPAND -static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", NULL}; +static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL}; +#endif +#ifdef FEAT_SIGNS +static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; #endif -static void set_option_default __ARGS((int, int opt_flags, int compatible)); -static void set_options_default __ARGS((int opt_flags)); -static char_u *term_bg_default __ARGS((void)); -static void did_set_option __ARGS((int opt_idx, int opt_flags, int new_value)); -static char_u *illegal_char __ARGS((char_u *, int)); -static int string_to_key __ARGS((char_u *arg)); +static void set_option_default(int, int opt_flags, int compatible); +static void set_options_default(int opt_flags); +static void set_string_default_esc(char *name, char_u *val, int escape); +static char_u *term_bg_default(void); +static void did_set_option(int opt_idx, int opt_flags, int new_value); +static char_u *illegal_char(char_u *, int); #ifdef FEAT_CMDWIN -static char_u *check_cedit __ARGS((void)); -#endif -#ifdef FEAT_TITLE -static void did_set_title __ARGS((int icon)); +static char_u *check_cedit(void); #endif -static char_u *option_expand __ARGS((int opt_idx, char_u *val)); -static void didset_options __ARGS((void)); -static void check_string_option __ARGS((char_u **pp)); +static char_u *option_expand(int opt_idx, char_u *val); +static void didset_options(void); +static void didset_options2(void); +static void check_string_option(char_u **pp); #if defined(FEAT_EVAL) || defined(PROTO) -static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags)); +static long_u *insecure_flag(int opt_idx, int opt_flags); #else # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) #endif -static void set_string_option_global __ARGS((int opt_idx, char_u **varp)); -static char_u *set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags)); -static char_u *did_set_string_option __ARGS((int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags)); -static char_u *set_chars_option __ARGS((char_u **varp)); +static void set_string_option_global(int opt_idx, char_u **varp); +static char_u *set_string_option(int opt_idx, char_u *value, int opt_flags); +static char_u *did_set_string_option(int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags); +static char_u *set_chars_option(char_u **varp); #ifdef FEAT_SYN_HL -static int int_cmp __ARGS((const void *a, const void *b)); +static int int_cmp(const void *a, const void *b); #endif #ifdef FEAT_CLIPBOARD -static char_u *check_clipboard_option __ARGS((void)); +static char_u *check_clipboard_option(void); #endif #ifdef FEAT_SPELL -static char_u *compile_cap_prog __ARGS((synblock_T *synblock)); +static char_u *did_set_spell_option(int is_spellfile); +static char_u *compile_cap_prog(synblock_T *synblock); #endif #ifdef FEAT_EVAL -static void set_option_scriptID_idx __ARGS((int opt_idx, int opt_flags, int id)); -#endif -static char_u *set_bool_option __ARGS((int opt_idx, char_u *varp, int value, int opt_flags)); -static char_u *set_num_option __ARGS((int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen, int opt_flags)); -static void check_redraw __ARGS((long_u flags)); -static int findoption __ARGS((char_u *)); -static int find_key_option __ARGS((char_u *)); -static void showoptions __ARGS((int all, int opt_flags)); -static int optval_default __ARGS((struct vimoption *, char_u *varp)); -static void showoneopt __ARGS((struct vimoption *, int opt_flags)); -static int put_setstring __ARGS((FILE *fd, char *cmd, char *name, char_u **valuep, int expand)); -static int put_setnum __ARGS((FILE *fd, char *cmd, char *name, long *valuep)); -static int put_setbool __ARGS((FILE *fd, char *cmd, char *name, int value)); -static int istermoption __ARGS((struct vimoption *)); -static char_u *get_varp_scope __ARGS((struct vimoption *p, int opt_flags)); -static char_u *get_varp __ARGS((struct vimoption *)); -static void option_value2string __ARGS((struct vimoption *, int opt_flags)); -static void check_winopt __ARGS((winopt_T *wop)); -static int wc_use_keyname __ARGS((char_u *varp, long *wcp)); +static void set_option_scriptID_idx(int opt_idx, int opt_flags, int id); +#endif +static char_u *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags); +static char_u *set_num_option(int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen, int opt_flags); +static void check_redraw(long_u flags); +static int findoption(char_u *); +static int find_key_option(char_u *); +static void showoptions(int all, int opt_flags); +static int optval_default(struct vimoption *, char_u *varp); +static void showoneopt(struct vimoption *, int opt_flags); +static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, int expand); +static int put_setnum(FILE *fd, char *cmd, char *name, long *valuep); +static int put_setbool(FILE *fd, char *cmd, char *name, int value); +static int istermoption(struct vimoption *); +static char_u *get_varp_scope(struct vimoption *p, int opt_flags); +static char_u *get_varp(struct vimoption *); +static void option_value2string(struct vimoption *, int opt_flags); +static void check_winopt(winopt_T *wop); +static int wc_use_keyname(char_u *varp, long *wcp); #ifdef FEAT_LANGMAP -static void langmap_init __ARGS((void)); -static void langmap_set __ARGS((void)); +static void langmap_init(void); +static void langmap_set(void); #endif -static void paste_option_changed __ARGS((void)); -static void compatible_set __ARGS((void)); +static void paste_option_changed(void); +static void compatible_set(void); #ifdef FEAT_LINEBREAK -static void fill_breakat_flags __ARGS((void)); +static void fill_breakat_flags(void); #endif -static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list)); -static int check_opt_strings __ARGS((char_u *val, char **values, int)); -static int check_opt_wim __ARGS((void)); +static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, int list); +static int check_opt_strings(char_u *val, char **values, int); +static int check_opt_wim(void); #ifdef FEAT_FULLSCREEN -static int check_fuoptions __ARGS((char_u *, unsigned *, int *)); +static int check_fuoptions(char_u *, unsigned *, int *); +#endif +#ifdef FEAT_LINEBREAK +static int briopt_check(win_T *wp); #endif /* * Initialize the options, first part. * * Called only once from main(), just after creating the first buffer. + * If "clean_arg" is TRUE Vim was started with --clean. */ void -set_init_1() +set_init_1(int clean_arg) { char_u *p; int opt_idx; @@ -3173,17 +3475,14 @@ set_init_1() * Don't use it if it is empty. */ if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL) -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) -# ifdef __EMX__ - || ((p = mch_getenv((char_u *)"EMXSHELL")) != NULL && *p != NUL) -# endif +#if defined(MSWIN) || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL) # ifdef WIN3264 - || ((p = default_shell()) != NULL && *p != NUL) + || ((p = (char_u *)default_shell()) != NULL && *p != NUL) # endif #endif ) - set_string_default("sh", p); + set_string_default_esc("sh", p, TRUE); #ifdef FEAT_WILDIGN /* @@ -3206,7 +3505,11 @@ set_init_1() mustfree = FALSE; # ifdef UNIX if (*names[n] == NUL) +# ifdef MACOS_X + p = (char_u *)"/private/tmp"; +# else p = (char_u *)"/tmp"; +# endif else # endif p = vim_getenv((char_u *)names[n], &mustfree); @@ -3261,24 +3564,14 @@ set_init_1() if (opt_idx >= 0) { #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM) - if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n - || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L) + if ((long)(long_i)options[opt_idx].def_val[VI_DEFAULT] > (long)n + || (long)(long_i)options[opt_idx].def_val[VI_DEFAULT] == 0L) #endif options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; } } } -#ifdef FEAT_GUI_W32 - /* force 'shortname' for Win32s */ - if (gui_is_win32s()) - { - opt_idx = findoption((char_u *)"shortname"); - if (opt_idx >= 0) - options[opt_idx].def_val[VI_DEFAULT] = (char_u *)TRUE; - } -#endif - #ifdef FEAT_SEARCHPATH { char_u *cdpath; @@ -3323,10 +3616,10 @@ set_init_1() } #endif -#if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(OS2) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) +#if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) /* Set print encoding on platforms that don't default to latin1 */ set_string_default("penc", -# if defined(MSWIN) || defined(OS2) +# if defined(MSWIN) (char_u *)"cp1252" # else # ifdef VMS @@ -3349,7 +3642,7 @@ set_init_1() #ifdef FEAT_POSTSCRIPT /* 'printexpr' must be allocated to be able to evaluate it. */ set_string_default("pexpr", -# if defined(MSWIN) || defined(MSDOS) || defined(OS2) +# if defined(MSWIN) (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)" # else # ifdef VMS @@ -3368,6 +3661,24 @@ set_init_1() */ set_options_default(0); +#ifdef CLEAN_RUNTIMEPATH + if (clean_arg) + { + opt_idx = findoption((char_u *)"runtimepath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_rtp = (char_u *)CLEAN_RUNTIMEPATH; + } + opt_idx = findoption((char_u *)"packpath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_pp = (char_u *)CLEAN_RUNTIMEPATH; + } + } +#endif + #ifdef FEAT_GUI if (found_reverse_arg) set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0); @@ -3384,17 +3695,11 @@ set_init_1() didset_options(); #ifdef FEAT_SPELL - /* Use the current chartab for the generic chartab. */ + /* Use the current chartab for the generic chartab. This is not in + * didset_options() because it only depends on 'encoding'. */ init_spell_chartab(); #endif -#ifdef FEAT_LINEBREAK - /* - * initialize the table for 'breakat'. - */ - fill_breakat_flags(); -#endif - /* * Expand environment variables and things like "~" for the defaults. * If option_expand() returns non-NULL the variable is expanded. This can @@ -3426,14 +3731,8 @@ set_init_1() } } - /* Initialize the highlight_attr[] table. */ - highlight_changed(); - save_file_ff(curbuf); /* Buffer is unchanged */ - /* Parse default for 'wildmode' */ - check_opt_wim(); - #if defined(FEAT_ARABIC) /* Detect use of mlterm. * Mlterm is a terminal emulator akin to xterm that has some special @@ -3445,15 +3744,7 @@ set_init_1() set_option_value((char_u *)"tbidi", 1L, NULL, 0); #endif -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) - /* Parse default for 'fillchars'. */ - (void)set_chars_option(&p_fcs); -#endif - -#ifdef FEAT_CLIPBOARD - /* Parse default for 'clipboard' */ - (void)check_clipboard_option(); -#endif + didset_options2(); #ifdef FEAT_MBYTE # if defined(WIN3264) && defined(FEAT_GETTEXT) @@ -3482,7 +3773,7 @@ set_init_1() STRCPY(buf, "ja"); else buf[2] = NUL; /* truncate to two-letter code */ - vim_setenv("LANG", buf); + vim_setenv((char_u *)"LANG", (char_u *)buf); } } # else @@ -3534,8 +3825,7 @@ set_init_1() options[opt_idx].flags |= P_DEF_ALLOCED; } -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \ - || defined(VMS) +#if defined(MSWIN) || defined(MACOS_X) || defined(VMS) if (STRCMP(p_enc, "latin1") == 0 # ifdef FEAT_MBYTE || enc_utf8 @@ -3607,10 +3897,10 @@ set_init_1() * This does not take care of side effects! */ static void -set_option_default(opt_idx, opt_flags, compatible) - int opt_idx; - int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ - int compatible; /* use Vi default value */ +set_option_default( + int opt_idx, + int opt_flags, /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ + int compatible) /* use Vi default value */ { char_u *varp; /* pointer to variable for current option */ int dvi; /* index in def_val[] */ @@ -3679,43 +3969,56 @@ set_option_default(opt_idx, opt_flags, compatible) /* * Set all options (except terminal options) to their default value. + * When "opt_flags" is non-zero skip 'encoding'. */ static void -set_options_default(opt_flags) - int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ +set_options_default( + int opt_flags) /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ { int i; -#ifdef FEAT_WINDOWS win_T *wp; tabpage_T *tp; -#endif for (i = 0; !istermoption(&options[i]); i++) - if (!(options[i].flags & P_NODEFAULT)) + if (!(options[i].flags & P_NODEFAULT) +#if defined(FEAT_MBYTE) || defined(FEAT_CRYPT) + && (opt_flags == 0 + || (TRUE +# if defined(FEAT_MBYTE) + && options[i].var != (char_u *)&p_enc +# endif +# if defined(FEAT_CRYPT) + && options[i].var != (char_u *)&p_cm + && options[i].var != (char_u *)&p_key +# endif + )) +#endif + ) set_option_default(i, opt_flags, p_cp); -#ifdef FEAT_WINDOWS /* The 'scroll' option must be computed for all windows. */ FOR_ALL_TAB_WINDOWS(tp, wp) win_comp_scroll(wp); -#else - win_comp_scroll(curwin); +#ifdef FEAT_CINDENT + parse_cino(curbuf); #endif } /* * Set the Vi-default value of a string option. * Used for 'sh', 'backupskip' and 'term'. + * When "escape" is TRUE escape spaces with a backslash. */ - void -set_string_default(name, val) - char *name; - char_u *val; + static void +set_string_default_esc(char *name, char_u *val, int escape) { char_u *p; int opt_idx; - p = vim_strsave(val); + if (escape && vim_strchr(val, ' ') != NULL) + p = vim_strsave_escaped(val, (char_u *)" "); + else + p = vim_strsave(val); if (p != NULL) /* we don't want a NULL */ { opt_idx = findoption((char_u *)name); @@ -3729,14 +4032,18 @@ set_string_default(name, val) } } + void +set_string_default(char *name, char_u *val) +{ + set_string_default_esc(name, val, FALSE); +} + /* * Set the Vi-default value of a number option. * Used for 'lines' and 'columns'. */ void -set_number_default(name, val) - char *name; - long val; +set_number_default(char *name, long val) { int opt_idx; @@ -3750,7 +4057,7 @@ set_number_default(name, val) * Free all options. */ void -free_all_options() +free_all_options(void) { int i; @@ -3759,7 +4066,7 @@ free_all_options() if (options[i].indir == PV_NONE) { /* global option: free value and default value. */ - if (options[i].flags & P_ALLOCED && options[i].var != NULL) + if ((options[i].flags & P_ALLOCED) && options[i].var != NULL) free_string_option(*(char_u **)options[i].var); if (options[i].flags & P_DEF_ALLOCED) free_string_option(options[i].def_val[VI_DEFAULT]); @@ -3778,15 +4085,14 @@ free_all_options() * setting 'term'. */ void -set_init_2() +set_init_2(void) { int idx; /* - * 'scroll' defaults to half the window height. Note that this default is - * wrong when the window height changes. + * 'scroll' defaults to half the window height. The stored default is zero, + * which results in the actual value computed from the window height. */ - set_number_default("scroll", (long)((long_u)Rows >> 1)); idx = findoption((char_u *)"scroll"); if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) set_option_default(idx, OPT_LOCAL, p_cp); @@ -3801,7 +4107,7 @@ set_init_2() set_number_default("window", Rows - 1); /* For DOS console the default is always black. */ -#if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)) +#if !((defined(WIN3264)) && !defined(FEAT_GUI)) /* * If 'background' wasn't set by the user, try guessing the value, * depending on the terminal name. Only need to check for terminals @@ -3834,26 +4140,26 @@ set_init_2() * This is just guessing! Recognized are: * "linux" Linux console * "screen.linux" Linux console with screen - * "cygwin" Cygwin shell - * "putty" Putty program + * "cygwin.*" Cygwin shell + * "putty.*" Putty program * We also check the COLORFGBG environment variable, which is set by * rxvt and derivatives. This variable contains either two or three * values separated by semicolons; we want the last value in either * case. If this value is 0-6 or 8, our background is dark. */ static char_u * -term_bg_default() +term_bg_default(void) { -#if defined(MSDOS) || defined(OS2) || defined(WIN3264) - /* DOS console nearly always black */ +#if defined(WIN3264) + /* DOS console is nearly always black */ return (char_u *)"dark"; #else char_u *p; if (STRCMP(T_NAME, "linux") == 0 || STRCMP(T_NAME, "screen.linux") == 0 - || STRCMP(T_NAME, "cygwin") == 0 - || STRCMP(T_NAME, "putty") == 0 + || STRNCMP(T_NAME, "cygwin", 6) == 0 + || STRNCMP(T_NAME, "putty", 5) == 0 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL && (p = vim_strrchr(p, ';')) != NULL && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8') @@ -3867,9 +4173,9 @@ term_bg_default() * Initialize the options, part three: After reading the .vimrc */ void -set_init_3() +set_init_3(void) { -#if defined(UNIX) || defined(OS2) || defined(WIN3264) +#if defined(UNIX) || defined(WIN3264) /* * Set 'shellpipe' and 'shellredir', depending on the 'shell' option. * This is done after other initializations, where 'shell' might have been @@ -3878,23 +4184,23 @@ set_init_3() char_u *p; int idx_srr; int do_srr; -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX int idx_sp; int do_sp; -#endif +# endif idx_srr = findoption((char_u *)"srr"); if (idx_srr < 0) do_srr = FALSE; else do_srr = !(options[idx_srr].flags & P_WAS_SET); -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX idx_sp = findoption((char_u *)"sp"); if (idx_sp < 0) do_sp = FALSE; else do_sp = !(options[idx_sp].flags & P_WAS_SET); -#endif +# endif p = get_isolated_shell_name(); if (p != NULL) { @@ -3904,23 +4210,23 @@ set_init_3() */ if ( fnamecmp(p, "csh") == 0 || fnamecmp(p, "tcsh") == 0 -# if defined(OS2) || defined(WIN3264) /* also check with .exe extension */ +# if defined(WIN3264) /* also check with .exe extension */ || fnamecmp(p, "csh.exe") == 0 || fnamecmp(p, "tcsh.exe") == 0 # endif ) { -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (do_sp) { -# ifdef WIN3264 +# ifdef WIN3264 p_sp = (char_u *)">&"; -# else +# else p_sp = (char_u *)"|& tee"; -# endif +# endif options[idx_sp].def_val[VI_DEFAULT] = p_sp; } -#endif +# endif if (do_srr) { p_srr = (char_u *)">&"; @@ -3928,7 +4234,7 @@ set_init_3() } } else -# ifndef OS2 /* Always use bourne shell style redirection if we reach this */ + /* Always use bourne shell style redirection if we reach this */ if ( fnamecmp(p, "sh") == 0 || fnamecmp(p, "ksh") == 0 || fnamecmp(p, "mksh") == 0 @@ -3937,7 +4243,7 @@ set_init_3() || fnamecmp(p, "zsh-beta") == 0 || fnamecmp(p, "bash") == 0 || fnamecmp(p, "fish") == 0 -# ifdef WIN3264 +# ifdef WIN3264 || fnamecmp(p, "cmd") == 0 || fnamecmp(p, "sh.exe") == 0 || fnamecmp(p, "ksh.exe") == 0 @@ -3947,21 +4253,20 @@ set_init_3() || fnamecmp(p, "zsh-beta.exe") == 0 || fnamecmp(p, "bash.exe") == 0 || fnamecmp(p, "cmd.exe") == 0 -# endif - ) # endif + ) { -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (do_sp) { -# ifdef WIN3264 +# ifdef WIN3264 p_sp = (char_u *)">%s 2>&1"; -# else +# else p_sp = (char_u *)"2>&1| tee"; -# endif +# endif options[idx_sp].def_val[VI_DEFAULT] = p_sp; } -#endif +# endif if (do_srr) { p_srr = (char_u *)">%s 2>&1"; @@ -3972,15 +4277,14 @@ set_init_3() } #endif -#if defined(MSDOS) || defined(WIN3264) || defined(OS2) +#if defined(WIN3264) /* * Set 'shellcmdflag', 'shellxquote', and 'shellquote' depending on the * 'shell' option. * This is done after other initializations, where 'shell' might have been * set, but only if they have not been set before. Default for p_shcf is * "/c", for p_shq is "". For "sh" like shells it is changed here to - * "-c" and "\"", but not for DJGPP, because it starts the shell without - * command.com. And for Win32 we need to set p_sxq instead. + * "-c" and "\"". And for Win32 we need to set p_sxq instead. */ if (strstr((char *)gettail(p_sh), "sh") != NULL) { @@ -3993,8 +4297,6 @@ set_init_3() options[idx3].def_val[VI_DEFAULT] = p_shcf; } -# ifndef DJGPP -# ifdef WIN3264 /* Somehow Win32 requires the quotes around the redirection too */ idx3 = findoption((char_u *)"sxq"); if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) @@ -4002,15 +4304,6 @@ set_init_3() p_sxq = (char_u *)"\""; options[idx3].def_val[VI_DEFAULT] = p_sxq; } -# else - idx3 = findoption((char_u *)"shq"); - if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) - { - p_shq = (char_u *)"\""; - options[idx3].def_val[VI_DEFAULT] = p_shq; - } -# endif -# endif } else if (strstr((char *)gettail(p_sh), "cmd.exe") != NULL) { @@ -4045,6 +4338,15 @@ set_init_3() } #endif + if (BUFEMPTY()) + { + int idx_ffs = findoption((char_u *)"ffs"); + + /* Apply the first entry of 'fileformats' to the initial buffer. */ + if (idx_ffs >= 0 && (options[idx_ffs].flags & P_WAS_SET)) + set_fileformat(default_fileformat(), OPT_LOCAL); + } + #ifdef FEAT_TITLE set_title_defaults(); #endif @@ -4056,8 +4358,7 @@ set_init_3() * Only the first two characters of "lang" are used. */ void -set_helplang_default(lang) - char_u *lang; +set_helplang_default(char_u *lang) { int idx; @@ -4087,10 +4388,10 @@ set_helplang_default(lang) #endif #ifdef FEAT_GUI -static char_u *gui_bg_default __ARGS((void)); +static char_u *gui_bg_default(void); static char_u * -gui_bg_default() +gui_bg_default(void) { if (gui_get_lightness(gui.back_pixel) < 127) return (char_u *)"dark"; @@ -4101,7 +4402,7 @@ gui_bg_default() * Option initializations that can only be done after opening the GUI window. */ void -init_gui_options() +init_gui_options(void) { /* Set the 'background' option according to the lightness of the * background color, unless the user has set it already. */ @@ -4122,7 +4423,7 @@ init_gui_options() * machine. */ void -set_title_defaults() +set_title_defaults(void) { int idx1; long val; @@ -4159,6 +4460,30 @@ set_title_defaults() } #endif +#if defined(FEAT_EVAL) + static void +trigger_optionsset_string( + int opt_idx, + int opt_flags, + char_u *oldval, + char_u *newval) +{ + if (oldval != NULL && newval != NULL) + { + char_u buf_type[7]; + + sprintf((char *)buf_type, "%s", + (opt_flags & OPT_LOCAL) ? "local" : "global"); + set_vim_var_string(VV_OPTION_OLD, oldval, -1); + set_vim_var_string(VV_OPTION_NEW, newval, -1); + set_vim_var_string(VV_OPTION_TYPE, buf_type, -1); + apply_autocmds(EVENT_OPTIONSET, + (char_u *)options[opt_idx].fullname, NULL, FALSE, NULL); + reset_v_option_vars(); + } +} +#endif + /* * Parse 'arg' for option settings. * @@ -4175,9 +4500,9 @@ set_title_defaults() * returns FAIL if an error is detected, OK otherwise */ int -do_set(arg, opt_flags) - char_u *arg; /* option string (may be written to!) */ - int opt_flags; +do_set( + char_u *arg, /* option string (may be written to!) */ + int opt_flags) { int opt_idx; char_u *errmsg; @@ -4188,7 +4513,7 @@ do_set(arg, opt_flags) int afterchar; /* character just after option name */ int len; int i; - long value; + varnumber_T value; int key; long_u flags; /* flags for current option */ char_u *varp = NULL; /* pointer to variable for current option */ @@ -4224,6 +4549,9 @@ do_set(arg, opt_flags) ++arg; /* Only for :set command set global value of local options. */ set_options_default(OPT_FREE | opt_flags); + didset_options(); + didset_options2(); + redraw_all_later(CLEAR); } else { @@ -4302,7 +4630,7 @@ do_set(arg, opt_flags) afterchar = arg[len]; /* skip white space, allow ":set ai ?" */ - while (vim_iswhite(arg[len])) + while (VIM_ISWHITE(arg[len])) ++len; adding = FALSE; @@ -4390,8 +4718,11 @@ do_set(arg, opt_flags) * "wrap" gets set. */ if (curwin->w_p_diff && opt_idx >= 0 /* shut up coverity warning */ - && (options[opt_idx].indir == PV_FDM - || options[opt_idx].indir == PV_WRAP)) + && ( +#ifdef FEAT_FOLDING + options[opt_idx].indir == PV_FDM || +#endif + options[opt_idx].indir == PV_WRAP)) goto skip; #endif } @@ -4423,7 +4754,7 @@ do_set(arg, opt_flags) } } if (vim_strchr((char_u *)"?!&<", nextchar) != NULL - && arg[1] != NUL && !vim_iswhite(arg[1])) + && arg[1] != NUL && !VIM_ISWHITE(arg[1])) { errmsg = e_trailing; goto skip; @@ -4431,8 +4762,8 @@ do_set(arg, opt_flags) } /* - * allow '=' and ':' as MSDOS command.com allows only one - * '=' character per "set" command line. grrr. (jw) + * allow '=' and ':' for hystorical reasons (MSDOS command.com + * allows only one '=' character per "set" command line. grrr. (jw) */ if (nextchar == '?' || (prefix == 1 @@ -4481,7 +4812,7 @@ do_set(arg, opt_flags) (void)show_one_termcode(key_name, p, TRUE); } if (nextchar != '?' - && nextchar != NUL && !vim_iswhite(afterchar)) + && nextchar != NUL && !VIM_ISWHITE(afterchar)) errmsg = e_trailing; } else @@ -4521,7 +4852,7 @@ do_set(arg, opt_flags) * ":set invopt": invert * ":set opt" or ":set noopt": set or reset */ - if (nextchar != NUL && !vim_iswhite(afterchar)) + if (nextchar != NUL && !VIM_ISWHITE(afterchar)) { errmsg = e_trailing; goto skip; @@ -4575,32 +4906,24 @@ do_set(arg, opt_flags) || (long *)varp == &p_wcm) && (*arg == '<' || *arg == '^' - || ((!arg[1] || vim_iswhite(arg[1])) + || (*arg != NUL + && (!arg[1] || VIM_ISWHITE(arg[1])) && !VIM_ISDIGIT(*arg)))) { - value = string_to_key(arg); + value = string_to_key(arg, FALSE); if (value == 0 && (long *)varp != &p_wcm) { errmsg = e_invarg; goto skip; } } - /* allow negative numbers (for 'undolevels') */ else if (*arg == '-' || VIM_ISDIGIT(*arg)) { - i = 0; - if (*arg == '-') - i = 1; -#ifdef HAVE_STRTOL - value = strtol((char *)arg, NULL, 0); - if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x') - i += 2; -#else - value = atol((char *)arg); -#endif - while (VIM_ISDIGIT(arg[i])) - ++i; - if (arg[i] != NUL && !vim_iswhite(arg[i])) + /* Allow negative (for 'undolevels'), octal and + * hex numbers. */ + vim_str2nr(arg, NULL, &i, STR2NR_ALL, + &value, NULL, 0); + if (arg[i] != NUL && !VIM_ISWHITE(arg[i])) { errmsg = e_invarg; goto skip; @@ -4623,15 +4946,19 @@ do_set(arg, opt_flags) } else if (opt_idx >= 0) /* string */ { - char_u *save_arg = NULL; - char_u *s = NULL; - char_u *oldval; /* previous value if *varp */ - char_u *newval; - char_u *origval; - unsigned newlen; - int comma; - int bs; - int new_value_alloced; /* new string option + char_u *save_arg = NULL; + char_u *s = NULL; + char_u *oldval = NULL; /* previous value if *varp */ + char_u *newval; + char_u *origval = NULL; +#if defined(FEAT_EVAL) + char_u *saved_origval = NULL; + char_u *saved_newval = NULL; +#endif + unsigned newlen; + int comma; + int bs; + int new_value_alloced; /* new string option was allocated */ /* When using ":set opt=val" for a global option @@ -4644,6 +4971,16 @@ do_set(arg, opt_flags) /* The old value is kept until we are sure that the * new value is valid. */ oldval = *(char_u **)varp; + + /* When setting the local value of a global + * option, the old value may be the global value. */ + if (((int)options[opt_idx].indir & PV_BOTH) + && (opt_flags & OPT_LOCAL)) + origval = *(char_u **)get_varp( + &options[opt_idx]); + else + origval = oldval; + if (nextchar == '&') /* set to default val */ { newval = options[opt_idx].def_val[ @@ -4720,6 +5057,8 @@ do_set(arg, opt_flags) break; } vim_free(oldval); + if (origval == oldval) + origval = *(char_u **)varp; oldval = *(char_u **)varp; } /* @@ -4758,15 +5097,6 @@ do_set(arg, opt_flags) ++arg; } - /* When setting the local value of a global - * option, the old value may be the global value. */ - if (((int)options[opt_idx].indir & PV_BOTH) - && (opt_flags & OPT_LOCAL)) - origval = *(char_u **)get_varp( - &options[opt_idx]); - else - origval = oldval; - /* * Copy the new string into allocated memory. * Can't use set_string_option_direct(), because @@ -4789,7 +5119,7 @@ do_set(arg, opt_flags) * do remove it for "\\\\machine\\path". * The reverse is found in ExpandOldSetting(). */ - while (*arg && !vim_iswhite(*arg)) + while (*arg && !VIM_ISWHITE(*arg)) { if (*arg == '\\' && arg[1] != NUL #ifdef BACKSLASH_IN_FILENAME @@ -4856,9 +5186,15 @@ do_set(arg, opt_flags) || s[i] == NUL)) break; /* Count backslashes. Only a comma with an - * even number of backslashes before it is - * recognized as a separator */ - if (s > origval && s[-1] == '\\') + * even number of backslashes or a single + * backslash preceded by a comma before it + * is recognized as a separator */ + if ((s > origval + 1 + && s[-1] == '\\' + && s[-2] != ',') + || (s == origval + 1 + && s[-1] == '\\')) + ++bs; else bs = 0; @@ -4882,6 +5218,12 @@ do_set(arg, opt_flags) if (adding) { i = (int)STRLEN(origval); + /* strip a trailing comma, would get 2 */ + if (comma && i > 1 + && (flags & P_ONECOMMA) == P_ONECOMMA + && origval[i - 1] == ',' + && origval[i - 2] != '\\') + i--; mch_memmove(newval + i + comma, newval, STRLEN(newval) + 1); mch_memmove(newval, origval, (size_t)i); @@ -4925,13 +5267,32 @@ do_set(arg, opt_flags) if (flags & P_FLAGLIST) { /* Remove flags that appear twice. */ - for (s = newval; *s; ++s) - if ((!(flags & P_COMMA) || *s != ',') - && vim_strchr(s + 1, *s) != NULL) + for (s = newval; *s;) + { + /* if options have P_FLAGLIST and + * P_ONECOMMA such as 'whichwrap' */ + if (flags & P_ONECOMMA) + { + if (*s != ',' && *(s + 1) == ',' + && vim_strchr(s + 2, *s) != NULL) + { + /* Remove the duplicated value and + * the next comma. */ + STRMOVE(s, s + 2); + continue; + } + } + else { - STRMOVE(s, s + 1); - --s; + if ((!(flags & P_COMMA) || *s != ',') + && vim_strchr(s + 1, *s) != NULL) + { + STRMOVE(s, s + 1); + continue; + } } + ++s; + } } if (save_arg != NULL) /* number for 'whichwrap' */ @@ -4939,14 +5300,41 @@ do_set(arg, opt_flags) new_value_alloced = TRUE; } - /* Set the new value. */ + /* + * Set the new value. + */ *(char_u **)(varp) = newval; +#if defined(FEAT_EVAL) + if (!starting +# ifdef FEAT_CRYPT + && options[opt_idx].indir != PV_KEY +# endif + && origval != NULL && newval != NULL) + { + /* origval may be freed by + * did_set_string_option(), make a copy. */ + saved_origval = vim_strsave(origval); + /* newval (and varp) may become invalid if the + * buffer is closed by autocommands. */ + saved_newval = vim_strsave(newval); + } +#endif + /* Handle side effects, and set the global value for - * ":set" on local options. */ + * ":set" on local options. Note: when setting 'syntax' + * or 'filetype' autocommands may be triggered that can + * cause havoc. */ errmsg = did_set_string_option(opt_idx, (char_u **)varp, new_value_alloced, oldval, errbuf, opt_flags); +#if defined(FEAT_EVAL) + if (errmsg == NULL) + trigger_optionsset_string(opt_idx, opt_flags, + saved_origval, saved_newval); + vim_free(saved_origval); + vim_free(saved_newval); +#endif /* If error detected, print the error message. */ if (errmsg != NULL) goto skip; @@ -4963,7 +5351,7 @@ do_set(arg, opt_flags) else { ++arg; /* jump to after the '=' or ':' */ - for (p = arg; *p && !vim_iswhite(*p); ++p) + for (p = arg; *p && !VIM_ISWHITE(*p); ++p) if (*p == '\\' && p[1] != NUL) ++p; nextchar = *p; @@ -4991,7 +5379,7 @@ do_set(arg, opt_flags) */ for (i = 0; i < 2 ; ++i) { - while (*arg != NUL && !vim_iswhite(*arg)) + while (*arg != NUL && !VIM_ISWHITE(*arg)) if (*arg++ == '\\' && *arg != NUL) ++arg; arg = skipwhite(arg); @@ -5045,10 +5433,10 @@ do_set(arg, opt_flags) * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag. */ static void -did_set_option(opt_idx, opt_flags, new_value) - int opt_idx; - int opt_flags; /* possibly with OPT_MODELINE */ - int new_value; /* value was replaced completely */ +did_set_option( + int opt_idx, + int opt_flags, /* possibly with OPT_MODELINE */ + int new_value) /* value was replaced completely */ { long_u *p; @@ -5069,9 +5457,7 @@ did_set_option(opt_idx, opt_flags, new_value) } static char_u * -illegal_char(errbuf, c) - char_u *errbuf; - int c; +illegal_char(char_u *errbuf, int c) { if (errbuf == NULL) return (char_u *)""; @@ -5083,15 +5469,17 @@ illegal_char(errbuf, c) /* * Convert a key name or string into a key value. * Used for 'wildchar' and 'cedit' options. + * When "multi_byte" is TRUE allow for multi-byte characters. */ - static int -string_to_key(arg) - char_u *arg; + int +string_to_key(char_u *arg, int multi_byte) { if (*arg == '<') return find_key_option(arg + 1); if (*arg == '^') return Ctrl_chr(arg[1]); + if (multi_byte) + return PTR2CHAR(arg); return *arg; } @@ -5101,7 +5489,7 @@ string_to_key(arg) * Returns NULL if value is OK, error message otherwise. */ static char_u * -check_cedit() +check_cedit(void) { int n; @@ -5109,7 +5497,7 @@ check_cedit() cedit_key = -1; else { - n = string_to_key(p_cedit); + n = string_to_key(p_cedit, FALSE); if (vim_isprintc(n)) return e_invarg; cedit_key = n; @@ -5126,27 +5514,14 @@ check_cedit() * the old value back. */ static void -did_set_title(icon) - int icon; /* Did set icon instead of title */ +did_set_title(void) { if (starting != NO_SCREEN #ifdef FEAT_GUI && !gui.starting #endif ) - { maketitle(); - if (icon) - { - if (!p_icon) - mch_restore_title(2); - } - else - { - if (!p_title) - mch_restore_title(1); - } - } } #endif @@ -5154,10 +5529,10 @@ did_set_title(icon) * set_options_bin - called when 'bin' changes value. */ void -set_options_bin(oldval, newval, opt_flags) - int oldval; - int newval; - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +set_options_bin( + int oldval, + int newval, + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { /* * The option values that are changed when 'bin' changes are @@ -5227,8 +5602,7 @@ set_options_bin(oldval, newval, opt_flags) * number, return -1. */ int -get_viminfo_parameter(type) - int type; +get_viminfo_parameter(int type) { char_u *p; @@ -5244,8 +5618,7 @@ get_viminfo_parameter(type) * Return NULL if the parameter is not specified in the string. */ char_u * -find_viminfo_parameter(type) - int type; +find_viminfo_parameter(int type) { char_u *p; @@ -5270,9 +5643,7 @@ find_viminfo_parameter(type) * Return pointer to NameBuff, or NULL when not expanded. */ static char_u * -option_expand(opt_idx, val) - int opt_idx; - char_u *val; +option_expand(int opt_idx, char_u *val) { /* if option doesn't need expansion nothing to do */ if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL) @@ -5309,7 +5680,7 @@ option_expand(opt_idx, val) * option values. */ static void -didset_options() +didset_options(void) { /* initialize the table for 'iskeyword' et.al. */ (void)init_chartab(); @@ -5318,6 +5689,7 @@ didset_options() (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); #endif (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE); + (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE); #ifdef FEAT_SESSION (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE); (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE); @@ -5330,6 +5702,7 @@ didset_options() &fuoptions_bgcolor); #endif (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE); + (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE); #ifdef FEAT_VIRTUALEDIT (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE); #endif @@ -5340,6 +5713,7 @@ didset_options() (void)spell_check_msm(); (void)spell_check_sps(); (void)compile_cap_prog(curwin->w_s); + (void)did_set_spell_option(TRUE); #endif #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE); @@ -5352,7 +5726,34 @@ didset_options() (void)check_cedit(); #endif #ifdef FEAT_LINEBREAK - briopt_check(); + briopt_check(curwin); +#endif +#ifdef FEAT_LINEBREAK + /* initialize the table for 'breakat'. */ + fill_breakat_flags(); +#endif + +} + +/* + * More side effects of setting options. + */ + static void +didset_options2(void) +{ + /* Initialize the highlight_attr[] table. */ + (void)highlight_changed(); + + /* Parse default for 'wildmode' */ + check_opt_wim(); + + (void)set_chars_option(&p_lcs); + /* Parse default for 'fillchars'. */ + (void)set_chars_option(&p_fcs); + +#ifdef FEAT_CLIPBOARD + /* Parse default for 'clipboard' */ + (void)check_clipboard_option(); #endif } @@ -5360,7 +5761,7 @@ didset_options() * Check for string options that are NULL (normally only termcap options). */ void -check_options() +check_options(void) { int opt_idx; @@ -5373,13 +5774,10 @@ check_options() * Check string options in a buffer for NULL value. */ void -check_buf_options(buf) - buf_T *buf; +check_buf_options(buf_T *buf) { -#if defined(FEAT_QUICKFIX) check_string_option(&buf->b_p_bh); check_string_option(&buf->b_p_bt); -#endif #ifdef FEAT_MBYTE check_string_option(&buf->b_p_fenc); #endif @@ -5401,6 +5799,7 @@ check_buf_options(buf) #if defined(FEAT_CRYPT) check_string_option(&buf->b_p_cm); #endif + check_string_option(&buf->b_p_fp); #if defined(FEAT_EVAL) check_string_option(&buf->b_p_fex); #endif @@ -5424,6 +5823,7 @@ check_buf_options(buf) #endif #ifdef FEAT_SYN_HL check_string_option(&buf->b_p_syn); + check_string_option(&buf->b_s.b_syn_isk); #endif #ifdef FEAT_SPELL check_string_option(&buf->b_s.b_p_spc); @@ -5438,9 +5838,7 @@ check_buf_options(buf) check_string_option(&buf->b_p_cino); parse_cino(buf); #endif -#ifdef FEAT_AUTOCMD check_string_option(&buf->b_p_ft); -#endif #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) check_string_option(&buf->b_p_cinw); #endif @@ -5462,12 +5860,17 @@ check_buf_options(buf) check_string_option(&buf->b_p_ep); check_string_option(&buf->b_p_path); check_string_option(&buf->b_p_tags); + check_string_option(&buf->b_p_tc); #ifdef FEAT_INS_EXPAND check_string_option(&buf->b_p_dict); check_string_option(&buf->b_p_tsr); #endif #ifdef FEAT_LISP check_string_option(&buf->b_p_lw); +#endif + check_string_option(&buf->b_p_bkc); +#ifdef FEAT_MBYTE + check_string_option(&buf->b_p_menc); #endif } @@ -5479,16 +5882,14 @@ check_buf_options(buf) * Does NOT check for P_ALLOCED flag! */ void -free_string_option(p) - char_u *p; +free_string_option(char_u *p) { if (p != empty_option) vim_free(p); } void -clear_string_option(pp) - char_u **pp; +clear_string_option(char_u **pp) { if (*pp != empty_option) vim_free(*pp); @@ -5496,8 +5897,7 @@ clear_string_option(pp) } static void -check_string_option(pp) - char_u **pp; +check_string_option(char_u **pp) { if (*pp == NULL) *pp = empty_option; @@ -5507,8 +5907,7 @@ check_string_option(pp) * Mark a terminal option as allocated, found by a pointer into term_strings[]. */ void -set_term_option_alloced(p) - char_u **p; +set_term_option_alloced(char_u **p) { int opt_idx; @@ -5528,9 +5927,7 @@ set_term_option_alloced(p) * Return -1 for an unknown option. */ int -was_set_insecurely(opt, opt_flags) - char_u *opt; - int opt_flags; +was_set_insecurely(char_u *opt, int opt_flags) { int idx = findoption(opt); long_u *flagp; @@ -5540,7 +5937,7 @@ was_set_insecurely(opt, opt_flags) flagp = insecure_flag(idx, opt_flags); return (*flagp & P_INSECURE) != 0; } - EMSG2(_(e_intern2), "was_set_insecurely()"); + internal_error("was_set_insecurely()"); return -1; } @@ -5549,9 +5946,7 @@ was_set_insecurely(opt, opt_flags) * "opt_idx". For some local options a local flags field is used. */ static long_u * -insecure_flag(opt_idx, opt_flags) - int opt_idx; - int opt_flags; +insecure_flag(int opt_idx, int opt_flags) { if (opt_flags & OPT_LOCAL) switch ((int)options[opt_idx].indir) @@ -5583,17 +5978,15 @@ insecure_flag(opt_idx, opt_flags) #endif #ifdef FEAT_TITLE -static void redraw_titles __ARGS((void)); +static void redraw_titles(void); /* * Redraw the window title and/or tab page text later. */ -static void redraw_titles() +static void redraw_titles(void) { need_maketitle = TRUE; -# ifdef FEAT_WINDOWS redraw_tabline = TRUE; -# endif } #endif @@ -5605,12 +5998,12 @@ static void redraw_titles() * SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid". */ void -set_string_option_direct(name, opt_idx, val, opt_flags, set_sid) - char_u *name; - int opt_idx; - char_u *val; - int opt_flags; /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ - int set_sid UNUSED; +set_string_option_direct( + char_u *name, + int opt_idx, + char_u *val, + int opt_flags, /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ + int set_sid UNUSED) { char_u *s; char_u **varp; @@ -5623,6 +6016,7 @@ set_string_option_direct(name, opt_idx, val, opt_flags, set_sid) if (idx < 0) /* not found (should not happen) */ { EMSG2(_(e_intern2), "set_string_option_direct()"); + IEMSG2(_("For option %s"), name); return; } } @@ -5664,9 +6058,9 @@ set_string_option_direct(name, opt_idx, val, opt_flags, set_sid) * Set global value for string option when it's a local option. */ static void -set_string_option_global(opt_idx, varp) - int opt_idx; /* option index */ - char_u **varp; /* pointer to option variable */ +set_string_option_global( + int opt_idx, /* option index */ + char_u **varp) /* pointer to option variable */ { char_u **p, *s; @@ -5682,6 +6076,11 @@ set_string_option_global(opt_idx, varp) free_string_option(*p); *p = s; } + +#ifdef USE_MIGEMO + if (varp == &p_migdict) + reset_migemo(FALSE); +#endif } /* @@ -5690,14 +6089,18 @@ set_string_option_global(opt_idx, varp) * Returns NULL on success or error message on error. */ static char_u * -set_string_option(opt_idx, value, opt_flags) - int opt_idx; - char_u *value; - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +set_string_option( + int opt_idx, + char_u *value, + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { char_u *s; char_u **varp; char_u *oldval; +#if defined(FEAT_EVAL) + char_u *saved_oldval = NULL; + char_u *saved_newval = NULL; +#endif char_u *r = NULL; if (options[opt_idx].var == NULL) /* don't set hidden option */ @@ -5713,26 +6116,61 @@ set_string_option(opt_idx, value, opt_flags) : opt_flags); oldval = *varp; *varp = s; + +#if defined(FEAT_EVAL) + if (!starting +# ifdef FEAT_CRYPT + && options[opt_idx].indir != PV_KEY +# endif + ) + { + saved_oldval = vim_strsave(oldval); + saved_newval = vim_strsave(s); + } +#endif if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL, opt_flags)) == NULL) did_set_option(opt_idx, opt_flags, TRUE); + +#if defined(FEAT_EVAL) + /* call autocommand after handling side effects */ + if (r == NULL) + trigger_optionsset_string(opt_idx, opt_flags, + saved_oldval, saved_newval); + vim_free(saved_oldval); + vim_free(saved_newval); +#endif } return r; } +/* + * Return TRUE if "val" is a valid 'filetype' name. + * Also used for 'syntax' and 'keymap'. + */ + static int +valid_filetype(char_u *val) +{ + char_u *s; + + for (s = val; *s != NUL; ++s) + if (!ASCII_ISALNUM(*s) && vim_strchr((char_u *)".-_", *s) == NULL) + return FALSE; + return TRUE; +} + /* * Handle string options that need some action to perform when changed. * Returns NULL for success, or an error message for an error. */ static char_u * -did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, - opt_flags) - int opt_idx; /* index in options[] table */ - char_u **varp; /* pointer to the option variable */ - int new_value_alloced; /* new value was allocated */ - char_u *oldval; /* previous value of the option */ - char_u *errbuf; /* buffer for errors, or NULL */ - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +did_set_string_option( + int opt_idx, /* index in options[] table */ + char_u **varp, /* pointer to the option variable */ + int new_value_alloced, /* new value was allocated */ + char_u *oldval, /* previous value of the option */ + char_u *errbuf, /* buffer for errors, or NULL */ + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { char_u *errmsg = NULL; char_u *s, *p; @@ -5743,6 +6181,10 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, /* set when changing an option that only requires a redraw in the GUI */ int redraw_gui_only = FALSE; #endif + int value_changed = FALSE; +#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) + int did_swaptcap = FALSE; +#endif /* Get the global option to compare with, otherwise we would have to check * two values for all local options. */ @@ -5758,11 +6200,15 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, errmsg = e_secure; } - /* Check for a "normal" file name in some options. Disallow a path - * separator (slash and/or backslash), wildcards and characters that are - * often illegal in a file name. */ - else if ((options[opt_idx].flags & P_NFNAME) - && vim_strpbrk(*varp, (char_u *)"/\\*?[|<>") != NULL) + /* Check for a "normal" directory or file name in some options. Disallow a + * path separator (slash and/or backslash), wildcards and characters that + * are often illegal in a file name. Be more permissive if "secure" is off. + */ + else if (((options[opt_idx].flags & P_NFNAME) + && vim_strpbrk(*varp, (char_u *)(secure + ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL) + || ((options[opt_idx].flags & P_NDNAME) + && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) { errmsg = e_invarg; } @@ -5781,22 +6227,44 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, else if (set_termname(T_NAME) == FAIL) errmsg = (char_u *)N_("E522: Not found in termcap"); else + { /* Screen colors may have changed. */ redraw_later_clear(); + + /* Both 'term' and 'ttytype' point to T_NAME, only set the + * P_ALLOCED flag on 'term'. */ + opt_idx = findoption((char_u *)"term"); + free_oldval = (options[opt_idx].flags & P_ALLOCED); + } } /* 'backupcopy' */ - else if (varp == &p_bkc) + else if (gvarp == &p_bkc) { - if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK) - errmsg = e_invarg; - if (((bkc_flags & BKC_AUTO) != 0) - + ((bkc_flags & BKC_YES) != 0) - + ((bkc_flags & BKC_NO) != 0) != 1) + char_u *bkc = p_bkc; + unsigned int *flags = &bkc_flags; + + if (opt_flags & OPT_LOCAL) { - /* Must have exactly one of "auto", "yes" and "no". */ - (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE); - errmsg = e_invarg; + bkc = curbuf->b_p_bkc; + flags = &curbuf->b_bkc_flags; + } + + if ((opt_flags & OPT_LOCAL) && *bkc == NUL) + /* make the local value empty: use the global value */ + *flags = 0; + else + { + if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) + errmsg = e_invarg; + if ((((int)*flags & BKC_AUTO) != 0) + + (((int)*flags & BKC_YES) != 0) + + (((int)*flags & BKC_NO) != 0) != 1) + { + /* Must have exactly one of "auto", "yes" and "no". */ + (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); + errmsg = e_invarg; + } } } @@ -5811,15 +6279,15 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, /* 'breakindentopt' */ else if (varp == &curwin->w_p_briopt) { - if (briopt_check() == FAIL) + if (briopt_check(curwin) == FAIL) errmsg = e_invarg; } #endif /* - * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[] + * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[] * If the new option is invalid, use old value. 'lisp' option: refill - * chartab[] for '-' char + * g_chartab[] for '-' char */ else if ( varp == &p_isi || varp == &(curbuf->b_p_isk) @@ -5909,26 +6377,22 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #endif /* 'scrollopt' */ -#ifdef FEAT_SCROLLBIND else if (varp == &p_sbo) { if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK) errmsg = e_invarg; } -#endif /* 'ambiwidth' */ #ifdef FEAT_MBYTE - else if (varp == &p_ambw) + else if (varp == &p_ambw || varp == &p_emoji) { if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) errmsg = e_invarg; else if (set_chars_option(&p_lcs) != NULL) errmsg = (char_u *)_("E834: Conflicts with value of 'listchars'"); -# if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) else if (set_chars_option(&p_fcs) != NULL) errmsg = (char_u *)_("E835: Conflicts with value of 'fillchars'"); -# endif } #endif @@ -5999,18 +6463,17 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } #endif -#ifdef FEAT_AUTOCMD /* 'eventignore' */ else if (varp == &p_ei) { if (check_ei() == FAIL) errmsg = e_invarg; } -#endif #ifdef FEAT_MBYTE - /* 'encoding' and 'fileencoding' */ - else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc) + /* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */ + else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc + || gvarp == &p_menc) { if (gvarp == &p_fenc) { @@ -6075,8 +6538,13 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, * display output conversion. */ if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) { - convert_setup(&input_conv, p_tenc, p_enc); - convert_setup(&output_conv, p_enc, p_tenc); + if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL + || convert_setup(&output_conv, p_enc, p_tenc) == FAIL) + { + EMSG3(_("E950: Cannot convert between %s and %s"), + p_tenc, p_enc); + errmsg = e_invarg; + } } # if defined(WIN3264) && defined(FEAT_MBYTE) @@ -6115,7 +6583,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) else if (varp == &p_imak) { - if (gui.in_use && !im_xim_isvalid_imactivate()) + if (!im_xim_isvalid_imactivate()) errmsg = e_invarg; } #endif @@ -6123,8 +6591,11 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #ifdef FEAT_KEYMAP else if (varp == &curbuf->b_p_keymap) { - /* load or unload key mapping tables */ - errmsg = keymap_init(); + if (!valid_filetype(*varp)) + errmsg = e_invarg; + else + /* load or unload key mapping tables */ + errmsg = keymap_init(); if (errmsg == NULL) { @@ -6148,9 +6619,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, set_iminsert_global(); set_imsearch_global(); } -# ifdef FEAT_WINDOWS status_redraw_curbuf(); -# endif } } #endif @@ -6207,7 +6676,8 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, # endif if (STRCMP(curbuf->b_p_key, oldval) != 0) /* Need to update the swapfile. */ - ml_set_crypt_key(curbuf, oldval, get_crypt_method(curbuf)); + ml_set_crypt_key(curbuf, oldval, + *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm); } else if (gvarp == &p_cm) @@ -6218,7 +6688,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, p = p_cm; if (check_opt_strings(p, p_cm_values, TRUE) != OK) errmsg = e_invarg; - else if (get_crypt_method(curbuf) > 0 && blowfish_self_test() == FAIL) + else if (crypt_self_test() == FAIL) errmsg = e_invarg; else { @@ -6230,6 +6700,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, p_cm = vim_strsave((char_u *)"zip"); new_value_alloced = TRUE; } + /* When using ":set cm=name" the local value is going to be empty. + * Do that here, otherwise the crypt functions will still use the + * local value. */ + if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) + { + free_string_option(curbuf->b_p_cm); + curbuf->b_p_cm = empty_option; + } /* Need to update the swapfile when the effective method changed. * Set "s" to the effective old value, "p" to the effective new @@ -6243,8 +6721,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, else p = curbuf->b_p_cm; if (STRCMP(s, p) != 0) - ml_set_crypt_key(curbuf, curbuf->b_p_key, - crypt_method_from_string(s)); + ml_set_crypt_key(curbuf, curbuf->b_p_key, s); /* If the global value changes need to update the swapfile for all * buffers using that value. */ @@ -6252,10 +6729,9 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) if (buf != curbuf && *buf->b_p_cm == NUL) - ml_set_crypt_key(buf, buf->b_p_key, - crypt_method_from_string(oldval)); + ml_set_crypt_key(buf, buf->b_p_key, oldval); } } } @@ -6346,13 +6822,11 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, errmsg = set_chars_option(varp); } -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) /* 'fillchars' */ else if (varp == &p_fcs) { errmsg = set_chars_option(varp); } -#endif #ifdef FEAT_CMDWIN /* 'cedit' */ @@ -6454,6 +6928,13 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, vim_free(T_CCO); T_CCO = empty_option; } +#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) + if (is_term_win32()) + { + swap_tcap(); + did_swaptcap = TRUE; + } +#endif /* We now have a different color setup, initialize it again. */ init_highlight(TRUE, FALSE); } @@ -6463,13 +6944,22 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { out_str(T_ME); redraw_later(CLEAR); -#if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32)) +#if defined(WIN3264) && !defined(FEAT_GUI_W32) /* Since t_me has been set, this probably means that the user * wants to use this as default colors. Need to reset default * background/foreground colors. */ mch_set_normal_colors(); #endif } + if (varp == &T_BE && termcap_active) + { + if (*T_BE == NUL) + /* When clearing t_BE we assume the user no longer wants + * bracketed paste, thus disable it by writing t_BD. */ + out_str(T_BD); + else + out_str(T_BE); + } } #ifdef FEAT_LINEBREAK @@ -6480,7 +6970,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { if (ptr2cells(s) != 1) errmsg = (char_u *)N_("E595: contains unprintable or wide character"); - mb_ptr_adv(s); + MB_PTR_ADV(s); } } #endif @@ -6600,8 +7090,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, else stl_syntax &= ~flagval; # endif - did_set_title(varp == &p_iconstring); - + did_set_title(); } #endif @@ -6718,14 +7207,12 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } -#ifdef FEAT_VERTSPLIT /* 'eadirection' */ else if (varp == &p_ead) { if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK) errmsg = e_invarg; } -#endif #ifdef FEAT_CLIPBOARD /* 'clipboard' */ @@ -6736,30 +7223,10 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #ifdef FEAT_SPELL /* When 'spelllang' or 'spellfile' is set and there is a window for this * buffer in which 'spell' is set load the wordlists. */ - else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) + else if (varp == &(curwin->w_s->b_p_spl) + || varp == &(curwin->w_s->b_p_spf)) { - win_T *wp; - int l; - - if (varp == &(curbuf->b_s.b_p_spf)) - { - l = (int)STRLEN(curbuf->b_s.b_p_spf); - if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4, - ".add") != 0)) - errmsg = e_invarg; - } - - if (errmsg == NULL) - { - FOR_ALL_WINDOWS(wp) - if (wp->w_buffer == curbuf && wp->w_p_spell) - { - errmsg = did_set_spelllang(wp); -# ifdef FEAT_WINDOWS - break; -# endif - } - } + errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf)); } /* When 'spellcapcheck' is set compile the regexp program. */ else if (varp == &(curwin->w_s->b_p_spc)) @@ -6780,7 +7247,6 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } #endif -#ifdef FEAT_QUICKFIX /* When 'bufhidden' is set, check for valid value. */ else if (gvarp == &p_bh) { @@ -6795,20 +7261,17 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, errmsg = e_invarg; else { -# ifdef FEAT_WINDOWS if (curwin->w_status_height) { curwin->w_redr_status = TRUE; redraw_later(VALID); } -# endif curbuf->b_help = (curbuf->b_p_bt[0] == 'h'); -# ifdef FEAT_TITLE +#ifdef FEAT_TITLE redraw_titles(); -# endif +#endif } } -#endif #ifdef FEAT_STL_OPT /* 'statusline' or 'rulerformat' */ @@ -6860,7 +7323,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, /* skip optional filename after 'k' and 's' */ while (*s && *s != ',' && *s != ' ') { - if (*s == '\\') + if (*s == '\\' && s[1] != NUL) ++s; ++s; } @@ -6887,11 +7350,23 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK) errmsg = e_invarg; + else + completeopt_was_set(); } #endif /* FEAT_INS_EXPAND */ +#ifdef FEAT_SIGNS + /* 'signcolumn' */ + else if (varp == &curwin->w_p_scl) + { + if (check_opt_strings(*varp, p_scl_values, FALSE) != OK) + errmsg = e_invarg; + } +#endif + #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) + /* 'toolbar' */ else if (varp == &p_toolbar) { if (opt_strings_flags(p_toolbar, p_toolbar_values, @@ -6942,12 +7417,41 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { if (VIM_ISDIGIT(*p_bs)) { - if (*p_bs >'2' || p_bs[1] != NUL) + if (*p_bs > '2' || p_bs[1] != NUL) errmsg = e_invarg; } else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK) errmsg = e_invarg; } + else if (varp == &p_bo) + { + if (opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE) != OK) + errmsg = e_invarg; + } + + /* 'tagcase' */ + else if (gvarp == &p_tc) + { + unsigned int *flags; + + if (opt_flags & OPT_LOCAL) + { + p = curbuf->b_p_tc; + flags = &curbuf->b_tc_flags; + } + else + { + p = p_tc; + flags = &tc_flags; + } + + if ((opt_flags & OPT_LOCAL) && *p == NUL) + /* make the local value empty: use the global value */ + *flags = 0; + else if (*p == NUL + || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK) + errmsg = e_invarg; + } #ifdef FEAT_MBYTE /* 'casemap' */ @@ -7086,23 +7590,72 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } #endif +#if defined(FEAT_RENDER_OPTIONS) + /* 'renderoptions' */ + else if (varp == &p_rop) + { + if (!gui_mch_set_rendering_options(p_rop)) + errmsg = e_invarg; + } +#endif + + else if (gvarp == &p_ft) + { + if (!valid_filetype(*varp)) + errmsg = e_invarg; + else + value_changed = STRCMP(oldval, *varp) != 0; + } + +#ifdef FEAT_SYN_HL + else if (gvarp == &p_syn) + { + if (!valid_filetype(*varp)) + errmsg = e_invarg; + else + value_changed = STRCMP(oldval, *varp) != 0; + } +#endif + +#ifdef FEAT_TERMINAL + /* 'termwinkey' */ + else if (varp == &curwin->w_p_twk) + { + if (*curwin->w_p_twk != NUL + && string_to_key(curwin->w_p_twk, TRUE) == 0) + errmsg = e_invarg; + } + /* 'termwinsize' */ + else if (varp == &curwin->w_p_tws) + { + if (*curwin->w_p_tws != NUL) + { + p = skipdigits(curwin->w_p_tws); + if (p == curwin->w_p_tws + || (*p != 'x' && *p != '*') + || *skipdigits(p + 1) != NUL) + errmsg = e_invarg; + } + } +#endif + /* Options that are a list of flags. */ else { p = NULL; - if (varp == &p_ww) + if (varp == &p_ww) /* 'whichwrap' */ p = (char_u *)WW_ALL; - if (varp == &p_shm) + if (varp == &p_shm) /* 'shortmess' */ p = (char_u *)SHM_ALL; - else if (varp == &(p_cpo)) + else if (varp == &(p_cpo)) /* 'cpoptions' */ p = (char_u *)CPO_ALL; - else if (varp == &(curbuf->b_p_fo)) + else if (varp == &(curbuf->b_p_fo)) /* 'formatoptions' */ p = (char_u *)FO_ALL; #ifdef FEAT_CONCEAL - else if (varp == &curwin->w_p_cocu) + else if (varp == &curwin->w_p_cocu) /* 'concealcursor' */ p = (char_u *)COCU_ALL; #endif - else if (varp == &p_mouse) + else if (varp == &p_mouse) /* 'mouse' */ { #ifdef FEAT_MOUSE p = (char_u *)MOUSE_ALL; @@ -7112,7 +7665,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #endif } #if defined(FEAT_GUI) - else if (varp == &p_go) + else if (varp == &p_go) /* 'guioptions' */ p = (char_u *)GO_ALL; #endif if (p != NULL) @@ -7174,26 +7727,44 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) set_string_option_global(opt_idx, varp); -#ifdef FEAT_AUTOCMD /* * Trigger the autocommand only after setting the flags. */ -# ifdef FEAT_SYN_HL +#ifdef FEAT_SYN_HL /* When 'syntax' is set, load the syntax of that name */ if (varp == &(curbuf->b_p_syn)) { - apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, - curbuf->b_fname, TRUE, curbuf); + static int syn_recursive = 0; + + ++syn_recursive; + // Only pass TRUE for "force" when the value changed or not used + // recursively, to avoid endless recurrence. + apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname, + value_changed || syn_recursive == 1, curbuf); + --syn_recursive; } -# endif +#endif else if (varp == &(curbuf->b_p_ft)) { - /* 'filetype' is set, trigger the FileType autocommand */ - did_filetype = TRUE; - apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, - curbuf->b_fname, TRUE, curbuf); + /* 'filetype' is set, trigger the FileType autocommand. + * Skip this when called from a modeline and the filetype was + * already set to this value. */ + if (!(opt_flags & OPT_MODELINE) || value_changed) + { + static int ft_recursive = 0; + + ++ft_recursive; + did_filetype = TRUE; + // Only pass TRUE for "force" when the value changed or not + // used recursively, to avoid endless recurrence. + apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname, + value_changed || ft_recursive == 1, curbuf); + --ft_recursive; + /* Just in case the old "curbuf" is now invalid. */ + if (varp != &(curbuf->b_p_ft)) + varp = NULL; + } } -#endif #ifdef FEAT_SPELL if (varp == &(curwin->w_s->b_p_spl)) { @@ -7214,7 +7785,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, if (vim_strchr((char_u *)"_.,", *p) != NULL) break; vim_snprintf((char *)fname, 200, "spell/%.*s.vim", (int)(p - q), q); - source_runtime(fname, TRUE); + source_runtime(fname, DIP_ALL); } #endif } @@ -7232,7 +7803,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #endif if (curwin->w_curswant != MAXCOL - && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) curwin->w_set_curswant = TRUE; #ifdef FEAT_GUI @@ -7241,6 +7812,16 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #endif check_redraw(options[opt_idx].flags); +#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) + if (did_swaptcap) + { + if (t_colors < 256) + p_tgc = 0; + set_termname((char_u *)"win32"); + init_highlight(TRUE, FALSE); + } +#endif + return errmsg; } @@ -7249,9 +7830,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, * Simple int comparison function for use with qsort() */ static int -int_cmp(a, b) - const void *a; - const void *b; +int_cmp(const void *a, const void *b) { return *(const int *)a - *(const int *)b; } @@ -7261,8 +7840,7 @@ int_cmp(a, b) * Returns error message, NULL if it's OK. */ char_u * -check_colorcolumn(wp) - win_T *wp; +check_colorcolumn(win_T *wp) { char_u *s; int col; @@ -7333,8 +7911,7 @@ check_colorcolumn(wp) * Returns error message, NULL if it's OK. */ static char_u * -set_chars_option(varp) - char_u **varp; +set_chars_option(char_u **varp) { int round, i, len, entries; char_u *p, *s; @@ -7344,7 +7921,6 @@ set_chars_option(varp) int *cp; char *name; }; -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) static struct charstab filltab[] = { {&fill_stl, "stl"}, @@ -7353,13 +7929,13 @@ set_chars_option(varp) {&fill_fold, "fold"}, {&fill_diff, "diff"}, }; -#endif static struct charstab lcstab[] = { {&lcs_eol, "eol"}, {&lcs_ext, "extends"}, {&lcs_nbsp, "nbsp"}, {&lcs_prec, "precedes"}, + {&lcs_space, "space"}, {&lcs_tab2, "tab"}, {&lcs_trail, "trail"}, #ifdef FEAT_CONCEAL @@ -7370,20 +7946,16 @@ set_chars_option(varp) }; struct charstab *tab; -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) if (varp == &p_lcs) -#endif { tab = lcstab; entries = sizeof(lcstab) / sizeof(struct charstab); } -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) else { tab = filltab; entries = sizeof(filltab) / sizeof(struct charstab); } -#endif /* first round: check for valid value, second round: assign values */ for (round = 0; round <= 1; ++round) @@ -7397,10 +7969,8 @@ set_chars_option(varp) *(tab[i].cp) = (varp == &p_lcs ? NUL : ' '); if (varp == &p_lcs) lcs_tab1 = NUL; -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) else fill_diff = '-'; -#endif } p = *varp; while (*p) @@ -7467,8 +8037,7 @@ set_chars_option(varp) * Return error message or NULL. */ char_u * -check_stl_option(s) - char_u *s; +check_stl_option(char_u *s) { int itemcnt = 0; int groupdepth = 0; @@ -7539,7 +8108,7 @@ check_stl_option(s) * Extract the items in the 'clipboard' option and set global values. */ static char_u * -check_clipboard_option() +check_clipboard_option(void) { int new_unnamed = 0; int new_autoselect_star = FALSE; @@ -7627,13 +8196,39 @@ check_clipboard_option() #endif #ifdef FEAT_SPELL + static char_u * +did_set_spell_option(int is_spellfile) +{ + char_u *errmsg = NULL; + win_T *wp; + int l; + + if (is_spellfile) + { + l = (int)STRLEN(curwin->w_s->b_p_spf); + if (l > 0 && (l < 4 + || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) + errmsg = e_invarg; + } + + if (errmsg == NULL) + { + FOR_ALL_WINDOWS(wp) + if (wp->w_buffer == curbuf && wp->w_p_spell) + { + errmsg = did_set_spelllang(wp); + break; + } + } + return errmsg; +} + /* * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. * Return error message when failed, NULL when OK. */ static char_u * -compile_cap_prog(synblock) - synblock_T *synblock; +compile_cap_prog(synblock_T *synblock) { regprog_T *rp = synblock->b_cap_prog; char_u *re; @@ -7667,10 +8262,7 @@ compile_cap_prog(synblock) * window-local value. */ static void -set_option_scriptID_idx(opt_idx, opt_flags, id) - int opt_idx; - int opt_flags; - int id; +set_option_scriptID_idx(int opt_idx, int opt_flags, int id) { int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; int indir = (int)options[opt_idx].indir; @@ -7694,11 +8286,11 @@ set_option_scriptID_idx(opt_idx, opt_flags, id) * Returns NULL for success, or an error message for an error. */ static char_u * -set_bool_option(opt_idx, varp, value, opt_flags) - int opt_idx; /* index in options[] table */ - char_u *varp; /* pointer to the option variable */ - int value; /* new value */ - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +set_bool_option( + int opt_idx, /* index in options[] table */ + char_u *varp, /* pointer to the option variable */ + int value, /* new value */ + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { int old_value = *(int *)varp; @@ -7734,6 +8326,15 @@ set_bool_option(opt_idx, varp, value, opt_flags) compatible_set(); } +#ifdef FEAT_LANGMAP + if ((int *)varp == &p_lrm) + /* 'langremap' -> !'langnoremap' */ + p_lnr = !p_lrm; + else if ((int *)varp == &p_lnr) + /* 'langnoremap' -> !'langremap' */ + p_lrm = !p_lnr; +#endif + #ifdef FEAT_PERSISTENT_UNDO /* 'undofile' */ else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) @@ -7746,7 +8347,7 @@ set_bool_option(opt_idx, varp, value, opt_flags) char_u hash[UNDO_HASH_SIZE]; buf_T *save_curbuf = curbuf; - for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) + FOR_ALL_BUFFERS(curbuf) { /* When 'undofile' is set globally: for every buffer, otherwise * only for the current buffer: Try to read in the undofile, @@ -7788,17 +8389,33 @@ set_bool_option(opt_idx, varp, value, opt_flags) } #endif -#ifdef FEAT_TITLE /* when 'modifiable' is changed, redraw the window title */ else if ((int *)varp == &curbuf->b_p_ma) { +# ifdef FEAT_TERMINAL + /* Cannot set 'modifiable' when in Terminal mode. */ + if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) + && curbuf->b_term != NULL && !term_is_finished(curbuf)))) + { + curbuf->b_p_ma = FALSE; + return (char_u *)N_("E946: Cannot make a terminal with running job modifiable"); + } +# endif +# ifdef FEAT_TITLE redraw_titles(); +# endif } +#ifdef FEAT_TITLE /* when 'endofline' is changed, redraw the window title */ else if ((int *)varp == &curbuf->b_p_eol) { redraw_titles(); } + /* when 'fixeol' is changed, redraw the window title */ + else if ((int *)varp == &curbuf->b_p_fixeol) + { + redraw_titles(); + } # ifdef FEAT_MBYTE /* when 'bomb' is changed, redraw the window title and tab page text */ else if ((int *)varp == &curbuf->b_p_bomb) @@ -7817,14 +8434,12 @@ set_bool_option(opt_idx, varp, value, opt_flags) #endif } -#ifdef FEAT_AUTOCMD /* when 'buflisted' changes, trigger autocommands */ else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl) { apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE, NULL, NULL, TRUE, curbuf); } -#endif /* when 'swf' is set, create swapfile, when reset remove swapfile */ else if ((int *)varp == &curbuf->b_p_swf) @@ -7871,7 +8486,8 @@ set_bool_option(opt_idx, varp, value, opt_flags) need_start_insertmode = TRUE; stop_insert_mode = FALSE; } - else + /* only reset if it was set previously */ + else if (old_value) { need_start_insertmode = FALSE; stop_insert_mode = TRUE; @@ -7891,11 +8507,10 @@ set_bool_option(opt_idx, varp, value, opt_flags) /* when 'hlsearch' is set or reset: reset no_hlsearch */ else if ((int *)varp == &p_hls) { - SET_NO_HLSEARCH(FALSE); + set_no_hlsearch(FALSE); } #endif -#ifdef FEAT_SCROLLBIND /* when 'scrollbind' is set: snapshot the current position to avoid a jump * at the end of normal_cmd() */ else if ((int *)varp == &curwin->w_p_scb) @@ -7906,9 +8521,8 @@ set_bool_option(opt_idx, varp, value, opt_flags) curwin->w_scbind_pos = curwin->w_topline; } } -#endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* There can be only one window with 'previewwindow' set. */ else if ((int *)varp == &curwin->w_p_pvw) { @@ -7916,7 +8530,7 @@ set_bool_option(opt_idx, varp, value, opt_flags) { win_T *win; - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) if (win->w_p_pvw && win != curwin) { curwin->w_p_pvw = FALSE; @@ -7966,6 +8580,21 @@ set_bool_option(opt_idx, varp, value, opt_flags) } #endif +#if defined(FEAT_GUI_MACVIM) + else if ((int *)varp == &p_macligatures) + { + gui_macvim_set_ligatures(p_macligatures); + } + else if ((int*)varp == &p_macthinstrokes) + { + gui_macvim_set_thinstrokes(p_macthinstrokes); + } + else if ((int *)varp == &p_mpfont) + { + gui_macvim_set_proportional_font(p_mpfont); + } +#endif + /* when 'textauto' is set or reset also change 'fileformats' */ else if ((int *)varp == &p_ta) set_string_option_direct((char_u *)"ffs", -1, @@ -7985,14 +8614,9 @@ set_bool_option(opt_idx, varp, value, opt_flags) #ifdef FEAT_TITLE /* when 'title' changed, may need to change the title; same for 'icon' */ - else if ((int *)varp == &p_title) - { - did_set_title(FALSE); - } - - else if ((int *)varp == &p_icon) + else if ((int *)varp == &p_title || (int *)varp == &p_icon) { - did_set_title(TRUE); + did_set_title(); } #endif @@ -8003,9 +8627,7 @@ set_bool_option(opt_idx, varp, value, opt_flags) #ifdef FEAT_TITLE redraw_titles(); #endif -#ifdef FEAT_AUTOCMD modified_was_set = value; -#endif } #ifdef BACKSLASH_IN_FILENAME @@ -8040,13 +8662,11 @@ set_bool_option(opt_idx, varp, value, opt_flags) curwin->w_leftcol = 0; } -#ifdef FEAT_WINDOWS else if ((int *)varp == &p_ea) { if (p_ea && !old_value) win_equal(curwin, FALSE, 0); } -#endif else if ((int *)varp == &p_wiv) { @@ -8061,13 +8681,22 @@ set_bool_option(opt_idx, varp, value, opt_flags) p_wiv = (*T_XS != NUL); } -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI else if ((int *)varp == &p_beval) { - if (p_beval && !old_value) - gui_mch_enable_beval_area(balloonEval); - else if (!p_beval && old_value) - gui_mch_disable_beval_area(balloonEval); + if (!balloonEvalForTerm) + { + if (p_beval && !old_value) + gui_mch_enable_beval_area(balloonEval); + else if (!p_beval && old_value) + gui_mch_disable_beval_area(balloonEval); + } + } +#endif +#ifdef FEAT_BEVAL_TERM + else if ((int *)varp == &p_bevalterm) + { + mch_bevalterm_changed(); } #endif @@ -8075,7 +8704,7 @@ set_bool_option(opt_idx, varp, value, opt_flags) else if ((int *)varp == &p_acd) { /* Change directories when the 'acd' option is set now. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; } #endif @@ -8092,7 +8721,7 @@ set_bool_option(opt_idx, varp, value, opt_flags) } #endif -#ifdef USE_IM_CONTROL +#ifdef HAVE_INPUT_METHOD /* 'imdisable' */ else if ((int *)varp == &p_imdisable) { @@ -8216,8 +8845,8 @@ set_bool_option(opt_idx, varp, value, opt_flags) { static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"); - msg_source(hl_attr(HLF_W)); - MSG_ATTR(_(w_arabic), hl_attr(HLF_W)); + msg_source(HL_ATTR(HLF_W)); + MSG_ATTR(_(w_arabic), HL_ATTR(HLF_W)); #ifdef FEAT_EVAL set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); #endif @@ -8271,15 +8900,59 @@ set_bool_option(opt_idx, varp, value, opt_flags) #endif +#ifdef FEAT_TERMGUICOLORS + /* 'termguicolors' */ + else if ((int *)varp == &p_tgc) + { +# ifdef FEAT_VTP + /* Do not turn on 'tgc' when 24-bit colors are not supported. */ + if (!has_vtp_working()) + { + p_tgc = 0; + return (char_u*)N_("E954: 24-bit colors are not supported on this environment"); + } + if (is_term_win32()) + swap_tcap(); +# endif +# ifdef FEAT_GUI + if (!gui.in_use && !gui.starting) +# endif + highlight_gui_started(); +# ifdef FEAT_VTP + control_console_color_rgb(); + /* reset t_Co */ + if (is_term_win32()) + set_termname(T_NAME); +# endif + } +#endif + /* * End of handling side effects for bool options. */ + /* after handling side effects, call autocommand */ + options[opt_idx].flags |= P_WAS_SET; +#if defined(FEAT_EVAL) + if (!starting) + { + char_u buf_old[2], buf_new[2], buf_type[7]; + vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE); + vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE); + vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global"); + set_vim_var_string(VV_OPTION_NEW, buf_new, -1); + set_vim_var_string(VV_OPTION_OLD, buf_old, -1); + set_vim_var_string(VV_OPTION_TYPE, buf_type, -1); + apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL); + reset_v_option_vars(); + } +#endif + comp_col(); /* in case 'ruler' or 'showcmd' changed */ if (curwin->w_curswant != MAXCOL - && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); @@ -8291,13 +8964,13 @@ set_bool_option(opt_idx, varp, value, opt_flags) * Returns NULL for success, or an error message for an error. */ static char_u * -set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) - int opt_idx; /* index in options[] table */ - char_u *varp; /* pointer to the option variable */ - long value; /* new value */ - char_u *errbuf; /* buffer for error messages */ - size_t errbuflen; /* length of "errbuf" */ - int opt_flags; /* OPT_LOCAL, OPT_GLOBAL and +set_num_option( + int opt_idx, /* index in options[] table */ + char_u *varp, /* pointer to the option variable */ + long value, /* new value */ + char_u *errbuf, /* buffer for error messages */ + size_t errbuflen, /* length of "errbuf" */ + int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and OPT_MODELINE */ { char_u *errmsg = NULL; @@ -8332,9 +9005,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) /* * Number options that need some action when changed */ -#ifdef FEAT_WINDOWS if (pp == &p_wh || pp == &p_hh) { + // 'winheight' and 'helpheight' if (p_wh < 1) { errmsg = e_positive; @@ -8352,7 +9025,7 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } /* Change window height NOW */ - if (lastwin != firstwin) + if (!ONE_WINDOW) { if (pp == &p_wh && curwin->w_height < p_wh) win_setheight((int)p_wh); @@ -8360,10 +9033,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) win_setheight((int)p_hh); } } - - /* 'winminheight' */ else if (pp == &p_wmh) { + // 'winminheight' if (p_wmh < 0) { errmsg = e_positive; @@ -8376,10 +9048,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } win_setminheight(); } - -# ifdef FEAT_VERTSPLIT else if (pp == &p_wiw) { + // 'winwidth' if (p_wiw < 1) { errmsg = e_positive; @@ -8392,13 +9063,12 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } /* Change window width NOW */ - if (lastwin != firstwin && curwin->w_width < p_wiw) + if (!ONE_WINDOW && curwin->w_width < p_wiw) win_setwidth((int)p_wiw); } - - /* 'winminwidth' */ else if (pp == &p_wmw) { + // 'winminwidth' if (p_wmw < 0) { errmsg = e_positive; @@ -8409,13 +9079,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) errmsg = e_winwidth; p_wmw = p_wiw; } - win_setminheight(); + win_setminwidth(); } -# endif -#endif - -#ifdef FEAT_WINDOWS /* (re)set last window status line */ else if (pp == &p_ls) { @@ -8427,10 +9093,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) { shell_new_rows(); /* recompute window positions and heights */ } -#endif #ifdef FEAT_GUI - else if (pp == &p_linespace) + else if (pp == &p_linespace || pp == &p_charspace) { /* Recompute gui.char_height and resize the Vim window to keep the * same number of lines. */ @@ -8439,6 +9104,16 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } #endif +#ifdef FEAT_GUI_MACVIM + else if (pp == &p_columnspace) + { + /* Recompute gui.char_width and resize the Vim window to keep the + * same number of columns. */ + if (gui.in_use && gui_mch_adjust_charwidth() == OK) + gui_set_shellsize(FALSE, FALSE, RESIZE_HOR); + } +#endif + #ifdef FEAT_FOLDING /* 'foldlevel' */ else if (pp == &curwin->w_p_fdl) @@ -8506,6 +9181,15 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } #endif +#ifdef USE_TRANSPARENCY + else if ((long *)varp == &p_transparency) + { + if (p_transparency < 1 || p_transparency > 255) + p_transparency = 255; + gui_mch_set_transparency(p_transparency); + } +#endif + else if (pp == &curbuf->b_p_iminsert) { if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST) @@ -8516,12 +9200,21 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) p_iminsert = curbuf->b_p_iminsert; if (termcap_active) /* don't do this in the alternate screen */ showmode(); -#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) +#if defined(FEAT_KEYMAP) /* Show/unshow value of 'keymap' in status lines. */ status_redraw_curbuf(); #endif } +#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(FEAT_GUI_MACVIM) + /* 'imstyle' */ + else if (pp == &p_imst) + { + if (p_imst != IM_ON_THE_SPOT && p_imst != IM_OVER_THE_SPOT) + errmsg = e_invarg; + } +#endif + else if (pp == &p_window) { if (p_window < 1) @@ -8606,6 +9299,15 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) mzvim_reset_timer(); #endif +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) + /* 'pyxversion' */ + else if (pp == &p_pyx) + { + if (p_pyx != 0 && p_pyx != 2 && p_pyx != 3) + errmsg = e_invarg; + } +#endif + /* sync undo before 'undolevels' changes */ else if (pp == &p_ul) { @@ -8636,7 +9338,7 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) errmsg = e_invarg; curwin->w_p_nuw = 10; } - curwin->w_nrwidth_line_count = 0; + curwin->w_nrwidth_line_count = 0; /* trigger a redraw */ } #endif @@ -8654,6 +9356,21 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } #endif +#ifdef FEAT_GUI_MACVIM + else if (pp == &p_blur) + { + if (p_blur < 0) + { + errmsg = e_invarg; + p_blur = old_value; + } + else + { + gui_macvim_set_blur(p_blur); + } + } +#endif + else if (pp == &curbuf->b_p_tw) { if (curbuf->b_p_tw < 0) @@ -8662,7 +9379,6 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) curbuf->b_p_tw = 0; } #ifdef FEAT_SYN_HL -# ifdef FEAT_WINDOWS { win_T *wp; tabpage_T *tp; @@ -8670,9 +9386,6 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) FOR_ALL_TAB_WINDOWS(tp, wp) check_colorcolumn(wp); } -# else - check_colorcolumn(curwin); -# endif #endif } @@ -8701,12 +9414,6 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } limit_screen_size(); -#ifdef DJGPP - /* avoid a crash by checking for a too large value of 'columns' */ - if (old_Columns != Columns && full_screen && term_console) - mch_check_columns(); -#endif - /* * If the screen (shell) height has been changed, assume it is the * physical screenheight. @@ -8826,9 +9533,24 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) options[opt_idx].flags |= P_WAS_SET; +#if defined(FEAT_EVAL) + if (!starting && errmsg == NULL) + { + char_u buf_old[11], buf_new[11], buf_type[7]; + vim_snprintf((char *)buf_old, 10, "%ld", old_value); + vim_snprintf((char *)buf_new, 10, "%ld", value); + vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global"); + set_vim_var_string(VV_OPTION_NEW, buf_new, -1); + set_vim_var_string(VV_OPTION_OLD, buf_old, -1); + set_vim_var_string(VV_OPTION_TYPE, buf_type, -1); + apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL); + reset_v_option_vars(); + } +#endif + comp_col(); /* in case 'columns' or 'ls' changed */ if (curwin->w_curswant != MAXCOL - && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); @@ -8839,22 +9561,21 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) * Called after an option changed: check if something needs to be redrawn. */ static void -check_redraw(flags) - long_u flags; +check_redraw(long_u flags) { /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */ int doclear = (flags & P_RCLR) == P_RCLR; int all = ((flags & P_RALL) == P_RALL || doclear); -#ifdef FEAT_WINDOWS if ((flags & P_RSTAT) || all) /* mark all status lines dirty */ status_redraw_all(); -#endif if ((flags & P_RBUF) || (flags & P_RWIN) || all) changed_window_setting(); if (flags & P_RBUF) redraw_curbuf_later(NOT_VALID); + if (flags & P_RWINONLY) + redraw_later(NOT_VALID); if (doclear) redraw_all_later(CLEAR); else if (all) @@ -8866,8 +9587,7 @@ check_redraw(flags) * Return -1 if not found. */ static int -findoption(arg) - char_u *arg; +findoption(char_u *arg) { int opt_idx; char *s, *p; @@ -8943,18 +9663,46 @@ findoption(arg) * unknown option: -3. */ int -get_option_value(name, numval, stringval, opt_flags) - char_u *name; - long *numval; - char_u **stringval; /* NULL when only checking existence */ - int opt_flags; +get_option_value( + char_u *name, + long *numval, + char_u **stringval, /* NULL when only checking existence */ + int opt_flags) { int opt_idx; char_u *varp; opt_idx = findoption(name); if (opt_idx < 0) /* unknown option */ + { + int key; + + if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_' + && (key = find_key_option(name)) != 0) + { + char_u key_name[2]; + char_u *p; + + if (key < 0) + { + key_name[0] = KEY2TERMCAP0(key); + key_name[1] = KEY2TERMCAP1(key); + } + else + { + key_name[0] = KS_KEY; + key_name[1] = (key & 0xff); + } + p = find_termcode(key_name); + if (p != NULL) + { + if (stringval != NULL) + *stringval = vim_strsave(p); + return 0; + } + } return -3; + } varp = get_varp_scope(&(options[opt_idx]), opt_flags); @@ -8987,7 +9735,7 @@ get_option_value(name, numval, stringval, opt_flags) if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else - *numval = *(int *)varp; + *numval = (long) *(int *)varp; } return 1; } @@ -9013,12 +9761,12 @@ get_option_value(name, numval, stringval, opt_flags) * Possible opt_type values: see SREQ_* in vim.h */ int -get_option_value_strict(name, numval, stringval, opt_type, from) - char_u *name; - long *numval; - char_u **stringval; /* NULL when only obtaining attributes */ - int opt_type; - void *from; +get_option_value_strict( + char_u *name, + long *numval, + char_u **stringval, /* NULL when only obtaining attributes */ + int opt_type, + void *from) { int opt_idx; char_u *varp = NULL; @@ -9132,20 +9880,19 @@ get_option_value_strict(name, numval, stringval, opt_type, from) } /* - * Iterate over options. First argument is a pointer to a pointer to a structure - * inside options[] array, second is option type like in the above function. + * Iterate over options. First argument is a pointer to a pointer to a + * structure inside options[] array, second is option type like in the above + * function. * - * If first argument points to NULL it is assumed that iteration just started + * If first argument points to NULL it is assumed that iteration just started * and caller needs the very first value. - * If first argument points to the end marker function returns NULL and sets + * If first argument points to the end marker function returns NULL and sets * first argument to NULL. * * Returns full option name for current option on each call. */ char_u * -option_iter_next(option, opt_type) - void **option; - int opt_type; +option_iter_next(void **option, int opt_type) { struct vimoption *ret = NULL; do @@ -9184,7 +9931,7 @@ option_iter_next(option, opt_type) ret = NULL; break; default: - EMSG2(_(e_intern2), "option_iter_next()"); + internal_error("option_iter_next()"); return NULL; } } @@ -9201,11 +9948,11 @@ option_iter_next(option, opt_type) * Returns NULL on success or error message on error. */ char_u * -set_option_value(name, number, string, opt_flags) - char_u *name; - long number; - char_u *string; - int opt_flags; /* OPT_LOCAL or 0 (both) */ +set_option_value( + char_u *name, + long number, + char_u *string, + int opt_flags) /* OPT_LOCAL or 0 (both) */ { int opt_idx; char_u *varp; @@ -9213,7 +9960,33 @@ set_option_value(name, number, string, opt_flags) opt_idx = findoption(name); if (opt_idx < 0) + { + int key; + + if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_' + && (key = find_key_option(name)) != 0) + { + char_u key_name[2]; + + if (key < 0) + { + key_name[0] = KEY2TERMCAP0(key); + key_name[1] = KEY2TERMCAP1(key); + } + else + { + key_name[0] = KS_KEY; + key_name[1] = (key & 0xff); + } + add_termcode(key_name, string, FALSE); + if (full_screen) + ttest(FALSE); + redraw_all_later(CLEAR); + return NULL; + } + EMSG2(_("E355: Unknown option: %s"), name); + } else { flags = options[opt_idx].flags; @@ -9268,8 +10041,7 @@ set_option_value(name, number, string, opt_flags) * Returns NULL when not found. */ char_u * -get_term_code(tname) - char_u *tname; +get_term_code(char_u *tname) { int opt_idx; char_u *varp; @@ -9288,7 +10060,7 @@ get_term_code(tname) } char_u * -get_highlight_default() +get_highlight_default(void) { int i; @@ -9300,7 +10072,7 @@ get_highlight_default() #if defined(FEAT_MBYTE) || defined(PROTO) char_u * -get_encoding_default() +get_encoding_default(void) { int i; @@ -9315,8 +10087,7 @@ get_encoding_default() * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number. */ static int -find_key_option(arg) - char_u *arg; +find_key_option(char_u *arg) { int key; int modifiers; @@ -9331,7 +10102,7 @@ find_key_option(arg) { --arg; /* put arg at the '<' */ modifiers = 0; - key = find_special_key(&arg, &modifiers, TRUE, TRUE); + key = find_special_key(&arg, &modifiers, TRUE, TRUE, FALSE); if (modifiers) /* can't handle modifiers here */ key = 0; } @@ -9344,9 +10115,9 @@ find_key_option(arg) * if 'all' == 2: show all terminal options */ static void -showoptions(all, opt_flags) - int all; - int opt_flags; /* OPT_LOCAL and/or OPT_GLOBAL */ +showoptions( + int all, + int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ { struct vimoption *p; int col; @@ -9453,9 +10224,7 @@ showoptions(all, opt_flags) * Return TRUE if option "p" has its default value. */ static int -optval_default(p, varp) - struct vimoption *p; - char_u *varp; +optval_default(struct vimoption *p, char_u *varp) { int dvi; @@ -9477,9 +10246,9 @@ optval_default(p, varp) * must not be called with a hidden option! */ static void -showoneopt(p, opt_flags) - struct vimoption *p; - int opt_flags; /* OPT_LOCAL or OPT_GLOBAL */ +showoneopt( + struct vimoption *p, + int opt_flags) /* OPT_LOCAL or OPT_GLOBAL */ { char_u *varp; int save_silent = silent_mode; @@ -9533,10 +10302,7 @@ showoneopt(p, opt_flags) * Return FAIL on error, OK otherwise. */ int -makeset(fd, opt_flags, local_only) - FILE *fd; - int opt_flags; - int local_only; +makeset(FILE *fd, int opt_flags, int local_only) { struct vimoption *p; char_u *varp; /* currently used value */ @@ -9617,22 +10383,15 @@ makeset(fd, opt_flags, local_only) } else /* P_STRING */ { -#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) int do_endif = FALSE; /* Don't set 'syntax' and 'filetype' again if the value is * already right, avoids reloading the syntax file. */ if ( -# if defined(FEAT_SYN_HL) - p->indir == PV_SYN -# if defined(FEAT_AUTOCMD) - || -# endif -# endif -# if defined(FEAT_AUTOCMD) - p->indir == PV_FT -# endif - ) +#if defined(FEAT_SYN_HL) + p->indir == PV_SYN || +#endif + p->indir == PV_FT) { if (fprintf(fd, "if &%s != '%s'", p->fullname, *(char_u **)(varp)) < 0 @@ -9640,17 +10399,14 @@ makeset(fd, opt_flags, local_only) return FAIL; do_endif = TRUE; } -#endif if (put_setstring(fd, cmd, p->fullname, (char_u **)varp, (p->flags & P_EXPAND) != 0) == FAIL) return FAIL; -#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) if (do_endif) { if (put_line(fd, "endif") == FAIL) return FAIL; } -#endif } } } @@ -9664,8 +10420,7 @@ makeset(fd, opt_flags, local_only) * 'sessionoptions' or 'viewoptions' contains "folds" but not "options". */ int -makefoldset(fd) - FILE *fd; +makefoldset(FILE *fd) { if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, FALSE) == FAIL # ifdef FEAT_EVAL @@ -9688,12 +10443,12 @@ makefoldset(fd) #endif static int -put_setstring(fd, cmd, name, valuep, expand) - FILE *fd; - char *cmd; - char *name; - char_u **valuep; - int expand; +put_setstring( + FILE *fd, + char *cmd, + char *name, + char_u **valuep, + int expand) { char_u *s; char_u *buf; @@ -9734,11 +10489,11 @@ put_setstring(fd, cmd, name, valuep, expand) } static int -put_setnum(fd, cmd, name, valuep) - FILE *fd; - char *cmd; - char *name; - long *valuep; +put_setnum( + FILE *fd, + char *cmd, + char *name, + long *valuep) { long wc; @@ -9758,11 +10513,11 @@ put_setnum(fd, cmd, name, valuep) } static int -put_setbool(fd, cmd, name, value) - FILE *fd; - char *cmd; - char *name; - int value; +put_setbool( + FILE *fd, + char *cmd, + char *name, + int value) { if (value < 0) /* global/local option using global value */ return OK; @@ -9778,7 +10533,7 @@ put_setbool(fd, cmd, name, value) * Terminal options are never hidden or indirect. */ void -clear_termoptions() +clear_termoptions(void) { /* * Reset a few things before clearing the old options. This may cause @@ -9797,19 +10552,13 @@ clear_termoptions() if (gui.starting) clear_xterm_clip(); #endif -#ifdef WIN3264 - /* - * Check if this is allowed now. - */ - if (can_end_termcap_mode(FALSE) == TRUE) -#endif - stoptermcap(); /* stop termcap mode */ + stoptermcap(); /* stop termcap mode */ free_termoptions(); } void -free_termoptions() +free_termoptions(void) { struct vimoption *p; @@ -9833,8 +10582,7 @@ free_termoptions() * "var" points to the option value. */ void -free_one_termoption(var) - char_u *var; +free_one_termoption(char_u *var) { struct vimoption *p; @@ -9854,7 +10602,7 @@ free_one_termoption(var) * Used after setting the terminal name. */ void -set_term_defaults() +set_term_defaults(void) { struct vimoption *p; @@ -9881,8 +10629,7 @@ set_term_defaults() * return TRUE if 'p' starts with 't_' */ static int -istermoption(p) - struct vimoption *p; +istermoption(struct vimoption *p) { return (p->fullname[0] == 't' && p->fullname[1] == '_'); } @@ -9897,20 +10644,20 @@ istermoption(p) #define COL_RULER 17 /* columns needed by standard ruler */ void -comp_col() +comp_col(void) { -#if defined(FEAT_CMDL_INFO) && defined(FEAT_WINDOWS) - int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin)); +#if defined(FEAT_CMDL_INFO) + int last_has_status = (p_ls == 2 || (p_ls == 1 && !ONE_WINDOW)); sc_col = 0; ru_col = 0; if (p_ru) { -#ifdef FEAT_STL_OPT +# ifdef FEAT_STL_OPT ru_col = (ru_wid ? ru_wid : COL_RULER) + 1; -#else +# else ru_col = COL_RULER + 1; -#endif +# endif /* no last status line, adjust sc_col */ if (!last_has_status) sc_col = ru_col; @@ -9937,15 +10684,15 @@ comp_col() * Unset local option value, similar to ":set opt<". */ void -unset_global_local_option(name, from) - char_u *name; - void *from; +unset_global_local_option(char_u *name, void *from) { struct vimoption *p; int opt_idx; buf_T *buf = (buf_T *)from; opt_idx = findoption(name); + if (opt_idx < 0) + return; p = &(options[opt_idx]); switch ((int)p->indir) @@ -9963,9 +10710,17 @@ unset_global_local_option(name, from) case PV_AR: buf->b_p_ar = -1; break; + case PV_BKC: + clear_string_option(&buf->b_p_bkc); + buf->b_bkc_flags = 0; + break; case PV_TAGS: clear_string_option(&buf->b_p_tags); break; + case PV_TC: + clear_string_option(&buf->b_p_tc); + buf->b_tc_flags = 0; + break; #ifdef FEAT_FIND_ID case PV_DEF: clear_string_option(&buf->b_p_def); @@ -9982,6 +10737,9 @@ unset_global_local_option(name, from) clear_string_option(&buf->b_p_tsr); break; #endif + case PV_FP: + clear_string_option(&buf->b_p_fp); + break; #ifdef FEAT_QUICKFIX case PV_EFM: clear_string_option(&buf->b_p_efm); @@ -10015,6 +10773,11 @@ unset_global_local_option(name, from) case PV_LW: clear_string_option(&buf->b_p_lw); break; +#endif +#ifdef FEAT_MBYTE + case PV_MENC: + clear_string_option(&buf->b_p_menc); + break; #endif } } @@ -10023,9 +10786,7 @@ unset_global_local_option(name, from) * Get pointer to option variable, depending on local or global scope. */ static char_u * -get_varp_scope(p, opt_flags) - struct vimoption *p; - int opt_flags; +get_varp_scope(struct vimoption *p, int opt_flags) { if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE) { @@ -10037,6 +10798,7 @@ get_varp_scope(p, opt_flags) { switch ((int)p->indir) { + case PV_FP: return (char_u *)&(curbuf->b_p_fp); #ifdef FEAT_QUICKFIX case PV_EFM: return (char_u *)&(curbuf->b_p_efm); case PV_GP: return (char_u *)&(curbuf->b_p_gp); @@ -10047,6 +10809,7 @@ get_varp_scope(p, opt_flags) case PV_PATH: return (char_u *)&(curbuf->b_p_path); case PV_AR: return (char_u *)&(curbuf->b_p_ar); case PV_TAGS: return (char_u *)&(curbuf->b_p_tags); + case PV_TC: return (char_u *)&(curbuf->b_p_tc); #ifdef FEAT_FIND_ID case PV_DEF: return (char_u *)&(curbuf->b_p_def); case PV_INC: return (char_u *)&(curbuf->b_p_inc); @@ -10067,6 +10830,10 @@ get_varp_scope(p, opt_flags) case PV_UL: return (char_u *)&(curbuf->b_p_ul); #ifdef FEAT_LISP case PV_LW: return (char_u *)&(curbuf->b_p_lw); +#endif + case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); +#ifdef FEAT_MBYTE + case PV_MENC: return (char_u *)&(curbuf->b_p_menc); #endif } return NULL; /* "cannot happen" */ @@ -10078,8 +10845,7 @@ get_varp_scope(p, opt_flags) * Get pointer to option variable. */ static char_u * -get_varp(p) - struct vimoption *p; +get_varp(struct vimoption *p) { /* hidden option, always return NULL */ if (p->var == NULL) @@ -10100,6 +10866,10 @@ get_varp(p) ? (char_u *)&(curbuf->b_p_ar) : p->var; case PV_TAGS: return *curbuf->b_p_tags != NUL ? (char_u *)&(curbuf->b_p_tags) : p->var; + case PV_TC: return *curbuf->b_p_tc != NUL + ? (char_u *)&(curbuf->b_p_tc) : p->var; + case PV_BKC: return *curbuf->b_p_bkc != NUL + ? (char_u *)&(curbuf->b_p_bkc) : p->var; #ifdef FEAT_FIND_ID case PV_DEF: return *curbuf->b_p_def != NUL ? (char_u *)&(curbuf->b_p_def) : p->var; @@ -10112,6 +10882,8 @@ get_varp(p) case PV_TSR: return *curbuf->b_p_tsr != NUL ? (char_u *)&(curbuf->b_p_tsr) : p->var; #endif + case PV_FP: return *curbuf->b_p_fp != NUL + ? (char_u *)&(curbuf->b_p_fp) : p->var; #ifdef FEAT_QUICKFIX case PV_EFM: return *curbuf->b_p_efm != NUL ? (char_u *)&(curbuf->b_p_efm) : p->var; @@ -10138,6 +10910,10 @@ get_varp(p) case PV_LW: return *curbuf->b_p_lw != NUL ? (char_u *)&(curbuf->b_p_lw) : p->var; #endif +#ifdef FEAT_MBYTE + case PV_MENC: return *curbuf->b_p_menc != NUL + ? (char_u *)&(curbuf->b_p_menc) : p->var; +#endif #ifdef FEAT_ARABIC case PV_ARAB: return (char_u *)&(curwin->w_p_arab); @@ -10173,13 +10949,9 @@ get_varp(p) #ifdef FEAT_LINEBREAK case PV_NUW: return (char_u *)&(curwin->w_p_nuw); #endif -#ifdef FEAT_WINDOWS case PV_WFH: return (char_u *)&(curwin->w_p_wfh); -#endif -#ifdef FEAT_VERTSPLIT case PV_WFW: return (char_u *)&(curwin->w_p_wfw); -#endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) case PV_PVW: return (char_u *)&(curwin->w_p_pvw); #endif #ifdef FEAT_RIGHTLEFT @@ -10193,15 +10965,16 @@ get_varp(p) case PV_BRI: return (char_u *)&(curwin->w_p_bri); case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt); #endif -#ifdef FEAT_SCROLLBIND case PV_SCBIND: return (char_u *)&(curwin->w_p_scb); -#endif -#ifdef FEAT_CURSORBIND case PV_CRBIND: return (char_u *)&(curwin->w_p_crb); -#endif #ifdef FEAT_CONCEAL - case PV_COCU: return (char_u *)&(curwin->w_p_cocu); - case PV_COLE: return (char_u *)&(curwin->w_p_cole); + case PV_COCU: return (char_u *)&(curwin->w_p_cocu); + case PV_COLE: return (char_u *)&(curwin->w_p_cole); +#endif +#ifdef FEAT_TERMINAL + case PV_TWK: return (char_u *)&(curwin->w_p_twk); + case PV_TWS: return (char_u *)&(curwin->w_p_tws); + case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl); #endif case PV_AI: return (char_u *)&(curbuf->b_p_ai); @@ -10209,10 +10982,8 @@ get_varp(p) #ifdef FEAT_MBYTE case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); #endif -#if defined(FEAT_QUICKFIX) case PV_BH: return (char_u *)&(curbuf->b_p_bh); case PV_BT: return (char_u *)&(curbuf->b_p_bt); -#endif case PV_BL: return (char_u *)&(curbuf->b_p_bl); case PV_CI: return (char_u *)&(curbuf->b_p_ci); #ifdef FEAT_CINDENT @@ -10237,14 +11008,13 @@ get_varp(p) case PV_OFU: return (char_u *)&(curbuf->b_p_ofu); #endif case PV_EOL: return (char_u *)&(curbuf->b_p_eol); + case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol); case PV_ET: return (char_u *)&(curbuf->b_p_et); #ifdef FEAT_MBYTE case PV_FENC: return (char_u *)&(curbuf->b_p_fenc); #endif case PV_FF: return (char_u *)&(curbuf->b_p_ff); -#ifdef FEAT_AUTOCMD case PV_FT: return (char_u *)&(curbuf->b_p_ft); -#endif case PV_FO: return (char_u *)&(curbuf->b_p_fo); case PV_FLP: return (char_u *)&(curbuf->b_p_flp); case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert); @@ -10275,6 +11045,9 @@ get_varp(p) case PV_MMTA: return (char_u *)&(curbuf->b_p_mmta); #endif case PV_MA: return (char_u *)&(curbuf->b_p_ma); +#ifdef USE_MIGEMO + case PV_MIG: return (char_u *)&(curbuf->b_p_migemo); +#endif case PV_MOD: return (char_u *)&(curbuf->b_changed); case PV_NF: return (char_u *)&(curbuf->b_p_nf); case PV_PI: return (char_u *)&(curbuf->b_p_pi); @@ -10285,9 +11058,7 @@ get_varp(p) #ifdef FEAT_SMARTINDENT case PV_SI: return (char_u *)&(curbuf->b_p_si); #endif -#ifndef SHORT_FNAME case PV_SN: return (char_u *)&(curbuf->b_p_sn); -#endif case PV_STS: return (char_u *)&(curbuf->b_p_sts); #ifdef FEAT_SEARCHPATH case PV_SUA: return (char_u *)&(curbuf->b_p_sua); @@ -10313,7 +11084,10 @@ get_varp(p) #ifdef FEAT_KEYMAP case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap); #endif - default: EMSG(_("E356: get_varp ERROR")); +#ifdef FEAT_SIGNS + case PV_SCL: return (char_u *)&(curwin->w_p_scl); +#endif + default: IEMSG(_("E356: get_varp ERROR")); } /* always return a valid pointer to avoid a crash! */ return (char_u *)&(curbuf->b_p_wm); @@ -10323,22 +11097,19 @@ get_varp(p) * Get the value of 'equalprg', either the buffer-local one or the global one. */ char_u * -get_equalprg() +get_equalprg(void) { if (*curbuf->b_p_ep == NUL) return p_ep; return curbuf->b_p_ep; } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Copy options from one window to another. * Used when splitting a window. */ void -win_copy_options(wp_from, wp_to) - win_T *wp_from; - win_T *wp_to; +win_copy_options(win_T *wp_from, win_T *wp_to) { copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt); copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); @@ -10348,8 +11119,10 @@ win_copy_options(wp_from, wp_to) wp_to->w_farsi = wp_from->w_farsi; # endif # endif -} +#if defined(FEAT_LINEBREAK) + briopt_check(wp_to); #endif +} /* * Copy the options from one winopt_T to another. @@ -10358,9 +11131,7 @@ win_copy_options(wp_from, wp_to) * The 'previewwindow' option is reset, there can be only one preview window. */ void -copy_winopt(from, to) - winopt_T *from; - winopt_T *to; +copy_winopt(winopt_T *from, winopt_T *to) { #ifdef FEAT_ARABIC to->wo_arab = from->wo_arab; @@ -10387,14 +11158,10 @@ copy_winopt(from, to) to->wo_bri = from->wo_bri; to->wo_briopt = vim_strsave(from->wo_briopt); #endif -#ifdef FEAT_SCROLLBIND to->wo_scb = from->wo_scb; to->wo_scb_save = from->wo_scb_save; -#endif -#ifdef FEAT_CURSORBIND to->wo_crb = from->wo_crb; to->wo_crb_save = from->wo_crb_save; -#endif #ifdef FEAT_SPELL to->wo_spell = from->wo_spell; #endif @@ -10411,6 +11178,10 @@ copy_winopt(from, to) to->wo_cocu = vim_strsave(from->wo_cocu); to->wo_cole = from->wo_cole; #endif +#ifdef FEAT_TERMINAL + to->wo_twk = vim_strsave(from->wo_twk); + to->wo_tws = vim_strsave(from->wo_tws); +#endif #ifdef FEAT_FOLDING to->wo_fdc = from->wo_fdc; to->wo_fdc_save = from->wo_fdc_save; @@ -10429,6 +11200,9 @@ copy_winopt(from, to) to->wo_fdt = vim_strsave(from->wo_fdt); # endif to->wo_fmr = vim_strsave(from->wo_fmr); +#endif +#ifdef FEAT_SIGNS + to->wo_scl = vim_strsave(from->wo_scl); #endif check_winopt(to); /* don't want NULL pointers */ } @@ -10437,8 +11211,7 @@ copy_winopt(from, to) * Check string options in a window for a NULL value. */ void -check_win_options(win) - win_T *win; +check_win_options(win_T *win) { check_winopt(&win->w_onebuf_opt); check_winopt(&win->w_allbuf_opt); @@ -10448,8 +11221,7 @@ check_win_options(win) * Check for NULL pointers in a winopt_T and replace them with empty_option. */ static void -check_winopt(wop) - winopt_T *wop UNUSED; +check_winopt(winopt_T *wop UNUSED) { #ifdef FEAT_FOLDING check_string_option(&wop->wo_fdi); @@ -10461,6 +11233,9 @@ check_winopt(wop) # endif check_string_option(&wop->wo_fmr); #endif +#ifdef FEAT_SIGNS + check_string_option(&wop->wo_scl); +#endif #ifdef FEAT_RIGHTLEFT check_string_option(&wop->wo_rlc); #endif @@ -10473,6 +11248,10 @@ check_winopt(wop) #ifdef FEAT_CONCEAL check_string_option(&wop->wo_cocu); #endif +#ifdef FEAT_TERMINAL + check_string_option(&wop->wo_twk); + check_string_option(&wop->wo_tws); +#endif #ifdef FEAT_LINEBREAK check_string_option(&wop->wo_briopt); #endif @@ -10482,8 +11261,7 @@ check_winopt(wop) * Free the allocated memory inside a winopt_T. */ void -clear_winopt(wop) - winopt_T *wop UNUSED; +clear_winopt(winopt_T *wop UNUSED) { #ifdef FEAT_FOLDING clear_string_option(&wop->wo_fdi); @@ -10495,6 +11273,9 @@ clear_winopt(wop) # endif clear_string_option(&wop->wo_fmr); #endif +#ifdef FEAT_SIGNS + clear_string_option(&wop->wo_scl); +#endif #ifdef FEAT_LINEBREAK clear_string_option(&wop->wo_briopt); #endif @@ -10510,6 +11291,10 @@ clear_winopt(wop) #ifdef FEAT_CONCEAL clear_string_option(&wop->wo_cocu); #endif +#ifdef FEAT_TERMINAL + clear_string_option(&wop->wo_twk); + clear_string_option(&wop->wo_tws); +#endif } /* @@ -10522,21 +11307,13 @@ clear_winopt(wop) * BCO_NOHELP Don't copy the values to a help buffer. */ void -buf_copy_options(buf, flags) - buf_T *buf; - int flags; +buf_copy_options(buf_T *buf, int flags) { int should_copy = TRUE; char_u *save_p_isk = NULL; /* init for GCC */ int dont_do_help; int did_isk = FALSE; - /* - * Don't do anything if the buffer is invalid. - */ - if (buf == NULL || !buf_valid(buf)) - return; - /* * Skip this when the option defaults have not been set yet. Happens when * main() allocates the first buffer. @@ -10585,11 +11362,21 @@ buf_copy_options(buf, flags) #ifdef FEAT_MBYTE buf->b_p_fenc = vim_strsave(p_fenc); #endif - buf->b_p_ff = vim_strsave(p_ff); -#if defined(FEAT_QUICKFIX) + switch (*p_ffs) + { + case 'm': + buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break; + case 'd': + buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break; + case 'u': + buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break; + default: + buf->b_p_ff = vim_strsave(p_ff); + } + if (buf->b_p_ff != NULL) + buf->b_start_ffc = *buf->b_p_ff; buf->b_p_bh = empty_option; buf->b_p_bt = empty_option; -#endif } else free_buf_options(buf, FALSE); @@ -10607,12 +11394,14 @@ buf_copy_options(buf, flags) #ifdef FEAT_MBYTE buf->b_p_bomb = p_bomb; #endif + buf->b_p_fixeol = p_fixeol; buf->b_p_et = p_et; buf->b_p_et_nobin = p_et_nobin; + buf->b_p_et_nopaste = p_et_nopaste; buf->b_p_ml = p_ml; buf->b_p_ml_nobin = p_ml_nobin; buf->b_p_inf = p_inf; - buf->b_p_swf = p_swf; + buf->b_p_swf = cmdmod.noswapfile ? FALSE : p_swf; #ifdef FEAT_INS_EXPAND buf->b_p_cpt = vim_strsave(p_cpt); #endif @@ -10622,9 +11411,7 @@ buf_copy_options(buf, flags) #endif buf->b_p_sts = p_sts; buf->b_p_sts_nopaste = p_sts_nopaste; -#ifndef SHORT_FNAME buf->b_p_sn = p_sn; -#endif #ifdef FEAT_COMMENTS buf->b_p_com = vim_strsave(p_com); #endif @@ -10644,10 +11431,8 @@ buf_copy_options(buf, flags) buf->b_p_cink = vim_strsave(p_cink); buf->b_p_cino = vim_strsave(p_cino); #endif -#ifdef FEAT_AUTOCMD /* Don't copy 'filetype', it must be detected */ buf->b_p_ft = empty_option; -#endif buf->b_p_pi = p_pi; #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) buf->b_p_cinw = vim_strsave(p_cinw); @@ -10659,6 +11444,7 @@ buf_copy_options(buf, flags) /* Don't copy 'syntax', it must be set */ buf->b_p_syn = empty_option; buf->b_p_smc = p_smc; + buf->b_s.b_syn_isk = empty_option; #endif #ifdef FEAT_SPELL buf->b_s.b_p_spc = vim_strsave(p_spc); @@ -10670,6 +11456,7 @@ buf_copy_options(buf, flags) buf->b_p_inde = vim_strsave(p_inde); buf->b_p_indk = vim_strsave(p_indk); #endif + buf->b_p_fp = empty_option; #if defined(FEAT_EVAL) buf->b_p_fex = vim_strsave(p_fex); #endif @@ -10683,6 +11470,9 @@ buf_copy_options(buf, flags) buf->b_p_keymap = vim_strsave(p_keymap); buf->b_kmap_state |= KEYMAP_INIT; #endif +#ifdef FEAT_TERMINAL + buf->b_p_twsl = p_twsl; +#endif #ifdef FEAT_GUI_MACVIM buf->b_p_mmta = p_mmta; #endif @@ -10691,10 +11481,17 @@ buf_copy_options(buf, flags) buf->b_p_iminsert = p_iminsert; buf->b_p_imsearch = p_imsearch; +#ifdef USE_MIGEMO + /* This is migemo extension */ + buf->b_p_migemo = p_migemo; +#endif + /* options that are normally global but also have a local value * are not copied, start using the global value */ buf->b_p_ar = -1; buf->b_p_ul = NO_LOCAL_UNDOLEVEL; + buf->b_p_bkc = empty_option; + buf->b_bkc_flags = 0; #ifdef FEAT_QUICKFIX buf->b_p_gp = empty_option; buf->b_p_mp = empty_option; @@ -10704,6 +11501,8 @@ buf_copy_options(buf, flags) buf->b_p_kp = empty_option; buf->b_p_path = empty_option; buf->b_p_tags = empty_option; + buf->b_p_tc = empty_option; + buf->b_tc_flags = 0; #ifdef FEAT_FIND_ID buf->b_p_def = empty_option; buf->b_p_inc = empty_option; @@ -10730,6 +11529,9 @@ buf_copy_options(buf, flags) #ifdef FEAT_LISP buf->b_p_lw = empty_option; #endif +#ifdef FEAT_MBYTE + buf->b_p_menc = empty_option; +#endif /* * Don't copy the options set by ex_help(), use the saved values, @@ -10745,10 +11547,8 @@ buf_copy_options(buf, flags) did_isk = TRUE; buf->b_p_ts = p_ts; buf->b_help = FALSE; -#ifdef FEAT_QUICKFIX if (buf->b_p_bt[0] == 'h') clear_string_option(&buf->b_p_bt); -#endif buf->b_p_ma = p_ma; } } @@ -10770,7 +11570,7 @@ buf_copy_options(buf, flags) * Reset the 'modifiable' option and its default value. */ void -reset_modifiable() +reset_modifiable(void) { int opt_idx; @@ -10785,7 +11585,7 @@ reset_modifiable() * Set the global value for 'iminsert' to the local value. */ void -set_iminsert_global() +set_iminsert_global(void) { p_iminsert = curbuf->b_p_iminsert; } @@ -10794,7 +11594,7 @@ set_iminsert_global() * Set the global value for 'imsearch' to the local value. */ void -set_imsearch_global() +set_imsearch_global(void) { p_imsearch = curbuf->b_p_imsearch; } @@ -10805,10 +11605,10 @@ static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL}; static int expand_option_flags = 0; void -set_context_in_set_cmd(xp, arg, opt_flags) - expand_T *xp; - char_u *arg; - int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */ +set_context_in_set_cmd( + expand_T *xp, + char_u *arg, + int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */ { int nextchar; long_u flags = 0; /* init for GCC */ @@ -10948,6 +11748,7 @@ set_context_in_set_cmd(xp, arg, opt_flags) if (p == (char_u *)&p_bdir || p == (char_u *)&p_dir || p == (char_u *)&p_path + || p == (char_u *)&p_pp || p == (char_u *)&p_rtp #ifdef FEAT_SEARCHPATH || p == (char_u *)&p_cdpath @@ -11011,11 +11812,11 @@ set_context_in_set_cmd(xp, arg, opt_flags) } int -ExpandSettings(xp, regmatch, num_file, file) - expand_T *xp; - regmatch_T *regmatch; - int *num_file; - char_u ***file; +ExpandSettings( + expand_T *xp, + regmatch_T *regmatch, + int *num_file, + char_u ***file) { int num_normal = 0; /* Nr of matching non-term-code settings */ int num_term = 0; /* Nr of matching terminal code settings */ @@ -11173,9 +11974,7 @@ ExpandSettings(xp, regmatch, num_file, file) } int -ExpandOldSetting(num_file, file) - int *num_file; - char_u ***file; +ExpandOldSetting(int *num_file, char_u ***file) { char_u *var = NULL; /* init for GCC */ char_u *buf; @@ -11210,15 +12009,14 @@ ExpandOldSetting(num_file, file) if (buf == NULL) { - vim_free(*file); - *file = NULL; + VIM_CLEAR(*file); return FAIL; } #ifdef BACKSLASH_IN_FILENAME /* For MS-Windows et al. we don't double backslashes at the start and * before a file name character. */ - for (var = buf; *var != NUL; mb_ptr_adv(var)) + for (var = buf; *var != NUL; MB_PTR_ADV(var)) if (var[0] == '\\' && var[1] == '\\' && expand_option_idx >= 0 && (options[expand_option_idx].flags & P_EXPAND) @@ -11238,9 +12036,9 @@ ExpandOldSetting(num_file, file) * NameBuff[]. Must not be called with a hidden option! */ static void -option_value2string(opp, opt_flags) - struct vimoption *opp; - int opt_flags; /* OPT_GLOBAL and/or OPT_LOCAL */ +option_value2string( + struct vimoption *opp, + int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */ { char_u *varp; @@ -11283,9 +12081,7 @@ option_value2string(opp, opt_flags) * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'. */ static int -wc_use_keyname(varp, wcp) - char_u *varp; - long *wcp; +wc_use_keyname(char_u *varp, long *wcp) { if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm)) { @@ -11296,7 +12092,7 @@ wc_use_keyname(varp, wcp) return FALSE; } -#ifdef FEAT_LANGMAP +#if defined(FEAT_LANGMAP) || defined(PROTO) /* * Any character has an equivalent 'langmap' character. This is used for * keyboards that have a special language mode that sends characters above @@ -11310,7 +12106,7 @@ wc_use_keyname(varp, wcp) * langmap_entry_T. This does the same as langmap_mapchar[] for characters >= * 256. */ -# ifdef FEAT_MBYTE +# if defined(FEAT_MBYTE) || defined(PROTO) /* * With multi-byte support use growarray for 'langmap' chars >= 256 */ @@ -11321,16 +12117,14 @@ typedef struct } langmap_entry_T; static garray_T langmap_mapga; -static void langmap_set_entry __ARGS((int from, int to)); +static void langmap_set_entry(int from, int to); /* * Search for an entry in "langmap_mapga" for "from". If found set the "to" * field. If not found insert a new entry at the appropriate location. */ static void -langmap_set_entry(from, to) - int from; - int to; +langmap_set_entry(int from, int to) { langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); int a = 0; @@ -11369,8 +12163,7 @@ langmap_set_entry(from, to) * Apply 'langmap' to multi-byte character "c" and return the result. */ int -langmap_adjust_mb(c) - int c; +langmap_adjust_mb(int c) { langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); int a = 0; @@ -11393,7 +12186,7 @@ langmap_adjust_mb(c) # endif static void -langmap_init() +langmap_init(void) { int i; @@ -11409,7 +12202,7 @@ langmap_init() * changed at any time! */ static void -langmap_set() +langmap_set(void) { char_u *p; char_u *p2; @@ -11423,7 +12216,7 @@ langmap_set() for (p = p_langmap; p[0] != NUL; ) { for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';'; - mb_ptr_adv(p2)) + MB_PTR_ADV(p2)) { if (p2[0] == '\\' && p2[1] != NUL) ++p2; @@ -11449,7 +12242,7 @@ langmap_set() to = NUL; if (p2 == NULL) { - mb_ptr_adv(p); + MB_PTR_ADV(p); if (p[0] != ',') { if (p[0] == '\\') @@ -11489,10 +12282,10 @@ langmap_set() langmap_mapchar[from & 255] = to; /* Advance to next pair */ - mb_ptr_adv(p); + MB_PTR_ADV(p); if (p2 != NULL) { - mb_ptr_adv(p2); + MB_PTR_ADV(p2); if (*p == ';') { p = p2; @@ -11518,8 +12311,7 @@ langmap_set() * Take care of no formatting when 'paste' is set. */ int -has_format_option(x) - int x; +has_format_option(int x) { if (p_paste) return FALSE; @@ -11531,8 +12323,7 @@ has_format_option(x) * 'shortmess' contains 'a' and "x" is present in SHM_A. */ int -shortmess(x) - int x; +shortmess(int x) { return p_shm != NULL && ( vim_strchr(p_shm, x) != NULL @@ -11544,10 +12335,11 @@ shortmess(x) * paste_option_changed() - Called after p_paste was set or reset. */ static void -paste_option_changed() +paste_option_changed(void) { static int old_p_paste = FALSE; static int save_sm = 0; + static int save_sta = 0; #ifdef FEAT_CMDL_INFO static int save_ru = 0; #endif @@ -11566,16 +12358,18 @@ paste_option_changed() if (!old_p_paste) { /* save options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { buf->b_p_tw_nopaste = buf->b_p_tw; buf->b_p_wm_nopaste = buf->b_p_wm; buf->b_p_sts_nopaste = buf->b_p_sts; buf->b_p_ai_nopaste = buf->b_p_ai; + buf->b_p_et_nopaste = buf->b_p_et; } /* save global options */ save_sm = p_sm; + save_sta = p_sta; #ifdef FEAT_CMDL_INFO save_ru = p_ru; #endif @@ -11584,10 +12378,11 @@ paste_option_changed() save_hkmap = p_hkmap; #endif /* save global values for local buffer options */ + p_ai_nopaste = p_ai; + p_et_nopaste = p_et; + p_sts_nopaste = p_sts; p_tw_nopaste = p_tw; p_wm_nopaste = p_wm; - p_sts_nopaste = p_sts; - p_ai_nopaste = p_ai; } /* @@ -11595,21 +12390,21 @@ paste_option_changed() * already on. */ /* set options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { buf->b_p_tw = 0; /* textwidth is 0 */ buf->b_p_wm = 0; /* wrapmargin is 0 */ buf->b_p_sts = 0; /* softtabstop is 0 */ buf->b_p_ai = 0; /* no auto-indent */ + buf->b_p_et = 0; /* no expandtab */ } /* set global options */ p_sm = 0; /* no showmatch */ + p_sta = 0; /* no smarttab */ #ifdef FEAT_CMDL_INFO -# ifdef FEAT_WINDOWS if (p_ru) status_redraw_all(); /* redraw to remove the ruler */ -# endif p_ru = 0; /* no ruler */ #endif #ifdef FEAT_RIGHTLEFT @@ -11629,21 +12424,21 @@ paste_option_changed() else if (old_p_paste) { /* restore options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { buf->b_p_tw = buf->b_p_tw_nopaste; buf->b_p_wm = buf->b_p_wm_nopaste; buf->b_p_sts = buf->b_p_sts_nopaste; buf->b_p_ai = buf->b_p_ai_nopaste; + buf->b_p_et = buf->b_p_et_nopaste; } /* restore global options */ p_sm = save_sm; + p_sta = save_sta; #ifdef FEAT_CMDL_INFO -# ifdef FEAT_WINDOWS if (p_ru != save_ru) status_redraw_all(); /* redraw to draw the ruler */ -# endif p_ru = save_ru; #endif #ifdef FEAT_RIGHTLEFT @@ -11651,10 +12446,11 @@ paste_option_changed() p_hkmap = save_hkmap; #endif /* set global values for local buffer options */ + p_ai = p_ai_nopaste; + p_et = p_et_nopaste; + p_sts = p_sts_nopaste; p_tw = p_tw_nopaste; p_wm = p_wm_nopaste; - p_sts = p_sts_nopaste; - p_ai = p_ai_nopaste; } old_p_paste = p_paste; @@ -11669,9 +12465,7 @@ paste_option_changed() * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet. */ void -vimrc_found(fname, envname) - char_u *fname; - char_u *envname; +vimrc_found(char_u *fname, char_u *envname) { int opt_idx; int dofree = FALSE; @@ -11684,6 +12478,7 @@ vimrc_found(fname, envname) if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF))) set_option_default(opt_idx, OPT_FREE, FALSE); didset_options(); + didset_options2(); } if (fname != NULL) @@ -11708,8 +12503,7 @@ vimrc_found(fname, envname) * Set 'compatible' on or off. Called for "-C" and "-N" command line arg. */ void -change_compatible(on) - int on; +change_compatible(int on) { int opt_idx; @@ -11728,8 +12522,7 @@ change_compatible(on) * Only works correctly for global options. */ int -option_was_set(name) - char_u *name; +option_was_set(char_u *name) { int idx; @@ -11745,8 +12538,7 @@ option_was_set(name) * Reset the flag indicating option "name" was set. */ void -reset_option_was_set(name) - char_u *name; +reset_option_was_set(char_u *name) { int idx = findoption(name); @@ -11763,7 +12555,7 @@ reset_option_was_set(name) * for Vim (without the P_VI_DEF flag) to that default. */ static void -compatible_set() +compatible_set(void) { int opt_idx; @@ -11772,6 +12564,7 @@ compatible_set() || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp)) set_option_default(opt_idx, OPT_FREE, p_cp); didset_options(); + didset_options2(); } #ifdef FEAT_LINEBREAK @@ -11785,7 +12578,7 @@ compatible_set() * fill_breakat_flags() -- called when 'breakat' changes value. */ static void -fill_breakat_flags() +fill_breakat_flags(void) { char_u *p; int i; @@ -11811,10 +12604,10 @@ fill_breakat_flags() * Empty is always OK. */ static int -check_opt_strings(val, values, list) - char_u *val; - char **values; - int list; /* when TRUE: accept a list of values */ +check_opt_strings( + char_u *val, + char **values, + int list) /* when TRUE: accept a list of values */ { return opt_strings_flags(val, values, NULL, list); } @@ -11827,11 +12620,11 @@ check_opt_strings(val, values, list) * Empty is always OK. */ static int -opt_strings_flags(val, values, flagp, list) - char_u *val; /* new value */ - char **values; /* array of valid string values */ - unsigned *flagp; - int list; /* when TRUE: accept a list of values */ +opt_strings_flags( + char_u *val, /* new value */ + char **values, /* array of valid string values */ + unsigned *flagp, + int list) /* when TRUE: accept a list of values */ { int i; int len; @@ -11864,7 +12657,7 @@ opt_strings_flags(val, values, flagp, list) * Read the 'wildmode' option, fill wim_flags[]. */ static int -check_opt_wim() +check_opt_wim(void) { char_u new_wim_flags[4]; char_u *p; @@ -11916,9 +12709,13 @@ check_opt_wim() * Check if backspacing over something is allowed. */ int -can_bs(what) - int what; /* BS_INDENT, BS_EOL or BS_START */ +can_bs( + int what) /* BS_INDENT, BS_EOL or BS_START */ { +#ifdef FEAT_JOB_CHANNEL + if (what == BS_START && bt_prompt(curbuf)) + return FALSE; +#endif switch (*p_bs) { case '2': return TRUE; @@ -11933,8 +12730,7 @@ can_bs(what) * the file must be considered changed when the value is different. */ void -save_file_ff(buf) - buf_T *buf; +save_file_ff(buf_T *buf) { buf->b_start_ffc = *buf->b_p_ff; buf->b_start_eol = buf->b_p_eol; @@ -11956,13 +12752,12 @@ save_file_ff(buf) * from when editing started (save_file_ff() called). * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was * changed and 'binary' is not set. + * Also when 'endofline' was changed and 'fixeol' is not set. * When "ignore_empty" is true don't consider a new, empty buffer to be * changed. */ int -file_ff_differs(buf, ignore_empty) - buf_T *buf; - int ignore_empty; +file_ff_differs(buf_T *buf, int ignore_empty) { /* In a buffer that was never loaded the options are not valid. */ if (buf->b_flags & BF_NEVERLOADED) @@ -11974,7 +12769,7 @@ file_ff_differs(buf, ignore_empty) return FALSE; if (buf->b_start_ffc != *buf->b_p_ff) return TRUE; - if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) + if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol) return TRUE; #ifdef FEAT_MBYTE if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) @@ -11991,8 +12786,7 @@ file_ff_differs(buf, ignore_empty) * return OK if "p" is a valid fileformat name, FAIL otherwise. */ int -check_ff_value(p) - char_u *p; +check_ff_value(char_u *p) { return check_opt_strings(p, p_ff_values, FALSE); } @@ -12002,8 +12796,7 @@ check_ff_value(p) * 'tabstop' value when 'shiftwidth' is zero. */ long -get_sw_value(buf) - buf_T *buf; +get_sw_value(buf_T *buf) { return buf->b_p_sw ? buf->b_p_sw : buf->b_p_ts; } @@ -12013,7 +12806,7 @@ get_sw_value(buf) * 'tabstop' value when 'softtabstop' is negative. */ long -get_sts_value() +get_sts_value(void) { return curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : curbuf->b_p_sts; } @@ -12025,11 +12818,11 @@ get_sts_value() * When "switchit" is TRUE swap the direction. */ void -find_mps_values(initc, findc, backwards, switchit) - int *initc; - int *findc; - int *backwards; - int switchit; +find_mps_values( + int *initc, + int *findc, + int *backwards, + int switchit) { char_u *ptr; @@ -12213,15 +13006,15 @@ check_fuoptions(p_fuoptions, flags, bgcolor) * This is called when 'breakindentopt' is changed and when a window is * initialized. */ - int -briopt_check() + static int +briopt_check(win_T *wp) { char_u *p; int bri_shift = 0; long bri_min = 20; int bri_sbr = FALSE; - p = curwin->w_p_briopt; + p = wp->w_p_briopt; while (*p != NUL) { if (STRNCMP(p, "shift:", 6) == 0 @@ -12246,10 +13039,77 @@ briopt_check() ++p; } - curwin->w_p_brishift = bri_shift; - curwin->w_p_brimin = bri_min; - curwin->w_p_brisbr = bri_sbr; + wp->w_p_brishift = bri_shift; + wp->w_p_brimin = bri_min; + wp->w_p_brisbr = bri_sbr; return OK; } #endif + +/* + * Get the local or global value of 'backupcopy'. + */ + unsigned int +get_bkc_value(buf_T *buf) +{ + return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; +} + +#if defined(FEAT_SIGNS) || defined(PROTO) +/* + * Return TRUE when window "wp" has a column to draw signs in. + */ + int +signcolumn_on(win_T *wp) +{ + if (*wp->w_p_scl == 'n') + return FALSE; + if (*wp->w_p_scl == 'y') + return TRUE; + return (wp->w_buffer->b_signlist != NULL +# ifdef FEAT_NETBEANS_INTG + || wp->w_buffer->b_has_sign_column +# endif + ); +} +#endif + +#if defined(FEAT_EVAL) || defined(PROTO) +/* + * Get window or buffer local options. + */ + dict_T * +get_winbuf_options(int bufopt) +{ + dict_T *d; + int opt_idx; + + d = dict_alloc(); + if (d == NULL) + return NULL; + + for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++) + { + struct vimoption *opt = &options[opt_idx]; + + if ((bufopt && (opt->indir & PV_BUF)) + || (!bufopt && (opt->indir & PV_WIN))) + { + char_u *varp = get_varp(opt); + + if (varp != NULL) + { + if (opt->flags & P_STRING) + dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp); + else if (opt->flags & P_NUM) + dict_add_nr_str(d, opt->fullname, *(long *)varp, NULL); + else + dict_add_nr_str(d, opt->fullname, *(int *)varp, NULL); + } + } + } + + return d; +} +#endif diff --git a/src/option.h b/src/option.h index e3e7b86b62..c8ed92dd9a 100644 --- a/src/option.h +++ b/src/option.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -18,23 +18,19 @@ #ifdef AMIGA # define DFLT_EFM "%f>%l:%c:%t:%n:%m,%f:%l: %t%*\\D%n: %m,%f %l %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f:%l:%m,%f|%l| %m" #else -# if defined(MSDOS) || defined(WIN3264) +# if defined(WIN3264) # define DFLT_EFM "%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m" # else -# if defined(__EMX__) /* put most common here (i.e. gcc format) at front */ -# define DFLT_EFM "%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f(%l:%c) : %m,%f|%l| %m" +# if defined(__QNX__) +# define DFLT_EFM "%f(%l):%*[^WE]%t%*\\D%n:%m,%f|%l| %m" # else -# if defined(__QNX__) -# define DFLT_EFM "%f(%l):%*[^WE]%t%*\\D%n:%m,%f|%l| %m" -# else -# ifdef VMS -# define DFLT_EFM "%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m" -# else /* Unix, probably */ -# ifdef EBCDIC +# ifdef VMS +# define DFLT_EFM "%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m" +# else /* Unix, probably */ +# ifdef EBCDIC #define DFLT_EFM "%*[^ ] %*[^ ] %f:%l%*[ ]%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" # else #define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" -# endif # endif # endif # endif @@ -213,9 +209,12 @@ #define SHM_ATTENTION 'A' /* no ATTENTION messages */ #define SHM_INTRO 'I' /* intro messages */ #define SHM_COMPLETIONMENU 'c' /* completion menu messages */ -#define SHM_ALL "rmfixlnwaWtToOsAIc" /* all possible flags for 'shm' */ +#define SHM_RECORDING 'q' /* short recording message */ +#define SHM_FILEINFO 'F' /* no file info messages */ +#define SHM_ALL "rmfixlnwaWtToOsAIcqF" /* all possible flags for 'shm' */ /* characters for p_go: */ +#define GO_TERMINAL '!' /* use terminal for system commands */ #define GO_ASEL 'a' /* autoselect */ #define GO_ASELML 'A' /* autoselect modeless selection */ #define GO_BOT 'b' /* use bottom scrollbar */ @@ -236,8 +235,9 @@ #define GO_TEAROFF 't' /* add tear-off menu items */ #define GO_TOOLBAR 'T' /* add toolbar */ #define GO_FOOTER 'F' /* add footer */ -#define GO_VERTICAL 'v' /* arrange dialog buttons vertically */ -#define GO_ALL "aAbcefFghilmMprtTv" /* all possible flags for 'go' */ +#define GO_KEEPWINSIZE 'k' /* keep GUI window size */ +#define GO_NOCAPTION 'C' /* remove caption bar */ +#define GO_ALL "!aAbcCefFghilmMprtTvk" /* all possible flags for 'go' */ /* flags for 'comments' option */ #define COM_NEST 'n' /* comments strings nest */ @@ -316,6 +316,7 @@ EXTERN int p_acd; /* 'autochdir' */ #endif #ifdef FEAT_MBYTE EXTERN char_u *p_ambw; /* 'ambiwidth' */ +EXTERN char_u *p_emoji; /* 'emoji' */ #endif #ifdef FEAT_ANTIALIAS EXTERN int p_antialias; /* 'antialias' */ @@ -327,7 +328,7 @@ EXTERN char_u *p_bs; /* 'backspace' */ EXTERN char_u *p_bg; /* 'background' */ EXTERN int p_bk; /* 'backup' */ EXTERN char_u *p_bkc; /* 'backupcopy' */ -EXTERN unsigned bkc_flags; +EXTERN unsigned bkc_flags; /* flags from 'backupcopy' */ #ifdef IN_OPTION_C static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL}; #endif @@ -338,6 +339,37 @@ static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhard # define BKC_BREAKHARDLINK 0x010 EXTERN char_u *p_bdir; /* 'backupdir' */ EXTERN char_u *p_bex; /* 'backupext' */ +EXTERN char_u *p_bo; /* 'belloff' */ +EXTERN unsigned bo_flags; +# ifdef IN_OPTION_C +static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete", + "copy", "ctrlg", "error", "esc", "ex", + "hangul", "insertmode", "lang", "mess", + "showmatch", "operator", "register", "shell", + "spell", "wildmode", NULL}; +# endif + +/* values for the 'beepon' option */ +#define BO_ALL 0x0001 +#define BO_BS 0x0002 +#define BO_CRSR 0x0004 +#define BO_COMPL 0x0008 +#define BO_COPY 0x0010 +#define BO_CTRLG 0x0020 +#define BO_ERROR 0x0040 +#define BO_ESC 0x0080 +#define BO_EX 0x0100 +#define BO_HANGUL 0x0200 +#define BO_IM 0x0400 +#define BO_LANG 0x0800 +#define BO_MESS 0x1000 +#define BO_MATCH 0x2000 +#define BO_OPER 0x4000 +#define BO_REG 0x8000 +#define BO_SH 0x10000 +#define BO_SPELL 0x20000 +#define BO_WILD 0x40000 + #ifdef FEAT_WILDIGN EXTERN char_u *p_bsk; /* 'backupskip' */ #endif @@ -345,19 +377,20 @@ EXTERN char_u *p_bsk; /* 'backupskip' */ EXTERN char_u *p_cm; /* 'cryptmethod' */ #endif #ifdef FEAT_BEVAL -EXTERN long p_bdlay; /* 'balloondelay' */ +# ifdef FEAT_BEVAL_GUI EXTERN int p_beval; /* 'ballooneval' */ +# endif +EXTERN long p_bdlay; /* 'balloondelay' */ # ifdef FEAT_EVAL EXTERN char_u *p_bexpr; # endif +# ifdef FEAT_BEVAL_TERM +EXTERN int p_bevalterm; /* 'balloonevalterm' */ +# endif #endif #ifdef FEAT_BROWSE EXTERN char_u *p_bsdir; /* 'browsedir' */ #endif -#ifdef MSDOS -EXTERN int p_biosk; /* 'bioskey' */ -EXTERN int p_consk; /* 'conskey' */ -#endif #ifdef FEAT_LINEBREAK EXTERN char_u *p_breakat; /* 'breakat' */ #endif @@ -377,6 +410,9 @@ EXTERN int p_deco; /* 'delcombine' */ EXTERN char_u *p_ccv; /* 'charconvert' */ # endif #endif +#ifdef FEAT_GUI +EXTERN long p_charspace; /* 'charspace' */ +#endif #ifdef FEAT_CMDWIN EXTERN char_u *p_cedit; /* 'cedit' */ EXTERN long p_cwh; /* 'cmdwinheight' */ @@ -392,6 +428,7 @@ EXTERN int p_cp; /* 'compatible' */ #ifdef FEAT_INS_EXPAND EXTERN char_u *p_cot; /* 'completeopt' */ EXTERN long p_ph; /* 'pumheight' */ +EXTERN long p_pw; /* 'pumwidth' */ #endif EXTERN char_u *p_cpo; /* 'cpoptions' */ #ifdef FEAT_CSCOPE @@ -399,7 +436,7 @@ EXTERN char_u *p_csprg; /* 'cscopeprg' */ EXTERN int p_csre; /* 'cscoperelative' */ # ifdef FEAT_QUICKFIX EXTERN char_u *p_csqf; /* 'cscopequickfix' */ -# define CSQF_CMDS "sgdctefi" +# define CSQF_CMDS "sgdctefia" # define CSQF_FLAGS "+-0" # endif EXTERN int p_cst; /* 'cscopetag' */ @@ -428,14 +465,13 @@ EXTERN char_u *p_dir; /* 'directory' */ EXTERN char_u *p_dy; /* 'display' */ EXTERN unsigned dy_flags; #ifdef IN_OPTION_C -static char *(p_dy_values[]) = {"lastline", "uhex", NULL}; +static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL}; #endif #define DY_LASTLINE 0x001 -#define DY_UHEX 0x002 +#define DY_TRUNCATE 0x002 +#define DY_UHEX 0x004 EXTERN int p_ed; /* 'edcompatible' */ -#ifdef FEAT_VERTSPLIT EXTERN char_u *p_ead; /* 'eadirection' */ -#endif EXTERN int p_ea; /* 'equalalways' */ EXTERN char_u *p_ep; /* 'equalprg' */ EXTERN int p_eb; /* 'errorbells' */ @@ -445,9 +481,7 @@ EXTERN char_u *p_efm; /* 'errorformat' */ EXTERN char_u *p_gefm; /* 'grepformat' */ EXTERN char_u *p_gp; /* 'grepprg' */ #endif -#ifdef FEAT_AUTOCMD EXTERN char_u *p_ei; /* 'eventignore' */ -#endif EXTERN int p_ek; /* 'esckeys' */ EXTERN int p_exrc; /* 'exrc' */ #ifdef FEAT_MBYTE @@ -536,20 +570,11 @@ EXTERN char_u *p_gtl; /* 'guitablabel' */ EXTERN char_u *p_gtt; /* 'guitabtooltip' */ #endif EXTERN char_u *p_hf; /* 'helpfile' */ -#ifdef FEAT_WINDOWS EXTERN long p_hh; /* 'helpheight' */ -#endif #ifdef FEAT_MULTI_LANG EXTERN char_u *p_hlg; /* 'helplang' */ #endif EXTERN int p_hid; /* 'hidden' */ -/* Use P_HID to check if a buffer is to be hidden when it is no longer - * visible in a window. */ -#ifndef FEAT_QUICKFIX -# define P_HID(dummy) (p_hid || cmdmod.hide) -#else -# define P_HID(buf) (buf_hide(buf)) -#endif EXTERN char_u *p_hl; /* 'highlight' */ EXTERN int p_hls; /* 'hlsearch' */ EXTERN long p_hi; /* 'history' */ @@ -569,14 +594,20 @@ EXTERN int p_icon; /* 'icon' */ EXTERN char_u *p_iconstring; /* 'iconstring' */ #endif EXTERN int p_ic; /* 'ignorecase' */ -#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) +#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) EXTERN char_u *p_imak; /* 'imactivatekey' */ +#define IM_ON_THE_SPOT 0L +#define IM_OVER_THE_SPOT 1L +EXTERN long p_imst; /* 'imstyle' */ +#endif +#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) EXTERN char_u *p_imaf; /* 'imactivatefunc' */ EXTERN char_u *p_imsf; /* 'imstatusfunc' */ #endif -#ifdef USE_IM_CONTROL +#ifdef FEAT_MBYTE EXTERN int p_imcmdline; /* 'imcmdline' */ EXTERN int p_imdisable; /* 'imdisable' */ +EXTERN int p_imdisableactivate; /* 'imdisableactivate' */ #endif EXTERN int p_is; /* 'incsearch' */ EXTERN int p_im; /* 'insertmode' */ @@ -588,6 +619,8 @@ EXTERN char_u *p_kp; /* 'keywordprg' */ EXTERN char_u *p_km; /* 'keymodel' */ #ifdef FEAT_LANGMAP EXTERN char_u *p_langmap; /* 'langmap'*/ +EXTERN int p_lnr; /* 'langnoremap' */ +EXTERN int p_lrm; /* 'langremap' */ #endif #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG) EXTERN char_u *p_lm; /* 'langmenu' */ @@ -598,22 +631,34 @@ EXTERN long p_linespace; /* 'linespace' */ #ifdef FEAT_LISP EXTERN char_u *p_lispwords; /* 'lispwords' */ #endif -#ifdef FEAT_WINDOWS EXTERN long p_ls; /* 'laststatus' */ EXTERN long p_stal; /* 'showtabline' */ -#endif EXTERN char_u *p_lcs; /* 'listchars' */ EXTERN int p_lz; /* 'lazyredraw' */ EXTERN int p_lpl; /* 'loadplugins' */ +#if defined(DYNAMIC_LUA) +EXTERN char_u *p_luadll; /* 'luadll' */ +#endif #ifdef FEAT_GUI_MAC EXTERN int p_macatsui; /* 'macatsui' */ #endif +#ifdef FEAT_GUI_MACVIM +EXTERN int p_macligatures; /* 'macligatures' */ +EXTERN int p_macthinstrokes; /* 'macthinstrokes' */ +EXTERN long p_columnspace; /* 'columnspace' */ +#endif EXTERN int p_magic; /* 'magic' */ +#ifdef FEAT_MBYTE +EXTERN char_u *p_menc; /* 'makeencoding' */ +#endif #ifdef FEAT_QUICKFIX EXTERN char_u *p_mef; /* 'makeef' */ EXTERN char_u *p_mp; /* 'makeprg' */ #endif +#ifdef FEAT_SIGNS +EXTERN char_u *p_scl; /* signcolumn */ +#endif #ifdef FEAT_SYN_HL EXTERN char_u *p_cc; /* 'colorcolumn' */ EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */ @@ -632,6 +677,10 @@ EXTERN long p_mmt; /* 'maxmemtot' */ #ifdef FEAT_MENU EXTERN long p_mis; /* 'menuitems' */ #endif +#ifdef USE_MIGEMO +EXTERN int p_migemo; /* 'migemo' */ +EXTERN char_u *p_migdict; /* 'migemodict' */ +#endif #ifdef FEAT_SPELL EXTERN char_u *p_msm; /* 'mkspellmem' */ #endif @@ -646,8 +695,12 @@ EXTERN long p_mouset; /* 'mousetime' */ EXTERN int p_more; /* 'more' */ #ifdef FEAT_MZSCHEME EXTERN long p_mzq; /* 'mzquantum */ +# if defined(DYNAMIC_MZSCHEME) +EXTERN char_u *p_mzschemedll; /* 'mzschemedll' */ +EXTERN char_u *p_mzschemegcdll; /* 'mzschemegcdll' */ +# endif #endif -#if defined(MSDOS) || defined(MSWIN) || defined(OS2) +#if defined(MSWIN) EXTERN int p_odev; /* 'opendevice' */ #endif EXTERN char_u *p_opfunc; /* 'operatorfunc' */ @@ -662,13 +715,36 @@ EXTERN char_u *p_path; /* 'path' */ #ifdef FEAT_SEARCHPATH EXTERN char_u *p_cdpath; /* 'cdpath' */ #endif +#if defined(DYNAMIC_PERL) +EXTERN char_u *p_perldll; /* 'perldll' */ +#endif +#if defined(DYNAMIC_PYTHON3) +EXTERN char_u *p_py3dll; /* 'pythonthreedll' */ +EXTERN char_u *p_py3home; /* 'pythonthreehome' */ +#endif +#ifdef FEAT_PYTHON3 +EXTERN char_u *p_py3home; /* 'pythonthreehome' */ +#endif +#if defined(DYNAMIC_PYTHON) +EXTERN char_u *p_pydll; /* 'pythondll' */ +EXTERN char_u *p_pyhome; /* 'pythonhome' */ +#endif +#ifdef FEAT_PYTHON +EXTERN char_u *p_pyhome; /* 'pythonhome' */ +#endif +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) +EXTERN long p_pyx; /* 'pyxversion' */ +#endif #ifdef FEAT_RELTIME EXTERN long p_rdt; /* 'redrawtime' */ #endif EXTERN int p_remap; /* 'remap' */ EXTERN long p_re; /* 'regexpengine' */ +#ifdef FEAT_RENDER_OPTIONS +EXTERN char_u *p_rop; /* 'renderoptions' */ +#endif EXTERN long p_report; /* 'report' */ -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) EXTERN long p_pvh; /* 'previewheight' */ #endif #ifdef WIN3264 @@ -678,18 +754,20 @@ EXTERN int p_rs; /* 'restorescreen' */ EXTERN int p_ari; /* 'allowrevins' */ EXTERN int p_ri; /* 'revins' */ #endif +#if defined(DYNAMIC_RUBY) +EXTERN char_u *p_rubydll; /* 'rubydll' */ +#endif #ifdef FEAT_CMDL_INFO EXTERN int p_ru; /* 'ruler' */ #endif #ifdef FEAT_STL_OPT EXTERN char_u *p_ruf; /* 'rulerformat' */ #endif +EXTERN char_u *p_pp; /* 'packpath' */ EXTERN char_u *p_rtp; /* 'runtimepath' */ EXTERN long p_sj; /* 'scrolljump' */ EXTERN long p_so; /* 'scrolloff' */ -#ifdef FEAT_SCROLLBIND EXTERN char_u *p_sbo; /* 'scrollopt' */ -#endif EXTERN char_u *p_sections; /* 'sections' */ EXTERN int p_secure; /* 'secure' */ EXTERN char_u *p_sel; /* 'selection' */ @@ -701,7 +779,7 @@ EXTERN unsigned ssop_flags; /* Also used for 'viewoptions'! */ static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize", "localoptions", "options", "help", "blank", "globals", "slash", "unix", - "sesdir", "curdir", "folds", "cursor", "tabpages", NULL}; + "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", NULL}; # endif # define SSOP_BUFFERS 0x001 # define SSOP_WINPOS 0x002 @@ -719,6 +797,7 @@ static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize", # define SSOP_FOLDS 0x2000 # define SSOP_CURSOR 0x4000 # define SSOP_TABPAGES 0x8000 +# define SSOP_TERMINAL 0x10000 #endif EXTERN char_u *p_sh; /* 'shell' */ EXTERN char_u *p_shcf; /* 'shellcmdflag' */ @@ -754,42 +833,55 @@ EXTERN long p_ss; /* 'sidescroll' */ EXTERN long p_siso; /* 'sidescrolloff' */ EXTERN int p_scs; /* 'smartcase' */ EXTERN int p_sta; /* 'smarttab' */ -#ifdef FEAT_WINDOWS EXTERN int p_sb; /* 'splitbelow' */ EXTERN long p_tpm; /* 'tabpagemax' */ # if defined(FEAT_STL_OPT) EXTERN char_u *p_tal; /* 'tabline' */ # endif -#endif #ifdef FEAT_SPELL EXTERN char_u *p_sps; /* 'spellsuggest' */ #endif -#ifdef FEAT_VERTSPLIT EXTERN int p_spr; /* 'splitright' */ -#endif EXTERN int p_sol; /* 'startofline' */ EXTERN char_u *p_su; /* 'suffixes' */ EXTERN char_u *p_sws; /* 'swapsync' */ EXTERN char_u *p_swb; /* 'switchbuf' */ EXTERN unsigned swb_flags; #ifdef IN_OPTION_C -static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", NULL}; +static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", NULL}; #endif #define SWB_USEOPEN 0x001 #define SWB_USETAB 0x002 #define SWB_SPLIT 0x004 #define SWB_NEWTAB 0x008 +#define SWB_VSPLIT 0x010 EXTERN int p_tbs; /* 'tagbsearch' */ +EXTERN char_u *p_tc; /* 'tagcase' */ +EXTERN unsigned tc_flags; /* flags from 'tagcase' */ +#ifdef IN_OPTION_C +static char *(p_tc_values[]) = {"followic", "ignore", "match", "followscs", "smart", NULL}; +#endif +#define TC_FOLLOWIC 0x01 +#define TC_IGNORE 0x02 +#define TC_MATCH 0x04 +#define TC_FOLLOWSCS 0x08 +#define TC_SMART 0x10 EXTERN long p_tl; /* 'taglength' */ EXTERN int p_tr; /* 'tagrelative' */ EXTERN char_u *p_tags; /* 'tags' */ EXTERN int p_tgst; /* 'tagstack' */ +#if defined(DYNAMIC_TCL) +EXTERN char_u *p_tcldll; /* 'tcldll' */ +#endif #ifdef FEAT_ARABIC EXTERN int p_tbidi; /* 'termbidi' */ #endif #ifdef FEAT_MBYTE EXTERN char_u *p_tenc; /* 'termencoding' */ #endif +#ifdef FEAT_TERMGUICOLORS +EXTERN int p_tgc; /* 'termguicolors' */ +#endif EXTERN int p_terse; /* 'terse' */ EXTERN int p_ta; /* 'textauto' */ EXTERN int p_to; /* 'tildeop' */ @@ -807,6 +899,7 @@ EXTERN char_u *p_tsr; /* 'thesaurus' */ #ifdef FEAT_TRANSPARENCY EXTERN long p_transp; /* 'transparency' */ #endif +EXTERN long p_blur; /* 'blurradius' */ EXTERN int p_ttimeout; /* 'ttimeout' */ EXTERN long p_ttm; /* 'ttimeoutlen' */ EXTERN int p_tbi; /* 'ttybuiltin' */ @@ -826,12 +919,14 @@ static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL} EXTERN char_u *p_tbis; /* 'toolbariconsize' */ EXTERN unsigned tbis_flags; # ifdef IN_OPTION_C -static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", NULL}; +static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "giant", NULL}; # endif # define TBIS_TINY 0x01 # define TBIS_SMALL 0x02 # define TBIS_MEDIUM 0x04 # define TBIS_LARGE 0x08 +# define TBIS_HUGE 0x10 +# define TBIS_GIANT 0x20 #endif EXTERN long p_ttyscroll; /* 'ttyscroll' */ #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS)) @@ -854,11 +949,10 @@ EXTERN long p_ul; /* 'undolevels' */ EXTERN long p_ur; /* 'undoreload' */ EXTERN long p_uc; /* 'updatecount' */ EXTERN long p_ut; /* 'updatetime' */ -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) EXTERN char_u *p_fcs; /* 'fillchar' */ -#endif #ifdef FEAT_VIMINFO EXTERN char_u *p_viminfo; /* 'viminfo' */ +EXTERN char_u *p_viminfofile; /* 'viminfofile' */ #endif #ifdef FEAT_SESSION EXTERN char_u *p_vdir; /* 'viewdir' */ @@ -905,13 +999,12 @@ EXTERN char_u *p_wim; /* 'wildmode' */ #ifdef FEAT_WILDMENU EXTERN int p_wmnu; /* 'wildmenu' */ #endif -#ifdef FEAT_WINDOWS EXTERN long p_wh; /* 'winheight' */ EXTERN long p_wmh; /* 'winminheight' */ -#endif -#ifdef FEAT_VERTSPLIT EXTERN long p_wmw; /* 'winminwidth' */ EXTERN long p_wiw; /* 'winwidth' */ +#if defined(WIN3264) && defined(FEAT_TERMINAL) +EXTERN char_u *p_winptydll; /* 'winptydll' */ #endif EXTERN int p_ws; /* 'wrapscan' */ EXTERN int p_write; /* 'write' */ @@ -928,9 +1021,10 @@ enum { BV_AI = 0 , BV_AR -#ifdef FEAT_QUICKFIX , BV_BH + , BV_BKC , BV_BT +#ifdef FEAT_QUICKFIX , BV_EFM , BV_GP , BV_MP @@ -969,9 +1063,11 @@ enum , BV_INC #endif , BV_EOL + , BV_FIXEOL , BV_EP , BV_ET , BV_FENC + , BV_FP #ifdef FEAT_EVAL , BV_BEXPR , BV_FEX @@ -979,9 +1075,7 @@ enum , BV_FF , BV_FLP , BV_FO -#ifdef FEAT_AUTOCMD , BV_FT -#endif , BV_IMI , BV_IMS #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) @@ -1003,8 +1097,14 @@ enum #ifdef FEAT_LISP , BV_LISP , BV_LW +#endif +#ifdef FEAT_MBYTE + , BV_MENC #endif , BV_MA +#ifdef USE_MIGEMO + , BV_MIG +#endif , BV_ML , BV_MOD , BV_MPS @@ -1024,9 +1124,7 @@ enum #ifdef FEAT_SMARTINDENT , BV_SI #endif -#ifndef SHORT_FNAME , BV_SN -#endif #ifdef FEAT_SYN_HL , BV_SMC , BV_SYN @@ -1043,12 +1141,16 @@ enum , BV_SW , BV_SWF , BV_TAGS + , BV_TC , BV_TS , BV_TW , BV_TX , BV_UDF , BV_UL , BV_WM +#ifdef FEAT_TERMINAL + , BV_TWSL +#endif , BV_COUNT /* must be the last one */ }; @@ -1067,9 +1169,11 @@ enum , WV_COCU , WV_COLE #endif -#ifdef FEAT_CURSORBIND - , WV_CRBIND +#ifdef FEAT_TERMINAL + , WV_TWK + , WV_TWS #endif + , WV_CRBIND #ifdef FEAT_LINEBREAK , WV_BRI , WV_BRIOPT @@ -1099,16 +1203,14 @@ enum #ifdef FEAT_LINEBREAK , WV_NUW #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) , WV_PVW #endif #ifdef FEAT_RIGHTLEFT , WV_RL , WV_RLC #endif -#ifdef FEAT_SCROLLBIND , WV_SCBIND -#endif , WV_SCROLL #ifdef FEAT_SPELL , WV_SPELL @@ -1121,13 +1223,12 @@ enum #ifdef FEAT_STL_OPT , WV_STL #endif -#ifdef FEAT_WINDOWS , WV_WFH -#endif -#ifdef FEAT_VERTSPLIT , WV_WFW -#endif , WV_WRAP +#ifdef FEAT_SIGNS + , WV_SCL +#endif , WV_COUNT /* must be the last one */ }; diff --git a/src/os_amiga.c b/src/os_amiga.c index 324fc367b7..39fb222fdd 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -71,12 +71,12 @@ #ifdef __amigaos4__ # define dos_packet(a, b, c) DoPkt(a, b, c, 0, 0, 0, 0) #elif !defined(AZTEC_C) && !defined(__AROS__) -static long dos_packet __ARGS((struct MsgPort *, long, long)); +static long dos_packet(struct MsgPort *, long, long); #endif -static int lock2name __ARGS((BPTR lock, char_u *buf, long len)); -static void out_num __ARGS((long n)); -static struct FileInfoBlock *get_fib __ARGS((char_u *)); -static int sortcmp __ARGS((const void *a, const void *b)); +static int lock2name(BPTR lock, char_u *buf, long len); +static void out_num(long n); +static struct FileInfoBlock *get_fib(char_u *); +static int sortcmp(const void *a, const void *b); static BPTR raw_in = (BPTR)NULL; static BPTR raw_out = (BPTR)NULL; @@ -98,21 +98,19 @@ int dos2 = FALSE; /* Amiga DOS 2.0x or higher */ int size_set = FALSE; /* set to TRUE if window size was set */ void -win_resize_on() +win_resize_on(void) { OUT_STR_NF("\033[12{"); } void -win_resize_off() +win_resize_off(void) { OUT_STR_NF("\033[12}"); } void -mch_write(p, len) - char_u *p; - int len; +mch_write(char_u *p, int len) { Write(raw_out, (char *)p, (long)len); } @@ -127,11 +125,11 @@ mch_write(p, len) * Return number of characters read. */ int -mch_inchar(buf, maxlen, time, tb_change_cnt) - char_u *buf; - int maxlen; - long time; /* milli seconds */ - int tb_change_cnt; +mch_inchar( + char_u *buf, + int maxlen, + long time, /* milli seconds */ + int tb_change_cnt) { int len; long utime; @@ -154,7 +152,6 @@ mch_inchar(buf, maxlen, time, tb_change_cnt) */ if (WaitForChar(raw_in, p_ut * 1000L) == 0) { -#ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; @@ -162,7 +159,6 @@ mch_inchar(buf, maxlen, time, tb_change_cnt) buf[2] = (int)KE_CURSORHOLD; return 3; } -#endif before_blocking(); } } @@ -190,7 +186,7 @@ mch_inchar(buf, maxlen, time, tb_change_cnt) * return non-zero if a character is available */ int -mch_char_avail() +mch_char_avail(void) { return (WaitForChar(raw_in, 100L) != 0); } @@ -199,8 +195,7 @@ mch_char_avail() * Return amount of memory still available in Kbyte. */ long_u -mch_avail_mem(special) - int special; +mch_avail_mem(int special) { #ifdef __amigaos4__ return (long_u)AvailMem(MEMF_ANY) >> 10; @@ -214,12 +209,10 @@ mch_avail_mem(special) * ignoreinput is FALSE. */ void -mch_delay(msec, ignoreinput) - long msec; - int ignoreinput; +mch_delay(long msec, int ignoreinput) { #ifndef LATTICE /* SAS declares void Delay(ULONG) */ - void Delay __ARGS((long)); + void Delay(long); #endif if (msec > 0) @@ -235,7 +228,7 @@ mch_delay(msec, ignoreinput) * We have no job control, fake it by starting a new shell. */ void -mch_suspend() +mch_suspend(void) { suspend_shell(); } @@ -245,7 +238,7 @@ mch_suspend() #endif void -mch_init() +mch_init(void) { static char intlibname[] = "intuition.library"; @@ -306,9 +299,7 @@ mch_init() #define BUF2SIZE 320 /* length of buffer for argument with complete path */ int -mch_check_win(argc, argv) - int argc; - char **argv; +mch_check_win(int argc, char **argv) { int i; BPTR nilfh, fh; @@ -545,7 +536,7 @@ mch_check_win(argc, argv) * We fake there is a window, because we can always open one! */ int -mch_input_isatty() +mch_input_isatty(void) { return TRUE; } @@ -557,9 +548,9 @@ mch_input_isatty() */ /*ARGSUSED*/ void -fname_case(name, len) - char_u *name; - int len; /* buffer size, ignored here */ +fname_case( + char_u *name, + int len) /* buffer size, ignored here */ { struct FileInfoBlock *fib; size_t flen; @@ -585,8 +576,7 @@ fname_case(name, len) * Returns NULL on error. */ static struct FileInfoBlock * -get_fib(fname) - char_u *fname; +get_fib(char_u *fname) { BPTR flock; struct FileInfoBlock *fib; @@ -618,9 +608,7 @@ get_fib(fname) * icon name is not set */ void -mch_settitle(title, icon) - char_u *title; - char_u *icon; +mch_settitle(char_u *title, char_u *icon) { if (wb_window != NULL && title != NULL) SetWindowTitles(wb_window, (UBYTE *)title, (UBYTE *)-1L); @@ -634,21 +622,20 @@ mch_settitle(title, icon) * 3 Restore title and icon (which we don't have) */ void -mch_restore_title(which) - int which; +mch_restore_title(int which) { if (which & 1) mch_settitle(oldwindowtitle, NULL); } int -mch_can_restore_title() +mch_can_restore_title(void) { return (wb_window != NULL); } int -mch_can_restore_icon() +mch_can_restore_icon(void) { return FALSE; } @@ -658,9 +645,7 @@ mch_can_restore_icon() * Insert user name in s[len]. */ int -mch_get_user_name(s, len) - char_u *s; - int len; +mch_get_user_name(char_u *s, int len) { /* TODO: Implement this. */ *s = NUL; @@ -671,9 +656,7 @@ mch_get_user_name(s, len) * Insert host name is s[len]. */ void -mch_get_host_name(s, len) - char_u *s; - int len; +mch_get_host_name(char_u *s, int len) { #if defined(__amigaos4__) && defined(__CLIB2__) gethostname(s, len); @@ -686,7 +669,7 @@ mch_get_host_name(s, len) * return process ID */ long -mch_get_pid() +mch_get_pid(void) { #ifdef __amigaos4__ /* This is as close to a pid as we can come. We could use CLI numbers also, @@ -703,9 +686,7 @@ mch_get_pid() * Return OK for success, FAIL for failure. */ int -mch_dirname(buf, len) - char_u *buf; - int len; +mch_dirname(char_u *buf, int len) { return mch_FullName((char_u *)"", buf, len, FALSE); } @@ -716,10 +697,11 @@ mch_dirname(buf, len) * return FAIL for failure, OK otherwise */ int -mch_FullName(fname, buf, len, force) - char_u *fname, *buf; - int len; - int force; +mch_FullName( + char_u *fname, + char_u *buf, + int len, + int force) { BPTR l; int retval = FAIL; @@ -764,8 +746,7 @@ mch_FullName(fname, buf, len, force) * Return TRUE if "fname" does not depend on the current directory. */ int -mch_isFullName(fname) - char_u *fname; +mch_isFullName(char_u *fname) { return (vim_strchr(fname, ':') != NULL && *fname != ':'); } @@ -777,10 +758,7 @@ mch_isFullName(fname) * return FAIL for failure, OK otherwise */ static int -lock2name(lock, buf, len) - BPTR lock; - char_u *buf; - long len; +lock2name(BPTR lock, char_u *buf, long len) { #ifdef FEAT_ARP if (dos2) /* use 2.0 function */ @@ -797,8 +775,7 @@ lock2name(lock, buf, len) * Returns -1 when it doesn't exist. */ long -mch_getperm(name) - char_u *name; +mch_getperm(char_u *name) { struct FileInfoBlock *fib; long retval = -1; @@ -818,9 +795,7 @@ mch_getperm(name) * return FAIL for failure, OK otherwise */ int -mch_setperm(name, perm) - char_u *name; - long perm; +mch_setperm(char_u *name, long perm) { perm &= ~FIBF_ARCHIVE; /* reset archived bit */ return (SetProtection((UBYTE *)name, (long)perm) ? OK : FAIL); @@ -830,8 +805,7 @@ mch_setperm(name, perm) * Set hidden flag for "name". */ void -mch_hide(name) - char_u *name; +mch_hide(char_u *name) { /* can't hide a file */ } @@ -842,8 +816,7 @@ mch_hide(name) * return FALSE for error. */ int -mch_isdir(name) - char_u *name; +mch_isdir(char_u *name) { struct FileInfoBlock *fib; int retval = FALSE; @@ -865,8 +838,7 @@ mch_isdir(name) * Create directory "name". */ int -mch_mkdir(name) - char_u *name; +mch_mkdir(char_u *name) { BPTR lock; @@ -881,12 +853,11 @@ mch_mkdir(name) /* * Return 1 if "name" can be executed, 0 if not. + * If "use_path" is FALSE only check if "name" is executable. * Return -1 if unknown. */ int -mch_can_exe(name, path) - char_u *name; - char_u **path; +mch_can_exe(char_u *name, char_u **path, int use_path) { /* TODO */ return -1; @@ -899,15 +870,14 @@ mch_can_exe(name, path) * NODE_OTHER: non-writable things */ int -mch_nodetype(name) - char_u *name; +mch_nodetype(char_u *name) { /* TODO */ return NODE_NORMAL; } void -mch_early_init() +mch_early_init(void) { } @@ -915,9 +885,10 @@ mch_early_init() * Careful: mch_exit() may be called before mch_init()! */ void -mch_exit(r) - int r; +mch_exit(int r) { + exiting = TRUE; + if (raw_in) /* put terminal in 'normal' mode */ { settmode(TMODE_COOK); @@ -975,8 +946,7 @@ mch_exit(r) * it sends a 0 to the console to make it back into a CON: from a RAW: */ void -mch_settmode(tmode) - int tmode; +mch_settmode(int tmode) { #if defined(__AROS__) || defined(__amigaos4__) if (!SetMode(raw_in, tmode == TMODE_RAW ? 1 : 0)) @@ -991,8 +961,7 @@ mch_settmode(tmode) * set screen mode, always fails. */ int -mch_screenmode(arg) - char_u *arg; +mch_screenmode(char_u *arg) { EMSG(_(e_screenmode)); return FAIL; @@ -1019,7 +988,7 @@ mch_screenmode(arg) * return FAIL for failure, OK otherwise */ int -mch_get_shellsize() +mch_get_shellsize(void) { struct ConUnit *conUnit; #ifndef __amigaos4__ @@ -1093,7 +1062,7 @@ mch_get_shellsize() * Try to set the real window size to Rows and Columns. */ void -mch_set_shellsize() +mch_set_shellsize(void) { if (term_console) { @@ -1112,7 +1081,7 @@ mch_set_shellsize() * Rows and/or Columns has changed. */ void -mch_new_shellsize() +mch_new_shellsize(void) { /* Nothing to do. */ } @@ -1121,8 +1090,7 @@ mch_new_shellsize() * out_num - output a (big) number fast */ static void -out_num(n) - long n; +out_num(long n) { OUT_STR_NF(tltoa((unsigned long)n)); } @@ -1152,10 +1120,10 @@ out_num(n) */ static long -dos_packet(pid, action, arg) - struct MsgPort *pid; /* process identifier ... (handlers message port) */ +dos_packet( + struct MsgPort *pid, /* process identifier ... (handlers message port) */ long action, /* packet type ... (what you want handler to do) */ - arg; /* single argument */ + long arg) /* single argument */ { # ifdef FEAT_ARP struct MsgPort *replyport; @@ -1204,9 +1172,9 @@ dos_packet(pid, action, arg) * Return error number for failure, 0 otherwise */ int -mch_call_shell(cmd, options) - char_u *cmd; - int options; /* SHELL_*, see vim.h */ +mch_call_shell( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ { BPTR mydir; int x; @@ -1413,7 +1381,7 @@ mch_call_shell(cmd, options) * trouble with lattice-c programs. */ void -mch_breakcheck() +mch_breakcheck(int force) { if (SetSignal(0L, (long)(SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D|SIGBREAKF_CTRL_E|SIGBREAKF_CTRL_F)) & SIGBREAKF_CTRL_C) got_int = TRUE; @@ -1462,10 +1430,10 @@ Chk_Abort(void) #endif int -mch_expandpath(gap, pat, flags) - garray_T *gap; - char_u *pat; - int flags; /* EW_* flags */ +mch_expandpath( + garray_T *gap, + char_u *pat, + int flags) /* EW_* flags */ { struct AnchorPath *Anchor; LONG Result; @@ -1583,8 +1551,7 @@ mch_expandpath(gap, pat, flags) } static int -sortcmp(a, b) - const void *a, *b; +sortcmp(const void *a, const void *b) { char *s = *(char **)a; char *t = *(char **)b; @@ -1596,10 +1563,9 @@ sortcmp(a, b) * Return TRUE if "p" has wildcards that can be expanded by mch_expandpath(). */ int -mch_has_exp_wildcard(p) - char_u *p; +mch_has_exp_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (*p == '\\' && p[1] != NUL) ++p; @@ -1610,10 +1576,9 @@ mch_has_exp_wildcard(p) } int -mch_has_wildcard(p) - char_u *p; +mch_has_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (*p == '\\' && p[1] != NUL) ++p; @@ -1639,8 +1604,7 @@ mch_has_wildcard(p) * - A small one to hold the return value. It is kept until the next call. */ char_u * -mch_getenv(var) - char_u *var; +mch_getenv(char_u *var) { int len; UBYTE *buf; /* buffer to expand in */ @@ -1653,8 +1617,7 @@ mch_getenv(var) else #endif { - vim_free(alloced); - alloced = NULL; + VIM_CLEAR(alloced); retval = NULL; buf = alloc(IOSIZE); @@ -1683,10 +1646,7 @@ mch_getenv(var) */ /* ARGSUSED */ int -mch_setenv(var, value, x) - char *var; - char *value; - int x; +mch_setenv(char *var, char *value, int x) { #ifdef FEAT_ARP if (!dos2) diff --git a/src/os_amiga.h b/src/os_amiga.h index bcdba32ad3..336cbdbaf3 100644 --- a/src/os_amiga.h +++ b/src/os_amiga.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -20,9 +20,6 @@ # if defined(AZTEC_C) || defined(__amigaos4__) # define HAVE_STAT_H # endif -# ifdef __amigaos4__ -# define HAVE_STDARG_H -# endif # define HAVE_STDLIB_H # define HAVE_STRING_H # define HAVE_FCNTL_H @@ -46,6 +43,9 @@ #ifndef DFLT_RUNTIMEPATH # define DFLT_RUNTIMEPATH "home:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,home:vimfiles/after" #endif +#ifndef CLEAN_RUNTIMEPATH +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +#endif #ifndef BASENAMELEN # define BASENAMELEN 26 /* Amiga */ @@ -163,6 +163,9 @@ typedef long off_t; #ifndef USR_VIMRC_FILE4 # define USR_VIMRC_FILE4 "$VIM/.vimrc" #endif +#ifndef VIM_DEFAULTS_FILE +# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" +#endif #ifndef EVIM_FILE # define EVIM_FILE "$VIMRUNTIME/evim.vim" #endif diff --git a/src/os_beos.c b/src/os_beos.c index 2eed684b87..ebb448829b 100644 --- a/src/os_beos.c +++ b/src/os_beos.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * BeBox port Copyright 1997 by Olaf Seibert. diff --git a/src/os_beos.h b/src/os_beos.h index e55c389631..0aa6f990fa 100644 --- a/src/os_beos.h +++ b/src/os_beos.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * BeBox port by Olaf Seibert diff --git a/src/os_dos.h b/src/os_dos.h index 19748c4963..bb8b30848d 100644 --- a/src/os_dos.h +++ b/src/os_dos.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -25,6 +25,9 @@ #ifndef USR_VIMRC_FILE3 # define USR_VIMRC_FILE3 "$VIM\\_vimrc" #endif +#ifndef VIM_DEFAULTS_FILE +# define VIM_DEFAULTS_FILE "$VIMRUNTIME\\defaults.vim" +#endif #ifndef EVIM_FILE # define EVIM_FILE "$VIMRUNTIME\\evim.vim" #endif @@ -122,6 +125,7 @@ #define DFLT_ERRORFILE "errors.err" #define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after" +#define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ #define SPACE_IN_FILENAME diff --git a/src/os_mac.h b/src/os_mac.h index c13a30158c..6f6a27b624 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -16,10 +16,10 @@ # define OPAQUE_TOOLBOX_STRUCTS 0 #endif -/* Include MAC_OS_X_VERSION_* macros */ -#ifdef HAVE_AVAILABILITYMACROS_H -# include <AvailabilityMacros.h> -#endif +/* Include MAC_OS_X_VERSION_* macros (needed for OS X 10.9, should be supported + * as of OS X 10.2) + * */ +#include <AvailabilityMacros.h> /* * Macintosh machine-dependent things. @@ -77,7 +77,7 @@ */ /* When compiled under MacOS X (including CARBON version) * we use the Unix File path style. Also when UNIX is defined. */ -# define USE_UNIXFILENAME +#define USE_UNIXFILENAME /* @@ -94,15 +94,10 @@ quite fast. Did I forgot to update the comment */ - #define USE_FNAME_CASE /* make ":e os_Mac.c" open the file in its original case, as "os_mac.c" */ #define BINARY_FILE_IO #define EOL_DEFAULT EOL_MAC -#ifndef MACOS_X_UNIX /* I hope that switching these two lines */ -# define USE_CR /* does what I want -- BNF */ -# define NO_CONSOLE /* don't include console mode */ -#endif #define HAVE_AVAIL_MEM #ifndef HAVE_CONFIG_H @@ -128,35 +123,38 @@ */ #ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "$VIM/vimrc" +# define SYS_VIMRC_FILE "$VIM/vimrc" #endif #ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM/gvimrc" +# define SYS_GVIMRC_FILE "$VIM/gvimrc" #endif #ifndef SYS_MENU_FILE -# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" +# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" #endif #ifndef SYS_OPTWIN_FILE -# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" +# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" +#endif +#ifndef VIM_DEFAULTS_FILE +# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" #endif #ifndef EVIM_FILE -# define EVIM_FILE "$VIMRUNTIME/evim.vim" +# define EVIM_FILE "$VIMRUNTIME/evim.vim" #endif #ifdef FEAT_GUI # ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "~/.gvimrc" +# define USR_GVIMRC_FILE "~/.gvimrc" # endif # ifndef GVIMRC_FILE # define GVIMRC_FILE "_gvimrc" # endif #endif #ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "~/.vimrc" +# define USR_VIMRC_FILE "~/.vimrc" #endif #ifndef USR_EXRC_FILE -# define USR_EXRC_FILE "~/.exrc" +# define USR_EXRC_FILE "~/.exrc" #endif #ifndef VIMRC_FILE @@ -168,7 +166,7 @@ #endif #ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" +# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" #endif #ifndef FILETYPE_FILE @@ -191,12 +189,12 @@ #endif #ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" +# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" #endif #ifdef FEAT_VIMINFO # ifndef VIMINFO_FILE -# define VIMINFO_FILE "~/.viminfo" +# define VIMINFO_FILE "~/.viminfo" # endif #endif /* FEAT_VIMINFO */ @@ -215,7 +213,10 @@ #define DFLT_ERRORFILE "errors.err" #ifndef DFLT_RUNTIMEPATH -# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" +# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" +#endif +#ifndef CLEAN_RUNTIMEPATH +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #endif /* @@ -223,11 +224,6 @@ */ #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ -#if !defined(MACOS_X_UNIX) -# define MAXPATHL 256 /* Limited by the Pascal Strings */ -# define BASENAMELEN (32-5-1) /* length of base of filename */ -#endif - #ifndef DFLT_MAXMEM # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */ #endif @@ -242,12 +238,8 @@ #define mch_rename(src, dst) rename(src, dst) #define mch_remove(x) unlink((char *)(x)) #ifndef mch_getenv -# if defined(__MRC__) || defined(__SC__) +# if defined(__APPLE_CC__) # define mch_getenv(name) ((char_u *)getenv((char *)(name))) -# define mch_setenv(name, val, x) setenv((name), (val)) -# elif defined(__APPLE_CC__) -# define mch_getenv(name) ((char_u *)getenv((char *)(name))) -/*# define mch_setenv(name, val, x) setenv((name), (val)) */ /* Obsoleted by Dany on Oct 30, 2001 */ # define mch_setenv(name, val, x) setenv(name, val, x) # else /* vim_getenv() is in pty.c */ @@ -272,33 +264,31 @@ * of ./configure for console MacOS X. */ -#ifdef MACOS_X_UNIX -# ifndef SIGPROTOARG -# define SIGPROTOARG (int) -# endif -# ifndef SIGDEFARG -# define SIGDEFARG(s) (s) int s UNUSED; -# endif -# ifndef SIGDUMMYARG -# define SIGDUMMYARG 0 -# endif -# undef HAVE_AVAIL_MEM -# ifndef HAVE_CONFIG_H -# define RETSIGTYPE void -# define SIGRETURN return +#ifndef SIGPROTOARG +# define SIGPROTOARG (int) +#endif +#ifndef SIGDEFARG +# define SIGDEFARG(s) (s) int s UNUSED; +#endif +#ifndef SIGDUMMYARG +# define SIGDUMMYARG 0 +#endif +#undef HAVE_AVAIL_MEM +#ifndef HAVE_CONFIG_H +# define RETSIGTYPE void +# define SIGRETURN return /*# define USE_SYSTEM */ /* Output ship do debugger :(, but ot compile */ -# define HAVE_SYS_WAIT_H 1 /* Attempt */ -# define HAVE_TERMIOS_H 1 -# define SYS_SELECT_WITH_SYS_TIME 1 -# define HAVE_SELECT 1 -# define HAVE_SYS_SELECT_H 1 -# define HAVE_PUTENV -# define HAVE_SETENV -# define HAVE_RENAME -# endif +# define HAVE_SYS_WAIT_H 1 /* Attempt */ +# define HAVE_TERMIOS_H 1 +# define SYS_SELECT_WITH_SYS_TIME 1 +# define HAVE_SELECT 1 +# define HAVE_SYS_SELECT_H 1 +# define HAVE_PUTENV +# define HAVE_SETENV +# define HAVE_RENAME #endif -#if defined(MACOS_X) && !defined(HAVE_CONFIG_H) +#if !defined(HAVE_CONFIG_H) # define HAVE_PUTENV #endif diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c index 2c4038ef1b..2bd337ea6f 100644 --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -14,10 +14,10 @@ */ #define NO_X11_INCLUDES -#define BalloonEval int /* used in header files */ #include "vim.h" -#ifndef FEAT_GUI_MAC + +#if !defined(FEAT_GUI_MAC) && !defined(PROTO) # include <CoreServices/CoreServices.h> #endif @@ -31,8 +31,8 @@ typedef int *TECObjectRef; typedef int CFStringRef; # endif -static char_u *mac_utf16_to_utf8 __ARGS((UniChar *from, size_t fromLen, size_t *actualLen)); -static UniChar *mac_utf8_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen)); +static char_u *mac_utf16_to_utf8(UniChar *from, size_t fromLen, size_t *actualLen); +static UniChar *mac_utf8_to_utf16(char_u *from, size_t fromLen, size_t *actualLen); /* Converter for composing decomposed HFS+ file paths */ static TECObjectRef gPathConverter; @@ -43,14 +43,14 @@ static TECObjectRef gUTF16ToUTF8Converter; * A Mac version of string_convert_ext() for special cases. */ char_u * -mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp) - char_u *ptr; - int len; - int *lenp; - int fail_on_error; - int from_enc; - int to_enc; - int *unconvlenp; +mac_string_convert( + char_u *ptr, + int len, + int *lenp, + int fail_on_error, + int from_enc, + int to_enc, + int *unconvlenp) { char_u *retval, *d; CFStringRef cfstr; @@ -179,10 +179,10 @@ mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp) * Returns OK or FAIL. */ int -macroman2enc(ptr, sizep, real_size) - char_u *ptr; - long *sizep; - long real_size; +macroman2enc( + char_u *ptr, + long *sizep, + long real_size) { CFStringRef cfstr; CFRange r; @@ -225,14 +225,14 @@ macroman2enc(ptr, sizep, real_size) * Returns OK or FAIL. */ int -enc2macroman(from, fromlen, to, tolenp, maxtolen, rest, restlenp) - char_u *from; - size_t fromlen; - char_u *to; - int *tolenp; - int maxtolen; - char_u *rest; - int *restlenp; +enc2macroman( + char_u *from, + size_t fromlen, + char_u *to, + int *tolenp, + int maxtolen, + char_u *rest, + int *restlenp) { CFStringRef cfstr; CFRange r; @@ -273,7 +273,7 @@ enc2macroman(from, fromlen, to, tolenp, maxtolen, rest, restlenp) * Initializes text converters */ void -mac_conv_init() +mac_conv_init(void) { TextEncoding utf8_encoding; TextEncoding utf8_hfsplus_encoding; @@ -308,7 +308,7 @@ mac_conv_init() * Destroys text converters */ void -mac_conv_cleanup() +mac_conv_cleanup(void) { if (gUTF16ToUTF8Converter) { @@ -329,10 +329,10 @@ mac_conv_cleanup() * CFBase.h) to avoid clashes with X11 header files in the .pro file */ char_u * -mac_utf16_to_enc(from, fromLen, actualLen) - unsigned short *from; - size_t fromLen; - size_t *actualLen; +mac_utf16_to_enc( + unsigned short *from, + size_t fromLen, + size_t *actualLen) { /* Following code borrows somewhat from os_mswin.c */ vimconv_T conv; @@ -383,10 +383,10 @@ mac_utf16_to_enc(from, fromLen, actualLen) * CFBase.h) to avoid clashes with X11 header files in the .pro file */ unsigned short * -mac_enc_to_utf16(from, fromLen, actualLen) - char_u *from; - size_t fromLen; - size_t *actualLen; +mac_enc_to_utf16( + char_u *from, + size_t fromLen, + size_t *actualLen) { /* Following code borrows somewhat from os_mswin.c */ vimconv_T conv; @@ -442,9 +442,9 @@ mac_enc_to_utf16(from, fromLen, actualLen) * The void * return type is actually a CFStringRef */ void * -mac_enc_to_cfstring(from, fromLen) - char_u *from; - size_t fromLen; +mac_enc_to_cfstring( + char_u *from, + size_t fromLen) { UniChar *utf16_str; size_t utf16_len; @@ -464,10 +464,10 @@ mac_enc_to_cfstring(from, fromLen) * Converts a decomposed HFS+ UTF-8 path to precomposed UTF-8 */ char_u * -mac_precompose_path(decompPath, decompLen, precompLen) - char_u *decompPath; - size_t decompLen; - size_t *precompLen; +mac_precompose_path( + char_u *decompPath, + size_t decompLen, + size_t *precompLen) { char_u *result = NULL; size_t actualLen = 0; @@ -480,10 +480,7 @@ mac_precompose_path(decompPath, decompLen, precompLen) if (TECConvertText(gPathConverter, decompPath, decompLen, &decompLen, result, decompLen, &actualLen) != noErr) - { - vim_free(result); - result = NULL; - } + VIM_CLEAR(result); } } @@ -497,10 +494,10 @@ mac_precompose_path(decompPath, decompLen, precompLen) * Converts from UTF-16 UniChars to precomposed UTF-8 */ static char_u * -mac_utf16_to_utf8(from, fromLen, actualLen) - UniChar *from; - size_t fromLen; - size_t *actualLen; +mac_utf16_to_utf8( + UniChar *from, + size_t fromLen, + size_t *actualLen) { ByteCount utf8_len; ByteCount inputRead; @@ -517,10 +514,7 @@ mac_utf16_to_utf8(from, fromLen, actualLen) utf8_len += inputRead; } else - { - vim_free(result); - result = NULL; - } + VIM_CLEAR(result); } else { @@ -537,10 +531,10 @@ mac_utf16_to_utf8(from, fromLen, actualLen) * Converts from UTF-8 to UTF-16 UniChars */ static UniChar * -mac_utf8_to_utf16(from, fromLen, actualLen) - char_u *from; - size_t fromLen; - size_t *actualLen; +mac_utf8_to_utf16( + char_u *from, + size_t fromLen, + size_t *actualLen) { CFStringRef utf8_str; CFRange convertRange; @@ -572,7 +566,8 @@ mac_utf8_to_utf16(from, fromLen, actualLen) * Sets LANG environment variable in Vim from Mac locale */ void -mac_lang_init() { +mac_lang_init(void) +{ if (mch_getenv((char_u *)"LANG") == NULL) { char buf[20]; diff --git a/src/os_macosx.m b/src/os_macosx.m index 00358290b8..e60d154f88 100644 --- a/src/os_macosx.m +++ b/src/os_macosx.m @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -8,20 +8,23 @@ */ /* - * os_macosx.m -- Mac specific things for Mac OS/X. + * os_macosx.m -- Mac specific things for Mac OS X. */ -#ifndef MACOS_X_UNIX - Error: MACOS 9 is no longer supported in Vim 7 +/* Suppress compiler warnings to non-C89 code. */ +#if defined(__clang__) && defined(__STRICT_ANSI__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wc99-extensions" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeclaration-after-statement" #endif /* Avoid a conflict for the definition of Boolean between Mac header files and * X11 header files. */ #define NO_X11_INCLUDES -#define BalloonEval int /* used in header files */ #include "vim.h" -#import <Cocoa/Cocoa.h> +#import <AppKit/AppKit.h> /* @@ -37,13 +40,13 @@ NSString *VimPboardType = @"VimPboardType"; void -clip_mch_lose_selection(VimClipboard *cbd) +clip_mch_lose_selection(VimClipboard *cbd UNUSED) { } int -clip_mch_own_selection(VimClipboard *cbd) +clip_mch_own_selection(VimClipboard *cbd UNUSED) { /* This is called whenever there is a new selection and 'guioptions' * contains the "a" flag (automatically copy selection). Return TRUE, else @@ -60,8 +63,13 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSPasteboard *pb = [NSPasteboard generalPasteboard]; +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSPasteboardTypeString, nil]; +#else NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, NSStringPboardType, nil]; +#endif NSString *bestType = [pb availableTypeFromArray:supportedTypes]; if (!bestType) goto releasepool; @@ -73,7 +81,7 @@ /* This type should consist of an array with two objects: * 1. motion type (NSNumber) * 2. text (NSString) - * If this is not the case we fall back on using NSStringPboardType. + * If this is not the case we fall back on using NSPasteboardTypeString. */ id plist = [pb propertyListForType:VimPboardType]; if ([plist isKindOfClass:[NSArray class]] && [plist count] == 2) @@ -89,10 +97,15 @@ if (!string) { - /* Use NSStringPboardType. The motion type is detected automatically. + /* Use NSPasteboardTypeString. The motion type is detected automatically. */ +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + NSMutableString *mstring = + [[pb stringForType:NSPasteboardTypeString] mutableCopy]; +#else NSMutableString *mstring = [[pb stringForType:NSStringPboardType] mutableCopy]; +#endif if (!mstring) goto releasepool; /* Replace unrecognized end-of-line sequences with \x0a (line feed). */ @@ -175,15 +188,24 @@ /* See clip_mch_request_selection() for info on pasteboard types. */ NSPasteboard *pb = [NSPasteboard generalPasteboard]; +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSPasteboardTypeString, nil]; +#else NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, NSStringPboardType, nil]; +#endif [pb declareTypes:supportedTypes owner:nil]; NSNumber *motion = [NSNumber numberWithInt:motion_type]; NSArray *plist = [NSArray arrayWithObjects:motion, string, nil]; [pb setPropertyList:plist forType:VimPboardType]; +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + [pb setString:string forType:NSPasteboardTypeString]; +#else [pb setString:string forType:NSStringPboardType]; +#endif [string release]; } @@ -195,6 +217,11 @@ #endif /* FEAT_CLIPBOARD */ +/* Lift the compiler warning suppression. */ +#if defined(__clang__) && defined(__STRICT_ANSI__) +# pragma clang diagnostic pop +# pragma clang diagnostic pop +#endif void macosx_fork() diff --git a/src/os_mint.h b/src/os_mint.h index 94419b389d..18bd78b68e 100644 --- a/src/os_mint.h +++ b/src/os_mint.h @@ -1,4 +1,4 @@ -/* vim:ts=8 sts=4:sw=4 +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/os_msdos.c b/src/os_msdos.c deleted file mode 100644 index f24a6f8ead..0000000000 --- a/src/os_msdos.c +++ /dev/null @@ -1,3081 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ - -/* - * os_msdos.c - * - * MSDOS system-dependent routines. - * A cheap plastic imitation of the amiga dependent code. - * A lot in this file was made by Juergen Weigert (jw). - * - * DJGPP changes by Gert van Antwerpen - * Faster text screens by John Lange (jlange@zilker.net) - * Windows clipboard functionality added by David Kotchan (dk) - * - * Some functions are also used for Win16 (MS-Windows 3.1). - */ - -#include "vim.h" - -/* cproto fails on missing include files */ -#ifndef PROTO -# include <conio.h> -#endif - -/* - * MS-DOS only code, not used for Win16. - */ -#ifndef WIN16 - - -#ifndef PROTO -# include <bios.h> -# ifdef DJGPP -# include <dpmi.h> -# include <signal.h> -# include <sys/movedata.h> -# include <crt0.h> -# ifdef FEAT_CLIPBOARD -# include <sys/segments.h> -# endif -# else -# include <alloc.h> -# endif -#endif - -#if defined(DJGPP) || defined(PROTO) -# define _cdecl /* DJGPP doesn't have this */ -#endif - -static int cbrk_pressed = FALSE; /* set by ctrl-break interrupt */ -static int ctrlc_pressed = FALSE; /* set when ctrl-C or ctrl-break detected */ -static int delayed_redraw = FALSE; /* set when ctrl-C detected */ - -static int bioskey_read = _NKEYBRD_READ; /* bioskey() argument: read key */ -static int bioskey_ready = _NKEYBRD_READY; /* bioskey() argument: key ready? */ - -#ifdef FEAT_MOUSE -static int mouse_avail = FALSE; /* mouse present */ -static int mouse_active; /* mouse enabled */ -static int mouse_hidden; /* mouse not shown */ -static int mouse_click = -1; /* mouse status */ -static int mouse_last_click = -1; /* previous status at click */ -static int mouse_x = -1; /* mouse x coordinate */ -static int mouse_y = -1; /* mouse y coordinate */ -static long mouse_click_time = 0; /* biostime() of last click */ -static int mouse_click_count = 0; /* count for multi-clicks */ -static int mouse_click_x = 0; /* x of previous mouse click */ -static int mouse_click_y = 0; /* y of previous mouse click */ -static linenr_T mouse_topline = 0; /* w_topline at previous mouse click */ -#ifdef FEAT_DIFF -static int mouse_topfill = 0; /* w_topfill at previous mouse click */ -#endif -static int mouse_x_div = 8; /* column = x coord / mouse_x_div */ -static int mouse_y_div = 8; /* line = y coord / mouse_y_div */ -#endif - -#define BIOSTICK 55 /* biostime() increases one tick about - every 55 msec */ - -static int orig_attr = 0x0700; /* video attributes when starting */ - -static int S_iLeft = 0; /* Scroll window; these are 1 offset */ -static int S_iTop = 0; -static int S_iRight = 0; -static int S_iBottom = 0; - -/* - * Need to remember the values, because we set horizontal and vertical - * edges separately. - */ - static void -mywindow(int iLeft, int iTop, int iRight, int iBottom) -{ - S_iLeft = iLeft; - S_iTop = iTop; - S_iRight = iRight; - S_iBottom = iBottom; - window(iLeft, iTop, iRight, iBottom); -} - -#ifdef DJGPP -/* - * For DJGPP, use our own functions for fast text screens. JML 1/18/98 - */ - -unsigned long S_ulScreenBase = 0xb8000; -unsigned short S_uiAttribute = 0; -int S_iCurrentRow = 0; /* These are 0 offset */ -int S_iCurrentColumn = 0; -short S_selVideo; /* Selector for DJGPP direct video transfers */ - -/* - * Use burst writes to improve mch_write speed - VJN 01/10/99 - */ -unsigned short S_linebuffer[8000]; /* <VN> enough for 160x50 */ -unsigned short S_blankbuffer[256]; /* <VN> max length of console line */ -unsigned short *S_linebufferpos = S_linebuffer; -int S_iBufferRow; -int S_iBufferColumn; - - static void -myflush(void) -{ - if (S_linebufferpos != S_linebuffer) - { - _dosmemputw(S_linebuffer, (S_linebufferpos - S_linebuffer), - S_ulScreenBase - + S_iBufferRow * (Columns << 1) + (S_iBufferColumn << 1)); - S_linebufferpos = S_linebuffer; - } -} - - static void -mygotoxy(int x, int y) -{ - S_iCurrentRow = y - 1; - S_iCurrentColumn = x - 1; -} - -/* - * Set the system cursor to our cursor position. - */ - static void -set_sys_cursor(void) -{ - if (term_console && full_screen) - { - myflush(); - gotoxy(S_iCurrentColumn + 1, S_iCurrentRow + 1); - } -} - - static void -setblankbuffer(unsigned short uiValue) -{ - int i; - static unsigned short olduiValue = 0; - - if (olduiValue != uiValue) - { - /* Load blank line buffer with spaces */ - for (i = 0; i < Columns; ++i) - S_blankbuffer[i] = uiValue; - olduiValue = uiValue; - } -} - - static void -myclreol(void) -{ - /* Clear to end of line */ - setblankbuffer(S_uiAttribute | ' '); - _dosmemputw(S_blankbuffer, S_iRight - S_iCurrentColumn, S_ulScreenBase - + (S_iCurrentRow) * (Columns << 1) - + (S_iCurrentColumn << 1)); -} - - static void -myclrscr(void) -{ - /* Clear whole screen */ - short iColumn; - int endpoint = (Rows * Columns) << 1; - - setblankbuffer(S_uiAttribute | ' '); - - for (iColumn = 0; iColumn < endpoint; iColumn += (Columns << 1)) - _dosmemputw(S_blankbuffer, Columns, S_ulScreenBase + iColumn); -} - - static void -mydelline(void) -{ - short iRow, iColumn; - - iColumn = (S_iLeft - 1) << 1; - - /* Copy the lines underneath */ - for (iRow = S_iCurrentRow; iRow < S_iBottom - 1; iRow++) - movedata(S_selVideo, (((iRow + 1) * Columns) << 1) + iColumn, - S_selVideo, ((iRow * Columns) << 1) + iColumn, - (S_iRight - S_iLeft + 1) << 1); - - /* Clear the new row */ - setblankbuffer(S_uiAttribute | ' '); - - _dosmemputw(S_blankbuffer, (S_iRight - S_iLeft) + 1, S_ulScreenBase - + (S_iBottom - 1) * (Columns << 1) + iColumn); -} - - static void -myinsline(void) -{ - short iRow, iColumn; - - iColumn = (S_iLeft - 1) << 1; - - /* Copy the lines underneath */ - for (iRow = S_iBottom - 1; iRow >= S_iTop; iRow--) - movedata(S_selVideo, (((iRow - 1) * Columns) << 1) + iColumn, - S_selVideo, ((iRow * Columns) << 1) + iColumn, - (S_iRight - S_iLeft + 1) << 1); - - /* Clear the new row */ - setblankbuffer(S_uiAttribute | ' '); - - _dosmemputw(S_blankbuffer, (S_iRight - S_iLeft) + 1, S_ulScreenBase - + (S_iTop - 1) * (Columns << 1) + iColumn); -} - -/* - * Scroll the screen one line up, clear the last line. - */ - static void -myscroll(void) -{ - short iRow, iColumn; - - iColumn = (S_iLeft - 1) << 1; - - /* Copy the screen */ - for (iRow = S_iTop; iRow < S_iBottom; iRow++) - movedata(S_selVideo, ((iRow * Columns) << 1) + iColumn, - S_selVideo, (((iRow - 1) * Columns) << 1) + iColumn, - (S_iRight - S_iLeft + 1) << 1); - - /* Clear the bottom row */ - setblankbuffer(S_uiAttribute | ' '); - - _dosmemputw(S_blankbuffer, (S_iRight - S_iLeft) + 1, S_ulScreenBase - + (S_iBottom - 1) * (Columns << 1) + iColumn); -} - - static int -myputch(int iChar) -{ - unsigned short uiValue; - - if (iChar == '\n') - { - myflush(); - if (S_iCurrentRow >= S_iBottom - S_iTop) - myscroll(); - else - { - S_iCurrentColumn = S_iLeft - 1; - S_iCurrentRow++; - } - } - else if (iChar == '\r') - { - myflush(); - S_iCurrentColumn = S_iLeft - 1; - } - else if (iChar == '\b') - { - myflush(); - if (S_iCurrentColumn >= S_iLeft) - S_iCurrentColumn--; - } - else if (iChar == 7) - { - sound(440); /* short beep */ - delay(200); - nosound(); - } - else - { - uiValue = S_uiAttribute | (unsigned char)iChar; - - /* - * Normal char - are we starting to buffer? - */ - if (S_linebufferpos == S_linebuffer) - { - S_iBufferColumn = S_iCurrentColumn; - S_iBufferRow = S_iCurrentRow; - } - - *S_linebufferpos++ = uiValue; - - S_iCurrentColumn++; - if (S_iCurrentColumn >= S_iRight && S_iCurrentRow >= S_iBottom - S_iTop) - { - myflush(); - myscroll(); - S_iCurrentColumn = S_iLeft - 1; - S_iCurrentRow++; - } - } - - return 0; -} - - static void -mytextinit(struct text_info *pTextinfo) -{ - S_selVideo = __dpmi_segment_to_descriptor(S_ulScreenBase >> 4); - S_uiAttribute = pTextinfo->normattr << 8; -} - - static void -get_screenbase(void) -{ - static union REGS regs; - - /* old Hercules grafic card has different base address (Macewicz) */ - regs.h.ah = 0x0f; - (void)int86(0x10, ®s, ®s); /* int 10 0f */ - if (regs.h.al == 0x07) /* video mode 7 -- hercules mono */ - S_ulScreenBase = 0xb0000; - else - S_ulScreenBase = 0xb8000; -} - - static void -mytextattr(int iAttribute) -{ - S_uiAttribute = (unsigned short)iAttribute << 8; -} - - static void -mynormvideo(void) -{ - mytextattr(orig_attr); -} - - static void -mytextcolor(int iTextColor) -{ - S_uiAttribute = (unsigned short)((S_uiAttribute & 0xf000) - | (unsigned short)iTextColor << 8); -} - - static void -mytextbackground(int iBkgColor) -{ - S_uiAttribute = (unsigned short)((S_uiAttribute & 0x0f00) - | (unsigned short)(iBkgColor << 12)); -} -/* - * Getdigits: Get a number from a string and skip over it. - * Note: the argument is a pointer to a char_u pointer! - */ - - static long -mygetdigits(pp) - char_u **pp; -{ - char_u *p; - long retval = 0; - - p = *pp; - if (*p == '-') /* skip negative sign */ - ++p; - while (VIM_ISDIGIT(*p)) - { - retval = (retval * 10) + (*p - '0'); - ++p; - } - if (**pp == '-') /* process negative sign */ - retval = -retval; - - *pp = p; - return retval; -} -#else -# define mygotoxy gotoxy -# define myputch putch -# define myscroll scroll -# define mynormvideo normvideo -# define mytextattr textattr -# define mytextcolor textcolor -# define mytextbackground textbackground -# define mygetdigits getdigits -# define myclreol clreol -# define myclrscr clrscr -# define myinsline insline -# define mydelline delline -#endif - -static const struct -{ - char_u scancode; - char_u metakey; -} altkey_table[] = -{ - {0x1e, 0xe1}, /* a */ - {0x30, 0xe2}, /* b */ - {0x2e, 0xe3}, /* c */ - {0x20, 0xe4}, /* d */ - {0x12, 0xe5}, /* e */ - {0x21, 0xe6}, /* f */ - {0x22, 0xe7}, /* g */ - {0x23, 0xe8}, /* h */ - {0x17, 0xe9}, /* i */ - {0x24, 0xea}, /* j */ - {0x25, 0xeb}, /* k */ - {0x26, 0xec}, /* l */ - {0x32, 0xed}, /* m */ - {0x31, 0xee}, /* n */ - {0x18, 0xef}, /* o */ - {0x19, 0xf0}, /* p */ - {0x10, 0xf1}, /* q */ - {0x13, 0xf2}, /* r */ - {0x1f, 0xf3}, /* s */ - {0x14, 0xf4}, /* t */ - {0x16, 0xf5}, /* u */ - {0x2f, 0xf6}, /* v */ - {0x11, 0xf7}, /* w */ - {0x2d, 0xf8}, /* x */ - {0x15, 0xf9}, /* y */ - {0x2c, 0xfa}, /* z */ - {0x78, 0xb1}, /* 1 */ - {0x79, 0xb2}, /* 2 */ - {0x7a, 0xb3}, /* 3 */ - {0x7b, 0xb4}, /* 4 */ - {0x7c, 0xb5}, /* 5 */ - {0x7d, 0xb6}, /* 6 */ - {0x7e, 0xb7}, /* 7 */ - {0x7f, 0xb8}, /* 8 */ - {0x80, 0xb9}, /* 9 */ - {0x81, 0xb0}, /* 0 */ -}; - -/* - * Translate extended keycodes into meta-chars where applicable - */ - static int -translate_altkeys(int rawkey) -{ - int i, c; - - if ((rawkey & 0xff) == 0) - { - c = (rawkey >> 8); - for (i = sizeof(altkey_table) / sizeof(altkey_table[0]); --i >= 0; ) - { - if (c == altkey_table[i].scancode) - return (int)altkey_table[i].metakey; - } - } - return rawkey; -} - -/* - * Set normal fg/bg color, based on T_ME. Called when t_me has been set. - */ - void -mch_set_normal_colors() -{ - char_u *p; - int n; - - cterm_normal_fg_color = (orig_attr & 0xf) + 1; - cterm_normal_bg_color = ((orig_attr >> 4) & 0xf) + 1; - if (T_ME[0] == ESC && T_ME[1] == '|') - { - p = T_ME + 2; - n = getdigits(&p); - if (*p == 'm' && n > 0) - { - cterm_normal_fg_color = (n & 0xf) + 1; - cterm_normal_bg_color = ((n >> 4) & 0xf) + 1; - } - } -} - -#if defined(MCH_CURSOR_SHAPE) || defined(PROTO) -/* - * Save/restore the shape of the cursor. - * call with FALSE to save, TRUE to restore - */ - static void -mch_restore_cursor_shape(int restore) -{ - static union REGS regs; - static int saved = FALSE; - - if (restore) - { - if (saved) - regs.h.ah = 0x01; /* Set Cursor */ - else - return; - } - else - { - regs.h.ah = 0x03; /* Get Cursor */ - regs.h.bh = 0x00; /* Page */ - saved = TRUE; - } - - (void)int86(0x10, ®s, ®s); -} - -/* - * Set the shape of the cursor. - * 'thickness' can be from 0 (thin) to 7 (block) - */ - static void -mch_set_cursor_shape(int thickness) -{ - union REGS regs; - - regs.h.ch = 7 - thickness; /* Starting Line */ - regs.h.cl = 7; /* Ending Line */ - regs.h.ah = 0x01; /* Set Cursor */ - (void)int86(0x10, ®s, ®s); -} - - void -mch_update_cursor(void) -{ - int idx; - int thickness; - - /* - * How the cursor is drawn depends on the current mode. - */ - idx = get_shape_idx(FALSE); - - if (shape_table[idx].shape == SHAPE_BLOCK) - thickness = 7; - else - thickness = (7 * shape_table[idx].percentage + 90) / 100; - mch_set_cursor_shape(thickness); -} -#endif - -/* - * Return amount of memory currently available in Kbyte. - */ - long_u -mch_avail_mem(int special) -{ -#ifdef DJGPP - return _go32_dpmi_remaining_virtual_memory() >> 10; -#else - return coreleft() >> 10; -#endif -} - -#ifdef FEAT_MOUSE - -/* - * Set area where mouse can be moved to: The whole screen. - * Rows and Columns must be valid when calling! - */ - static void -mouse_area(void) -{ - union REGS regs; - - if (mouse_avail) - { - regs.x.cx = 0; /* mouse visible between cx and dx */ - regs.x.dx = Columns * mouse_x_div - 1; - regs.x.ax = 7; - (void)int86(0x33, ®s, ®s); - - regs.x.cx = 0; /* mouse visible between cx and dx */ - regs.x.dx = Rows * mouse_y_div - 1; - regs.x.ax = 8; - (void)int86(0x33, ®s, ®s); - } -} - - static void -show_mouse(int on) -{ - static int was_on = FALSE; - union REGS regs; - - if (mouse_avail) - { - if (!mouse_active || mouse_hidden) - on = FALSE; - /* - * Careful: Each switch on must be compensated by exactly one switch - * off - */ - if ((on && !was_on) || (!on && was_on)) - { - was_on = on; - regs.x.ax = on ? 1 : 2; - int86(0x33, ®s, ®s); /* show mouse */ - if (on) - mouse_area(); - } - } -} - -#endif - -/* - * Version of kbhit() and getch() that use direct console I/O. - * This avoids trouble with CTRL-P and the like, and should work over a telnet - * connection (it works for Xvi). - */ - -static int cons_key = -1; - -/* - * Try to get one character directly from the console. - * If there is a key, it is stored in cons_key. - * Only call when cons_key is -1! - */ - static void -cons_getkey(void) -{ - union REGS regs; - - /* call DOS function 6: Direct console I/O */ - regs.h.ah = 0x06; - regs.h.dl = 0xff; - (void)intdos(®s, ®s); - if ((regs.x.flags & 0x40) == 0) /* zero flag not set? */ - cons_key = (regs.h.al & 0xff); -} - -/* - * Return TRUE if a character is available. - */ - static int -cons_kbhit(void) -{ - if (cons_key < 0) - cons_getkey(); - return (cons_key >= 0); -} - -/* - * Return a character from the console. - * Should only be called when vim_kbhit() returns TRUE. - */ - static int -cons_getch(void) -{ - int c = -1; - - if (cons_key < 0) - cons_getkey(); - c = cons_key; - cons_key = -1; - return c; -} - - -#ifdef DJGPP -/* - * DJGPP provides a kbhit() function that goes to the BIOS instead of DOS. - * This doesn't work for terminals connected to a serial port. - * Redefine kbhit() here to make it work. - */ - static int -vim_kbhit(void) -{ - union REGS regs; - - regs.h.ah = 0x0b; - (void)intdos(®s, ®s); - return regs.h.al; -} - -#ifdef kbhit -# undef kbhit /* might have been defined in conio.h */ -#endif -#define kbhit() vim_kbhit() - -#endif - -/* - * Simulate WaitForChar() by slowly polling with bioskey(1) or kbhit(). - * - * If Vim should work over the serial line after a 'ctty com1' we must use - * kbhit() and getch(). (jw) - * Usually kbhit() is not used, because then CTRL-C and CTRL-P - * will be caught by DOS (mool). - * - * return TRUE if a character is available, FALSE otherwise - */ - -#define FOREVER 1999999999L - - static int -WaitForChar(long msec) -{ - long starttime = 0; - - if (msec != 0) - starttime = biostime(0, 0L); - - for (;;) - { -#ifdef FEAT_MOUSE - long clicktime; - static int old_status = 0; - union REGS regs; - int x, y; - - if (mouse_avail && mouse_active && mouse_click < 0) - { - regs.x.ax = 3; - int86(0x33, ®s, ®s); /* check mouse status */ - /* only recognize button-down and button-up event */ - x = regs.x.cx / mouse_x_div; - y = regs.x.dx / mouse_y_div; - if ((old_status == 0) != (regs.x.bx == 0)) - { - if (old_status) /* button up */ - mouse_click = MOUSE_RELEASE; - else /* button down */ - { - /* - * Translate MSDOS mouse events to Vim mouse events. - * TODO: should handle middle mouse button, by pressing - * left and right at the same time. - */ - if (regs.x.bx & MSDOS_MOUSE_LEFT) - mouse_click = MOUSE_LEFT; - else if (regs.x.bx & MSDOS_MOUSE_RIGHT) - mouse_click = MOUSE_RIGHT; - else if (regs.x.bx & MSDOS_MOUSE_MIDDLE) - mouse_click = MOUSE_MIDDLE; - - /* - * Find out if this is a multi-click - */ - clicktime = biostime(0, 0L); - if (mouse_click_x == x && mouse_click_y == y - && mouse_topline == curwin->w_topline -#ifdef FEAT_DIFF - && mouse_topfill == curwin->w_topfill -#endif - && mouse_click_count != 4 - && mouse_click == mouse_last_click - && clicktime < mouse_click_time - + p_mouset / BIOSTICK) - ++mouse_click_count; - else - mouse_click_count = 1; - mouse_click_time = clicktime; - mouse_last_click = mouse_click; - mouse_click_x = x; - mouse_click_y = y; - mouse_topline = curwin->w_topline; -#ifdef FEAT_DIFF - mouse_topfill = curwin->w_topfill; -#endif - SET_NUM_MOUSE_CLICKS(mouse_click, mouse_click_count); - } - } - else if (old_status && (x != mouse_x || y != mouse_y)) - mouse_click = MOUSE_DRAG; - old_status = regs.x.bx; - if (mouse_hidden && mouse_x >= 0 && (mouse_x != x || mouse_y != y)) - { - mouse_hidden = FALSE; - show_mouse(TRUE); - } - mouse_x = x; - mouse_y = y; - } -#endif - - if ((p_consk ? cons_kbhit() - : p_biosk ? bioskey(bioskey_ready) : kbhit()) - || cbrk_pressed -#ifdef FEAT_MOUSE - || mouse_click >= 0 -#endif - ) - return TRUE; - /* - * Use biostime() to wait until our time is done. - * We busy-wait here. Unfortunately, delay() and usleep() have been - * reported to give problems with the original Windows 95. This is - * fixed in service pack 1, but not everybody installed that. - * The DJGPP implementation of usleep() uses a busy-wait loop too. - */ - if (msec == 0 || (msec != FOREVER - && biostime(0, 0L) > starttime + msec / BIOSTICK)) - break; - -#ifdef DJGPP - /* Yield the CPU to the next process. */ - __dpmi_yield(); -#endif - } - return FALSE; -} - -/* - * don't do anything for about "msec" msec - */ - void -mch_delay( - long msec, - int ignoreinput) -{ - long starttime; - - if (ignoreinput) - { - /* - * We busy-wait here. Unfortunately, delay() and usleep() have been - * reported to give problems with the original Windows 95. This is - * fixed in service pack 1, but not everybody installed that. - */ - starttime = biostime(0, 0L); - while (biostime(0, 0L) < starttime + msec / BIOSTICK) - ; - } - else - WaitForChar(msec); -} - -/* - * mch_write(): write the output buffer to the screen - */ - void -mch_write( - char_u *s, - int len) -{ - char_u *p; - int row, col; - - if (term_console && full_screen) - while (len--) - { - /* translate ESC | sequences into bios calls */ - if (p_wd) /* testing: wait a bit for each char */ - WaitForChar(p_wd); - - if (s[0] == '\n') -#ifdef DJGPP - { - myflush(); - S_iCurrentColumn = S_iLeft - 1; - } -#else - myputch('\r'); -#endif - else if (s[0] == ESC && len > 1 && s[1] == '|') - { - switch (s[2]) - { -#ifdef DJGPP - case 'B': ScreenVisualBell(); - goto got3; -#endif - case 'J': -#ifdef DJGPP - myflush(); -#endif - myclrscr(); - goto got3; - - case 'K': -#ifdef DJGPP - myflush(); -#endif - myclreol(); - goto got3; - - case 'L': -#ifdef DJGPP - myflush(); -#endif - myinsline(); - goto got3; - - case 'M': -#ifdef DJGPP - myflush(); -#endif - mydelline(); -got3: s += 3; - len -= 2; - continue; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': p = s + 2; - row = mygetdigits(&p); /* no check for length! */ - if (p > s + len) - break; - if (*p == ';') - { - ++p; - col = mygetdigits(&p); /* no check for length! */ - if (p > s + len) - break; - if (*p == 'H' || *p == 'r' || *p == 'V') - { -#ifdef DJGPP - myflush(); -#endif - if (*p == 'H') /* set cursor position */ - mygotoxy(col, row); - else if (*p == 'V') - mywindow(row, S_iTop, col, S_iBottom); - else /* set scroll region */ - mywindow(S_iLeft, row, S_iRight, col); - len -= p - s; - s = p + 1; - continue; - } - } - else if (*p == 'm' || *p == 'f' || *p == 'b') - { - if (*p == 'm') /* set color */ - { - if (row == 0) - mynormvideo();/* reset color */ - else - mytextattr(row); - } - else if (*p == 'f') /* set foreground color */ - mytextcolor(row); - else /* set background color */ - mytextbackground(row); - - len -= p - s; - s = p + 1; - continue; - } - } - } - myputch(*s++); - } - else - { - write(1, s, (unsigned)len); - } -} - -/* - * mch_inchar(): low level input function. - * Get a characters from the keyboard. - * If time == 0 do not wait for characters. - * If time == n wait a short time for characters. - * If time == -1 wait forever for characters. - * - * return the number of characters obtained - */ - int -mch_inchar( - char_u *buf, - int maxlen, - long time, - int tb_change_cnt) -{ - int len = 0; - int c; - int tmp_c; - static int nextchar = 0; /* may keep character when maxlen == 1 */ - - /* - * if we got a ctrl-C when we were busy, there will be a "^C" somewhere - * on the screen, so we need to redisplay it. - */ - if (delayed_redraw) - { - delayed_redraw = FALSE; - update_screen(CLEAR); - setcursor(); - out_flush(); - } - - /* return remaining character from last call */ - if (nextchar) - { - *buf = nextchar; - nextchar = 0; - return 1; - } - -#ifdef FEAT_MOUSE - if (time != 0) - show_mouse(TRUE); -#endif -#ifdef DJGPP - set_sys_cursor(); -#endif - if (time >= 0) - { - if (WaitForChar(time) == 0) /* no character available */ - { -#ifdef FEAT_MOUSE - show_mouse(FALSE); -#endif - return 0; - } - } - else /* time == -1 */ - { - /* - * If there is no character available within 2 seconds (default) - * write the autoscript file to disk. Or cause the CursorHold event - * to be triggered. - */ - if (WaitForChar(p_ut) == 0) - { -#ifdef FEAT_AUTOCMD - if (trigger_cursorhold() && maxlen >= 3) - { - buf[0] = K_SPECIAL; - buf[1] = KS_EXTRA; - buf[2] = (int)KE_CURSORHOLD; - return 3; - } -#endif - before_blocking(); - } - } - WaitForChar(FOREVER); /* wait for key or mouse click */ - -/* - * Try to read as many characters as there are, until the buffer is full. - */ - /* - * we will get at least one key. Get more if they are available - * After a ctrl-break we have to read a 0 (!) from the buffer. - * bioskey(1) will return 0 if no key is available and when a - * ctrl-break was typed. When ctrl-break is hit, this does not always - * implies a key hit. - */ - cbrk_pressed = FALSE; -#ifdef FEAT_MOUSE - if (mouse_click >= 0 && maxlen >= 5) - { - len = 5; - *buf++ = ESC + 128; - *buf++ = 'M'; - *buf++ = mouse_click; - *buf++ = mouse_x + '!'; - *buf++ = mouse_y + '!'; - mouse_click = -1; - } - else -#endif - { -#ifdef FEAT_MOUSE - mouse_hidden = TRUE; -#endif - if (p_biosk && !p_consk) - { - while ((len == 0 || bioskey(bioskey_ready)) && len < maxlen) - { - c = translate_altkeys(bioskey(bioskey_read)); /* get the key */ - /* - * translate a few things for inchar(): - * 0x0000 == CTRL-break -> 3 (CTRL-C) - * 0x0300 == CTRL-@ -> NUL - * 0xnn00 == extended key code -> K_NUL, nn - * 0xnne0 == enhanced keyboard -> K_NUL, nn - * K_NUL -> K_NUL, 3 - */ - if (c == 0) - c = 3; - else if (c == 0x0300) - c = NUL; - else if ((c & 0xff) == 0 - || c == K_NUL - || c == 0x4e2b - || c == 0x4a2d - || c == 0x372a - || ((c & 0xff) == 0xe0 && c != 0xe0)) - { - if (c == K_NUL) - c = 3; - else - c >>= 8; - *buf++ = K_NUL; - ++len; - } - - if (len < maxlen) - { - *buf++ = c; - len++; -#ifdef FEAT_MBYTE - /* Convert from 'termencoding' to 'encoding'. Only - * translate normal characters, not key codes. */ - if (input_conv.vc_type != CONV_NONE - && (len == 1 || buf[-2] != K_NUL)) - len += convert_input(buf - 1, 1, maxlen - len + 1) - 1; -#endif - } - else - nextchar = c; - } - } - else - { - while ((len == 0 || (p_consk ? cons_kbhit() : kbhit())) - && len < maxlen) - { - switch (c = (p_consk ? cons_getch() : getch())) - { - case 0: - /* NUL means that there is another character. - * Get it immediately, because kbhit() doesn't always - * return TRUE for the second character. - */ - if (p_consk) - c = cons_getch(); - else - c = getch(); - tmp_c = translate_altkeys(c << 8); - if (tmp_c == (c << 8)) - { - *buf++ = K_NUL; - ++len; - } - else - c = tmp_c; - break; - case K_NUL: - *buf++ = K_NUL; - ++len; - c = 3; - break; - case 3: - cbrk_pressed = TRUE; - /*FALLTHROUGH*/ - default: - break; - } - if (len < maxlen) - { - *buf++ = c; - ++len; - } - else - nextchar = c; - } - } - } -#ifdef FEAT_MOUSE - show_mouse(FALSE); -#endif - - beep_count = 0; /* may beep again now that we got some chars */ - return len; -} - -/* - * return non-zero if a character is available - */ - int -mch_char_avail(void) -{ - return WaitForChar(0L); -} - -#ifdef DJGPP -# define INT_ARG int -#else -# define INT_ARG -#endif - -/* - * function for ctrl-break interrupt - */ - static void interrupt -#ifdef DJGPP -catch_cbrk(int a) -#else -catch_cbrk(void) -#endif -{ - cbrk_pressed = TRUE; - ctrlc_pressed = TRUE; -} - -#ifndef DJGPP -/* - * ctrl-break handler for DOS. Never called when a ctrl-break is typed, because - * we catch interrupt 1b. If you type ctrl-C while Vim is waiting for a - * character this function is not called. When a ctrl-C is typed while Vim is - * busy this function may be called. By that time a ^C has been displayed on - * the screen, so we have to redisplay the screen. We can't do that here, - * because we may be called by DOS. The redraw is in mch_inchar(). - */ - static int _cdecl -cbrk_handler(void) -{ - delayed_redraw = TRUE; - return 1; /* resume operation after ctrl-break */ -} - -/* - * function for critical error interrupt - * For DOS 1 and 2 return 0 (Ignore). - * For DOS 3 and later return 3 (Fail) - */ - static void interrupt -catch_cint(bp, di, si, ds, es, dx, cx, bx, ax) - unsigned bp, di, si, ds, es, dx, cx, bx, ax; -{ - ax = (ax & 0xff00); /* set AL to 0 */ - if (_osmajor >= 3) - ax |= 3; /* set AL to 3 */ -} -#endif - -/* - * Set the interrupt vectors for use with Vim on or off. - * on == TRUE means as used within Vim - */ - static void -set_interrupts(int on) -{ - static int saved_cbrk; -#ifndef DJGPP - static void interrupt (*old_cint)(); -#endif - static void interrupt (*old_cbrk)(INT_ARG); - - if (on) - { - saved_cbrk = getcbrk(); /* save old ctrl-break setting */ - setcbrk(0); /* do not check for ctrl-break */ -#ifdef DJGPP - old_cbrk = signal(SIGINT, catch_cbrk); /* critical error interrupt */ -#else - old_cint = getvect(0x24); /* save old critical error interrupt */ - setvect(0x24, catch_cint); /* install our critical error interrupt */ - old_cbrk = getvect(0x1B); /* save old ctrl-break interrupt */ - setvect(0x1B, catch_cbrk); /* install our ctrl-break interrupt */ - ctrlbrk(cbrk_handler); /* vim's ctrl-break handler */ -#endif - if (term_console) - out_str(T_ME); /* set colors */ - } - else - { - setcbrk(saved_cbrk); /* restore ctrl-break setting */ -#ifdef DJGPP - signal(SIGINT,old_cbrk); /* critical error interrupt */ -#else - setvect(0x24, old_cint); /* restore critical error interrupt */ - setvect(0x1B, old_cbrk); /* restore ctrl-break interrupt */ -#endif - /* restore ctrl-break handler, how ??? */ - if (term_console) - mynormvideo(); /* restore screen colors */ - } -} - -/* - * We have no job control, fake it by starting a new shell. - */ - void -mch_suspend(void) -{ - suspend_shell(); -} - -extern int _fmode; - -/* - * Prepare window for use by Vim. - */ - void -mch_init(void) -{ - union REGS regs; - -#if defined(DJGPP) && defined(FEAT_CLIPBOARD) - __dpmi_regs dpmi_regs; -#endif - - /* - * Get the video attributes at the cursor. These will be used as the - * default attributes. - */ - regs.h.ah = 0x08; - regs.h.bh = 0x00; /* video page 0 */ - int86(0x10, ®s, ®s); - orig_attr = regs.h.ah; - mynormvideo(); - if (cterm_normal_fg_color == 0) - cterm_normal_fg_color = (orig_attr & 0xf) + 1; - if (cterm_normal_bg_color == 0) - cterm_normal_bg_color = ((orig_attr >> 4) & 0xf) + 1; - - term_console = TRUE; /* assume using the console for the things here */ - _fmode = O_BINARY; /* we do our own CR-LF translation */ - out_flush(); - set_interrupts(TRUE); /* catch interrupts */ - -#ifdef DJGPP - /* - * Use Long File Names by default, if $LFN not set. - */ - if (getenv("LFN") == NULL) - putenv("LFN=y"); - - get_screenbase(); -#endif - -#ifdef FEAT_MOUSE -/* find out if a MS compatible mouse is available */ - regs.x.ax = 0; - (void)int86(0x33, ®s, ®s); - mouse_avail = regs.x.ax; - /* best guess for mouse coordinate computations */ - mch_get_shellsize(); - if (Columns <= 40) - mouse_x_div = 16; - if (Rows == 30) - mouse_y_div = 16; -#endif - - /* - * Try switching to 16 colors for background, instead of 8 colors and - * blinking. Does this always work? Can the old value be restored? - */ - regs.x.ax = 0x1003; - regs.h.bl = 0x00; - regs.h.bh = 0x00; - int86(0x10, ®s, ®s); - - /* - * Test if we have an enhanced AT keyboard. Write 0xFFFF to the keyboard - * buffer and try to read it back. If we can't in 16 tries, it's an old - * type XT keyboard. - */ - regs.h.ah = 0x05; - regs.x.cx = 0xffff; - int86(0x16, ®s, ®s); - if (regs.h.al != 1) /* skip this when keyboard buffer is full */ - { - int i; - - for (i = 0; i < 16; ++i) - { - regs.h.ah = 0x10; - int86(0x16, ®s, ®s); - if (regs.x.ax == 0xffff) - break; - } - if (i == 16) /* 0xffff not read, must be old keyboard */ - { - bioskey_read = 0; - bioskey_ready = 1; - } - } - -#ifdef MCH_CURSOR_SHAPE - /* Save the old cursor shape */ - mch_restore_cursor_shape(FALSE); - /* Initialise the cursor shape */ - mch_update_cursor(); -#endif - -#if defined(DJGPP) && defined(FEAT_CLIPBOARD) - /* - * Check to see if the Windows clipboard is available, ie. are we - * running from a DOS session within Windows. Obviously, the Windows - * clipboard will not be available if we're running under pure DOS. - * - * int 0x2f, AX = 0x1700 identifies the Windows version we're running - * under. Upon return from the interrupt, if AX is unchanged, we're - * running under pure DOS and no Windows clipboard is available. - * - * Remark: could use int86() here but __dpmi_int() is recommended in - * the DJGPP docs, since int86() doesn't cover all available interrupts. - */ - dpmi_regs.x.ax = 0x1700; - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - /* real-mode interrupt failed? */ - dpmi_regs.x.ax = 0x1700; /* force failure */ - - if (dpmi_regs.x.ax == 0x1700) /* no change in AX? */ - clip_init(FALSE); /* no clipboard available, too bad */ - else /* else, running under Windows, OK */ - clip_init(TRUE); /* clipboard is available */ -#endif -} - - int -mch_check_win( - int argc, - char **argv) -{ - /* store argv[0], may be used for $VIM */ - if (*argv[0] != NUL) - exe_name = FullName_save((char_u *)argv[0], FALSE); - - /* - * Try the DOS search path. The executable may in - * fact be called differently, so try this last. - */ - if (exe_name == NULL || *exe_name == NUL) - exe_name = searchpath("vim.exe"); - - if (isatty(1)) - return OK; - return FAIL; -} - -/* - * Return TRUE if the input comes from a terminal, FALSE otherwise. - */ - int -mch_input_isatty(void) -{ - if (isatty(read_cmd_fd)) - return TRUE; - return FALSE; -} - -#if defined(USE_FNAME_CASE) || defined(PROTO) -/* - * fname_case(): Set the case of the file name, if it already exists. - * TODO: should expand short to long file names. Need to use DOS interrupts, - * see DJGPP sources libc/dos/dir/findfirs.c. - */ - void -fname_case(char_u *name, int len) -{ - char_u *tail; - struct ffblk fb; - - slash_adjust(name); - if (findfirst(name, &fb, 0) == 0) - { - tail = gettail(name); - if (len == 0 ? STRLEN(tail) == STRLEN(fb.ff_name) - : (tail - name) + STRLEN(fb.ff_name) < len) - STRCPY(tail, fb.ff_name); - } -} -#endif - -/* - * return process ID - */ - long -mch_get_pid(void) -{ - return (long)0; -} - -/* - * Change default drive (just like _chdrive of Borland C 3.1) - */ - static int -change_drive(int drive) -{ - union REGS regs; - - regs.h.ah = 0x0e; - regs.h.dl = drive - 1; - intdos(®s, ®s); /* set default drive */ - regs.h.ah = 0x19; - intdos(®s, ®s); /* get default drive */ - if (regs.h.al == drive - 1) - return 0; - return -1; -} - -/* - * Get absolute file name into buffer 'buf' of length 'len' bytes. - * All slashes are replaced with backslashes, to avoid trouble when comparing - * file names. When 'shellslash' set do it the other way around. - * - * return FAIL for failure, OK otherwise - */ - int -mch_FullName( - char_u *fname, - char_u *buf, - int len, - int force) -{ - if (!force && mch_isFullName(fname)) /* already expanded */ - { - vim_strncpy(buf, fname, len - 1); - slash_adjust(buf); - return OK; - } - -#ifdef __BORLANDC__ /* Only Borland C++ has this */ - if (_fullpath((char *)buf, (char *)fname, len - 1) == NULL) - return FAIL; - return OK; -#else /* almost the same as mch_FullName() in os_unix.c */ - { -# if 1 - char_u fullpath[MAXPATHL]; - - if (!_truename(fname, fullpath)) - return FAIL; - slash_adjust(fullpath); /* Only needed when 'shellslash' set */ - vim_strncpy(buf, fullpath, len - 1); - return OK; - -# else /* Old code, to be deleted... */ - int l; - char_u olddir[MAXPATHL]; - char_u *p, *q; - int c; - int retval = OK; - - *buf = 0; - /* - * change to the directory for a moment, - * and then do the getwd() (and get back to where we were). - * This will get the correct path name with "../" things. - */ - p = vim_strrchr(fname, '/'); - q = vim_strrchr(fname, '\\'); - if (q != NULL && (p == NULL || q > p)) - p = q; - q = vim_strrchr(fname, ':'); - if (q != NULL && (p == NULL || q > p)) - p = q; - if (p != NULL) - { - if (getcwd(olddir, MAXPATHL) == NULL) - { - p = NULL; /* can't get current dir: don't chdir */ - retval = FAIL; - } - else - { - if (p == fname) /* /fname */ - q = p + 1; /* -> / */ - else if (q + 1 == p) /* ... c:\foo */ - q = p + 1; /* -> c:\ */ - else /* but c:\foo\bar */ - q = p; /* -> c:\foo */ - - c = *q; /* truncate at start of fname */ - *q = NUL; -# ifdef DJGPP - STRCPY(buf, fname); - slash_adjust(buf); /* needed when fname starts with \ */ - if (mch_chdir(buf)) /* change to the directory */ -# else - if (mch_chdir(fname)) /* change to the directory */ -# endif - retval = FAIL; - else - { - fname = q; - if (c == psepc) /* if we cut the name at a */ - fname++; /* '\', don't add it again */ - } - *q = c; - } - } - if (getcwd(buf, len) == NULL) - { - retval = FAIL; - *buf = NUL; - } -# ifdef USE_FNAME_CASE - else - { - char_u *head; - char_u *tail; - struct ffblk fb; - int c; - int added; - - /* Apparently "longna~1" isn't expanded by getcwd(), at least not - * for DJGPP. Expand it here. Have to do each dirname - * separately. */ - slash_adjust(buf); - head = buf; - if (isalpha(*head) && head[1] == ':') - head += 2; /* skip "c:" */ - while (*head != NUL) - { - /* Advance "head" to the start of a dirname and "tail" to just - * after it. */ - while (*head == '/' || *head == '\\') - ++head; - for (tail = head; *tail != NUL; ++tail) - if (*tail == '/' || *tail == '\\') - break; - c = *tail; - *tail = NUL; - - if (findfirst(buf, &fb, FA_DIREC) == 0) - { - added = STRLEN(fb.ff_name); - if ((head - buf) + added + STRLEN(tail + 1) + 2 < len) - { - added -= (tail - head); - if (added != 0) - STRMOVE(tail + 1 + added, tail + 1); - STRCPY(head, fb.ff_name); - tail += added; - } - } - *tail = c; - head = tail; - } - } -# endif - if (p != NULL) - mch_chdir(olddir); - /* - * Concatenate the file name to the path. - */ - if (*fname != NUL) - { - l = STRLEN(buf); - if (l > 0 && buf[l - 1] != '/' && buf[l - 1] != '\\') - strcat(buf, pseps); - strcat(buf, fname); - } - return retval; -# endif - } -#endif -} - -/* - * Replace all slashes by backslashes. - * This used to be the other way around, but MS-DOS sometimes has problems - * with slashes (e.g. in a command name). We can't have mixed slashes and - * backslashes, because comparing file names will not work correctly. The - * commands that use a file name should try to avoid the need to type a - * backslash twice. - * When 'shellslash' set do it the other way around. - */ - void -slash_adjust(char_u *p) -{ -#ifdef OLD_DJGPP /* this seems to have been fixed in DJGPP 2.01 */ - /* DJGPP can't handle a file name that starts with a backslash, and when it - * starts with a slash there should be no backslashes */ - if (*p == '\\' || *p == '/') - while (*p) - { - if (*p == '\\') - *p = '/'; - mb_ptr_adv(p); - } - else -#endif - while (*p) - { - if (*p == psepcN) - *p = psepc; - mb_ptr_adv(p); - } -} - -/* - * Return TRUE if "fname" does not depend on the current directory. - */ - int -mch_isFullName(char_u *fname) -{ - /* A name like "d:/foo" and "//server/share" is absolute */ - return (fname[0] != NUL && fname[1] == ':' - && (fname[2] == '/' || fname[2] == '\\')) - || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\')); -} - - - void -mch_early_init(void) -{ -} - -/* - * Careful: mch_exit() may be called before mch_init()! - */ - void -mch_exit(int r) -{ - settmode(TMODE_COOK); - stoptermcap(); - set_interrupts(FALSE); /* restore interrupts */ -#ifdef DJGPP - set_sys_cursor(); -#endif - /* Somehow outputting CR-NL causes the original colors to be restored */ - out_char('\r'); - out_char('\n'); - out_flush(); - ml_close_all(TRUE); /* remove all memfiles */ -#ifdef MCH_CURSOR_SHAPE - mch_restore_cursor_shape(TRUE); -#endif - exit(r); -} - -/* - * set the tty in (raw) ? "raw" : "cooked" mode - * Does not change the tty, as bioskey() and kbhit() work raw all the time. - */ - void -mch_settmode(int tmode) -{ -} - -#ifdef FEAT_MOUSE - void -mch_setmouse(int on) -{ - mouse_active = on; - mouse_hidden = TRUE; /* don't show it until moved */ -} -#endif - -/* - * set screen mode - * return FAIL for failure, OK otherwise - */ - int -mch_screenmode(char_u *arg) -{ - int mode; - int i; - static char *(names[]) = {"BW40", "C40", "BW80", "C80", "MONO", "C4350"}; - static int modes[] = { BW40, C40, BW80, C80, MONO, C4350}; - - mode = -1; - if (VIM_ISDIGIT(*arg)) /* mode number given */ - mode = atoi((char *)arg); - else - { - for (i = 0; i < sizeof(names) / sizeof(char_u *); ++i) - if (stricmp(names[i], (char *)arg) == 0) - { - mode = modes[i]; - break; - } - } - if (mode == -1) - { - EMSG("E362: Unsupported screen mode"); - return FAIL; - } - textmode(mode); /* use Borland function */ -#ifdef DJGPP - /* base address may have changed */ - get_screenbase(); -#endif - - /* Screen colors may have changed. */ - out_str(T_ME); - -#ifdef FEAT_MOUSE - if (mode <= 1 || mode == 4 || mode == 5 || mode == 13 || mode == 0x13) - mouse_x_div = 16; - else - mouse_x_div = 8; - if (mode == 0x11 || mode == 0x12) - mouse_y_div = 16; - else if (mode == 0x10) - mouse_y_div = 14; - else - mouse_y_div = 8; - shell_resized(); -#endif - return OK; -} - -/* - * Structure used by Turbo-C/Borland-C to store video parameters. - */ -#ifndef DJGPP -extern struct text_info _video; -#endif - -/* - * try to get the real window size - * return FAIL for failure, OK otherwise - */ - int -mch_get_shellsize(void) -{ - struct text_info textinfo; - - /* - * The screenwidth is returned by the BIOS OK. - * The screenheight is in a location in the bios RAM, if the display is - * EGA or VGA. - */ - if (!term_console) - return FAIL; - gettextinfo(&textinfo); - Columns = textinfo.screenwidth; - Rows = textinfo.screenheight; -#ifndef DJGPP - if (textinfo.currmode > 10) - Rows = *(char far *)MK_FP(0x40, 0x84) + 1; -#endif - - if (Columns < MIN_COLUMNS || Rows < MIN_LINES) - { - /* these values are overwritten by termcap size or default */ - Columns = 80; - Rows = 25; - return FAIL; - } -#ifdef DJGPP - mytextinit(&textinfo); /* Added by JML, 1/15/98 */ -#endif - - return OK; -} - -/* - * Set the active window for delline/insline. - */ - static void -set_window(void) -{ - if (term_console) - { -#ifndef DJGPP - _video.screenheight = Rows; -#endif - mywindow(1, 1, Columns, Rows); - } - screen_start(); -} - - void -mch_set_shellsize(void) -{ - /* Should try to set the window size to Rows and Columns. - * May involve switching display mode.... - * We assume the user knows the size and just use it. */ -} - -/* - * Rows and/or Columns has changed. - */ - void -mch_new_shellsize() -{ -#ifdef FEAT_MOUSE - /* best guess for mouse coordinate computations */ - if (Columns <= 40) - mouse_x_div = 16; - if (Rows == 30) - mouse_y_div = 16; -#endif - set_window(); -#ifdef FEAT_MOUSE - mouse_area(); /* set area where mouse can go */ -#endif -} - -#if defined(DJGPP) || defined(PROTO) -/* - * Check the number of Columns with a BIOS call. This avoids a crash of the - * DOS console when 'columns' is set to a too large value. - */ - void -mch_check_columns() -{ - static union REGS regs; - - regs.h.ah = 0x0f; - (void)int86(0x10, ®s, ®s); - if ((unsigned)Columns > (unsigned)regs.h.ah) - Columns = (unsigned)regs.h.ah; -} -#endif - -/* - * call shell, return FAIL for failure, OK otherwise - * options: SHELL_*, see vim.h. - */ - int -mch_call_shell( - char_u *cmd, - int options) -{ - int x; - int tmode = cur_tmode; -#ifndef DJGPP - char_u *newcmd; -#endif - - out_flush(); -#ifdef DJGPP - set_sys_cursor(); -#endif - - if (options & SHELL_COOKED) - settmode(TMODE_COOK); /* set to normal mode */ - set_interrupts(FALSE); /* restore interrupts */ - -#ifdef DJGPP - /* ignore signals while external command is running */ - signal(SIGINT, SIG_IGN); - signal(SIGHUP, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGTERM, SIG_IGN); -#endif - if (cmd == NULL) - x = system((char *)p_sh); - else - { -#ifdef DJGPP - /* - * Use 'shell' for system(). - */ - setenv("SHELL", (char *)p_sh, 1); - x = system(cmd); -#else - /* we use "command" to start the shell, slow but easy */ - newcmd = alloc(STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 3); - if (newcmd == NULL) - x = -1; - else - { - sprintf((char *)newcmd, "%s %s %s", p_sh, p_shcf, cmd); - x = system((char *)newcmd); - vim_free(newcmd); - } -#endif - } -#ifdef DJGPP - signal(SIGINT, SIG_DFL); - signal(SIGHUP, SIG_DFL); - signal(SIGQUIT, SIG_DFL); - signal(SIGTERM, SIG_DFL); -#endif - if (tmode == TMODE_RAW) - settmode(TMODE_RAW); /* set to raw mode */ - set_interrupts(TRUE); /* catch interrupts */ - - if (x && !(options & SHELL_SILENT) && !emsg_silent) - { - MSG_PUTS("\nshell returned "); - msg_outnum((long)x); - msg_putchar('\n'); - } - - return x; -} - -/* - * check for an "interrupt signal": CTRL-break or CTRL-C - */ - void -mch_breakcheck(void) -{ - if (ctrlc_pressed) - { - ctrlc_pressed = FALSE; - got_int = TRUE; - } -} - -/* - * Return TRUE if "p" contain a wildcard that can be expanded by - * dos_expandpath(). - */ - int -mch_has_exp_wildcard(char_u *p) -{ - for ( ; *p; mb_ptr_adv(p)) - { - if (vim_strchr((char_u *)"?*[", *p) != NULL - || (*p == '~' && p[1] != NUL)) - return TRUE; - } - return FALSE; -} - -/* - * Return TRUE if "p" contain a wildcard or a "~1" kind of thing (could be a - * shortened file name). - */ - int -mch_has_wildcard(char_u *p) -{ - for ( ; *p; mb_ptr_adv(p)) - { - if (vim_strchr((char_u *) -# ifdef VIM_BACKTICK - "?*$[`" -# else - "?*$[" -# endif - , *p) != NULL - || (*p == '~' && p[1] != NUL)) - return TRUE; - } - return FALSE; -} - -/* - * Change directory to "path". - * The normal chdir() does not change the default drive. This one does. - * Return 0 for success, -1 for failure. - */ - int -mch_chdir(char *path) -{ - if (path[0] == NUL) /* just checking... */ - return 0; - if (p_verbose >= 5) - { - verbose_enter(); - smsg((char_u *)"chdir(%s)", path); - verbose_leave(); - } - if (path[1] == ':') /* has a drive name */ - { - if (change_drive(TOLOWER_ASC(path[0]) - 'a' + 1)) - return -1; /* invalid drive name */ - path += 2; - } - if (*path == NUL) /* drive name only */ - return 0; - return chdir(path); /* let the normal chdir() do the rest */ -} - -#ifdef DJGPP -/* - * mch_rename() works around a bug in rename (aka MoveFile) in - * Windows 95: rename("foo.bar", "foo.bar~") will generate a - * file whose short file name is "FOO.BAR" (its long file name will - * be correct: "foo.bar~"). Because a file can be accessed by - * either its SFN or its LFN, "foo.bar" has effectively been - * renamed to "foo.bar", which is not at all what was wanted. This - * seems to happen only when renaming files with three-character - * extensions by appending a suffix that does not include ".". - * Windows NT gets it right, however, with an SFN of "FOO~1.BAR". - * This works like mch_rename in os_win32.c, but is a bit simpler. - * - * Like rename(), returns 0 upon success, non-zero upon failure. - * Should probably set errno appropriately when errors occur. - */ - - int -mch_rename(const char *OldFile, const char *NewFile) -{ - char_u *TempFile; - int retval; - int fd; - - /* rename() works correctly without long file names, so use that */ - if (!_USE_LFN) - return rename(OldFile, NewFile); - - if ((TempFile = alloc((unsigned)(STRLEN(OldFile) + 13))) == NULL) - return -1; - - STRCPY(TempFile, OldFile); - STRCPY(gettail(TempFile), "axlqwqhy.ba~"); - if (rename(OldFile, TempFile)) - retval = -1; - else - { - /* now create an empty file called OldFile; this prevents - * the operating system using OldFile as an alias (SFN) - * if we're renaming within the same directory. For example, - * we're editing a file called filename.asc.txt by its SFN, - * filena~1.txt. If we rename filena~1.txt to filena~1.txt~ - * (i.e., we're making a backup while writing it), the SFN - * for filena~1.txt~ will be filena~1.txt, by default, which - * will cause all sorts of problems later in buf_write(). So, we - * create an empty file called filena~1.txt and the system will have - * to find some other SFN for filena~1.txt~, such as filena~2.txt - */ - if ((fd = open(OldFile, O_RDWR|O_CREAT|O_EXCL, 0444)) < 0) - return -1; - retval = rename(TempFile, NewFile); - close(fd); - mch_remove((char_u *)OldFile); - - /* If renaming to NewFile failed, rename TempFile back to OldFile, so - * that it looks like nothing happened. */ - if (retval) - rename(TempFile, OldFile); - } - vim_free(TempFile); - - return retval; /* success */ -} -#endif - -#if defined(DJGPP) || defined(PROTO) -/* - * setlocale() for DJGPP with MS-DOS codepage support - * Author: Cyril Slobin <slobin@fe.msk.ru> - * - * Scaled down a lot for use by Vim: Only support setlocale(LC_ALL, ""). - */ - -#undef setlocale - -#ifndef PROTO -# include <go32.h> -# include <inlines/ctype.ha> -#endif -#include <locale.h> - -#define UPCASE (__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER) -#define LOCASE (__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISLOWER) - - char * -djgpp_setlocale(void) -{ - __dpmi_regs regs; - struct { char id; unsigned short off, seg; } __attribute__ ((packed)) info; - unsigned char buffer[0x82], lower, upper; - int i; - - regs.x.ax = 0x6502; - regs.x.bx = 0xffff; - regs.x.dx = 0xffff; - regs.x.cx = 5; - regs.x.es = __tb >> 4; - regs.x.di = __tb & 0xf; - - __dpmi_int(0x21, ®s); - - if (regs.x.flags & 1) - return NULL; - - dosmemget(__tb, 5, &info); - dosmemget((info.seg << 4) + info.off, 0x82, buffer); - - if (*(short *)buffer != 0x80) - return NULL; - - /* Fix problem of underscores being replaced with y-umlaut. (Levin) */ - if (buffer[26] == 0x5f) - buffer[26] = 0x98; - - for (i = 0; i < 0x80; i++) - { - lower = i + 0x80; - upper = (buffer+2)[i]; - if (lower != upper) - { - __dj_ctype_flags[lower+1] = LOCASE; - __dj_ctype_toupper[lower+1] = upper; - if (__dj_ctype_flags[upper+1] == 0) - __dj_ctype_flags[upper+1] = UPCASE; - if (__dj_ctype_tolower[upper+1] == upper) - __dj_ctype_tolower[upper+1] = lower; - } - } - - return "C"; -} - -#if defined(FEAT_CLIPBOARD) || defined(PROTO) - -/* - * Clipboard stuff, for cutting and pasting text to other windows. - * - * Implementation of DOS/Windows clipboard data transfer - * by David Kotchan (dkotchan@sympatico.ca) - */ - -#define CF_TEXT 0x01 /* Windows clipboard format: Windows (ANSI) text */ -#define CF_OEMTEXT 0x07 /* Windows clipboard format: OEM (DOS) text */ -#define CF_VIMCLIP 0x04 /* trick: SYLK clipboard format for VimClipboard */ - -static int Win16OpenClipboard(void); -static int Win16CloseClipboard(void); -static int Win16EmptyClipboard(void); -static char_u *Win16GetClipboardData(int clip_data_format); -static int Win16SetClipboardData(int clip_data_format, char_u *clip_data, int clip_data_size, int clip_data_type); - -/* - * Make vim the owner of the current selection. Return OK upon success. - */ - int -clip_mch_own_selection(VimClipboard *cbd) -{ - /* - * Never actually own the clipboard. If another application sets the - * clipboard, we don't want to think that we still own it. - */ - return FAIL; -} - -/* - * Make vim NOT the owner of the current selection. - */ - void -clip_mch_lose_selection(VimClipboard *cbd) -{ - /* Nothing needs to be done here */ -} - -/* - * Read the Windows clipboard text and put it in Vim's clipboard register. - */ - void -clip_mch_request_selection(VimClipboard *cbd) -{ - int type = MAUTO; - char_u *pAllocated = NULL; - char_u *pClipText = NULL; - int clip_data_format = 0; - - if (Win16OpenClipboard()) - { - /* Check for Vim's own clipboard format first. The CF_VIMCLIP format - * is just ordinary text (like CF_TEXT) except prepended by the - * selection type (as a single character). Note that under DOS we - * actually cannot define a custom CF_VIMCLIP clipboard format; we - * use instead one of the existing Windows-defined formats, usually - * "DIF" or "SYLK". See Win16GetClipboardData() for details. - * - * Note that Win16GetClipboardData() returns the address of the memory - * block it allocated. This is not necessary the start of the - * clipboard text data: there may be other bytes ahead of the - * text (particularly for CF_VIMCLIP) which are used for data - * management. So pClipText is not necessarily == pAllocated. - */ - - if ((pAllocated = Win16GetClipboardData(CF_VIMCLIP)) != NULL) - { - clip_data_format = CF_VIMCLIP; - pClipText = pAllocated; - - switch (*pClipText++) /* after ++, pClipText points to text */ - { - default: - case 'L': type = MLINE; break; - case 'C': type = MCHAR; break; - case 'B': type = MBLOCK; break; - } - } - - /* Otherwise, check for the normal Windows text formats. There are - * two of these: CF_TEXT (common) and CF_OEMTEXT (used for DOS - * compatibility). Experiments show that, under the DOS/Windows - * clipboard interface, writing CF_TEXT data to the clipboard - * automatically creates a CF_OEMTEXT format as well. - */ - - else if ((pAllocated = Win16GetClipboardData(CF_TEXT)) != NULL) - { - clip_data_format = CF_TEXT; - pClipText = pAllocated; - } - - else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL) - { - clip_data_format = CF_OEMTEXT; - pClipText = pAllocated; - } - - /* Did we get anything? */ - - if (pClipText != NULL) - { - char_u *pDest; - char_u *pStart; - char_u *pEnd; - - long_u clip_data_size = 0; - - /* The Windows clipboard normally stores its text lines terminated - * by <CR><NL>. But Vim uses only <NL>, so translate the <CR><NL> - * into <NL>. Also, watch for possible null bytes at the end of - * pClipText. These are padding added by "get_clipboard_data" - * (int 0x2f, AX= 0x1705) in order to round the data size up to the - * next multiple of 32 bytes. See Win16GetClipboardData() for - * details. - */ - - pDest = strstr( pClipText, "\r\n" ); /* find first <CR><NL> */ - - if (pDest != NULL) /* found one? */ - { - pStart = pDest + 1; /* points to <NL> after <CR> */ - pEnd = strstr( pStart, "\r\n" );/* find next <CR><NL> */ - - while (pEnd != NULL) /* found one? */ - { - memmove(pDest, pStart, (long)(pEnd - pStart)); - /* exclude <CR> */ - pDest += (long)(pEnd - pStart); /* new destination */ - pStart = pEnd + 1; /* new starting point */ - pEnd = strstr(pStart, "\r\n"); /* find next <CR><NL> */ - } - - /* Fell out of while() loop: no more <CR><NL> pairs. Just copy - * the rest of the data, up to the first null byte. */ - pEnd = strchr(pStart, '\0'); /* find first null */ - - memmove(pDest, pStart, (long)(pEnd - pStart)); /* exclude nul */ - pDest += (long)(pEnd - pStart); - *pDest = '\0'; /* terminate */ - - /* Now that all <CR><NL> pairs have been "compressed" into just - * <NL>'s, determine the true text length. */ - clip_data_size = (long_u)(pDest - pClipText); - } - else - { - /* no <CR><NL> pairs at all */ - /* Since the data may have been padded with trailing nulls, - * determine the true string length. */ - clip_data_size = STRLEN(pClipText); /* true data length */ - } - - /* Copy the cleaned-up data over to Vim's clipboard "*" register. */ - clip_yank_selection(type, pClipText, clip_data_size, cbd); - - /* Free the memory that Win16GetClipboardData() allocated. */ - vim_free(pAllocated); - } - - Win16CloseClipboard(); - - } // end if (Win16OpenClipboard()) -} - -/* - * Send the currently selected Vim text to the Windows clipboard. - */ - void -clip_mch_set_selection( VimClipboard *cbd ) -{ - char_u *pClipData = NULL; - long_u clip_data_size; - int clip_data_type; - - /* If the '*' register isn't already filled in, fill it in now. */ - cbd->owned = TRUE; - clip_get_selection(cbd); - cbd->owned = FALSE; - - /* - * clip_convert_selection() returns a pointer to a buffer containing - * the text to send to the Windows clipboard, together with a count - * of the number of characters (bytes) in the buffer. The function's - * return value is the 'type' of selection: MLINE, MCHAR, or MBLOCK; - * or -1 for failure. - */ - clip_data_type = clip_convert_selection(&pClipData, &clip_data_size, cbd); - - if (clip_data_type < 0) /* could not convert? */ - return; /* early exit */ - - if (Win16OpenClipboard()) - { - if (Win16EmptyClipboard()) - { - int sentOK; - - sentOK = Win16SetClipboardData(CF_TEXT, pClipData, - clip_data_size, clip_data_type); - sentOK = Win16SetClipboardData(CF_VIMCLIP, - pClipData, clip_data_size, clip_data_type) && sentOK; - - if (!sentOK) - { - /* one or both of Win16SetClipboardData() failed. */ - /* Technically we don't know why Win16SetClipboardData() - * failed, but almost always it will be because there wasn't - * enough DOS memory to buffer the data, so report that as the - * problem. - * - * We report the error here (instead of in - * Win16SetClipboardData()) because we don't want the error - * reported twice. - */ - EMSG("E450: Selection too large, cannot allocate DOS buffer"); - } - } - - Win16CloseClipboard(); - } - - /* release memory allocated by clip_convert_selection() */ - vim_free(pClipData); - - return; -} - -/* - * Win16OpenClipboard: open the Windows clipboard. The clipboard must be open - * before it can be communicated with at all. Return TRUE on success, - * FALSE on failure. - */ - static int -Win16OpenClipboard(void) -{ - __dpmi_regs dpmi_regs; - - long start_time; - int tick_count; - - /* int 0x2f, AX = 0x1701 attempts to open the Windows clipboard. Upon - * return from the interrupt, if AX is non-zero, the clipboard was - * successfully opened. If AX is zero, the clipboard could not be opened - * because it is currently in use by another process. - * - * Remark: other DOS programs I (dk) have written that use the Windows - * clipboard sometimes encounter the problem that the clipboard cannot - * be opened even though it is demonstrably not in use by any other - * process. In all cases, repeated attempts to open the clipboard - * eventually succeed, but the initial attempt occasionally fails. - * - * The problem is intermittent and appears to be related to DOS being - * "busy" at certain unpredictable times. DOS maintains two internal - * flags that indicate whether it's busy: InDOS and CritErr. The - * location of InDOS can be found by calling int 0x21, AH = 0x34. The - * location of CritErr can be found by calling int 0x21, AX = 0x5d06. - * If either of these flags is set, DOS is "busy" and cannot be - * interrupted. See "Undocumented DOS" by Schulman et al for details. - * - * However here I take the easier approach that if the first call to open - * the clipboard does not succeed, just try again. In fact, try once per - * biostime() clock tick, up to 18 times (about one second). - */ - - tick_count = 0; - - dpmi_regs.x.ax = 0x1701; /* open Windows clipboard */ - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - return FALSE; /* FALSE --> clipboard not open */ - } - - /* wait up to one second */ - while (dpmi_regs.x.ax == 0 && tick_count++ < 18) - { - /* Wait one clock tick (18.2 ticks/sec = 55 msec per tick). - * - * We busy-wait here. Unfortunately, delay() and usleep() have been - * reported to give problems with the original Windows 95. This is - * fixed in service pack 1, but not everybody installed that. - */ - start_time = biostime(0, 0L); - while (biostime(0, 0L) == start_time) - ; - - dpmi_regs.x.ax = 0x1701; /* open Windows clipboard */ - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - return FALSE; /* FALSE --> clipboard not open */ - } - } - - /* Couldn't open the clipboard, even after 18 attempts? */ - - if (tick_count >= 18 && dpmi_regs.x.ax == 0) - return FALSE; /* FALSE --> clipboard not open */ - - return TRUE; /* TRUE --> clipboard opened successfully, OK */ -} - -/* - * Win16CloseClipboard: close the Windows clipboard. Return TRUE on - * success, FALSE on failure. This function can always be called, - * whether the clipboard is open or not. - */ - static int -Win16CloseClipboard(void) -{ - __dpmi_regs dpmi_regs; - - /* Close the clipboard. This interrupt can always be called, even - * if the clipboard is already closed. - */ - - dpmi_regs.x.ax = 0x1708; /* close the clipboard */ - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - return FALSE; /* FALSE --> clipboard could not be closed */ - } - - return TRUE; /* TRUE --> clipboard closed successfully, OK */ -} - -/* - * Win16EmptyClipboard: empty the (previously opened) Windows clipboard. - * Return TRUE on success, FALSE on failure. - */ - static int -Win16EmptyClipboard(void) -{ - __dpmi_regs dpmi_regs; - - /* int 0x2f, AX = 0x1702 attempts to empty the Windows clipboard. Upon - * return from the interrupt, if AX == 0, the clipboard could not be - * emptied (for some reason). - */ - dpmi_regs.x.ax = 0x1702; /* empty the Windows clipboard */ - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - return FALSE; /* FALSE --> clipboard could not be emptied */ - } - - /* Did we succeed in clearing the clipboard? */ - if (dpmi_regs.x.ax == 0) - return FALSE; /* FALSE --> clipboard could not be emptied */ - - return TRUE; /* TRUE --> clipboard was emptied, OK */ -} - -/* - * FreeDOSMemory: a helper function to free memory previously - * allocated by a call to __dpmi_allocate_dos_memory(). - */ - static void -FreeDOSMemory(int protected_mode_selector) -{ - /* Free the DOS buffer and release the DPMI prot-mode selector. - * - * It's important that DOS memory be properly released because - * there's only a limited amount of it. Therefore, if the call - * to __dpmi_free_dos_memory() fails, emit an error message - * unconditionally. - */ - if (__dpmi_free_dos_memory(protected_mode_selector) == -1) - EMSG("E451: could not free DOS memory buffer (DJGPP)"); -} - -/* - * Win16GetClipboardData: query the Windows clipboard as to whether data - * is available in a particular clipboard format. If data is - * available, allocate a buffer for it and read the data from the - * clipboard into the buffer. Return a pointer to the buffer. If - * no data is available in the requested format, return NULL. - * - * This routine allocates memory to hold the retrieved clipboard - * data. It's the caller's responsibility to free this memory - * once it's finished using it. The memory should be freed by - * calling vim_free(). - */ - static char_u * -Win16GetClipboardData(int clip_data_format) -{ - __dpmi_regs dpmi_regs; - - int real_mode_segment_address; - int protected_mode_selector; - - char_u *clip_data_buffer; - long_u clip_data_size; - - /* We only handle clipboard formats we recognize, others are ignored. - * - * It's not possible to create a custom clipboard format for VimClipboard - * data under DOS, so one of the predefined Windows formats had to be - * used for CF_VIMCLIP. Two obscure formats, popular when Windows 3.0 - * came out but no longer in much use today, are the DIF and SYLK formats. - * DIF is the Data Interchange Format, SYLK is the Symbolic Link format. - * They are both text formats and either one can be hijacked for use as - * "the VimClipboard format". Of course, this conflicts with anyone who - * still *is* using DIF or SYLK data formats, but that will be very few - * people. - * - * I (dk) chose SYLK as the more obscure format because it was used - * mostly for Microsoft Multiplan (the pre-cursor to Excel) and it's not - * likely Multiplan is used anywhere much anymore. Mind you, Excel can - * still export to both DIF and SYLK formats. - */ - - switch (clip_data_format) - { - case CF_VIMCLIP: /* Vim's own special clipboard format */ - case CF_TEXT: /* Windows text */ - case CF_OEMTEXT: /* DOS (OEM) text */ - - /* int 0x2f, AX = 0x1704 returns the number of bytes of data currently - * on the Windows clipboard, for the specified format. Upon return - * from the interrupt, DX:AX = the number of bytes, rounded up to the - * nearest multiple of 32. - */ - - dpmi_regs.x.ax = 0x1704; /* get size of clipbd data */ - dpmi_regs.x.dx = clip_data_format; - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - return NULL; /* early exit */ - } - - /* Did we get anything? If not, this is not an error. */ - if (dpmi_regs.x.dx == 0 && dpmi_regs.x.ax == 0) - { - /* no CF_VIMCLIP data? */ - return NULL; /* early exit */ - } - - /* There is data available in the requested clipboard format. - * - * Calculate data size. Remember this is rounded up to the nearest - * multiple of 32, so clip_data_size is actually an upper limit. - * The extra bytes, if any, are set to null (0x00) when the data is - * read from the clipboard. (Later:) actually I'm no longer sure - * this is strictly true: the end-of-data is marked by a null, but - * the extra bytes appear to sometimes be null, sometimes not. - * They may just be garbage. - */ - clip_data_size = dpmi_regs.x.ax + (dpmi_regs.x.dx << 16); - - /* Allocate memory to retrieve the data. The buffer has to lie in the - * DOS memory region (in the first 1 MByte of address space) because - * the Windows clipboard interface expects a 16-bit segment:offset - * pointer to a buffer address within the DOS region. Must therefore - * use __dpmi_allocate_dos_memory() instead of lalloc() or alloc(). - */ - real_mode_segment_address = __dpmi_allocate_dos_memory( - (clip_data_size + 15) >> 4, /* buffer size, in 16-byte paragraphs */ - &protected_mode_selector); /* prot-mode selector for the address */ - - if (real_mode_segment_address == -1) - { - /* memory allocation failed. */ - - /* Technically we don't know why the allocation failed, but - * almost always it will be because there wasn't enough DOS - * memory to satisfy the request, so report that as the problem. - * On my system, DJGPP is able to satisfy a DOS allocation request - * up to about 600K in size. This depends on your HIMEM.SYS and - * EMM386.EXE settings however. - */ - EMSG("E452: Clipboard data too large, cannot allocate DOS buffer"); - return NULL; /* early exit */ - } - - /* Copy data from the clipboard into the buffer. Experiments show that - * the Windows clipboard is smart enough to handle data transfers - * larger than 64K properly, even though the buffer address is a 16-bit - * segment:offset (which would normally limit the block size to 64K - * unless ES gets incremented). - */ - dpmi_regs.x.ax = 0x1705; /* get clipboard data */ - dpmi_regs.x.dx = clip_data_format; /* CF_VIMCLIP */ - dpmi_regs.x.es = real_mode_segment_address; /* buffer ad: segment */ - dpmi_regs.x.bx = 0; /* buffer ad: offset */ - if (__dpmi_int( 0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed? */ - EMSG("E453: could not copy clipboard data to DOS buffer"); - FreeDOSMemory(protected_mode_selector); /* clean up DOS mem */ - return NULL; /* early exit */ - } - - /* Clipboard data is now in DOS memory in the buffer pointed to by - * ES:BX. Copy this into ordinary memory that Vim can access (ie. - * prot-mode memory). Allocate one extra byte to ensure the text - * is terminated properly (in case it was somehow corrupted). - */ - clip_data_buffer = (char_u *)lalloc(clip_data_size + 1, TRUE); - - if (clip_data_buffer == NULL) - { - /* allocation failed? */ - EMSG("E454: could not allocate clipboard memory buffer"); - FreeDOSMemory(protected_mode_selector); /* clean up DOS mem */ - return NULL; /* early exit */ - } - - *(clip_data_buffer + clip_data_size) = '\0'; /* ensure terminated */ - - /* Copy the data from DOS memory to Vim-accessible memory. */ - movedata( /* DJGPP version of memcpy() */ - protected_mode_selector, 0, /* source: DOS ad (via selector) */ - _my_ds(), (unsigned)clip_data_buffer, - /* target: normal mem address */ - clip_data_size); /* how many bytes */ - - /* Free the DOS buffer and release the DPMI prot-mode selector. */ - FreeDOSMemory(protected_mode_selector); /* clean up DOS memory */ - - return clip_data_buffer; /* return pointer to allocated buffer */ - - default: /* unknown clipboard format */ - return NULL; - } -} - -/* - * Win16SetClipboardData: send 'clip_data_size' bytes of data from the buffer - * pointed to by 'clip_data', to the Windows clipboard. The data is - * registered with the clipboard as being in the 'clip_data_format' - * format. - */ - static int -Win16SetClipboardData( - int clip_data_format, - char_u *clip_data, - int clip_data_size, - int clip_data_type) -{ - __dpmi_regs dpmi_regs; - - int real_mode_segment_address; - int protected_mode_selector; - long_u protected_mode_offset = 0L; - int total_size = clip_data_size; - - char_u *clip_sel_type; - - /* If we're using the CF_VIMCLIP custom format, allocate an extra - * byte for clip_sel_type, which is a character indicating the type - * of text selection: MLINE, MCHAR, or MBLOCK. - */ - if (clip_data_format == CF_VIMCLIP) - total_size++; /* extra byte for marker */ - - /* Data cannot be sent directly from a Vim string (pClipData) to - * the Windows clipboard, because the Windows clipboard interface - * expects a 16-bit (DOS) segment:offset address for the source - * buffer. Therefore we must create a "transfer buffer" in the DOS - * memory region (in the first 1 MByte of address space) and copy - * the Vim string into that. From there, the data can then be sent - * to the Windows clipboard. - * - * To allocate DOS memory, we must use __dpmi_allocate_dos_memory() - * instead of lalloc() or alloc(). If the allocation fails, it will - * almost invariably be because there is not enough DOS memory - * available to accommodate the size of clip_data. There is nothing - * we can do about this, we simply have to fail. - */ - real_mode_segment_address = __dpmi_allocate_dos_memory( - (total_size + 15) >> 4, /* buffer size, in 16-byte paragraphs */ - &protected_mode_selector); /* prot-mode selector for the address */ - - if (real_mode_segment_address == -1) - { - /* memory allocation failed. */ - /* Technically we don't know why the allocation failed, but - * almost always it will be because there wasn't enough DOS - * memory to satisfy the request. On my system, DJGPP is able - * to satisfy a DOS allocation request up to about 600K in size. - * This depends however on HIMEM.SYS and EMM386.EXE settings. - */ - return FALSE; /* early exit */ - } - - /* Copy data from Vim's buffer (clip_data) into the DOS transfer buffer. - * This can be larger than 64K; movedata() takes care of crossing any - * 16-bit segment boundaries. - * - * If we're using Vim's custom clipboard format, we must copy one extra - * byte to indicate the type of selection: line, character, or block. - */ - if (clip_data_format == CF_VIMCLIP) - { - switch (clip_data_type) - { - default: - case MLINE: clip_sel_type = "L"; break; - case MCHAR: clip_sel_type = "C"; break; - case MBLOCK: clip_sel_type = "B"; break; - } - - movedata( - _my_ds(), (unsigned)clip_sel_type, - /* source: normal memory address */ - protected_mode_selector, 0, /* target: DOS ad (via selector) */ - 1); /* how many bytes to copy */ - - protected_mode_offset += STRLEN(clip_sel_type); /* allow for marker */ - } - - movedata( - _my_ds(), (unsigned)clip_data, /* source: normal memory address */ - protected_mode_selector, /* target: DOS address (via selector) */ - protected_mode_offset, /* non-zero, if using clip_sel_type */ - clip_data_size); /* how many bytes to copy */ - - /* Send data from the DOS transfer buffer to the Windows clipboard. - * int 0x2f, AX = 0x1703 sends SI:CX bytes of data from the buffer - * at ES:BX, to the clipboard. - */ - dpmi_regs.x.ax = 0x1703; /* send clipboard data */ - dpmi_regs.x.dx = clip_data_format; /* flag: format of the data */ - dpmi_regs.x.si = ((total_size >> 16) - & 0x0000ffffL); /* hi word of data size */ - dpmi_regs.x.cx = (total_size & 0x0000ffffL); - /* lo word of data size */ - dpmi_regs.x.es = real_mode_segment_address; /* buffer address: segment */ - dpmi_regs.x.bx = 0; /* buffer address: offset */ - if (__dpmi_int(0x2f, &dpmi_regs) == -1) - { - /* real-mode interrupt failed. */ - FreeDOSMemory(protected_mode_selector); /* clean up DOS memory */ - return FALSE; /* early exit */ - } - - /* Free the DOS buffer and release the DPMI prot-mode selector. */ - FreeDOSMemory(protected_mode_selector); /* clean up DOS memory */ - - return TRUE; /* TRUE --> data successfully sent to clipboard */ -} - -#endif /* FEAT_CLIPBOARD */ -#endif /* DJGPP */ - -/* - * End of MS-DOS only code - */ -#endif /* WIN16 */ - -/* common MS-DOS and Win16 code follows */ - - static int -vim_chmod(char_u *name) -{ - char_u *p; - int f; - int c = 0; - - /* chmod() can't handle a file name with a trailing slash, remove it. - * But don't remove it for "/" or "c:/". */ - p = name + STRLEN(name); - if (p > name) - --p; - if (p > name && (*p == '\\' || *p == '/') && p[-1] != ':') - { - c = *p; /* remove trailing (back)slash */ - *p = NUL; - } - else - p = NULL; -#if defined(__BORLANDC__) && (__BORLANDC__ > 0x410) - /* this also sets the archive bit, supported by Borland C 4.0 and later, - * where __BORLANDC__ is 0x450 (3.1 is 0x410) */ - f = _rtl_chmod((char *)name, 0, 0); -#else - f = _chmod((char *)name, 0, 0); -#endif - if (p != NULL) - *p = c; /* put back (back)slash */ - return f; -} - -/* - * get file permissions for 'name' - * Returns -1 for error. - * Returns FA_attributes defined in dos.h - */ - long -mch_getperm(char_u *name) -{ - return (long)vim_chmod(name); /* get file mode */ -} - -/* - * set file permission for 'name' to 'perm' - * - * return FAIL for failure, OK otherwise - */ - int -mch_setperm( - char_u *name, - long perm) -{ - perm |= FA_ARCH; /* file has changed, set archive bit */ -#if defined(__BORLANDC__) && (__BORLANDC__ > 0x410) - return (_rtl_chmod((char *)name, 1, (int)perm) == -1 ? FAIL : OK); -#else - return (_chmod((char *)name, 1, (int)perm) == -1 ? FAIL : OK); -#endif -} - -/* - * Set hidden flag for "name". - */ - void -mch_hide(char_u *name) -{ - /* DOS 6.2 share.exe causes "seek error on file write" errors when making - * the swap file hidden. Thus don't do it. */ -} - -/* - * return TRUE if "name" is a directory - * return FALSE if "name" is not a directory - * return FALSE for error - * - * beware of a trailing (back)slash - */ - int -mch_isdir(char_u *name) -{ - int f; - - f = vim_chmod(name); - if (f == -1) - return FALSE; /* file does not exist at all */ - if ((f & FA_DIREC) == 0) - return FALSE; /* not a directory */ - return TRUE; -} - -/* - * Return 1 if "name" can be executed, 0 if not. - * Return -1 if unknown. - */ - int -mch_can_exe(name, path) - char_u *name; - char_u **path; -{ - char *p; - - p = searchpath(name); - if (p == NULL || mch_isdir(p)) - return FALSE; - if (path != NULL) - *path = vim_strsave(p); - return TRUE; -} - -/* - * Check what "name" is: - * NODE_NORMAL: file or directory (or doesn't exist) - * NODE_WRITABLE: writable device, socket, fifo, etc. - * NODE_OTHER: non-writable things - */ - int -mch_nodetype(char_u *name) -{ - if (STRICMP(name, "AUX") == 0 - || STRICMP(name, "CON") == 0 - || STRICMP(name, "CLOCK$") == 0 - || STRICMP(name, "NUL") == 0 - || STRICMP(name, "PRN") == 0 - || ((STRNICMP(name, "COM", 3) == 0 - || STRNICMP(name, "LPT", 3) == 0) - && VIM_ISDIGIT(name[3]) - && name[4] == NUL)) - return NODE_WRITABLE; - /* TODO: NODE_OTHER? */ - return NODE_NORMAL; -} - -/* - * Get name of current directory into buffer 'buf' of length 'len' bytes. - * Return OK for success, FAIL for failure. - */ - int -mch_dirname( - char_u *buf, - int len) -{ -#ifdef DJGPP - if (getcwd((char *)buf, len) == NULL) - return FAIL; - /* turn the '/'s returned by DJGPP into '\'s */ - slash_adjust(buf); - return OK; -#else - return (getcwd((char *)buf, len) != NULL ? OK : FAIL); -#endif -} - -/* - * this version of remove is not scared by a readonly (backup) file - * - * returns -1 on error, 0 otherwise (just like remove()) - */ - int -mch_remove(char_u *name) -{ - (void)mch_setperm(name, 0); /* default permissions */ - return unlink((char *)name); -} - -/* - * Special version of getenv(): Use uppercase name. - */ - char_u * -mch_getenv(char_u *name) -{ - int i; -#define MAXENVLEN 50 - char_u var_copy[MAXENVLEN + 1]; - char_u *p; - char_u *res; - - /* - * Take a copy of the argument, and force it to upper case before passing - * to getenv(). On DOS systems, getenv() doesn't like lower-case argument - * (unlike Win32 et al.) If the name is too long to fit in var_copy[] - * allocate memory. - */ - if ((i = STRLEN(name)) > MAXENVLEN) - p = alloc(i + 1); - else - p = var_copy; - if (p == NULL) - p = name; /* out of memory, fall back to unmodified name */ - else - { - for (i = 0; name[i] != NUL; ++i) - p[i] = toupper(name[i]); - p[i] = NUL; - } - - res = (char_u *)getenv((char *)p); - - if (p != var_copy && p != name) - vim_free(p); - - return res; -} - -/* - * Insert user name in s[len]. - */ - int -mch_get_user_name( - char_u *s, - int len) -{ - *s = NUL; - return FAIL; -} - -/* - * Insert host name is s[len]. - */ - void -mch_get_host_name( - char_u *s, - int len) -{ -#ifdef DJGPP - vim_strncpy(s, "PC (32 bits Vim)", len - 1); -#else - vim_strncpy(s, "PC (16 bits Vim)", len - 1); -#endif -} diff --git a/src/os_msdos.h b/src/os_msdos.h deleted file mode 100644 index 735410fa0b..0000000000 --- a/src/os_msdos.h +++ /dev/null @@ -1,110 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -/* - * MSDOS Machine-dependent things. - */ - -#include "os_dos.h" /* common MS-DOS and Win32 stuff */ - -#define BINARY_FILE_IO -#define USE_EXE_NAME /* use argv[0] for $VIM */ -#define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */ -#define USE_TERM_CONSOLE -#ifdef DJGPP -# include <fcntl.h> /* defines _USE_LFN */ -# define USE_LONG_FNAME _USE_LFN /* decide at run time */ -# define USE_FNAME_CASE -# define HAVE_PUTENV -# define HAVE_STDARG_H -#else -# define SHORT_FNAME /* always 8.3 file name */ -#endif -#define HAVE_STDLIB_H -#define HAVE_STRING_H -#define HAVE_FCNTL_H -#define HAVE_STRCSPN -#define HAVE_STRICMP -#define HAVE_STRFTIME /* guessed */ -#define HAVE_STRNICMP -#define HAVE_MEMSET -#define HAVE_QSORT -#define HAVE_ST_MODE /* have stat.st_mode */ -#define HAVE_MATH_H -#if defined(__DATE__) && defined(__TIME__) -# define HAVE_DATE_TIME -#endif -#define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */ -#define HAVE_AVAIL_MEM - -/* - * Borland C++ 3.1 doesn't have _RTLENTRYF - */ -#ifdef __BORLANDC__ -# if __BORLANDC__ < 0x450 -# define _RTLENTRYF -# endif -#endif - -#define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ - -/* cproto fails on missing include files */ -#ifndef PROTO -# include <dos.h> -# include <dir.h> -# include <time.h> -#endif - -#ifdef DJGPP -# include <unistd.h> -# define HAVE_LOCALE_H -# define setlocale(c, p) djgpp_setlocale() -#endif - -#ifndef DJGPP -typedef long off_t; -#endif - -/* - * Try several directories to put the temp files. - */ -#define TEMPDIRNAMES "$TMP", "$TEMP", "c:\\TMP", "c:\\TEMP", "" -#define TEMPNAMELEN 128 - -#ifndef DFLT_MAXMEM -# define DFLT_MAXMEM 256 /* use up to 256Kbyte for buffer */ -#endif -#ifndef DFLT_MAXMEMTOT -# define DFLT_MAXMEMTOT 0 /* decide in set_init */ -#endif - -#ifdef DJGPP -# define BASENAMELEN (_USE_LFN?250:8) /* length of base of file name */ -#else -# define BASENAMELEN 8 /* length of base of file name */ -#endif - -/* codes for msdos mouse event */ -#define MSDOS_MOUSE_LEFT 0x01 -#define MSDOS_MOUSE_RIGHT 0x02 -#define MSDOS_MOUSE_MIDDLE 0x04 - -#ifdef DJGPP -int mch_rename(const char *OldFile, const char *NewFile); -#else -# define mch_rename(src, dst) rename(src, dst) -#endif - -#ifdef DJGPP -# define vim_mkdir(x, y) mkdir((char *)(x), y) -#else -# define vim_mkdir(x, y) mkdir((char *)(x)) -#endif -#define mch_rmdir(x) rmdir((char *)(x)) - -#define mch_setenv(name, val, x) setenv(name, val, x) diff --git a/src/os_mswin.c b/src/os_mswin.c index 871afad9d2..5dbfd0ef0c 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,28 +10,11 @@ /* * os_mswin.c * - * Routines common to both Win16 and Win32. + * Routines for Win32. */ -#ifdef WIN16 -# ifdef __BORLANDC__ -# pragma warn -par -# pragma warn -ucp -# pragma warn -use -# pragma warn -aus -# endif -#endif - #include "vim.h" -#ifdef WIN16 -# define SHORT_FNAME /* always 8.3 file name */ -/* cproto fails on missing include files */ -# ifndef PROTO -# include <dos.h> -# endif -# include <string.h> -#endif #include <sys/types.h> #include <signal.h> #include <limits.h> @@ -55,13 +38,9 @@ # if defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT) # include <dlgs.h> -# ifdef WIN3264 -# include <winspool.h> -# else -# include <print.h> -# endif +# include <winspool.h> # include <commdlg.h> -#endif +# endif #endif /* PROTO */ @@ -147,10 +126,6 @@ typedef void VOID; FILE* fdDump = NULL; #endif -#ifdef WIN3264 -extern DWORD g_PlatformId; -#endif - #ifndef FEAT_GUI_MSWIN extern char g_szOrigTitle[]; #endif @@ -161,7 +136,9 @@ extern HWND s_hwnd; static HWND s_hwnd = 0; /* console window handle, set by GetConsoleHwnd() */ #endif -extern int WSInitialized; +#ifdef FEAT_JOB_CHANNEL +int WSInitialized = FALSE; /* WinSock is initialized */ +#endif /* Don't generate prototypes here, because some systems do have these * functions. */ @@ -224,6 +201,8 @@ int _stricoll(char *a, char *b) void mch_exit(int r) { + exiting = TRUE; + display_errors(); ml_close_all(TRUE); /* remove all memfiles */ @@ -231,7 +210,7 @@ mch_exit(int r) # ifdef FEAT_OLE UninitOLE(); # endif -# ifdef FEAT_NETBEANS_INTG +# ifdef FEAT_JOB_CHANNEL if (WSInitialized) { WSInitialized = FALSE; @@ -263,24 +242,13 @@ mch_early_init(void) { int i; -#ifdef WIN3264 PlatformId(); -#endif /* Init the tables for toupper() and tolower() */ for (i = 0; i < 256; ++i) toupper_tab[i] = tolower_tab[i] = i; -#ifdef WIN3264 - CharUpperBuff(toupper_tab, 256); - CharLowerBuff(tolower_tab, 256); -#else - AnsiUpperBuff(toupper_tab, 256); - AnsiLowerBuff(tolower_tab, 256); -#endif - -#if defined(FEAT_MBYTE) && !defined(FEAT_GUI) - (void)get_cmd_argsW(NULL); -#endif + CharUpperBuff((LPSTR)toupper_tab, 256); + CharLowerBuff((LPSTR)tolower_tab, 256); } @@ -288,7 +256,7 @@ mch_early_init(void) * Return TRUE if the input comes from a terminal, FALSE otherwise. */ int -mch_input_isatty() +mch_input_isatty(void) { #ifdef FEAT_GUI_MSWIN return OK; /* GUI always has a tty */ @@ -318,18 +286,16 @@ mch_settitle( { /* Convert the title from 'encoding' to the active codepage. */ WCHAR *wp = enc_to_utf16(title, NULL); - int n; if (wp != NULL) { - n = SetConsoleTitleW(wp); + SetConsoleTitleW(wp); vim_free(wp); - if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return; + return; } } # endif - SetConsoleTitle(title); + SetConsoleTitle((LPCSTR)title); } # endif } @@ -342,13 +308,11 @@ mch_settitle( * 2: Just restore icon (which we don't have) * 3: Restore title and icon (which we don't have) */ -/*ARGSUSED*/ void -mch_restore_title( - int which) +mch_restore_title(int which UNUSED) { #ifndef FEAT_GUI_MSWIN - mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL); + SetConsoleTitle(g_szOrigTitle); #endif } @@ -357,7 +321,7 @@ mch_restore_title( * Return TRUE if we can restore the title (we can) */ int -mch_can_restore_title() +mch_can_restore_title(void) { return TRUE; } @@ -367,7 +331,7 @@ mch_can_restore_title() * Return TRUE if we can restore the icon title (we can't) */ int -mch_can_restore_icon() +mch_can_restore_icon(void) { return FALSE; } @@ -381,13 +345,12 @@ mch_can_restore_icon() * When 'shellslash' set do it the other way around. * Return OK or FAIL. */ -/*ARGSUSED*/ int mch_FullName( char_u *fname, char_u *buf, int len, - int force) + int force UNUSED) { int nResult = FAIL; @@ -398,12 +361,7 @@ mch_FullName( #endif { #ifdef FEAT_MBYTE - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage -# ifdef __BORLANDC__ - /* Wide functions of Borland C 5.5 do not work on Windows 98. */ - && g_PlatformId == VER_PLATFORM_WIN32_NT -# endif - ) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wname; WCHAR wbuf[MAX_PATH]; @@ -415,7 +373,7 @@ mch_FullName( * - convert the result from UCS2 to 'encoding'. */ wname = enc_to_utf16(fname, NULL); - if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL) + if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL) { cname = utf16_to_enc((short_u *)wbuf, NULL); if (cname != NULL) @@ -430,7 +388,7 @@ mch_FullName( if (nResult == FAIL) /* fall back to non-wide function */ #endif { - if (_fullpath(buf, fname, len - 1) == NULL) + if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL) { /* failed, use relative path name */ vim_strncpy(buf, fname, len - 1); @@ -471,10 +429,10 @@ mch_isFullName(char_u *fname) return TRUE; /* A name that can't be made absolute probably isn't absolute. */ - if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL) + if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL) return FALSE; - return pathcmp(fname, szName, -1) == 0; + return pathcmp((const char *)fname, (const char *)szName, -1) == 0; } /* @@ -485,19 +443,43 @@ mch_isFullName(char_u *fname) * commands that use a file name should try to avoid the need to type a * backslash twice. * When 'shellslash' set do it the other way around. + * When the path looks like a URL leave it unmodified. */ void -slash_adjust(p) - char_u *p; +slash_adjust(char_u *p) { + if (path_with_url(p)) + return; + + if (*p == '`') + { + size_t len = STRLEN(p); + + /* don't replace backslash in backtick quoted strings */ + if (len > 2 && *(p + len - 1) == '`') + return; + } + while (*p) { if (*p == psepcN) *p = psepc; - mb_ptr_adv(p); + MB_PTR_ADV(p); } } +/* Use 64-bit stat functions if available. */ +#ifdef HAVE_STAT64 +# undef stat +# undef _stat +# undef _wstat +# undef _fstat +# define stat _stat64 +# define _stat _stat64 +# define _wstat _wstat64 +# define _fstat _fstat64 +#endif + #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) # define OPEN_OH_ARGTYPE intptr_t #else @@ -505,14 +487,18 @@ slash_adjust(p) #endif static int -stat_symlink_aware(const char *name, struct stat *stp) +stat_symlink_aware(const char *name, stat_T *stp) { -#if defined(_MSC_VER) && _MSC_VER < 1700 - /* Work around for VC10 or earlier. stat() can't handle symlinks properly. +#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__) + /* Work around for VC12 or earlier (and MinGW). stat() can't handle + * symlinks properly. * VC9 or earlier: stat() doesn't support a symlink at all. It retrieves * status of a symlink itself. * VC10: stat() supports a symlink to a normal file, but it doesn't support - * a symlink to a directory (always returns an error). */ + * a symlink to a directory (always returns an error). + * VC11 and VC12: stat() doesn't return an error for a symlink to a + * directory, but it doesn't set S_IFDIR flag. + * MinGW: Same as VC9. */ WIN32_FIND_DATA findData; HANDLE hFind, h; DWORD attr = 0; @@ -540,7 +526,9 @@ stat_symlink_aware(const char *name, struct stat *stp) int fd, n; fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY); - n = _fstat(fd, (struct _stat*)stp); + n = _fstat(fd, (struct _stat *)stp); + if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY)) + stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR; _close(fd); return n; } @@ -551,14 +539,18 @@ stat_symlink_aware(const char *name, struct stat *stp) #ifdef FEAT_MBYTE static int -wstat_symlink_aware(const WCHAR *name, struct _stat *stp) +wstat_symlink_aware(const WCHAR *name, stat_T *stp) { -# if defined(_MSC_VER) && _MSC_VER < 1700 - /* Work around for VC10 or earlier. _wstat() can't handle symlinks properly. +# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__) + /* Work around for VC12 or earlier (and MinGW). _wstat() can't handle + * symlinks properly. * VC9 or earlier: _wstat() doesn't support a symlink at all. It retrieves * status of a symlink itself. * VC10: _wstat() supports a symlink to a normal file, but it doesn't - * support a symlink to a directory (always returns an error). */ + * support a symlink to a directory (always returns an error). + * VC11 and VC12: _wstat() doesn't return an error for a symlink to a + * directory, but it doesn't set S_IFDIR flag. + * MinGW: Same as VC9. */ int n; BOOL is_symlink = FALSE; HANDLE hFind, h; @@ -587,13 +579,15 @@ wstat_symlink_aware(const WCHAR *name, struct _stat *stp) int fd; fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY); - n = _fstat(fd, stp); + n = _fstat(fd, (struct _stat *)stp); + if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY)) + stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR; _close(fd); return n; } } # endif - return _wstat(name, stp); + return _wstat(name, (struct _stat *)stp); } #endif @@ -601,22 +595,22 @@ wstat_symlink_aware(const WCHAR *name, struct _stat *stp) * stat() can't handle a trailing '/' or '\', remove it first. */ int -vim_stat(const char *name, struct stat *stp) +vim_stat(const char *name, stat_T *stp) { #ifdef FEAT_MBYTE /* WinNT and later can use _MAX_PATH wide characters for a pathname, which * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is * UTF-8. */ - char buf[_MAX_PATH * 3 + 1]; + char_u buf[_MAX_PATH * 3 + 1]; #else - char buf[_MAX_PATH + 1]; + char_u buf[_MAX_PATH + 1]; #endif - char *p; + char_u *p; vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); - p = buf + strlen(buf); + p = buf + STRLEN(buf); if (p > buf) - mb_ptr_back(buf, p); + MB_PTR_BACK(buf, p); /* Remove trailing '\\' except root path. */ if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') @@ -625,44 +619,34 @@ vim_stat(const char *name, struct stat *stp) if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) { /* UNC root path must be followed by '\\'. */ - p = vim_strpbrk(buf + 2, "\\/"); + p = vim_strpbrk(buf + 2, (char_u *)"\\/"); if (p != NULL) { - p = vim_strpbrk(p + 1, "\\/"); + p = vim_strpbrk(p + 1, (char_u *)"\\/"); if (p == NULL) STRCAT(buf, "\\"); } } #ifdef FEAT_MBYTE - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage -# ifdef __BORLANDC__ - /* Wide functions of Borland C 5.5 do not work on Windows 98. */ - && g_PlatformId == VER_PLATFORM_WIN32_NT -# endif - ) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wp = enc_to_utf16(buf, NULL); int n; if (wp != NULL) { - n = wstat_symlink_aware(wp, (struct _stat *)stp); + n = wstat_symlink_aware(wp, stp); vim_free(wp); - if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT) - return n; - /* Retry with non-wide function (for Windows 98). Can't use - * GetLastError() here and it's unclear what errno gets set to if - * the _wstat() fails for missing wide functions. */ + return n; } } #endif - return stat_symlink_aware(buf, stp); + return stat_symlink_aware((char *)buf, stp); } #if defined(FEAT_GUI_MSWIN) || defined(PROTO) -/*ARGSUSED*/ void -mch_settmode(int tmode) +mch_settmode(int tmode UNUSED) { /* nothing to do */ } @@ -695,7 +679,7 @@ mch_new_shellsize(void) * We have no job control, so fake it by starting a new shell. */ void -mch_suspend() +mch_suspend(void) { suspend_shell(); } @@ -710,7 +694,7 @@ mch_suspend() * Display the saved error message(s). */ void -display_errors() +display_errors(void) { char *p; @@ -729,7 +713,8 @@ display_errors() gui.starting ? (char_u *)_("Message") : #endif (char_u *)_("Error"), - p, (char_u *)_("&Ok"), 1, NULL, FALSE); + (char_u *)p, (char_u *)_("&Ok"), + 1, NULL, FALSE); break; } ga_clear(&error_ga); @@ -745,7 +730,7 @@ display_errors() int mch_has_exp_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (vim_strchr((char_u *)"?*[", *p) != NULL || (*p == '~' && p[1] != NUL)) @@ -761,7 +746,7 @@ mch_has_exp_wildcard(char_u *p) int mch_has_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { if (vim_strchr((char_u *) # ifdef VIM_BACKTICK @@ -808,16 +793,14 @@ mch_chdir(char *path) #ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - WCHAR *p = enc_to_utf16(path, NULL); + WCHAR *p = enc_to_utf16((char_u *)path, NULL); int n; if (p != NULL) { n = _wchdir(p); vim_free(p); - if (n == 0 || g_PlatformId == VER_PLATFORM_WIN32_NT) - return n; - /* Retry with non-wide function (for Windows 98). */ + return n; } } #endif @@ -826,46 +809,36 @@ mch_chdir(char *path) } +#ifdef FEAT_GUI_MSWIN /* - * Switching off termcap mode is only allowed when Columns is 80, otherwise a - * crash may result. It's always allowed on NT or when running the GUI. + * return non-zero if a character is available */ -/*ARGSUSED*/ int -can_end_termcap_mode( - int give_msg) +mch_char_avail(void) { -#ifdef FEAT_GUI_MSWIN - return TRUE; /* GUI starts a new console anyway */ -#else - if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80) - return TRUE; - if (give_msg) - msg(_("'columns' is not 80, cannot execute external commands")); - return FALSE; -#endif + /* never used */ + return TRUE; } -#ifdef FEAT_GUI_MSWIN +# if defined(FEAT_TERMINAL) || defined(PROTO) /* - * return non-zero if a character is available + * Check for any pending input or messages. */ int -mch_char_avail() +mch_check_messages(void) { - /* never used */ + /* TODO: check for messages */ return TRUE; } +# endif #endif /* * set screen mode, always fails. */ -/*ARGSUSED*/ int -mch_screenmode( - char_u *arg) +mch_screenmode(char_u *arg UNUSED) { EMSG(_(e_screenmode)); return FAIL; @@ -878,19 +851,11 @@ mch_screenmode( * and returns an allocated string. * Return OK if it worked, FAIL if not. */ -# ifdef WIN3264 typedef LPTSTR (*MYSTRPROCSTR)(LPTSTR); typedef LPTSTR (*MYINTPROCSTR)(int); typedef int (*MYSTRPROCINT)(LPTSTR); typedef int (*MYINTPROCINT)(int); -# else -typedef LPSTR (*MYSTRPROCSTR)(LPSTR); -typedef LPSTR (*MYINTPROCSTR)(int); -typedef int (*MYSTRPROCINT)(LPSTR); -typedef int (*MYINTPROCINT)(int); -# endif -# ifndef WIN16 /* * Check if a pointer points to a valid NUL terminated string. * Return the length of the string, including terminating NUL. @@ -903,7 +868,7 @@ check_str_len(char_u *str) MEMORY_BASIC_INFORMATION mbi; size_t length = 0; size_t i; - const char *p; + const char_u *p; /* get page size */ GetSystemInfo(&si); @@ -930,7 +895,32 @@ check_str_len(char_u *str) return 0; } -# endif + +/* + * Passed to do_in_runtimepath() to load a vim.ico file. + */ + static void +mch_icon_load_cb(char_u *fname, void *cookie) +{ + HANDLE *h = (HANDLE *)cookie; + + *h = LoadImage(NULL, + (LPSTR)fname, + IMAGE_ICON, + 64, + 64, + LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); +} + +/* + * Try loading an icon file from 'runtimepath'. + */ + int +mch_icon_load(HANDLE *iconp) +{ + return do_in_runtimepath((char_u *)"bitmaps/vim.ico", + 0, mch_icon_load_cb, iconp); +} int mch_libcall( @@ -951,11 +941,7 @@ mch_libcall( BOOL fRunTimeLinkSuccess = FALSE; // Get a handle to the DLL module. -# ifdef WIN16 - hinstLib = LoadLibrary(libname); -# else - hinstLib = vimLoadLib(libname); -# endif + hinstLib = vimLoadLib((char *)libname); // If the handle is valid, try to get the function address. if (hinstLib != NULL) @@ -967,25 +953,25 @@ mch_libcall( if (argstring != NULL) { /* Call with string argument */ - ProcAdd = (MYSTRPROCSTR) GetProcAddress(hinstLib, funcname); + ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname); if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) { if (string_result == NULL) - retval_int = ((MYSTRPROCINT)ProcAdd)(argstring); + retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring); else - retval_str = (ProcAdd)(argstring); + retval_str = (char_u *)(ProcAdd)((LPSTR)argstring); } } else { /* Call with number argument */ - ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, funcname); + ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, (LPCSTR)funcname); if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0) { if (string_result == NULL) retval_int = ((MYINTPROCINT)ProcAddI)(argint); else - retval_str = (ProcAddI)(argint); + retval_str = (char_u *)(ProcAddI)(argint); } } @@ -994,15 +980,7 @@ mch_libcall( if (string_result == NULL) *number_result = retval_int; else if (retval_str != NULL -# ifdef WIN16 - && retval_str != (char_u *)1 - && retval_str != (char_u *)-1 - && !IsBadStringPtr(retval_str, INT_MAX) - && (len = strlen(retval_str) + 1) > 0 -# else - && (len = check_str_len(retval_str)) > 0 -# endif - ) + && (len = check_str_len(retval_str)) > 0) { *string_result = lalloc((long_u)len, TRUE); if (*string_result != NULL) @@ -1036,10 +1014,8 @@ mch_libcall( /* * Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules */ -/*ARGSUSED*/ void -DumpPutS( - const char *psz) +DumpPutS(const char *psz UNUSED) { # ifdef MCH_WRITE_DUMP if (fdDump) @@ -1072,7 +1048,7 @@ Trace( #endif //_DEBUG #if !defined(FEAT_GUI) || defined(PROTO) -# if defined(FEAT_TITLE) && defined(WIN3264) +# ifdef FEAT_TITLE extern HWND g_hWnd; /* This is in os_win32.c. */ # endif @@ -1093,7 +1069,7 @@ GetConsoleHwnd(void) if (s_hwnd != 0) return; -# if defined(FEAT_TITLE) && defined(WIN3264) +# ifdef FEAT_TITLE /* Window handle may have been found by init code (Windows NT only) */ if (g_hWnd != 0) { @@ -1144,9 +1120,6 @@ mch_set_winpos(int x, int y) #if (defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT)) || defined(PROTO) -# ifdef WIN16 -# define TEXT(a) a -# endif /*================================================================= * Win32 printer stuff */ @@ -1171,7 +1144,7 @@ static char_u *prt_name = NULL; #define IDC_PRINTTEXT2 402 #define IDC_PROGRESS 403 -#if !defined(FEAT_MBYTE) || defined(WIN16) +#if !defined(FEAT_MBYTE) # define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s) #else static BOOL @@ -1190,7 +1163,7 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) vim_free(wp); return ret; } - return SetDlgItemText(hDlg, nIDDlgItem, s); + return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s); } #endif @@ -1216,9 +1189,12 @@ swap_me(COLORREF colorref) # define PDP_RETVAL INT_PTR #endif -/*ARGSUSED*/ static PDP_RETVAL CALLBACK -PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +PrintDlgProc( + HWND hDlg, + UINT message, + WPARAM wParam UNUSED, + LPARAM lParam UNUSED) { #ifdef FEAT_GETTEXT NONCLIENTMETRICS nm; @@ -1245,20 +1221,19 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,i, _(buff)); + vimSetDlgItemText(hDlg,i, (char_u *)_(buff)); } SendDlgItemMessage(hDlg, IDCANCEL, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,IDCANCEL, _(buff)); + vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); } #endif - SetWindowText(hDlg, szAppName); + SetWindowText(hDlg, (LPCSTR)szAppName); if (prt_name != NULL) { - vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); - vim_free(prt_name); - prt_name = NULL; + vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); + VIM_CLEAR(prt_name); } EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); #ifndef FEAT_GUI @@ -1279,9 +1254,8 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } -/*ARGSUSED*/ static BOOL CALLBACK -AbortProc(HDC hdcPrn, int iCode) +AbortProc(HDC hdcPrn UNUSED, int iCode UNUSED) { MSG msg; @@ -1416,23 +1390,13 @@ prt_get_cpl(void) int dvoff; int rev_offset; int dpi; -#ifdef WIN16 - POINT pagesize; -#endif GetTextMetrics(prt_dlg.hDC, &prt_tm); prt_line_height = prt_tm.tmHeight + prt_tm.tmExternalLeading; hr = GetDeviceCaps(prt_dlg.hDC, HORZRES); -#ifdef WIN16 - Escape(prt_dlg.hDC, GETPHYSPAGESIZE, NULL, NULL, &pagesize); - phyw = pagesize.x; - Escape(prt_dlg.hDC, GETPRINTINGOFFSET, NULL, NULL, &pagesize); - dvoff = pagesize.x; -#else phyw = GetDeviceCaps(prt_dlg.hDC, PHYSICALWIDTH); dvoff = GetDeviceCaps(prt_dlg.hDC, PHYSICALOFFSETX); -#endif dpi = GetDeviceCaps(prt_dlg.hDC, LOGPIXELSX); rev_offset = phyw - (dvoff + hr); @@ -1461,20 +1425,10 @@ prt_get_lpp(void) int rev_offset; int bottom_margin; int dpi; -#ifdef WIN16 - POINT pagesize; -#endif vr = GetDeviceCaps(prt_dlg.hDC, VERTRES); -#ifdef WIN16 - Escape(prt_dlg.hDC, GETPHYSPAGESIZE, NULL, NULL, &pagesize); - phyw = pagesize.y; - Escape(prt_dlg.hDC, GETPRINTINGOFFSET, NULL, NULL, &pagesize); - dvoff = pagesize.y; -#else phyw = GetDeviceCaps(prt_dlg.hDC, PHYSICALHEIGHT); dvoff = GetDeviceCaps(prt_dlg.hDC, PHYSICALOFFSETY); -#endif dpi = GetDeviceCaps(prt_dlg.hDC, LOGPIXELSY); rev_offset = phyw - (dvoff + vr); @@ -1541,15 +1495,13 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) ) { prt_dlg.Flags |= PD_RETURNDEFAULT; -#ifdef WIN3264 /* * MSDN suggests setting the first parameter to WINSPOOL for * NT, but NULL appears to work just as well. */ if (*p_pdev != NUL) - prt_dlg.hDC = CreateDC(NULL, p_pdev, NULL, NULL); + prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL); else -#endif { prt_dlg.Flags |= PD_RETURNDEFAULT; if (PrintDlg(&prt_dlg) == 0) @@ -1595,10 +1547,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) mem = (DEVMODE *)GlobalLock(prt_dlg.hDevMode); if (mem != NULL) { -#ifdef WIN3264 if (mem->dmCopies != 1) stored_nCopies = mem->dmCopies; -#endif if ((mem->dmFields & DM_DUPLEX) && (mem->dmDuplex & ~DMDUP_SIMPLEX)) psettings->duplex = TRUE; if ((mem->dmFields & DM_COLOR) && (mem->dmColor & DMCOLOR_COLOR)) @@ -1611,12 +1561,36 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) { char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; char_u *port_name = (char_u *)devname +devname->wOutputOffset; - char_u *text = _("to %s on %s"); + char_u *text = (char_u *)_("to %s on %s"); +#ifdef FEAT_MBYTE + char_u *printer_name_orig = printer_name; + char_u *port_name_orig = port_name; + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + char_u *to_free = NULL; + int maxlen; + + acp_to_enc(printer_name, (int)STRLEN(printer_name), &to_free, + &maxlen); + if (to_free != NULL) + printer_name = to_free; + acp_to_enc(port_name, (int)STRLEN(port_name), &to_free, &maxlen); + if (to_free != NULL) + port_name = to_free; + } +#endif prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) + STRLEN(text))); if (prt_name != NULL) - wsprintf(prt_name, text, printer_name, port_name); + wsprintf((char *)prt_name, (const char *)text, + printer_name, port_name); +#ifdef FEAT_MBYTE + if (printer_name != printer_name_orig) + vim_free(printer_name); + if (port_name != port_name_orig) + vim_free(port_name); +#endif } GlobalUnlock(prt_dlg.hDevNames); @@ -1650,16 +1624,24 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) */ psettings->chars_per_line = prt_get_cpl(); psettings->lines_per_page = prt_get_lpp(); - psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE) - ? prt_dlg.nCopies : 1; - psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE) - ? 1 : prt_dlg.nCopies; + if (prt_dlg.Flags & PD_USEDEVMODECOPIESANDCOLLATE) + { + psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE) + ? prt_dlg.nCopies : 1; + psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE) + ? 1 : prt_dlg.nCopies; - if (psettings->n_collated_copies == 0) - psettings->n_collated_copies = 1; + if (psettings->n_collated_copies == 0) + psettings->n_collated_copies = 1; - if (psettings->n_uncollated_copies == 0) + if (psettings->n_uncollated_copies == 0) + psettings->n_uncollated_copies = 1; + } + else + { + psettings->n_collated_copies = 1; psettings->n_uncollated_copies = 1; + } psettings->jobname = jobname; @@ -1671,12 +1653,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) if (err) { -#ifdef WIN16 - char buf[20]; - - sprintf(buf, "%ld", err); - EMSG2(_("E238: Print error: %s"), buf); -#else char_u *buf; /* I suspect FormatMessage() doesn't work for values returned by @@ -1688,7 +1664,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) EMSG2(_("E238: Print error: %s"), buf == NULL ? (char_u *)_("Unknown") : buf); LocalFree((LPVOID)(buf)); -#endif } else msg_clr_eos(); /* Maybe canceled */ @@ -1703,23 +1678,40 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) mch_print_begin(prt_settings_T *psettings) { int ret; - static DOCINFO di; char szBuffer[300]; +#if defined(FEAT_MBYTE) + WCHAR *wp = NULL; +#endif hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"), prt_dlg.hwndOwner, PrintDlgProc); -#ifdef WIN16 - Escape(prt_dlg.hDC, SETABORTPROC, 0, (LPSTR)AbortProc, NULL); -#else SetAbortProc(prt_dlg.hDC, AbortProc); -#endif wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); - vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); + vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); + +#if defined(FEAT_MBYTE) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + wp = enc_to_utf16(psettings->jobname, NULL); + if (wp != NULL) + { + DOCINFOW di; + + vim_memset(&di, 0, sizeof(di)); + di.cbSize = sizeof(di); + di.lpszDocName = wp; + ret = StartDocW(prt_dlg.hDC, &di); + vim_free(wp); + } + else +#endif + { + DOCINFO di; - vim_memset(&di, 0, sizeof(DOCINFO)); - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = psettings->jobname; - ret = StartDoc(prt_dlg.hDC, &di); + vim_memset(&di, 0, sizeof(di)); + di.cbSize = sizeof(di); + di.lpszDocName = (LPCSTR)psettings->jobname; + ret = StartDoc(prt_dlg.hDC, &di); + } #ifdef FEAT_GUI /* Give focus back to main window (when using MDI). */ @@ -1729,9 +1721,8 @@ mch_print_begin(prt_settings_T *psettings) return (ret > 0); } -/*ARGSUSED*/ void -mch_print_end(prt_settings_T *psettings) +mch_print_end(prt_settings_T *psettings UNUSED) { EndDoc(prt_dlg.hDC); if (!*bUserAbort) @@ -1748,7 +1739,7 @@ mch_print_end_page(void) mch_print_begin_page(char_u *msg) { if (msg != NULL) - vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); + vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg); return (StartPage(prt_dlg.hDC) > 0); } @@ -1762,9 +1753,7 @@ static int prt_pos_x = 0; static int prt_pos_y = 0; void -mch_print_start_line(margin, page_line) - int margin; - int page_line; +mch_print_start_line(int margin, int page_line) { if (margin) prt_pos_x = -prt_number_width; @@ -1777,10 +1766,10 @@ mch_print_start_line(margin, page_line) int mch_print_text_out(char_u *p, int len) { -#if defined(FEAT_PROPORTIONAL_FONTS) || (defined(FEAT_MBYTE) && !defined(WIN16)) +#if defined(FEAT_PROPORTIONAL_FONTS) || defined(FEAT_MBYTE) SIZE sz; #endif -#if defined(FEAT_MBYTE) && !defined(WIN16) +#if defined(FEAT_MBYTE) WCHAR *wp = NULL; int wlen = len; @@ -1813,26 +1802,19 @@ mch_print_text_out(char_u *p, int len) } #endif TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, - prt_pos_y + prt_top_margin, p, len); + prt_pos_y + prt_top_margin, + (LPCSTR)p, len); #ifndef FEAT_PROPORTIONAL_FONTS prt_pos_x += len * prt_tm.tmAveCharWidth; return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth + prt_tm.tmOverhang > prt_right_margin); #else -# ifdef WIN16 - GetTextExtentPoint(prt_dlg.hDC, p, len, &sz); -# else - GetTextExtentPoint32(prt_dlg.hDC, p, len, &sz); -# endif + GetTextExtentPoint32(prt_dlg.hDC, (LPCSTR)p, len, &sz); prt_pos_x += (sz.cx - prt_tm.tmOverhang); /* This is wrong when printing spaces for a TAB. */ if (p[len] == NUL) return FALSE; -# ifdef WIN16 - GetTextExtentPoint(prt_dlg.hDC, p + len, 1, &sz); -# else GetTextExtentPoint32(prt_dlg.hDC, p + len, 1, &sz); -# endif return (prt_pos_x + prt_left_margin + sz.cx > prt_right_margin); #endif } @@ -1945,7 +1927,7 @@ mch_resolve_shortcut(char_u *fname) goto shortcut_end; } } - /* Retry with non-wide function (for Windows 98). */ + goto shortcut_end; } # endif // create a link manager object and request its interface @@ -1962,7 +1944,7 @@ mch_resolve_shortcut(char_u *fname) goto shortcut_end; // full path string must be in Unicode. - MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, (LPCSTR)fname, -1, wsz, MAX_PATH); // "load" the name and resolve the link hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ); @@ -1978,7 +1960,7 @@ mch_resolve_shortcut(char_u *fname) ZeroMemory(buf, MAX_PATH); hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0); if (hr == S_OK && buf[0] != NUL) - rfname = vim_strsave(buf); + rfname = vim_strsave((char_u *)buf); shortcut_end: // Release all interface pointers (both belong to the same object) @@ -2001,7 +1983,7 @@ mch_resolve_shortcut(char_u *fname) * Bring ourselves to the foreground. Does work if the OS doesn't allow it. */ void -win32_set_foreground() +win32_set_foreground(void) { # ifndef FEAT_GUI GetConsoleHwnd(); /* get value of s_hwnd */ @@ -2165,11 +2147,15 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) str = serverConvert(client_enc, (char_u *)data->lpData, &tofree); res = eval_client_expr_to_string(str); - vim_free(tofree); if (res == NULL) { - res = vim_strsave(_(e_invexprmsg)); + char *err = _(e_invexprmsg); + size_t len = STRLEN(str) + STRLEN(err) + 5; + + res = alloc((unsigned)len); + if (res != NULL) + vim_snprintf((char *)res, len, "%s: \"%s\"", err, str); reply.dwData = COPYDATA_ERROR_RESULT; } else @@ -2180,6 +2166,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) serverSendEnc(sender); retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window, (LPARAM)(&reply)); + vim_free(tofree); vim_free(res); return retval; @@ -2197,7 +2184,6 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) (data->dwData == COPYDATA_RESULT ? 1 : 2))) == FAIL) vim_free(str); -#ifdef FEAT_AUTOCMD else if (data->dwData == COPYDATA_REPLY) { char_u winstr[30]; @@ -2206,7 +2192,6 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } -#endif } return 1; } @@ -2334,8 +2319,8 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam) return TRUE; /* Add the name to the list */ - ga_concat(ga, server); - ga_concat(ga, "\n"); + ga_concat(ga, (char_u *)server); + ga_concat(ga, (char_u *)"\n"); return TRUE; } @@ -2394,7 +2379,7 @@ serverSetName(char_u *name) #endif /* Update the message window title */ - SetWindowText(message_window, ok_name); + SetWindowText(message_window, (LPCSTR)ok_name); #ifdef FEAT_EVAL /* Set the servername variable */ @@ -2417,9 +2402,9 @@ serverGetVimNames(void) } int -serverSendReply(name, reply) - char_u *name; /* Where to send. */ - char_u *reply; /* What to send. */ +serverSendReply( + char_u *name, /* Where to send. */ + char_u *reply) /* What to send. */ { HWND target; COPYDATASTRUCT data; @@ -2450,13 +2435,14 @@ serverSendReply(name, reply) } int -serverSendToVim(name, cmd, result, ptarget, asExpr, silent) - char_u *name; /* Where to send. */ - char_u *cmd; /* What to send. */ - char_u **result; /* Result of eval'ed expression */ - void *ptarget; /* HWND of server */ - int asExpr; /* Expression or keys? */ - int silent; /* don't complain about no server */ +serverSendToVim( + char_u *name, /* Where to send. */ + char_u *cmd, /* What to send. */ + char_u **result, /* Result of eval'ed expression */ + void *ptarget, /* HWND of server */ + int asExpr, /* Expression or keys? */ + int timeout, /* timeout in seconds or zero */ + int silent) /* don't complain about no server */ { HWND target; COPYDATASTRUCT data; @@ -2464,6 +2450,10 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent) int retcode = 0; char_u altname_buf[MAX_PATH]; + /* Execute locally if no display or target is ourselves */ + if (serverName != NULL && STRICMP(name, serverName) == 0) + return sendToLocalVim(cmd, asExpr, result); + /* If the server name does not end in a digit then we look for an * alternate name. e.g. when "name" is GVIM the we may find GVIM2. */ if (STRLEN(name) > 1 && !vim_isdigit(name[STRLEN(name) - 1])) @@ -2495,7 +2485,7 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent) return -1; if (asExpr) - retval = serverGetReply(target, &retcode, TRUE, TRUE); + retval = serverGetReply(target, &retcode, TRUE, TRUE, timeout); if (result == NULL) vim_free(retval); @@ -2509,8 +2499,7 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent) * Bring the server to the foreground. */ void -serverForeground(name) - char_u *name; +serverForeground(char_u *name) { HWND target = findServer(name); @@ -2573,13 +2562,17 @@ save_reply(HWND server, char_u *reply, int expr) * if "wait" is TRUE block until a message arrives (or the server exits). */ char_u * -serverGetReply(HWND server, int *expr_res, int remove, int wait) +serverGetReply(HWND server, int *expr_res, int remove, int wait, int timeout) { int i; char_u *reply; reply_T *rep; + int did_process = FALSE; + time_t start; + time_t now; /* When waiting, loop until the message waiting for is received. */ + time(&start); for (;;) { /* Reset this here, in case a message arrives while we are going @@ -2614,7 +2607,17 @@ serverGetReply(HWND server, int *expr_res, int remove, int wait) /* If we got here, we didn't find a reply. Return immediately if the * "wait" parameter isn't set. */ if (!wait) + { + /* Process pending messages once. Without this, looping on + * remote_peek() would never get the reply. */ + if (!did_process) + { + did_process = TRUE; + serverProcessPendingMessages(); + continue; + } break; + } /* We need to wait for a reply. Enter a message loop until the * "reply_received" flag gets set. */ @@ -2622,6 +2625,14 @@ serverGetReply(HWND server, int *expr_res, int remove, int wait) /* Loop until we receive a reply */ while (reply_received == 0) { +#ifdef FEAT_TIMERS + /* TODO: use the return value to decide how long to wait. */ + check_due_timer(); +#endif + time(&now); + if (timeout > 0 && (now - start) >= timeout) + break; + /* Wait for a SendMessage() call to us. This could be the reply * we are waiting for. Use a timeout of a second, to catch the * situation that the server died unexpectedly. */ @@ -2674,7 +2685,6 @@ charset_pairs[] = {"OEM", OEM_CHARSET}, {"SHIFTJIS", SHIFTJIS_CHARSET}, {"SYMBOL", SYMBOL_CHARSET}, -#ifdef WIN3264 {"ARABIC", ARABIC_CHARSET}, {"BALTIC", BALTIC_CHARSET}, {"EASTEUROPE", EASTEUROPE_CHARSET}, @@ -2686,14 +2696,39 @@ charset_pairs[] = {"RUSSIAN", RUSSIAN_CHARSET}, {"THAI", THAI_CHARSET}, {"TURKISH", TURKISH_CHARSET}, -# if (!defined(_MSC_VER) || (_MSC_VER > 1010)) \ - && (!defined(__BORLANDC__) || (__BORLANDC__ > 0x0500)) +#ifdef VIETNAMESE_CHARSET {"VIETNAMESE", VIETNAMESE_CHARSET}, -# endif #endif {NULL, 0} }; +struct quality_pair +{ + char *name; + DWORD quality; +}; + +static struct quality_pair +quality_pairs[] = { +#ifdef CLEARTYPE_QUALITY + {"CLEARTYPE", CLEARTYPE_QUALITY}, +#endif +#ifdef ANTIALIASED_QUALITY + {"ANTIALIASED", ANTIALIASED_QUALITY}, +#endif +#ifdef NONANTIALIASED_QUALITY + {"NONANTIALIASED", NONANTIALIASED_QUALITY}, +#endif +#ifdef PROOF_QUALITY + {"PROOF", PROOF_QUALITY}, +#endif +#ifdef DRAFT_QUALITY + {"DRAFT", DRAFT_QUALITY}, +#endif + {"DEFAULT", DEFAULT_QUALITY}, + {NULL, 0} +}; + /* * Convert a charset ID to a name. * Return NULL when not recognized. @@ -2709,6 +2744,21 @@ charset_id2name(int id) return cp->name; } +/* + * Convert a quality ID to a name. + * Return NULL when not recognized. + */ + char * +quality_id2name(DWORD id) +{ + struct quality_pair *qp; + + for (qp = quality_pairs; qp->name != NULL; ++qp) + if (id == qp->quality) + break; + return qp->name; +} + static const LOGFONT s_lfDefault = { -12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, @@ -2781,12 +2831,11 @@ points_to_pixels(char_u *str, char_u **end, int vertical, long_i pprinter_dc) return pixels; } -/*ARGSUSED*/ static int CALLBACK font_enumproc( ENUMLOGFONT *elf, - NEWTEXTMETRIC *ntm, - int type, + NEWTEXTMETRIC *ntm UNUSED, + int type UNUSED, LPARAM lparam) { /* Return value: @@ -2884,7 +2933,7 @@ get_logfont( if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { int len; - enc_to_acp(name, (int)strlen(name), &acpname, &len); + enc_to_acp(name, (int)STRLEN(name), &acpname, &len); name = acpname; } #endif @@ -2912,7 +2961,7 @@ get_logfont( */ for (p = name; *p && *p != ':'; p++) { - if (p - name + 1 > LF_FACESIZE) + if (p - name + 1 >= LF_FACESIZE) goto theend; /* Name too long */ lf->lfFaceName[p - name] = *p; } @@ -2935,7 +2984,9 @@ get_logfont( int did_replace = FALSE; for (i = 0; lf->lfFaceName[i]; ++i) - if (lf->lfFaceName[i] == '_') + if (IsDBCSLeadByte(lf->lfFaceName[i])) + ++i; + else if (lf->lfFaceName[i] == '_') { lf->lfFaceName[i] = ' '; did_replace = TRUE; @@ -2959,14 +3010,10 @@ get_logfont( lf->lfWidth = points_to_pixels(p, &p, FALSE, (long_i)printer_dc); break; case 'b': -#ifndef MSWIN16_FASTTEXT lf->lfWeight = FW_BOLD; -#endif break; case 'i': -#ifndef MSWIN16_FASTTEXT lf->lfItalic = TRUE; -#endif break; case 'u': lf->lfUnderline = TRUE; @@ -2994,6 +3041,26 @@ get_logfont( } break; } + case 'q': + { + struct quality_pair *qp; + + for (qp = quality_pairs; qp->name != NULL; ++qp) + if (STRNCMP(p, qp->name, strlen(qp->name)) == 0) + { + lf->lfQuality = qp->quality; + p += strlen(qp->name); + break; + } + if (qp->name == NULL && verbose) + { + vim_snprintf((char *)IObuff, IOSIZE, + _("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name); + EMSG(IObuff); + break; + } + break; + } default: if (verbose) { @@ -3026,3 +3093,22 @@ get_logfont( } #endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */ + +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) +/* + * Initialize the Winsock dll. + */ + void +channel_init_winsock(void) +{ + WSADATA wsaData; + int wsaerr; + + if (WSInitialized) + return; + + wsaerr = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (wsaerr == 0) + WSInitialized = TRUE; +} +#endif diff --git a/src/os_os2_cfg.h b/src/os_os2_cfg.h deleted file mode 100644 index eef8bf598c..0000000000 --- a/src/os_os2_cfg.h +++ /dev/null @@ -1,254 +0,0 @@ -/* os_os2_cfg.h */ -/* vi:set ts=8 sts=4 sw=4: */ - -#define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ -#define SPACE_IN_FILENAME -#define BACKSLASH_IN_FILENAME -#define BINARY_FILE_IO -#define USE_CRNL /* lines end in CR-NL instead of NL */ -#define NO_EXPANDPATH /* always call mch_expand_wildcards */ -#define USE_EXE_NAME /* use argv[0] for $VIM */ -#define USE_TERM_CONSOLE -#define HAVE_DUP /* have dup() */ - -#define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ - -/* - * The rest is manually generated from configure.in by Paul Slootman. - */ - -/* Define unless no X support found */ -#undef HAVE_X11 - -/* Define when terminfo support found */ -#undef TERMINFO - -/* Define when termcap.h contains ospeed */ -#define HAVE_OSPEED 1 - -#define HAVE_STRICMP -#define HAVE_STRNICMP - -/* Define when ospeed can be extern */ -#define OSPEED_EXTERN - -/* Define when termcap.h contains UP, BC and PC */ -#define HAVE_UP_BC_PC 1 - -/* Define when UP, BC and PC can be extern */ -#define UP_BC_PC_EXTERN - -/* Define when termcap.h defines outfuntype */ -#undef HAVE_OUTFUNTYPE - -/* Define when __DATE__ " " __TIME__ can be used */ -#define HAVE_DATE_TIME 1 - -#undef UNIX /* define always by current configure script */ - -/* Defined to the size of an int */ -#define VIM_SIZEOF_INT 4 - -/* - * If we cannot trust one of the following from the libraries, we use our - * own safe but probably slower mch_memmove(). - */ -#define USEBCOPY 1 -#undef USEMEMMOVE -#undef USEMEMCPY - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef mode_t - -/* Define to `long' if <sys/types.h> doesn't define. */ -#undef off_t - -/* Define to `long' if <sys/types.h> doesn't define. */ -#undef pid_t - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef uid_t - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef gid_t - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if you can safely include both <sys/time.h> and <sys/select.h>. */ -#define SYS_SELECT_WITH_SYS_TIME 1 - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define as the command at the end of signal handlers ("" or "return 0;"). */ -#define SIGRETURN - -/* Define if toupper/tolower only work on lower/uppercase characters */ -#undef BROKEN_TOUPPER - -/* Define if tgetstr() has a second argument that is (char *) */ -#undef TGETSTR_CHAR_P - -/* Define if you have the sigset() function. */ -#undef HAVE_SIGSET - -/* Define if the getcwd() function should not be used. */ -#undef BAD_GETCWD - -/* Define if you have the getcwd() function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the getwd() function. */ -#define HAVE_GETWD 1 - -/* Define if you have the select() function. */ -#define HAVE_SELECT 1 - -/* Define if you have the strcspn() function. */ -#define HAVE_STRCSPN 1 - -/* Define if you have the strtol() function. */ -#define HAVE_STRTOL 1 - -/* Define if you have the tgetent() function. */ -#define HAVE_TGETENT 1 - -#define HAVE_STRFTIME /* guessed */ - -/* Define if you have the memset() function. */ -#define HAVE_MEMSET 1 - -/* Define if you have the strerror() function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strcasecmp() function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the fchown() function. */ -#undef HAVE_FCHOWN - -/* Define if you have the rename() function. */ -#define HAVE_RENAME 1 - -/* Define if you have the fsync() function. */ -#undef HAVE_FSYNC /* exists, but apparently Bad Things happen when used */ - -/* Define if you have the fchdir() function. */ -#undef HAVE_FCHDIR - -/* Define if you have the setenv() function. */ -#undef HAVE_SETENV - -/* Define if you have the putenv() function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the gettimeofday() function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the getpwuid() function. */ -#undef HAVE_GETPWUID - -/* Define if you have the getpwnam() function. */ -#undef HAVE_GETPWNAM - -/* Define if you have the qsort() function. */ -#define HAVE_QSORT 1 - -/* Define if you have the <dirent.h> header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the <sys/ndir.h> header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define if you have the <sys/dir.h> header file. */ -#undef HAVE_SYS_DIR_H - -/* Define if you have the <ndir.h> header file. */ -#undef HAVE_NDIR_H - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have a <sys/wait.h> that is not POSIX.1 compatible. */ -#undef HAVE_UNION_WAIT - -/* This is currently unused in vim: */ -/* Define if you have the ANSI C header files. */ -/* #undef STDC_HEADERS */ - -/* added by David Sanders */ -#define HAVE_STDARG_H 1 - -/* instead, we check a few STDC things ourselves */ -#define HAVE_STDLIB_H 1 -#undef HAVE_STRING_H /* On EMX it is better to use strings.h */ - -/* Define if you have the <sys/select.h> header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define if you have the <sys/utsname.h> header file. */ -#define HAVE_SYS_UTSNAME_H 1 - -/* Define if you have the <termcap.h> header file. */ -#define HAVE_TERMCAP_H 1 - -/* Define if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the <sgtty.h> header file. */ -#define HAVE_SGTTY_H 1 - -/* Define if you have the <sys/ioctl.h> header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H - -/* Define if you have the <termio.h> header file. */ -#undef HAVE_TERMIO_H - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the <stropts.h> header file. */ -#undef HAVE_STROPTS_H - -/* Define if you have the <errno.h> header file. */ -#define HAVE_ERRNO_H 1 - -/* Define if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the <sys/systeminfo.h> header file. */ -#undef HAVE_SYS_SYSTEMINFO_H - -/* Define if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the <sys/stream.h> header file. */ -#undef HAVE_SYS_STREAM_H - -/* Define if you have the <sys/ptem.h> header file. */ -#undef HAVE_SYS_PTEM_H - -/* Define if you have the <termios.h> header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define if you have the <libc.h> header file. */ -#undef HAVE_LIBC_H - -/* Define if you have the <sys/statfs.h> header file. */ -#undef HAVE_SYS_STATFS_H - -/* Define if you have the <sys/poll.h> header file. */ -#undef HAVE_SYS_POLL_H - -/* Define if you have the <pwd.h> header file. */ -#undef HAVE_PWD_H diff --git a/src/os_qnx.c b/src/os_qnx.c index a8f12fa878..b121f3d70e 100644 --- a/src/os_qnx.c +++ b/src/os_qnx.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -19,7 +19,7 @@ int is_photon_available; #endif -void qnx_init() +void qnx_init(void) { #if defined(FEAT_GUI_PHOTON) PhChannelParms_t parms; @@ -37,7 +37,7 @@ void qnx_init() #define CLIP_TYPE_TEXT "TEXT" /* Turn on the clipboard for a console vim when photon is running */ -void qnx_clip_init() +void qnx_clip_init(void) { if (is_photon_available == TRUE && !gui.in_use) clip_init(TRUE); diff --git a/src/os_qnx.h b/src/os_qnx.h index cddc68db9f..f98e31117f 100644 --- a/src/os_qnx.h +++ b/src/os_qnx.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/os_unix.c b/src/os_unix.c index a620d28a53..3bf53675c0 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * OS/2 port by Paul Slootman @@ -78,7 +78,7 @@ static int selinux_enabled = -1; #endif #if defined(HAVE_SELECT) -extern int select __ARGS((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif #ifdef FEAT_MOUSE_GPM @@ -98,18 +98,18 @@ extern int select __ARGS((int, fd_set *, fd_set *, fd_set *, struct timeval *) # define KG_CTRLR 7 # define KG_CAPSSHIFT 8 -static void gpm_close __ARGS((void)); -static int gpm_open __ARGS((void)); -static int mch_gpm_process __ARGS((void)); +static void gpm_close(void); +static int gpm_open(void); +static int mch_gpm_process(void); #endif #ifdef FEAT_SYSMOUSE # include <sys/consio.h> # include <sys/fbio.h> -static int sysmouse_open __ARGS((void)); -static void sysmouse_close __ARGS((void)); -static RETSIGTYPE sig_sysmouse __ARGS(SIGPROTOARG); +static int sysmouse_open(void); +static void sysmouse_close(void); +static RETSIGTYPE sig_sysmouse SIGPROTOARG; #endif /* @@ -140,8 +140,8 @@ static RETSIGTYPE sig_sysmouse __ARGS(SIGPROTOARG); # include <X11/Shell.h> # include <X11/StringDefs.h> static Widget xterm_Shell = (Widget)0; -static void clip_update __ARGS((void)); -static void xterm_update __ARGS((void)); +static void clip_update(void); +static void xterm_update(void); # endif # if defined(FEAT_XCLIPBOARD) || defined(FEAT_TITLE) @@ -150,15 +150,15 @@ Window x11_window = 0; Display *x11_display = NULL; # ifdef FEAT_TITLE -static int get_x11_windis __ARGS((void)); -static void set_x11_title __ARGS((char_u *)); -static void set_x11_icon __ARGS((char_u *)); +static int get_x11_windis(void); +static void set_x11_title(char_u *); +static void set_x11_icon(char_u *); # endif #endif #ifdef FEAT_TITLE -static int get_x11_title __ARGS((int)); -static int get_x11_icon __ARGS((int)); +static int get_x11_title(int); +static int get_x11_icon(int); static char_u *oldtitle = NULL; static int did_set_title = FALSE; @@ -166,58 +166,64 @@ static char_u *oldicon = NULL; static int did_set_icon = FALSE; #endif -static void may_core_dump __ARGS((void)); +static void may_core_dump(void); #ifdef HAVE_UNION_WAIT typedef union wait waitstatus; #else typedef int waitstatus; #endif -static pid_t wait4pid __ARGS((pid_t, waitstatus *)); +static pid_t wait4pid(pid_t, waitstatus *); -static int WaitForChar __ARGS((long)); +static int WaitForChar(long msec, int *interrupted, int ignore_input); +static int WaitForCharOrMouse(long msec, int *interrupted, int ignore_input); #if defined(__BEOS__) || defined(VMS) -int RealWaitForChar __ARGS((int, long, int *)); +int RealWaitForChar(int, long, int *, int *interrupted); #else -static int RealWaitForChar __ARGS((int, long, int *)); +static int RealWaitForChar(int, long, int *, int *interrupted); #endif #ifdef FEAT_XCLIPBOARD -static int do_xterm_trace __ARGS((void)); +static int do_xterm_trace(void); # define XT_TRACE_DELAY 50 /* delay for xterm tracing */ #endif -static void handle_resize __ARGS((void)); +static void handle_resize(void); #if defined(SIGWINCH) -static RETSIGTYPE sig_winch __ARGS(SIGPROTOARG); +static RETSIGTYPE sig_winch SIGPROTOARG; #endif #if defined(SIGINT) -static RETSIGTYPE catch_sigint __ARGS(SIGPROTOARG); +static RETSIGTYPE catch_sigint SIGPROTOARG; #endif #if defined(SIGPWR) -static RETSIGTYPE catch_sigpwr __ARGS(SIGPROTOARG); +static RETSIGTYPE catch_sigpwr SIGPROTOARG; #endif #if defined(SIGALRM) && defined(FEAT_X11) \ && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK) # define SET_SIG_ALARM -static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG); +static RETSIGTYPE sig_alarm SIGPROTOARG; /* volatile because it is used in signal handler sig_alarm(). */ static volatile int sig_alarm_called; #endif -static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG); +static RETSIGTYPE deathtrap SIGPROTOARG; -static void catch_int_signal __ARGS((void)); -static void set_signals __ARGS((void)); -static void catch_signals __ARGS((RETSIGTYPE (*func_deadly)(), RETSIGTYPE (*func_other)())); -#ifndef __EMX__ -static int have_wildcard __ARGS((int, char_u **)); -static int have_dollars __ARGS((int, char_u **)); +static void catch_int_signal(void); +static void set_signals(void); +static void catch_signals(RETSIGTYPE (*func_deadly)(), RETSIGTYPE (*func_other)()); +#ifdef HAVE_SIGPROCMASK +# define SIGSET_DECL(set) sigset_t set; +# define BLOCK_SIGNALS(set) block_signals(set) +# define UNBLOCK_SIGNALS(set) unblock_signals(set) +#else +# define SIGSET_DECL(set) +# define BLOCK_SIGNALS(set) do { /**/ } while (0) +# define UNBLOCK_SIGNALS(set) do { /**/ } while (0) #endif +static int have_wildcard(int, char_u **); +static int have_dollars(int, char_u **); -#ifndef __EMX__ -static int save_patterns __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file)); -#endif +static int save_patterns(int num_pat, char_u **pat, int *num_file, char_u ***file); #ifndef SIG_ERR # define SIG_ERR ((RETSIGTYPE (*)())-1) @@ -225,15 +231,17 @@ static int save_patterns __ARGS((int num_pat, char_u **pat, int *num_file, char_ /* volatile because it is used in signal handler sig_winch(). */ static volatile int do_resize = FALSE; -#ifndef __EMX__ static char_u *extra_shell_arg = NULL; static int show_shell_mess = TRUE; -#endif /* volatile because it is used in signal handler deathtrap(). */ static volatile int deadly_signal = 0; /* The signal we caught */ /* volatile because it is used in signal handler deathtrap(). */ static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */ +#if defined(FEAT_JOB_CHANNEL) && !defined(USE_SYSTEM) +static int dont_check_job_ended = 0; +#endif + static int curr_tmode = TMODE_COOK; /* contains current terminal mode */ #ifdef USE_XSMP @@ -257,7 +265,7 @@ static xsmp_config_T xsmp; * that describe the signals. That is nearly what we want here. But * autoconf does only check for sys_siglist (without the underscore), I * do not want to change everything today.... jw. - * This is why AC_DECL_SYS_SIGLIST is commented out in configure.in + * This is why AC_DECL_SYS_SIGLIST is commented out in configure.ac. */ #endif @@ -342,8 +350,7 @@ static struct signalinfo }; int -mch_chdir(path) - char *path; +mch_chdir(char *path) { if (p_verbose >= 5) { @@ -358,17 +365,20 @@ mch_chdir(path) # endif } +/* Why is NeXT excluded here (and not in os_unixx.h)? */ +#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__) +# define NEW_TTY_SYSTEM +#endif + /* - * Write s[len] to the screen. + * Write s[len] to the screen (stdout). */ void -mch_write(s, len) - char_u *s; - int len; +mch_write(char_u *s, int len) { ignored = (int)write(1, (char *)s, len); if (p_wd) /* Unix is too fast, slow down a bit more */ - RealWaitForChar(read_cmd_fd, p_wd, NULL); + RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL); } /* @@ -380,121 +390,168 @@ mch_write(s, len) * If wtime == -1 wait forever for characters. */ int -mch_inchar(buf, maxlen, wtime, tb_change_cnt) - char_u *buf; - int maxlen; - long wtime; /* don't use "time", MIPS cannot handle it */ - int tb_change_cnt; +mch_inchar( + char_u *buf, + int maxlen, + long wtime, /* don't use "time", MIPS cannot handle it */ + int tb_change_cnt) { int len; + int interrupted = FALSE; + int did_start_blocking = FALSE; + long wait_time; + long elapsed_time = 0; +#ifdef ELAPSED_FUNC + ELAPSED_TYPE start_tv; -#ifdef FEAT_NETBEANS_INTG - /* Process the queued netbeans messages. */ - netbeans_parse_messages(); + ELAPSED_INIT(start_tv); #endif - /* Check if window changed size while we were busy, perhaps the ":set - * columns=99" command was used. */ - while (do_resize) - handle_resize(); - - if (wtime >= 0) + /* repeat until we got a character or waited long enough */ + for (;;) { - while (WaitForChar(wtime) == 0) /* no character available */ - { - if (!do_resize) /* return if not interrupted by resize */ - return 0; + /* Check if window changed size while we were busy, perhaps the ":set + * columns=99" command was used. */ + while (do_resize) handle_resize(); -#ifdef FEAT_NETBEANS_INTG - /* Process the queued netbeans messages. */ - netbeans_parse_messages(); + +#ifdef MESSAGE_QUEUE + parse_queued_messages(); + /* If input was put directly in typeahead buffer bail out here. */ + if (typebuf_changed(tb_change_cnt)) + return 0; #endif - } - } - else /* wtime == -1 */ - { - /* - * If there is no character available within 'updatetime' seconds - * flush all the swap files to disk. - * Also done when interrupted by SIGWINCH. - */ - if (WaitForChar(p_ut) == 0) + if (wtime < 0 && did_start_blocking) + /* blocking and already waited for p_ut */ + wait_time = -1; + else { -#ifdef FEAT_AUTOCMD - if (trigger_cursorhold() && maxlen >= 3 - && !typebuf_changed(tb_change_cnt)) + if (wtime >= 0) + wait_time = wtime; + else + /* going to block after p_ut */ + wait_time = p_ut; +#ifdef ELAPSED_FUNC + elapsed_time = ELAPSED_FUNC(start_tv); +#endif + wait_time -= elapsed_time; + if (wait_time < 0) { - buf[0] = K_SPECIAL; - buf[1] = KS_EXTRA; - buf[2] = (int)KE_CURSORHOLD; - return 3; + if (wtime >= 0) + /* no character available within "wtime" */ + return 0; + + else + { + /* no character available within 'updatetime' */ + did_start_blocking = TRUE; + if (trigger_cursorhold() && maxlen >= 3 + && !typebuf_changed(tb_change_cnt)) + { + buf[0] = K_SPECIAL; + buf[1] = KS_EXTRA; + buf[2] = (int)KE_CURSORHOLD; + return 3; + } + /* + * If there is no character available within 'updatetime' + * seconds flush all the swap files to disk. + * Also done when interrupted by SIGWINCH. + */ + before_blocking(); + continue; + } } -#endif - before_blocking(); } - } - - for (;;) /* repeat until we got a character */ - { - while (do_resize) /* window changed size */ - handle_resize(); -#ifdef FEAT_NETBEANS_INTG - /* Process the queued netbeans messages. */ - netbeans_parse_messages(); +#ifdef FEAT_JOB_CHANNEL + /* Checking if a job ended requires polling. Do this every 100 msec. */ + if (has_pending_job() && (wait_time < 0 || wait_time > 100L)) + wait_time = 100L; + /* If there is readahead then parse_queued_messages() timed out and we + * should call it again soon. */ + if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead()) + wait_time = 10L; +#endif +#ifdef FEAT_BEVAL_GUI + if (p_beval && wait_time > 100L) + /* The 'balloonexpr' may indirectly invoke a callback while waiting + * for a character, need to check often. */ + wait_time = 100L; #endif + /* * We want to be interrupted by the winch signal * or by an event on the monitored file descriptors. */ - if (WaitForChar(-1L) == 0) + if (WaitForChar(wait_time, &interrupted, FALSE)) { - if (do_resize) /* interrupted by SIGWINCH signal */ - handle_resize(); - return 0; - } + /* If input was put directly in typeahead buffer bail out here. */ + if (typebuf_changed(tb_change_cnt)) + return 0; - /* If input was put directly in typeahead buffer bail out here. */ - if (typebuf_changed(tb_change_cnt)) - return 0; + /* + * For some terminals we only get one character at a time. + * We want the get all available characters, so we could keep on + * trying until none is available + * For some other terminals this is quite slow, that's why we don't + * do it. + */ + len = read_from_input_buf(buf, (long)maxlen); + if (len > 0) + return len; + continue; + } - /* - * For some terminals we only get one character at a time. - * We want the get all available characters, so we could keep on - * trying until none is available - * For some other terminals this is quite slow, that's why we don't do - * it. - */ - len = read_from_input_buf(buf, (long)maxlen); - if (len > 0) - { -#ifdef OS2 - int i; + /* no character available */ +#if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) + /* estimate the elapsed time */ + elapsed_time += wait_time; +#endif - for (i = 0; i < len; i++) - if (buf[i] == 0) - buf[i] = K_NUL; + if (do_resize /* interrupted by SIGWINCH signal */ +#if defined(FEAT_CLIENTSERVER) && !defined(MAC_CLIENTSERVER) + || server_waiting() #endif - return len; - } +#ifdef MESSAGE_QUEUE + || interrupted +#endif + || wait_time > 0 + || (wtime < 0 && !did_start_blocking)) + continue; + + /* no character available or interrupted */ + break; } + return 0; } static void -handle_resize() +handle_resize(void) { do_resize = FALSE; shell_resized(); } /* - * return non-zero if a character is available + * Return non-zero if a character is available. + */ + int +mch_char_avail(void) +{ + return WaitForChar(0L, NULL, FALSE); +} + +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * Check for any pending input or messages. */ int -mch_char_avail() +mch_check_messages(void) { - return WaitForChar(0L); + return WaitForChar(0L, NULL, TRUE); } +#endif #if defined(HAVE_TOTAL_MEM) || defined(PROTO) # ifdef HAVE_SYS_RESOURCE_H @@ -506,34 +563,88 @@ mch_char_avail() # if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) # include <sys/sysinfo.h> # endif +# ifdef MACOS_X +# include <mach/mach_host.h> +# include <mach/mach_port.h> +# endif /* * Return total amount of memory available in Kbyte. * Doesn't change when memory has been allocated. */ long_u -mch_total_mem(special) - int special UNUSED; +mch_total_mem(int special UNUSED) { -# ifdef __EMX__ - return ulimit(3, 0L) >> 10; /* always 32MB? */ -# else long_u mem = 0; long_u shiftright = 10; /* how much to shift "mem" right for Kbyte */ -# ifdef HAVE_SYSCTL - int mib[2], physmem; - size_t len; +# ifdef MACOS_X + { + /* Mac (Darwin) way of getting the amount of RAM available */ + mach_port_t host = mach_host_self(); + kern_return_t kret; +# ifdef HOST_VM_INFO64 + struct vm_statistics64 vm_stat; + natural_t count = HOST_VM_INFO64_COUNT; + + kret = host_statistics64(host, HOST_VM_INFO64, + (host_info64_t)&vm_stat, &count); +# else + struct vm_statistics vm_stat; + natural_t count = HOST_VM_INFO_COUNT; + + kret = host_statistics(host, HOST_VM_INFO, + (host_info_t)&vm_stat, &count); +# endif + if (kret == KERN_SUCCESS) + /* get the amount of user memory by summing each usage */ + mem = (long_u)(vm_stat.free_count + vm_stat.active_count + + vm_stat.inactive_count +# ifdef MAC_OS_X_VERSION_10_9 + + vm_stat.compressor_page_count +# endif + ) * sysconf(_SC_PAGESIZE); + mach_port_deallocate(mach_task_self(), host); + } +# endif + +# ifdef HAVE_SYSCTL + if (mem == 0) + { + /* BSD way of getting the amount of RAM available. */ + int mib[2]; + size_t len = sizeof(long_u); +# ifdef HW_USERMEM64 + long_u physmem; +# else + /* sysctl() may return 32 bit or 64 bit, accept both */ + union { + int_u u32; + long_u u64; + } physmem; +# endif - /* BSD way of getting the amount of RAM available. */ - mib[0] = CTL_HW; - mib[1] = HW_USERMEM; - len = sizeof(physmem); - if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0) - mem = (long_u)physmem; + mib[0] = CTL_HW; +# ifdef HW_USERMEM64 + mib[1] = HW_USERMEM64; +# else + mib[1] = HW_USERMEM; +# endif + if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0) + { +# ifdef HW_USERMEM64 + mem = (long_u)physmem; +# else + if (len == sizeof(physmem.u64)) + mem = (long_u)physmem.u64; + else + mem = (long_u)physmem.u32; # endif + } + } +# endif -# if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) +# if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) if (mem == 0) { struct sysinfo sinfo; @@ -541,7 +652,7 @@ mch_total_mem(special) /* Linux way of getting amount of RAM available */ if (sysinfo(&sinfo) == 0) { -# ifdef HAVE_SYSINFO_MEM_UNIT +# ifdef HAVE_SYSINFO_MEM_UNIT /* avoid overflow as much as possible */ while (shiftright > 0 && (sinfo.mem_unit & 1) == 0) { @@ -549,14 +660,14 @@ mch_total_mem(special) --shiftright; } mem = sinfo.totalram * sinfo.mem_unit; -# else +# else mem = sinfo.totalram; -# endif +# endif } } -# endif +# endif -# ifdef HAVE_SYSCONF +# ifdef HAVE_SYSCONF if (mem == 0) { long pagesize, pagecount; @@ -575,19 +686,19 @@ mch_total_mem(special) mem = (long_u)pagesize * pagecount; } } -# endif +# endif /* Return the minimum of the physical memory and the user limit, because * using more than the user limit may cause Vim to be terminated. */ -# if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) +# if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) { struct rlimit rlp; if (getrlimit(RLIMIT_DATA, &rlp) == 0 && rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1)) -# ifdef RLIM_INFINITY +# ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY -# endif +# endif && ((long_u)rlp.rlim_cur >> 10) < (mem >> shiftright) ) { @@ -595,19 +706,16 @@ mch_total_mem(special) shiftright = 10; } } -# endif +# endif if (mem > 0) return mem >> shiftright; return (long_u)0x1fffff; -# endif } #endif void -mch_delay(msec, ignoreinput) - long msec; - int ignoreinput; +mch_delay(long msec, int ignoreinput) { int old_tmode; #ifdef FEAT_MZSCHEME @@ -659,9 +767,6 @@ mch_delay(msec, ignoreinput) # ifndef HAVE_SELECT poll(NULL, 0, (int)msec); # else -# ifdef __EMX__ - _sleep2(msec); -# else { struct timeval tv; @@ -673,7 +778,6 @@ mch_delay(msec, ignoreinput) */ select(0, NULL, NULL, NULL, &tv); } -# endif /* __EMX__ */ # endif /* HAVE_SELECT */ # endif /* HAVE_NANOSLEEP */ #endif /* HAVE_USLEEP */ @@ -686,7 +790,7 @@ mch_delay(msec, ignoreinput) in_mch_delay = FALSE; } else - WaitForChar(msec); + WaitForChar(msec, NULL, FALSE); } #if defined(HAVE_STACK_LIMIT) \ @@ -700,7 +804,7 @@ mch_delay(msec, ignoreinput) * Return a pointer to an item on the stack. Used to find out if the stack * grows up or down. */ -static void check_stack_growth __ARGS((char *p)); +static void check_stack_growth(char *p); static int stack_grows_downwards; /* @@ -708,8 +812,7 @@ static int stack_grows_downwards; * "p" points to a variable on the stack of the caller. */ static void -check_stack_growth(p) - char *p; +check_stack_growth(char *p) { int i; @@ -731,7 +834,7 @@ static char *stack_limit = NULL; * deathtrap(). */ static void -get_stack_limit() +get_stack_limit(void) { struct rlimit rlp; int i; @@ -785,8 +888,7 @@ get_stack_limit() * "p" must point to any variable local to the caller that's on the stack. */ int -mch_stackcheck(p) - char *p; +mch_stackcheck(char *p) { if (stack_limit != NULL) { @@ -810,10 +912,6 @@ mch_stackcheck(p) * completely full. */ -#if defined(HAVE_AVAILABILITYMACROS_H) -# include <AvailabilityMacros.h> -#endif - #ifndef SIGSTKSZ # define SIGSTKSZ 8000 /* just a guess of how much stack is needed... */ #endif @@ -824,22 +922,15 @@ static stack_t sigstk; /* for sigaltstack() */ static struct sigstack sigstk; /* for sigstack() */ # endif -static void init_signal_stack __ARGS((void)); +static void init_signal_stack(void); static char *signal_stack; static void -init_signal_stack() +init_signal_stack(void) { if (signal_stack != NULL) { # ifdef HAVE_SIGALTSTACK -# if defined(__APPLE__) && (!defined(MAC_OS_X_VERSION_MAX_ALLOWED) \ - || MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) - /* missing prototype. Adding it to osdef?.h.in doesn't work, because - * "struct sigaltstack" needs to be declared. */ - extern int sigaltstack __ARGS((const struct sigaltstack *ss, struct sigaltstack *oss)); -# endif - # ifdef HAVE_SS_BASE sigstk.ss_base = signal_stack; # else @@ -940,7 +1031,7 @@ sig_alarm SIGDEFARG(sigarg) * problem and LONGJMP() was used. */ void -mch_startjmp() +mch_startjmp(void) { #ifdef SIGHASARG lc_signal = 0; @@ -949,13 +1040,13 @@ mch_startjmp() } void -mch_endjmp() +mch_endjmp(void) { lc_active = FALSE; } void -mch_didjmp() +mch_didjmp(void) { # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) /* On FreeBSD the signal stack has to be reset after using siglongjmp(), @@ -1039,10 +1130,15 @@ deathtrap SIGDEFARG(sigarg) /* Remember how often we have been called. */ ++entered; + /* Executing autocommands is likely to use more stack space than we have + * available in the signal stack. */ + block_autocmds(); + #ifdef FEAT_EVAL /* Set the v:dying variable. */ set_vim_var_nr(VV_DYING, (long)entered); #endif + v_dying = entered; #ifdef HAVE_STACK_LIMIT /* Since we are now using the signal stack, need to reset the stack @@ -1120,6 +1216,8 @@ deathtrap SIGDEFARG(sigarg) * calling free(). */ preserve_exit(); + /* NOTREACHED */ + #ifdef NBDEBUG reset_signals(); may_core_dump(); @@ -1141,7 +1239,7 @@ deathtrap SIGDEFARG(sigarg) * volatile because it is used in signal handler sigcont_handler(). */ static volatile int sigcont_received; -static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG); +static RETSIGTYPE sigcont_handler SIGPROTOARG; /* * signal handler for SIGCONT @@ -1155,10 +1253,10 @@ sigcont_handler SIGDEFARG(sigarg) #endif # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) -static void loose_clipboard __ARGS((void)); +static void loose_clipboard(void); # ifdef USE_SYSTEM -static void save_clipboard __ARGS((void)); -static void restore_clipboard __ARGS((void)); +static void save_clipboard(void); +static void restore_clipboard(void); static void *clip_star_save = NULL; static void *clip_plus_save = NULL; @@ -1170,7 +1268,7 @@ static void *clip_plus_save = NULL; * other applications will hang. But first copy the text to cut buffer 0. */ static void -loose_clipboard() +loose_clipboard(void) { if (clip_star.owned || clip_plus.owned) { @@ -1189,7 +1287,7 @@ loose_clipboard() * Save clipboard text to restore later. */ static void -save_clipboard() +save_clipboard(void) { if (clip_star.owned) clip_star_save = get_register('*', TRUE); @@ -1201,7 +1299,7 @@ save_clipboard() * Restore clipboard text if no one own the X selection. */ static void -restore_clipboard() +restore_clipboard(void) { if (clip_star_save != NULL) { @@ -1228,7 +1326,7 @@ restore_clipboard() * otherwise fake it by starting a new shell. */ void -mch_suspend() +mch_suspend(void) { /* BeOS does have SIGTSTP, but it doesn't work. */ #if defined(SIGTSTP) && !defined(__BEOS__) @@ -1268,8 +1366,7 @@ mch_suspend() /* * Set oldtitle to NULL, so the current title is obtained again. */ - vim_free(oldtitle); - oldtitle = NULL; + VIM_CLEAR(oldtitle); # endif settmode(TMODE_RAW); need_check_timestamps = TRUE; @@ -1280,7 +1377,7 @@ mch_suspend() } void -mch_init() +mch_init(void) { Columns = 80; Rows = 24; @@ -1297,7 +1394,7 @@ mch_init() } static void -set_signals() +set_signals(void) { #if defined(SIGWINCH) /* @@ -1362,14 +1459,14 @@ set_signals() * Catch CTRL-C (only works while in Cooked mode). */ static void -catch_int_signal() +catch_int_signal(void) { signal(SIGINT, (RETSIGTYPE (*)())catch_sigint); } #endif void -reset_signals() +reset_signals(void) { catch_signals(SIG_DFL, SIG_DFL); #if defined(_REENTRANT) && defined(SIGCONT) @@ -1379,9 +1476,9 @@ reset_signals() } static void -catch_signals(func_deadly, func_other) - RETSIGTYPE (*func_deadly)(); - RETSIGTYPE (*func_other)(); +catch_signals( + RETSIGTYPE (*func_deadly)(), + RETSIGTYPE (*func_other)()) { int i; @@ -1423,6 +1520,33 @@ catch_signals(func_deadly, func_other) signal(signal_info[i].sig, func_other); } +#ifdef HAVE_SIGPROCMASK + static void +block_signals(sigset_t *set) +{ + sigset_t newset; + int i; + + sigemptyset(&newset); + + for (i = 0; signal_info[i].sig != -1; i++) + sigaddset(&newset, signal_info[i].sig); + +# if defined(_REENTRANT) && defined(SIGCONT) + /* SIGCONT isn't in the list, because its default action is ignore */ + sigaddset(&newset, SIGCONT); +# endif + + sigprocmask(SIG_BLOCK, &newset, set); +} + + static void +unblock_signals(sigset_t *set) +{ + sigprocmask(SIG_SETMASK, set, NULL); +} +#endif + /* * Handling of SIGHUP, SIGQUIT and SIGTERM: * "when" == a signal: when busy, postpone and return FALSE, otherwise @@ -1433,8 +1557,7 @@ catch_signals(func_deadly, func_other) * Returns TRUE when Vim should exit. */ int -vim_handle_signal(sig) - int sig; +vim_handle_signal(int sig) { static int got_signal = 0; static int blocked = TRUE; @@ -1468,18 +1591,8 @@ vim_handle_signal(sig) * Check_win checks whether we have an interactive stdout. */ int -mch_check_win(argc, argv) - int argc UNUSED; - char **argv UNUSED; +mch_check_win(int argc UNUSED, char **argv UNUSED) { -#ifdef OS2 - /* - * Store argv[0], may be used for $VIM. Only use it if it is an absolute - * name, mostly it's just "vim" and found in the path, which is unusable. - */ - if (mch_isFullName(argv[0])) - exe_name = vim_strsave((char_u *)argv[0]); -#endif if (isatty(1)) return OK; return FAIL; @@ -1489,7 +1602,7 @@ mch_check_win(argc, argv) * Return TRUE if the input comes from a terminal, FALSE otherwise. */ int -mch_input_isatty() +mch_input_isatty(void) { if (isatty(read_cmd_fd)) return TRUE; @@ -1498,25 +1611,16 @@ mch_input_isatty() #ifdef FEAT_X11 -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) \ +# if defined(ELAPSED_TIMEVAL) \ && (defined(FEAT_XCLIPBOARD) || defined(FEAT_TITLE)) -static void xopen_message __ARGS((struct timeval *tvp)); - /* * Give a message about the elapsed time for opening the X window. */ static void -xopen_message(tvp) - struct timeval *tvp; /* must contain start time */ +xopen_message(long elapsed_msec) { - struct timeval end_tv; - - /* Compute elapsed time. */ - gettimeofday(&end_tv, NULL); - smsg((char_u *)_("Opening the X display took %ld msec"), - (end_tv.tv_sec - tvp->tv_sec) * 1000L - + (end_tv.tv_usec - tvp->tv_usec) / 1000L); + smsg((char_u *)_("Opening the X display took %ld msec"), elapsed_msec); } # endif #endif @@ -1525,10 +1629,10 @@ xopen_message(tvp) /* * A few functions shared by X11 title and clipboard code. */ -static int x_error_handler __ARGS((Display *dpy, XErrorEvent *error_event)); -static int x_error_check __ARGS((Display *dpy, XErrorEvent *error_event)); -static int x_connect_to_server __ARGS((void)); -static int test_x11_window __ARGS((Display *dpy)); +static int x_error_handler(Display *dpy, XErrorEvent *error_event); +static int x_error_check(Display *dpy, XErrorEvent *error_event); +static int x_connect_to_server(void); +static int test_x11_window(Display *dpy); static int got_x_error = FALSE; @@ -1536,9 +1640,7 @@ static int got_x_error = FALSE; * X Error handler, otherwise X just exits! (very rude) -- webb */ static int -x_error_handler(dpy, error_event) - Display *dpy; - XErrorEvent *error_event; +x_error_handler(Display *dpy, XErrorEvent *error_event) { XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE); STRCAT(IObuff, _("\nVim: Got X error\n")); @@ -1555,9 +1657,7 @@ x_error_handler(dpy, error_event) * Another X Error handler, just used to check for errors. */ static int -x_error_check(dpy, error_event) - Display *dpy UNUSED; - XErrorEvent *error_event UNUSED; +x_error_check(Display *dpy UNUSED, XErrorEvent *error_event UNUSED) { got_x_error = TRUE; return 0; @@ -1568,11 +1668,10 @@ x_error_check(dpy, error_event) /* * An X IO Error handler, used to catch error while opening the display. */ -static int x_IOerror_check __ARGS((Display *dpy)); +static int x_IOerror_check(Display *dpy); static int -x_IOerror_check(dpy) - Display *dpy UNUSED; +x_IOerror_check(Display *dpy UNUSED) { /* This function should not return, it causes exit(). Longjump instead. */ LONGJMP(lc_jump_env, 1); @@ -1585,13 +1684,15 @@ x_IOerror_check(dpy) /* * An X IO Error handler, used to catch terminal errors. */ -static int x_IOerror_handler __ARGS((Display *dpy)); +static int x_IOerror_handler(Display *dpy); +static void may_restore_clipboard(void); +static int xterm_dpy_was_reset = FALSE; static int -x_IOerror_handler(dpy) - Display *dpy UNUSED; +x_IOerror_handler(Display *dpy UNUSED) { xterm_dpy = NULL; + xterm_dpy_was_reset = TRUE; x11_window = 0; x11_display = NULL; xterm_Shell = (Widget)0; @@ -1602,16 +1703,41 @@ x_IOerror_handler(dpy) return 0; /* avoid the compiler complains about missing return value */ # endif } + +/* + * If the X11 connection was lost try to restore it. + * Helps when the X11 server was stopped and restarted while Vim was inactive + * (e.g. through tmux). + */ + static void +may_restore_clipboard(void) +{ + if (xterm_dpy_was_reset) + { + xterm_dpy_was_reset = FALSE; + +# ifndef LESSTIF_VERSION + /* This has been reported to avoid Vim getting stuck. */ + if (app_context != (XtAppContext)NULL) + { + XtDestroyApplicationContext(app_context); + app_context = (XtAppContext)NULL; + x11_display = NULL; /* freed by XtDestroyApplicationContext() */ + } +# endif + + setup_term_clip(); + get_x11_title(FALSE); + } +} #endif /* * Return TRUE when connection to the X server is desired. */ static int -x_connect_to_server() +x_connect_to_server(void) { - regmatch_T regmatch; - #if defined(FEAT_CLIENTSERVER) if (x_force_connect) return TRUE; @@ -1622,9 +1748,7 @@ x_connect_to_server() /* Check for a match with "exclude:" from 'clipboard'. */ if (clip_exclude_prog != NULL) { - regmatch.rm_ic = FALSE; /* Don't ignore case */ - regmatch.regprog = clip_exclude_prog; - if (vim_regexec(®match, T_NAME, (colnr_T)0)) + if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0)) return FALSE; } return TRUE; @@ -1638,8 +1762,7 @@ x_connect_to_server() * user changes his DISPLAY, but not his WINDOWID) -- webb */ static int -test_x11_window(dpy) - Display *dpy; +test_x11_window(Display *dpy) { int (*old_handler)(); XTextProperty text_prop; @@ -1662,7 +1785,7 @@ test_x11_window(dpy) #ifdef FEAT_X11 -static int get_x11_thing __ARGS((int get_title, int test_only)); +static int get_x11_thing(int get_title, int test_only); /* * try to get x11 window and display @@ -1670,7 +1793,7 @@ static int get_x11_thing __ARGS((int get_title, int test_only)); * return FAIL for failure, OK otherwise */ static int -get_x11_windis() +get_x11_windis(void) { char *winid; static int result = -1; @@ -1796,11 +1919,11 @@ get_x11_windis() #endif if (x11_display != NULL) { -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# ifdef ELAPSED_FUNC if (p_verbose > 0) { verbose_enter(); - xopen_message(&start_tv); + xopen_message(ELAPSED_FUNC(start_tv)); verbose_leave(); } # endif @@ -1829,8 +1952,7 @@ get_x11_windis() * Determine original x11 Window Title */ static int -get_x11_title(test_only) - int test_only; +get_x11_title(int test_only) { return get_x11_thing(TRUE, test_only); } @@ -1839,8 +1961,7 @@ get_x11_title(test_only) * Determine original x11 Window icon */ static int -get_x11_icon(test_only) - int test_only; +get_x11_icon(int test_only) { int retval = FALSE; @@ -1859,9 +1980,9 @@ get_x11_icon(test_only) } static int -get_x11_thing(get_title, test_only) - int get_title; /* get title string */ - int test_only; +get_x11_thing( + int get_title, /* get title string */ + int test_only) { XTextProperty text_prop; int retval = FALSE; @@ -1960,9 +2081,12 @@ get_x11_thing(get_title, test_only) return retval; } -/* Are Xutf8 functions available? Avoid error from old compilers. */ +/* Xutf8 functions are not avaialble on older systems. Note that on some + * systems X_HAVE_UTF8_STRING may be defined in a header file but + * Xutf8SetWMProperties() is not in the X11 library. Configure checks for + * that and defines HAVE_XUTF8SETWMPROPERTIES. */ #if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE) -# if X_HAVE_UTF8_STRING +# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES # define USE_UTF8_STRING # endif #endif @@ -1973,8 +2097,7 @@ get_x11_thing(get_title, test_only) * get_x11_windis() must be called before this and have returned OK */ static void -set_x11_title(title) - char_u *title; +set_x11_title(char_u *title) { /* XmbSetWMProperties() and Xutf8SetWMProperties() should use a STRING * when possible, COMPOUND_TEXT otherwise. COMPOUND_TEXT isn't @@ -2013,8 +2136,7 @@ set_x11_title(title) * get_x11_windis() must be called before this and have returned OK */ static void -set_x11_icon(icon) - char_u *icon; +set_x11_icon(char_u *icon) { /* See above for comments about using X*SetWMProperties(). */ #ifdef USE_UTF8_STRING @@ -2046,15 +2168,13 @@ set_x11_icon(icon) #else /* FEAT_X11 */ static int -get_x11_title(test_only) - int test_only UNUSED; +get_x11_title(int test_only UNUSED) { return FALSE; } static int -get_x11_icon(test_only) - int test_only; +get_x11_icon(int test_only) { if (!test_only) { @@ -2069,13 +2189,13 @@ get_x11_icon(test_only) #endif /* FEAT_X11 */ int -mch_can_restore_title() +mch_can_restore_title(void) { return get_x11_title(TRUE); } int -mch_can_restore_icon() +mch_can_restore_icon(void) { return get_x11_icon(TRUE); } @@ -2084,9 +2204,7 @@ mch_can_restore_icon() * Set the window title and icon. */ void -mch_settitle(title, icon) - char_u *title; - char_u *icon; +mch_settitle(char_u *title, char_u *icon) { int type = 0; static int recursive = 0; @@ -2183,8 +2301,7 @@ mch_settitle(title, icon) * 3 restore title and icon */ void -mch_restore_title(which) - int which; +mch_restore_title(int which) { /* only restore the title or icon when it has been set */ mch_settitle(((which & 1) && did_set_title) ? @@ -2199,8 +2316,7 @@ mch_restore_title(which) * Seiichi Sato mentioned that "mlterm" works like xterm. */ int -vim_is_xterm(name) - char_u *name; +vim_is_xterm(char_u *name) { if (name == NULL) return FALSE; @@ -2209,6 +2325,7 @@ vim_is_xterm(name) || STRNICMP(name, "kterm", 5) == 0 || STRNICMP(name, "mlterm", 6) == 0 || STRNICMP(name, "rxvt", 4) == 0 + || STRNICMP(name, "screen.xterm", 12) == 0 || STRCMP(name, "builtin_xterm") == 0); } @@ -2219,11 +2336,15 @@ vim_is_xterm(name) * Relies on term_is_xterm having been set to its correct value. */ int -use_xterm_like_mouse(name) - char_u *name; +use_xterm_like_mouse(char_u *name) { return (name != NULL - && (term_is_xterm || STRNICMP(name, "screen", 6) == 0)); + && (term_is_xterm + || STRNICMP(name, "screen", 6) == 0 + || STRNICMP(name, "tmux", 4) == 0 + || STRICMP(name, "st") == 0 + || STRNICMP(name, "st-", 3) == 0 + || STRNICMP(name, "stterm", 6) == 0)); } #endif @@ -2236,7 +2357,7 @@ use_xterm_like_mouse(name) * Return 4 for "sgr". */ int -use_xterm_mouse() +use_xterm_mouse(void) { if (ttym_flags == TTYM_SGR) return 4; @@ -2251,8 +2372,7 @@ use_xterm_mouse() #endif int -vim_is_iris(name) - char_u *name; +vim_is_iris(char_u *name) { if (name == NULL) return FALSE; @@ -2261,8 +2381,7 @@ vim_is_iris(name) } int -vim_is_vt300(name) - char_u *name; +vim_is_vt300(char_u *name) { if (name == NULL) return FALSE; /* actually all ANSI comp. terminals should be here */ @@ -2277,8 +2396,7 @@ vim_is_vt300(name) * This should include all windowed terminal emulators. */ int -vim_is_fastterm(name) - char_u *name; +vim_is_fastterm(char_u *name) { if (name == NULL) return FALSE; @@ -2287,6 +2405,7 @@ vim_is_fastterm(name) return ( STRNICMP(name, "hpterm", 6) == 0 || STRNICMP(name, "sun-cmd", 7) == 0 || STRNICMP(name, "screen", 6) == 0 + || STRNICMP(name, "tmux", 4) == 0 || STRNICMP(name, "dtterm", 6) == 0); } @@ -2295,9 +2414,7 @@ vim_is_fastterm(name) * Return OK if a name found. */ int -mch_get_user_name(s, len) - char_u *s; - int len; +mch_get_user_name(char_u *s, int len) { #ifdef VMS vim_strncpy(s, (char_u *)cuserid(NULL), len - 1); @@ -2312,10 +2429,7 @@ mch_get_user_name(s, len) * Return OK if a name found. */ int -mch_get_uname(uid, s, len) - uid_t uid; - char_u *s; - int len; +mch_get_uname(uid_t uid, char_u *s, int len) { #if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID) struct passwd *pw; @@ -2337,9 +2451,7 @@ mch_get_uname(uid, s, len) #ifdef HAVE_SYS_UTSNAME_H void -mch_get_host_name(s, len) - char_u *s; - int len; +mch_get_host_name(char_u *s, int len) { struct utsname vutsname; @@ -2355,9 +2467,7 @@ mch_get_host_name(s, len) # endif void -mch_get_host_name(s, len) - char_u *s; - int len; +mch_get_host_name(char_u *s, int len) { # ifdef VAXC vaxc$gethostname((char *)s, len); @@ -2372,17 +2482,16 @@ mch_get_host_name(s, len) * return process ID */ long -mch_get_pid() +mch_get_pid(void) { return (long)getpid(); } #if !defined(HAVE_STRERROR) && defined(USE_GETCWD) -static char *strerror __ARGS((int)); +static char *strerror(int); static char * -strerror(err) - int err; +strerror(int err) { extern int sys_nerr; extern char *sys_errlist[]; @@ -2400,9 +2509,7 @@ strerror(err) * Return OK for success, FAIL for failure. */ int -mch_dirname(buf, len) - char_u *buf; - int len; +mch_dirname(char_u *buf, int len) { #if defined(USE_GETCWD) if (getcwd((char *)buf, len) == NULL) @@ -2416,39 +2523,19 @@ mch_dirname(buf, len) #endif } -#if defined(OS2) || defined(PROTO) -/* - * Replace all slashes by backslashes. - * When 'shellslash' set do it the other way around. - */ - void -slash_adjust(p) - char_u *p; -{ - while (*p) - { - if (*p == psepcN) - *p = psepc; - mb_ptr_adv(p); - } -} -#endif - /* * Get absolute file name into "buf[len]". * * return FAIL for failure, OK for success */ int -mch_FullName(fname, buf, len, force) - char_u *fname, *buf; - int len; - int force; /* also expand when already absolute path */ +mch_FullName( + char_u *fname, + char_u *buf, + int len, + int force) /* also expand when already absolute path */ { int l; -#ifdef OS2 - int only_drive; /* file name is only a drive letter */ -#endif #ifdef HAVE_FCHDIR int fd = -1; static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ @@ -2470,29 +2557,27 @@ mch_FullName(fname, buf, len, force) * This helps for when "/etc/hosts" is a symlink to "c:/something/hosts". */ # if CYGWIN_VERSION_DLL_MAJOR >= 1007 - cygwin_conv_path(CCP_WIN_A_TO_POSIX, fname, posix_fname, MAXPATHL); + /* Use CCP_RELATIVE to avoid that it sometimes returns a path that ends in + * a forward slash. */ + cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, + fname, posix_fname, MAXPATHL); # else cygwin_conv_to_posix_path(fname, posix_fname); # endif fname = posix_fname; #endif - /* expand it if forced or not an absolute path */ - if (force || !mch_isFullName(fname)) + /* Expand it if forced or not an absolute path. + * Do not do it for "/file", the result is always "/". */ + if ((force || !mch_isFullName(fname)) + && ((p = vim_strrchr(fname, '/')) == NULL || p != fname)) { /* * If the file name has a path, change to that directory for a moment, * and then do the getwd() (and get back to where we were). * This will get the correct path name with "../" things. */ -#ifdef OS2 - only_drive = 0; - if (((p = vim_strrchr(fname, '/')) != NULL) - || ((p = vim_strrchr(fname, '\\')) != NULL) - || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) -#else - if ((p = vim_strrchr(fname, '/')) != NULL) -#endif + if (p != NULL) { #ifdef HAVE_FCHDIR /* @@ -2526,15 +2611,6 @@ mch_FullName(fname, buf, len, force) } else { -#ifdef OS2 - /* - * compensate for case where ':' from "D:" was the only - * path separator detected in the file name; the _next_ - * character has to be removed, and then restored later. - */ - if (only_drive) - p++; -#endif /* The directory is copied into buf[], to be able to remove * the file name without changing it (could be a string in * read-only memory) */ @@ -2549,14 +2625,6 @@ mch_FullName(fname, buf, len, force) fname = p + 1; *buf = NUL; } -#ifdef OS2 - if (only_drive) - { - p--; - if (retval != FAIL) - fname--; - } -#endif } } if (mch_dirname(buf, len) == FAIL) @@ -2610,20 +2678,15 @@ mch_FullName(fname, buf, len, force) * Return TRUE if "fname" does not depend on the current directory. */ int -mch_isFullName(fname) - char_u *fname; +mch_isFullName(char_u *fname) { -#ifdef __EMX__ - return _fnisabs(fname); -#else -# ifdef VMS +#ifdef VMS return ( fname[0] == '/' || fname[0] == '.' || strchr((char *)fname,':') || strchr((char *)fname,'"') || (strchr((char *)fname,'[') && strchr((char *)fname,']'))|| (strchr((char *)fname,'<') && strchr((char *)fname,'>')) ); -# else +#else return (*fname == '/' || *fname == '~'); -# endif #endif } @@ -2634,16 +2697,16 @@ mch_isFullName(fname) * Only required for file systems where case is ignored and preserved. */ void -fname_case(name, len) - char_u *name; - int len UNUSED; /* buffer size, only used when name gets longer */ +fname_case( + char_u *name, + int len UNUSED) /* buffer size, only used when name gets longer */ { struct stat st; char_u *slash, *tail; DIR *dirp; struct dirent *dp; - if (lstat((char *)name, &st) >= 0) + if (mch_lstat((char *)name, &st) >= 0) { /* Open the directory where the file is located. */ slash = vim_strrchr(name, '/'); @@ -2676,7 +2739,7 @@ fname_case(name, len) vim_strncpy(newname, name, MAXPATHL); vim_strncpy(newname + (tail - name), (char_u *)dp->d_name, MAXPATHL - (tail - name)); - if (lstat((char *)newname, &st2) >= 0 + if (mch_lstat((char *)newname, &st2) >= 0 && st.st_ino == st2.st_ino && st.st_dev == st2.st_dev) { @@ -2697,8 +2760,7 @@ fname_case(name, len) * Returns -1 when it doesn't exist. */ long -mch_getperm(name) - char_u *name; +mch_getperm(char_u *name) { struct stat statb; @@ -2719,14 +2781,11 @@ mch_getperm(name) } /* - * set file permission for 'name' to 'perm' - * - * return FAIL for failure, OK otherwise + * Set file permission for "name" to "perm". + * Return FAIL for failure, OK otherwise. */ int -mch_setperm(name, perm) - char_u *name; - long perm; +mch_setperm(char_u *name, long perm) { return (chmod((char *) #ifdef VMS @@ -2737,6 +2796,18 @@ mch_setperm(name, perm) (mode_t)perm) == 0 ? OK : FAIL); } +#if defined(HAVE_FCHMOD) || defined(PROTO) +/* + * Set file permission for open file "fd" to "perm". + * Return FAIL for failure, OK otherwise. + */ + int +mch_fsetperm(int fd, long perm) +{ + return (fchmod(fd, (mode_t)perm) == 0 ? OK : FAIL); +} +#endif + #if defined(HAVE_ACL) || defined(PROTO) # ifdef HAVE_SYS_ACL_H # include <sys/acl.h> @@ -2757,9 +2828,7 @@ typedef struct vim_acl_solaris_T { * Copy security info from "from_file" to "to_file". */ void -mch_copy_sec(from_file, to_file) - char_u *from_file; - char_u *to_file; +mch_copy_sec(char_u *from_file, char_u *to_file) { if (from_file == NULL) return; @@ -2813,9 +2882,7 @@ mch_copy_sec(from_file, to_file) * Copy security info from "from_file" to "to_file". */ void -mch_copy_sec(from_file, to_file) - char_u *from_file; - char_u *to_file; +mch_copy_sec(char_u *from_file, char_u *to_file) { static const char * const smack_copied_attributes[] = { @@ -2847,10 +2914,10 @@ mch_copy_sec(from_file, to_file) ret = setxattr((char*)to_file, name, buffer, (size_t)size, 0); if (ret < 0) { - MSG_PUTS(_("Could not set security context ")); - MSG_PUTS(name); - MSG_PUTS(_(" for ")); - msg_outtrans(to_file); + vim_snprintf((char *)IObuff, IOSIZE, + _("Could not set security context %s for %s"), + name, to_file); + msg_outtrans(IObuff); msg_putchar('\n'); } } @@ -2867,11 +2934,11 @@ mch_copy_sec(from_file, to_file) case ERANGE: default: /* no enough size OR unexpected error */ - MSG_PUTS(_("Could not get security context ")); - MSG_PUTS(name); - MSG_PUTS(_(" for ")); - msg_outtrans(from_file); - MSG_PUTS(_(". Removing it!\n")); + vim_snprintf((char *)IObuff, IOSIZE, + _("Could not get security context %s for %s. Removing it!"), + name, from_file); + msg_puts(IObuff); + msg_putchar('\n'); /* FALLTHROUGH to remove the attribute */ case ENODATA: @@ -2891,8 +2958,7 @@ mch_copy_sec(from_file, to_file) * Return NULL if the ACL is not available for whatever reason. */ vim_acl_T -mch_get_acl(fname) - char_u *fname UNUSED; +mch_get_acl(char_u *fname UNUSED) { vim_acl_T ret = NULL; #ifdef HAVE_POSIX_ACL @@ -2959,9 +3025,7 @@ mch_get_acl(fname) * Set the ACL of file "fname" to "acl" (unless it's NULL). */ void -mch_set_acl(fname, aclent) - char_u *fname UNUSED; - vim_acl_T aclent; +mch_set_acl(char_u *fname UNUSED, vim_acl_T aclent) { if (aclent == NULL) return; @@ -2984,8 +3048,7 @@ mch_set_acl(fname, aclent) } void -mch_free_acl(aclent) - vim_acl_T aclent; +mch_free_acl(vim_acl_T aclent) { if (aclent == NULL) return; @@ -3012,20 +3075,18 @@ mch_free_acl(aclent) * Set hidden flag for "name". */ void -mch_hide(name) - char_u *name UNUSED; +mch_hide(char_u *name UNUSED) { /* can't hide a file */ } /* - * return TRUE if "name" is a directory + * return TRUE if "name" is a directory or a symlink to a directory * return FALSE if "name" is not a directory * return FALSE for error */ int -mch_isdir(name) - char_u *name; +mch_isdir(char_u *name) { struct stat statb; @@ -3040,14 +3101,34 @@ mch_isdir(name) #endif } -static int executable_file __ARGS((char_u *name)); +/* + * return TRUE if "name" is a directory, NOT a symlink to a directory + * return FALSE if "name" is not a directory + * return FALSE for error + */ + int +mch_isrealdir(char_u *name) +{ + struct stat statb; + + if (*name == NUL) /* Some stat()s don't flag "" as an error. */ + return FALSE; + if (mch_lstat((char *)name, &statb)) + return FALSE; +#ifdef _POSIX_SOURCE + return (S_ISDIR(statb.st_mode) ? TRUE : FALSE); +#else + return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE); +#endif +} + +static int executable_file(char_u *name); /* * Return 1 if "name" is an executable file, 0 if not or it doesn't exist. */ static int -executable_file(name) - char_u *name; +executable_file(char_u *name) { struct stat st; @@ -3076,27 +3157,29 @@ executable_file(name) } /* - * Return 1 if "name" can be found in $PATH and executed, 0 if not. + * Return TRUE if "name" can be found in $PATH and executed, FALSE if not. + * If "use_path" is FALSE only check if "name" is executable. * Return -1 if unknown. */ int -mch_can_exe(name, path) - char_u *name; - char_u **path; +mch_can_exe(char_u *name, char_u **path, int use_path) { char_u *buf; char_u *p, *e; int retval; - /* If it's an absolute or relative path don't need to use $PATH. */ - if (mch_isFullName(name) || (name[0] == '.' && (name[1] == '/' - || (name[1] == '.' && name[2] == '/')))) + /* When "use_path" is false and if it's an absolute or relative path don't + * need to use $PATH. */ + if (!use_path || mch_isFullName(name) || (name[0] == '.' + && (name[1] == '/' || (name[1] == '.' && name[2] == '/')))) { - if (executable_file(name)) + /* There must be a path separator, files in the current directory + * can't be executed. */ + if (gettail(name) != name && executable_file(name)) { if (path != NULL) { - if (name[0] == '.') + if (name[0] != '/') *path = FullName_save(name, TRUE); else *path = vim_strsave(name); @@ -3135,7 +3218,7 @@ mch_can_exe(name, path) { if (path != NULL) { - if (buf[0] == '.') + if (buf[0] != '/') *path = FullName_save(buf, TRUE); else *path = vim_strsave(buf); @@ -3159,8 +3242,7 @@ mch_can_exe(name, path) * NODE_OTHER: non-writable things */ int -mch_nodetype(name) - char_u *name; +mch_nodetype(char_u *name) { struct stat st; @@ -3168,16 +3250,14 @@ mch_nodetype(name) return NODE_NORMAL; if (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)) return NODE_NORMAL; -#ifndef OS2 if (S_ISBLK(st.st_mode)) /* block device isn't writable */ return NODE_OTHER; -#endif /* Everything else is writable? */ return NODE_WRITABLE; } void -mch_early_init() +mch_early_init(void) { #ifdef HAVE_CHECK_STACK_GROWTH int i; @@ -3208,7 +3288,7 @@ mch_early_init() #if defined(EXITFREE) || defined(PROTO) void -mch_free_mem() +mch_free_mem(void) { # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) if (clip_star.owned) @@ -3241,8 +3321,7 @@ mch_free_mem() XCloseDisplay(x11_display); # endif # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) - vim_free(signal_stack); - signal_stack = NULL; + VIM_CLEAR(signal_stack); # endif # ifdef FEAT_TITLE vim_free(oldtitle); @@ -3251,14 +3330,14 @@ mch_free_mem() } #endif -static void exit_scroll __ARGS((void)); +static void exit_scroll(void); /* * Output a newline when exiting. * Make sure the newline goes to the same stream as the text. */ static void -exit_scroll() +exit_scroll(void) { if (silent_mode) return; @@ -3283,8 +3362,7 @@ exit_scroll() } void -mch_exit(r) - int r; +mch_exit(int r) { exiting = TRUE; @@ -3356,7 +3434,7 @@ mch_exit(r) } static void -may_core_dump() +may_core_dump(void) { if (deadly_signal != 0) { @@ -3368,16 +3446,11 @@ may_core_dump() #ifndef VMS void -mch_settmode(tmode) - int tmode; +mch_settmode(int tmode) { static int first = TRUE; - /* Why is NeXT excluded here (and not in os_unixx.h)? */ -#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__) - /* - * for "new" tty systems - */ +#ifdef NEW_TTY_SYSTEM # ifdef HAVE_TERMIOS_H static struct termios told; struct termios tnew; @@ -3416,7 +3489,13 @@ mch_settmode(tmode) tnew.c_cc[VTIME] = 0; /* don't wait */ } else if (tmode == TMODE_SLEEP) - tnew.c_lflag &= ~(ECHO); + { + /* Also reset ICANON here, otherwise on Solaris select() won't see + * typeahead characters. */ + tnew.c_lflag &= ~(ICANON | ECHO); + tnew.c_cc[VMIN] = 1; /* return after 1 char */ + tnew.c_cc[VTIME] = 0; /* don't wait */ + } # if defined(HAVE_TERMIOS_H) { @@ -3433,7 +3512,6 @@ mch_settmode(tmode) # endif #else - /* * for "old" tty systems */ @@ -3472,66 +3550,98 @@ mch_settmode(tmode) * doing forward deletes for no reason. (Eric Fischer) */ void -get_stty() +get_stty(void) { - char_u buf[2]; - char_u *p; + ttyinfo_T info; + char_u buf[2]; + char_u *p; - /* Why is NeXT excluded here (and not in os_unixx.h)? */ -#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__) - /* for "new" tty systems */ + if (get_tty_info(read_cmd_fd, &info) == OK) + { + intr_char = info.interrupt; + buf[0] = info.backspace; + buf[1] = NUL; + add_termcode((char_u *)"kb", buf, FALSE); + + /* If <BS> and <DEL> are now the same, redefine <DEL>. */ + p = find_termcode((char_u *)"kD"); + if (p != NULL && p[0] == buf[0] && p[1] == buf[1]) + do_fixdel(NULL); + } +} + +/* + * Obtain the characters that Backspace and Enter produce on "fd". + * Returns OK or FAIL. + */ + int +get_tty_info(int fd, ttyinfo_T *info) +{ +#ifdef NEW_TTY_SYSTEM # ifdef HAVE_TERMIOS_H struct termios keys; # else struct termio keys; # endif + if ( # if defined(HAVE_TERMIOS_H) - if (tcgetattr(read_cmd_fd, &keys) != -1) + tcgetattr(fd, &keys) != -1 # else - if (ioctl(read_cmd_fd, TCGETA, &keys) != -1) + ioctl(fd, TCGETA, &keys) != -1 # endif + ) { - buf[0] = keys.c_cc[VERASE]; - intr_char = keys.c_cc[VINTR]; + info->backspace = keys.c_cc[VERASE]; + info->interrupt = keys.c_cc[VINTR]; + if (keys.c_iflag & ICRNL) + info->enter = NL; + else + info->enter = CAR; + if (keys.c_oflag & ONLCR) + info->nl_does_cr = TRUE; + else + info->nl_does_cr = FALSE; + return OK; + } #else /* for "old" tty systems */ struct sgttyb keys; - if (ioctl(read_cmd_fd, TIOCGETP, &keys) != -1) + if (ioctl(fd, TIOCGETP, &keys) != -1) { - buf[0] = keys.sg_erase; - intr_char = keys.sg_kill; -#endif - buf[1] = NUL; - add_termcode((char_u *)"kb", buf, FALSE); - - /* - * If <BS> and <DEL> are now the same, redefine <DEL>. - */ - p = find_termcode((char_u *)"kD"); - if (p != NULL && p[0] == buf[0] && p[1] == buf[1]) - do_fixdel(NULL); + info->backspace = keys.sg_erase; + info->interrupt = keys.sg_kill; + info->enter = CAR; + info->nl_does_cr = TRUE; + return OK; } -#if 0 - } /* to keep cindent happy */ #endif + return FAIL; } #endif /* VMS */ #if defined(FEAT_MOUSE_TTY) || defined(PROTO) +static int mouse_ison = FALSE; + /* * Set mouse clicks on or off. */ void -mch_setmouse(on) - int on; +mch_setmouse(int on) { - static int ison = FALSE; +# ifdef FEAT_BEVAL_TERM + static int bevalterm_ison = FALSE; +# endif int xterm_mouse_vers; - if (on == ison) /* return quickly if nothing to do */ + if (on == mouse_ison +# ifdef FEAT_BEVAL_TERM + && p_bevalterm == bevalterm_ison +# endif + ) + /* return quickly if nothing to do */ return; xterm_mouse_vers = use_xterm_mouse(); @@ -3543,18 +3653,30 @@ mch_setmouse(on) (on ? IF_EB("\033[?1015h", ESC_STR "[?1015h") : IF_EB("\033[?1015l", ESC_STR "[?1015l"))); - ison = on; + mouse_ison = on; } # endif # ifdef FEAT_MOUSE_SGR if (ttym_flags == TTYM_SGR) { + /* SGR mode supports columns above 223 */ out_str_nf((char_u *) (on ? IF_EB("\033[?1006h", ESC_STR "[?1006h") : IF_EB("\033[?1006l", ESC_STR "[?1006l"))); - ison = on; + mouse_ison = on; + } +# endif + +# ifdef FEAT_BEVAL_TERM + if (bevalterm_ison != (p_bevalterm && on)) + { + bevalterm_ison = (p_bevalterm && on); + if (xterm_mouse_vers > 1 && !bevalterm_ison) + /* disable mouse movement events, enabling is below */ + out_str_nf((char_u *) + (IF_EB("\033[?1003l", ESC_STR "[?1003l"))); } # endif @@ -3563,14 +3685,19 @@ mch_setmouse(on) if (on) /* enable mouse events, use mouse tracking if available */ out_str_nf((char_u *) (xterm_mouse_vers > 1 - ? IF_EB("\033[?1002h", ESC_STR "[?1002h") + ? ( +# ifdef FEAT_BEVAL_TERM + bevalterm_ison + ? IF_EB("\033[?1003h", ESC_STR "[?1003h") : +# endif + IF_EB("\033[?1002h", ESC_STR "[?1002h")) : IF_EB("\033[?1000h", ESC_STR "[?1000h"))); else /* disable mouse events, could probably always send the same */ out_str_nf((char_u *) (xterm_mouse_vers > 1 ? IF_EB("\033[?1002l", ESC_STR "[?1002l") : IF_EB("\033[?1000l", ESC_STR "[?1000l"))); - ison = on; + mouse_ison = on; } # ifdef FEAT_MOUSE_DEC @@ -3580,7 +3707,7 @@ mch_setmouse(on) out_str_nf((char_u *)"\033[1;2'z\033[1;3'{"); else /* disable mouse events */ out_str_nf((char_u *)"\033['z"); - ison = on; + mouse_ison = on; } # endif @@ -3590,12 +3717,12 @@ mch_setmouse(on) if (on) { if (gpm_open()) - ison = TRUE; + mouse_ison = TRUE; } else { gpm_close(); - ison = FALSE; + mouse_ison = FALSE; } } # endif @@ -3606,12 +3733,12 @@ mch_setmouse(on) if (on) { if (sysmouse_open() == OK) - ison = TRUE; + mouse_ison = TRUE; } else { sysmouse_close(); - ison = FALSE; + mouse_ison = FALSE; } } # endif @@ -3644,13 +3771,13 @@ mch_setmouse(on) out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\", ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\")); # endif - ison = TRUE; + mouse_ison = TRUE; } else { out_str_nf((char_u *)IF_EB("\033[0~ZwQ\033\\", ESC_STR "[0~ZwQ" ESC_STR "\\")); - ison = FALSE; + mouse_ison = FALSE; } } # endif @@ -3662,19 +3789,28 @@ mch_setmouse(on) out_str_nf("\033[>1h\033[>6h\033[>7h\033[>1h\033[>9l"); else out_str_nf("\033[>1l\033[>6l\033[>7l\033[>1l\033[>9h"); - ison = on; + mouse_ison = on; } # endif } +#if defined(FEAT_BEVAL_TERM) || defined(PROTO) /* - * Set the mouse termcode, depending on the 'term' and 'ttymouse' options. + * Called when 'balloonevalterm' changed. */ void -check_mouse_termcode() +mch_bevalterm_changed(void) { - xterm_conflict_mouse = FALSE; + mch_setmouse(mouse_ison); +} +#endif +/* + * Set the mouse termcode, depending on the 'term' and 'ttymouse' options. + */ + void +check_mouse_termcode(void) +{ # ifdef FEAT_MOUSE_XTERM if (use_xterm_mouse() # ifdef FEAT_MOUSE_URXVT @@ -3719,7 +3855,7 @@ check_mouse_termcode() # endif # ifdef FEAT_MOUSE_JSB - /* There is no conflict, but it was disabled for xterm before. */ + /* Conflicts with xterm mouse: "\033[" and "\033[M" ??? */ if (!use_xterm_mouse() # ifdef FEAT_GUI && !gui.in_use @@ -3746,45 +3882,30 @@ check_mouse_termcode() # endif # ifdef FEAT_MOUSE_DEC - /* Conflicts with xterm mouse: "\033[" and "\033[M". - * Also conflicts with the xterm termresponse, skip this if it was - * requested already. */ + /* Conflicts with xterm mouse: "\033[" and "\033[M" */ if (!use_xterm_mouse() -# ifdef FEAT_TERMRESPONSE - && !did_request_esc_sequence() -# endif # ifdef FEAT_GUI && !gui.in_use # endif ) - { set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME) ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "["))); - xterm_conflict_mouse = TRUE; - } else del_mouse_termcode(KS_DEC_MOUSE); # endif # ifdef FEAT_MOUSE_PTERM - /* same as the dec mouse */ + /* same conflict as the dec mouse */ if (!use_xterm_mouse() -# ifdef FEAT_TERMRESPONSE - && !did_request_esc_sequence() -# endif # ifdef FEAT_GUI && !gui.in_use # endif ) - { set_mouse_termcode(KS_PTERM_MOUSE, (char_u *) IF_EB("\033[", ESC_STR "[")); - xterm_conflict_mouse = TRUE; - } else del_mouse_termcode(KS_PTERM_MOUSE); # endif # ifdef FEAT_MOUSE_URXVT - /* same as the dec mouse */ if (use_xterm_mouse() == 3 # ifdef FEAT_GUI && !gui.in_use @@ -3792,22 +3913,19 @@ check_mouse_termcode() ) { set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME) - ? IF_EB("\233", CSI_STR) - : IF_EB("\033[", ESC_STR "["))); + ? IF_EB("\233*M", CSI_STR "*M") + : IF_EB("\033[*M", ESC_STR "[*M"))); if (*p_mouse != NUL) { mch_setmouse(FALSE); setmouse(); } - /* It's OK to request the xterm version for uxterm. */ - resume_get_esc_sequence(); } else del_mouse_termcode(KS_URXVT_MOUSE); # endif # ifdef FEAT_MOUSE_SGR - /* There is no conflict with xterm mouse */ if (use_xterm_mouse() == 4 # ifdef FEAT_GUI && !gui.in_use @@ -3815,8 +3933,12 @@ check_mouse_termcode() ) { set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME) - ? IF_EB("\233<", CSI_STR "<") - : IF_EB("\033[<", ESC_STR "[<"))); + ? IF_EB("\233<*M", CSI_STR "<*M") + : IF_EB("\033[<*M", ESC_STR "[<*M"))); + + set_mouse_termcode(KS_SGR_MOUSE_RELEASE, (char_u *)(term_is_8bit(T_NAME) + ? IF_EB("\233<*m", CSI_STR "<*m") + : IF_EB("\033[<*m", ESC_STR "[<*m"))); if (*p_mouse != NUL) { @@ -3825,7 +3947,10 @@ check_mouse_termcode() } } else + { del_mouse_termcode(KS_SGR_MOUSE); + del_mouse_termcode(KS_SGR_MOUSE_RELEASE); + } # endif } #endif @@ -3834,8 +3959,7 @@ check_mouse_termcode() * set screen mode, always fails. */ int -mch_screenmode(arg) - char_u *arg UNUSED; +mch_screenmode(char_u *arg UNUSED) { EMSG(_(e_screenmode)); return FAIL; @@ -3852,25 +3976,12 @@ mch_screenmode(arg) * Return OK when size could be determined, FAIL otherwise. */ int -mch_get_shellsize() +mch_get_shellsize(void) { long rows = 0; long columns = 0; char_u *p; - /* - * For OS/2 use _scrsize(). - */ -# ifdef __EMX__ - { - int s[2]; - - _scrsize(s); - columns = s[0]; - rows = s[1]; - } -# endif - /* * 1. try using an ioctl. It is the most accurate method. * @@ -3942,11 +4053,49 @@ mch_get_shellsize() return OK; } +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * Report the windows size "rows" and "cols" to tty "fd". + */ + int +mch_report_winsize(int fd, int rows, int cols) +{ +# ifdef TIOCSWINSZ + struct winsize ws; + + ws.ws_col = cols; + ws.ws_row = rows; + ws.ws_xpixel = cols * 5; + ws.ws_ypixel = rows * 10; + if (ioctl(fd, TIOCSWINSZ, &ws) == 0) + { + ch_log(NULL, "ioctl(TIOCSWINSZ) success"); + return OK; + } + ch_log(NULL, "ioctl(TIOCSWINSZ) failed"); +# else +# ifdef TIOCSSIZE + struct ttysize ts; + + ts.ts_cols = cols; + ts.ts_lines = rows; + if (ioctl(fd, TIOCSSIZE, &ws) == 0) + { + ch_log(NULL, "ioctl(TIOCSSIZE) success"); + return OK; + } + ch_log(NULL, "ioctl(TIOCSSIZE) failed"); +# endif +# endif + return FAIL; +} +#endif + /* * Try to set the window size to Rows and Columns. */ void -mch_set_shellsize() +mch_set_shellsize(void) { if (*T_CWS) { @@ -3967,7 +4116,7 @@ mch_set_shellsize() * Rows and/or Columns has changed. */ void -mch_new_shellsize() +mch_new_shellsize(void) { /* Nothing to do. */ } @@ -3977,11 +4126,10 @@ mch_new_shellsize() * Return "child" if it exited properly, <= 0 on error. */ static pid_t -wait4pid(child, status) - pid_t child; - waitstatus *status; +wait4pid(pid_t child, waitstatus *status) { pid_t wait_pid = 0; + long delay_msec = 1; while (wait_pid != child) { @@ -3996,8 +4144,10 @@ wait4pid(child, status) # endif if (wait_pid == 0) { - /* Wait for 10 msec before trying again. */ - mch_delay(10L, TRUE); + /* Wait for 1 to 10 msec before trying again. */ + mch_delay(delay_msec, TRUE); + if (++delay_msec > 10) + delay_msec = 10; continue; } if (wait_pid <= 0 @@ -4010,42 +4160,276 @@ wait4pid(child, status) return wait_pid; } - int -mch_call_shell(cmd, options) - char_u *cmd; - int options; /* SHELL_*, see vim.h */ +#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL) +/* + * Set the environment for a child process. + */ + static void +set_child_environment( + long rows, + long columns, + char *term, + int is_terminal UNUSED) { -#ifdef VMS - char *ifn = NULL; - char *ofn = NULL; -#endif - int tmode = cur_tmode; -#ifdef USE_SYSTEM /* use system() to start the shell: simple but slow */ - int x; -# ifndef __EMX__ - char_u *newcmd; /* only needed for unix */ +# ifdef HAVE_SETENV + char envbuf[50]; +# else + static char envbuf_Term[30]; + static char envbuf_Rows[20]; + static char envbuf_Lines[20]; + static char envbuf_Columns[20]; + static char envbuf_Colors[20]; +# ifdef FEAT_TERMINAL + static char envbuf_Version[20]; +# endif +# ifdef FEAT_CLIENTSERVER + static char envbuf_Servername[60]; +# endif +# endif + long colors = +# ifdef FEAT_GUI + gui.in_use ? 256*256*256 : +# endif + t_colors; + +# ifdef HAVE_SETENV + setenv("TERM", term, 1); + sprintf((char *)envbuf, "%ld", rows); + setenv("ROWS", (char *)envbuf, 1); + sprintf((char *)envbuf, "%ld", rows); + setenv("LINES", (char *)envbuf, 1); + sprintf((char *)envbuf, "%ld", columns); + setenv("COLUMNS", (char *)envbuf, 1); + sprintf((char *)envbuf, "%ld", colors); + setenv("COLORS", (char *)envbuf, 1); +# ifdef FEAT_TERMINAL + if (is_terminal) + { + sprintf((char *)envbuf, "%ld", (long)get_vim_var_nr(VV_VERSION)); + setenv("VIM_TERMINAL", (char *)envbuf, 1); + } +# endif +# ifdef FEAT_CLIENTSERVER + setenv("VIM_SERVERNAME", serverName == NULL ? "" : (char *)serverName, 1); +# endif # else /* - * Set the preferred shell in the EMXSHELL environment variable (but - * only if it is different from what is already in the environment). - * Emx then takes care of whether to use "/c" or "-c" in an - * intelligent way. Simply pass the whole thing to emx's system() call. - * Emx also starts an interactive shell if system() is passed an empty - * string. + * Putenv does not copy the string, it has to remain valid. + * Use a static array to avoid losing allocated memory. + * This won't work well when running multiple children... */ - char_u *p, *old; + vim_snprintf(envbuf_Term, sizeof(envbuf_Term), "TERM=%s", term); + putenv(envbuf_Term); + vim_snprintf(envbuf_Rows, sizeof(envbuf_Rows), "ROWS=%ld", rows); + putenv(envbuf_Rows); + vim_snprintf(envbuf_Lines, sizeof(envbuf_Lines), "LINES=%ld", rows); + putenv(envbuf_Lines); + vim_snprintf(envbuf_Columns, sizeof(envbuf_Columns), + "COLUMNS=%ld", columns); + putenv(envbuf_Columns); + vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", colors); + putenv(envbuf_Colors); +# ifdef FEAT_TERMINAL + if (is_terminal) + { + vim_snprintf(envbuf_Version, sizeof(envbuf_Version), + "VIM_TERMINAL=%ld", (long)get_vim_var_nr(VV_VERSION)); + putenv(envbuf_Version); + } +# endif +# ifdef FEAT_CLIENTSERVER + vim_snprintf(envbuf_Servername, sizeof(envbuf_Servername), + "VIM_SERVERNAME=%s", serverName == NULL ? "" : (char *)serverName); + putenv(envbuf_Servername); +# endif +# endif +} + + static void +set_default_child_environment(int is_terminal) +{ + set_child_environment(Rows, Columns, "dumb", is_terminal); +} +#endif - if (((old = (char_u *)getenv("EMXSHELL")) == NULL) || STRCMP(old, p_sh)) +#if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) +/* + * Open a PTY, with FD for the master and slave side. + * When failing "pty_master_fd" and "pty_slave_fd" are -1. + * When successful both file descriptors are stored. + */ + static void +open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **namep) +{ + char *tty_name; + + *pty_master_fd = OpenPTY(&tty_name); /* open pty */ + if (*pty_master_fd >= 0) { - /* should check HAVE_SETENV, but I know we don't have it. */ - p = alloc(10 + strlen(p_sh)); - if (p) + /* Leaving out O_NOCTTY may lead to waitpid() always returning + * 0 on Mac OS X 10.7 thereby causing freezes. Let's assume + * adding O_NOCTTY always works when defined. */ +#ifdef O_NOCTTY + *pty_slave_fd = open(tty_name, O_RDWR | O_NOCTTY | O_EXTRA, 0); +#else + *pty_slave_fd = open(tty_name, O_RDWR | O_EXTRA, 0); +#endif + if (*pty_slave_fd < 0) { - sprintf((char *)p, "EMXSHELL=%s", p_sh); - putenv((char *)p); /* don't free the pointer! */ + close(*pty_master_fd); + *pty_master_fd = -1; } + else if (namep != NULL) + *namep = vim_strsave((char_u *)tty_name); + } +} +#endif + +/* + * Send SIGINT to a child process if "c" is an interrupt character. + */ + void +may_send_sigint(int c UNUSED, pid_t pid UNUSED, pid_t wpid UNUSED) +{ +# ifdef SIGINT + if (c == Ctrl_C || c == intr_char) + { +# ifdef HAVE_SETSID + kill(-pid, SIGINT); +# else + kill(0, SIGINT); +# endif + if (wpid > 0) + kill(wpid, SIGINT); } # endif +} + +#if !defined(USE_SYSTEM) || (defined(FEAT_GUI) && defined(FEAT_TERMINAL)) + + static int +build_argv( + char_u *cmd, + char ***argvp, + char_u **sh_tofree, + char_u **shcf_tofree) +{ + char **argv = NULL; + int argc; + + *sh_tofree = vim_strsave(p_sh); + if (*sh_tofree == NULL) /* out of memory */ + return FAIL; + + if (mch_parse_cmd(*sh_tofree, TRUE, &argv, &argc) == FAIL) + return FAIL; + *argvp = argv; + + if (cmd != NULL) + { + char_u *s; + char_u *p; + + if (extra_shell_arg != NULL) + argv[argc++] = (char *)extra_shell_arg; + + /* Break 'shellcmdflag' into white separated parts. This doesn't + * handle quoted strings, they are very unlikely to appear. */ + *shcf_tofree = alloc((unsigned)STRLEN(p_shcf) + 1); + if (*shcf_tofree == NULL) /* out of memory */ + return FAIL; + s = *shcf_tofree; + p = p_shcf; + while (*p != NUL) + { + argv[argc++] = (char *)s; + while (*p && *p != ' ' && *p != TAB) + *s++ = *p++; + *s++ = NUL; + p = skipwhite(p); + } + + argv[argc++] = (char *)cmd; + } + argv[argc] = NULL; + return OK; +} +#endif + +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) +/* + * Use a terminal window to run a shell command in. + */ + static int +mch_call_shell_terminal( + char_u *cmd, + int options UNUSED) /* SHELL_*, see vim.h */ +{ + jobopt_T opt; + char **argv = NULL; + char_u *tofree1 = NULL; + char_u *tofree2 = NULL; + int retval = -1; + buf_T *buf; + aco_save_T aco; + oparg_T oa; /* operator arguments */ + + if (build_argv(cmd, &argv, &tofree1, &tofree2) == FAIL) + goto theend; + + init_job_options(&opt); + ch_log(NULL, "starting terminal for system command '%s'", cmd); + buf = term_start(NULL, argv, &opt, TERM_START_SYSTEM); + + /* Find a window to make "buf" curbuf. */ + aucmd_prepbuf(&aco, buf); + + clear_oparg(&oa); + while (term_use_loop()) + { + if (oa.op_type == OP_NOP && oa.regname == NUL && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. We don't do redrawing anyway. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else + normal_cmd(&oa, TRUE); + } + retval = 0; + ch_log(NULL, "system command finished"); + + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + + wait_return(TRUE); + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); + +theend: + vim_free(argv); + vim_free(tofree1); + vim_free(tofree2); + return retval; +} +#endif + +#ifdef USE_SYSTEM +/* + * Use system() to start the shell: simple but slow. + */ + static int +mch_call_shell_system( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ +{ +#ifdef VMS + char *ifn = NULL; + char *ofn = NULL; +#endif + int tmode = cur_tmode; + char_u *newcmd; /* only needed for unix */ + int x; out_flush(); #ifdef FEAT_GUI_MACVIM @@ -4063,24 +4447,11 @@ mch_call_shell(cmd, options) loose_clipboard(); # endif -# ifdef __EMX__ - if (cmd == NULL) - x = system(""); /* this starts an interactive shell in emx */ - else - x = system((char *)cmd); - /* system() returns -1 when error occurs in starting shell */ - if (x == -1 && !emsg_silent) - { - MSG_PUTS(_("\nCannot execute shell ")); - msg_outtrans(p_sh); - msg_putchar('\n'); - } -# else /* not __EMX__ */ if (cmd == NULL) x = system((char *)p_sh); else { -# ifdef VMS +# ifdef VMS if (ofn = strchr((char *)cmd, '>')) *ofn++ = '\0'; if (ifn = strchr((char *)cmd, '<')) @@ -4096,7 +4467,7 @@ mch_call_shell(cmd, options) x = vms_sys((char *)cmd, ofn, ifn); else x = system((char *)cmd); -# else +# else newcmd = lalloc(STRLEN(p_sh) + (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg)) + STRLEN(p_shcf) + STRLEN(cmd) + 4, TRUE); @@ -4111,7 +4482,7 @@ mch_call_shell(cmd, options) x = system((char *)newcmd); vim_free(newcmd); } -# endif +# endif } # ifdef VMS x = vms_sys_status(x); @@ -4120,7 +4491,6 @@ mch_call_shell(cmd, options) ; else if (x == 127) MSG_PUTS(_("\nCannot execute shell sh\n")); -# endif /* __EMX__ */ else if (x && !(options & SHELL_SILENT)) { MSG_PUTS(_("\nshell returned ")); @@ -4137,13 +4507,23 @@ mch_call_shell(cmd, options) restore_clipboard(); # endif return x; +} -#else /* USE_SYSTEM */ /* don't use system(), use fork()/exec() */ +#else /* USE_SYSTEM */ # define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use 127, some shells use that already */ +# define OPEN_NULL_FAILED 123 /* Exit code if /dev/null can't be opened */ - char_u *newcmd = NULL; +/* + * Don't use system(), use fork()/exec(). + */ + static int +mch_call_shell_fork( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ +{ + int tmode = cur_tmode; pid_t pid; pid_t wpid = 0; pid_t wait_pid = 0; @@ -4154,31 +4534,18 @@ mch_call_shell(cmd, options) # endif int retval = -1; char **argv = NULL; - int argc; - char_u *p_shcf_copy = NULL; + char_u *tofree1 = NULL; + char_u *tofree2 = NULL; int i; - char_u *p; - int inquote; int pty_master_fd = -1; /* for pty's */ # ifdef FEAT_GUI int pty_slave_fd = -1; - char *tty_name; # endif int fd_toshell[2]; /* for pipes */ int fd_fromshell[2]; int pipe_error = FALSE; -# ifdef HAVE_SETENV - char envbuf[50]; -# else - static char envbuf_Rows[20]; - static char envbuf_Columns[20]; -# endif int did_settmode = FALSE; /* settmode(TMODE_RAW) called */ - newcmd = vim_strsave(p_sh); - if (newcmd == NULL) /* out of memory */ - goto error; - out_flush(); #ifdef FEAT_GUI_MACVIM /* It is conceivable that the shell command will take a long time to finish @@ -4189,79 +4556,8 @@ mch_call_shell(cmd, options) if (options & SHELL_COOKED) settmode(TMODE_COOK); /* set to normal mode */ - /* - * Do this loop twice: - * 1: find number of arguments - * 2: separate them and build argv[] - */ - for (i = 0; i < 2; ++i) - { - p = newcmd; - inquote = FALSE; - argc = 0; - for (;;) - { - if (i == 1) - argv[argc] = (char *)p; - ++argc; - while (*p && (inquote || (*p != ' ' && *p != TAB))) - { - if (*p == '"') - inquote = !inquote; - ++p; - } - if (*p == NUL) - break; - if (i == 1) - *p++ = NUL; - p = skipwhite(p); - } - if (argv == NULL) - { - /* - * Account for possible multiple args in p_shcf. - */ - p = p_shcf; - for (;;) - { - p = skiptowhite(p); - if (*p == NUL) - break; - ++argc; - p = skipwhite(p); - } - - argv = (char **)alloc((unsigned)((argc + 4) * sizeof(char *))); - if (argv == NULL) /* out of memory */ - goto error; - } - } - if (cmd != NULL) - { - char_u *s; - - if (extra_shell_arg != NULL) - argv[argc++] = (char *)extra_shell_arg; - - /* Break 'shellcmdflag' into white separated parts. This doesn't - * handle quoted strings, they are very unlikely to appear. */ - p_shcf_copy = alloc((unsigned)STRLEN(p_shcf) + 1); - if (p_shcf_copy == NULL) /* out of memory */ - goto error; - s = p_shcf_copy; - p = p_shcf; - while (*p != NUL) - { - argv[argc++] = (char *)s; - while (*p && *p != ' ' && *p != TAB) - *s++ = *p++; - *s++ = NUL; - p = skipwhite(p); - } - - argv[argc++] = (char *)cmd; - } - argv[argc] = NULL; + if (build_argv(cmd, &argv, &tofree1, &tofree2) == FAIL) + goto error; /* * For the GUI, when writing the output into the buffer and when reading @@ -4281,25 +4577,7 @@ mch_call_shell(cmd, options) * If the slave can't be opened, close the master pty. */ if (p_guipty && !(options & (SHELL_READ|SHELL_WRITE))) - { - pty_master_fd = OpenPTY(&tty_name); /* open pty */ - if (pty_master_fd >= 0) - { - /* Leaving out O_NOCTTY may lead to waitpid() always returning - * 0 on Mac OS X 10.7 thereby causing freezes. Let's assume - * adding O_NOCTTY always works when defined. */ -#ifdef O_NOCTTY - pty_slave_fd = open(tty_name, O_RDWR | O_NOCTTY | O_EXTRA, 0); -#else - pty_slave_fd = open(tty_name, O_RDWR | O_EXTRA, 0); -#endif - if (pty_slave_fd < 0) - { - close(pty_master_fd); - pty_master_fd = -1; - } - } - } + open_pty(&pty_master_fd, &pty_slave_fd, NULL); /* * If not opening a pty or it didn't work, try using pipes. */ @@ -4326,12 +4604,18 @@ mch_call_shell(cmd, options) if (!pipe_error) /* pty or pipe opened or not used */ { + SIGSET_DECL(curset) + # ifdef __BEOS__ beos_cleanup_read_thread(); # endif - if ((pid = fork()) == -1) /* maybe we should use vfork() */ + BLOCK_SIGNALS(&curset); + pid = fork(); /* maybe we should use vfork() */ + if (pid == -1) { + UNBLOCK_SIGNALS(&curset); + MSG_PUTS(_("\nCannot fork\n")); if ((options & (SHELL_READ|SHELL_WRITE)) # ifdef FEAT_GUI @@ -4358,6 +4642,13 @@ mch_call_shell(cmd, options) else if (pid == 0) /* child */ { reset_signals(); /* handle signals normally */ + UNBLOCK_SIGNALS(&curset); + +# ifdef FEAT_JOB_CHANNEL + if (ch_log_active()) + /* close the log file in the child */ + ch_logfile((char_u *)"", (char_u *)""); +# endif if (!show_shell_mess || (options & SHELL_EXPAND)) { @@ -4432,28 +4723,7 @@ mch_call_shell(cmd, options) # endif } # endif - /* Simulate to have a dumb terminal (for now) */ -# ifdef HAVE_SETENV - setenv("TERM", "dumb", 1); - sprintf((char *)envbuf, "%ld", Rows); - setenv("ROWS", (char *)envbuf, 1); - sprintf((char *)envbuf, "%ld", Rows); - setenv("LINES", (char *)envbuf, 1); - sprintf((char *)envbuf, "%ld", Columns); - setenv("COLUMNS", (char *)envbuf, 1); -# else - /* - * Putenv does not copy the string, it has to remain valid. - * Use a static array to avoid losing allocated memory. - */ - putenv("TERM=dumb"); - sprintf(envbuf_Rows, "ROWS=%ld", Rows); - putenv(envbuf_Rows); - sprintf(envbuf_Rows, "LINES=%ld", Rows); - putenv(envbuf_Rows); - sprintf(envbuf_Columns, "COLUMNS=%ld", Columns); - putenv(envbuf_Columns); -# endif + set_default_child_environment(FALSE); /* * stderr is only redirected when using the GUI, so that a @@ -4522,7 +4792,10 @@ mch_call_shell(cmd, options) */ catch_signals(SIG_IGN, SIG_ERR); catch_int_signal(); - + UNBLOCK_SIGNALS(&curset); +# ifdef FEAT_JOB_CHANNEL + ++dont_check_job_ended; +# endif /* * For the GUI we redirect stdin, stdout and stderr to our window. * This is also used to pipe stdin/stdout to/from the external @@ -4626,7 +4899,8 @@ mch_call_shell(cmd, options) /* Finished a line, add a NL, unless this line * should not have one. */ if (lnum != curbuf->b_op_end.lnum - || !curbuf->b_p_bin + || (!curbuf->b_p_bin + && curbuf->b_p_fixeol) || (lnum != curbuf->b_no_eol_lnum && (lnum != curbuf->b_ml.ml_line_count @@ -4660,8 +4934,8 @@ mch_call_shell(cmd, options) ga_init2(&ga, 1, BUFLEN); noread_cnt = 0; -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) - gettimeofday(&start_tv, NULL); +# ifdef ELAPSED_FUNC + ELAPSED_INIT(start_tv); # endif for (;;) { @@ -4696,8 +4970,8 @@ mch_call_shell(cmd, options) /* Get extra characters when we don't have any. * Reset the counter and timer. */ noread_cnt = 0; -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) - gettimeofday(&start_tv, NULL); +# ifdef ELAPSED_FUNC + ELAPSED_INIT(start_tv); # endif len = ui_inchar(ta_buf, BUFLEN, 10L, 0); } @@ -4710,23 +4984,12 @@ mch_call_shell(cmd, options) */ if (len == 1 && (pty_master_fd < 0 || cmd != NULL)) { -# ifdef SIGINT /* * Send SIGINT to the child's group or all * processes in our group. */ - if (ta_buf[ta_len] == Ctrl_C - || ta_buf[ta_len] == intr_char) - { -# ifdef HAVE_SETSID - kill(-pid, SIGINT); -# else - kill(0, SIGINT); -# endif - if (wpid > 0) - kill(wpid, SIGINT); - } -# endif + may_send_sigint(ta_buf[ta_len], pid, wpid); + if (pty_master_fd < 0 && toshell_fd >= 0 && ta_buf[ta_len] == Ctrl_D) { @@ -4834,7 +5097,7 @@ mch_call_shell(cmd, options) * to some terminal (vt52?). */ ++noread_cnt; - while (RealWaitForChar(fromshell_fd, 10L, NULL)) + while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL)) { len = read_eintr(fromshell_fd, buffer # ifdef FEAT_MBYTE @@ -4865,6 +5128,7 @@ mch_call_shell(cmd, options) else if (has_mbyte) { int l; + char_u *p; len += buffer_off; buffer[len] = NUL; @@ -4874,7 +5138,7 @@ mch_call_shell(cmd, options) * round. */ for (p = buffer; p < buffer + len; p += l) { - l = mb_cptr2len(p); + l = MB_CPTR2LEN(p); if (l == 0) l = 1; /* NUL byte? */ else if (MB_BYTE2LEN(*p) != l) @@ -4920,17 +5184,14 @@ mch_call_shell(cmd, options) if (got_int) break; -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# ifdef ELAPSED_FUNC + if (wait_pid == 0) { - struct timeval now_tv; - long msec; + long msec = ELAPSED_FUNC(start_tv); /* Avoid that we keep looping here without * checking for a CTRL-C for a long time. Don't * break out too often to avoid losing typeahead. */ - gettimeofday(&now_tv, NULL); - msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L - + (now_tv.tv_usec - start_tv.tv_usec) / 1000L; if (msec > 2000) { noread_cnt = 5; @@ -4940,10 +5201,15 @@ mch_call_shell(cmd, options) # endif } - /* If we already detected the child has finished break the - * loop now. */ + /* If we already detected the child has finished, continue + * reading output for a short while. Some text may be + * buffered. */ if (wait_pid == pid) + { + if (noread_cnt < 5) + continue; break; + } /* * Check if the child still exists, before checking for @@ -4999,6 +5265,8 @@ mch_call_shell(cmd, options) # if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11) else { + long delay_msec = 1; + /* * Similar to the loop above, but only handle X events, no * I/O. @@ -5031,106 +5299,674 @@ mch_call_shell(cmd, options) /* Handle any X events, e.g. serving the clipboard. */ clip_update(); - mch_delay(10L, TRUE); - } - } + /* Wait for 1 to 10 msec. 1 is faster but gives the child + * less time. */ + mch_delay(delay_msec, TRUE); + if (++delay_msec > 10) + delay_msec = 10; + } + } +# endif + + /* + * Wait until our child has exited. + * Ignore wait() returning pids of other children and returning + * because of some signal like SIGWINCH. + * Don't wait if wait_pid was already set above, indicating the + * child already exited. + */ + if (wait_pid != pid) + wait_pid = wait4pid(pid, &status); + +# ifdef FEAT_GUI + /* Close slave side of pty. Only do this after the child has + * exited, otherwise the child may hang when it tries to write on + * the pty. */ + if (pty_master_fd >= 0) + close(pty_slave_fd); +# endif + + /* Make sure the child that writes to the external program is + * dead. */ + if (wpid > 0) + { + kill(wpid, SIGKILL); + wait4pid(wpid, NULL); + } + +# ifdef FEAT_JOB_CHANNEL + --dont_check_job_ended; +# endif + + /* + * Set to raw mode right now, otherwise a CTRL-C after + * catch_signals() will kill Vim. + */ + if (tmode == TMODE_RAW) + settmode(TMODE_RAW); + did_settmode = TRUE; + set_signals(); + + if (WIFEXITED(status)) + { + /* LINTED avoid "bitwise operation on signed value" */ + retval = WEXITSTATUS(status); + if (retval != 0 && !emsg_silent) + { + if (retval == EXEC_FAILED) + { + MSG_PUTS(_("\nCannot execute shell ")); + msg_outtrans(p_sh); + msg_putchar('\n'); + } + else if (!(options & SHELL_SILENT)) + { + MSG_PUTS(_("\nshell returned ")); + msg_outnum((long)retval); + msg_putchar('\n'); + } + } + } + else + MSG_PUTS(_("\nCommand terminated\n")); + } + } + +error: + if (!did_settmode) + if (tmode == TMODE_RAW) + settmode(TMODE_RAW); /* set to raw mode */ +# ifdef FEAT_TITLE + resettitle(); +# endif + vim_free(argv); + vim_free(tofree1); + vim_free(tofree2); + + return retval; +} +#endif /* USE_SYSTEM */ + + int +mch_call_shell( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ +{ +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) + if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL) + return mch_call_shell_terminal(cmd, options); +#endif +#ifdef USE_SYSTEM + return mch_call_shell_system(cmd, options); +#else + return mch_call_shell_fork(cmd, options); +#endif +} + +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) + void +mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) +{ + pid_t pid; + int fd_in[2] = {-1, -1}; /* for stdin */ + int fd_out[2] = {-1, -1}; /* for stdout */ + int fd_err[2] = {-1, -1}; /* for stderr */ + int pty_master_fd = -1; + int pty_slave_fd = -1; + channel_T *channel = NULL; + int use_null_for_in = options->jo_io[PART_IN] == JIO_NULL; + int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL; + int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL; + int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; + int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE; + int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE; + int use_buffer_for_in = options->jo_io[PART_IN] == JIO_BUFFER; + int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; + SIGSET_DECL(curset) + + if (use_out_for_err && use_null_for_out) + use_null_for_err = TRUE; + + /* default is to fail */ + job->jv_status = JOB_FAILED; + + if (options->jo_pty + && (!(use_file_for_in || use_null_for_in) + || !(use_file_for_in || use_null_for_out) + || !(use_out_for_err || use_file_for_err || use_null_for_err))) + { + open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_out); + if (job->jv_tty_out != NULL) + job->jv_tty_in = vim_strsave(job->jv_tty_out); + } + + /* TODO: without the channel feature connect the child to /dev/null? */ + /* Open pipes for stdin, stdout, stderr. */ + if (use_file_for_in) + { + char_u *fname = options->jo_io_name[PART_IN]; + + fd_in[0] = mch_open((char *)fname, O_RDONLY, 0); + if (fd_in[0] < 0) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else + /* When writing buffer lines to the input don't use the pty, so that + * the pipe can be closed when all lines were written. */ + if (!use_null_for_in && (pty_master_fd < 0 || use_buffer_for_in) + && pipe(fd_in) < 0) + goto failed; + + if (use_file_for_out) + { + char_u *fname = options->jo_io_name[PART_OUT]; + + fd_out[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd_out[1] < 0) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else if (!use_null_for_out && pty_master_fd < 0 && pipe(fd_out) < 0) + goto failed; + + if (use_file_for_err) + { + char_u *fname = options->jo_io_name[PART_ERR]; + + fd_err[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd_err[1] < 0) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else if (!use_out_for_err && !use_null_for_err + && pty_master_fd < 0 && pipe(fd_err) < 0) + goto failed; + + if (!use_null_for_in || !use_null_for_out || !use_null_for_err) + { + if (options->jo_set & JO_CHANNEL) + { + channel = options->jo_channel; + if (channel != NULL) + ++channel->ch_refcount; + } + else + channel = add_channel(); + if (channel == NULL) + goto failed; + if (job->jv_tty_out != NULL) + ch_log(channel, "using pty %s on fd %d", + job->jv_tty_out, pty_master_fd); + } + + BLOCK_SIGNALS(&curset); + pid = fork(); /* maybe we should use vfork() */ + if (pid == -1) + { + /* failed to fork */ + UNBLOCK_SIGNALS(&curset); + goto failed; + } + if (pid == 0) + { + int null_fd = -1; + int stderr_works = TRUE; + + /* child */ + reset_signals(); /* handle signals normally */ + UNBLOCK_SIGNALS(&curset); + +# ifdef FEAT_JOB_CHANNEL + if (ch_log_active()) + /* close the log file in the child */ + ch_logfile((char_u *)"", (char_u *)""); +# endif + +# ifdef HAVE_SETSID + /* Create our own process group, so that the child and all its + * children can be kill()ed. Don't do this when using pipes, + * because stdin is not a tty, we would lose /dev/tty. */ + (void)setsid(); +# endif + +# ifdef FEAT_TERMINAL + if (options->jo_term_rows > 0) + { + char *term = (char *)T_NAME; + +#ifdef FEAT_GUI + if (term_is_gui(T_NAME)) + /* In the GUI 'term' is not what we want, use $TERM. */ + term = getenv("TERM"); +#endif + /* Use 'term' or $TERM if it starts with "xterm", otherwise fall + * back to "xterm". */ + if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0) + term = "xterm"; + set_child_environment( + (long)options->jo_term_rows, + (long)options->jo_term_cols, + term, + is_terminal); + } + else +# endif + set_default_child_environment(is_terminal); + + if (options->jo_env != NULL) + { + dict_T *dict = options->jo_env; + hashitem_T *hi; + int todo = (int)dict->dv_hashtab.ht_used; + + for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + typval_T *item = &dict_lookup(hi)->di_tv; + + vim_setenv((char_u*)hi->hi_key, get_tv_string(item)); + --todo; + } + } + + if (use_null_for_in || use_null_for_out || use_null_for_err) + { + null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0); + if (null_fd < 0) + { + perror("opening /dev/null failed"); + _exit(OPEN_NULL_FAILED); + } + } + + if (pty_slave_fd >= 0) + { + /* push stream discipline modules */ + SetupSlavePTY(pty_slave_fd); +# ifdef TIOCSCTTY + /* Try to become controlling tty (probably doesn't work, + * unless run by root) */ + ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL); +# endif + } + + /* set up stdin for the child */ + close(0); + if (use_null_for_in && null_fd >= 0) + ignored = dup(null_fd); + else if (fd_in[0] < 0) + ignored = dup(pty_slave_fd); + else + ignored = dup(fd_in[0]); + + /* set up stderr for the child */ + close(2); + if (use_null_for_err && null_fd >= 0) + { + ignored = dup(null_fd); + stderr_works = FALSE; + } + else if (use_out_for_err) + ignored = dup(fd_out[1]); + else if (fd_err[1] < 0) + ignored = dup(pty_slave_fd); + else + ignored = dup(fd_err[1]); + + /* set up stdout for the child */ + close(1); + if (use_null_for_out && null_fd >= 0) + ignored = dup(null_fd); + else if (fd_out[1] < 0) + ignored = dup(pty_slave_fd); + else + ignored = dup(fd_out[1]); + + if (fd_in[0] >= 0) + close(fd_in[0]); + if (fd_in[1] >= 0) + close(fd_in[1]); + if (fd_out[0] >= 0) + close(fd_out[0]); + if (fd_out[1] >= 0) + close(fd_out[1]); + if (fd_err[0] >= 0) + close(fd_err[0]); + if (fd_err[1] >= 0) + close(fd_err[1]); + if (pty_master_fd >= 0) + { + close(pty_master_fd); /* not used in the child */ + close(pty_slave_fd); /* was duped above */ + } + + if (null_fd >= 0) + close(null_fd); + + if (options->jo_cwd != NULL && mch_chdir((char *)options->jo_cwd) != 0) + _exit(EXEC_FAILED); + + /* See above for type of argv. */ + execvp(argv[0], argv); + + if (stderr_works) + perror("executing job failed"); +# ifdef EXITFREE + /* calling free_all_mem() here causes problems. Ignore valgrind + * reporting possibly leaked memory. */ +# endif + _exit(EXEC_FAILED); /* exec failed, return failure code */ + } + + /* parent */ + UNBLOCK_SIGNALS(&curset); + + job->jv_pid = pid; + job->jv_status = JOB_STARTED; + job->jv_channel = channel; /* ch_refcount was set above */ + + if (pty_master_fd >= 0) + close(pty_slave_fd); /* not used in the parent */ + /* close child stdin, stdout and stderr */ + if (fd_in[0] >= 0) + close(fd_in[0]); + if (fd_out[1] >= 0) + close(fd_out[1]); + if (fd_err[1] >= 0) + close(fd_err[1]); + if (channel != NULL) + { + int in_fd = use_file_for_in || use_null_for_in + ? INVALID_FD : fd_in[1] < 0 ? pty_master_fd : fd_in[1]; + int out_fd = use_file_for_out || use_null_for_out + ? INVALID_FD : fd_out[0] < 0 ? pty_master_fd : fd_out[0]; + /* When using pty_master_fd only set it for stdout, do not duplicate it + * for stderr, it only needs to be read once. */ + int err_fd = use_out_for_err || use_file_for_err || use_null_for_err + ? INVALID_FD + : fd_err[0] >= 0 + ? fd_err[0] + : (out_fd == pty_master_fd + ? INVALID_FD + : pty_master_fd); + + channel_set_pipes(channel, in_fd, out_fd, err_fd); + channel_set_job(channel, job, options); + } + else + { + if (fd_in[1] >= 0) + close(fd_in[1]); + if (fd_out[0] >= 0) + close(fd_out[0]); + if (fd_err[0] >= 0) + close(fd_err[0]); + if (pty_master_fd >= 0) + close(pty_master_fd); + } + + /* success! */ + return; + +failed: + channel_unref(channel); + if (fd_in[0] >= 0) + close(fd_in[0]); + if (fd_in[1] >= 0) + close(fd_in[1]); + if (fd_out[0] >= 0) + close(fd_out[0]); + if (fd_out[1] >= 0) + close(fd_out[1]); + if (fd_err[0] >= 0) + close(fd_err[0]); + if (fd_err[1] >= 0) + close(fd_err[1]); + if (pty_master_fd >= 0) + close(pty_master_fd); + if (pty_slave_fd >= 0) + close(pty_slave_fd); +} + + char * +mch_job_status(job_T *job) +{ +# ifdef HAVE_UNION_WAIT + union wait status; +# else + int status = -1; +# endif + pid_t wait_pid = 0; + +# ifdef __NeXT__ + wait_pid = wait4(job->jv_pid, &status, WNOHANG, (struct rusage *)0); +# else + wait_pid = waitpid(job->jv_pid, &status, WNOHANG); # endif + if (wait_pid == -1) + { + /* process must have exited */ + if (job->jv_status < JOB_ENDED) + ch_log(job->jv_channel, "Job no longer exists: %s", + strerror(errno)); + goto return_dead; + } + if (wait_pid == 0) + return "run"; + if (WIFEXITED(status)) + { + /* LINTED avoid "bitwise operation on signed value" */ + job->jv_exitval = WEXITSTATUS(status); + if (job->jv_status < JOB_ENDED) + ch_log(job->jv_channel, "Job exited with %d", job->jv_exitval); + goto return_dead; + } + if (WIFSIGNALED(status)) + { + job->jv_exitval = -1; + if (job->jv_status < JOB_ENDED) + ch_log(job->jv_channel, "Job terminated by a signal"); + goto return_dead; + } + return "run"; - /* - * Wait until our child has exited. - * Ignore wait() returning pids of other children and returning - * because of some signal like SIGWINCH. - * Don't wait if wait_pid was already set above, indicating the - * child already exited. - */ - if (wait_pid != pid) - wait_pid = wait4pid(pid, &status); +return_dead: + if (job->jv_status < JOB_ENDED) + job->jv_status = JOB_ENDED; + return "dead"; +} -# ifdef FEAT_GUI - /* Close slave side of pty. Only do this after the child has - * exited, otherwise the child may hang when it tries to write on - * the pty. */ - if (pty_master_fd >= 0) - close(pty_slave_fd); + job_T * +mch_detect_ended_job(job_T *job_list) +{ +# ifdef HAVE_UNION_WAIT + union wait status; +# else + int status = -1; # endif + pid_t wait_pid = 0; + job_T *job; - /* Make sure the child that writes to the external program is - * dead. */ - if (wpid > 0) - { - kill(wpid, SIGKILL); - wait4pid(wpid, NULL); - } - - /* - * Set to raw mode right now, otherwise a CTRL-C after - * catch_signals() will kill Vim. - */ - if (tmode == TMODE_RAW) - settmode(TMODE_RAW); - did_settmode = TRUE; - set_signals(); +# ifndef USE_SYSTEM + /* Do not do this when waiting for a shell command to finish, we would get + * the exit value here (and discard it), the exit value obtained there + * would then be wrong. */ + if (dont_check_job_ended > 0) + return NULL; +# endif +# ifdef __NeXT__ + wait_pid = wait4(-1, &status, WNOHANG, (struct rusage *)0); +# else + wait_pid = waitpid(-1, &status, WNOHANG); +# endif + if (wait_pid <= 0) + /* no process ended */ + return NULL; + for (job = job_list; job != NULL; job = job->jv_next) + { + if (job->jv_pid == wait_pid) + { if (WIFEXITED(status)) - { /* LINTED avoid "bitwise operation on signed value" */ - retval = WEXITSTATUS(status); - if (retval != 0 && !emsg_silent) - { - if (retval == EXEC_FAILED) - { - MSG_PUTS(_("\nCannot execute shell ")); - msg_outtrans(p_sh); - msg_putchar('\n'); - } - else if (!(options & SHELL_SILENT)) - { - MSG_PUTS(_("\nshell returned ")); - msg_outnum((long)retval); - msg_putchar('\n'); - } - } + job->jv_exitval = WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + job->jv_exitval = -1; + if (job->jv_status < JOB_ENDED) + { + ch_log(job->jv_channel, "Job ended"); + job->jv_status = JOB_ENDED; } - else - MSG_PUTS(_("\nCommand terminated\n")); + return job; } } - vim_free(argv); - vim_free(p_shcf_copy); + return NULL; +} -error: - if (!did_settmode) - if (tmode == TMODE_RAW) - settmode(TMODE_RAW); /* set to raw mode */ -# ifdef FEAT_TITLE - resettitle(); +/* + * Send a (deadly) signal to "job". + * Return FAIL if "how" is not a valid name. + */ + int +mch_signal_job(job_T *job, char_u *how) +{ + int sig = -1; + pid_t job_pid; + + if (*how == NUL || STRCMP(how, "term") == 0) + sig = SIGTERM; + else if (STRCMP(how, "hup") == 0) + sig = SIGHUP; + else if (STRCMP(how, "quit") == 0) + sig = SIGQUIT; + else if (STRCMP(how, "int") == 0) + sig = SIGINT; + else if (STRCMP(how, "kill") == 0) + sig = SIGKILL; +#ifdef SIGWINCH + else if (STRCMP(how, "winch") == 0) + sig = SIGWINCH; +#endif + else if (isdigit(*how)) + sig = atoi((char *)how); + else + return FAIL; + + /* TODO: have an option to only kill the process, not the group? */ + job_pid = job->jv_pid; +#ifdef HAVE_GETPGID + if (job_pid == getpgid(job_pid)) + job_pid = -job_pid; +#endif + + /* Never kill ourselves! */ + if (job_pid != 0) + kill(job_pid, sig); + + return OK; +} + +/* + * Clear the data related to "job". + */ + void +mch_clear_job(job_T *job) +{ + /* call waitpid because child process may become zombie */ +# ifdef __NeXT__ + (void)wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0); +# else + (void)waitpid(job->jv_pid, NULL, WNOHANG); # endif - vim_free(newcmd); +} +#endif - return retval; +#if defined(FEAT_TERMINAL) || defined(PROTO) + int +mch_create_pty_channel(job_T *job, jobopt_T *options) +{ + int pty_master_fd = -1; + int pty_slave_fd = -1; + channel_T *channel; -#endif /* USE_SYSTEM */ + open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_out); + if (job->jv_tty_out != NULL) + job->jv_tty_in = vim_strsave(job->jv_tty_out); + close(pty_slave_fd); + + channel = add_channel(); + if (channel == NULL) + { + close(pty_master_fd); + return FAIL; + } + if (job->jv_tty_out != NULL) + ch_log(channel, "using pty %s on fd %d", + job->jv_tty_out, pty_master_fd); + job->jv_channel = channel; /* ch_refcount was set by add_channel() */ + channel->ch_keep_open = TRUE; + + /* Only set the pty_master_fd for stdout, do not duplicate it for stderr, + * it only needs to be read once. */ + channel_set_pipes(channel, pty_master_fd, pty_master_fd, INVALID_FD); + channel_set_job(channel, job, options); + return OK; } +#endif /* * Check for CTRL-C typed by reading all available characters. * In cooked mode we should get SIGINT, no need to check. */ void -mch_breakcheck() +mch_breakcheck(int force) { - if (curr_tmode == TMODE_RAW && RealWaitForChar(read_cmd_fd, 0L, NULL)) + if ((curr_tmode == TMODE_RAW || force) + && RealWaitForChar(read_cmd_fd, 0L, NULL, NULL)) fill_input_buf(FALSE); } /* - * Wait "msec" msec until a character is available from the keyboard or from - * inbuf[]. msec == -1 will block forever. + * Wait "msec" msec until a character is available from the mouse, keyboard, + * from inbuf[]. + * "msec" == -1 will block forever. + * Invokes timer callbacks when needed. + * When "ignore_input" is TRUE even check for pending input when input is + * already available. + * "interrupted" (if not NULL) is set to TRUE when no character is available + * but something else needs to be done. + * Returns TRUE when a character is available. + * When a GUI is being used, this will never get called -- webb + */ + static int +WaitForChar(long msec, int *interrupted, int ignore_input) +{ +#ifdef FEAT_TIMERS + return ui_wait_for_chars_or_timer( + msec, WaitForCharOrMouse, interrupted, ignore_input) == OK; +#else + return WaitForCharOrMouse(msec, interrupted, ignore_input); +#endif +} + +/* + * Wait "msec" msec until a character is available from the mouse or keyboard + * or from inbuf[]. + * "msec" == -1 will block forever. + * for "ignore_input" see WaitForCharOr(). + * "interrupted" (if not NULL) is set to TRUE when no character is available + * but something else needs to be done. * When a GUI is being used, this will never get called -- webb */ static int -WaitForChar(msec) - long msec; +WaitForCharOrMouse(long msec, int *interrupted, int ignore_input) { #ifdef FEAT_MOUSE_GPM int gpm_process_wanted; @@ -5140,7 +5976,7 @@ WaitForChar(msec) #endif int avail; - if (input_available()) /* something in inbuf[] */ + if (!ignore_input && input_available()) /* something in inbuf[] */ return 1; #if defined(FEAT_MOUSE_DEC) @@ -5176,13 +6012,14 @@ WaitForChar(msec) # endif # ifdef FEAT_MOUSE_GPM gpm_process_wanted = 0; - avail = RealWaitForChar(read_cmd_fd, msec, &gpm_process_wanted); + avail = RealWaitForChar(read_cmd_fd, msec, + &gpm_process_wanted, interrupted); # else - avail = RealWaitForChar(read_cmd_fd, msec, NULL); + avail = RealWaitForChar(read_cmd_fd, msec, NULL, interrupted); # endif if (!avail) { - if (input_available()) + if (!ignore_input && input_available()) return 1; # ifdef FEAT_XCLIPBOARD if (rest == 0 || !do_xterm_trace()) @@ -5197,10 +6034,11 @@ WaitForChar(msec) # ifdef FEAT_XCLIPBOARD || (!avail && rest != 0) # endif - ); + ) + ; #else - avail = RealWaitForChar(read_cmd_fd, msec, NULL); + avail = RealWaitForChar(read_cmd_fd, msec, NULL, interrupted); #endif return avail; } @@ -5211,53 +6049,34 @@ WaitForChar(msec) * "msec" == 0 will check for characters once. * "msec" == -1 will block until a character is available. * When a GUI is being used, this will not be used for input -- webb - * Returns also, when a request from Sniff is waiting -- toni. * Or when a Linux GPM mouse event is waiting. + * Or when a clientserver message is on the queue. + * "interrupted" (if not NULL) is set to TRUE when no character is available + * but something else needs to be done. */ #if defined(__BEOS__) int #else - static int + static int #endif -RealWaitForChar(fd, msec, check_for_gpm) - int fd; - long msec; - int *check_for_gpm UNUSED; +RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) { int ret; -#ifdef FEAT_NETBEANS_INTG - int nb_fd = netbeans_filedesc(); -#endif + int result; #if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME) static int busy = FALSE; /* May retry getting characters after an event was handled. */ # define MAY_LOOP -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# ifdef ELAPSED_FUNC /* Remember at what time we started, so that we know how much longer we * should wait after being interrupted. */ -# define USE_START_TV - struct timeval start_tv; + long start_msec = msec; + ELAPSED_TYPE start_tv; - if (msec > 0 && ( -# ifdef FEAT_XCLIPBOARD - xterm_Shell != (Widget)0 -# if defined(USE_XSMP) || defined(FEAT_MZSCHEME) - || -# endif -# endif -# ifdef USE_XSMP - xsmp_icefd != -1 -# ifdef FEAT_MZSCHEME - || -# endif -# endif -# ifdef FEAT_MZSCHEME - (mzthreads_allowed() && p_mzq > 0) -# endif - )) - gettimeofday(&start_tv, NULL); + if (msec > 0) + ELAPSED_INIT(start_tv); # endif /* Handle being called recursively. This may happen for the session @@ -5277,7 +6096,8 @@ RealWaitForChar(fd, msec, check_for_gpm) # endif #endif #ifndef HAVE_SELECT - struct pollfd fds[6]; + /* each channel may use in, out and err */ + struct pollfd fds[6 + 3 * MAX_OPEN_CHANNELS]; int nfd; # ifdef FEAT_XCLIPBOARD int xterm_idx = -1; @@ -5287,9 +6107,6 @@ RealWaitForChar(fd, msec, check_for_gpm) # endif # ifdef USE_XSMP int xsmp_idx = -1; -# endif -# ifdef FEAT_NETBEANS_INTG - int nb_idx = -1; # endif int towait = (int)msec; @@ -5305,16 +6122,8 @@ RealWaitForChar(fd, msec, check_for_gpm) fds[0].events = POLLIN; nfd = 1; -# ifdef FEAT_SNIFF -# define SNIFF_IDX 1 - if (want_sniff_request) - { - fds[SNIFF_IDX].fd = fd_from_sniff; - fds[SNIFF_IDX].events = POLLIN; - nfd++; - } -# endif # ifdef FEAT_XCLIPBOARD + may_restore_clipboard(); if (xterm_Shell != (Widget)0) { xterm_idx = nfd; @@ -5341,34 +6150,24 @@ RealWaitForChar(fd, msec, check_for_gpm) nfd++; } # endif -#ifdef FEAT_NETBEANS_INTG - if (nb_fd != -1) - { - nb_idx = nfd; - fds[nfd].fd = nb_fd; - fds[nfd].events = POLLIN; - nfd++; - } +#ifdef FEAT_JOB_CHANNEL + nfd = channel_poll_setup(nfd, &fds, &towait); #endif + if (interrupted != NULL) + *interrupted = FALSE; ret = poll(fds, nfd, towait); + + result = ret > 0 && (fds[0].revents & POLLIN); + if (result == 0 && interrupted != NULL && ret > 0) + *interrupted = TRUE; + # ifdef FEAT_MZSCHEME if (ret == 0 && mzquantum_used) /* MzThreads scheduling is required and timeout occurred */ finished = FALSE; # endif -# ifdef FEAT_SNIFF - if (ret < 0) - sniff_disconnect(1); - else if (want_sniff_request) - { - if (fds[SNIFF_IDX].revents & POLLHUP) - sniff_disconnect(1); - if (fds[SNIFF_IDX].revents & POLLIN) - sniff_request_waiting = 1; - } -# endif # ifdef FEAT_XCLIPBOARD if (xterm_Shell != (Widget)0 && (fds[xterm_idx].revents & POLLIN)) { @@ -5403,20 +6202,17 @@ RealWaitForChar(fd, msec, check_for_gpm) finished = FALSE; /* Try again */ } # endif -#ifdef FEAT_NETBEANS_INTG - if (ret > 0 && nb_idx != -1 && fds[nb_idx].revents & POLLIN) - { - netbeans_read(); - --ret; - } +#ifdef FEAT_JOB_CHANNEL + /* also call when ret == 0, we may be polling a keep-open channel */ + if (ret >= 0) + ret = channel_poll_check(ret, &fds); #endif - #else /* HAVE_SELECT */ struct timeval tv; struct timeval *tvp; - fd_set rfds, efds; + fd_set rfds, wfds, efds; int maxfd; long towait = msec; @@ -5428,12 +6224,6 @@ RealWaitForChar(fd, msec, check_for_gpm) mzquantum_used = TRUE; } # endif -# ifdef __EMX__ - /* don't check for incoming chars if not in raw mode, because select() - * always returns TRUE then (in some version of emx.dll) */ - if (curr_tmode != TMODE_RAW) - return 0; -# endif if (towait >= 0) { @@ -5449,6 +6239,7 @@ RealWaitForChar(fd, msec, check_for_gpm) */ select_eintr: FD_ZERO(&rfds); + FD_ZERO(&wfds); FD_ZERO(&efds); FD_SET(fd, &rfds); # if !defined(__QNX__) && !defined(__CYGWIN32__) @@ -5457,16 +6248,8 @@ RealWaitForChar(fd, msec, check_for_gpm) # endif maxfd = fd; -# ifdef FEAT_SNIFF - if (want_sniff_request) - { - FD_SET(fd_from_sniff, &rfds); - FD_SET(fd_from_sniff, &efds); - if (maxfd < fd_from_sniff) - maxfd = fd_from_sniff; - } -# endif # ifdef FEAT_XCLIPBOARD + may_restore_clipboard(); if (xterm_Shell != (Widget)0) { FD_SET(ConnectionNumber(xterm_dpy), &rfds); @@ -5496,16 +6279,19 @@ RealWaitForChar(fd, msec, check_for_gpm) maxfd = xsmp_icefd; } # endif -# ifdef FEAT_NETBEANS_INTG - if (nb_fd != -1) - { - FD_SET(nb_fd, &rfds); - if (maxfd < nb_fd) - maxfd = nb_fd; - } +# ifdef FEAT_JOB_CHANNEL + maxfd = channel_select_setup(maxfd, &rfds, &wfds, &tv, &tvp); # endif + if (interrupted != NULL) + *interrupted = FALSE; + + ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp); + result = ret > 0 && FD_ISSET(fd, &rfds); + if (result) + --ret; + else if (interrupted != NULL && ret > 0) + *interrupted = TRUE; - ret = select(maxfd + 1, &rfds, NULL, &efds, tvp); # ifdef EINTR if (ret == -1 && errno == EINTR) { @@ -5535,17 +6321,6 @@ RealWaitForChar(fd, msec, check_for_gpm) finished = FALSE; # endif -# ifdef FEAT_SNIFF - if (ret < 0 ) - sniff_disconnect(1); - else if (ret > 0 && want_sniff_request) - { - if (FD_ISSET(fd_from_sniff, &efds)) - sniff_disconnect(1); - if (FD_ISSET(fd_from_sniff, &rfds)) - sniff_request_waiting = 1; - } -# endif # ifdef FEAT_XCLIPBOARD if (ret > 0 && xterm_Shell != (Widget)0 && FD_ISSET(ConnectionNumber(xterm_dpy), &rfds)) @@ -5590,12 +6365,10 @@ RealWaitForChar(fd, msec, check_for_gpm) } } # endif -#ifdef FEAT_NETBEANS_INTG - if (ret > 0 && nb_fd != -1 && FD_ISSET(nb_fd, &rfds)) - { - netbeans_read(); - --ret; - } +#ifdef FEAT_JOB_CHANNEL + /* also call when ret == 0, we may be polling a keep-open channel */ + if (ret >= 0) + ret = channel_select_check(ret, &rfds, &wfds); #endif #endif /* HAVE_SELECT */ @@ -5604,16 +6377,17 @@ RealWaitForChar(fd, msec, check_for_gpm) if (finished || msec == 0) break; +# if defined(FEAT_CLIENTSERVER) && !defined(MAC_CLIENTSERVER) + if (server_waiting()) + break; +# endif + /* We're going to loop around again, find out for how long */ if (msec > 0) { -# ifdef USE_START_TV - struct timeval mtv; - +# ifdef ELAPSED_FUNC /* Compute remaining wait time. */ - gettimeofday(&mtv, NULL); - msec -= (mtv.tv_sec - start_tv.tv_sec) * 1000L - + (mtv.tv_usec - start_tv.tv_usec) / 1000L; + msec = start_msec - ELAPSED_FUNC(start_tv); # else /* Guess we got interrupted halfway. */ msec = msec / 2; @@ -5624,7 +6398,7 @@ RealWaitForChar(fd, msec, check_for_gpm) #endif } - return (ret > 0); + return result; } #ifndef NO_EXPANDPATH @@ -5635,10 +6409,10 @@ RealWaitForChar(fd, msec, check_for_gpm) * Returns the number of matches found. */ int -mch_expandpath(gap, path, flags) - garray_T *gap; - char_u *path; - int flags; /* EW_* flags */ +mch_expandpath( + garray_T *gap, + char_u *path, + int flags) /* EW_* flags */ { return unix_expandpath(gap, path, 0, flags, FALSE); } @@ -5667,131 +6441,19 @@ mch_expandpath(gap, path, flags) #define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|" int -mch_expand_wildcards(num_pat, pat, num_file, file, flags) - int num_pat; - char_u **pat; - int *num_file; - char_u ***file; - int flags; /* EW_* flags */ +mch_expand_wildcards( + int num_pat, + char_u **pat, + int *num_file, + char_u ***file, + int flags) /* EW_* flags */ { int i; size_t len; + long llen; char_u *p; int dir; -#ifdef __EMX__ - /* - * This is the OS/2 implementation. - */ -# define EXPL_ALLOC_INC 16 - char_u **expl_files; - size_t files_alloced, files_free; - char_u *buf; - int has_wildcard; - - *num_file = 0; /* default: no files found */ - files_alloced = EXPL_ALLOC_INC; /* how much space is allocated */ - files_free = EXPL_ALLOC_INC; /* how much space is not used */ - *file = (char_u **)alloc(sizeof(char_u **) * files_alloced); - if (*file == NULL) - return FAIL; - - for (; num_pat > 0; num_pat--, pat++) - { - expl_files = NULL; - if (vim_strchr(*pat, '$') || vim_strchr(*pat, '~')) - /* expand environment var or home dir */ - buf = expand_env_save(*pat); - else - buf = vim_strsave(*pat); - expl_files = NULL; - has_wildcard = mch_has_exp_wildcard(buf); /* (still) wildcards? */ - if (has_wildcard) /* yes, so expand them */ - expl_files = (char_u **)_fnexplode(buf); - /* - * return value of buf if no wildcards left, - * OR if no match AND EW_NOTFOUND is set. - */ - if ((!has_wildcard && ((flags & EW_NOTFOUND) || mch_getperm(buf) >= 0)) - || (expl_files == NULL && (flags & EW_NOTFOUND))) - { /* simply save the current contents of *buf */ - expl_files = (char_u **)alloc(sizeof(char_u **) * 2); - if (expl_files != NULL) - { - expl_files[0] = vim_strsave(buf); - expl_files[1] = NULL; - } - } - vim_free(buf); - - /* - * Count number of names resulting from expansion, - * At the same time add a backslash to the end of names that happen to - * be directories, and replace slashes with backslashes. - */ - if (expl_files) - { - for (i = 0; (p = expl_files[i]) != NULL; i++) - { - dir = mch_isdir(p); - /* If we don't want dirs and this is one, skip it */ - if ((dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) - continue; - - /* Skip files that are not executable if we check for that. */ - if (!dir && (flags & EW_EXEC) && !mch_can_exe(p, NULL)) - continue; - - if (--files_free == 0) - { - /* need more room in table of pointers */ - files_alloced += EXPL_ALLOC_INC; - *file = (char_u **)vim_realloc(*file, - sizeof(char_u **) * files_alloced); - if (*file == NULL) - { - EMSG(_(e_outofmem)); - *num_file = 0; - return FAIL; - } - files_free = EXPL_ALLOC_INC; - } - slash_adjust(p); - if (dir) - { - /* For a directory we add a '/', unless it's already - * there. */ - len = STRLEN(p); - if (((*file)[*num_file] = alloc(len + 2)) != NULL) - { - STRCPY((*file)[*num_file], p); - if (!after_pathsep((*file)[*num_file], - (*file)[*num_file] + len)) - { - (*file)[*num_file][len] = psepc; - (*file)[*num_file][len + 1] = NUL; - } - } - } - else - { - (*file)[*num_file] = vim_strsave(p); - } - - /* - * Error message already given by either alloc or vim_strsave. - * Should return FAIL, but returning OK works also. - */ - if ((*file)[*num_file] == NULL) - break; - (*num_file)++; - } - _fnexplodefree((char **)expl_files); - } - } - return OK; - -#else /* __EMX__ */ /* * This is the non-OS/2 implementation (really Unix). */ @@ -5841,7 +6503,7 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) /* * get a name for the temp file */ - if ((tempname = vim_tempname('o')) == NULL) + if ((tempname = vim_tempname('o', FALSE)) == NULL) { EMSG(_(e_notmp)); return FAIL; @@ -5922,7 +6584,7 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) STRCAT(command, pat[0] + 1); /* exclude first backtick */ p = command + STRLEN(command) - 1; *p-- = ')'; /* remove last backtick */ - while (p > command && vim_iswhite(*p)) + while (p > command && VIM_ISWHITE(*p)) --p; if (*p == '&') /* remove trailing '&' */ { @@ -5979,10 +6641,12 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) *p++ = '\\'; ++j; } - else if (!intick && vim_strchr(SHELL_SPECIAL, - pat[i][j]) != NULL) + else if (!intick + && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$') + && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) /* Put a backslash before a special character, but not - * when inside ``. */ + * when inside ``. And not for $var when EW_KEEPDOLLAR is + * set. */ *p++ = '\\'; /* Copy one character. */ @@ -6073,9 +6737,13 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) goto notfound; } fseek(fd, 0L, SEEK_END); - len = ftell(fd); /* get size of temp file */ + llen = ftell(fd); /* get size of temp file */ fseek(fd, 0L, SEEK_SET); - buffer = alloc(len + 1); + if (llen < 0) + /* just in case ftell() would fail */ + buffer = NULL; + else + buffer = alloc(llen + 1); if (buffer == NULL) { /* out of memory */ @@ -6084,6 +6752,7 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) fclose(fd); return FAIL; } + len = llen; i = fread((char *)buffer, 1, len, fd); fclose(fd); mch_remove(tempname); @@ -6237,7 +6906,8 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) continue; /* Skip files that are not executable if we check for that. */ - if (!dir && (flags & EW_EXEC) && !mch_can_exe((*file)[i], NULL)) + if (!dir && (flags & EW_EXEC) + && !mch_can_exe((*file)[i], NULL, !(flags & EW_SHELLCMD))) continue; p = alloc((unsigned)(STRLEN((*file)[i]) + 1 + dir)); @@ -6254,8 +6924,7 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) if (*num_file == 0) /* rejected all entries */ { - vim_free(*file); - *file = NULL; + VIM_CLEAR(*file); goto notfound; } @@ -6265,19 +6934,16 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) if (flags & EW_NOTFOUND) return save_patterns(num_pat, pat, num_file, file); return FAIL; - -#endif /* __EMX__ */ } #endif /* VMS */ -#ifndef __EMX__ static int -save_patterns(num_pat, pat, num_file, file) - int num_pat; - char_u **pat; - int *num_file; - char_u ***file; +save_patterns( + int num_pat, + char_u **pat, + int *num_file, + char_u ***file) { int i; char_u *s; @@ -6297,32 +6963,24 @@ save_patterns(num_pat, pat, num_file, file) *num_file = num_pat; return OK; } -#endif /* * Return TRUE if the string "p" contains a wildcard that mch_expandpath() can * expand. */ int -mch_has_exp_wildcard(p) - char_u *p; +mch_has_exp_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { -#ifndef OS2 if (*p == '\\' && p[1] != NUL) ++p; else -#endif if (vim_strchr((char_u *) #ifdef VMS "*?%" #else -# ifdef OS2 - "*?" -# else "*?[{'" -# endif #endif , *p) != NULL) return TRUE; @@ -6335,29 +6993,18 @@ mch_has_exp_wildcard(p) * Don't recognize '~' at the end as a wildcard. */ int -mch_has_wildcard(p) - char_u *p; +mch_has_wildcard(char_u *p) { - for ( ; *p; mb_ptr_adv(p)) + for ( ; *p; MB_PTR_ADV(p)) { -#ifndef OS2 if (*p == '\\' && p[1] != NUL) ++p; else -#endif if (vim_strchr((char_u *) #ifdef VMS "*?%$" #else -# ifdef OS2 -# ifdef VIM_BACKTICK - "*?$`" -# else - "*?$" -# endif -# else "*?[{`'$" -# endif #endif , *p) != NULL || (*p == '~' && p[1] != NUL)) @@ -6366,11 +7013,8 @@ mch_has_wildcard(p) return FALSE; } -#ifndef __EMX__ static int -have_wildcard(num, file) - int num; - char_u **file; +have_wildcard(int num, char_u **file) { int i; @@ -6381,9 +7025,7 @@ have_wildcard(num, file) } static int -have_dollars(num, file) - int num; - char_u **file; +have_dollars(int num, char_u **file) { int i; @@ -6392,17 +7034,15 @@ have_dollars(num, file) return TRUE; return FALSE; } -#endif /* ifndef __EMX__ */ -#ifndef HAVE_RENAME +#if !defined(HAVE_RENAME) || defined(PROTO) /* * Scaled-down version of rename(), which is missing in Xenix. * This version can only move regular files and will fail if the * destination exists. */ int -mch_rename(src, dest) - const char *src, *dest; +mch_rename(const char *src, const char *dest) { struct stat st; @@ -6422,7 +7062,7 @@ mch_rename(src, dest) * Return 1 if succeeded (or connection already opened), 0 if failed */ static int -gpm_open() +gpm_open(void) { static Gpm_Connect gpm_connect; /* Must it be kept till closing ? */ @@ -6456,7 +7096,7 @@ gpm_open() * Closes connection to gpm */ static void -gpm_close() +gpm_close(void) { if (gpm_flag && gpm_fd >= 0) /* if Open */ Gpm_Close(); @@ -6467,7 +7107,7 @@ gpm_close() * This function is styled after gui_send_mouse_event(). */ static int -mch_gpm_process() +mch_gpm_process(void) { int button; static Gpm_Event gpm_event; @@ -6556,7 +7196,7 @@ mch_gpm_process() * Return OK if succeeded, FAIL if failed. */ static int -sysmouse_open() +sysmouse_open(void) { struct mouse_info mouse; @@ -6578,7 +7218,7 @@ sysmouse_open() * virtual console do not send us any sysmouse related signal. */ static void -sysmouse_close() +sysmouse_close(void) { struct mouse_info mouse; @@ -6656,23 +7296,23 @@ sig_sysmouse SIGDEFARG(sigarg) #endif /* FEAT_SYSMOUSE */ #if defined(FEAT_LIBCALL) || defined(PROTO) -typedef char_u * (*STRPROCSTR)__ARGS((char_u *)); -typedef char_u * (*INTPROCSTR)__ARGS((int)); -typedef int (*STRPROCINT)__ARGS((char_u *)); -typedef int (*INTPROCINT)__ARGS((int)); +typedef char_u * (*STRPROCSTR)(char_u *); +typedef char_u * (*INTPROCSTR)(int); +typedef int (*STRPROCINT)(char_u *); +typedef int (*INTPROCINT)(int); /* * Call a DLL routine which takes either a string or int param * and returns an allocated string. */ int -mch_libcall(libname, funcname, argstring, argint, string_result, number_result) - char_u *libname; - char_u *funcname; - char_u *argstring; /* NULL when using a argint */ - int argint; - char_u **string_result;/* NULL when using number_result */ - int *number_result; +mch_libcall( + char_u *libname, + char_u *funcname, + char_u *argstring, /* NULL when using a argint */ + int argint, + char_u **string_result,/* NULL when using number_result */ + int *number_result) { # if defined(USE_DLOPEN) void *hinstLib; @@ -6735,7 +7375,7 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) if (argstring != NULL) { # if defined(USE_DLOPEN) - ProcAdd = (STRPROCSTR)dlsym(hinstLib, (const char *)funcname); + *(void **)(&ProcAdd) = dlsym(hinstLib, (const char *)funcname); dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, @@ -6757,7 +7397,7 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) else { # if defined(USE_DLOPEN) - ProcAddI = (INTPROCSTR)dlsym(hinstLib, (const char *)funcname); + *(void **)(&ProcAddI) = dlsym(hinstLib, (const char *)funcname); dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, @@ -6833,7 +7473,7 @@ static int xterm_button; * Setup a dummy window for X selections in a terminal. */ void -setup_term_clip() +setup_term_clip(void) { int z = 0; char *strp = ""; @@ -6849,11 +7489,11 @@ setup_term_clip() #if defined(HAVE_SETJMP_H) int (*oldIOhandler)(); #endif -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) - struct timeval start_tv; +# ifdef ELAPSED_FUNC + ELAPSED_TYPE start_tv; if (p_verbose > 0) - gettimeofday(&start_tv, NULL); + ELAPSED_INIT(start_tv); # endif /* Ignore X errors while opening the display */ @@ -6895,11 +7535,11 @@ setup_term_clip() /* Catch terminating error of the X server connection. */ (void)XSetIOErrorHandler(x_IOerror_handler); -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# ifdef ELAPSED_FUNC if (p_verbose > 0) { verbose_enter(); - xopen_message(&start_tv); + xopen_message(ELAPSED_FUNC(start_tv)); verbose_leave(); } # endif @@ -6942,8 +7582,7 @@ setup_term_clip() } void -start_xterm_trace(button) - int button; +start_xterm_trace(int button) { if (x11_window == 0 || xterm_trace < 0 || xterm_Shell == (Widget)0) return; @@ -6954,7 +7593,7 @@ start_xterm_trace(button) void -stop_xterm_trace() +stop_xterm_trace(void) { if (xterm_trace < 0) return; @@ -6966,7 +7605,7 @@ stop_xterm_trace() * return TRUE if dragging is active, else FALSE */ static int -do_xterm_trace() +do_xterm_trace(void) { Window root, child; int root_x, root_y; @@ -7000,7 +7639,7 @@ do_xterm_trace() /* Rely on the same mouse code for the duration of this */ mouse_code = find_termcode(mouse_name); prev_row = mouse_row; - prev_row = mouse_col; + prev_col = mouse_col; xterm_trace = 2; /* Find the offset of the chars, there might be a scrollbar on the @@ -7049,7 +7688,7 @@ do_xterm_trace() * Destroy the display, window and app_context. Required for GTK. */ void -clear_xterm_clip() +clear_xterm_clip(void) { if (xterm_Shell != (Widget)0) { @@ -7081,7 +7720,7 @@ clear_xterm_clip() * Catch up with GUI or X events. */ static void -clip_update() +clip_update(void) { # ifdef FEAT_GUI if (gui.in_use) @@ -7099,29 +7738,42 @@ clip_update() * immediately. */ static void -xterm_update() +xterm_update(void) { XEvent event; - while (XtAppPending(app_context) && !vim_is_input_buf_full()) + for (;;) { - XtAppNextEvent(app_context, &event); -#ifdef FEAT_CLIENTSERVER + XtInputMask mask = XtAppPending(app_context); + + if (mask == 0 || vim_is_input_buf_full()) + break; + + if (mask & XtIMXEvent) { - XPropertyEvent *e = (XPropertyEvent *)&event; + /* There is an event to process. */ + XtAppNextEvent(app_context, &event); +#ifdef FEAT_CLIENTSERVER + { + XPropertyEvent *e = (XPropertyEvent *)&event; - if (e->type == PropertyNotify && e->window == commWindow + if (e->type == PropertyNotify && e->window == commWindow && e->atom == commProperty && e->state == PropertyNewValue) - serverEventProc(xterm_dpy, &event); - } + serverEventProc(xterm_dpy, &event, 0); + } #endif - XtDispatchEvent(&event); + XtDispatchEvent(&event); + } + else + { + /* There is something else than an event to process. */ + XtAppProcessEvent(app_context, mask); + } } } int -clip_xterm_own_selection(cbd) - VimClipboard *cbd; +clip_xterm_own_selection(VimClipboard *cbd) { if (xterm_Shell != (Widget)0) return clip_x11_own_selection(xterm_Shell, cbd); @@ -7129,24 +7781,21 @@ clip_xterm_own_selection(cbd) } void -clip_xterm_lose_selection(cbd) - VimClipboard *cbd; +clip_xterm_lose_selection(VimClipboard *cbd) { if (xterm_Shell != (Widget)0) clip_x11_lose_selection(xterm_Shell, cbd); } void -clip_xterm_request_selection(cbd) - VimClipboard *cbd; +clip_xterm_request_selection(VimClipboard *cbd) { if (xterm_Shell != (Widget)0) clip_x11_request_selection(xterm_Shell, xterm_dpy, cbd); } void -clip_xterm_set_selection(cbd) - VimClipboard *cbd; +clip_xterm_set_selection(VimClipboard *cbd) { clip_x11_set_selection(cbd); } @@ -7157,31 +7806,29 @@ clip_xterm_set_selection(cbd) /* * Code for X Session Management Protocol. */ -static void xsmp_handle_save_yourself __ARGS((SmcConn smc_conn, SmPointer client_data, int save_type, Bool shutdown, int interact_style, Bool fast)); -static void xsmp_die __ARGS((SmcConn smc_conn, SmPointer client_data)); -static void xsmp_save_complete __ARGS((SmcConn smc_conn, SmPointer client_data)); -static void xsmp_shutdown_cancelled __ARGS((SmcConn smc_conn, SmPointer client_data)); -static void xsmp_ice_connection __ARGS((IceConn iceConn, IcePointer clientData, Bool opening, IcePointer *watchData)); +static void xsmp_handle_save_yourself(SmcConn smc_conn, SmPointer client_data, int save_type, Bool shutdown, int interact_style, Bool fast); +static void xsmp_die(SmcConn smc_conn, SmPointer client_data); +static void xsmp_save_complete(SmcConn smc_conn, SmPointer client_data); +static void xsmp_shutdown_cancelled(SmcConn smc_conn, SmPointer client_data); +static void xsmp_ice_connection(IceConn iceConn, IcePointer clientData, Bool opening, IcePointer *watchData); # if defined(FEAT_GUI) && defined(USE_XSMP_INTERACT) -static void xsmp_handle_interaction __ARGS((SmcConn smc_conn, SmPointer client_data)); +static void xsmp_handle_interaction(SmcConn smc_conn, SmPointer client_data); /* * This is our chance to ask the user if they want to save, * or abort the logout */ static void -xsmp_handle_interaction(smc_conn, client_data) - SmcConn smc_conn; - SmPointer client_data UNUSED; +xsmp_handle_interaction(SmcConn smc_conn, SmPointer client_data UNUSED) { cmdmod_T save_cmdmod; int cancel_shutdown = False; save_cmdmod = cmdmod; cmdmod.confirm = TRUE; - if (check_changed_any(FALSE)) + if (check_changed_any(FALSE, FALSE)) /* Mustn't logout */ cancel_shutdown = True; cmdmod = save_cmdmod; @@ -7208,14 +7855,13 @@ xsmp_handle_interaction(smc_conn, client_data) * Callback that starts save-yourself. */ static void -xsmp_handle_save_yourself(smc_conn, client_data, save_type, - shutdown, interact_style, fast) - SmcConn smc_conn; - SmPointer client_data UNUSED; - int save_type UNUSED; - Bool shutdown; - int interact_style UNUSED; - Bool fast UNUSED; +xsmp_handle_save_yourself( + SmcConn smc_conn, + SmPointer client_data UNUSED, + int save_type UNUSED, + Bool shutdown, + int interact_style UNUSED, + Bool fast UNUSED) { /* Handle already being in saveyourself */ if (xsmp.save_yourself) @@ -7250,9 +7896,7 @@ xsmp_handle_save_yourself(smc_conn, client_data, save_type, * Callback to warn us of imminent death. */ static void -xsmp_die(smc_conn, client_data) - SmcConn smc_conn UNUSED; - SmPointer client_data UNUSED; +xsmp_die(SmcConn smc_conn UNUSED, SmPointer client_data UNUSED) { xsmp_close(); @@ -7265,9 +7909,9 @@ xsmp_die(smc_conn, client_data) * Callback to tell us that save-yourself has completed. */ static void -xsmp_save_complete(smc_conn, client_data) - SmcConn smc_conn UNUSED; - SmPointer client_data UNUSED; +xsmp_save_complete( + SmcConn smc_conn UNUSED, + SmPointer client_data UNUSED) { xsmp.save_yourself = False; } @@ -7278,9 +7922,9 @@ xsmp_save_complete(smc_conn, client_data) * (maybe even by us) */ static void -xsmp_shutdown_cancelled(smc_conn, client_data) - SmcConn smc_conn; - SmPointer client_data UNUSED; +xsmp_shutdown_cancelled( + SmcConn smc_conn, + SmPointer client_data UNUSED) { if (xsmp.save_yourself) SmcSaveYourselfDone(smc_conn, True); @@ -7293,11 +7937,11 @@ xsmp_shutdown_cancelled(smc_conn, client_data) * Callback to tell us that a new ICE connection has been established. */ static void -xsmp_ice_connection(iceConn, clientData, opening, watchData) - IceConn iceConn; - IcePointer clientData UNUSED; - Bool opening; - IcePointer *watchData UNUSED; +xsmp_ice_connection( + IceConn iceConn, + IcePointer clientData UNUSED, + Bool opening, + IcePointer *watchData UNUSED) { /* Intercept creation of ICE connection fd */ if (opening) @@ -7310,7 +7954,7 @@ xsmp_ice_connection(iceConn, clientData, opening, watchData) /* Handle any ICE processing that's required; return FAIL if SM lost */ int -xsmp_handle_requests() +xsmp_handle_requests(void) { Bool rep; @@ -7409,7 +8053,7 @@ xsmp_init(void) /* Shut down XSMP comms. */ void -xsmp_close() +xsmp_close(void) { if (xsmp_icefd != -1) { diff --git a/src/os_unix.h b/src/os_unix.h index 4a353388c0..4146529241 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -33,10 +33,6 @@ # include <stdlib.h> #endif -#ifdef __EMX__ -# define HAVE_TOTAL_MEM -#endif - #if defined(__CYGWIN__) || defined(__CYGWIN32__) # define WIN32UNIX /* Compiling for Win32 using Unix files. */ # define BINARY_FILE_IO @@ -64,13 +60,6 @@ # include <sys/param.h> /* defines BSD, if it's a BSD system */ #endif -/* - * Sun defines FILE on SunOS 4.x.x, Solaris has a typedef for FILE - */ -#if defined(sun) && !defined(FILE) -# define SOLARIS -#endif - /* * Using getcwd() is preferred, because it checks for a buffer overflow. * Don't use getcwd() on systems do use system("sh -c pwd"). There is an @@ -81,25 +70,11 @@ # define USE_GETCWD #endif -#ifndef __ARGS - /* The AIX VisualAge cc compiler defines __EXTENDED__ instead of __STDC__ - * because it includes pre-ansi features. */ -# if defined(__STDC__) || defined(__GNUC__) || defined(__EXTENDED__) -# define __ARGS(x) x -# else -# define __ARGS(x) () -# endif -#endif - /* always use unlink() to remove files */ #ifndef PROTO # ifdef VMS # define mch_remove(x) delete((char *)(x)) # define vim_mkdir(x, y) mkdir((char *)(x), y) -# ifdef VAX -# else -# define mch_rmdir(x) rmdir((char *)(x)) -# endif # else # define vim_mkdir(x, y) mkdir((char *)(x), y) # define mch_rmdir(x) rmdir((char *)(x)) @@ -188,10 +163,6 @@ # include <pwd.h> #endif -#ifdef __COHERENT__ -# undef __ARGS -#endif - #if (defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)) \ || (defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)) \ || defined(HAVE_SYSCTL) || defined(HAVE_SYSCONF) @@ -281,9 +252,6 @@ typedef struct dsc$descriptor DESC; # endif #endif -#if !defined(USR_EXRC_FILE2) && defined(OS2) -# define USR_EXRC_FILE2 "$VIM/.exrc" -#endif #if !defined(USR_EXRC_FILE2) && defined(VMS) # define USR_EXRC_FILE2 "sys$login:_exrc" #endif @@ -297,21 +265,14 @@ typedef struct dsc$descriptor DESC; #endif -#if !defined(USR_EXRC_FILE2) -# ifdef OS2 -# define USR_VIMRC_FILE2 "$HOME/vimfiles/vimrc" +#if !defined(USR_VIMRC_FILE2) +# ifdef VMS +# define USR_VIMRC_FILE2 "sys$login:vimfiles/vimrc" # else -# ifdef VMS -# define USR_VIMRC_FILE2 "sys$login:vimfiles/vimrc" -# else -# define USR_VIMRC_FILE2 "~/.vim/vimrc" -# endif +# define USR_VIMRC_FILE2 "~/.vim/vimrc" # endif #endif -#if !defined(USR_VIMRC_FILE3) && defined(OS2) -# define USR_VIMRC_FILE3 "$VIM/.vimrc" -#endif #if !defined(USR_VIMRC_FILE3) && defined(VMS) # define USR_VIMRC_FILE3 "sys$login:_vimrc" #endif @@ -325,14 +286,10 @@ typedef struct dsc$descriptor DESC; #endif #ifndef USR_GVIMRC_FILE2 -# ifdef OS2 -# define USR_GVIMRC_FILE2 "$HOME/vimfiles/gvimrc" +# ifdef VMS +# define USR_GVIMRC_FILE2 "sys$login:vimfiles/gvimrc" # else -# ifdef VMS -# define USR_GVIMRC_FILE2 "sys$login:vimfiles/gvimrc" -# else -# define USR_GVIMRC_FILE2 "~/.vim/gvimrc" -# endif +# define USR_GVIMRC_FILE2 "~/.vim/gvimrc" # endif #endif @@ -342,6 +299,10 @@ typedef struct dsc$descriptor DESC; # endif #endif +#ifndef VIM_DEFAULTS_FILE +# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" +#endif + #ifndef EVIM_FILE # define EVIM_FILE "$VIMRUNTIME/evim.vim" #endif @@ -354,9 +315,6 @@ typedef struct dsc$descriptor DESC; # define VIMINFO_FILE "$HOME/.viminfo" # endif # endif -# if !defined(VIMINFO_FILE2) && defined(OS2) -# define VIMINFO_FILE2 "$VIM/.viminfo" -# endif # if !defined(VIMINFO_FILE2) && defined(VMS) # define VIMINFO_FILE2 "sys$login:_viminfo" # endif @@ -381,74 +339,54 @@ typedef struct dsc$descriptor DESC; #endif #ifndef DFLT_BDIR -# ifdef OS2 -# define DFLT_BDIR ".,c:/tmp,~/tmp,~/" +# ifdef VMS +# define DFLT_BDIR "./,sys$login:,tmp:" # else -# ifdef VMS -# define DFLT_BDIR "./,sys$login:,tmp:" -# else -# define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */ -# endif +# define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */ # endif #endif #ifndef DFLT_DIR -# ifdef OS2 -# define DFLT_DIR ".,~/tmp,c:/tmp,/tmp" +# ifdef VMS +# define DFLT_DIR "./,sys$login:,tmp:" # else -# ifdef VMS -# define DFLT_DIR "./,sys$login:,tmp:" -# else -# define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */ -# endif +# define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */ # endif #endif #ifndef DFLT_VDIR -# ifdef OS2 -# define DFLT_VDIR "$VIM/vimfiles/view" +# ifdef VMS +# define DFLT_VDIR "sys$login:vimfiles/view" # else -# ifdef VMS -# define DFLT_VDIR "sys$login:vimfiles/view" -# else -# define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */ -# endif +# define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */ # endif #endif #define DFLT_ERRORFILE "errors.err" -#ifdef OS2 -# define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after" +#ifdef VMS +# define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #else -# ifdef VMS -# define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" +# ifdef RUNTIME_GLOBAL +# define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after" # else -# ifdef RUNTIME_GLOBAL -# define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" -# else -# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" -# endif +# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" # endif #endif -#ifdef OS2 -/* - * Try several directories to put the temp files. - */ -# define TEMPDIRNAMES "$TMP", "$TEMP", "c:\\TMP", "c:\\TEMP", "" -# define TEMPNAMELEN 128 -#else -# ifdef VMS -# ifndef VAX -# define VMS_TEMPNAM /* to fix default .LIS extension */ -# endif -# define TEMPNAME "TMP:v?XXXXXX.txt" -# define TEMPNAMELEN 28 -# else -# define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME" -# define TEMPNAMELEN 256 +#ifdef VMS +# ifndef VAX +# define VMS_TEMPNAM /* to fix default .LIS extension */ # endif +# define TEMPNAME "TMP:v?XXXXXX.txt" +# define TEMPNAMELEN 28 +#else +/* Try several directories to put the temp files. */ +# define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME" +# define TEMPNAMELEN 256 #endif /* Special wildcards that need to be handled by the shell */ @@ -488,21 +426,17 @@ typedef struct dsc$descriptor DESC; # endif #endif -/* memmove is not present on all systems, use memmove, bcopy, memcpy or our - * own version */ -/* Some systems have (void *) arguments, some (char *). If we use (char *) it +/* memmove() is not present on all systems, use memmove, bcopy or memcpy. + * Some systems have (void *) arguments, some (char *). If we use (char *) it * works for all */ -#ifdef USEMEMMOVE +#if defined(USEMEMMOVE) || (!defined(USEBCOPY) && !defined(USEMEMCPY)) # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) #else # ifdef USEBCOPY # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len) # else -# ifdef USEMEMCPY + /* ifdef USEMEMCPY */ # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) -# else -# define VIM_MEMMOVE /* found in misc2.c */ -# endif # endif #endif @@ -510,7 +444,7 @@ typedef struct dsc$descriptor DESC; # ifdef HAVE_RENAME # define mch_rename(src, dst) rename(src, dst) # else -int mch_rename __ARGS((const char *src, const char *dest)); +int mch_rename(const char *src, const char *dest); # endif # ifndef VMS # ifdef __MVS__ diff --git a/src/os_unixx.h b/src/os_unixx.h index e46edcf59a..edf7914aa6 100644 --- a/src/os_unixx.h +++ b/src/os_unixx.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -17,8 +17,8 @@ # define signal sigset #endif - /* sun's sys/ioctl.h redefines symbols from termio world */ -#if defined(HAVE_SYS_IOCTL_H) && !defined(sun) + /* Sun's sys/ioctl.h redefines symbols from termio world */ +#if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM) # include <sys/ioctl.h> #endif @@ -69,16 +69,7 @@ #endif #ifdef HAVE_SYS_SYSTEMINFO_H -/* - * foolish Sinix <sys/systeminfo.h> uses SYS_NMLN but doesn't include - * <limits.h>, where it is defined. Perhaps other systems have the same - * problem? Include it here. -- Slootman - */ -# if defined(HAVE_LIMITS_H) && !defined(_LIMITS_H) -# include <limits.h> /* for SYS_NMLN (Sinix 5.41 / Unix SysV.4) */ -# endif - -/* Define SYS_NMLN ourselves if it still isn't defined (for CrayT3E). */ +/* <sys/systeminfo.h> uses SYS_NMLN but it may not be defined (CrayT3E). */ # ifndef SYS_NMLN # define SYS_NMLN 32 # endif @@ -113,7 +104,7 @@ /* shared library access */ #if defined(HAVE_DLFCN_H) && defined(USE_DLOPEN) -# ifdef __MVS__ +# if defined(__MVS__) && !defined (__SUSV3) /* needed to define RTLD_LAZY (Anthony Giorgio) */ # define __SUSV3 # endif diff --git a/src/os_vms.c b/src/os_vms.c index 55876b27fe..61db3a80b6 100644 --- a/src/os_vms.c +++ b/src/os_vms.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * VMS port by Henk Elbers @@ -12,13 +12,13 @@ #include "vim.h" /* define _generic_64 for use in time functions */ -#ifndef VAX +#if !defined(VAX) && !defined(PROTO) # include <gen64def.h> #else /* based on Alpha's gen64def.h; the file is absent on VAX */ typedef struct _generic_64 { # pragma __nomember_alignment - __union { /* You can treat me as... */ + __union { /* You can treat me as... */ /* long long is not available on VAXen */ /* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */ @@ -77,13 +77,13 @@ static char *Fspec_Rms; /* rms file spec, passed implicitly between rout -static TT_MODE get_tty __ARGS((void)); -static void set_tty __ARGS((int row, int col)); +static TT_MODE get_tty(void); +static void set_tty(int row, int col); #define EXPL_ALLOC_INC 64 #define EQN(S1,S2,LN) (strncmp(S1,S2,LN) == 0) -#define SKIP_FOLLOWING_SLASHES(Str) while (Str[1] == '/') ++Str +#define SKIP_FOLLOWING_SLASHES(Str) do { while (Str[1] == '/') ++Str; } while (0) /* @@ -461,8 +461,7 @@ mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, i result = decc$translate_vms(vms_fixfilename(buf)); if ( (int) result == 0 || (int) result == -1 ) { cnt = 0; - } - else { + } else { cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; } if (cnt > 0) @@ -483,7 +482,8 @@ mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, i continue; /* Skip files that are not executable if we check for that. */ - if (!dir && (flags & EW_EXEC) && !mch_can_exe(vms_fmatch[i], NULL)) + if (!dir && (flags & EW_EXEC) + && !mch_can_exe(vms_fmatch[i], NULL, !(flags & EW_SHELLCMD))) continue; /* allocate memory for pointers */ @@ -518,10 +518,9 @@ mch_expandpath(garray_T *gap, char_u *path, int flags) /* otherwise it might create ACCVIO error in decc$to_vms */ result = decc$translate_vms(vms_fixfilename(path)); if ( (int) result == 0 || (int) result == -1 ) { - cnt = 0; - } - else { - cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); + cnt = 0; + } else { + cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); } if (cnt > 0) cnt = vms_match_num; @@ -722,10 +721,11 @@ struct typeahead_st { * "msec" == -1 will block until a character is available. */ int -RealWaitForChar(fd, msec, check_for_gpm) - int fd UNUSED; /* always read from iochan */ - long msec; - int *check_for_gpm UNUSED; +RealWaitForChar( + int fd UNUSED, /* always read from iochan */ + long msec, + int *check_for_gpm UNUSED, + int *interrupted) { int status; struct _generic_64 time_curr; @@ -739,68 +739,66 @@ RealWaitForChar(fd, msec, check_for_gpm) get_tty(); if (sec > 0) { - /* time-out specified; convert it to absolute time */ + /* time-out specified; convert it to absolute time */ /* sec>0 requirement of lib$cvtf_to_internal_time()*/ - /* get current time (number of 100ns ticks since the VMS Epoch) */ - status = sys$gettim(&time_curr); - if (status != SS$_NORMAL) - return 0; /* error */ - /* construct the delta time */ + /* get current time (number of 100ns ticks since the VMS Epoch) */ + status = sys$gettim(&time_curr); + if (status != SS$_NORMAL) + return 0; /* error */ + /* construct the delta time */ #if __G_FLOAT==0 # ifndef VAX /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */ - status = lib$cvts_to_internal_time( - &convert_operation, &sec, &time_diff); + status = lib$cvts_to_internal_time( + &convert_operation, &sec, &time_diff); # endif #else /* default on Alpha and VAX */ - status = lib$cvtf_to_internal_time( + status = lib$cvtf_to_internal_time( &convert_operation, &sec, &time_diff); #endif - if (status != LIB$_NORMAL) - return 0; /* error */ - /* add them up */ - status = lib$add_times( - &time_curr, - &time_diff, - &time_out); - if (status != LIB$_NORMAL) - return 0; /* error */ + if (status != LIB$_NORMAL) + return 0; /* error */ + /* add them up */ + status = lib$add_times( + &time_curr, + &time_diff, + &time_out); + if (status != LIB$_NORMAL) + return 0; /* error */ } while (TRUE) { - /* select() */ - status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, - 0, 0, &typeahead, 8, 0, 0, 0, 0); + /* select() */ + status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, + 0, 0, &typeahead, 8, 0, 0, 0, 0); if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL) - return 0; /* error */ - - if (typeahead.numchars) - return 1; /* ready to read */ - - /* there's nothing to read; what now? */ - if (msec == 0) { - /* immediate time-out; return impatiently */ - return 0; - } - else if (msec < 0) { - /* no time-out; wait on indefinitely */ - continue; - } - else { - /* time-out needs to be checked */ - status = sys$gettim(&time_curr); - if (status != SS$_NORMAL) - return 0; /* error */ - - status = lib$sub_times( - &time_out, - &time_curr, - &time_diff); - if (status != LIB$_NORMAL) - return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ - - /* otherwise wait some more */ - } + return 0; /* error */ + + if (typeahead.numchars) + return 1; /* ready to read */ + + /* there's nothing to read; what now? */ + if (msec == 0) { + /* immediate time-out; return impatiently */ + return 0; + } else if (msec < 0) { + /* no time-out; wait on indefinitely */ + return 1; /* fakeout to force a wait in vms_read() */ + } else { + /* time-out needs to be checked */ + status = sys$gettim(&time_curr); + if (status != SS$_NORMAL) + return 0; /* error */ + + status = lib$sub_times( + &time_out, + &time_curr, + &time_diff); + if (status != LIB$_NORMAL) + return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ + + /* otherwise wait some more */ + } } } diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h index 41728efe29..9aa7526e7e 100644 --- a/src/os_vms_conf.h +++ b/src/os_vms_conf.h @@ -101,7 +101,6 @@ #define HAVE_STRTOL #define HAVE_TGETENT #define HAVE_MEMSET -#define HAVE_MEMCMP #define HAVE_STRERROR #define HAVE_FCHOWN #define HAVE_RENAME @@ -109,7 +108,6 @@ #define HAVE_FSYNC #define HAVE_GETPWUID #define HAVE_GETPWNAM -#define HAVE_STDARG_H #define HAVE_STDLIB_H #define HAVE_STRING_H #define HAVE_ERRNO_H @@ -142,6 +140,7 @@ #undef HAVE_SYS_POLL_H #undef HAVE_PWD_H #undef HAVE_FCHDIR +#undef HAVE_LSTAT /* Hardware specific */ #ifdef VAX @@ -149,13 +148,15 @@ #undef HAVE_USLEEP #undef HAVE_STRCASECMP #undef HAVE_STRINGS_H -#undef HAVE_SIGSETJMP +#undef HAVE_SIGSETJMP +#undef HAVE_ISNAN #else #define HAVE_GETTIMEOFDAY #define HAVE_USLEEP #define HAVE_STRCASECMP #define HAVE_STRINGS_H -#define HAVE_SIGSETJMP +#define HAVE_SIGSETJMP +#define HAVE_ISNAN #endif /* Compiler specific */ diff --git a/src/os_w32dll.c b/src/os_w32dll.c index 9cfec1aa52..5b944008f3 100644 --- a/src/os_w32dll.c +++ b/src/os_w32dll.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI support by Robert Webb diff --git a/src/os_w32exe.c b/src/os_w32exe.c index 93a13899c2..3beca193d7 100644 --- a/src/os_w32exe.c +++ b/src/os_w32exe.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * GUI support by Robert Webb @@ -27,7 +27,7 @@ VimMain #else main #endif - __ARGS((int argc, char **argv)); + (int argc, char **argv); static int (_cdecl *pmain)(int, char **); #ifndef PROTO @@ -38,13 +38,12 @@ void _cdecl SaveInst(HINSTANCE hInst); static void (_cdecl *pSaveInst)(HINSTANCE); #endif -/*ARGSUSED*/ int WINAPI WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInst, + HINSTANCE hInstance UNUSED, + HINSTANCE hPrevInst UNUSED, LPSTR lpszCmdLine, - int nCmdShow) + int nCmdShow UNUSED) { int argc = 0; char **argv; @@ -69,7 +68,7 @@ WinMain( #ifdef DYNAMIC_GETTEXT /* Initialize gettext library */ - dyn_libintl_init(NULL); + dyn_libintl_init(); #endif #ifdef VIMDLL diff --git a/src/os_win16.c b/src/os_win16.c deleted file mode 100644 index 49e6e300b9..0000000000 --- a/src/os_win16.c +++ /dev/null @@ -1,427 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ -/* - * os_win16.c - * - * Win16 (Windows 3.1x) system-dependent routines. - * Carved brutally from os_win32.c by Vince Negri <vn@aslnet.co.uk> - */ -#ifdef __BORLANDC__ -# pragma warn -par -# pragma warn -ucp -# pragma warn -use -# pragma warn -aus -# pragma warn -obs -#endif - -#include "vim.h" - -/* cproto fails on missing include files */ -#ifndef PROTO -# include <dos.h> -#endif - -#include <string.h> -#include <sys/types.h> -#include <signal.h> -#include <limits.h> - -#ifndef PROTO -# include <process.h> - -# undef chdir -# include <direct.h> -# include <shellapi.h> /* required for FindExecutable() */ -#endif - - -/* Record all output and all keyboard & mouse input */ -/* #define MCH_WRITE_DUMP */ - -#ifdef MCH_WRITE_DUMP -FILE* fdDump = NULL; -#endif - - -/* - * When generating prototypes for Win32 on Unix, these lines make the syntax - * errors disappear. They do not need to be correct. - */ -#ifdef PROTO -typedef int HANDLE; -typedef int SMALL_RECT; -typedef int COORD; -typedef int SHORT; -typedef int WORD; -typedef int DWORD; -typedef int BOOL; -typedef int LPSTR; -typedef int LPTSTR; -typedef int KEY_EVENT_RECORD; -typedef int MOUSE_EVENT_RECORD; -# define WINAPI -typedef int CONSOLE_CURSOR_INFO; -typedef char * LPCSTR; -# define WINBASEAPI -typedef int INPUT_RECORD; -# define _cdecl -#endif - -#ifdef __BORLANDC__ -/* being a more ANSI compliant compiler, BorlandC doesn't define _stricoll: - * but it does in BC 5.02! */ -# if __BORLANDC__ < 0x502 -int _stricoll(char *a, char *b); -# endif -#endif - -/* cproto doesn't create a prototype for main() */ -int _cdecl -VimMain -__ARGS((int argc, char **argv)); -static int (_cdecl *pmain)(int, char **); - -#ifndef PROTO -void _cdecl SaveInst(HINSTANCE hInst); -static void (_cdecl *pSaveInst)(HINSTANCE); - -int WINAPI -WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInst, - LPSTR lpszCmdLine, - int nCmdShow) -{ - int argc; - char **argv; - char *tofree; - char prog[256]; - - /* - * Ron: added full path name so that the $VIM variable will get set to our - * startup path (so the .vimrc file can be found w/o a VIM env. var.) - * Remove the ".exe" extension, and find the 1st non-space. - */ - GetModuleFileName(hInstance, prog, 255); - if (*prog != NUL) - exe_name = FullName_save((char_u *)prog, FALSE); - - /* Separate the command line into arguments. */ - argc = get_cmd_args(prog, (char *)lpszCmdLine, &argv, &tofree); - if (argc == 0) - { - /* Error message? */ - return 0; - } - - pSaveInst = SaveInst; - pmain = VimMain; - pSaveInst(hInstance); - pmain(argc, argv); - - free(argv); - if (tofree != NULL) - free(tofree); - - return 0; -} -#endif - - - - - - -#ifdef FEAT_MOUSE - -/* - * For the GUI the mouse handling is in gui_w32.c. - */ - void -mch_setmouse( - int on) -{ -} -#endif /* FEAT_MOUSE */ - - - -/* - * GUI version of mch_init(). - */ - void -mch_init() -{ - extern int _fmode; - - - /* Let critical errors result in a failure, not in a dialog box. Required - * for the timestamp test to work on removed floppies. */ - SetErrorMode(SEM_FAILCRITICALERRORS); - - _fmode = O_BINARY; /* we do our own CR-LF translation */ - - /* Specify window size. Is there a place to get the default from? */ - Rows = 25; - Columns = 80; - - - set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0); - -#ifdef FEAT_CLIPBOARD - clip_init(TRUE); - - /* - * Vim's own clipboard format recognises whether the text is char, line, - * or rectangular block. Only useful for copying between two Vims. - * "VimClipboard" was used for previous versions, using the first - * character to specify MCHAR, MLINE or MBLOCK. - */ - clip_star.format = RegisterClipboardFormat("VimClipboard2"); - clip_star.format_raw = RegisterClipboardFormat("VimRawBytes"); -#endif -} - - - -/* - * Do we have an interactive window? - */ - int -mch_check_win( - int argc, - char **argv) -{ - return OK; /* GUI always has a tty */ -} - - -/* - * return process ID - */ - long -mch_get_pid() -{ - return (long)GetCurrentTask(); -} - - -/* - * Specialised version of system(). - * This version proceeds as follows: - * 1. Start the program with WinExec - * 2. Wait for the module use count of the program to go to 0 - * (This is the best way of detecting the program has finished) - */ - - static int -mch_system(char *cmd, int options) -{ - DWORD ret = 0; - UINT wShowWindow; - UINT h_module; - MSG msg; - BOOL again = TRUE; - - /* - * It's nicer to run a filter command in a minimized window, but in - */ - if (options & SHELL_DOOUT) - wShowWindow = SW_SHOWMINIMIZED; - else - wShowWindow = SW_SHOWNORMAL; - - /* Now, run the command */ - h_module = WinExec((LPCSTR)cmd, wShowWindow); - - if (h_module < 32) - { - /*error*/ - ret = -h_module; - } - else - { - /* Wait for the command to terminate before continuing */ - while (GetModuleUsage((HINSTANCE)h_module) > 0 && again ) - { - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) && again) - { - if (msg.message == WM_QUIT) - - { - PostQuitMessage(msg.wParam); - again = FALSE; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - - return ret; -} - -/* - * Either execute a command by calling the shell or start a new shell - */ - int -mch_call_shell( - char_u *cmd, - int options) /* SHELL_, see vim.h */ -{ - int x; - int tmode = cur_tmode; - - out_flush(); - - -#ifdef MCH_WRITE_DUMP - if (fdDump) - { - fprintf(fdDump, "mch_call_shell(\"%s\", %d)\n", cmd, options); - fflush(fdDump); - } -#endif - - /* - * Catch all deadly signals while running the external command, because a - * CTRL-C, Ctrl-Break or illegal instruction might otherwise kill us. - */ - signal(SIGINT, SIG_IGN); - signal(SIGILL, SIG_IGN); - signal(SIGFPE, SIG_IGN); - signal(SIGSEGV, SIG_IGN); - signal(SIGTERM, SIG_IGN); - signal(SIGABRT, SIG_IGN); - - if (options & SHELL_COOKED) - settmode(TMODE_COOK); /* set to normal mode */ - - if (cmd == NULL) - { - x = mch_system(p_sh, options); - } - else - { - /* we use "command" or "cmd" to start the shell; slow but easy */ - char_u *newcmd; - - newcmd = lalloc( - STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10, TRUE); - if (newcmd != NULL) - { - if (STRNICMP(cmd, "start ", 6) == 0) - { - sprintf((char *)newcmd, "%s\0", cmd+6); - if (WinExec((LPCSTR)newcmd, SW_SHOWNORMAL) > 31) - x = 0; - else - x = -1; - } - else - { - sprintf((char *)newcmd, "%s%s %s %s", - "", - p_sh, - p_shcf, - cmd); - x = mch_system((char *)newcmd, options); - } - vim_free(newcmd); - } - } - - if (tmode == TMODE_RAW) - settmode(TMODE_RAW); /* set to raw mode */ - - if (x && !(options & SHELL_SILENT) && !emsg_silent) - { - smsg(_("shell returned %d"), x); - msg_putchar('\n'); - } -#ifdef FEAT_TITLE - resettitle(); -#endif - - signal(SIGINT, SIG_DFL); - signal(SIGILL, SIG_DFL); - signal(SIGFPE, SIG_DFL); - signal(SIGSEGV, SIG_DFL); - signal(SIGTERM, SIG_DFL); - signal(SIGABRT, SIG_DFL); - - - return x; -} - - -/* - * Delay for half a second. - */ - void -mch_delay( - long msec, - int ignoreinput) -{ -#ifdef MUST_FIX - Sleep((int)msec); /* never wait for input */ -#endif -} - - -/* - * check for an "interrupt signal": CTRL-break or CTRL-C - */ - void -mch_breakcheck() -{ - /* never used */ -} - - -/* - * How much memory is available in Kbyte? - */ - long_u -mch_avail_mem( - int special) -{ - return GetFreeSpace(0) >> 10; -} - - -/* - * Like rename(), returns 0 upon success, non-zero upon failure. - * Should probably set errno appropriately when errors occur. - */ - int -mch_rename( - const char *pszOldFile, - const char *pszNewFile) -{ - - /* - * No need to play tricks, this isn't rubbish like Windows 95 <g> - */ - return rename(pszOldFile, pszNewFile); - -} - -/* - * Get the default shell for the current hardware platform - */ - char* -default_shell() -{ - char* psz = NULL; - - psz = "command.com"; - - return psz; -} diff --git a/src/os_win16.h b/src/os_win16.h deleted file mode 100644 index 4c2677264b..0000000000 --- a/src/os_win16.h +++ /dev/null @@ -1,143 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -/* - * Win16 (Windows 3.1x) machine-dependent things. - */ - -#include "os_dos.h" /* common MS-DOS and Windows stuff */ - -#define BINARY_FILE_IO -#define USE_EXE_NAME /* use argv[0] for $VIM */ -#define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */ -#define USE_TERM_CONSOLE -#define HAVE_STRING_H -#define HAVE_STRCSPN -#define HAVE_STRICMP -#define HAVE_STRNICMP -#define HAVE_STRFTIME /* guessed */ -#define HAVE_MEMSET -#define USE_TMPNAM /* use tmpnam() instead of mktemp() */ -#define HAVE_LOCALE_H -#define HAVE_FCNTL_H -#define HAVE_QSORT -#define HAVE_ST_MODE /* have stat.st_mode */ -#define HAVE_MATH_H -//#define USE_FNAME_CASE /* adjust case of file names */ -#ifndef FEAT_CLIPBOARD -# define FEAT_CLIPBOARD /* include clipboard support */ -#endif -#if defined(__DATE__) && defined(__TIME__) -# define HAVE_DATE_TIME -#endif -#define HAVE_AVAIL_MEM - -#define SHORT_FNAME /* always 8.3 file name */ - -#define SMALL_MALLOC /* 16 bit storage allocation */ - -#ifdef __BORLANDC__ -# define HAVE_PUTENV /* at least Bcc 5.2 has it */ -#endif - -#ifdef FEAT_GUI_W16 -# define NO_CONSOLE /* don't included console-only code */ -#endif - -/* toupper() is not really broken, but it's very slow. Probably because of - * using unicode characters on Windows NT */ -#define BROKEN_TOUPPER - -#define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ - -#ifndef VIM_SIZEOF_INT -# define VIM_SIZEOF_INT 2 -#endif - -typedef long off_t; - -#include <stdlib.h> -#include <time.h> - -/* cproto fails on missing include files */ -#ifndef PROTO -# include <dos.h> -# include <dir.h> - -# ifndef STRICT -# define STRICT -# endif -# ifndef COBJMACROS -# define COBJMACROS /* For OLE: Enable "friendlier" access to objects */ -# endif -# include <windows.h> - -#endif /* PROTO */ - -/* - * plenty of memory, use large buffers - */ -#define CMDBUFFSIZE 1024 /* size of the command processing buffer */ - - -#define BASENAMELEN (MAXPATHL-5) /* length of base of file name */ - -#ifndef DFLT_MAXMEM -# define DFLT_MAXMEM (256) /* use up to 256K for a buffer*/ -#endif - -#ifndef DFLT_MAXMEMTOT -# define DFLT_MAXMEMTOT (5*1024) /* use up to 5 Mbyte for Vim */ -#endif - -/* - * Some simple debugging macros that look and behave a lot like their - * namesakes in MFC. - */ - -#ifdef _DEBUG - -# if defined(_MSC_VER) && (_MSC_VER >= 1000) - /* Use the new debugging tools in Visual C++ 4.x */ -# include <crtdbg.h> -# define ASSERT(f) _ASSERT(f) -# else -# include <assert.h> -# define ASSERT(f) assert(f) -# endif - -# define TRACE Trace -# define TRACE0(sz) Trace(_T("%s"), _T(sz)) -# define TRACE1(sz, p1) Trace(_T(sz), p1) -# define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2) -# define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3) - -/* In debug version, writes trace messages to debug stream */ -void __cdecl -Trace(char *pszFormat, ...); - -#else /* !_DEBUG */ - - /* These macros should all compile away to nothing */ -# define ASSERT(f) ((void)0) -# define TRACE 1 ? (void)0 : printf -# define TRACE0(sz) -# define TRACE1(sz, p1) -# define TRACE2(sz, p1, p2) -# define TRACE3(sz, p1, p2, p3) - -#endif /* !_DEBUG */ - - -#define ASSERT_POINTER(p, type) \ - ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE)) - -#define ASSERT_NULL_OR_POINTER(p, type) \ - ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) - -#define mch_setenv(name, val, x) setenv(name, val, x) diff --git a/src/os_win32.c b/src/os_win32.c index 0c896efc37..bece2c4c61 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -50,6 +50,10 @@ # endif #endif +#ifdef FEAT_JOB_CHANNEL +# include <tlhelp32.h> +#endif + #ifdef __MINGW32__ # ifndef FROM_LEFT_1ST_BUTTON_PRESSED # define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001 @@ -91,7 +95,6 @@ FILE* fdDump = NULL; */ #ifdef PROTO #define WINAPI -#define WINBASEAPI typedef char * LPCSTR; typedef char * LPWSTR; typedef int ACCESS_MASK; @@ -101,12 +104,14 @@ typedef int CONSOLE_CURSOR_INFO; typedef int COORD; typedef int DWORD; typedef int HANDLE; +typedef int LPHANDLE; typedef int HDC; typedef int HFONT; typedef int HICON; typedef int HINSTANCE; typedef int HWND; typedef int INPUT_RECORD; +typedef int INT; typedef int KEY_EVENT_RECORD; typedef int LOGFONT; typedef int LPBOOL; @@ -135,26 +140,10 @@ typedef int BY_HANDLE_FILE_INFORMATION; typedef int SE_OBJECT_TYPE; typedef int PSNSECINFO; typedef int PSNSECINFOW; -#endif - -#ifndef FEAT_GUI_W32 -/* Undocumented API in kernel32.dll needed to work around dead key bug in - * console-mode applications in NT 4.0. If you switch keyboard layouts - * in a console app to a layout that includes dead keys and then hit a - * dead key, a call to ToAscii will trash the stack. My thanks to Ian James - * and Michael Dietrich for helping me figure out this workaround. - */ - -/* WINBASEAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */ -#ifndef WINBASEAPI -# define WINBASEAPI __stdcall -#endif -#if defined(__BORLANDC__) -typedef BOOL (__stdcall *PFNGCKLN)(LPSTR); -#else -typedef WINBASEAPI BOOL (WINAPI *PFNGCKLN)(LPSTR); -#endif -static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL; +typedef int STARTUPINFO; +typedef int PROCESS_INFORMATION; +typedef int LPSECURITY_ATTRIBUTES; +# define __stdcall /* empty */ #endif #if defined(__BORLANDC__) @@ -162,18 +151,6 @@ static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL; # define wcsicmp(a, b) wcscmpi((a), (b)) #endif -#ifndef PROTO - -/* Enable common dialogs input unicode from IME if possible. */ -#ifdef FEAT_MBYTE -LRESULT (WINAPI *pDispatchMessage)(CONST MSG *) = DispatchMessage; -BOOL (WINAPI *pGetMessage)(LPMSG, HWND, UINT, UINT) = GetMessage; -BOOL (WINAPI *pIsDialogMessage)(HWND, LPMSG) = IsDialogMessage; -BOOL (WINAPI *pPeekMessage)(LPMSG, HWND, UINT, UINT, UINT) = PeekMessage; -#endif - -#endif /* PROTO */ - #ifndef FEAT_GUI_W32 /* Win32 Console handles for input and output */ static HANDLE g_hConIn = INVALID_HANDLE_VALUE; @@ -211,8 +188,7 @@ static void standout(void); static void standend(void); static void visual_bell(void); static void cursor_visible(BOOL fVisible); -static BOOL write_chars(LPCSTR pchBuf, DWORD cchToWrite); -static char_u tgetch(int *pmodifiers, char_u *pch2); +static DWORD write_chars(char_u *pchBuf, DWORD cbToWrite); static void create_conin(void); static int s_cursor_visible = TRUE; static int did_create_conin = FALSE; @@ -226,6 +202,32 @@ static int win32_getattrs(char_u *name); static int win32_setattrs(char_u *name, int attrs); static int win32_set_archive(char_u *name); +#ifndef FEAT_GUI_W32 +static int vtp_working = 0; +static void vtp_init(); +static void vtp_exit(); +static int vtp_printf(char *format, ...); +static void vtp_sgr_bulk(int arg); +static void vtp_sgr_bulks(int argc, int *argv); + +static guicolor_T save_console_bg_rgb; +static guicolor_T save_console_fg_rgb; + +# ifdef FEAT_TERMGUICOLORS +# define USE_VTP (vtp_working && is_term_win32() && (p_tgc || (!p_tgc && t_colors >= 256))) +# else +# define USE_VTP 0 +# endif + +static void set_console_color_rgb(void); +static void reset_console_color_rgb(void); +#endif + +/* This flag is newly created from Windows 10 */ +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +# define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#endif + #ifndef FEAT_GUI_W32 static int suppress_winsize = 1; /* don't fiddle with console */ #endif @@ -234,6 +236,55 @@ static char_u *exe_path = NULL; static BOOL win8_or_later = FALSE; +#ifndef FEAT_GUI_W32 +/* Dynamic loading for portability */ +typedef struct _DYN_CONSOLE_SCREEN_BUFFER_INFOEX +{ + ULONG cbSize; + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; + WORD wPopupAttributes; + BOOL bFullscreenSupported; + COLORREF ColorTable[16]; +} DYN_CONSOLE_SCREEN_BUFFER_INFOEX, *PDYN_CONSOLE_SCREEN_BUFFER_INFOEX; +typedef BOOL (WINAPI *PfnGetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); +static PfnGetConsoleScreenBufferInfoEx pGetConsoleScreenBufferInfoEx; +typedef BOOL (WINAPI *PfnSetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); +static PfnSetConsoleScreenBufferInfoEx pSetConsoleScreenBufferInfoEx; +static BOOL has_csbiex = FALSE; + +/* + * Get version number including build number + */ +typedef BOOL (WINAPI *PfnRtlGetVersion)(LPOSVERSIONINFOW); +# define MAKE_VER(major, minor, build) \ + (((major) << 24) | ((minor) << 16) | (build)) + + static DWORD +get_build_number(void) +{ + OSVERSIONINFOW osver = {sizeof(OSVERSIONINFOW)}; + HMODULE hNtdll; + PfnRtlGetVersion pRtlGetVersion; + DWORD ver = MAKE_VER(0, 0, 0); + + hNtdll = GetModuleHandle("ntdll.dll"); + if (hNtdll != NULL) + { + pRtlGetVersion = + (PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion"); + pRtlGetVersion(&osver); + ver = MAKE_VER(min(osver.dwMajorVersion, 255), + min(osver.dwMinorVersion, 255), + min(osver.dwBuildNumber, 32767)); + } + return ver; +} + + /* * Version of ReadConsoleInput() that works with IME. * Works around problems on Windows 8. @@ -257,18 +308,21 @@ read_console_input( int tail; int i; + if (nLength == -2) + return (s_dwMax > 0) ? TRUE : FALSE; + if (!win8_or_later) { if (nLength == -1) - return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents); - return ReadConsoleInput(hInput, lpBuffer, 1, &dwEvents); + return PeekConsoleInputW(hInput, lpBuffer, 1, lpEvents); + return ReadConsoleInputW(hInput, lpBuffer, 1, &dwEvents); } if (s_dwMax == 0) { if (nLength == -1) - return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents); - if (!ReadConsoleInput(hInput, s_irCache, IRSIZE, &dwEvents)) + return PeekConsoleInputW(hInput, lpBuffer, 1, lpEvents); + if (!ReadConsoleInputW(hInput, s_irCache, IRSIZE, &dwEvents)) return FALSE; s_dwIndex = 0; s_dwMax = dwEvents; @@ -301,7 +355,7 @@ read_console_input( } *lpBuffer = s_irCache[s_dwIndex]; - if (nLength != -1 && ++s_dwIndex >= s_dwMax) + if (!(nLength == -1 || nLength == -2) && ++s_dwIndex >= s_dwMax) s_dwMax = 0; *lpEvents = 1; return TRUE; @@ -320,6 +374,35 @@ peek_console_input( return read_console_input(hInput, lpBuffer, -1, lpEvents); } +# ifdef FEAT_CLIENTSERVER + static DWORD +msg_wait_for_multiple_objects( + DWORD nCount, + LPHANDLE pHandles, + BOOL fWaitAll, + DWORD dwMilliseconds, + DWORD dwWakeMask) +{ + if (read_console_input(NULL, NULL, -2, NULL)) + return WAIT_OBJECT_0; + return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll, + dwMilliseconds, dwWakeMask); +} +# endif + +# ifndef FEAT_CLIENTSERVER + static DWORD +wait_for_single_object( + HANDLE hHandle, + DWORD dwMilliseconds) +{ + if (read_console_input(NULL, NULL, -2, NULL)) + return WAIT_OBJECT_0; + return WaitForSingleObject(hHandle, dwMilliseconds); +} +# endif +#endif + static void get_exe_name(void) { @@ -358,7 +441,7 @@ get_exe_name(void) STRCAT(temp, ";"); } STRCAT(temp, exe_path); - vim_setenv((char_u *)"PATH", temp); + vim_setenv((char_u *)"PATH", (char_u *)temp); } } } @@ -394,7 +477,6 @@ unescape_shellxquote(char_u *p, char_u *escaped) vimLoadLib(char *name) { HINSTANCE dll = NULL; - char old_dir[MAXPATHL]; /* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call * vimLoadLib() recursively, which causes a stack overflow. */ @@ -402,7 +484,6 @@ vimLoadLib(char *name) get_exe_name(); if (exe_path != NULL) { -#ifdef FEAT_MBYTE WCHAR old_dirw[MAXPATHL]; if (GetCurrentDirectoryW(MAXPATHL, old_dirw) != 0) @@ -410,47 +491,121 @@ vimLoadLib(char *name) /* Change directory to where the executable is, both to make * sure we find a .dll there and to avoid looking for a .dll * in the current directory. */ - SetCurrentDirectory(exe_path); + SetCurrentDirectory((LPCSTR)exe_path); dll = LoadLibrary(name); SetCurrentDirectoryW(old_dirw); return dll; } - /* Retry with non-wide function (for Windows 98). */ - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) -#endif - if (GetCurrentDirectory(MAXPATHL, old_dir) != 0) + } + return dll; +} + +#if defined(DYNAMIC_ICONV) || defined(DYNAMIC_GETTEXT) || defined(PROTO) +/* + * Get related information about 'funcname' which is imported by 'hInst'. + * If 'info' is 0, return the function address. + * If 'info' is 1, return the module name which the function is imported from. + */ + static void * +get_imported_func_info(HINSTANCE hInst, const char *funcname, int info) +{ + PBYTE pImage = (PBYTE)hInst; + PIMAGE_DOS_HEADER pDOS = (PIMAGE_DOS_HEADER)hInst; + PIMAGE_NT_HEADERS pPE; + PIMAGE_IMPORT_DESCRIPTOR pImpDesc; + PIMAGE_THUNK_DATA pIAT; /* Import Address Table */ + PIMAGE_THUNK_DATA pINT; /* Import Name Table */ + PIMAGE_IMPORT_BY_NAME pImpName; + + if (pDOS->e_magic != IMAGE_DOS_SIGNATURE) + return NULL; + pPE = (PIMAGE_NT_HEADERS)(pImage + pDOS->e_lfanew); + if (pPE->Signature != IMAGE_NT_SIGNATURE) + return NULL; + pImpDesc = (PIMAGE_IMPORT_DESCRIPTOR)(pImage + + pPE->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] + .VirtualAddress); + for (; pImpDesc->FirstThunk; ++pImpDesc) + { + if (!pImpDesc->OriginalFirstThunk) + continue; + pIAT = (PIMAGE_THUNK_DATA)(pImage + pImpDesc->FirstThunk); + pINT = (PIMAGE_THUNK_DATA)(pImage + pImpDesc->OriginalFirstThunk); + for (; pIAT->u1.Function; ++pIAT, ++pINT) + { + if (IMAGE_SNAP_BY_ORDINAL(pINT->u1.Ordinal)) + continue; + pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage + + (UINT_PTR)(pINT->u1.AddressOfData)); + if (strcmp((char *)pImpName->Name, funcname) == 0) { - /* Change directory to where the executable is, both to make - * sure we find a .dll there and to avoid looking for a .dll - * in the current directory. */ - SetCurrentDirectory(exe_path); - dll = LoadLibrary(name); - SetCurrentDirectory(old_dir); + switch (info) + { + case 0: + return (void *)pIAT->u1.Function; + case 1: + return (void *)(pImage + pImpDesc->Name); + default: + return NULL; + } } + } } - return dll; + return NULL; +} + +/* + * Get the module handle which 'funcname' in 'hInst' is imported from. + */ + HINSTANCE +find_imported_module_by_funcname(HINSTANCE hInst, const char *funcname) +{ + char *modulename; + + modulename = (char *)get_imported_func_info(hInst, funcname, 1); + if (modulename != NULL) + return GetModuleHandleA(modulename); + return NULL; +} + +/* + * Get the address of 'funcname' which is imported by 'hInst' DLL. + */ + void * +get_dll_import_func(HINSTANCE hInst, const char *funcname) +{ + return get_imported_func_info(hInst, funcname, 0); } +#endif #if defined(DYNAMIC_GETTEXT) || defined(PROTO) # ifndef GETTEXT_DLL # define GETTEXT_DLL "libintl.dll" +# define GETTEXT_DLL_ALT "libintl-8.dll" # endif /* Dummy functions */ static char *null_libintl_gettext(const char *); +static char *null_libintl_ngettext(const char *, const char *, unsigned long n); static char *null_libintl_textdomain(const char *); static char *null_libintl_bindtextdomain(const char *, const char *); static char *null_libintl_bind_textdomain_codeset(const char *, const char *); +static int null_libintl_putenv(const char *); +static int null_libintl_wputenv(const wchar_t *); static HINSTANCE hLibintlDLL = NULL; char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext; +char *(*dyn_libintl_ngettext)(const char *, const char *, unsigned long n) + = null_libintl_ngettext; char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain; char *(*dyn_libintl_bindtextdomain)(const char *, const char *) = null_libintl_bindtextdomain; char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) = null_libintl_bind_textdomain_codeset; +int (*dyn_libintl_putenv)(const char *) = null_libintl_putenv; +int (*dyn_libintl_wputenv)(const wchar_t *) = null_libintl_wputenv; int -dyn_libintl_init(char *libname) +dyn_libintl_init(void) { int i; static struct @@ -460,16 +615,22 @@ dyn_libintl_init(char *libname) } libintl_entry[] = { {"gettext", (FARPROC*)&dyn_libintl_gettext}, + {"ngettext", (FARPROC*)&dyn_libintl_ngettext}, {"textdomain", (FARPROC*)&dyn_libintl_textdomain}, {"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain}, {NULL, NULL} }; + HINSTANCE hmsvcrt; /* No need to initialize twice. */ if (hLibintlDLL) return 1; /* Load gettext library (libintl.dll) */ - hLibintlDLL = vimLoadLib(libname != NULL ? libname : GETTEXT_DLL); + hLibintlDLL = vimLoadLib(GETTEXT_DLL); +#ifdef GETTEXT_DLL_ALT + if (!hLibintlDLL) + hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT); +#endif if (!hLibintlDLL) { if (p_verbose > 0) @@ -504,50 +665,85 @@ dyn_libintl_init(char *libname) dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; + /* _putenv() function for the libintl.dll is optional. */ + hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv"); + if (hmsvcrt != NULL) + { + dyn_libintl_putenv = (void *)GetProcAddress(hmsvcrt, "_putenv"); + dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv"); + } + if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == _putenv) + dyn_libintl_putenv = null_libintl_putenv; + if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv) + dyn_libintl_wputenv = null_libintl_wputenv; + return 1; } void -dyn_libintl_end() +dyn_libintl_end(void) { if (hLibintlDLL) FreeLibrary(hLibintlDLL); hLibintlDLL = NULL; dyn_libintl_gettext = null_libintl_gettext; + dyn_libintl_ngettext = null_libintl_ngettext; dyn_libintl_textdomain = null_libintl_textdomain; dyn_libintl_bindtextdomain = null_libintl_bindtextdomain; dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; + dyn_libintl_putenv = null_libintl_putenv; + dyn_libintl_wputenv = null_libintl_wputenv; } -/*ARGSUSED*/ static char * null_libintl_gettext(const char *msgid) { return (char*)msgid; } -/*ARGSUSED*/ static char * -null_libintl_bindtextdomain(const char *domainname, const char *dirname) +null_libintl_ngettext( + const char *msgid, + const char *msgid_plural, + unsigned long n) +{ + return (char *)(n == 1 ? msgid : msgid_plural); +} + + static char * +null_libintl_bindtextdomain( + const char *domainname UNUSED, + const char *dirname UNUSED) { return NULL; } -/*ARGSUSED*/ static char * -null_libintl_bind_textdomain_codeset(const char *domainname, - const char *codeset) +null_libintl_bind_textdomain_codeset( + const char *domainname UNUSED, + const char *codeset UNUSED) { return NULL; } -/*ARGSUSED*/ static char * -null_libintl_textdomain(const char *domainname) +null_libintl_textdomain(const char *domainname UNUSED) { return NULL; } + static int +null_libintl_putenv(const char *envstring UNUSED) +{ + return 0; +} + + static int +null_libintl_wputenv(const wchar_t *envstring UNUSED) +{ + return 0; +} + #endif /* DYNAMIC_GETTEXT */ /* This symbol is not defined in older versions of the SDK or Visual C++ */ @@ -565,38 +761,8 @@ DWORD g_PlatformId; # ifndef PROTECTED_DACL_SECURITY_INFORMATION # define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000L # endif - -/* - * These are needed to dynamically load the ADVAPI DLL, which is not - * implemented under Windows 95 (and causes VIM to crash) - */ -typedef DWORD (WINAPI *PSNSECINFO) (LPSTR, SE_OBJECT_TYPE, - SECURITY_INFORMATION, PSID, PSID, PACL, PACL); -typedef DWORD (WINAPI *PGNSECINFO) (LPSTR, SE_OBJECT_TYPE, - SECURITY_INFORMATION, PSID *, PSID *, PACL *, PACL *, - PSECURITY_DESCRIPTOR *); -# ifdef FEAT_MBYTE -typedef DWORD (WINAPI *PSNSECINFOW) (LPWSTR, SE_OBJECT_TYPE, - SECURITY_INFORMATION, PSID, PSID, PACL, PACL); -typedef DWORD (WINAPI *PGNSECINFOW) (LPWSTR, SE_OBJECT_TYPE, - SECURITY_INFORMATION, PSID *, PSID *, PACL *, PACL *, - PSECURITY_DESCRIPTOR *); -# endif - -static HANDLE advapi_lib = NULL; /* Handle for ADVAPI library */ -static PSNSECINFO pSetNamedSecurityInfo; -static PGNSECINFO pGetNamedSecurityInfo; -# ifdef FEAT_MBYTE -static PSNSECINFOW pSetNamedSecurityInfoW; -static PGNSECINFOW pGetNamedSecurityInfoW; -# endif #endif -typedef BOOL (WINAPI *PSETHANDLEINFORMATION)(HANDLE, DWORD, DWORD); - -static BOOL allowPiping = FALSE; -static PSETHANDLEINFORMATION pSetHandleInformation; - #ifdef HAVE_ACL /* * Enables or disables the specified privilege. @@ -656,93 +822,13 @@ PlatformId(void) win8_or_later = TRUE; #ifdef HAVE_ACL - /* - * Load the ADVAPI runtime if we are on anything - * other than Windows 95 - */ - if (g_PlatformId == VER_PLATFORM_WIN32_NT) - { - /* - * do this load. Problems: Doesn't unload at end of run (this is - * theoretically okay, since Windows should unload it when VIM - * terminates). Should we be using the 'mch_libcall' routines? - * Seems like a lot of overhead to load/unload ADVAPI32.DLL each - * time we verify security... - */ - advapi_lib = vimLoadLib("ADVAPI32.DLL"); - if (advapi_lib != NULL) - { - pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib, - "SetNamedSecurityInfoA"); - pGetNamedSecurityInfo = (PGNSECINFO)GetProcAddress(advapi_lib, - "GetNamedSecurityInfoA"); -# ifdef FEAT_MBYTE - pSetNamedSecurityInfoW = (PSNSECINFOW)GetProcAddress(advapi_lib, - "SetNamedSecurityInfoW"); - pGetNamedSecurityInfoW = (PGNSECINFOW)GetProcAddress(advapi_lib, - "GetNamedSecurityInfoW"); -# endif - if (pSetNamedSecurityInfo == NULL - || pGetNamedSecurityInfo == NULL -# ifdef FEAT_MBYTE - || pSetNamedSecurityInfoW == NULL - || pGetNamedSecurityInfoW == NULL -# endif - ) - { - /* If we can't get the function addresses, set advapi_lib - * to NULL so that we don't use them. */ - FreeLibrary(advapi_lib); - advapi_lib = NULL; - } - /* Enable privilege for getting or setting SACLs. */ - win32_enable_privilege(SE_SECURITY_NAME, TRUE); - } - } + /* Enable privilege for getting or setting SACLs. */ + win32_enable_privilege(SE_SECURITY_NAME, TRUE); #endif - /* - * If we are on windows NT, try to load the pipe functions, only - * available from Win2K. - */ - if (g_PlatformId == VER_PLATFORM_WIN32_NT) - { - HANDLE kernel32 = GetModuleHandle("kernel32"); - pSetHandleInformation = (PSETHANDLEINFORMATION)GetProcAddress( - kernel32, "SetHandleInformation"); - - allowPiping = pSetHandleInformation != NULL; - } done = TRUE; } } -/* - * Return TRUE when running on Windows 95 (or 98 or ME). - * Only to be used after mch_init(). - */ - int -mch_windows95(void) -{ - return g_PlatformId == VER_PLATFORM_WIN32_WINDOWS; -} - -#ifdef FEAT_GUI_W32 -/* - * Used to work around the "can't do synchronous spawn" - * problem on Win32s, without resorting to Universal Thunk. - */ -static int old_num_windows; -static int num_windows; - -/*ARGSUSED*/ - static BOOL CALLBACK -win32ssynch_cb(HWND hwnd, LPARAM lparam) -{ - num_windows++; - return TRUE; -} -#endif - #ifndef FEAT_GUI_W32 #define SHIFT (SHIFT_PRESSED) @@ -839,9 +925,9 @@ static const struct #endif #if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) -# define AChar AsciiChar +# define UChar UnicodeChar #else -# define AChar uChar.AsciiChar +# define UChar uChar.UnicodeChar #endif /* The return code indicates key code size. */ @@ -860,27 +946,18 @@ win32_kbd_patch_key( if (s_iIsDead == 2) { - pker->AChar = (CHAR) awAnsiCode[1]; + pker->UChar = (WCHAR) awAnsiCode[1]; s_iIsDead = 0; return 1; } - if (pker->AChar != 0) + if (pker->UChar != 0) return 1; vim_memset(abKeystate, 0, sizeof (abKeystate)); - // Should only be non-NULL on NT 4.0 - if (s_pfnGetConsoleKeyboardLayoutName != NULL) - { - CHAR szKLID[KL_NAMELENGTH]; - - if ((*s_pfnGetConsoleKeyboardLayoutName)(szKLID)) - (void)LoadKeyboardLayout(szKLID, KLF_ACTIVATE); - } - /* Clear any pending dead keys */ - ToAscii(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 0); + ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 2, 0); if (uMods & SHIFT_PRESSED) abKeystate[VK_SHIFT] = 0x80; @@ -893,11 +970,11 @@ win32_kbd_patch_key( abKeystate[VK_MENU] = abKeystate[VK_RMENU] = 0x80; } - s_iIsDead = ToAscii(pker->wVirtualKeyCode, pker->wVirtualScanCode, - abKeystate, awAnsiCode, 0); + s_iIsDead = ToUnicode(pker->wVirtualKeyCode, pker->wVirtualScanCode, + abKeystate, awAnsiCode, 2, 0); if (s_iIsDead > 0) - pker->AChar = (CHAR) awAnsiCode[0]; + pker->UChar = (WCHAR) awAnsiCode[0]; return s_iIsDead; } @@ -924,8 +1001,8 @@ static BOOL g_fJustGotFocus = FALSE; static BOOL decode_key_event( KEY_EVENT_RECORD *pker, - char_u *pch, - char_u *pch2, + WCHAR *pch, + WCHAR *pch2, int *pmodifiers, BOOL fDoPost) { @@ -953,7 +1030,7 @@ decode_key_event( } /* special cases */ - if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0 && pker->AChar == NUL) + if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0 && pker->UChar == NUL) { /* Ctrl-6 is Ctrl-^ */ if (pker->wVirtualKeyCode == '6') @@ -1015,7 +1092,7 @@ decode_key_event( *pch = NUL; else { - *pch = (i > 0) ? pker->AChar : NUL; + *pch = (i > 0) ? pker->UChar : NUL; if (pmodifiers != NULL) { @@ -1054,9 +1131,8 @@ decode_key_event( * For the GUI the mouse handling is in gui_w32.c. */ # ifdef FEAT_GUI_W32 -/*ARGSUSED*/ void -mch_setmouse(int on) +mch_setmouse(int on UNUSED) { } # else @@ -1089,6 +1165,17 @@ mch_setmouse(int on) } +#if defined(FEAT_BEVAL_TERM) || defined(PROTO) +/* + * Called when 'balloonevalterm' changed. + */ + void +mch_bevalterm_changed(void) +{ + mch_setmouse(g_fMouseActive); +} +#endif + /* * Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT, * MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse @@ -1168,7 +1255,7 @@ decode_mouse_event( if (pmer->dwEventFlags == MOUSE_MOVED) { - /* ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these + /* Ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these * events even when the mouse moves only within a char cell.) */ if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse) return FALSE; @@ -1177,11 +1264,20 @@ decode_mouse_event( /* If no buttons are pressed... */ if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0) { + nButton = MOUSE_RELEASE; + /* If the last thing returned was MOUSE_RELEASE, ignore this */ if (s_fReleased) - return FALSE; + { +#ifdef FEAT_BEVAL_TERM + /* do return mouse move events when we want them */ + if (p_bevalterm) + nButton = MOUSE_DRAG; + else +#endif + return FALSE; + } - nButton = MOUSE_RELEASE; s_fReleased = TRUE; } else /* one or more buttons pressed */ @@ -1399,15 +1495,19 @@ handle_focus_event(INPUT_RECORD ir) /* * Wait until console input from keyboard or mouse is available, * or the time is up. + * When "ignore_input" is TRUE even wait when input is available. * Return TRUE if something is available FALSE if not. */ static int -WaitForChar(long msec) +WaitForChar(long msec, int ignore_input) { DWORD dwNow = 0, dwEndTime = 0; INPUT_RECORD ir; DWORD cRecords; - char_u ch, ch2; + WCHAR ch, ch2; +#ifdef FEAT_TIMERS + int tb_change_cnt = typebuf.tb_change_cnt; +#endif if (msec > 0) /* Wait until the specified time has elapsed. */ @@ -1421,18 +1521,22 @@ WaitForChar(long msec) */ for (;;) { +#ifdef MESSAGE_QUEUE + parse_queued_messages(); +#endif #ifdef FEAT_MZSCHEME mzvim_check_threads(); #endif #ifdef FEAT_CLIENTSERVER serverProcessPendingMessages(); #endif + if (0 #ifdef FEAT_MOUSE || g_nMouseClick != -1 #endif #ifdef FEAT_CLIENTSERVER - || input_available() + || (!ignore_input && input_available()) #endif ) return TRUE; @@ -1449,18 +1553,55 @@ WaitForChar(long msec) { DWORD dwWaitTime = dwEndTime - dwNow; +#ifdef FEAT_JOB_CHANNEL + /* Check channel while waiting for input. */ + if (dwWaitTime > 100) + { + dwWaitTime = 100; + /* If there is readahead then parse_queued_messages() timed out + * and we should call it again soon. */ + if (channel_any_readahead()) + dwWaitTime = 10; + } +#endif +#ifdef FEAT_BEVAL_GUI + if (p_beval && dwWaitTime > 100) + /* The 'balloonexpr' may indirectly invoke a callback while + * waiting for a character, need to check often. */ + dwWaitTime = 100; +#endif #ifdef FEAT_MZSCHEME if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || (long)dwWaitTime > p_mzq)) dwWaitTime = p_mzq; /* don't wait longer than 'mzquantum' */ #endif +#ifdef FEAT_TIMERS + { + long due_time; + + /* When waiting very briefly don't trigger timers. */ + if (dwWaitTime > 10) + { + /* Trigger timers and then get the time in msec until the + * next one is due. Wait up to that time. */ + due_time = check_due_timer(); + if (typebuf.tb_change_cnt != tb_change_cnt) + { + /* timer may have used feedkeys() */ + return FALSE; + } + if (due_time > 0 && dwWaitTime > (DWORD)due_time) + dwWaitTime = due_time; + } + } +#endif #ifdef FEAT_CLIENTSERVER /* Wait for either an event on the console input or a message in * the client-server window. */ - if (MsgWaitForMultipleObjects(1, &g_hConIn, FALSE, + if (msg_wait_for_multiple_objects(1, &g_hConIn, FALSE, dwWaitTime, QS_SENDMESSAGE) != WAIT_OBJECT_0) #else - if (WaitForSingleObject(g_hConIn, dwWaitTime) != WAIT_OBJECT_0) + if (wait_for_single_object(g_hConIn, dwWaitTime) != WAIT_OBJECT_0) #endif continue; } @@ -1494,7 +1635,7 @@ WaitForChar(long msec) #ifdef FEAT_MBYTE_IME /* Windows IME sends two '\n's with only one 'ENTER'. First: * wVirtualKeyCode == 13. second: wVirtualKeyCode == 0 */ - if (ir.Event.KeyEvent.uChar.UnicodeChar == 0 + if (ir.Event.KeyEvent.UChar == 0 && ir.Event.KeyEvent.wVirtualKeyCode == 13) { read_console_input(g_hConIn, &ir, 1, &cRecords); @@ -1511,7 +1652,13 @@ WaitForChar(long msec) if (ir.EventType == FOCUS_EVENT) handle_focus_event(ir); else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT) - shell_resized(); + { + /* Only call shell_resized() when the size actually change to + * avoid the screen is cleard. */ + if (ir.Event.WindowBufferSizeEvent.dwSize.X != Columns + || ir.Event.WindowBufferSizeEvent.dwSize.Y != Rows) + shell_resized(); + } #ifdef FEAT_MOUSE else if (ir.EventType == MOUSE_EVENT && decode_mouse_event(&ir.Event.MouseEvent)) @@ -1527,6 +1674,7 @@ WaitForChar(long msec) if (input_available()) return TRUE; #endif + return FALSE; } @@ -1537,8 +1685,19 @@ WaitForChar(long msec) int mch_char_avail(void) { - return WaitForChar(0L); + return WaitForChar(0L, FALSE); +} + +# if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * Check for any pending input or messages. + */ + int +mch_check_messages(void) +{ + return WaitForChar(0L, TRUE); } +# endif #endif /* @@ -1555,12 +1714,12 @@ create_conin(void) } /* - * Get a keystroke or a mouse event + * Get a keystroke or a mouse event, use a blocking wait. */ - static char_u -tgetch(int *pmodifiers, char_u *pch2) + static WCHAR +tgetch(int *pmodifiers, WCHAR *pch2) { - char_u ch; + WCHAR ch; for (;;) { @@ -1568,7 +1727,7 @@ tgetch(int *pmodifiers, char_u *pch2) DWORD cRecords = 0; #ifdef FEAT_CLIENTSERVER - (void)WaitForChar(-1L); + (void)WaitForChar(-1L, FALSE); if (input_available()) return 0; # ifdef FEAT_MOUSE @@ -1614,13 +1773,12 @@ tgetch(int *pmodifiers, char_u *pch2) * If time == -1, wait forever for characters. * Returns the number of characters read into buf. */ -/*ARGSUSED*/ int mch_inchar( - char_u *buf, - int maxlen, - long time, - int tb_change_cnt) + char_u *buf UNUSED, + int maxlen UNUSED, + long time UNUSED, + int tb_change_cnt UNUSED) { #ifndef FEAT_GUI_W32 /* this isn't used for the GUI */ @@ -1629,40 +1787,14 @@ mch_inchar( #define TYPEAHEADLEN 20 static char_u typeahead[TYPEAHEADLEN]; /* previously typed bytes. */ static int typeaheadlen = 0; -#ifdef FEAT_MBYTE - static char_u *rest = NULL; /* unconverted rest of previous read */ - static int restlen = 0; - int unconverted; -#endif /* First use any typeahead that was kept because "buf" was too small. */ if (typeaheadlen > 0) goto theend; -#ifdef FEAT_SNIFF - if (want_sniff_request) - { - if (sniff_request_waiting) - { - /* return K_SNIFF */ - typeahead[typeaheadlen++] = CSI; - typeahead[typeaheadlen++] = (char_u)KS_EXTRA; - typeahead[typeaheadlen++] = (char_u)KE_SNIFF; - sniff_request_waiting = 0; - want_sniff_request = 0; - goto theend; - } - else if (time < 0 || time > 250) - { - /* don't wait too long, a request might be pending */ - time = 250; - } - } -#endif - if (time >= 0) { - if (!WaitForChar(time)) /* no character available */ + if (!WaitForChar(time, FALSE)) /* no character available */ return 0; } else /* time == -1, wait forever */ @@ -1674,9 +1806,8 @@ mch_inchar( * write the autoscript file to disk. Or cause the CursorHold event * to be triggered. */ - if (!WaitForChar(p_ut)) + if (!WaitForChar(p_ut, FALSE)) { -#ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; @@ -1684,7 +1815,6 @@ mch_inchar( buf[2] = (int)KE_CURSORHOLD; return 3; } -#endif before_blocking(); } } @@ -1704,7 +1834,7 @@ mch_inchar( /* Keep looping until there is something in the typeahead buffer and more * to get and still room in the buffer (up to two bytes for a char and * three bytes for a modifier). */ - while ((typeaheadlen == 0 || WaitForChar(0L)) + while ((typeaheadlen == 0 || WaitForChar(0L, FALSE)) && typeaheadlen + 5 <= TYPEAHEADLEN) { if (typebuf_changed(tb_change_cnt)) @@ -1732,38 +1862,11 @@ mch_inchar( else #endif { - char_u ch2 = NUL; + WCHAR ch2 = NUL; int modifiers = 0; c = tgetch(&modifiers, &ch2); -#ifdef FEAT_MBYTE - /* stolen from fill_input_buf() in ui.c */ - if (rest != NULL) - { - /* Use remainder of previous call, starts with an invalid - * character that may become valid when reading more. */ - if (restlen > TYPEAHEADLEN - typeaheadlen) - unconverted = TYPEAHEADLEN - typeaheadlen; - else - unconverted = restlen; - mch_memmove(typeahead + typeaheadlen, rest, unconverted); - if (unconverted == restlen) - { - vim_free(rest); - rest = NULL; - } - else - { - restlen -= unconverted; - mch_memmove(rest, rest + unconverted, restlen); - } - typeaheadlen += unconverted; - } - else - unconverted = 0; -#endif - if (typebuf_changed(tb_change_cnt)) { /* "buf" may be invalid now if a client put something in the @@ -1785,45 +1888,44 @@ mch_inchar( #endif { int n = 1; - int conv = FALSE; - typeahead[typeaheadlen] = c; - if (ch2 != NUL) - { - typeahead[typeaheadlen + 1] = 3; - typeahead[typeaheadlen + 2] = ch2; - n += 2; - } #ifdef FEAT_MBYTE - /* Only convert normal characters, not special keys. Need to - * convert before applying ALT, otherwise mapping <M-x> breaks - * when 'tenc' is set. */ - if (input_conv.vc_type != CONV_NONE - && (ch2 == NUL || c != K_NUL)) + if (ch2 == NUL) { - conv = TRUE; - typeaheadlen -= unconverted; - n = convert_input_safe(typeahead + typeaheadlen, - n + unconverted, TYPEAHEADLEN - typeaheadlen, - rest == NULL ? &rest : NULL, &restlen); + int i; + char_u *p; + WCHAR ch[2]; + + ch[0] = c; + if (c >= 0xD800 && c <= 0xDBFF) /* High surrogate */ + { + ch[1] = tgetch(&modifiers, &ch2); + n++; + } + p = utf16_to_enc(ch, &n); + if (p != NULL) + { + for (i = 0; i < n; i++) + typeahead[typeaheadlen + i] = p[i]; + vim_free(p); + } } + else #endif - - if (conv) + typeahead[typeaheadlen] = c; + if (ch2 != NUL) { - char_u *p = typeahead + typeaheadlen; - char_u *e = typeahead + TYPEAHEADLEN; - - while (*p && p < e) + if (c == K_NUL && (ch2 & 0xff00) != 0) { - if (*p == K_NUL) - { - ++p; - mch_memmove(p + 1, p, ((size_t)(e - p)) - 1); - *p = 3; - ++n; - } - ++p; + /* fAnsiKey with modifier keys */ + typeahead[typeaheadlen + n] = (char_u)ch2; + n++; + } + else + { + typeahead[typeaheadlen + n] = 3; + typeahead[typeaheadlen + n + 1] = (char_u)ch2; + n += 2; } } @@ -1898,47 +2000,81 @@ mch_inchar( #endif /* - * Return TRUE if "name" is in $PATH. + * If "use_path" is TRUE: Return TRUE if "name" is in $PATH. + * If "use_path" is FALSE: Return TRUE if "name" exists. + * When returning TRUE and "path" is not NULL save the path and set "*path" to + * the allocated memory. * TODO: Should somehow check if it's really executable. */ static int -executable_exists(char *name, char_u **path) +executable_exists(char *name, char_u **path, int use_path) { char *dum; char fname[_MAX_PATH]; + char *curpath, *newpath; + long n; + + if (!use_path) + { + if (mch_getperm((char_u *)name) != -1 && !mch_isdir((char_u *)name)) + { + if (path != NULL) + { + if (mch_isFullName((char_u *)name)) + *path = vim_strsave((char_u *)name); + else + *path = FullName_save((char_u *)name, FALSE); + } + return TRUE; + } + return FALSE; + } #ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - WCHAR *p = enc_to_utf16(name, NULL); + WCHAR *p = enc_to_utf16((char_u *)name, NULL); WCHAR fnamew[_MAX_PATH]; WCHAR *dumw; - long n; + WCHAR *wcurpath, *wnewpath; if (p != NULL) { - n = (long)SearchPathW(NULL, p, NULL, _MAX_PATH, fnamew, &dumw); + wcurpath = _wgetenv(L"PATH"); + wnewpath = (WCHAR*)alloc((unsigned)(wcslen(wcurpath) + 3) + * sizeof(WCHAR)); + if (wnewpath == NULL) + return FALSE; + wcscpy(wnewpath, L".;"); + wcscat(wnewpath, wcurpath); + n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw); + vim_free(wnewpath); vim_free(p); - if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - { - if (n == 0) - return FALSE; - if (GetFileAttributesW(fnamew) & FILE_ATTRIBUTE_DIRECTORY) - return FALSE; - if (path != NULL) - *path = utf16_to_enc(fnamew, NULL); - return TRUE; - } - /* Retry with non-wide function (for Windows 98). */ + if (n == 0) + return FALSE; + if (GetFileAttributesW(fnamew) & FILE_ATTRIBUTE_DIRECTORY) + return FALSE; + if (path != NULL) + *path = utf16_to_enc(fnamew, NULL); + return TRUE; } } #endif - if (SearchPath(NULL, name, NULL, _MAX_PATH, fname, &dum) == 0) + + curpath = getenv("PATH"); + newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3)); + if (newpath == NULL) + return FALSE; + STRCPY(newpath, ".;"); + STRCAT(newpath, curpath); + n = (long)SearchPath(newpath, name, NULL, _MAX_PATH, fname, &dum); + vim_free(newpath); + if (n == 0) return FALSE; - if (mch_isdir(fname)) + if (mch_isdir((char_u *)fname)) return FALSE; if (path != NULL) - *path = vim_strsave(fname); + *path = vim_strsave((char_u *)fname); return TRUE; } @@ -1997,7 +2133,6 @@ mch_init(void) Columns = 80; /* Look for 'vimrun' */ - if (!gui_is_win32s()) { char_u vimrun_location[_MAX_PATH + 4]; @@ -2020,7 +2155,7 @@ mch_init(void) vimrun_path = (char *)vim_strsave(vimrun_location); s_dont_use_vimrun = FALSE; } - else if (executable_exists("vimrun.exe", NULL)) + else if (executable_exists("vimrun.exe", NULL, TRUE)) s_dont_use_vimrun = FALSE; /* Don't give the warning for a missing vimrun.exe right now, but only @@ -2034,7 +2169,7 @@ mch_init(void) * If "finstr.exe" doesn't exist, use "grep -n" for 'grepprg'. * Otherwise the default "findstr /n" is used. */ - if (!executable_exists("findstr.exe", NULL)) + if (!executable_exists("findstr.exe", NULL, TRUE)) set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0); #ifdef FEAT_CLIPBOARD @@ -2142,6 +2277,8 @@ typedef struct ConsoleBufferStruct CONSOLE_SCREEN_BUFFER_INFO Info; PCHAR_INFO Buffer; COORD BufferSize; + PSMALL_RECT Regions; + int NumRegions; } ConsoleBuffer; /* @@ -2162,6 +2299,7 @@ SaveConsoleBuffer( COORD BufferCoord; SMALL_RECT ReadRegion; WORD Y, Y_incr; + int i, numregions; if (cb == NULL) return FALSE; @@ -2204,7 +2342,21 @@ SaveConsoleBuffer( ReadRegion.Left = 0; ReadRegion.Right = cb->Info.dwSize.X - 1; Y_incr = 12000 / cb->Info.dwSize.X; - for (Y = 0; Y < cb->BufferSize.Y; Y += Y_incr) + + numregions = (cb->Info.dwSize.Y + Y_incr - 1) / Y_incr; + if (cb->Regions == NULL || numregions != cb->NumRegions) + { + cb->NumRegions = numregions; + vim_free(cb->Regions); + cb->Regions = (PSMALL_RECT)alloc(cb->NumRegions * sizeof(SMALL_RECT)); + if (cb->Regions == NULL) + { + VIM_CLEAR(cb->Buffer); + return FALSE; + } + } + + for (i = 0, Y = 0; i < cb->NumRegions; i++, Y += Y_incr) { /* * Read into position (0, Y) in our buffer. @@ -2218,16 +2370,17 @@ SaveConsoleBuffer( */ ReadRegion.Top = Y; ReadRegion.Bottom = Y + Y_incr - 1; - if (!ReadConsoleOutput(g_hConOut, /* output handle */ + if (!ReadConsoleOutputW(g_hConOut, /* output handle */ cb->Buffer, /* our buffer */ cb->BufferSize, /* dimensions of our buffer */ BufferCoord, /* offset in our buffer */ &ReadRegion)) /* region to save */ { - vim_free(cb->Buffer); - cb->Buffer = NULL; + VIM_CLEAR(cb->Buffer); + VIM_CLEAR(cb->Regions); return FALSE; } + cb->Regions[i] = ReadRegion; } return TRUE; @@ -2249,6 +2402,7 @@ RestoreConsoleBuffer( { COORD BufferCoord; SMALL_RECT WriteRegion; + int i; if (cb == NULL || !cb->IsValid) return FALSE; @@ -2285,19 +2439,19 @@ RestoreConsoleBuffer( */ if (cb->Buffer != NULL) { - BufferCoord.X = 0; - BufferCoord.Y = 0; - WriteRegion.Left = 0; - WriteRegion.Top = 0; - WriteRegion.Right = cb->Info.dwSize.X - 1; - WriteRegion.Bottom = cb->Info.dwSize.Y - 1; - if (!WriteConsoleOutput(g_hConOut, /* output handle */ - cb->Buffer, /* our buffer */ - cb->BufferSize, /* dimensions of our buffer */ - BufferCoord, /* offset in our buffer */ - &WriteRegion)) /* region to restore */ + for (i = 0; i < cb->NumRegions; i++) { - return FALSE; + BufferCoord.X = cb->Regions[i].Left; + BufferCoord.Y = cb->Regions[i].Top; + WriteRegion = cb->Regions[i]; + if (!WriteConsoleOutputW(g_hConOut, /* output handle */ + cb->Buffer, /* our buffer */ + cb->BufferSize, /* dimensions of our buffer */ + BufferCoord, /* offset in our buffer */ + &WriteRegion)) /* region to restore */ + { + return FALSE; + } } } @@ -2315,7 +2469,7 @@ static ConsoleBuffer g_cbTermcap = { 0 }; #ifdef __BORLANDC__ typedef HWND (__stdcall *GETCONSOLEWINDOWPROC)(VOID); #else -typedef WINBASEAPI HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID); +typedef HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID); #endif char g_szOrigTitle[256] = { 0 }; HWND g_hWnd = NULL; /* also used in os_mswin.c */ @@ -2371,18 +2525,15 @@ SetConsoleIcon( HICON hIconSmall, HICON hIcon) { - HICON hPrevIconSmall; - HICON hPrevIcon; - if (hWnd == NULL) return FALSE; if (hIconSmall != NULL) - hPrevIconSmall = (HICON)SendMessage(hWnd, WM_SETICON, - (WPARAM)ICON_SMALL, (LPARAM)hIconSmall); + SendMessage(hWnd, WM_SETICON, + (WPARAM)ICON_SMALL, (LPARAM)hIconSmall); if (hIcon != NULL) - hPrevIcon = (HICON)SendMessage(hWnd, WM_SETICON, - (WPARAM)ICON_BIG,(LPARAM) hIcon); + SendMessage(hWnd, WM_SETICON, + (WPARAM)ICON_BIG, (LPARAM) hIcon); return TRUE; } @@ -2399,8 +2550,6 @@ SetConsoleIcon( static void SaveConsoleTitleAndIcon(void) { - GETCONSOLEWINDOWPROC GetConsoleWindowProc; - /* Save the original title. */ if (!GetConsoleTitle(g_szOrigTitle, sizeof(g_szOrigTitle))) return; @@ -2412,12 +2561,7 @@ SaveConsoleTitleAndIcon(void) * 2000. On older operating systems, we can't change the window icon * anyway. */ - if ((GetConsoleWindowProc = (GETCONSOLEWINDOWPROC) - GetProcAddress(GetModuleHandle("KERNEL32.DLL"), - "GetConsoleWindow")) != NULL) - { - g_hWnd = (*GetConsoleWindowProc)(); - } + g_hWnd = GetConsoleWindow(); if (g_hWnd == NULL) return; @@ -2427,7 +2571,8 @@ SaveConsoleTitleAndIcon(void) return; /* Extract the first icon contained in the Vim executable. */ - g_hVimIcon = ExtractIcon(NULL, exe_name, 0); + if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL) + g_hVimIcon = ExtractIcon(NULL, (LPCSTR)exe_name, 0); if (g_hVimIcon != NULL) g_fCanChangeIcon = TRUE; } @@ -2526,10 +2671,7 @@ mch_init(void) win_clip_init(); #endif - /* This will be NULL on anything but NT 4.0 */ - s_pfnGetConsoleKeyboardLayoutName = - (PFNGCKLN) GetProcAddress(GetModuleHandle("kernel32.dll"), - "GetConsoleKeyboardLayoutNameA"); + vtp_init(); } /* @@ -2540,8 +2682,11 @@ mch_init(void) void mch_exit(int r) { - stoptermcap(); + exiting = TRUE; + vtp_exit(); + + stoptermcap(); if (g_fWindInitCalled) settmode(TMODE_COOK); @@ -2588,11 +2733,10 @@ mch_exit(int r) /* * Do we have an interactive window? */ -/*ARGSUSED*/ int mch_check_win( - int argc, - char **argv) + int argc UNUSED, + char **argv UNUSED) { get_exe_name(); @@ -2711,9 +2855,6 @@ fname_casew( *porig = c; ptrue = ptruePrev + wcslen(ptruePrev); } - else if (hFind == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return FAIL; } wcscpy(name, szTrueName); @@ -2755,9 +2896,10 @@ fname_case( if (p != NULL) { char_u *q; - WCHAR buf[_MAX_PATH + 2]; + WCHAR buf[_MAX_PATH + 1]; - wcscpy(buf, p); + wcsncpy(buf, p, _MAX_PATH); + buf[_MAX_PATH] = L'\0'; vim_free(p); if (fname_casew(buf, (len > 0) ? _MAX_PATH : 0) == OK) @@ -2771,7 +2913,7 @@ fname_case( } } } - /* Retry with non-wide function (for Windows 98). */ + return; } #endif @@ -2781,7 +2923,7 @@ fname_case( return; /* Build the new name in szTrueName[] one component at a time. */ - porig = name; + porig = (char *)name; ptrue = szTrueName; if (isalpha(porig[0]) && porig[1] == ':') @@ -2807,7 +2949,7 @@ fname_case( if (enc_dbcs) { - l = (*mb_ptr2len)(porig); + l = (*mb_ptr2len)((char_u *)porig); while (--l >= 0) *ptrue++ = *porig++; } @@ -2901,14 +3043,11 @@ mch_get_user_name( return OK; } } - else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return FAIL; - /* Retry with non-wide function (for Windows 98). */ } #endif if (GetUserName(szUserName, &cch)) { - vim_strncpy(s, szUserName, len - 1); + vim_strncpy(s, (char_u *)szUserName, len - 1); return OK; } s[0] = NUL; @@ -2943,13 +3082,10 @@ mch_get_host_name( return; } } - else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return; - /* Retry with non-wide function (for Windows 98). */ } #endif - if (!GetComputerName(s, &cch)) - vim_strncpy(s, "PC (Win32 Vim)", len - 1); + if (!GetComputerName((LPSTR)s, &cch)) + vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1); } @@ -2994,12 +3130,10 @@ mch_dirname( return OK; } } - else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return FAIL; - /* Retry with non-wide function (for Windows 98). */ + return FAIL; } #endif - return (GetCurrentDirectory(len, buf) != 0 ? OK : FAIL); + return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL); } /* @@ -3009,10 +3143,10 @@ mch_dirname( long mch_getperm(char_u *name) { - struct stat st; + stat_T st; int n; - n = mch_stat(name, &st); + n = mch_stat((char *)name, &st); return n == 0 ? (long)(unsigned short)st.st_mode : -1L; } @@ -3036,14 +3170,13 @@ mch_setperm(char_u *name, long perm) { n = _wchmod(p, perm); vim_free(p); - if (n == -1 && g_PlatformId == VER_PLATFORM_WIN32_NT) + if (n == -1) return FAIL; - /* Retry with non-wide function (for Windows 98). */ } } if (n == -1) #endif - n = _chmod(name, perm); + n = _chmod((const char *)name, perm); if (n == -1) return FAIL; @@ -3066,6 +3199,20 @@ mch_hide(char_u *name) win32_setattrs(name, attrs); } +/* + * Return TRUE if file "name" exists and is hidden. + */ + int +mch_ishidden(char_u *name) +{ + int f = win32_getattrs(name); + + if (f == -1) + return FALSE; /* file does not exist at all */ + + return (f & FILE_ATTRIBUTE_HIDDEN) != 0; +} + /* * return TRUE if "name" is a directory * return FALSE if "name" is not a directory or upon error @@ -3081,6 +3228,17 @@ mch_isdir(char_u *name) return (f & FILE_ATTRIBUTE_DIRECTORY) != 0; } +/* + * return TRUE if "name" is a directory, NOT a symlink to a directory + * return FALSE if "name" is not a directory + * return FALSE for error + */ + int +mch_isrealdir(char_u *name) +{ + return mch_isdir(name) && !mch_is_symbolic_link(name); +} + /* * Create directory "name". * Return 0 on success, -1 on error. @@ -3102,7 +3260,31 @@ mch_mkdir(char_u *name) return retval; } #endif - return _mkdir(name); + return _mkdir((const char *)name); +} + +/* + * Delete directory "name". + * Return 0 on success, -1 on error. + */ + int +mch_rmdir(char_u *name) +{ +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR *p; + int retval; + + p = enc_to_utf16(name, NULL); + if (p == NULL) + return -1; + retval = _wrmdir(p); + vim_free(p); + return retval; + } +#endif + return _rmdir((const char *)name); } /* @@ -3118,10 +3300,10 @@ mch_is_hard_link(char_u *fname) } /* - * Return TRUE if file "fname" is a symbolic link. + * Return TRUE if "name" is a symbolic link (or a junction). */ int -mch_is_symbolic_link(char_u *fname) +mch_is_symbolic_link(char_u *name) { HANDLE hFind; int res = FALSE; @@ -3132,23 +3314,12 @@ mch_is_symbolic_link(char_u *fname) WIN32_FIND_DATAW findDataW; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - wn = enc_to_utf16(fname, NULL); + wn = enc_to_utf16(name, NULL); if (wn != NULL) { hFind = FindFirstFileW(wn, &findDataW); vim_free(wn); - if (hFind == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - hFind = FindFirstFile(fname, &findDataA); - if (hFind != INVALID_HANDLE_VALUE) - { - fileFlags = findDataA.dwFileAttributes; - reparseTag = findDataA.dwReserved0; - } - } - else + if (hFind != INVALID_HANDLE_VALUE) { fileFlags = findDataW.dwFileAttributes; reparseTag = findDataW.dwReserved0; @@ -3157,7 +3328,7 @@ mch_is_symbolic_link(char_u *fname) else #endif { - hFind = FindFirstFile(fname, &findDataA); + hFind = FindFirstFile((LPCSTR)name, &findDataA); if (hFind != INVALID_HANDLE_VALUE) { fileFlags = findDataA.dwFileAttributes; @@ -3169,7 +3340,8 @@ mch_is_symbolic_link(char_u *fname) FindClose(hFind); if ((fileFlags & FILE_ATTRIBUTE_REPARSE_POINT) - && reparseTag == IO_REPARSE_TAG_SYMLINK) + && (reparseTag == IO_REPARSE_TAG_SYMLINK + || reparseTag == IO_REPARSE_TAG_MOUNT_POINT)) res = TRUE; return res; @@ -3206,7 +3378,7 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) { wn = enc_to_utf16(fname, NULL); if (wn == NULL) - res = FILEINFO_ENC_FAIL; + return FILEINFO_ENC_FAIL; } if (wn != NULL) { @@ -3217,18 +3389,12 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) OPEN_EXISTING, /* creation disposition */ FILE_FLAG_BACKUP_SEMANTICS, /* file attributes */ NULL); /* handle to template file */ - if (hFile == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - vim_free(wn); - wn = NULL; - } + vim_free(wn); } - if (wn == NULL) + else #endif - hFile = CreateFile(fname, /* file name */ - GENERIC_READ, /* access mode */ + hFile = CreateFile((LPCSTR)fname, /* file name */ + GENERIC_READ, /* access mode */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */ NULL, /* security descriptor */ OPEN_EXISTING, /* creation disposition */ @@ -3244,9 +3410,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) CloseHandle(hFile); } -#ifdef FEAT_MBYTE - vim_free(wn); -#endif return res; } @@ -3268,19 +3431,12 @@ win32_getattrs(char_u *name) if (p != NULL) { attr = GetFileAttributesW(p); - if (attr < 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - vim_free(p); - p = NULL; - } + vim_free(p); } - if (p == NULL) + else #endif attr = GetFileAttributes((char *)name); -#ifdef FEAT_MBYTE - vim_free(p); -#endif + return attr; } @@ -3303,20 +3459,12 @@ win32_setattrs(char_u *name, int attrs) if (p != NULL) { res = SetFileAttributesW(p, attrs); - if (res == FALSE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - vim_free(p); - p = NULL; - } + vim_free(p); } - if (p == NULL) + else #endif res = SetFileAttributes((char *)name, attrs); -#ifdef FEAT_MBYTE - vim_free(p); -#endif + return res ? 0 : -1; } @@ -3350,11 +3498,13 @@ mch_writable(char_u *name) } /* - * Return 1 if "name" can be executed, 0 if not. - * Return -1 if unknown. + * Return TRUE if "name" can be executed, FALSE if not. + * If "use_path" is FALSE only check if "name" is executable. + * When returning TRUE and "path" is not NULL save the path and set "*path" to + * the allocated memory. */ int -mch_can_exe(char_u *name, char_u **path) +mch_can_exe(char_u *name, char_u **path, int use_path) { char_u buf[_MAX_PATH]; int len = (int)STRLEN(name); @@ -3367,7 +3517,7 @@ mch_can_exe(char_u *name, char_u **path) * this with a Unix-shell like 'shell'. */ if (vim_strchr(gettail(name), '.') != NULL || strstr((char *)gettail(p_sh), "sh") != NULL) - if (executable_exists((char *)name, path)) + if (executable_exists((char *)name, path, use_path)) return TRUE; /* @@ -3389,7 +3539,7 @@ mch_can_exe(char_u *name, char_u **path) } else copy_option_part(&p, buf + len, _MAX_PATH - len, ";"); - if (executable_exists((char *)buf, path)) + if (executable_exists((char *)buf, path, use_path)) return TRUE; } return FALSE; @@ -3418,39 +3568,29 @@ mch_nodetype(char_u *name) #ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - { wn = enc_to_utf16(name, NULL); - if (wn != NULL) - { - hFile = CreateFileW(wn, /* file name */ - GENERIC_WRITE, /* access mode */ - 0, /* share mode */ - NULL, /* security descriptor */ - OPEN_EXISTING, /* creation disposition */ - 0, /* file attributes */ - NULL); /* handle to template file */ - if (hFile == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - vim_free(wn); - wn = NULL; - } - } + + if (wn != NULL) + { + hFile = CreateFileW(wn, /* file name */ + GENERIC_WRITE, /* access mode */ + 0, /* share mode */ + NULL, /* security descriptor */ + OPEN_EXISTING, /* creation disposition */ + 0, /* file attributes */ + NULL); /* handle to template file */ + vim_free(wn); } - if (wn == NULL) + else #endif - hFile = CreateFile(name, /* file name */ - GENERIC_WRITE, /* access mode */ - 0, /* share mode */ - NULL, /* security descriptor */ - OPEN_EXISTING, /* creation disposition */ - 0, /* file attributes */ - NULL); /* handle to template file */ + hFile = CreateFile((LPCSTR)name, /* file name */ + GENERIC_WRITE, /* access mode */ + 0, /* share mode */ + NULL, /* security descriptor */ + OPEN_EXISTING, /* creation disposition */ + 0, /* file attributes */ + NULL); /* handle to template file */ -#ifdef FEAT_MBYTE - vim_free(wn); -#endif if (hFile == INVALID_HANDLE_VALUE) return NODE_NORMAL; @@ -3487,88 +3627,84 @@ mch_get_acl(char_u *fname) struct my_acl *p = NULL; DWORD err; - /* This only works on Windows NT and 2000. */ - if (g_PlatformId == VER_PLATFORM_WIN32_NT && advapi_lib != NULL) + p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); + if (p != NULL) { - p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); - if (p != NULL) - { # ifdef FEAT_MBYTE - WCHAR *wn = NULL; + WCHAR *wn = NULL; - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - wn = enc_to_utf16(fname, NULL); - if (wn != NULL) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + wn = enc_to_utf16(fname, NULL); + if (wn != NULL) + { + /* Try to retrieve the entire security descriptor. */ + err = GetNamedSecurityInfoW( + wn, // Abstract filename + SE_FILE_OBJECT, // File Object + OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION, + &p->pSidOwner, // Ownership information. + &p->pSidGroup, // Group membership. + &p->pDacl, // Discretionary information. + &p->pSacl, // For auditing purposes. + &p->pSecurityDescriptor); + if (err == ERROR_ACCESS_DENIED || + err == ERROR_PRIVILEGE_NOT_HELD) { - /* Try to retrieve the entire security descriptor. */ - err = pGetNamedSecurityInfoW( - wn, // Abstract filename - SE_FILE_OBJECT, // File Object - OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION | - SACL_SECURITY_INFORMATION, - &p->pSidOwner, // Ownership information. - &p->pSidGroup, // Group membership. - &p->pDacl, // Discretionary information. - &p->pSacl, // For auditing purposes. - &p->pSecurityDescriptor); - if (err == ERROR_ACCESS_DENIED || - err == ERROR_PRIVILEGE_NOT_HELD) - { - /* Retrieve only DACL. */ - (void)pGetNamedSecurityInfoW( - wn, - SE_FILE_OBJECT, - DACL_SECURITY_INFORMATION, - NULL, - NULL, - &p->pDacl, - NULL, - &p->pSecurityDescriptor); - } - if (p->pSecurityDescriptor == NULL) - { - mch_free_acl((vim_acl_T)p); - p = NULL; - } - vim_free(wn); + /* Retrieve only DACL. */ + (void)GetNamedSecurityInfoW( + wn, + SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION, + NULL, + NULL, + &p->pDacl, + NULL, + &p->pSecurityDescriptor); } - else + if (p->pSecurityDescriptor == NULL) + { + mch_free_acl((vim_acl_T)p); + p = NULL; + } + vim_free(wn); + } + else # endif + { + /* Try to retrieve the entire security descriptor. */ + err = GetNamedSecurityInfo( + (LPSTR)fname, // Abstract filename + SE_FILE_OBJECT, // File Object + OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION, + &p->pSidOwner, // Ownership information. + &p->pSidGroup, // Group membership. + &p->pDacl, // Discretionary information. + &p->pSacl, // For auditing purposes. + &p->pSecurityDescriptor); + if (err == ERROR_ACCESS_DENIED || + err == ERROR_PRIVILEGE_NOT_HELD) { - /* Try to retrieve the entire security descriptor. */ - err = pGetNamedSecurityInfo( - (LPSTR)fname, // Abstract filename - SE_FILE_OBJECT, // File Object - OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION | - SACL_SECURITY_INFORMATION, - &p->pSidOwner, // Ownership information. - &p->pSidGroup, // Group membership. - &p->pDacl, // Discretionary information. - &p->pSacl, // For auditing purposes. - &p->pSecurityDescriptor); - if (err == ERROR_ACCESS_DENIED || - err == ERROR_PRIVILEGE_NOT_HELD) - { - /* Retrieve only DACL. */ - (void)pGetNamedSecurityInfo( - (LPSTR)fname, - SE_FILE_OBJECT, - DACL_SECURITY_INFORMATION, - NULL, - NULL, - &p->pDacl, - NULL, - &p->pSecurityDescriptor); - } - if (p->pSecurityDescriptor == NULL) - { - mch_free_acl((vim_acl_T)p); - p = NULL; - } + /* Retrieve only DACL. */ + (void)GetNamedSecurityInfo( + (LPSTR)fname, + SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION, + NULL, + NULL, + &p->pDacl, + NULL, + &p->pSecurityDescriptor); + } + if (p->pSecurityDescriptor == NULL) + { + mch_free_acl((vim_acl_T)p); + p = NULL; } } } @@ -3612,7 +3748,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl) struct my_acl *p = (struct my_acl *)acl; SECURITY_INFORMATION sec_info = 0; - if (p != NULL && advapi_lib != NULL) + if (p != NULL) { # ifdef FEAT_MBYTE WCHAR *wn = NULL; @@ -3640,7 +3776,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl) wn = enc_to_utf16(fname, NULL); if (wn != NULL) { - (void)pSetNamedSecurityInfoW( + (void)SetNamedSecurityInfoW( wn, // Abstract filename SE_FILE_OBJECT, // File Object sec_info, @@ -3654,7 +3790,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl) else # endif { - (void)pSetNamedSecurityInfo( + (void)SetNamedSecurityInfo( (LPSTR)fname, // Abstract filename SE_FILE_OBJECT, // File Object sec_info, @@ -3691,6 +3827,9 @@ mch_free_acl(vim_acl_T acl) handler_routine( DWORD dwCtrlType) { + INPUT_RECORD ir; + DWORD out; + switch (dwCtrlType) { case CTRL_C_EVENT: @@ -3700,6 +3839,16 @@ handler_routine( case CTRL_BREAK_EVENT: g_fCBrkPressed = TRUE; + ctrl_break_was_pressed = TRUE; + /* ReadConsoleInput is blocking, send a key event to continue. */ + ir.EventType = KEY_EVENT; + ir.Event.KeyEvent.bKeyDown = TRUE; + ir.Event.KeyEvent.wRepeatCount = 1; + ir.Event.KeyEvent.wVirtualKeyCode = VK_CANCEL; + ir.Event.KeyEvent.wVirtualScanCode = 0; + ir.Event.KeyEvent.dwControlKeyState = 0; + ir.Event.KeyEvent.uChar.UnicodeChar = 0; + WriteConsoleInput(g_hConIn, &ir, 1, &out); return TRUE; /* fatal events: shut down gracefully */ @@ -3749,7 +3898,15 @@ mch_settmode(int tmode) if (g_fMouseActive) cmodein |= ENABLE_MOUSE_INPUT; #endif - cmodeout &= ~(ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); + cmodeout &= ~( +#ifdef FEAT_TERMGUICOLORS + /* Do not turn off the ENABLE_PROCESSRD_OUTPUT flag when using + * VTP. */ + ((vtp_working) ? 0 : ENABLE_PROCESSED_OUTPUT) | +#else + ENABLE_PROCESSED_OUTPUT | +#endif + ENABLE_WRAP_AT_EOL_OUTPUT); bEnableHandler = TRUE; } else /* cooked */ @@ -3953,31 +4110,46 @@ vim_create_process( BOOL inherit_handles, DWORD flags, STARTUPINFO *si, - PROCESS_INFORMATION *pi) + PROCESS_INFORMATION *pi, + LPVOID *env, + char *cwd) { -# ifdef FEAT_MBYTE +#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - WCHAR *wcmd = enc_to_utf16(cmd, NULL); + BOOL ret; + WCHAR *wcmd, *wcwd = NULL; - if (wcmd != NULL) + wcmd = enc_to_utf16((char_u *)cmd, NULL); + if (wcmd == NULL) + goto fallback; + if (cwd != NULL) { - BOOL ret; - ret = CreateProcessW( - NULL, /* Executable name */ - wcmd, /* Command to execute */ - NULL, /* Process security attributes */ - NULL, /* Thread security attributes */ - inherit_handles, /* Inherit handles */ - flags, /* Creation flags */ - NULL, /* Environment */ - NULL, /* Current directory */ - (LPSTARTUPINFOW)si, /* Startup information */ - pi); /* Process information */ - vim_free(wcmd); - return ret; + wcwd = enc_to_utf16((char_u *)cwd, NULL); + if (wcwd == NULL) + { + vim_free(wcmd); + goto fallback; + } } - } + + ret = CreateProcessW( + NULL, /* Executable name */ + wcmd, /* Command to execute */ + NULL, /* Process security attributes */ + NULL, /* Thread security attributes */ + inherit_handles, /* Inherit handles */ + flags, /* Creation flags */ + env, /* Environment */ + wcwd, /* Current directory */ + (LPSTARTUPINFOW)si, /* Startup information */ + pi); /* Process information */ + vim_free(wcmd); + if (wcwd != NULL) + vim_free(wcwd); + return ret; + } +fallback: #endif return CreateProcess( NULL, /* Executable name */ @@ -3986,13 +4158,35 @@ vim_create_process( NULL, /* Thread security attributes */ inherit_handles, /* Inherit handles */ flags, /* Creation flags */ - NULL, /* Environment */ - NULL, /* Current directory */ + env, /* Environment */ + cwd, /* Current directory */ si, /* Startup information */ pi); /* Process information */ } + static HINSTANCE +vim_shell_execute( + char *cmd, + INT n_show_cmd) +{ +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL); + if (wcmd != NULL) + { + HINSTANCE ret; + ret = ShellExecuteW(NULL, NULL, wcmd, NULL, NULL, n_show_cmd); + vim_free(wcmd); + return ret; + } + } +#endif + return ShellExecute(NULL, NULL, cmd, NULL, NULL, n_show_cmd); +} + + #if defined(FEAT_GUI_W32) || defined(PROTO) /* @@ -4017,31 +4211,22 @@ mch_system_classic(char *cmd, int options) si.lpTitle = NULL; si.dwFlags = STARTF_USESHOWWINDOW; /* - * It's nicer to run a filter command in a minimized window, but in - * Windows 95 this makes the command MUCH slower. We can't do it under - * Win32s either as it stops the synchronous spawn workaround working. + * It's nicer to run a filter command in a minimized window. * Don't activate the window to keep focus on Vim. */ - if ((options & SHELL_DOOUT) && !mch_windows95() && !gui_is_win32s()) + if (options & SHELL_DOOUT) si.wShowWindow = SW_SHOWMINNOACTIVE; else si.wShowWindow = SW_SHOWNORMAL; si.cbReserved2 = 0; si.lpReserved2 = NULL; - /* There is a strange error on Windows 95 when using "c:\\command.com". - * When the "c:\\" is left out it works OK...? */ - if (mch_windows95() - && (STRNICMP(cmd, "c:/command.com", 14) == 0 - || STRNICMP(cmd, "c:\\command.com", 14) == 0)) - cmd += 3; - /* Now, run the command */ vim_create_process(cmd, FALSE, - CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, &si, &pi); + CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, + &si, &pi, NULL, NULL); /* Wait for the command to terminate before continuing */ - if (g_PlatformId != VER_PLATFORM_WIN32s) { #ifdef FEAT_GUI int delay = 1; @@ -4074,23 +4259,6 @@ mch_system_classic(char *cmd, int options) /* Get the command exit code */ GetExitCodeProcess(pi.hProcess, &ret); } - else - { - /* - * This ugly code is the only quick way of performing - * a synchronous spawn under Win32s. Yuk. - */ - num_windows = 0; - EnumWindows(win32ssynch_cb, 0); - old_num_windows = num_windows; - do - { - Sleep(1000); - num_windows = 0; - EnumWindows(win32ssynch_cb, 0); - } while (num_windows == old_num_windows); - ret = 0; - } /* Close the handles to the subprocess, so that it goes away */ CloseHandle(pi.hThread); @@ -4107,7 +4275,7 @@ mch_system_classic(char *cmd, int options) * process. This way avoid to hang up vim totally if the children * process take a long time to process the lines. */ - static DWORD WINAPI + static unsigned int __stdcall sub_process_writer(LPVOID param) { HANDLE g_hChildStd_IN_Wr = param; @@ -4140,7 +4308,8 @@ sub_process_writer(LPVOID param) /* Finished a line, add a NL, unless this line should not have * one. */ if (lnum != curbuf->b_op_end.lnum - || !curbuf->b_p_bin + || (!curbuf->b_p_bin + && curbuf->b_p_fixeol) || (lnum != curbuf->b_no_eol_lnum && (lnum != curbuf->b_ml.ml_line_count || curbuf->b_p_eol))) @@ -4161,7 +4330,7 @@ sub_process_writer(LPVOID param) /* finished all the lines, close pipe */ CloseHandle(g_hChildStd_IN_Wr); - ExitThread(0); + return 0; } @@ -4249,7 +4418,7 @@ dump_pipe(int options, * round. */ for (p = buffer; p < buffer + len; p += l) { - l = mb_cptr2len(p); + l = MB_CPTR2LEN(p); if (l == 0) l = 1; /* NUL byte? */ else if (MB_BYTE2LEN(*p) != l) @@ -4318,7 +4487,7 @@ mch_system_piped(char *cmd, int options) int c; int noread_cnt = 0; garray_T ga; - int delay = 1; + int delay = 1; DWORD buffer_off = 0; /* valid bytes in buffer[] */ char *p = NULL; @@ -4331,11 +4500,11 @@ mch_system_piped(char *cmd, int options) if ( ! CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0) /* Ensure the read handle to the pipe for STDOUT is not inherited. */ - || ! pSetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) + || ! SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) /* Create a pipe for the child process's STDIN. */ || ! CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0) /* Ensure the write handle to the pipe for STDIN is not inherited. */ - || ! pSetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) + || ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) { CloseHandle(g_hChildStd_IN_Rd); CloseHandle(g_hChildStd_IN_Wr); @@ -4374,7 +4543,8 @@ mch_system_piped(char *cmd, int options) * About "Inherit handles" being TRUE: this command can be litigious, * handle inheritance was deactivated for pending temp file, but, if we * deactivate it, the pipes don't work for some reason. */ - vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, &si, &pi); + vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, + &si, &pi, NULL, NULL); if (p != cmd) vim_free(p); @@ -4385,8 +4555,8 @@ mch_system_piped(char *cmd, int options) if (options & SHELL_WRITE) { - HANDLE thread = - CreateThread(NULL, /* security attributes */ + HANDLE thread = (HANDLE) + _beginthreadex(NULL, /* security attributes */ 0, /* default stack size */ sub_process_writer, /* function to be executed */ g_hChildStd_IN_Wr, /* parameter */ @@ -4430,9 +4600,6 @@ mch_system_piped(char *cmd, int options) /* Get extra characters when we don't have any. Reset the * counter and timer. */ noread_cnt = 0; -# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) - gettimeofday(&start_tv, NULL); -# endif len = ui_inchar(ta_buf, BUFLEN, 10L, 0); } if (ta_len > 0 || len > 0) @@ -4585,7 +4752,7 @@ mch_system_piped(char *cmd, int options) mch_system(char *cmd, int options) { /* if we can pipe and the shelltemp option is off */ - if (allowPiping && !p_stmp) + if (!p_stmp) return mch_system_piped(cmd, options); else return mch_system_classic(cmd, options); @@ -4598,7 +4765,7 @@ mch_system(char *cmd, int options) { if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - WCHAR *wcmd = enc_to_utf16(cmd, NULL); + WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL); if (wcmd != NULL) { int ret = _wsystem(wcmd); @@ -4614,6 +4781,81 @@ mch_system(char *cmd, int options) #endif +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) +/* + * Use a terminal window to run a shell command in. + */ + static int +mch_call_shell_terminal( + char_u *cmd, + int options UNUSED) /* SHELL_*, see vim.h */ +{ + jobopt_T opt; + char_u *newcmd = NULL; + typval_T argvar[2]; + long_u cmdlen; + int retval = -1; + buf_T *buf; + aco_save_T aco; + oparg_T oa; /* operator arguments */ + + if (cmd == NULL) + cmdlen = STRLEN(p_sh) + 1; + else + cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; + newcmd = lalloc(cmdlen, TRUE); + if (newcmd == NULL) + return 255; + if (cmd == NULL) + { + STRCPY(newcmd, p_sh); + ch_log(NULL, "starting terminal to run a shell"); + } + else + { + vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); + ch_log(NULL, "starting terminal for system command '%s'", cmd); + } + + init_job_options(&opt); + + argvar[0].v_type = VAR_STRING; + argvar[0].vval.v_string = newcmd; + argvar[1].v_type = VAR_UNKNOWN; + buf = term_start(argvar, NULL, &opt, TERM_START_SYSTEM); + if (buf == NULL) + return 255; + + /* Find a window to make "buf" curbuf. */ + aucmd_prepbuf(&aco, buf); + + clear_oparg(&oa); + while (term_use_loop()) + { + if (oa.op_type == OP_NOP && oa.regname == NUL && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. We don't do redrawing anyway. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else + normal_cmd(&oa, TRUE); + } + retval = 0; + ch_log(NULL, "system command finished"); + + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + + wait_return(TRUE); + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); + + vim_free(newcmd); + return retval; +} +#endif + /* * Either execute a command by calling the shell or start a new shell */ @@ -4625,21 +4867,53 @@ mch_call_shell( int x = 0; int tmode = cur_tmode; #ifdef FEAT_TITLE - char szShellTitle[512]; + char szShellTitle[512]; +# ifdef FEAT_MBYTE + int did_set_title = FALSE; /* Change the title to reflect that we are in a subshell. */ - if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - if (cmd == NULL) - strcat(szShellTitle, " :sh"); - else + WCHAR szShellTitle[512]; + + if (GetConsoleTitleW(szShellTitle, + sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0) { - strcat(szShellTitle, " - !"); - if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) - strcat(szShellTitle, cmd); + if (cmd == NULL) + wcscat(szShellTitle, L" :sh"); + else + { + WCHAR *wn = enc_to_utf16((char_u *)cmd, NULL); + + if (wn != NULL) + { + wcscat(szShellTitle, L" - !"); + if ((wcslen(szShellTitle) + wcslen(wn) < + sizeof(szShellTitle)/sizeof(WCHAR))) + wcscat(szShellTitle, wn); + SetConsoleTitleW(szShellTitle); + vim_free(wn); + did_set_title = TRUE; + } + } } - mch_settitle(szShellTitle, NULL); } + if (!did_set_title) +# endif + /* Change the title to reflect that we are in a subshell. */ + if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) + { + if (cmd == NULL) + strcat(szShellTitle, " :sh"); + else + { + strcat(szShellTitle, " - !"); + if ((strlen(szShellTitle) + strlen((char *)cmd) + < sizeof(szShellTitle))) + strcat(szShellTitle, (char *)cmd); + } + SetConsoleTitle(szShellTitle); + } #endif out_flush(); @@ -4651,6 +4925,19 @@ mch_call_shell( fflush(fdDump); } #endif +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) + /* TODO: make the terminal window work with input or output redirected. */ + if (vim_strchr(p_go, GO_TERMINAL) != NULL + && (options & (SHELL_FILTER|SHELL_DOOUT|SHELL_WRITE|SHELL_READ)) == 0) + { + /* Use a terminal window to run the command in. */ + x = mch_call_shell_terminal(cmd, options); +#ifdef FEAT_TITLE + resettitle(); +#endif + return x; + } +#endif /* * Catch all deadly signals while running the external command, because a @@ -4673,7 +4960,7 @@ mch_call_shell( if (cmd == NULL) { - x = mch_system(p_sh, options); + x = mch_system((char *)p_sh, options); } else { @@ -4688,11 +4975,12 @@ mch_call_shell( if (*cmdbase == '(') ++cmdbase; - if ((STRNICMP(cmdbase, "start", 5) == 0) && vim_iswhite(cmdbase[5])) + if ((STRNICMP(cmdbase, "start", 5) == 0) && VIM_ISWHITE(cmdbase[5])) { STARTUPINFO si; PROCESS_INFORMATION pi; DWORD flags = CREATE_NEW_CONSOLE; + INT n_show_cmd = SW_SHOWNORMAL; char_u *p; ZeroMemory(&si, sizeof(si)); @@ -4706,14 +4994,15 @@ mch_call_shell( cmdbase = skipwhite(cmdbase + 5); if ((STRNICMP(cmdbase, "/min", 4) == 0) - && vim_iswhite(cmdbase[4])) + && VIM_ISWHITE(cmdbase[4])) { cmdbase = skipwhite(cmdbase + 4); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOWMINNOACTIVE; + n_show_cmd = SW_SHOWMINNOACTIVE; } else if ((STRNICMP(cmdbase, "/b", 2) == 0) - && vim_iswhite(cmdbase[2])) + && VIM_ISWHITE(cmdbase[2])) { cmdbase = skipwhite(cmdbase + 2); flags = CREATE_NO_WINDOW; @@ -4757,9 +5046,10 @@ mch_call_shell( char_u *cmd_shell = mch_getenv("COMSPEC"); if (cmd_shell == NULL || *cmd_shell == NUL) - cmd_shell = default_shell(); + cmd_shell = (char_u *)default_shell(); - subcmd = vim_strsave_escaped_ext(cmdbase, "|", '^', FALSE); + subcmd = vim_strsave_escaped_ext(cmdbase, + (char_u *)"|", '^', FALSE); if (subcmd != NULL) { /* make "cmd.exe /c arguments" */ @@ -4779,7 +5069,11 @@ mch_call_shell( * inherit our handles which causes unpleasant dangling swap * files if we exit before the spawned process */ - if (vim_create_process(newcmd, FALSE, flags, &si, &pi)) + if (vim_create_process((char *)newcmd, FALSE, flags, + &si, &pi, NULL, NULL)) + x = 0; + else if (vim_shell_execute((char *)newcmd, n_show_cmd) + > (HINSTANCE)32) x = 0; else { @@ -4805,7 +5099,7 @@ mch_call_shell( { cmdlen = ( #ifdef FEAT_GUI_W32 - (allowPiping && !p_stmp ? 0 : STRLEN(vimrun_path)) + + (!p_stmp ? 0 : STRLEN(vimrun_path)) + #endif STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10); @@ -4815,15 +5109,27 @@ mch_call_shell( #if defined(FEAT_GUI_W32) if (need_vimrun_warning) { - MessageBox(NULL, - _("VIMRUN.EXE not found in your $PATH.\n" - "External commands will not pause after completion.\n" - "See :help win32-vimrun for more information."), - _("Vim Warning"), - MB_ICONWARNING); + char *msg = _("VIMRUN.EXE not found in your $PATH.\n" + "External commands will not pause after completion.\n" + "See :help win32-vimrun for more information."); + char *title = _("Vim Warning"); +# ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR *wmsg = enc_to_utf16((char_u *)msg, NULL); + WCHAR *wtitle = enc_to_utf16((char_u *)title, NULL); + + if (wmsg != NULL && wtitle != NULL) + MessageBoxW(NULL, wmsg, wtitle, MB_ICONWARNING); + vim_free(wmsg); + vim_free(wtitle); + } + else +# endif + MessageBox(NULL, msg, title, MB_ICONWARNING); need_vimrun_warning = FALSE; } - if (!s_dont_use_vimrun && (!allowPiping || p_stmp)) + if (!s_dont_use_vimrun && p_stmp) /* Use vimrun to execute the command. It opens a console * window, which can be closed without killing Vim. */ vim_snprintf((char *)newcmd, cmdlen, "%s%s%s %s %s", @@ -4847,12 +5153,11 @@ mch_call_shell( /* Print the return value, unless "vimrun" was used. */ if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent #if defined(FEAT_GUI_W32) - && ((options & SHELL_DOOUT) || s_dont_use_vimrun - || (allowPiping && !p_stmp)) + && ((options & SHELL_DOOUT) || s_dont_use_vimrun || !p_stmp) #endif ) { - smsg(_("shell returned %d"), x); + smsg((char_u *)_("shell returned %d"), x); msg_putchar('\n'); } #ifdef FEAT_TITLE @@ -4874,31 +5179,498 @@ mch_call_shell( return x; } - -#ifndef FEAT_GUI_W32 +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) + static HANDLE +job_io_file_open( + char_u *fname, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes) +{ + HANDLE h; +# ifdef FEAT_MBYTE + WCHAR *wn = NULL; + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + wn = enc_to_utf16(fname, NULL); + if (wn != NULL) + { + h = CreateFileW(wn, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, + dwFlagsAndAttributes, NULL); + vim_free(wn); + } + } + if (wn == NULL) +# endif + h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, + dwFlagsAndAttributes, NULL); + return h; +} /* - * Start termcap mode + * Turn the dictionary "env" into a NUL separated list that can be used as the + * environment argument of vim_create_process(). */ - static void -termcap_mode_start(void) + void +win32_build_env(dict_T *env, garray_T *gap, int is_terminal) { - DWORD cmodein; + hashitem_T *hi; + long_u todo = env != NULL ? env->dv_hashtab.ht_used : 0; + LPVOID base = GetEnvironmentStringsW(); - if (g_fTermcapMode) + /* for last \0 */ + if (ga_grow(gap, 1) == FAIL) return; - SaveConsoleBuffer(&g_cbNonTermcap); - - if (g_cbTermcap.IsValid) + if (base) { - /* - * We've been in termcap mode before. Restore certain screen - * characteristics, including the buffer size and the window - * size. Since we will be redrawing the screen, we don't need + WCHAR *p = (WCHAR*) base; + + /* for last \0 */ + if (ga_grow(gap, 1) == FAIL) + return; + + while (*p != 0 || *(p + 1) != 0) + { + if (ga_grow(gap, 1) == OK) + *((WCHAR*)gap->ga_data + gap->ga_len++) = *p; + p++; + } + FreeEnvironmentStrings(base); + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; + } + + if (env != NULL) + { + for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + typval_T *item = &dict_lookup(hi)->di_tv; + WCHAR *wkey = enc_to_utf16((char_u *)hi->hi_key, NULL); + WCHAR *wval = enc_to_utf16(get_tv_string(item), NULL); + --todo; + if (wkey != NULL && wval != NULL) + { + size_t n; + size_t lkey = wcslen(wkey); + size_t lval = wcslen(wval); + + if (ga_grow(gap, (int)(lkey + lval + 2)) != OK) + continue; + for (n = 0; n < lkey; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = wkey[n]; + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'='; + for (n = 0; n < lval; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = wval[n]; + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; + } + if (wkey != NULL) vim_free(wkey); + if (wval != NULL) vim_free(wval); + } + } + } + +# if defined(FEAT_CLIENTSERVER) || defined(FEAT_TERMINAL) + { +# ifdef FEAT_CLIENTSERVER + char_u *servername = get_vim_var_str(VV_SEND_SERVER); + size_t servername_len = STRLEN(servername); +# endif +# ifdef FEAT_TERMINAL + char_u *version = get_vim_var_str(VV_VERSION); + size_t version_len = STRLEN(version); +# endif + // size of "VIM_SERVERNAME=" and value, + // plus "VIM_TERMINAL=" and value, + // plus two terminating NULs + size_t n = 0 +# ifdef FEAT_CLIENTSERVER + + 15 + servername_len +# endif +# ifdef FEAT_TERMINAL + + 13 + version_len + 2 +# endif + ; + + if (ga_grow(gap, (int)n) == OK) + { +# ifdef FEAT_CLIENTSERVER + for (n = 0; n < 15; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = + (WCHAR)"VIM_SERVERNAME="[n]; + for (n = 0; n < servername_len; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = + (WCHAR)servername[n]; + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; +# endif +# ifdef FEAT_TERMINAL + if (is_terminal) + { + for (n = 0; n < 13; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = + (WCHAR)"VIM_TERMINAL="[n]; + for (n = 0; n < version_len; n++) + *((WCHAR*)gap->ga_data + gap->ga_len++) = + (WCHAR)version[n]; + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; + } +# endif + } + } +# endif +} + + void +mch_job_start(char *cmd, job_T *job, jobopt_T *options) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + HANDLE jo; + SECURITY_ATTRIBUTES saAttr; + channel_T *channel = NULL; + HANDLE ifd[2]; + HANDLE ofd[2]; + HANDLE efd[2]; + garray_T ga; + + int use_null_for_in = options->jo_io[PART_IN] == JIO_NULL; + int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL; + int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL; + int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; + int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE; + int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE; + int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; + + if (use_out_for_err && use_null_for_out) + use_null_for_err = TRUE; + + ifd[0] = INVALID_HANDLE_VALUE; + ifd[1] = INVALID_HANDLE_VALUE; + ofd[0] = INVALID_HANDLE_VALUE; + ofd[1] = INVALID_HANDLE_VALUE; + efd[0] = INVALID_HANDLE_VALUE; + efd[1] = INVALID_HANDLE_VALUE; + ga_init2(&ga, (int)sizeof(wchar_t), 500); + + jo = CreateJobObject(NULL, NULL); + if (jo == NULL) + { + job->jv_status = JOB_FAILED; + goto failed; + } + + if (options->jo_env != NULL) + win32_build_env(options->jo_env, &ga, FALSE); + + ZeroMemory(&pi, sizeof(pi)); + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags |= STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + if (use_file_for_in) + { + char_u *fname = options->jo_io_name[PART_IN]; + + ifd[0] = job_io_file_open(fname, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL); + if (ifd[0] == INVALID_HANDLE_VALUE) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else if (!use_null_for_in && + (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0) + || !SetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0))) + goto failed; + + if (use_file_for_out) + { + char_u *fname = options->jo_io_name[PART_OUT]; + + ofd[1] = job_io_file_open(fname, GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL); + if (ofd[1] == INVALID_HANDLE_VALUE) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else if (!use_null_for_out && + (!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0) + || !SetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0))) + goto failed; + + if (use_file_for_err) + { + char_u *fname = options->jo_io_name[PART_ERR]; + + efd[1] = job_io_file_open(fname, GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL); + if (efd[1] == INVALID_HANDLE_VALUE) + { + EMSG2(_(e_notopen), fname); + goto failed; + } + } + else if (!use_out_for_err && !use_null_for_err && + (!CreatePipe(&efd[0], &efd[1], &saAttr, 0) + || !SetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0))) + goto failed; + + si.dwFlags |= STARTF_USESTDHANDLES; + si.hStdInput = ifd[0]; + si.hStdOutput = ofd[1]; + si.hStdError = use_out_for_err ? ofd[1] : efd[1]; + + if (!use_null_for_in || !use_null_for_out || !use_null_for_err) + { + if (options->jo_set & JO_CHANNEL) + { + channel = options->jo_channel; + if (channel != NULL) + ++channel->ch_refcount; + } + else + channel = add_channel(); + if (channel == NULL) + goto failed; + } + + if (!vim_create_process(cmd, TRUE, + CREATE_SUSPENDED | + CREATE_DEFAULT_ERROR_MODE | + CREATE_NEW_PROCESS_GROUP | + CREATE_UNICODE_ENVIRONMENT | + CREATE_NEW_CONSOLE, + &si, &pi, + ga.ga_data, + (char *)options->jo_cwd)) + { + CloseHandle(jo); + job->jv_status = JOB_FAILED; + goto failed; + } + + ga_clear(&ga); + + if (!AssignProcessToJobObject(jo, pi.hProcess)) + { + /* if failing, switch the way to terminate + * process with TerminateProcess. */ + CloseHandle(jo); + jo = NULL; + } + ResumeThread(pi.hThread); + CloseHandle(pi.hThread); + job->jv_proc_info = pi; + job->jv_job_object = jo; + job->jv_status = JOB_STARTED; + + CloseHandle(ifd[0]); + CloseHandle(ofd[1]); + if (!use_out_for_err && !use_null_for_err) + CloseHandle(efd[1]); + + job->jv_channel = channel; + if (channel != NULL) + { + channel_set_pipes(channel, + use_file_for_in || use_null_for_in + ? INVALID_FD : (sock_T)ifd[1], + use_file_for_out || use_null_for_out + ? INVALID_FD : (sock_T)ofd[0], + use_out_for_err || use_file_for_err || use_null_for_err + ? INVALID_FD : (sock_T)efd[0]); + channel_set_job(channel, job, options); + } + return; + +failed: + CloseHandle(ifd[0]); + CloseHandle(ofd[0]); + CloseHandle(efd[0]); + CloseHandle(ifd[1]); + CloseHandle(ofd[1]); + CloseHandle(efd[1]); + channel_unref(channel); + ga_clear(&ga); +} + + char * +mch_job_status(job_T *job) +{ + DWORD dwExitCode = 0; + + if (!GetExitCodeProcess(job->jv_proc_info.hProcess, &dwExitCode) + || dwExitCode != STILL_ACTIVE) + { + job->jv_exitval = (int)dwExitCode; + if (job->jv_status < JOB_ENDED) + { + ch_log(job->jv_channel, "Job ended"); + job->jv_status = JOB_ENDED; + } + return "dead"; + } + return "run"; +} + + job_T * +mch_detect_ended_job(job_T *job_list) +{ + HANDLE jobHandles[MAXIMUM_WAIT_OBJECTS]; + job_T *jobArray[MAXIMUM_WAIT_OBJECTS]; + job_T *job = job_list; + + while (job != NULL) + { + DWORD n; + DWORD result; + + for (n = 0; n < MAXIMUM_WAIT_OBJECTS + && job != NULL; job = job->jv_next) + { + if (job->jv_status == JOB_STARTED) + { + jobHandles[n] = job->jv_proc_info.hProcess; + jobArray[n] = job; + ++n; + } + } + if (n == 0) + continue; + result = WaitForMultipleObjects(n, jobHandles, FALSE, 0); + if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + n) + { + job_T *wait_job = jobArray[result - WAIT_OBJECT_0]; + + if (STRCMP(mch_job_status(wait_job), "dead") == 0) + return wait_job; + } + } + return NULL; +} + + static BOOL +terminate_all(HANDLE process, int code) +{ + PROCESSENTRY32 pe; + HANDLE h = INVALID_HANDLE_VALUE; + DWORD pid = GetProcessId(process); + + if (pid != 0) + { + h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (h != INVALID_HANDLE_VALUE) + { + pe.dwSize = sizeof(PROCESSENTRY32); + if (!Process32First(h, &pe)) + goto theend; + + do + { + if (pe.th32ParentProcessID == pid) + { + HANDLE ph = OpenProcess( + PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID); + if (ph != NULL) + { + terminate_all(ph, code); + CloseHandle(ph); + } + } + } while (Process32Next(h, &pe)); + + CloseHandle(h); + } + } + +theend: + return TerminateProcess(process, code); +} + +/* + * Send a (deadly) signal to "job". + * Return FAIL if it didn't work. + */ + int +mch_signal_job(job_T *job, char_u *how) +{ + int ret; + + if (STRCMP(how, "term") == 0 || STRCMP(how, "kill") == 0 || *how == NUL) + { + /* deadly signal */ + if (job->jv_job_object != NULL) + return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL; + return terminate_all(job->jv_proc_info.hProcess, 0) ? OK : FAIL; + } + + if (!AttachConsole(job->jv_proc_info.dwProcessId)) + return FAIL; + ret = GenerateConsoleCtrlEvent( + STRCMP(how, "int") == 0 ? CTRL_C_EVENT : CTRL_BREAK_EVENT, + job->jv_proc_info.dwProcessId) + ? OK : FAIL; + FreeConsole(); + return ret; +} + +/* + * Clear the data related to "job". + */ + void +mch_clear_job(job_T *job) +{ + if (job->jv_status != JOB_FAILED) + { + if (job->jv_job_object != NULL) + CloseHandle(job->jv_job_object); + CloseHandle(job->jv_proc_info.hProcess); + } +} +#endif + + +#ifndef FEAT_GUI_W32 + +/* + * Start termcap mode + */ + static void +termcap_mode_start(void) +{ + DWORD cmodein; + + if (g_fTermcapMode) + return; + + SaveConsoleBuffer(&g_cbNonTermcap); + + if (g_cbTermcap.IsValid) + { + /* + * We've been in termcap mode before. Restore certain screen + * characteristics, including the buffer size and the window + * size. Since we will be redrawing the screen, we don't need * to restore the actual contents of the buffer. */ RestoreConsoleBuffer(&g_cbTermcap, FALSE); + reset_console_color_rgb(); SetConsoleWindowInfo(g_hConOut, TRUE, &g_cbTermcap.Info.srWindow); Rows = g_cbTermcap.Info.dwSize.Y; Columns = g_cbTermcap.Info.dwSize.X; @@ -4911,6 +5683,7 @@ termcap_mode_start(void) * size. We will use this as the size of our editing environment. */ ClearConsoleBuffer(g_attrCurrent); + set_console_color_rgb(); ResizeConBufAndWindow(g_hConOut, Columns, Rows); } @@ -4959,6 +5732,7 @@ termcap_mode_end(void) cb = &g_cbNonTermcap; #endif RestoreConsoleBuffer(cb, p_rs); + reset_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); if (p_rs || exiting) @@ -4992,11 +5766,10 @@ termcap_mode_end(void) #ifdef FEAT_GUI_W32 -/*ARGSUSED*/ void mch_write( - char_u *s, - int len) + char_u *s UNUSED, + int len UNUSED) { /* never used */ } @@ -5014,7 +5787,15 @@ clear_chars( DWORD dwDummy; FillConsoleOutputCharacter(g_hConOut, ' ', n, coord, &dwDummy); - FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, n, coord, &dwDummy); + + if (!USE_VTP) + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, n, coord, &dwDummy); + else + { + set_console_color_rgb(); + gotoxy(coord.X + 1, coord.Y + 1); + vtp_printf("\033[%dX", n); + } } @@ -5025,7 +5806,15 @@ clear_chars( clear_screen(void) { g_coord.X = g_coord.Y = 0; - clear_chars(g_coord, Rows * Columns); + + if (!USE_VTP) + clear_chars(g_coord, Rows * Columns); + else + { + set_console_color_rgb(); + gotoxy(1, 1); + vtp_printf("\033[2J"); + } } @@ -5035,8 +5824,20 @@ clear_screen(void) static void clear_to_end_of_display(void) { - clear_chars(g_coord, (Rows - g_coord.Y - 1) + COORD save = g_coord; + + if (!USE_VTP) + clear_chars(g_coord, (Rows - g_coord.Y - 1) * Columns + (Columns - g_coord.X)); + else + { + set_console_color_rgb(); + gotoxy(g_coord.X + 1, g_coord.Y + 1); + vtp_printf("\033[0J"); + + gotoxy(save.X + 1, save.Y + 1); + g_coord = save; + } } @@ -5046,7 +5847,19 @@ clear_to_end_of_display(void) static void clear_to_end_of_line(void) { - clear_chars(g_coord, Columns - g_coord.X); + COORD save = g_coord; + + if (!USE_VTP) + clear_chars(g_coord, Columns - g_coord.X); + else + { + set_console_color_rgb(); + gotoxy(g_coord.X + 1, g_coord.Y + 1); + vtp_printf("\033[0K"); + + gotoxy(save.X + 1, save.Y + 1); + g_coord = save; + } } @@ -5085,6 +5898,9 @@ set_scroll_region( g_srScrollRegion.Top = top; g_srScrollRegion.Right = right; g_srScrollRegion.Bottom = bottom; + + if (USE_VTP) + vtp_printf("\033[%d;%dr", top + 1, bottom + 1); } @@ -5106,10 +5922,20 @@ insert_lines(unsigned cLines) source.Right = g_srScrollRegion.Right; source.Bottom = g_srScrollRegion.Bottom - cLines; - fill.Char.AsciiChar = ' '; - fill.Attributes = g_attrCurrent; + if (!USE_VTP) + { + fill.Char.AsciiChar = ' '; + fill.Attributes = g_attrCurrent; - ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + } + else + { + set_console_color_rgb(); + + gotoxy(1, source.Top + 1); + vtp_printf("\033[%dT", cLines); + } /* Here we have to deal with a win32 console flake: If the scroll * region looks like abc and we scroll c to a and fill with d we get @@ -5148,10 +5974,20 @@ delete_lines(unsigned cLines) source.Right = g_srScrollRegion.Right; source.Bottom = g_srScrollRegion.Bottom; - fill.Char.AsciiChar = ' '; - fill.Attributes = g_attrCurrent; + if (!USE_VTP) + { + fill.Char.AsciiChar = ' '; + fill.Attributes = g_attrCurrent; + + ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + } + else + { + set_console_color_rgb(); - ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + gotoxy(1, source.Top + 1); + vtp_printf("\033[%dS", cLines); + } /* Here we have to deal with a win32 console flake: If the scroll * region looks like abc and we scroll c to a and fill with d we get @@ -5187,7 +6023,11 @@ gotoxy( /* external cursor coords are 1-based; internal are 0-based */ g_coord.X = x - 1; g_coord.Y = y - 1; - SetConsoleCursorPosition(g_hConOut, g_coord); + + if (!USE_VTP) + SetConsoleCursorPosition(g_hConOut, g_coord); + else + vtp_printf("\033[%d;%dH", y, x); } @@ -5198,7 +6038,7 @@ gotoxy( static void textattr(WORD wAttr) { - g_attrCurrent = wAttr; + g_attrCurrent = wAttr & 0xff; SetConsoleTextAttribute(g_hConOut, wAttr); } @@ -5207,18 +6047,24 @@ textattr(WORD wAttr) static void textcolor(WORD wAttr) { - g_attrCurrent = (g_attrCurrent & 0xf0) + wAttr; + g_attrCurrent = (g_attrCurrent & 0xf0) + (wAttr & 0x0f); - SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + if (!USE_VTP) + SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + else + vtp_sgr_bulk(wAttr); } static void textbackground(WORD wAttr) { - g_attrCurrent = (g_attrCurrent & 0x0f) + (wAttr << 4); + g_attrCurrent = (g_attrCurrent & 0x0f) + ((wAttr & 0x0f) << 4); - SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + if (!USE_VTP) + SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + else + vtp_sgr_bulk(wAttr); } @@ -5228,7 +6074,10 @@ textbackground(WORD wAttr) static void normvideo(void) { - textattr(g_attrDefault); + if (!USE_VTP) + textattr(g_attrDefault); + else + vtp_sgr_bulk(0); } @@ -5241,6 +6090,7 @@ static WORD g_attrPreStandout = 0; standout(void) { g_attrPreStandout = g_attrCurrent; + textattr((WORD) (g_attrCurrent|FOREGROUND_INTENSITY|BACKGROUND_INTENSITY)); } @@ -5252,10 +6102,9 @@ standout(void) standend(void) { if (g_attrPreStandout) - { textattr(g_attrPreStandout); - g_attrPreStandout = 0; - } + + g_attrPreStandout = 0; } @@ -5270,7 +6119,11 @@ mch_set_normal_colors(void) cterm_normal_fg_color = (g_attrDefault & 0xf) + 1; cterm_normal_bg_color = ((g_attrDefault >> 4) & 0xf) + 1; - if (T_ME[0] == ESC && T_ME[1] == '|') + if ( +#ifdef FEAT_TERMGUICOLORS + !p_tgc && +#endif + T_ME[0] == ESC && T_ME[1] == '|') { p = T_ME + 2; n = getdigits(&p); @@ -5280,6 +6133,10 @@ mch_set_normal_colors(void) cterm_normal_bg_color = ((n >> 4) & 0xf) + 1; } } +#ifdef FEAT_TERMGUICOLORS + cterm_normal_fg_gui_color = INVALCOLOR; + cterm_normal_bg_gui_color = INVALCOLOR; +#endif } @@ -5303,7 +6160,8 @@ visual_bell(void) coordOrigin, &dwDummy); Sleep(15); /* wait for 15 msec */ - WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns, + if (!USE_VTP) + WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns, coordOrigin, &dwDummy); vim_free(oldattrs); } @@ -5323,27 +6181,92 @@ cursor_visible(BOOL fVisible) /* - * write `cchToWrite' characters in `pchBuf' to the screen - * Returns the number of characters actually written (at least one). + * Write "cbToWrite" bytes in `pchBuf' to the screen. + * Returns the number of bytes actually written (at least one). */ - static BOOL + static DWORD write_chars( - LPCSTR pchBuf, - DWORD cchToWrite) + char_u *pchBuf, + DWORD cbToWrite) { COORD coord = g_coord; DWORD written; - FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cchToWrite, - coord, &written); - /* When writing fails or didn't write a single character, pretend one - * character was written, otherwise we get stuck. */ - if (WriteConsoleOutputCharacter(g_hConOut, pchBuf, cchToWrite, - coord, &written) == 0 - || written == 0) - written = 1; +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + static WCHAR *unicodebuf = NULL; + static int unibuflen = 0; + int length; + DWORD n, cchwritten, cells; + + length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pchBuf, cbToWrite, 0, 0); + if (unicodebuf == NULL || length > unibuflen) + { + vim_free(unicodebuf); + unicodebuf = (WCHAR *)lalloc(length * sizeof(WCHAR), FALSE); + unibuflen = length; + } + MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pchBuf, cbToWrite, + unicodebuf, unibuflen); + + cells = mb_string2cells(pchBuf, cbToWrite); + + if (!USE_VTP) + { + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cells, + coord, &written); + /* When writing fails or didn't write a single character, pretend one + * character was written, otherwise we get stuck. */ + if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length, + coord, &cchwritten) == 0 + || cchwritten == 0) + cchwritten = 1; + } + else + { + if (WriteConsoleW(g_hConOut, unicodebuf, length, &cchwritten, + NULL) == 0 || cchwritten == 0) + cchwritten = 1; + } + + if (cchwritten == length) + { + written = cbToWrite; + g_coord.X += (SHORT)cells; + } + else + { + char_u *p = pchBuf; + for (n = 0; n < cchwritten; n++) + MB_CPTR_ADV(p); + written = p - pchBuf; + g_coord.X += (SHORT)mb_string2cells(pchBuf, written); + } + } + else +#endif + { + if (!USE_VTP) + { + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cbToWrite, + coord, &written); + /* When writing fails or didn't write a single character, pretend one + * character was written, otherwise we get stuck. */ + if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite, + coord, &written) == 0 + || written == 0) + written = 1; + } + else + { + if (WriteConsole(g_hConOut, (LPCSTR)pchBuf, cbToWrite, &written, + NULL) == 0 || written == 0) + written = 1; + } - g_coord.X += (SHORT) written; + g_coord.X += (SHORT) written; + } while (g_coord.X > g_srScrollRegion.Right) { @@ -5380,11 +6303,11 @@ mch_write( { /* optimization: use one single write_chars for runs of text, * rather than once per character It ain't curses, but it helps. */ - DWORD prefix = (DWORD)strcspn(s, "\n\r\b\a\033"); + DWORD prefix = (DWORD)strcspn((char *)s, "\n\r\b\a\033"); if (p_wd) { - WaitForChar(p_wd); + WaitForChar(p_wd, FALSE); if (prefix != 0) prefix = 1; } @@ -5466,67 +6389,76 @@ mch_write( char_u *old_s = s; #endif char_u *p; - int arg1 = 0, arg2 = 0; + int arg1 = 0, arg2 = 0, argc = 0, args[16]; switch (s[2]) { - /* one or two numeric arguments, separated by ';' */ - case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - p = s + 2; - arg1 = getdigits(&p); /* no check for length! */ - if (p > s + len) - break; - - if (*p == ';') + p = s + 1; + do { ++p; - arg2 = getdigits(&p); /* no check for length! */ + args[argc] = getdigits(&p); + argc += (argc < 15) ? 1 : 0; if (p > s + len) break; + } while (*p == ';'); + + if (p > s + len) + break; - if (*p == 'H') - gotoxy(arg2, arg1); - else if (*p == 'r') - set_scroll_region(0, arg1 - 1, Columns - 1, arg2 - 1); + arg1 = args[0]; + arg2 = args[1]; + if (*p == 'm') + { + if (argc == 1 && args[0] == 0) + normvideo(); + else if (argc == 1) + { + if (USE_VTP) + textcolor((WORD) arg1); + else + textattr((WORD) arg1); + } + else if (USE_VTP) + vtp_sgr_bulks(argc, args); } - else if (*p == 'A') + else if (argc == 2 && *p == 'H') { - /* move cursor up arg1 lines in same column */ - gotoxy(g_coord.X + 1, - max(g_srScrollRegion.Top, g_coord.Y - arg1) + 1); + gotoxy(arg2, arg1); } - else if (*p == 'C') + else if (argc == 2 && *p == 'r') { - /* move cursor right arg1 columns in same line */ - gotoxy(min(g_srScrollRegion.Right, g_coord.X + arg1) + 1, - g_coord.Y + 1); + set_scroll_region(0, arg1 - 1, Columns - 1, arg2 - 1); } - else if (*p == 'H') + else if (argc == 1 && *p == 'A') { - gotoxy(1, arg1); + gotoxy(g_coord.X + 1, + max(g_srScrollRegion.Top, g_coord.Y - arg1) + 1); } - else if (*p == 'L') + else if (argc == 1 && *p == 'b') { - insert_lines(arg1); + textbackground((WORD) arg1); } - else if (*p == 'm') + else if (argc == 1 && *p == 'C') { - if (arg1 == 0) - normvideo(); - else - textattr((WORD) arg1); + gotoxy(min(g_srScrollRegion.Right, g_coord.X + arg1) + 1, + g_coord.Y + 1); } - else if (*p == 'f') + else if (argc == 1 && *p == 'f') { textcolor((WORD) arg1); } - else if (*p == 'b') + else if (argc == 1 && *p == 'H') { - textbackground((WORD) arg1); + gotoxy(1, arg1); } - else if (*p == 'M') + else if (argc == 1 && *p == 'L') + { + insert_lines(arg1); + } + else if (argc == 1 && *p == 'M') { delete_lines(arg1); } @@ -5535,11 +6467,7 @@ mch_write( s = p + 1; break; - - /* Three-character escape sequences */ - case 'A': - /* move cursor up one line in same column */ gotoxy(g_coord.X + 1, max(g_srScrollRegion.Top, g_coord.Y - 1) + 1); goto got3; @@ -5549,7 +6477,6 @@ mch_write( goto got3; case 'C': - /* move cursor right one column in same line */ gotoxy(min(g_srScrollRegion.Right, g_coord.X + 1) + 1, g_coord.Y + 1); goto got3; @@ -5646,13 +6573,12 @@ mch_write( /* - * Delay for half a second. + * Delay for "msec" milliseconds. */ -/*ARGSUSED*/ void mch_delay( long msec, - int ignoreinput) + int ignoreinput UNUSED) { #ifdef FEAT_GUI_W32 Sleep((int)msec); /* never wait for input */ @@ -5677,13 +6603,14 @@ mch_delay( # endif Sleep((int)msec); else - WaitForChar(msec); + WaitForChar(msec, FALSE); #endif } /* - * this version of remove is not scared by a readonly (backup) file + * This version of remove is not scared by a readonly (backup) file. + * This can also remove a symbolic link like Unix. * Return 0 for success, -1 for failure. */ int @@ -5694,6 +6621,13 @@ mch_remove(char_u *name) int n; #endif + /* + * On Windows, deleting a directory's symbolic link is done by + * RemoveDirectory(): mch_rmdir. It seems unnatural, but it is fact. + */ + if (mch_isdir(name) && mch_is_symbolic_link(name)) + return mch_rmdir(name); + win32_setattrs(name, FILE_ATTRIBUTE_NORMAL); #ifdef FEAT_MBYTE @@ -5704,31 +6638,59 @@ mch_remove(char_u *name) { n = DeleteFileW(wn) ? 0 : -1; vim_free(wn); - if (n == 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return n; - /* Retry with non-wide function (for Windows 98). */ + return n; } } #endif - return DeleteFile(name) ? 0 : -1; + return DeleteFile((LPCSTR)name) ? 0 : -1; } /* - * check for an "interrupt signal": CTRL-break or CTRL-C + * Check for an "interrupt signal": CTRL-break or CTRL-C. */ void -mch_breakcheck(void) +mch_breakcheck(int force) { #ifndef FEAT_GUI_W32 /* never used */ if (g_fCtrlCPressed || g_fCBrkPressed) { + ctrl_break_was_pressed = g_fCBrkPressed; g_fCtrlCPressed = g_fCBrkPressed = FALSE; got_int = TRUE; } #endif } +/* physical RAM to leave for the OS */ +#define WINNT_RESERVE_BYTES (256*1024*1024) + +/* + * How much main memory in KiB that can be used by VIM. + */ + long_u +mch_total_mem(int special UNUSED) +{ + MEMORYSTATUSEX ms; + + PlatformId(); + /* Need to use GlobalMemoryStatusEx() when there is more memory than + * what fits in 32 bits. But it's not always available. */ + ms.dwLength = sizeof(MEMORYSTATUSEX); + GlobalMemoryStatusEx(&ms); + if (ms.ullAvailVirtual < ms.ullTotalPhys) + { + /* Process address space fits in physical RAM, use all of it. */ + return (long_u)(ms.ullAvailVirtual / 1024); + } + if (ms.ullTotalPhys <= WINNT_RESERVE_BYTES) + { + /* Catch old NT box or perverse hardware setup. */ + return (long_u)((ms.ullTotalPhys / 2) / 1024); + } + /* Use physical RAM less reserve for OS + data. */ + return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024); +} #ifdef FEAT_MBYTE /* @@ -5744,16 +6706,13 @@ mch_wrename(WCHAR *wold, WCHAR *wnew) WCHAR szNewPath[_MAX_PATH + 1]; HANDLE hf; - if (!mch_windows95()) - { - p = wold; - for (i = 0; wold[i] != NUL; ++i) - if ((wold[i] == '/' || wold[i] == '\\' || wold[i] == ':') - && wold[i + 1] != 0) - p = wold + i + 1; - if ((int)(wold + i - p) < 8 || p[6] != '~') - return (MoveFileW(wold, wnew) == 0); - } + p = wold; + for (i = 0; wold[i] != NUL; ++i) + if ((wold[i] == '/' || wold[i] == '\\' || wold[i] == ':') + && wold[i + 1] != 0) + p = wold + i + 1; + if ((int)(wold + i - p) < 8 || p[6] != '~') + return (MoveFileW(wold, wnew) == 0); if (GetFullPathNameW(wnew, _MAX_PATH, szNewPath, &p) == 0 || p == NULL) return -1; @@ -5831,22 +6790,17 @@ mch_rename( retval = mch_wrename(wold, wnew); vim_free(wold); vim_free(wnew); - if (retval == 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return retval; - /* Retry with non-wide function (for Windows 98). */ + return retval; } #endif /* - * No need to play tricks if not running Windows 95, unless the file name - * contains a "~" as the seventh character. + * No need to play tricks unless the file name contains a "~" as the + * seventh character. */ - if (!mch_windows95()) - { - pszFilePart = (char *)gettail((char_u *)pszOldFile); - if (STRLEN(pszFilePart) < 8 || pszFilePart[6] != '~') - return rename(pszOldFile, pszNewFile); - } + pszFilePart = (char *)gettail((char_u *)pszOldFile); + if (STRLEN(pszFilePart) < 8 || pszFilePart[6] != '~') + return rename(pszOldFile, pszNewFile); /* Get base path of new file name. Undocumented feature: If pszNewFile is * a directory, no error is returned and pszFilePart will be NULL. */ @@ -5909,16 +6863,9 @@ mch_rename( char * default_shell(void) { - char* psz = NULL; - PlatformId(); - if (g_PlatformId == VER_PLATFORM_WIN32_NT) /* Windows NT */ - psz = "cmd.exe"; - else if (g_PlatformId == VER_PLATFORM_WIN32_WINDOWS) /* Windows 95 */ - psz = "command.com"; - - return psz; + return "cmd.exe"; } /* @@ -5929,16 +6876,15 @@ default_shell(void) mch_access(char *n, int p) { HANDLE hFile; - DWORD am; int retval = -1; /* default: fail */ #ifdef FEAT_MBYTE WCHAR *wn = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) - wn = enc_to_utf16(n, NULL); + wn = enc_to_utf16((char_u *)n, NULL); #endif - if (mch_isdir(n)) + if (mch_isdir((char_u *)n)) { char TempName[_MAX_PATH + 16] = ""; #ifdef FEAT_MBYTE @@ -5964,24 +6910,17 @@ mch_access(char *n, int p) hFile = FindFirstFileW(TempNameW, &d); if (hFile == INVALID_HANDLE_VALUE) - { - if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - goto getout; - - /* Retry with non-wide function (for Windows 98). */ - vim_free(wn); - wn = NULL; - } + goto getout; else (void)FindClose(hFile); } - if (wn == NULL) + else #endif { char *pch; WIN32_FIND_DATA d; - vim_strncpy(TempName, n, _MAX_PATH); + vim_strncpy((char_u *)TempName, (char_u *)n, _MAX_PATH); pch = TempName + STRLEN(TempName) - 1; if (*pch != '\\' && *pch != '/') *++pch = '\\'; @@ -6005,18 +6944,11 @@ mch_access(char *n, int p) if (wn != NULL) { if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW)) - { - if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - goto getout; - - /* Retry with non-wide function (for Windows 98). */ - vim_free(wn); - wn = NULL; - } + goto getout; else DeleteFileW(TempNameW); } - if (wn == NULL) + else #endif { if (!GetTempFileName(n, "VIM", 0, TempName)) @@ -6027,25 +6959,22 @@ mch_access(char *n, int p) } else { + // Don't consider a file read-only if another process has opened it. + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + /* Trying to open the file for the required access does ACL, read-only * network share, and file attribute checks. */ - am = ((p & W_OK) ? GENERIC_WRITE : 0) - | ((p & R_OK) ? GENERIC_READ : 0); + DWORD access_mode = ((p & W_OK) ? GENERIC_WRITE : 0) + | ((p & R_OK) ? GENERIC_READ : 0); + #ifdef FEAT_MBYTE if (wn != NULL) - { - hFile = CreateFileW(wn, am, 0, NULL, OPEN_EXISTING, 0, NULL); - if (hFile == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - /* Retry with non-wide function (for Windows 98). */ - vim_free(wn); - wn = NULL; - } - } - if (wn == NULL) + hFile = CreateFileW(wn, access_mode, share_mode, + NULL, OPEN_EXISTING, 0, NULL); + else #endif - hFile = CreateFile(n, am, 0, NULL, OPEN_EXISTING, 0, NULL); + hFile = CreateFile(n, access_mode, share_mode, + NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) goto getout; CloseHandle(hFile); @@ -6064,7 +6993,7 @@ mch_access(char *n, int p) * Version of open() that may use UTF-16 file name. */ int -mch_open(char *name, int flags, int mode) +mch_open(const char *name, int flags, int mode) { /* _wopen() does not work with Borland C 5.5: creates a read-only file. */ # ifndef __BORLANDC__ @@ -6073,20 +7002,23 @@ mch_open(char *name, int flags, int mode) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - wn = enc_to_utf16(name, NULL); + wn = enc_to_utf16((char_u *)name, NULL); if (wn != NULL) { f = _wopen(wn, flags, mode); vim_free(wn); - if (f >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT) - return f; - /* Retry with non-wide function (for Windows 98). Can't use - * GetLastError() here and it's unclear what errno gets set to if - * the _wopen() fails for missing wide functions. */ + return f; } } # endif + /* open() can open a file which name is longer than _MAX_PATH bytes + * and shorter than _MAX_PATH characters successfully, but sometimes it + * causes unexpected error in another part. We make it an error explicitly + * here. */ + if (strlen(name) >= _MAX_PATH) + return -1; + return open(name, flags, mode); } @@ -6094,17 +7026,12 @@ mch_open(char *name, int flags, int mode) * Version of fopen() that may use UTF-16 file name. */ FILE * -mch_fopen(char *name, char *mode) +mch_fopen(const char *name, const char *mode) { WCHAR *wn, *wm; FILE *f = NULL; - if (enc_codepage >= 0 && (int)GetACP() != enc_codepage -# ifdef __BORLANDC__ - /* Wide functions of Borland C 5.5 do not work on Windows 98. */ - && g_PlatformId == VER_PLATFORM_WIN32_NT -# endif - ) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { # if defined(DEBUG) && _MSC_VER >= 1400 /* Work around an annoying assertion in the Microsoft debug CRT @@ -6118,8 +7045,8 @@ mch_fopen(char *name, char *mode) else if (newMode == 'b') _set_fmode(_O_BINARY); # endif - wn = enc_to_utf16(name, NULL); - wm = enc_to_utf16(mode, NULL); + wn = enc_to_utf16((char_u *)name, NULL); + wm = enc_to_utf16((char_u *)mode, NULL); if (wn != NULL && wm != NULL) f = _wfopen(wn, wm); vim_free(wn); @@ -6128,14 +7055,16 @@ mch_fopen(char *name, char *mode) # if defined(DEBUG) && _MSC_VER >= 1400 _set_fmode(oldMode); # endif - - if (f != NULL || g_PlatformId == VER_PLATFORM_WIN32_NT) - return f; - /* Retry with non-wide function (for Windows 98). Can't use - * GetLastError() here and it's unclear what errno gets set to if - * the _wfopen() fails for missing wide functions. */ + return f; } + /* fopen() can open a file which name is longer than _MAX_PATH bytes + * and shorter than _MAX_PATH characters successfully, but sometimes it + * causes unexpected error in another part. We make it an error explicitly + * here. */ + if (strlen(name) >= _MAX_PATH) + return NULL; + return fopen(name, mode); } #endif @@ -6297,8 +7226,7 @@ mch_copy_file_attribute(char_u *from, char_u *to) #ifdef FEAT_MBYTE /* File streams only work on Windows NT and later. */ PlatformId(); - if (g_PlatformId == VER_PLATFORM_WIN32_NT) - copy_infostreams(from, to); + copy_infostreams(from, to); #endif return 0; } @@ -6310,7 +7238,6 @@ mch_copy_file_attribute(char_u *from, char_u *to) */ /* These magic numbers are from the MS header files */ -#define MIN_STACK_WIN9X 17 #define MIN_STACK_WINNT 2 /* @@ -6330,10 +7257,7 @@ myresetstkoflw(void) DWORD nPageSize; DWORD dummy; - /* This code will not work on win32s. */ PlatformId(); - if (g_PlatformId == VER_PLATFORM_WIN32s) - return 0; /* We need to know the system page size. */ GetSystemInfo(&si); @@ -6349,29 +7273,12 @@ myresetstkoflw(void) /* ...and the page thats min_stack_req pages away from stack base; this is * the lowest page we could use. */ - pLowestPossiblePage = pStackBase + ((g_PlatformId == VER_PLATFORM_WIN32_NT) - ? MIN_STACK_WINNT : MIN_STACK_WIN9X) * nPageSize; + pLowestPossiblePage = pStackBase + MIN_STACK_WINNT * nPageSize; - /* On Win95, we want the next page down from the end of the stack. */ - if (g_PlatformId == VER_PLATFORM_WIN32_WINDOWS) { - /* Find the page that's only 1 page down from the page that the stack - * ptr is in. */ - pGuardPage = (BYTE*)((DWORD)nPageSize * (((DWORD)pStackPtr - / (DWORD)nPageSize) - 1)); - if (pGuardPage < pLowestPossiblePage) - return 0; - - /* Apply the noaccess attribute to the page -- there's no guard - * attribute in win95-type OSes. */ - if (!VirtualProtect(pGuardPage, nPageSize, PAGE_NOACCESS, &dummy)) - return 0; - } - else - { - /* On NT, however, we want the first committed page in the stack Start - * at the stack base and move forward through memory until we find a - * committed block. */ + /* We want the first committed page in the stack Start at the stack + * base and move forward through memory until we find a committed block. + */ BYTE *pBlock = pStackBase; for (;;) @@ -6442,6 +7349,7 @@ get_cmd_argsW(char ***argvp) int argc = 0; int i; + free_cmd_argsW(); ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW); if (ArglistW != NULL) { @@ -6474,7 +7382,11 @@ get_cmd_argsW(char ***argvp) global_argc = argc; global_argv = argv; if (argc > 0) + { + if (used_file_indexes != NULL) + free(used_file_indexes); used_file_indexes = malloc(argc * sizeof(int)); + } if (argvp != NULL) *argvp = argv; @@ -6569,6 +7481,8 @@ fix_arg_enc(void) str = utf16_to_enc(ArglistW[idx], NULL); if (str != NULL) { + int literal = used_file_literal; + #ifdef FEAT_DIFF /* When using diff mode may need to concatenate file name to * directory name. Just like it's done in main(). */ @@ -6590,7 +7504,16 @@ fix_arg_enc(void) if (used_file_literal) buf_set_name(fnum_list[i], str); - alist_add(&global_alist, str, used_file_literal ? 2 : 0); + /* Check backtick literal. backtick literal is already expanded in + * main.c, so this part add str as literal. */ + if (literal == FALSE) + { + size_t len = STRLEN(str); + + if (len > 2 && *str == '`' && *(str + len - 1) == '`') + literal = TRUE; + } + alist_add(&global_alist, str, literal ? 2 : 0); } } @@ -6599,10 +7522,15 @@ fix_arg_enc(void) /* Now expand wildcards in the arguments. */ /* Temporarily add '(' and ')' to 'isfname'. These are valid * filename characters but are excluded from 'isfname' to make - * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ + * "gf" work on a file name in parenthesis (e.g.: see vim.h). + * Also, unset wildignore to not be influenced by this option. + * The arguments specified in command-line should be kept even if + * encoding options were changed. */ do_cmdline_cmd((char_u *)":let SaVe_ISF = &isf|set isf+=(,)"); + do_cmdline_cmd((char_u *)":let SaVe_WIG = &wig|set wig="); alist_expand(fnum_list, used_alist_count); do_cmdline_cmd((char_u *)":let &isf = SaVe_ISF|unlet SaVe_ISF"); + do_cmdline_cmd((char_u *)":let &wig = SaVe_WIG|unlet SaVe_WIG"); } /* If wildcard expansion failed, we are editing the first file of the @@ -6611,9 +7539,262 @@ fix_arg_enc(void) { do_cmdline_cmd((char_u *)":rewind"); if (GARGCOUNT == 1 && used_file_full_path) - (void)vim_chdirfile(alist_name(&GARGLIST[0])); + (void)vim_chdirfile(alist_name(&GARGLIST[0]), "drop"); } set_alist_count(); } +#endif + + int +mch_setenv(char *var, char *value, int x) +{ + char_u *envbuf; + + envbuf = alloc((unsigned)(STRLEN(var) + STRLEN(value) + 2)); + if (envbuf == NULL) + return -1; + + sprintf((char *)envbuf, "%s=%s", var, value); + +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR *p = enc_to_utf16(envbuf, NULL); + + vim_free(envbuf); + if (p == NULL) + return -1; + _wputenv(p); +# ifdef libintl_wputenv + libintl_wputenv(p); +# endif + /* Unlike Un*x systems, we can free the string for _wputenv(). */ + vim_free(p); + } + else +#endif + { + _putenv((char *)envbuf); +# ifdef libintl_putenv + libintl_putenv((char *)envbuf); +# endif + /* Unlike Un*x systems, we can free the string for _putenv(). */ + vim_free(envbuf); + } + + return 0; +} + +#ifndef FEAT_GUI_W32 + +/* + * Support for 256 colors and 24-bit colors was added in Windows 10 + * version 1703 (Creators update). + */ +# define VTP_FIRST_SUPPORT_BUILD MAKE_VER(10, 0, 15063) + + static void +vtp_init(void) +{ + DWORD ver, mode; + HMODULE hKerneldll; + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + + ver = get_build_number(); + vtp_working = (ver >= VTP_FIRST_SUPPORT_BUILD) ? 1 : 0; + GetConsoleMode(g_hConOut, &mode); + mode |= (ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING); + if (SetConsoleMode(g_hConOut, mode) == 0) + vtp_working = 0; + + /* Use functions supported from Vista */ + hKerneldll = GetModuleHandle("kernel32.dll"); + if (hKerneldll != NULL) + { + pGetConsoleScreenBufferInfoEx = + (PfnGetConsoleScreenBufferInfoEx)GetProcAddress( + hKerneldll, "GetConsoleScreenBufferInfoEx"); + pSetConsoleScreenBufferInfoEx = + (PfnSetConsoleScreenBufferInfoEx)GetProcAddress( + hKerneldll, "SetConsoleScreenBufferInfoEx"); + if (pGetConsoleScreenBufferInfoEx != NULL + && pSetConsoleScreenBufferInfoEx != NULL) + has_csbiex = TRUE; + } + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + save_console_bg_rgb = (guicolor_T)csbi.ColorTable[0]; + save_console_fg_rgb = (guicolor_T)csbi.ColorTable[7]; + + set_console_color_rgb(); +} + + static void +vtp_exit(void) +{ + reset_console_color_rgb(); +} + + static int +vtp_printf( + char *format, + ...) +{ + char_u buf[100]; + va_list list; + DWORD result; + + va_start(list, format); + vim_vsnprintf((char *)buf, 100, (char *)format, list); + va_end(list); + WriteConsoleA(g_hConOut, buf, (DWORD)STRLEN(buf), &result, NULL); + return (int)result; +} + + static void +vtp_sgr_bulk( + int arg) +{ + int args[1]; + + args[0] = arg; + vtp_sgr_bulks(1, args); +} + + static void +vtp_sgr_bulks( + int argc, + int *args +) +{ + /* 2('\033[') + 4('255.') * 16 + NUL */ + char_u buf[2 + (4 * 16) + 1]; + char_u *p; + int i; + + p = buf; + *p++ = '\033'; + *p++ = '['; + + for (i = 0; i < argc; ++i) + { + p += vim_snprintf((char *)p, 4, "%d", args[i] & 0xff); + *p++ = ';'; + } + p--; + *p++ = 'm'; + *p = NUL; + vtp_printf((char *)buf); +} + +# ifdef FEAT_TERMGUICOLORS + static int +ctermtoxterm( + int cterm) +{ + char_u r, g, b, idx; + + cterm_color2rgb(cterm, &r, &g, &b, &idx); + return (((int)r << 16) | ((int)g << 8) | (int)b); +} +# endif + + static void +set_console_color_rgb(void) +{ +# ifdef FEAT_TERMGUICOLORS + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + int id; + guicolor_T fg = INVALCOLOR; + guicolor_T bg = INVALCOLOR; + int ctermfg; + int ctermbg; + + if (!USE_VTP) + return; + + id = syn_name2id((char_u *)"Normal"); + if (id > 0) + syn_id2colors(id, &fg, &bg); + if (fg == INVALCOLOR) + { + ctermfg = -1; + if (id > 0) + syn_id2cterm_bg(id, &ctermfg, &ctermbg); + fg = ctermfg != -1 ? ctermtoxterm(ctermfg) : 0xc0c0c0; /* white */ + } + if (bg == INVALCOLOR) + { + ctermbg = -1; + if (id > 0) + syn_id2cterm_bg(id, &ctermfg, &ctermbg); + bg = ctermbg != -1 ? ctermtoxterm(ctermbg) : 0x000000; /* black */ + } + fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg); + bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg); + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + + csbi.cbSize = sizeof(csbi); + csbi.srWindow.Right += 1; + csbi.srWindow.Bottom += 1; + csbi.ColorTable[0] = (COLORREF)bg; + csbi.ColorTable[7] = (COLORREF)fg; + if (has_csbiex) + pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); +# endif +} + + static void +reset_console_color_rgb(void) +{ +# ifdef FEAT_TERMGUICOLORS + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + + csbi.cbSize = sizeof(csbi); + csbi.srWindow.Right += 1; + csbi.srWindow.Bottom += 1; + csbi.ColorTable[0] = (COLORREF)save_console_bg_rgb; + csbi.ColorTable[7] = (COLORREF)save_console_fg_rgb; + if (has_csbiex) + pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); +# endif +} + + void +control_console_color_rgb(void) +{ + if (USE_VTP) + set_console_color_rgb(); + else + reset_console_color_rgb(); +} + + int +has_vtp_working(void) +{ + return vtp_working; +} + + int +use_vtp(void) +{ + return USE_VTP; +} + + int +is_term_win32(void) +{ + return T_NAME != NULL && STRCMP(T_NAME, "win32") == 0; +} + #endif diff --git a/src/os_win32.h b/src/os_win32.h index 8553910e3d..21f35a76bd 100644 --- a/src/os_win32.h +++ b/src/os_win32.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -49,9 +49,6 @@ #ifndef HAVE_FCNTL_H # define HAVE_FCNTL_H #endif -#ifndef HAVE_STDARG_H -# define HAVE_STDARG_H -#endif #define HAVE_QSORT #define HAVE_ST_MODE /* have stat.st_mode */ @@ -78,10 +75,13 @@ # define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */ #endif +#define HAVE_TOTAL_MEM + #define HAVE_PUTENV /* at least Bcc 5.2 and MSC have it */ #ifdef FEAT_GUI_W32 # define NO_CONSOLE /* don't included console-only code */ +# define USE_TRANSPARENCY #endif /* toupper() is not really broken, but it's very slow. Probably because of @@ -203,7 +203,9 @@ Trace(char *pszFormat, ...); #define ASSERT_NULL_OR_POINTER(p, type) \ ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) -#define mch_setenv(name, val, x) setenv(name, val, x) +#ifndef HAVE_SETENV +# define HAVE_SETENV +#endif #define mch_getenv(x) (char_u *)getenv((char *)(x)) #ifdef __BORLANDC__ # define vim_mkdir(x, y) mkdir(x) @@ -211,20 +213,15 @@ Trace(char *pszFormat, ...); # define vim_mkdir(x, y) mch_mkdir(x) #endif -#ifndef PROTO - /* Enable common dialogs input unicode from IME if possible. */ #ifdef FEAT_MBYTE - /* The variables are defined in os_win32.c. */ -extern LRESULT (WINAPI *pDispatchMessage)(CONST MSG *); -extern BOOL (WINAPI *pGetMessage)(LPMSG, HWND, UINT, UINT); -extern BOOL (WINAPI *pIsDialogMessage)(HWND, LPMSG); -extern BOOL (WINAPI *pPeekMessage)(LPMSG, HWND, UINT, UINT, UINT); +# define pDispatchMessage DispatchMessageW +# define pGetMessage GetMessageW +# define pIsDialogMessage IsDialogMessageW +# define pPeekMessage PeekMessageW #else # define pDispatchMessage DispatchMessage # define pGetMessage GetMessage # define pIsDialogMessage IsDialogMessage # define pPeekMessage PeekMessage #endif - -#endif /* PROTO */ diff --git a/src/osdef.sh b/src/osdef.sh index 6f9fea28b5..59ef55d046 100755 --- a/src/osdef.sh +++ b/src/osdef.sh @@ -53,11 +53,11 @@ $CC -I. -I$srcdir -E osdef0.c >osdef0.cc # start of the line is matched with "[)*, ]\1[ (]" sed < osdef0.cc -e '/\(..*\)/s// \1/' > osdef0.ccc -sed < $srcdir/osdef1.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\) __ARGS.*@/[)*, ][(]*\1[)]*[ (]/i\\\ -\\/\\[^a-zA-Z_\\]\1 __ARGS\\/d@p' > osdef11.sed +sed < $srcdir/osdef1.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, ][(]*\1[)]*[ (]/i\\\ +\\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef11.sed -sed < $srcdir/osdef2.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\) __ARGS.*@/[)*, ][(]*\1[)]*[ (]/i\\\ -\\/\\[^a-zA-Z_\\]\1 __ARGS\\/d@p' > osdef21.sed +sed < $srcdir/osdef2.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, ][(]*\1[)]*[ (]/i\\\ +\\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef21.sed cat << EOF > osdef2.sed 1i\\ diff --git a/src/osdef1.h.in b/src/osdef1.h.in index 8190c9b1ee..5519104c93 100644 --- a/src/osdef1.h.in +++ b/src/osdef1.h.in @@ -12,130 +12,125 @@ * sed cannot always handle so many commands, this is file 1 of 2 */ -extern int printf __ARGS((char *, ...)); -extern int fprintf __ARGS((FILE *, char *, ...)); -extern int sprintf __ARGS((char *, char *, ...)); -extern int sscanf __ARGS((char *, char *, ...)); +extern int printf(char *, ...); +extern int fprintf(FILE *, char *, ...); +extern int sprintf(char *, char *, ...); +extern int sscanf(char *, char *, ...); #ifndef fopen /* could be redefined to fopen64() */ -extern FILE *fopen __ARGS((const char *, const char *)); +extern FILE *fopen(const char *, const char *); #endif -extern int fclose __ARGS((FILE *)); -extern int fseek __ARGS((FILE *, long, int)); +extern int fclose(FILE *); +extern int fseek(FILE *, long, int); #ifdef HAVE_FSEEKO -extern int fseeko __ARGS((FILE *, off_t, int)); +extern int fseeko(FILE *, off_t, int); #endif -extern long ftell __ARGS((FILE *)); +extern long ftell(FILE *); #ifdef HAVE_FSEEKO -extern off_t ftello __ARGS((FILE *)); +extern off_t ftello(FILE *); #endif -extern void rewind __ARGS((FILE *)); -extern int fread __ARGS((char *, int, int, FILE *)); -extern int fwrite __ARGS((char *, int, int, FILE *)); -extern int fputs __ARGS((char *, FILE *)); +extern void rewind(FILE *); +extern int fread(char *, int, int, FILE *); +extern int fwrite(char *, int, int, FILE *); +extern int fputs(char *, FILE *); #ifndef ferror /* let me say it again: "macros should never have prototypes" */ -extern int ferror __ARGS((FILE *)); +extern int ferror(FILE *); #endif -extern int fflush __ARGS((FILE *)); +extern int fflush(FILE *); #if defined(sun) || defined(_SEQUENT_) /* used inside of stdio macros getc(), puts(), putchar()... */ -extern int _flsbuf __ARGS((int, FILE *)); -extern int _filbuf __ARGS((FILE *)); +extern int _flsbuf(int, FILE *); +extern int _filbuf(FILE *); #endif #if !defined(HAVE_SELECT) -struct pollfd; /* for poll __ARGS */ -extern int poll __ARGS((struct pollfd *, long, int)); +struct pollfd; /* for poll() */ +extern int poll(struct pollfd *, long, int); #endif #ifdef HAVE_MEMSET -extern void *memset __ARGS((void *, int, size_t)); -#endif -#ifdef HAVE_BCMP -extern int bcmp __ARGS((void *, void *, size_t)); -#endif -#ifdef HAVE_MEMCMP -extern int memcmp __ARGS((const void *, const void *, size_t)); +extern void *memset(void *, int, size_t); #endif +extern int memcmp(const void *, const void *, size_t); #ifdef HAVE_STRPBRK -extern char *strpbrk __ARGS((const char *, const char *)); +extern char *strpbrk(const char *, const char *); #endif #ifdef USEBCOPY -extern void bcopy __ARGS((char *, char *, int)); +extern void bcopy(char *, char *, int); #else # ifdef USEMEMCPY -extern void memcpy __ARGS((char *, char *, int)); +extern void memcpy(char *, char *, int); # else # ifdef USEMEMMOVE -extern void memmove __ARGS((char *, char *, int)); +extern void memmove(char *, char *, int); # endif # endif #endif /* used inside of FD_ZERO macro: */ -extern void bzero __ARGS((void *, size_t)); +extern void bzero(void *, size_t); #ifdef HAVE_SETSID -extern pid_t setsid __ARGS((void)); +extern pid_t setsid(void); #endif #ifdef HAVE_SETPGID -extern int setpgid __ARGS((pid_t, pid_t)); +extern int setpgid(pid_t, pid_t); #endif #ifdef HAVE_STRTOL -extern int strtol __ARGS((char *, char **, int)); +extern int strtol(char *, char **, int); #endif #ifdef HAVE_STRFTIME -extern size_t strftime __ARGS((char *, size_t, char *, struct tm *)); +extern size_t strftime(char *, size_t, char *, struct tm *); #endif #ifdef HAVE_STRCASECMP -extern int strcasecmp __ARGS((char *, char *)); +extern int strcasecmp(char *, char *); #endif #ifdef HAVE_STRNCASECMP -extern int strncasecmp __ARGS((char *, char *, size_t)); +extern int strncasecmp(char *, char *, size_t); #endif #ifndef strdup -extern char *strdup __ARGS((const char *)); +extern char *strdup(const char *); #endif -extern int atoi __ARGS((char *)); -extern int atol __ARGS((char *)); +extern int atoi(char *); +extern int atol(char *); #ifndef USE_SYSTEM -extern int fork __ARGS((void)); +extern int fork(void); # ifndef __TANDEM -extern int execvp __ARGS((const char *, const char **)); +extern int execvp(const char *, const char **); # endif -extern int wait __ARGS((int *)); /* will this break things ...? */ -extern int waitpid __ARGS((pid_t, int *, int)); +extern int wait(int *); /* will this break things ...? */ +extern int waitpid(pid_t, int *, int); #endif -extern int toupper __ARGS((int)); -extern int tolower __ARGS((int)); +extern int toupper(int); +extern int tolower(int); -extern RETSIGTYPE (*signal __ARGS((int, RETSIGTYPE (*func) SIGPROTOARG))) __ARGS(SIGPROTOARG); +extern RETSIGTYPE (*signal(int, RETSIGTYPE (*func) SIGPROTOARG)) SIGPROTOARG; #ifdef HAVE_SIGSET -extern RETSIGTYPE (*sigset __ARGS((int, RETSIGTYPE (*func) SIGPROTOARG))) __ARGS(SIGPROTOARG); +extern RETSIGTYPE (*sigset(int, RETSIGTYPE (*func) SIGPROTOARG)) SIGPROTOARG; #endif #if defined(HAVE_SETJMP_H) # ifdef HAVE_SIGSETJMP -extern int sigsetjmp __ARGS((sigjmp_buf, int)); -extern void siglongjmp __ARGS((sigjmp_buf, int)); +extern int sigsetjmp(sigjmp_buf, int); +extern void siglongjmp(sigjmp_buf, int); # else -extern int setjmp __ARGS((jmp_buf)); -extern void longjmp __ARGS((jmp_buf, int)); +extern int setjmp(jmp_buf); +extern void longjmp(jmp_buf, int); # endif #endif -extern int kill __ARGS((int, int)); +extern int kill(int, int); #ifndef __TANDEM -extern int access __ARGS((char *, int)); +extern int access(char *, int); #endif -extern int fsync __ARGS((int)); -extern int fchown __ARGS((int, int, int)); +extern int fsync(int); +extern int fchown(int, int, int); #if defined(HAVE_GETCWD) && !defined(sun) && !defined(__TANDEM) -extern char *getcwd __ARGS((char *, int)); +extern char *getcwd(char *, int); #else -extern char *getwd __ARGS((char *)); +extern char *getwd(char *); #endif #ifndef __alpha /* suggested by Campbell */ -extern int ioctl __ARGS((int, int, ...)); +extern int ioctl(int, int, ...); #endif -extern int chmod __ARGS((const char *, mode_t)); +extern int chmod(const char *, mode_t); diff --git a/src/osdef2.h.in b/src/osdef2.h.in index f2f97763fc..f29451ddfd 100644 --- a/src/osdef2.h.in +++ b/src/osdef2.h.in @@ -2,95 +2,99 @@ * osdef2.h.in - See osdef1.h.in for a description. */ -extern int remove __ARGS((const char *)); -extern int rename __ARGS((const char *, const char *)); -extern int free __ARGS((char *)); -extern char *malloc __ARGS((unsigned int)); -extern char *realloc __ARGS((char *, int)); -extern char *getenv __ARGS((char *)); -extern int setenv __ARGS((char *, char *, int)); -extern int putenv __ARGS((const char *)); +extern int remove(const char *); +extern int rename(const char *, const char *); +extern int free(char *); +extern char *malloc(unsigned int); +extern char *realloc(char *, int); +extern char *getenv(char *); +#ifndef __TANDEM +extern int setenv(char *, char *, int); +#else +extern int setenv(const char *, const char *, int); +#endif +extern int putenv(const char *); #ifndef __TANDEM -extern int gethostname __ARGS((char *, int)); +extern int gethostname(char *, int); #endif -extern void perror __ARGS((char *)); +extern void perror(char *); #ifndef __TANDEM -extern int sleep __ARGS((int)); +extern int sleep(int); #endif -extern int usleep __ARGS((unsigned int)); -extern unsigned int alarm __ARGS((unsigned int)); +extern int usleep(unsigned int); +extern unsigned int alarm(unsigned int); #ifndef __TANDEM -extern int chdir __ARGS((char *)); +extern int chdir(char *); #endif -extern int fchdir __ARGS((int)); +extern int fchdir(int); #ifndef stat /* could be redefined to stat64() */ -extern int stat __ARGS((const char *, struct stat *)); +extern int stat(const char *, struct stat *); #endif #ifndef lstat /* could be redefined to lstat64() */ -extern int lstat __ARGS((const char *, struct stat *)); +extern int lstat(const char *, struct stat *); #endif -extern int fstat __ARGS((int, struct stat *)); -extern int open __ARGS((const char *, int, ...)); -extern int close __ARGS((int)); +extern int fstat(int, struct stat *); +extern int open(const char *, int, ...); +extern int close(int); #ifndef __TANDEM -extern int read __ARGS((int, char *, size_t)); -extern int write __ARGS((int, char *, size_t)); +extern int read(int, char *, size_t); +extern int write(int, char *, size_t); #endif -extern int pipe __ARGS((int *)); -extern off_t lseek __ARGS((int, off_t, int)); -extern void sync __ARGS((void)); -extern uid_t getuid __ARGS((void)); -extern gid_t getgid __ARGS((void)); -extern void qsort __ARGS((void *, size_t, size_t, int (*)(const void *, const void *))); +extern int pipe(int *); +extern off_t lseek(int, off_t, int); +extern void sync(void); +extern uid_t getuid(void); +extern gid_t getgid(void); +extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); -extern int isatty __ARGS((int)); -extern int getpid __ARGS((void)); -extern int dup __ARGS((int)); -extern int unlink __ARGS((const char *)); -extern int link __ARGS((const char *, const char *)); -extern int mkdir __ARGS((const char *, mode_t)); -extern int rmdir __ARGS((const char *)); +extern int isatty(int); +extern int getpid(void); +extern int dup(int); +extern int unlink(const char *); +extern int link(const char *, const char *); +extern int mkdir(const char *, mode_t); +extern int rmdir(const char *); -extern int tgetent __ARGS((char *, char *)); -extern int tgetnum __ARGS((char *)); -extern int tgetflag __ARGS((char *)); -extern char *tgoto __ARGS((char *, int, int)); -extern int tputs __ARGS((char *, int, int (*)(int))); +extern int tgetent(char *, char *); +extern int tgetnum(char *); +extern int tgetflag(char *); +extern char *tgoto(char *, int, int); +extern int tputs(char *, int, int (*)(int)); #ifdef HAVE_TERMIOS_H -struct termios; /* for tcgetattr __ARGS */ -extern int tcgetattr __ARGS((int, struct termios *)); -extern int tcsetattr __ARGS((int, int, const struct termios *)); +struct termios; /* for tcgetattr() */ +extern int tcgetattr(int, struct termios *); +extern int tcsetattr(int, int, const struct termios *); #endif #ifdef HAVE_SYS_STATFS_H -struct statfs; /* for fstatfs __ARGS */ -extern int fstatfs __ARGS((int, struct statfs *, int, int)); +struct statfs; /* for fstatfs() */ +extern int fstatfs(int, struct statfs *, int, int); #endif #ifdef HAVE_GETTIMEOFDAY -struct timeval; /* for gettimeofday __ARGS */ -struct timezone; /* for gettimeofday __ARGS */ -extern int gettimeofday __ARGS((struct timeval *tp, struct timezone *tzp)); -extern time_t time __ARGS((time_t *)); +struct timeval; /* for gettimeofday() */ +struct timezone; /* for gettimeofday() */ +extern int gettimeofday(struct timeval *tp, struct timezone *tzp); +extern time_t time(time_t *); #endif #ifdef HAVE_GETPWNAM -struct passwd; /* for getpwnam __ARGS */ -extern struct passwd *getpwnam __ARGS((const char *)); +struct passwd; /* for getpwnam() */ +extern struct passwd *getpwnam(const char *); #endif #ifdef USE_TMPNAM -extern char *tmpnam __ARGS((char *)); +extern char *tmpnam(char *); #else -extern char *mktemp __ARGS((char *)); +extern char *mktemp(char *); #endif #ifdef ISC -extern int _Xmblen __ARGS((char const *, size_t)); +extern int _Xmblen(char const *, size_t); #else /* This is different from the header but matches mblen() */ -extern int _Xmblen __ARGS((char *, size_t)); +extern int _Xmblen(char *, size_t); #endif diff --git a/src/po/Make_cyg.mak b/src/po/Make_cyg.mak index be369164e6..5f6f6cca35 100644 --- a/src/po/Make_cyg.mak +++ b/src/po/Make_cyg.mak @@ -12,7 +12,8 @@ ifndef VIMRUNTIME VIMRUNTIME = ../../runtime endif -LANGUAGES = af \ +LANGUAGES = \ + af \ ca \ cs \ cs.cp1250 \ @@ -25,28 +26,34 @@ LANGUAGES = af \ ga \ it \ ja \ + ja.euc-jp \ ja.sjis \ ko \ ko.UTF-8 \ + nb \ + nl \ no \ pl \ pl.cp1250 \ + pl.UTF-8 \ pt_BR \ ru \ ru.cp1251 \ sk \ sk.cp1250 \ + sr \ sv \ uk \ uk.cp1251 \ vi \ zh_CN \ - zh_CN.UTF-8 \ zh_CN.cp936 \ + zh_CN.UTF-8 \ zh_TW \ zh_TW.UTF-8 \ -MOFILES = af.mo \ +MOFILES = \ + af.mo \ ca.mo \ cs.cp1250.mo \ cs.mo \ @@ -58,27 +65,32 @@ MOFILES = af.mo \ fr.mo \ ga.mo \ it.mo \ + ja.euc-jp.mo \ ja.mo \ ja.sjis.mo \ ko.mo \ ko.UTF-8.mo \ + nb.mo \ + nl.mo \ no.mo \ pl.cp1250.mo \ pl.mo \ + pl.UTF-8.mo \ pt_BR.mo \ ru.cp1251.mo \ ru.mo \ sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.cp1251.mo \ uk.mo \ vi.mo \ - zh_CN.UTF-8.mo \ - zh_CN.cp936.mo \ zh_CN.mo \ - zh_TW.UTF-8.mo \ + zh_CN.cp936.mo \ + zh_CN.UTF-8.mo \ zh_TW.mo \ + zh_TW.UTF-8.mo \ PACKAGE = vim @@ -118,11 +130,11 @@ all: $(MOFILES) first_time: $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs $(wildcard ../globals.h) + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h ../vim.h $(LANGUAGES): $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs $(wildcard ../globals.h) + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h ../vim.h $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old @@ -135,6 +147,8 @@ install: $(MOFILES) $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ done +install-all: install + clean: $(RM) *.mo $(RM) *.pot diff --git a/src/po/Make_ming.mak b/src/po/Make_ming.mak index 6d23390b5b..70b2c1efad 100644 --- a/src/po/Make_ming.mak +++ b/src/po/Make_ming.mak @@ -10,10 +10,19 @@ # language (xx) and add it to the next three lines. # +ifndef VIMRUNTIME +ifeq (sh.exe, $(SHELL)) +VIMRUNTIME = ..\..\runtime +else +VIMRUNTIME = ../../runtime +endif +endif + LANGUAGES = \ af \ ca \ cs \ + cs.cp1250 \ de \ en_GB \ eo \ @@ -23,23 +32,36 @@ LANGUAGES = \ ga \ it \ ja \ + ja.euc-jp \ + ja.sjis \ ko \ + ko.UTF-8 \ + nb \ + nl \ no \ pl \ + pl.cp1250 \ + pl.UTF-8 \ pt_BR \ ru \ + ru.cp1251 \ sk \ + sk.cp1250 \ + sr \ sv \ uk \ + uk.cp1251 \ vi \ zh_CN \ - zh_CN.UTF-8\ + zh_CN.cp936 \ + zh_CN.UTF-8 \ zh_TW \ zh_TW.UTF-8 \ MOFILES = \ af.mo \ ca.mo \ + cs.cp1250.mo \ cs.mo \ de.mo \ en_GB.mo \ @@ -49,20 +71,32 @@ MOFILES = \ fr.mo \ ga.mo \ it.mo \ + ja.euc-jp.mo \ ja.mo \ + ja.sjis.mo \ ko.mo \ + ko.UTF-8.mo \ + nb.mo \ + nl.mo \ no.mo \ + pl.cp1250.mo \ pl.mo \ + pl.UTF-8.mo \ pt_BR.mo \ + ru.cp1251.mo \ ru.mo \ + sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ + uk.cp1251.mo \ uk.mo \ vi.mo \ - zh_CN.UTF-8.mo \ zh_CN.mo \ - zh_TW.UTF-8.mo \ + zh_CN.cp936.mo \ + zh_CN.UTF-8.mo \ zh_TW.mo \ + zh_TW.UTF-8.mo \ PACKAGE = vim @@ -72,14 +106,27 @@ PACKAGE = vim #GETTEXT_PATH = C:/gettext-0.10.35-w32/win32/Release/ #GETTEXT_PATH = C:/cygwin/bin/ -MSGFMT = $(GETTEXT_PATH)msgfmt -XGETTEXT = $(GETTEXT_PATH)xgettext -MSGMERGE = $(GETTEXT_PATH)msgmerge +ifeq (sh.exe, $(SHELL)) +MSGFMT = set OLD_PO_FILE_INPUT=yes && $(GETTEXT_PATH)msgfmt -v +XGETTEXT = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)xgettext +MSGMERGE = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)msgmerge +else +MSGFMT = LANG=C OLD_PO_FILE_INPUT=yes $(GETTEXT_PATH)msgfmt -v +XGETTEXT = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)xgettext +MSGMERGE = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)msgmerge +endif +ifeq (sh.exe, $(SHELL)) MV = move CP = copy RM = del MKD = mkdir +else +MV = mv -f +CP = cp -f +RM = rm -f +MKD = mkdir -p +endif .SUFFIXES: .SUFFIXES: .po .mo .pot @@ -92,11 +139,11 @@ all: $(MOFILES) first_time: $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs $(wildcard ../globals.h) + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h ../vim.h $(LANGUAGES): $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs $(wildcard ../globals.h) + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h ../vim.h $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old @@ -108,6 +155,19 @@ install: $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES $(CP) $(LANGUAGE).mo $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo +ifeq (sh.exe, $(SHELL)) +install-all: all + FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l + FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES + FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo +else +install-all: all + for TARGET in $(LANGUAGES); do \ + $(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \ + $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ + done +endif + clean: $(RM) *.mo $(RM) *.pot diff --git a/src/po/Make_mvc.mak b/src/po/Make_mvc.mak index 32eecfe00a..0748bdf06b 100644 --- a/src/po/Make_mvc.mak +++ b/src/po/Make_mvc.mak @@ -6,10 +6,15 @@ # Please read README_mvc.txt before using this file. # +!ifndef VIMRUNTIME +VIMRUNTIME = ..\..\runtime +!endif + LANGUAGES = \ af \ ca \ cs \ + cs.cp1250 \ de \ en_GB \ eo \ @@ -19,16 +24,28 @@ LANGUAGES = \ ga \ it \ ja \ + ja.euc-jp \ + ja.sjis \ ko \ + ko.UTF-8 \ + nb \ + nl \ no \ pl \ + pl.cp1250 \ + pl.UTF-8 \ pt_BR \ ru \ + ru.cp1251 \ sk \ + sk.cp1250 \ + sr \ sv \ uk \ + uk.cp1251 \ vi \ zh_CN \ + zh_CN.cp936 \ zh_CN.UTF-8 \ zh_TW \ zh_TW.UTF-8 \ @@ -36,6 +53,7 @@ LANGUAGES = \ MOFILES = \ af.mo \ ca.mo \ + cs.cp1250.mo \ cs.mo \ de.mo \ en_GB.mo \ @@ -45,27 +63,39 @@ MOFILES = \ fr.mo \ ga.mo \ it.mo \ + ja.euc-jp.mo \ ja.mo \ + ja.sjis.mo \ ko.mo \ + ko.UTF-8.mo \ + nb.mo \ + nl.mo \ no.mo \ + pl.cp1250.mo \ pl.mo \ + pl.UTF-8.mo \ pt_BR.mo \ + ru.cp1251.mo \ ru.mo \ + sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ + uk.cp1251.mo \ uk.mo \ vi.mo \ - zh_CN.UTF-8.mo \ zh_CN.mo \ - zh_TW.UTF-8.mo \ + zh_CN.cp936.mo \ + zh_CN.UTF-8.mo \ zh_TW.mo \ + zh_TW.UTF-8.mo \ PACKAGE = vim # Correct the following line for the directory where gettext et al is installed GETTEXT_PATH = H:\gettext.0.14.4\bin -MSGFMT = $(GETTEXT_PATH)\msgfmt +MSGFMT = $(GETTEXT_PATH)\msgfmt -v XGETTEXT = $(GETTEXT_PATH)\xgettext MSGMERGE = $(GETTEXT_PATH)\msgmerge @@ -83,18 +113,23 @@ INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES .SUFFIXES: .po .mo .pot .po.mo: + set OLD_PO_FILE_INPUT=yes $(MSGFMT) -o $@ $< all: $(MOFILES) files: - $(LS) $(LSFLAGS) ..\*.c ..\if_perl.xs ..\globals.h > .\files + $(LS) $(LSFLAGS) ..\*.c ..\if_perl.xs ..\GvimExt\gvimext.cpp ..\globals.h ..\if_py_both.h ..\vim.h > .\files first_time: files - $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments --keyword=_ --keyword=N_ --files-from=.\files + set OLD_PO_FILE_INPUT=yes + set OLD_PO_FILE_OUTPUT=yes + $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 --files-from=.\files $(LANGUAGES): files - $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments --keyword=_ --keyword=N_ --files-from=.\files + set OLD_PO_FILE_INPUT=yes + set OLD_PO_FILE_OUTPUT=yes + $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 --files-from=.\files $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old @@ -105,6 +140,10 @@ install: if not exist $(INSTALLDIR) $(MKD) $(INSTALLDIR) $(CP) $(LANGUAGE).mo $(INSTALLDIR)\$(PACKAGE).mo +install-all: all + FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES + FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo + clean: $(RM) *.mo $(RM) *.pot diff --git a/src/po/Makefile b/src/po/Makefile index d9aa834574..386cb64433 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -22,6 +22,7 @@ LANGUAGES = \ ja \ ko \ ko.UTF-8 \ + lv \ nb \ nl \ no \ @@ -29,6 +30,7 @@ LANGUAGES = \ pt_BR \ ru \ sk \ + sr \ sv \ uk \ vi \ @@ -63,6 +65,7 @@ MOFILES = \ ja.mo \ ko.mo \ ko.UTF-8.mo \ + lv.mo \ nb.mo \ nl.mo \ no.mo \ @@ -70,6 +73,7 @@ MOFILES = \ pt_BR.mo \ ru.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.mo \ vi.mo \ @@ -111,6 +115,7 @@ CHECKFILES = \ pt_BR.ck \ ru.ck \ sk.ck \ + sr.ck \ sv.ck \ uk.ck \ vi.ck \ @@ -232,12 +237,13 @@ sk.cp1250.po: sk.po iconv -f iso-8859-2 -t cp1250 sk.po | \ sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po -# Convert zh_CN.po to create zh_CN.cp936.po. -# set 'charset' to gbk to avoid that msfmt generates a warning -zh_CN.cp936.po: zh_CN.po +# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po. +# Set 'charset' to gbk to avoid that msfmt generates a warning. +# This used to convert from zh_CN.po, but that results in a conversion error. +zh_CN.cp936.po: zh_CN.UTF-8.po rm -f zh_CN.cp936.po - iconv -f gb2312 -t cp936 zh_CN.po | \ - sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po + iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \ + sed -e 's/charset=utf-8/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' > zh_CN.cp936.po # Convert ko.UTF-8.po to create ko.po. ko.po: ko.UTF-8.po @@ -275,10 +281,10 @@ distclean: clean checkclean: rm -f *.ck -$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h +$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h ../vim.h cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ \ - *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ + *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h vim.h mv -f ../$(PACKAGE).po $(PACKAGE).pot update-po: $(LANGUAGES) diff --git a/src/po/README.txt b/src/po/README.txt index ae5b393932..60a7e0abcc 100644 --- a/src/po/README.txt +++ b/src/po/README.txt @@ -84,7 +84,13 @@ language. You should include your name and E-mail address instead, for example: msgstr "Berichten bersetzt bei: John Doe <john@doe.org>" -(3) Clean up +(3) Remove unused messages (optional) + Remove messages that have been marked as obsolete. + Such messages start with "#~". + + The cleanup script will also do that (see next step). + +(4) Clean up This is very important to make sure the translation works on all systems. Comment-out all non-translated strings. There are two types: - items marked with "#, fuzzy" @@ -100,8 +106,12 @@ language. messed up by changes in line numbers and show the actual changes in the text. -(4) Check: +(5) Check: + + While editing the .po file: + :source check.vim + From the command line: vim -S check.vim xx.po make xx.mo diff --git a/src/po/README_mingw.txt b/src/po/README_mingw.txt index 939a8f0e0f..805208228f 100644 --- a/src/po/README_mingw.txt +++ b/src/po/README_mingw.txt @@ -86,6 +86,9 @@ the same as in the Unix case, only the commands change): This will create the xx\LC_MESSAGES directory (if it does not exist) and will copy vim.po to it. + You can also use the following command to install all languages: + + make -f Make_ming.mak install-all (6) Another extra step ;-)). The command: diff --git a/src/po/README_mvc.txt b/src/po/README_mvc.txt index 3a47213f31..c63ad1fe81 100644 --- a/src/po/README_mvc.txt +++ b/src/po/README_mvc.txt @@ -111,6 +111,9 @@ Install your translation with the following command: This will create the xx\LC_MESSAGES directory in runtime\lang if it does not already exist. +You can also use the following command to install all languages: + + nmake -f make_mvc.mak install-all vim:tw=78: diff --git a/src/po/af.po b/src/po/af.po index d73660b6ed..0862e5d0d1 100644 --- a/src/po/af.po +++ b/src/po/af.po @@ -4719,8 +4719,8 @@ msgstr "tik :q<Enter> om program verlaat " msgid "type :help<Enter> or <F1> for on-line help" msgstr "tik :help<Enter> of <F1> vir aanlyn hulp " -msgid "type :help version7<Enter> for version info" -msgstr "tik :help version7<Enter> vir weergawe-inligting" +msgid "type :help version8<Enter> for version info" +msgstr "tik :help version8<Enter> vir weergawe-inligting" msgid "Running in Vi compatible mode" msgstr "Voer tans uit in Vi-versoenbare modus" diff --git a/src/po/ca.po b/src/po/ca.po index 741cfc1700..834749973e 100644 --- a/src/po/ca.po +++ b/src/po/ca.po @@ -1,28 +1,59 @@ # Catalan messages for vim. -# Copyright (C) 2003-2012 Ernest Adrogu <eadrogue@gmx.net>. +# Copyright (C) 2003-2017 Ernest Adrogu <eadrogue@gmx.net>. # This file is distributed under the Vim License. # msgid "" msgstr "" -"Project-Id-Version: vim 7.1\n" +"Project-Id-Version: vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-05-24 14:27+0200\n" -"PO-Revision-Date: 2008-06-06 14:40+0100\n" +"POT-Creation-Date: 2017-07-11 23:51+0200\n" +"PO-Revision-Date: 2017-07-26 13:29+0200\n" "Last-Translator: Ernest Adrogu <eadrogue@gmx.net>\n" "Language-Team: Catalan <ca@dodds.net>\n" +"Language: ca\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: s'ha cridat bf_key_init() amb una contrasenya buida" + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) != 4" + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: s de Blowfish amb una ordenaci dels bytes incorrecta" + +msgid "E818: sha256 test failed" +msgstr "E818: el test sha256 ha fallat" + +msgid "E819: Blowfish test failed" +msgstr "E819: el test Blowfish ha fallat" + +msgid "[Location List]" +msgstr "[Llista de posicions]" + +msgid "[Quickfix List]" +msgstr "[Llista Quickfix]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Una ordre automtica a provocat que l'ordre avorts" + msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: No s'ha pogut assignar memria per cap buffer, sortint..." +msgstr "E82: No s'ha pogut assignar memria per a cap buffer, sortint..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: No s'ha pogut assignar memria pel buffer, usant-ne un altre..." +msgstr "E83: No s'ha pogut assignar memria per al buffer, usant-ne un altre..." -# unload: Treu el buffer de la memria per el deixa a la llista -# delete: Treu el buffer de la memria i de la llista de buffers -# wipe out: Elimina el buffer amb totes les opcions, marques, etc. +msgid "E931: Buffer cannot be registered" +msgstr "E931: No s'ha pogut registrar el buffer" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Intent d'eliminar un buffer que es troba en s" + +# unload: treu el buffer de la memria per el deixa a la llista +# delete: treu el buffer de la memria i de la llista de buffers +# wipe out: elimina el buffer amb totes les opcions, marques, etc. msgid "E515: No buffers were unloaded" msgstr "E515: No s'ha alliberat cap buffer" @@ -53,17 +84,15 @@ msgstr "S'ha destru msgid "%d buffers wiped out" msgstr "S'han destrut %d buffers" +msgid "E90: Cannot unload last buffer" +msgstr "E90: No es pot alliberar l'ltim buffer" + msgid "E84: No modified buffer found" msgstr "E84: No s'ha trobat cap buffer modificat" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: No hi ha cap buffer a la llista" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: El buffer %ld no existeix" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: No es pot anar ms enll de l'ltim buffer" @@ -72,10 +101,7 @@ msgstr "E88: No es pot anar m #, c-format msgid "E89: No write since last change for buffer %ld (add ! to override)" -msgstr "E89: No s'ha desat el buffer %ld (afegiu ! per confirmar)" - -msgid "E90: Cannot unload last buffer" -msgstr "E90: No es pot alliberar l'ltim buffer" +msgstr "E89: No s'ha desat el buffer %ld (afegiu ! per a forar)" msgid "W14: Warning: List of file names overflow" msgstr "W14: Atenci: S'ha desbordat la llista de noms de fitxers" @@ -111,6 +137,10 @@ msgstr "[Fitxer nou]" msgid "[Read errors]" msgstr "[Errors de lectura]" +# ro == read only +msgid "[RO]" +msgstr "[NL]" + msgid "[readonly]" msgstr "[noms lectura]" @@ -129,7 +159,6 @@ msgstr "l msgid "[No Name]" msgstr "[Sense nom]" -#. must be a help buffer msgid "help" msgstr "ajuda" @@ -148,7 +177,6 @@ msgstr "Baix" msgid "Top" msgstr "Dalt" -#, c-format msgid "" "\n" "# Buffer list:\n" @@ -156,12 +184,11 @@ msgstr "" "\n" "# Llista de buffers:\n" -msgid "[Location List]" -msgstr "[Llista de posicions]" - -msgid "[Quickfix List]" -msgstr "[Llista Quickfix]" +# :h special-buffers +msgid "[Scratch]" +msgstr "[Esborrany]" +# :sign place msgid "" "\n" "--- Signs ---" @@ -169,25 +196,132 @@ msgstr "" "\n" "--- Senyals ---" +# :sign place #, c-format msgid "Signs for %s:" -msgstr "Senyals per a %s:" +msgstr "Senyals a %s:" +# :sign place #, c-format msgid " line=%ld id=%d name=%s" msgstr " lnia=%ld id=%d nom=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: No s'ha pogut connectar al port" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() a channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() a channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: s'ha rebut una ordre amb un argument que no s text" + +# expr i call sn ordres (:h channel-commands) +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: l'ltim argument a expr/call ha de ser un nmero" + +msgid "E904: third argument for call must be a list" +msgstr "E904: el tercer argument a call ha de ser una llista" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: s'ha rebut una ordre desconeguda: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): s'ha escrit sense estar connectat" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): l'escriptura ha fallat" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: No es poden utilitzar callbacks amb %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: no es pot usar ch_evalexpr()/ch_sendexpr() amb canals raw o nl" + +msgid "E906: not an open channel" +msgstr "E906: el canal no est obert" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: els fitxers _io han de tenir l'atribut _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: els buffers in_io han de tenir l'atribut in_buf o in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: el buffer no est carregat: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: El fitxer est xifrat amb un mtode desconegut" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Atenci: esteu utilitzant un xifrat poc potent; vegeu :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Introduu la clau de xifrat: " + +msgid "Enter same key again: " +msgstr "Introduu la mateixa clau un altre cop: " + +msgid "Keys don't match!" +msgstr "La claus no coincideixen!" + +msgid "[crypted]" +msgstr "[xifrat]" + +# :let foo = {1 2} +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Falta un carcter ':': %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Clau duplicada: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Falta una coma: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Falta un '}': %s" + +# :let foo = [1,2] +# :let bar = [3,4] +# :lockvar foo +# :echo extend(foo, bar) +# +# la forma fun() argument es repeteix ms avall +msgid "extend() argument" +msgstr "argument a extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: La clau ja existeix: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: No es poden mostrar diferncies amb ms de %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: No es pot fer diff amb ms de %ld buffers" + +msgid "E810: Cannot read or write temp files" +msgstr "E810: No s'han pogut escriure o llegir fitxers temporals" msgid "E97: Cannot create diffs" -msgstr "E97: No s'han pogut mostrar les diferncies" +msgstr "E97: No s'han pogut crear diffs" # s el nom d'un dileg. Men "Split patched by..." msgid "Patch file" msgstr "Fitxer de diferncies" +msgid "E816: Cannot read patch output" +msgstr "E816: No s'ha pogut llegir la sortida de patch" + msgid "E98: Cannot read diff output" msgstr "E98: No s'ha pogut llegir la sortida de diff" @@ -201,7 +335,7 @@ msgid "E100: No other buffer in diff mode" msgstr "E100: No hi ha cap altre buffer en mode diff" msgid "E101: More than two buffers in diff mode, don't know which one to use" -msgstr "E101: Hi ha ms de 2 buffers en mode diff, no se sap quin usar" +msgstr "E101: Hi ha ms de 2 buffers en mode diff" #, c-format msgid "E102: Can't find buffer \"%s\"" @@ -215,107 +349,102 @@ msgid "E787: Buffer changed unexpectedly" msgstr "E787: El buffer ha canviat inesperadament" msgid "E104: Escape not allowed in digraph" -msgstr "E104: No es permeten carcters d'escapada en un dgraf" +msgstr "E104: El dgraf cont carcters d'escapada" msgid "E544: Keymap file not found" msgstr "E544: No s'ha trobat el fitxer de mapa de tecles" -# traducci de sourced file. eac +# sourced file == script msgid "E105: Using :loadkeymap not in a sourced file" -msgstr "E105: L'ordre :loadkeymap noms es pot usar en fitxers" +msgstr "E105: s de :loadkeymap fora d'un script" msgid "E791: Empty keymap entry" -msgstr "E791: Entrada al mapa de tecles no cont res" +msgstr "E791: Entrada buida al mapa de tecles" -# buscar un nom, en lloc del verb completar. eac msgid " Keyword completion (^N^P)" msgstr " Compleci de paraules clau (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " Mode ^X (^]^D^E^F^|^K^L^N^O^Ps^U^V^Y)" -# buscar un nom, en lloc del verb completar. eac msgid " Whole line completion (^L^N^P)" msgstr " Compleci de lnies senceres (^L^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " File name completion (^F^N^P)" msgstr " Compleci de noms de fitxer (^F^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Tag completion (^]^N^P)" msgstr " Compleci d'etiquetes (^]^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Path pattern completion (^N^P)" msgstr " Compleci d'ubicacions (^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Definition completion (^D^N^P)" msgstr " Compleci de definicions (^D^N^P)" -# buscar un nom, en lloc del verb completar. eac +# todo: expecificar diccionari? msgid " Dictionary completion (^K^N^P)" -msgstr " Compleci de paraules de diccionari (^K^N^P)" +msgstr " Compleci de paraules (^K^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Thesaurus completion (^T^N^P)" msgstr " Compleci de sinnims (^T^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Command-line completion (^V^N^P)" -msgstr " Compleci d'ordres (^V^N^P)" +msgstr " Compleci de la lnia d'ordres (^V^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " User defined completion (^U^N^P)" msgstr " Compleci definida per l'usuari (^U^N^P)" -# buscar un nom, en lloc del verb completar. eac msgid " Omni completion (^O^N^P)" msgstr " Omni-compleci (^O^N^P)" msgid " Spelling suggestion (s^N^P)" -msgstr "Suggeriment ortogrfic (s^N^P)" +msgstr " Suggeriment d'ortografia (s^N^P)" -# buscar un nom, en lloc del verb completar. eac +# i C-x C-p msgid " Keyword Local completion (^N^P)" msgstr " Compleci de paraules clau locals (^N^P)" msgid "Hit end of paragraph" msgstr "S'ha arribat al final del pargraf" +msgid "E839: Completion function changed window" +msgstr "E839: La funci de compleci ha modificat la finestra" + +msgid "E840: Completion function deleted text" +msgstr "E840: La funci de compleci ha esborrat text" + msgid "'dictionary' option is empty" -msgstr "L'opci 'dictionary' no est definida" +msgstr "El parmetre 'dictionary' est en blanc" msgid "'thesaurus' option is empty" -msgstr "L'opci 'thesaurus' no est definida" +msgstr "El parmetre 'thesaurus' est en blanc" +# i C-x C-k #, c-format msgid "Scanning dictionary: %s" -msgstr "S'est examinant el diccionari: %s" +msgstr "Cercant al diccionari: %s" +# i C-x C-e msgid " (insert) Scroll (^E/^Y)" -msgstr " (inserir) Desplaar (^E/^Y)" +msgstr " (inserir) Desplaament (^E/^Y)" msgid " (replace) Scroll (^E/^Y)" -msgstr " (substituir) Desplaar (^E/^Y)" +msgstr " (substituir) Desplaament (^E/^Y)" #, c-format msgid "Scanning: %s" -msgstr "Examinant: %s" +msgstr "Cercant: %s" -#, c-format msgid "Scanning tags." -msgstr "Examinant les etiquetes." +msgstr "Cercant etiquetes." + +msgid "match in file" +msgstr "coincidncia al fitxer" msgid " Adding" msgstr " Afegint" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Cercant..." @@ -337,11 +466,7 @@ msgid "match %d" msgstr "coincidncia %d" msgid "E18: Unexpected characters in :let" -msgstr "E18: Carcters inesperats :let" - -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: ndex de llista fora d'abast: %ld" +msgstr "E18: Carcters inesperats a :let" #, c-format msgid "E121: Undefined variable: %s" @@ -350,124 +475,97 @@ msgstr "E121: Variable no definida: %s" msgid "E111: Missing ']'" msgstr "E111: Falta un ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: L'argument de %s ha de ser una llista" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: L'argument de %s ha de ser una llista o un diccionari" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Els diccionaris no admeten claus buides" - -msgid "E714: List required" -msgstr "E714: Es requereix una llista" - -msgid "E715: Dictionary required" -msgstr "E715: Es requereix un diccionari" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Massa arguments per a la funci: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: La clau no existeix al diccionari: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: La funci %s ja existeix, afegiu ! per substituir-la" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Ja existeix l'entrada al diccionari" - -msgid "E718: Funcref required" -msgstr "E718: Es requereix una referncia de funci" - +# :let foo={1: 2} +# :let foo[1:3]=0 msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: No es pot usar [:] amb un diccionari" +# :let foo += 1 #, c-format msgid "E734: Wrong variable type for %s=" msgstr "E734: Tipus de variable incorrecte per a %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Funci desconeguda: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: El nom de la variable s illegal: %s" +# semblant a eval.c:7120 i segents +msgid "E806: using Float as a String" +msgstr "E806: s de Float com a String" + +# :let [foo,bar] = [1] msgid "E687: Less targets than List items" -msgstr "E687: Hi ha menys valors objectiu que elements a la llista" +msgstr "E687: Menys valors per assignar que elements a la llista" +# :let [a,b]=[1,2,3] msgid "E688: More targets than List items" -msgstr "E688: Hi ha ms valors objectiu que elements a la llista" +msgstr "E688: Ms valors per assignar que elements a la llista" msgid "Double ; in list of variables" -msgstr "Doble ; a la llista de variables" +msgstr "La llista de variables cont un ; doble" #, c-format msgid "E738: Can't list variables for %s" -msgstr "E738: No es poden llistar les variables per a %s" +msgstr "E738: No s'han pogut mostrar les variables de tipus %s" msgid "E689: Can only index a List or Dictionary" -msgstr "E689: Noms admeten ndexs les llistes i els diccionaris" +msgstr "E689: Noms s possible indexar List i Dictionary" msgid "E708: [:] must come last" msgstr "E708: [:] ha d'anar al final" msgid "E709: [:] requires a List value" -msgstr "E709: [:] requereix un valor tipus llista" +msgstr "E709: [:] requereix un valor List" msgid "E710: List value has more items than target" -msgstr "E710: La llista t ms elements que valors objectiu" +msgstr "E710: La llista cont ms elements que valors per assignar" msgid "E711: List value has not enough items" -msgstr "E711: La llista no t prou elements" +msgstr "E711: La llista no cont prou elements" msgid "E690: Missing \"in\" after :for" msgstr "E690: Falta un \"in\" desprs de :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Falten claus '{}': %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: No existeix tal variable: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: No s'ha pogut bloquejar o desbloquejar la variable %s" + msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: variable est massa imbricada per a (des)bloquejar-la" +msgstr "E743: el nivell d'imbricaci de la variable s massa elevat" msgid "E109: Missing ':' after '?'" msgstr "E109: Falta un ':' desprs de '?'" msgid "E691: Can only compare List with List" -msgstr "E691: Una llista noms es pot comparar amb una llista" +msgstr "E691: List noms es pot comparar amb List" msgid "E692: Invalid operation for List" -msgstr "E692: Operaci no vlida en llistes" +msgstr "E692: Operaci no vlida amb llistes" msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Un diccionari noms es pot comparar amb un diccionari" +msgstr "E735: Dictionary noms es pot comparar amb Dictionary" msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Operaci no vlida en diccionaris" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Una referncia de funci noms es pot comparar amb una referncia de funci" +msgstr "E736: Operaci no vlida per a Dictionary" msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Operaci no vlida per a referncies de funcions" +msgstr "E694: Operaci no vlida per a Funcref" + +msgid "E804: Cannot use '%' with Float" +msgstr "E804: No s possible utilitzar '%' amb Float" msgid "E110: Missing ')'" msgstr "E110: Falta un ')'" msgid "E695: Cannot index a Funcref" -msgstr "E695: No es pot indexar una referncia de funci" +msgstr "E695: No s possible indexar Funcref" + +msgid "E909: Cannot index a special variable" +msgstr "E909: Les variables especials no sn indexables" #, c-format msgid "E112: Option name missing: %s" @@ -485,75 +583,139 @@ msgstr "E114: Falten cometes: %s" msgid "E115: Missing quote: %s" msgstr "E115: Falten cometes: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Falta una coma a la llista: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "No hi ha prou memria, s'avorta el collector de brossa!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Falta un final de llista ']': %s" +# veure eval.c:2935 +msgid "E724: variable nested too deep for displaying" +msgstr "E724: el nivell d'imbricaci de la variable s massa elevat" + +msgid "E805: Using a Float as a Number" +msgstr "E805: s de Float com a Number" + +msgid "E703: Using a Funcref as a Number" +msgstr "E703: s de Funcref com a Number" + +msgid "E745: Using a List as a Number" +msgstr "E745: s de List com a Number" + +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: s de Dictionary com a Number" + +msgid "E910: Using a Job as a Number" +msgstr "E910: s de Job com a Number" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: s de Channel com a Number" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: s de Funcref com a Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: s de String com a Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: s de List com a Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: s de Dictionary com a Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: s de Special com a Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: s de Job com a Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: s de Channel com a Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: s de Funcref com a String" + +msgid "E730: using List as a String" +msgstr "E730: s de List com a String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: s de Dictionary com a String" + +msgid "E908: using an invalid value as a String" +msgstr "E908: s d'un valor invlid com a String" #, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Falta un carcter de dos punts al diccionari: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: No s'ha pogut eliminar la variable %s" #, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Clau duplicada al diccionari: \"%s\"" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Les variables Funcref han de comenar amb majscula: %s" #, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Falta una coma al diccionari: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: La variable entra en conflicte amb una funci existent: %s" #, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Falta un final de diccionari '}': %s" +msgid "E741: Value is locked: %s" +msgstr "E741: El valor est bloquejat: %s" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: variable imbricada massa profundament per a mostrar-la" +msgid "Unknown" +msgstr "Desconegut" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Funci desconeguda: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: No s'ha pogut canviar el valor de %s" -#, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Falten arguments per a la funci: %s" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: el nivell d'imbricaci de la variable s massa elevat" -#, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: s de <SID> en un context no vlid: %s" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# variables globals:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tDefinit per ltim cop a " + +msgid "map() argument" +msgstr "argument a map()" + +msgid "filter() argument" +msgstr "argument a filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Crida a una funci dict sense diccionari: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: L'argument a %s ha de ser List" -msgid "E699: Too many arguments" -msgstr "E699: Sobren arguments" +msgid "E928: String required" +msgstr "E928: Es necessita String" + +msgid "E808: Number or Float required" +msgstr "E808: Es necessita Number o Float" + +msgid "add() argument" +msgstr "argument a add()" msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() noms es pot utilitzar en el mode d'inserci" +msgstr "E785: complete() noms es pot utilitzar en mode d'inserci" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. msgid "&Ok" msgstr "&D'acord" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: La clau ja existeix: %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld lnies: " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Funci desconeguda: %s" +msgid "E922: expected a dict" +msgstr "E922: s'esperava un diccionari" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: El segon argument a function() ha de ser una llista o diccionari" + msgid "" "&OK\n" "&Cancel" @@ -564,25 +726,34 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "s'ha cridat inputrestore() ms sovint que inputsave()" +msgid "insert() argument" +msgstr "argument a insert()" + msgid "E786: Range not allowed" msgstr "E786: Interval no perms" +msgid "E916: not a valid job" +msgstr "E916: no s una feina vlida" + msgid "E701: Invalid type for len()" -msgstr "E701: El tipus per a len() no s vlid" +msgstr "E701: Tipus invlid per a len()" + +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID reservat per a \":match\": %ld" msgid "E726: Stride is zero" -msgstr "E726: L'increment entre passos s zero" +msgstr "E726: L'increment s zero" msgid "E727: Start past end" -msgstr "E727: Inici ms enll del final" +msgstr "E727: Inici desprs del final" msgid "<empty>" msgstr "<buit>" -msgid "E240: No connection to Vim server" -msgstr "E240: No hi ha connexi amb el servidor Vim" +msgid "E240: No connection to the X server" +msgstr "E240: No hi ha connexi amb el servidor X" -# res ? eac #, c-format msgid "E241: Unable to send to %s" msgstr "E241: No s'ha pogut enviar a %s" @@ -590,304 +761,84 @@ msgstr "E241: No s'ha pogut enviar a %s" msgid "E277: Unable to read a server reply" msgstr "E277: No s'ha pogut llegir la resposta del servidor" +msgid "E941: already started a server" +msgstr "E941: ja s'ha iniciat un servidor" + +msgid "E942: +clientserver feature not available" +msgstr "E942: la caracterstica +clientserver no est disponible" + +msgid "remove() argument" +msgstr "argument a remove()" + msgid "E655: Too many symbolic links (cycle?)" msgstr "E655: Massa enllaos simblics (circulars?)" -# res ? eac +msgid "reverse() argument" +msgstr "argument a reverse()" + msgid "E258: Unable to send to client" msgstr "E258: No s'ha pogut enviar al client" +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Acci invlida: '%s'" + +msgid "sort() argument" +msgstr "argument a sort()" + +msgid "uniq() argument" +msgstr "argument a uniq()" + msgid "E702: Sort compare function failed" -msgstr "E702: La funci ordena-compara ha fallat" +msgstr "E702: La funci de comparaci a sort() ha fallat" + +msgid "E882: Uniq compare function failed" +msgstr "E882: La funci de comparaci a unique() ha fallat" msgid "(Invalid)" msgstr "(No vlid)" +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: referncia invlida a una coincidncia: %d" + msgid "E677: Error writing temp file" msgstr "E677: Error en escriure el fitxer temporal" -msgid "E703: Using a Funcref as a Number" -msgstr "E703: s d'una referncia de funci com a nmero" +msgid "E921: Invalid callback argument" +msgstr "E921: L'argument del callback no s vlid" -msgid "E745: Using a List as a Number" -msgstr "E745: s d'una llista com a nmero" +# E.G: :ascii +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: s d'un diccionari com a nmero" +# E.G: :ascii +#, c-format +msgid "> %d, Hex %04x, Octal %o" +msgstr "> %d, Hex %04x, Octal %o" -msgid "E729: using Funcref as a String" -msgstr "E729: s d'una referncia de funci com a cadena" +# E.G: :ascii +#, c-format +msgid "> %d, Hex %08x, Octal %o" +msgstr "> %d, Hex %08x, Octal %o" -msgid "E730: using List as a String" -msgstr "E730: s d'una llista com a cadena" +msgid "E134: Move lines into themselves" +msgstr "E134: No es poden moure lnies cap a elles mateixes" -msgid "E731: using Dictionary as a String" -msgstr "E731: s d'un diccionari com a cadena" +msgid "1 line moved" +msgstr "1 lnia desplaada" #, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: El nom d'una variable Funcref ha de comenar en majscula: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: El nom de la variable entra en conflicte amb una funci existent: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Tipus de variables no coincidents: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: No s'ha pogut eliminar la variable %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: El valor est bloquejat: %s" - -msgid "Unknown" -msgstr "Desconegut" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: No s'ha pogut canviar el valor de %s" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: la variable est massa imbricada per fer-ne una cpia" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Falta un '(': %s" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Argument illegal: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: Falta un :endfunction" - -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: El nom de la funci no coincideix amb el nom de l'script: %s" - -msgid "E129: Function name required" -msgstr "E129: Es necessita un nom de funci" - -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: El nom de la funci ha de comenar en majscula o contenir dos punts: %s" - -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: No s'ha pogut eliminar la funci %s: S'est utilitzant" - -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Profunditat de crides a funcions superior a 'maxfuncdeptg'" - -#, c-format -msgid "calling %s" -msgstr "cridant %s" - -#, c-format -msgid "%s aborted" -msgstr "s'ha avortat %s" - -#, c-format -msgid "%s returning #%ld" -msgstr "%s ha retornat #%ld" - -#, c-format -msgid "%s returning %s" -msgstr "%s ha retornat \"%s\"" - -#, c-format -msgid "continuing in %s" -msgstr "continuant a %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return fora d'una funci" - -#, c-format -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# variables globals:\n" - -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tDefinit per ltim cop a " - -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "Entrant en mode de depuraci. Escriviu \"cont\" per a continuar." - -#, c-format -msgid "line %ld: %s" -msgstr "lnia %ld: %s" - -#, c-format -msgid "cmd: %s" -msgstr "ordre: %s" - -#, c-format -msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Punt de ruptura a \"%s%s\" lnia %ld" - -#, c-format -msgid "E161: Breakpoint not found: %s" -msgstr "E161: Punt de ruptura no trobat: %s" - -msgid "No breakpoints defined" -msgstr "No s'han definit punts de ruptura" - -#, c-format -msgid "%3d %s %s line %ld" -msgstr "%3d %s %s lnia %ld" - -msgid "E750: First use :profile start <fname>" -msgstr "E750: Primer useu :profile start <nomfitxer>" - -# Ttol d'un dileg [:browse w]. eac -msgid "Save As" -msgstr "Anomena i desa" - -#, c-format -msgid "Save changes to \"%s\"?" -msgstr "Voleu desar els canvis a \"%s\"?" - -msgid "Untitled" -msgstr "Sense-nom" - -#, c-format -msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: No s'han desat els canvis en el buffer \"%s\"" - -msgid "Warning: Entered other buffer unexpectedly (check autocommands)" -msgstr "Atenci: S'ha canviat de buffer inesperadament (reviseu les auto-ordres)" - -msgid "E163: There is only one file to edit" -msgstr "E163: Noms hi ha un fitxer per editar" - -msgid "E164: Cannot go before first file" -msgstr "E164: No es pot anar ms enll del primer fitxer" - -msgid "E165: Cannot go beyond last file" -msgstr "E165: No es pot anar ms enll de l'ltim fitxer" - -#, c-format -msgid "E666: compiler not supported: %s" -msgstr "E666: el compilador no est suportat: %s" - -#, c-format -msgid "Searching for \"%s\" in \"%s\"" -msgstr "Cercant \"%s\" a \"%s\"" - -#, c-format -msgid "Searching for \"%s\"" -msgstr "Cercant \"%s\"" - -# runtimepath. eac -#, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "no s'ha trobat en el 'runtimepath': \"%s\"" - -# Ttol d'un dileg [:browse source]. eac -msgid "Source Vim script" -msgstr "Interpreta un script Vim" - -#, c-format -msgid "Cannot source a directory: \"%s\"" -msgstr "No es pot interpretar un directori: \"%s\"" - -#, c-format -msgid "could not source \"%s\"" -msgstr "no s'ha pogut interpretar \"%s\"" - -#, c-format -msgid "line %ld: could not source \"%s\"" -msgstr "lnia %ld: no s'ha pogut interpretar \"%s\"" - -#, c-format -msgid "sourcing \"%s\"" -msgstr "interpretant \"%s\"" - -#, c-format -msgid "line %ld: sourcing \"%s\"" -msgstr "lnia %ld: interpretant \"%s\"" - -#, c-format -msgid "finished sourcing %s" -msgstr "ha finalitzat l'interpretaci de %s" - -msgid "modeline" -msgstr "modeline" - -msgid "--cmd argument" -msgstr "--cmd argument" - -msgid "-c argument" -msgstr "-c argument" - -msgid "environment variable" -msgstr "variable d'entorn" - -msgid "error handler" -msgstr "gestor d'errors" - -msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Atenci: El separador de lnia no s vlid, potser falta un ^M" - -# sourced file. eac -msgid "E167: :scriptencoding used outside of a sourced file" -msgstr "E167: L'ordre :scriptencoding noms es pot utilitzar en scripts" - -# sourced file. eac -msgid "E168: :finish used outside of a sourced file" -msgstr "E168: L'ordre :finish noms es pot utilitzar en scripts" - -# les cadenes substitudes no es poden tradur. eac -#, c-format -msgid "Current %slanguage: \"%s\"" -msgstr "Idioma actual ( %s): \"%s\"" - -#, c-format -msgid "E197: Cannot set language to \"%s\"" -msgstr "E197: No s'ha pogut canviar l'idioma a \"%s\"" - -# E.G: :ascii -#, c-format -msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" - -# E.G: :ascii -#, c-format -msgid "> %d, Hex %04x, Octal %o" -msgstr "> %d, Hex %04x, Octal %o" - -# E.G: :ascii -#, c-format -msgid "> %d, Hex %08x, Octal %o" -msgstr "> %d, Hex %08x, Octal %o" - -msgid "E134: Move lines into themselves" -msgstr "E134: No es poden moure lnies cap a elles mateixes" - -msgid "1 line moved" -msgstr "1 lnia desplaada" - -#, c-format -msgid "%ld lines moved" -msgstr "%ld lnies desplaades" +msgid "%ld lines moved" +msgstr "%ld lnies desplaades" #, c-format msgid "%ld lines filtered" msgstr "%ld lnies filtrades" msgid "E135: *Filter* Autocommands must not change current buffer" -msgstr "E135: Les auto-ordres *Filter* no poden canviar el buffer actual" +msgstr "E135: Les ordres automtiques *Filter* han de no modificar el buffer" msgid "[No write since last change]\n" msgstr "[No s'han desat els ltims canvis]\n" @@ -899,25 +850,31 @@ msgstr "%sviminfo: %s a la l msgid "E136: viminfo: Too many errors, skipping rest of file" msgstr "E136: viminfo: Hi ha massa errors, s'omet la resta del fitxer" -# les tres segents van juntes. eac +# vim -V5 #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" msgstr "Llegint el fitxer viminfo \"%s\"%s%s%s" msgid " info" -msgstr " per info" +msgstr " / info" msgid " marks" -msgstr " per marques" +msgstr " / marques" + +msgid " oldfiles" +msgstr " / fitxers vells" msgid " FAILED" msgstr " ERROR" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: El fitxer viminfo no s modificable: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Massa fitxers viminfo temporals, anomenats %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: No s'ha pogut escriure el fitxer viminfo %s!" @@ -926,12 +883,14 @@ msgstr "E138: No s'ha pogut escriure el fitxer viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Escrivint el fitxer viminfo \"%s\"" -#. Write the info: #, c-format -msgid "# This viminfo file was generated by Vim %s.\n" -msgstr "# Aquest fitxer viminfo ha estat generat pel Vim %s.\n" +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: No s'ha pogut reanomenar el fitxer viminfo a %s!" #, c-format +msgid "# This viminfo file was generated by Vim %s.\n" +msgstr "# Aquest fitxer viminfo ha estat generat per Vim %s.\n" + msgid "" "# You may edit it if you're careful!\n" "\n" @@ -939,22 +898,31 @@ msgstr "" "# El podeu editar si aneu amb compte!\n" "\n" -#, c-format msgid "# Value of 'encoding' when this file was written\n" msgstr "# Valor de 'encoding' en el moment d'escriure aquest fitxer\n" msgid "Illegal starting char" msgstr "Carcter inicial illegal" +# viminfo +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "\n# Lnies copiades literalment sense modificar:\n" + +# GUI :browse w +msgid "Save As" +msgstr "Anomena i desa" + msgid "Write partial file?" msgstr "Voleu escriure un fitxer parcial?" msgid "E140: Use ! to write partial buffer" -msgstr "E140: Useu ! per desar una part del buffer" +msgstr "E140: Useu ! per a desar una part del buffer" #, c-format msgid "Overwrite existing file \"%s\"?" -msgstr "Voleu sobrescriure el fitxer existent \"%s\"?" +msgstr "Voleu sobreescriure el fitxer existent \"%s\"?" #, c-format msgid "Swap file \"%s\" exists, overwrite anyway?" @@ -962,44 +930,57 @@ msgstr "El fitxer d'intercanvi \"%s\" existeix, sobreescriure igualment?" #, c-format msgid "E768: Swap file exists: %s (:silent! overrides)" -msgstr "E768: El fitxer d'intercanvi existeix: %s (:silent! per a confirmar)" +msgstr "E768: El fitxer d'intercanvi existeix: %s (:silent! per a forar)" #, c-format msgid "E141: No file name for buffer %ld" msgstr "E141: No hi ha nom de fitxer per al buffer %ld" msgid "E142: File not written: Writing is disabled by 'write' option" -msgstr "E142: No s'ha escrit el fitxer: L'opci 'write' ho impedeix" +msgstr "E142: No s'ha escrit el fitxer: El parmetre 'write' ho impedeix" #, c-format msgid "" "'readonly' option is set for \"%s\".\n" "Do you wish to write anyway?" msgstr "" -"L'opci 'readonly' est definida per a \"%s\".\n" +"S'ha establert l'opci 'readonly' per a \"%s\".\n" "Voleu escriure de totes maneres?" -# s un ttol de dileg [:browse edit]. eac +#, c-format +msgid "" +"File permissions of \"%s\" are read-only.\n" +"It may still be possible to write it.\n" +"Do you wish to try?" +msgstr "" +"El fitxer \"%s\" s de noms lectura.\n" +"Tot i aix pot ser possible escriure-hi.\n" +"Voleu intentar-ho?" + +#, c-format +msgid "E505: \"%s\" is read-only (add ! to override)" +msgstr "E505: \"%s\" s de noms lectura (afegiu ! per a forar)" + +# :browse edit msgid "Edit File" msgstr "Edita un fitxer" #, c-format msgid "E143: Autocommands unexpectedly deleted new buffer %s" -msgstr "E143: Una auto-ordre ha eliminat el buffer nou %s inesperadament" +msgstr "E143: Una ordre automtica ha eliminat el nou buffer %s" msgid "E144: non-numeric argument to :z" -msgstr "E144: Argument no numric per a :z" +msgstr "E144: Argument no numric a :z" msgid "E145: Shell commands not allowed in rvim" -msgstr "E145: Les ordres shell no estan permeses en l'rvim" +msgstr "E145: El mode restringit no permet executar ordres de l'intrpret" msgid "E146: Regular expressions can't be delimited by letters" -msgstr "E146: Les expressions regulars no poden estar delimitades per lletres" +msgstr "E146: Expressions regulars delimitades amb carcters alfabtics" -# amb o per + tecles. eac #, c-format msgid "replace with %s (y/n/a/q/l/^E/^Y)?" -msgstr "substituir amb %s (y/n/a/q/l/^E/^Y)?" +msgstr "substituir per %s (y/n/a/q/l/^E/^Y)?" msgid "(Interrupted) " msgstr "(Interromput) " @@ -1025,17 +1006,21 @@ msgstr " en 1 l msgid " on %ld lines" msgstr " en %ld lnies" -msgid "E147: Cannot do :global recursive" -msgstr "E147: No es pot executar una ordre global de forma recursiva" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: No s possible usar :global recursivament amb un interval" +# :g msgid "E148: Regular expression missing from global" -msgstr "E148: Les ordres globals requereixen una expressi regular" +msgstr "E148: Falta una expressi regular a :global" #, c-format msgid "Pattern found in every line: %s" -msgstr "S'ha trobat el patr a cada lnia: %s" +msgstr "El patr apareix a totes les lnies: %s" #, c-format +msgid "Pattern not found: %s" +msgstr "No s'ha trobat el patr: %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -1046,80 +1031,243 @@ msgstr "" "$" msgid "E478: Don't panic!" -msgstr "E478: Calma!" +msgstr "E478: Mantingueu la calma!" #, c-format msgid "E661: Sorry, no '%s' help for %s" -msgstr "E661: No hi ha ajuda en '%s' per a %s" +msgstr "E661: No hi ha ajuda en '%s' sobre %s" +# :h zzzzzzzzz #, c-format msgid "E149: Sorry, no help for %s" -msgstr "E149: No hi ha ajuda per %s" +msgstr "E149: No hi ha ajuda sobre %s" #, c-format msgid "Sorry, help file \"%s\" not found" -msgstr "El fitxer d'ajuda \"%s\" no s'ha trobat" +msgstr "No s'ha trobat el fitxer d'ajuda \"%s\"" + +#, c-format +msgid "E151: No match: %s" +msgstr "E151: Cap coincidncia: %s" + +#, c-format +msgid "E152: Cannot open %s for writing" +msgstr "E152: No es obrir %s per a escriptura" + +#, c-format +msgid "E153: Unable to open %s for reading" +msgstr "E153: No es pot obrir %s per a lectura" + +#, c-format +msgid "E670: Mix of help file encodings within a language: %s" +msgstr "E670: Fitxers d'ajuda amb codificacions heterognies: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: L'etiqueta \"%s\" est duplicada en el fitxer %s/%s" #, c-format msgid "E150: Not a directory: %s" msgstr "E150: No s un directori: %s" #, c-format -msgid "E152: Cannot open %s for writing" -msgstr "E152: No s'ha pogut obrir %s amb perms d'escriptura" +msgid "E160: Unknown sign command: %s" +msgstr "E160: Ordre de senyals desconeguda: %s" + +msgid "E156: Missing sign name" +msgstr "E156: Falta el nom del senyal" + +msgid "E612: Too many signs defined" +msgstr "E612: S'han definit massa senyals" + +#, c-format +msgid "E239: Invalid sign text: %s" +msgstr "E239: El text del senyal no s vlid: %s" + +#, c-format +msgid "E155: Unknown sign: %s" +msgstr "E155: El senyal s desconegut: %s" + +msgid "E159: Missing sign number" +msgstr "E159: Falta el nmero del senyal" + +#, c-format +msgid "E158: Invalid buffer name: %s" +msgstr "E158: El nom del buffer no s vlid: %s" + +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: No s possible saltar a un buffer que no t nom" + +#, c-format +msgid "E157: Invalid sign ID: %ld" +msgstr "E157: L'ID del senyal no s vlid: %ld" + +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: No s possible canviar el senyal %s" + +msgid " (NOT FOUND)" +msgstr " (NO TROBAT)" + +msgid " (not supported)" +msgstr " (no suportat)" + +msgid "[Deleted]" +msgstr "[Eliminat]" + +msgid "No old files" +msgstr "No hi ha fitxers antics" + +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "Mode de depuraci. Escriviu \"cont\" per a continuar." + +#, c-format +msgid "line %ld: %s" +msgstr "lnia %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "ordre: %s" + +msgid "frame is zero" +msgstr "el marc s zero" + +#, c-format +msgid "frame at highest level: %d" +msgstr "marc al nivell mxim: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "Punt de ruptura a \"%s%s\" lnia %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: Punt de ruptura no trobat: %s" + +msgid "No breakpoints defined" +msgstr "No s'han definit punts de ruptura" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s lnia %ld" + +msgid "E750: First use \":profile start {fname}\"" +msgstr "E750: Primer feu \":profile start {nomfitxer}\"" + +#, c-format +msgid "Save changes to \"%s\"?" +msgstr "Voleu desar els canvis a \"%s\"?" + +msgid "Untitled" +msgstr "Sense-nom" + +#, c-format +msgid "E162: No write since last change for buffer \"%s\"" +msgstr "E162: No s'han desat els canvis en el buffer \"%s\"" + +msgid "Warning: Entered other buffer unexpectedly (check autocommands)" +msgstr "Atenci: S'ha canviat de buffer (reviseu les ordres automtiques)" + +msgid "E163: There is only one file to edit" +msgstr "E163: Noms hi ha un fitxer per editar" + +msgid "E164: Cannot go before first file" +msgstr "E164: No es pot anar ms enll del primer fitxer" + +msgid "E165: Cannot go beyond last file" +msgstr "E165: No es pot anar ms enll de l'ltim fitxer" + +#, c-format +msgid "E666: compiler not supported: %s" +msgstr "E666: el compilador no est suportat: %s" + +#, c-format +msgid "Searching for \"%s\" in \"%s\"" +msgstr "Cercant \"%s\" a \"%s\"" + +#, c-format +msgid "Searching for \"%s\"" +msgstr "Cercant \"%s\"" + +#, c-format +msgid "not found in '%s': \"%s\"" +msgstr "no s'ha trobat a '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: la versi 2.x de Python est suportada, s'ignora: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: La versi 3.x de Python no est suportada, s'ignora: %s" + +# :browse source +msgid "Source Vim script" +msgstr "Executa un script Vim" + +#, c-format +msgid "Cannot source a directory: \"%s\"" +msgstr "No s possible executar un directori: \"%s\"" + +#, c-format +msgid "could not source \"%s\"" +msgstr "no s'ha pogut executar \"%s\"" + +#, c-format +msgid "line %ld: could not source \"%s\"" +msgstr "lnia %ld: no s'ha pogut executar \"%s\"" #, c-format -msgid "E153: Unable to open %s for reading" -msgstr "E153: No s'ha pogut obrir %s amb perms de lectura" +msgid "sourcing \"%s\"" +msgstr "executant \"%s\"" #, c-format -msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: Conjunts de carcters diferents dins del mateix idioma: %s" +msgid "line %ld: sourcing \"%s\"" +msgstr "lnia %ld: executant \"%s\"" #, c-format -msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: L'etiqueta \"%s\" est duplicada en el fitxer %s/%s" +msgid "finished sourcing %s" +msgstr "ha finalitzat l'execuci de %s" #, c-format -msgid "E160: Unknown sign command: %s" -msgstr "E160: Ordre de senyalitzaci desconeguda: %s" +msgid "continuing in %s" +msgstr "continuant a %s" -msgid "E156: Missing sign name" -msgstr "E156: Falta el nom del senyal" +msgid "modeline" +msgstr "lnia de mode" -msgid "E612: Too many signs defined" -msgstr "E612: S'han definit massa senyals" +msgid "--cmd argument" +msgstr "argument --cmd" -#, c-format -msgid "E239: Invalid sign text: %s" -msgstr "E239: El text del senyal no s vlid: %s" +msgid "-c argument" +msgstr "argument -c" -#, c-format -msgid "E155: Unknown sign: %s" -msgstr "E155: El senyal s desconegut: %s" +msgid "environment variable" +msgstr "variable d'entorn" -msgid "E159: Missing sign number" -msgstr "E159: Falta el nmero del senyal" +# todo: handler +msgid "error handler" +msgstr "conductor d'errors" -#, c-format -msgid "E158: Invalid buffer name: %s" -msgstr "E158: El nom del buffer no s vlid: %s" +msgid "W15: Warning: Wrong line separator, ^M may be missing" +msgstr "W15: Atenci: Separador de lnia incorrecte, potser falta un ^M" -#, c-format -msgid "E157: Invalid sign ID: %ld" -msgstr "E157: L'ID del senyal no s vlida: %ld" +msgid "E167: :scriptencoding used outside of a sourced file" +msgstr "E167: s de :scriptencoding fora d'un script" -msgid " (NOT FOUND)" -msgstr " (NO TROBAT)" +msgid "E168: :finish used outside of a sourced file" +msgstr "E168: s de :finish fora d'un script" -msgid " (not supported)" -msgstr " (no suportat)" +#, c-format +msgid "Current %slanguage: \"%s\"" +msgstr "Idioma actual ( %s): \"%s\"" -msgid "[Deleted]" -msgstr "[Eliminat]" +#, c-format +msgid "E197: Cannot set language to \"%s\"" +msgstr "E197: No s'ha pogut canviar l'idioma a \"%s\"" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Mode Ex. Escriviu \"visual\" per tornar al mode Normal." +msgstr "Mode Ex. Escriviu \"visual\" per a tornar al mode Normal." msgid "E501: At end-of-file" msgstr "E501: Final del fitxer" @@ -1132,7 +1280,7 @@ msgid "E605: Exception not caught: %s" msgstr "E605: No s'ha interceptat l'excepci: %s" msgid "End of sourced file" -msgstr "Final del fitxer interpretat" +msgstr "Final de l'script" msgid "End of function" msgstr "Final de la funci" @@ -1141,30 +1289,33 @@ msgid "E464: Ambiguous use of user-defined command" msgstr "E464: s ambigu d'una ordre definida per l'usuari" msgid "E492: Not an editor command" -msgstr "E492: No s una ordre d'edici" +msgstr "E492: No s una ordre de l'editor" msgid "E493: Backwards range given" -msgstr "E493: Heu especificat un interval decreixent" +msgstr "E493: Interval decreixent" -# s una pregunta. eac +# s una pregunta. msgid "Backwards range given, OK to swap" -msgstr "Heu especificat un interval decreixent. El voleu invertir" +msgstr "Interval decreixent. El voleu invertir" msgid "E494: Use w or w>>" msgstr "E494: Useu w o b w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: La taula d'ordres s'ha d'actualitzar, executeu 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Aquesta ordre no est disponible en aquesta versi" msgid "E172: Only one file name allowed" -msgstr "E172: Noms est perms un nom de fitxer" +msgstr "E172: Noms podeu especificar un nom de fitxer" msgid "1 more file to edit. Quit anyway?" -msgstr "Queda 1 fitxer per editar. Voleu sortir de totes maneres?" +msgstr "Queda 1 fitxer per editar. Voleu sortir de totes maneres?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "Queden %d fitxers per editar. Voleu sortir de totes maneres?" +msgstr "Queden %d fitxers per editar. Voleu sortir de totes maneres?" msgid "E173: 1 more file to edit" msgstr "E173: Queda 1 fitxer per editar" @@ -1174,14 +1325,14 @@ msgid "E173: %ld more files to edit" msgstr "E173: Queden %ld fitxers per editar" msgid "E174: Command already exists: add ! to replace it" -msgstr "E174: L'ordre ja existeix: afegiu ! per substituir-la" +msgstr "E174: L'ordre ja existeix: afegiu ! per a substituir-la" +# :command +# <l><l><l><l><l> msgid "" "\n" -" Name Args Range Complete Definition" -msgstr "" -"\n" -" Nom Args Abast Completar Definici" +" Name Args Address Complete Definition" +msgstr "\n Nom Arguments Adrea Compleci Definici " msgid "No user-defined commands found" msgstr "No s'han trobat ordres definides per l'usuari" @@ -1193,15 +1344,19 @@ msgid "E176: Invalid number of arguments" msgstr "E176: El nombre d'arguments no s vlid" msgid "E177: Count cannot be specified twice" -msgstr "E177: El comptador no es pot especificar dos cops" +msgstr "E177: El parmetre de quantitat no es pot especificar dos cops" msgid "E178: Invalid default value for count" -msgstr "E178: El valor per omissi del comptador no s vlid" +msgstr "E178: El valor per omissi del parmetre de quantitat no s vlid" -# completar eac +# :command -complete Echo :echo "foo" msgid "E179: argument required for -complete" -msgstr "E179: -complete requereix un argument" +msgstr "E179: l'atribut -complete requereix un argument" +msgid "E179: argument required for -addr" +msgstr "E179: l'atribut -addr requereix un argument" + +# :command -foo Foo :echo "bar" #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: L'atribut no s vlid: %s" @@ -1210,39 +1365,48 @@ msgid "E182: Invalid command name" msgstr "E182: El nom de l'ordre no s vlid" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: Les ordres definides per l'usuari han de comenar en majscula" +msgstr "E183: Les ordres definides per l'usuari han de comenar amb majscula" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: Nom reservat, no es pot usar com a ordre definida per l'usuari" #, c-format msgid "E184: No such user-defined command: %s" msgstr "E184: No existeix tal ordre definida per l'usuari: %s" -# completar eac +# :command -addr=foo Bar :echo "bar" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: El tipus d'adrea no s vlid: %s" + #, c-format msgid "E180: Invalid complete value: %s" -msgstr "E180: El valor per la funci completar no s vlid: %s" +msgstr "E180: El tipus de compleci no s vlid: %s" -# completar eac msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: L'argument de completar noms est perms en esquemes personalitzats" +msgstr "E468: La compleci estndard no admet arguments" -# completar eac msgid "E467: Custom completion requires a function argument" -msgstr "E467: Els esquemes de completar requereixen una funci com a argument" +msgstr "E467: La compleci no estndard requereix una funci com a argument" + +# esquema de colors +msgid "unknown" +msgstr "desconegut" #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: No s'ha trobat l'esquema de colors %s" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: No s'ha trobat l'esquema de colors '%s'" msgid "Greetings, Vim user!" msgstr "Salutacions, usuari de Vim!" msgid "E784: Cannot close last tab page" -msgstr "E784: No es pot tancar l'ltima pestanya" +msgstr "E784: No s possible tancar l'ltima pestanya" msgid "Already only one tab page" msgstr "Noms hi ha una pestanya" -# Ttol d'un dileg [:browse split] eac +# :browse split msgid "Edit File in new window" msgstr "Edita un fitxer en una finestra nova" @@ -1251,14 +1415,14 @@ msgid "Tab page %d" msgstr "Pestanya %d" msgid "No swap file" -msgstr "No hi ha fitxer d'intercanvi" +msgstr "No existeix cap fitxer d'intercanvi" -# s un ttol d'un dileg [:browse read] eac +# :browse read msgid "Append File" msgstr "Afegeix un fitxer" -msgid "E747: Cannot change directory, buffer is modifed (add ! to override)" -msgstr "E747: No es pot canviar de directori, el buffer ha estat modificat (afegiu ! per confirmar)" +msgid "E747: Cannot change directory, buffer is modified (add ! to override)" +msgstr "E747: Buffer modificat, no es canvia de directori (! per a forar)" msgid "E186: No previous directory" msgstr "E186: No hi ha cap directori anterior" @@ -1267,31 +1431,33 @@ msgid "E187: Unknown" msgstr "E187: Desconegut" msgid "E465: :winsize requires two number arguments" -msgstr "E465: L'ordre :winsize requereix dos arguments numrics" +msgstr "E465: :winsize requereix dos arguments numrics" #, c-format msgid "Window position: X %d, Y %d" msgstr "Posici de la finestra: X %d, Y %d" msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: En aquesta plataforma no es pot obtenir la posici de la finestra" +msgstr "E188: Aquesta plataforma no permet obtenir la posici de la finestra" msgid "E466: :winpos requires two number arguments" -msgstr "E466: L'ordre :winpos requereix dos arguments numrics" +msgstr "E466: :winpos requereix dos arguments numrics" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: No es pot utilitzar :redir a dins de execute()" -# s el ttol d'un dileg. eac msgid "Save Redirection" msgstr "Desa la redirecci" -# s el ttol d'un dileg. eac +# :browse mkview msgid "Save View" msgstr "Desa la vista" -# s el ttol d'un dileg. eac +# :browse mksession msgid "Save Session" msgstr "Desa la sessi" -# s el ttol d'un dileg. eac +# :browse mkvimrc msgid "Save Setup" msgstr "Desa la configuraci" @@ -1301,75 +1467,78 @@ msgstr "E739: No s'ha pogut crear el directori: %s" #, c-format msgid "E189: \"%s\" exists (add ! to override)" -msgstr "E189: \"%s\" existeix (afegiu ! per confirmar)" +msgstr "E189: \"%s\" existeix (afegiu ! per a forar)" #, c-format msgid "E190: Cannot open \"%s\" for writing" -msgstr "E190: No s'ha pogut obrir \"%s\" amb perms d'escriptura" +msgstr "E190: No es pot obrir \"%s\" per a escriptura" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: L'argument ha de ser una lletra o b un accent obert o tancat" msgid "E192: Recursive use of :normal too deep" -msgstr "E192: s recursiu de :normal massa profund" +msgstr "E192: s de :normal amb un grau de recursivitat massa elevat" + +msgid "E809: #< is not available without the +eval feature" +msgstr "E809: #< no est disponible sense la caracterstica +eval" msgid "E194: No alternate file name to substitute for '#'" -msgstr "E194: No hi ha cap nom de fitxer alternatiu per substituir '#'" +msgstr "E194: no hi ha cap nom de fitxer alternatiu per substituir" msgid "E495: no autocommand file name to substitute for \"<afile>\"" -msgstr "E495: No hi ha cap nom de fitxer d'auto-ordres per substituir \"<afile>\"" +msgstr "E495: no hi ha cap nom de fitxer d'ordres automtiques per substituir" msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" -msgstr "E496: No hi ha cap nombre de buffer d'auto-ordres per substituir \"<abuf>\"" +msgstr "E496: no hi ha cap buffer d'ordres automtiques per substituir" msgid "E497: no autocommand match name to substitute for \"<amatch>\"" -msgstr "E497: No hi ha cap nom d'auto-ordre per substituir \"<amatch>\"" +msgstr "E497: no hi ha cap coincidncia d'ordre automtica per substituir" msgid "E498: no :source file name to substitute for \"<sfile>\"" -msgstr "E498: No hi ha cap script per substituir \"<sfile>\"" +msgstr "E498: no hi ha cap nom de fitxer :source per substituir" + +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: no hi ha cap script per substituir \"<sfile>\"" #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" -msgstr "E499: El nom de fitxer per '%' o '#' est buit, noms funciona amb \":p:h\"" +msgstr "E499: Nom de fitxer per a '%' o '#' en blanc, noms funciona amb \":p:h\"" msgid "E500: Evaluates to an empty string" -msgstr "E500: S'evalua com a cadena buida" +msgstr "E500: L'avaluaci s una cadena en blanc" msgid "E195: Cannot open viminfo file for reading" -msgstr "E195: No s'ha pogut obrir el fitxer viminfo amb perms de lectura" +msgstr "E195: No s'ha pogut obrir el fitxer viminfo per a lectura" msgid "E196: No digraphs in this version" msgstr "E196: Aquesta versi no suporta dgrafs" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" -msgstr "E608: No es poden generar exepcions amb el prefix 'Vim'" +msgstr "E608: No s possible generar excepcions amb el prefix 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Excepci generada: %s" #, c-format msgid "Exception finished: %s" -msgstr "Exepci finalitzada: %s" +msgstr "Excepci finalitzada: %s" #, c-format msgid "Exception discarded: %s" -msgstr "Exepci descartada: %s" +msgstr "Excepci descartada: %s" #, c-format msgid "%s, line %ld" msgstr "%s, lnia %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Excepci interceptada: %s" #, c-format msgid "%s made pending" -msgstr "%s est pendent" +msgstr "%s s'ha posposat" #, c-format msgid "%s resumed" @@ -1380,7 +1549,7 @@ msgid "%s discarded" msgstr "%s s'ha descartat" msgid "Exception" -msgstr "Exepci" +msgstr "Excepci" msgid "Error and interrupt" msgstr "Error i interrupci" @@ -1388,30 +1557,29 @@ msgstr "Error i interrupci msgid "Error" msgstr "Error" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Interrupci" msgid "E579: :if nesting too deep" -msgstr "E579: Imbricaci de :if massa profunda" +msgstr "E579: nivell d'imbricaci :if massa elevat" msgid "E580: :endif without :if" -msgstr "E580: Declaraci :endif sense :if" +msgstr "E580: :endif sense :if" msgid "E581: :else without :if" -msgstr "E581: Declaraci :else sense :if" +msgstr "E581: :else sense :if" msgid "E582: :elseif without :if" -msgstr "E582: Declaraci :elseif sense :if" +msgstr "E582: :elseif sense :if" msgid "E583: multiple :else" -msgstr "E583: Mltiples :else" +msgstr "E583: mltiples :else" msgid "E584: :elseif after :else" -msgstr "E584: Declaraci :elseif desprs de :else" +msgstr "E584: :elseif desprs de :else" msgid "E585: :while/:for nesting too deep" -msgstr "E585: Imbricaci de :while/:for massa profunda" +msgstr "E585: nivell d'imbricaci :while/:for massa elevat" msgid "E586: :continue without :while or :for" msgstr "E586: :continue sense :while o :for" @@ -1420,48 +1588,49 @@ msgid "E587: :break without :while or :for" msgstr "E587: :break sense :while" msgid "E732: Using :endfor with :while" -msgstr "E732: s incorrecte de :endfor amb :while" +msgstr "E732: s de :endfor amb :while" msgid "E733: Using :endwhile with :for" -msgstr "E733: s incorrecte de :endwhile amb :for" +msgstr "E733: s de :endwhile amb :for" msgid "E601: :try nesting too deep" -msgstr "E601: Imbricaci de :try massa profunda" +msgstr "E601: nivell d'imbricaci :try massa elevat" msgid "E603: :catch without :try" -msgstr "E603: Declaraci :catch sense :try" +msgstr "E603: :catch sense :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" -msgstr "E604: Declaraci :catch desprs de :finally" +msgstr "E604: :catch desprs de :finally" msgid "E606: :finally without :try" -msgstr "E606: Declaraci :finally sense :try" +msgstr "E606: :finally sense :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" -msgstr "E607: Mltiples :finally" +msgstr "E607: mltiples :finally" msgid "E602: :endtry without :try" -msgstr "E602: Declaraci :endtry sense :try" +msgstr "E602: :endtry sense :try" msgid "E193: :endfunction not inside a function" -msgstr "E193: Declaraci :endfunction fora d'una funci" +msgstr "E193: :endfunction fora d'una funci" msgid "E788: Not allowed to edit another buffer now" -msgstr "E788: No podeu editar un altre buffer ara" +msgstr "E788: No est perms editar un altre buffer ara" -# context? eac +msgid "E811: Not allowed to change buffer information now" +msgstr "E811: No est perms canviar la informaci del buffer ara" + +# :set wop=tagfile +# :ts <C-d> msgid "tagname" -msgstr "nom de l'etiqueta" +msgstr "etiqueta" -# context? eac +# <r><l> msgid " kind file\n" -msgstr " tipus de fitxer\n" +msgstr " tip fitxer\n" msgid "'history' option is zero" -msgstr "l'opci 'history' s zero" +msgstr "el parmetre 'history' s zero" #, c-format msgid "" @@ -1472,10 +1641,10 @@ msgstr "" "# Historial %s (de ms a menys recent):\n" msgid "Command Line" -msgstr "d'ordres" +msgstr "de la lnia d'ordres" msgid "Search String" -msgstr "de cadenes cercades" +msgstr "de cerques" msgid "Expression" msgstr "d'expressions" @@ -1483,12 +1652,18 @@ msgstr "d'expressions" msgid "Input Line" msgstr "de lnies d'entrada" +msgid "Debug Line" +msgstr "d'ordres de depuraci" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar fora de l'rea de l'ordre" msgid "E199: Active window or buffer deleted" msgstr "E199: S'ha eliminat la finestra o el buffer actiu" +msgid "E812: Autocommands changed buffer or buffer name" +msgstr "E812: Ordres automtiques han canviat el buffer o el nom del buffer" + msgid "Illegal file name" msgstr "El nom de fitxer s illegal" @@ -1498,8 +1673,8 @@ msgstr " msgid "is not a file" msgstr "no s un fitxer" -msgid "is a device (disabled with 'opendevice' option" -msgstr "s un dispositiu (deshabilitat amb l'opci 'opendevice'" +msgid "is a device (disabled with 'opendevice' option)" +msgstr "s un dispositiu (deshabilitat amb el parmetre 'opendevice')" msgid "[New File]" msgstr "[Fitxer nou]" @@ -1514,10 +1689,10 @@ msgid "[Permission Denied]" msgstr "[Perms denegat]" msgid "E200: *ReadPre autocommands made the file unreadable" -msgstr "E200: Auto-ordres *ReadPre han deixat el fitxer illegible" +msgstr "E200: Ordres automtiques *ReadPre han deixat el fitxer illegible" msgid "E201: *ReadPre autocommands must not change current buffer" -msgstr "E201: Les auto-ordres *ReadPre no poden canviar el buffer actual" +msgstr "E201: Les ordres automtiques *ReadPre han de no modificar el buffer" msgid "Vim: Reading from stdin...\n" msgstr "Vim: Llegint l'entrada estndard...\n" @@ -1525,7 +1700,6 @@ msgstr "Vim: Llegint l'entrada est msgid "Reading from stdin..." msgstr "Llegint l'entrada estndard..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: La conversi ha deixat el fitxer illegible!" @@ -1538,16 +1712,11 @@ msgstr "[fifo]" msgid "[socket]" msgstr "[socket]" -# eac noms-lectura (nl) -msgid "[RO]" -msgstr "[NL]" +msgid "[character special]" +msgstr "[carcter especial]" msgid "[CR missing]" -msgstr "[falten carcters CR]" - -# entra en conflicte amb NL (noms lectura) -msgid "[NL found]" -msgstr "[s'han trobat carcters NL]" +msgstr "[falta retorn-de-carro]" msgid "[long lines split]" msgstr "[lnies llargues partides]" @@ -1558,9 +1727,6 @@ msgstr "[NO convertit]" msgid "[converted]" msgstr "[convertit]" -msgid "[crypted]" -msgstr "[xifrat]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ERROR DE CONVERSI a la lnia %ld]" @@ -1573,7 +1739,7 @@ msgid "[READ ERRORS]" msgstr "[ERRORS DE LECTURA]" msgid "Can't find temp file for conversion" -msgstr "No s'ha trobat el fitxer temporal per la conversi" +msgstr "No s'ha trobat el fitxer temporal per a fer la conversi" msgid "Conversion with 'charconvert' failed" msgstr "La conversi amb 'charconvert' ha fallat" @@ -1582,59 +1748,59 @@ msgid "can't read output of 'charconvert'" msgstr "No s'ha pogut llegir la sortida de 'charconvert'" msgid "E676: No matching autocommands for acwrite buffer" -msgstr "E676: No hi ha cap auto-ordre coincident per al buffer acwrite" +msgstr "E676: No hi ha ordres automtiques coincidents amb acwrite" msgid "E203: Autocommands deleted or unloaded buffer to be written" -msgstr "E203: Auto-ordres han eliminat o alliberat el buffer a escriure" +msgstr "E203: Ordres automtiques han eliminat o alliberat el buffer" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Una auto-ordre ha canviat el nombre de lnies de forma inesperada" +msgstr "E204: Una ordre automtica ha canviat el nombre de lnies" msgid "NetBeans disallows writes of unmodified buffers" msgstr "NetBeans no permet escriure buffers no modificats" msgid "Partial writes disallowed for NetBeans buffers" -msgstr "L'escriptura parcial no est permesa en buffers NetBeans" +msgstr "L'escriptura parcial no est permesa a buffers NetBeans" msgid "is not a file or writable device" msgstr "no s un fitxer o dispositiu que es pugui escriure" msgid "writing to device disabled with 'opendevice' option" -msgstr "escriptura a un dispositiu deshabilitat amb l'opci 'opendevice'" +msgstr "escriptura a dispositius deshabilitada amb el parmetre 'opendevice'" msgid "is read-only (add ! to override)" -msgstr "s un fitxer de noms lectura (afegiu ! per confirmar)" +msgstr "s de noms lectura (afegiu ! per a forar)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: No s'ha pogut escriure la cpia de seguretat (afegiu ! per confirmar)" +msgstr "E506: No s'ha pogut escriure la cpia de seguretat (! per a forar)" msgid "E507: Close error for backup file (add ! to override)" -msgstr "E507: Error en tancar el fitxer cpia de seguretat (afegiu ! per confirmar)" +msgstr "E507: Error en tancar la cpia de seguretat (afegiu ! per a forar)" msgid "E508: Can't read file for backup (add ! to override)" -msgstr "E508: Error de lectura en fer la cpia de seguretat (afegiu ! per confirmar)" +msgstr "E508: Error de lectura en fer la cpia de seguretat (! per a forar)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: No s'ha pogut crear la cpia de seguretat (afegiu ! per confirmar)" +msgstr "E509: No s'ha pogut crear la cpia de seguretat (! per a forar)" msgid "E510: Can't make backup file (add ! to override)" -msgstr "E510: No s'ha pogut fer la cpia de seguretat (afegiu ! per confirmar)" +msgstr "E510: No s'ha pogut fer la cpia de seguretat (! per a forar)" -# resource fork (MacOS) ? +# MacOS msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: La bifurcaci de recursos es perdr (afegiu ! per confirmar)" +msgstr "E460: La secci de recursos del fitxer es perdr (afegiu ! per a forar)" msgid "E214: Can't find temp file for writing" -msgstr "E214: No s'ha trobat el fitxer temporal per escriure-hi" +msgstr "E214: No s'ha trobat el fitxer temporal" msgid "E213: Cannot convert (add ! to write without conversion)" -msgstr "E213: No s'ha pogut convertir (afegiu ! per desar sense conversi)" +msgstr "E213: No s'ha pogut convertir (! per a desar sense convertir)" msgid "E166: Can't open linked file for writing" -msgstr "E166: No s'ha pogut obrir el fitxer enllaat per escriure-hi" +msgstr "E166: No s'ha pogut obrir el fitxer enllaat" msgid "E212: Can't open file for writing" -msgstr "E212: No s'ha pogut obrir el fitxer amb perms d'escriptura" +msgstr "E212: No s'ha pogut obrir el fitxer per a escriptura" msgid "E667: Fsync failed" msgstr "E667: Fsync ha fallat" @@ -1643,7 +1809,13 @@ msgid "E512: Close failed" msgstr "E512: Error en tancar" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: error d'escriptura, conversi fallida (anulleu 'fenc' per a ometre)" +msgstr "E513: ha fallat la conversi (anulleu l'opci 'fenc' per a ometre)" + +#, c-format +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "E513: error de conversi, lnia %ld (anulleu l'opci 'fenc' per a ometre)" msgid "E514: write error (file system full?)" msgstr "E514: Error d'escriptura (sistema de fitxers ple?)" @@ -1651,6 +1823,10 @@ msgstr "E514: Error d'escriptura (sistema de fitxers ple?)" msgid " CONVERSION ERROR" msgstr " ERROR DE CONVERSI" +#, c-format +msgid " in line %ld;" +msgstr " a la lnia %ld" + msgid "[Device]" msgstr "[Dispositiu]" @@ -1673,7 +1849,7 @@ msgid "E205: Patchmode: can't save original file" msgstr "E205: patchmode: no s'ha pogut desar el fitxer original" msgid "E206: patchmode: can't touch empty original file" -msgstr "E206: patchmode: no s'ha pogut tocar el fitxer original buit" +msgstr "E206: patchmode: no s'ha pogut fer un toc al fitxer original buit" msgid "E207: Can't delete backup file" msgstr "E207: No s'ha pogut eliminar la cpia de seguretat" @@ -1681,9 +1857,7 @@ msgstr "E207: No s'ha pogut eliminar la c msgid "" "\n" "WARNING: Original file may be lost or damaged\n" -msgstr "" -"\n" -"ATENCI: El fitxer original es pot haver fet malb\n" +msgstr "\nATENCI: El fitxer original es pot haver perdut o fet malb\n" msgid "don't quit the editor until the file is successfully written!" msgstr "no sortiu de l'editor fins que s'hagi desat el fitxer amb xit!" @@ -1717,23 +1891,20 @@ msgid "1 character" msgstr "1 carcter" #, c-format -msgid "%ld characters" -msgstr "%ld carcters" +msgid "%lld characters" +msgstr "%lld carcters" -# no final de lnia eac +# eol = final de lnia msgid "[noeol]" msgstr "[nofl]" msgid "[Incomplete last line]" msgstr "[ltima lnia incompleta]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "ATENCI: El fitxer ha canviat des de que s'ha llegit!!!" -# pregunta ask_yesno() eac +# pregunta ask_yesno() msgid "Do you really want to write to it" msgstr "Esteu segurs que voleu escriure'l" @@ -1750,39 +1921,38 @@ msgid "E210: Error reading \"%s\"" msgstr "E210: Error en llegir \"%s\"" msgid "E246: FileChangedShell autocommand deleted buffer" -msgstr "E246: L'auto-ordre FileChangedShell ha eliminat el buffer" +msgstr "E246: L'ordre automtica FileChangedShell ha eliminat el buffer" #, c-format msgid "E211: File \"%s\" no longer available" msgstr "E211: El fitxer \"%s\" ha deixat d'estar disponible" #, c-format -msgid "W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as well" +msgid "" +"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"well" msgstr "W12: Atenci: Tant el fitxer \"%s\" com el buffer del Vim han canviat" msgid "See \":help W12\" for more info." msgstr "Vegeu \":help W12\" per a ms info." -# massa llarg? eac #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Atenci: El fitxer \"%s\" ha canviat des de que s'ha comenat a editar" +msgstr "W11: Atenci: El fitxer \"%s\" ha canviat desprs de ser obert" msgid "See \":help W11\" for more info." msgstr "Vegeu \":help W11\" per a ms info." -# massa llarg? eac #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" -msgstr "W16: Atenci: Els permisos de \"%s\" han canviat des que s'ha comenat a editar" +msgstr "W16: Atenci: Els permisos de \"%s\" han canviat desprs de ser obert" msgid "See \":help W16\" for more info." msgstr "Vegeu \":help W16\" per a ms info." -# massa llarg? eac #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Atenci: El fitxer \"%s\" ha estat creat desprs que s'ha comenat a editar" +msgstr "W13: Atenci: El fitxer \"%s\" ha estat creat desprs de ser obert" msgid "Warning" msgstr "Atenci" @@ -1796,7 +1966,7 @@ msgstr "" #, c-format msgid "E462: Could not prepare for reloading \"%s\"" -msgstr "E462: No s'han pogut fer les preparacions per rellegir \"%s\"" +msgstr "E462: No s'han pogut fer les preparacions per a rellegir \"%s\"" #, c-format msgid "E321: Could not reload \"%s\"" @@ -1807,13 +1977,18 @@ msgstr "--Eliminat--" #, c-format msgid "auto-removing autocommand: %s <buffer=%d>" -msgstr "auto-eliminant auto-ordre: %s <buffer=%d>" +msgstr "s'elimina l'ordre automtica: %s <buffer=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: No existeix tal grup: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: No es pot eliminar el grup actual" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: S'elimina un grup d'ordres automtiques que est en s" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Carcter illegal desprs de *: %s" @@ -1826,30 +2001,30 @@ msgstr "E216: No existeix tal esdeveniment: %s" msgid "E216: No such group or event: %s" msgstr "E216: No existeix tal grup o esdeveniment: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" -msgstr "" -"\n" -"--- Auto-ordres ---" +msgstr "\n--- Ordres automtiques ---" #, c-format msgid "E680: <buffer=%d>: invalid buffer number " msgstr "E680: <buffer=%d>: nmero de buffer no vlid" +# :do * Foo msgid "E217: Can't execute autocommands for ALL events" -msgstr "E217: No es poden executar auto-ordres per TOTS els esdeveniments" +msgstr "E217: No es pot assignar una ordre a TOTS els esdeveniments" msgid "No matching autocommands" -msgstr "No coincideix cap auto-ordre" +msgstr "No hi ha cap ordre automtica coincident" msgid "E218: autocommand nesting too deep" -msgstr "E218: Imbricaci d'auto-ordres massa profunda" +msgstr "E218: nivell d'imbricaci d'ordres automtiques massa elevat" +# todo: substitucions +# <event> ... <pattern> #, c-format msgid "%s Auto commands for \"%s\"" -msgstr "auto-ordres %s per \"%s\"" +msgstr "Ordres automtiques de %s per a \"%s\"" #, c-format msgid "Executing %s" @@ -1857,7 +2032,7 @@ msgstr "Executant %s" #, c-format msgid "autocommand %s" -msgstr "auto-ordre %s" +msgstr "ordre automtica %s" msgid "E219: Missing {." msgstr "E219: Falta un {." @@ -1869,14 +2044,10 @@ msgid "E490: No fold found" msgstr "E490: No s'ha trobat cap plec" msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: No es pot crear cap plec amb el 'foldmethod' actual" +msgstr "E350: No s possible crear plecs amb el mtode seleccionat" msgid "E351: Cannot delete fold with current 'foldmethod'" -msgstr "E351: No pot eliminar el plec amb el 'foldmethod' actual" - -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld lnies plegades " +msgstr "E351: No s possible eliminar plecs amb el mtode seleccionat" msgid "E222: Add to read buffer" msgstr "E222: No es pot modificar un buffer de lectura" @@ -1886,19 +2057,19 @@ msgstr "E223: assignaci #, c-format msgid "E224: global abbreviation already exists for %s" -msgstr "E224: ja existeix una abreviaci global per %s" +msgstr "E224: ja existeix una abreviaci global per a %s" #, c-format msgid "E225: global mapping already exists for %s" -msgstr "E225: ja existeix una assignaci global per %s" +msgstr "E225: ja existeix una assignaci global per a %s" #, c-format msgid "E226: abbreviation already exists for %s" -msgstr "E226: ja existeix una abreviaci per %s" +msgstr "E226: ja existeix una abreviaci per a %s" #, c-format msgid "E227: mapping already exists for %s" -msgstr "E227: ja existeix una assignaci per %s" +msgstr "E227: ja existeix una assignaci per a %s" msgid "No abbreviation found" msgstr "No s'ha trobat cap abreviaci" @@ -1909,6 +2080,35 @@ msgstr "No s'ha trobat cap assignaci msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Mode illegal" +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: No s'ha pogut crear un nou procs per a la interfcie grfica" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: El procs fill no ha pogut crear la interfcie grfica" + +msgid "E229: Cannot start the GUI" +msgstr "E229: No s'ha pogut iniciar la interfcie grfica" + +#, c-format +msgid "E230: Cannot read from \"%s\"" +msgstr "E230: No s'ha pogut llegir \"%s\"" + +msgid "E665: Cannot start GUI, no valid font found" +msgstr "E665: Error en iniciar el GUI, no s'han trobat tipus de lletra" + +msgid "E231: 'guifontwide' invalid" +msgstr "E231: El valor de 'guifontwide' no s vlid" + +msgid "E599: Value of 'imactivatekey' is invalid" +msgstr "E599: El valor de 'imactivatekey' no s vlid" + +#, c-format +msgid "E254: Cannot allocate color %s" +msgstr "E254: No s'ha pogut assignar memria per al color %s" + +msgid "No match at cursor, finding next" +msgstr "Cap coincidncia al cursor, cercant la segent" + msgid "<cannot open> " msgstr "<no es pot obrir> " @@ -1931,40 +2131,27 @@ msgstr "D'acord" msgid "Cancel" msgstr "Cancella" +msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." +msgstr "Barra de desplaament: No s'ha obtingut la mida del mapa de bits." + msgid "Vim dialog" msgstr "Dileg del Vim" -msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." -msgstr "Barra de desplaament: No s'ha pogut obtenir la mida del mapa de bits." - msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: No es pot crear un BalloonEval amb missatge i callback alhora" -msgid "E229: Cannot start the GUI" -msgstr "E229: No s'ha pogut iniciar l'interfcie grfica" - -#, c-format -msgid "E230: Cannot read from \"%s\"" -msgstr "E230: No s'ha pogut llegir \"%s\"" - -msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: No es pot iniciar l'IUG, no s'ha trobat cap fosa vlida" - -msgid "E231: 'guifontwide' invalid" -msgstr "E231: El valor de 'guifontwide' no s vlid" - -msgid "E599: Value of 'imactivatekey' is invalid" -msgstr "E599: El valor de 'imactivatekey' no s vlid" +msgid "_Cancel" +msgstr "_Cancella" -#, c-format -msgid "E254: Cannot allocate color %s" -msgstr "E254: No s'ha pogut assignar memria pel color %s" +# :browse w +msgid "_Save" +msgstr "_Desa" -msgid "No match at cursor, finding next" -msgstr "Cap coincidncia al cursor, cercant la segent" +msgid "_Open" +msgstr "_Obre" -msgid "Vim dialog..." -msgstr "Dileg del Vim..." +msgid "_OK" +msgstr "D'_acord" msgid "" "&Yes\n" @@ -1975,6 +2162,12 @@ msgstr "" "&No\n" "&Cancella" +msgid "Yes" +msgstr "S" + +msgid "No" +msgstr "No" + msgid "Input _Methods" msgstr "_Mtodes d'entrada" @@ -1988,20 +2181,17 @@ msgid "Find what:" msgstr "Cerca:" msgid "Replace with:" -msgstr "Substituieix amb:" +msgstr "Substitueix per:" -#. whole word only button msgid "Match whole word only" msgstr "Noms paraules senceres" -#. match case button msgid "Match case" msgstr "Sensible a les majscules" msgid "Direction" msgstr "Direcci" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Amunt" @@ -2017,11 +2207,14 @@ msgstr "Substitueix" msgid "Replace All" msgstr "Substitueix-les totes" +msgid "_Close" +msgstr "_Tanca" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: S'ha rebut una petici \"die\" del gestor de sessions\n" -msgid "Close" -msgstr "Tanca" +msgid "Close tab" +msgstr "Tanca la pestanya" msgid "New tab" msgstr "Nova pestanya" @@ -2030,13 +2223,7 @@ msgid "Open Tab..." msgstr "Obre una pestanya..." msgid "Vim: Main window unexpectedly destroyed\n" -msgstr "Vim: La finestra principal ha estat destruda inesperadament\n" - -msgid "Font Selection" -msgstr "Selecci de fosa" - -msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "S'ha usat CUT_BUFFER0 en lloc d'una selecci buida" +msgstr "Vim: La finestra principal s'ha destrut inesperadament\n" msgid "&Filter" msgstr "&Filtre" @@ -2063,7 +2250,7 @@ msgid "Selection" msgstr "Selecci" msgid "Find &Next" -msgstr "Cerca el &segent" +msgstr "&Cerca el segent" msgid "&Replace" msgstr "&Substitueix" @@ -2074,88 +2261,79 @@ msgstr "Substitueix-les &totes" msgid "&Undo" msgstr "&Desfs" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: No s'ha trobat el ttol de finestra \"%s\"" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argument no suportat: \"-%s\"; Useu la versi OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: No s'ha pogut obrir una finestra dins l'aplicaci MDI" - -msgid "Close tab" -msgstr "Tanca la pestanya" - msgid "Open tab..." msgstr "Obre una pestanya..." msgid "Find string (use '\\\\' to find a '\\')" -msgstr "Cerca una cadena (useu '\\\\' per cercar '\\')" +msgstr "Cerca una cadena (useu '\\\\' per a cercar '\\')" msgid "Find & Replace (use '\\\\' to find a '\\')" -msgstr "Cerca i substitueix (useu '\\\\' per cercar '\\')" +msgstr "Cerca i substitueix (useu '\\\\' per a cercar '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "No Usat" msgid "Directory\t*.nothing\n" msgstr "Directori\t*.res\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: No s'ha trobat el ttol de finestra \"%s\"" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argument no suportat: \"-%s\"; Useu la versi OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: No s'ha pogut obrir una finestra dins l'aplicaci MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" -msgstr "Vim E458: No s'ha pogut assignar memria per colors, poden ser incorrectes" +msgstr "Vim E458: No es pot assignar memria, els colors poden ser incorrectes" #, c-format msgid "E250: Fonts for the following charsets are missing in fontset %s:" -msgstr "E250: En el conjunt %s falten tipus pels segents jocs de carcters:" +msgstr "E250: Falten fonts per als jocs de carcters del conjunt de fonts %s:" #, c-format msgid "E252: Fontset name: %s" -msgstr "E252: Nom del conjunt de tipus: %s" +msgstr "E252: Nom del conjunt de fonts: %s" #, c-format msgid "Font '%s' is not fixed-width" msgstr "La fosa '%s' no s d'amplada fixa" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Nom del conjunt de tipus: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Nom del conjunt de fonts: %s" #, c-format -msgid "Font0: %s\n" -msgstr "Fosa0: %s\n" +msgid "Font0: %s" +msgstr "Fosa0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Fosa1: %s\n" +msgid "Font1: %s" +msgstr "Fosa1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "L'amplada de la fosa%ld no s el doble que la de la fosa0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "L'amplada de fosa%ld no s el doble que la de fosa0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Amplada de de la Fosa0: %ld\n" +msgid "Font0 width: %ld" +msgstr "Amplada de fosa0: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Amplada de la Fosa1: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Amplada de fosa1: %ld" msgid "Invalid font specification" -msgstr "Especificaci de fosa no vlida" +msgstr "L'especificaci de tipus de lletra no s vlida" msgid "&Dismiss" msgstr "&Ignora" msgid "no specific match" -msgstr "cap coincidncia especfica" +msgstr "no hi ha coincidncies" msgid "Vim - Font Selector" msgstr "Vim - Selector de fosa" @@ -2163,7 +2341,6 @@ msgstr "Vim - Selector de fosa" msgid "Name:" msgstr "Nom:" -#. create toggle button msgid "Show size in Points" msgstr "Mostra la mida en punts" @@ -2183,13 +2360,13 @@ msgid "E256: Hangul automata ERROR" msgstr "E256: ERROR de l'autmata hangul" msgid "E550: Missing colon" -msgstr "E550: Falta un carcter \":\"" +msgstr "E550: Falta un carcter ':'" msgid "E551: Illegal component" msgstr "E551: Component illegal" msgid "E552: digit expected" -msgstr "E552: S'esperava un dgit" +msgstr "E552: s'esperava un dgit" #, c-format msgid "Page %d" @@ -2200,7 +2377,7 @@ msgstr "No hi ha text per imprimir" #, c-format msgid "Printing page %d (%d%%)" -msgstr "S'est imprimint la pgina %d (%d%%)" +msgstr "Imprimint la pgina %d (%d%%)" #, c-format msgid " Copy %d of %d" @@ -2211,7 +2388,7 @@ msgid "Printed: %s" msgstr "S'ha imprs: %s" msgid "Printing aborted" -msgstr "S'ha avortat l'impressi" +msgstr "S'ha avortat la impressi" msgid "E455: Error writing to PostScript output file" msgstr "E455: Error en escriure el fitxer PostScript" @@ -2234,19 +2411,19 @@ msgstr "E619: El fitxer de recursos PostScript \"%s\" no est #, c-format msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: La versi del fitxer de recursos \"%s\" no s vlida" +msgstr "E621: La versi del fitxer de recursos \"%s\" s incorrecta" msgid "E673: Incompatible multi-byte encoding and character set." -msgstr "E673: Joc de carcters i codificaci multi-octet no compatibles." +msgstr "E673: El joc de carcters no admet codificaci multi-octet." msgid "E674: printmbcharset cannot be empty with multi-byte encoding." -msgstr "E674: printmbcharset no pot estar buit si la codificaci s multi-octet" +msgstr "E674: la codificaci multi-octet requereix l'opci printmbcharset" msgid "E675: No default font specified for multi-byte printing." -msgstr "E675: No heu especificat cap fosa per defecte per a la impressi multi-octet." +msgstr "E675: No hi ha cap font per defecte per a imprimir en mode multi-octet." msgid "E324: Can't open PostScript output file" -msgstr "E324: No s'ha pogut obrir el fitxer PostScript generat" +msgstr "E324: No s'ha pogut obrir el fitxer PostScript de sortida" #, c-format msgid "E456: Can't open file \"%s\"" @@ -2267,19 +2444,19 @@ msgid "E620: Unable to convert to print encoding \"%s\"" msgstr "E620: No s'ha pogut convertir a la codificaci d'impressi \"%s\"" msgid "Sending to printer..." -msgstr "S'est enviant a la impressora..." +msgstr "Enviant a la impressora..." msgid "E365: Failed to print PostScript file" msgstr "E365: Error en imprimir el fitxer PostScript" msgid "Print job sent." -msgstr "S'ha enviat la tasca d'impressi." +msgstr "S'ha enviat la feina d'impressi." msgid "Add a new database" msgstr "Afegeix una base de dades nova" msgid "Query for a pattern" -msgstr "Consulta un patr" +msgstr "Cerca un patr" msgid "Show this message" msgstr "Mostra aquest missatge" @@ -2295,27 +2472,27 @@ msgstr "Mostra les connexions" #, c-format msgid "E560: Usage: cs[cope] %s" -msgstr "E560: Forma d's: cs[cope] %s" +msgstr "E560: Sintaxi: cs[cope] %s" msgid "This cscope command does not support splitting the window.\n" msgstr "Aquesta ordre de cscope no suporta divisi de finestres.\n" msgid "E562: Usage: cstag <ident>" -msgstr "E562: Forma d's: cstag <despl>" +msgstr "E562: Sintaxi: cstag <despl>" msgid "E257: cstag: tag not found" msgstr "E257: cstag: No s'ha trobat l'etiqueta" #, c-format msgid "E563: stat(%s) error: %d" -msgstr "E563: Error de stat(%s): %d" +msgstr "E563: Error a stat(%s): %d" msgid "E563: stat error" -msgstr "E563: Error de stat()" +msgstr "E563: Error a stat()" #, c-format msgid "E564: %s is not a directory or a valid cscope database" -msgstr "E564: %s no s un directori o una base de dades de cscope vlida" +msgstr "E564: %s no s un directori o una base de dades cscope vlida" #, c-format msgid "Added cscope database %s" @@ -2332,62 +2509,84 @@ msgid "E566: Could not create cscope pipes" msgstr "E566: No s'han pogut crear canonades cscope" msgid "E622: Could not fork for cscope" -msgstr "E622: No s'ha pogut bifurcar el procs cscope" +msgstr "E622: No s'ha pogut crear el procs cscope" -msgid "cs_create_connection exec failed" -msgstr "l'execuci de cs_create_connection ha fallat" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid ha fallat" -msgid "E623: Could not spawn cscope process" -msgstr "E623: No s'ha pogut generar un procs per cscope" +msgid "cs_create_connection exec failed" +msgstr "cs_create_connection exec ha fallat" msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen per to_fp ha fallat" +msgstr "cs_create_connection: fdopen per a to_fp ha fallat" msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen per fr_fp ha fallat" +msgstr "cs_create_connection: fdopen per a fr_fp ha fallat" + +msgid "E623: Could not spawn cscope process" +msgstr "E623: No s'ha pogut crear el procs cscope" msgid "E567: no cscope connections" -msgstr "E567: No hi han connexions cscope" +msgstr "E567: No hi ha connexions cscope" #, c-format -msgid "E259: no matches found for cscope query %s of %s" -msgstr "E259: Cap resultat per la consulta cscope %s de %s" +msgid "E469: invalid cscopequickfix flag %c for %c" +msgstr "E469: parmetre cscopequickfix %c no vlid per a %c" #, c-format -msgid "E469: invalid cscopequickfix flag %c for %c" -msgstr "E469: El senyal cscopequickfix %c no s vlid per %c" +msgid "E259: no matches found for cscope query %s of %s" +msgstr "E259: no hi ha coincidncies per la cerca cscope %s de %s" msgid "cscope commands:\n" msgstr "ordres de cscope:\n" #, c-format -msgid "%-5s: %-30s (Usage: %s)" -msgstr "%-5s: %-30s (Forma d's: %s)" +msgid "%-5s: %s%*s (Usage: %s)" +msgstr "%-5s: %s%*s (Sintaxi: %s)" + +msgid "" +"\n" +" a: Find assignments to this symbol\n" +" c: Find functions calling this function\n" +" d: Find functions called by this function\n" +" e: Find this egrep pattern\n" +" f: Find this file\n" +" g: Find this definition\n" +" i: Find files #including this file\n" +" s: Find this C symbol\n" +" t: Find this text string\n" +msgstr "" +"\n" +" a: Cerca assignacions a aquest smbol\n" +" c: Cerca funcions que criden aquesta funci\n" +" d: Cerca funcions cridades per aquesta funci\n" +" e: Cerca aquest patr egrep\n" +" f: Cerca aquest fitxer\n" +" g: Cerca aquesta definici\n" +" i: Cerca fitxers que fan #include amb aquest fitxer\n" +" s: Cerca aquest smbol C\n" +" t: Cerca aquesta cadena de carcters\n" #, c-format msgid "E625: cannot open cscope database: %s" -msgstr "E625: No s'ha pogut obrir la base de dades cscope: %s" +msgstr "E625: no s'ha pogut obrir la base de dades cscope: %s" msgid "E626: cannot get cscope database information" -msgstr "E626: No s'ha pogut obtenir l'informaci de la base de dades cscope" +msgstr "E626: no s'ha pogut obtenir informaci de la base de dades cscope" msgid "E568: duplicate cscope database not added" -msgstr "E568: No s'ha afegit una base de dades cscope duplicada" - -msgid "E569: maximum number of cscope connections reached" -msgstr "E569: S'ha assolit el mxim nombre de connexions cscope" +msgstr "E568: no s'ha afegit una base de dades cscope duplicada" #, c-format msgid "E261: cscope connection %s not found" -msgstr "E261: No s'ha trobat la connexi cscope %s" +msgstr "E261: no s'ha trobat la connexi cscope %s" #, c-format msgid "cscope connection %s closed" msgstr "s'ha tancat la connexi cscope %s" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" -msgstr "E570: Error fatal a cs_manage_matches" +msgstr "E570: error fatal a cs_manage_matches" #, c-format msgid "Cscope tag: %s" @@ -2408,7 +2607,7 @@ msgid "E609: Cscope error: %s" msgstr "E609: Error de cscope: %s" msgid "All cscope databases reset" -msgstr "S'han reiniciat totes les bases de dades cscope" +msgstr "S'han restablert totes les bases de dades cscope" msgid "no cscope connections\n" msgstr "no hi ha connexions cscope\n" @@ -2416,14 +2615,27 @@ msgstr "no hi ha connexions cscope\n" msgid " # pid database name prepend path\n" msgstr " # pid base de dades prefix d'ubicaci\n" -msgid "???: Sorry, this command is disabled, the MzScheme library could not be loaded." -msgstr "???: Aquesta ordre no est habilitada, la biblioteca MzScheme no s'ha pogut carregar." +msgid "Lua library cannot be loaded." +msgstr "No s'ha pogut carregar la biblioteca Lua." + +msgid "cannot save undo information" +msgstr "no s'ha pogut desar la informaci de desfer" + +msgid "" +"E815: Sorry, this command is disabled, the MzScheme libraries could not be " +"loaded." +msgstr "E815: Ordre no disponible, no s'han carregat biblioteques MzScheme" + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "E895: Ordre no disponible, no s'ha carregat el mdul base de MzScheme" msgid "invalid expression" msgstr "l'expressi no s vlida" msgid "expressions disabled at compile time" -msgstr "no s'ha compilat suport per expressions" +msgstr "no s'ha compilat suport per a expressions" msgid "hidden option" msgstr "opci amagada" @@ -2432,14 +2644,11 @@ msgid "unknown option" msgstr "opci desconeguda" msgid "window index is out of range" -msgstr "ndex de finestra fora d'abast" +msgstr "l'ndex de la finestra est fora de l'interval" msgid "couldn't open buffer" msgstr "no s'ha pogut obrir el buffer" -msgid "cannot save undo information" -msgstr "no s'ha pogut desar l'informaci de desfer" - msgid "cannot delete line" msgstr "no s'ha pogut esborrar la lnia" @@ -2452,6 +2661,9 @@ msgstr "no s'ha pogut inserir la l msgid "string cannot contain newlines" msgstr "la cadena no pot contenir salts de lnia" +msgid "error converting Scheme values to Vim" +msgstr "error en convertir els valors de Scheme a Vim" + msgid "Vim error: ~a" msgstr "Error del Vim: ~a" @@ -2465,77 +2677,36 @@ msgid "window is invalid" msgstr "la finestra no s vlida" msgid "linenr out of range" -msgstr "nombre de lnia fora d'abast" +msgstr "nmero de lnia fora de l'interval" msgid "not allowed in the Vim sandbox" -msgstr "no perms a la gbia del Vim" - -msgid "E263: Sorry, this command is disabled, the Python library could not be loaded." -msgstr "E263: Aquesta ordre est deshabilitada, no s'ha pogut carregar Python." - -msgid "E659: Cannot invoke Python recursively" -msgstr "E659: No es pot invocar Python de forma recursiva" - -msgid "can't delete OutputObject attributes" -msgstr "no s'han pogut eliminar els atributs de l'OutputObject" - -msgid "softspace must be an integer" -msgstr "'softspace' ha de ser un nombre enter" - -msgid "invalid attribute" -msgstr "l'atribut no s vlid" - -msgid "writelines() requires list of strings" -msgstr "la funci writelines() requereix una llista de cadenes" - -msgid "E264: Python: Error initialising I/O objects" -msgstr "E264: Python: Error en inicialitzar els objectes d'E/S" - -msgid "attempt to refer to deleted buffer" -msgstr "intent de referncia a un buffer eliminat" - -msgid "line number out of range" -msgstr "nombre de lnia fora d'abast" - -#, c-format -msgid "<buffer object (deleted) at %8lX>" -msgstr "<objecte buffer (eliminat) a %8lX>" +msgstr "no perms a l'entorn d'execuci del Vim" -msgid "invalid mark name" -msgstr "nom de marca no vlid" - -msgid "no such buffer" -msgstr "no existeix tal buffer" - -msgid "attempt to refer to deleted window" -msgstr "intent de referir-se a una finestra eliminada" - -msgid "readonly attribute" -msgstr "atribut de noms lectura" - -msgid "cursor position outside buffer" -msgstr "posici del cursor fora del buffer" +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Aquest Vim no pot executar :python desprs de :py3" -#, c-format -msgid "<window object (deleted) at %.8lX>" -msgstr "<objecte finestra (eliminat) a %.8lX>" +msgid "" +"E263: Sorry, this command is disabled, the Python library could not be " +"loaded." +msgstr "E263: Ordre no disponible, no s'ha carregat la biblioteca Python." -#, c-format -msgid "<window object (unknown) at %.8lX>" -msgstr "<objecte finestra (desconegut) a %.8lX>" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "E263: Ordre no disponible, no s'ha carregat el mdul site de Python." -#, c-format -msgid "<window %d>" -msgstr "<finestra %d>" +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: No es pot invocar Python de forma recursiva" -msgid "no such window" -msgstr "no existeix tal finestra" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Aquest Vim no pot executar :py3 desprs de :python" msgid "E265: $_ must be an instance of String" -msgstr "E265: $_ ha de ser una instncia d'una cadena" +msgstr "E265: $_ ha de ser String" -msgid "E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "E266: Ordre deshabilitada, no s'ha pogut carregar la biblioteca Ruby." +msgid "" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." +msgstr "E266: Ordre no disponible, no s'ha carregat la biblioteca Ruby." msgid "E267: unexpected return" msgstr "E267: retorn inesperat" @@ -2544,7 +2715,7 @@ msgid "E268: unexpected next" msgstr "E268: 'next' inesperat" msgid "E269: unexpected break" -msgstr "E269: tall inesperat" +msgstr "E269: 'break' inesperat" msgid "E270: unexpected redo" msgstr "E270: 'redo' inesperat" @@ -2553,106 +2724,23 @@ msgid "E271: retry outside of rescue clause" msgstr "E271: 'retry' fora d'una clusula de rescat" msgid "E272: unhandled exception" -msgstr "E272: excepci no manejada" +msgstr "E272: excepci no conduda" #, c-format msgid "E273: unknown longjmp status %d" -msgstr "E273: estat de longjmp desconegut %d" - -msgid "Toggle implementation/definition" -msgstr "Commuta implementaci/definici" - -msgid "Show base class of" -msgstr "Mostra la classe base de" - -msgid "Show overridden member function" -msgstr "Mostra el membre de la funci invalidat" - -msgid "Retrieve from file" -msgstr "Obtenir d'un fitxer" - -msgid "Retrieve from project" -msgstr "Obtenir d'un projecte" - -msgid "Retrieve from all projects" -msgstr "Obtenir de tots els projectes" - -msgid "Retrieve" -msgstr "Obtenir" - -msgid "Show source of" -msgstr "Mostra el codi font de" - -msgid "Find symbol" -msgstr "Cerca un smbol" - -msgid "Browse class" -msgstr "Explora les classes" - -msgid "Show class in hierarchy" -msgstr "Mostra la jerarquia de classes" - -msgid "Show class in restricted hierarchy" -msgstr "Mostra la jerarquia de classes restringida" - -msgid "Xref refers to" -msgstr "Xref es refereix a" - -msgid "Xref referred by" -msgstr "Xref referenciada per" - -msgid "Xref has a" -msgstr "Xref t un" - -msgid "Xref used by" -msgstr "Xref usada per" - -msgid "Show docu of" -msgstr "Mostra docu de" - -msgid "Generate docu for" -msgstr "Genera docu per" - -msgid "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in $PATH).\n" -msgstr "No s'ha pogut connectar amb SNiFF+. Reviseu l'entorn (sniffemacs ha d'estar en el $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Error de lectura. Desconnectat" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ " - -msgid "not " -msgstr "no " - -msgid "connected" -msgstr "est connectat" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Petici SNiFF+ desconeguda: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Error en connectar a SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ no connectat" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: No s un buffer SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Error d'escriptura. Desconnectat" +msgstr "E273: estat de longjmp %d desconegut" msgid "invalid buffer number" -msgstr "nombre de buffer no vlid" +msgstr "nmero de buffer no vlid" msgid "not implemented yet" -msgstr "no implementat (encara)" +msgstr "no implementat (de moment)" -#. ??? msgid "cannot set line(s)" -msgstr "no s'ha pogut establir el nombre de lnies" +msgstr "no s'han pogut establir les lnies" + +msgid "invalid mark name" +msgstr "nom de marca no vlid" msgid "mark not set" msgstr "marca no establerta" @@ -2664,11 +2752,14 @@ msgstr "fila %d columna %d" msgid "cannot insert/append line" msgstr "no s'ha pogut inserir/afegir la lnia" +msgid "line number out of range" +msgstr "nmero de lnia fora de l'interval" + msgid "unknown flag: " -msgstr "senyal desconegut: " +msgstr "parmetre desconegut: " msgid "unknown vimOption" -msgstr "vimOption desconeguda" +msgstr "opci del Vim desconeguda" msgid "keyboard interrupt" msgstr "interrupci de teclat" @@ -2677,23 +2768,23 @@ msgid "vim error" msgstr "error de vim" msgid "cannot create buffer/window command: object is being deleted" -msgstr "no s'ha pogut crear l'ordre de buffer/finestra: l'objecte est siguent eliminat" +msgstr "no es pot crear l'ordre Tcl: l'objecte est sent eliminant" -msgid "cannot register callback command: buffer/window is already being deleted" -msgstr "no s'ha pogut registrar l'ordre callback: el bfer/finestra ja est sent eliminat" +msgid "" +"cannot register callback command: buffer/window is already being deleted" +msgstr "no es pot registrar el callback: l'objecte est sent eliminant" -#. This should never happen. Famous last word? -msgid "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org" -msgstr "E280: ERROR FATAL DE TCL: llista de referncies corrupta!? Comuniqueu-ho a vim-dev@vim.org." +msgid "" +"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." +"org" +msgstr "E280: ERROR FATAL DE TCL: reflist corromput!? Comuniqueu el bug a vim-dev@vim.org." msgid "cannot register callback command: buffer/window reference not found" -msgstr "no s'ha pogut registrar l'ordre callback: referncia del bfer/finestra no trobada" - -msgid "E571: Sorry, this command is disabled: the Tcl library could not be loaded." -msgstr "E571: Aquesta ordre est deshabilitada: No s'ha pogut carregar la llibreria Tcl." +msgstr "no es pot registrar el callback: no s'ha trobat la referncia" -msgid "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "E281: ERROR DE TCL: el codi de retorn no s un enter!? Comuniqueu-ho a vim-dev@vim.org." +msgid "" +"E571: Sorry, this command is disabled: the Tcl library could not be loaded." +msgstr "E571: Ordre no disponible: no s'ha carregat la biblioteca Tcl." #, c-format msgid "E572: exit code %d" @@ -2710,47 +2801,70 @@ msgstr "E248: No s'ha pogut enviar l'ordre al programa destinatari" #, c-format msgid "E573: Invalid server id used: %s" -msgstr "E573: S'ha usat una ID de servidor no vlida: %s" +msgstr "E573: ID de servidor no vlid: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" -msgstr "E251: El registre de l'instncia de VIM est mal format. S'ha esborrat!" +msgstr "E251: La propietat 'VimRegistry' no s vlida. S'ha esborrat!" + +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Clau duplicada a l'objecte JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Falta una coma a la llista: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Falta ']' al final de la llista: %s" +# vim --foo msgid "Unknown option argument" -msgstr "Argument d'opci desconegut" +msgstr "Opci desconeguda" msgid "Too many edit arguments" -msgstr "Massa arguments d'edici" +msgstr "Sobren arguments d'edici" msgid "Argument missing after" msgstr "Falta un argument desprs de" +# vim -Tx msgid "Garbage after option argument" -msgstr "Porqueria desprs de l'argument d'opci" +msgstr "Carcters sobrants desprs de l'opci" msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" -msgstr "Massa arguments \"+ordre\", \"-c ordre\" o \"--cmd ordre\"" +msgstr "Sobren arguments \"+ordre\", \"-c ordre\" o \"--cmd ordre\"" msgid "Invalid argument for" -msgstr "Argument no vlid per" +msgstr "Argument no vlid per a" #, c-format msgid "%d files to edit\n" msgstr "%d fitxers per editar\n" +msgid "netbeans is not supported with this GUI\n" +msgstr "aquesta interfcie grfica no suporta NetBeans\n" + +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr "'-nb' no est disponible: no s'ha compilat el suport\n" + msgid "This Vim was not compiled with the diff feature." -msgstr "Aquest Vim no ha estat compilat amb suport per diff." +msgstr "Aquest Vim no ha estat compilat amb la caracterstica diff." msgid "Attempt to open script file again: \"" -msgstr "Reintent d'obrir l'script: \"" +msgstr "Es torna a intentar obrir l'script: \"" msgid "Cannot open for reading: \"" -msgstr "No s'ha pogut obrir amb perms de lectura: \"" +msgstr "No es pot obrir per a lectura: \"" msgid "Cannot open for script output: \"" -msgstr "No s'ha pogut obrir per desar-hi l'exida de l'script: \"" +msgstr "No es pot obrir per a la sortida de l'script: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Error: Ha fallat l'arrencada del gvim des de NetBeans\n" +msgstr "Vim: Error: No s'ha pogut iniciar gvim des de NetBeans\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Error: Aquesta versi de Vim no funciona en terminals Cygwin\n" msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Atenci: La sortida no est connectada a un terminal\n" @@ -2758,9 +2872,8 @@ msgstr "Vim: Atenci msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: Atenci: L'entrada no est connectada a un terminal\n" -#. just in case.. msgid "pre-vimrc command line" -msgstr "lnia d'ordres pre-vimrc" +msgstr "lnia d'ordres prvia a vimrc" #, c-format msgid "E282: Cannot read from \"%s\"" @@ -2773,18 +2886,23 @@ msgstr "" "\n" "Ms informaci amb: \"vim -h\"\n" +# max 56 carcters msgid "[file ..] edit specified file(s)" msgstr "[fitxer ...] edita el(s) fitxer(s) especificat(s)" +# max 56 carcters msgid "- read text from stdin" msgstr "- edita el text de l'entrada estndard" +# max 56 carcters msgid "-t tag edit file where tag is defined" msgstr "-t etiqueta edita el fitxer on hi ha l'etiqueta" +# max 56 carcters msgid "-q [errorfile] edit file with first error" msgstr "-q [ftxerrors] edita el fitxer on hi ha el primer error" +# alineat amb main.c:3279 msgid "" "\n" "\n" @@ -2804,12 +2922,11 @@ msgstr "" "\n" "o b:" +# VMS msgid "" "\n" "Where case is ignored prepend / to make flag upper case" -msgstr "" -"\n" -"On s'ignora la capitalizaci, afegiu el prefix / per a indicar majscules" +msgstr "\nOn no es distingeixen majscules el prefix / indica majscules" msgid "" "\n" @@ -2827,16 +2944,16 @@ msgid "--literal\t\tDon't expand wildcards" msgstr "--literal\t\tNo expandeix patrons de noms" msgid "-register\t\tRegister this gvim for OLE" -msgstr "-register\t\tRegistra aquest gvim per OLE" +msgstr "-register\t\tRegistra aquest gvim a OLE" msgid "-unregister\t\tUnregister gvim for OLE" -msgstr "-unregister\t\tDesregistra aquest gvim per OLE" +msgstr "-unregister\t\tDna de baixa aquest gvim a OLE" msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tUsa una interfcie grfica (com \"gvim\")" +msgstr "-g\t\t\tUsa la interfcie grfica (com \"gvim\")" msgid "-f or --nofork\tForeground: Don't fork when starting GUI" -msgstr "-f o --nofork\tNo crea un procs nou per la GUI" +msgstr "-f o --nofork\tNo crea un procs nou per al GUI" msgid "-v\t\t\tVi mode (like \"vi\")" msgstr "-v\t\t\tMode Vi (com \"vi\")" @@ -2844,8 +2961,11 @@ msgstr "-v\t\t\tMode Vi (com \"vi\")" msgid "-e\t\t\tEx mode (like \"ex\")" msgstr "-e\t\t\tMode Ex (com \"ex\")" +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tMode Ex millorat" + msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\tMode silencis (noms per \"ex\")" +msgstr "-s\t\t\tMode silencis per lots (noms per a \"ex\")" msgid "-d\t\t\tDiff mode (like \"vimdiff\")" msgstr "-d\t\t\tMode diff (com \"vimdiff\")" @@ -2872,13 +2992,13 @@ msgid "-l\t\t\tLisp mode" msgstr "-l\t\t\tMode Lisp" msgid "-C\t\t\tCompatible with Vi: 'compatible'" -msgstr "-C\t\t\tCompatible amb Vi" +msgstr "-C\t\t\tCompatible amb Vi: 'compatible'" msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" -msgstr "-N\t\t\tNo del tot compatible amb Vi" +msgstr "-N\t\t\tNo del tot compatible amb Vi: 'nocompatible'" msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -msgstr "-V[N][nomf]\t\tLoquacitat [nivell N] [desa els missatges a nomf]" +msgstr "-V[N][nomf]\t\tLoquacitat [nivell N] [desa missatges a nomf]" msgid "-D\t\t\tDebugging mode" msgstr "-D\t\t\tMode de depuraci" @@ -2887,7 +3007,7 @@ msgid "-n\t\t\tNo swap file, use memory only" msgstr "-n\t\t\tNo usa fitxers d'intercanvi, noms memria" msgid "-r\t\t\tList swap files and exit" -msgstr "-r\t\t\tLlista els fitxers d'intercanvi i surt" +msgstr "-r\t\t\tLlistat dels fitxers d'intercanvi" msgid "-r (with file name)\tRecover crashed session" msgstr "-r (amb nom de fitxer) Recupera una sessi accidentada" @@ -2899,20 +3019,26 @@ msgid "-f\t\t\tDon't use newcli to open window" msgstr "-f\t\t\tNo obre una finestra nova amb newcli" msgid "-dev <device>\t\tUse <device> for I/O" -msgstr "-dev <dispositiu>\t\tUsa <dispositiu> per l'E/S" +msgstr "-dev <dispositiu>\t\tUsa <dispositiu> per a l'E/S" msgid "-A\t\t\tstart in Arabic mode" -msgstr "-A\t\t\tComena en mode rab" +msgstr "-A\t\t\tComena en mode arbic" msgid "-H\t\t\tStart in Hebrew mode" msgstr "-H\t\t\tComena en mode hebreu" msgid "-F\t\t\tStart in Farsi mode" -msgstr "-F\t\t\t Comena en mode farsi" +msgstr "-F\t\t\tComena en mode farsi" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\tDefineix el tipus de terminal" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tOmet avisos relacionats amb el terminal" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tSurt si l'entrada/sortida no sn un terminal" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tUsa <vimrc> en lloc de qualsevol altre .vimrc" @@ -2920,7 +3046,7 @@ msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc" msgstr "-U <gvimrc>\t\tUsa <gvimrc> en lloc de qualsevol altre .gvimrc" msgid "--noplugin\t\tDon't load plugin scripts" -msgstr "--noplugin\t\tNo carrega cap plugin" +msgstr "--noplugin\t\tNo carrega plugins" msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" msgstr "-p[N]\t\tObre N pestanyes (per omissi: una per fitxer)" @@ -2929,7 +3055,7 @@ msgid "-o[N]\t\tOpen N windows (default: one for each file)" msgstr "-o[N]\t\tObre N finestres (per omissi: una per fitxer)" msgid "-O[N]\t\tLike -o but split vertically" -msgstr "-O[N]\t\tCom -o per amb divisions verticals" +msgstr "-O[N]\t\tCom -o per amb divisi vertical" msgid "+\t\t\tStart at end of file" msgstr "+\t\t\tComena al final del fitxer" @@ -2944,16 +3070,16 @@ msgid "-c <command>\t\tExecute <command> after loading the first file" msgstr "-c <ordre>\t\tExecuta <ordre> desprs de carregar el primer fitxer" msgid "-S <session>\t\tSource file <session> after loading the first file" -msgstr "-S <fitxer>\t\tEvalua <fitxer> un cop carregat el primer fitxer" +msgstr "-S <fitxer>\t\tExecuta <fitxer> un cop carregat el primer fitxer" msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" msgstr "-s <script>\t\tLlegeix ordres del mode Normal del fitxer <script>" msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" -msgstr "-w <script>\t\tAfegeix totes les ordres executades al fitxer <script>" +msgstr "-w <script>\t\tAfegeix totes les ordres entrades al fitxer <script>" msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" -msgstr "-W <script>\t\tEscriu totes les ordres executades al fitxer <script>" +msgstr "-W <script>\t\tEscriu totes les ordres entrades al fitxer <script>" msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tEdita fitxers amb xifrat" @@ -2962,7 +3088,7 @@ msgid "-display <display>\tConnect vim to this particular X-server" msgstr "-display <pantalla>\tConnecta el Vim a un servidor X particular" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tNo es connecta a cap servidor X" +msgstr "-X\t\t\tNo es connecta al servidor X" msgid "--remote <files>\tEdit <files> in a Vim server if possible" msgstr "--remote <fitxers>\tEdita <fitxers> en un servidor Vim, si s possible" @@ -2970,26 +3096,36 @@ msgstr "--remote <fitxers>\tEdita <fitxers> en un servidor Vim, si msgid "--remote-silent <files> Same, don't complain if there is no server" msgstr "--remote-silent <fitxers> Igual, no es queixa si no hi ha servidor" -msgid "--remote-wait <files> As --remote but wait for files to have been edited" -msgstr "--remote-wait <fitxers> Com --remote, per espera que s'editin els fitxers" +msgid "" +"--remote-wait <files> As --remote but wait for files to have been edited" +msgstr "" +"--remote-wait <fitxers> Com --remote, per espera que s'editin els fitxers" -msgid "--remote-wait-silent <files> Same, don't complain if there is no server" -msgstr "--remote-wait-silent <fitxers> Igual, no es queixa si no hi ha servidor" +msgid "" +"--remote-wait-silent <files> Same, don't complain if there is no server" +msgstr "" +"--remote-wait-silent <fitxers> Igual, no es queixa si no hi ha servidor" -msgid "--remote-tab <files> As --remote but open tab page for each file" -msgstr "--remote-tab <fitxers> Com --remote, per obre una pestanya per fitxer" +msgid "" +"--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" +msgstr "" +"--remote-tab[-wait][-silent] <fitxers>\n" +" Com --remote, per obre una pestanya per fitxer" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" msgstr "--remote-send <tecles> Envia <tecles> a un servidor Vim i surt" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <expr>\tEvaula <expr> en un servidor Vim i mostra el resultat" +msgstr "--remote-expr <expr>\tAvalua <expr> en un servidor Vim i mostra el resultat" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tLlista els noms dels servidors Vim accessibles" +msgstr "--serverlist\t\tLlistat de servidors Vim disponibles" msgid "--servername <name>\tSend to/become the Vim server <name>" -msgstr "--servername <nom>\tEnvia a o es converteix en servidor Vim <nom>" +msgstr "--servername <nom>\tEnvia a/es converteix en servidor Vim <nom>" + +msgid "--startuptime <file>\tWrite startup timing messages to <file>" +msgstr "--startuptime <fitxer> Desa la cronologia d'arrencada a <fitxer>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tUsa <viminfo> en lloc de .viminfo" @@ -3010,9 +3146,7 @@ msgstr "" msgid "" "\n" "Arguments recognised by gvim (neXtaw version):\n" -msgstr "" -"\n" -"Arguments reconeguts pel gvim (versi neXtaw>:\n" +msgstr "\nArguments reconeguts pel gvim (versi neXtaw):\n" msgid "" "\n" @@ -3027,32 +3161,26 @@ msgstr "-display <pantalla>\tExecuta vim a <pantalla>" msgid "-iconic\t\tStart vim iconified" msgstr "-iconic\t\tComena iconificat" -msgid "-name <name>\t\tUse resource as if vim was <name>" -msgstr "-name <nom>\t\tUsa els recursos com si vim fs <nom>" - -msgid "\t\t\t (Unimplemented)\n" -msgstr "\t\t\t (No implementat)\n" - msgid "-background <color>\tUse <color> for the background (also: -bg)" -msgstr "-background <color>\tUsa <color> pel fons (tamb: -bg)" +msgstr "-background <color>\tUsa <color> per al fons (tamb: -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" -msgstr "-foreground <color>\tUsa <color> pel text normal (tamb: -fg)" +msgstr "-foreground <color>\tUsa <color> per al text normal (tamb: -fg)" msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" -msgstr "-font <fosa>\tUsa <fosa> pel text normal (tamb: -fn)" +msgstr "-font <fosa>\t\tUsa <fosa> per al text normal (tamb: -fn)" msgid "-boldfont <font>\tUse <font> for bold text" -msgstr "-boldfont <fosa>\tUsa <fosa> pel text en negreta" +msgstr "-boldfont <fosa>\tUsa <fosa> per al text en negreta" msgid "-italicfont <font>\tUse <font> for italic text" -msgstr "-italicfont <fosa>\tUsa <fosa> pel text en cursiva" +msgstr "-italicfont <fosa>\tUsa <fosa> per al text en cursiva" msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" msgstr "-geometry <geom>\tUsa <geom> com a geometria inicial (tamb: -geom)" msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" -msgstr "-borderwidth <amplada>\tUsa un marge d'amplada <amplada> (tamb: -bw)" +msgstr "-borderwidth <amplada> Usa un marge d'amplada <amplada> (tamb: -bw) " msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" msgstr "-scrollbarwidth <amplada> Amplada de la barra de desplaament (tamb: -sw)" @@ -3069,19 +3197,6 @@ msgstr "+reverse\t\tNo usa el mode de video invers (tamb msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <recurs>\tEstableix el recurs especificat" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"Arguments reconeguts pel gvim (versi RISC OS):\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <nombre>\tAmplada inicial de la finestra en columnes" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <nombre>\tAlada inicial de la finestra en files" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" @@ -3093,24 +3208,28 @@ msgid "-display <display>\tRun vim on <display> (also: --display)" msgstr "-display <pantalla>\tExecuta vim a <pantalla> (tamb: --display)" msgid "--role <role>\tSet a unique role to identify the main window" -msgstr "--role <rol>\t\tUsa un nic rol per identificar la finestra principal" +msgstr "--role <rol>\t\tUsa un nic rol per a identificar la finestra principal" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" -msgstr "--socketid <xid>\tObre el vim dins d'una altra aplicaci GTK" +msgstr "--socketid <xid>\tObre el vim dins d'un altre giny GTK" + +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tEscriu el Window ID a la sortida estndard" msgid "-P <parent title>\tOpen Vim inside parent application" -msgstr "-P <ttol pare>\tObre el Vim en una aplicaci pare" +msgstr "-P <aplicaci>\t\tObre el Vim dins d'una altra aplicaci" + +msgid "--windowid <HWND>\tOpen Vim inside another win32 widget" +msgstr "--windowid <HWND>\tObre el Vim dins d'un altre giny win32" msgid "No display" msgstr "No hi ha cap pantalla" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": Error en enviar.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" -msgstr ": Error en enviar. Intentant l'execuci local\n" +msgstr ": Error en enviar. Intentant executar vim localment\n" #, c-format msgid "%d of %d edited" @@ -3127,9 +3246,9 @@ msgstr "No hi ha marques definides" #, c-format msgid "E283: No marks matching \"%s\"" -msgstr "E283: Cap marca coincideix amb \"%s\"" +msgstr "E283: Cap marca coincident amb \"%s\"" -#. Highlight title +# :marks msgid "" "\n" "mark line col file/text" @@ -3137,7 +3256,8 @@ msgstr "" "\n" "marca ln col fitxer/text" -#. Highlight title +# :jumps +# <c><r><r><l> msgid "" "\n" " jump line col file/text" @@ -3145,38 +3265,30 @@ msgstr "" "\n" " salt ln col fitxer/text" -#. Highlight title +# :changes +# <r><r><r><l> msgid "" "\n" "change line col text" -msgstr "" -"\n" -"canvi lnia col text" +msgstr "\ncanvi lnia col text" -#, c-format +# fitxer viminfo msgid "" "\n" "# File marks:\n" -msgstr "" -"\n" -"# Marques de fitxer:\n" +msgstr "\n# Marques:\n" -#. Write the jumplist with -' -#, c-format +# fitxer viminfo msgid "" "\n" "# Jumplist (newest first):\n" -msgstr "" -"\n" -"# Llista de salts (de ms a menys recent):\n" +msgstr "\n# Salts (ms recents primer):\n" -#, c-format +# fitxer viminfo msgid "" "\n" "# History of marks within files (newest to oldest):\n" -msgstr "" -"\n" -"# Historial de marques en fitxers (de ms a menys recent):\n" +msgstr "\n# Historial de marques (ms recents primer):\n" msgid "Missing '>'" msgstr "Falta un '>'" @@ -3194,7 +3306,7 @@ msgid "E286: Failed to open input method" msgstr "E286: Error en obrir el mtode d'entrada" msgid "E287: Warning: Could not set destroy callback to IM" -msgstr "E287: Atenci: No s'ha pogut establir el callback de destrucci a IM" +msgstr "E287: Atenci: Error en establir el callback de destrucci de l'IM" msgid "E288: input method doesn't support any style" msgstr "E288: el mtode d'entrada no suporta cap estil" @@ -3202,32 +3314,23 @@ msgstr "E288: el m msgid "E289: input method doesn't support my preedit type" msgstr "E289: el mtode d'entrada no suporta el tipus de preedici" -msgid "E290: over-the-spot style requires fontset" -msgstr "E290: L'estil over-the-spot requereix un conjunt de tipus" - -msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -msgstr "E291: La llibreria GTK+ s anterior a 1.2.3. Es deshabilita l'rea d'estat" - -msgid "E292: Input Method Server is not running" -msgstr "E292: El servidor de mtodes d'entrada (IMS) no est funcionant" - msgid "E293: block was not locked" msgstr "E293: El bloc no estava bloquejat" msgid "E294: Seek error in swap file read" -msgstr "E294: Error de posici quan es llegia el fitxer d'intercanvi" +msgstr "E294: Error de posicionament en llegir el fitxer d'intercanvi" msgid "E295: Read error in swap file" msgstr "E295: Error de lectura en el fitxer d'intercanvi" msgid "E296: Seek error in swap file write" -msgstr "E296: Error de posici quan s'escrivia el fitxer d'intercanvi" +msgstr "E296: Error de posicionament en escriure el fitxer d'intercanvi" msgid "E297: Write error in swap file" msgstr "E297: Error d'escriptura en el fitxer d'intercanvi" msgid "E300: Swap file already exists (symlink attack?)" -msgstr "E300: El fitxer d'intercanvi encara existeix" +msgstr "E300: El fitxer d'intercanvi ja existeix (pot ser un atac?)" msgid "E298: Didn't get block nr 0?" msgstr "E298: No s'ha pogut obtenir el bloc 0?" @@ -3236,18 +3339,21 @@ msgid "E298: Didn't get block nr 1?" msgstr "E298: No s'ha pogut obtenir el bloc 1?" msgid "E298: Didn't get block nr 2?" -msgstr "E298: No s'ha pogut obtenir el bloc 3?" +msgstr "E298: No s'ha pogut obtenir el bloc 2?" + +# called after the crypt key or 'cryptmethod' was changed for "buf" +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Error en actualitzar el xifrat del fitxer d'intercanvi" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: Ep! El fitxer d'intercanvi s'ha perdut!!!" +msgstr "E301: El fitxer d'intercanvi ha desaparegut!!!" msgid "E302: Could not rename swap file" msgstr "E302: No s'ha pogut reanomenar el fitxer d'intercanvi" #, c-format msgid "E303: Unable to open swap file for \"%s\", recovery impossible" -msgstr "E303: Error en obrir el fitxer d'intercanvi de \"%s\", no es podr recuperar" +msgstr "E303: Error en obrir el fitxer .swp de \"%s\", no es pot recuperar" msgid "E304: ml_upd_block0(): Didn't get block 0??" msgstr "E304: ml_upd_block0(): No s'ha obtingut el bloc 0??" @@ -3257,7 +3363,7 @@ msgid "E305: No swap file found for %s" msgstr "E305: No s'ha trobat el fitxer d'intercanvi de %s" msgid "Enter number of swap file to use (0 to quit): " -msgstr "Entreu el nmero del fitxer d'intercanvi a utilitzar (0 per sortir): " +msgstr "Entreu el nmero del fitxer .swp a utilitzar (0 per a sortir): " #, c-format msgid "E306: Cannot open %s" @@ -3269,22 +3375,20 @@ msgstr "No s'ha pogut llegir el bloc 0 de " msgid "" "\n" "Maybe no changes were made or Vim did not update the swap file." -msgstr "" -"\n" -"O b no s'han fet canvis, o el Vim no ha actualitzat el fitxer d'intercanvi." +msgstr "\nPotser no hi havia canvis o no es va desar el fitxer .swp." msgid " cannot be used with this version of Vim.\n" -msgstr " no es pot utilitzar amb aquesta versi de Vim.\n" +msgstr " no es pot utilitzar amb aquesta versi del Vim.\n" msgid "Use Vim version 3.0.\n" -msgstr "Useu Vim versi 3.0.\n" +msgstr "Useu la versi 3.0 del Vim.\n" #, c-format msgid "E307: %s does not look like a Vim swap file" -msgstr "E307: %s no sembla un fitxer d'intercanvi de Vim" +msgstr "E307: %s no sembla un fitxer d'intercanvi del Vim" msgid " cannot be used on this computer.\n" -msgstr " no es pot utilitzar en aquest ordinador.\n" +msgstr " no es pot utilitzar en aquesta mquina.\n" msgid "The file was created on " msgstr "El fitxer va ser creat el " @@ -3296,12 +3400,17 @@ msgstr "" ",\n" "o el fitxer est fet malb." +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "E833: %s est xifrat i aquesta versi de Vim no suporta xifratge" + msgid " has been damaged (page size is smaller than minimum value).\n" msgstr " ha estat danyat (la mida de pgina s inferior al valor mnim).\n" #, c-format msgid "Using swap file \"%s\"" -msgstr "S'est utilitzant el fitxer d'intercanvi \"%s\"" +msgstr "S'utilitza el fitxer d'intercanvi \"%s\"" #, c-format msgid "Original file \"%s\"" @@ -3310,6 +3419,30 @@ msgstr "Fitxer original \"%s\"" msgid "E308: Warning: Original file may have been changed" msgstr "E308: Atenci: El fitxer original pot haver canviat" +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "El fitxer d'intercanvi est xifrat: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "\nSi vau entrar una nova clau de xifrat per no vau desar el fitxer," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "\nentreu la nova clau." + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "\nSi vau desar el fitxer desprs de canviar la clau, premeu Entrar per a" + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "\nusar la mateixa clau per al fitxer de text i per al fitxer d'intercanvi." + #, c-format msgid "E309: Unable to read block 1 from %s" msgstr "E309: No s'ha pogut llegir el bloc 1 de %s" @@ -3328,16 +3461,16 @@ msgstr "???FALTEN L #, c-format msgid "E310: Block 1 ID wrong (%s not a .swp file?)" -msgstr "E310: L'ID del bloc 1 no s correcta (%s no s un fitxer .swp?)" +msgstr "E310: L'ID del bloc 1 no s correcte (%s no s un fitxer .swp?)" msgid "???BLOCK MISSING" msgstr "???FALTA UN BLOC" msgid "??? from here until ???END lines may be messed up" -msgstr "??? Des d'aqu fins ???FINAL les lnies poden estar equivocades" +msgstr "??? Des d'aqu fins a ???FINAL les lnies poden ser incorrectes" msgid "??? from here until ???END lines may have been inserted/deleted" -msgstr "??? Des d'aqu fins ???FINAL hi pot haver lnies inserides/eliminades" +msgstr "??? Des d'aqu fins a ???FINAL hi pot haver lnies inserides/eliminades" msgid "???END" msgstr "???FINAL" @@ -3345,14 +3478,15 @@ msgstr "???FINAL" msgid "E311: Recovery Interrupted" msgstr "E311: S'ha interromput la recuperaci" -msgid "E312: Errors detected while recovering; look for lines starting with ???" -msgstr "E312: S'han detectat errors en la recuperaci; busqueu lnies amb ???" +msgid "" +"E312: Errors detected while recovering; look for lines starting with ???" +msgstr "E312: Errors durant la recuperaci; cerqueu lnies amb la marca ???" msgid "See \":help E312\" for more information." msgstr "Vegeu \":help E312\" per a ms informaci." msgid "Recovery completed. You should check if everything is OK." -msgstr "S'ha completat la recuperaci. Haurieu de revisar que tot sigui correcte." +msgstr "Recuperaci completada. Haureu de revisar que tot sigui correcte." msgid "" "\n" @@ -3361,17 +3495,21 @@ msgstr "" "\n" "(Potser voleu desar aquest fitxer amb un altre nom\n" -msgid "and run diff with the original file to check for changes)\n" -msgstr "i fer un diff amb el fitxer original per veure els canvis)\n" +msgid "and run diff with the original file to check for changes)" +msgstr "i fer un diff amb el fitxer original per a veure els canvis)" + +msgid "Recovery completed. Buffer contents equals file contents." +msgstr "Recuperaci completada. El buffer cont el mateix que el fitxer." msgid "" -"Delete the .swp file afterwards.\n" "\n" -msgstr "" -"Elimina el fitxer .swp tot seguit.\n" +"You may want to delete the .swp file now.\n" "\n" +msgstr "\nNormalment, ara haureu d'esborrar el fitxer .swp.\n\n" + +msgid "Using crypt key from swap file for the text file.\n" +msgstr "S'usa la clau de xifrat del fitxer .swp per al fitxer de text.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Fitxers d'intercanvi trobats:" @@ -3400,7 +3538,7 @@ msgid " [from Vim version 3.0]" msgstr " [del Vim versi 3.0]" msgid " [does not look like a Vim swap file]" -msgstr " [no sembla un fitxer d'intercanvi de Vim]" +msgstr " [no sembla un fitxer .swp de Vim]" msgid " file name: " msgstr " nom del fitxer: " @@ -3443,21 +3581,17 @@ msgstr "" " ID del procs: " msgid " (still running)" -msgstr " (encara funcionant)" +msgstr " (executant-se)" msgid "" "\n" " [not usable with this version of Vim]" -msgstr "" -"\n" -" [no usable amb aquesta versi de Vim]" +msgstr "\n [no usable amb aquesta versi del Vim]" msgid "" "\n" " [not usable on this computer]" -msgstr "" -"\n" -" [no usable en aquesta computadora]" +msgstr "\n [no usable en aquesta mquina]" msgid " [cannot be read]" msgstr " [no es pot llegir]" @@ -3466,7 +3600,7 @@ msgid " [cannot be opened]" msgstr " [no es pot obrir]" msgid "E313: Cannot preserve, there is no swap file" -msgstr "E313: No s'ha pogut preservar, no hi ha fitxer d'intercanvi" +msgstr "E313: No s'ha pogut preservar, no existeix cap fitxer d'intercanvi" msgid "File preserved" msgstr "S'ha preservat el fitxer" @@ -3483,7 +3617,7 @@ msgid "E316: ml_get: cannot find line %ld" msgstr "E316: ml_get: no s'ha trobat la lnia %ld" msgid "E317: pointer block id wrong 3" -msgstr "E317: Punter a la id d'un bloc incorrecte 3" +msgstr "E317: punter a id de bloc incorrecte 3" msgid "stack_idx should be 0" msgstr "stack_idx hauria de ser 0" @@ -3492,7 +3626,7 @@ msgid "E318: Updated too many blocks?" msgstr "E318: S'han actualitzat massa blocs?" msgid "E317: pointer block id wrong 4" -msgstr "E317: Punter a la id d'un bloc incorrecte 4" +msgstr "E317: Punter a id de bloc incorrecte 4" msgid "deleted block 1?" msgstr "s'ha eliminat el bloc 1?" @@ -3502,28 +3636,28 @@ msgid "E320: Cannot find line %ld" msgstr "E320: No s'ha trobat la lnia %ld" msgid "E317: pointer block id wrong" -msgstr "E317: Punter a la id d'un bloc incorrecte" +msgstr "E317: punter a id de bloc incorrecte" msgid "pe_line_count is zero" msgstr "po_line_count s zero" #, c-format msgid "E322: line number out of range: %ld past the end" -msgstr "E322: Nombre de lnia fora d'abast: %ld passat el final" +msgstr "E322: nmero de lnia fora de l'interval: %ld passat el final" #, c-format msgid "E323: line count wrong in block %ld" -msgstr "E323: Comptador de lnia incorrecte al bloc %ld" +msgstr "E323: nombre de lnies incorrecte al bloc %ld" msgid "Stack size increases" -msgstr "La mida de la pila s'incrementa" +msgstr "S'augmenta la mida de la pila" msgid "E317: pointer block id wrong 2" -msgstr "E317: Punter a la id d'un bloc incorrecte 2" +msgstr "E317: punter a id de bloc incorrecte 2" #, c-format msgid "E773: Symlink loop for \"%s\"" -msgstr "E773: Bucle d'enllaos simblics per a \"%s\"" +msgstr "E773: Enllaos simblics circulars per a \"%s\"" msgid "E325: ATTENTION" msgstr "E325: ATENCI" @@ -3531,9 +3665,7 @@ msgstr "E325: ATENCI msgid "" "\n" "Found a swap file by the name \"" -msgstr "" -"\n" -"S'ha trobat un fitxer d'intercanvi de nom \"" +msgstr "\nS'ha trobat un fitxer d'intercanvi amb nom \"" msgid "While opening file \"" msgstr "Mentre s'obria el fitxer \"" @@ -3541,28 +3673,20 @@ msgstr "Mentre s'obria el fitxer \"" msgid " NEWER than swap file!\n" msgstr " MS NOU que el fitxer d'intercanvi!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Un altre programa pot estar editant aquest mateix fitxer.\n" -" En aquest cas, aneu amb compte de no acabar amb dues\n" -" instncies diferents del mateix fitxer quan feu canvis.\n" +"(1) Un altre programa pot estar editant aquest mateix fitxer. Si s\n" +" aquest el cas, aneu amb compte de no acabar amb dues versions\n" +" diferents del mateix fitxer quan feu canvis. Sortiu, o continueu\n" +" amb precauci.\n" -msgid " Quit, or continue with caution.\n" -msgstr " Sortiu, o continueu amb precauci.\n" - -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) El Vim s'ha estrellat mentre s'editava aquest fitxer.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) El Vim es va estavellar mentre s'editava aquest fitxer.\n" msgid " If this is the case, use \":recover\" or \"vim -r " msgstr " En aquest cas, useu \":recover\" o b \"vim -r " @@ -3572,7 +3696,7 @@ msgid "" " to recover the changes (see \":help recovery\").\n" msgstr "" "\"\n" -" per recuperar els canvis (vegeu \":help recovery\").\n" +" per a recuperar els canvis (vegeu \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" msgstr " Si ja ho heu fet, elimineu el fitxer \"" @@ -3582,7 +3706,7 @@ msgid "" " to avoid this message.\n" msgstr "" "\"\n" -" per evitar aquest missatge.\n" +" per a evitar aquest missatge.\n" msgid "Swap file \"" msgstr "El fitxer d'intercanvi \"" @@ -3603,7 +3727,7 @@ msgid "" "&Quit\n" "&Abort" msgstr "" -"&Obrir noms-lectura\n" +"&Obrir amb noms lectura\n" "&Editar igualment\n" "&Recuperar\n" "&Sortir\n" @@ -3617,18 +3741,19 @@ msgid "" "&Quit\n" "&Abort" msgstr "" -"&Obrir noms-lectura\n" +"&Obrir amb noms lectura\n" "&Editar igualment\n" "&Recuperar\n" -"E&liminar-lo\n" +"E&liminar\n" "&Sortir\n" "&Avortar" msgid "E326: Too many swap files found" msgstr "E326: S'han trobat massa fitxers d'intercanvi" +# todo: menu path msgid "E327: Part of menu-item path is not sub-menu" -msgstr "E327: Part de l'ubicaci del men no s submen" +msgstr "E327: Un component de l'tem de men no s un submen" msgid "E328: Menu only exists in another mode" msgstr "E328: El men noms existeix en un altre mode" @@ -3637,21 +3762,20 @@ msgstr "E328: El men msgid "E329: No menu \"%s\"" msgstr "E329: No hi ha cap men \"%s\"" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" -msgstr "E792: Nom de men buit" +msgstr "E792: Nom de men en blanc" +# :menu Eines.Plecs :e msgid "E330: Menu path must not lead to a sub-menu" -msgstr "E330: L'ubicaci del men no pot portar a un submen" +msgstr "E330: L'tem de men no pot ser un submen" msgid "E331: Must not add menu items directly to menu bar" -msgstr "E331: No es poden afegir tems de men directament a la barra de men" +msgstr "E331: No s possible afegir tems directament a la barra de men" +# :menu Fitxer.-Sep-.Foo.Foo : msgid "E332: Separator cannot be part of a menu path" -msgstr "E332: Un separador no pot formar part de l'ubicaci de men" +msgstr "E332: Un component de l'tem de men s un separador" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3660,10 +3784,10 @@ msgstr "" "--- Mens ---" msgid "Tear off this menu" -msgstr "Estripa aquest men" +msgstr "Desenganxa aquest men" msgid "E333: Menu path must lead to a menu item" -msgstr "E333: L'ubicaci de men ha de portar a un tem de men" +msgstr "E333: L'tem de men ha de portar a un element" #, c-format msgid "E334: Menu not found: %s" @@ -3671,10 +3795,10 @@ msgstr "E334: No s'ha trobat el men #, c-format msgid "E335: Menu not defined for %s mode" -msgstr "E335: El men no est definit pel mode %s" +msgstr "E335: El men no est definit per al mode %s" msgid "E336: Menu path must lead to a sub-menu" -msgstr "E336: L'ubicaci de men ha de portar a un submen" +msgstr "E336: L'tem de men ha de portar a un submen" msgid "E337: Menu not found - check menu names" msgstr "E337: No s'ha trobat el men - reviseu els noms dels mens" @@ -3734,32 +3858,36 @@ msgstr "" "&Cancella" msgid "Select Directory dialog" -msgstr "Dileg de selecci de directori" +msgstr "Selecci de directori" msgid "Save File dialog" -msgstr "Dileg de desar fitxer" +msgstr "Desar fitxer" msgid "Open File dialog" -msgstr "Dileg d'obrir fitxer" +msgstr "Obrir fitxer" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: No hi ha un explorador de fitxers en mode consola" +msgstr "E338: L'explorador de fitxers no est disponible en mode consola" msgid "E766: Insufficient arguments for printf()" -msgstr "E766: Falten arguments per a printf()" +msgstr "E766: Falten arguments a printf()" + +msgid "E807: Expected Float argument for printf()" +msgstr "E807: S'esperava un argument Float a printf()" msgid "E767: Too many arguments to printf()" -msgstr "E767: Sobren arguments per a printf()" +msgstr "E767: Sobren arguments a printf()" msgid "W10: Warning: Changing a readonly file" -msgstr "W10: Atenci: S'est canviant un fitxer de noms lectura" +msgstr "W10: Atenci: S'est modificant un fitxer de noms lectura" -msgid "Type number or click with mouse (<Enter> cancels): " -msgstr "Introduu un nmero o feu clic amb el ratol (<Entrar> per a cancellar): " +# z= +msgid "Type number and <Enter> or click with mouse (empty cancels): " +msgstr "Entreu un nmero o feu clic (<Entrar> per a cancellar): " -msgid "Choice number (<Enter> cancels): " -msgstr "Trieu un nmero (<Entrar> per a cancellar): " +# z= (sense mouse) +msgid "Type number and <Enter> (empty cancels): " +msgstr "Entreu un nmero (<Entrar> per a cancellar): " msgid "1 more line" msgstr "1 lnia ms" @@ -3781,14 +3909,6 @@ msgstr " (Interromput)" msgid "Beep!" msgstr "Bip!" -msgid "Vim: preserving files...\n" -msgstr "Vim: preservant els fitxers...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Finalitzat.\n" - -#, c-format msgid "ERROR: " msgstr "ERROR: " @@ -3809,7 +3929,7 @@ msgstr "" "\n" msgid "E340: Line is becoming too long" -msgstr "E340: La lnia s'est tornant massa llarga" +msgstr "E340: La lnia s'est fent massa llarga" #, c-format msgid "E341: Internal error: lalloc(%ld, )" @@ -3817,11 +3937,11 @@ msgstr "E341: Error intern: lalloc(%ld, )" #, c-format msgid "E342: Out of memory! (allocating %lu bytes)" -msgstr "E342: Memria exhaurida! (assignant %lu octets)" +msgstr "E342: Memria exhaurida! (en assignar %lu octets)" #, c-format msgid "Calling shell to execute: \"%s\"" -msgstr "S'est cridant l'intrpret d'ordres per executar: \"%s\"" +msgstr "Es crida l'intrpret d'ordres per a executar: \"%s\"" msgid "E545: Missing colon" msgstr "E545: Falta un carcter \":\"" @@ -3838,87 +3958,82 @@ msgstr "E548: S'esperava un d msgid "E549: Illegal percentage" msgstr "E549: Percentatge illegal" -msgid "Enter encryption key: " -msgstr "Introduu la clau de xifrat: " - -msgid "Enter same key again: " -msgstr "Introduu la mateixa clau un altre cop: " - -msgid "Keys don't match!" -msgstr "La claus no coincideixen!" +msgid "E854: path too long for completion" +msgstr "E854: la ubicaci s massa llarga per a fer compleci" #, c-format -msgid "E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'." -msgstr "E343: Path no vlid: '**[nm]' ha d'estar al final del path, o seguit de '%s'" +msgid "" +"E343: Invalid path: '**[number]' must be at the end of the path or be " +"followed by '%s'." +msgstr "E343: Ubicaci no vlida: '**[nm]' ha d'anar al final de la ubicaci, o anar seguit de '%s'" #, c-format msgid "E344: Can't find directory \"%s\" in cdpath" -msgstr "E344: No s'ha trobat el directori \"%s\" en el cdpath" +msgstr "E344: No s'ha trobat el directori \"%s\" a cdpath" #, c-format msgid "E345: Can't find file \"%s\" in path" -msgstr "E345: No s'ha trobat el fitxer \"%s\" en el path" +msgstr "E345: No s'ha trobat el fitxer \"%s\" a path" #, c-format msgid "E346: No more directory \"%s\" found in cdpath" -msgstr "E346: No s'ha trobat cap ms directori \"%s\" en el cdpath" +msgstr "E346: No s'ha trobat cap ms directori \"%s\" a cdpath" #, c-format msgid "E347: No more file \"%s\" found in path" -msgstr "E347: No s'ha trobat cap ms fitxer \"%s\" en el path" - -#. Get here when the server can't be found. -msgid "Cannot connect to Netbeans #2" -msgstr "No s'ha pogut connectar amb Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "No s'ha pogut connectar amb Netbeans" +msgstr "E347: No s'ha trobat cap ms fitxer \"%s\" a path" #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" -msgstr "E668: Mode d'accs incorrecte per al fitxer d'info de la connexi NetBeans: \"%s\"" - -msgid "read from Netbeans socket" -msgstr "lectura d'un socket Netbeans" +msgstr "E668: El fitxer de connexi NetBeans t permisos incorrectes: \"%s\"" #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: S'ha perdut la connexi NetBeans per al buffer %ld" -msgid "E505: " -msgstr "E505:" +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: aquesta interfcie grfica no suporta NetBeans" + +msgid "E511: netbeans already connected" +msgstr "E511: NetBeans ja est connectat" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s s de noms lectura (afegiu ! per a forar)" + +msgid "E349: No identifier under cursor" +msgstr "E349: El cursor no es troba sobre un identificador" msgid "E774: 'operatorfunc' is empty" -msgstr "E774: 'operatorfunc' no cont res" +msgstr "E774: 'operatorfunc' est en blanc" msgid "E775: Eval feature not available" -msgstr "E775: La funci eval no est disponible" +msgstr "E775: La caracterstica eval no est disponible" msgid "Warning: terminal cannot highlight" -msgstr "Atenci: el terminal no suporta ressalt" +msgstr "Atenci: el terminal no suporta ressaltat" msgid "E348: No string under cursor" -msgstr "E348: No hi ha cap cadena sota el cursor" - -msgid "E349: No identifier under cursor" -msgstr "E349: No hi ha cap identificador sota el cursor" +msgstr "E348: El cursor no es troba sobre una cadena" msgid "E352: Cannot erase folds with current 'foldmethod'" -msgstr "E352: No es poden eliminar plecs amb el 'foldmethod' actual" +msgstr "E352: No es poden eliminar plecs amb el mtode actual" msgid "E664: changelist is empty" -msgstr "E664: La llista de canvis no cont res" +msgstr "E664: La llista de canvis est buida" +# g; msgid "E662: At start of changelist" -msgstr "E662: A l'inici de la llista de canvis" +msgstr "E662: Us trobeu a l'inici de la llista de canvis" +# g, msgid "E663: At end of changelist" -msgstr "E663: A l'inici de la llista de canvis" +msgstr "E663: Us trobeu al final de la llista de canvis" -# amplada 53 carcters -msgid "Type :quit<Enter> to exit Vim" -msgstr "Feu :quit<Entrar> per sortir" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "Escriviu :qa! i premeu <Entrar> per a abandonar els canvis i sortir" +# la substituci s ">" o "<" #, c-format msgid "1 line %sed 1 time" msgstr "1 lnia %sada 1 vegada" @@ -3949,9 +4064,8 @@ msgstr "%ld l msgid "E748: No previously used register" msgstr "E748: No hi ha cap registre usat amb anterioritat" -#. must display the prompt msgid "cannot yank; delete anyway" -msgstr "no s'ha pogut copiar; voleu elimiar el text de totes maneres" +msgstr "no s'ha pogut copiar; voleu eliminar el text de totes maneres" msgid "1 line changed" msgstr "1 lnia canviada" @@ -3962,7 +4076,7 @@ msgstr "%ld l #, c-format msgid "freeing %ld lines" -msgstr "alliberant %ld lnies" +msgstr "s'alliberen %ld lnies" msgid "block of 1 line yanked" msgstr "bloc d'1 lnia copiat" @@ -3982,7 +4096,6 @@ msgstr "%ld l msgid "E353: Nothing in register %s" msgstr "E353: No hi ha res en el registre %s" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -3991,9 +4104,8 @@ msgstr "" "--- Registres ---" msgid "Illegal register name" -msgstr "El nom de registre s illegal" +msgstr "Nom de registre illegal" -#, c-format msgid "" "\n" "# Registers:\n" @@ -4005,25 +4117,36 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: El tipus de registre %d s desconegut" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "E883: els registres d'expressi i de patr de cerca no poden contenir ms d'una lnia" + #, c-format msgid "%ld Cols; " msgstr "%ld Cols; " +# v g C-g #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Selecci %s%ld de %ld Lnies; %ld de %ld Paraules; %ld de %ld Octets" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Seleccionat %s%ld de %ld lnies; %lld de %lld paraules; %lld de %lld octets" #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes" -msgstr "Selecci %s%ld de %ld Lnies; %ld de %ld Paraules; %ld de %ld Carcters; %ld de %ld Octets" +msgid "" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "Seleccionat %s%ld de %ld lnies; %lld de %lld paraules; %lld de %lld carcters; %lld de %lld octets" +# g G-c #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Col %s de %s; Lnia %ld de %ld; Paraula %ld de %ld; Octet %ld de %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Columna %s de %s; lnia %ld de %ld; paraula %lld de %lld; octet %lld de %lld" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld" -msgstr "Col %s de %s; Lnia %ld de %ld; Paraula %ld de %ld; Carcter %ld de %ld; Octet %ld de %ld" +msgid "" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" +msgstr "Columna %s de %s; lnia %ld de %ld; paraula %lld de %lld; carcter %lld de %lld; octet %lld de %lld" #, c-format msgid "(+%ld for BOM)" @@ -4042,38 +4165,54 @@ msgid "E519: Option not supported" msgstr "E519: L'opci no est suportada" msgid "E520: Not allowed in a modeline" -msgstr "E520: No est perms en una lnia de mode" +msgstr "E520: No perms en una lnia de mode" + +# :set t_kb= +# :set t_kb +msgid "E846: Key code not set" +msgstr "E846: Codi de tecla no definit" msgid "E521: Number required after =" -msgstr "E521: Es requereix un nmero desprs de =" +msgstr "E521: Falta un nmero desprs de =" msgid "E522: Not found in termcap" -msgstr "E522: No s'ha trobat a la base de dades termcap" +msgstr "E522: No trobat a la base de dades termcap" #, c-format msgid "E539: Illegal character <%s>" msgstr "E539: Carcter illegal <%s>" +# error intern +#, c-format +msgid "For option %s" +msgstr "Per a l'opci %s" + msgid "E529: Cannot set 'term' to empty string" -msgstr "E529: No es pot definir 'term' com a cadena buida" +msgstr "E529: No s possible assignar 'term' a una cadena buida" msgid "E530: Cannot change term in GUI" -msgstr "E530: No es pot canviar de terminal en mode GUI" +msgstr "E530: No es pot canviar el terminal en mode GUI" msgid "E531: Use \":gui\" to start the GUI" -msgstr "E531: Useu \":gui\" per ininciar l'interfcie d'usuari grfica" +msgstr "E531: Useu \":gui\" per a iniciar la interfcie d'usuari grfica" msgid "E589: 'backupext' and 'patchmode' are equal" -msgstr "E589: Les opcions 'backupext' i 'patchmode' coincideixen" +msgstr "E589: Els parmetres 'backupext' i 'patchmode' coincideixen" + +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: Conflicte amb el valor de 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: Conflicte amb el valor de 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" -msgstr "E617: L'interfcie GTK+ 2 no permet canviar la codificaci" +msgstr "E617: La interfcie GTK+ 2 no permet canviar la codificaci" msgid "E524: Missing colon" msgstr "E524: Falta un carcter \":\"" msgid "E525: Zero length string" -msgstr "E525: La llargada de la cadena s zero" +msgstr "E525: Cadena de longitud zero" #, c-format msgid "E526: Missing number after <%s>" @@ -4091,17 +4230,18 @@ msgstr "E595: Cont msgid "E596: Invalid font(s)" msgstr "E596: Fosa no vlida" +# necessita +xfontset msgid "E597: can't select fontset" -msgstr "E597: No s'ha pogut seleccionar el conjunt de tipus" +msgstr "E597: No s'ha pogut seleccionar el conjunt de foses" msgid "E598: Invalid fontset" -msgstr "E598: El conjunt de tipus de lletra no s vlid" +msgstr "E598: El conjunt de foses no s vlid" msgid "E533: can't select wide font" -msgstr "E533: No s'ha pogut seleccionar una fosa ampla" +msgstr "E533: No s'ha pogut seleccionar la fosa per a carcters amples" msgid "E534: Invalid wide font" -msgstr "E534: Fosa ampla no vlida" +msgstr "E534: La fosa per a carcters amples no s vlida" #, c-format msgid "E535: Illegal character after <%c>" @@ -4112,25 +4252,25 @@ msgstr "E536: Es requereix una coma" #, c-format msgid "E537: 'commentstring' must be empty or contain %s" -msgstr "E537: L'opci 'commentstring' ha d'estar indefinida o contenir %s" +msgstr "E537: 'commentstring' ha d'estar en blanc o contenir %s" msgid "E538: No mouse support" -msgstr "E538: No hi ha suport per ratol" +msgstr "E538: No hi ha suport per a ratol" msgid "E540: Unclosed expression sequence" -msgstr "E540: La seqncia d'expressions no est acabada" +msgstr "E540: Seqncia d'expressions no tancada" msgid "E541: too many items" -msgstr "E541: Hi han massa tems" +msgstr "E541: massa tems" msgid "E542: unbalanced groups" -msgstr "E542: Grups desequilibrats" +msgstr "E542: grups desequilibrats" msgid "E590: A preview window already exists" -msgstr "E590: Ja hi ha una finestra de vista prvia" +msgstr "E590: Ja existeix una finestra de vista prvia" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" -msgstr "W17: L'rab requereix UTF-8, feu ':set encoding=utf-8'" +msgstr "W17: L'idioma rab requereix UTF-8, feu ':set encoding=utf-8'" #, c-format msgid "E593: Need at least %d lines" @@ -4142,15 +4282,19 @@ msgstr "E594: Es necessiten com a m #, c-format msgid "E355: Unknown option: %s" -msgstr "E355: L'opci s desconeguda: %s" +msgstr "E355: Opci desconeguda: %s" + +#, c-format +msgid "E521: Number required: &%s = '%s'" +msgstr "E521: Fa falta un nmero: &%s = '%s'" +# :set termcap msgid "" "\n" "--- Terminal codes ---" -msgstr "" -"\n" -"--- Codis de terminal ---" +msgstr "\n--- Codis del terminal ---" +# :setglobal msgid "" "\n" "--- Global option values ---" @@ -4158,6 +4302,7 @@ msgstr "" "\n" "--- Valors de les opcions globals ---" +# :setlocal msgid "" "\n" "--- Local option values ---" @@ -4165,6 +4310,7 @@ msgstr "" "\n" "--- Valors de les opcions locals ---" +# :set all msgid "" "\n" "--- Options ---" @@ -4173,16 +4319,17 @@ msgstr "" "--- Opcions ---" msgid "E356: get_varp ERROR" -msgstr "E356: Error en get_varp()" +msgstr "E356: Error a get_varp" #, c-format msgid "E357: 'langmap': Matching character missing for %s" -msgstr "E357: 'langmap': No s'ha trobat el carcter corresponent a %s" +msgstr "E357: 'langmap': Cap carcter coincident per a %s" #, c-format msgid "E358: 'langmap': Extra characters after semicolon: %s" msgstr "E358: 'langmap': Sobren carcters desprs del punt i coma: %s" +# ... <biblioteca> msgid "cannot open " msgstr "no s'ha pogut obrir " @@ -4190,11 +4337,11 @@ msgid "VIM: Can't open window!\n" msgstr "VIM: No s'ha pogut obrir la finestra!\n" msgid "Need Amigados version 2.04 or later\n" -msgstr "Es requereix Amigados versi 2.04 o posterior\n" +msgstr "Es necessita Amigados, versi 2.04 o posterior\n" #, c-format msgid "Need %s version %ld\n" -msgstr "Es requereix %s versi %ld\n" +msgstr "Es necessita %s, versi %ld\n" msgid "Cannot open NIL:\n" msgstr "No s'ha pogut obrir NIL:\n" @@ -4212,10 +4359,10 @@ msgstr "no s'ha pogut canviar el mode de consola ?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: no s una consola??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" -msgstr "E360: No s'ha pogut executar l'intrpret d'ordres amb l'opci -f" +msgstr "E360: No s possible executar l'intrpret conjuntament amb l'opci -f" +# ... shell|<cmd> msgid "Cannot execute " msgstr "No s'ha pogut executar " @@ -4226,7 +4373,7 @@ msgid " returned\n" msgstr " ha retornat\n" msgid "ANCHOR_BUF_SIZE too small." -msgstr "un valor ANCHOR_BUF_SIZE massa petit." +msgstr "Valor de ANCHOR_BUF_SIZE massa petit." msgid "I/O ERROR" msgstr "ERROR d'E/S" @@ -4234,13 +4381,11 @@ msgstr "ERROR d'E/S" msgid "Message" msgstr "Missatge" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "L'opci 'columns' no s 80, no es poden executar ordres externes" - msgid "E237: Printer selection failed" -msgstr "E237: La selecci d'impressora ha fallat" +msgstr "E237: Error en seleccionar la impressora" -# a IMPRESSORA a PORT ? +# todo +# <impressora> <port> #, c-format msgid "to %s on %s" msgstr "a %s a %s" @@ -4255,81 +4400,78 @@ msgstr "E238: Error d'impressi #, c-format msgid "Printing '%s'" -msgstr "S'est imprimint '%s'" +msgstr "Imprimint '%s'" #, c-format msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" -msgstr "E244: Conjunt de carcters \"%s\" illegal en el tipus \"%s\"" - -#, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Carcter '%c' illegal en el tipus \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: S'ha rebut un doble senyal, sortint\n" +msgstr "E244: Conjunt de carcters \"%s\" illegal a la fosa \"%s\"" #, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: S'ha rebut un senyal letal %s\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Tipus de qualitat \"%s\" illegal a la fosa \"%s\"" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: S'ha rebut un senyal letal\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Carcter '%c' illegal a la fosa \"%s\"" -# display #, c-format msgid "Opening the X display took %ld msec" -msgstr "S'ha trigat %ld mseg en obrir el display X" +msgstr "Obrir la pantalla X ha tardat %ld mseg" msgid "" "\n" "Vim: Got X error\n" -msgstr "" -"\n" -"Vim: Error de X\n" +msgstr "\nVim: Error del sistema de finestres X\n" -# display msgid "Testing the X display failed" -msgstr "Ha fallat la comprovaci del display X" +msgstr "Error en realitzar els tests de la pantalla X" -# display msgid "Opening the X display timed out" -msgstr "S'ha esgotat el temps mentre es tractava d'obrir el display X" +msgstr "Temps esgotat intentant obrir la pantalla X" msgid "" "\n" -"Cannot execute shell " -msgstr "" +"Could not get security context for " +msgstr "\nError en obtenir el context de seguretat per a " + +msgid "" "\n" -"No s'ha pogut executar la shell " +"Could not set security context for " +msgstr "\nError en establir el context de seguretat per a " + +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Error en establir el context de seguretat %s per a %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Error en obtenir el context de seguretat %s per a %s. Eliminat!" msgid "" "\n" "Cannot execute shell sh\n" -msgstr "" -"\n" -"No s'ha pogut executar la shell sh\n" +msgstr "\nNo s'ha pogut executar l'intrpret sh\n" +# <codi de sortida> msgid "" "\n" "shell returned " -msgstr "" -"\n" -"la shell ha retornat " +msgstr "\nl'intrpret ha retornat " msgid "" "\n" "Cannot create pipes\n" -msgstr "" -"\n" -"No s'han pogut crear canonades\n" +msgstr "\nNo es poden crear canonades\n" msgid "" "\n" "Cannot fork\n" -msgstr "" +msgstr "\nNo es pot fer fork\n" + +msgid "" "\n" -"No s'ha pogut bifurcar\n" +"Cannot execute shell " +msgstr "\nNo es pot executar l'intrpret " msgid "" "\n" @@ -4339,28 +4481,27 @@ msgstr "" "L'ordre ha finalitzat\n" msgid "XSMP lost ICE connection" -msgstr "XSMP: s'ha perdut la connexi ICE" +msgstr "l'XSMP ha perdut la connexi ICE" #, c-format msgid "dlerror = \"%s\"" msgstr "dlerror = \"%s\"" -# display msgid "Opening the X display failed" -msgstr "Ha fallat l'obertura del display X" +msgstr "Error en obrir la pantalla X" msgid "XSMP handling save-yourself request" -msgstr "XSMP: s'est duent a terme la petici save-yourself" +msgstr "s'executa el procediment XSMP save-yourself" msgid "XSMP opening connection" -msgstr "XSMP: obrint la connexi" +msgstr "s'obre la connexi XSMP" msgid "XSMP ICE connection watch failed" -msgstr "XSMP: Ha fallat l'inspecci de la connexi ICE" +msgstr "ha fallat la supervisi de la connexi XSMP ICE" #, c-format msgid "XSMP SmcOpenConnection failed: %s" -msgstr "XSMP: Ha fallat la rutina SmcOpenConnection: %s" +msgstr "ha fallat la rutina XSMP SmcOpenConnection: %s" msgid "At line" msgstr "A la lnia" @@ -4374,13 +4515,9 @@ msgstr "Error del VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "No s'han pogut reassignar els punters de funcions a la DLL!" -#, c-format -msgid "shell returned %d" -msgstr "la shell ha retornat %d" - #, c-format msgid "Vim: Caught %s event\n" -msgstr "Vim: S'ha rebut un event %s\n" +msgstr "Vim: S'ha atrapat un esdeveniment %s\n" msgid "close" msgstr "de finalitzaci" @@ -4404,7 +4541,11 @@ msgstr "" "Vegeu :help win32-vimrun per a ms informaci." msgid "Vim Warning" -msgstr "Vim Atenci" +msgstr "Vim: Atenci" + +#, c-format +msgid "shell returned %d" +msgstr "l'intrpret ha retornat %d" #, c-format msgid "E372: Too many %%%c in format string" @@ -4430,7 +4571,7 @@ msgid "E377: Invalid %%%c in format string" msgstr "E377: %%%c no vlid a la cadena de format" msgid "E378: 'errorformat' contains no pattern" -msgstr "E378: L'opci 'errorformat' no cont cap patr" +msgstr "E378: 'errorformat' no cont cap patr" msgid "E379: Missing or empty directory name" msgstr "E379: Falta un nom de directori" @@ -4438,6 +4579,15 @@ msgstr "E379: Falta un nom de directori" msgid "E553: No more items" msgstr "E553: No hi ha ms tems" +msgid "E924: Current window was closed" +msgstr "E924: S'ha tancat la finestra actual" + +msgid "E925: Current quickfix was changed" +msgstr "E925: La llista quickfix ha canviat" + +msgid "E926: Current location list was changed" +msgstr "E926: La llista d'ubicacions ha canviat" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d de %d)%s%s: " @@ -4445,21 +4595,29 @@ msgstr "(%d de %d)%s%s: " msgid " (line deleted)" msgstr " (lnia eliminada)" +# subst: " " | "> " +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sllista d'errors %d de %d; %d errors" + msgid "E380: At bottom of quickfix stack" -msgstr "E380: Baix de la pila quickfix" +msgstr "E380: A baix de la pila quickfix" msgid "E381: At top of quickfix stack" -msgstr "E381: Dalt de la pila quickfix" +msgstr "E381: A dalt de la pila quickfix" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "llista d'errors %d de %d; %d errors" +msgid "No entries" +msgstr "No hi ha entrades" msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: No s'ha pogut escriure, l'opci 'buftype' no est definida" +msgstr "E382: No es pot escriure, 'buftype' est establert" + +# :browse :cfile +msgid "Error file" +msgstr "Fitxer d'errors" msgid "E683: File name missing or invalid pattern" -msgstr "E683: Falta el nom de fitxer o el patr no s vlid" +msgstr "E683: Falta un nom de fitxer o el patr no s vlid" #, c-format msgid "Cannot open file \"%s\"" @@ -4469,24 +4627,21 @@ msgid "E681: Buffer is not loaded" msgstr "E681: El buffer no est carregat" msgid "E777: String or List expected" -msgstr "E777: S'esperava una cadena o una llista" +msgstr "E777: S'esperava String o List" #, c-format msgid "E369: invalid item in %s%%[]" msgstr "E369: tem no vlid a %s%%[]" -msgid "E339: Pattern too long" -msgstr "E339: El patr s massa llarg" - -msgid "E50: Too many \\z(" -msgstr "E50: Sobren \\z(" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: Sobren %s(" +msgid "E769: Missing ] after %s[" +msgstr "E769: Falta un ] desprs de %s[" -msgid "E52: Unmatched \\z(" -msgstr "E52: \\z( desequilibrat" +msgid "E944: Reverse range in character class" +msgstr "E944: Interval en ordre invers a la classe de carcter" + +msgid "E945: Range too large in character class" +msgstr "E945: Interval massa ample a la classe de carcter" #, c-format msgid "E53: Unmatched %s%%(" @@ -4500,14 +4655,46 @@ msgstr "E54: %s( desequilibrat" msgid "E55: Unmatched %s)" msgstr "E55: %s) desequilibrat" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( no est perms aqu" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 et al. no estan permesos aqu" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: Falta un ] desprs de %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] buit" + +msgid "E65: Illegal back reference" +msgstr "E65: Referncia enrere illegal" + +msgid "E339: Pattern too long" +msgstr "E339: El patr s massa llarg" + +msgid "E50: Too many \\z(" +msgstr "E50: Sobren \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Sobren %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: \\z( desequilibrat" + #, c-format msgid "E59: invalid character after %s@" -msgstr "E59: Hi ha un carcter no vlid desprs de %s@" +msgstr "E59: carcter no vlid desprs de %s@" +# complex braces #, c-format msgid "E60: Too many complex %s{...}s" -msgstr "E60: La construcci %s{...} s massa complexa" +msgstr "E60: Massa %s{...}s" +# a\{}\{} #, c-format msgid "E61: Nested %s*" msgstr "E61: %s* imbricats" @@ -4517,62 +4704,121 @@ msgid "E62: Nested %s%c" msgstr "E62: %s%c imbricats" msgid "E63: invalid use of \\_" -msgstr "E63: s no vlid de \\_" +msgstr "E63: s invlid de \\_" #, c-format msgid "E64: %s%c follows nothing" -msgstr "E64: No ha ha res abans de %s%c" +msgstr "E64: %s%c no segueix res" -msgid "E65: Illegal back reference" -msgstr "E65: Referncia illegal a l'element anterior" +msgid "E68: Invalid character after \\z" +msgstr "E68: Carcter invlid desprs de \\z" -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( no est perms aqu" +#, c-format +msgid "E678: Invalid character after %s%%[dxouU]" +msgstr "E678: Carcter invlid desprs de %s%%[dxouU]" -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 et al. no estan permesos aqu" +#, c-format +msgid "E71: Invalid character after %s%%" +msgstr "E71: Carcter invlid desprs de %s%%" -msgid "E68: Invalid character after \\z" -msgstr "E68: Hi ha un carcter no vlid desprs de \\z" +#, c-format +msgid "E554: Syntax error in %s{...}" +msgstr "E554: Error de sintaxi a %s{...}" + +msgid "External submatches:\n" +msgstr "Coincidncies parcials externes:\n" #, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: Falta un ] desprs de %s%%[" +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA) no s possible repetir %s" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "E864: \\%#= ha d'anar seguit de 0, 1 o 2. Es canvia al motor automtic." + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Es canvia al motor d'ER amb backtracking per al patr: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) final prematur de l'expressi regular" #, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: Element %s%%[] buit" +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA) %c mal collocat" #, c-format -msgid "E678: Invalid character after %s%%[dxouU]" -msgstr "E678: Carcter invlid desprs de %s%%[dxouU]" +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA) Classe de carcter invlida: %ld" #, c-format -msgid "E71: Invalid character after %s%%" -msgstr "E71: Hi ha un carcter invlid desprs de %s%%" +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Operador desconegut '\\z%c'" #, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: Falta un ] desprs de %s[" +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Operador desconegut '\\%%%c'" + +# todo +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Error en construir l'NFA amb classe d'equivalncia!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Operador desconegut '\\@%c'" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA) Error en llegir els lmits de repetici" + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA) Diverses especificacions de multiplicitat seguides !" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA) Sobren '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA) Sobren \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA) parntesi sense tancar" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) No es poden treure elements de la pila !" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "E875: (NFA) (En convertir de postfix a NFA), la pila cont massa estats" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (NFA) Espai insuficient per a desar l'NFA" + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) Memria insuficient per a recrrer la branca!" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "No es pot obrir un fitxer temporal de logs, s'escriu a stderr ... " #, c-format -msgid "E554: Syntax error in %s{...}" -msgstr "E554: Error de sintaxi a %s{...}" +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) NO ES POT OBRIR %s !" -msgid "External submatches:\n" -msgstr "Subcoincidncies externes:\n" +msgid "Could not open temporary log file for writing " +msgstr "Error en obrir un fitxer temporal per a logs " +# gR msgid " VREPLACE" msgstr " SUBSTITUIRV" msgid " REPLACE" msgstr " SUBSTITUIR" -# En el mode d'escriptura de dreta a esquerra -# surt el missatge REVERSE INSERT +# mode d'escriptura de dreta a esquerra: REVERSE INSERT msgid " REVERSE" msgstr " INVERS" +# i msgid " INSERT" msgstr " INSERIR" @@ -4591,9 +4837,6 @@ msgstr " Hebreu" msgid " Arabic" msgstr " rab" -msgid " (lang)" -msgstr " (lang)" - msgid " (paste)" msgstr " (enganxar)" @@ -4610,10 +4853,10 @@ msgid " SELECT" msgstr " SELECCIONAR" msgid " SELECT LINE" -msgstr " SELECCI LNIA" +msgstr " SELECCIONAR LNIA" msgid " SELECT BLOCK" -msgstr " SELECCI BLOC" +msgstr " SELECCIONAR BLOC" msgid "recording" msgstr "enregistrant" @@ -4634,20 +4877,23 @@ msgid "E386: Expected '?' or '/' after ';'" msgstr "E386: S'esperava '?' o '/' desprs de ';'" msgid " (includes previously listed match)" -msgstr " (inclou resultats llistats anteriorment)" +msgstr " (inclou resultats mostrats anteriorment)" -#. cursor at status line +# :checkpath +# :checkpath! msgid "--- Included files " msgstr "--- Fitxers inclosos " +# Included files ... not found ... in path msgid "not found " -msgstr "no s'ha trobat" +msgstr "no trobats " +# todo: path msgid "in path ---\n" -msgstr "en el path ---\n" +msgstr "al path ---\n" msgid " (Already listed)" -msgstr " (Ja s'havia llistat)" +msgstr " (Ja llistat)" msgid " NOT FOUND" msgstr " NO TROBAT" @@ -4656,6 +4902,8 @@ msgstr " NO TROBAT" msgid "Scanning included file: %s" msgstr "Examinant el fitxer incls: %s" +# :isearch /BAR/ +# :checkpath! #, c-format msgid "Searching included file %s" msgstr "Cercant al fitxer incls %s" @@ -4667,7 +4915,7 @@ msgid "All included files were found" msgstr "S'han trobat tots els fitxers inclosos" msgid "No included files" -msgstr "No hi han fitxers inclosos" +msgstr "No hi ha fitxers inclosos" msgid "E388: Couldn't find definition" msgstr "E388: No s'ha trobat la definici" @@ -4675,6 +4923,11 @@ msgstr "E388: No s'ha trobat la definici msgid "E389: Couldn't find pattern" msgstr "E389: No s'ha trobat el patr" +# viminfo +msgid "Substitute " +msgstr " (substituci)" + +# Last <Substitute> Search Pattern #, c-format msgid "" "\n" @@ -4682,58 +4935,104 @@ msgid "" "~" msgstr "" "\n" -"# ltim %sPatr de Cerca:\n" +"# ltim patr de cerca%s:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Error de format en el fitxer d'ortografia" +msgid "E756: Spell checking is not enabled" +msgstr "E756: La comprovaci ortogrfica no est activada" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Atenci: No s'ha trobat \"%s_%s.spl\" ni \"%s_ascii.spl\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Atenci: No s'ha trobat \"%s.%s.spl\" ni \"%s.ascii.spl\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: L'ordre automtica SpellFileMissing ha eliminat el buffer" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Atenci: no hi ha suport per a la regi %s" + +msgid "Sorry, no suggestions" +msgstr "No hi ha suggeriments" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Noms hi ha %ld suggeriments" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Canviar \"%.*s\" per:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: No hi ha cap correcci prvia" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: No trobat: %s" msgid "E758: Truncated spell file" msgstr "E758: Fitxer d'ortografia truncat" #, c-format msgid "Trailing text in %s line %d: %s" -msgstr "Text sobrant a %s lnia %d: %s" +msgstr "Text sobrer a %s, lnia %d: %s" #, c-format msgid "Affix name too long in %s line %d: %s" -msgstr "El nom de l'afix s massa llarg a %s lnia %d: %s" +msgstr "Nom d'afix s massa llarg a %s, lnia %d: %s" msgid "E761: Format error in affix file FOL, LOW or UPP" msgstr "E761: Error de format en el fitxer d'afixos FOL, LOW o UPP" msgid "E762: Character in FOL, LOW or UPP is out of range" -msgstr "E762: Carcter a FOL, LOW o UPP fora d'abast" +msgstr "E762: Carcter a FOL, LOW o UPP fora de l'interval" msgid "Compressing word tree..." msgstr "Comprimint l'arbre de paraules..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: La correcci ortogrfica no est activada" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Atenci: No s'ha trobat la llista de paraules \"%s.%s.spl\" o \"%s.ascii.spl\"" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Llegint el fitxer d'ortografia \"%s\"" msgid "E757: This does not look like a spell file" -msgstr "E757: Aix no t pinta de ser un fitxer d'ortografia" +msgstr "E757: No s un fitxer d'ortografia" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: Fitxer d'ortografia vell, ha de ser actualitzat" +msgstr "E771: Fitxer d'ortografia obsolet, ha de ser actualitzat" msgid "E772: Spell file is for newer version of Vim" -msgstr "E772: El fitxer d'ortografia s per a una versi ms recent del Vim" +msgstr "E772: Fitxer d'ortografia per a una versi ms recent del Vim" msgid "E770: Unsupported section in spell file" -msgstr "E770: Secci en el fitxer d'ortografia no suportada" +msgstr "E770: El fitxer d'ortografia cont una secci no suportada" #, c-format -msgid "Warning: region %s not supported" -msgstr "Atenci: la regi %s no est suportada" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: No s un fitxer .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Fitxer .sug obsolet, ha de ser actualitzat: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Fitxer .sug per a una versi ms recent del Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: El fitxer .sug no coincideix amb el fitxer .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: error en llegir el fitxer .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -4741,8 +5040,9 @@ msgstr "Llegint el fitxer d'afixos %s ..." #, c-format msgid "Conversion failure for word in %s line %d: %s" -msgstr "No s'ha pogut convertir una paraula a %s lnia %d: %s" +msgstr "No s'ha pogut convertir una paraula a %s, lnia %d: %s" +# <fname> #, c-format msgid "Conversion in %s not supported: from %s to %s" msgstr "La conversi a %s no est suportada: de %s a %s" @@ -4753,87 +5053,97 @@ msgstr "Conversi #, c-format msgid "Invalid value for FLAG in %s line %d: %s" -msgstr "Valor de marca no vlid a %s lnia %d: %s" +msgstr "Valor de FLAG invlid a %s, lnia %d: %s" #, c-format msgid "FLAG after using flags in %s line %d: %s" -msgstr "FLAG desprs d'usar marques a %s lnia %d: %s" +msgstr "FLAG posterior a l's de flags %s, lnia %d: %s" #, c-format -msgid "Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d" -msgstr "Definir COMPOUNDFORBIDFLAG desprs de l'element PFX pot tenir resultats inesperats a %s lnia %d" +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "Definir COMPOUNDFORBIDFLAG desprs de PFX, pot donar resultats incorrectes, a %s, lnia %d" + +#, c-format +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "Definir COMPOUNDPERMITFLAG desprs de PFX, pot donar resultats incorrectes, a %s, lnia %d" #, c-format -msgid "Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d" -msgstr "Definir COMPOUNDPERMITFLAG desprs de l'element PFX pot tenir resultats inesperats a %s lnia %d" +msgid "Wrong COMPOUNDRULES value in %s line %d: %s" +msgstr "Valor de COMPOUNDRULES incorrecte a %s, lnia %d: %s" #, c-format msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" -msgstr "Valor de COMPOUNDWORDMAX incorrecte a %s lnia %d: %s" +msgstr "Valor de COMPOUNDWORDMAX incorrecte a %s, lnia %d: %s" #, c-format msgid "Wrong COMPOUNDMIN value in %s line %d: %s" -msgstr "Valor de COMPOUNDMIN incorrecte a %s lnia %d: %s" +msgstr "Valor de COMPOUNDMIN incorrecte a %s, lnia %d: %s" #, c-format msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" -msgstr "Valor de COMPOUNDSYLMAX incorrecte a %s lnia %d: %s" +msgstr "Valor de COMPOUNDSYLMAX incorrecte a %s, lnia %d: %s" #, c-format msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" -msgstr "Valor de CHECKCOMPOUNDPATTERN incorrecte a %s lnia %d: %s" +msgstr "Valor de CHECKCOMPOUNDPATTERN incorrecte a %s, lnia %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" -msgstr "Marca de combinaci diferent en bloc continuat d'afixos a %s lnia %d: %s" +msgstr "Diferents tipus de combinaci en bloc d'afixos a %s, lnia %d: %s" #, c-format msgid "Duplicate affix in %s line %d: %s" -msgstr "Afix duplicat a %s lnia %d: %s" +msgstr "Afix duplicat a %s, lnia %d: %s" #, c-format -msgid "Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s" -msgstr "Afix tamb utilitzat per a BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST a %s lnia %d: %s" +msgid "" +"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " +"line %d: %s" +msgstr "Mateix afix utilitzat per BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST a %s, lnia %d: %s" #, c-format msgid "Expected Y or N in %s line %d: %s" -msgstr "S'esperava Y o N a %s lnia %d: %s" +msgstr "S'esperava Y o N a %s, lnia %d: %s" #, c-format msgid "Broken condition in %s line %d: %s" -msgstr "Condici errnia a %s lnia %d: %s" +msgstr "Condici errnia a %s, lnia %d: %s" #, c-format msgid "Expected REP(SAL) count in %s line %d" -msgstr "S'esperava recompte REP(SAL) a %s lnia %d" +msgstr "S'esperava un enter no negatiu per a REP(SAL) a %s, lnia %d" #, c-format msgid "Expected MAP count in %s line %d" -msgstr "S'esperava un recompte MAP a %s lnia %d" +msgstr "S'esperava un enter no negatiu per a MAP a %s, lnia %d" #, c-format msgid "Duplicate character in MAP in %s line %d" -msgstr "Carcter duplicat en un element MAP a %s lnia %d" +msgstr "Carcter duplicat a MAP a %s, lnia %d" #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" -msgstr "Element duplicat o no reconegut a %s lnia %d: %s" +msgstr "Element no reconegut o duplicat a %s, lnia %d: %s" #, c-format msgid "Missing FOL/LOW/UPP line in %s" msgstr "Falta una lnia FOL/LOW/UPP a %s" msgid "COMPOUNDSYLMAX used without SYLLABLE" -msgstr "Element COMPOUNDSYLMAX sense sllaba" +msgstr "Element COMPOUNDSYLMAX sense SYLLABLE" msgid "Too many postponed prefixes" msgstr "Sobren prefixes posposats" msgid "Too many compound flags" -msgstr "Sobren marques de composici" +msgstr "Sobren flags de composici" msgid "Too many postponed prefixes and/or compound flags" -msgstr "Massa prefixes posposats i/o marques de composici" +msgstr "Sobren prefixes posposats i/o flags de composici" #, c-format msgid "Missing SOFO%s line in %s" @@ -4841,15 +5151,15 @@ msgstr "Falta una l #, c-format msgid "Both SAL and SOFO lines in %s" -msgstr "Lnies SAL i SOFO a %s" +msgstr "Lnies SAL i SOFO alhora a %s" #, c-format msgid "Flag is not a number in %s line %d: %s" -msgstr "La marca no s un nmero a %s lnia %d: %s" +msgstr "Flag no numric a %s, lnia %d: %s" #, c-format msgid "Illegal flag in %s line %d: %s" -msgstr "Marca illegal a %s lnia %d: %s" +msgstr "Flag illegal a %s, lnia %d: %s" #, c-format msgid "%s value differs from what is used in another .aff file" @@ -4857,11 +5167,11 @@ msgstr "el valor %s difereix de l'usat en un altre fitxer .aff" #, c-format msgid "Reading dictionary file %s ..." -msgstr "Llefint el fitxer de diccionari %s ..." +msgstr "Llegint el fitxer de diccionari %s ..." #, c-format msgid "E760: No word count in %s" -msgstr "E760: No hi ha recompte de paraules a %s" +msgstr "E760: Falta el nombre de paraules a %s" #, c-format msgid "line %6d, word %6d - %s" @@ -4869,19 +5179,19 @@ msgstr "l #, c-format msgid "Duplicate word in %s line %d: %s" -msgstr "Paraula duplicada a %s lnia %d: %s" +msgstr "Paraula duplicada a %s, lnia %d: %s" #, c-format msgid "First duplicate word in %s line %d: %s" -msgstr "Primera paraula duplicada a %s lnia %d: %s" +msgstr "Primera paraula duplicada a %s, lnia %d: %s" #, c-format msgid "%d duplicate word(s) in %s" -msgstr "%d paraula/es duplada/es a %s" +msgstr "%d paraula/es duplicada/es a %s" #, c-format msgid "Ignored %d word(s) with non-ASCII characters in %s" -msgstr "%d paraula/es ignorada/es amb carcters no-ASCII a %s" +msgstr "S'ignora/en %d paraula/es amb carcters no-ASCII a %s" #, c-format msgid "Reading word file %s ..." @@ -4889,36 +5199,39 @@ msgstr "Llegint el fitxer de paraules %s ..." #, c-format msgid "Duplicate /encoding= line ignored in %s line %d: %s" -msgstr "S'ignora la lnia /encoding= duplicada a %s lnia %d: %s" +msgstr "S'ignora lnia /encoding= duplicada a %s, lnia %d: %s" #, c-format msgid "/encoding= line after word ignored in %s line %d: %s" -msgstr "S'ignora una lnia /encoding= desprs d'una paraula a %s lnia %d: %s" +msgstr "S'ignora lnia /encoding= desprs de paraula a %s, lnia %d: %s" #, c-format msgid "Duplicate /regions= line ignored in %s line %d: %s" -msgstr "S'ignora la lnia /regions= duplicada a %s lnia %d: %s" +msgstr "S'ignora lnia /regions= duplicada a %s, lnia %d: %s" #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "Massa regions a %s lnia %d: %s" +msgstr "Sobren regions a %s, lnia %d: %s" #, c-format msgid "/ line ignored in %s line %d: %s" -msgstr "Lnia / ignorada a %s lnia %d: %s" +msgstr "S'ignora lnia / a %s, lnia %d: %s" #, c-format msgid "Invalid region nr in %s line %d: %s" -msgstr "Nmero de regi no vlid a %s lnia %d: %s" +msgstr "Nmero de regi no vlid a %s, lnia %d: %s" #, c-format msgid "Unrecognized flags in %s line %d: %s" -msgstr "Marques no reconegudes a %s lnia %d: %s" +msgstr "Flags no reconeguts a %s, lnia %d: %s" #, c-format msgid "Ignored %d words with non-ASCII characters" msgstr "S'ignoren %d paraules amb carcters no-ASCII" +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Memria insuficient, la llista de paraules ser incompleta" + #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" msgstr "Comprimits %d de %d nodes; %d (%d%%) pendents" @@ -4926,10 +5239,6 @@ msgstr "Comprimits %d de %d nodes; %d (%d%%) pendents" msgid "Reading back spell file..." msgstr "Tornant a llegir el fitxer d'ortografia..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Efectuant expansi per similitud fontica..." @@ -4947,7 +5256,7 @@ msgstr "Escrivint el fitxer de suggeriments %s ..." #, c-format msgid "Estimated runtime memory use: %d bytes" -msgstr "s estimat de memria en funcionament: %d octets" +msgstr "s estimat de memria durant l'execuci: %d octets" msgid "E751: Output file name must not have region name" msgstr "E751: El fitxer de sortida no pot tenir un nom de regi" @@ -4960,7 +5269,7 @@ msgid "E755: Invalid region in %s" msgstr "E755: Regi no vlida a %s" msgid "Warning: both compounding and NOBREAK specified" -msgstr "Atenci: heu especificat composici i NOBREAK alhora" +msgstr "Atenci: s'ha especificat composici i NOBREAK alhora" #, c-format msgid "Writing spell file %s ..." @@ -4974,147 +5283,130 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' no t %ld entrades" #, c-format -msgid "Word removed from %s" -msgstr "Paraula eliminada de %s" +msgid "Word '%.*s' removed from %s" +msgstr "Paraula '%.*s' eliminada de %s" #, c-format -msgid "Word added to %s" -msgstr "Paraula afegida a %s" +msgid "Word '%.*s' added to %s" +msgstr "Paraula '%.*s' afegida a %s" msgid "E763: Word characters differ between spell files" -msgstr "E763: Els carcters de paraula difereixen entre fitxers d'ortografia" - -msgid "Sorry, no suggestions" -msgstr "Cap suggeriment" +msgstr "E763: Les llistes de carcters constituents de paraula no coincideixen" -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Llstima, noms %ld suggeriments" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Canviar \"%.*s\" per:" +msgid "E783: duplicate char in MAP entry" +msgstr "E783: Carcter duplicat a l'entrada MAP" -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr "No s'han definit elements de sintaxi per a aquest buffer" -msgid "E752: No previous spell replacement" -msgstr "E752: No hi ha cap correcci ortogrfica anterior" +msgid "syntax conceal on" +msgstr "ocultaci de sintaxi activada" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: No trobat: %s" +msgid "syntax conceal off" +msgstr "ocultaci de sintaxi desactivada" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: No sembla pas un fitxer .sug: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: L'argument s illegal: %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Fitxer .sug antic, ha de ser actualitzat: %s" +msgid "syntax case ignore" +msgstr "la sintaxi distingeix majscules" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: El fitxer .sug s per a una versi ms nova del Vim: %s" +msgid "syntax case match" +msgstr "la sintaxi no distingeix majscules" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: El fitxer .sug no coincideix amb el fitxer .spl: %s" +msgid "syntax spell toplevel" +msgstr "sintaxi amb revisi ortogrfica" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: error en llegir el fitxer .sug: %s" +msgid "syntax spell notoplevel" +msgstr "sintaxi sense revisi ortogrfica" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: Carcter duplicat a l'entrada MAP" +msgid "syntax spell default" +msgstr "sintaxi amb revisi ortogrfica per defecte" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: L'argument s illegal: %s" +# todo: not set +# valor de 'iskeyword' o "not set" +msgid "syntax iskeyword " +msgstr "sintaxi 'iskeyword' " #, c-format msgid "E391: No such syntax cluster: %s" -msgstr "E391: No existeix tal grup de sintaxi: %s" - -msgid "No Syntax items defined for this buffer" -msgstr "No hi ha tems de sintaxi definits en aquest buffer" +msgstr "E391: No existeix tal clster de sintaxi: %s" msgid "syncing on C-style comments" -msgstr "s'est sincronitzant a partir de comentaris estil C" +msgstr "se sincronitza amb comentaris estil C" msgid "no syncing" msgstr "no es sincronitza" -# va junta amb la segent +# junt amb el segent msgid "syncing starts " -msgstr "comena la sincronitzaci" +msgstr "la sincronitzaci comena " -# va junta amb l'anterior +# junt amb l'anterior msgid " lines before top line" msgstr " lnies abans de la lnia superior" msgid "" "\n" "--- Syntax sync items ---" -msgstr "" -"\n" -"--- tems de sincronitzaci de sintaxi ---" +msgstr "\n--- Elements de sincronitzaci de sintaxi ---" msgid "" "\n" "syncing on items" -msgstr "" -"\n" -"s'est sincronitzant a partir d'tems" +msgstr "\nes sincronitza amb elements" msgid "" "\n" "--- Syntax items ---" -msgstr "" -"\n" -"--- tems de sintaxi ---" +msgstr "\n--- Elements de sintaxi ---" #, c-format msgid "E392: No such syntax cluster: %s" -msgstr "E392: No existeix tal grup de sintaxi: %s" +msgstr "E392: No existeix tal clster de sintaxi: %s" +# ... <lines before the top line> msgid "minimal " msgstr "mnim " msgid "maximal " msgstr "mxim " +# match ... line breaks msgid "; match " -msgstr "; coincidncia " +msgstr "; coincident amb " msgid " line breaks" msgstr " salts de lnia" msgid "E395: contains argument not accepted here" -msgstr "E395: Cont un argument que no s'accepta aqu" +msgstr "E395: cont argument no vlid en aquest context" -msgid "E396: containedin argument not accepted here" -msgstr "E396: L'argument 'containedin' no s'accepta aqu" +msgid "E844: invalid cchar value" +msgstr "E844: valor de cchar invlid" msgid "E393: group[t]here not accepted here" -msgstr "E393: L'opci group[t]here no s'accepta aqu" +msgstr "E393: grouphere/groupthere no s vlid en aquest context" #, c-format msgid "E394: Didn't find region item for %s" -msgstr "E394: No s'ha trobat cap regi d'tems per %s" +msgstr "E394: No s'ha trobat cap element de regi per a %s" msgid "E397: Filename required" -msgstr "E397: Es requereix un nom de fitxer" +msgstr "E397: Necessita un nom de fitxer" + +msgid "E847: Too many syntax includes" +msgstr "E847: Sobren inclusions de sintaxi" #, c-format msgid "E789: Missing ']': %s" msgstr "E789: Falta un ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: carcter sobrer desprs de ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Falta un '=': %s" @@ -5124,19 +5416,22 @@ msgstr "E398: Falta un '=': %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Falten arguments: syntax region %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: Sobren clsters de sintaxi" + msgid "E400: No cluster specified" -msgstr "E400: No heu especificat cap grup" +msgstr "E400: No s'ha especificat cap clster" #, c-format msgid "E401: Pattern delimiter not found: %s" -msgstr "E401: No s'ha trobat el patr de delimitaci: %s" +msgstr "E401: No s'ha trobat el delimitador: %s" #, c-format msgid "E402: Garbage after pattern: %s" -msgstr "E402: Hi ha porqueria desprs del patr: %s" +msgstr "E402: Carcters sobrants desprs del patr: %s" msgid "E403: syntax sync: line continuations pattern specified twice" -msgstr "E403: syntax sync: el patr de continuaci de lnia est repetit" +msgstr "E403: syntax sync: patr de continuaci de lnia repetit" #, c-format msgid "E404: Illegal arguments: %s" @@ -5152,26 +5447,31 @@ msgstr "E406: Argument buit: %s" #, c-format msgid "E407: %s not allowed here" -msgstr "E407: %s no est perms aqu" +msgstr "E407: %s no perms en aquest context" #, c-format msgid "E408: %s must be first in contains list" -msgstr "E408: %s ha d'anar al principi de la llista 'contains'" +msgstr "E408: %s ha d'anar al principi a 'contains'" #, c-format msgid "E409: Unknown group name: %s" -msgstr "E409: El nom del grup s desconegut: %s" +msgstr "E409: Nom de grup desconegut: %s" #, c-format msgid "E410: Invalid :syntax subcommand: %s" -msgstr "E410: Sub-ordre de sintaxi no vlida: %s" +msgstr "E410: Subordre de :syntax no vlida: %s" + +# :syntime report +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr " TOTAL FREQ COINC PITJOR MITJANA NOM PATR" msgid "E679: recursive loop loading syncolor.vim" -msgstr "E679: Iteraci recursiva en carregar syncolor.vim" +msgstr "E679: bucle infinit en carregar syncolor.vim" #, c-format msgid "E411: highlight group not found: %s" -msgstr "E411: No s'ha trobat el grup de ressalt: %s" +msgstr "E411: grup de ressaltat no trobat: %s" #, c-format msgid "E412: Not enough arguments: \":highlight link %s\"" @@ -5182,44 +5482,44 @@ msgid "E413: Too many arguments: \":highlight link %s\"" msgstr "E413: Sobren arguments: \":highlight link %s\"" msgid "E414: group has settings, highlight link ignored" -msgstr "E414: El grup ja ha estat definit, s'ignora l'enlla de ressalt" +msgstr "E414: el grup ja t parmetres, s'ignora l'enlla" #, c-format msgid "E415: unexpected equal sign: %s" -msgstr "E415: Signe d'igual inesperat: %s" +msgstr "E415: signe d'igualtat inesperat: %s" #, c-format msgid "E416: missing equal sign: %s" -msgstr "E416: Falta un signe d'igual: %s" +msgstr "E416: falta un signe d'igual: %s" #, c-format msgid "E417: missing argument: %s" -msgstr "E417: Falta un argument: %s" +msgstr "E417: falta un argument: %s" #, c-format msgid "E418: Illegal value: %s" -msgstr "E418: El valor s illegal: %s" +msgstr "E418: Valor illegal: %s" msgid "E419: FG color unknown" msgstr "E419: Color de primer terme desconegut" msgid "E420: BG color unknown" -msgstr "E420: Color de fons desconegut" +msgstr "E420: Color de segon terme desconegut" #, c-format msgid "E421: Color name or number not recognized: %s" -msgstr "E421: Nom o nmero de color no identificat: %s" +msgstr "E421: Nom o nmero de color no reconegut: %s" #, c-format msgid "E422: terminal code too long: %s" -msgstr "E422: El codi de terminal s massa llarg: %s" +msgstr "E422: codi de terminal massa llarg: %s" #, c-format msgid "E423: Illegal argument: %s" -msgstr "E423: L'argument s illegal: %s" +msgstr "E423: Argument illegal: %s" msgid "E424: Too many different highlighting attributes in use" -msgstr "E424: Hi ha massa atributs de ressalt diferents en s" +msgstr "E424: Hi ha massa atributs de ressaltat diferents en s" msgid "E669: Unprintable character in group name" msgstr "E669: Carcter no imprimible en el nom del grup" @@ -5227,27 +5527,33 @@ msgstr "E669: Car msgid "W18: Invalid character in group name" msgstr "W18: Hi ha un carcter no vlid en el nom del grup" +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Massa grups de sintaxi i de ressaltat" + msgid "E555: at bottom of tag stack" -msgstr "E555: Baix de la pila d'etiquetes" +msgstr "E555: a baix de la pila d'etiquetes" msgid "E556: at top of tag stack" -msgstr "E556: Dalt de la pila d'etiquetes" +msgstr "E556: a dalt de la pila d'etiquetes" msgid "E425: Cannot go before first matching tag" -msgstr "E425: No es pot anar abans de la primera etiqueta coincident" +msgstr "E425: No es pot anar ms enll de la primera etiqueta coincident" #, c-format msgid "E426: tag not found: %s" msgstr "E426: No s'ha trobat l'etiqueta: %s" +# :tselect +# <c><l><?><l> msgid " # pri kind tag" msgstr " # pri tip etiqueta" +# <l> msgid "file\n" msgstr "fitxer\n" msgid "E427: There is only one matching tag" -msgstr "E427: Noms hi ha una sola etiqueta que coincideixi" +msgstr "E427: Noms hi ha una etiqueta coincident" msgid "E428: Cannot go beyond last matching tag" msgstr "E428: No es pot anar ms enll de l'ltima etiqueta coincident" @@ -5256,7 +5562,6 @@ msgstr "E428: No es pot anar m msgid "File \"%s\" does not exist" msgstr "El fitxer \"%s\" no existeix" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "etiqueta %d de %d%s" @@ -5271,13 +5576,12 @@ msgstr " No es fa distinci msgid "E429: File \"%s\" does not exist" msgstr "E429: El fitxer \"%s\" no existeix" -#. Highlight title +# :tags +# <c><l><l><r><l> msgid "" "\n" " # TO tag FROM line in file/text" -msgstr "" -"\n" -" # A etiq DES DE lnia en fitxer/text" +msgstr "\n # A nom DES DE la lnia al fitxer/text" #, c-format msgid "Searching tags file %s" @@ -5285,7 +5589,10 @@ msgstr "Cercant en el fitxer d'etiquetes %s" #, c-format msgid "E430: Tag file path truncated for %s\n" -msgstr "E430: S'ha truncat l'ubicaci del fitxer d'etiquetes per %s\n" +msgstr "E430: ubicaci del fitxer d'etiquetes truncada per a %s\n" + +msgid "Ignoring long line in tags file" +msgstr "S'ignora una lnia llarga en el fitxer d'etiquetes" #, c-format msgid "E431: Format error in tags file \"%s\"" @@ -5299,7 +5606,6 @@ msgstr "Abans de l'octet %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: El fitxer d'etiquetes no est ordenat: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: No hi ha cap fitxer d'etiquetes" @@ -5309,30 +5615,33 @@ msgstr "E434: No s'ha trobat l'etiqueta" msgid "E435: Couldn't find tag, just guessing!" msgstr "E435: No s'ha trobat l'etiqueta exacta!" -# terminal s mascul +#, c-format +msgid "Duplicate field name: %s" +msgstr "Camp de nom duplicat: %s" + +# <terminal> msgid "' not known. Available builtin terminals are:" -msgstr "' no identificat. Els terminals disponibles sn:" +msgstr "' desconegut. Els terminals disponibles sn:" msgid "defaulting to '" -msgstr "per omissi '" +msgstr "se selecciona per omissi '" msgid "E557: Cannot open termcap file" msgstr "E557: No s'ha pogut obrir el fitxer termcap" msgid "E558: Terminal entry not found in terminfo" -msgstr "E558: No s'ha trobat l'informaci del terminal a terminfo" +msgstr "E558: No s'ha trobat informaci sobre el terminal a terminfo" msgid "E559: Terminal entry not found in termcap" -msgstr "E559: No s'ha trobat l'informaci del terminal a termcap" +msgstr "E559: No s'ha trobat informaci sobre el terminal a termcap" #, c-format msgid "E436: No \"%s\" entry in termcap" -msgstr "E436: No hi ha cap entrada \"%s\" a termcap" +msgstr "E436: No hi ha cap entrada \"%s\" al termcap" msgid "E437: terminal capability \"cm\" required" -msgstr "E437: Es requereix la capacitat \"cm\" per part del terminal" +msgstr "E437: es necessita la capacitat \"cm\" per part del terminal" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5340,166 +5649,340 @@ msgstr "" "\n" "--- Tecles del terminal ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "No s'ha pogut obrir $VIMRUNTIME/rgb.txt" + msgid "new shell started\n" -msgstr "s'ha iniciat una nova shell\n" +msgstr "s'ha iniciat un nou intrpret\n" msgid "Vim: Error reading input, exiting...\n" msgstr "Vim: Error en llegir l'entrada, sortint...\n" -#. must display the prompt +msgid "Used CUT_BUFFER0 instead of empty selection" +msgstr "S'ha usat CUT_BUFFER0 en lloc d'una selecci buida" + +msgid "E881: Line count changed unexpectedly" +msgstr "E881: El nombre de lnies ha canviat inesperadament" + msgid "No undo possible; continue anyway" msgstr "No es pot desfer res; voleu continuar" +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: No es pot obrir el fitxer de desfer per a escriptura: %s" + +#, c-format +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: Fitxer de desfer corromput (%s): %s" + +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "No s'ha pogut escriure el fitxer de desfer a cap dels directoris de 'undodir'" + +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "No se sobreescriur el fitxer de desfer, error de lectura: %s" + +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "No se sobreescriur, no s un fitxer de desfer: %s" + +msgid "Skipping undo file write, nothing to undo" +msgstr "No s'escriu el fitxer de desfer, no hi ha res per desfer" + +#, c-format +msgid "Writing undo file: %s" +msgstr "Desant el fitxer de desfer: %s" + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: error d'escriptura en desar el fitxer de desfer: %s" + +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "No es llegeix el fitxer de desfer, el propietari s diferent: %s" + +#, c-format +msgid "Reading undo file: %s" +msgstr "Llegint el fitxer de desfer: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: Error en obrir el fitxer de desfer: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: No s un fitxer de desfer: %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "E832: Fitxer de desfer xifrat associat a un fitxer no xifrat: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Error en desxifrar el fitxer de desfer: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: El fitxer de desfer est xifrat: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Fitxer de desfer incompatible: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "El contingut del fitxer ha canviat, no s'utilitza la informaci de desfer." + +#, c-format +msgid "Finished reading undo file %s" +msgstr "S'ha completat la lectura del fitxer de desfer %s" + msgid "Already at oldest change" -msgstr "Ja sou en el canvi ms vell" +msgstr "Ja us trobeu al canvi ms antic" msgid "Already at newest change" -msgstr "Ja sou en el canvi ms recent" +msgstr "Ja us trobeu al canvi ms recent" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: No s'ha trobat l'element de desfer nmero %ld" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: els nmeros de lnia no sn correctes" + +msgid "more line" +msgstr "lnia ms" + +msgid "more lines" +msgstr "lnies ms" + +# u +msgid "line less" +msgstr "lnia menys" + +# u +msgid "fewer lines" +msgstr "lnies menys" + +msgid "change" +msgstr "canvi" + +msgid "changes" +msgstr "canvis" + +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s; %s #%ld %s" + +# u +msgid "before" +msgstr "abans de" + +# u +msgid "after" +msgstr "desprs de" + +msgid "Nothing to undo" +msgstr "No hi ha res per desfer" + +# :undolist +# <r><r><l><l> +msgid "number changes when saved" +msgstr " nm canvis quan desat" + +# u +#, c-format +msgid "%ld seconds ago" +msgstr "fa %ld segons" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin no est perms desprs de undo" + +msgid "E439: undo list corrupt" +msgstr "E439: la llista de desfer est corrompuda" + +msgid "E440: undo line missing" +msgstr "E440: falta una lnia de desfer" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: La funci %s ja existeix, afegiu ! per a substituir-la" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Ja existeix l'entrada al diccionari" + +msgid "E718: Funcref required" +msgstr "E718: Es necessita Funcref" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Funci desconeguda: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Argument illegal: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Argument duplicat: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Sobren arguments a la funci %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Arguments invlids a la funci %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: El nombre de crides a funcions excedeix 'maxfuncdeptg'" + +#, c-format +msgid "calling %s" +msgstr "cridant %s" + +#, c-format +msgid "%s aborted" +msgstr "%s ha avortat" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s ha retornat #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s ha retornat \"%s\"" + +msgid "E699: Too many arguments" +msgstr "E699: Sobren arguments" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Funci desconeguda: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: La funci s'ha eliminat: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Falten arguments a la funci: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: s de <SID> en un context no vlid: %s" #, c-format -msgid "Undo number %ld not found" -msgstr "Lnia de desfer nmero %ld no trobada" - -msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: els nombres de lnia no sn correctes" +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Crida a una funci de diccionari sense diccionari: %s" -msgid "more line" -msgstr "lnia ms" +msgid "E129: Function name required" +msgstr "E129: Es necessita un nom de funci" -msgid "more lines" -msgstr "lnies ms" +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: El nom de la funci ha de comenar amb majscula o \"s:\": %s" -msgid "line less" -msgstr "lnia menys" +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: El nom de la funci no pot contenir \":\": %s" -msgid "fewer lines" -msgstr "lnies menys" +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: La funci no est definida: %s" -msgid "change" -msgstr "canvi" +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Falta un '(': %s" -msgid "changes" -msgstr "canvis" +msgid "E862: Cannot use g: here" +msgstr "E862: No s possible utilitzar g: en aquest context" #, c-format -msgid "%ld %s; %s #%ld %s" -msgstr "%ld %s; %s #%ld %s" - -msgid "before" -msgstr "abans" +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Una funci amb clausura no pot estar al nivell superior: %s" -msgid "after" -msgstr "desprs" +msgid "E126: Missing :endfunction" +msgstr "E126: Falta :endfunction" -msgid "Nothing to undo" -msgstr "No hi ha res per desfer" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Hi ha text desprs de :endfunction: %s" -msgid "number changes time" -msgstr "nmero canvis hora" +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: El nom de la funci entra en conflicte amb una variable: %s" #, c-format -msgid "%ld seconds ago" -msgstr "fa %ld segons" +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: No es pot redefinir la funci %s: es troba en s" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undojoin no est perms desprs de undo" +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: El nom de la funci no coincideix amb el nom de l'script: %s" -msgid "E439: undo list corrupt" -msgstr "E439: La llista de desfer est corrompuda" +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: No es pot eliminar la funci %s: es troba en s" -msgid "E440: undo line missing" -msgstr "E440: Falta una lnia de desfer" +msgid "E133: :return not inside a function" +msgstr "E133: :return fora d'una funci" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Versi GUI per MS-Windows 16/32 bits" +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Falten parntesis: %s" msgid "" "\n" "MS-Windows 64-bit GUI version" -msgstr "" -"\n" -"Versi GUI per a MS-Windows 64 bits" +msgstr "\nVersi GUI per a MS-Windows de 64 bits" msgid "" "\n" "MS-Windows 32-bit GUI version" -msgstr "" -"\n" -"Versi GUI per MS-Windows 32 bits" - -msgid " in Win32s mode" -msgstr " en mode Win32s" +msgstr "\nVersi GUI per a MS-Windows de 32 bits" msgid " with OLE support" -msgstr " amb suport per OLE" - -msgid "" -"\n" -"MS-Windows 32-bit console version" -msgstr "" -"\n" -"Versi consola per MS-Windows 32 bits" - -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Versi per MS-Windows 16 bits" +msgstr " amb suport per a OLE" msgid "" "\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Versi per MS-DOS 32 bits" +"MS-Windows 64-bit console version" +msgstr "\nVersi consola per a MS-Windows de 64 bits" msgid "" "\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Versi per MS-DOS 16 bits" +"MS-Windows 32-bit console version" +msgstr "\nVersi consola per a MS-Windows de 32 bits" msgid "" "\n" "MacOS X (unix) version" -msgstr "" -"\n" -"Versi per MacOS X (Unix)" +msgstr "\nVersi per a MacOS X (Unix)" msgid "" "\n" "MacOS X version" -msgstr "" -"\n" -"Versi per MacOS X" +msgstr "\nVersi per a MacOS X" msgid "" "\n" "MacOS version" -msgstr "" -"\n" -"Versi per MacOS" +msgstr "\nVersi per a MacOS" msgid "" "\n" -"RISC OS version" -msgstr "" -"\n" -"Versi per RISC OS" +"OpenVMS version" +msgstr "\nVersi per a OpenVMS" msgid "" "\n" "Included patches: " -msgstr "" +msgstr "\nCanvis inclosos: " + +msgid "" "\n" -"Modificacions incloses: " +"Extra patches: " +msgstr "\nCanvis addicionals: " msgid "Modified by " msgstr "Modificat per " @@ -5517,16 +6000,12 @@ msgstr "per " msgid "" "\n" "Huge version " -msgstr "" -"\n" -"Versi enorme " +msgstr "\nVersi molt extensa " msgid "" "\n" "Big version " -msgstr "" -"\n" -"Versi gran " +msgstr "\nVersi extensa " msgid "" "\n" @@ -5545,51 +6024,47 @@ msgstr "" msgid "" "\n" "Tiny version " -msgstr "" -"\n" -"Versi mnima " +msgstr "\nVersi minimalista " msgid "without GUI." -msgstr "sense GUI." +msgstr "sense interfcie grfica." -msgid "with GTK2-GNOME GUI." -msgstr "amb GUI GTK2-GNOME." +msgid "with GTK3 GUI." +msgstr "amb interfcie grfica GTK3." -msgid "with GTK-GNOME GUI." -msgstr "amb GUI GTK-GNOME." +msgid "with GTK2-GNOME GUI." +msgstr "amb interfcie grfica GTK2-GNOME." msgid "with GTK2 GUI." -msgstr "amb GUI GTK2." - -msgid "with GTK GUI." -msgstr "amb GUI GTK." +msgstr "amb interfcie grfica GTK2." msgid "with X11-Motif GUI." -msgstr "amb GUI X11-Motif." +msgstr "amb interfcie grfica X11-Motif." msgid "with X11-neXtaw GUI." -msgstr "amb GUI X11-neXtaw." +msgstr "amb interfcie grfica X11-neXtaw." msgid "with X11-Athena GUI." -msgstr "amb GUI X11-Athena." +msgstr "amb interfcie grfica X11-Athena." msgid "with Photon GUI." -msgstr "amb GUI Photon." +msgstr "amb interfcie grfica Photon." msgid "with GUI." -msgstr "amb GUI." +msgstr "amb interfcie grfica." msgid "with Carbon GUI." -msgstr "amb GUI Carbon." +msgstr "amb interfcie grfica Carbon." msgid "with Cocoa GUI." -msgstr "amb GUI Cocoa." +msgstr "amb interfcie grfica Cocoa." msgid "with (classic) GUI." -msgstr "amb GUI (clssic)." +msgstr "amb interfcie grfica (clssica)." +# vim --version msgid " Features included (+) or not (-):\n" -msgstr " Funcions incloses (+) o excloses (-):\n" +msgstr "Caracterstiques incloses (+) o excloses (-):\n" # 29 carcters fins el ":" (incls) msgid " system vimrc file: \"" @@ -5631,6 +6106,10 @@ msgstr "2n fitxer gvimrc de l'usuari: \"" msgid "3rd user gvimrc file: \"" msgstr "3r fitxer gvimrc de l'usuari: \"" +# 29 carcters fins el ":" (incls) +msgid " defaults file: \"" +msgstr "fitxer de valors per defecte: \"" + # 29 carcters fins el ":" (incls) msgid " system menu file: \"" msgstr " fitxer de men del sistema: \"" @@ -5641,7 +6120,7 @@ msgstr " alternativa per a $VIM: \"" # 29 carcters fins el ":" (incls) msgid " f-b for $VIMRUNTIME: \"" -msgstr " alt per a $VIMRUNTIME: \"" +msgstr " altern. per a $VIMRUNTIME: \"" msgid "Compilation: " msgstr "Compilat amb: " @@ -5665,7 +6144,7 @@ msgid "by Bram Moolenaar et al." msgstr "per Bram Moolenaar et al." msgid "Vim is open source and freely distributable" -msgstr "Vim s un programa obert i lliure distribuci" +msgstr "Vim s un programa obert i de lliure distribuci" msgid "Help poor children in Uganda!" msgstr "Ajudeu els nens pobres d'Uganda!" @@ -5683,8 +6162,8 @@ msgid "type :help<Enter> or <F1> for on-line help" msgstr "feu :help<Entrar> o <F1> per a obtenir ajuda " # amplada 53 carcters -msgid "type :help version7<Enter> for version info" -msgstr "feu :help version7<Entrar> per a info de la versi " +msgid "type :help version8<Enter> for version info" +msgstr "feu :help version8<Entrar> per a info de la versi " msgid "Running in Vi compatible mode" msgstr "Funcionant en mode compatible amb Vi" @@ -5740,13 +6219,6 @@ msgstr "feu :help register<Entrar> per a informaci msgid "menu Help->Sponsor/Register for information " msgstr "men Ajuda->Patrocini/Registre per a informaci " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ATENCI: S'ha detectat Windows 95/98/ME" - -# amplada 53 carcters -msgid "type :help windows95<Enter> for info on this" -msgstr "feu :help windows95<Entrar> per a info sobre el tema " - msgid "Already only one window" msgstr "Noms hi ha una finestra" @@ -5754,14 +6226,20 @@ msgid "E441: There is no preview window" msgstr "E441: No hi ha cap finestra de previsualitzaci" msgid "E442: Can't split topleft and botright at the same time" -msgstr "E442: No es pot dividir horitzontal i verticalment al mateix temps" +msgstr "E442: No es pot dividir horitzontal i verticalment alhora" msgid "E443: Cannot rotate when another window is split" -msgstr "E443: No hi pot haver rotaci quan hi ha finestres dividides" +msgstr "E443: No es pot rotar quan hi ha finestres dividides" msgid "E444: Cannot close last window" msgstr "E444: No es pot tancar l'ltima finestra" +msgid "E813: Cannot close autocmd window" +msgstr "E813: No es pot tancar la finestra autocmd" + +msgid "E814: Cannot close window, only autocmd window would remain" +msgstr "E814: No es pot tancar la finestra, noms romandria la finestra autocmd" + msgid "E445: Other window contains changes" msgstr "E445: Hi han altres finestres que contenen canvis" @@ -5770,17 +6248,36 @@ msgstr "E446: No hi ha cap nom de fitxer sota el cursor" #, c-format msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: No s'ha trobat el fitxer \"%s\" en el path" +msgstr "E447: No s'ha trobat el fitxer \"%s\" a path" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID invlid: %ld (ha de ser ms gran o igual que 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: L'ID ja est agafat: %ld" + +msgid "List or number required" +msgstr "Es necessita una llista o un nmero" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID invlid: %ld (ha de ser ms gran o igual que 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID no trobat: %ld" #, c-format msgid "E370: Could not load library %s" msgstr "E370: No s'ha pogut carregar la biblioteca %s" msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "Aquesta ordre no est habilitada: no s'ha pogut carregar la biblioteca Perl." +msgstr "Ordre no disponible: no s'ha pogut carregar la biblioteca Perl." msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -msgstr "E299: Avaluaci Perl en una gbia no permesa sense el mdul Safe" +msgstr "E299: No est perms executar Perl en un entorn allat sense el mdul Safe" msgid "Edit with &multiple Vims" msgstr "Edita en &mltiples Vims" @@ -5794,7 +6291,6 @@ msgstr "Mostra les difer msgid "Edit with &Vim" msgstr "Edita amb el &Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "Edita amb un Vim existent - " @@ -5802,7 +6298,7 @@ msgid "Edits the selected file(s) with Vim" msgstr "Edita el(s) fitxer(s) seleccionat(s) amb el Vim" msgid "Error creating process: Check if gvim is in your path!" -msgstr "Error en crear el procs: Comproveu que gvim es trobi en el path!" +msgstr "Error en crear el procs: Comproveu que gvim es troba al path!" msgid "gvimext.dll error" msgstr "error de la biblioteca gvimext.dll" @@ -5813,10 +6309,6 @@ msgstr "La llargada del path msgid "--No lines in buffer--" msgstr "--Cap lnia en el buffer--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: S'ha avortat l'ordre" @@ -5827,38 +6319,38 @@ msgid "E10: \\ should be followed by /, ? or &" msgstr "E10: \\ hauria de continuar amb /, ? o &" msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" -msgstr "E11: No s vlid a la lnia d'ordres: <ENTRAR> executa, CTRL-C surt" +msgstr "E11: No vlid a la lnia d'ordres; <ENTRAR> executa, CTRL-C surt" msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" -msgstr "E12: Ordre en exrc/vimrc no permesa en l'actual cerca d'etiquetes o directoris" +msgstr "E12: Ordre no permesa a exrc/vimrc al directori actual o en cerca d'etiquetes" msgid "E171: Missing :endif" -msgstr "E171: Falta una declaraci :endif" +msgstr "E171: Falta :endif" msgid "E600: Missing :endtry" -msgstr "E600: Falta una declaraci :endtry" +msgstr "E600: Falta :endtry" msgid "E170: Missing :endwhile" -msgstr "E170: Falta una declaraci :endwhile" +msgstr "E170: Falta :endwhile" msgid "E170: Missing :endfor" -msgstr "E170: Falta un :endfor" +msgstr "E170: Falta :endfor" msgid "E588: :endwhile without :while" -msgstr "E588: Declaraci :endwhile sense :while" +msgstr "E588: :endwhile sense :while" msgid "E588: :endfor without :for" msgstr "E588: :endfor sense :for" msgid "E13: File exists (add ! to override)" -msgstr "E13: El fitxer existeix (afegiu ! per confirmar)" +msgstr "E13: El fitxer existeix (afegiu ! per a forar)" msgid "E472: Command failed" msgstr "E472: L'ordre ha fallat" #, c-format msgid "E234: Unknown fontset: %s" -msgstr "E234: Conjunt de tipus desconegut: %s" +msgstr "E234: Conjunt de foses desconegut: %s" #, c-format msgid "E235: Unknown font: %s" @@ -5871,28 +6363,32 @@ msgstr "E236: La fosa \"%s\" no msgid "E473: Internal error" msgstr "E473: Error intern" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Error intern: %s" + msgid "Interrupted" msgstr "Interromput" msgid "E14: Invalid address" -msgstr "E14: L'adrea no s vlida" +msgstr "E14: Adrea no vlida" msgid "E474: Invalid argument" -msgstr "E474: L'argument no s vlid" +msgstr "E474: Argument no vlid" #, c-format msgid "E475: Invalid argument: %s" -msgstr "E475: L'argument no s vlid: %s" +msgstr "E475: Argument no vlid: %s" #, c-format msgid "E15: Invalid expression: %s" -msgstr "E15: L'expressi no s vlida: %s" +msgstr "E15: Expressi no vlida: %s" msgid "E16: Invalid range" -msgstr "E16: L'interval no s vlid" +msgstr "E16: Interval no vlid" msgid "E476: Invalid command" -msgstr "E476: L'ordre no s vlida" +msgstr "E476: Ordre no vlida" #, c-format msgid "E17: \"%s\" is a directory" @@ -5900,23 +6396,23 @@ msgstr "E17: \"%s\" #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: La crida a la biblioteca a fallat per \"%s()\"" +msgstr "E364: La crida a la biblioteca a fallat per a \"%s()\"" #, c-format msgid "E448: Could not load library function %s" msgstr "E448: No s'ha pogut carregar la funci %s" msgid "E19: Mark has invalid line number" -msgstr "E19: Marca amb un nmero de lnia no vlid" +msgstr "E19: Marca amb nmero de lnia no vlid" msgid "E20: Mark not set" msgstr "E20: Marca no establerta" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: No es poden fer canvis, l'opci 'modifiable' est desactivada" +msgstr "E21: No es poden fer canvis, el parmetre 'modifiable' est desactivat" msgid "E22: Scripts nested too deep" -msgstr "E22: Imbricaci d'scripts massa profunda" +msgstr "E22: Nivell d'imbricaci de scripts massa elevat" msgid "E23: No alternate file" msgstr "E23: No hi ha cap fitxer alternatiu" @@ -5928,20 +6424,20 @@ msgid "E477: No ! allowed" msgstr "E477: ! no perms" msgid "E25: GUI cannot be used: Not enabled at compile time" -msgstr "E25: No es pot usar la GUI: No ha estat compilada" +msgstr "E25: No es pot usar GUI: No ha estat compilat" msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -msgstr "E26: No es pot usar el mode Hebreu: No ha estat compilat\n" +msgstr "E26: No es pot usar hebreu: No ha estat compilat\n" msgid "E27: Farsi cannot be used: Not enabled at compile time\n" -msgstr "E27: No es pot usar el mode Farsi: No ha estat compilat\n" +msgstr "E27: No es pot usar farsi: No ha estat compilat\n" msgid "E800: Arabic cannot be used: Not enabled at compile time\n" -msgstr "E800: No es pot usar el mode rab: No ha estat compilat\n" +msgstr "E800: No es pot usar rab: No ha estat compilat\n" #, c-format msgid "E28: No such highlight group name: %s" -msgstr "E28: No existeix tal grup de ressalt: %s" +msgstr "E28: No existeix tal grup de ressaltat: %s" msgid "E29: No inserted text yet" msgstr "E29: Encara no s'ha inserit text" @@ -5972,14 +6468,14 @@ msgid "E35: No previous regular expression" msgstr "E35: No hi ha cap expressi regular anterior" msgid "E481: No range allowed" -msgstr "E481: No es permet cap interval" +msgstr "E481: No es permeten intervals" msgid "E36: Not enough room" msgstr "E36: No hi ha prou espai" #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "E247: No hi ha cap servidor registrat amb aquest nom \"%s\"" +msgstr "E247: cap servidor registrat amb aquest nom \"%s\"" #, c-format msgid "E482: Can't create file %s" @@ -5997,7 +6493,10 @@ msgid "E485: Can't read file %s" msgstr "E485: No es pot llegir el fitxer %s" msgid "E37: No write since last change (add ! to override)" -msgstr "E37: No s'han desat els canvis (afegiu ! per confirmar)" +msgstr "E37: No s'han desat els canvis (afegiu ! per a forar)" + +msgid "E37: No write since last change" +msgstr "E37: No s'han desat els canvis" msgid "E38: Null argument" msgstr "E38: Argument nul" @@ -6029,48 +6528,73 @@ msgid "E459: Cannot go back to previous directory" msgstr "E459: No es pot tornar al directori anterior" msgid "E42: No Errors" -msgstr "E42: No hi han errors" +msgstr "E42: No hi ha errors" msgid "E776: No location list" msgstr "E776: No hi ha cap llista de posicions" msgid "E43: Damaged match string" -msgstr "E43: S'ha corromput la cadena amb l'expressi regular" +msgstr "E43: Cadena de coincidncia corrompuda" msgid "E44: Corrupted regexp program" -msgstr "E44: S'ha corromput el programa d'expressi regular" +msgstr "E44: Programa d'expressi regular corromput" msgid "E45: 'readonly' option is set (add ! to override)" -msgstr "E45: L'opci 'readonly' est definida (afegiu ! per confirmar)" +msgstr "E45: 'readonly' est establert (afegiu ! per a forar)" #, c-format msgid "E46: Cannot change read-only variable \"%s\"" -msgstr "E46: No s'ha pogut canviar la variable de noms lectura \"%s\"" +msgstr "E46: No es pot canviar la variable de noms lectura \"%s\"" #, c-format msgid "E794: Cannot set variable in the sandbox: \"%s\"" -msgstr "E794: No s'ha pogut definir la variable dins la gbia: \"%s\"" +msgstr "E794: No es pot definir la variable dins de l'entorn d'allament: \"%s\"" + +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: No s possible utilitzar una clau buida en un diccionari" + +msgid "E715: Dictionary required" +msgstr "E715: Es necessita Dictionary" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: ndex de llista fora de l'interval: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Sobren arguments a la funci: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: La clau no existeix al diccionari: %s" + +msgid "E714: List required" +msgstr "E714: Es necessita una llista" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: L'argument de %s ha de ser List o Dictionary" msgid "E47: Error while reading errorfile" msgstr "E47: Error en llegir el fitxer d'errors" msgid "E48: Not allowed in sandbox" -msgstr "E48: No est perms dins d'una gbia" +msgstr "E48: No est perms dins d'un entorn d'allament" msgid "E523: Not allowed here" -msgstr "E523: No est perms aqu" +msgstr "E523: No perms en aquest context" msgid "E359: Screen mode setting not supported" -msgstr "E359: La funci d'ajustar el mode de pantalla no est suportada" +msgstr "E359: L'ajustament del mode de pantalla no est suportat" msgid "E49: Invalid scroll size" -msgstr "E49: La distncia de desplaament no s vlida" +msgstr "E49: Distncia de desplaament no vlida" msgid "E91: 'shell' option is empty" -msgstr "E91: L'opci 'shell' no cont res" +msgstr "E91: El parmetre 'shell' est en blanc" msgid "E255: Couldn't read in sign data!" -msgstr "E255: No s'han pogut llegir les dades del senyal!" +msgstr "E255: Error en obtenir les dades de senyals!" msgid "E72: Close error on swap file" msgstr "E72: Error en tancar el fitxer d'intercanvi" @@ -6085,31 +6609,31 @@ msgid "E75: Name too long" msgstr "E75: El nom s massa llarg" msgid "E76: Too many [" -msgstr "E76: Sobren carcters [" +msgstr "E76: Sobren [" msgid "E77: Too many file names" msgstr "E77: Sobren noms de fitxer" msgid "E488: Trailing characters" -msgstr "E488: Sobren carcters" +msgstr "E488: Sobren carcters al final" msgid "E78: Unknown mark" -msgstr "E78: La marca s desconeguda" +msgstr "E78: Marca desconeguda" msgid "E79: Cannot expand wildcards" msgstr "E79: No s'ha pogut expandir el nom de fitxer" msgid "E591: 'winheight' cannot be smaller than 'winminheight'" -msgstr "E591: L'opci 'winheight' no pot ser menor que 'winminheight'" +msgstr "E591: El valor de 'winheight' no pot ser menor que 'winminheight'" msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" -msgstr "E592: L'opci 'winwidth' no pot ser menor que 'winminwidth'" +msgstr "E592: El valor de 'winwidth' no pot ser menor que 'winminwidth'" msgid "E80: Error while writing" msgstr "E80: Error d'escriptura" -msgid "Zero count" -msgstr "Comptador a zero" +msgid "E939: Positive count required" +msgstr "E939: Es necessita un nmero estrictament positiu" msgid "E81: Using <SID> not in a script context" msgstr "E81: s de <SID> en un context equivocat" @@ -6121,18 +6645,18 @@ msgid "E463: Region is guarded, cannot modify" msgstr "E463: La regi est protegida, no es pot modificar" msgid "E744: NetBeans does not allow changes in read-only files" -msgstr "E744: NetBeans no permet canvis a fitxers de noms-lectura" - -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Error intern: %s" +msgstr "E744: NetBeans no permet canvis a fitxers de noms lectura" msgid "E363: pattern uses more memory than 'maxmempattern'" -msgstr "E363: el patr usa ms memria que 'maxmempattern'" +msgstr "E363: el patr requereix ms memria que 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: buffer buit" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: El buffer %ld no existeix" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Patr de cerca o delimitador no vlid" @@ -6141,7 +6665,14 @@ msgstr "E139: El fitxer est #, c-format msgid "E764: Option '%s' is not set" -msgstr "E764: L'opci '%s' no est definida" +msgstr "E764: El parmetre '%s' no est establert" + +msgid "E850: Invalid register name" +msgstr "E850: Nom de registre no vlid" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Directori no trobat a '%s': \"%s\"" msgid "search hit TOP, continuing at BOTTOM" msgstr "la cerca ha arribat a DALT, es continua a BAIX" @@ -6149,53 +6680,260 @@ msgstr "la cerca ha arribat a DALT, es continua a BAIX" msgid "search hit BOTTOM, continuing at TOP" msgstr "la cerca ha arribat a BAIX, es continua a DALT" -#~ msgid "[Error List]" -#~ msgstr "[Llista d'errors]" -#~ msgid "[No File]" -#~ msgstr "[Cap fitxer]" -#~ msgid "E106: Unknown variable: \"%s\"" -#~ msgstr "E106: La variable s desconeguda: \"%s\"" -#~ msgid "E123: Undefined function: %s" -#~ msgstr "E123: La funci no est definida: %s" -#~ msgid "E127: Cannot redefine function %s: It is in use" -#~ msgstr "E127: No s'ha pogut redefinir la funci %s: s'est utilitzant" -#~ msgid "E130: Undefined function: %s" -#~ msgstr "E130: La funci no est definida: %s" -#~ msgid "\"\n" -#~ msgstr "\"\n" -#~ msgid "-V[N]\t\tVerbose level" -#~ msgstr "-V[N]\t\tNivell de loquacitat" -#~ msgid "--help\t\tShow Gnome arguments" -#~ msgstr "--help\t\tMostra els arguments per Gnome" -#~ msgid "[string too long]" -#~ msgstr "[cadena massa llarga]" -#~ msgid "Hit ENTER to continue" -#~ msgstr "Premeu ENTRAR per continuar" -#~ msgid " (RET/BS: line, SPACE/b: page, d/u: half page, q: quit)" -#~ msgstr "" -#~ " (ENTRAR/RETROCS: lnia, ESPAI/b; pgina, d/u; mitja pgina, q: surt)" -#~ msgid " (RET: line, SPACE: page, d: half page, q: quit)" -#~ msgstr " (ENTRAR: lnia, ESPAI: pgina, d: mitja pgina, q: surt)" -#~ msgid "...(truncated)" -#~ msgstr "...(truncat)" -#~ msgid "Could not allocate memory for command line." -#~ msgstr "No s'ha pogut assignar memria per la lnia d'ordres." -#~ msgid "E56: %s* operand could be empty" -#~ msgstr "E56: L'operand %s* podria estar buit" -#~ msgid "E57: %s+ operand could be empty" -#~ msgstr "E57: L'operand %s+ podria estar buit" -#~ msgid "E58: %s{ operand could be empty" -#~ msgstr "E58: L'operand %s{ podria estar buit" -#~ msgid "E361: Crash intercepted; regexp too complex?" -#~ msgstr "E361: Programa inestable; expressi regular massa complexa?" -#~ msgid "E363: pattern caused out-of-stack error" -#~ msgstr "E363: El patr ha provocat un error de desbordament de pila" -#~ msgid " BLOCK" -#~ msgstr " BLOC" -#~ msgid " LINE" -#~ msgstr " LNIA" -#~ msgid "Enter nr of choice (<CR> to abort): " -#~ msgstr "Entreu un nmero (<Entrar> per avortar): " -#~ msgid "with BeOS GUI." -#~ msgstr "amb GUI BeOS." +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Es necessita la clau de xifrat per a \"%s\"" + +msgid "empty keys are not allowed" +msgstr "no s'admeten claus en blanc" + +msgid "dictionary is locked" +msgstr "el diccionari est bloquejat" + +msgid "list is locked" +msgstr "la llista est bloquejada" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "error en afegir la clau '%s' al diccionari" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "l'ndex ha de ser un enter o un interval, no %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "s'esperava una objecte str() o unicode(), s'ha rebut %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "s'esperava un objecte bytes() o str(), s'ha rebut %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "s'esperava int(), long() o un objecte convertible a long(), s'ha rebut %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "s'esperava int() o un objecte convertible a int(), s'ha rebut %s" + +msgid "value is too large to fit into C int type" +msgstr "el valor s massa gran per al tipus int de C" + +msgid "value is too small to fit into C int type" +msgstr "el valor s massa petit per al tipus int de C" + +msgid "number must be greater than zero" +msgstr "el nmero ha de ser ms gran que zero" + +msgid "number must be greater or equal to zero" +msgstr "el nmero ha de ser ms gran o igual que zero" + +msgid "can't delete OutputObject attributes" +msgstr "no s'han pogut eliminar els atributs de OutputObject" + +#, c-format +msgid "invalid attribute: %s" +msgstr "atribut invlid: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Error en inicialitzar els objectes d'E/S" + +msgid "failed to change directory" +msgstr "error en canviar de directori" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "s'esperava una 3-tupla, per imp.find_module() ha retornat %s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "s'esperava una 3-tupla, per imp.find_module() retornat una %d-tupla" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "error intern: imp.find_module ha retornat una tupla amb valors NULL" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "no s'han pogut eliminar els atributs de vim.Dictionary" + +msgid "cannot modify fixed dictionary" +msgstr "no s possible modificar un diccionari fixat" + +#, c-format +msgid "cannot set attribute %s" +msgstr "no s'ha pogut establir l'atribut %s" + +msgid "hashtab changed during iteration" +msgstr "hashtab ha canviat durant la iteraci" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "s'esperava una seqncia de mida 2, s'ha rebut una seqncia de mida %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "el constructor de llistes no accepta arguments amb nom" + +msgid "list index out of range" +msgstr "ndex de llista fora de l'interval" + +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "error intern: error en obtenir l'element %d de la llista vim" + +msgid "slice step cannot be zero" +msgstr "l'increment de l'interval no pot ser zero" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "intent d'assignar una seqncia de ms de %d elements a un interval ests" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "error intern: no existeix l'element %d a la llista vim" + +msgid "internal error: not enough list items" +msgstr "error intern: no hi ha prou elements a la llista" + +msgid "internal error: failed to add item to list" +msgstr "error intern: error en afegir un element a la llista" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "intent d'assignar una seqncia de %d elements a un interval ests de %d" + +msgid "failed to add item to list" +msgstr "error en afegir un element a la llista" + +msgid "cannot delete vim.List attributes" +msgstr "no s'han pogut eliminar els atributs de vim.List" + +msgid "cannot modify fixed list" +msgstr "no es pot modificar una llista fixada" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "la funci sense nom %s no existeix" + +#, c-format +msgid "function %s does not exist" +msgstr "la funci %s no existeix" + +#, c-format +msgid "failed to run function %s" +msgstr "error en executar la funci %s" + +msgid "unable to get option value" +msgstr "error en obtenir el valor de l'opci" + +msgid "internal error: unknown option type" +msgstr "error intern: tipus d'opci desconegut" + +msgid "problem while switching windows" +msgstr "problema en canviar de finestra" + +#, c-format +msgid "unable to unset global option %s" +msgstr "error en eliminar el valor de l'opci global %s" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "error en eliminar el valor de l'opci %s que no t valor global" + +msgid "attempt to refer to deleted tab page" +msgstr "referncia a una pestanya eliminada" + +msgid "no such tab page" +msgstr "no existeix tal pestanya" + +msgid "attempt to refer to deleted window" +msgstr "referncia a una finestra eliminada" + +msgid "readonly attribute: buffer" +msgstr "atribut readonly: buffer" + +msgid "cursor position outside buffer" +msgstr "posici del cursor fora del buffer" + +msgid "no such window" +msgstr "no existeix tal finestra" + +msgid "attempt to refer to deleted buffer" +msgstr "referncia a un buffer eliminat" + +msgid "failed to rename buffer" +msgstr "error en reanomenar el buffer" + +msgid "mark name must be a single character" +msgstr "els noms de marques han ser un nic carcter" + +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "s'esperava un objecte vim.Buffer object, s'ha rebut %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "error en canviar al buffer %d" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "s'esperava un objecte vim.Window, s'ha rebut %s" + +msgid "failed to find window in the current tab page" +msgstr "no s'ha trobat la finestra a la pestanya actual" + +msgid "did not switch to the specified window" +msgstr "no s'ha canviat a la finestra especificada" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "s'esperava un objecte vim.TabPage, s'ha rebut %s" + +msgid "did not switch to the specified tab page" +msgstr "no s'ha canviat a la pestanya especificada" +msgid "failed to run the code" +msgstr "error en executar el codi" + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval no ha retornat un objecte Python vlid" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "E859: Error en convertir l'objecte Python retornat a un valor Vim" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "error en convertir %s en un diccionari Vim" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "error en convertir %s en una llista Vim" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "error en convertir %s en una estructura Vim" + +msgid "internal error: NULL reference passed" +msgstr "error intern: s'ha passat una referncia amb valor NULL" + +msgid "internal error: invalid value type" +msgstr "error intern: tipus de valor invlid" + +# todo: path hook +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Error en establir les rutines de path: sys.path_hooks no s una llista\n" +"Haureu de fer el segent:\n" +"- afegir vim.path_hook a sys.path_hooks\n" +"- afegir vim.VIM_SPECIAL_PATH a sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Error en establir el path: sys.path no s una llista\n" +"Haureu d'afegir vim.VIM_SPECIAL_PATH a sys.path" diff --git a/src/po/check.vim b/src/po/check.vim index 5a3a0e3f46..24c4d79cb5 100644 --- a/src/po/check.vim +++ b/src/po/check.vim @@ -30,36 +30,67 @@ func! GetMline() return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc -" This only works when 'wrapscan' is set. +" This only works when 'wrapscan' is not set. let s:save_wrapscan = &wrapscan -set wrapscan +set nowrapscan " Start at the first "msgid" line. +let wsv = winsaveview() 1 -/^msgid -let startline = line('.') +/^msgid\> + +" When an error is detected this is set to the line number. +" Note: this is used in the Makefile. let error = 0 while 1 if getline(line('.') - 1) !~ "no-c-format" - let fromline = GetMline() + " go over the "msgid" and "msgid_plural" lines + let prevfromline = 'foobar' + while 1 + let fromline = GetMline() + if prevfromline != 'foobar' && prevfromline != fromline + echomsg 'Mismatching % in line ' . (line('.') - 1) + echomsg 'msgid: ' . prevfromline + echomsg 'msgid ' . fromline + if error == 0 + let error = line('.') + endif + endif + if getline('.') !~ 'msgid_plural' + break + endif + let prevfromline = fromline + endwhile + if getline('.') !~ '^msgstr' - echo 'Missing "msgstr" in line ' . line('.') - let error = 1 - endif - let toline = GetMline() - if fromline != toline - echo 'Mismatching % in line ' . (line('.') - 1) - echo 'msgid: ' . fromline - echo 'msgstr: ' . toline - let error = 1 + echomsg 'Missing "msgstr" in line ' . line('.') + if error == 0 + let error = line('.') + endif endif + + " check all the 'msgstr' lines + while getline('.') =~ '^msgstr' + let toline = GetMline() + if fromline != toline + echomsg 'Mismatching % in line ' . (line('.') - 1) + echomsg 'msgid: ' . fromline + echomsg 'msgstr: ' . toline + if error == 0 + let error = line('.') + endif + endif + if line('.') == line('$') + break + endif + endwhile endif - " Find next msgid. - " Wrap around at the end of the file, quit when back at the first one. - /^msgid - if line('.') == startline + " Find next msgid. Quit when there is no more. + let lnum = line('.') + silent! /^msgid\> + if line('.') == lnum break endif endwhile @@ -74,12 +105,81 @@ endwhile " 1 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0 - echo 'Mismatching error/warning code in line ' . line('.') - let error = 1 + echomsg 'Mismatching error/warning code in line ' . line('.') + if error == 0 + let error = line('.') + endif endif +func! CountNl(first, last) + let nl = 0 + for lnum in range(a:first, a:last) + let nl += count(getline(lnum), "\n") + endfor + return nl +endfunc + +" Check that the \n at the end of the msgid line is also present in the msgstr +" line. Skip over the header. +1 +/^"MIME-Version: +while 1 + let lnum = search('^msgid\>') + if lnum <= 0 + break + endif + let strlnum = search('^msgstr\>') + let end = search('^$') + if end <= 0 + let end = line('$') + 1 + endif + let origcount = CountNl(lnum, strlnum - 1) + let transcount = CountNl(strlnum, end - 1) + " Allow for a few more or less line breaks when there are 2 or more + if origcount != transcount && (origcount <= 2 || transcount <= 2) + echomsg 'Mismatching "\n" in line ' . line('.') + if error == 0 + let error = lnum + endif + endif +endwhile + +" Check that the file is well formed according to msgfmts understanding +if executable("msgfmt") + let filename = expand("%") + " Newer msgfmt does not take OLD_PO_FILE_INPUT argument, must be in + " environment. + let $OLD_PO_FILE_INPUT = 'yes' + let a = system("msgfmt --statistics " . filename) + if v:shell_error != 0 + let error = matchstr(a, filename.':\zs\d\+\ze:')+0 + for line in split(a, '\n') | echomsg line | endfor + endif +endif + +" Check that the plural form is properly initialized +1 +let plural = search('^msgid_plural ', 'n') +if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1) + if search('^"Plural-Forms: ', 'n') == 0 + echomsg "Missing Plural header" + if error == 0 + let error = search('\(^"[A-Za-z-_]\+: .*\\n"\n\)\+\zs', 'n') - 1 + endif + elseif error == 0 + let error = plural + endif +elseif !plural && search('^"Plural-Forms: ', 'n') + " We allow for a stray plural header, msginit adds one. +endif + + if error == 0 - echo "OK" + " If all was OK restore the view. + call winrestview(wsv) + echomsg "OK" +else + exe error endif let &wrapscan = s:save_wrapscan diff --git a/src/po/cleanup.vim b/src/po/cleanup.vim index 24ae74ed38..b27d88092f 100644 --- a/src/po/cleanup.vim +++ b/src/po/cleanup.vim @@ -8,12 +8,18 @@ let s:was_diff = &diff setl nodiff -silent g/^#: /d +" untranslated message preceded by c-format or comment +silent g/^#, c-format\n#/.d +silent g/^#\..*\n#/.d + +silent g/^#[:~] /d silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ / silent g/^msgstr"/s//msgstr "/ silent g/^msgid"/s//msgid "/ silent g/^msgstr ""\(\n"\)\@!/?^msgid?,.s/^/#\~ / +silent g/^\n\n\n/.d + if s:was_diff setl diff endif diff --git a/src/po/cs.cp1250.po b/src/po/cs.cp1250.po index 97e0e9457b..bce1598fb9 100644 --- a/src/po/cs.cp1250.po +++ b/src/po/cs.cp1250.po @@ -2655,11 +2655,6 @@ msgstr "" msgid "and run diff with the original file to check for changes)\n" msgstr "a kontrolu zmn pomoc programu diff.)\n" -msgid "" -"Delete the .swp file afterwards.\n" -"\n" -msgstr "Pot smate odkldac soubor.\n" - #. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Nalezen odkldac soubory:" @@ -3120,7 +3115,7 @@ msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " "followed by '%s'." msgstr "" -"E343: Chybn cesta: '**[slo] mus bt bu na konci cesty, nebo mus bt\n" +"E343: Chybn cesta: '**[slo] mus bt bu na konci cesty, nebo mus bt " "nsledovno'%s. Viz :help path." #, c-format @@ -3606,7 +3601,8 @@ msgid "" "See :help win32-vimrun for more information." msgstr "" "VIMRUN.EXE se nevyskytuje ve Va $PATH.\n" -"Extern pkazy nebudou " +"Extern pkazy nebudou\n" +"See :help win32-vimrun for more information." msgid "Vim Warning" msgstr "Varovn" @@ -4358,8 +4354,8 @@ msgstr "zadejte :q<Enter> pro ukon msgid "type :help<Enter> or <F1> for on-line help" msgstr "zadejte :help<Enter> i <F1> pro npovdu" -msgid "type :help version7<Enter> for version info" -msgstr "zadejte :help version7<Enter> pro informace o verzi 6" +msgid "type :help version8<Enter> for version info" +msgstr "zadejte :help version8<Enter> pro informace o verzi 6" msgid "Running in Vi compatible mode" msgstr "Bm v reimu kompatibility s Vi" diff --git a/src/po/cs.po b/src/po/cs.po index 08a14d9b9a..d34af602c5 100644 --- a/src/po/cs.po +++ b/src/po/cs.po @@ -2655,11 +2655,6 @@ msgstr "" msgid "and run diff with the original file to check for changes)\n" msgstr "a kontrolu zmn pomoc programu diff.)\n" -msgid "" -"Delete the .swp file afterwards.\n" -"\n" -msgstr "Pot smate odkldac soubor.\n" - #. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Nalezen odkldac soubory:" @@ -3120,7 +3115,7 @@ msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " "followed by '%s'." msgstr "" -"E343: Chybn cesta: '**[slo] mus bt bu na konci cesty, nebo mus bt\n" +"E343: Chybn cesta: '**[slo] mus bt bu na konci cesty, nebo mus bt " "nsledovno'%s. Viz :help path." #, c-format @@ -3606,7 +3601,8 @@ msgid "" "See :help win32-vimrun for more information." msgstr "" "VIMRUN.EXE se nevyskytuje ve Va $PATH.\n" -"Extern pkazy nebudou " +"Extern pkazy nebudou\n" +"See :help win32-vimrun for more information." msgid "Vim Warning" msgstr "Varovn" @@ -4358,8 +4354,8 @@ msgstr "zadejte :q<Enter> pro ukon msgid "type :help<Enter> or <F1> for on-line help" msgstr "zadejte :help<Enter> i <F1> pro npovdu" -msgid "type :help version7<Enter> for version info" -msgstr "zadejte :help version7<Enter> pro informace o verzi 6" +msgid "type :help version8<Enter> for version info" +msgstr "zadejte :help version8<Enter> pro informace o verzi 6" msgid "Running in Vi compatible mode" msgstr "Bm v reimu kompatibility s Vi" diff --git a/src/po/de.po b/src/po/de.po index 545bde4447..2c54b9ac54 100644 --- a/src/po/de.po +++ b/src/po/de.po @@ -1,37 +1,70 @@ -# German Translation for Vim vim:set foldmethod=marker: +# German Translation for Vim # # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # # Previous-Translator(s): +# Georg Dahn <georg.dahn@gmail.com> # Johannes Zellner <johannes@zellner.org> # Gerfried Fuchs <alfie@ist.org> - msgid "" msgstr "" "Project-Id-Version: Vim(deutsch)\n" -"POT-Creation-Date: 2006-04-02 11:30+0200\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-30 15:16+0200\n" "PO-Revision-Date: 2008-05-24 17:26+0200\n" -"Last-Translator: Georg Dahn <georg.dahn@gmail.com>\n" -"Language-Team: German <de@li.org>\n" +"Last-Translator: Christian Brabandt <cb@256bit.org>\n" +"Language-Team: German\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: bf_key_init() mit leerem passwort aufgerufen." + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) ungleich 4." + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: Blowfish Big-/Little-Endian falsch." + +msgid "E818: sha256 test failed" +msgstr "E818: Test sha256 fehlgeschlagen" + +msgid "E819: Blowfish test failed" +msgstr "E819: Blowfish Test fehlgeschlagen" + +msgid "[Location List]" +msgstr "[Positionsliste]" + +msgid "[Quickfix List]" +msgstr "[Quickfix-Liste]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Autokommandos fhrten zu einem Abbruch." msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: Kann keinen Puffer zuweisen; beenden..." +msgstr "E82: Kann keinen Puffer zuweisen; beende..." msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: Kann den Puffer nicht zuweisen; benutze einen anderen..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: Puffer kann nicht registriert werden." + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Versuch, Puffer zu lschen, der noch benutzt wird." + msgid "E515: No buffers were unloaded" -msgstr "E515: Keine Puffer wurden entladen" +msgstr "E515: Keine Puffer wurden entladen." msgid "E516: No buffers were deleted" -msgstr "E516: Keine Puffer wurden vollstndig gelscht" +msgstr "E516: Keine Puffer wurden gelscht." msgid "E517: No buffers were wiped out" -msgstr "E517: Keine Puffer wurden vollstndig gelscht" +msgstr "E517: Keine Puffer wurden vollstndig gelscht." msgid "1 buffer unloaded" msgstr "ein Puffer entladen" @@ -54,51 +87,59 @@ msgstr "ein Puffer vollst msgid "%d buffers wiped out" msgstr "%d Puffer vollstndig gelscht" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Kann letzten Puffer nicht ausladen" + msgid "E84: No modified buffer found" -msgstr "E84: Kein vernderter Puffer gefunden" +msgstr "E84: Keinen vernderter Puffer gefunden" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" -msgstr "E85: Es gibt keine angezeigten Puffer" - -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Puffer %ld existiert nicht" +msgstr "E85: Es gibt keine angezeigten Puffer." msgid "E87: Cannot go beyond last buffer" -msgstr "E87: Kann nicht ber den letzten Puffer hinaus gehen" +msgstr "E87: Kann nicht ber den letzten Puffer hinaus gehen." msgid "E88: Cannot go before first buffer" -msgstr "E88: Kann nicht vor den ersten Puffer gehen" +msgstr "E88: Kann nicht vor den ersten Puffer gehen." #, c-format msgid "E89: No write since last change for buffer %ld (add ! to override)" -msgstr "E89: Puffer %ld nicht gesichert seit der letzten nderung (erzwinge mit !)" +msgstr "" +"E89: Puffer %ld seit der letzten nderung nicht gesichert (erzwinge mit !)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Kann letzten Puffer nicht ausladen" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Job luft noch (Beenden mit !)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Kein Schreibvorgang seit der letzten nderung (erzwinge mit !)" + +msgid "E948: Job still running" +msgstr "E948: Job luft noch" + +msgid "E37: No write since last change" +msgstr "E37: Nicht geschrieben seit letzter nderung" msgid "W14: Warning: List of file names overflow" -msgstr "W14: Achtung: berlauf der Liste der Dateinamen" +msgstr "W14: Achtung: berlauf der Dateinamensliste." #, c-format msgid "E92: Buffer %ld not found" -msgstr "E92: Kein Puffer %ld gefunden" +msgstr "E92: Puffer %ld nicht gefunden." #, c-format msgid "E93: More than one match for %s" -msgstr "E93: Mehr als ein Treffer fr %s" +msgstr "E93: Mehr als ein Treffer fr %s." #, c-format msgid "E94: No matching buffer for %s" -msgstr "E94: Kein bereinstimmender Puffer fr %s" +msgstr "E94: Kein bereinstimmender Puffer fr %s." #, c-format msgid "line %ld" msgstr "Zeile %ld" msgid "E95: Buffer with this name already exists" -msgstr "E95: Ein Puffer mit diesem Namen existiert bereits" +msgstr "E95: Ein Puffer mit diesem Namen existiert bereits." msgid " [Modified]" msgstr " [Verndert]" @@ -112,6 +153,9 @@ msgstr "[Neue Datei]" msgid "[Read errors]" msgstr "[Lesefehler]" +msgid "[RO]" +msgstr "[RO]" + msgid "[readonly]" msgstr "[Nur Lesen]" @@ -130,7 +174,6 @@ msgstr "Zeile %ld von %ld --%d%%-- Spalte " msgid "[No Name]" msgstr "[Unbenannt]" -#. must be a help buffer msgid "help" msgstr "Hilfe" @@ -149,7 +192,6 @@ msgstr "Ende" msgid "Top" msgstr "Anfang" -#, c-format msgid "" "\n" "# Buffer list:\n" @@ -157,11 +199,11 @@ msgstr "" "\n" "# Liste der Puffer:\n" -msgid "[Location List]" -msgstr "[Positionsliste]" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Kann nicht schreiben, 'buftype'-Option ist gesetzt" -msgid "[Quickfix List]" -msgstr "[QuickFix-Liste]" +msgid "[Scratch]" +msgstr "[Scratch]" msgid "" "\n" @@ -178,49 +220,156 @@ msgstr "Zeichen f msgid " line=%ld id=%d name=%s" msgstr " Zeile=%ld id=%d Name=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Kann keine Verbindung zu Port herstellen." + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() in channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() in channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: Befehl mit Nicht-String Argument empfangen." + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: Letztes Argument fr expr/call muss eine Zahl sein." + +msgid "E904: third argument for call must be a list" +msgstr "E904: Drittes Argument fr call muss eine Liste sein." + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: Unbekannter Befehl empfangen: %s." + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): geschrieben ohne eine Verbindung hergestellt zu haben." + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): Schreiben fehlgeschlagen." + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Kann keinen Callback mit %s() durchfhren." + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: Kann ch_evalexpr()/ch_sendexpr() nicht mit einem Raw oder NL Channel " +"benutzen." + +msgid "E906: not an open channel" +msgstr "E906: Kein offener Channel" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: Fr _io Datei muss _name gesetzt ist." + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: Fr in_io Puffer muss in_buf oder in_name gesetzt sein." + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: Puffer muss geladen sein: %s." + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Datei ist mit unbekannter Verschlsselungsart verschlsselt." + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Achtung: Benutze eine schwache Verschlsselungsart; siehe :help 'cm'." + +msgid "Enter encryption key: " +msgstr "Geben Sie bitte den Schlssel ein: " + +msgid "Enter same key again: " +msgstr "Geben Sie den gleichen Schlssel nochmals ein:" + +msgid "Keys don't match!" +msgstr "Die Schlssel stimmen nicht berein!" + +msgid "[crypted]" +msgstr "[verschlsselt]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Fehlender Doppelpunkt im Dictionary: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: Keine Differenz fr mehr als %ld Puffer" +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Doppelter Schlssel im Dictionary: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Fehlendes Komma im Dictionary: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Fehlendes Ende des Dictionary '}': %s" + +msgid "extend() argument" +msgstr "extend() Argument" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Schlssel existiert bereits: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: Kann Diff fr mehr als %ld Puffer nicht erstellen." + +msgid "E810: Cannot read or write temp files" +msgstr "E810: Kann temporre Datei nicht lesen oder schreiben." msgid "E97: Cannot create diffs" -msgstr "E97: Kann keine Differenz erstellen" +msgstr "E97: Kann keinen Diff erstellen." msgid "Patch file" msgstr "Patch-Datei" +msgid "E816: Cannot read patch output" +msgstr "E816: Kann Patch Ausgabe nicht lesen." + msgid "E98: Cannot read diff output" -msgstr "E98: Differenz-Ausgabe kann nicht gelesen werden" +msgstr "E98: Diff-Ausgabe kann nicht gelesen werden." msgid "E99: Current buffer is not in diff mode" -msgstr "E99: Aktueller Puffer ist nicht im Differenz-Modus" +msgstr "E99: Aktueller Puffer ist nicht im Diff-Modus." + +msgid "E793: No other buffer in diff mode is modifiable" +msgstr "E793: Kein weitere Puffer im diff-Modues ist modifizierbar." msgid "E100: No other buffer in diff mode" -msgstr "E100: Kein weiterer Puffer ist im Differenz-Modus" +msgstr "E100: Kein weiterer Puffer ist im Diff-Modus." msgid "E101: More than two buffers in diff mode, don't know which one to use" -msgstr "E101: Mehrdeutigkeit: Mehr als zwei Puffer im Differenz-Modus" +msgstr "E101: Mehrdeutigkeit: Mehr als zwei Puffer im Diff-Modus." #, c-format msgid "E102: Can't find buffer \"%s\"" -msgstr "E102: Kann Puffer \"%s\" nicht finden" +msgstr "E102: Kann Puffer \"%s\" nicht finden." #, c-format msgid "E103: Buffer \"%s\" is not in diff mode" -msgstr "E103: Puffer \"%s\" ist nicht im Differenz-Modus" +msgstr "E103: Puffer \"%s\" ist nicht im Diff-Modus." + +msgid "E787: Buffer changed unexpectedly" +msgstr "E787: Puffer nderte sich unerwartet." msgid "E104: Escape not allowed in digraph" -msgstr "E104: 'Escape' ist in einem Digraphen nicht erlaubt" +msgstr "E104: 'Escape' ist in einem Digraphen nicht erlaubt." msgid "E544: Keymap file not found" -msgstr "E544: Datei fr die Tastaturbelegung nicht gefunden" +msgstr "E544: Datei fr die Tastaturbelegung (keymap) nicht gefunden." msgid "E105: Using :loadkeymap not in a sourced file" -msgstr "E105: :loadkeymap auerhalb einer eingelesenen Datei" +msgstr "E105: :loadkeymap auerhalb einer eingelesenen Datei." + +msgid "E791: Empty keymap entry" +msgstr "E791: Leerer keymap Eintrag" msgid " Keyword completion (^N^P)" msgstr " Stichwort-Ergnzung (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X Modus (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -240,7 +389,7 @@ msgid " Definition completion (^D^N^P)" msgstr " Definitions-Ergnzung (^D^N^P)" msgid " Dictionary completion (^K^N^P)" -msgstr " Wrterbuch-Ergnzung (^K^N^P) " +msgstr " Dictionary-Ergnzung (^K^N^P) " msgid " Thesaurus completion (^T^N^P)" msgstr " Thesaurus-Ergnzung (^T^N^P)" @@ -258,16 +407,22 @@ msgid " Spelling suggestion (s^N^P)" msgstr " Vorschlag der Rechtschreibprfung (s^N^P)" msgid " Keyword Local completion (^N^P)" -msgstr " Lokale Schlsselwort-Ergnzung(^N^P)" +msgstr " Lokale Stichwort-Ergnzung(^N^P)" msgid "Hit end of paragraph" msgstr "Absatzende erreicht" +msgid "E839: Completion function changed window" +msgstr "E839: Vervollstndigungsfunktion nderte Fenster." + +msgid "E840: Completion function deleted text" +msgstr "E840: Vervollstndigungsfunktion hat Text gelscht." + msgid "'dictionary' option is empty" -msgstr "Die Option 'dictionary' ist leer" +msgstr "Die Option 'dictionary' ist leer." msgid "'thesaurus' option is empty" -msgstr "Die Option 'thesaurus' ist leer" +msgstr "Die Option 'thesaurus' ist leer." #, c-format msgid "Scanning dictionary: %s" @@ -283,17 +438,15 @@ msgstr " (Ersetzen) Scrollen (^E/^Y)" msgid "Scanning: %s" msgstr "Durchsuche: %s" -#, c-format msgid "Scanning tags." -msgstr "Durchsuchen von Tags." +msgstr "Durchsuche Tags" + +msgid "match in file" +msgstr "Treffer in Datei" msgid " Adding" msgstr " Fge hinzu" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Suche..." @@ -317,10 +470,6 @@ msgstr "Treffer %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Unerwartete Zeichen in :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: Index der Liste auerhalb des zulssigen Bereichs: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Undefinierte Variable: %s" @@ -328,61 +477,25 @@ msgstr "E121: Undefinierte Variable: %s" msgid "E111: Missing ']'" msgstr "E111: Fehlende ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Argument von %s muss eine Liste sein" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Argument von %s muss eine Liste oder ein Wrterbuch" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Der Schlssel fr das Wrterbuch darf nicht leer sein" - -msgid "E714: List required" -msgstr "E714: Liste bentigt" - -msgid "E715: Dictionary required" -msgstr "E715: Wrterbuch bentigt" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Zu viele Argumente fr Funktion: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Schlssel nicht vorhanden im Wrterbuch: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Funktion %s existiert bereits; zum Ersetzen ! hinzufgen" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Wrterbuch-Eintrag existiert bereits" - -msgid "E718: Funcref required" -msgstr "E718: Funktionsreferenz bentigt" - msgid "E719: Cannot use [:] with a Dictionary" -msgstr "E719: Kann [:] nicht mit einem Wrterbuch verwenden" +msgstr "E719: Kann [:] nicht mit einem Dictionary verwenden" #, c-format msgid "E734: Wrong variable type for %s=" msgstr "E734: Falscher Typ der Variable fr %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Unbekannte Funktion: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Unzulssiger Name der Variable: %s" +msgid "E806: using Float as a String" +msgstr "E806: Float als String benutzt." + msgid "E687: Less targets than List items" -msgstr "E687: Weniger Ziele als Eintrge der Liste" +msgstr "E687: Weniger Ziele als Eintrge in der Liste." msgid "E688: More targets than List items" -msgstr "E688: Mehr Ziele als Eintrge der Liste" +msgstr "E688: Mehr Ziele als Eintrge in der Liste." msgid "Double ; in list of variables" msgstr "Doppeltes ; in der Liste von Variablen" @@ -392,64 +505,52 @@ msgid "E738: Can't list variables for %s" msgstr "E738: Kann Variablen nicht auflisten: %s" msgid "E689: Can only index a List or Dictionary" -msgstr "E689: Kann nur Listen und Wrterbcher indizieren" +msgstr "E689: Kann nur Listen und Dictionary indizieren" msgid "E708: [:] must come last" -msgstr "E708: [:] muss am Schluss kommen" +msgstr "E708: [:] muss am Schluss kommen." msgid "E709: [:] requires a List value" msgstr "E709: [:] bentigt eine Liste als Wert" msgid "E710: List value has more items than target" -msgstr "E710: Listenwert hat mehr Eintrge als das Ziel" +msgstr "E710: Listenwert hat mehr Eintrge als das Ziel." msgid "E711: List value has not enough items" -msgstr "E711: Listenwert hat nicht gengend Eintrge" +msgstr "E711: Listenwert hat nicht gengend Eintrge." msgid "E690: Missing \"in\" after :for" msgstr "E690: Fehlendes \"in\" nach :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Fehlende Klammern: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Keine solche Variable: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Kann Variable \"%s\" nicht sperren bzw. entsperren." + msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: Variable ist zu tief verschachtelt fr (un)lock" +msgstr "E743: Variable ist zu tief verschachtelt fr (un)lock." msgid "E109: Missing ':' after '?'" msgstr "E109: Fehlender ':' nach '?'" -msgid "E691: Can only compare List with List" -msgstr "E691: Kann nur eine Liste mit einer Liste vergleichen" - -msgid "E692: Invalid operation for List" -msgstr "E692: Unzulssige Operation fr Listen" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Kann nur ein Wrterbuch mit einem Wrterbuch vergleichen" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Unzulssige Operation fr ein Wrterbuch" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Kann nur eine Funktionsreferenz mit einer Funktionsreferenz vergleichen" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Unzulssige Operation fr Funktionsreferenzen" +msgid "E804: Cannot use '%' with Float" +msgstr "E804: Kann '%' mit Floats benutzen." msgid "E110: Missing ')'" -msgstr "E110: Fehlende ')'" +msgstr "E110: Fehlendes ')'" msgid "E695: Cannot index a Funcref" -msgstr "E695: Kann keine Funktionsreferenz indizieren" +msgstr "E695: Kann keine Funktionsreferenz indizieren." + +msgid "E909: Cannot index a special variable" +msgstr "E909: Kann Spezialvariable nicht indexieren." #, c-format msgid "E112: Option name missing: %s" -msgstr "E112: Bezeichnung der Option fehlt: %s" +msgstr "E112: Optionsname fehlt: %s" #, c-format msgid "E113: Unknown option: %s" @@ -463,59 +564,163 @@ msgstr "E114: Fehlendes Anf msgid "E115: Missing quote: %s" msgstr "E115: Fehlendes Anfhrungszeichen: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Nicht gengend Speicher um Referenzen zu setzen, Garbagecollection " +"abgebrochen!" + +msgid "E724: variable nested too deep for displaying" +msgstr "E724: Variable ist zu tief verschachtelt fr die Anzeige" + +msgid "E805: Using a Float as a Number" +msgstr "E805: Benutze Float als Nummer." + +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funktionsreferenz als Zahl verwendet" + +msgid "E745: Using a List as a Number" +msgstr "E745: Liste als Zahl verwendet." + +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dictionary als Zahl verwendet." + +msgid "E910: Using a Job as a Number" +msgstr "E910: Job als Zahl verwendet." + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel als Zahl verwendet." + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funktionsreferenz als Float verwendet." + +msgid "E892: Using a String as a Float" +msgstr "E892: String als Float verwendet." + +msgid "E893: Using a List as a Float" +msgstr "E893: Liste als Float verwendet." + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dictionary als Float verwendet." + +msgid "E907: Using a special value as a Float" +msgstr "E907: Benutze Spezialvariable als Float." + +msgid "E911: Using a Job as a Float" +msgstr "E911: Benutzte Job als Float." + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Channel als Float verwendet." + +msgid "E729: using Funcref as a String" +msgstr "E729: Funktionsreferenz als String verwendet" + +msgid "E730: using List as a String" +msgstr "E730: Liste als String verwendet" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dictionary als String verwendet" + +msgid "E908: using an invalid value as a String" +msgstr "E908: Ungltiger Wert als String verwendet." + #, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Fehlendes Komma in der Liste: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Kann Variable nicht lschen: %s" #, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Fehlendes Ende der Liste ']': %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "" +"E704: Funktionsreferenz-Variable muss mit einem Grobuchstaben beginnen: %s" #, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Fehlender Doppelpunkt im Wrterbuch: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Konflikt eines Variablennamens mit bestehender Funktion: %s" #, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Doppelter Schlssel im Wrterbuch: \"%s\"" +msgid "E741: Value is locked: %s" +msgstr "E741: Wert ist gesperrt: %s" + +msgid "Unknown" +msgstr "Unbekannt" #, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Fehlendes Komma im Wrterbuch: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Kann Wert nicht ndern: %s" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Variable ist zu tief verschachtelt fr eine Kopie" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# globale Variablen:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tZuletzt gesetzt in " + +msgid "E691: Can only compare List with List" +msgstr "E691: Kann nur eine Liste mit einer Liste vergleichen." + +msgid "E692: Invalid operation for List" +msgstr "E692: Unzulssige Operation fr Listen" + +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Kann nur ein Dictionary mit einem Dictionary vergleichen" + +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Unzulssige Funktion fr ein Dictionary" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Unzulssige Operation fr Funktionsreferenzen" + +msgid "map() argument" +msgstr "map() Argument" + +msgid "filter() argument" +msgstr "filter() Argument" #, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Fehlendes Ende des Wrterbuchs '}': %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Argument von %s muss eine Liste sein." -msgid "E724: variable nested too deep for displaying" -msgstr "E724: Variable ist zu tief verschachtelt fr die Anzeige" +msgid "E928: String required" +msgstr "E928: String wird bentigt." -msgid "E699: Too many arguments" -msgstr "E699: Zu viele Argumente" +msgid "E808: Number or Float required" +msgstr "E808: Zahl oder Float bentigt." + +msgid "add() argument" +msgstr "add() Argument" msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() kann nur im Einfge-Modus verwendet werden" +msgstr "E785: complete() kann nur im Einfge-Modus verwendet werden." -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. msgid "&Ok" msgstr "&Ok" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Schlssel existiert bereits: %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld Zeilen: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld Zeile, " +msgstr[1] "+-%s%3ld Zeilen, " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Unbekannte Funktion: %s" +msgid "E922: expected a dict" +msgstr "E922: Erwarte ein Dictionary." + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "" +"E923: Zweites Argument von function() muss eine Liste oder ein Dictionary " +"sein." + msgid "" "&OK\n" "&Cancel" @@ -524,14 +729,24 @@ msgstr "" "&Abbrechen" msgid "called inputrestore() more often than inputsave()" -msgstr "inputrestore() wurde fter als inputsave() aufgerufen" +msgstr "inputrestore() wurde hufiger als inputsave() aufgerufen." + +msgid "insert() argument" +msgstr "insert() Argument" + +msgid "E786: Range not allowed" +msgstr "E786: Bereich nicht erlaubt" -msgid "E745: Range not allowed" -msgstr "E745: Bereich nicht erlaubt" +msgid "E916: not a valid job" +msgstr "E916: kein gltiger Job" msgid "E701: Invalid type for len()" msgstr "E701: Unzulssiger Typ fr len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID ist fr \":match\" reserviert: %ld" + msgid "E726: Stride is zero" msgstr "E726: Stride ist Null" @@ -541,146 +756,76 @@ msgstr "E727: Start hinter dem Ende" msgid "<empty>" msgstr "<leer>" -msgid "E240: No connection to Vim server" -msgstr "E240: Keine Verbindung zum Vim-Server" +msgid "E240: No connection to the X server" +msgstr "E240: Keine Verbindung zum X-Server" #, c-format msgid "E241: Unable to send to %s" msgstr "E241: Kann nicht zu %s senden" msgid "E277: Unable to read a server reply" -msgstr "E277: Server-Antwort kann nicht gelesen werden" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Zu viele symbolische Links (zirkulr?)" - -msgid "E258: Unable to send to client" -msgstr "E258: Kann nicht zum Client senden" - -msgid "E702: Sort compare function failed" -msgstr "E702: Die Vergleichsfunktion der Sortierung ist fehlgeschlagen" - -msgid "(Invalid)" -msgstr "(Ungltig)" - -msgid "E677: Error writing temp file" -msgstr "E677: Fehler beim Schreiben einer temporren Datei" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funktionsreferenz als Zahl verwendet" - -msgid "E745: Using a List as a Number" -msgstr "E745: Liste als Zahl verwendet" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Wrterbuch als Zahl verwendet" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funktionsreferenz als String verwendet" +msgstr "E277: Server-Antwort kann nicht gelesen werden." -msgid "E730: using List as a String" -msgstr "E730: Liste als String verwendet" +msgid "E941: already started a server" +msgstr "E941: Server bereits gestartet." -msgid "E731: using Dictionary as a String" -msgstr "E731: Wrterbuch als String verwendet" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver Eigenschaft nicht verfgbar" -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funktionsreferenz-Variable muss mit einem Grobuchstaben beginnen: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Konflikt eines Variablennamens mit bestehender Funktion: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Typ der Variable falsch zugeordnet: %s" +msgid "remove() argument" +msgstr "remove() Argument" -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Wert ist gesperrt: %s" - -msgid "Unknown" -msgstr "Unbekannt" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Kann Wert nicht ndern: %s" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: Variable ist zu tief verschachtelt fr eine Kopie" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Zu viele symbolische Links (zirkulr?)" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Fehlendes '(': %s" +msgid "reverse() argument" +msgstr "reverse() Argument" -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Unzulssiges Argument: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: Fehlendes :endfunction" +msgid "E258: Unable to send to client" +msgstr "E258: Kann nicht zum Client senden." #, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Funktionsname stimmt mit dem Namen der Skript-Datei nicht berein: %s" - -msgid "E129: Function name required" -msgstr "E129: Funktionsname wird verlangt" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Ungltige Aktion '%s'" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: Funktionsname muss mit einem Grobuchstaben beginnen oder einen Doppelpunkt enthalten: %s" +msgid "sort() argument" +msgstr "sort() Argument" -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Funktion %s kann nicht gelscht werden: sie ist in Verwendung" +msgid "uniq() argument" +msgstr "uniq() Argument" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Funktionsaufrufstiefe berschreitet 'maxfuncdepth'" +msgid "E702: Sort compare function failed" +msgstr "E702: Die Vergleichsfunktion der Sortierung ist fehlgeschlagen." -#, c-format -msgid "calling %s" -msgstr "rufe %s auf" +msgid "E882: Uniq compare function failed" +msgstr "E882: Die Uniq Vergleichsfunktion ist fehlgeschlagen." -#, c-format -msgid "%s aborted" -msgstr "%s abgebrochen" +msgid "(Invalid)" +msgstr "(Ungltig)" #, c-format -msgid "%s returning #%ld" -msgstr "%s lieferte #%ld zurck" +msgid "E935: invalid submatch number: %d" +msgstr "E935: Ungltige Submatch Nummer: %d" -#, c-format -msgid "%s returning %s" -msgstr "%s lieferte \"%s\" zurck" +msgid "E677: Error writing temp file" +msgstr "E677: Fehler beim Schreiben einer temporren Datei" -#, c-format -msgid "continuing in %s" -msgstr "weiter in %s" +msgid "E921: Invalid callback argument" +msgstr "E921: Unglgltiges Callback Argument" -msgid "E133: :return not inside a function" -msgstr "E133: :return auerhalb einer Funktion" - -#, c-format -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# globale Variablen:\n" - -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tZuletzt gesetzt von " +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Hex %02x, Oktal %03o, Digr %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, Hex %02x, Oktal %03o" +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Hex %04x, Oktal %o, Digr %s" + +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Hex %08x, Oktal %o, Digr %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, Hex %04x, Oktal %o" @@ -707,7 +852,7 @@ msgid "E135: *Filter* Autocommands must not change current buffer" msgstr "E135: *Filter*-Autokommandos drfen den aktuellen Puffer nicht ndern" msgid "[No write since last change]\n" -msgstr "[Kein Schreiben seit der letzten nderung]\n" +msgstr "[Nicht geschrieben seit der letzten nderung]\n" #, c-format msgid "%sviminfo: %s in line: " @@ -726,6 +871,9 @@ msgstr " Information" msgid " marks" msgstr " Markierungen" +msgid " oldfiles" +msgstr " oldfiles" + msgid " FAILED" msgstr " FEHLGESCHLAGEN" @@ -733,6 +881,10 @@ msgstr " FEHLGESCHLAGEN" msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Viminfo-Datei ist nicht schreibbar: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Zu viele temporre viminfo Dateien (wie %s)!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Schreiben der viminfo-Datei %s ist nicht mglich!" @@ -741,12 +893,14 @@ msgstr "E138: Schreiben der viminfo-Datei %s ist nicht m msgid "Writing viminfo file \"%s\"" msgstr "Schreiben der viminfo-Datei \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Kann viminfo Datei nicht in %s umbenennen!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Diese viminfo-Datei wurde von Vim %s generiert.\n" -#, c-format msgid "" "# You may edit it if you're careful!\n" "\n" @@ -754,13 +908,19 @@ msgstr "" "# Sie knnen sie verndern, wenn Sie vorsichtig vorgehen!\n" "\n" -#, c-format msgid "# Value of 'encoding' when this file was written\n" msgstr "# Wert von 'encoding', als diese Datei geschrieben wurde\n" msgid "Illegal starting char" msgstr "Unzulssiges Zeichen am Anfang" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# |-Zeilen, wortwrtlich kopiert:\n" + msgid "Save As" msgstr "Speichern als" @@ -787,7 +947,9 @@ msgid "E141: No file name for buffer %ld" msgstr "E141: Kein Dateiname fr Puffer %ld" msgid "E142: File not written: Writing is disabled by 'write' option" -msgstr "E142: Datei wurde nicht geschrieben: Schreiben ist durch die Option 'write' ausgeschaltet" +msgstr "" +"E142: Datei wurde nicht geschrieben: Schreiben ist durch die Option 'write' " +"ausgeschaltet" #, c-format msgid "" @@ -797,6 +959,20 @@ msgstr "" "'readonly'-Option ist fr \"%s\" gesetzt.\n" "Mchten Sie trotzdem schreiben?" +#, c-format +msgid "" +"File permissions of \"%s\" are read-only.\n" +"It may still be possible to write it.\n" +"Do you wish to try?" +msgstr "" +"Dateiberechtigung von \"%s\" ist nur-lesbar.\n" +"Mglicherweise kann die Datei dennoch geschrieben werden.\n" +"Fortsetzen?" + +#, c-format +msgid "E505: \"%s\" is read-only (add ! to override)" +msgstr "E505: \"%s\" ist Schreibgeschtzt (erzwinge mit !)" + msgid "Edit File" msgstr "ffne Datei" @@ -808,10 +984,11 @@ msgid "E144: non-numeric argument to :z" msgstr "E144: Nicht-numerisches Argument fr :z" msgid "E145: Shell commands not allowed in rvim" -msgstr "E145: Shell-Befehle sind in rvim nicht erlaubt" +msgstr "E145: Shell-Befehle sind in rvim nicht erlaubt." msgid "E146: Regular expressions can't be delimited by letters" -msgstr "E146: Regulre Ausdrcke knnen nicht durch Buchstaben begrenzt werden" +msgstr "" +"E146: Regulre Ausdrcke knnen nicht durch Buchstaben begrenzt werden." #, c-format msgid "replace with %s (y/n/a/q/l/^E/^Y)?" @@ -841,8 +1018,8 @@ msgstr " auf einer Zeile" msgid " on %ld lines" msgstr " auf %ld Zeilen" -msgid "E147: Cannot do :global recursive" -msgstr "E147: Kann :global nicht rekursiv ausfhren" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: Kann :global nicht rekursiv mit einem Bereich ausfhren." msgid "E148: Regular expression missing from global" msgstr "E148: Regulrer Ausdruck fehlt in global" @@ -852,6 +1029,9 @@ msgid "Pattern found in every line: %s" msgstr "Muster in jeder Zeile gefunden: %s" #, c-format +msgid "Pattern not found: %s" +msgstr "Muster nicht gefunden: %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -877,24 +1057,29 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Hilfe-Datei \"%s\" nicht gefunden" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: Kein Verzeichnis: %s" +msgid "E151: No match: %s" +msgstr "E151: Kein Treffer: %s" #, c-format msgid "E152: Cannot open %s for writing" -msgstr "E152: %s kann nicht zum Schreiben geffnet werden" +msgstr "E152: %s kann nicht zum Schreiben geffnet werden." #, c-format msgid "E153: Unable to open %s for reading" -msgstr "E153: %s kann nicht zum Lesen geffnet werden" +msgstr "E153: %s kann nicht zum Lesen geffnet werden." #, c-format msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: Mischung von Kodierungen einer Hilfedatei innerhalb einer Sprache: %s" +msgstr "" +"E670: Mischung von Kodierungen einer Hilfedatei innerhalb einer Sprache: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: Doppelter Tag \"%s\" in der Datei %s/%s" #, c-format -msgid "E154: Duplicate tag \"%s\" in file %s" -msgstr "E154: Doppelter Tag \"%s\" in der Datei %s" +msgid "E150: Not a directory: %s" +msgstr "E150: Kein Verzeichnis: %s" #, c-format msgid "E160: Unknown sign command: %s" @@ -921,10 +1106,17 @@ msgstr "E159: Fehlende Zeichennummer" msgid "E158: Invalid buffer name: %s" msgstr "E158: ungltige Puffernummer: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Kann nicht zu einem Puffer ohne Namen springen." + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Ungltige Zeichen-ID: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Nicht mglich Zeichen %s zu ndern." + msgid " (NOT FOUND)" msgstr " (NICHT GEFUNDEN)" @@ -934,9 +1126,19 @@ msgstr " (nicht unterst msgid "[Deleted]" msgstr "[Gelscht]" +msgid "No old files" +msgstr "Keine Alt-Dateien" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Debug-Modus. Geben Sie \"cont\" zum Fortsetzen ein." +msgid "Oldval = \"%s\"" +msgstr "Alter Wert = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Neuer Wert = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "Zeile %ld: %s" @@ -945,6 +1147,13 @@ msgstr "Zeile %ld: %s" msgid "cmd: %s" msgstr "Befehl: %s" +msgid "frame is zero" +msgstr "Frame ist Null" + +#, c-format +msgid "frame at highest level: %d" +msgstr "Frame auf letzter Ebene: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Haltepunkt in \"%s%s\" Zeile %ld" @@ -960,28 +1169,35 @@ msgstr "Keine Haltepunkte definiert" msgid "%3d %s %s line %ld" msgstr "%3d %s %s Zeile %ld" -msgid "E750: First use :profile start <fname>" -msgstr "E750: Erste Verwendung von :profile startet <fname>" +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + +msgid "E750: First use \":profile start {fname}\"" +msgstr "E750: Benutze vorher :profile start <fname>" #, c-format msgid "Save changes to \"%s\"?" msgstr "nderungen in \"%s\" speichern?" -msgid "Untitled" -msgstr "Unbenannt" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Job noch aktiv in Puffer \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: Puffer \"%s\" wurde seit der letzten nderung nicht geschrieben" +msgstr "E162: Puffer \"%s\" wurde seit der letzten nderung nicht geschrieben." msgid "Warning: Entered other buffer unexpectedly (check autocommands)" -msgstr "Achtung: Unerwarteter Eintritt in einen andren Puffer (berprfen Sie die Autokommandos)" +msgstr "" +"Achtung: Unerwartetet einen andren Puffer geffnet (berprfen Sie die " +"Autokommandos)" msgid "E163: There is only one file to edit" -msgstr "E163: Es gibt nur eine Datei zum Editieren" +msgstr "E163: Es gibt nur eine Datei zum Editieren." msgid "E164: Cannot go before first file" -msgstr "E164: Kann nicht ber die erste Datei hinausgehen" +msgstr "E164: Kann nicht vor die erste Datei hinausgehen." msgid "E165: Cannot go beyond last file" msgstr "E165: Kann nicht ber die letzte Datei hinausgehen" @@ -999,11 +1215,21 @@ msgid "Searching for \"%s\"" msgstr "Suche nach \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "im 'runtimepath' nicht gefunden: \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "in '%s' nicht gefunden: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "" +"W20: Erfoderliche Python Version 2.x nicht untersttzt, ignoriere Datei: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "" +"W21: Erforderliche Python Version 3.x nicht untersttzt, ignoriere Datei: %s" msgid "Source Vim script" -msgstr "Fhre Vim-Skript aus" +msgstr "Lese Vim-Skript" #, c-format msgid "Cannot source a directory: \"%s\"" @@ -1029,6 +1255,10 @@ msgstr "Zeile %ld: lese \"%s\"" msgid "finished sourcing %s" msgstr "Lesen von %s beendet" +#, c-format +msgid "continuing in %s" +msgstr "weiter in %s" + msgid "modeline" msgstr "modeline" @@ -1062,9 +1292,9 @@ msgid "E197: Cannot set language to \"%s\"" msgstr "E197: Sprache kann nicht auf \"%s\" gesetzt werden" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Ex-Modus. Geben Sie \"visual\" ein, um zum Normal-Modus zurckzukehren." +msgstr "" +"Ex-Modus. Geben Sie \"visual\" ein, um zum Normal-Modus zurckzukehren." -#. must be at EOF msgid "E501: At end-of-file" msgstr "E501: Am Dateiende" @@ -1073,7 +1303,7 @@ msgstr "E169: Befehl zu rekursiv" #, c-format msgid "E605: Exception not caught: %s" -msgstr "E605: Ausnahme nicht aufgefangen: %s" +msgstr "E605: Exception nicht gefangen: %s" msgid "End of sourced file" msgstr "Ende der eingelesenen Datei" @@ -1096,12 +1326,13 @@ msgstr "Bereichsgrenzen r msgid "E494: Use w or w>>" msgstr "E494: Verwenden Sie w oder w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: Befehlstabelle muss aktualisiert werden, fhre 'make cmdidxs' aus" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Der Befehl ist in dieser Version nicht implementiert" -msgid "E172: Only one file name allowed" -msgstr "E172: Nur ein Dateiname erlaubt" - msgid "1 more file to edit. Quit anyway?" msgstr "Eine weitere Datei zum Editieren. Trotzdem beenden?" @@ -1121,10 +1352,10 @@ msgstr "E174: Befehl existiert bereits: ! zum Ersetzen hinzuf msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Name Args Bereich Fertig Definition" +" Name Args Adresse Vervollstndigung Definition" msgid "No user-defined commands found" msgstr "Keine vom Benutzer definierten Befehle gefunden" @@ -1141,8 +1372,11 @@ msgstr "E177: Z msgid "E178: Invalid default value for count" msgstr "E178: Ungltige Voreinstellung fr den Zhler" -msgid "E179: argument required for complete" -msgstr "E179: Argument wird zur Vervollstndigung bentigt" +msgid "E179: argument required for -complete" +msgstr "E179: Argument bentigt fr -complete" + +msgid "E179: argument required for -addr" +msgstr "E179: Argument bentigt fr -addr" #, c-format msgid "E181: Invalid attribute: %s" @@ -1152,46 +1386,68 @@ msgid "E182: Invalid command name" msgstr "E182: Ungltiger Befehls-Name" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: Benutzerdefinierte Befehle mssen mit Grobuchstaben beginnen" +msgstr "E183: Benutzerdefinierte Befehle mssen mit Grobuchstaben beginnen." + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "" +"E841: Reservierter Name kann nicht fr benutzerdefinierten Befehl verwendet " +"werden." #, c-format msgid "E184: No such user-defined command: %s" msgstr "E184: Unbekannter benutzerdefinierter Befehl: %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Ungltiger Adresstyp: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Ungltiger Wert der Vervollstndigung: %s" msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: Argument fr Vervollstndigung nur fr eigene Vervollstndigung erlaubt" +msgstr "" +"E468: Argument fr Vervollstndigung nur fr benutzerdefinierte " +"Vervollstndigung erlaubt." msgid "E467: Custom completion requires a function argument" -msgstr "E467: Eigene Vervollstndigung bentigt eine Funktion als Argument" +msgstr "" +"E467: Benutzerdefinierte Vervollstndigung bentigt eine Funktion als " +"Argument." + +msgid "unknown" +msgstr "unbekannt" #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: Kann Farbschema %s nicht finden" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Kann Farbschema '%s' nicht finden" msgid "Greetings, Vim user!" msgstr "Herzliche Gre, Vim Benutzer!" msgid "E784: Cannot close last tab page" -msgstr "E784: Kann letztes Tab nicht schlieen" +msgstr "E784: Kann letzten Tab nicht schlieen." msgid "Already only one tab page" -msgstr "Es existiert bereits nur ein Tab" +msgstr "Es existiert nur ein Tab" msgid "Edit File in new window" msgstr "ffne Datei in einem neuen Fenster" +#, c-format +msgid "Tab page %d" +msgstr "Tab %d" + msgid "No swap file" msgstr "Keine Auslagerungsdatei" msgid "Append File" msgstr "Fge Datei an" -msgid "E747: Cannot change directory, buffer is modifed (add ! to override)" -msgstr "E747: Kann das Verzeichnis nicht wechseln, da der Puffer verndert wurde (erzwinge mit !)" +msgid "E747: Cannot change directory, buffer is modified (add ! to override)" +msgstr "" +"E747: Kann das Verzeichnis nicht wechseln, da der Puffer verndert wurde " +"(erzwinge mit !)" msgid "E186: No previous directory" msgstr "E186: Kein vorheriges Verzeichnis" @@ -1207,10 +1463,15 @@ msgid "Window position: X %d, Y %d" msgstr "Fenster-Position: X %d, Y %d" msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: Die Fensterposition kann fr dieses Terminal nicht bestimmt werden" +msgstr "" +"E188: Die Bestimmung der Fensterposition ist fr diese Plattform nicht " +"implementiert." msgid "E466: :winpos requires two number arguments" -msgstr "E466: :winpos bentigt zwei numerische Argumente" +msgstr "E466: :winpos bentigt zwei numerische Argumente." + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Kann :redir nicht innerhalb von execute() verwenden." msgid "Save Redirection" msgstr "Umleitung Speichern" @@ -1234,15 +1495,19 @@ msgstr "E189: \"%s\" existiert (erzwinge mit !)" #, c-format msgid "E190: Cannot open \"%s\" for writing" -msgstr "E190: \"%s\" kann nicht zum Schreiben geffnet werden" +msgstr "E190: \"%s\" kann nicht zum Schreiben geffnet werden." -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" -msgstr "E191: Argument muss ein Buchstabe oder vorwrts/rckwrts-Anfhrungszeichen sein" +msgstr "" +"E191: Argument muss ein Buchstabe oder vorwrts/rckwrts-Anfhrungszeichen " +"sein" msgid "E192: Recursive use of :normal too deep" msgstr "E192: Rekursive Verwendung von :normal zu tief" +msgid "E809: #< is not available without the +eval feature" +msgstr "E809: #< is ohne +eval Eigenschaft nicht verfgbar" + msgid "E194: No alternate file name to substitute for '#'" msgstr "E194: Kein anderer Dateiname zur Ersetzung mit '#'" @@ -1253,11 +1518,15 @@ msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" msgstr "E496: Keine Autokommando-Puffernummer zur Ersetzung mit \"<abuf>\"" msgid "E497: no autocommand match name to substitute for \"<amatch>\"" -msgstr "E497: Kein passender Name eines Autokommandos zur Ersetzung mit \"<amatch>\"" +msgstr "" +"E497: Kein passender Name eines Autokommandos zur Ersetzung mit \"<amatch>\"" msgid "E498: no :source file name to substitute for \"<sfile>\"" msgstr "E498: kein :source Dateiname zur Ersetzung mit \"<sfile>\"" +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: Keine Zeilennummer fr \"<slnum>\" vorhanden." + #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" msgstr "E499: Leerer Dateiname fr '%' oder '#', funktioniert nur mit \":p:h\"" @@ -1266,35 +1535,36 @@ msgid "E500: Evaluates to an empty string" msgstr "E500: Ergibt eine leere Zeichenkette" msgid "E195: Cannot open viminfo file for reading" -msgstr "E195: viminfo kann nicht zum Lesen geffnet werden" +msgstr "E195: viminfo kann nicht zum Lesen geffnet werden." + +msgid "Untitled" +msgstr "Unbenannt" msgid "E196: No digraphs in this version" -msgstr "E196: Keine Digraphen in dieser Version" +msgstr "E196: Keine Digraphen in dieser Version." msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: Kann nicht :throw Exceptions mit 'Vim' Prfix" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" -msgstr "Ausnahme geworfen: %s" +msgstr "Exception geworfen: %s" #, c-format msgid "Exception finished: %s" -msgstr "Ausnahme beendet: %s" +msgstr "Exception beendet: %s" #, c-format msgid "Exception discarded: %s" -msgstr "Ausnahme verworfen: %s" +msgstr "Exception verworfen: %s" #, c-format msgid "%s, line %ld" msgstr "%s, Zeile %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" -msgstr "Ausnahme gefangen: %s" +msgstr "Exception gefangen: %s" #, c-format msgid "%s made pending" @@ -1309,7 +1579,7 @@ msgid "%s discarded" msgstr "%s verworfen" msgid "Exception" -msgstr "Ausnahme" +msgstr "Exception" msgid "Error and interrupt" msgstr "Fehler und Unterbrechung" @@ -1317,7 +1587,6 @@ msgstr "Fehler und Unterbrechung" msgid "Error" msgstr "Fehler" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Unterbrechung" @@ -1339,20 +1608,20 @@ msgstr "E583: Mehrere :else" msgid "E584: :elseif after :else" msgstr "E584: :elseif nach :else" -msgid "E585: :while nesting too deep" -msgstr "E585: :while Schachtelung zu tief" +msgid "E585: :while/:for nesting too deep" +msgstr "E585: :while/:for Schachtelung zu tief" -msgid "E586: :continue without :while" -msgstr "E586: :continue ohne :while" +msgid "E586: :continue without :while or :for" +msgstr "E586: :continue ohne :while or :for" -msgid "E587: :break without :while" -msgstr "E587: :break ohne :while" +msgid "E587: :break without :while or :for" +msgstr "E587: :break ohne :while oder :for" msgid "E732: Using :endfor with :while" -msgstr "E732: Bentzung von :endfor mit :while" +msgstr "E732: Nutzung von :endfor mit :while" msgid "E733: Using :endwhile with :for" -msgstr "E733: Bentzung von :endwhile mit :for" +msgstr "E733: Nutzung von :endwhile mit :for" msgid "E601: :try nesting too deep" msgstr "E601: :try Schachtelung zu tief" @@ -1360,15 +1629,12 @@ msgstr "E601: :try Schachtelung zu tief" msgid "E603: :catch without :try" msgstr "E603: :catch ohne :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch nach :finally" msgid "E606: :finally without :try" msgstr "E606: :finally ohne :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: Mehrere :finally" @@ -1378,6 +1644,12 @@ msgstr "E602: :endtry ohne :try" msgid "E193: :endfunction not inside a function" msgstr "E193: :endfunction auerhalb einer Funktion" +msgid "E788: Not allowed to edit another buffer now" +msgstr "E788: Einen weiteren Puffer zu editieren ist im Moment nicht erlaubt" + +msgid "E811: Not allowed to change buffer information now" +msgstr "E811: Puffer Information darf momentan nicht gendert werden." + msgid "tagname" msgstr "Tag-Name" @@ -1407,12 +1679,18 @@ msgstr "Ausdruck" msgid "Input Line" msgstr "Eingabe-Zeile" +msgid "Debug Line" +msgstr "Debug-Zeile" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar ber die Lnge des Befehls hinaus" msgid "E199: Active window or buffer deleted" msgstr "E199: Aktives Fenster oder Puffer gelscht" +msgid "E812: Autocommands changed buffer or buffer name" +msgstr "E812: Autokommandos vernderten Puffer oder Puffername." + msgid "Illegal file name" msgstr "Unzulssiger Dateiname" @@ -1422,6 +1700,9 @@ msgstr "ist ein Verzeichnis" msgid "is not a file" msgstr "ist keine Datei" +msgid "is a device (disabled with 'opendevice' option)" +msgstr "ist ein Gert (durch 'opendevice' Option deaktiviert)" + msgid "[New File]" msgstr "[Neue Datei]" @@ -1438,7 +1719,8 @@ msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: *ReadPre Autokommandos haben die Datei unlesbar gemacht" msgid "E201: *ReadPre autocommands must not change current buffer" -msgstr "E201: *ReadPre Autokommandos drfen nicht den aktuellen Puffer wechseln" +msgstr "" +"E201: *ReadPre Autokommandos drfen nicht den aktuellen Puffer wechseln" msgid "Vim: Reading from stdin...\n" msgstr "Vim: Lese von stdin...\n" @@ -1446,9 +1728,8 @@ msgstr "Vim: Lese von stdin...\n" msgid "Reading from stdin..." msgstr "Lese von stdin..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" -msgstr "E202: Datei wurde unlesbar durch Umwandlung" +msgstr "E202: Datei wurde durch Konvertierung unlesbar!" msgid "[fifo/socket]" msgstr "[fifo/socket]" @@ -1459,15 +1740,12 @@ msgstr "[fifo]" msgid "[socket]" msgstr "[socket]" -msgid "[RO]" -msgstr "[RO]" +msgid "[character special]" +msgstr "[Zeichen spezial]" msgid "[CR missing]" msgstr "[CR fehlt]" -msgid "[NL found]" -msgstr "[NL gefunden]" - msgid "[long lines split]" msgstr "[lange Zeilen geteilt]" @@ -1477,9 +1755,6 @@ msgstr "[NICHT konvertiert]" msgid "[converted]" msgstr "[konvertiert]" -msgid "[crypted]" -msgstr "[verschlsselt]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "UMWANDLUNGSFEHLER in Zeile %ld]" @@ -1504,13 +1779,16 @@ msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Keine bereinstimmenden Autokommandos fr acwrite Puffer" msgid "E203: Autocommands deleted or unloaded buffer to be written" -msgstr "E203: Autokommandos haben den zu schreibenden Puffer gelscht oder entladen" +msgstr "" +"E203: Autokommandos haben den zu schreibenden Puffer gelscht oder entladen" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Autokommandos haben die Anzahl der Zeilen in unerwarteter Weise verndert" +msgstr "" +"E204: Autokommandos haben die Anzahl der Zeilen in unerwarteter Weise " +"verndert" msgid "NetBeans disallows writes of unmodified buffers" -msgstr "NetBeans verweigert das Schreiben von unvernderten Puffern" +msgstr "NetBeans verweigert das Schreiben von unvernderten Puffern." msgid "Partial writes disallowed for NetBeans buffers" msgstr "Partielles Schreiben fr NetBeans Puffer verweigert" @@ -1518,8 +1796,11 @@ msgstr "Partielles Schreiben f msgid "is not a file or writable device" msgstr "ist keine Datei oder beschreibbares Device" +msgid "writing to device disabled with 'opendevice' option" +msgstr "Schreiben auf Gert durch 'opendevice' Option deaktiviert." + msgid "is read-only (add ! to override)" -msgstr "ist Schreibgeschtzt (erzwinge mit !)" +msgstr "ist schreibgeschtzt (erzwinge mit !)" msgid "E506: Can't write to backup file (add ! to override)" msgstr "E506: Sicherungsdatei kann nicht geschrieben werden (erzwinge mit !)" @@ -1536,9 +1817,6 @@ msgstr "E509: Sicherungsdatei kann nicht angelegt werden (erzwinge mit !)" msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: Sicherungsdatei kann nicht erstellt werden (erzwinge mit !)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: Der Ressourcefork geht verloren (erzwinge mit !)" - msgid "E214: Can't find temp file for writing" msgstr "E214: Temporre Datei kann nicht zum Schreiben geffnet werden" @@ -1551,14 +1829,24 @@ msgstr "E166: Gelinkte Datei kann nicht zum Schreiben ge msgid "E212: Can't open file for writing" msgstr "E212: Datei kann nicht zum Schreiben geffnet werden" -msgid "E667: Fsync failed" -msgstr "E667: Fsync fehlgeschlagen" +msgid "E949: File changed while writing" +msgstr "E949: Datei wurde whrend des Schreibens verndert" msgid "E512: Close failed" msgstr "E512: Fehler beim Schlieen" -msgid "E513: write error, conversion failed" -msgstr "E513: Schreibfehler, Umwandlung schlug fehl" +msgid "E513: write error, conversion failed (make 'fenc' empty to override)" +msgstr "" +"E513: Schreibfehler, Umwandlung schlug fehl (leere 'fenc' um sie zu " +"erzwingen)" + +#, c-format +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "" +"E513: Schreibfehler, Konvertierung fehlgeschlagen in Zeile %ld (leere 'fenc' " +"um sie zu erzwingen)" msgid "E514: write error (file system full?)" msgstr "E514: Schreibfehler (Dateisystem voll?)" @@ -1566,6 +1854,10 @@ msgstr "E514: Schreibfehler (Dateisystem voll?)" msgid " CONVERSION ERROR" msgstr "KONVERTIERUNGSFEHLER" +#, c-format +msgid " in line %ld;" +msgstr " in Zeile %ld" + msgid "[Device]" msgstr "[Ausgabegert]" @@ -1598,10 +1890,11 @@ msgid "" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"ACHTUNG: Original-Datei kann verloren oder zerstrt sein\n" +"ACHTUNG: Original-Datei knnte verloren oder zerstrt sein\n" msgid "don't quit the editor until the file is successfully written!" -msgstr "beende nicht den Editor bis die Datei erfolgreich geschrieben wurde!" +msgstr "" +"beenden Sie nicht den Editor bis die Datei erfolgreich geschrieben wurde!" msgid "[dos]" msgstr "[dos]" @@ -1632,8 +1925,8 @@ msgid "1 character" msgstr "ein Zeichen" #, c-format -msgid "%ld characters" -msgstr "%ld Zeichen" +msgid "%lld characters" +msgstr "%lld Zeichen" msgid "[noeol]" msgstr "[noeol]" @@ -1641,9 +1934,6 @@ msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[Unvollstndige letzte Zeile]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "ACHTUNG: Die Datei wurde seit dem letzten Lesen gendert!!!" @@ -1666,34 +1956,46 @@ msgid "E246: FileChangedShell autocommand deleted buffer" msgstr "E246: FileChangedShell-Autokommando lschte Puffer" #, c-format -msgid "E211: Warning: File \"%s\" no longer available" -msgstr "E211: Achtung: Datei \"%s\" ist nicht lnger vorhanden" +msgid "E211: File \"%s\" no longer available" +msgstr "E211: Datei \"%s\" ist nicht lnger vorhanden" #, c-format msgid "" "W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " "well" msgstr "" -"W12: Achtung: Datei \"%s\" wurde verndert und der Puffer wurde ebenfalls in " -"Vim verndert" +"W12: Achtung: Datei \"%s\" wurde verndert und der Puffer wurde in Vim " +"ebenfalls verndert" + +msgid "See \":help W12\" for more info." +msgstr "Siehe \":help W12\" fr mehr Information" #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Achtung: Datei \"%s\" wurde verndert, seit mit dem Editieren angefangen wurde" +msgstr "" +"W11: Achtung: Datei \"%s\" wurde verndert, seit mit dem Editieren " +"angefangen wurde" -#, c-format -msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" -msgstr "W16: Achtung: Mode der Datei \"%s\" wurde verndert seit mit dem Editieren angefangen wurde" +msgid "See \":help W11\" for more info." +msgstr "Siehe \":help W11\" fr mehr Information" #, c-format -msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Achtung: Datei \"%s\" wurde erstellt, nachdem mit dem Editieren begonnen wurde" +msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" +msgstr "" +"W16: Achtung: Mode der Datei \"%s\" wurde verndert seit mit dem Editieren " +"angefangen wurde" msgid "See \":help W16\" for more info." msgstr "Siehe \":help W16\" fr mehr Information" +#, c-format +msgid "W13: Warning: File \"%s\" has been created after editing started" +msgstr "" +"W13: Achtung: Datei \"%s\" wurde erstellt, nachdem mit dem Editieren " +"begonnen wurde" + msgid "Warning" -msgstr "Warnung" +msgstr "Achtung" msgid "" "&OK\n" @@ -1713,11 +2015,20 @@ msgstr "E321: \"%s\" konnte nicht neu geladen werden" msgid "--Deleted--" msgstr "--gelscht--" -#. the group doesn't exist +#, c-format +msgid "auto-removing autocommand: %s <buffer=%d>" +msgstr "Entferne Autokommando: %s <buffer=%d>" + #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Keine solche Gruppe: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: Kann die aktuelle Gruppe nicht lschen." + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Lsche Autogruppe, die noch in Benutztung ist." + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Unzulssiges Zeichen nach *: %s" @@ -1730,7 +2041,6 @@ msgstr "E216: Kein derartiges Ereignis: %s" msgid "E216: No such group or event: %s" msgstr "E216: Keine solche Gruppe oder Ereignis: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -1759,7 +2069,6 @@ msgstr "%s Autokommandos f msgid "Executing %s" msgstr "Ausfhrung von %s" -#. always scroll up, don't overwrite #, c-format msgid "autocommand %s" msgstr "Autokommando %s" @@ -1774,55 +2083,64 @@ msgid "E490: No fold found" msgstr "E490: Keine Faltung gefunden" msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: Faltung kann mit der aktuellen Faltungsmethode nicht erzeugt werden" +msgstr "" +"E350: Faltung kann mit der aktuellen Faltungsmethode nicht erzeugt werden" msgid "E351: Cannot delete fold with current 'foldmethod'" -msgstr "E351: Faltung kann mit der aktuellen Faltungsmethode nicht gelscht werden" +msgstr "" +"E351: Faltung kann mit der aktuellen Faltungsmethode nicht gelscht werden" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld Zeilen gefaltet " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "%3ld Zeile gefaltet " +msgstr[1] "%3ld Zeilen gefaltet " msgid "E222: Add to read buffer" msgstr "E222: Zum Lesepuffer hinzufgen" msgid "E223: recursive mapping" -msgstr "E223: rekursive Zuordnung" +msgstr "E223: rekursives Mapping" #, c-format msgid "E224: global abbreviation already exists for %s" -msgstr "E224: Globale Abkrzung fr %s existiert bereits" +msgstr "E224: Globale Kurzform fr %s existiert bereits" #, c-format msgid "E225: global mapping already exists for %s" -msgstr "E225: Globale Zuordnung fr %s existiert bereits" +msgstr "E225: Globales Mapping fr %s existiert bereits" #, c-format msgid "E226: abbreviation already exists for %s" -msgstr "E226: Abkrzung fr %s existiert bereits" +msgstr "E226: Kurzform %s existiert bereits" #, c-format msgid "E227: mapping already exists for %s" -msgstr "E227: Zuordnung fr %s existiert bereits" +msgstr "E227: Mapping fr %s existiert bereits" msgid "No abbreviation found" -msgstr "Keine Abkrzung gefunden" +msgstr "Keine Kurzform gefunden" msgid "No mapping found" -msgstr "Keine Zuordnung gefunden" +msgstr "Kein Mapping gefunden" msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Unzulssiger Modus" +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Erstellung des GUI-Prozesses fehlgeschlagen" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: Der Kindprozess zum Starten der GUI fehlgeschlagen." + msgid "E229: Cannot start the GUI" -msgstr "E229: GUI kann nicht gestartet werden" +msgstr "E229: GUI kann nicht gestartet werden." #, c-format msgid "E230: Cannot read from \"%s\"" msgstr "E230: Kann nicht von \"%s\" lesen" msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: GUI kann nicht gestartet werden, keine gltige Schrift gefunden" +msgstr "E665: GUI kann nicht gestartet werden, keine gltige Schrift gefunden." msgid "E231: 'guifontwide' invalid" msgstr "E231: 'guifontwide' ungltig" @@ -1832,7 +2150,10 @@ msgstr "E599: Wert von 'imactivatekey' ist ung #, c-format msgid "E254: Cannot allocate color %s" -msgstr "E254: Kann die Farbe %s nicht zuweisen" +msgstr "E254: Kann die Farbe %s nicht zuweisen." + +msgid "No match at cursor, finding next" +msgstr "Kein Treffer beim Cursor, finde den nchsten" msgid "<cannot open> " msgstr "<kann nicht ffnen> " @@ -1842,13 +2163,13 @@ msgid "E616: vim_SelFile: can't get font %s" msgstr "E616: vim_SelFile: kann Schriftart %s nicht erhalten" msgid "E614: vim_SelFile: can't return to current directory" -msgstr "E614: vim_SelFile: kann nicht zum laufenden Verzeichnis zurckkehren" +msgstr "E614: vim_SelFile: kann nicht zum laufenden Verzeichnis zurckkehren." msgid "Pathname:" msgstr "Pfad:" msgid "E615: vim_SelFile: can't get current directory" -msgstr "E615: vim_SelFile: aktuelles Verzeichnis kann nicht ermittelt werden" +msgstr "E615: vim_SelFile: aktuelles Verzeichnis kann nicht ermittelt werden." msgid "OK" msgstr "OK" @@ -1857,16 +2178,27 @@ msgid "Cancel" msgstr "Abbrechen" msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." -msgstr "Scrollbar Widget: Geometrie des Bildchens kann nicht ermittelt werden" +msgstr "Scrollbar Widget: Geometrie des Bildchens kann nicht ermittelt werden." msgid "Vim dialog" msgstr "Vim-Dialog" msgid "E232: Cannot create BalloonEval with both message and callback" -msgstr "E232: BalloonEval kann nicht mit sowohl \"message\" und \"callback\" erzeugt werden" +msgstr "" +"E232: BalloonEval kann nicht mit sowohl \"message\" und \"callback\" erzeugt " +"werden" -msgid "Vim dialog..." -msgstr "Vim-Dialog..." +msgid "_Cancel" +msgstr "_Abbrechen" + +msgid "_Save" +msgstr "_Speichern" + +msgid "_Open" +msgstr "_ffnen" + +msgid "_OK" +msgstr "_OK" msgid "" "&Yes\n" @@ -1877,6 +2209,12 @@ msgstr "" "&Nein\n" "&Abbrechen" +msgid "Yes" +msgstr "Ja" + +msgid "No" +msgstr "Nein" + msgid "Input _Methods" msgstr "Eingabe _Methoden" @@ -1892,18 +2230,15 @@ msgstr "Wonach suchen:" msgid "Replace with:" msgstr "Ersetzen mit:" -#. whole word only button msgid "Match whole word only" msgstr "Nur ganzes Wort suchen" -#. match case button msgid "Match case" msgstr "Gro-/Kleinschreibung" msgid "Direction" msgstr "Richtung" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Aufwrts" @@ -1919,27 +2254,24 @@ msgstr "Ersetzen" msgid "Replace All" msgstr "Alle ersetzen" +msgid "_Close" +msgstr "_Schlieen" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: \"die\"-Request von Session-Manager erhalten\n" -msgid "Close" -msgstr "Schliee" +msgid "Close tab" +msgstr "Tab schlieen" msgid "New tab" -msgstr "Neues Tab" +msgstr "Neuer Tab" msgid "Open Tab..." -msgstr "ffne in Tab..." +msgstr "ffne Tab..." msgid "Vim: Main window unexpectedly destroyed\n" msgstr "Vim: Hauptfenster unerwartet gelscht\n" -msgid "Font Selection" -msgstr "Auswahl der Schriftart" - -msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "CUT_BUFFER0 anstatt der leeren Auswahl benutzt" - msgid "&Filter" msgstr "&Filter" @@ -1976,43 +2308,42 @@ msgstr "Ersetze &alles" msgid "&Undo" msgstr "&Rckgngig" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Kann Fenstertitel \"%s\" nicht finden" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argument wird nicht untersttzt: \"-%s\"; verwende die OLE Version." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Kann Fenster nicht innerhalb einer MDI Anwendung ffnen" - -msgid "Close tab" -msgstr "Tab schlieen" - msgid "Open tab..." -msgstr "ffne in Tab..." +msgstr "ffne Tab..." msgid "Find string (use '\\\\' to find a '\\')" -msgstr "Suche (bentze '\\\\' um ein '\\' zu finden)" +msgstr "Suche (benutze '\\\\' um ein '\\' zu finden)" msgid "Find & Replace (use '\\\\' to find a '\\')" -msgstr "Suche & Ersetze (bentze '\\\\' um ein '\\' zu finden)" +msgstr "Suche & Ersetze (benutze '\\\\' um ein '\\' zu finden)" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Nicht verwendet" msgid "Directory\t*.nothing\n" msgstr "Verzeichnis\t*.nichts\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Kann Fenstertitel \"%s\" nicht finden" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "" +"E243: Argument wird nicht untersttzt: \"-%s\"; verwende die OLE Version." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Kann Fenster nicht innerhalb einer MDI Anwendung ffnen" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" -msgstr "Vim E458: \"Colormap\"-Eintrag kann nicht zugewiesen werden, einige Farben knnen falsch sein" +msgstr "" +"Vim E458: \"Colormap\"-Eintrag kann nicht zugewiesen werden, einige Farben " +"knnen falsch sein" #, c-format msgid "E250: Fonts for the following charsets are missing in fontset %s:" -msgstr "E250: Schriftarten fr die folgenden Zeichenstze fehlen im Fontset %s:" +msgstr "" +"E250: Schriftarten fr die folgenden Zeichenstze fehlen im Fontset %s:" #, c-format msgid "E252: Fontset name: %s" @@ -2023,32 +2354,28 @@ msgid "Font '%s' is not fixed-width" msgstr "Schriftart '%s' hat keine feste Breite" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Fontset Name: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Fontset Name: %s" #, c-format -msgid "Font0: %s\n" -msgstr "Schriftart 0: %s\n" +msgid "Font0: %s" +msgstr "Schriftart 0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Schriftart 1: %s\n" +msgid "Font1: %s" +msgstr "Schriftart 1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "Die Breite der Schriftart %ld ist nicht doppelt so gro wie die der Schriftart 0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "Breite der Schriftart%ld ist nicht doppelt so breit wie Schriftart0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Schriftart 0 Breite: %ld\n" +msgid "Font0 width: %ld" +msgstr "Schriftart 0 Breite: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Schriftart 1 Breite: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Schriftart 1 Breite: %ld" msgid "Invalid font specification" msgstr "Ungltige Spezifikation der Schriftart" @@ -2065,7 +2392,6 @@ msgstr "Vim - Auswahl der Schriftart" msgid "Name:" msgstr "Name:" -#. create toggle button msgid "Show size in Points" msgstr "Zeige Gre in Punkten" @@ -2120,23 +2446,23 @@ msgstr "E455: Fehler beim Schreiben der PostScript-Ausgabedatei" #, c-format msgid "E624: Can't open file \"%s\"" -msgstr "E624: Datei \"%s\" kann nicht geffnet werden" +msgstr "E624: Datei \"%s\" kann nicht geffnet werden." #, c-format msgid "E457: Can't read PostScript resource file \"%s\"" -msgstr "E457: PostScript Ressource-Datei \"%s\" kann nicht gelesen werden" +msgstr "E457: PostScript Ressource-Datei \"%s\" kann nicht gelesen werden." #, c-format msgid "E618: file \"%s\" is not a PostScript resource file" -msgstr "E618: Datei \"%s\" ist keine PostScript Ressource-Datei" +msgstr "E618: Datei \"%s\" ist keine PostScript Ressource-Datei." #, c-format msgid "E619: file \"%s\" is not a supported PostScript resource file" -msgstr "E619: Datei \"%s\" ist keine untersttzte PostScript Ressource-Datei" +msgstr "E619: Datei \"%s\" ist keine untersttzte PostScript Ressource-Datei." #, c-format msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: \"%s\" Ressource-Datei hat die falsche Version" +msgstr "E621: \"%s\" Ressource-Datei hat die falsche Version." msgid "E673: Incompatible multi-byte encoding and character set." msgstr "E673: Unzulssiger Multi-Byte Zeichensatz" @@ -2152,13 +2478,13 @@ msgstr "E324: PostScript Ausgabe-Datei kann nicht ge #, c-format msgid "E456: Can't open file \"%s\"" -msgstr "E456: Datei \"%s\" kann nicht geffnet werden" +msgstr "E456: Datei \"%s\" kann nicht geffnet werden." msgid "E456: Can't find PostScript resource file \"prolog.ps\"" -msgstr "E456: PostScript Ressource-Datei \"prolog.ps\" nicht gefunden" +msgstr "E456: PostScript Ressource-Datei \"prolog.ps\" nicht gefunden." msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" -msgstr "E456: PostScript Ressource-Datei \"cidfont.ps\" nicht gefunden" +msgstr "E456: PostScript Ressource-Datei \"cidfont.ps\" nicht gefunden." #, c-format msgid "E456: Can't find PostScript resource file \"%s.ps\"" @@ -2166,7 +2492,8 @@ msgstr "E456: PostScript Ressource-Datei \"%s\" nicht gefunden" #, c-format msgid "E620: Unable to convert to print encoding \"%s\"" -msgstr "E620: Umwandlung nach dem Zeichensatz fr den Ausdruck \"%s\" fehlgeschlagen" +msgstr "" +"E620: Umwandlung nach dem Zeichensatz fr den Ausdruck \"%s\" fehlgeschlagen" msgid "Sending to printer..." msgstr "Schicke zum Drucker..." @@ -2225,7 +2552,7 @@ msgstr "csope Datenbank %s hinzugef #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: Fehler beim Lesen aus der cscope Verbindung %ld" +msgstr "E262: Fehler beim Lesen der cscope Verbindung %ld" msgid "E561: unknown cscope search type" msgstr "E561: Unbekannter cscope Suchtyp" @@ -2234,37 +2561,63 @@ msgid "E566: Could not create cscope pipes" msgstr "E566: cscope Pipes konnten nicht angelegt werden" msgid "E622: Could not fork for cscope" -msgstr "E622: Konnte nicht fr cscope verzweigen" +msgstr "E622: Konnte Fork fr cscope nicht erstellen." -msgid "cs_create_connection exec failed" -msgstr "cs_create_connection exec misslang" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid fehlgeschlagen" -msgid "E623: Could not spawn cscope process" -msgstr "E623: Konnte cscope Prozess nicht hervorbringen" +msgid "cs_create_connection exec failed" +msgstr "cs_create_connection exec fehlgeschlagen" msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen von to_fp misslang" +msgstr "cs_create_connection: fdopen von to_fp fehlgeschlagen" msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen von fr_fp misslang" +msgstr "cs_create_connection: fdopen von fr_fp fehlgeschlagen" + +msgid "E623: Could not spawn cscope process" +msgstr "E623: Konnte cscope Prozess nicht starten" msgid "E567: no cscope connections" msgstr "E567: Keine cscope Verbindungen" -#, c-format -msgid "E259: no matches found for cscope query %s of %s" -msgstr "E259: keine bereinstimmungen gefunden fr cscope Abfrage %s aus %s" - #, c-format msgid "E469: invalid cscopequickfix flag %c for %c" msgstr "E469: Unzulssiges cscopequickfix Flag %c fr %c" +#, c-format +msgid "E259: no matches found for cscope query %s of %s" +msgstr "E259: keine bereinstimmungen gefunden fr cscope Abfrage %s aus %s" + msgid "cscope commands:\n" msgstr "cscope Befehle:\n" #, c-format -msgid "%-5s: %-30s (Usage: %s)" -msgstr "%-5s: %-30s (Verwendung: %s)" +msgid "%-5s: %s%*s (Usage: %s)" +msgstr "%-5s: %s%*s (Verwendung: %s)" + +msgid "" +"\n" +" a: Find assignments to this symbol\n" +" c: Find functions calling this function\n" +" d: Find functions called by this function\n" +" e: Find this egrep pattern\n" +" f: Find this file\n" +" g: Find this definition\n" +" i: Find files #including this file\n" +" s: Find this C symbol\n" +" t: Find this text string\n" +msgstr "" +"\n" +" a: Finde Zuweisungen dieses Symbols\n" +" c: Finde Funktionen, die diese Funktion aufrufen\n" +" d: Finde Funktionen, die von dieser Funktion aufgerufen werden\n" +" e: Finde dieses egrep Muster\n" +" f: Finde diese Datei\n" +" g: Finde diese Definition\n" +" i: Finde Dateien, die diese Datei #inkludieren\n" +" s: Finde dieses C Symbol\n" +" t: Finde diese Zeichenkette\n" #, c-format msgid "E625: cannot open cscope database: %s" @@ -2274,10 +2627,7 @@ msgid "E626: cannot get cscope database information" msgstr "E626: Kann cscope Datenbank-Informationen nicht bekommen" msgid "E568: duplicate cscope database not added" -msgstr "E568: cscope Datenbank nicht doppelt hinzugefgt" - -msgid "E569: maximum number of cscope connections reached" -msgstr "E569: Maximale Anzahl von cscope Verbindungen erreicht" +msgstr "E568: doppelte cscope Datenbank nicht hinzugefgt" #, c-format msgid "E261: cscope connection %s not found" @@ -2287,7 +2637,6 @@ msgstr "E261: cscope Verbindung %s nicht gefunden" msgid "cscope connection %s closed" msgstr "cscope Verbindung %s geschlossen" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: Fataler Fehler in cs_manage_matches" @@ -2318,12 +2667,25 @@ msgstr "keine cscope-Verbindungen\n" msgid " # pid database name prepend path\n" msgstr " # pid Datenbank Name\t fhrender Pfad\n" +msgid "Lua library cannot be loaded." +msgstr "Lua bibliothek kann nicht geladen werden." + +msgid "cannot save undo information" +msgstr "kann Information fr die Wiederherstellung nicht speichern" + msgid "" -"???: Sorry, this command is disabled, the MzScheme library could not be " +"E815: Sorry, this command is disabled, the MzScheme libraries could not be " "loaded." msgstr "" -"???: Dieser Befehl ist nicht verfgbar, die MzScheme Bibliothek konnte nicht " -"geladen werden" +"E815: Dieser Befehl ist nicht verfgbar, da die MzScheme Bibliotheken nicht " +"geladen werden konnte." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895 Dieser Befehl ist nicht verfgbar, da die MzScheme racket/basis Module " +"nicht geladen werden konnten." msgid "invalid expression" msgstr "ungltiger Ausdruck" @@ -2343,9 +2705,6 @@ msgstr "Fensterindex au msgid "couldn't open buffer" msgstr "konnte Puffer nicht ffnen" -msgid "cannot save undo information" -msgstr "kann Information fr die Wiederherstellung nicht speichern" - msgid "cannot delete line" msgstr "Zeile kann nicht gelscht werden" @@ -2358,186 +2717,80 @@ msgstr "Zeile kann nicht eingef msgid "string cannot contain newlines" msgstr "Zeichenfolge kann keine Zeilenwechsel enthalten" +msgid "error converting Scheme values to Vim" +msgstr "Fehler beim Konvertieren der Scheme Werte nach Vim." + msgid "Vim error: ~a" msgstr "Vim Fehler: ~a" msgid "Vim error" -msgstr "Vim Fehler" - -msgid "buffer is invalid" -msgstr "ungltiger Puffer" - -msgid "window is invalid" -msgstr "ungltiges Fenster" - -msgid "linenr out of range" -msgstr "'linenr' auerhalb des zulssigen Bereichs" - -msgid "not allowed in the Vim sandbox" -msgstr "in der Vim-Sandbox nicht erlaubt" - -msgid "" -"E263: Sorry, this command is disabled, the Python library could not be " -"loaded." -msgstr "" -"E263: Dieser Befehl ist nicht verfgbar, die Python-Bibliothek konnte nicht " -"geladen werden" - -msgid "E659: Cannot invoke Python recursively" -msgstr "E659: Kann Python nicht rekursiv ausfhren" - -msgid "can't delete OutputObject attributes" -msgstr "OutputObject-Attribute knnen nicht gelscht werden" - -msgid "softspace must be an integer" -msgstr "\"softspace\" muss eine ganze Zahl sein" - -msgid "invalid attribute" -msgstr "unzulssiges Attribut" - -msgid "writelines() requires list of strings" -msgstr "writelines() verlangt eine Liste von Zeichenfolgen" - -msgid "E264: Python: Error initialising I/O objects" -msgstr "E264: Python: Fehler bei der Initialisierung von I/O Objekten" - -msgid "attempt to refer to deleted buffer" -msgstr "Versuch, Bezug auf einen gelschten Puffer zu nehmen" - -msgid "line number out of range" -msgstr "Zeilennummer auerhalb des zulssigen Bereichs" - -#, c-format -msgid "<buffer object (deleted) at %8lX>" -msgstr "<Pufferobjekt (gelscht) bei %8lX>" - -msgid "invalid mark name" -msgstr "ungltiger Name einer Markierung" - -msgid "no such buffer" -msgstr "kein solcher Puffer vorhanden" - -msgid "attempt to refer to deleted window" -msgstr "Versuch, Bezug auf eine gelschtes Fenster zu nehmen" - -msgid "readonly attribute" -msgstr "nur-Lesen Attribut" - -msgid "cursor position outside buffer" -msgstr "Cursor Position auerhalb des Puffers" - -#, c-format -msgid "<window object (deleted) at %.8lX>" -msgstr "<Fensterobjekt (gelscht) bei %.8lX>" - -#, c-format -msgid "<window object (unknown) at %.8lX>" -msgstr "<Fensterobjekt (unbekannt) bei %.8lX>" - -#, c-format -msgid "<window %d>" -msgstr "<Fenster %d>" - -msgid "no such window" -msgstr "ungltiges Fenster" - -msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: Dieser Befehl ist nicht verfgbar, die Ruby Bibliothek konnte nicht geladen werden" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: Unbekannter longjmp Status %d" - -msgid "Toggle implementation/definition" -msgstr "Umschaltung zwischen Implementierung/Definition" - -msgid "Show base class of" -msgstr "Zeige Basis-Klasse von" - -msgid "Show overridden member function" -msgstr "Zeige berschriebene Methode" - -msgid "Retrieve from file" -msgstr "Beziehe aus Datei" - -msgid "Retrieve from project" -msgstr "Beziehe aus Projekt" - -msgid "Retrieve from all projects" -msgstr "Beziehe aus allen Projekten" - -msgid "Retrieve" -msgstr "Beziehe" - -msgid "Show source of" -msgstr "Zeige die Quelle von" +msgstr "Vim Fehler" -msgid "Find symbol" -msgstr "Finde Symbol" +msgid "buffer is invalid" +msgstr "ungltiger Puffer" -msgid "Browse class" -msgstr "Durchsehe Klassen" +msgid "window is invalid" +msgstr "ungltiges Fenster" -msgid "Show class in hierarchy" -msgstr "Zeige Klasse in Hierarchie" +msgid "linenr out of range" +msgstr "Zeilennummer auerhalb des zulssigen Bereichs" -msgid "Show class in restricted hierarchy" -msgstr "Zeige Klasse in eingeschrnkter Hierarchie" +msgid "not allowed in the Vim sandbox" +msgstr "innerhalb der Vim-Sandbox nicht erlaubt" -msgid "Xref refers to" -msgstr "Xref bezieht sich auf" +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Dieser Vim kann :python nicht nach :py3 ausfhren." -msgid "Xref referred by" -msgstr "Xref hat Bezge zu" +msgid "" +"E263: Sorry, this command is disabled, the Python library could not be " +"loaded." +msgstr "" +"E263: Dieser Befehl ist nicht verfgbar, die Python-Bibliothek konnte nicht " +"geladen werden" -msgid "Xref has a" -msgstr "Xref hat ein" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Dieser Befehl ist nicht verfgbar, da das Python site Module nicht " +"geladen werden konnte." -msgid "Xref used by" -msgstr "Xref wird verwendet von" +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Kann Python nicht rekursiv ausfhren" -msgid "Show docu of" -msgstr "Zeige Docu aus" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Dieser Vim kann :py3 nicht nach :python ausfhren." -msgid "Generate docu for" -msgstr "Generiere Docu fr" +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ muss eine Instanz einer Zeichenkette sein" msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"Kann keine verbindung zu SNiFF+ aufnehmen. Prfe die Umgebung (sniffemacs " -"muss in $PATH) zu finden sein.\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Fehler beim Lesen. Verbindung abgebrochen" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ ist zur Zeit" +"E266: Dieser Befehl ist nicht verfgbar, die Ruby Bibliothek konnte nicht " +"geladen werden" -msgid "not " -msgstr "nicht" +msgid "E267: unexpected return" +msgstr "E267: Unerwartetes 'return'" -msgid "connected" -msgstr "verbunden" +msgid "E268: unexpected next" +msgstr "E268: Unerwartetes 'next'" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Unbekannte SNiFF+ Anfrage: %s" +msgid "E269: unexpected break" +msgstr "E269: Unerwartetes 'break'" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Fehler beim Herstellen der Verbindung mit SNiFF+" +msgid "E270: unexpected redo" +msgstr "E270: Unerwartetes 'redo'" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ ist nicht verbunden" +msgid "E271: retry outside of rescue clause" +msgstr "E271: 'retry' auerhalb der 'rescue clause'" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Ist kein SNiFF+ Puffer" +msgid "E272: unhandled exception" +msgstr "E272: Unbehandelte Exception" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Fehler beim Schreiben. Verbindung abgebrochen" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: Unbekannter longjmp Status %d" msgid "invalid buffer number" msgstr "ungltige Puffernummer" @@ -2545,12 +2798,14 @@ msgstr "ung msgid "not implemented yet" msgstr "nicht implementiert" -#. ??? msgid "cannot set line(s)" -msgstr "kann keine Zeile/Zeilen setzen" +msgstr "kann Zeile(n) nicht setzen" + +msgid "invalid mark name" +msgstr "ungltiger Name einer Markierung" msgid "mark not set" -msgstr "Marke nicht gesetzt" +msgstr "Markierung nicht gesetzt" #, c-format msgid "row %d column %d" @@ -2559,6 +2814,9 @@ msgstr "Zeile %d Spalte %d" msgid "cannot insert/append line" msgstr "kann Zeile nicht ein-/anfgen" +msgid "line number out of range" +msgstr "Zeilennummer auerhalb des zulssigen Bereichs" + msgid "unknown flag: " msgstr "unbekanntes Flag: " @@ -2572,33 +2830,31 @@ msgid "vim error" msgstr "vim Fehler" msgid "cannot create buffer/window command: object is being deleted" -msgstr "Puffer/Fenster-Befehl kann nicht ausgefhrt werden: das Objekt wird gelscht" +msgstr "" +"Puffer/Fenster-Befehl kann nicht ausgefhrt werden: das Objekt wird gelscht" msgid "" "cannot register callback command: buffer/window is already being deleted" msgstr "" "kann keinen Callback-Befehl registrieren: Puffer/Fenster ist bereits gelscht" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" msgstr "" -"E280: TCL FATALER FEHLER: reflist kaputt!? Bitte vim-dev@vim.org" -"benachrichtigen." +"E280: TCL FATALER FEHLER: reflist kaputt!? Bitte vim-dev@vim." +"orgbenachrichtigen." msgid "cannot register callback command: buffer/window reference not found" -msgstr "kann keinen Callback-Befehl registrieren: Puffer/Fenster-Referenz nicht gefunden" - -msgid "" -"E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E571: Dieser Befehl ist nicht verfgbar: die Tcl Bibliothek konnte nicht geladen werden" +"kann keinen Callback-Befehl registrieren: Puffer/Fenster-Referenz nicht " +"gefunden" msgid "" -"E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" +"E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E281: TCL FEHLER: Exit-Code ist nicht int!? Bitte vim-dev@vim.org benachrichtigen." +"E571: Dieser Befehl ist nicht verfgbar: die Tcl Bibliothek konnte nicht " +"geladen werden" #, c-format msgid "E572: exit code %d" @@ -2620,6 +2876,18 @@ msgstr "E573: Ung msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: Registry-Eigenschaft der VIM Instanz ist fehlerhaft. Gelscht!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Doppelter Schlssel im JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Fehlendes Komma in der Liste: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Fehlendes Ende der Liste ']': %s" + msgid "Unknown option argument" msgstr "Unbekanntes Optionsargument" @@ -2638,8 +2906,20 @@ msgstr "Zu viele \"+command\", \"-c command\" oder \"--cmd command\" Argumente" msgid "Invalid argument for" msgstr "Ungltiges Argument fr" +#, c-format +msgid "%d files to edit\n" +msgstr "%d Dateien zum Editieren\n" + +msgid "netbeans is not supported with this GUI\n" +msgstr "netbeans wird in dieser GUI nicht untersttzt\n" + +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr "" +"'-nb' kann nicht benutzt werden: Wurde zum Zeitpunkt des bersetzens " +"deaktiviert.\n" + msgid "This Vim was not compiled with the diff feature." -msgstr "Vim wurde nicht mit der \"diff\"-Eigenschaft bersetzt" +msgstr "Vim wurde nicht mit der \"diff\"-Eigenschaft bersetzt." msgid "Attempt to open script file again: \"" msgstr "Versuche, die Skript-Datei erneut zu ffnen: \"" @@ -2653,13 +2933,17 @@ msgstr "kann nicht zur Skript-Ausgabe ge msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: Fehler: Konnte gvim nicht von NetBeans aus starten\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "" +"Vim: Fehler: Diese Version von Vim kann nicht in einem Cygwin Terminal " +"ausgefhrt werden\n" + msgid "Vim: Warning: Output is not to a terminal\n" -msgstr "Vim: Warnung: Die Ausgabe erfolgt nicht auf einem Terminal\n" +msgstr "Vim: Achtung: Die Ausgabe erfolgt nicht auf einem Terminal\n" msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Warnung: Die Eingabe kommt nicht von einem Terminal\n" +msgstr "Vim: Achtung: Die Eingabe kommt nicht von einem Terminal\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "pre-vimrc Befehls-Zeile" @@ -2705,6 +2989,14 @@ msgstr "" "\n" " oder:" +msgid "" +"\n" +"Where case is ignored prepend / to make flag upper case" +msgstr "" +"\n" +"Wo Gro/Kleinschreibung ignoriert wird, fge / am Anfang hinzu um das Flag " +"gro zuschreiben." + msgid "" "\n" "\n" @@ -2738,6 +3030,9 @@ msgstr "-v\t\t\tVi Modus (wie \"vi\")" msgid "-e\t\t\tEx mode (like \"ex\")" msgstr "-e\t\t\tEx Modus (wie \"ex\")" +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tVerbesserter Ex Modus" + msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" msgstr "-s\t\t\tLeiser (batch) Modus (nur fr \"ex\")" @@ -2748,13 +3043,13 @@ msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" msgstr "-y\t\t\tLeichter Modus (wie \"evim\", ohne Modi)" msgid "-R\t\t\tReadonly mode (like \"view\")" -msgstr "-R\t\t\tModus ohne Schreibrechte (wie \"view\")" +msgstr "-R\t\t\tNur Lese-Modus (wie \"view\")" msgid "-Z\t\t\tRestricted mode (like \"rvim\")" msgstr "-Z\t\t\tEingeschrnkter Modus (wie \"rvim\")" msgid "-m\t\t\tModifications (writing files) not allowed" -msgstr "-m\t\t\tModifikationen (beim Schreiben von Dateien) sind nicht erlaubt" +msgstr "-m\t\t\tModifikationen (Schreiben von Dateien) sind nicht erlaubt" msgid "-M\t\t\tModifications in text not allowed" msgstr "-M\t\t\tModifikationen im Text nicht erlaubt" @@ -2771,8 +3066,8 @@ msgstr "-C\t\t\tKompatibel zu Vi: 'compatible'" msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" msgstr "-N\t\t\tNicht ganz kompatibel zu Vi: 'nocompatible'" -msgid "-V[N]\t\tVerbose level" -msgstr "-V[N]\t\tVerbose Stufe" +msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" +msgstr "-V[N][Datei]\t\tVerbose [level N] [Logge nach Datei]" msgid "-D\t\t\tDebugging mode" msgstr "-D\t\t\tDebug-Modus" @@ -2787,7 +3082,7 @@ msgid "-r (with file name)\tRecover crashed session" msgstr "-r (mit Dateiname)\tStelle abgestrzte Session wieder her" msgid "-L\t\t\tSame as -r" -msgstr "-L\t\t\tGenauso wie z -r" +msgstr "-L\t\t\tGenauso wie -r" msgid "-f\t\t\tDon't use newcli to open window" msgstr "-f\t\t\tVerwende nicht newcli zum ffnen eines neuen Fensters" @@ -2807,6 +3102,16 @@ msgstr "-F\t\t\tStart im Farsi Modus" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\tSetze Terminaltyp auf <terminal>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "" +"--not-a-term\t\tKeine Warnung ausgeben, wenn Eingabe/Ausgabe nicht auf einem " +"Terminal ausgegebn wird" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "" +"--ttyfail\t\tBeende, wenn Ein- oder Ausgabe nicht auf einem Terminal " +"ausgegeben wird" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tBenutze <vimrc> anstatt jeglicher .vimrc" @@ -2816,8 +3121,11 @@ msgstr "-U <gvimrc>\t\tBenutze <gvimrc> anstatt jeglicher .gvimrc" msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tlade keine \"plugin\"-Skripte" +msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" +msgstr "-p[N]\t\tffne N Tabs (Vorgabe: einen fr jede Datei)" + msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "-o[N]\t\tffne N Fenster (Vorgabe: einzeln fr jede Datei)" +msgstr "-o[N]\t\tffne N Fenster (Vorgabe: fr jede Datei eins)" msgid "-O[N]\t\tLike -o but split vertically" msgstr "-O[N]\t\tWie -o, aber teile vertikal" @@ -2838,16 +3146,19 @@ msgid "-S <session>\t\tSource file <session> after loading the first file" msgstr "-S <session>\t\tLese Datei <session> nach dem Laden der ersten Datei" msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" -msgstr "-s <scriptin>\tLese Normal-Modus Befehle aus der Skript-Datei <scriptin>" +msgstr "" +"-s <scriptin>\tLese Normal-Modus Befehle aus der Skript-Datei <scriptin>" msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" -msgstr "-w <scriptout>\tBefehle am Ende der Skript-Datei <scriptout> anfgen" +msgstr "" +"-w <scriptout>\tAlle getippten Befehle der Skript-Datei <scriptout> anfgen" msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" -msgstr "-W <scriptout>\tSchreibe Befehle in die Skript-Datei <scriptout>" +msgstr "" +"-W <scriptout>\tSchreibe getippte Befehle in die Skript-Datei <scriptout>" msgid "-x\t\t\tEdit encrypted files" -msgstr "-x\t\t\tEditiere kodierte Dateien" +msgstr "-x\t\t\tEditiere verschlsselte Dateien" msgid "-display <display>\tConnect vim to this particular X-server" msgstr "-display <display>\tStarte vim <display>" @@ -2856,36 +3167,56 @@ msgid "-X\t\t\tDo not connect to X server" msgstr "-X\t\t\tStelle keine Verbindung zum X-server her" msgid "--remote <files>\tEdit <files> in a Vim server if possible" -msgstr "--remote <Dateien>\tEditiere <Dateien> in einem Vim-Server falls mglich" +msgstr "" +"--remote <Dateien>\tEditiere <Dateien> in einem Vim-Server falls mglich" msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <Dateien> Dasselbe ohne Warnung, wenn kein Server vorhanden ist" +msgstr "" +"--remote-silent <Dateien> Dasselbe ohne Warnung, wenn kein Server vorhanden " +"ist" msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" msgstr "" -"--remote-wait <Dateien> Wie --remote, aber warte, bis die <Dateien> editiert wurden" +"--remote-wait <Dateien> Wie --remote, aber warte, bis die <Dateien> " +"editiert wurden" msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent <files> Dasselbe ohne Warnung, wenn kein Server vorhanden ist" +"--remote-wait-silent <files> Dasselbe ohne Warnung, wenn kein Server " +"vorhanden ist" + +msgid "" +"--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" +msgstr "" +"--remote-tab[-wait][-silent] <Dateien> Wie --remote, aber ffne ein Tab fr " +"jede Datei." msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" msgstr "--remote-send <keys>\tSchicke <keys> zu einem Vim Server und beende" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <Ausdruck>\tFhre <Ausdruck> in einem Vim-Server aus und drucke das Ergebnis" +msgstr "" +"--remote-expr <Ausdruck>\tFhre <Ausdruck> in einem Vim-Server aus und " +"drucke das Ergebnis" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tDrucke verfgbare Vim-Server-Namen und beende" +msgstr "--serverlist\t\tAuflisten verfgbarer Vim-Server-Namen und beende" msgid "--servername <name>\tSend to/become the Vim server <name>" msgstr "--servername <Name>\tBenutze den Vim-Server <Name>" +msgid "--startuptime <file>\tWrite startup timing messages to <file>" +msgstr "--startuptime <Datei>\tSchreibe Start Zeitmessung in <Datei>" + msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tBenutze <viminfo> statt .viminfo" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "" +"--clean\t\t'nocompatible', Vim Standardwerte, keine Plugins, keine Viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h or --help\tAnzeigen der Hilfe (diesen Text) und beenden" @@ -2897,21 +3228,21 @@ msgid "" "Arguments recognised by gvim (Motif version):\n" msgstr "" "\n" -"Argumente fr die gvim (Motif Version):\n" +"Argumente fr den gvim (Motif Version):\n" msgid "" "\n" "Arguments recognised by gvim (neXtaw version):\n" msgstr "" "\n" -"Argumente fr die gvim (neXtaw Version):\n" +"Argumente fr den gvim (neXtaw Version):\n" msgid "" "\n" "Arguments recognised by gvim (Athena version):\n" msgstr "" "\n" -"Argumente fr die gvim (Athena Version):\n" +"Argumente fr den gvim (Athena Version):\n" msgid "-display <display>\tRun vim on <display>" msgstr "-display <display>\tStarte vim auf <display>" @@ -2919,20 +3250,17 @@ msgstr "-display <display>\tStarte vim auf <display>" msgid "-iconic\t\tStart vim iconified" msgstr "-iconic\t\tStarte vim als Icon" -msgid "-name <name>\t\tUse resource as if vim was <name>" -msgstr "-name <name>\t\tBenutze so als ob vim <name> hiee" - -msgid "\t\t\t (Unimplemented)\n" -msgstr "\t\t\t (Nicht implementiert)\n" - msgid "-background <color>\tUse <color> for the background (also: -bg)" -msgstr "-background <Farbe>\tBenutze <Farbe> fr den Hintergrund (auch mit: -bg)" +msgstr "" +"-background <Farbe>\tBenutze <Farbe> fr den Hintergrund (auch mit: -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" -msgstr "-foreground <Farbe>\tBenutze <Farbe> fr den Text Vordergrund (auch mit: -fg)" +msgstr "" +"-foreground <Farbe>\tBenutze <Farbe> fr den Text Vordergrund (auch mit: -fg)" msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" -msgstr "-font <Schriftart>\tBenutze <Schriftart> fr normalen Text (auch mit: -fn)" +msgstr "" +"-font <Schriftart>\tBenutze <Schriftart> fr normalen Text (auch mit: -fn)" msgid "-boldfont <font>\tUse <font> for bold text" msgstr "-boldfont <Schriftart>\tBenutze <Schriftart> fr Fettschrift" @@ -2941,16 +3269,23 @@ msgid "-italicfont <font>\tUse <font> for italic text" msgstr "-italicfont <Schriftart>\tBenutze <Schriftart> fr geneigten Text" msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" -msgstr "-geometry <geom>\tbenutze <geom> fr die Anfangs Abmessungen (auch mit: -geom)" +msgstr "" +"-geometry <geom>\tbenutze <geom> fr die Anfangs Abmessungen (auch mit: -" +"geom)" msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" -msgstr "-borderwidth <Breite>\tBenutze einen Rahmen der Breite <Breite> (auch mit: -bw)" +msgstr "" +"-borderwidth <Breite>\tBenutze einen Rahmen der Breite <Breite> (auch mit: -" +"bw)" msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" -msgstr "-scrollbarwidth <Breite> Benutze eine Scrollbar der Breite <Breite> (auch mit: -sw)" +msgstr "" +"-scrollbarwidth <Breite> Benutze eine Scrollbar der Breite <Breite> (auch " +"mit: -sw)" msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" -msgstr "-menuheight <Hhe>\tBenutze einen Men-Balken der Hhe <Hhe> (auch mit: -mh)" +msgstr "" +"-menuheight <Hhe>\tBenutze einen Men-Balken der Hhe <Hhe> (auch mit: -mh)" msgid "-reverse\t\tUse reverse video (also: -rv)" msgstr "-reverse\t\tBenutze invertierte Farben (auch mit: -rv)" @@ -2961,46 +3296,39 @@ msgstr "+reverse\t\tBenutze keine invertierten Farben (auch mit: +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <resource>\tSetze die gegebene Ressource" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"Argumente fr die gvim RISC-OS Version:\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <Nummer>\tAnfangsbreite des Fensters in Spalten" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <Nummer>\tAnfangshhe des Fensters in Zeilen" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" msgstr "" "\n" -"Argumente fr die gvim GTK+ Version:\n" +"Argumente fr gvim GTK+ Version:\n" msgid "-display <display>\tRun vim on <display> (also: --display)" msgstr "-display <display>\tStarte vim auf <display> (auch mit: --display)" msgid "--role <role>\tSet a unique role to identify the main window" -msgstr "--role <role>\tSetze eine eindeutige Rolle, um das Hauptfenster zu identifizieren" +msgstr "" +"--role <role>\tSetze eine eindeutige Rolle, um das Hauptfenster zu " +"identifizieren" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\tffne Vim in einem anderen GTK widget" +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tSchreibe die Window ID auf Standard Ausgabe." + msgid "-P <parent title>\tOpen Vim inside parent application" msgstr "-P <parent title>\tffne Vim innerhalb der Vater-Applikation" +msgid "--windowid <HWND>\tOpen Vim inside another win32 widget" +msgstr "--windowid <HWND>\tffne Vim in einem anderen Win32 widget" + msgid "No display" msgstr "Keine Anzeige" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": Versendung fehlgeschlagen.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": Versendung fehlgeschlagen. Versuche lokale Ausfhrung\n" @@ -3019,9 +3347,8 @@ msgstr "Keine Markierungen gesetzt" #, c-format msgid "E283: No marks matching \"%s\"" -msgstr "E283: Keine Markierungen passen zu \"%s\"" +msgstr "E283: Keine Markierungen passen auf \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3029,7 +3356,6 @@ msgstr "" "\n" "Mark Zeile Sp Datei/Text" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3037,7 +3363,6 @@ msgstr "" "\n" " Sprung Zeile Sp Datei/Text" -#. Highlight title msgid "" "\n" "change line col text" @@ -3052,7 +3377,6 @@ msgstr "" "\n" "# Datei-Marken:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3080,7 +3404,7 @@ msgid "E285: Failed to create input context" msgstr "E285: Eingabe-Kontext konnte nicht erzeugt werden" msgid "E286: Failed to open input method" -msgstr "E286: Eingabemethode konnte geffnet werden" +msgstr "E286: Eingabemethode konnte nicht geffnet werden" msgid "E287: Warning: Could not set destroy callback to IM" msgstr "E287: Achtung: Destroy Callabck konnte nicht auf IM gesetzt werden" @@ -3091,15 +3415,6 @@ msgstr "E288: Eingabemethode unterst msgid "E289: input method doesn't support my preedit type" msgstr "E289: Eingabemethode untersttzt nicht meinen Voreditier-Typen" -msgid "E290: over-the-spot style requires fontset" -msgstr "E290: der ber-dem-Punkt Stil bentigt fontset" - -msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -msgstr "E291: Ihr GTK+ ist lter als 1.2.3. Der Status-Bereich wird abgeschaltet" - -msgid "E292: Input Method Server is not running" -msgstr "E292: Server der Eingabemethode luft nicht" - msgid "E293: block was not locked" msgstr "E293: Block war nicht gesperrt" @@ -3127,7 +3442,9 @@ msgstr "E298: Block Nr. 1 nicht erhalten?" msgid "E298: Didn't get block nr 2?" msgstr "E298: Block Nr. 2 nicht erhalten?" -#. could not (re)open the swap file, what can we do???? +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Fehler beim Aktualisieren der Verschlsselung der swap Datei." + msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Ups, Verlust der Auslagerungsdatei!!!" @@ -3136,17 +3453,21 @@ msgstr "E302: Auslagerungsdatei konnte nicht umbenannt werden" #, c-format msgid "E303: Unable to open swap file for \"%s\", recovery impossible" -msgstr "E303: Auslagerungsdatei fr \"%s\" konnte nicht geffnet werden, Wiederherstellung unmglich" +msgstr "" +"E303: Auslagerungsdatei fr \"%s\" konnte nicht geffnet werden, " +"Wiederherstellung unmglich" -msgid "E304: ml_timestamp: Didn't get block 0??" -msgstr "E304: ml_timestamp: Block Nr. 0 nicht erhalten?" +msgid "E304: ml_upd_block0(): Didn't get block 0??" +msgstr "E304: ml_upd_block0(): Block Nr. 0 nicht erhalten?" #, c-format msgid "E305: No swap file found for %s" msgstr "E305: Keine Auslagerungsdatei fr %s gefunden" msgid "Enter number of swap file to use (0 to quit): " -msgstr "Geben Sie die Nummer der Auslagerungsdatei ein die verwendet werden soll (0 um abzubrechen): " +msgstr "" +"Geben Sie die Nummer der Auslagerungsdatei ein die verwendet werden soll (0 " +"um abzubrechen): " #, c-format msgid "E306: Cannot open %s" @@ -3160,7 +3481,8 @@ msgid "" "Maybe no changes were made or Vim did not update the swap file." msgstr "" "\n" -"Vielleicht wurden keine nderungen vorgenommen oder Vim hatte die Auslagerungsdatei nicht aktualisiert." +"Vielleicht wurden keine nderungen vorgenommen oder Vim hatte die " +"Auslagerungsdatei nicht aktualisiert." msgid " cannot be used with this version of Vim.\n" msgstr " kann nicht zusammen mit dieser Vim Version verwendet werden.\n" @@ -3185,6 +3507,16 @@ msgstr "" ",\n" "oder die Datei wurde zerstrt." +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "" +"E833: %s is verschlsselt, aber diese Version von Vim untersttzt " +"Verschlsselung nicht." + +msgid " has been damaged (page size is smaller than minimum value).\n" +msgstr " wurde beschdigt (Pagesize kleiner als das Minimum).\n" + #, c-format msgid "Using swap file \"%s\"" msgstr "Verwende Auslagerungsdatei \"%s\"" @@ -3194,7 +3526,41 @@ msgid "Original file \"%s\"" msgstr "Original-Datei \"%s\"" msgid "E308: Warning: Original file may have been changed" -msgstr "E308: Warnung: Die Originaldatei knnte verndert worden sein" +msgstr "E308: Achtung: Die Originaldatei knnte verndert worden sein" + +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "Swap Datei is verschlsselt: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "" +"\n" +"Wenn Sie einen neuen Schlssel eingegeben haben, aber die Textdatei nicht " +"geschrieben haben," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "" +"\n" +"geben Sie bitte den Schlssel ein: " + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "" +"\n" +"Wenn Sie die Textdatei geschrieben haben, nachdem der Schlssel gendert " +"wurde, drcke Enter." + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "" +"\n" +"um den gleichen Schlssel fr die Textdatei und die Swap Datei zu nutzen." #, c-format msgid "E309: Unable to read block 1 from %s" @@ -3204,7 +3570,7 @@ msgid "???MANY LINES MISSING" msgstr "???VIELE ZEILEN FEHLEN" msgid "???LINE COUNT WRONG" -msgstr "???ZEILEN ZHLER FALSCH" +msgstr "???ZEILENANZAHL FALSCH" msgid "???EMPTY BLOCK" msgstr "???LEERER BLOCK" @@ -3234,7 +3600,8 @@ msgstr "E311: Wiederherstellung unterbrochen" msgid "" "E312: Errors detected while recovering; look for lines starting with ???" msgstr "" -"E312: Fehler wurden festgestellt whrend der Wiederherstellung: suche nach Zeilen die mit ??? beginnen" +"E312: Fehler wurden festgestellt whrend der Wiederherstellung: suche nach " +"Zeilen die mit ??? beginnen" msgid "See \":help E312\" for more information." msgstr "Lesen Sie \":help E312\" fr weitere Informationen." @@ -3249,22 +3616,30 @@ msgstr "" "\n" "(Wollen Sie vielleicht diese Datei unter einem neuen Namen speichern\n" -msgid "and run diff with the original file to check for changes)\n" -msgstr "und \"diff\" zur Original-Datei machen, um nderungen zu prfen)\n" +msgid "and run diff with the original file to check for changes)" +msgstr "" +"und \"diff\" mit der Original-Datei ausfhren, um nderungen zu prfen)" + +msgid "Recovery completed. Buffer contents equals file contents." +msgstr "Recovery durchgefhrt. Pufferinhalt entspricht Dateiinhalt." msgid "" -"Delete the .swp file afterwards.\n" +"\n" +"You may want to delete the .swp file now.\n" "\n" msgstr "" -"Lschen Sie die .swp-Datei danach.\n" "\n" +"Sie knnen die Swap Datei jetzt lschen.\n" +"\n" + +msgid "Using crypt key from swap file for the text file.\n" +msgstr "Benutze den Schlssel der Swap Datei fr die Textdatei.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Auslagerungsdateien gefunden:" msgid " In current directory:\n" -msgstr " Im laufenden Verzeichnis:\n" +msgstr " Im aktuellen Verzeichnis:\n" msgid " Using specified name:\n" msgstr " Benutze gegebenen Namen:\n" @@ -3338,7 +3713,7 @@ msgid "" " [not usable with this version of Vim]" msgstr "" "\n" -" [nicht verwendbar zusammen mit dieser Vim-Version]" +" [nicht verwendbar mit dieser Vim-Version]" msgid "" "\n" @@ -3364,7 +3739,7 @@ msgstr "E314: Absicherung fehlgeschlagen" #, c-format msgid "E315: ml_get: invalid lnum: %ld" -msgstr "E315: ml_get: unzulssige lnum: %ld" +msgstr "E315: ml_get: unzulssige Zeilennummer: %ld" #, c-format msgid "E316: ml_get: cannot find line %ld" @@ -3401,7 +3776,7 @@ msgstr "E322: Zeilennummer nicht im zul #, c-format msgid "E323: line count wrong in block %ld" -msgstr "E323: Zeilen Zhler falsch in Block %ld" +msgstr "E323: Zeilenanzahl falsch in Block %ld" msgid "Stack size increases" msgstr "Stapel Gre wchst" @@ -3409,6 +3784,10 @@ msgstr "Stapel Gr msgid "E317: pointer block id wrong 2" msgstr "E317: Zeiger Block id falsch 2" +#, c-format +msgid "E773: Symlink loop for \"%s\"" +msgstr "E773: Symlink Schleife fr \"%s\"" + msgid "E325: ATTENTION" msgstr "E325: ACHTUNG" @@ -3425,31 +3804,23 @@ msgstr "Beim msgid " NEWER than swap file!\n" msgstr " neuer als Auslagerungsdatei!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Ein anderes Programm editiert mglicherweise diese Datei.\n" -" Wenn dies der Fall ist, sollten Sie vorsichtig sein, damit\n" -" es nicht zu berschneidungen kommt.\n" +"(1) Ein anderes Programm editiert mglicherweise diese Datei. Wenn dies\n" +" der Fall ist, sollten Sie vorsichtig sein, damit es nicht zu\n" +" berschneidungen kommt. Beende oder fahre vorsichtig fort.\n" -msgid " Quit, or continue with caution.\n" -msgstr " Ende, oder Fortsetzung mit Vorsicht.\n" - -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) Eine Editiersitzung fr diese Datei ist abgestrzt.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) Eine Editiersitzung fr diese Datei ist abgestrzt.\n" msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr " Wenn dies der Fall ist, so verwenden Sie \":recover\" oder \"vim -r " +msgstr "" +" Wenn dies der Fall ist, so verwenden Sie \":recover\" oder \"vim -r " msgid "" "\"\n" @@ -3459,7 +3830,8 @@ msgstr "" " um die nderungen wiederherzustellen (siehe \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" -msgstr " Wenn dies bereits geschehen ist, lschen Sie die Auslagerungsdatei \"" +msgstr "" +" Wenn dies bereits geschehen ist, lschen Sie die Auslagerungsdatei \"" msgid "" "\"\n" @@ -3521,17 +3893,19 @@ msgstr "E328: Men msgid "E329: No menu \"%s\"" msgstr "E329: Kein Men \"%s\"" +msgid "E792: Empty menu name" +msgstr "E792: Leerer Menname" + msgid "E330: Menu path must not lead to a sub-menu" msgstr "E330: Men-Pfad darf nicht zum Untermen fhren" msgid "E331: Must not add menu items directly to menu bar" -msgstr "E331: Menpunkt knnen nicht direkt zum Men-Balken hinzugefgt werden" +msgstr "" +"E331: Menpunkte knnen nicht direkt zum Men-Balken hinzugefgt werden" msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Trenner kann nicht Teil des Men-Pfades sein" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3542,6 +3916,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Reie dieses Men ab" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Men ist fr Modus %s nicht definiert" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: Men-Pfad muss zu einem Menpunkt fhren" @@ -3549,10 +3927,6 @@ msgstr "E333: Men msgid "E334: Menu not found: %s" msgstr "E334: Men nicht gefunden: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Men ist fr %s Modus nicht definiert" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: Men-Pfad muss zum Untermen fhren" @@ -3572,13 +3946,13 @@ msgid "E354: Invalid register name: '%s'" msgstr "E354: Ungltiger Register Name: '%s'" msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" -msgstr "bersetzt von Georg Dahn <gorgyd@yahoo.co.uk>" +msgstr "bersetzt von Christian Brabandt <cb@256bit.org>" msgid "Interrupt: " msgstr "Unterbrechung: " -msgid "Hit ENTER or type command to continue" -msgstr "Drcken Sie die EINGABETASTE oder geben Sie einen Befehl ein" +msgid "Press ENTER or type command to continue" +msgstr "Bettigen Sie die EINGABETASTE oder geben Sie einen Befehl ein" #, c-format msgid "%s line %ld" @@ -3588,7 +3962,9 @@ msgid "-- More --" msgstr "-- Mehr --" msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " -msgstr " LEERZEICHEN/d/j: Seite/halbe Seite/Zeile vorwrts, b/u/k: rckwrts, q: Ende " +msgstr "" +" LEERZEICHEN/d/j: Seite/halbe Seite/Zeile vorwrts, b/u/k: rckwrts, q: " +"Ende " msgid "Question" msgstr "Frage" @@ -3613,30 +3989,37 @@ msgstr "" "Alle &Verwerfen\n" "&Abbrechen" +msgid "Select Directory dialog" +msgstr "Verzeichnis Auswahl Dialog" + msgid "Save File dialog" msgstr "Datei Speichern Dialog" msgid "Open File dialog" msgstr "Datei ffnen Dialog" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "E338: Kein Datei-Dialog im Konsole-Modus" msgid "E766: Insufficient arguments for printf()" msgstr "E766: Zu wenige Argumente fr printf()" +msgid "E807: Expected Float argument for printf()" +msgstr "E807: Erwarte Float Argument fr printf()" + msgid "E767: Too many arguments to printf()" msgstr "E767: Zu viele Argumente fr printf()" msgid "W10: Warning: Changing a readonly file" -msgstr "W10: Warnung: ndern einer schreibgeschtzten Datei" +msgstr "W10: Achtung: ndern einer schreibgeschtzten Datei" -msgid "Type number or click with mouse (<Enter> cancels): " -msgstr "Bitte Nummer eingeben oder mit der Maus auswhlen (abbrechen mit <Enter>)" +msgid "Type number and <Enter> or click with mouse (empty cancels): " +msgstr "" +"Bitte Nummer und <Enter> eingeben oder mit der Maus auswhlen (abbrechen mit " +"<Enter>): " -msgid "Choice number (<Enter> cancels): " -msgstr "Gewnschte Nummer (abbrechen mit <Enter>)" +msgid "Type number and <Enter> (empty cancels): " +msgstr "Gewnschte Nummer und <Enter> eingeben (abbrechen mit <Enter>): " msgid "1 more line" msgstr "eine Zeile mehr" @@ -3658,13 +4041,6 @@ msgstr " (Unterbrochen)" msgid "Beep!" msgstr "Beep!" -msgid "Vim: preserving files...\n" -msgstr "Vim: Sichern der Dateien...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Beendet.\n" - msgid "ERROR: " msgstr "FEHLER: " @@ -3674,7 +4050,8 @@ msgid "" "[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" msgstr "" "\n" -"[Bytes] gesamt alloc-frei %lu-%lu, in Verwendung %lu, maximale Verwendung %lu\n" +"[Bytes] gesamt alloc-frei %lu-%lu, in Verwendung %lu, maximale Verwendung " +"%lu\n" #, c-format msgid "" @@ -3714,14 +4091,8 @@ msgstr "E548: Ziffer erwartet" msgid "E549: Illegal percentage" msgstr "E549: Unzulssige Prozentangabe" -msgid "Enter encryption key: " -msgstr "Geben Sie bitte den Schlssel ein: " - -msgid "Enter same key again: " -msgstr "Geben Sie den gleichen Schlssel nochmals ein:" - -msgid "Keys don't match!" -msgstr "Die Schlssel stimmen nicht berein!" +msgid "E854: path too long for completion" +msgstr "E854: Pfad fr Vervollstndigung zu lang." #, c-format msgid "" @@ -3747,26 +4118,29 @@ msgstr "E346: Kein weiteres Verzeichnis \"%s\" im 'cdpath' gefunden" msgid "E347: No more file \"%s\" found in path" msgstr "E347: Keine weitere Datei \"%s\" im Pfad gefunden" -#. Get here when the server can't be found. -msgid "Cannot connect to Netbeans #2" -msgstr "Keine Verbindung zu NetBeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "Keine Verbindung zu NetBeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" -msgstr "E668: Falscher Zugriffsmodus auf die NetBeans Zugriff-Informationsdatei: \"%s\"" - -msgid "read from Netbeans socket" -msgstr "gelesen vom NetBeans Socket" +msgstr "" +"E668: Falscher Zugriffsmodus auf die NetBeans Zugriff-Informationsdatei: \"%s" +"\"" #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Verbindung zu NetBeans fr Puffer %ld verloren" -msgid "E505: " -msgstr "E505: " +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: netbeans wird nicht untersttzt mit dieser GUI." + +msgid "E511: netbeans already connected" +msgstr "E511: netbeans ist bereits verbunden" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s ist schreibgeschtzt (erzwinge mit !)" + +# Identifizierungszeichen/merkmal, Bezeichner +msgid "E349: No identifier under cursor" +msgstr "E349: Kein Merkmal unter dem Cursor" msgid "E774: 'operatorfunc' is empty" msgstr "E774: 'operatorfunc' is empty" @@ -3780,24 +4154,24 @@ msgstr "Achtung: Terminal unterst msgid "E348: No string under cursor" msgstr "E348: Keine Zeichenkette unter dem Cursor" -# Identifizierungszeichen/merkmal, Bezeichner -msgid "E349: No identifier under cursor" -msgstr "E349: Kein Merkmal unter dem Cursor" - msgid "E352: Cannot erase folds with current 'foldmethod'" -msgstr "E352: Faltung kann mit der eingestellten Faltungsmethode nicht gelscht werden" +msgstr "" +"E352: Faltung kann mit der eingestellten Faltungsmethode nicht gelscht " +"werden" msgid "E664: changelist is empty" msgstr "E664: Liste der nderungen ist leer" msgid "E662: At start of changelist" -msgstr "E662: Am Anfang der Liste der nderungen" +msgstr "E662: Am Anfang der nderungsliste" msgid "E663: At end of changelist" -msgstr "E663: Am Ende der Liste der nderungen" +msgstr "E663: Am Ende der nderungsliste" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Bitte :quit<Enter> eingeben um Vim zu verlassen" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Tippe: :qa! und drcke <Enter> um alle nderungen zu verwerfen und Vim zu " +"beenden" #, c-format msgid "1 line %sed 1 time" @@ -3829,7 +4203,6 @@ msgstr "%ld Zeilen einger msgid "E748: No previously used register" msgstr "E748: Kein bereits verwendetes Register" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "kann nicht kopieren; lsche trotzdem" @@ -3844,25 +4217,30 @@ msgstr "%ld Zeilen ge msgid "freeing %ld lines" msgstr "gebe %ld Zeilen frei" -msgid "block of 1 line yanked" -msgstr "Block von einer Zeile kopiert" +#, c-format +msgid " into \"%c" +msgstr " in \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "Block von einer Zeile kopiert%s" -msgid "1 line yanked" -msgstr "eine Zeile kopiert" +#, c-format +msgid "1 line yanked%s" +msgstr "eine Zeile kopiert%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "Block von %ld Zeilen kopiert" +msgid "block of %ld lines yanked%s" +msgstr "Block von %ld Zeilen kopiert%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld Zeilen kopiert" +msgid "%ld lines yanked%s" +msgstr "%ld Zeilen kopiert%s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: Register %s ist leer" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -3884,40 +4262,45 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Unbekannter Register Typ %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: Suchmuster und Ausdrucksregister drfen nicht mehr als 1 Zeile " +"enthalten." + #, c-format msgid "%ld Cols; " msgstr "%ld Spalten; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "%s%ld von %ld Zeilen; %ld von %ld Wrtern; %ld von %ld Bytes" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "" +"%s%ld von %ld Zeilen; %lld von %lld Wrtern; %lld von %lld Bytes ausgewhlt" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"%s%ld von %ld Zeilen; %ld von %ld Wrtern; %ld von %ld Zeichen; %ld von %ld " -"Bytes" +"%s%ld von %ld Zeilen; %lld von %lld Wrtern; %lld von %lld Zeichen; %lld von " +"%lld Bytes ausgewhlt" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Sp %s von %s; Zeile %ld von %ld; Wort %ld von %ld; Byte %ld von %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "" +"Sp %s von %s; Zeile %ld von %ld; Wort %lld von %lld; Byte %lld von %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Sp %s von %s; Zeile %ld von %ld; Wort %ld von %ld; Zeichen %ld von %ld; Byte %ld von " -"%ld" - -#, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld fr BOM)" +"Sp %s von %s; Zeile %ld von %ld; Wort %lld von %lld; Zeichen %lld von %lld; " +"Byte %lld von %lld" -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Seite %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld fr BOM)" msgid "Thanks for flying Vim" msgstr "Danke fr die Benutzung von Vim" @@ -3931,6 +4314,9 @@ msgstr "E519: Option nicht unterst msgid "E520: Not allowed in a modeline" msgstr "E520: Nicht erlaubt in einer Modeline" +msgid "E846: Key code not set" +msgstr "E846: Tastencode nicht gesetzt" + msgid "E521: Number required after =" msgstr "E521: Zahl bentigt nach =" @@ -3941,6 +4327,10 @@ msgstr "E522: Nicht gefunden in 'termcap'" msgid "E539: Illegal character <%s>" msgstr "E539: Unzulssiges Zeichen <%s>" +#, c-format +msgid "For option %s" +msgstr "Fr Option %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' darf keine leere Zeichenkette sein" @@ -3953,9 +4343,18 @@ msgstr "E531: Verwende \":gui\", um die GUI-Version zu starten" msgid "E589: 'backupext' and 'patchmode' are equal" msgstr "E589: 'backupext' und 'patchmode' sind gleich" +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: Widerspricht Wert aus 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: Widerspricht Wert aus 'fillchars'" + msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Kann in der GTK+ 2 GUI nicht verndert werden" +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Kann nicht zwischen %s und %s konvertieren." + msgid "E524: Missing colon" msgstr "E524: Fehlender Doppelpunkt" @@ -4013,12 +4412,18 @@ msgstr "E541: Zu viele Elemente" msgid "E542: unbalanced groups" msgstr "E542: Unausgewogene Gruppen" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Kann ein Terminal mit einem laufenden Job nicht modifizieren" + msgid "E590: A preview window already exists" -msgstr "E590: Ein Voransichtsfenster existiert bereits" +msgstr "E590: Ein Vorschaufenster existiert bereits" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "W17: Arabisch bentigt UTF-8, bitte ':set encoding=utf-8' ausfhren" +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24-bit Farben werden in dieser Umgebung nicht untersttzt" + #, c-format msgid "E593: Need at least %d lines" msgstr "E593: Mindestens %d Zeilen werden bentigt" @@ -4031,6 +4436,10 @@ msgstr "E594: Mindestens %d Spalten werden ben msgid "E355: Unknown option: %s" msgstr "E355: Unbekannte Option: %s" +#, c-format +msgid "E521: Number required: &%s = '%s'" +msgstr "E521: Zahl bentigt: &%s = '%s'" + msgid "" "\n" "--- Terminal codes ---" @@ -4043,14 +4452,14 @@ msgid "" "--- Global option values ---" msgstr "" "\n" -"--- Werte globaler Optionen ---" +"--- Globale Optionswerte ---" msgid "" "\n" "--- Local option values ---" msgstr "" "\n" -"--- Werte lokaler Optionen ---" +"--- Lokale Optionswerte ---" msgid "" "\n" @@ -4087,11 +4496,11 @@ msgid "Cannot open NIL:\n" msgstr "Kann NIL nicht ffnen:\n" msgid "Cannot create " -msgstr "Kann nicht anlegen " +msgstr "Kann nicht erstellen " #, c-format msgid "Vim exiting with %d\n" -msgstr "Vim steigt aus mit %d\n" +msgstr "Vim beendet mit %d\n" msgid "cannot change console mode ?!\n" msgstr "kann Konsolenmodus nicht wechseln ?!\n" @@ -4099,7 +4508,6 @@ msgstr "kann Konsolenmodus nicht wechseln ?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_winsize: keine Konsole??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Kann Shell nicht mit der -f Option ausfhren" @@ -4118,15 +4526,9 @@ msgstr "ANCHOR_BUF_SIZE zu klein." msgid "I/O ERROR" msgstr "I/O FEHLER" -msgid "...(truncated)" -msgstr "...(abgeschnitten)" - msgid "Message" msgstr "Nachricht" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' betrgt nicht 80, kann externe Befehle nicht ausfhren" - msgid "E237: Printer selection failed" msgstr "E237: Drucker-Auswahl fehlgeschlagen" @@ -4151,18 +4553,13 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Unzulssiger Zeichensatz-Name \"%s\" im Schriftart-Namen \"%s\"" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Unzulssiges Zeichen '%c' in der Schriftart \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: Doppel-Signal, beenden\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "" +"E244: Unzulssiger Eigenschaften-Name \"%s\" im Schriftart-Namen \"%s\"" #, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: Erhielt tdliches Signal %s\n" - -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: Erhielt tdliches Signal\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Unzulssiges Zeichen '%c' in der Schriftart \"%s\"" #, c-format msgid "Opening the X display took %ld msec" @@ -4183,10 +4580,25 @@ msgstr "Zeit msgid "" "\n" -"Cannot execute shell " +"Could not get security context for " msgstr "" "\n" -"Shell kann nicht ausfhrt werden " +"Konnte Security Context nicht erhalten fr " + +msgid "" +"\n" +"Could not set security context for " +msgstr "" +"\n" +"Konnte Security Context nicht setzen fr " + +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Konnte Security Context %s fr %s nicht setzen." + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Konnte Security Context %s fr %s nicht erhalten. Entferne ihn!" msgid "" "\n" @@ -4207,14 +4619,21 @@ msgid "" "Cannot create pipes\n" msgstr "" "\n" -"Pipes knnen nicht angelegt werden\n" +"Pipes knnen nicht angelegt werden\n" + +msgid "" +"\n" +"Cannot fork\n" +msgstr "" +"\n" +"'fork' schlug fehl\n" msgid "" "\n" -"Cannot fork\n" +"Cannot execute shell " msgstr "" "\n" -"'fork' schlug fehl\n" +"Shell kann nicht ausfhrt werden " msgid "" "\n" @@ -4258,10 +4677,6 @@ msgstr "VIM Fehler" msgid "Could not fix up function pointers to the DLL!" msgstr "Konnte Funktions-Zeiger in der DLL nicht korrigieren!" -#, c-format -msgid "shell returned %d" -msgstr "Shell gab %d zurck" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Fing Ereignis %s ein\n" @@ -4288,7 +4703,14 @@ msgstr "" "Siehe :help win32-vimrun fr weitere Informationen." msgid "Vim Warning" -msgstr "Vim Warnung" +msgstr "Vim Achtung" + +#, c-format +msgid "shell returned %d" +msgstr "Shell gab %d zurck" + +msgid "E926: Current location list was changed" +msgstr "E926: Aktuelle Positionsliste wurde gendert." #, c-format msgid "E372: Too many %%%c in format string" @@ -4322,6 +4744,12 @@ msgstr "E379: Fehlender oder leerer Verzeichnisname" msgid "E553: No more items" msgstr "E553: Keine weiteren Eintrge" +msgid "E924: Current window was closed" +msgstr "E924: Aktuelles Fenster wurde geschlossen." + +msgid "E925: Current quickfix was changed" +msgstr "E925: Aktuelle Quickfix wurde gendert." + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d aus %d)%s%s: " @@ -4329,18 +4757,21 @@ msgstr "(%d aus %d)%s%s: " msgid " (line deleted)" msgstr " (Zeile gelscht)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s Fehlerliste %d von %d; %d Fehler" + msgid "E380: At bottom of quickfix stack" -msgstr "E380: Am Anfang der quickfix Liste" +msgstr "E380: Am Anfang der Quickfix Liste" msgid "E381: At top of quickfix stack" -msgstr "E381: An Ende der quickfix Liste" +msgstr "E381: An Ende der Quickfix Liste" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "Fehlerliste %d aus %d; %d Fehler" +msgid "No entries" +msgstr "Keine Eintrge" -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: Kann nicht schreiben, 'buftype'-Option ist gesetzt" +msgid "Error file" +msgstr "Fehlerdatei" msgid "E683: File name missing or invalid pattern" msgstr "E683: Dateiname fehlt oder ungltiges Muster" @@ -4359,18 +4790,15 @@ msgstr "E777: Zeichenkette oder Liste erwartet" msgid "E369: invalid item in %s%%[]" msgstr "E369: Ungltiges Element in %s%%[]" -msgid "E339: Pattern too long" -msgstr "E339: Muster zu lang" - -msgid "E50: Too many \\z(" -msgstr "E50: Zu viele \\z(" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: Zu viele %s(" +msgid "E769: Missing ] after %s[" +msgstr "E769: Fehlende ] nach %s[" -msgid "E52: Unmatched \\z(" -msgstr "E52: \\z( ohne Gegenstck" +msgid "E944: Reverse range in character class" +msgstr "E944: Bereich in Zeichenklasse rckwrts" + +msgid "E945: Range too large in character class" +msgstr "E945: Bereich in Zeichenklasse zu gro" #, c-format msgid "E53: Unmatched %s%%(" @@ -4384,6 +4812,36 @@ msgstr "E54: %s( ohne Gegenst msgid "E55: Unmatched %s)" msgstr "E55: %s) ohne Gegenstck" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( ist hier nicht erlaubt" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 usw. ist hier nicht erlaubt" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: Fehlende ] nach %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] ist leer" + +msgid "E65: Illegal back reference" +msgstr "E65: Ungltige Rckreferenz" + +msgid "E339: Pattern too long" +msgstr "E339: Muster zu lang" + +msgid "E50: Too many \\z(" +msgstr "E50: Zu viele \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Zu viele %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: \\z( ohne Gegenstck" + #, c-format msgid "E59: invalid character after %s@" msgstr "E59: Ungltiges Zeichen nach %s@" @@ -4407,26 +4865,9 @@ msgstr "E63: Ung msgid "E64: %s%c follows nothing" msgstr "E64: %s%c nach Nichts" -msgid "E65: Illegal back reference" -msgstr "E65: Ungltige Rckreferenz" - -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( ist hier nicht erlaubt" - -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 usw. ist hier nicht erlaubt" - msgid "E68: Invalid character after \\z" msgstr "E68: Ungltiges Zeichen nach \\z" -#, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: Fehlende ] nach %s%%[" - -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[] ist leer" - #, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: Ungltiges Zeichen nach %s%%[dxouU]" @@ -4435,10 +4876,6 @@ msgstr "E678: Ung msgid "E71: Invalid character after %s%%" msgstr "E71: Ungltiges Zeichen nach %s%%" -#, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: Fehlende ] nach %s[" - #, c-format msgid "E554: Syntax error in %s{...}" msgstr "E554: Syntaxfehler in %s{...}" @@ -4446,6 +4883,93 @@ msgstr "E554: Syntaxfehler in %s{...}" msgid "External submatches:\n" msgstr "Externe 'submatches':\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) kann nicht wiederholt werden %s" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: Auf \\%#= muss 0, 1, oder 2 folgen. Die automatische Engine wird " +"genutzt " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Wechsele zur Backtracking RE Engine fr Muster: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Regexp Ende verfrht aufgetreten" + +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA regexp) Deplatziert %c" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Ungltige Zeichenklasse: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Unbekannter Operator '\\z%c'" + +msgid "E951: \\% value too large" +msgstr "E951: \\% Wert zu gro" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Unbekannter Operator '\\%%%c'" + +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Fehler beim Erstellen der NFA fr quivalenzklasse!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Unbekannter Operator '\\@%c'" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA regexp) Fehler beim Lesen der Wiederholungsbeschrnkung." + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Ein Multi darf nicht auf ein Multi folgen!" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA regexp) Zu viele '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA regexp) Zu viele \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA regexp) geeigneter Abschlussfehler" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) Konnte nicht vom Stack herausnehmen!" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (NFA regexp) (Beim Konvertieren von postfix zu NFA), zu viele Zustnde " +"auf Stack enthalten" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (NFA regexp) Nicht genug Speicher zum Speichern der NFA" + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) Konnte nicht Speicher allokieren um ste zu durchlaufen!" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Konnte temporre Datei zum Schreiben ffnen, zeige auf Standard " +"Fehlerausgabe ... " + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) KONNTE NICHT FFNEN %s !" + +msgid "Could not open temporary log file for writing " +msgstr "Temporre Logdatei kann nicht zum Schreiben geffnet werden" + msgid " VREPLACE" msgstr " V-ERSETZEN" @@ -4473,9 +4997,6 @@ msgstr " Hebr msgid " Arabic" msgstr " Arabisch" -msgid " (lang)" -msgstr " (Sprache)" - msgid " (paste)" msgstr " (paste)" @@ -4518,7 +5039,6 @@ msgstr "E386: Erwarte '?' oder '/' nach ';'" msgid " (includes previously listed match)" msgstr " (enthlt bereits vorher aufgezhlte Treffer)" -#. cursor at status line msgid "--- Included files " msgstr "--- Eingefgte Dateien " @@ -4557,15 +5077,67 @@ msgstr "E388: Konnte Definition nicht finden" msgid "E389: Couldn't find pattern" msgstr "E389: Konnte Muster nicht finden" -msgid "E759: Format error in spell file" -msgstr "E759: Format-Fehler im Rechtschreibwrterbuch" +msgid "Substitute " +msgstr "Ersetze" + +#, c-format +msgid "" +"\n" +"# Last %sSearch Pattern:\n" +"~" +msgstr "" +"\n" +"# Letztes %sSuchmuster:\n" +"~" + +msgid "E756: Spell checking is not enabled" +msgstr "E756: Rechtschreibprfung ist nicht aktiviert" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Achtung: Kann Wortliste \"%s_%s.spl\" oder \"%s_ascii.spl\" nicht finden" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Achtung: Kann Wortliste \"%s.%s.spl\" oder \"%s.ascii.spl\" nicht finden" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing-Autokommando lschte Puffer" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Achtung: Region %s nicht untersttzt" + +msgid "Sorry, no suggestions" +msgstr "Leider keine Vorschlge" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Leider nur %ld Vorschlge" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "ndere \"%.*s\" nach:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Keine vorhergehende Ersetzung" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Nicht gefunden: %s" msgid "E758: Truncated spell file" msgstr "E758: Abgeschnittenes Rechtschreibwrterbuch" #, c-format msgid "Trailing text in %s line %d: %s" -msgstr "Angehngter Text in %s Zeile %d: %s" +msgstr "berschssiger Text in %s Zeile %d: %s" #, c-format msgid "Affix name too long in %s line %d: %s" @@ -4580,13 +5152,6 @@ msgstr "E762: Zeichen in FOL, LOW oder UPP au msgid "Compressing word tree..." msgstr "Komprimiere Wrter-Baum..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Rechtschreibprfung ist nicht aktiviert" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Achtung: Kann Wortliste \"%s.%s.spl\" oder \"%s.ascii.spl\" nicht finden" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Lese Rechtschreibwrterbuch \"%s\" ein" @@ -4604,8 +5169,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Nicht untersttzter Abschnitt im Rechtschreibwrterbuch" #, c-format -msgid "Warning: region %s not supported" -msgstr "Achtung: Region %s nicht untersttzt" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Das sieht nicht nach einer .sug Datei aus: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Veraltete .sug Datei; Aktualisierung erforderlich: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug Datei ist fr eine neuere Version von Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug Datei passt nicht zur .spl Datei: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Fehler beim Lesen der .sug Datei: %s" #, c-format msgid "Reading affix file %s ..." @@ -4631,6 +5212,26 @@ msgstr "Ung msgid "FLAG after using flags in %s line %d: %s" msgstr "FLAG nach dem Gebrauch von Flags in %s Zeile %d: %s" +#, c-format +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Die Definition von COMPOUNDFORBIDFLAG nach dem PFX Element kann falsches " +"Ergebnis in Zeile %s ergeben %d" + +#, c-format +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Die Definition von COMPOUNDPERMITFLAG nach dem PFX Element kann falsches " +"Ergebnis in Zeile %s ergeben %d" + +#, c-format +msgid "Wrong COMPOUNDRULES value in %s line %d: %s" +msgstr "Falscher COMPOUNDRULES-Wert in %s Zeile %d: %s" + #, c-format msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" msgstr "Falscher COMPOUNDWORDMAX-Wert in %s Zeile %d: %s" @@ -4649,7 +5250,9 @@ msgstr "Falscher CHECKCOMPOUNDPATTERN-Wert in %s Zeile %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" -msgstr "Unterschiedliches verknpfendes Flag im fortgesetzten Affix-Block in %s Zeile %d: %s" +msgstr "" +"Unterschiedliches verknpfendes Flag im fortgesetzten Affix-Block in %s " +"Zeile %d: %s" #, c-format msgid "Duplicate affix in %s line %d: %s" @@ -4660,8 +5263,8 @@ msgid "" "Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " "line %d: %s" msgstr "" -"Affix wird auch fr BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST verwendet in %s " -"Zeile %d: %s" +"Affix wird auch fr BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " +"verwendet in %s Zeile %d: %s" #, c-format msgid "Expected Y or N in %s line %d: %s" @@ -4671,10 +5274,6 @@ msgstr "Y oder N erwartet in %s Zeile %d: %s" msgid "Broken condition in %s line %d: %s" msgstr "Bedingung verletzt in %s Zeile %d: %s" -#, c-format -msgid "Affix flags ignored when PFXPOSTPONE used in %s line %d: %s" -msgstr "Affix Flags ignoriert, wenn PFXPOSTPONE verwendet wird in %s Zeile %d: %s" - #, c-format msgid "Expected REP(SAL) count in %s line %d" msgstr "Erwartetes REP(SAL) gezhlt in %s Zeile %d" @@ -4725,7 +5324,9 @@ msgstr "Unerlaubtes Flag in %s Zeile %d: %s" #, c-format msgid "%s value differs from what is used in another .aff file" -msgstr "%s Wert unterscheidet sich von dem, was in einer anderen .aff Datei verwendet wird" +msgstr "" +"%s Wert unterscheidet sich von dem, was in einer anderen .aff Datei " +"verwendet wird" #, c-format msgid "Reading dictionary file %s ..." @@ -4735,9 +5336,8 @@ msgstr "Lese W msgid "E760: No word count in %s" msgstr "E760: Keine Wrter gezhlt in %s" -#, c-format -msgid "line %6d, word %6d - %s" -msgstr "Zeile %6d, Wort %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "Zeile %6d, Wort %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -4791,6 +5391,9 @@ msgstr "Nicht erkanntes Flag in %s Zeile %d: %s" msgid "Ignored %d words with non-ASCII characters" msgstr "%d Wrter mit nicht-ASCII Zeichen ignoriert" +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Nicht ausreichend Speicher, Wortlist wird unvollstndig sein" + #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" msgstr "%d von %d Knoten komprimiert; %d (%d%%) brig" @@ -4798,10 +5401,6 @@ msgstr "%d von %d Knoten komprimiert; %d (%d%%) msgid "Reading back spell file..." msgstr "Lese Rechtschreibwrterbuch zurck..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Fhre 'Soundfolding' durch..." @@ -4824,8 +5423,8 @@ msgstr "Gesch msgid "E751: Output file name must not have region name" msgstr "E751: Ausgabedatei darf keinen Regionsnamen haben" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: Maximal 8 Regionen untersttzt" +msgid "E754: Only up to %ld regions supported" +msgstr "E754: Maximal %ld Regionen untersttzt" #, c-format msgid "E755: Invalid region in %s" @@ -4838,83 +5437,65 @@ msgstr "Achtung: Sowohl zusammengesetzte W msgid "Writing spell file %s ..." msgstr "Schreibe Rechtschreibwrterbuch %s ..." -msgid "Done!" -msgstr "Fertig!" - -#, c-format -msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' hat nicht %ld Eintrge" - -#, c-format -msgid "Word removed from %s" -msgstr "Wort entfernt von %s" - -#, c-format -msgid "Word added to %s" -msgstr "Wort zu %s hinzugefgt" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: 'Word Characters' unterscheiden sich zwischen Rechtschreibwrterbchern" - -msgid "Sorry, no suggestions" -msgstr "Leider keine Vorschlge" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Leider nur %ld Vorschlge" - -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "ndere \"%.*s\" nach:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: Keine vorhergehende Ersetzung" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Nicht gefunden: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Das sieht nicht nach einer .sug Datei aus: %s" +msgid "Done!" +msgstr "Fertig!" #, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Veraltete .sug Datei; Aktualisierung erforderlich: %s" +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' hat nicht %ld Eintrge" #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug Datei ist fr eine neuere Version von Vim: %s" +msgid "Word '%.*s' removed from %s" +msgstr "Wort '%.*s' entfernt von %s" #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug Datei passt nicht zur .spl Datei: %s" +msgid "Word '%.*s' added to %s" +msgstr "Wort '%.*s' hinzugefgt zu %s" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: Fehler beim Lesen der .sug Datei: %s" +msgid "E763: Word characters differ between spell files" +msgstr "" +"E763: 'Word Characters' unterscheiden sich zwischen Rechtschreibwrterbchern" -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: Doppeltes Zeichen im MAP Eintrag" +msgid "No Syntax items defined for this buffer" +msgstr "Keine Syntax-Elemente fr diesen Puffer definiert" + +msgid "syntax conceal on" +msgstr "Syntax conceal aktiviert" + +msgid "syntax conceal off" +msgstr "Syntax conceal deaktiviert" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Unerlaubtes Argument: %s" +msgid "syntax case ignore" +msgstr "Syntax ignoriere Gro-/Kleinschreibung" + +msgid "syntax case match" +msgstr "Syntax unterscheide Gro-/Kleinschreibung" + +msgid "syntax spell toplevel" +msgstr "Prfe Rechtschreibung von Text ohne zugehrige Syntaxgruppe" + +msgid "syntax spell notoplevel" +msgstr "Prfe keine Rechtschreibung von Text ohne zugehrige Syntaxgruppe" + +msgid "syntax spell default" +msgstr "" +"Prfe Rechtschreibung von Text ohne zugehrige Syntaxgruppen nur bei @Spell/" +"@NoSpell Attribut." + +msgid "syntax iskeyword " +msgstr "syntax iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Kein solcher Syntax Cluster: %s" -msgid "No Syntax items defined for this buffer" -msgstr "Keine Syntax-Elemente fr diesen Puffer definiert" - msgid "syncing on C-style comments" msgstr "Synchronisation an C-Stil Kommentaren" @@ -4964,6 +5545,12 @@ msgstr "; Treffer " msgid " line breaks" msgstr " Zeilenumbrche" +msgid "E395: contains argument not accepted here" +msgstr "E395: \"contains\"-Argument ist an dieser Stelle ungltig" + +msgid "E844: invalid cchar value" +msgstr "E844: Ungltiger cchar Wert" + msgid "E393: group[t]here not accepted here" msgstr "E393: \"group[t]here\" ist an dieser Stelle ungltig" @@ -4971,19 +5558,20 @@ msgstr "E393: \"group[t]here\" ist an dieser Stelle ung msgid "E394: Didn't find region item for %s" msgstr "E394: Konnte kein \"region\"-Element fr \"%s\" finden" -msgid "E395: contains argument not accepted here" -msgstr "E395: \"contains\"-Argument ist an dieser Stelle ungltig" - -msgid "E396: containedin argument not accepted here" -msgstr "E396: \"containedin\"-Argument ist an dieser Stelle ungltig" - msgid "E397: Filename required" msgstr "E397: Dateiname wird bentigt" +msgid "E847: Too many syntax includes" +msgstr "E847: Zu viele Syntax Includedateien" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: Fehlende ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: berschssige Zeichen nach ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Fehlendes '=': %s" @@ -4992,12 +5580,15 @@ msgstr "E398: Fehlendes '=': %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Nicht ausreichend viele Argumente: syntax region %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: Zu viele Syntax Cluster" + msgid "E400: No cluster specified" msgstr "E400: Kein Cluster angegeben" #, c-format msgid "E401: Pattern delimiter not found: %s" -msgstr "E401: Muster-Abgrenzer nicht gefunden: %s" +msgstr "E401: Muster-Begrenzer nicht gefunden: %s" #, c-format msgid "E402: Garbage after pattern: %s" @@ -5024,7 +5615,8 @@ msgstr "E407: %s ist hier nicht erlaubt" #, c-format msgid "E408: %s must be first in contains list" -msgstr "E408: %s muss als Erstes in der Liste der enthaltenen Elemente auftreten" +msgstr "" +"E408: %s muss als Erstes in der Liste der enthaltenen Elemente auftreten" #, c-format msgid "E409: Unknown group name: %s" @@ -5034,6 +5626,11 @@ msgstr "E409: Unbekannter Gruppenname: %s" msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Ungltiger :syntax Befehl: %s" +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" TOTAL ANZAHL MATCH LANGSAMST DURCHSCHN NAME MUSTER" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: Rekursive Schleife beim Laden von syncolor.vim" @@ -5043,14 +5640,14 @@ msgstr "E411: Hervorhebungsgruppe nicht gefunden: %s" #, c-format msgid "E412: Not enough arguments: \":highlight link %s\"" -msgstr "E412: Nicht ausreichend viele Argumente: \":highlight link %s\"" +msgstr "E412: Nicht gengend Argumente: \":highlight link %s\"" #, c-format msgid "E413: Too many arguments: \":highlight link %s\"" msgstr "E413: Zu viele Argumente: \":highlight link %s\"" msgid "E414: group has settings, highlight link ignored" -msgstr "E414: Gruppe hat Einstellungen, highlight link ignorieren" +msgstr "E414: Gruppe hat Einstellungen, highlight link ignoriert" #, c-format msgid "E415: unexpected equal sign: %s" @@ -5095,6 +5692,9 @@ msgstr "E669: Nicht druckbare Zeichen im Namen der Gruppe" msgid "W18: Invalid character in group name" msgstr "W18: Ungltiges Zeichen im Namen der Gruppe" +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Zu viele Highlight- und Syntaxgruppen" + msgid "E555: at bottom of tag stack" msgstr "E555: Am Ende des Tag-Stacks" @@ -5124,7 +5724,6 @@ msgstr "E428: Kann nicht msgid "File \"%s\" does not exist" msgstr "Die Datei \"%s\" existiert nicht" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "Tag %d aus %d%s" @@ -5139,7 +5738,6 @@ msgstr " Verwendung eines Tags mit abgewandelter Gro msgid "E429: File \"%s\" does not exist" msgstr "E429: Die Datei \"%s\" existiert nicht" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5149,12 +5747,15 @@ msgstr "" #, c-format msgid "Searching tags file %s" -msgstr "tags file %s wird durchsucht" +msgstr "Tag-Datei %s wird durchsucht" #, c-format msgid "E430: Tag file path truncated for %s\n" msgstr "E430: Tag-Dateipfad wurde abgeschnitten fr %s\n" +msgid "Ignoring long line in tags file" +msgstr "Ignoriere zu lange Zeile in Tagsdatei" + #, c-format msgid "E431: Format error in tags file \"%s\"" msgstr "E431: Format Fehler in Tag-Datei \"%s\"" @@ -5167,7 +5768,6 @@ msgstr "Vor byte %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: Tag-Datei ist nicht sortiert: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: Keine Tag-Datei" @@ -5177,8 +5777,13 @@ msgstr "E434: Kann Tag-Muster nicht finden" msgid "E435: Couldn't find tag, just guessing!" msgstr "E435: Konnte Tag mglicherweise nicht finden!" +#, c-format +msgid "Duplicate field name: %s" +msgstr "Doppelter Feldname: %s" + msgid "' not known. Available builtin terminals are:" -msgstr "' nicht bekannt. Die folgenden eingebauten Terminals stehen zur Verfgung:" +msgstr "" +"' nicht bekannt. Die folgenden eingebauten Terminals stehen zur Verfgung:" msgid "defaulting to '" msgstr "Voreinstellung '" @@ -5199,7 +5804,6 @@ msgstr "E436: Kein \"%s\" Eintrag in der Termcap-Datei" msgid "E437: terminal capability \"cm\" required" msgstr "E437: Terminalfhigkeit \"cm\" wird bentigt" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5207,15 +5811,121 @@ msgstr "" "\n" "--- Terminal Tasten ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Kann Datei $VIMRUNTIME/rgb.txt nicht ffnen." + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Beende job in \"%s\"?" + +msgid "Terminal" +msgstr "Terminal" + +msgid "Terminal-finished" +msgstr "Terminal beendet" + +msgid "active" +msgstr "aktiv" + +msgid "running" +msgstr "Fhre aus" + +msgid "finished" +msgstr "beendet" + +msgid "E953: File exists: %s" +msgstr "E953: Datei existiert bereits: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Kein Terminal Puffer" + msgid "new shell started\n" msgstr "neue Shell gestartet\n" msgid "Vim: Error reading input, exiting...\n" msgstr "Vim: Fehler beim Lesen der Eingabe, Abbruch...\n" +msgid "Used CUT_BUFFER0 instead of empty selection" +msgstr "CUT_BUFFER0 anstatt der leeren Auswahl benutzt" + +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Zeilenanzahl nderte sich unerwartet" + msgid "No undo possible; continue anyway" msgstr "Wiederherstellung nicht mglich; setze trotzdem fort" +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: Undo-Datei kann nicht zum Schreiben geffnet werden: %s" + +#, c-format +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: Beschdigte Undo-Datei (%s): %s" + +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "" +"Undo-Datei kann nicht in eines der Verzeichnisse aus 'undodir' geschrieben " +"werden." + +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "berschreibe nicht mit Undo-Datei, nicht lesbar: %s" + +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "berschreibe nicht, dies ist keine Undo-Datei: %s" + +msgid "Skipping undo file write, nothing to undo" +msgstr "" +"berspringe Schreiben der Undo-Datei, es gibt nichts zum rckgngig machen." + +#, c-format +msgid "Writing undo file: %s" +msgstr "Schreiben der Undo-Datei %s" + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: Fehler beim Schreiben in Undo-Datei: %s" + +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "Lese nicht Undo-Datei, Besitzer unterscheidet sich: %s" + +#, c-format +msgid "Reading undo file: %s" +msgstr "Lese Undo-Datei: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: Undo-Datei kann nicht zum Lesen geffnet werden: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: Keine Undo-Datei: %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "E832: Unverschlsselte Datei besitzt verschlsselte Undo-Datei: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Entschlsselung der Undo-Datei fehlgeschlagen: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: Undo-Datei ist verschlsselt: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Inkompatible Undo-Datei: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "Dateiinhalt hat sich gendert, kann Undo Informationen nicht nutzen." + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Lesen der Undo-Datei %s abgeschlossen" + msgid "Already at oldest change" msgstr "Bereits bei der ltesten nderung" @@ -5223,8 +5933,8 @@ msgid "Already at newest change" msgstr "Bereits bei der jngsten nderung" #, c-format -msgid "Undo number %ld not found" -msgstr "Nummer %ld zur Wiederherstellung nicht gefunden" +msgid "E830: Undo number %ld not found" +msgstr "E830: Undo Nummer %ld nicht gefunden" msgid "E438: u_undo: line numbers wrong" msgstr "E438: u_undo: Zeilennummer falsch" @@ -5258,10 +5968,17 @@ msgid "after" msgstr "nach" msgid "Nothing to undo" -msgstr "Nichts wiederherzustellen" +msgstr "Nichts zum Wiederherstellen" + +msgid "number changes when saved" +msgstr "Nummer nderung Wann Gesichert" + +#, c-format +msgid "%ld seconds ago" +msgstr "vor %ld Sekunden" -msgid "number changes time" -msgstr "Nummer nd. Zeit" +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: 'undojoin' ist nicht erlaubt nach 'undo'" msgid "E439: undo list corrupt" msgstr "E439: Liste der Wiederherstellungen fehlerhaft" @@ -5269,89 +5986,204 @@ msgstr "E439: Liste der Wiederherstellungen fehlerhaft" msgid "E440: undo line missing" msgstr "E440: Wiederherstellungszeile fehlt" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Funktion %s existiert bereits; zum Ersetzen ! hinzufgen" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Dictionary-Eintrag existiert bereits" + +msgid "E718: Funcref required" +msgstr "E718: Funktionsreferenz bentigt" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Unbekannte Funktion: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Unzulssiges Argument: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Doppelter Argumentname: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Zu viele Argumente fr Funktion %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Ungltige Argumente fr die Funktion %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Funktionsaufrufstiefe berschreitet 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "rufe %s auf" + +#, c-format +msgid "%s aborted" +msgstr "%s abgebrochen" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s lieferte #%ld zurck" + +#, c-format +msgid "%s returning %s" +msgstr "%s lieferte \"%s\" zurck" + +msgid "E699: Too many arguments" +msgstr "E699: Zu viele Argumente" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Unbekannte Funktion: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Funktion wurde gelscht: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Zu wenige Argumente fr Funktion: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> wurde nicht in einer Skript-Umgebung benutzt: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Aufruf der 'dict' Funktion ohne Dictionary: %s" + +msgid "E129: Function name required" +msgstr "E129: Funktionsname wird bentigt" + +# #msgid "E129: Function name required" +# #msgstr "E129: Funktionsname wird verlangt" +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" msgstr "" -"\n" -"MS-Windows 16/32 Bit GUI Version" +"E128: Funktionsname muss mit einem Grobuchstaben oder \"s:\" beginnen: %s" -msgid "" -"\n" -"MS-Windows 32-bit GUI version" +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Funktionsname darf keinen Doppelpunkt enthalten: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Undefinierte Funktion: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Fehlendes '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: g: kann nicht hier benutzt werden" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" msgstr "" -"\n" -"MS-Windows 32 Bit GUI Version" +"E932: Closure Funktion kann nicht auf ussersten Level definiert sein: %s" -msgid " in Win32s mode" -msgstr " in Win32s Modus" +msgid "E126: Missing :endfunction" +msgstr "E126: Fehlendes :endfunction" -msgid " with OLE support" -msgstr " mit OLE-Untersttzung" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: berschssiger Text nach :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Funktionsname kollidiert mit Variable: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Funktion %s kann nicht umdefiniert werden, da noch in Verwendung" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "" +"E746: Funktionsname stimmt mit dem Namen der Skript-Datei nicht berein: %s." + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Funktion %s kann nicht gelscht werden: sie ist in Verwendung" + +msgid "E133: :return not inside a function" +msgstr "E133: :return auerhalb einer Funktion" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Fehlende Klammern: %s" msgid "" "\n" -"MS-Windows 32-bit console version" +"MS-Windows 64-bit GUI version" msgstr "" "\n" -"MS-Windows 32 Bit Konsolen-Version" +"MS-Windows 64 Bit GUI Version" msgid "" "\n" -"MS-Windows 16-bit version" +"MS-Windows 32-bit GUI version" msgstr "" "\n" -"MS-Windows 16 Bit Version" +"MS-Windows 32 Bit GUI Version" + +msgid " with OLE support" +msgstr " mit OLE-Untersttzung" msgid "" "\n" -"32-bit MS-DOS version" +"MS-Windows 64-bit console version" msgstr "" "\n" -"32 Bit MS-DOS Version" +"MS-Windows 64 Bit Konsolen-Version" msgid "" "\n" -"16-bit MS-DOS version" +"MS-Windows 32-bit console version" msgstr "" "\n" -"16 Bit MS-DOS Version" +"MS-Windows 32 Bit Konsolen-Version" msgid "" "\n" -"MacOS X (unix) version" +"macOS version" msgstr "" "\n" -"MacOS X (unix) Version" +"MacOS Version" msgid "" "\n" -"MacOS X version" +"macOS version w/o darwin feat." msgstr "" "\n" -"MacOS X Version" +"MacOS Version ohne Darwin" msgid "" "\n" -"MacOS version" +"OpenVMS version" msgstr "" "\n" -"MacOS Version" +"OpenVMS Version" msgid "" "\n" -"RISC OS version" +"Included patches: " msgstr "" "\n" -"RISC OS Version" +"Inklusive der Patches: " msgid "" "\n" -"Included patches: " +"Extra patches: " msgstr "" "\n" -"Inklusive der Korrekturen: " +"Extra Patches: " msgid "Modified by " msgstr "Verndert von " @@ -5404,18 +6236,15 @@ msgstr "" msgid "without GUI." msgstr "ohne GUI." +msgid "with GTK3 GUI." +msgstr "mit GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "mit GTK2-GNOME GUI." -msgid "with GTK-GNOME GUI." -msgstr "mit GTK-GNOME GUI." - msgid "with GTK2 GUI." msgstr "mit GTK2 GUI." -msgid "with GTK GUI." -msgstr "mit GTK GUI." - msgid "with X11-Motif GUI." msgstr "mit X11-Motif GUI." @@ -5425,9 +6254,6 @@ msgstr "mit X11-neXtaw GUI." msgid "with X11-Athena GUI." msgstr "mit X11-Athena GUI." -msgid "with BeOS GUI." -msgstr "mit BeOS GUI." - msgid "with Photon GUI." msgstr "mit Photon GUI." @@ -5440,9 +6266,6 @@ msgstr "mit Carbon GUI." msgid "with Cocoa GUI." msgstr "mit Cocoa GUI." -msgid "with (classic) GUI." -msgstr "mit (klassischem) GUI." - msgid " Features included (+) or not (-):\n" msgstr " Ein- (+) oder ausschlielich (-) der Eigenschaften:\n" @@ -5476,6 +6299,9 @@ msgstr "zweite Benutzer-gvimrc-Datei: \"" msgid "3rd user gvimrc file: \"" msgstr "dritte Benutzer-gvimrc-Datei: \"" +msgid " defaults file: \"" +msgstr " defaults Datei: \"" + msgid " system menu file: \"" msgstr " System-Men-Datei: \"" @@ -5521,8 +6347,8 @@ msgstr "Tippe :q<Enter> zum Beenden " msgid "type :help<Enter> or <F1> for on-line help" msgstr "Tippe :help<Enter> oder <F1> fr Online Hilfe " -msgid "type :help version7<Enter> for version info" -msgstr "Tippe :help version7<Enter> fr Versions-Informationen" +msgid "type :help version8<Enter> for version info" +msgstr "Tippe :help version8<Enter> fr Versions-Informationen" msgid "Running in Vi compatible mode" msgstr "Vi kompatible Einstellung" @@ -5540,13 +6366,15 @@ msgid "Running modeless, typed text is inserted" msgstr "Mode-freier Betrieb, getippter Text wird eingefgt" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "Men Editieren->Globale Einstellung->Einfge-Modus ein- und ausschalten " +msgstr "" +"Men Editieren->Globale Einstellung->Einfge-Modus ein- und ausschalten " msgid " for two modes " msgstr " fr zwei Modi " msgid "menu Edit->Global Settings->Toggle Vi Compatible" -msgstr "Men Editieren->Globale Einstellung->Vi-Kompatibilitt ein- und ausschalten" +msgstr "" +"Men Editieren->Globale Einstellung->Vi-Kompatibilitt ein- und ausschalten" msgid " for Vim defaults " msgstr " fr Vim Voreinstellungen " @@ -5566,14 +6394,11 @@ msgstr "Tippe :help register<Enter> f msgid "menu Help->Sponsor/Register for information " msgstr "Men Hilfe->Sponsor/Register fr mehr Informationen " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ACHTUNG: Windows 95/98/ME wurde erkannt" - -msgid "type :help windows95<Enter> for info on this" -msgstr "Tippe :help windows95<Enter> fr Informationen darber " +msgid "Already only one window" +msgstr "Bereits nur ein Fenster" msgid "E441: There is no preview window" -msgstr "E441: Es gibt kein Fenster zur Voransicht" +msgstr "E441: Es gibt kein Vorschaufenster" # should read: topleft / botright msgid "E442: Can't split topleft and botright at the same time" @@ -5585,37 +6410,88 @@ msgstr "E443: Rotieren nicht m msgid "E444: Cannot close last window" msgstr "E444: Letztes Fenster kann nicht geschlossen werden" -msgid "Already only one window" -msgstr "Bereits nur ein Fenster" +msgid "E813: Cannot close autocmd window" +msgstr "E813: Autokommando-Fenster kann nicht geschlossen werden" + +msgid "E814: Cannot close window, only autocmd window would remain" +msgstr "" +"E814: Kann Fenster nicht schlieen, da nur Autokommando-Fenster brig " +"bleiben wrde" msgid "E445: Other window contains changes" msgstr "E445: Anderes Fenster enthlt nderungen" -# Cursor: Schreibmarke Positionsmarke -msgid "E446: No file name under cursor" -msgstr "E446: Kein Dateiname unter dem Cursor" +# Cursor: Schreibmarke Positionsmarke +msgid "E446: No file name under cursor" +msgstr "E446: Kein Dateiname unter dem Cursor" + +#, c-format +msgid "E447: Can't find file \"%s\" in path" +msgstr "E447: Kann Datei \"%s\" nicht im Pfad finden" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Ungltige ID: %ld (muss grer gleich 1 sein)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID bereits benutzt: %ld" + +msgid "List or number required" +msgstr "Liste oder Nummer erforderlich" #, c-format -msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: Kann Datei \"%s\" nicht im Pfad finden" +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Ungltige ID: %ld (muss grer gleich 1 sein)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID nicht gefunden: %ld" #, c-format msgid "E370: Could not load library %s" msgstr "E370: Konnte Bibliothek %s nicht laden" msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "Dieser Befehl ist nicht verfgbar, da die Perl-Bibliothek nicht geladen werden konnte" +msgstr "" +"Dieser Befehl ist nicht verfgbar, da die Perl-Bibliothek nicht geladen " +"werden konnte" msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" msgstr "E299: Perl-Evaluierung in der Sandbox ohne dem 'Safe' Modul" +msgid "Edit with &multiple Vims" +msgstr "Editiere mit &mehreren Vims" + +msgid "Edit with single &Vim" +msgstr "Editiere mit einem &Vim" + +msgid "Diff with Vim" +msgstr "Differenz mit Vim" + +msgid "Edit with &Vim" +msgstr "Editiere mit &Vim" + +msgid "Edit with existing Vim - " +msgstr "Editiere mit vorhandenem Vim - " + +msgid "Edits the selected file(s) with Vim" +msgstr "Editiert die ausgewhlte(n) Datei(en) mit Vim" + +msgid "Error creating process: Check if gvim is in your path!" +msgstr "" +"Fehler beim Erzeugen des Prozesses: berprfen Sie, ob gvim in Ihrem Pfad " +"ist!" + +msgid "gvimext.dll error" +msgstr "gvimext.dll Fehler" + +msgid "Path length too long!" +msgstr "Die Lnge des Pfads ist zu gro!" + msgid "--No lines in buffer--" msgstr "--Keine Zeilen im Puffer--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Befehl abgebrochen" @@ -5629,7 +6505,9 @@ msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" msgstr "E11: Ungltig im Kommandozeilenfenster; <CR> fhrt aus, CTRL-C beendet" msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" -msgstr "E12: Befehl nicht zulssig vom exrc/vimrc in der momentanen Verzeichnis- oder Tag-Suche" +msgstr "" +"E12: Befehl nicht zulssig vom exrc/vimrc in der momentanen Verzeichnis- " +"oder Tag-Suche" msgid "E171: Missing :endif" msgstr "E171: Fehlendes :endif" @@ -5652,7 +6530,6 @@ msgstr "E588: :endfor ohne :for" msgid "E13: File exists (add ! to override)" msgstr "E13: Datei existiert bereits (erzwinge mit !)" - msgid "E472: Command failed" msgstr "E472: Befehl fehlgeschlagen" @@ -5671,6 +6548,10 @@ msgstr "E236: Schriftart \"%s\" hat keine feste Breite" msgid "E473: Internal error" msgstr "E473: Interner Fehler" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Interner Fehler: %s" + msgid "Interrupted" msgstr "Unterbrochen" @@ -5684,6 +6565,12 @@ msgstr "E474: Ung msgid "E475: Invalid argument: %s" msgstr "E475: Ungltiges Argument: %s" +msgid "E475: Invalid value for argument %s" +msgstr "E475: Ungltiger Wert fr Argument: %s" + +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Ungltiger Wert fr Argument %s: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: ungltiger Ausdruck: %s" @@ -5702,6 +6589,9 @@ msgstr "E17: \"%s\" ist ein Verzeichnis" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: Bibliotheksaufruf fr \"%s()\" schlug fehl" +msgid "E667: Fsync failed" +msgstr "E667: Fsync fehlgeschlagen" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Bibliotheksfunktion %s konnte nicht geladen werden" @@ -5710,7 +6600,7 @@ msgid "E19: Mark has invalid line number" msgstr "E19: Marke hat ungltige Zeilennummer" msgid "E20: Mark not set" -msgstr "E20: Marke nicht gesetzt" +msgstr "E20: Markierung nicht gesetzt" msgid "E21: Cannot make changes, 'modifiable' is off" msgstr "E21: Kann keine nderungen machen, 'modifiable' ist aus" @@ -5722,22 +6612,30 @@ msgid "E23: No alternate file" msgstr "E23: Keine alternative Datei" msgid "E24: No such abbreviation" -msgstr "E24: Keine Abkrzung gefunden" +msgstr "E24: Diese Kurzform nicht gefunden" msgid "E477: No ! allowed" msgstr "E477: Kein ! erlaubt" msgid "E25: GUI cannot be used: Not enabled at compile time" -msgstr "E25: GUI kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens nicht eingeschaltet." +msgstr "" +"E25: GUI kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens " +"nicht eingeschaltet." msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -msgstr "E26: Hebrisch kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens nicht eingeschaltet.\n" +msgstr "" +"E26: Hebrisch kann nicht benutzt werden: wurde zum Zeitpunkt des " +"bersetzens nicht eingeschaltet.\n" msgid "E27: Farsi cannot be used: Not enabled at compile time\n" -msgstr "E27: Farsi kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens nicht eingeschaltet.\n" +msgstr "" +"E27: Farsi kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens " +"nicht eingeschaltet.\n" msgid "E800: Arabic cannot be used: Not enabled at compile time\n" -msgstr "E800: Arabisch kann nicht benutzt werden: wurde zum Zeitpunkt des bersetzens nicht eingeschaltet.\n" +msgstr "" +"E800: Arabisch kann nicht benutzt werden: wurde zum Zeitpunkt des " +"bersetzens nicht eingeschaltet.\n" #, c-format msgid "E28: No such highlight group name: %s" @@ -5750,7 +6648,7 @@ msgid "E30: No previous command line" msgstr "E30: Keine vorherige Befehlszeile" msgid "E31: No such mapping" -msgstr "E31: Keine Zuordnung gefunden" +msgstr "E31: Kein Mapping gefunden" msgid "E479: No match" msgstr "E479: Kein Treffer" @@ -5796,9 +6694,6 @@ msgstr "E484: Kann die Datei %s nicht msgid "E485: Can't read file %s" msgstr "E485: Kann Datei %s nicht lesen" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Kein Schreibvorgang seit der letzten nderung (erzwinge mit !)" - msgid "E38: Null argument" msgstr "E38: Null-Argument" @@ -5844,9 +6739,38 @@ msgid "E45: 'readonly' option is set (add ! to override)" msgstr "E45: Die Option 'readonly' ist gesetzt (erzwinge mit !)" #, c-format -msgid "E46: Cannot set read-only variable \"%s\"" +msgid "E46: Cannot change read-only variable \"%s\"" msgstr "E46: Variable \"%s\" kann nur gelesen werden" +#, c-format +msgid "E794: Cannot set variable in the sandbox: \"%s\"" +msgstr "E794: Variable kann nicht in der Sandbox gesetzt werden: \"%s\"" + +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Der Schlssel fr das Dictionary darf nicht leer sein" + +msgid "E715: Dictionary required" +msgstr "E715: Dictionary bentigt" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Index der Liste auerhalb des zulssigen Bereichs: %ld." + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Zu viele Argumente fr Funktion: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Schlssel %s nicht im Dictionary vorhanden." + +msgid "E714: List required" +msgstr "E714: Liste bentigt" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Argument von %s muss eine Liste oder ein Wrterbuch sein." + msgid "E47: Error while reading errorfile" msgstr "E47: Fehler whrend des Lesens der Fehlerdatei" @@ -5866,7 +6790,7 @@ msgid "E91: 'shell' option is empty" msgstr "E91: Die Option 'shell' ist leer" msgid "E255: Couldn't read in sign data!" -msgstr "E255: Fehler -- Daten fr Debuggersymbol konnten nicht gelesen werden" +msgstr "E255: Fehler -- Sign-Daten konnten nicht gelesen werden" msgid "E72: Close error on swap file" msgstr "E72: Fehler beim Schlieen der Auslagerungsdatei" @@ -5890,7 +6814,7 @@ msgid "E488: Trailing characters" msgstr "E488: berschssige Zeichen" msgid "E78: Unknown mark" -msgstr "E78: Unbekannte Mark" +msgstr "E78: Unbekannte Markierung" msgid "E79: Cannot expand wildcards" msgstr "E79: Kann die Platzhalter nicht erweitern" @@ -5904,8 +6828,8 @@ msgstr "E592: 'winwidth' darf nicht kleiner sein als 'winminwidth'" msgid "E80: Error while writing" msgstr "E80: Fehler whrend des Schreibens" -msgid "Zero count" -msgstr "Null-Zhler" +msgid "E939: Positive count required" +msgstr "E939: Positiver Zahl bentigt" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> wurde nicht in einer Skript-Umgebung benutzt" @@ -5919,16 +6843,16 @@ msgstr "E463: Region ist gesch msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans erlaubt keine nderungen in schreibgeschtzten Dateien" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Interner Fehler: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: Muster bentigt mehr Speicher als 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: Leerer Puffer" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Puffer %ld existiert nicht." + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Ungltiges Suchmuster oder Trennzeichen" @@ -5939,179 +6863,331 @@ msgstr "E139: Datei ist in einem anderen Puffer geladen" msgid "E764: Option '%s' is not set" msgstr "E764: Option '%s' ist nicht gesetzt" +msgid "E850: Invalid register name" +msgstr "E850: Ungltiger Register Name" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Verzeichnis nicht gefunden in '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Autokommando verursachten Rekursion" + msgid "search hit TOP, continuing at BOTTOM" msgstr "Suche erreichte den ANFANG und wurde am ENDE fortgesetzt" msgid "search hit BOTTOM, continuing at TOP" msgstr "Suche erreichte das ENDE und wurde am ANFANG fortgesetzt" -msgid "Edit with &multiple Vims" -msgstr "Editiere mit &mehreren Vims" +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Geben Sie bitte den Schlssel fr \"%s\" ein: " -msgid "Edit with single &Vim" -msgstr "Editiere mit einem &Vim" +msgid "empty keys are not allowed" +msgstr "Leerer Schlssel nicht erlaubt" -msgid "Diff with Vim" -msgstr "Differenz mit Vim" +msgid "dictionary is locked" +msgstr "Dictionary is gesperrt" -msgid "Edit with &Vim" -msgstr "Editiere mit &Vim" +msgid "list is locked" +msgstr "Liste is gesperrt" -msgid "Edit with existing Vim - " -msgstr "Editiere mit vorhandenem Vim - " +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "Konnte Schlssel '%s' zu Dictionary nicht hinzufgen." -msgid "Press ENTER or type command to continue" -msgstr "Bettigen Sie die EINGABETASTE oder geben Sie einen Befehl ein" +#, c-format +msgid "index must be int or slice, not %s" +msgstr "Index muss eine Int oder Slice sein, nicht %s" -msgid "Error creating process: Check if gvim is in your path!" -msgstr "Fehler beim Erzeugen des Prozesses: berprfen Sie, ob gvim in Ihrem Pfad ist!" +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "erwartete str() oder unicode() Instanz, erhielt jedoch %s" -msgid "gvimext.dll error" -msgstr "gvimext.dll Fehler" +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "Erwartete bytes() oder str() Instanz, erhielt jedoch %s" -msgid "Path length too long!" -msgstr "Die Lnge des Pfads ist zu gro!" +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"erwartete int(), long() or etwas was sich zu long() wandeln lsst, erhielt " +"jedoch %s" -msgid "Edits the selected file(s) with Vim" -msgstr "Editiert die ausgewhlte(n) Datei(en) mit Vim" +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "" +"erwartete int() oder etwas was sich zu int() wandeln lsst, erhielt jedoch %s" -msgid "%ld seconds ago" -msgstr "vor %ld Sekunden" +msgid "value is too large to fit into C int type" +msgstr "Wert zu gro fr einen C Integerwert" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: 'undojoin' ist nicht erlaubt nach 'undo'" +msgid "value is too small to fit into C int type" +msgstr "Wert zu klein fr einen C Integerwert" + +msgid "number must be greater than zero" +msgstr "Nummer muss grer als 0 sein" + +msgid "number must be greater or equal to zero" +msgstr "Nummer muss grer gleich 0 sein" + +msgid "can't delete OutputObject attributes" +msgstr "OutputObject-Attribute knnen nicht gelscht werden" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Unbekannte Funktion: %s" +msgid "invalid attribute: %s" +msgstr "unzulssiges Attribut: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Fehler bei der Initialisierung von I/O Objekten" + +msgid "failed to change directory" +msgstr "Verzeichniswechsel fehlgeschlagen" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Zu wenige Argumente fr Funktion: %s" +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "" +"erwartete 3 Tuple als Ergebnis von imp.find_module(), erhielt jedoch %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> wurde nicht in einer Skript-Umgebung benutzt: %s" +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"erwartete 3 Tuple als Ergebnis von find_module(), but erhielt Tuple der " +"Gre %d" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "interner Fehler: imp.find_module gab Tuple mit NULL zurck" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "kann vim.Dictionary Attribute nicht lschen" + +msgid "cannot modify fixed dictionary" +msgstr "Kann festes Dictionary nicht ndern" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Aufruf der 'dict' Funktion ohne Wrterbuch: %s" +msgid "cannot set attribute %s" +msgstr "Kann nicht Attribut %s setzen" -msgid "E786: Range not allowed" -msgstr "E786: Bereich nicht erlaubt" +msgid "hashtab changed during iteration" +msgstr "Hashtab vernderte sich whrend der Initialisierung" #, c-format -msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Doppelter Tag \"%s\" in der Datei %s/%s" +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "" +"erwartete Sequenz Element der Gre 2, but erhielt Sequenz der Gre %d" -msgid "E179: argument required for -complete" -msgstr "E179: Argument bentigt fr -complete" +msgid "list constructor does not accept keyword arguments" +msgstr "Listen Konstruktor akzeptiert keine Keyword Argumente" + +msgid "list index out of range" +msgstr "Listen Index auerhalb des gltigen Bereichs" #, c-format -msgid "Tab page %d" -msgstr "Tab %d" +msgid "internal error: failed to get vim list item %d" +msgstr "interner Fehler: Zugriff auf Vim Listobjekt %d fehlgeschlagen" -msgid "E585: :while/:for nesting too deep" -msgstr "E585: :while/:for Schachtelung zu tief" +msgid "slice step cannot be zero" +msgstr "Slice Schritt kann nicht Null sein" -msgid "E586: :continue without :while or :for" -msgstr "E586: :continue ohne :while or :for" +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"Versuch der Zuweisung von Sequenzgre grer als %d zu erweiterten Slice" -msgid "E587: :break without :while or :for" -msgstr "E587: :break ohne :while oder :for" +#, c-format +msgid "internal error: no vim list item %d" +msgstr "interner Fehler: Keine Vim Listobjekt %d" -msgid "E788: Not allowed to edit another buffer now" -msgstr "E788: Einen weiteren Puffer zu editieren ist im Moment nicht erlaubt" +msgid "internal error: not enough list items" +msgstr "interner Fehler: nicht gengend Listobjekte" -msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: Schreibfehler, Umwandlung schlug fehl (leere 'fenc' um sie zu erzwingen)" +msgid "internal error: failed to add item to list" +msgstr "interner Fehler: konnte Objekt nicht Liste hinzufgen" #, c-format -msgid "E211: File \"%s\" no longer available" -msgstr "E211: Datei \"%s\" ist nicht lnger vorhanden" +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"Versuch der Zuweisung von Sequenzgre %d zu erweiterten Slice der Gre %d" -msgid "See \":help W12\" for more info." -msgstr "Siehe \":help W12\" fr mehr Information" +msgid "failed to add item to list" +msgstr "Hinzufgen von Objekt zu Liste fehlgeschlagen" -msgid "See \":help W11\" for more info." -msgstr "Siehe \":help W11\" fr mehr Information" +msgid "cannot delete vim.List attributes" +msgstr "kann vim.List Attribute nicht lschen" + +msgid "cannot modify fixed list" +msgstr "kann feste Liste nicht modifizieren" #, c-format -msgid "E46: Cannot change read-only variable \"%s\"" -msgstr "E46: Variable \"%s\" kann nur gelesen werden" +msgid "unnamed function %s does not exist" +msgstr "Unbenannte Funktion %s existiert nicht" #, c-format -msgid "E46: Cannot set variable in the sandbox: \"%s\"" -msgstr "E46: Variable \"%s\" kann in der Sandbox nur gelesen werden" +msgid "function %s does not exist" +msgstr "Funktion %s existiert nicht" -msgid "E267: unexpected return" -msgstr "E267: Unerwartetes 'return'" +#, c-format +msgid "failed to run function %s" +msgstr "Fehler beim Ausfhren der Funktion %s" -msgid "E268: unexpected next" -msgstr "E268: Unerwartetes 'next'" +msgid "unable to get option value" +msgstr "konnte Optionswert nicht erhalten" -msgid "E269: unexpected break" -msgstr "E269: Unerwartetes 'break'" +msgid "internal error: unknown option type" +msgstr "interner Fehler: unbekannter Optionstyp" -msgid "E270: unexpected redo" -msgstr "E270: Unerwartetes 'redo'" +msgid "problem while switching windows" +msgstr "Problem beim Wechseln der Fenster" -msgid "E271: retry outside of rescue clause" -msgstr "E271: 'retry' auerhalb der 'rescue clause'" +#, c-format +msgid "unable to unset global option %s" +msgstr "Konnte globale Option %s nicht aufheben" -msgid "E272: unhandled exception" -msgstr "E272: Unbehandelte Ausnahme" +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "konnte option %s nicht aufheben, da sie keinen globalen Wert hat" + +msgid "attempt to refer to deleted tab page" +msgstr "Versuch, Bezug auf einen gelschten Tab zu nehmen" + +msgid "no such tab page" +msgstr "kein solcher Tab vorhanden" + +msgid "attempt to refer to deleted window" +msgstr "Versuch, Bezug auf eine gelschtes Fenster zu nehmen" + +msgid "readonly attribute: buffer" +msgstr "nur-Lesen Attribut: Puffer" + +msgid "cursor position outside buffer" +msgstr "Cursor Position auerhalb des Puffers" + +msgid "no such window" +msgstr "ungltiges Fenster" + +msgid "attempt to refer to deleted buffer" +msgstr "Versuch, Bezug auf einen gelschten Puffer zu nehmen" + +msgid "failed to rename buffer" +msgstr "Umbenennen des Puffers fehlgeschlagen" + +msgid "mark name must be a single character" +msgstr "Markierung muss ein einzelner Buchstabe sein" #, c-format -msgid "%d files to edit\n" -msgstr "%d Dateien zum Editieren\n" +msgid "expected vim.Buffer object, but got %s" +msgstr "erwartete vim.Puffer Objekt, erhielt jedoch %s" -msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tffne N Tabs (Vorgabe: einzeln fr jede Datei)" +#, c-format +msgid "failed to switch to buffer %d" +msgstr "Wechsel zu Puffer %d fehlgeschlagen" -msgid "--remote-tab <files> As --remote but open tab page for each file" -msgstr "--remote-tab <Dateien> Wie --remote, aber ffne ein Tab fr jede Datei" +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "erwartete vim.Window Objekt, erhielt jedoch %s" -msgid "E304: ml_upd_block0(): Didn't get block 0??" -msgstr "E304: ml_upd_block0(): Block Nr. 0 nicht erhalten?" +msgid "failed to find window in the current tab page" +msgstr "konnte Fenster im aktuellen Tab nicht finden" -msgid "Select Directory dialog" -msgstr "Verzeichnis Auswahl Dialog" +msgid "did not switch to the specified window" +msgstr "konnte nicht zu spezifizierten Fenster wechseln" -msgid "No match at cursor, finding next" -msgstr "Kein Treffer beim Cursur, finde den nchsten" +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "erwartete vim.TabPage Objekt, erhielt jedoch %s" -msgid "E265: $_ must be an instance of String" -msgstr "E265: $_ muss eine Instanz einer Zeichenkette sein" +msgid "did not switch to the specified tab page" +msgstr "konnte nicht zu spezifiziertem Tab wechseln" -msgid "E773: Symlink loop for \"%s\"" -msgstr "E773: Symlink Schleife fr \"%s\"" +msgid "failed to run the code" +msgstr "Ausfhren des Codes fehlgeschlagen." + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval hat kein gltiges Pythonobjekt zurckgegeben" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "" +"E859: Konvertierung von zurckgegebenen Pythonobjekt zu Vim Wert " +"fehlgeschlagen" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "konnte nicht %s zu Vim Dictionary konvertieren" #, c-format +msgid "unable to convert %s to vim list" +msgstr "konnte %s nicht zu Vim Liste konvertieren" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "konnte %s nicht zu Vim Struktur konvertieren" + +msgid "internal error: NULL reference passed" +msgstr "interner Fehler: NULL Referenz bermittelt" + +msgid "internal error: invalid value type" +msgstr "interner Fehler: ungltiger Werttyp" + msgid "" -"\n" -"# Last %sSearch Pattern:\n" -"~" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" msgstr "" -"\n" -"# Letztes %sSuchmuster:\n" -"~" +"Fehler beim setzen des Path hooks: sys.path_hooks ist keine Liste\n" +"Sie sollten jetzt eine der folgenden Alternativen tun:\n" +"- vim.path_hook zu sys.path_hooks hinzufgen\n" +"- vim.VIM_SPECIAL_PATH zu sys.path hinzufgen\n" -#, c-format msgid "" -"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " -"%d" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" msgstr "" -"Die Definition von COMPOUNDFORBIDFLAG nach dem PFX Element kann falsches Ergebnis in Zeile %s ergeben " -"%d" +"Fehler beim setzen des Pfades: sys.path ist keine Liste\n" +"Fgen Sie vim.VIM_SPECIAL_PATH zu sys.path hinzu" -#, c-format msgid "" -"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " -"%d" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" msgstr "" -"Die Definition von COMPOUNDPERMITFLAG nach dem PFX Element kann falsches Ergebnis in Zeile %s ergeben " -"%d" +"Vim Dateien (*.vim)\t*.vim\n" +"Alle Dateien (*.*)\t*.*\n" -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Ungltige Argumente fr die Funktion %s" +msgid "All Files (*.*)\t*.*\n" +msgstr "Alle Dateien (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Alle Dateien (*.*)\t*.*\n" +"C Quellcode (*.c, *.h)\t*.c;*.h\n" +"C++ Quellcode (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB Quellcode (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim Dateien (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim Dateien (*.vim)\t*.vim\n" +"Alle Dateien (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "" +"Alle Dateien (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Alle Dateien (*)\t*\n" +"C Quellcode (*.c, *.h)\t*.c;*.h\n" +"C++ Quellcode (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim Dateien (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/en_GB.po b/src/po/en_GB.po index 1caad8ae2f..730aafc55e 100644 --- a/src/po/en_GB.po +++ b/src/po/en_GB.po @@ -7,17 +7,23 @@ # # Style Guide: # o English spelling! +# o Colour, not color # o -ise, not -ize. # o No contractions. # o Cannot, not can not. # o Backward (no s) when used as an adjective. +# o Consistent capitalisation for first word after Ennn: +# o Consistent capitalisation of NetBeans # o TBC ... # +# As with all guides, they should be followed unless there is a reason why they +# should not be for a particular message. +# msgid "" msgstr "" "Project-Id-Version: Vim(UK English)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-19 18:03+0100\n" +"POT-Creation-Date: 2017-07-16 13:34+0100\n" "PO-Revision-Date: 2003-02-25 11:05+0000\n" "Last-Translator: Mike Williams <mrw@eandem.co.uk>\n" "Language-Team: Mike Williams <mrw@eandem.co.uk>\n" @@ -25,9 +31,36 @@ msgstr "" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 7bit\n" + +msgid "E903: received command with non-string argument" +msgstr "E903: Received command with non-string argument" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: Last argument for expr/call must be a number" + +msgid "E904: third argument for call must be a list" +msgstr "E904: Third argument for call must be a list" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: Cannot diff more than %ld buffers" +msgid "E905: received unknown command: %s" +msgstr "E905: Received unknown command: %s" + + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: Cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" + +msgid "E906: not an open channel" +msgstr "E906: Not an open channel" + + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: Buffer must be loaded: %s" + + +msgid "Keys don't match!" +msgstr "Keys do not match!" + msgid "E101: More than two buffers in diff mode, don't know which one to use" msgstr "E101: More than two buffers in diff mode, do not know which one to use" @@ -36,14 +69,72 @@ msgstr "E101: More than two buffers in diff mode, do not know which one to use" msgid "E102: Can't find buffer \"%s\"" msgstr "E102: Cannot find buffer \"%s\"" + +msgid "E806: using Float as a String" +msgstr "E806: Using Float as a String" + + #, c-format msgid "E738: Can't list variables for %s" msgstr "E738: Cannot list variables for %s" + +msgid "E743: variable nested too deep for (un)lock" +msgstr "E743: Variable nested too deep for (un)lock" + + +msgid "E724: variable nested too deep for displaying" +msgstr "E724: Variable nested too deep for displaying" + + +msgid "E729: using Funcref as a String" +msgstr "E729: Using Funcref as a String" + +msgid "E730: using List as a String" +msgstr "E730: Using List as a String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Using Dictionary as a String" + +msgid "E908: using an invalid value as a String" +msgstr "E908: Using an invalid value as a String" + + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Variable nested too deep for making a copy" + + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: Complete() can only be used in Insert mode" + + +msgid "E922: expected a dict" +msgstr "E922: Expected a dict" + + +msgid "E916: not a valid job" +msgstr "E916: Not a valid job" + + +msgid "E941: already started a server" +msgstr "E941: Already started a server" + + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: Invalid submatch number: %d" + + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Cannot write viminfo file %s!" + +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Cannot rename viminfo file to %s!" + + msgid "" "# You may edit it if you're careful!\n" "\n" @@ -51,84 +142,153 @@ msgstr "" "# You may edit it if you are careful!\n" "\n" + +msgid "E144: non-numeric argument to :z" +msgstr "E144: Non-numeric argument to :z" + + msgid "E146: Regular expressions can't be delimited by letters" msgstr "E146: Regular expressions cannot be delimited by letters" + +#, c-format +msgid "E666: compiler not supported: %s" +msgstr "E666: Compiler not supported: %s" + + msgid "E493: Backwards range given" msgstr "E493: Backward range given" msgid "Backwards range given, OK to swap" msgstr "Backward range given, OK to swap" + +msgid "E179: argument required for -complete" +msgstr "E179: Argument required for -complete" + +msgid "E179: argument required for -addr" +msgstr "E179: Argument required for -addr" + + #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: Cannot find colour scheme %s" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Cannot find colour scheme '%s'" + + +msgid "E495: no autocommand file name to substitute for \"<afile>\"" +msgstr "E495: No autocommand file name to substitute for \"<afile>\"" + +msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" +msgstr "E496: No autocommand buffer number to substitute for \"<abuf>\"" + +msgid "E497: no autocommand match name to substitute for \"<amatch>\"" +msgstr "E497: No autocommand match name to substitute for \"<amatch>\"" + +msgid "E498: no :source file name to substitute for \"<sfile>\"" +msgstr "E498: No :source file name to substitute for \"<sfile>\"" + +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: No line number to use for \"<slnum>\"" + +#, no-c-format + + +msgid "E583: multiple :else" +msgstr "E583: Multiple :else" + + +#. Give up for a multiple ":finally" and ignore it. +msgid "E607: multiple :finally" +msgstr "E607: Multiple :finally" + msgid "Can't find temp file for conversion" msgstr "Cannot find temp file for conversion" + msgid "can't read output of 'charconvert'" msgstr "cannot read output of 'charconvert'" + msgid "E506: Can't write to backup file (add ! to override)" msgstr "E506: Cannot write to backup file (add ! to override)" + msgid "E508: Can't read file for backup (add ! to override)" msgstr "E508: Cannot read file for backup (add ! to override)" + msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: Cannot make backup file (add ! to override)" + msgid "E214: Can't find temp file for writing" msgstr "E214: Cannot find temp file for writing" + msgid "E166: Can't open linked file for writing" msgstr "E166: Cannot open linked file for writing" msgid "E212: Can't open file for writing" msgstr "E212: Cannot open file for writing" + +msgid "E513: write error, conversion failed (make 'fenc' empty to override)" +msgstr "E513: Write error, conversion failed (make 'fenc' empty to override)" + +#, c-format +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "E513: Write error, conversion failed in line %ld (make 'fenc' empty to override)" + +msgid "E514: write error (file system full?)" +msgstr "E514: Write error (file system full?)" + + msgid "E205: Patchmode: can't save original file" msgstr "E205: Patchmode: cannot save original file" msgid "E206: patchmode: can't touch empty original file" -msgstr "E206: patchmode: cannot touch empty original file" +msgstr "E206: Patchmode: cannot touch empty original file" msgid "E207: Can't delete backup file" msgstr "E207: Cannot delete backup file" + msgid "don't quit the editor until the file is successfully written!" msgstr "do not quit the editor until the file is successfully written!" + msgid "E217: Can't execute autocommands for ALL events" msgstr "E217: Cannot execute autocommands for ALL events" -#, c-format -msgid "E482: Can't create file %s" -msgstr "E482: Cannot create file %s" -msgid "E483: Can't get temp file name" -msgstr "E483: Cannot get temp file name" +msgid "E223: recursive mapping" +msgstr "E223: Recursive mapping" #, c-format -msgid "E484: Can't open file %s" -msgstr "E484: Cannot open file %s" +msgid "E224: global abbreviation already exists for %s" +msgstr "E224: Global abbreviation already exists for %s" #, c-format -msgid "E485: Can't read file %s" -msgstr "E485: Cannot read file %s" +msgid "E225: global mapping already exists for %s" +msgstr "E225: Global mapping already exists for %s" #, c-format -msgid "E40: Can't open errorfile %s" -msgstr "E40: Cannot open errorfile %s" +msgid "E226: abbreviation already exists for %s" +msgstr "E226: Abbreviation already exists for %s" + +#, c-format +msgid "E227: mapping already exists for %s" +msgstr "E227: Mapping already exists for %s" -msgid "E255: Couldn't read in sign data!" -msgstr "E255: Could not read in sign data!" #, c-format msgid "E254: Cannot allocate color %s" msgstr "E254: Cannot allocate colour %s" + #, c-format msgid "E616: vim_SelFile: can't get font %s" msgstr "E616: vim_SelFile: cannot get font %s" @@ -136,13 +296,20 @@ msgstr "E616: vim_SelFile: cannot get font %s" msgid "E614: vim_SelFile: can't return to current directory" msgstr "E614: vim_SelFile: cannot return to current directory" + msgid "E615: vim_SelFile: can't get current directory" msgstr "E615: vim_SelFile: cannot get current directory" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: Cannot allocate colourmap entry, some colours may be incorrect" + +msgid "E552: digit expected" +msgstr "E552: Digit expected" + + #, c-format msgid "E624: Can't open file \"%s\"" msgstr "E624: Cannot open file \"%s\"" @@ -151,6 +318,15 @@ msgstr "E624: Cannot open file \"%s\"" msgid "E457: Can't read PostScript resource file \"%s\"" msgstr "E457: Cannot read PostScript resource file \"%s\"" +#, c-format +msgid "E618: file \"%s\" is not a PostScript resource file" +msgstr "E618: File \"%s\" is not a PostScript resource file" + +#, c-format +msgid "E619: file \"%s\" is not a supported PostScript resource file" +msgstr "E619: File \"%s\" is not a supported PostScript resource file" + + msgid "E324: Can't open PostScript output file" msgstr "E324: Cannot open PostScript output file" @@ -168,46 +344,125 @@ msgstr "E456: Cannot find PostScript resource file \"cidfont.ps\"" msgid "E456: Can't find PostScript resource file \"%s.ps\"" msgstr "E456: Cannot find PostScript resource file \"%s.ps\"" + +#, c-format +msgid "E262: error reading cscope connection %ld" +msgstr "E262: Error reading cscope connection %ld" + +msgid "E561: unknown cscope search type" +msgstr "E561: Unknown cscope search type" + + +msgid "E567: no cscope connections" +msgstr "E567: No cscope connections" + +#, c-format +msgid "E469: invalid cscopequickfix flag %c for %c" +msgstr "E469: Invalid cscopequickfix flag %c for %c" + +#, c-format +msgid "E259: no matches found for cscope query %s of %s" +msgstr "E259: No matches found for cscope query %s of %s" + + +#, c-format +msgid "E625: cannot open cscope database: %s" +msgstr "E625: Cannot open cscope database: %s" + +msgid "E626: cannot get cscope database information" +msgstr "E626: Cannot get cscope database information" + +msgid "E568: duplicate cscope database not added" +msgstr "E568: Duplicate cscope database not added" + + +#. should not reach here +msgid "E570: fatal error in cs_manage_matches" +msgstr "E570: Fatal error in cs_manage_matches" + + msgid "couldn't open buffer" msgstr "could not open buffer" -msgid "can't delete OutputObject attributes" -msgstr "cannot delete OutputObject attributes" + +msgid "E267: unexpected return" +msgstr "E267: Unexpected return" + +msgid "E268: unexpected next" +msgstr "E268: Unexpected next" + +msgid "E269: unexpected break" +msgstr "E269: Unexpected break" + +msgid "E270: unexpected redo" +msgstr "E270: Unexpected redo" + +msgid "E271: retry outside of rescue clause" +msgstr "E271: Retry outside of rescue clause" + +msgid "E272: unhandled exception" +msgstr "E272: Unhandled exception" + +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: Unknown longjmp status %d" + + +#, c-format +msgid "E572: exit code %d" +msgstr "E572: Exit code %d" + + +msgid "netbeans is not supported with this GUI\n" +msgstr "NetBeans is not supported with this GUI\n" + msgid "--literal\t\tDon't expand wildcards" msgstr "--literal\t\tDo not expand wildcards" + msgid "-f or --nofork\tForeground: Don't fork when starting GUI" msgstr "-f or --nofork\tForeground: Do not fork when starting GUI" + msgid "-f\t\t\tDon't use newcli to open window" msgstr "-f\t\t\tDo not use newcli to open window" + msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tDo not load plugin scripts" + msgid "--remote-silent <files> Same, don't complain if there is no server" msgstr "--remote-silent <files> Same, do not complain if there is no server" + msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" msgstr "" "--remote-wait-silent <files> Same, do not complain if there is no server" + msgid "-background <color>\tUse <color> for the background (also: -bg)" msgstr "-background <colour>\tUse <colour> for the background (also: -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" msgstr "-foreground <colour>\tUse <colour> for normal text (also: -fg)" + msgid "+reverse\t\tDon't use reverse video (also: +rv)" msgstr "+reverse\t\tDo not use reverse video (also: +rv)" + msgid "E288: input method doesn't support any style" -msgstr "E288: input method does not support any style" +msgstr "E288: Input method does not support any style" msgid "E289: input method doesn't support my preedit type" -msgstr "E289: input method does not support my preedit type" +msgstr "E289: Input method does not support my preedit type" + +msgid "E293: block was not locked" +msgstr "E293: Block was not locked" + msgid "E298: Didn't get block nr 0?" msgstr "E298: Did not get block nr 0?" @@ -218,14 +473,47 @@ msgstr "E298: Did not get block nr 1?" msgid "E298: Didn't get block nr 2?" msgstr "E298: Did not get block nr 2?" + msgid "E304: ml_upd_block0(): Didn't get block 0??" msgstr "E304: ml_upd_block0(): Did not get block 0??" + +msgid "E317: pointer block id wrong 3" +msgstr "E317: Pointer block id wrong 3" + + +msgid "E317: pointer block id wrong 4" +msgstr "E317: Pointer block id wrong 4" + + +msgid "E317: pointer block id wrong" +msgstr "E317: Pointer block id wrong" + + +#, c-format +msgid "E322: line number out of range: %ld past the end" +msgstr "E322: Line number out of range: %ld past the end" + +#, c-format +msgid "E323: line count wrong in block %ld" +msgstr "E323: Line count wrong in block %ld" + + +msgid "E317: pointer block id wrong 2" +msgstr "E317: Pointer block id wrong 2" + + msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" msgstr "Messages maintainer: Mike Williams <mrw@eandem.co.uk>" -msgid "Keys don't match!" -msgstr "Keys do not match!" + +msgid "E548: digit expected" +msgstr "E548: Digit expected" + + +msgid "E854: path too long for completion" +msgstr "E854: Path too long for completion" + #, c-format msgid "E344: Can't find directory \"%s\" in cdpath" @@ -235,37 +523,148 @@ msgstr "E344: Cannot find directory \"%s\" in cdpath" msgid "E345: Can't find file \"%s\" in path" msgstr "E345: Cannot find file \"%s\" in path" + +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: NetBeans is not supported with this GUI" + +msgid "E511: netbeans already connected" +msgstr "E511: NetBeans already connected" + + +msgid "E664: changelist is empty" +msgstr "E664: Changelist is empty" + + +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "E883: Search pattern and expression register may not contain two or more lines" + + +msgid "E595: contains unprintable or wide character" +msgstr "E595: Contains unprintable or wide character" + + msgid "E597: can't select fontset" -msgstr "E597: cannot select fontset" +msgstr "E597: Cannot select fontset" + msgid "E533: can't select wide font" -msgstr "E533: cannot select wide font" +msgstr "E533: Cannot select wide font" + + +msgid "E536: comma required" +msgstr "E536: Comma required" + + +msgid "E541: too many items" +msgstr "E541: Too many items" + +msgid "E542: unbalanced groups" +msgstr "E542: Unbalanced groups" + msgid "VIM: Can't open window!\n" msgstr "VIM: Cannot open window!\n" + +#, c-format +msgid "E369: invalid item in %s%%[]" +msgstr "E369: Invalid item in %s%%[]" + + +#, c-format +msgid "E59: invalid character after %s@" +msgstr "E59: Invalid character after %s@" + + +msgid "E63: invalid use of \\_" +msgstr "E63: Invalid use of \\_" + + +#. Can't have a multi follow a multi. +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Cannot have a multi follow a multi !" + + +#, c-format +msgid "E384: search hit TOP without match for: %s" +msgstr "E384: Search hit TOP without match for: %s" + +#, c-format +msgid "E385: search hit BOTTOM without match for: %s" +msgstr "E385: Search hit BOTTOM without match for: %s" + + msgid "E388: Couldn't find definition" msgstr "E388: Could not find definition" msgid "E389: Couldn't find pattern" msgstr "E389: Could not find pattern" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug file does not match .spl file: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Error while reading .sug file: %s" + + #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" msgstr "Unrecognised or duplicate item in %s line %d: %s" + #, c-format msgid "Unrecognized flags in %s line %d: %s" msgstr "Unrecognised flags in %s line %d: %s" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug file does not match .spl file: %s" + +#. * file. +msgid "E783: duplicate char in MAP entry" +msgstr "E783: Duplicate char in MAP entry" + + +msgid "E395: contains argument not accepted here" +msgstr "E395: Contains argument not accepted here" + +msgid "E844: invalid cchar value" +msgstr "E844: Invalid cchar value" + #, c-format msgid "E394: Didn't find region item for %s" msgstr "E394: Did not find region item for %s" + +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Trailing char after ']': %s]%s" + + +msgid "E679: recursive loop loading syncolor.vim" +msgstr "E679: Recursive loop loading syncolor.vim" + +#, c-format +msgid "E411: highlight group not found: %s" +msgstr "E411: Highlight group not found: %s" + + +#, c-format +msgid "E415: unexpected equal sign: %s" +msgstr "E415: Unexpected equal sign: %s" + +#, c-format +msgid "E416: missing equal sign: %s" +msgstr "E416: Missing equal sign: %s" + +#, c-format +msgid "E417: missing argument: %s" +msgstr "E417: Missing argument: %s" + + msgid "E419: FG color unknown" msgstr "E419: FG colour unknown" @@ -276,15 +675,93 @@ msgstr "E420: BG colour unknown" msgid "E421: Color name or number not recognized: %s" msgstr "E421: Colour name or number not recognised: %s" +#, c-format +msgid "E422: terminal code too long: %s" +msgstr "E422: Terminal code too long: %s" + + +msgid "E555: at bottom of tag stack" +msgstr "E555: At bottom of tag stack" + +msgid "E556: at top of tag stack" +msgstr "E556: At top of tag stack" + + +#, c-format +msgid "E426: tag not found: %s" +msgstr "E426: Tag not found: %s" + + msgid "E434: Can't find tag pattern" msgstr "E434: Cannot find tag pattern" msgid "E435: Couldn't find tag, just guessing!" msgstr "E435: Could not find tag, just guessing!" + +msgid "E437: terminal capability \"cm\" required" +msgstr "E437: Terminal capability \"cm\" required" + + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: Write error in undo file: %s" + + msgid "E442: Can't split topleft and botright at the same time" msgstr "E442: Cannot split topleft and botright at the same time" + #, c-format msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Cannot find file \"%s\" in path" + + +#, c-format +msgid "E247: no registered server named \"%s\"" +msgstr "E247: No registered server named \"%s\"" + +#, c-format +msgid "E482: Can't create file %s" +msgstr "E482: Cannot create file %s" + +msgid "E483: Can't get temp file name" +msgstr "E483: Cannot get temp file name" + +#, c-format +msgid "E484: Can't open file %s" +msgstr "E484: Cannot open file %s" + +#, c-format +msgid "E485: Can't read file %s" +msgstr "E485: Cannot read file %s" + + +#, c-format +msgid "E40: Can't open errorfile %s" +msgstr "E40: Cannot open errorfile %s" + +msgid "E233: cannot open display" +msgstr "E233: Cannot open display" + + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: List index out of range: %ld" + + +msgid "E255: Couldn't read in sign data!" +msgstr "E255: Could not read in sign data!" + + +msgid "E363: pattern uses more memory than 'maxmempattern'" +msgstr "E363: Pattern uses more memory than 'maxmempattern'" + +msgid "E749: empty buffer" +msgstr "E749: Empty buffer" + + +msgid "can't delete OutputObject attributes" +msgstr "cannot delete OutputObject attributes" + + diff --git a/src/po/eo.po b/src/po/eo.po index 580c7ac797..389597c5b7 100644 --- a/src/po/eo.po +++ b/src/po/eo.po @@ -5,7 +5,7 @@ # # UNUA TRADUKISTO Dominique PELLE <dominique.pelle ĉe gmail.com> # PROVLEGANTO(J) Felipe CASTRO <fefcas ĉe gmail.com> -# Antono MECHELYNCK <antoine.mechelynck ĉe skynet.be> +# Antono MECHELYNCK <antoine.mechelynck ĉe gmail.com> # Yves NEVELSTEEN # # Uzitaj vortaroj kaj fakvortaroj: @@ -13,24 +13,19 @@ # Komputeko: http://komputeko.net/index_eo.php # Komputada leksikono: http://bertilow.com/div/komputada_leksikono/ # -# Lasta versio: -# http://dominique.pelle.free.fr/vim-eo.php -# -# Ĉiu komento estas bonvenata... -# Every remark is welcome... -# msgid "" msgstr "" "Project-Id-Version: Vim(Esperanto)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-21 23:15+0100\n" -"PO-Revision-Date: 2014-03-21 23:16+0100\n" +"POT-Creation-Date: 2018-04-30 19:32+0200\n" +"PO-Revision-Date: 2018-05-07 23:01+0200\n" "Last-Translator: Dominique PELLÉ <dominique.pelle@gmail.com>\n" "Language-Team: \n" "Language: eo\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() alvokita kun malplena pasvorto" @@ -42,10 +37,10 @@ msgid "E817: Blowfish big/little endian use wrong" msgstr "E817: Misuzo de pezkomenca/pezfina en blowfish" msgid "E818: sha256 test failed" -msgstr "E818: Testo de sha256 fiaskis" +msgstr "E818: Testo de sha256 malsukcesis" msgid "E819: Blowfish test failed" -msgstr "E819: Testo de blowfish fiaskis" +msgstr "E819: Testo de blowfish malsukcesis" msgid "[Location List]" msgstr "[Listo de lokoj]" @@ -63,6 +58,12 @@ msgstr "E82: Ne eblas disponigi iun ajn bufron, nun eliras..." msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: Ne eblas disponigi bufron, nun uzas alian..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: Bufro ne povas esti registrita" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Provo de forviŝo de bufro, kiu estas en uzo" + msgid "E515: No buffers were unloaded" msgstr "E515: Neniu bufro estis malŝargita" @@ -99,14 +100,9 @@ msgstr "E90: Ne eblas malŝargi la lastan bufron" msgid "E84: No modified buffer found" msgstr "E84: Neniu modifita bufro trovita" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Estas neniu listigita bufro" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: La bufro %ld ne ekzistas" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Ne eblas iri preter la lastan bufron" @@ -119,6 +115,18 @@ msgstr "" "E89: Neniu skribo de post la lasta ŝanĝo de la bufro %ld (aldonu ! por " "transpasi)" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Tasko akoraŭ aktiva (aldonu ! por fini la taskon)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Neniu skribo de post lasta ŝanĝo (aldonu ! por transpasi)" + +msgid "E948: Job still running" +msgstr "E948: Tasko ankoraŭ aktiva" + +msgid "E37: No write since last change" +msgstr "E37: Neniu skribo de post lasta ŝanĝo" + msgid "W14: Warning: List of file names overflow" msgstr "W14: Averto: Listo de dosiernomoj troas" @@ -174,7 +182,6 @@ msgstr "linio %ld de %ld --%d%%-- kol " msgid "[No Name]" msgstr "[Neniu nomo]" -#. must be a help buffer msgid "help" msgstr "helpo" @@ -200,6 +207,9 @@ msgstr "" "\n" "# Listo de bufroj:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Ne eblas skribi, opcio 'buftype' estas ŝaltita" + msgid "[Scratch]" msgstr "[Malneto]" @@ -219,8 +229,99 @@ msgstr "Emfazaj simbolaĵoj de %s:" msgid " line=%ld id=%d name=%s" msgstr " linio=%ld id=%d nomo=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Ne eblas konekti al pordo" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() en channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: gethostbyname() en channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: ricevis komandon kun argumento, kiu ne estas ĉeno" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: lasta argumento de \"expr/call\" devas esti nombro" + +msgid "E904: third argument for call must be a list" +msgstr "E904: tria argumento de \"call\" devas esti listo" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: nekonata komando ricevita: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): konservo dum nekonektita" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): Konservo malsukcesis" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Ne eblas uzi reagfunkcion kun %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: ne eblas uzi ch_evalexpr()/ch_sendexpr() kun kruda aŭ nl kanalo" + +msgid "E906: not an open channel" +msgstr "E906: ne estas malfermita kanalo" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: dosiero _io bezonas _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: bufro in_io bezonas in_buf aŭ in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: bufro devas esti ŝargita: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Dosiero estas ĉifrita per nekonata metodo" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Averto: uzo de malfortika ĉifrada metodo; vidu :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Tajpu la ŝlosilon de ĉifrado: " + +msgid "Enter same key again: " +msgstr "Tajpu la ŝlosilon denove: " + +msgid "Keys don't match!" +msgstr "Ŝlosiloj ne kongruas!" + +msgid "[crypted]" +msgstr "[ĉifrita]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Mankas dupunkto en la vortaro: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Ripetita ŝlosilo en la vortaro: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Mankas komo en la vortaro: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Mankas fino de vortaro '}': %s" + +msgid "extend() argument" +msgstr "argumento de extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Ŝlosilo jam ekzistas: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: Ne eblas dosierdiferenci pli ol %ld bufrojn" msgid "E810: Cannot read or write temp files" @@ -276,7 +377,6 @@ msgstr "E791: Malplena rikordo en klavmapo" msgid " Keyword completion (^N^P)" msgstr " Kompletigo de ŝlosilvorto (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " Reĝimo ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -349,13 +449,12 @@ msgstr "Analizas: %s" msgid "Scanning tags." msgstr "Analizas etikedojn." +msgid "match in file" +msgstr "kongruo en dosiero" + msgid " Adding" msgstr " Aldonanta" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Serĉanta..." @@ -379,10 +478,6 @@ msgstr "kongruo %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Neatenditaj signoj en \":let\"" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: indekso de listo ekster limoj: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Nedifinita variablo: %s" @@ -390,41 +485,6 @@ msgstr "E121: Nedifinita variablo: %s" msgid "E111: Missing ']'" msgstr "E111: Mankas ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Argumento de %s devas esti Listo" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Argumento de %s devas esti Listo aŭ Vortaro" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Ne eblas uzi malplenan ŝlosilon de Vortaro" - -msgid "E714: List required" -msgstr "E714: Listo bezonata" - -msgid "E715: Dictionary required" -msgstr "E715: Vortaro bezonata" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Tro da argumentoj por funkcio: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Ŝlosilo malekzistas en Vortaro: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: La funkcio %s jam ekzistas (aldonu ! por anstataŭigi ĝin)" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Rikordo de vortaro jam ekzistas" - -msgid "E718: Funcref required" -msgstr "E718: Funcref bezonata" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Uzo de [:] ne eblas kun Vortaro" @@ -432,10 +492,6 @@ msgstr "E719: Uzo de [:] ne eblas kun Vortaro" msgid "E734: Wrong variable type for %s=" msgstr "E734: Nevalida datumtipo de variablo de %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Nekonata funkcio: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Nevalida nomo de variablo: %s" @@ -472,39 +528,21 @@ msgid "E711: List value has not enough items" msgstr "E711: Lista valoro ne havas sufiĉe da eroj" msgid "E690: Missing \"in\" after :for" -msgstr "E690: \"in\" mankas post \":for\"" - -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Mankas krampoj: %s" +msgstr "E690: \"in\" mankas malantaŭ \":for\"" #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Ne estas tia variablo: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Ne eblas ŝlosi aŭ malŝlosi variablon %s" + msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: variablo ingita tro profunde por malŝlosi" +msgstr "E743: variablo ingita tro profunde por (mal)ŝlosi" msgid "E109: Missing ':' after '?'" -msgstr "E109: Mankas ':' post '?'" - -msgid "E691: Can only compare List with List" -msgstr "E691: Eblas nur kompari Liston kun Listo" - -msgid "E692: Invalid operation for List" -msgstr "E692: Nevalida operacio de Listoj" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Eblas nur kompari Vortaron kun Vortaro" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Nevalida operacio de Vortaro" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Eblas nur kompari Funcref kun Funcref" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Nevalida operacio de Funcref-oj" +msgstr "E109: Mankas ':' malantaŭ '?'" msgid "E804: Cannot use '%' with Float" msgstr "E804: Ne eblas uzi '%' kun Glitpunktnombro" @@ -515,6 +553,9 @@ msgstr "E110: Mankas ')'" msgid "E695: Cannot index a Funcref" msgstr "E695: Ne eblas indeksi Funcref" +msgid "E909: Cannot index a special variable" +msgstr "E909: Ne eblas indeksi specialan variablon" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Mankas nomo de opcio: %s" @@ -531,56 +572,130 @@ msgstr "E114: Mankas citilo: %s" msgid "E115: Missing quote: %s" msgstr "E115: Mankas citilo: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Mankas komo en Listo: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "Ne sufiĉa memoro por valorigi referencojn, senrubigado ĉesigita!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Mankas fino de Listo ']': %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: variablo ingita tro profunde por vidigi" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Mankas dupunkto en la vortaro: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Uzo de Glitpunktnombro kiel Nombro" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Ripetita ŝlosilo en la vortaro: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Uzo de Funcref kiel Nombro" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Mankas komo en la vortaro: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Uzo de Listo kiel Nombro" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Mankas fino de vortaro '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Uzo de Vortaro kiel Nombro" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: variablo ingita tro profunde por vidigi" +msgid "E910: Using a Job as a Number" +msgstr "E910: Uzo de Tasko kiel Nombro" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Uzo de Kanalo kiel Nombro" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Uzo de Funcref kiel Glitpunktnombro" + +msgid "E892: Using a String as a Float" +msgstr "E892: Uzo de Ĉeno kiel Glitpunktnombro" + +msgid "E893: Using a List as a Float" +msgstr "E893: Uzo de Listo kiel Glitpunktnombro" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Uzo de Vortaro kiel Glitpunktnombro" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Uzo de speciala valoro kiel Glitpunktnombro" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Uzo de Tasko kiel Glitpunktnombro" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Uzo de Kanalo kiel Glitpunktnombro" + +msgid "E729: using Funcref as a String" +msgstr "E729: uzo de Funcref kiel Ĉeno" + +msgid "E730: using List as a String" +msgstr "E730: uzo de Listo kiel Ĉeno" + +msgid "E731: using Dictionary as a String" +msgstr "E731: uzo de Vortaro kiel Ĉeno" + +msgid "E908: using an invalid value as a String" +msgstr "E908: uzo de nevalida valoro kiel Ĉeno" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Tro da argumentoj por funkcio: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Ne eblas forviŝi variablon %s" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Nevalidaj argumentoj por funkcio: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Nomo de variablo Funcref devas eki per majusklo: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Nekonata funkcio: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Nomo de variablo konfliktas kun ekzistanta funkcio: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Ne sufiĉe da argumentoj por funkcio: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Valoro estas ŝlosita: %s" + +msgid "Unknown" +msgstr "Nekonata" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> estas uzata ekster kunteksto de skripto: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Ne eblas ŝanĝi valoron de %s" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: variablo ingita tro profunde por fari kopion" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# mallokaj variabloj:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tLaste ŝaltita de " + +msgid "E691: Can only compare List with List" +msgstr "E691: Eblas nur kompari Liston kun Listo" + +msgid "E692: Invalid operation for List" +msgstr "E692: Nevalida operacio de Listoj" + +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Eblas nur kompari Vortaron kun Vortaro" + +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Nevalida operacio de Vortaro" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Nevalida operacio de Funcref-oj" + +msgid "map() argument" +msgstr "argumento de map()" + +msgid "filter() argument" +msgstr "argumento de filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Alvoko de funkcio dict sen Vortaro: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Argumento de %s devas esti Listo" + +msgid "E928: String required" +msgstr "E928: Ĉeno bezonata" msgid "E808: Number or Float required" msgstr "E808: Nombro aŭ Glitpunktnombro bezonata" @@ -588,41 +703,28 @@ msgstr "E808: Nombro aŭ Glitpunktnombro bezonata" msgid "add() argument" msgstr "argumento de add()" -msgid "E699: Too many arguments" -msgstr "E699: Tro da argumentoj" - msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() uzeblas nur en Enmeta reĝimo" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. msgid "&Ok" msgstr "&Bone" #, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Ŝlosilo jam ekzistas: %s" - -msgid "extend() argument" -msgstr "argumento de extend()" - -msgid "map() argument" -msgstr "argumento de map()" - -msgid "filter() argument" -msgstr "argumento de filter()" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld linioj: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld linio: " +msgstr[1] "+-%s%3ld linioj: " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Nekonata funkcio: %s" +msgid "E922: expected a dict" +msgstr "E922: vortaro atendita" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Dua argumento de function() devas esti listo aŭ Vortaro" + msgid "" "&OK\n" "&Cancel" @@ -639,9 +741,16 @@ msgstr "argumento de insert()" msgid "E786: Range not allowed" msgstr "E786: Amplekso nepermesebla" +msgid "E916: not a valid job" +msgstr "E916: nevalida tasko" + msgid "E701: Invalid type for len()" msgstr "E701: Nevalida datumtipo de len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID estas rezervita por \":match\": %ld" + msgid "E726: Stride is zero" msgstr "E726: Paŝo estas nul" @@ -651,8 +760,8 @@ msgstr "E727: Komenco preter fino" msgid "<empty>" msgstr "<malplena>" -msgid "E240: No connection to Vim server" -msgstr "E240: Neniu konekto al Vim-servilo" +msgid "E240: No connection to the X server" +msgstr "E240: Neniu konekto al X-servilo" #, c-format msgid "E241: Unable to send to %s" @@ -661,6 +770,12 @@ msgstr "E241: Ne eblas sendi al %s" msgid "E277: Unable to read a server reply" msgstr "E277: Ne eblas legi respondon de servilo" +msgid "E941: already started a server" +msgstr "E941: servilo jam lanĉita" + +msgid "E942: +clientserver feature not available" +msgstr "E942: la eblo +clientserver ne disponeblas" + msgid "remove() argument" msgstr "argumento de remove()" @@ -673,160 +788,50 @@ msgstr "argumento de reverse()" msgid "E258: Unable to send to client" msgstr "E258: Ne eblas sendi al kliento" +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Nevalida ago: '%s'" + msgid "sort() argument" msgstr "argumento de sort()" +msgid "uniq() argument" +msgstr "argumento de uniq()" + msgid "E702: Sort compare function failed" -msgstr "E702: Ordiga funkcio fiaskis" +msgstr "E702: Ordiga funkcio malsukcesis" + +msgid "E882: Uniq compare function failed" +msgstr "E882: kompara funkcio de uniq() malsukcesis" msgid "(Invalid)" msgstr "(Nevalida)" -msgid "E677: Error writing temp file" -msgstr "E677: Eraro dum skribo de provizora dosiero" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Uzo de Glitpunktnombro kiel Nombro" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Uzo de Funcref kiel Nombro" - -msgid "E745: Using a List as a Number" -msgstr "E745: Uzo de Listo kiel Nombro" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Uzo de Vortaro kiel Nombro" - -msgid "E729: using Funcref as a String" -msgstr "E729: uzo de Funcref kiel Ĉeno" - -msgid "E730: using List as a String" -msgstr "E730: uzo de Listo kiel Ĉeno" - -msgid "E731: using Dictionary as a String" -msgstr "E731: uzo de Vortaro kiel Ĉeno" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Nekongrua datumtipo de variablo: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Ne eblas forviŝi variablon %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Nomo de variablo Funcref devas finiĝi per majusklo: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Nomo de variablo konfliktas kun ekzistanta funkcio: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Valoro estas ŝlosita: %s" - -msgid "Unknown" -msgstr "Nekonata" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Ne eblas ŝanĝi valoron de %s" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: variablo ingita tro profunde por fari kopion" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Nedifinita funkcio: %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Mankas '(': %s" - -msgid "E862: Cannot use g: here" -msgstr "E862: Ne eblas uzi g: ĉi tie" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Nevalida argumento: %s" - -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: Ripetita nomo de argumento: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: Mankas \":endfunction\"" - -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Nomo de funkcio konfliktas kun variablo: %s" - -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Ne eblas redifini funkcion %s: Estas nuntempe uzata" - -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Nomo de funkcio ne kongruas kun dosiernomo de skripto: %s" - -msgid "E129: Function name required" -msgstr "E129: Nomo de funkcio bezonata" - #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: Nomo de funkcio devas eki per majusklo aŭ enhavi dupunkton: %s" +msgid "E935: invalid submatch number: %d" +msgstr "E935: nevalida indekso de \"submatch\": %d" -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Ne eblas forviŝi funkcion %s: Estas nuntempe uzata" - -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Profundo de funkcia alvoko superas 'maxfuncdepth'" - -#, c-format -msgid "calling %s" -msgstr "alvokas %s" +msgid "E677: Error writing temp file" +msgstr "E677: Eraro dum skribo de provizora dosiero" -#, c-format -msgid "%s aborted" -msgstr "%s ĉesigita" +msgid "E921: Invalid callback argument" +msgstr "E921: Nevalida argumento de reagfunctio" #, c-format -msgid "%s returning #%ld" -msgstr "%s liveras #%ld" +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Deksesuma %02x, Okuma %03o, Digr %s" #, c-format -msgid "%s returning %s" -msgstr "%s liveras %s" +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Deksesuma %02x, Okuma %03o" #, c-format -msgid "continuing in %s" -msgstr "daŭrigas en %s" - -msgid "E133: :return not inside a function" -msgstr "E133: \":return\" ekster funkcio" - -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# mallokaj variabloj:\n" - -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLaste ŝaltita de " - -msgid "No old files" -msgstr "Neniu malnova dosiero" +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Deksesuma %04x, Okuma %o, Digr %s" #, c-format -msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, Deksesuma %02x, Okuma %03o" +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Deksesuma %08x, Okuma %o, Digr %s" #, c-format msgid "> %d, Hex %04x, Octal %o" @@ -877,13 +882,16 @@ msgid " oldfiles" msgstr " malnovaj dosieroj" msgid " FAILED" -msgstr " FIASKIS" +msgstr " MALSUKCESIS" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Dosiero viminfo ne skribeblas: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Tro da provizoraj dosieroj viminfo, kiel %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Ne eblas skribi dosieron viminfo %s!" @@ -892,7 +900,10 @@ msgstr "E138: Ne eblas skribi dosieron viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Skribas dosieron viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Ne eblas renomi dosieron viminfo al %s!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Tiu dosiero viminfo estis kreita de Vim %s.\n" @@ -910,6 +921,13 @@ msgstr "# Valoro de 'encoding' kiam tiu dosiero estis kreita\n" msgid "Illegal starting char" msgstr "Nevalida eka signo" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Linioj komencantaj per |, kopiitaj sen ŝanĝo:\n" + msgid "Save As" msgstr "Konservi kiel" @@ -1004,8 +1022,8 @@ msgstr " en 1 linio" msgid " on %ld lines" msgstr " en %ld linioj" -msgid "E147: Cannot do :global recursive" -msgstr "E147: Ne eblas fari \":global\" rekursie" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: Ne eblas fari \":global\" rekursie kun amplekso" # DP: global estas por ":global" do mi ne tradukis ĝin msgid "E148: Regular expression missing from global" @@ -1045,8 +1063,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Bedaŭrinde, la helpdosiero \"%s\" ne troveblas" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: Ne estas dosierujo: %s" +msgid "E151: No match: %s" +msgstr "E151: Neniu kongruo: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1064,6 +1082,10 @@ msgstr "E670: Miksaĵo de kodoprezento de helpa dosiero en lingvo: %s" msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: Ripetita etikedo \"%s\" en dosiero %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Ne estas dosierujo: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: Nekonata simbola komando: %s" @@ -1089,10 +1111,17 @@ msgstr "E159: Mankas numero de simbolo" msgid "E158: Invalid buffer name: %s" msgstr "E158: Nevalida nomo de bufro: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Ne eblas salti al sennoma bufro" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Nevalida identigilo de simbolo: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Ne eblas ŝanĝi simbolon %s" + msgid " (NOT FOUND)" msgstr " (NETROVITA)" @@ -1102,9 +1131,20 @@ msgstr " (nesubtenata)" msgid "[Deleted]" msgstr "[Forviŝita]" +msgid "No old files" +msgstr "Neniu malnova dosiero" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Eniras sencimigan reĝimon. Tajpu \"cont\" por daŭrigi." +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Malnovaval = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Novaval = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "linio %ld: %s" @@ -1113,6 +1153,13 @@ msgstr "linio %ld: %s" msgid "cmd: %s" msgstr "kmd: %s" +msgid "frame is zero" +msgstr "kadro estas nul" + +#, c-format +msgid "frame at highest level: %d" +msgstr "kadro je la plej alta nivelo: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Kontrolpunkto en \"%s%s\" linio %ld" @@ -1128,6 +1175,10 @@ msgstr "Neniu kontrolpunkto estas difinita" msgid "%3d %s %s line %ld" msgstr "%3d %s %s linio %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d espr %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: Uzu unue \":profile start {dosiernomo}\"" @@ -1135,8 +1186,9 @@ msgstr "E750: Uzu unue \":profile start {dosiernomo}\"" msgid "Save changes to \"%s\"?" msgstr "Ĉu konservi ŝanĝojn al \"%s\"?" -msgid "Untitled" -msgstr "Sen titolo" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Tasko ankoraŭ aktiva en la bufro \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1167,8 +1219,16 @@ msgid "Searching for \"%s\"" msgstr "Serĉado de \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "ne trovita en 'runtimepath': \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "ne trovita en '%s: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Pitono versio 2.x bezonata sed nesubtenata, ignoro de dosiero: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: pitono versio 3.x bezonata sed nesubtenata, ignoro de dosiero: %s" msgid "Source Vim script" msgstr "Ruli Vim-skripton" @@ -1197,6 +1257,10 @@ msgstr "linio %ld: rulas \"%s\"" msgid "finished sourcing %s" msgstr "finis ruli %s" +#, c-format +msgid "continuing in %s" +msgstr "daŭrigas en %s" + msgid "modeline" msgstr "reĝimlinio" @@ -1263,12 +1327,12 @@ msgstr "Inversa amplekso donita, permuteblas" msgid "E494: Use w or w>>" msgstr "E494: Uzu w aŭ w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Tabulo de komandoj estas ĝisdatigenda, lanĉu 'make cmdidx'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Bedaŭrinde, tiu komando ne haveblas en tiu versio" -msgid "E172: Only one file name allowed" -msgstr "E172: Nur unu dosiernomo permesebla" - msgid "1 more file to edit. Quit anyway?" msgstr "1 plia redaktenda dosiero. Ĉu tamen eliri?" @@ -1286,13 +1350,12 @@ msgstr "E173: %ld pliaj redaktendaj dosieroj" msgid "E174: Command already exists: add ! to replace it" msgstr "E174: La komando jam ekzistas: aldonu ! por anstataŭigi ĝin" -# DP: malfacilas traduki tion, kaj samtempe honori spacetojn msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nomo Arg Interv Kompleto Difino" +" Nomo Argumentoj Adreso Kompleto Difino" msgid "No user-defined commands found" msgstr "Neniu komando difinita de uzanto trovita" @@ -1312,6 +1375,9 @@ msgstr "E178: Nevalida defaŭlta valoro de kvantoro" msgid "E179: argument required for -complete" msgstr "E179: argumento bezonata por -complete" +msgid "E179: argument required for -addr" +msgstr "E179: argumento bezonata por -addr" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Nevalida atributo: %s" @@ -1329,6 +1395,10 @@ msgstr "E841: Rezervita nomo, neuzebla por komando difinita de uzanto" msgid "E184: No such user-defined command: %s" msgstr "E184: Neniu komando-difinita-de-uzanto kiel: %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Nevalida valoro de tipo de adreso: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Nevalida valoro de kompletigo: %s" @@ -1394,6 +1464,9 @@ msgstr "" msgid "E466: :winpos requires two number arguments" msgstr "E466: \":winpos\" bezonas du numerajn argumentojn" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Ne eblas uzi :redir en execute()" + msgid "Save Redirection" msgstr "Konservi alidirekton" @@ -1419,7 +1492,6 @@ msgstr "E189: \"%s\" ekzistas (aldonu ! por transpasi)" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Ne eblas malfermi \"%s\" por skribi" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: Argumento devas esti litero, citilo aŭ retrocitilo" @@ -1461,13 +1533,15 @@ msgstr "E500: Liveras malplenan ĉenon" msgid "E195: Cannot open viminfo file for reading" msgstr "E195: Ne eblas malfermi dosieron viminfo en lega reĝimo" +msgid "Untitled" +msgstr "Sen titolo" + msgid "E196: No digraphs in this version" msgstr "E196: Neniu duliteraĵo en tiu versio" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: Ne eblas lanĉi (:throw) escepton kun prefikso 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Escepto lanĉita: %s" @@ -1484,7 +1558,6 @@ msgstr "Escepto ne konservita: %s" msgid "%s, line %ld" msgstr "%s, linio %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Kaptis escepton: %s" @@ -1510,7 +1583,6 @@ msgstr "Eraro kaj interrompo" msgid "Error" msgstr "Eraro" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Interrompo" @@ -1530,7 +1602,7 @@ msgid "E583: multiple :else" msgstr "E583: pluraj \":else\"" msgid "E584: :elseif after :else" -msgstr "E584: \":elseif\" post \":else\"" +msgstr "E584: \":elseif\" malantaŭ \":else\"" msgid "E585: :while/:for nesting too deep" msgstr "E585: \":while/:for\" ingita tro profunde" @@ -1553,15 +1625,12 @@ msgstr "E601: \":try\" ingita tro profunde" msgid "E603: :catch without :try" msgstr "E603: \":catch\" sen \":try\"" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" -msgstr "E604: \":catch\" post \":finally\"" +msgstr "E604: \":catch\" malantaŭ \":finally\"" msgid "E606: :finally without :try" msgstr "E606: \":finally\" sen \":try\"" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: pluraj \":finally\"" @@ -1606,6 +1675,9 @@ msgstr "Esprimo" msgid "Input Line" msgstr "Eniga linio" +msgid "Debug Line" +msgstr "Sencimiga linio" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar preter la longo de komando" @@ -1651,7 +1723,6 @@ msgstr "Vim: Legado el stdin...\n" msgid "Reading from stdin..." msgstr "Legado el stdin..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: Konverto igis la dosieron nelegebla!" @@ -1679,12 +1750,6 @@ msgstr "[NE konvertita]" msgid "[converted]" msgstr "[konvertita]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[ĉifrita]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ERARO DE KONVERTO en linio %ld]" @@ -1700,14 +1765,11 @@ msgid "Can't find temp file for conversion" msgstr "Ne eblas trovi provizoran dosieron por konverti" msgid "Conversion with 'charconvert' failed" -msgstr "Konverto kun 'charconvert' fiaskis" +msgstr "Konverto kun 'charconvert' malsukcesis" msgid "can't read output of 'charconvert'" msgstr "ne eblas legi la eligon de 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Dosiero estas ĉifrata per nekonata metodo" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Neniu kongrua aŭtokomando por la bufro acwrite" @@ -1747,9 +1809,6 @@ msgstr "E509: Ne eblas krei restaŭrkopion (aldonu ! por transpasi)" msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: Ne eblas krei restaŭrkopion (aldonu ! por transpasi)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: La rimeda forko estus perdita (aldonu ! por transpasi)" - msgid "E214: Can't find temp file for writing" msgstr "E214: Ne eblas trovi provizoran dosieron por skribi" @@ -1762,23 +1821,23 @@ msgstr "E166: Ne eblas malfermi ligitan dosieron por skribi" msgid "E212: Can't open file for writing" msgstr "E212: Ne eblas malfermi la dosieron por skribi" -# AM: fsync: ne traduku (nomo de C-komando) -msgid "E667: Fsync failed" -msgstr "E667: Fsync fiaskis" +msgid "E949: File changed while writing" +msgstr "E949: Dosiero ŝanĝiĝis dum skribo" msgid "E512: Close failed" -msgstr "E512: Fermo fiaskis" +msgstr "E512: Fermo malsukcesis" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: skriberaro, konverto fiaskis (igu 'fenc' malplena por transpasi)" +msgstr "" +"E513: skriberaro, konverto malsukcesis (igu 'fenc' malplena por transpasi)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: skriberaro, konverto fiaskis en linio %ld (igu 'fenc' malplena por " -"transpasi)" +"E513: skriberaro, konverto malsukcesis en linio %ld (igu 'fenc' malplena " +"por transpasi)" msgid "E514: write error (file system full?)" msgstr "E514: skriberaro (ĉu plena dosiersistemo?)" @@ -1859,20 +1918,12 @@ msgstr "1 signo" msgid "%lld characters" msgstr "%lld signoj" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld signoj" - msgid "[noeol]" msgstr "[sen EOL]" msgid "[Incomplete last line]" msgstr "[Nekompleta lasta linio]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "AVERTO: La dosiero estas ŝanĝita de post kiam ĝi estis legita!!!" @@ -1951,14 +2002,19 @@ msgstr "--Forviŝita--" msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "aŭto-forviŝas aŭtokomandon: %s <bufro=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Ne ekzistas tia grupo: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: Ne eblas forviŝi la aktualan grupon" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Forviŝo de augroup kiu estas ankoraŭ uzata" + #, c-format msgid "E215: Illegal character after *: %s" -msgstr "E215: Nevalida signo post *: %s" +msgstr "E215: Nevalida signo malantaŭ *: %s" #, c-format msgid "E216: No such event: %s" @@ -1968,7 +2024,6 @@ msgstr "E216: Ne estas tia evento: %s" msgid "E216: No such group or event: %s" msgstr "E216: Ne ekzistas tia grupo aŭ evento: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2017,14 +2072,16 @@ msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: Ne eblas forviŝi faldon per la aktuala 'foldmethod'" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld linioj falditaj " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld linio faldita" +msgstr[1] "+--%3ld linioj falditaj" msgid "E222: Add to read buffer" msgstr "E222: Aldoni al lega bufro" msgid "E223: recursive mapping" -msgstr "E223: rekursia mapo" +msgstr "E223: rikura mapo" #, c-format msgid "E224: global abbreviation already exists for %s" @@ -2052,10 +2109,10 @@ msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Nevalida reĝimo" msgid "E851: Failed to create a new process for the GUI" -msgstr "E851: Ne sukcesis krei novan procezon por la grafika interfaco" +msgstr "E851: Malsukcesis krei novan procezon por la grafika interfaco" msgid "E852: The child process failed to start the GUI" -msgstr "E852: La ida procezo ne sukcesis startigi la grafikan interfacon" +msgstr "E852: La ida procezo malsukcesis startigi la grafikan interfacon" msgid "E229: Cannot start the GUI" msgstr "E229: Ne eblas lanĉi la grafikan interfacon" @@ -2113,6 +2170,18 @@ msgstr "Vim dialogo" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: Ne eblas krei BalloonEval kun ambaŭ mesaĝo kaj reagfunkcio" +msgid "_Cancel" +msgstr "_Rezigni" + +msgid "_Save" +msgstr "_Konservi" + +msgid "_Open" +msgstr "_Malfermi" + +msgid "_OK" +msgstr "_Bone" + msgid "" "&Yes\n" "&No\n" @@ -2122,6 +2191,12 @@ msgstr "" "&Ne\n" "&Rezigni" +msgid "Yes" +msgstr "Jes" + +msgid "No" +msgstr "Ne" + # todo '_' is for hotkey, i guess? msgid "Input _Methods" msgstr "Enigaj _metodoj" @@ -2138,41 +2213,38 @@ msgstr "Serĉi kion:" msgid "Replace with:" msgstr "Anstataŭigi per:" -#. whole word only button msgid "Match whole word only" msgstr "Kongrui kun nur plena vorto" -#. match case button msgid "Match case" msgstr "Uskleca kongruo" msgid "Direction" msgstr "Direkto" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Supren" msgid "Down" msgstr "Suben" -#. 'Find Next' button msgid "Find Next" msgstr "Trovi sekvantan" -#. 'Replace' button msgid "Replace" msgstr "Anstataŭigi" -#. 'Replace All' button msgid "Replace All" msgstr "Anstataŭigi ĉiujn" +msgid "_Close" +msgstr "_Fermi" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: Ricevis peton \"die\" (morti) el la seanca administrilo\n" -msgid "Close" -msgstr "Fermi" +msgid "Close tab" +msgstr "Fermi langeton" msgid "New tab" msgstr "Nova langeto" @@ -2219,20 +2291,6 @@ msgstr "Anstataŭigi ĉi&on" msgid "&Undo" msgstr "&Malfari" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Ne eblas trovi titolon de fenestro \"%s\"" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Ne subtenata argumento: \"-%s\"; Uzu la version OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Ne eblas malfermi fenestron interne de aplikaĵo MDI" - -msgid "Close tab" -msgstr "Fermi langeton" - msgid "Open tab..." msgstr "Malfermi langeton..." @@ -2242,14 +2300,23 @@ msgstr "Trovi ĉenon (uzu '\\\\' por trovi '\\')" msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "Trovi kaj anstataŭigi (uzu '\\\\' por trovi '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Ne uzata" msgid "Directory\t*.nothing\n" msgstr "Dosierujo\t*.nenio\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Ne eblas trovi titolon de fenestro \"%s\"" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Ne subtenata argumento: \"-%s\"; Uzu la version OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Ne eblas malfermi fenestron interne de aplikaĵo MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: Ne eblas disponigi rikordon de kolormapo, iuj koloroj estas eble " @@ -2306,7 +2373,6 @@ msgstr "Vim - Elektilo de tiparo" msgid "Name:" msgstr "Nomo:" -#. create toggle button msgid "Show size in Points" msgstr "Montri grandon en punktoj" @@ -2414,7 +2480,7 @@ msgid "Sending to printer..." msgstr "Sendas al presilo..." msgid "E365: Failed to print PostScript file" -msgstr "E365: Presado de PostSkripta dosiero fiaskis" +msgstr "E365: Presado de PostSkripta dosiero malsukcesis" msgid "Print job sent." msgstr "Laboro de presado sendita." @@ -2479,16 +2545,16 @@ msgid "E622: Could not fork for cscope" msgstr "E622: Ne eblis forki cscope" msgid "cs_create_connection setpgid failed" -msgstr "plenumo de cs_create_connection-setgpid fiaskis" +msgstr "plenumo de cs_create_connection-setgpid malsukcesis" msgid "cs_create_connection exec failed" -msgstr "plenumo de cs_create_connection fiaskis" +msgstr "plenumo de cs_create_connection malsukcesis" msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen de to_fp fiaskis" +msgstr "cs_create_connection: fdopen de to_fp malsukcesis" msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen de fr_fp fiaskis" +msgstr "cs_create_connection: fdopen de fr_fp malsukcesis" msgid "E623: Could not spawn cscope process" msgstr "E623: Ne eblis naskigi procezon cscope" @@ -2513,6 +2579,7 @@ msgstr "%-5s: %s%*s (Uzo: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2523,6 +2590,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: Trovi valorizojn al tiu simbolo\n" " c: Trovi funkciojn, kiuj alvokas tiun funkcion\n" " d: Trovi funkciojn alvokataj de tiu funkcio\n" " e: Trovi tiun egrep-ŝablonon\n" @@ -2550,7 +2618,6 @@ msgstr "E261: konekto cscope %s netrovita" msgid "cscope connection %s closed" msgstr "konekto cscope %s fermita" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: neriparebla eraro en cs_manage_matches" @@ -2594,6 +2661,13 @@ msgstr "" "E815: Bedaŭrinde, tiu komando estas malŝaltita, ne eblis ŝargi la " "bibliotekojn." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Bedaŭrinde, tiu komando estas malŝaltita, ne eblis ŝargi la modulon de " +"MzScheme racket/base." + msgid "invalid expression" msgstr "nevalida esprimo" @@ -2655,6 +2729,13 @@ msgstr "" "E263: Bedaŭrinde tiu komando estas malŝaltita: la biblioteko de Pitono ne " "ŝargeblis." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887` Bedaŭrinde tiu komando estas malŝaltita: la biblioteko de Pitono ne " +"ŝargeblis." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Ne eblas alvoki Pitonon rekursie" @@ -2692,104 +2773,12 @@ msgstr "E272: netraktita escepto" msgid "E273: unknown longjmp status %d" msgstr "E273: nekonata stato de longjmp: %d" -msgid "Toggle implementation/definition" -msgstr "Baskuligi realigon/difinon" - -msgid "Show base class of" -msgstr "Vidigi bazan klason de" - -msgid "Show overridden member function" -msgstr "Montri anajn homonimigajn funkciojn" - -msgid "Retrieve from file" -msgstr "Rekuperi el dosiero" - -msgid "Retrieve from project" -msgstr "Rekuperi el projekto" - -msgid "Retrieve from all projects" -msgstr "Rekuperi de ĉiuj projektoj" - -msgid "Retrieve" -msgstr "Rekuperi" - -msgid "Show source of" -msgstr "Vidigi fonton de" - -msgid "Find symbol" -msgstr "Trovi simbolon" - -msgid "Browse class" -msgstr "Foliumi klasojn" - -msgid "Show class in hierarchy" -msgstr "Montri klason en hierarkio" - -msgid "Show class in restricted hierarchy" -msgstr "Montri klason en hierarkio restriktita" - -# todo -msgid "Xref refers to" -msgstr "Xref ligas al" - -msgid "Xref referred by" -msgstr "Xref ligiĝas de" - -msgid "Xref has a" -msgstr "Xref havas" - -msgid "Xref used by" -msgstr "Xref uzita de" - -# DP: mi ne certas pri kio temas -msgid "Show docu of" -msgstr "Vidigi dokumentaron de" - -msgid "Generate docu for" -msgstr "Krei dokumentaron de" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"Konekto al SNiFF+ neeblas. Kontrolu medion (sniffemacs trovendas en $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Eraro dum lego. Malkonektita" - -# DP: Tiuj 3 mesaĝoj estas kune -msgid "SNiFF+ is currently " -msgstr "SNiFF+ estas aktuale " - -msgid "not " -msgstr "ne " - -msgid "connected" -msgstr "konektita" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Nekonata peto de SNiFF+: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Eraro dum konekto al SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ ne estas konektita" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Ne estas bufro SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Eraro dum skribo. Malkonektita" - msgid "invalid buffer number" msgstr "nevalida numero de bufro" msgid "not implemented yet" msgstr "ankoraŭ ne realigita" -#. ??? msgid "cannot set line(s)" msgstr "ne eblas meti la linio(j)n" @@ -2830,7 +2819,6 @@ msgid "" msgstr "" "ne eblas registri postalvokan komandon: bufro/fenestro estas jam forviŝiĝanta" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2860,7 +2848,7 @@ msgid "Unable to register a command server name" msgstr "Ne eblas registri nomon de komanda servilo" msgid "E248: Failed to send command to the destination program" -msgstr "E248: Sendo de komando al cela programo fiaskis" +msgstr "E248: Sendo de komando al cela programo malsukcesis" #, c-format msgid "E573: Invalid server id used: %s" @@ -2870,6 +2858,18 @@ msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "" "E251: Ecoj de registro de apero de VIM estas nevalide formata. Forviŝita!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Ripetita ŝlosilo en JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Mankas komo en Listo: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Mankas fino de Listo ']': %s" + msgid "Unknown option argument" msgstr "Nekonata argumento de opcio" @@ -2877,10 +2877,10 @@ msgid "Too many edit arguments" msgstr "Tro da argumentoj de redakto" msgid "Argument missing after" -msgstr "Argumento mankas post" +msgstr "Argumento mankas malantaŭ" msgid "Garbage after option argument" -msgstr "Forĵetindaĵo post argumento de opcio" +msgstr "Forĵetindaĵo malantaŭ argumento de opcio" msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" msgstr "Tro da argumentoj \"+komando\", \"-c komando\" aŭ \"--cmd komando\"" @@ -2895,12 +2895,12 @@ msgstr "%d redaktendaj dosieroj\n" msgid "netbeans is not supported with this GUI\n" msgstr "netbeans ne estas subtenata kun tiu grafika interfaco\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Tiu Vim ne estis kompilita kun la kompara eblo." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' ne uzeblas: malŝaltita dum kompilado\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Tiu Vim ne estis kompilita kun la kompara eblo." + msgid "Attempt to open script file again: \"" msgstr "Provas malfermi skriptan dosieron denove: \"" @@ -2911,7 +2911,10 @@ msgid "Cannot open for script output: \"" msgstr "Ne eblas malfermi por eligo de skripto: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Eraro: Fiaskis lanĉi gvim el NetBeans\n" +msgstr "Vim: Eraro: malsukcesis lanĉi gvim el NetBeans\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Eraro: Tiu versio de Vim ne ruliĝas en terminalo Cygwin\n" msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Averto: Eligo ne estas al terminalo\n" @@ -2919,7 +2922,6 @@ msgstr "Vim: Averto: Eligo ne estas al terminalo\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: Averto: Enigo ne estas el terminalo\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "komanda linio pre-vimrc" @@ -2983,7 +2985,7 @@ msgstr "" "Argumentoj:\n" msgid "--\t\t\tOnly file names after this" -msgstr "--\t\t\tNur dosiernomoj post tio" +msgstr "--\t\t\tNur dosiernomoj malantaŭ tio" msgid "--literal\t\tDon't expand wildcards" msgstr "--literal\t\tNe malvolvi ĵokerojn" @@ -3079,6 +3081,13 @@ msgstr "-F\t\t\tKomenci en persa reĝimo" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminalo>\tAgordi terminalon al <terminalo>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "" +"--not-a-term\t\tPreterpasi averton por enigo/eligo, kiu ne estas terminalo" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tEliri se la eniro aŭ eliro ne estas terminalo" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tUzi <vimrc> anstataŭ iun ajn .vimrc" @@ -3178,6 +3187,9 @@ msgstr "" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tUzi <viminfo> anstataŭ .viminfo" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible', defaŭltaj agordoj de Vim, neniu viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h aŭ --help\tAfiŝi Helpon (tiun mesaĝon) kaj eliri" @@ -3278,23 +3290,21 @@ msgstr "--windowid <HWND>\tMalfermi Vim en alia win32 fenestraĵo" msgid "No display" msgstr "Neniu ekrano" -#. Failed to send, abort. msgid ": Send failed.\n" -msgstr ": Sendo fiaskis.\n" +msgstr ": Sendo malsukcesis.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" -msgstr ": Sendo fiaskis. Provo de loka plenumo\n" +msgstr ": Sendo malsukcesis. Provo de loka plenumo\n" #, c-format msgid "%d of %d edited" msgstr "%d de %d redaktita(j)" msgid "No display: Send expression failed.\n" -msgstr "Neniu ekrano: Sendado de esprimo fiaskis.\n" +msgstr "Neniu ekrano: Sendado de esprimo malsukcesis.\n" msgid ": Send expression failed.\n" -msgstr ": Sendado de esprimo fiaskis.\n" +msgstr ": Sendado de esprimo malsukcesis.\n" msgid "No marks set" msgstr "Neniu marko" @@ -3303,7 +3313,6 @@ msgstr "Neniu marko" msgid "E283: No marks matching \"%s\"" msgstr "E283: Neniu marko kongruas kun \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3311,7 +3320,6 @@ msgstr "" "\n" "mark linio kol dosiero/teksto" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3319,7 +3327,6 @@ msgstr "" "\n" " salt linio kol dosiero/teksto" -#. Highlight title msgid "" "\n" "change line col text" @@ -3334,7 +3341,6 @@ msgstr "" "\n" "# Markoj de dosiero:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3359,10 +3365,10 @@ msgid "E284: Cannot set IC values" msgstr "E284: Ne eblas agordi valorojn de IC" msgid "E285: Failed to create input context" -msgstr "E285: Ne eblis krei enigan kuntekston" +msgstr "E285: Kreado de eniga kunteksto malsukcesis" msgid "E286: Failed to open input method" -msgstr "E286: Ne eblis malfermi enigan metodon" +msgstr "E286: Malfermo de eniga metodo malsukcesis" msgid "E287: Warning: Could not set destroy callback to IM" msgstr "E287: Averto: Ne eblis agordi detruan reagfunkcion al IM" @@ -3404,7 +3410,6 @@ msgstr "E298: Ĉu ne akiris blokon n-ro 2?" msgid "E843: Error while updating swap file crypt" msgstr "E843: Eraro dum ĝisdatigo de ĉifrada permutodosiero .swp" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Ve, perdis la permutodosieron .swp!!!" @@ -3466,7 +3471,7 @@ msgstr "" #, c-format msgid "" "E833: %s is encrypted and this version of Vim does not support encryption" -msgstr "E833: %s estas ĉifrata kaj tiu versio de Vim ne subtenas ĉifradon" +msgstr "E833: %s estas ĉifrita kaj tiu versio de Vim ne subtenas ĉifradon" msgid " has been damaged (page size is smaller than minimum value).\n" msgstr " difektiĝis (paĝa grando pli malgranda ol minimuma valoro).\n" @@ -3484,7 +3489,7 @@ msgstr "E308: Averto: Originala dosiero eble ŝanĝiĝis" #, c-format msgid "Swap file is encrypted: \"%s\"" -msgstr "Perumutodosiero .swp estas ĉifrata: \"%s\"" +msgstr "Permutodosiero .swp estas ĉifrita: \"%s\"" msgid "" "\n" @@ -3513,7 +3518,7 @@ msgid "" "to use the same key for text file and swap file" msgstr "" "\n" -"por uzi la saman ŝlosilon por la teksta dosiero kaj permuto dosiero .swp" +"por uzi la saman ŝlosilon por la teksta dosiero kaj permutodosiero .swp" #, c-format msgid "E309: Unable to read block 1 from %s" @@ -3586,9 +3591,8 @@ msgstr "" msgid "Using crypt key from swap file for the text file.\n" msgstr "" -"Uzas ŝlosilon de ĉifrado el permuto dosiero .swp por la teksta dosiero.\n" +"Uzas ŝlosilon de ĉifrado el permutodosiero .swp por la teksta dosiero.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Permutodosiero .swp trovita:" @@ -3689,7 +3693,7 @@ msgid "File preserved" msgstr "Dosiero konservita" msgid "E314: Preserve failed" -msgstr "E314: Konservo fiaskis" +msgstr "E314: Konservo malsukcesis" #, c-format msgid "E315: ml_get: invalid lnum: %ld" @@ -3758,21 +3762,16 @@ msgstr "Dum malfermo de dosiero \"" msgid " NEWER than swap file!\n" msgstr " PLI NOVA ol permutodosiero .swp!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Alia programo eble redaktas la saman dosieron.\n" -" Se jes, estu singarda por ne havi du malsamajn\n" -" aperojn de la sama dosiero, kiam vi faros ŝanĝojn." - -msgid " Quit, or continue with caution.\n" -msgstr " Eliru, aŭ daŭrigu singarde.\n" +"(1) Alia programo eble redaktas la saman dosieron. Se jes, estu singarda\n" +" por ne havi du malsamajn aperojn de la sama dosiero, kiam vi faros\n" +" ŝanĝojn. Eliru aŭ daŭrigu singarde.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) Redakta seanco de tiu dosiero kolapsis.\n" @@ -3852,7 +3851,6 @@ msgstr "E328: Menuo nur ekzistas en alia reĝimo" msgid "E329: No menu \"%s\"" msgstr "E329: Neniu menuo \"%s\"" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: Malplena nomo de menuo" @@ -3865,8 +3863,6 @@ msgstr "E331: Aldono de menueroj direkte al menuzono estas malpermesita" msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Disigilo ne rajtas esti ero de vojo de menuo" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3877,6 +3873,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Disigi tiun menuon" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Menuo ne estas difinita por reĝimo %s" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: Vojo de menuo devas konduki al menuero" @@ -3884,10 +3884,6 @@ msgstr "E333: Vojo de menuo devas konduki al menuero" msgid "E334: Menu not found: %s" msgstr "E334: Menuo netrovita: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Menuo ne estas difinita por reĝimo %s" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: Vojo de menuo devas konduki al sub-menuo" @@ -3959,7 +3955,6 @@ msgstr "Dialogujo de dosiera konservo" msgid "Open File dialog" msgstr "Dialogujo de dosiera malfermo" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "E338: Bedaŭrinde ne estas dosierfoliumilo en konzola reĝimo" @@ -3967,7 +3962,7 @@ msgid "E766: Insufficient arguments for printf()" msgstr "E766: Ne sufiĉaj argumentoj por printf()" msgid "E807: Expected Float argument for printf()" -msgstr "E807: Atendis Glitpunktnombron kiel argumento de printf()" +msgstr "E807: Atendis Glitpunktnombron kiel argumenton de printf()" msgid "E767: Too many arguments to printf()" msgstr "E767: Tro da argumentoj al printf()" @@ -4052,15 +4047,6 @@ msgstr "E548: cifero atendata" msgid "E549: Illegal percentage" msgstr "E549: Nevalida procento" -msgid "Enter encryption key: " -msgstr "Tajpu la ŝlosilon de ĉifrado: " - -msgid "Enter same key again: " -msgstr "Tajpu la ŝlosilon denove: " - -msgid "Keys don't match!" -msgstr "Ŝlosiloj ne kongruas!" - msgid "E854: path too long for completion" msgstr "E854: tro longa vojo por kompletigo" @@ -4088,20 +4074,11 @@ msgstr "E346: Ne plu trovis dosierujon \"%s\" en cdpath" msgid "E347: No more file \"%s\" found in path" msgstr "E347: Ne plu trovis dosieron \"%s\" en serĉvojo" -msgid "Cannot connect to Netbeans #2" -msgstr "Ne eblas konekti al Netbeans n-ro 2" - -msgid "Cannot connect to Netbeans" -msgstr "Ne eblas konekti al Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: Nevalida permeso de dosiero de informo de konekto NetBeans: \"%s\"" -msgid "read from Netbeans socket" -msgstr "lego el kontaktoskatolo de Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Konekto de NetBeans perdita por bufro %ld" @@ -4144,8 +4121,10 @@ msgstr "E662: Ĉe komenco de ŝanĝlisto" msgid "E663: At end of changelist" msgstr "E663: Ĉe fino de ŝanĝlisto" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Tajpu \":quit<Enenklavo>\" por eliri el Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Tajpu :qa! kaj premu <Enenklavon> por forlasi ĉiujn ŝanĝojn kaj eliri el " +"Vim" #, c-format msgid "1 line %sed 1 time" @@ -4177,9 +4156,8 @@ msgstr "%ld linioj krommarĝenitaj " msgid "E748: No previously used register" msgstr "E748: Neniu reĝistro antaŭe uzata" -#. must display the prompt msgid "cannot yank; delete anyway" -msgstr "ne eblas kopii; forviŝi tamene" +msgstr "ne eblas kopii; tamen forviŝi" msgid "1 line changed" msgstr "1 linio ŝanĝita" @@ -4192,25 +4170,30 @@ msgstr "%ld linioj ŝanĝitaj" msgid "freeing %ld lines" msgstr "malokupas %ld liniojn" -msgid "block of 1 line yanked" -msgstr "bloko de 1 linio kopiita" +#, c-format +msgid " into \"%c" +msgstr " en \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "bloko de 1 linio kopiita%s" -msgid "1 line yanked" -msgstr "1 linio kopiita" +#, c-format +msgid "1 line yanked%s" +msgstr "1 linio kopiita%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "bloko de %ld linioj kopiita" +msgid "block of %ld lines yanked%s" +msgstr "bloko de %ld linioj kopiita%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld linioj kopiitaj" +msgid "%ld lines yanked%s" +msgstr "%ld linioj kopiitaj%s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: Nenio en reĝistro %s" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4232,40 +4215,44 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Nekonata tipo de reĝistro %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: serĉa ŝablono kaj esprima reĝistro ne povas enhavi du aŭ pliajn liniojn" + #, c-format msgid "%ld Cols; " msgstr "%ld Kolumnoj; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Apartigis %s%ld de %ld Linioj; %ld de %ld Vortoj; %ld de %ld Bajtoj" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "" +"Apartigis %s%ld de %ld Linioj; %lld de %lld Vortoj; %lld de %lld Bajtoj" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"Apartigis %s%ld de %ld Linioj; %ld de %ld Vortoj; %ld de %ld Signoj; %ld de " -"%ld Bajtoj" +"Apartigis %s%ld de %ld Linioj; %lld de %lld Vortoj; %lld de %lld Signoj; " +"%lld de %lld Bajtoj" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Kol %s de %s; Linio %ld de %ld; Vorto %ld de %ld; Bajto %ld de %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Kol %s de %s; Linio %ld de %ld; Vorto %lld de %lld; Bajto %lld de %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Kol %s de %s; Linio %ld de %ld; Vorto %ld de %ld; Signo %ld de %ld; Bajto " -"%ld de %ld" +"Kol %s de %s; Linio %ld de %ld; Vorto %lld de %lld; Signo %lld de %lld; " +"Bajto %lld de %lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld por BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Folio %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld por BOM)" msgid "Thanks for flying Vim" msgstr "Dankon pro flugi per Vim" @@ -4283,7 +4270,7 @@ msgid "E846: Key code not set" msgstr "E846: Klavkodo ne agordita" msgid "E521: Number required after =" -msgstr "E521: Nombro bezonata post =" +msgstr "E521: Nombro bezonata malantaŭ =" msgid "E522: Not found in termcap" msgstr "E522: Netrovita en termcap" @@ -4292,6 +4279,10 @@ msgstr "E522: Netrovita en termcap" msgid "E539: Illegal character <%s>" msgstr "E539: Nevalida signo <%s>" +#, c-format +msgid "For option %s" +msgstr "Por opcio %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: Ne eblas agordi 'term' al malplena ĉeno" @@ -4313,6 +4304,10 @@ msgstr "E835: Konfliktoj kun la valoro de 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Ne ŝanĝeblas en la grafika interfaco GTK+ 2" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Ne eblas konverti de %s al %s" + msgid "E524: Missing colon" msgstr "E524: Mankas dupunkto" @@ -4321,7 +4316,7 @@ msgstr "E525: Ĉeno de nula longo" #, c-format msgid "E526: Missing number after <%s>" -msgstr "E526: Mankas nombro post <%s>" +msgstr "E526: Mankas nombro malantaŭ <%s>" msgid "E527: Missing comma" msgstr "E527: Mankas komo" @@ -4349,7 +4344,7 @@ msgstr "E534: Nevalida larĝa tiparo" #, c-format msgid "E535: Illegal character after <%c>" -msgstr "E535: Nevalida signo post <%c>" +msgstr "E535: Nevalida signo malantaŭ <%c>" msgid "E536: comma required" msgstr "E536: komo bezonata" @@ -4368,7 +4363,10 @@ msgid "E541: too many items" msgstr "E541: tro da elementoj" msgid "E542: unbalanced groups" -msgstr "E542: misekvilibritaj grupoj" +msgstr "E542: misekvilibraj grupoj" + +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Ne eblas igi modifebla terminalon kun aktiva tasko" msgid "E590: A preview window already exists" msgstr "E590: Antaŭvida fenestro jam ekzistas" @@ -4376,6 +4374,9 @@ msgstr "E590: Antaŭvida fenestro jam ekzistas" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "W17: La araba bezonas UTF-8, tajpu \":set encoding=utf-8\"" +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24-bitaj koloroj ne estas subtenataj en tiu sistemo" + #, c-format msgid "E593: Need at least %d lines" msgstr "E593: Bezonas almenaŭ %d liniojn" @@ -4388,9 +4389,6 @@ msgstr "E594: Bezonas almenaŭ %d kolumnojn" msgid "E355: Unknown option: %s" msgstr "E355: Nekonata opcio: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: Nombro bezonata: &%s = '%s'" @@ -4432,7 +4430,7 @@ msgstr "E357: 'langmap': Kongrua signo mankas por %s" #, c-format msgid "E358: 'langmap': Extra characters after semicolon: %s" -msgstr "E358: 'langmap': Ekstraj signoj post punktokomo: %s" +msgstr "E358: 'langmap': Ekstraj signoj malantaŭ punktokomo: %s" msgid "cannot open " msgstr "ne eblas malfermi " @@ -4463,7 +4461,6 @@ msgstr "ne eblas ŝanĝi reĝimon de konzolo?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: ne estas konzolo??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Ne eblas plenumi ŝelon kun opcio -f" @@ -4485,11 +4482,8 @@ msgstr "ERARO DE ENIGO/ELIGO" msgid "Message" msgstr "Mesaĝo" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' ne estas 80, ne eblas plenumi eksternajn komandojn" - msgid "E237: Printer selection failed" -msgstr "E237: Elekto de presilo fiaskis" +msgstr "E237: Elekto de presilo malsukcesis" #, c-format msgid "to %s on %s" @@ -4511,6 +4505,10 @@ msgstr "Presas '%s'" msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Nevalida nomo de signaro \"%s\" en nomo de tiparo \"%s\"" +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Nevalida nomo de kvalito \"%s\" en nomo de tiparo \"%s\"" + #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: Nevalida signo '%c' en nomo de tiparo \"%s\"" @@ -4527,7 +4525,7 @@ msgstr "" "Vim: Alvenis X eraro\n" msgid "Testing the X display failed" -msgstr "Testo de la vidigo X fiaskis" +msgstr "Testo de la vidigo X malsukcesis" msgid "Opening the X display timed out" msgstr "Tempolimo okazis dum malfermo de vidigo X" @@ -4546,12 +4544,14 @@ msgstr "" "\n" "Ne povis ŝalti kuntekston de sekureco por " -msgid "" -"\n" -"Cannot execute shell " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Ne povis ŝalti kuntekston de sekureco %s por %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" msgstr "" -"\n" -"Ne eblas plenumi ŝelon " +"Ne povis akiri kuntekston de sekureco %s por %s. Ĝi nun estas forigata!" msgid "" "\n" @@ -4581,6 +4581,13 @@ msgstr "" "\n" "Ne eblas forki\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Ne eblas plenumi ŝelon " + msgid "" "\n" "Command terminated\n" @@ -4596,7 +4603,7 @@ msgid "dlerror = \"%s\"" msgstr "dlerror = \"%s\"" msgid "Opening the X display failed" -msgstr "Malfermo de vidigo X fiaskis" +msgstr "Malfermo de vidigo X malsukcesis" msgid "XSMP handling save-yourself request" msgstr "XSMP: traktado de peto konservi-mem" @@ -4605,11 +4612,11 @@ msgid "XSMP opening connection" msgstr "XSMP: malfermo de konekto" msgid "XSMP ICE connection watch failed" -msgstr "XSMP: kontrolo de konekto ICE fiaskis" +msgstr "XSMP: kontrolo de konekto ICE malsukcesis" #, c-format msgid "XSMP SmcOpenConnection failed: %s" -msgstr "XSMP: SmcOpenConnection fiaskis: %s" +msgstr "XSMP: SmcOpenConnection malsukcesis: %s" msgid "At line" msgstr "Ĉe linio" @@ -4623,10 +4630,6 @@ msgstr "Eraro de VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "Ne eblis ripari referencojn de funkcioj al la DLL!" -#, c-format -msgid "shell returned %d" -msgstr "la ŝelo liveris %d" - # DP: la eventoj estas tiuj, kiuj estas en la sekvantaj ĉenoj #, c-format msgid "Vim: Caught %s event\n" @@ -4656,6 +4659,13 @@ msgstr "" msgid "Vim Warning" msgstr "Averto de Vim" +#, c-format +msgid "shell returned %d" +msgstr "la ŝelo liveris %d" + +msgid "E926: Current location list was changed" +msgstr "E926: Aktuala listo de lokoj ŝanĝiĝis" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: Tro da %%%c en formata ĉeno" @@ -4688,6 +4698,12 @@ msgstr "E379: Nomo de dosierujo mankas aŭ estas malplena" msgid "E553: No more items" msgstr "E553: Ne plu estas eroj" +msgid "E924: Current window was closed" +msgstr "E924: Aktuala vindozo fermiĝis" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Aktuala rapidriparo ŝanĝiĝis" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d de %d)%s%s: " @@ -4695,18 +4711,18 @@ msgstr "(%d de %d)%s%s: " msgid " (line deleted)" msgstr " (forviŝita linio)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%slisto de eraroj %d de %d; %d eraroj" + msgid "E380: At bottom of quickfix stack" msgstr "E380: Ĉe la subo de stako de rapidriparo" msgid "E381: At top of quickfix stack" msgstr "E381: Ĉe la supro de stako de rapidriparo" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "listo de eraroj %d de %d; %d eraroj" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: Ne eblas skribi, opcio 'buftype' estas ŝaltita" +msgid "No entries" +msgstr "Neniu ano" msgid "Error file" msgstr "Erara Dosiero" @@ -4730,7 +4746,13 @@ msgstr "E369: nevalida ano en %s%%[]" #, c-format msgid "E769: Missing ] after %s[" -msgstr "E769: Mankas ] post %s[" +msgstr "E769: Mankas ] malantaŭ %s[" + +msgid "E944: Reverse range in character class" +msgstr "E944: Inversa amplekso en klaso de signoj" + +msgid "E945: Range too large in character class" +msgstr "E945: tro larga amplekso de klaso de signoj" #, c-format msgid "E53: Unmatched %s%%(" @@ -4753,12 +4775,15 @@ msgstr "E67: \\z1 kaj aliaj estas nepermeseblaj tie" #, c-format msgid "E69: Missing ] after %s%%[" -msgstr "E69: Mankas ] post %s%%[" +msgstr "E69: Mankas ] malantaŭ %s%%[" #, c-format msgid "E70: Empty %s%%[]" msgstr "E70: Malplena %s%%[]" +msgid "E65: Illegal back reference" +msgstr "E65: Nevalida retro-referenco" + msgid "E339: Pattern too long" msgstr "E339: Ŝablono tro longa" @@ -4774,7 +4799,7 @@ msgstr "E52: Neekvilibra \\z(" #, c-format msgid "E59: invalid character after %s@" -msgstr "E59: nevalida signo post %s@" +msgstr "E59: nevalida signo malantaŭ %s@" #, c-format msgid "E60: Too many complex %s{...}s" @@ -4795,19 +4820,16 @@ msgstr "E63: nevalida uzo de \\_" msgid "E64: %s%c follows nothing" msgstr "E64: %s%c sekvas nenion" -msgid "E65: Illegal back reference" -msgstr "E65: Nevalida retro-referenco" - msgid "E68: Invalid character after \\z" -msgstr "E68: Nevalida signo post \\z" +msgstr "E68: Nevalida signo malantaŭ \\z" #, c-format msgid "E678: Invalid character after %s%%[dxouU]" -msgstr "E678: Nevalida signo post %s%%[dxouU]" +msgstr "E678: Nevalida signo malantaŭ %s%%[dxouU]" #, c-format msgid "E71: Invalid character after %s%%" -msgstr "E71: Nevalida signo post %s%%" +msgstr "E71: Nevalida signo malantaŭ %s%%" #, c-format msgid "E554: Syntax error in %s{...}" @@ -4816,6 +4838,10 @@ msgstr "E554: Sintaksa eraro en %s{...}" msgid "External submatches:\n" msgstr "Eksteraj subkongruoj:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA-regulesprimo) ne eblas ripeti %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -4823,6 +4849,9 @@ msgstr "" "E864: \\%#= povas nur esti sekvita de 0, 1, aŭ 2. La aŭtomata motoro de " "regulesprimo estos uzata " +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Ŝanĝas al malavanca motoro de regulesprimo por ŝablono: " + msgid "E865: (NFA) Regexp end encountered prematurely" msgstr "E865: (NFA) Trovis finon de regulesprimo tro frue" @@ -4832,17 +4861,19 @@ msgstr "E866: (NFA-regulesprimo) Mispoziciigita %c" #, c-format msgid "E877: (NFA regexp) Invalid character class: %ld" -msgstr "E877: (NFA-regulesprimo) Nevalida klaso de signo: %ld" +msgstr "E877: (NFA-regulesprimo) Nevalida klaso de signoj: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) Nekonata operatoro '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: tro larga valoro de \\%" + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (NFA) Nekonata operatoro '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: Eraro dum prekomputado de NFA kun ekvivalentoklaso!" @@ -4853,13 +4884,11 @@ msgstr "E869: (NFA) Nekonata operatoro '\\@%c'" msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (NFS-regulesprimo) Eraro dum legado de limoj de ripeto" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "" "E871: (NFA-regulesprimo) Ne povas havi mult-selekton tuj post alia mult-" "selekto!" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (NFA-regulesprimo) tro da '('" @@ -4880,7 +4909,7 @@ msgstr "" "statoj en la staplo" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " -msgstr "E876: (NFA-regulesprimo) ne sufiĉa spaco por enmomorigi la tutan NFA " +msgstr "E876: (NFA-regulesprimo) ne sufiĉa spaco por enmemorigi la tutan NFA " msgid "E878: (NFA) Could not allocate memory for branch traversal!" msgstr "E878: (NFA) Ne povis asigni memoron por traigi branĉojn!" @@ -4925,9 +4954,6 @@ msgstr " hebrea" msgid " Arabic" msgstr " araba" -msgid " (lang)" -msgstr " (lingvo)" - msgid " (paste)" msgstr " (algluo)" @@ -4965,12 +4991,11 @@ msgid "E385: search hit BOTTOM without match for: %s" msgstr "E385: serĉo atingis SUBON sen trovi: %s" msgid "E386: Expected '?' or '/' after ';'" -msgstr "E386: Atendis '?' aŭ '/' post ';'" +msgstr "E386: Atendis '?' aŭ '/' malantaŭ ';'" msgid " (includes previously listed match)" msgstr " (enhavas antaŭe listigitajn kongruojn)" -#. cursor at status line msgid "--- Included files " msgstr "--- Inkluzivitaj dosieroj " @@ -5022,8 +5047,45 @@ msgstr "" "# Lasta serĉa ŝablono %s:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Eraro de formato en literuma dosiero" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Literumilo ne estas ŝaltita" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Averto: Ne eblas trovi vortliston \"%s_%s.spl\" aŭ \"%s_ascii.spl\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Averto: Ne eblas trovi vortliston \"%s.%s.spl\" aŭ \"%s.ascii.spl\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: Aŭtokomando SpellFileMissing forviŝis bufron" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Averto: regiono %s ne subtenata" + +msgid "Sorry, no suggestions" +msgstr "Bedaŭrinde ne estas sugestoj" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Bedaŭrinde estas nur %ld sugestoj" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Anstataŭigi \"%.*s\" per:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Neniu antaŭa literuma anstataŭigo" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Netrovita: %s" msgid "E758: Truncated spell file" msgstr "E758: Trunkita literuma dosiero" @@ -5045,17 +5107,6 @@ msgstr "E762: Signo en FOL, LOW aŭ UPP estas ekster limoj" msgid "Compressing word tree..." msgstr "Densigas arbon de vortoj..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Literumilo ne estas ŝaltita" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "Averto: Ne eblas trovi vortliston \"%s_%s.spl\" aŭ \"%s_ascii.spl\"" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Averto: Ne eblas trovi vortliston \"%s.%s.spl\" aŭ \"%s.ascii.spl\"" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Legado de literuma dosiero \"%s\"" @@ -5073,8 +5124,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Nesubtenata sekcio en literuma dosiero" #, c-format -msgid "Warning: region %s not supported" -msgstr "Averto: regiono %s ne subtenata" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Tio ne ŝajnas esti dosiero .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Malnova dosiero .sug, bezonas ĝisdatigon: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Dosiero .sug estas por pli nova versio de Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Dosiero .sug ne kongruas kun dosiero .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: eraro dum legado de dosiero .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5221,8 +5288,8 @@ msgid "E760: No word count in %s" msgstr "E760: Ne estas nombro de vortoj en %s" #, c-format -msgid "line %6d, word %6d - %s" -msgstr "linio %6d, vorto %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "linio %6d, vorto %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5286,10 +5353,6 @@ msgstr "Densigis %d de %d nodoj; %d (%d%%) restantaj" msgid "Reading back spell file..." msgstr "Relegas la dosieron de literumo..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Fonetika analizado..." @@ -5312,8 +5375,9 @@ msgstr "Evaluo de memoro uzata: %d bajtoj" msgid "E751: Output file name must not have region name" msgstr "E751: Nomo de eliga dosiero ne devas havi nomon de regiono" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: Nur 8 regionoj subtenataj" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: Nur ĝis %ld regionoj subtenataj" #, c-format msgid "E755: Invalid region in %s" @@ -5338,68 +5402,47 @@ msgid "Word '%.*s' removed from %s" msgstr "Vorto '%.*s' fortirita el %s" #, c-format -msgid "Word '%.*s' added to %s" -msgstr "Vorto '%.*s' aldonita al %s" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: Signoj de vorto malsamas tra literumaj dosieroj" - -msgid "Sorry, no suggestions" -msgstr "Bedaŭrinde ne estas sugestoj" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Bedaŭrinde estas nur %ld sugestoj" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Anstataŭigi \"%.*s\" per:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: Neniu antaŭa literuma anstataŭigo" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Netrovita: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Tio ne ŝajnas esti dosiero .sug: %s" - -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Malnova dosiero .sug, bezonas ĝisdatigon: %s" - -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Dosiero .sug estas por pli nova versio de Vim: %s" - -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Dosiero .sug ne kongruas kun dosiero .spl: %s" +msgid "Word '%.*s' added to %s" +msgstr "Vorto '%.*s' aldonita al %s" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: eraro dum legado de dosiero .sug: %s" +msgid "E763: Word characters differ between spell files" +msgstr "E763: Signoj de vorto malsamas tra literumaj dosieroj" -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: ripetita signo en rikordo MAP" msgid "No Syntax items defined for this buffer" msgstr "Neniu sintaksa elemento difinita por tiu bufro" +msgid "syntax conceal on" +msgstr "sintakso de conceal ŝaltata" + +msgid "syntax conceal off" +msgstr "sintakso de conceal malŝaltita" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Nevalida argumento: %s" +msgid "syntax case ignore" +msgstr "sintakso ignoras usklecon" + +msgid "syntax case match" +msgstr "sintakso konsideras usklecon" + +msgid "syntax spell toplevel" +msgstr "literumado en teksto sen sintaksa grupo" + +msgid "syntax spell notoplevel" +msgstr "sen literumado en teksto sen sintaksa grupo" + +msgid "syntax spell default" +msgstr "" +"literumado en teksto sen sintaksa grupo, nur se ne estas @Spell aŭ @NoSpell" + +msgid "syntax iskeyword " +msgstr "sintakso iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Nenia sintaksa fasko: %s" @@ -5476,6 +5519,10 @@ msgstr "E847: Tro da sintaksaj inkluzivoj" msgid "E789: Missing ']': %s" msgstr "E789: Mankas ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: vosta signo malantaŭ ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Mankas '=': %s" @@ -5496,7 +5543,7 @@ msgstr "E401: Disigilo de ŝablono netrovita: %s" #, c-format msgid "E402: Garbage after pattern: %s" -msgstr "E402: Forĵetindaĵo post ŝablono: %s" +msgstr "E402: Forĵetindaĵo malantaŭ ŝablono: %s" msgid "E403: syntax sync: line continuations pattern specified twice" msgstr "E403: sintaksa sinkronigo: ŝablono de linia daŭrigo specifita dufoje" @@ -5547,7 +5594,7 @@ msgstr "E412: Ne sufiĉaj argumentoj: \":highlight link %s\"" #, c-format msgid "E413: Too many arguments: \":highlight link %s\"" -msgstr "E413: Tro argumentoj: \":highlight link %s\"" +msgstr "E413: Tro da argumentoj: \":highlight link %s\"" msgid "E414: group has settings, highlight link ignored" msgstr "E414: grupo havas agordojn, ligilo de emfazo ignorita" @@ -5628,7 +5675,6 @@ msgstr "E428: Ne eblas iri preter lastan kongruan etikedon" msgid "File \"%s\" does not exist" msgstr "La dosiero \"%s\" ne ekzistas" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "etikedo %d de %d%s" @@ -5643,7 +5689,6 @@ msgstr " Uzo de etikedo kun malsama uskleco!" msgid "E429: File \"%s\" does not exist" msgstr "E429: Dosiero \"%s\" ne ekzistas" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5674,7 +5719,6 @@ msgstr "Antaŭ bajto %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: Etikeda dosiero ne estas ordigita: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: Neniu etikeda dosiero" @@ -5710,7 +5754,6 @@ msgstr "E436: Neniu rikordo \"%s\" en termcap" msgid "E437: terminal capability \"cm\" required" msgstr "E437: kapablo de terminalo \"cm\" bezonata" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5718,6 +5761,35 @@ msgstr "" "\n" "--- Klavoj de terminalo ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Ne povas malfermi $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Ĉu ĉesigi taskon en \"%s\"?" + +msgid "Terminal" +msgstr "Terminalo" + +msgid "Terminal-finished" +msgstr "Terminalo-finiĝis" + +msgid "active" +msgstr "aktiva" + +msgid "running" +msgstr "ruliĝas" + +msgid "finished" +msgstr "finiĝis" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: Dosiero jam ekzistas: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Ne estas bufro de terminalo" + msgid "new shell started\n" msgstr "nova ŝelo lanĉita\n" @@ -5727,14 +5799,11 @@ msgstr "Vim: Eraro dum legado de eniro, elironta...\n" msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "Uzis CUT_BUFFER0 anstataŭ malplenan apartigon" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. msgid "E881: Line count changed unexpectedly" msgstr "E881: Nombro de linioj ŝanĝiĝis neatendite" -#. must display the prompt msgid "No undo possible; continue anyway" -msgstr "Malfaro neebla; daŭrigi tamene" +msgstr "Malfaro neebla; tamen daŭrigi" #, c-format msgid "E828: Cannot open undo file for writing: %s" @@ -5784,15 +5853,15 @@ msgstr "E823: Ne estas malfara dosiero: %s" #, c-format msgid "E832: Non-encrypted file has encrypted undo file: %s" -msgstr "E832: Ne ĉifrata dosiero havas ĉifratan malfaran dosieron: %s" +msgstr "E832: Ne ĉifrita dosiero havas ĉifritan malfaran dosieron: %s" #, c-format msgid "E826: Undo file decryption failed: %s" -msgstr "E826: Malĉifrado de malfara dosiero fiaskis: %s" +msgstr "E826: Malĉifrado de malfara dosiero malsukcesis: %s" #, c-format msgid "E827: Undo file is encrypted: %s" -msgstr "E827: Malfara dosiero estas ĉifrata: %s" +msgstr "E827: Malfara dosiero estas ĉifrita: %s" #, c-format msgid "E824: Incompatible undo file: %s" @@ -5865,13 +5934,133 @@ msgstr "E439: listo de malfaro estas difekta" msgid "E440: undo line missing" msgstr "E440: linio de malfaro mankas" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Grafika versio MS-Vindozo 16/32-bitoj" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: La funkcio %s jam ekzistas (aldonu ! por anstataŭigi ĝin)" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Rikordo de vortaro jam ekzistas" + +msgid "E718: Funcref required" +msgstr "E718: Funcref bezonata" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Nekonata funkcio: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Nevalida argumento: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Ripetita nomo de argumento: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Tro da argumentoj por funkcio: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Nevalidaj argumentoj por funkcio: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Profundo de funkcia alvoko superas 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "alvokas %s" + +#, c-format +msgid "%s aborted" +msgstr "%s ĉesigita" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s liveras #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s liveras %s" + +msgid "E699: Too many arguments" +msgstr "E699: Tro da argumentoj" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Nekonata funkcio: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: funkcio estis forviŝita: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Ne sufiĉe da argumentoj por funkcio: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> estas uzata ekster kunteksto de skripto: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Alvoko de funkcio dict sen Vortaro: %s" + +msgid "E129: Function name required" +msgstr "E129: Nomo de funkcio bezonata" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Nomo de funkcio devas eki per majusklo aŭ per \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Nomo de funkcio ne povas enhavi dupunkton: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Nedifinita funkcio: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Mankas '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: Ne eblas uzi g: ĉi tie" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Fermo-funkcio devus esti je la plej alta nivelo: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: Mankas \":endfunction\"" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Teksto trovita malantaŭ :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Nomo de funkcio konfliktas kun variablo: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Ne eblas redifini funkcion %s: Estas nuntempe uzata" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Nomo de funkcio ne kongruas kun dosiernomo de skripto: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Ne eblas forviŝi funkcion %s: Estas nuntempe uzata" + +msgid "E133: :return not inside a function" +msgstr "E133: \":return\" ekster funkcio" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Mankas krampoj: %s" msgid "" "\n" @@ -5887,9 +6076,6 @@ msgstr "" "\n" "Grafika versio MS-Vindozo 32-bitoj" -msgid " in Win32s mode" -msgstr " en reĝimo Win32s" - msgid " with OLE support" msgstr " kun subteno de OLE" @@ -5909,45 +6095,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Versio MS-Vindozo 16-bitoj" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Versio MS-DOS 32-bitoj" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Versio MS-DOS 16-bitoj" - -msgid "" -"\n" -"MacOS X (unix) version" +"macOS version" msgstr "" "\n" -"Versio Mak OS X (unikso)" +"Versio makOS" msgid "" "\n" -"MacOS X version" +"macOS version w/o darwin feat." msgstr "" "\n" -"Versio Mak OS X" - -msgid "" -"\n" -"MacOS version" -msgstr "" -"\n" -"Versio Mak OS" +"Versio makOS sen ebloj de darwin." msgid "" "\n" @@ -6021,6 +6179,9 @@ msgstr "" msgid "without GUI." msgstr "sen grafika interfaco." +msgid "with GTK3 GUI." +msgstr "kun grafika interfaco GTK3." + msgid "with GTK2-GNOME GUI." msgstr "kun grafika interfaco GTK2-GNOME." @@ -6048,9 +6209,6 @@ msgstr "kun grafika interfaco Carbon." msgid "with Cocoa GUI." msgstr "kun grafika interfaco Cocoa." -msgid "with (classic) GUI." -msgstr "kun (klasika) grafika interfaco." - msgid " Features included (+) or not (-):\n" msgstr " Ebloj inkluzivitaj (+) aŭ ne (-):\n" @@ -6084,6 +6242,9 @@ msgstr " 2-a dosiero gvimrc de uzanto: \"" msgid "3rd user gvimrc file: \"" msgstr " 3-a dosiero gvimrc de uzanto: \"" +msgid " defaults file: \"" +msgstr " dosiero de defaŭltoj: \"" + msgid " system menu file: \"" msgstr " dosiero de sistema menuo: \"" @@ -6134,8 +6295,8 @@ msgid "type :help<Enter> or <F1> for on-line help" msgstr "tajpu :help<Enenklavo> aŭ <F1> por aliri la helpon " # DP: atentu al la spacetoj: ĉiuj ĉenoj devas havi la saman longon -msgid "type :help version7<Enter> for version info" -msgstr "tajpu :help version7<Enenklavo> por informo de versio" +msgid "type :help version8<Enter> for version info" +msgstr "tajpu :help version8<Enenklavo> por informo de versio" msgid "Running in Vi compatible mode" msgstr "Ruliĝas en reĝimo kongrua kun Vi" @@ -6190,13 +6351,6 @@ msgstr "tajpu :help register<Enenklavo> por pliaj informoj " msgid "menu Help->Sponsor/Register for information " msgstr "menuo Helpo->Subteni/Registri por pliaj informoj " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "AVERTO: Trovis Vindozon 95/98/ME" - -# DP: atentu al la spacetoj: ĉiuj ĉenoj devas havi la saman longon -msgid "type :help windows95<Enter> for info on this" -msgstr "tajpu :help windows95<Enenklavo> por pliaj informoj " - msgid "Already only one window" msgstr "Jam nur unu fenestro" @@ -6228,6 +6382,25 @@ msgstr "E446: Neniu dosiernomo sub la kursoro" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Ne eblas trovi dosieron \"%s\" en serĉvojo" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Nevalida ID: %ld (devas esti egala aŭ pli granda ol 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID jam uzata: %ld" + +msgid "List or number required" +msgstr "Listo aŭ nombro bezonata" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Nevalida ID: %ld (devas esti egala aŭ pli granda ol 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID netrovita: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Ne eblis ŝargi bibliotekon %s" @@ -6252,7 +6425,6 @@ msgstr "Kompari per Vim" msgid "Edit with &Vim" msgstr "Redakti per &Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "Redakti per ekzistanta Vim - " @@ -6271,10 +6443,6 @@ msgstr "Serĉvojo estas tro longa!" msgid "--No lines in buffer--" msgstr "--Neniu linio en bufro--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: komando ĉesigita" @@ -6314,7 +6482,7 @@ msgid "E13: File exists (add ! to override)" msgstr "E13: Dosiero ekzistas (aldonu ! por transpasi)" msgid "E472: Command failed" -msgstr "E472: La komando fiaskis" +msgstr "E472: La komando malsukcesis" #, c-format msgid "E234: Unknown fontset: %s" @@ -6331,6 +6499,10 @@ msgstr "E236: La tiparo \"%s\" ne estas egallarĝa" msgid "E473: Internal error" msgstr "E473: Interna eraro" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Interna eraro: %s" + msgid "Interrupted" msgstr "Interrompita" @@ -6344,6 +6516,14 @@ msgstr "E474: Nevalida argumento" msgid "E475: Invalid argument: %s" msgstr "E475: Nevalida argumento: %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: Nevalida valoro de argumento: %s" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Nevalida valoro de argumento %s: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Nevalida esprimo: %s" @@ -6360,7 +6540,11 @@ msgstr "E17: \"%s\" estas dosierujo" #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: Alvoko al biblioteko fiaskis por \"%s()\"" +msgstr "E364: Alvoko al biblioteko malsukcesis por \"%s()\"" + +# AM: fsync: ne traduku (nomo de C-komando) +msgid "E667: Fsync failed" +msgstr "E667: Fsync malsukcesis" #, c-format msgid "E448: Could not load library function %s" @@ -6456,12 +6640,6 @@ msgstr "E484: Ne eblas malfermi dosieron %s" msgid "E485: Can't read file %s" msgstr "E485: Ne eblas legi dosieron %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Neniu skribo de post lasta ŝanĝo (aldonu ! por transpasi)" - -msgid "E37: No write since last change" -msgstr "E37: Neniu skribo de post lasta ŝanĝo" - msgid "E38: Null argument" msgstr "E38: Nula argumento" @@ -6495,7 +6673,7 @@ msgid "E42: No Errors" msgstr "E42: Neniu eraro" msgid "E776: No location list" -msgstr "E776: Neniu listo de loko" +msgstr "E776: Neniu listo de lokoj" msgid "E43: Damaged match string" msgstr "E43: Difekta kongruenda ĉeno" @@ -6514,6 +6692,31 @@ msgstr "E46: Ne eblas ŝanĝi nurlegeblan variablon \"%s\"" msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: Ne eblas agordi variablon en la sabloludejo: \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Ne eblas uzi malplenan ŝlosilon de Vortaro" + +msgid "E715: Dictionary required" +msgstr "E715: Vortaro bezonata" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: indekso de listo ekster limoj: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Tro da argumentoj por funkcio: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Ŝlosilo malekzistas en Vortaro: %s" + +msgid "E714: List required" +msgstr "E714: Listo bezonata" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Argumento de %s devas esti Listo aŭ Vortaro" + msgid "E47: Error while reading errorfile" msgstr "E47: Eraro dum legado de erardosiero" @@ -6571,8 +6774,8 @@ msgstr "E592: 'winwidth' ne rajtas esti malpli ol 'winminwidth'" msgid "E80: Error while writing" msgstr "E80: Eraro dum skribado" -msgid "Zero count" -msgstr "Nul kvantoro" +msgid "E939: Positive count required" +msgstr "E939: Pozitiva kvantoro bezonata" msgid "E81: Using <SID> not in a script context" msgstr "E81: Uzo de <SID> ekster kunteksto de skripto" @@ -6586,16 +6789,16 @@ msgstr "E463: Regiono estas gardita, ne eblas ŝanĝi" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans ne permesas ŝanĝojn en nurlegeblaj dosieroj" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Interna eraro: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: ŝablono uzas pli da memoro ol 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: malplena bufro" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: La bufro %ld ne ekzistas" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Nevalida serĉa ŝablono aŭ disigilo" @@ -6609,6 +6812,13 @@ msgstr "E764: La opcio '%s' ne estas ŝaltita" msgid "E850: Invalid register name" msgstr "E850: Nevalida nomo de reĝistro" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Dosierujo ne trovita en '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Aŭtokomandoj kaŭzis rikiran konduton" + msgid "search hit TOP, continuing at BOTTOM" msgstr "serĉo atingis SUPRON, daŭrigonte al SUBO" @@ -6630,7 +6840,7 @@ msgstr "listo estas ŝlosita" #, c-format msgid "failed to add key '%s' to dictionary" -msgstr "aldono de ŝlosilo '%s' al vortaro fiaskis" +msgstr "aldono de ŝlosilo '%s' al vortaro malsukcesis" #, c-format msgid "index must be int or slice, not %s" @@ -6676,7 +6886,7 @@ msgid "E264: Python: Error initialising I/O objects" msgstr "E264: Pitono: Eraro de pravalorizo de eneligaj objektoj" msgid "failed to change directory" -msgstr "ne povis ŝanĝi dosierujon" +msgstr "malsukcesis ŝanĝi dosierujon" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got %s" @@ -6712,10 +6922,9 @@ msgstr "konstruilo de listo ne akceptas ŝlosilvortajn argumentojn" msgid "list index out of range" msgstr "indekso de listo ekster limoj" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" -msgstr "interna eraro: obteno de vim-a listero %d fiaskis" +msgstr "interna eraro: obteno de vim-a listero %d malsukcesis" msgid "slice step cannot be zero" msgstr "paŝo de sekco ne povas esti nul" @@ -6732,14 +6941,14 @@ msgid "internal error: not enough list items" msgstr "interna eraro: ne sufiĉaj listeroj" msgid "internal error: failed to add item to list" -msgstr "interna eraro: aldono de listero fiaskis" +msgstr "interna eraro: aldono de listero malsukcesis" #, c-format msgid "attempt to assign sequence of size %d to extended slice of size %d" msgstr "provis valorizi sekvencon kun %d eroj al etendita sekco kun %d eroj" msgid "failed to add item to list" -msgstr "aldono de listero fiaskis" +msgstr "aldono de listero malsukcesis" msgid "cannot delete vim.List attributes" msgstr "ne eblas forviŝi atributojn de 'vim.List'" @@ -6755,15 +6964,12 @@ msgstr "sennoma funkcio %s ne ekzistas" msgid "function %s does not exist" msgstr "funkcio %s ne ekzistas" -msgid "function constructor does not accept keyword arguments" -msgstr "konstruilo de funkcio ne akceptas ŝlosilvortajn argumentojn" - #, c-format msgid "failed to run function %s" -msgstr "fiaskis ruli funkcion %s" +msgstr "malsukcesis ruli funkcion %s" msgid "unable to get option value" -msgstr "fiaskis akiri valoron de opcio" +msgstr "malsukcesis akiri valoron de opcio" msgid "internal error: unknown option type" msgstr "interna eraro: nekonata tipo de opcio" @@ -6801,7 +7007,7 @@ msgid "attempt to refer to deleted buffer" msgstr "provo de referenco al forviŝita bufro" msgid "failed to rename buffer" -msgstr "ne povis renomi bufron" +msgstr "malsukcesis renomi bufron" msgid "mark name must be a single character" msgstr "nomo de marko devas esti unuopa signo" @@ -6812,14 +7018,14 @@ msgstr "atendis objekton vim.Buffer, sed ricevis %s" #, c-format msgid "failed to switch to buffer %d" -msgstr "ne povis salti al la bufro %d" +msgstr "salto al la bufro %d malsukcesis" #, c-format msgid "expected vim.Window object, but got %s" msgstr "atendis objekton vim.window, sed ricevis %s" msgid "failed to find window in the current tab page" -msgstr "ne povis trovi vindozon en la nuna langeto" +msgstr "malsukcesis trovi vindozon en la nuna langeto" msgid "did not switch to the specified window" msgstr "ne saltis al la specifita vindozo" @@ -6832,18 +7038,22 @@ msgid "did not switch to the specified tab page" msgstr "ne saltis al la specifita langeto" msgid "failed to run the code" -msgstr "fiaskis ruli la kodon" +msgstr "malsukcesis ruli la kodon" msgid "E858: Eval did not return a valid python object" msgstr "E858: Eval ne revenis kun valida python-objekto" msgid "E859: Failed to convert returned python object to vim value" -msgstr "E859: Konverto de revena python-objekto al vim-valoro fiaskis" +msgstr "E859: Konverto de revena python-objekto al vim-valoro malsukcesis" #, c-format msgid "unable to convert %s to vim dictionary" msgstr "ne povis konverti %s al vim-vortaro" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "ne povis konverti %s al vim-listo" + #, c-format msgid "unable to convert %s to vim structure" msgstr "ne povis konverti %s al vim-strukturo" @@ -6860,7 +7070,7 @@ msgid "" "- append vim.path_hook to sys.path_hooks\n" "- append vim.VIM_SPECIAL_PATH to sys.path\n" msgstr "" -"Fiaskis valorizi sys.path_hooks: sys.path_hooks ne estas listo\n" +"Valorizo de sys.path_hooks malsukcesis: sys.path_hooks ne estas listo\n" "Vi nun devas fari tion:\n" "- postaldoni vim.path_hook al sys.path_hooks\n" "- postaldoni vim.VIM_SPECIAL_PATH al sys.path\n" @@ -6869,5 +7079,49 @@ msgid "" "Failed to set path: sys.path is not a list\n" "You should now append vim.VIM_SPECIAL_PATH to sys.path" msgstr "" -"Ne povis agordi serĉvojon: sys.path ne estas listo\n" +"Agordo de serĉvojo malsukcesis: sys.path ne estas listo\n" "Vi nun devas aldoni vim.VIM_SPECIAL_PATH al sys.path" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Dosierioj de vim-makrooj (*.vim)\t*.vim\n" +"Ĉiuj dosieroj (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "Ĉiuj dosieroj (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Ĉiuj dosieroj (*.*)\t*.*\n" +"Dosieroj C (*.c, *.h)\t*.c;*.h\n" +"Dosieroj C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Fonto VB (*.bas, *.frm)\t.bas;*.frm\n" +"Dosieroj Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Dosierioj de vim-makrooj (*.vim)\t*.vim\n" +"Ĉiuj dosieroj (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "Ĉiuj dosieroj (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Ĉiuj dosieroj (*)\t*\n" +"Dosieroj C (*.c, *.h)\t*.c;*.h\n" +"Dosieroj C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Dosieroj Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/es.po b/src/po/es.po index a3f1cfb9f3..94c8631e7c 100644 --- a/src/po/es.po +++ b/src/po/es.po @@ -1126,7 +1126,7 @@ msgstr "E141: No existe un nombre de archivo para el búfer %ld" #: ex_cmds.c:2940 msgid "E142: File not written: Writing is disabled by 'write' option" msgstr "" -"E142: No se ha escrito el archivo: escritura desactivada por \n" +"E142: No se ha escrito el archivo: escritura desactivada por " "la opción 'write'" #: ex_cmds.c:2970 @@ -2159,7 +2159,7 @@ msgstr "es de solo lectura (añada ! para sobreescribir)" #: fileio.c:3761 msgid "E506: Can't write to backup file (add ! to override)" msgstr "" -"E506: No se pudo escribir en el archivo de recuperación\n" +"E506: No se pudo escribir en el archivo de recuperación " "(añada ! para forzar la orden)" #: fileio.c:3773 @@ -2888,7 +2888,7 @@ msgstr "Tipo de letra de impresión 1: %s\n" #, c-format msgid "Font%ld width is not twice that of font0\n" msgstr "" -"La anchura del tipo de letra de impresión %ld no es el doble de la \n" +"La anchura del tipo de letra de impresión %ld no es el doble de la " "de la tipografía de impresión 0\n" #: gui_x11.c:2205 @@ -3031,7 +3031,7 @@ msgstr "" #: hardcopy.c:2578 msgid "E675: No default font specified for multi-byte printing." msgstr "" -"E675: No se ha definido un tipo de letra predeterminado para impresión\n" +"E675: No se ha definido un tipo de letra predeterminado para impresión " "multi-byte" #: hardcopy.c:2771 @@ -3364,7 +3364,7 @@ msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." msgstr "" -"E263: Lo siento, esta orden está desactivada, no se pudo cargar la \n" +"E263: Lo siento, esta orden está desactivada, no se pudo cargar la " "biblioteca de Python" #: if_python.c:583 @@ -3451,7 +3451,7 @@ msgstr "E265: $_ debe ser una instancia de \"String\"" msgid "" "E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"E266: Lo siento, esta orden está desactivada, no se pudo cargar\n" +"E266: Lo siento, esta orden está desactivada, no se pudo cargar " "la biblioteca de Ruby" #: if_ruby.c:455 @@ -3560,7 +3560,7 @@ msgid "" "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " "$PATH).\n" msgstr "" -"No se pudo conectar a SNiFF+. Verifique el entorno (\"sniffemacs\" debe\n" +"No se pudo conectar a SNiFF+. Verifique el entorno (\"sniffemacs\" debe " "estar en \"$PATH\").\n" #: if_sniff.c:422 @@ -3651,7 +3651,7 @@ msgstr "No se pudo crear la orden de búfer/ventana: el objeto se suprimirá" msgid "" "cannot register callback command: buffer/window is already being deleted" msgstr "" -"No se pudo registrar el orden \"callback\": El búfer o la ventana ya se \n" +"No se pudo registrar el orden \"callback\": El búfer o la ventana ya se " "eliminó" # This should never happen. Famous last word? @@ -3661,27 +3661,27 @@ msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" msgstr "" -"E280: ERROR FATAL DE TCL: ¿¡\"reflist\" dañada!? Por favor, informe de \n" +"E280: ERROR FATAL DE TCL: ¿¡\"reflist\" dañada!? Por favor, informe de " "esto a vim-dev@vim.org" #: if_tcl.c:1570 msgid "cannot register callback command: buffer/window reference not found" msgstr "" -"No se pudo registrar la orden de retorno de llamada: No se pudo encontrar\n" +"No se pudo registrar la orden de retorno de llamada: No se pudo encontrar " "la referencia al búfer o la ventana" #: if_tcl.c:1742 msgid "" "E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E571: Lo siento, esta orden está desactivada pues no se pudo\n" +"E571: Lo siento, esta orden está desactivada pues no se pudo " "cargar la biblioteca de Tcl" #: if_tcl.c:1904 msgid "" "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" msgstr "" -"E281: ERROR DE TCL: ¿¡el código de salida no es \"int\"!? Por favor\n" +"E281: ERROR DE TCL: ¿¡el código de salida no es \"int\"!? Por favor " "informe a vim-dev@vim.org" #: if_tcl.c:1909 @@ -3729,7 +3729,7 @@ msgstr "Basura después de la opción" #: main.c:146 msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" msgstr "" -"Demasiados argumentos tales como: \"+orden\", \"-c orden\" \n" +"Demasiados argumentos tales como: \"+orden\", \"-c orden\" " "o \"--cmd orden\"" #: main.c:148 @@ -3836,7 +3836,7 @@ msgid "" "Where case is ignored prepend / to make flag upper case" msgstr "" "\n" -"Cuando mayúscula y minúscula son ignoradas añada \"/\" para \n" +"Cuando mayúscula y minúscula son ignoradas añada \"/\" para " "cambiar la marca (\"flag\") a mayúscula" #: main.c:3061 @@ -3872,8 +3872,8 @@ msgstr "-g\t\t\tEjecutar usando el GUI (como \"gvim\")" #: main.c:3072 msgid "-f or --nofork\tForeground: Don't fork when starting GUI" msgstr "" -"-f o --nofork\tPrimer plano: No separarse (\"fork\") cuando se\n" -" \tinicia la interfaz gráfica (GUI)" +"-f o --nofork\tPrimer plano: No separarse (\"fork\") cuando se " +"inicia la interfaz gráfica (GUI)" #: main.c:3074 msgid "-v\t\t\tVi mode (like \"vi\")" @@ -4020,26 +4020,26 @@ msgstr "-c <orden>\t\tEjecutar <orden> después de cargar el primer archivo" #: main.c:3127 msgid "-S <session>\t\tSource file <session> after loading the first file" msgstr "" -"-S <sesión>\t\tEjecutar las órdenes del archivo <sesión> después\n" -" \t\tde cargar el primer archivo" +"-S <sesión>\t\tEjecutar las órdenes del archivo <sesión> después " +"de cargar el primer archivo" #: main.c:3128 msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" msgstr "" -"-s <scriptin>\tLeer las órdenes en modo Normal del archivo\n" -" \t\"módulo de expansión\" de entrada>" +"-s <scriptin>\tLeer las órdenes en modo Normal del archivo " +"\"módulo de expansión\" de entrada>" #: main.c:3129 msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" msgstr "" -"-w <scriptout>\tAñadir todas las órdenes escritas al archivo\n" -" \t\"módulo de expansión\" de salida" +"-w <scriptout>\tAñadir todas las órdenes escritas al archivo " +"\"módulo de expansión\" de salida" #: main.c:3130 msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" msgstr "" -"-W <scriptout>\tGrabar todas las órdenes escritas al archivo\n" -" \t\"módulo de expansión\" de salida" +"-W <scriptout>\tGrabar todas las órdenes escritas al archivo " +"\"módulo de expansión\" de salida" #: main.c:3132 msgid "-x\t\t\tEdit encrypted files" @@ -4061,22 +4061,22 @@ msgstr "" #: main.c:3142 msgid "--remote-silent <files> Same, don't complain if there is no server" msgstr "" -"--remote-silent \"archivos\"\tLo mismo pero no se queja si no existe un\n" -" \tservidor disponible" +"--remote-silent \"archivos\"\tLo mismo pero no se queja si no existe un " +"servidor disponible" #: main.c:3143 msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" msgstr "" -"--remote-wait \"archivos\"\tComo --remote pero espera a que los archivos\n" -" \tterminen de editarse" +"--remote-wait \"archivos\"\tComo --remote pero espera a que los archivos " +"terminen de editarse" #: main.c:3144 msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent \"archivos\"\tLo mismo pero no se queja si no hay un\n" -" \tservidor disponible" +"--remote-wait-silent \"archivos\"\tLo mismo pero no se queja si no hay un " +"servidor disponible" #: main.c:3146 msgid "" @@ -4173,19 +4173,19 @@ msgstr "-foreground <color>\tUsa <color> para el texto normal (también: -fg)" #: main.c:3182 main.c:3202 msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" msgstr "" -"-font <tipo>\t\tUse <tipo de letra de impresión> para el texto normal\n" +"-font <tipo>\t\tUse <tipo de letra de impresión> para el texto normal " "(también: -fn)" #: main.c:3183 msgid "-boldfont <font>\tUse <font> for bold text" msgstr "" -"-boldfont <tipo>\tUsa <tipo de letra de impresión> para texto en\n" +"-boldfont <tipo>\tUsa <tipo de letra de impresión> para texto en " "negrita" #: main.c:3184 msgid "-italicfont <font>\tUse <font> for italic text" msgstr "" -"-italicfont <tipo>\tUse <tipo de letra de impresión> para texto\n" +"-italicfont <tipo>\tUse <tipo de letra de impresión> para texto " "en cursiva" #: main.c:3185 main.c:3203 @@ -4200,8 +4200,8 @@ msgstr "-borderwidth <ancho>\tUsa un ancho de borde de <ancho> (también: -bw)" #: main.c:3187 msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" msgstr "" -"-scrollbarwidth <ancho>\tUsa una barra de desplazamiento de ancho <ancho>\n" -" \t(también: -sw)" +"-scrollbarwidth <ancho>\tUsa una barra de desplazamiento de ancho <ancho> " +"(también: -sw)" #: main.c:3189 msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" @@ -4280,7 +4280,7 @@ msgstr ": Falló el envío.\n" #: main.c:3578 msgid ": Send failed. Trying to execute locally\n" msgstr "" -": Falló el inicio de sesión remota (\"send\"). Intentado una\n" +": Falló el inicio de sesión remota (\"send\"). Intentado una " "ejecución local\n" #: main.c:3616 main.c:3637 @@ -4388,7 +4388,7 @@ msgstr "E286: Falló la apertura del método de entrada" #: mbyte.c:5175 msgid "E287: Warning: Could not set destroy callback to IM" msgstr "" -"E287: Advertencia: No pude crear una llamada de retorno\n" +"E287: Advertencia: No pude crear una llamada de retorno " "de destrucción al IM" #: mbyte.c:5181 @@ -4406,7 +4406,7 @@ msgstr "E290: El estilo \"sobre el punto\" requiere del uso de un \"fontset\"" #: mbyte.c:5352 msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" msgstr "" -"E291: Su versión de GTK+ es anterior a 1.2.3. Área de estado\n" +"E291: Su versión de GTK+ es anterior a 1.2.3. Área de estado " "desactivada" #: mbyte.c:5663 @@ -4464,7 +4464,7 @@ msgstr "E302: No pude cambiar el nombre del archivo de intercambio" #, c-format msgid "E303: Unable to open swap file for \"%s\", recovery impossible" msgstr "" -"E303: Incapaz de abrir el archivo de intercambio para %s,\n" +"E303: Incapaz de abrir el archivo de intercambio para %s, " "recuperación imposible" #: memline.c:703 @@ -4582,7 +4582,7 @@ msgstr "??? desde aquí hasta ???FIN las líneas pueden estar desordenadas" #: memline.c:1286 msgid "??? from here until ???END lines may have been inserted/deleted" msgstr "" -"??? desde aquí hasta ???FIN las líneas pueden haber sido\n" +"??? desde aquí hasta ???FIN las líneas pueden haber sido " "insertadas/borradas" #: memline.c:1306 @@ -4597,7 +4597,7 @@ msgstr "E311: Recuperación interrumpida" msgid "" "E312: Errors detected while recovering; look for lines starting with ???" msgstr "" -"E312: Se han detectado errores al recuperar; busque líneas que\n" +"E312: Se han detectado errores al recuperar; busque líneas que " "empiecen con ???" #: memline.c:1340 @@ -4939,7 +4939,8 @@ msgstr "" "&Abrir para lectura únicamente\n" "&Editar de todas formas\n" "&Recuperar\n" -"&Borrar&Salir\n" +"&Borrar\n" +"&Salir\n" "&Abortar" #: memline.c:4264 @@ -5240,7 +5241,7 @@ msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " "followed by '%s'." msgstr "" -"E343: Ruta no válida: '**[número]' debe estar al final de la ruta\n" +"E343: Ruta no válida: '**[número]' debe estar al final de la ruta " "o seguido de %s." #: misc2.c:5585 @@ -5786,14 +5787,14 @@ msgstr "Imprimiendo %s" #, c-format msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "" -"E244: El nombre del conjunto de caracteres \"%s\" no es válido en el\n" +"E244: El nombre del conjunto de caracteres \"%s\" no es válido en el " "nombre del tipo de letra de impresión \"%s\"" #: os_mswin.c:3471 #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "" -"E245: Carácter '%c' ilegal en el nombre del tipo de letra de\n" +"E245: Carácter '%c' ilegal en el nombre del tipo de letra de " "impresión %s" #: os_unix.c:1065 @@ -6382,7 +6383,7 @@ msgstr "E756: La corrección ortográfica está desactivada" #, c-format msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" msgstr "" -"Advertencia: No se pudo hallar la lista de palabras \"%s.%s.spl\" \n" +"Advertencia: No se pudo hallar la lista de palabras \"%s.%s.spl\" " "or \"%s.ascii.spl\"" #: spell.c:2776 @@ -6448,8 +6449,7 @@ msgid "" "%d" msgstr "" "Definir COMPOUNDFORBIDFLAG después de un elemento PFX puede dar resultados " -"erróneos\n" -"en %s línea %d" +"erróneos en %s línea %d" #: spell.c:5533 #, c-format @@ -6458,8 +6458,7 @@ msgid "" "%d" msgstr "" "Definir COMPOUNDPERMITFLAG después de un ítem PFX puede dar resultados " -"erróneos\n" -"en %s línea %d" +"erróneos en %s línea %d" #: spell.c:5554 #, c-format @@ -6490,7 +6489,7 @@ msgstr "Valor equivocado de CHECKCOMPOUNDPATTERN en %s línea %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" msgstr "" -"Marca de combinación diferente en el bloque de afijos continuo\n" +"Marca de combinación diferente en el bloque de afijos continuo " "en %s línea %d: %s" #: spell.c:5688 @@ -6505,8 +6504,7 @@ msgid "" "line %d: %s" msgstr "" "Afijo usado también para BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " -"en\n" -"%s línea %d: %s" +"en %s línea %d: %s" #: spell.c:5734 #, c-format @@ -6937,7 +6935,7 @@ msgstr "E402: Basura después del patrón: %s" #: syntax.c:5537 msgid "E403: syntax sync: line continuations pattern specified twice" msgstr "" -"E403: Sincronización de sintaxis: Se especificó dos veces un\n" +"E403: Sincronización de sintaxis: Se especificó dos veces un " "patrón de continuación de línea" #: syntax.c:5594 @@ -7646,8 +7644,8 @@ msgid "type :help<Enter> or <F1> for on-line help" msgstr "escriba «:help<Intro>» o <F1> para obtener ayuda " #: version.c:1706 -msgid "type :help version7<Enter> for version info" -msgstr "escriba «:help version7<Intro>» para información de la versión" +msgid "type :help version8<Enter> for version info" +msgstr "escriba «:help version8<Intro>» para información de la versión" #: version.c:1709 msgid "Running in Vi compatible mode" @@ -7742,7 +7740,7 @@ msgstr "E813: No se puede cerrar la ventana de autocmd" #: window.c:2125 msgid "E814: Cannot close window, only autocmd window would remain" msgstr "" -"E814: No se pudo cerrar la última ventana, solo quedará\n" +"E814: No se pudo cerrar la última ventana, solo quedará " "la ventana de autocmd" #: window.c:3188 @@ -7770,7 +7768,7 @@ msgstr "Esta orden está desactivada, no se pudo cargar la biblioteca de Perl" #: if_perl.xs:726 msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" msgstr "" -"E299: No se permite la evaluación de código Perl en la caja de\n" +"E299: No se permite la evaluación de código Perl en la caja de " "arena sin el uso del módulo \"Safe\"" #: GvimExt/gvimext.cpp:587 @@ -7845,7 +7843,7 @@ msgstr "" #: globals.h:1380 msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" msgstr "" -"E12: Orden no permitida desde exrc/vimrc en el directorio \n" +"E12: Orden no permitida desde exrc/vimrc en el directorio " "en uso o al buscar etiquetas" #: globals.h:1382 diff --git a/src/po/fi.po b/src/po/fi.po index 4a7dcaa4f5..73136d9d01 100644 --- a/src/po/fi.po +++ b/src/po/fi.po @@ -1,45 +1,45 @@ # Finnish translation for Vim. # Copyright (C) 2003-2006 Free Software Foundation, Inc. -# 2007-2010, Flammie Pirinen <flammie@iki.fi> +# 2007-2018, Flammie Pirinen <flammie@iki.fi> # -# Vimin kyttjt on nrttej. Sanasto on jargonia :-p -# -# Lhinn latin-1:t, sill vim pit portata ilmeisen obskuureille -# alustoille. Mys: pluralit puuttuu, ohjelman kyttliittymn fontti -# tasavlinen, tila rajattu, jne. jne., luovia ratkaisuja edess. +# Jargonia ei ole yritetty suotta kotoperäistää missä teknisempi lainasanasto +# tulee paremmin kyseeseen. # # Sanastosta: -# Fold on sellainen moderneissa ohjelmointi-IDE:iss oleva toiminto, jolla -# lohko koodia esim. funktio piilotetaan nkymst: suom. taitos alkup. +# * Fold on sellainen moderneissa ohjelmointi-IDE:issä oleva toiminto, jolla +# lohko koodia esim. funktio piilotetaan näkymästä: suom. taitos alkup. # analogian mukaan -# source v. lataa tiedoston, kuten bash-komento source (tai .) +# * source, v. lataa tiedoston, kuten bash-komento source (tai .) +# * dictionary (dict) on vaihtelevasti sanakirja tai tietorakenne # msgid "" msgstr "" "Project-Id-Version: Vim 7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-09 02:00+0300\n" -"PO-Revision-Date: 2010-08-09 02:35+0300\n" -"Last-Translator: Flammie Pirinen <flammie@iki.fi>\n" +"POT-Creation-Date: 2017-10-04 17:59+0200\n" +"PO-Revision-Date: 2017-10-05 11:17+0200\n" +"Last-Translator: Flammie A Pirinen <flammie@iki.fi>\n" "Language-Team: Finnish <laatu@lokalisointi.org>\n" +"Language: fi\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "E831: bf_key_init() called with empty password" -msgstr "E831: bf_key_init() tyhjll salasanalla" +msgstr "E831: bf_key_init() tyhjällä salasanalla" msgid "E820: sizeof(uint32_t) != 4" msgstr "E820: sizeof(uint32_t) != 4" msgid "E817: Blowfish big/little endian use wrong" -msgstr "E817: Blowfishin tavujrjestys vr" +msgstr "E817: Blowfishin tavujärjestys väärä" msgid "E818: sha256 test failed" -msgstr "E818: sha256-testi eponnistui failed" +msgstr "E818: sha256-testi epäonnistui failed" msgid "E819: Blowfish test failed" -msgstr "E819: Blowfish-testi eponnistui" +msgstr "E819: Blowfish-testi epäonnistui" msgid "[Location List]" msgstr "[Sijaintiluettelo]" @@ -47,11 +47,20 @@ msgstr "[Sijaintiluettelo]" msgid "[Quickfix List]" msgstr "[Pikakorjausluettelo]" +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Autocommands lopetti komennon" + msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: Mitn puskuria ei voitu varata, lopetetaan..." +msgstr "E82: Mitään puskuria ei voitu varata, lopetetaan..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: Puskuria ei voitu varata, kytetn toista..." +msgstr "E83: Puskuria ei voitu varata, käytetään toista..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: Puskuria ei voi rekisteröidä" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Ei voida poistaa puskuria joka on käytössä" msgid "E515: No buffers were unloaded" msgstr "E515: Puskureita ei vapautettu" @@ -83,46 +92,54 @@ msgstr "1 puskuri pyyhitty" msgid "%d buffers wiped out" msgstr "%d puskuria pyyhitty" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Ei voi vapauttaa viimeistä puskuria" + msgid "E84: No modified buffer found" msgstr "E84: Ei muokattuja puskureita" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Luetteloitua puskuria ei ole" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Puskuria %ld ei ole" - msgid "E87: Cannot go beyond last buffer" -msgstr "E87: Viimeisen puskurin ohi ei voi edet" +msgstr "E87: Viimeisen puskurin ohi ei voi edetä" msgid "E88: Cannot go before first buffer" -msgstr "E88: Ensimmisen puskurin ohi ei voi edet" +msgstr "E88: Ensimmäisen puskurin ohi ei voi edetä" #, c-format msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" -"E89: Puskurin %ld muutoksia ei ole tallennettu (lis komentoon ! " +"E89: Puskurin %ld muutoksia ei ole tallennettu (lisää komentoon ! " "ohittaaksesi)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Ei voi vapauttaa viimeist puskuria" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Komento on kesken (lisää loppuun ! lopettaaksesi komennon)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "" +"E37: Viimeisen muutoksen jälkeen ei ole kirjoitettu (lisää ! ohittaaksesi)" + +msgid "E948: Job still running" +msgstr "E948: Komento on vielä käynnissä" + +msgid "E37: No write since last change" +msgstr "E37: Viimeisimmän muutoksen jälkeen ei ole kirjoitettu mitään" msgid "W14: Warning: List of file names overflow" msgstr "W14: Varoitus: Tiedostonimiluettelon ylivuoto" #, c-format msgid "E92: Buffer %ld not found" -msgstr "E92: Puskuria %ld ei lydy" +msgstr "E92: Puskuria %ld ei löydy" #, c-format msgid "E93: More than one match for %s" -msgstr "E93: %s tsm useampaan kuin yhteen puskuriin" +msgstr "E93: %s täsmää useampaan kuin yhteen puskuriin" #, c-format msgid "E94: No matching buffer for %s" -msgstr "E94: %s ei tsm yhteenkn puskuriin" +msgstr "E94: %s ei täsmää yhteenkään puskuriin" #, c-format msgid "line %ld" @@ -141,7 +158,10 @@ msgid "[New file]" msgstr "[Uusi tiedosto]" msgid "[Read errors]" -msgstr "[Lukuvirheit]" +msgstr "[Lukuvirheitä]" + +msgid "[RO]" +msgstr "[Luku]" msgid "[readonly]" msgstr "[kirjoitussuojattu]" @@ -152,16 +172,15 @@ msgstr "1 rivi --%d %%--" #, c-format msgid "%ld lines --%d%%--" -msgstr "%ld rivi --%d %%--" +msgstr "%ld riviä --%d %%--" #, c-format msgid "line %ld of %ld --%d%%-- col " msgstr "rivi %ld/%ld --%d %%-- sarake " msgid "[No Name]" -msgstr "[Nimetn]" +msgstr "[Nimetön]" -#. must be a help buffer msgid "help" msgstr "ohje" @@ -172,7 +191,7 @@ msgid "[Preview]" msgstr "[Esikatselu]" # sijainti tiedostossa -indikaattoreja: -# 4 merkki sais riitt +# 4 merkkiä sais riittää msgid "All" msgstr "Kaik" @@ -182,7 +201,6 @@ msgstr "Loppu" msgid "Top" msgstr "Alku" -#, c-format msgid "" "\n" "# Buffer list:\n" @@ -190,6 +208,9 @@ msgstr "" "\n" "# Puskuriluettelo:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Ei voi kirjoittaa, buftype asetettu" + msgid "[Scratch]" msgstr "[Raapust]" @@ -208,15 +229,108 @@ msgstr "Merkit kohteelle %s:" msgid " line=%ld id=%d name=%s" msgstr " rivi=%ld id=%d nimi=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Ei voi yhdistää porttiin" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() funktiossa channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() funktiossa channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: komennolla ei-merkkijonoargumentti" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: viimeisen expr/call-argumentin pitää olla numero" + +msgid "E904: third argument for call must be a list" +msgstr "E904: kolmannen argumentin pitää olla lista" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: Ei voi diffata enemp kuin %ld puskuria" +msgid "E905: received unknown command: %s" +msgstr "E905: tuntematon komento: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): ei voi kirjoittaa ilman yhteyttä" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): kirjoitus epäonnistui" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Ei voitu käyttää callbackia %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: ei voida käyttää funktioita ch_evalexpr(), ch_sendexpr() raa'an tai nl-" +"kanavan kanssa" + +msgid "E906: not an open channel" +msgstr "E906: ei ole avoin kanava" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io-tiedostolla pitää olla _name asetettu" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io-puskurilla pitää olla in_buf tai in_name asetettu" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: puskuria ei voi ladata: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Tiedoston salaus on tuntematon" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Varoitus: Käytetään heikkoa salausmenetelmää, ks. :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Anna salausavain: " + +msgid "Enter same key again: " +msgstr "Anna sama avain uudestaan: " + +msgid "Keys don't match!" +msgstr "Avaimet eivät täsmää!" + +msgid "[crypted]" +msgstr "[salattu]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Kaksi samaa avainta sanakirjassa: %s" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Sanakirjasta puuttuu pilkku: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Sanakirjan lopusta puuttuu }: %s" + +msgid "extend() argument" +msgstr "extend()-argumentti" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Avain on jo olemassa: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: Ei voi diffata enempää kuin %ld puskuria" msgid "E810: Cannot read or write temp files" -msgstr "E810: Ei voi lukea tai kirjoittaa vliaikaistiedostoja" +msgstr "E810: Ei voi lukea tai kirjoittaa väliaikaistiedostoja" msgid "E97: Cannot create diffs" -msgstr "E97: Ei voi luoda diffej" +msgstr "E97: Ei voi luoda diffejä" msgid "Patch file" msgstr "Patch-tiedosto" @@ -228,20 +342,20 @@ msgid "E98: Cannot read diff output" msgstr "E98: Ei voi lukea diffin tulostetta" msgid "E99: Current buffer is not in diff mode" -msgstr "E99: Tm puskuri ei ole diff-tilassa" +msgstr "E99: Tämä puskuri ei ole diff-tilassa" msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: Yksikn muu diff-tilan puskurit ei ole muokattavissa" +msgstr "E793: Yksikään muu diff-tilan puskurit ei ole muokattavissa" msgid "E100: No other buffer in diff mode" -msgstr "E100: Yksikn muu puskuri ei ole diff-tilassa" +msgstr "E100: Yksikään muu puskuri ei ole diff-tilassa" msgid "E101: More than two buffers in diff mode, don't know which one to use" -msgstr "E101: Monta puskuria on diff-tilassa, kytettvn valinta ei onnistu" +msgstr "E101: Monta puskuria on diff-tilassa, käytettävän valinta ei onnistu" #, c-format msgid "E102: Can't find buffer \"%s\"" -msgstr "E102: Puskuria %s ei lydy" +msgstr "E102: Puskuria %s ei löydy" #, c-format msgid "E103: Buffer \"%s\" is not in diff mode" @@ -251,75 +365,80 @@ msgid "E787: Buffer changed unexpectedly" msgstr "E787: Puskuri vaihtui odottamatta" msgid "E104: Escape not allowed in digraph" -msgstr "E104: Escapea ei voi kytt digraafissa" +msgstr "E104: Escapea ei voi käyttää digraafissa" msgid "E544: Keymap file not found" -msgstr "E544: Nppinkarttaa ei lydy" +msgstr "E544: Näppäinkarttaa ei löydy" msgid "E105: Using :loadkeymap not in a sourced file" -msgstr "E105: Kytetn :loadkeymapia ladatun tiedoston ulkopuolella" +msgstr "E105: Käytetään :loadkeymapia ladatun tiedoston ulkopuolella" msgid "E791: Empty keymap entry" -msgstr "E791: Tyhj keymap-kentt" +msgstr "E791: Tyhjä keymap-kenttä" msgid " Keyword completion (^N^P)" -msgstr " Avainsanatydennys (^N^P)" +msgstr " Avainsanatäydennys (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X-tila (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgid " Whole line completion (^L^N^P)" -msgstr " Tysrivitydennys (^L^N^P)" +msgstr " Täysrivitäydennys (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr " Tiedostonimitydennys (^F^N^P)" +msgstr " Tiedostonimitäydennys (^F^N^P)" msgid " Tag completion (^]^N^P)" -msgstr " Tgitydennys (^]^N^P)" +msgstr " Tägitäydennys (^]^N^P)" msgid " Path pattern completion (^N^P)" -msgstr " Polkukuviotydennys (^N^P)" +msgstr " Polkukuviotäydennys (^N^P)" msgid " Definition completion (^D^N^P)" -msgstr " Mritelmtydennys (^D^N^P)" +msgstr " Määritelmätäydennys (^D^N^P)" msgid " Dictionary completion (^K^N^P)" -msgstr " Sanakirjatydennys (^K^N^P)" +msgstr " Sanakirjatäydennys (^K^N^P)" msgid " Thesaurus completion (^T^N^P)" -msgstr " Thesaurus-tydennys (^T^N^P)" +msgstr " Thesaurus-täydennys (^T^N^P)" msgid " Command-line completion (^V^N^P)" -msgstr " Komentorivitydennys (^V^N^P)" +msgstr " Komentorivitäydennys (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " Kyttjn mrittelem tydennys (^U^N^P)" +msgstr " Käyttäjän määrittelemä täydennys (^U^N^P)" msgid " Omni completion (^O^N^P)" -msgstr " Omnitydennys (^O^N^P)" +msgstr " Omnitäydennys (^O^N^P)" msgid " Spelling suggestion (s^N^P)" msgstr " Oikaisulukuehdotus (s^N^P)" msgid " Keyword Local completion (^N^P)" -msgstr " Avainsanan paikallinen tydennys (^N^P)" +msgstr " Avainsanan paikallinen täydennys (^N^P)" msgid "Hit end of paragraph" msgstr "Kappaleen loppu tuli vastaan" +msgid "E839: Completion function changed window" +msgstr "E839: Täydennys vaihtoi ikkunaa" + +msgid "E840: Completion function deleted text" +msgstr "E840: Täydennys poisti tekstiä" + msgid "'dictionary' option is empty" -msgstr "dictionary-asetus on tyhj" +msgstr "dictionary-asetus on tyhjä" msgid "'thesaurus' option is empty" -msgstr "thesaurus-asetus on tyhj" +msgstr "thesaurus-asetus on tyhjä" #, c-format msgid "Scanning dictionary: %s" msgstr "Luetaan sanakirjaa: %s" msgid " (insert) Scroll (^E/^Y)" -msgstr " (sytt) Vieritys (^E/^Y)" +msgstr " (syöttö) Vieritys (^E/^Y)" msgid " (replace) Scroll (^E/^Y)" msgstr " (korvaus) Vieritys (^E/^Y)" @@ -329,124 +448,82 @@ msgid "Scanning: %s" msgstr "Luetaan: %s" msgid "Scanning tags." -msgstr "Luetaan tgej." +msgstr "Luetaan tägejä." + +msgid "match in file" +msgstr "täsmäys tiedostossa" msgid " Adding" -msgstr " Listn" +msgstr " Lisätään" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Haetaan..." msgid "Back at original" -msgstr "Takaisin lhtpisteess" +msgstr "Takaisin lähtöpisteessä" msgid "Word from other line" -msgstr "Sana toisella rivill" +msgstr "Sana toisella rivillä" msgid "The only match" -msgstr "Ainoa tsmys" +msgstr "Ainoa täsmäys" #, c-format msgid "match %d of %d" -msgstr "tsmys %d/%d" +msgstr "täsmäys %d/%d" #, c-format msgid "match %d" -msgstr "tsmys %d" +msgstr "täsmäys %d" msgid "E18: Unexpected characters in :let" -msgstr "E18: Odottamattomia merkkej komennossa :let" - -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: Indeksi %ld luettelon rajojen ulkopuolella" +msgstr "E18: Odottamattomia merkkejä komennossa :let" #, c-format msgid "E121: Undefined variable: %s" -msgstr "E121: Mrittelemtn muuttuja: %s" +msgstr "E121: Määrittelemätön muuttuja: %s" msgid "E111: Missing ']'" msgstr "E111: ] puuttuu" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Argumentin %s pit olla lista" - -# datarakenteita -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Argumentin %s pit olla lista tai sanakirja" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Sanakirjassa ei voi olla tyhji avaimia" - -msgid "E714: List required" -msgstr "E714: Lista tarvitaan" - -msgid "E715: Dictionary required" -msgstr "E715: Sanakirja tarvitaan" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Liikaa argumentteja funktiolle: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Avainta %s ei ole sanakirjassa" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Funktio %s on jo olemassa, lis ! korvataksesi" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Sanakirja-alkio on jo olemassa" - -msgid "E718: Funcref required" -msgstr "E718: Funcref tarvitaan" - msgid "E719: Cannot use [:] with a Dictionary" -msgstr "E719: Sanakirjassa ei voi kytt merkint [:]" +msgstr "E719: Sanakirjassa ei voi käyttää merkintää [:]" #, c-format msgid "E734: Wrong variable type for %s=" -msgstr "E734: Vr muuttujatyyppi muuttujalle %s=" - -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Tuntematon funktio: %s" +msgstr "E734: Väärä muuttujatyyppi muuttujalle %s=" #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Virheellinen muuttujanimi: %s" +msgid "E806: using Float as a String" +msgstr "E806: Float ei käy merkkijonosta" + msgid "E687: Less targets than List items" -msgstr "E687: Kohteita on vhemmn kuin listan alkioita" +msgstr "E687: Kohteita on vähemmän kuin listan alkioita" msgid "E688: More targets than List items" -msgstr "E688: Kohteita on enemmn kuin listan alkioita" +msgstr "E688: Kohteita on enemmän kuin listan alkioita" msgid "Double ; in list of variables" -msgstr "Kaksi ;:tt listan muuttujissa" +msgstr "Kaksi ;:ttä listan muuttujissa" #, c-format msgid "E738: Can't list variables for %s" msgstr "E738: Kohteen %s muuttujia ei voi listata" msgid "E689: Can only index a List or Dictionary" -msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksej" +msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksejä" msgid "E708: [:] must come last" -msgstr "E708: [:]:n pit olla viimeisen" +msgstr "E708: [:]:n pitää olla viimeisenä" msgid "E709: [:] requires a List value" msgstr "E709: [:] toimii vain listalla" msgid "E710: List value has more items than target" -msgstr "E710: Listalla on enemmn alkioita kuin kohteella" +msgstr "E710: Listalla on enemmän alkioita kuin kohteella" msgid "E711: List value has not enough items" msgstr "E711: Listalla ei ole tarpeeksi alkioita" @@ -454,19 +531,19 @@ msgstr "E711: Listalla ei ole tarpeeksi alkioita" msgid "E690: Missing \"in\" after :for" msgstr "E690: :for-kommenolta puuttuu in" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Sulkeita puuttuu: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Muuttujaa %s ei ole" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Muuttujaa %s ei voi lukita tai avata" + msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: muuttujassa liian monta tasoa lukituksen ksittelyyn" +msgstr "E743: muuttujassa liian monta tasoa lukituksen käsittelyyn" msgid "E109: Missing ':' after '?'" -msgstr "E109: ?:n jlkeen puuttuu :" +msgstr "E109: ?:n jälkeen puuttuu :" msgid "E691: Can only compare List with List" msgstr "E691: Listaa voi verrata vain listaan" @@ -480,20 +557,20 @@ msgstr "E735: Sanakirjaa voi verrata vain sanakirjaan" msgid "E736: Invalid operation for Dictionary" msgstr "E736: Virheellinen toiminto sanakirjalle" -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Funcrefi voi verrata vain funcrefiin" - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Virheellinen toiminto funcrefille" msgid "E804: Cannot use '%' with Float" -msgstr "E804: Ei voi kytt '%':a Floatin kanssa" +msgstr "E804: Ei voi käyttää '%':a Floatin kanssa" msgid "E110: Missing ')'" msgstr "E110: ) puuttuu" msgid "E695: Cannot index a Funcref" -msgstr "E695: Funcrefi ei voi indeksoida" +msgstr "E695: Funcrefiä ei voi indeksoida" + +msgid "E909: Cannot index a special variable" +msgstr "E909: erikoismuuttujaa ei voi indeksoida" #, c-format msgid "E112: Option name missing: %s" @@ -511,86 +588,140 @@ msgstr "E114: Puuttuva lainausmerkki: %s" msgid "E115: Missing quote: %s" msgstr "E115: Puuttuva lainausmerkki: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Listasta puuttuu pilkku: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Ei tarpeeksi muistia viitteiden asettamista varten, roskiekeruu peruttiin." -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Listan lopusta puuttuu ]: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: muuttuja on upotettu liian syvälle näytettäväksi" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float ei käy Numberista" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Kaksi samaa avainta sanakirjassa: %s" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref ei käy Numberista" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Sanakirjasta puuttuu pilkku: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Lista ei käy Numberista" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Sanakirjan lopusta puuttuu }: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Sanakirja ei käy Numberista" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: muuttuja on upotettu liian syvlle nytettvksi" +msgid "E910: Using a Job as a Number" +msgstr "E910: Job ei käy Numberista" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel ei käy Numberista" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref ei käy Floatista" + +msgid "E892: Using a String as a Float" +msgstr "E892: String ei käy Floatista" + +msgid "E893: Using a List as a Float" +msgstr "E893: Lista ei käy Floatista" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Sanakirja ei käy Floatista" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Käytettiin erikoisarvoa Floattina" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job ei käy Floatista" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Käytettiin Channelia Floattina" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref ei käy merkkijonosta" + +msgid "E730: using List as a String" +msgstr "E730: Lista ei käy merkkijonosta" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Sanakirja ei käy merkkijonosta" + +msgid "E908: using an invalid value as a String" +msgstr "E908: huono arvo merkkijonolle" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Liikaa argumentteja funktiolle %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Muuttujaa %s ei voi poistaa" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Vri argumentteja funktiolle %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Funcrefin muuttujanimen pitää alkaa suuraakkosella: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Tuntematon funktio: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Muuttujanimi on sama kuin olemassaolevan funktion: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Liikaa argumentteja funktiolle %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Arvo on lukittu: %s" + +msgid "Unknown" +msgstr "Tuntematon" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> skriptin ulkopuolella: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Ei voi muuttaa muuttujan %s arvoa" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: muuttuja on upotettu liian syvälle kopioitavaksi" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# globaalit muuttujat:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tViimeksi asetettu kohteesta " + +msgid "map() argument" +msgstr "map()-argumentti" + +msgid "filter() argument" +msgstr "filter()-argumentti" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: dict-funktio ilman sanakirjaa: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Argumentin %s pitää olla lista" + +msgid "E928: String required" +msgstr "E928: Merkkijono puuttuu" msgid "E808: Number or Float required" msgstr "E808: Number tai Float vaaditaan" -msgid "E699: Too many arguments" -msgstr "E699: Liikaa argumentteja" +msgid "add() argument" +msgstr "add()-argumentti" msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() toimii vain sytttilassa" +msgstr "E785: complete() toimii vain syöttötilassa" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. msgid "&Ok" msgstr "&Ok" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Avain on jo olemassa: %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld rivi: " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Tuntematon funktio: %s" +msgid "E922: expected a dict" +msgstr "E922: odotettiin dictiä" + +# datarakenteita +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: toisen function()-argumentin pitää olla lista tai sanakirja" + msgid "" "&OK\n" "&Cancel" @@ -601,185 +732,90 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "inputrestore() suoritettu useammin kuin inputsave()" +msgid "insert() argument" +msgstr "insert()-argumentti" + msgid "E786: Range not allowed" -msgstr "E786: Aluetta ei voi kytt" +msgstr "E786: Aluetta ei voi käyttää" + +msgid "E916: not a valid job" +msgstr "E916: ei ole job" msgid "E701: Invalid type for len()" msgstr "E701: Virheellinen tyyppi funktiolle len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID on varattu kohteelle \":match\": %ld" + msgid "E726: Stride is zero" msgstr "E726: Stride on nolla" msgid "E727: Start past end" -msgstr "E727: Alku on lopun jlkeen" +msgstr "E727: Alku on lopun jälkeen" msgid "<empty>" -msgstr "<tyhj>" +msgstr "<tyhjä>" -msgid "E240: No connection to Vim server" -msgstr "E240: Ei yhteytt vim-palvelimeen" +msgid "E240: No connection to the X server" +msgstr "E240: Ei yhteyttä X-palvelimeen" #, c-format msgid "E241: Unable to send to %s" -msgstr "E241: Kohteeseen %s lhettminen ei onnistunut" +msgstr "E241: Kohteeseen %s lähettäminen ei onnistunut" msgid "E277: Unable to read a server reply" msgstr "E277: Palvelimen vastauksen lukeminen ei onnistunut" -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Liikaa symbolisia linkkej (mahdollinen sykli)" - -msgid "E258: Unable to send to client" -msgstr "E258: Asiakkaalle lhetys ei onnistunut" - -msgid "E702: Sort compare function failed" -msgstr "E702: Lajittelun vertausfunktio ei onnistunut" - -msgid "(Invalid)" -msgstr "(Virheellinen)" - -msgid "E677: Error writing temp file" -msgstr "E677: Vliaikaistiedostoon kirjoittaminen ei onnistunut" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Float ei ky Numberista" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref ei ky Numberista" - -msgid "E745: Using a List as a Number" -msgstr "E745: Lista ei ky Numberista" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Sanakirja ei ky Numberista" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref ei ky merkkijonosta" - -msgid "E730: using List as a String" -msgstr "E730: Lista ei ky merkkijonosta" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Sanakirja ei ky merkkijonosta" - -msgid "E806: using Float as a String" -msgstr "E806: Float ei ky merkkijonosta" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funcrefin muuttujanimen pit alkaa suuraakkosella: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Muuttujanimi on sama kuin olemassaolevan funktion: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Muuttujatyyppi ei tsm: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Muuttujaa %s ei voi poistaa" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Arvo on lukittu: %s" - -msgid "Unknown" -msgstr "Tuntematon" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Ei voi muuttaa muuttujan %s arvoa" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: muuttuja on upotettu liian syvlle kopioitavaksi" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Tuntematon funktio: %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: ( puuttuu: %s" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Virheellinen argumentti: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction puuttuu" +msgid "E941: already started a server" +msgstr "E941: palvelin on jo käynnissä" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Funktion nimi on ristiriidassa muuttujan kanssa: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver-toiminto ei ole saatavilla" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Funktiota %s ei voi mritell uudestaan, koska se on kytss" +msgid "remove() argument" +msgstr "remove()-argumentti" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Funktion nimi ei ole sama kuin skriptin tiedostonnimi: %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Liikaa symbolisia linkkejä (mahdollinen sykli)" -msgid "E129: Function name required" -msgstr "E129: Funktion nimi puuttuu" +msgid "reverse() argument" +msgstr "reverse()-argumentti" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Funktion nimen pit alkaa suuraakkosella tai sislt kaksoispisteen: " -"%s" +msgid "E258: Unable to send to client" +msgstr "E258: Asiakkaalle lähetys ei onnistunut" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Funktiota %s ei voi poistaa" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Viallinen toiminto: %s" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Funktiokutsujen syvyys on enemmn kuin maxfuncdepth" +msgid "sort() argument" +msgstr "sort()-argumentti" -#, c-format -msgid "calling %s" -msgstr "kutsutaan funktiota %s" +msgid "uniq() argument" +msgstr "uniq()-argumentti" -#, c-format -msgid "%s aborted" -msgstr "%s keskeytettiin" +msgid "E702: Sort compare function failed" +msgstr "E702: Lajittelun vertausfunktio ei onnistunut" -#, c-format -msgid "%s returning #%ld" -msgstr "%s palaa kohdassa #%ld" +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniqin vertausfunktio ei onnistunut" -#, c-format -msgid "%s returning %s" -msgstr "%s palaa kohdassa %s" +msgid "(Invalid)" +msgstr "(Virheellinen)" #, c-format -msgid "continuing in %s" -msgstr "jatkaa kohdassa %s" +msgid "E935: invalid submatch number: %d" +msgstr "E935: Virheellinen alitäsmäyksen numero: %d" -msgid "E133: :return not inside a function" -msgstr "E133: :return ei ole funktion sisll" - -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# globaalit muuttujat:\n" - -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tViimeksi asetettu kohteesta " +msgid "E677: Error writing temp file" +msgstr "E677: Väliaikaistiedostoon kirjoittaminen ei onnistunut" -msgid "No old files" -msgstr "Ei vanhoja tiedostoja" +msgid "E921: Invalid callback argument" +msgstr "E921: Virheellinen callback-argumentti" msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "Siirrytn vianetsinttilaan, kirjoita cont jatkaaksesi." +msgstr "Siirrytään vianetsintätilaan, kirjoita cont jatkaaksesi." #, c-format msgid "line %ld: %s" @@ -789,9 +825,16 @@ msgstr "rivi %ld: %s" msgid "cmd: %s" msgstr "kmnt: %s" +msgid "frame is zero" +msgstr "kehys on nolla" + +#, c-format +msgid "frame at highest level: %d" +msgstr "kehys ylimmällä tasolla: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Katkaisukohta %s%s rivill %ld" +msgstr "Katkaisukohta %s%s rivillä %ld" #, c-format msgid "E161: Breakpoint not found: %s" @@ -805,21 +848,22 @@ msgid "%3d %s %s line %ld" msgstr "%3d %s %s rivi %ld" msgid "E750: First use \":profile start {fname}\"" -msgstr "E750: Aloita kskyll :profile start {fname}" +msgstr "E750: Aloita käskyllä :profile start {fname}" msgid "Save As" -msgstr "Tallenna nimell" +msgstr "Tallenna nimellä" #, c-format msgid "Save changes to \"%s\"?" msgstr "Tallennetaanko muutokset tiedostoon %s?" -msgid "Untitled" -msgstr "Nimetn" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Komento on vielä käynnissä puskurissa \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jlkeen" +msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jälkeen" msgid "Warning: Entered other buffer unexpectedly (check autocommands)" msgstr "Varoitus: Puskuri vaihtui odottamatta (tarkista autocommands)" @@ -828,26 +872,34 @@ msgid "E163: There is only one file to edit" msgstr "E163: Vain yksi tiedosto muokattavana" msgid "E164: Cannot go before first file" -msgstr "E164: Ensimmisen tiedoston ohi ei voi menn" +msgstr "E164: Ensimmäisen tiedoston ohi ei voi mennä" msgid "E165: Cannot go beyond last file" -msgstr "E165: Viimeisen tiedoston ohi ei voi menn" +msgstr "E165: Viimeisen tiedoston ohi ei voi mennä" #, c-format msgid "E666: compiler not supported: %s" -msgstr "E666: kntj ei tueta: %s" +msgstr "E666: kääntäjää ei tueta: %s" #, c-format msgid "Searching for \"%s\" in \"%s\"" -msgstr "Etsitn ilmausta %s kohteesta %s" +msgstr "Etsitään ilmausta %s kohteesta %s" #, c-format msgid "Searching for \"%s\"" -msgstr "Etsitn ilmausta %s" +msgstr "Etsitään ilmausta %s" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "ei lydy runtimepathista: %s" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' ei löydy kohteesta: %s" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Vaadittu python-versio 2.x ei ole tuettu. Ohitetaan: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Vaadittu python-versio 3.x ei ole tuettu. Ohitetaan: %s" msgid "Source Vim script" msgstr "Lataa vim-skripti" @@ -876,6 +928,10 @@ msgstr "rivi %ld: ladataan %s" msgid "finished sourcing %s" msgstr "ladattu %s" +#, c-format +msgid "continuing in %s" +msgstr "jatkaa kohdassa %s" + msgid "modeline" msgstr "mode-rivi" @@ -886,13 +942,13 @@ msgid "-c argument" msgstr "-c-argumentti" msgid "environment variable" -msgstr "ympristmuuttuja" +msgstr "ympäristömuuttuja" msgid "error handler" -msgstr "virheksittelin" +msgstr "virhekäsittelin" msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Varoitus: Vr rivierotin, ^M saattaa puuttua" +msgstr "W15: Varoitus: Väärä rivierotin, ^M saattaa puuttua" msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding ladatun tiedoston ulkopuolella" @@ -902,11 +958,11 @@ msgstr "E168: :finish ladatun tiedoston ulkopuolella" #, c-format msgid "Current %slanguage: \"%s\"" -msgstr "Kytss oleva %skieli: %s" +msgstr "Käytössä oleva %skieli: %s" #, c-format msgid "E197: Cannot set language to \"%s\"" -msgstr "E197: Kieleksi ei voitu asettaa kielt %s" +msgstr "E197: Kieleksi ei voitu asettaa kieltä %s" # puhutaan merkin ulkoasusta snprintf(..., c, c, c, c) #, c-format @@ -922,31 +978,31 @@ msgid "> %d, Hex %08x, Octal %o" msgstr "> %d, hekdana %08x, oktaalina %o" msgid "E134: Move lines into themselves" -msgstr "E134: Rivien siirto itsejens plle" +msgstr "E134: Rivien siirto itsejensä päälle" msgid "1 line moved" msgstr "1 rivi siirretty" #, c-format msgid "%ld lines moved" -msgstr "%ld rivi siirretty" +msgstr "%ld riviä siirretty" #, c-format msgid "%ld lines filtered" -msgstr "%ld rivi suodatettu" +msgstr "%ld riviä suodatettu" msgid "E135: *Filter* Autocommands must not change current buffer" msgstr "E135: *Filter*-autocommand ei voi vaihtaa puskuria" msgid "[No write since last change]\n" -msgstr "[Viimeisint muutosta ei ole kirjoitettu]\n" +msgstr "[Viimeisintä muutosta ei ole kirjoitettu]\n" #, c-format msgid "%sviminfo: %s in line: " -msgstr "%sviminfo: %s rivill: " +msgstr "%sviminfo: %s rivillä: " msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: liikaa virheit, ohitetaan lopputiedosto" +msgstr "E136: viminfo: liikaa virheitä, ohitetaan lopputiedosto" #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" @@ -962,13 +1018,16 @@ msgid " oldfiles" msgstr " vanhaatiedostoa" msgid " FAILED" -msgstr " EPONNISTUI" +msgstr " EPÄONNISTUI" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Viminfo-tiedostoon ei voitu kirjoittaa: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: liikaa viminfo-väliaikaistiedostoja, kuten %s." + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s" @@ -977,12 +1036,14 @@ msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s" msgid "Writing viminfo file \"%s\"" msgstr "Kirjoitetaan viminfo-tiedostoa %s" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Viminfo-tiedostoa ei voit uudelleennimetä nimelle %s" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Vimin %s generoima viminfo-tiedosto.\n" -#, c-format msgid "" "# You may edit it if you're careful!\n" "\n" @@ -990,18 +1051,24 @@ msgstr "" "# Muokkaa varovasti!\n" "\n" -#, c-format msgid "# Value of 'encoding' when this file was written\n" msgstr "# encoding-muuttujan arvo tiedostoa kirjoitettaessa\n" msgid "Illegal starting char" msgstr "Virheellinen aloitusmerkki" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Bar-rivit, kopiotu sellaisenaan:\n" + msgid "Write partial file?" msgstr "Kirjoita osittainen tiedosto" msgid "E140: Use ! to write partial buffer" -msgstr "E140: Kyt !-komentoa osittaisen puskurin kirjoittamiseen" +msgstr "E140: Käytä !-komentoa osittaisen puskurin kirjoittamiseen" #, c-format msgid "Overwrite existing file \"%s\"?" @@ -1017,11 +1084,11 @@ msgstr "E768: Swap-tiedosto on jo olemassa: %s (komento :silent! ohittaa)" #, c-format msgid "E141: No file name for buffer %ld" -msgstr "E141: Ei tiedostonime puskurille %ld" +msgstr "E141: Ei tiedostonimeä puskurille %ld" msgid "E142: File not written: Writing is disabled by 'write' option" msgstr "" -"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen kytst" +"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen käytöstä" #, c-format msgid "" @@ -1039,11 +1106,11 @@ msgid "" msgstr "" "Tiedosto %s on kirjoitussuojattu.\n" "Siihen saattaa voida silti kirjoittaa.\n" -"Yritetnk?" +"Yritetäänkö?" #, c-format msgid "E505: \"%s\" is read-only (add ! to override)" -msgstr "E505: %s on kirjoitussuojattu (lis komentoon ! ohittaaksesi)" +msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" msgid "Edit File" msgstr "Muokkaa tiedostoa" @@ -1056,10 +1123,10 @@ msgid "E144: non-numeric argument to :z" msgstr "E144: :z:n argumentti ei ole numero" msgid "E145: Shell commands not allowed in rvim" -msgstr "E145: Kuoren komennot eivt toimi rvimiss" +msgstr "E145: Kuoren komennot eivät toimi rvimissä" msgid "E146: Regular expressions can't be delimited by letters" -msgstr "E146: Snnllist ilmausta ei voi rajata kirjaimilla" +msgstr "E146: Säännöllistä ilmausta ei voi rajata kirjaimilla" #, c-format msgid "replace with %s (y/n/a/q/l/^E/^Y)?" @@ -1069,37 +1136,40 @@ msgid "(Interrupted) " msgstr "(Keskeytetty)" msgid "1 match" -msgstr "1 tsmys" +msgstr "1 täsmäys" msgid "1 substitution" msgstr "1 korvaus" #, c-format msgid "%ld matches" -msgstr "%ld tsmyst" +msgstr "%ld täsmäystä" #, c-format msgid "%ld substitutions" msgstr "%ld korvausta" msgid " on 1 line" -msgstr " 1 rivill" +msgstr " 1 rivillä" #, c-format msgid " on %ld lines" -msgstr " %ld rivill" +msgstr " %ld rivillä" -msgid "E147: Cannot do :global recursive" +msgid "E147: Cannot do :global recursive with a range" msgstr "E147: :globalia ei voi suorittaa rekursiivisesti" msgid "E148: Regular expression missing from global" -msgstr "E148: Snnllinen ilmaus puuttuu globaalista" +msgstr "E148: Säännöllinen ilmaus puuttuu globaalista" #, c-format msgid "Pattern found in every line: %s" -msgstr "Kuvio lytyi joka rivilt: %s" +msgstr "Kuvio löytyi joka riviltä: %s" #, c-format +msgid "Pattern not found: %s" +msgstr "Kuviota ei löydy: %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -1110,23 +1180,23 @@ msgstr "" "$" msgid "E478: Don't panic!" -msgstr "E478: l panikoi." +msgstr "E478: Älä panikoi." #, c-format msgid "E661: Sorry, no '%s' help for %s" -msgstr "E661: Sori, ei lydy %s-ohjetta kohteelle %s" +msgstr "E661: ei löydy %s-ohjetta kohteelle %s" #, c-format msgid "E149: Sorry, no help for %s" -msgstr "E149: Sori, ei lydy ohjetta kohteelle %s" +msgstr "E149: ei löydy ohjetta kohteelle %s" #, c-format msgid "Sorry, help file \"%s\" not found" -msgstr "Sori, ohjetiedostoa %s ei lydy" +msgstr "ohjetiedostoa %s ei löydy" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: Ei ole hakemisto: %s" +msgid "E151: No match: %s" +msgstr "E151: Ei täsmää: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1138,11 +1208,15 @@ msgstr "E153: Ei voi avata tiedostoa %s lukemista varten" #, c-format msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: Monia ohjetiedostokoodauksia kieless: %s" +msgstr "E670: Monia ohjetiedostokoodauksia kielessä: %s" #, c-format msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Kaksoiskappale tgist %s tiedostossa %s/%s" +msgstr "E154: Kaksoiskappale tägistä %s tiedostossa %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Ei ole hakemisto: %s" #, c-format msgid "E160: Unknown sign command: %s" @@ -1152,7 +1226,7 @@ msgid "E156: Missing sign name" msgstr "E156: Merkki puuttuu" msgid "E612: Too many signs defined" -msgstr "E612: Liikaa merkkej mritelty" +msgstr "E612: Liikaa merkkejä määritelty" #, c-format msgid "E239: Invalid sign text: %s" @@ -1169,12 +1243,19 @@ msgstr "E159: Merkin numero puuttuu" msgid "E158: Invalid buffer name: %s" msgstr "E158: Virheellinen puskurin nimi: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Ei voida hypätä puskuriin jolla ei ole nimeä" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Virheellinen merkin tunnus: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Ei voida muuttaa merkkiä %s" + msgid " (NOT FOUND)" -msgstr " (EI LYTYNYT)" +msgstr " (EI LÖYTYNYT)" msgid " (not supported)" msgstr " (ei tuettu)" @@ -1182,8 +1263,11 @@ msgstr " (ei tuettu)" msgid "[Deleted]" msgstr "[Poistettu]" +msgid "No old files" +msgstr "Ei vanhoja tiedostoja" + msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Siirrytn Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan." +msgstr "Siirrytään Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan." msgid "E501: At end-of-file" msgstr "E501: Tiedoston lopussa" @@ -1202,7 +1286,7 @@ msgid "End of function" msgstr "Funktion loppu" msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: Kyttjn mrittelemn komennon monimerkityksinen kytt" +msgstr "E464: Käyttäjän määrittelemän komennon monimerkityksinen käyttö" msgid "E492: Not an editor command" msgstr "E492: Ei ole editorikomento" @@ -1211,59 +1295,65 @@ msgid "E493: Backwards range given" msgstr "E493: Takaperoinen arvoalue annettu" msgid "Backwards range given, OK to swap" -msgstr "Takaperoinen arvoalue annettu, OK knt" +msgstr "Takaperoinen arvoalue annettu, OK kääntää" msgid "E494: Use w or w>>" -msgstr "E494: Kyt w:t tai w>>:aa" +msgstr "E494: Käytä w:tä tai w>>:aa" + +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Komentotaulukko pitää päivittää komennolla 'make cmdidxs'" msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: Komento ei ole kytettviss tss versiossa" +msgstr "E319: Komento ei ole käytettävissä tässä versiossa" msgid "E172: Only one file name allowed" msgstr "E172: Vain yksi tiedostonimi sallitaan" msgid "1 more file to edit. Quit anyway?" -msgstr "viel 1 tiedosto muokattavana, lopetaanko silti?" +msgstr "vielä 1 tiedosto muokattavana, lopetaanko silti?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "viel %d tiedostoa muokattavana, lopetetaanko silti?" +msgstr "vielä %d tiedostoa muokattavana, lopetetaanko silti?" msgid "E173: 1 more file to edit" -msgstr "E173: viel 1 tiedosto muokattavana" +msgstr "E173: vielä 1 tiedosto muokattavana" #, c-format msgid "E173: %ld more files to edit" -msgstr "E173: viel %ld tiedostoa muokattavana" +msgstr "E173: vielä %ld tiedostoa muokattavana" msgid "E174: Command already exists: add ! to replace it" -msgstr "E174: Komento on jo olemassa, kyt !: korvataksesi" +msgstr "E174: Komento on jo olemassa, käytä !:ä korvataksesi" msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nimi Arg Arvot Valmis Mritelm" +" Nimi Argumentit Osoite Valmis Määritelmä" msgid "No user-defined commands found" -msgstr "Ei kyttjn mrittelemi komentoja" +msgstr "Ei käyttäjän määrittelemiä komentoja" msgid "E175: No attribute specified" -msgstr "E175: Ei attribuutteja mriteltyn" +msgstr "E175: Ei attribuutteja määriteltynä" msgid "E176: Invalid number of arguments" -msgstr "E176: Vr mr attribuutteja" +msgstr "E176: Väärä määrä attribuutteja" msgid "E177: Count cannot be specified twice" -msgstr "E177: Lukumr ei voi mritell kahdesti" +msgstr "E177: Lukumäärää ei voi määritellä kahdesti" msgid "E178: Invalid default value for count" -msgstr "E178: Lukumrn oletusarvo on vr" +msgstr "E178: Lukumäärän oletusarvo on väärä" msgid "E179: argument required for -complete" msgstr "E179: -complete vaatii argumentin" +msgid "E179: argument required for -addr" +msgstr "E179: -addr vaatii argumentin" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Virheellinen attribuutti: %s" @@ -1272,37 +1362,44 @@ msgid "E182: Invalid command name" msgstr "E182: Virheellinen komennon nimi" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: Kyttjn mrittelemn komennon pit alkaa suuraakkosella" +msgstr "E183: Käyttäjän määrittelemän komennon pitää alkaa suuraakkosella" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: Varattua nimeä ei voi käyttää käyttäjän määrittelemänä komentona" #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: Kyttjn komentoa ei ole olemassa: %s" +msgstr "E184: Käyttäjän komentoa ei ole olemassa: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Virheellinen osoitetyyppiarvo: %s" #, c-format msgid "E180: Invalid complete value: %s" -msgstr "E180: Virheellinen tydennysarvo: %s" +msgstr "E180: Virheellinen täydennysarvo: %s" msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: Tydennysargumentti sopii vain itse mriteltyyn tydennykseen" +msgstr "E468: Täydennysargumentti sopii vain itse määriteltyyn täydennykseen" msgid "E467: Custom completion requires a function argument" -msgstr "E467: Itse mritelty tydennys vaatii funktioargumentin" +msgstr "E467: Itse määritelty täydennys vaatii funktioargumentin" msgid "unknown" msgstr "tuntematon" #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: Vriteemaa %s ei lydy" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Väriteemaa %s ei löydy" msgid "Greetings, Vim user!" -msgstr "Tervehdys, Vimin kyttj." +msgstr "Tervehdys, Vimin käyttäjä." msgid "E784: Cannot close last tab page" -msgstr "E784: Viimeist vlilehte ei voi sulkea" +msgstr "E784: Viimeistä välilehteä ei voi sulkea" msgid "Already only one tab page" -msgstr "Vain yksi vlilehti jljell en" +msgstr "Vain yksi välilehti jäljellä enää" msgid "Edit File in new window" msgstr "Muokkaa uudessa ikkunassa" @@ -1315,15 +1412,15 @@ msgid "No swap file" msgstr "Ei swap-tiedostoa" msgid "Append File" -msgstr "Lis tiedostoon" +msgstr "Lisää tiedostoon" msgid "E747: Cannot change directory, buffer is modified (add ! to override)" msgstr "" -"E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lis komentoon ! " +"E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lisää komentoon ! " "ohittaaksesi" msgid "E186: No previous directory" -msgstr "E186: Ei edellist hakemistoa" +msgstr "E186: Ei edellistä hakemistoa" msgid "E187: Unknown" msgstr "E187: Tuntematon" @@ -1336,16 +1433,19 @@ msgid "Window position: X %d, Y %d" msgstr "Ikkunan sijainti: X %d, Y %d" msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: Ikkunan sijainnin selvitys ei toimi tll alustalla" +msgstr "E188: Ikkunan sijainnin selvitys ei toimi tällä alustalla" msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos vaatii kaksi lukuargumenttia" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Komentoa :redir ei voi käyttää funktion execute() sisällä" + msgid "Save Redirection" msgstr "Tallenna uudelleenosoitus" msgid "Save View" -msgstr "Tallenna nkym" +msgstr "Tallenna näkymä" msgid "Save Session" msgstr "Tallenna sessio" @@ -1359,24 +1459,23 @@ msgstr "E739: hakemistoa ei voi luoda: %s" #, c-format msgid "E189: \"%s\" exists (add ! to override)" -msgstr "E189: %s on jo olemassa (lis komentoon ! ohittaaksesi)" +msgstr "E189: %s on jo olemassa (lisää komentoon ! ohittaaksesi)" #, c-format msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Tiedostoa %s ei voitu avata kirjoittamista varten" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" -msgstr "E191: Argumentin eteen- tai taaksepin lainaukseen pit olla kirjain" +msgstr "E191: Argumentin eteen- tai taaksepäin lainaukseen pitää olla kirjain" msgid "E192: Recursive use of :normal too deep" -msgstr "E192: :normalin liian syv rekursio" +msgstr "E192: :normalin liian syvä rekursio" msgid "E809: #< is not available without the +eval feature" -msgstr "E809: #< ei ole kytss jollei +eval ole pll" +msgstr "E809: #< ei ole käytössä jollei +eval ole päällä" msgid "E194: No alternate file name to substitute for '#'" -msgstr "E194: Ei vaihtoehtoista tiedostonime #:lle" +msgstr "E194: Ei vaihtoehtoista tiedostonimeä #:lle" msgid "E495: no autocommand file name to substitute for \"<afile>\"" msgstr "E495: ei autocommand-tiedostoa kohteelle <afile>" @@ -1385,28 +1484,33 @@ msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" msgstr "E496: ei autocommand-puskurinumeroa kohteelle <abuf>" msgid "E497: no autocommand match name to substitute for \"<amatch>\"" -msgstr "E497: ei autocommand-tsmysnime kohteella <amatch>" +msgstr "E497: ei autocommand-täsmäysnimeä kohteella <amatch>" msgid "E498: no :source file name to substitute for \"<sfile>\"" -msgstr "E498: ei :source-tiedostonime kohteelle <sfile>" +msgstr "E498: ei :source-tiedostonimeä kohteelle <sfile>" + +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: ei rivinumeroa kohteelle <slnum>" #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" -msgstr "E499: Tyhj tiedostonimi kohteissa % tai # toimii vain :p:h" +msgstr "E499: Tyhjä tiedostonimi kohteissa % tai # toimii vain :p:h" msgid "E500: Evaluates to an empty string" -msgstr "E500: Loppuarvo on tyhj merkkijono" +msgstr "E500: Loppuarvo on tyhjä merkkijono" msgid "E195: Cannot open viminfo file for reading" msgstr "E195: Viminfoa ei voi avata lukemista varten" +msgid "Untitled" +msgstr "Nimetön" + msgid "E196: No digraphs in this version" -msgstr "E196: Digraafeja ei ole tss versiossa" +msgstr "E196: Digraafeja ei ole tässä versiossa" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" -msgstr "E608: Vim-alkuisia poikkeuksia ei voi heitt :throw-komennolla" +msgstr "E608: Vim-alkuisia poikkeuksia ei voi heittää :throw-komennolla" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Poikkeus heitetty: %s" @@ -1423,7 +1527,6 @@ msgstr "Poikkeus poistettu: %s" msgid "%s, line %ld" msgstr "%s, rivi %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Poikkeus otettu kiinni: %s" @@ -1449,7 +1552,6 @@ msgstr "Virhe ja keskeytys" msgid "Error" msgstr "Virhe" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Keskeytys" @@ -1469,7 +1571,7 @@ msgid "E583: multiple :else" msgstr "E583: :else monta kertaa" msgid "E584: :elseif after :else" -msgstr "E584: :elseif komennon :else jlkeen" +msgstr "E584: :elseif komennon :else jälkeen" msgid "E585: :while/:for nesting too deep" msgstr "E585: liian monta tasoa :while- tai :for-komennoissa" @@ -1492,15 +1594,12 @@ msgstr "E601: liian monta tasoa :try-komennossa" msgid "E603: :catch without :try" msgstr "E603: :catch ilman komentoa :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch ilman komentoa :finally" msgid "E606: :finally without :try" msgstr "E606: :finally ilman komentoa :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: :finally monta kertaa" @@ -1517,7 +1616,7 @@ msgid "E811: Not allowed to change buffer information now" msgstr "E811: Puskuria ei voi vaihtaa nyt" msgid "tagname" -msgstr "tginimi" +msgstr "täginimi" msgid " kind file\n" msgstr " -tiedostotyyppi\n" @@ -1543,7 +1642,10 @@ msgid "Expression" msgstr "Ilmaus" msgid "Input Line" -msgstr "Syterivi" +msgstr "Syöterivi" + +msgid "Debug Line" +msgstr "Vianetsintärivi" msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar komennon pituuden ulkopuolella" @@ -1564,7 +1666,7 @@ msgid "is not a file" msgstr "ei ole tiedosto" msgid "is a device (disabled with 'opendevice' option)" -msgstr "on laite (ei kytss opendevice-asetuksen takia)" +msgstr "on laite (ei käytössä opendevice-asetuksen takia)" msgid "[New File]" msgstr "[Uusi tiedosto]" @@ -1580,18 +1682,17 @@ msgstr "[Lupa kielletty]" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "" -"E200: *ReadPre-autocommand-komennot tekivt tiedostosta lukukelvottoman" +"E200: *ReadPre-autocommand-komennot tekivät tiedostosta lukukelvottoman" msgid "E201: *ReadPre autocommands must not change current buffer" -msgstr "E201: *ReadPre-autocommand-komennot eivt saa muuttaa puskuria" +msgstr "E201: *ReadPre-autocommand-komennot eivät saa muuttaa puskuria" msgid "Vim: Reading from stdin...\n" -msgstr "Vim: Luetaan vakiosytteest...\n" +msgstr "Vim: Luetaan vakiosyötteestä...\n" msgid "Reading from stdin..." -msgstr "Luetaan vakiosytteest" +msgstr "Luetaan vakiosyötteestä" -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: Muunnos teki tiedostosta lukukelvottoman." @@ -1607,15 +1708,12 @@ msgstr "[soketti]" msgid "[character special]" msgstr "[merkki erikoinen]" -msgid "[RO]" -msgstr "[Luku]" - -# Carriage Return elikk rivinvaihtomerkin ers muoto/osa (vrt. LF) +# Carriage Return elikkä rivinvaihtomerkin eräs muoto/osa (vrt. LF) msgid "[CR missing]" msgstr "[CR puuttuu]" msgid "[long lines split]" -msgstr "[pitkt rivit hajotettu]" +msgstr "[pitkät rivit hajotettu]" msgid "[NOT converted]" msgstr "[EI muunnettu]" @@ -1623,32 +1721,26 @@ msgstr "[EI muunnettu]" msgid "[converted]" msgstr "[muunnettu]" -msgid "[crypted]" -msgstr "[salattu]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" -msgstr "[MUUNNOSVIRHE rivill %ld]" +msgstr "[MUUNNOSVIRHE rivillä %ld]" #, c-format msgid "[ILLEGAL BYTE in line %ld]" -msgstr "[VIRHEELLINEN OKTETTI rivill %ld]" +msgstr "[VIRHEELLINEN OKTETTI rivillä %ld]" msgid "[READ ERRORS]" -msgstr "[LUKUVIRHEIT]" +msgstr "[LUKUVIRHEITÄ]" msgid "Can't find temp file for conversion" -msgstr "Ei voi lyt vliaikaistiedstoa muuntamiseksi" +msgstr "Ei voi löytää väliaikaistiedstoa muuntamiseksi" msgid "Conversion with 'charconvert' failed" -msgstr "Muunnos charconvert eponnistui" +msgstr "Muunnos charconvert epäonnistui" msgid "can't read output of 'charconvert'" msgstr "charconvertin tulostetta ei voida lukea" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Tiedoston salaus on tuntematon" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Ei autocommand-komentoa acwrite-puskurille" @@ -1658,7 +1750,7 @@ msgstr "" "kirjoittaa" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Autocommand-komento muutti rivien mr odottamatta" +msgstr "E204: Autocommand-komento muutti rivien määrä odottamatta" msgid "NetBeans disallows writes of unmodified buffers" msgstr "NetBeans ei salli kirjoittaa muokkaamattomiin puskureihin" @@ -1670,43 +1762,43 @@ msgid "is not a file or writable device" msgstr "ei ole tiedosto tai kirjoitettava laite" msgid "writing to device disabled with 'opendevice' option" -msgstr "laitteeseen kirjoittaminen pois kytst opendevice-asetuksella" +msgstr "laitteeseen kirjoittaminen pois käytöstä opendevice-asetuksella" msgid "is read-only (add ! to override)" -msgstr "on kirjoitussuojattu (lis komentoon ! ohittaaksesi)" +msgstr "on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" msgid "E506: Can't write to backup file (add ! to override)" msgstr "" -"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lis komentoon ! " +"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lisää komentoon ! " "ohittaaksesi)" msgid "E507: Close error for backup file (add ! to override)" msgstr "" -"E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lis komentoon ! " +"E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lisää komentoon ! " "ohittaaksesi)" msgid "E508: Can't read file for backup (add ! to override)" msgstr "" -"E508: Varmuuskopiotiedostoa ei voi lukea (lis komentoon ! ohittaaksesi)" +"E508: Varmuuskopiotiedostoa ei voi lukea (lisää komentoon ! ohittaaksesi)" msgid "E509: Cannot create backup file (add ! to override)" msgstr "" -"E509: Ei voi luoda varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)" +"E509: Ei voi luoda varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)" msgid "E510: Can't make backup file (add ! to override)" msgstr "" -"E510: Ei voi tehd varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)" +"E510: Ei voi tehdä varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)" -# tietkseni resurssiforkki on applen tiedostojrjestelmn tunnistejuttujuttu +# tietääkseni resurssiforkki on applen tiedostojärjestelmän tunnistejuttujuttu msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: resurssiosa hviisi (lis komentoon ! ohittaaksesi)" +msgstr "E460: resurssiosa häviäisi (lisää komentoon ! ohittaaksesi)" msgid "E214: Can't find temp file for writing" -msgstr "E214: Ei voi lyt vliaikaistiedostoa kirjoitettavaksi" +msgstr "E214: Ei voi löytää väliaikaistiedostoa kirjoitettavaksi" msgid "E213: Cannot convert (add ! to write without conversion)" msgstr "" -"E213: Muunnos ei onnistu (lis komentoon ! kirjoittaaksesi muuntamatta)" +"E213: Muunnos ei onnistu (lisää komentoon ! kirjoittaaksesi muuntamatta)" msgid "E166: Can't open linked file for writing" msgstr "E166: Linkitetyn tiedoston avaus kirjoittamista varten ei onnistu" @@ -1721,24 +1813,25 @@ msgid "E512: Close failed" msgstr "E512: Sulkeminen ei onnistunut" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: kirjoitusvirhe, muunnos eponnistui (tyhj fenc ohittaaksesi)" +msgstr "E513: kirjoitusvirhe, muunnos epäonnistui (tyhjää fenc ohittaaksesi)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" -msgstr "E513: kirjoitusvirhe, muunnos eponnistui rivill %ld" -"(tyhj fenc ohittaaksesi)" +msgstr "" +"E513: kirjoitusvirhe, muunnos epäonnistui rivillä %ld(tyhjää fenc " +"ohittaaksesi)" msgid "E514: write error (file system full?)" -msgstr "E514: kirjoitusvirhe (tiedostojrjestelm tysi)" +msgstr "E514: kirjoitusvirhe (tiedostojärjestelmä täysi)" msgid " CONVERSION ERROR" msgstr " MUUNNOSVIRHE" #, c-format msgid " in line %ld;" -msgstr " rivill %ld" +msgstr " rivillä %ld" msgid "[Device]" msgstr "[Laite]" @@ -1750,7 +1843,7 @@ msgid " [a]" msgstr " [a]" msgid " appended" -msgstr " listty" +msgstr " lisätty" msgid " [w]" msgstr " [w]" @@ -1759,10 +1852,10 @@ msgid " written" msgstr " kirjoitettu" msgid "E205: Patchmode: can't save original file" -msgstr "E205: Patch-tilassa ei voi tallentaa alkuperistiedostoa" +msgstr "E205: Patch-tilassa ei voi tallentaa alkuperäistiedostoa" msgid "E206: patchmode: can't touch empty original file" -msgstr "E206: patch-tilassa ei voi muuttaa tyhj alkuperistiedostoa" +msgstr "E206: patch-tilassa ei voi muuttaa tyhjää alkuperäistiedostoa" msgid "E207: Can't delete backup file" msgstr "E207: Ei voi poistaa varmuuskopiota" @@ -1772,10 +1865,10 @@ msgid "" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"VAROITUS: Alkuperistiedosto voi hvit tai vahingoittua\n" +"VAROITUS: Alkuperäistiedosto voi hävitä tai vahingoittua\n" msgid "don't quit the editor until the file is successfully written!" -msgstr "l lopeta editoria kesken tallentamisen." +msgstr "älä lopeta editoria kesken tallentamisen." msgid "[dos]" msgstr "[dos]" @@ -1800,19 +1893,14 @@ msgstr "1 rivi, " #, c-format msgid "%ld lines, " -msgstr "%ld rivi, " +msgstr "%ld riviä, " msgid "1 character" msgstr "1 merkki" #, c-format msgid "%lld characters" -msgstr "%lld merkki" - -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld merkki" +msgstr "%lld merkkiä" # ei rivinvaihtoja msgid "[noeol]" @@ -1821,12 +1909,9 @@ msgstr "[eiriviv.]" msgid "[Incomplete last line]" msgstr "[Vajaa viimeinen rivi]" -# Jos aukiolevaa tiedostoa srkkii toisella ohjelmalla -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers +# Jos aukiolevaa tiedostoa sörkkii toisella ohjelmalla msgid "WARNING: The file has been changed since reading it!!!" -msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jlkeen!" +msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jälkeen!" msgid "Do you really want to write to it" msgstr "Kirjoitetaanko" @@ -1848,7 +1933,7 @@ msgstr "E246: FileChangedShell-autocommand poisti puskurin" #, c-format msgid "E211: File \"%s\" no longer available" -msgstr "E211: Tiedostoa %s ei ole en" +msgstr "E211: Tiedostoa %s ei ole enää" #, c-format msgid "" @@ -1859,32 +1944,32 @@ msgstr "" "tiedostoon" msgid "See \":help W12\" for more info." -msgstr ":help W12 kertoo listietoja." +msgstr ":help W12 kertoo lisätietoja." #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jlkeen" +msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jälkeen" msgid "See \":help W11\" for more info." -msgstr ":help W11 kertoo listietoja." +msgstr ":help W11 kertoo lisätietoja." #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" msgstr "" "W16: Varoitus: Tiedoston %s oikeuksia on muutettu muokkauksen aloituksen " -"jlkeen" +"jälkeen" msgid "See \":help W16\" for more info." -msgstr ":help W16 kertoo listietoja." +msgstr ":help W16 kertoo lisätietoja." #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jlkeen" +msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jälkeen" msgid "Warning" msgstr "Varoitus" -# yll olevien varoitusten ratkaisut +# yllä olevien varoitusten ratkaisut msgid "" "&OK\n" "&Load File" @@ -1907,24 +1992,28 @@ msgstr "--Poistettu--" msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "poistetaan autocommand automaattisesti: %s <puskuri=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" -msgstr "E367: Ryhm ei ole: %s" +msgstr "E367: Ryhmää ei ole: %s" + +msgid "E936: Cannot delete the current group" +msgstr "E936: Nykyistä ryhmää ei voi poistaa" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: käytössä oleva augroup poistetaan" #, c-format msgid "E215: Illegal character after *: %s" -msgstr "E215: Virheellinen merkki *:n jlkeen: %s" +msgstr "E215: Virheellinen merkki *:n jälkeen: %s" #, c-format msgid "E216: No such event: %s" -msgstr "E216: Eventti ei ole: %s" +msgstr "E216: Eventtiä ei ole: %s" #, c-format msgid "E216: No such group or event: %s" -msgstr "E216: Ryhm tai eventti ei ole: %s" +msgstr "E216: Ryhmää tai eventtiä ei ole: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -1940,7 +2029,7 @@ msgid "E217: Can't execute autocommands for ALL events" msgstr "E217: Ei voi suorittaa autocommandsia kaikille eventeille" msgid "No matching autocommands" -msgstr "Ei tsmvi autocommandsia" +msgstr "Ei täsmääviä autocommandsia" msgid "E218: autocommand nesting too deep" msgstr "E218: liian monta tasoa autocommandissa" @@ -1967,28 +2056,24 @@ msgid "E490: No fold found" msgstr "E490: taitos puuttuu" msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: Taitoksia ei voi tehd tll foldmethodilla" +msgstr "E350: Taitoksia ei voi tehdä tällä foldmethodilla" msgid "E351: Cannot delete fold with current 'foldmethod'" -msgstr "E351: Taitosta ei voi poistaa tll foldmethodilla" - -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld rivi taitettu pois " +msgstr "E351: Taitosta ei voi poistaa tällä foldmethodilla" msgid "E222: Add to read buffer" -msgstr "E222: Lis lukupuskuriin" +msgstr "E222: Lisää lukupuskuriin" msgid "E223: recursive mapping" msgstr "E223: rekursiivinen kuvaus" #, c-format msgid "E224: global abbreviation already exists for %s" -msgstr "E224: globaali lyhenne merkinnlle %s on jo olemassa" +msgstr "E224: globaali lyhenne merkinnälle %s on jo olemassa" #, c-format msgid "E225: global mapping already exists for %s" -msgstr "E225: globaali kuvaus merkinnlle %s on jo olemassa" +msgstr "E225: globaali kuvaus merkinnälle %s on jo olemassa" #, c-format msgid "E226: abbreviation already exists for %s" @@ -1999,10 +2084,10 @@ msgid "E227: mapping already exists for %s" msgstr "E227: kuvaus on jo olemassa %s" msgid "No abbreviation found" -msgstr "Lyhennett ei lydy" +msgstr "Lyhennettä ei löydy" msgid "No mapping found" -msgstr "Kuvausta ei lydy" +msgstr "Kuvausta ei löydy" msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Virheellinen tila" @@ -2021,7 +2106,7 @@ msgid "Pathname:" msgstr "Polku:" msgid "E615: vim_SelFile: can't get current directory" -msgstr "E615: vim_SelFile: nykyist hakemistoa ei saada selville" +msgstr "E615: vim_SelFile: nykyistä hakemistoa ei saada selville" msgid "OK" msgstr "OK" @@ -2033,20 +2118,26 @@ msgid "Vim dialog" msgstr "Vim-ikkuna" msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." -msgstr "Vierityspalkki: Pixmapin geometria ei selvi" +msgstr "Vierityspalkki: Pixmapin geometria ei selviä" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: Ei voi luoda BalloonEvalia viestille ja callbackille" +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Ei voitu luoda uutta prosessia käyttöliittymälle" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: Lapsiprosesi ei voinut käynnistää käyttöliittymää" + msgid "E229: Cannot start the GUI" -msgstr "E229: GUIn kynnistys ei onnistu" +msgstr "E229: GUIn käynnistys ei onnistu" #, c-format msgid "E230: Cannot read from \"%s\"" msgstr "E230: Ei voi lukea kohteesta %s" msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei lydy" +msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei löydy" msgid "E231: 'guifontwide' invalid" msgstr "E231: guifontwide virheellinen" @@ -2056,22 +2147,40 @@ msgstr "E599: imactivatekeyn arvo on virheellinen" #, c-format msgid "E254: Cannot allocate color %s" -msgstr "E254: Vri %s ei voi mritell" +msgstr "E254: Väriä %s ei voi määritellä" msgid "No match at cursor, finding next" -msgstr "Ei tsmyst kursorin alla, etsitn seuraava" +msgstr "Ei täsmäystä kursorin alla, etsitään seuraava" + +msgid "_Cancel" +msgstr "_Peru" + +msgid "_Save" +msgstr "_Tallenna" + +msgid "_Open" +msgstr "_Avaa" + +msgid "_OK" +msgstr "_OK" msgid "" "&Yes\n" "&No\n" "&Cancel" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei\n" "&Peru" +msgid "Yes" +msgstr "Kyllä" + +msgid "No" +msgstr "Ei" + msgid "Input _Methods" -msgstr "Syte_menetelmt" +msgstr "Syöte_menetelmät" msgid "VIM - Search and Replace..." msgstr "VIM - Etsi ja korvaa..." @@ -2085,50 +2194,47 @@ msgstr "Etsi:" msgid "Replace with:" msgstr "Korvaa:" -#. whole word only button msgid "Match whole word only" msgstr "Korvaa kokonaisia sanoja" -#. match case button msgid "Match case" msgstr "Kirjaintaso" msgid "Direction" msgstr "Suunta" -#. 'Up' and 'Down' buttons msgid "Up" -msgstr "Yls" +msgstr "Ylös" msgid "Down" msgstr "Alas" -#. 'Find Next' button msgid "Find Next" msgstr "Etsi seuraava" -#. 'Replace' button msgid "Replace" msgstr "Korvaa" -#. 'Replace All' button msgid "Replace All" msgstr "Korvaa kaikki" +msgid "_Close" +msgstr "_Sulje" + msgid "Vim: Received \"die\" request from session manager\n" -msgstr "Vim: sessiomanageri lhetti die-pyynnn\n" +msgstr "Vim: sessiomanageri lähetti die-pyynnön\n" -msgid "Close" -msgstr "Sulje" +msgid "Close tab" +msgstr "Sulje välilehti" msgid "New tab" -msgstr "Uusi vlilehti" +msgstr "Uusi välilehti" msgid "Open Tab..." -msgstr "Avaa vlilehti..." +msgstr "Avaa välilehti..." msgid "Vim: Main window unexpectedly destroyed\n" -msgstr "Vim: Pikkuna tuhoutui odottamatta\n" +msgstr "Vim: Pääikkuna tuhoutui odottamatta\n" msgid "&Filter" msgstr "&Suodata" @@ -2166,45 +2272,40 @@ msgstr "Korvaa k&aikki" msgid "&Undo" msgstr "&Kumoa" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Ikkunan otsikkoa ei lydy %s" - -# OLE on object linking and embedding p windowska -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argumenttia ei tueta: -%s, kyt OLE-versiota" - -# MDI eli windowsin moni-ikkunasovellus -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen" - -msgid "Close tab" -msgstr "Sulje vlilehti" - msgid "Open tab..." -msgstr "Avaa vlilehti..." +msgstr "Avaa välilehti..." msgid "Find string (use '\\\\' to find a '\\')" -msgstr "Etsi merkkijonoa (\\\\:ll lyt \\:t)" +msgstr "Etsi merkkijonoa (\\\\:llä löytää \\:t)" msgid "Find & Replace (use '\\\\' to find a '\\')" -msgstr "Etsi ja korvaa (\\\\:ll lyt \\:t)" +msgstr "Etsi ja korvaa (\\\\:llä löytää \\:t)" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" -msgstr "Ei kytss" +msgstr "Ei käytössä" msgid "Directory\t*.nothing\n" msgstr "Hakemisto\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Ikkunan otsikkoa ei löydy %s" + +# OLE on object linking and embedding på windowska +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argumenttia ei tueta: -%s, käytä OLE-versiota" + +# MDI eli windowsin moni-ikkunasovellus +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" -msgstr "Vim E458: Ei voi varata vrikartan alkiota, vrit voivat menn vrin" +msgstr "Vim E458: Ei voi varata värikartan alkiota, värit voivat mennä väärin" #, c-format msgid "E250: Fonts for the following charsets are missing in fontset %s:" -msgstr "E250: Seuraavien merkistjoukkojen fontit puuttuvat fontsetist %s:" +msgstr "E250: Seuraavien merkistöjoukkojen fontit puuttuvat fontsetistä %s:" #, c-format msgid "E252: Fontset name: %s" @@ -2212,44 +2313,40 @@ msgstr "E252: Fontsetin nimi: %s" #, c-format msgid "Font '%s' is not fixed-width" -msgstr "Fontti %s ei ole tasavlinen" +msgstr "Fontti %s ei ole tasavälinen" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Fontsetin nimi: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Fontsetin nimi: %s" #, c-format -msgid "Font0: %s\n" -msgstr "Fontti0: %s\n" +msgid "Font0: %s" +msgstr "Fontti0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Fontti1: %s\n" +msgid "Font1: %s" +msgstr "Fontti1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "Fontti%ld:n leveys ei ole kaksi kertaa fontti0:n\n" +msgid "Font%ld width is not twice that of font0" +msgstr "Fontti%ld:n leveys ei ole kaksi kertaa fontti0:n" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Fontti0:n leveys: %ld\n" +msgid "Font0 width: %ld" +msgstr "Fontti0:n leveys: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Fontti1:n leveys: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Fontti1:n leveys: %ld" msgid "Invalid font specification" -msgstr "Virheellinen fonttimritys" +msgstr "Virheellinen fonttimääritys" msgid "&Dismiss" msgstr "&Ohita" msgid "no specific match" -msgstr "ei tarkkaa tsmyst" +msgstr "ei tarkkaa täsmäystä" msgid "Vim - Font Selector" msgstr "Vim - fonttivalitsin" @@ -2257,9 +2354,8 @@ msgstr "Vim - fonttivalitsin" msgid "Name:" msgstr "Nimi:" -#. create toggle button msgid "Show size in Points" -msgstr "Nyt koko pistein" +msgstr "Näytä koko pisteinä" msgid "Encoding:" msgstr "Koodaus:" @@ -2283,14 +2379,14 @@ msgid "E551: Illegal component" msgstr "E551: Virheellinen komponentti" msgid "E552: digit expected" -msgstr "E552: pitisi olla numero" +msgstr "E552: pitäisi olla numero" #, c-format msgid "Page %d" msgstr "Sivu %d" msgid "No text to be printed" -msgstr "Ei teksti tulostettavaksi" +msgstr "Ei tekstiä tulostettavaksi" #, c-format msgid "Printing page %d (%d%%)" @@ -2308,7 +2404,7 @@ msgid "Printing aborted" msgstr "Tulostus peruttu" msgid "E455: Error writing to PostScript output file" -msgstr "E455: Virhe kirjoitettaessa PostScripti tiedostoon" +msgstr "E455: Virhe kirjoitettaessa PostScriptiä tiedostoon" #, c-format msgid "E624: Can't open file \"%s\"" @@ -2328,13 +2424,13 @@ msgstr "E619: tiedosto %s ei ole tuettu PostScript-resurssitiedosto" #, c-format msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: resurssitiedoston %s versio on vr" +msgstr "E621: resurssitiedoston %s versio on väärä" msgid "E673: Incompatible multi-byte encoding and character set." -msgstr "E673: Tukematon monitvauinen merkistkoodaus ja merkist." +msgstr "E673: Tukematon monitvauinen merkistökoodaus ja merkistö." msgid "E674: printmbcharset cannot be empty with multi-byte encoding." -msgstr "E674: printmbcharset ei voi olla tyhj monitavuiselle koodaukselle." +msgstr "E674: printmbcharset ei voi olla tyhjä monitavuiselle koodaukselle." msgid "E675: No default font specified for multi-byte printing." msgstr "E675: Ei oletusfonttia monitavuiseen tulostukseen" @@ -2347,36 +2443,36 @@ msgid "E456: Can't open file \"%s\"" msgstr "E456: Tiedoston %s avaus ei onnistu" msgid "E456: Can't find PostScript resource file \"prolog.ps\"" -msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei lydy" +msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei löydy" msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" -msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei lydy" +msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei löydy" #, c-format msgid "E456: Can't find PostScript resource file \"%s.ps\"" -msgstr "E456: Postscript-resurssitiedosta %s.ps ei lydy" +msgstr "E456: Postscript-resurssitiedosta %s.ps ei löydy" #, c-format msgid "E620: Unable to convert to print encoding \"%s\"" msgstr "E620: Tulostuskoodaukseen %s muunto ei onnistu" msgid "Sending to printer..." -msgstr "Lhetetn tulostimelle..." +msgstr "Lähetetään tulostimelle..." msgid "E365: Failed to print PostScript file" -msgstr "E365: PostScript-tiedoston tulostus eponnistui" +msgstr "E365: PostScript-tiedoston tulostus epäonnistui" msgid "Print job sent." -msgstr "Tulostusty lhetetty." +msgstr "Tulostustyö lähetetty." msgid "Add a new database" -msgstr "Lis uusi tietokanta" +msgstr "Lisää uusi tietokanta" msgid "Query for a pattern" msgstr "Hae kuviota" msgid "Show this message" -msgstr "Nyt tm viesti" +msgstr "Näytä tämä viesti" msgid "Kill a connection" msgstr "Tapa yhteys" @@ -2385,20 +2481,20 @@ msgid "Reinit all connections" msgstr "Alusta uudelleen yhteydet" msgid "Show connections" -msgstr "Nyt yhteydet" +msgstr "Näytä yhteydet" #, c-format msgid "E560: Usage: cs[cope] %s" -msgstr "E560: Kytt: cs[cope] %s" +msgstr "E560: Käyttö: cs[cope] %s" msgid "This cscope command does not support splitting the window.\n" -msgstr "Tm cscope-komento ei tue ikkunan jakamista.\n" +msgstr "Tämä cscope-komento ei tue ikkunan jakamista.\n" msgid "E562: Usage: cstag <ident>" -msgstr "E562: Kytt: cstag <ident>" +msgstr "E562: Käyttö: cstag <ident>" msgid "E257: cstag: tag not found" -msgstr "E257: cstag: tgia ei lydy" +msgstr "E257: cstag: tägia ei löydy" #, c-format msgid "E563: stat(%s) error: %d" @@ -2409,15 +2505,15 @@ msgstr "E563: stat-virhe" #, c-format msgid "E564: %s is not a directory or a valid cscope database" -msgstr "E564: %s ei ole hakemisto eik cscope-tietokanta" +msgstr "E564: %s ei ole hakemisto eikä cscope-tietokanta" #, c-format msgid "Added cscope database %s" -msgstr "Listty cscope-tietokanta %s" +msgstr "Lisätty cscope-tietokanta %s" #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: Virhe luettaessa cscope-yhteytt %ld" +msgstr "E262: Virhe luettaessa cscope-yhteyttä %ld" msgid "E561: unknown cscope search type" msgstr "E561: tuntematon cscope-hakutyyppi" @@ -2428,20 +2524,23 @@ msgstr "E566: Ei voitu luoda cscope-putkia" msgid "E622: Could not fork for cscope" msgstr "E622: Ei voitu haarauttaa cscopea" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid epäonnistui" + msgid "cs_create_connection exec failed" -msgstr "cs_create_connection eponnistui" +msgstr "cs_create_connection epäonnistui" msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen to_fp eponnistui" +msgstr "cs_create_connection: fdopen to_fp epäonnistui" msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen fr_fp eponnistui" +msgstr "cs_create_connection: fdopen fr_fp epäonnistui" msgid "E623: Could not spawn cscope process" -msgstr "E623: Cscope-prosessin luonti eponnistui" +msgstr "E623: Cscope-prosessin luonti epäonnistui" msgid "E567: no cscope connections" -msgstr "E567: ei cscope-yhteyksi" +msgstr "E567: ei cscope-yhteyksiä" #, c-format msgid "E469: invalid cscopequickfix flag %c for %c" @@ -2449,17 +2548,18 @@ msgstr "E469: virheellinen cscopequickfix-asetus %c kohteelle %c" #, c-format msgid "E259: no matches found for cscope query %s of %s" -msgstr "E259: ei tsmyksi cscope-hakuun %s/%s" +msgstr "E259: ei täsmäyksiä cscope-hakuun %s/%s" msgid "cscope commands:\n" msgstr "cscope-komennot:\n" #, c-format msgid "%-5s: %s%*s (Usage: %s)" -msgstr "%-5s: %s%*s (Kytt: %s)" +msgstr "%-5s: %s%*s (Käyttö: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2467,16 +2567,17 @@ msgid "" " g: Find this definition\n" " i: Find files #including this file\n" " s: Find this C symbol\n" -" t: Find assignments to\n" +" t: Find this text string\n" msgstr "" "\n" -" c: Etsi tt funktiota kutsuvat funktiot\n" -" d: Etsi tmn funktion kutsumat funktiot\n" -" e: Etsi tm egrep-lauseke\n" -" f: Find tm tiedosto\n" -" g: Etsi tm mritys\n" -" i: Etsi tiedostoja jotka #inkluudaavat tmn\n" -" s: Etsi tm C-symboli\n" +" a: Etsi sijotukset tähän symboliin\n" +" c: Etsi tätä funktiota kutsuvat funktiot\n" +" d: Etsi tämän funktion kutsumat funktiot\n" +" e: Etsi tämä egrep-lauseke\n" +" f: Etsi tämä tiedosto\n" +" g: Etsi tämä määritys\n" +" i: Etsi tiedostoja jotka #inkluudaavat tämän\n" +" s: Etsi tämä C-symboli\n" " t: Etsi sijoitukset muuttujaan \n" #, c-format @@ -2487,7 +2588,7 @@ msgid "E626: cannot get cscope database information" msgstr "E626: ei voi hakea cscope-tietokannan tietoja" msgid "E568: duplicate cscope database not added" -msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei listty" +msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei lisätty" #, c-format msgid "E261: cscope connection %s not found" @@ -2497,13 +2598,12 @@ msgstr "E261: cscope-yhteys %s puuttuu" msgid "cscope connection %s closed" msgstr "cscope-yhteys %s on katkaistu" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: kriittinen virhe cs_manage_matches-funktiossa" #, c-format msgid "Cscope tag: %s" -msgstr "Cscope-tgi: %s" +msgstr "Cscope-tägi: %s" msgid "" "\n" @@ -2523,10 +2623,10 @@ msgid "All cscope databases reset" msgstr "Kaikki cscope-tietokannat nollattu" msgid "no cscope connections\n" -msgstr "ei cscope-yhteyksi\n" +msgstr "ei cscope-yhteyksiä\n" msgid " # pid database name prepend path\n" -msgstr " # pid tietokanta lisyspolku\n" +msgstr " # pid tietokanta lisäyspolku\n" msgid "Lua library cannot be loaded." msgstr "Luan kirjastoa ei voitu ladata." @@ -2537,13 +2637,18 @@ msgstr "ei voitu tallentaa kumoustietoja" msgid "" "E815: Sorry, this command is disabled, the MzScheme libraries could not be " "loaded." -msgstr "E815: Sori, komento ei toimi, MzScheme-kirjastoa ei voitu ladata." +msgstr "E815: komento ei toimi, MzScheme-kirjastoa ei voitu ladata." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "E895: Komento ei toimi, MzScheme-moduulia racket/base ei voitu ladata." msgid "invalid expression" msgstr "virheellinen ilmaus" msgid "expressions disabled at compile time" -msgstr "ilmaukset poistettu kytst knnsaikana" +msgstr "ilmaukset poistettu käytöstä käännösaikana" msgid "hidden option" msgstr "piilotettu asetus" @@ -2558,16 +2663,19 @@ msgid "couldn't open buffer" msgstr "ei voitu avata puskuria" msgid "cannot delete line" -msgstr "ei voitu poistaa rivi" +msgstr "ei voitu poistaa riviä" msgid "cannot replace line" -msgstr "ei voitu korvata rivi" +msgstr "ei voitu korvata riviä" msgid "cannot insert line" -msgstr "ei voitu list rivi" +msgstr "ei voitu lisätä riviä" msgid "string cannot contain newlines" -msgstr "merkkijono ei saa sislt rivinvaihtoja" +msgstr "merkkijono ei saa sisältää rivinvaihtoja" + +msgid "error converting Scheme values to Vim" +msgstr "virhe Schemestä Vimiin konversiossa" msgid "Vim error: ~a" msgstr "Vim-virhe: ~a" @@ -2587,40 +2695,32 @@ msgstr "rivinumero arvoalueen ulkopuolelta" msgid "not allowed in the Vim sandbox" msgstr "ei sallittu Vimin hiekkalaatikossa" -msgid "E836: This Vim cannot execute :python after using :py3" -msgstr "E836: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa" - msgid "E837: This Vim cannot execute :py3 after using :python" -msgstr "E837: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa" +msgstr "E837: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa" msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." -msgstr "" -"E263: Sori, komento ei toimi, Python-kirjaston lataaminen ei onnistunut." - -msgid "can't delete OutputObject attributes" -msgstr "ei voi poistaa OutputObject-attribuutteja" +msgstr "E263: komento ei toimi, Python-kirjaston lataaminen ei onnistunut." -msgid "softspace must be an integer" -msgstr "softspacen pit olla kokonaisluku" - -msgid "invalid attribute" -msgstr "virheellinen attribuutti" +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa" -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<puskuriolio (poistettu) kohdassa %p>" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Komento ei toimi, Pythonin site-moduulien lataaminen ei onnistunut." msgid "E659: Cannot invoke Python recursively" msgstr "E659: Pythonia ei voi kutsua rekursiivisesti" msgid "E265: $_ must be an instance of String" -msgstr "E265: muuttujan $_ pit olla Stringin instanssi" +msgstr "E265: muuttujan $_ pitää olla Stringin instanssi" msgid "" "E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "E266: Sori, komento ei toimi, Ruby-kirjastoa ei voitu ladata." +msgstr "E266: komento ei toimi, Ruby-kirjastoa ei voitu ladata." msgid "E267: unexpected return" msgstr "E267: odotuksenvastainen return" @@ -2638,110 +2738,20 @@ msgid "E271: retry outside of rescue clause" msgstr "E271: retry rescuen ulkopuolella" msgid "E272: unhandled exception" -msgstr "E272: ksittelemtn poikkeus" +msgstr "E272: käsittelemätön poikkeus" #, c-format msgid "E273: unknown longjmp status %d" msgstr "E273: tuntematon longjmp-tila %d" -msgid "Toggle implementation/definition" -msgstr "Vaihda toteutuksen ja mritelmn vlill" - -msgid "Show base class of" -msgstr "Nyt kantaluokka kohteelle" - -msgid "Show overridden member function" -msgstr "Nyt korvattu jsenfunktio" - -msgid "Retrieve from file" -msgstr "Jljit tiedostosta" - -msgid "Retrieve from project" -msgstr "Jljit projektista" - -msgid "Retrieve from all projects" -msgstr "Jljit kaikista projekteista" - -msgid "Retrieve" -msgstr "Jljit" - -msgid "Show source of" -msgstr "Nyt lhdekoodi kohteelle" - -msgid "Find symbol" -msgstr "Etsi symboli" - -msgid "Browse class" -msgstr "Selaa luokkaa" - -msgid "Show class in hierarchy" -msgstr "Nyt luokka hierarkiassa" - -msgid "Show class in restricted hierarchy" -msgstr "Nyt luokka rajoitetussa hierarkiassa" - -msgid "Xref refers to" -msgstr "Xref viittaa kohteeseen" - -msgid "Xref referred by" -msgstr "Xref viitattu kohteesta" - -msgid "Xref has a" -msgstr "Xref sislt kohteen" - -msgid "Xref used by" -msgstr "Xrefi kytt" - -msgid "Show docu of" -msgstr "Nyt dokumentti kohteelle" - -msgid "Generate docu for" -msgstr "Luo dokumentti kohteelle" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"Ei voida yhdist SNiFF+:aan. Tarkista ympristmuuttujat (sniffemacsin " -"lyty polkumuuttujasta $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Virhe luettaessa, yhteys katkaistu" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ " - -msgid "not " -msgstr "ei ole " - -msgid "connected" -msgstr "yhdistetty" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Tuntematon SNiFF+-pyynt: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Virhe yhdistettess SNiFF+:aan" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ ei ole yhdistetty" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Ei ole SNiFF+-puskuri" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Virhe kirjoituksessa, yhteys katkaistu" - msgid "invalid buffer number" msgstr "virheellinen puskurinumero" msgid "not implemented yet" msgstr "ei toteutettu" -#. ??? msgid "cannot set line(s)" -msgstr "ei voi asettaa rivej" +msgstr "ei voi asettaa rivejä" msgid "invalid mark name" msgstr "virheellinen merkin nimi" @@ -2754,7 +2764,7 @@ msgid "row %d column %d" msgstr "rivi %d sarake %d" msgid "cannot insert/append line" -msgstr "rivin lisys ei onnistu" +msgstr "rivin lisäys ei onnistu" msgid "line number out of range" msgstr "rivinumero arvoalueen ulkopuolella" @@ -2766,7 +2776,7 @@ msgid "unknown vimOption" msgstr "tuntematon vimOption" msgid "keyboard interrupt" -msgstr "nppimistkeskeytys" +msgstr "näppäimistökeskeytys" msgid "vim error" msgstr "vim-virhe" @@ -2776,9 +2786,8 @@ msgstr "ei voi luoda puskuri- tai ikkunakomentoa, olio on poistumassa" msgid "" "cannot register callback command: buffer/window is already being deleted" -msgstr "callbackia ei voi rekisterid: puskuri tai ikkuna on poistettu" +msgstr "callbackia ei voi rekisteröidä: puskuri tai ikkuna on poistettu" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2787,30 +2796,24 @@ msgstr "" "postituslistalle vim-dev@vim.org" msgid "cannot register callback command: buffer/window reference not found" -msgstr "callbackia ei voi rekisterid: puskurin tai ikkunan viitett ei lydy" +msgstr "callbackia ei voi rekisteröidä: puskurin tai ikkunan viitettä ei löydy" msgid "" "E571: Sorry, this command is disabled: the Tcl library could not be loaded." -msgstr "E571: Sori, komento ei toimi, Tcl-kirjastoa ei voitu ladata." - -msgid "" -"E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "" -"E281: TCL-virhe: lopetuskoodi ei ole kokonaisluku? Ilmoita asiasta " -"postituslistalle vim-dev@vim.org" +msgstr "E571: komento ei toimi, Tcl-kirjastoa ei voitu ladata." #, c-format msgid "E572: exit code %d" msgstr "E572: palautusarvo %d" msgid "cannot get line" -msgstr "ei voida hakea rivi" +msgstr "ei voida hakea riviä" msgid "Unable to register a command server name" -msgstr "Komentopalvelimen nimen rekisterinti ei onnistu" +msgstr "Komentopalvelimen nimen rekisteröinti ei onnistu" msgid "E248: Failed to send command to the destination program" -msgstr "E248: Komennon lhetys kohdeohjelmalle ei onnistu" +msgstr "E248: Komennon lähetys kohdeohjelmalle ei onnistu" #, c-format msgid "E573: Invalid server id used: %s" @@ -2819,6 +2822,18 @@ msgstr "E573: Virheellinen palvelimen tunniste: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIMin instanssin rekisteriarvo on virheellinen, poistettiin." +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Kaksi samaa avainta JSONissa: %s" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Listasta puuttuu pilkku: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Listan lopusta puuttuu ]: %s" + msgid "Unknown option argument" msgstr "Tuntematon asetusargumentti" @@ -2829,26 +2844,26 @@ msgid "Argument missing after" msgstr "Argumentti puuttuu kohdasta" msgid "Garbage after option argument" -msgstr "Roskaa argumentin perss" +msgstr "Roskaa argumentin perässä" msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" msgstr "Liikaa +komentoja, -c-komentoja tai --cmd-komentoja" msgid "Invalid argument for" -msgstr "Vr argumentti valitsimelle" +msgstr "Väärä argumentti valitsimelle" #, c-format msgid "%d files to edit\n" msgstr "%d tiedostoa muokattavana\n" msgid "netbeans is not supported with this GUI\n" -msgstr "netbeans ei toimi tss kyttliittymss\n" - -msgid "This Vim was not compiled with the diff feature." -msgstr "Thn Vimiin ei ole knnetty diff-toimintoja mukaan." +msgstr "netbeans ei toimi tässä käyttöliittymässä\n" msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr "-nb:t ei voi kytt, koska sit ei knnetty mukaan\n" +msgstr "-nb:tä ei voi käyttää, koska sitä ei käännetty mukaan\n" + +msgid "This Vim was not compiled with the diff feature." +msgstr "Tähän Vimiin ei ole käännetty diff-toimintoja mukaan." msgid "Attempt to open script file again: \"" msgstr "Yritettiin avata skriptitiedostoa uudestaan:" @@ -2860,15 +2875,17 @@ msgid "Cannot open for script output: \"" msgstr "Ei voi avata skriptin tulostetta varten: " msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Virhe: Gvimin kynnistys NetBeansist ei onnistu\n" +msgstr "Vim: Virhe: Gvimin käynnistys NetBeansistä ei onnistu\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Virhe: Tämä versio Vimistä ei toimi Cygwinin terminaalissa\n" msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Varoitus: Tuloste ei mene terminaalille\n" msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Varoitus: Syte ei tule terminaalilta\n" +msgstr "Vim: Varoitus: Syöte ei tule terminaalilta\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "esi-vimrc-komentorivi" @@ -2881,19 +2898,19 @@ msgid "" "More info with: \"vim -h\"\n" msgstr "" "\n" -"Listietoja: \"vim -h\"\n" +"Lisätietoja: \"vim -h\"\n" msgid "[file ..] edit specified file(s)" msgstr "[tiedosto ..] muokkaa tiedostoja" msgid "- read text from stdin" -msgstr "- lue vakiosytteest" +msgstr "- lue vakiosyötteestä" msgid "-t tag edit file where tag is defined" -msgstr "-t tgi muokkaa tiedostoa tgist" +msgstr "-t tägi muokkaa tiedostoa tägistä" msgid "-q [errorfile] edit file with first error" -msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmisest virheest" +msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmäisestä virheestä" msgid "" "\n" @@ -2902,7 +2919,7 @@ msgid "" msgstr "" "\n" "\n" -"kytt:" +"käyttö:" msgid " vim [arguments] " msgstr " vim [argumentit] " @@ -2919,7 +2936,7 @@ msgid "" "Where case is ignored prepend / to make flag upper case" msgstr "" "\n" -"Jos aakkoslaji on ohitettu, lis alkuun / tehdksesi asetuksesta " +"Jos aakkoslaji on ohitettu, lisää alkuun / tehdäksesi asetuksesta " "suuraakkosia" msgid "" @@ -2932,52 +2949,55 @@ msgstr "" "Argumentit:\n" msgid "--\t\t\tOnly file names after this" -msgstr "--\t\t\tvain tiedostonimi tmn jlkeen" +msgstr "--\t\t\tvain tiedostonimiä tämän jälkeen" msgid "--literal\t\tDon't expand wildcards" -msgstr "--literal\t\tl ksittele jokerimerkkej " +msgstr "--literal\t\tÄlä käsittele jokerimerkkejä " msgid "-register\t\tRegister this gvim for OLE" -msgstr "-register\t\trekisteri gvim OLEa varten" +msgstr "-register\t\trekisteröi gvim OLEa varten" msgid "-unregister\t\tUnregister gvim for OLE" -msgstr "-unregister\t\tPoista gvim OLE-rekisterist" +msgstr "-unregister\t\tPoista gvim OLE-rekisteristä" msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tAvaa GUI (kuten gvimill)" +msgstr "-g\t\t\tAvaa GUI (kuten gvimillä)" msgid "-f or --nofork\tForeground: Don't fork when starting GUI" -msgstr "-f tai --nofork\tEdustalle: l haarauta GUIn kynnistyksess" +msgstr "-f tai --nofork\tEdustalle: Älä haarauta GUIn käynnistyksessä" msgid "-v\t\t\tVi mode (like \"vi\")" -msgstr "-v\t\t\tVi-tila (kuten vill)" +msgstr "-v\t\t\tVi-tila (kuten villä)" msgid "-e\t\t\tEx mode (like \"ex\")" -msgstr "-e\t\t\tEx-tila (kute exill)" +msgstr "-e\t\t\tEx-tila (kute exillä)" + +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tParanneltu Ex-tila" msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\tHiljainen (erajo)tila (vain exill)" +msgstr "-s\t\t\tHiljainen (eräajo)tila (vain exillä)" msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tDiff-tila (kuten vimdiffill)" +msgstr "-d\t\t\tDiff-tila (kuten vimdiffillä)" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tHelppokytttila (kuten evimiss, ilman tiloja)" +msgstr "-y\t\t\tHelppokäyttötila (kuten evimissä, ilman tiloja)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)" msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\tRajoitettu tila (kuten rvimill)" +msgstr "-Z\t\t\tRajoitettu tila (kuten rvimillä)" msgid "-m\t\t\tModifications (writing files) not allowed" -msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois kytst" +msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois käytöstä" msgid "-M\t\t\tModifications in text not allowed" -msgstr "-M\t\t\tTekstin muokkaus pois kytst" +msgstr "-M\t\t\tTekstin muokkaus pois käytöstä" msgid "-b\t\t\tBinary mode" -msgstr "-b\t\t\tBinritila" +msgstr "-b\t\t\tBinääritila" msgid "-l\t\t\tLisp mode" msgstr "-l\t\t\tLisp-tila" @@ -2993,10 +3013,10 @@ msgstr "" "-V[N][tnimi]\t\tMonisanainen tuloste [Taso N] [kirjoita tuloste tnimeen] " msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\tVianetsinttila" +msgstr "-D\t\t\tVianetsintätila" msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tEi swap-tiedostoja, kyt muistia" +msgstr "-n\t\t\tEi swap-tiedostoja, käytä muistia" msgid "-r\t\t\tList swap files and exit" msgstr "-r\t\t\tLuetteloi swap-tiedostot ja poistu" @@ -3008,34 +3028,41 @@ msgid "-L\t\t\tSame as -r" msgstr "-L\t\t\tkuten -r" msgid "-f\t\t\tDon't use newcli to open window" -msgstr "-f\t\t\tl kyt newcli:t ikkunan avaamiseen" +msgstr "-f\t\t\tÄlä käytä newcli:tä ikkunan avaamiseen" msgid "-dev <device>\t\tUse <device> for I/O" -msgstr "-dev <laite>\t\tKyt <laitetta> IO:hon" +msgstr "-dev <laite>\t\tKäytä <laitetta> IO:hon" msgid "-A\t\t\tstart in Arabic mode" -msgstr "-A\t\t\tkynnist arabia-tilassa" +msgstr "-A\t\t\tkäynnistä arabia-tilassa" msgid "-H\t\t\tStart in Hebrew mode" -msgstr "-H\t\t\tkynnist heprea-tilassa" +msgstr "-H\t\t\tkäynnistä heprea-tilassa" msgid "-F\t\t\tStart in Farsi mode" -msgstr "-F\t\t\tkynnist farsi-tilassa" +msgstr "-F\t\t\tkäynnistä farsi-tilassa" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminaali>\tAseta terminaalin tyypiksi <terminaali>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tOhita varoitus siitä että i/o ei ole terminaali" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tLopeta jos syöttö tai tuloste ei tule terminaalista tai " +"terminaaliin vastaavasti" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" -msgstr "-u <vimrc>\t\tKyt <vimrc>-tiedostoa .vimrc:iden sijasta" +msgstr "-u <vimrc>\t\tKäytä <vimrc>-tiedostoa .vimrc:iden sijasta" msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc" -msgstr "-U <gvimrc>\t\tKyt <gvimrc>-tiedostoa .gvimrc:iden sijasta" +msgstr "-U <gvimrc>\t\tKäytä <gvimrc>-tiedostoa .gvimrc:iden sijasta" msgid "--noplugin\t\tDon't load plugin scripts" -msgstr "--noplugin\t\tl lataa liitnnisi" +msgstr "--noplugin\t\tÄlä lataa liitännäisiä" msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tAvaa N vlilehte (oletus: yksi per tiedosto)" +msgstr "-p[N]\t\tAvaa N välilehteä (oletus: yksi per tiedosto)" msgid "-o[N]\t\tOpen N windows (default: one for each file)" msgstr "-o[N]\t\tAvaa N ikkunaa (oletus: yksi per tiedosto)" @@ -3047,22 +3074,22 @@ msgid "+\t\t\tStart at end of file" msgstr "+\t\t\tAloita tiedoston lopusta" msgid "+<lnum>\t\tStart at line <lnum>" -msgstr "+<rivi>\t\t\tAloita rivilt <rivi>" +msgstr "+<rivi>\t\t\tAloita riviltä <rivi>" msgid "--cmd <command>\tExecute <command> before loading any vimrc file" msgstr "--cmd <komento>\tSuorita <komento> ennen vimrc:iden latausta" msgid "-c <command>\t\tExecute <command> after loading the first file" -msgstr "-c <komento>\t\tSuorita <komento> ensimmisen tiedoston latauduttua" +msgstr "-c <komento>\t\tSuorita <komento> ensimmäisen tiedoston latauduttua" msgid "-S <session>\t\tSource file <session> after loading the first file" -msgstr "-S <sessio>\t\tLataa <sessio> ensimmisen tiedoston latauduttua" +msgstr "-S <sessio>\t\tLataa <sessio> ensimmäisen tiedoston latauduttua" msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" msgstr "-s <skripti>\tLue normaalitilan komentoja <skripti>-tiedostosta" msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" -msgstr "-w <skripti>\tLis kirjoitetut komennot <skripti>-tiedostoon" +msgstr "-w <skripti>\tLisää kirjoitetut komennot <skripti>-tiedostoon" msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" msgstr "-W <skripti>\tKirjoita komennot <skripti>-tiedostoon" @@ -3071,10 +3098,10 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tMuokkaa salattua tiedostoa" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <nytt>\tYhdist vim tiettyyn X-palvelimeen" +msgstr "-display <näyttö>\tYhdistä vim tiettyyn X-palvelimeen" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tl yhdist X-palvelimeen" +msgstr "-X\t\t\tÄlä yhdistä X-palvelimeen" msgid "--remote <files>\tEdit <files> in a Vim server if possible" msgstr "" @@ -3082,7 +3109,7 @@ msgstr "" msgid "--remote-silent <files> Same, don't complain if there is no server" msgstr "" -"--remote-silent <tiedostoja>\tSama, mutta l ilmoita puuttuvasta " +"--remote-silent <tiedostoja>\tSama, mutta älä ilmoita puuttuvasta " "palvelimesta" msgid "" @@ -3094,37 +3121,41 @@ msgstr "" msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent <tiedostoja> sama, mutta l ilmoita puuttuvasta " +"--remote-wait-silent <tiedostoja> sama, mutta älä ilmoita puuttuvasta " "palvelimesta" msgid "" "--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" msgstr "" "--remote-tab[-wait][-silent] <tiedostoja> kuten --remote, mutta avaa " -"vlilehti joka tiedostolle" +"välilehti joka tiedostolle" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" msgstr "" -"--remote-send <nppimi>\tLhet <nppimi> painalluksina Vimille ja lopeta" +"--remote-send <näppäimiä>\tLähetä <näppäimiä> painalluksina Vimille ja lopeta" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" msgstr "" -"--remote-expr <ilmaus>\tKsittele <ilmaus> Vim-palvelimella ja tulosta tulos" +"--remote-expr <ilmaus>\tKäsittele <ilmaus> Vim-palvelimella ja tulosta tulos" msgid "--serverlist\t\tList available Vim server names and exit" msgstr "--serverlist\t\tLuettele Vim-palvelinten nimet ja lopeta" msgid "--servername <name>\tSend to/become the Vim server <name>" -msgstr "--servername <nimi>\tLhet Vim-palvelimelle <nimi> tai luo se" +msgstr "--servername <nimi>\tLähetä Vim-palvelimelle <nimi> tai luo se" msgid "--startuptime <file>\tWrite startup timing messages to <file>" -msgstr "--startuptime <file>\tKirjoita kynnistysaikaviestit tiedostoon <file>" +msgstr "--startuptime <file>\tKirjoita käynnistysaikaviestit tiedostoon <file>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" -msgstr "-i <viminfo>\t\tKyt <viminfo>-tiedostoa .viminfon sijaan" +msgstr "-i <viminfo>\t\tKäytä <viminfo>-tiedostoa .viminfon sijaan" + +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible', Vimin oletukset," +"ei liitännäisiä tai viminfoa" msgid "-h or --help\tPrint Help (this message) and exit" -msgstr "-h tai --help\tTulosta ohje (tm viesti) ja lopeta" +msgstr "-h tai --help\tTulosta ohje (tämä viesti) ja lopeta" msgid "--version\t\tPrint version information and exit" msgstr "--version\t\t\tTulosta versiotiedot ja lopeta" @@ -3151,62 +3182,49 @@ msgstr "" "Gvimin (Athena-version) tuntemat argumentit:\n" msgid "-display <display>\tRun vim on <display>" -msgstr "-display <nytt>\tSuorita vim <nytss>" +msgstr "-display <näyttö>\tSuorita vim <näytössä>" msgid "-iconic\t\tStart vim iconified" -msgstr "-iconic\t\tKynnist pienennettyn" +msgstr "-iconic\t\tKäynnistä pienennettynä" msgid "-background <color>\tUse <color> for the background (also: -bg)" -msgstr "-background <vri>\tKyt <vri> taustavrin (mys: -bg)" +msgstr "-background <väri>\tKäytä <väriä> taustavärinä (myös: -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" -msgstr "-foreground <vri>\tKyt <vri> tekstin vrin (mys: -fg)" +msgstr "-foreground <väri>\tKäytä <väriä> tekstin värinä (myös: -fg)" msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" -msgstr "-font <fontti>\t\tKyt <fonttia> tekstiss (mys: -fn)" +msgstr "-font <fontti>\t\tKäytä <fonttia> tekstissä (myös: -fn)" msgid "-boldfont <font>\tUse <font> for bold text" -msgstr "-boldfont <fontti>\tKyt <fonttia> lihavoidussa tekstiss" +msgstr "-boldfont <fontti>\tKäytä <fonttia> lihavoidussa tekstissä" msgid "-italicfont <font>\tUse <font> for italic text" -msgstr "-italicfont <fontti>\tKyt <fonttia> kursivoidussa tekstiss" +msgstr "-italicfont <fontti>\tKäytä <fonttia> kursivoidussa tekstissä" msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" msgstr "" -"-geometry <geom>\tKyt mittoja <geom> ikkunan asetteluun (mys: -geom)" +"-geometry <geom>\tKäytä mittoja <geom> ikkunan asetteluun (myös: -geom)" msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" -msgstr "-borderwidt <leveys>\tKyt <leveytt> reunuksissa (mys: -bw) " +msgstr "-borderwidt <leveys>\tKäytä <leveyttä> reunuksissa (myös: -bw) " msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" msgstr "" -"-scrollbarwidth <leveys> Kyt <leveytt> vierityspalkissa (mys: -sw)" +"-scrollbarwidth <leveys> Käytä <leveyttä> vierityspalkissa (myös: -sw)" msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" -msgstr "-menuheight <korkeus>\tKyt <korkeutta> valikossa (mys: -mh)" +msgstr "-menuheight <korkeus>\tKäytä <korkeutta> valikossa (myös: -mh)" msgid "-reverse\t\tUse reverse video (also: -rv)" -msgstr "-reverse\t\tKyt knteisvrej (mys: -rv) " +msgstr "-reverse\t\tKäytä käänteisvärejä (myös: -rv) " msgid "+reverse\t\tDon't use reverse video (also: +rv)" -msgstr "+reverse\t\tl kyt knteisvrej (mys: +rv)" +msgstr "+reverse\t\tÄlä käytä käänteisvärejä (myös: +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <resurssi>\tAseta resurssi" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"Gvimin (RISC OS -version) tuntemat argumentit:\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <luku>\tIkkunan alkuleveys sarakkeina" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <luku>\tIkkunan alkukorkeus rivein" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" @@ -3215,51 +3233,51 @@ msgstr "" "Gvimin (GTK+-version) tuntemat argumentit:\n" msgid "-display <display>\tRun vim on <display> (also: --display)" -msgstr "-display <nytt>\tSuorita vim nytll <nytt> (mys: --display)" +msgstr "-display <näyttö>\tSuorita vim näytöllä <näyttö> (myös: --display)" -# X-ikkunointijrjestelmss saman sovelluksen saman luokan ikkunat +# X-ikkunointijärjestelmässä saman sovelluksen saman luokan ikkunat # tunnistetaan rooliresursseista msgid "--role <role>\tSet a unique role to identify the main window" -msgstr "--role <rooli>\tAseta pikkunalle ainutlaatuinen rooli tunnisteeksi" +msgstr "--role <rooli>\tAseta pääikkunalle ainutlaatuinen rooli tunnisteeksi" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\tAvaa Vim annettuun GTK-olioon " +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tTulosta gvimin Window ID vakiotulosteeseen" + msgid "-P <parent title>\tOpen Vim inside parent application" -msgstr "-P <otsikko>\tAvaa Vim isntohjelman sisn" +msgstr "-P <otsikko>\tAvaa Vim isäntäohjelman sisään" msgid "--windowid <HWND>\tOpen Vim inside another win32 widget" msgstr "--windowid <HWND>\tAvaa Vim annettuun win32-olioon " msgid "No display" -msgstr "Ei nytt" +msgstr "Ei näyttöä" -#. Failed to send, abort. msgid ": Send failed.\n" -msgstr ": Lhetys eponnistui.\n" +msgstr ": Lähetys epäonnistui.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" -msgstr ": Lhetys eponnistui. Yritetn suorittaa paikallisena\n" +msgstr ": Lähetys epäonnistui. Yritetään suorittaa paikallisena\n" #, c-format msgid "%d of %d edited" msgstr "%d/%d muokattu" msgid "No display: Send expression failed.\n" -msgstr "Ei nytt: Ilmauksen lhetys eponnistui.\n" +msgstr "Ei näyttöä: Ilmauksen lähetys epäonnistui.\n" msgid ": Send expression failed.\n" -msgstr ": Ilmauksen lhetys eponnistui.\n" +msgstr ": Ilmauksen lähetys epäonnistui.\n" msgid "No marks set" -msgstr "Ei asetettuja merkkej" +msgstr "Ei asetettuja merkkejä" #, c-format msgid "E283: No marks matching \"%s\"" -msgstr "E283: Mikn merkki ei tsm ilmaukseen \"%s\"" +msgstr "E283: Mikään merkki ei täsmää ilmaukseen \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3267,7 +3285,6 @@ msgstr "" "\n" "merkki rivi sarake tiedosto/teksti" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3275,7 +3292,6 @@ msgstr "" "\n" "hyppy rivi sarake tiedosto/teksti" -#. Highlight title msgid "" "\n" "change line col text" @@ -3283,7 +3299,6 @@ msgstr "" "\n" "muutos rivi sarake teksti" -#, c-format msgid "" "\n" "# File marks:\n" @@ -3291,8 +3306,6 @@ msgstr "" "\n" "# Tiedoston merkit:\n" -#. Write the jumplist with -' -#, c-format msgid "" "\n" "# Jumplist (newest first):\n" @@ -3300,7 +3313,6 @@ msgstr "" "\n" "# Hyppylista (uusin ensiksi):\n" -#, c-format msgid "" "\n" "# History of marks within files (newest to oldest):\n" @@ -3312,26 +3324,26 @@ msgid "Missing '>'" msgstr "> puuttuu" msgid "E543: Not a valid codepage" -msgstr "E543: Koodisivu ei ole kyp" +msgstr "E543: Koodisivu ei ole käypä" msgid "E284: Cannot set IC values" msgstr "E284: Ei voi asettaa IC-arvoja" msgid "E285: Failed to create input context" -msgstr "E285: Sytekontekstin luonti ei onnistu" +msgstr "E285: Syötekontekstin luonti ei onnistu" msgid "E286: Failed to open input method" -msgstr "E286: Sytemetodin avaus ei onnistu" +msgstr "E286: Syötemetodin avaus ei onnistu" msgid "E287: Warning: Could not set destroy callback to IM" msgstr "" -"E287: Varoitus: Ei voitu asettaa destroy-kutsua sytemetodipalvelimelle" +"E287: Varoitus: Ei voitu asettaa destroy-kutsua syötemetodipalvelimelle" msgid "E288: input method doesn't support any style" -msgstr "E288: sytemetodi ei tue tyylej" +msgstr "E288: syötemetodi ei tue tyylejä" msgid "E289: input method doesn't support my preedit type" -msgstr "E289: sytemetodi ei tue tt preedit-tyyppi" +msgstr "E289: syötemetodi ei tue tätä preedit-tyyppiä" msgid "E293: block was not locked" msgstr "E293: lohkoa ei ole lukittu" @@ -3349,20 +3361,22 @@ msgid "E297: Write error in swap file" msgstr "E297: Kirjoitusvirhe swap-tiedostossa" msgid "E300: Swap file already exists (symlink attack?)" -msgstr "E300: Swaptiedosto on jo olemassa (symlink-hykkys?)" +msgstr "E300: Swaptiedosto on jo olemassa (symlink-hyökkäys?)" msgid "E298: Didn't get block nr 0?" msgstr "E298: Lohko 0:aa ei saatu?" msgid "E298: Didn't get block nr 1?" -msgstr "E298: Lohko 1:t ei saatu?" +msgstr "E298: Lohko 1:tä ei saatu?" msgid "E298: Didn't get block nr 2?" msgstr "E298: Lohko 2:ta ei saatu?" -#. could not (re)open the swap file, what can we do???? +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Virhe päivitettäessä swapin kryptausta" + msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: Hups, swap-tiedosto hvisi!" +msgstr "E301: Hups, swap-tiedosto hävisi!" msgid "E302: Could not rename swap file" msgstr "E302: Swap-tiedoston uudellennimeys ei onnistu" @@ -3393,20 +3407,20 @@ msgid "" "Maybe no changes were made or Vim did not update the swap file." msgstr "" "\n" -"Muutoksia ei tehty, tai Vim ei pivittnyt swap-tiedostoa." +"Muutoksia ei tehty, tai Vim ei päivittänyt swap-tiedostoa." msgid " cannot be used with this version of Vim.\n" -msgstr " ei toimi tmn version Vimin kanssa.\n" +msgstr " ei toimi tämän version Vimin kanssa.\n" msgid "Use Vim version 3.0.\n" -msgstr "Kyt Vimin versiota 3.0\n" +msgstr "Käytä Vimin versiota 3.0\n" #, c-format msgid "E307: %s does not look like a Vim swap file" msgstr "E307: %s ei ole Vimin swap-tiedosto" msgid " cannot be used on this computer.\n" -msgstr " ei toimi tll koneella.\n" +msgstr " ei toimi tällä koneella.\n" msgid "The file was created on " msgstr "Tiedosto luotiin " @@ -3421,21 +3435,21 @@ msgstr "" #, c-format msgid "" "E833: %s is encrypted and this version of Vim does not support encryption" -msgstr "E833: %s on salattu eik tm Vim tue salausta" +msgstr "E833: %s on salattu eikä tämä Vim tue salausta" msgid " has been damaged (page size is smaller than minimum value).\n" -msgstr " on vioittunut (sivun koko on vhimmisarvoa pienempi).\n" +msgstr " on vioittunut (sivun koko on vähimmäisarvoa pienempi).\n" #, c-format msgid "Using swap file \"%s\"" -msgstr "Kytetn swap-tiedostoa %s" +msgstr "Käytetään swap-tiedostoa %s" #, c-format msgid "Original file \"%s\"" -msgstr "Alkuperinen tiedosto %s" +msgstr "Alkuperäinen tiedosto %s" msgid "E308: Warning: Original file may have been changed" -msgstr "E308: Varoitus: Alkuperist tiedostoa saattaa olla muutettu" +msgstr "E308: Varoitus: Alkuperäistä tiedostoa saattaa olla muutettu" #, c-format msgid "Swap file is encrypted: \"%s\"" @@ -3444,55 +3458,59 @@ msgstr "Swap-tiedosto on salattu: %s" msgid "" "\n" "If you entered a new crypt key but did not write the text file," -msgstr "\n" -"Jos kytit uutta salausavainta muttet kirjoittanut tekstitiedostoa," +msgstr "" +"\n" +"Jos käytit uutta salausavainta muttet kirjoittanut tekstitiedostoa," msgid "" "\n" "enter the new crypt key." -msgstr "\n" +msgstr "" +"\n" "anna uusi salausavain." msgid "" "\n" "If you wrote the text file after changing the crypt key press enter" -msgstr "\n" -"Jos kirjoitit tekstitiedoston salausavaimen vaihdon jlkeen paina enteri" +msgstr "" +"\n" +"Jos kirjoitit tekstitiedoston salausavaimen vaihdon jälkeen paina enteriä" msgid "" "\n" "to use the same key for text file and swap file" -msgstr "\n" -"kyttksesi samaa avainta teksti- ja swppitiedostoille" +msgstr "" +"\n" +"käyttääksesi samaa avainta teksti- ja swäppitiedostoille" #, c-format msgid "E309: Unable to read block 1 from %s" msgstr "E309: Ei voitu lukea lohkoa 1 tiedostosta %s" msgid "???MANY LINES MISSING" -msgstr "???PALJON RIVEJ PUUTTUU" +msgstr "???PALJON RIVEJÄ PUUTTUU" msgid "???LINE COUNT WRONG" -msgstr "???RIVIMR PIELESS" +msgstr "???RIVIMÄÄRÄ PIELESSÄ" msgid "???EMPTY BLOCK" -msgstr "???TYHJ LOHKO" +msgstr "???TYHJÄ LOHKO" msgid "???LINES MISSING" -msgstr "???RIVEJ PUUTTUU" +msgstr "???RIVEJÄ PUUTTUU" #, c-format msgid "E310: Block 1 ID wrong (%s not a .swp file?)" -msgstr "E310: Lohon 1 tunniste vr (%s ei ole .swp-tiedosto?)" +msgstr "E310: Lohon 1 tunniste väärä (%s ei ole .swp-tiedosto?)" msgid "???BLOCK MISSING" msgstr "???LOHKO PUUTTUU" msgid "??? from here until ???END lines may be messed up" -msgstr "??? tst kohtaan ???LOPPU rivej sekaisin" +msgstr "??? tästä kohtaan ???LOPPU rivejä sekaisin" msgid "??? from here until ???END lines may have been inserted/deleted" -msgstr "??? tst kohtaan ???LOPPU rivej saattaa olla listty tai poistettu" +msgstr "??? tästä kohtaan ???LOPPU rivejä saattaa olla lisätty tai poistettu" msgid "???END" msgstr "???LOPPU" @@ -3502,53 +3520,53 @@ msgstr "E311: Palautus keskeytetty" msgid "" "E312: Errors detected while recovering; look for lines starting with ???" -msgstr "E312: Palautuksessa oli virheit, etsi rivej, jotka alkavat ???" +msgstr "E312: Palautuksessa oli virheitä, etsi rivejä, jotka alkavat ???" msgid "See \":help E312\" for more information." -msgstr ":help E312 kertoo listietoja" +msgstr ":help E312 kertoo lisätietoja" msgid "Recovery completed. You should check if everything is OK." -msgstr "Palautus onnistui. Tarkista, ett kaikki on kunnossa." +msgstr "Palautus onnistui. Tarkista, että kaikki on kunnossa." msgid "" "\n" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(Saattaa kannattaa kirjoittaa tm tiedosto toisella nimell\n" +"(Saattaa kannattaa kirjoittaa tämä tiedosto toisella nimellä\n" msgid "and run diff with the original file to check for changes)" -msgstr "ja katso diffill muutokset alkuperiseen tiedostoon)" +msgstr "ja katso diffillä muutokset alkuperäiseen tiedostoon)" msgid "Recovery completed. Buffer contents equals file contents." -msgstr "Palautus onnistui. Puskurin ja tiedoston sisllt tsmvt." +msgstr "Palautus onnistui. Puskurin ja tiedoston sisällöt täsmäävät." msgid "" "\n" "You may want to delete the .swp file now.\n" "\n" -msgstr "\n" +msgstr "" +"\n" "Voit poistaa .swp-tiedosto nyt.\n" "\n" msgid "Using crypt key from swap file for the text file.\n" -msgstr "Kytetn swpin salausavainta tekstitiedostolle\n" +msgstr "Käytetään swäpin salausavainta tekstitiedostolle\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" -msgstr "Swap-tiedostoja lytyi:" +msgstr "Swap-tiedostoja löytyi:" msgid " In current directory:\n" -msgstr " Tss hakemistossa:\n" +msgstr " Tässä hakemistossa:\n" msgid " Using specified name:\n" -msgstr " Mritellyll nimell:\n" +msgstr " Määritellyllä nimellä:\n" msgid " In directory " msgstr " Hakemistossa " msgid " -- none --\n" -msgstr " -- ei mitn --\n" +msgstr " -- ei mitään --\n" msgid " owned by: " msgstr " omistaja: " @@ -3563,7 +3581,7 @@ msgid " [from Vim version 3.0]" msgstr " [Vimin 3.0-versiosta]" msgid " [does not look like a Vim swap file]" -msgstr " [ei nyt Vimin swap-tiedostolta]" +msgstr " [ei näytä Vimin swap-tiedostolta]" msgid " file name: " msgstr " tiedostonimi: " @@ -3576,7 +3594,7 @@ msgstr "" " muokattu: " msgid "YES" -msgstr "KYLL" +msgstr "KYLLÄ" msgid "no" msgstr "ei" @@ -3586,7 +3604,7 @@ msgid "" " user name: " msgstr "" "\n" -" kyttjnimi: " +" käyttäjänimi: " msgid " host name: " msgstr " laitenimi: " @@ -3606,21 +3624,21 @@ msgstr "" " prosessin tunniste: " msgid " (still running)" -msgstr " (kynniss)" +msgstr " (käynnissä)" msgid "" "\n" " [not usable with this version of Vim]" msgstr "" "\n" -" [ei toimi tmn Vim-version kanssa]" +" [ei toimi tämän Vim-version kanssa]" msgid "" "\n" " [not usable on this computer]" msgstr "" "\n" -" [ei toimi tll koneella]" +" [ei toimi tällä koneella]" msgid " [cannot be read]" msgstr " [ei voi lukea]" @@ -3629,13 +3647,13 @@ msgid " [cannot be opened]" msgstr " [ei voi avata]" msgid "E313: Cannot preserve, there is no swap file" -msgstr "E313: Ei voi silytt, swap-tiedostoa ei ole" +msgstr "E313: Ei voi säilyttää, swap-tiedostoa ei ole" msgid "File preserved" -msgstr "Tiedosto silytetty" +msgstr "Tiedosto säilytetty" msgid "E314: Preserve failed" -msgstr "E314: Silyttminen eponnistui" +msgstr "E314: Säilyttäminen epäonnistui" #, c-format msgid "E315: ml_get: invalid lnum: %ld" @@ -3643,29 +3661,29 @@ msgstr "E315: ml_get: virheellinen lnum: %ld" #, c-format msgid "E316: ml_get: cannot find line %ld" -msgstr "E316: ml_get: rivi %ld ei lydy" +msgstr "E316: ml_get: riviä %ld ei löydy" msgid "E317: pointer block id wrong 3" -msgstr "E317: osoitinlohkon tunnus vr 3" +msgstr "E317: osoitinlohkon tunnus väärä 3" msgid "stack_idx should be 0" -msgstr "stack_idx pit olla 0" +msgstr "stack_idx pitää olla 0" msgid "E318: Updated too many blocks?" -msgstr "E318: Pivitetty liikaa lohkoja" +msgstr "E318: Päivitetty liikaa lohkoja" msgid "E317: pointer block id wrong 4" -msgstr "E317: osoitinlohkon tunnus vr 4" +msgstr "E317: osoitinlohkon tunnus väärä 4" msgid "deleted block 1?" msgstr "poistettu lohko 1?" #, c-format msgid "E320: Cannot find line %ld" -msgstr "E320: Rivi %ld ei lydy" +msgstr "E320: Riviä %ld ei löydy" msgid "E317: pointer block id wrong" -msgstr "E317: osoitinlohkon tunnus vr" +msgstr "E317: osoitinlohkon tunnus väärä" msgid "pe_line_count is zero" msgstr "pe_line_count on nolla" @@ -3676,13 +3694,13 @@ msgstr "E322: rivinumero arvoalueen ulkopuoleta: %ld on loppua suurempi" #, c-format msgid "E323: line count wrong in block %ld" -msgstr "E323: rivimr vrin lohkossa %ld" +msgstr "E323: rivimäärä väärin lohkossa %ld" msgid "Stack size increases" msgstr "Pinon koko kasvaa" msgid "E317: pointer block id wrong 2" -msgstr "E317: osoitinlohon tunnus vr 2" +msgstr "E317: osoitinlohon tunnus väärä 2" #, c-format msgid "E773: Symlink loop for \"%s\"" @@ -3696,7 +3714,7 @@ msgid "" "Found a swap file by the name \"" msgstr "" "\n" -"Swap-tiedosto lytyi: \"" +"Swap-tiedosto löytyi: \"" msgid "While opening file \"" msgstr "Avattaessa tiedostoa " @@ -3704,48 +3722,39 @@ msgstr "Avattaessa tiedostoa " msgid " NEWER than swap file!\n" msgstr " joka on UUDEMPI kuin swap-tiedosto!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Toinen ohjelma saattaa kytt samaa tiedostoa.\n" -" Jos nin on, varo, ettet muokkaa saman tiedoston\n" -" kahta instanssia yht aikaa.\n" +"(1) Toinen ohjelma saattaa käyttää samaa tiedostoa.\n" +" Jos näin on, varo, ettet muokkaa saman tiedoston\n" +" kahta instanssia yhtä aikaa. Lopeta tai jatka varoen.\n" -msgid " Quit, or continue with caution.\n" -msgstr " Lopeta, tai jatka.\n" - -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) Ohjelma on kaatunut muokatessa tiedostoa.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) Tiedostonmuokkausistunto on kaatunut.\n" msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr " Jos nin on, kyt komentoa :recover tai vim -r " +msgstr " Jos näin on, käytä komentoa :recover tai vim -r " msgid "" "\"\n" " to recover the changes (see \":help recovery\").\n" msgstr "" "\"\n" -" palauttaaksesi muutokset (listietoja: \":help recovery\").\n" +" palauttaaksesi muutokset (lisätietoja: \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" -msgstr " Jos teit jo nin, poista swap-tiedosto " +msgstr " Jos teit jo näin, poista swap-tiedosto " msgid "" "\"\n" " to avoid this message.\n" msgstr "" "\"\n" -" vlttksesi tmn viestin.\n" +" välttääksesi tämän viestin.\n" msgid "Swap file \"" msgstr "Swap-tiedosto " @@ -3800,21 +3809,18 @@ msgstr "E328: Valikko on olemassa vain toisessa tilassa" msgid "E329: No menu \"%s\"" msgstr "E329: Ei valikkoa %s" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" -msgstr "E792: tyhj valikkonimi" +msgstr "E792: tyhjä valikkonimi" msgid "E330: Menu path must not lead to a sub-menu" msgstr "E330: Valikkopolku ei saa johtaa alivalikkoon" msgid "E331: Must not add menu items directly to menu bar" -msgstr "E331: Valikkokohtia ei saa list suoraan valikkopalkkiin" +msgstr "E331: Valikkokohtia ei saa lisätä suoraan valikkopalkkiin" msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Erotin ei voi olla valikkopolun osa" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3823,24 +3829,24 @@ msgstr "" "--- Valikot ---" msgid "Tear off this menu" -msgstr "Repise valikko irti" +msgstr "Repäise valikko irti" + +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Valikkoa ei ole määritelty %s-tilassa" msgid "E333: Menu path must lead to a menu item" msgstr "E333: Valikkopolun on johdettava valikkokohtaan" #, c-format msgid "E334: Menu not found: %s" -msgstr "E334: Valikkoa ei lydy: %s" - -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Valikkoa ei ole mritelty %s-tilassa" +msgstr "E334: Valikkoa ei löydy: %s" msgid "E336: Menu path must lead to a sub-menu" -msgstr "E336: Valikkopolun pit johtaa alivalikkoon" +msgstr "E336: Valikkopolun pitää johtaa alivalikkoon" msgid "E337: Menu not found - check menu names" -msgstr "E337: Valikkoa ei lytynyt - tarkista valikkojen nimet" +msgstr "E337: Valikkoa ei löytynyt - tarkista valikkojen nimet" #, c-format msgid "Error detected while processing %s:" @@ -3855,23 +3861,23 @@ msgid "E354: Invalid register name: '%s'" msgstr "E354: Virheellinen rekisterin nimi: %s" msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" -msgstr "Knnksen yllpitj: Flammie Pirinen <flammie@iki.fi>" +msgstr "Käännöksen ylläpitäjä: Flammie Pirinen <flammie@iki.fi>" msgid "Interrupt: " msgstr "Keskeytys: " msgid "Press ENTER or type command to continue" -msgstr "Paina enteri tai kirjoita komento aloittaaksesi " +msgstr "Paina enteriä tai kirjoita komento aloittaaksesi " #, c-format msgid "%s line %ld" msgstr "%s rivi %ld" msgid "-- More --" -msgstr "-- Lis --" +msgstr "-- Lisää --" msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " -msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: yls, q: lopeta " +msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: ylös, q: lopeta " msgid "Question" msgstr "Kysymys" @@ -3880,7 +3886,7 @@ msgid "" "&Yes\n" "&No" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei" msgid "" @@ -3890,7 +3896,7 @@ msgid "" "&Discard All\n" "&Cancel" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei\n" "&Tallenna kaikki\n" "T&uhoa kaikki\n" @@ -3905,9 +3911,8 @@ msgstr "Tallennusikkuna" msgid "Open File dialog" msgstr "Avausikkuna" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: Sori, tiedostonselain puuttuu konsolitilasta" +msgstr "E338: tiedostonselain puuttuu konsolitilasta" msgid "E766: Insufficient arguments for printf()" msgstr "E766: printf():lle ei annettu tarpeeksi argumentteja" @@ -3922,24 +3927,24 @@ msgid "W10: Warning: Changing a readonly file" msgstr "W10: Varoitus: Muutetaan kirjoitussuojattua tiedostoa" msgid "Type number and <Enter> or click with mouse (empty cancels): " -msgstr "Kirjoita numero ja <Enter> tai valitse hiirell (tyhj peruu): " +msgstr "Kirjoita numero ja <Enter> tai valitse hiirellä (tyhjä peruu): " msgid "Type number and <Enter> (empty cancels): " -msgstr "Valitse numero ja <Enter> (tyhj peruu): " +msgstr "Valitse numero ja <Enter> (tyhjä peruu): " msgid "1 more line" -msgstr "1 rivi lis" +msgstr "1 rivi lisää" msgid "1 line less" -msgstr "1 rivi vhemmn" +msgstr "1 rivi vähemmän" #, c-format msgid "%ld more lines" -msgstr "%ld rivi lis" +msgstr "%ld riviä lisää" #, c-format msgid "%ld fewer lines" -msgstr "%ld rivi vhemmn" +msgstr "%ld riviä vähemmän" msgid " (Interrupted)" msgstr " (Keskeytetty)" @@ -3947,14 +3952,6 @@ msgstr " (Keskeytetty)" msgid "Beep!" msgstr "Piip!" -msgid "Vim: preserving files...\n" -msgstr "Vim: sstetn tiedostoja...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Valmis.\n" - -#, c-format msgid "ERROR: " msgstr "VIRHE: " @@ -3964,7 +3961,7 @@ msgid "" "[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" msgstr "" "\n" -"[tavua] yht. alloc-free %lu-%lu, kytss %lu, kytthuippu %lu\n" +"[tavua] yht. alloc-free %lu-%lu, käytössä %lu, käyttöhuippu %lu\n" #, c-format msgid "" @@ -3975,11 +3972,11 @@ msgstr "" "\n" msgid "E340: Line is becoming too long" -msgstr "E340: Rivist tulee liian pitk" +msgstr "E340: Rivistä tulee liian pitkä" #, c-format msgid "E341: Internal error: lalloc(%ld, )" -msgstr "E341: Sisinen virhe: lalloc(%ld, )" +msgstr "E341: Sisäinen virhe: lalloc(%ld, )" #, c-format msgid "E342: Out of memory! (allocating %lu bytes)" @@ -3999,19 +3996,13 @@ msgid "E547: Illegal mouseshape" msgstr "E547: Virheellinen hiiren muoto" msgid "E548: digit expected" -msgstr "E548: pit olla numero" +msgstr "E548: pitää olla numero" msgid "E549: Illegal percentage" msgstr "E549: Virheellinen prosenttiluku" -msgid "Enter encryption key: " -msgstr "Anna salausavain: " - -msgid "Enter same key again: " -msgstr "Anna sama avain uudestaan: " - -msgid "Keys don't match!" -msgstr "Avaimet eivt tsm!" +msgid "E854: path too long for completion" +msgstr "E854: polku on liian pitkä täydennykseen" #, c-format msgid "" @@ -4023,51 +4014,46 @@ msgstr "" #, c-format msgid "E344: Can't find directory \"%s\" in cdpath" -msgstr "E344: Hakemistoa %s ei lydy cdpathista" +msgstr "E344: Hakemistoa %s ei löydy cdpathista" #, c-format msgid "E345: Can't find file \"%s\" in path" -msgstr "E345: Tiedostoa %s ei lydy polulta" +msgstr "E345: Tiedostoa %s ei löydy polulta" #, c-format msgid "E346: No more directory \"%s\" found in cdpath" -msgstr "E346: Hakemisto %s ei ole en cdpathissa" +msgstr "E346: Hakemisto %s ei ole enää cdpathissa" #, c-format msgid "E347: No more file \"%s\" found in path" -msgstr "E347: Tiedosto %s ei ole en polulla" - -msgid "Cannot connect to Netbeans #2" -msgstr "Ei voi yhdist Netbeans #2:een" - -msgid "Cannot connect to Netbeans" -msgstr "Ei voi yhdist Netbeansiin" +msgstr "E347: Tiedosto %s ei ole enää polulla" #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" -msgstr "E668: Vr avaustila NetBeans-yhteyden infotiedostolle: %s" - -msgid "read from Netbeans socket" -msgstr "luettu Netbeans-soketista" +msgstr "E668: Väärä avaustila NetBeans-yhteyden infotiedostolle: %s" #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: NetBeans-yhteys katkesi puskurille %ld" +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: netbeans ei toimi tässä käyttöliittymässä" + msgid "E511: netbeans already connected" msgstr "E511: netbeans on yhdistetty jo" -msgid "E505: " -msgstr "E505: " +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" msgid "E349: No identifier under cursor" msgstr "E349: Ei tunnistetta osoittimen alla" msgid "E774: 'operatorfunc' is empty" -msgstr "E774: operatorfunc on tyhj" +msgstr "E774: operatorfunc on tyhjä" msgid "E775: Eval feature not available" -msgstr "E775: Eval ei ole kytettviss" +msgstr "E775: Eval ei ole käytettävissä" msgid "Warning: terminal cannot highlight" msgstr "Varoitus: terminaalista puuttuu korostus" @@ -4076,10 +4062,10 @@ msgid "E348: No string under cursor" msgstr "E348: Ei merkkijonoa kursorin alla" msgid "E352: Cannot erase folds with current 'foldmethod'" -msgstr "E352: taitoksia ei voi poistaa tll foldmethodilla" +msgstr "E352: taitoksia ei voi poistaa tällä foldmethodilla" msgid "E664: changelist is empty" -msgstr "E664: muutoslista on tyhj" +msgstr "E664: muutoslista on tyhjä" msgid "E662: At start of changelist" msgstr "E662: Muutoslistan alussa" @@ -4087,40 +4073,39 @@ msgstr "E662: Muutoslistan alussa" msgid "E663: At end of changelist" msgstr "E663: Muutoslistan lopussa" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Komento :quit<Enter> lopettaa Vimin" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "Kirjoita :qa! ja <Enter> niin hylkäät muutokset ja lopetat Vimin" #, c-format msgid "1 line %sed 1 time" -msgstr "1 rivi %s kerran" +msgstr "1 riviä %s kerran" #, c-format msgid "1 line %sed %d times" -msgstr "1 rivi %s %d kertaa" +msgstr "1 riviä %s %d kertaa" #, c-format msgid "%ld lines %sed 1 time" -msgstr "%ld rivi %s kerran" +msgstr "%ld riviä %s kerran" #, c-format msgid "%ld lines %sed %d times" -msgstr "%ld rivi %s %d kertaa" +msgstr "%ld riviä %s %d kertaa" #, c-format msgid "%ld lines to indent... " -msgstr "%ld rivi sisennettvn..." +msgstr "%ld riviä sisennettävänä..." msgid "1 line indented " msgstr "1 rivi sisennetty " #, c-format msgid "%ld lines indented " -msgstr "%ld rivi sisennetty " +msgstr "%ld riviä sisennetty " msgid "E748: No previously used register" -msgstr "E748: Ei aiemmin kytettyj rekisterej" +msgstr "E748: Ei aiemmin käytettyjä rekisterejä" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "Ei voi kopioida; poista joka tapauksessa" @@ -4129,31 +4114,36 @@ msgstr "1 rivi muuttui" #, c-format msgid "%ld lines changed" -msgstr "%ld rivi muuttui" +msgstr "%ld riviä muuttui" #, c-format msgid "freeing %ld lines" -msgstr "vapautetaan %ld rivi" +msgstr "vapautetaan %ld riviä" + +#, c-format +msgid " into \"%c" +msgstr " kohteeksi \"%c" -msgid "block of 1 line yanked" -msgstr "1 rivin lohko kopioitu" +#, c-format +msgid "block of 1 line yanked%s" +msgstr "1 rivin lohko kopioitu%s" -msgid "1 line yanked" -msgstr "1 rivi kopioitu" +#, c-format +msgid "1 line yanked%s" +msgstr "1 rivi kopioitu%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "lohko %ld rivilt kopioitu" +msgid "block of %ld lines yanked%s" +msgstr "lohko %ld riviltä kopioitu%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld rivi kopioitu" +msgid "%ld lines yanked%s" +msgstr "%ld riviä kopioitu%s" #, c-format msgid "E353: Nothing in register %s" -msgstr "E353: Rekisteriss %s ei ole mitn" +msgstr "E353: Rekisterissä %s ei ole mitään" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4175,40 +4165,46 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Tuntematon rekisterityyppi %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: hakulauseke- ja -ilmausrekisteri ei voi sisältää kahta tai useampaa " +"riviä" + #, c-format msgid "%ld Cols; " msgstr "%ld saraketta, " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Valittu %s%ld/%ld rivi, %ld/%ld sanaa, %ld/%ld tavua" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld tavua" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr "Valittu %s%ld/%ld rivi, %ld/%ld sanaa, %ld/%ld merkki, %ld/%ld tavua" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld merkkiä, %lld/%lld tavua" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Sarake %s/%s, Rivi %ld/%ld, sana %ld/%ld, tavu %ld/%ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Sarake %s/%s, Rivi %ld/%ld, sana %lld/%lld, tavu %lld/%lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" -msgstr "Sarake %s/%s, rivi %ld/%ld, sana %ld/%ld, merkki %ld/%ld, tavu %ld/%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" +msgstr "" +"Sarake %s/%s, rivi %ld/%ld, sana %lld/%lld, merkki %lld/%lld, tavu %lld/%lld" # Unicode Byte Order Mark #, c-format msgid "(+%ld for BOM)" msgstr "(+%ld BOMista)" -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Sivu %N" - msgid "Thanks for flying Vim" -msgstr "Kiitos ett ajoit Vimi" +msgstr "Kiitos että ajoit Vimiä" msgid "E518: Unknown option" msgstr "E518: Tuntematon asetus" @@ -4217,10 +4213,13 @@ msgid "E519: Option not supported" msgstr "E519: Asetusta ei tueta" msgid "E520: Not allowed in a modeline" -msgstr "E520: Ei sallitu modeline-rivill" +msgstr "E520: Ei sallitu modeline-rivillä" + +msgid "E846: Key code not set" +msgstr "E846: Avainkoodi puuttuu" msgid "E521: Number required after =" -msgstr "E521: =:n jlkeen tarvitaan luku" +msgstr "E521: =:n jälkeen tarvitaan luku" msgid "E522: Not found in termcap" msgstr "E522: Puuttuu termcapista" @@ -4229,14 +4228,18 @@ msgstr "E522: Puuttuu termcapista" msgid "E539: Illegal character <%s>" msgstr "E539: Virheellinen merkki <%s>" +#, c-format +msgid "For option %s" +msgstr "Asetukselle %s" + msgid "E529: Cannot set 'term' to empty string" -msgstr "E529: Termi ei voi asettaa tyhjksi merkkijonoksi" +msgstr "E529: Termiä ei voi asettaa tyhjäksi merkkijonoksi" msgid "E530: Cannot change term in GUI" -msgstr "E530: Ei voi vaihtaa termi GUIssa" +msgstr "E530: Ei voi vaihtaa termiä GUIssa" msgid "E531: Use \":gui\" to start the GUI" -msgstr "E531: Kyt komentoa :gui GUIn kynnistmiseen" +msgstr "E531: Käytä komentoa :gui GUIn käynnistämiseen" msgid "E589: 'backupext' and 'patchmode' are equal" msgstr "E589: backupext ja patchmod ovat samat" @@ -4258,16 +4261,16 @@ msgstr "E525: Nollan pituinen merkkijono" #, c-format msgid "E526: Missing number after <%s>" -msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jlkeen" +msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen" msgid "E527: Missing comma" msgstr "E527: Pilkku puuttuu" msgid "E528: Must specify a ' value" -msgstr "E528: '-arvo pit antaa" +msgstr "E528: '-arvo pitää antaa" msgid "E595: contains unprintable or wide character" -msgstr "E595: Sislt tulostumattomia tai leveit merkkej" +msgstr "E595: Sisältää tulostumattomia tai leveitä merkkejä" msgid "E596: Invalid font(s)" msgstr "E596: Viallisia fontteja" @@ -4279,24 +4282,24 @@ msgid "E598: Invalid fontset" msgstr "E598: Viallinen fontset" msgid "E533: can't select wide font" -msgstr "E533: Leven fontin valinta ei onnistu" +msgstr "E533: Leveän fontin valinta ei onnistu" msgid "E534: Invalid wide font" -msgstr "E534: Viallinen leve fontti" +msgstr "E534: Viallinen leveä fontti" #, c-format msgid "E535: Illegal character after <%c>" -msgstr "E535: Virheellinen merkki merkin <%c> jlkeen" +msgstr "E535: Virheellinen merkki merkin <%c> jälkeen" msgid "E536: comma required" msgstr "E536: pilkku puuttuu" #, c-format msgid "E537: 'commentstring' must be empty or contain %s" -msgstr "E537: commentstringin pit olla tyhj tai sislt %s" +msgstr "E537: commentstringin pitää olla tyhjä tai sisältää %s" msgid "E538: No mouse support" -msgstr "E538: Hiirt ei tueta" +msgstr "E538: Hiirtä ei tueta" msgid "E540: Unclosed expression sequence" msgstr "E540: Sulkematon lausekesarja" @@ -4305,17 +4308,20 @@ msgid "E541: too many items" msgstr "E541: liikaa kohteita" msgid "E542: unbalanced groups" -msgstr "E542: eptasapainoisia ryhmi" +msgstr "E542: epätasapainoisia ryhmiä" + +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Terminaalia jossa suoritetaan komentoa ei voi tehdä muokattavaksi" msgid "E590: A preview window already exists" msgstr "E590: Esikatseluikkuna on jo olemassa" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" -msgstr "W17: Arabialle pit olla UTF-8:aa, aseta :set encoding=utf-8" +msgstr "W17: Arabialle pitää olla UTF-8:aa, aseta :set encoding=utf-8" #, c-format msgid "E593: Need at least %d lines" -msgstr "E593: Tarvitaan ainakin %d rivi" +msgstr "E593: Tarvitaan ainakin %d riviä" #, c-format msgid "E594: Need at least %d columns" @@ -4325,9 +4331,6 @@ msgstr "E594: Tarvitaan ainakin %d saraketta" msgid "E355: Unknown option: %s" msgstr "E355: Tuntematon asetus: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: tarvitaan luku: &%s = '%s'" @@ -4365,11 +4368,11 @@ msgstr "E356: get_varp-virhe" #, c-format msgid "E357: 'langmap': Matching character missing for %s" -msgstr "E357: langmap: Merkkiin %s tsmv merkki puuttuu" +msgstr "E357: langmap: Merkkiin %s täsmäävä merkki puuttuu" #, c-format msgid "E358: 'langmap': Extra characters after semicolon: %s" -msgstr "E358: langmap: ylimrisi merkkej puolipisteen jlkeen: %s" +msgstr "E358: langmap: ylimääräisiä merkkejä puolipisteen jälkeen: %s" msgid "cannot open " msgstr "ei voi avata " @@ -4385,7 +4388,7 @@ msgid "Need %s version %ld\n" msgstr "Tarvitaan %s versio %ld\n" msgid "Cannot open NIL:\n" -msgstr "Ei voi avata NILi:\n" +msgstr "Ei voi avata NILiä:\n" msgid "Cannot create " msgstr "Ei voi luoda " @@ -4400,7 +4403,6 @@ msgstr "ei voi vaihtaa konsolitilaa?\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: ei ole konsoli?\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Kuorta ei voi avata asetuksella -f" @@ -4422,11 +4424,8 @@ msgstr "IO-virhe" msgid "Message" msgstr "Viesti" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "columns ei ole 80, ei voi suorittaa ulkoista komentoa" - msgid "E237: Printer selection failed" -msgstr "E237: Tulostimen valinta eponnistui" +msgstr "E237: Tulostimen valinta epäonnistui" #, c-format msgid "to %s on %s" @@ -4446,26 +4445,19 @@ msgstr "Tulostetaan %s" #, c-format msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" -msgstr "E244: Virheellinen merkistn nimi %s fontin nimess %s" - -#, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Virheellinen merkki %c fontin nimess %s" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: Kaksoissignaali, lopetetaan\n" +msgstr "E244: Virheellinen merkistön nimi %s fontin nimessä %s" #, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: Tappava signaali %s\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Virheellinen laatunimi %s fontin nimessä %s" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: Tappava signaali\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Virheellinen merkki %c fontin nimessä %s" #, c-format msgid "Opening the X display took %ld msec" -msgstr "X-nytn avaus vei %ld millisekuntia" +msgstr "X-näytön avaus vei %ld millisekuntia" msgid "" "\n" @@ -4475,12 +4467,12 @@ msgstr "" "Vim: X-virhe\n" msgid "Testing the X display failed" -msgstr "X-nytn testaus eponnistui" +msgstr "X-näytön testaus epäonnistui" msgid "Opening the X display timed out" -msgstr "X-nytn avaus aikakatkaistiin" +msgstr "X-näytön avaus aikakatkaistiin" -# mik security context? +# mikä security context? msgid "" "\n" "Could not get security context for " @@ -4495,12 +4487,14 @@ msgstr "" "\n" "Ei voitu asettaa turvallisuuskontekstia kohteelle " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Kuoren suoritus ei onnistu " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Ei voitu asettaa turvallisuuskontekstia %s kohteelle %s" + +# mikä security context? +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Ei saatu turvallisuuskontekstia %s kohteelle %s ja se poistetaan" msgid "" "\n" @@ -4521,7 +4515,7 @@ msgid "" "Cannot create pipes\n" msgstr "" "\n" -"Putkia ei voi tehd\n" +"Putkia ei voi tehdä\n" msgid "" "\n" @@ -4530,6 +4524,13 @@ msgstr "" "\n" "Ei voi haarauttaa\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Kuoren suoritus ei onnistu " + msgid "" "\n" "Command terminated\n" @@ -4545,36 +4546,32 @@ msgid "dlerror = \"%s\"" msgstr "dlerror = %s" msgid "Opening the X display failed" -msgstr "X-nytn avaus eponnistui" +msgstr "X-näytön avaus epäonnistui" msgid "XSMP handling save-yourself request" -msgstr "XSMP ksittelee save-yourself-pyynt" +msgstr "XSMP käsittelee save-yourself-pyyntöä" msgid "XSMP opening connection" -msgstr "XSMP avaa yhteytt" +msgstr "XSMP avaa yhteyttä" msgid "XSMP ICE connection watch failed" -msgstr "XSMP:n ICE-yhteyden tarkkailu eponnistui" +msgstr "XSMP:n ICE-yhteyden tarkkailu epäonnistui" #, c-format msgid "XSMP SmcOpenConnection failed: %s" -msgstr "XSMP SmcOpenConnection eponnistui: %s" +msgstr "XSMP SmcOpenConnection epäonnistui: %s" msgid "At line" -msgstr "Rivill" +msgstr "Rivillä" msgid "Could not load vim32.dll!" -msgstr "Vim32.dll: ei voitu ladata" +msgstr "Vim32.dll:ää ei voitu ladata" msgid "VIM Error" msgstr "VIM-virhe" msgid "Could not fix up function pointers to the DLL!" -msgstr "Ei voitu korjata funktio-osoittimia DLL:ss" - -#, c-format -msgid "shell returned %d" -msgstr "kuori palautti arvon %d" +msgstr "Ei voitu korjata funktio-osoittimia DLL:ssä" #, c-format msgid "Vim: Caught %s event\n" @@ -4590,20 +4587,24 @@ msgid "shutdown" msgstr "sammutus" msgid "E371: Command not found" -msgstr "E371: Komentoa ei lydy" +msgstr "E371: Komentoa ei löydy" msgid "" "VIMRUN.EXE not found in your $PATH.\n" "External commands will not pause after completion.\n" "See :help win32-vimrun for more information." msgstr "" -"VIMRUN.EXE ei lydy muuttujasta $PATH.\n" -"Ulkoiset komennot eivt pyshdy suorituksen lopussa.\n" -"Listietoja komennolla :help win32-vimrun" +"VIMRUN.EXEä ei löydy muuttujasta $PATH.\n" +"Ulkoiset komennot eivät pysähdy suorituksen lopussa.\n" +"Lisätietoja komennolla :help win32-vimrun" msgid "Vim Warning" msgstr "Vim-varoitus" +#, c-format +msgid "shell returned %d" +msgstr "kuori palautti arvon %d" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: Liikaa %%%c-juttuja muotoilumerkkijonossa" @@ -4631,10 +4632,19 @@ msgid "E378: 'errorformat' contains no pattern" msgstr "E378: errorformatissa ei ole kuvioita" msgid "E379: Missing or empty directory name" -msgstr "E379: Puuttuva tai tyhj hakemiston nimi" +msgstr "E379: Puuttuva tai tyhjä hakemiston nimi" msgid "E553: No more items" -msgstr "E553: Ei en kohteita" +msgstr "E553: Ei enää kohteita" + +msgid "E924: Current window was closed" +msgstr "E924: Nykyinen ikkuna on suljettu" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Nykyinen quickfix on muuttunut" + +msgid "E926: Current location list was changed" +msgstr "E926: Nykyinen sijaintiluettelo on muuttunut" #, c-format msgid "(%d of %d)%s%s: " @@ -4643,18 +4653,18 @@ msgstr "(%d/%d)%s%s: " msgid " (line deleted)" msgstr " (rivi poistettu)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%svirhelista %d/%d, %d virhettä" + msgid "E380: At bottom of quickfix stack" msgstr "E380: quickfix-pinon pohjalla" msgid "E381: At top of quickfix stack" msgstr "E381: quickfix-pinon huipulla" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "virhelista %d/%d, %d virhett" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: Ei voi kirjoittaa, buftype asetettu" +msgid "No entries" +msgstr "Ei kenttiä" msgid "Error file" msgstr "Virhetiedosto" @@ -4670,24 +4680,21 @@ msgid "E681: Buffer is not loaded" msgstr "E681: Puskuria ei ole ladattu" msgid "E777: String or List expected" -msgstr "E777: Pit olla merkkijono tai lista" +msgstr "E777: Pitää olla merkkijono tai lista" #, c-format msgid "E369: invalid item in %s%%[]" msgstr "E369: virheellinen olio kohdassa %s%%[]" -msgid "E339: Pattern too long" -msgstr "E339: Liian pitk kuvio" - -msgid "E50: Too many \\z(" -msgstr "E50: Liikaa merkkej \\z(" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: Liikaa merkkej %s(" +msgid "E769: Missing ] after %s[" +msgstr "E769: ] puuttuu merkinnän %s[ jäljestä" -msgid "E52: Unmatched \\z(" -msgstr "E52: Pariton \\z(" +msgid "E944: Reverse range in character class" +msgstr "E944: Merkiluokan arvoalua on takaperin" + +msgid "E945: Range too large in character class" +msgstr "E945: Liian laaja valikoima merkkiluokassa" #, c-format msgid "E53: Unmatched %s%%(" @@ -4698,12 +4705,42 @@ msgid "E54: Unmatched %s(" msgstr "E54: Pariton %s(" #, c-format -msgid "E55: Unmatched %s)" -msgstr "E55: Pariton %s)" +msgid "E55: Unmatched %s)" +msgstr "E55: Pariton %s)" + +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( ei ole sallittu tässä" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 jne. ei ole sallittu tässä" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ] puuttuu merkinnän %s%%[ jäljestä" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: Tyhjä %s%%[]" + +msgid "E65: Illegal back reference" +msgstr "E65: Virheellinen täsmäysviittaus" + +msgid "E339: Pattern too long" +msgstr "E339: Liian pitkä kuvio" + +msgid "E50: Too many \\z(" +msgstr "E50: Liikaa merkkejä \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Liikaa merkkejä %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: Pariton \\z(" #, c-format msgid "E59: invalid character after %s@" -msgstr "E59: virheellinen merkki kohdan %s@ jlkeen" +msgstr "E59: virheellinen merkki kohdan %s@ jälkeen" #, c-format msgid "E60: Too many complex %s{...}s" @@ -4711,57 +4748,120 @@ msgstr "E60: Liikaa monimutkaisia ilmauksia %s{...}s" #, c-format msgid "E61: Nested %s*" -msgstr "E61: Siskkistetty %s*" +msgstr "E61: Sisäkkäistetty %s*" #, c-format msgid "E62: Nested %s%c" -msgstr "E62: Siskkistetty %s%c" +msgstr "E62: Sisäkkäistetty %s%c" msgid "E63: invalid use of \\_" -msgstr "E63: vrinkytetty \\_" +msgstr "E63: väärinkäytetty \\_" #, c-format msgid "E64: %s%c follows nothing" -msgstr "E64: %s%c jlkeen ei minkn" +msgstr "E64: %s%c jälkeen ei minkään" -msgid "E65: Illegal back reference" -msgstr "E65: Virheellinen tsmysviittaus" +msgid "E68: Invalid character after \\z" +msgstr "E68: Virheellinen merkki ilmauksen \\z jälkeen" -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( ei ole sallittu tss" +#, c-format +msgid "E678: Invalid character after %s%%[dxouU]" +msgstr "E678: Virheellinen merkki merkinnän %s%%[dxouU] jäljessä" -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 jne. ei ole sallittu tss" +#, c-format +msgid "E71: Invalid character after %s%%" +msgstr "E71: Virheellinen merkki merkinnän %s%% jäljessä" -msgid "E68: Invalid character after \\z" -msgstr "E68: Virheellinen merkki ilmauksen \\z jlkeen" +#, c-format +msgid "E554: Syntax error in %s{...}" +msgstr "E554: Syntaksivirhe ilmauksessa %s{...}" + +msgid "External submatches:\n" +msgstr "Ulkoisia alitäsmäyksiä:\n" #, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: ] puuttuu merkinnn %s%%[ jljest" +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA-säänn. ilmaus) ei voi toistaa kohdetta %s" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: \\%#=-merkkien perään voi tulla vain 0, 1 tai 2. Käytetään " +"automaattista engineä " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Vaihdetaan käyttämään backtrackkaavaa RE-engineä ilmaukselle: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Säännöllisen ilmauksen ennenaikainen loppu" #, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: Tyhj %s%%[]" +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA-regexp) %c väärässä paikassa" #, c-format -msgid "E678: Invalid character after %s%%[dxouU]" -msgstr "E678: Virheellinen merkki merkinnn %s%%[dxouU] jljess" +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Virheellinen merkkiluokka: %ld" #, c-format -msgid "E71: Invalid character after %s%%" -msgstr "E71: Virheellinen merkki merkinnn %s%% jljess" +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Tuntematon operaattori '\\z%c'" #, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: ] puuttuu merkinnn %s[ jljest" +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Tuntematon operaattori '\\%%%c'" + +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Virhe NFA:n ekvivalenssiluokkia tekemisessä" #, c-format -msgid "E554: Syntax error in %s{...}" -msgstr "E554: Syntaksivirhe ilmauksessa %s{...}" +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Tuntematon operaattori '\\@%c'" -msgid "External submatches:\n" -msgstr "Ulkoisia alitsmyksi:\n" +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA regexp) Virhe luettaessa toiston määriä" + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Multi ei voi seurata multia" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA regexp) Liian monta suljetta '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA regexp) Liikaa merkkejä \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA regexp) oikea lopetusvirhe" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) Ei voida poistaa pinosta" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (NFA regexp) (Muunnettaessa postfixistä NFA:ksi), liikaa tiloja " +"jäljellä pinossa" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (NFA regexp) Tila ei riitä NFA:n tallentamiseen" + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) Ei voitu allokoida muistia polkujen läpikäyntiin" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Ei voitu avata väliaikaislokitiedosta kirjoittamista varten, joten virheet " +"näytetään vakiovirhevirrassa. " + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) EI VOI AVATA KOHDETTA %s" + +msgid "Could not open temporary log file for writing " +msgstr "Väliaikaislokitiedoston avaus kirjoittamista varten ei onnistu" # tiloja msgid " VREPLACE" @@ -4771,13 +4871,13 @@ msgid " REPLACE" msgstr " KORVAUS" msgid " REVERSE" -msgstr " KNTEIS" +msgstr " KÄÄNTEIS" msgid " INSERT" -msgstr " SYTT" +msgstr " SYÖTTÖ" msgid " (insert)" -msgstr " (sytt)" +msgstr " (syöttö)" msgid " (replace)" msgstr " (korvaus)" @@ -4791,9 +4891,6 @@ msgstr " Heprea" msgid " Arabic" msgstr " Arabia" -msgid " (lang)" -msgstr " (kieli)" - msgid " (paste)" msgstr " (liitos)" @@ -4824,24 +4921,23 @@ msgstr "E383: Viallinen hakujono: %s" #, c-format msgid "E384: search hit TOP without match for: %s" -msgstr "E384: Haku psi alkuun lytmtt jonoa: %s" +msgstr "E384: Haku pääsi alkuun löytämättä jonoa: %s" #, c-format msgid "E385: search hit BOTTOM without match for: %s" -msgstr "E385: Haku psi loppuun lytmtt jonoa: %s" +msgstr "E385: Haku pääsi loppuun löytämättä jonoa: %s" msgid "E386: Expected '?' or '/' after ';'" -msgstr "E386: ;:n jlkeen pit olla ? tai /" +msgstr "E386: ;:n jälkeen pitää olla ? tai /" msgid " (includes previously listed match)" -msgstr " (sislt viimeksi luetellun tsmyksen)" +msgstr " (sisältää viimeksi luetellun täsmäyksen)" -#. cursor at status line msgid "--- Included files " -msgstr "--- Sisllytetyt tiedostot " +msgstr "--- Sisällytetyt tiedostot " msgid "not found " -msgstr "ei lytynyt " +msgstr "ei löytynyt " msgid "in path ---\n" msgstr "polusta ---\n" @@ -4850,30 +4946,30 @@ msgid " (Already listed)" msgstr " (Jo lueteltu)" msgid " NOT FOUND" -msgstr " EI LYTYNYT" +msgstr " EI LÖYTYNYT" #, c-format msgid "Scanning included file: %s" -msgstr "Haku sislsi tiedoston: %s" +msgstr "Haku sisälsi tiedoston: %s" #, c-format msgid "Searching included file %s" -msgstr "Haku sislsi tiedoston %s" +msgstr "Haku sisälsi tiedoston %s" msgid "E387: Match is on current line" -msgstr "E387: Tsmys tll rivill" +msgstr "E387: Täsmäys tällä rivillä" msgid "All included files were found" -msgstr "Kaikki sisllytetyt rivit lytyivt" +msgstr "Kaikki sisällytetyt rivit löytyivät" msgid "No included files" -msgstr "Ei sisllytettyj tiedostoja" +msgstr "Ei sisällytettyjä tiedostoja" msgid "E388: Couldn't find definition" -msgstr "E388: Mritelm ei lydy" +msgstr "E388: Määritelmä ei löydy" msgid "E389: Couldn't find pattern" -msgstr "E389: kuvio ei lydy" +msgstr "E389: kuvio ei löydy" msgid "Substitute " msgstr "Korvaa " @@ -4888,35 +4984,65 @@ msgstr "" "# Edellinen %sHakulauseke:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Muotoiluvirhe oikolukutiedostossa" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Oikaisuluku ei ole päällä" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Varoitus: Ei löydetty sanalistaa %s_%s.spl tai %s_ascii.spl" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Varoitus: Ei löydetty sanalistaa %s.%s.spl tai %s.ascii.spl" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing autocommand poisti puskurin" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Varoitus: osaa %s ei tueta" + +msgid "Sorry, no suggestions" +msgstr "ei ehdotuksia" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "vain %ld ehdotusta" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Muuta %.*s:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < %.*s" + +msgid "E752: No previous spell replacement" +msgstr "E752: Ei edellistä oikaisulukukorjausta" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Ei löytynyt: %s" msgid "E758: Truncated spell file" msgstr "E758: Oikolukutiedosto katkaistu" #, c-format msgid "Trailing text in %s line %d: %s" -msgstr "Teksti rivin perss tiedostossa %s rivill %d: %s" +msgstr "Tekstiä rivin perässä tiedostossa %s rivillä %d: %s" #, c-format msgid "Affix name too long in %s line %d: %s" -msgstr "Affiksin nimi on liian pitk tiedostossa %s rivill %d: %s" +msgstr "Affiksin nimi on liian pitkä tiedostossa %s rivillä %d: %s" msgid "E761: Format error in affix file FOL, LOW or UPP" msgstr "E761: Affiksitiedoston FOL-, LOW- tai UPP-muotovirhe " msgid "E762: Character in FOL, LOW or UPP is out of range" -msgstr "E762: Merkki FOL:ss, LOW:ss tai UPP:ss ei kuulu arvoalueeseen" +msgstr "E762: Merkki FOL:ssä, LOW:ssä tai UPP:ssä ei kuulu arvoalueeseen" msgid "Compressing word tree..." -msgstr "Tiivistetn sanapuuta..." - -msgid "E756: Spell checking is not enabled" -msgstr "E756: Oikaisuluku ei ole pll" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Varoitus: Ei lydetty sanalistaa %s.%s.spl tai %s.ascii.spl" +msgstr "Tiivistetään sanapuuta..." #, c-format msgid "Reading spell file \"%s\"" @@ -4926,7 +5052,7 @@ msgid "E757: This does not look like a spell file" msgstr "E757: Ei vaikuta oikaisulukutiedostolta" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: Vanha oikaisulukutiedosto vaatii pivittmist" +msgstr "E771: Vanha oikaisulukutiedosto vaatii päivittämistä" msgid "E772: Spell file is for newer version of Vim" msgstr "E772: Oikaisulukutiedosto on uudemmalle Vimille" @@ -4935,8 +5061,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Tukematon osio oikaisulukutiedostossa" #, c-format -msgid "Warning: region %s not supported" -msgstr "Varoitus: osaa %s ei tueta" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Ei vaikuta .sug-tiedostolta: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Vanha .sug-tiedosto pitää päivittää: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug-tiedosto ei täsmää .spl-tiedostoon: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" #, c-format msgid "Reading affix file %s ..." @@ -4944,7 +5086,7 @@ msgstr "Luetaan affiksitiedostoa %s..." #, c-format msgid "Conversion failure for word in %s line %d: %s" -msgstr "Muunnosvirhe sanalle %s rivill %d: %s" +msgstr "Muunnosvirhe sanalle %s rivillä %d: %s" #, c-format msgid "Conversion in %s not supported: from %s to %s" @@ -4956,88 +5098,88 @@ msgstr "Muutosta kohteessa %s ei tueta" #, c-format msgid "Invalid value for FLAG in %s line %d: %s" -msgstr "Tuntematon FLAG kohteessa %s rivill %d: %s" +msgstr "Tuntematon FLAG kohteessa %s rivillä %d: %s" #, c-format msgid "FLAG after using flags in %s line %d: %s" -msgstr "FLAG kohteessa %s lippujen jlkeen rivill %d: %s" +msgstr "FLAG kohteessa %s lippujen jälkeen rivillä %d: %s" #, c-format msgid "" "Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " "%d" msgstr "" -"COMPOUNDFORBIDFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s " -"rivill %d" +"COMPOUNDFORBIDFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s " +"rivillä %d" #, c-format msgid "" "Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " "%d" msgstr "" -"COMPOUNDPERMITFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s " -"rivill %d" +"COMPOUNDPERMITFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s " +"rivillä %d" #, c-format msgid "Wrong COMPOUNDRULES value in %s line %d: %s" -msgstr "Vr COMPOUNDRULES-arvo kohteessa %s rivill %d: %s" +msgstr "Väärä COMPOUNDRULES-arvo kohteessa %s rivillä %d: %s" #, c-format msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" -msgstr "Vr COMPOUNDWORDMAX-arvo kohteessa %s rivill %d: %s" +msgstr "Väärä COMPOUNDWORDMAX-arvo kohteessa %s rivillä %d: %s" #, c-format msgid "Wrong COMPOUNDMIN value in %s line %d: %s" -msgstr "Vr COMPOUNDMIN-arvo kohteessa %s rivill %d: %s" +msgstr "Väärä COMPOUNDMIN-arvo kohteessa %s rivillä %d: %s" #, c-format msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" -msgstr "Vr COMPOUNDSYLMAX-arvo kohteessa %s rivill %d: %s" +msgstr "Väärä COMPOUNDSYLMAX-arvo kohteessa %s rivillä %d: %s" #, c-format msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" -msgstr "Vr CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivill %d: %s" +msgstr "Väärä CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivillä %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" msgstr "" -"Eri yhdistelmlippu jatketussa affiksilohkossa kohteessa %s rivill %d: %s" +"Eri yhdistelmälippu jatketussa affiksilohkossa kohteessa %s rivillä %d: %s" #, c-format msgid "Duplicate affix in %s line %d: %s" -msgstr "Kaksoiskappale affiksista kohteessa %s rivill %d: %s" +msgstr "Kaksoiskappale affiksista kohteessa %s rivillä %d: %s" #, c-format msgid "" "Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " "line %d: %s" msgstr "" -"Affiksia kytetty mys BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai " -"NOSUGGEST-arvossa kohteessa %s rivill %d: %s" +"Affiksia käytetty myös BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai " +"NOSUGGEST-arvossa kohteessa %s rivillä %d: %s" #, c-format msgid "Expected Y or N in %s line %d: %s" -msgstr "Odotettiin Y:t tai N: kohteessa %s rivill %d: %s" +msgstr "Odotettiin Y:tä tai N:ää kohteessa %s rivillä %d: %s" #, c-format msgid "Broken condition in %s line %d: %s" -msgstr "Viallinen ehto kohteessa %s rivill %d: %s" +msgstr "Viallinen ehto kohteessa %s rivillä %d: %s" #, c-format msgid "Expected REP(SAL) count in %s line %d" -msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivill %d" +msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivillä %d" #, c-format msgid "Expected MAP count in %s line %d" -msgstr "Odotettiin MAP-arvoa kohteessa %s rivill %d" +msgstr "Odotettiin MAP-arvoa kohteessa %s rivillä %d" #, c-format msgid "Duplicate character in MAP in %s line %d" -msgstr "Kaksoiskappale merkist MAP:ss kohteessa %s rivill %d" +msgstr "Kaksoiskappale merkistä MAP:ssä kohteessa %s rivillä %d" #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" -msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivill %d: %s" +msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivillä %d: %s" #, c-format msgid "Missing FOL/LOW/UPP line in %s" @@ -5047,13 +5189,13 @@ msgid "COMPOUNDSYLMAX used without SYLLABLE" msgstr "COMPOUNDSYLMAX ilman SYLLABLEa" msgid "Too many postponed prefixes" -msgstr "Liikaa jlkikteistettyj prefiksej" +msgstr "Liikaa jälkikäteistettyjä prefiksejä" msgid "Too many compound flags" msgstr "Liikaa yhdyssanalippuja" msgid "Too many postponed prefixes and/or compound flags" -msgstr "Liikaa jlkikteistettyj prefiksej tai yhdyssanalippuja" +msgstr "Liikaa jälkikäteistettyjä prefiksejä tai yhdyssanalippuja" #, c-format msgid "Missing SOFO%s line in %s" @@ -5065,11 +5207,11 @@ msgstr "SAL- ja SOFO-rivit kohteessa %s" #, c-format msgid "Flag is not a number in %s line %d: %s" -msgstr "Lippu ei ole lukuarvo kohteessa %s rivill %d: %s" +msgstr "Lippu ei ole lukuarvo kohteessa %s rivillä %d: %s" #, c-format msgid "Illegal flag in %s line %d: %s" -msgstr "Tuntematon lippu kohteessa %s rivill %d: %s" +msgstr "Tuntematon lippu kohteessa %s rivillä %d: %s" #, c-format msgid "%s value differs from what is used in another .aff file" @@ -5089,11 +5231,11 @@ msgstr "rivi %6d, sana %6d - %s" #, c-format msgid "Duplicate word in %s line %d: %s" -msgstr "Toistettu sana kohteessa %s rivill %d: %s" +msgstr "Toistettu sana kohteessa %s rivillä %d: %s" #, c-format msgid "First duplicate word in %s line %d: %s" -msgstr "Ensimminen kappale kohteessa %s rivill %d: %s" +msgstr "Ensimmäinen kappale kohteessa %s rivillä %d: %s" #, c-format msgid "%d duplicate word(s) in %s" @@ -5109,57 +5251,56 @@ msgstr "Luetaan sanatiedostoa %s..." #, c-format msgid "Duplicate /encoding= line ignored in %s line %d: %s" -msgstr "Toistettu /encoding= ohitettu kohteessa %s rivill %d: %s" +msgstr "Toistettu /encoding= ohitettu kohteessa %s rivillä %d: %s" #, c-format msgid "/encoding= line after word ignored in %s line %d: %s" -msgstr "/encoding= sanojen jlkeen ohitettu kohteessa %s rivill %d: %s" +msgstr "/encoding= sanojen jälkeen ohitettu kohteessa %s rivillä %d: %s" #, c-format msgid "Duplicate /regions= line ignored in %s line %d: %s" -msgstr "Toistettu /regions= ohitettu kohteessa %s rivill %d: %s" +msgstr "Toistettu /regions= ohitettu kohteessa %s rivillä %d: %s" #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "Liikaa regionseja kohteessa %s rivill %d: %s" +msgstr "Liikaa regionseja kohteessa %s rivillä %d: %s" #, c-format msgid "/ line ignored in %s line %d: %s" -msgstr "/ ohitettu kohteessa %s rivill %d: %s" +msgstr "/ ohitettu kohteessa %s rivillä %d: %s" #, c-format msgid "Invalid region nr in %s line %d: %s" -msgstr "Virheellinen region-luku kohteessa %s rivill %d: %s" +msgstr "Virheellinen region-luku kohteessa %s rivillä %d: %s" #, c-format msgid "Unrecognized flags in %s line %d: %s" -msgstr "Tunnistamaton lippu kohteessa %s rivill %d: %s" +msgstr "Tunnistamaton lippu kohteessa %s rivillä %d: %s" #, c-format msgid "Ignored %d words with non-ASCII characters" msgstr "Ei-ASCIIn takia ohitettuja sanoja %d" +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Muisti ei riitä, sanalista jää keskeneräiseksi" + #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" -msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jljell" +msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jäljellä" msgid "Reading back spell file..." msgstr "Luetaan taas oikaisulukutiedostoa..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." -msgstr "ntmyksen mukaan yhdistelln..." +msgstr "Ääntämyksen mukaan yhdistellään..." #, c-format msgid "Number of words after soundfolding: %ld" -msgstr "Sanoja ntmysyhdistelyn jlkeen: %ld" +msgstr "Sanoja ääntämysyhdistelyn jälkeen: %ld" #, c-format msgid "Total number of words: %d" -msgstr "Sanoja yhteens: %d" +msgstr "Sanoja yhteensä: %d" #, c-format msgid "Writing suggestion file %s ..." @@ -5167,20 +5308,20 @@ msgstr "Kirjoitetaan ehdotustiedostoa %s..." #, c-format msgid "Estimated runtime memory use: %d bytes" -msgstr "Arvioitu kyttmuisti: %d tavua" +msgstr "Arvioitu käyttömuisti: %d tavua" msgid "E751: Output file name must not have region name" -msgstr "E751: Tulostetiedostonimess ei saa olla alueen nime" +msgstr "E751: Tulostetiedostonimessä ei saa olla alueen nimeä" msgid "E754: Only up to 8 regions supported" -msgstr "E754: Enintn 8 aluetta tuetaan" +msgstr "E754: Enintään 8 aluetta tuetaan" #, c-format msgid "E755: Invalid region in %s" msgstr "E755: Virheellinen alue kohteelle %s" msgid "Warning: both compounding and NOBREAK specified" -msgstr "Varoitus: sek yhdyssanamuodostus ett NOBREAK kytss" +msgstr "Varoitus: sekä yhdyssanamuodostus että NOBREAK käytössä" #, c-format msgid "Writing spell file %s ..." @@ -5191,79 +5332,57 @@ msgstr "Valmista." #, c-format msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: spellfile ei sisll %ld kohtaa" +msgstr "E765: spellfile ei sisällä %ld kohtaa" #, c-format -msgid "Word removed from %s" -msgstr "Sana poistettu kohteesta %s" +msgid "Word '%.*s' removed from %s" +msgstr "Sana %.*s poistettu kohteesta %s" #, c-format -msgid "Word added to %s" -msgstr "Sana listty kohteeseen %s" +msgid "Word '%.*s' added to %s" +msgstr "Sana %.*s lisätty kohteeseen %s" msgid "E763: Word characters differ between spell files" -msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen vlill" +msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen välillä" -msgid "Sorry, no suggestions" -msgstr "Sori, ei ehdotuksia" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Sori, vain %ld ehdotusta" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Muuta %.*s:" +msgid "E783: duplicate char in MAP entry" +msgstr "E783: kaksoiskappale merkistä MAP-kohdassa" -#, c-format -msgid " < \"%.*s\"" -msgstr " < %.*s" +msgid "No Syntax items defined for this buffer" +msgstr "Ei syntaksikohteita tälle puskurille" -msgid "E752: No previous spell replacement" -msgstr "E752: Ei edellist oikaisulukukorjausta" +msgid "syntax conceal on" +msgstr "syntaksin piilotus päällä" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Ei lytynyt: %s" +msgid "syntax conceal off" +msgstr "syntaksin piilotus pois" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Ei vaikuta .sug-tiedostolta: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: Virheellinen argumentti: %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Vanha .sug-tiedosto pit pivitt: %s" +msgid "syntax case ignore" +msgstr "syntaksin merkkitason ohitus " -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s" +msgid "syntax case match" +msgstr "syntaksin merkkitason täsmäys" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug-tiedosto ei tsm .spl-tiedostoon: %s" +msgid "syntax spell toplevel" +msgstr "syntaksin oikaisuluku päätasolla" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" +msgid "syntax spell notoplevel" +msgstr "syntaksin oikaisuluku ei-päätasolla" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: kaksoiskappale merkist MAP-kohdassa" +msgid "syntax spell default" +msgstr "syntaksin oikaisuluku oletusarvolla" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: Virheellinen argumentti: %s" +msgid "syntax iskeyword " +msgstr "syntax iskeyword " #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Syntaksiklusteri puuttuu: %s" -msgid "No Syntax items defined for this buffer" -msgstr "Ei syntaksikohteita tlle puskurille" - msgid "syncing on C-style comments" msgstr "synkkaa C-tyylin kommentteihin" @@ -5274,7 +5393,7 @@ msgid "syncing starts " msgstr "synkkaus aloitettu " msgid " lines before top line" -msgstr " rivi ennen alkua" +msgstr " riviä ennen alkua" msgid "" "\n" @@ -5302,34 +5421,44 @@ msgid "E392: No such syntax cluster: %s" msgstr "E392: syntaksiklusteria ei ole: %s" msgid "minimal " -msgstr "vhintn " +msgstr "vähintään " msgid "maximal " -msgstr "enitntn " +msgstr "enitntään " msgid "; match " -msgstr "; tsm " +msgstr "; täsmää " msgid " line breaks" msgstr " rivinvaihdot" msgid "E395: contains argument not accepted here" -msgstr "E395: contains ei sovi thn" +msgstr "E395: contains ei sovi tähän" + +msgid "E844: invalid cchar value" +msgstr "E844: Virheellinen cchar-arvo" msgid "E393: group[t]here not accepted here" -msgstr "E393: group[t]here ei sovi thn" +msgstr "E393: group[t]here ei sovi tähän" #, c-format msgid "E394: Didn't find region item for %s" -msgstr "E394: Aluetta nimelle %s ei lydy" +msgstr "E394: Aluetta nimelle %s ei löydy" msgid "E397: Filename required" msgstr "E397: Tiedostonimi puuttuu" +msgid "E847: Too many syntax includes" +msgstr "E847: Liikaa syntax includeja" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ] puuttuu: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Ylimääräisiä merkkejä merkin ] perässä: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: = puuttuu: %s" @@ -5338,8 +5467,11 @@ msgstr "E398: = puuttuu: %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Argumentteja puuttuu: syntaksialue %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: Liikaa syntaksiklustereita" + msgid "E400: No cluster specified" -msgstr "E400: klusteri mrittelemtt" +msgstr "E400: klusteri määrittelemättä" #, c-format msgid "E401: Pattern delimiter not found: %s" @@ -5347,10 +5479,10 @@ msgstr "E401: Kuvoin erotin puuttuu: %s" #, c-format msgid "E402: Garbage after pattern: %s" -msgstr "E402: Roskia kuvion jljess: %s" +msgstr "E402: Roskia kuvion jäljessä: %s" msgid "E403: syntax sync: line continuations pattern specified twice" -msgstr "E403: syntax sync: rivinjatkamiskuvio mritelty kahdesti" +msgstr "E403: syntax sync: rivinjatkamiskuvio määritelty kahdesti" #, c-format msgid "E404: Illegal arguments: %s" @@ -5362,11 +5494,11 @@ msgstr "E405: = puuttuu: %s" #, c-format msgid "E406: Empty argument: %s" -msgstr "E406: Tyhj argumentti: %s" +msgstr "E406: Tyhjä argumentti: %s" #, c-format msgid "E407: %s not allowed here" -msgstr "E407: %s ei sovi thn" +msgstr "E407: %s ei sovi tähän" #, c-format msgid "E408: %s must be first in contains list" @@ -5374,18 +5506,23 @@ msgstr "E408: %s kuuluu contains-listan alkuun" #, c-format msgid "E409: Unknown group name: %s" -msgstr "E409: Tuntematon ryhmn nimi: %s" +msgstr "E409: Tuntematon ryhmän nimi: %s" #, c-format msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Virheelluinen :syntax-osakomento: %s" +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" KAIKKI MÄÄRÄ TÄSMÄYS HITAIN KEKSIARVO NIMI ILMAUS" + msgid "E679: recursive loop loading syncolor.vim" -msgstr "E679: rekursiivinen silmukka syncolor.vimiss" +msgstr "E679: rekursiivinen silmukka syncolor.vimissä" #, c-format msgid "E411: highlight group not found: %s" -msgstr "E411: korostusryhm ei lytynyt: %s" +msgstr "E411: korostusryhmää ei löytynyt: %s" #, c-format msgid "E412: Not enough arguments: \":highlight link %s\"" @@ -5396,7 +5533,7 @@ msgid "E413: Too many arguments: \":highlight link %s\"" msgstr "E413: Liikaa argumentteja: :highlight link %s" msgid "E414: group has settings, highlight link ignored" -msgstr "E414: ryhmll on asetuksia, highlight link -komento ohitetaan" +msgstr "E414: ryhmällä on asetuksia, highlight link -komento ohitetaan" #, c-format msgid "E415: unexpected equal sign: %s" @@ -5415,18 +5552,18 @@ msgid "E418: Illegal value: %s" msgstr "E418: Viallinen arvo: %s" msgid "E419: FG color unknown" -msgstr "E419: edustavri tuntematon" +msgstr "E419: edustaväri tuntematon" msgid "E420: BG color unknown" -msgstr "E420: taustavri tuntematon" +msgstr "E420: taustaväri tuntematon" #, c-format msgid "E421: Color name or number not recognized: %s" -msgstr "E421: Vrin nimi tai numero tuntematon: %s" +msgstr "E421: Värin nimi tai numero tuntematon: %s" #, c-format msgid "E422: terminal code too long: %s" -msgstr "E422: terminaalikoodi liian pitk: %s" +msgstr "E422: terminaalikoodi liian pitkä: %s" #, c-format msgid "E423: Illegal argument: %s" @@ -5436,74 +5573,78 @@ msgid "E424: Too many different highlighting attributes in use" msgstr "E424: Liikaa eri korostusattribuutteja" msgid "E669: Unprintable character in group name" -msgstr "E669: Tulostuskelvoton merkki ryhmn nimess" +msgstr "E669: Tulostuskelvoton merkki ryhmän nimessä" msgid "W18: Invalid character in group name" -msgstr "W18: Virheellinen merkki ryhmn nimess" +msgstr "W18: Virheellinen merkki ryhmän nimessä" + +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Liikaa korostuksia ja syntaksiryhmiä" msgid "E555: at bottom of tag stack" -msgstr "E555: tgipinon pohja" +msgstr "E555: tägipinon pohja" msgid "E556: at top of tag stack" -msgstr "E556: tgipinon huippu" +msgstr "E556: tägipinon huippu" msgid "E425: Cannot go before first matching tag" -msgstr "E425: Ei voida menn ensimmist tsmv tgi alummaksi" +msgstr "E425: Ei voida mennä ensimmäistä täsmäävää tägiä alummaksi" #, c-format msgid "E426: tag not found: %s" -msgstr "E426: tgi puuttuu: %s" +msgstr "E426: tägi puuttuu: %s" msgid " # pri kind tag" -msgstr " # arvo tyyppi tgi" +msgstr " # arvo tyyppi tägi" msgid "file\n" msgstr "tiedosto\n" msgid "E427: There is only one matching tag" -msgstr "E427: Vain yksi tgi tsm" +msgstr "E427: Vain yksi tägi täsmää" msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: Ei voida edet viimeisen tsmvn tgin ohi" +msgstr "E428: Ei voida edetä viimeisen täsmäävän tägin ohi" #, c-format msgid "File \"%s\" does not exist" msgstr "Tiedostoa %s ei ole" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" -msgstr "tgi %d/%d%s" +msgstr "tägi %d/%d%s" msgid " or more" msgstr " tai useammasta" msgid " Using tag with different case!" -msgstr " Tgiss eri kirjaintaso" +msgstr " Tägissä eri kirjaintaso" #, c-format msgid "E429: File \"%s\" does not exist" msgstr "E429: Tiedostoa %s ei ole" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" msgstr "" "\n" -" # TILL tagg FRN LINJE i fil/text" +" # TILL tagg FRÅN LINJE i fil/text" #, c-format msgid "Searching tags file %s" -msgstr "Etsitn tgitiedostoa %s" +msgstr "Etsitään tägitiedostoa %s" #, c-format msgid "E430: Tag file path truncated for %s\n" -msgstr "E430: Tgitiedoston polku katkaistu kohdassa %s\n" +msgstr "E430: Tägitiedoston polku katkaistu kohdassa %s\n" + +msgid "Ignoring long line in tags file" +msgstr "Ohitetaan pitkä rivi tägitiedostossa" #, c-format msgid "E431: Format error in tags file \"%s\"" -msgstr "E431: Muotovirh tgitiedostossa %s" +msgstr "E431: Muotovirh tägitiedostossa %s" #, c-format msgid "Before byte %ld" @@ -5511,24 +5652,20 @@ msgstr "Ennen tavua %ld" #, c-format msgid "E432: Tags file not sorted: %s" -msgstr "E432: Tgitiedosto ei ole jrjestetty: %s" +msgstr "E432: Tägitiedosto ei ole järjestetty: %s" -#. never opened any tags file msgid "E433: No tags file" -msgstr "E433: Ei tgitiedostoja" - -msgid "Ignoring long line in tags file" -msgstr "Ohitetaan pitk rivi tgitiedostossa" +msgstr "E433: Ei tägitiedostoja" msgid "E434: Can't find tag pattern" -msgstr "E434: Tgikuviota ei lydy" +msgstr "E434: Tägikuviota ei löydy" msgid "E435: Couldn't find tag, just guessing!" -msgstr "E435: Tgi ei lydy, arvataan." +msgstr "E435: Tägiä ei löydy, arvataan." #, c-format msgid "Duplicate field name: %s" -msgstr "Kaksoiskappale kentn nimest: %s" +msgstr "Kaksoiskappale kentän nimestä: %s" msgid "' not known. Available builtin terminals are:" msgstr " ei tunnettu. Tuetut terminaalit:" @@ -5540,41 +5677,55 @@ msgid "E557: Cannot open termcap file" msgstr "E557: Ei voi avata termcap-tiedostoa" msgid "E558: Terminal entry not found in terminfo" -msgstr "E558: Terminaalia ei lytynyt terminfosta" +msgstr "E558: Terminaalia ei löytynyt terminfosta" msgid "E559: Terminal entry not found in termcap" -msgstr "E559: Terminaalia ei lytynyt termcapista" +msgstr "E559: Terminaalia ei löytynyt termcapista" #, c-format msgid "E436: No \"%s\" entry in termcap" -msgstr "E436: %s ei lytynyt termcapista" +msgstr "E436: %s ei löytynyt termcapista" msgid "E437: terminal capability \"cm\" required" -msgstr "E437: terminaalilla pit olla cm kyvyissn" +msgstr "E437: terminaalilla pitää olla cm kyvyissään" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" msgstr "" "\n" -"--- Terminaalinppimet ---" +"--- Terminaalinäppäimet ---" + +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Ei voida avata tiedostoa $VIMRUNTIME/rgb.txt" + +msgid "Terminal" +msgstr "Terminaali" + +msgid "Terminal-finished" +msgstr "Terminaali-lopetettu" + +msgid "active" +msgstr "aktiivinen" + +msgid "running" +msgstr "suoritetaan" + +msgid "finished" +msgstr "lopetettu" msgid "new shell started\n" msgstr "uusi kuori avattu\n" msgid "Vim: Error reading input, exiting...\n" -msgstr "Vim: Virhe luettaessa sytett, poistutaan...\n" +msgstr "Vim: Virhe luettaessa syötettä, poistutaan...\n" msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "Kytettiin CUT_BUFFER0:aa tyhjn valinnan sijaan" +msgstr "Käytettiin CUT_BUFFER0:aa tyhjän valinnan sijaan" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Rivimr vaihtui odottamatta" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Rivimäärä vaihtui odottamatta" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "Ei voi kumota, jatketaan silti" @@ -5587,7 +5738,7 @@ msgid "E825: Corrupted undo file (%s): %s" msgstr "E825: Pilaanntunut kumoustiedosto (%s): %s" msgid "Cannot write undo file in any directory in 'undodir'" -msgstr "Ei voitu lukea kumoustiedostoa mistn undodir-muuttujan hakemistosta" +msgstr "Ei voitu lukea kumoustiedostoa mistään undodir-muuttujan hakemistosta" #, c-format msgid "Will not overwrite with undo file, cannot read: %s" @@ -5595,7 +5746,7 @@ msgstr "Ei ylikirjoitetat kumoustiedostolla, koska ei voida lukea: %s" #, c-format msgid "Will not overwrite, this is not an undo file: %s" -msgstr "Ei ylikirjoiteta, koska tm ei ole kumoustiedosto: %s" +msgstr "Ei ylikirjoiteta, koska tämä ei ole kumoustiedosto: %s" msgid "Skipping undo file write, nothing to undo" msgstr "Ohitetaan kumoustiedoston kirjoitus, koska ei ole peruutettavia" @@ -5625,97 +5776,217 @@ msgid "E823: Not an undo file: %s" msgstr "E823: Ei ole kumoustiedosto: %s" #, c-format -msgid "E832: Non-encrypted file has encrypted undo file: %s" -msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s" +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Kumoustiedoston purku epäonnistui: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: Kumoustiedosto on salattu: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Epäyhteensopiva kumoustiedosto: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "" +"Tiedoston sisältö on muuttunut, joen kumoustiedot ovat käyttökelvottomia" + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Ladattu kumoustiedoto %s" + +msgid "Already at oldest change" +msgstr "Vanhimmassa muutoksessa" + +msgid "Already at newest change" +msgstr "Nuorimmassa muutoksessa" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: Kumouslukua %ld ei löydy" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: väärät rivinumerot" + +msgid "more line" +msgstr "rivi lisää" + +msgid "more lines" +msgstr "riviä lisää" + +msgid "line less" +msgstr "rivi vähemmän" + +msgid "fewer lines" +msgstr "riviä vähemmän" + +msgid "change" +msgstr "muutos" + +msgid "changes" +msgstr "muutosta" + +# eka %s yläpuolelta, toka %s alapuolelta, kolmas %s aika +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s, %s #%ld %s" + +msgid "before" +msgstr "ennen muutosta" + +msgid "after" +msgstr "jälkeen muutoksen" + +msgid "Nothing to undo" +msgstr "Ei kumottavaa" + +msgid "number changes when saved" +msgstr "numero muutoksia aika tallennettu" + +#, c-format +msgid "%ld seconds ago" +msgstr "%ld sekuntia sitten" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin ei toimi undon jälkeen" + +msgid "E439: undo list corrupt" +msgstr "E439: kumouslista rikki" + +msgid "E440: undo line missing" +msgstr "E440: kumousrivi puuttuu" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Funktio %s on jo olemassa, lisää ! korvataksesi" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Sanakirja-alkio on jo olemassa" + +msgid "E718: Funcref required" +msgstr "E718: Funcref tarvitaan" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Tuntematon funktio: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Virheellinen argumentti: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Kaksoiskappale argumentin nimestä: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Liikaa argumentteja funktiolle %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Vääriä argumentteja funktiolle %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Funktiokutsujen syvyys on enemmän kuin maxfuncdepth" + +#, c-format +msgid "calling %s" +msgstr "kutsutaan funktiota %s" #, c-format -msgid "E826: Undo file decryption failed: %s" -msgstr "E826: Kumoustiedoston purku eponnistui: %s" +msgid "%s aborted" +msgstr "%s keskeytettiin" #, c-format -msgid "E827: Undo file is encrypted: %s" -msgstr "E827: Kumoustiedosto on salattu: %s" +msgid "%s returning #%ld" +msgstr "%s palaa kohdassa #%ld" #, c-format -msgid "E824: Incompatible undo file: %s" -msgstr "E824: Epyhteensopiva kumoustiedosto: %s" +msgid "%s returning %s" +msgstr "%s palaa kohdassa %s" -msgid "File contents changed, cannot use undo info" -msgstr "Tiedoston sislt on muuttunut, joen kumoustiedot ovat " -"kyttkelvottomia" +msgid "E699: Too many arguments" +msgstr "E699: Liikaa argumentteja" #, c-format -msgid "Finished reading undo file %s" -msgstr "Ladattu kumoustiedoto %s" +msgid "E117: Unknown function: %s" +msgstr "E117: Tuntematon funktio: %s" -msgid "Already at oldest change" -msgstr "Vanhimmassa muutoksessa" +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Funktion nimi poistettu: %s" -msgid "Already at newest change" -msgstr "Nuorimmassa muutoksessa" +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Liikaa argumentteja funktiolle %s" #, c-format -msgid "E830: Undo number %ld not found" -msgstr "E830: Kumouslukua %ld ei lydy" +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> skriptin ulkopuolella: %s" -msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: vrt rivinumerot" +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: dict-funktio ilman sanakirjaa: %s" -msgid "more line" -msgstr "rivi lis" +msgid "E129: Function name required" +msgstr "E129: Funktion nimi puuttuu" -msgid "more lines" -msgstr "rivi lis" +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Funktion nimen pitää alkaa suuraakkosella tai merkeillä ’s:’: %s" -msgid "line less" -msgstr "rivi vhemmn" +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Funktion nimessä ei saa olla kaksoispistettä: %s" -msgid "fewer lines" -msgstr "rivi vhemmn" +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Tuntematon funktio: %s" -msgid "change" -msgstr "muutos" +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: ( puuttuu: %s" -msgid "changes" -msgstr "muutosta" +msgid "E862: Cannot use g: here" +msgstr "E862: g: ei toimi täällä" -# eka %s ylpuolelta, toka %s alapuolelta, kolmas %s aika #, c-format -msgid "%ld %s; %s #%ld %s" -msgstr "%ld %s, %s #%ld %s" - -msgid "before" -msgstr "ennen muutosta" +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Sulkeumafunktion ei pitäisi olla uloimmalla tasolla: %s" -msgid "after" -msgstr "jlkeen muutoksen" +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction puuttuu" -msgid "Nothing to undo" -msgstr "Ei kumottavaa" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Ylimääräistä tekstiä :endfunction jälkeen: %s" -msgid "number changes time saved" -msgstr "muutoksia aika tallennettu" +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Funktion nimi on ristiriidassa muuttujan kanssa: %s" #, c-format -msgid "%ld seconds ago" -msgstr "%ld sekuntia sitten" +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Funktiota %s ei voi määritellä uudestaan, koska se on käytössä" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undojoin ei toimi undon jlkeen" +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Funktion nimi ei ole sama kuin skriptin tiedostonnimi: %s" -msgid "E439: undo list corrupt" -msgstr "E439: kumouslista rikki" +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Funktiota %s ei voi poistaa" -msgid "E440: undo line missing" -msgstr "E440: kumousrivi puuttuu" +msgid "E133: :return not inside a function" +msgstr "E133: :return ei ole funktion sisällä" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16- t. 32-bittinen GUI-versio" +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Sulkeita puuttuu: %s" msgid "" "\n" @@ -5731,9 +6002,6 @@ msgstr "" "\n" "MS-Windows 32-bittinen GUI-version" -msgid " in Win32s mode" -msgstr " Win32s-tilassa" - msgid " with OLE support" msgstr " OLE-tuella" @@ -5751,27 +6019,6 @@ msgstr "" "\n" "MS-Windows 32-bittinen konsoliversio" -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16-bittinen versio" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32-bittinen MS-DOS-versio" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16-bittinen MS-DOS-versio" - msgid "" "\n" "MacOS X (unix) version" @@ -5793,13 +6040,6 @@ msgstr "" "\n" "MacOS-version" -msgid "" -"\n" -"RISC OS version" -msgstr "" -"\n" -"RISC OS-version" - msgid "" "\n" "OpenVMS version" @@ -5812,13 +6052,14 @@ msgid "" "Included patches: " msgstr "" "\n" -"Ptsit: " +"Pätsit: " msgid "" "\n" "Extra patches: " -msgstr "\n" -"Muita ptsej: " +msgstr "" +"\n" +"Muita pätsejä: " msgid "Modified by " msgstr "Muokannut " @@ -5828,7 +6069,7 @@ msgid "" "Compiled " msgstr "" "\n" -"Kntnyt " +"Kääntänyt " msgid "by " msgstr ": " @@ -5871,6 +6112,9 @@ msgstr "" msgid "without GUI." msgstr "ilman GUIta." +msgid "with GTK3 GUI." +msgstr "GTK3-GUIlla." + msgid "with GTK2-GNOME GUI." msgstr "GTK2-Gnome-GUIlla." @@ -5899,43 +6143,46 @@ msgid "with Cocoa GUI." msgstr "Cocoa-GUIlla." msgid "with (classic) GUI." -msgstr "perinteisell GUIlla." +msgstr "perinteisellä GUIlla." msgid " Features included (+) or not (-):\n" msgstr " Ominaisuudet mukana (+) ja poissa (-):\n" msgid " system vimrc file: \"" -msgstr " jrjestelmn vimrc: \"" +msgstr " järjestelmän vimrc: \"" msgid " user vimrc file: \"" -msgstr " kyttjn vimrc: \"" +msgstr " käyttäjän vimrc: \"" msgid " 2nd user vimrc file: \"" -msgstr " 2. kyttjn vimrc: \"" +msgstr " 2. käyttäjän vimrc: \"" msgid " 3rd user vimrc file: \"" -msgstr " 3. kyttjn vimrc: \"" +msgstr " 3. käyttäjän vimrc: \"" msgid " user exrc file: \"" -msgstr " kyttjn exrc: \"" +msgstr " käyttäjän exrc: \"" msgid " 2nd user exrc file: \"" -msgstr " 2. kyttjn exrc: \"" +msgstr " 2. käyttäjän exrc: \"" msgid " system gvimrc file: \"" -msgstr " jrjestelmn gvimrc: \"" +msgstr " järjestelmän gvimrc: \"" msgid " user gvimrc file: \"" -msgstr " kyttjn gvimrc: \"" +msgstr " käyttäjän gvimrc: \"" msgid "2nd user gvimrc file: \"" -msgstr "2. kyttjn gvimrc: \"" +msgstr "2. käyttäjän gvimrc: \"" msgid "3rd user gvimrc file: \"" -msgstr "3. kyttjn gvimrc: \"" +msgstr "3. käyttäjän gvimrc: \"" + +msgid " defaults file: \"" +msgstr " defaults-tiedosto: \"" msgid " system menu file: \"" -msgstr " jrjestelmvalikko: \"" +msgstr " järjestelmävalikko: \"" msgid " fall-back for $VIM: \"" msgstr " $VIMin fallback: \"" @@ -5944,10 +6191,10 @@ msgid " f-b for $VIMRUNTIME: \"" msgstr " $VIMRUNTIMEn f-b: \"" msgid "Compilation: " -msgstr "Knns: " +msgstr "Käännös: " msgid "Compiler: " -msgstr "Knnin: " +msgstr "Käännin: " msgid "Linking: " msgstr "Linkitys: " @@ -5962,16 +6209,16 @@ msgid "version " msgstr "versio " msgid "by Bram Moolenaar et al." -msgstr "tekijt Bram Moolenaar et al." +msgstr "tekijät Bram Moolenaar et al." msgid "Vim is open source and freely distributable" -msgstr "Vim on avointa lhdekoodia ja vapaasti jaossa" +msgstr "Vim on avointa lähdekoodia ja vapaasti jaossa" msgid "Help poor children in Uganda!" -msgstr "Auta Ugandan kyhi lapsia" +msgstr "Auta Ugandan köyhiä lapsia" msgid "type :help iccf<Enter> for information " -msgstr "kirjoita :help iccf<Enter> listietoa varten " +msgstr "kirjoita :help iccf<Enter> lisätietoa varten " msgid "type :q<Enter> to exit " msgstr "kirjoita :q<Enter> lopettaaksesi " @@ -5979,8 +6226,8 @@ msgstr "kirjoita :q<Enter> lopettaaksesi " msgid "type :help<Enter> or <F1> for on-line help" msgstr "kirjoita :help<Enter> tai <F1> ohjetta varten " -msgid "type :help version7<Enter> for version info" -msgstr "kirjoita :help version7<Enter> versiotietoja varten " +msgid "type :help version8<Enter> for version info" +msgstr "kirjoita :help version8<Enter> versiotietoja varten " msgid "Running in Vi compatible mode" msgstr "Suoritetaan Vi-yhteensopivuustilaa" @@ -5992,13 +6239,13 @@ msgid "type :help cp-default<Enter> for info on this" msgstr "kirjoita :help cp-default<Enter> ohjetta oletuksista varten" msgid "menu Help->Orphans for information " -msgstr "valikko Ohje->Orvot listietoja varten " +msgstr "valikko Ohje->Orvot lisätietoja varten " msgid "Running modeless, typed text is inserted" -msgstr "Suoritetaan tilattomana, kirjoitettu teksti sytetn" +msgstr "Suoritetaan tilattomana, kirjoitettu teksti syötetään" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda sytetilaa" +msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda syötetilaa" msgid " for two modes " msgstr " kahta tilaa varten " @@ -6010,102 +6257,110 @@ msgid " for Vim defaults " msgstr " Vim-oletuksia varten" msgid "Sponsor Vim development!" -msgstr "Tue Vimin kehityst" +msgstr "Tue Vimin kehitystä" msgid "Become a registered Vim user!" -msgstr "Rekisteridy Vim-kyttjksi." +msgstr "Rekisteröidy Vim-käyttäjäksi." msgid "type :help sponsor<Enter> for information " -msgstr "kirjoita :help sponsor<Enter> listietoja varten" +msgstr "kirjoita :help sponsor<Enter> lisätietoja varten" msgid "type :help register<Enter> for information " -msgstr "kirjoita :help register<Enter> listietoja varten" +msgstr "kirjoita :help register<Enter> lisätietoja varten" msgid "menu Help->Sponsor/Register for information " -msgstr "valikko Ohje->Sponsoroi/Rekisteri listietoja varten" - -msgid "WARNING: Windows 95/98/ME detected" -msgstr "VAROITUS: Window 95/98/ME havaittu" - -msgid "type :help windows95<Enter> for info on this" -msgstr "kirjoita :help windows95<Enter> listietoja varten" +msgstr "valikko Ohje->Sponsoroi/Rekisteröi lisätietoja varten" msgid "Already only one window" -msgstr "En yksi ikkuna jljell" +msgstr "Enää yksi ikkuna jäljellä" msgid "E441: There is no preview window" msgstr "E441: Ei esikatseluikkunaa" msgid "E442: Can't split topleft and botright at the same time" -msgstr "E442: Ei voi jakaa vasenta ylnurkkaa ja oikeaa alanurkkaa yhtaikaa" +msgstr "E442: Ei voi jakaa vasenta ylänurkkaa ja oikeaa alanurkkaa yhtäaikaa" msgid "E443: Cannot rotate when another window is split" -msgstr "E443: Ei voi kiert kun toinen ikkuna on jaettu" +msgstr "E443: Ei voi kiertää kun toinen ikkuna on jaettu" msgid "E444: Cannot close last window" -msgstr "E444: Ei voi sulkea viimeist ikkunaa" +msgstr "E444: Ei voi sulkea viimeistä ikkunaa" msgid "E813: Cannot close autocmd window" msgstr "E813: Ei voi sulkea autocmd-ikkunaa" msgid "E814: Cannot close window, only autocmd window would remain" -msgstr "E814: Ei voi sulkea viimeist ikkunaa, joka ei ole autocmd-ikkuna" +msgstr "E814: Ei voi sulkea viimeistä ikkunaa, joka ei ole autocmd-ikkuna" msgid "E445: Other window contains changes" -msgstr "E445: Toinen ikkuna sislt muutoksia" +msgstr "E445: Toinen ikkuna sisältää muutoksia" msgid "E446: No file name under cursor" -msgstr "E446: Ei tiedostonime kursorin alla" +msgstr "E446: Ei tiedostonimeä kursorin alla" #, c-format msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: Tiedosto %s ei lydy polulta" +msgstr "E447: Tiedosto %s ei löydy polulta" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Käyttökelvoton ID: %ld (pitää olla vähintään 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID jo käytössä: %ld" + +msgid "List or number required" +msgstr "Lista tai luku tarvitaan" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Käyttöklvoton ID: %ld (pitää olla vähintään 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID:tä ei löydy: %ld" #, c-format msgid "E370: Could not load library %s" msgstr "E370: Kirjaston %s lataaminen ei onnistu" msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "Sori, komento ei toimi, Perl kirjastoa ei voinut ladata." +msgstr "komento ei toimi, Perl kirjastoa ei voinut ladata." msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" msgstr "E299: Perl-suoritus kielletty hiekkalaatikossa ilman Safe-moduulia" msgid "Edit with &multiple Vims" -msgstr "&Muokkaa usealla Vimill" +msgstr "&Muokkaa usealla Vimillä" msgid "Edit with single &Vim" -msgstr "Muokkaa yhdell &Vimill" +msgstr "Muokkaa yhdellä &Vimillä" msgid "Diff with Vim" -msgstr "Diffi Vimill" +msgstr "Diffi Vimillä" msgid "Edit with &Vim" -msgstr "Muokkaa &Vimill" +msgstr "Muokkaa &Vimillä" -#. Now concatenate msgid "Edit with existing Vim - " -msgstr "Muokkaa olemassaolevalla Vimill - " +msgstr "Muokkaa olemassaolevalla Vimillä - " msgid "Edits the selected file(s) with Vim" -msgstr "Muokkaa valittuja tiedostoja Vimill" +msgstr "Muokkaa valittuja tiedostoja Vimillä" msgid "Error creating process: Check if gvim is in your path!" -msgstr "Virhe prosessin kynnistmisess, varmista ett gvim on polulla" +msgstr "Virhe prosessin käynnistämisessä, varmista että gvim on polulla" msgid "gvimext.dll error" msgstr "gvimext.dll-virhe" msgid "Path length too long!" -msgstr "Liian pitk polku" +msgstr "Liian pitkä polku" msgid "--No lines in buffer--" -msgstr "--Ei rivej puskurissa--" +msgstr "--Ei rivejä puskurissa--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Komento peruttu" @@ -6113,15 +6368,15 @@ msgid "E471: Argument required" msgstr "E471: Argumentti puuttuu" msgid "E10: \\ should be followed by /, ? or &" -msgstr "E10: \\:n jlkeen pit tulla /, ? tai &" +msgstr "E10: \\:n jälkeen pitää tulla /, ? tai &" msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" msgstr "E11: Virheellinen komentorivi-ikkuna, <CR> suorittaa, Ctrl C lopettaa" msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" msgstr "" -"E12: Komentoa ei tueta exrc:ss tai vimrc:ss tss hakemistossa tai " -"tgihaussa" +"E12: Komentoa ei tueta exrc:ssä tai vimrc:ssä tässä hakemistossa tai " +"tägihaussa" msgid "E171: Missing :endif" msgstr "E171: :endif puuttuu" @@ -6142,10 +6397,10 @@ msgid "E588: :endfor without :for" msgstr "E588: :endfor ilman komentoa :for" msgid "E13: File exists (add ! to override)" -msgstr "E13: Tiedosto on jo olemassa (lis ! ohittaaksesi)" +msgstr "E13: Tiedosto on jo olemassa (lisää ! ohittaaksesi)" msgid "E472: Command failed" -msgstr "E472: Komento eponnistui" +msgstr "E472: Komento epäonnistui" #, c-format msgid "E234: Unknown fontset: %s" @@ -6157,10 +6412,14 @@ msgstr "E235: Tuntematon fontti: %s" #, c-format msgid "E236: Font \"%s\" is not fixed-width" -msgstr "E236: Fontti %s ei ole tasavlinen" +msgstr "E236: Fontti %s ei ole tasavälinen" msgid "E473: Internal error" -msgstr "E473: Sisinen virhe" +msgstr "E473: Sisäinen virhe" + +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Sisäinen virhe: %s" msgid "Interrupted" msgstr "Keskeytetty" @@ -6191,93 +6450,93 @@ msgstr "E17: %s on hakemisto" #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: Kirjastukutsu %s() eponnistui" +msgstr "E364: Kirjastukutsu %s() epäonnistui" #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Ei voitu ladta kirjastofunktiota %s" msgid "E19: Mark has invalid line number" -msgstr "E19: Merkill on virheellinen rivinumero" +msgstr "E19: Merkillä on virheellinen rivinumero" msgid "E20: Mark not set" -msgstr "E20: Merkki ei asetettu" +msgstr "E20: Merkkiä ei asetettu" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: Ei voi tehd muutoksia, modifiable on pois plt" +msgstr "E21: Ei voi tehdä muutoksia, modifiable on pois päältä" msgid "E22: Scripts nested too deep" -msgstr "E22: Liian monta tasoa skripteiss" +msgstr "E22: Liian monta tasoa skripteissä" msgid "E23: No alternate file" msgstr "E23: Eo vaihtoehtoista tiedostoa" msgid "E24: No such abbreviation" -msgstr "E24: Lyhennett ei ole" +msgstr "E24: Lyhennettä ei ole" msgid "E477: No ! allowed" msgstr "E477: ! ei sallittu" msgid "E25: GUI cannot be used: Not enabled at compile time" -msgstr "E25: GUIta ei voi kytt, koska sit ei knnetty mukaan" +msgstr "E25: GUIta ei voi käyttää, koska sitä ei käännetty mukaan" msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -msgstr "E26: Hepreaa ei voi kytt, koska sit ei knnetty mukaan\n" +msgstr "E26: Hepreaa ei voi käyttää, koska sitä ei käännetty mukaan\n" msgid "E27: Farsi cannot be used: Not enabled at compile time\n" -msgstr "E27: Farsia ei voi kytt, koska sit ei knnetty mukaan\n" +msgstr "E27: Farsia ei voi käyttää, koska sitä ei käännetty mukaan\n" msgid "E800: Arabic cannot be used: Not enabled at compile time\n" -msgstr "E800: Arabiaa ei voi kytt, koska sit ei knnetty mukaan\n" +msgstr "E800: Arabiaa ei voi käyttää, koska sitä ei käännetty mukaan\n" #, c-format msgid "E28: No such highlight group name: %s" -msgstr "E28: Korostusryhm ei ole nimell: %s" +msgstr "E28: Korostusryhmää ei ole nimellä: %s" msgid "E29: No inserted text yet" -msgstr "E29: Teksti ei ole sytetty viel" +msgstr "E29: Tekstiä ei ole syötetty vielä" msgid "E30: No previous command line" -msgstr "E30: Ei edellist komentorivi" +msgstr "E30: Ei edellistä komentoriviä" msgid "E31: No such mapping" msgstr "E31: Kuvausta ei ole" msgid "E479: No match" -msgstr "E479: Ei tsm" +msgstr "E479: Ei täsmää" #, c-format msgid "E480: No match: %s" -msgstr "E480: Ei tsm: %s" +msgstr "E480: Ei tsämää: %s" msgid "E32: No file name" -msgstr "E32: Ei tiedostonime" +msgstr "E32: Ei tiedostonimeä" msgid "E33: No previous substitute regular expression" -msgstr "E33: Ei edellist korvausta snnlliselle ilmaukselle" +msgstr "E33: Ei edellistä korvausta säännölliselle ilmaukselle" msgid "E34: No previous command" -msgstr "E34: Ei edellist komentoa" +msgstr "E34: Ei edellistä komentoa" msgid "E35: No previous regular expression" -msgstr "E35: Ei edellist snnllist ilmausta" +msgstr "E35: Ei edellistä säännöllistä ilmausta" msgid "E481: No range allowed" msgstr "E481: Arvoalue ei sallittu" msgid "E36: Not enough room" -msgstr "E36: Tila ei riit" +msgstr "E36: Tila ei riitä" #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "E247: palvelinta %s ei ole rekisterityn" +msgstr "E247: palvelinta %s ei ole rekisteröitynä" #, c-format msgid "E482: Can't create file %s" msgstr "E482: Tiedostoa %s ei voi luoda" msgid "E483: Can't get temp file name" -msgstr "E483: vliaikaistiedoston nime ei saada selville" +msgstr "E483: väliaikaistiedoston nimeä ei saada selville" #, c-format msgid "E484: Can't open file %s" @@ -6287,54 +6546,50 @@ msgstr "E484: Ei voi avata tiedostoa %s" msgid "E485: Can't read file %s" msgstr "E485: Ei voi lukea tiedostoa %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "" -"E37: Viimeisen muutoksen jlkeen ei ole kirjoitettu (lis ! ohittaaksesi)" - msgid "E38: Null argument" msgstr "E38: Null-argumentti" msgid "E39: Number expected" -msgstr "E39: Pit olla numero" +msgstr "E39: Pitää olla numero" #, c-format msgid "E40: Can't open errorfile %s" msgstr "E40: virhetiedostoa %s ei voi avata" msgid "E233: cannot open display" -msgstr "E233: nytt ei voi avata" +msgstr "E233: näyttöä ei voi avata" msgid "E41: Out of memory!" msgstr "E41: Muisti loppui" msgid "Pattern not found" -msgstr "Kuviota ei lydy" +msgstr "Kuviota ei löydy" #, c-format msgid "E486: Pattern not found: %s" -msgstr "E486: Kuviota ei lydy: %s" +msgstr "E486: Kuviota ei löydy: %s" msgid "E487: Argument must be positive" -msgstr "E487: Argumentin pit olla positiivinen" +msgstr "E487: Argumentin pitää olla positiivinen" msgid "E459: Cannot go back to previous directory" -msgstr "E459: Ei voi siirty edelliseen hakemistoon" +msgstr "E459: Ei voi siirtyä edelliseen hakemistoon" # ;-) msgid "E42: No Errors" -msgstr "E42: Ei virheit" +msgstr "E42: Ei virheitä" msgid "E776: No location list" msgstr "E776: Ei sijaintilistaa" msgid "E43: Damaged match string" -msgstr "E43: Viallinen tsmysmerkkijono" +msgstr "E43: Viallinen täsmäysmerkkijono" msgid "E44: Corrupted regexp program" msgstr "E44: Viallinen regexp-ohjelma" msgid "E45: 'readonly' option is set (add ! to override)" -msgstr "E45: readonly asetettu (lis ! ohittaaksesi)" +msgstr "E45: readonly asetettu (lisää ! ohittaaksesi)" #, c-format msgid "E46: Cannot change read-only variable \"%s\"" @@ -6344,6 +6599,32 @@ msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa" msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: Muuttujaa ei voi asettaa hiekkalaatikossa: %s" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Sanakirjassa ei voi olla tyhjiä avaimia" + +msgid "E715: Dictionary required" +msgstr "E715: Sanakirja tarvitaan" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Indeksi %ld luettelon rajojen ulkopuolella" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Liikaa argumentteja funktiolle: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Avainta %s ei ole sanakirjassa" + +msgid "E714: List required" +msgstr "E714: Lista tarvitaan" + +# datarakenteita +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Argumentin %s pitää olla lista tai sanakirja" + msgid "E47: Error while reading errorfile" msgstr "E47: Virhe virhetiedostoa luettaessa" @@ -6351,16 +6632,16 @@ msgid "E48: Not allowed in sandbox" msgstr "E48: Ei sallittu hiekkalaatikossa" msgid "E523: Not allowed here" -msgstr "E523: Ei sallittu tll" +msgstr "E523: Ei sallittu täällä" msgid "E359: Screen mode setting not supported" -msgstr "E359: Nytttila-asetus ei tuettu" +msgstr "E359: Näyttötila-asetus ei tuettu" msgid "E49: Invalid scroll size" msgstr "E49: Virheellinen vierityskoko" msgid "E91: 'shell' option is empty" -msgstr "E91: shell-asetus on tyhj" +msgstr "E91: shell-asetus on tyhjä" msgid "E255: Couldn't read in sign data!" msgstr "E255: Merkkidatan luku ei onnistu" @@ -6369,22 +6650,22 @@ msgid "E72: Close error on swap file" msgstr "E72: Swap-tiedoston sulkemisvirhe" msgid "E73: tag stack empty" -msgstr "E73: tgipino tyhj" +msgstr "E73: tägipino tyhjä" msgid "E74: Command too complex" msgstr "E74: Liian monimutkainen komento" msgid "E75: Name too long" -msgstr "E75: Liian pitk nimi" +msgstr "E75: Liian pitkä nimi" msgid "E76: Too many [" msgstr "E76: Liian monta [:a" msgid "E77: Too many file names" -msgstr "E77: Liikaa tiedostonimi" +msgstr "E77: Liikaa tiedostonimiä" msgid "E488: Trailing characters" -msgstr "E488: Ylimrisi merkkej perss" +msgstr "E488: Ylimääräisiä merkkejä perässä" msgid "E78: Unknown mark" msgstr "E78: Tuntematon merkki" @@ -6401,8 +6682,8 @@ msgstr "E592: winwidth ei voi olla pienempi kuin winminwidth" msgid "E80: Error while writing" msgstr "E80: Kirjoitusvirhe" -msgid "Zero count" -msgstr "Nollalaskuri" +msgid "E939: Positive count required" +msgstr "E939: Positiivinen luku tarvitaan" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> skriptin ulkopuolella" @@ -6416,15 +6697,15 @@ msgstr "E463: Alue on suojattu, muuttaminen ei onnistu" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans ei tue muutoksia kirjoitussuojattuihin tiedostoihin" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Sisinen virhe: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" -msgstr "E363: kuvio kytt enemmn muistia kuin maxmempattern on" +msgstr "E363: kuvio käyttää enemmän muistia kuin maxmempattern on" msgid "E749: empty buffer" -msgstr "E749: tyhj puskuri" +msgstr "E749: tyhjä puskuri" + +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Puskuria %ld ei ole" msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Virheellinen hakulauseke tai erotin" @@ -6436,45 +6717,198 @@ msgstr "E139: Tiedosto on ladattu toiseen puskuriin" msgid "E764: Option '%s' is not set" msgstr "E764: Asetus %s on asettamatta" +msgid "E850: Invalid register name" +msgstr "E850: Virheellinen rekisterin nimi" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Hakemisto puuttuu kohteesta %s: %s" + msgid "search hit TOP, continuing at BOTTOM" -msgstr "haku psi ALKUUN, jatketaan LOPUSTA" +msgstr "haku pääsi ALKUUN, jatketaan LOPUSTA" msgid "search hit BOTTOM, continuing at TOP" -msgstr "haku psi LOPPUUN, jatketaan ALUSTA" +msgstr "haku pääsi LOPPUUN, jatketaan ALUSTA" #, c-format msgid "Need encryption key for \"%s\"" msgstr "Tarvitaan salausavain kohteelle %s " -msgid "writelines() requires list of strings" -msgstr "writelines()-komennolle pit antaa merkkijonolista" +msgid "empty keys are not allowed" +msgstr "tyhjiä avaimia ei voi käyttää" + +msgid "dictionary is locked" +msgstr "dictionary on lukittu" + +msgid "list is locked" +msgstr "luettelo on lukittu" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "avaimen %s lisääminen sanakirjaan ei onnistu" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "indeksin pitää olla int tai slice, ei %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "odottettiin insanssia tyypeistä str() tai unicode(), ei %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "odotettiin instanssia tyypeistä bytes() tai str(), ei %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"odotettiin instanssia tyypeistä int(), long() tai mitä tahansa joka " +"muuntuisi tyyppiin long(), ei %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "odotettiin tyyppiä int() tai jotain joka muuntuu tyyppiin int(), ei %s" + +msgid "value is too large to fit into C int type" +msgstr "arvo on liian suuri mahtumaan C:n int-tyyppiin" + +msgid "value is too small to fit into C int type" +msgstr "arvo on liian pieni mahtumaan C:n int-tyyppiin" + +msgid "number must be greater than zero" +msgstr "luvun on oltava nollaa suurempi" + +msgid "number must be greater or equal to zero" +msgstr "luvun on oltava yhtä suuri tai suurempi kuin nolla" + +msgid "can't delete OutputObject attributes" +msgstr "ei voi poistaa OutputObject-attribuutteja" + +#, c-format +msgid "invalid attribute: %s" +msgstr "virheellinen attribuutti: %s" msgid "E264: Python: Error initialising I/O objects" msgstr "E264: Python: Virhe IO-olioiden alustuksessa" -msgid "no such buffer" -msgstr "puskuria ei ole" +msgid "failed to change directory" +msgstr "hakemistoa ei voitu muuttaa" -msgid "attempt to refer to deleted window" -msgstr "yritettiin viitata poistettuun ikkunaan" +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "odotettiin 3-tuplea tuloksena imp.find_module()-kutsulle, ei %s" -msgid "readonly attribute" -msgstr "kirjoitussuojattu attribuutti" +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"odotettiin 3-tuple tuloksnea imp.find_module()-kutsulle, mutta tuplen koko " +"onkin %d" -msgid "cursor position outside buffer" -msgstr "kursorin sijainti puskurin ulkopuolella" +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "sisäinen virhe: imp.find_module palautti tuplen joka sisältää nullin" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "ei voi poistaa vim.Dictionary-attribuutteja" + +msgid "cannot modify fixed dictionary" +msgstr "ei voida muuttaa kiinnitettyä sanakirjaa" + +#, c-format +msgid "cannot set attribute %s" +msgstr "ei voi asettaa attribuuttia %s" + +msgid "hashtab changed during iteration" +msgstr "hashtab muuttui kesken iteraation" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "sekvenssin elementin koon pitäisi olla 2, ei %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "listakonstruktori ei tue avainsanaparametrejä" + +msgid "list index out of range" +msgstr "listaindeksi arvoalueen ulkopuolelta" + +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "sisäinen virhe: ei pystytty hakea vimin listan indeksiä %d" + +msgid "slice step cannot be zero" +msgstr "slicen askel ei voi olla nolla" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "yritettiin sijoittaa sekvenssiä jonka koko on enemmän kuin %d sliceen" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "sisäinen virhe: ei vim-listan indeksiä %d" + +msgid "internal error: not enough list items" +msgstr "sisäinen virhe: ei tarpeeksi listan kohtia" + +msgid "internal error: failed to add item to list" +msgstr "sisäinen virhe: ei voitu lisätä kohtaa listaan" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"yritettiin asettaa sekvenssiä jonka koko on %d sliceen jonka koko on %d" + +msgid "failed to add item to list" +msgstr "ei voitu lisätä kohtaa listaan" + +msgid "cannot delete vim.List attributes" +msgstr "ei voi poistaa vim.List-attribuutteja" + +msgid "cannot modify fixed list" +msgstr "ei voida muokata kiinitettyä listaa" #, c-format -msgid "<window object (deleted) at %p>" -msgstr "<ikkunaolio (poistettu) kohdassa %p>" +msgid "unnamed function %s does not exist" +msgstr "nimetöntä funktiota %s ei ole" #, c-format -msgid "<window object (unknown) at %p>" -msgstr "<ikkunaolio (tuntematon) kohdassa %p>" +msgid "function %s does not exist" +msgstr "funktiota %s ei ole" #, c-format -msgid "<window %d>" -msgstr "<ikkuna %d>" +msgid "failed to run function %s" +msgstr "ei voitu suorittaa funktiota %s" + +msgid "unable to get option value" +msgstr "ei voitu hakea asetuksen arvoa" + +msgid "internal error: unknown option type" +msgstr "sisäinen virhe: tuntematon asetustyyppi" + +msgid "problem while switching windows" +msgstr "virhe ikkunaa vaihtaessa" + +#, c-format +msgid "unable to unset global option %s" +msgstr "ei voi tyhjentää yleistä asetusta %s" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "ei voi tyhjentää asetusta %s jolla ei ole yleistä arvoa" + +msgid "attempt to refer to deleted tab page" +msgstr "yritettiin viitata poistettuun välilehteen" + +msgid "no such tab page" +msgstr "välilehteä ei ole" + +msgid "attempt to refer to deleted window" +msgstr "yritettiin viitata poistettuun ikkunaan" + +msgid "readonly attribute: buffer" +msgstr "kirjoitussuojausattribuutti: puskuri" + +msgid "cursor position outside buffer" +msgstr "kursorin sijainti puskurin ulkopuolella" msgid "no such window" msgstr "ikkunaa ei ole" @@ -6482,45 +6916,78 @@ msgstr "ikkunaa ei ole" msgid "attempt to refer to deleted buffer" msgstr "yritettiin viitata poistettuun puskuriin" -# New Line eli uusi rivinvaihtomerkki (ei CR, LF tai CR LF) -#~ msgid "[NL found]" -#~ msgstr "[NL puuttuu]" +msgid "failed to rename buffer" +msgstr "ei voity uudelleennimetä puskuria" -#~ msgid "Vim dialog..." -#~ msgstr "Vim-ikkuna..." +msgid "mark name must be a single character" +msgstr "merkin nimen pitää olla yksi merkki" -#~ msgid "Font Selection" -#~ msgstr "Fontin valinta" +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "odotettiin vim.Buffer-oliota, ei %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "ei voitu vaihtaa puskuriin %d" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "odotettiin vim.Window-oliota, saatiin %s" + +msgid "failed to find window in the current tab page" +msgstr "ei voitu löytää ikkunaa nykyiselle välilehtisivulle" + +msgid "did not switch to the specified window" +msgstr "ei vaihdettu annettuun ikkunaan" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "odotettiin vim.TabPage-oliota, saatiin %s" -#~ msgid "E569: maximum number of cscope connections reached" -#~ msgstr "E569: enimmismr cscope-yhteyksi otettu" +msgid "did not switch to the specified tab page" +msgstr "ei voitu vaihtaa annetulle välilehtisivulle" -#~ msgid "-name <name>\t\tUse resource as if vim was <name>" -#~ msgstr "-name <nimi>\t\tKyt resurssia vim <nimen>" +msgid "failed to run the code" +msgstr "ei voitu suorittaa koodia" -#~ msgid "\t\t\t (Unimplemented)\n" -#~ msgstr "\t\t\t (toteuttamatta)\n" +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval ei palauttanut python-oliota" -#~ msgid "E290: over-the-spot style requires fontset" -#~ msgstr "E290: over-the-spot-tyyliss pit olla fontset" +msgid "E859: Failed to convert returned python object to vim value" +msgstr "E859: Ei voitu konvertoida python-oliota vim-arvoksi" -#~ msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -#~ msgstr "E291: GTK+-versio vanhempi kuin 1.2.3: Tila-alue poistettu kytst" +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "ei voitu konvertoida oliota %s vim-sanakirjaksi" -#~ msgid "E292: Input Method Server is not running" -#~ msgstr "E292: Sytemetodipalvelin ei ole kynniss" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "ei voitu konvertoida tyypistä %s vim-listaksi" -#~ msgid "E396: containedin argument not accepted here" -#~ msgstr "E396: containedin ei sovi thn" +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "ei voi konvertoida oliota %s vim-tietorakenteeksi" -#~ msgid "with GTK-GNOME GUI." -#~ msgstr "GTK-Gnome-GUIlla." +msgid "internal error: NULL reference passed" +msgstr "sisäinen virhe: NULL-viite annettu" -#~ msgid "with GTK GUI." -#~ msgstr "GTK-GUIlla." +msgid "internal error: invalid value type" +msgstr "sisäinen virhe: huono arvotyyppi" -#~ msgid "-V[N]\t\tVerbose level" -#~ msgstr "-V[N]\t\tMonisanaisuustaso" +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Ei voitu asettaa polkukoukkua: sys.path_hooks ei ole lista\n" +"Koeta seuraavaa:\n" +"- lisää vim.path_hook muuttujaan sys.path_hooks\n" +"- lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path\n" -#~ msgid "...(truncated)" -#~ msgstr "...(katkaistu)" +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Ei onnistuttu asettaman polkua: sys.path ei ole list\n" +"Lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path" diff --git a/src/po/fr.po b/src/po/fr.po index fe466b301f..d70346c39d 100644 --- a/src/po/fr.po +++ b/src/po/fr.po @@ -3,26 +3,24 @@ # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# FIRST AUTHOR DindinX <David.Odin@bigfoot.com> 2000. -# SECOND AUTHOR Adrien Beau <version.francaise@free.fr> 2002, 2003. -# THIRD AUTHOR David Blanchet <david.blanchet@free.fr> 2006, 2008. -# FOURTH AUTHOR Dominique Pell <dominique.pelle@gmail.com> 2008, 2013. -# -# Latest translation available at: -# http://dominique.pelle.free.fr/vim-fr.php +# FIRST AUTHOR DindinX <David.Odin@bigfoot.com> 2000. +# SECOND AUTHOR Adrien Beau <version.francaise@free.fr> 2002, 2003. +# THIRD AUTHOR David Blanchet <david.blanchet@free.fr> 2006, 2008. +# FOURTH AUTHOR Dominique Pell <dominique.pelle@gmail.com> 2008, 2018. # msgid "" msgstr "" "Project-Id-Version: Vim(Franais)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-05-27 04:55+0200\n" -"PO-Revision-Date: 2013-05-27 10:22+0200\n" +"POT-Creation-Date: 2018-05-08 09:00+0200\n" +"PO-Revision-Date: 2018-05-08 09:17+0200\n" "Last-Translator: Dominique Pell <dominique.pelle@gmail.com>\n" "Language-Team: \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-15\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() appele avec un mot de passe vide" @@ -60,6 +58,12 @@ msgid "E83: Cannot allocate buffer, using other one..." msgstr "" "E83: L'allocation du tampon a chou : arrtez Vim, librez de la mmoire" +msgid "E931: Buffer cannot be registered" +msgstr "E931: Le tampon ne peut pas tre enregistr" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Tentative de suppression d'un tampon en cours d'utilisation" + msgid "E515: No buffers were unloaded" msgstr "E515: Aucun tampon n'a t dcharg" @@ -90,18 +94,16 @@ msgstr "1 tampon a msgid "%d buffers wiped out" msgstr "%d tampons ont t dtruits" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Impossible de dcharger le dernier tampon" + # AB - La version franaise est meilleure que la version anglaise. msgid "E84: No modified buffer found" msgstr "E84: Aucun tampon n'est modifi" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Aucun tampon n'est list" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Le tampon %ld n'existe pas" - # AB - Je ne suis pas sr que l'on puisse obtenir ce message. msgid "E87: Cannot go beyond last buffer" msgstr "E87: Impossible d'aller aprs le dernier tampon" @@ -115,8 +117,17 @@ msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" "E89: Le tampon %ld n'a pas t enregistr (ajoutez ! pour passer outre)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Impossible de dcharger le dernier tampon" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Tche en cours d'excution (ajouter ! pour terminer la tche)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Modifications non enregistres (ajoutez ! pour passer outre)" + +msgid "E948: Job still running" +msgstr "E948: Tche en cours d'excution" + +msgid "E37: No write since last change" +msgstr "E37: Modifications non enregistres" msgid "W14: Warning: List of file names overflow" msgstr "W14: Alerte : La liste des noms de fichier dborde" @@ -156,6 +167,9 @@ msgstr "[Nouveau fichier]" msgid "[Read errors]" msgstr "[Erreurs de lecture]" +msgid "[RO]" +msgstr "[RO]" + # AB - La version courte, "[RO]", devrait-elle tre traduite par "[LS]" ? # Il faudrait faire un sondage auprs des utilisateurs francophones. msgid "[readonly]" @@ -181,7 +195,6 @@ msgstr "ligne %ld sur %ld --%d%%-- col " msgid "[No Name]" msgstr "[Aucun nom]" -#. must be a help buffer msgid "help" msgstr "aide" @@ -212,6 +225,9 @@ msgstr "" "\n" "# Liste des tampons :\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: criture impossible, l'option 'buftype' est active" + msgid "[Scratch]" msgstr "[Brouillon]" @@ -230,12 +246,102 @@ msgstr "Symboles dans %s :" msgid " line=%ld id=%d name=%s" msgstr " ligne=%ld id=%d nom=%s" -# AB - Je n'ai pas trouv de traduction satisfaisante au verbe "diff". Comme -# Vim fait en pratique appel au programme "diff" pour evaluer les -# diffrences entre fichiers, "to diff" a t traduit par "utiliser diff" -# et d'autres expressions appropries. +msgid "E902: Cannot connect to port" +msgstr "E902: Impossible de se connecter au port" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() dans channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() dans channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: commande reue avec un argument qui n'est pas une chane" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: le dernier argument de expr/call doit tre un nombre" + +msgid "E904: third argument for call must be a list" +msgstr "E904: le troisime argument de \"call\" doit tre une liste" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: commande inconnue reue : %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s() : criture sans tre connect" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s() : erreur d'criture" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Impossible d'utiliser un callback avec %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: Impossible d'utiliser ch_evalexpr()/ch_sendexpr() avec un canal brut " +"ou nl" + +msgid "E906: not an open channel" +msgstr "E906: pas un canal ouvert" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: fichier _io ncessite _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: tampon in_io ncessite in_buf ou in_name " + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: le tampon doit tre charg : %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Le fichier est chiffr avec une mthode inconnue" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "" +"Alerte : utilisation d'une mthode de chiffrage faible ; consultez :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Tapez la cl de chiffrement : " + +msgid "Enter same key again: " +msgstr "Tapez la cl nouveau : " + +msgid "Keys don't match!" +msgstr "Les cls ne correspondent pas !" + +msgid "[crypted]" +msgstr "[chiffr]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Il manque ':' dans le Dictionnaire %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Cl duplique dans le Dictionnaire : %s" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Il manque une virgule dans le Dictionnaire : %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Il manque '}' la fin du Dictionnaire : %s" + +msgid "extend() argument" +msgstr "argument de extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: La cl existe dj : %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: Impossible d'utiliser diff sur plus de %ld tampons" msgid "E810: Cannot read or write temp files" @@ -300,7 +406,6 @@ msgid " Keyword completion (^N^P)" msgstr " Compltement de mot-cl (^N^P)" # DB - todo : Faut-il une majuscule "mode" ? -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " mode ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -385,6 +490,9 @@ msgstr "Examen : %s" msgid "Scanning tags." msgstr "Examen des marqueurs." +msgid "match in file" +msgstr "correspondance dans le fichier" + # AB - Cette chane de caractres est ajoute en dbut de ligne lorsqu'une # opration de compltion est rpte (typiquement avec CTRL-X CTRL-N). # Que ce soit en anglais ou en franais, il y a un problme de majuscules. @@ -392,10 +500,6 @@ msgstr "Examen des marqueurs." msgid " Adding" msgstr " Ajout" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Recherche en cours..." @@ -429,10 +533,6 @@ msgstr "Correspondance %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Caractres inattendus avant '='" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: index de Liste hors limites : %ld au-del de la fin" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Variable non dfinie : %s" @@ -440,42 +540,6 @@ msgstr "E121: Variable non d msgid "E111: Missing ']'" msgstr "E111: ']' manquant" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: L'argument de %s doit tre une Liste" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: L'argument de %s doit tre une Liste ou un Dictionnaire" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Impossible d'utiliser une cl vide dans un Dictionnaire" - -msgid "E714: List required" -msgstr "E714: Liste requise" - -msgid "E715: Dictionary required" -msgstr "E715: Dictionnaire requis" - -# DB : Suggestion -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: La fonction %s a reu trop d'arguments" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: La cl %s n'existe pas dans le Dictionnaire" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: La fonction %s existe dj (ajoutez ! pour la remplacer)" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Une entre du Dictionnaire porte dj ce nom" - -msgid "E718: Funcref required" -msgstr "E718: Rfrence de fonction (Funcref) requise" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Utilisation de [:] impossible avec un Dictionnaire" @@ -483,14 +547,13 @@ msgstr "E719: Utilisation de [:] impossible avec un Dictionnaire" msgid "E734: Wrong variable type for %s=" msgstr "E734: Type de variable erron avec %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Fonction inconnue : %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Nom de variable invalide : %s" +msgid "E806: using Float as a String" +msgstr "E806: Utilisation d'un Flottant comme une Chane" + # DB - todo : trouver mieux que "destinations". msgid "E687: Less targets than List items" msgstr "E687: Moins de destinations que d'lments dans la Liste" @@ -513,7 +576,7 @@ msgid "E708: [:] must come last" msgstr "E708: [:] ne peut tre spcifi qu'en dernier" msgid "E709: [:] requires a List value" -msgstr "E709: [:] requiert une Liste" +msgstr "E709: [:] ncessite une Liste" msgid "E710: List value has more items than target" msgstr "E710: La Liste a plus d'lments que la destination" @@ -524,14 +587,14 @@ msgstr "E711: La Liste n'a pas assez d' msgid "E690: Missing \"in\" after :for" msgstr "E690: \"in\" manquant aprs :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Parenthses manquantes : %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Variable inexistante : %s" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Impossible de (d)verrouiller la variable %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: variable trop imbrique pour la (d)verrouiller" @@ -540,25 +603,6 @@ msgstr "E743: variable trop imbriqu msgid "E109: Missing ':' after '?'" msgstr "E109: Il manque ':' aprs '?'" -msgid "E691: Can only compare List with List" -msgstr "E691: Une Liste ne peut tre compare qu'avec une Liste" - -msgid "E692: Invalid operation for List" -msgstr "E692: Opration invalide avec les Liste" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Un Dictionnaire ne peut tre compar qu'avec un Dictionnaire" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Opration invalide avec les Dictionnaires" - -# DB - todo : Traduction valable (et courte) pour Funcref ? -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Une Funcref ne peut tre compare qu' une Funcref" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Opration invalide avec les Funcrefs" - msgid "E804: Cannot use '%' with Float" msgstr "E804: Impossible d'utiliser '%' avec un Flottant" @@ -568,6 +612,9 @@ msgstr "E110: ')' manquant" msgid "E695: Cannot index a Funcref" msgstr "E695: Impossible d'indexer une Funcref" +msgid "E909: Cannot index a special variable" +msgstr "E909: Impossible d'indexer une variable spciale" + # AB - La version franaise est meilleure que la version anglaise. #, c-format msgid "E112: Option name missing: %s" @@ -589,334 +636,278 @@ msgstr "E114: Il manque \" msgid "E115: Missing quote: %s" msgstr "E115: Il manque ' la fin de %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Il manque une virgule dans la Liste %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Pas assez de mmoire pour les rfrences, arrt du ramassage de mites !" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Il manque ']' la fin de la Liste %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: variable trop imbrique pour tre affiche" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Il manque ':' dans le Dictionnaire %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Utilisation d'un Flottant comme un Nombre" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Cl \"%s\" duplique dans le Dictionnaire" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Utilisation d'une Funcref comme un Nombre" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Il manque une virgule dans le Dictionnaire %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Utilisation d'une Liste comme un Nombre" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Il manque '}' la fin du Dictionnaire %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Utilisation d'un Dictionnaire comme un Nombre" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: variable trop imbrique pour tre affiche" +msgid "E910: Using a Job as a Number" +msgstr "E910: Utilisation d'une Tche comme un Nombre" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Trop d'arguments pour la fonction %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: Utilisation d'un Canal comme un Nombre" -#, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Arguments invalides pour la fonction %s" +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Utilisation d'une Funcref comme un Flottant" -#, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Fonction inconnue : %s" +msgid "E892: Using a String as a Float" +msgstr "E892: Utilisation d'une Chane comme un Flottant" -#, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: La fonction %s n'a pas reu assez d'arguments" +msgid "E893: Using a List as a Float" +msgstr "E893: Utilisation d'une Liste comme un Flottant" -#, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> utilis en dehors d'un script : %s" +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Utilisation d'un Dictionnaire comme un Flottant" -#, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Appel d'une fonction dict sans Dictionnaire : %s" +msgid "E907: Using a special value as a Float" +msgstr "E907: Utilisation d'une valeur spciale comme un Flottant" -msgid "E808: Number or Float required" -msgstr "E808: Nombre ou Flottant requis" +msgid "E911: Using a Job as a Float" +msgstr "E911: Utilisation d'une Tche comme un Flottant" -msgid "add() argument" -msgstr "argument de add()" +msgid "E914: Using a Channel as a Float" +msgstr "E914: Utilisation d'un Canal comme un Flottant" -msgid "E699: Too many arguments" -msgstr "E699: Trop d'arguments" +msgid "E729: using Funcref as a String" +msgstr "E729: Utilisation d'une Funcref comme une Chane" -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() n'est utilisable que dans le mode Insertion" +msgid "E730: using List as a String" +msgstr "E730: Utilisation d'une Liste comme une Chane" -# AB - Texte par dfaut du bouton de la bote de dialogue affiche par la -# fonction confirm(). -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E731: using Dictionary as a String" +msgstr "E731: Utilisation d'un Dictionnaire comme une Chane" -msgid "extend() argument" -msgstr "argument de extend()" +msgid "E908: using an invalid value as a String" +msgstr "E908: Utilisation d'une valeur invalide comme une Chane" #, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: un mappage existe dj pour %s" - -msgid "map() argument" -msgstr "argument de map()" - -msgid "filter() argument" -msgstr "argument de filter()" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Impossible de supprimer la variable %s" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld lignes : " +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Le nom d'une Funcref doit commencer par une majuscule : %s" #, c-format -msgid "E700: Unknown function: %s" -msgstr "E700: Fonction inconnue : %s" - -# AB - Textes des boutons de la bote de dialogue affiche par inputdialog(). -msgid "" -"&OK\n" -"&Cancel" -msgstr "" -"&Ok\n" -"&Annuler" - -# AB - La version franaise est meilleure que la version anglaise. -msgid "called inputrestore() more often than inputsave()" -msgstr "inputrestore() a t appel plus de fois qu'inputsave()" - -msgid "insert() argument" -msgstr "argument de insert()" - -msgid "E786: Range not allowed" -msgstr "E786: Les plages ne sont pas autorises" - -msgid "E701: Invalid type for len()" -msgstr "E701: Type invalide avec len()" - -msgid "E726: Stride is zero" -msgstr "E726: Le pas est nul" - -msgid "E727: Start past end" -msgstr "E727: Dbut au-del de la fin" - -msgid "<empty>" -msgstr "<vide>" - -# AB - mon avis, la version anglaise est errone. -# DB : Vrifier -msgid "E240: No connection to Vim server" -msgstr "E240: Pas de connexion au serveur X" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Le nom d'une variable entre en conflit avec la fonction %s" -# AB - La version franaise est meilleure que la version anglaise. #, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: L'envoi au serveur %s chou" +msgid "E741: Value is locked: %s" +msgstr "E741: La valeur de %s est verrouille" -msgid "E277: Unable to read a server reply" -msgstr "E277: Impossible de lire la rponse du serveur" +msgid "Unknown" +msgstr "Inconnu" -msgid "remove() argument" -msgstr "argument de remove()" +#, c-format +msgid "E742: Cannot change value of %s" +msgstr "E742: Impossible de modifier la valeur de %s" -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Trop de liens symboliques (cycle ?)" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: variable trop imbrique pour en faire une copie" -msgid "reverse() argument" -msgstr "argument de reverse()" +# AB - La version franaise est capitalise pour tre en accord avec les autres +# commentaires enregistrs dans le fichier viminfo. +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# Variables globales:\n" -# AB - La version franaise est meilleure que la version anglaise. -msgid "E258: Unable to send to client" -msgstr "E258: La rponse n'a pas pu tre envoye au client" +# DB - Plus prcis ("la dernire fois") ? +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tModifi la dernire fois dans " -msgid "sort() argument" -msgstr "argument de sort()" +msgid "E691: Can only compare List with List" +msgstr "E691: Une Liste ne peut tre compare qu'avec une Liste" -msgid "E702: Sort compare function failed" -msgstr "E702: La fonction de comparaison de sort() a chou" +msgid "E692: Invalid operation for List" +msgstr "E692: Opration invalide avec les Liste" -msgid "(Invalid)" -msgstr "(Invalide)" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Un Dictionnaire ne peut tre compar qu'avec un Dictionnaire" -msgid "E677: Error writing temp file" -msgstr "E677: Erreur lors de l'criture du fichier temporaire" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Opration invalide avec les Dictionnaires" -msgid "E805: Using a Float as a Number" -msgstr "E805: Utilisation d'un Flottant comme un Nombre" +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Opration invalide avec les Funcrefs" -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Utilisation d'une Funcref comme un Nombre" +msgid "map() argument" +msgstr "argument de map()" -msgid "E745: Using a List as a Number" -msgstr "E745: Utilisation d'une Liste comme un Nombre" +msgid "filter() argument" +msgstr "argument de filter()" -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Utilisation d'un Dictionnaire comme un Nombre" +#, c-format +msgid "E686: Argument of %s must be a List" +msgstr "E686: L'argument de %s doit tre une Liste" -msgid "E729: using Funcref as a String" -msgstr "E729: Utilisation d'une Funcref comme une Chane" +msgid "E928: String required" +msgstr "E928: Chane requis" -msgid "E730: using List as a String" -msgstr "E730: Utilisation d'une Liste comme une Chane" +msgid "E808: Number or Float required" +msgstr "E808: Nombre ou Flottant requis" -msgid "E731: using Dictionary as a String" -msgstr "E731: Utilisation d'un Dictionnaire comme une Chane" +msgid "add() argument" +msgstr "argument de add()" -msgid "E806: using Float as a String" -msgstr "E806: Utilisation d'un Flottant comme une Chane" +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() n'est utilisable que dans le mode Insertion" -# DB : On doit pouvoir trouver nettement mieux que a. -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Type de variable incohrent pour %s" +# AB - Texte par dfaut du bouton de la bote de dialogue affiche par la +# fonction confirm(). +msgid "&Ok" +msgstr "&Ok" #, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Impossible de supprimer la variable %s" +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld ligne : " +msgstr[1] "+-%s%3ld lignes : " #, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Le nom d'une Funcref doit commencer par une majuscule : %s" +msgid "E700: Unknown function: %s" +msgstr "E700: Fonction inconnue : %s" -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Le nom d'une variable entre en conflit avec la fonction %s" +msgid "E922: expected a dict" +msgstr "E922: dictionnaire attendu" -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: La valeur de %s est verrouille" +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "" +"E923: Le second argument de function() doit tre une liste ou un dictionnaire" -msgid "Unknown" -msgstr "Inconnu" +# AB - Textes des boutons de la bote de dialogue affiche par inputdialog(). +msgid "" +"&OK\n" +"&Cancel" +msgstr "" +"&Ok\n" +"&Annuler" -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Impossible de modifier la valeur de %s" +# AB - La version franaise est meilleure que la version anglaise. +msgid "called inputrestore() more often than inputsave()" +msgstr "inputrestore() a t appel plus de fois qu'inputsave()" -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: variable trop imbrique pour en faire une copie" +msgid "insert() argument" +msgstr "argument de insert()" -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Fonction non dfinie : %s" +msgid "E786: Range not allowed" +msgstr "E786: Les plages ne sont pas autorises" -# AB - La version franaise est plus consistante que la version anglaise. -# AB - Je suis partag entre la concision d'une traduction assez littrale et -# la lourdeur d'une traduction plus correcte. -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Il manque '(' aprs %s" +msgid "E916: not a valid job" +msgstr "E916: tche invalide" -msgid "E862: Cannot use g: here" -msgstr "E862: Impossible d'utiliser g: ici" +msgid "E701: Invalid type for len()" +msgstr "E701: Type invalide avec len()" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Argument invalide : %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID est rserv pour \":match\": %ld" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: Nom d'argument dupliqu : %s" +msgid "E726: Stride is zero" +msgstr "E726: Le pas est nul" -msgid "E126: Missing :endfunction" -msgstr "E126: Il manque :endfunction" +msgid "E727: Start past end" +msgstr "E727: Dbut au-del de la fin" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Le nom de fonction entre en conflit avec la variable : %s" +msgid "<empty>" +msgstr "<vide>" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Impossible de redfinir fonction %s : dj utilise" +msgid "E240: No connection to the X server" +msgstr "E240: Pas de connexion au serveur X" -# DB - Le contenu du "c-format" est le nom de la fonction. +# AB - La version franaise est meilleure que la version anglaise. #, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Le nom de la fonction %s ne correspond pas le nom du script" +msgid "E241: Unable to send to %s" +msgstr "E241: L'envoi au serveur %s a chou" -msgid "E129: Function name required" -msgstr "E129: Nom de fonction requis" +msgid "E277: Unable to read a server reply" +msgstr "E277: Impossible de lire la rponse du serveur" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: La fonction %s ne commence pas par une majuscule ou contient ':'" +msgid "E941: already started a server" +msgstr "E941: serveur dj dmarr" -# AB - Il est difficile de crer une version franaise qui fasse moins de 80 -# caractres de long, nom de la fonction compris : "It is in use" est une -# expression trs dense. Traductions possibles : "elle est utilise", -# "elle s'excute" ou "elle est occupe". -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Impossible d'effacer %s : cette fonction est utilise" +msgid "E942: +clientserver feature not available" +msgstr "E942: La fonctionnalit +clientserver n'est pas disponible" -# AB - Vrifier dans la littrature technique s'il n'existe pas une meilleure -# traduction pour "function call depth". -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "" -"E132: La profondeur d'appel de fonction est suprieure 'maxfuncdepth'" +msgid "remove() argument" +msgstr "argument de remove()" -# AB - Ce texte fait partie d'un message de dbogage. -#, c-format -msgid "calling %s" -msgstr "appel de %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Trop de liens symboliques (cycle ?)" -# AB - Vrifier. -#, c-format -msgid "%s aborted" -msgstr "%s annule" +msgid "reverse() argument" +msgstr "argument de reverse()" -# AB - Ce texte fait partie d'un message de dbogage. -#, c-format -msgid "%s returning #%ld" -msgstr "%s a retourn #%ld" +# AB - La version franaise est meilleure que la version anglaise. +msgid "E258: Unable to send to client" +msgstr "E258: La rponse n'a pas pu tre envoye au client" -# AB - Ce texte fait partie d'un message de dbogage. #, c-format -msgid "%s returning %s" -msgstr "%s a retourn \"%s\"" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Action invalide : %s " -# AB - Ce texte fait partie d'un message de dbogage. -#, c-format -msgid "continuing in %s" -msgstr "de retour dans %s" +msgid "sort() argument" +msgstr "argument de sort()" -msgid "E133: :return not inside a function" -msgstr "E133: :return en dehors d'une fonction" +msgid "uniq() argument" +msgstr "argument de uniq()" -# AB - La version franaise est capitalise pour tre en accord avec les autres -# commentaires enregistrs dans le fichier viminfo. -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# Variables globales:\n" +msgid "E702: Sort compare function failed" +msgstr "E702: La fonction de comparaison de sort() a chou" -# DB - Plus prcis ("la dernire fois") ? -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tModifi la dernire fois dans " +msgid "E882: Uniq compare function failed" +msgstr "E882: La fonction de comparaison de uniq() a chou" -msgid "No old files" -msgstr "Aucun vieux fichier" +msgid "(Invalid)" +msgstr "(Invalide)" + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: numro de submatch invalide : %d" + +msgid "E677: Error writing temp file" +msgstr "E677: Erreur lors de l'criture du fichier temporaire" + +msgid "E921: Invalid callback argument" +msgstr "E921: Argument de callback invalide" + +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Hexa %02x, Octal %03o, Digr %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, Hexa %02x, Octal %03o" +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Hexa %04x, Octal %o, Digr %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Hexa %08x, Octal %o, Digr %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, Hexa %04x, Octal %o" @@ -996,11 +987,14 @@ msgstr " # ses droits d'accs. # AB - Le mot "viminfo" a t retir pour que le message ne dpasse pas 80 # caractres dans le cas courant o %s = /home/12345678/.viminfo -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: L'criture dans le fichier %s est interdite" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Trop de fichiers temporaires viminfo, comme %s!" + # AB - Le point d'exclamation est superflu. # AB - Le mot "viminfo" a t retir pour que le message ne dpasse pas 80 # caractres dans le cas courant o %s = /home/12345678/.viminfo @@ -1013,7 +1007,10 @@ msgstr "E138: Impossible d' msgid "Writing viminfo file \"%s\"" msgstr "criture du fichier viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Impossible de renommer viminfo en %s" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Ce fichier viminfo a t gnr par Vim %s.\n" @@ -1034,6 +1031,13 @@ msgstr "# 'encoding' dans lequel ce fichier a msgid "Illegal starting char" msgstr "Caractre initial non valide" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Lignes commenant par |, copies littralement :\n" + # AB - Ceci est un titre de bote de dialogue. Vrifier que la version # franaise est correcte pour les trois rfrences ; j'ai un doute quant # la troisime. @@ -1153,8 +1157,8 @@ msgstr " sur %ld lignes" # AB - Il faut respecter l'esprit plus que la lettre. # AB - Ce message devrait contenir une rfrence :vglobal. -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global ne peut pas excuter :global" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global ne peut pas excuter :global avec une plage" # AB - Ce message devrait contenir une rfrence :vglobal. msgid "E148: Regular expression missing from global" @@ -1203,18 +1207,16 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Dsol, le fichier d'aide \"%s\" est introuvable" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: %s n'est pas un rpertoire" +msgid "E151: No match: %s" +msgstr "E151: Aucune correspondance : %s" -# AB - La version anglaise est plus prcise, mais trop technique. #, c-format msgid "E152: Cannot open %s for writing" -msgstr "E152: Impossible d'crire %s" +msgstr "E152: Impossible d'ouvrir %s en criture" -# AB - La version anglaise est plus prcise, mais trop technique. #, c-format msgid "E153: Unable to open %s for reading" -msgstr "E153: Impossible de lire %s" +msgstr "E153: Impossible d'ouvrir %s en lecture" #, c-format msgid "E670: Mix of help file encodings within a language: %s" @@ -1229,6 +1231,10 @@ msgstr "E670: Encodages diff msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: Marqueur \"%s\" dupliqu dans le fichier %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: %s n'est pas un rpertoire" + # AB - Il faut respecter l'esprit plus que la lettre. #, c-format msgid "E160: Unknown sign command: %s" @@ -1261,12 +1267,19 @@ msgstr "E159: Il manque l'ID du symbole" msgid "E158: Invalid buffer name: %s" msgstr "E158: Le tampon %s est introuvable" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Impossible de sauter un tampon sans nom" + # AB - Vu le code source, la version franaise est meilleure que la # version anglaise. #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Le symbole %ld est introuvable" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Impossible de changer le symbole %s" + msgid " (NOT FOUND)" msgstr " (INTROUVABLE)" @@ -1276,11 +1289,22 @@ msgstr " (non support msgid "[Deleted]" msgstr "[Effac]" +msgid "No old files" +msgstr "Aucun vieux fichier" + # AB - La version franaise de la premire phrase ne me satisfait pas. # DB - Suggestion. msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Mode dbogage activ. Tapez \"cont\" pour continuer." +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Ancienneval = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Nouvelleval = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "ligne %ld : %s" @@ -1289,6 +1313,13 @@ msgstr "ligne %ld : %s" msgid "cmd: %s" msgstr "cmde : %s" +msgid "frame is zero" +msgstr "le cadre de pile est zro" + +#, c-format +msgid "frame at highest level: %d" +msgstr "cadre de pile au niveau le plus haut : %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Point d'arrt dans %s%s ligne %ld" @@ -1306,6 +1337,10 @@ msgstr "Aucun point d'arr msgid "%3d %s %s line %ld" msgstr "%3d %s %s ligne %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: Utilisez d'abord \":profile start {nomfichier}\"" @@ -1314,10 +1349,9 @@ msgstr "E750: Utilisez d'abord \":profile start {nomfichier}\"" msgid "Save changes to \"%s\"?" msgstr "Enregistrer \"%s\" ?" -# AB - Si les parenthses posent problme, il faudra remettre les guillemets -# ci-dessus. -msgid "Untitled" -msgstr "(sans titre)" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Tche en cours d'excution dans le buffer \"%s\"" # AB - Il faut respecter l'esprit plus que la lettre. # AB - Ce message est similaire au message E89. @@ -1326,7 +1360,8 @@ msgid "E162: No write since last change for buffer \"%s\"" msgstr "E162: Le tampon %s n'a pas t enregistr" msgid "Warning: Entered other buffer unexpectedly (check autocommands)" -msgstr "Alerte : Entre inattendue dans un autre tampon (vrifier autocmdes)" +msgstr "" +"Alerte : Entre inattendue dans un autre tampon (vrifier autocommandes)" msgid "E163: There is only one file to edit" msgstr "E163: Il n'y a qu'un seul fichier diter" @@ -1350,8 +1385,16 @@ msgid "Searching for \"%s\"" msgstr "Recherche de \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "introuvable dans 'runtimepath' : \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "introuvable dans '%s' : \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Python version 2.x non support, fichier %s ignor" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Python 3.x non support, fichier %s ignor" msgid "Source Vim script" msgstr "Sourcer un script - Vim" @@ -1380,6 +1423,11 @@ msgstr "ligne %ld : sourcement de \"%s\"" msgid "finished sourcing %s" msgstr "fin du sourcement de %s" +# AB - Ce texte fait partie d'un message de dbogage. +#, c-format +msgid "continuing in %s" +msgstr "de retour dans %s" + msgid "modeline" msgstr "ligne de mode" @@ -1448,12 +1496,13 @@ msgstr "La plage sp msgid "E494: Use w or w>>" msgstr "E494: Utilisez w ou w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: La table des commandes doit tre mise jour, lancez 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Dsol, cette commande n'est pas disponible dans cette version" -msgid "E172: Only one file name allowed" -msgstr "E172: Un seul nom de fichier autoris" - msgid "1 more file to edit. Quit anyway?" msgstr "Encore 1 fichier diter. Quitter tout de mme ?" @@ -1473,10 +1522,10 @@ msgstr "E174: La commande existe d msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nom Args Plage Complet. Dfinition" +" Nom Args Adresse Complet. Dfinition" msgid "No user-defined commands found" msgstr "Aucune commande dfinie par l'utilisateur trouve" @@ -1496,6 +1545,9 @@ msgstr "E178: La valeur par d msgid "E179: argument required for -complete" msgstr "E179: argument requis avec -complete" +msgid "E179: argument required for -addr" +msgstr "E179: argument requis avec -addr" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Attribut invalide : %s" @@ -1514,6 +1566,10 @@ msgstr "" msgid "E184: No such user-defined command: %s" msgstr "E184: Aucune commande %s dfinie par l'utilisateur" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Valeur de type d'adresse invalide : %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Valeur invalide pour \"-complete=\" : %s" @@ -1522,7 +1578,7 @@ msgid "E468: Completion argument only allowed for custom completion" msgstr "E468: Seul le compltement personnalis accepte un argument" msgid "E467: Custom completion requires a function argument" -msgstr "E467: Le compltement personnalis requiert une fonction en argument" +msgstr "E467: Le compltement personnalis ncessite une fonction en argument" msgid "unknown" msgstr "inconnu" @@ -1565,7 +1621,7 @@ msgid "E187: Unknown" msgstr "E187: Inconnu" msgid "E465: :winsize requires two number arguments" -msgstr "E465: :winsize requiert deux arguments numriques" +msgstr "E465: :winsize ncessite deux arguments numriques" #, c-format msgid "Window position: X %d, Y %d" @@ -1577,7 +1633,10 @@ msgstr "" "E188: Rcuprer la position de la fentre non implment dans cette version" msgid "E466: :winpos requires two number arguments" -msgstr "E466: :winpos requiert deux arguments numriques" +msgstr "E466: :winpos ncessite deux arguments numriques" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Impossible d'utiliser :redir dans execute()" msgid "Save Redirection" msgstr "Enregistrer la redirection" @@ -1603,7 +1662,6 @@ msgstr "E189: \"%s\" existe (ajoutez ! pour passer outre)" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Impossible d'ouvrir \"%s\" pour y crire" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: L'argument doit tre une lettre ou une (contre-)apostrophe" @@ -1641,13 +1699,17 @@ msgstr "E500: msgid "E195: Cannot open viminfo file for reading" msgstr "E195: Impossible d'ouvrir le viminfo en lecture" +# AB - Si les parenthses posent problme, il faudra remettre les guillemets +# ci-dessus. +msgid "Untitled" +msgstr "(sans titre)" + msgid "E196: No digraphs in this version" msgstr "E196: Pas de digraphes dans cette version" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: Impossible d'mettre des exceptions avec 'Vim' comme prfixe" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Exception mise : %s" @@ -1664,7 +1726,6 @@ msgstr "Exception msgid "%s, line %ld" msgstr "%s, ligne %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Exception intercepte : %s" @@ -1691,7 +1752,6 @@ msgstr "Erreur et interruption" msgid "Error" msgstr "Erreur" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Interruption" @@ -1734,15 +1794,12 @@ msgstr "E601: Imbrication de :try trop importante" msgid "E603: :catch without :try" msgstr "E603: :catch sans :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch aprs :finally" msgid "E606: :finally without :try" msgstr "E606: :finally sans :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: Il ne peut y avoir qu'un seul :finally" @@ -1793,6 +1850,9 @@ msgstr "expression" msgid "Input Line" msgstr "ligne de saisie" +msgid "Debug Line" +msgstr "Ligne de dbogage" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar au-del de la longueur de la commande" @@ -1840,7 +1900,6 @@ msgstr "Vim : Lecture de stdin...\n" msgid "Reading from stdin..." msgstr "Lecture de stdin..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: La conversion a rendu le fichier illisible !" @@ -1856,9 +1915,6 @@ msgstr "[socket]" msgid "[character special]" msgstr "[caractre spcial]" -msgid "[RO]" -msgstr "[RO]" - msgid "[CR missing]" msgstr "[CR manquant]" @@ -1871,12 +1927,6 @@ msgstr "[NON converti]" msgid "[converted]" msgstr "[converti]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[chiffr]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ERREUR DE CONVERSION la ligne %ld]" @@ -1898,9 +1948,6 @@ msgstr "La conversion avec 'charconvert' a msgid "can't read output of 'charconvert'" msgstr "Impossible de lire la sortie de 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Le fichier est chiffr avec une mthode inconnue" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Pas d'autocommande correspondante pour le tampon acwrite" @@ -1945,10 +1992,6 @@ msgid "E510: Can't make backup file (add ! to override)" msgstr "" "E510: Impossible de gnrer la copie de secours (ajoutez ! pour passer outre)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "" -"E460: Les ressources partages seraient perdues (ajoutez ! pour passer outre)" - msgid "E214: Can't find temp file for writing" msgstr "E214: Impossible de gnrer un fichier temporaire pour y crire" @@ -1961,8 +2004,8 @@ msgstr "E166: Impossible d'ouvrir le lien pour y msgid "E212: Can't open file for writing" msgstr "E212: Impossible d'ouvrir le fichier pour y crire" -msgid "E667: Fsync failed" -msgstr "E667: Fsynch a chou" +msgid "E949: File changed while writing" +msgstr "E949: Fichier modifi aprs criture" msgid "E512: Close failed" msgstr "E512: Erreur de fermeture de fichier" @@ -2061,20 +2104,12 @@ msgstr "1 caract msgid "%lld characters" msgstr "%lld caractres" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld caractres" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[Dernire ligne incomplte]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "ALERTE : Le fichier a t modifi depuis que Vim l'a lu !" @@ -2156,11 +2191,16 @@ msgstr "--Effac msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "Autocommandes marques pour auto-suppression : %s <tampon=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Aucun groupe \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: Impossible de supprimer le groupe courant" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Effacement d'augroup toujours en usage" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Caractre non valide aprs * : %s" @@ -2173,7 +2213,6 @@ msgstr "E216: Aucun msgid "E216: No such group or event: %s" msgstr "E216: Aucun vnement ou groupe %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2223,8 +2262,10 @@ msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: Impossible de supprimer un repli avec la 'foldmethod'e actuelle" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld lignes replies " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld ligne dplace " +msgstr[1] "+--%3ld lignes dplaces " msgid "E222: Add to read buffer" msgstr "E222: Ajout au tampon de lecture" @@ -2321,6 +2362,18 @@ msgstr "Vim" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: Impossible de crer un BalloonEval avec message ET callback" +msgid "_Cancel" +msgstr "_Annuler" + +msgid "_Save" +msgstr "_Enregistrer" + +msgid "_Open" +msgstr "_Ouvrir" + +msgid "_OK" +msgstr "_Ok" + msgid "" "&Yes\n" "&No\n" @@ -2330,6 +2383,12 @@ msgstr "" "&Non\n" "&Annuler" +msgid "Yes" +msgstr "Oui" + +msgid "No" +msgstr "Non" + # todo '_' is for hotkey, i guess? msgid "Input _Methods" msgstr "_Mthodes de saisie" @@ -2346,41 +2405,38 @@ msgstr "Rechercher :" msgid "Replace with:" msgstr "Remplacer par :" -#. whole word only button msgid "Match whole word only" msgstr "Mots entiers seulement" -#. match case button msgid "Match case" msgstr "Respecter la casse" msgid "Direction" msgstr "Direction" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Haut" msgid "Down" msgstr "Bas" -#. 'Find Next' button msgid "Find Next" msgstr "Suivant" -#. 'Replace' button msgid "Replace" msgstr "Remplacer" -#. 'Replace All' button msgid "Replace All" msgstr "Remplacer tout" +msgid "_Close" +msgstr "_Fermer" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim : Une requte \"die\" a t reue par le gestionnaire de session\n" -msgid "Close" -msgstr "Fermer" +msgid "Close tab" +msgstr "Fermer l'onglet" msgid "New tab" msgstr "Nouvel onglet" @@ -2426,27 +2482,9 @@ msgstr "&Remplacer" msgid "Replace &All" msgstr "Rempl&acer tout" -msgid "&Undo" -msgstr "Ann&uler" - -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Titre de fentre \"%s\" introuvable" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argument non support : \"-%s\" ; Utilisez la version OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Impossible d'ouvrir une fentre dans une application MDI" - -# DB - Les quelques messages qui suivent se retrouvent aussi ici : -# gui_gtk_x11.c:3170 et suivants. -# Les libells changent un peu (majuscule par exemple). -# La VF tche de les unifier. -msgid "Close tab" -msgstr "Fermer l'onglet" - +msgid "&Undo" +msgstr "Ann&uler" + msgid "Open tab..." msgstr "Ouvrir dans un onglet..." @@ -2459,8 +2497,6 @@ msgstr "Chercher et remplacer (utilisez '\\\\' pour trouver un '\\')" # DB - Traduction non indispensable puisque le code indique qu'il s'agit d'un # paramtrage bidon afin de slectionner un rpertoire plutt qu'un # fichier. -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Non utilis" @@ -2470,6 +2506,17 @@ msgstr "Non utilis msgid "Directory\t*.nothing\n" msgstr "Rpertoire\t*.rien\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Titre de fentre \"%s\" introuvable" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argument non support : \"-%s\" ; Utilisez la version OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Impossible d'ouvrir une fentre dans une application MDI" + # DB - todo : perfectible. msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" @@ -2490,32 +2537,28 @@ msgid "Font '%s' is not fixed-width" msgstr "La police '%s' n'a pas une largeur fixe" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Nom du jeu de polices : %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Nom du jeu de polices : %s" #, c-format -msgid "Font0: %s\n" -msgstr "Font0: %s\n" +msgid "Font0: %s" +msgstr "Font0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Font1: %s\n" +msgid "Font1: %s" +msgstr "Font1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "La largeur de Font%ld n'est pas le double de celle de Font0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "La largeur de Font%ld n'est pas le double de celle de Font0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Largeur de Font0 : %ld\n" +msgid "Font0 width: %ld" +msgstr "Largeur de Font0 : %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Largeur de Font1 : %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Largeur de Font1 : %ld" # DB - todo : Pas certain de mon coup, ici... msgid "Invalid font specification" @@ -2534,7 +2577,6 @@ msgstr "Choisir une police - Vim" msgid "Name:" msgstr "Nom :" -#. create toggle button msgid "Show size in Points" msgstr "Afficher la taille en Points" @@ -2709,6 +2751,9 @@ msgstr "E566: Impossible de cr msgid "E622: Could not fork for cscope" msgstr "E622: Impossible de forker pour cscope" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid a chou" + msgid "cs_create_connection exec failed" msgstr "exec de cs_create_connection a chou" @@ -2742,6 +2787,7 @@ msgstr "%-5s: %s%*s (Utilisation : %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2752,6 +2798,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: Trouver les affectations ce symbole\n" " c: Trouver les fonctions appelant cette fonction\n" " d: Trouver les fonctions appeles par cette fonction\n" " e: Trouver ce motif egrep\n" @@ -2780,7 +2827,6 @@ msgstr "E261: Connexion cscope %s introuvable" msgid "cscope connection %s closed" msgstr "connexion cscope %s ferme" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: erreur fatale dans cs_manage_matches" @@ -2825,11 +2871,18 @@ msgstr "" "E815: Dsol, cette commande est dsactive : les bibliothques MzScheme " "n'ont pas pu tre charges." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Dsol, cette commande est dsactive : le module MzScheme racket/base " +"ne peut pas tre charg." + msgid "invalid expression" msgstr "expression invalide" msgid "expressions disabled at compile time" -msgstr "expressions dsactive lors de la compilation" +msgstr "expressions dsactives lors de la compilation" msgid "hidden option" msgstr "option cache" @@ -2879,9 +2932,6 @@ msgstr "non autoris msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Vim ne peut pas excuter :python aprs avoir utilis :py3" -msgid "only string keys are allowed" -msgstr "seule une chaine est autorise comme cl" - msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." @@ -2889,15 +2939,19 @@ msgstr "" "E263: Dsol, commande dsactive : la bibliothque Python n'a pas pu tre " "charge." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Dsol, commande dsactive : la bibliothque Python n'a pas pu tre " +"charge." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Impossible d'invoquer Python rcursivement" msgid "E837: This Vim cannot execute :py3 after using :python" msgstr "E837: Vim ne peut pas excuter :py3 aprs avoir utilis :python" -msgid "index must be int or slice" -msgstr "index doit tre int ou slice" - msgid "E265: $_ must be an instance of String" msgstr "E265: $_ doit tre une instance de chane (String)" @@ -2930,97 +2984,6 @@ msgstr "E272: Exception non prise en charge" msgid "E273: unknown longjmp status %d" msgstr "E273: contexte de longjmp inconnu : %d" -msgid "Toggle implementation/definition" -msgstr "Basculer implmentation/dfinition" - -msgid "Show base class of" -msgstr "Montrer la classe de base de" - -msgid "Show overridden member function" -msgstr "Montrer les fonctions membres surcharges" - -msgid "Retrieve from file" -msgstr "Rcuprer du fichier" - -msgid "Retrieve from project" -msgstr "Rcuprer du projet" - -msgid "Retrieve from all projects" -msgstr "Rcuprer de tous les projets" - -msgid "Retrieve" -msgstr "Rcuprer" - -msgid "Show source of" -msgstr "Montrer source de" - -msgid "Find symbol" -msgstr "Trouver symbole" - -msgid "Browse class" -msgstr "Parcourir classe" - -msgid "Show class in hierarchy" -msgstr "Montrer classe dans hirarchie" - -msgid "Show class in restricted hierarchy" -msgstr "Montrer classe dans hirarchie restreinte" - -# todo -msgid "Xref refers to" -msgstr "Xref rfrence" - -msgid "Xref referred by" -msgstr "Xref est rfrenc par" - -msgid "Xref has a" -msgstr "Xref a un(e)" - -msgid "Xref used by" -msgstr "Xref utilise par" - -msgid "Show docu of" -msgstr "Montrer doc de" - -msgid "Generate docu for" -msgstr "Gnrer la doc de" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"Connexion SNiFF+ impossible. Vrifiez l'environnement (sniffemacs doit " -"tre dans le $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff : Erreur de lecture. Dconnexion" - -# DB - Les trois messages suivants vont ensembles. -msgid "SNiFF+ is currently " -msgstr "SNiFF+ est actuellement " - -msgid "not " -msgstr "d" - -msgid "connected" -msgstr "connect" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Requte SNiFF+ inconnue : %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Erreur lors de la connexion SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ n'est pas connect" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Ce tampon n'est pas un tampon SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff : Erreur lors d'une criture. Dconnexion" - msgid "invalid buffer number" msgstr "numro de tampon invalide" @@ -3028,7 +2991,6 @@ msgid "not implemented yet" msgstr "pas encore implment" # DB - TODO : le contexte est celui d'une annulation. -#. ??? msgid "cannot set line(s)" msgstr "Impossible de remettre la/les ligne(s)" @@ -3069,7 +3031,6 @@ msgid "" msgstr "" "Impossible d'inscrire la commande de rappel : tampon/fentre en effacement" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -3106,6 +3067,18 @@ msgstr "E573: Id utilis msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: Entre registre de l'instance de Vim mal formate. Suppression !" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Cl duplique dans le document JSON : \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Il manque une virgule dans la Liste %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Il manque ']' la fin de la Liste %s" + msgid "Unknown option argument" msgstr "Option inconnue" @@ -3131,12 +3104,12 @@ msgstr "%d fichiers msgid "netbeans is not supported with this GUI\n" msgstr "netbeans n'est pas support avec cette interface graphique\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Ce Vim n'a pas t compil avec la fonctionnalit diff" - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' ne peut pas tre utilis : dsactiv la compilation\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Ce Vim n'a pas t compil avec la fonctionnalit diff" + msgid "Attempt to open script file again: \"" msgstr "Nouvelle tentative pour ouvrir le script : \"" @@ -3149,13 +3122,17 @@ msgstr "Impossible d'ouvrir pour la sortie script : \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim : Erreur : Impossible de dmarrer gvim depuis NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "" +"Vim : Erreur : Cette version de Vim ne fonctionne pas dans un terminal " +"Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim : Alerte : La sortie ne s'effectue pas sur un terminal\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim : Alerte : L'entre ne se fait pas sur un terminal\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "ligne de commande pre-vimrc" @@ -3317,6 +3294,13 @@ msgstr "-F\t\tD msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <term>\tRgler le type du terminal sur <terminal>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "" +"--no-a-term\t\tAucun avertissement si l'entre/sortie n'est pas un terminal" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tQuitte si l'entre ou la sortie ne sont pas un terminal" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\tUtiliser <vimrc> au lieu du vimrc habituel" @@ -3415,6 +3399,10 @@ msgstr "" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tUtiliser <viminfo> au lieu du viminfo habituel" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "" +"--clean\t\t'nocompatible', rglages par dfaut, aucun greffon ni viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h ou --help\t\tAfficher l'aide (ce message) puis quitter" @@ -3517,11 +3505,9 @@ msgstr "--windowid <HWND>\tOuvrir Vim dans un autre widget win32" msgid "No display" msgstr "Aucun display" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr " : L'envoi a chou.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr " : L'envoi a chou. Tentative d'excution locale\n" @@ -3542,7 +3528,6 @@ msgstr "Aucune marque positionn msgid "E283: No marks matching \"%s\"" msgstr "E283: Aucune marque ne correspond \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3550,7 +3535,6 @@ msgstr "" "\n" "marq ligne col fichier/texte" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3558,7 +3542,6 @@ msgstr "" "\n" " saut ligne col fichier/texte" -#. Highlight title msgid "" "\n" "change line col text" @@ -3573,7 +3556,6 @@ msgstr "" "\n" "# Marques dans le fichier :\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3605,7 +3587,7 @@ msgstr "E286: msgid "E287: Warning: Could not set destroy callback to IM" msgstr "" -"E287: Alerte : Impossible d'inscrire la callback de destruction dans la MS" +"E287: Alerte : Impossible d'inscrire le callback de destruction dans la MS" msgid "E288: input method doesn't support any style" msgstr "E288: la mthode de saisie ne supporte aucun style" @@ -3645,7 +3627,6 @@ msgstr "E298: Bloc n msgid "E843: Error while updating swap file crypt" msgstr "E843: Erreur lors de la mise jour du fichier d'change crypt" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Oups, le fichier d'change a disparu !" @@ -3834,7 +3815,6 @@ msgstr "" "Utilisation de la cl de chiffrement du fichier d'change pour le fichier " "texte.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Fichiers d'change trouvs :" @@ -4004,21 +3984,17 @@ msgstr "Lors de l'ouverture du fichier \"" msgid " NEWER than swap file!\n" msgstr " PLUS RCENT que le fichier d'change !\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) Un autre programme est peut-tre en train d'diter ce fichier.\n" " Si c'est le cas, faites attention ne pas vous retrouver avec\n" -" deux versions diffrentes du mme fichier en faisant des modifications." - -msgid " Quit, or continue with caution.\n" -msgstr " Quittez, ou continuez prudemment.\n" +" deux versions diffrentes du mme fichier en faisant des modifications.\n" +" Quitter ou continuer avec attention.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) Une session d'dition de ce fichier a plant.\n" @@ -4031,7 +4007,7 @@ msgid "" " to recover the changes (see \":help recovery\").\n" msgstr "" "\"\n" -" pour rcuprer le fichier (voir \":help recovery\").\n" +" pour rcuprer le fichier (consultez \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" msgstr " Si vous l'avez dj fait, effacez le fichier d'change \"" @@ -4098,7 +4074,6 @@ msgstr "E328: Le menu n'existe que dans un autre mode" msgid "E329: No menu \"%s\"" msgstr "E329: Aucun menu \"%s\"" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: Nom de menu vide" @@ -4111,8 +4086,6 @@ msgstr "E331: Ajout d' msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Un sparateur ne peut faire partie d'un chemin de menu" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -4123,6 +4096,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Dtacher ce menu" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Le menu n'est pas dfini pour le mode %s" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: Le chemin du menu doit conduire un lment de menu" @@ -4130,10 +4107,6 @@ msgstr "E333: Le chemin du menu doit conduire msgid "E334: Menu not found: %s" msgstr "E334: Menu introuvable : %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Le menu n'est pas dfini pour le mode %s" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: Le chemin du menu doit conduire un sous-menu" @@ -4207,7 +4180,6 @@ msgstr "Enregistrer un fichier" msgid "Open File dialog" msgstr "Ouvrir un fichier" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "E338: Dsol, pas de slecteur de fichiers en mode console" @@ -4249,13 +4221,6 @@ msgstr " (Interrompu)" msgid "Beep!" msgstr "Bip !" -msgid "Vim: preserving files...\n" -msgstr "Vim : prservation des fichiers...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim : Fini.\n" - msgid "ERROR: " msgstr "ERREUR : " @@ -4305,15 +4270,6 @@ msgstr "E548: chiffre attendu" msgid "E549: Illegal percentage" msgstr "E549: Pourcentage non autoris" -msgid "Enter encryption key: " -msgstr "Tapez la cl de chiffrement : " - -msgid "Enter same key again: " -msgstr "Tapez la cl nouveau : " - -msgid "Keys don't match!" -msgstr "Les cls ne correspondent pas !" - msgid "E854: path too long for completion" msgstr "E854: chemin trop long pour compltement" @@ -4341,22 +4297,12 @@ msgstr "E346: Plus de r msgid "E347: No more file \"%s\" found in path" msgstr "E347: Plus de fichier \"%s\" dans 'path'" -msgid "Cannot connect to Netbeans #2" -msgstr "Impossible de se connecter Netbeans n2" - -msgid "Cannot connect to Netbeans" -msgstr "Impossible de se connecter Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: Mode d'accs incorrect au fichier d'infos de connexion NetBeans : \"%s" "\"" -# DB : message d'un appel perror(). -msgid "read from Netbeans socket" -msgstr "read sur la socket Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Connexion NetBeans perdue pour le tampon %ld" @@ -4399,8 +4345,10 @@ msgstr "E662: Au d msgid "E663: At end of changelist" msgstr "E663: la fin de la liste des modifications" -msgid "Type :quit<Enter> to exit Vim" -msgstr "tapez :q<Entre> pour quitter Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Tapez :qa! puis <Entre> pour abandonner tous les changements et quitter " +"Vim" #, c-format msgid "1 line %sed 1 time" @@ -4433,7 +4381,6 @@ msgid "E748: No previously used register" msgstr "E748: Aucun registre n'a t prcdemment utilis" # DB - Question O/N. -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "impossible de raliser une copie ; effacer tout de mme" @@ -4448,25 +4395,30 @@ msgstr "%ld lignes modifi msgid "freeing %ld lines" msgstr "libration de %ld lignes" -msgid "block of 1 line yanked" -msgstr "bloc de 1 ligne copi" +#, c-format +msgid " into \"%c" +msgstr " dans \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "bloc de 1 ligne copi%s" -msgid "1 line yanked" -msgstr "1 ligne copie" +#, c-format +msgid "1 line yanked%s" +msgstr "1 ligne copie%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "bloc de %ld lignes copi" +msgid "block of %ld lines yanked%s" +msgstr "bloc de %ld lignes copi%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld lignes copies" +msgid "%ld lines yanked%s" +msgstr "%ld lignes copies%s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: Le registre %s est vide" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4488,42 +4440,47 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Type de registre %d inconnu" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: le motif de recherche et le registre d'expression ne peuvent pas " +"contenir deux lignes ou plus" + #, c-format msgid "%ld Cols; " msgstr "%ld Colonnes ; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" msgstr "" -"%s%ld sur %ld Lignes ; %ld sur %ld Mots ; %ld sur %ld Octets slectionns" +"%s%ld sur %ld Lignes ; %lld sur %lld Mots ; %lld sur %lld Octets slectionns" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"%s%ld sur %ld Lignes ; %ld sur %ld Mots ; %ld sur %ld Caractres ; %ld sur " -"%ld octets slectionns" +"%s%ld sur %ld Lignes ; %lld sur %lld Mots ; %lld sur %lld Caractres ; %lld " +"sur %lld octets slectionns" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" msgstr "" -"Colonne %s sur %s ; Ligne %ld sur %ld ; Mot %ld sur %ld ; Octet %ld sur %ld" +"Colonne %s sur %s ; Ligne %ld sur %ld ; Mot %lld sur %lld ; Octet %lld sur " +"%lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Colonne %s sur %s ; Ligne %ld sur %ld ; Mot %ld sur %ld ; Caractre %ld sur " -"%ld ; Octet %ld sur %ld" +"Colonne %s sur %s ; Ligne %ld sur %ld ; Mot %lld sur %lld ; Caractre %lld " +"sur %lld ; Octet %lld sur %lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld pour le BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Page %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld pour le BOM)" msgid "Thanks for flying Vim" msgstr "Merci d'avoir choisi Vim" @@ -4550,6 +4507,10 @@ msgstr "E522: Introuvable dans termcap" msgid "E539: Illegal character <%s>" msgstr "E539: Caractre <%s> invalide" +#, c-format +msgid "For option %s" +msgstr "Pour l'option %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' ne doit pas tre une chane vide" @@ -4571,6 +4532,10 @@ msgstr "E835: Conflits avec la valeur de 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Non modifiable dans l'interface graphique GTK+ 2" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Impossible de convertir de %s %s" + msgid "E524: Missing colon" msgstr "E524: ':' manquant" @@ -4631,11 +4596,18 @@ msgstr "E541: trop d' msgid "E542: unbalanced groups" msgstr "E542: parenthses non quilibres" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "" +"E946: terminal avec tche en cours d'excution ne peut pas tre modifiable" + msgid "E590: A preview window already exists" msgstr "E590: Il existe dj une fentre de prvisualisation" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" -msgstr "W17: L'arabe requiert l'UTF-8, tapez ':set encoding=utf-8'" +msgstr "W17: L'arabe ncessite l'UTF-8, tapez ':set encoding=utf-8'" + +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: Couleurs en 24-bits non-supportes sur cet environnement." #, c-format msgid "E593: Need at least %d lines" @@ -4649,9 +4621,6 @@ msgstr "E594: Au moins %d colonnes sont n msgid "E355: Unknown option: %s" msgstr "E355: Option inconnue : %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: Nombre requis : &%s = '%s'" @@ -4724,7 +4693,6 @@ msgstr "Impossible de modifier le mode de la console ?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize : pas une console ?!\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Impossible d'excuter un shell avec l'option -f" @@ -4746,9 +4714,6 @@ msgstr "ERREUR d'E/S" msgid "Message" msgstr "Message" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' ne vaut pas 80, impossible d'excuter des commandes externes" - msgid "E237: Printer selection failed" msgstr "E237: La slection de l'imprimante a chou" @@ -4774,19 +4739,12 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Jeu de caractres \"%s\" invalide dans le nom de fonte \"%s\"" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Caractre '%c' invalide dans le nom de fonte \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim : Double signal, sortie\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim : Signal mortel %s intercept\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Nom de qualit \"%s\" invalide dans le nom de fonte \"%s\"" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim : Signal mortel intercept\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Caractre '%c' invalide dans le nom de fonte \"%s\"" #, c-format msgid "Opening the X display took %ld msec" @@ -4819,12 +4777,14 @@ msgstr "" "\n" "Impossible de modifier le contexte de scurit pour " -msgid "" -"\n" -"Cannot execute shell " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Impossible d'initialiser le contexte de scurit %s pour %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" msgstr "" -"\n" -"Impossible d'excuter le shell " +"Impossible d'obtenir le contexte de scurit %s pour %s. Il sera supprim !" msgid "" "\n" @@ -4854,6 +4814,13 @@ msgstr "" "\n" "Impossible de forker\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Impossible d'excuter le shell " + msgid "" "\n" "Command terminated\n" @@ -4896,10 +4863,6 @@ msgstr "Erreur VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "Impossible d'initialiser les pointeurs de fonction vers la DLL !" -#, c-format -msgid "shell returned %d" -msgstr "le shell a retourn %d" - # DB - Les vnements en question sont ceux des messages qui suivent. #, c-format msgid "Vim: Caught %s event\n" @@ -4924,11 +4887,18 @@ msgid "" msgstr "" "VIMRUN.EXE est introuvable votre $PATH.\n" "Les commandes externes ne feront pas de pause une fois termines.\n" -"Voir :help win32-vimrun pour plus d'informations." +"Consultez :help win32-vimrun pour plus d'informations." msgid "Vim Warning" msgstr "Alerte Vim" +#, c-format +msgid "shell returned %d" +msgstr "le shell a retourn %d" + +msgid "E926: Current location list was changed" +msgstr "E926: La liste d'emplacements courante a chang" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: Trop de %%%c dans la chane de format" @@ -4961,6 +4931,12 @@ msgstr "E379: Nom de r msgid "E553: No more items" msgstr "E553: Plus d'lments" +msgid "E924: Current window was closed" +msgstr "E924: La fentre courante doit tre ferme" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Le quickfix courant a chang" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d sur %d)%s%s : " @@ -4968,18 +4944,18 @@ msgstr "(%d sur %d)%s%s : " msgid " (line deleted)" msgstr " (ligne efface)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sliste d'erreurs %d sur %d ; %d erreurs" + msgid "E380: At bottom of quickfix stack" msgstr "E380: En bas de la pile quickfix" msgid "E381: At top of quickfix stack" msgstr "E381: Au sommet de la pile quickfix" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "liste d'erreurs %d sur %d ; %d erreurs" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: criture impossible, l'option 'buftype' est active" +msgid "No entries" +msgstr "Aucune entre" msgid "Error file" msgstr "Fichier d'erreurs" @@ -5005,6 +4981,12 @@ msgstr "E369: msgid "E769: Missing ] after %s[" msgstr "E769: ']' manquant aprs %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: Classe de caractres inverse" + +msgid "E945: Range too large in character class" +msgstr "E945: Plage de classe de caractres trop large" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: Pas de correspondance pour %s%%(" @@ -5017,6 +4999,23 @@ msgstr "E54: %s( ouvrante non ferm msgid "E55: Unmatched %s)" msgstr "E55: %s) fermante non ouverte" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( n'est pas autoris ici" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 et co. ne sont pas autoriss ici" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ']' manquant aprs %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] vide" + +msgid "E65: Illegal back reference" +msgstr "E65: post-rfrence invalide" + msgid "E339: Pattern too long" msgstr "E339: Motif trop long" @@ -5053,26 +5052,9 @@ msgstr "E63: utilisation invalide de \\_" msgid "E64: %s%c follows nothing" msgstr "E64: %s%c ne suit aucun atome" -msgid "E65: Illegal back reference" -msgstr "E65: post-rfrence invalide" - -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( n'est pas autoris ici" - -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 et co. ne sont pas autoriss ici" - msgid "E68: Invalid character after \\z" msgstr "E68: Caractre invalide aprs \\z" -#, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: ']' manquant aprs %s%%[" - -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[] vide" - #, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: Caractre invalide aprs %s%%[dxouU]" @@ -5088,6 +5070,10 @@ msgstr "E554: Erreur de syntaxe dans %s{...}" msgid "External submatches:\n" msgstr "Sous-correspondances externes :\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (regexp NFA) %s ne peut pas tre rpt" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -5095,18 +5081,31 @@ msgstr "" "E864: \\%#= peut tre suivi uniquement de 0, 1 ou 2. Le moteur automatique " "sera utilis " +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Moteur RE avec backtracking utilis pour le motif : " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Fin de regexp rencontre prmaturment" + #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (regexp NFA) %c au mauvais endroit" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) Fin de regexp rencontre prmaturment" +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (regexp NFA) Classe de caractre invalide : %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) Oprateur inconnu '\\z%c'" -#. should never happen +msgid "E951: \\% value too large" +msgstr "E951: valeur \\% trop grande" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Oprateur inconnu '\\%%%c'" + msgid "E868: Error building NFA with equivalence class!" msgstr "E868: Erreur lors de la construction du NFA avec classe d'quivalence" @@ -5123,6 +5122,9 @@ msgstr "E871: (regexp NFA) Un multi ne peut pas suivre un multi !" msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (regexp NFA) Trop de '('" +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (regexp NFA) Trop de \\z(" + msgid "E873: (NFA regexp) proper termination error" msgstr "E873: (NFA regexp) erreur de terminaison" @@ -5139,18 +5141,9 @@ msgstr "" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (regexp NFA) Pas assez de mmoire pour stocker le NFA" -msgid "E999: (NFA regexp internal error) Should not process NOT node !" +msgid "E878: (NFA) Could not allocate memory for branch traversal!" msgstr "" -"E999: (erreur interne du regexp NFA) Un noeud 'NOT' ne devrait pas tre " -"trait !" - -#. should not be here :P -msgid "E877: (NFA regexp) Invalid character class " -msgstr "E877: (regexp NFA) Classe de caractre invalide " - -#, c-format -msgid "(NFA) COULD NOT OPEN %s !" -msgstr "(NFA) IMPOSSIBLE D'OUVRIR %s !" +"E878: (NFA) Impossible d'allouer la mmoire pour parcourir les branches !" msgid "" "Could not open temporary log file for writing, displaying on stderr ... " @@ -5158,9 +5151,9 @@ msgstr "" "Impossible d'ouvrir le fichier de log temporaire en criture, affichage sur " "stderr ... " -msgid "E878: (NFA) Could not allocate memory for branch traversal!" -msgstr "" -"E878: (NFA) Impossible d'allouer la mmoire pour parcourir les branches!" +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) IMPOSSIBLE D'OUVRIR %s !" msgid "Could not open temporary log file for writing " msgstr "Impossible d'ouvrir le fichier de log en criture" @@ -5193,9 +5186,6 @@ msgstr " h msgid " Arabic" msgstr " arabe" -msgid " (lang)" -msgstr " (langue)" - msgid " (paste)" msgstr " (collage)" @@ -5238,7 +5228,6 @@ msgstr "E386: '?' ou '/' attendu apr msgid " (includes previously listed match)" msgstr " (inclut des correspondances listes prcdemment)" -#. cursor at status line msgid "--- Included files " msgstr "--- Fichiers inclus " @@ -5268,30 +5257,68 @@ msgstr "E387: La correspondance est sur la ligne courante" msgid "All included files were found" msgstr "Tous les fichiers inclus ont t trouvs" -msgid "No included files" -msgstr "Aucun fichier inclus" +msgid "No included files" +msgstr "Aucun fichier inclus" + +msgid "E388: Couldn't find definition" +msgstr "E388: Impossible de trouver la dfinition" + +msgid "E389: Couldn't find pattern" +msgstr "E389: Impossible de trouver le motif" + +msgid "Substitute " +msgstr "Substitue " + +#, c-format +msgid "" +"\n" +"# Last %sSearch Pattern:\n" +"~" +msgstr "" +"\n" +"# Dernier motif de recherche %s :\n" +"~" + +msgid "E756: Spell checking is not enabled" +msgstr "E756: La vrification orthographique n'est pas active" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Alerte : Liste de mots \"%s_%s.spl\" ou \"%s_ascii.spl\" introuvable" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Alerte : Liste de mots \"%s.%s.spl\" ou \"%s.ascii.spl\" introuvable" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: L'autocommande SpellFileMissing a effac le tampon" -msgid "E388: Couldn't find definition" -msgstr "E388: Impossible de trouver la dfinition" +#, c-format +msgid "Warning: region %s not supported" +msgstr "Alerte : rgion %s non supporte" -msgid "E389: Couldn't find pattern" -msgstr "E389: Impossible de trouver le motif" +msgid "Sorry, no suggestions" +msgstr "Dsol, aucune suggestion" -msgid "Substitute " -msgstr "Substitue " +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Dsol, seulement %ld suggestions" #, c-format -msgid "" -"\n" -"# Last %sSearch Pattern:\n" -"~" -msgstr "" -"\n" -"# Dernier motif de recherche %s :\n" -"~" +msgid "Change \"%.*s\" to:" +msgstr "Remplacer \"%.*s\" par :" + +# DB - todo : l'intrt de traduire ce message m'chappe. +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Pas de suggestion orthographique prcdente" -msgid "E759: Format error in spell file" -msgstr "E759: Erreur de format du fichier orthographique" +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Introuvable : %s" msgid "E758: Truncated spell file" msgstr "E758: Fichier orthographique tronqu" @@ -5313,17 +5340,6 @@ msgstr "E762: Un caract msgid "Compressing word tree..." msgstr "Compression de l'arbre des mots" -msgid "E756: Spell checking is not enabled" -msgstr "E756: La vrification orthographique n'est pas active" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "Alerte : Liste de mots \"%s_%s.spl\" ou \"%s_ascii.spl\" introuvable" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Alerte : Liste de mots \"%s.%s.spl\" ou \"%s.ascii.spl\" introuvable" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Lecture du fichier orthographique \"%s\"" @@ -5341,8 +5357,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Section non supporte dans le fichier orthographique" #, c-format -msgid "Warning: region %s not supported" -msgstr "Alerte : rgion %s non supporte" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: %s ne semble pas tre un fichier .sug" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Fichier de suggestions obsolte, mise jour ncessaire : %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Fichier .sug prvu pour une version de Vim plus rcente : %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Le fichier .sug ne correspond pas au fichier .spl : %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Erreur lors de la lecture de fichier de suggestions : %s" #, c-format msgid "Reading affix file %s ..." @@ -5493,8 +5525,8 @@ msgid "E760: No word count in %s" msgstr "E760: Nombre de mots non indiqu dans %s" #, c-format -msgid "line %6d, word %6d - %s" -msgstr "ligne %6d, mot %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "ligne %6d, mot %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5558,10 +5590,6 @@ msgstr "%d noeuds compress msgid "Reading back spell file..." msgstr "Relecture du fichier orthographique" -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Analyse phontique en cours..." @@ -5584,8 +5612,9 @@ msgstr "Estimation de m msgid "E751: Output file name must not have region name" msgstr "E751: Le nom du fichier ne doit pas contenir de nom de rgion" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: 8 rgions au maximum sont supportes" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: %ld rgions au maximum supportes" #, c-format msgid "E755: Invalid region in %s" @@ -5607,78 +5636,57 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' n'a pas %ld entres" #, c-format -msgid "Word removed from %s" -msgstr "Mot retir de %s" +msgid "Word '%.*s' removed from %s" +msgstr "Mot '%.*s' retir de %s" #, c-format -msgid "Word added to %s" -msgstr "Mot ajout dans %s" +msgid "Word '%.*s' added to %s" +msgstr "Mot '%.*s' ajout dans %s" msgid "E763: Word characters differ between spell files" msgstr "" "E763: Les caractres de mots diffrent entre les fichiers orthographiques" -msgid "Sorry, no suggestions" -msgstr "Dsol, aucune suggestion" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Dsol, seulement %ld suggestions" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Remplacer \"%.*s\" par :" +msgid "E783: duplicate char in MAP entry" +msgstr "E783: caractre dupliqu dans l'entre MAP" -# DB - todo : l'intrt de traduire ce message m'chappe. -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr "Aucun lment de syntaxe dfini pour ce tampon" -msgid "E752: No previous spell replacement" -msgstr "E752: Pas de suggestion orthographique prcdente" +msgid "syntax conceal on" +msgstr "\"syntax conceal\" active" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Introuvable : %s" +msgid "syntax conceal off" +msgstr "\"syntax conceal\" dsactive" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: %s ne semble pas tre un fichier .sug" +msgid "E390: Illegal argument: %s" +msgstr "E390: Argument invalide : %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Fichier de suggestions obsolte, mise jour ncessaire : %s" +msgid "syntax case ignore" +msgstr "syntaxe ignore la casse" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Fichier .sug prvu pour une version de Vim plus rcente : %s" +msgid "syntax case match" +msgstr "syntaxe respecte la casse" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Le fichier .sug ne correspond pas au fichier .spl : %s" +msgid "syntax spell toplevel" +msgstr "contrle orthographique dans le texte sans groupe syntaxique" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: Erreur lors de la lecture de fichier de suggestions : %s" +msgid "syntax spell notoplevel" +msgstr "pas de contrle orthographique dans le texte sans groupe syntaxique" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: caractres dupliqu dans l'entre MAP" +msgid "syntax spell default" +msgstr "" +"contrle orthographique dans le texte sans groupe syntaxique, sauf si @Spell/" +"@NoSpell" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: Argument invalide : %s" +msgid "syntax iskeyword " +msgstr "syntaxe iskeyword " #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Aucune grappe de syntaxe %s" -msgid "No Syntax items defined for this buffer" -msgstr "Aucun lment de syntaxe dfini pour ce tampon" - msgid "syncing on C-style comments" msgstr "synchronisation sur les commentaires de type C" @@ -5754,6 +5762,10 @@ msgstr "E847: Trop d'inclusions de syntaxe" msgid "E789: Missing ']': %s" msgstr "E789: ']' manquant : %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Caractre surnumraire aprs ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' manquant : %s" @@ -5808,6 +5820,11 @@ msgstr "E409: Nom de groupe inconnu : %s" msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Sous-commande de :syntax invalide : %s" +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" TOTAL NOMBRE MATCH PLUS LENT MOYEN NOM MOTIF" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: boucle rcursive lors du chargement de syncolor.vim" @@ -5902,7 +5919,6 @@ msgstr "E428: Impossible d'aller au-del msgid "File \"%s\" does not exist" msgstr "Le fichier \"%s\" n'existe pas" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "marqueur %d sur %d%s" @@ -5917,7 +5933,6 @@ msgstr " Utilisation d'un marqueur avec une casse diff msgid "E429: File \"%s\" does not exist" msgstr "E429: Le fichier \"%s\" n'existe pas" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5948,7 +5963,6 @@ msgstr "Avant l'octet %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: Le fichier de marqueurs %s n'est pas ordonn" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: Aucun fichier de marqueurs" @@ -5985,7 +5999,6 @@ msgstr "E436: Aucune entr msgid "E437: terminal capability \"cm\" required" msgstr "E437: capacit de terminal \"cm\" requise" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5993,6 +6006,35 @@ msgstr "" "\n" "--- Touches du terminal ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Impossible d'ouvrir $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Terminer la tche d'excution dans \"%s\"?" + +msgid "Terminal" +msgstr "Terminal" + +msgid "Terminal-finished" +msgstr "Terminal-fini" + +msgid "active" +msgstr "actif" + +msgid "running" +msgstr "en cours" + +msgid "finished" +msgstr "fini" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: Le fichier existe dj : %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Ce n'est pas un buffer de terminal" + msgid "new shell started\n" msgstr "nouveau shell dmarr\n" @@ -6003,13 +6045,10 @@ msgstr "Vim : Erreur lors de la lecture de l'entr msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "CUT_BUFFER0 utilis plutt qu'une slection vide" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Le nombre de lignes a t chang inopinment" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Le nombre de lignes a t chang inopinment" # DB - Question O/N. -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "Annulation impossible ; continuer" @@ -6099,61 +6138,200 @@ msgstr "E830: Annulation n msgid "E438: u_undo: line numbers wrong" msgstr "E438: u_undo : numros de ligne errons" -msgid "more line" -msgstr "ligne en plus" +msgid "more line" +msgstr "ligne en plus" + +msgid "more lines" +msgstr "lignes en plus" + +msgid "line less" +msgstr "ligne en moins" + +msgid "fewer lines" +msgstr "lignes en moins" + +msgid "change" +msgstr "modification" + +msgid "changes" +msgstr "modifications" + +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s ; %s #%ld ; %s" + +msgid "before" +msgstr "avant" + +msgid "after" +msgstr "aprs" + +msgid "Nothing to undo" +msgstr "Rien annuler" + +# DB - Les deux premires colonnes sont alignes droite. +msgid "number changes when saved" +msgstr "numro modif. instant enregistr" + +#, c-format +msgid "%ld seconds ago" +msgstr "il y a %ld secondes" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin n'est pas autoris aprs une annulation" + +msgid "E439: undo list corrupt" +msgstr "E439: la liste d'annulation est corrompue" + +msgid "E440: undo line missing" +msgstr "E440: ligne d'annulation manquante" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: La fonction %s existe dj (ajoutez ! pour la remplacer)" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Une entre du Dictionnaire porte dj ce nom" + +msgid "E718: Funcref required" +msgstr "E718: Rfrence de fonction (Funcref) requise" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Fonction inconnue : %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Argument invalide : %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Nom d'argument dupliqu : %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Trop d'arguments pour la fonction %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Arguments invalides pour la fonction %s" + +# AB - Vrifier dans la littrature technique s'il n'existe pas une meilleure +# traduction pour "function call depth". +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "" +"E132: La profondeur d'appel de fonction est suprieure 'maxfuncdepth'" + +# AB - Ce texte fait partie d'un message de dbogage. +#, c-format +msgid "calling %s" +msgstr "appel de %s" + +# AB - Vrifier. +#, c-format +msgid "%s aborted" +msgstr "%s annule" + +# AB - Ce texte fait partie d'un message de dbogage. +#, c-format +msgid "%s returning #%ld" +msgstr "%s a retourn #%ld" + +# AB - Ce texte fait partie d'un message de dbogage. +#, c-format +msgid "%s returning %s" +msgstr "%s a retourn \"%s\"" + +msgid "E699: Too many arguments" +msgstr "E699: Trop d'arguments" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Fonction inconnue : %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: La fonction a t efface: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: La fonction %s n'a pas reu assez d'arguments" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> utilis en dehors d'un script : %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Appel d'une fonction dict sans Dictionnaire : %s" + +msgid "E129: Function name required" +msgstr "E129: Nom de fonction requis" -msgid "more lines" -msgstr "lignes en plus" +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "" +"E128: Le nom de la fonction doit commencer par une majuscule ou \"s:\": %s" -msgid "line less" -msgstr "ligne en moins" +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "" +"E884: Le nom de la fonction ne peut pas contenir le caractre deux-points : " +"%s" -msgid "fewer lines" -msgstr "lignes en moins" +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Fonction non dfinie : %s" -msgid "change" -msgstr "modification" +# AB - La version franaise est plus consistante que la version anglaise. +# AB - Je suis partag entre la concision d'une traduction assez littrale et +# la lourdeur d'une traduction plus correcte. +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Il manque '(' aprs %s" -msgid "changes" -msgstr "modifications" +msgid "E862: Cannot use g: here" +msgstr "E862: Impossible d'utiliser g: ici" #, c-format -msgid "%ld %s; %s #%ld %s" -msgstr "%ld %s ; %s #%ld ; %s" - -msgid "before" -msgstr "avant" +msgid "E932: Closure function should not be at top level: %s" +msgstr "" +"E932: une fonction fermeture ne devrait pas tre au niveau principal : %s" -msgid "after" -msgstr "aprs" +msgid "E126: Missing :endfunction" +msgstr "E126: Il manque :endfunction" -msgid "Nothing to undo" -msgstr "Rien annuler" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Texte trouv aprs :endfunction: %s" -# DB - Les deux premires colonnes sont alignes droite. -msgid "number changes when saved" -msgstr "numro modif. instant enregistr" +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Le nom de fonction entre en conflit avec la variable : %s" #, c-format -msgid "%ld seconds ago" -msgstr "il y a %ld secondes" +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Impossible de redfinir fonction %s : dj utilise" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undojoin n'est pas autoris aprs une annulation" +# DB - Le contenu du "c-format" est le nom de la fonction. +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Le nom de la fonction %s ne correspond pas le nom du script" -msgid "E439: undo list corrupt" -msgstr "E439: la liste d'annulation est corrompue" +# AB - Il est difficile de crer une version franaise qui fasse moins de 80 +# caractres de long, nom de la fonction compris : "It is in use" est une +# expression trs dense. Traductions possibles : "elle est utilise", +# "elle s'excute" ou "elle est occupe". +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Impossible d'effacer %s : cette fonction est utilise" -msgid "E440: undo line missing" -msgstr "E440: ligne d'annulation manquante" +msgid "E133: :return not inside a function" +msgstr "E133: :return en dehors d'une fonction" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Version graphique MS-Windows 16/32 bits" +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Parenthses manquantes : %s" msgid "" "\n" @@ -6169,9 +6347,6 @@ msgstr "" "\n" "Version graphique MS-Windows 32 bits" -msgid " in Win32s mode" -msgstr " lance en mode Win32s" - msgid " with OLE support" msgstr " supportant l'OLE" @@ -6191,45 +6366,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Version MS-Windows 16 bits" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Version MS-DOS 32 bits" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Version MS-DOS 16 bits" - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"Version MaxOS X (unix)" - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"Version MacOS X" +"Version macOS" msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"Version MacOS" +"Version macOS sans fonctionalits darwin" msgid "" "\n" @@ -6303,6 +6450,9 @@ msgstr "" msgid "without GUI." msgstr "sans interface graphique." +msgid "with GTK3 GUI." +msgstr "avec interface graphique GTK3." + msgid "with GTK2-GNOME GUI." msgstr "avec interface graphique GTK2-GNOME." @@ -6330,9 +6480,6 @@ msgstr "avec interface graphique Carbon." msgid "with Cocoa GUI." msgstr "avec interface graphique Cocoa." -msgid "with (classic) GUI." -msgstr "avec interface graphique (classic)." - msgid " Features included (+) or not (-):\n" msgstr " Fonctionnalits incluses (+) ou non (-) :\n" @@ -6366,6 +6513,9 @@ msgstr "2me fichier gvimrc utilisateur : \"" msgid "3rd user gvimrc file: \"" msgstr "3me fichier gvimrc utilisateur : \"" +msgid " defaults file: \"" +msgstr " fichier de valeurs par dfaut : \"" + msgid " system menu file: \"" msgstr " fichier menu systme : \"" @@ -6411,8 +6561,8 @@ msgstr "tapez :q<Entr msgid "type :help<Enter> or <F1> for on-line help" msgstr "tapez :help<Entre> ou <F1> pour accder l'aide en ligne " -msgid "type :help version7<Enter> for version info" -msgstr "tapez :help version7<Entre> pour lire les notes de mise jour" +msgid "type :help version8<Enter> for version info" +msgstr "tapez :help version8<Entre> pour lire les notes de mise jour" # DB - Pour les trois messages qui suivent : # :set cp @@ -6462,12 +6612,6 @@ msgstr "tapez :help register<Entr msgid "menu Help->Sponsor/Register for information " msgstr "menu Aide->Sponsor/Enregistrement pour plus d'info" -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ALERTE: Windows 95/98/ME dtect" - -msgid "type :help windows95<Enter> for info on this" -msgstr "tapez :help windows95<Entre> pour plus d'information" - msgid "Already only one window" msgstr "Il n'y a dj plus qu'une fentre" @@ -6501,6 +6645,25 @@ msgstr "E446: Aucun nom de fichier sous le curseur" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Le fichier \"%s\" est introuvable dans 'path'" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID invalide : %ld (doit tre plus grand ou gal 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID dj pris: %ld" + +msgid "List or number required" +msgstr "Liste ou nombre requis" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID invalide : %ld (doit tre plus grand ou gal 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID introuvable : %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Impossible de charger la bibliothque %s" @@ -6524,7 +6687,6 @@ msgstr "&Comparer avec Vim" msgid "Edit with &Vim" msgstr "diter dans &Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "diter dans le Vim existant - " @@ -6548,10 +6710,6 @@ msgstr "Le chemin est trop long !" msgid "--No lines in buffer--" msgstr "--Le tampon est vide--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Commande annule" @@ -6609,6 +6767,10 @@ msgstr "E236: La police \"%s\" n'a pas une chasse (largeur) fixe" msgid "E473: Internal error" msgstr "E473: Erreur interne" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Erreur interne : %s" + msgid "Interrupted" msgstr "Interrompu" @@ -6622,6 +6784,14 @@ msgstr "E474: Argument invalide" msgid "E475: Invalid argument: %s" msgstr "E475: Argument invalide : %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: Valeur d'argument invalide : %s" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Valeur d'argument invalide %s : %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Expression invalide : %s" @@ -6640,6 +6810,9 @@ msgstr "E17: \"%s\" est un r msgid "E364: Library call failed for \"%s()\"" msgstr "E364: L'appel la bibliothque a chou pour \"%s()\"" +msgid "E667: Fsync failed" +msgstr "E667: Fsynch a chou" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Impossible de charger la fonction %s de la bibliothque" @@ -6734,9 +6907,6 @@ msgstr "E484: Impossible d'ouvrir le fichier \"%s\"" msgid "E485: Can't read file %s" msgstr "E485: Impossible de lire le fichier %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Modifications non enregistres (ajoutez ! pour passer outre)" - msgid "E38: Null argument" msgstr "E38: Argument null" @@ -6791,6 +6961,32 @@ msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "" "E794: Impossible de modifier une variable depuis le bac sable : \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Impossible d'utiliser une cl vide dans un Dictionnaire" + +msgid "E715: Dictionary required" +msgstr "E715: Dictionnaire requis" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: index de Liste hors limites : %ld au-del de la fin" + +# DB : Suggestion +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: La fonction %s a reu trop d'arguments" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: La cl %s n'existe pas dans le Dictionnaire" + +msgid "E714: List required" +msgstr "E714: Liste requise" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: L'argument de %s doit tre une Liste ou un Dictionnaire" + msgid "E47: Error while reading errorfile" msgstr "E47: Erreur lors de la lecture du fichier d'erreurs" @@ -6848,8 +7044,8 @@ msgstr "E592: 'winwidth' ne peut pas msgid "E80: Error while writing" msgstr "E80: Erreur lors de l'criture" -msgid "Zero count" -msgstr "Le quantificateur est nul" +msgid "E939: Positive count required" +msgstr "E939: Quantificateur positif requis" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> utilis en dehors d'un script" @@ -6864,16 +7060,16 @@ msgid "E744: NetBeans does not allow changes in read-only files" msgstr "" "E744: NetBeans n'autorise pas la modification des fichiers en lecture seule" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Erreur interne : %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: le motif utilise plus de mmoire que 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: tampon vide" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Le tampon %ld n'existe pas" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Dlimiteur ou motif de recherche invalide" @@ -6887,6 +7083,13 @@ msgstr "E764: L'option '%s' n'est pas activ msgid "E850: Invalid register name" msgstr "E850: Nom de registre invalide" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Rpertoire introuvable dans '%s' : \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Une autocommande a caus une rcursivit" + msgid "search hit TOP, continuing at BOTTOM" msgstr "La recherche a atteint le HAUT, et continue en BAS" @@ -6897,107 +7100,176 @@ msgstr "La recherche a atteint le BAS, et continue en HAUT" msgid "Need encryption key for \"%s\"" msgstr "Besoin de la cl de chiffrement pour \"%s\"" -msgid "can't delete OutputObject attributes" -msgstr "impossible d'effacer les attributs d'OutputObject" +msgid "empty keys are not allowed" +msgstr "les cls vides ne sont pas autorises" + +msgid "dictionary is locked" +msgstr "dictionnaire est verrouill" + +msgid "list is locked" +msgstr "liste verrouille" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "l'ajout de cl '%s' au dictionnaire a chou" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "index doit tre int ou slice, et non %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "attendu instance de str() ou unicode(), mais reu %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "attendu instance de bytes() ou str(), mais reu %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"attendu int(), long() ou quelque chose qui peut tre transform en long(), " +"mais reu %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "" +"attendu int() ou quelque chose qui peut tre transform en int(), mais reu " +"%s" -msgid "softspace must be an integer" -msgstr "softspace doit tre un nombre entier" +msgid "value is too large to fit into C int type" +msgstr "valeur trop grande pour tre stocke dans le type C int" -msgid "invalid attribute" -msgstr "attribut invalide" +msgid "value is too small to fit into C int type" +msgstr "valeur trop petite pour tre stocke dans le type C int" + +msgid "number must be greater than zero" +msgstr "le nombre doit tre plus grand que zro" + +msgid "number must be greater or equal to zero" +msgstr "le nombre doit tre plus grand ou gal zro" + +msgid "can't delete OutputObject attributes" +msgstr "impossible d'effacer les attributs d'OutputObject" -msgid "writelines() requires list of strings" -msgstr "writelines() requiert une liste de chanes" +#, c-format +msgid "invalid attribute: %s" +msgstr "attribut invalide : %s" msgid "E264: Python: Error initialising I/O objects" msgstr "E264: Python : Erreur d'initialisation des objets d'E/S" -msgid "empty keys are not allowed" -msgstr "les cls vides ne sont pas autorises" +msgid "failed to change directory" +msgstr "changement de rpertoire a chou" -msgid "Cannot delete DictionaryObject attributes" -msgstr "Impossible d'effacer les attributs de DictionaryObject" +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "attendu un 3-tuple comme rsultat de imp.find_module(), mais reu %s" -msgid "Cannot modify fixed dictionary" -msgstr "Impossible de modifier un dictionnaire fixe" +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"attendu un 3-tuple comme rsultat de imp.find_module(), mais reu un tuple " +"de taille %d" -msgid "Cannot set this attribute" -msgstr "Impossible d'initialiser cet attribut" +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "erreur interne : imp.find_module a retourn un tuple contenant NULL" -msgid "dict is locked" -msgstr "dictionnaire est verrouill" +msgid "cannot delete vim.Dictionary attributes" +msgstr "impossible d'effacer les attributs de vim.Dictionary" -msgid "failed to add key to dictionary" -msgstr "l'ajout de cl au dictionnaire a chou" +msgid "cannot modify fixed dictionary" +msgstr "impossible de modifier un dictionnaire fixe" + +#, c-format +msgid "cannot set attribute %s" +msgstr "impossible d'initialiser l'attribut %s" + +msgid "hashtab changed during iteration" +msgstr "la table de hachage a t change pendant une itration" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "" +"attendu une squence d'lments de taille 2, mais reu une squence de " +"taille %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "le constructeur de liste n'accepte pas les arguments nomms" msgid "list index out of range" msgstr "index de liste hors limites" -msgid "internal error: failed to get vim list item" -msgstr "erreur interne : accs un lment de liste a chou" +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "erreur interne : accs un lment %d de liste a chou" -msgid "list is locked" -msgstr "liste verrouille" +msgid "slice step cannot be zero" +msgstr "le pas du dcoupage en tranche ne peut pas tre zro" -msgid "Failed to add item to list" -msgstr "Ajout la liste a chou" +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"tentative d'assigner une squence de taille plus grande que %d un " +"dcoupage en tranche tendu " -msgid "internal error: no vim list item" -msgstr "erreur interne : pas d'lment de liste vim" +#, c-format +msgid "internal error: no vim list item %d" +msgstr "erreur interne : pas d'lment %d de liste vim" -msgid "can only assign lists to slice" -msgstr "seules des tranches peuvent tre assignes aux listes" +msgid "internal error: not enough list items" +msgstr "erreur interne : pas assez d'lments de liste" msgid "internal error: failed to add item to list" msgstr "erreur interne : ajout d'lment la liste a chou" -msgid "can only concatenate with lists" -msgstr "on ne peut que concatner avec des listes" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"tentative d'assigner une squence de taille %d un dcoupage en tranche " +"tendu de taille %d" + +msgid "failed to add item to list" +msgstr "ajout la liste a chou" -msgid "cannot delete vim.dictionary attributes" -msgstr "impossible d'effacer les attributs de vim.dictionary" +msgid "cannot delete vim.List attributes" +msgstr "impossible d'effacer les attributs de vim.List" msgid "cannot modify fixed list" msgstr "impossible de modifier une liste fixe" -msgid "cannot set this attribute" -msgstr "impossible d'initialiser cet attribut" +#, c-format +msgid "unnamed function %s does not exist" +msgstr "la fonction sans nom %s n'existe pas" -msgid "'self' argument must be a dictionary" -msgstr "l'argument 'self' doit tre un dictionnaire" +#, c-format +msgid "function %s does not exist" +msgstr "la fonction %s n'existe pas" -msgid "failed to run function" -msgstr "excution de la fonction a chou" +#, c-format +msgid "failed to run function %s" +msgstr "excution de la fonction %s a chou" msgid "unable to get option value" msgstr "impossible d'obtenir la valeur d'une option" -msgid "unable to unset global option" -msgstr "impossible de dsactiver une option globale" - -msgid "unable to unset option without global value" -msgstr "impossible de dsactiver une option sans une valeur globale" +msgid "internal error: unknown option type" +msgstr "erreur interne : type d'option inconnu" -msgid "object must be integer" -msgstr "objet doit tre un nombre entier" - -msgid "object must be string" -msgstr "objet doit tre de type string" - -msgid "attempt to refer to deleted tab page" -msgstr "tentative de rfrencer un onglet effac" +msgid "problem while switching windows" +msgstr "problme lors du changement de fentres" #, c-format -msgid "<tabpage object (deleted) at %p>" -msgstr "<objet onglet (effac) %p>" +msgid "unable to unset global option %s" +msgstr "impossible de dsactiver une option globale %s" #, c-format -msgid "<tabpage object (unknown) at %p>" -msgstr "<objet onglet (inconnu) %p>" +msgid "unable to unset option %s which does not have global value" +msgstr "impossible de dsactiver l'option %s qui n'a pas de valeur globale" -#, c-format -msgid "<tabpage %d>" -msgstr "<onglet %d>" +msgid "attempt to refer to deleted tab page" +msgstr "tentative de rfrencer un onglet effac" msgid "no such tab page" msgstr "cet onglet n'existe pas" @@ -7005,45 +7277,35 @@ msgstr "cet onglet n'existe pas" msgid "attempt to refer to deleted window" msgstr "tentative de rfrencer une fentre efface" -msgid "readonly attribute" -msgstr "attribut en lecture seule" +msgid "readonly attribute: buffer" +msgstr "attribut en lecture seule : tampon" msgid "cursor position outside buffer" msgstr "curseur positionn en dehors du tampon" -#, c-format -msgid "<window object (deleted) at %p>" -msgstr "<objet fentre (effac) %p>" - -#, c-format -msgid "<window object (unknown) at %p>" -msgstr "<objet fentre (inconnu) %p>" - -#, c-format -msgid "<window %d>" -msgstr "<fentre %d>" - msgid "no such window" msgstr "Cette fentre n'existe pas" msgid "attempt to refer to deleted buffer" msgstr "tentative de rfrencer un tampon effac" -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<objet tampon (effac) %p>" +msgid "failed to rename buffer" +msgstr "impossible de renommer le tampon" -msgid "key must be integer" -msgstr "la cl doit tre un nombre entier" +msgid "mark name must be a single character" +msgstr "le nom de marque doit tre un seul caractre" -msgid "expected vim.buffer object" -msgstr "objet vim.buffer attendu" +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "attendu un objet vim.Buffer, mais reu %s" -msgid "failed to switch to given buffer" -msgstr "impossible de se dplacer au tampon donn" +#, c-format +msgid "failed to switch to buffer %d" +msgstr "impossible de se dplacer au tampon %d" -msgid "expected vim.window object" -msgstr "objet vim.window attendu" +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "attendu un objet vim.Window, mais reu %s" msgid "failed to find window in the current tab page" msgstr "impossible de trouver une fentre dans l'onglet courant" @@ -7051,8 +7313,9 @@ msgstr "impossible de trouver une fen msgid "did not switch to the specified window" msgstr "ne s'est pas dplac la fentre spcifie" -msgid "expected vim.tabpage object" -msgstr "objet vim.tabpage attendu" +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "attendu un objet vim.TabPage, mais reu %s" msgid "did not switch to the specified tab page" msgstr "impossible de se dplacer l'onglet spcifi" @@ -7066,26 +7329,82 @@ msgstr "E858: Eval n'a pas retourn msgid "E859: Failed to convert returned python object to vim value" msgstr "E859: Conversion d'objet python une valeur de vim a chou" -msgid "unable to convert to vim structure" -msgstr "conversion une structure vim impossible" +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "impossible de convertir %s un dictionnaire vim" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "impossible de convertir %s une liste de vim" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "impossible de convertir %s une structure de vim" -msgid "NULL reference passed" -msgstr "rfrence NULL passe" +msgid "internal error: NULL reference passed" +msgstr "erreur interne : rfrence NULL passe" msgid "internal error: invalid value type" msgstr "erreur interne : type de valeur invalide" -#~ msgid "E860: Eval did not return a valid python 3 object" -#~ msgstr "E860: Eval n'a pas retourn un object python 3 valid" +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Impossible d'initialiser sys.path_hook qui n'est pas un liste\n" +"Vous devez maintenant :\n" +"- ajouter vim.path_hook sys.path_hooks\n" +"- ajouter vim.VIM_SPECIAL_PATH sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Impossible d'initialiser le chemin : sys.math n'est pas une liste\n" +"Vous devez maintenant ajouter vim.VIM_SPECIAL_PATH sys.path" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Fichiers de macros Vim (*.vim)\t*.vim\n" +"Tous les fichiers (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "Tous les fichiers (*.)\t*.*\n" -#~ msgid "E861: Failed to convert returned python 3 object to vim value" -#~ msgstr "E861: Conversion d'objet python 3 une valeur de vim a chou" +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Tous les fichiers (*.*)\t*.*\n" +"Source C (*.c, *.h)\t*.c;*.h\n" +"Source C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Code VB (*.bas, *.frm)\t*.bas;*.frm\n" +"Fichiers Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" -#~ msgid "E863: return value must be an instance of str" -#~ msgstr "E863: valeur de retour doit tre une instance de Str" +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Fichiers de macros Vim (*.vim)\t*.vim\n" +"Tous les fichiers (*)\t*\n" -#~ msgid "Only boolean objects are allowed" -#~ msgstr "Seuls les objets boolens sont autoriss" +msgid "All Files (*)\t*\n" +msgstr "Tous les fichiers (*)\t*\n" -#~ msgid "no such key in dictionary" -#~ msgstr "cette cl est inexistante dans le dictionnaire" +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Tous les fichiers (*)\t*\n" +"Source C (*.c, *.h)\t*.c;*.h\n" +"Source C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Fichiers Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/ga.po b/src/po/ga.po index 3b9a79b741..d409560f6b 100644 --- a/src/po/ga.po +++ b/src/po/ga.po @@ -6,13 +6,40 @@ msgid "" msgstr "" "Project-Id-Version: vim 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-14 09:44-0500\n" +"POT-Creation-Date: 2017-07-11 15:45-0500\n" "PO-Revision-Date: 2010-04-14 10:01-0500\n" "Last-Translator: Kevin Patrick Scannell <kscanne@gmail.com>\n" "Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net>\n" +"Language: ga\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : (n>2 && n<7) ? 2 :" +"(n>6 && n<11) ? 3 : 4;\n" + +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: cuireadh glaoch ar bf_key_init() le focal faire folamh" + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) != 4" + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: sid mhcheart Blowfish mrcheannach/caolcheannach" + +msgid "E818: sha256 test failed" +msgstr "E818: Theip ar thstil sha256" + +msgid "E819: Blowfish test failed" +msgstr "E819: Theip ar thstil Blowfish" + +msgid "[Location List]" +msgstr "[Liosta Suomh]" + +msgid "[Quickfix List]" +msgstr "[Liosta Mearcheartchn]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Tobscoireadh an t-ord mar gheall ar uathorduithe" msgid "E82: Cannot allocate any buffer, exiting..." msgstr "E82: N fidir maoln a dhileadh, ag scor..." @@ -20,6 +47,12 @@ msgstr "E82: N msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: N fidir maoln a dhileadh, ag sid cinn eile..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: N fidir an maoln a chlr" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Iarracht ar mhaoln in sid a scriosadh" + msgid "E515: No buffers were unloaded" msgstr "E515: N raibh aon mhaoln dluchtaithe" @@ -50,6 +83,9 @@ msgstr "Bh msgid "%d buffers wiped out" msgstr "%d maoln bnaithe" +msgid "E90: Cannot unload last buffer" +msgstr "E90: N fidir an maoln deireanach a dhlucht" + msgid "E84: No modified buffer found" msgstr "E84: Nor aimsodh maoln mionathraithe" @@ -57,10 +93,6 @@ msgstr "E84: N msgid "E85: There is no listed buffer" msgstr "E85: Nl aon mhaoln liostaithe ann" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Nl a leithid de mhaoln %ld" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: N fidir a dhul thar an maoln deireanach" @@ -73,9 +105,6 @@ msgstr "" "E89: Athraodh maoln %ld ach nach bhfuil s sbhilte shin (cuir ! leis " "an ord chun sr)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: N fidir an maoln deireanach a dhlucht" - msgid "W14: Warning: List of file names overflow" msgstr "W14: Rabhadh: Liosta ainmneacha comhaid thar maoil" @@ -110,6 +139,9 @@ msgstr "[Comhad nua]" msgid "[Read errors]" msgstr "[Earrid limh]" +msgid "[RO]" +msgstr "[L-A]" + msgid "[readonly]" msgstr "[inlite amhin]" @@ -147,7 +179,6 @@ msgstr "Bun" msgid "Top" msgstr "Barr" -#, c-format msgid "" "\n" "# Buffer list:\n" @@ -155,12 +186,6 @@ msgstr "" "\n" "# Liosta maolin:\n" -msgid "[Location List]" -msgstr "[Liosta Suomh]" - -msgid "[Quickfix List]" -msgstr "[Liosta Ceartchn Tapa]" - msgid "[Scratch]" msgstr "[Sealadach]" @@ -179,8 +204,100 @@ msgstr "Comhartha msgid " line=%ld id=%d name=%s" msgstr " lne=%ld id=%d ainm=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: N fidir ceangal leis an bport" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() in channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() in channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: fuarthas ord le hargint nach bhfuil ina theaghrn" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: n mr don argint dheireanach ar expr/call a bheith ina huimhir" + +msgid "E904: third argument for call must be a list" +msgstr "E904: Caithfidh an tr argint a bheith ina liosta" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: fuarthas ord anaithnid: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): scrobh gan ceangal a bheith ann" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): theip ar scrobh" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: N fidir aisghlaoch a sid le %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: n fidir ch_evalexpr()/ch_sendexpr() a sid le cainal raw n nl" + +msgid "E906: not an open channel" +msgstr "E906: n cainal oscailte " + +msgid "E920: _io file requires _name to be set" +msgstr "E920: caithfear _name a shocr chun comhad _io a sid" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: caithfear in_buf n in_name a shocr chun maoln in_io a sid" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: n mr an maoln a lucht: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Comhad criptithe le modh anaithnid" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Rabhadh: Criptichn lag; fach :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Iontril eochair chriptichin: " + +msgid "Enter same key again: " +msgstr "Iontril an eochair ars: " + +msgid "Keys don't match!" +msgstr "Nl na heochracha comhoirinach le chile!" + +msgid "[crypted]" +msgstr "[criptithe]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Idirstad ar iarraidh i bhFoclir: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Eochair dhblach i bhFoclir: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Camg ar iarraidh i bhFoclir: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: '}' ar iarraidh ag deireadh foclra: %s" + +msgid "extend() argument" +msgstr "argint extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: T eochair ann cheana: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: N fidir diff a dhanamh ar nos m n %ld maoln" msgid "E810: Cannot read or write temp files" @@ -281,6 +398,12 @@ msgstr " Comhl msgid "Hit end of paragraph" msgstr "Sroicheadh croch an pharagraif" +msgid "E839: Completion function changed window" +msgstr "E839: D'athraigh an fheidhm chomhlnaithe an fhuinneog" + +msgid "E840: Completion function deleted text" +msgstr "E840: Scrios an fheidhm chomhlnaithe roinnt tacs" + msgid "'dictionary' option is empty" msgstr "t an rogha 'dictionary' folamh" @@ -304,6 +427,9 @@ msgstr "%s msgid "Scanning tags." msgstr "Clibeanna scanadh." +msgid "match in file" +msgstr "meaitseil sa chomhad" + msgid " Adding" msgstr " Mad" @@ -331,13 +457,10 @@ msgstr "comhoiri msgid "match %d" msgstr "comhoirin %d" +#. maximum nesting of lists and dicts msgid "E18: Unexpected characters in :let" msgstr "E18: Carachtair gan choinne i :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: innacs liosta as raon: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Athrg gan sainmhni: %s" @@ -345,41 +468,6 @@ msgstr "E121: Athr msgid "E111: Missing ']'" msgstr "E111: `]' ar iarraidh" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Caithfidh argint de %s a bheith ina Liosta" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Caithfidh argint de %s a bheith ina Liosta n Foclir" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: N fidir eochair fholamh a sid le Foclir" - -msgid "E714: List required" -msgstr "E714: T g le liosta" - -msgid "E715: Dictionary required" -msgstr "E715: T g le foclir" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: An iomarca argint d'fheidhm: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Nl an eochair seo san Fhoclir: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: T feidhm %s ann cheana, cuir ! leis an ord chun a asiti" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: T an iontril foclra seo ann cheana" - -msgid "E718: Funcref required" -msgstr "E718: T g le Funcref" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: N fidir [:] a sid le foclir" @@ -387,14 +475,13 @@ msgstr "E719: N msgid "E734: Wrong variable type for %s=" msgstr "E734: Cinel mcheart athrige le haghaidh %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Feidhm anaithnid: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Ainm athrige neamhcheadaithe: %s" +msgid "E806: using Float as a String" +msgstr "E806: Snmhphointe sid mar Theaghrn" + msgid "E687: Less targets than List items" msgstr "E687: Nos l spriocanna n mreanna Liosta" @@ -426,14 +513,16 @@ msgstr "E711: N msgid "E690: Missing \"in\" after :for" msgstr "E690: \"in\" ar iarraidh i ndiaidh :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Libn ar iarraidh: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Nl a leithid d'athrg: \"%s\"" +#. For historic reasons this error is not given for a list or dict. +#. * E.g., the b: dict could be locked/unlocked. +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: N fidir athrg %s a ghlasil n a dhghlasil" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: athrg neadaithe rdhomhain chun a (d)ghlasil" @@ -452,9 +541,6 @@ msgstr "E735: Is f msgid "E736: Invalid operation for Dictionary" msgstr "E736: Oibrocht neamhbhail ar Fhoclir" -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Is fidir Funcref a chur i gcomparid le Funcref eile amhin" - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Oibrocht neamhbhail ar Funcref" @@ -467,6 +553,9 @@ msgstr "E110: ')' ar iarraidh" msgid "E695: Cannot index a Funcref" msgstr "E695: N fidir Funcref a innacs" +msgid "E909: Cannot index a special variable" +msgstr "E909: N fidir athrg speisialta a innacs" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Ainm rogha ar iarraidh: %s" @@ -483,62 +572,122 @@ msgstr "E114: Comhartha athfhriotail ar iarraidh: %s" msgid "E115: Missing quote: %s" msgstr "E115: Comhartha athfhriotail ar iarraidh: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Camg ar iarraidh i Liosta: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Nl go leor cuimhne ann le tagairt a shocr; baili dramhaola thobscor!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: ']' ar iarraidh ag deireadh liosta: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: athrg neadaithe rdhomhain chun a thaispeint" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Idirstad ar iarraidh i bhFoclir: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Snmhphointe sid mar Uimhir" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Eochair dhblach i bhFoclir: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref sid mar Uimhir" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Camg ar iarraidh i bhFoclir: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Liosta sid mar Uimhir" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: '}' ar iarraidh ag deireadh foclra: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Foclir sid mar Uimhir" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: athrg neadaithe rdhomhain chun a thaispeint" +msgid "E910: Using a Job as a Number" +msgstr "E910: Jab sid mar Uimhir" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Cainal sid mar Uimhir" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref sid mar Shnmhphointe" + +msgid "E892: Using a String as a Float" +msgstr "E892: Teaghrn sid mar Shnmhphointe" + +msgid "E893: Using a List as a Float" +msgstr "E893: Liosta sid mar Shnmhphointe" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Foclir sid mar Shnmhphointe" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Luach speisialta sid mar Shnmhphointe" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Jab sid mar Shnmhphointe" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Cainal sid mar Shnmhphointe" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref sid mar Theaghrn" + +msgid "E730: using List as a String" +msgstr "E730: Liosta sid mar Theaghrn" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Foclir sid mar Theaghrn" + +msgid "E908: using an invalid value as a String" +msgstr "E908: luach neamhbhail sid mar Theaghrn" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: An iomarca argint d'fheidhm %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: N fidir athrg %s a scriosadh" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Argint neamhbhail d'fheidhm %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Caithfidh ceannlitir a bheith ar dts ainm Funcref: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Feidhm anaithnid: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Tagann ainm athrige salach ar fheidhm at ann cheana: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Nl go leor feidhmeanna d'fheidhm: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: T an luach faoi ghlas: %s" + +msgid "Unknown" +msgstr "Anaithnid" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> sid ach gan a bheith i gcomhthacs scripte: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: N fidir an luach de %s a athr" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: athrg neadaithe rdhomhain chun a chipeil" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# athrga comhchoiteanna:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tSocraithe is dana " + +msgid "map() argument" +msgstr "argint map()" + +msgid "filter() argument" +msgstr "argint filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Feidhm 'dict' ghlao gan Foclir: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Caithfidh argint de %s a bheith ina Liosta" + +msgid "E928: String required" +msgstr "E928: Teaghrn de dhth" msgid "E808: Number or Float required" msgstr "E808: Uimhir n Snmhphointe de dhth" -msgid "E699: Too many arguments" -msgstr "E699: An iomarca argint" +msgid "add() argument" +msgstr "argint add()" msgid "E785: complete() can only be used in Insert mode" msgstr "E785: is fidir complete() a sid sa mhd Ionsite amhin" @@ -551,18 +700,18 @@ msgstr "E785: is f msgid "&Ok" msgstr "&Ok" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: T eochair ann cheana: %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld lne: " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Feidhm anaithnid: %s" +msgid "E922: expected a dict" +msgstr "E922: bhothas ag sil le foclir" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "" +"E923: Caithfidh an dara hargint de function() a bheith ina liosta n ina " +"foclir" + msgid "" "&OK\n" "&Cancel" @@ -573,12 +722,22 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "Glaodh inputrestore() nos minice n inputsave()" +msgid "insert() argument" +msgstr "argint insert()" + msgid "E786: Range not allowed" msgstr "E786: N cheadatear an raon" +msgid "E916: not a valid job" +msgstr "E916: n jab bail " + msgid "E701: Invalid type for len()" msgstr "E701: Cinel neamhbhail le haghaidh len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: Aitheantas in irithe do \":match\": %ld" + msgid "E726: Stride is zero" msgstr "E726: Is nialas an chim" @@ -588,8 +747,8 @@ msgstr "E727: Tosach thar dheireadh" msgid "<empty>" msgstr "<folamh>" -msgid "E240: No connection to Vim server" -msgstr "E240: Nl aon nasc le freastala Vim" +msgid "E240: No connection to the X server" +msgstr "E240: Nl aon cheangal leis an bhfreastala X" #, c-format msgid "E241: Unable to send to %s" @@ -598,159 +757,52 @@ msgstr "E241: N msgid "E277: Unable to read a server reply" msgstr "E277: N fidir freagra n fhreastala a lamh" -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: An iomarca naisc shiombalacha (ciogal?)" - -msgid "E258: Unable to send to client" -msgstr "E258: N fidir aon rud a sheoladh chuig an chliant" - -msgid "E702: Sort compare function failed" -msgstr "E702: Theip ar fheidhm chomparide le linn srtla" - -msgid "(Invalid)" -msgstr "(Neamhbhail)" - -msgid "E677: Error writing temp file" -msgstr "E677: Earrid agus comhad sealadach scrobh" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Snmhphointe sid mar Uimhir" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref sid mar Uimhir" - -msgid "E745: Using a List as a Number" -msgstr "E745: Liosta sid mar Uimhir" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Foclir sid mar Uimhir" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref sid mar Theaghrn" - -msgid "E730: using List as a String" -msgstr "E730: Liosta sid mar Theaghrn" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Foclir sid mar Theaghrn" - -msgid "E806: using Float as a String" -msgstr "E806: Snmhphointe sid mar Theaghrn" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Caithfidh ceannlitir a bheith ar dts ainm Funcref: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Tagann ainm athrige salach ar fheidhm at ann cheana: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Mmheaitseil idir cinelacha athrige: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: N fidir athrg %s a scriosadh" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: T an luach faoi ghlas: %s" - -msgid "Unknown" -msgstr "Anaithnid" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: N fidir an luach de %s a athr" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: athrg neadaithe rdhomhain chun a chipeil" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Feidhm gan sainmhni: %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' ar iarraidh: %s" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Argint neamhcheadaithe: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction ar iarraidh" - -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Tagann ainm na feidhme salach ar athrg: %s" - -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: N fidir sainmhni nua a dhanamh ar fheidhm %s: In sid cheana" +msgid "E941: already started a server" +msgstr "E941: tosaodh freastala cheana" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "" -"E746: Nl ainm na feidhme comhoirinach le hainm comhaid na scripte: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: nl an ghn +clientserver ar fil" -msgid "E129: Function name required" -msgstr "E129: T g le hainm feidhme" +msgid "remove() argument" +msgstr "argint remove()" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Caithfidh ceannlitir a bheith ar dts ainm feidhme, n idirstad a " -"bheith ann: %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: An iomarca naisc shiombalacha (ciogal?)" -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: N fidir feidhm %s a scriosadh: T s in sid faoi lthair" +msgid "reverse() argument" +msgstr "argint reverse()" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Doimhneacht na nglaonna nos m n 'maxfuncdepth'" +msgid "E258: Unable to send to client" +msgstr "E258: N fidir aon rud a sheoladh chuig an chliant" #, c-format -msgid "calling %s" -msgstr "%s glao" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Gnomh neamhbhail: '%s'" -#, c-format -msgid "%s aborted" -msgstr "%s tobscortha" +msgid "sort() argument" +msgstr "argint sort()" -#, c-format -msgid "%s returning #%ld" -msgstr "%s ag aisfhilleadh #%ld" +msgid "uniq() argument" +msgstr "argint uniq()" -#, c-format -msgid "%s returning %s" -msgstr "%s ag aisfhilleadh %s" +msgid "E702: Sort compare function failed" +msgstr "E702: Theip ar fheidhm chomparide le linn srtla" -#, c-format -msgid "continuing in %s" -msgstr "ag leanint i %s" +msgid "E882: Uniq compare function failed" +msgstr "E882: Theip ar fheidhm chomparide Uniq" -msgid "E133: :return not inside a function" -msgstr "E133: Caithfidh :return a bheith isteach i bhfeidhm" +msgid "(Invalid)" +msgstr "(Neamhbhail)" #, c-format -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# athrga comhchoiteanna:\n" +msgid "E935: invalid submatch number: %d" +msgstr "E935: uimhir fho-mheaitsela neamhbhail: %d" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tSocraithe is dana " +msgid "E677: Error writing temp file" +msgstr "E677: Earrid agus comhad sealadach scrobh" -msgid "No old files" -msgstr "Gan seanchomhaid" +msgid "E921: Invalid callback argument" +msgstr "E921: Argint neamhbhail ar aisghlaoch" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" @@ -814,6 +866,10 @@ msgstr " TEIPTHE" msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Nl an comhad Viminfo inscrofa: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: An iomarca comhad sealadach viminfo, mar shampla %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: N fidir comhad viminfo %s a scrobh!" @@ -822,12 +878,15 @@ msgstr "E138: N msgid "Writing viminfo file \"%s\"" msgstr "Comhad viminfo \"%s\" scrobh" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: N fidir ainm %s a chur ar an gcomhad viminfo!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Chruthaigh Vim an comhad viminfo seo %s.\n" -#, c-format msgid "" "# You may edit it if you're careful!\n" "\n" @@ -835,13 +894,19 @@ msgstr "" "# Is fidir leat an comhad seo a chur in eagar ach b cramach!\n" "\n" -#, c-format msgid "# Value of 'encoding' when this file was written\n" msgstr "# Luach 'encoding' agus an comhad seo scrobh\n" msgid "Illegal starting char" msgstr "Carachtar neamhcheadaithe tosaigh" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Barralnte, cipeilte focal ar fhocal:\n" + msgid "Save As" msgstr "Sbhil Mar" @@ -937,8 +1002,9 @@ msgstr " ar l msgid " on %ld lines" msgstr " ar %ld lne" -msgid "E147: Cannot do :global recursive" -msgstr "E147: N cheadatear :global go hathchrsach" +#. will increment global_busy to break out of the loop +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: N cheadatear :global athchrsach le raon" # should have ":" msgid "E148: Regular expression missing from global" @@ -949,6 +1015,9 @@ msgid "Pattern found in every line: %s" msgstr "Aimsodh an patrn i ngach lne: %s" #, c-format +msgid "Pattern not found: %s" +msgstr "Patrn gan aimsi: %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -974,8 +1043,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "T brn orm, comhad cabhrach \"%s\" gan aimsi" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: N comhadlann : %s" +msgid "E151: No match: %s" +msgstr "E151: Gan meaitseil: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -993,6 +1062,10 @@ msgstr "E670: Ionch msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: Clib dhblach \"%s\" i gcomhad %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: N comhadlann : %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: Ord anaithnid comhartha: %s" @@ -1018,10 +1091,17 @@ msgstr "E159: Uimhir chomhartha ar iarraidh" msgid "E158: Invalid buffer name: %s" msgstr "E158: Ainm maolin neamhbhail: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: N fidir lim go maoln gan ainm" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID neamhbhail comhartha: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: N fidir an comhartha a athr: %s" + msgid " (NOT FOUND)" msgstr " (AR IARRAIDH)" @@ -1031,6 +1111,9 @@ msgstr " (n msgid "[Deleted]" msgstr "[Scriosta]" +msgid "No old files" +msgstr "Gan seanchomhaid" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Md dfhabhtaithe thos. Clscrobh \"cont\" chun leanint." @@ -1042,6 +1125,13 @@ msgstr "l msgid "cmd: %s" msgstr "ord: %s" +msgid "frame is zero" +msgstr "is nialas an frma" + +#, c-format +msgid "frame at highest level: %d" +msgstr "frma ag an leibhal is airde: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Brisphointe i \"%s%s\" lne %ld" @@ -1096,8 +1186,16 @@ msgid "Searching for \"%s\"" msgstr "Ag danamh cuardach ar \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "gan aimsi i 'runtimepath': \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "gan aimsi in '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Nl leagan 2.x de Python ar fil; ag danamh neamhaird de %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Nl leagan 3.x de Python ar fil; ag danamh neamhaird de %s" msgid "Source Vim script" msgstr "Foinsigh script Vim" @@ -1126,6 +1224,10 @@ msgstr "l msgid "finished sourcing %s" msgstr "deireadh ag foinsi %s" +#, c-format +msgid "continuing in %s" +msgstr "ag leanint i %s" + msgid "modeline" msgstr "mdlne" @@ -1194,6 +1296,9 @@ msgstr "Raon droim ar ais, babht msgid "E494: Use w or w>>" msgstr "E494: Bain sid as w n w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Caithfear tbla na n-orduithe a nuashonr; rith 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: T brn orm, nl an t-ord ar fil sa leagan seo" @@ -1219,10 +1324,10 @@ msgstr "E174: T msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Ainm Arg Raon Iomln Sainmhni" +" Ainm Arg Seoladh Iomln Sainmhni" msgid "No user-defined commands found" msgstr "Nl aon ord aimsithe at sainithe ag an sideoir" @@ -1242,6 +1347,9 @@ msgstr "E178: Luach r msgid "E179: argument required for -complete" msgstr "E179: t g le hargint i ndiaidh -complete" +msgid "E179: argument required for -addr" +msgstr "E179: t g le hargint i ndiaidh -addr" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Aitreabid neamhbhail: %s" @@ -1254,10 +1362,18 @@ msgstr "" "E183: Caithfidh ceannlitir a bheith ar dts orduithe at sainithe ag an " "sideoir" +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "" +"E841: Ainm in irithe, n fidir a chur ar ord sainithe ag an sideoir" + #, c-format msgid "E184: No such user-defined command: %s" msgstr "E184: Nl a leithid d'ord saincheaptha: %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Cinel neamhbhail seolta: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Luach iomln neamhbhail: %s" @@ -1269,18 +1385,21 @@ msgstr "" msgid "E467: Custom completion requires a function argument" msgstr "E467: T g le hargint fheidhme le comhln saincheaptha" +msgid "unknown" +msgstr "anaithnid" + #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: Scim dathanna %s gan aimsi" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Scim dathanna '%s' gan aimsi" msgid "Greetings, Vim user!" msgstr "Dia duit, a sideoir Vim!" msgid "E784: Cannot close last tab page" -msgstr "E784: N fidir an leathanach cluaisn deiridh a dhnadh" +msgstr "E784: N fidir an leathanach cluaisn deiridh a dhnadh" msgid "Already only one tab page" -msgstr "Nl ach leathanach cluaisn amhin cheana fin" +msgstr "Nl ach leathanach cluaisn amhin cheana fin" msgid "Edit File in new window" msgstr "Cuir comhad in eagar i bhfuinneog nua" @@ -1293,7 +1412,7 @@ msgid "No swap file" msgstr "Nl aon chomhad babhtla ann" msgid "Append File" -msgstr "Cuir Comhad i nDeireadh" +msgstr "Ceangail Comhad ag an Deireadh" msgid "E747: Cannot change directory, buffer is modified (add ! to override)" msgstr "" @@ -1314,10 +1433,13 @@ msgid "Window position: X %d, Y %d" msgstr "Ionad na fuinneoige: X %d, Y %d" msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: N fidir ionad na fuinneoige a fhil amach ar an chras seo" +msgstr "E188: N fidir ionad na fuinneoige a fhil amach ar an gcras seo" msgid "E466: :winpos requires two number arguments" -msgstr "E466: n folir dh argint uimhrila le :winpos" +msgstr "E466: dh argint uimhrila de dhth le :winpos" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: N fidir :redir a sid laistigh de execute()" msgid "Save Redirection" msgstr "Sbhil Atreor" @@ -1369,6 +1491,9 @@ msgstr "" msgid "E498: no :source file name to substitute for \"<sfile>\"" msgstr "E498: nl aon ainm comhaid :source le cur in ionad \"<sfile>\"" +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: nl aon lne-uimhir ar fil le haghaidh \"<slnum>\"" + #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" msgstr "" @@ -1528,6 +1653,9 @@ msgstr "Sloinn:" msgid "Input Line" msgstr "Lne an Ionchuir:" +msgid "Debug Line" +msgstr "Lne Dhfhabhtaithe" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar os cionn fad an ordaithe" @@ -1535,8 +1663,7 @@ msgid "E199: Active window or buffer deleted" msgstr "E199: Scriosadh an fhuinneog reatha n an maoln reatha" msgid "E812: Autocommands changed buffer or buffer name" -msgstr "" -"E812: Bh maoln n ainm maolin athraithe ag orduithe uathoibrocha" +msgstr "E812: Bh maoln n ainm maolin athraithe ag orduithe uathoibrocha" msgid "Illegal file name" msgstr "Ainm comhaid neamhcheadaithe" @@ -1591,9 +1718,6 @@ msgstr "[soic msgid "[character special]" msgstr "[comhad speisialta den chinel carachtar]" -msgid "[RO]" -msgstr "[L-A]" - msgid "[CR missing]" msgstr "[CR ar iarraidh]" @@ -1606,9 +1730,6 @@ msgstr "[N msgid "[converted]" msgstr "[tiontaithe]" -msgid "[crypted]" -msgstr "[criptithe]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[EARRID TIONTAITHE i lne %ld]" @@ -1704,8 +1825,8 @@ msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: earrid le linn scrofa, theip ar thiont ar lne %ld (sid 'fenc' folamh le " -"sr)" +"E513: earrid le linn scrofa, theip ar thiont ar lne %ld (sid 'fenc' " +"folamh le sr)" msgid "E514: write error (file system full?)" msgstr "E514: earrid le linn scrofa (an bhfuil an cras comhaid ln?)" @@ -1783,8 +1904,8 @@ msgid "1 character" msgstr "1 carachtar" #, c-format -msgid "%ld characters" -msgstr "%ld carachtar" +msgid "%lld characters" +msgstr "%lld carachtar" msgid "[noeol]" msgstr "[ganEOL]" @@ -1879,6 +2000,12 @@ msgstr "uathord msgid "E367: No such group: \"%s\"" msgstr "E367: Nl a leithid de ghrpa: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: N fidir an grpa reatha a scriosadh" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Iarracht ar augroup at fs in sid a scriosadh" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Carachtar neamhcheadaithe i ndiaidh *: %s" @@ -1939,10 +2066,6 @@ msgstr "E350: N msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: N fidir filleadh a scriosadh leis an 'foldmethod' reatha" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld lne fillte " - msgid "E222: Add to read buffer" msgstr "E222: Cuir leis an maoln lite" @@ -1974,6 +2097,12 @@ msgstr "N msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Md neamhcheadaithe" +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Norbh fhidir priseas nua a chruth don GUI" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: Theip ar an macphriseas an GUI a thos" + msgid "E229: Cannot start the GUI" msgstr "E229: N fidir an GUI a chur ag obair" @@ -2031,8 +2160,17 @@ msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "" "E232: N fidir BalloonEval a chruth le teachtaireacht agus aisghlaoch araon" -msgid "Vim dialog..." -msgstr "Dialg Vim..." +msgid "_Cancel" +msgstr "_Cealaigh" + +msgid "_Save" +msgstr "_Sbhil" + +msgid "_Open" +msgstr "_Oscail" + +msgid "_OK" +msgstr "_OK" msgid "" "&Yes\n" @@ -2043,6 +2181,12 @@ msgstr "" "&Nl\n" "&Cealaigh" +msgid "Yes" +msgstr "T" + +msgid "No" +msgstr "Nl" + msgid "Input _Methods" msgstr "_Modhanna ionchuir" @@ -2086,11 +2230,14 @@ msgstr "Ionadaigh" msgid "Replace All" msgstr "Ionadaigh Uile" +msgid "_Close" +msgstr "_Dn" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: Fuarthas iarratas \"die\" bhainisteoir an tseisiin\n" -msgid "Close" -msgstr "Dn" +msgid "Close tab" +msgstr "Dn cluaisn" msgid "New tab" msgstr "Cluaisn nua" @@ -2101,9 +2248,6 @@ msgstr "Oscail Cluais msgid "Vim: Main window unexpectedly destroyed\n" msgstr "Vim: Milleadh an promhfhuinneog gan choinne\n" -msgid "Font Selection" -msgstr "Roghn Cl" - msgid "&Filter" msgstr "&Scagaire" @@ -2140,20 +2284,6 @@ msgstr "Ionadaigh &Uile" msgid "&Undo" msgstr "&Cealaigh" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: N fidir teideal na fuinneoige \"%s\" a aimsi" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argint gan tacaocht: \"-%s\"; Bain sid as an leagan OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: N fidir fuinneog a oscailt isteach i bhfeidhmchlr MDI" - -msgid "Close tab" -msgstr "Dn cluaisn" - msgid "Open tab..." msgstr "Oscail cluaisn..." @@ -2171,6 +2301,17 @@ msgstr "Gan msgid "Directory\t*.nothing\n" msgstr "Comhadlann\t*.neamhn\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: N fidir teideal na fuinneoige \"%s\" a aimsi" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argint gan tacaocht: \"-%s\"; Bain sid as an leagan OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: N fidir fuinneog a oscailt isteach i bhfeidhmchlr MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: N fidir iontril dathmhapla a dhileadh, is fidir go mbeidh " @@ -2190,32 +2331,28 @@ msgid "Font '%s' is not fixed-width" msgstr "N cl aonleithid '%s'" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Ainm an tacar cl: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Ainm an tacar cl: %s" #, c-format -msgid "Font0: %s\n" -msgstr "Cl0: %s\n" +msgid "Font0: %s" +msgstr "Cl0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Cl1: %s\n" +msgid "Font1: %s" +msgstr "Cl1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "Nl Cl%ld nos leithne faoi dh n cl0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "Nl Cl%ld nos leithne faoi dh n cl0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Leithead Cl0: %ld\n" +msgid "Font0 width: %ld" +msgstr "Leithead Cl0: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Leithead Cl1: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Leithead cl1: %ld" msgid "Invalid font specification" msgstr "Sonr neamhbhail cl" @@ -2404,6 +2541,9 @@ msgstr "E566: N msgid "E622: Could not fork for cscope" msgstr "E622: Norbh fhidir forc a dhanamh le haghaidh cscope" +msgid "cs_create_connection setpgid failed" +msgstr "theip ar setpgid do cs_create_connection" + msgid "cs_create_connection exec failed" msgstr "theip ar rith cs_create_connection" @@ -2419,15 +2559,15 @@ msgstr "E623: N msgid "E567: no cscope connections" msgstr "E567: nl aon nasc cscope ann" +#, c-format +msgid "E469: invalid cscopequickfix flag %c for %c" +msgstr "E469: bratach neamhbhail cscopequickfix %c le haghaidh %c" + #, c-format msgid "E259: no matches found for cscope query %s of %s" msgstr "" "E259: nor aimsodh aon rud comhoirinach leis an iarratas cscope %s de %s" -#, c-format -msgid "E469: invalid cscopequickfix flag %c for %c" -msgstr "E469: bratach neamhbhail cscopequickfix %c le haghaidh %c" - msgid "cscope commands:\n" msgstr "Orduithe cscope:\n" @@ -2437,6 +2577,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2444,9 +2585,10 @@ msgid "" " g: Find this definition\n" " i: Find files #including this file\n" " s: Find this C symbol\n" -" t: Find assignments to\n" +" t: Find this text string\n" msgstr "" "\n" +" a: Aimsigh ritis sannachin leis an tsiombail seo\n" " c: Aimsigh feidhmeanna a chuireann glaoch ar an bhfeidhm seo\n" " d: Aimsigh feidhmeanna a gcuireann an fheidhm seo glaoch orthu\n" " e: Aimsigh an patrn egrep seo\n" @@ -2454,7 +2596,7 @@ msgstr "" " g: Aimsigh an sainmhni seo\n" " i: Aimsigh comhaid a #include-il an comhad seo\n" " s: Aimsigh an tsiombail C seo\n" -" t: Aimsigh sannta do\n" +" t: Aimsigh an teaghrn tacs seo\n" #, c-format msgid "E625: cannot open cscope database: %s" @@ -2505,12 +2647,25 @@ msgstr "n msgid " # pid database name prepend path\n" msgstr " # pid ainm bunachair conair thosaigh\n" +msgid "Lua library cannot be loaded." +msgstr "N fidir an leabharlann Lua a lucht." + +msgid "cannot save undo information" +msgstr "n fidir eolas cealaithe a shbhil" + msgid "" "E815: Sorry, this command is disabled, the MzScheme libraries could not be " "loaded." msgstr "" -"E815: T brn orm, bh an t-ord seo dchumasaithe, norbh fhidir leabharlanna " -"MzScheme a lucht." +"E815: T brn orm, bh an t-ord seo dchumasaithe, norbh fhidir " +"leabharlanna MzScheme a lucht." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: r leithscal, t an t-ord seo dchumasaithe; norbh fhidir modl " +"racket/base MzScheme a lucht." msgid "invalid expression" msgstr "slonn neamhbhail" @@ -2530,9 +2685,6 @@ msgstr "inn msgid "couldn't open buffer" msgstr "n fidir maoln a oscailt" -msgid "cannot save undo information" -msgstr "n fidir eolas cealaithe a shbhil" - msgid "cannot delete line" msgstr "n fidir an lne a scriosadh" @@ -2545,6 +2697,9 @@ msgstr "n msgid "string cannot contain newlines" msgstr "n cheadatear carachtair lne nua sa teaghrn" +msgid "error converting Scheme values to Vim" +msgstr "earrid agus luach Scheme thiont go Vim" + msgid "Vim error: ~a" msgstr "earrid Vim: ~a" @@ -2563,6 +2718,10 @@ msgstr "l msgid "not allowed in the Vim sandbox" msgstr "n cheadatear seo i mbosca gainimh Vim" +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "" +"E836: N fidir leis an leagan seo de Vim :python a rith tar is :py3 a sid" + msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." @@ -2570,63 +2729,19 @@ msgstr "" "E263: T brn orm, nl an t-ord seo le fil, norbh fhidir an leabharlann " "Python a lucht." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: r leithscal, nl an t-ord seo le fil, norbh fhidir an modl " +"Python a lucht." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: N fidir Python a rith go hathchrsach" -msgid "can't delete OutputObject attributes" -msgstr "n fidir trithe OutputObject a scriosadh" - -msgid "softspace must be an integer" -msgstr "caithfidh softspace a bheith ina shlnuimhir" - -msgid "invalid attribute" -msgstr "aitreabid neamhbhail" - -msgid "writelines() requires list of strings" -msgstr "liosta teaghrn ag teastil writelines()" - -msgid "E264: Python: Error initialising I/O objects" -msgstr "E264: Python: Earrid agus rada I/A dts" - -msgid "attempt to refer to deleted buffer" -msgstr "rinneadh iarracht ar mhaoln scriosta a rochtain" - -msgid "line number out of range" -msgstr "lne-uimhir as raon" - -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<rad maolin (scriosta) ag %p>" - -msgid "invalid mark name" -msgstr "ainm neamhbhail mairc" - -msgid "no such buffer" -msgstr "nl a leithid de mhaoln ann" - -msgid "attempt to refer to deleted window" -msgstr "rinneadh iarracht ar fhuinneog scriosta a rochtain" - -msgid "readonly attribute" -msgstr "trith inlite amhin" - -msgid "cursor position outside buffer" -msgstr "crsir taobh amuigh den mhaoln" - -#, c-format -msgid "<window object (deleted) at %p>" -msgstr "<rad fuinneoige (scriosta) ag %p>" - -#, c-format -msgid "<window object (unknown) at %p>" -msgstr "<rad fuinneoige (anaithnid) ag %p>" - -#, c-format -msgid "<window %d>" -msgstr "<fuinneog %d>" - -msgid "no such window" -msgstr "nl a leithid d'fhuinneog ann" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "" +"E837: N fidir leis an leagan seo de Vim :py3 a rith tar is :python a sid" msgid "E265: $_ must be an instance of String" msgstr "E265: caithfidh $_ a bheith cinel Teaghrin" @@ -2659,95 +2774,6 @@ msgstr "E272: eisceacht gan l msgid "E273: unknown longjmp status %d" msgstr "E273: stdas anaithnid longjmp %d" -msgid "Toggle implementation/definition" -msgstr "Scornaigh feidhmi/sainmhni" - -msgid "Show base class of" -msgstr "Taispein an bunaicme de" - -msgid "Show overridden member function" -msgstr "Taispein ballfheidhm sraithe" - -msgid "Retrieve from file" -msgstr "Aisghabh chomhad" - -msgid "Retrieve from project" -msgstr "Aisghabh thionscadal" - -msgid "Retrieve from all projects" -msgstr "Aisghabh gach tionscadal" - -msgid "Retrieve" -msgstr "Aisghabh" - -msgid "Show source of" -msgstr "Taispein foinse" - -msgid "Find symbol" -msgstr "Aimsigh siombail" - -msgid "Browse class" -msgstr "Brabhsil aicme" - -msgid "Show class in hierarchy" -msgstr "Taispein an aicme in ordlathas" - -msgid "Show class in restricted hierarchy" -msgstr "Taispein an aicme in ordlathas srianta" - -msgid "Xref refers to" -msgstr "Tagraonn Xref do" - -msgid "Xref referred by" -msgstr "Xref tagartha ag" - -msgid "Xref has a" -msgstr "Rud at ag Xref:" - -msgid "Xref used by" -msgstr "Xref sid ag" - -msgid "Show docu of" -msgstr "Taispein eolas faoi" - -msgid "Generate docu for" -msgstr "Gin eolas faoi" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"N fidir nasc a dhanamh le SNiFF+. Seiceil do chuid athrga " -"thimpeallachta (caithfidh t sniffemacs a chur i do $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Earrid sa lamh. Dnasctha" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ stdas faoi lthair: " - -msgid "not " -msgstr "n " - -msgid "connected" -msgstr "nasctha" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Iarratas anaithnid SNiFF+: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Earrid ag nascadh le SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ gan nasc" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: N maoln SNiFF+ " - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Earrid sa scrobh. Dnasctha" - msgid "invalid buffer number" msgstr "uimhir neamhbhail mhaolin" @@ -2758,6 +2784,9 @@ msgstr "n msgid "cannot set line(s)" msgstr "n fidir ln(t)e a shocr" +msgid "invalid mark name" +msgstr "ainm neamhbhail mairc" + msgid "mark not set" msgstr "marc gan socr" @@ -2768,6 +2797,9 @@ msgstr "l msgid "cannot insert/append line" msgstr "n fidir lne a ions/iarcheangal" +msgid "line number out of range" +msgstr "lne-uimhir as raon" + msgid "unknown flag: " msgstr "bratach anaithnid: " @@ -2805,12 +2837,6 @@ msgstr "" "E571: T brn orm, nl an t-ord seo le fil: norbh fhidir an leabharlann " "Tcl a lucht." -msgid "" -"E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "" -"E281: EARRID TCL: nl an cd scortha ina shlnuimhir!? Seol tuairisc fhabht " -"chuig <vim-dev@vim.org> le do thoil" - #, c-format msgid "E572: exit code %d" msgstr "E572: cd scortha %d" @@ -2831,6 +2857,18 @@ msgstr "E573: Aitheantas neamhbhail msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: Air mchumtha sa chlrlann isc VIM. Scriosta!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Eochair dhblach in JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Camg ar iarraidh i Liosta: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: ']' ar iarraidh ag deireadh liosta: %s" + msgid "Unknown option argument" msgstr "Argint anaithnid rogha" @@ -2854,12 +2892,15 @@ msgstr "Arg msgid "%d files to edit\n" msgstr "%d comhad le heagr\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Nor tiomsaodh an leagan Vim seo le `diff' ar fil." +msgid "netbeans is not supported with this GUI\n" +msgstr "N thacatear le netbeans sa GUI seo\n" msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "N fidir '-nb' a sid: nor cumasaodh ag am tiomsaithe\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Nor tiomsaodh an leagan Vim seo le `diff' ar fil." + msgid "Attempt to open script file again: \"" msgstr "Dan iarracht ar oscailt na scripte ars: \"" @@ -2872,6 +2913,10 @@ msgstr "N msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: Earrid: Theip ar thos gvim NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "" +"Vim: Earrid: N fidir an leagan seo de Vim a rith i dteirminal Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Rabhadh: Nl an t-aschur ag dul chuig teirminal\n" @@ -2965,6 +3010,9 @@ msgstr "-v\t\t\tM msgid "-e\t\t\tEx mode (like \"ex\")" msgstr "-e\t\t\tMd Ex (mar \"ex\")" +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tMd Ex feabhsaithe" + msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" msgstr "-s\t\t\tMd ciin (baiscphrisela) (do \"ex\" amhin)" @@ -3035,6 +3083,14 @@ msgstr "-F\t\t\tTosaigh sa mh msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <teirminal>\tSocraigh cinel teirminal" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "" +"--not-a-term\t\tN bac le rabhadh faoi ionchur/aschur gan a bheith n " +"teirminal" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tScoir mura bhfuil ionchur agus aschur ina dteirminil" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tsid <vimrc> in ionad aon .vimrc" @@ -3045,7 +3101,7 @@ msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tN luchtaigh breisein" msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tOscail N leathanach cluaisn (default: ceann do gach comhad)" +msgstr "-p[N]\t\tOscail N leathanach cluaisn (default: ceann do gach comhad)" msgid "-o[N]\t\tOpen N windows (default: one for each file)" msgstr "-o[N]\t\tOscail N fuinneog (ramhshocr: ceann do gach comhad)" @@ -3131,7 +3187,9 @@ msgid "--servername <name>\tSend to/become the Vim server <name>" msgstr "--servername <ainm>\tSeol chuig/Tigh i do fhreastala Vim <ainm>" msgid "--startuptime <file>\tWrite startup timing messages to <file>" -msgstr "--startuptime <comhad>\tScrobh faisnis maidir le trimhse tosaithe i <comhad>" +msgstr "" +"--startuptime <comhad>\tScrobh faisnis maidir le trimhse tosaithe i " +"<comhad>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tsid <viminfo> in ionad .viminfo" @@ -3169,12 +3227,6 @@ msgstr "-display <sc msgid "-iconic\t\tStart vim iconified" msgstr "-iconic\t\tTosaigh vim sa mhd oslaghdaithe" -msgid "-name <name>\t\tUse resource as if vim was <name>" -msgstr "-name <ainm>\t\tsid acmhainn mar a bheadh vim <ainm>" - -msgid "\t\t\t (Unimplemented)\n" -msgstr "\t\t\t (Nl ar fil)\n" - msgid "-background <color>\tUse <color> for the background (also: -bg)" msgstr "-background <dath>\tBain sid as <dath> don chlra (-bg fosta)" @@ -3217,19 +3269,6 @@ msgstr "+reverse\t\tN msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <acmhainn>\tSocraigh an acmhainn sainithe" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"Argint ar eolas do gvim (leagan RISC OS):\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <uimhir>\tLeithead fuinneoige i dtosach (colin)" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <uimhir>\tAirde fhuinneoige i dtosach (rnna)" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" @@ -3246,6 +3285,9 @@ msgstr "--role <r msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\tOscail Vim isteach i ngiuirlid GTK eile" +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tTaispenann gvim aitheantas na fuinneoige ar stdout" + msgid "-P <parent title>\tOpen Vim inside parent application" msgstr "-P <mthairchlr>\tOscail Vim isteach sa mhthairchlr" @@ -3304,7 +3346,6 @@ msgstr "" "\n" "athr lne col tacs" -#, c-format msgid "" "\n" "# File marks:\n" @@ -3313,7 +3354,6 @@ msgstr "" "# Marcanna comhaid:\n" #. Write the jumplist with -' -#, c-format msgid "" "\n" "# Jumplist (newest first):\n" @@ -3321,7 +3361,6 @@ msgstr "" "\n" "# Liosta limeanna (is nua i dtosach):\n" -#, c-format msgid "" "\n" "# History of marks within files (newest to oldest):\n" @@ -3353,17 +3392,6 @@ msgstr "E288: N msgid "E289: input method doesn't support my preedit type" msgstr "E289: n thacaonn an modh ionchuir mo chinel ramheagair" -msgid "E290: over-the-spot style requires fontset" -msgstr "E290: tacar cl ag teastil stl thar-an-spota" - -msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -msgstr "" -"E291: T an GTK+ at agat nos sine n leagan 1.2.3. Dchumasatear an " -"limistar stdais" - -msgid "E292: Input Method Server is not running" -msgstr "E292: Nl an Freastala Mhodh Ionchuir ag rith" - msgid "E293: block was not locked" msgstr "E293: n raibh an bloc faoi ghlas" @@ -3391,6 +3419,9 @@ msgstr "E298: N msgid "E298: Didn't get block nr 2?" msgstr "E298: N bhfuarthas bloc a d?" +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Earrid agus cripti an chomhaid bhabhtla nuashonr" + #. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: ps, cailleadh an comhad babhtla!!!" @@ -3426,7 +3457,7 @@ msgid "" "Maybe no changes were made or Vim did not update the swap file." msgstr "" "\n" -"B'fhidir nach raibh aon athr dhanamh, n t an comhad\n" +"B'fhidir nach raibh aon athr dhanamh, n t an comhad " "babhtla as dta." msgid " cannot be used with this version of Vim.\n" @@ -3452,6 +3483,12 @@ msgstr "" ",\n" "is sin n rinneadh dochar don chomhad." +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "" +"E833: t %s criptithe agus n thacaonn an leagan seo de Vim le cripti" + msgid " has been damaged (page size is smaller than minimum value).\n" msgstr " rinneadh dochar d (mid an leathanaigh nos l n an osmhid).\n" @@ -3466,6 +3503,40 @@ msgstr "Comhad bun msgid "E308: Warning: Original file may have been changed" msgstr "E308: Rabhadh: Is fidir gur athraodh an comhad bunsach" +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "T an comhad babhtla criptithe: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "" +"\n" +"M chuir t eochair nua chriptichin isteach, ach mura scrobh t an " +"tacschomhad," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "" +"\n" +"cuir isteach an eochair nua chriptichin." + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "" +"\n" +"M scrobh t an tacschomhad tar is duit an eochair chriptichn a athr, " +"brigh Enter" + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "" +"\n" +"chun an eochair channa a sid don tacschomhad agus an comhad babhtla" + #, c-format msgid "E309: Unable to read block 1 from %s" msgstr "E309: N fidir bloc a haon a lamh %s" @@ -3520,17 +3591,26 @@ msgstr "" "\n" "(B'fhidir gur mian leat an comhad seo a shbhil de rir ainm eile\n" -msgid "and run diff with the original file to check for changes)\n" +msgid "and run diff with the original file to check for changes)" +msgstr "agus dan comparid leis an mbunchomhad chun athruithe a lorg)" + +msgid "Recovery completed. Buffer contents equals file contents." msgstr "" -"agus dan comparid leis an chomhad bhunsach (m.sh. le `diff') chun " -"athruithe a scrd)\n" +"Athshln crochnaithe. Is ionann an t-bhar sa mhaoln agus an t-bhar sa " +"chomhad." msgid "" -"Delete the .swp file afterwards.\n" +"\n" +"You may want to delete the .swp file now.\n" "\n" msgstr "" -"Scrios an comhad .swp tar is sin.\n" "\n" +"B'fhidir gur mhaith leat an comhad .swp a scriosadh anois.\n" +"\n" + +msgid "Using crypt key from swap file for the text file.\n" +msgstr "" +"Eochair chriptichin n gcomhad babhtla hsid ar an tacschomhad.\n" #. use msg() to start the scrolling properly msgid "Swap files found:" @@ -3706,25 +3786,17 @@ msgstr " N #. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Is fidir go bhfuil clr eile ag rochtain an comhad seo.\n" -" Ms ea, b cramach nach bhfuil dh leagan den chomhad\n" -" canna.\n" - -msgid " Quit, or continue with caution.\n" -msgstr " Scoir, n lean ar aghaidh go hairdeallach.\n" +"(1) Seans go bhfuil an comhad seo chur in eagar ag clr eile. M t,\n" +" b cramach nach bhfuil dh leagan den chomhad canna agat nuair\n" +" a athraonn t . Scoir anois, n lean ort go faichilleach.\n" -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) Rinne Vim thobscor agus an comhad seo\n" -" idir lmha agat.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) Thuairteil seisin eagarthireachta.\n" msgid " If this is the case, use \":recover\" or \"vim -r " msgstr " Ms amhlaidh, bain sid as \":recover\" n \"vim -r " @@ -3951,14 +4023,6 @@ msgstr " (Idirbhriste)" msgid "Beep!" msgstr "Bp!" -msgid "Vim: preserving files...\n" -msgstr "Vim: comhaid gcaomhn...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Crochnaithe.\n" - -#, c-format msgid "ERROR: " msgstr "EARRID: " @@ -4008,14 +4072,8 @@ msgstr "E548: ag s msgid "E549: Illegal percentage" msgstr "E549: Catadn neamhcheadaithe" -msgid "Enter encryption key: " -msgstr "Iontril eochair chriptichin: " - -msgid "Enter same key again: " -msgstr "Iontril an eochair ars: " - -msgid "Keys don't match!" -msgstr "Nl na heochracha comhoirinach le chile!" +msgid "E854: path too long for completion" +msgstr "E854: conair rfhada le comhln" #, c-format msgid "" @@ -4041,25 +4099,23 @@ msgstr "E346: N msgid "E347: No more file \"%s\" found in path" msgstr "E347: Nl comhad \"%s\" sa chonair a thuilleadh" -msgid "Cannot connect to Netbeans #2" -msgstr "N fidir nascadh le Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "N fidir nascadh le Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "E668: Md mcheart rochtana ar an chomhad eolas naisc NetBeans: \"%s\"" -msgid "read from Netbeans socket" -msgstr "ladh shoicad Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Cailleadh nasc NetBeans le haghaidh maolin %ld" -msgid "E505: " -msgstr "E505: " +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: N thacatear le netbeans sa GUI seo" + +msgid "E511: netbeans already connected" +msgstr "E511: T netbeans ceangailte cheana" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: T %s inlite amhin (cuir ! leis chun sr)" msgid "E349: No identifier under cursor" msgstr "E349: Nl aitheantir faoin chrsir" @@ -4088,8 +4144,8 @@ msgstr "E662: Ag tosach liosta na n-athruithe" msgid "E663: At end of changelist" msgstr "E663: Ag deireadh liosta na n-athruithe" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Clscrobh :quit<Enter> chun Vim a scor" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "Clscrobh :qa! agus brigh <Enter> le fgil Vim gan athruithe a shbhil" # ouch - English -ed ? #, c-format @@ -4169,7 +4225,6 @@ msgstr "" msgid "Illegal register name" msgstr "Ainm neamhcheadaithe tabhaill" -#, c-format msgid "" "\n" "# Registers:\n" @@ -4181,33 +4236,40 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Cinel anaithnid tabhaill %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: n cheadatear nos m n lne amhin i bpatrn cuardaigh n sa " +"slonntabhall" + #, c-format msgid "%ld Cols; " msgstr "%ld Coln; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Roghnaodh %s%ld as %ld Lne; %ld as %ld Focal; %ld as %ld Beart" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Roghnaodh %s%ld as %ld Lne; %lld as %lld Focal; %lld as %lld Beart" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"Roghnaodh %s%ld as %ld Lne; %ld as %ld Focal; %ld as %ld Carachtar; %ld as " -"%ld Beart" +"Roghnaodh %s%ld as %ld Lne; %lld as %lld Focal; %lld as %lld Carachtar; " +"%lld as %lld Beart" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Col %s as %s; Lne %ld as %ld; Focal %ld as %ld; Beart %ld as %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Col %s as %s; Lne %ld as %ld; Focal %lld as %lld; Beart %lld as %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Col %s as %s; Lne %ld as %ld; Focal %ld as %ld; Carachtar %ld as %ld; Beart " -"%ld as %ld" +"Col %s as %s; Lne %ld as %ld; Focal %lld as %lld; Carachtar %lld as %lld; " +"Beart %lld as %lld" #, c-format msgid "(+%ld for BOM)" @@ -4228,6 +4290,9 @@ msgstr "E519: N msgid "E520: Not allowed in a modeline" msgstr "E520: N cheadaithe i mdlne" +msgid "E846: Key code not set" +msgstr "E846: Cd eochrach gan socr" + msgid "E521: Number required after =" msgstr "E521: T g le huimhir i ndiaidh =" @@ -4238,6 +4303,10 @@ msgstr "E522: Gan aimsi msgid "E539: Illegal character <%s>" msgstr "E539: Carachtar neamhcheadaithe <%s>" +#, c-format +msgid "For option %s" +msgstr "Le haghaidh rogha %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: N fidir 'term' a shocr mar theaghrn folamh" @@ -4250,6 +4319,12 @@ msgstr "E531: msgid "E589: 'backupext' and 'patchmode' are equal" msgstr "E589: is ionann iad 'backupext' agus 'patchmode'" +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: Tagann s salach ar luach de 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: Tagann s salach ar luach de 'fillchars'" + msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: N fidir a athr sa GUI GTK+ 2" @@ -4429,9 +4504,6 @@ msgstr "EARR msgid "Message" msgstr "Teachtaireacht" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "n 80 'columns', n fidir orduithe seachtracha a rith" - msgid "E237: Printer selection failed" msgstr "E237: Theip ar roghn printara" @@ -4458,19 +4530,12 @@ msgstr "" "\"%s\"" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Carachtar neamhcheadaithe '%c' mar phirt d'ainm cl \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: Comhartha dbailte, ag scor\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: Fuarthas comhartha marfach %s\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Ainm neamhcheadaithe ar chilocht \"%s\" in ainm cl \"%s\"" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: Fuarthas comhartha marfach\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Carachtar neamhcheadaithe '%c' mar phirt d'ainm cl \"%s\"" #, c-format msgid "Opening the X display took %ld msec" @@ -4503,12 +4568,14 @@ msgstr "" "\n" "Norbh fhidir comhthacs slndla a shocr le haghaidh " -msgid "" -"\n" -"Cannot execute shell " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Norbh fhidir comhthacs slndla %s a shocr le haghaidh %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" msgstr "" -"\n" -"N fidir blaosc a rith " +"Norbh fhidir comhthacs slndla %s a fhil le haghaidh %s. bhaint!" msgid "" "\n" @@ -4539,6 +4606,13 @@ msgstr "" "\n" "N fidir forc a dhanamh\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"N fidir blaosc a rith " + msgid "" "\n" "Command terminated\n" @@ -4581,10 +4655,6 @@ msgstr "Earr msgid "Could not fix up function pointers to the DLL!" msgstr "Norbh fhidir pointeoir feidhme a chiri i gcomhair an DLL!" -#, c-format -msgid "shell returned %d" -msgstr "d'aisfhill an bhlaosc %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Fuarthas teagmhas %s\n" @@ -4613,6 +4683,10 @@ msgstr "" msgid "Vim Warning" msgstr "Rabhadh Vim" +#, c-format +msgid "shell returned %d" +msgstr "d'aisfhill an bhlaosc %d" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: An iomarca %%%c i dteaghrn formide" @@ -4636,6 +4710,7 @@ msgstr "E376: %%%c neamhbhail msgid "E377: Invalid %%%c in format string" msgstr "E377: %%%c neamhbhail i dteaghrn formide" +#. nothing found msgid "E378: 'errorformat' contains no pattern" msgstr "E378: Nl aon phatrn i 'errorformat'" @@ -4645,6 +4720,15 @@ msgstr "E379: Ainm comhadlainne ar iarraidh, n msgid "E553: No more items" msgstr "E553: Nl aon mhr eile" +msgid "E924: Current window was closed" +msgstr "E924: Dnadh an fhuinneog reatha" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Athraodh an mearcheartchn reatha" + +msgid "E926: Current location list was changed" +msgstr "E926: Athraodh an liosta suomh reatha" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d as %d)%s%s: " @@ -4652,19 +4736,25 @@ msgstr "(%d as %d)%s%s: " msgid " (line deleted)" msgstr " (lne scriosta)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sliosta earrid %d as %d; %d earrid " + msgid "E380: At bottom of quickfix stack" -msgstr "E380: In ochtar na cruaiche quickfix" +msgstr "E380: In ochtar chruach na mearcheartchn" msgid "E381: At top of quickfix stack" -msgstr "E381: In uachtar na cruaiche quickfix" +msgstr "E381: In uachtar chruach na mearcheartchn" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "liosta earrid %d as %d; %d earrid" +msgid "No entries" +msgstr "Gan iontril" msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: N fidir scrobh, rogha 'buftype' socraithe" +msgid "Error file" +msgstr "Comhad earride" + msgid "E683: File name missing or invalid pattern" msgstr "E683: Ainm comhaid ar iarraidh, n patrn neamhbhail" @@ -4682,18 +4772,15 @@ msgstr "E777: Bh msgid "E369: invalid item in %s%%[]" msgstr "E369: mr neamhbhail i %s%%[]" -msgid "E339: Pattern too long" -msgstr "E339: Slonn rfhada" - -msgid "E50: Too many \\z(" -msgstr "E50: an iomarca \\z(" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: an iomarca %s(" +msgid "E769: Missing ] after %s[" +msgstr "E769: ] ar iarraidh i ndiaidh %s[" -msgid "E52: Unmatched \\z(" -msgstr "E52: \\z( corr" +msgid "E944: Reverse range in character class" +msgstr "E944: Raon aisiompaithe in aicme carachtar" + +msgid "E945: Range too large in character class" +msgstr "E945: Raon rmhr in aicme carachtar" #, c-format msgid "E53: Unmatched %s%%(" @@ -4707,48 +4794,61 @@ msgstr "E54: %s( corr" msgid "E55: Unmatched %s)" msgstr "E55: %s) corr" -#, c-format -msgid "E59: invalid character after %s@" -msgstr "E59: carachtar neamhbhail i ndiaidh %s@" +msgid "E66: \\z( not allowed here" +msgstr "E66: n cheadatear \\z( anseo" -#, c-format -msgid "E60: Too many complex %s{...}s" -msgstr "E60: An iomarca %s{...} coimplascach" +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: n cheadatear \\z1 et al. anseo" #, c-format -msgid "E61: Nested %s*" -msgstr "E61: %s* neadaithe" +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ] ar iarraidh i ndiaidh %s%%[" #, c-format -msgid "E62: Nested %s%c" -msgstr "E62: %s%c neadaithe" - -msgid "E63: invalid use of \\_" -msgstr "E63: sid neamhbhail de \\_" - -#, c-format -msgid "E64: %s%c follows nothing" -msgstr "E64: nl aon rud roimh %s%c" +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] folamh" msgid "E65: Illegal back reference" msgstr "E65: Cltagairt neamhbhail" -msgid "E66: \\z( not allowed here" -msgstr "E66: n cheadatear \\z( anseo" +msgid "E339: Pattern too long" +msgstr "E339: Slonn rfhada" -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: n cheadatear \\z1 et al. anseo" +msgid "E50: Too many \\z(" +msgstr "E50: an iomarca \\z(" -msgid "E68: Invalid character after \\z" -msgstr "E68: Carachtar neamhbhail i ndiaidh \\z" +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: an iomarca %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: \\z( corr" #, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: ] ar iarraidh i ndiaidh %s%%[" +msgid "E59: invalid character after %s@" +msgstr "E59: carachtar neamhbhail i ndiaidh %s@" #, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[] folamh" +msgid "E60: Too many complex %s{...}s" +msgstr "E60: An iomarca %s{...} coimplascach" + +#, c-format +msgid "E61: Nested %s*" +msgstr "E61: %s* neadaithe" + +#, c-format +msgid "E62: Nested %s%c" +msgstr "E62: %s%c neadaithe" + +msgid "E63: invalid use of \\_" +msgstr "E63: sid neamhbhail de \\_" + +#, c-format +msgid "E64: %s%c follows nothing" +msgstr "E64: nl aon rud roimh %s%c" + +msgid "E68: Invalid character after \\z" +msgstr "E68: Carachtar neamhbhail i ndiaidh \\z" #, c-format msgid "E678: Invalid character after %s%%[dxouU]" @@ -4758,10 +4858,6 @@ msgstr "E678: Carachtar neamhbhail msgid "E71: Invalid character after %s%%" msgstr "E71: Carachtar neamhbhail i ndiaidh %s%%" -#, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: ] ar iarraidh i ndiaidh %s[" - #, c-format msgid "E554: Syntax error in %s{...}" msgstr "E554: Earrid chomhrire i %s{...}" @@ -4769,6 +4865,96 @@ msgstr "E554: Earr msgid "External submatches:\n" msgstr "Fo-mheaitseil sheachtrach:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (slonn NFA) n fidir %s a athdhanamh" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: N cheadatear ach 0, 1, n 2 tar is \\%#=. sidfear an t-inneall " +"uathoibroch " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "" +"Ag athr go dt an t-inneall rianaithe siar le haghaidh an phatrin seo: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Thngthas ar dheireadh an tsloinn gan sil leis" + +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (slonn NFA) %c as it" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (slonn NFA) Aicme carachtar neamhbhail: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Oibreoir anaithnid '\\z%c'" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Oibreoir anaithnid '\\%%%c'" + +#. should never happen +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Earrid agus NFA thgil le haicme coibhise!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Oibreoir anaithnid '\\@%c'" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (slonn NFA) Earrid agus teorainneacha athdhanta lamh" + +#. Can't have a multi follow a multi. +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (slonn NFA) N cheadatear ilchodach tar is ilchodach!" + +#. Too many `(' +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (slonn NFA) An iomarca '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (slonn NFA) An iomarca \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (slonn NFA) crochn neamhoirinach" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) Norbh fhidir an chruach a phlobadh!" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (slonn NFA) (Le linn tiontaithe postfix go NFA), an iomarca " +"staideanna fgtha ar an gcruach" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (slonn NFA) Nl go leor spis ann don NFA iomln " + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "" +"E878: (NFA) Norbh fhidir cuimhne a leithdhileadh leis an gcraobh a " +"thrasnal!" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Norbh fhidir logchomhad sealadach a oscailt le scrobh ann, thaispeint " +"ar stderr..." + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) NORBH FHIDIR %s A OSCAILT!" + +msgid "Could not open temporary log file for writing " +msgstr "Norbh fhidir logchomhad sealadach a oscailt le scrobh ann " + msgid " VREPLACE" msgstr " V-IONADAIGH" @@ -4796,9 +4982,6 @@ msgstr " Eabhrais" msgid " Arabic" msgstr " Araibis" -msgid " (lang)" -msgstr " (teanga)" - msgid " (paste)" msgstr " (greamaigh)" @@ -4894,8 +5077,49 @@ msgstr "" "# %sPatrn Cuardaigh Is Dana:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Earrid fhormide i gcomhad litrithe" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Nl seiceil litrithe cumasaithe" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Rabhadh: N fidir liosta focal \"%s_%s.spl\" n \"%s_ascii.spl\" a aimsi" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Rabhadh: N fidir liosta focal \"%s.%s.spl\" n \"%s.ascii.spl\" a aimsi" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: Scrios uathord SpellFileMissing an maoln" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Rabhadh: rigin %s gan tacaocht" + +msgid "Sorry, no suggestions" +msgstr "T brn orm, nl aon mholadh ann" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "T brn orm, nl ach %ld moladh ann" + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Athraigh \"%.*s\" go:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Nl aon ionada litrithe roimhe seo" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Gan aimsi: %s" msgid "E758: Truncated spell file" msgstr "E758: Comhad teasctha litrithe" @@ -4917,14 +5141,6 @@ msgstr "E762: Carachtar i FOL, LOW n msgid "Compressing word tree..." msgstr "Crann focal chomhbhr..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Nl seiceil litrithe cumasaithe" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"Rabhadh: N fidir liosta focal \"%s.%s.spl\" n \"%s.ascii.spl\" a aimsi" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Comhad litrithe \"%s\" lamh" @@ -4942,8 +5158,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Rannn gan tacaocht i gcomhad litrithe" #, c-format -msgid "Warning: region %s not supported" -msgstr "Rabhadh: rigin %s gan tacaocht" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Nl s cosil le comhad .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Seanchomhad .sug, t g lena nuashonr: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Oibronn an comhad .sug le leagan nos nua de Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Nl an comhad .sug comhoirinach leis an gcomhad .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: earrid agus comhad .sug lamh: %s" #, c-format msgid "Reading affix file %s ..." @@ -5146,6 +5378,9 @@ msgstr "Bratacha anaithnide i %s l msgid "Ignored %d words with non-ASCII characters" msgstr "Rinneadh neamhshuim ar %d focal le carachtair neamh-ASCII" +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Easpa cuimhne, beidh an liosta focal neamhiomln" + #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" msgstr "Comhbhrdh %d as %d nd; %d (%d%%) fgtha" @@ -5201,76 +5436,56 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: nl %ld iontril i 'spellfile'" #, c-format -msgid "Word removed from %s" -msgstr "Baineadh focal %s" +msgid "Word '%.*s' removed from %s" +msgstr "Baineadh focal '%.*s' %s" #, c-format -msgid "Word added to %s" -msgstr "Cuireadh focal le %s" +msgid "Word '%.*s' added to %s" +msgstr "Cuireadh focal '%.*s' le %s" msgid "E763: Word characters differ between spell files" msgstr "E763: T carachtair dhifrila fhocail sna comhaid litrithe" -msgid "Sorry, no suggestions" -msgstr "T brn orm, nl aon mholadh ann" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "T brn orm, nl ach %ld moladh ann" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Athraigh \"%.*s\" go:" +#. This should have been checked when generating the .spl +#. * file. +msgid "E783: duplicate char in MAP entry" +msgstr "E783: carachtar dblach in iontril MAP" -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr "Nl aon mhr chomhrire sainmhnithe le haghaidh an mhaolin seo" -msgid "E752: No previous spell replacement" -msgstr "E752: Nl aon ionada litrithe roimhe seo" +msgid "syntax conceal on" +msgstr "syntax conceal on" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Gan aimsi: %s" +msgid "syntax conceal off" +msgstr "syntax conceal off" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Nl s cosil le comhad .sug: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: Argint neamhcheadaithe: %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Seanchomhad .sug, t g lena nuashonr: %s" +msgid "syntax case ignore" +msgstr "syntax case ignore" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Oibronn an comhad .sug le leagan nos nua de Vim: %s" +msgid "syntax case match" +msgstr "syntax case match" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Nl an comhad .sug comhoirinach leis an gcomhad .spl: %s" +msgid "syntax spell toplevel" +msgstr "syntax spell toplevel" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: earrid agus comhad .sug lamh: %s" +msgid "syntax spell notoplevel" +msgstr "syntax spell notoplevel" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: carachtar dblach in iontril MAP" +msgid "syntax spell default" +msgstr "syntax spell default" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: Argint neamhcheadaithe: %s" +msgid "syntax iskeyword " +msgstr "syntax iskeyword " #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Nl a leithid de mhogall comhrire: %s" -msgid "No Syntax items defined for this buffer" -msgstr "Nl aon mhr chomhrire sainmhnithe le haghaidh an mhaolin seo" - msgid "syncing on C-style comments" msgstr "ag sioncrn ar nta den ns C" @@ -5323,8 +5538,8 @@ msgstr " bristeacha l msgid "E395: contains argument not accepted here" msgstr "E395: t argint ann nach nglactar leis anseo" -msgid "E396: containedin argument not accepted here" -msgstr "E396: n ghlactar leis an argint containedin anseo" +msgid "E844: invalid cchar value" +msgstr "E844: luach neamhbhail cchar" msgid "E393: group[t]here not accepted here" msgstr "E393: n ghlactar le group[t]here anseo" @@ -5336,10 +5551,17 @@ msgstr "E394: N msgid "E397: Filename required" msgstr "E397: T g le hainm comhaid" +msgid "E847: Too many syntax includes" +msgstr "E847: An iomarca comhad comhrire in sid" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ']' ar iarraidh: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: carachtar tar is ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' ar iarraidh: %s" @@ -5348,6 +5570,9 @@ msgstr "E398: '=' ar iarraidh: %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Nl go leor argint ann: rigin comhrire %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: An iomarca mogall comhrire" + msgid "E400: No cluster specified" msgstr "E400: Nor sonraodh mogall" @@ -5390,6 +5615,11 @@ msgstr "E409: Ainm anaithnid gr msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Fo-ord neamhbhail :syntax: %s" +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" IOMLN LON MEAITS IS MOILLE MEN AINM PATRN" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: lb athchrsach agus syncolor.vim lucht" @@ -5452,6 +5682,9 @@ msgstr "E669: Carachtar neamhghrafach in ainm gr msgid "W18: Invalid character in group name" msgstr "W18: Carachtar neamhbhail in ainm grpa" +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: An iomarca grpa aibhsithe agus comhrire" + msgid "E555: at bottom of tag stack" msgstr "E555: in ochtar na cruaiche clibeanna" @@ -5512,6 +5745,9 @@ msgstr "Comhad clibeanna %s msgid "E430: Tag file path truncated for %s\n" msgstr "E430: Teascadh conair an chomhaid clibeanna le haghaidh %s\n" +msgid "Ignoring long line in tags file" +msgstr "Ag danamh neamhaird de lne fhada sa chomhad clibeanna" + #, c-format msgid "E431: Format error in tags file \"%s\"" msgstr "E431: Earrid fhormide i gcomhad clibeanna \"%s\"" @@ -5528,15 +5764,16 @@ msgstr "E432: Comhad clibeanna gan s msgid "E433: No tags file" msgstr "E433: Nl aon chomhad clibeanna" -msgid "Ignoring long line in tags file" -msgstr "Ag danamh neamhaird de lne fhada sa chomhad clibeanna" - msgid "E434: Can't find tag pattern" msgstr "E434: Patrn clibe gan aimsi" msgid "E435: Couldn't find tag, just guessing!" msgstr "E435: Clib gan aimsi, ag tabhairt buille faoi thuairim!" +#, c-format +msgid "Duplicate field name: %s" +msgstr "Ainm rimse dbailte: %s" + msgid "' not known. Available builtin terminals are:" msgstr "' anaithnid. Is iad seo na teirminil insuite:" @@ -5567,6 +5804,9 @@ msgstr "" "\n" "--- Eochracha teirminil ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "N fidir $VIMRUNTIME/rgb.txt a oscailt" + msgid "new shell started\n" msgstr "tosaodh blaosc nua\n" @@ -5576,43 +5816,117 @@ msgstr "Vim: Earr msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "sideadh CUT_BUFFER0 in ionad roghnchin folaimh" +#. This happens when the FileChangedRO autocommand changes the +#. * file in a way it becomes shorter. +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Athraodh lon na lnte gan sil leis" + #. must display the prompt msgid "No undo possible; continue anyway" msgstr "N fidir a cheal; lean ar aghaidh mar sin fin" -msgid "Already at oldest change" -msgstr "Ag an athr is sine cheana" - -msgid "Already at newest change" -msgstr "Ag an athr is nua cheana" +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: N fidir comhad staire a oscailt le scrobh ann: %s" #, c-format -msgid "Undo number %ld not found" -msgstr "Nor aimsodh ceal uimhir a %ld" +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: Comhad staire truaillithe (%s): %s" -msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: lne-uimhreacha mchearta" +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "N fidir comhad staire a shbhil in aon chomhadlann in 'undodir'" -msgid "more line" -msgstr "lne eile" +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "N forscrobhfar le comhad staire, n fidir a lamh: %s" -msgid "more lines" -msgstr "lne eile" +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "N forscrobhfar , n comhad staire seo: %s" -msgid "line less" -msgstr "lne nos l" +msgid "Skipping undo file write, nothing to undo" +msgstr "N scrobhfar an comhad staire, nl aon stair ann" -msgid "fewer lines" -msgstr "lne nos l" +#, c-format +msgid "Writing undo file: %s" +msgstr "Comhad staire scrobh: %s" -msgid "change" -msgstr "athr" +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: earrid le linn scrofa i gcomhad staire: %s" -msgid "changes" -msgstr "athr" +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "Nor ladh an comhad staire; inir difriil: %s" #, c-format -msgid "%ld %s; %s #%ld %s" +msgid "Reading undo file: %s" +msgstr "Comhad staire lamh: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: N fidir an comhad staire a oscailt lena lamh: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: N comhad staire : %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "E832: Comhad neamhchriptithe le comhad staire criptithe: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Norbh fhidir an comhad staire a dhchripti: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: T an comhad staire criptithe: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Comhad staire neamh-chomhoirinach: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "Athraodh bhar an chomhaid, n fidir comhad staire a sid" + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Comhad staire %s lite" + +msgid "Already at oldest change" +msgstr "Ag an athr is sine cheana" + +msgid "Already at newest change" +msgstr "Ag an athr is nua cheana" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: Mr staire %ld gan aimsi" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: lne-uimhreacha mchearta" + +msgid "more line" +msgstr "lne eile" + +msgid "more lines" +msgstr "lne eile" + +msgid "line less" +msgstr "lne nos l" + +msgid "fewer lines" +msgstr "lne nos l" + +msgid "change" +msgstr "athr" + +msgid "changes" +msgstr "athr" + +#, c-format +msgid "%ld %s; %s #%ld %s" msgstr "%ld %s; %s #%ld %s" msgid "before" @@ -5624,9 +5938,8 @@ msgstr "tar msgid "Nothing to undo" msgstr "Nl faic le ceal" -# columns? -msgid "number changes time" -msgstr "uimhir athruithe am" +msgid "number changes when saved" +msgstr "athraonn an uimhir ag am sbhla" #, c-format msgid "%ld seconds ago" @@ -5641,13 +5954,136 @@ msgstr "E439: t msgid "E440: undo line missing" msgstr "E440: lne chealaithe ar iarraidh" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: T feidhm %s ann cheana, cuir ! leis an ord chun a asiti" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: T an iontril foclra seo ann cheana" + +msgid "E718: Funcref required" +msgstr "E718: T g le Funcref" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Feidhm anaithnid: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Argint neamhcheadaithe: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Argint dhbailte: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: An iomarca argint d'fheidhm %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Argint neamhbhail d'fheidhm %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Doimhneacht na nglaonna nos m n 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "%s glao" + +#, c-format +msgid "%s aborted" +msgstr "%s tobscortha" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s ag aisfhilleadh #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s ag aisfhilleadh %s" + +msgid "E699: Too many arguments" +msgstr "E699: An iomarca argint" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Feidhm anaithnid: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Scriosadh an fheidhm: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Nl go leor feidhmeanna d'fheidhm: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> sid ach gan a bheith i gcomhthacs scripte: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Feidhm 'dict' ghlao gan Foclir: %s" + +msgid "E129: Function name required" +msgstr "E129: T g le hainm feidhme" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" msgstr "" -"\n" -"Leagan GUI 16/32 giotn MS-Windows" +"E128: Caithfidh ceannlitir a bheith ar dts ainm feidhme, n \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: N cheadatear idirstad in ainm feidhme: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Feidhm gan sainmhni: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(' ar iarraidh: %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: N fidir g: a sid anseo" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: N mr don chlabhsr a bheith ag an mbarrleibhal: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction ar iarraidh" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Aimsodh tacs tar is :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Tagann ainm na feidhme salach ar athrg: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "" +"E127: N fidir sainmhni nua a dhanamh ar fheidhm %s: In sid cheana" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "" +"E746: Nl ainm na feidhme comhoirinach le hainm comhaid na scripte: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: N fidir feidhm %s a scriosadh: T s in sid faoi lthair" + +msgid "E133: :return not inside a function" +msgstr "E133: Caithfidh :return a bheith isteach i bhfeidhm" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Libn ar iarraidh: %s" msgid "" "\n" @@ -5663,9 +6099,6 @@ msgstr "" "\n" "Leagan GUI 32 giotn MS-Windows" -msgid " in Win32s mode" -msgstr " i md Win32s" - msgid " with OLE support" msgstr " le tacaocht OLE" @@ -5683,27 +6116,6 @@ msgstr "" "\n" "Leagan consil 32 giotn MS-Windows" -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Leagan 16 giotn MS-Windows" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Leagan 32 giotn MS-DOS" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Leagan 16 giotn MS-DOS" - msgid "" "\n" "MacOS X (unix) version" @@ -5725,13 +6137,6 @@ msgstr "" "\n" "Leagan MacOS" -msgid "" -"\n" -"RISC OS version" -msgstr "" -"\n" -"Leagan RISC OS" - msgid "" "\n" "OpenVMS version" @@ -5805,18 +6210,15 @@ msgstr "" msgid "without GUI." msgstr "gan GUI." +msgid "with GTK3 GUI." +msgstr "le GUI GTK3." + msgid "with GTK2-GNOME GUI." msgstr "le GUI GTK2-GNOME." -msgid "with GTK-GNOME GUI." -msgstr "le GUI GTK-GNOME." - msgid "with GTK2 GUI." msgstr "le GUI GTK2." -msgid "with GTK GUI." -msgstr "le GUI GTK." - msgid "with X11-Motif GUI." msgstr "le GUI X11-Motif." @@ -5874,6 +6276,9 @@ msgstr "dara comhad gvimrc msgid "3rd user gvimrc file: \"" msgstr "tr comhad gvimrc sideora: \"" +msgid " defaults file: \"" +msgstr " comhad na ramhshocruithe: \"" + msgid " system menu file: \"" msgstr " comhad roghchlir an chrais: \"" @@ -5919,8 +6324,8 @@ msgstr "cl msgid "type :help<Enter> or <F1> for on-line help" msgstr "clscrobh :help<Enter> n <F1> le haghaidh cabhrach ar lne" -msgid "type :help version7<Enter> for version info" -msgstr "clscrobh :help version7<Enter> le haghaidh eolais faoin leagan" +msgid "type :help version8<Enter> for version info" +msgstr "clscrobh :help version8<Enter> le haghaidh eolais faoin leagan" msgid "Running in Vi compatible mode" msgstr "Sa mhd comhoirinachta Vi" @@ -5969,12 +6374,6 @@ msgstr "cl msgid "menu Help->Sponsor/Register for information " msgstr "roghchlr Help->Sponsor/Register chun eolas a fhil " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "RABHADH: Braitheadh Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr "clscrobh :help windows95<Enter> chun eolas a fhil " - msgid "Already only one window" msgstr "Nl ach aon fhuinneog amhin ann cheana" @@ -5994,7 +6393,8 @@ msgid "E813: Cannot close autocmd window" msgstr "E813: N fidir fuinneog autocmd a dhnadh" msgid "E814: Cannot close window, only autocmd window would remain" -msgstr "E814: N fidir an fhuinneog a dhnadh, n bheadh ach fuinneog autocmd fgtha" +msgstr "" +"E814: N fidir an fhuinneog a dhnadh, n bheadh ach fuinneog autocmd fgtha" msgid "E445: Other window contains changes" msgstr "E445: T athruithe ann san fhuinneog eile" @@ -6006,6 +6406,25 @@ msgstr "E446: N msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Nl aon fhil ar chomhad \"%s\" sa chonair" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Aitheantas neamhbhail: %ld (n mr d a bheith >= 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: Aitheantas in sid cheana: %ld" + +msgid "List or number required" +msgstr "T g le liosta n uimhir" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Aitheantas neamhbhail: %ld (n mr d a bheith >= 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: Aitheantas gan aimsi: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Norbh fhidir an leabharlann %s a oscailt" @@ -6111,6 +6530,10 @@ msgstr "E236: N msgid "E473: Internal error" msgstr "E473: Earrid inmhenach" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Earrid inmhenach: %s" + msgid "Interrupted" msgstr "Idirbhriste" @@ -6244,6 +6667,9 @@ msgstr "E485: N msgid "E37: No write since last change (add ! to override)" msgstr "E37: T athruithe ann gan sbhil (cuir ! leis an ord chun sr)" +msgid "E37: No write since last change" +msgstr "E37: Gan scrobh n athr is dana" + msgid "E38: Null argument" msgstr "E38: Argint nialasach" @@ -6268,7 +6694,7 @@ msgid "E486: Pattern not found: %s" msgstr "E486: Patrn gan aimsi: %s" msgid "E487: Argument must be positive" -msgstr "E487: N folir argint dheimhneach" +msgstr "E487: Argint dheimhneach de dhth" msgid "E459: Cannot go back to previous directory" msgstr "E459: N fidir a fhilleadh ar an chomhadlann roimhe seo" @@ -6296,6 +6722,31 @@ msgstr "E46: N msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: N fidir athrg a shocr sa bhosca gainimh: \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: N fidir eochair fholamh a sid le Foclir" + +msgid "E715: Dictionary required" +msgstr "E715: T g le foclir" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: innacs liosta as raon: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: An iomarca argint d'fheidhm: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Nl an eochair seo san Fhoclir: %s" + +msgid "E714: List required" +msgstr "E714: T g le liosta" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Caithfidh argint de %s a bheith ina Liosta n Foclir" + msgid "E47: Error while reading errorfile" msgstr "E47: Earrid agus comhad earride lamh" @@ -6353,8 +6804,8 @@ msgstr "E592: n msgid "E80: Error while writing" msgstr "E80: Earrid agus scrobh" -msgid "Zero count" -msgstr "Nialas" +msgid "E939: Positive count required" +msgstr "E939: Uimhir dheimhneach de dhth" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> sid nach i gcomhthacs scripte" @@ -6368,16 +6819,16 @@ msgstr "E463: R msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: N cheadaonn NetBeans aon athr i gcomhaid inlite amhin" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Earrid inmhenach: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: sideann an patrn nos m cuimhne n 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: maoln folamh" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Nl a leithid de mhaoln %ld" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Patrn n teormharcir neamhbhail cuardaigh" @@ -6388,12 +6839,569 @@ msgstr "E139: T msgid "E764: Option '%s' is not set" msgstr "E764: Rogha '%s' gan socr" +msgid "E850: Invalid register name" +msgstr "E850: Ainm neamhbhail tabhaill" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Comhadlann gan aimsi in '%s': \"%s\"" + msgid "search hit TOP, continuing at BOTTOM" msgstr "Buaileadh an BARR le linn an chuardaigh, ag leanint ag an CHROCH" msgid "search hit BOTTOM, continuing at TOP" msgstr "Buaileadh an BUN le linn an chuardaigh, ag leanint ag an BHARR" +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Eochair chriptichin le haghaidh \"%s\" de dhth" + +msgid "empty keys are not allowed" +msgstr "n cheadatear eochracha folmha" + +msgid "dictionary is locked" +msgstr "t an foclir faoi ghlas" + +msgid "list is locked" +msgstr "t an liosta faoi ghlas" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "norbh fhidir eochair '%s' a chur leis an bhfoclir" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "n mr don innacs a bheith ina shlnuimhir n ina shlisne, seachas %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "bhothas ag sil le str() n unicode(), ach fuarthas %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "bhothas ag sil le bytes() n str(), ach fuarthas %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"bhothas ag sil le int(), long(), n rud igin inathraithe ina long(), ach " +"fuarthas %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "" +"bhothas ag sil le int() n rud igin inathraithe ina int(), ach fuarthas %s" + +msgid "value is too large to fit into C int type" +msgstr "t an luach nos m n athrg int sa teanga C" + +msgid "value is too small to fit into C int type" +msgstr "t an luach nos l n athrg int sa teanga C" + +msgid "number must be greater than zero" +msgstr "n mr don uimhir a bheith deimhneach" + +msgid "number must be greater or equal to zero" +msgstr "n mr don uimhir a bheith >= 0" + +msgid "can't delete OutputObject attributes" +msgstr "n fidir trithe OutputObject a scriosadh" + +#, c-format +msgid "invalid attribute: %s" +msgstr "aitreabid neamhbhail: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Earrid agus rada I/A dts" + +msgid "failed to change directory" +msgstr "norbh fhidir an chomhadlann a athr" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "" +"bhothas ag sil le 3-chodach mar thoradh ar imp.find_module(), ach fuarthas " +"%s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"bhothas ag sil le 3-chodach mar thoradh ar imp.find_module(), ach fuarthas " +"%d-chodach" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "earrid inmhenach: fuarthas codach NULL ar ais imp.find_module" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "n fidir trithe vim.Dictionary a scriosadh" + +msgid "cannot modify fixed dictionary" +msgstr "n fidir foclir socraithe a athr" + +#, c-format +msgid "cannot set attribute %s" +msgstr "n fidir trith %s a shocr" + +msgid "hashtab changed during iteration" +msgstr "athraodh an haistb le linn atriallta" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "bhothas ag sil le heilimint de mhid 2, ach fuarthas mid %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "n ghlacann cruthaitheoir an liosta le hargint eochairfhocail" + +msgid "list index out of range" +msgstr "innacs liosta as raon" + +#. No more suitable format specifications in python-2.3 +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "earrid inmhenach: nl aon fhil ar mhr %d sa liosta vim" + +msgid "slice step cannot be zero" +msgstr "n cheadatear slisne le cim 0" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "iarracht ar sheicheamh nos m n %d a shannadh do shlisne fadaithe" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "earrid inmhenach: nl aon mhr %d sa liosta vim" + +msgid "internal error: not enough list items" +msgstr "earrid inmhenach: nl go leor mreanna liosta ann" + +msgid "internal error: failed to add item to list" +msgstr "earrid inmhenach: norbh fhidir mr a chur leis an liosta" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "iarracht ar sheicheamh de mhid %d a shannadh do shlisne de mhid %d" + +msgid "failed to add item to list" +msgstr "norbh fhidir mr a chur leis an liosta" + +msgid "cannot delete vim.List attributes" +msgstr "n fidir trithe vim.List a scriosadh" + +msgid "cannot modify fixed list" +msgstr "n fidir liosta socraithe a athr" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "nl feidhm %s gan ainm ann" + +#, c-format +msgid "function %s does not exist" +msgstr "nl feidhm %s ann" + +#, c-format +msgid "failed to run function %s" +msgstr "norbh fhidir feidhm %s a rith" + +msgid "unable to get option value" +msgstr "n fidir luach na rogha a fhil" + +msgid "internal error: unknown option type" +msgstr "earrid inmhenach: cinel rogha anaithnid" + +msgid "problem while switching windows" +msgstr "tharla earrid agus an fhuinneog hathr" + +#, c-format +msgid "unable to unset global option %s" +msgstr "n fidir rogha chomhchoiteann %s a dhshocr" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "n fidir rogha %s gan luach comhchoiteann a dhshocr" + +msgid "attempt to refer to deleted tab page" +msgstr "tagairt danta do leathanach cluaisn scriosta" + +msgid "no such tab page" +msgstr "nl a leithid de leathanach cluaisn ann" + +msgid "attempt to refer to deleted window" +msgstr "rinneadh iarracht ar fhuinneog scriosta a rochtain" + +msgid "readonly attribute: buffer" +msgstr "trith inlite amhin: maoln" + +msgid "cursor position outside buffer" +msgstr "crsir taobh amuigh den mhaoln" + +msgid "no such window" +msgstr "nl a leithid d'fhuinneog ann" + +msgid "attempt to refer to deleted buffer" +msgstr "rinneadh iarracht ar mhaoln scriosta a rochtain" + +msgid "failed to rename buffer" +msgstr "norbh fhidir ainm nua a chur ar an maoln" + +msgid "mark name must be a single character" +msgstr "n cheadatear ach carachtar amhin in ainm an mhairc" + +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "bhothas ag sil le rad vim.Buffer, ach fuarthas %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "norbh fhidir athr go dt maoln a %d" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "bhothas ag sil le rad vim.Window, ach fuarthas %s" + +msgid "failed to find window in the current tab page" +msgstr "nor aimsodh fuinneog sa leathanach cluaisn reatha" + +msgid "did not switch to the specified window" +msgstr "nor athraodh go dt an fhuinneog roghnaithe" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "bhothas ag sil le rad vim.TabPage, ach fuarthas %s" + +msgid "did not switch to the specified tab page" +msgstr "nor athraodh go dt an leathanach cluaisn roghnaithe" + +msgid "failed to run the code" +msgstr "norbh fhidir an cd a chur ar sil" + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: N bhfuarthas rad bail python ar ais Eval" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "E859: Norbh fhidir luach vim a dhanamh as an rad python" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "n fidir foclir vim a dhanamh as %s" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "n fidir liosta vim a dhanamh as %s" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "n fidir struchtr vim a dhanamh as %s" + +msgid "internal error: NULL reference passed" +msgstr "earrid inmhenach: tagairt NULL seolta" + +msgid "internal error: invalid value type" +msgstr "earrid inmhenach: cinel neamhbhail" + +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Norbh fhidir path_hook a shocr: n liosta sys.path_hooks\n" +"Ba chir duit na ruda seo a leanas a dhanamh:\n" +"- cuir vim.path_hook le deireadh sys.path_hooks\n" +"- cuir vim.VIM_SPECIAL_PATH le deireadh sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Norbh fhidir an chonair a shocr: n liosta sys.path\n" +"Ba chir duit vim.VIM_SPECIAL_PATH a cheangal le deireadh sys.path" + +#~ msgid "+-%s%3ld line: " +#~ msgid_plural "+-%s%3ld lines: " +#~ msgstr[0] "+-%s%3ld lne: " +#~ msgstr[1] "+-%s%3ld lne: " +#~ msgstr[2] "+-%s%3ld lne: " +#~ msgstr[3] "+-%s%3ld lne: " +#~ msgstr[4] "+-%s%3ld lne: " + +#~ msgid "+--%3ld line folded " +#~ msgid_plural "+--%3ld lines folded " +#~ msgstr[0] "+--%3ld lne fillte " +#~ msgstr[1] "+--%3ld lne fillte " +#~ msgstr[2] "+--%3ld lne fillte " +#~ msgstr[3] "+--%3ld lne fillte " +#~ msgstr[4] "+--%3ld lne fillte " + +#~ msgid "Type :quit<Enter> to exit Vim" +#~ msgstr "Clscrobh :quit<Enter> chun Vim a scor" + +#~ msgid "Zero count" +#~ msgstr "Nialas" + +#~ msgid "E693: Can only compare Funcref with Funcref" +#~ msgstr "E693: Is fidir Funcref a chur i gcomparid le Funcref eile amhin" + +#~ msgid "E706: Variable type mismatch for: %s" +#~ msgstr "E706: Mmheaitseil idir cinelacha athrige: %s" + +#~ msgid "%ld characters" +#~ msgstr "%ld carachtar" + +#~ msgid "Toggle implementation/definition" +#~ msgstr "Scornaigh feidhmi/sainmhni" + +#~ msgid "Show base class of" +#~ msgstr "Taispein an bunaicme de" + +#~ msgid "Show overridden member function" +#~ msgstr "Taispein ballfheidhm sraithe" + +#~ msgid "Retrieve from file" +#~ msgstr "Aisghabh chomhad" + +#~ msgid "Retrieve from project" +#~ msgstr "Aisghabh thionscadal" + +#~ msgid "Retrieve from all projects" +#~ msgstr "Aisghabh gach tionscadal" + +#~ msgid "Retrieve" +#~ msgstr "Aisghabh" + +#~ msgid "Show source of" +#~ msgstr "Taispein foinse" + +#~ msgid "Find symbol" +#~ msgstr "Aimsigh siombail" + +#~ msgid "Browse class" +#~ msgstr "Brabhsil aicme" + +#~ msgid "Show class in hierarchy" +#~ msgstr "Taispein an aicme in ordlathas" + +#~ msgid "Show class in restricted hierarchy" +#~ msgstr "Taispein an aicme in ordlathas srianta" + +#~ msgid "Xref refers to" +#~ msgstr "Tagraonn Xref do" + +#~ msgid "Xref referred by" +#~ msgstr "Xref tagartha ag" + +#~ msgid "Xref has a" +#~ msgstr "Rud at ag Xref:" + +#~ msgid "Xref used by" +#~ msgstr "Xref sid ag" + +#~ msgid "Show docu of" +#~ msgstr "Taispein eolas faoi" + +#~ msgid "Generate docu for" +#~ msgstr "Gin eolas faoi" + +#~ msgid "" +#~ "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " +#~ "$PATH).\n" +#~ msgstr "" +#~ "N fidir nasc a dhanamh le SNiFF+. Seiceil do chuid athrga " +#~ "thimpeallachta (caithfidh t sniffemacs a chur i do $PATH).\n" + +#~ msgid "E274: Sniff: Error during read. Disconnected" +#~ msgstr "E274: Sniff: Earrid sa lamh. Dnasctha" + +#~ msgid "SNiFF+ is currently " +#~ msgstr "SNiFF+ stdas faoi lthair: " + +#~ msgid "not " +#~ msgstr "n " + +#~ msgid "connected" +#~ msgstr "nasctha" + +#~ msgid "E275: Unknown SNiFF+ request: %s" +#~ msgstr "E275: Iarratas anaithnid SNiFF+: %s" + +#~ msgid "E276: Error connecting to SNiFF+" +#~ msgstr "E276: Earrid ag nascadh le SNiFF+" + +#~ msgid "E278: SNiFF+ not connected" +#~ msgstr "E278: SNiFF+ gan nasc" + +#~ msgid "E279: Not a SNiFF+ buffer" +#~ msgstr "E279: N maoln SNiFF+ " + +#~ msgid "Sniff: Error during write. Disconnected" +#~ msgstr "Sniff: Earrid sa scrobh. Dnasctha" + +#~ msgid " Quit, or continue with caution.\n" +#~ msgstr " Scoir, n lean ar aghaidh go hairdeallach.\n" + +#~ msgid "Cannot connect to Netbeans #2" +#~ msgstr "N fidir nascadh le Netbeans #2" + +#~ msgid "read from Netbeans socket" +#~ msgstr "ladh shoicad Netbeans" + +#~ msgid "'columns' is not 80, cannot execute external commands" +#~ msgstr "n 80 'columns', n fidir orduithe seachtracha a rith" + +#~ msgid "Could not set security context " +#~ msgstr "Norbh fhidir comhthacs slndla a shocr " + +#~ msgid " for " +#~ msgstr " le haghaidh " + +#~ msgid "Could not get security context " +#~ msgstr "Norbh fhidir comhthacs slndla a fhil " + +#~ msgid ". Removing it!\n" +#~ msgstr ". scriosadh!\n" + +#~ msgid " (lang)" +#~ msgstr " (teanga)" + +#~ msgid "E759: Format error in spell file" +#~ msgstr "E759: Earrid fhormide i gcomhad litrithe" + +#~ msgid "" +#~ "\n" +#~ "MS-Windows 16/32-bit GUI version" +#~ msgstr "" +#~ "\n" +#~ "Leagan GUI 16/32 giotn MS-Windows" + +#~ msgid " in Win32s mode" +#~ msgstr " i md Win32s" + +#~ msgid "" +#~ "\n" +#~ "MS-Windows 16-bit version" +#~ msgstr "" +#~ "\n" +#~ "Leagan 16 giotn MS-Windows" + +#~ msgid "" +#~ "\n" +#~ "32-bit MS-DOS version" +#~ msgstr "" +#~ "\n" +#~ "Leagan 32 giotn MS-DOS" + +#~ msgid "" +#~ "\n" +#~ "16-bit MS-DOS version" +#~ msgstr "" +#~ "\n" +#~ "Leagan 16 giotn MS-DOS" + +#~ msgid "WARNING: Windows 95/98/ME detected" +#~ msgstr "RABHADH: Braitheadh Windows 95/98/ME" + +#~ msgid "type :help windows95<Enter> for info on this" +#~ msgstr "clscrobh :help windows95<Enter> chun eolas a fhil " + +#~ msgid "function constructor does not accept keyword arguments" +#~ msgstr "n ghlacann cruthaitheoir na feidhme le hargint eochairfhocail" + +#~ msgid "Vim dialog..." +#~ msgstr "Dialg Vim..." + +#~ msgid "Font Selection" +#~ msgstr "Roghn Cl" + +#~ msgid "softspace must be an integer" +#~ msgstr "caithfidh softspace a bheith ina shlnuimhir" + +#~ msgid "writelines() requires list of strings" +#~ msgstr "liosta teaghrn ag teastil writelines()" + +#~ msgid "<buffer object (deleted) at %p>" +#~ msgstr "<rad maolin (scriosta) ag %p>" + +#~ msgid "<window object (deleted) at %p>" +#~ msgstr "<rad fuinneoige (scriosta) ag %p>" + +#~ msgid "<window object (unknown) at %p>" +#~ msgstr "<rad fuinneoige (anaithnid) ag %p>" + +#~ msgid "<window %d>" +#~ msgstr "<fuinneog %d>" + +#~ msgid "" +#~ "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim." +#~ "org" +#~ msgstr "" +#~ "E281: EARRID TCL: nl an cd scortha ina shlnuimhir!? Seol tuairisc " +#~ "fhabht chuig <vim-dev@vim.org> le do thoil" + +#~ msgid "-name <name>\t\tUse resource as if vim was <name>" +#~ msgstr "-name <ainm>\t\tsid acmhainn mar a bheadh vim <ainm>" + +#~ msgid "\t\t\t (Unimplemented)\n" +#~ msgstr "\t\t\t (Nl ar fil)\n" + +#~ msgid "" +#~ "\n" +#~ "Arguments recognised by gvim (RISC OS version):\n" +#~ msgstr "" +#~ "\n" +#~ "Argint ar eolas do gvim (leagan RISC OS):\n" + +#~ msgid "--columns <number>\tInitial width of window in columns" +#~ msgstr "--columns <uimhir>\tLeithead fuinneoige i dtosach (colin)" + +#~ msgid "--rows <number>\tInitial height of window in rows" +#~ msgstr "--rows <uimhir>\tAirde fhuinneoige i dtosach (rnna)" + +#~ msgid "E290: over-the-spot style requires fontset" +#~ msgstr "E290: tacar cl ag teastil stl thar-an-spota" + +#~ msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" +#~ msgstr "" +#~ "E291: T an GTK+ at agat nos sine n leagan 1.2.3. Dchumasatear an " +#~ "limistar stdais" + +#~ msgid "E292: Input Method Server is not running" +#~ msgstr "E292: Nl an Freastala Mhodh Ionchuir ag rith" + +#~ msgid "Vim: preserving files...\n" +#~ msgstr "Vim: comhaid gcaomhn...\n" + +#~ msgid "Vim: Finished.\n" +#~ msgstr "Vim: Crochnaithe.\n" + +#~ msgid "E505: " +#~ msgstr "E505: " + +#~ msgid "Vim: Double signal, exiting\n" +#~ msgstr "Vim: Comhartha dbailte, ag scor\n" + +#~ msgid "Vim: Caught deadly signal %s\n" +#~ msgstr "Vim: Fuarthas comhartha marfach %s\n" + +#~ msgid "Vim: Caught deadly signal\n" +#~ msgstr "Vim: Fuarthas comhartha marfach\n" + +#~ msgid "E396: containedin argument not accepted here" +#~ msgstr "E396: n ghlactar leis an argint containedin anseo" + +# columns? +#~ msgid "number changes time" +#~ msgstr "uimhir athruithe am" + +#~ msgid "" +#~ "\n" +#~ "RISC OS version" +#~ msgstr "" +#~ "\n" +#~ "Leagan RISC OS" + +#~ msgid "with GTK-GNOME GUI." +#~ msgstr "le GUI GTK-GNOME." + #~ msgid "E569: maximum number of cscope connections reached" #~ msgstr "E569: n cheadatear nos m n an lon uasta nasc cscope" diff --git a/src/po/it.po b/src/po/it.po index e134cf6d73..550c2c7ce5 100644 --- a/src/po/it.po +++ b/src/po/it.po @@ -11,18 +11,19 @@ # msgid "" msgstr "" -"Project-Id-Version: vim 7.4b\n" +"Project-Id-Version: vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-29 16:11+0200\n" -"PO-Revision-Date: 2013-08-03 17:14+0200\n" -"Last-Translator: Vlad Sandrini <vlad.gently@gmail.com>\n" -"Language-Team: Italian" -" Antonio Colombo <azc100@gmail.com>" -" Vlad Sandrini <vlad.gently@gmail.com>" +"POT-Creation-Date: 2018-05-12 16:07+0200\n" +"PO-Revision-Date: 2018-05-13 22:32+0200\n" +"Last-Translator: Antonio Colombo <azc100@gmail.com>\n" +"Language-Team: Antonio Colombo <azc100@gmail.com>\n" +" Vlad Sandrini <vlad.gently@gmail.com>\n" " Luciano Montanaro <mikelima@cirulla.net>\n" +"Language: Italian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: chiamata a bf_key_init() con password nulla" @@ -54,6 +55,12 @@ msgstr "E82: Non riesco ad allocare alcun buffer, esco..." msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: Non riesco ad allocare un buffer, uso l'altro..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: Non riesco a registrare il buffer" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Tentativo di eliminare un buffer ancora usato" + msgid "E515: No buffers were unloaded" msgstr "E515: Nessun buffer scaricato" @@ -84,17 +91,15 @@ msgstr "1 buffer cancellato" msgid "%d buffers wiped out" msgstr "%d buffer cancellati" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Non riesco a scaricare l'ultimo buffer" + msgid "E84: No modified buffer found" msgstr "E84: Nessun buffer risulta modificato" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Non c' alcun buffer elencato" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Non esiste il buffer %ld" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Non posso oltrepassare l'ultimo buffer" @@ -106,11 +111,20 @@ msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" "E89: Buffer %ld non salvato dopo modifica (aggiungi ! per eseguire comunque)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Non riesco a scaricare l'ultimo buffer" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Lavoro ancora in esecuzione (aggiungi! per terminarlo)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Non salvato dopo modifica (aggiungi ! per eseguire comunque)" + +msgid "E948: Job still running" +msgstr "E948: Lavoro ancora attivo" + +msgid "E37: No write since last change" +msgstr "E37: Non salvato dopo l'ultima modifica" msgid "W14: Warning: List of file names overflow" -msgstr "W14: Attenzione: Superato limite della lista dei nomi di file" +msgstr "W14: Avviso: Superato limite della lista dei nomi di file" #, c-format msgid "E92: Buffer %ld not found" @@ -126,7 +140,7 @@ msgstr "E94: Nessun buffer corrispondente a %s" #, c-format msgid "line %ld" -msgstr "linea %ld" +msgstr "riga %ld" msgid "E95: Buffer with this name already exists" msgstr "E95: C' gi un buffer con questo nome" @@ -149,19 +163,21 @@ msgstr "[Sola Lettura]" msgid "[readonly]" msgstr "[in sola lettura]" +#, c-format msgid "1 line --%d%%--" -msgstr "1 linea --%d%%--" +msgstr "1 riga --%d%%--" +#, c-format msgid "%ld lines --%d%%--" -msgstr "%ld linee --%d%%--" +msgstr "%ld righe --%d%%--" +#, c-format msgid "line %ld of %ld --%d%%-- col " -msgstr "linea %ld di %ld --%d%%-- col " +msgstr "riga %ld di %ld --%d%%-- col " msgid "[No Name]" msgstr "[Senza nome]" -#. must be a help buffer msgid "help" msgstr "aiuto" @@ -187,6 +203,9 @@ msgstr "" "\n" "# Lista Buffer:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Non posso scrivere, l'opzione 'buftype' impostata" + msgid "[Scratch]" msgstr "[Volatile]" @@ -203,10 +222,101 @@ msgstr "Segni per %s:" #, c-format msgid " line=%ld id=%d name=%s" -msgstr " linea=%ld id=%d, nome=%s" +msgstr " riga=%ld id=%d, nome=%s" + +msgid "E902: Cannot connect to port" +msgstr "E902: Non posso commettermi alla porta" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() in channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() in channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: il comando ricevuto non aveva come argomento una stringa" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: l'ultimo argomento per espressione/chiamata dev'essere numerico" + +msgid "E904: third argument for call must be a list" +msgstr "E904: il terzo argomento della chiamata dev'essere una Lista" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: recevuto comando non conosciuto: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): scrittura in mancanza di connessione" #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E631: %s(): write failed" +msgstr "E631: %s(): scrittura non riuscita" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Non posso usare callback con %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: non posso usare ch_evalexpr() con un canale grezzo o nl" + +msgid "E906: not an open channel" +msgstr "E906: canale non aperto" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: il file _io necessita di impostare _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: il buffer in_io necessita di impostare in_buf o in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: il buffer dev'essere caricato: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: File cifrato con metodo sconosciuto" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Avviso: Metodo di cifratura debole in uso; vedere :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Immetti chiave di cifratura: " + +msgid "Enter same key again: " +msgstr "Ribatti per conferma la stessa chiave: " + +msgid "Keys don't match!" +msgstr "Le chiavi non corrispondono!" + +msgid "[crypted]" +msgstr "[cifrato]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Manca ':' nel Dizionario: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Chiave duplicata nel Dizionario: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Manca virgola nel Dizionario: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Manca '}' a fine Dizionario: %s" + +msgid "extend() argument" +msgstr "argomento di extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Chiave gi esistente: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: Non supporto differenze fra pi di %ld buffer" msgid "E810: Cannot read or write temp files" @@ -262,15 +372,14 @@ msgstr "E791: Nessuna keymap per questo tasto" msgid " Keyword completion (^N^P)" msgstr " Completamento Keyword (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " modalit ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgid " Whole line completion (^L^N^P)" -msgstr " Completamento Linea Intera (^L^N^P)" +msgstr " Completamento riga intera (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr " Completamento nomi File (^F^N^P)" +msgstr " Completamento nomi file (^F^N^P)" msgid " Tag completion (^]^N^P)" msgstr " Completamento Tag (^]^N^P)" @@ -288,7 +397,7 @@ msgid " Thesaurus completion (^T^N^P)" msgstr " Completamento Thesaurus (^T^N^P)" msgid " Command-line completion (^V^N^P)" -msgstr " Completamento linea comandi (^V^N^P)" +msgstr " Completamento riga comandi (^V^N^P)" msgid " User defined completion (^U^N^P)" msgstr " Completamento definito dall'utente (^U^N^P)" @@ -334,13 +443,12 @@ msgstr "Scansione: %s" msgid "Scanning tags." msgstr "Scansione tag." +msgid "match in file" +msgstr "corrispondenza nel file" + msgid " Adding" msgstr " Aggiungo" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Ricerca..." @@ -348,7 +456,7 @@ msgid "Back at original" msgstr "Ritorno all'originale" msgid "Word from other line" -msgstr "Parola da un'altra linea" +msgstr "Parola da un'altra riga" msgid "The only match" msgstr "L'unica corrispondenza" @@ -364,10 +472,6 @@ msgstr "corrispondenza %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Caratteri non previsti in :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: indice lista fuori intervallo: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Variabile non definita: %s" @@ -375,41 +479,6 @@ msgstr "E121: Variabile non definita: %s" msgid "E111: Missing ']'" msgstr "E111: Manca ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: L'argomento di %s deve essere una Lista" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: L'argomento di %s deve essere una Lista o un Dizionario" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Non posso usare una chiave nulla per il Dizionario" - -msgid "E714: List required" -msgstr "E714: necessaria una Lista" - -msgid "E715: Dictionary required" -msgstr "E715: necessario un Dizionario" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Troppi argomenti per la funzione: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Chiave assente dal Dizionario: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: La funzione %s esiste gi, aggiungi ! per sostituirla" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: C' gi la voce nel Dizionario" - -msgid "E718: Funcref required" -msgstr "E718: Funcref necessario" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Non posso usare [:] con un Dizionario" @@ -417,17 +486,13 @@ msgstr "E719: Non posso usare [:] con un Dizionario" msgid "E734: Wrong variable type for %s=" msgstr "E734: Tipo di variabile errato per %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Funzione sconosciuta: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Nome di variabile non ammesso: %s" # nuovo msgid "E806: using Float as a String" -msgstr "E806: uso di un numero con virgola come stringa" +msgstr "E806: uso di un Numero-a-virgola-mobile come Stringa" msgid "E687: Less targets than List items" msgstr "E687: Destinazioni pi numerose degli elementi di Lista" @@ -460,40 +525,22 @@ msgstr "E711: Il valore Lista non ha elementi sufficienti" msgid "E690: Missing \"in\" after :for" msgstr "E690: Manca \"in\" dopo :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Mancano parentesi: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Variabile inesistente: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Non riesco a bloccare o sbloccare la variabile %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: variabile troppo nidificata per lock/unlock" msgid "E109: Missing ':' after '?'" msgstr "E109: Manca ':' dopo '?'" -msgid "E691: Can only compare List with List" -msgstr "E691: Posso confrontare una Lista solo con un'altra Lista" - -msgid "E692: Invalid operation for List" -msgstr "E692: Operazione non valida per Liste" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Posso confrontare un Dizionario solo con un altro Dizionario" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Operazione non valida per Dizionari" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Posso confrontare un Funcref solo con un Funcref" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Operazione non valida per Funcref" - msgid "E804: Cannot use '%' with Float" -msgstr "E804: Non si pu usare '%' con un numero con virgola" +msgstr "E804: Non si pu usare '%' con un Numero-a-virgola-mobile" msgid "E110: Missing ')'" msgstr "E110: Manca ')'" @@ -501,6 +548,9 @@ msgstr "E110: Manca ')'" msgid "E695: Cannot index a Funcref" msgstr "E695: Non posso indicizzare un Funcref" +msgid "E909: Cannot index a special variable" +msgstr "E909: Non posso indicizzare una variabile speciale" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Nome Opzione mancante: %s" @@ -517,83 +567,119 @@ msgstr "E114: Manca '\"': %s" msgid "E115: Missing quote: %s" msgstr "E115: Manca apostrofo: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Manca virgola nella Lista: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "Memoria insufficiente per impostarlo, recupero memoria fallito!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Manca ']' a fine Lista: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: variabile troppo nidificata per la visualizzazione" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Manca ':' nel Dizionario: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Uso di un Numero-a-virgola-mobile come Numero" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Chiave duplicata nel Dizionario: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Uso di Funcref come Numero" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Manca virgola nel Dizionario: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Uso di Lista come Numero" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Manca '}' a fine Dizionario: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Uso di Dizionario come Numero" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: variabile troppo nidificata per la visualizzazione" +msgid "E910: Using a Job as a Number" +msgstr "E910: Uso di Job come Numero" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Troppi argomenti per la funzione: %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: Uso di Canale come Numero" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Uso di Funcref come Numero-a-virgola-mobile" + +msgid "E892: Using a String as a Float" +msgstr "E892: Uso di Stringa come Numero-a-virgola-mobile" + +msgid "E893: Using a List as a Float" +msgstr "E893: Uso di Lista come Numero-a-virgola-mobile" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Uso di Dizionario come Numero-a-virgola-mobile" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Uso di valore speciale come Numero-a-virgola-mobile" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Uso di Job come Numero-a-virgola-mobile" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Uso di Canale come Numero-a-virgola-mobile" + +msgid "E729: using Funcref as a String" +msgstr "E729: uso di Funcref come Stringa" + +msgid "E730: using List as a String" +msgstr "E730: uso di Lista come Stringa" + +msgid "E731: using Dictionary as a String" +msgstr "E731: uso di Dizionario come Stringa" + +# nuovo +msgid "E908: using an invalid value as a String" +msgstr "E908: uso di un valore non valido come Stringa" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Argomenti non validi per la funzione: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Non posso cancellare la variabile %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Funzione sconosciuta: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "" +"E704: Il nome della variabile Funcref deve iniziare con una maiuscola: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: La funzione: %s richiede pi argomenti" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Nome di variabile in conflitto con una funzione esistente: %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: Uso di <SID> fuori dal contesto di uno script: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Valore di %s non modificabile" + +msgid "Unknown" +msgstr "Sconosciuto" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Chiamata di funzione dict in assenza di Dizionario: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Non riesco a cambiare il valore di %s" -msgid "E808: Number or Float required" -msgstr "E808: Ci vuole un numero intero o con virgola" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Variabile troppo nidificata per poterla copiare" -msgid "add() argument" -msgstr "argomento di add()" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# variabili globali:\n" -msgid "E699: Too many arguments" -msgstr "E699: Troppi argomenti" +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tImpostata l'ultima volta da " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() pu essere usata solo in modalit inserimento" +msgid "E691: Can only compare List with List" +msgstr "E691: Posso confrontare una Lista solo con un'altra Lista" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&OK" +msgid "E692: Invalid operation for List" +msgstr "E692: Operazione non valida per Liste" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Chiave gi esistente: %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Posso confrontare un Dizionario solo con un altro Dizionario" -msgid "extend() argument" -msgstr "argomento di extend()" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Operazione non valida per Dizionari" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Operazione non valida per Funcref" msgid "map() argument" msgstr "argomento di map()" @@ -602,13 +688,40 @@ msgid "filter() argument" msgstr "argomento di filter()" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld linee: " +msgid "E686: Argument of %s must be a List" +msgstr "E686: L'argomento di %s deve essere una Lista" + +msgid "E928: String required" +msgstr "E928: Stringa necessaria" + +msgid "E808: Number or Float required" +msgstr "E808: Ci vuole un Numero o un Numero-a-virgola-mobile" + +msgid "add() argument" +msgstr "argomento di add()" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() pu essere usata solo in modalit inserimento" + +msgid "&Ok" +msgstr "&OK" + +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld riga: " +msgstr[1] "+-%s%3ld righe: " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Funzione sconosciuta: %s" +msgid "E922: expected a dict" +msgstr "E922: aspettavo un Dizionario" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "" +"E923: Il secondo argomento di function() dev'essere una Lista o un Dizionario" + msgid "" "&OK\n" "&Cancel" @@ -625,198 +738,95 @@ msgstr "argomento di insert()" msgid "E786: Range not allowed" msgstr "E786: Intervallo non consentito" -msgid "E701: Invalid type for len()" -msgstr "E701: Tipo non valido per len()" - -msgid "E726: Stride is zero" -msgstr "E726: Incremento indice a zero" - -msgid "E727: Start past end" -msgstr "E727: Indice iniziale superiore a quello finale" - -msgid "<empty>" -msgstr "<vuoto>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Manca connessione con server Vim" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: Impossibile inviare a %s" - -msgid "E277: Unable to read a server reply" -msgstr "E277: Non riesco a leggere una risposta del server" - -msgid "remove() argument" -msgstr "argomento di remove()" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Troppi link simbolici (circolarit?)" - -msgid "reverse() argument" -msgstr "argomento di reverse()" - -msgid "E258: Unable to send to client" -msgstr "E258: Impossibile inviare al client" - -msgid "sort() argument" -msgstr "argomento di sort()" - -msgid "E702: Sort compare function failed" -msgstr "E702: Funzione confronto nel sort non riuscita" - -msgid "(Invalid)" -msgstr "(Non valido)" - -msgid "E677: Error writing temp file" -msgstr "E677: Errore in scrittura su file temporaneo" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Uso di un numero con virgola come intero" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Uso di Funcref come Numero" - -msgid "E745: Using a List as a Number" -msgstr "E745: Uso di Lista come Numero" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Uso di Dizionario come Numero" - -msgid "E729: using Funcref as a String" -msgstr "E729: uso di Funcref come Stringa" - -msgid "E730: using List as a String" -msgstr "E730: uso di Lista come Stringa" - -msgid "E731: using Dictionary as a String" -msgstr "E731: uso di Dizionario come Stringa" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Tipo di variabile non corrispondente per: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Non posso cancellare la variabile %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "" -"E704: Il nome della variabile Funcref deve iniziare con una maiuscola: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Nome di variabile in conflitto con una funzione esistente: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Valore di %s non modificabile" - -msgid "Unknown" -msgstr "Sconosciuto" +msgid "E916: not a valid job" +msgstr "E916: job non valido" + +msgid "E701: Invalid type for len()" +msgstr "E701: Tipo non valido per len()" #, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Non riesco a cambiare il valore di %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID riservato per \":match\": %ld" -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: Variabile troppo nidificata per poterla copiare" +msgid "E726: Stride is zero" +msgstr "E726: Incremento indice a zero" -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Funzione non definita: %s" +msgid "E727: Start past end" +msgstr "E727: Indice iniziale superiore a quello finale" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Manca '(': %s" +msgid "<empty>" +msgstr "<vuoto>" -msgid "E862: Cannot use g: here" -msgstr "E862: Non si pu usare g: qui" +msgid "E240: No connection to the X server" +msgstr "E240: Manca connessione con server Vim" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Argomento non ammesso: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: Impossibile inviare a %s" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: Nome argomento duplicato: %s" +msgid "E277: Unable to read a server reply" +msgstr "E277: Non riesco a leggere una risposta del server" -msgid "E126: Missing :endfunction" -msgstr "E126: Manca :endfunction" +msgid "E941: already started a server" +msgstr "E941: un server gi stato predisposto" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Nome funzione in conflitto con la variabile: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: funzionalit +clientserver non disponibile" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Non posso ridefinire la funzione %s: in uso" +msgid "remove() argument" +msgstr "argomento di remove()" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Il nome funzione non corrisponde al nome file dello script: %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Troppi link simbolici (circolarit?)" -msgid "E129: Function name required" -msgstr "E129: Nome funzione necessario" +msgid "reverse() argument" +msgstr "argomento di reverse()" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Il nome funzione deve iniziare con una maiuscola o contenere ':': %s" +msgid "E258: Unable to send to client" +msgstr "E258: Impossibile inviare al client" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Non posso eliminare la funzione %s: in uso" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Azione non valida: '%s'" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "" -"E132: Nidificazione della chiamata di funzione maggiore di 'maxfuncdepth'" +msgid "sort() argument" +msgstr "argomento di sort()" -#, c-format -msgid "calling %s" -msgstr "chiamo %s" +msgid "uniq() argument" +msgstr "argomento di uniq()" -#, c-format -msgid "%s aborted" -msgstr "%s non completata" +msgid "E702: Sort compare function failed" +msgstr "E702: Funzione confronto nel sort non riuscita" -#, c-format -msgid "%s returning #%ld" -msgstr "%s ritorno #%ld" +msgid "E882: Uniq compare function failed" +msgstr "E882: Funzione confronto in uniq non riuscita" -#, c-format -msgid "%s returning %s" -msgstr "%s ritorno %s" +msgid "(Invalid)" +msgstr "(Non valido)" #, c-format -msgid "continuing in %s" -msgstr "continuo in %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return fuori da una funzione" +msgid "E935: invalid submatch number: %d" +msgstr "E935: nomeri di sotto-corrispondenza non valido: %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# variabili globali:\n" +msgid "E677: Error writing temp file" +msgstr "E677: Errore in scrittura su file temporaneo" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tImpostata l'ultima volta da " +msgid "E921: Invalid callback argument" +msgstr "E921: Argomento callback non valido" -msgid "No old files" -msgstr "Nessun file elaborato in precedenza" +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Esa %02x, Ottale %03o, Digr %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, Esa %02x, Ottale %03o" +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Esa %04x, Ottale %o, Digr %s" + +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Esa %08x, Ottale %o, Digr %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, Esa %04x, Ottale %o" @@ -826,18 +836,18 @@ msgid "> %d, Hex %08x, Octal %o" msgstr "> %d, Esa %08x, Ottale %o" msgid "E134: Move lines into themselves" -msgstr "E134: Movimento di linee verso se stesse" +msgstr "E134: Movimento di righe verso se stesse" msgid "1 line moved" -msgstr "1 linea mossa" +msgstr "1 riga mossa" #, c-format msgid "%ld lines moved" -msgstr "%ld linee mosse" +msgstr "%ld righe mosse" #, c-format msgid "%ld lines filtered" -msgstr "%ld linee filtrate" +msgstr "%ld righe filtrate" msgid "E135: *Filter* Autocommands must not change current buffer" msgstr "E135: *Filter* Gli autocomandi non devono modificare il buffer in uso" @@ -847,7 +857,7 @@ msgstr "[Non salvato dopo l'ultima modifica]\n" #, c-format msgid "%sviminfo: %s in line: " -msgstr "%sviminfo: %s nella linea: " +msgstr "%sviminfo: %s nella riga: " msgid "E136: viminfo: Too many errors, skipping rest of file" msgstr "E136: viminfo: Troppi errori, ignoro il resto del file" @@ -868,11 +878,14 @@ msgstr " file elaborati in precedenza" msgid " FAILED" msgstr " FALLITO" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: File viminfo \"%s\" inaccessibile in scrittura" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Troppi file temporanei viminfo, come %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Non riesco a scrivere il file viminfo %s!" @@ -881,7 +894,10 @@ msgstr "E138: Non riesco a scrivere il file viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Scrivo file viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Non riesco a rinominare il file viminfo a %s!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Questo file viminfo stato generato da Vim %s.\n" @@ -899,6 +915,13 @@ msgstr "# Valore di 'encoding' al momento della scrittura di questo file\n" msgid "Illegal starting char" msgstr "Carattere iniziale non ammesso" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Righe che iniziano con '|', semplicemente copiate:\n" + msgid "Save As" msgstr "Salva con Nome" @@ -988,21 +1011,21 @@ msgid "%ld substitutions" msgstr "%ld sostituzioni" msgid " on 1 line" -msgstr " in 1 linea" +msgstr " in 1 riga" #, c-format msgid " on %ld lines" -msgstr " in %ld linee" +msgstr " in %ld righe" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global non pu essere usato ricorsivamente" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global non pu essere usato ricorsivamente con un intervallo" msgid "E148: Regular expression missing from global" msgstr "E148: Manca espressione regolare nel comando 'global'" #, c-format msgid "Pattern found in every line: %s" -msgstr "Espressione trovata su ogni linea: %s" +msgstr "Espressione trovata su ogni riga: %s" #, c-format msgid "Pattern not found: %s" @@ -1033,8 +1056,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Spiacente, non trovo file di aiuto \"%s\"" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: %s non una directory" +msgid "E151: No match: %s" +msgstr "E151: Nessuna corrispondenza: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1052,6 +1075,10 @@ msgstr "E670: Codifiche diverse fra file di aiuto nella stessa lingua: %s" msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: Tag duplicato \"%s\" nel file %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: %s non una directory" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: Comando 'sign' sconosciuto: %s" @@ -1077,10 +1104,17 @@ msgstr "E159: Manca numero 'sign'" msgid "E158: Invalid buffer name: %s" msgstr "E158: Nome buffer non valido: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Impossibile passare a un buffer che non ha un nome" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID 'sign' non valido: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Impossibile cambiare segno %s" + msgid " (NOT FOUND)" msgstr " (NON TROVATO)" @@ -1090,20 +1124,37 @@ msgstr " (non supportata)" msgid "[Deleted]" msgstr "[Cancellato]" +msgid "No old files" +msgstr "Nessun file elaborato in precedenza" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Entro modalit Debug. Batti \"cont\" per continuare." +msgid "Oldval = \"%s\"" +msgstr "Vecchioval = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Nuovoval = \"%s\"" + #, c-format msgid "line %ld: %s" -msgstr "linea %ld: %s" +msgstr "riga %ld: %s" #, c-format msgid "cmd: %s" msgstr "com: %s" +msgid "frame is zero" +msgstr "al livello zero" + +#, c-format +msgid "frame at highest level: %d" +msgstr "al livello pi alto: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Pausa in \"%s%s\" linea %ld" +msgstr "Pausa in \"%s%s\" riga %ld" #, c-format msgid "E161: Breakpoint not found: %s" @@ -1114,7 +1165,11 @@ msgstr "Nessun 'breakpoint' definito" #, c-format msgid "%3d %s %s line %ld" -msgstr "%3d %s %s linea %ld" +msgstr "%3d %s %s riga %ld" + +#, c-format +msgid "%3d expr %s" +msgstr "%3d espr %s" msgid "E750: First use \":profile start {fname}\"" msgstr "E750: Usare prima \":profile start {fname}\"" @@ -1123,8 +1178,9 @@ msgstr "E750: Usare prima \":profile start {fname}\"" msgid "Save changes to \"%s\"?" msgstr "Salvare modifiche a \"%s\"?" -msgid "Untitled" -msgstr "Senza Nome" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Lavoro ancora in esecuzione nel buffer \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1132,8 +1188,7 @@ msgstr "E162: Buffer \"%s\" non salvato dopo modifica" msgid "Warning: Entered other buffer unexpectedly (check autocommands)" msgstr "" -"Attenzione: Entrato in altro buffer inaspettatamente (controllare " -"autocomandi)" +"Avviso: Entrato in altro buffer inaspettatamente (controllare autocomandi)" msgid "E163: There is only one file to edit" msgstr "E163: C' un solo file da elaborare" @@ -1157,8 +1212,18 @@ msgid "Searching for \"%s\"" msgstr "Cerco \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "non trovato in 'runtimepath': \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "non trovato in '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "" +"W20: Versione richiesta di python 2.x non supportata, ignoro il file: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "" +"W21: Versione richiesta di python 3.x non supportata, ignoro il file: %s" msgid "Source Vim script" msgstr "Esegui script Vim" @@ -1173,7 +1238,7 @@ msgstr "non riesco ad eseguire \"%s\"" #, c-format msgid "line %ld: could not source \"%s\"" -msgstr "linea %ld: non riesco ad eseguire \"%s\"" +msgstr "riga %ld: non riesco ad eseguire \"%s\"" #, c-format msgid "sourcing \"%s\"" @@ -1181,12 +1246,16 @@ msgstr "eseguo \"%s\"" #, c-format msgid "line %ld: sourcing \"%s\"" -msgstr "linea %ld: eseguo \"%s\"" +msgstr "riga %ld: eseguo \"%s\"" #, c-format msgid "finished sourcing %s" msgstr "esecuzione di %s terminata" +#, c-format +msgid "continuing in %s" +msgstr "continuo in %s" + msgid "modeline" msgstr "modeline" @@ -1203,7 +1272,7 @@ msgid "error handler" msgstr "gestore di errore" msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Attenzione: Separatore di linea errato, forse manca ^M" +msgstr "W15: Avviso: Separatore di riga errato, forse manca ^M" msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding usato fuori da un file di comandi" @@ -1253,12 +1322,12 @@ msgstr "Intervallo rovesciato, OK invertirlo" msgid "E494: Use w or w>>" msgstr "E494: Usa w oppure w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Tabella dei comandi da aggiornare, eseguire 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Spiacente, comando non disponibile in questa versione" -msgid "E172: Only one file name allowed" -msgstr "E172: Ammesso un solo nome file" - msgid "1 more file to edit. Quit anyway?" msgstr "1 ulteriore file da elaborare. Esco lo stesso?" @@ -1278,10 +1347,10 @@ msgstr "E174: Il comando esiste gi msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nome Arg. Inter Completo Definizione" +" Nome Arg. Indir. Completo Definizione" msgid "No user-defined commands found" msgstr "Non trovo comandi definiti dall'utente" @@ -1301,6 +1370,9 @@ msgstr "E178: Valore predefinito del contatore non valido" msgid "E179: argument required for -complete" msgstr "E179: argomento necessario per -complete" +msgid "E179: argument required for -addr" +msgstr "E179: argomento necessario per -addr" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Attributo non valido: %s" @@ -1319,13 +1391,17 @@ msgstr "E841: Nome riservato, non usabile in un comando definito dall'utente" msgid "E184: No such user-defined command: %s" msgstr "E184: Comando definito dall'utente %s inesistente" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Tipo di indirizzo non valido: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Valore %s non valido per 'complete'" msgid "E468: Completion argument only allowed for custom completion" msgstr "" -"E468: Argomento di completamento permesso solo per completamento " +"E468: Argomento di completamento consentito solo per completamento " "personalizzato" msgid "E467: Custom completion requires a function argument" @@ -1386,6 +1462,9 @@ msgstr "" msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos richiede due argomenti numerici" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Non possibile usare :redir all'interno di execute()" + msgid "Save Redirection" msgstr "Salva Redirezione" @@ -1410,7 +1489,6 @@ msgstr "E189: \"%s\" esiste (aggiungi ! per eseguire comunque)" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Non riesco ad aprire \"%s\" in scrittura" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "" "E191: L'argomento deve essere una lettera, oppure un apice/apice retroverso" @@ -1452,13 +1530,15 @@ msgstr "E500: Il valore msgid "E195: Cannot open viminfo file for reading" msgstr "E195: Non posso aprire il file viminfo in lettura" +msgid "Untitled" +msgstr "Senza Nome" + msgid "E196: No digraphs in this version" msgstr "E196: Digrammi non supportati in questa versione" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: Impossibile lanciare eccezioni con prefisso 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Eccezione lanciata: %s" @@ -1473,9 +1553,8 @@ msgstr "Eccezione scartata: %s" #, c-format msgid "%s, line %ld" -msgstr "%s, linea %ld" +msgstr "%s, riga %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Eccezione intercettata: %s" @@ -1501,7 +1580,6 @@ msgstr "Errore ed interruzione" msgid "Error" msgstr "Errore" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Interruzione" @@ -1544,15 +1622,12 @@ msgstr "E601: nidificazione di :try troppo estesa" msgid "E603: :catch without :try" msgstr "E603: :catch senza :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch dopo :finally" msgid "E606: :finally without :try" msgstr "E606: :finally senza :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: :finally multipli" @@ -1586,7 +1661,7 @@ msgstr "" "# %s Storia (da pi recente a meno recente):\n" msgid "Command Line" -msgstr "Linea di Comando" +msgstr "Riga di Comando" msgid "Search String" msgstr "Stringa di Ricerca" @@ -1595,7 +1670,10 @@ msgid "Expression" msgstr "Espressione" msgid "Input Line" -msgstr "Linea di Input" +msgstr "Riga di Input" + +msgid "Debug Line" +msgstr "Riga di Debug" msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar dopo la fine del comando" @@ -1642,7 +1720,6 @@ msgstr "Vim: Leggo da 'stdin'...\n" msgid "Reading from stdin..." msgstr "Leggo da 'stdin'..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: La conversione ha reso il file illeggibile!" @@ -1662,7 +1739,7 @@ msgid "[CR missing]" msgstr "[manca CR]" msgid "[long lines split]" -msgstr "[linee lunghe divise]" +msgstr "[righe lunghe divise]" msgid "[NOT converted]" msgstr "[NON convertito]" @@ -1670,19 +1747,13 @@ msgstr "[NON convertito]" msgid "[converted]" msgstr "[convertito]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[cifrato]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" -msgstr "[ERRORE DI CONVERSIONE alla linea %ld]" +msgstr "[ERRORE DI CONVERSIONE alla riga %ld]" #, c-format msgid "[ILLEGAL BYTE in line %ld]" -msgstr "[BYTE NON VALIDO alla linea %ld]" +msgstr "[BYTE NON VALIDO alla riga %ld]" msgid "[READ ERRORS]" msgstr "[ERRORI IN LETTURA]" @@ -1696,9 +1767,6 @@ msgstr "Conversione fallita con 'charconvert'" msgid "can't read output of 'charconvert'" msgstr "non riesco a leggere il risultato di 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: File cifrato con metodo sconosciuto" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Nessun autocomando corrispondente per buffer acwrite" @@ -1706,7 +1774,7 @@ msgid "E203: Autocommands deleted or unloaded buffer to be written" msgstr "E203: Buffer in scrittura cancellato o scaricato dagli autocomandi" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: L'autocomando ha modificato numero linee in maniera imprevista" +msgstr "E204: L'autocomando ha modificato numero righe in maniera imprevista" msgid "NetBeans disallows writes of unmodified buffers" msgstr "NetBeans non permette la scrittura di un buffer non modificato" @@ -1746,11 +1814,6 @@ msgid "E510: Can't make backup file (add ! to override)" msgstr "" "E510: Non posso fare il file di backup (aggiungi ! per eseguire comunque)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "" -"E460: La 'fork' sulla risorsa verrebbe persa (aggiungi ! per eseguire " -"comunque)" - msgid "E214: Can't find temp file for writing" msgstr "E214: Non riesco a trovare un file 'temp' su cui scrivere" @@ -1764,8 +1827,8 @@ msgstr "E166: Non posso aprire il file collegato ('linked') in scrittura" msgid "E212: Can't open file for writing" msgstr "E212: Non posso aprire il file in scrittura" -msgid "E667: Fsync failed" -msgstr "E667: Fsync fallito" +msgid "E949: File changed while writing" +msgstr "E949: File modificato in fase di riscrittura" msgid "E512: Close failed" msgstr "E512: Chiusura fallita" @@ -1780,8 +1843,8 @@ msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: errore in scrittura, conversione fallita alla linea %ld (rendere " -"'fenc' nullo per eseguire comunque)" +"E513: errore in scrittura, conversione fallita alla riga %ld (rendere 'fenc' " +"nullo per eseguire comunque)" msgid "E514: write error (file system full?)" msgstr "E514: errore in scrittura ('File System' pieno?)" @@ -1791,7 +1854,7 @@ msgstr " ERRORE DI CONVERSIONE" #, c-format msgid " in line %ld;" -msgstr " alla linea %ld;" +msgstr " alla riga %ld;" msgid "[Device]" msgstr "[Dispositivo]" @@ -1825,7 +1888,7 @@ msgid "" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"ATTENZIONE: Il file originale pu essere perso o danneggiato\n" +"AVVISO: Il file originale pu essere perso o danneggiato\n" msgid "don't quit the editor until the file is successfully written!" msgstr "non uscire dall'editor prima della fine della scrittura del file!" @@ -1837,23 +1900,23 @@ msgid "[dos format]" msgstr "[in formato DOS]" msgid "[mac]" -msgstr "[MAC]" +msgstr "[Mac]" msgid "[mac format]" -msgstr "[in formato MAC]" +msgstr "[in formato Mac]" msgid "[unix]" -msgstr "[UNIX]" +msgstr "[Unix]" msgid "[unix format]" -msgstr "[in formato UNIX]" +msgstr "[in formato Unix]" msgid "1 line, " -msgstr "1 linea, " +msgstr "1 riga, " #, c-format msgid "%ld lines, " -msgstr "%ld linee," +msgstr "%ld righe," msgid "1 character" msgstr "1 carattere" @@ -1862,22 +1925,14 @@ msgstr "1 carattere" msgid "%lld characters" msgstr "%lld caratteri" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld caratteri" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" -msgstr "[Manca carattere di fine linea]" +msgstr "[Manca carattere di fine riga]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" -msgstr "ATTENZIONE: File modificato dopo essere stato letto dall'Editor!!!" +msgstr "AVVISO: File modificato dopo essere stato letto!!!" msgid "Do you really want to write to it" msgstr "Vuoi davvero riscriverlo" @@ -1906,31 +1961,31 @@ msgid "" "W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " "well" msgstr "" -"W12: Attenzione: File \"%s\" modificato su disco ed anche nel buffer di Vim" +"W12: Avviso: File \"%s\" modificato su disco ed anche nel buffer di Vim" msgid "See \":help W12\" for more info." msgstr "Vedere \":help W12\" per ulteriori informazioni." #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Attenzione: File \"%s\" modificato dopo l'apertura" +msgstr "W11: Avviso: File \"%s\" modificato dopo l'apertura" msgid "See \":help W11\" for more info." msgstr "Vedere \":help W11\" per ulteriori informazioni." #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" -msgstr "W16: Attenzione: Modo File \"%s\" modificato dopo l'apertura" +msgstr "W16: Avviso: Modo File \"%s\" modificato dopo l'apertura" msgid "See \":help W16\" for more info." msgstr "Vedere \":help W16\" per ulteriori informazioni." #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Attenzione: Il file \"%s\" risulta creato dopo l'apertura" +msgstr "W13: Avviso: Il file \"%s\" risulta creato dopo l'apertura" msgid "Warning" -msgstr "Attenzione" +msgstr "Avviso" msgid "" "&OK\n" @@ -1954,11 +2009,16 @@ msgstr "--Cancellato--" msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "auto-rimozione dell'autocomando: %s <buffer=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Gruppo inesistente: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: Non posso cancellare il gruppo corrente" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Cancello augroup, ma ancora in uso" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Carattere non ammesso dopo *: %s" @@ -1971,7 +2031,6 @@ msgstr "E216: Evento inesistente: %s" msgid "E216: No such group or event: %s" msgstr "E216: Evento o gruppo inesistente: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2014,14 +2073,15 @@ msgid "E490: No fold found" msgstr "E490: Non trovo alcuna piegatura" msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: Non posso create piegatura con il 'foldmethod' in uso" +msgstr "E350: Non posso creare piegatura con il 'foldmethod' in uso" msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: Non posso cancellare piegatura con il 'foldmethod' in uso" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld linee piegate" +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld riga piegata " +msgstr[1] "+--%3ld righe piegate " msgid "E222: Add to read buffer" msgstr "E222: Aggiunto al buffer di lettura" @@ -2114,6 +2174,18 @@ msgstr "Dialogo Vim" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: Non riesco a creare 'BalloonEval' con sia messaggio che callback" +msgid "_Cancel" +msgstr "_Annulla" + +msgid "_Save" +msgstr "_Salva" + +msgid "_Open" +msgstr "_Apri" + +msgid "_OK" +msgstr "_OK" + msgid "" "&Yes\n" "&No\n" @@ -2123,6 +2195,12 @@ msgstr "" "&No\n" "&C Ignora" +msgid "Yes" +msgstr "S" + +msgid "No" +msgstr "No" + msgid "Input _Methods" msgstr "_Metodi di inserimento" @@ -2138,41 +2216,38 @@ msgstr "Trova cosa:" msgid "Replace with:" msgstr "Sostituisci con:" -#. whole word only button msgid "Match whole word only" msgstr "Cerca solo la parola intera" -#. match case button msgid "Match case" msgstr "Maiuscole/minuscole" msgid "Direction" msgstr "Direzione" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Su" msgid "Down" msgstr "Gi" -#. 'Find Next' button msgid "Find Next" msgstr "Trova il Prossimo" -#. 'Replace' button msgid "Replace" msgstr "Sostituisci" -#. 'Replace All' button msgid "Replace All" msgstr "Sostituisci Tutto" +msgid "_Close" +msgstr "_Chiudi" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: Ricevuta richiesta \"die\" dal session manager\n" -msgid "Close" -msgstr "Chiusura" +msgid "Close tab" +msgstr "Chiudi linguetta" msgid "New tab" msgstr "Nuova linguetta" @@ -2219,20 +2294,6 @@ msgstr "&A Sostituisci Tutto" msgid "&Undo" msgstr "&U Disfa" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Non trovo il titolo della finestra \"%s\"" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argomento non supportato: \"-%s\"; Usa la versione OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Non posso aprire la finestra in un'applicazione MDI" - -msgid "Close tab" -msgstr "Chiudi linguetta" - msgid "Open tab..." msgstr "Apri linguetta..." @@ -2242,14 +2303,23 @@ msgstr "Stringa di ricerca (usa '\\\\' per cercare un '\\')" msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "Sostituisci (usa '\\\\' per cercare un '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Non Utilizzato" msgid "Directory\t*.nothing\n" msgstr "Directory\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Non trovo il titolo della finestra \"%s\"" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argomento non supportato: \"-%s\"; Usa la versione OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Non posso aprire la finestra in un'applicazione MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: Non riesco ad allocare elemento di colormap, possibili colori " @@ -2306,7 +2376,6 @@ msgstr "Vim - Selettore Font" msgid "Name:" msgstr "Nome:" -#. create toggle button msgid "Show size in Points" msgstr "Mostra dimensione in Punti" @@ -2341,6 +2410,7 @@ msgstr "Pagina %d" msgid "No text to be printed" msgstr "Manca testo da stampare" +#, c-format msgid "Printing page %d (%d%%)" msgstr "Sto stampando pagina %d (%d%%)" @@ -2511,6 +2581,7 @@ msgstr "%-5s: %s%*s (Uso: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2521,6 +2592,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: Trova assegnazioni a questo simbolo\n" " c: Trova funzioni che chiamano questa\n" " d: Trova funzioni chiamate da questa\n" " e: Trova questa espressione egrep\n" @@ -2528,7 +2600,7 @@ msgstr "" " g: Trova questa definizione\n" " i: Trova file che #includono questo file\n" " s: Trova questo simbolo C\n" -" t: Trova questa stringa\n" +" t: Trova questa stringa di testo\n" #, c-format msgid "E625: cannot open cscope database: %s" @@ -2548,7 +2620,6 @@ msgstr "E261: connessione cscope %s non trovata" msgid "cscope connection %s closed" msgstr "connessione cscope %s chiusa" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: errore irreparabile in cs_manage_matches" @@ -2561,10 +2632,10 @@ msgid "" " # line" msgstr "" "\n" -" # linea" +" # riga" msgid "filename / context / line\n" -msgstr "nomefile / contest / linea\n" +msgstr "nomefile / contest / riga\n" #, c-format msgid "E609: Cscope error: %s" @@ -2592,6 +2663,13 @@ msgstr "" "E815: Spiacente, comando non disponibile, non riesco a caricare librerie " "programmi MzScheme." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E815: Spiacente, comando non disponibile, non riesco a caricare modulo " +"racket/base di MzScheme." + msgid "invalid expression" msgstr "espressione non valida" @@ -2611,13 +2689,13 @@ msgid "couldn't open buffer" msgstr "non sono riuscito ad aprire il buffer" msgid "cannot delete line" -msgstr "non posso cancellare la linea" +msgstr "non posso cancellare la riga" msgid "cannot replace line" -msgstr "non posso sostituire la linea" +msgstr "non posso sostituire la riga" msgid "cannot insert line" -msgstr "non posso inserire la linea" +msgstr "non posso inserire la riga" msgid "string cannot contain newlines" msgstr "la stringa non pu contenere caratteri 'A CAPO'" @@ -2638,7 +2716,7 @@ msgid "window is invalid" msgstr "finestra non valida" msgid "linenr out of range" -msgstr "numero linea non nell'intervallo" +msgstr "numero riga non nell'intervallo" msgid "not allowed in the Vim sandbox" msgstr "non ammesso in ambiente protetto" @@ -2646,9 +2724,6 @@ msgstr "non ammesso in ambiente protetto" msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Python: Impossibile usare :py e :py3 nella stessa sessione" -msgid "E837: This Vim cannot execute :py3 after using :python" -msgstr "E837: Impossibile usare ora :py3 dopo aver usato :python" - msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." @@ -2656,14 +2731,18 @@ msgstr "" "E263: Spiacente, comando non disponibile, non riesco a caricare libreria " "programmi Python." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Spiacente, comando non disponibile, non riesco a caricare il modulo " +"Python locale." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Python non pu essere chiamato ricorsivamente" -msgid "line number out of range" -msgstr "numero linea non nell'intervallo" - -msgid "invalid mark name" -msgstr "nome di mark non valido" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Impossibile usare ora :py3 dopo aver usato :python" msgid "E265: $_ must be an instance of String" msgstr "E265: $_ deve essere un'istanza di String" @@ -2692,98 +2771,9 @@ msgstr "E271: retry fuori da clausola rescue" msgid "E272: unhandled exception" msgstr "E272: eccezione non gestita" -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: tipo sconosciuto di salto nel programma %d" - -msgid "Toggle implementation/definition" -msgstr "Implementazione/definizione S/No" - -msgid "Show base class of" -msgstr "Visualizza classe base di" - -msgid "Show overridden member function" -msgstr "Visualizza funzione modulo sovrascritto" - -msgid "Retrieve from file" -msgstr "Carica da file" - -msgid "Retrieve from project" -msgstr "Carica da progetto" - -msgid "Retrieve from all projects" -msgstr "Carica da tutti i progetti" - -msgid "Retrieve" -msgstr "Carica successivo" - -msgid "Show source of" -msgstr "Visualizza sorgente di" - -msgid "Find symbol" -msgstr "Trova simbolo" - -msgid "Browse class" -msgstr "Esplora classe" - -msgid "Show class in hierarchy" -msgstr "Visualizza classe in gerarchia" - -msgid "Show class in restricted hierarchy" -msgstr "Visualizza classe nella gerarchia ristretta" - -msgid "Xref refers to" -msgstr "Xref si riferisce a" - -msgid "Xref referred by" -msgstr "Xref referenziato da" - -msgid "Xref has a" -msgstr "Xref ha un" - -msgid "Xref used by" -msgstr "Xref usato da" - -msgid "Show docu of" -msgstr "Visualizza docu di" - -msgid "Generate docu for" -msgstr "Genera docu per" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"Non riesco a connettermi a SNiFF+. Controllare ambiente (sniffemacs deve " -"essere presente in $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Errore in lettura. Disconnessione." - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ al momento " - -msgid "not " -msgstr "non " - -msgid "connected" -msgstr "connesso" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Richiesta SNiFF+ sconosciuta: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Errore di connessione a SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ non connesso" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Non un buffer SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Errore in scrittura. Disconnesso" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: tipo sconosciuto di salto nel programma %d" msgid "invalid buffer number" msgstr "numero buffer non valido" @@ -2791,9 +2781,11 @@ msgstr "numero buffer non valido" msgid "not implemented yet" msgstr "non ancora implementato" -#. ??? msgid "cannot set line(s)" -msgstr "non posso impostare linea(e)" +msgstr "non posso impostare riga(he)" + +msgid "invalid mark name" +msgstr "nome di mark non valido" msgid "mark not set" msgstr "mark non impostato" @@ -2803,7 +2795,10 @@ msgid "row %d column %d" msgstr "riga %d colonna %d" msgid "cannot insert/append line" -msgstr "non riesco a inserire/aggiungere linea" +msgstr "non riesco a inserire/aggiungere riga" + +msgid "line number out of range" +msgstr "numero riga non nell'intervallo" msgid "unknown flag: " msgstr "opzione inesistente: " @@ -2826,7 +2821,6 @@ msgid "" msgstr "" "non posso registrare comando callback: buffer/finestra gi in cancellazione" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2850,7 +2844,7 @@ msgid "E572: exit code %d" msgstr "E572: codice di uscita %d" msgid "cannot get line" -msgstr "non riesco a ottenere la linea" +msgstr "non riesco a ottenere la riga" msgid "Unable to register a command server name" msgstr "Non riesco a registrare un nome di server comando" @@ -2865,6 +2859,18 @@ msgstr "E573: Identificativo di server non valido: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: Propriet registry relative a VIM non adeguate. Cancellate!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Chiave duplicata in JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Manca virgola nella Lista: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Manca ']' a fine Lista: %s" + msgid "Unknown option argument" msgstr "Argomento di opzione sconosciuto" @@ -2890,12 +2896,12 @@ msgstr "%d file da elaborare\n" msgid "netbeans is not supported with this GUI\n" msgstr "netbeans non supportato con questa GUI\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Vim non compilato con funzionalit 'diff'." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' non disponibile: non abilitato in compilazione\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Vim non compilato con funzionalit 'diff'." + msgid "Attempt to open script file again: \"" msgstr "Tento di riaprire lo script file: \"" @@ -2908,15 +2914,18 @@ msgstr "Non posso aprire come script output: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: Errore: Avvio di gvim da NetBeans non riuscito\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "" +"Vim: Errore: Questa versione di Vim non funziona in un terminale Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" -msgstr "Vim: Attenzione: Output non diretto a un terminale\n" +msgstr "Vim: Avviso: Output non diretto a un terminale\n" msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Attenzione: Input non proveniente da un terminale\n" +msgstr "Vim: Avviso: Input non proveniente da un terminale\n" -#. just in case.. msgid "pre-vimrc command line" -msgstr "linea comandi prima di vimrc" +msgstr "riga comandi prima di vimrc" #, c-format msgid "E282: Cannot read from \"%s\"" @@ -3072,11 +3081,17 @@ msgstr "-F\t\t\tComincia in modalit msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminale>\tImposta tipo terminale a <terminale>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tNon avvisare se input/output non da terminale" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tEsce se l'input o l'output non sono da un terminale" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" -msgstr "-u <vimrc>\t\tUsa <vimrc> invece di .vimrc" +msgstr "-u <vimrc>\t\tUsa <vimrc> invece di qualche .vimrc" msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc" -msgstr "-U <gvimrc>\t\tUsa <gvimrc> invece di .gvimrc" +msgstr "-U <gvimrc>\t\tUsa <gvimrc> invece di qualche .gvimrc" msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tNon caricare script plugin" @@ -3094,7 +3109,7 @@ msgid "+\t\t\tStart at end of file" msgstr "+\t\t\tPosizionati alla fine del file" msgid "+<lnum>\t\tStart at line <lnum>" -msgstr "+<lnum>\t\tPosizionati alla linea <lnum>" +msgstr "+<lnum>\t\tPosizionati alla riga <lnum>" msgid "--cmd <command>\tExecute <command> before loading any vimrc file" msgstr "" @@ -3167,6 +3182,9 @@ msgstr "" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tUsa <viminfo> invece di .viminfo" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible', default di Vim, no plugin, no viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h opp. --help\tStampa Aiuto (questo messaggio) ed esci" @@ -3267,11 +3285,9 @@ msgstr "--windowid <HWND>\tApri Vim dentro un altro widget win32" msgid "No display" msgstr "Manca display" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": Invio fallito.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": Invio fallito. Tento di eseguire localmente\n" @@ -3292,29 +3308,26 @@ msgstr "Nessun mark impostato" msgid "E283: No marks matching \"%s\"" msgstr "E283: Nessun mark corrispondente a \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" msgstr "" "\n" -"mark linea col.file/testo" +"mark riga col.file/testo" -#. Highlight title msgid "" "\n" " jump line col file/text" msgstr "" "\n" -" salt.linea col.file/testo" +" salt.riga col.file/testo" -#. Highlight title msgid "" "\n" "change line col text" msgstr "" "\n" -"modif linea col testo" +"modif riga col testo" msgid "" "\n" @@ -3323,7 +3336,6 @@ msgstr "" "\n" "# File mark:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3354,7 +3366,7 @@ msgid "E286: Failed to open input method" msgstr "E286: Apertura 'input method' fallita" msgid "E287: Warning: Could not set destroy callback to IM" -msgstr "E287: Attenzione: Non posso assegnare IM a 'destroy callback'" +msgstr "E287: Avviso: Non posso assegnare IM a 'destroy callback'" msgid "E288: input method doesn't support any style" msgstr "E288: 'input method' non sopporta alcuno stile" @@ -3392,7 +3404,6 @@ msgstr "E298: Non riesco a leggere blocco numero 2?" msgid "E843: Error while updating swap file crypt" msgstr "E843: Errore aggiornando cifratura dello swap file" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Ahim, lo swap file perduto!!!" @@ -3470,7 +3481,7 @@ msgstr "File originale \"%s\"" msgid "E308: Warning: Original file may have been changed" msgstr "" -"E308: Attenzione: il file originale pu essere stato modificato nel frattempo" +"E308: Avviso: il file originale pu essere stato modificato nel frattempo" #, c-format msgid "Swap file is encrypted: \"%s\"" @@ -3509,16 +3520,16 @@ msgid "E309: Unable to read block 1 from %s" msgstr "E309: Impossibile leggere blocco 1 da %s" msgid "???MANY LINES MISSING" -msgstr "???MOLTE LINEE MANCANTI" +msgstr "???MOLTE RIGHE MANCANTI" msgid "???LINE COUNT WRONG" -msgstr "???CONTATORE LINEE ERRATO" +msgstr "???CONTATORE RIGHE ERRATO" msgid "???EMPTY BLOCK" msgstr "???BLOCCO VUOTO" msgid "???LINES MISSING" -msgstr "???LINEE MANCANTI" +msgstr "???RIGHE MANCANTI" #, c-format msgid "E310: Block 1 ID wrong (%s not a .swp file?)" @@ -3528,11 +3539,11 @@ msgid "???BLOCK MISSING" msgstr "???BLOCCO MANCANTE" msgid "??? from here until ???END lines may be messed up" -msgstr "??? da qui fino a ???END le linee possono essere fuori ordine" +msgstr "??? da qui fino a ???END le righe possono essere fuori ordine" msgid "??? from here until ???END lines may have been inserted/deleted" msgstr "" -"??? da qui fino a ???END linee possono essere state inserite/cancellate" +"??? da qui fino a ???END righe possono essere state inserite/cancellate" msgid "???END" msgstr "???END" @@ -3542,7 +3553,7 @@ msgstr "E311: Recupero Interrotto" msgid "" "E312: Errors detected while recovering; look for lines starting with ???" -msgstr "E312: Errori durante recupero; controlla linee che iniziano con ???" +msgstr "E312: Errori durante recupero; controlla righe che iniziano con ???" msgid "See \":help E312\" for more information." msgstr "Vedere \":help E312\" per ulteriori informazioni." @@ -3576,7 +3587,6 @@ msgstr "" msgid "Using crypt key from swap file for the text file.\n" msgstr "Uso la chiave di cifratura del file swap per il file di testo.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Swap file trovati:" @@ -3681,11 +3691,11 @@ msgstr "E314: Preservazione fallita" #, c-format msgid "E315: ml_get: invalid lnum: %ld" -msgstr "E315: ml_get: numero linea non valido: %ld" +msgstr "E315: ml_get: numero riga non valido: %ld" #, c-format msgid "E316: ml_get: cannot find line %ld" -msgstr "E316: ml_get: non riesco a trovare la linea %ld" +msgstr "E316: ml_get: non riesco a trovare la riga %ld" msgid "E317: pointer block id wrong 3" msgstr "E317: ID blocco puntatori errato 3" @@ -3704,7 +3714,7 @@ msgstr "cancellato blocco 1?" #, c-format msgid "E320: Cannot find line %ld" -msgstr "E320: Non riesco a trovare la linea %ld" +msgstr "E320: Non riesco a trovare la riga %ld" msgid "E317: pointer block id wrong" msgstr "E317: ID blocco puntatori errato" @@ -3714,11 +3724,11 @@ msgstr "pe_line_count a zero" #, c-format msgid "E322: line number out of range: %ld past the end" -msgstr "E322: numero linea non ammissibile: %ld dopo la fine" +msgstr "E322: numero riga non ammissibile: %ld dopo la fine" #, c-format msgid "E323: line count wrong in block %ld" -msgstr "E323: contatore linee errato nel blocco %ld" +msgstr "E323: contatore righe errato nel blocco %ld" msgid "Stack size increases" msgstr "Dimensione stack aumentata" @@ -3746,21 +3756,16 @@ msgstr "Mentre aprivo file \"" msgid " NEWER than swap file!\n" msgstr " pi RECENTE dello swap file!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Un altro programma pu essere in edit sullo stesso file.\n" -" Se cos, attenzione a non trovarti con due versioni\n" -" differenti dello stesso file a cui vengono apportate modifiche." - -msgid " Quit, or continue with caution.\n" -msgstr " Esci, o continua con prudenza.\n" +"(1) Un altro programma pu essere in edit sullo stesso file. Se cos,\n" +" attenzione a non finire con due sessioni differenti che modificano lo\n" +" stesso file. Uscire da Vim, o continuare con cautela.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) Una sessione di edit per questo file finita male.\n" @@ -3839,7 +3844,6 @@ msgstr "E328: I Menu esistono solo in un'altra modalit msgid "E329: No menu \"%s\"" msgstr "E329: Nessun Menu \"%s\"" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: Nome menu non valido" @@ -3853,8 +3857,6 @@ msgstr "" msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Il separatore non pu far parte di un percorso di Menu" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3865,6 +3867,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Togli questo Menu" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Menu non definito per la modalit %s" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: Il percorso Menu deve condurre ad un elemento Menu" @@ -3872,10 +3878,6 @@ msgstr "E333: Il percorso Menu deve condurre ad un elemento Menu" msgid "E334: Menu not found: %s" msgstr "E334: Menu non trovato: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Menu non definito per la modalit %s" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: Il percorso Menu deve condurre ad un sotto-Menu" @@ -3888,7 +3890,7 @@ msgstr "Errore/i eseguendo %s:" #, c-format msgid "line %4ld:" -msgstr "linea %4ld:" +msgstr "riga %4ld:" #, c-format msgid "E354: Invalid register name: '%s'" @@ -3905,13 +3907,13 @@ msgstr "Premi INVIO o un comando per proseguire" #, c-format msgid "%s line %ld" -msgstr "%s linea %ld" +msgstr "%s riga %ld" msgid "-- More --" msgstr "-- Ancora --" msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " -msgstr " SPAZIO/d/j: schermo/pagina/linea gi, b/u/k: su, q: abbandona " +msgstr " SPAZIO/d/j: schermo/pagina/riga gi, b/u/k: su, q: abbandona " msgid "Question" msgstr "Domanda" @@ -3945,7 +3947,6 @@ msgstr "Salva File dialogo" msgid "Open File dialog" msgstr "Apri File dialogo" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "E338: Spiacente, niente esplorazione file in modalit console" @@ -3953,13 +3954,13 @@ msgid "E766: Insufficient arguments for printf()" msgstr "E766: Argomenti non sufficienti per printf()" msgid "E807: Expected Float argument for printf()" -msgstr "E807: Numero con virgola atteso come argomento per printf()" +msgstr "E807: Numero-a-virgola-mobile atteso come argomento per printf()" msgid "E767: Too many arguments to printf()" msgstr "E767: Troppi argomenti per printf()" msgid "W10: Warning: Changing a readonly file" -msgstr "W10: Attenzione: Modifica a un file in sola-lettura" +msgstr "W10: Avviso: Modifica a un file in sola-lettura" msgid "Type number and <Enter> or click with mouse (empty cancels): " msgstr "" @@ -3969,18 +3970,18 @@ msgid "Type number and <Enter> (empty cancels): " msgstr "Inserire numero e <Invio> (vuoto per annullare): " msgid "1 more line" -msgstr "1 linea in pi" +msgstr "1 riga in pi" msgid "1 line less" -msgstr "1 linea in meno" +msgstr "1 riga in meno" #, c-format msgid "%ld more lines" -msgstr "%ld linee in pi" +msgstr "%ld righe in pi" #, c-format msgid "%ld fewer lines" -msgstr "%ld linee in meno" +msgstr "%ld righe in meno" msgid " (Interrupted)" msgstr " (Interrotto)" @@ -3988,13 +3989,6 @@ msgstr " (Interrotto)" msgid "Beep!" msgstr "Beep!" -msgid "Vim: preserving files...\n" -msgstr "Vim: preservo file...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Finito.\n" - msgid "ERROR: " msgstr "ERRORE: " @@ -4015,7 +4009,7 @@ msgstr "" "\n" msgid "E340: Line is becoming too long" -msgstr "E340: La linea sta diventando troppo lunga" +msgstr "E340: La riga sta diventando troppo lunga" #, c-format msgid "E341: Internal error: lalloc(%ld, )" @@ -4044,15 +4038,6 @@ msgstr "E548: aspettavo un numero" msgid "E549: Illegal percentage" msgstr "E549: Percentuale non valida" -msgid "Enter encryption key: " -msgstr "Immetti chiave di cifratura: " - -msgid "Enter same key again: " -msgstr "Ribatti per conferma la stessa chiave: " - -msgid "Keys don't match!" -msgstr "Le chiavi non corrispondono!" - msgid "E854: path too long for completion" msgstr "E854: percorso troppo lungo per il completamento" @@ -4080,20 +4065,11 @@ msgstr "E346: Nessun altra directory \"%s\" trovata nel 'cdpath'" msgid "E347: No more file \"%s\" found in path" msgstr "E347: Nessun altro file \"%s\" trovato nel percorso" -msgid "Cannot connect to Netbeans #2" -msgstr "Non posso connettermi a Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "Non posso connettermi a Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: Modalit errata di accesso a file info connessione NetBeans: \"%s\"" -msgid "read from Netbeans socket" -msgstr "lettura da socket Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Connessione NetBeans persa per il buffer %ld" @@ -4118,7 +4094,7 @@ msgid "E775: Eval feature not available" msgstr "E775: Funzionalit [eval] non disponibile" msgid "Warning: terminal cannot highlight" -msgstr "Attenzione: il terminale non in grado di evidenziare" +msgstr "Avviso: il terminale non in grado di evidenziare" msgid "E348: No string under cursor" msgstr "E348: Nessuna stringa sotto il cursore" @@ -4135,73 +4111,78 @@ msgstr "E662: All'inizio della lista modifiche" msgid "E663: At end of changelist" msgstr "E663: Alla fine della lista modifiche" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Batti :quit<Invio> per uscire da Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "Batti :qa! e premi <Invio> per ignorare le modifiche e uscire da Vim" #, c-format msgid "1 line %sed 1 time" -msgstr "1 linea %sa 1 volta" +msgstr "1 riga %sa 1 volta" #, c-format msgid "1 line %sed %d times" -msgstr "1 linea %sa %d volte" +msgstr "1 riga %sa %d volte" #, c-format msgid "%ld lines %sed 1 time" -msgstr "%ld linee %se 1 volta" +msgstr "%ld righe %se 1 volta" #, c-format msgid "%ld lines %sed %d times" -msgstr "%ld linee %se %d volte" +msgstr "%ld righe %se %d volte" #, c-format msgid "%ld lines to indent... " -msgstr "%ld linee da rientrare... " +msgstr "%ld righe da rientrare... " msgid "1 line indented " -msgstr "1 linea rientrata " +msgstr "1 riga rientrata " #, c-format msgid "%ld lines indented " -msgstr "%ld linee rientrate " +msgstr "%ld righe rientrate " msgid "E748: No previously used register" msgstr "E748: Nessun registro usato in precedenza" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "non riesco a salvare in un registro; cancello comunque" msgid "1 line changed" -msgstr "1 linea cambiata" +msgstr "1 riga cambiata" #, c-format msgid "%ld lines changed" -msgstr "%ld linee cambiate" +msgstr "%ld righe cambiate" #, c-format msgid "freeing %ld lines" -msgstr "libero %ld linee" +msgstr "libero %ld righe" -msgid "block of 1 line yanked" -msgstr "blocco di 1 linea messo in registro" +#, c-format +msgid " into \"%c" +msgstr " in \"%c" + +# +#, c-format +msgid "block of 1 line yanked%s" +msgstr "blocco di 1 riga messo in registro%s" -msgid "1 line yanked" -msgstr "1 linea messa in registro" +#, c-format +msgid "1 line yanked%s" +msgstr "1 riga messa in registro%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "blocco di %ld linee messo in registro" +msgid "block of %ld lines yanked%s" +msgstr "blocco di %ld righe messo in registro%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld linee messe in registro" +msgid "%ld lines yanked%s" +msgstr "%ld righe messe in registro%s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: Niente nel registro %s" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4223,40 +4204,45 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Tipo di registro sconosciuto: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: espressione di ricerca e registro dell'espressione non possono " +"contenere due o pi righe" + #, c-format msgid "%ld Cols; " msgstr "%ld Col.; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Selezionate %s%ld di %ld Linee; %ld di %ld Parole; %ld di %ld Caratt." +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "" +"Selezionate %s%ld di %ld Righe; %lld di %lld Parole; %lld di %lld Caratt." #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"Selezionate %s%ld di %ld Linee; %ld di %ld Parole; %ld di %ld Caratt.; %ld " -"di %ld Byte" +"Selezionate %s%ld di %ld Righe; %lld di %lld Parole; %lld di %lld Caratt.; " +"%lld di %lld Byte" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Col. %s di %s; Linea %ld di %ld; Parola %ld di %ld; Caratt. %ld di %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "" +"Col. %s di %s; Riga %ld di %ld; Parola %lld di %lld; Caratt. %lld di %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Col. %s di %s; Linea %ld di %ld; Parola %ld di %ld; Caratt. %ld di %ld; Byte " -"%ld di %ld" - -#, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld per BOM)" +"Col. %s di %s; Riga %ld di %ld; Parola %lld di %lld; Caratt. %lld di %lld; " +"Byte %lld di %lld" -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Pagina %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld per BOM)" msgid "Thanks for flying Vim" msgstr "Grazie per aver volato con Vim" @@ -4283,6 +4269,10 @@ msgstr "E522: Non trovato in 'termcap'" msgid "E539: Illegal character <%s>" msgstr "E539: Carattere non ammesso <%s>" +#, c-format +msgid "For option %s" +msgstr "Per opzione %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: Non posso assegnare a 'term' il valore 'stringa nulla'" @@ -4304,6 +4294,9 @@ msgstr "E835: Conflitto con il valore di 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Non pu essere cambiato nella GUI GTK+ 2" +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Non si pu convertire da %s a %s" + msgid "E524: Missing colon" msgstr "E524: Manca ':'" @@ -4361,15 +4354,23 @@ msgstr "E541: troppi elementi" msgid "E542: unbalanced groups" msgstr "E542: gruppi sbilanciati" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "" +"E946: Non posso aprire un terminale mentre ci sono lavori modificabili in " +"esecuzione" + msgid "E590: A preview window already exists" msgstr "E590: Una finestra di pre-visualizzazione esiste gi" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "W17: Arabo richiede UTF-8, esegui ':set encoding=utf-8'" +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: colori a 24-bit non supportati in questo ambiente" + #, c-format msgid "E593: Need at least %d lines" -msgstr "E593: Servono almeno %d linee" +msgstr "E593: Servono almeno %d righe" #, c-format msgid "E594: Need at least %d columns" @@ -4379,9 +4380,6 @@ msgstr "E594: Servono almeno %d colonne" msgid "E355: Unknown option: %s" msgstr "E355: Opzione inesistente: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: Ci vuole un numero: &%s = '%s'" @@ -4454,7 +4452,6 @@ msgstr "non posso modificare modalit msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: non una console??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Non posso eseguire lo shell con l'opzione -f" @@ -4476,9 +4473,6 @@ msgstr "ERRORE I/O" msgid "Message" msgstr "Messaggio" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' non vale 80, non riesco ad eseguire comandi esterni" - msgid "E237: Printer selection failed" msgstr "E237: Scelta stampante non riuscita" @@ -4503,18 +4497,12 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Nome di charset non ammesso \"%s\" nel fonte di nome \"%s\"" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Carattere non ammesso '%c' nel font di nome \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: Segnale doppio, esco\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Nome di qualit non ammesso \"%s\" nel font di nome \"%s\"" #, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: Intercettato segnale fatale %s\n" - -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: Intercettato segnale fatale\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Carattere non ammesso '%c' nel font di nome \"%s\"" #, c-format msgid "Opening the X display took %ld msec" @@ -4547,12 +4535,13 @@ msgstr "" "\n" "Non posso impostare il contesto di sicurezza per " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Non riesco a eseguire shell " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Non posso impostare il contesto di sicurezza %s per %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Non posso ottenere il contesto di sicurezza %s per %s. Lo rimuovo!" msgid "" "\n" @@ -4582,6 +4571,13 @@ msgstr "" "\n" "Non riesco ad effettuare 'fork'\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Non riesco a eseguire shell " + msgid "" "\n" "Command terminated\n" @@ -4613,7 +4609,7 @@ msgid "XSMP SmcOpenConnection failed: %s" msgstr "XSMP SmcOpenConnection fallita: %s" msgid "At line" -msgstr "Alla linea" +msgstr "Alla riga" msgid "Could not load vim32.dll!" msgstr "Non riesco a caricare vim32.dll!" @@ -4624,10 +4620,6 @@ msgstr "Errore VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "Non sono riuscito a impostare puntatori di funzione verso la DLL!" -#, c-format -msgid "shell returned %d" -msgstr "shell terminato con return-code %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Intercettato evento %s\n" @@ -4656,21 +4648,33 @@ msgstr "" msgid "Vim Warning" msgstr "Avviso da Vim" +#, c-format +msgid "shell returned %d" +msgstr "shell terminato con return-code %d" + +msgid "E926: Current location list was changed" +msgstr "E926: La lista delle locazioni corrente stata cambiata" + +#, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: Troppi %%%c nella stringa di 'format'" +#, c-format msgid "E373: Unexpected %%%c in format string" msgstr "E373: %%%c imprevisto nella stringa di 'format'" msgid "E374: Missing ] in format string" msgstr "E374: Manca ] nella stringa di 'format'" +#, c-format msgid "E375: Unsupported %%%c in format string" msgstr "E375: %%%c non supportato nella stringa di 'format'" +#, c-format msgid "E376: Invalid %%%c in format string prefix" msgstr "E376: %%%c non valido nel prefisso della stringa di 'format'" +#, c-format msgid "E377: Invalid %%%c in format string" msgstr "E377: %%%c non valido nella stringa di 'format'" @@ -4683,12 +4687,22 @@ msgstr "E379: Nome directory mancante o nullo" msgid "E553: No more items" msgstr "E553: Non ci sono pi elementi" +msgid "E924: Current window was closed" +msgstr "E924: La finestra corrente stata chiusa" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Il quickfix corrente stato cambiato" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d di %d)%s%s: " msgid " (line deleted)" -msgstr " (linea cancellata)" +msgstr " (riga cancellata)" + +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%slista errori %d di %d; %d errori" msgid "E380: At bottom of quickfix stack" msgstr "E380: Al fondo dello stack di quickfix" @@ -4696,12 +4710,8 @@ msgstr "E380: Al fondo dello stack di quickfix" msgid "E381: At top of quickfix stack" msgstr "E381: In cima allo stack di quickfix" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "lista errori %d di %d; %d errori" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: Non posso scrivere, l'opzione 'buftype' impostata" +msgid "No entries" +msgstr "Nessun elemento" msgid "Error file" msgstr "File errori" @@ -4719,10 +4729,21 @@ msgstr "E681: Buffer non caricato" msgid "E777: String or List expected" msgstr "E777: aspettavo Stringa o Lista" +#, c-format +msgid "E369: invalid item in %s%%[]" +msgstr "E369: elemento non valido in %s%%[]" + #, c-format msgid "E769: Missing ] after %s[" msgstr "E769: Manca ] dopo %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: Intervallo invertito nella classe di caratteri" + +msgid "E945: Range too large in character class" +msgstr "E945: Intervallo troppo ampio nella classe di caratteri" + +#, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: Senza riscontro: %s%%(" @@ -4740,12 +4761,17 @@ msgstr "E66: \\z( non consentito qui" msgid "E67: \\z1 et al. not allowed here" msgstr "E67: \\z1 ecc. non consentiti qui" +#, c-format msgid "E69: Missing ] after %s%%[" msgstr "E69: Manca ] dopo %s%%[" +#, c-format msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] vuoto" +msgid "E65: Illegal back reference" +msgstr "E65: Riferimento all'indietro non ammesso" + msgid "E339: Pattern too long" msgstr "E339: Espressione troppo lunga" @@ -4782,15 +4808,14 @@ msgstr "E63: uso non valido di \\_" msgid "E64: %s%c follows nothing" msgstr "E64: %s%c senza nulla prima" -msgid "E65: Illegal back reference" -msgstr "E65: Riferimento all'indietro non ammesso" - msgid "E68: Invalid character after \\z" msgstr "E68: Carattere non ammesso dopo \\z" +#, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: Carattere non valido dopo %s%%[dxouU]" +#, c-format msgid "E71: Invalid character after %s%%" msgstr "E71: Carattere non ammesso dopo %s%%" @@ -4801,27 +4826,42 @@ msgstr "E554: Errore sintattico in %s{...}" msgid "External submatches:\n" msgstr "Sotto-corrispondenze esterne:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) non riesco a ripetere %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= pu essere seguito solo da 0, 1 o 2. Sar usato il motore automatico " +"E864: \\%#= pu essere seguito solo da 0, 1 o 2. Sar usato il motore " +"automatico " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Passo alla ricerca di RE col vecchio metodo: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Fine prematura dell'espressione regolare" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA regexp) %c fuori posto" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) Fine prematura dell'espressione regolare" +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Classe di caratteri non valida: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) Operatore sconosciuto '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% valore troppo grande" + +#, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (NFA) Operatore sconosciuto '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: Errore nel build di NFA con classe di equivalenza!" @@ -4832,11 +4872,9 @@ msgstr "E869: (NFA) Operatore sconosciuto '\\@%c'" msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (NFA regexp) Errore nella lettura dei limiti di ripetizione" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (NFA regexp) Non si pu avere multi dopo multi !" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (NFA regexp) Troppi '('" @@ -4852,8 +4890,9 @@ msgstr "E874: (NFA) Impossibile riprendere lo stack !" msgid "" "E875: (NFA regexp) (While converting from postfix to NFA), too many states " "left on stack" -msgstr "E875: (NFA regexp) (Nella conversione da postfix a NFA), " -"troppi stati lasciati sullo stack" +msgstr "" +"E875: (NFA regexp) (Nella conversione da postfix a NFA), troppi stati " +"lasciati sullo stack" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (NFA regexp) Non c' spazio per immagazzinare l'intero NFA " @@ -4900,9 +4939,6 @@ msgstr " Ebraico" msgid " Arabic" msgstr " Arabo" -msgid " (lang)" -msgstr " (lingua)" - msgid " (paste)" msgstr " (incolla)" @@ -4910,7 +4946,7 @@ msgid " VISUAL" msgstr " VISUALE" msgid " VISUAL LINE" -msgstr " VISUALE LINEA" +msgstr " VISUALE RIGA" msgid " VISUAL BLOCK" msgstr " VISUALE BLOCCO" @@ -4919,7 +4955,7 @@ msgid " SELECT" msgstr " SELEZIONA" msgid " SELECT LINE" -msgstr " SELEZIONA LINEA" +msgstr " SELEZIONA RIGA" msgid " SELECT BLOCK" msgstr " SELEZIONA BLOCCO" @@ -4945,7 +4981,6 @@ msgstr "E386: '?' o '/' atteso dopo ';'" msgid " (includes previously listed match)" msgstr " (comprese corrispondenze elencate prima)" -#. cursor at status line msgid "--- Included files " msgstr "--- File inclusi " @@ -4970,7 +5005,7 @@ msgid "Searching included file %s" msgstr "Cerco nel file incluso: %s" msgid "E387: Match is on current line" -msgstr "E387: Corrispondenza nella linea corrente" +msgstr "E387: Corrispondenza nella riga corrente" msgid "All included files were found" msgstr "Tutti i file inclusi sono stati trovati" @@ -4997,19 +5032,56 @@ msgstr "" "# Ult. %sEspressione di Ricerca:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Errore di formato nel file ortografico" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Controllo ortografico non abilitato" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Avviso: Non trovo lista parole \"%s_%s.spl\" o \"%s_ascii.spl\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Avviso: Non trovo lista parole \"%s.%s.spl\" o \"%s.ascii.spl\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: L'autocomando 'SpellFileMissing' ha cancellato il buffer" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Avviso: regione %s non supportata" + +msgid "Sorry, no suggestions" +msgstr "Spiacente, nessun suggerimento" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Spiacente, solo %ld suggerimenti" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Cambiare \"%.*s\" in:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Nessuna sostituzione ortografica precedente" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Non trovato: %s" msgid "E758: Truncated spell file" msgstr "E758: File ortografico troncato" #, c-format msgid "Trailing text in %s line %d: %s" -msgstr "Testo in eccesso in %s linea %d: %s" +msgstr "Testo in eccesso in %s riga %d: %s" #, c-format msgid "Affix name too long in %s line %d: %s" -msgstr "Nome affisso troppo lungo in %s linea %d: %s" +msgstr "Nome affisso troppo lungo in %s riga %d: %s" msgid "E761: Format error in affix file FOL, LOW or UPP" msgstr "E761: Errore di formato nel file affissi FOL, LOW o UPP" @@ -5020,17 +5092,6 @@ msgstr "E762: Carattere fuori intervallo in FOL, LOW o UPP" msgid "Compressing word tree..." msgstr "Comprimo albero di parole..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Controllo ortografico non abilitato" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "Attenzione: Non trovo lista parole \"%s_%s.spl\" o \"%s_ascii.spl\"" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Attenzione: Non trovo lista parole \"%s.%s.spl\" o \"%s.ascii.spl\"" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Lettura file ortografico \"%s\"" @@ -5048,8 +5109,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Sezione non supportata nel file ortografico" #, c-format -msgid "Warning: region %s not supported" -msgstr "Attenzione: regione %s non supportata" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Questo non sembra un file .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: File .sug obsoleto, necessario aggiornarlo: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Il file .sug per versioni di Vim pi recenti: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Il file .sug non corrisponde al file .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Errore leggendo il file .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5057,7 +5134,7 @@ msgstr "Lettura file affissi %s ..." #, c-format msgid "Conversion failure for word in %s line %d: %s" -msgstr "Conversione fallita per una parola in %s linea %d: %s" +msgstr "Conversione fallita per una parola in %s riga %d: %s" #, c-format msgid "Conversion in %s not supported: from %s to %s" @@ -5069,11 +5146,11 @@ msgstr "Conversione in %s non supportata" #, c-format msgid "Invalid value for FLAG in %s line %d: %s" -msgstr "Valore di FLAG non valido in %s linea %d: %s" +msgstr "Valore di FLAG non valido in %s riga %d: %s" #, c-format msgid "FLAG after using flags in %s line %d: %s" -msgstr "FLAG dopo l'uso di flags in %s linea %d: %s" +msgstr "FLAG dopo l'uso di flags in %s riga %d: %s" #, c-format msgid "" @@ -5081,7 +5158,7 @@ msgid "" "%d" msgstr "" "Definire COMPOUNDFORBIDFLAG dopo l'elemento PFX potrebbe dare risultati " -"errati in %s linea %d" +"errati in %s riga %d" #, c-format msgid "" @@ -5089,36 +5166,35 @@ msgid "" "%d" msgstr "" "Definire COMPOUNDPERMITFLAG dopo l'elemento PFX potrebbe dare risultati " -"errati in %s linea %d" +"errati in %s riga %d" #, c-format msgid "Wrong COMPOUNDRULES value in %s line %d: %s" -msgstr "Valore errato per COMPOUNDRULES in %s linea %d: %s" +msgstr "Valore errato per COMPOUNDRULES in %s riga %d: %s" #, c-format msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" -msgstr "Valore errato per COMPOUNDWORDMAX in %s linea %d: %s" +msgstr "Valore errato per COMPOUNDWORDMAX in %s riga %d: %s" #, c-format msgid "Wrong COMPOUNDMIN value in %s line %d: %s" -msgstr "Valore errato per COMPOUNDMIN in %s linea %d: %s" +msgstr "Valore errato per COMPOUNDMIN in %s riga %d: %s" #, c-format msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" -msgstr "Valore errato per COMPOUNDSYLMAX in %s linea %d: %s" +msgstr "Valore errato per COMPOUNDSYLMAX in %s riga %d: %s" #, c-format msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" -msgstr "Valore errato per CHECKCOMPOUNDPATTERN in %s linea %d: %s" +msgstr "Valore errato per CHECKCOMPOUNDPATTERN in %s riga %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" -msgstr "" -"Flag combinazione diverso in blocco affissi continuo in %s linea %d: %s" +msgstr "Flag combinazione diverso in blocco affissi continuo in %s riga %d: %s" #, c-format msgid "Duplicate affix in %s line %d: %s" -msgstr "Affisso duplicato in %s linea %d: %s" +msgstr "Affisso duplicato in %s riga %d: %s" #, c-format msgid "" @@ -5126,35 +5202,35 @@ msgid "" "line %d: %s" msgstr "" "Affisso usato anche per BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " -"in %s linea %d: %s" +"in %s riga %d: %s" #, c-format msgid "Expected Y or N in %s line %d: %s" -msgstr "Y o N deve essere presente in %s linea %d: %s" +msgstr "Y o N deve essere presente in %s riga %d: %s" #, c-format msgid "Broken condition in %s line %d: %s" -msgstr "Condizione non rispettata in %s linea %d: %s" +msgstr "Condizione non rispettata in %s riga %d: %s" #, c-format msgid "Expected REP(SAL) count in %s line %d" -msgstr "Contatore REP(SAL) necessario in %s linea %d" +msgstr "Contatore REP(SAL) necessario in %s riga %d" #, c-format msgid "Expected MAP count in %s line %d" -msgstr "Contatore MAP necessario in %s linea %d" +msgstr "Contatore MAP necessario in %s riga %d" #, c-format msgid "Duplicate character in MAP in %s line %d" -msgstr "Carattere duplicato in MAP in %s linea %d" +msgstr "Carattere duplicato in MAP in %s riga %d" #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" -msgstr "Elemento non riconosciuto o duplicato in %s linea %d: %s" +msgstr "Elemento non riconosciuto o duplicato in %s riga %d: %s" #, c-format msgid "Missing FOL/LOW/UPP line in %s" -msgstr "Linea FOL/LOW/UPP mancante in %s" +msgstr "Riga FOL/LOW/UPP mancante in %s" msgid "COMPOUNDSYLMAX used without SYLLABLE" msgstr "COMPOUNDSYLMAX usato senza SYLLABLE" @@ -5170,19 +5246,19 @@ msgstr "Troppi suffissi e/o flag composti" #, c-format msgid "Missing SOFO%s line in %s" -msgstr "Linea SOFO%s mancante in %s" +msgstr "Riga SOFO%s mancante in %s" #, c-format msgid "Both SAL and SOFO lines in %s" -msgstr "Linee sia SAL che SOFO in %s" +msgstr "Righe sia SAL che SOFO in %s" #, c-format msgid "Flag is not a number in %s line %d: %s" -msgstr "Il flag non un numero in %s linea %d: %s" +msgstr "Il flag non un numero in %s riga %d: %s" #, c-format msgid "Illegal flag in %s line %d: %s" -msgstr "Flag non ammesso in %s linea %d: %s" +msgstr "Flag non ammesso in %s riga %d: %s" #, c-format msgid "%s value differs from what is used in another .aff file" @@ -5196,17 +5272,16 @@ msgstr "Lettura file dizionario %s ..." msgid "E760: No word count in %s" msgstr "E760: Nessun contatore parole in %s" -#, c-format -msgid "line %6d, word %6d - %s" -msgstr "linea %6d, parola %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "riga %6d, parola %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" -msgstr "Parola duplicata in %s linea %d: %s" +msgstr "Parola duplicata in %s riga %d: %s" #, c-format msgid "First duplicate word in %s line %d: %s" -msgstr "Prima parola duplicata in %s linea %d: %s" +msgstr "Prima parola duplicata in %s riga %d: %s" #, c-format msgid "%d duplicate word(s) in %s" @@ -5222,31 +5297,31 @@ msgstr "Lettura file parole %s ..." #, c-format msgid "Duplicate /encoding= line ignored in %s line %d: %s" -msgstr "Linea /encoding= duplicata ignorata in %s linea %d: %s" +msgstr "Riga /encoding= duplicata ignorata in %s riga %d: %s" #, c-format msgid "/encoding= line after word ignored in %s line %d: %s" -msgstr "Linea /encoding= dopo parola ignorata in %s linea %d: %s" +msgstr "Riga /encoding= dopo parola ignorata in %s riga %d: %s" #, c-format msgid "Duplicate /regions= line ignored in %s line %d: %s" -msgstr "Linea /regions= duplicata ignorata in %s linea %d: %s" +msgstr "Riga /regions= duplicata ignorata in %s riga %d: %s" #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "Troppe regioni in %s linea %d: %s" +msgstr "Troppe regioni in %s riga %d: %s" #, c-format msgid "/ line ignored in %s line %d: %s" -msgstr "Linea / ignorata in %s linea %d: %s" +msgstr "Riga / ignorata in %s riga %d: %s" #, c-format msgid "Invalid region nr in %s line %d: %s" -msgstr "N. regione non valido in %s linea %d: %s" +msgstr "N. regione non valido in %s riga %d: %s" #, c-format msgid "Unrecognized flags in %s line %d: %s" -msgstr "Flag non riconosciuti in %s linea %d: %s" +msgstr "Flag non riconosciuti in %s riga %d: %s" #, c-format msgid "Ignored %d words with non-ASCII characters" @@ -5255,16 +5330,13 @@ msgstr "%d parole con caratteri non-ASCII ignorate" msgid "E845: Insufficient memory, word list will be incomplete" msgstr "E845: Memoria insufficiente, la lista parole sar incompleta" +#, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" msgstr "%d di %d nodi compressi; ne restano %d (%d%%)" msgid "Reading back spell file..." msgstr "Rilettura file ortografico..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Eseguo soundfolding..." @@ -5287,15 +5359,15 @@ msgstr "Uso stimato di memoria durante esecuzione: %d byte" msgid "E751: Output file name must not have region name" msgstr "E751: Il nome del file di output non deve avere il nome di regione" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: Sono supportate fino ad 8 regioni" +msgid "E754: Only up to %ld regions supported" +msgstr "E754: Sono supportate al massimo %ld regioni" #, c-format msgid "E755: Invalid region in %s" msgstr "E755: Regione non valida in %s" msgid "Warning: both compounding and NOBREAK specified" -msgstr "Attenzione: specificati sia composizione sia NOBREAK" +msgstr "Avviso: specificati sia composizione sia NOBREAK" #, c-format msgid "Writing spell file %s ..." @@ -5309,72 +5381,50 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' non ha %ld elementi" #, c-format -msgid "Word removed from %s" -msgstr "Parola rimossa da %s" +msgid "Word '%.*s' removed from %s" +msgstr "Parola '%.*s' rimossa da %s" #, c-format -msgid "Word added to %s" -msgstr "Parola aggiunta a %s" +msgid "Word '%.*s' added to %s" +msgstr "Parola '%.*s' aggiunta a %s" msgid "E763: Word characters differ between spell files" msgstr "E763: Caratteri di parola differenti nei file ortografici" -msgid "Sorry, no suggestions" -msgstr "Spiacente, nessun suggerimento" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Spiacente, solo %ld suggerimenti" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Cambiare \"%.*s\" in:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: Nessuna sostituzione ortografica precedente" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Non trovato: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Questo non sembra un file .sug: %s" - -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: File .sug obsoleto, necessario aggiornarlo: %s" - -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Il file .sug per versioni di Vim pi recenti: %s" - -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Il file .sug non corrisponde al file .spl: %s" - -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: Errore leggendo il file .sug: %s" - -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: carattere duplicato nell'elemento MAP" msgid "No Syntax items defined for this buffer" msgstr "Nessun elemento sintattico definito per questo buffer" +msgid "syntax conceal on" +msgstr "syntax conceal attivo" + +msgid "syntax conceal off" +msgstr "syntax conceal inattivo" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Argomento non ammesso: %s" +msgid "syntax case ignore" +msgstr "syntax, ignorare maiuscolo/minuscolo" + +msgid "syntax case match" +msgstr "syntax, considerare maiuscolo/minuscolo" + +msgid "syntax spell toplevel" +msgstr "syntax, effettua spell sul testo" + +msgid "syntax spell notoplevel" +msgstr "syntax, non effettuare spell sul testo" + +msgid "syntax spell default" +msgstr "syntax, usare valore di default per lo spell" + +msgid "syntax iskeyword " +msgstr "syntax iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: 'cluster' sintattico inesistente: %s" @@ -5389,7 +5439,7 @@ msgid "syncing starts " msgstr "la sincronizzazione inizia " msgid " lines before top line" -msgstr " linee prima della linea iniziale" +msgstr " righe prima della riga iniziale" msgid "" "\n" @@ -5426,7 +5476,7 @@ msgid "; match " msgstr "; corrisp. " msgid " line breaks" -msgstr " interruzioni di linea" +msgstr " interruzioni di riga" msgid "E395: contains argument not accepted here" msgstr "E395: contiene argomenti non accettati qui" @@ -5451,6 +5501,10 @@ msgstr "E847: Troppe inclusioni di sintassi" msgid "E789: Missing ']': %s" msgstr "E789: Manca ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Caratteri in pi dopo ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Manca '=': %s" @@ -5475,7 +5529,7 @@ msgstr "E402: Spazzatura dopo espressione: %s" msgid "E403: syntax sync: line continuations pattern specified twice" msgstr "" -"E403: syntax sync: espressione di continuazione linea specificata due volte" +"E403: syntax sync: espressione di continuazione riga specificata due volte" #, c-format msgid "E404: Illegal arguments: %s" @@ -5603,7 +5657,6 @@ msgstr "E428: Non posso andare oltre l'ultimo tag corrispondente" msgid "File \"%s\" does not exist" msgstr "Il file \"%s\" non esiste" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "tag %d di %d%s" @@ -5618,13 +5671,12 @@ msgstr " Uso tag ignorando maiuscole/minuscole!" msgid "E429: File \"%s\" does not exist" msgstr "E429: Il file \"%s\" non esiste" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" msgstr "" "\n" -" # A tag DA__ linea in file/testo" +" # A tag DA__ riga in file/testo" #, c-format msgid "Searching tags file %s" @@ -5635,7 +5687,7 @@ msgid "E430: Tag file path truncated for %s\n" msgstr "E430: Percorso tag file troncato per %s\n" msgid "Ignoring long line in tags file" -msgstr "Linea lunga ignorata nel tag file" +msgstr "Riga lunga ignorata nel tag file" #, c-format msgid "E431: Format error in tags file \"%s\"" @@ -5649,7 +5701,6 @@ msgstr "Prima del byte %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: Tag file non ordinato alfabeticamente: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: Nessun tag file" @@ -5685,7 +5736,6 @@ msgstr "E436: Nessuna descrizione per \"%s\" in 'termcap'" msgid "E437: terminal capability \"cm\" required" msgstr "E437: capacit \"cm\" del terminale necessaria" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5693,6 +5743,34 @@ msgstr "" "\n" "--- Tasti Terminale ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Non riesco ad aprire $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Cancello lavoro \"%s\"?" + +msgid "Terminal" +msgstr "Terminale" + +msgid "Terminal-finished" +msgstr "Terminale-terminato" + +msgid "active" +msgstr "attivo" + +msgid "running" +msgstr "in esecuzione" + +msgid "finished" +msgstr "terminato" + +msgid "E953: File exists: %s" +msgstr "E953: File gi esistente: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Il buffer non un terminale" + msgid "new shell started\n" msgstr "fatto eseguire nuovo shell\n" @@ -5702,12 +5780,9 @@ msgstr "Vim: Errore leggendo l'input, esco...\n" msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "Uso CUT_BUFFER0 invece che una scelta nulla" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Il conteggio delle righe inaspettatamente cambiato" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Contatore righe inaspettatamente cambiato" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "'undo' non pi possibile; continuo comunque" @@ -5791,19 +5866,19 @@ msgid "E830: Undo number %ld not found" msgstr "E830: Undo numero %ld non trovato" msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: numeri linee errati" +msgstr "E438: u_undo: numeri righe errati" msgid "more line" -msgstr "linea in pi" +msgstr "riga in pi" msgid "more lines" -msgstr "linee in pi" +msgstr "righe in pi" msgid "line less" -msgstr "linea in meno" +msgstr "riga in meno" msgid "fewer lines" -msgstr "linee in meno" +msgstr "righe in meno" msgid "change" msgstr "modifica" @@ -5838,15 +5913,137 @@ msgid "E439: undo list corrupt" msgstr "E439: lista 'undo' non valida" msgid "E440: undo line missing" -msgstr "E440: linea di 'undo' mancante" +msgstr "E440: riga di 'undo' mancante" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: La funzione %s esiste gi, aggiungi ! per sostituirla" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: C' gi la voce nel Dizionario" + +msgid "E718: Funcref required" +msgstr "E718: Funcref necessario" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Funzione sconosciuta: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Argomento non ammesso: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Nome argomento duplicato: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Troppi argomenti per la funzione: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Argomenti non validi per la funzione: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" msgstr "" -"\n" -"versione MS-Windows 16/32-bit GUI" +"E132: Nidificazione della chiamata di funzione maggiore di 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "chiamo %s" + +#, c-format +msgid "%s aborted" +msgstr "%s non completata" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s ritorno #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s ritorno %s" + +msgid "E699: Too many arguments" +msgstr "E699: Troppi argomenti" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Funzione sconosciuta: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Funzione eliminata: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: La funzione: %s richiede pi argomenti" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: Uso di <SID> fuori dal contesto di uno script: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Chiamata di funzione dict in assenza di Dizionario: %s" + +msgid "E129: Function name required" +msgstr "E129: Nome funzione necessario" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Il nome funzione deve iniziare con maiuscola o \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Il nome della funzione non pu contenere un due punti: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Funzione non definita: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Manca '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: Non si pu usare g: qui" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "" +"E932: La funzione di chiusura non novrebbe essere al livello pi alto: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: Manca :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Trovato testo dopo :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Nome funzione in conflitto con la variabile: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Non posso ridefinire la funzione %s: in uso" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Il nome funzione non corrisponde al nome file dello script: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Non posso eliminare la funzione %s: in uso" + +msgid "E133: :return not inside a function" +msgstr "E133: :return fuori da una funzione" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Mancano parentesi: %s" msgid "" "\n" @@ -5862,9 +6059,6 @@ msgstr "" "\n" "Versione MS-Windows 32-bit GUI" -msgid " in Win32s mode" -msgstr " in modalit Win32s" - msgid " with OLE support" msgstr " con supporto OLE" @@ -5884,45 +6078,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Versione MS-Windows 16-bit" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Version MS-DOS 32-bit" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Versione MS-DOS 16-bit" - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"Versione MacOS X (unix)" - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"Versione X MacOS" +"Versione macOS" msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"Versione MacOS" +"versione macOS senza funzion. darwin" msgid "" "\n" @@ -5996,6 +6162,9 @@ msgstr "" msgid "without GUI." msgstr "senza GUI." +msgid "with GTK3 GUI." +msgstr "con GUI GTK3." + msgid "with GTK2-GNOME GUI." msgstr "con GUI GTK2-GNOME." @@ -6023,9 +6192,6 @@ msgstr "con GUI Carbon." msgid "with Cocoa GUI." msgstr "con GUI Cocoa." -msgid "with (classic) GUI." -msgstr "con GUI (classica)." - msgid " Features included (+) or not (-):\n" msgstr " Funzionalit incluse (+) o escluse (-):\n" @@ -6059,6 +6225,9 @@ msgstr " II file gvimrc utente: \"" msgid "3rd user gvimrc file: \"" msgstr " III file gvimrc utente: \"" +msgid " defaults file: \"" +msgstr " file dei default: \"" + msgid " system menu file: \"" msgstr " file menu di sistema: \"" @@ -6104,8 +6273,8 @@ msgstr "batti :q<Invio> per uscire " msgid "type :help<Enter> or <F1> for on-line help" msgstr "batti :help<Invio> o <F1> per aiuto online " -msgid "type :help version7<Enter> for version info" -msgstr "batti :help version7<Invio> per informazioni su versione" +msgid "type :help version8<Enter> for version info" +msgstr "batti :help version8<Invio> per informazioni su versione" msgid "Running in Vi compatible mode" msgstr "Eseguo in modalit compatibile Vi" @@ -6149,12 +6318,6 @@ msgstr "batti :help register<Invio> per informazioni " msgid "menu Help->Sponsor/Register for information " msgstr "menu Aiuto->Sponsor/Registrazione per informazioni " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ATTENZIONE: Trovato Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr "batti :help windows95<Enter> per info al riguardo" - msgid "Already only one window" msgstr "C' gi una finestra sola" @@ -6188,6 +6351,25 @@ msgstr "E446: Nessun nome file sotto il cursore" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Non riesco a trovare il file \"%s\" nel percorso" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID non valido: %ld (dev'essere maggiore o uguale a 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID gi utilizzato: %ld" + +msgid "List or number required" +msgstr " necessaria una Lista o un numero" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID non valido: %ld (dev'essere maggiore o uguale a 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID non trovato: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Non riesco a caricare la libreria %s" @@ -6233,10 +6415,6 @@ msgstr "Percorso file troppo lungo!" msgid "--No lines in buffer--" msgstr "--File vuoto--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Comando finito male" @@ -6292,6 +6470,10 @@ msgstr "E236: Font \"%s\" non di larghezza fissa" msgid "E473: Internal error" msgstr "E473: Errore interno" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Errore interno: %s" + msgid "Interrupted" msgstr "Interrotto" @@ -6305,6 +6487,12 @@ msgstr "E474: Argomento non valido" msgid "E475: Invalid argument: %s" msgstr "E475: Argomento non valido: %s" +msgid "E475: Invalid value for argument %s" +msgstr "E475: Valore non valido per l'argomento %s" + +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Valore non valido per l'argomento %s: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Espressione non valida: %s" @@ -6323,12 +6511,15 @@ msgstr "E17: \"%s\" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: Chiamata a libreria fallita per \"%s()\"" +msgid "E667: Fsync failed" +msgstr "E667: Fsync fallito" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Non posso caricare la funzione di libreria %s" msgid "E19: Mark has invalid line number" -msgstr "E19: 'Mark' con numero linea non valido" +msgstr "E19: 'Mark' con numero riga non valido" msgid "E20: Mark not set" msgstr "E20: 'Mark' non impostato" @@ -6368,7 +6559,7 @@ msgid "E29: No inserted text yet" msgstr "E29: Ancora nessun testo inserito" msgid "E30: No previous command line" -msgstr "E30: Nessuna linea comandi precedente" +msgstr "E30: Nessuna riga comandi precedente" msgid "E31: No such mapping" msgstr "E31: Mapping inesistente" @@ -6417,9 +6608,6 @@ msgstr "E484: Non riesco ad aprire il file %s" msgid "E485: Can't read file %s" msgstr "E485: Non riesco a leggere il file %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Non salvato dopo modifica (aggiungi ! per eseguire comunque)" - msgid "E38: Null argument" msgstr "E38: Argomento nullo" @@ -6473,6 +6661,31 @@ msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "" "E794: Non posso impostare la variabile read-only in ambiente protetto: \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Non posso usare una chiave nulla per il Dizionario" + +msgid "E715: Dictionary required" +msgstr "E715: necessario un Dizionario" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: indice lista fuori intervallo: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Troppi argomenti per la funzione: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Chiave assente dal Dizionario: %s" + +msgid "E714: List required" +msgstr "E714: necessaria una Lista" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: L'argomento di %s deve essere una Lista o un Dizionario" + msgid "E47: Error while reading errorfile" msgstr "E47: Errore leggendo il file errori" @@ -6530,8 +6743,8 @@ msgstr "E592: 'winwidth' non pu msgid "E80: Error while writing" msgstr "E80: Errore in scrittura" -msgid "Zero count" -msgstr "Contatore a zero" +msgid "E939: Positive count required" +msgstr "E939: Un contatore positivo necessario" msgid "E81: Using <SID> not in a script context" msgstr "E81: Uso di <SID> fuori dal contesto di uno script" @@ -6545,16 +6758,16 @@ msgstr "E463: Regione protetta, impossibile modificare" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans non permette modifiche a file di sola lettura" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Errore interno: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: l'espressione usa troppa memoria rispetto a 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: buffer vuoto" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Non esiste il buffer %ld" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Espressione o delimitatore di ricerca non validi" @@ -6568,6 +6781,13 @@ msgstr "E764: opzione '%s' non impostata" msgid "E850: Invalid register name" msgstr "E850: Nome registro non valido" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Directory non trovata in '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: L'autocomando ha generato un comportamento ricorsivo" + msgid "search hit TOP, continuing at BOTTOM" msgstr "raggiunta la CIMA nella ricerca, continuo dal FONDO" @@ -6578,6 +6798,23 @@ msgstr "raggiunto il FONDO nella ricerca, continuo dalla CIMA" msgid "Need encryption key for \"%s\"" msgstr "Serve una chiave di cifratura per \"%s\"" +msgid "empty keys are not allowed" +msgstr "chiavi nulle non consentite" + +msgid "dictionary is locked" +msgstr "il dizionario bloccato" + +msgid "list is locked" +msgstr "la lista bloccata" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "non non riusciato ad aggiungere la chiave '%s' al dizionario" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "l'indice deve'essere un intero o un intervallo, non %s" + #, c-format msgid "expected str() or unicode() instance, but got %s" msgstr "attesa istanza di str() o unicode(), trovato invece %s" @@ -6590,11 +6827,13 @@ msgstr "attesa istanza di bytes() o str(), trovato invece %s" msgid "" "expected int(), long() or something supporting coercing to long(), but got %s" msgstr "" -"atteso int(), long() o qualcosa che supporti forzatura a long(), trovato invece %s" +"atteso int(), long() o qualcosa che supporti forzatura a long(), trovato " +"invece %s" #, c-format msgid "expected int() or something supporting coercing to int(), but got %s" -msgstr "atteso int() o qualcosa che supporti forzatura a int(), trovato invece %s" +msgstr "" +"atteso int() o qualcosa che supporti forzatura a int(), trovato invece %s" msgid "value is too large to fit into C int type" msgstr "valore troppo grande per il tipo int del C" @@ -6602,8 +6841,8 @@ msgstr "valore troppo grande per il tipo int del C" msgid "value is too small to fit into C int type" msgstr "valore troppo piccolo per il tipo int del C" -msgid "number must be greater then zero" -msgstr "il numero dev'essere maggiore di zero" +msgid "number must be greater than zero" +msgstr "il numero deve essere maggiore di zero" msgid "number must be greater or equal to zero" msgstr "il numero dev'essere maggiore o uguale a zero" @@ -6627,7 +6866,9 @@ msgstr "atteso terzetto come risultato di imp.find_module(), trovato invece %s" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" -msgstr "atteso terzetto come risultato di imp.find_module(), trovato invece tuple di dimens. %d" +msgstr "" +"atteso terzetto come risultato di imp.find_module(), trovato invece tuple di " +"dimens. %d" msgid "internal error: imp.find_module returned tuple with NULL" msgstr "errore interno: imp.find_module restituisce tuple con NULL" @@ -6647,7 +6888,8 @@ msgstr "hashtab cambiato durante l'iterazione" #, c-format msgid "expected sequence element of size 2, but got sequence of size %d" -msgstr "atteso elemento sequenza di dimensione 2, trovata sequenza di dimensione %d" +msgstr "" +"atteso elemento sequenza di dimensione 2, trovata sequenza di dimensione %d" msgid "list constructor does not accept keyword arguments" msgstr "il costruttore di lista non accetta parole chiave come argomenti" @@ -6655,21 +6897,37 @@ msgstr "il costruttore di lista non accetta parole chiave come argomenti" msgid "list index out of range" msgstr "indice di lista non nell'intervallo" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr "errore interno: non ho potuto ottenere l'elemento di vim list %d" -msgid "failed to add item to list" -msgstr "non ho potuto aggiungere un elemento alla lista" +msgid "slice step cannot be zero" +msgstr "il passo scorrendo un intervallo non pu essere zero" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"tentativo di assegnare una sequenza maggiore di %d a un intervallo esteso" #, c-format msgid "internal error: no vim list item %d" msgstr "errore interno: non c' un elemento di vim list %d" +msgid "internal error: not enough list items" +msgstr "errore interno: non ci sono abbastanza elementi per la lista" + msgid "internal error: failed to add item to list" msgstr "errore interno: non ho potuto aggiungere un elemento alla lista" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"tentativo di assegnare sequenza di dimensione %d a un intervallo esteso di " +"dimensione %d" + +msgid "failed to add item to list" +msgstr "non ho potuto aggiungere un elemento alla lista" + msgid "cannot delete vim.List attributes" msgstr "non riesco a cancellare gli attributi vim.List" @@ -6684,9 +6942,6 @@ msgstr "la funzione anonima %s non esiste" msgid "function %s does not exist" msgstr "la funzione %s non esiste" -msgid "function constructor does not accept keyword arguments" -msgstr "il costruttore di funzione non accetta parole chiave come argomenti" - #, c-format msgid "failed to run function %s" msgstr "esecuzione non riuscita della funzione %s" @@ -6748,7 +7003,8 @@ msgid "expected vim.Window object, but got %s" msgstr "atteso oggetto vim.Window, trovato %s" msgid "failed to find window in the current tab page" -msgstr "non stato possibile trovare la finestra nella pagina con linguette corrente" +msgstr "" +"non stato possibile trovare la finestra nella pagina con linguette corrente" msgid "did not switch to the specified window" msgstr "passaggio alla finestra specificata non effettuato" @@ -6767,12 +7023,17 @@ msgid "E858: Eval did not return a valid python object" msgstr "E858: Eval non ha restituito un oggetto python valido" msgid "E859: Failed to convert returned python object to vim value" -msgstr "E859: Conversione non riuscita dell'oggetto python risultato a un valore vim" +msgstr "" +"E859: Conversione non riuscita dell'oggetto python risultato a un valore vim" #, c-format msgid "unable to convert %s to vim dictionary" msgstr "impossibile convertire %s a dizionario vim" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "impossibile convertire %s a Lista vim" + #, c-format msgid "unable to convert %s to vim structure" msgstr "impossibile convertire %s a struttura vim" @@ -6789,7 +7050,8 @@ msgid "" "- append vim.path_hook to sys.path_hooks\n" "- append vim.VIM_SPECIAL_PATH to sys.path\n" msgstr "" -"Impostazione dell'ancora di percorso non riuscita: sys.path_hooks non una lista\n" +"Impostazione dell'ancora di percorso non riuscita: sys.path_hooks non una " +"lista\n" "Dovresti fare cos:\n" "- aggiungere vim.path_hook a vim.path_hooks\n" "- aggiungere vim.VIM_SPECIAL_PATH a sys.path\n" @@ -6798,6 +7060,49 @@ msgid "" "Failed to set path: sys.path is not a list\n" "You should now append vim.VIM_SPECIAL_PATH to sys.path" msgstr "" -"Impostazione di percorso non riuscita: sys.path non una lista\n" +"Impostazione di percorso non riuscita: sys.path non una Lista\n" "Dovresti aggiungere vim.VIM_SPECIAL_PATH a sys.path" +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Vim macro file (*.vim)\t*.vim\n" +"Tutti i file (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "Tutti i file (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Tutti i file (*.*)\t*.*\n" +"Sorgenti C (*.c, *.h)\t*.c;*.h\n" +"Sorgenti C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Codice VB (*.bas, *.frm)\t*.bas;*.frm\n" +"File di Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim macro file (*.vim)\t*.vim\n" +"Tutti i file (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "Tutti i file (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Tutti i file (*)\t*\n" +"Sorgenti C (*.c, *.h)\t*.c;*.h\n" +"Sorgenti C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"File di Vim (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/ja.euc-jp.po b/src/po/ja.euc-jp.po index c97c8388a8..0a92f04fb0 100644 --- a/src/po/ja.euc-jp.po +++ b/src/po/ja.euc-jp.po @@ -1,27 +1,28 @@ -# Japanese translation for Vim vim:set foldmethod=marker: +# Japanese translation for Vim # # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# Last Change: 2014 May 13 +# Copyright (C) 2001-2018 MURAOKA Taro <koron.kaoriya@gmail.com>, +# vim-jp (http://vim-jp.org/) # -# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. # # Generated from ja.po, DO NOT EDIT. # msgid "" msgstr "" -"Project-Id-Version: Vim 7.4\n" +"Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-06 13:50+0900\n" -"PO-Revision-Date: 2013-07-06 15:00+0900\n" +"POT-Creation-Date: 2018-05-01 10:46+0900\n" +"PO-Revision-Date: 2017-05-18 00:45+0900\n" "Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n" -"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n" +"Language-Team: vim-jp (https://github.com/vim-jp/lang-ja)\n" "Language: Japanese\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=euc-jp\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() ѥɤǸƤӽФޤ" @@ -39,7 +40,7 @@ msgid "E819: Blowfish test failed" msgstr "E819: BlowfishŹΥƥȤ˼Ԥޤ" msgid "[Location List]" -msgstr "[ꥹ]" +msgstr "[ꥹ]" msgid "[Quickfix List]" msgstr "[Quickfixꥹ]" @@ -48,10 +49,16 @@ msgid "E855: Autocommands caused command to abort" msgstr "E855: autocommandޥɤߤޤ" msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: Хåե1ĤǤʤΤ, λޤ..." +msgstr "E82: Хåե1ĤǤʤΤǡλޤ..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: ХåեǤʤΤ, ¾ΤѤޤ..." +msgstr "E83: ХåեǤʤΤǡ¾ΤѤޤ..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: ХåեϿǤޤ" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: ΥХåե褦Ȼߤޤ" msgid "E515: No buffers were unloaded" msgstr "E515: 줿ХåեϤޤ" @@ -83,17 +90,15 @@ msgstr "1 msgid "%d buffers wiped out" msgstr "%d ĤΥХåե˴ޤ" +msgid "E90: Cannot unload last buffer" +msgstr "E90: ǸΥХåեϲǤޤ" + msgid "E84: No modified buffer found" msgstr "E84: ѹ줿ХåեϤޤ" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: ꥹɽХåեϤޤ" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Хåե %ld Ϥޤ" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: ǸΥХåեۤưưϤǤޤ" @@ -104,8 +109,17 @@ msgstr "E88: msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: Хåե %ld ѹ¸Ƥޤ (! ѹ˴)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: ǸΥХåեϲǤޤ" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: ֤Ϥޤ¹Ǥ (! ɲäǥ֤λ)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Ǹѹ¸Ƥޤ (! ɲäѹ˴)" + +msgid "E948: Job still running" +msgstr "E948: ֤Ϥޤ¹Ǥ" + +msgid "E37: No write since last change" +msgstr "E37: Ǹѹ¸Ƥޤ" msgid "W14: Warning: List of file names overflow" msgstr "W14: ٹ: ե̾ΥꥹȤĹ᤮ޤ" @@ -162,7 +176,6 @@ msgstr " msgid "[No Name]" msgstr "[̵̾]" -#. must be a help buffer msgid "help" msgstr "إ" @@ -188,6 +201,9 @@ msgstr "" "\n" "# Хåեꥹ:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: 'buftype' ץꤵƤΤǽޤ" + msgid "[Scratch]" msgstr "[]" @@ -206,15 +222,107 @@ msgstr "%s msgid " line=%ld id=%d name=%s" msgstr " =%ld ̻=%d ̾=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: ݡȤ³Ǥޤ" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: channel_open() gethostbyname() Ԥޤ" + +msgid "E898: socket() in channel_open()" +msgstr "E898: channel_open() socket() Ԥޤ" + +msgid "E903: received command with non-string argument" +msgstr "E903: ʸΰΥޥɤޤ" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: expr/call κǸΰϿǤʤФʤޤ" + +msgid "E904: third argument for call must be a list" +msgstr "E904: call 3ܤΰϥꥹȷǤʤФʤޤ" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: ̤ΤΥޥɤޤ: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): ³֤ǽ񤭹ߤޤ" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): 񤭹ߤ˼Ԥޤ" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s() ˥ХåϻȤޤ" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: raw nl ⡼ɤΥͥ ch_evalexpr()/ch_sendexpr() ϻȤޤ" + +msgid "E906: not an open channel" +msgstr "E906: ƤʤͥǤ" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io ե _name ꤬ɬפǤ" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io Хåե in_buf in_name ꤬ɬפǤ" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: ХåեɤƤʤФʤޤ: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: ե뤬̤ΤˡǰŹ沽Ƥޤ" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "ٹ: 夤ŹˡȤäƤޤ; :help 'cm' 򻲾ȤƤ" + +msgid "Enter encryption key: " +msgstr "Ź沽ѤΥϤƤ: " + +msgid "Enter same key again: " +msgstr "⤦ƱϤƤ: " + +msgid "Keys don't match!" +msgstr "פޤ" + +msgid "[crypted]" +msgstr "[Ź沽]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: 񷿤˥󤬤ޤ: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: 񷿤˽ʣޤ: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: 񷿤˥ޤޤ: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: 񷿤κǸ '}' ޤ: %s" + +msgid "extend() argument" +msgstr "extend() ΰ" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: ϴ¸ߤޤ: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: %ld ʾΥХåեdiffǤޤ" msgid "E810: Cannot read or write temp files" msgstr "E810: եɹ⤷ϽǤޤ" msgid "E97: Cannot create diffs" -msgstr "E97: ʬǤޤ " +msgstr "E97: ʬǤޤ" msgid "Patch file" msgstr "ѥåե" @@ -229,7 +337,7 @@ msgid "E99: Current buffer is not in diff mode" msgstr "E99: ߤΥХåեϺʬ⡼ɤǤϤޤ" msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: ʬ⡼ɤǤ¾ΥХåեѹǽǤ" +msgstr "E793: ʬ⡼ɤǤ¾ΥХåեѹǤޤ" msgid "E100: No other buffer in diff mode" msgstr "E100: ʬ⡼ɤǤ¾ΥХåեϤޤ" @@ -264,7 +372,6 @@ msgstr "E791: msgid " Keyword completion (^N^P)" msgstr " 䴰 (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X ⡼ (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -272,7 +379,7 @@ msgid " Whole line completion (^L^N^P)" msgstr " ()䴰 (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr "ե̾䴰 (^F^N^P)" +msgstr " ե̾䴰 (^F^N^P)" msgid " Tag completion (^]^N^P)" msgstr " 䴰 (^]^N^P)" @@ -293,7 +400,7 @@ msgid " Command-line completion (^V^N^P)" msgstr " ޥɥ饤䴰 (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " 桼䴰 (^U^N^P)" +msgstr " 桼䴰 (^U^N^P)" msgid " Omni completion (^O^N^P)" msgstr " 䴰 (^O^N^P)" @@ -336,13 +443,12 @@ msgstr " msgid "Scanning tags." msgstr "򥹥." +msgid "match in file" +msgstr "եΥޥå" + msgid " Adding" msgstr " ɲ" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- ..." @@ -366,10 +472,6 @@ msgstr "%d msgid "E18: Unexpected characters in :let" msgstr "E18: ͽʸ :let ˤޤ" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: ꥹȤΥǥåϰϳǤ: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: ̤ѿǤ: %s" @@ -377,41 +479,6 @@ msgstr "E121: ̤ msgid "E111: Missing ']'" msgstr "E111: ']' Ĥޤ" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s ΰϥꥹȷǤʤФʤޤ" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s ΰϥꥹȷޤϼ񷿤ǤʤФʤޤ" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: 񷿤˶ΥȤȤϤǤޤ" - -msgid "E714: List required" -msgstr "E714: ꥹȷɬפǤ" - -msgid "E715: Dictionary required" -msgstr "E715: 񷿤ɬפǤ" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: ؿΰ¿᤮ޤ: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: 񷿤˥¸ߤޤ: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: ؿ %s ѤǤ, ˤ ! ɲäƤ" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: ˥ȥ꤬¸ߤޤ" - -msgid "E718: Funcref required" -msgstr "E718: ؿȷ׵ᤵޤ" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: [:] 򼭽񷿤Ȥ߹碌ƤϻȤޤ" @@ -419,10 +486,6 @@ msgstr "E719: [:] msgid "E734: Wrong variable type for %s=" msgstr "E734: ۤʤäѿǤ %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: ̤ΤδؿǤ: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: ѿ̾Ǥ: %s" @@ -462,38 +525,20 @@ msgstr "E711: msgid "E690: Missing \"in\" after :for" msgstr "E690: :for θ \"in\" ޤ" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: å '(' ޤ: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: ѿϤޤ: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: ѿ %s ϥåޤϥåǤޤ" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: ()åˤѿҤ᤮ޤ" msgid "E109: Missing ':' after '?'" msgstr "E109: '?' θ ':' ޤ" -msgid "E691: Can only compare List with List" -msgstr "E691: ꥹȷϥꥹȷȤӤǤޤ" - -msgid "E692: Invalid operation for List" -msgstr "E692: ꥹȷˤ̵Ǥ" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: 񷿤ϼ񷿤ȤӤǤޤ" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: 񷿤ˤ̵Ǥ" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: ؿȷϴؿȷȤӤǤޤ" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: ؿȷˤ̵Ǥ" - msgid "E804: Cannot use '%' with Float" msgstr "E804: '%' ưȤ߹碌ƤϻȤޤ" @@ -503,6 +548,9 @@ msgstr "E110: ')' msgid "E695: Cannot index a Funcref" msgstr "E695: ؿȷϥǥåǤޤ" +msgid "E909: Cannot index a special variable" +msgstr "E909: üѿϥǥåǤޤ" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: ץ̾ޤ: %s" @@ -519,83 +567,118 @@ msgstr "E114: msgid "E115: Missing quote: %s" msgstr "E115: (') ޤ: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: ꥹȷ˥ޤޤ: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"٥å쥯ߤޤ! ȤΤ˥꤬­ޤ" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: ꥹȷκǸ ']' ޤ: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: ɽˤѿҤ᤮ޤ" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: 񷿤˥󤬤ޤ: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: ưͤȤưäƤޤ" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: 񷿤˽ʣޤ: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: ؿȷͤȤưäƤޤ" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: 񷿤˥ޤޤ: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: ꥹȷͤȤưäƤޤ" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: 񷿤κǸ '}' ޤ: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: 񷿤ͤȤưäƤޤ" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: ɽˤѿҤ᤮ޤ" +msgid "E910: Using a Job as a Number" +msgstr "E910: ֤ͤȤưäƤޤ" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: ؿΰ¿᤮ޤ: %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: ͥͤȤưäƤޤ" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: ؿȷưȤưäƤޤ" + +msgid "E892: Using a String as a Float" +msgstr "E892: ʸưȤưäƤޤ" + +msgid "E893: Using a List as a Float" +msgstr "E893: ꥹȷưȤưäƤޤ" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: 񷿤ưȤưäƤޤ" + +msgid "E907: Using a special value as a Float" +msgstr "E907: üͤưȤưäƤޤ" + +msgid "E911: Using a Job as a Float" +msgstr "E911: ֤ưȤưäƤޤ" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: ͥưȤưäƤޤ" + +msgid "E729: using Funcref as a String" +msgstr "E729: ؿȷʸȤưäƤޤ" + +msgid "E730: using List as a String" +msgstr "E730: ꥹȷʸȤưäƤޤ" + +msgid "E731: using Dictionary as a String" +msgstr "E731: 񷿤ʸȤưäƤޤ" + +msgid "E908: using an invalid value as a String" +msgstr "E908: ̵ͤʸȤưäƤޤ" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: ؿ̵ʰǤ: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: ѿ %s Ǥޤ" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: ̤ΤδؿǤ: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: ؿȷѿ̾ʸǻϤޤʤФʤޤ: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: ؿΰʲ᤮ޤ: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: ѿ̾¸δؿ̾Ⱦͤޤ: %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: ץȰʳ<SID>Ȥޤ: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: ͤåƤޤ: %s" + +msgid "Unknown" +msgstr "" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: ѴؿƤФޤ񤬤ޤ: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s ͤѹǤޤ" -msgid "E808: Number or Float required" -msgstr "E808: ͤưɬפǤ" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: ԡˤѿҤ᤮ޤ" -msgid "add() argument" -msgstr "add() ΰ" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# Хѿ:\n" -msgid "E699: Too many arguments" -msgstr "E699: ¿᤮ޤ" +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tǸ˥åȤץ: " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() ⡼ɤǤѤǤޤ" +msgid "E691: Can only compare List with List" +msgstr "E691: ꥹȷϥꥹȷȤӤǤޤ" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E692: Invalid operation for List" +msgstr "E692: ꥹȷˤ̵Ǥ" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: ϴ¸ߤޤ: %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: 񷿤ϼ񷿤ȤӤǤޤ" -msgid "extend() argument" -msgstr "extend() ΰ" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: 񷿤ˤ̵Ǥ" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: ؿȷˤ̵Ǥ" msgid "map() argument" msgstr "map() ΰ" @@ -604,13 +687,39 @@ msgid "filter() argument" msgstr "filter() ΰ" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld : " +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s ΰϥꥹȷǤʤФʤޤ" + +msgid "E928: String required" +msgstr "E928: ʸɬפǤ" + +msgid "E808: Number or Float required" +msgstr "E808: ͤưɬפǤ" + +msgid "add() argument" +msgstr "add() ΰ" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() ⡼ɤǤѤǤޤ" + +msgid "&Ok" +msgstr "&Ok" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld : " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: ̤ΤδؿǤ: %s" +msgid "E922: expected a dict" +msgstr "E922: 񤬴ԤƤޤ" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function() 2 ϥꥹȷޤϼ񷿤ǤʤФʤޤ" + msgid "" "&OK\n" "&Cancel" @@ -627,196 +736,99 @@ msgstr "insert() msgid "E786: Range not allowed" msgstr "E786: ϰϻϵĤƤޤ" +msgid "E916: not a valid job" +msgstr "E916: ͭʥ֤ǤϤޤ" + msgid "E701: Invalid type for len()" msgstr "E701: len() ˤ̵ʷǤ" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID \":match\" Τͽ󤵤Ƥޤ: %ld" + msgid "E726: Stride is zero" msgstr "E726: ȥ饤() 0 Ǥ" msgid "E727: Start past end" -msgstr "E727: ϰ֤λ֤ۤޤ" - -msgid "<empty>" -msgstr "<>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim Фؤ³ޤ" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s 뤳ȤǤޤ" - -msgid "E277: Unable to read a server reply" -msgstr "E277: Фαޤ" - -msgid "remove() argument" -msgstr "remove() ΰ" - -# Added at 10-Mar-2004. -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: ܥå󥯤¿᤮ޤ (۴ĤƤǽޤ)" - -msgid "reverse() argument" -msgstr "reverse() ΰ" - -msgid "E258: Unable to send to client" -msgstr "E258: 饤Ȥ뤳ȤǤޤ" - -msgid "sort() argument" -msgstr "sort() ΰ" - -msgid "E702: Sort compare function failed" -msgstr "E702: ȤӴؿԤޤ" - -msgid "(Invalid)" -msgstr "(̵)" - -msgid "E677: Error writing temp file" -msgstr "E677: ե˥顼ȯޤ" - -msgid "E805: Using a Float as a Number" -msgstr "E805: ưͤȤưäƤޤ" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: ؿȷͤȤưäƤޤ" - -msgid "E745: Using a List as a Number" -msgstr "E745: ꥹȷͤȤưäƤޤ" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: 񷿤ͤȤưäƤޤ" - -msgid "E729: using Funcref as a String" -msgstr "E729: ؿȷʸȤưäƤޤ" - -msgid "E730: using List as a String" -msgstr "E730: ꥹȷʸȤưäƤޤ" - -msgid "E731: using Dictionary as a String" -msgstr "E731: 񷿤ʸȤưäƤޤ" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: ѿηפޤ: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: ѿ %s Ǥޤ" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: ؿȷѿ̾ʸǻϤޤʤФʤޤ: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: ѿ̾¸δؿ̾Ⱦͤޤ: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: ͤåƤޤ: %s" - -msgid "Unknown" -msgstr "" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s ͤѹǤޤ" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: ԡˤѿҤ᤮ޤ" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: ̤δؿǤ: %s" +msgstr "E727: ϰ֤λ֤ۤޤ" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' ޤ: %s" +msgid "<empty>" +msgstr "<>" -msgid "E862: Cannot use g: here" -msgstr "E862: Ǥ g: ϻȤޤ" +msgid "E240: No connection to the X server" +msgstr "E240: X Сؤ³ޤ" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: ʰǤ: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s 뤳ȤǤޤ" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: ̾ʣƤޤ: %s" +msgid "E277: Unable to read a server reply" +msgstr "E277: Сαޤ" -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction ޤ" +msgid "E941: already started a server" +msgstr "E941: СϤǤ˳ϤƤޤ" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: ؿ̾ѿ̾Ⱦͤޤ: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver ǽ̵ˤʤäƤޤ" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: ؿ %s Ǥޤ: Ǥ" +msgid "remove() argument" +msgstr "remove() ΰ" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: ؿ̾ץȤΥե̾Ȱפޤ: %s" +# Added at 10-Mar-2004. +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: ܥå󥯤¿᤮ޤ (۴ĤƤǽޤ)" -msgid "E129: Function name required" -msgstr "E129: ؿ̾׵ᤵޤ" +msgid "reverse() argument" +msgstr "reverse() ΰ" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: ؿ̾ʸǻϤޤ뤫ޤޤʤФʤޤ: %s" +msgid "E258: Unable to send to client" +msgstr "E258: 饤Ȥ뤳ȤǤޤ" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: ؿ %s Ǥޤ: Ǥ" +msgid "E927: Invalid action: '%s'" +msgstr "E927: ̵Ǥ: %s" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: ؿƽФҿ 'maxfuncdepth' Ķޤ" +msgid "sort() argument" +msgstr "sort() ΰ" -#, c-format -msgid "calling %s" -msgstr "%s ¹Ǥ" +msgid "uniq() argument" +msgstr "uniq() ΰ" -#, c-format -msgid "%s aborted" -msgstr "%s Ǥޤ" +msgid "E702: Sort compare function failed" +msgstr "E702: ȤӴؿԤޤ" -#, c-format -msgid "%s returning #%ld" -msgstr "%s #%ld ֤ޤ" +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq ӴؿԤޤ" -#, c-format -msgid "%s returning %s" -msgstr "%s %s ֤ޤ" +msgid "(Invalid)" +msgstr "(̵)" #, c-format -msgid "continuing in %s" -msgstr "%s μ¹Ԥ³Ǥ" - -msgid "E133: :return not inside a function" -msgstr "E133: ؿ :return ޤ" +msgid "E935: invalid submatch number: %d" +msgstr "E935: ̵ʥ֥ޥåֹ: %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# Хѿ:\n" +msgid "E677: Error writing temp file" +msgstr "E677: ե˥顼ȯޤ" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLast set from " +msgid "E921: Invalid callback argument" +msgstr "E921: ̵ʥХåǤ" -msgid "No old files" -msgstr "ŤեϤޤ" +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, 16ʿ %02x, 8ʿ %03o, %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, 16ʿ %02x, 8ʿ %03o" +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, 16ʿ %04x, 8ʿ %o, %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, 16ʿ %08x, 8ʿ %o, %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, 16ʿ %04x, 8ʿ %o" @@ -850,11 +862,11 @@ msgid "%sviminfo: %s in line: " msgstr "%sviminfo: %s : " msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: 顼¿᤮Τ, ʹߤϥåפޤ" +msgstr "E136: viminfo: 顼¿᤮Τǡʹߤϥåפޤ" #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" -msgstr "viminfoե \"%s\"%s%s%s ɹ " +msgstr "viminfoե \"%s\"%s%s%s ɹ" msgid " info" msgstr " " @@ -868,11 +880,14 @@ msgstr " msgid " FAILED" msgstr " " -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: viminfoե뤬ߤǤޤ: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: viminfoե뤬¿᤮ޤ! : %s" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: viminfoե %s ¸Ǥޤ!" @@ -881,7 +896,10 @@ msgstr "E138: viminfo msgid "Writing viminfo file \"%s\"" msgstr "viminfoե \"%s\" " -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfoե %s ̾ѹǤޤ!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# viminfo ե Vim %s ˤäޤ.\n" @@ -899,6 +917,13 @@ msgstr "# msgid "Illegal starting char" msgstr "ƬʸǤ" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# '|' ǻϤޤԤΡʸ̤Υԡ:\n" + msgid "Save As" msgstr "̾¸" @@ -993,8 +1018,8 @@ msgstr " ( msgid " on %ld lines" msgstr " ( %ld )" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global ƵŪˤϻȤޤ" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global ϰդǺƵŪˤϻȤޤ" msgid "E148: Regular expression missing from global" msgstr "E148: globalޥɤɽꤵƤޤ" @@ -1032,8 +1057,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "ǰǤإץե \"%s\" Ĥޤ" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: ǥ쥯ȥǤϤޤ: %s" +msgid "E151: No match: %s" +msgstr "E151: ޥåϤޤ: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1052,6 +1077,10 @@ msgstr "E670: 1 msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: \"%s\" ե %s/%s ˽ʣƤޤ" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: ǥ쥯ȥǤϤޤ: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: ̤ΤsignޥɤǤ: %s" @@ -1077,13 +1106,20 @@ msgstr "E159: sign msgid "E158: Invalid buffer name: %s" msgstr "E158: ̵ʥХåե̾Ǥ: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: ̵̾ХåեؤϥפǤޤ" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ̵sign̻ҤǤ: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: ѹǤʤ sign Ǥ: %s" + # Added at 27-Jan-2004. msgid " (NOT FOUND)" -msgstr " (Ĥޤ)" +msgstr " (Ĥޤ)" msgid " (not supported)" msgstr " (󥵥ݡ)" @@ -1091,9 +1127,20 @@ msgstr " ( msgid "[Deleted]" msgstr "[]" +msgid "No old files" +msgstr "ŤեϤޤ" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "ǥХå⡼ɤޤ. ³ˤ \"cont\" ϤƤ." +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Ť = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr " = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr " %ld: %s" @@ -1102,6 +1149,13 @@ msgstr " msgid "cmd: %s" msgstr "ޥ: %s" +msgid "frame is zero" +msgstr "ե졼ब 0 Ǥ" + +#, c-format +msgid "frame at highest level: %d" +msgstr "ǹ٥Υե졼: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "֥졼ݥ \"%s%s\" %ld" @@ -1117,6 +1171,10 @@ msgstr " msgid "%3d %s %s line %ld" msgstr "%3d %s %s %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: \":profile start {fname}\" ¹ԤƤ" @@ -1124,8 +1182,9 @@ msgstr "E750: msgid "Save changes to \"%s\"?" msgstr "ѹ \"%s\" ¸ޤ?" -msgid "Untitled" -msgstr "̵" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: ֤ϥХåե \"%s\" Ǥޤ¹Ǥ" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1156,8 +1215,16 @@ msgid "Searching for \"%s\"" msgstr "\"%s\" 򸡺" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "'runtimepath' ˤϸĤޤ: \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' ˤϤޤ: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: ׵ᤵ줿python 2.xбƤޤ󡢥ե̵뤷ޤ: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: ׵ᤵ줿python 3.xбƤޤ󡢥ե̵뤷ޤ: %s" msgid "Source Vim script" msgstr "VimץȤμ" @@ -1186,6 +1253,10 @@ msgstr " msgid "finished sourcing %s" msgstr "%s μλ" +#, c-format +msgid "continuing in %s" +msgstr "%s μ¹Ԥ³Ǥ" + msgid "modeline" msgstr "⡼ɹ" @@ -1219,7 +1290,8 @@ msgid "E197: Cannot set language to \"%s\"" msgstr "E197: \"%s\" Ǥޤ" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Ex⡼ɤޤ. Ρޥˤ\"visual\"ϤƤ." +msgstr "" +"Ex⡼ɤޤ. Ρޥ⡼ɤˤ\"visual\"ϤƤ." msgid "E501: At end-of-file" msgstr "E501: եνλ" @@ -1238,7 +1310,7 @@ msgid "End of function" msgstr "ؿκǸǤ" msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: 桼ޥɤΤޤʻѤǤ" +msgstr "E464: 桼ޥɤΤޤʻѤǤ" msgid "E492: Not an editor command" msgstr "E492: ǥΥޥɤǤϤޤ" @@ -1247,23 +1319,25 @@ msgid "E493: Backwards range given" msgstr "E493: դޤϰϤꤵޤ" msgid "Backwards range given, OK to swap" -msgstr "դޤϰϤꤵޤ, ؤޤ?" +msgstr "դޤϰϤꤵޤؤޤ?" msgid "E494: Use w or w>>" msgstr "E494: w ⤷ w>> ѤƤ" -msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: ΥСǤϤΥޥɤѤǤޤ, ʤ" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: ޥɥơ֥򹹿ɬפޤ'make cmdidxs' ¹ԤƤ" +"" -msgid "E172: Only one file name allowed" -msgstr "E172: ե̾ 1 ĤˤƤ" +msgid "E319: Sorry, the command is not available in this version" +msgstr "E319: ΥСǤϤΥޥɤѤǤޤ󡢤ʤ" msgid "1 more file to edit. Quit anyway?" -msgstr "Խ٤ե뤬 1 Ĥޤ, λޤ?" +msgstr "Խ٤ե뤬 1 Ĥޤλޤ?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "Խ٤ե뤬 %d Ĥޤ, λޤ?" +msgstr "Խ٤ե뤬 %d Ĥޤλޤ?" msgid "E173: 1 more file to edit" msgstr "E173: Խ٤ե뤬 1 Ĥޤ" @@ -1277,13 +1351,13 @@ msgstr "E174: msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" ̾ ϰ 䴰 " +" ̾ ɥ쥹 䴰 " msgid "No user-defined commands found" -msgstr "桼ޥɤĤޤǤ" +msgstr "桼ޥɤĤޤǤ" msgid "E175: No attribute specified" msgstr "E175: °Ƥޤ" @@ -1298,7 +1372,10 @@ msgid "E178: Invalid default value for count" msgstr "E178: Ȥξά̵ͤǤ" msgid "E179: argument required for -complete" -msgstr "E179: -䴰ΤΰɬפǤ" +msgstr "E179: -complete ˤϰɬפǤ" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr ˤϰɬפǤ" #, c-format msgid "E181: Invalid attribute: %s" @@ -1308,14 +1385,18 @@ msgid "E182: Invalid command name" msgstr "E182: ̵ʥޥ̾Ǥ" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: 桼ޥɤϱʸǻϤޤʤФʤޤ" +msgstr "E183: 桼ޥɤϱʸǻϤޤʤФʤޤ" msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: ͽ̾ʤΤ, 桼ޥɤѤǤޤ" +msgstr "E841: ͽ̾ʤΤǡ桼ޥɤѤǤޤ" #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: Υ桼ޥɤϤޤ: %s" +msgstr "E184: Υ桼ޥɤϤޤ: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ̵ʥɥ쥹ͤǤ: %s" #, c-format msgid "E180: Invalid complete value: %s" @@ -1358,7 +1439,7 @@ msgstr " msgid "E747: Cannot change directory, buffer is modified (add ! to override)" msgstr "" -"E747: ХåեƤΤ, ǥ쥯ȥѹǤޤ (! ɲä" +"E747: ХåեƤΤǡǥ쥯ȥѹǤޤ (! ɲä" ")" msgid "E186: No previous directory" @@ -1381,6 +1462,9 @@ msgstr "" msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos ˤ2ĤοͤΰɬפǤ" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: execute() Ǥ :redir ϻȤޤ" + msgid "Save Redirection" msgstr "쥯Ȥ¸ޤ" @@ -1405,7 +1489,6 @@ msgstr "E189: \"%s\" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: \"%s\" ѤȤƳޤ" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: 1ʸαѻ (' `) ǤʤФޤ" @@ -1444,13 +1527,15 @@ msgstr "E500: msgid "E195: Cannot open viminfo file for reading" msgstr "E195: viminfoեɹѤȤƳޤ" +msgid "Untitled" +msgstr "̵" + msgid "E196: No digraphs in this version" msgstr "E196: ΥС˹Ϥޤ" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: 'Vim' ǻϤޤ㳰 :throw Ǥޤ" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "㳰ȯޤ: %s" @@ -1467,7 +1552,6 @@ msgstr " msgid "%s, line %ld" msgstr "%s, %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "㳰ªޤ: %s" @@ -1493,7 +1577,6 @@ msgstr " msgid "Error" msgstr "顼" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "" @@ -1536,15 +1619,12 @@ msgstr "E601: :try msgid "E603: :catch without :try" msgstr "E603: :try Τʤ :catch ޤ" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :finally θ :catch ޤ" msgid "E606: :finally without :try" msgstr "E606: :try Τʤ :finally ޤ" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: ʣ :finally ޤ" @@ -1589,6 +1669,9 @@ msgstr " msgid "Input Line" msgstr "Ϲ" +msgid "Debug Line" +msgstr "ǥХå" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar ޥĹĶޤ" @@ -1602,13 +1685,13 @@ msgid "Illegal file name" msgstr "ʥե̾" msgid "is a directory" -msgstr " ϥǥ쥯ȥǤ" +msgstr "ϥǥ쥯ȥǤ" msgid "is not a file" -msgstr " ϥեǤϤޤ" +msgstr "ϥեǤϤޤ" msgid "is a device (disabled with 'opendevice' option)" -msgstr " ϥǥХǤ ('opendevice' ץDzǤޤ)" +msgstr "ϥǥХǤ ('opendevice' ץDzǤޤ)" msgid "[New File]" msgstr "[ե]" @@ -1620,7 +1703,7 @@ msgid "[File too big]" msgstr "[ե]" msgid "[Permission Denied]" -msgstr "[ǧĤޤ]" +msgstr "[¤ޤ]" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: *ReadPre autocommand եɹԲĤˤޤ" @@ -1634,7 +1717,6 @@ msgstr "Vim: ɸ msgid "Reading from stdin..." msgstr "ɸϤɹ..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: ѴեɹԲĤˤޤ" @@ -1662,12 +1744,6 @@ msgstr "[̤ msgid "[converted]" msgstr "[Ѵ]" -msgid "[blowfish]" -msgstr "[blowfishŹ沽]" - -msgid "[crypted]" -msgstr "[Ź沽]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[%ld ܤѴ顼]" @@ -1688,9 +1764,6 @@ msgstr "'charconvert' msgid "can't read output of 'charconvert'" msgstr "'charconvert' νϤɹޤǤ" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: ե뤬̤ΤˡǰŹ沽Ƥޤ" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwriteХåեγautocommand¸ߤޤ" @@ -1732,9 +1805,6 @@ msgstr "E509: msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: Хååץեޤ (! ɲäǶ)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: ꥽ե뤫⤷ޤ (! ɲäǶ)" - msgid "E214: Can't find temp file for writing" msgstr "E214: ¸Ѱե뤬Ĥޤ" @@ -1747,32 +1817,32 @@ msgstr "E166: msgid "E212: Can't open file for writing" msgstr "E212: Ѥ˥ե򳫤ޤ" -msgid "E667: Fsync failed" -msgstr "E667: fsync ˼Ԥޤ" +msgid "E949: File changed while writing" +msgstr "E949: ˥ե뤬ѹޤ" msgid "E512: Close failed" msgstr "E512: Ĥ뤳Ȥ˼" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: ߥ顼, Ѵ (񤹤ˤ 'fenc' ˤƤ)" +msgstr "E513: ߥ顼Ѵ (񤹤ˤ 'fenc' ˤƤ)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: ߥ顼, Ѵ, Կ %ld (񤹤ˤ 'fenc' ˤƤ" +"E513: ߥ顼ѴԡԿ %ld (񤹤ˤ 'fenc' ˤƤ" ")" msgid "E514: write error (file system full?)" -msgstr "E514: ߥ顼, (ե륷ƥब?)" +msgstr "E514: ߥ顼 (ե륷ƥब?)" msgid " CONVERSION ERROR" msgstr " Ѵ顼" #, c-format msgid " in line %ld;" -msgstr " %ld;" +msgstr " %ld;" msgid "[Device]" msgstr "[ǥХ]" @@ -1843,20 +1913,12 @@ msgstr "1 ʸ msgid "%lld characters" msgstr "%lld ʸ" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld ʸ" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[ǽԤԴ]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "ٹ: ɹ˥եѹޤ!!!" @@ -1934,11 +1996,16 @@ msgstr "-- msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "autocommand: %s <Хåե=%d> ưŪ˺ޤ" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Υ롼פϤޤ: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: ߤΥ롼פϺǤޤ" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: augroup äȤƤޤ" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: * θʸޤ: %s" @@ -1951,7 +2018,6 @@ msgstr "E216: msgid "E216: No such group or event: %s" msgstr "E216: Τ褦ʥ롼פ⤷ϥ٥ȤϤޤ: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2000,8 +2066,9 @@ msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: ߤ 'foldmethod' Ǥ޾ߤǤޤ" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld Ԥ޾ޤޤ " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld Ԥ޾ޤޤ" msgid "E222: Add to read buffer" msgstr "E222: ɹХåեɲ" @@ -2048,7 +2115,7 @@ msgid "E230: Cannot read from \"%s\"" msgstr "E230: \"%s\"ɹळȤǤޤ" msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: ͭʥեȤĤʤΤ, GUI򳫻ϤǤޤ" +msgstr "E665: ͭʥեȤĤʤΤǡGUI򳫻ϤǤޤ" msgid "E231: 'guifontwide' invalid" msgstr "E231: 'guifontwide' ̵Ǥ" @@ -2061,7 +2128,7 @@ msgid "E254: Cannot allocate color %s" msgstr "E254: %s οƤޤ" msgid "No match at cursor, finding next" -msgstr "ΰ֤˥ޥåϤޤ, 򸡺Ƥޤ" +msgstr "ΰ֤˥ޥåϤޤ󡢼򸡺Ƥޤ" msgid "<cannot open> " msgstr "<ޤ> " @@ -2094,6 +2161,18 @@ msgstr "Vim msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: åȥХåΤ BalloonEval Ǥޤ" +msgid "_Cancel" +msgstr "󥻥(_C)" + +msgid "_Save" +msgstr "¸(_S)" + +msgid "_Open" +msgstr "(_O)" + +msgid "_OK" +msgstr "_OK" + msgid "" "&Yes\n" "&No\n" @@ -2103,6 +2182,12 @@ msgstr "" "(&N)\n" "󥻥(&C)" +msgid "Yes" +msgstr "Ϥ" + +msgid "No" +msgstr "" + msgid "Input _Methods" msgstr "ץåȥ᥽å" @@ -2118,41 +2203,38 @@ msgstr " msgid "Replace with:" msgstr "ִʸ:" -#. whole word only button msgid "Match whole word only" msgstr "Τ˳Τ" -#. match case button msgid "Match case" msgstr "ʸ/ʸ̤" msgid "Direction" msgstr "" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "" msgid "Down" msgstr "" -#. 'Find Next' button msgid "Find Next" msgstr "򸡺" -#. 'Replace' button msgid "Replace" msgstr "ִ" -#. 'Replace All' button msgid "Replace All" msgstr "ִ" +msgid "_Close" +msgstr "Ĥ(_C)" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: åޥ͡㤫 \"die\" ׵ޤ\n" -msgid "Close" -msgstr "Ĥ" +msgid "Close tab" +msgstr "֥ڡĤ" msgid "New tab" msgstr "֥ڡ" @@ -2199,20 +2281,6 @@ msgstr " msgid "&Undo" msgstr "ɥ(&U)" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: ȥ뤬 \"%s\" ΥɥϸĤޤ" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: ϥݡȤޤ: \"-%s\"; OLEǤѤƤ." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDIץǤϥɥ򳫤ޤ" - -msgid "Close tab" -msgstr "֥ڡĤ" - msgid "Open tab..." msgstr "֥ڡ򳫤" @@ -2222,14 +2290,23 @@ msgstr " msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "ִ ('\\' 򸡺ˤ '\\\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Ȥޤ" msgid "Directory\t*.nothing\n" msgstr "ǥ쥯ȥ\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: ȥ뤬 \"%s\" ΥɥϸĤޤ" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: ϥݡȤޤ: \"-%s\"; OLEǤѤƤ." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDIץǤϥɥ򳫤ޤ" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "Vim E458: ꤬ʤΤǥȥƤޤ" @@ -2284,7 +2361,6 @@ msgstr "Vim - msgid "Name:" msgstr "̾:" -#. create toggle button msgid "Show size in Points" msgstr "ݥȤɽ" @@ -2491,6 +2567,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2501,6 +2578,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: ΥܥФõ\n" " c: δؿƤǤؿõ\n" " d: δؿƤǤؿõ\n" " e: egrepѥõ\n" @@ -2528,7 +2606,6 @@ msgstr "E261: cscope msgid "cscope connection %s closed" msgstr "cscope³ %s Ĥޤ" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: cs_manage_matches ̿Ūʥ顼Ǥ" @@ -2570,6 +2647,13 @@ msgid "" "loaded." msgstr "E815: Υޥɤ̵Ǥ. MzScheme 饤֥ɤǤޤ." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Υޥɤ̵Ǥʤ. MzScheme racket/base ⥸塼" +"뤬ɤǤޤǤ." + msgid "invalid expression" msgstr "̵ʼǤ" @@ -2621,19 +2705,6 @@ msgstr " msgid "not allowed in the Vim sandbox" msgstr "ɥܥåǤϵޤ" -#, c-format -msgid "E370: Could not load library %s" -msgstr "E370: 饤֥ %s ɤǤޤǤ" - -msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "" -"Υޥɤ̵Ǥ, ʤ: Perl饤֥ɤǤޤǤ." - -msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -msgstr "" -"E299: ɥܥåǤ Safe ⥸塼ѤʤPerlץȤ϶ؤ" -"Ƥޤ" - msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: VimǤ :py3 Ȥä :python Ȥޤ" @@ -2641,8 +2712,15 @@ msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." msgstr "" -"E263: Υޥɤ̵Ǥ,ʤ: Python饤֥ɤǤޤ" -"Ǥ." +"E263: Υޥɤ̵Ǥʤ: Python饤֥ɤǤޤ" +"Ǥ." + +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Υޥɤ̵Ǥʤ. Python site ⥸塼" +"ǤޤǤ." # Added at 07-Feb-2004. msgid "E659: Cannot invoke Python recursively" @@ -2656,120 +2734,31 @@ msgstr "E265: $_ msgid "" "E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: Υޥɤ̵Ǥ,ʤ: Ruby饤֥ɤǤޤ" -"." - -msgid "E267: unexpected return" -msgstr "E267: ͽ return Ǥ" - -msgid "E268: unexpected next" -msgstr "E268: ͽ next Ǥ" - -msgid "E269: unexpected break" -msgstr "E269: ͽ break Ǥ" - -msgid "E270: unexpected redo" -msgstr "E270: ͽ redo Ǥ" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: rescue γ retry Ǥ" - -msgid "E272: unhandled exception" -msgstr "E272: 갷ʤä㳰ޤ" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: ̤Τlongjmp: %d" - -msgid "Toggle implementation/definition" -msgstr "ڤؤ" - -msgid "Show base class of" -msgstr "Υ饹δɽ" - -msgid "Show overridden member function" -msgstr "С饤ɤ줿дؿɽ" - -msgid "Retrieve from file" -msgstr "ե뤫" - -msgid "Retrieve from project" -msgstr "ץȤ" - -msgid "Retrieve from all projects" -msgstr "ƤΥץȤ" - -msgid "Retrieve" -msgstr "" - -msgid "Show source of" -msgstr "Υɽ" - -msgid "Find symbol" -msgstr "Ĥܥ" - -msgid "Browse class" -msgstr "饹򻲾" - -msgid "Show class in hierarchy" -msgstr "ؤǥ饹ɽ" - -msgid "Show class in restricted hierarchy" -msgstr "ꤵ줿ؤǥ饹ɽ" - -msgid "Xref refers to" -msgstr "Xref λ" - -msgid "Xref referred by" -msgstr "Xref Ȥ" - -msgid "Xref has a" -msgstr "Xref ΤΤäƤޤ" - -msgid "Xref used by" -msgstr "Xref Ѥ" - -msgid "Show docu of" -msgstr "ʸϤɽ" - -msgid "Generate docu for" -msgstr "ʸϤ" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"SNiFF+³Ǥޤ. ĶåƤ(sniffemacs $PATH ˤʤ" -"Фʤޤ).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: ɹ˥顼ȯޤ. Ǥޤ" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ ξ֤ϡ" +msgstr "" +"E266: Υޥɤ̵Ǥʤ: Ruby饤֥ɤǤޤ" +"Ǥ." -msgid "not " -msgstr "̤" +msgid "E267: unexpected return" +msgstr "E267: ͽ return Ǥ" -msgid "connected" -msgstr "³פǤ" +msgid "E268: unexpected next" +msgstr "E268: ͽ next Ǥ" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: ̤Τ SNiFF+ ꥯȤǤ: %s" +msgid "E269: unexpected break" +msgstr "E269: ͽ break Ǥ" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+ ؤ³Υ顼Ǥ" +msgid "E270: unexpected redo" +msgstr "E270: ͽ redo Ǥ" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ ³Ƥޤ" +msgid "E271: retry outside of rescue clause" +msgstr "E271: rescue γ retry Ǥ" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SNiFF+ Хåեޤ" +msgid "E272: unhandled exception" +msgstr "E272: 갷ʤä㳰ޤ" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: ˥顼ȯΤǤޤ" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: ̤Τlongjmp: %d" msgid "invalid buffer number" msgstr "̵ʥХåեֹǤ" @@ -2777,7 +2766,6 @@ msgstr "̵ msgid "not implemented yet" msgstr "ޤƤޤ" -#. ??? msgid "cannot set line(s)" msgstr "ԤǤޤ" @@ -2819,7 +2807,6 @@ msgid "" msgstr "" "ХåޥɤϿǤޤ: Хåե/ɥ˾õޤ" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2834,7 +2821,7 @@ msgstr "" msgid "" "E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E571: Υޥɤ̵Ǥ,ʤ: Tcl饤֥ɤǤޤ" +"E571: Υޥɤ̵Ǥʤ: Tcl饤֥ɤǤޤ" "." #, c-format @@ -2845,18 +2832,30 @@ msgid "cannot get line" msgstr "ԤǤޤ" msgid "Unable to register a command server name" -msgstr "̿᥵Ф̾ϿǤޤ" +msgstr "̿᥵С̾ϿǤޤ" msgid "E248: Failed to send command to the destination program" msgstr "E248: ŪΥץؤΥޥ˼Ԥޤ" #, c-format msgid "E573: Invalid server id used: %s" -msgstr "E573: ̵ʥIDȤޤ: %s" +msgstr "E573: ̵ʥСIDȤޤ: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM ΤϿץѥƥǤ. õޤ!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSON˽ʣޤ: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: ꥹȷ˥ޤޤ: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: ꥹȷκǸ ']' ޤ: %s" + msgid "Unknown option argument" msgstr "̤ΤΥץǤ" @@ -2882,14 +2881,14 @@ msgstr "%d msgid "netbeans is not supported with this GUI\n" msgstr "netbeans ϤGUIǤѤǤޤ\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Vimˤdiffǽޤ(ѥ)." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' ԲǽǤ: ѥ̵ˤƤޤ\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Vimˤdiffǽޤ(ѥ)." + msgid "Attempt to open script file again: \"" -msgstr "ץȥեƤӳƤߤޤ: \"" +msgstr "ץȥեƤӳȤޤ: \"" msgid "Cannot open for reading: \"" msgstr "ɹѤȤƳޤ" @@ -2900,13 +2899,15 @@ msgstr " msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: 顼: NetBeansgvim򥹥ȤǤޤ\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: 顼: ΥСVimCygwinüǤưޤ\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: ٹ: üؤνϤǤϤޤ\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: ٹ: üϤǤϤޤ\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "vimrcΥޥɥ饤" @@ -3002,7 +3003,7 @@ msgid "-d\t\t\tDiff mode (like \"vimdiff\")" msgstr "-d\t\t\tʬ⡼ (\"vidiff\" Ʊ)" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\t⡼ (\"evim\" Ʊ, ⡼̵)" +msgstr "-y\t\t\t⡼ (\"evim\" Ʊ⡼̵)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\tɹѥ⡼ (\"view\" Ʊ)" @@ -3064,6 +3065,12 @@ msgstr "-F\t\t\t msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\tü <terminal> ꤹ" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tϤüǤʤȤηٹ򥹥åפ" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tϤüǤʤнλ" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t.vimrc <vimrc> Ȥ" @@ -3110,16 +3117,16 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tŹ沽줿եԽ" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <display>\tvimꤷ X Ф³" +msgstr "-display <display>\tvimꤷ X С³" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tXФ³ʤ" +msgstr "-X\t\t\tXС³ʤ" msgid "--remote <files>\tEdit <files> in a Vim server if possible" -msgstr "--remote <files>\tǽʤVimФ <files> Խ" +msgstr "--remote <files>\tǽʤVimС <files> Խ" msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <files> Ʊ, Ф̵ƤٹʸϤʤ" +msgstr "--remote-silent <files> Ʊ塢С̵ƤٹʸϤʤ" msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" @@ -3127,7 +3134,8 @@ msgstr "--remote-wait <files>\t--remote msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" -msgstr "--remote-wait-silent <files> Ʊ, Ф̵ƤٹʸϤʤ" +msgstr "" +"--remote-wait-silent <files> Ʊ塢С̵ƤٹʸϤʤ" msgid "" "--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" @@ -3136,16 +3144,16 @@ msgstr "" "ڡ򳫤" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" -msgstr "--remote-send <keys>\tVimФ <keys> ƽλ" +msgstr "--remote-send <keys>\tVimС <keys> ƽλ" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <expr>\tФ <expr> ¹ԤƷ̤ɽ" +msgstr "--remote-expr <expr>\tС <expr> ¹ԤƷ̤ɽ" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tVim̾ΰɽƽλ" +msgstr "--serverlist\t\tVimС̾ΰɽƽλ" msgid "--servername <name>\tSend to/become the Vim server <name>" -msgstr "--servername <name>\tVim <name> /̾ꤹ" +msgstr "--servername <name>\tVimС <name> /̾ꤹ" msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "--startuptime <file>\tưˤä֤ξܺ٤ <file> ؽϤ" @@ -3153,8 +3161,11 @@ msgstr "--startuptime <file>\t msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\t.viminfo <viminfo> Ȥ" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible'Vimδꡢץ饰ʤviminfoʤ" + msgid "-h or --help\tPrint Help (this message) and exit" -msgstr "-h or --help\tإ(Υå)ɽλ" +msgstr "-h or --help\tإ(Υå)ɽλ" msgid "--version\t\tPrint version information and exit" msgstr "--version\t\tСɽλ" @@ -3251,11 +3262,9 @@ msgstr "--windowid <HWND>\t msgid "No display" msgstr "ǥץ쥤Ĥޤ" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": ˼Ԥޤ.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": ˼Ԥޤ. Ǥμ¹ԤߤƤޤ\n" @@ -3276,7 +3285,6 @@ msgstr " msgid "E283: No marks matching \"%s\"" msgstr "E283: \"%s\" ˳ޡޤ" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3284,7 +3292,6 @@ msgstr "" "\n" "mark ե/ƥ" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3292,7 +3299,6 @@ msgstr "" "\n" " jump ե/ƥ" -#. Highlight title msgid "" "\n" "change line col text" @@ -3307,7 +3313,6 @@ msgstr "" "\n" "# եޡ:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3376,9 +3381,8 @@ msgstr "E298: msgid "E843: Error while updating swap file crypt" msgstr "E843: åץեΰŹ򹹿˥顼ȯޤ" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: ä, åץե뤬ޤ!!!" +msgstr "E301: äȡåץե뤬ޤ!!!" msgid "E302: Could not rename swap file" msgstr "E302: åץե̾Ѥޤ" @@ -3463,7 +3467,7 @@ msgid "" "If you entered a new crypt key but did not write the text file," msgstr "" "\n" -"Ź業ϤȤ˥ƥȥե¸Ƥʤ," +"Ź業ϤȤ˥ƥȥե¸Ƥʤϡ" msgid "" "\n" @@ -3477,7 +3481,7 @@ msgid "" "If you wrote the text file after changing the crypt key press enter" msgstr "" "\n" -"Ź業ѤȤ˥ƥȥե¸, ƥȥե" +"Ź業ѤȤ˥ƥȥե¸ϡƥȥե" msgid "" "\n" @@ -3537,7 +3541,7 @@ msgid "" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(ѹå뤿, Υե̤̾¸\n" +"(ѹå뤿ˡΥե̤̾¸\n" msgid "and run diff with the original file to check for changes)" msgstr "ܥեȤ diff ¹ԤɤǤ礦)" @@ -3551,13 +3555,12 @@ msgid "" "\n" msgstr "" "\n" -"줫.swpեƤ\n" +".swpեϺƤ⹽ޤ\n" "\n" msgid "Using crypt key from swap file for the text file.\n" msgstr "åץե뤫Ź業ƥȥե˻Ȥޤ.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "åץե뤬ʣĤޤ:" @@ -3565,7 +3568,7 @@ msgid " In current directory:\n" msgstr " ߤΥǥ쥯ȥ:\n" msgid " Using specified name:\n" -msgstr " ̾:\n" +msgstr " ʲ̾:\n" msgid " In directory " msgstr " ǥ쥯ȥ " @@ -3609,7 +3612,7 @@ msgid "" " user name: " msgstr "" "\n" -" 桼̾: " +" 桼̾: " msgid " host name: " msgstr " ۥ̾: " @@ -3727,21 +3730,17 @@ msgstr " msgid " NEWER than swap file!\n" msgstr " åץե⿷Ǥ!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) ̤ΥץबƱեԽƤ뤫⤷ޤ.\n" -" ξˤ, ѹ򤷤ݤ˺ǽŪ, Ʊեΰۤʤ\n" -" 2ĤΥ󥹥󥹤ǤƤޤȤդƤ." - -msgid " Quit, or continue with caution.\n" -msgstr " λ뤫, դʤ³Ƥ.\n" +" ξˤϡѹ򤷤Ƥޤ1ĤΥեФưۤʤ2Ĥ\n" +" 󥹥󥹤ǤƤޤΤǡʤ褦˵ĤƤ.\n" +" λ뤫դʤ³Ƥ.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) ΥեԽå󤬥å夷.\n" @@ -3757,7 +3756,7 @@ msgstr "" " ѤѹꥫСޤ(\":help recovery\" 򻲾).\n" msgid " If you did this already, delete the swap file \"" -msgstr " ˤԤʤäΤʤ, åץե \"" +msgstr " ˤԤʤäΤʤСåץե \"" msgid "" "\"\n" @@ -3819,7 +3818,6 @@ msgstr "E328: msgid "E329: No menu \"%s\"" msgstr "E329: \"%s\" Ȥ˥塼Ϥޤ" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: ˥塼̾Ǥ" @@ -3832,8 +3830,6 @@ msgstr "E331: msgid "E332: Separator cannot be part of a menu path" msgstr "E332: ڤϥ˥塼ѥΰǤϤޤ" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3844,6 +3840,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Υ˥塼ڤ" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: %s ˤϥ˥塼Ƥޤ" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: ˥塼ѥϥ˥塼ƥʤФޤ" @@ -3851,10 +3851,6 @@ msgstr "E333: msgid "E334: Menu not found: %s" msgstr "E334: ˥塼Ĥޤ: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: %s ˤϥ˥塼Ƥޤ" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: ˥塼ѥϥ֥˥塼ʤФޤ" @@ -3924,15 +3920,14 @@ msgstr " msgid "Open File dialog" msgstr "եɹ" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: 󥽡⡼ɤǤϥե֥饦Ȥޤ, ʤ" +msgstr "E338: 󥽡⡼ɤǤϥե֥饦Ȥޤ󡢤ʤ" msgid "E766: Insufficient arguments for printf()" msgstr "E766: printf() ΰԽʬǤ" msgid "E807: Expected Float argument for printf()" -msgstr "E807: printf() ΰˤưԤƤޤ" +msgstr "E807: printf() ΰˤưԤƤޤ" msgid "E767: Too many arguments to printf()" msgstr "E767: printf() ΰ¿᤮ޤ" @@ -3967,13 +3962,6 @@ msgstr " ( msgid "Beep!" msgstr "ӡ!" -msgid "Vim: preserving files...\n" -msgstr "Vim: ե¸...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: λޤ.\n" - msgid "ERROR: " msgstr "顼: " @@ -4023,15 +4011,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: ʥѡơǤ" -msgid "Enter encryption key: " -msgstr "Ź沽ѤΥϤƤ: " - -msgid "Enter same key again: " -msgstr "⤦ƱϤƤ: " - -msgid "Keys don't match!" -msgstr "פޤ" - msgid "E854: path too long for completion" msgstr "E854: ѥĹ᤮䴰Ǥޤ" @@ -4059,20 +4038,11 @@ msgstr "E346: cdpath msgid "E347: No more file \"%s\" found in path" msgstr "E347: ѥˤϤʾ \"%s\" Ȥե뤬ޤ" -msgid "Cannot connect to Netbeans #2" -msgstr "Netbeans #2 ³Ǥޤ" - -msgid "Cannot connect to Netbeans" -msgstr "Netbeans ³Ǥޤ" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: NetBeans³եΥ⡼ɤ꤬ޤ: \"%s\"" -msgid "read from Netbeans socket" -msgstr "Netbeans ΥåȤɹ" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Хåե %ld NetBeans ³ޤ" @@ -4114,8 +4084,10 @@ msgstr "E662: msgid "E663: At end of changelist" msgstr "E663: ѹꥹȤ" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Vimλˤ :quit<Enter> ϤƤ" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"٤Ƥѹ˴Vimλˤ :qa! Ϥ <Enter> 򲡤Ƥ" +"" #, c-format msgid "1 line %sed 1 time" @@ -4147,7 +4119,6 @@ msgstr "%ld msgid "E748: No previously used register" msgstr "E748: ޤ쥸ѤƤޤ" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "󥯤Ǥޤ; Ȥˤõ" @@ -4162,25 +4133,30 @@ msgstr "%ld msgid "freeing %ld lines" msgstr "%ld Ԥ" -msgid "block of 1 line yanked" -msgstr "1 ԤΥ֥å󥯤ޤ" +#, c-format +msgid " into \"%c" +msgstr " \"%c " + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "1 ԤΥ֥å%s󥯤ޤ" -msgid "1 line yanked" -msgstr "1 Ԥ󥯤ޤ" +#, c-format +msgid "1 line yanked%s" +msgstr "1 Ԥ%s󥯤ޤ" #, c-format -msgid "block of %ld lines yanked" -msgstr "%ld ԤΥ֥å󥯤ޤ" +msgid "block of %ld lines yanked%s" +msgstr "%ld ԤΥ֥å%s󥯤ޤ" #, c-format -msgid "%ld lines yanked" -msgstr "%ld Ԥ󥯤ޤ" +msgid "%ld lines yanked%s" +msgstr "%ld Ԥ%s󥯤ޤ" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: 쥸 %s ˤϲ⤢ޤ" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4202,37 +4178,41 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: ̤ΤΥ쥸 %d Ǥ" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "E883: ѥȼ쥸ˤ2԰ʾޤޤ" + #, c-format msgid "%ld Cols; " msgstr "%ld ; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr " %s%ld / %ld ; %ld / %ld ñ; %ld / %ld Х" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr " %s%ld / %ld ; %lld / %lld ñ; %lld / %lld Х" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr " %s%ld / %ld ; %ld / %ld ñ; %ld / %ld ʸ; %ld / %ld Х" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +" %s%ld / %ld ; %lld / %lld ñ; %lld / %lld ʸ; %lld / %lld Х" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr " %s / %s; %ld of %ld; ñ %ld / %ld; Х %ld / %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr " %s / %s; %ld of %ld; ñ %lld / %lld; Х %lld / %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -" %s / %s; %ld / %ld; ñ %ld / %ld; ʸ %ld / %ld; Х %ld of %ld" +" %s / %s; %ld / %ld; ñ %lld / %lld; ʸ %lld / %lld; Х %lld of " +"%lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld for BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=%N ڡ" +msgid "(+%lld for BOM)" +msgstr "(+%lld for BOM)" msgid "Thanks for flying Vim" msgstr "Vim ȤäƤƤ꤬Ȥ" @@ -4259,6 +4239,10 @@ msgstr "E522: termcap msgid "E539: Illegal character <%s>" msgstr "E539: ʸǤ <%s>" +#, c-format +msgid "For option %s" +msgstr "ץ: %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' ˤ϶ʸǤޤ" @@ -4280,6 +4264,10 @@ msgstr "E835: 'fillchars' msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: GTK+2 GUIǤѹǤޤ" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: %s %s δ֤ѴǤޤ" + msgid "E524: Missing colon" msgstr "E524: 󤬤ޤ" @@ -4337,12 +4325,18 @@ msgstr "E541: msgid "E542: unbalanced groups" msgstr "E542: 롼פ礤ޤ" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: ¹Υ֤üѹǽˤǤޤ" + msgid "E590: A preview window already exists" msgstr "E590: ץӥ塼ɥ¸ߤޤ" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "" -"W17: ӥʸˤUTF-8ɬפʤΤ, ':set encoding=utf-8' Ƥ" +"W17: ӥʸˤUTF-8ɬפʤΤǡ':set encoding=utf-8' Ƥ" + +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24bitϤδĶǤϥݡȤƤޤ" #, c-format msgid "E593: Need at least %d lines" @@ -4356,9 +4350,6 @@ msgstr "E594: msgid "E355: Unknown option: %s" msgstr "E355: ̤ΤΥץǤ: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: ɬפǤ: &%s = '%s'" @@ -4431,7 +4422,6 @@ msgstr " msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: 󥽡ǤϤʤ??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: -f ץǥ¹ԤǤޤ" @@ -4453,9 +4443,6 @@ msgstr " msgid "Message" msgstr "å" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' 80ǤϤʤ, ޥɤ¹ԤǤޤ" - msgid "E237: Printer selection failed" msgstr "E237: ץ󥿤˼Ԥޤ" @@ -4480,23 +4467,16 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: ʸå̾ \"%s\" Ǥ (ե̾ \"%s\")" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: '%c' ʸǤ (ե̾ \"%s\")" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: 2ŤΥʥΤ, λޤ\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: ̿Ūʥ %s Τޤ\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: ʼ̾ \"%s\" Ǥ (ե̾ \"%s\")" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: ̿ŪʥΤޤ\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: '%c' ʸǤ (ե̾ \"%s\")" #, c-format msgid "Opening the X display took %ld msec" -msgstr "XФؤ³ %ld ߥäޤ" +msgstr "XСؤ³ %ld ߥäޤ" msgid "" "\n" @@ -4525,12 +4505,13 @@ msgstr "" "\n" "ƥƥȤǤޤ " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"¹ԤǤޤ " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "ƥƥ %s %s Ǥޤ" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "ƥƥ %s %s Ǥޤ. ޤ!" msgid "" "\n" @@ -4560,6 +4541,13 @@ msgstr "" "\n" "fork Ǥޤ\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"¹ԤǤޤ " + msgid "" "\n" "Command terminated\n" @@ -4602,10 +4590,6 @@ msgstr "VIM msgid "Could not fix up function pointers to the DLL!" msgstr "DLLؿݥ󥿤ǤޤǤ" -#, c-format -msgid "shell returned %d" -msgstr "뤬 %d ǽλޤ" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: ٥ %s \n" @@ -4634,6 +4618,13 @@ msgstr "" msgid "Vim Warning" msgstr "Vimηٹ" +#, c-format +msgid "shell returned %d" +msgstr "뤬 %d ǽλޤ" + +msgid "E926: Current location list was changed" +msgstr "E926: ߤΥꥹȤѹޤ" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: եޥåʸ %%%c ¿᤮ޤ" @@ -4666,6 +4657,12 @@ msgstr "E379: msgid "E553: No more items" msgstr "E553: Ǥ⤦ޤ" +msgid "E924: Current window was closed" +msgstr "E924: ߤΥɥĤޤ" + +msgid "E925: Current quickfix was changed" +msgstr "E925: ߤ quickfix ѹޤ" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d of %d)%s%s: " @@ -4673,18 +4670,18 @@ msgstr "(%d of %d)%s%s: " msgid " (line deleted)" msgstr " (Ԥޤ)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s 顼 %d of %d; %d ĥ顼" + msgid "E380: At bottom of quickfix stack" msgstr "E380: quickfix åǤ" msgid "E381: At top of quickfix stack" msgstr "E381: quickfix åƬǤ" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "顼 %d of %d; %d ĥ顼" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: 'buftype' ץꤵƤΤǽߤޤ" +msgid "No entries" +msgstr "ȥ꤬ޤ" msgid "Error file" msgstr "顼ե" @@ -4711,6 +4708,12 @@ msgstr "E369: ̵ msgid "E769: Missing ] after %s[" msgstr "E769: %s[ θ ] ޤ" +msgid "E944: Reverse range in character class" +msgstr "E944: ʸ饹ϰϤդǤ" + +msgid "E945: Range too large in character class" +msgstr "E945: ʸ饹ϰϤ礭ޤ" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: %s%%( äƤޤ" @@ -4740,6 +4743,10 @@ msgstr "E69: %s%%[ msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] Ǥ" +# +msgid "E65: Illegal back reference" +msgstr "E65: ʸȤǤ" + msgid "E339: Pattern too long" msgstr "E339: ѥĹ᤮ޤ" @@ -4777,10 +4784,6 @@ msgstr "E63: \\_ msgid "E64: %s%c follows nothing" msgstr "E64:%s%c θˤʤˤ⤢ޤ" -# -msgid "E65: Illegal back reference" -msgstr "E65: ʸȤǤ" - # msgid "E68: Invalid character after \\z" msgstr "E68: \\z θʸޤ" @@ -4802,29 +4805,43 @@ msgstr "E554: %s{...} msgid "External submatches:\n" msgstr "ʬ:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA ɽ) ֤ޤ %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= ˤ 0, 1 ⤷ 2 Τߤ³ޤ" -"ɽ󥸥ϼư򤵤ޤ" +"E864: \\%#= ˤ 0, 1 ⤷ 2 Τߤ³ޤɽ󥸥ϼư" +"򤵤ޤ" + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Υѥ˥Хåȥå RE 󥸥ŬѤޤ: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Ԥ᤯ɽνüãޤ" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA ɽ) ֤äƤޤ: %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) Ԥ᤯ɽνüãޤ" +# +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA ɽ) ̵ʸ饹: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) ̤ΤΥڥ졼Ǥ: '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% ͤĹ᤮ޤ" + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (NFA) ̤ΤΥڥ졼Ǥ: '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: 饹ޤNFAۤ˼Ԥޤ!" @@ -4835,11 +4852,9 @@ msgstr "E869: (NFA) ̤ msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (NFA ɽ) ֤²ɹ˥顼" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (NFA ɽ) ֤ θ ֤ ϤǤޤ!" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (NFA ɽ) '(' ¿᤮ޤ" @@ -4856,8 +4871,8 @@ msgid "" "E875: (NFA regexp) (While converting from postfix to NFA), too many states " "left on stack" msgstr "" -"E875: (NFA ɽ) (ʸNFAѴ) " -"å˻Ĥ줿ơȤ¿᤮ޤ" +"E875: (NFA ɽ) (ʸNFAѴ) å˻Ĥ줿ơȤ" +"¿᤮ޤ" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (NFA ɽ) NFAΤ¸ˤ϶ڡ­ޤ" @@ -4867,8 +4882,9 @@ msgstr "E878: (NFA) msgid "" "Could not open temporary log file for writing, displaying on stderr ... " -msgstr "NFAɽ󥸥ѤΥեѤȤƳޤ" -"ɸϤ˽Ϥޤ" +msgstr "" +"NFAɽ󥸥ѤΥեѤȤƳޤ󡣥ɸϤ" +"Ϥޤ" #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -4904,9 +4920,6 @@ msgstr " msgid " Arabic" msgstr " ӥ" -msgid " (lang)" -msgstr " ()" - msgid " (paste)" msgstr " (Žդ)" @@ -4949,7 +4962,6 @@ msgstr "E386: ';' msgid " (includes previously listed match)" msgstr " (󤷤սޤ)" -#. cursor at status line msgid "--- Included files " msgstr "--- 󥯥롼ɤ줿ե " @@ -5001,8 +5013,47 @@ msgstr "" "# Ǹ %sѥ:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: ڥեν񼰥顼Ǥ" +msgid "E756: Spell checking is not enabled" +msgstr "E756: ڥå̵Ƥޤ" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"ٹ: ñꥹ \"%s_%s.spl\" \"%s_ascii.spl\" ϸĤޤ" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"ٹ: ñꥹ \"%s.%s.spl\" \"%s.ascii.spl\" ϸĤޤ" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: autocommand SpellFileMissing Хåեޤ" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "ٹ9: %s ȤϰϤϥݡȤƤޤ" + +msgid "Sorry, no suggestions" +msgstr "ǰǤϤޤ" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "ǰǤ %ld Ĥޤ" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "\"%.*s\" 򼡤Ѵ:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: ڥִޤ¹ԤƤޤ" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Ĥޤ: %s" msgid "E758: Truncated spell file" msgstr "E758: ڥե뤬ڼƤ褦Ǥ" @@ -5025,19 +5076,6 @@ msgstr "E762: FOL, LOW msgid "Compressing word tree..." msgstr "ñĥ꡼򰵽̤Ƥޤ..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: ڥå̵Ƥޤ" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -"ٹ: ñꥹ \"%s_%s.spl\" \"%s_ascii.spl\" ϸĤޤ" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"ٹ: ñꥹ \"%s.%s.spl\" \"%s.ascii.spl\" ϸĤޤ" - #, c-format msgid "Reading spell file \"%s\"" msgstr "ڥե \"%s\" ɹ" @@ -5046,7 +5084,7 @@ msgid "E757: This does not look like a spell file" msgstr "E757: ڥեǤϤʤ褦Ǥ" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: ŤڥեʤΤ, åץǡȤƤ" +msgstr "E771: ŤڥեʤΤǡåץǡȤƤ" msgid "E772: Spell file is for newer version of Vim" msgstr "E772: 꿷С Vim ѤΥڥեǤ" @@ -5055,8 +5093,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: ڥե˥ݡȤƤʤ󤬤ޤ" #, c-format -msgid "Warning: region %s not supported" -msgstr "ٹ9: %s ȤϰϤϥݡȤƤޤ" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug եǤϤʤ褦Ǥ: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Ť .sug եʤΤǡåץǡȤƤ: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: 꿷С Vim Ѥ .sug եǤ: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug ե뤬 .spl եȰפޤ: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug եɹ˥顼ȯޤ: %s" #, c-format msgid "Reading affix file %s ..." @@ -5204,8 +5258,8 @@ msgid "E760: No word count in %s" msgstr "E760: %s ˤñޤ" #, c-format -msgid "line %6d, word %6d - %s" -msgstr " %6d, ñ %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr " %6d, ñ %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5241,7 +5295,7 @@ msgstr "%s #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "%s %d , ϰϻ꤬¿᤮ޤ: %s" +msgstr "%s %d ܡϰϻ꤬¿᤮ޤ: %s" #, c-format msgid "/ line ignored in %s line %d: %s" @@ -5269,10 +5323,6 @@ msgstr " msgid "Reading back spell file..." msgstr "ڥեɹ" -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "ߤ¹..." @@ -5295,8 +5345,9 @@ msgstr " msgid "E751: Output file name must not have region name" msgstr "E751: ϥե̾ˤϰ̾ޤޤ" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: ϰϤ 8 ĤޤǤݡȤƤޤ" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: ϰϤ %ld ĤޤǤݡȤƤޤ" #, c-format msgid "E755: Invalid region in %s" @@ -5317,72 +5368,50 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' ˤ %ld ĤΥȥϤޤ" #, c-format -msgid "Word removed from %s" -msgstr "%s ñ줬ޤ" +msgid "Word '%.*s' removed from %s" +msgstr "ñ '%.*s' %s ޤ" #, c-format -msgid "Word added to %s" -msgstr "%s ñ줬ɲäޤ" +msgid "Word '%.*s' added to %s" +msgstr "ñ '%.*s' %s ɲäޤ" msgid "E763: Word characters differ between spell files" msgstr "E763: ñʸڥեȰۤʤޤ" -msgid "Sorry, no suggestions" -msgstr "ǰǤ, Ϥޤ" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "ǰǤ, %ld Ĥޤ" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "\"%.*s\" 򼡤Ѵ:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: ڥִޤ¹ԤƤޤ" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Ĥޤ: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug եǤϤʤ褦Ǥ: %s" - -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Ť .sug եʤΤ, åץǡȤƤ: %s" - -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: 꿷С Vim Ѥ .sug եǤ: %s" - -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug ե뤬 .spl եȰפޤ: %s" - -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug եɹ˥顼ȯޤ: %s" - -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: MAP ȥ˽ʣʸ¸ߤޤ" msgid "No Syntax items defined for this buffer" msgstr "ΥХåե줿ʸǤϤޤ" +msgid "syntax conceal on" +msgstr "ʸ conceal ϸ on Ǥ" + +msgid "syntax conceal off" +msgstr "ʸ conceal ϸ off Ǥ" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: ʰǤ: %s" +msgid "syntax case ignore" +msgstr "ʸʸʸϸ ignore Ǥ" + +msgid "syntax case match" +msgstr "ʸʸʸϸ match Ǥ" + +msgid "syntax spell toplevel" +msgstr "ʸ spell ϸ toplevel Ǥ" + +msgid "syntax spell notoplevel" +msgstr "ʸ spell ϸ notoplevel Ǥ" + +msgid "syntax spell default" +msgstr "ʸ spell ϸ default Ǥ" + +msgid "syntax iskeyword " +msgstr "ʸ iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Τ褦ʹʸ饹Ϥޤ: %s" @@ -5459,6 +5488,10 @@ msgstr "E847: msgid "E789: Missing ']': %s" msgstr "E789: ']' ޤ: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']' θ;ʬʸޤ: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' ޤ: %s" @@ -5541,7 +5574,7 @@ msgstr "E415: ͽ #, c-format msgid "E416: missing equal sign: %s" -msgstr "E416: 椬ޤ: %s" +msgstr "E416: 椬ޤ: %s" #, c-format msgid "E417: missing argument: %s" @@ -5588,7 +5621,7 @@ msgid "E556: at top of tag stack" msgstr "E556: åƬǤ" msgid "E425: Cannot go before first matching tag" -msgstr "E425: ǽγĶ뤳ȤϤǤޤ" +msgstr "E425: ǽγۤ뤳ȤϤǤޤ" #, c-format msgid "E426: tag not found: %s" @@ -5604,13 +5637,12 @@ msgid "E427: There is only one matching tag" msgstr "E427: 1Ĥޤ" msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: Ǹ˳륿ĶƿʤळȤϤǤޤ" +msgstr "E428: ǸγۤƿʤळȤϤǤޤ" #, c-format msgid "File \"%s\" does not exist" msgstr "ե \"%s\" ޤ" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr " %d (%d%s)" @@ -5625,7 +5657,6 @@ msgstr " msgid "E429: File \"%s\" does not exist" msgstr "E429: ե \"%s\" ޤ" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5656,7 +5687,6 @@ msgstr "ľ msgid "E432: Tags file not sorted: %s" msgstr "E432: ե뤬ȤƤޤ: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: ե뤬ޤ" @@ -5692,7 +5722,6 @@ msgstr "E436: termcap msgid "E437: terminal capability \"cm\" required" msgstr "E437: ü \"cm\" ǽɬפǤ" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5700,6 +5729,35 @@ msgstr "" "\n" "--- ü ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txt򳫤ޤ" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "\"%s\" Υ֤λޤ?" + +msgid "Terminal" +msgstr "ü" + +msgid "Terminal-finished" +msgstr "ü (λ)" + +msgid "active" +msgstr "ƥ" + +msgid "running" +msgstr "¹" + +msgid "finished" +msgstr "λ" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: եϴ¸ߤޤ: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: üХåեǤϤޤ" + msgid "new shell started\n" msgstr "ưޤ\n" @@ -5709,12 +5767,9 @@ msgstr "Vim: msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "ΰΤCUT_BUFFER0Ѥޤ" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: ͽԥȤѤޤ" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: ͽԥȤѤޤ" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "ǽʥɥϤޤ: Ȥꤢ³ޤ" @@ -5847,13 +5902,133 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: ɥԤޤ" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16/32 ӥå GUI " +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: ؿ %s ѤǤˤ ! ɲäƤ" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: ˥ȥ꤬¸ߤޤ" + +msgid "E718: Funcref required" +msgstr "E718: ؿȷ׵ᤵޤ" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: ̤ΤδؿǤ: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: ʰǤ: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: ̾ʣƤޤ: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: ؿΰ¿᤮ޤ: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: ؿ̵ʰǤ: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: ؿƽФҿ 'maxfuncdepth' Ķޤ" + +#, c-format +msgid "calling %s" +msgstr "%s ¹Ǥ" + +#, c-format +msgid "%s aborted" +msgstr "%s Ǥޤ" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s #%ld ֤ޤ" + +#, c-format +msgid "%s returning %s" +msgstr "%s %s ֤ޤ" + +msgid "E699: Too many arguments" +msgstr "E699: ¿᤮ޤ" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: ̤ΤδؿǤ: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: ؿϺޤ: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: ؿΰ­ޤ: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: ץȰʳ<SID>Ȥޤ: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: ѴؿƤФޤ񤬤ޤ: %s" + +msgid "E129: Function name required" +msgstr "E129: ؿ̾׵ᤵޤ" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: ؿ̾ʸ \"s:\" ǻϤޤʤФʤޤ: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: ؿ̾ˤϥϴޤޤ: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: ̤δؿǤ: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(' ޤ: %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: Ǥ g: ϻȤޤ" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: 㡼ؿϥȥåץ٥˵ҤǤޤ: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction ޤ" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction θʸޤ: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: ؿ̾ѿ̾Ⱦͤޤ: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: ؿ %s Ǥޤ: Ǥ" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: ؿ̾ץȤΥե̾Ȱפޤ: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: ؿ %s Ǥޤ: Ǥ" + +msgid "E133: :return not inside a function" +msgstr "E133: ؿ :return ޤ" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: å '(' ޤ: %s" msgid "" "\n" @@ -5869,9 +6044,6 @@ msgstr "" "\n" "MS-Windows 32 ӥå GUI " -msgid " in Win32s mode" -msgstr " in Win32s ⡼" - msgid " with OLE support" msgstr " with OLE ݡ" @@ -5891,45 +6063,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16 ӥå " - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32 ӥå MS-DOS " - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16 ӥå MS-DOS " - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"MacOS X (unix) " - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"MacOS X " +"macOS " msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"MacOS " +"macOS (darwin ̵)" msgid "" "\n" @@ -6003,6 +6147,9 @@ msgstr "" msgid "without GUI." msgstr "without GUI." +msgid "with GTK3 GUI." +msgstr "with GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "with GTK2-GNOME GUI." @@ -6030,9 +6177,6 @@ msgstr "with Carbon GUI." msgid "with Cocoa GUI." msgstr "with Cocoa GUI." -msgid "with (classic) GUI." -msgstr "with (饷å) GUI." - msgid " Features included (+) or not (-):\n" msgstr " ǽΰ ͭ(+)/̵(-)\n" @@ -6040,31 +6184,34 @@ msgid " system vimrc file: \"" msgstr " ƥ vimrc: \"" msgid " user vimrc file: \"" -msgstr " 桼 vimrc: \"" +msgstr " 桼 vimrc: \"" msgid " 2nd user vimrc file: \"" -msgstr " 2桼 vimrc: \"" +msgstr " 2桼 vimrc: \"" msgid " 3rd user vimrc file: \"" -msgstr " 3桼 vimrc: \"" +msgstr " 3桼 vimrc: \"" msgid " user exrc file: \"" -msgstr " 桼 exrc: \"" +msgstr " 桼 exrc: \"" msgid " 2nd user exrc file: \"" -msgstr " 2桼 exrc: \"" +msgstr " 2桼 exrc: \"" msgid " system gvimrc file: \"" msgstr " ƥ gvimrc: \"" msgid " user gvimrc file: \"" -msgstr " 桼 gvimrc: \"" +msgstr " 桼 gvimrc: \"" msgid "2nd user gvimrc file: \"" -msgstr " 2桼 gvimrc: \"" +msgstr " 2桼 gvimrc: \"" msgid "3rd user gvimrc file: \"" -msgstr " 3桼 gvimrc: \"" +msgstr " 3桼 gvimrc: \"" + +msgid " defaults file: \"" +msgstr " ǥեȥե: \"" msgid " system menu file: \"" msgstr " ƥ˥塼: \"" @@ -6111,8 +6258,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr "饤إפ :help<Enter> <F1> " -msgid "type :help version7<Enter> for version info" -msgstr "С :help version7<Enter> " +msgid "type :help version8<Enter> for version info" +msgstr "С :help version8<Enter> " msgid "Running in Vi compatible mode" msgstr "Viߴ⡼ɤư" @@ -6124,19 +6271,19 @@ msgid "type :help cp-default<Enter> for info on this" msgstr "ܺ٤ʾ :help cp-default<Enter>" msgid "menu Help->Orphans for information " -msgstr "ܺ٤ϥ˥塼 إעɻ 򻲾ȤƲ " +msgstr "ܺ٤ϥ˥塼 إ->ɻ 򻲾ȤƲ " msgid "Running modeless, typed text is inserted" -msgstr "⡼̵Ǽ¹, פʸޤ" +msgstr "⡼̵Ǽ¹档פʸޤ" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "˥塼 Խꢪ(鿴)⡼ " +msgstr "˥塼 Խ->->(鿴)⡼ " msgid " for two modes " msgstr " ǥ⡼ͭ " msgid "menu Edit->Global Settings->Toggle Vi Compatible" -msgstr "˥塼 ԽꢪViߴ⡼ " +msgstr "˥塼 Խ->->Viߴ⡼ " msgid " for Vim defaults " msgstr " VimȤư " @@ -6145,7 +6292,7 @@ msgid "Sponsor Vim development!" msgstr "Vimγȯ礷Ƥ!" msgid "Become a registered Vim user!" -msgstr "VimϿ桼ˤʤäƤ!" +msgstr "VimϿ桼ˤʤäƤ!" msgid "type :help sponsor<Enter> for information " msgstr "ܺ٤ʾ :help sponsor<Enter> " @@ -6154,13 +6301,7 @@ msgid "type :help register<Enter> for information " msgstr "ܺ٤ʾ :help register<Enter> " msgid "menu Help->Sponsor/Register for information " -msgstr "ܺ٤ϥ˥塼 إעݥ󥵡/Ͽ 򻲾ȤƲ " - -msgid "WARNING: Windows 95/98/ME detected" -msgstr " ٹ: Windows 95/98/Me 򸡽 " - -msgid "type :help windows95<Enter> for info on this" -msgstr " ܺ٤ʾ :help windows95<Enter> " +msgstr "ܺ٤ϥ˥塼 إ->ݥ󥵡/Ͽ 򻲾ȤƲ" msgid "Already only one window" msgstr "˥ɥ1Ĥޤ" @@ -6193,6 +6334,38 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: pathˤ \"%s\" Ȥե뤬ޤ" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ̵ ID: %ld (1 ʾǤʤФʤޤ)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID ϤǤǤ: %ld" + +msgid "List or number required" +msgstr "ꥹȤͤɬפǤ" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ̵ ID: %ld (1 ʾǤʤФʤޤ)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID Ϥޤ: %ld" + +#, c-format +msgid "E370: Could not load library %s" +msgstr "E370: 饤֥ %s ɤǤޤǤ" + +msgid "Sorry, this command is disabled: the Perl library could not be loaded." +msgstr "" +"Υޥɤ̵Ǥʤ: Perl饤֥ɤǤޤǤ." + +msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" +msgstr "" +"E299: ɥܥåǤ Safe ⥸塼ѤʤPerlץȤ϶ؤ" +"Ƥޤ" + msgid "Edit with &multiple Vims" msgstr "ʣVimԽ (&M)" @@ -6205,7 +6378,6 @@ msgstr "Vim msgid "Edit with &Vim" msgstr "VimԽ (&V)" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "ưѤVimԽ - " @@ -6219,15 +6391,11 @@ msgid "gvimext.dll error" msgstr "gvimext.dll 顼" msgid "Path length too long!" -msgstr "ѥĹޤ!" +msgstr "ѥĹ᤮ޤ!" msgid "--No lines in buffer--" msgstr "--Хåե˹Ԥޤ--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: ޥɤǤޤ" @@ -6283,6 +6451,10 @@ msgstr "E236: msgid "E473: Internal error" msgstr "E473: 顼Ǥ" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: 顼Ǥ: %s" + msgid "Interrupted" msgstr "ޤޤ" @@ -6296,6 +6468,14 @@ msgstr "E474: ̵ msgid "E475: Invalid argument: %s" msgstr "E475: ̵ʰǤ: %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: %s Ф̵ͤǤ" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: %s Ф̵ͤǤ: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: ̵ʼǤ: %s" @@ -6314,6 +6494,9 @@ msgstr "E17: \"%s\" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: \"%s\"() Υ饤֥ƽФ˼Ԥޤ" +msgid "E667: Fsync failed" +msgstr "E667: fsync ˼Ԥޤ" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: 饤֥δؿ %s ɤǤޤǤ" @@ -6325,7 +6508,7 @@ msgid "E20: Mark not set" msgstr "E20: ޡꤵƤޤ" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: 'modifiable' դʤΤ, ѹǤޤ" +msgstr "E21: 'modifiable' դʤΤǡѹǤޤ" msgid "E22: Scripts nested too deep" msgstr "E22: ץȤҤ᤮ޤ" @@ -6391,7 +6574,7 @@ msgstr "E36: #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "E247: %s Ȥ̾Ͽ줿ФϤޤ" +msgstr "E247: %s Ȥ̾Ͽ줿СϤޤ" #, c-format msgid "E482: Can't create file %s" @@ -6408,9 +6591,6 @@ msgstr "E484: msgid "E485: Can't read file %s" msgstr "E485: ե %s ɹޤ" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Ǹѹ¸Ƥޤ (! ɲäѹ˴)" - msgid "E38: Null argument" msgstr "E38: Ǥ" @@ -6444,7 +6624,7 @@ msgid "E42: No Errors" msgstr "E42: 顼Ϥޤ" msgid "E776: No location list" -msgstr "E776: ꥹȤϤޤ" +msgstr "E776: ꥹȤϤޤ" msgid "E43: Damaged match string" msgstr "E43: ʸ»Ƥޤ" @@ -6463,6 +6643,31 @@ msgstr "E46: msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: ɥܥåǤѿ \"%s\" ͤǤޤ" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: 񷿤˶ΥȤȤϤǤޤ" + +msgid "E715: Dictionary required" +msgstr "E715: 񷿤ɬפǤ" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: ꥹȤΥǥåϰϳǤ: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: ؿΰ¿᤮ޤ: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: 񷿤˥¸ߤޤ: %s" + +msgid "E714: List required" +msgstr "E714: ꥹȷɬפǤ" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s ΰϥꥹȷޤϼ񷿤ǤʤФʤޤ" + msgid "E47: Error while reading errorfile" msgstr "E47: 顼եɹ˥顼ȯޤ" @@ -6520,8 +6725,8 @@ msgstr "E592: 'winwidth' msgid "E80: Error while writing" msgstr "E80: Υ顼" -msgid "Zero count" -msgstr "" +msgid "E939: Positive count required" +msgstr "E939: ΥȤɬפǤ" msgid "E81: Using <SID> not in a script context" msgstr "E81: ץȰʳ<SID>Ȥޤ" @@ -6530,21 +6735,21 @@ msgid "E449: Invalid expression received" msgstr "E449: ̵ʼޤ" msgid "E463: Region is guarded, cannot modify" -msgstr "E463: ΰ褬ݸƤΤ, ѹǤޤ" +msgstr "E463: ΰ褬ݸƤΤǡѹǤޤ" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans ɹѥեѹ뤳Ȥޤ" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: 顼Ǥ: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: ѥ 'maxmempattern' ʾΥѤޤ" msgid "E749: empty buffer" msgstr "E749: ХåեǤ" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Хåե %ld Ϥޤ" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: ѥ󤫶ڤ국椬Ǥ" @@ -6558,6 +6763,13 @@ msgstr "E764: msgid "E850: Invalid register name" msgstr "E850: ̵ʥ쥸̾Ǥ" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: ǥ쥯ȥ꤬ '%s' ˤޤ: \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: AutocommandƵޤ" + msgid "search hit TOP, continuing at BOTTOM" msgstr "ޤǸΤDzޤ" @@ -6608,7 +6820,7 @@ msgstr "C msgid "value is too small to fit into C int type" msgstr "C int ȤƤͤ᤮ޤ" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr "ͤ 0 礭ʤФʤޤ" msgid "number must be greater or equal to zero" @@ -6629,11 +6841,11 @@ msgstr " #, c-format msgid "expected 3-tuple as imp.find_module() result, but got %s" -msgstr "imp.find_module() %s ֤ޤ (: 2 ǤΥץ)" +msgstr "imp.find_module() %s ֤ޤ (: 3 ǤΥץ)" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" -msgstr "impl.find_module() %d ǤΥץ֤ޤ (: 2)" +msgstr "imp.find_module() %d ǤΥץ֤ޤ (: 3)" msgid "internal error: imp.find_module returned tuple with NULL" msgstr "顼: imp.find_module NULL ޤॿץ֤ޤ" @@ -6661,21 +6873,34 @@ msgstr " msgid "list index out of range" msgstr "ꥹϰϳΥǥåǤ" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr "顼: vimΥꥹ %d μ˼Ԥޤ" -msgid "failed to add item to list" -msgstr "ꥹȤؤɲä˼Ԥޤ" +msgid "slice step cannot be zero" +msgstr "饤Υƥåפ 0 ϻǤޤ" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "Ĺ %d γĥ饤ˡĹ饤Ƥ褦Ȥޤ" #, c-format msgid "internal error: no vim list item %d" msgstr "顼: vimΥꥹ %d Ϥޤ" +msgid "internal error: not enough list items" +msgstr "顼: ꥹȤ˽ʬǤޤ" + msgid "internal error: failed to add item to list" msgstr "顼: ꥹȤؤɲä˼Ԥޤ" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "Ĺ %d Υ饤 %d γĥ饤˳Ƥ褦Ȥޤ" + +msgid "failed to add item to list" +msgstr "ꥹȤؤɲä˼Ԥޤ" + msgid "cannot delete vim.List attributes" msgstr "vim.List °Ͼäޤ" @@ -6690,9 +6915,6 @@ msgstr "̵̾ msgid "function %s does not exist" msgstr "ؿ %s ޤ" -msgid "function constructor does not accept keyword arguments" -msgstr "ؿΥ󥹥ȥ饯ϥɰդޤ" - #, c-format msgid "failed to run function %s" msgstr "ؿ %s μ¹Ԥ˼Ԥޤ" @@ -6779,6 +7001,10 @@ msgstr "E859: msgid "unable to convert %s to vim dictionary" msgstr "%s vimμ񷿤ѴǤޤ" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s vimΥꥹȤѴǤޤ" + #, c-format msgid "unable to convert %s to vim structure" msgstr "%s vimι¤ΤѴǤޤ" @@ -6806,3 +7032,47 @@ msgid "" msgstr "" "ѥ˼Ԥޤ: sys.path ꥹȤǤϤޤ\n" " vim.VIM_SPECIAL_PATH sys.path ɲäƤ" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Vimޥե (*.vim)\t*.vim\n" +"٤ƤΥե (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "٤ƤΥե (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"٤ƤΥե (*.*)\t*.*\n" +"C (*.c, *.h)\t*.c;*.h\n" +"C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB (*.bas, *.frm)\t*.bas;*.frm\n" +"Vimե (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim ޥե (*.vim)\t*.vim\n" +"٤ƤΥե (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "٤ƤΥե (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"٤ƤΥե (*)\t*\n" +"C (*.c, *.h)\t*.c;*.h\n" +"C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vimե (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/ja.po b/src/po/ja.po index 854df3b44d..fa5aff5e4e 100644 --- a/src/po/ja.po +++ b/src/po/ja.po @@ -1,27 +1,28 @@ -# Japanese translation for Vim vim:set foldmethod=marker: +# Japanese translation for Vim # # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# Last Change: 2014 May 13 +# Copyright (C) 2001-2018 MURAOKA Taro <koron.kaoriya@gmail.com>, +# vim-jp (http://vim-jp.org/) # -# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. # # Original translations. # msgid "" msgstr "" -"Project-Id-Version: Vim 7.4\n" +"Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-06 13:50+0900\n" -"PO-Revision-Date: 2013-07-06 15:00+0900\n" +"POT-Creation-Date: 2018-05-01 10:46+0900\n" +"PO-Revision-Date: 2017-05-18 00:45+0900\n" "Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n" -"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n" +"Language-Team: vim-jp (https://github.com/vim-jp/lang-ja)\n" "Language: Japanese\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() が空パスワードで呼び出されました" @@ -39,7 +40,7 @@ msgid "E819: Blowfish test failed" msgstr "E819: Blowfish暗号のテストに失敗しました" msgid "[Location List]" -msgstr "[場所リスト]" +msgstr "[ロケーションリスト]" msgid "[Quickfix List]" msgstr "[Quickfixリスト]" @@ -48,10 +49,16 @@ msgid "E855: Autocommands caused command to abort" msgstr "E855: autocommandがコマンドの停止を引き起こしました" msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: バッファを1つも作成できないので, 終了します..." +msgstr "E82: バッファを1つも作成できないので、終了します..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: バッファを作成できないので, 他のを使用します..." +msgstr "E83: バッファを作成できないので、他のを使用します..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: バッファを登録できません" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: 使用中のバッファを削除しようと試みました" msgid "E515: No buffers were unloaded" msgstr "E515: 解放されたバッファはありません" @@ -83,17 +90,15 @@ msgstr "1 個のバッファが破棄されました" msgid "%d buffers wiped out" msgstr "%d 個のバッファが破棄されました" +msgid "E90: Cannot unload last buffer" +msgstr "E90: 最後のバッファは解放できません" + msgid "E84: No modified buffer found" msgstr "E84: 変更されたバッファはありません" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: リスト表示されるバッファはありません" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: バッファ %ld はありません" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: 最後のバッファを越えて移動はできません" @@ -104,8 +109,17 @@ msgstr "E88: 最初のバッファより前へは移動できません" msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: バッファ %ld の変更は保存されていません (! で変更を破棄)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: 最後のバッファは解放できません" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: ジョブはまだ実行中です (! を追加でジョブを終了)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: 最後の変更が保存されていません (! を追加で変更を破棄)" + +msgid "E948: Job still running" +msgstr "E948: ジョブはまだ実行中です" + +msgid "E37: No write since last change" +msgstr "E37: 最後の変更が保存されていません" msgid "W14: Warning: List of file names overflow" msgstr "W14: 警告: ファイル名のリストが長過ぎます" @@ -162,7 +176,6 @@ msgstr "行 %ld (全体 %ld) --%d%%-- col " msgid "[No Name]" msgstr "[無名]" -#. must be a help buffer msgid "help" msgstr "ヘルプ" @@ -188,6 +201,9 @@ msgstr "" "\n" "# バッファリスト:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: 'buftype' オプションが設定されているので書込めません" + msgid "[Scratch]" msgstr "[下書き]" @@ -206,15 +222,107 @@ msgstr "%s のサイン:" msgid " line=%ld id=%d name=%s" msgstr " 行=%ld 識別子=%d 名前=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: ポートに接続できません" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: channel_open() 内の gethostbyname() が失敗しました" + +msgid "E898: socket() in channel_open()" +msgstr "E898: channel_open() 内の socket() が失敗しました" + +msgid "E903: received command with non-string argument" +msgstr "E903: 非文字列の引数のコマンドを受信しました" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: expr/call の最後の引数は数字でなければなりません" + +msgid "E904: third argument for call must be a list" +msgstr "E904: call の3番目の引数はリスト型でなければなりません" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: 未知のコマンドを受信しました: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): 非接続状態で書き込みました" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): 書き込みに失敗しました" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s() にコールバックは使えません" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: raw や nl モードのチャンネルに ch_evalexpr()/ch_sendexpr() は使えません" + +msgid "E906: not an open channel" +msgstr "E906: 開いていないチャンネルです" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io ファイルは _name の設定が必要です" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io バッファは in_buf か in_name の設定が必要です" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: バッファがロードされてなければなりません: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: ファイルが未知の方法で暗号化されています" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "警告: 弱い暗号方法を使っています; :help 'cm' を参照してください" + +msgid "Enter encryption key: " +msgstr "暗号化用のキーを入力してください: " + +msgid "Enter same key again: " +msgstr "もう一度同じキーを入力してください: " + +msgid "Keys don't match!" +msgstr "キーが一致しません" + +msgid "[crypted]" +msgstr "[暗号化]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: 辞書型にコロンがありません: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: 辞書型に重複キーがあります: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: 辞書型にカンマがありません: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: 辞書型の最後に '}' がありません: %s" + +msgid "extend() argument" +msgstr "extend() の引数" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: キーは既に存在します: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: %ld 以上のバッファはdiffできません" msgid "E810: Cannot read or write temp files" msgstr "E810: 一時ファイルの読込もしくは書込ができません" msgid "E97: Cannot create diffs" -msgstr "E97: 差分を作成できません " +msgstr "E97: 差分を作成できません" msgid "Patch file" msgstr "パッチファイル" @@ -229,7 +337,7 @@ msgid "E99: Current buffer is not in diff mode" msgstr "E99: 現在のバッファは差分モードではありません" msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: 差分モードである他のバッファは変更可能です" +msgstr "E793: 差分モードである他のバッファは変更できません" msgid "E100: No other buffer in diff mode" msgstr "E100: 差分モードである他のバッファはありません" @@ -264,7 +372,6 @@ msgstr "E791: 空のキーマップエントリ" msgid " Keyword completion (^N^P)" msgstr " キーワード補完 (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X モード (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -272,7 +379,7 @@ msgid " Whole line completion (^L^N^P)" msgstr " 行(全体)補完 (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr "ファイル名補完 (^F^N^P)" +msgstr " ファイル名補完 (^F^N^P)" msgid " Tag completion (^]^N^P)" msgstr " タグ補完 (^]^N^P)" @@ -293,7 +400,7 @@ msgid " Command-line completion (^V^N^P)" msgstr " コマンドライン補完 (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " ユーザ定義補完 (^U^N^P)" +msgstr " ユーザー定義補完 (^U^N^P)" msgid " Omni completion (^O^N^P)" msgstr " オムニ補完 (^O^N^P)" @@ -336,13 +443,12 @@ msgstr "スキャン中: %s" msgid "Scanning tags." msgstr "タグをスキャン中." +msgid "match in file" +msgstr "ファイル内のマッチ" + msgid " Adding" msgstr " 追加中" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- 検索中..." @@ -366,10 +472,6 @@ msgstr "%d 番目の該当" msgid "E18: Unexpected characters in :let" msgstr "E18: 予期せぬ文字が :let にありました" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: リストのインデックスが範囲外です: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: 未定義の変数です: %s" @@ -377,41 +479,6 @@ msgstr "E121: 未定義の変数です: %s" msgid "E111: Missing ']'" msgstr "E111: ']' が見つかりません" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s の引数はリスト型でなければなりません" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s の引数はリスト型または辞書型でなければなりません" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: 辞書型に空のキーを使うことはできません" - -msgid "E714: List required" -msgstr "E714: リスト型が必要です" - -msgid "E715: Dictionary required" -msgstr "E715: 辞書型が必要です" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: 関数の引数が多過ぎます: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: 辞書型にキーが存在しません: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: 関数 %s は定義済です, 再定義するには ! を追加してください" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: 辞書型内にエントリが既に存在します" - -msgid "E718: Funcref required" -msgstr "E718: 関数参照型が要求されます" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: [:] を辞書型と組み合わせては使えません" @@ -419,10 +486,6 @@ msgstr "E719: [:] を辞書型と組み合わせては使えません" msgid "E734: Wrong variable type for %s=" msgstr "E734: 異なった型の変数です %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: 未知の関数です: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: 不正な変数名です: %s" @@ -462,38 +525,20 @@ msgstr "E711: リスト型変数に十分な数の要素がありません" msgid "E690: Missing \"in\" after :for" msgstr "E690: :for の後に \"in\" がありません" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: カッコ '(' がありません: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: その変数はありません: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: 変数 %s はロックまたはアンロックできません" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: (アン)ロックするには変数の入れ子が深過ぎます" msgid "E109: Missing ':' after '?'" msgstr "E109: '?' の後に ':' がありません" -msgid "E691: Can only compare List with List" -msgstr "E691: リスト型はリスト型としか比較できません" - -msgid "E692: Invalid operation for List" -msgstr "E692: リスト型には無効な操作です" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: 辞書型は辞書型としか比較できません" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: 辞書型には無効な操作です" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: 関数参照型は関数参照型としか比較できません" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: 関数参照型には無効な操作です" - msgid "E804: Cannot use '%' with Float" msgstr "E804: '%' を浮動小数点数と組み合わせては使えません" @@ -503,6 +548,9 @@ msgstr "E110: ')' が見つかりません" msgid "E695: Cannot index a Funcref" msgstr "E695: 関数参照型はインデックスできません" +msgid "E909: Cannot index a special variable" +msgstr "E909: 特殊変数はインデックスできません" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: オプション名がありません: %s" @@ -519,83 +567,118 @@ msgstr "E114: 引用符 (\") がありません: %s" msgid "E115: Missing quote: %s" msgstr "E115: 引用符 (') がありません: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: リスト型にカンマがありません: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"ガーベッジコレクションを中止しました! 参照を作成するのにメモリが不足しました" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: リスト型の最後に ']' がありません: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: 表示するには変数の入れ子が深過ぎます" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: 辞書型にコロンがありません: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: 浮動小数点数を数値として扱っています" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: 辞書型に重複キーがあります: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: 関数参照型を数値として扱っています" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: 辞書型にカンマがありません: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: リスト型を数値として扱っています" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: 辞書型の最後に '}' がありません: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: 辞書型を数値として扱っています" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: 表示するには変数の入れ子が深過ぎます" +msgid "E910: Using a Job as a Number" +msgstr "E910: ジョブを数値として扱っています" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: 関数の引数が多過ぎます: %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: チャンネルを数値として扱っています" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: 関数参照型を浮動小数点数として扱っています" + +msgid "E892: Using a String as a Float" +msgstr "E892: 文字列を浮動小数点数として扱っています" + +msgid "E893: Using a List as a Float" +msgstr "E893: リスト型を浮動小数点数として扱っています" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: 辞書型を浮動小数点数として扱っています" + +msgid "E907: Using a special value as a Float" +msgstr "E907: 特殊値を浮動小数点数として扱っています" + +msgid "E911: Using a Job as a Float" +msgstr "E911: ジョブを浮動小数点数として扱っています" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: チャンネルを浮動小数点数として扱っています" + +msgid "E729: using Funcref as a String" +msgstr "E729: 関数参照型を文字列として扱っています" + +msgid "E730: using List as a String" +msgstr "E730: リスト型を文字列として扱っています" + +msgid "E731: using Dictionary as a String" +msgstr "E731: 辞書型を文字列として扱っています" + +msgid "E908: using an invalid value as a String" +msgstr "E908: 無効な値を文字列として扱っています" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: 関数の無効な引数です: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: 変数 %s を削除できません" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: 未知の関数です: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: 関数参照型変数名は大文字で始まらなければなりません: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: 関数の引数が少な過ぎます: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: 変数名が既存の関数名と衝突します: %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: スクリプト以外で<SID>が使われました: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: 値がロックされています: %s" + +msgid "Unknown" +msgstr "不明" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: 辞書用関数が呼ばれましたが辞書がありません: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s の値を変更できません" -msgid "E808: Number or Float required" -msgstr "E808: 数値か浮動小数点数が必要です" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: コピーを取るには変数の入れ子が深過ぎます" -msgid "add() argument" -msgstr "add() の引数" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# グローバル変数:\n" -msgid "E699: Too many arguments" -msgstr "E699: 引数が多過ぎます" +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\t最後にセットしたスクリプト: " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() は挿入モードでしか利用できません" +msgid "E691: Can only compare List with List" +msgstr "E691: リスト型はリスト型としか比較できません" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E692: Invalid operation for List" +msgstr "E692: リスト型には無効な操作です" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: キーは既に存在します: %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: 辞書型は辞書型としか比較できません" -msgid "extend() argument" -msgstr "extend() の引数" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: 辞書型には無効な操作です" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: 関数参照型には無効な操作です" msgid "map() argument" msgstr "map() の引数" @@ -604,13 +687,39 @@ msgid "filter() argument" msgstr "filter() の引数" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld 行: " +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s の引数はリスト型でなければなりません" + +msgid "E928: String required" +msgstr "E928: 文字列が必要です" + +msgid "E808: Number or Float required" +msgstr "E808: 数値か浮動小数点数が必要です" + +msgid "add() argument" +msgstr "add() の引数" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() は挿入モードでしか利用できません" + +msgid "&Ok" +msgstr "&Ok" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld 行: " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: 未知の関数です: %s" +msgid "E922: expected a dict" +msgstr "E922: 辞書が期待されています" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function() の第 2 引数はリスト型または辞書型でなければなりません" + msgid "" "&OK\n" "&Cancel" @@ -627,196 +736,99 @@ msgstr "insert() の引数" msgid "E786: Range not allowed" msgstr "E786: 範囲指定は許可されていません" +msgid "E916: not a valid job" +msgstr "E916: 有効なジョブではありません" + msgid "E701: Invalid type for len()" msgstr "E701: len() には無効な型です" -msgid "E726: Stride is zero" -msgstr "E726: ストライド(前進量)が 0 です" - -msgid "E727: Start past end" -msgstr "E727: 開始位置が終了位置を越えました" - -msgid "<empty>" -msgstr "<空>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim サーバへの接続がありません" - #, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s へ送ることができません" - -msgid "E277: Unable to read a server reply" -msgstr "E277: サーバの応答がありません" - -msgid "remove() argument" -msgstr "remove() の引数" - -# Added at 10-Mar-2004. -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: シンボリックリンクが多過ぎます (循環している可能性があります)" - -msgid "reverse() argument" -msgstr "reverse() の引数" - -msgid "E258: Unable to send to client" -msgstr "E258: クライアントへ送ることができません" - -msgid "sort() argument" -msgstr "sort() の引数" - -msgid "E702: Sort compare function failed" -msgstr "E702: ソートの比較関数が失敗しました" - -msgid "(Invalid)" -msgstr "(無効)" - -msgid "E677: Error writing temp file" -msgstr "E677: 一時ファイル書込中にエラーが発生しました" - -msgid "E805: Using a Float as a Number" -msgstr "E805: 浮動小数点数を数値として扱っています" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: 関数参照型を数値として扱っています。" - -msgid "E745: Using a List as a Number" -msgstr "E745: リスト型を数値として扱っています" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID は \":match\" のために予約されています: %ld" -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: 辞書型を数値として扱っています" - -msgid "E729: using Funcref as a String" -msgstr "E729: 関数参照型を文字列として扱っています" - -msgid "E730: using List as a String" -msgstr "E730: リスト型を文字列として扱っています" - -msgid "E731: using Dictionary as a String" -msgstr "E731: 辞書型を文字列として扱っています" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: 変数の型が一致しません: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: 変数 %s を削除できません" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: 関数参照型変数名は大文字で始まらなければなりません: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: 変数名が既存の関数名と衝突します: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: 値がロックされています: %s" - -msgid "Unknown" -msgstr "不明" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s の値を変更できません" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: コピーを取るには変数の入れ子が深過ぎます" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: 未定義の関数です: %s" +msgid "E726: Stride is zero" +msgstr "E726: ストライド(前進量)が 0 です" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' がありません: %s" +msgid "E727: Start past end" +msgstr "E727: 開始位置が終了位置を越えました" -msgid "E862: Cannot use g: here" -msgstr "E862: ここでは g: は使えません" +msgid "<empty>" +msgstr "<空>" -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: 不正な引数です: %s" +msgid "E240: No connection to the X server" +msgstr "E240: X サーバーへの接続がありません" #, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: 引数名が重複しています: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s へ送ることができません" -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction がありません" +msgid "E277: Unable to read a server reply" +msgstr "E277: サーバーの応答がありません" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: 関数名が変数名と衝突します: %s" +msgid "E941: already started a server" +msgstr "E941: サーバーはすでに開始しています" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: 関数 %s を再定義できません: 使用中です" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver 機能が無効になっています" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: 関数名がスクリプトのファイル名と一致しません: %s" +msgid "remove() argument" +msgstr "remove() の引数" -msgid "E129: Function name required" -msgstr "E129: 関数名が要求されます" +# Added at 10-Mar-2004. +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: シンボリックリンクが多過ぎます (循環している可能性があります)" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: 関数名は大文字で始まるかコロンを含まなければなりません: %s" +msgid "reverse() argument" +msgstr "reverse() の引数" + +msgid "E258: Unable to send to client" +msgstr "E258: クライアントへ送ることができません" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: 関数 %s を削除できません: 使用中です" +msgid "E927: Invalid action: '%s'" +msgstr "E927: 無効な操作です: %s" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: 関数呼出の入れ子数が 'maxfuncdepth' を超えました" +msgid "sort() argument" +msgstr "sort() の引数" -#, c-format -msgid "calling %s" -msgstr "%s を実行中です" +msgid "uniq() argument" +msgstr "uniq() の引数" -#, c-format -msgid "%s aborted" -msgstr "%s が中断されました" +msgid "E702: Sort compare function failed" +msgstr "E702: ソートの比較関数が失敗しました" -#, c-format -msgid "%s returning #%ld" -msgstr "%s が #%ld を返しました" +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq の比較関数が失敗しました" -#, c-format -msgid "%s returning %s" -msgstr "%s が %s を返しました" +msgid "(Invalid)" +msgstr "(無効)" #, c-format -msgid "continuing in %s" -msgstr "%s の実行を継続中です" - -msgid "E133: :return not inside a function" -msgstr "E133: 関数外に :return がありました" +msgid "E935: invalid submatch number: %d" +msgstr "E935: 無効なサブマッチ番号: %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# グローバル変数:\n" +msgid "E677: Error writing temp file" +msgstr "E677: 一時ファイル書込中にエラーが発生しました" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLast set from " +msgid "E921: Invalid callback argument" +msgstr "E921: 無効なコールバック引数です" -msgid "No old files" -msgstr "古いファイルはありません" +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, 16進数 %02x, 8進数 %03o, ダイグラフ %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, 16進数 %02x, 8進数 %03o" +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, 16進数 %04x, 8進数 %o, ダイグラフ %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, 16進数 %08x, 8進数 %o, ダイグラフ %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, 16進数 %04x, 8進数 %o" @@ -850,11 +862,11 @@ msgid "%sviminfo: %s in line: " msgstr "%sviminfo: %s 行目: " msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: エラーが多過ぎるので, 以降はスキップします" +msgstr "E136: viminfo: エラーが多過ぎるので、以降はスキップします" #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" -msgstr "viminfoファイル \"%s\"%s%s%s を読込み中 " +msgstr "viminfoファイル \"%s\"%s%s%s を読込み中" msgid " info" msgstr " 情報" @@ -868,11 +880,14 @@ msgstr " 旧ファイル群" msgid " FAILED" msgstr " 失敗" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: viminfoファイルが書込みできません: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: 一時viminfoファイルが多過ぎます! 例: %s" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: viminfoファイル %s を保存できません!" @@ -881,7 +896,10 @@ msgstr "E138: viminfoファイル %s を保存できません!" msgid "Writing viminfo file \"%s\"" msgstr "viminfoファイル \"%s\" を書込み中" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfoファイルを %s へ名前変更できません!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# この viminfo ファイルは Vim %s によって生成されました.\n" @@ -899,6 +917,13 @@ msgstr "# このファイルが書かれた時の 'encoding' の値\n" msgid "Illegal starting char" msgstr "不正な先頭文字です" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# '|' で始まる行の、文字通りのコピー:\n" + msgid "Save As" msgstr "別名で保存" @@ -993,8 +1018,8 @@ msgstr " (計 1 行内)" msgid " on %ld lines" msgstr " (計 %ld 行内)" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global を再帰的には使えません" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global を範囲付きで再帰的には使えません" msgid "E148: Regular expression missing from global" msgstr "E148: globalコマンドに正規表現が指定されていません" @@ -1032,8 +1057,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "残念ですがヘルプファイル \"%s\" が見つかりません" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: ディレクトリではありません: %s" +msgid "E151: No match: %s" +msgstr "E151: マッチはありません: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1052,6 +1077,10 @@ msgstr "E670: 1つの言語のヘルプファイルに複数のエンコード msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: タグ \"%s\" がファイル %s/%s に重複しています" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: ディレクトリではありません: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: 未知のsignコマンドです: %s" @@ -1077,13 +1106,20 @@ msgstr "E159: signの番号がありません" msgid "E158: Invalid buffer name: %s" msgstr "E158: 無効なバッファ名です: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: 名前の無いバッファへはジャンプできません" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: 無効なsign識別子です: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: 変更できない sign です: %s" + # Added at 27-Jan-2004. msgid " (NOT FOUND)" -msgstr " (見つかりません)" +msgstr " (見つかりません)" msgid " (not supported)" msgstr " (非サポート)" @@ -1091,9 +1127,20 @@ msgstr " (非サポート)" msgid "[Deleted]" msgstr "[削除済]" +msgid "No old files" +msgstr "古いファイルはありません" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "デバッグモードに入ります. 続けるには \"cont\" と入力してください." +#, c-format +msgid "Oldval = \"%s\"" +msgstr "古い値 = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "新しい値 = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "行 %ld: %s" @@ -1102,6 +1149,13 @@ msgstr "行 %ld: %s" msgid "cmd: %s" msgstr "コマンド: %s" +msgid "frame is zero" +msgstr "フレームが 0 です" + +#, c-format +msgid "frame at highest level: %d" +msgstr "最高レベルのフレーム: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "ブレークポイント \"%s%s\" 行 %ld" @@ -1117,6 +1171,10 @@ msgstr "ブレークポイントが定義されていません" msgid "%3d %s %s line %ld" msgstr "%3d %s %s 行 %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: 初めに \":profile start {fname}\" を実行してください" @@ -1124,8 +1182,9 @@ msgstr "E750: 初めに \":profile start {fname}\" を実行してください" msgid "Save changes to \"%s\"?" msgstr "変更を \"%s\" に保存しますか?" -msgid "Untitled" -msgstr "無題" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: ジョブはバッファ \"%s\" でまだ実行中です" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1156,8 +1215,16 @@ msgid "Searching for \"%s\"" msgstr "\"%s\" を検索中" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "'runtimepath' の中には見つかりません: \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' の中にはありません: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: 要求されたpython 2.xは対応していません、ファイルを無視します: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: 要求されたpython 3.xは対応していません、ファイルを無視します: %s" msgid "Source Vim script" msgstr "Vimスクリプトの取込み" @@ -1186,6 +1253,10 @@ msgstr "行 %ld: %s を取込中" msgid "finished sourcing %s" msgstr "%s の取込を完了" +#, c-format +msgid "continuing in %s" +msgstr "%s の実行を継続中です" + msgid "modeline" msgstr "モード行" @@ -1219,7 +1290,8 @@ msgid "E197: Cannot set language to \"%s\"" msgstr "E197: 言語を \"%s\" に設定できません" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Exモードに入ります. ノーマルに戻るには\"visual\"と入力してください." +msgstr "" +"Exモードに入ります. ノーマルモードに戻るには\"visual\"と入力してください." msgid "E501: At end-of-file" msgstr "E501: ファイルの終了位置" @@ -1238,7 +1310,7 @@ msgid "End of function" msgstr "関数の最後です" msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: ユーザ定義コマンドのあいまいな使用です" +msgstr "E464: ユーザー定義コマンドのあいまいな使用です" msgid "E492: Not an editor command" msgstr "E492: エディタのコマンドではありません" @@ -1247,23 +1319,25 @@ msgid "E493: Backwards range given" msgstr "E493: 逆さまの範囲が指定されました" msgid "Backwards range given, OK to swap" -msgstr "逆さまの範囲が指定されました, 入替えますか?" +msgstr "逆さまの範囲が指定されました、入替えますか?" msgid "E494: Use w or w>>" msgstr "E494: w もしくは w>> を使用してください" -msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: このバージョンではこのコマンドは利用できません, ごめんなさい" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: コマンドテーブルを更新する必要があります、'make cmdidxs' を実行してくだ" +"さい" -msgid "E172: Only one file name allowed" -msgstr "E172: ファイル名は 1 つにしてください" +msgid "E319: Sorry, the command is not available in this version" +msgstr "E319: このバージョンではこのコマンドは利用できません、ごめんなさい" msgid "1 more file to edit. Quit anyway?" -msgstr "編集すべきファイルが 1 個ありますが, 終了しますか?" +msgstr "編集すべきファイルが 1 個ありますが、終了しますか?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "編集すべきファイルがあと %d 個ありますが, 終了しますか?" +msgstr "編集すべきファイルがあと %d 個ありますが、終了しますか?" msgid "E173: 1 more file to edit" msgstr "E173: 編集すべきファイルが 1 個あります" @@ -1277,13 +1351,13 @@ msgstr "E174: コマンドが既にあります: 再定義するには ! を追 msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" 名前 引数 範囲 補完 定義" +" 名前 引数 アドレス 補完 定義" msgid "No user-defined commands found" -msgstr "ユーザ定義コマンドが見つかりませんでした" +msgstr "ユーザー定義コマンドが見つかりませんでした" msgid "E175: No attribute specified" msgstr "E175: 属性は定義されていません" @@ -1298,7 +1372,10 @@ msgid "E178: Invalid default value for count" msgstr "E178: カウントの省略値が無効です" msgid "E179: argument required for -complete" -msgstr "E179: -補完のための引数が必要です" +msgstr "E179: -complete には引数が必要です" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr には引数が必要です" #, c-format msgid "E181: Invalid attribute: %s" @@ -1308,14 +1385,18 @@ msgid "E182: Invalid command name" msgstr "E182: 無効なコマンド名です" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: ユーザ定義コマンドは英大文字で始まらなければなりません" +msgstr "E183: ユーザー定義コマンドは英大文字で始まらなければなりません" msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: 予約名なので, ユーザ定義コマンドに利用できません" +msgstr "E841: 予約名なので、ユーザー定義コマンドに利用できません" #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: そのユーザ定義コマンドはありません: %s" +msgstr "E184: そのユーザー定義コマンドはありません: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: 無効なアドレスタイプ値です: %s" #, c-format msgid "E180: Invalid complete value: %s" @@ -1358,7 +1439,7 @@ msgstr "追加ファイル" msgid "E747: Cannot change directory, buffer is modified (add ! to override)" msgstr "" -"E747: バッファが修正されているので, ディレクトリを変更できません (! を追加で" +"E747: バッファが修正されているので、ディレクトリを変更できません (! を追加で" "上書)" msgid "E186: No previous directory" @@ -1381,6 +1462,9 @@ msgstr "" msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos には2つの数値の引数が必要です" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: execute() の中では :redir は使えません" + msgid "Save Redirection" msgstr "リダイレクトを保存します" @@ -1405,7 +1489,6 @@ msgstr "E189: \"%s\" が存在します (上書するには ! を追加してく msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: \"%s\" を書込み用として開けません" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: 引数は1文字の英字か引用符 (' か `) でなければいけません" @@ -1444,13 +1527,15 @@ msgstr "E500: 空文字列として評価されました" msgid "E195: Cannot open viminfo file for reading" msgstr "E195: viminfoファイルを読込用として開けません" +msgid "Untitled" +msgstr "無題" + msgid "E196: No digraphs in this version" msgstr "E196: このバージョンに合字はありません" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: 'Vim' で始まる例外は :throw できません" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "例外が発生しました: %s" @@ -1467,7 +1552,6 @@ msgstr "例外が破棄されました: %s" msgid "%s, line %ld" msgstr "%s, 行 %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "例外が捕捉されました: %s" @@ -1493,7 +1577,6 @@ msgstr "エラーと割込み" msgid "Error" msgstr "エラー" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "割込み" @@ -1536,15 +1619,12 @@ msgstr "E601: :try の入れ子が深過ぎます" msgid "E603: :catch without :try" msgstr "E603: :try のない :catch があります" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :finally の後に :catch があります" msgid "E606: :finally without :try" msgstr "E606: :try のない :finally があります" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: 複数の :finally があります" @@ -1589,6 +1669,9 @@ msgstr "式" msgid "Input Line" msgstr "入力行" +msgid "Debug Line" +msgstr "デバッグ行" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar がコマンド長を超えました" @@ -1602,13 +1685,13 @@ msgid "Illegal file name" msgstr "不正なファイル名" msgid "is a directory" -msgstr " はディレクトリです" +msgstr "はディレクトリです" msgid "is not a file" -msgstr " はファイルではありません" +msgstr "はファイルではありません" msgid "is a device (disabled with 'opendevice' option)" -msgstr " はデバイスです ('opendevice' オプションで回避できます)" +msgstr "はデバイスです ('opendevice' オプションで回避できます)" msgid "[New File]" msgstr "[新ファイル]" @@ -1620,7 +1703,7 @@ msgid "[File too big]" msgstr "[ファイル過大]" msgid "[Permission Denied]" -msgstr "[認可がありません]" +msgstr "[権限がありません]" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: *ReadPre autocommand がファイルを読込不可にしました" @@ -1634,7 +1717,6 @@ msgstr "Vim: 標準入力から読込中...\n" msgid "Reading from stdin..." msgstr "標準入力から読込み中..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: 変換がファイルを読込不可にしました" @@ -1662,12 +1744,6 @@ msgstr "[未変換]" msgid "[converted]" msgstr "[変換済]" -msgid "[blowfish]" -msgstr "[blowfish暗号化]" - -msgid "[crypted]" -msgstr "[暗号化]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[%ld 行目で変換エラー]" @@ -1688,9 +1764,6 @@ msgstr "'charconvert' による変換が失敗しました" msgid "can't read output of 'charconvert'" msgstr "'charconvert' の出力を読込めませんでした" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: ファイルが未知の方法で暗号化されています" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwriteバッファの該当するautocommandは存在しません" @@ -1732,9 +1805,6 @@ msgstr "E509: バックアップファイルを作れません (! を追加で msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: バックアップファイルを作れません (! を追加で強制作成)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: リソースフォークが失われるかもしれません (! を追加で強制)" - msgid "E214: Can't find temp file for writing" msgstr "E214: 保存用一時ファイルが見つかりません" @@ -1747,32 +1817,32 @@ msgstr "E166: リンクされたファイルに書込めません" msgid "E212: Can't open file for writing" msgstr "E212: 書込み用にファイルを開けません" -msgid "E667: Fsync failed" -msgstr "E667: fsync に失敗しました" +msgid "E949: File changed while writing" +msgstr "E949: 書込み中にファイルが変更されました" msgid "E512: Close failed" msgstr "E512: 閉じることに失敗" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: 書込みエラー, 変換失敗 (上書するには 'fenc' を空にしてください)" +msgstr "E513: 書込みエラー、変換失敗 (上書するには 'fenc' を空にしてください)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: 書込みエラー, 変換失敗, 行数 %ld (上書するには 'fenc' を空にしてくださ" +"E513: 書込みエラー、変換失敗、行数 %ld (上書するには 'fenc' を空にしてくださ" "い)" msgid "E514: write error (file system full?)" -msgstr "E514: 書込みエラー, (ファイルシステムが満杯?)" +msgstr "E514: 書込みエラー (ファイルシステムが満杯?)" msgid " CONVERSION ERROR" msgstr " 変換エラー" #, c-format msgid " in line %ld;" -msgstr "行 %ld;" +msgstr " 行 %ld;" msgid "[Device]" msgstr "[デバイス]" @@ -1843,20 +1913,12 @@ msgstr "1 文字" msgid "%lld characters" msgstr "%lld 文字" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld 文字" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[最終行が不完全]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "警告: 読込んだ後にファイルに変更がありました!!!" @@ -1934,11 +1996,16 @@ msgstr "--削除済--" msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "autocommand: %s <バッファ=%d> が自動的に削除されます" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: そのグループはありません: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: 現在のグループは削除できません" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: 使用中の augroup を消そうとしています" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: * の後に不正な文字がありました: %s" @@ -1951,7 +2018,6 @@ msgstr "E216: そのようなイベントはありません: %s" msgid "E216: No such group or event: %s" msgstr "E216: そのようなグループもしくはイベントはありません: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2000,8 +2066,9 @@ msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: 現在の 'foldmethod' では折畳みを削除できません" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld 行が折畳まれました " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld 行が折畳まれました" msgid "E222: Add to read buffer" msgstr "E222: 読込バッファへ追加" @@ -2048,7 +2115,7 @@ msgid "E230: Cannot read from \"%s\"" msgstr "E230: \"%s\"から読込むことができません" msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: 有効なフォントが見つからないので, GUIを開始できません" +msgstr "E665: 有効なフォントが見つからないので、GUIを開始できません" msgid "E231: 'guifontwide' invalid" msgstr "E231: 'guifontwide' が無効です" @@ -2061,7 +2128,7 @@ msgid "E254: Cannot allocate color %s" msgstr "E254: %s の色を割り当てられません" msgid "No match at cursor, finding next" -msgstr "カーソルの位置にマッチはありません, 次を検索しています" +msgstr "カーソルの位置にマッチはありません、次を検索しています" msgid "<cannot open> " msgstr "<開けません> " @@ -2094,6 +2161,18 @@ msgstr "Vim ダイアログ" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: メッセージとコールバックのある BalloonEval を作成できません" +msgid "_Cancel" +msgstr "キャンセル(_C)" + +msgid "_Save" +msgstr "保存(_S)" + +msgid "_Open" +msgstr "開く(_O)" + +msgid "_OK" +msgstr "_OK" + msgid "" "&Yes\n" "&No\n" @@ -2103,6 +2182,12 @@ msgstr "" "いいえ(&N)\n" "キャンセル(&C)" +msgid "Yes" +msgstr "はい" + +msgid "No" +msgstr "いいえ" + msgid "Input _Methods" msgstr "インプットメソッド" @@ -2118,41 +2203,38 @@ msgstr "検索文字列:" msgid "Replace with:" msgstr "置換文字列:" -#. whole word only button msgid "Match whole word only" msgstr "正確に該当するものだけ" -#. match case button msgid "Match case" msgstr "大文字/小文字を区別する" msgid "Direction" msgstr "方向" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "上" msgid "Down" msgstr "下" -#. 'Find Next' button msgid "Find Next" msgstr "次を検索" -#. 'Replace' button msgid "Replace" msgstr "置換" -#. 'Replace All' button msgid "Replace All" msgstr "全て置換" +msgid "_Close" +msgstr "閉じる(_C)" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: セッションマネージャから \"die\" 要求を受け取りました\n" -msgid "Close" -msgstr "閉じる" +msgid "Close tab" +msgstr "タブページを閉じる" msgid "New tab" msgstr "新規タブページ" @@ -2199,20 +2281,6 @@ msgstr "全て置換(&A)" msgid "&Undo" msgstr "アンドゥ(&U)" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: タイトルが \"%s\" のウィンドウは見つかりません" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: 引数はサポートされません: \"-%s\"; OLE版を使用してください." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDIアプリの中ではウィンドウを開けません" - -msgid "Close tab" -msgstr "タブページを閉じる" - msgid "Open tab..." msgstr "タブページを開く" @@ -2222,14 +2290,23 @@ msgstr "検索文字列 ('\\' を検索するには '\\\\')" msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "検索・置換 ('\\' を検索するには '\\\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "使われません" msgid "Directory\t*.nothing\n" msgstr "ディレクトリ\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: タイトルが \"%s\" のウィンドウは見つかりません" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: 引数はサポートされません: \"-%s\"; OLE版を使用してください." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDIアプリの中ではウィンドウを開けません" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "Vim E458: 色指定が正しくないのでエントリを割り当てられません" @@ -2284,7 +2361,6 @@ msgstr "Vim - フォント選択" msgid "Name:" msgstr "名前:" -#. create toggle button msgid "Show size in Points" msgstr "サイズをポイントで表示する" @@ -2491,6 +2567,7 @@ msgstr "%-5s: %s%*s (使用法: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2501,6 +2578,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: このシンボルに対する代入を探す\n" " c: この関数を呼んでいる関数を探す\n" " d: この関数から呼んでいる関数を探す\n" " e: このegrepパターンを探す\n" @@ -2528,7 +2606,6 @@ msgstr "E261: cscope接続 %s が見つかりませんでした" msgid "cscope connection %s closed" msgstr "cscope接続 %s が閉じられました" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: cs_manage_matches で致命的なエラーです" @@ -2570,6 +2647,13 @@ msgid "" "loaded." msgstr "E815: このコマンドは無効です. MzScheme ライブラリをロードできません." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: このコマンドは無効です、ごめんなさい. MzScheme の racket/base モジュー" +"ルがロードできませんでした." + msgid "invalid expression" msgstr "無効な式です" @@ -2621,19 +2705,6 @@ msgstr "範囲外の行番号です" msgid "not allowed in the Vim sandbox" msgstr "サンドボックスでは許されません" -#, c-format -msgid "E370: Could not load library %s" -msgstr "E370: ライブラリ %s をロードできませんでした" - -msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "" -"このコマンドは無効です, ごめんなさい: Perlライブラリをロードできませんでした." - -msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -msgstr "" -"E299: サンドボックスでは Safe モジュールを使用しないPerlスクリプトは禁じられ" -"ています" - msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: このVimでは :py3 を使った後に :python を使えません" @@ -2641,8 +2712,15 @@ msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." msgstr "" -"E263: このコマンドは無効です,ごめんなさい: Pythonライブラリをロードできません" -"でした." +"E263: このコマンドは無効です、ごめんなさい: Pythonライブラリをロードできませ" +"んでした." + +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: このコマンドは無効です、ごめんなさい. Python の site モジュールをロード" +"できませんでした." # Added at 07-Feb-2004. msgid "E659: Cannot invoke Python recursively" @@ -2655,121 +2733,32 @@ msgid "E265: $_ must be an instance of String" msgstr "E265: $_ は文字列のインスタンスでなければなりません" msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: このコマンドは無効です,ごめんなさい: Rubyライブラリをロードできませんで" -"した." - -msgid "E267: unexpected return" -msgstr "E267: 予期せぬ return です" - -msgid "E268: unexpected next" -msgstr "E268: 予期せぬ next です" - -msgid "E269: unexpected break" -msgstr "E269: 予期せぬ break です" - -msgid "E270: unexpected redo" -msgstr "E270: 予期せぬ redo です" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: rescue の外の retry です" - -msgid "E272: unhandled exception" -msgstr "E272: 取り扱われなかった例外があります" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: 未知のlongjmp状態: %d" - -msgid "Toggle implementation/definition" -msgstr "実装と定義を切り替える" - -msgid "Show base class of" -msgstr "次のクラスの基底を表示" - -msgid "Show overridden member function" -msgstr "オーバーライドされたメンバ関数を表示" - -msgid "Retrieve from file" -msgstr "ファイルから回復する" - -msgid "Retrieve from project" -msgstr "プロジェクトから回復する" - -msgid "Retrieve from all projects" -msgstr "全てのプロジェクトから回復する" - -msgid "Retrieve" -msgstr "回復" - -msgid "Show source of" -msgstr "次のソースを表示する" - -msgid "Find symbol" -msgstr "見つけたシンボル" - -msgid "Browse class" -msgstr "クラスを参照" - -msgid "Show class in hierarchy" -msgstr "階層でクラスを表示" - -msgid "Show class in restricted hierarchy" -msgstr "限定された階層でクラスを表示" - -msgid "Xref refers to" -msgstr "Xref の参照先" - -msgid "Xref referred by" -msgstr "Xref が参照される" - -msgid "Xref has a" -msgstr "Xref が次のものをもっています" - -msgid "Xref used by" -msgstr "Xref が使用される" - -msgid "Show docu of" -msgstr "次の文章を表示" - -msgid "Generate docu for" -msgstr "次の文章を生成" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"SNiFF+に接続できません. 環境をチェックしてください(sniffemacs が $PATH になけ" -"ればなりません).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: 読込中にエラーが発生しました. 切断しました" - -msgid "SNiFF+ is currently " -msgstr "現在SNiFF+ の状態は「" +"E266: このコマンドは無効です、ごめんなさい: Rubyライブラリをロードできません" +"でした." -msgid "not " -msgstr "未" +msgid "E267: unexpected return" +msgstr "E267: 予期せぬ return です" -msgid "connected" -msgstr "接続」です" +msgid "E268: unexpected next" +msgstr "E268: 予期せぬ next です" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: 未知の SNiFF+ リクエストです: %s" +msgid "E269: unexpected break" +msgstr "E269: 予期せぬ break です" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+ への接続中のエラーです" +msgid "E270: unexpected redo" +msgstr "E270: 予期せぬ redo です" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ に接続されていません" +msgid "E271: retry outside of rescue clause" +msgstr "E271: rescue の外の retry です" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SNiFF+ バッファがありません" +msgid "E272: unhandled exception" +msgstr "E272: 取り扱われなかった例外があります" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: 書込み中にエラーが発生したので切断しました" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: 未知のlongjmp状態: %d" msgid "invalid buffer number" msgstr "無効なバッファ番号です" @@ -2777,7 +2766,6 @@ msgstr "無効なバッファ番号です" msgid "not implemented yet" msgstr "まだ実装されていません" -#. ??? msgid "cannot set line(s)" msgstr "行を設定できません" @@ -2819,7 +2807,6 @@ msgid "" msgstr "" "コールバックコマンドを登録できません: バッファ/ウィンドウが既に消去されました" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2834,7 +2821,7 @@ msgstr "" msgid "" "E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E571: このコマンドは無効です,ごめんなさい: Tclライブラリをロードできませんで" +"E571: このコマンドは無効です、ごめんなさい: Tclライブラリをロードできませんで" "した." #, c-format @@ -2845,18 +2832,30 @@ msgid "cannot get line" msgstr "行を取得できません" msgid "Unable to register a command server name" -msgstr "命令サーバの名前を登録できません" +msgstr "命令サーバーの名前を登録できません" msgid "E248: Failed to send command to the destination program" msgstr "E248: 目的のプログラムへのコマンド送信に失敗しました" #, c-format msgid "E573: Invalid server id used: %s" -msgstr "E573: 無効なサーバIDが使われました: %s" +msgstr "E573: 無効なサーバーIDが使われました: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM 実体の登録プロパティが不正です. 消去しました!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSONに重複キーがあります: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: リスト型にカンマがありません: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: リスト型の最後に ']' がありません: %s" + msgid "Unknown option argument" msgstr "未知のオプション引数です" @@ -2882,14 +2881,14 @@ msgstr "%d 個のファイルが編集を控えています\n" msgid "netbeans is not supported with this GUI\n" msgstr "netbeans はこのGUIでは利用できません\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "このVimにはdiff機能がありません(コンパイル時設定)." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' 使用不可能です: コンパイル時に無効にされています\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "このVimにはdiff機能がありません(コンパイル時設定)." + msgid "Attempt to open script file again: \"" -msgstr "スクリプトファイルを再び開いてみます: \"" +msgstr "スクリプトファイルを再び開こうとしました: \"" msgid "Cannot open for reading: \"" msgstr "読込用として開けません" @@ -2900,13 +2899,15 @@ msgstr "スクリプト出力用を開けません" msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: エラー: NetBeansからgvimをスタートできません\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: エラー: このバージョンのVimはCygwin端末では動作しません\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: 警告: 端末への出力ではありません\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: 警告: 端末からの入力ではありません\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "vimrc前のコマンドライン" @@ -3002,7 +3003,7 @@ msgid "-d\t\t\tDiff mode (like \"vimdiff\")" msgstr "-d\t\t\t差分モード (\"vidiff\" と同じ)" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tイージーモード (\"evim\" と同じ, モード無)" +msgstr "-y\t\t\tイージーモード (\"evim\" と同じ、モード無)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\t読込専用モード (\"view\" と同じ)" @@ -3064,6 +3065,12 @@ msgstr "-F\t\t\tペルシア語モードで起動する" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\t端末を <terminal> に設定する" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\t入出力が端末でないとの警告をスキップする" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\t入出力が端末でなければ終了する" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t.vimrcの代わりに <vimrc> を使う" @@ -3110,16 +3117,16 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\t暗号化されたファイルを編集する" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <display>\tvimを指定した X サーバに接続する" +msgstr "-display <display>\tvimを指定した X サーバーに接続する" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tXサーバに接続しない" +msgstr "-X\t\t\tXサーバーに接続しない" msgid "--remote <files>\tEdit <files> in a Vim server if possible" -msgstr "--remote <files>\t可能ならばVimサーバで <files> を編集する" +msgstr "--remote <files>\t可能ならばVimサーバーで <files> を編集する" msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <files> 同上, サーバが無くても警告文を出力しない" +msgstr "--remote-silent <files> 同上、サーバーが無くても警告文を出力しない" msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" @@ -3127,7 +3134,8 @@ msgstr "--remote-wait <files>\t--remote後 ファイルの編集が終わるの msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" -msgstr "--remote-wait-silent <files> 同上, サーバが無くても警告文を出力しない" +msgstr "" +"--remote-wait-silent <files> 同上、サーバーが無くても警告文を出力しない" msgid "" "--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" @@ -3136,16 +3144,16 @@ msgstr "" "ページを開く" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" -msgstr "--remote-send <keys>\tVimサーバに <keys> を送信して終了する" +msgstr "--remote-send <keys>\tVimサーバーに <keys> を送信して終了する" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <expr>\tサーバで <expr> を実行して結果を表示する" +msgstr "--remote-expr <expr>\tサーバーで <expr> を実行して結果を表示する" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tVimサーバ名の一覧を表示して終了する" +msgstr "--serverlist\t\tVimサーバー名の一覧を表示して終了する" msgid "--servername <name>\tSend to/become the Vim server <name>" -msgstr "--servername <name>\tVimサーバ <name> に送信/名前設定する" +msgstr "--servername <name>\tVimサーバー <name> に送信/名前設定する" msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "--startuptime <file>\t起動にかかった時間の詳細を <file> へ出力する" @@ -3153,8 +3161,11 @@ msgstr "--startuptime <file>\t起動にかかった時間の詳細を <file> へ msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\t.viminfoの代わりに <viminfo> を使う" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible'、Vimの既定、プラグインなし、viminfoなし" + msgid "-h or --help\tPrint Help (this message) and exit" -msgstr "-h or --help\tヘルプ(このメッセージ)を表示し終了する" +msgstr "-h or --help\tヘルプ(このメッセージ)を表示し終了する" msgid "--version\t\tPrint version information and exit" msgstr "--version\t\tバージョン情報を表示し終了する" @@ -3251,11 +3262,9 @@ msgstr "--windowid <HWND>\t異なるWin32 widgetの内部にVimを開く" msgid "No display" msgstr "ディスプレイが見つかりません" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": 送信に失敗しました.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": 送信に失敗しました. ローカルでの実行を試みています\n" @@ -3276,7 +3285,6 @@ msgstr "マークが設定されていません" msgid "E283: No marks matching \"%s\"" msgstr "E283: \"%s\" に該当するマークがありません" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3284,7 +3292,6 @@ msgstr "" "\n" "mark 行 列 ファイル/テキスト" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3292,7 +3299,6 @@ msgstr "" "\n" " jump 行 列 ファイル/テキスト" -#. Highlight title msgid "" "\n" "change line col text" @@ -3307,7 +3313,6 @@ msgstr "" "\n" "# ファイルマーク:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3376,9 +3381,8 @@ msgstr "E298: ブロック 2 を取得できません?" msgid "E843: Error while updating swap file crypt" msgstr "E843: スワップファイルの暗号を更新中にエラーが発生しました" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: おっと, スワップファイルが失われました!!!" +msgstr "E301: おっと、スワップファイルが失われました!!!" msgid "E302: Could not rename swap file" msgstr "E302: スワップファイルの名前を変えられません" @@ -3463,7 +3467,7 @@ msgid "" "If you entered a new crypt key but did not write the text file," msgstr "" "\n" -"新しい暗号キーを入力したあとにテキストファイルを保存していない場合は," +"新しい暗号キーを入力したあとにテキストファイルを保存していない場合は、" msgid "" "\n" @@ -3477,7 +3481,7 @@ msgid "" "If you wrote the text file after changing the crypt key press enter" msgstr "" "\n" -"暗号キーを変えたあとにテキストファイルを保存した場合は, テキストファイルと" +"暗号キーを変えたあとにテキストファイルを保存した場合は、テキストファイルと" msgid "" "\n" @@ -3537,7 +3541,7 @@ msgid "" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(変更をチェックするために, このファイルを別の名前で保存した上で\n" +"(変更をチェックするために、このファイルを別の名前で保存した上で\n" msgid "and run diff with the original file to check for changes)" msgstr "原本ファイルとの diff を実行すると良いでしょう)" @@ -3551,13 +3555,12 @@ msgid "" "\n" msgstr "" "\n" -"それから.swpファイルを削除してください\n" +"元の.swpファイルは削除しても構いません\n" "\n" msgid "Using crypt key from swap file for the text file.\n" msgstr "スワップファイルから取得した暗号キーをテキストファイルに使います.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "スワップファイルが複数見つかりました:" @@ -3565,7 +3568,7 @@ msgid " In current directory:\n" msgstr " 現在のディレクトリ:\n" msgid " Using specified name:\n" -msgstr " ある名前を使用中:\n" +msgstr " 以下の名前を使用中:\n" msgid " In directory " msgstr " ディレクトリ " @@ -3609,7 +3612,7 @@ msgid "" " user name: " msgstr "" "\n" -" ユーザ名: " +" ユーザー名: " msgid " host name: " msgstr " ホスト名: " @@ -3727,21 +3730,17 @@ msgstr "次のファイルを開いている最中 \"" msgid " NEWER than swap file!\n" msgstr " スワップファイルよりも新しいです!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) 別のプログラムが同じファイルを編集しているかもしれません.\n" -" この場合には, 変更をした際に最終的に, 同じファイルの異なる\n" -" 2つのインスタンスができてしまうことに注意してください." - -msgid " Quit, or continue with caution.\n" -msgstr " 終了するか, 注意しながら続けてください.\n" +" この場合には、変更をしてしまうと1つのファイルに対して異なる2つの\n" +" インスタンスができてしまうので、そうしないように気をつけてください.\n" +" 終了するか、注意しながら続けてください.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) このファイルの編集セッションがクラッシュした.\n" @@ -3757,7 +3756,7 @@ msgstr "" " を使用して変更をリカバーします(\":help recovery\" を参照).\n" msgid " If you did this already, delete the swap file \"" -msgstr " 既にこれを行なったのならば, スワップファイル \"" +msgstr " 既にこれを行なったのならば、スワップファイル \"" msgid "" "\"\n" @@ -3819,7 +3818,6 @@ msgstr "E328: メニューは他のモードにだけあります" msgid "E329: No menu \"%s\"" msgstr "E329: \"%s\" というメニューはありません" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: メニュー名が空です" @@ -3832,8 +3830,6 @@ msgstr "E331: メニューバーには直接メニューアイテムを追加で msgid "E332: Separator cannot be part of a menu path" msgstr "E332: 区切りはメニューパスの一部ではありません" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3844,6 +3840,10 @@ msgstr "" msgid "Tear off this menu" msgstr "このメニューを切り取る" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: %s にはメニューが定義されていません" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: メニューパスはメニューアイテムを生じなければいけません" @@ -3851,10 +3851,6 @@ msgstr "E333: メニューパスはメニューアイテムを生じなければ msgid "E334: Menu not found: %s" msgstr "E334: メニューが見つかりません: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: %s にはメニューが定義されていません" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: メニューパスはサブメニューを生じなければいけません" @@ -3924,15 +3920,14 @@ msgstr "ファイル保存ダイアログ" msgid "Open File dialog" msgstr "ファイル読込ダイアログ" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: コンソールモードではファイルブラウザを使えません, ごめんなさい" +msgstr "E338: コンソールモードではファイルブラウザを使えません、ごめんなさい" msgid "E766: Insufficient arguments for printf()" msgstr "E766: printf() の引数が不十分です" msgid "E807: Expected Float argument for printf()" -msgstr "E807: printf() の引数には浮動少数点数が期待されています" +msgstr "E807: printf() の引数には浮動小数点数が期待されています" msgid "E767: Too many arguments to printf()" msgstr "E767: printf() の引数が多過ぎます" @@ -3967,13 +3962,6 @@ msgstr " (割込まれました)" msgid "Beep!" msgstr "ビーッ!" -msgid "Vim: preserving files...\n" -msgstr "Vim: ファイルを保存中...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: 終了しました.\n" - msgid "ERROR: " msgstr "エラー: " @@ -4023,15 +4011,6 @@ msgstr "E548: 数値が必要です" msgid "E549: Illegal percentage" msgstr "E549: 不正なパーセンテージです" -msgid "Enter encryption key: " -msgstr "暗号化用のキーを入力してください: " - -msgid "Enter same key again: " -msgstr "もう一度同じキーを入力してください: " - -msgid "Keys don't match!" -msgstr "キーが一致しません" - msgid "E854: path too long for completion" msgstr "E854: パスが長過ぎて補完できません" @@ -4059,20 +4038,11 @@ msgstr "E346: cdpathにはこれ以上 \"%s\" というファイルがありま msgid "E347: No more file \"%s\" found in path" msgstr "E347: パスにはこれ以上 \"%s\" というファイルがありません" -msgid "Cannot connect to Netbeans #2" -msgstr "Netbeans #2 に接続できません" - -msgid "Cannot connect to Netbeans" -msgstr "Netbeans に接続できません" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: NetBeansの接続情報ファイルのアクセスモードに問題があります: \"%s\"" -msgid "read from Netbeans socket" -msgstr "Netbeans のソケットを読込み" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: バッファ %ld の NetBeans 接続が失われました" @@ -4114,8 +4084,10 @@ msgstr "E662: 変更リストの先頭" msgid "E663: At end of changelist" msgstr "E663: 変更リストの末尾" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Vimを終了するには :quit<Enter> と入力してください" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"すべての変更を破棄し、Vimを終了するには :qa! と入力し <Enter> を押してくだ" +"さい" #, c-format msgid "1 line %sed 1 time" @@ -4147,7 +4119,6 @@ msgstr "%ld 行をインデントしました " msgid "E748: No previously used register" msgstr "E748: まだレジスタを使用していません" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "ヤンクできません; とにかく消去" @@ -4162,25 +4133,30 @@ msgstr "%ld 行が変更されました" msgid "freeing %ld lines" msgstr "%ld 行を解放中" -msgid "block of 1 line yanked" -msgstr "1 行のブロックがヤンクされました" +#, c-format +msgid " into \"%c" +msgstr " \"%c に" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "1 行のブロックが%sヤンクされました" -msgid "1 line yanked" -msgstr "1 行がヤンクされました" +#, c-format +msgid "1 line yanked%s" +msgstr "1 行が%sヤンクされました" #, c-format -msgid "block of %ld lines yanked" -msgstr "%ld 行のブロックがヤンクされました" +msgid "block of %ld lines yanked%s" +msgstr "%ld 行のブロックが%sヤンクされました" #, c-format -msgid "%ld lines yanked" -msgstr "%ld 行がヤンクされました" +msgid "%ld lines yanked%s" +msgstr "%ld 行が%sヤンクされました" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: レジスタ %s には何もありません" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4202,37 +4178,41 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: 未知のレジスタ型 %d です" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "E883: 検索パターンと式レジスタには2行以上を含められません" + #, c-format msgid "%ld Cols; " msgstr "%ld 列; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "選択 %s%ld / %ld 行; %ld / %ld 単語; %ld / %ld バイト" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "選択 %s%ld / %ld 行; %lld / %lld 単語; %lld / %lld バイト" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr "選択 %s%ld / %ld 行; %ld / %ld 単語; %ld / %ld 文字; %ld / %ld バイト" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"選択 %s%ld / %ld 行; %lld / %lld 単語; %lld / %lld 文字; %lld / %lld バイト" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "列 %s / %s; 行 %ld of %ld; 単語 %ld / %ld; バイト %ld / %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "列 %s / %s; 行 %ld of %ld; 単語 %lld / %lld; バイト %lld / %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"列 %s / %s; 行 %ld / %ld; 単語 %ld / %ld; 文字 %ld / %ld; バイト %ld of %ld" +"列 %s / %s; 行 %ld / %ld; 単語 %lld / %lld; 文字 %lld / %lld; バイト %lld of " +"%lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld for BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=%N ページ" +msgid "(+%lld for BOM)" +msgstr "(+%lld for BOM)" msgid "Thanks for flying Vim" msgstr "Vim を使ってくれてありがとう" @@ -4259,6 +4239,10 @@ msgstr "E522: termcap 内に見つかりません" msgid "E539: Illegal character <%s>" msgstr "E539: 不正な文字です <%s>" +#, c-format +msgid "For option %s" +msgstr "オプション: %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' には空文字列を設定できません" @@ -4280,6 +4264,10 @@ msgstr "E835: 'fillchars'の値に矛盾があります" msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: GTK+2 GUIでは変更できません" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: %s と %s の間で変換できません" + msgid "E524: Missing colon" msgstr "E524: コロンがありません" @@ -4337,12 +4325,18 @@ msgstr "E541: 要素が多過ぎます" msgid "E542: unbalanced groups" msgstr "E542: グループが釣合いません" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: 実行中のジョブがある端末は変更可能にできません" + msgid "E590: A preview window already exists" msgstr "E590: プレビューウィンドウが既に存在します" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "" -"W17: アラビア文字にはUTF-8が必要なので, ':set encoding=utf-8' してください" +"W17: アラビア文字にはUTF-8が必要なので、':set encoding=utf-8' してください" + +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24bit色はこの環境ではサポートされていません" #, c-format msgid "E593: Need at least %d lines" @@ -4356,9 +4350,6 @@ msgstr "E594: 最低 %d のカラム幅が必要です" msgid "E355: Unknown option: %s" msgstr "E355: 未知のオプションです: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: 数字が必要です: &%s = '%s'" @@ -4431,7 +4422,6 @@ msgstr "コンソールモードを変更できません?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: コンソールではない??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: -f オプションでシェルを実行できません" @@ -4453,9 +4443,6 @@ msgstr "入出力エラー" msgid "Message" msgstr "メッセージ" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' が80ではないため, 外部コマンドを実行できません" - msgid "E237: Printer selection failed" msgstr "E237: プリンタの選択に失敗しました" @@ -4480,23 +4467,16 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: 文字セット名 \"%s\" は不正です (フォント名 \"%s\")" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: '%c' は不正な文字です (フォント名 \"%s\")" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: 2重のシグナルのため, 終了します\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: 致命的シグナル %s を検知しました\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: 品質名 \"%s\" は不正です (フォント名 \"%s\")" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: 致命的シグナルを検知しました\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: '%c' は不正な文字です (フォント名 \"%s\")" #, c-format msgid "Opening the X display took %ld msec" -msgstr "Xサーバへの接続に %ld ミリ秒かかりました" +msgstr "Xサーバーへの接続に %ld ミリ秒かかりました" msgid "" "\n" @@ -4525,12 +4505,13 @@ msgstr "" "\n" "セキュリティコンテキストを設定できません " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"シェルを実行できません " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "セキュリティコンテキスト %s を %s に設定できません" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "セキュリティコンテキスト %s を %s から取得できません. 削除します!" msgid "" "\n" @@ -4560,6 +4541,13 @@ msgstr "" "\n" "fork できません\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"シェルを実行できません " + msgid "" "\n" "Command terminated\n" @@ -4602,10 +4590,6 @@ msgstr "VIMエラー" msgid "Could not fix up function pointers to the DLL!" msgstr "DLLから関数ポインタを取得できませんでした" -#, c-format -msgid "shell returned %d" -msgstr "シェルがコード %d で終了しました" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: イベント %s を検知\n" @@ -4634,6 +4618,13 @@ msgstr "" msgid "Vim Warning" msgstr "Vimの警告" +#, c-format +msgid "shell returned %d" +msgstr "シェルがコード %d で終了しました" + +msgid "E926: Current location list was changed" +msgstr "E926: 現在のロケーションリストが変更されました" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: フォーマット文字列に %%%c が多過ぎます" @@ -4666,6 +4657,12 @@ msgstr "E379: ディレクトリ名が無いか空です" msgid "E553: No more items" msgstr "E553: 要素がもうありません" +msgid "E924: Current window was closed" +msgstr "E924: 現在のウィンドウが閉じられました" + +msgid "E925: Current quickfix was changed" +msgstr "E925: 現在の quickfix が変更されました" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d of %d)%s%s: " @@ -4673,18 +4670,18 @@ msgstr "(%d of %d)%s%s: " msgid " (line deleted)" msgstr " (行が削除されました)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s エラー一覧 %d of %d; %d 個エラー" + msgid "E380: At bottom of quickfix stack" msgstr "E380: quickfix スタックの末尾です" msgid "E381: At top of quickfix stack" msgstr "E381: quickfix スタックの先頭です" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "エラー一覧 %d of %d; %d 個エラー" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: 'buftype' オプションが設定されているので書込みません" +msgid "No entries" +msgstr "エントリがありません" msgid "Error file" msgstr "エラーファイル" @@ -4711,6 +4708,12 @@ msgstr "E369: 無効な項目です: %s%%[]" msgid "E769: Missing ] after %s[" msgstr "E769: %s[ の後に ] がありません" +msgid "E944: Reverse range in character class" +msgstr "E944: 文字クラスの範囲が逆です" + +msgid "E945: Range too large in character class" +msgstr "E945: 文字クラスの範囲が大きすぎます" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: %s%%( が釣り合っていません" @@ -4740,6 +4743,10 @@ msgstr "E69: %s%%[ の後に ] がありません" msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] が空です" +# +msgid "E65: Illegal back reference" +msgstr "E65: 不正な後方参照です" + msgid "E339: Pattern too long" msgstr "E339: パターンが長過ぎます" @@ -4777,10 +4784,6 @@ msgstr "E63: \\_ の無効な使用方法です" msgid "E64: %s%c follows nothing" msgstr "E64:%s%c の後になにもありません" -# -msgid "E65: Illegal back reference" -msgstr "E65: 不正な後方参照です" - # msgid "E68: Invalid character after \\z" msgstr "E68: \\z の後に不正な文字がありました" @@ -4802,29 +4805,43 @@ msgstr "E554: %s{...} 内に文法エラーがあります" msgid "External submatches:\n" msgstr "外部の部分該当:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA 正規表現) 繰り返せません %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= には 0, 1 もしくは 2 のみが続けられます。" -"正規表現エンジンは自動選択されます。" +"E864: \\%#= には 0, 1 もしくは 2 のみが続けられます。正規表現エンジンは自動選" +"択されます。" + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "次のパターンにバックトラッキング RE エンジンを適用します: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) 期待より早く正規表現の終端に到達しました" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA 正規表現) 位置が誤っています: %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) 期待より早く正規表現の終端に到達しました" +# +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA 正規表現) 無効な文字クラス: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) 未知のオペレータです: '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% 値が長過ぎます" + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (NFA) 未知のオペレータです: '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: 等価クラスを含むNFA構築に失敗しました!" @@ -4835,11 +4852,9 @@ msgstr "E869: (NFA) 未知のオペレータです: '\\@%c'" msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (NFA 正規表現) 繰り返しの制限回数を読込中にエラー" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (NFA 正規表現) 繰り返し の後に 繰り返し はできません!" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (NFA 正規表現) '(' が多過ぎます" @@ -4856,8 +4871,8 @@ msgid "" "E875: (NFA regexp) (While converting from postfix to NFA), too many states " "left on stack" msgstr "" -"E875: (NFA 正規表現) (後置文字列をNFAに変換中に) " -"スタックに残されたステートが多過ぎます" +"E875: (NFA 正規表現) (後置文字列をNFAに変換中に) スタックに残されたステートが" +"多過ぎます" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (NFA 正規表現) NFA全体を保存するには空きスペースが足りません" @@ -4867,8 +4882,9 @@ msgstr "E878: (NFA) 現在横断中のブランチに十分なメモリを割り msgid "" "Could not open temporary log file for writing, displaying on stderr ... " -msgstr "NFA正規表現エンジン用のログファイルを書込用として開けません。" -"ログは標準出力に出力します。" +msgstr "" +"NFA正規表現エンジン用のログファイルを書込用として開けません。ログは標準出力に" +"出力します。" #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -4904,9 +4920,6 @@ msgstr " ヘブライ" msgid " Arabic" msgstr " アラビア" -msgid " (lang)" -msgstr " (言語)" - msgid " (paste)" msgstr " (貼り付け)" @@ -4949,7 +4962,6 @@ msgstr "E386: ';' のあとには '?' か '/' が期待されている" msgid " (includes previously listed match)" msgstr " (前に列挙した該当箇所を含む)" -#. cursor at status line msgid "--- Included files " msgstr "--- インクルードされたファイル " @@ -5001,8 +5013,47 @@ msgstr "" "# 最後の %s検索パターン:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: スペルファイルの書式エラーです" +msgid "E756: Spell checking is not enabled" +msgstr "E756: スペルチェックは無効化されています" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"警告: 単語リスト \"%s_%s.spl\" および \"%s_ascii.spl\" は見つかりません" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"警告: 単語リスト \"%s.%s.spl\" および \"%s.ascii.spl\" は見つかりません" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: autocommand の SpellFileMissing がバッファを削除しました" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "警告9: %s という範囲はサポートされていません" + +msgid "Sorry, no suggestions" +msgstr "残念ですが、修正候補はありません" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "残念ですが、修正候補は %ld 個しかありません" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "\"%.*s\" を次へ変換:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: スペル置換がまだ実行されていません" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: 見つかりません: %s" msgid "E758: Truncated spell file" msgstr "E758: スペルファイルが切取られているようです" @@ -5025,19 +5076,6 @@ msgstr "E762: FOL, LOW もしくは UPP の文字が範囲外です" msgid "Compressing word tree..." msgstr "単語ツリーを圧縮しています..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: スペルチェックは無効化されています" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -"警告: 単語リスト \"%s_%s.spl\" および \"%s_ascii.spl\" は見つかりません" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"警告: 単語リスト \"%s.%s.spl\" および \"%s.ascii.spl\" は見つかりません" - #, c-format msgid "Reading spell file \"%s\"" msgstr "スペルファイル \"%s\" を読込中" @@ -5046,7 +5084,7 @@ msgid "E757: This does not look like a spell file" msgstr "E757: スペルファイルではないようです" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: 古いスペルファイルなので, アップデートしてください" +msgstr "E771: 古いスペルファイルなので、アップデートしてください" msgid "E772: Spell file is for newer version of Vim" msgstr "E772: より新しいバージョンの Vim 用のスペルファイルです" @@ -5055,8 +5093,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: スペルファイルにサポートしていないセクションがあります" #, c-format -msgid "Warning: region %s not supported" -msgstr "警告9: %s という範囲はサポートされていません" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug ファイルではないようです: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: 古い .sug ファイルなので、アップデートしてください: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: より新しいバージョンの Vim 用の .sug ファイルです: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug ファイルが .spl ファイルと一致しません: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug ファイルの読込中にエラーが発生しました: %s" #, c-format msgid "Reading affix file %s ..." @@ -5204,8 +5258,8 @@ msgid "E760: No word count in %s" msgstr "E760: %s には単語数がありません" #, c-format -msgid "line %6d, word %6d - %s" -msgstr "行 %6d, 単語 %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "行 %6d, 単語 %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5241,7 +5295,7 @@ msgstr "%s の %d 行目の 重複した /regions= 行を無視しました: %s" #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "%s の %d 行目, 範囲指定が多過ぎます: %s" +msgstr "%s の %d 行目、範囲指定が多過ぎます: %s" #, c-format msgid "/ line ignored in %s line %d: %s" @@ -5269,10 +5323,6 @@ msgstr "ノード %d 個(全 %d 個中) を圧縮しました; 残り %d (%d%%)" msgid "Reading back spell file..." msgstr "スペルファイルを逆読込中" -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "音声畳込みを実行中..." @@ -5295,8 +5345,9 @@ msgstr "推定メモリ使用量: %d バイト" msgid "E751: Output file name must not have region name" msgstr "E751: 出力ファイル名には範囲名を含められません" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: 範囲は 8 個までしかサポートされていません" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: 範囲は %ld 個までしかサポートされていません" #, c-format msgid "E755: Invalid region in %s" @@ -5317,71 +5368,49 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' には %ld 個のエントリはありません" #, c-format -msgid "Word removed from %s" -msgstr "%s から単語が削除されました" +msgid "Word '%.*s' removed from %s" +msgstr "単語 '%.*s' が %s から削除されました" #, c-format -msgid "Word added to %s" -msgstr "%s に単語が追加されました" +msgid "Word '%.*s' added to %s" +msgstr "単語 '%.*s' が %s へ追加されました" msgid "E763: Word characters differ between spell files" msgstr "E763: 単語の文字がスペルファイルと異なります" -msgid "Sorry, no suggestions" -msgstr "残念ですが, 修正候補はありません" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "残念ですが, 修正候補は %ld 個しかありません" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "\"%.*s\" を次へ変換:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "E783: duplicate char in MAP entry" +msgstr "E783: MAP エントリに重複文字が存在します" -msgid "E752: No previous spell replacement" -msgstr "E752: スペル置換がまだ実行されていません" +msgid "No Syntax items defined for this buffer" +msgstr "このバッファに定義された構文要素はありません" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: 見つかりません: %s" +msgid "syntax conceal on" +msgstr "構文の conceal は現在 on です" -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug ファイルではないようです: %s" +msgid "syntax conceal off" +msgstr "構文の conceal は現在 off です" #, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: 古い .sug ファイルなので, アップデートしてください: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: 不正な引数です: %s" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: より新しいバージョンの Vim 用の .sug ファイルです: %s" +msgid "syntax case ignore" +msgstr "構文の大文字小文字は現在 ignore です" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug ファイルが .spl ファイルと一致しません: %s" +msgid "syntax case match" +msgstr "構文の大文字小文字は現在 match です" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug ファイルの読込中にエラーが発生しました: %s" +msgid "syntax spell toplevel" +msgstr "構文の spell は現在 toplevel です" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: MAP エントリに重複文字が存在します" +msgid "syntax spell notoplevel" +msgstr "構文の spell は現在 notoplevel です" -msgid "No Syntax items defined for this buffer" -msgstr "このバッファに定義された構文要素はありません" +msgid "syntax spell default" +msgstr "構文の spell は現在 default です" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: 不正な引数です: %s" +msgid "syntax iskeyword " +msgstr "構文用 iskeyword " #, c-format msgid "E391: No such syntax cluster: %s" @@ -5459,6 +5488,10 @@ msgstr "E847: 構文の取り込み(include)が多過ぎます" msgid "E789: Missing ']': %s" msgstr "E789: ']' がありません: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']' の後ろに余分な文字があります: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' がありません: %s" @@ -5541,7 +5574,7 @@ msgstr "E415: 予期せぬ等号です: %s" #, c-format msgid "E416: missing equal sign: %s" -msgstr "E416: 等号ががありません: %s" +msgstr "E416: 等号がありません: %s" #, c-format msgid "E417: missing argument: %s" @@ -5588,7 +5621,7 @@ msgid "E556: at top of tag stack" msgstr "E556: タグスタックの先頭です" msgid "E425: Cannot go before first matching tag" -msgstr "E425: 最初の該当タグを超えて戻ることはできません" +msgstr "E425: 最初の該当タグを越えて戻ることはできません" #, c-format msgid "E426: tag not found: %s" @@ -5604,13 +5637,12 @@ msgid "E427: There is only one matching tag" msgstr "E427: 該当タグが1つだけしかありません" msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: 最後に該当するタグを超えて進むことはできません" +msgstr "E428: 最後の該当タグを越えて進むことはできません" #, c-format msgid "File \"%s\" does not exist" msgstr "ファイル \"%s\" がありません" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "タグ %d (全%d%s)" @@ -5625,7 +5657,6 @@ msgstr " タグを異なるcaseで使用します!" msgid "E429: File \"%s\" does not exist" msgstr "E429: ファイル \"%s\" がありません" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5656,7 +5687,6 @@ msgstr "直前の %ld バイト" msgid "E432: Tags file not sorted: %s" msgstr "E432: タグファイルがソートされていません: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: タグファイルがありません" @@ -5692,7 +5722,6 @@ msgstr "E436: termcapに \"%s\" のエントリがありません" msgid "E437: terminal capability \"cm\" required" msgstr "E437: 端末に \"cm\" 機能が必要です" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5700,6 +5729,35 @@ msgstr "" "\n" "--- 端末キー ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txtを開けません" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "\"%s\" 内のジョブを終了しますか?" + +msgid "Terminal" +msgstr "端末" + +msgid "Terminal-finished" +msgstr "端末 (終了)" + +msgid "active" +msgstr "アクティブ" + +msgid "running" +msgstr "実行中" + +msgid "finished" +msgstr "終了" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: ファイルは既に存在します: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: 端末バッファではありません" + msgid "new shell started\n" msgstr "新しいシェルを起動します\n" @@ -5709,12 +5767,9 @@ msgstr "Vim: 入力を読込み中のエラーにより終了します...\n" msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "空の選択領域のかわりにCUT_BUFFER0が使用されました" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: 予期せず行カウントが変わりました" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: 予期せず行カウントが変わりました" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "可能なアンドゥはありません: とりあえず続けます" @@ -5847,13 +5902,133 @@ msgstr "E439: アンドゥリストが壊れています" msgid "E440: undo line missing" msgstr "E440: アンドゥ行がありません" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16/32 ビット GUI 版" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: 関数 %s は定義済です、再定義するには ! を追加してください" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: 辞書型内にエントリが既に存在します" + +msgid "E718: Funcref required" +msgstr "E718: 関数参照型が要求されます" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: 未知の関数です: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: 不正な引数です: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: 引数名が重複しています: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: 関数の引数が多過ぎます: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: 関数の無効な引数です: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: 関数呼出の入れ子数が 'maxfuncdepth' を超えました" + +#, c-format +msgid "calling %s" +msgstr "%s を実行中です" + +#, c-format +msgid "%s aborted" +msgstr "%s が中断されました" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s が #%ld を返しました" + +#, c-format +msgid "%s returning %s" +msgstr "%s が %s を返しました" + +msgid "E699: Too many arguments" +msgstr "E699: 引数が多過ぎます" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: 未知の関数です: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: 関数は削除されました: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: 関数の引数が足りません: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: スクリプト以外で<SID>が使われました: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: 辞書用関数が呼ばれましたが辞書がありません: %s" + +msgid "E129: Function name required" +msgstr "E129: 関数名が要求されます" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: 関数名は大文字か \"s:\" で始まらなければなりません: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: 関数名にはコロンは含められません: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: 未定義の関数です: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(' がありません: %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: ここでは g: は使えません" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: クロージャー関数はトップレベルに記述できません: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction がありません" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction の後に文字があります: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: 関数名が変数名と衝突します: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: 関数 %s を再定義できません: 使用中です" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: 関数名がスクリプトのファイル名と一致しません: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: 関数 %s を削除できません: 使用中です" + +msgid "E133: :return not inside a function" +msgstr "E133: 関数外に :return がありました" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: カッコ '(' がありません: %s" msgid "" "\n" @@ -5869,9 +6044,6 @@ msgstr "" "\n" "MS-Windows 32 ビット GUI 版" -msgid " in Win32s mode" -msgstr " in Win32s モード" - msgid " with OLE support" msgstr " with OLE サポート" @@ -5891,45 +6063,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16 ビット 版" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32 ビット MS-DOS 版" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16 ビット MS-DOS 版" - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"MacOS X (unix) 版" - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"MacOS X 版" +"macOS 版" msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"MacOS 版" +"macOS 版 (darwin 無し)" msgid "" "\n" @@ -6003,6 +6147,9 @@ msgstr "" msgid "without GUI." msgstr "without GUI." +msgid "with GTK3 GUI." +msgstr "with GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "with GTK2-GNOME GUI." @@ -6030,9 +6177,6 @@ msgstr "with Carbon GUI." msgid "with Cocoa GUI." msgstr "with Cocoa GUI." -msgid "with (classic) GUI." -msgstr "with (クラシック) GUI." - msgid " Features included (+) or not (-):\n" msgstr " 機能の一覧 有効(+)/無効(-)\n" @@ -6040,31 +6184,34 @@ msgid " system vimrc file: \"" msgstr " システム vimrc: \"" msgid " user vimrc file: \"" -msgstr " ユーザ vimrc: \"" +msgstr " ユーザー vimrc: \"" msgid " 2nd user vimrc file: \"" -msgstr " 第2ユーザ vimrc: \"" +msgstr " 第2ユーザー vimrc: \"" msgid " 3rd user vimrc file: \"" -msgstr " 第3ユーザ vimrc: \"" +msgstr " 第3ユーザー vimrc: \"" msgid " user exrc file: \"" -msgstr " ユーザ exrc: \"" +msgstr " ユーザー exrc: \"" msgid " 2nd user exrc file: \"" -msgstr " 第2ユーザ exrc: \"" +msgstr " 第2ユーザー exrc: \"" msgid " system gvimrc file: \"" msgstr " システム gvimrc: \"" msgid " user gvimrc file: \"" -msgstr " ユーザ gvimrc: \"" +msgstr " ユーザー gvimrc: \"" msgid "2nd user gvimrc file: \"" -msgstr " 第2ユーザ gvimrc: \"" +msgstr " 第2ユーザー gvimrc: \"" msgid "3rd user gvimrc file: \"" -msgstr " 第3ユーザ gvimrc: \"" +msgstr " 第3ユーザー gvimrc: \"" + +msgid " defaults file: \"" +msgstr " デフォルトファイル: \"" msgid " system menu file: \"" msgstr " システムメニュー: \"" @@ -6111,8 +6258,8 @@ msgstr "終了するには :q<Enter> " msgid "type :help<Enter> or <F1> for on-line help" msgstr "オンラインヘルプは :help<Enter> か <F1> " -msgid "type :help version7<Enter> for version info" -msgstr "バージョン情報は :help version7<Enter> " +msgid "type :help version8<Enter> for version info" +msgstr "バージョン情報は :help version8<Enter> " msgid "Running in Vi compatible mode" msgstr "Vi互換モードで動作中" @@ -6124,19 +6271,19 @@ msgid "type :help cp-default<Enter> for info on this" msgstr "詳細な情報は :help cp-default<Enter>" msgid "menu Help->Orphans for information " -msgstr "詳細はメニューの ヘルプ→孤児 を参照して下さい " +msgstr "詳細はメニューの ヘルプ->孤児 を参照して下さい " msgid "Running modeless, typed text is inserted" -msgstr "モード無で実行中, タイプした文字が挿入されます" +msgstr "モード無で実行中。タイプした文字が挿入されます" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "メニューの 編集→全体設定→挿入(初心者)モード切替 " +msgstr "メニューの 編集->全体設定->挿入(初心者)モード切替 " msgid " for two modes " msgstr " でモード有に " msgid "menu Edit->Global Settings->Toggle Vi Compatible" -msgstr "メニューの 編集→全体設定→Vi互換モード切替 " +msgstr "メニューの 編集->全体設定->Vi互換モード切替 " msgid " for Vim defaults " msgstr " でVimとして動作 " @@ -6145,7 +6292,7 @@ msgid "Sponsor Vim development!" msgstr "Vimの開発を応援してください!" msgid "Become a registered Vim user!" -msgstr "Vimの登録ユーザになってください!" +msgstr "Vimの登録ユーザーになってください!" msgid "type :help sponsor<Enter> for information " msgstr "詳細な情報は :help sponsor<Enter> " @@ -6154,13 +6301,7 @@ msgid "type :help register<Enter> for information " msgstr "詳細な情報は :help register<Enter> " msgid "menu Help->Sponsor/Register for information " -msgstr "詳細はメニューの ヘルプ→スポンサー/登録 を参照して下さい " - -msgid "WARNING: Windows 95/98/ME detected" -msgstr " 警告: Windows 95/98/Me を検出 " - -msgid "type :help windows95<Enter> for info on this" -msgstr " 詳細な情報は :help windows95<Enter> " +msgstr "詳細はメニューの ヘルプ->スポンサー/登録 を参照して下さい" msgid "Already only one window" msgstr "既にウィンドウは1つしかありません" @@ -6193,6 +6334,38 @@ msgstr "E446: カーソルの下にファイル名がありません" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: pathには \"%s\" というファイルがありません" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: 無効な ID: %ld (1 以上でなければなりません)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID はすでに利用中です: %ld" + +msgid "List or number required" +msgstr "リストか数値が必要です" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: 無効な ID: %ld (1 以上でなければなりません)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID はありません: %ld" + +#, c-format +msgid "E370: Could not load library %s" +msgstr "E370: ライブラリ %s をロードできませんでした" + +msgid "Sorry, this command is disabled: the Perl library could not be loaded." +msgstr "" +"このコマンドは無効です、ごめんなさい: Perlライブラリをロードできませんでした." + +msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" +msgstr "" +"E299: サンドボックスでは Safe モジュールを使用しないPerlスクリプトは禁じられ" +"ています" + msgid "Edit with &multiple Vims" msgstr "複数のVimで編集する (&M)" @@ -6205,7 +6378,6 @@ msgstr "Vimで差分を表示する" msgid "Edit with &Vim" msgstr "Vimで編集する (&V)" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "起動済のVimで編集する - " @@ -6219,15 +6391,11 @@ msgid "gvimext.dll error" msgstr "gvimext.dll エラー" msgid "Path length too long!" -msgstr "パスが長すぎます!" +msgstr "パスが長過ぎます!" msgid "--No lines in buffer--" msgstr "--バッファに行がありません--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: コマンドが中断されました" @@ -6283,6 +6451,10 @@ msgstr "E236: フォント \"%s\" は固定幅ではありません" msgid "E473: Internal error" msgstr "E473: 内部エラーです" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: 内部エラーです: %s" + msgid "Interrupted" msgstr "割込まれました" @@ -6296,6 +6468,14 @@ msgstr "E474: 無効な引数です" msgid "E475: Invalid argument: %s" msgstr "E475: 無効な引数です: %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: 引数 %s に対して無効な値です" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: 引数 %s に対して無効な値です: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: 無効な式です: %s" @@ -6314,6 +6494,9 @@ msgstr "E17: \"%s\" はディレクトリです" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: \"%s\"() のライブラリ呼出に失敗しました" +msgid "E667: Fsync failed" +msgstr "E667: fsync に失敗しました" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: ライブラリの関数 %s をロードできませんでした" @@ -6325,7 +6508,7 @@ msgid "E20: Mark not set" msgstr "E20: マークは設定されていません" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: 'modifiable' がオフなので, 変更できません" +msgstr "E21: 'modifiable' がオフなので、変更できません" msgid "E22: Scripts nested too deep" msgstr "E22: スクリプトの入れ子が深過ぎます" @@ -6391,7 +6574,7 @@ msgstr "E36: ウィンドウに十分な高さもしくは幅がありません" #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "E247: %s という名前の登録されたサーバはありません" +msgstr "E247: %s という名前の登録されたサーバーはありません" #, c-format msgid "E482: Can't create file %s" @@ -6408,9 +6591,6 @@ msgstr "E484: ファイル \"%s\" を開けません" msgid "E485: Can't read file %s" msgstr "E485: ファイル %s を読込めません" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: 最後の変更が保存されていません (! を追加で変更を破棄)" - msgid "E38: Null argument" msgstr "E38: 引数が空です" @@ -6444,7 +6624,7 @@ msgid "E42: No Errors" msgstr "E42: エラーはありません" msgid "E776: No location list" -msgstr "E776: 場所リストはありません" +msgstr "E776: ロケーションリストはありません" msgid "E43: Damaged match string" msgstr "E43: 該当文字列が破損しています" @@ -6463,6 +6643,31 @@ msgstr "E46: 読取専用変数 \"%s\" には値を設定できません" msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: サンドボックスでは変数 \"%s\" に値を設定できません" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: 辞書型に空のキーを使うことはできません" + +msgid "E715: Dictionary required" +msgstr "E715: 辞書型が必要です" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: リストのインデックスが範囲外です: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: 関数の引数が多過ぎます: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: 辞書型にキーが存在しません: %s" + +msgid "E714: List required" +msgstr "E714: リスト型が必要です" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s の引数はリスト型または辞書型でなければなりません" + msgid "E47: Error while reading errorfile" msgstr "E47: エラーファイルの読込中にエラーが発生しました" @@ -6520,8 +6725,8 @@ msgstr "E592: 'winwidth' は 'winminwidth' より小さくできません" msgid "E80: Error while writing" msgstr "E80: 書込み中のエラー" -msgid "Zero count" -msgstr "ゼロカウント" +msgid "E939: Positive count required" +msgstr "E939: 正のカウントが必要です" msgid "E81: Using <SID> not in a script context" msgstr "E81: スクリプト以外で<SID>が使われました" @@ -6530,21 +6735,21 @@ msgid "E449: Invalid expression received" msgstr "E449: 無効な式を受け取りました" msgid "E463: Region is guarded, cannot modify" -msgstr "E463: 領域が保護されているので, 変更できません" +msgstr "E463: 領域が保護されているので、変更できません" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans は読込専用ファイルを変更することを許しません" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: 内部エラーです: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: パターンが 'maxmempattern' 以上のメモリを使用します" msgid "E749: empty buffer" msgstr "E749: バッファが空です" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: バッファ %ld はありません" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: 検索パターンか区切り記号が不正です" @@ -6558,6 +6763,13 @@ msgstr "E764: オプション '%s' は設定されていません" msgid "E850: Invalid register name" msgstr "E850: 無効なレジスタ名です" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: ディレクトリが '%s' の中にありません: \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Autocommandが再帰を引き起こしました" + msgid "search hit TOP, continuing at BOTTOM" msgstr "上まで検索したので下に戻ります" @@ -6608,7 +6820,7 @@ msgstr "C言語の int 型としては値が大き過ぎます" msgid "value is too small to fit into C int type" msgstr "C言語の int 型としては値が小さ過ぎます" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr "数値は 0 より大きくなければなりません" msgid "number must be greater or equal to zero" @@ -6629,11 +6841,11 @@ msgstr "辞書の変更に失敗しました" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got %s" -msgstr "imp.find_module() が %s を返しました (期待値: 2 要素のタプル)" +msgstr "imp.find_module() が %s を返しました (期待値: 3 要素のタプル)" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" -msgstr "impl.find_module() が %d 要素のタプルを返しました (期待値: 2)" +msgstr "imp.find_module() が %d 要素のタプルを返しました (期待値: 3)" msgid "internal error: imp.find_module returned tuple with NULL" msgstr "内部エラー: imp.find_module が NULL を含むタプルを返しました" @@ -6661,21 +6873,34 @@ msgstr "リストのコンストラクタはキーワード引数を受け付け msgid "list index out of range" msgstr "リスト範囲外のインデックスです" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr "内部エラー: vimのリスト要素 %d の取得に失敗しました" -msgid "failed to add item to list" -msgstr "リストへの要素追加に失敗しました" +msgid "slice step cannot be zero" +msgstr "スライスのステップに 0 は指定できません" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "長さ %d の拡張スライスに、より長いスライスを割り当てようとしました" #, c-format msgid "internal error: no vim list item %d" msgstr "内部エラー: vimのリスト要素 %d はありません" +msgid "internal error: not enough list items" +msgstr "内部エラー: リストに十分な要素がありません" + msgid "internal error: failed to add item to list" msgstr "内部エラー: リストへの要素追加に失敗しました" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "長さ %d のスライスを %d の拡張スライスに割り当てようとしました" + +msgid "failed to add item to list" +msgstr "リストへの要素追加に失敗しました" + msgid "cannot delete vim.List attributes" msgstr "vim.List 属性は消せません" @@ -6690,9 +6915,6 @@ msgstr "無名関数 %s は存在しません" msgid "function %s does not exist" msgstr "関数 %s がありません" -msgid "function constructor does not accept keyword arguments" -msgstr "関数のコンストラクタはキーワード引数を受け付けません" - #, c-format msgid "failed to run function %s" msgstr "関数 %s の実行に失敗しました" @@ -6779,6 +7001,10 @@ msgstr "E859: 返されたpythonオブジェクトをvimの値に変換できま msgid "unable to convert %s to vim dictionary" msgstr "%s vimの辞書型に変換できません" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s をvimのリストに変換できません" + #, c-format msgid "unable to convert %s to vim structure" msgstr "%s をvimの構造体に変換できません" @@ -6806,3 +7032,75 @@ msgid "" msgstr "" "パスの設定に失敗しました: sys.path がリストではありません\n" "すぐに vim.VIM_SPECIAL_PATH を sys.path に追加してください" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Vimマクロファイル (*.vim)\t*.vim\n" +"すべてのファイル (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "すべてのファイル (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"すべてのファイル (*.*)\t*.*\n" +"Cソース (*.c, *.h)\t*.c;*.h\n" +"C++ソース (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VBコード (*.bas, *.frm)\t*.bas;*.frm\n" +"Vimファイル (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim マクロファイル (*.vim)\t*.vim\n" +"すべてのファイル (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "すべてのファイル (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"すべてのファイル (*)\t*\n" +"Cソース (*.c, *.h)\t*.c;*.h\n" +"C++ソース (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vimファイル (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "Do you want to save the changes you made in the " +"document \"%s\"?" +msgstr "\"%s\"を保存しますか?" +"" + +msgid "Your changes will be lost if you don't save " +"them." +msgstr "保存しない場合、変更は失われます。" +"" + +msgid "&Save\n&Cancel\n&Don't Save" +msgstr "保存(&S)\nキャンセル(&C)\n保存しない(&D)" + +msgid "&Save...\n&Cancel\n&Don't Save" +msgstr "保存...(&S)\nキャンセル(&C)\n保存しない(&D)" + +msgid "There are several documents with unsaved changes. " +"Do you want to save the changes you made in the " +"document \"%s\"?" +msgstr "保存されていないドキュメントがあります。" +"\"%s\"を保存しますか?" +"" + +msgid "&Save\n&Don't Save\nS&ave All\nD&iscard All\n" +"&Cancel" +msgstr "保存(&S)\n保存しない(&D)\n全て保存(&a)\n全て破棄(&i)\n" +"キャンセル(&C)" diff --git a/src/po/ja.sjis.po b/src/po/ja.sjis.po index e9c392d8a3..02fff41844 100644 --- a/src/po/ja.sjis.po +++ b/src/po/ja.sjis.po @@ -1,27 +1,28 @@ -# Japanese translation for Vim vim:set foldmethod=marker: +# Japanese translation for Vim # # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# Last Change: 2014 May 13 +# Copyright (C) 2001-2018 MURAOKA Taro <koron.kaoriya@gmail.com>, +# vim-jp (http://vim-jp.org/) # -# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. # -# Original translations. +# generated from ja.po, DO NOT EDIT # msgid "" msgstr "" -"Project-Id-Version: Vim 7.4\n" +"Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-06 13:50+0900\n" -"PO-Revision-Date: 2013-07-06 15:00+0900\n" +"POT-Creation-Date: 2018-05-01 10:46+0900\n" +"PO-Revision-Date: 2017-05-18 00:45+0900\n" "Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n" -"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n" +"Language-Team: vim-jp (https://github.com/vim-jp/lang-ja)\n" "Language: Japanese\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=cp932\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() pX[hŌĂяo܂" @@ -39,7 +40,7 @@ msgid "E819: Blowfish test failed" msgstr "E819: BlowfishÍ̃eXgɎs܂" msgid "[Location List]" -msgstr "[ꏊXg]" +msgstr "[P[VXg]" msgid "[Quickfix List]" msgstr "[QuickfixXg]" @@ -48,10 +49,16 @@ msgid "E855: Autocommands caused command to abort" msgstr "E855: autocommandR}h̒~N܂" msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: obt@1‚쐬łȂ̂, I܂..." +msgstr "E82: obt@1‚쐬łȂ̂ŁAI܂..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: obt@쐬łȂ̂, ̂gp܂..." +msgstr "E83: obt@쐬łȂ̂ŁÂgp܂..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: obt@o^ł܂" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: gp̃obt@폜悤Ǝ݂܂" msgid "E515: No buffers were unloaded" msgstr "E515: ꂽobt@͂܂" @@ -83,17 +90,15 @@ msgstr "1 msgid "%d buffers wiped out" msgstr "%d ‚̃obt@j܂" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Ō̃obt@͉ł܂" + msgid "E84: No modified buffer found" msgstr "E84: ύXꂽobt@͂܂" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Xg\\obt@͂܂" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: obt@ %ld ͂܂" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Ō̃obt@zĈړ͂ł܂" @@ -104,8 +109,17 @@ msgstr "E88: msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: obt@ %ld ̕ύX͕ۑĂ܂ (! ŕύXj)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Ō̃obt@͉ł܂" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Wu͂܂sł (! ljŃWuI)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Ō̕ύXۑĂ܂ (! ljŕύXj)" + +msgid "E948: Job still running" +msgstr "E948: Wu͂܂sł" + +msgid "E37: No write since last change" +msgstr "E37: Ō̕ύXۑĂ܂" msgid "W14: Warning: List of file names overflow" msgstr "W14: x: t@C̃Xg߂܂" @@ -162,7 +176,6 @@ msgstr " msgid "[No Name]" msgstr "[]" -#. must be a help buffer msgid "help" msgstr "wv" @@ -188,6 +201,9 @@ msgstr "" "\n" "# obt@Xg:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: 'buftype' IvVݒ肳Ă̂ŏ߂܂" + msgid "[Scratch]" msgstr "[]" @@ -206,15 +222,107 @@ msgstr "%s msgid " line=%ld id=%d name=%s" msgstr " s=%ld ʎq=%d O=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: |[gɐڑł܂" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: channel_open() gethostbyname() s܂" + +msgid "E898: socket() in channel_open()" +msgstr "E898: channel_open() socket() s܂" + +msgid "E903: received command with non-string argument" +msgstr "E903: 񕶎̈̃R}hM܂" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: expr/call ̍Ō̈͐łȂ΂Ȃ܂" + +msgid "E904: third argument for call must be a list" +msgstr "E904: call 3Ԗڂ̈̓Xg^łȂ΂Ȃ܂" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: m̃R}hM܂: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): ڑԂŏ݂܂" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): ݂Ɏs܂" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s() ɃR[obN͎g܂" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: raw nl [h̃`l ch_evalexpr()/ch_sendexpr() ͎g܂" + +msgid "E906: not an open channel" +msgstr "E906: JĂȂ`lł" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io t@C _name ̐ݒ肪Kvł" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io obt@ in_buf in_name ̐ݒ肪Kvł" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: obt@[hĂȂ΂Ȃ܂: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: t@Cm̕@ňÍĂ܂" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "x: アÍ@gĂ܂; :help 'cm' QƂĂ" + +msgid "Enter encryption key: " +msgstr "Íp̃L[͂Ă: " + +msgid "Enter same key again: " +msgstr "xL[͂Ă: " + +msgid "Keys don't match!" +msgstr "L[v܂" + +msgid "[crypted]" +msgstr "[Í]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: ^ɃR܂: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: ^ɏdL[܂: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: ^ɃJ}܂: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: ^̍Ō '}' ܂: %s" + +msgid "extend() argument" +msgstr "extend() ̈" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: L[͊ɑ݂܂: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: %ld ȏ̃obt@diffł܂" msgid "E810: Cannot read or write temp files" msgstr "E810: ꎞt@C̓Ǎ͏ł܂" msgid "E97: Cannot create diffs" -msgstr "E97: 쐬ł܂ " +msgstr "E97: 쐬ł܂" msgid "Patch file" msgstr "pb`t@C" @@ -229,7 +337,7 @@ msgid "E99: Current buffer is not in diff mode" msgstr "E99: ݂̃obt@͍[hł͂܂" msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: [hł鑼̃obt@͕ύX”\\ł" +msgstr "E793: [hł鑼̃obt@͕ύXł܂" msgid "E100: No other buffer in diff mode" msgstr "E100: [hł鑼̃obt@͂܂" @@ -264,7 +372,6 @@ msgstr "E791: msgid " Keyword completion (^N^P)" msgstr " L[[h⊮ (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X [h (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -272,7 +379,7 @@ msgid " Whole line completion (^L^N^P)" msgstr " s(S)⊮ (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr "t@C⊮ (^F^N^P)" +msgstr " t@C⊮ (^F^N^P)" msgid " Tag completion (^]^N^P)" msgstr " ^O⊮ (^]^N^P)" @@ -293,7 +400,7 @@ msgid " Command-line completion (^V^N^P)" msgstr " R}hC⊮ (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " [U`⊮ (^U^N^P)" +msgstr " [U[`⊮ (^U^N^P)" msgid " Omni completion (^O^N^P)" msgstr " Ij⊮ (^O^N^P)" @@ -336,13 +443,12 @@ msgstr " msgid "Scanning tags." msgstr "^OXL." +msgid "match in file" +msgstr "t@C̃}b`" + msgid " Adding" msgstr " lj" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- ..." @@ -366,10 +472,6 @@ msgstr "%d msgid "E18: Unexpected characters in :let" msgstr "E18: \\ʕ :let ɂ܂" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: Xg̃CfbNX͈͊Oł: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: `̕ϐł: %s" @@ -377,41 +479,6 @@ msgstr "E121: msgid "E111: Missing ']'" msgstr "E111: ']' ‚܂" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s ̈̓Xg^łȂ΂Ȃ܂" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s ̈̓Xg^܂͎^łȂ΂Ȃ܂" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: ^ɋ̃L[gƂ͂ł܂" - -msgid "E714: List required" -msgstr "E714: Xg^Kvł" - -msgid "E715: Dictionary required" -msgstr "E715: ^Kvł" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: ֐̈߂܂: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: ^ɃL[݂܂: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: ֐ %s ͒`ςł, Ē`ɂ ! ljĂ" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: ^ɃGgɑ݂܂" - -msgid "E718: Funcref required" -msgstr "E718: ֐Qƌ^v܂" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: [:] ^Ƒgݍ킹Ă͎g܂" @@ -419,10 +486,6 @@ msgstr "E719: [:] msgid "E734: Wrong variable type for %s=" msgstr "E734: قȂ^̕ϐł %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: m̊֐ł: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: sȕϐł: %s" @@ -462,38 +525,20 @@ msgstr "E711: msgid "E690: Missing \"in\" after :for" msgstr "E690: :for ̌ \"in\" ܂" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: JbR '(' ܂: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: ̕ϐ͂܂: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: ϐ %s ̓bN܂̓AbNł܂" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: (A)bNɂ͕ϐ̓q[߂܂" msgid "E109: Missing ':' after '?'" msgstr "E109: '?' ̌ ':' ܂" -msgid "E691: Can only compare List with List" -msgstr "E691: Xg^̓Xg^Ƃrł܂" - -msgid "E692: Invalid operation for List" -msgstr "E692: Xg^ɂ͖ȑł" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: ^͎^Ƃrł܂" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: ^ɂ͖ȑł" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: ֐Qƌ^͊֐Qƌ^Ƃrł܂" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: ֐Qƌ^ɂ͖ȑł" - msgid "E804: Cannot use '%' with Float" msgstr "E804: '%' 𕂓_Ƒgݍ킹Ă͎g܂" @@ -503,6 +548,9 @@ msgstr "E110: ')' msgid "E695: Cannot index a Funcref" msgstr "E695: ֐Qƌ^̓CfbNXł܂" +msgid "E909: Cannot index a special variable" +msgstr "E909: ϐ̓CfbNXł܂" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: IvV܂: %s" @@ -519,83 +567,118 @@ msgstr "E114: msgid "E115: Missing quote: %s" msgstr "E115: p (') ܂: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Xg^ɃJ}܂: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"K[xbWRNV𒆎~܂! QƂ쐬̂Ƀs܂" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Xg^̍Ō ']' ܂: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: \\ɂ͕ϐ̓q[߂܂" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: ^ɃR܂: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: _𐔒lƂĈĂ܂" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: ^ɏdL[܂: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: ֐Qƌ^𐔒lƂĈĂ܂" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: ^ɃJ}܂: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Xg^𐔒lƂĈĂ܂" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: ^̍Ō '}' ܂: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: ^𐔒lƂĈĂ܂" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: \\ɂ͕ϐ̓q[߂܂" +msgid "E910: Using a Job as a Number" +msgstr "E910: Wu𐔒lƂĈĂ܂" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: ֐̈߂܂: %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: `l𐔒lƂĈĂ܂" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: ֐Qƌ^𕂓_ƂĈĂ܂" + +msgid "E892: Using a String as a Float" +msgstr "E892: 𕂓_ƂĈĂ܂" + +msgid "E893: Using a List as a Float" +msgstr "E893: Xg^𕂓_ƂĈĂ܂" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: ^𕂓_ƂĈĂ܂" + +msgid "E907: Using a special value as a Float" +msgstr "E907: l𕂓_ƂĈĂ܂" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Wu𕂓_ƂĈĂ܂" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: `l𕂓_ƂĈĂ܂" + +msgid "E729: using Funcref as a String" +msgstr "E729: ֐Qƌ^𕶎ƂĈĂ܂" + +msgid "E730: using List as a String" +msgstr "E730: Xg^𕶎ƂĈĂ܂" + +msgid "E731: using Dictionary as a String" +msgstr "E731: ^𕶎ƂĈĂ܂" + +msgid "E908: using an invalid value as a String" +msgstr "E908: Ȓl𕶎ƂĈĂ܂" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: ֐̖Ȉł: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: ϐ %s 폜ł܂" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: m̊֐ł: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: ֐Qƌ^ϐ͑啶Ŏn܂Ȃ΂Ȃ܂: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: ֐̈ȉ߂܂: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: ϐ̊֐ƏՓ˂܂: %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: XNvgȊO<SID>g܂: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: lbNĂ܂: %s" + +msgid "Unknown" +msgstr "s" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: p֐Ă΂܂܂: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s ̒lύXł܂" -msgid "E808: Number or Float required" -msgstr "E808: l_Kvł" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Rs[ɂ͕ϐ̓q[߂܂" -msgid "add() argument" -msgstr "add() ̈" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# O[oϐ:\n" -msgid "E699: Too many arguments" -msgstr "E699: ߂܂" +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tŌɃZbgXNvg: " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() ͑}[hłpł܂" +msgid "E691: Can only compare List with List" +msgstr "E691: Xg^̓Xg^Ƃrł܂" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E692: Invalid operation for List" +msgstr "E692: Xg^ɂ͖ȑł" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: L[͊ɑ݂܂: %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: ^͎^Ƃrł܂" -msgid "extend() argument" -msgstr "extend() ̈" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: ^ɂ͖ȑł" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: ֐Qƌ^ɂ͖ȑł" msgid "map() argument" msgstr "map() ̈" @@ -604,13 +687,39 @@ msgid "filter() argument" msgstr "filter() ̈" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld s: " +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s ̈̓Xg^łȂ΂Ȃ܂" + +msgid "E928: String required" +msgstr "E928: 񂪕Kvł" + +msgid "E808: Number or Float required" +msgstr "E808: l_Kvł" + +msgid "add() argument" +msgstr "add() ̈" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() ͑}[hłpł܂" + +msgid "&Ok" +msgstr "&Ok" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld s: " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: m̊֐ł: %s" +msgid "E922: expected a dict" +msgstr "E922: ҂Ă܂" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function() ̑ 2 ̓Xg^܂͎^łȂ΂Ȃ܂" + msgid "" "&OK\n" "&Cancel" @@ -627,196 +736,99 @@ msgstr "insert() msgid "E786: Range not allowed" msgstr "E786: ͈͎w͋‚Ă܂" +msgid "E916: not a valid job" +msgstr "E916: LȃWuł͂܂" + msgid "E701: Invalid type for len()" msgstr "E701: len() ɂ͖Ȍ^ł" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID \":match\" ̂߂ɗ\\񂳂Ă܂: %ld" + msgid "E726: Stride is zero" msgstr "E726: XgCh(Oi) 0 ł" msgid "E727: Start past end" -msgstr "E727: JnʒuIʒuz܂" - -msgid "<empty>" -msgstr "<>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim T[oւ̐ڑ܂" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s ֑邱Ƃł܂" - -msgid "E277: Unable to read a server reply" -msgstr "E277: T[ỏ܂" - -msgid "remove() argument" -msgstr "remove() ̈" - -# Added at 10-Mar-2004. -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: V{bNN߂܂ (z‚Ă”\\܂)" - -msgid "reverse() argument" -msgstr "reverse() ̈" - -msgid "E258: Unable to send to client" -msgstr "E258: NCAg֑邱Ƃł܂" - -msgid "sort() argument" -msgstr "sort() ̈" - -msgid "E702: Sort compare function failed" -msgstr "E702: \\[g̔r֐s܂" - -msgid "(Invalid)" -msgstr "()" - -msgid "E677: Error writing temp file" -msgstr "E677: ꎞt@CɃG[܂" - -msgid "E805: Using a Float as a Number" -msgstr "E805: _𐔒lƂĈĂ܂" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: ֐Qƌ^𐔒lƂĈĂ܂B" - -msgid "E745: Using a List as a Number" -msgstr "E745: Xg^𐔒lƂĈĂ܂" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: ^𐔒lƂĈĂ܂" - -msgid "E729: using Funcref as a String" -msgstr "E729: ֐Qƌ^𕶎ƂĈĂ܂" - -msgid "E730: using List as a String" -msgstr "E730: Xg^𕶎ƂĈĂ܂" - -msgid "E731: using Dictionary as a String" -msgstr "E731: ^𕶎ƂĈĂ܂" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: ϐ̌^v܂: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: ϐ %s 폜ł܂" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: ֐Qƌ^ϐ͑啶Ŏn܂Ȃ΂Ȃ܂: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: ϐ̊֐ƏՓ˂܂: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: lbNĂ܂: %s" - -msgid "Unknown" -msgstr "s" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s ̒lύXł܂" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: Rs[ɂ͕ϐ̓q[߂܂" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: `̊֐ł: %s" +msgstr "E727: JnʒuIʒuz܂" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' ܂: %s" +msgid "<empty>" +msgstr "<>" -msgid "E862: Cannot use g: here" -msgstr "E862: ł g: ͎g܂" +msgid "E240: No connection to the X server" +msgstr "E240: X T[o[ւ̐ڑ܂" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: sȈł: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s ֑邱Ƃł܂" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: dĂ܂: %s" +msgid "E277: Unable to read a server reply" +msgstr "E277: T[o[̉܂" -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction ܂" +msgid "E941: already started a server" +msgstr "E941: T[o[͂łɊJnĂ܂" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: ֐ϐƏՓ˂܂: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver @\\ɂȂĂ܂" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: ֐ %s Ē`ł܂: gpł" +msgid "remove() argument" +msgstr "remove() ̈" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: ֐XNvg̃t@Cƈv܂: %s" +# Added at 10-Mar-2004. +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: V{bNN߂܂ (z‚Ă”\\܂)" -msgid "E129: Function name required" -msgstr "E129: ֐v܂" +msgid "reverse() argument" +msgstr "reverse() ̈" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: ֐͑啶Ŏn܂邩R܂܂Ȃ΂Ȃ܂: %s" +msgid "E258: Unable to send to client" +msgstr "E258: NCAg֑邱Ƃł܂" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: ֐ %s 폜ł܂: gpł" +msgid "E927: Invalid action: '%s'" +msgstr "E927: ȑł: %s" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: ֐ďo̓q 'maxfuncdepth' 𒴂܂" +msgid "sort() argument" +msgstr "sort() ̈" -#, c-format -msgid "calling %s" -msgstr "%s sł" +msgid "uniq() argument" +msgstr "uniq() ̈" -#, c-format -msgid "%s aborted" -msgstr "%s f܂" +msgid "E702: Sort compare function failed" +msgstr "E702: \\[g̔r֐s܂" -#, c-format -msgid "%s returning #%ld" -msgstr "%s #%ld Ԃ܂" +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq ̔r֐s܂" -#, c-format -msgid "%s returning %s" -msgstr "%s %s Ԃ܂" +msgid "(Invalid)" +msgstr "()" #, c-format -msgid "continuing in %s" -msgstr "%s ̎spł" - -msgid "E133: :return not inside a function" -msgstr "E133: ֐O :return ܂" +msgid "E935: invalid submatch number: %d" +msgstr "E935: ȃTu}b`ԍ: %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# O[oϐ:\n" +msgid "E677: Error writing temp file" +msgstr "E677: ꎞt@CɃG[܂" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLast set from " +msgid "E921: Invalid callback argument" +msgstr "E921: ȃR[obNł" -msgid "No old files" -msgstr "Ât@C͂܂" +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, 16i %02x, 8i %03o, _COt %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" msgstr "<%s>%s%s %d, 16i %02x, 8i %03o" +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, 16i %04x, 8i %o, _COt %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, 16i %08x, 8i %o, _COt %s" + #, c-format msgid "> %d, Hex %04x, Octal %o" msgstr "> %d, 16i %04x, 8i %o" @@ -850,11 +862,11 @@ msgid "%sviminfo: %s in line: " msgstr "%sviminfo: %s s: " msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: G[߂̂, ȍ~̓XLbv܂" +msgstr "E136: viminfo: G[߂̂ŁAȍ~̓XLbv܂" #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" -msgstr "viminfot@C \"%s\"%s%s%s Ǎݒ " +msgstr "viminfot@C \"%s\"%s%s%s Ǎݒ" msgid " info" msgstr " " @@ -868,11 +880,14 @@ msgstr " msgid " FAILED" msgstr " s" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: viminfot@C݂ł܂: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: ꎞviminfot@C߂܂! : %s" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: viminfot@C %s ۑł܂!" @@ -881,7 +896,10 @@ msgstr "E138: viminfo msgid "Writing viminfo file \"%s\"" msgstr "viminfot@C \"%s\" ݒ" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfot@C %s ֖OύXł܂!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# viminfo t@C Vim %s ɂĐ܂.\n" @@ -899,6 +917,13 @@ msgstr "# msgid "Illegal starting char" msgstr "sȐ擪ł" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# '|' Ŏn܂śAʂ̃Rs[:\n" + msgid "Save As" msgstr "ʖŕۑ" @@ -993,8 +1018,8 @@ msgstr " ( msgid " on %ld lines" msgstr " (v %ld s)" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global ċAIɂ͎g܂" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global ͈͕tōċAIɂ͎g܂" msgid "E148: Regular expression missing from global" msgstr "E148: globalR}hɐK\\w肳Ă܂" @@ -1032,8 +1057,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "cOłwvt@C \"%s\" ‚܂" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: fBNgł͂܂: %s" +msgid "E151: No match: %s" +msgstr "E151: }b`͂܂: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1052,6 +1077,10 @@ msgstr "E670: 1 msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: ^O \"%s\" t@C %s/%s ɏdĂ܂" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: fBNgł͂܂: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: msignR}hł: %s" @@ -1077,13 +1106,20 @@ msgstr "E159: sign msgid "E158: Invalid buffer name: %s" msgstr "E158: ȃobt@ł: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: O̖obt@ւ̓Wvł܂" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: signʎqł: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: ύXłȂ sign ł: %s" + # Added at 27-Jan-2004. msgid " (NOT FOUND)" -msgstr " (‚܂)" +msgstr " (‚܂)" msgid " (not supported)" msgstr " (T|[g)" @@ -1091,9 +1127,20 @@ msgstr " ( msgid "[Deleted]" msgstr "[폜]" +msgid "No old files" +msgstr "Ât@C͂܂" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "fobO[hɓ܂. ɂ \"cont\" Ɠ͂Ă." +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Âl = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Vl = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "s %ld: %s" @@ -1102,6 +1149,13 @@ msgstr " msgid "cmd: %s" msgstr "R}h: %s" +msgid "frame is zero" +msgstr "t[ 0 ł" + +#, c-format +msgid "frame at highest level: %d" +msgstr "ōx̃t[: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "u[N|Cg \"%s%s\" s %ld" @@ -1117,6 +1171,10 @@ msgstr " msgid "%3d %s %s line %ld" msgstr "%3d %s %s s %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: ߂ \":profile start {fname}\" sĂ" @@ -1124,8 +1182,9 @@ msgstr "E750: msgid "Save changes to \"%s\"?" msgstr "ύX \"%s\" ɕۑ܂?" -msgid "Untitled" -msgstr "" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Wu̓obt@ \"%s\" ł܂sł" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1156,8 +1215,16 @@ msgid "Searching for \"%s\"" msgstr "\"%s\" " #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "'runtimepath' ̒ɂ͌‚܂: \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' ̒ɂ͂܂: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: vꂽpython 2.x͑ΉĂ܂At@C𖳎܂: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: vꂽpython 3.x͑ΉĂ܂At@C𖳎܂: %s" msgid "Source Vim script" msgstr "VimXNvg̎捞" @@ -1186,6 +1253,10 @@ msgstr " msgid "finished sourcing %s" msgstr "%s ̎捞" +#, c-format +msgid "continuing in %s" +msgstr "%s ̎spł" + msgid "modeline" msgstr "[hs" @@ -1219,7 +1290,8 @@ msgid "E197: Cannot set language to \"%s\"" msgstr "E197: \"%s\" ɐݒł܂" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Ex[hɓ܂. m[}ɖ߂ɂ\"visual\"Ɠ͂Ă." +msgstr "" +"Ex[hɓ܂. m[}[hɖ߂ɂ\"visual\"Ɠ͂Ă." msgid "E501: At end-of-file" msgstr "E501: t@C̏Iʒu" @@ -1238,7 +1310,7 @@ msgid "End of function" msgstr "֐̍Ōł" msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: [U`R}ĥ܂Ȏgpł" +msgstr "E464: [U[`R}ĥ܂Ȏgpł" msgid "E492: Not an editor command" msgstr "E492: GfB^̃R}hł͂܂" @@ -1247,23 +1319,25 @@ msgid "E493: Backwards range given" msgstr "E493: t܂͈̔͂w肳܂" msgid "Backwards range given, OK to swap" -msgstr "t܂͈̔͂w肳܂, ւ܂?" +msgstr "t܂͈̔͂w肳܂Aւ܂?" msgid "E494: Use w or w>>" msgstr "E494: w w>> gpĂ" -msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: ̃o[Wł͂̃R}h͗pł܂, ߂Ȃ" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: R}he[uXVKv܂A'make cmdidxs' sĂ" +"" -msgid "E172: Only one file name allowed" -msgstr "E172: t@C 1 ‚ɂĂ" +msgid "E319: Sorry, the command is not available in this version" +msgstr "E319: ̃o[Wł͂̃R}h͗pł܂A߂Ȃ" msgid "1 more file to edit. Quit anyway?" -msgstr "ҏWׂt@C 1 ‚܂, I܂?" +msgstr "ҏWׂt@C 1 ‚܂AI܂?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "ҏWׂt@C %d ‚܂, I܂?" +msgstr "ҏWׂt@C %d ‚܂AI܂?" msgid "E173: 1 more file to edit" msgstr "E173: ҏWׂt@C 1 ‚܂" @@ -1277,13 +1351,13 @@ msgstr "E174: msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" O ͈ ⊮ `" +" O AhX ⊮ `" msgid "No user-defined commands found" -msgstr "[U`R}h‚܂ł" +msgstr "[U[`R}h‚܂ł" msgid "E175: No attribute specified" msgstr "E175: ͒`Ă܂" @@ -1298,7 +1372,10 @@ msgid "E178: Invalid default value for count" msgstr "E178: JEg̏ȗlł" msgid "E179: argument required for -complete" -msgstr "E179: -⊮̂߂̈Kvł" +msgstr "E179: -complete ɂ͈Kvł" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr ɂ͈Kvł" #, c-format msgid "E181: Invalid attribute: %s" @@ -1308,14 +1385,18 @@ msgid "E182: Invalid command name" msgstr "E182: ȃR}hł" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: [U`R}h͉p啶Ŏn܂Ȃ΂Ȃ܂" +msgstr "E183: [U[`R}h͉p啶Ŏn܂Ȃ΂Ȃ܂" msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: \\񖼂Ȃ̂, [U`R}hɗpł܂" +msgstr "E841: \\񖼂Ȃ̂ŁA[U[`R}hɗpł܂" #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: ̃[U`R}h͂܂: %s" +msgstr "E184: ̃[U[`R}h͂܂: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ȃAhX^Cvlł: %s" #, c-format msgid "E180: Invalid complete value: %s" @@ -1358,7 +1439,7 @@ msgstr " msgid "E747: Cannot change directory, buffer is modified (add ! to override)" msgstr "" -"E747: obt@CĂ̂, fBNgύXł܂ (! lj" +"E747: obt@CĂ̂ŁAfBNgύXł܂ (! lj" "㏑)" msgid "E186: No previous directory" @@ -1381,6 +1462,9 @@ msgstr "" msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos ɂ2‚̐l̈Kvł" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: execute() ̒ł :redir ͎g܂" + msgid "Save Redirection" msgstr "_CNgۑ܂" @@ -1405,7 +1489,6 @@ msgstr "E189: \"%s\" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: \"%s\" ݗpƂĊJ܂" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: 1̉pp (' `) łȂ΂܂" @@ -1444,13 +1527,15 @@ msgstr "E500: msgid "E195: Cannot open viminfo file for reading" msgstr "E195: viminfot@CǍpƂĊJ܂" +msgid "Untitled" +msgstr "" + msgid "E196: No digraphs in this version" msgstr "E196: ̃o[Wɍ͂܂" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: 'Vim' Ŏn܂O :throw ł܂" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "O܂: %s" @@ -1467,7 +1552,6 @@ msgstr " msgid "%s, line %ld" msgstr "%s, s %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Oߑ܂: %s" @@ -1493,7 +1577,6 @@ msgstr " msgid "Error" msgstr "G[" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "" @@ -1536,15 +1619,12 @@ msgstr "E601: :try msgid "E603: :catch without :try" msgstr "E603: :try ̂Ȃ :catch ܂" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :finally ̌ :catch ܂" msgid "E606: :finally without :try" msgstr "E606: :try ̂Ȃ :finally ܂" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: :finally ܂" @@ -1589,6 +1669,9 @@ msgstr " msgid "Input Line" msgstr "͍s" +msgid "Debug Line" +msgstr "fobOs" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar R}h𒴂܂" @@ -1602,13 +1685,13 @@ msgid "Illegal file name" msgstr "sȃt@C" msgid "is a directory" -msgstr " ̓fBNgł" +msgstr "̓fBNgł" msgid "is not a file" -msgstr " ̓t@Cł͂܂" +msgstr "̓t@Cł͂܂" msgid "is a device (disabled with 'opendevice' option)" -msgstr " ̓foCXł ('opendevice' IvVʼnł܂)" +msgstr "̓foCXł ('opendevice' IvVʼnł܂)" msgid "[New File]" msgstr "[Vt@C]" @@ -1620,7 +1703,7 @@ msgid "[File too big]" msgstr "[t@Cߑ]" msgid "[Permission Denied]" -msgstr "[F‚܂]" +msgstr "[܂]" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: *ReadPre autocommand t@CǍs‚ɂ܂" @@ -1634,7 +1717,6 @@ msgstr "Vim: msgid "Reading from stdin..." msgstr "W͂Ǎݒ..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: ϊt@CǍs‚ɂ܂" @@ -1662,12 +1744,6 @@ msgstr "[ msgid "[converted]" msgstr "[ϊ]" -msgid "[blowfish]" -msgstr "[blowfishÍ]" - -msgid "[crypted]" -msgstr "[Í]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[%ld sڂŕϊG[]" @@ -1688,9 +1764,6 @@ msgstr "'charconvert' msgid "can't read output of 'charconvert'" msgstr "'charconvert' ̏o͂Ǎ߂܂ł" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: t@Cm̕@ňÍĂ܂" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwriteobt@̊Yautocommand݂͑܂" @@ -1732,9 +1805,6 @@ msgstr "E509: msgid "E510: Can't make backup file (add ! to override)" msgstr "E510: obNAbvt@C܂ (! ljŋ쐬)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: \\[XtH[N邩܂ (! ljŋ)" - msgid "E214: Can't find temp file for writing" msgstr "E214: ۑpꎞt@C‚܂" @@ -1747,32 +1817,32 @@ msgstr "E166: msgid "E212: Can't open file for writing" msgstr "E212: ݗpɃt@CJ܂" -msgid "E667: Fsync failed" -msgstr "E667: fsync Ɏs܂" +msgid "E949: File changed while writing" +msgstr "E949: ݒɃt@CύX܂" msgid "E512: Close failed" msgstr "E512: ‚邱ƂɎs" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: ݃G[, ϊs (㏑ɂ 'fenc' ɂĂ)" +msgstr "E513: ݃G[Aϊs (㏑ɂ 'fenc' ɂĂ)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: ݃G[, ϊs, s %ld (㏑ɂ 'fenc' ɂĂ" +"E513: ݃G[AϊsAs %ld (㏑ɂ 'fenc' ɂĂ" ")" msgid "E514: write error (file system full?)" -msgstr "E514: ݃G[, (t@CVXet?)" +msgstr "E514: ݃G[ (t@CVXet?)" msgid " CONVERSION ERROR" msgstr " ϊG[" #, c-format msgid " in line %ld;" -msgstr "s %ld;" +msgstr " s %ld;" msgid "[Device]" msgstr "[foCX]" @@ -1843,20 +1913,12 @@ msgstr "1 msgid "%lld characters" msgstr "%lld " -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld " - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[ŏIssS]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "x: Ǎ񂾌Ƀt@CɕύX܂!!!" @@ -1934,11 +1996,16 @@ msgstr "-- msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "autocommand: %s <obt@=%d> Iɍ폜܂" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: ̃O[v͂܂: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: ݂̃O[v͍폜ł܂" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: gp augroup ƂĂ܂" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: * ̌ɕsȕ܂: %s" @@ -1951,7 +2018,6 @@ msgstr "E216: msgid "E216: No such group or event: %s" msgstr "E216: ̂悤ȃO[v̓Cxg͂܂: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2000,8 +2066,9 @@ msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: ݂ 'foldmethod' ł͐܏݂폜ł܂" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld s܏܂܂ " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld s܏܂܂" msgid "E222: Add to read buffer" msgstr "E222: Ǎobt@֒lj" @@ -2048,7 +2115,7 @@ msgid "E230: Cannot read from \"%s\"" msgstr "E230: \"%s\"ǍނƂł܂" msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: LȃtHg‚Ȃ̂, GUIJnł܂" +msgstr "E665: LȃtHg‚Ȃ̂ŁAGUIJnł܂" msgid "E231: 'guifontwide' invalid" msgstr "E231: 'guifontwide' ł" @@ -2061,7 +2128,7 @@ msgid "E254: Cannot allocate color %s" msgstr "E254: %s ̐F蓖Ă܂" msgid "No match at cursor, finding next" -msgstr "J[\\̈ʒuɃ}b`͂܂, Ă܂" +msgstr "J[\\̈ʒuɃ}b`͂܂AĂ܂" msgid "<cannot open> " msgstr "<J܂> " @@ -2094,6 +2161,18 @@ msgstr "Vim msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: bZ[WƃR[obN̂ BalloonEval 쐬ł܂" +msgid "_Cancel" +msgstr "LZ(_C)" + +msgid "_Save" +msgstr "ۑ(_S)" + +msgid "_Open" +msgstr "J(_O)" + +msgid "_OK" +msgstr "_OK" + msgid "" "&Yes\n" "&No\n" @@ -2103,6 +2182,12 @@ msgstr "" "(&N)\n" "LZ(&C)" +msgid "Yes" +msgstr "͂" + +msgid "No" +msgstr "" + msgid "Input _Methods" msgstr "Cvbg\\bh" @@ -2118,41 +2203,38 @@ msgstr " msgid "Replace with:" msgstr "u:" -#. whole word only button msgid "Match whole word only" msgstr "mɊŶ" -#. match case button msgid "Match case" msgstr "啶/ʂ" msgid "Direction" msgstr "" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "" msgid "Down" msgstr "" -#. 'Find Next' button msgid "Find Next" msgstr "" -#. 'Replace' button msgid "Replace" msgstr "u" -#. 'Replace All' button msgid "Replace All" msgstr "SĒu" +msgid "_Close" +msgstr "‚(_C)" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: ZbV}l[W \"die\" v󂯎܂\n" -msgid "Close" -msgstr "‚" +msgid "Close tab" +msgstr "^uy[W‚" msgid "New tab" msgstr "VK^uy[W" @@ -2199,20 +2281,6 @@ msgstr " msgid "&Undo" msgstr "AhD(&U)" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: ^Cg \"%s\" ̃EBhE͌‚܂" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: ̓T|[g܂: \"-%s\"; OLEłgpĂ." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDIAv̒ł̓EBhEJ܂" - -msgid "Close tab" -msgstr "^uy[W‚" - msgid "Open tab..." msgstr "^uy[WJ" @@ -2222,14 +2290,23 @@ msgstr " msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "Eu ('\\' ɂ '\\\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "g܂" msgid "Directory\t*.nothing\n" msgstr "fBNg\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: ^Cg \"%s\" ̃EBhE͌‚܂" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: ̓T|[g܂: \"-%s\"; OLEłgpĂ." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDIAv̒ł̓EBhEJ܂" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "Vim E458: Fw肪Ȃ̂ŃGg蓖Ă܂" @@ -2284,7 +2361,6 @@ msgstr "Vim - msgid "Name:" msgstr "O:" -#. create toggle button msgid "Show size in Points" msgstr "TCY|Cgŕ\\" @@ -2491,6 +2567,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2501,6 +2578,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: ̃V{ɑ΂T\n" " c: ̊֐Ăł֐T\n" " d: ̊֐Ăł֐T\n" " e: egrepp^[T\n" @@ -2528,7 +2606,6 @@ msgstr "E261: cscope msgid "cscope connection %s closed" msgstr "cscopeڑ %s ‚܂" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: cs_manage_matches ŒvIȃG[ł" @@ -2570,6 +2647,13 @@ msgid "" "loaded." msgstr "E815: ̃R}h͖ł. MzScheme Cu[hł܂." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: ̃R}h͖łA߂Ȃ. MzScheme racket/base W[" +"[hł܂ł." + msgid "invalid expression" msgstr "Ȏł" @@ -2621,19 +2705,6 @@ msgstr " msgid "not allowed in the Vim sandbox" msgstr "Th{bNXł͋܂" -#, c-format -msgid "E370: Could not load library %s" -msgstr "E370: Cu %s [hł܂ł" - -msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "" -"̃R}h͖ł, ߂Ȃ: PerlCu[hł܂ł." - -msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -msgstr "" -"E299: Th{bNXł Safe W[gpȂPerlXNvg͋ւ" -"Ă܂" - msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Vimł :py3 g :python g܂" @@ -2641,8 +2712,15 @@ msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." msgstr "" -"E263: ̃R}h͖ł,߂Ȃ: PythonCu[hł܂" -"ł." +"E263: ̃R}h͖łA߂Ȃ: PythonCu[hł܂" +"ł." + +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: ̃R}h͖łA߂Ȃ. Python site W[[h" +"ł܂ł." # Added at 07-Feb-2004. msgid "E659: Cannot invoke Python recursively" @@ -2656,120 +2734,31 @@ msgstr "E265: $_ msgid "" "E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: ̃R}h͖ł,߂Ȃ: RubyCu[hł܂" -"." - -msgid "E267: unexpected return" -msgstr "E267: \\ return ł" - -msgid "E268: unexpected next" -msgstr "E268: \\ next ł" - -msgid "E269: unexpected break" -msgstr "E269: \\ break ł" - -msgid "E270: unexpected redo" -msgstr "E270: \\ redo ł" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: rescue ̊O retry ł" - -msgid "E272: unhandled exception" -msgstr "E272: 舵ȂO܂" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: mlongjmp: %d" - -msgid "Toggle implementation/definition" -msgstr "ƒ`؂ւ" - -msgid "Show base class of" -msgstr "̃NX̊\\" - -msgid "Show overridden member function" -msgstr "I[o[Chꂽo֐\\" - -msgid "Retrieve from file" -msgstr "t@C񕜂" - -msgid "Retrieve from project" -msgstr "vWFNg񕜂" - -msgid "Retrieve from all projects" -msgstr "SẴvWFNg񕜂" - -msgid "Retrieve" -msgstr "" - -msgid "Show source of" -msgstr "̃\\[X\\" - -msgid "Find symbol" -msgstr "‚V{" - -msgid "Browse class" -msgstr "NXQ" - -msgid "Show class in hierarchy" -msgstr "KwŃNX\\" - -msgid "Show class in restricted hierarchy" -msgstr "肳ꂽKwŃNX\\" - -msgid "Xref refers to" -msgstr "Xref ̎QƐ" - -msgid "Xref referred by" -msgstr "Xref QƂ" - -msgid "Xref has a" -msgstr "Xref ̂̂Ă܂" - -msgid "Xref used by" -msgstr "Xref gp" - -msgid "Show docu of" -msgstr "͂̕\\" - -msgid "Generate docu for" -msgstr "͂̕𐶐" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"SNiFF+ɐڑł܂. ‹`FbNĂ(sniffemacs $PATH ɂȂ" -"΂Ȃ܂).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: ǍɃG[܂. ؒf܂" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ ̏Ԃ́u" +msgstr "" +"E266: ̃R}h͖łA߂Ȃ: RubyCu[hł܂" +"ł." -msgid "not " -msgstr "" +msgid "E267: unexpected return" +msgstr "E267: \\ return ł" -msgid "connected" -msgstr "ڑvł" +msgid "E268: unexpected next" +msgstr "E268: \\ next ł" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: m SNiFF+ NGXgł: %s" +msgid "E269: unexpected break" +msgstr "E269: \\ break ł" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+ ւ̐ڑ̃G[ł" +msgid "E270: unexpected redo" +msgstr "E270: \\ redo ł" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ ɐڑĂ܂" +msgid "E271: retry outside of rescue clause" +msgstr "E271: rescue ̊O retry ł" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SNiFF+ obt@܂" +msgid "E272: unhandled exception" +msgstr "E272: 舵ȂO܂" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: ݒɃG[̂Őؒf܂" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: mlongjmp: %d" msgid "invalid buffer number" msgstr "ȃobt@ԍł" @@ -2777,7 +2766,6 @@ msgstr " msgid "not implemented yet" msgstr "܂Ă܂" -#. ??? msgid "cannot set line(s)" msgstr "sݒł܂" @@ -2819,7 +2807,6 @@ msgid "" msgstr "" "R[obNR}ho^ł܂: obt@/EBhEɏ܂" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2834,7 +2821,7 @@ msgstr "" msgid "" "E571: Sorry, this command is disabled: the Tcl library could not be loaded." msgstr "" -"E571: ̃R}h͖ł,߂Ȃ: TclCu[hł܂" +"E571: ̃R}h͖łA߂Ȃ: TclCu[hł܂" "." #, c-format @@ -2845,18 +2832,30 @@ msgid "cannot get line" msgstr "s擾ł܂" msgid "Unable to register a command server name" -msgstr "߃T[o̖Oo^ł܂" +msgstr "߃T[o[̖Oo^ł܂" msgid "E248: Failed to send command to the destination program" msgstr "E248: ړĨvOւ̃R}hMɎs܂" #, c-format msgid "E573: Invalid server id used: %s" -msgstr "E573: ȃT[oIDg܂: %s" +msgstr "E573: ȃT[o[IDg܂: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM ̂̓o^vpeBsł. ܂!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSONɏdL[܂: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Xg^ɃJ}܂: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Xg^̍Ō ']' ܂: %s" + msgid "Unknown option argument" msgstr "m̃IvVł" @@ -2882,14 +2881,14 @@ msgstr "%d msgid "netbeans is not supported with this GUI\n" msgstr "netbeans ͂GUIł͗pł܂\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Vimɂdiff@\\܂(RpCݒ)." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' gps”\\ł: RpCɖɂĂ܂\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Vimɂdiff@\\܂(RpCݒ)." + msgid "Attempt to open script file again: \"" -msgstr "XNvgt@CĂъJĂ݂܂: \"" +msgstr "XNvgt@CĂъJƂ܂: \"" msgid "Cannot open for reading: \"" msgstr "ǍpƂĊJ܂" @@ -2900,13 +2899,15 @@ msgstr " msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: G[: NetBeansgvimX^[gł܂\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: G[: ̃o[WVimCygwin[ł͓삵܂\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: x: [ւ̏o͂ł͂܂\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: x: [̓͂ł͂܂\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "vimrcÕR}hC" @@ -3002,7 +3003,7 @@ msgid "-d\t\t\tDiff mode (like \"vimdiff\")" msgstr "-d\t\t\t[h (\"vidiff\" Ɠ)" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tC[W[[h (\"evim\" Ɠ, [h)" +msgstr "-y\t\t\tC[W[[h (\"evim\" ƓA[h)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\tǍp[h (\"view\" Ɠ)" @@ -3064,6 +3065,12 @@ msgstr "-F\t\t\t msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\t[ <terminal> ɐݒ肷" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\to͂[łȂƂ̌xXLbv" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\to͂[łȂΏI" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t.vimrc̑ <vimrc> g" @@ -3110,16 +3117,16 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tÍꂽt@CҏW" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <display>\tvimw肵 X T[oɐڑ" +msgstr "-display <display>\tvimw肵 X T[o[ɐڑ" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tXT[oɐڑȂ" +msgstr "-X\t\t\tXT[o[ɐڑȂ" msgid "--remote <files>\tEdit <files> in a Vim server if possible" -msgstr "--remote <files>\t”\\ȂVimT[o <files> ҏW" +msgstr "--remote <files>\t”\\ȂVimT[o[ <files> ҏW" msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <files> , T[oĂxo͂Ȃ" +msgstr "--remote-silent <files> AT[o[Ăxo͂Ȃ" msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" @@ -3127,7 +3134,8 @@ msgstr "--remote-wait <files>\t--remote msgid "" "--remote-wait-silent <files> Same, don't complain if there is no server" -msgstr "--remote-wait-silent <files> , T[oĂxo͂Ȃ" +msgstr "" +"--remote-wait-silent <files> AT[o[Ăxo͂Ȃ" msgid "" "--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" @@ -3136,16 +3144,16 @@ msgstr "" "y[WJ" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" -msgstr "--remote-send <keys>\tVimT[o <keys> 𑗐MďI" +msgstr "--remote-send <keys>\tVimT[o[ <keys> 𑗐MďI" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <expr>\tT[o <expr> sČʂ\\" +msgstr "--remote-expr <expr>\tT[o[ <expr> sČʂ\\" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tVimT[öꗗ\\ďI" +msgstr "--serverlist\t\tVimT[o[̈ꗗ\\ďI" msgid "--servername <name>\tSend to/become the Vim server <name>" -msgstr "--servername <name>\tVimT[o <name> ɑM/Oݒ肷" +msgstr "--servername <name>\tVimT[o[ <name> ɑM/Oݒ肷" msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "--startuptime <file>\tNɂԂ̏ڍׂ <file> ֏o͂" @@ -3153,8 +3161,11 @@ msgstr "--startuptime <file>\t msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\t.viminfȏ <viminfo> g" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible'AVim̊AvOCȂAviminfoȂ" + msgid "-h or --help\tPrint Help (this message) and exit" -msgstr "-h or --help\twv(̃bZ[W)\\I" +msgstr "-h or --help\twv(̃bZ[W)\\I" msgid "--version\t\tPrint version information and exit" msgstr "--version\t\to[W\\I" @@ -3251,11 +3262,9 @@ msgstr "--windowid <HWND>\t msgid "No display" msgstr "fBXvC‚܂" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": MɎs܂.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": MɎs܂. [Jł̎s݂Ă܂\n" @@ -3276,7 +3285,6 @@ msgstr " msgid "E283: No marks matching \"%s\"" msgstr "E283: \"%s\" ɊY}[N܂" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3284,7 +3292,6 @@ msgstr "" "\n" "mark s t@C/eLXg" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3292,7 +3299,6 @@ msgstr "" "\n" " jump s t@C/eLXg" -#. Highlight title msgid "" "\n" "change line col text" @@ -3307,7 +3313,6 @@ msgstr "" "\n" "# t@C}[N:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3376,9 +3381,8 @@ msgstr "E298: msgid "E843: Error while updating swap file crypt" msgstr "E843: Xbvt@C̈ÍXVɃG[܂" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: , Xbvt@C܂!!!" +msgstr "E301: ƁAXbvt@C܂!!!" msgid "E302: Could not rename swap file" msgstr "E302: Xbvt@C̖Oς܂" @@ -3463,7 +3467,7 @@ msgid "" "If you entered a new crypt key but did not write the text file," msgstr "" "\n" -"VÍL[͂ƂɃeLXgt@CۑĂȂꍇ," +"VÍL[͂ƂɃeLXgt@CۑĂȂꍇ́A" msgid "" "\n" @@ -3477,7 +3481,7 @@ msgid "" "If you wrote the text file after changing the crypt key press enter" msgstr "" "\n" -"ÍL[ςƂɃeLXgt@Cۑꍇ, eLXgt@C" +"ÍL[ςƂɃeLXgt@Cۑꍇ́AeLXgt@C" msgid "" "\n" @@ -3537,7 +3541,7 @@ msgid "" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(ύX`FbN邽߂, ̃t@Cʂ̖Oŕۑ\n" +"(ύX`FbN邽߂ɁÃt@Cʂ̖Oŕۑ\n" msgid "and run diff with the original file to check for changes)" msgstr "{t@CƂ diff sƗǂł傤)" @@ -3551,13 +3555,12 @@ msgid "" "\n" msgstr "" "\n" -"ꂩ.swpt@C폜Ă\n" +".swpt@C͍폜Ă\\܂\n" "\n" msgid "Using crypt key from swap file for the text file.\n" msgstr "Xbvt@C擾ÍL[eLXgt@CɎg܂.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Xbvt@C‚܂:" @@ -3565,7 +3568,7 @@ msgid " In current directory:\n" msgstr " ݂̃fBNg:\n" msgid " Using specified name:\n" -msgstr " 閼Ogp:\n" +msgstr " ȉ̖Ogp:\n" msgid " In directory " msgstr " fBNg " @@ -3609,7 +3612,7 @@ msgid "" " user name: " msgstr "" "\n" -" [U: " +" [U[: " msgid " host name: " msgstr " zXg: " @@ -3727,21 +3730,17 @@ msgstr " msgid " NEWER than swap file!\n" msgstr " Xbvt@CVł!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) ʂ̃vOt@CҏWĂ邩܂.\n" -" ̏ꍇɂ, ύXۂɍŏII, t@C̈قȂ\n" -" 2‚̃CX^XłĂ܂ƂɒӂĂ." - -msgid " Quit, or continue with caution.\n" -msgstr " I邩, ӂȂ瑱Ă.\n" +" ̏ꍇɂ́AύXĂ܂1‚̃t@Cɑ΂ĈقȂ2‚\n" +" CX^XłĂ܂̂ŁAȂ悤ɋC‚Ă.\n" +" I邩AӂȂ瑱Ă.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) ̃t@C̕ҏWZbVNbV.\n" @@ -3757,7 +3756,7 @@ msgstr "" " gpĕύXJo[܂(\":help recovery\" Q).\n" msgid " If you did this already, delete the swap file \"" -msgstr " ɂsȂ̂Ȃ, Xbvt@C \"" +msgstr " ɂsȂ̂Ȃ΁AXbvt@C \"" msgid "" "\"\n" @@ -3819,7 +3818,6 @@ msgstr "E328: msgid "E329: No menu \"%s\"" msgstr "E329: \"%s\" Ƃj[͂܂" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: j[ł" @@ -3832,8 +3830,6 @@ msgstr "E331: msgid "E332: Separator cannot be part of a menu path" msgstr "E332: ؂̓j[pẌꕔł͂܂" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3844,6 +3840,10 @@ msgstr "" msgid "Tear off this menu" msgstr "̃j[؂" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: %s ɂ̓j[`Ă܂" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: j[pX̓j[ACe𐶂Ȃ΂܂" @@ -3851,10 +3851,6 @@ msgstr "E333: msgid "E334: Menu not found: %s" msgstr "E334: j[‚܂: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: %s ɂ̓j[`Ă܂" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: j[pX̓Tuj[𐶂Ȃ΂܂" @@ -3924,15 +3920,14 @@ msgstr " msgid "Open File dialog" msgstr "t@CǍ_CAO" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: R\\[[hł̓t@CuEUg܂, ߂Ȃ" +msgstr "E338: R\\[[hł̓t@CuEUg܂A߂Ȃ" msgid "E766: Insufficient arguments for printf()" msgstr "E766: printf() ̈s\\ł" msgid "E807: Expected Float argument for printf()" -msgstr "E807: printf() ̈ɂ͕_҂Ă܂" +msgstr "E807: printf() ̈ɂ͕_҂Ă܂" msgid "E767: Too many arguments to printf()" msgstr "E767: printf() ̈߂܂" @@ -3967,13 +3962,6 @@ msgstr " ( msgid "Beep!" msgstr "r[b!" -msgid "Vim: preserving files...\n" -msgstr "Vim: t@Cۑ...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: I܂.\n" - msgid "ERROR: " msgstr "G[: " @@ -4023,15 +4011,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: sȃp[Ze[Wł" -msgid "Enter encryption key: " -msgstr "Íp̃L[͂Ă: " - -msgid "Enter same key again: " -msgstr "xL[͂Ă: " - -msgid "Keys don't match!" -msgstr "L[v܂" - msgid "E854: path too long for completion" msgstr "E854: pX߂ĕ⊮ł܂" @@ -4059,20 +4038,11 @@ msgstr "E346: cdpath msgid "E347: No more file \"%s\" found in path" msgstr "E347: pXɂ͂ȏ \"%s\" Ƃt@C܂" -msgid "Cannot connect to Netbeans #2" -msgstr "Netbeans #2 ɐڑł܂" - -msgid "Cannot connect to Netbeans" -msgstr "Netbeans ɐڑł܂" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: NetBeans̐ڑt@C̃ANZX[hɖ肪܂: \"%s\"" -msgid "read from Netbeans socket" -msgstr "Netbeans ̃\\PbgǍ" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: obt@ %ld NetBeans ڑ܂" @@ -4114,8 +4084,10 @@ msgstr "E662: msgid "E663: At end of changelist" msgstr "E663: ύXXg̖" -msgid "Type :quit<Enter> to exit Vim" -msgstr "VimIɂ :quit<Enter> Ɠ͂Ă" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"ׂĂ̕ύXjAVimIɂ :qa! Ɠ͂ <Enter> Ă" +"" #, c-format msgid "1 line %sed 1 time" @@ -4147,7 +4119,6 @@ msgstr "%ld msgid "E748: No previously used register" msgstr "E748: ܂WX^gpĂ܂" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "Nł܂; Ƃɂ" @@ -4162,25 +4133,30 @@ msgstr "%ld msgid "freeing %ld lines" msgstr "%ld s" -msgid "block of 1 line yanked" -msgstr "1 s̃ubNN܂" +#, c-format +msgid " into \"%c" +msgstr " \"%c " + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "1 s̃ubN%sN܂" -msgid "1 line yanked" -msgstr "1 sN܂" +#, c-format +msgid "1 line yanked%s" +msgstr "1 s%sN܂" #, c-format -msgid "block of %ld lines yanked" -msgstr "%ld s̃ubNN܂" +msgid "block of %ld lines yanked%s" +msgstr "%ld s̃ubN%sN܂" #, c-format -msgid "%ld lines yanked" -msgstr "%ld sN܂" +msgid "%ld lines yanked%s" +msgstr "%ld s%sN܂" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: WX^ %s ɂ͉܂" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4202,37 +4178,41 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: m̃WX^^ %d ł" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "E883: p^[ƎWX^ɂ2sȏ܂߂܂" + #, c-format msgid "%ld Cols; " msgstr "%ld ; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "I %s%ld / %ld s; %ld / %ld P; %ld / %ld oCg" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "I %s%ld / %ld s; %lld / %lld P; %lld / %lld oCg" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr "I %s%ld / %ld s; %ld / %ld P; %ld / %ld ; %ld / %ld oCg" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"I %s%ld / %ld s; %lld / %lld P; %lld / %lld ; %lld / %lld oCg" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr " %s / %s; s %ld of %ld; P %ld / %ld; oCg %ld / %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr " %s / %s; s %ld of %ld; P %lld / %lld; oCg %lld / %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -" %s / %s; s %ld / %ld; P %ld / %ld; %ld / %ld; oCg %ld of %ld" +" %s / %s; s %ld / %ld; P %lld / %lld; %lld / %lld; oCg %lld of " +"%lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld for BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=%N y[W" +msgid "(+%lld for BOM)" +msgstr "(+%lld for BOM)" msgid "Thanks for flying Vim" msgstr "Vim gĂĂ肪Ƃ" @@ -4259,6 +4239,10 @@ msgstr "E522: termcap msgid "E539: Illegal character <%s>" msgstr "E539: sȕł <%s>" +#, c-format +msgid "For option %s" +msgstr "IvV: %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' ɂ͋󕶎ݒł܂" @@ -4280,6 +4264,10 @@ msgstr "E835: 'fillchars' msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: GTK+2 GUIł͕ύXł܂" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: %s %s ̊Ԃŕϊł܂" + msgid "E524: Missing colon" msgstr "E524: R܂" @@ -4337,12 +4325,18 @@ msgstr "E541: msgid "E542: unbalanced groups" msgstr "E542: O[vލ܂" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: s̃Wu[͕ύX”\\ɂł܂" + msgid "E590: A preview window already exists" msgstr "E590: vr[EBhEɑ݂܂" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "" -"W17: ArAɂUTF-8KvȂ̂, ':set encoding=utf-8' Ă" +"W17: ArAɂUTF-8KvȂ̂ŁA':set encoding=utf-8' Ă" + +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24bitF͂̊‹ł̓T|[gĂ܂" #, c-format msgid "E593: Need at least %d lines" @@ -4356,9 +4350,6 @@ msgstr "E594: msgid "E355: Unknown option: %s" msgstr "E355: m̃IvVł: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: Kvł: &%s = '%s'" @@ -4431,7 +4422,6 @@ msgstr " msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: R\\[ł͂Ȃ??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: -f IvVŃVFsł܂" @@ -4453,9 +4443,6 @@ msgstr " msgid "Message" msgstr "bZ[W" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' 80ł͂Ȃ, OR}hsł܂" - msgid "E237: Printer selection failed" msgstr "E237: v^̑IɎs܂" @@ -4480,23 +4467,16 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Zbg \"%s\" ͕sł (tHg \"%s\")" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: '%c' ͕sȕł (tHg \"%s\")" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: 2d̃VOî, I܂\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: vIVOi %s m܂\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: i \"%s\" ͕sł (tHg \"%s\")" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: vIVOim܂\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: '%c' ͕sȕł (tHg \"%s\")" #, c-format msgid "Opening the X display took %ld msec" -msgstr "XT[oւ̐ڑ %ld ~b܂" +msgstr "XT[o[ւ̐ڑ %ld ~b܂" msgid "" "\n" @@ -4525,12 +4505,13 @@ msgstr "" "\n" "ZLeBReLXgݒł܂ " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"VFsł܂ " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "ZLeBReLXg %s %s ɐݒł܂" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "ZLeBReLXg %s %s 擾ł܂. 폜܂!" msgid "" "\n" @@ -4560,6 +4541,13 @@ msgstr "" "\n" "fork ł܂\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"VFsł܂ " + msgid "" "\n" "Command terminated\n" @@ -4602,10 +4590,6 @@ msgstr "VIM msgid "Could not fix up function pointers to the DLL!" msgstr "DLL֐|C^擾ł܂ł" -#, c-format -msgid "shell returned %d" -msgstr "VFR[h %d ŏI܂" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Cxg %s m\n" @@ -4634,6 +4618,13 @@ msgstr "" msgid "Vim Warning" msgstr "Vim̌x" +#, c-format +msgid "shell returned %d" +msgstr "VFR[h %d ŏI܂" + +msgid "E926: Current location list was changed" +msgstr "E926: ݂̃P[VXgύX܂" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: tH[}bg %%%c ߂܂" @@ -4666,6 +4657,12 @@ msgstr "E379: msgid "E553: No more items" msgstr "E553: vf܂" +msgid "E924: Current window was closed" +msgstr "E924: ݂̃EBhE‚܂" + +msgid "E925: Current quickfix was changed" +msgstr "E925: ݂ quickfix ύX܂" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d of %d)%s%s: " @@ -4673,18 +4670,18 @@ msgstr "(%d of %d)%s%s: " msgid " (line deleted)" msgstr " (s폜܂)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s G[ꗗ %d of %d; %d ƒG[" + msgid "E380: At bottom of quickfix stack" msgstr "E380: quickfix X^bN̖ł" msgid "E381: At top of quickfix stack" msgstr "E381: quickfix X^bN̐擪ł" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "G[ꗗ %d of %d; %d ƒG[" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: 'buftype' IvVݒ肳Ă̂ŏ݂܂" +msgid "No entries" +msgstr "Gg܂" msgid "Error file" msgstr "G[t@C" @@ -4711,6 +4708,12 @@ msgstr "E369: msgid "E769: Missing ] after %s[" msgstr "E769: %s[ ̌ ] ܂" +msgid "E944: Reverse range in character class" +msgstr "E944: NX͈̔͂tł" + +msgid "E945: Range too large in character class" +msgstr "E945: NX͈̔͂傫܂" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: %s%%( ނ荇Ă܂" @@ -4740,6 +4743,10 @@ msgstr "E69: %s%%[ msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] ł" +# +msgid "E65: Illegal back reference" +msgstr "E65: sȌQƂł" + msgid "E339: Pattern too long" msgstr "E339: p^[߂܂" @@ -4777,10 +4784,6 @@ msgstr "E63: \\_ msgid "E64: %s%c follows nothing" msgstr "E64:%s%c ̌ɂȂɂ܂" -# -msgid "E65: Illegal back reference" -msgstr "E65: sȌQƂł" - # msgid "E68: Invalid character after \\z" msgstr "E68: \\z ̌ɕsȕ܂" @@ -4802,29 +4805,43 @@ msgstr "E554: %s{...} msgid "External submatches:\n" msgstr "O̕Y:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA K\\) JԂ܂ %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= ɂ 0, 1 2 ݂̂܂B" -"K\\GW͎I܂B" +"E864: \\%#= ɂ 0, 1 2 ݂̂܂BK\\GW͎I" +"܂B" + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "̃p^[ɃobNgbLO RE GWKp܂: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) ҂葁K\\̏I[ɓB܂" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA K\\) ʒuĂ܂: %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) ҂葁K\\̏I[ɓB܂" +# +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA K\\) ȕNX: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) m̃Iy[^ł: '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% l߂܂" + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (NFA) m̃Iy[^ł: '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: NX܂NFA\\zɎs܂!" @@ -4835,11 +4852,9 @@ msgstr "E869: (NFA) msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (NFA K\\) JԂ̐񐔂ǍɃG[" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (NFA K\\) JԂ ̌ JԂ ͂ł܂!" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (NFA K\\) '(' ߂܂" @@ -4856,8 +4871,8 @@ msgid "" "E875: (NFA regexp) (While converting from postfix to NFA), too many states " "left on stack" msgstr "" -"E875: (NFA K\\) (uNFAɕϊ) " -"X^bNɎcꂽXe[g߂܂" +"E875: (NFA K\\) (uNFAɕϊ) X^bNɎcꂽXe[g" +"߂܂" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (NFA K\\) NFAŜۑɂ͋󂫃Xy[X܂" @@ -4867,8 +4882,9 @@ msgstr "E878: (NFA) msgid "" "Could not open temporary log file for writing, displaying on stderr ... " -msgstr "NFAK\\GWp̃Ot@CpƂĊJ܂B" -"O͕Wo͂ɏo͂܂B" +msgstr "" +"NFAK\\GWp̃Ot@CpƂĊJ܂BO͕Wo͂" +"o͂܂B" #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -4904,9 +4920,6 @@ msgstr " msgid " Arabic" msgstr " ArA" -msgid " (lang)" -msgstr " ()" - msgid " (paste)" msgstr " (\\t)" @@ -4949,7 +4962,6 @@ msgstr "E386: ';' msgid " (includes previously listed match)" msgstr " (Oɗ񋓂Yӏ܂)" -#. cursor at status line msgid "--- Included files " msgstr "--- CN[hꂽt@C " @@ -5001,8 +5013,47 @@ msgstr "" "# Ō %sp^[:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Xyt@C̏G[ł" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Xy`FbN͖Ă܂" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"x: PꃊXg \"%s_%s.spl\" \"%s_ascii.spl\" ͌‚܂" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"x: PꃊXg \"%s.%s.spl\" \"%s.ascii.spl\" ͌‚܂" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: autocommand SpellFileMissing obt@폜܂" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "x9: %s Ƃ͈͂̓T|[gĂ܂" + +msgid "Sorry, no suggestions" +msgstr "cOłAC͂܂" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "cOłAC %ld ‚܂" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "\"%.*s\" ֕ϊ:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Xyu܂sĂ܂" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: ‚܂: %s" msgid "E758: Truncated spell file" msgstr "E758: Xyt@C؎Ă悤ł" @@ -5025,19 +5076,6 @@ msgstr "E762: FOL, LOW msgid "Compressing word tree..." msgstr "Pc[kĂ܂..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Xy`FbN͖Ă܂" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -"x: PꃊXg \"%s_%s.spl\" \"%s_ascii.spl\" ͌‚܂" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"x: PꃊXg \"%s.%s.spl\" \"%s.ascii.spl\" ͌‚܂" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Xyt@C \"%s\" Ǎ" @@ -5046,7 +5084,7 @@ msgid "E757: This does not look like a spell file" msgstr "E757: Xyt@Cł͂Ȃ悤ł" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: ÂXyt@CȂ̂, Abvf[gĂ" +msgstr "E771: ÂXyt@CȂ̂ŁAAbvf[gĂ" msgid "E772: Spell file is for newer version of Vim" msgstr "E772: Vo[W Vim p̃Xyt@Cł" @@ -5055,8 +5093,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Xyt@CɃT|[gĂȂZNV܂" #, c-format -msgid "Warning: region %s not supported" -msgstr "x9: %s Ƃ͈͂̓T|[gĂ܂" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug t@Cł͂Ȃ悤ł: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779:  .sug t@CȂ̂ŁAAbvf[gĂ: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Vo[W Vim p .sug t@Cł: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug t@C .spl t@Cƈv܂: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug t@C̓ǍɃG[܂: %s" #, c-format msgid "Reading affix file %s ..." @@ -5204,8 +5258,8 @@ msgid "E760: No word count in %s" msgstr "E760: %s ɂ͒Pꐔ܂" #, c-format -msgid "line %6d, word %6d - %s" -msgstr "s %6d, P %6d - %s" +msgid "line %6d, word %6ld - %s" +msgstr "s %6d, P %6ld - %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5241,7 +5295,7 @@ msgstr "%s #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "%s %d s, ͈͎w肪߂܂: %s" +msgstr "%s %d sځA͈͎w肪߂܂: %s" #, c-format msgid "/ line ignored in %s line %d: %s" @@ -5269,10 +5323,6 @@ msgstr " msgid "Reading back spell file..." msgstr "Xyt@CtǍ" -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "􍞂݂s..." @@ -5295,8 +5345,9 @@ msgstr " msgid "E751: Output file name must not have region name" msgstr "E751: o̓t@Cɂ͔͈͖܂߂܂" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: ͈͂ 8 ‚܂łT|[gĂ܂" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: ͈͂ %ld ‚܂łT|[gĂ܂" #, c-format msgid "E755: Invalid region in %s" @@ -5317,72 +5368,50 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' ɂ %ld ‚̃Gg͂܂" #, c-format -msgid "Word removed from %s" -msgstr "%s Pꂪ폜܂" +msgid "Word '%.*s' removed from %s" +msgstr "P '%.*s' %s 폜܂" #, c-format -msgid "Word added to %s" -msgstr "%s ɒPꂪlj܂" +msgid "Word '%.*s' added to %s" +msgstr "P '%.*s' %s ֒lj܂" msgid "E763: Word characters differ between spell files" msgstr "E763: P̕Xyt@CƈقȂ܂" -msgid "Sorry, no suggestions" -msgstr "cOł, C͂܂" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "cOł, C %ld ‚܂" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "\"%.*s\" ֕ϊ:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: Xyu܂sĂ܂" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: ‚܂: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug t@Cł͂Ȃ悤ł: %s" - -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779:  .sug t@CȂ̂, Abvf[gĂ: %s" - -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Vo[W Vim p .sug t@Cł: %s" - -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug t@C .spl t@Cƈv܂: %s" - -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug t@C̓ǍɃG[܂: %s" - -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: MAP Ggɏd݂܂" msgid "No Syntax items defined for this buffer" msgstr "̃obt@ɒ`ꂽ\\vf͂܂" +msgid "syntax conceal on" +msgstr "\\ conceal ͌ on ł" + +msgid "syntax conceal off" +msgstr "\\ conceal ͌ off ł" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: sȈł: %s" +msgid "syntax case ignore" +msgstr "\\̑啶͌ ignore ł" + +msgid "syntax case match" +msgstr "\\̑啶͌ match ł" + +msgid "syntax spell toplevel" +msgstr "\\ spell ͌ toplevel ł" + +msgid "syntax spell notoplevel" +msgstr "\\ spell ͌ notoplevel ł" + +msgid "syntax spell default" +msgstr "\\ spell ͌ default ł" + +msgid "syntax iskeyword " +msgstr "\\p iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: ̂悤ȍ\\NX^͂܂: %s" @@ -5459,6 +5488,10 @@ msgstr "E847: msgid "E789: Missing ']': %s" msgstr "E789: ']' ܂: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']' ̌ɗ]ȕ܂: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' ܂: %s" @@ -5541,7 +5574,7 @@ msgstr "E415: #, c-format msgid "E416: missing equal sign: %s" -msgstr "E416: ܂: %s" +msgstr "E416: ܂: %s" #, c-format msgid "E417: missing argument: %s" @@ -5588,7 +5621,7 @@ msgid "E556: at top of tag stack" msgstr "E556: ^OX^bN̐擪ł" msgid "E425: Cannot go before first matching tag" -msgstr "E425: ŏ̊Y^O𒴂Ė߂邱Ƃ͂ł܂" +msgstr "E425: ŏ̊Y^OzĖ߂邱Ƃ͂ł܂" #, c-format msgid "E426: tag not found: %s" @@ -5604,13 +5637,12 @@ msgid "E427: There is only one matching tag" msgstr "E427: Y^O1‚܂" msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: ŌɊY^O𒴂ĐiނƂ͂ł܂" +msgstr "E428: Ō̊Y^OzĐiނƂ͂ł܂" #, c-format msgid "File \"%s\" does not exist" msgstr "t@C \"%s\" ܂" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "^O %d (S%d%s)" @@ -5625,7 +5657,6 @@ msgstr " msgid "E429: File \"%s\" does not exist" msgstr "E429: t@C \"%s\" ܂" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5656,7 +5687,6 @@ msgstr " msgid "E432: Tags file not sorted: %s" msgstr "E432: ^Ot@C\\[gĂ܂: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: ^Ot@C܂" @@ -5692,7 +5722,6 @@ msgstr "E436: termcap msgid "E437: terminal capability \"cm\" required" msgstr "E437: [ \"cm\" @\\Kvł" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5700,6 +5729,35 @@ msgstr "" "\n" "--- [L[ ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txtJ܂" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "\"%s\" ̃WuI܂?" + +msgid "Terminal" +msgstr "[" + +msgid "Terminal-finished" +msgstr "[ (I)" + +msgid "active" +msgstr "ANeBu" + +msgid "running" +msgstr "s" + +msgid "finished" +msgstr "I" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: t@C͊ɑ݂܂: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: [obt@ł͂܂" + msgid "new shell started\n" msgstr "VVFN܂\n" @@ -5709,12 +5767,9 @@ msgstr "Vim: msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "̑Ï̂CUT_BUFFER0gp܂" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: \\sJEgς܂" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: \\sJEgς܂" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "”\\ȃAhD͂܂: Ƃ肠܂" @@ -5847,13 +5902,133 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: AhDs܂" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16/32 rbg GUI " +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: ֐ %s ͒`ςłAĒ`ɂ ! ljĂ" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: ^ɃGgɑ݂܂" + +msgid "E718: Funcref required" +msgstr "E718: ֐Qƌ^v܂" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: m̊֐ł: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: sȈł: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: dĂ܂: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: ֐̈߂܂: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: ֐̖Ȉł: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: ֐ďo̓q 'maxfuncdepth' 𒴂܂" + +#, c-format +msgid "calling %s" +msgstr "%s sł" + +#, c-format +msgid "%s aborted" +msgstr "%s f܂" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s #%ld Ԃ܂" + +#, c-format +msgid "%s returning %s" +msgstr "%s %s Ԃ܂" + +msgid "E699: Too many arguments" +msgstr "E699: ߂܂" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: m̊֐ł: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: ֐͍폜܂: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: ֐̈܂: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: XNvgȊO<SID>g܂: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: p֐Ă΂܂܂: %s" + +msgid "E129: Function name required" +msgstr "E129: ֐v܂" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: ֐͑啶 \"s:\" Ŏn܂Ȃ΂Ȃ܂: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: ֐ɂ̓R͊܂߂܂: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: `̊֐ł: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(' ܂: %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: ł g: ͎g܂" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: N[W[֐̓gbvxɋLqł܂: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction ܂" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction ̌ɕ܂: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: ֐ϐƏՓ˂܂: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: ֐ %s Ē`ł܂: gpł" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: ֐XNvg̃t@Cƈv܂: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: ֐ %s 폜ł܂: gpł" + +msgid "E133: :return not inside a function" +msgstr "E133: ֐O :return ܂" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: JbR '(' ܂: %s" msgid "" "\n" @@ -5869,9 +6044,6 @@ msgstr "" "\n" "MS-Windows 32 rbg GUI " -msgid " in Win32s mode" -msgstr " in Win32s [h" - msgid " with OLE support" msgstr " with OLE T|[g" @@ -5891,45 +6063,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16 rbg " - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32 rbg MS-DOS " - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16 rbg MS-DOS " - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"MacOS X (unix) " - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"MacOS X " +"macOS " msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"MacOS " +"macOS (darwin )" msgid "" "\n" @@ -6003,6 +6147,9 @@ msgstr "" msgid "without GUI." msgstr "without GUI." +msgid "with GTK3 GUI." +msgstr "with GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "with GTK2-GNOME GUI." @@ -6030,9 +6177,6 @@ msgstr "with Carbon GUI." msgid "with Cocoa GUI." msgstr "with Cocoa GUI." -msgid "with (classic) GUI." -msgstr "with (NVbN) GUI." - msgid " Features included (+) or not (-):\n" msgstr " @\\̈ꗗ L(+)/(-)\n" @@ -6040,31 +6184,34 @@ msgid " system vimrc file: \"" msgstr " VXe vimrc: \"" msgid " user vimrc file: \"" -msgstr " [U vimrc: \"" +msgstr " [U[ vimrc: \"" msgid " 2nd user vimrc file: \"" -msgstr " 2[U vimrc: \"" +msgstr " 2[U[ vimrc: \"" msgid " 3rd user vimrc file: \"" -msgstr " 3[U vimrc: \"" +msgstr " 3[U[ vimrc: \"" msgid " user exrc file: \"" -msgstr " [U exrc: \"" +msgstr " [U[ exrc: \"" msgid " 2nd user exrc file: \"" -msgstr " 2[U exrc: \"" +msgstr " 2[U[ exrc: \"" msgid " system gvimrc file: \"" msgstr " VXe gvimrc: \"" msgid " user gvimrc file: \"" -msgstr " [U gvimrc: \"" +msgstr " [U[ gvimrc: \"" msgid "2nd user gvimrc file: \"" -msgstr " 2[U gvimrc: \"" +msgstr " 2[U[ gvimrc: \"" msgid "3rd user gvimrc file: \"" -msgstr " 3[U gvimrc: \"" +msgstr " 3[U[ gvimrc: \"" + +msgid " defaults file: \"" +msgstr " ftHgt@C: \"" msgid " system menu file: \"" msgstr " VXej[: \"" @@ -6111,8 +6258,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr "ICwv :help<Enter> <F1> " -msgid "type :help version7<Enter> for version info" -msgstr "o[W :help version7<Enter> " +msgid "type :help version8<Enter> for version info" +msgstr "o[W :help version8<Enter> " msgid "Running in Vi compatible mode" msgstr "Vi݊[hœ쒆" @@ -6124,19 +6271,19 @@ msgid "type :help cp-default<Enter> for info on this" msgstr "ڍׂȏ :help cp-default<Enter>" msgid "menu Help->Orphans for information " -msgstr "ڍׂ̓j[ wvǎ QƂĉ " +msgstr "ڍׂ̓j[ wv->ǎ QƂĉ " msgid "Running modeless, typed text is inserted" -msgstr "[hŎs, ^Cv}܂" +msgstr "[hŎsB^Cv}܂" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "j[ ҏWS̐ݒ聨}(S)[hؑ " +msgstr "j[ ҏW->S̐ݒ->}(S)[hؑ " msgid " for two modes " msgstr " Ń[hL " msgid "menu Edit->Global Settings->Toggle Vi Compatible" -msgstr "j[ ҏWS̐ݒ聨Vi݊[hؑ " +msgstr "j[ ҏW->S̐ݒ->Vi݊[hؑ " msgid " for Vim defaults " msgstr " VimƂē " @@ -6145,7 +6292,7 @@ msgid "Sponsor Vim development!" msgstr "Vim̊JĂ!" msgid "Become a registered Vim user!" -msgstr "Vim̓o^[UɂȂĂ!" +msgstr "Vim̓o^[U[ɂȂĂ!" msgid "type :help sponsor<Enter> for information " msgstr "ڍׂȏ :help sponsor<Enter> " @@ -6154,13 +6301,7 @@ msgid "type :help register<Enter> for information " msgstr "ڍׂȏ :help register<Enter> " msgid "menu Help->Sponsor/Register for information " -msgstr "ڍׂ̓j[ wvX|T[/o^ QƂĉ " - -msgid "WARNING: Windows 95/98/ME detected" -msgstr " x: Windows 95/98/Me o " - -msgid "type :help windows95<Enter> for info on this" -msgstr " ڍׂȏ :help windows95<Enter> " +msgstr "ڍׂ̓j[ wv->X|T[/o^ QƂĉ" msgid "Already only one window" msgstr "ɃEBhE1‚܂" @@ -6193,6 +6334,38 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: pathɂ \"%s\" Ƃt@C܂" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID: %ld (1 ȏłȂ΂Ȃ܂)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID ͂łɗpł: %ld" + +msgid "List or number required" +msgstr "XglKvł" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID: %ld (1 ȏłȂ΂Ȃ܂)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID ͂܂: %ld" + +#, c-format +msgid "E370: Could not load library %s" +msgstr "E370: Cu %s [hł܂ł" + +msgid "Sorry, this command is disabled: the Perl library could not be loaded." +msgstr "" +"̃R}h͖łA߂Ȃ: PerlCu[hł܂ł." + +msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" +msgstr "" +"E299: Th{bNXł Safe W[gpȂPerlXNvg͋ւ" +"Ă܂" + msgid "Edit with &multiple Vims" msgstr "VimŕҏW (&M)" @@ -6205,7 +6378,6 @@ msgstr "Vim msgid "Edit with &Vim" msgstr "VimŕҏW (&V)" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "NςVimŕҏW - " @@ -6219,15 +6391,11 @@ msgid "gvimext.dll error" msgstr "gvimext.dll G[" msgid "Path length too long!" -msgstr "pX܂!" +msgstr "pX߂܂!" msgid "--No lines in buffer--" msgstr "--obt@ɍs܂--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: R}hf܂" @@ -6283,6 +6451,10 @@ msgstr "E236: msgid "E473: Internal error" msgstr "E473: G[ł" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: G[ł: %s" + msgid "Interrupted" msgstr "܂܂" @@ -6296,6 +6468,14 @@ msgstr "E474: msgid "E475: Invalid argument: %s" msgstr "E475: Ȉł: %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: %s ɑ΂ĖȒlł" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: %s ɑ΂ĖȒlł: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Ȏł: %s" @@ -6314,6 +6494,9 @@ msgstr "E17: \"%s\" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: \"%s\"() ̃CuďoɎs܂" +msgid "E667: Fsync failed" +msgstr "E667: fsync Ɏs܂" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Ců֐ %s [hł܂ł" @@ -6325,7 +6508,7 @@ msgid "E20: Mark not set" msgstr "E20: }[N͐ݒ肳Ă܂" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: 'modifiable' ItȂ̂, ύXł܂" +msgstr "E21: 'modifiable' ItȂ̂ŁAύXł܂" msgid "E22: Scripts nested too deep" msgstr "E22: XNvg̓q[߂܂" @@ -6391,7 +6574,7 @@ msgstr "E36: #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "E247: %s ƂO̓o^ꂽT[o͂܂" +msgstr "E247: %s ƂO̓o^ꂽT[o[͂܂" #, c-format msgid "E482: Can't create file %s" @@ -6408,9 +6591,6 @@ msgstr "E484: msgid "E485: Can't read file %s" msgstr "E485: t@C %s Ǎ߂܂" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Ō̕ύXۑĂ܂ (! ljŕύXj)" - msgid "E38: Null argument" msgstr "E38: ł" @@ -6444,7 +6624,7 @@ msgid "E42: No Errors" msgstr "E42: G[͂܂" msgid "E776: No location list" -msgstr "E776: ꏊXg͂܂" +msgstr "E776: P[VXg͂܂" msgid "E43: Damaged match string" msgstr "E43: Y񂪔jĂ܂" @@ -6463,6 +6643,31 @@ msgstr "E46: msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: Th{bNXł͕ϐ \"%s\" ɒlݒł܂" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: ^ɋ̃L[gƂ͂ł܂" + +msgid "E715: Dictionary required" +msgstr "E715: ^Kvł" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Xg̃CfbNX͈͊Oł: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: ֐̈߂܂: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: ^ɃL[݂܂: %s" + +msgid "E714: List required" +msgstr "E714: Xg^Kvł" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s ̈̓Xg^܂͎^łȂ΂Ȃ܂" + msgid "E47: Error while reading errorfile" msgstr "E47: G[t@C̓ǍɃG[܂" @@ -6520,8 +6725,8 @@ msgstr "E592: 'winwidth' msgid "E80: Error while writing" msgstr "E80: ݒ̃G[" -msgid "Zero count" -msgstr "[JEg" +msgid "E939: Positive count required" +msgstr "E939: ̃JEgKvł" msgid "E81: Using <SID> not in a script context" msgstr "E81: XNvgȊO<SID>g܂" @@ -6530,21 +6735,21 @@ msgid "E449: Invalid expression received" msgstr "E449: Ȏ󂯎܂" msgid "E463: Region is guarded, cannot modify" -msgstr "E463: ̈悪ی삳Ă̂, ύXł܂" +msgstr "E463: ̈悪ی삳Ă̂ŁAύXł܂" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans ͓Ǎpt@CύX邱Ƃ܂" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: G[ł: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: p^[ 'maxmempattern' ȏ̃gp܂" msgid "E749: empty buffer" msgstr "E749: obt@ł" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: obt@ %ld ͂܂" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: p^[؂Lsł" @@ -6558,6 +6763,13 @@ msgstr "E764: msgid "E850: Invalid register name" msgstr "E850: ȃWX^ł" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: fBNg '%s' ̒ɂ܂: \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: AutocommandċAN܂" + msgid "search hit TOP, continuing at BOTTOM" msgstr "܂Ō̂ʼnɖ߂܂" @@ -6608,7 +6820,7 @@ msgstr "C msgid "value is too small to fit into C int type" msgstr "C int ^ƂĂ͒l߂܂" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr "l 0 傫Ȃ΂Ȃ܂" msgid "number must be greater or equal to zero" @@ -6629,11 +6841,11 @@ msgstr " #, c-format msgid "expected 3-tuple as imp.find_module() result, but got %s" -msgstr "imp.find_module() %s Ԃ܂ (Ғl: 2 vf̃^v)" +msgstr "imp.find_module() %s Ԃ܂ (Ғl: 3 vf̃^v)" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" -msgstr "impl.find_module() %d vf̃^vԂ܂ (Ғl: 2)" +msgstr "imp.find_module() %d vf̃^vԂ܂ (Ғl: 3)" msgid "internal error: imp.find_module returned tuple with NULL" msgstr "G[: imp.find_module NULL ܂ރ^vԂ܂" @@ -6661,21 +6873,34 @@ msgstr " msgid "list index out of range" msgstr "Xg͈͊ÕCfbNXł" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr "G[: vim̃Xgvf %d ̎擾Ɏs܂" -msgid "failed to add item to list" -msgstr "Xgւ̗vfljɎs܂" +msgid "slice step cannot be zero" +msgstr "XCX̃Xebv 0 ͎wł܂" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr " %d ̊gXCXɁA蒷XCX蓖Ă悤Ƃ܂" #, c-format msgid "internal error: no vim list item %d" msgstr "G[: vim̃Xgvf %d ͂܂" +msgid "internal error: not enough list items" +msgstr "G[: Xgɏ\\ȗvf܂" + msgid "internal error: failed to add item to list" msgstr "G[: Xgւ̗vfljɎs܂" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr " %d ̃XCX %d ̊gXCXɊ蓖Ă悤Ƃ܂" + +msgid "failed to add item to list" +msgstr "Xgւ̗vfljɎs܂" + msgid "cannot delete vim.List attributes" msgstr "vim.List ͏܂" @@ -6690,9 +6915,6 @@ msgstr " msgid "function %s does not exist" msgstr "֐ %s ܂" -msgid "function constructor does not accept keyword arguments" -msgstr "֐̃RXgN^̓L[[h󂯕t܂" - #, c-format msgid "failed to run function %s" msgstr "֐ %s ̎sɎs܂" @@ -6779,6 +7001,10 @@ msgstr "E859: msgid "unable to convert %s to vim dictionary" msgstr "%s vim̎^ɕϊł܂" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s vim̃Xgɕϊł܂" + #, c-format msgid "unable to convert %s to vim structure" msgstr "%s vim̍\\̂ɕϊł܂" @@ -6806,3 +7032,47 @@ msgid "" msgstr "" "pX̐ݒɎs܂: sys.path Xgł͂܂\n" " vim.VIM_SPECIAL_PATH sys.path ɒljĂ" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Vim}Nt@C (*.vim)\t*.vim\n" +"ׂẴt@C (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "ׂẴt@C (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"ׂẴt@C (*.*)\t*.*\n" +"C\\[X (*.c, *.h)\t*.c;*.h\n" +"C++\\[X (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VBR[h (*.bas, *.frm)\t*.bas;*.frm\n" +"Vimt@C (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim }Nt@C (*.vim)\t*.vim\n" +"ׂẴt@C (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "ׂẴt@C (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"ׂẴt@C (*)\t*\n" +"C\\[X (*.c, *.h)\t*.c;*.h\n" +"C++\\[X (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vimt@C (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/ko.UTF-8.po b/src/po/ko.UTF-8.po index 984cfa0749..1aeecd23ab 100644 --- a/src/po/ko.UTF-8.po +++ b/src/po/ko.UTF-8.po @@ -4,12 +4,12 @@ # msgid "" msgstr "" -"Project-Id-Version: vim 7.3\n" +"Project-Id-Version: vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-16 16:18+0900\n" -"PO-Revision-Date: 2010-02-18 09:49+0900\n" +"POT-Creation-Date: 2017-07-12 14:52+0900\n" +"PO-Revision-Date: 2017-07-12 18:56+0900\n" "Last-Translator: SungHyun Nam <goweol@gmail.com>\n" -"Language-Team: GTP Korean <gnome-kr-translation@gnome.or.kr>\n" +"Language-Team: GTP Korean\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,12 +35,21 @@ msgstr "[위치 목록]" msgid "[Quickfix List]" msgstr "[Quickfix 목록]" +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Autocommand로 명령이 중단되었습니다" + msgid "E82: Cannot allocate any buffer, exiting..." msgstr "E82: 버퍼를 할당할 수 없어서 끝냅니다..." msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: 버퍼를 할당할 수 없어서 다른 걸 사용합니다..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: 버퍼를 등록하지 못했습니다" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: 사용중인 버퍼를 삭제하려고 했습니다" + msgid "E515: No buffers were unloaded" msgstr "E515: 내려진 버퍼가 없습니다" @@ -71,6 +80,9 @@ msgstr "버퍼 한 개가 완전히 지워졌습니다" msgid "%d buffers wiped out" msgstr "버퍼 %d개가 완전히 지워졌습니다" +msgid "E90: Cannot unload last buffer" +msgstr "E90: 마지막 버퍼를 내릴 수 없습니다" + msgid "E84: No modified buffer found" msgstr "E84: 바뀐 버퍼를 찾을 수 없습니다" @@ -78,10 +90,6 @@ msgstr "E84: 바뀐 버퍼를 찾을 수 없습니다" msgid "E85: There is no listed buffer" msgstr "E85: 나열된 버퍼가 없습니다" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: 버퍼 %ld이(가) 존재하지 않습니다" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: 마지막 버퍼입니다" @@ -94,9 +102,6 @@ msgstr "" "E89: 버퍼 %ld을(를) 마지막으로 고친 뒤 저장하지 않았습니다 (덮어쓰려면 ! 더하" "기)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: 마지막 버퍼를 내릴 수 없습니다" - msgid "W14: Warning: List of file names overflow" msgstr "W14: 경고: 파일 이름 목록이 넘쳤습니다" @@ -131,6 +136,9 @@ msgstr "[새 파일]" msgid "[Read errors]" msgstr "[읽기 에러]" +msgid "[RO]" +msgstr "[읽기 전용]" + msgid "[readonly]" msgstr "[읽기 전용]" @@ -193,9 +201,100 @@ msgstr "%s에 대한 기호:" msgid " line=%ld id=%d name=%s" msgstr " 줄=%ld id=%d 이름=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: 포트로 연결할 수 없습니다" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: channel_open()에서 gethostbyname()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: channel_open()에서 socket()" + +msgid "E903: received command with non-string argument" +msgstr "E903: 문자열이 아닌 인자를 명령으로 수신했습니다" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: expr/call의 마지막 인자는 숫자여야 합니다" + +msgid "E904: third argument for call must be a list" +msgstr "E904: 3번째 인자는 list여야 합니다" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: 모르는 명령 수신: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): 연결되지 않았는 데 쓰기" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): 쓰기가 실패했습니다" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s()에는 callback을 사용할 수 없습니다" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: raw 혹은 nl 채널에서 ch_evalexpr()/ch_sendexpr()을 사용할 수 없습니다" + +msgid "E906: not an open channel" +msgstr "E906: 열린 채널이 아닙니다" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io 파일은 설정하려면 _name이 필요합니다" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io 버퍼는 설정하려면 in_buf나 in_name이 필요합니다" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: %ld개 이상의 버퍼에 대해서는 diff를 할 수 없습니다" +msgid "E918: buffer must be loaded: %s" +msgstr "E918: 버퍼가 로딩되어야 합니다: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: 파일이 모르는 방법으로 암호화되어 있습니다" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "경고: 약한 암호 방식을 사용중; :help 'cm'을 확인하세요" + +msgid "Enter encryption key: " +msgstr "암호 키 입력: " + +msgid "Enter same key again: " +msgstr "같은 키를 다시 입력: " + +msgid "Keys don't match!" +msgstr "키가 맞지 않습니다!" + +msgid "[crypted]" +msgstr "[암호화 되었습니다]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Dictionary에 콜론 누락: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Dictionary에 중복된 키: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Dictionary에 콤마 누락: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Dictionary 끝에 '}' 누락: %s" + +msgid "extend() argument" +msgstr "extend() 인자" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: 키가 이미 존재함: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: 버퍼를 %ld개 이상은 비교할 수 없습니다" msgid "E810: Cannot read or write temp files" msgstr "E810: 임시 파일을 읽거나 쓸 수 없습니다" @@ -323,6 +422,9 @@ msgstr "찾는 중: %s" msgid "Scanning tags." msgstr "태그 찾는 중." +#~ msgid "match in file" +#~ msgstr "" + msgid " Adding" msgstr " 더하기" @@ -350,13 +452,10 @@ msgstr "match %d of %d" msgid "match %d" msgstr "match %d" +#. maximum nesting of lists and dicts msgid "E18: Unexpected characters in :let" msgstr "E18: ':let'에 모르는 글자" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: 목록 번호가 범위를 벗어남: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: 정의 안 된 변수: %s" @@ -364,41 +463,6 @@ msgstr "E121: 정의 안 된 변수: %s" msgid "E111: Missing ']'" msgstr "E111: ']'이 없습니다" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s 인자는 List이어야 합니다" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s 인자는 List 혹은 Dictionary여야 합니다" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Dictionary에 빈 키를 쓸 수 없습니다" - -msgid "E714: List required" -msgstr "E714: List가 필요합니다" - -msgid "E715: Dictionary required" -msgstr "E715: Dictionary가 필요합니다" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: 함수에 너무 많은 인자 넘김: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Dictionary에 키가 없음: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: 함수 %s이(가) 이미 있습니다, 바꾸려면 !을 더하세요" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: 이미 Dictionary 항목이 있습니다" - -msgid "E718: Funcref required" -msgstr "E718: Funcref가 필요합니다" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Dictionary에 [:]을 사용할 수 없습니다" @@ -406,14 +470,13 @@ msgstr "E719: Dictionary에 [:]을 사용할 수 없습니다" msgid "E734: Wrong variable type for %s=" msgstr "E734: %s=에 대한 잘못된 변수형" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: 모르는 함수: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: 비정상적인 변수 명: %s" +msgid "E806: using Float as a String" +msgstr "E806: Float를 String으로 사용" + msgid "E687: Less targets than List items" msgstr "E687: List 항목보다 적은 대상" @@ -445,14 +508,16 @@ msgstr "E711: List 값이 충분한 항목을 가지고 있지 않습니다" msgid "E690: Missing \"in\" after :for" msgstr "E690: :for 뒤에 \"in\"가 없습니다" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: 괄호 없음: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: 이런 변수 없음: \"%s\"" +#. For historic reasons this error is not given for a list or dict. +#. * E.g., the b: dict could be locked/unlocked. +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: 변수 %s을(를) 잠금 혹은 해제할 수 없습니다" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: 잠금(해제)하기에 변수가 너무 깊이 중첩되었습니다" @@ -471,9 +536,6 @@ msgstr "E735: Dictionary는 Dictionary와만 비교할 수 있습니다" msgid "E736: Invalid operation for Dictionary" msgstr "E736: Dictionary에 대한 잘못된 동작" -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Funcref는 Funcref와만 비교할 수 있습니다" - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Funcrefs에 대한 잘못된 동작" @@ -486,6 +548,9 @@ msgstr "E110: ')'가 없습니다" msgid "E695: Cannot index a Funcref" msgstr "E695: Funcref를 색인할 수 없습니다" +msgid "E909: Cannot index a special variable" +msgstr "E909: 특수한 변수는 색인할 수 없습니다" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: 옵션 이름 없음: %s" @@ -502,62 +567,121 @@ msgstr "E114: 따옴표 없음: %s" msgid "E115: Missing quote: %s" msgstr "E115: 따옴표 없음: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: List에 콤마 누락: %s" +#~ msgid "Not enough memory to set references, garbage collection aborted!" +#~ msgstr "" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: List 끝에 ']' 누락: %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: 변수가 표시하기에 너무 깊이 중첩되었습니다" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Dictionary에 콜론 누락: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float를 Number로 사용" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Dictionary에 중복된 키: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref를 Number로 사용" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Dictionary에 콤마 누락: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: List를 Number로 사용" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Dictionary 끝에 '}' 누락: %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dictionary를 Number로 사용" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: 변수가 표시하기에 너무 깊이 중첩되었습니다" +msgid "E910: Using a Job as a Number" +msgstr "E910: Job을 Number로 사용하고 있습니다" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel을 Number로 사용하고 있습니다" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref를 Float로 사용하고 있습니다" + +msgid "E892: Using a String as a Float" +msgstr "E892: String을 Float로 사용하고 있습니다" + +msgid "E893: Using a List as a Float" +msgstr "E893: List를 Float로 사용하고 있습니다" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dictionary를 Float로 사용하고 있습니다" + +msgid "E907: Using a special value as a Float" +msgstr "E907: 특수한 값을 Float로 사용하고 있습니다" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job을 Float로 사용하고 있습니다" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Channel을 Float로 사용하고 있습니다" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref를 String으로 사용" + +msgid "E730: using List as a String" +msgstr "E730: List를 String으로 사용" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dictionary를 String으로 사용" + +msgid "E908: using an invalid value as a String" +msgstr "E908: 잘못된 값을 String으로 사용하고 있습니다" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: 함수 %s에 너무 많은 인자가 전달되었습니다" +msgid "E795: Cannot delete variable %s" +msgstr "E795: 변수 %s를 삭제할 수 없습니다" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: 함수 %s(으)로 잘못된 인자가 넘겨졌습니다" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Funcref 변수명은 대문자로 시작해야 함: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: 모르는 함수: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: 변수명이 이미 있는 함수명과 충돌: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: 함수에 적은 인자 넘김: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: 값이 잠겨있음: %s" + +msgid "Unknown" +msgstr "모름" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: 스크립트 콘텍스트 밖에서 <SID> 사용: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s 값을 바꿀 수 없습니다" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: 복사하기에 변수가 너무 깊게 중첩되었습니다" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# 전역 변수:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tLast set from " + +msgid "map() argument" +msgstr "map() 인자" + +msgid "filter() argument" +msgstr "filter() 인자" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Dictionary없이 사전함수가 불려짐: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s 인자는 List이어야 합니다" + +msgid "E928: String required" +msgstr "E928: String이 필요합니다" msgid "E808: Number or Float required" msgstr "E808: Number 혹은 Float가 필요합니다" -msgid "E699: Too many arguments" -msgstr "E699: 너무 많은 인자" +msgid "add() argument" +msgstr "add() 인자" msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete()은 입력 모드에서만 사용될 수 있습니다" @@ -570,18 +694,16 @@ msgstr "E785: complete()은 입력 모드에서만 사용될 수 있습니다" msgid "&Ok" msgstr "확인(&O)" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: 키가 이미 존재함: %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld 줄: " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: 모르는 함수: %s" +msgid "E922: expected a dict" +msgstr "E922: dict가 요구됩니다" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function()의 두번째 인자는 list나 dict이어야 합니다" + msgid "" "&OK\n" "&Cancel" @@ -592,180 +714,87 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "inputrestore()가 inputsave()보다 많이 불려졌습니다" +msgid "insert() argument" +msgstr "insert() 인자" + msgid "E786: Range not allowed" msgstr "E786: 범위가 허용되지 않습니다" -msgid "E701: Invalid type for len()" -msgstr "E701: len()에 잘못된 형" - -msgid "E726: Stride is zero" -msgstr "E726: Stride가 0" - -msgid "E727: Start past end" -msgstr "E727: 시작위치가 끝을 지나침" - -msgid "<empty>" -msgstr "<비어있음>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim 서버에 연결되어 있지 않습니다" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s(으)로 보낼 수 없습니다" - -msgid "E277: Unable to read a server reply" -msgstr "E277: 서버의 응답을 읽을 수 없습니다" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: 너무 많은 심볼릭 링크 (반복순환?)" - -msgid "E258: Unable to send to client" -msgstr "E258: 클라이언트로 보낼 수 없습니다" - -msgid "E702: Sort compare function failed" -msgstr "E702: 정렬 비교 기능이 실패했습니다" - -msgid "(Invalid)" -msgstr "(잘못되었습니다)" - -msgid "E677: Error writing temp file" -msgstr "E677: 임시 파일 쓰기 에러" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Float를 Number로 사용" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref를 Number로 사용" - -msgid "E745: Using a List as a Number" -msgstr "E745: List를 Number로 사용" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Dictionary를 Number로 사용" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref를 String으로 사용" - -msgid "E730: using List as a String" -msgstr "E730: List를 String으로 사용" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Dictionary를 String으로 사용" - -msgid "E806: using Float as a String" -msgstr "E806: Float를 String으로 사용" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funcref 변수명은 대문자로 시작해야 함: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: 변수명이 이미 있는 함수명과 충돌: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: 변수 형 다름: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: 변수 %s를 삭제할 수 없습니다" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: 값이 잠겨있음: %s" - -msgid "Unknown" -msgstr "모름" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s 값을 바꿀 수 없습니다" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: 복사하기에 변수가 너무 깊게 중첩되었습니다" +msgid "E916: not a valid job" +msgstr "E916: 정상적인 job이 아닙니다" -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: 정의 안 된 함수: %s" +msgid "E701: Invalid type for len()" +msgstr "E701: len()에 잘못된 형" #, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '('가 없음: %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID가 \":match\"때문에 예약됨: %ld" -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: 잘못된 인자: %s" +msgid "E726: Stride is zero" +msgstr "E726: Stride가 0" -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction이 없습니다" +msgid "E727: Start past end" +msgstr "E727: 시작위치가 끝을 지나침" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: 함수명이 변수명과 충돌: %s" +msgid "<empty>" +msgstr "<비어있음>" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: 함수 %s을(를) 다시 정의할 수 없습니다: 사용중입니다" +msgid "E240: No connection to the X server" +msgstr "E240: X 서버에 연결되어 있지 않습니다" #, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: 함수명이 스크립트 파일명과 다름: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s(으)로 보낼 수 없습니다" -msgid "E129: Function name required" -msgstr "E129: 함수 이름이 필요합니다" +msgid "E277: Unable to read a server reply" +msgstr "E277: 서버의 응답을 읽을 수 없습니다" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: 함수 이름은 대문자로 시작하거나 콜론을 포함해야 함: %s" +msgid "E941: already started a server" +msgstr "E941: 서버가 이미 시작되었습니다" -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: 함수 %s을(를) 지울 수 없습니다: 사용중입니다" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver 기능이 포함되지 않았습니다" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: 함수를 부른 깊이가 'maxfuncdepth'보다 큽니다" +msgid "remove() argument" +msgstr "remove() 인자" -#, c-format -msgid "calling %s" -msgstr "%s 부르는 중" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: 너무 많은 심볼릭 링크 (반복순환?)" -#, c-format -msgid "%s aborted" -msgstr "%s이(가) 중지되었습니다" +msgid "reverse() argument" +msgstr "reverse() 인자" -#, c-format -msgid "%s returning #%ld" -msgstr "%s이(가) #%ld을(를) 돌려주었습니다" +msgid "E258: Unable to send to client" +msgstr "E258: 클라이언트로 보낼 수 없습니다" #, c-format -msgid "%s returning %s" -msgstr "%s이(가) %s을(를) 돌려주었습니다" +msgid "E927: Invalid action: '%s'" +msgstr "E927: 비정상적인 동작: '%s'" -#, c-format -msgid "continuing in %s" -msgstr "%s에서 계속" +msgid "sort() argument" +msgstr "sort() 인자" -msgid "E133: :return not inside a function" -msgstr "E133: :return이 함수 안에 있지 않습니다" +msgid "uniq() argument" +msgstr "uniq() 인자" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# 전역 변수:\n" +msgid "E702: Sort compare function failed" +msgstr "E702: 정렬 비교 기능이 실패했습니다" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLast set from " +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq 비교 함수가 실패하였습니다" -msgid "No old files" -msgstr "old 파일이 없습니다" +msgid "(Invalid)" +msgstr "(비정상)" + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: 비정상적인 submatch number: %d" + +msgid "E677: Error writing temp file" +msgstr "E677: 임시 파일 쓰기 에러" + +msgid "E921: Invalid callback argument" +msgstr "E921: 비정상적인 콜백 인자" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" @@ -827,6 +856,10 @@ msgstr " 실패" msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Viminfo 파일의 쓰기 권한이 없습니다: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: 너무 많은 viminfo 임시 파일들, 가령 %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Viminfo 파일 %s을(를) 쓸 수 없습니다!" @@ -835,6 +868,10 @@ msgstr "E138: Viminfo 파일 %s을(를) 쓸 수 없습니다!" msgid "Writing viminfo file \"%s\"" msgstr "Viminfo 파일 \"%s\"을(를) 쓰는 중" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo 파일명을 %s(으)로 변경할 수 없습니다!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -853,6 +890,11 @@ msgstr "# 이 파일이 저장되었을 때의 'encoding'의 값\n" msgid "Illegal starting char" msgstr "이상한 시작 글자" +#~ msgid "" +#~ "\n" +#~ "# Bar lines, copied verbatim:\n" +#~ msgstr "" + msgid "Save As" msgstr "다른 이름으로 저장" @@ -947,8 +989,9 @@ msgstr " 한 줄에서" msgid " on %ld lines" msgstr " %ld 줄에서" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global은 재귀 호출 될 수 없습니다" +#. will increment global_busy to break out of the loop +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global은 범위로 재귀 호출 될 수 없습니다" msgid "E148: Regular expression missing from global" msgstr "E148: global에서 정규표현식이 빠졌습니다" @@ -957,6 +1000,10 @@ msgstr "E148: global에서 정규표현식이 빠졌습니다" msgid "Pattern found in every line: %s" msgstr "여러 줄에서 패턴을 찾았습니다: %s" +#, c-format +msgid "Pattern not found: %s" +msgstr "패턴을 찾을 수 없음: %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -982,8 +1029,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "미안합니다, 도움말 파일 \"%s\"을(를) 찾을 수 없습니다" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: 디렉토리가 아님: %s" +msgid "E151: No match: %s" +msgstr "E151: 맞지 않음: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1001,6 +1048,10 @@ msgstr "E670: 한 언어내에서 여러 인코딩 사용: %s" msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: \"%s\" 태그가 %s/%s 파일에서 중복되었습니다" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: 디렉토리가 아님: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: 모르는 sign 명령: %s" @@ -1026,10 +1077,17 @@ msgstr "E159: sign 번호가 없습니다" msgid "E158: Invalid buffer name: %s" msgstr "E158: 잘못된 버퍼 이름: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: 이름없는 버퍼로는 점프할 수 없습니다" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: 잘못된 sign ID: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: sign %s을(를) 바꿀 수 없습니다" + msgid " (NOT FOUND)" msgstr " (못 찾았음)" @@ -1039,6 +1097,9 @@ msgstr " (지원되지 않음)" msgid "[Deleted]" msgstr "[지워졌습니다]" +msgid "No old files" +msgstr "old 파일이 없습니다" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "디버그 상태로 들어감. 계속하려면 \"cont\"를 입력하십시오." @@ -1050,6 +1111,13 @@ msgstr "%ld 줄: %s" msgid "cmd: %s" msgstr "명령: %s" +msgid "frame is zero" +msgstr "프레임이 0" + +#, c-format +msgid "frame at highest level: %d" +msgstr "프레임이 가장 높은 단계임: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "중지점: \"%s%s\" %ld 줄" @@ -1104,8 +1172,16 @@ msgid "Searching for \"%s\"" msgstr "\"%s\"을(를) 찾는 중" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "'runtimepath'에서 찾을 수 없음: \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "'%s'에서 찾을 수 없음: \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: 요구되는 파이선 버젼 2.x는 지원되지 않음, 파일을 무시: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: 요구되는 파이선 버젼 3.x는 지원되지 않음, 파일을 무시: %s" msgid "Source Vim script" msgstr "빔 스크립트 로드" @@ -1134,8 +1210,12 @@ msgstr "%ld 줄: \"%s\" 불러들이는 중" msgid "finished sourcing %s" msgstr "%s 불러들이기 끝" -#~ msgid "modeline" -#~ msgstr "" +#, c-format +msgid "continuing in %s" +msgstr "%s에서 계속" + +msgid "modeline" +msgstr "modeline" msgid "--cmd argument" msgstr "--cmd 인자" @@ -1200,6 +1280,9 @@ msgstr "반대 영역이 주어졌습니다, 뒤집을까요" msgid "E494: Use w or w>>" msgstr "E494: w나 w>>를 사용하십시오" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: 명령 테이블 갱신이 필요, 'make cmdidxs'를 실행하세요" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: 미안합니다, 그 명령은 현재 판에서 사용할 수 없습니다" @@ -1225,10 +1308,10 @@ msgstr "E174: 명령이 이미 존재합니다: 바꾸려면 !을 더하세요" msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" 이름 인자 범위 완성 정의" +" 이름 인자 주소 완성 정의" msgid "No user-defined commands found" msgstr "사용자 정의 명령을 찾을 수 없습니다" @@ -1248,6 +1331,9 @@ msgstr "E178: 잘못된 기본 카운트 값" msgid "E179: argument required for -complete" msgstr "E179: -complete에 인자가 필요합니다" +msgid "E179: argument required for -addr" +msgstr "E179: -addr에 인자가 필요합니다" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: 잘못된 속성: %s" @@ -1265,6 +1351,10 @@ msgstr "E841: 예약된 이름, 사용자 정의 명령으로 사용될 수 없 msgid "E184: No such user-defined command: %s" msgstr "E184: 그런 사용자 정의 명령 없음: %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: 잘못된 주소 형식 값: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: 잘못된 끝내기 값: %s" @@ -1279,7 +1369,7 @@ msgid "unknown" msgstr "모름" #, c-format -msgid "E185: Cannot find color scheme %s" +msgid "E185: Cannot find color scheme '%s'" msgstr "E185: 색 스킴 %s을(를) 찾을 수 없습니다" msgid "Greetings, Vim user!" @@ -1326,6 +1416,9 @@ msgstr "E188: 이 플랫폼에 대한 창 위치 얻는 기능을 구현되지 msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos에는 두개의 인자가 필요합니다" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: execute() 내에서 :redir을 사용할 수 없습니다" + msgid "Save Redirection" msgstr "리디렉션 저장" @@ -1522,7 +1615,7 @@ msgstr "" "# %s 히스토리 (새것부터 오래된 것 순):\n" msgid "Command Line" -msgstr "명령 줄" +msgstr "명령 행" msgid "Search String" msgstr "찾을 문자열" @@ -1531,7 +1624,10 @@ msgid "Expression" msgstr "표현" msgid "Input Line" -msgstr "입력 줄" +msgstr "입력 행" + +msgid "Debug Line" +msgstr "디버그 행" msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar가 명령 길이를 벗어났습니다" @@ -1594,9 +1690,6 @@ msgstr "[소켓]" #~ msgid "[character special]" #~ msgstr "" -msgid "[RO]" -msgstr "[읽기 전용]" - msgid "[CR missing]" msgstr "[CR 없음]" @@ -1609,9 +1702,6 @@ msgstr "[변환 안 됩니다]" msgid "[converted]" msgstr "[변환 되었습니다]" -msgid "[crypted]" -msgstr "[암호화 되었습니다]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[%ld 줄에서 변환 에러]" @@ -1632,9 +1722,6 @@ msgstr "'charconvert'를 사용한 변환이 실패했습니다" msgid "can't read output of 'charconvert'" msgstr "'charconvert'의 출력결과를 읽을 수 없습니다" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: 파일이 모르는 방법으로 암호화되어 있습니다" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwrite 버퍼에 대한 autocommand를 찾을 수 없습니다" @@ -1783,11 +1870,6 @@ msgstr "1 글자" msgid "%lld characters" msgstr "%lld 글자" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld 글자" - msgid "[noeol]" msgstr "[noeol]" @@ -1880,6 +1962,12 @@ msgstr "autocommand 자동삭제: %s <buffer=%d>" msgid "E367: No such group: \"%s\"" msgstr "E367: 이런 그룹 없음: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: 현재 그룹을 삭제할 수 없습니다" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: 사용중인 augroup을 삭제하려고 합니다" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: * 뒤에 이상한 글자: %s" @@ -1940,10 +2028,6 @@ msgstr "E350: 현재의 'foldmethod'으로 접기를 만들 수 없습니다" msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: 현재의 'foldmethod'으로 접기를 지울 수 없습니다" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld 줄 접힘 " - msgid "E222: Add to read buffer" msgstr "E222: 읽혀진 버퍼에 더하기" @@ -1975,6 +2059,12 @@ msgstr "맵핑을 찾을 수 없습니다" msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: 이상한 상태" +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: 새로운 GUI 프로세스를 생성할 수 없습니다" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: 자식 프로세스가 GUI를 시작하지 못했습니다" + msgid "E229: Cannot start the GUI" msgstr "E229: GUI를 시작할 수 없습니다" @@ -2029,6 +2119,18 @@ msgstr "빔 대화상자" msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: 메시지와 콜백 모두를 사용해서는 BalloonEval을 만들 수 없습니다" +msgid "_Cancel" +msgstr "취소(_C)" + +msgid "_Save" +msgstr "저장(_S)" + +msgid "_Open" +msgstr "열기(_O)" + +msgid "_OK" +msgstr "확인(_O)" + msgid "" "&Yes\n" "&No\n" @@ -2038,6 +2140,12 @@ msgstr "" "아니오(&N)\n" "취소(&C)" +msgid "Yes" +msgstr "예" + +msgid "No" +msgstr "아니오" + msgid "Input _Methods" msgstr "입력 방법(_M)" @@ -2071,23 +2179,23 @@ msgstr "위로" msgid "Down" msgstr "아래로" -#. 'Find Next' button msgid "Find Next" msgstr "다음 찾기" -#. 'Replace' button msgid "Replace" msgstr "바꾸기" -#. 'Replace All' button msgid "Replace All" msgstr "모두 바꾸기" +msgid "_Close" +msgstr "닫기(_C)" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "빔: 세션 관리자로부터 \"die\" 요청을 받았습니다\n" -msgid "Close" -msgstr "닫기" +msgid "Close tab" +msgstr "탭 닫기" msgid "New tab" msgstr "새 탭" @@ -2134,20 +2242,6 @@ msgstr "모두 바꾸기(&A)" msgid "&Undo" msgstr "취소(&U)" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: 창 제목 \"%s\"을(를) 찾을 수 없습니다" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: 지원되지 않는 인자: \"-%s\": OLE 판을 사용하십시오." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDI 응용프로그램 안에서 창을 열 수 없습니다" - -msgid "Close tab" -msgstr "탭 닫기" - msgid "Open tab..." msgstr "탭 열기..." @@ -2165,6 +2259,17 @@ msgstr "사용 않됨" msgid "Directory\t*.nothing\n" msgstr "디렉토리\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: 창 제목 \"%s\"을(를) 찾을 수 없습니다" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: 지원되지 않는 인자: \"-%s\": OLE 판을 사용하십시오." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDI 응용프로그램 안에서 창을 열 수 없습니다" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "빔 E458: 색상맵 엔트리를 할당할 수 없습니다, 몇몇 색이 잘못될 수 있습니다" @@ -2182,32 +2287,28 @@ msgid "Font '%s' is not fixed-width" msgstr "글꼴 '%s'은(는) 고정넓이가 아닙니다" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: 글꼴셋 이름: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: 글꼴셋 이름: %s" #, c-format -msgid "Font0: %s\n" -msgstr "글꼴0: %s\n" +msgid "Font0: %s" +msgstr "글꼴0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "글꼴1: %s\n" +msgid "Font1: %s" +msgstr "글꼴1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "글꼴%ld 너비가 글꼴0의 두배가 아닙니다\n" +msgid "Font%ld width is not twice that of font0" +msgstr "글꼴%ld 너비가 글꼴0의 두배가 아닙니다" #, c-format -msgid "Font0 width: %ld\n" -msgstr "글꼴0 너비: %ld\n" +msgid "Font0 width: %ld" +msgstr "글꼴0 너비: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"글꼴1 너비: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "글꼴1 너비: %ld" #~ msgid "Invalid font specification" #~ msgstr "" @@ -2395,6 +2496,9 @@ msgstr "E566: cscope 파이프를 만들 수 없습니다" msgid "E622: Could not fork for cscope" msgstr "E622: cscope를 fork할 수 없습니다" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid가 실패했습니다" + msgid "cs_create_connection exec failed" msgstr "cs_create_connection 실행이 실패했습니다" @@ -2427,6 +2531,7 @@ msgstr "%-5s: %s%*s (사용법: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2437,13 +2542,14 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: 이 기호에 대한 할당 찾기\n" " c: 이 함수를 부르는 함수들 찾기\n" " d: 이 함수에 의해 불려지는 함수들 찾기\n" " e: 이 egrep 패턴 찾기\n" " f: 이 파일 찾기\n" " g: 이 정의 찾기\n" -" i: 이 파일을 포함하는 파일들 찾기\n" -" s: 이 C 심볼 찾기\n" +" i: 이 파일을 #include하는 파일들 찾기\n" +" s: 이 C 기호 찾기\n" " t: 이 문자열 찾기\n" #, c-format @@ -2495,8 +2601,8 @@ msgstr "cscope 연결이 없습니다\n" msgid " # pid database name prepend path\n" msgstr " # pid 데이터베이스 이름 prepend path\n" -#~ msgid "Lua library cannot be loaded." -#~ msgstr "" +msgid "Lua library cannot be loaded." +msgstr "Lua 라이브러리를 로딩할 수 없습니다." msgid "cannot save undo information" msgstr "undo 정보를 저장할 수 없습니다" @@ -2508,14 +2614,21 @@ msgstr "" "E815: 미안합니다, 이 명령은 사용할 수 없습니다, MzScheme 라이브러리를 로딩할 " "수 없습니다." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: 미안합니다, 이 명령은 사용할 수 없습니다, MzScheme의 racket/base " +"모듈을 로딩할 수 없습니다." + msgid "invalid expression" msgstr "잘못된 표현식" msgid "expressions disabled at compile time" msgstr "표현식을 지원하지 않도록 컴파일 되었습니다" -#~ msgid "hidden option" -#~ msgstr "" +msgid "hidden option" +msgstr "숨김 옵션" msgid "unknown option" msgstr "모르는 옵션" @@ -2538,6 +2651,9 @@ msgstr "줄을 끼워넣을 수 없습니다" msgid "string cannot contain newlines" msgstr "문자열은 newline을 포함할 수 없습니다" +#~ msgid "error converting Scheme values to Vim" +#~ msgstr "" + msgid "Vim error: ~a" msgstr "Vim 에러: ~a" @@ -2566,144 +2682,49 @@ msgstr "" "E263: 미안합니다, 이 명령은 사용할 수 없습니다, 파이썬 라이브러리를 로딩할 " "수 없습니다." -msgid "E659: Cannot invoke Python recursively" -msgstr "E659: Python을 재귀호출할 수 없습니다" - -msgid "can't delete OutputObject attributes" -msgstr "OutputObject 속성을 지울 수 없습니다" - -msgid "softspace must be an integer" -msgstr "softspace는 정수여야만 합니다" - -msgid "invalid attribute" -msgstr "잘못된 속성" - -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<%p에 버퍼 객체 (삭제됨)>" - -msgid "E837: This Vim cannot execute :py3 after using :python" -msgstr "E837: 이 Vim은 :python을 사용한 후에 :py3을 사용할 수 없습니다" - -#~ msgid "E265: $_ must be an instance of String" -#~ msgstr "" - -msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: 미안합니다, 이 명령은 사용할 수 없습니다, 루비 라이브러리를 로딩할 수 " -"없습니다." - -msgid "E267: unexpected return" -msgstr "E267: 뜻밖의 return" - -msgid "E268: unexpected next" -msgstr "E268: 뜻밖의 next" - -msgid "E269: unexpected break" -msgstr "E269: 뜻밖의 break" - -msgid "E270: unexpected redo" -msgstr "E270: 뜻밖의 redo" - -#~ msgid "E271: retry outside of rescue clause" -#~ msgstr "" - -msgid "E272: unhandled exception" -msgstr "E272: 처리않된 예외" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: 모르는 longjmp 상태 %d" - -msgid "Toggle implementation/definition" -msgstr "토글 구현/정의" - -msgid "Show base class of" -msgstr "...의 기본 클래스 보여주기" - -#~ msgid "Show overridden member function" -#~ msgstr "" - -#~ msgid "Retrieve from file" -#~ msgstr "" - -#~ msgid "Retrieve from project" -#~ msgstr "" - -#~ msgid "Retrieve from all projects" -#~ msgstr "" - -#~ msgid "Retrieve" -#~ msgstr "" - -#~ msgid "Show source of" -#~ msgstr "" - -#~ msgid "Find symbol" -#~ msgstr "" - -#~ msgid "Browse class" -#~ msgstr "" - -#~ msgid "Show class in hierarchy" -#~ msgstr "" - -#~ msgid "Show class in restricted hierarchy" -#~ msgstr "" - -#~ msgid "Xref refers to" -#~ msgstr "" - -#~ msgid "Xref referred by" -#~ msgstr "" - -#~ msgid "Xref has a" -#~ msgstr "" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: 미안합니다, 이 명령은 사용할 수 없습니다, 파이썬의 사이트 모듈을 " +"로딩할 수 없습니다." -#~ msgid "Xref used by" -#~ msgstr "" +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Python을 재귀호출할 수 없습니다" -#~ msgid "Show docu of" -#~ msgstr "" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: 이 Vim은 :python을 사용한 후에 :py3을 사용할 수 없습니다" -#~ msgid "Generate docu for" -#~ msgstr "" +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_는 String 인스턴스이어야 합니다" msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"SNiFF+로 연결할 수 없습니다. 환경을 확인하십시오 (sniffemacs가 $PATH에서 찾아" -"져야 합니다).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: 읽는 중 에러. 끊김" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ is currently " +"E266: 미안합니다, 이 명령은 사용할 수 없습니다, 루비 라이브러리를 로딩할 수 " +"없습니다." -msgid "not " -msgstr "not " +msgid "E267: unexpected return" +msgstr "E267: 뜻밖의 return" -msgid "connected" -msgstr "connected" +msgid "E268: unexpected next" +msgstr "E268: 뜻밖의 next" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: 모르는 SNiFF+ 요청: %s" +msgid "E269: unexpected break" +msgstr "E269: 뜻밖의 break" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+에 연결 에러" +msgid "E270: unexpected redo" +msgstr "E270: 뜻밖의 redo" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SniFF+가 연결되지 않았습니다" +#~ msgid "E271: retry outside of rescue clause" +#~ msgstr "" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SniFF+ 버퍼가 아닙니다" +msgid "E272: unhandled exception" +msgstr "E272: 처리않된 예외" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: 쓰는 도중 에러. 끊겼습니다" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: 모르는 longjmp 상태 %d" msgid "invalid buffer number" msgstr "잘못된 버퍼 번호" @@ -2767,12 +2788,6 @@ msgstr "" "E571: 미안합니다, 이 명령은 사용할 수 없습니다, Tcl 라이브러리를 로딩할 수 없" "습니다." -msgid "" -"E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "" -"E281: TCL 에러: 끝내기 코드가 정수가 아닌가!? 이 문제를 vim-dev@vim.org로 알" -"려주십시오" - #, c-format msgid "E572: exit code %d" msgstr "E572: 종료 코드 %d" @@ -2793,6 +2808,18 @@ msgstr "E573: 잘못된 서버 id 사용됨: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: 빔 인스턴스 레지스트리 속성이 잘못되어 있습니다. 지웠습니다!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSON에 중복된 키: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: List에 콤마 누락: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: List 끝에 ']' 누락: %s" + msgid "Unknown option argument" msgstr "모르는 옵션 인자" @@ -2818,12 +2845,12 @@ msgstr "%d 파일을 고치기\n" msgid "netbeans is not supported with this GUI\n" msgstr "이 GUI는 netbeans를 지원하지 않습니다\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "이 빔은 diff 기능 없이 컴파일 되었습니다." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb'는 사용할 수 없음: 컴파일할 때 포함되지 않음\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "이 빔은 diff 기능 없이 컴파일 되었습니다." + msgid "Attempt to open script file again: \"" msgstr "스크립트 파일을 다시 열려고 시도: \"" @@ -2836,6 +2863,9 @@ msgstr "스크립트 출력을 열 수 없음: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: 에러: NetBeans에서 gvim 시작 실패\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: 에러: 이 버젼의 빔은 Cygwin 터미널에서 실행할 수 없습니다\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "빔: 경고: 터미널로 출력할 수 없습니다\n" @@ -2921,25 +2951,28 @@ msgid "-f or --nofork\tForeground: Don't fork when starting GUI" msgstr "-f 혹은 --nofork\t포그라운드: GUI로 시작할 때 fork하지 말 것" msgid "-v\t\t\tVi mode (like \"vi\")" -msgstr "-v\t\t\tVi 상태 (\"vi\"와 같음)" +msgstr "-v\t\t\tVi 모드 (\"vi\"와 같음)" msgid "-e\t\t\tEx mode (like \"ex\")" -msgstr "-e\t\t\tEx 상태 (\"ex\"와 같음)" +msgstr "-e\t\t\tEx 모드 (\"ex\"와 같음)" + +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\t향상된 Ex 모드" msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\t조용한 (배치) 상태 (\"ex\"만)" +msgstr "-s\t\t\t조용한 (배치) 모드 (\"ex\"만)" msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tDiff 상태 (\"vimdiff\"와 같음)" +msgstr "-d\t\t\tDiff 모드 (\"vimdiff\"와 같음)" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\t쉬운 상태 (\"evim\"과 같음, modeless)" +msgstr "-y\t\t\t쉬운 모드 (\"evim\"과 같음, modeless)" msgid "-R\t\t\tReadonly mode (like \"view\")" -msgstr "-R\t\t\t읽기 전용 상태 (\"view\"와 같음)" +msgstr "-R\t\t\t읽기 전용 모드 (\"view\"와 같음)" msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\t제한된 상태 (\"rvim\"과 같음)" +msgstr "-Z\t\t\t제한된 모드 (\"rvim\"과 같음)" msgid "-m\t\t\tModifications (writing files) not allowed" msgstr "-m\t\t\t수정(파일 쓰기)이 허용되지 않음" @@ -2959,11 +2992,11 @@ msgstr "-C\t\t\tVi 호환: 'compatible'" msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" msgstr "-N\t\t\tVi와 호환되지 않음: 'nocompatible'" -#~ msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -#~ msgstr "" +msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" +msgstr "-V[N][fname]\t\tBe verbose [level N] [fname에 메시지 저장]" msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\t디버깅 상태" +msgstr "-D\t\t\t디버깅 모드" msgid "-n\t\t\tNo swap file, use memory only" msgstr "-n\t\t\t스왑 파일 없이 메모리만 사용" @@ -2995,6 +3028,12 @@ msgstr "-F\t\t\tFarsi 모드로 시작" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\t터미널 종류를 <terminal>로 설정" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\t터미널에 입출력할 수 없다는 경고하지 않음" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\t터미널에 입출력할 수 없는 경우 종료" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t.vimrc 대신 <vimrc>를 사용" @@ -3153,19 +3192,6 @@ msgstr "+reverse\t\t반전 비디오 사용 안 함 (also: +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <resource>\t명시된 리소스 설정" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"gvim이 알고있는 인자 (RISC OS 판):\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <숫자>\t칸에서 창 초기 너비" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <숫자>\t줄에서 창 초기 높이" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" @@ -3182,6 +3208,9 @@ msgstr "--role <role>\t메인 창 구분을 위해 유일한 역할 설정" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\t빔을 다른 GTK 위젯 안에서 열음" +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\t표준출력에 gvim의 Window ID를 표시" + msgid "-P <parent title>\tOpen Vim inside parent application" msgstr "-P <parent title>\tVim을 부모 응용 프로그램 내에서 열기" @@ -3373,8 +3402,7 @@ msgstr " 이 컴퓨터에서는 사용될 수 없습니다.\n" #, c-format msgid "" "E833: %s is encrypted and this version of Vim does not support encryption" -msgstr "" -"E833: %s이(가) 암호화되어 있는 데, 이 Vim은 암호화를 지원하지 않습니다" +msgstr "E833: %s이(가) 암호화되어 있는 데, 이 Vim은 암호화를 지원하지 않습니다" #~ msgid " has been damaged (page size is smaller than minimum value).\n" #~ msgstr "" @@ -3666,24 +3694,17 @@ msgstr " NEWER than swap file!\n" #. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) 다른 프로그램이 같은 파일을 고치고 있는중일 수 있습니다.\n" -" 만약 그렇다면 같은 파일을 두 개의 프로그램에서 고치지\n" -" 않도록 조심하시기 바랍니다.\n" - -msgid " Quit, or continue with caution.\n" -msgstr " 끝내거나 위험을 감수하시려면 계속하십시오.\n" +" 만약 그렇다면 같은 파일을 두 개의 프로그램에서 고치지 않도록\n" +" 조심하시기 바랍니다. 종료하세요. 계속하시려면 주의하세요.\n" -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) 파일을 고치다가 죽었었습니다.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) 이 파일을 고치다가 죽었었습니다.\n" msgid " If this is the case, use \":recover\" or \"vim -r " msgstr " 만약 그렇다면 \":recover\" 혹은 \"vim -r " @@ -3905,13 +3926,6 @@ msgstr " (중단되었습니다)" msgid "Beep!" msgstr "삑!" -msgid "Vim: preserving files...\n" -msgstr "빔: 파일 보존중...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "빔: 끌났습니다.\n" - msgid "ERROR: " msgstr "에러: " @@ -3957,14 +3971,8 @@ msgstr "E548: 숫자가 필요합니다" msgid "E549: Illegal percentage" msgstr "E549: 이상한 백분율" -msgid "Enter encryption key: " -msgstr "암호 키 입력: " - -msgid "Enter same key again: " -msgstr "같은 키를 다시 입력: " - -msgid "Keys don't match!" -msgstr "키가 맞지 않습니다!" +#~ msgid "E854: path too long for completion" +#~ msgstr "" #, c-format msgid "" @@ -3990,19 +3998,10 @@ msgstr "E346: cdpath에서 더 이상의 \"%s\" 디렉토리를 찾을 수 없 msgid "E347: No more file \"%s\" found in path" msgstr "E347: path에서 더 이상의 \"%s\" 파일을 찾을 수 없습니다" -msgid "Cannot connect to Netbeans #2" -msgstr "Netbeans #2에 연결할 수 없습니다" - -msgid "Cannot connect to Netbeans" -msgstr "Netbeans에 연결할 수 없습니다" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "E668: NetBeans 연결 정보 파일이 접근 모드가 잘못됨: \"%s\"" -msgid "read from Netbeans socket" -msgstr "Netbeans 소켓에서 읽기" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: 버퍼 %ld에 대한 NetBeans 연결을 잃어버렸습니다" @@ -4013,8 +4012,9 @@ msgstr "E838: 이 GUI는 netbeans를 지원하지 않습니다" msgid "E511: netbeans already connected" msgstr "E511: netbeans가 이미 연결되어 있습니다" -msgid "E505: " -msgstr "E505: " +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s은(는) 읽기 전용입니다 (덮어쓰려면 ! 더하기)" msgid "E349: No identifier under cursor" msgstr "E349: 커서 밑에 식별자가 없습니다" @@ -4043,8 +4043,8 @@ msgstr "E664: changelist가 비었습니다" #~ msgid "E663: At end of changelist" #~ msgstr "" -msgid "Type :quit<Enter> to exit Vim" -msgstr "VIM을 마치려면 :quit<Enter> 입력" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr ":qa! 입력 후에 <엔터> 키를 누르시면 수정을 취소하고 빔을 종료합니다" #, c-format msgid "1 line %sed 1 time" @@ -4131,37 +4131,38 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: 모르는 레지스터 형식 %d" +#~ msgid "" +#~ "E883: search pattern and expression register may not contain two or more " +#~ "lines" +#~ msgstr "" + #, c-format msgid "%ld Cols; " msgstr "%ld 열; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Selected %s%ld of %ld 라인; %ld of %ld 단어; %ld of %ld 바이트" +#~ msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +#~ msgstr "" #, c-format -msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr "" -"Selected %s%ld of %ld 라인; %ld of %ld 단어; %ld of %ld 문자; %ld of %ld 바이" -"트" +#~ msgid "" +#~ "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +#~ "%lld Bytes" +#~ msgstr "" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Col %s of %s; 라인 %ld of %ld; 단어 %ld of %ld; 바이트 %ld of %ld" +#~ msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +#~ msgstr "" #, c-format -msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" -msgstr "" -"Col %s of %s; 라인 %ld of %ld; 단어 %ld of %ld; 문자 %ld of %ld; 바이트 %ld " -"of %ld" +#~ msgid "" +#~ "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +#~ "%lld of %lld" +#~ msgstr "" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld for BOM)" +#~ msgid "(+%ld for BOM)" +#~ msgstr "" msgid "%<%f%h%m%=Page %N" msgstr "%<%f%h%m%=페이지 %N" @@ -4178,6 +4179,9 @@ msgstr "E519: 지원되지 않는 옵션입니다" msgid "E520: Not allowed in a modeline" msgstr "E520: 모드라인에서 사용될 수 없습니다" +msgid "E846: Key code not set" +msgstr "E846: 키 코드가 설정되지 않았습니다" + msgid "E521: Number required after =" msgstr "E521: = 뒤에 숫자가 필요합니다" @@ -4188,6 +4192,10 @@ msgstr "E522: termcap에서 찾을 수 없습니다" msgid "E539: Illegal character <%s>" msgstr "E539: 이상한 글자 <%s>" +#, c-format +#~ msgid "For option %s" +#~ msgstr "" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term'을 빈 문자열로 설정할 수 없습니다" @@ -4381,9 +4389,6 @@ msgstr "I/O 에러" msgid "Message" msgstr "메시지" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns'이 80이 아니어서, 외부 명령을 실행할 수 없습니다" - msgid "E237: Printer selection failed" msgstr "E237: 프린터를 고르지 못했습니다" @@ -4408,19 +4413,12 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: 잘못된 글자셋 이름 \"%s\"이(가) 글꼴 이름 \"%s\"에 있습니다" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: 잘못된 글자 '%c'이(가) 글꼴 이름 \"%s\"에 있습니다" - -msgid "Vim: Double signal, exiting\n" -msgstr "빔: 같은 시그널 두 번, 끝냅니다\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "빔: %s 시그널을 잡았습니다\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: 잘못된 퀄러티 이름 \"%s\"이(가) 글꼴 이름 \"%s\"에 있습니다" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "빔: 죽을 시그널을 잡았습니다\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: 잘못된 글자 '%c'이(가) 글꼴 이름 \"%s\"에 있습니다" #, c-format msgid "Opening the X display took %ld msec" @@ -4453,12 +4451,13 @@ msgstr "" "\n" "Could not set security context for " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Cannot execute shell " +#, c-format +#~ msgid "Could not set security context %s for %s" +#~ msgstr "" + +#, c-format +#~ msgid "Could not get security context %s for %s. Removing it!" +#~ msgstr "" msgid "" "\n" @@ -4488,6 +4487,13 @@ msgstr "" "\n" "자식 프로세스를 만들 수 없습니다\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Cannot execute shell " + msgid "" "\n" "Command terminated\n" @@ -4530,10 +4536,6 @@ msgstr "빔 에러" msgid "Could not fix up function pointers to the DLL!" msgstr "함수 포인터를 DLL로 바꿀 수 없습니다!" -#, c-format -msgid "shell returned %d" -msgstr "쉘이 %d을(를) 돌려주었습니다" - #, c-format msgid "Vim: Caught %s event\n" msgstr "빔: %s 이벤트를 잡았습니다\n" @@ -4562,6 +4564,10 @@ msgstr "" msgid "Vim Warning" msgstr "빔 경고" +#, c-format +msgid "shell returned %d" +msgstr "쉘이 %d을(를) 돌려주었습니다" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: 형식 문자열에 %%%c이(가) 너무 많습니다" @@ -4585,6 +4591,7 @@ msgstr "E376: 형식 문자열 서두에 잘못된 %%%c이(가) 있습니다" msgid "E377: Invalid %%%c in format string" msgstr "E377: 형식 문자열에 잘못된 %%%c이(가) 있습니다" +#. nothing found msgid "E378: 'errorformat' contains no pattern" msgstr "E378: 'errorformat'이 어떤 패턴도 포함하고 있지 않습니다" @@ -4594,6 +4601,15 @@ msgstr "E379: 빠졌거나 빈 디렉토리 이름" msgid "E553: No more items" msgstr "E553: 더 이상의 항목이 없습니다" +msgid "E924: Current window was closed" +msgstr "E924: 현재 창이 닫혔습니다" + +msgid "E925: Current quickfix was changed" +msgstr "E925: 현재의 quickfix가 바뀌었습니다" + +msgid "E926: Current location list was changed" +msgstr "E926: 현재의 location list가 바뀌었습니다" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d of %d)%s%s: " @@ -4601,15 +4617,18 @@ msgstr "(%d of %d)%s%s: " msgid " (line deleted)" msgstr " (줄을 지웠음)" +#, c-format +#~ msgid "%serror list %d of %d; %d errors " +#~ msgstr "" + msgid "E380: At bottom of quickfix stack" msgstr "E380: 퀵픽스 스택의 바닥입니다" msgid "E381: At top of quickfix stack" msgstr "E381: 퀵픽스 스택의 꼭대기입니다" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "error list %d of %d; %d errors" +#~ msgid "No entries" +#~ msgstr "" msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: 쓸 수 없음, 'buftype' 옵션이 설정되어 있습니다" @@ -4634,18 +4653,15 @@ msgstr "E777: String이나 List가 있어야 함" msgid "E369: invalid item in %s%%[]" msgstr "E369: %s%%[]에 잘못된 항목" -msgid "E339: Pattern too long" -msgstr "E339: 패턴이 너무 깁니다" - -msgid "E50: Too many \\z(" -msgstr "E50: \\z(가 너무 많습니다" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: %s(가 너무 많습니다" +msgid "E769: Missing ] after %s[" +msgstr "E769: %s[ 뒤에 ]가 없습니다" -msgid "E52: Unmatched \\z(" -msgstr "E52: 맞지 않는 \\z(" +#~ msgid "E944: Reverse range in character class" +#~ msgstr "" + +#~ msgid "E945: Range too large in character class" +#~ msgstr "" #, c-format msgid "E53: Unmatched %s%%(" @@ -4659,6 +4675,36 @@ msgstr "E54: 맞지 않는 %s(" msgid "E55: Unmatched %s)" msgstr "E55: 맞지 않는 %s)" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z(는 여기에서 허용되지 않습니다" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 등은 여기에서 허용되지 않습니다" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: %s%%[ 뒤에 ]가 없습니다" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: 빈 %s%%[]" + +msgid "E65: Illegal back reference" +msgstr "E65: 이상한 후위 참조" + +msgid "E339: Pattern too long" +msgstr "E339: 패턴이 너무 깁니다" + +msgid "E50: Too many \\z(" +msgstr "E50: \\z(가 너무 많습니다" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: %s(가 너무 많습니다" + +msgid "E52: Unmatched \\z(" +msgstr "E52: 맞지 않는 \\z(" + #, c-format msgid "E59: invalid character after %s@" msgstr "E59: %s@ 뒤에 잘못된 문자" @@ -4682,26 +4728,9 @@ msgstr "E63: \\_를 잘 못 사용" msgid "E64: %s%c follows nothing" msgstr "E64: %s%c 뒤에 아무것도 없습니다" -msgid "E65: Illegal back reference" -msgstr "E65: 이상한 후위 참조" - -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z(는 여기에서 허용되지 않습니다" - -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 등은 여기에서 허용되지 않습니다" - msgid "E68: Invalid character after \\z" msgstr "E68: \\z 뒤에 이상한 문자" -#, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: %s%%[ 뒤에 ]가 없습니다" - -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: 빈 %s%%[]" - #, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: %s%%[dxouU] 뒤에 이상한 문자" @@ -4710,10 +4739,6 @@ msgstr "E678: %s%%[dxouU] 뒤에 이상한 문자" msgid "E71: Invalid character after %s%%" msgstr "E71: %s%% 뒤에 이상한 문자" -#, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: %s[ 뒤에 ]가 없습니다" - #, c-format msgid "E554: Syntax error in %s{...}" msgstr "E554: %s{...}에 구문 에러" @@ -4721,6 +4746,87 @@ msgstr "E554: %s{...}에 구문 에러" msgid "External submatches:\n" msgstr "외부 submatches:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA 정규표현식) %s을(를) 반복할 수 없습니다" + +#~ msgid "" +#~ "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +#~ "used " +#~ msgstr "" + +#~ msgid "Switching to backtracking RE engine for pattern: " +#~ msgstr "" + +#~ msgid "E865: (NFA) Regexp end encountered prematurely" +#~ msgstr "" + +#, c-format +#~ msgid "E866: (NFA regexp) Misplaced %c" +#~ msgstr "" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA 정규표현식) 비정상적인 문자 클래스: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) 모르는 오퍼레이터 '\\z%c'" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) 모르는 오퍼레이터 '\\%%%c'" + +#. should never happen +#~ msgid "E868: Error building NFA with equivalence class!" +#~ msgstr "" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) 모르는 오퍼레이터 '\\@%c'" + +#~ msgid "E870: (NFA regexp) Error reading repetition limits" +#~ msgstr "" + +#. Can't have a multi follow a multi. +#~ msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +#~ msgstr "" + +#. Too many `(' +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA 정규표현식) '('가 너무 많습니다" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA 정규표현식) \\z(가 너무 많습니다" + +#~ msgid "E873: (NFA regexp) proper termination error" +#~ msgstr "" + +#~ msgid "E874: (NFA) Could not pop the stack !" +#~ msgstr "" + +#~ msgid "" +#~ "E875: (NFA regexp) (While converting from postfix to NFA), too many states " +#~ "left on stack" +#~ msgstr "" + +#~ msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +#~ msgstr "" + +#~ msgid "E878: (NFA) Could not allocate memory for branch traversal!" +#~ msgstr "" + +#~ msgid "" +#~ "Could not open temporary log file for writing, displaying on stderr ... " +#~ msgstr "" + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) %s을(를) 열 수 없습니다!" + +msgid "Could not open temporary log file for writing " +msgstr "임시 로그 파일을 쓰기 위해 열 수 없습니다" + msgid " VREPLACE" msgstr " 선택치환" @@ -4748,9 +4854,6 @@ msgstr " 헤브루" msgid " Arabic" msgstr " 아라비아" -msgid " (lang)" -msgstr " (언어)" - msgid " (paste)" msgstr " (붙이기)" @@ -4845,8 +4948,47 @@ msgstr "" "# Last %sSearch Pattern:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: spell 파일 형식 에러" +msgid "E756: Spell checking is not enabled" +msgstr "E756: 맞춤법 검사가 활성화되어 있지 않습니다" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "경고: 단어 목록 \"%s_%s.spl\" 혹은 \"%s_ascii.spl\"을 찾을 수 없습니다" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "경고: 단어 목록 \"%s.%s.spl\" 혹은 \"%s.ascii.spl\"을 찾을 수 없습니다" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing autocommand가 버퍼를 삭제했습니다" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "경고: %s 영역은 지원되지 않습니다" + +msgid "Sorry, no suggestions" +msgstr "죄송, 제안할 게 없습니다" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "죄송, %ld개만 제안" + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Change \"%.*s\" to:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: 철자가 바뀐적이 없습니다" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: 찾을 수 없음: %s" msgid "E758: Truncated spell file" msgstr "E758: 잘린 spell 파일" @@ -4868,17 +5010,6 @@ msgstr "E762: FOL, LOW 혹은 UPP의 문자가 범위를 벗어남" msgid "Compressing word tree..." msgstr "단어 트리 압축중..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: 맞춤법 검사가 활성화되어 있지 않습니다" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "경고: 단어 목록 \"%s_%s.spl\" 혹은 \"%s_ascii.spl\"을 찾을 수 없습니다" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "경고: 단어 목록 \"%s.%s.spl\" 혹은 \"%s.ascii.spl\"을 찾을 수 없습니다" - #, c-format msgid "Reading spell file \"%s\"" msgstr "spell 파일 \"%s\"을(를) 읽고 있습니다" @@ -4896,8 +5027,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: spell 파일에 지원되지 않는 섹션" #, c-format -msgid "Warning: region %s not supported" -msgstr "경고: %s 영역은 지원되지 않습니다" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug 파일이 아닌 것 같음: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: 오래된 .sug 파일, 갱신 필요: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug 파일이 새 버젼의 Vim용임: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug 파일이 .spl 파일과 맞지 않음: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug 파일 읽기 에러: %s" #, c-format msgid "Reading affix file %s ..." @@ -5157,76 +5304,56 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile'에 %ld 항목이 없습니다" #, c-format -msgid "Word removed from %s" -msgstr "%s에서 단어 삭제됨" +msgid "Word '%.*s' removed from %s" +msgstr "단어 '%.*s'이(가) %s에서 제거됨" #, c-format -msgid "Word added to %s" -msgstr "%s에 단어 추가됨" +msgid "Word '%.*s' added to %s" +msgstr "단어 '%.*s'이(가) %s에 추가됨" msgid "E763: Word characters differ between spell files" msgstr "E763: 단어가 spell 파일 간에 다릅니다" -msgid "Sorry, no suggestions" -msgstr "죄송, 제안할 게 없습니다" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "죄송, %ld개만 제안" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Change \"%.*s\" to:" +#. This should have been checked when generating the .spl +#. * file. +msgid "E783: duplicate char in MAP entry" +msgstr "E783: MAP 항목에 중복된 문자" -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr "이 버퍼에 대해 정의된 구문 항목이 없습니다" -msgid "E752: No previous spell replacement" -msgstr "E752: 철자가 바뀐적이 없습니다" +#~ msgid "syntax conceal on" +#~ msgstr "" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: 찾을 수 없음: %s" +#~ msgid "syntax conceal off" +#~ msgstr "" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug 파일이 아닌 것 같음: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: 잘못된 인자: %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: 오래된 .sug 파일, 갱신 필요: %s" +#~ msgid "syntax case ignore" +#~ msgstr "" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug 파일이 새 버젼의 Vim용임: %s" +#~ msgid "syntax case match" +#~ msgstr "" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug 파일이 .spl 파일과 맞지 않음: %s" +#~ msgid "syntax spell toplevel" +#~ msgstr "" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug 파일 읽기 에러: %s" +#~ msgid "syntax spell notoplevel" +#~ msgstr "" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: MAP 항목에 중복된 문자" +#~ msgid "syntax spell default" +#~ msgstr "" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: 잘못된 인자: %s" +#~ msgid "syntax iskeyword " +#~ msgstr "" #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: 이런 구문 클러스터는 없습니다: %s" -msgid "No Syntax items defined for this buffer" -msgstr "이 버퍼에 대해 정의된 구문 항목이 없습니다" - msgid "syncing on C-style comments" msgstr "C-형식 주석문에 동기맞춤" @@ -5292,10 +5419,17 @@ msgstr "E394: %s에 대한 region 항목을 찾지 못했습니다" msgid "E397: Filename required" msgstr "E397: 파일이름이 필요합니다" +#~ msgid "E847: Too many syntax includes" +#~ msgstr "" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ']' 누락: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']' 뒤에 문자가 더 있음: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' 누락: %s" @@ -5304,6 +5438,9 @@ msgstr "E398: '=' 누락: %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: 충분치 않은 인자: 구문 영역 %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: 구문 클러스터가 너무 많습니다" + msgid "E400: No cluster specified" msgstr "E400: 클러스터가 명시되지 않았습니다" @@ -5346,6 +5483,10 @@ msgstr "E409: 모르는 그룹 이름: %s" msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: 잘못된 :syntax 하위 명령: %s" +#~ msgid "" +#~ " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +#~ msgstr "" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: syncolor.vim 반복 로딩" @@ -5407,6 +5548,9 @@ msgstr "E669: 그룹 이름에 출력할 수 없는 문자가 있습니다" msgid "W18: Invalid character in group name" msgstr "W18: 그룹 이름에 이상한 문자" +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: highlight와 syntax group이 너무 많습니다" + msgid "E555: at bottom of tag stack" msgstr "E555: 태그 스택의 끝입니다" @@ -5467,6 +5611,9 @@ msgstr "태그 파일 %s 찾는 중" msgid "E430: Tag file path truncated for %s\n" msgstr "E430: %s에 대한 태그 파일 경로가 잘렸습니다\n" +msgid "Ignoring long line in tags file" +msgstr "태그 파일의 너무 긴 라인을 무시합니다" + #, c-format msgid "E431: Format error in tags file \"%s\"" msgstr "E431: 태그 파일 \"%s\"에 형식 에러가 있습니다" @@ -5483,9 +5630,6 @@ msgstr "E432: 태그 파일이 정렬되어 있지 않음: %s" msgid "E433: No tags file" msgstr "E433: 태그 파일이 없습니다" -msgid "Ignoring long line in tags file" -msgstr "태그 파일의 너무 긴 라인을 무시합니다" - msgid "E434: Can't find tag pattern" msgstr "E434: 태그 패턴을 찾을 수 없습니다" @@ -5526,6 +5670,9 @@ msgstr "" "\n" "--- 터미널 키 ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txt을 열 수 없습니다" + msgid "new shell started\n" msgstr "새 쉘이 시작되었습니다\n" @@ -5537,8 +5684,8 @@ msgstr "빈 고르기 대신 CUT_BUFFER0을 사용했습니다" #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: 줄 갯수가 모르는 사이에 바뀌었습니다" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: 행 갯수가 갑자기 바뀌었습니다" #. must display the prompt msgid "No undo possible; continue anyway" @@ -5648,38 +5795,158 @@ msgstr "changes" msgid "%ld %s; %s #%ld %s" msgstr "%ld %s; %s #%ld %s" -msgid "before" -msgstr "before" +msgid "before" +msgstr "before" + +msgid "after" +msgstr "after" + +msgid "Nothing to undo" +msgstr "취소할 게 없습니다" + +#~ msgid "number changes when saved" +#~ msgstr "" + +#, c-format +msgid "%ld seconds ago" +msgstr "%ld seconds ago" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undo 뒤에 undojoin은 할 수 없습니다" + +msgid "E439: undo list corrupt" +msgstr "E439: undo 목록이 깨졌습니다" + +msgid "E440: undo line missing" +msgstr "E440: undo 줄이 없습니다" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: 함수 %s이(가) 이미 있습니다, 바꾸려면 !을 더하세요" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: 이미 Dictionary 항목이 있습니다" + +msgid "E718: Funcref required" +msgstr "E718: Funcref가 필요합니다" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: 모르는 함수: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: 잘못된 인자: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: 중복된 인자 이름: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: 함수 %s에 너무 많은 인자가 전달되었습니다" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: 함수 %s(으)로 잘못된 인자가 넘겨졌습니다" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: 함수를 부른 깊이가 'maxfuncdepth'보다 큽니다" + +#, c-format +msgid "calling %s" +msgstr "%s 부르는 중" + +#, c-format +msgid "%s aborted" +msgstr "%s이(가) 중지되었습니다" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s이(가) #%ld을(를) 돌려주었습니다" + +#, c-format +msgid "%s returning %s" +msgstr "%s이(가) %s을(를) 돌려주었습니다" + +msgid "E699: Too many arguments" +msgstr "E699: 너무 많은 인자" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: 모르는 함수: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: 함수가 삭제됨: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: 함수에 적은 인자 넘김: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: 스크립트 콘텍스트 밖에서 <SID> 사용: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Dictionary없이 사전함수가 불려짐: %s" + +msgid "E129: Function name required" +msgstr "E129: 함수 이름이 필요합니다" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: 함수 이름은 대문자 혹은 \"s:\"로 시작해야 함: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: 함수 이름은 콜론을 포함할 수 없음: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: 정의 안 된 함수: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '('가 없음: %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: 여기에서 g:을 사용할 수 없습니다" + +#, c-format +#~ msgid "E932: Closure function should not be at top level: %s" +#~ msgstr "" -msgid "after" -msgstr "after" +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction이 없습니다" -msgid "Nothing to undo" -msgstr "취소할 게 없습니다" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction 뒤에 문자열이 있음: %s" -#~ msgid "number changes when saved" -#~ msgstr "" +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: 함수명이 변수명과 충돌: %s" #, c-format -msgid "%ld seconds ago" -msgstr "%ld seconds ago" +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: 함수 %s을(를) 다시 정의할 수 없습니다: 사용중입니다" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undo 뒤에 undojoin은 할 수 없습니다" +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: 함수명이 스크립트 파일명과 다름: %s" -msgid "E439: undo list corrupt" -msgstr "E439: undo 목록이 깨졌습니다" +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: 함수 %s을(를) 지울 수 없습니다: 사용중입니다" -msgid "E440: undo line missing" -msgstr "E440: undo 줄이 없습니다" +msgid "E133: :return not inside a function" +msgstr "E133: :return이 함수 안에 있지 않습니다" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16/32 비트 GUI 판" +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: 괄호 없음: %s" msgid "" "\n" @@ -5695,9 +5962,6 @@ msgstr "" "\n" "MS-Windows 32비트 GUI 버젼" -msgid " in Win32s mode" -msgstr " Win32s 상태" - msgid " with OLE support" msgstr " OLE 지원" @@ -5715,27 +5979,6 @@ msgstr "" "\n" "MS-Windows 32비트 콘솔 버젼" -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16비트 버젼" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32비트 MS-DOS 버젼" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16비트 MS-DOS 버젼" - msgid "" "\n" "MacOS X (unix) version" @@ -5757,13 +6000,6 @@ msgstr "" "\n" "MacOS 버젼" -msgid "" -"\n" -"RISC OS version" -msgstr "" -"\n" -"RISC OS 버젼" - msgid "" "\n" "OpenVMS version" @@ -5836,6 +6072,9 @@ msgstr "" msgid "without GUI." msgstr "GUI 없음." +msgid "with GTK3 GUI." +msgstr "GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "GTK2-GNOME GUI." @@ -5899,6 +6138,9 @@ msgstr "사용자 두 번째 gvimrc 파일: \"" msgid "3rd user gvimrc file: \"" msgstr "사용자 세 번째 gvimrc 파일: \"" +msgid " defaults file: \"" +msgstr " defaults 파일: \"" + msgid " system menu file: \"" msgstr " 시스템 메뉴 파일: \"" @@ -5930,7 +6172,7 @@ msgid "by Bram Moolenaar et al." msgstr "by Bram Moolenaar et al." msgid "Vim is open source and freely distributable" -msgstr "빔은 소스가 열려 있고 공짜로 배포됩니다" +msgstr "빔은 누구나 소스를 볼 수 있고 공짜로 배포됩니다" msgid "Help poor children in Uganda!" msgstr "우간다에 사는 가난한 아이를 도와주세요!" @@ -5944,8 +6186,8 @@ msgstr "끝내려면 :q<엔터> 입력" msgid "type :help<Enter> or <F1> for on-line help" msgstr "온라인 도움말을 보려면 :help<엔터> 또는 <F1> 입력" -msgid "type :help version7<Enter> for version info" -msgstr "판 정보를 보려면 :help version7<엔터> 입력" +msgid "type :help version8<Enter> for version info" +msgstr "판 정보를 보려면 :help version8<엔터> 입력" msgid "Running in Vi compatible mode" msgstr "Vi 호환 상태로 실행중입니다" @@ -5989,12 +6231,6 @@ msgstr "이에 대한 정보를 보려면 :help register<엔터> 입력" msgid "menu Help->Sponsor/Register for information " msgstr "이에 대한 정보를 보려면 메뉴 도움말->Sponsor/Register" -msgid "WARNING: Windows 95/98/ME detected" -msgstr "경고: 윈도우즈 95/98/ME를 찾았음" - -msgid "type :help windows95<Enter> for info on this" -msgstr "이에 대한 정보를 보려면 :help windows95<엔터> 입력" - msgid "Already only one window" msgstr "이미 하나의 창만 있습니다" @@ -6026,6 +6262,25 @@ msgstr "E446: 커서 밑에 파일 이름이 없습니다" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: path에서 \"%s\" 파일을 찾을 수 없습니다" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: 비정상적인 ID: %ld (1보다 크거나 같아야 합니다)" + +#, c-format +#~ msgid "E801: ID already taken: %ld" +#~ msgstr "" + +msgid "List or number required" +msgstr "List나 number가 필요합니다" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: 비정상적인 ID: %ld (1보다 크거나 같아야 합니다)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID를 찾을 수 없음: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s 라이브러리를 로드할 수 없습니다" @@ -6128,6 +6383,10 @@ msgstr "E236: 글꼴 \"%s\"은(는) 고정넓이가 아닙니다" msgid "E473: Internal error" msgstr "E473: 내부 에러" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: 내부 에러: %s" + msgid "Interrupted" msgstr "중단되었습니다" @@ -6256,6 +6515,9 @@ msgstr "E485: %s 파일을 읽을 수 없습니다" msgid "E37: No write since last change (add ! to override)" msgstr "E37: 마지막으로 고친 뒤 저장되지 않았습니다 (무시하려면 ! 더하기)" +msgid "E37: No write since last change" +msgstr "E37: 마지막으로 고친 뒤 저장하지 않았습니다" + msgid "E38: Null argument" msgstr "E38: 널 인자" @@ -6308,6 +6570,31 @@ msgstr "E46: 읽기 전용 변수 \"%s\"을(를) 바꿀 수 없습니다" msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: sandbox 안에서는 변수를 설정할 수 없음: \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Dictionary에 빈 키를 쓸 수 없습니다" + +msgid "E715: Dictionary required" +msgstr "E715: Dictionary가 필요합니다" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: 목록 번호가 범위를 벗어남: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: 함수에 너무 많은 인자 넘김: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Dictionary에 키가 없음: %s" + +msgid "E714: List required" +msgstr "E714: List가 필요합니다" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s 인자는 List 혹은 Dictionary여야 합니다" + msgid "E47: Error while reading errorfile" msgstr "E47: 에러파일 읽는 도중에 에러" @@ -6365,8 +6652,8 @@ msgstr "E592: 'winwidth'는 'winminwidth'보다 커야 합니다" msgid "E80: Error while writing" msgstr "E80: 쓰는 중에 에러" -msgid "Zero count" -msgstr "Zero count" +#~ msgid "E939: Positive count required" +#~ msgstr "" msgid "E81: Using <SID> not in a script context" msgstr "E81: 스크립트 콘텍스트 밖에서 <SID> 사용" @@ -6380,16 +6667,16 @@ msgstr "E463: 영역이 보호되고 있어서 수정할 수 없습니다" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans는 읽기 전용 파일을 바꿀 수 없습니다" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: 내부 에러: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: 패턴이 'maxmempattern'보다 많은 메모리를 사용합니다" msgid "E749: empty buffer" msgstr "E749: 빈 버퍼" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: 버퍼 %ld이(가) 존재하지 않습니다" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: 잘못된 찾기 패턴 혹은 구분자" @@ -6400,6 +6687,13 @@ msgstr "E139: 파일이 다른 버퍼에 로딩되어 있습니다" msgid "E764: Option '%s' is not set" msgstr "E764: 옵션 '%s'이(가) 설정되어 있지 않습니다" +msgid "E850: Invalid register name" +msgstr "E850: 잘못된 레지스터 이름" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: '%s'에서 디렉토리를 못찾음: \"%s\"" + msgid "search hit TOP, continuing at BOTTOM" msgstr "처음까지 찾았음, 끝에서 계속" @@ -6410,38 +6704,250 @@ msgstr "끝까지 찾았음, 처음부터 계속" msgid "Need encryption key for \"%s\"" msgstr "\"%s\"에 대한 암호 키가 필요합니다" -msgid "writelines() requires list of strings" -msgstr "writelines()는 문자열 목록이 필요합니다" +msgid "empty keys are not allowed" +msgstr "빈 키 값은 허용되지 않습니다" + +msgid "dictionary is locked" +msgstr "dictionary가 잠겨있습니다" + +msgid "list is locked" +msgstr "list가 잠겨있습니다" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "dictionary에 '%s' 키를 추가할 수 없습니다" + +#, c-format +#~ msgid "index must be int or slice, not %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected str() or unicode() instance, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected bytes() or str() instance, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "" +#~ "expected int(), long() or something supporting coercing to long(), but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected int() or something supporting coercing to int(), but got %s" +#~ msgstr "" + +msgid "value is too large to fit into C int type" +msgstr "값이 C 정수 형식 대비하여 너무 큽니다" + +msgid "value is too small to fit into C int type" +msgstr "값이 C 정수 형식 대비하여 너무 작습니다" + +msgid "number must be greater than zero" +msgstr "값이 0보다 커야 합니다" + +msgid "number must be greater or equal to zero" +msgstr "값이 0보다 크거나 같아야 합니다" + +msgid "can't delete OutputObject attributes" +msgstr "OutputObject 속성을 지울 수 없습니다" + +#, c-format +msgid "invalid attribute: %s" +msgstr "잘못된 속성: %s" msgid "E264: Python: Error initialising I/O objects" msgstr "E264: 파이썬: I/O 객체 초기화중 에러가 생겼습니다" -msgid "no such buffer" -msgstr "그런 버퍼는 없습니다" +msgid "failed to change directory" +msgstr "디렉토리를 바꿀 수 없습니다" -msgid "attempt to refer to deleted window" -msgstr "지워진 창을 참조하려고 하였습니다" +#, c-format +#~ msgid "expected 3-tuple as imp.find_module() result, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +#~ msgstr "" -msgid "readonly attribute" -msgstr "읽기 전용 속성" +#~ msgid "internal error: imp.find_module returned tuple with NULL" +#~ msgstr "" -msgid "cursor position outside buffer" -msgstr "퍼서 위치가 버퍼 밖에 있습니다" +msgid "cannot delete vim.Dictionary attributes" +msgstr "vim.Dictionary 속성을 삭제할 수 없습니다" + +msgid "cannot modify fixed dictionary" +msgstr "fixed dictionary를 수정할 수 없습니다" + +#, c-format +msgid "cannot set attribute %s" +msgstr "속성 %s을(를) 설정할 수 없습니다" + +#~ msgid "hashtab changed during iteration" +#~ msgstr "" + +#, c-format +#~ msgid "expected sequence element of size 2, but got sequence of size %d" +#~ msgstr "" + +#~ msgid "list constructor does not accept keyword arguments" +#~ msgstr "" + +msgid "list index out of range" +msgstr "list 색인이 범위를 벗어났습니다" + +#. No more suitable format specifications in python-2.3 +#, c-format +#~ msgid "internal error: failed to get vim list item %d" +#~ msgstr "" + +#~ msgid "slice step cannot be zero" +#~ msgstr "" + +#, c-format +#~ msgid "attempt to assign sequence of size greater than %d to extended slice" +#~ msgstr "" + +#, c-format +#~ msgid "internal error: no vim list item %d" +#~ msgstr "" + +#~ msgid "internal error: not enough list items" +#~ msgstr "" + +#~ msgid "internal error: failed to add item to list" +#~ msgstr "" + +#, c-format +#~ msgid "attempt to assign sequence of size %d to extended slice of size %d" +#~ msgstr "" + +#~ msgid "failed to add item to list" +#~ msgstr "" + +msgid "cannot delete vim.List attributes" +msgstr "vim.List 속성을 삭제할 수 없습니다" + +#~ msgid "cannot modify fixed list" +#~ msgstr "" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "이름없는 함수 %s이(가) 존재하지 않습니다" + +#, c-format +msgid "function %s does not exist" +msgstr "함수 %s이(가) 존재하지 않습니다" #, c-format -msgid "<window object (deleted) at %p>" -msgstr "<%p에 창 객체 (삭제됨)>" +msgid "failed to run function %s" +msgstr "함수 %s을(를) 실행할 수 없습니다" + +msgid "unable to get option value" +msgstr "옵션 값을 얻을 수 없습니다" + +#~ msgid "internal error: unknown option type" +#~ msgstr "" + +#~ msgid "problem while switching windows" +#~ msgstr "" #, c-format -msgid "<window object (unknown) at %p>" -msgstr "<%p에 창 객체 (모름)>" +#~ msgid "unable to unset global option %s" +#~ msgstr "" #, c-format -msgid "<window %d>" -msgstr "<창 %d>" +#~ msgid "unable to unset option %s which does not have global value" +#~ msgstr "" + +msgid "attempt to refer to deleted tab page" +msgstr "지워진 탭 페이지를 참조하려고 하였습니다" + +msgid "no such tab page" +msgstr "그런 탭 페이지가 없습니다" + +msgid "attempt to refer to deleted window" +msgstr "지워진 창을 참조하려고 하였습니다" + +msgid "readonly attribute: buffer" +msgstr "읽기 전용 속성: 버퍼" + +msgid "cursor position outside buffer" +msgstr "퍼서 위치가 버퍼 밖에 있습니다" msgid "no such window" msgstr "그런 창은 없습니다" msgid "attempt to refer to deleted buffer" msgstr "지워진 버퍼를 참조하려고 하였습니다" + +msgid "failed to rename buffer" +msgstr "버퍼 이름을 변경할 수 없습니다" + +#~ msgid "mark name must be a single character" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.Buffer object, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "failed to switch to buffer %d" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.Window object, but got %s" +#~ msgstr "" + +#~ msgid "failed to find window in the current tab page" +#~ msgstr "" + +#~ msgid "did not switch to the specified window" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.TabPage object, but got %s" +#~ msgstr "" + +#~ msgid "did not switch to the specified tab page" +#~ msgstr "" + +#~ msgid "failed to run the code" +#~ msgstr "" + +#~ msgid "E858: Eval did not return a valid python object" +#~ msgstr "" + +#~ msgid "E859: Failed to convert returned python object to vim value" +#~ msgstr "" + +#, c-format +#~ msgid "unable to convert %s to vim dictionary" +#~ msgstr "" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s을(를) vim list로 변경할 수 없습니다" + +#, c-format +#~ msgid "unable to convert %s to vim structure" +#~ msgstr "" + +#~ msgid "internal error: NULL reference passed" +#~ msgstr "" + +#~ msgid "internal error: invalid value type" +#~ msgstr "" + +#~ msgid "" +#~ "Failed to set path hook: sys.path_hooks is not a list\n" +#~ "You should now do the following:\n" +#~ "- append vim.path_hook to sys.path_hooks\n" +#~ "- append vim.VIM_SPECIAL_PATH to sys.path\n" +#~ msgstr "" + +#~ msgid "" +#~ "Failed to set path: sys.path is not a list\n" +#~ "You should now append vim.VIM_SPECIAL_PATH to sys.path" +#~ msgstr "" diff --git a/src/po/ko.po b/src/po/ko.po index efe4f5d2b9..ddddf3451d 100644 --- a/src/po/ko.po +++ b/src/po/ko.po @@ -4,12 +4,12 @@ # msgid "" msgstr "" -"Project-Id-Version: vim 7.3\n" +"Project-Id-Version: vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-16 16:18+0900\n" -"PO-Revision-Date: 2010-02-18 09:49+0900\n" +"POT-Creation-Date: 2017-07-12 14:52+0900\n" +"PO-Revision-Date: 2017-07-12 18:56+0900\n" "Last-Translator: SungHyun Nam <goweol@gmail.com>\n" -"Language-Team: GTP Korean <gnome-kr-translation@gnome.or.kr>\n" +"Language-Team: GTP Korean\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=euc-kr\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,12 +35,21 @@ msgstr "[ msgid "[Quickfix List]" msgstr "[Quickfix ]" +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Autocommand ߴܵǾϴ" + msgid "E82: Cannot allocate any buffer, exiting..." msgstr "E82: ۸ Ҵ  ϴ..." msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: ۸ Ҵ  ٸ մϴ..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: ۸ ߽ϴ" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: ۸ Ϸ ߽ϴ" + msgid "E515: No buffers were unloaded" msgstr "E515: ۰ ϴ" @@ -71,6 +80,9 @@ msgstr " msgid "%d buffers wiped out" msgstr " %d ϴ" +msgid "E90: Cannot unload last buffer" +msgstr "E90: ۸ ϴ" + msgid "E84: No modified buffer found" msgstr "E84: ٲ ۸ ã ϴ" @@ -78,10 +90,6 @@ msgstr "E84: msgid "E85: There is no listed buffer" msgstr "E85: ۰ ϴ" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: %ld() ʽϴ" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Դϴ" @@ -94,9 +102,6 @@ msgstr "" "E89: %ld() ģ ʾҽϴ ( ! " ")" -msgid "E90: Cannot unload last buffer" -msgstr "E90: ۸ ϴ" - msgid "W14: Warning: List of file names overflow" msgstr "W14: : ̸ ƽϴ" @@ -131,6 +136,9 @@ msgstr "[ msgid "[Read errors]" msgstr "[б ]" +msgid "[RO]" +msgstr "[б ]" + msgid "[readonly]" msgstr "[б ]" @@ -193,9 +201,100 @@ msgstr "%s msgid " line=%ld id=%d name=%s" msgstr " =%ld id=%d ̸=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Ʈ ϴ" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: channel_open() gethostbyname()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: channel_open() socket()" + +msgid "E903: received command with non-string argument" +msgstr "E903: ڿ ƴ ڸ ߽ϴ" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: expr/call ڴ ڿ մϴ" + +msgid "E904: third argument for call must be a list" +msgstr "E904: 3° ڴ list մϴ" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: 𸣴 : %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): ʾҴ " + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): Ⱑ ߽ϴ" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s() callback ϴ" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: raw Ȥ nl äο ch_evalexpr()/ch_sendexpr() ϴ" + +msgid "E906: not an open channel" +msgstr "E906: ä ƴմϴ" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io Ϸ _name ʿմϴ" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io ۴ Ϸ in_buf in_name ʿմϴ" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: %ld ̻ ۿ ؼ diff ϴ" +msgid "E918: buffer must be loaded: %s" +msgstr "E918: ۰ εǾ մϴ: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: 𸣴 ȣȭǾ ֽϴ" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr ": ȣ ; :help 'cm' Ȯϼ" + +msgid "Enter encryption key: " +msgstr "ȣ Ű Է: " + +msgid "Enter same key again: " +msgstr " Ű ٽ Է: " + +msgid "Keys don't match!" +msgstr "Ű ʽϴ!" + +msgid "[crypted]" +msgstr "[ȣȭ Ǿϴ]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Dictionary ݷ : %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Dictionary ߺ Ű: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Dictionary ޸ : %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Dictionary '}' : %s" + +msgid "extend() argument" +msgstr "extend() " + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Ű ̹ : %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: ۸ %ld ̻ ϴ" msgid "E810: Cannot read or write temp files" msgstr "E810: ӽ аų ϴ" @@ -323,6 +422,9 @@ msgstr "ã msgid "Scanning tags." msgstr "± ã ." +#~ msgid "match in file" +#~ msgstr "" + msgid " Adding" msgstr " ϱ" @@ -350,13 +452,10 @@ msgstr "match %d of %d" msgid "match %d" msgstr "match %d" +#. maximum nesting of lists and dicts msgid "E18: Unexpected characters in :let" msgstr "E18: ':let' 𸣴 " -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: ȣ : %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: : %s" @@ -364,41 +463,6 @@ msgstr "E121: msgid "E111: Missing ']'" msgstr "E111: ']' ϴ" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s ڴ List̾ մϴ" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s ڴ List Ȥ Dictionary մϴ" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Dictionary Ű ϴ" - -msgid "E714: List required" -msgstr "E714: List ʿմϴ" - -msgid "E715: Dictionary required" -msgstr "E715: Dictionary ʿմϴ" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Լ ʹ ѱ: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Dictionary Ű : %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Լ %s() ̹ ֽϴ, ٲٷ ! ϼ" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: ̹ Dictionary ׸ ֽϴ" - -msgid "E718: Funcref required" -msgstr "E718: Funcref ʿմϴ" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Dictionary [:] ϴ" @@ -406,14 +470,13 @@ msgstr "E719: Dictionary msgid "E734: Wrong variable type for %s=" msgstr "E734: %s= ߸ " -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: 𸣴 Լ: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: : %s" +msgid "E806: using Float as a String" +msgstr "E806: Float String " + msgid "E687: Less targets than List items" msgstr "E687: List ׸񺸴 " @@ -445,14 +508,16 @@ msgstr "E711: List msgid "E690: Missing \"in\" after :for" msgstr "E690: :for ڿ \"in\" ϴ" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: ȣ : %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: ̷ : \"%s\"" +#. For historic reasons this error is not given for a list or dict. +#. * E.g., the b: dict could be locked/unlocked. +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: %s() Ȥ ϴ" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: ()ϱ⿡ ʹ øǾϴ" @@ -471,9 +536,6 @@ msgstr "E735: Dictionary msgid "E736: Invalid operation for Dictionary" msgstr "E736: Dictionary ߸ " -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Funcref Funcref͸ ֽϴ" - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Funcrefs ߸ " @@ -486,6 +548,9 @@ msgstr "E110: ')' msgid "E695: Cannot index a Funcref" msgstr "E695: Funcref ϴ" +msgid "E909: Cannot index a special variable" +msgstr "E909: Ư ϴ" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: ɼ ̸ : %s" @@ -502,62 +567,121 @@ msgstr "E114: msgid "E115: Missing quote: %s" msgstr "E115: ǥ : %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: List ޸ : %s" +#~ msgid "Not enough memory to set references, garbage collection aborted!" +#~ msgstr "" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: List ']' : %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: ǥϱ⿡ ʹ øǾϴ" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Dictionary ݷ : %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float Number " -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Dictionary ߺ Ű: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref Number " -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Dictionary ޸ : %s" +msgid "E745: Using a List as a Number" +msgstr "E745: List Number " -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Dictionary '}' : %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dictionary Number " -msgid "E724: variable nested too deep for displaying" -msgstr "E724: ǥϱ⿡ ʹ øǾϴ" +msgid "E910: Using a Job as a Number" +msgstr "E910: Job Number ϰ ֽϴ" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel Number ϰ ֽϴ" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref Float ϰ ֽϴ" + +msgid "E892: Using a String as a Float" +msgstr "E892: String Float ϰ ֽϴ" + +msgid "E893: Using a List as a Float" +msgstr "E893: List Float ϰ ֽϴ" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dictionary Float ϰ ֽϴ" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Ư Float ϰ ֽϴ" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job Float ϰ ֽϴ" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Channel Float ϰ ֽϴ" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref String " + +msgid "E730: using List as a String" +msgstr "E730: List String " + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dictionary String " + +msgid "E908: using an invalid value as a String" +msgstr "E908: ߸ String ϰ ֽϴ" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Լ %s ʹ ڰ ޵Ǿϴ" +msgid "E795: Cannot delete variable %s" +msgstr "E795: %s ϴ" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Լ %s() ߸ ڰ Ѱϴ" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Funcref 빮ڷ ؾ : %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: 𸣴 Լ: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: ̹ ִ Լ 浹: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Լ ѱ: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: : %s" + +msgid "Unknown" +msgstr "" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: ũƮ ؽƮ ۿ <SID> : %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s ٲ ϴ" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: ϱ⿡ ʹ øǾϴ" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# :\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tLast set from " + +msgid "map() argument" +msgstr "map() " + +msgid "filter() argument" +msgstr "filter() " #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Dictionary Լ ҷ: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s ڴ List̾ մϴ" + +msgid "E928: String required" +msgstr "E928: String ʿմϴ" msgid "E808: Number or Float required" msgstr "E808: Number Ȥ Float ʿմϴ" -msgid "E699: Too many arguments" -msgstr "E699: ʹ " +msgid "add() argument" +msgstr "add() " msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() Է 忡 ֽϴ" @@ -570,18 +694,16 @@ msgstr "E785: complete() msgid "&Ok" msgstr "Ȯ(&O)" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Ű ̹ : %s" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld : " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: 𸣴 Լ: %s" +msgid "E922: expected a dict" +msgstr "E922: dict 䱸˴ϴ" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function() ι° ڴ list dict̾ մϴ" + msgid "" "&OK\n" "&Cancel" @@ -592,180 +714,87 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "inputrestore() inputsave() ҷϴ" +msgid "insert() argument" +msgstr "insert() " + msgid "E786: Range not allowed" msgstr "E786: ʽϴ" -msgid "E701: Invalid type for len()" -msgstr "E701: len() ߸ " - -msgid "E726: Stride is zero" -msgstr "E726: Stride 0" - -msgid "E727: Start past end" -msgstr "E727: ġ ħ" - -msgid "<empty>" -msgstr "<>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim Ǿ ʽϴ" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s() ϴ" - -msgid "E277: Unable to read a server reply" -msgstr "E277: ϴ" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: ʹ ɺ ũ (ݺȯ?)" - -msgid "E258: Unable to send to client" -msgstr "E258: Ŭ̾Ʈ ϴ" - -msgid "E702: Sort compare function failed" -msgstr "E702: ߽ϴ" - -msgid "(Invalid)" -msgstr "(߸Ǿϴ)" - -msgid "E677: Error writing temp file" -msgstr "E677: ӽ " - -msgid "E805: Using a Float as a Number" -msgstr "E805: Float Number " - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref Number " - -msgid "E745: Using a List as a Number" -msgstr "E745: List Number " - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Dictionary Number " - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref String " - -msgid "E730: using List as a String" -msgstr "E730: List String " - -msgid "E731: using Dictionary as a String" -msgstr "E731: Dictionary String " - -msgid "E806: using Float as a String" -msgstr "E806: Float String " - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funcref 빮ڷ ؾ : %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: ̹ ִ Լ 浹: %s" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: ٸ: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: %s ϴ" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: : %s" - -msgid "Unknown" -msgstr "" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s ٲ ϴ" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: ϱ⿡ ʹ øǾϴ" +msgid "E916: not a valid job" +msgstr "E916: job ƴմϴ" -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Լ: %s" +msgid "E701: Invalid type for len()" +msgstr "E701: len() ߸ " #, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' : %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID \":match\" : %ld" -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: ߸ : %s" +msgid "E726: Stride is zero" +msgstr "E726: Stride 0" -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction ϴ" +msgid "E727: Start past end" +msgstr "E727: ġ ħ" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Լ 浹: %s" +msgid "<empty>" +msgstr "<>" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Լ %s() ٽ ϴ: Դϴ" +msgid "E240: No connection to the X server" +msgstr "E240: X Ǿ ʽϴ" #, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Լ ũƮ ϸ ٸ: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s() ϴ" -msgid "E129: Function name required" -msgstr "E129: Լ ̸ ʿմϴ" +msgid "E277: Unable to read a server reply" +msgstr "E277: ϴ" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: Լ ̸ 빮ڷ ϰų ݷ ؾ : %s" +msgid "E941: already started a server" +msgstr "E941: ̹ ۵Ǿϴ" -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Լ %s() ϴ: Դϴ" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver Ե ʾҽϴ" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Լ θ ̰ 'maxfuncdepth' Ůϴ" +msgid "remove() argument" +msgstr "remove() " -#, c-format -msgid "calling %s" -msgstr "%s θ " +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: ʹ ɺ ũ (ݺȯ?)" -#, c-format -msgid "%s aborted" -msgstr "%s() Ǿϴ" +msgid "reverse() argument" +msgstr "reverse() " -#, c-format -msgid "%s returning #%ld" -msgstr "%s() #%ld() ־ϴ" +msgid "E258: Unable to send to client" +msgstr "E258: Ŭ̾Ʈ ϴ" #, c-format -msgid "%s returning %s" -msgstr "%s() %s() ־ϴ" +msgid "E927: Invalid action: '%s'" +msgstr "E927: : '%s'" -#, c-format -msgid "continuing in %s" -msgstr "%s " +msgid "sort() argument" +msgstr "sort() " -msgid "E133: :return not inside a function" -msgstr "E133: :return Լ ȿ ʽϴ" +msgid "uniq() argument" +msgstr "uniq() " -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# :\n" +msgid "E702: Sort compare function failed" +msgstr "E702: ߽ϴ" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tLast set from " +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq Լ Ͽϴ" -msgid "No old files" -msgstr "old ϴ" +msgid "(Invalid)" +msgstr "()" + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: submatch number: %d" + +msgid "E677: Error writing temp file" +msgstr "E677: ӽ " + +msgid "E921: Invalid callback argument" +msgstr "E921: ݹ " #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" @@ -827,6 +856,10 @@ msgstr " msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Viminfo ϴ: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: ʹ viminfo ӽ ϵ, %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Viminfo %s() ϴ!" @@ -835,6 +868,10 @@ msgstr "E138: Viminfo msgid "Writing viminfo file \"%s\"" msgstr "Viminfo \"%s\"() " +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo ϸ %s() ϴ!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -853,6 +890,11 @@ msgstr "# msgid "Illegal starting char" msgstr "̻ " +#~ msgid "" +#~ "\n" +#~ "# Bar lines, copied verbatim:\n" +#~ msgstr "" + msgid "Save As" msgstr "ٸ ̸ " @@ -947,8 +989,9 @@ msgstr " msgid " on %ld lines" msgstr " %ld ٿ" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global ȣ ϴ" +#. will increment global_busy to break out of the loop +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global ȣ ϴ" msgid "E148: Regular expression missing from global" msgstr "E148: global ǥ ϴ" @@ -957,6 +1000,10 @@ msgstr "E148: global msgid "Pattern found in every line: %s" msgstr " ٿ ãҽϴ: %s" +#, c-format +msgid "Pattern not found: %s" +msgstr " ã : %s" + msgid "" "\n" "# Last Substitute String:\n" @@ -982,8 +1029,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "̾մϴ, \"%s\"() ã ϴ" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: 丮 ƴ: %s" +msgid "E151: No match: %s" +msgstr "E151: : %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1001,6 +1048,10 @@ msgstr "E670: msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: \"%s\" ±װ %s/%s Ͽ ߺǾϴ" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: 丮 ƴ: %s" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: 𸣴 sign : %s" @@ -1026,10 +1077,17 @@ msgstr "E159: sign msgid "E158: Invalid buffer name: %s" msgstr "E158: ߸ ̸: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: ̸ ۷δ ϴ" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ߸ sign ID: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: sign %s() ٲ ϴ" + msgid " (NOT FOUND)" msgstr " ( ã)" @@ -1039,6 +1097,9 @@ msgstr " ( msgid "[Deleted]" msgstr "[ϴ]" +msgid "No old files" +msgstr "old ϴ" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr " · . Ϸ \"cont\" ԷϽʽÿ." @@ -1050,6 +1111,13 @@ msgstr "%ld msgid "cmd: %s" msgstr ": %s" +msgid "frame is zero" +msgstr " 0" + +#, c-format +msgid "frame at highest level: %d" +msgstr " ܰ: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr ": \"%s%s\" %ld " @@ -1104,8 +1172,16 @@ msgid "Searching for \"%s\"" msgstr "\"%s\"() ã " #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "'runtimepath' ã : \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' ã : \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: 䱸Ǵ ̼ 2.x , : %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: 䱸Ǵ ̼ 3.x , : %s" msgid "Source Vim script" msgstr " ũƮ ε" @@ -1134,8 +1210,12 @@ msgstr "%ld msgid "finished sourcing %s" msgstr "%s ҷ̱ " -#~ msgid "modeline" -#~ msgstr "" +#, c-format +msgid "continuing in %s" +msgstr "%s " + +msgid "modeline" +msgstr "modeline" msgid "--cmd argument" msgstr "--cmd " @@ -1200,6 +1280,9 @@ msgstr " msgid "E494: Use w or w>>" msgstr "E494: w w>> Ͻʽÿ" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: ̺ ʿ, 'make cmdidxs' ϼ" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: ̾մϴ, ǿ ϴ" @@ -1225,10 +1308,10 @@ msgstr "E174: msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" ̸ ϼ " +" ̸ ּ ϼ " msgid "No user-defined commands found" msgstr " ã ϴ" @@ -1248,6 +1331,9 @@ msgstr "E178: msgid "E179: argument required for -complete" msgstr "E179: -complete ڰ ʿմϴ" +msgid "E179: argument required for -addr" +msgstr "E179: -addr ڰ ʿմϴ" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: ߸ Ӽ: %s" @@ -1265,6 +1351,10 @@ msgstr "E841: msgid "E184: No such user-defined command: %s" msgstr "E184: ׷ : %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ߸ ּ : %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: ߸ : %s" @@ -1279,7 +1369,7 @@ msgid "unknown" msgstr "" #, c-format -msgid "E185: Cannot find color scheme %s" +msgid "E185: Cannot find color scheme '%s'" msgstr "E185: Ŵ %s() ã ϴ" msgid "Greetings, Vim user!" @@ -1326,6 +1416,9 @@ msgstr "E188: msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos ΰ ڰ ʿմϴ" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: execute() :redir ϴ" + msgid "Save Redirection" msgstr "𷺼 " @@ -1522,7 +1615,7 @@ msgstr "" "# %s 丮 (ͺ ):\n" msgid "Command Line" -msgstr " " +msgstr " " msgid "Search String" msgstr "ã ڿ" @@ -1531,7 +1624,10 @@ msgid "Expression" msgstr "ǥ" msgid "Input Line" -msgstr "Է " +msgstr "Է " + +msgid "Debug Line" +msgstr " " msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar ̸ ϴ" @@ -1594,9 +1690,6 @@ msgstr "[ #~ msgid "[character special]" #~ msgstr "" -msgid "[RO]" -msgstr "[б ]" - msgid "[CR missing]" msgstr "[CR ]" @@ -1609,9 +1702,6 @@ msgstr "[ msgid "[converted]" msgstr "[ȯ Ǿϴ]" -msgid "[crypted]" -msgstr "[ȣȭ Ǿϴ]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[%ld ٿ ȯ ]" @@ -1632,9 +1722,6 @@ msgstr "'charconvert' msgid "can't read output of 'charconvert'" msgstr "'charconvert' ° ϴ" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: 𸣴 ȣȭǾ ֽϴ" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwrite ۿ autocommand ã ϴ" @@ -1783,11 +1870,6 @@ msgstr "1 msgid "%lld characters" msgstr "%lld " -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld " - msgid "[noeol]" msgstr "[noeol]" @@ -1880,6 +1962,12 @@ msgstr "autocommand msgid "E367: No such group: \"%s\"" msgstr "E367: ̷ ׷ : \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: ׷ ϴ" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: augroup Ϸ մϴ" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: * ڿ ̻ : %s" @@ -1940,10 +2028,6 @@ msgstr "E350: msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: 'foldmethod' ⸦ ϴ" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld " - msgid "E222: Add to read buffer" msgstr "E222: ۿ ϱ" @@ -1975,6 +2059,12 @@ msgstr " msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: ̻ " +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: ο GUI μ ϴ" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: ڽ μ GUI ߽ϴ" + msgid "E229: Cannot start the GUI" msgstr "E229: GUI ϴ" @@ -2029,6 +2119,18 @@ msgstr " msgid "E232: Cannot create BalloonEval with both message and callback" msgstr "E232: ޽ ݹ θ ؼ BalloonEval ϴ" +msgid "_Cancel" +msgstr "(_C)" + +msgid "_Save" +msgstr "(_S)" + +msgid "_Open" +msgstr "(_O)" + +msgid "_OK" +msgstr "Ȯ(_O)" + msgid "" "&Yes\n" "&No\n" @@ -2038,6 +2140,12 @@ msgstr "" "ƴϿ(&N)\n" "(&C)" +msgid "Yes" +msgstr "" + +msgid "No" +msgstr "ƴϿ" + msgid "Input _Methods" msgstr "Է (_M)" @@ -2071,23 +2179,23 @@ msgstr " msgid "Down" msgstr "Ʒ" -#. 'Find Next' button msgid "Find Next" msgstr " ã" -#. 'Replace' button msgid "Replace" msgstr "ٲٱ" -#. 'Replace All' button msgid "Replace All" msgstr " ٲٱ" +msgid "_Close" +msgstr "ݱ(_C)" + msgid "Vim: Received \"die\" request from session manager\n" msgstr ": ڷκ \"die\" û ޾ҽϴ\n" -msgid "Close" -msgstr "ݱ" +msgid "Close tab" +msgstr " ݱ" msgid "New tab" msgstr " " @@ -2134,20 +2242,6 @@ msgstr " msgid "&Undo" msgstr "(&U)" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: â \"%s\"() ã ϴ" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: ʴ : \"-%s\": OLE Ͻʽÿ." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDI α׷ ȿ â ϴ" - -msgid "Close tab" -msgstr " ݱ" - msgid "Open tab..." msgstr " ..." @@ -2165,6 +2259,17 @@ msgstr " msgid "Directory\t*.nothing\n" msgstr "丮\t*.nothing\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: â \"%s\"() ã ϴ" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: ʴ : \"-%s\": OLE Ͻʽÿ." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDI α׷ ȿ â ϴ" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" " E458: Ʈ Ҵ ϴ, ߸ ֽϴ" @@ -2182,32 +2287,28 @@ msgid "Font '%s' is not fixed-width" msgstr "۲ '%s'() ̰ ƴմϴ" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: ۲ü ̸: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: ۲ü ̸: %s" #, c-format -msgid "Font0: %s\n" -msgstr "۲0: %s\n" +msgid "Font0: %s" +msgstr "۲0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "۲1: %s\n" +msgid "Font1: %s" +msgstr "۲1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "۲%ld ʺ ۲0 ι谡 ƴմϴ\n" +msgid "Font%ld width is not twice that of font0" +msgstr "۲%ld ʺ ۲0 ι谡 ƴմϴ" #, c-format -msgid "Font0 width: %ld\n" -msgstr "۲0 ʺ: %ld\n" +msgid "Font0 width: %ld" +msgstr "۲0 ʺ: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"۲1 ʺ: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "۲1 ʺ: %ld" #~ msgid "Invalid font specification" #~ msgstr "" @@ -2395,6 +2496,9 @@ msgstr "E566: cscope msgid "E622: Could not fork for cscope" msgstr "E622: cscope fork ϴ" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid ߽ϴ" + msgid "cs_create_connection exec failed" msgstr "cs_create_connection ߽ϴ" @@ -2427,6 +2531,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2437,13 +2542,14 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: ȣ Ҵ ã\n" " c: Լ θ Լ ã\n" " d: Լ ҷ Լ ã\n" " e: egrep ã\n" " f: ã\n" " g: ã\n" -" i: ϴ ϵ ã\n" -" s: C ɺ ã\n" +" i: #includeϴ ϵ ã\n" +" s: C ȣ ã\n" " t: ڿ ã\n" #, c-format @@ -2495,8 +2601,8 @@ msgstr "cscope msgid " # pid database name prepend path\n" msgstr " # pid ͺ̽ ̸ prepend path\n" -#~ msgid "Lua library cannot be loaded." -#~ msgstr "" +msgid "Lua library cannot be loaded." +msgstr "Lua ̺귯 ε ϴ." msgid "cannot save undo information" msgstr "undo ϴ" @@ -2508,14 +2614,21 @@ msgstr "" "E815: ̾մϴ, ϴ, MzScheme ̺귯 ε " " ϴ." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: ̾մϴ, ϴ, MzScheme racket/base " +" ε ϴ." + msgid "invalid expression" msgstr "߸ ǥ" msgid "expressions disabled at compile time" msgstr "ǥ ʵ Ǿϴ" -#~ msgid "hidden option" -#~ msgstr "" +msgid "hidden option" +msgstr " ɼ" msgid "unknown option" msgstr "𸣴 ɼ" @@ -2538,6 +2651,9 @@ msgstr " msgid "string cannot contain newlines" msgstr "ڿ newline ϴ" +#~ msgid "error converting Scheme values to Vim" +#~ msgstr "" + msgid "Vim error: ~a" msgstr "Vim : ~a" @@ -2566,144 +2682,49 @@ msgstr "" "E263: ̾մϴ, ϴ, ̽ ̺귯 ε " " ϴ." -msgid "E659: Cannot invoke Python recursively" -msgstr "E659: Python ȣ ϴ" - -msgid "can't delete OutputObject attributes" -msgstr "OutputObject Ӽ ϴ" - -msgid "softspace must be an integer" -msgstr "softspace ߸ մϴ" - -msgid "invalid attribute" -msgstr "߸ Ӽ" - -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<%p ü ()>" - -msgid "E837: This Vim cannot execute :py3 after using :python" -msgstr "E837: Vim :python Ŀ :py3 ϴ" - -#~ msgid "E265: $_ must be an instance of String" -#~ msgstr "" - -msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: ̾մϴ, ϴ, ̺귯 ε " -"ϴ." - -msgid "E267: unexpected return" -msgstr "E267: return" - -msgid "E268: unexpected next" -msgstr "E268: next" - -msgid "E269: unexpected break" -msgstr "E269: break" - -msgid "E270: unexpected redo" -msgstr "E270: redo" - -#~ msgid "E271: retry outside of rescue clause" -#~ msgstr "" - -msgid "E272: unhandled exception" -msgstr "E272: óʵ " - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: 𸣴 longjmp %d" - -msgid "Toggle implementation/definition" -msgstr " /" - -msgid "Show base class of" -msgstr "... ⺻ Ŭ ֱ" - -#~ msgid "Show overridden member function" -#~ msgstr "" - -#~ msgid "Retrieve from file" -#~ msgstr "" - -#~ msgid "Retrieve from project" -#~ msgstr "" - -#~ msgid "Retrieve from all projects" -#~ msgstr "" - -#~ msgid "Retrieve" -#~ msgstr "" - -#~ msgid "Show source of" -#~ msgstr "" - -#~ msgid "Find symbol" -#~ msgstr "" - -#~ msgid "Browse class" -#~ msgstr "" - -#~ msgid "Show class in hierarchy" -#~ msgstr "" - -#~ msgid "Show class in restricted hierarchy" -#~ msgstr "" - -#~ msgid "Xref refers to" -#~ msgstr "" - -#~ msgid "Xref referred by" -#~ msgstr "" - -#~ msgid "Xref has a" -#~ msgstr "" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: ̾մϴ, ϴ, ̽ Ʈ " +"ε ϴ." -#~ msgid "Xref used by" -#~ msgstr "" +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Python ȣ ϴ" -#~ msgid "Show docu of" -#~ msgstr "" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Vim :python Ŀ :py3 ϴ" -#~ msgid "Generate docu for" -#~ msgstr "" +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ String νϽ̾ մϴ" msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"SNiFF+ ϴ. ȯ ȮϽʽÿ (sniffemacs $PATH ã" -" մϴ).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: д . " - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ is currently " +"E266: ̾մϴ, ϴ, ̺귯 ε " +"ϴ." -msgid "not " -msgstr "not " +msgid "E267: unexpected return" +msgstr "E267: return" -msgid "connected" -msgstr "connected" +msgid "E268: unexpected next" +msgstr "E268: next" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: 𸣴 SNiFF+ û: %s" +msgid "E269: unexpected break" +msgstr "E269: break" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+ " +msgid "E270: unexpected redo" +msgstr "E270: redo" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SniFF+ ʾҽϴ" +#~ msgid "E271: retry outside of rescue clause" +#~ msgstr "" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SniFF+ ۰ ƴմϴ" +msgid "E272: unhandled exception" +msgstr "E272: óʵ " -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: . ϴ" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: 𸣴 longjmp %d" msgid "invalid buffer number" msgstr "߸ ȣ" @@ -2767,12 +2788,6 @@ msgstr "" "E571: ̾մϴ, ϴ, Tcl ̺귯 ε " "ϴ." -msgid "" -"E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "" -"E281: TCL : ڵ尡 ƴѰ!? vim-dev@vim.org " -"ֽʽÿ" - #, c-format msgid "E572: exit code %d" msgstr "E572: ڵ %d" @@ -2793,6 +2808,18 @@ msgstr "E573: msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: νϽ Ʈ Ӽ ߸Ǿ ֽϴ. ϴ!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSON ߺ Ű: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: List ޸ : %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: List ']' : %s" + msgid "Unknown option argument" msgstr "𸣴 ɼ " @@ -2818,12 +2845,12 @@ msgstr "%d msgid "netbeans is not supported with this GUI\n" msgstr " GUI netbeans ʽϴ\n" -msgid "This Vim was not compiled with the diff feature." -msgstr " diff Ǿϴ." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "'-nb' : Ե \n" +msgid "This Vim was not compiled with the diff feature." +msgstr " diff Ǿϴ." + msgid "Attempt to open script file again: \"" msgstr "ũƮ ٽ õ: \"" @@ -2836,6 +2863,9 @@ msgstr " msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: : NetBeans gvim \n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: : Cygwin ͹̳ο ϴ\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr ": : ͹̳η ϴ\n" @@ -2921,25 +2951,28 @@ msgid "-f or --nofork\tForeground: Don't fork when starting GUI" msgstr "-f Ȥ --nofork\t׶: GUI fork " msgid "-v\t\t\tVi mode (like \"vi\")" -msgstr "-v\t\t\tVi (\"vi\" )" +msgstr "-v\t\t\tVi (\"vi\" )" msgid "-e\t\t\tEx mode (like \"ex\")" -msgstr "-e\t\t\tEx (\"ex\" )" +msgstr "-e\t\t\tEx (\"ex\" )" + +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\t Ex " msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\t (ġ) (\"ex\")" +msgstr "-s\t\t\t (ġ) (\"ex\")" msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tDiff (\"vimdiff\" )" +msgstr "-d\t\t\tDiff (\"vimdiff\" )" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\t (\"evim\" , modeless)" +msgstr "-y\t\t\t (\"evim\" , modeless)" msgid "-R\t\t\tReadonly mode (like \"view\")" -msgstr "-R\t\t\tб (\"view\" )" +msgstr "-R\t\t\tб (\"view\" )" msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\tѵ (\"rvim\" )" +msgstr "-Z\t\t\tѵ (\"rvim\" )" msgid "-m\t\t\tModifications (writing files) not allowed" msgstr "-m\t\t\t( ) " @@ -2959,11 +2992,11 @@ msgstr "-C\t\t\tVi ȣȯ: 'compatible'" msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" msgstr "-N\t\t\tVi ȣȯ : 'nocompatible'" -#~ msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -#~ msgstr "" +msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" +msgstr "-V[N][fname]\t\tBe verbose [level N] [fname ޽ ]" msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\t " +msgstr "-D\t\t\t " msgid "-n\t\t\tNo swap file, use memory only" msgstr "-n\t\t\t ޸𸮸 " @@ -2995,6 +3028,12 @@ msgstr "-F\t\t\tFarsi msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\t͹̳ <terminal> " +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\t͹̳ο ٴ " + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\t͹̳ο " + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t.vimrc <vimrc> " @@ -3153,19 +3192,6 @@ msgstr "+reverse\t\t msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <resource>\tõ ҽ " -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"gvim ˰ִ (RISC OS ):\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <>\tĭ â ʱ ʺ" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <>\tٿ â ʱ " - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" @@ -3182,6 +3208,9 @@ msgstr "--role <role>\t msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\t ٸ GTK ȿ " +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tǥ¿ gvim Window ID ǥ" + msgid "-P <parent title>\tOpen Vim inside parent application" msgstr "-P <parent title>\tVim θ α׷ " @@ -3373,8 +3402,7 @@ msgstr " #, c-format msgid "" "E833: %s is encrypted and this version of Vim does not support encryption" -msgstr "" -"E833: %s() ȣȭǾ ִ , Vim ȣȭ ʽϴ" +msgstr "E833: %s() ȣȭǾ ִ , Vim ȣȭ ʽϴ" #~ msgid " has been damaged (page size is smaller than minimum value).\n" #~ msgstr "" @@ -3666,24 +3694,17 @@ msgstr " NEWER than swap file!\n" #. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) ٸ α׷ ġ ִ ֽϴ.\n" -" ׷ٸ α׷ ġ\n" -" ʵ Ͻñ ٶϴ.\n" - -msgid " Quit, or continue with caution.\n" -msgstr " ų Ͻ÷ Ͻʽÿ.\n" +" ׷ٸ α׷ ġ ʵ\n" +" Ͻñ ٶϴ. ϼ. Ͻ÷ ϼ.\n" -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) ġٰ ׾ϴ.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) ġٰ ׾ϴ.\n" msgid " If this is the case, use \":recover\" or \"vim -r " msgstr " ׷ٸ \":recover\" Ȥ \"vim -r " @@ -3905,13 +3926,6 @@ msgstr " ( msgid "Beep!" msgstr "!" -msgid "Vim: preserving files...\n" -msgstr ": ...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr ": ϴ.\n" - msgid "ERROR: " msgstr ": " @@ -3957,14 +3971,8 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: ̻ " -msgid "Enter encryption key: " -msgstr "ȣ Ű Է: " - -msgid "Enter same key again: " -msgstr " Ű ٽ Է: " - -msgid "Keys don't match!" -msgstr "Ű ʽϴ!" +#~ msgid "E854: path too long for completion" +#~ msgstr "" #, c-format msgid "" @@ -3990,19 +3998,10 @@ msgstr "E346: cdpath msgid "E347: No more file \"%s\" found in path" msgstr "E347: path ̻ \"%s\" ã ϴ" -msgid "Cannot connect to Netbeans #2" -msgstr "Netbeans #2 ϴ" - -msgid "Cannot connect to Netbeans" -msgstr "Netbeans ϴ" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "E668: NetBeans 尡 ߸: \"%s\"" -msgid "read from Netbeans socket" -msgstr "Netbeans Ͽ б" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: %ld NetBeans ҾȽϴ" @@ -4013,8 +4012,9 @@ msgstr "E838: msgid "E511: netbeans already connected" msgstr "E511: netbeans ̹ Ǿ ֽϴ" -msgid "E505: " -msgstr "E505: " +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s() б Դϴ ( ! ϱ)" msgid "E349: No identifier under cursor" msgstr "E349: Ŀ ؿ ĺڰ ϴ" @@ -4043,8 +4043,8 @@ msgstr "E664: changelist #~ msgid "E663: At end of changelist" #~ msgstr "" -msgid "Type :quit<Enter> to exit Vim" -msgstr "VIM ġ :quit<Enter> Է" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr ":qa! Է Ŀ <> Ű ø ϰ մϴ" #, c-format msgid "1 line %sed 1 time" @@ -4131,37 +4131,38 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: 𸣴 %d" +#~ msgid "" +#~ "E883: search pattern and expression register may not contain two or more " +#~ "lines" +#~ msgstr "" + #, c-format msgid "%ld Cols; " msgstr "%ld ; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Selected %s%ld of %ld ; %ld of %ld ܾ; %ld of %ld Ʈ" +#~ msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +#~ msgstr "" #, c-format -msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" -msgstr "" -"Selected %s%ld of %ld ; %ld of %ld ܾ; %ld of %ld ; %ld of %ld " -"Ʈ" +#~ msgid "" +#~ "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +#~ "%lld Bytes" +#~ msgstr "" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Col %s of %s; %ld of %ld; ܾ %ld of %ld; Ʈ %ld of %ld" +#~ msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +#~ msgstr "" #, c-format -msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" -msgstr "" -"Col %s of %s; %ld of %ld; ܾ %ld of %ld; %ld of %ld; Ʈ %ld " -"of %ld" +#~ msgid "" +#~ "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +#~ "%lld of %lld" +#~ msgstr "" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld for BOM)" +#~ msgid "(+%ld for BOM)" +#~ msgstr "" msgid "%<%f%h%m%=Page %N" msgstr "%<%f%h%m%= %N" @@ -4178,6 +4179,9 @@ msgstr "E519: msgid "E520: Not allowed in a modeline" msgstr "E520: ο ϴ" +msgid "E846: Key code not set" +msgstr "E846: Ű ڵ尡 ʾҽϴ" + msgid "E521: Number required after =" msgstr "E521: = ڿ ڰ ʿմϴ" @@ -4188,6 +4192,10 @@ msgstr "E522: termcap msgid "E539: Illegal character <%s>" msgstr "E539: ̻ <%s>" +#, c-format +#~ msgid "For option %s" +#~ msgstr "" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' ڿ ϴ" @@ -4381,9 +4389,6 @@ msgstr "I/O msgid "Message" msgstr "޽" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' 80 ƴϾ, ܺ ϴ" - msgid "E237: Printer selection failed" msgstr "E237: ͸ ߽ϴ" @@ -4408,19 +4413,12 @@ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: ߸ ڼ ̸ \"%s\"() ۲ ̸ \"%s\" ֽϴ" #, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: ߸ '%c'() ۲ ̸ \"%s\" ֽϴ" - -msgid "Vim: Double signal, exiting\n" -msgstr ": ñ׳ , ϴ\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr ": %s ñ׳ ҽϴ\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: ߸ Ƽ ̸ \"%s\"() ۲ ̸ \"%s\" ֽϴ" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr ": ñ׳ ҽϴ\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: ߸ '%c'() ۲ ̸ \"%s\" ֽϴ" #, c-format msgid "Opening the X display took %ld msec" @@ -4453,12 +4451,13 @@ msgstr "" "\n" "Could not set security context for " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Cannot execute shell " +#, c-format +#~ msgid "Could not set security context %s for %s" +#~ msgstr "" + +#, c-format +#~ msgid "Could not get security context %s for %s. Removing it!" +#~ msgstr "" msgid "" "\n" @@ -4488,6 +4487,13 @@ msgstr "" "\n" "ڽ μ ϴ\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Cannot execute shell " + msgid "" "\n" "Command terminated\n" @@ -4530,10 +4536,6 @@ msgstr " msgid "Could not fix up function pointers to the DLL!" msgstr "Լ ͸ DLL ٲ ϴ!" -#, c-format -msgid "shell returned %d" -msgstr " %d() ־ϴ" - #, c-format msgid "Vim: Caught %s event\n" msgstr ": %s ̺Ʈ ҽϴ\n" @@ -4562,6 +4564,10 @@ msgstr "" msgid "Vim Warning" msgstr " " +#, c-format +msgid "shell returned %d" +msgstr " %d() ־ϴ" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: ڿ %%%c() ʹ ϴ" @@ -4585,6 +4591,7 @@ msgstr "E376: msgid "E377: Invalid %%%c in format string" msgstr "E377: ڿ ߸ %%%c() ֽϴ" +#. nothing found msgid "E378: 'errorformat' contains no pattern" msgstr "E378: 'errorformat'  ϵ ϰ ʽϴ" @@ -4594,6 +4601,15 @@ msgstr "E379: msgid "E553: No more items" msgstr "E553: ̻ ׸ ϴ" +msgid "E924: Current window was closed" +msgstr "E924: â ϴ" + +msgid "E925: Current quickfix was changed" +msgstr "E925: quickfix ٲϴ" + +msgid "E926: Current location list was changed" +msgstr "E926: location list ٲϴ" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d of %d)%s%s: " @@ -4601,15 +4617,18 @@ msgstr "(%d of %d)%s%s: " msgid " (line deleted)" msgstr " ( )" +#, c-format +#~ msgid "%serror list %d of %d; %d errors " +#~ msgstr "" + msgid "E380: At bottom of quickfix stack" msgstr "E380: Ƚ ٴԴϴ" msgid "E381: At top of quickfix stack" msgstr "E381: Ƚ Դϴ" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "error list %d of %d; %d errors" +#~ msgid "No entries" +#~ msgstr "" msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: , 'buftype' ɼ Ǿ ֽϴ" @@ -4634,18 +4653,15 @@ msgstr "E777: String msgid "E369: invalid item in %s%%[]" msgstr "E369: %s%%[] ߸ ׸" -msgid "E339: Pattern too long" -msgstr "E339: ʹ ϴ" - -msgid "E50: Too many \\z(" -msgstr "E50: \\z( ʹ ϴ" - #, c-format -msgid "E51: Too many %s(" -msgstr "E51: %s( ʹ ϴ" +msgid "E769: Missing ] after %s[" +msgstr "E769: %s[ ڿ ] ϴ" -msgid "E52: Unmatched \\z(" -msgstr "E52: ʴ \\z(" +#~ msgid "E944: Reverse range in character class" +#~ msgstr "" + +#~ msgid "E945: Range too large in character class" +#~ msgstr "" #, c-format msgid "E53: Unmatched %s%%(" @@ -4659,6 +4675,36 @@ msgstr "E54: msgid "E55: Unmatched %s)" msgstr "E55: ʴ %s)" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( ⿡ ʽϴ" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 ⿡ ʽϴ" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: %s%%[ ڿ ] ϴ" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[]" + +msgid "E65: Illegal back reference" +msgstr "E65: ̻ " + +msgid "E339: Pattern too long" +msgstr "E339: ʹ ϴ" + +msgid "E50: Too many \\z(" +msgstr "E50: \\z( ʹ ϴ" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: %s( ʹ ϴ" + +msgid "E52: Unmatched \\z(" +msgstr "E52: ʴ \\z(" + #, c-format msgid "E59: invalid character after %s@" msgstr "E59: %s@ ڿ ߸ " @@ -4682,26 +4728,9 @@ msgstr "E63: \\_ msgid "E64: %s%c follows nothing" msgstr "E64: %s%c ڿ ƹ͵ ϴ" -msgid "E65: Illegal back reference" -msgstr "E65: ̻ " - -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( ⿡ ʽϴ" - -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 ⿡ ʽϴ" - msgid "E68: Invalid character after \\z" msgstr "E68: \\z ڿ ̻ " -#, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: %s%%[ ڿ ] ϴ" - -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[]" - #, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: %s%%[dxouU] ڿ ̻ " @@ -4710,10 +4739,6 @@ msgstr "E678: %s%%[dxouU] msgid "E71: Invalid character after %s%%" msgstr "E71: %s%% ڿ ̻ " -#, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: %s[ ڿ ] ϴ" - #, c-format msgid "E554: Syntax error in %s{...}" msgstr "E554: %s{...} " @@ -4721,6 +4746,87 @@ msgstr "E554: %s{...} msgid "External submatches:\n" msgstr "ܺ submatches:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA ǥ) %s() ݺ ϴ" + +#~ msgid "" +#~ "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +#~ "used " +#~ msgstr "" + +#~ msgid "Switching to backtracking RE engine for pattern: " +#~ msgstr "" + +#~ msgid "E865: (NFA) Regexp end encountered prematurely" +#~ msgstr "" + +#, c-format +#~ msgid "E866: (NFA regexp) Misplaced %c" +#~ msgstr "" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA ǥ) Ŭ: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) 𸣴 ۷ '\\z%c'" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) 𸣴 ۷ '\\%%%c'" + +#. should never happen +#~ msgid "E868: Error building NFA with equivalence class!" +#~ msgstr "" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) 𸣴 ۷ '\\@%c'" + +#~ msgid "E870: (NFA regexp) Error reading repetition limits" +#~ msgstr "" + +#. Can't have a multi follow a multi. +#~ msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +#~ msgstr "" + +#. Too many `(' +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA ǥ) '(' ʹ ϴ" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA ǥ) \\z( ʹ ϴ" + +#~ msgid "E873: (NFA regexp) proper termination error" +#~ msgstr "" + +#~ msgid "E874: (NFA) Could not pop the stack !" +#~ msgstr "" + +#~ msgid "" +#~ "E875: (NFA regexp) (While converting from postfix to NFA), too many states " +#~ "left on stack" +#~ msgstr "" + +#~ msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +#~ msgstr "" + +#~ msgid "E878: (NFA) Could not allocate memory for branch traversal!" +#~ msgstr "" + +#~ msgid "" +#~ "Could not open temporary log file for writing, displaying on stderr ... " +#~ msgstr "" + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) %s() ϴ!" + +msgid "Could not open temporary log file for writing " +msgstr "ӽ α ϴ" + msgid " VREPLACE" msgstr " ġȯ" @@ -4748,9 +4854,6 @@ msgstr " msgid " Arabic" msgstr " ƶ" -msgid " (lang)" -msgstr " ()" - msgid " (paste)" msgstr " (̱)" @@ -4845,8 +4948,47 @@ msgstr "" "# Last %sSearch Pattern:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: spell " +msgid "E756: Spell checking is not enabled" +msgstr "E756: ˻簡 ȰȭǾ ʽϴ" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr ": ܾ \"%s_%s.spl\" Ȥ \"%s_ascii.spl\" ã ϴ" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr ": ܾ \"%s.%s.spl\" Ȥ \"%s.ascii.spl\" ã ϴ" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing autocommand ۸ ߽ϴ" + +#, c-format +msgid "Warning: region %s not supported" +msgstr ": %s ʽϴ" + +msgid "Sorry, no suggestions" +msgstr "˼, ϴ" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "˼, %ld " + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Change \"%.*s\" to:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: öڰ ٲ ϴ" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: ã : %s" msgid "E758: Truncated spell file" msgstr "E758: ߸ spell " @@ -4868,17 +5010,6 @@ msgstr "E762: FOL, LOW Ȥ msgid "Compressing word tree..." msgstr "ܾ Ʈ ..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: ˻簡 ȰȭǾ ʽϴ" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr ": ܾ \"%s_%s.spl\" Ȥ \"%s_ascii.spl\" ã ϴ" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr ": ܾ \"%s.%s.spl\" Ȥ \"%s.ascii.spl\" ã ϴ" - #, c-format msgid "Reading spell file \"%s\"" msgstr "spell \"%s\"() а ֽϴ" @@ -4896,8 +5027,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: spell Ͽ ʴ " #, c-format -msgid "Warning: region %s not supported" -msgstr ": %s ʽϴ" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug ƴ : %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: .sug , ʿ: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug .spl ϰ : %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug б : %s" #, c-format msgid "Reading affix file %s ..." @@ -5157,76 +5304,56 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' %ld ׸ ϴ" #, c-format -msgid "Word removed from %s" -msgstr "%s ܾ " +msgid "Word '%.*s' removed from %s" +msgstr "ܾ '%.*s'() %s ŵ" #, c-format -msgid "Word added to %s" -msgstr "%s ܾ ߰" +msgid "Word '%.*s' added to %s" +msgstr "ܾ '%.*s'() %s ߰" msgid "E763: Word characters differ between spell files" msgstr "E763: ܾ spell ٸϴ" -msgid "Sorry, no suggestions" -msgstr "˼, ϴ" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "˼, %ld " - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Change \"%.*s\" to:" +#. This should have been checked when generating the .spl +#. * file. +msgid "E783: duplicate char in MAP entry" +msgstr "E783: MAP ׸ ߺ " -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr " ۿ ǵ ׸ ϴ" -msgid "E752: No previous spell replacement" -msgstr "E752: öڰ ٲ ϴ" +#~ msgid "syntax conceal on" +#~ msgstr "" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: ã : %s" +#~ msgid "syntax conceal off" +#~ msgstr "" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug ƴ : %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: ߸ : %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: .sug , ʿ: %s" +#~ msgid "syntax case ignore" +#~ msgstr "" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug Vim: %s" +#~ msgid "syntax case match" +#~ msgstr "" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug .spl ϰ : %s" +#~ msgid "syntax spell toplevel" +#~ msgstr "" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug б : %s" +#~ msgid "syntax spell notoplevel" +#~ msgstr "" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: MAP ׸ ߺ " +#~ msgid "syntax spell default" +#~ msgstr "" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: ߸ : %s" +#~ msgid "syntax iskeyword " +#~ msgstr "" #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: ̷ Ŭʹ ϴ: %s" -msgid "No Syntax items defined for this buffer" -msgstr " ۿ ǵ ׸ ϴ" - msgid "syncing on C-style comments" msgstr "C- ּ " @@ -5292,10 +5419,17 @@ msgstr "E394: %s msgid "E397: Filename required" msgstr "E397: ̸ ʿմϴ" +#~ msgid "E847: Too many syntax includes" +#~ msgstr "" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ']' : %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']' ڿ ڰ : %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' : %s" @@ -5304,6 +5438,9 @@ msgstr "E398: '=' msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: ġ : %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: ŬͰ ʹ ϴ" + msgid "E400: No cluster specified" msgstr "E400: ŬͰ õ ʾҽϴ" @@ -5346,6 +5483,10 @@ msgstr "E409: msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: ߸ :syntax : %s" +#~ msgid "" +#~ " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +#~ msgstr "" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: syncolor.vim ݺ ε" @@ -5407,6 +5548,9 @@ msgstr "E669: msgid "W18: Invalid character in group name" msgstr "W18: ׷ ̸ ̻ " +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: highlight syntax group ʹ ϴ" + msgid "E555: at bottom of tag stack" msgstr "E555: ± Դϴ" @@ -5467,6 +5611,9 @@ msgstr " msgid "E430: Tag file path truncated for %s\n" msgstr "E430: %s ± ΰ ߷Ƚϴ\n" +msgid "Ignoring long line in tags file" +msgstr "± ʹ մϴ" + #, c-format msgid "E431: Format error in tags file \"%s\"" msgstr "E431: ± \"%s\" ֽϴ" @@ -5483,9 +5630,6 @@ msgstr "E432: msgid "E433: No tags file" msgstr "E433: ± ϴ" -msgid "Ignoring long line in tags file" -msgstr "± ʹ մϴ" - msgid "E434: Can't find tag pattern" msgstr "E434: ± ã ϴ" @@ -5526,6 +5670,9 @@ msgstr "" "\n" "--- ͹̳ Ű ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txt ϴ" + msgid "new shell started\n" msgstr " ۵Ǿϴ\n" @@ -5537,8 +5684,8 @@ msgstr " #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: 𸣴 ̿ ٲϴ" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: ڱ ٲϴ" #. must display the prompt msgid "No undo possible; continue anyway" @@ -5648,38 +5795,158 @@ msgstr "changes" msgid "%ld %s; %s #%ld %s" msgstr "%ld %s; %s #%ld %s" -msgid "before" -msgstr "before" +msgid "before" +msgstr "before" + +msgid "after" +msgstr "after" + +msgid "Nothing to undo" +msgstr " ϴ" + +#~ msgid "number changes when saved" +#~ msgstr "" + +#, c-format +msgid "%ld seconds ago" +msgstr "%ld seconds ago" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undo ڿ undojoin ϴ" + +msgid "E439: undo list corrupt" +msgstr "E439: undo ϴ" + +msgid "E440: undo line missing" +msgstr "E440: undo ϴ" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Լ %s() ̹ ֽϴ, ٲٷ ! ϼ" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: ̹ Dictionary ׸ ֽϴ" + +msgid "E718: Funcref required" +msgstr "E718: Funcref ʿմϴ" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: 𸣴 Լ: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: ߸ : %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: ߺ ̸: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Լ %s ʹ ڰ ޵Ǿϴ" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Լ %s() ߸ ڰ Ѱϴ" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Լ θ ̰ 'maxfuncdepth' Ůϴ" + +#, c-format +msgid "calling %s" +msgstr "%s θ " + +#, c-format +msgid "%s aborted" +msgstr "%s() Ǿϴ" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s() #%ld() ־ϴ" + +#, c-format +msgid "%s returning %s" +msgstr "%s() %s() ־ϴ" + +msgid "E699: Too many arguments" +msgstr "E699: ʹ " + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: 𸣴 Լ: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Լ : %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Լ ѱ: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: ũƮ ؽƮ ۿ <SID> : %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Dictionary Լ ҷ: %s" + +msgid "E129: Function name required" +msgstr "E129: Լ ̸ ʿմϴ" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Լ ̸ 빮 Ȥ \"s:\" ؾ : %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Լ ̸ ݷ : %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Լ: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(' : %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: ⿡ g: ϴ" + +#, c-format +#~ msgid "E932: Closure function should not be at top level: %s" +#~ msgstr "" -msgid "after" -msgstr "after" +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction ϴ" -msgid "Nothing to undo" -msgstr " ϴ" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction ڿ ڿ : %s" -#~ msgid "number changes when saved" -#~ msgstr "" +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Լ 浹: %s" #, c-format -msgid "%ld seconds ago" -msgstr "%ld seconds ago" +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Լ %s() ٽ ϴ: Դϴ" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undo ڿ undojoin ϴ" +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Լ ũƮ ϸ ٸ: %s" -msgid "E439: undo list corrupt" -msgstr "E439: undo ϴ" +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Լ %s() ϴ: Դϴ" -msgid "E440: undo line missing" -msgstr "E440: undo ϴ" +msgid "E133: :return not inside a function" +msgstr "E133: :return Լ ȿ ʽϴ" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"MS-Windows 16/32 Ʈ GUI " +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: ȣ : %s" msgid "" "\n" @@ -5695,9 +5962,6 @@ msgstr "" "\n" "MS-Windows 32Ʈ GUI " -msgid " in Win32s mode" -msgstr " Win32s " - msgid " with OLE support" msgstr " OLE " @@ -5715,27 +5979,6 @@ msgstr "" "\n" "MS-Windows 32Ʈ ܼ " -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"MS-Windows 16Ʈ " - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"32Ʈ MS-DOS " - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"16Ʈ MS-DOS " - msgid "" "\n" "MacOS X (unix) version" @@ -5757,13 +6000,6 @@ msgstr "" "\n" "MacOS " -msgid "" -"\n" -"RISC OS version" -msgstr "" -"\n" -"RISC OS " - msgid "" "\n" "OpenVMS version" @@ -5836,6 +6072,9 @@ msgstr "" msgid "without GUI." msgstr "GUI ." +msgid "with GTK3 GUI." +msgstr "GTK3 GUI." + msgid "with GTK2-GNOME GUI." msgstr "GTK2-GNOME GUI." @@ -5899,6 +6138,9 @@ msgstr " msgid "3rd user gvimrc file: \"" msgstr " ° gvimrc : \"" +msgid " defaults file: \"" +msgstr " defaults : \"" + msgid " system menu file: \"" msgstr " ý ޴ : \"" @@ -5930,7 +6172,7 @@ msgid "by Bram Moolenaar et al." msgstr "by Bram Moolenaar et al." msgid "Vim is open source and freely distributable" -msgstr " ҽ ְ ¥ ˴ϴ" +msgstr " ҽ ְ ¥ ˴ϴ" msgid "Help poor children in Uganda!" msgstr "찣ٿ ̸ ּ!" @@ -5944,8 +6186,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr "¶ :help<> Ǵ <F1> Է" -msgid "type :help version7<Enter> for version info" -msgstr " :help version7<> Է" +msgid "type :help version8<Enter> for version info" +msgstr " :help version8<> Է" msgid "Running in Vi compatible mode" msgstr "Vi ȣȯ · Դϴ" @@ -5989,12 +6231,6 @@ msgstr " msgid "menu Help->Sponsor/Register for information " msgstr "̿ ޴ ->Sponsor/Register" -msgid "WARNING: Windows 95/98/ME detected" -msgstr ": 95/98/ME ã" - -msgid "type :help windows95<Enter> for info on this" -msgstr "̿ :help windows95<> Է" - msgid "Already only one window" msgstr "̹ ϳ â ֽϴ" @@ -6026,6 +6262,25 @@ msgstr "E446: Ŀ msgid "E447: Can't find file \"%s\" in path" msgstr "E447: path \"%s\" ã ϴ" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID: %ld (1 ũų ƾ մϴ)" + +#, c-format +#~ msgid "E801: ID already taken: %ld" +#~ msgstr "" + +msgid "List or number required" +msgstr "List number ʿմϴ" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID: %ld (1 ũų ƾ մϴ)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID ã : %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s ̺귯 ε ϴ" @@ -6128,6 +6383,10 @@ msgstr "E236: msgid "E473: Internal error" msgstr "E473: " +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: : %s" + msgid "Interrupted" msgstr "ߴܵǾϴ" @@ -6256,6 +6515,9 @@ msgstr "E485: %s msgid "E37: No write since last change (add ! to override)" msgstr "E37: ģ ʾҽϴ (Ϸ ! ϱ)" +msgid "E37: No write since last change" +msgstr "E37: ģ ʾҽϴ" + msgid "E38: Null argument" msgstr "E38: " @@ -6308,6 +6570,31 @@ msgstr "E46: msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: sandbox ȿ : \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Dictionary Ű ϴ" + +msgid "E715: Dictionary required" +msgstr "E715: Dictionary ʿմϴ" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: ȣ : %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Լ ʹ ѱ: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Dictionary Ű : %s" + +msgid "E714: List required" +msgstr "E714: List ʿմϴ" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s ڴ List Ȥ Dictionary մϴ" + msgid "E47: Error while reading errorfile" msgstr "E47: д ߿ " @@ -6365,8 +6652,8 @@ msgstr "E592: 'winwidth' msgid "E80: Error while writing" msgstr "E80: ߿ " -msgid "Zero count" -msgstr "Zero count" +#~ msgid "E939: Positive count required" +#~ msgstr "" msgid "E81: Using <SID> not in a script context" msgstr "E81: ũƮ ؽƮ ۿ <SID> " @@ -6380,16 +6667,16 @@ msgstr "E463: msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans б ٲ ϴ" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: : %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: 'maxmempattern' ޸𸮸 մϴ" msgid "E749: empty buffer" msgstr "E749: " +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: %ld() ʽϴ" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: ߸ ã Ȥ " @@ -6400,6 +6687,13 @@ msgstr "E139: msgid "E764: Option '%s' is not set" msgstr "E764: ɼ '%s'() Ǿ ʽϴ" +msgid "E850: Invalid register name" +msgstr "E850: ߸ ̸" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: '%s' 丮 ã: \"%s\"" + msgid "search hit TOP, continuing at BOTTOM" msgstr "ó ã, " @@ -6410,38 +6704,250 @@ msgstr " msgid "Need encryption key for \"%s\"" msgstr "\"%s\" ȣ Ű ʿմϴ" -msgid "writelines() requires list of strings" -msgstr "writelines() ڿ ʿմϴ" +msgid "empty keys are not allowed" +msgstr " Ű ʽϴ" + +msgid "dictionary is locked" +msgstr "dictionary ֽϴ" + +msgid "list is locked" +msgstr "list ֽϴ" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "dictionary '%s' Ű ߰ ϴ" + +#, c-format +#~ msgid "index must be int or slice, not %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected str() or unicode() instance, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected bytes() or str() instance, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "" +#~ "expected int(), long() or something supporting coercing to long(), but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected int() or something supporting coercing to int(), but got %s" +#~ msgstr "" + +msgid "value is too large to fit into C int type" +msgstr " C Ͽ ʹ Ůϴ" + +msgid "value is too small to fit into C int type" +msgstr " C Ͽ ʹ ۽ϴ" + +msgid "number must be greater than zero" +msgstr " 0 Ŀ մϴ" + +msgid "number must be greater or equal to zero" +msgstr " 0 ũų ƾ մϴ" + +msgid "can't delete OutputObject attributes" +msgstr "OutputObject Ӽ ϴ" + +#, c-format +msgid "invalid attribute: %s" +msgstr "߸ Ӽ: %s" msgid "E264: Python: Error initialising I/O objects" msgstr "E264: ̽: I/O ü ʱȭ ϴ" -msgid "no such buffer" -msgstr "׷ ۴ ϴ" +msgid "failed to change directory" +msgstr "丮 ٲ ϴ" -msgid "attempt to refer to deleted window" -msgstr " â Ϸ Ͽϴ" +#, c-format +#~ msgid "expected 3-tuple as imp.find_module() result, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +#~ msgstr "" -msgid "readonly attribute" -msgstr "б Ӽ" +#~ msgid "internal error: imp.find_module returned tuple with NULL" +#~ msgstr "" -msgid "cursor position outside buffer" -msgstr "ۼ ġ ۿ ֽϴ" +msgid "cannot delete vim.Dictionary attributes" +msgstr "vim.Dictionary Ӽ ϴ" + +msgid "cannot modify fixed dictionary" +msgstr "fixed dictionary ϴ" + +#, c-format +msgid "cannot set attribute %s" +msgstr "Ӽ %s() ϴ" + +#~ msgid "hashtab changed during iteration" +#~ msgstr "" + +#, c-format +#~ msgid "expected sequence element of size 2, but got sequence of size %d" +#~ msgstr "" + +#~ msgid "list constructor does not accept keyword arguments" +#~ msgstr "" + +msgid "list index out of range" +msgstr "list ϴ" + +#. No more suitable format specifications in python-2.3 +#, c-format +#~ msgid "internal error: failed to get vim list item %d" +#~ msgstr "" + +#~ msgid "slice step cannot be zero" +#~ msgstr "" + +#, c-format +#~ msgid "attempt to assign sequence of size greater than %d to extended slice" +#~ msgstr "" + +#, c-format +#~ msgid "internal error: no vim list item %d" +#~ msgstr "" + +#~ msgid "internal error: not enough list items" +#~ msgstr "" + +#~ msgid "internal error: failed to add item to list" +#~ msgstr "" + +#, c-format +#~ msgid "attempt to assign sequence of size %d to extended slice of size %d" +#~ msgstr "" + +#~ msgid "failed to add item to list" +#~ msgstr "" + +msgid "cannot delete vim.List attributes" +msgstr "vim.List Ӽ ϴ" + +#~ msgid "cannot modify fixed list" +#~ msgstr "" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "̸ Լ %s() ʽϴ" + +#, c-format +msgid "function %s does not exist" +msgstr "Լ %s() ʽϴ" #, c-format -msgid "<window object (deleted) at %p>" -msgstr "<%p â ü ()>" +msgid "failed to run function %s" +msgstr "Լ %s() ϴ" + +msgid "unable to get option value" +msgstr "ɼ ϴ" + +#~ msgid "internal error: unknown option type" +#~ msgstr "" + +#~ msgid "problem while switching windows" +#~ msgstr "" #, c-format -msgid "<window object (unknown) at %p>" -msgstr "<%p â ü ()>" +#~ msgid "unable to unset global option %s" +#~ msgstr "" #, c-format -msgid "<window %d>" -msgstr "<â %d>" +#~ msgid "unable to unset option %s which does not have global value" +#~ msgstr "" + +msgid "attempt to refer to deleted tab page" +msgstr " Ϸ Ͽϴ" + +msgid "no such tab page" +msgstr "׷ ϴ" + +msgid "attempt to refer to deleted window" +msgstr " â Ϸ Ͽϴ" + +msgid "readonly attribute: buffer" +msgstr "б Ӽ: " + +msgid "cursor position outside buffer" +msgstr "ۼ ġ ۿ ֽϴ" msgid "no such window" msgstr "׷ â ϴ" msgid "attempt to refer to deleted buffer" msgstr " ۸ Ϸ Ͽϴ" + +msgid "failed to rename buffer" +msgstr " ̸ ϴ" + +#~ msgid "mark name must be a single character" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.Buffer object, but got %s" +#~ msgstr "" + +#, c-format +#~ msgid "failed to switch to buffer %d" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.Window object, but got %s" +#~ msgstr "" + +#~ msgid "failed to find window in the current tab page" +#~ msgstr "" + +#~ msgid "did not switch to the specified window" +#~ msgstr "" + +#, c-format +#~ msgid "expected vim.TabPage object, but got %s" +#~ msgstr "" + +#~ msgid "did not switch to the specified tab page" +#~ msgstr "" + +#~ msgid "failed to run the code" +#~ msgstr "" + +#~ msgid "E858: Eval did not return a valid python object" +#~ msgstr "" + +#~ msgid "E859: Failed to convert returned python object to vim value" +#~ msgstr "" + +#, c-format +#~ msgid "unable to convert %s to vim dictionary" +#~ msgstr "" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s() vim list ϴ" + +#, c-format +#~ msgid "unable to convert %s to vim structure" +#~ msgstr "" + +#~ msgid "internal error: NULL reference passed" +#~ msgstr "" + +#~ msgid "internal error: invalid value type" +#~ msgstr "" + +#~ msgid "" +#~ "Failed to set path hook: sys.path_hooks is not a list\n" +#~ "You should now do the following:\n" +#~ "- append vim.path_hook to sys.path_hooks\n" +#~ "- append vim.VIM_SPECIAL_PATH to sys.path\n" +#~ msgstr "" + +#~ msgid "" +#~ "Failed to set path: sys.path is not a list\n" +#~ "You should now append vim.VIM_SPECIAL_PATH to sys.path" +#~ msgstr "" diff --git a/src/po/lv.po b/src/po/lv.po new file mode 100644 index 0000000000..12a91ea3cf --- /dev/null +++ b/src/po/lv.po @@ -0,0 +1,282 @@ +# Latvian Translation for Vim vim:set foldmethod=marker: +# +# Do ":help uganda" in Vim to read copying and usage conditions. +# Do ":help credits" in Vim to see a list of people who contributed. +# +# FIRST AUTHOR Valdis Vitolins <valdis.vitolins@odo.lv>, 2017. +# +# +msgid "" +msgstr "" +"Project-Id-Version: Vim (Latvian)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-03 18:03+0100\n" +"PO-Revision-Date: 2017-05-03 18:08+0300\n" +"Last-Translator: Valdis Vītoliņš <valdis.vitolins@odo.lv>\n" +"Language-Team: Bram Moolenaar <Bram@vim.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: lv\n" +"X-Generator: Poedit 1.8.7.1\n" + +#, c-format +msgid "E96: Can not diff more than %ld buffers" +msgstr "E96: Nevar salīdzināt vairāk kā %ld buferus" + +msgid "E101: More than two buffers in diff mode, don't know which one to use" +msgstr "E101: Vairāk par vienu buferi diff režīmā, nav skaidrs, kuru izmantot" + +#, c-format +msgid "E102: Can't find buffer \"%s\"" +msgstr "E102: Nevar atrast buferi \"%s\"" + +#, c-format +msgid "E738: Can't list variables for %s" +msgstr "E738: Nevar parādīt %s mainīgos" + +#, c-format +msgid "E138: Can't write viminfo file %s!" +msgstr "E138: Nevar ierakstīt viminfo failu %s!" + +msgid "" +"# You may edit it if you're careful!\n" +"\n" +msgstr "" +"# Ja rediģējat, esiet uzmanīgs!\n" +"\n" + +msgid "E146: Regular expressions can't be delimited by letters" +msgstr "E146: Regulārās izteiksmes nedrīkst atdalīt ar burtiem" + +msgid "E493: Backwards range given" +msgstr "E493: Uzdots pretējs diapazons" + +msgid "Backwards range given, OK to swap" +msgstr "Diapazons pretējā secībā, OK lai apvērstu" + +#, c-format +msgid "E185: Cannot find color scheme %s" +msgstr "E185: Nevar atrast krāsu shēmu %s" + +msgid "Can't find temp file for conversion" +msgstr "Nevar atrast konvertējamo īslaicīgo failu" + +msgid "can't read output of 'charconvert'" +msgstr "nevar nolasīt 'charconvert' izeju" + +msgid "E506: Can't write to backup file (add ! to override)" +msgstr "E506: Nevar ierakstīt rezerves failu (pievienojiet ! lai pārlabotu)" + +msgid "E508: Can't read file for backup (add ! to override)" +msgstr "E508: Nevar nolasīt rezerves failu (pievienojiet ! lai pārlabotu)" + +msgid "E510: Can't make backup file (add ! to override)" +msgstr "E510: Nevar izveidot rezerves failu (pievienojiet ! lai pārlabotu)" + +msgid "E214: Can't find temp file for writing" +msgstr "E214: Nevar atvērt īslaicīgo failu rakstīšanai" + +msgid "E166: Can't open linked file for writing" +msgstr "E166: Nevar atvērt rakstīšanai saistīto failu" + +msgid "E212: Can't open file for writing" +msgstr "E212: Nevar atvērt failu rakstīšanai" + +msgid "E205: Patchmode: can't save original file" +msgstr "E205: Patchmode: nevar saglabāt oriģinālo failu" + +msgid "E206: patchmode: can't touch empty original file" +msgstr "E206: patchmode: nevar izveidot jaunu oriģinālo failu" + +msgid "E207: Can't delete backup file" +msgstr "E207: nevar izdzēst kopijas failu" + +msgid "don't quit the editor until the file is successfully written!" +msgstr "neizejiet no redaktora pirms fails nav veiksmīgi saglabāts!" + +msgid "E217: Can't execute autocommands for ALL events" +msgstr "E217: Nevar izpildīt autokomandu VISIEM notikumiem" + +#, c-format +msgid "E482: Can't create file %s" +msgstr "E482: Nevar izveidot failu %s" + +msgid "E483: Can't get temp file name" +msgstr "E483: Nevar iegūt īslaicīgā faila nosaukumu" + +#, c-format +msgid "E484: Can't open file %s" +msgstr "E484: Nevar atvērt failu %s" + +#, c-format +msgid "E485: Can't read file %s" +msgstr "E485: Nevar nolasīt failu %s" + +#, c-format +msgid "E40: Can't open errorfile %s" +msgstr "E40: Nevar atvērt kļūdu failu %s" + +msgid "E255: Couldn't read in sign data!" +msgstr "E255: Nevar nolasīt zīmes datus!" + +#, c-format +msgid "E254: Cannot allocate color %s" +msgstr "E254: Nevar izdalīt krāsu %s" + +#, c-format +msgid "E616: vim_SelFile: can't get font %s" +msgstr "E616: vim_SelFile: nevar iegūt fontu %s" + +msgid "E614: vim_SelFile: can't return to current directory" +msgstr "E614: vim_SelFile: nevar atgriezties uz tekošo mapi" + +msgid "E615: vim_SelFile: can't get current directory" +msgstr "E615: vim_SelFile: nevar iegūt tekošo mapi" + +msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" +msgstr "Vim E458: Nevar izveidot krāsu karti, iespējams, ir kāda nepareiza krāsa" + +#, c-format +msgid "E624: Can't open file \"%s\"" +msgstr "E624: Nevar atvērt failu \"%s\"" + +#, c-format +msgid "E457: Can't read PostScript resource file \"%s\"" +msgstr "E457: Nevar nolasīt PostScript resursu failu \"%s\"" + +msgid "E324: Can't open PostScript output file" +msgstr "E324: Nevar atvērt PostScript izejas failu" + +#, c-format +msgid "E456: Can't open file \"%s\"" +msgstr "E456: Nevar atrast failu \"%s\"" + +msgid "E456: Can't find PostScript resource file \"prolog.ps\"" +msgstr "E456: Nevar atrast PostScript resursu failu \"prolog.ps\"" + +msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" +msgstr "E456: Nevar atrast PostScript resursu failu \"cidfont.ps\"" + +#, c-format +msgid "E456: Can't find PostScript resource file \"%s.ps\"" +msgstr "E456: Nevar atrast PostScript resursu failu \"%s.ps\"" + +msgid "couldn't open buffer" +msgstr "nevar atvērt buferi" + +msgid "can't delete OutputObject attributes" +msgstr "nevar izdzēst OutputObject vērtības" + +msgid "--literal\t\tDon't expand wildcards" +msgstr "--literal\t\tNeizvērst aizstājējzīmes" + +msgid "-f or --nofork\tForeground: Don't fork when starting GUI" +msgstr "-f jeb --nofork\tPriekšplānā: startējot GUI, neveidot jaunu pavedienu" + +msgid "-f\t\t\tDon't use newcli to open window" +msgstr "-f\t\t\tAtverot logu, neveidot jaunu klientu" + +msgid "--noplugin\t\tDon't load plugin scripts" +msgstr "--noplugin\t\tNeielādēt spraudņu skriptus" + +msgid "--remote-silent <files> Same, don't complain if there is no server" +msgstr "--remote-silent <files> Līdzīgi, nebrīdināt, ja nav servera" + +msgid "--remote-wait-silent <files> Same, don't complain if there is no server" +msgstr "--remote-wait-silent <files> Līdzīgi, nebrīdināt, ja nav servera" + +msgid "-background <color>\tUse <color> for the background (also: -bg)" +msgstr "-background <krāsa>\tLietot <krāsa> kā fonu (arī: -bg)" + +msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" +msgstr "-foreground <krāsa>\tLietot <krāsa> normālam tekstam (arī: -fg)" + +msgid "+reverse\t\tDon't use reverse video (also: +rv)" +msgstr "+reverse\t\tNelietot reversu video (arī: +rv)" + +msgid "E288: input method doesn't support any style" +msgstr "E288: ievades veids neatbalsta nevienu stilu" + +msgid "E289: input method doesn't support my preedit type" +msgstr "E289: ievades veids neatbalsta šādu preedit veidu" + +msgid "E298: Didn't get block nr 0?" +msgstr "E298: Neizdevās iegūt bloku nr 0?" + +msgid "E298: Didn't get block nr 1?" +msgstr "E298: Neizdevās iegūt blok nr 1?" + +msgid "E298: Didn't get block nr 2?" +msgstr "E298: Neizdevās iegūt bloku nr 2?" + +msgid "E304: ml_upd_block0(): Didn't get block 0??" +msgstr "E304: ml_upd_block0(): Neizdevās iegūt bloku 0??" + +msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" +msgstr "Messages maintainer: Valdis Vitolins <valdis.vitolins@odo.lv>" + +msgid "Keys don't match!" +msgstr "Atslēgas neatbilst!" + +#, c-format +msgid "E344: Can't find directory \"%s\" in cdpath" +msgstr "E344: cdpath nevar atrast mapi \"%s\"" + +#, c-format +msgid "E345: Can't find file \"%s\" in path" +msgstr "E345: ceļā nevar atrast failu \"%s\"" + +msgid "E597: can't select fontset" +msgstr "E597: nevar izvēlēties fontu kopu" + +msgid "E533: can't select wide font" +msgstr "E533: nevar izvēlēties plato fontu" + +msgid "VIM: Can't open window!\n" +msgstr "VIM: Nevar atvērt logu!\n" + +msgid "E388: Couldn't find definition" +msgstr "E388: neatradu definīciju" + +msgid "E389: Couldn't find pattern" +msgstr "E389: neatradu šablonu" + +#, c-format +msgid "Unrecognized or duplicate item in %s line %d: %s" +msgstr "Neatpazīts vai dublēts vienums %s rindā %d: %s" + +#, c-format +msgid "Unrecognized flags in %s line %d: %s" +msgstr "Neatpazīti karodziņi %s rindā %d: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug fails neatbilst .spl failam: %s" + +#, c-format +msgid "E394: Didn't find region item for %s" +msgstr "E394: Neatradu vienuma %s reģionu" + +msgid "E419: FG color unknown" +msgstr "E419: Nezināma priekšplāna krāsa" + +msgid "E420: BG color unknown" +msgstr "E420: Nezināma fona krāsa" + +#, c-format +msgid "E421: Color name or number not recognized: %s" +msgstr "E421: Nezināms krāsas %s nosaukums vai numurs" + +msgid "E434: Can't find tag pattern" +msgstr "E434: Neatradu tagu paraugu" + +msgid "E435: Couldn't find tag, just guessing!" +msgstr "E435: Neatradu tagu, mēģinu uzminēt!" + +msgid "E442: Can't split topleft and botright at the same time" +msgstr "E442: Nevar sadalīt kreiso augšu un labo apakšu vienlaicīgi" + +#, c-format +msgid "E447: Can't find file \"%s\" in path" +msgstr "E447: Failu \"%s\" ceļā nevar atrast" diff --git a/src/po/nb.po b/src/po/nb.po index bf2b964d2c..c8bb08d1a3 100644 --- a/src/po/nb.po +++ b/src/po/nb.po @@ -2827,7 +2827,7 @@ msgstr "" msgid "where case is ignored prepend / to make flag upper case" msgstr "" -"der bokstavstrrelse ignoreres, legg til / i begynnelsen for\n" +"der bokstavstrrelse ignoreres, legg til / i begynnelsen for " " gjre flagget om til stor bokstav" msgid "" @@ -5708,8 +5708,8 @@ msgstr "skriv :q<Enter> for msgid "type :help<Enter> or <F1> for on-line help" msgstr "skriv :help<Enter> eller <F1> for on-line hjelp" -msgid "type :help version7<Enter> for version info" -msgstr "skriv :help version7<Enter> for versjonsinfo " +msgid "type :help version8<Enter> for version info" +msgstr "skriv :help version8<Enter> for versjonsinfo " msgid "Running in Vi compatible mode" msgstr "Kjrer i Vi-kompatibel modus" diff --git a/src/po/nl.po b/src/po/nl.po index eb8f4dd8ba..1a9f72a48c 100644 --- a/src/po/nl.po +++ b/src/po/nl.po @@ -5391,8 +5391,8 @@ msgstr "typ :q<Enter> om te stoppen" msgid "type :help<Enter> or <F1> for on-line help" msgstr "typ :help<Enter> of <F1> voor on-line hulp" -msgid "type :help version7<Enter> for version info" -msgstr "typ :help version7<Enter> voor versieinformatie" +msgid "type :help version8<Enter> for version info" +msgstr "typ :help version8<Enter> voor versieinformatie" msgid "Running in Vi compatible mode" msgstr "wordt uitgevoerd in Vi compatible-modus" diff --git a/src/po/no.po b/src/po/no.po index bf2b964d2c..c8bb08d1a3 100644 --- a/src/po/no.po +++ b/src/po/no.po @@ -2827,7 +2827,7 @@ msgstr "" msgid "where case is ignored prepend / to make flag upper case" msgstr "" -"der bokstavstrrelse ignoreres, legg til / i begynnelsen for\n" +"der bokstavstrrelse ignoreres, legg til / i begynnelsen for " " gjre flagget om til stor bokstav" msgid "" @@ -5708,8 +5708,8 @@ msgstr "skriv :q<Enter> for msgid "type :help<Enter> or <F1> for on-line help" msgstr "skriv :help<Enter> eller <F1> for on-line hjelp" -msgid "type :help version7<Enter> for version info" -msgstr "skriv :help version7<Enter> for versjonsinfo " +msgid "type :help version8<Enter> for version info" +msgstr "skriv :help version8<Enter> for versjonsinfo " msgid "Running in Vi compatible mode" msgstr "Kjrer i Vi-kompatibel modus" diff --git a/src/po/pl.UTF-8.po b/src/po/pl.UTF-8.po index 511d532a7c..5d4c3c3799 100644 --- a/src/po/pl.UTF-8.po +++ b/src/po/pl.UTF-8.po @@ -3153,7 +3153,7 @@ msgstr "--servername <nazwa>\t\tOdsyłaj do/stań się serwerem Vim <nazwa>" msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "" -"--startuptime <plik>\n" +"--startuptime <plik> " "Zapisz wiadomości o długości startu do <plik>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" @@ -6110,8 +6110,8 @@ msgstr "wprowadź :q<Enter> zakończenie programu " msgid "type :help<Enter> or <F1> for on-line help" msgstr "wprowadź :help<Enter> lub <F1> pomoc na bieżąco " -msgid "type :help version7<Enter> for version info" -msgstr "wprowadź :help version7<Enter> dla informacji o wersji" +msgid "type :help version8<Enter> for version info" +msgstr "wprowadź :help version8<Enter> dla informacji o wersji" msgid "Running in Vi compatible mode" msgstr "Działam w trybie zgodności z Vi" diff --git a/src/po/pl.cp1250.po b/src/po/pl.cp1250.po index 86c04b703b..3650598a25 100644 --- a/src/po/pl.cp1250.po +++ b/src/po/pl.cp1250.po @@ -3153,7 +3153,7 @@ msgstr "--servername <nazwa>\t\tOdsy msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "" -"--startuptime <plik>\n" +"--startuptime <plik> " "Zapisz wiadomoci o dugoci startu do <plik>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" @@ -6110,8 +6110,8 @@ msgstr "wprowad msgid "type :help<Enter> or <F1> for on-line help" msgstr "wprowad :help<Enter> lub <F1> pomoc na bieco " -msgid "type :help version7<Enter> for version info" -msgstr "wprowad :help version7<Enter> dla informacji o wersji" +msgid "type :help version8<Enter> for version info" +msgstr "wprowad :help version8<Enter> dla informacji o wersji" msgid "Running in Vi compatible mode" msgstr "Dziaam w trybie zgodnoci z Vi" diff --git a/src/po/pl.po b/src/po/pl.po index 560cadd0dd..2483aaeb59 100644 --- a/src/po/pl.po +++ b/src/po/pl.po @@ -3153,7 +3153,7 @@ msgstr "--servername <nazwa>\t\tOdsy msgid "--startuptime <file>\tWrite startup timing messages to <file>" msgstr "" -"--startuptime <plik>\n" +"--startuptime <plik> " "Zapisz wiadomoci o dugoci startu do <plik>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" @@ -6110,8 +6110,8 @@ msgstr "wprowad msgid "type :help<Enter> or <F1> for on-line help" msgstr "wprowad :help<Enter> lub <F1> pomoc na bieco " -msgid "type :help version7<Enter> for version info" -msgstr "wprowad :help version7<Enter> dla informacji o wersji" +msgid "type :help version8<Enter> for version info" +msgstr "wprowad :help version8<Enter> dla informacji o wersji" msgid "Running in Vi compatible mode" msgstr "Dziaam w trybie zgodnoci z Vi" diff --git a/src/po/pt_BR.po b/src/po/pt_BR.po index f31e1390d8..6f90daea8b 100644 --- a/src/po/pt_BR.po +++ b/src/po/pt_BR.po @@ -2,22 +2,55 @@ # msgid "" msgstr "" -"Project-Id-Version: Vim 7.3\n" +"Project-Id-Version: Vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-04 20:05-0300\n" -"PO-Revision-Date: 2010-08-04 20:36-0300\n" +"POT-Creation-Date: 2017-09-10 11:11-0300\n" +"PO-Revision-Date: 2017-09-10 11:12-0300\n" "Last-Translator: Eduardo S. Dobay <edudobay@gmail.com>\n" -"Language-Team: Brazilian Portuguese <pt-br@li.org>\n" +"Language-Team: Brazilian Portuguese\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Language: pt_BR\n" +"X-Source-Language: en\n" + +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: bf_key_init() chamado com senha vazia" + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) != 4" + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: Uso incorreto de Blowfish big/little endian" + +msgid "E818: sha256 test failed" +msgstr "E818: verificação sha256 falhou" + +msgid "E819: Blowfish test failed" +msgstr "E819: verificação Blowfish falhou" + +msgid "[Location List]" +msgstr "[Lista de locais]" + +msgid "[Quickfix List]" +msgstr "[Lista quickfix]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Comando abortado devido a autocomandos" msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: No foi possvel alocar nenhum buffer, saindo do Vim..." +msgstr "E82: Não foi possível alocar nenhum buffer, saindo..." msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: Impossvel alocar buffer; tentando usar outro..." +msgstr "E83: Impossível alocar buffer; tentando usar outro..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: Buffer não pode ser registrado" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Tentativa de deletar um buffer em uso" msgid "E515: No buffers were unloaded" msgstr "E515: Nenhum buffer foi descarregado" @@ -49,40 +82,48 @@ msgstr "1 buffer eliminado" msgid "%d buffers wiped out" msgstr "%d buffers eliminados" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Impossível descarregar último buffer" + msgid "E84: No modified buffer found" -msgstr "E84: No foram encontrados buffers modificados" +msgstr "E84: Não foram encontrados buffers modificados" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" -msgstr "E85: No h buffers listados" - -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Buffer %ld no existe" +msgstr "E85: Não há buffers listados" msgid "E87: Cannot go beyond last buffer" -msgstr "E87: No possvel ir alm do ltimo buffer" +msgstr "E87: Não é possível ir além do último buffer" msgid "E88: Cannot go before first buffer" -msgstr "E88: No possvel ir para antes do primeiro buffer" +msgstr "E88: Não é possível ir para antes do primeiro buffer" #, c-format msgid "E89: No write since last change for buffer %ld (add ! to override)" -msgstr "E89: Alteraes no buffer %ld no foram gravadas (adicione ! para forar)" +msgstr "" +"E89: Alterações no buffer %ld não foram gravadas (adicione ! para forçar)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Impossvel descarregar ltimo buffer" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Tarefa ainda em execução (adicione ! para finalizá-la)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Alterações não foram gravadas (adicione ! para forçar)" + +msgid "E948: Job still running" +msgstr "E948: Tarefa ainda em execução" + +msgid "E37: No write since last change" +msgstr "E37: Não foi salvo desde a última alteração" msgid "W14: Warning: List of file names overflow" msgstr "W14: Aviso: Estouro da lista de nomes de arquivos" #, c-format msgid "E92: Buffer %ld not found" -msgstr "E92: Buffer %ld no encontrado" +msgstr "E92: Buffer %ld não encontrado" #, c-format msgid "E93: More than one match for %s" -msgstr "E93: Mais de uma correspondncia com %s" +msgstr "E93: Mais de uma correspondência com %s" #, c-format msgid "E94: No matching buffer for %s" @@ -93,13 +134,13 @@ msgid "line %ld" msgstr "linha %ld" msgid "E95: Buffer with this name already exists" -msgstr "E95: J existe um buffer com esse nome" +msgstr "E95: Já existe um buffer com esse nome" msgid " [Modified]" msgstr " [Modificado]" msgid "[Not edited]" -msgstr "[No editado]" +msgstr "[Não editado]" msgid "[New file]" msgstr "[Novo arquivo]" @@ -107,6 +148,9 @@ msgstr "[Novo arquivo]" msgid "[Read errors]" msgstr "[Erros de leitura]" +msgid "[RO]" +msgstr "[S/L]" + msgid "[readonly]" msgstr "[somente-leitura]" @@ -125,7 +169,6 @@ msgstr "linha %ld de %ld --%d%%-- col " msgid "[No Name]" msgstr "[Sem nome]" -#. must be a help buffer msgid "help" msgstr "ajuda" @@ -133,7 +176,7 @@ msgid "[Help]" msgstr "[Ajuda]" msgid "[Preview]" -msgstr "[Visualizao]" +msgstr "[Visualização]" msgid "All" msgstr "Tudo" @@ -144,7 +187,6 @@ msgstr "Fim" msgid "Top" msgstr "Topo" -#, c-format msgid "" "\n" "# Buffer list:\n" @@ -152,11 +194,8 @@ msgstr "" "\n" "# Lista de buffers:\n" -msgid "[Location List]" -msgstr "[Lista de locais]" - -msgid "[Quickfix List]" -msgstr "[Lista quickfix]" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Impossível gravar, opção 'buftype' foi definida" msgid "[Scratch]" msgstr "[Rascunho]" @@ -176,53 +215,145 @@ msgstr "Sinais para %s:" msgid " line=%ld id=%d name=%s" msgstr " linha=%ld id=%d nome=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Não foi possível conectar-se à porta" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() em channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() em channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: comando recebido com argumento não-string" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: último argumento para expr/call deve ser numérico" + +msgid "E904: third argument for call must be a list" +msgstr "E904: terceiro argumento para call deve ser uma lista" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: comando desconhecido recebido: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): tentativa de escrita enquanto desconectado" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): escrita falhou" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Impossível usar callback com %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: ch_evalexpr()/ch_sendexpr() não pode ser usado com canal raw ou nl" + +msgid "E906: not an open channel" +msgstr "E906: não é um canal aberto" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: arquivo _io requer definição de _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: buffer in_io requer definição de in_buf ou in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: buffer precisa ser carregado: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Arquivo criptografado com método desconhecido" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Alerta: Método fraco de criptografia; veja :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Insira a chave criptográfica: " + +msgid "Enter same key again: " +msgstr "Insira a mesma chave novamente: " + +msgid "Keys don't match!" +msgstr "As chaves não coincidem!" + +msgid "[crypted]" +msgstr "[criptografado]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Dois-pontos faltando no Dicionário: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Chave duplicada no Dicionário: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Vírgula faltando no Dicionário: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Dicionário não finalizado com '}': %s" + +msgid "extend() argument" +msgstr "argumento extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Chave já existe: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" -msgstr "E96: No possvel usar diff com mais de %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: Não é possível um diff com mais de %ld buffers" msgid "E810: Cannot read or write temp files" -msgstr "E810: No foi possvel ler ou gravar arquivos temporrios" +msgstr "E810: Não foi possível ler ou gravar arquivos temporários" msgid "E97: Cannot create diffs" -msgstr "E97: diff no funcionou" +msgstr "E97: diff não funcionou" msgid "Patch file" msgstr "Selecionar arquivo de patch" msgid "E816: Cannot read patch output" -msgstr "E816: No foi possvel ler o resultado do patch" +msgstr "E816: Não foi possível ler o resultado do patch" msgid "E98: Cannot read diff output" -msgstr "E98: No foi possvel ler o resultado do diff" +msgstr "E98: Não foi possível ler o resultado do diff" msgid "E99: Current buffer is not in diff mode" -msgstr "E99: O buffer atual no est no modo diff" +msgstr "E99: O buffer atual não está no modo diff" msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: No h nenhum outro buffer modificvel em modo diff" +msgstr "E793: Não há nenhum outro buffer modificável em modo diff" msgid "E100: No other buffer in diff mode" -msgstr "E100: No h nenhum outro buffer no modo diff" +msgstr "E100: Não há nenhum outro buffer no modo diff" msgid "E101: More than two buffers in diff mode, don't know which one to use" -msgstr "E101: H mais de dois buffers no modo diff; no sei quais usar" +msgstr "E101: Há mais de dois buffers no modo diff; não sei quais usar" #, c-format msgid "E102: Can't find buffer \"%s\"" -msgstr "E102: Buffer \"%s\" no encontrado" +msgstr "E102: Buffer \"%s\" não encontrado" #, c-format msgid "E103: Buffer \"%s\" is not in diff mode" -msgstr "E103: Buffer \"%s\" no est no modo diff" +msgstr "E103: Buffer \"%s\" não está no modo diff" msgid "E787: Buffer changed unexpectedly" msgstr "E787: Buffer foi alterado inesperadamente" msgid "E104: Escape not allowed in digraph" -msgstr "E104: Caractere escape no permitido em dgrafos" +msgstr "E104: Caractere escape não é permitido em dígrafos" msgid "E544: Keymap file not found" -msgstr "E544: Arquivo de mapa de teclado no encontrado" +msgstr "E544: Arquivo de mapa de teclado não encontrado" msgid "E105: Using :loadkeymap not in a sourced file" msgstr "E105: :loadkeymap usado fora de um script Vim" @@ -233,7 +364,6 @@ msgstr "E791: Entrada vazia no mapa de teclado" msgid " Keyword completion (^N^P)" msgstr " Completar palavra-chave (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " modo ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -247,50 +377,56 @@ msgid " Tag completion (^]^N^P)" msgstr " Completar marcador (^]^N^P)" msgid " Path pattern completion (^N^P)" -msgstr " Completar padro de caminho (^N^P)" +msgstr " Completar padrão de caminho (^N^P)" msgid " Definition completion (^D^N^P)" -msgstr " Completar definio (^D^N^P)" +msgstr " Completar definição (^D^N^P)" msgid " Dictionary completion (^K^N^P)" -msgstr " Completar do dicionrio (^K^N^P)" +msgstr " Completar do dicionário (^K^N^P)" msgid " Thesaurus completion (^T^N^P)" -msgstr " Completar do dicionrio de sinnimos (^T^N^P)" +msgstr " Completar do dicionário de sinônimos (^T^N^P)" msgid " Command-line completion (^V^N^P)" msgstr " Completar da linha de comando (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " Completar definido pelo usurio (^U^N^P)" +msgstr " Completar definido pelo usuário (^U^N^P)" msgid " Omni completion (^O^N^P)" -msgstr " Completao inteligente (^O^N^P)" +msgstr " Completação inteligente (^O^N^P)" msgid " Spelling suggestion (s^N^P)" -msgstr " Sugesto de ortografia (s^N^P)" +msgstr " Sugestão de ortografia (s^N^P)" msgid " Keyword Local completion (^N^P)" msgstr " Completar palavra-chave local (^N^P)" msgid "Hit end of paragraph" -msgstr "Fim do pargrafo atingido" +msgstr "Fim do parágrafo atingido" + +msgid "E839: Completion function changed window" +msgstr "E839: Janela alterada por função de completamento" + +msgid "E840: Completion function deleted text" +msgstr "E840: Função de completamento apagou texto" msgid "'dictionary' option is empty" -msgstr "opo 'dictionary' vazia" +msgstr "opção 'dictionary' vazia" msgid "'thesaurus' option is empty" -msgstr "opo 'thesaurus' vazia" +msgstr "opção 'thesaurus' vazia" #, c-format msgid "Scanning dictionary: %s" -msgstr "Examinando dicionrio: %s" +msgstr "Examinando dicionário: %s" msgid " (insert) Scroll (^E/^Y)" -msgstr " (insero) Rolagem (^E/^Y)" +msgstr " (inserção) Rolagem (^E/^Y)" msgid " (replace) Scroll (^E/^Y)" -msgstr " (substituio) Rolagem (^E/^Y)" +msgstr " (substituição) Rolagem (^E/^Y)" #, c-format msgid "Scanning: %s" @@ -299,13 +435,12 @@ msgstr "Examinando: %s" msgid "Scanning tags." msgstr "Examinando tags." +msgid "match in file" +msgstr "coincidência no arquivo" + msgid " Adding" msgstr " Adicionando" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Procurando..." @@ -316,98 +451,58 @@ msgid "Word from other line" msgstr "Palavra de outra linha" msgid "The only match" -msgstr "A nica correspondncia" +msgstr "A única correspondência" #, c-format msgid "match %d of %d" -msgstr "correspondncia %d de %d" +msgstr "correspondência %d de %d" #, c-format msgid "match %d" -msgstr "correspondncia %d" +msgstr "correspondência %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Caracteres inesperados em :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: ndice da lista fora dos limites: %ld" - #, c-format msgid "E121: Undefined variable: %s" -msgstr "E121: Varivel indefinida: %s" +msgstr "E121: Variável indefinida: %s" msgid "E111: Missing ']'" msgstr "E111: ']' faltando" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Argumento de %s deve ser uma Lista" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Argumento de %s deve ser uma Lista ou Dicionrio" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Impossvel usar chave vazia num Dicionrio" - -msgid "E714: List required" -msgstr "E714: Lista requerida" - -msgid "E715: Dictionary required" -msgstr "E715: Dicionrio requerido" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Muitos argumentos para a funo: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Chave inexistente no Dicionrio: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Funo %s j existe, adicione ! para substitu-la" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Entrada do Dicionrio j existente" - -msgid "E718: Funcref required" -msgstr "E718: Referncia de funo (Funcref) requerida" - msgid "E719: Cannot use [:] with a Dictionary" -msgstr "E719: No possvel usar [:] com um Dicionrio" +msgstr "E719: Não é possível usar [:] com um Dicionário" #, c-format msgid "E734: Wrong variable type for %s=" -msgstr "E734: Varivel de tipo errado para %s=" - -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Funo desconhecida: %s" +msgstr "E734: Variável de tipo errado para %s=" #, c-format msgid "E461: Illegal variable name: %s" -msgstr "E461: Nome ilegal para varivel: %s" +msgstr "E461: Nome ilegal para variável: %s" + +msgid "E806: using Float as a String" +msgstr "E806: Float usado como String" msgid "E687: Less targets than List items" -msgstr "E687: H menos destinos que itens na Lista" +msgstr "E687: Há menos destinos que itens na Lista" msgid "E688: More targets than List items" -msgstr "E688: H mais destinos que itens na Lista" +msgstr "E688: Há mais destinos que itens na Lista" msgid "Double ; in list of variables" -msgstr "; duplo na lista de variveis" +msgstr "; duplo na lista de variáveis" #, c-format msgid "E738: Can't list variables for %s" -msgstr "E738: Impossvel listar variveis %s" +msgstr "E738: Impossível listar variáveis %s" msgid "E689: Can only index a List or Dictionary" -msgstr "E689: S Listas ou Dicionrios podem ser indexados" +msgstr "E689: Só Listas ou Dicionários podem ser indexados" msgid "E708: [:] must come last" -msgstr "E708: [:] deve vir por ltimo" +msgstr "E708: [:] deve vir por último" msgid "E709: [:] requires a List value" msgstr "E709: [:] requer uma Lista" @@ -416,59 +511,59 @@ msgid "E710: List value has more items than target" msgstr "E710: a Lista tem mais itens que o destino" msgid "E711: List value has not enough items" -msgstr "E711: a Lista no tem itens suficientes" +msgstr "E711: a Lista não tem itens suficientes" msgid "E690: Missing \"in\" after :for" -msgstr "E690: \"in\" faltando aps :for" +msgstr "E690: \"in\" faltando após :for" #, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Parnteses faltando: %s" +msgid "E108: No such variable: \"%s\"" +msgstr "E108: Variável inexistente: \"%s\"" #, c-format -msgid "E108: No such variable: \"%s\"" -msgstr "E108: Varivel inexistente: \"%s\"" +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Impossível travar ou destravar variável %s" msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: varivel aninhada demais para ser (des)bloqueada" +msgstr "E743: variável aninhada demais para (des)bloquear" msgid "E109: Missing ':' after '?'" msgstr "E109: ':' faltando depois de '?'" msgid "E691: Can only compare List with List" -msgstr "E691: Uma Lista s pode ser comparada com outra Lista" +msgstr "E691: Uma Lista só pode ser comparada com outra Lista" msgid "E692: Invalid operation for List" -msgstr "E692: Operao invlida para Lista" +msgstr "E692: Operação inválida para Lista" msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Um Dicionrio s pode ser comparado com outro Dicionrio" +msgstr "E735: Um Dicionário só pode ser comparado com outro Dicionário" msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Operao invlida para um Dicionrio" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Funcref s pode ser comparada com outra Funcref" +msgstr "E736: Operação inválida para um Dicionário" msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Operao invlida para Funcrefs" +msgstr "E694: Operação inválida para Funcrefs" msgid "E804: Cannot use '%' with Float" -msgstr "E804: No possvel usar '%' com Float" +msgstr "E804: Não é possível usar '%' com Float" msgid "E110: Missing ')'" msgstr "E110: ')' faltando" msgid "E695: Cannot index a Funcref" -msgstr "E695: No possvel indexar uma Funcref" +msgstr "E695: Não é possível indexar uma Funcref" + +msgid "E909: Cannot index a special variable" +msgstr "E909: Não é possível indexar uma variável especial" #, c-format msgid "E112: Option name missing: %s" -msgstr "E112: Nome de opo faltando: %s" +msgstr "E112: Nome de opção faltando: %s" #, c-format msgid "E113: Unknown option: %s" -msgstr "E113: Opo desconhecida: %s" +msgstr "E113: Opção desconhecida: %s" #, c-format msgid "E114: Missing quote: %s" @@ -478,85 +573,138 @@ msgstr "E114: Aspas duplas (\") faltando: %s" msgid "E115: Missing quote: %s" msgstr "E115: Aspas simples (') faltando: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Falta uma vrgula na Lista: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Sem memória suficiente para definir referências, coleta de lixo abortada!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Lista no finalizada com ']': %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: variável aninhada demais para ser exibida" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Dois-pontos faltando no Dicionrio: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float usado como Número" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Chave duplicada no Dicionrio: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref usada como Número" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Vrgula faltando no Dicionrio: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Lista usada como Número" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Dicionrio no finalizado com '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dicionário usado como Número" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: varivel aninhada demais para ser exibida" +msgid "E910: Using a Job as a Number" +msgstr "E910: Job usado como Número" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Canal usado como Número" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref usada como Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: String usada como Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: Lista usada como Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dicionário usado como Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Valor especial usado como Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job usado como Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Usando Canal como Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref usada como String" + +msgid "E730: using List as a String" +msgstr "E730: Lista usada como String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dicionário usado como String" + +msgid "E908: using an invalid value as a String" +msgstr "E908: valor inválido usado como String" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Argumentos demais para a funo %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Impossível excluir variável %s" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Argumentos invlidos para a funo %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Nome de variável Funcref deve começar com letra maiúscula: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Funo desconhecida: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Nome da variável em conflito com função já existente: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Argumentos insuficientes para a funo: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Valor bloqueado: %s" + +msgid "Unknown" +msgstr "Desconhecido" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> usado fora de um script: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Não é possível mudar valor de %s" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: variável aninhada demais para fazer uma cópia" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# variáveis globais:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tDefinido pela última vez em " + +msgid "map() argument" +msgstr "argumento de map()" + +msgid "filter() argument" +msgstr "argumento de filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Funo dict chamada sem um Dicionrio: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Argumento de %s deve ser uma Lista" + +msgid "E928: String required" +msgstr "E928: String requerida" msgid "E808: Number or Float required" -msgstr "E808: Nmero ou Float requerido" +msgstr "E808: Número ou Float requerido" -msgid "E699: Too many arguments" -msgstr "E699: Argumentos demais" +msgid "add() argument" +msgstr "argumento de add()" msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() s pode ser usado no modo de Insero" +msgstr "E785: complete() só pode ser usado no modo de Inserção" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. msgid "&Ok" msgstr "&OK" #, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Chave j existe: %s" +msgid "E700: Unknown function: %s" +msgstr "E700: Função desconhecida: %s" -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld linhas: " +msgid "E922: expected a dict" +msgstr "E922: esperava um dict" -#, c-format -msgid "E700: Unknown function: %s" -msgstr "E700: Funo desconhecida: %s" +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Segundo argumento de function() deve ser list ou dict" msgid "" "&OK\n" @@ -568,328 +716,105 @@ msgstr "" msgid "called inputrestore() more often than inputsave()" msgstr "inputrestore() foi chamado mais vezes que inputsave()" +msgid "insert() argument" +msgstr "argumento de insert()" + msgid "E786: Range not allowed" -msgstr "E786: Intervalos no so permitidos" +msgstr "E786: Intervalos não são permitidos" + +msgid "E916: not a valid job" +msgstr "E916: não é um trabalho válido" msgid "E701: Invalid type for len()" -msgstr "E701: Tipo invlido para len()" +msgstr "E701: Tipo inválido para len()" + +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID reservado para \":match\": %ld" msgid "E726: Stride is zero" msgstr "E726: Incremento nulo" msgid "E727: Start past end" -msgstr "E727: O incio est depois do fim" +msgstr "E727: O início está depois do fim" msgid "<empty>" msgstr "<vazio>" -msgid "E240: No connection to Vim server" -msgstr "E240: Nenhuma conexo a um servidor do Vim" +msgid "E240: No connection to the X server" +msgstr "E240: Sem conexão ao servidor X" #, c-format msgid "E241: Unable to send to %s" -msgstr "E241: No foi possvel enviar para %s" +msgstr "E241: Não foi possível enviar para %s" msgid "E277: Unable to read a server reply" -msgstr "E277: No foi possvel ler a resposta do servidor" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Links simblicos em excesso (cclicos?)" +msgstr "E277: Não foi possível ler a resposta do servidor" -msgid "E258: Unable to send to client" -msgstr "E258: No foi possvel enviar ao cliente" +msgid "E941: already started a server" +msgstr "E941: servidor já iniciado" -msgid "E702: Sort compare function failed" -msgstr "E702: A funo de comparao para a classificao falhou" +msgid "E942: +clientserver feature not available" +msgstr "E942: recurso +clientserver não disponível" -msgid "(Invalid)" -msgstr "(Invlido)" +msgid "remove() argument" +msgstr "argumento de remove()" -msgid "E677: Error writing temp file" -msgstr "E677: Erro ao gravar o arquivo temporrio" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Links simbólicos em excesso (cíclicos?)" -msgid "E805: Using a Float as a Number" -msgstr "E805: Float usado como Nmero" +msgid "reverse() argument" +msgstr "argumento de reverse()" -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref usada como Nmero" +msgid "E258: Unable to send to client" +msgstr "E258: Não foi possível enviar ao cliente" -msgid "E745: Using a List as a Number" -msgstr "E745: Lista usada como Nmero" +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Ação inválida: '%s'" -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Dicionrio usado como Nmero" +msgid "sort() argument" +msgstr "argumento de sort()" -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref usada como String" +msgid "uniq() argument" +msgstr "argumento de uniq()" -msgid "E730: using List as a String" -msgstr "E730: Lista usada como String" +msgid "E702: Sort compare function failed" +msgstr "E702: Falha na função de comparação para ordenação" -msgid "E731: using Dictionary as a String" -msgstr "E731: Dicionrio usado como String" +msgid "E882: Uniq compare function failed" +msgstr "E882: Falha na função de comparação para uniq" -msgid "E806: using Float as a String" -msgstr "E806: Float usado como String" +msgid "(Invalid)" +msgstr "(Inválido)" #, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Nome de varivel Funcref deve comear com letra maiscula: %s" +msgid "E935: invalid submatch number: %d" +msgstr "E935: número inválido para subpadrão: %d" -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Nome da varivel em conflito com funo j existente: %s" +msgid "E677: Error writing temp file" +msgstr "E677: Erro ao gravar o arquivo temporário" -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Tipo de varivel incoerente para: %s" +msgid "E921: Invalid callback argument" +msgstr "E921: Argumento inválido para callback" #, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Impossvel excluir varivel %s" +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" #, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Valor bloqueado: %s" - -msgid "Unknown" -msgstr "Desconhecido" +msgid "> %d, Hex %04x, Octal %o" +msgstr "> %d, Hex %04x, Octal %o" #, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: No possvel mudar valor de %s" +msgid "> %d, Hex %08x, Octal %o" +msgstr "> %d, Hex %08x, Octal %o" -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: varivel aninhada demais para fazer uma cpia" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Funo indefinida: %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(' faltando: %s" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Argumento invlido: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction faltando" - -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Nome da funo em conflito com varivel: %s" - -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: No possvel redefinir a funo %s: ela est em uso" - -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Nome da funo no coincide com o nome de arquivo do script: %s" - -msgid "E129: Function name required" -msgstr "E129: Nome da funo requerido" - -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: Nome da funo deve comear com letra maiscula ou conter dois-pontos: %s" - -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: No possvel excluir a funo %s: ela est em uso" - -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Profundidade de chamadas de funo maior que 'maxfuncdepth'" - -#, c-format -msgid "calling %s" -msgstr "chamando %s" - -#, c-format -msgid "%s aborted" -msgstr "%s cancelada" - -#, c-format -msgid "%s returning #%ld" -msgstr "%s devolveu #%ld" - -#, c-format -msgid "%s returning %s" -msgstr "%s devolveu %s" - -#, c-format -msgid "continuing in %s" -msgstr "continuando em %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return fora de uma funo" - -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# variveis globais:\n" - -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tDefinido pela ltima vez em " - -msgid "No old files" -msgstr "No h arquivos antigos" - -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "Entrando modo de depurao. Digite \"cont\" para continuar." - -#, c-format -msgid "line %ld: %s" -msgstr "linha %ld: %s" - -#, c-format -msgid "cmd: %s" -msgstr "cmdo: %s" - -#, c-format -msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Ponto de interrupo em \"%s%s\", linha %ld" - -#, c-format -msgid "E161: Breakpoint not found: %s" -msgstr "E161: Ponto de interrupo no encontrado: %s" - -msgid "No breakpoints defined" -msgstr "Nenhum ponto de interrupo definido" - -#, c-format -msgid "%3d %s %s line %ld" -msgstr "%3d %s %s linha %ld" - -msgid "E750: First use \":profile start {fname}\"" -msgstr "E750: Primeiro digite \":profile start {nome_arquivo}\"" - -msgid "Save As" -msgstr "Salvar como" - -#, c-format -msgid "Save changes to \"%s\"?" -msgstr "Salvar as alteraes em \"%s\"?" - -msgid "Untitled" -msgstr "(Sem ttulo)" - -#, c-format -msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: Alteraes no buffer \"%s\" no foram gravadas" - -msgid "Warning: Entered other buffer unexpectedly (check autocommands)" -msgstr "Aviso: Entrada inesperada em outro buffer (verifique os autocomandos)" - -msgid "E163: There is only one file to edit" -msgstr "E163: S h um arquivo para editar" - -msgid "E164: Cannot go before first file" -msgstr "E164: Impossvel ir antes do primeiro arquivo" - -msgid "E165: Cannot go beyond last file" -msgstr "E165: Impossvel ir alm do ltimo arquivo" - -#, c-format -msgid "E666: compiler not supported: %s" -msgstr "E666: compilador no suportado: %s" - -#, c-format -msgid "Searching for \"%s\" in \"%s\"" -msgstr "Procurando por \"%s\" em \"%s\"" - -#, c-format -msgid "Searching for \"%s\"" -msgstr "Procurando por \"%s\"" - -#, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "no encontrado em 'runtimepath': \"%s\"" - -msgid "Source Vim script" -msgstr "Executar script do Vim" - -#, c-format -msgid "Cannot source a directory: \"%s\"" -msgstr "Impossvel executar um diretrio: \"%s\"" - -#, c-format -msgid "could not source \"%s\"" -msgstr "no foi possvel executar \"%s\"" - -#, c-format -msgid "line %ld: could not source \"%s\"" -msgstr "linha %ld: no foi possvel executar \"%s\"" - -#, c-format -msgid "sourcing \"%s\"" -msgstr "executando \"%s\"" - -#, c-format -msgid "line %ld: sourcing \"%s\"" -msgstr "linha %ld: executando \"%s\"" - -#, c-format -msgid "finished sourcing %s" -msgstr "fim da execuo de %s" - -msgid "modeline" -msgstr "modeline" - -msgid "--cmd argument" -msgstr "argumento --cmd" - -msgid "-c argument" -msgstr "argumento -c" - -msgid "environment variable" -msgstr "varivel de ambiente" - -msgid "error handler" -msgstr "tratador de erro" - -msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Aviso: Separador de linha incorreto; ^M pode estar faltando" - -msgid "E167: :scriptencoding used outside of a sourced file" -msgstr "E167: :scriptencoding usado fora de um script" - -msgid "E168: :finish used outside of a sourced file" -msgstr "E168: :finish usado fora de um script" - -#, c-format -msgid "Current %slanguage: \"%s\"" -msgstr "Idioma atual para %s: \"%s\"" - -#, c-format -msgid "E197: Cannot set language to \"%s\"" -msgstr "E197: Impossvel definir idioma como \"%s\"" - -#, c-format -msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" - -#, c-format -msgid "> %d, Hex %04x, Octal %o" -msgstr "> %d, Hex %04x, Octal %o" - -#, c-format -msgid "> %d, Hex %08x, Octal %o" -msgstr "> %d, Hex %08x, Octal %o" - -msgid "E134: Move lines into themselves" -msgstr "E134: O destino coincide com a origem" - -msgid "1 line moved" -msgstr "1 linha movida" +msgid "E134: Move lines into themselves" +msgstr "E134: O destino coincide com a origem" + +msgid "1 line moved" +msgstr "1 linha movida" #, c-format msgid "%ld lines moved" @@ -900,17 +825,17 @@ msgid "%ld lines filtered" msgstr "%ld linhas filtradas" msgid "E135: *Filter* Autocommands must not change current buffer" -msgstr "E135: Os autocomandos *Filter* no devem modificar o buffer atual" +msgstr "E135: Os autocomandos *Filter* não devem modificar o buffer atual" msgid "[No write since last change]\n" -msgstr "[Alteraes no gravadas]\n" +msgstr "[Alterações não gravadas]\n" #, c-format msgid "%sviminfo: %s in line: " msgstr "%sviminfo: %s na linha: " msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: H erros demais; abandonando a leitura do arquivo" +msgstr "E136: viminfo: Há erros demais; abandonando a leitura do arquivo" #, c-format msgid "Reading viminfo file \"%s\"%s%s%s" @@ -928,38 +853,52 @@ msgstr " arquivos antigos" msgid " FAILED" msgstr " FALHOU" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" -msgstr "E137: O arquivo viminfo no pode ser escrito: %s" +msgstr "E137: O arquivo viminfo não pode ser escrito: %s" + +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Muitos arquivos viminfo temporários para %s!" #, c-format msgid "E138: Can't write viminfo file %s!" -msgstr "E138: No possvel gravar o arquivo viminfo %s!" +msgstr "E138: Não é possível gravar o arquivo viminfo %s!" #, c-format msgid "Writing viminfo file \"%s\"" msgstr "Gravando arquivo viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Não é possível renomear o arquivo viminfo para %s!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Este arquivo viminfo foi gerado pelo Vim %s.\n" -#, c-format msgid "" "# You may edit it if you're careful!\n" "\n" msgstr "" -"# Voc pode edit-lo se for cuidadoso!\n" +"# Você pode editá-lo se for cuidadoso!\n" "\n" -#, c-format msgid "# Value of 'encoding' when this file was written\n" msgstr "# Valor de 'encoding' quando este arquivo foi escrito\n" msgid "Illegal starting char" -msgstr "Caractere inicial invlido" +msgstr "Caractere inicial inválido" + +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Linhas com barra, copiadas literalmente:\n" + +msgid "Save As" +msgstr "Salvar como" msgid "Write partial file?" msgstr "Gravar arquivo parcial?" @@ -973,26 +912,26 @@ msgstr "Sobrescrever arquivo existente \"%s\"?" #, c-format msgid "Swap file \"%s\" exists, overwrite anyway?" -msgstr "O arquivo de troca \"%s\" existe. Sobrescrev-lo?" +msgstr "O arquivo de troca \"%s\" existe. Sobrescrevê-lo?" #, c-format msgid "E768: Swap file exists: %s (:silent! overrides)" -msgstr "E768: Arquivo de troca existe: %s (:silent! para forar)" +msgstr "E768: Arquivo de troca existe: %s (:silent! para forçar)" #, c-format msgid "E141: No file name for buffer %ld" msgstr "E141: Sem nome de arquivo para o buffer %ld" msgid "E142: File not written: Writing is disabled by 'write' option" -msgstr "E142: Arquivo no gravado: gravao desativada pela opo 'write'" +msgstr "E142: Arquivo não gravado: gravação desativada pela opção 'write'" #, c-format msgid "" "'readonly' option is set for \"%s\".\n" "Do you wish to write anyway?" msgstr "" -"\"%s\" est com a opo 'readonly' (somente-leitura) ativada.\n" -"Voc deseja gravar assim mesmo?" +"\"%s\" está com a opção 'readonly' (somente-leitura) ativada.\n" +"Você deseja gravar assim mesmo?" #, c-format msgid "" @@ -1000,29 +939,30 @@ msgid "" "It may still be possible to write it.\n" "Do you wish to try?" msgstr "" -"As permisses para \"%s\" so somente-leitura.\n" -"Ainda pode ser possvel gravar no arquivo.\n" -"Voc deseja tentar?" +"As permissões para \"%s\" são somente-leitura.\n" +"Ainda pode ser possível gravar no arquivo.\n" +"Você deseja tentar?" #, c-format msgid "E505: \"%s\" is read-only (add ! to override)" -msgstr "E505: \"%s\" somente-leitura (adicione ! para forar)" +msgstr "E505: \"%s\" é somente-leitura (adicione ! para forçar)" msgid "Edit File" msgstr "Editar arquivo" #, c-format msgid "E143: Autocommands unexpectedly deleted new buffer %s" -msgstr "E143: Algum autocomando inesperadamente apagou o buffer %s recm-criado" +msgstr "" +"E143: Algum autocomando inesperadamente apagou o buffer %s recém-criado" msgid "E144: non-numeric argument to :z" -msgstr "E144: argumento no-numrico passado a :z" +msgstr "E144: argumento não-numérico passado a :z" msgid "E145: Shell commands not allowed in rvim" -msgstr "E145: Comandos do shell no so permitidos no rvim" +msgstr "E145: Comandos do shell não são permitidos no rvim" msgid "E146: Regular expressions can't be delimited by letters" -msgstr "E146: Expresses regulares no podem ser delimitadas por letras" +msgstr "E146: Expressões regulares não podem ser delimitadas por letras" #, c-format msgid "replace with %s (y/n/a/q/l/^E/^Y)?" @@ -1032,18 +972,18 @@ msgid "(Interrupted) " msgstr "(Interrompido) " msgid "1 match" -msgstr "1 correspondncia" +msgstr "1 correspondência" msgid "1 substitution" -msgstr "1 substituio" +msgstr "1 substituição" #, c-format msgid "%ld matches" -msgstr "%ld correspondncias" +msgstr "%ld correspondências" #, c-format msgid "%ld substitutions" -msgstr "%ld substituies" +msgstr "%ld substituições" msgid " on 1 line" msgstr " em 1 linha" @@ -1052,98 +992,262 @@ msgstr " em 1 linha" msgid " on %ld lines" msgstr " em %ld linhas" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global no pode ser executado recursivamente" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: Não é possível fazer :global recursivamente com um intervalo" msgid "E148: Regular expression missing from global" -msgstr "E148: Expresso regular faltando no comando :global" +msgstr "E148: Expressão regular faltando no comando :global" #, c-format msgid "Pattern found in every line: %s" -msgstr "Padro encontrado em toda linha: %s" +msgstr "Padrão encontrado em toda linha: %s" #, c-format +msgid "Pattern not found: %s" +msgstr "Padrão não encontrado: %s" + msgid "" "\n" "# Last Substitute String:\n" "$" msgstr "" "\n" -"# ltima string de substituio:\n" +"# Última string de substituição:\n" "$" -msgid "E478: Don't panic!" -msgstr "E478: No entre em pnico!" +msgid "E478: Don't panic!" +msgstr "E478: Não entre em pânico!" + +#, c-format +msgid "E661: Sorry, no '%s' help for %s" +msgstr "E661: Desculpe, nenhuma ajuda para %s em '%s'" + +#, c-format +msgid "E149: Sorry, no help for %s" +msgstr "E149: Desculpe, nenhuma ajuda para %s" + +#, c-format +msgid "Sorry, help file \"%s\" not found" +msgstr "Desculpe, arquivo de ajuda \"%s\" não encontrado" + +#, c-format +msgid "E151: No match: %s" +msgstr "E151: Nenhuma correspondência: %s" + +#, c-format +msgid "E152: Cannot open %s for writing" +msgstr "E152: Não foi possível abrir %s para escrita" + +#, c-format +msgid "E153: Unable to open %s for reading" +msgstr "E153: Não foi possível abrir %s para leitura" + +#, c-format +msgid "E670: Mix of help file encodings within a language: %s" +msgstr "E670: Mistura de codificações nos arquivos de ajuda na língua: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: Marcador duplicado \"%s\" no arquivo %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Não é um diretório: %s" + +#, c-format +msgid "E160: Unknown sign command: %s" +msgstr "E160: Subcomando sign desconhecido: %s" + +msgid "E156: Missing sign name" +msgstr "E156: Nome do sinal faltando" + +msgid "E612: Too many signs defined" +msgstr "E612: Muitos sinais definidos" + +#, c-format +msgid "E239: Invalid sign text: %s" +msgstr "E239: Texto de sinal inválido: %s" + +#, c-format +msgid "E155: Unknown sign: %s" +msgstr "E155: Sinal desconhecido: %s" + +msgid "E159: Missing sign number" +msgstr "E159: Número do sinal faltando" + +#, c-format +msgid "E158: Invalid buffer name: %s" +msgstr "E158: Nome de buffer inválido: %s" + +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Impossível pular para um buffer sem nome" + +#, c-format +msgid "E157: Invalid sign ID: %ld" +msgstr "E157: ID de sinal inválido: %ld" + +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Não é possível mudar o sinal %s" + +msgid " (NOT FOUND)" +msgstr " (NÃO ENCONTRADO)" + +msgid " (not supported)" +msgstr " (não suportado)" + +msgid "[Deleted]" +msgstr "[Excluído]" + +msgid "No old files" +msgstr "Não há arquivos antigos" + +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "Entrando modo de depuração. Digite \"cont\" para continuar." + +#, c-format +msgid "line %ld: %s" +msgstr "linha %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "cmdo: %s" + +msgid "frame is zero" +msgstr "quadro é zero" + +#, c-format +msgid "frame at highest level: %d" +msgstr "quadro no nível mais alto: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "Ponto de interrupção em \"%s%s\", linha %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: Ponto de interrupção não encontrado: %s" + +msgid "No breakpoints defined" +msgstr "Nenhum ponto de interrupção definido" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s linha %ld" + +msgid "E750: First use \":profile start {fname}\"" +msgstr "E750: Primeiro digite \":profile start {nome_arquivo}\"" + +#, c-format +msgid "Save changes to \"%s\"?" +msgstr "Salvar as alterações em \"%s\"?" + +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Tarefa em execução no buffer \"%s\"" + +#, c-format +msgid "E162: No write since last change for buffer \"%s\"" +msgstr "E162: Alterações no buffer \"%s\" não foram gravadas" + +msgid "Warning: Entered other buffer unexpectedly (check autocommands)" +msgstr "Aviso: Entrada inesperada em outro buffer (verifique os autocomandos)" + +msgid "E163: There is only one file to edit" +msgstr "E163: Só há um arquivo para editar" + +msgid "E164: Cannot go before first file" +msgstr "E164: Impossível ir antes do primeiro arquivo" + +msgid "E165: Cannot go beyond last file" +msgstr "E165: Impossível ir além do último arquivo" + +#, c-format +msgid "E666: compiler not supported: %s" +msgstr "E666: compilador não suportado: %s" + +#, c-format +msgid "Searching for \"%s\" in \"%s\"" +msgstr "Procurando por \"%s\" em \"%s\"" + +#, c-format +msgid "Searching for \"%s\"" +msgstr "Procurando por \"%s\"" + +#, c-format +msgid "not found in '%s': \"%s\"" +msgstr "não encontrado em '%s': \"%s\"" #, c-format -msgid "E661: Sorry, no '%s' help for %s" -msgstr "E661: Desculpe, nenhuma ajuda para %s em '%s'" +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Versão 2.x do python não suportada; ignorando arquivo: %s" #, c-format -msgid "E149: Sorry, no help for %s" -msgstr "E149: Desculpe, nenhuma ajuda para %s" +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Versão 3.x do python não suportada; ignorando arquivo: %s" + +msgid "Source Vim script" +msgstr "Executar script do Vim" #, c-format -msgid "Sorry, help file \"%s\" not found" -msgstr "Desculpe, arquivo de ajuda \"%s\" no encontrado" +msgid "Cannot source a directory: \"%s\"" +msgstr "Impossível executar um diretório: \"%s\"" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: No um diretrio: %s" +msgid "could not source \"%s\"" +msgstr "não foi possível executar \"%s\"" #, c-format -msgid "E152: Cannot open %s for writing" -msgstr "E152: No foi possvel abrir %s para escrita" +msgid "line %ld: could not source \"%s\"" +msgstr "linha %ld: não foi possível executar \"%s\"" #, c-format -msgid "E153: Unable to open %s for reading" -msgstr "E153: No foi possvel abrir %s para leitura" +msgid "sourcing \"%s\"" +msgstr "executando \"%s\"" #, c-format -msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: Mistura de codificaes nos arquivos de ajuda na lngua: %s" +msgid "line %ld: sourcing \"%s\"" +msgstr "linha %ld: executando \"%s\"" #, c-format -msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Marcador duplicado \"%s\" no arquivo %s/%s" +msgid "finished sourcing %s" +msgstr "fim da execução de %s" #, c-format -msgid "E160: Unknown sign command: %s" -msgstr "E160: Subcomando sign desconhecido: %s" +msgid "continuing in %s" +msgstr "continuando em %s" -msgid "E156: Missing sign name" -msgstr "E156: Nome do sinal faltando" +msgid "modeline" +msgstr "modeline" -msgid "E612: Too many signs defined" -msgstr "E612: Muitos sinais definidos" +msgid "--cmd argument" +msgstr "argumento --cmd" -#, c-format -msgid "E239: Invalid sign text: %s" -msgstr "E239: Texto de sinal invlido: %s" +msgid "-c argument" +msgstr "argumento -c" -#, c-format -msgid "E155: Unknown sign: %s" -msgstr "E155: Sinal desconhecido: %s" +msgid "environment variable" +msgstr "variável de ambiente" -msgid "E159: Missing sign number" -msgstr "E159: Nmero do sinal faltando" +msgid "error handler" +msgstr "tratador de erro" -#, c-format -msgid "E158: Invalid buffer name: %s" -msgstr "E158: Nome de buffer invlido: %s" +msgid "W15: Warning: Wrong line separator, ^M may be missing" +msgstr "W15: Aviso: Separador de linha incorreto; ^M pode estar faltando" -#, c-format -msgid "E157: Invalid sign ID: %ld" -msgstr "E157: ID de sinal invlido: %ld" +msgid "E167: :scriptencoding used outside of a sourced file" +msgstr "E167: :scriptencoding usado fora de um script" -msgid " (NOT FOUND)" -msgstr " (NO ENCONTRADO)" +msgid "E168: :finish used outside of a sourced file" +msgstr "E168: :finish usado fora de um script" -msgid " (not supported)" -msgstr " (no suportado)" +#, c-format +msgid "Current %slanguage: \"%s\"" +msgstr "Idioma atual para %s: \"%s\"" -msgid "[Deleted]" -msgstr "[Excludo]" +#, c-format +msgid "E197: Cannot set language to \"%s\"" +msgstr "E197: Impossível definir idioma como \"%s\"" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "Entrando no modo Ex. Digite \"visual\" para ir para o modo Normal." @@ -1156,41 +1260,45 @@ msgstr "E169: Comando recursivo demais" #, c-format msgid "E605: Exception not caught: %s" -msgstr "E605: Exceo no interceptada: %s" +msgstr "E605: Exceção não interceptada: %s" msgid "End of sourced file" msgstr "Fim do arquivo executado" msgid "End of function" -msgstr "Fim da funo" +msgstr "Fim da função" msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: Uso ambguo de comando definido pelo usurio" +msgstr "E464: Uso ambíguo de comando definido pelo usuário" msgid "E492: Not an editor command" -msgstr "E492: No um comando do editor" +msgstr "E492: Não é um comando do editor" msgid "E493: Backwards range given" msgstr "E493: Intervalo com limites invertidos" msgid "Backwards range given, OK to swap" -msgstr "O intervalo dado est com os limites invertidos. OK para reverter" +msgstr "O intervalo dado está com os limites invertidos. OK para reverter" msgid "E494: Use w or w>>" msgstr "E494: Use w ou w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "" +"E943: Tabela de comandos precisa ser atualizada, execute 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: Desculpe, esse comando no est disponvel nesta verso" +msgstr "E319: Desculpe, esse comando não está disponível nesta versão" msgid "E172: Only one file name allowed" -msgstr "E172: S permitido um nome de arquivo" +msgstr "E172: Só é permitido um nome de arquivo" msgid "1 more file to edit. Quit anyway?" -msgstr "Ainda h 1 arquivo para editar. Sair mesmo assim?" +msgstr "Ainda há 1 arquivo para editar. Sair mesmo assim?" #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "H mais %d arquivos para editar. Sair mesmo assim?" +msgstr "Há mais %d arquivos para editar. Sair mesmo assim?" msgid "E173: 1 more file to edit" msgstr "E173: Mais 1 arquivo para editar" @@ -1200,72 +1308,84 @@ msgid "E173: %ld more files to edit" msgstr "E173: Mais %ld arquivos para editar" msgid "E174: Command already exists: add ! to replace it" -msgstr "E174: Comando j existe; adicione ! para substitu-lo" +msgstr "E174: Comando já existe; adicione ! para substituí-lo" msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nome Args Intrv Complet. Definio" +" Nome Args Intrv Complet. Definição" msgid "No user-defined commands found" -msgstr "Nenhum comando definido pelo usurio foi encontrado" +msgstr "Nenhum comando definido pelo usuário foi encontrado" msgid "E175: No attribute specified" msgstr "E175: Nenhum atributo foi especificado" msgid "E176: Invalid number of arguments" -msgstr "E176: Nmero invlido de argumentos" +msgstr "E176: Número inválido de argumentos" msgid "E177: Count cannot be specified twice" -msgstr "E177: Quantificador no pode ser especificado duas vezes" +msgstr "E177: Quantificador não pode ser especificado duas vezes" msgid "E178: Invalid default value for count" -msgstr "E178: Valor padro invlido para o quantificador" +msgstr "E178: Valor padrão inválido para o quantificador" msgid "E179: argument required for -complete" -msgstr "E179: argumento necessrio para -complete" +msgstr "E179: argumento necessário para -complete" + +msgid "E179: argument required for -addr" +msgstr "E179: argumento necessário para -addr" #, c-format msgid "E181: Invalid attribute: %s" -msgstr "E181: Atributo invlido: %s" +msgstr "E181: Atributo inválido: %s" msgid "E182: Invalid command name" -msgstr "E182: Nome de comando invlido" +msgstr "E182: Nome de comando inválido" msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: Comandos definidos pelo usurio devem comear com letra maiscula" +msgstr "" +"E183: Comandos definidos pelo usuário devem começar com letra maiúscula" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "" +"E841: Nome reservado, não pode ser usado para comando definido pelo usuário" #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: No existe tal comando definido pelo usurio: %s" +msgstr "E184: Não existe tal comando definido pelo usuário: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Tipo de endereço inválido: %s" #, c-format msgid "E180: Invalid complete value: %s" -msgstr "E180: Valor invlido para -complete: %s" +msgstr "E180: Valor inválido para -complete: %s" msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: Argumento s permitido para completao personalizada" +msgstr "E468: Argumento só é permitido para completação personalizada" msgid "E467: Custom completion requires a function argument" -msgstr "E467: Completao automtica requer funo como argumento" +msgstr "E467: Completação automática requer função como argumento" msgid "unknown" msgstr "desconhecido" #, c-format -msgid "E185: Cannot find color scheme %s" -msgstr "E185: Esquema de cores %s no encontrado" +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Esquema de cores '%s' não encontrado" msgid "Greetings, Vim user!" -msgstr "Saudaes, usurio do Vim!" +msgstr "Saudações, usuário do Vim!" msgid "E784: Cannot close last tab page" -msgstr "E784: No possvel fechar a ltima aba" +msgstr "E784: Não é possível fechar a última aba" msgid "Already only one tab page" -msgstr "J h apenas uma aba" +msgstr "Já há apenas uma aba" msgid "Edit File in new window" msgstr "Editar arquivo em nova janela" @@ -1281,113 +1401,125 @@ msgid "Append File" msgstr "Adicionar arquivo" msgid "E747: Cannot change directory, buffer is modified (add ! to override)" -msgstr "E747: Impossvel mudar de diretrio, o buffer foi alterado (adicione ! para forar)" +msgstr "" +"E747: Impossível mudar de diretório, o buffer foi alterado (adicione ! para " +"forçar)" msgid "E186: No previous directory" -msgstr "E186: No h diretrio anterior" +msgstr "E186: Não há diretório anterior" msgid "E187: Unknown" msgstr "E187: Desconhecido" msgid "E465: :winsize requires two number arguments" -msgstr "E465: :winsize requer dois argumentos numricos" +msgstr "E465: :winsize requer dois argumentos numéricos" #, c-format msgid "Window position: X %d, Y %d" -msgstr "Posio da janela: X %d, Y %d" +msgstr "Posição da janela: X %d, Y %d" msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: A obteno da posio da janela no foi implementada para esta plataforma" +msgstr "" +"E188: A obtenção da posição da janela não foi implementada para esta " +"plataforma" msgid "E466: :winpos requires two number arguments" -msgstr "E466: :winpos requer dois argumentos numricos" +msgstr "E466: :winpos requer dois argumentos numéricos" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Impossível usar :redir dentro de execute()" msgid "Save Redirection" msgstr "Salvar redirecionamento" msgid "Save View" -msgstr "Salvar viso atual" +msgstr "Salvar visão atual" msgid "Save Session" -msgstr "Salvar sesso" +msgstr "Salvar sessão" msgid "Save Setup" -msgstr "Salvar configuraes" +msgstr "Salvar configurações" #, c-format msgid "E739: Cannot create directory: %s" -msgstr "E739: Diretrio no pode ser criado: %s" +msgstr "E739: Diretório não pode ser criado: %s" #, c-format msgid "E189: \"%s\" exists (add ! to override)" -msgstr "E189: \"%s\" existe (adicione ! para forar)" +msgstr "E189: \"%s\" existe (adicione ! para forçar)" #, c-format msgid "E190: Cannot open \"%s\" for writing" -msgstr "E190: \"%s\" no pode ser aberto para escrita" +msgstr "E190: \"%s\" não pode ser aberto para escrita" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: Argumento deve ser uma letra ou aspa (` ou ')" msgid "E192: Recursive use of :normal too deep" -msgstr "E192: Recurso excessiva de :normal" +msgstr "E192: Recursão excessiva de :normal" msgid "E809: #< is not available without the +eval feature" -msgstr "E809: #< no est disponvel sem o recurso +eval" +msgstr "E809: #< não está disponível sem o recurso +eval" msgid "E194: No alternate file name to substitute for '#'" msgstr "E194: Sem nome de arquivo alternativo para substituir '#'" msgid "E495: no autocommand file name to substitute for \"<afile>\"" -msgstr "E495: nenhum nome de arquivo de autocomandos para substituir \"<afile>\"" +msgstr "" +"E495: nenhum nome de arquivo de autocomandos para substituir \"<afile>\"" msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" -msgstr "E496: nenhum nmero de buffer de autocomandos para substituir \"<abuf>\"" +msgstr "" +"E496: nenhum número de buffer de autocomandos para substituir \"<abuf>\"" msgid "E497: no autocommand match name to substitute for \"<amatch>\"" -msgstr "E497: nenhum critrio de autocomando para substituir \"<amatch>\"" +msgstr "E497: nenhum critério de autocomando para substituir \"<amatch>\"" msgid "E498: no :source file name to substitute for \"<sfile>\"" msgstr "E498: nenhum nome de arquivo :source para substituir \"<sfile>\"" +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: sem número de linha para substituir \"<slnum>\"" + #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" -msgstr "E499: Nome de arquivo vazio para '%' ou '#' s funciona com \":p:h\"" +msgstr "E499: Nome de arquivo vazio para '%' ou '#' só funciona com \":p:h\"" msgid "E500: Evaluates to an empty string" -msgstr "E500: Expresso resulta em string vazia" +msgstr "E500: Expressão resulta em string vazia" msgid "E195: Cannot open viminfo file for reading" -msgstr "E195: O arquivo viminfo no pode ser aberto para leitura" +msgstr "E195: O arquivo viminfo não pode ser aberto para leitura" + +msgid "Untitled" +msgstr "Sem título" msgid "E196: No digraphs in this version" -msgstr "E196: Sem suporte a dgrafos nesta verso" +msgstr "E196: Sem suporte a dígrafos nesta versão" msgid "E608: Cannot :throw exceptions with 'Vim' prefix" -msgstr "E608: No possvel lanar excees com o prefixo 'Vim'" +msgstr "E608: Não é possível lançar exceções com o prefixo 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" -msgstr "Exceo lanada: %s" +msgstr "Exceção lançada: %s" #, c-format msgid "Exception finished: %s" -msgstr "Exceo concluda: %s" +msgstr "Exceção concluída: %s" #, c-format msgid "Exception discarded: %s" -msgstr "Exceo descartada: %s" +msgstr "Exceção descartada: %s" #, c-format msgid "%s, line %ld" msgstr "%s, linha %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" -msgstr "Exceo interceptada: %s" +msgstr "Exceção interceptada: %s" #, c-format msgid "%s made pending" @@ -1402,17 +1534,16 @@ msgid "%s discarded" msgstr "%s descartado(s)" msgid "Exception" -msgstr "Exceo" +msgstr "Exceção" msgid "Error and interrupt" -msgstr "Erro e interrupo" +msgstr "Erro e interrupção" msgid "Error" msgstr "Erro" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" -msgstr "Interrupo" +msgstr "Interrupção" msgid "E579: :if nesting too deep" msgstr "E579: :if aninhado demais" @@ -1453,15 +1584,12 @@ msgstr "E601: :try aninhado demais" msgid "E603: :catch without :try" msgstr "E603: :catch sem :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch depois de :finally" msgid "E606: :finally without :try" msgstr "E606: :finally sem :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: mais de um :finally" @@ -1469,13 +1597,13 @@ msgid "E602: :endtry without :try" msgstr "E602: :endtry sem :try" msgid "E193: :endfunction not inside a function" -msgstr "E193: :endfunction fora de uma funo" +msgstr "E193: :endfunction fora de uma função" msgid "E788: Not allowed to edit another buffer now" -msgstr "E788: No possvel editar outro buffer agora" +msgstr "E788: Não é possível editar outro buffer agora" msgid "E811: Not allowed to change buffer information now" -msgstr "E811: No permitido mudar as informaes do buffer agora" +msgstr "E811: Não é permitido mudar as informações do buffer agora" msgid "tagname" msgstr "marcador" @@ -1484,7 +1612,7 @@ msgid " kind file\n" msgstr " tipo arquivo\n" msgid "'history' option is zero" -msgstr "opo 'history' vale zero" +msgstr "opção 'history' vale zero" #, c-format msgid "" @@ -1492,22 +1620,25 @@ msgid "" "# %s History (newest to oldest):\n" msgstr "" "\n" -"# Histrico de %s (mais recente primeiro):\n" +"# Histórico de %s (mais recente primeiro):\n" msgid "Command Line" -msgstr "Linha de comando" +msgstr "linha de comando" msgid "Search String" -msgstr "Expresses de busca" +msgstr "expressões de busca" msgid "Expression" -msgstr "Expresso" +msgstr "expressões" msgid "Input Line" -msgstr "Linhas de entrada" +msgstr "linha de entrada" + +msgid "Debug Line" +msgstr "linha de debug" msgid "E198: cmd_pchar beyond the command length" -msgstr "E198: cmd_pchar alm do final do comando" +msgstr "E198: cmd_pchar além do final do comando" msgid "E199: Active window or buffer deleted" msgstr "E199: A janela ou buffer ativo foi apagado" @@ -1516,44 +1647,43 @@ msgid "E812: Autocommands changed buffer or buffer name" msgstr "E812: Autocomandos alteraram o buffer ou o nome do buffer" msgid "Illegal file name" -msgstr "Nome de arquivo invlido" +msgstr "Nome de arquivo inválido" msgid "is a directory" -msgstr " um diretrio" +msgstr "é um diretório" msgid "is not a file" -msgstr "no um arquivo" +msgstr "não é um arquivo" msgid "is a device (disabled with 'opendevice' option)" -msgstr " um dispositivo (desativado pela opo 'opendevice')" +msgstr "é um dispositivo (desativado pela opção 'opendevice')" msgid "[New File]" msgstr "[Novo arquivo]" msgid "[New DIRECTORY]" -msgstr "[Novo DIRETRIO]" +msgstr "[Novo DIRETÓRIO]" msgid "[File too big]" msgstr "[Arquivo muito grande]" msgid "[Permission Denied]" -msgstr "[Permisso negada]" +msgstr "[Permissão negada]" msgid "E200: *ReadPre autocommands made the file unreadable" -msgstr "E200: Autocomandos *ReadPre tornaram o arquivo ilegvel" +msgstr "E200: Autocomandos *ReadPre tornaram o arquivo ilegível" msgid "E201: *ReadPre autocommands must not change current buffer" -msgstr "E201: Os autocomandos *ReadPre no devem alterar o buffer atual" +msgstr "E201: Os autocomandos *ReadPre não devem alterar o buffer atual" msgid "Vim: Reading from stdin...\n" -msgstr "Vim: Lendo da entrada padro...\n" +msgstr "Vim: Lendo da entrada padrão...\n" msgid "Reading from stdin..." -msgstr "Lendo da entrada padro..." +msgstr "Lendo da entrada padrão..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" -msgstr "E202: A converso tornou o arquivo ilegvel!" +msgstr "E202: A conversão tornou o arquivo ilegível!" msgid "[fifo/socket]" msgstr "[fifo/socket]" @@ -1567,9 +1697,6 @@ msgstr "[socket]" msgid "[character special]" msgstr "[dispositivo de caractere]" -msgid "[RO]" -msgstr "[S/L]" - msgid "[CR missing]" msgstr "[CR faltando]" @@ -1577,87 +1704,84 @@ msgid "[long lines split]" msgstr "[linhas longas divididas]" msgid "[NOT converted]" -msgstr "[NO convertido]" +msgstr "[NÃO convertido]" msgid "[converted]" msgstr "[convertido]" -msgid "[crypted]" -msgstr "[criptografado]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" -msgstr "[ERRO DE CONVERSO na linha %ld]" +msgstr "[ERRO DE CONVERSÃO na linha %ld]" #, c-format msgid "[ILLEGAL BYTE in line %ld]" -msgstr "[BYTE INVLIDO na linha %ld]" +msgstr "[BYTE INVÁLIDO na linha %ld]" msgid "[READ ERRORS]" msgstr "[ERROS DE LEITURA]" msgid "Can't find temp file for conversion" -msgstr "No foi possvel encontrar um arquivo temporrio para a converso" +msgstr "Não foi possível encontrar um arquivo temporário para a conversão" msgid "Conversion with 'charconvert' failed" -msgstr "Converso com 'charconvert' falhou" +msgstr "Conversão com 'charconvert' falhou" msgid "can't read output of 'charconvert'" -msgstr "no foi possvel ler o resultado de 'charconvert'" +msgstr "não foi possível ler o resultado de 'charconvert'" msgid "E676: No matching autocommands for acwrite buffer" -msgstr "E676: Nenhum comando automtico correspondente para acwrite buffer" +msgstr "E676: Nenhum comando automático correspondente para acwrite buffer" msgid "E203: Autocommands deleted or unloaded buffer to be written" msgstr "E203: Os autocomandos apagaram ou descarregaram o buffer a ser gravado" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Autocomando alterou nmero de linhas de maneira inesperada" +msgstr "E204: Autocomando alterou número de linhas de maneira inesperada" msgid "NetBeans disallows writes of unmodified buffers" -msgstr "NetBeans no permite gravao de buffers no modificados" +msgstr "NetBeans não permite gravação de buffers não modificados" msgid "Partial writes disallowed for NetBeans buffers" -msgstr "Gravao parcial no permitida em buffers do NetBeans" +msgstr "Gravação parcial não é permitida em buffers do NetBeans" msgid "is not a file or writable device" -msgstr "no um arquivo ou dispositivo com permisso de escrita" +msgstr "não é um arquivo ou dispositivo com permissão de escrita" msgid "writing to device disabled with 'opendevice' option" -msgstr "escrita em dispositivo desativada pela opo 'opendevice'" +msgstr "escrita em dispositivo desativada pela opção 'opendevice'" msgid "is read-only (add ! to override)" -msgstr " somente-leitura (adicione ! para forar)" +msgstr "é somente-leitura (adicione ! para forçar)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: Impossvel gravar arquivo de backup (adicione ! para forar)" +msgstr "E506: Impossível gravar arquivo de backup (adicione ! para forçar)" msgid "E507: Close error for backup file (add ! to override)" -msgstr "E507: Erro de fechamento no arquivo de backup (adicione ! para forar)" +msgstr "E507: Erro de fechamento no arquivo de backup (adicione ! para forçar)" msgid "E508: Can't read file for backup (add ! to override)" -msgstr "E508: Impossvel ler o arquivo para backup (adicione ! para forar)" +msgstr "E508: Impossível ler o arquivo para backup (adicione ! para forçar)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: Impossvel criar arquivo de backup (adicione ! para forar)" +msgstr "E509: Impossível criar arquivo de backup (adicione ! para forçar)" msgid "E510: Can't make backup file (add ! to override)" -msgstr "E510: Impossvel fazer o backup (adicione ! para forar)" +msgstr "E510: Impossível fazer o backup (adicione ! para forçar)" msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: O resource fork seria perdido (adicione ! para forar)" +msgstr "E460: O resource fork seria perdido (adicione ! para forçar)" msgid "E214: Can't find temp file for writing" -msgstr "E214: No foi possvel encontrar arquivo temporrio para escrita" +msgstr "E214: Não foi possível encontrar arquivo temporário para escrita" msgid "E213: Cannot convert (add ! to write without conversion)" -msgstr "E213: Impossvel converter (adicione ! para gravar sem converter)" +msgstr "E213: Impossível converter (adicione ! para gravar sem converter)" msgid "E166: Can't open linked file for writing" -msgstr "E166: Impossvel abrir ligao para escrita" +msgstr "E166: Impossível abrir ligação para escrita" msgid "E212: Can't open file for writing" -msgstr "E212: Impossvel abrir arquivo para escrita" +msgstr "E212: Impossível abrir arquivo para escrita" msgid "E667: Fsync failed" msgstr "E667: Fsync falhou" @@ -1666,17 +1790,22 @@ msgid "E512: Close failed" msgstr "E512: Falha no fechamento do arquivo" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: erro de gravao, converso falhou (torne 'fenc' vazio para forar)" +msgstr "" +"E513: erro de gravação, conversão falhou (torne 'fenc' vazio para forçar)" #, c-format -msgid "E513: write error, conversion failed in line %ld (make 'fenc' empty to override)" -msgstr "E513: erro de gravao, converso falhou na linha %ld (deixe 'fenc' vazio para forar)" +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "" +"E513: erro de gravação, conversão falhou na linha %ld (deixe 'fenc' vazio " +"para forçar)" msgid "E514: write error (file system full?)" -msgstr "E514: erro de gravao (sistema de arquivos cheio?)" +msgstr "E514: erro de gravação (sistema de arquivos cheio?)" msgid " CONVERSION ERROR" -msgstr " ERRO DE CONVERSO" +msgstr " ERRO DE CONVERSÃO" #, c-format msgid " in line %ld;" @@ -1701,13 +1830,13 @@ msgid " written" msgstr " gravado(s)" msgid "E205: Patchmode: can't save original file" -msgstr "E205: patchmode: impossvel salvar o arquivo original" +msgstr "E205: patchmode: impossível salvar o arquivo original" msgid "E206: patchmode: can't touch empty original file" -msgstr "E206: patchmode: impossvel criar arquivo original vazio" +msgstr "E206: patchmode: impossível criar arquivo original vazio" msgid "E207: Can't delete backup file" -msgstr "E207: Impossvel excluir arquivo de backup" +msgstr "E207: Impossível excluir arquivo de backup" msgid "" "\n" @@ -1717,7 +1846,7 @@ msgstr "" "AVISO: O arquivo original pode ter sido perdido ou danificado\n" msgid "don't quit the editor until the file is successfully written!" -msgstr "no saia do editor at que o arquivo tenha sido gravado com sucesso!" +msgstr "não saia do editor até que o arquivo tenha sido gravado com sucesso!" msgid "[dos]" msgstr "[dos]" @@ -1748,23 +1877,20 @@ msgid "1 character" msgstr "1 caractere" #, c-format -msgid "%ld characters" -msgstr "%ld caracteres" +msgid "%lld characters" +msgstr "%lld caracteres" msgid "[noeol]" msgstr "[sem fim de linha]" msgid "[Incomplete last line]" -msgstr "[ltima linha incompleta]" +msgstr "[Última linha incompleta]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "AVISO: O arquivo foi alterado desde que foi carregado!!!" msgid "Do you really want to write to it" -msgstr "Voc realmente deseja grav-lo" +msgstr "Você realmente deseja gravá-lo" #, c-format msgid "E208: Error writing to \"%s\"" @@ -1783,32 +1909,37 @@ msgstr "E246: O autocomando FileChangedShell apagou o buffer" #, c-format msgid "E211: File \"%s\" no longer available" -msgstr "E211: Arquivo \"%s\" no est mais disponvel" +msgstr "E211: Arquivo \"%s\" não está mais disponível" #, c-format -msgid "W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as well" -msgstr "W12: Aviso: O arquivo \"%s\" foi alterado e o buffer tambm foi alterado no Vim!" +msgid "" +"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"well" +msgstr "" +"W12: Aviso: arquivo \"%s\" foi alterado e o buffer também foi alterado no Vim" msgid "See \":help W12\" for more info." -msgstr "Veja \":help W12\" para mais informaes." +msgstr "Veja \":help W12\" para mais informações." #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Aviso: O arquivo \"%s\" foi alterado desde o incio da edio!" +msgstr "W11: Aviso: arquivo \"%s\" foi alterado desde o início da edição" msgid "See \":help W11\" for more info." -msgstr "Veja \":help W11\" para mais informaes." +msgstr "Veja \":help W11\" para mais informações." #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" -msgstr "W16: Aviso: O modo do arquivo \"%s\" foi alterado desde o incio da edio!" +msgstr "W16: Aviso: modo do arquivo \"%s\" alterado desde o início da edição" msgid "See \":help W16\" for more info." -msgstr "Veja \":help W16\" para mais informaes." +msgstr "Veja \":help W16\" para mais informações." #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Aviso: O arquivo \"%s\" foi criado aps o incio da edio!" +msgstr "" +"W13: Aviso: arquivo \"%s\" foi criado por outro programa desde o início da " +"edição" msgid "Warning" msgstr "Aviso" @@ -1822,27 +1953,32 @@ msgstr "" #, c-format msgid "E462: Could not prepare for reloading \"%s\"" -msgstr "E462: No foi possvel preparar \"%s\" para ser recarregado" +msgstr "E462: Não foi possível preparar \"%s\" para ser recarregado" #, c-format msgid "E321: Could not reload \"%s\"" -msgstr "E321: No foi possvel recarregar \"%s\"" +msgstr "E321: Não foi possível recarregar \"%s\"" msgid "--Deleted--" -msgstr "--Excludo--" +msgstr "--Excluído--" #, c-format msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "removendo automaticamente o autocomando: %s <buffer=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Grupo inexistente: \"%s\"" +msgid "E936: Cannot delete the current group" +msgstr "E936: Impossível deletar o grupo atual" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Deletando augroup em uso" + #, c-format msgid "E215: Illegal character after *: %s" -msgstr "E215: Caractere invlido aps *: %s" +msgstr "E215: Caractere inválido após *: %s" #, c-format msgid "E216: No such event: %s" @@ -1852,7 +1988,6 @@ msgstr "E216: Evento inexistente: %s" msgid "E216: No such group or event: %s" msgstr "E216: Grupo ou evento inexistente: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -1862,10 +1997,10 @@ msgstr "" #, c-format msgid "E680: <buffer=%d>: invalid buffer number " -msgstr "E680: <buffer=%d>: nmero invlido de buffer " +msgstr "E680: <buffer=%d>: número inválido de buffer " msgid "E217: Can't execute autocommands for ALL events" -msgstr "E217: No possvel executar autocomandos para TODOS os eventos" +msgstr "E217: Não é possível executar autocomandos para TODOS os eventos" msgid "No matching autocommands" msgstr "Nenhum autocomando coincidente" @@ -1875,7 +2010,7 @@ msgstr "E218: autocomandos aninhados demais" #, c-format msgid "%s Auto commands for \"%s\"" -msgstr "Comandos automticos %s para \"%s\"" +msgstr "Comandos automáticos %s para \"%s\"" #, c-format msgid "Executing %s" @@ -1895,61 +2030,88 @@ msgid "E490: No fold found" msgstr "E490: Nenhuma dobra encontrada" msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: Impossvel criar dobra com a configurao atual de 'foldmethod'" +msgstr "E350: Impossível criar dobra com a configuração atual de 'foldmethod'" msgid "E351: Cannot delete fold with current 'foldmethod'" -msgstr "E351: Impossvel excluir dobra com a configurao atual de 'foldmethod'" - -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld linhas dobradas " +msgstr "" +"E351: Impossível excluir dobra com a configuração atual de 'foldmethod'" msgid "E222: Add to read buffer" -msgstr "E222: Adio a um buffer j lido" +msgstr "E222: Adição a um buffer já lido" msgid "E223: recursive mapping" -msgstr "E223: associao recursiva" +msgstr "E223: associação recursiva" #, c-format msgid "E224: global abbreviation already exists for %s" -msgstr "E224: j existe uma abreviao global para %s" +msgstr "E224: já existe uma abreviação global para %s" #, c-format msgid "E225: global mapping already exists for %s" -msgstr "E225: j existe uma associao global para %s" +msgstr "E225: já existe uma associação global para %s" #, c-format msgid "E226: abbreviation already exists for %s" -msgstr "E226: j existe uma abreviao para %s" +msgstr "E226: já existe uma abreviação para %s" #, c-format msgid "E227: mapping already exists for %s" -msgstr "E227: j existe uma associao para %s" +msgstr "E227: já existe uma associação para %s" msgid "No abbreviation found" -msgstr "Nenhuma abreviao encontrada" +msgstr "Nenhuma abreviação encontrada" msgid "No mapping found" -msgstr "Nenhuma associao encontrada" +msgstr "Nenhuma associação encontrada" msgid "E228: makemap: Illegal mode" -msgstr "E228: makemap: Modo invlido" +msgstr "E228: makemap: Modo inválido" + +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Falha ao criar novo processo para interface gráfica" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: Inicialização da interface falhou no processo filho" + +msgid "E229: Cannot start the GUI" +msgstr "E229: Não é possível iniciar a interface gráfica" + +#, c-format +msgid "E230: Cannot read from \"%s\"" +msgstr "E230: Impossível ler de \"%s\"" + +msgid "E665: Cannot start GUI, no valid font found" +msgstr "" +"E665: Impossível iniciar a interface gráfica, nenhuma fonte válida encontrada" + +msgid "E231: 'guifontwide' invalid" +msgstr "E231: Valor inválido para 'guifontwide'" + +msgid "E599: Value of 'imactivatekey' is invalid" +msgstr "E599: Valor inválido para 'imactivatekey'" + +#, c-format +msgid "E254: Cannot allocate color %s" +msgstr "E254: Impossível alocar cor %s" + +msgid "No match at cursor, finding next" +msgstr "Nenhum resultado sob o cursor; procurando próximo" msgid "<cannot open> " -msgstr "<impossvel abrir> " +msgstr "<impossível abrir> " #, c-format msgid "E616: vim_SelFile: can't get font %s" -msgstr "E616: vim_SelFile: impossvel obter fonte %s" +msgstr "E616: vim_SelFile: impossível obter fonte %s" msgid "E614: vim_SelFile: can't return to current directory" -msgstr "E614: vim_SelFile: impossvel voltar ao diretrio atual" +msgstr "E614: vim_SelFile: impossível voltar ao diretório atual" msgid "Pathname:" msgstr "Caminho:" msgid "E615: vim_SelFile: can't get current directory" -msgstr "E615: vim_SelFile: impossvel obter diretrio atual" +msgstr "E615: vim_SelFile: impossível obter diretório atual" msgid "OK" msgstr "OK" @@ -1957,40 +2119,26 @@ msgstr "OK" msgid "Cancel" msgstr "Cancelar" -msgid "Vim dialog" -msgstr "Dilogo do Vim" - msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." -msgstr "Widget barra de rolagem: impossvel obter geometria do pixmap 'thumb'" - -msgid "E232: Cannot create BalloonEval with both message and callback" -msgstr "E232: Impossvel criar BalloonEval com mensagem E callback" - -msgid "E229: Cannot start the GUI" -msgstr "E229: No possvel iniciar a interface grfica" - -#, c-format -msgid "E230: Cannot read from \"%s\"" -msgstr "E230: Impossvel ler de \"%s\"" +msgstr "Widget barra de rolagem: impossível obter geometria do pixmap 'thumb'." -msgid "E665: Cannot start GUI, no valid font found" -msgstr "E665: Impossvel iniciar a interface grfica, nenhuma fonte vlida encontrada" +msgid "Vim dialog" +msgstr "Diálogo do Vim" -msgid "E231: 'guifontwide' invalid" -msgstr "E231: Valor invlido para 'guifontwide'" +msgid "E232: Cannot create BalloonEval with both message and callback" +msgstr "E232: Impossível criar BalloonEval com mensagem E callback" -msgid "E599: Value of 'imactivatekey' is invalid" -msgstr "E599: Valor invlido para 'imactivatekey'" +msgid "_Cancel" +msgstr "_Cancelar" -#, c-format -msgid "E254: Cannot allocate color %s" -msgstr "E254: Impossvel alocar cor %s" +msgid "_Save" +msgstr "_Salvar" -msgid "No match at cursor, finding next" -msgstr "Nenhum resultado sob o cursor; procurando prximo" +msgid "_Open" +msgstr "_Abrir" -msgid "Vim dialog..." -msgstr "Dilogo do Vim..." +msgid "_OK" +msgstr "_OK" msgid "" "&Yes\n" @@ -1998,11 +2146,17 @@ msgid "" "&Cancel" msgstr "" "&Sim\n" -"&No\n" +"&Não\n" "&Cancelar" +msgid "Yes" +msgstr "Sim" + +msgid "No" +msgstr "Não" + msgid "Input _Methods" -msgstr "_Mtodos de entrada" +msgstr "_Métodos de entrada" msgid "VIM - Search and Replace..." msgstr "VIM - Procurar e substituir..." @@ -2016,18 +2170,15 @@ msgstr "Localizar:" msgid "Replace with:" msgstr "Substituir por:" -#. whole word only button msgid "Match whole word only" msgstr "Coincidir palavra inteira" -#. match case button msgid "Match case" -msgstr "Diferenciar maisculas/minsculas" +msgstr "Diferenciar maiúsculas/minúsculas" msgid "Direction" -msgstr "Direo" +msgstr "Direção" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Acima" @@ -2035,7 +2186,7 @@ msgid "Down" msgstr "Abaixo" msgid "Find Next" -msgstr "Localizar prxima" +msgstr "Localizar próxima" msgid "Replace" msgstr "Substituir" @@ -2043,11 +2194,14 @@ msgstr "Substituir" msgid "Replace All" msgstr "Substituir todas" +msgid "_Close" +msgstr "_Fechar" + msgid "Vim: Received \"die\" request from session manager\n" -msgstr "Vim: Recebido um pedido \"die\" do gerenciador de sesso\n" +msgstr "Vim: Pedido \"die\" recebido do gerenciador de sessão\n" -msgid "Close" -msgstr "Fechar" +msgid "Close tab" +msgstr "Fechar aba" msgid "New tab" msgstr "Nova aba" @@ -2056,10 +2210,7 @@ msgid "Open Tab..." msgstr "Abrir aba..." msgid "Vim: Main window unexpectedly destroyed\n" -msgstr "Vim: Janela principal destruda inesperadamente\n" - -msgid "Font Selection" -msgstr "Selecionar fonte" +msgstr "Vim: Janela principal destruída inesperadamente\n" msgid "&Filter" msgstr "&Filtrar" @@ -2068,7 +2219,7 @@ msgid "&Cancel" msgstr "&Cancelar" msgid "Directories" -msgstr "Diretrios" +msgstr "Diretórios" msgid "Filter" msgstr "Filtro" @@ -2083,10 +2234,10 @@ msgid "&OK" msgstr "&OK" msgid "Selection" -msgstr "Seleo" +msgstr "Seleção" msgid "Find &Next" -msgstr "Localizar &prxima" +msgstr "Localizar &próxima" msgid "&Replace" msgstr "&Substituir" @@ -2097,20 +2248,6 @@ msgstr "Substituir &todas" msgid "&Undo" msgstr "&Desfazer" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Impossvel encontrar janela de ttulo \"%s\"" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Argumento no suportado: \"-%s\"; Use a verso OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Impossvel abrir janela dentro de aplicao MDI" - -msgid "Close tab" -msgstr "Fechar aba" - msgid "Open tab..." msgstr "Abrir aba..." @@ -2120,20 +2257,33 @@ msgstr "Localizar cadeia de caracteres (use '\\\\' para procurar por '\\')" msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "Localizar e Substituir (use '\\\\' para procurar por '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" -msgstr "No usado" +msgstr "Não usado" msgid "Directory\t*.nothing\n" -msgstr "Diretrio\t*.nada\n" +msgstr "Diretório\t*.nada\n" + +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Impossível encontrar janela de título \"%s\"" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Argumento não suportado: \"-%s\"; Use a versão OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Impossível abrir janela dentro de aplicação MDI" msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" -msgstr "Vim E458: Impossvel alocar entrada do mapa de cores; algumas cores podem estar erradas" +msgstr "" +"Vim E458: Impossível alocar entrada do mapa de cores; algumas cores podem " +"estar erradas" #, c-format msgid "E250: Fonts for the following charsets are missing in fontset %s:" -msgstr "E250: Faltam fontes para os seguintes conjuntos de caracteres no conjunto de fontes %s:" +msgstr "" +"E250: Faltam fontes para os seguintes conjuntos de caracteres no conjunto de " +"fontes %s:" #, c-format msgid "E252: Fontset name: %s" @@ -2141,44 +2291,40 @@ msgstr "E252: Nome do conjunto de fontes: %s" #, c-format msgid "Font '%s' is not fixed-width" -msgstr "Fonte '%s' no de largura fixa" +msgstr "Fonte '%s' não é de largura fixa" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Nome do conjunto de fontes: %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Nome do conjunto de fontes: %s" #, c-format -msgid "Font0: %s\n" -msgstr "Fonte0: %s\n" +msgid "Font0: %s" +msgstr "Fonte0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Fonte1: %s\n" +msgid "Font1: %s" +msgstr "Fonte1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "O tamanho da Fonte%ld no o dobro do da Fonte0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "Largura da Fonte%ld não é o dobro da Fonte0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Tamanho da Fonte0: %ld\n" +msgid "Font0 width: %ld" +msgstr "Largura da Fonte0: %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Tamanho da Fonte1: %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Largura da Fonte1: %ld" msgid "Invalid font specification" -msgstr "Especificao de fonte invlida" +msgstr "Especificação de fonte inválida" msgid "&Dismiss" msgstr "&Dispensar" msgid "no specific match" -msgstr "nenhuma coincidncia exata" +msgstr "nenhuma coincidência exata" msgid "Vim - Font Selector" msgstr "Vim - Seletor de fontes" @@ -2186,12 +2332,11 @@ msgstr "Vim - Seletor de fontes" msgid "Name:" msgstr "Nome:" -#. create toggle button msgid "Show size in Points" msgstr "Mostrar tamanho em pontos" msgid "Encoding:" -msgstr "Codificao:" +msgstr "Codificação:" msgid "Font:" msgstr "Fonte:" @@ -2203,131 +2348,134 @@ msgid "Size:" msgstr "Tamanho:" msgid "E256: Hangul automata ERROR" -msgstr "E256: ERRO no autmato Hangul" +msgstr "E256: ERRO no autômato Hangul" msgid "E550: Missing colon" msgstr "E550: Dois-pontos faltando" msgid "E551: Illegal component" -msgstr "E551: Elemento invlido" +msgstr "E551: Elemento inválido" msgid "E552: digit expected" msgstr "E552: era esperado um algarismo" #, c-format msgid "Page %d" -msgstr "Pgina %d" +msgstr "Página %d" msgid "No text to be printed" msgstr "Sem texto para imprimir" #, c-format msgid "Printing page %d (%d%%)" -msgstr "Imprimindo pgina %d (%d%%)" +msgstr "Imprimindo página %d (%d%%)" #, c-format msgid " Copy %d of %d" -msgstr " Cpia %d de %d" +msgstr " Cópia %d de %d" #, c-format msgid "Printed: %s" msgstr "Impresso: %s" msgid "Printing aborted" -msgstr "Impresso cancelada" +msgstr "Impressão cancelada" msgid "E455: Error writing to PostScript output file" msgstr "E455: Erro ao escrever no arquivo PostScript" #, c-format msgid "E624: Can't open file \"%s\"" -msgstr "E624: Impossvel abrir arquivo \"%s\"" +msgstr "E624: Impossível abrir arquivo \"%s\"" #, c-format msgid "E457: Can't read PostScript resource file \"%s\"" -msgstr "E457: Impossvel ler o arquivo de recursos de PostScript \"%s\"" +msgstr "E457: Impossível ler o arquivo de recursos de PostScript \"%s\"" #, c-format msgid "E618: file \"%s\" is not a PostScript resource file" -msgstr "E618: arquivo \"%s\" no um arquivo de recursos de PostScript" +msgstr "E618: arquivo \"%s\" não é um arquivo de recursos de PostScript" #, c-format msgid "E619: file \"%s\" is not a supported PostScript resource file" -msgstr "E619: arquivo \"%s\" no um arquivo de recursos de PostScript suportado" +msgstr "" +"E619: arquivo \"%s\" não é um arquivo de recursos de PostScript suportado" #, c-format msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: verso errada do arquivo de recursos \"%s\"" +msgstr "E621: versão errada do arquivo de recursos \"%s\"" msgid "E673: Incompatible multi-byte encoding and character set." -msgstr "E673: Codificao multi-byte incompatvel com o conjunto de caracteres." +msgstr "" +"E673: Codificação multi-byte incompatível com o conjunto de caracteres." msgid "E674: printmbcharset cannot be empty with multi-byte encoding." -msgstr "E674: 'printmbcharset' no pode estar vazio com codificaes multi-byte." +msgstr "" +"E674: 'printmbcharset' não pode estar vazio com codificações multi-byte." msgid "E675: No default font specified for multi-byte printing." -msgstr "E675: Nenhuma fonte padro especificada para impresso em multi-byte." +msgstr "E675: Nenhuma fonte padrão especificada para impressão em multi-byte." msgid "E324: Can't open PostScript output file" -msgstr "E324: Impossvel abrir arquivo PostScript para sada" +msgstr "E324: Impossível abrir arquivo PostScript para saída" #, c-format msgid "E456: Can't open file \"%s\"" -msgstr "E456: Impossvel abrir arquivo \"%s\"" +msgstr "E456: Impossível abrir arquivo \"%s\"" msgid "E456: Can't find PostScript resource file \"prolog.ps\"" -msgstr "E456: Arquivo de recursos de PostScript \"prolog.ps\" no encontrado" +msgstr "E456: Arquivo de recursos de PostScript \"prolog.ps\" não encontrado" msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" -msgstr "E456: Arquivo de recursos de PostScript \"cidfont.ps\" no encontrado" +msgstr "E456: Arquivo de recursos de PostScript \"cidfont.ps\" não encontrado" #, c-format msgid "E456: Can't find PostScript resource file \"%s.ps\"" -msgstr "E456: Arquivo de recursos de PostScript \"%s.ps\" no encontrado" +msgstr "E456: Arquivo de recursos de PostScript \"%s.ps\" não encontrado" #, c-format msgid "E620: Unable to convert to print encoding \"%s\"" -msgstr "E620: Impossvel converter para a codificao \"%s\" para impresso" +msgstr "E620: Impossível converter para a codificação \"%s\" para impressão" msgid "Sending to printer..." -msgstr "Enviando impressora..." +msgstr "Enviando à impressora..." msgid "E365: Failed to print PostScript file" -msgstr "E365: No foi possvel imprimir o arquivo PostScript" +msgstr "E365: Não foi possível imprimir o arquivo PostScript" msgid "Print job sent." -msgstr "Trabalho de impresso enviado." +msgstr "Trabalho de impressão enviado." msgid "Add a new database" msgstr "Adicionar novo banco de dados" msgid "Query for a pattern" -msgstr "Procurar por um padro" +msgstr "Procurar por um padrão" msgid "Show this message" msgstr "Mostrar esta mensagem" msgid "Kill a connection" -msgstr "Terminar uma conexo" +msgstr "Terminar uma conexão" msgid "Reinit all connections" -msgstr "Reinicializar todas as conexes" +msgstr "Reinicializar todas as conexões" msgid "Show connections" -msgstr "Mostrar conexes" +msgstr "Mostrar conexões" #, c-format msgid "E560: Usage: cs[cope] %s" msgstr "E560: Forma de uso: cs[cope] %s" msgid "This cscope command does not support splitting the window.\n" -msgstr "Este comando cscope no suporta a diviso da janela.\n" +msgstr "Este comando cscope não suporta a divisão da janela.\n" msgid "E562: Usage: cstag <ident>" msgstr "E562: Forma de uso: cstag <ident>" msgid "E257: cstag: tag not found" -msgstr "E257: cstag: marcador no encontrado" +msgstr "E257: cstag: marcador não encontrado" #, c-format msgid "E563: stat(%s) error: %d" @@ -2338,7 +2486,7 @@ msgstr "E563: erro em stat" #, c-format msgid "E564: %s is not a directory or a valid cscope database" -msgstr "E564: %s no um diretrio ou um banco de dados vlido do cscope" +msgstr "E564: %s não é um diretório ou um banco de dados válido do cscope" #, c-format msgid "Added cscope database %s" @@ -2346,19 +2494,22 @@ msgstr "Adicionado banco de dados do cscope %s" #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: erro ao ler a conexo %ld do cscope" +msgstr "E262: erro ao ler a conexão %ld do cscope" msgid "E561: unknown cscope search type" msgstr "E561: tipo desconhecido de busca do cscope" msgid "E566: Could not create cscope pipes" -msgstr "E566: No foi possvel criar os pipes para comunicao com o cscope" +msgstr "E566: Não foi possível criar os pipes para comunicação com o cscope" msgid "E622: Could not fork for cscope" -msgstr "E622: No foi possvel fazer a bifurcao de processo para o cscope" +msgstr "E622: Não foi possível fazer a bifurcação de processo para o cscope" + +msgid "cs_create_connection setpgid failed" +msgstr "falha de setpgid em cs_create_connection" msgid "cs_create_connection exec failed" -msgstr "a execuo do cscope em cs_create_connection falhou" +msgstr "falha na execução do cscope em cs_create_connection" msgid "cs_create_connection: fdopen for to_fp failed" msgstr "cs_create_connection: fdopen para to_fp falhou" @@ -2367,14 +2518,14 @@ msgid "cs_create_connection: fdopen for fr_fp failed" msgstr "cs_create_connection: fdopen para fr_fp falhou" msgid "E623: Could not spawn cscope process" -msgstr "E623: No foi possvel invocar o processo do cscope" +msgstr "E623: Não foi possível invocar o processo do cscope" msgid "E567: no cscope connections" -msgstr "E567: no h conexes com o cscope" +msgstr "E567: não há conexões com o cscope" #, c-format msgid "E469: invalid cscopequickfix flag %c for %c" -msgstr "E469: marca %c invlida para %c em 'cscopequickfix'" +msgstr "E469: marca %c inválida para %c em 'cscopequickfix'" #, c-format msgid "E259: no matches found for cscope query %s of %s" @@ -2389,6 +2540,7 @@ msgstr "%-5s: %s%*s (Forma de uso: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2396,37 +2548,37 @@ msgid "" " g: Find this definition\n" " i: Find files #including this file\n" " s: Find this C symbol\n" -" t: Find assignments to\n" +" t: Find this text string\n" msgstr "" "\n" -" c: Procurar funes que chamam esta funo\n" -" d: Procurar funes chamadas por esta funo\n" -" e: Procurar este padro do egrep\n" -" f: Procurar este arquivo\n" -" g: Procurar esta definio\n" -" i: Procurar arquivos com #include para este arquivo\n" -" s: Procurar este smbolo do C\n" -" t: Procurar atribuies para isto\n" +" a: Buscar atribuição a este símbolo\n" +" c: Buscar funções que chamam esta função\n" +" d: Buscar funções chamadas por esta função\n" +" e: Buscar este padrão do egrep\n" +" f: Buscar este arquivo\n" +" g: Buscar esta definição\n" +" i: Buscar arquivos com #include para este arquivo\n" +" s: Buscar este símbolo do C\n" +" t: Buscar esta string de texto\n" #, c-format msgid "E625: cannot open cscope database: %s" -msgstr "E625: impossvel abrir banco de dados do cscope: %s" +msgstr "E625: impossível abrir banco de dados do cscope: %s" msgid "E626: cannot get cscope database information" -msgstr "E626: impossvel obter informaes do banco de dados do cscope" +msgstr "E626: impossível obter informações do banco de dados do cscope" msgid "E568: duplicate cscope database not added" -msgstr "E568: banco de dados do cscope repetido; no foi adicionado" +msgstr "E568: banco de dados do cscope repetido; não foi adicionado" #, c-format msgid "E261: cscope connection %s not found" -msgstr "E261: conexo %s com o cscope no encontrada" +msgstr "E261: conexão %s com o cscope não encontrada" #, c-format msgid "cscope connection %s closed" -msgstr "conexo %s com o cscope fechada" +msgstr "conexão %s com o cscope fechada" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: erro fatal em cs_manage_matches" @@ -2452,46 +2604,63 @@ msgid "All cscope databases reset" msgstr "Todos os bancos de dados do cscope redefinidos" msgid "no cscope connections\n" -msgstr "nenhuma conexo ao cscope\n" +msgstr "nenhuma conexão ao cscope\n" msgid " # pid database name prepend path\n" msgstr " # pid nome do banco de dados adicionar caminho\n" -msgid "E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded." -msgstr "E815: Desculpe, este comando est desativado. As bibliotecas do MzScheme no puderam ser carregadas." +msgid "Lua library cannot be loaded." +msgstr "Biblioteca Lua não pôde ser carregada." + +msgid "cannot save undo information" +msgstr "impossível salvar informações para desfazer" + +msgid "" +"E815: Sorry, this command is disabled, the MzScheme libraries could not be " +"loaded." +msgstr "" +"E815: Desculpe, este comando está desativado. As bibliotecas do MzScheme não " +"puderam ser carregadas." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Desculpe, este comando está desativado. O módulo racket/base do " +"MzScheme não pôde ser carregado." msgid "invalid expression" -msgstr "expresso invlida" +msgstr "expressão inválida" msgid "expressions disabled at compile time" -msgstr "expresses desativadas na compilao" +msgstr "expressões desativadas na compilação" msgid "hidden option" -msgstr "opo oculta" +msgstr "opção oculta" msgid "unknown option" -msgstr "opo desconhecida" +msgstr "opção desconhecida" msgid "window index is out of range" -msgstr "nmero da janela fora dos limites" +msgstr "número da janela fora dos limites" msgid "couldn't open buffer" -msgstr "impossvel abrir buffer" - -msgid "cannot save undo information" -msgstr "impossvel salvar informaes para desfazer" +msgstr "impossível abrir buffer" msgid "cannot delete line" -msgstr "impossvel excluir linha" +msgstr "impossível excluir linha" msgid "cannot replace line" -msgstr "impossvel substituir linha" +msgstr "impossível substituir linha" msgid "cannot insert line" -msgstr "impossvel inserir linha" +msgstr "impossível inserir linha" msgid "string cannot contain newlines" -msgstr "a cadeia no pode conter quebras de linha" +msgstr "a cadeia não pode conter quebras de linha" + +msgid "error converting Scheme values to Vim" +msgstr "erro convertendo valores Scheme para Vim" msgid "Vim error: ~a" msgstr "Erro do Vim: ~a" @@ -2500,83 +2669,48 @@ msgid "Vim error" msgstr "Erro do Vim" msgid "buffer is invalid" -msgstr "buffer invlido" +msgstr "buffer inválido" msgid "window is invalid" -msgstr "janela invlida" +msgstr "janela inválida" msgid "linenr out of range" -msgstr "nmero de linha fora dos limites" +msgstr "número de linha fora dos limites" msgid "not allowed in the Vim sandbox" -msgstr "no permitido na caixa de areia do Vim" - -msgid "E263: Sorry, this command is disabled, the Python library could not be loaded." -msgstr "E263: Desculpe, este comando est desativado. A biblioteca do Python no pde ser carregada." - -msgid "E659: Cannot invoke Python recursively" -msgstr "E659: No possvel invocar o Python recursivamente" - -msgid "can't delete OutputObject attributes" -msgstr "impossvel excluir os atributos do OutputObject" - -msgid "softspace must be an integer" -msgstr "'softspace' deve ser um inteiro" - -msgid "invalid attribute" -msgstr "atributo invlido" - -msgid "writelines() requires list of strings" -msgstr "writelines() requer uma lista de cadeias de caracteres" - -msgid "E264: Python: Error initialising I/O objects" -msgstr "E264: Python: Erro ao inicializar objetos de E/S" - -msgid "attempt to refer to deleted buffer" -msgstr "tentativa de referncia a buffer apagado" - -msgid "line number out of range" -msgstr "nmero de linha fora dos limites" - -#, c-format -msgid "<buffer object (deleted) at %p>" -msgstr "<objeto buffer (apagado) em %p>" +msgstr "não permitido na caixa de areia do Vim" -msgid "invalid mark name" -msgstr "nome de marca invlido" - -msgid "no such buffer" -msgstr "buffer inexistente" - -msgid "attempt to refer to deleted window" -msgstr "tentativa de referncia a janela excluda" - -msgid "readonly attribute" -msgstr "atributo somente-leitura" - -msgid "cursor position outside buffer" -msgstr "cursor posicionado fora do buffer" +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Este Vim não pode executar :python após ter usado :py3" -#, c-format -msgid "<window object (deleted) at %p>" -msgstr "<objeto janela (apagado) em %p>" +msgid "" +"E263: Sorry, this command is disabled, the Python library could not be " +"loaded." +msgstr "" +"E263: Desculpe, este comando está desativado. A biblioteca do Python não " +"pôde ser carregada." -#, c-format -msgid "<window object (unknown) at %p>" -msgstr "<objeto janela (desconhecido) em %p>" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Desculpe, este comando está desativado. O módulo site do Python não " +"pôde ser carregado." -#, c-format -msgid "<window %d>" -msgstr "<janela %d>" +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Não é possível invocar o Python recursivamente" -msgid "no such window" -msgstr "janela inexistente" +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Este Vim não pode executar :py3 depois de usar :python" msgid "E265: $_ must be an instance of String" -msgstr "E265: $_ deve ser uma instncia de String" +msgstr "E265: $_ deve ser uma instância de String" -msgid "E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "E266: Desculpe, este comando est desativado. A biblioteca do Ruby no pde ser carregada." +msgid "" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." +msgstr "" +"E266: Desculpe, este comando está desativado. A biblioteca do Ruby não pôde " +"ser carregada." msgid "E267: unexpected return" msgstr "E267: \"return\" inesperado" @@ -2588,128 +2722,48 @@ msgid "E269: unexpected break" msgstr "E269: \"break\" inesperado" msgid "E270: unexpected redo" -msgstr "E270: \"redo\" inesperado" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: \"retry\" fora de bloco \"rescue\"" - -msgid "E272: unhandled exception" -msgstr "E272: exceo no tratada" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: status %d de longjmp desconhecido" - -msgid "Toggle implementation/definition" -msgstr "Alternar implementao/definio" - -msgid "Show base class of" -msgstr "Mostrar classe base de" - -msgid "Show overridden member function" -msgstr "Mostrar funo membro sobrescrita" - -msgid "Retrieve from file" -msgstr "Recuperar do arquivo" - -msgid "Retrieve from project" -msgstr "Recuperar do projeto" - -msgid "Retrieve from all projects" -msgstr "Recuperar de todos os projetos" - -msgid "Retrieve" -msgstr "Recuperar" - -msgid "Show source of" -msgstr "Mostrar cdigo de" - -msgid "Find symbol" -msgstr "Procurar smbolo" - -msgid "Browse class" -msgstr "Navegador de classe" - -msgid "Show class in hierarchy" -msgstr "Mostrar classe na hierarquia" - -msgid "Show class in restricted hierarchy" -msgstr "Mostrar classe em hierarquia restrita" - -msgid "Xref refers to" -msgstr "Xref refere-se a" - -msgid "Xref referred by" -msgstr "Xref referido por" - -msgid "Xref has a" -msgstr "Xref tem um" - -msgid "Xref used by" -msgstr "Xref usado por" - -msgid "Show docu of" -msgstr "Mostrar docum. de" - -msgid "Generate docu for" -msgstr "Gerar docum. para" - -msgid "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in $PATH).\n" -msgstr "No foi possvel conectar-se ao SNiFF+. Verifique o ambiente (sniffemacs precisa ser encontrado no $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Erro durante a leitura. Desconectado" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ est atualmente " - -msgid "not " -msgstr "des" - -msgid "connected" -msgstr "conectado" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Pedido do SNiFF+ desconhecido: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Erro ao conectar-se ao SNiFF+" +msgstr "E270: \"redo\" inesperado" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ desconectado" +msgid "E271: retry outside of rescue clause" +msgstr "E271: \"retry\" fora de bloco \"rescue\"" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: No um buffer do SNiFF+" +msgid "E272: unhandled exception" +msgstr "E272: exceção não tratada" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Erro durante a gravao. Desconectado" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: status %d de longjmp desconhecido" msgid "invalid buffer number" -msgstr "nmero invlido de buffer" +msgstr "número inválido de buffer" msgid "not implemented yet" -msgstr "ainda no implementado" +msgstr "ainda não implementado" -#. ??? msgid "cannot set line(s)" -msgstr "no foi possvel redefinir a(s) linha(s)" +msgstr "não foi possível redefinir a(s) linha(s)" + +msgid "invalid mark name" +msgstr "nome de marca inválido" msgid "mark not set" -msgstr "marca no definida" +msgstr "marca não definida" #, c-format msgid "row %d column %d" msgstr "linha %d coluna %d" msgid "cannot insert/append line" -msgstr "impossvel inserir/adicionar linha" +msgstr "impossível inserir/adicionar linha" + +msgid "line number out of range" +msgstr "número de linha fora dos limites" msgid "unknown flag: " -msgstr "opo desconhecida: " +msgstr "opção desconhecida: " msgid "unknown vimOption" -msgstr "opo do Vim desconhecida" +msgstr "opção do Vim desconhecida" msgid "keyboard interrupt" msgstr "interrompido pelo teclado" @@ -2718,113 +2772,142 @@ msgid "vim error" msgstr "erro do vim" msgid "cannot create buffer/window command: object is being deleted" -msgstr "impossvel criar comando de buffer/janela: o objeto est sendo excludo" +msgstr "" +"impossível criar comando de buffer/janela: o objeto está sendo excluído" -msgid "cannot register callback command: buffer/window is already being deleted" -msgstr "no foi possvel registrar o comando de callback: o buffer/janela j est sendo excludo" +msgid "" +"cannot register callback command: buffer/window is already being deleted" +msgstr "" +"não foi possível registrar o comando de callback: o buffer/janela já está " +"sendo excluído" -#. This should never happen. Famous last word? -msgid "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org" -msgstr "E280: ERRO FATAL DO TCL: reflist corrompida!? Por favor relate isso para vim-dev@vim.org" +msgid "" +"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." +"org" +msgstr "" +"E280: ERRO FATAL DO TCL: reflist corrompida!? Por favor relate isso para vim-" +"dev@vim.org" msgid "cannot register callback command: buffer/window reference not found" -msgstr "no foi possvel registrar o comando de callback: referncia a buffer/janela no encontrada" - -msgid "E571: Sorry, this command is disabled: the Tcl library could not be loaded." -msgstr "E571: Desculpe, este comando est desativado. A biblioteca do Tcl no pde ser carregada." +msgstr "" +"não foi possível registrar o comando de callback: referência a buffer/janela " +"não encontrada" -msgid "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org" -msgstr "E281: ERRO DO TCL: cdigo de sada no int!? Por favor relate isso para vim-dev@vim.org" +msgid "" +"E571: Sorry, this command is disabled: the Tcl library could not be loaded." +msgstr "" +"E571: Desculpe, este comando está desativado. A biblioteca do Tcl não pôde " +"ser carregada." #, c-format msgid "E572: exit code %d" -msgstr "E572: cdigo de sada %d" +msgstr "E572: código de saída %d" msgid "cannot get line" -msgstr "no foi possvel obter a linha" +msgstr "não foi possível obter a linha" msgid "Unable to register a command server name" -msgstr "No foi possvel registrar um nome para o servidor de comandos" +msgstr "Não foi possível registrar um nome para o servidor de comandos" msgid "E248: Failed to send command to the destination program" msgstr "E248: Falha ao enviar comando ao programa de destino" #, c-format msgid "E573: Invalid server id used: %s" -msgstr "E573: Foi usada uma id de servidor invlida: %s" +msgstr "E573: Foi usada uma id de servidor inválida: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" -msgstr "E251: Propriedade de registro de instncia do VIM malformada encontrada e excluda!" +msgstr "" +"E251: Propriedade de registro de instância do VIM malformada encontrada e " +"excluída!" + +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Chave duplicada no objeto JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Falta uma vírgula na Lista: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Lista não finalizada com ']': %s" msgid "Unknown option argument" -msgstr "Argumento de opo desconhecido" +msgstr "Argumento de opção desconhecido" msgid "Too many edit arguments" -msgstr "Argumentos de edio em excesso" +msgstr "Argumentos de edição em excesso" msgid "Argument missing after" -msgstr "Argumento faltando aps" +msgstr "Argumento faltando após" msgid "Garbage after option argument" -msgstr "Lixo aps argumento de opo" +msgstr "Lixo após argumento de opção" msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" -msgstr "Demasiados argumentos \"+comando\", \"-c comando\" ou \"--cmd comando\"" +msgstr "" +"Demasiados argumentos \"+comando\", \"-c comando\" ou \"--cmd comando\"" msgid "Invalid argument for" -msgstr "Argumento invlido para" +msgstr "Argumento inválido para" #, c-format msgid "%d files to edit\n" msgstr "%d arquivos para editar\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Este Vim no foi compilado com o recurso diff." +msgid "netbeans is not supported with this GUI\n" +msgstr "netbeans não suportado com esta GUI\n" msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr "'-nb' no pode ser usado: no foi ativado na compilao\n" +msgstr "'-nb' não pode ser usado: não foi ativado na compilação\n" + +msgid "This Vim was not compiled with the diff feature." +msgstr "Este Vim não foi compilado com o recurso diff." msgid "Attempt to open script file again: \"" msgstr "Tentando abrir novamente arquivo de script: \"" msgid "Cannot open for reading: \"" -msgstr "Impossvel abrir para leitura: \"" +msgstr "Impossível abrir para leitura: \"" msgid "Cannot open for script output: \"" -msgstr "Impossvel abrir para transcrio do script: \"" +msgstr "Impossível abrir para transcrição do script: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Erro: No foi possvel iniciar o gvim a partir do NetBeans\n" +msgstr "Vim: Erro: Não foi possível iniciar o gvim a partir do NetBeans\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Erro: Esta versão do Vim não executa num terminal Cygwin\n" msgid "Vim: Warning: Output is not to a terminal\n" -msgstr "Vim: Aviso: Sada no um terminal\n" +msgstr "Vim: Aviso: Saída não é um terminal\n" msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Aviso: Entrada no de um terminal\n" +msgstr "Vim: Aviso: Entrada não é de um terminal\n" -#. just in case.. msgid "pre-vimrc command line" -msgstr "linha de comando pr-vimrc" +msgstr "linha de comando pré-vimrc" #, c-format msgid "E282: Cannot read from \"%s\"" -msgstr "E282: Impossvel ler de \"%s\"" +msgstr "E282: Impossível ler de \"%s\"" msgid "" "\n" "More info with: \"vim -h\"\n" msgstr "" "\n" -"Mais informaes com: \"vim -h\"\n" +"Mais informações com: \"vim -h\"\n" msgid "[file ..] edit specified file(s)" msgstr "[arquivo ..] abrir o(s) arquivo(s) especificado(s)" msgid "- read text from stdin" -msgstr "- ler texto a partir da entrada padro" +msgstr "- ler texto a partir da entrada padrão" msgid "-t tag edit file where tag is defined" -msgstr "-t marcador editar arquivo onde o marcador definido" +msgstr "-t marcador editar arquivo onde o marcador é definido" msgid "-q [errorfile] edit file with first error" msgstr "-q [arq.erro] editar arquivo e abrir no primeiro erro" @@ -2853,7 +2936,7 @@ msgid "" "Where case is ignored prepend / to make flag upper case" msgstr "" "\n" -"Se a caixa ignorada, insira / antes da opo para torn-la maiscula" +"Se a caixa é ignorada, insira / antes da opção para torná-la maiúscula" msgid "" "\n" @@ -2868,7 +2951,7 @@ msgid "--\t\t\tOnly file names after this" msgstr "--\t\t\tApenas nomes de arquivo depois daqui" msgid "--literal\t\tDon't expand wildcards" -msgstr "--literal\t\tNo expandir caracteres-curinga" +msgstr "--literal\t\tNão expandir caracteres-curinga" msgid "-register\t\tRegister this gvim for OLE" msgstr "-register\t\tRegistrar o gvim para o OLE" @@ -2877,10 +2960,11 @@ msgid "-unregister\t\tUnregister gvim for OLE" msgstr "-unregister\t\tDesregistrar o gvim para o OLE" msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tExecutar a interface grfica (como \"gvim\")" +msgstr "-g\t\t\tExecutar a interface gráfica (como \"gvim\")" msgid "-f or --nofork\tForeground: Don't fork when starting GUI" -msgstr "-f ou --nofork\tPrimeiro plano: No separar a interface grfica do terminal" +msgstr "" +"-f ou --nofork\tPrimeiro plano: Não separar a interface gráfica do terminal" msgid "-v\t\t\tVi mode (like \"vi\")" msgstr "-v\t\t\tModo Vi (como \"vi\")" @@ -2888,6 +2972,9 @@ msgstr "-v\t\t\tModo Vi (como \"vi\")" msgid "-e\t\t\tEx mode (like \"ex\")" msgstr "-e\t\t\tModo Ex (como \"ex\")" +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tMovo Ex melhorado" + msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" msgstr "-s\t\t\tModo silencioso ou \"batch\" (apenas para \"ex\")" @@ -2895,7 +2982,7 @@ msgid "-d\t\t\tDiff mode (like \"vimdiff\")" msgstr "-d\t\t\tModo diff (como \"vimdiff\")" msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tModo fcil (como \"evim\", o Vim no modal)" +msgstr "-y\t\t\tModo fácil (como \"evim\", o Vim não modal)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\tmodo somente-leitura (como \"view\")" @@ -2904,49 +2991,49 @@ msgid "-Z\t\t\tRestricted mode (like \"rvim\")" msgstr "-Z\t\t\tmodo restrito (como \"rvim\")" msgid "-m\t\t\tModifications (writing files) not allowed" -msgstr "-m\t\t\tNo permitir alteraes (gravao de arquivos)" +msgstr "-m\t\t\tNão permitir alterações (gravação de arquivos)" msgid "-M\t\t\tModifications in text not allowed" -msgstr "-M\t\t\tNo permitir alteraes no texto" +msgstr "-M\t\t\tNão permitir alterações no texto" msgid "-b\t\t\tBinary mode" -msgstr "-b\t\t\tModo binrio" +msgstr "-b\t\t\tModo binário" msgid "-l\t\t\tLisp mode" msgstr "-l\t\t\tModo Lisp" msgid "-C\t\t\tCompatible with Vi: 'compatible'" -msgstr "-C\t\t\tCompatvel com o Vi: 'compatible'" +msgstr "-C\t\t\tCompatível com o Vi: 'compatible'" msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" -msgstr "-N\t\t\tNo totalmente compatvel com o Vi: 'nocompatible'" +msgstr "-N\t\t\tNão totalmente compatível com o Vi: 'nocompatible'" msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -msgstr "-V[N][arq]\t\tDetalhado [nvel N] [gravar mensagens em 'arq']" +msgstr "-V[N][arq]\t\tDetalhado [nível N] [gravar mensagens em 'arq']" msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\tModo de depurao (debug)" +msgstr "-D\t\t\tModo de depuração (debug)" msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tNo usar arquivo de troca, apenas a memria" +msgstr "-n\t\t\tNão usar arquivo de troca, apenas a memória" msgid "-r\t\t\tList swap files and exit" msgstr "-r\t\t\tListar arquivos de troca e sair" msgid "-r (with file name)\tRecover crashed session" -msgstr "-r (nome de arquivo)\tRecuperar sesso perdida" +msgstr "-r (nome de arquivo)\tRecuperar sessão perdida" msgid "-L\t\t\tSame as -r" msgstr "-L\t\t\tMesmo que -r" msgid "-f\t\t\tDon't use newcli to open window" -msgstr "-f\t\t\tNo usar newcli para abrir janela" +msgstr "-f\t\t\tNão usar newcli para abrir janela" msgid "-dev <device>\t\tUse <device> for I/O" msgstr "-dev <dispositivo>\tUsar <dispositivo> para E/S" msgid "-A\t\t\tstart in Arabic mode" -msgstr "-A\t\t\tiniciar no modo rabe" +msgstr "-A\t\t\tiniciar no modo Árabe" msgid "-H\t\t\tStart in Hebrew mode" msgstr "-H\t\t\tIniciar no modo Hebraico" @@ -2957,6 +3044,12 @@ msgstr "-F\t\t\tIniciar no modo Farsi (persa)" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <terminal>\tDefinir tipo de terminal como <terminal>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tOmite aviso sobre entrada/saída não ser um terminal" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tSai se entrada/saída não for um terminal" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tUsar <vimrc> em vez de qualquer outro .vimrc" @@ -2964,13 +3057,13 @@ msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc" msgstr "-U <gvimrc>\t\tUsar <gvimrc> em vez de qualquer outro .gvimrc" msgid "--noplugin\t\tDon't load plugin scripts" -msgstr "--noplugin\t\tNo carregar scripts de plugins" +msgstr "--noplugin\t\tNão carregar scripts de plugins" msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tAbrir N abas (padro: uma para cada arquivo)" +msgstr "-p[N]\t\tAbrir N abas (padrão: uma para cada arquivo)" msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "-o[N]\t\tAbrir N janelas (padro: uma para cada arquivo)" +msgstr "-o[N]\t\tAbrir N janelas (padrão: uma para cada arquivo)" msgid "-O[N]\t\tLike -o but split vertically" msgstr "-O[N]\t\tComo -o, mas dividindo verticalmente" @@ -2979,24 +3072,26 @@ msgid "+\t\t\tStart at end of file" msgstr "+\t\t\tAbrir no final do arquivo" msgid "+<lnum>\t\tStart at line <lnum>" -msgstr "+<nm.l>\t\tComear na linha <nm.l>" +msgstr "+<núm.l>\t\tComeçar na linha <núm.l>" msgid "--cmd <command>\tExecute <command> before loading any vimrc file" msgstr "--cmd <comando>\tExecutar <comando> antes de carregar qualquer vimrc" msgid "-c <command>\t\tExecute <command> after loading the first file" -msgstr "-c <comando>\t\tExecutar <comando> depois de carregar o primeiro arquivo" +msgstr "" +"-c <comando>\t\tExecutar <comando> depois de carregar o primeiro arquivo" msgid "-S <session>\t\tSource file <session> after loading the first file" msgstr "" -"-S <sesso>\t\tExecutar o arquivo <sesso> depois de carregar o\n" -"\t\t\tprimeiro arquivo" +"-S <sessão>\t\tExecutar o arquivo <sessão> depois de carregar o primeiro " +"arquivo" msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" msgstr "-s <script>\t\tLer comandos do modo Normal do arquivo <script>" msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" -msgstr "-w <script>\t\tAdicionar todos os comandos digitados ao arquivo <script>" +msgstr "" +"-w <script>\t\tAdicionar todos os comandos digitados ao arquivo <script>" msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" msgstr "-W <script>\t\tGravar todos os comandos digitados no arquivo <script>" @@ -3005,70 +3100,83 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tEditar arquivos criptografados" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <display>\tConectar o vim a este servidor X especfico" +msgstr "-display <display>\tConectar o vim a este servidor X específico" msgid "-X\t\t\tDo not connect to X server" -msgstr "-X\t\t\tNo conectar ao servidor X" +msgstr "-X\t\t\tNão conectar ao servidor X" msgid "--remote <files>\tEdit <files> in a Vim server if possible" -msgstr "--remote <arquivos>\tEditar <arquivos> num servidor Vim se possvel" +msgstr "--remote <arquivos>\tEditar <arquivos> num servidor Vim se possível" msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <arqs.> Idem, sem reclamar se no houver servidor" +msgstr "--remote-silent <arqs.> Idem, sem reclamar se não houver servidor" -msgid "--remote-wait <files> As --remote but wait for files to have been edited" -msgstr "--remote-wait <arqs.> Como --remote, mas esperar a edio dos arquivos" +msgid "" +"--remote-wait <files> As --remote but wait for files to have been edited" +msgstr "" +"--remote-wait <arqs.> Como --remote, mas esperar a edição dos arquivos" -msgid "--remote-wait-silent <files> Same, don't complain if there is no server" -msgstr "--remote-wait-silent <arqs.> Idem, sem reclamar se no houver servidor" +msgid "" +"--remote-wait-silent <files> Same, don't complain if there is no server" +msgstr "" +"--remote-wait-silent <arqs.> Idem, sem reclamar se não houver servidor" -msgid "--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" -msgstr "--remote-tab[-wait][-silent] <arqs.> Como --remote, mas com uma aba por arquivo" +msgid "" +"--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" +msgstr "" +"--remote-tab[-wait][-silent] <arqs.> Como --remote, mas com uma aba por " +"arquivo" msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" msgstr "--remote-send <teclas> Enviar <teclas> para um servidor Vim e sair" msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" -msgstr "--remote-expr <expr>\tAvaliar <expr> num servidor Vim e exibir o resultado" +msgstr "" +"--remote-expr <expr>\tAvaliar <expr> num servidor Vim e exibir o resultado" msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tListar servidores Vim disponveis e sair" +msgstr "--serverlist\t\tListar servidores Vim disponíveis e sair" msgid "--servername <name>\tSend to/become the Vim server <name>" msgstr "--servername <nome>\tEnviar para/tornar-se o servidor Vim <nome>" msgid "--startuptime <file>\tWrite startup timing messages to <file>" -msgstr "--startuptime <arq.>\tGravar mensagens de cronometragem da inicializao para <arquivo>" +msgstr "" +"--startuptime <arq.>\tGravar mensagens de cronometragem da inicialização " +"para <arquivo>" msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tUsar <viminfo> em vez do .viminfo normal" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible', padrões do Vim, sem plugins, sem viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h ou --help\tImprimir a ajuda (esta mensagem) e sair" msgid "--version\t\tPrint version information and exit" -msgstr "--version\t\tImprimir informaes da verso e sair" +msgstr "--version\t\tImprimir informações da versão e sair" msgid "" "\n" "Arguments recognised by gvim (Motif version):\n" msgstr "" "\n" -"Argumentos reconhecidos pelo gvim (verso Motif):\n" +"Argumentos reconhecidos pelo gvim (versão Motif):\n" msgid "" "\n" "Arguments recognised by gvim (neXtaw version):\n" msgstr "" "\n" -"Argumentos reconhecidos pelo gvim (verso neXtaw):\n" +"Argumentos reconhecidos pelo gvim (versão neXtaw):\n" msgid "" "\n" "Arguments recognised by gvim (Athena version):\n" msgstr "" "\n" -"Argumentos reconhecidos pelo gvim (verso Athena):\n" +"Argumentos reconhecidos pelo gvim (versão Athena):\n" msgid "-display <display>\tRun vim on <display>" msgstr "-display <display>\tExecutar vim em <display>" @@ -3076,12 +3184,6 @@ msgstr "-display <display>\tExecutar vim em <display>" msgid "-iconic\t\tStart vim iconified" msgstr "-iconic\t\tIniciar vim iconizado" -msgid "-name <name>\t\tUse resource as if vim was <name>" -msgstr "-name <nome>\t\tUsar recurso como se o vim fosse <nome>" - -msgid "\t\t\t (Unimplemented)\n" -msgstr "\t\t\t (No implementado)\n" - msgid "-background <color>\tUse <color> for the background (also: -bg)" msgstr "-background <cor>\tUsar <cor> para o fundo (abrev.: -bg)" @@ -3095,7 +3197,7 @@ msgid "-boldfont <font>\tUse <font> for bold text" msgstr "-boldfont <fonte>\tUsar <fonte> para texto em negrito" msgid "-italicfont <font>\tUse <font> for italic text" -msgstr "-italicfont <fonte>\tUsar <fonte> para texto em itlico" +msgstr "-italicfont <fonte>\tUsar <fonte> para texto em itálico" msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" msgstr "-geometry <geom>\tUsar <geom> como geometria inicial (abrev.: -geom)" @@ -3104,65 +3206,55 @@ msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" msgstr "-borderwidth <larg.>\tUsar <larg.> como largura da borda (abrev.: -bw)" msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" -msgstr "-scrollbarwidth <larg.> Usar <larg.> como largura da barra de rolagem (abrev.: -sw)" +msgstr "" +"-scrollbarwidth <larg.> Usar <larg.> como largura da barra de rolagem " +"(abrev.: -sw)" msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" -msgstr "-menuheight <altura>\tUsar <altura> para a barra de menus (abrev.: -mh)" +msgstr "" +"-menuheight <altura>\tUsar <altura> para a barra de menus (abrev.: -mh)" msgid "-reverse\t\tUse reverse video (also: -rv)" -msgstr "-reverse\t\tUsar vdeo reverso (abrev.: -rv)" +msgstr "-reverse\t\tUsar vídeo reverso (abrev.: -rv)" msgid "+reverse\t\tDon't use reverse video (also: +rv)" -msgstr "+reverse\t\tNo usar vdeo reverso (abrev.: +rv)" +msgstr "+reverse\t\tNão usar vídeo reverso (abrev.: +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <recurso>\tDefinir o recurso especificado" -msgid "" -"\n" -"Arguments recognised by gvim (RISC OS version):\n" -msgstr "" -"\n" -"Argumentos reconhecidos pelo gvim (verso RISC OS):\n" - -msgid "--columns <number>\tInitial width of window in columns" -msgstr "--columns <nmero>\tLargura inicial da janela, em colunas" - -msgid "--rows <number>\tInitial height of window in rows" -msgstr "--rows <nmero>\tAltura inicial da janela, em linhas" - msgid "" "\n" "Arguments recognised by gvim (GTK+ version):\n" msgstr "" "\n" -"Argumentos reconhecidos pelo gvim (verso GTK+):\n" +"Argumentos reconhecidos pelo gvim (versão GTK+):\n" msgid "-display <display>\tRun vim on <display> (also: --display)" msgstr "-display <display>\tExecutar vim no <display> (alt.: --display)" msgid "--role <role>\tSet a unique role to identify the main window" msgstr "" -"--role <papel>\tDefine um papel nico para identificar a janela\n" -"\t\t\tprincipal" +"--role <papel>\tDefine um papel único para identificar a janela principal" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\tAbrir o Vim dentro de outro widget do GTK" +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tFaz o gvim mostrar o ID da janela na saída padrão" + msgid "-P <parent title>\tOpen Vim inside parent application" -msgstr "-P <ttulo pai>\tAbrir o Vim dentro de uma aplicao-pai" +msgstr "-P <título pai>\tAbrir o Vim dentro de uma aplicação-pai" msgid "--windowid <HWND>\tOpen Vim inside another win32 widget" msgstr "--windowid <HWND>\tAbrir o Vim dentro de outro widget win32" msgid "No display" -msgstr "No h display" +msgstr "Não há display" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": Envio falhou.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": Envio falhou. Tentando executar localmente\n" @@ -3171,10 +3263,10 @@ msgid "%d of %d edited" msgstr "%d de %d editados" msgid "No display: Send expression failed.\n" -msgstr "No h display: Envio da expresso falhou.\n" +msgstr "Não há display: Envio da expressão falhou.\n" msgid ": Send expression failed.\n" -msgstr ": Envio da expresso falhou.\n" +msgstr ": Envio da expressão falhou.\n" msgid "No marks set" msgstr "Nenhuma marca definida" @@ -3183,7 +3275,6 @@ msgstr "Nenhuma marca definida" msgid "E283: No marks matching \"%s\"" msgstr "E283: Nenhuma marca coincide com \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3191,7 +3282,6 @@ msgstr "" "\n" "marc linha col arquivo/texto" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3199,7 +3289,6 @@ msgstr "" "\n" "salto linha col arquivo/texto" -#. Highlight title msgid "" "\n" "change line col text" @@ -3207,7 +3296,6 @@ msgstr "" "\n" "alter. linha col texto" -#, c-format msgid "" "\n" "# File marks:\n" @@ -3215,8 +3303,6 @@ msgstr "" "\n" "# Marcas nos arquivos:\n" -#. Write the jumplist with -' -#, c-format msgid "" "\n" "# Jumplist (newest first):\n" @@ -3224,49 +3310,39 @@ msgstr "" "\n" "# Lista de saltos (mais recente primeiro):\n" -#, c-format msgid "" "\n" "# History of marks within files (newest to oldest):\n" msgstr "" "\n" -"# Histrico de marcas nos arquivos (mais recente primeiro):\n" +"# Histórico de marcas nos arquivos (mais recente primeiro):\n" msgid "Missing '>'" msgstr "'>' faltando" msgid "E543: Not a valid codepage" -msgstr "E543: Pgina de cdigos invlida" +msgstr "E543: Página de códigos inválida" msgid "E284: Cannot set IC values" -msgstr "E284: No foi possvel definir os valores do contexto de entrada" +msgstr "E284: Não foi possível definir os valores do contexto de entrada" msgid "E285: Failed to create input context" msgstr "E285: Falha ao criar o contexto de entrada" msgid "E286: Failed to open input method" -msgstr "E286: Falha ao abrir o mtodo de entrada" +msgstr "E286: Falha ao abrir o método de entrada" msgid "E287: Warning: Could not set destroy callback to IM" -msgstr "E287: Aviso: No foi possvel definir o callback de destruio do ME" +msgstr "E287: Aviso: Não foi possível definir o callback de destruição do ME" msgid "E288: input method doesn't support any style" -msgstr "E288: o mtodo de entrada no suporta nenhum estilo" +msgstr "E288: o método de entrada não suporta nenhum estilo" msgid "E289: input method doesn't support my preedit type" -msgstr "E289: o mtodo de entrada no suporta meu tipo de pr-edio" - -msgid "E290: over-the-spot style requires fontset" -msgstr "E290: o estilo over-the-spot requer um conjunto de fontes" - -msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -msgstr "E291: Sua verso do GTK+ anterior 1.2.3. A rea de status foi desativada" - -msgid "E292: Input Method Server is not running" -msgstr "E292: O Servidor de Mtodo de Entrada no est em execuo" +msgstr "E289: o método de entrada não suporta meu tipo de pré-edição" msgid "E293: block was not locked" -msgstr "E293: o bloco no estava travado" +msgstr "E293: o bloco não estava travado" msgid "E294: Seek error in swap file read" msgstr "E294: Erro de posicionamento na leitura do arquivo de troca" @@ -3281,65 +3357,68 @@ msgid "E297: Write error in swap file" msgstr "E297: Erro de escrita no arquivo de troca" msgid "E300: Swap file already exists (symlink attack?)" -msgstr "E300: Arquivo de troca j existe (ataque de symlink?)" +msgstr "E300: Arquivo de troca já existe (ataque de symlink?)" msgid "E298: Didn't get block nr 0?" -msgstr "E298: No foi obtido o bloco n 0?" +msgstr "E298: Não foi obtido o bloco nº 0?" msgid "E298: Didn't get block nr 1?" -msgstr "E298: No foi obtido o bloco n 1?" +msgstr "E298: Não foi obtido o bloco nº 1?" msgid "E298: Didn't get block nr 2?" -msgstr "E298: No foi obtido o bloco n 2?" +msgstr "E298: Não foi obtido o bloco nº 2?" + +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Erro ao atualizar criptografia do arquivo de troca" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Oops, o arquivo de troca foi perdido!!!" msgid "E302: Could not rename swap file" -msgstr "E302: No foi possvel renomear o arquivo de troca" +msgstr "E302: Não foi possível renomear o arquivo de troca" #, c-format msgid "E303: Unable to open swap file for \"%s\", recovery impossible" -msgstr "E303: Impossvel abrir arquivo de troca para \"%s\", recuperao impossvel" +msgstr "" +"E303: Impossível abrir arquivo de troca para \"%s\", recuperação impossível" msgid "E304: ml_upd_block0(): Didn't get block 0??" -msgstr "E304: ml_upd_block0(): No foi obtido o bloco 0??" +msgstr "E304: ml_upd_block0(): Não foi obtido o bloco 0??" #, c-format msgid "E305: No swap file found for %s" msgstr "E305: Nenhum arquivo de troca encontrado para %s" msgid "Enter number of swap file to use (0 to quit): " -msgstr "Insira o nmero do arquivo de troca a usar (0 para sair): " +msgstr "Insira o número do arquivo de troca a usar (0 para sair): " #, c-format msgid "E306: Cannot open %s" -msgstr "E306: Impossvel abrir %s" +msgstr "E306: Impossível abrir %s" msgid "Unable to read block 0 from " -msgstr "Impossvel ler o bloco 0 de " +msgstr "Impossível ler o bloco 0 de " msgid "" "\n" "Maybe no changes were made or Vim did not update the swap file." msgstr "" "\n" -"Talvez nenhuma mudana tenha sido feita ou o Vim no tenha atualizado o arquivo\n" -"de troca." +"Talvez nenhuma mudança tenha sido feita ou o Vim não tenha atualizado o " +"arquivo de troca." msgid " cannot be used with this version of Vim.\n" -msgstr " no pode ser usado com esta verso do Vim.\n" +msgstr " não pode ser usado com esta versão do Vim.\n" msgid "Use Vim version 3.0.\n" -msgstr "Use o Vim verso 3.0.\n" +msgstr "Use o Vim versão 3.0.\n" #, c-format msgid "E307: %s does not look like a Vim swap file" -msgstr "E307: %s no se parece com um arquivo de troca do Vim" +msgstr "E307: %s não se parece com um arquivo de troca do Vim" msgid " cannot be used on this computer.\n" -msgstr " no pode ser usado neste computador.\n" +msgstr " não pode ser usado neste computador.\n" msgid "The file was created on " msgstr "O arquivo foi criado em " @@ -3351,8 +3430,14 @@ msgstr "" ",\n" "ou o arquivo foi danificado." +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "" +"E833: %s está criptografado e esta versão do Vim não suporta criptografia" + msgid " has been damaged (page size is smaller than minimum value).\n" -msgstr " foi danificado (o tamanho da pgina menor que o valor mnimo).\n" +msgstr " foi danificado (o tamanho da página é menor que o valor mínimo).\n" #, c-format msgid "Using swap file \"%s\"" @@ -3365,15 +3450,47 @@ msgstr "Arquivo original \"%s\"" msgid "E308: Warning: Original file may have been changed" msgstr "E308: Aviso: O arquivo original pode ter sido alterado" +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "Arquivo de troca criptografado: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "" +"\n" +"Se você inseriu uma nova chave criptográfica sem gravar o arquivo de texto," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "" +"\n" +"insira a nova chave criptográfica." + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "" +"\n" +"Se você gravou o arquivo após alterar a chave, aperte Enter" + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "" +"\n" +"para usar a mesma chave para o arquivo de texto e o de troca" + #, c-format msgid "E309: Unable to read block 1 from %s" -msgstr "E309: Impossvel ler o bloco 1 de %s" +msgstr "E309: Impossível ler o bloco 1 de %s" msgid "???MANY LINES MISSING" msgstr "???MUITAS LINHAS FALTANDO" msgid "???LINE COUNT WRONG" -msgstr "???NMERO DE LINHAS ERRADO" +msgstr "???NÚMERO DE LINHAS ERRADO" msgid "???EMPTY BLOCK" msgstr "???BLOCO VAZIO" @@ -3383,61 +3500,72 @@ msgstr "???LINHAS FALTANDO" #, c-format msgid "E310: Block 1 ID wrong (%s not a .swp file?)" -msgstr "E310: ID do bloco 1 est errado (%s no um arquivo .swp?)" +msgstr "E310: ID do bloco 1 está errado (%s não é um arquivo .swp?)" msgid "???BLOCK MISSING" msgstr "???BLOCO FALTANDO" msgid "??? from here until ???END lines may be messed up" -msgstr "??? daqui at ???FIM as linhas podem estar corrompidas" +msgstr "??? daqui até ???FIM as linhas podem estar corrompidas" msgid "??? from here until ???END lines may have been inserted/deleted" -msgstr "??? daqui at ???FIM linhas podem ter sido inseridas/excludas" +msgstr "??? daqui até ???FIM linhas podem ter sido inseridas/excluídas" msgid "???END" msgstr "???FIM" msgid "E311: Recovery Interrupted" -msgstr "E311: Recuperao interrompida" +msgstr "E311: Recuperação interrompida" -msgid "E312: Errors detected while recovering; look for lines starting with ???" -msgstr "E312: Erros detectados durante a recuperao; procure por linhas comeando com ???" +msgid "" +"E312: Errors detected while recovering; look for lines starting with ???" +msgstr "" +"E312: Erros detectados durante a recuperação; procure por linhas começando " +"com ???" msgid "See \":help E312\" for more information." -msgstr "Veja \":help E312\" para mais informaes." +msgstr "Veja \":help E312\" para mais informações." msgid "Recovery completed. You should check if everything is OK." -msgstr "Recuperao concluda. Voc deve verificar se est tudo certo." +msgstr "Recuperação concluída. Você deve verificar se está tudo certo." msgid "" "\n" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(Voc talvez queira salvar este arquivo com outro nome\n" +"(Você talvez queira salvar este arquivo com outro nome\n" + +msgid "and run diff with the original file to check for changes)" +msgstr "e execute diff com o arquivo original para verificar mudanças)" -msgid "and run diff with the original file to check for changes)\n" -msgstr "e executar diff com o arquivo original para verificar se houve alteraes)\n" +msgid "Recovery completed. Buffer contents equals file contents." +msgstr "Recuperação completa. Buffer e arquivo têm o mesmo conteúdo." msgid "" -"Delete the .swp file afterwards.\n" +"\n" +"You may want to delete the .swp file now.\n" "\n" msgstr "" -"Exclua o arquivo .swp em seguida.\n" +"\n" +"Você pode querer excluir o arquivo .swp agora.\n" "\n" -#. use msg() to start the scrolling properly +msgid "Using crypt key from swap file for the text file.\n" +msgstr "" +"Usando chave criptográfica do arquivo de troca para o arquivo de texto.\n" + msgid "Swap files found:" msgstr "Arquivos de troca encontrados:" msgid " In current directory:\n" -msgstr " No diretrio atual:\n" +msgstr " No diretório atual:\n" msgid " Using specified name:\n" msgstr " Usando o nome especificado:\n" msgid " In directory " -msgstr " No diretrio " +msgstr " No diretório " msgid " -- none --\n" msgstr " -- nenhum --\n" @@ -3452,10 +3580,10 @@ msgid " dated: " msgstr " com data de: " msgid " [from Vim version 3.0]" -msgstr " [do Vim verso 3.0]" +msgstr " [do Vim versão 3.0]" msgid " [does not look like a Vim swap file]" -msgstr " [no se parece com um arquivo de troca do Vim]" +msgstr " [não se parece com um arquivo de troca do Vim]" msgid " file name: " msgstr " nome do arquivo: " @@ -3471,14 +3599,14 @@ msgid "YES" msgstr "SIM" msgid "no" -msgstr "no" +msgstr "não" msgid "" "\n" " user name: " msgstr "" "\n" -" nome de usurio: " +" nome de usuário: " msgid " host name: " msgstr " nome do host: " @@ -3505,37 +3633,37 @@ msgid "" " [not usable with this version of Vim]" msgstr "" "\n" -" [no pode ser usado com esta verso do Vim]" +" [não pode ser usado com esta versão do Vim]" msgid "" "\n" " [not usable on this computer]" msgstr "" "\n" -" [no pode ser usado neste computador]" +" [não pode ser usado neste computador]" msgid " [cannot be read]" -msgstr " [no pode ser lido]" +msgstr " [não pode ser lido]" msgid " [cannot be opened]" -msgstr " [no pode ser aberto]" +msgstr " [não pode ser aberto]" msgid "E313: Cannot preserve, there is no swap file" -msgstr "E313: Impossvel preservar, no h um arquivo de troca" +msgstr "E313: Impossível preservar, não há um arquivo de troca" msgid "File preserved" msgstr "Arquivo preservado" msgid "E314: Preserve failed" -msgstr "E314: Preservao falhou" +msgstr "E314: Preservação falhou" #, c-format msgid "E315: ml_get: invalid lnum: %ld" -msgstr "E315: ml_get: nmero de linha invlido: %ld" +msgstr "E315: ml_get: número de linha inválido: %ld" #, c-format msgid "E316: ml_get: cannot find line %ld" -msgstr "E316: ml_get: linha %ld no encontrada" +msgstr "E316: ml_get: linha %ld não encontrada" msgid "E317: pointer block id wrong 3" msgstr "E317: id do bloco de ponteiros incorreto: 3" @@ -3554,21 +3682,21 @@ msgstr "bloco 1 apagado?" #, c-format msgid "E320: Cannot find line %ld" -msgstr "E320: Linha %ld no encontrada" +msgstr "E320: Linha %ld não encontrada" msgid "E317: pointer block id wrong" msgstr "E317: id do bloco de ponteiros incorreto" msgid "pe_line_count is zero" -msgstr "pe_line_count zero" +msgstr "pe_line_count é zero" #, c-format msgid "E322: line number out of range: %ld past the end" -msgstr "E322: nmero da linha fora dos limites: %ld alm do fim" +msgstr "E322: número da linha fora dos limites: %ld além do fim" #, c-format msgid "E323: line count wrong in block %ld" -msgstr "E323: nmero de linhas incorreto no bloco %ld" +msgstr "E323: número de linhas incorreto no bloco %ld" msgid "Stack size increases" msgstr "Aumenta o tamanho da pilha" @@ -3578,10 +3706,10 @@ msgstr "E317: id do bloco de ponteiros incorreto: 2" #, c-format msgid "E773: Symlink loop for \"%s\"" -msgstr "E773: Links simblicos cclicos para \"%s\"" +msgstr "E773: Links simbólicos cíclicos para \"%s\"" msgid "E325: ATTENTION" -msgstr "E325: ATENO" +msgstr "E325: ATENÇÃO" msgid "" "\n" @@ -3596,41 +3724,32 @@ msgstr "Ao abrir o arquivo \"" msgid " NEWER than swap file!\n" msgstr " MAIS NOVO que o arquivo de troca!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" -"(1) Another program may be editing the same file.\n" -" If this is the case, be careful not to end up with two\n" -" different instances of the same file when making changes.\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Outro programa pode estar editando o mesmo arquivo.\n" -" Se for esse o caso, cuidado para no acabar com duas\n" -" verses do mesmo arquivo ao fazer alteraes.\n" +"(1) Outro programa pode estar editando o mesmo arquivo. Se for esse\n" +" o caso, cuidado para não acabar com duas versões do mesmo arquivo\n" +" ao fazer alterações. Saia, ou continue com cuidado.\n" -msgid " Quit, or continue with caution.\n" -msgstr " Saia do programa, ou continue com cuidado.\n" - -msgid "" -"\n" -"(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) Ocorreu um travamento numa sesso de edio desse arquivo.\n" +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) Uma sessão de edição para esse arquivo travou.\n" msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr " Se esse for o caso, use \":recover\" ou \"vim -r " +msgstr " Se for esse o caso, use \":recover\" ou \"vim -r " msgid "" "\"\n" " to recover the changes (see \":help recovery\").\n" msgstr "" "\"\n" -" para recuperar as alteraes (veja \":help recovery\").\n" +" para recuperar as alterações (veja \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" -msgstr " Se voc j vez isso, exclua o arquivo de troca \"" +msgstr " Se você já vez isso, exclua o arquivo de troca \"" msgid "" "\"\n" @@ -3643,13 +3762,13 @@ msgid "Swap file \"" msgstr "O arquivo de troca \"" msgid "\" already exists!" -msgstr "\" j existe!" +msgstr "\" já existe!" msgid "VIM - ATTENTION" -msgstr "VIM - ATENO" +msgstr "VIM - ATENÇÃO" msgid "Swap file already exists!" -msgstr "O arquivo de troca j existe!" +msgstr "O arquivo de troca já existe!" msgid "" "&Open Read-Only\n" @@ -3675,7 +3794,7 @@ msgstr "" "&Abrir somente-leitura\n" "&Editar mesmo assim\n" "&Recuperar\n" -"E&xclu-lo\n" +"E&xcluí-lo\n" "&Sair\n" "&Cancelar" @@ -3683,30 +3802,27 @@ msgid "E326: Too many swap files found" msgstr "E326: Foram encontrados arquivos de troca demais" msgid "E327: Part of menu-item path is not sub-menu" -msgstr "E327: Parte do caminho do item do menu no um submenu" +msgstr "E327: Parte do caminho do item do menu não é um submenu" msgid "E328: Menu only exists in another mode" -msgstr "E328: Menu s existe em outro modo" +msgstr "E328: Menu só existe em outro modo" #, c-format msgid "E329: No menu \"%s\"" -msgstr "E329: No h o menu \"%s\"" +msgstr "E329: Não há o menu \"%s\"" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: Menu com nome vazio" msgid "E330: Menu path must not lead to a sub-menu" -msgstr "E330: Caminho do menu no deve levar a um submenu" +msgstr "E330: Caminho do menu não deve levar a um submenu" msgid "E331: Must not add menu items directly to menu bar" -msgstr "E331: Itens no devem ser adicionados diretamente barra de menus" +msgstr "E331: Itens não devem ser adicionados diretamente à barra de menus" msgid "E332: Separator cannot be part of a menu path" -msgstr "E332: Um separador no pode ser parte de um caminho de menu" +msgstr "E332: Um separador não pode ser parte de um caminho de menu" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3722,17 +3838,17 @@ msgstr "E333: Caminho de menu deve levar a um item de menu" #, c-format msgid "E334: Menu not found: %s" -msgstr "E334: Menu no encontrado: %s" +msgstr "E334: Menu não encontrado: %s" #, c-format msgid "E335: Menu not defined for %s mode" -msgstr "E335: Menu no definido para o modo %s" +msgstr "E335: Menu não definido para o modo %s" msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: O caminho do menu deve levar a um submenu" msgid "E337: Menu not found - check menu names" -msgstr "E337: Menu no encontrado - verifique os nomes dos menus" +msgstr "E337: Menu não encontrado - verifique os nomes dos menus" #, c-format msgid "Error detected while processing %s:" @@ -3744,13 +3860,13 @@ msgstr "linha %4ld:" #, c-format msgid "E354: Invalid register name: '%s'" -msgstr "E354: Nome de registrador invlido: '%s'" +msgstr "E354: Nome de registrador inválido: '%s'" msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" msgstr "Tradutor das mensagens: Eduardo Dobay <edudobay@gmail.com>" msgid "Interrupt: " -msgstr "Interrupo: " +msgstr "Interrupção: " msgid "Press ENTER or type command to continue" msgstr "Aperte ENTER ou digite um comando para continuar" @@ -3763,17 +3879,17 @@ msgid "-- More --" msgstr "-- Mais --" msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " -msgstr " ESPAO/d/j: tela/pgina/linha abaixo, b/u/k: acima, q: sair " +msgstr " ESPAÇO/d/j: tela/página/linha abaixo, b/u/k: acima, q: sair " msgid "Question" -msgstr "Questo" +msgstr "Questão" msgid "" "&Yes\n" "&No" msgstr "" "&Sim\n" -"&No" +"&Não" msgid "" "&Yes\n" @@ -3783,13 +3899,13 @@ msgid "" "&Cancel" msgstr "" "&Sim\n" -"&No\n" +"&Não\n" "Salvar &tudo\n" "&Descartar tudo\n" "&Cancelar" msgid "Select Directory dialog" -msgstr "Seletor de diretrio" +msgstr "Seletor de diretório" msgid "Save File dialog" msgstr "Salvar arquivo" @@ -3797,9 +3913,8 @@ msgstr "Salvar arquivo" msgid "Open File dialog" msgstr "Abrir arquivo" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: Desculpe, no h um seletor de arquivos no modo console" +msgstr "E338: Desculpe, não há um seletor de arquivos no modo console" msgid "E766: Insufficient arguments for printf()" msgstr "E766: Argumentos insuficientes para printf()" @@ -3814,10 +3929,12 @@ msgid "W10: Warning: Changing a readonly file" msgstr "W10: Aviso: Modificando um arquivo somente-leitura" msgid "Type number and <Enter> or click with mouse (empty cancels): " -msgstr "Digite um nmero e <Enter> ou clique com o mouse (deixe em branco para cancelar): " +msgstr "" +"Digite um número e <Enter> ou clique com o mouse (deixe em branco para " +"cancelar): " msgid "Type number and <Enter> (empty cancels): " -msgstr "Digite um nmero e <Enter> (deixe em branco para cancelar): " +msgstr "Digite um número e <Enter> (deixe em branco para cancelar): " msgid "1 more line" msgstr "1 linha a mais" @@ -3839,14 +3956,6 @@ msgstr " (Interrompido)" msgid "Beep!" msgstr "Bip!" -msgid "Vim: preserving files...\n" -msgstr "Vim: preservando arquivos...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim: Concludo.\n" - -#, c-format msgid "ERROR: " msgstr "ERRO: " @@ -3867,7 +3976,7 @@ msgstr "" "\n" msgid "E340: Line is becoming too long" -msgstr "E340: A linha est tornando-se muito longa" +msgstr "E340: A linha está tornando-se muito longa" #, c-format msgid "E341: Internal error: lalloc(%ld, )" @@ -3875,7 +3984,7 @@ msgstr "E341: Erro interno: lalloc(%ld, )" #, c-format msgid "E342: Out of memory! (allocating %lu bytes)" -msgstr "E342: Memria esgotada! (ao alocar %lu bytes)" +msgstr "E342: Memória esgotada! (ao alocar %lu bytes)" #, c-format msgid "Calling shell to execute: \"%s\"" @@ -3885,95 +3994,94 @@ msgid "E545: Missing colon" msgstr "E545: Dois-pontos faltando" msgid "E546: Illegal mode" -msgstr "E546: Modo de operao invlido" +msgstr "E546: Modo de operação inválido" msgid "E547: Illegal mouseshape" -msgstr "E547: 'mouseshape' invlido" +msgstr "E547: 'mouseshape' inválido" msgid "E548: digit expected" msgstr "E548: era esperado um algarismo" msgid "E549: Illegal percentage" -msgstr "E549: Porcentagem invlida" - -msgid "Enter encryption key: " -msgstr "Insira a chave criptogrfica: " - -msgid "Enter same key again: " -msgstr "Insira a mesma chave novamente: " +msgstr "E549: Porcentagem inválida" -msgid "Keys don't match!" -msgstr "As chaves no coincidem!" +msgid "E854: path too long for completion" +msgstr "E854: caminho muito longo para completar" #, c-format -msgid "E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'." -msgstr "E343: Caminho invlido: '**[nmero]' deve estar no final do caminho ou seguido de '%s'." +msgid "" +"E343: Invalid path: '**[number]' must be at the end of the path or be " +"followed by '%s'." +msgstr "" +"E343: Caminho inválido: '**[número]' deve estar no final do caminho ou " +"seguido de '%s'." #, c-format msgid "E344: Can't find directory \"%s\" in cdpath" -msgstr "E344: Diretrio \"%s\" no encontrado em 'cdpath'" +msgstr "E344: Diretório \"%s\" não encontrado em 'cdpath'" #, c-format msgid "E345: Can't find file \"%s\" in path" -msgstr "E345: Arquivo \"%s\" no encontrado em 'path'" +msgstr "E345: Arquivo \"%s\" não encontrado em 'path'" #, c-format msgid "E346: No more directory \"%s\" found in cdpath" -msgstr "E346: Mais nenhum diretrio \"%s\" encontrado em 'cdpath'" +msgstr "E346: Mais nenhum diretório \"%s\" encontrado em 'cdpath'" #, c-format msgid "E347: No more file \"%s\" found in path" msgstr "E347: Mais nenhum arquivo \"%s\" encontrado em 'path'" -msgid "Cannot connect to Netbeans #2" -msgstr "No foi possvel conectar-se ao Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "No foi possvel conectar-se ao Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" -msgstr "E668: Modo de acesso errado para o arquivo de informao de conexo do NetBeans: \"%s\"" - -msgid "read from Netbeans socket" -msgstr "lido do socket do NetBeans" +msgstr "" +"E668: Modo de acesso errado para o arquivo de informação de conexão do " +"NetBeans: \"%s\"" #, c-format msgid "E658: NetBeans connection lost for buffer %ld" -msgstr "E658: Conexo com o NetBeans perdida para o buffer %ld" +msgstr "E658: Conexão com o NetBeans perdida para o buffer %ld" + +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: netbeans não suportado com esta GUI" -msgid "E505: " -msgstr "E505: " +msgid "E511: netbeans already connected" +msgstr "E511: netbeans já conectado" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s é somente-leitura (adicione ! para forçar)" msgid "E349: No identifier under cursor" msgstr "E349: Nenhum identificador sob o cursor" msgid "E774: 'operatorfunc' is empty" -msgstr "E774: 'operatorfunc' est vazio" +msgstr "E774: 'operatorfunc' está vazio" msgid "E775: Eval feature not available" -msgstr "E775: O recurso eval no est disponvel" +msgstr "E775: O recurso eval não está disponível" msgid "Warning: terminal cannot highlight" -msgstr "Aviso: o terminal no suporta destaque no modo visual" +msgstr "Aviso: o terminal não suporta destaque no modo visual" msgid "E348: No string under cursor" msgstr "E348: Nenhuma cadeia de caracteres sob o cursor" msgid "E352: Cannot erase folds with current 'foldmethod'" -msgstr "E352: Impossvel eliminar dobras com o 'foldmethod' atual" +msgstr "E352: Impossível eliminar dobras com o 'foldmethod' atual" msgid "E664: changelist is empty" -msgstr "E664: lista de modificaes est vazia" +msgstr "E664: lista de modificações está vazia" msgid "E662: At start of changelist" -msgstr "E662: No incio da lista de modificaes" +msgstr "E662: No início da lista de modificações" msgid "E663: At end of changelist" -msgstr "E663: No final da lista de modificaes" +msgstr "E663: No final da lista de modificações" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Digite :quit<Enter> para sair do Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Digite :qa! e aperte <Enter> para abandonar as alterações e sair do Vim" #, c-format msgid "1 line %sed 1 time" @@ -4005,9 +4113,8 @@ msgstr "%ld linhas indentadas " msgid "E748: No previously used register" msgstr "E748: Nenhum registrador foi anteriormente utilizado" -#. must display the prompt msgid "cannot yank; delete anyway" -msgstr "impossvel copiar; excluir assim mesmo" +msgstr "impossível copiar; excluir assim mesmo" msgid "1 line changed" msgstr "1 linha alterada" @@ -4020,25 +4127,30 @@ msgstr "%ld linhas alteradas" msgid "freeing %ld lines" msgstr "liberando %ld linhas" -msgid "block of 1 line yanked" -msgstr "bloco de uma linha copiado" +#, c-format +msgid " into \"%c" +msgstr " para \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "bloco de 1 linha copiado%s" -msgid "1 line yanked" -msgstr "1 linha copiada" +#, c-format +msgid "1 line yanked%s" +msgstr "1 linha copiada%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "bloco de %ld linhas copiado" +msgid "block of %ld lines yanked%s" +msgstr "bloco de %ld linhas copiado%s" #, c-format -msgid "%ld lines yanked" -msgstr "%ld linhas copiadas" +msgid "%ld lines yanked%s" +msgstr "%ld linhas copiadas%s" #, c-format msgid "E353: Nothing in register %s" -msgstr "E353: No h nada no registrador %s" +msgstr "E353: Não há nada no registrador %s" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4047,9 +4159,8 @@ msgstr "" "--- Registradores ---" msgid "Illegal register name" -msgstr "Nome de registrador invlido" +msgstr "Nome de registrador inválido" -#, c-format msgid "" "\n" "# Registers:\n" @@ -4061,69 +4172,96 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Registrador de tipo desconhecido %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: padrão de busca e registro de expressões não podem conter duas ou mais " +"linhas" + #, c-format msgid "%ld Cols; " msgstr "%ld colunas; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Selecionadas %s%ld de %ld linhas; %ld de %ld palavras; %ld de %ld bytes" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "" +"Selecionadas %s%ld de %ld linhas; %lld de %lld palavras; %lld de %lld bytes" #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes" -msgstr "Selecionadas %s%ld de %ld linhas; %ld de %ld palavras; %ld de %ld caracteres; %ld de %ld bytes" +msgid "" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"Selecionadas %s%ld de %ld linhas; %lld de %lld palavras; %lld de %lld " +"caracteres; %lld de %lld bytes" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Coluna %s de %s; linha %ld de %ld; palavra %ld de %ld; byte %ld de %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "" +"Coluna %s de %s; linha %ld de %ld; palavra %lld de %lld; byte %lld de %lld" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld" -msgstr "Coluna %s de %s; linha %ld de %ld; palavra %ld de %ld; caractere %ld de %ld; byte %ld de %ld" +msgid "" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" +msgstr "" +"Coluna %s de %s; linha %ld de %ld; palavra %lld de %lld; caractere %lld de " +"%lld; byte %lld de %lld" #, c-format msgid "(+%ld for BOM)" msgstr "(+%ld para BOM)" -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Pgina %N" - msgid "Thanks for flying Vim" msgstr "Obrigado por voar com o Vim" msgid "E518: Unknown option" -msgstr "E518: Opo desconhecida" +msgstr "E518: Opção desconhecida" msgid "E519: Option not supported" -msgstr "E519: Opo no suportada" +msgstr "E519: Opção não suportada" msgid "E520: Not allowed in a modeline" -msgstr "E520: No permitido em modelines" +msgstr "E520: Não permitido em modelines" + +msgid "E846: Key code not set" +msgstr "E846: Código de tecla não definido" msgid "E521: Number required after =" -msgstr "E521: Nmero requerido aps =" +msgstr "E521: Número requerido após =" msgid "E522: Not found in termcap" -msgstr "E522: No encontrado no termcap" +msgstr "E522: Não encontrado no termcap" #, c-format msgid "E539: Illegal character <%s>" msgstr "E539: Caractere ilegal <%s>" +#, c-format +msgid "For option %s" +msgstr "Para opção %s" + msgid "E529: Cannot set 'term' to empty string" -msgstr "E529: 'term' no pode ser uma string vazia" +msgstr "E529: 'term' não pode ser uma string vazia" msgid "E530: Cannot change term in GUI" -msgstr "E530: term no pode ser alterado na interface grfica" +msgstr "E530: term não pode ser alterado na interface gráfica" msgid "E531: Use \":gui\" to start the GUI" -msgstr "E531: Use \":gui\" para iniciar a interface grfica" +msgstr "E531: Use \":gui\" para iniciar a interface gráfica" msgid "E589: 'backupext' and 'patchmode' are equal" -msgstr "E589: 'backupext' e 'patchmode' so iguais" +msgstr "E589: 'backupext' e 'patchmode' são iguais" + +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: Conflita com valor de 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: Conflita com valor de 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" -msgstr "E617: No pode ser modificado na interface GTK+ 2" +msgstr "E617: Não pode ser modificado na interface GTK+ 2" msgid "E524: Missing colon" msgstr "E524: Dois-pontos faltando" @@ -4133,107 +4271,107 @@ msgstr "E525: Cadeia de comprimento zero" #, c-format msgid "E526: Missing number after <%s>" -msgstr "E526: Nmero faltando aps <%s>" +msgstr "E526: Número faltando após <%s>" msgid "E527: Missing comma" -msgstr "E527: Vrgula faltando" +msgstr "E527: Vírgula faltando" msgid "E528: Must specify a ' value" -msgstr "E528: necessrio especificar um valor para '" +msgstr "E528: É necessário especificar um valor para '" msgid "E595: contains unprintable or wide character" -msgstr "E595: contm caracteres no-imprimveis ou largos" +msgstr "E595: contém caracteres não-imprimíveis ou largos" msgid "E596: Invalid font(s)" -msgstr "E596: Fonte(s) invlida(s)" +msgstr "E596: Fonte(s) inválida(s)" msgid "E597: can't select fontset" -msgstr "E597: impossvel selecionar conjunto de fontes" +msgstr "E597: impossível selecionar conjunto de fontes" msgid "E598: Invalid fontset" -msgstr "E598: Conjunto de fontes invlido" +msgstr "E598: Conjunto de fontes inválido" msgid "E533: can't select wide font" -msgstr "E533: impossvel selecionar fonte de caracteres largos" +msgstr "E533: impossível selecionar fonte de caracteres largos" msgid "E534: Invalid wide font" -msgstr "E534: Fonte de caracteres largos invlida." +msgstr "E534: Fonte de caracteres largos inválida" #, c-format msgid "E535: Illegal character after <%c>" -msgstr "E535: Caractere invlido aps <%c>" +msgstr "E535: Caractere inválido após <%c>" msgid "E536: comma required" -msgstr "E536: vrgula requerida" +msgstr "E536: vírgula requerida" #, c-format msgid "E537: 'commentstring' must be empty or contain %s" msgstr "E537: 'commentstring' deve estar vazia ou conter %s" msgid "E538: No mouse support" -msgstr "E538: No h suporte a mouse" +msgstr "E538: Não há suporte a mouse" msgid "E540: Unclosed expression sequence" -msgstr "E540: Expresso no terminada com '}'" +msgstr "E540: Expressão não terminada com '}'" msgid "E541: too many items" msgstr "E541: itens demais" msgid "E542: unbalanced groups" -msgstr "E542: parnteses desequilibrados" +msgstr "E542: parênteses desequilibrados" + +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Um terminal com trabalho em execução não pode ser modificável" msgid "E590: A preview window already exists" -msgstr "E590: J existe uma janela de visualizao" +msgstr "E590: Já existe uma janela de visualização" msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" -msgstr "W17: rabe requer UTF-8; digite ':set encoding=utf-8'" +msgstr "W17: Árabe requer UTF-8; digite ':set encoding=utf-8'" #, c-format msgid "E593: Need at least %d lines" -msgstr "E593: So necessrias pelo menos %d linhas" +msgstr "E593: São necessárias pelo menos %d linhas" #, c-format msgid "E594: Need at least %d columns" -msgstr "E594: So necessrias pelo menos %d colunas" +msgstr "E594: São necessárias pelo menos %d colunas" #, c-format msgid "E355: Unknown option: %s" -msgstr "E355: Opo desconhecida: %s" +msgstr "E355: Opção desconhecida: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" -msgstr "E521: Nmero requerido: &%s = '%s'" +msgstr "E521: Número requerido: &%s = '%s'" msgid "" "\n" "--- Terminal codes ---" msgstr "" "\n" -"--- Cdigos de terminal ---" +"--- Códigos de terminal ---" msgid "" "\n" "--- Global option values ---" msgstr "" "\n" -"--- Valores de opes globais ---" +"--- Valores de opções globais ---" msgid "" "\n" "--- Local option values ---" msgstr "" "\n" -"--- Valores de opes locais ---" +"--- Valores de opções locais ---" msgid "" "\n" "--- Options ---" msgstr "" "\n" -"--- Opes ---" +"--- Opções ---" msgid "E356: get_varp ERROR" msgstr "E356: ERRO em get_varp" @@ -4244,43 +4382,42 @@ msgstr "E357: 'langmap': Falta um caractere para corresponder com %s" #, c-format msgid "E358: 'langmap': Extra characters after semicolon: %s" -msgstr "E358: 'langmap': Caracteres a mais aps ponto-e-vrgula: %s" +msgstr "E358: 'langmap': Caracteres a mais após ponto-e-vírgula: %s" msgid "cannot open " -msgstr "impossvel abrir " +msgstr "impossível abrir " msgid "VIM: Can't open window!\n" -msgstr "VIM: No foi possvel abrir a janela!\n" +msgstr "VIM: Não foi possível abrir a janela!\n" msgid "Need Amigados version 2.04 or later\n" -msgstr "Necessrio Amigados verso 2.04 ou mais nova\n" +msgstr "Necessário Amigados versão 2.04 ou mais nova\n" #, c-format msgid "Need %s version %ld\n" -msgstr "Necessrio %s verso %ld\n" +msgstr "Necessário %s versão %ld\n" msgid "Cannot open NIL:\n" -msgstr "Impossvel abrir NIL:\n" +msgstr "Impossível abrir NIL:\n" msgid "Cannot create " -msgstr "Impossvel criar " +msgstr "Impossível criar " #, c-format msgid "Vim exiting with %d\n" msgstr "Vim terminando com %d\n" msgid "cannot change console mode ?!\n" -msgstr "impossvel alterar o modo de console ?!\n" +msgstr "impossível alterar o modo de console ?!\n" msgid "mch_get_shellsize: not a console??\n" -msgstr "mch_get_shellsize: no um console??\n" +msgstr "mch_get_shellsize: não é um console??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" -msgstr "E360: Impossvel executar shell com opo -f" +msgstr "E360: Impossível executar shell com opção -f" msgid "Cannot execute " -msgstr "No possvel executar " +msgstr "Não é possível executar " msgid "shell " msgstr "shell " @@ -4297,11 +4434,8 @@ msgstr "ERRO DE E/S" msgid "Message" msgstr "Mensagem" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' no vale 80; impossvel executar comandos externos" - msgid "E237: Printer selection failed" -msgstr "E237: Seleo da impressora falhou" +msgstr "E237: Seleção da impressora falhou" #, c-format msgid "to %s on %s" @@ -4309,11 +4443,11 @@ msgstr "para %s em %s" #, c-format msgid "E613: Unknown printer font: %s" -msgstr "E613: Fonte de impresso desconhecida: %s" +msgstr "E613: Fonte de impressão desconhecida: %s" #, c-format msgid "E238: Print error: %s" -msgstr "E238: Erro de impresso: %s" +msgstr "E238: Erro de impressão: %s" #, c-format msgid "Printing '%s'" @@ -4321,22 +4455,15 @@ msgstr "Imprimindo '%s'" #, c-format msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" -msgstr "E244: Conjunto de caracteres \"%s\" invlido no nome da fonte \"%s\"" - -#, c-format -msgid "E245: Illegal char '%c' in font name \"%s\"" -msgstr "E245: Caractere '%c' invlido no nome da fonte \"%s\"" - -msgid "Vim: Double signal, exiting\n" -msgstr "Vim: Sinal duplo, saindo\n" +msgstr "E244: Conjunto de caracteres \"%s\" inválido no nome da fonte \"%s\"" #, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim: Sinal mortal %s interceptado\n" +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Qualidade \"%s\" inválida no nome da fonte \"%s\"" #, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim: Sinal mortal interceptado\n" +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Caractere '%c' inválido no nome da fonte \"%s\"" #, c-format msgid "Opening the X display took %ld msec" @@ -4360,28 +4487,29 @@ msgid "" "Could not get security context for " msgstr "" "\n" -"No foi possvel obter o contexto de segurana para " +"Não foi possível obter o contexto de segurança para " msgid "" "\n" "Could not set security context for " msgstr "" "\n" -"No foi possvel definir o contexto de segurana para " +"Não foi possível definir o contexto de segurança para " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"No foi possvel executar o shell " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Não foi possível definir o contexto de segurança %s para %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Não foi possível obter o contexto de segurança %s para %s. Removendo!" msgid "" "\n" "Cannot execute shell sh\n" msgstr "" "\n" -"No foi possvel executar o shell sh\n" +"Não foi possível executar o shell sh\n" msgid "" "\n" @@ -4395,14 +4523,21 @@ msgid "" "Cannot create pipes\n" msgstr "" "\n" -"Impossvel criar pipes de comunicao\n" +"Impossível criar pipes de comunicação\n" msgid "" "\n" "Cannot fork\n" msgstr "" "\n" -"Impossvel realizar bifurcao de processo\n" +"Impossível realizar bifurcação de processo\n" + +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Não foi possível executar o shell " msgid "" "\n" @@ -4412,7 +4547,7 @@ msgstr "" "Comando interrompido\n" msgid "XSMP lost ICE connection" -msgstr "XSMP perdeu a conexo ICE" +msgstr "XSMP perdeu a conexão ICE" #, c-format msgid "dlerror = \"%s\"" @@ -4425,10 +4560,10 @@ msgid "XSMP handling save-yourself request" msgstr "XSMP tratando pedido de auto-salvamento" msgid "XSMP opening connection" -msgstr "XSMP abrindo conexo" +msgstr "XSMP abrindo conexão" msgid "XSMP ICE connection watch failed" -msgstr "Falha no vigia de conexes ICE do XSMP" +msgstr "Falha no vigia de conexões ICE do XSMP" #, c-format msgid "XSMP SmcOpenConnection failed: %s" @@ -4438,17 +4573,13 @@ msgid "At line" msgstr "Na linha" msgid "Could not load vim32.dll!" -msgstr "No foi possvel carregar vim32.dll!" +msgstr "Não foi possível carregar vim32.dll!" msgid "VIM Error" msgstr "Erro do VIM" msgid "Could not fix up function pointers to the DLL!" -msgstr "No foi possvel definir os ponteiros de funo para a DLL!" - -#, c-format -msgid "shell returned %d" -msgstr "shell devolveu %d" +msgstr "Não foi possível definir os ponteiros de função para a DLL!" #, c-format msgid "Vim: Caught %s event\n" @@ -4464,58 +4595,75 @@ msgid "shutdown" msgstr "de desligamento" msgid "E371: Command not found" -msgstr "E371: Comando no encontrado" +msgstr "E371: Comando não encontrado" msgid "" "VIMRUN.EXE not found in your $PATH.\n" "External commands will not pause after completion.\n" "See :help win32-vimrun for more information." msgstr "" -"VIMRUN.EXE no foi encontrado no seu $PATH.\n" -"Comandos externos no faro uma pausa ao terminar.\n" -"Veja :help win32-vimrun para mais informaes." +"VIMRUN.EXE não foi encontrado no seu $PATH.\n" +"Comandos externos não farão uma pausa ao terminar.\n" +"Veja :help win32-vimrun para mais informações." msgid "Vim Warning" msgstr "Alerta do Vim" +#, c-format +msgid "shell returned %d" +msgstr "shell devolveu %d" + #, c-format msgid "E372: Too many %%%c in format string" -msgstr "E372: Muitos %%%c na especificao do formato" +msgstr "E372: Muitos %%%c na especificação do formato" #, c-format msgid "E373: Unexpected %%%c in format string" -msgstr "E373: %%%c inesperado na especificao do formato" +msgstr "E373: %%%c inesperado na especificação do formato" msgid "E374: Missing ] in format string" -msgstr "E374: ] faltando na especificao do formato" +msgstr "E374: ] faltando na especificação do formato" #, c-format msgid "E375: Unsupported %%%c in format string" -msgstr "E375: %%%c no suportado na especificao de formato" +msgstr "E375: %%%c não suportado na especificação de formato" #, c-format msgid "E376: Invalid %%%c in format string prefix" -msgstr "E376: %%%c invlido no prefixo da especificao de formato" +msgstr "E376: %%%c inválido no prefixo da especificação de formato" #, c-format msgid "E377: Invalid %%%c in format string" -msgstr "E377: %%%c invlido na especificao de formato" +msgstr "E377: %%%c inválido na especificação de formato" msgid "E378: 'errorformat' contains no pattern" -msgstr "E378: 'errorformat' no contm nenhum padro" +msgstr "E378: 'errorformat' não contém nenhum padrão" msgid "E379: Missing or empty directory name" -msgstr "E379: O nome do diretrio est faltando ou vazio" +msgstr "E379: O nome do diretório está faltando ou vazio" msgid "E553: No more items" -msgstr "E553: No h mais itens" +msgstr "E553: Não há mais itens" + +msgid "E924: Current window was closed" +msgstr "E924: Janela atual foi fechada" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Quickfix atual foi alterada" + +msgid "E926: Current location list was changed" +msgstr "E926: Lista de locais atual foi alterada" #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d de %d)%s%s: " msgid " (line deleted)" -msgstr " (linha excluda)" +msgstr " (linha excluída)" + +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%slista de erros %d de %d; %d erros " msgid "E380: At bottom of quickfix stack" msgstr "E380: No final da pilha do quickfix" @@ -4523,42 +4671,38 @@ msgstr "E380: No final da pilha do quickfix" msgid "E381: At top of quickfix stack" msgstr "E381: No topo da pilha do quickfix" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "lista de erros %d de %d; %d erros" +msgid "No entries" +msgstr "Sem entradas" -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "E382: Impossvel gravar, opo 'buftype' foi definida" +msgid "Error file" +msgstr "Arquivo de erro" msgid "E683: File name missing or invalid pattern" -msgstr "E683: Nome de arquivo faltando ou padro invlido" +msgstr "E683: Nome de arquivo faltando ou padrão inválido" #, c-format msgid "Cannot open file \"%s\"" -msgstr "Impossvel abrir arquivo \"%s\"" +msgstr "Impossível abrir arquivo \"%s\"" msgid "E681: Buffer is not loaded" -msgstr "E681: Buffer no est carregado" +msgstr "E681: Buffer não está carregado" msgid "E777: String or List expected" msgstr "E777: Era esperada uma String ou uma Lista" #, c-format msgid "E369: invalid item in %s%%[]" -msgstr "E369: item invlido em %s%%[]" - -msgid "E339: Pattern too long" -msgstr "E339: Padro longo demais" - -msgid "E50: Too many \\z(" -msgstr "E50: Muitos \\z(" +msgstr "E369: item inválido em %s%%[]" #, c-format -msgid "E51: Too many %s(" -msgstr "E51: Muitos %s(" +msgid "E769: Missing ] after %s[" +msgstr "E769: ] faltando após %s[" -msgid "E52: Unmatched \\z(" -msgstr "E52: \\z( sem correspondente" +msgid "E944: Reverse range in character class" +msgstr "E944: Intervalo invertido em classe de caracteres" + +msgid "E945: Range too large in character class" +msgstr "E945: Intervalo muito grande em classe de caracteres" #, c-format msgid "E53: Unmatched %s%%(" @@ -4572,9 +4716,39 @@ msgstr "E54: %s( sem correspondente" msgid "E55: Unmatched %s)" msgstr "E55: %s) sem correspondente" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( não é permitido aqui" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 e cia. não são permitidos aqui" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ] faltando após %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] vazio" + +msgid "E65: Illegal back reference" +msgstr "E65: Retrorreferência inválida" + +msgid "E339: Pattern too long" +msgstr "E339: Padrão longo demais" + +msgid "E50: Too many \\z(" +msgstr "E50: Muitos \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Muitos %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: \\z( sem correspondente" + #, c-format msgid "E59: invalid character after %s@" -msgstr "E59: caractere invlido aps %s@" +msgstr "E59: caractere inválido após %s@" #, c-format msgid "E60: Too many complex %s{...}s" @@ -4589,56 +4763,118 @@ msgid "E62: Nested %s%c" msgstr "E62: %s%c aninhado" msgid "E63: invalid use of \\_" -msgstr "E63: uso invlido de \\_" +msgstr "E63: uso inválido de \\_" #, c-format msgid "E64: %s%c follows nothing" -msgstr "E64: %s%c no segue nenhum item" +msgstr "E64: %s%c não segue nenhum item" -msgid "E65: Illegal back reference" -msgstr "E65: Retrorreferncia invlida" +msgid "E68: Invalid character after \\z" +msgstr "E68: Caractere inválido após \\z" -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( no permitido aqui" +#, c-format +msgid "E678: Invalid character after %s%%[dxouU]" +msgstr "E678: Caractere inválido após %s%%[dxouU]" -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 e cia. no so permitidos aqui" +#, c-format +msgid "E71: Invalid character after %s%%" +msgstr "E71: Caractere inválido após %s%%" -msgid "E68: Invalid character after \\z" -msgstr "E68: Caractere invlido aps \\z" +#, c-format +msgid "E554: Syntax error in %s{...}" +msgstr "E554: Erro de sintaxe em %s{...}" + +msgid "External submatches:\n" +msgstr "Subcoincidências externas:\n" #, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: ] faltando aps %s%%[" +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) %s não pode ser repetido" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: \\%#= só pode ser seguido por 0, 1 ou 2. Será usada a seleção " +"automática do mecanismo de regex" + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Usando mecanismo de regexp com backtracking para o padrão: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Fim prematuro de regexp" + +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA regexp) %c mal colocado" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Classe de caracteres inválida: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Operador '\\z%c' desconhecido" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Operador '\\%%%c' desconhecido" + +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Erro ao construir NFA com classe de equivalência!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Operador '\\@%c' desconhecido" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA regexp) Erro ao ler limites de repetição" + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Não é possível um multi seguindo outro multi!" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA regexp) Muitos '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA regexp) Muitos \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA regexp) terminação imprópria" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) não foi possível desempilhar a pilha!" -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[] vazio" +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (NFA regexp) (ao converter de postfix para NFA), muitos estados " +"sobraram na pilha" -#, c-format -msgid "E678: Invalid character after %s%%[dxouU]" -msgstr "E678: Caractere invlido aps %s%%[dxouU]" +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (NFA regexp) espaço insuficiente para guardar todo o NFA " -#, c-format -msgid "E71: Invalid character after %s%%" -msgstr "E71: Caractere invlido aps %s%%" +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) memória não pôde ser alocada para percorrer os ramos!" -#, c-format -msgid "E769: Missing ] after %s[" -msgstr "E769: ] faltando aps %s[" +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Arquivo de log temporário não pôde ser gravado, mostrando no stderr ... " #, c-format -msgid "E554: Syntax error in %s{...}" -msgstr "E554: Erro de sintaxe em %s{...}" +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) %s NÃO PÔDE SER ABERTO !" -msgid "External submatches:\n" -msgstr "Subcoincidncias externas:\n" +msgid "Could not open temporary log file for writing " +msgstr "Não foi possível abrir arquivo de log temporário para escrita " msgid " VREPLACE" -msgstr " SUBSTITUIO VISUAL" +msgstr " SUBSTITUIÇÃO VISUAL" msgid " REPLACE" -msgstr " SUBSTITUIO" +msgstr " SUBSTITUIÇÃO" # ESD - In Portuguese it would sound more natural if the message for # "REVERSE" came *after* the message for "INSERT". @@ -4646,25 +4882,22 @@ msgid " REVERSE" msgstr " (INVERTIDA)" msgid " INSERT" -msgstr " INSERO" +msgstr " INSERÇÃO" msgid " (insert)" -msgstr " (insero)" +msgstr " (inserção)" msgid " (replace)" -msgstr " (substituio)" +msgstr " (substituição)" msgid " (vreplace)" -msgstr " (substituio visual)" +msgstr " (substituição visual)" msgid " Hebrew" msgstr " Hebraico" msgid " Arabic" -msgstr " rabe" - -msgid " (lang)" -msgstr " (lngua)" +msgstr " Árabe" msgid " (paste)" msgstr " (colar)" @@ -4679,20 +4912,20 @@ msgid " VISUAL BLOCK" msgstr " VISUAL/BLOCO" msgid " SELECT" -msgstr " SELEO" +msgstr " SELEÇÃO" msgid " SELECT LINE" -msgstr " SELEO DE LINHAS" +msgstr " SELEÇÃO DE LINHAS" msgid " SELECT BLOCK" -msgstr " SELEO EM BLOCO" +msgstr " SELEÇÃO EM BLOCO" msgid "recording" msgstr "gravando" #, c-format msgid "E383: Invalid search string: %s" -msgstr "E383: Texto de busca invlido: %s" +msgstr "E383: Texto de busca inválido: %s" #, c-format msgid "E384: search hit TOP without match for: %s" @@ -4703,52 +4936,51 @@ msgid "E385: search hit BOTTOM without match for: %s" msgstr "E385: busca atingiu o FIM sem encontrar: %s" msgid "E386: Expected '?' or '/' after ';'" -msgstr "E386: '?' ou '/' esperado aps ';'" +msgstr "E386: '?' ou '/' esperado após ';'" msgid " (includes previously listed match)" -msgstr " (inclui coincidncias listadas anteriormente)" +msgstr " (inclui coincidências listadas anteriormente)" -#. cursor at status line msgid "--- Included files " -msgstr "--- Arquivos includos " +msgstr "--- Arquivos incluídos " msgid "not found " -msgstr "no encontrados " +msgstr "não encontrados " msgid "in path ---\n" msgstr "no caminho de busca ---\n" msgid " (Already listed)" -msgstr " (J listado)" +msgstr " (Já listado)" msgid " NOT FOUND" -msgstr " NO ENCONTRADO" +msgstr " NÃO ENCONTRADO" #, c-format msgid "Scanning included file: %s" -msgstr "Examinando arquivo includo: %s" +msgstr "Examinando arquivo incluído: %s" #, c-format msgid "Searching included file %s" -msgstr "Examinando arquivo includo %s" +msgstr "Examinando arquivo incluído %s" msgid "E387: Match is on current line" -msgstr "E387: A correspondncia est na linha atual" +msgstr "E387: A correspondência está na linha atual" msgid "All included files were found" -msgstr "Todos os arquivos includos foram encontrados" +msgstr "Todos os arquivos incluídos foram encontrados" msgid "No included files" -msgstr "No h arquivos includos" +msgstr "Não há arquivos incluídos" msgid "E388: Couldn't find definition" -msgstr "E388: Definio no foi encontrada" +msgstr "E388: Definição não foi encontrada" msgid "E389: Couldn't find pattern" -msgstr "E389: Padro no foi encontrado" +msgstr "E389: Padrão não foi encontrado" msgid "Substitute " -msgstr " de substituio" +msgstr " de substituição" # ESD - The %s is replaced by the argument which is given to the wvsp_one() # function (search.c). The "Substitute " argument which may be given @@ -4760,14 +4992,53 @@ msgid "" "~" msgstr "" "\n" -"# ltimo padro de busca %s:\n" +"# Último padrão de busca %s:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Erro de formato no arquivo de verificao ortogrfica" +msgid "E756: Spell checking is not enabled" +msgstr "E756: A verificação ortográfica não está ativada" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Aviso: Não encontrada a lista de palavras \"%s_%s.spl\" ou \"%s_ascii.spl\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Aviso: Não encontrada a lista de palavras \"%s.%s.spl\" ou \"%s.ascii.spl\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: O autocomando SpellFileMissing apagou o buffer" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Aviso: região %s não é suportada" + +msgid "Sorry, no suggestions" +msgstr "Desculpe, não há sugestões" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Desculpe, apenas %ld sugestões" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Alterar \"%.*s\" para:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Nenhuma substituição ortográfica anterior" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Não encontrado: %s" msgid "E758: Truncated spell file" -msgstr "E758: Arquivo de verificao ortogrfica truncado" +msgstr "E758: Arquivo de verificação ortográfica truncado" #, c-format msgid "Trailing text in %s line %d: %s" @@ -4781,37 +5052,48 @@ msgid "E761: Format error in affix file FOL, LOW or UPP" msgstr "E761: Erro de formato em FOL, LOW ou UPP no arquivo de afixos" msgid "E762: Character in FOL, LOW or UPP is out of range" -msgstr "E762: H um caractere fora dos limites em FOL, LOW ou UPP" +msgstr "E762: Há um caractere fora dos limites em FOL, LOW ou UPP" msgid "Compressing word tree..." -msgstr "Comprimindo rvore de palavras..." - -msgid "E756: Spell checking is not enabled" -msgstr "E756: A verificao ortogrfica no est ativada" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Aviso: A lista de palavras \"%s.%s.spl\" ou \"%s.ascii.spl\" no foi encontrada" +msgstr "Comprimindo árvore de palavras..." #, c-format msgid "Reading spell file \"%s\"" -msgstr "Lendo arquivo de verificao ortogrfica \"%s\"" +msgstr "Lendo arquivo de verificação ortográfica \"%s\"" msgid "E757: This does not look like a spell file" -msgstr "E757: Este no se parece com um arquivo de verificao ortogrfica" +msgstr "E757: Este não se parece com um arquivo de verificação ortográfica" msgid "E771: Old spell file, needs to be updated" -msgstr "E771: Arquivo de verificao ortogrfica antigo; necessrio atualiz-lo" +msgstr "" +"E771: Arquivo de verificação ortográfica antigo; é necessário atualizá-lo" msgid "E772: Spell file is for newer version of Vim" -msgstr "E772: Arquivo de verificao ortogrfica para uma verso mais nova do Vim" +msgstr "" +"E772: Arquivo de verificação ortográfica é para uma versão mais nova do Vim" msgid "E770: Unsupported section in spell file" -msgstr "E770: Seo no suportada no arquivo de verificao ortogrfica" +msgstr "E770: Seção não suportada no arquivo de verificação ortográfica" #, c-format -msgid "Warning: region %s not supported" -msgstr "Aviso: regio %s no suportada" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Este não parece com um arquivo .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Arquivo .sug antigo, precisa ser atualizado: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Arquivo .sug é para uma versão mais nova do Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: O arquivo .sug não corresponde ao arquivo .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: erro ao ler o arquivo .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -4819,31 +5101,39 @@ msgstr "Lendo arquivo de afixos %s..." #, c-format msgid "Conversion failure for word in %s line %d: %s" -msgstr "Falha na converso para palavra em %s, linha %d: %s" +msgstr "Falha na conversão para palavra em %s, linha %d: %s" #, c-format msgid "Conversion in %s not supported: from %s to %s" -msgstr "Converso em %s no suportada: de %s para %s" +msgstr "Conversão em %s não é suportada: de %s para %s" #, c-format msgid "Conversion in %s not supported" -msgstr "Converso em %s no suportada" +msgstr "Conversão em %s não é suportada" #, c-format msgid "Invalid value for FLAG in %s line %d: %s" -msgstr "Valor invlido para FLAG em %s, linha %d: %s" +msgstr "Valor inválido para FLAG em %s, linha %d: %s" #, c-format msgid "FLAG after using flags in %s line %d: %s" -msgstr "FLAG encontrado aps outros indicadores em %s, linha %d: %s" +msgstr "FLAG encontrado após outros indicadores em %s, linha %d: %s" #, c-format -msgid "Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d" -msgstr "Definir COMPOUNDFORBIDFLAG aps um item PFX pode causar resultados errados em %s, linha %d" +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Definir COMPOUNDFORBIDFLAG após um item PFX pode causar resultados errados " +"em %s, linha %d" #, c-format -msgid "Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d" -msgstr "Definir COMPOUNDPERMITFLAG aps um item PFX pode causar resultados errados em %s, linha %d" +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Definir COMPOUNDPERMITFLAG após um item PFX pode causar resultados errados " +"em %s, linha %d" #, c-format msgid "Wrong COMPOUNDRULES value in %s line %d: %s" @@ -4867,15 +5157,21 @@ msgstr "Valor CHECKCOMPOUNDPATTERN incorreto em %s, linha %d: %s" #, c-format msgid "Different combining flag in continued affix block in %s line %d: %s" -msgstr "Indicadores de combinao diferentes no bloco de afixos continuado em %s linha %d: %s" +msgstr "" +"Indicadores de combinação diferentes no bloco de afixos continuado em %s " +"linha %d: %s" #, c-format msgid "Duplicate affix in %s line %d: %s" msgstr "Afixo duplicado em %s, linha %d: %s" #, c-format -msgid "Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s" -msgstr "Afixo tambm usado para BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST em %s, linha %d: %s" +msgid "" +"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " +"line %d: %s" +msgstr "" +"Afixo também usado para BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " +"em %s, linha %d: %s" #, c-format msgid "Expected Y or N in %s line %d: %s" @@ -4883,15 +5179,15 @@ msgstr "Esperado Y ou N em %s, linha %d: %s" #, c-format msgid "Broken condition in %s line %d: %s" -msgstr "Condio defeituosa em %s, linha %d: %s" +msgstr "Condição defeituosa em %s, linha %d: %s" #, c-format msgid "Expected REP(SAL) count in %s line %d" -msgstr "Esperado nmero de REP(SAL) em %s, linha %d" +msgstr "Esperado número de REP(SAL) em %s, linha %d" #, c-format msgid "Expected MAP count in %s line %d" -msgstr "Esperado nmero de MAP em %s, linha %d" +msgstr "Esperado número de MAP em %s, linha %d" #, c-format msgid "Duplicate character in MAP in %s line %d" @@ -4899,7 +5195,7 @@ msgstr "Caractere duplicado em MAP em %s, linha %d" #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" -msgstr "Item no reconhecido ou duplicado em %s, linha %d: %s" +msgstr "Item não reconhecido ou duplicado em %s, linha %d: %s" #, c-format msgid "Missing FOL/LOW/UPP line in %s" @@ -4909,13 +5205,13 @@ msgid "COMPOUNDSYLMAX used without SYLLABLE" msgstr "COMPOUNDSYLMAX usado sem SYLLABLE" msgid "Too many postponed prefixes" -msgstr "H muitos prefixos postergados" +msgstr "Há muitos prefixos postergados" msgid "Too many compound flags" -msgstr "H muitos indicadores de composio" +msgstr "Há muitos indicadores de composição" msgid "Too many postponed prefixes and/or compound flags" -msgstr "H muitos prefixos postergados e/ou indicadores de composio" +msgstr "Há muitos prefixos postergados e/ou indicadores de composição" #, c-format msgid "Missing SOFO%s line in %s" @@ -4927,23 +5223,23 @@ msgstr "Linhas SAL e SOFO presentes em %s" #, c-format msgid "Flag is not a number in %s line %d: %s" -msgstr "Indicador no numrico em %s, linha %d: %s" +msgstr "Indicador não numérico em %s, linha %d: %s" #, c-format msgid "Illegal flag in %s line %d: %s" -msgstr "Indicador invlido em %s, linha %d: %s" +msgstr "Indicador inválido em %s, linha %d: %s" #, c-format msgid "%s value differs from what is used in another .aff file" -msgstr "O valor de %s diferente daquele usado em outro arquivo .aff" +msgstr "O valor de %s é diferente daquele usado em outro arquivo .aff" #, c-format msgid "Reading dictionary file %s ..." -msgstr "Lendo arquivo-dicionrio %s ..." +msgstr "Lendo arquivo-dicionário %s ..." #, c-format msgid "E760: No word count in %s" -msgstr "E760: Nmero de palavras no indicado em %s" +msgstr "E760: Número de palavras não indicado em %s" #, c-format msgid "line %6d, word %6d - %s" @@ -4963,7 +5259,7 @@ msgstr "%d palavra(s) duplicada(s) em %s" #, c-format msgid "Ignored %d word(s) with non-ASCII characters in %s" -msgstr "Foram ignoradas %d palavra(s) com caracteres no-ASCII em %s" +msgstr "Foram ignoradas %d palavra(s) com caracteres não-ASCII em %s" #, c-format msgid "Reading word file %s ..." @@ -4975,7 +5271,7 @@ msgstr "Linha /encoding= duplicada ignorada em %s, linha %d: %s" #, c-format msgid "/encoding= line after word ignored in %s line %d: %s" -msgstr "Linha /encoding= ignorada aps uma palavra em %s, linha %d: %s" +msgstr "Linha /encoding= ignorada após uma palavra em %s, linha %d: %s" #, c-format msgid "Duplicate /regions= line ignored in %s line %d: %s" @@ -4983,7 +5279,7 @@ msgstr "Linha /regions= duplicada ignorada em %s, linha %d: %s" #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "Regies demais em %s, linha %d: %s" +msgstr "Regiões demais em %s, linha %d: %s" #, c-format msgid "/ line ignored in %s line %d: %s" @@ -4991,149 +5287,126 @@ msgstr "Linha / ignorada em %s, linha %d: %s" #, c-format msgid "Invalid region nr in %s line %d: %s" -msgstr "Nm. de regio invlido em %s, linha %d: %s" +msgstr "Núm. de região inválido em %s, linha %d: %s" #, c-format msgid "Unrecognized flags in %s line %d: %s" -msgstr "Indicadores no reconhecidos em %s, linha %d: %s" +msgstr "Indicadores não reconhecidos em %s, linha %d: %s" #, c-format msgid "Ignored %d words with non-ASCII characters" -msgstr "Ignoradas %d palavras com caracteres no-ASCII" +msgstr "Ignoradas %d palavras com caracteres não-ASCII" + +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Memória insuficiente, a lista de palavras ficará incompleta" #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" -msgstr "%d de %d ns comprimidos; %d (%d%%) restantes" +msgstr "%d de %d nós comprimidos; %d (%d%%) restantes" msgid "Reading back spell file..." -msgstr "Relendo o arquivo de verificao ortogrfica..." +msgstr "Relendo o arquivo de verificação ortográfica..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." -msgstr "Realizando anlise fontica..." +msgstr "Realizando análise fonética..." #, c-format msgid "Number of words after soundfolding: %ld" -msgstr "Nmero de palavras aps anlise fontica: %ld" +msgstr "Número de palavras após análise fonética: %ld" #, c-format msgid "Total number of words: %d" -msgstr "Nmero total de palavras: %d" +msgstr "Número total de palavras: %d" #, c-format msgid "Writing suggestion file %s ..." -msgstr "Gravando arquivo de sugestes %s ..." +msgstr "Gravando arquivo de sugestões %s ..." #, c-format msgid "Estimated runtime memory use: %d bytes" -msgstr "Consumo estimado de memria: %d bytes" +msgstr "Consumo estimado de memória: %d bytes" msgid "E751: Output file name must not have region name" -msgstr "E751: O nome do arquivo no deve conter o nome da regio" +msgstr "E751: O nome do arquivo não deve conter o nome da região" msgid "E754: Only up to 8 regions supported" -msgstr "E754: So suportadas apenas 8 regies no mximo" +msgstr "E754: São suportadas apenas 8 regiões no máximo" #, c-format msgid "E755: Invalid region in %s" -msgstr "E755: Regio invlida em %s" +msgstr "E755: Região inválida em %s" msgid "Warning: both compounding and NOBREAK specified" -msgstr "Aviso: tanto composio quanto NOBREAK foram especificados" +msgstr "Aviso: tanto composição quanto NOBREAK foram especificados" #, c-format msgid "Writing spell file %s ..." -msgstr "Gravando arquivo de verificao ortogrfica %s ..." +msgstr "Gravando arquivo de verificação ortográfica %s ..." msgid "Done!" -msgstr "Concludo!" +msgstr "Concluído!" #, c-format msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' no contm %ld elementos" +msgstr "E765: 'spellfile' não contém %ld elementos" #, c-format -msgid "Word removed from %s" -msgstr "Palavra removida de %s" +msgid "Word '%.*s' removed from %s" +msgstr "Palavra '%.*s' removida de %s" #, c-format -msgid "Word added to %s" -msgstr "Palavra adicionada a %s" +msgid "Word '%.*s' added to %s" +msgstr "Palavra '%.*s' adicionada a %s" msgid "E763: Word characters differ between spell files" -msgstr "E763: Caracteres das palavras diferem entre os arquivos ortogrficos" - -msgid "Sorry, no suggestions" -msgstr "Desculpe, no h sugestes" +msgstr "E763: Caracteres das palavras diferem entre os arquivos ortográficos" -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Desculpe, apenas %ld sugestes" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Alterar \"%.*s\" para:" +msgid "E783: duplicate char in MAP entry" +msgstr "E783: caractere duplicado na entrada MAP" -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" +msgid "No Syntax items defined for this buffer" +msgstr "Nenhum item sintático definido para este buffer" -msgid "E752: No previous spell replacement" -msgstr "E752: Nenhuma substituio ortogrfica anterior" +msgid "syntax conceal on" +msgstr "sintaxe com ocultamento ativado" -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: No encontrado: %s" +msgid "syntax conceal off" +msgstr "sintaxe com ocultamento desativado" #, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Este no parece com um arquivo .sug: %s" +msgid "E390: Illegal argument: %s" +msgstr "E390: Argumento inválido: %s" -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Arquivo .sug antigo, precisa ser atualizado: %s" +msgid "syntax case ignore" +msgstr "sintaxe insensível a maiúsculas/minúsculas" -#, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Arquivo .sug para uma verso mais nova do Vim: %s" +msgid "syntax case match" +msgstr "sintaxe sensível a maiúsculas/minúsculas" -#, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: O arquivo .sug no corresponde ao arquivo .spl: %s" +#~ msgid "syntax spell toplevel" +#~ msgstr "" -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: erro ao ler o arquivo .sug: %s" +#~ msgid "syntax spell notoplevel" +#~ msgstr "" -#. This should have been checked when generating the .spl -#. * file. -msgid "E783: duplicate char in MAP entry" -msgstr "E783: caractere duplicado na entrada MAP" +#~ msgid "syntax spell default" +#~ msgstr "" -#, c-format -msgid "E390: Illegal argument: %s" -msgstr "E390: Argumento invlido: %s" +#~ msgid "syntax iskeyword " +#~ msgstr "" #, c-format msgid "E391: No such syntax cluster: %s" -msgstr "E391: No existe o agrupamento sinttico: %s" - -msgid "No Syntax items defined for this buffer" -msgstr "Nenhum item sinttico definido para este buffer" +msgstr "E391: Não existe o agrupamento sintático: %s" msgid "syncing on C-style comments" -msgstr "sincronizao nos comentrios no estilo do C" +msgstr "sincronização nos comentários no estilo do C" msgid "no syncing" -msgstr "sem sincronizao" +msgstr "sem sincronização" msgid "syncing starts " -msgstr "sincronizao comea " +msgstr "sincronização começa " msgid " lines before top line" msgstr " linhas antes do topo da tela" @@ -5143,14 +5416,14 @@ msgid "" "--- Syntax sync items ---" msgstr "" "\n" -"--- Elementos de sincronizao da sintaxe ---" +"--- Elementos de sincronização da sintaxe ---" msgid "" "\n" "syncing on items" msgstr "" "\n" -"sincronizao sobre elementos" +"sincronização sobre elementos" msgid "" "\n" @@ -5161,13 +5434,13 @@ msgstr "" #, c-format msgid "E392: No such syntax cluster: %s" -msgstr "E392: No existe o agrupamento de sintaxe: %s" +msgstr "E392: Não existe o agrupamento de sintaxe: %s" msgid "minimal " -msgstr "mnimo " +msgstr "mínimo " msgid "maximal " -msgstr "mximo " +msgstr "máximo " msgid "; match " msgstr "; corresponder com " @@ -5176,25 +5449,32 @@ msgid " line breaks" msgstr " quebras de linha" msgid "E395: contains argument not accepted here" -msgstr "E395: o parmetro \"contains\" no aceito aqui" +msgstr "E395: o parâmetro \"contains\" não é aceito aqui" -msgid "E396: containedin argument not accepted here" -msgstr "E396: o parmetro \"containedin\" no aceito aqui" +msgid "E844: invalid cchar value" +msgstr "E844: cchar inválido" msgid "E393: group[t]here not accepted here" -msgstr "E393: o parmetro \"group[t]here\" no aceito aqui" +msgstr "E393: group[t]here não é aceito aqui" #, c-format msgid "E394: Didn't find region item for %s" -msgstr "E394: No foi encontrado um item de regio para %s" +msgstr "E394: Não foi encontrado um item de região para %s" msgid "E397: Filename required" msgstr "E397: Nome de arquivo requerido" +msgid "E847: Too many syntax includes" +msgstr "E847: Muitas inclusões de sintaxe" + #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ']' faltando: %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: caractere sobrando após ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=' faltando: %s" @@ -5203,23 +5483,26 @@ msgstr "E398: '=' faltando: %s" msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Argumentos insuficientes: syntax region %s" +msgid "E848: Too many syntax clusters" +msgstr "E848: Muitos agrupamentos sintáticos" + msgid "E400: No cluster specified" msgstr "E400: Nenhum agrupamento especificado" #, c-format msgid "E401: Pattern delimiter not found: %s" -msgstr "E401: Delimitador de padro no encontrado: %s" +msgstr "E401: Delimitador de padrão não encontrado: %s" #, c-format msgid "E402: Garbage after pattern: %s" -msgstr "E402: Caracteres indevidos aps o padro: %s" +msgstr "E402: Caracteres indevidos após o padrão: %s" msgid "E403: syntax sync: line continuations pattern specified twice" -msgstr "E403: syntax sync: padro de continuao de linha informado duas vezes" +msgstr "E403: syntax sync: padrão de continuação de linha informado duas vezes" #, c-format msgid "E404: Illegal arguments: %s" -msgstr "E404: Argumentos invlidos: %s" +msgstr "E404: Argumentos inválidos: %s" #, c-format msgid "E405: Missing equal sign: %s" @@ -5231,7 +5514,7 @@ msgstr "E406: Argumento vazio: %s" #, c-format msgid "E407: %s not allowed here" -msgstr "E407: %s no permitido aqui" +msgstr "E407: %s não é permitido aqui" #, c-format msgid "E408: %s must be first in contains list" @@ -5243,14 +5526,19 @@ msgstr "E409: Nome de grupo desconhecido: %s" #, c-format msgid "E410: Invalid :syntax subcommand: %s" -msgstr "E410: Subcomando invlido para :syntax: %s" +msgstr "E410: Subcomando inválido para :syntax: %s" + +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" TOTAL CONT. COINC. MAIS LENTO MÉDIA NOME PADRÃO" msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: loop recursivo ao carregar syncolor.vim" #, c-format msgid "E411: highlight group not found: %s" -msgstr "E411: grupo de destaque no encontrado: %s" +msgstr "E411: grupo de destaque não encontrado: %s" #, c-format msgid "E412: Not enough arguments: \":highlight link %s\"" @@ -5261,7 +5549,7 @@ msgid "E413: Too many arguments: \":highlight link %s\"" msgstr "E413: Argumentos demais: \":highlight link %s\"" msgid "E414: group has settings, highlight link ignored" -msgstr "E414: o grupo j tem suas definies; associao de destaque ignorada" +msgstr "E414: o grupo já tem suas definições; associação de destaque ignorada" #, c-format msgid "E415: unexpected equal sign: %s" @@ -5277,7 +5565,7 @@ msgstr "E417: argumento faltando: %s" #, c-format msgid "E418: Illegal value: %s" -msgstr "E418: Valor invlido: %s" +msgstr "E418: Valor inválido: %s" msgid "E419: FG color unknown" msgstr "E419: cor do texto desconhecida" @@ -5287,24 +5575,28 @@ msgstr "E420: cor de fundo desconhecida" #, c-format msgid "E421: Color name or number not recognized: %s" -msgstr "E421: Nome ou nmero de cor no reconhecido: %s" +msgstr "E421: Nome ou número de cor não reconhecido: %s" #, c-format msgid "E422: terminal code too long: %s" -msgstr "E422: cdigo de terminal longo demais: %s" +msgstr "E422: código de terminal longo demais: %s" #, c-format msgid "E423: Illegal argument: %s" -msgstr "E423: Argumento invlido: %s" +msgstr "E423: Argumento inválido: %s" msgid "E424: Too many different highlighting attributes in use" -msgstr "E424: Muitos atributos diferentes de destaque sendo usados simultaneamente" +msgstr "" +"E424: Muitos atributos diferentes de destaque sendo usados simultaneamente" msgid "E669: Unprintable character in group name" -msgstr "E669: Caractere no-imprimvel no nome do grupo" +msgstr "E669: Caractere não-imprimível no nome do grupo" msgid "W18: Invalid character in group name" -msgstr "W18: Caractere invlido no nome do grupo" +msgstr "W18: Caractere inválido no nome do grupo" + +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Muitos grupos de destaque e sintaxe" msgid "E555: at bottom of tag stack" msgstr "E555: no fim da pilha de marcadores" @@ -5313,11 +5605,11 @@ msgid "E556: at top of tag stack" msgstr "E556: no topo da pilha de marcadores" msgid "E425: Cannot go before first matching tag" -msgstr "E425: Impossvel ir para antes do primeiro marcador correspondente" +msgstr "E425: Impossível ir para antes do primeiro marcador correspondente" #, c-format msgid "E426: tag not found: %s" -msgstr "E426: marcador no encontrado: %s" +msgstr "E426: marcador não encontrado: %s" msgid " # pri kind tag" msgstr " # pri tipo marcador" @@ -5326,16 +5618,15 @@ msgid "file\n" msgstr "arquivo\n" msgid "E427: There is only one matching tag" -msgstr "E427: S h um marcador coincidente" +msgstr "E427: Só há um marcador coincidente" msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: Impossvel ir alm do ltimo marcador coincidente" +msgstr "E428: Impossível ir além do último marcador coincidente" #, c-format msgid "File \"%s\" does not exist" -msgstr "Arquivo \"%s\" no existe" +msgstr "Arquivo \"%s\" não existe" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "marcador %d de %d%s" @@ -5348,9 +5639,8 @@ msgstr " Usando etiqueta com caixa diferente!" #, c-format msgid "E429: File \"%s\" does not exist" -msgstr "E429: Arquivo \"%s\" no existe" +msgstr "E429: Arquivo \"%s\" não existe" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5366,6 +5656,9 @@ msgstr "Examinando arquivo de marcadores %s" msgid "E430: Tag file path truncated for %s\n" msgstr "E430: Caminho dos arquivos de marcadores truncado para %s\n" +msgid "Ignoring long line in tags file" +msgstr "Ignorando linha muito longa no arquivo de marcas" + #, c-format msgid "E431: Format error in tags file \"%s\"" msgstr "E431: Erro de formato no arquivo de marcadores \"%s\"" @@ -5376,48 +5669,43 @@ msgstr "Antes do byte %ld" #, c-format msgid "E432: Tags file not sorted: %s" -msgstr "E432: Arquivo de marcadores no ordenado: %s" +msgstr "E432: Arquivo de marcadores não ordenado: %s" -#. never opened any tags file msgid "E433: No tags file" -msgstr "E433: No h arquivo de marcadores" - -msgid "Ignoring long line in tags file" -msgstr "Ignorando linha muito longa no arquivo de marcas" +msgstr "E433: Não há arquivo de marcadores" msgid "E434: Can't find tag pattern" -msgstr "E434: Padro do marcador no encontrado" +msgstr "E434: Padrão do marcador não encontrado" msgid "E435: Couldn't find tag, just guessing!" -msgstr "E435: Marcador no foi encontrado, tentando adivinhar apenas!" +msgstr "E435: Marcador não foi encontrado, tentando adivinhar apenas!" #, c-format msgid "Duplicate field name: %s" msgstr "Nome de campo duplicado: %s" msgid "' not known. Available builtin terminals are:" -msgstr "' desconhecido. Os terminais incorporados disponveis so:" +msgstr "' desconhecido. Os terminais incorporados disponíveis são:" msgid "defaulting to '" -msgstr "usando por omisso '" +msgstr "usando por omissão '" msgid "E557: Cannot open termcap file" -msgstr "E557: Impossvel abrir arquivo termcap" +msgstr "E557: Impossível abrir arquivo termcap" msgid "E558: Terminal entry not found in terminfo" -msgstr "E558: Descrio do terminal no encontrada em terminfo" +msgstr "E558: Descrição do terminal não encontrada em terminfo" msgid "E559: Terminal entry not found in termcap" -msgstr "E559: Descrio do terminal no encontrada em termcap" +msgstr "E559: Descrição do terminal não encontrada em termcap" #, c-format msgid "E436: No \"%s\" entry in termcap" msgstr "E436: Nenhuma entrada \"%s\" em termcap" msgid "E437: terminal capability \"cm\" required" -msgstr "E437: necessrio o recurso de terminal \"cm\"" +msgstr "E437: é necessário o recurso de terminal \"cm\"" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5425,6 +5713,24 @@ msgstr "" "\n" "--- Teclas do terminal ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "$VIMRUNTIME/rgb.txt não pode ser aberto" + +msgid "Terminal" +msgstr "Terminal" + +msgid "Terminal-finished" +msgstr "Terminal-concluído" + +msgid "active" +msgstr "ativo" + +msgid "running" +msgstr "executando" + +msgid "finished" +msgstr "concluído" + msgid "new shell started\n" msgstr "novo shell iniciado\n" @@ -5432,96 +5738,286 @@ msgid "Vim: Error reading input, exiting...\n" msgstr "Vim: Erro ao ler a entrada; saindo...\n" msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "Foi usado CUT_BUFFER0 em vez de uma seleo vazia" +msgstr "Foi usado CUT_BUFFER0 em vez de uma seleção vazia" + +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Número de linhas alterado inesperadamente" -#. must display the prompt msgid "No undo possible; continue anyway" -msgstr "Impossvel desfazer; continuando assim mesmo" +msgstr "Impossível desfazer; continuando assim mesmo" + +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: Impossível abrir arquivo de desfazer para escrita: %s" + +#, c-format +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: Arquivo de desfazer corrompido (%s): %s" + +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "" +"Arquivo de desfazer não pode ser gravado em nenhum diretório de 'undodir'" + +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "Não será sobrescrito pelo arquivo de desfazer; ilegível: %s" + +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "Não é um arquivo de desfazer; não será sobrescrito: %s" + +msgid "Skipping undo file write, nothing to undo" +msgstr "Ignorando gravação do arquivo de desfazer; nada para desfazer" + +#, c-format +msgid "Writing undo file: %s" +msgstr "Gravando arquivo de desfazer: \"%s\"" + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: erro de escrita no arquivo de desfazer: %s" + +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "Arquivo de desfazer não lido; proprietário difere: %s" + +#, c-format +msgid "Reading undo file: %s" +msgstr "Lendo arquivo de desfazer: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: Arquivo de desfazer não pode ser aberto para leitura: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: Não é um arquivo de desfazer: %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "" +"E832: Arquivo de desfazer criptografado para arquivo não criptografado: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Falha na descriptografia do arquivo de desfazer: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: Arquivo de desfazer criptografado: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Arquivo de desfazer incompatível: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "Conteúdo do arquivo mudou; não posso usar informação de desfazer" + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Fim da leitura do arquivo de desfazer %s" + +msgid "Already at oldest change" +msgstr "Já está na alteração mais antiga" + +msgid "Already at newest change" +msgstr "Já está na alteração mais nova" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: Registro desfazer %ld não encontrado" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: números de linha errados" + +msgid "more line" +msgstr "linha a mais" + +msgid "more lines" +msgstr "linhas a mais" + +msgid "line less" +msgstr "linha a menos" + +msgid "fewer lines" +msgstr "linhas a menos" + +msgid "change" +msgstr "alteração" + +msgid "changes" +msgstr "alterações" + +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s; %s #%ld %s" + +msgid "before" +msgstr "antes de" + +msgid "after" +msgstr "após" + +msgid "Nothing to undo" +msgstr "Nada a desfazer" + +msgid "number changes when saved" +msgstr "número mudanças quando salvo" + +#, c-format +msgid "%ld seconds ago" +msgstr "%ld segundos atrás" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin não é permitido depois de desfazer" + +msgid "E439: undo list corrupt" +msgstr "E439: lista de desfazimentos corrompida" + +msgid "E440: undo line missing" +msgstr "E440: a linha para desfazer está faltando" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Função %s já existe, adicione ! para substituí-la" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Entrada do Dicionário já existente" + +msgid "E718: Funcref required" +msgstr "E718: Referência de função (Funcref) requerida" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Função desconhecida: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Argumento inválido: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Nome de argumento duplicado: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Argumentos demais para a função %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Argumentos inválidos para a função %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Profundidade de chamadas de função é maior que 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "chamando %s" + +#, c-format +msgid "%s aborted" +msgstr "%s cancelada" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s devolveu #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s devolveu %s" -msgid "Already at oldest change" -msgstr "J est na alterao mais antiga" +msgid "E699: Too many arguments" +msgstr "E699: Argumentos demais" -msgid "Already at newest change" -msgstr "J est na alterao mais nova" +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Função desconhecida: %s" #, c-format -msgid "Undo number %ld not found" -msgstr "Desfazimento n %ld no encontrado" +msgid "E933: Function was deleted: %s" +msgstr "E933: Função foi deletada: %s" -msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: nmeros de linha errados" +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Argumentos insuficientes para a função: %s" -msgid "more line" -msgstr "linha a mais" +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> usado fora de um script: %s" -msgid "more lines" -msgstr "linhas a mais" +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Função dict chamada sem um Dicionário: %s" -msgid "line less" -msgstr "linha a menos" +msgid "E129: Function name required" +msgstr "E129: Nome da função requerido" -msgid "fewer lines" -msgstr "linhas a menos" +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Nome da função deve começar com maiúscula ou \"s:\": %s" -msgid "change" -msgstr "alterao" +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Nome da função não pode conter dois-pontos: %s" -msgid "changes" -msgstr "alteraes" +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Função indefinida: %s" #, c-format -msgid "%ld %s; %s #%ld %s" -msgstr "%ld %s; %s #%ld %s" +msgid "E124: Missing '(': %s" +msgstr "E124: '(' faltando: %s" -msgid "before" -msgstr "antes de" +msgid "E862: Cannot use g: here" +msgstr "E862: g: não pode ser usado aqui" -msgid "after" -msgstr "aps" +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Função closure não deve estar no nível superior: %s" -msgid "Nothing to undo" -msgstr "Nada a desfazer" +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction faltando" -msgid "number changes time" -msgstr "nmero altera. hora" +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Texto extra após :endfunction: %s" #, c-format -msgid "%ld seconds ago" -msgstr "%ld segundos atrs" +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Nome da função em conflito com variável: %s" -msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undojoin no permitido depois de desfazer" +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Não é possível redefinir a função %s: ela está em uso" -msgid "E439: undo list corrupt" -msgstr "E439: lista de desfazimentos corrompida" +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Nome da função não coincide com o nome de arquivo do script: %s" -msgid "E440: undo line missing" -msgstr "E440: a linha para desfazer est faltando" +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Não é possível excluir a função %s: ela está em uso" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Verso grfica para MS-Windows 16/32 bits" +msgid "E133: :return not inside a function" +msgstr "E133: :return fora de uma função" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Parênteses faltando: %s" msgid "" "\n" "MS-Windows 64-bit GUI version" msgstr "" "\n" -"Verso grfica para MS-Windows 64 bits" +"Versão gráfica para MS-Windows 64 bits" msgid "" "\n" "MS-Windows 32-bit GUI version" msgstr "" "\n" -"Verso grfica para MS-Windows 32 bits" - -msgid " in Win32s mode" -msgstr " no modo Win32s" +"Versão gráfica para MS-Windows 32 bits" msgid " with OLE support" msgstr " com suporte a OLE" @@ -5531,84 +6027,56 @@ msgid "" "MS-Windows 64-bit console version" msgstr "" "\n" -"Verso console para MS-Windows 64 bits" +"Versão console para MS-Windows 64 bits" msgid "" "\n" "MS-Windows 32-bit console version" msgstr "" "\n" -"Verso console para MS-Windows 32 bits" - -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Verso para MS-Windows 16 bits" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Verso MS-DOS 32 bits" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Verso MS-DOS 16 bits" +"Versão console para MS-Windows 32 bits" msgid "" "\n" "MacOS X (unix) version" msgstr "" "\n" -"Verso MacOS X (unix)" +"Versão MacOS X (unix)" msgid "" "\n" "MacOS X version" msgstr "" "\n" -"Verso MacOS X" +"Versão MacOS X" msgid "" "\n" "MacOS version" msgstr "" "\n" -"Verso MacOS" - -msgid "" -"\n" -"RISC OS version" -msgstr "" -"\n" -"Verso RISC OS" +"Versão MacOS" msgid "" "\n" "OpenVMS version" msgstr "" "\n" -"Verso OpenVMS" +"Versão OpenVMS" msgid "" "\n" "Included patches: " msgstr "" "\n" -"Correes includas: " +"Correções incluídas: " msgid "" "\n" "Extra patches: " msgstr "" "\n" -"Correes extras:" +"Correções extras:" msgid "Modified by " msgstr "Modificado por " @@ -5628,51 +6096,48 @@ msgid "" "Huge version " msgstr "" "\n" -"Verso enorme " +"Versão enorme " msgid "" "\n" "Big version " msgstr "" "\n" -"Verso grande " +"Versão grande " msgid "" "\n" "Normal version " msgstr "" "\n" -"Verso normal " +"Versão normal " msgid "" "\n" "Small version " msgstr "" "\n" -"Verso pequena " +"Versão pequena " msgid "" "\n" "Tiny version " msgstr "" "\n" -"Verso minscula " +"Versão minúscula " msgid "without GUI." -msgstr "sem interface grfica." +msgstr "sem interface gráfica." + +msgid "with GTK3 GUI." +msgstr "com interface GTK3." msgid "with GTK2-GNOME GUI." msgstr "com interface GTK2-GNOME." -msgid "with GTK-GNOME GUI." -msgstr "com interface GTK-GNOME." - msgid "with GTK2 GUI." msgstr "com interface GTK2." -msgid "with GTK GUI." -msgstr "com interface GTK." - msgid "with X11-Motif GUI." msgstr "com interface X11-Motif." @@ -5686,7 +6151,7 @@ msgid "with Photon GUI." msgstr "com interface Photon." msgid "with GUI." -msgstr "com interface grfica." +msgstr "com interface gráfica." msgid "with Carbon GUI." msgstr "com interface Carbon." @@ -5695,79 +6160,82 @@ msgid "with Cocoa GUI." msgstr "com interface Cocoa." msgid "with (classic) GUI." -msgstr "com interface grfica (clssica)." +msgstr "com interface gráfica (clássica)." msgid " Features included (+) or not (-):\n" -msgstr " Recursos includos (+) ou no (-):\n" +msgstr " Recursos incluídos (+) ou não (-):\n" msgid " system vimrc file: \"" msgstr " arquivo vimrc de sistema: \"" msgid " user vimrc file: \"" -msgstr " arquivo vimrc do usurio: \"" +msgstr " arquivo vimrc do usuário: \"" msgid " 2nd user vimrc file: \"" -msgstr " 2 arquivo vimrc do usurio: \"" +msgstr " 2º arquivo vimrc do usuário: \"" msgid " 3rd user vimrc file: \"" -msgstr " 3 arquivo vimrc do usurio: \"" +msgstr " 3º arquivo vimrc do usuário: \"" msgid " user exrc file: \"" -msgstr " arquivo exrc do usurio: \"" +msgstr " arquivo exrc do usuário: \"" msgid " 2nd user exrc file: \"" -msgstr " 2 arquivo exrc do usurio: \"" +msgstr " 2º arquivo exrc do usuário: \"" msgid " system gvimrc file: \"" msgstr " arquivo gvimrc de sistema: \"" msgid " user gvimrc file: \"" -msgstr " arquivo gvimrc do usurio: \"" +msgstr " arquivo gvimrc do usuário: \"" msgid "2nd user gvimrc file: \"" -msgstr "2 arquivo gvimrc do usurio: \"" +msgstr "2º arquivo gvimrc do usuário: \"" msgid "3rd user gvimrc file: \"" -msgstr "3 arquivo gvimrc do usurio: \"" +msgstr "3º arquivo gvimrc do usuário: \"" + +msgid " defaults file: \"" +msgstr " arquivo de padrões: \"" msgid " system menu file: \"" msgstr " arquivo de menu do sistema: \"" msgid " fall-back for $VIM: \"" -msgstr " padro para $VIM: \"" +msgstr " padrão para $VIM: \"" msgid " f-b for $VIMRUNTIME: \"" -msgstr " padro para $VIMRUNTIME: \"" +msgstr " padrão para $VIMRUNTIME: \"" msgid "Compilation: " -msgstr "Compilao: " +msgstr "Compilação: " msgid "Compiler: " msgstr "Compilador: " msgid "Linking: " -msgstr "Vinculao: " +msgstr "Vinculação: " msgid " DEBUG BUILD" -msgstr " VERSO DE DEPURAO" +msgstr " VERSÃO DE DEPURAÇÃO" msgid "VIM - Vi IMproved" msgstr "VIM - VI Melhorado" msgid "version " -msgstr "verso " +msgstr "versão " msgid "by Bram Moolenaar et al." msgstr "por Bram Moolenaar et al." msgid "Vim is open source and freely distributable" -msgstr "Vim tem cdigo aberto e livremente distribuvel" +msgstr "Vim tem código aberto e é livremente distribuível" msgid "Help poor children in Uganda!" -msgstr "Ajude crianas pobres em Uganda!" +msgstr "Ajude crianças pobres em Uganda!" msgid "type :help iccf<Enter> for information " -msgstr "digite :help iccf<Enter> para informaes " +msgstr "digite :help iccf<Enter> para informações " msgid "type :q<Enter> to exit " msgstr "digite :q<Enter> para sair " @@ -5775,103 +6243,121 @@ msgstr "digite :q<Enter> para sair " msgid "type :help<Enter> or <F1> for on-line help" msgstr "digite :help<Enter> ou <F1> para ajuda on-line " -msgid "type :help version7<Enter> for version info" -msgstr "digite :help version7<Enter> para info da verso" +msgid "type :help version8<Enter> for version info" +msgstr "digite :help version8<Enter> para info da versão" msgid "Running in Vi compatible mode" -msgstr "Executando no modo compatvel com Vi" +msgstr "Executando no modo compatível com Vi" msgid "type :set nocp<Enter> for Vim defaults" -msgstr "digite :set nocp<Enter> para restaurar padres do Vim" +msgstr "digite :set nocp<Enter> para restaurar padrões do Vim" msgid "type :help cp-default<Enter> for info on this" -msgstr "digite :help cp-default<Enter> para informaes sobre isso" +msgstr "digite :help cp-default<Enter> para informações sobre isso" msgid "menu Help->Orphans for information " -msgstr " menu Ajuda->rfos para informaes " +msgstr " menu Ajuda->Órfãos para informações " msgid "Running modeless, typed text is inserted" -msgstr "Execuo no modal; todo texto digitado inserido" +msgstr "Execução não modal; todo texto digitado é inserido" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr " menu Editar->Opes globais->Alternar modo de insero " +msgstr " menu Editar->Opções globais->Alternar modo de inserção " msgid " for two modes " -msgstr " para voltar execuo modal " +msgstr " para voltar à execução modal " msgid "menu Edit->Global Settings->Toggle Vi Compatible" -msgstr " menu Editar->Opes globais->Alternar compatvel com Vi " +msgstr " menu Editar->Opções globais->Alternar compatível com Vi " msgid " for Vim defaults " -msgstr " para restaurar padres do Vim" +msgstr " para restaurar padrões do Vim" msgid "Sponsor Vim development!" msgstr "Patrocine o desenvolvimento do Vim!" msgid "Become a registered Vim user!" -msgstr "Torne-se um usurio registrado do Vim!" +msgstr "Torne-se um usuário registrado do Vim!" msgid "type :help sponsor<Enter> for information " -msgstr "digite :help sponsor<Enter> para informaes " +msgstr "digite :help sponsor<Enter> para informações " msgid "type :help register<Enter> for information " -msgstr "digite :help register<Enter> para informaes " +msgstr "digite :help register<Enter> para informações " msgid "menu Help->Sponsor/Register for information " -msgstr "menu Ajuda->Doar/Registrar para informaes" - -msgid "WARNING: Windows 95/98/ME detected" -msgstr "AVISO: Windows 95/98/ME detectado" - -msgid "type :help windows95<Enter> for info on this" -msgstr "digite :help windows95<Enter> para informaes sobre isso" +msgstr "menu Ajuda->Doar/Registrar para informações" msgid "Already only one window" -msgstr "J h apenas uma janela" +msgstr "Já há apenas uma janela" msgid "E441: There is no preview window" -msgstr "E441: No h janela de visualizao" +msgstr "E441: Não há janela de visualização" msgid "E442: Can't split topleft and botright at the same time" -msgstr "E442: Impossvel dividir nos cantos sup.esquerdo e inf.direito ao mesmo tempo" +msgstr "" +"E442: Impossível dividir nos cantos sup.esquerdo e inf.direito ao mesmo tempo" msgid "E443: Cannot rotate when another window is split" -msgstr "E443: Impossvel rodar quando outra janela est dividida" +msgstr "E443: Impossível rodar quando outra janela está dividida" msgid "E444: Cannot close last window" -msgstr "E444: No posso fechar a ltima janela" +msgstr "E444: Não posso fechar a última janela" msgid "E813: Cannot close autocmd window" -msgstr "E813: No possvel fechar a janela autocmd" +msgstr "E813: Não é possível fechar a janela autocmd" msgid "E814: Cannot close window, only autocmd window would remain" -msgstr "E814: No possvel fechar a janela, s restaria a janela autocmd" +msgstr "E814: Não é possível fechar a janela, só restaria a janela autocmd" msgid "E445: Other window contains changes" -msgstr "E445: Outra janela contm alteraes" +msgstr "E445: Outra janela contém alterações" msgid "E446: No file name under cursor" msgstr "E446: Nenhum nome de arquivo sob o cursor" #, c-format msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: Arquivo \"%s\" no encontrado nos caminhos de busca" +msgstr "E447: Arquivo \"%s\" não encontrado nos caminhos de busca" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID inválido: %ld (deve ser maior ou igual a 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID já atribuído: %ld" + +msgid "List or number required" +msgstr "Necessária Lista ou número" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID inválido: %ld (deve ser maior ou igual a 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID não encontrado: %ld" #, c-format msgid "E370: Could not load library %s" -msgstr "E370: No foi possvel carregar a biblioteca %s" +msgstr "E370: Não foi possível carregar a biblioteca %s" msgid "Sorry, this command is disabled: the Perl library could not be loaded." -msgstr "Desculpe, este comando est desativado: a biblioteca do Perl no pde ser carregada." +msgstr "" +"Desculpe, este comando está desativado: a biblioteca do Perl não pôde ser " +"carregada." msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -msgstr "E299: Avaliao de expresses Perl na caixa de areia proibida sem o mdulo Safe" +msgstr "" +"E299: Avaliação de expressões Perl na caixa de areia proibida sem o módulo " +"Safe" msgid "Edit with &multiple Vims" -msgstr "Editar em &mltiplos Vims" +msgstr "Editar em &múltiplos Vims" msgid "Edit with single &Vim" -msgstr "Editar com nico &Vim" +msgstr "Editar com único &Vim" msgid "Diff with Vim" msgstr "Comparar (diff) com Vim" @@ -5879,7 +6365,6 @@ msgstr "Comparar (diff) com Vim" msgid "Edit with &Vim" msgstr "Editar com &Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "Editar com Vim existente - " @@ -5887,7 +6372,7 @@ msgid "Edits the selected file(s) with Vim" msgstr "Edita o(s) arquivo(s) selecionado(s) com o Vim" msgid "Error creating process: Check if gvim is in your path!" -msgstr "Erro ao criar processo: verifique se o gvim est no caminho de busca!" +msgstr "Erro ao criar processo: verifique se o gvim está no caminho de busca!" msgid "gvimext.dll error" msgstr "erro da gvimext.dll" @@ -5898,10 +6383,6 @@ msgstr "Caminho comprido demais!" msgid "--No lines in buffer--" msgstr "--Sem linhas no buffer--" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Comando cancelado" @@ -5912,10 +6393,12 @@ msgid "E10: \\ should be followed by /, ? or &" msgstr "E10: \\ deve ser seguido de /, ? ou &" msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" -msgstr "E11: Invlido na janela da linha de comando; <CR> executa, CTRL-C sai" +msgstr "E11: Inválido na janela da linha de comando; <CR> executa, CTRL-C sai" msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" -msgstr "E12: Comando no permitido no exrc/vimrc do diretrio atual ou num arquivo de marcadores" +msgstr "" +"E12: Comando não permitido no exrc/vimrc do diretório atual ou num arquivo " +"de marcadores" msgid "E171: Missing :endif" msgstr "E171: :endif faltando" @@ -5936,7 +6419,7 @@ msgid "E588: :endfor without :for" msgstr "E588: :endfor sem :for" msgid "E13: File exists (add ! to override)" -msgstr "E13: Arquivo existe (adicione ! para forar)" +msgstr "E13: Arquivo existe (adicione ! para forçar)" msgid "E472: Command failed" msgstr "E472: Comando falhou" @@ -5951,54 +6434,58 @@ msgstr "E235: Fonte desconhecida: %s" #, c-format msgid "E236: Font \"%s\" is not fixed-width" -msgstr "E236: Fonte \"%s\" no de largura fixa" +msgstr "E236: Fonte \"%s\" não é de largura fixa" msgid "E473: Internal error" msgstr "E473: Erro interno" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Erro interno: %s" + msgid "Interrupted" msgstr "Interrompido" msgid "E14: Invalid address" -msgstr "E14: Endereo invlido" +msgstr "E14: Endereço inválido" msgid "E474: Invalid argument" -msgstr "E474: Argumento invlido" +msgstr "E474: Argumento inválido" #, c-format msgid "E475: Invalid argument: %s" -msgstr "E475: Argumento invlido: %s" +msgstr "E475: Argumento inválido: %s" #, c-format msgid "E15: Invalid expression: %s" -msgstr "E15: Expresso invlida: %s" +msgstr "E15: Expressão inválida: %s" msgid "E16: Invalid range" -msgstr "E16: Intervalo invlido" +msgstr "E16: Intervalo inválido" msgid "E476: Invalid command" -msgstr "E476: Comando invlido" +msgstr "E476: Comando inválido" #, c-format msgid "E17: \"%s\" is a directory" -msgstr "E17: \"%s\" um diretrio" +msgstr "E17: \"%s\" é um diretório" #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: Chamada biblioteca falhou para \"%s()\"" +msgstr "E364: Chamada à biblioteca falhou para \"%s()\"" #, c-format msgid "E448: Could not load library function %s" -msgstr "E448: No foi possvel carregar a funo %s de biblioteca" +msgstr "E448: Não foi possível carregar a função %s de biblioteca" msgid "E19: Mark has invalid line number" -msgstr "E19: Marca tem nmero de linha invlido" +msgstr "E19: Marca tem número de linha inválido" msgid "E20: Mark not set" -msgstr "E20: Marca no definida" +msgstr "E20: Marca não definida" msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: Impossvel fazer mudanas, 'modifiable' est desativado" +msgstr "E21: Impossível fazer mudanças, 'modifiable' está desativado" msgid "E22: Scripts nested too deep" msgstr "E22: Scripts excessivamente aninhados" @@ -6007,26 +6494,27 @@ msgid "E23: No alternate file" msgstr "E23: Nenhum arquivo alternativo" msgid "E24: No such abbreviation" -msgstr "E24: Abreviao inexistente" +msgstr "E24: Abreviação inexistente" msgid "E477: No ! allowed" -msgstr "E477: '!' no permitido" +msgstr "E477: '!' não permitido" msgid "E25: GUI cannot be used: Not enabled at compile time" -msgstr "E25: Interface grfica no pode ser usada, no foi ativada na compilao" +msgstr "" +"E25: Interface gráfica não pode ser usada, não foi ativada na compilação" msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -msgstr "E26: Hebraico no pode ser usado, no foi ativado na compilao\n" +msgstr "E26: Hebraico não pode ser usado, não foi ativado na compilação\n" msgid "E27: Farsi cannot be used: Not enabled at compile time\n" -msgstr "E27: Farsi (persa) no pode ser usado, no foi ativado na compilao\n" +msgstr "E27: Farsi (persa) não pode ser usado, não foi ativado na compilação\n" msgid "E800: Arabic cannot be used: Not enabled at compile time\n" -msgstr "E800: rabe no pode ser usado, no foi ativado na compilao\n" +msgstr "E800: Árabe não pode ser usado, não foi ativado na compilação\n" #, c-format msgid "E28: No such highlight group name: %s" -msgstr "E28: No existe grupo de destaque com tal nome: %s" +msgstr "E28: Não existe grupo de destaque com tal nome: %s" msgid "E29: No inserted text yet" msgstr "E29: Nenhum texto foi inserido ainda" @@ -6035,32 +6523,32 @@ msgid "E30: No previous command line" msgstr "E30: Nenhuma linha de comando anterior" msgid "E31: No such mapping" -msgstr "E31: Associao inexistente" +msgstr "E31: Associação inexistente" msgid "E479: No match" -msgstr "E479: Nenhuma correspondncia" +msgstr "E479: Nenhuma correspondência" #, c-format msgid "E480: No match: %s" -msgstr "E480: Nenhuma correspondncia: %s" +msgstr "E480: Nenhuma correspondência: %s" msgid "E32: No file name" msgstr "E32: Nenhum nome de arquivo" msgid "E33: No previous substitute regular expression" -msgstr "E33: Nenhuma expresso regular de substituio anterior" +msgstr "E33: Nenhuma expressão regular de substituição anterior" msgid "E34: No previous command" msgstr "E34: Nenhum comando anterior" msgid "E35: No previous regular expression" -msgstr "E35: Nenhuma expresso regular anterior" +msgstr "E35: Nenhuma expressão regular anterior" msgid "E481: No range allowed" -msgstr "E481: Intervalos no so permitidos" +msgstr "E481: Intervalos não são permitidos" msgid "E36: Not enough room" -msgstr "E36: No h espao suficiente" +msgstr "E36: Não há espaço suficiente" #, c-format msgid "E247: no registered server named \"%s\"" @@ -6068,50 +6556,47 @@ msgstr "E247: nenhum servidor registrado com o nome \"%s\"" #, c-format msgid "E482: Can't create file %s" -msgstr "E482: Impossvel criar arquivo %s" +msgstr "E482: Impossível criar arquivo %s" msgid "E483: Can't get temp file name" -msgstr "E483: Impossvel obter nome do arquivo temporrio" +msgstr "E483: Impossível obter nome do arquivo temporário" #, c-format msgid "E484: Can't open file %s" -msgstr "E484: Impossvel abrir arquivo %s" +msgstr "E484: Impossível abrir arquivo %s" #, c-format msgid "E485: Can't read file %s" -msgstr "E485: Impossvel ler arquivo %s" - -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Alteraes no foram gravadas (adicione ! para forar)" +msgstr "E485: Impossível ler arquivo %s" msgid "E38: Null argument" msgstr "E38: Argumento nulo" msgid "E39: Number expected" -msgstr "E39: Nmero era esperado" +msgstr "E39: Número era esperado" #, c-format msgid "E40: Can't open errorfile %s" -msgstr "E40: Impossvel abrir o arquivo de erros %s" +msgstr "E40: Impossível abrir o arquivo de erros %s" msgid "E233: cannot open display" -msgstr "E233: impossvel abrir display" +msgstr "E233: impossível abrir display" msgid "E41: Out of memory!" -msgstr "E41: Memria esgotada!" +msgstr "E41: Memória esgotada!" msgid "Pattern not found" -msgstr "Padro no encontrado" +msgstr "Padrão não encontrado" #, c-format msgid "E486: Pattern not found: %s" -msgstr "E486: Padro no encontrado: %s" +msgstr "E486: Padrão não encontrado: %s" msgid "E487: Argument must be positive" msgstr "E487: Argumento deve ser positivo" msgid "E459: Cannot go back to previous directory" -msgstr "E459: Impossvel voltar ao diretrio anterior" +msgstr "E459: Impossível voltar ao diretório anterior" msgid "E42: No Errors" msgstr "E42: Nenhum erro" @@ -6123,39 +6608,64 @@ msgid "E43: Damaged match string" msgstr "E43: String de busca danificada" msgid "E44: Corrupted regexp program" -msgstr "E44: Autmato de expresso regular corrompido" +msgstr "E44: Autômato de expressão regular corrompido" msgid "E45: 'readonly' option is set (add ! to override)" -msgstr "E45: opo 'readonly' est definida (adicione ! para forar)" +msgstr "E45: opção 'readonly' está definida (adicione ! para forçar)" #, c-format msgid "E46: Cannot change read-only variable \"%s\"" -msgstr "E46: Impossvel alterar varivel somente-leitura \"%s\"" +msgstr "E46: Impossível alterar variável somente-leitura \"%s\"" #, c-format msgid "E794: Cannot set variable in the sandbox: \"%s\"" -msgstr "E794: No possvel definir a varivel na caixa de areia: \"%s\"" +msgstr "E794: Não é possível definir a variável na caixa de areia: \"%s\"" + +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Impossível usar chave vazia num Dicionário" + +msgid "E715: Dictionary required" +msgstr "E715: Dicionário requerido" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: índice da lista fora dos limites: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Muitos argumentos para a função: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Chave inexistente no Dicionário: %s" + +msgid "E714: List required" +msgstr "E714: Lista requerida" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Argumento de %s deve ser uma Lista ou Dicionário" msgid "E47: Error while reading errorfile" msgstr "E47: Erro ao ler arquivo de erros" msgid "E48: Not allowed in sandbox" -msgstr "E48: Isso no permitido na caixa de areia" +msgstr "E48: Isso não é permitido na caixa de areia" msgid "E523: Not allowed here" -msgstr "E523: Isso no permitido aqui" +msgstr "E523: Isso não é permitido aqui" msgid "E359: Screen mode setting not supported" -msgstr "E359: Configurao do modo de tela no suportada" +msgstr "E359: Configuração do modo de tela não é suportada" msgid "E49: Invalid scroll size" -msgstr "E49: Tamanho de rolagem invlido" +msgstr "E49: Tamanho de rolagem inválido" msgid "E91: 'shell' option is empty" -msgstr "E91: Opo 'shell' est vazia" +msgstr "E91: Opção 'shell' está vazia" msgid "E255: Couldn't read in sign data!" -msgstr "E255: No foi possvel ler os dados dos smbolos!" +msgstr "E255: Não foi possível ler os dados dos símbolos!" msgid "E72: Close error on swap file" msgstr "E72: Erro ao fechar o arquivo de troca" @@ -6182,51 +6692,58 @@ msgid "E78: Unknown mark" msgstr "E78: Marca desconhecida" msgid "E79: Cannot expand wildcards" -msgstr "E79: Impossvel expandir os caracteres-curinga" +msgstr "E79: Impossível expandir os caracteres-curinga" msgid "E591: 'winheight' cannot be smaller than 'winminheight'" -msgstr "E591: 'winheight' no pode ser menor que 'winminheight'" +msgstr "E591: 'winheight' não pode ser menor que 'winminheight'" msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" -msgstr "E592: 'winwidth' no pode ser menor que 'winminwidth'" +msgstr "E592: 'winwidth' não pode ser menor que 'winminwidth'" msgid "E80: Error while writing" msgstr "E80: Erro na escrita" -msgid "Zero count" -msgstr "Quantificador nulo" +msgid "E939: Positive count required" +msgstr "E939: Contador positivo necessário" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> usado fora de um script" msgid "E449: Invalid expression received" -msgstr "E449: Expresso invlida recebida" +msgstr "E449: Expressão inválida recebida" msgid "E463: Region is guarded, cannot modify" -msgstr "E463: A regio protegida; impossvel modific-la" +msgstr "E463: A região é protegida; impossível modificá-la" msgid "E744: NetBeans does not allow changes in read-only files" -msgstr "E744: O NetBeans no permite alteraes em arquivos somente-leitura" - -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Erro interno: %s" +msgstr "E744: O NetBeans não permite alterações em arquivos somente-leitura" msgid "E363: pattern uses more memory than 'maxmempattern'" -msgstr "E363: padro usa mais memria que 'maxmempattern'" +msgstr "E363: padrão usa mais memória que 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: buffer vazio" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Buffer %ld não existe" + msgid "E682: Invalid search pattern or delimiter" -msgstr "E682: Padro de busca ou delimitador invlido" +msgstr "E682: Padrão de busca ou delimitador inválido" msgid "E139: File is loaded in another buffer" -msgstr "E139: O arquivo est carregado em outro buffer" +msgstr "E139: O arquivo está carregado em outro buffer" #, c-format msgid "E764: Option '%s' is not set" -msgstr "E764: Opo '%s' no est definida" +msgstr "E764: Opção '%s' não está definida" + +msgid "E850: Invalid register name" +msgstr "E850: Nome de registrador inválido" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Diretório não encontrado em '%s': \"%s\"" msgid "search hit TOP, continuing at BOTTOM" msgstr "busca atingiu TOPO; continuando do FIM" @@ -6234,3 +6751,265 @@ msgstr "busca atingiu TOPO; continuando do FIM" msgid "search hit BOTTOM, continuing at TOP" msgstr "busca atingiu FIM; continuando do TOPO" +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Necessária chave criptográfica para \"%s\"" + +msgid "empty keys are not allowed" +msgstr "chaves vazias não são permitidas" + +msgid "dictionary is locked" +msgstr "dicionário está travado" + +msgid "list is locked" +msgstr "lista está travada" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "falha ao adicionar chave '%s' ao dicionário" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "índice deve ser int ou slice, não %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "esperava instância de str() ou unicode(); recebi %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "esperava instância de bytes() ou str(); recebi %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "esperava int(), long() ou algo coercível para long(); recebi %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "esperava int() ou algo coercível para int(); recebi %s" + +msgid "value is too large to fit into C int type" +msgstr "valor muito grande para o tipo int do C" + +msgid "value is too small to fit into C int type" +msgstr "valor muito pequeno para o tipo int do C" + +msgid "number must be greater than zero" +msgstr "número deve ser maior que zero" + +msgid "number must be greater or equal to zero" +msgstr "número deve ser maior que ou igual a zero" + +msgid "can't delete OutputObject attributes" +msgstr "impossível excluir os atributos do OutputObject" + +#, c-format +msgid "invalid attribute: %s" +msgstr "atributo inválido: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Erro ao inicializar objetos de E/S" + +msgid "failed to change directory" +msgstr "falha ao mudar diretório" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "esperava 3-tupla como resultado de imp.find_module(); recebi %s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"esperava 3-tupla como resultado de imp.find_module(); recebi tupla de " +"tamanho %d" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "erro interno: imp.find_module devolveu tupla com NULL" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "impossível excluir os atributos de vim.Dictionary" + +msgid "cannot modify fixed dictionary" +msgstr "impossível modificar dicionário fixo" + +#, c-format +msgid "cannot set attribute %s" +msgstr "não foi possível definir o atributo %s" + +msgid "hashtab changed during iteration" +msgstr "tabela hash alterada durante iteração" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "" +"esperava elemento sequência de tamanho 2, mas obtive sequência de tamanho %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "construtor de lista não aceita argumentos por palavra-chave" + +msgid "list index out of range" +msgstr "índice de lista fora dos limites" + +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "erro interno: não consegui obter item %d de lista do Vim" + +msgid "slice step cannot be zero" +msgstr "passo de slice não pode ser zero" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"tentativa de atribuir sequência de tamanho maior que %d a slice estendida" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "erro interno: não existe o item %d na lista do vim" + +msgid "internal error: not enough list items" +msgstr "erro interno: não há itens suficientes na lista" + +msgid "internal error: failed to add item to list" +msgstr "erro interno: falha ao adicionar item à lista" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"tentativa de atribuir sequência de tamanho %d a slice estendida de tamanho %d" + +msgid "failed to add item to list" +msgstr "falha ao adicionar item a lista" + +msgid "cannot delete vim.List attributes" +msgstr "impossível excluir os atributos de vim.List" + +msgid "cannot modify fixed list" +msgstr "impossível modificar lista fixa" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "função anônima %s não existe" + +#, c-format +msgid "function %s does not exist" +msgstr "função %s não existe" + +#, c-format +msgid "failed to run function %s" +msgstr "falha ao executar função %s" + +msgid "unable to get option value" +msgstr "impossível obter valor da opção" + +msgid "internal error: unknown option type" +msgstr "erro interno: opção de tipo desconhecido" + +msgid "problem while switching windows" +msgstr "problema ao alternar janelas" + +#, c-format +msgid "unable to unset global option %s" +msgstr "impossível remover definição global para %s" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "impossível remover definição %s sem valor global" + +msgid "attempt to refer to deleted tab page" +msgstr "tentativa de referência a aba removida" + +msgid "no such tab page" +msgstr "aba inexistente" + +msgid "attempt to refer to deleted window" +msgstr "tentativa de referência a janela excluída" + +msgid "readonly attribute: buffer" +msgstr "atributo somente-leitura: buffer" + +msgid "cursor position outside buffer" +msgstr "cursor posicionado fora do buffer" + +msgid "no such window" +msgstr "janela inexistente" + +msgid "attempt to refer to deleted buffer" +msgstr "tentativa de referência a buffer apagado" + +msgid "failed to rename buffer" +msgstr "falha ao renomear buffer" + +msgid "mark name must be a single character" +msgstr "nome da marca deve ser um único caractere" + +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "esperava objeto vim.Buffer, mas recebi %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "falha ao alternar para buffer %d" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "esperava objeto vim.Window, mas recebi %s" + +msgid "failed to find window in the current tab page" +msgstr "não pude encontrar a janela na aba atual" + +msgid "did not switch to the specified window" +msgstr "não pude alternar para a janela especificada" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "esperava objeto vim.TabPage, mas recebi %s" + +msgid "did not switch to the specified tab page" +msgstr "não pude alternar para a aba especificada" + +msgid "failed to run the code" +msgstr "falha ao executar o código" + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval não devolveu um objeto python válido" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "" +"E859: Falha ao converter o objeto devolvido pelo python para um valor do vim" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "impossível converter %s para dicionário do vim" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "impossível converter %s para lista do vim" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "impossível converter %s para estrutura do vim" + +msgid "internal error: NULL reference passed" +msgstr "erro interno: referência NULL recebida" + +msgid "internal error: invalid value type" +msgstr "erro interno: valor de tipo inválido" + +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Falha ao definir path hook: sys.path_hooks não é uma lista\n" +"Você deve fazer o seguinte:\n" +"- adicionar vim.path_hook ao sys.path_hooks\n" +"- adicionar vim.VIM_SPECIAL_PATH ao sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Falha ao definir path: sys.path não é uma lista\n" +"Você deve adicionar vim.VIM_SPECIAL_PATH ao sys.path" diff --git a/src/po/ru.cp1251.po b/src/po/ru.cp1251.po index 8205c813db..094fab9548 100644 --- a/src/po/ru.cp1251.po +++ b/src/po/ru.cp1251.po @@ -3,20 +3,22 @@ # Vim ":help uganda" # # vassily "vr" ragosin <vrr@users.sourceforge.net>, 2004 -# Sergey Alyoshin <alyoshin.s@gmail.com>, 2013-2014 +# Sergey Alyoshin <alyoshin.s@gmail.com>, 2013-2014, 2016, 2018 # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-24 12:18+0400\n" -"PO-Revision-Date: 2014-03-24 12:18 +0400\n" +"POT-Creation-Date: 2018-04-28 21:50+0300\n" +"PO-Revision-Date: 2018-04-28 21:51+0300\n" "Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n" "Language-Team: \n" "Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=cp1251\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() " @@ -49,6 +51,12 @@ msgstr "E82: msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: , ..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: " + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: " + msgid "E515: No buffers were unloaded" msgstr "E515: " @@ -85,14 +93,9 @@ msgstr "E90: msgid "E84: No modified buffer found" msgstr "E84: " -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: " -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: %ld " - msgid "E87: Cannot go beyond last buffer" msgstr "E87: " @@ -104,6 +107,18 @@ msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" "E89: %ld ( !, )" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: ( !, )" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: ( !, )" + +msgid "E948: Job still running" +msgstr "E948: " + +msgid "E37: No write since last change" +msgstr "E37: " + msgid "W14: Warning: List of file names overflow" msgstr "W14: : " @@ -159,7 +174,6 @@ msgstr " msgid "[No Name]" msgstr "[ ]" -#. must be a help buffer msgid "help" msgstr "" @@ -185,6 +199,10 @@ msgstr "" "\n" "# :\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "" +"E382: , 'buftype' " + msgid "[Scratch]" msgstr "[]" @@ -203,8 +221,101 @@ msgstr " msgid " line=%ld id=%d name=%s" msgstr " =%ld id=%d =%s" +msgid "E902: Cannot connect to port" +msgstr "E902: " + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: " + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: " + +msgid "E904: third argument for call must be a list" +msgstr "E904: " + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): " + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s()" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: ch_evalexpr() ch_sendexpr() nl " +" raw" + +msgid "E906: not an open channel" +msgstr "E906: " + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io in_buf in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: : %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: " + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr ": , . :help 'cm'" + +msgid "Enter encryption key: " +msgstr " : " + +msgid "Enter same key again: " +msgstr " : " + +msgid "Keys don't match!" +msgstr " !" + +msgid "[crypted]" +msgstr "[]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: : %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: : \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: : %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: '}': %s" + +msgid "extend() argument" +msgstr " extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: : %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: %ld " msgid "E810: Cannot read or write temp files" @@ -260,7 +371,6 @@ msgstr "E791: msgid " Keyword completion (^N^P)" msgstr " (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -332,13 +442,12 @@ msgstr " msgid "Scanning tags." msgstr " ." +msgid "match in file" +msgstr " " + msgid " Adding" msgstr " " -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- ..." @@ -362,10 +471,6 @@ msgstr " msgid "E18: Unexpected characters in :let" msgstr "E18: :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: : %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: : %s" @@ -373,41 +478,6 @@ msgstr "E121: msgid "E111: Missing ']'" msgstr "E111: ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s " - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s " - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: " - -msgid "E714: List required" -msgstr "E714: " - -msgid "E715: Dictionary required" -msgstr "E715: " - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: : %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: %s . !, ." - -msgid "E717: Dictionary entry already exists" -msgstr "E717: " - -msgid "E718: Funcref required" -msgstr "E718: " - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: [:] " @@ -415,10 +485,6 @@ msgstr "E719: msgid "E734: Wrong variable type for %s=" msgstr "E734: %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: : %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: : %s" @@ -457,38 +523,20 @@ msgstr "E711: msgid "E690: Missing \"in\" after :for" msgstr "E690: \"in\" :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: : %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: : \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: () %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: ()" msgid "E109: Missing ':' after '?'" msgstr "E109: ':' '?'" -msgid "E691: Can only compare List with List" -msgstr "E691: " - -msgid "E692: Invalid operation for List" -msgstr "E692: " - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: " - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: " - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: " - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: " - msgid "E804: Cannot use '%' with Float" msgstr "E804: '%' " @@ -498,6 +546,9 @@ msgstr "E110: msgid "E695: Cannot index a Funcref" msgstr "E695: " +msgid "E909: Cannot index a special variable" +msgstr "E909: " + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: : %s" @@ -514,83 +565,119 @@ msgstr "E114: msgid "E115: Missing quote: %s" msgstr "E115: : %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: : %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr " , !" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: ']': %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: " -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: : %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: " -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: : \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: " -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: : %s" +msgid "E745: Using a List as a Number" +msgstr "E745: " -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: " -msgid "E724: variable nested too deep for displaying" -msgstr "E724: " +msgid "E910: Using a Job as a Number" +msgstr "E910: " -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: " + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: " + +msgid "E892: Using a String as a Float" +msgstr "E892: " + +msgid "E893: Using a List as a Float" +msgstr "E893: " + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: " + +msgid "E907: Using a special value as a Float" +msgstr "E907: " + +msgid "E911: Using a Job as a Float" +msgstr "E911: " + +msgid "E914: Using a Channel as a Float" +msgstr "E914: " + +msgid "E729: using Funcref as a String" +msgstr "E729: " + +msgid "E730: using List as a String" +msgstr "E730: " + +msgid "E731: using Dictionary as a String" +msgstr "E731: " + +msgid "E908: using an invalid value as a String" +msgstr "E908: " #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: %s " +msgid "E795: Cannot delete variable %s" +msgstr "E795: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: : %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "" +"E704: : " +"%s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: : %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> : %s" +msgid "E741: Value is locked: %s" +msgstr "E741: %s " + +msgid "Unknown" +msgstr "" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: dict : %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s" -msgid "E808: Number or Float required" -msgstr "E808: " +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: " -msgid "add() argument" -msgstr " add()" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# :\n" -msgid "E699: Too many arguments" -msgstr "E699: " +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\t " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() " +msgid "E691: Can only compare List with List" +msgstr "E691: " -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E692: Invalid operation for List" +msgstr "E692: " -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: : %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: " -msgid "extend() argument" -msgstr " extend()" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: " + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: " msgid "map() argument" msgstr " map()" @@ -599,13 +686,41 @@ msgid "filter() argument" msgstr " filter()" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld : " +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s " + +msgid "E928: String required" +msgstr "E928: " + +msgid "E808: Number or Float required" +msgstr "E808: " + +msgid "add() argument" +msgstr " add()" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() " + +msgid "&Ok" +msgstr "&Ok" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld : " +msgstr[1] "+-%s%3ld : " +msgstr[2] "+-%s%3ld : " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: : %s" +msgid "E922: expected a dict" +msgstr "E922: " + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: () " + msgid "" "&OK\n" "&Cancel" @@ -622,206 +737,106 @@ msgstr " msgid "E786: Range not allowed" msgstr "E786: " +msgid "E916: not a valid job" +msgstr "E916: " + msgid "E701: Invalid type for len()" msgstr "E701: len()" -msgid "E726: Stride is zero" -msgstr "E726: " - -msgid "E727: Start past end" -msgstr "E727: " - -msgid "<empty>" -msgstr "<>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Vim" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: %s" - -msgid "E277: Unable to read a server reply" -msgstr "E277: " - -msgid "remove() argument" -msgstr " remove()" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: (?)" - -msgid "reverse() argument" -msgstr " reverse()" - -msgid "E258: Unable to send to client" -msgstr "E258: " - -msgid "sort() argument" -msgstr " sort()" - -msgid "E702: Sort compare function failed" -msgstr "E702: " - -msgid "(Invalid)" -msgstr "()" - -msgid "E677: Error writing temp file" -msgstr "E677: " - -msgid "E805: Using a Float as a Number" -msgstr "E805: " - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: " - -msgid "E745: Using a List as a Number" -msgstr "E745: " - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: " - -msgid "E729: using Funcref as a String" -msgstr "E729: " - -msgid "E730: using List as a String" -msgstr "E730: " - -msgid "E731: using Dictionary as a String" -msgstr "E731: " - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: : %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "" -"E704: : " -"%s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: : %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: %s " - -msgid "Unknown" -msgstr "" - #, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID \":match\": %ld" -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: " +msgid "E726: Stride is zero" +msgstr "E726: " -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: : %s" +msgid "E727: Start past end" +msgstr "E727: " -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(': %s" +msgid "<empty>" +msgstr "<>" -msgid "E862: Cannot use g: here" -msgstr "E862: g:" +msgid "E240: No connection to the X server" +msgstr "E240: X-" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: : %s" +msgid "E241: Unable to send to %s" +msgstr "E241: %s" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: : %s" +msgid "E277: Unable to read a server reply" +msgstr "E277: " -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction" +msgid "E941: already started a server" +msgstr "E941: " -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: : %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver " -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: %s, " +msgid "remove() argument" +msgstr " remove()" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: : %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: (?)" -msgid "E129: Function name required" -msgstr "E129: " +msgid "reverse() argument" +msgstr " reverse()" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: " -": %s" +msgid "E258: Unable to send to client" +msgstr "E258: " #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: %s, " +msgid "E927: Invalid action: '%s'" +msgstr "E927: : '%s'" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: , 'maxfuncdepth'" +msgid "sort() argument" +msgstr " sort()" -#, c-format -msgid "calling %s" -msgstr " %s" +msgid "uniq() argument" +msgstr " uniq()" -#, c-format -msgid "%s aborted" -msgstr "%s " +msgid "E702: Sort compare function failed" +msgstr "E702: " -#, c-format -msgid "%s returning #%ld" -msgstr "%s #%ld" +msgid "E882: Uniq compare function failed" +msgstr "" +"E882: " -#, c-format -msgid "%s returning %s" -msgstr "%s %s" +msgid "(Invalid)" +msgstr "()" #, c-format -msgid "continuing in %s" -msgstr " %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return " +msgid "E935: invalid submatch number: %d" +msgstr "E935: : %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# :\n" +msgid "E677: Error writing temp file" +msgstr "E677: " -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\t " +msgid "E921: Invalid callback argument" +msgstr "E921: " -msgid "No old files" -msgstr " " +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, %02x, %03o, %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, %02x, %03o" + +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, %04x, %o, %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, %08x, %o, %s" #, c-format msgid "> %d, Hex %04x, Octal %o" -msgstr "> %d, Hex %04x, Octal %o" +msgstr "> %d, %04x, %o" #, c-format msgid "> %d, Hex %08x, Octal %o" -msgstr "> %d, Hex %08x, Octal %o" +msgstr "> %d, %08x, %o" msgid "E134: Move lines into themselves" msgstr "E134: " @@ -867,11 +882,14 @@ msgstr " msgid " FAILED" msgstr " " -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: viminfo : %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: viminfo, %s" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: viminfo %s!" @@ -880,7 +898,10 @@ msgstr "E138: msgid "Writing viminfo file \"%s\"" msgstr " viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo %s!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# viminfo Vim %s.\n" @@ -898,6 +919,13 @@ msgstr "# msgid "Illegal starting char" msgstr " " +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# '|', :\n" + msgid "Save As" msgstr " " @@ -987,14 +1015,14 @@ msgid "%ld substitutions" msgstr "%ld " msgid " on 1 line" -msgstr " " +msgstr " 1 ." #, c-format msgid " on %ld lines" msgstr " %ld ." -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global " +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global " msgid "E148: Regular expression missing from global" msgstr "E148: :global " @@ -1032,8 +1060,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr ", \"%s\" " #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: %s " +msgid "E151: No match: %s" +msgstr "E151: : %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1051,6 +1079,10 @@ msgstr "E670: msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: \"%s\" %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: %s " + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: %s" @@ -1076,10 +1108,17 @@ msgstr "E159: msgid "E158: Invalid buffer name: %s" msgstr "E158: : %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: " + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID : %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: %s" + msgid " (NOT FOUND)" msgstr " ( )" @@ -1089,9 +1128,20 @@ msgstr " ( msgid "[Deleted]" msgstr "[]" +msgid "No old files" +msgstr " " + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr " . \"cont\"" +#, c-format +msgid "Oldval = \"%s\"" +msgstr ".. = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr ".. = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr " %ld: %s" @@ -1100,6 +1150,13 @@ msgstr " msgid "cmd: %s" msgstr ": %s" +msgid "frame is zero" +msgstr " " + +#, c-format +msgid "frame at highest level: %d" +msgstr " : %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr " \"%s%s\" . %ld" @@ -1115,6 +1172,10 @@ msgstr " msgid "%3d %s %s line %ld" msgstr "%3d %s %s . %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d . %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: \":profile start {-}\"" @@ -1122,8 +1183,9 @@ msgstr "E750: msgid "Save changes to \"%s\"?" msgstr " \"%s\"?" -msgid "Untitled" -msgstr " " +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1155,8 +1217,18 @@ msgid "Searching for \"%s\"" msgstr " \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr " 'runtimepath': \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr " '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "" +"W20: python 2.x, : %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "" +"W21: python 3.x, : %s" msgid "Source Vim script" msgstr " Vim" @@ -1185,6 +1257,10 @@ msgstr " msgid "finished sourcing %s" msgstr " %s " +#, c-format +msgid "continuing in %s" +msgstr " %s" + msgid "modeline" msgstr " " @@ -1252,12 +1328,12 @@ msgstr " msgid "E494: Use w or w>>" msgstr "E494: w w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: , 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: , " -msgid "E172: Only one file name allowed" -msgstr "E172: " - msgid "1 more file to edit. Quit anyway?" msgstr "1 . ?" @@ -1277,10 +1353,10 @@ msgstr "E174: msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" . . . " +" . . . " msgid "No user-defined commands found" msgstr ", , ." @@ -1300,6 +1376,9 @@ msgstr "E178: msgid "E179: argument required for -complete" msgstr "E179: -complete " +msgid "E179: argument required for -addr" +msgstr "E179: -addr " + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: : %s" @@ -1318,6 +1397,10 @@ msgstr "" msgid "E184: No such user-defined command: %s" msgstr "E184: : %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: : %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: : %s" @@ -1382,6 +1465,9 @@ msgstr "E188: msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos " +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: :redir execute()" + msgid "Save Redirection" msgstr " " @@ -1406,7 +1492,6 @@ msgstr "E189: \"%s\" msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: \"%s\"" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: / " @@ -1444,6 +1529,9 @@ msgstr "E500: msgid "E195: Cannot open viminfo file for reading" msgstr "E195: viminfo " +msgid "Untitled" +msgstr " " + msgid "E196: No digraphs in this version" msgstr "E196: " @@ -1451,7 +1539,6 @@ msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "" "E608: :throw 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr " : %s" @@ -1468,7 +1555,6 @@ msgstr " msgid "%s, line %ld" msgstr "%s, %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr " : %s" @@ -1494,7 +1580,6 @@ msgstr " msgid "Error" msgstr "" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "" @@ -1537,15 +1622,12 @@ msgstr "E601: msgid "E603: :catch without :try" msgstr "E603: :catch :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch :finally" msgid "E606: :finally without :try" msgstr "E606: :finally :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: :finally" @@ -1590,6 +1672,9 @@ msgstr " msgid "Input Line" msgstr " " +msgid "Debug Line" +msgstr " " + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar " @@ -1635,7 +1720,6 @@ msgstr "Vim: msgid "Reading from stdin..." msgstr " stdin..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: !" @@ -1663,12 +1747,6 @@ msgstr "[ msgid "[converted]" msgstr "[]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ %ld]" @@ -1689,9 +1767,6 @@ msgstr " msgid "can't read output of 'charconvert'" msgstr " 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: " - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwrite" @@ -1737,9 +1812,6 @@ msgid "E510: Can't make backup file (add ! to override)" msgstr "" "E510: ( !, )" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: ( !, )" - msgid "E214: Can't find temp file for writing" msgstr "E214: " @@ -1748,13 +1820,13 @@ msgstr "" "E213: ( ! )" msgid "E166: Can't open linked file for writing" -msgstr "E166: " +msgstr "E166: " msgid "E212: Can't open file for writing" msgstr "E212: " -msgid "E667: Fsync failed" -msgstr "E667: fsync()" +msgid "E949: File changed while writing" +msgstr "E949: " msgid "E512: Close failed" msgstr "E512: " @@ -1852,20 +1924,12 @@ msgstr "1 msgid "%lld characters" msgstr ": %lld" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr ": %ld" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[ ]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr ": !!!" @@ -1949,11 +2013,16 @@ msgstr "-- msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "- : %s <=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: \"%s\" " +msgid "E936: Cannot delete the current group" +msgstr "E936: " + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: " + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: *: %s" @@ -1966,7 +2035,6 @@ msgstr "E216: msgid "E216: No such group or event: %s" msgstr "E216: : %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2017,8 +2085,11 @@ msgstr "" "E351: 'foldmethod'" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld " +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld " +msgstr[1] "+--%3ld " +msgstr[2] "+--%3ld " msgid "E222: Add to read buffer" msgstr "E222: " @@ -2114,6 +2185,18 @@ msgstr "" "E232: \"\" , , , " " " +msgid "_Cancel" +msgstr "_" + +msgid "_Save" +msgstr " _" + +msgid "_Open" +msgstr "_" + +msgid "_OK" +msgstr "_" + msgid "" "&Yes\n" "&No\n" @@ -2123,8 +2206,14 @@ msgstr "" "&\n" "&" +msgid "Yes" +msgstr "" + +msgid "No" +msgstr "" + msgid "Input _Methods" -msgstr " " +msgstr "_ " msgid "VIM - Search and Replace..." msgstr "VIM ..." @@ -2133,46 +2222,43 @@ msgid "VIM - Search..." msgstr "VIM ..." msgid "Find what:" -msgstr " :" +msgstr " :" msgid "Replace with:" -msgstr " :" +msgstr " :" -#. whole word only button msgid "Match whole word only" msgstr " " -#. match case button msgid "Match case" -msgstr " " +msgstr " " msgid "Direction" msgstr "" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "" msgid "Down" msgstr "" -#. 'Find Next' button msgid "Find Next" msgstr " " -#. 'Replace' button msgid "Replace" -msgstr "" +msgstr "" -#. 'Replace All' button msgid "Replace All" msgstr " " +msgid "_Close" +msgstr "_" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: \n" -msgid "Close" -msgstr "" +msgid "Close tab" +msgstr " " msgid "New tab" msgstr " " @@ -2219,20 +2305,6 @@ msgstr " msgid "&Undo" msgstr "&" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: \"%s\" " - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: : \"-%s\"; OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDI" - -msgid "Close tab" -msgstr " " - msgid "Open tab..." msgstr " ..." @@ -2242,14 +2314,23 @@ msgstr " msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr " ( '\\\\' '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr " " msgid "Directory\t*.nothing\n" msgstr "\t*.\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: \"%s\" " + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: : \"-%s\"; OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: , " @@ -2306,7 +2387,6 @@ msgstr "Vim msgid "Name:" msgstr ":" -#. create toggle button msgid "Show size in Points" msgstr " " @@ -2512,6 +2592,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2522,6 +2603,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: \n" " c: \n" " d: \n" " e: egrep\n" @@ -2536,7 +2618,7 @@ msgid "E625: cannot open cscope database: %s" msgstr "E625: cscope: %s" msgid "E626: cannot get cscope database information" -msgstr "E626: cscope " +msgstr "E626: cscope " msgid "E568: duplicate cscope database not added" msgstr "E568: cscope " @@ -2549,7 +2631,6 @@ msgstr "E261: msgid "cscope connection %s closed" msgstr " cscope %s " -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: cs_manage_matches" @@ -2591,7 +2672,14 @@ msgid "" "loaded." msgstr "" "E815: , " -"MzScheme" +"MzScheme." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: , " +"racket/base MzScheme." msgid "invalid expression" msgstr " " @@ -2654,131 +2742,49 @@ msgstr "" "E263: , " "Python" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: , " +"Python site." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Python" msgid "E837: This Vim cannot execute :py3 after using :python" msgstr "E837: Vim :py3 :python" -msgid "E265: $_ must be an instance of String" -msgstr "E265: $_ " - -msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: , " -"Ruby" - -msgid "E267: unexpected return" -msgstr "E267: return" - -msgid "E268: unexpected next" -msgstr "E268: next" - -msgid "E269: unexpected break" -msgstr "E269: break" - -msgid "E270: unexpected redo" -msgstr "E270: redo" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: retry rescue" - -msgid "E272: unhandled exception" -msgstr "E272: " - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: longjmp %d" - -msgid "Toggle implementation/definition" -msgstr " /" - -msgid "Show base class of" -msgstr " " - -msgid "Show overridden member function" -msgstr " " - -msgid "Retrieve from file" -msgstr " " - -msgid "Retrieve from project" -msgstr " " - -msgid "Retrieve from all projects" -msgstr " " - -msgid "Retrieve" -msgstr "" - -msgid "Show source of" -msgstr " " - -msgid "Find symbol" -msgstr " " - -msgid "Browse class" -msgstr " " - -msgid "Show class in hierarchy" -msgstr " " - -msgid "Show class in restricted hierarchy" -msgstr " " - -msgid "Xref refers to" -msgstr "Xref " - -msgid "Xref referred by" -msgstr " xref " - -msgid "Xref has a" -msgstr "Xref " - -msgid "Xref used by" -msgstr "Xref " - -msgid "Show docu of" -msgstr " docu" - -msgid "Generate docu for" -msgstr " docu" +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ " msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -" SNiFF+. ." -"(sniffemacs $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: . " - -msgid "SNiFF+ is currently " -msgstr " SNiFF+ " +"E266: , " +"Ruby" -msgid "not " -msgstr " " +msgid "E267: unexpected return" +msgstr "E267: return" -msgid "connected" -msgstr "" +msgid "E268: unexpected next" +msgstr "E268: next" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: SNiFF+: %s" +msgid "E269: unexpected break" +msgstr "E269: break" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: SNiFF+" +msgid "E270: unexpected redo" +msgstr "E270: redo" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ " +msgid "E271: retry outside of rescue clause" +msgstr "E271: retry rescue" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SNiFF+" +msgid "E272: unhandled exception" +msgstr "E272: " -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: . " +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: longjmp %d" msgid "invalid buffer number" msgstr " " @@ -2786,7 +2792,6 @@ msgstr " msgid "not implemented yet" msgstr " " -#. ??? msgid "cannot set line(s)" msgstr " " @@ -2827,7 +2832,6 @@ msgstr "" " : " " " -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2868,6 +2872,18 @@ msgstr "" "E251: VIM . " "!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: : %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: ']': %s" + msgid "Unknown option argument" msgstr " " @@ -2894,13 +2910,13 @@ msgstr " msgid "netbeans is not supported with this GUI\n" msgstr "NetBeans \n" +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr " '-nb': \n" + msgid "This Vim was not compiled with the diff feature." msgstr "" " Vim " -msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr " '-nb': \n" - msgid "Attempt to open script file again: \"" msgstr " : \"" @@ -2913,13 +2929,15 @@ msgstr " msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: : gvim NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: : Vim Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: : \n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: : \n" -#. just in case.. msgid "pre-vimrc command line" msgstr " vimrc" @@ -3083,6 +3101,12 @@ msgstr "-F\t\t\t msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <>\t <>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\t / " + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\t / " + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t <vimrc> .vimrc" @@ -3141,7 +3165,7 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\t " msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <>\t VIM X-" +msgstr "-display <>\t Vim X-" msgid "-X\t\t\tDo not connect to X server" msgstr "-X\t\t\t X" @@ -3186,6 +3210,11 @@ msgstr "--startuptime < msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\t .viminfo <viminfo>" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "" +"--clean\t\t Vi, Vim ,\n" +"\t\t\t\t , viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h --help\t ( ) " @@ -3214,21 +3243,19 @@ msgstr "" " gvim ( Athena):\n" msgid "-display <display>\tRun vim on <display>" -msgstr "-display <>\t VIM <>" +msgstr "-display <>\t Vim <>" msgid "-iconic\t\tStart vim iconified" -msgstr "-iconic\t\t VIM " +msgstr "-iconic\t\t Vim " msgid "-background <color>\tUse <color> for the background (also: -bg)" -msgstr "" -"-background <>\t <> (: -bg)" +msgstr "-background <>\t <> ( -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" -msgstr "" -"-foreground <>\t <> (: -fg)" +msgstr "-foreground <>\t <> ( -fg)" msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" -msgstr "-font <>\t\t <> (: -fn)" +msgstr "-font <>\t <> ( -fn)" msgid "-boldfont <font>\tUse <font> for bold text" msgstr "-boldfont <>\t <> " @@ -3237,24 +3264,23 @@ msgid "-italicfont <font>\tUse <font> for italic text" msgstr "-italicfont <>\t <> " msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" -msgstr "" -"-geometry <>\t <> (: -geom)" +msgstr "-geometry <>\t <> ( -geom)" msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" -msgstr "-borderwidth <>\t <> (: -bw)" +msgstr "-borderwidth <>\t <> ( -bw)" msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" msgstr "" -"-scrollbarwidth <> (: -sw)" +"-scrollbarwidth <> ( -sw)" msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" -msgstr "-menuheight <>\t <> (: -mh)" +msgstr "-menuheight <>\t <> ( -mh)" msgid "-reverse\t\tUse reverse video (also: -rv)" -msgstr "-reverse\t\t (: -rv)" +msgstr "-reverse\t\t ( -rv)" msgid "+reverse\t\tDon't use reverse video (also: +rv)" -msgstr "+reverse\t\t (: +rv)" +msgstr "+reverse\t\t ( +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <>\t <>" @@ -3268,11 +3294,12 @@ msgstr "" msgid "-display <display>\tRun vim on <display> (also: --display)" msgstr "" -"-display <>\t VIM <> (: --display)" +"-display <>\t Vim <> ( --display)" msgid "--role <role>\tSet a unique role to identify the main window" msgstr "" -"--role <>\t <> " +"--role <>\t <>\n" +"\t\t\t\t " msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\t Vim GTK" @@ -3289,11 +3316,9 @@ msgstr "--windowid <HWND>\t msgid "No display" msgstr " " -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": .\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": . \n" @@ -3314,7 +3339,6 @@ msgstr " msgid "E283: No marks matching \"%s\"" msgstr "E283: , \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3322,7 +3346,6 @@ msgstr "" "\n" " /" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3330,7 +3353,6 @@ msgstr "" "\n" " /" -#. Highlight title msgid "" "\n" "change line col text" @@ -3345,7 +3367,6 @@ msgstr "" "\n" "# :\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3418,7 +3439,6 @@ msgstr "E298: msgid "E843: Error while updating swap file crypt" msgstr "E843: -" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: , -!!!" @@ -3603,7 +3623,6 @@ msgstr "" msgid "Using crypt key from swap file for the text file.\n" msgstr " - .\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr " -:" @@ -3774,24 +3793,17 @@ msgstr " msgid " NEWER than swap file!\n" msgstr " , -!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) , .\n" " , , \n" -" ." - -# , " \n" .. . -msgid " Quit, or continue with caution.\n" -msgstr "" -" \n" -" .\n" +" .\n" +" .\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) .\n" @@ -3869,7 +3881,6 @@ msgstr "E328: msgid "E329: No menu \"%s\"" msgstr "E329: %s" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: " @@ -3882,8 +3893,6 @@ msgstr "E331: msgid "E332: Separator cannot be part of a menu path" msgstr "E332: " -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3894,6 +3903,10 @@ msgstr "" msgid "Tear off this menu" msgstr " " +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: %s" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: " @@ -3901,10 +3914,6 @@ msgstr "E333: msgid "E334: Menu not found: %s" msgstr "E334: : %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: %s" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: " @@ -3976,7 +3985,6 @@ msgstr " msgid "Open File dialog" msgstr " " -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "" "E338: , " @@ -4068,15 +4076,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: " -msgid "Enter encryption key: " -msgstr " : " - -msgid "Enter same key again: " -msgstr " : " - -msgid "Keys don't match!" -msgstr " !" - msgid "E854: path too long for completion" msgstr "E854: " @@ -4104,20 +4103,11 @@ msgstr "E346: msgid "E347: No more file \"%s\" found in path" msgstr "E347: \"%s\"" -msgid "Cannot connect to Netbeans #2" -msgstr " NetBeans #2" - -msgid "Cannot connect to Netbeans" -msgstr " NetBeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: NetBeans: \"%s\"" -msgid "read from Netbeans socket" -msgstr " NetBeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: NetBeans %ld" @@ -4139,7 +4129,7 @@ msgid "E774: 'operatorfunc' is empty" msgstr "E774: 'operatorfunc' " msgid "E775: Eval feature not available" -msgstr "E775: eval " +msgstr "E775: eval " msgid "Warning: terminal cannot highlight" msgstr ": " @@ -4160,8 +4150,9 @@ msgstr "E662: msgid "E663: At end of changelist" msgstr "E663: " -msgid "Type :quit<Enter> to exit Vim" -msgstr " :quit<Enter> Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +" :qa! <Enter> Vim" #, c-format msgid "1 line %sed 1 time" @@ -4193,7 +4184,6 @@ msgstr " msgid "E748: No previously used register" msgstr "E748: " -#. must display the prompt msgid "cannot yank; delete anyway" msgstr " , " @@ -4208,25 +4198,30 @@ msgstr " msgid "freeing %ld lines" msgstr " : %ld" -msgid "block of 1 line yanked" -msgstr " " +#, c-format +msgid " into \"%c" +msgstr " \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr " %s" -msgid "1 line yanked" -msgstr " " +#, c-format +msgid "1 line yanked%s" +msgstr " %s" #, c-format -msgid "block of %ld lines yanked" -msgstr " : %ld" +msgid "block of %ld lines yanked%s" +msgstr " %ld %s" #, c-format -msgid "%ld lines yanked" -msgstr " : %ld" +msgid "%ld lines yanked%s" +msgstr " %ld %s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: %s " -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4248,40 +4243,44 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: " +"" + #, c-format msgid "%ld Cols; " msgstr ": %ld; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr " %s%ld %ld ; %ld %ld ; %ld %ld " +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr " %s%ld %ld ; %lld %lld ; %lld %lld " #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -" %s%ld %ld .; %ld %ld ; %ld %ld .; %ld %ld " -"" +" %s%ld %ld .; %lld %lld ; %lld %lld .; %lld " +"%lld " #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr ". %s %s; . %ld %ld; . %ld %ld; %ld %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr ". %s %s; . %ld %ld; . %lld %lld; %lld %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -". %s %s; . %ld %ld; . %ld %ld; . %ld %ld; %ld " -" %ld" +". %s %s; . %ld %ld; . %lld %lld; . %lld %lld; " +"%lld %lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=. %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld BOM)" msgid "Thanks for flying Vim" msgstr " Vim" @@ -4308,6 +4307,10 @@ msgstr "E522: msgid "E539: Illegal character <%s>" msgstr "E539: <%s>" +#, c-format +msgid "For option %s" +msgstr " %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term' " @@ -4329,6 +4332,10 @@ msgstr "E835: msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: GTK+ 2" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: %s %s" + msgid "E524: Missing colon" msgstr "E524: " @@ -4388,6 +4395,9 @@ msgstr "E541: msgid "E542: unbalanced groups" msgstr "E542: " +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: " + msgid "E590: A preview window already exists" msgstr "E590: " @@ -4395,6 +4405,9 @@ msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "" "W17: UTF-8, ':set encoding=utf-8'" +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24 " + #, c-format msgid "E593: Need at least %d lines" msgstr "E593: %d " @@ -4407,9 +4420,6 @@ msgstr "E594: msgid "E355: Unknown option: %s" msgstr "E355: : %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: : &%s = '%s'" @@ -4433,7 +4443,7 @@ msgid "" "--- Local option values ---" msgstr "" "\n" -"--- ---" +"--- ---" msgid "" "\n" @@ -4482,7 +4492,6 @@ msgstr " msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: ??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: -f" @@ -4504,9 +4513,6 @@ msgstr " msgid "Message" msgstr "" -msgid "'columns' is not 80, cannot execute external commands" -msgstr " 'columns' 80, " - msgid "E237: Printer selection failed" msgstr "E237: " @@ -4530,6 +4536,10 @@ msgstr " msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: \"%s\" \"%s\"" +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: \"%s\" \"%s\"" + #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: '%c' \"%s\"" @@ -4565,12 +4575,13 @@ msgstr "" "\n" " " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -" " +#, c-format +msgid "Could not set security context %s for %s" +msgstr " %s %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr " %s %s. !" msgid "" "\n" @@ -4600,6 +4611,13 @@ msgstr "" "\n" " fork()\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +" " + msgid "" "\n" "Command terminated\n" @@ -4642,10 +4660,6 @@ msgstr " msgid "Could not fix up function pointers to the DLL!" msgstr " DLL!" -#, c-format -msgid "shell returned %d" -msgstr " %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: %s\n" @@ -4674,6 +4688,13 @@ msgstr "" msgid "Vim Warning" msgstr " Vim" +#, c-format +msgid "shell returned %d" +msgstr " %d" + +msgid "E926: Current location list was changed" +msgstr "E926: " + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: %%%c" @@ -4706,6 +4727,12 @@ msgstr "E379: msgid "E553: No more items" msgstr "E553: " +msgid "E924: Current window was closed" +msgstr "E924: " + +msgid "E925: Current quickfix was changed" +msgstr "E925: " + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d %d)%s%s: " @@ -4713,19 +4740,18 @@ msgstr "(%d msgid " (line deleted)" msgstr " ( )" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s %d %d; %d " + msgid "E380: At bottom of quickfix stack" msgstr "E380: " msgid "E381: At top of quickfix stack" msgstr "E381: " -#, c-format -msgid "error list %d of %d; %d errors" -msgstr " %d %d; %d " - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "" -"E382: , 'buftype' " +msgid "No entries" +msgstr " " msgid "Error file" msgstr " " @@ -4751,6 +4777,12 @@ msgstr "E369: msgid "E769: Missing ] after %s[" msgstr "E769: ] %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: " + +msgid "E945: Range too large in character class" +msgstr "E945: " + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: %s%%(" @@ -4777,6 +4809,9 @@ msgstr "E69: msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[]" +msgid "E65: Illegal back reference" +msgstr "E65: " + msgid "E339: Pattern too long" msgstr "E339: " @@ -4813,9 +4848,6 @@ msgstr "E63: msgid "E64: %s%c follows nothing" msgstr "E64: %s%c " -msgid "E65: Illegal back reference" -msgstr "E65: " - msgid "E68: Invalid character after \\z" msgstr "E68: \\z" @@ -4834,6 +4866,10 @@ msgstr "E554: msgid "External submatches:\n" msgstr " :\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (. ) %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -4841,6 +4877,9 @@ msgstr "" "E864: \\%#= 0, 1 2. " " " +msgid "Switching to backtracking RE engine for pattern: " +msgstr " . : " + msgid "E865: (NFA) Regexp end encountered prematurely" msgstr "E865: () " @@ -4856,11 +4895,13 @@ msgstr "E877: ( msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: () '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% " + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: () '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: !" @@ -4871,11 +4912,9 @@ msgstr "E869: ( msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (. ) " -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (. ) !" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (. ) '('" @@ -4940,9 +4979,6 @@ msgstr " msgid " Arabic" msgstr " " -msgid " (lang)" -msgstr " ()" - msgid " (paste)" msgstr " ()" @@ -4985,7 +5021,6 @@ msgstr "E386: msgid " (includes previously listed match)" msgstr " ( )" -#. cursor at status line msgid "--- Included files " msgstr "--- " @@ -5037,8 +5072,49 @@ msgstr "" "# %s :\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: " +msgid "E756: Spell checking is not enabled" +msgstr "E756: " + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +": \"%s_%s.spl\" \"%s_ascii.spl" +"\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +": \"%s.%s.spl\" \"%s.ascii.spl" +"\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing" + +#, c-format +msgid "Warning: region %s not supported" +msgstr ": %s " + +msgid "Sorry, no suggestions" +msgstr ", " + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr ", %ld " + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr " \"%.*s\" :" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: " + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: : %s" msgid "E758: Truncated spell file" msgstr "E758: " @@ -5060,21 +5136,6 @@ msgstr "E762: msgid "Compressing word tree..." msgstr " ..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: " - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -": \"%s_%s.spl\" \"%s_ascii.spl" -"\"" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -": \"%s.%s.spl\" \"%s.ascii.spl" -"\"" - #, c-format msgid "Reading spell file \"%s\"" msgstr " \"%s\"" @@ -5092,8 +5153,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: " #, c-format -msgid "Warning: region %s not supported" -msgstr ": %s " +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: .sug, : %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5241,8 +5318,8 @@ msgid "E760: No word count in %s" msgstr "E760: %s" #, c-format -msgid "line %6d, word %6d - %s" -msgstr " %6d, %6d %s" +msgid "line %6d, word %6ld - %s" +msgstr " %6d, %6ld %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5306,10 +5383,6 @@ msgstr " msgid "Reading back spell file..." msgstr " ..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr " ..." @@ -5332,8 +5405,9 @@ msgstr " msgid "E751: Output file name must not have region name" msgstr "E751: " -msgid "E754: Only up to 8 regions supported" -msgstr "E754: 8- " +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: %ld " #, c-format msgid "E755: Invalid region in %s" @@ -5344,82 +5418,60 @@ msgstr " #, c-format msgid "Writing spell file %s ..." -msgstr " %s ..." - -msgid "Done!" -msgstr "!" - -#, c-format -msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' %ld " - -#, c-format -msgid "Word '%.*s' removed from %s" -msgstr " '%.*s' %s" - -#, c-format -msgid "Word '%.*s' added to %s" -msgstr " '%.*s' %s" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: " - -msgid "Sorry, no suggestions" -msgstr ", " - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr ", %ld " - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr " \"%.*s\" :" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: " - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: : %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug: %s" +msgstr " %s ..." -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: .sug, : %s" +msgid "Done!" +msgstr "!" #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug Vim: %s" +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' %ld " #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug .spl: %s" +msgid "Word '%.*s' removed from %s" +msgstr " '%.*s' %s" #, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug: %s" +msgid "Word '%.*s' added to %s" +msgstr " '%.*s' %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: " -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: MAP" msgid "No Syntax items defined for this buffer" msgstr " " +msgid "syntax conceal on" +msgstr " " + +msgid "syntax conceal off" +msgstr " " + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: : %s" +msgid "syntax case ignore" +msgstr " " + +msgid "syntax case match" +msgstr " " + +msgid "syntax spell toplevel" +msgstr " " + +msgid "syntax spell notoplevel" +msgstr " " + +msgid "syntax spell default" +msgstr " " + +msgid "syntax iskeyword " +msgstr " " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: %s " @@ -5496,6 +5548,10 @@ msgstr "E847: msgid "E789: Missing ']': %s" msgstr "E789: ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: '=': %s" @@ -5648,7 +5704,6 @@ msgstr "E428: msgid "File \"%s\" does not exist" msgstr " \"%s\" " -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr " %d %d%s" @@ -5663,7 +5718,6 @@ msgstr " msgid "E429: File \"%s\" does not exist" msgstr "E429: \"%s\" " -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5694,7 +5748,6 @@ msgstr " msgid "E432: Tags file not sorted: %s" msgstr "E432: : %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: " @@ -5730,7 +5783,6 @@ msgstr "E436: msgid "E437: terminal capability \"cm\" required" msgstr "E437: \"cm\"" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5738,6 +5790,35 @@ msgstr "" "\n" "--- ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr " $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr " \"%s\"?" + +msgid "Terminal" +msgstr "" + +msgid "Terminal-finished" +msgstr "-" + +msgid "active" +msgstr "" + +msgid "running" +msgstr "" + +msgid "finished" +msgstr "" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: : %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: " + msgid "new shell started\n" msgstr " \n" @@ -5747,12 +5828,9 @@ msgstr "Vim: msgid "Used CUT_BUFFER0 instead of empty selection" msgstr " CUT_BUFFER0" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. msgid "E881: Line count changed unexpectedly" msgstr "E881: " -#. must display the prompt msgid "No undo possible; continue anyway" msgstr " ; " @@ -5875,7 +5953,7 @@ msgstr " #, c-format msgid "%ld seconds ago" -msgstr "%ld " +msgstr "%ld " msgid "E790: undojoin is not allowed after undo" msgstr "E790: " @@ -5886,13 +5964,133 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: " -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -" MS-Windows 16/32 " +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: %s . !, ." + +msgid "E717: Dictionary entry already exists" +msgstr "E717: " + +msgid "E718: Funcref required" +msgstr "E718: " + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: : %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: : %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: : %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: %s " + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: , 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr " %s" + +#, c-format +msgid "%s aborted" +msgstr "%s " + +#, c-format +msgid "%s returning #%ld" +msgstr "%s #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s %s" + +msgid "E699: Too many arguments" +msgstr "E699: " + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: : %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: : %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> : %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: dict : %s" + +msgid "E129: Function name required" +msgstr "E129: " + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: : %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: : %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: g:" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: - : %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: : %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: %s, " + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: : %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: %s, " + +msgid "E133: :return not inside a function" +msgstr "E133: :return " + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: : %s" msgid "" "\n" @@ -5908,9 +6106,6 @@ msgstr "" "\n" " MS-Windows 32 " -msgid " in Win32s mode" -msgstr " Win32" - msgid " with OLE support" msgstr " OLE" @@ -5930,45 +6125,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -" MS-Windows 16 " - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -" MS-DOS 32 " - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -" MS-DOS 16 " - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -" MacOS X (unix)" - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -" MacOS X" +" macOS" msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -" MacOS" +" macOS darwin" msgid "" "\n" @@ -5999,7 +6166,7 @@ msgid "" "Compiled " msgstr "" "\n" -" " +": " msgid "by " msgstr " " @@ -6037,11 +6204,14 @@ msgid "" "Tiny version " msgstr "" "\n" -" \"\" " +" " msgid "without GUI." msgstr " ." +msgid "with GTK3 GUI." +msgstr " GTK3." + msgid "with GTK2-GNOME GUI." msgstr " GTK2-GNOME." @@ -6069,11 +6239,8 @@ msgstr " msgid "with Cocoa GUI." msgstr " Cocoa." -msgid "with (classic) GUI." -msgstr " ." - msgid " Features included (+) or not (-):\n" -msgstr " (+) (-) :\n" +msgstr " (+) (-) :\n" msgid " system vimrc file: \"" msgstr " vimrc: \"" @@ -6105,6 +6272,9 @@ msgstr " msgid "3rd user gvimrc file: \"" msgstr " gvimrc: \"" +msgid " defaults file: \"" +msgstr " : \"" + msgid " system menu file: \"" msgstr " : \"" @@ -6136,7 +6306,7 @@ msgid "by Bram Moolenaar et al." msgstr " " msgid "Vim is open source and freely distributable" -msgstr "Vim " +msgstr "Vim " msgid "Help poor children in Uganda!" msgstr " !" @@ -6150,8 +6320,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr " :help<Enter> <F1> " -msgid "type :help version7<Enter> for version info" -msgstr " :help version7<Enter> " +msgid "type :help version8<Enter> for version info" +msgstr " :help version8<Enter> " msgid "Running in Vi compatible mode" msgstr " Vi- " @@ -6195,12 +6365,6 @@ msgstr " msgid "menu Help->Sponsor/Register for information " msgstr " ->/ " -msgid "WARNING: Windows 95/98/ME detected" -msgstr ": Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr " :help windows95<Enter> " - msgid "Already only one window" msgstr " " @@ -6232,6 +6396,25 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: \"%s\" " +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID: %ld ( 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID : %ld" + +msgid "List or number required" +msgstr " " + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID: %ld ( 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID : %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s" @@ -6256,7 +6439,6 @@ msgstr " msgid "Edit with &Vim" msgstr "& Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr " Vim " @@ -6275,10 +6457,6 @@ msgstr " msgid "--No lines in buffer--" msgstr "-- --" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: " @@ -6335,6 +6513,10 @@ msgstr "E236: msgid "E473: Internal error" msgstr "E473: " +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: : %s" + msgid "Interrupted" msgstr "" @@ -6348,6 +6530,14 @@ msgstr "E474: msgid "E475: Invalid argument: %s" msgstr "E475: : %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: : %s" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: %s: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: : %s" @@ -6366,6 +6556,9 @@ msgstr "E17: \"%s\" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: \"%s()\" " +msgid "E667: Fsync failed" +msgstr "E667: fsync()" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: %s " @@ -6462,12 +6655,6 @@ msgstr "E484: msgid "E485: Can't read file %s" msgstr "E485: %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: ( !, )" - -msgid "E37: No write since last change" -msgstr "E37: " - msgid "E38: Null argument" msgstr "E38: " @@ -6520,6 +6707,31 @@ msgstr "E46: msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: : \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: " + +msgid "E715: Dictionary required" +msgstr "E715: " + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: : %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: : %s" + +msgid "E714: List required" +msgstr "E714: " + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s " + msgid "E47: Error while reading errorfile" msgstr "E47: " @@ -6579,8 +6791,8 @@ msgstr "" msgid "E80: Error while writing" msgstr "E80: " -msgid "Zero count" -msgstr " " +msgid "E939: Positive count required" +msgstr "E939: " msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> " @@ -6594,16 +6806,16 @@ msgstr "E463: msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans " -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: : %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: " +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: %ld " + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: " @@ -6617,6 +6829,13 @@ msgstr "E764: msgid "E850: Invalid register name" msgstr "E850: " +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: " + msgid "search hit TOP, continuing at BOTTOM" msgstr " " @@ -6724,7 +6943,6 @@ msgstr " msgid "list index out of range" msgstr " " -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr " : VIM- %d" @@ -6771,9 +6989,6 @@ msgstr " msgid "function %s does not exist" msgstr " %s " -msgid "function constructor does not accept keyword arguments" -msgstr " " - #, c-format msgid "failed to run function %s" msgstr " %s" @@ -6861,6 +7076,10 @@ msgstr "" msgid "unable to convert %s to vim dictionary" msgstr " %s VIM" +#, c-format +msgid "unable to convert %s to vim list" +msgstr " %s VIM" + #, c-format msgid "unable to convert %s to vim structure" msgstr " %s VIM" @@ -6888,3 +7107,5 @@ msgid "" msgstr "" " : sys.path \n" " vim.VIM_SPECIAL_PATH sys.path" + + diff --git a/src/po/ru.po b/src/po/ru.po index 1d7f16deb0..5f392ac333 100644 --- a/src/po/ru.po +++ b/src/po/ru.po @@ -3,20 +3,22 @@ # Об условиях использования читайте в редакторе Vim ":help uganda" # # vassily "vr" ragosin <vrr@users.sourceforge.net>, 2004 -# Sergey Alyoshin <alyoshin.s@gmail.com>, 2013-2014 +# Sergey Alyoshin <alyoshin.s@gmail.com>, 2013-2014, 2016, 2018 # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-24 12:18+0400\n" -"PO-Revision-Date: 2014-03-24 12:18 +0400\n" +"POT-Creation-Date: 2018-04-28 21:50+0300\n" +"PO-Revision-Date: 2018-04-28 21:51+0300\n" "Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n" "Language-Team: \n" "Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() вызван с пустым паролем" @@ -49,6 +51,12 @@ msgstr "E82: Невозможно выделить память даже для msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: Невозможно выделить память для буфера, используем другой буфер..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: Невозможно зарегистрировать буфер" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Попытка удалить используемый буфер" + msgid "E515: No buffers were unloaded" msgstr "E515: Ни один буфер не был выгружен из памяти" @@ -85,14 +93,9 @@ msgstr "E90: Невозможно выгрузить из памяти посл msgid "E84: No modified buffer found" msgstr "E84: Изменённых буферов не обнаружено" -#. back where we started, didn't find anything. msgid "E85: There is no listed buffer" msgstr "E85: Буферы в списке отсутствуют" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Буфер %ld не существует" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Это последний буфер" @@ -104,6 +107,18 @@ msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" "E89: Изменения в буфере %ld не сохранены (добавьте !, чтобы обойти проверку)" +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Задание ещё выполняется (добавьте !, чтобы завершить)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Изменения не сохранены (добавьте !, чтобы обойти проверку)" + +msgid "E948: Job still running" +msgstr "E948: Задание ещё выполняется" + +msgid "E37: No write since last change" +msgstr "E37: Изменения не сохранены" + msgid "W14: Warning: List of file names overflow" msgstr "W14: Предупреждение: переполнение списка имён файлов" @@ -159,7 +174,6 @@ msgstr "стр. %ld из %ld --%d%%-- кол. " msgid "[No Name]" msgstr "[Нет имени]" -#. must be a help buffer msgid "help" msgstr "справка" @@ -185,6 +199,10 @@ msgstr "" "\n" "# Список буферов:\n" +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "" +"E382: Запись невозможна, значение опции 'buftype' не является пустой строкой" + msgid "[Scratch]" msgstr "[Временный]" @@ -203,8 +221,101 @@ msgstr "Значки для %s:" msgid " line=%ld id=%d name=%s" msgstr " строка=%ld id=%d имя=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Невозможно соединиться с портом" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() в channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() в channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: Получена команда с не строковым параметром" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: Последний параметр для выражения или вызова должен быть числом" + +msgid "E904: third argument for call must be a list" +msgstr "E904: Третий параметр для вызова должен быть списком" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: Получена неизвестная команда %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): запись без соединения" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: Ошибка записи в %s()" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Невозможно использовать обратный вызов с %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: Невозможно использовать ch_evalexpr() или ch_sendexpr() с каналом nl " +"или raw" + +msgid "E906: not an open channel" +msgstr "E906: Не открытый канал" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: Файл _io требует установленного _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: буфер in_io требует установленного in_buf или in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: Буфер должен быть загружен: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Файл зашифрован неизвестным методом" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Предупреждение: Используется слабый метод шифрования, см. :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Введите пароль для шифрования: " + +msgid "Enter same key again: " +msgstr "Повторите ввод пароля: " + +msgid "Keys don't match!" +msgstr "Введённые пароли не совпадают!" + +msgid "[crypted]" +msgstr "[зашифровано]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Пропущено двоеточие в словаре: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Повтор ключа в словаре: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Пропущена запятая в словаре: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Пропущено окончание словаря '}': %s" + +msgid "extend() argument" +msgstr "параметра extend()" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Ключ уже существует: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: Следить за отличиями можно не более чем в %ld буферах" msgid "E810: Cannot read or write temp files" @@ -260,7 +371,6 @@ msgstr "E791: пустая запись раскладки клавиатуры" msgid " Keyword completion (^N^P)" msgstr " Автодополнение ключевого слова (^N^P)" -#. ctrl_x_mode == 0, ^P/^N compl. msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " Режим ^X (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" @@ -332,13 +442,12 @@ msgstr "Просмотр: %s" msgid "Scanning tags." msgstr "Выполняется поиск среди меток." +msgid "match in file" +msgstr "соответствие в файле" + msgid " Adding" msgstr " Добавление" -#. showmode might reset the internal line pointers, so it must -#. * be called before line = ml_get(), or when this address is no -#. * longer needed. -- Acevedo. -#. msgid "-- Searching..." msgstr "-- Поиск..." @@ -362,10 +471,6 @@ msgstr "соответствие %d" msgid "E18: Unexpected characters in :let" msgstr "E18: Неожиданные символы в :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: Индекс списка за пределами диапазона: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Неопределённая переменная: %s" @@ -373,41 +478,6 @@ msgstr "E121: Неопределённая переменная: %s" msgid "E111: Missing ']'" msgstr "E111: Пропущена ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Параметр %s должен быть списком" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Параметр %s должен быть списком или словарём" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Невозможно использовать пустой ключ для словаря" - -msgid "E714: List required" -msgstr "E714: Требуется список" - -msgid "E715: Dictionary required" -msgstr "E715: Требуется словарь" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Слишком много параметров для функции %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Нет ключа в словаре: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Функция %s уже существует. Добавьте !, чтобы заменить её." - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Запись уже существует в словаре" - -msgid "E718: Funcref required" -msgstr "E718: Требуется ссылка на функцию" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Невозможно использовать [:] со словарём" @@ -415,10 +485,6 @@ msgstr "E719: Невозможно использовать [:] со слова msgid "E734: Wrong variable type for %s=" msgstr "E734: Неправильный тип переменной для %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Неизвестная функция: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Недопустимое имя переменной: %s" @@ -457,38 +523,20 @@ msgstr "E711: Список-значение не содержит достато msgid "E690: Missing \"in\" after :for" msgstr "E690: Пропущено \"in\" после :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Пропущены скобки: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Нет такой переменной: \"%s\"" +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Невозможно (раз)блокировать переменную %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: Слишком глубоко вложенные переменные для (раз)блокировки" msgid "E109: Missing ':' after '?'" msgstr "E109: Пропущено ':' после '?'" -msgid "E691: Can only compare List with List" -msgstr "E691: Список можно сравнивать только со списком" - -msgid "E692: Invalid operation for List" -msgstr "E692: Недопустимая операция для списков" - -msgid "E735: Can only compare Dictionary with Dictionary" -msgstr "E735: Словарь можно сравнивать только со словарём" - -msgid "E736: Invalid operation for Dictionary" -msgstr "E736: Недопустимая операция для словаря" - -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Ссылку на функцию можно сравнивать только с ссылкой на функцию" - -msgid "E694: Invalid operation for Funcrefs" -msgstr "E694: Недопустимая операция для ссылки на функцию" - msgid "E804: Cannot use '%' with Float" msgstr "E804: Невозможно использовать '%' с числом с плавающей точкой" @@ -498,6 +546,9 @@ msgstr "E110: Пропущена ')'" msgid "E695: Cannot index a Funcref" msgstr "E695: Невозможно индексировать ссылку на функцию" +msgid "E909: Cannot index a special variable" +msgstr "E909: Невозможно индексировать специальную переменную" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Не указано имя опции: %s" @@ -514,83 +565,119 @@ msgstr "E114: Пропущена кавычка: %s" msgid "E115: Missing quote: %s" msgstr "E115: Пропущена кавычка: %s" -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Пропущена запятая в списке: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "Недостаточно памяти для установки ссылки, сборка мусора прекращена!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Пропущено окончание списка ']': %s" +msgid "E724: variable nested too deep for displaying" +msgstr "E724: Слишком глубоко вложенные переменные для отображения" -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Пропущено двоеточие в словаре: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Использование числа с плавающей точкой как целого" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Повтор ключа в словаре: \"%s\"" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Использование ссылки на функцию как числа" -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Пропущена запятая в словаре: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: Использование списка как числа" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Пропущено окончание словаря '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Использование словаря как числа" -msgid "E724: variable nested too deep for displaying" -msgstr "E724: Слишком глубоко вложенные переменные для отображения" +msgid "E910: Using a Job as a Number" +msgstr "E910: Использование задания как числа" -#, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Слишком много параметров для функции %s" +msgid "E913: Using a Channel as a Number" +msgstr "E913: Использование канала как числа" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Использование ссылки на функцию как числа с плавающей точкой" + +msgid "E892: Using a String as a Float" +msgstr "E892: Использование строки как числа с плавающей точкой" + +msgid "E893: Using a List as a Float" +msgstr "E893: Использование списка как числа с плавающей точкой" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Использование словаря как числа с плавающей точкой" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Использование специального значения как числа с плавающей точкой" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Использование задания как числа с плавающей точкой" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Использование канала как числа с плавающей точкой" + +msgid "E729: using Funcref as a String" +msgstr "E729: Использование ссылки на функцию как строки" + +msgid "E730: using List as a String" +msgstr "E730: Использование списка как строки" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Использование словаря как строки" + +msgid "E908: using an invalid value as a String" +msgstr "E908: Использование неправильного значения как строки" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Параметры для функции %s заданы неверно" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Невозможно удалить переменную %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Неизвестная функция: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "" +"E704: Имя переменной ссылки на функцию должно начинаться с заглавной буквы: " +"%s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Недостаточно параметров для функции %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Имя переменной конфликтует с существующей функцией: %s" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> используется вне сценария: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Значение %s заблокировано" + +msgid "Unknown" +msgstr "Неизвестно" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Вызов функции dict без словаря: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Невозможно изменить значение %s" -msgid "E808: Number or Float required" -msgstr "E808: Требуется целое число или с плавающей точкой" +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Слишком глубоко вложенные переменные для копирования" -msgid "add() argument" -msgstr "параметра add()" +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# глобальные переменные:\n" -msgid "E699: Too many arguments" -msgstr "E699: Слишком много параметров" +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tВ последний раз опция изменена в " -msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() может использоваться только в режиме Вставки" +msgid "E691: Can only compare List with List" +msgstr "E691: Список можно сравнивать только со списком" -#. -#. * Yes this is ugly, I don't particularly like it either. But doing it -#. * this way has the compelling advantage that translations need not to -#. * be touched at all. See below what 'ok' and 'ync' are used for. -#. -msgid "&Ok" -msgstr "&Ok" +msgid "E692: Invalid operation for List" +msgstr "E692: Недопустимая операция для списков" -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Ключ уже существует: %s" +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Словарь можно сравнивать только со словарём" -msgid "extend() argument" -msgstr "параметра extend()" +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Недопустимая операция для словаря" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Недопустимая операция для ссылки на функцию" msgid "map() argument" msgstr "параметра map()" @@ -599,13 +686,41 @@ msgid "filter() argument" msgstr "параметра filter()" #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld строк: " +msgid "E686: Argument of %s must be a List" +msgstr "E686: Параметр %s должен быть списком" + +msgid "E928: String required" +msgstr "E928: Требуется строка" + +msgid "E808: Number or Float required" +msgstr "E808: Требуется целое число или с плавающей точкой" + +msgid "add() argument" +msgstr "параметра add()" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() может использоваться только в режиме Вставки" + +msgid "&Ok" +msgstr "&Ok" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld строка: " +msgstr[1] "+-%s%3ld строки: " +msgstr[2] "+-%s%3ld строк: " #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Неизвестная функция: %s" +msgid "E922: expected a dict" +msgstr "E922: Ожидался словарь" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Второй параметр функции() должен быть списком или словарём" + msgid "" "&OK\n" "&Cancel" @@ -622,206 +737,106 @@ msgstr "параметра insert()" msgid "E786: Range not allowed" msgstr "E786: Диапазон не допускается" +msgid "E916: not a valid job" +msgstr "E916: Недопустимое задание" + msgid "E701: Invalid type for len()" msgstr "E701: Неправильные тип для len()" -msgid "E726: Stride is zero" -msgstr "E726: Нулевой шаг" - -msgid "E727: Start past end" -msgstr "E727: Начало после конца" - -msgid "<empty>" -msgstr "<пусто>" - -msgid "E240: No connection to Vim server" -msgstr "E240: Нет связи с сервером Vim" - -#, c-format -msgid "E241: Unable to send to %s" -msgstr "E241: Не могу отправить сообщение для %s" - -msgid "E277: Unable to read a server reply" -msgstr "E277: Сервер не отвечает" - -msgid "remove() argument" -msgstr "параметра remove()" - -msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Слишком много символических ссылок (цикл?)" - -msgid "reverse() argument" -msgstr "параметра reverse()" - -msgid "E258: Unable to send to client" -msgstr "E258: Не могу ответить клиенту" - -msgid "sort() argument" -msgstr "параметра sort()" - -msgid "E702: Sort compare function failed" -msgstr "E702: Неудачное завершение функции сравнения при сортировке" - -msgid "(Invalid)" -msgstr "(Неправильно)" - -msgid "E677: Error writing temp file" -msgstr "E677: Ошибка записи во временный файл" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Использование числа с плавающей точкой как целого" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Использование ссылки на функцию как числа" - -msgid "E745: Using a List as a Number" -msgstr "E745: Использование списка как числа" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Использование словаря как числа" - -msgid "E729: using Funcref as a String" -msgstr "E729: Использование ссылки на функцию как строки" - -msgid "E730: using List as a String" -msgstr "E730: Использование списка как строки" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Использование словаря как строки" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Несоответствие типа переменной для: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Невозможно удалить переменную %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "" -"E704: Имя переменной ссылки на функцию должно начинаться с заглавной буквы: " -"%s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Имя переменной конфликтует с существующей функцией: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Значение %s заблокировано" - -msgid "Unknown" -msgstr "Неизвестно" - #, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Невозможно изменить значение %s" +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID зарезервирован для \":match\": %ld" -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: Слишком глубоко вложенные переменные для копирования" +msgid "E726: Stride is zero" +msgstr "E726: Нулевой шаг" -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Неопределённая функция: %s" +msgid "E727: Start past end" +msgstr "E727: Начало после конца" -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Пропущена '(': %s" +msgid "<empty>" +msgstr "<пусто>" -msgid "E862: Cannot use g: here" -msgstr "E862: Здесь невозможно использовать g:" +msgid "E240: No connection to the X server" +msgstr "E240: Нет связи с X-сервером" #, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Недопустимый параметр: %s" +msgid "E241: Unable to send to %s" +msgstr "E241: Не могу отправить сообщение для %s" -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: Повторяющееся имя параметра: %s" +msgid "E277: Unable to read a server reply" +msgstr "E277: Сервер не отвечает" -msgid "E126: Missing :endfunction" -msgstr "E126: Пропущена команда :endfunction" +msgid "E941: already started a server" +msgstr "E941: Сервер уже запущен" -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Имя функции конфликтует с переменной: %s" +msgid "E942: +clientserver feature not available" +msgstr "E942: Особенность +clientserver недоступна" -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Невозможно переопределить функцию %s, она используется" +msgid "remove() argument" +msgstr "параметра remove()" -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Имя функции не соответствует имени файла сценария: %s" +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Слишком много символических ссылок (цикл?)" -msgid "E129: Function name required" -msgstr "E129: Требуется имя функции" +msgid "reverse() argument" +msgstr "параметра reverse()" -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Имя функции должно начинаться с заглавной буквы или содержать " -"двоеточие: %s" +msgid "E258: Unable to send to client" +msgstr "E258: Не могу ответить клиенту" #, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Невозможно удалить функцию %s, она используется" +msgid "E927: Invalid action: '%s'" +msgstr "E927: Неправильное действие: '%s'" -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Глубина вызова функции больше, чем значение 'maxfuncdepth'" +msgid "sort() argument" +msgstr "параметра sort()" -#, c-format -msgid "calling %s" -msgstr "вызов %s" +msgid "uniq() argument" +msgstr "параметра uniq()" -#, c-format -msgid "%s aborted" -msgstr "%s прервана" +msgid "E702: Sort compare function failed" +msgstr "E702: Неудачное завершение функции сравнения при сортировке" -#, c-format -msgid "%s returning #%ld" -msgstr "%s возвращает #%ld" +msgid "E882: Uniq compare function failed" +msgstr "" +"E882: Неудачное завершение функции сравнения при проверке единственности" -#, c-format -msgid "%s returning %s" -msgstr "%s возвращает %s" +msgid "(Invalid)" +msgstr "(Неправильно)" #, c-format -msgid "continuing in %s" -msgstr "продолжение в %s" - -msgid "E133: :return not inside a function" -msgstr "E133: команда :return вне функции" +msgid "E935: invalid submatch number: %d" +msgstr "E935: Недопустимый номер подсоответствия: %d" -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# глобальные переменные:\n" +msgid "E677: Error writing temp file" +msgstr "E677: Ошибка записи во временный файл" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tВ последний раз опция изменена в " +msgid "E921: Invalid callback argument" +msgstr "E921: Недопустимый параметр обратного вызова" -msgid "No old files" -msgstr "Нет старых файлов" +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Шес %02x, Вос %03o, Дигр %s" #, c-format msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Шес %02x, Вос %03o" + +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Шес %04x, Вос %o, Дигр %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Шес %08x, Вос %o, Дигр %s" #, c-format msgid "> %d, Hex %04x, Octal %o" -msgstr "> %d, Hex %04x, Octal %o" +msgstr "> %d, Шес %04x, Вос %o" #, c-format msgid "> %d, Hex %08x, Octal %o" -msgstr "> %d, Hex %08x, Octal %o" +msgstr "> %d, Шес %08x, Вос %o" msgid "E134: Move lines into themselves" msgstr "E134: Строки перемещаются сами на себя" @@ -867,11 +882,14 @@ msgstr " старых файлов" msgid " FAILED" msgstr " НЕУДАЧНО" -#. avoid a wait_return for this message, it's annoying #, c-format msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Права на запись файла viminfo отсутствуют: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Слишком много временных файлов viminfo, таких как %s" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Невозможно записать файл viminfo %s!" @@ -880,7 +898,10 @@ msgstr "E138: Невозможно записать файл viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Запись файла viminfo \"%s\"" -#. Write the info: +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Невозможно переименовать файл viminfo в %s!" + #, c-format msgid "# This viminfo file was generated by Vim %s.\n" msgstr "# Этот файл viminfo автоматически создан Vim %s.\n" @@ -898,6 +919,13 @@ msgstr "# Значение опции 'encoding' в момент записи ф msgid "Illegal starting char" msgstr "Недопустимый начальный символ" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Строк с '|', точно скопировано:\n" + msgid "Save As" msgstr "Сохранить как" @@ -987,14 +1015,14 @@ msgid "%ld substitutions" msgstr "%ld замен" msgid " on 1 line" -msgstr " в одной строке" +msgstr " в 1 стр." #, c-format msgid " on %ld lines" msgstr " в %ld стр." -msgid "E147: Cannot do :global recursive" -msgstr "E147: Команда :global не может быть рекурсивной" +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: Невозможно выполнить :global рекурсивно с диапазоном" msgid "E148: Regular expression missing from global" msgstr "E148: В команде :global пропущено регулярное выражение" @@ -1032,8 +1060,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Извините, файл справки \"%s\" не найден" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: %s не является каталогом" +msgid "E151: No match: %s" +msgstr "E151: Нет соответствия: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1051,6 +1079,10 @@ msgstr "E670: Файлы справки используют разные код msgid "E154: Duplicate tag \"%s\" in file %s/%s" msgstr "E154: Повторяющаяся метка \"%s\" в файле %s/%s" +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: %s не является каталогом" + #, c-format msgid "E160: Unknown sign command: %s" msgstr "E160: Неизвестная команда значка %s" @@ -1076,10 +1108,17 @@ msgstr "E159: Пропущен номер значка" msgid "E158: Invalid buffer name: %s" msgstr "E158: Неправильное имя буфера: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Невозможно перейти к буферу без имени" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Неправильный ID значка: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Невозможно изменить значок %s" + msgid " (NOT FOUND)" msgstr " (НЕ НАЙДЕНО)" @@ -1089,9 +1128,20 @@ msgstr " (не поддерживается)" msgid "[Deleted]" msgstr "[Удалено]" +msgid "No old files" +msgstr "Нет старых файлов" + msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Включён режим отладки. Для продолжения наберите \"cont\"" +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Преж.зн. = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Нов.зн. = \"%s\"" + #, c-format msgid "line %ld: %s" msgstr "строка %ld: %s" @@ -1100,6 +1150,13 @@ msgstr "строка %ld: %s" msgid "cmd: %s" msgstr "команда: %s" +msgid "frame is zero" +msgstr "нулевой фрейм" + +#, c-format +msgid "frame at highest level: %d" +msgstr "максимальный фрейм: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Точка остановки в \"%s%s\" стр. %ld" @@ -1115,6 +1172,10 @@ msgstr "Точки остановки не определены" msgid "%3d %s %s line %ld" msgstr "%3d %s %s стр. %ld" +#, c-format +msgid "%3d expr %s" +msgstr "%3d выр. %s" + msgid "E750: First use \":profile start {fname}\"" msgstr "E750: Первое использование \":profile start {имя-файла}\"" @@ -1122,8 +1183,9 @@ msgstr "E750: Первое использование \":profile start {имя- msgid "Save changes to \"%s\"?" msgstr "Сохранить изменения в \"%s\"?" -msgid "Untitled" -msgstr "Без имени" +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Задание ещё выполняется в буфере \"%s\"" #, c-format msgid "E162: No write since last change for buffer \"%s\"" @@ -1155,8 +1217,18 @@ msgid "Searching for \"%s\"" msgstr "Поиск \"%s\"" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "не найдено в 'runtimepath': \"%s\"" +msgid "not found in '%s': \"%s\"" +msgstr "не найдено в '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "" +"W20: Не поддерживается python требуемой версии 2.x, файл проигнорирован: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "" +"W21: Не поддерживается python требуемой версии 3.x, файл проигнорирован: %s" msgid "Source Vim script" msgstr "Выполнить сценарий Vim" @@ -1185,6 +1257,10 @@ msgstr "строка %ld: считывание \"%s\"" msgid "finished sourcing %s" msgstr "считывание сценария %s завершено" +#, c-format +msgid "continuing in %s" +msgstr "продолжение в %s" + msgid "modeline" msgstr "режимная строка" @@ -1252,12 +1328,12 @@ msgstr "Задан обратный диапазон, меняем границ msgid "E494: Use w or w>>" msgstr "E494: Используйте w или w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Таблица команд должна быть обновлена, выполните 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Извините, эта команда недоступна в данной версии" -msgid "E172: Only one file name allowed" -msgstr "E172: Разрешено использовать только одно имя файла" - msgid "1 more file to edit. Quit anyway?" msgstr "1 файл ожидает редактирования. Выйти?" @@ -1277,10 +1353,10 @@ msgstr "E174: Команда уже существует. Добавьте ! д msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Имя Парам. Диап. Дополн. Определение" +" Имя Парам. Диап. Дополн. Определение" msgid "No user-defined commands found" msgstr "Команды, определённые пользователем, не обнаружены." @@ -1300,6 +1376,9 @@ msgstr "E178: Неправильное значение числа-приста msgid "E179: argument required for -complete" msgstr "E179: Для -complete требуется указать параметр" +msgid "E179: argument required for -addr" +msgstr "E179: Для -addr требуется указать параметр" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Неправильный атрибут: %s" @@ -1318,6 +1397,10 @@ msgstr "" msgid "E184: No such user-defined command: %s" msgstr "E184: Нет такой команды пользователя: %s" +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Неправильное значение типа адреса: %s" + #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Неправильное значение дополнения: %s" @@ -1382,6 +1465,9 @@ msgstr "E188: В данной системе определение положе msgid "E466: :winpos requires two number arguments" msgstr "E466: Команда :winpos требует указания двух числовых параметров" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Невозможно использовать :redir внутри execute()" + msgid "Save Redirection" msgstr "Перенаправление записи" @@ -1406,7 +1492,6 @@ msgstr "E189: \"%s\" существует (добавьте !, чтобы обо msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Невозможно открыть для записи \"%s\"" -#. set mark msgid "E191: Argument must be a letter or forward/backward quote" msgstr "E191: Параметр должен быть прямой/обратной кавычкой или буквой" @@ -1444,6 +1529,9 @@ msgstr "E500: Результатом выражения является пус msgid "E195: Cannot open viminfo file for reading" msgstr "E195: Невозможно открыть файл viminfo для чтения" +msgid "Untitled" +msgstr "Без имени" + msgid "E196: No digraphs in this version" msgstr "E196: В этой версии диграфы не работают" @@ -1451,7 +1539,6 @@ msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "" "E608: Невозможно выполнить команду :throw для исключений с приставкой 'Vim'" -#. always scroll up, don't overwrite #, c-format msgid "Exception thrown: %s" msgstr "Исключительная ситуация: %s" @@ -1468,7 +1555,6 @@ msgstr "Исключительная ситуация проигнорирова msgid "%s, line %ld" msgstr "%s, строка %ld" -#. always scroll up, don't overwrite #, c-format msgid "Exception caught: %s" msgstr "Обработка исключительной ситуации: %s" @@ -1494,7 +1580,6 @@ msgstr "Ошибка и прерывание" msgid "Error" msgstr "Ошибка" -#. if (pending & CSTP_INTERRUPT) msgid "Interrupt" msgstr "Прерывание" @@ -1537,15 +1622,12 @@ msgstr "E601: Слишком глубоко вложенный :try" msgid "E603: :catch without :try" msgstr "E603: :catch без :try" -#. Give up for a ":catch" after ":finally" and ignore it. -#. * Just parse. msgid "E604: :catch after :finally" msgstr "E604: :catch после :finally" msgid "E606: :finally without :try" msgstr "E606: :finally без :try" -#. Give up for a multiple ":finally" and ignore it. msgid "E607: multiple :finally" msgstr "E607: Обнаружено несколько :finally" @@ -1590,6 +1672,9 @@ msgstr "Выражение" msgid "Input Line" msgstr "Строка ввода" +msgid "Debug Line" +msgstr "Строка отладки" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar больше длины команды" @@ -1635,7 +1720,6 @@ msgstr "Vim: Чтение из стандартного потока ввода msgid "Reading from stdin..." msgstr "Чтение из стандартного потока ввода stdin..." -#. Re-opening the original file failed! msgid "E202: Conversion made file unreadable!" msgstr "E202: В результате преобразования файл стал нечитаемым!" @@ -1663,12 +1747,6 @@ msgstr "[БЕЗ преобразований]" msgid "[converted]" msgstr "[перекодировано]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[зашифровано]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ОШИБКА ПРЕОБРАЗОВАНИЯ в строке %ld]" @@ -1689,9 +1767,6 @@ msgstr "Преобразование с помощью 'charconvert' не вып msgid "can't read output of 'charconvert'" msgstr "невозможно прочитать вывод 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Файл зашифрован неизвестным методом" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Нет подходящих автокоманд для буфера acwrite" @@ -1737,9 +1812,6 @@ msgid "E510: Can't make backup file (add ! to override)" msgstr "" "E510: Невозможно создать резервный файл (добавьте !, чтобы обойти проверку)" -msgid "E460: The resource fork would be lost (add ! to override)" -msgstr "E460: Ветвь ресурса будет потеряна (добавьте !, чтобы обойти проверку)" - msgid "E214: Can't find temp file for writing" msgstr "E214: Временный файл для записи не найден" @@ -1748,13 +1820,13 @@ msgstr "" "E213: Перекодировка невозможна (добавьте ! для записи без перекодировки)" msgid "E166: Can't open linked file for writing" -msgstr "E166: Невозможно открыть связанный файл для записи" +msgstr "E166: Невозможно открыть файл по ссылке для записи" msgid "E212: Can't open file for writing" msgstr "E212: Невозможно открыть файл для записи" -msgid "E667: Fsync failed" -msgstr "E667: Не удалось выполнить функцию fsync()" +msgid "E949: File changed while writing" +msgstr "E949: Файл был изменён после записи" msgid "E512: Close failed" msgstr "E512: Операция закрытия не удалась" @@ -1852,20 +1924,12 @@ msgstr "1 символ" msgid "%lld characters" msgstr "символов: %lld" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "символов: %ld" - msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" msgstr "[Незавершённая последняя строка]" -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers msgid "WARNING: The file has been changed since reading it!!!" msgstr "ПРЕДУПРЕЖДЕНИЕ: Файл изменён с момента чтения!!!" @@ -1949,11 +2013,16 @@ msgstr "--Удалено--" msgid "auto-removing autocommand: %s <buffer=%d>" msgstr "авто-удаление автокоманды: %s <буффер=%d>" -#. the group doesn't exist #, c-format msgid "E367: No such group: \"%s\"" msgstr "E367: Группа \"%s\" не существует" +msgid "E936: Cannot delete the current group" +msgstr "E936: Невозможно удалить текущую группу" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Удаление ещё используемой группы автокоманд" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Недопустимые символы после *: %s" @@ -1966,7 +2035,6 @@ msgstr "E216: Несуществующее событие: %s" msgid "E216: No such group or event: %s" msgstr "E216: Несуществующая группа или событие: %s" -#. Highlight title msgid "" "\n" "--- Auto-Commands ---" @@ -2017,8 +2085,11 @@ msgstr "" "E351: Складка не может быть удалена с текущим значением опции 'foldmethod'" #, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld строк в складке" +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld строка в складке " +msgstr[1] "+--%3ld строки в складке " +msgstr[2] "+--%3ld строк в складке " msgid "E222: Add to read buffer" msgstr "E222: Добавление в буфер чтения" @@ -2114,6 +2185,18 @@ msgstr "" "E232: \"Пузырь\" для вычислений, включающий и сообщение, и обратный вызов, " "не может быть создан" +msgid "_Cancel" +msgstr "О_тмена" + +msgid "_Save" +msgstr "Сохранить _как" + +msgid "_Open" +msgstr "_Открыть" + +msgid "_OK" +msgstr "_Да" + msgid "" "&Yes\n" "&No\n" @@ -2123,8 +2206,14 @@ msgstr "" "&Нет\n" "О&тмена" +msgid "Yes" +msgstr "Да" + +msgid "No" +msgstr "Нет" + msgid "Input _Methods" -msgstr "Методы Ввода" +msgstr "_Методы ввода" msgid "VIM - Search and Replace..." msgstr "VIM — Поиск и замена..." @@ -2133,46 +2222,43 @@ msgid "VIM - Search..." msgstr "VIM — Поиск..." msgid "Find what:" -msgstr "Что ищем:" +msgstr "Что найти:" msgid "Replace with:" -msgstr "На что заменяем:" +msgstr "Заменить на:" -#. whole word only button msgid "Match whole word only" msgstr "Только точные соответствия" -#. match case button msgid "Match case" -msgstr "Регистрозависимые соответствия" +msgstr "Учитывать регистр" msgid "Direction" msgstr "Направление" -#. 'Up' and 'Down' buttons msgid "Up" msgstr "Вверх" msgid "Down" msgstr "Вниз" -#. 'Find Next' button msgid "Find Next" msgstr "Найти следующее" -#. 'Replace' button msgid "Replace" -msgstr "Замена" +msgstr "Заменить" -#. 'Replace All' button msgid "Replace All" msgstr "Заменить все" +msgid "_Close" +msgstr "_Закрыть" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: Получен запрос на прекращение работы от диспетчера сеансов\n" -msgid "Close" -msgstr "Закрыть" +msgid "Close tab" +msgstr "Закрыть вкладку" msgid "New tab" msgstr "Новая вкладка" @@ -2219,20 +2305,6 @@ msgstr "Заменить &все" msgid "&Undo" msgstr "О&тмена" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Окно с заголовком \"%s\" не обнаружено" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Параметр не поддерживается: \"-%s\"; используйте версию OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Невозможно открыть окно внутри приложения MDI" - -msgid "Close tab" -msgstr "Закрыть вкладку" - msgid "Open tab..." msgstr "Открыть вкладку..." @@ -2242,14 +2314,23 @@ msgstr "Поиск строки (используйте '\\\\' для поиск msgid "Find & Replace (use '\\\\' to find a '\\')" msgstr "Поиск и замена (используйте '\\\\' для поиска '\\')" -#. We fake this: Use a filter that doesn't select anything and a default -#. * file name that won't be used. msgid "Not Used" msgstr "Не используется" msgid "Directory\t*.nothing\n" msgstr "Каталог\t*.ничего\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Окно с заголовком \"%s\" не обнаружено" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Параметр не поддерживается: \"-%s\"; используйте версию OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Невозможно открыть окно внутри приложения MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: Невозможно выделить запись в таблице цвета, некоторые цвета могут " @@ -2306,7 +2387,6 @@ msgstr "Vim — Выбор шрифта" msgid "Name:" msgstr "Название:" -#. create toggle button msgid "Show size in Points" msgstr "Показывать размер в пунктах" @@ -2512,6 +2592,7 @@ msgstr "%-5s: %s%*s (использование: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2522,6 +2603,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: Найти присваивания для этого символа\n" " c: Найти функции вызывающие эту функцию\n" " d: Найти функции вызываемые этой функцией\n" " e: Найти этот шаблон egrep\n" @@ -2536,7 +2618,7 @@ msgid "E625: cannot open cscope database: %s" msgstr "E625: Невозможно открыть базу данных cscope: %s" msgid "E626: cannot get cscope database information" -msgstr "E626: Информация о базе данных cscope не доступна" +msgstr "E626: Информация о базе данных cscope недоступна" msgid "E568: duplicate cscope database not added" msgstr "E568: Данная база данных cscope уже подсоединена" @@ -2549,7 +2631,6 @@ msgstr "E261: Соединение с cscope %s не обнаружено" msgid "cscope connection %s closed" msgstr "соединение с cscope %s закрыто" -#. should not reach here msgid "E570: fatal error in cs_manage_matches" msgstr "E570: Критическая ошибка в cs_manage_matches" @@ -2591,7 +2672,14 @@ msgid "" "loaded." msgstr "" "E815: К сожалению эта команда не работает, поскольку не загружена библиотека " -"MzScheme" +"MzScheme." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: К сожалению эта команда не работает, поскольку не загружен модуль " +"racket/base для MzScheme." msgid "invalid expression" msgstr "неправильное выражение" @@ -2654,131 +2742,49 @@ msgstr "" "E263: К сожалению эта команда не работает, поскольку не загружена библиотека " "Python" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: К сожалению эта команда не работает, поскольку не загружен модуль " +"Python site." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Невозможно выполнить рекурсивный вызов Python" msgid "E837: This Vim cannot execute :py3 after using :python" msgstr "E837: Данный Vim не может выполнить :py3 после использования :python" -msgid "E265: $_ must be an instance of String" -msgstr "E265: $_ должен быть экземпляром или строкой" - -msgid "" -"E266: Sorry, this command is disabled, the Ruby library could not be loaded." -msgstr "" -"E266: К сожалению эта команда не работает, поскольку не загружена библиотека " -"Ruby" - -msgid "E267: unexpected return" -msgstr "E267: Неожиданный return" - -msgid "E268: unexpected next" -msgstr "E268: Неожиданный next" - -msgid "E269: unexpected break" -msgstr "E269: Неожиданный break" - -msgid "E270: unexpected redo" -msgstr "E270: Неожиданный redo" - -msgid "E271: retry outside of rescue clause" -msgstr "E271: retry вне оператора rescue" - -msgid "E272: unhandled exception" -msgstr "E272: Необработанное исключение" - -#, c-format -msgid "E273: unknown longjmp status %d" -msgstr "E273: Неизвестное состояние longjmp %d" - -msgid "Toggle implementation/definition" -msgstr "Переключение между реализацией/определением" - -msgid "Show base class of" -msgstr "Показать основной класс" - -msgid "Show overridden member function" -msgstr "Показать перегруженные функции" - -msgid "Retrieve from file" -msgstr "Получить из файла" - -msgid "Retrieve from project" -msgstr "Получить из проекта" - -msgid "Retrieve from all projects" -msgstr "Получить из всех проектов" - -msgid "Retrieve" -msgstr "Получить" - -msgid "Show source of" -msgstr "Показать исходный код" - -msgid "Find symbol" -msgstr "Найти символ" - -msgid "Browse class" -msgstr "Просмотр класса" - -msgid "Show class in hierarchy" -msgstr "Показать класс в иерархии" - -msgid "Show class in restricted hierarchy" -msgstr "Показать класс в ограниченной иерархии" - -msgid "Xref refers to" -msgstr "Xref ссылается на" - -msgid "Xref referred by" -msgstr "Ссылка на xref из" - -msgid "Xref has a" -msgstr "Xref имеет" - -msgid "Xref used by" -msgstr "Xref используется" - -msgid "Show docu of" -msgstr "Показать docu" - -msgid "Generate docu for" -msgstr "Создать docu" +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ должен быть экземпляром или строкой" msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"Невозможно подсоединиться к SNiFF+. Проверьте настройки окружения." -"(sniffemacs должны быть указаны в переменной $PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Ошибка во время чтения. Отсоединение" - -msgid "SNiFF+ is currently " -msgstr "В настоящий момент SNiFF+ " +"E266: К сожалению эта команда не работает, поскольку не загружена библиотека " +"Ruby" -msgid "not " -msgstr "не " +msgid "E267: unexpected return" +msgstr "E267: Неожиданный return" -msgid "connected" -msgstr "подсоединён" +msgid "E268: unexpected next" +msgstr "E268: Неожиданный next" -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Неизвестный запрос SNiFF+: %s" +msgid "E269: unexpected break" +msgstr "E269: Неожиданный break" -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Ошибка соединения со SNiFF+" +msgid "E270: unexpected redo" +msgstr "E270: Неожиданный redo" -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ не подсоединён" +msgid "E271: retry outside of rescue clause" +msgstr "E271: retry вне оператора rescue" -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Это не буфер SNiFF+" +msgid "E272: unhandled exception" +msgstr "E272: Необработанное исключение" -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Ошибка во время записи. Отсоединение" +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: Неизвестное состояние longjmp %d" msgid "invalid buffer number" msgstr "неправильный номер буфера" @@ -2786,7 +2792,6 @@ msgstr "неправильный номер буфера" msgid "not implemented yet" msgstr "пока не реализовано" -#. ??? msgid "cannot set line(s)" msgstr "невозможно назначить строку или строки" @@ -2827,7 +2832,6 @@ msgstr "" "невозможно зарегистрировать команду с обратным вызовом: буфер или окно в " "процессе удаления" -#. This should never happen. Famous last word? msgid "" "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." "org" @@ -2868,6 +2872,18 @@ msgstr "" "E251: Неправильно сформировано значение данного процесса VIM в реестре. " "Удалено!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Повтор ключа в JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Пропущена запятая в списке: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Пропущено окончание списка ']': %s" + msgid "Unknown option argument" msgstr "Неизвестный необязательный параметр" @@ -2894,13 +2910,13 @@ msgstr "Файлов для редактирования: %d\n" msgid "netbeans is not supported with this GUI\n" msgstr "NetBeans не поддерживается с этим графическим интерфейсом\n" +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr "Невозможно использовать '-nb': не включено при компиляции\n" + msgid "This Vim was not compiled with the diff feature." msgstr "" "Данный Vim был скомпилирован с выключенной особенностью просмотра отличий" -msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr "Невозможно использовать '-nb': не включено при компиляции\n" - msgid "Attempt to open script file again: \"" msgstr "Попытка повторного открытия файла сценария: \"" @@ -2913,13 +2929,15 @@ msgstr "Невозможно открыть для вывода сценария msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: Ошибка: Не удалось запустить gvim из NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Ошибка: Данная версия Vim не работает в терминале Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Предупреждение: Вывод осуществляется не на терминал\n" msgid "Vim: Warning: Input is not from a terminal\n" msgstr "Vim: Предупреждение: Ввод происходит не с терминала\n" -#. just in case.. msgid "pre-vimrc command line" msgstr "командная строка перед выполнением vimrc" @@ -3083,6 +3101,12 @@ msgstr "-F\t\t\tЗапуск в режиме \"Фарси\"" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <терминал>\tНазначить указанный тип <терминала>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tНе предупреждать при вводе/выводе не в терминал" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tВыйти при вводе/выводе не в терминал" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tИспользовать <vimrc> вместо любых файлов .vimrc" @@ -3141,7 +3165,7 @@ msgid "-x\t\t\tEdit encrypted files" msgstr "-x\t\t\tРедактирование зашифрованных файлов" msgid "-display <display>\tConnect vim to this particular X-server" -msgstr "-display <экран>\tПодсоединить VIM к указанному X-серверу" +msgstr "-display <экран>\tПодсоединить Vim к указанному X-серверу" msgid "-X\t\t\tDo not connect to X server" msgstr "-X\t\t\tНе выполнять соединение с сервером X" @@ -3186,6 +3210,11 @@ msgstr "--startuptime <файл>\tЗаписать временную метку msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" msgstr "-i <viminfo>\t\tИспользовать вместо .viminfo файл <viminfo>" +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "" +"--clean\t\tНеполная совместимость с Vi, Vim по умолчанию,\n" +"\t\t\t\tбез модулей, без viminfo" + msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h или --help\tВывести справку (это сообщение) и завершить работу" @@ -3214,21 +3243,19 @@ msgstr "" "Параметры для gvim (версия Athena):\n" msgid "-display <display>\tRun vim on <display>" -msgstr "-display <дисплей>\tЗапустить VIM на указанном <дисплее>" +msgstr "-display <дисплей>\tЗапустить Vim на указанном <дисплее>" msgid "-iconic\t\tStart vim iconified" -msgstr "-iconic\t\tЗапустить VIM в свёрнутом виде" +msgstr "-iconic\t\tЗапустить Vim в свёрнутом виде" msgid "-background <color>\tUse <color> for the background (also: -bg)" -msgstr "" -"-background <цвет>\tИспользовать указанный <цвет> для фона (также: -bg)" +msgstr "-background <цвет>\tИспользовать указанный <цвет> для фона (или -bg)" msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" -msgstr "" -"-foreground <цвет>\tИспользовать <цвет> для обычного текста (также: -fg)" +msgstr "-foreground <цвет>\tИспользовать <цвет> для обычного текста (или -fg)" msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" -msgstr "-font <шрифт>\t\tИспользовать <шрифт> для обычного текста (также: -fn)" +msgstr "-font <шрифт>\tИспользовать <шрифт> для обычного текста (или -fn)" msgid "-boldfont <font>\tUse <font> for bold text" msgstr "-boldfont <шрифт>\tИспользовать <шрифт> для жирного текста" @@ -3237,24 +3264,23 @@ msgid "-italicfont <font>\tUse <font> for italic text" msgstr "-italicfont <шрифт>\tИспользовать <шрифт> для наклонного текста" msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" -msgstr "" -"-geometry <геометрия>\tИспользовать начальную <геометрию> (также: -geom)" +msgstr "-geometry <геометрия>\tИспользовать начальную <геометрию> (или -geom)" msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" -msgstr "-borderwidth <ширина>\tИспользовать <ширину> бордюра (также: -bw)" +msgstr "-borderwidth <ширина>\tИспользовать <ширину> бордюра (или -bw)" msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" msgstr "" -"-scrollbarwidth <ширина> Использовать ширину полосы прокрутки (также: -sw)" +"-scrollbarwidth <ширина> Использовать ширину полосы прокрутки (или -sw)" msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" -msgstr "-menuheight <высота>\tИспользовать <высоту> меню (также: -mh)" +msgstr "-menuheight <высота>\tИспользовать <высоту> меню (или -mh)" msgid "-reverse\t\tUse reverse video (also: -rv)" -msgstr "-reverse\t\tИспользовать инверсный видеорежим (также: -rv)" +msgstr "-reverse\t\tИспользовать инверсный видеорежим (или -rv)" msgid "+reverse\t\tDon't use reverse video (also: +rv)" -msgstr "+reverse\t\tНе использовать инверсный видеорежим (также: +rv)" +msgstr "+reverse\t\tНе использовать инверсный видеорежим (или +rv)" msgid "-xrm <resource>\tSet the specified resource" msgstr "-xrm <ресурс>\tУстановить указанный <ресурс>" @@ -3268,11 +3294,12 @@ msgstr "" msgid "-display <display>\tRun vim on <display> (also: --display)" msgstr "" -"-display <дисплей>\tЗапустить VIM на указанном <дисплее> (также: --display)" +"-display <дисплей>\tЗапустить Vim на указанном <дисплее> (или --display)" msgid "--role <role>\tSet a unique role to identify the main window" msgstr "" -"--role <роль>\tУстановить уникальную <роль> для идентификации главного окна" +"--role <роль>\tУстановить уникальную <роль>\n" +"\t\t\t\tдля идентификации главного окна" msgid "--socketid <xid>\tOpen Vim inside another GTK widget" msgstr "--socketid <xid>\tОткрыть Vim внутри другого компонента GTK" @@ -3289,11 +3316,9 @@ msgstr "--windowid <HWND>\tОткрыть Vim внутри другого ком msgid "No display" msgstr "Нет дисплея" -#. Failed to send, abort. msgid ": Send failed.\n" msgstr ": Отправка не удалась.\n" -#. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" msgstr ": Отправка не удалась. Попытка местного выполнения\n" @@ -3314,7 +3339,6 @@ msgstr "Нет установленных отметок" msgid "E283: No marks matching \"%s\"" msgstr "E283: Нет отметок, совпадающих с \"%s\"" -#. Highlight title msgid "" "\n" "mark line col file/text" @@ -3322,7 +3346,6 @@ msgstr "" "\n" "отмет стр кол файл/текст" -#. Highlight title msgid "" "\n" " jump line col file/text" @@ -3330,7 +3353,6 @@ msgstr "" "\n" "прыжок стр кол файл/текст" -#. Highlight title msgid "" "\n" "change line col text" @@ -3345,7 +3367,6 @@ msgstr "" "\n" "# Глобальные отметки:\n" -#. Write the jumplist with -' msgid "" "\n" "# Jumplist (newest first):\n" @@ -3418,7 +3439,6 @@ msgstr "E298: Не получен блок номер 2?" msgid "E843: Error while updating swap file crypt" msgstr "E843: Ошибка при обновлении шифрования своп-файла" -#. could not (re)open the swap file, what can we do???? msgid "E301: Oops, lost the swap file!!!" msgstr "E301: Ой, потерялся своп-файл!!!" @@ -3603,7 +3623,6 @@ msgstr "" msgid "Using crypt key from swap file for the text file.\n" msgstr "Использование ключа шифрования из своп-файла для текстового файла.\n" -#. use msg() to start the scrolling properly msgid "Swap files found:" msgstr "Обнаружены своп-файлы:" @@ -3774,24 +3793,17 @@ msgstr "при открытии файла: \"" msgid " NEWER than swap file!\n" msgstr " Более СВЕЖИЙ, чем своп-файл!\n" -#. Some of these messages are long to allow translation to -#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) Возможно, редактирование этого же файла выполняется в другой программе.\n" " Если это так, то будьте внимательны при внесении изменений, чтобы\n" -" у вас не появилось два разных варианта одного и того же файла." - -# Сообщение разделено, " \n" добавлено т.к. строка не помещается. -msgid " Quit, or continue with caution.\n" -msgstr "" -" \n" -" Завершите работу или продолжайте с осторожностью.\n" +" у вас не появилось два разных варианта одного и того же файла.\n" +" Выйдите или продолжайте с осторожностью.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) Сеанс редактирования этого файла завершён аварийно.\n" @@ -3869,7 +3881,6 @@ msgstr "E328: Меню в этом режиме не существует" msgid "E329: No menu \"%s\"" msgstr "E329: Нет меню %s" -#. Only a mnemonic or accelerator is not valid. msgid "E792: Empty menu name" msgstr "E792: Пустое имя меню" @@ -3882,8 +3893,6 @@ msgstr "E331: Элементы меню нельзя добавлять непо msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Разделители не могут быть компонентом пути к меню" -#. Now we have found the matching menu, and we list the mappings -#. Highlight title msgid "" "\n" "--- Menus ---" @@ -3894,6 +3903,10 @@ msgstr "" msgid "Tear off this menu" msgstr "Оторвать это меню" +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Меню не определено для режима %s" + msgid "E333: Menu path must lead to a menu item" msgstr "E333: Путь к меню должен вести к элементу меню" @@ -3901,10 +3914,6 @@ msgstr "E333: Путь к меню должен вести к элементу msgid "E334: Menu not found: %s" msgstr "E334: Меню не найдено: %s" -#, c-format -msgid "E335: Menu not defined for %s mode" -msgstr "E335: Меню не определено для режима %s" - msgid "E336: Menu path must lead to a sub-menu" msgstr "E336: Путь к меню должен вести к подменю" @@ -3976,7 +3985,6 @@ msgstr "Сохранение файла" msgid "Open File dialog" msgstr "Открытие файла" -#. TODO: non-GUI file selector here msgid "E338: Sorry, no file browser in console mode" msgstr "" "E338: Извините, но в консольном режиме нет проводника по файловой системе" @@ -4068,15 +4076,6 @@ msgstr "E548: Требуется ввести цифру" msgid "E549: Illegal percentage" msgstr "E549: Недопустимое значение процентов" -msgid "Enter encryption key: " -msgstr "Введите пароль для шифрования: " - -msgid "Enter same key again: " -msgstr "Повторите ввод пароля: " - -msgid "Keys don't match!" -msgstr "Введённые пароли не совпадают!" - msgid "E854: path too long for completion" msgstr "E854: слишком большой путь для автодополнения" @@ -4104,20 +4103,11 @@ msgstr "E346: В пути смены каталога больше нет кат msgid "E347: No more file \"%s\" found in path" msgstr "E347: В известных каталогах больше нет файлов \"%s\"" -msgid "Cannot connect to Netbeans #2" -msgstr "Невозможно соединиться с NetBeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "Невозможно соединиться с NetBeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: Неправильный режим доступа к информации о соединении с NetBeans: \"%s\"" -msgid "read from Netbeans socket" -msgstr "чтение из гнезда NetBeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Потеряно соединение с NetBeans для буфера %ld" @@ -4139,7 +4129,7 @@ msgid "E774: 'operatorfunc' is empty" msgstr "E774: Значением опции 'operatorfunc' является пустая строка" msgid "E775: Eval feature not available" -msgstr "E775: eval не доступна" +msgstr "E775: eval недоступна" msgid "Warning: terminal cannot highlight" msgstr "Предупреждение: терминал не может выполнять подсветку" @@ -4160,8 +4150,9 @@ msgstr "E662: В начале списка изменений" msgid "E663: At end of changelist" msgstr "E663: В конце списка изменений" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Введите :quit<Enter> для выхода из Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Введите :qa! и нажмите <Enter> для отмены всех изменений и выхода из Vim" #, c-format msgid "1 line %sed 1 time" @@ -4193,7 +4184,6 @@ msgstr "Изменены отступы в строках (%ld) " msgid "E748: No previously used register" msgstr "E748: Нет предыдущего использованного регистра" -#. must display the prompt msgid "cannot yank; delete anyway" msgstr "скопировать не удалось, удаление выполнено" @@ -4208,25 +4198,30 @@ msgstr "изменено строк: %ld" msgid "freeing %ld lines" msgstr "очищено строк: %ld" -msgid "block of 1 line yanked" -msgstr "скопирован блок из одной строки" +#, c-format +msgid " into \"%c" +msgstr " в \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "скопирован блок из одной строки%s" -msgid "1 line yanked" -msgstr "скопирована одна строка" +#, c-format +msgid "1 line yanked%s" +msgstr "скопирована одна строка%s" #, c-format -msgid "block of %ld lines yanked" -msgstr "скопирован блок из строк: %ld" +msgid "block of %ld lines yanked%s" +msgstr "скопирован блок из %ld строк%s" #, c-format -msgid "%ld lines yanked" -msgstr "скопировано строк: %ld" +msgid "%ld lines yanked%s" +msgstr "скопировано %ld строк%s" #, c-format msgid "E353: Nothing in register %s" msgstr "E353: В регистре %s ничего нет" -#. Highlight title msgid "" "\n" "--- Registers ---" @@ -4248,40 +4243,44 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Неизвестный тип регистра %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: шаблон поиска и регистр выражения не могут содержать двух или более " +"строк" + #, c-format msgid "%ld Cols; " msgstr "Колонок: %ld; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Выделено %s%ld из %ld строк; %ld из %ld слов; %ld из %ld байт" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Выделено %s%ld из %ld строк; %lld из %lld слов; %lld из %lld байт" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"Выделено %s%ld из %ld стр.; %ld из %ld слов; %ld из %ld симв.; %ld из %ld " -"байт" +"Выделено %s%ld из %ld стр.; %lld из %lld слов; %lld из %lld симв.; %lld из " +"%lld байт" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Кол. %s из %s; стр. %ld из %ld; сл. %ld из %ld; байт %ld из %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Кол. %s из %s; стр. %ld из %ld; сл. %lld из %lld; байт %lld из %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Кол. %s из %s; стр. %ld из %ld; сл. %ld из %ld; симв. %ld из %ld; байт %ld " -"из %ld" +"Кол. %s из %s; стр. %ld из %ld; сл. %lld из %lld; симв. %lld из %lld; байт " +"%lld из %lld" #, c-format -msgid "(+%ld for BOM)" -msgstr "(+%ld с учётом BOM)" - -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Стр. %N" +msgid "(+%lld for BOM)" +msgstr "(+%lld с учётом BOM)" msgid "Thanks for flying Vim" msgstr "Благодарим за использование Vim" @@ -4308,6 +4307,10 @@ msgstr "E522: Не обнаружено в termcap" msgid "E539: Illegal character <%s>" msgstr "E539: Недопустимый символ <%s>" +#, c-format +msgid "For option %s" +msgstr "Для опции %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: Значение опции 'term' не может быть пустой строкой" @@ -4329,6 +4332,10 @@ msgstr "E835: Конфликтует со значением 'fillchars'" msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Не может быть изменено в графическом интерфейсе GTK+ 2" +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Невозможно преобразовать %s и %s" + msgid "E524: Missing colon" msgstr "E524: Пропущено двоеточие" @@ -4388,6 +4395,9 @@ msgstr "E541: Слишком много элементов" msgid "E542: unbalanced groups" msgstr "E542: Несбалансированные группы" +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Невозможно сделать терминал изменённым с запущенным заданием" + msgid "E590: A preview window already exists" msgstr "E590: Окно предпросмотра уже есть" @@ -4395,6 +4405,9 @@ msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" msgstr "" "W17: Арабский требует использования UTF-8, введите ':set encoding=utf-8'" +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: 24 битный цвет не поддерживается в этом окружении" + #, c-format msgid "E593: Need at least %d lines" msgstr "E593: Нужно хотя бы %d строк" @@ -4407,9 +4420,6 @@ msgstr "E594: Нужно хотя бы %d колонок" msgid "E355: Unknown option: %s" msgstr "E355: Неизвестная опция: %s" -#. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: Требуется указать число: &%s = '%s'" @@ -4433,7 +4443,7 @@ msgid "" "--- Local option values ---" msgstr "" "\n" -"--- Местные значения опций ---" +"--- Локальные значения опций ---" msgid "" "\n" @@ -4482,7 +4492,6 @@ msgstr "невозможно сменить режим консоли?!\n" msgid "mch_get_shellsize: not a console??\n" msgstr "mch_get_shellsize: не в консоли??\n" -#. if Vim opened a window: Executing a shell may cause crashes msgid "E360: Cannot execute shell with -f option" msgstr "E360: Невозможно выполнить оболочку с параметром -f" @@ -4504,9 +4513,6 @@ msgstr "ОШИБКА ВВОДА/ВЫВОДА" msgid "Message" msgstr "Сообщение" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "Значение опции 'columns' не равно 80, внешние программы не выполняются" - msgid "E237: Printer selection failed" msgstr "E237: Неудачное завершение выбора принтера" @@ -4530,6 +4536,10 @@ msgstr "Печать '%s'" msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Недопустимое имя кодировки \"%s\" в имени шрифта \"%s\"" +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Недопустимое имя свойства \"%s\" в имени шрифта \"%s\"" + #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: Недопустимый символ '%c' в имени шрифта \"%s\"" @@ -4565,12 +4575,13 @@ msgstr "" "\n" "Невозможно установить контекст безопасности для " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Невозможно запустить оболочку " +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Невозможно установить контекст безопасности %s для для %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Невозможно получить контекст безопасности %s для %s. Будет удалено!" msgid "" "\n" @@ -4600,6 +4611,13 @@ msgstr "" "\n" "Невозможно выполнить fork()\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Невозможно запустить оболочку " + msgid "" "\n" "Command terminated\n" @@ -4642,10 +4660,6 @@ msgstr "Ошибка VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "Невозможно исправить указатели функций для DLL!" -#, c-format -msgid "shell returned %d" -msgstr "завершение работы оболочки с кодом %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Перехвачено событие %s\n" @@ -4674,6 +4688,13 @@ msgstr "" msgid "Vim Warning" msgstr "Предупреждение Vim" +#, c-format +msgid "shell returned %d" +msgstr "завершение работы оболочки с кодом %d" + +msgid "E926: Current location list was changed" +msgstr "E926: Изменён список текущих расположений" + #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: В строке формата слишком много %%%c" @@ -4706,6 +4727,12 @@ msgstr "E379: Имя каталога не задано или равно пус msgid "E553: No more items" msgstr "E553: Больше нет элементов" +msgid "E924: Current window was closed" +msgstr "E924: Текущее окно было закрыто" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Изменён список текущих быстрых исправлений" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d из %d)%s%s: " @@ -4713,19 +4740,18 @@ msgstr "(%d из %d)%s%s: " msgid " (line deleted)" msgstr " (строка удалена)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sсписок ошибок %d из %d; %d ошибок" + msgid "E380: At bottom of quickfix stack" msgstr "E380: Внизу стека быстрых исправлений" msgid "E381: At top of quickfix stack" msgstr "E381: Наверху стека быстрых исправлений" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "список ошибок %d из %d; %d ошибок" - -msgid "E382: Cannot write, 'buftype' option is set" -msgstr "" -"E382: Запись невозможна, значение опции 'buftype' не является пустой строкой" +msgid "No entries" +msgstr "Нет элементов" msgid "Error file" msgstr "Файл ошибок" @@ -4751,6 +4777,12 @@ msgstr "E369: Недопустимый элемент в %s%%[]" msgid "E769: Missing ] after %s[" msgstr "E769: Пропущена ] после %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: Обратный диапазон в символьном классе" + +msgid "E945: Range too large in character class" +msgstr "E945: Диапазон слишком велик в символьном классе" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: Нет пары для %s%%(" @@ -4777,6 +4809,9 @@ msgstr "E69: Пропущена ] после %s%%[" msgid "E70: Empty %s%%[]" msgstr "E70: Пустое %s%%[]" +msgid "E65: Illegal back reference" +msgstr "E65: Недопустимая обратная ссылка" + msgid "E339: Pattern too long" msgstr "E339: Слишком длинный шаблон" @@ -4813,9 +4848,6 @@ msgstr "E63: Недопустимое использование \\_" msgid "E64: %s%c follows nothing" msgstr "E64: %s%c ни за чем не следует" -msgid "E65: Illegal back reference" -msgstr "E65: Недопустимая обратная ссылка" - msgid "E68: Invalid character after \\z" msgstr "E68: Недопустимый символ после \\z" @@ -4834,6 +4866,10 @@ msgstr "E554: Синтаксическая ошибка в %s{...}" msgid "External submatches:\n" msgstr "Внешние подсоответствия:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (рег. выражение НКА) невозможно повторить %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -4841,6 +4877,9 @@ msgstr "" "E864: после \\%#= может быть только 0, 1 или 2. Будет использоваться " "автоматическая машина" +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Включено отслеживание движка рег. выражений для шаблона: " + msgid "E865: (NFA) Regexp end encountered prematurely" msgstr "E865: (НКА) неожиданный конец регулярного выражения" @@ -4856,11 +4895,13 @@ msgstr "E877: (рег. выражение НКА) неправильный кл msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (НКА) неизвестный оператор '\\z%c'" +msgid "E951: \\% value too large" +msgstr "E951: \\% значение слишком большое" + #, c-format msgid "E867: (NFA) Unknown operator '\\%%%c'" msgstr "E867: (НКА) неизвестный оператор '\\%%%c'" -#. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: ошибка при создании НКА с классом эквивалентности!" @@ -4871,11 +4912,9 @@ msgstr "E869: (НКА) неизвестный оператор '\\@%c'" msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (рег. выражение НКА) ошибка при чтении границ повторения" -#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (рег. выражение НКА) множество не может следовать за множеством!" -#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (рег. выражение НКА) слишком много '('" @@ -4940,9 +4979,6 @@ msgstr " Иврит" msgid " Arabic" msgstr " Арабский" -msgid " (lang)" -msgstr " (язык)" - msgid " (paste)" msgstr " (вклейка)" @@ -4985,7 +5021,6 @@ msgstr "E386: После ';' ожидается ввод '?' или '/'" msgid " (includes previously listed match)" msgstr " (включает раннее показанные соответствия)" -#. cursor at status line msgid "--- Included files " msgstr "--- Включённые файлы " @@ -5037,8 +5072,49 @@ msgstr "" "# Последний %sШаблон поиска:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Ошибка формата в файле правописания" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Проверка правописания выключена" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Предупреждение: Невозможно найти список слов \"%s_%s.spl\" или \"%s_ascii.spl" +"\"" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Предупреждение: Невозможно найти список слов \"%s.%s.spl\" или \"%s.ascii.spl" +"\"" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: Буфер удалён при выполнении автокоманды SpellFileMissing" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Предупреждение: регион %s не поддерживается" + +msgid "Sorry, no suggestions" +msgstr "Извините, нет предположений" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Извините, только %ld предположений" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Заменить \"%.*s\" на:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Нет предыдущей замены правописания" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Не найдено: %s" msgid "E758: Truncated spell file" msgstr "E758: Файл правописания обрезан" @@ -5060,21 +5136,6 @@ msgstr "E762: Символы в FOL, LOW или UPP за пределами ди msgid "Compressing word tree..." msgstr "Сжатие дерева слов..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Проверка правописания выключена" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -"Предупреждение: Невозможно найти список слов \"%s_%s.spl\" или \"%s_ascii.spl" -"\"" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"Предупреждение: Невозможно найти список слов \"%s.%s.spl\" или \"%s.ascii.spl" -"\"" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Чтение файла правописания \"%s\"" @@ -5092,8 +5153,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Неподдерживаемый раздел в файле правописания" #, c-format -msgid "Warning: region %s not supported" -msgstr "Предупреждение: регион %s не поддерживается" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Это не похоже на файл .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Старый файл .sug, требует обновления: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Файл .sug для более новой версии Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Файл .sug не соответствует файлу .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Ошибка при чтении файла .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5241,8 +5318,8 @@ msgid "E760: No word count in %s" msgstr "E760: Количество слов не указано в %s" #, c-format -msgid "line %6d, word %6d - %s" -msgstr "строка %6d, слово %6d — %s" +msgid "line %6d, word %6ld - %s" +msgstr "строка %6d, слово %6ld — %s" #, c-format msgid "Duplicate word in %s line %d: %s" @@ -5306,10 +5383,6 @@ msgstr "Сжато %d из %d узлов; осталось %d (%d%%)" msgid "Reading back spell file..." msgstr "Чтение записанного файла правописания..." -#. -#. * Go through the trie of good words, soundfold each word and add it to -#. * the soundfold trie. -#. msgid "Performing soundfolding..." msgstr "Выполнение звуковой свёртки..." @@ -5332,8 +5405,9 @@ msgstr "Оценка использования памяти при выполн msgid "E751: Output file name must not have region name" msgstr "E751: Имя выходного файла не должно содержать названия региона" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: Поддерживается не более 8-ми регионов" +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: Поддерживается не более %ld регионов" #, c-format msgid "E755: Invalid region in %s" @@ -5344,82 +5418,60 @@ msgstr "Предупреждение: оба составные и указан #, c-format msgid "Writing spell file %s ..." -msgstr "Запись файла правописания %s ..." - -msgid "Done!" -msgstr "Завершено!" - -#, c-format -msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' не содержит %ld элементов" - -#, c-format -msgid "Word '%.*s' removed from %s" -msgstr "Слово '%.*s' удалено из %s" - -#, c-format -msgid "Word '%.*s' added to %s" -msgstr "Слово '%.*s' добавлено в %s" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: Символы слов отличаются в файлах правописания" - -msgid "Sorry, no suggestions" -msgstr "Извините, нет предположений" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Извините, только %ld предположений" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Заменить \"%.*s\" на:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < \"%.*s\"" - -msgid "E752: No previous spell replacement" -msgstr "E752: Нет предыдущей замены правописания" - -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Не найдено: %s" - -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Это не похоже на файл .sug: %s" +msgstr "Запись файла правописания %s ..." -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Старый файл .sug, требует обновления: %s" +msgid "Done!" +msgstr "Завершено!" #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Файл .sug для более новой версии Vim: %s" +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' не содержит %ld элементов" #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Файл .sug не соответствует файлу .spl: %s" +msgid "Word '%.*s' removed from %s" +msgstr "Слово '%.*s' удалено из %s" #, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: Ошибка при чтении файла .sug: %s" +msgid "Word '%.*s' added to %s" +msgstr "Слово '%.*s' добавлено в %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: Символы слов отличаются в файлах правописания" -#. This should have been checked when generating the .spl -#. * file. msgid "E783: duplicate char in MAP entry" msgstr "E783: Повторяющийся символ в элементе MAP" msgid "No Syntax items defined for this buffer" msgstr "Синтаксические элементы для данного буфера не определены" +msgid "syntax conceal on" +msgstr "синтаксическое скрытие включено" + +msgid "syntax conceal off" +msgstr "синтаксическое скрытие отключено" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Недопустимый параметр: %s" +msgid "syntax case ignore" +msgstr "синтаксическое игнорирование регистра" + +msgid "syntax case match" +msgstr "синтаксическое соответствие регистра" + +msgid "syntax spell toplevel" +msgstr "синтаксическая проверка правописания верхнего уровня" + +msgid "syntax spell notoplevel" +msgstr "синтаксическая проверка правописания без верхнего уровня" + +msgid "syntax spell default" +msgstr "синтаксическая проверка правописания по умолчанию" + +msgid "syntax iskeyword " +msgstr "синтаксическое ключевое слово" + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Синтаксический кластер %s не найден" @@ -5496,6 +5548,10 @@ msgstr "E847: Слишком много синтаксических включ msgid "E789: Missing ']': %s" msgstr "E789: Пропущено ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Лишние символы после ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Пропущено '=': %s" @@ -5648,7 +5704,6 @@ msgstr "E428: Невозможно перейти в позицию за пос msgid "File \"%s\" does not exist" msgstr "Файл \"%s\" не существует" -#. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" msgstr "метка %d из %d%s" @@ -5663,7 +5718,6 @@ msgstr " Используется метка с символами в друго msgid "E429: File \"%s\" does not exist" msgstr "E429: Файл \"%s\" не существует" -#. Highlight title msgid "" "\n" " # TO tag FROM line in file/text" @@ -5694,7 +5748,6 @@ msgstr "Перед байтом %ld" msgid "E432: Tags file not sorted: %s" msgstr "E432: Файл меток не отсортирован: %s" -#. never opened any tags file msgid "E433: No tags file" msgstr "E433: Файл меток не обнаружен" @@ -5730,7 +5783,6 @@ msgstr "E436: В termcap нет записи \"%s\"" msgid "E437: terminal capability \"cm\" required" msgstr "E437: Требуется способность терминала \"cm\"" -#. Highlight title msgid "" "\n" "--- Terminal keys ---" @@ -5738,6 +5790,35 @@ msgstr "" "\n" "--- Кнопки терминала ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Невозможно открыть $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Убить задание в \"%s\"?" + +msgid "Terminal" +msgstr "Терминал" + +msgid "Terminal-finished" +msgstr "Терминал-завершено" + +msgid "active" +msgstr "активно" + +msgid "running" +msgstr "выполнение" + +msgid "finished" +msgstr "завершено" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: Файл существует: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Не является буфером терминала" + msgid "new shell started\n" msgstr "запуск новой оболочки\n" @@ -5747,12 +5828,9 @@ msgstr "Vim: Ошибка чтения ввода, выход...\n" msgid "Used CUT_BUFFER0 instead of empty selection" msgstr "Вместо пустого выделения используется CUT_BUFFER0" -#. This happens when the FileChangedRO autocommand changes the -#. * file in a way it becomes shorter. msgid "E881: Line count changed unexpectedly" msgstr "E881: Неожиданно изменился счётчик строк" -#. must display the prompt msgid "No undo possible; continue anyway" msgstr "Отмена невозможна; продолжать выполнение" @@ -5875,7 +5953,7 @@ msgstr " номер измен. когда сохранено" #, c-format msgid "%ld seconds ago" -msgstr "%ld с назад" +msgstr "%ldс назад" msgid "E790: undojoin is not allowed after undo" msgstr "E790: Объединение отмен не допускается после отмены" @@ -5886,13 +5964,133 @@ msgstr "E439: Повреждён список отмены" msgid "E440: undo line missing" msgstr "E440: Потеряна строка отмены" -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Версия с графическим интерфейсом для MS-Windows 16/32 бит" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Функция %s уже существует. Добавьте !, чтобы заменить её." + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Запись уже существует в словаре" + +msgid "E718: Funcref required" +msgstr "E718: Требуется ссылка на функцию" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Неизвестная функция: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Недопустимый параметр: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Повторяющееся имя параметра: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Слишком много параметров для функции %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Параметры для функции %s заданы неверно" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Глубина вызова функции больше, чем значение 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "вызов %s" + +#, c-format +msgid "%s aborted" +msgstr "%s прервана" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s возвращает #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s возвращает %s" + +msgid "E699: Too many arguments" +msgstr "E699: Слишком много параметров" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Неизвестная функция: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Функция удалена: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Недостаточно параметров для функции %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> используется вне сценария: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Вызов функции dict без словаря: %s" + +msgid "E129: Function name required" +msgstr "E129: Требуется имя функции" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Имя функции должно начинаться с заглавной буквы или \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Имя функции не может содержать двоеточие: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Неопределённая функция: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Пропущена '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: Здесь невозможно использовать g:" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: функция-замыкание не должна быть на верхнем уровне: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: Пропущена команда :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Текст после :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Имя функции конфликтует с переменной: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Невозможно переопределить функцию %s, она используется" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Имя функции не соответствует имени файла сценария: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Невозможно удалить функцию %s, она используется" + +msgid "E133: :return not inside a function" +msgstr "E133: команда :return вне функции" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Пропущены скобки: %s" msgid "" "\n" @@ -5908,9 +6106,6 @@ msgstr "" "\n" "Версия с графическим интерфейсом для MS-Windows 32 бит" -msgid " in Win32s mode" -msgstr " в режиме Win32" - msgid " with OLE support" msgstr " с поддержкой OLE" @@ -5930,45 +6125,17 @@ msgstr "" msgid "" "\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Версия для MS-Windows 16 бит" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Версия для MS-DOS 32 бит" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Версия для MS-DOS 16 бит" - -msgid "" -"\n" -"MacOS X (unix) version" -msgstr "" -"\n" -"Версия для MacOS X (unix)" - -msgid "" -"\n" -"MacOS X version" +"macOS version" msgstr "" "\n" -"Версия для MacOS X" +"Версия для macOS" msgid "" "\n" -"MacOS version" +"macOS version w/o darwin feat." msgstr "" "\n" -"Версия для MacOS" +"Версия для macOS без darwin" msgid "" "\n" @@ -5999,7 +6166,7 @@ msgid "" "Compiled " msgstr "" "\n" -"Скомпилирован " +"Скомпилировано: " msgid "by " msgstr " " @@ -6037,11 +6204,14 @@ msgid "" "Tiny version " msgstr "" "\n" -"Версия \"Кроха\" " +"Крохотная версия " msgid "without GUI." msgstr "без графического интерфейса." +msgid "with GTK3 GUI." +msgstr "с графическим интерфейсом GTK3." + msgid "with GTK2-GNOME GUI." msgstr "с графическим интерфейсом GTK2-GNOME." @@ -6069,11 +6239,8 @@ msgstr "с графическим интерфейсом Carbon." msgid "with Cocoa GUI." msgstr "с графическим интерфейсом Cocoa." -msgid "with (classic) GUI." -msgstr "с классическим графическим интерфейсом." - msgid " Features included (+) or not (-):\n" -msgstr " Включённые (+) и отключённые (-) особенности:\n" +msgstr " Включённые(+) и отключённые(-) особенности:\n" msgid " system vimrc file: \"" msgstr " общесистемный файл vimrc: \"" @@ -6105,6 +6272,9 @@ msgstr " второй пользовательский файл gvimrc: \"" msgid "3rd user gvimrc file: \"" msgstr " третий пользовательский файл gvimrc: \"" +msgid " defaults file: \"" +msgstr " файл умолчаний: \"" + msgid " system menu file: \"" msgstr " общесистемный файл меню: \"" @@ -6136,7 +6306,7 @@ msgid "by Bram Moolenaar et al." msgstr "Брам Мооленаар и другие" msgid "Vim is open source and freely distributable" -msgstr "Vim это свободно распространяемая программа с открытым кодом" +msgstr "Vim — свободно распространяемая программа с открытым кодом" msgid "Help poor children in Uganda!" msgstr "Бедным детям в Уганде нужна ваша помощь!" @@ -6150,8 +6320,8 @@ msgstr "наберите :q<Enter> чтобы выйти из пр msgid "type :help<Enter> or <F1> for on-line help" msgstr "наберите :help<Enter> или <F1> для получения справки " -msgid "type :help version7<Enter> for version info" -msgstr "наберите :help version7<Enter> чтобы узнать об этой версии " +msgid "type :help version8<Enter> for version info" +msgstr "наберите :help version8<Enter> для информации о версии " msgid "Running in Vi compatible mode" msgstr "Работа в Vi-совместимом режиме" @@ -6195,12 +6365,6 @@ msgstr "наберите :help register<Enter> для получения ин msgid "menu Help->Sponsor/Register for information " msgstr "меню Справка->Помощь/Регистрация для получения информации " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ПРЕДУПРЕЖДЕНИЕ: обнаружена Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr "наберите :help windows95<Enter> для получения информации " - msgid "Already only one window" msgstr "На экране всего одно окно" @@ -6232,6 +6396,25 @@ msgstr "E446: Нет имени файла в позиции курсора" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Файл \"%s\" не найден по известным путям" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Неверный ID: %ld (должен быть больше или равен 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID уже занят: %ld" + +msgid "List or number required" +msgstr "Требуется список или число" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Неверный ID: %ld (должен быть больше или равен 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID не найден: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Невозможно загрузить библиотеку %s" @@ -6256,7 +6439,6 @@ msgstr "Сравнить с помощью Vim" msgid "Edit with &Vim" msgstr "Ре&дактировать с помощью Vim" -#. Now concatenate msgid "Edit with existing Vim - " msgstr "Редактировать в запущенном Vim — " @@ -6275,10 +6457,6 @@ msgstr "Слишком длинный путь!" msgid "--No lines in buffer--" msgstr "-- Нет строк в буфере --" -#. -#. * The error messages that can be shared are included here. -#. * Excluded are errors that are only used once and debugging messages. -#. msgid "E470: Command aborted" msgstr "E470: Выполнение команды прервано" @@ -6335,6 +6513,10 @@ msgstr "E236: Шрифт \"%s\" не является моноширинным" msgid "E473: Internal error" msgstr "E473: Внутренняя ошибка" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Внутренняя ошибка: %s" + msgid "Interrupted" msgstr "Прервано" @@ -6348,6 +6530,14 @@ msgstr "E474: Недопустимый параметр" msgid "E475: Invalid argument: %s" msgstr "E475: Недопустимый параметр: %s" +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: Недопустимое значение параметра: %s" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Недопустимое значение параметра %s: %s" + #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Недопустимое выражение: %s" @@ -6366,6 +6556,9 @@ msgstr "E17: \"%s\" является каталогом" msgid "E364: Library call failed for \"%s()\"" msgstr "E364: Неудачный вызов функции \"%s()\" из библиотеки" +msgid "E667: Fsync failed" +msgstr "E667: Не удалось выполнить функцию fsync()" + #, c-format msgid "E448: Could not load library function %s" msgstr "E448: Не удалось загрузить функцию %s из библиотеки" @@ -6462,12 +6655,6 @@ msgstr "E484: Невозможно открыть файл %s" msgid "E485: Can't read file %s" msgstr "E485: Невозможно прочитать файл %s" -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Изменения не сохранены (добавьте !, чтобы обойти проверку)" - -msgid "E37: No write since last change" -msgstr "E37: Изменения не сохранены" - msgid "E38: Null argument" msgstr "E38: Нулевой параметр" @@ -6520,6 +6707,31 @@ msgstr "E46: Невозможно изменить переменную толь msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: Невозможно изменить переменную в песочнице: \"%s\"" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Невозможно использовать пустой ключ для словаря" + +msgid "E715: Dictionary required" +msgstr "E715: Требуется словарь" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Индекс списка за пределами диапазона: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Слишком много параметров для функции %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Нет ключа в словаре: %s" + +msgid "E714: List required" +msgstr "E714: Требуется список" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Параметр %s должен быть списком или словарём" + msgid "E47: Error while reading errorfile" msgstr "E47: Ошибка при чтении файла ошибок" @@ -6579,8 +6791,8 @@ msgstr "" msgid "E80: Error while writing" msgstr "E80: Ошибка при записи" -msgid "Zero count" -msgstr "Нулевое значение счётчика" +msgid "E939: Positive count required" +msgstr "E939: Требуется положительный счётчик" msgid "E81: Using <SID> not in a script context" msgstr "E81: Использование <SID> вне контекста сценария" @@ -6594,16 +6806,16 @@ msgstr "E463: Невозможно изменить охраняемую обл msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans не допускает изменений в файлах только для чтения" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Внутренняя ошибка: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: Шаблон использует больше памяти чем 'maxmempattern'" msgid "E749: empty buffer" msgstr "E749: Пустой буфер" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Буфер %ld не существует" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Неправильная строка поиска или разделитель" @@ -6617,6 +6829,13 @@ msgstr "E764: Опция '%s' не установлена" msgid "E850: Invalid register name" msgstr "E850: Недопустимое имя регистра" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Каталог не найден в '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Автокоманда вызвала рекурсивное поведение" + msgid "search hit TOP, continuing at BOTTOM" msgstr "Поиск будет продолжен с КОНЦА документа" @@ -6724,7 +6943,6 @@ msgstr "Конструктор списка не допускает ключев msgid "list index out of range" msgstr "Индекс списка за пределами диапазона" -#. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" msgstr "Внутренняя ошибка: не удалось получить элемент VIM-списка %d" @@ -6771,9 +6989,6 @@ msgstr "Не существует безымянной функции %s" msgid "function %s does not exist" msgstr "Функция %s не существует" -msgid "function constructor does not accept keyword arguments" -msgstr "Конструктор функции не допускает ключевые слова как аргументы" - #, c-format msgid "failed to run function %s" msgstr "Невозможно выполнить функцию %s" @@ -6861,6 +7076,10 @@ msgstr "" msgid "unable to convert %s to vim dictionary" msgstr "Невозможно преобразовать %s в словарь VIM" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "Невозможно преобразовать %s в список VIM" + #, c-format msgid "unable to convert %s to vim structure" msgstr "Невозможно преобразовать %s в структуру VIM" @@ -6888,3 +7107,5 @@ msgid "" msgstr "" "Ошибка при установке пути: sys.path не является списком\n" "Следует добавить vim.VIM_SPECIAL_PATH в sys.path" + + diff --git a/src/po/sjiscorr.c b/src/po/sjiscorr.c index fec4740c04..2f55b9ec3e 100644 --- a/src/po/sjiscorr.c +++ b/src/po/sjiscorr.c @@ -7,9 +7,7 @@ #include <string.h> int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char buffer[BUFSIZ]; char *p; @@ -23,9 +21,8 @@ main(argc, argv) fputs("charset=cp932", stdout); p += 12; } - else if (strncmp(p, "ja.po - Japanese message file", 29) == 0) + else if (strncmp(p, "# Original translations", 23) == 0) { - fputs("ja.sjis.po - Japanese message file for Vim (version 6.x)\n", stdout); fputs("# generated from ja.po, DO NOT EDIT", stdout); while (p[1] != '\n') ++p; diff --git a/src/po/sk.cp1250.po b/src/po/sk.cp1250.po index dff9e44b70..00eac5f320 100644 --- a/src/po/sk.cp1250.po +++ b/src/po/sk.cp1250.po @@ -3203,6 +3203,7 @@ msgid "" "Delete the .swp file afterwards.\n" "\n" msgstr "Potom vymate odkladac sbor s prponou .swp.\n" +"\n" #. use msg() to start the scrolling properly msgid "Swap files found:" @@ -3673,7 +3674,7 @@ msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " "followed by '%s'." msgstr "" -"E343: Chybn cesta: '**[slo] mus by bu na konci cesty, alebo mus by\n" +"E343: Chybn cesta: '**[slo] mus by bu na konci cesty, alebo mus by " "nasledovan '%s. Vi :help path." #, c-format @@ -5359,8 +5360,8 @@ msgstr "zadajte :q<Enter> pre ukon msgid "type :help<Enter> or <F1> for on-line help" msgstr "zadajte :help<Enter> alebo <F1> pre pomocnka " -msgid "type :help version7<Enter> for version info" -msgstr "zadajte :help version7<Enter> pre informcie o verzii" +msgid "type :help version8<Enter> for version info" +msgstr "zadajte :help version8<Enter> pre informcie o verzii" msgid "Running in Vi compatible mode" msgstr "Pracujem v reime kompatibility s Vi" diff --git a/src/po/sk.po b/src/po/sk.po index 4373e4025b..de0af7dad1 100644 --- a/src/po/sk.po +++ b/src/po/sk.po @@ -3203,6 +3203,7 @@ msgid "" "Delete the .swp file afterwards.\n" "\n" msgstr "Potom vymate odkladac sbor s prponou .swp.\n" +"\n" #. use msg() to start the scrolling properly msgid "Swap files found:" @@ -3673,7 +3674,7 @@ msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " "followed by '%s'." msgstr "" -"E343: Chybn cesta: '**[slo] mus by bu na konci cesty, alebo mus by\n" +"E343: Chybn cesta: '**[slo] mus by bu na konci cesty, alebo mus by " "nasledovan '%s. Vi :help path." #, c-format @@ -5359,8 +5360,8 @@ msgstr "zadajte :q<Enter> pre ukon msgid "type :help<Enter> or <F1> for on-line help" msgstr "zadajte :help<Enter> alebo <F1> pre pomocnka " -msgid "type :help version7<Enter> for version info" -msgstr "zadajte :help version7<Enter> pre informcie o verzii" +msgid "type :help version8<Enter> for version info" +msgstr "zadajte :help version8<Enter> pre informcie o verzii" msgid "Running in Vi compatible mode" msgstr "Pracujem v reime kompatibility s Vi" diff --git a/src/po/sr.po b/src/po/sr.po new file mode 100644 index 0000000000..1cf5f12a3d --- /dev/null +++ b/src/po/sr.po @@ -0,0 +1,7114 @@ +# Serbian Cyrillic Translation for Vim +# +# Do ":help uganda" in Vim to read copying and usage conditions. +# Do ":help credits" in Vim to see a list of people who contributed. +# Copyright (C) 2017 +# This file is distributed under the same license as the Vim package. +# FIRST AUTHOR Ivan Pešić <ivan.pesic@gmail.com>, 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: Vim(Serbian)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-05-15 11:55+0400\n" +"PO-Revision-Date: 2018-05-15 10:50+0400\n" +"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n" +"Language-Team: Serbian <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: bf_key_init() је позвана са празном лозинком" + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) != 4" + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: Blowfish употреба big/little endian је погрешна" + +msgid "E818: sha256 test failed" +msgstr "E818: sha256 тест није успео" + +msgid "E819: Blowfish test failed" +msgstr "E819: Blowfish тест није успео" + +msgid "[Location List]" +msgstr "[Листа локација]" + +msgid "[Quickfix List]" +msgstr "[Quickfix листа]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Аутокоманде су изазвале прекид команде" + +msgid "E82: Cannot allocate any buffer, exiting..." +msgstr "E82: Не може да се резервише меморија ни за један бафер, излазак..." + +msgid "E83: Cannot allocate buffer, using other one..." +msgstr "E83: Не може да се резервише меморија за бафер, користи се други..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: Бафер не може да се региструје" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Покушај брисања бафера који је у употреби" + +msgid "E515: No buffers were unloaded" +msgstr "E515: Ниједан бафер није уклоњен из меморије" + +msgid "E516: No buffers were deleted" +msgstr "E516: Ниједан бафер није обрисан" + +msgid "E517: No buffers were wiped out" +msgstr "E517: Ниједан бафер није очишћен" + +msgid "1 buffer unloaded" +msgstr "1 бафер је уклоњен из меморије" + +#, c-format +msgid "%d buffers unloaded" +msgstr "%d бафера је уклоњено из меморије" + +msgid "1 buffer deleted" +msgstr "1 бафер је обрисан" + +#, c-format +msgid "%d buffers deleted" +msgstr "%d бафера је обрисано" + +msgid "1 buffer wiped out" +msgstr "1 бафер је очишћен" + +#, c-format +msgid "%d buffers wiped out" +msgstr "%d бафера је очишћено" + +msgid "E90: Cannot unload last buffer" +msgstr "E90: Последњи бафер не може да се уклони из меморије" + +msgid "E84: No modified buffer found" +msgstr "E84: Није пронађен измењени бафер" + +msgid "E85: There is no listed buffer" +msgstr "E85: Нема бафера на листи" + +msgid "E87: Cannot go beyond last buffer" +msgstr "E87: Не може да се иде иза последњег бафера" + +msgid "E88: Cannot go before first buffer" +msgstr "E88: Не може да се иде испред првог бафера" + +#, c-format +msgid "E89: No write since last change for buffer %ld (add ! to override)" +msgstr "" +"E89: Од последње измене није било уписа за бафер %ld (додајте ! да " +"премостите)" + +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Задатак се још извршава (додајте ! да зауставите задатак)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Није било уписа од последње промене (додајте ! да премостите)" + +msgid "E948: Job still running" +msgstr "E948: Задатак се и даље извршава" + +msgid "E37: No write since last change" +msgstr "E37: Није било уписа од последње промене" + +msgid "W14: Warning: List of file names overflow" +msgstr "" +"W14: Упозорење: Прекорачена је максимална величина листе имена датотека" + +#, c-format +msgid "E92: Buffer %ld not found" +msgstr "E92: Бафер %ld није пронађен" + +#, c-format +msgid "E93: More than one match for %s" +msgstr "E93: Више од једног подударања са %s" + +#, c-format +msgid "E94: No matching buffer for %s" +msgstr "E94: Ниједан бафер се не подудара са %s" + +#, c-format +msgid "line %ld" +msgstr "линија %ld" + +msgid "E95: Buffer with this name already exists" +msgstr "E95: Бафер са овим именом већ постоји" + +msgid " [Modified]" +msgstr "[Измењено]" + +msgid "[Not edited]" +msgstr "[Није уређивано]" + +msgid "[New file]" +msgstr "[Нова датотека]" + +msgid "[Read errors]" +msgstr "[Грешке при читању]" + +msgid "[RO]" +msgstr "[СЧ]" + +msgid "[readonly]" +msgstr "[само за читање]" + +#, c-format +msgid "1 line --%d%%--" +msgstr "1 линија --%d%%--" + +#, c-format +msgid "%ld lines --%d%%--" +msgstr "%ld линија --%d%%--" + +#, c-format +msgid "line %ld of %ld --%d%%-- col " +msgstr "линија %ld од %ld --%d%%-- кол " + +msgid "[No Name]" +msgstr "[Без имена]" + +msgid "help" +msgstr "помоћ" + +msgid "[Help]" +msgstr "[Помоћ]" + +msgid "[Preview]" +msgstr "[Преглед]" + +msgid "All" +msgstr "Све" + +msgid "Bot" +msgstr "Дно" + +msgid "Top" +msgstr "Врх" + +msgid "" +"\n" +"# Buffer list:\n" +msgstr "" +"\n" +"# Листа бафера:\n" + +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Упис није могућ, постављена је 'buftype' опција" + +msgid "[Scratch]" +msgstr "[Празно]" + +msgid "" +"\n" +"--- Signs ---" +msgstr "" +"\n" +"--- Знаци ---" + +#, c-format +msgid "Signs for %s:" +msgstr "Знаци за %s:" + +#, c-format +msgid " line=%ld id=%d name=%s" +msgstr " линија=%ld ид=%d име=%s" + +msgid "E902: Cannot connect to port" +msgstr "E902: Повезивање на порт није могуће" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() у channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() у channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: примњена команда са аргуменом који није стринг" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: последњи аргумент за expr/call мора бити број" + +msgid "E904: third argument for call must be a list" +msgstr "E904: трећи аргумент за call мора бити листа" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: примљена непозната команда: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): упис док није успостављена веза" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): упис није успео" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Callback не може да се користи са %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: ch_evalexpr()/ch_sendexpr() не може да се користи са raw или nl каналом" + +msgid "E906: not an open channel" +msgstr "E906: није отворен канал" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io датотека захтева да _name буде постављено" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io бафер захтева да in_buf или in_name буде постављено" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: бафер мора бити учитан: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Датотека је шифрована непознатом методом" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Упозорење: Користи се слаба метода шифрирања; погледајте :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Унесите кључ за шифрирање: " + +msgid "Enter same key again: " +msgstr "Унесите исти кључ поново: " + +msgid "Keys don't match!" +msgstr "Кључеви нису исти!" + +msgid "[crypted]" +msgstr "[шифровано]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Недостаје тачка-зарез у Речнику: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Дупликат кључа у Речнику: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Недостаје зарез у Речнику: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Недостаје крај Речника '}': %s" + +msgid "extend() argument" +msgstr "extend() аргумент" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Кључ већ постоји: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: Не може да се упоређује више од %ld бафера" + +msgid "E810: Cannot read or write temp files" +msgstr "E810: Није могуће читање или упис у привремене датотеке" + +msgid "E97: Cannot create diffs" +msgstr "E97: Није могуће креирање diff-ова" + +msgid "Patch file" +msgstr "Patch датотека" + +msgid "E816: Cannot read patch output" +msgstr "E816: Није могуће читање patch излаза" + +msgid "E98: Cannot read diff output" +msgstr "E98: Није могуће читање diff излаза" + +msgid "E99: Current buffer is not in diff mode" +msgstr "E99: Текући бафер није у diff режиму" + +msgid "E793: No other buffer in diff mode is modifiable" +msgstr "E793: Ниједан други бафер у diff режиму није измењив" + +msgid "E100: No other buffer in diff mode" +msgstr "E100: ниједан други бафер није у diff режиму" + +msgid "E101: More than two buffers in diff mode, don't know which one to use" +msgstr "E101: Више од два бафера су у diff режиму, не знам који да користим" + +#, c-format +msgid "E102: Can't find buffer \"%s\"" +msgstr "E102: Бафер \"%s\" не може да се пронађе" + +#, c-format +msgid "E103: Buffer \"%s\" is not in diff mode" +msgstr "E103: Бафер \"%s\" није у diff режиму" + +msgid "E787: Buffer changed unexpectedly" +msgstr "E787: Бафер је неочекивано измењен" + +msgid "E104: Escape not allowed in digraph" +msgstr "E104: Escape није дозвољен у digraph" + +msgid "E544: Keymap file not found" +msgstr "E544: Keymap датотека није пронађена" + +msgid "E105: Using :loadkeymap not in a sourced file" +msgstr "E105: Коришћење :loadkeymap ван датотеке која се учитава као скрипта" + +msgid "E791: Empty keymap entry" +msgstr "E791: Празна keymap ставка" + +msgid " Keyword completion (^N^P)" +msgstr " Довршавање кључне речи (^N^P)" + +msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" +msgstr " ^X режим (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" + +msgid " Whole line completion (^L^N^P)" +msgstr " Довршавање целе линије (^L^N^P)" + +msgid " File name completion (^F^N^P)" +msgstr " Довршавање имена датотеке (^F^N^P)" + +msgid " Tag completion (^]^N^P)" +msgstr " Довршавање ознаке (^]^N^P)" + +msgid " Path pattern completion (^N^P)" +msgstr " Довршавање шаблона путање (^N^P)" + +msgid " Definition completion (^D^N^P)" +msgstr " Довршавање дефиниције (^D^N^P)" + +msgid " Dictionary completion (^K^N^P)" +msgstr " Довршавање речника (^K^N^P)" + +msgid " Thesaurus completion (^T^N^P)" +msgstr " Довршавање речника синонима (^T^N^P)" + +msgid " Command-line completion (^V^N^P)" +msgstr " Довршавање командне линије (^V^N^P)" + +msgid " User defined completion (^U^N^P)" +msgstr " Кориснички дефинисано довршавање (^U^N^P)" + +msgid " Omni completion (^O^N^P)" +msgstr " Omni довршавање (^O^N^P)" + +msgid " Spelling suggestion (s^N^P)" +msgstr " Правописни предлог (s^N^P)" + +msgid " Keyword Local completion (^N^P)" +msgstr " Довршавање локалне кључне речи (^N^P)" + +msgid "Hit end of paragraph" +msgstr "Достигнут крај пасуса" + +msgid "E839: Completion function changed window" +msgstr "E839: Функција довршавања је променила прозор" + +msgid "E840: Completion function deleted text" +msgstr "E840: Функција довршавања је обрисала текст" + +msgid "'dictionary' option is empty" +msgstr "Опција 'dictionary' је празна" + +msgid "'thesaurus' option is empty" +msgstr "Опција 'thesaurus' је празна" + +#, c-format +msgid "Scanning dictionary: %s" +msgstr "Скенирање речника: %s" + +msgid " (insert) Scroll (^E/^Y)" +msgstr " (уметање) Скроловање (^E/^Y)" + +msgid " (replace) Scroll (^E/^Y)" +msgstr " (замена) Скроловање (^E/^Y)" + +#, c-format +msgid "Scanning: %s" +msgstr "Скенирање: %s" + +msgid "Scanning tags." +msgstr "Скенирање ознака." + +msgid "match in file" +msgstr "подударање у датотеци" + +msgid " Adding" +msgstr " Додавање" + +msgid "-- Searching..." +msgstr "-- Претрага..." + +msgid "Back at original" +msgstr "Назад на оригинал" + +msgid "Word from other line" +msgstr "Реч из друге линије" + +msgid "The only match" +msgstr "Једино подударање" + +#, c-format +msgid "match %d of %d" +msgstr "подударање %d од %d" + +#, c-format +msgid "match %d" +msgstr "подударање %d" + +msgid "E18: Unexpected characters in :let" +msgstr "E18: Неочекивани карактери у :let" + +#, c-format +msgid "E121: Undefined variable: %s" +msgstr "E121: Недефинисана променљива: %s" + +msgid "E111: Missing ']'" +msgstr "E111: Недостаје ']'" + +msgid "E719: Cannot use [:] with a Dictionary" +msgstr "E719: Не може да се користи [:] са Речником" + +#, c-format +msgid "E734: Wrong variable type for %s=" +msgstr "E734: Погрешан тип променљиве за %s=" + +#, c-format +msgid "E461: Illegal variable name: %s" +msgstr "E461: Недозвољено име променљиве: %s" + +msgid "E806: using Float as a String" +msgstr "E806: коришћење Float као String" + +msgid "E687: Less targets than List items" +msgstr "E687: Мање одредишта него ставки Листе" + +msgid "E688: More targets than List items" +msgstr "E688: Више одредишта него ставки Листе" + +msgid "Double ; in list of variables" +msgstr "Дупле ; у листи променљивих" + +#, c-format +msgid "E738: Can't list variables for %s" +msgstr "E738: Не може да се прикаже листа променљивих за %s" + +msgid "E689: Can only index a List or Dictionary" +msgstr "E689: Само Листа или Речник могу да се индексирају" + +msgid "E708: [:] must come last" +msgstr "E708: [:] мора да буде последња" + +msgid "E709: [:] requires a List value" +msgstr "E709: [:] захтева вредност типа List" + +msgid "E710: List value has more items than target" +msgstr "E710: Вредност типа List има више ставки него одредиште" + +msgid "E711: List value has not enough items" +msgstr "E711: Вредност типа List нема довољно ставки" + +msgid "E690: Missing \"in\" after :for" +msgstr "E690: Недостаје \"in\" након :for" + +#, c-format +msgid "E108: No such variable: \"%s\"" +msgstr "E108: Не постоји таква променљива: \"%s\"" + +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Не може да се откључа или закључа променљива %s" + +msgid "E743: variable nested too deep for (un)lock" +msgstr "E743: променљива је угњеждена сувише дубоко да би се за(от)кључала" + +msgid "E109: Missing ':' after '?'" +msgstr "E109: Недостаје ':' након '?'" + +msgid "E804: Cannot use '%' with Float" +msgstr "E804: '%' не може да се користи са Float" + +msgid "E110: Missing ')'" +msgstr "E110: Недостаје ')'" + +msgid "E695: Cannot index a Funcref" +msgstr "E695: Funcref не може да се индексира" + +msgid "E909: Cannot index a special variable" +msgstr "E909: Специјална променљива не може да се индексира" + +#, c-format +msgid "E112: Option name missing: %s" +msgstr "E112: Недостаје име опције: %s" + +#, c-format +msgid "E113: Unknown option: %s" +msgstr "E113: Непозната опција: %s" + +#, c-format +msgid "E114: Missing quote: %s" +msgstr "E114: Недостаје наводник: %s" + +#, c-format +msgid "E115: Missing quote: %s" +msgstr "E115: Недостаје наводник: %s" + +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Нема довољно меморије за постављање референци, прекинуто је скупљање отпада" + +msgid "E724: variable nested too deep for displaying" +msgstr "E724: променљива је угњеждена предубоко да би се приказала" + +msgid "E805: Using a Float as a Number" +msgstr "E805: Користи се Float као Number" + +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Користи се Funcref као Number" + +msgid "E745: Using a List as a Number" +msgstr "E745: Користи се List као Number" + +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Користи се Dictionary као Number" + +msgid "E910: Using a Job as a Number" +msgstr "E910: Користи се Job као Number" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Користи се Channel као Number" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Користи се Funcref као Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: Користи се String као Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: Користи се List као Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Користи се Dictionary као Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Користи се специјална вредност као Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Користи се Job као Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Користи се Channel као Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: користи се Funcref као String" + +msgid "E730: using List as a String" +msgstr "E730: користи се List као String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: користи се Dictionary као String" + +msgid "E908: using an invalid value as a String" +msgstr "E908: користи се недозвољена вредност као String" + +#, c-format +msgid "E795: Cannot delete variable %s" +msgstr "E795: Променљива %s не може да се обрише" + +#, c-format +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Име Funcref мора да почне великим словом: %s" + +#, c-format +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Име променљиве је у конфликту са постојећом функцијом: %s" + +#, c-format +msgid "E741: Value is locked: %s" +msgstr "E741: Вредност је закључана: %s" + +msgid "Unknown" +msgstr "Непознато" + +#, c-format +msgid "E742: Cannot change value of %s" +msgstr "E742: Вредност %s не може да се промени" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: променљива је предубоко угњеждена да би се направила копија" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# глобалне променљиве:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tПоследњи сет од " + +msgid "E691: Can only compare List with List" +msgstr "E691: List може да се пореди само са List" + +msgid "E692: Invalid operation for List" +msgstr "E692: Неисправна операција за List" + +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Dictionary може да се пореди само са Dictionary" + +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: Неисправна операција за Dictionary" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: Неисправна операција за Funcrefs" + +msgid "map() argument" +msgstr "map() аргумент" + +msgid "filter() argument" +msgstr "filter() аргумент" + +#, c-format +msgid "E686: Argument of %s must be a List" +msgstr "E686: Аргумент за %s мора бити List" + +msgid "E928: String required" +msgstr "E928: Захтева се String" + +msgid "E808: Number or Float required" +msgstr "E808: Захтева се Number или Float" + +msgid "add() argument" +msgstr "add() аргумент" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() може да се користи само у режиму Уметање" + +msgid "&Ok" +msgstr "&Ок" + +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld линија: " +msgstr[1] "+-%s%3ld линија: " + +#, c-format +msgid "E700: Unknown function: %s" +msgstr "E700: Непозната функција: %s" + +msgid "E922: expected a dict" +msgstr "E922: очекивао се dict" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Други аргумент function() мора бити list или dict" + +msgid "" +"&OK\n" +"&Cancel" +msgstr "" +"&OK\n" +"О&ткажи" + +msgid "called inputrestore() more often than inputsave()" +msgstr "inputrestore() је позвана више пута него inputsave()" + +msgid "insert() argument" +msgstr "insert() аргумент" + +msgid "E786: Range not allowed" +msgstr "E786: Опсег није дозвољен" + +msgid "E916: not a valid job" +msgstr "E916: није валидан job" + +msgid "E701: Invalid type for len()" +msgstr "E701: Неисправан тип за len()" + +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ИД је резервисан за \":match\": %ld" + +msgid "E726: Stride is zero" +msgstr "E726: Корак је нула" + +msgid "E727: Start past end" +msgstr "E727: Почетак иза краја" + +msgid "<empty>" +msgstr "<празно>" + +msgid "E240: No connection to the X server" +msgstr "E240: Нема везе са X сервером" + +#, c-format +msgid "E241: Unable to send to %s" +msgstr "E241: Слање ка %s није могуће" + +msgid "E277: Unable to read a server reply" +msgstr "E277: Не може да се прочита одговор сервера" + +msgid "E941: already started a server" +msgstr "E941: сервер је већ покренут" + +msgid "E942: +clientserver feature not available" +msgstr "E942: Могућност +clientserver није доступна" + +msgid "remove() argument" +msgstr "remove() аргумент" + +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Превише симболичких веза (циклус?)" + +msgid "reverse() argument" +msgstr "reverse() аргумент" + +msgid "E258: Unable to send to client" +msgstr "E258: Слање ка клијенту није могуће" + +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Неисправна акција: '%s'" + +msgid "sort() argument" +msgstr "sort() аргумент" + +msgid "uniq() argument" +msgstr "uniq() аргумент" + +msgid "E702: Sort compare function failed" +msgstr "E702: Sort функција поређења није успела" + +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq функција поређења није успела" + +msgid "(Invalid)" +msgstr "(Неисправно)" + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: неисправан број подпоклапања: %d" + +msgid "E677: Error writing temp file" +msgstr "E677: Грешка при упису temp датотеке" + +msgid "E921: Invalid callback argument" +msgstr "E921: Неисправан callback аргумент" + +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s" +msgstr "<%s>%s%s %d, Хекс %02x, Окт %03o, Дигр %s" + +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Хекс %02x, Октално %03o" + +#, c-format +msgid "> %d, Hex %04x, Oct %o, Digr %s" +msgstr "> %d, Хекс %04x, Окт %o, Дигр %s" + +#, c-format +msgid "> %d, Hex %08x, Oct %o, Digr %s" +msgstr "> %d, Хекс %08x, Окт %o, Дигр %s" + +#, c-format +msgid "> %d, Hex %04x, Octal %o" +msgstr "> %d, Хекс %04x, Октално %o" + +#, c-format +msgid "> %d, Hex %08x, Octal %o" +msgstr "> %d, Хекс %08x, Октално %o" + +msgid "E134: Move lines into themselves" +msgstr "E134: Премештање линија у саме себе" + +msgid "1 line moved" +msgstr "1 линија премештена" + +#, c-format +msgid "%ld lines moved" +msgstr "%ld линија премештено" + +#, c-format +msgid "%ld lines filtered" +msgstr "%ld линија филтрирано" + +msgid "E135: *Filter* Autocommands must not change current buffer" +msgstr "E135: *Филтер* Аутокоманде не смеју да мењају текући бафер" + +msgid "[No write since last change]\n" +msgstr "[Нема уписа од последње промене]\n" + +#, c-format +msgid "%sviminfo: %s in line: " +msgstr "%sviminfo: %s у линији: " + +msgid "E136: viminfo: Too many errors, skipping rest of file" +msgstr "E136: viminfo: Превише грешака, остатак датотеке се прескаче" + +#, c-format +msgid "Reading viminfo file \"%s\"%s%s%s" +msgstr "Читање viminfo датотеке \"%s\"%s%s%s" + +msgid " info" +msgstr " инфо" + +msgid " marks" +msgstr " маркера" + +msgid " oldfiles" +msgstr " старихдатотека" + +msgid " FAILED" +msgstr " НЕУСПЕЛО" + +#, c-format +msgid "E137: Viminfo file is not writable: %s" +msgstr "E137: Viminfo датотека није уписива: %s" + +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Превише viminfo temp датотека, као %s!" + +#, c-format +msgid "E138: Can't write viminfo file %s!" +msgstr "E138: Viminfo датотека %s не може да се упише!" + +#, c-format +msgid "Writing viminfo file \"%s\"" +msgstr "Уписивање viminfo датотеке \"%s\"" + +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Viminfo датотека не може да се преименује у %s!" + +#, c-format +msgid "# This viminfo file was generated by Vim %s.\n" +msgstr "# Ову viminfo датотеку је генерисао Vim %s.\n" + +msgid "" +"# You may edit it if you're careful!\n" +"\n" +msgstr "" +"# Можете да је уређујете ако сте опрезни!\n" +"\n" + +msgid "# Value of 'encoding' when this file was written\n" +msgstr "# Вредност опције 'encoding' када је ова датотека написана\n" + +msgid "Illegal starting char" +msgstr "Неисправан почетни карактер" + +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Преградне линије, копиране дословно:\n" + +msgid "Save As" +msgstr "Сачувај као" + +msgid "Write partial file?" +msgstr "Да упишем парцијалну датотеку?" + +msgid "E140: Use ! to write partial buffer" +msgstr "E140: Користите ! да бисте уписали парцијални бафер" + +#, c-format +msgid "Overwrite existing file \"%s\"?" +msgstr "Да препишем постојећи датотеку \"%s\"?" + +#, c-format +msgid "Swap file \"%s\" exists, overwrite anyway?" +msgstr "Swap датотека \"%s\" постоји, да је препишем у сваком случају?" + +#, c-format +msgid "E768: Swap file exists: %s (:silent! overrides)" +msgstr "E768: Swap датотека постоји: %s (:silent! премошћава)" + +#, c-format +msgid "E141: No file name for buffer %ld" +msgstr "E141: Нема имена датотеке за бафер %ld" + +msgid "E142: File not written: Writing is disabled by 'write' option" +msgstr "E142: Датотека није уписана: Уписивање је онемогућено опцијом 'write'" + +#, c-format +msgid "" +"'readonly' option is set for \"%s\".\n" +"Do you wish to write anyway?" +msgstr "" +"'readonly' опција је постављена за \"%s\".\n" +"Да ли ипак желите да упишете?" + +#, c-format +msgid "" +"File permissions of \"%s\" are read-only.\n" +"It may still be possible to write it.\n" +"Do you wish to try?" +msgstr "" +"Дозволе датотеке \"%s\" омогућавају само читање.\n" +"Можда је ипак могуће да се упише.\n" +"Да ли желите да покушате?" + +#, c-format +msgid "E505: \"%s\" is read-only (add ! to override)" +msgstr "E505: \"%s\" је само за читање (додајте ! за премошћавање)" + +msgid "Edit File" +msgstr "Уреди датотеку" + +#, c-format +msgid "E143: Autocommands unexpectedly deleted new buffer %s" +msgstr "E143: Аутокоманде су неочекивано обрисале нов бафер %s" + +msgid "E144: non-numeric argument to :z" +msgstr "E144: ненумерички аргумент за :z" + +msgid "E145: Shell commands not allowed in rvim" +msgstr "E145: Shell команде нису дозвољене у rvim" + +msgid "E146: Regular expressions can't be delimited by letters" +msgstr "E146: Регуларни изрази не могу да се раздвајају словима" + +#, c-format +msgid "replace with %s (y/n/a/q/l/^E/^Y)?" +msgstr "заменити са %s (y/n/a/q/l/^E/^Y)?" + +msgid "(Interrupted) " +msgstr "(Прекинуто)" + +msgid "1 match" +msgstr "1 подударање" + +msgid "1 substitution" +msgstr "1 замена" + +#, c-format +msgid "%ld matches" +msgstr "%ld подударања" + +#, c-format +msgid "%ld substitutions" +msgstr "%ld замена" + +msgid " on 1 line" +msgstr " у 1 линији" + +#, c-format +msgid " on %ld lines" +msgstr " у %ld линија" + +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global не може да се изврши рекурзивно са опсегом" + +msgid "E148: Regular expression missing from global" +msgstr "E148: У global недостаје регуларни израз" + +#, c-format +msgid "Pattern found in every line: %s" +msgstr "Шаблон је пронаћен у свакој линији: %s" + +#, c-format +msgid "Pattern not found: %s" +msgstr "Шаблон није пронађен: %s" + +msgid "" +"\n" +"# Last Substitute String:\n" +"$" +msgstr "" +"\n" +"# Последњи Стринг за замену:\n" +"$" + +msgid "E478: Don't panic!" +msgstr "E478: Не паничите!" + +#, c-format +msgid "E661: Sorry, no '%s' help for %s" +msgstr "E661: Жао нам је, нема '%s' помоћи за %s" + +#, c-format +msgid "E149: Sorry, no help for %s" +msgstr "E149: Жао нам је, нема помоћи за %s" + +#, c-format +msgid "Sorry, help file \"%s\" not found" +msgstr "Жао нам је, датотека помоћи \"%s\" није пронађена" + +#, c-format +msgid "E151: No match: %s" +msgstr "E151: Нема подударања: %s" + +#, c-format +msgid "E152: Cannot open %s for writing" +msgstr "E152: %s не може да се отвори за упис" + +#, c-format +msgid "E153: Unable to open %s for reading" +msgstr "E153: %s не може да се отвори за читање" + +#, c-format +msgid "E670: Mix of help file encodings within a language: %s" +msgstr "E670: Помешано је више кодирања фајлова помоћи за језик: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: Дуплирана ознака \"%s\" у датотеци %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Није директоријум: %s" + +#, c-format +msgid "E160: Unknown sign command: %s" +msgstr "E160: Непозната знак команда: %s" + +msgid "E156: Missing sign name" +msgstr "E156: Недостаје име знака" + +msgid "E612: Too many signs defined" +msgstr "E612: Дефинисано је превише знакова" + +#, c-format +msgid "E239: Invalid sign text: %s" +msgstr "E239: Неисправан текст знака: %s" + +#, c-format +msgid "E155: Unknown sign: %s" +msgstr "E155: Непознат знак: %s" + +msgid "E159: Missing sign number" +msgstr "E159: Недостаје број знака" + +#, c-format +msgid "E158: Invalid buffer name: %s" +msgstr "E158: Неисправно име бафера: %s" + +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Не може да се скочи на бафер који нема име`" + +#, c-format +msgid "E157: Invalid sign ID: %ld" +msgstr "E157: Неисправан ИД знака: %ld" + +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Знак %s не може да се промени" + +msgid " (NOT FOUND)" +msgstr " (НИЈЕ ПРОНАЂЕНО)" + +msgid " (not supported)" +msgstr " (није подржано)" + +msgid "[Deleted]" +msgstr "[Обрисано]" + +msgid "No old files" +msgstr "Нема старих датотека" + +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "Улазак у Debug режим. Откуцајте \"cont\" за наставак." + +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Старавред = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Новаавред = \"%s\"" + +#, c-format +msgid "line %ld: %s" +msgstr "линија %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "ком: %s" + +msgid "frame is zero" +msgstr "оквир је нула" + +#, c-format +msgid "frame at highest level: %d" +msgstr "оквир је на највишем нивоу: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "Прекидна тачка у \"%s%s\" линија %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: Прекидна тачка није пронађена: %s" + +msgid "No breakpoints defined" +msgstr "Није дефинисана ниједна прекидна тачка" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s линија %ld" + +#, c-format +msgid "%3d expr %s" +msgstr "%3d израз %s" + +msgid "E750: First use \":profile start {fname}\"" +msgstr "E750: Најпре користите \":profile start {fname}\"" + +#, c-format +msgid "Save changes to \"%s\"?" +msgstr "Да сачувам промене у \"%s\"?" + +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Задатак се и даље извршава у баферу \"%s\"" + +#, c-format +msgid "E162: No write since last change for buffer \"%s\"" +msgstr "E162: Није било уписа од последње промене за бафер \"%s\"" + +msgid "Warning: Entered other buffer unexpectedly (check autocommands)" +msgstr "Упозорење: Неочекивано се прешло у други бафер (проверите аутокоманде)" + +msgid "E163: There is only one file to edit" +msgstr "E163: Постоји само једна датотека за уређивање" + +msgid "E164: Cannot go before first file" +msgstr "E164: Не може да се иде испред прве датотеке" + +msgid "E165: Cannot go beyond last file" +msgstr "E165: Не може да се иде испред прве датотеке" + +#, c-format +msgid "E666: compiler not supported: %s" +msgstr "E666: компајлер није подржан: %s" + +#, c-format +msgid "Searching for \"%s\" in \"%s\"" +msgstr "Тражи се \"%s\" у \"%s\"" + +#, c-format +msgid "Searching for \"%s\"" +msgstr "Тражи се\"%s\"" + +#, c-format +msgid "not found in '%s': \"%s\"" +msgstr "није пронађено у '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "" +"W20: Захтевани python version 2.x није подржан, датотека: %s се игнорише" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "" +"W21: Захтевани python version 3.x није подржан, датотека: %s се игнорише" + +msgid "Source Vim script" +msgstr "Изворна Vim скрипта" + +#, c-format +msgid "Cannot source a directory: \"%s\"" +msgstr "Директоријум не може да буде извор: \"%s\"" + +#, c-format +msgid "could not source \"%s\"" +msgstr "не може бити извор \"%s\"" + +#, c-format +msgid "line %ld: could not source \"%s\"" +msgstr "линија %ld: не може бити извор \"%s\"" + +#, c-format +msgid "sourcing \"%s\"" +msgstr "прибављање \"%s\"" + +#, c-format +msgid "line %ld: sourcing \"%s\"" +msgstr "линија %ld: прибављање \"%s\"" + +#, c-format +msgid "finished sourcing %s" +msgstr "завршено прибављање %s" + +#, c-format +msgid "continuing in %s" +msgstr "наставља се у %s" + +msgid "modeline" +msgstr "режимска линија (modeline)" + +msgid "--cmd argument" +msgstr "--cmd аргумент" + +msgid "-c argument" +msgstr "-c аргумент" + +msgid "environment variable" +msgstr "променљива окружења" + +msgid "error handler" +msgstr "процедура за обраду грешке" + +msgid "W15: Warning: Wrong line separator, ^M may be missing" +msgstr "W15: Упозорење: Погрешан сепаратор линије, можда недостаје ^M" + +msgid "E167: :scriptencoding used outside of a sourced file" +msgstr "E167: :scriptencoding се користи ван изворишне датотеке" + +msgid "E168: :finish used outside of a sourced file" +msgstr "E168: :finish се користи ван изворишне датотеке" + +#, c-format +msgid "Current %slanguage: \"%s\"" +msgstr "Текући %sјезик: \"%s\"" + +#, c-format +msgid "E197: Cannot set language to \"%s\"" +msgstr "E197: Језик не може да се постави на \"%s\"" + +msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." +msgstr "" +"Улазак у Ex режим. Откуцајте \"visual\" да бисте прешли у Нормални режим." + +msgid "E501: At end-of-file" +msgstr "E501: На крају-датотеке" + +msgid "E169: Command too recursive" +msgstr "E169: Команда је сувише рекурзивна" + +#, c-format +msgid "E605: Exception not caught: %s" +msgstr "E605: Изузетак није ухваћен: %s" + +msgid "End of sourced file" +msgstr "Крај изворишне датотеке" + +msgid "End of function" +msgstr "Крај функције" + +msgid "E464: Ambiguous use of user-defined command" +msgstr "E464: Двосмислена употреба кориснички дефинисане команде" + +msgid "E492: Not an editor command" +msgstr "E492: Није команда едитора" + +msgid "E493: Backwards range given" +msgstr "E493: Задат је опсег уназад" + +msgid "Backwards range given, OK to swap" +msgstr "Задат је опсег уназад, ОК да се замени" + +msgid "E494: Use w or w>>" +msgstr "E494: Користите w или w>>" + +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Табела команди мора да се освежи, покрените 'make cmdidxs'" + +msgid "E319: Sorry, the command is not available in this version" +msgstr "E319: Жао нам је, та команда није доступна у овој верзији" + +msgid "1 more file to edit. Quit anyway?" +msgstr "Још 1 датотека за уређивање. Ипак желите да напустите програм?" + +#, c-format +msgid "%d more files to edit. Quit anyway?" +msgstr "Још %d датотека за уређивање. Ипак желите да напустите програм?" + +msgid "E173: 1 more file to edit" +msgstr "E173: Још 1 датотека за уређивање" + +#, c-format +msgid "E173: %ld more files to edit" +msgstr "E173: Још %ld датотека за уређивање" + +msgid "E174: Command already exists: add ! to replace it" +msgstr "E174: Команда већ постоји: додајте ! да је замените" + +msgid "" +"\n" +" Name Args Address Complete Definition" +msgstr "" +"\n" +" Име Аргум Адреса Довршење Дефиниција" + +msgid "No user-defined commands found" +msgstr "Нису пронађене кориснички дефинисане команде" + +msgid "E175: No attribute specified" +msgstr "E175: Није наведен ни један атрибут" + +msgid "E176: Invalid number of arguments" +msgstr "E176: Неисправан број аргумената" + +msgid "E177: Count cannot be specified twice" +msgstr "E177: Бројач не може да се наведе два пута" + +msgid "E178: Invalid default value for count" +msgstr "E178: Несправна подразумевана вредност за бројач" + +msgid "E179: argument required for -complete" +msgstr "E179: потребан је аргумент за -complete" + +msgid "E179: argument required for -addr" +msgstr "E179: потребан је аргумент за -addr" + +#, c-format +msgid "E181: Invalid attribute: %s" +msgstr "E181: Неисправан атрибут: %s" + +msgid "E182: Invalid command name" +msgstr "E182: Неисправно име команде" + +msgid "E183: User defined commands must start with an uppercase letter" +msgstr "E183: Кориснички дефинисане команде морају да почну великим словом" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "" +"E841: Резервисано име, не може да се користи за кориснички дефинисану команду" + +#, c-format +msgid "E184: No such user-defined command: %s" +msgstr "E184: Не постоји таква кориснички дефинисана команда: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Неисправна вредност адресног типа: %s" + +#, c-format +msgid "E180: Invalid complete value: %s" +msgstr "E180: Неисправна вредност довршавања: %s" + +msgid "E468: Completion argument only allowed for custom completion" +msgstr "E468: Аргумент довршавања је дозвољен само за прилагођена довршавања" + +msgid "E467: Custom completion requires a function argument" +msgstr "E467: Прилагођено довршавање захтева аргумент функције" + +msgid "unknown" +msgstr "непознато" + +#, c-format +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Шема боја '%s' не може да се пронађе" + +msgid "Greetings, Vim user!" +msgstr "Поздрав, корисниче Vim-a" + +msgid "E784: Cannot close last tab page" +msgstr "E784: Последња картица не може да се затвори" + +msgid "Already only one tab page" +msgstr "Већ сте на само једној картици" + +msgid "Edit File in new window" +msgstr "Уређивање Датотеке у новом прозору" + +#, c-format +msgid "Tab page %d" +msgstr "Картица %d" + +msgid "No swap file" +msgstr "Нема swap датотеке" + +msgid "Append File" +msgstr "Додавање на крај Датотеке" + +msgid "E747: Cannot change directory, buffer is modified (add ! to override)" +msgstr "" +"E747: Директоријум не може да се промени, бафер је измењен (додајте ! за " +"премошћавање)" + +msgid "E186: No previous directory" +msgstr "E186: Нема претгодног директоријума" + +msgid "E187: Unknown" +msgstr "E187: Непознато" + +msgid "E465: :winsize requires two number arguments" +msgstr "E465: :winsize захтева два бројчана аргумента" + +#, c-format +msgid "Window position: X %d, Y %d" +msgstr "Позиција прозора: X %d, Y %d" + +msgid "E188: Obtaining window position not implemented for this platform" +msgstr "E188: Добављање позиције прозора није имплементирано за ову платформу" + +msgid "E466: :winpos requires two number arguments" +msgstr "E466: :winpos захтева два бројчана аргумента" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: :redir не може да се користи унутар execute()" + +msgid "Save Redirection" +msgstr "Сачувај Редирекцију" + +msgid "Save View" +msgstr "Сачувај Поглед" + +msgid "Save Session" +msgstr "Сачувај Сесију" + +msgid "Save Setup" +msgstr "Сачувај Подешавање" + +#, c-format +msgid "E739: Cannot create directory: %s" +msgstr "E739: Директоријум не може да се креира: %s" + +#, c-format +msgid "E189: \"%s\" exists (add ! to override)" +msgstr "E189: \"%s\" постоји (додајте ! за премошћавање)" + +#, c-format +msgid "E190: Cannot open \"%s\" for writing" +msgstr "E190: \"%s\" не може да се отвори за упис" + +msgid "E191: Argument must be a letter or forward/backward quote" +msgstr "E191: Аргумент мора бити слово или апостроф/обрнути апостроф" + +msgid "E192: Recursive use of :normal too deep" +msgstr "E192: Рекурзивно коришћење :normal је сувише дубоко" + +msgid "E809: #< is not available without the +eval feature" +msgstr "E809: #< није доступно без +eval могућности" + +msgid "E194: No alternate file name to substitute for '#'" +msgstr "E194: Нема алтернативног имена које би заменило '#'" + +msgid "E495: no autocommand file name to substitute for \"<afile>\"" +msgstr "E495: нема имена датотеке за аутокоманде које би заменило \"<afile>\"" + +msgid "E496: no autocommand buffer number to substitute for \"<abuf>\"" +msgstr "E496: нема броја бафера за аутокоманду који би заменио \"<abuf>\"" + +msgid "E497: no autocommand match name to substitute for \"<amatch>\"" +msgstr "E497: нема имена подударања аутокоманде које би заменило \"<amatch>\"" + +msgid "E498: no :source file name to substitute for \"<sfile>\"" +msgstr "E498: нема имена :source датотеке које би заменило \"<sfile>\"" + +msgid "E842: no line number to use for \"<slnum>\"" +msgstr "E842: нема броја линије који би се користио за \"<slnum>\"" + +#, no-c-format +msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" +msgstr "E499: Празно име датотеке за'%' or '#', функционише само са \":p:h\"" + +msgid "E500: Evaluates to an empty string" +msgstr "E500: Резултат израчунавања је празан стринг" + +msgid "E195: Cannot open viminfo file for reading" +msgstr "E195: viminfo датотека не може да се отвори за читање" + +msgid "Untitled" +msgstr "Без наслова" + +msgid "E196: No digraphs in this version" +msgstr "E196: У овој верзији нема диграфа" + +msgid "E608: Cannot :throw exceptions with 'Vim' prefix" +msgstr "E608: :throw изузетка са 'Vim' префиксом није дозвољен" + +#, c-format +msgid "Exception thrown: %s" +msgstr "Бачен је изузетак: %s" + +#, c-format +msgid "Exception finished: %s" +msgstr "Изузетак је завршен: %s" + +#, c-format +msgid "Exception discarded: %s" +msgstr "Изузетак је одбачен: %s" + +#, c-format +msgid "%s, line %ld" +msgstr "%s, линија %ld" + +#, c-format +msgid "Exception caught: %s" +msgstr "Изузетак је ухваћен: %s" + +#, c-format +msgid "%s made pending" +msgstr "%s је стављен на чекање" + +#, c-format +msgid "%s resumed" +msgstr "%s је поново активан" + +#, c-format +msgid "%s discarded" +msgstr "%s је одбачен" + +msgid "Exception" +msgstr "Изузетак" + +msgid "Error and interrupt" +msgstr "Грешка и прекид" + +msgid "Error" +msgstr "Грешка" + +msgid "Interrupt" +msgstr "Прекид" + +msgid "E579: :if nesting too deep" +msgstr "E579: :if угњеждавање је сувише дубоко" + +msgid "E580: :endif without :if" +msgstr "E580: :endif без :if" + +msgid "E581: :else without :if" +msgstr "E581: :else без :if" + +msgid "E582: :elseif without :if" +msgstr "E582: :elseif без :if" + +msgid "E583: multiple :else" +msgstr "E583: вишеструко :else" + +msgid "E584: :elseif after :else" +msgstr "E584: :elseif након :else" + +msgid "E585: :while/:for nesting too deep" +msgstr "E585: :while/:for угњеждавање је сувише дубоко" + +msgid "E586: :continue without :while or :for" +msgstr "E586: :continue без :while или :for" + +msgid "E587: :break without :while or :for" +msgstr "E587: :break без :while или :for" + +msgid "E732: Using :endfor with :while" +msgstr "E732: Коришћење :endfor са :while" + +msgid "E733: Using :endwhile with :for" +msgstr "E733: Коришћење :endwhile са :for" + +msgid "E601: :try nesting too deep" +msgstr "E601: :try угњеждавање је сувише дубоко" + +msgid "E603: :catch without :try" +msgstr "E603: :catch без :try" + +msgid "E604: :catch after :finally" +msgstr "E604: :catch након :finally" + +msgid "E606: :finally without :try" +msgstr "E606: :finally без :try" + +msgid "E607: multiple :finally" +msgstr "E607: вишеструко :finally" + +msgid "E602: :endtry without :try" +msgstr "E602: :endtry без :try" + +msgid "E193: :endfunction not inside a function" +msgstr "E193: :endfunction није унутар функције" + +msgid "E788: Not allowed to edit another buffer now" +msgstr "E788: Уређивање другог бафера тренутно није дозвољено" + +msgid "E811: Not allowed to change buffer information now" +msgstr "E811: Мењање информација о баферу тренутно није дозвољено" + +msgid "tagname" +msgstr "ознака" + +msgid " kind file\n" +msgstr " врста датотеке\n" + +msgid "'history' option is zero" +msgstr "опција 'history' је нула" + +#, c-format +msgid "" +"\n" +"# %s History (newest to oldest):\n" +msgstr "" +"\n" +"# %s Историја (од најновијег ка најстаријем):\n" + +msgid "Command Line" +msgstr "Командна линија" + +msgid "Search String" +msgstr "Стринг за претрагу" + +msgid "Expression" +msgstr "Израз" + +msgid "Input Line" +msgstr "Линија за унос" + +msgid "Debug Line" +msgstr "Debug линија" + +msgid "E198: cmd_pchar beyond the command length" +msgstr "E198: cmd_pchar је иза дужине команде" + +msgid "E199: Active window or buffer deleted" +msgstr "E199: Active window or buffer deleted" + +msgid "E812: Autocommands changed buffer or buffer name" +msgstr "E812: Аутокоманде су промениле багер или име бафера" + +msgid "Illegal file name" +msgstr "Недозвољено име датотеке" + +msgid "is a directory" +msgstr "је директоријум" + +msgid "is not a file" +msgstr "није датотека" + +msgid "is a device (disabled with 'opendevice' option)" +msgstr "је уређај (онемогућен опцијом 'opendevice')" + +msgid "[New File]" +msgstr "[Нова датотека]" + +msgid "[New DIRECTORY]" +msgstr "[Нов ДИРЕКТОРИЈУМ]" + +msgid "[File too big]" +msgstr "[Датотека је сувише велика]" + +msgid "[Permission Denied]" +msgstr "[Дозвола одбијена]" + +msgid "E200: *ReadPre autocommands made the file unreadable" +msgstr "E200: *ReadPre аутокоманде су учиниле датотеку нечитљивом" + +msgid "E201: *ReadPre autocommands must not change current buffer" +msgstr "E201: *ReadPre аутокоманде не смеју да измене текући бафер" + +msgid "Vim: Reading from stdin...\n" +msgstr "Vim: Читање са stdin...\n" + +msgid "Reading from stdin..." +msgstr "Читање са stdin..." + +msgid "E202: Conversion made file unreadable!" +msgstr "E202: Конверзија је учинила датотеку нечитљивом!" + +msgid "[fifo/socket]" +msgstr "[fifo/утичница]" + +msgid "[fifo]" +msgstr "[fifo]" + +msgid "[socket]" +msgstr "[утичница]" + +msgid "[character special]" +msgstr "[специјални карактер]" + +msgid "[CR missing]" +msgstr "[недостаје CR]" + +msgid "[long lines split]" +msgstr "[дуге линије преломљене]" + +msgid "[NOT converted]" +msgstr "[НИЈЕ конвертовано]" + +msgid "[converted]" +msgstr "[конвертовано]" + +#, c-format +msgid "[CONVERSION ERROR in line %ld]" +msgstr "[ГРЕШКА КОНВЕРЗИЈЕ у линији %ld]" + +#, c-format +msgid "[ILLEGAL BYTE in line %ld]" +msgstr "[НЕДОЗВОЉЕН БАЈТ у линији %ld]" + +msgid "[READ ERRORS]" +msgstr "[ГРЕШКЕ ПРИ ЧИТАЊУ]" + +msgid "Can't find temp file for conversion" +msgstr "Привремена датотека за конверзију не може да се пронађе" + +msgid "Conversion with 'charconvert' failed" +msgstr "Конверзија са 'charconvert' није успела" + +msgid "can't read output of 'charconvert'" +msgstr "излаз 'charconvert' не може да се прочита" + +msgid "E676: No matching autocommands for acwrite buffer" +msgstr "E676: Нема одговарајућих аутокоманди за acwrite бафер" + +msgid "E203: Autocommands deleted or unloaded buffer to be written" +msgstr "" +"E203: Аутокоманде су обрисале или уклониле из меморије бафер који требало да " +"буде уписан" + +msgid "E204: Autocommand changed number of lines in unexpected way" +msgstr "E204: Аутокоманде су на неочекиван начин промениле број линија" + +msgid "NetBeans disallows writes of unmodified buffers" +msgstr "NetBeans не дозвољава упис неизмењених бафера" + +msgid "Partial writes disallowed for NetBeans buffers" +msgstr "Парцијални уписи нису дозвољени за NetBeans бафере" + +msgid "is not a file or writable device" +msgstr "није датотека или уређај на који може да се уписује" + +msgid "writing to device disabled with 'opendevice' option" +msgstr "упис на уређај је онемогућен опцијом 'opendevice'" + +msgid "is read-only (add ! to override)" +msgstr "је само за читање (додајте ! за премошћавање)" + +msgid "E506: Can't write to backup file (add ! to override)" +msgstr "" +"E506: Не може да се упише у резервну датотеку (додајте ! за премошћавање)" + +msgid "E507: Close error for backup file (add ! to override)" +msgstr "" +"E507: Грешка код затварања за резервну датотеку (додајте ! за премошћавање)" + +msgid "E508: Can't read file for backup (add ! to override)" +msgstr "" +"E508: Резервна датотека не може да се прочита (додајте ! за премошћавање)" + +msgid "E509: Cannot create backup file (add ! to override)" +msgstr "" +"E509: Резервна датотека не може да се креира (додајте ! за премошћавање)" + +msgid "E510: Can't make backup file (add ! to override)" +msgstr "" +"E510: Резервна датотека не може да се направи (додајте ! за премошћавање)" + +msgid "E214: Can't find temp file for writing" +msgstr "E214: Привремена датотека за упис не може да се пронађе" + +msgid "E213: Cannot convert (add ! to write without conversion)" +msgstr "E213: Конверзија није могућа (додајте ! за упис без конверзије)" + +msgid "E166: Can't open linked file for writing" +msgstr "E166: Повезана датотека не може да се отвори за упис" + +msgid "E212: Can't open file for writing" +msgstr "E212: Датотека не може да се отвори за упис" + +msgid "E949: File changed while writing" +msgstr "E949: Датотека је промењена током уписа" + +msgid "E512: Close failed" +msgstr "E512: Затварање није успело" + +msgid "E513: write error, conversion failed (make 'fenc' empty to override)" +msgstr "" +"E513: грешка при упису, конверзија није успела (оставите 'fenc' празно да " +"премостите)" + +#, c-format +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "" +"E513: грешка при упису, конверзија није успела у линији %ld (оставите 'fenc' " +"празно да премостите)" + +msgid "E514: write error (file system full?)" +msgstr "E514: грешка при упису (систем датотека је пун?)" + +msgid " CONVERSION ERROR" +msgstr " ГРЕШКА КОНВЕРЗИЈЕ" + +#, c-format +msgid " in line %ld;" +msgstr " у линији %ld;" + +msgid "[Device]" +msgstr "[Уређај]" + +msgid "[New]" +msgstr "[Ново]" + +msgid " [a]" +msgstr " [н]" + +msgid " appended" +msgstr " настављено" + +msgid " [w]" +msgstr " [у]" + +msgid " written" +msgstr " уписано" + +msgid "E205: Patchmode: can't save original file" +msgstr "E205: Patch режим: оригинална датотека не може да се сачува" + +msgid "E206: patchmode: can't touch empty original file" +msgstr "E206: Patch режим: не може да се креира празна оригинална датотека" + +msgid "E207: Can't delete backup file" +msgstr "E207: Резервна датотека не може да се обрише" + +msgid "" +"\n" +"WARNING: Original file may be lost or damaged\n" +msgstr "" +"\n" +"УПОЗОРЕЊЕ: Оригинална датотека је можда изгубљена или оштећена\n" + +msgid "don't quit the editor until the file is successfully written!" +msgstr "не напуштајте едитор док се датотека успешно не упише!" + +msgid "[dos]" +msgstr "[dos]" + +msgid "[dos format]" +msgstr "[dos формат]" + +msgid "[mac]" +msgstr "[mac]" + +msgid "[mac format]" +msgstr "[mac формат]" + +msgid "[unix]" +msgstr "[unix]" + +msgid "[unix format]" +msgstr "[unix формат]" + +msgid "1 line, " +msgstr "1 линија, " + +#, c-format +msgid "%ld lines, " +msgstr "%ld линија, " + +msgid "1 character" +msgstr "1 карактер" + +#, c-format +msgid "%lld characters" +msgstr "%lld карактера" + +msgid "[noeol]" +msgstr "[noeol]" + +msgid "[Incomplete last line]" +msgstr "[Последња линија није комплетна]" + +msgid "WARNING: The file has been changed since reading it!!!" +msgstr "УПОЗОРЕЊЕ: Ова датотека је промењена од кад је прочитана!!!" + +msgid "Do you really want to write to it" +msgstr "Да ли заиста желите да пишете у њу" + +#, c-format +msgid "E208: Error writing to \"%s\"" +msgstr "E208: Грешка при упису у \"%s\"" + +#, c-format +msgid "E209: Error closing \"%s\"" +msgstr "E209: Грешка при затварању \"%s\"" + +#, c-format +msgid "E210: Error reading \"%s\"" +msgstr "E210: Грешка при читању \"%s\"" + +msgid "E246: FileChangedShell autocommand deleted buffer" +msgstr "E246: FileChangedShell аутокоманда је обрисала бафер" + +#, c-format +msgid "E211: File \"%s\" no longer available" +msgstr "E211: Датотека \"%s\" више није доступна" + +#, c-format +msgid "" +"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"well" +msgstr "" +"W12: Упозорење: Датотека \"%s\" је измењена и бафер у програму Vim је такође " +"измењен" + +msgid "See \":help W12\" for more info." +msgstr "Погледајте \":help W12\" за више информација." + +#, c-format +msgid "W11: Warning: File \"%s\" has changed since editing started" +msgstr "" +"W11: Упозорење: Датотека \"%s\" је измењена откад је започето уређивање" + +msgid "See \":help W11\" for more info." +msgstr "Погледајте \":help W11\" за више информација." + +#, c-format +msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" +msgstr "" +"W16: Упозорење: Режим датотеке \"%s\" је измењен откад је започето уређивање" + +msgid "See \":help W16\" for more info." +msgstr "Погледајте \":help W16\" за више информација." + +#, c-format +msgid "W13: Warning: File \"%s\" has been created after editing started" +msgstr "W13: Упозорење: Датотека \"%s\" је креирана након почетка уређивања" + +msgid "Warning" +msgstr "Упозорење" + +msgid "" +"&OK\n" +"&Load File" +msgstr "" +"&OK\n" +"&Учитај датотеку" + +#, c-format +msgid "E462: Could not prepare for reloading \"%s\"" +msgstr "E462: Припрема за поновно учитавање \"%s\" није била могућа" + +#, c-format +msgid "E321: Could not reload \"%s\"" +msgstr "E321: \"%s\" не може поново да се учита" + +msgid "--Deleted--" +msgstr "--Обрисано--" + +#, c-format +msgid "auto-removing autocommand: %s <buffer=%d>" +msgstr "ауто-уклањајућа аутокоманда: %s <бафер=%d>" + +#, c-format +msgid "E367: No such group: \"%s\"" +msgstr "E367: Нема такве групе: \"%s\"" + +msgid "E936: Cannot delete the current group" +msgstr "E936: Текућа група не може да се обрише" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Брисање augroup која је још у употреби" + +#, c-format +msgid "E215: Illegal character after *: %s" +msgstr "E215: Недозвољени карактер након *: %s" + +#, c-format +msgid "E216: No such event: %s" +msgstr "E216: Нема таквог догађаја: %s" + +#, c-format +msgid "E216: No such group or event: %s" +msgstr "E216: Нема такве групе или догађаја: %s" + +msgid "" +"\n" +"--- Auto-Commands ---" +msgstr "" +"\n" +"--- Ауто-Команде ---" + +#, c-format +msgid "E680: <buffer=%d>: invalid buffer number " +msgstr "E680: <бафер=%d>: неисправан број бафера " + +msgid "E217: Can't execute autocommands for ALL events" +msgstr "E217: Аутокоманде за СВЕ догађаје не могу да се изврше" + +msgid "No matching autocommands" +msgstr "Нема подударајућих аутокоманди" + +msgid "E218: autocommand nesting too deep" +msgstr "E218: Угњшждавање аутокоманде је сувише дубоко" + +#, c-format +msgid "%s Auto commands for \"%s\"" +msgstr "%s Ауто команде за \"%s\"" + +#, c-format +msgid "Executing %s" +msgstr "Извршавање %s" + +#, c-format +msgid "autocommand %s" +msgstr "аутокоманда %s" + +msgid "E219: Missing {." +msgstr "E219: Недостаје {." + +msgid "E220: Missing }." +msgstr "E220: Недостаје }." + +msgid "E490: No fold found" +msgstr "E490: Није пронађено ниједно склапање" + +msgid "E350: Cannot create fold with current 'foldmethod'" +msgstr "E350: Склапање не може да се креира са текућим 'foldmethod'" + +msgid "E351: Cannot delete fold with current 'foldmethod'" +msgstr "E351: Склапање не може да се обрише са текћим 'foldmethod'" + +#, c-format +msgid "+--%3ld line folded " +msgid_plural "+--%3ld lines folded " +msgstr[0] "+--%3ld линија подвијена" +msgstr[1] "+--%3ld линија подвијено" + +msgid "E222: Add to read buffer" +msgstr "E222: Додавање у бафер читања" + +msgid "E223: recursive mapping" +msgstr "E223: рекурзивно мапирање" + +#, c-format +msgid "E224: global abbreviation already exists for %s" +msgstr "E224: глобална скраћеница за %s већ постоји" + +#, c-format +msgid "E225: global mapping already exists for %s" +msgstr "E225: глобално мапирање за %s већ постоји" + +#, c-format +msgid "E226: abbreviation already exists for %s" +msgstr "E226: скраћеница за %s већ постоји" + +#, c-format +msgid "E227: mapping already exists for %s" +msgstr "E227: мапирање за %s већ постоји" + +msgid "No abbreviation found" +msgstr "Скраћеница није пронађена" + +msgid "No mapping found" +msgstr "Мапирање није пронађено" + +msgid "E228: makemap: Illegal mode" +msgstr "E228: makemap: Недозвољен режим" + +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Креирање новог процеса за GUI није успело" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: Процес потомак није успео да покрене GUI" + +msgid "E229: Cannot start the GUI" +msgstr "E229: GUI не може да се покрене" + +#, c-format +msgid "E230: Cannot read from \"%s\"" +msgstr "E230: Из \"%s\" не може да се чита" + +msgid "E665: Cannot start GUI, no valid font found" +msgstr "E665: GUI не може да се покрене, није пронађен валидан фонт" + +msgid "E231: 'guifontwide' invalid" +msgstr "E231: 'guifontwide' неисправан" + +msgid "E599: Value of 'imactivatekey' is invalid" +msgstr "E599: Вредност 'imactivatekey' није исправна" + +#, c-format +msgid "E254: Cannot allocate color %s" +msgstr "E254: Боја %s не може да се алоцира" + +msgid "No match at cursor, finding next" +msgstr "Нема подударања на месту курсора, тражи се даље" + +msgid "<cannot open> " +msgstr "<не може да се отвори> " + +#, c-format +msgid "E616: vim_SelFile: can't get font %s" +msgstr "E616: vim_SelFile: не може да се добије фонт %s" + +msgid "E614: vim_SelFile: can't return to current directory" +msgstr "E614: vim_SelFile: повратак у текући директоријум није могућ" + +msgid "Pathname:" +msgstr "Име путање:" + +msgid "E615: vim_SelFile: can't get current directory" +msgstr "E615: vim_SelFile: не може да се добије текући директоријум" + +msgid "OK" +msgstr "ОК" + +msgid "Cancel" +msgstr "Откажи" + +msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." +msgstr "Scrollbar Widget: Не може да се добије геометрија thumb pixmap." + +msgid "Vim dialog" +msgstr "Vim дијалог" + +msgid "E232: Cannot create BalloonEval with both message and callback" +msgstr "" +"E232: Не може да се креира BalloonEval и са поруком и са повратним позивом" + +msgid "_Cancel" +msgstr "_Откажи" + +msgid "_Save" +msgstr "_Сачувај" + +msgid "_Open" +msgstr "_Отвори" + +msgid "_OK" +msgstr "_OK" + +msgid "" +"&Yes\n" +"&No\n" +"&Cancel" +msgstr "" +"&Да\n" +"&Не\n" +"&Откажи" + +msgid "Yes" +msgstr "Да" + +msgid "No" +msgstr "Не" + +msgid "Input _Methods" +msgstr "_Методе уноса" + +msgid "VIM - Search and Replace..." +msgstr "VIM - Претрага and Замена..." + +msgid "VIM - Search..." +msgstr "VIM - Претрага..." + +msgid "Find what:" +msgstr "Пронађи:" + +msgid "Replace with:" +msgstr "Замени са:" + +msgid "Match whole word only" +msgstr "Само целе речи подударају" + +msgid "Match case" +msgstr "Мала/велика слова" + +msgid "Direction" +msgstr "Смер" + +msgid "Up" +msgstr "Горе" + +msgid "Down" +msgstr "Доле" + +msgid "Find Next" +msgstr "Пронађи наредно" + +msgid "Replace" +msgstr "Замени" + +msgid "Replace All" +msgstr "Замени све" + +msgid "_Close" +msgstr "_Затвори" + +msgid "Vim: Received \"die\" request from session manager\n" +msgstr "Vim: Примљен је \"die\" захтев од менаџера сесије\n" + +msgid "Close tab" +msgstr "Затвори картицу" + +msgid "New tab" +msgstr "Нова картица" + +msgid "Open Tab..." +msgstr "Отвори картицу..." + +msgid "Vim: Main window unexpectedly destroyed\n" +msgstr "Vim: Главни прозор је неочекивано уништен\n" + +msgid "&Filter" +msgstr "&Филтер" + +msgid "&Cancel" +msgstr "&Откажи" + +msgid "Directories" +msgstr "Директоријуми" + +msgid "Filter" +msgstr "Филтер" + +msgid "&Help" +msgstr "&Помоћ" + +msgid "Files" +msgstr "Датотеке" + +msgid "&OK" +msgstr "&ОК" + +msgid "Selection" +msgstr "Селекција" + +msgid "Find &Next" +msgstr "Пронађи &Следеће" + +msgid "&Replace" +msgstr "&Замени" + +msgid "Replace &All" +msgstr "Замени с&Ве" + +msgid "&Undo" +msgstr "О&позови" + +msgid "Open tab..." +msgstr "Отвори картицу" + +msgid "Find string (use '\\\\' to find a '\\')" +msgstr "Пронађи стринг (користите '\\\\' да пронађете '\\')" + +msgid "Find & Replace (use '\\\\' to find a '\\')" +msgstr "Пронађи & Замени (користите '\\\\' да пронађете '\\')" + +msgid "Not Used" +msgstr "Не користи се" + +msgid "Directory\t*.nothing\n" +msgstr "Директоријум\t*.ништа\n" + +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Наслов прозора \"%s\" не може да се пронађе" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Аргумент није подржан: \"-%s\"; Користите OLE верзију." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Није могуће отварање прозора унутар MDI апликације" + +msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" +msgstr "" +"Vim E458: colormap унос не може да се алоцира, неке боје су можда неисправне" + +#, c-format +msgid "E250: Fonts for the following charsets are missing in fontset %s:" +msgstr "E250: Фонтови за следеће сетове карактера недостају у фонтсету %s:" + +#, c-format +msgid "E252: Fontset name: %s" +msgstr "E252: Име фонтсета: %s" + +#, c-format +msgid "Font '%s' is not fixed-width" +msgstr "Фонт %s' није фиксне ширине" + +#, c-format +msgid "E253: Fontset name: %s" +msgstr "E253: Име фонтсета: %s" + +#, c-format +msgid "Font0: %s" +msgstr "Фонт0: %s" + +#, c-format +msgid "Font1: %s" +msgstr "Фонт1: %s" + +#, c-format +msgid "Font%ld width is not twice that of font0" +msgstr "Ширина фонт%ld није двострука од ширине фонт0" + +#, c-format +msgid "Font0 width: %ld" +msgstr "Фонт0 ширина: %ld" + +#, c-format +msgid "Font1 width: %ld" +msgstr "Фонт1 ширина: %ld" + +msgid "Invalid font specification" +msgstr "Неисправна спецификација фонта" + +msgid "&Dismiss" +msgstr "О&дбаци" + +msgid "no specific match" +msgstr "нема посебног подударања" + +msgid "Vim - Font Selector" +msgstr "Vim - Фонт селектор" + +msgid "Name:" +msgstr "Име:" + +msgid "Show size in Points" +msgstr "Прикажи величину у Тачкама" + +msgid "Encoding:" +msgstr "Кодирање:" + +msgid "Font:" +msgstr "Фонт:" + +msgid "Style:" +msgstr "Стил:" + +msgid "Size:" +msgstr "Величина:" + +msgid "E256: Hangul automata ERROR" +msgstr "E256: ГРЕШКА Hangul аутомата" + +msgid "E550: Missing colon" +msgstr "E550: Недостаје двотачка" + +msgid "E551: Illegal component" +msgstr "E551: Неисправна компонента" + +msgid "E552: digit expected" +msgstr "E552: очекује се цифра" + +#, c-format +msgid "Page %d" +msgstr "Страна %d" + +msgid "No text to be printed" +msgstr "Нема текста за штампу" + +#, c-format +msgid "Printing page %d (%d%%)" +msgstr "Штампање стране %d (%d%%)" + +#, c-format +msgid " Copy %d of %d" +msgstr " Копија %d од %d" + +#, c-format +msgid "Printed: %s" +msgstr "Одштампано: %s" + +msgid "Printing aborted" +msgstr "Штампање прекинуто" + +msgid "E455: Error writing to PostScript output file" +msgstr "E455: Грешка приликом уписа у PostScript излазну датотеку" + +#, c-format +msgid "E624: Can't open file \"%s\"" +msgstr "E624: Датотека \"%s\" не може да се отвори" + +#, c-format +msgid "E457: Can't read PostScript resource file \"%s\"" +msgstr "E457: PostScript resource датотека \"%s\" не може да се чита" + +#, c-format +msgid "E618: file \"%s\" is not a PostScript resource file" +msgstr "E618: датотека \"%s\" није PostScript resource датотека" + +#, c-format +msgid "E619: file \"%s\" is not a supported PostScript resource file" +msgstr "E619: датотека \"%s\" није подржана PostScript resource датотека" + +#, c-format +msgid "E621: \"%s\" resource file has wrong version" +msgstr "E621: \"%s\" resource датотека је погрешне верзије" + +msgid "E673: Incompatible multi-byte encoding and character set." +msgstr "E673: Вишебајтно кодирање и скуп карактера нису компатибилни." + +msgid "E674: printmbcharset cannot be empty with multi-byte encoding." +msgstr "E674: printmbcharset не може бити празно са вишебајтним кодирањем." + +msgid "E675: No default font specified for multi-byte printing." +msgstr "E675: Није наведен подразумевани фонт за вишебајтно штампање." + +msgid "E324: Can't open PostScript output file" +msgstr "E324: PostScript излазна датотека не може да се отвори" + +#, c-format +msgid "E456: Can't open file \"%s\"" +msgstr "E456: Датотека \"%s\" не може да се отвори" + +msgid "E456: Can't find PostScript resource file \"prolog.ps\"" +msgstr "E456: PostScript resource датотека \"prolog.ps\" не може да се пронађе" + +msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" +msgstr "" +"E456: PostScript resource датотека \"cidfont.ps\" не може да се пронађе" + +#, c-format +msgid "E456: Can't find PostScript resource file \"%s.ps\"" +msgstr "E456: PostScript resource датотека \"%s.ps\" не може да се пронађе" + +#, c-format +msgid "E620: Unable to convert to print encoding \"%s\"" +msgstr "E620: Није могућа конверзија у кодирање за штампу \"%s\"" + +msgid "Sending to printer..." +msgstr "Слање штампачу..." + +msgid "E365: Failed to print PostScript file" +msgstr "E365: PostScript датотека није успела да се одштампа" + +msgid "Print job sent." +msgstr "Задатак штампе је послат" + +msgid "Add a new database" +msgstr "Додај нову базу" + +msgid "Query for a pattern" +msgstr "Упит за шаблон" + +msgid "Show this message" +msgstr "Прикажи ову поруку" + +msgid "Kill a connection" +msgstr "Затвори везу" + +msgid "Reinit all connections" +msgstr "Поново иницијализуј све везе" + +msgid "Show connections" +msgstr "Прикажи везе" + +#, c-format +msgid "E560: Usage: cs[cope] %s" +msgstr "E560: Употреба: cs[cope] %s" + +msgid "This cscope command does not support splitting the window.\n" +msgstr "Ова cscope команда не подржава поделу прозора.\n" + +msgid "E562: Usage: cstag <ident>" +msgstr "E562: Употреба: cstag <ident>" + +msgid "E257: cstag: tag not found" +msgstr "E257: cstag: ознака није пронађена" + +#, c-format +msgid "E563: stat(%s) error: %d" +msgstr "E563: stat(%s) грешка: %d" + +msgid "E563: stat error" +msgstr "E563: stat грешка" + +#, c-format +msgid "E564: %s is not a directory or a valid cscope database" +msgstr "E564: %s није директоријум или валидна cscope база података" + +#, c-format +msgid "Added cscope database %s" +msgstr "cscope база података %s је додата" + +#, c-format +msgid "E262: error reading cscope connection %ld" +msgstr "E262: грешка код читања cscope везе %ld" + +msgid "E561: unknown cscope search type" +msgstr "E561: непознат cscope тип претраге" + +msgid "E566: Could not create cscope pipes" +msgstr "E566: cscope процесни токови нису могли да се креирају" + +msgid "E622: Could not fork for cscope" +msgstr "E622: Рачвање за cscope није успело" + +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid није успео" + +msgid "cs_create_connection exec failed" +msgstr "cs_create_connection exec није успео" + +msgid "cs_create_connection: fdopen for to_fp failed" +msgstr "cs_create_connection: fdopen за to_fp није успео" + +msgid "cs_create_connection: fdopen for fr_fp failed" +msgstr "cs_create_connection: fdopen за fr_fp није успео" + +msgid "E623: Could not spawn cscope process" +msgstr "E623: Мрешћење cscope процеса није успело" + +msgid "E567: no cscope connections" +msgstr "E567: нема cscope веза" + +#, c-format +msgid "E469: invalid cscopequickfix flag %c for %c" +msgstr "E469: неисправан cscopequickfix индикатор %c за %c" + +#, c-format +msgid "E259: no matches found for cscope query %s of %s" +msgstr "E259: нису пронађена подударања за cscope упит %s на %s" + +msgid "cscope commands:\n" +msgstr "cscope команде:\n" + +#, c-format +msgid "%-5s: %s%*s (Usage: %s)" +msgstr "%-5s: %s%*s (Употреба: %s)" + +msgid "" +"\n" +" a: Find assignments to this symbol\n" +" c: Find functions calling this function\n" +" d: Find functions called by this function\n" +" e: Find this egrep pattern\n" +" f: Find this file\n" +" g: Find this definition\n" +" i: Find files #including this file\n" +" s: Find this C symbol\n" +" t: Find this text string\n" +msgstr "" +"\n" +" a: Пронађи доделе овом симболу\n" +" c: Пронађи функције које позивају ову функцију\n" +" d: Пронађи функције које зове ова функција\n" +" e: Пронађи овај egrep шаблон\n" +" f: Пронађи ову датотеку\n" +" g: Пронађи ову дефиницију\n" +" i: Пронађи датотеке које #includе ову датотеку\n" +" s: Пронађи овај C симбол\n" +" t: Пронађи овај текст стринг\n" + +#, c-format +msgid "E625: cannot open cscope database: %s" +msgstr "E625: cscope database: %s не може да се отвори" + +msgid "E626: cannot get cscope database information" +msgstr "E626: Инфорамције о cscope бази података не могу да се добију" + +msgid "E568: duplicate cscope database not added" +msgstr "E568: Дупликат cscope база података није додата" + +#, c-format +msgid "E261: cscope connection %s not found" +msgstr "E261: cscope веза %s није пронађена" + +#, c-format +msgid "cscope connection %s closed" +msgstr "cscope веза %s је затворена" + +msgid "E570: fatal error in cs_manage_matches" +msgstr "E570: фатална грешка у cs_manage_matches" + +#, c-format +msgid "Cscope tag: %s" +msgstr "Cscope ознака: %s" + +msgid "" +"\n" +" # line" +msgstr "" +"\n" +" # линија" + +msgid "filename / context / line\n" +msgstr "датотека / контекст / линија\n" + +#, c-format +msgid "E609: Cscope error: %s" +msgstr "E609: Cscope грешка: %s" + +msgid "All cscope databases reset" +msgstr "Све cscope базе података ресетоване" + +msgid "no cscope connections\n" +msgstr "нема cscope веза\n" + +msgid " # pid database name prepend path\n" +msgstr " # pid име базе података додај путању испред\n" + +msgid "Lua library cannot be loaded." +msgstr "Lua библиотека не може да се учита" + +msgid "cannot save undo information" +msgstr "инфорамције за опозив не могу да се сачувају" + +msgid "" +"E815: Sorry, this command is disabled, the MzScheme libraries could not be " +"loaded." +msgstr "" +"E815: Жао нам је, ова команда је онемогућена, MzScheme библиотеке нису могле " +"да се учитају." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Жао нам је, ова команда је онемогућена, MzScheme-ов racket/base модул " +"није могао да се учита." + +msgid "invalid expression" +msgstr "неисправан израз" + +msgid "expressions disabled at compile time" +msgstr "изрази су онемогућени у време компилације" + +msgid "hidden option" +msgstr "скривена опција" + +msgid "unknown option" +msgstr "непозната опција" + +msgid "window index is out of range" +msgstr "индекс прозора је ван опсега" + +msgid "couldn't open buffer" +msgstr "бафер не може да се отвори" + +msgid "cannot delete line" +msgstr "линија не може да се обрише" + +msgid "cannot replace line" +msgstr "линија не може да се замени" + +msgid "cannot insert line" +msgstr "линија не може да се уметне" + +msgid "string cannot contain newlines" +msgstr "стринг не може да садржи нове редове" + +msgid "error converting Scheme values to Vim" +msgstr "грешка при конверзији Scheme вредности у Vim" + +msgid "Vim error: ~a" +msgstr "Vim грешка: ~a" + +msgid "Vim error" +msgstr "Vim грешка" + +msgid "buffer is invalid" +msgstr "бафер је неважећи" + +msgid "window is invalid" +msgstr "прозор је неважећи" + +msgid "linenr out of range" +msgstr "linenr је ван опсега" + +msgid "not allowed in the Vim sandbox" +msgstr "није дозвољено у Vim sandbox-у" + +#, c-format +msgid "E370: Could not load library %s" +msgstr "E370: Библиотека %s није могла да се учита" + +msgid "Sorry, this command is disabled: the Perl library could not be loaded." +msgstr "" +"Жао нам је, ова команда је онемогућена: Perl библиотека није могла да " +"се учита." + +msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" +msgstr "E299: Perl одређивање вредности у sandbox-у је забрањено без Safe модула" + +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Овај Vim не може да изврши :python након коришћења :py3" + +msgid "" +"E263: Sorry, this command is disabled, the Python library could not be " +"loaded." +msgstr "" +"E263: Жао нам је, ова команда је онемогућена, Python библиотека није могла " +"да се учита." + +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Жао нам је, ова команда је онемогућена, Python-ов site модул није " +"могао да се учита." + +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Python не може да се позива рекурзивно" + +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Овај Vim не може да изврши :py3 након коришћења :python" + +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ мора да буде инстанца String-а" + +msgid "" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." +msgstr "" +"E266: Жао нам је, ова команда је онемогућена, Ruby библиотека није могла да " +"се учита." + +msgid "E267: unexpected return" +msgstr "E267: неочекиван return" + +msgid "E268: unexpected next" +msgstr "E268: неочекивано next" + +msgid "E269: unexpected break" +msgstr "E269: неочекивано break" + +msgid "E270: unexpected redo" +msgstr "E270: неочекивано redo" + +msgid "E271: retry outside of rescue clause" +msgstr "E271: retry ван rescue клаузуле" + +msgid "E272: unhandled exception" +msgstr "E272: необрађени изузетак" + +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: непознат longjmp статус %d" + +msgid "invalid buffer number" +msgstr "неисправан број бафера" + +msgid "not implemented yet" +msgstr "још није имплементирано" + +msgid "cannot set line(s)" +msgstr "линија(е) не може да се постави" + +msgid "invalid mark name" +msgstr "неисправно име маркера" + +msgid "mark not set" +msgstr "маркер није постављен" + +#, c-format +msgid "row %d column %d" +msgstr "ред %d колона %d" + +msgid "cannot insert/append line" +msgstr "линија не може да се уметне/дода на крај" + +msgid "line number out of range" +msgstr "број линије је ван опсега" + +msgid "unknown flag: " +msgstr "непознат индикатор" + +msgid "unknown vimOption" +msgstr "непозната vimОпција" + +msgid "keyboard interrupt" +msgstr "прекид тастатуре" + +msgid "vim error" +msgstr "vim грешка" + +msgid "cannot create buffer/window command: object is being deleted" +msgstr "бафер/прозор команда не може да се креира: објекат се брише" + +msgid "" +"cannot register callback command: buffer/window is already being deleted" +msgstr "" +"команда повратног позива не може да се региструје: бафер/прозор је већ " +"обрисан" + +msgid "" +"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." +"org" +msgstr "" +"E280: TCL ФАТАЛНА ГРЕШКА: reflist је оштећена!? Молимо пријавите ово на " +"vim-dev@vim.org" + +msgid "cannot register callback command: buffer/window reference not found" +msgstr "" +"команда повратног позива не може да се региструје: референца бафера/прозора " +"није пронађена" + +msgid "" +"E571: Sorry, this command is disabled: the Tcl library could not be loaded." +msgstr "" +"E571: Жао нам је, ова команда је онемогућена: Tcl библиотека није могла да " +"се учита." + +#, c-format +msgid "E572: exit code %d" +msgstr "E572: излазни код %d" + +msgid "cannot get line" +msgstr "линија не може да се добије" + +msgid "Unable to register a command server name" +msgstr "Име сервера команди није могло да се региструје" + +msgid "E248: Failed to send command to the destination program" +msgstr "E248: Слање команде циљном програму није успело" + +#, c-format +msgid "E573: Invalid server id used: %s" +msgstr "E573: Користи се несправан ид сервера: %s" + +msgid "E251: VIM instance registry property is badly formed. Deleted!" +msgstr "E251: registry својство VIM инстанце је лоше формирано. Обрисано!" + +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Дупли кључ у JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: У Листи недостаје зарез: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Недостаје крај Листе ']': %s" + +msgid "Unknown option argument" +msgstr "Непознат аргумент опције" + +msgid "Too many edit arguments" +msgstr "Сувише аргумента уређивања" + +msgid "Argument missing after" +msgstr "Аргумент недостаје након" + +msgid "Garbage after option argument" +msgstr "Смеће након аргумента опције" + +msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" +msgstr "Сувише \"+command\", \"-c command\" или \"--cmd command\" аргумената" + +msgid "Invalid argument for" +msgstr "Неисправан аргумент for" + +#, c-format +msgid "%d files to edit\n" +msgstr "%d датотека за уређивање\n" + +msgid "netbeans is not supported with this GUI\n" +msgstr "NetBeans није подржан са овим GUI\n" + +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr "'-nb' не може да се користи: није омогућено у време компилације\n" + +msgid "This Vim was not compiled with the diff feature." +msgstr "Овај Vim није компајлиран са diff могућношћу." + +msgid "Attempt to open script file again: \"" +msgstr "Покушај да се поново отвори скрипт датотека: \"" + +msgid "Cannot open for reading: \"" +msgstr "Не може да се отвори за читање: \"" + +msgid "Cannot open for script output: \"" +msgstr "Не може да се отвори за излаз скрипте: \"" + +msgid "Vim: Error: Failure to start gvim from NetBeans\n" +msgstr "Vim: Грешка: Покретање gvim из NetBeans није успело\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "" +"Vim: Грешка: Ова верзија Vim не може да се покрене из Cygwin терминала\n" + +msgid "Vim: Warning: Output is not to a terminal\n" +msgstr "Vim: Упозорење: Излаз није у терминал\n" + +msgid "Vim: Warning: Input is not from a terminal\n" +msgstr "Vim: Упозорење: Улаз није из терминала\n" + +msgid "pre-vimrc command line" +msgstr "pre-vimrc командна линија" + +#, c-format +msgid "E282: Cannot read from \"%s\"" +msgstr "E282: Не може да се чита из \"%s\"" + +msgid "" +"\n" +"More info with: \"vim -h\"\n" +msgstr "" +"\n" +"Више инфо са: \"vim -h\"\n" + +msgid "[file ..] edit specified file(s)" +msgstr "[датотека ..] уређуј наведену(е) датотеку(е)" + +msgid "- read text from stdin" +msgstr "- читај текст са stdin" + +msgid "-t tag edit file where tag is defined" +msgstr "-t tag уређуј датотеку где је дефинисана ознака" + +msgid "-q [errorfile] edit file with first error" +msgstr "-q [дат.грешке] уређуј датотеку са првом грешком" + +msgid "" +"\n" +"\n" +"usage:" +msgstr "" +"\n" +"\n" +"употреба:" + +msgid " vim [arguments] " +msgstr " vim [аргументи] " + +msgid "" +"\n" +" or:" +msgstr "" +"\n" +" или:" + +msgid "" +"\n" +"Where case is ignored prepend / to make flag upper case" +msgstr "" +"\n" +"Где се мала/велика слова игноришу ставите испред / како би претворили " +"индикатор у велика слова" + +msgid "" +"\n" +"\n" +"Arguments:\n" +msgstr "" +"\n" +"\n" +"Аргументи:\n" + +msgid "--\t\t\tOnly file names after this" +msgstr "--\t\t\tСамо имена датотека након овога" + +msgid "--literal\t\tDon't expand wildcards" +msgstr "--literal\t\tНе развијај џокере" + +msgid "-register\t\tRegister this gvim for OLE" +msgstr "-register\t\tРегиструј овај gvim за OLE" + +msgid "-unregister\t\tUnregister gvim for OLE" +msgstr "-unregister\t\tУклони регистрацију gvim за OLE" + +msgid "-g\t\t\tRun using GUI (like \"gvim\")" +msgstr "-g\t\t\tПокрени користећи GUI (као \"gvim\")" + +msgid "-f or --nofork\tForeground: Don't fork when starting GUI" +msgstr "-f или --nofork\tУ предњем плану: немој да рачваш кад се покреће GUI" + +msgid "-v\t\t\tVi mode (like \"vi\")" +msgstr "-v\t\t\tVi режим (као \"vi\")" + +msgid "-e\t\t\tEx mode (like \"ex\")" +msgstr "-e\t\t\tEx режим (као \"ex\")" + +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tУнапређен Ex режим" + +msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" +msgstr "-s\t\t\tНечујни (batch) режим (само за \"ex\")" + +msgid "-d\t\t\tDiff mode (like \"vimdiff\")" +msgstr "-d\t\t\tDiff режим (као \"vimdiff\")" + +msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" +msgstr "-y\t\t\tEasy режим (као \"evim\", безрежимни)" + +msgid "-R\t\t\tReadonly mode (like \"view\")" +msgstr "-R\t\t\tReadonly режим (као \"view\")" + +msgid "-Z\t\t\tRestricted mode (like \"rvim\")" +msgstr "-Z\t\t\tRestricted режим (као \"rvim\")" + +msgid "-m\t\t\tModifications (writing files) not allowed" +msgstr "-m\t\t\tИзмене (уписивање датотека) нису дозвољене" + +msgid "-M\t\t\tModifications in text not allowed" +msgstr "-M\t\t\tИзмене у тексту нису дозвољене" + +msgid "-b\t\t\tBinary mode" +msgstr "-b\t\t\tБинарни режим" + +msgid "-l\t\t\tLisp mode" +msgstr "-l\t\t\tLisp режим" + +msgid "-C\t\t\tCompatible with Vi: 'compatible'" +msgstr "-C\t\t\tКомпатибилан са Vi: 'compatible'" + +msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" +msgstr "-N\t\t\tНе потпуно Vi компатибилан: 'nocompatible'" + +msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" +msgstr "-V[N][fname]\t\tБуди опширан [ниво N] [бележи поруке у fname]" + +msgid "-D\t\t\tDebugging mode" +msgstr "-D\t\t\tDebugging режим" + +msgid "-n\t\t\tNo swap file, use memory only" +msgstr "-n\t\t\tБез swap датотеке, користи само меморију" + +msgid "-r\t\t\tList swap files and exit" +msgstr "-r\t\t\tИзлистај swap датотеке и изађи" + +msgid "-r (with file name)\tRecover crashed session" +msgstr "-r (са именом датотеке)\tОбнови срушену сесију" + +msgid "-L\t\t\tSame as -r" +msgstr "-L\t\t\tИсто као -r" + +msgid "-f\t\t\tDon't use newcli to open window" +msgstr "-f\t\t\tНемој да користиш нов cli да отвориш прозор" + +msgid "-dev <device>\t\tUse <device> for I/O" +msgstr "-dev <уређај>\t\tКористи <уређај> за У/И" + +msgid "-A\t\t\tstart in Arabic mode" +msgstr "-A\t\t\tПокрени у Арапском режиму" + +msgid "-H\t\t\tStart in Hebrew mode" +msgstr "-H\t\t\tПокрени у Хебрејском режиму" + +msgid "-F\t\t\tStart in Farsi mode" +msgstr "-F\t\t\tПокрени у Фарси режиму" + +msgid "-T <terminal>\tSet terminal type to <terminal>" +msgstr "-T <терминал>\tПостави тип терминала на <терминал>" + +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tПрескочи упозорење да улаз/излаз није терминал" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tИзађи ако улаз или излаз нису терминал" + +msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" +msgstr "-u <vimrc>\t\tКористи <vimrc> уместо било ког .vimrc" + +msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc" +msgstr "-U <gvimrc>\t\tКористи <gvimrc> уместо било ког .gvimrc" + +msgid "--noplugin\t\tDon't load plugin scripts" +msgstr "--noplugin\t\tНе учитавај скрипте додатака" + +msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" +msgstr "-p[N]\t\tОтвори N картица (подразумевано: по једну за сваку датотеку)" + +msgid "-o[N]\t\tOpen N windows (default: one for each file)" +msgstr "-o[N]\t\tОтвори N прозора (подразумевано: по један за сваку датотеку)" + +msgid "-O[N]\t\tLike -o but split vertically" +msgstr "-O[N]\t\tКао -o али подели по вертикали" + +msgid "+\t\t\tStart at end of file" +msgstr "+\t\t\tПочни на крају датотеке" + +msgid "+<lnum>\t\tStart at line <lnum>" +msgstr "+<бројл>\t\tПочни на линији <бројл>" + +msgid "--cmd <command>\tExecute <command> before loading any vimrc file" +msgstr "" +"--cmd <команда>\tИзврши <команда> пре учитавања било које vimrc датотеке" + +msgid "-c <command>\t\tExecute <command> after loading the first file" +msgstr "-c <команда>\t\tИзврши <команда> након учитавања прве датотеке" + +msgid "-S <session>\t\tSource file <session> after loading the first file" +msgstr "" +"-S <сесија>\t\tИзворна датотека <сесија> након учитавања прве " +"датотеке" + +msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>" +msgstr "" +"-s <скриптулаз>\tЧитај команде Нормалног режима из датотеке <скриптулаз>" + +msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>" +msgstr "" +"-w <скриптизлаз>\tНадовежи све откуцане команде на крај датотеке " +"<скриптизлаз>" + +msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>" +msgstr "-W <скриптизлаз>\tУписуј све откуцане команде у датотеку <скриптизлаз>" + +msgid "-x\t\t\tEdit encrypted files" +msgstr "-x\t\t\tУређуј шифроване датотеке" + +msgid "-display <display>\tConnect vim to this particular X-server" +msgstr "-display <дисплеј>\tПовежи vim на овај X-сервер" + +msgid "-X\t\t\tDo not connect to X server" +msgstr "-X\t\t\tНе повезуј се на X сервер" + +msgid "--remote <files>\tEdit <files> in a Vim server if possible" +msgstr "--remote <датотеке>\tУређуј <датотеке> у Vim серверу ако је могуће" + +msgid "--remote-silent <files> Same, don't complain if there is no server" +msgstr "--remote-silent <датотеке> Исто, не буни се ако нема сервера" + +msgid "" +"--remote-wait <files> As --remote but wait for files to have been edited" +msgstr "" +"--remote-wait <датотеке> Као --remote али чекај да датотеке буду уређене" + +msgid "" +"--remote-wait-silent <files> Same, don't complain if there is no server" +msgstr "--remote-wait-silent <датотеке> Исто, не буни се ако нема сервера" + +msgid "" +"--remote-tab[-wait][-silent] <files> As --remote but use tab page per file" +msgstr "" +"--remote-tab[-wait][-silent] <датотеке> Као --remote али користи једну " +"картицу по датотеци" + +msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit" +msgstr "--remote-send <тастери>\tПошаљи <тастери> Vim серверу и изађи" + +msgid "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result" +msgstr "" +"--remote-expr <израз>\tИзрачунај <израз> у Vim серверу и одштампај резултат" + +msgid "--serverlist\t\tList available Vim server names and exit" +msgstr "--serverlist\t\tИзлистај имена доступних Vim сервера и изађи" + +msgid "--servername <name>\tSend to/become the Vim server <name>" +msgstr "--servername <име>\tПошаљи/постани Vim сервер <име>" + +msgid "--startuptime <file>\tWrite startup timing messages to <file>" +msgstr "--startuptime <датотека>\tУпиши поруке о дужини покретања у <датотеку>" + +msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo" +msgstr "-i <viminfo>\t\tКористи <viminfo> уместо .viminfo" + +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "" +"--clean\t\t'nocompatible', Vim подразумеване вредности, без додатака, без " +"viminfo" + +msgid "-h or --help\tPrint Help (this message) and exit" +msgstr "-h or --help\tИспиши Помоћ (ову поруку) и изађи" + +msgid "--version\t\tPrint version information and exit" +msgstr "--version\t\tИспиши информације о верзији и изађи" + +msgid "" +"\n" +"Arguments recognised by gvim (Motif version):\n" +msgstr "" +"\n" +"Аргументи које препознаје gvim (Motif верзија):\n" + +msgid "" +"\n" +"Arguments recognised by gvim (neXtaw version):\n" +msgstr "" +"\n" +"Аргументи које препознаје gvim (neXtaw верзија):\n" + +msgid "" +"\n" +"Arguments recognised by gvim (Athena version):\n" +msgstr "" +"\n" +"Аргументи које препознаје gvim (Athena верзија):\n" + +msgid "-display <display>\tRun vim on <display>" +msgstr "-display <дисплеј>\tПокрени vim на <дисплеј>" + +msgid "-iconic\t\tStart vim iconified" +msgstr "-iconic\t\tПокрени vim као икону" + +msgid "-background <color>\tUse <color> for the background (also: -bg)" +msgstr "-background <боја>\tКористи <боја> за позадину (такође: -bg)" + +msgid "-foreground <color>\tUse <color> for normal text (also: -fg)" +msgstr "-foreground <боја>\tКористи <боја> за нормални текст (такође: -fg)" + +msgid "-font <font>\t\tUse <font> for normal text (also: -fn)" +msgstr "-font <фонт>\t\tКористи <фонт> за нормални текст (такође: -fn)" + +msgid "-boldfont <font>\tUse <font> for bold text" +msgstr "-boldfont <фонт>\tКористи <фонт> за подебљани текст" + +msgid "-italicfont <font>\tUse <font> for italic text" +msgstr "-italicfont <фонт>\tКористи <фонт> за курзивни текст" + +msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)" +msgstr "-geometry <геом>\tКористи <геом> за почетну геометрију (такође: -geom)" + +msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)" +msgstr "-borderwidth <ширина>\tКористи оквир ширине <ширина> (такође: -bw)" + +msgid "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)" +msgstr "" +"-scrollbarwidth <ширина> Користи Линију за скроловање ширине <ширина> " +"(такође: -sw)" + +msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)" +msgstr "" +"-menuheight <ширина>\tКористи линију менија висине <висина> (такође: -mh)" + +msgid "-reverse\t\tUse reverse video (also: -rv)" +msgstr "-reverse\t\tКористи обрнути видео (такође: -rv)" + +msgid "+reverse\t\tDon't use reverse video (also: +rv)" +msgstr "+reverse\t\tНемој да користиш обрнути видео (такође: +rv)" + +msgid "-xrm <resource>\tSet the specified resource" +msgstr "-xrm <ресурс>\tПостави наведени ресурс" + +msgid "" +"\n" +"Arguments recognised by gvim (GTK+ version):\n" +msgstr "" +"\n" +"Аргументи које препознаје gvim (GTK+ верзија):\n" + +msgid "-display <display>\tRun vim on <display> (also: --display)" +msgstr "-display <дисплеј>\tПокрени vim на <дисплеј> (такође: --display)" + +msgid "--role <role>\tSet a unique role to identify the main window" +msgstr "" +"--role <улога>\tПостави јединствену улогу да би се идентификовао главни " +"прозор" + +msgid "--socketid <xid>\tOpen Vim inside another GTK widget" +msgstr "--socketid <xid>\tОтвори Vim унутар другог GTK виџета" + +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tНека gvim испише Window ID на stdout" + +msgid "-P <parent title>\tOpen Vim inside parent application" +msgstr "-P <назив родитеља>\tОтвори Vim унутар родитељске апликације" + +msgid "--windowid <HWND>\tOpen Vim inside another win32 widget" +msgstr "--windowid <HWND>\tОтвори Vim унутар другог win32 виџета" + +msgid "No display" +msgstr "Нема приказа" + +msgid ": Send failed.\n" +msgstr ": Слање није успело.\n" + +msgid ": Send failed. Trying to execute locally\n" +msgstr ": Слање није успело. Покушава се локално извршавање\n" + +#, c-format +msgid "%d of %d edited" +msgstr "%d од %d уређено" + +msgid "No display: Send expression failed.\n" +msgstr "Нема приказа: Израз слања није успео.\n" + +msgid ": Send expression failed.\n" +msgstr ": Израз слања није успео.\n" + +msgid "No marks set" +msgstr "Нема постављених маркера" + +#, c-format +msgid "E283: No marks matching \"%s\"" +msgstr "E283: Нема маркера који се подударају са \"%s\"" + +msgid "" +"\n" +"mark line col file/text" +msgstr "" +"\n" +"линија маркера кол датотека/текст" + +msgid "" +"\n" +" jump line col file/text" +msgstr "" +"\n" +" линија скока кол датотека/текст" + +msgid "" +"\n" +"change line col text" +msgstr "" +"\n" +"линија промене кол текст" + +msgid "" +"\n" +"# File marks:\n" +msgstr "" +"\n" +"# Маркери датотеке:\n" + +msgid "" +"\n" +"# Jumplist (newest first):\n" +msgstr "" +"\n" +"# Скок-листа (прво најновији):\n" + +msgid "" +"\n" +"# History of marks within files (newest to oldest):\n" +msgstr "" +"\n" +"# Историја маркера унутар датотека (ок најновијег до најстаријег):\n" + +msgid "Missing '>'" +msgstr "Недостаје '>'" + +msgid "E543: Not a valid codepage" +msgstr "E543: Неважећа кодна страна" + +msgid "E284: Cannot set IC values" +msgstr "E284: IC вредности не могу да се поставе" + +msgid "E285: Failed to create input context" +msgstr "E285: Креирање контекста уноса није успело" + +msgid "E286: Failed to open input method" +msgstr "E286: Отварање методе уноса није успело" + +msgid "E287: Warning: Could not set destroy callback to IM" +msgstr "" +"E287: Упозорење: Постављање повратне функције за уништење IM није успело" + +msgid "E288: input method doesn't support any style" +msgstr "E288: метод уноса не подржава ниједан стил" + +msgid "E289: input method doesn't support my preedit type" +msgstr "E289: метод уноса не подржава мој preedit тип" + +msgid "E293: block was not locked" +msgstr "E293: блок није закључан" + +msgid "E294: Seek error in swap file read" +msgstr "E294: Грешка код постављања показивача за читање swap датотеке" + +msgid "E295: Read error in swap file" +msgstr "E295: Грешка при читању swap датотеке" + +msgid "E296: Seek error in swap file write" +msgstr "E296: Грешка код постављања показивача за упис swap датотеке" + +msgid "E297: Write error in swap file" +msgstr "E297: Грешка при упису swap датотеке" + +msgid "E300: Swap file already exists (symlink attack?)" +msgstr "E300: Swap датотека већ постоји (symlink напад?)" + +msgid "E298: Didn't get block nr 0?" +msgstr "E298: Блок бр 0 није добављен?" + +msgid "E298: Didn't get block nr 1?" +msgstr "E298: Блок бр 1 није добављен?" + +msgid "E298: Didn't get block nr 2?" +msgstr "E298: Блок бр 2 није добављен?" + +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Грешка приликом осважавања криптовања swap датотеке" + +msgid "E301: Oops, lost the swap file!!!" +msgstr "E301: Уупс, swap датотека је изгубљена!!!" + +msgid "E302: Could not rename swap file" +msgstr "E302: Промена имена swap датотеке није успела" + +#, c-format +msgid "E303: Unable to open swap file for \"%s\", recovery impossible" +msgstr "" +"E303: Отварање swap датотеке за \"%s\" није успело, опоравак је немогућ" + +msgid "E304: ml_upd_block0(): Didn't get block 0??" +msgstr "E304: ml_upd_block0(): Блок бр 0 није добављен??" + +#, c-format +msgid "E305: No swap file found for %s" +msgstr "E305: За %s није пронађена swap датотека" + +msgid "Enter number of swap file to use (0 to quit): " +msgstr "Унесите број swap датотеке која ће да се користи (0 за отказивање): " + +#, c-format +msgid "E306: Cannot open %s" +msgstr "E306: %s не може да се отвори" + +msgid "Unable to read block 0 from " +msgstr "Није могуће литање блока 0 из " + +msgid "" +"\n" +"Maybe no changes were made or Vim did not update the swap file." +msgstr "" +"\n" +"Можда нису направљене никакве измене или Vim није освежио swap датотеку." + +msgid " cannot be used with this version of Vim.\n" +msgstr " не може да се користи са овом верзијом Vim-а.\n" + +msgid "Use Vim version 3.0.\n" +msgstr "Користите Vim верзијe 3.0.\n" + +#, c-format +msgid "E307: %s does not look like a Vim swap file" +msgstr "E307: %s не изгледа као Vim swap датотека" + +msgid " cannot be used on this computer.\n" +msgstr " не може да се користи на овом компјутеру.\n" + +msgid "The file was created on " +msgstr "Ова датотека је креирана са " + +msgid "" +",\n" +"or the file has been damaged." +msgstr "" +",\n" +"или је датотека оштећена." + +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "E833: %s је шифрована и ова верзија Vim-а не подржава шифровање" + +msgid " has been damaged (page size is smaller than minimum value).\n" +msgstr " је оштећена (величина странице је маља од минималне вредности).\n" + +#, c-format +msgid "Using swap file \"%s\"" +msgstr "Користи се swap датотека \"%s\"" + +#, c-format +msgid "Original file \"%s\"" +msgstr "Оригинална датотека \"%s\"" + +msgid "E308: Warning: Original file may have been changed" +msgstr "E308: Упозорење: Можда је промењена оригинална датотека" + +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "Swap датотека је шифрована: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "" +"\n" +"Ако сте унели нов кључ за шифрирање али нисте уписали текст датотеку," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "" +"\n" +"унесите нови кључ за шифрирање." + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "" +"\n" +"Ако сте уписали текст датотеку на диск након промене кључа за шифрирање " +"притисните ентер" + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "" +"\n" +"да бисте користили исти кључ за текст датотеку и swap датотеку" + +#, c-format +msgid "E309: Unable to read block 1 from %s" +msgstr "E309: Блок 1 из %s не може да се прочита" + +msgid "???MANY LINES MISSING" +msgstr "??НЕДОСТАЈЕ МНОГО ЛИНИЈА" + +msgid "???LINE COUNT WRONG" +msgstr "???БРОЈ ЛИНИЈА ЈЕ ПОГРЕШАН" + +msgid "???EMPTY BLOCK" +msgstr "???ПРАЗАН БЛОК" + +msgid "???LINES MISSING" +msgstr "???НЕДОСТАЈУ ЛИНИЈЕ" + +#, c-format +msgid "E310: Block 1 ID wrong (%s not a .swp file?)" +msgstr "E310: ID блока 1 је погрешан (%s није .swp датотека?)" + +msgid "???BLOCK MISSING" +msgstr "???НЕДОСТАЈЕ БЛОК" + +msgid "??? from here until ???END lines may be messed up" +msgstr "??? одавде па до ???КРАЈ линије су можда забрљане" + +msgid "??? from here until ???END lines may have been inserted/deleted" +msgstr "??? одавде па до ???КРАЈ линије су можда уметане/брисане" + +msgid "???END" +msgstr "???КРАЈ" + +msgid "E311: Recovery Interrupted" +msgstr "E311: Опоравак је прекинут" + +msgid "" +"E312: Errors detected while recovering; look for lines starting with ???" +msgstr "" +"E312: Откривене су грешке приликом опоравка; потражите линије које почињу " +"са ???" + +msgid "See \":help E312\" for more information." +msgstr "Погледајте \":help E312\" за више информација." + +msgid "Recovery completed. You should check if everything is OK." +msgstr "Опоравак је завршен. Требало би да проверите да ли је све OK." + +msgid "" +"\n" +"(You might want to write out this file under another name\n" +msgstr "" +"\n" +"(Можда бисте хтели да запишете ову датотеку под другим именом\n" + +msgid "and run diff with the original file to check for changes)" +msgstr "и покренете diff са оригиналном датотеком да провелите има ли измена)" + +msgid "Recovery completed. Buffer contents equals file contents." +msgstr "Опоравак је завршен. Садржај бафера је истоветан садржају датотеке." + +msgid "" +"\n" +"You may want to delete the .swp file now.\n" +"\n" +msgstr "" +"\n" +"Сада можда желите да обришете .swp датотеку.\n" +"\n" + +msgid "Using crypt key from swap file for the text file.\n" +msgstr "За текст датотеку се користи кључ за шифрирање из swap датотеке.\n" + +msgid "Swap files found:" +msgstr "Пронађене су swap датотеке:" + +msgid " In current directory:\n" +msgstr " У текућем директоријуму:\n" + +msgid " Using specified name:\n" +msgstr " Користећи наведено име:\n" + +msgid " In directory " +msgstr " У директоријуму " + +msgid " -- none --\n" +msgstr " -- ниједна --\n" + +msgid " owned by: " +msgstr " које поседује: " + +msgid " dated: " +msgstr " датиране: " + +msgid " dated: " +msgstr " датиране: " + +msgid " [from Vim version 3.0]" +msgstr " [од Vim верзије 3.0]" + +msgid " [does not look like a Vim swap file]" +msgstr " [не изгледа као Vim swap датотека]" + +msgid " file name: " +msgstr " име датотеке: " + +msgid "" +"\n" +" modified: " +msgstr "" +"\n" +" измењено: " + +msgid "YES" +msgstr "ДА" + +msgid "no" +msgstr "не" + +msgid "" +"\n" +" user name: " +msgstr "" +"\n" +" корисничко име: " + +msgid " host name: " +msgstr " име хоста: " + +msgid "" +"\n" +" host name: " +msgstr "" +"\n" +" име хоста: " + +msgid "" +"\n" +" process ID: " +msgstr "" +"\n" +" ИД процеса: " + +msgid " (still running)" +msgstr " (још се извршава)" + +msgid "" +"\n" +" [not usable with this version of Vim]" +msgstr "" +"\n" +" [није употребљива са овом верзијом Vim-а]" + +msgid "" +"\n" +" [not usable on this computer]" +msgstr "" +"\n" +" [није употребљива на овом компјутеру]" + +msgid " [cannot be read]" +msgstr " [не може да се прочита]" + +msgid " [cannot be opened]" +msgstr " [не може да се отвори]" + +msgid "E313: Cannot preserve, there is no swap file" +msgstr "E313: Не може да се презервира, нема swap датотеке" + +msgid "File preserved" +msgstr "Датотека је презервирана" + +msgid "E314: Preserve failed" +msgstr "E314: Презервација није успела" + +#, c-format +msgid "E315: ml_get: invalid lnum: %ld" +msgstr "E315: ml_get: неисправан lnum: %ld" + +#, c-format +msgid "E316: ml_get: cannot find line %ld" +msgstr "E316: ml_get: линија %ld не може да се пронађе" + +msgid "E317: pointer block id wrong 3" +msgstr "E317: ид показивача блока је погрешан 3" + +msgid "stack_idx should be 0" +msgstr "stack_idx би требало да је 0" + +msgid "E318: Updated too many blocks?" +msgstr "E318: Освежено превише блокова?" + +msgid "E317: pointer block id wrong 4" +msgstr "E317: ид показивача блока је погрешан 4" + +msgid "deleted block 1?" +msgstr "блок 1 обрисан?" + +#, c-format +msgid "E320: Cannot find line %ld" +msgstr "E320: Линија %ld не може да се пронађе" + +msgid "E317: pointer block id wrong" +msgstr "E317: ид показивача блока је погрешан" + +msgid "pe_line_count is zero" +msgstr "pe_line_count је нула" + +#, c-format +msgid "E322: line number out of range: %ld past the end" +msgstr "E322: број линије је ван опсега: %ld иза краја" + +#, c-format +msgid "E323: line count wrong in block %ld" +msgstr "E323: број линија је погрешан у блоку %ld" + +msgid "Stack size increases" +msgstr "Величина стека се повећава" + +msgid "E317: pointer block id wrong 2" +msgstr "E317: ид показивача блока је погрешан 2" + +#, c-format +msgid "E773: Symlink loop for \"%s\"" +msgstr "E773: Symlink петља за \"%s\"" + +msgid "E325: ATTENTION" +msgstr "E325: ПАЖЊА" + +msgid "" +"\n" +"Found a swap file by the name \"" +msgstr "" +"\n" +"Пронађена је swap датотека под именом \"" + +msgid "While opening file \"" +msgstr "Док се отварала датотекa \"" + +msgid " NEWER than swap file!\n" +msgstr " НОВИЈА од swap датотеке!\n" + +msgid "" +"\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" +msgstr "" +"\n" +"(1) Можда други програм уређује исту датотеку. Ако је ово случај,\n" +" кад правите измене, пазите да не завршите са две различите\n" +" инстанце исте датотеке. Изађите, или опрезно наставите.\n" + +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) Сесија уређивања ове датотеке се срушила.\n" + +msgid " If this is the case, use \":recover\" or \"vim -r " +msgstr " Ако је ово случај, користите \":recover\" или \"vim -r " + +msgid "" +"\"\n" +" to recover the changes (see \":help recovery\").\n" +msgstr "" +"\"\n" +" да опоравите измене (погледајте \":help recovery\").\n" + +msgid " If you did this already, delete the swap file \"" +msgstr " Ако сте ово већ учинили, обришите swap датотеку \"" + +msgid "" +"\"\n" +" to avoid this message.\n" +msgstr "" +"\"\n" +" како би избегли ову поруку.\n" + +msgid "Swap file \"" +msgstr "Swap датотека \"" + +msgid "\" already exists!" +msgstr "\" већ постоји!" + +msgid "VIM - ATTENTION" +msgstr "VIM - ПАЖЊА" + +msgid "Swap file already exists!" +msgstr "Swap датотека већ постоји!" + +msgid "" +"&Open Read-Only\n" +"&Edit anyway\n" +"&Recover\n" +"&Quit\n" +"&Abort" +msgstr "" +"Отвори &Само за читање\n" +"Ипак &Уређуј\n" +"&Опорави\n" +"&Изађи\n" +"&Прекини" + +msgid "" +"&Open Read-Only\n" +"&Edit anyway\n" +"&Recover\n" +"&Delete it\n" +"&Quit\n" +"&Abort" +msgstr "" +"Отвори &Само за читање\n" +"Ипак &Уређуј\n" +"&Опорави\n" +"&Изађи\n" +"&Прекини" + +msgid "E326: Too many swap files found" +msgstr "E326: Пронађено је превише swap датотека" + +msgid "E327: Part of menu-item path is not sub-menu" +msgstr "E327: Део путање ставке менија није подмени" + +msgid "E328: Menu only exists in another mode" +msgstr "E328: Мени постоји само у другом режиму" + +#, c-format +msgid "E329: No menu \"%s\"" +msgstr "E329: Нема менија \"%s\"" + +msgid "E792: Empty menu name" +msgstr "E792: Празно име менија" + +msgid "E330: Menu path must not lead to a sub-menu" +msgstr "E330: Путања менија не сме да води у подмени" + +msgid "E331: Must not add menu items directly to menu bar" +msgstr "E331: Ставке менија не смеју да се додају директно у линију менија" + +msgid "E332: Separator cannot be part of a menu path" +msgstr "E332: Сепаратор не може да буде део путање менија" + +msgid "" +"\n" +"--- Menus ---" +msgstr "" +"\n" +"--- Менији ---" + +msgid "Tear off this menu" +msgstr "Отцепи овај мени" + +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Мени није дефинисан за %s рeжим" + +msgid "E333: Menu path must lead to a menu item" +msgstr "E333: Путања менија мора да води у ставку менија" + +#, c-format +msgid "E334: Menu not found: %s" +msgstr "E334: Мени није пронађен: %s" + +msgid "E336: Menu path must lead to a sub-menu" +msgstr "E336: Путања менија мора да води у подмени" + +msgid "E337: Menu not found - check menu names" +msgstr "E337: Мени није пронађен - проверите имена менија" + +#, c-format +msgid "Error detected while processing %s:" +msgstr "Откривена је грешка током обраде %s:" + +#, c-format +msgid "line %4ld:" +msgstr "линија %4ld:" + +#, c-format +msgid "E354: Invalid register name: '%s'" +msgstr "E354: Неисправно име регистра: '%s'" + +msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" +msgstr "Поруке одржава: Иван Пешић <ivan.pesic@gmail.com>" + +msgid "Interrupt: " +msgstr "Прекид: " + +msgid "Press ENTER or type command to continue" +msgstr "Да бисте наставили, притисните ЕНТЕР или откуцајте команду" + +#, c-format +msgid "%s line %ld" +msgstr "%s линија %ld" + +msgid "-- More --" +msgstr "-- Још --" + +msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " +msgstr " РАЗМАКНИЦА/d/j: екран/страна/линија наниже, b/u/k: навише, q: излаз " + +msgid "Question" +msgstr "Питање" + +msgid "" +"&Yes\n" +"&No" +msgstr "" +"&Да\n" +"&Не" + +msgid "" +"&Yes\n" +"&No\n" +"Save &All\n" +"&Discard All\n" +"&Cancel" +msgstr "" +"&Да\n" +"&Не\n" +"Сачувај &Све\n" +"о&Дбаци све\n" +"&Откажи" + +msgid "Select Directory dialog" +msgstr "Дијалог избора директоријума" + +msgid "Save File dialog" +msgstr "Дијалог чувања датотеке" + +msgid "Open File dialog" +msgstr "Дијалог отварања датотеке" + +msgid "E338: Sorry, no file browser in console mode" +msgstr "E338: Жао нам је, нема претраживача датотека у конзолном режиму" + +msgid "E766: Insufficient arguments for printf()" +msgstr "E766: Недовољно аргумената за printf()" + +msgid "E807: Expected Float argument for printf()" +msgstr "E807: Очекује се Float аргумент за printf()" + +msgid "E767: Too many arguments to printf()" +msgstr "E767: Сувише аргумената за printf()" + +msgid "W10: Warning: Changing a readonly file" +msgstr "W10: Упозорење: Мења се датотека која може само да се чита" + +msgid "Type number and <Enter> or click with mouse (empty cancels): " +msgstr "Унесите број и <Enter> или кликните мишем (ништа за отказ): " + +msgid "Type number and <Enter> (empty cancels): " +msgstr "Унесите број и <Enter> (ништа за отказ): " + +msgid "1 more line" +msgstr "1 линија више" + +msgid "1 line less" +msgstr "1 линија мање" + +#, c-format +msgid "%ld more lines" +msgstr "%ld линија више" + +#, c-format +msgid "%ld fewer lines" +msgstr "%ld линија мање" + +msgid " (Interrupted)" +msgstr " (Прекинуто)" + +msgid "Beep!" +msgstr "Биип!" + +msgid "ERROR: " +msgstr "ГРЕШКА: " + +#, c-format +msgid "" +"\n" +"[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" +msgstr "" +"\n" +"[бајтова] укупно алоц-ослоб %lu-%lu, у употр %lu, вршна употр %lu\n" + +#, c-format +msgid "" +"[calls] total re/malloc()'s %lu, total free()'s %lu\n" +"\n" +msgstr "" +"[позива] укупно re/malloc()-а %lu, укупно free()-ова %lu\n" +"\n" + +msgid "E340: Line is becoming too long" +msgstr "E340: Линија постаје предугачка" + +#, c-format +msgid "E341: Internal error: lalloc(%ld, )" +msgstr "E341: Интерна грешка: lalloc(%ld, )" + +#, c-format +msgid "E342: Out of memory! (allocating %lu bytes)" +msgstr "E342: Нема више меморије! (код алокације %lu бајтова)" + +#, c-format +msgid "Calling shell to execute: \"%s\"" +msgstr "Позива се командно окружење да изврши: \"%s\"" + +msgid "E545: Missing colon" +msgstr "E545: Недостаје двотачка" + +msgid "E546: Illegal mode" +msgstr "E546: Недозвољени режим" + +msgid "E547: Illegal mouseshape" +msgstr "E547: Недозвољени mouseshape" + +msgid "E548: digit expected" +msgstr "E548: очекује се цифра" + +msgid "E549: Illegal percentage" +msgstr "E549: Недозвољени проценат" + +msgid "E854: path too long for completion" +msgstr "E854: путања је сувише дугачка да би се довршила" + +#, c-format +msgid "" +"E343: Invalid path: '**[number]' must be at the end of the path or be " +"followed by '%s'." +msgstr "" +"E343: Неисправна путања: '**[број]' мора бити на крају путање или да иза " +"њега следи '%s'." + +#, c-format +msgid "E344: Can't find directory \"%s\" in cdpath" +msgstr "E344: Директоријум \"%s\" не може да се пронађе у cdpath" + +#, c-format +msgid "E345: Can't find file \"%s\" in path" +msgstr "E345: Датотека \"%s\" не може да се пронађе у path" + +#, c-format +msgid "E346: No more directory \"%s\" found in cdpath" +msgstr "E346: Директоријум \"%s\" више не може да се пронађе у cdpath" + +#, c-format +msgid "E347: No more file \"%s\" found in path" +msgstr "E347: Датотека \"%s\" више не може да се пронађе у path" + +#, c-format +msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" +msgstr "E668: Погрешан режим приступа за инфо датотеку NetBeans везе: \"%s\"" + +#, c-format +msgid "E658: NetBeans connection lost for buffer %ld" +msgstr "E658: NetBeans веза је изгубљена за бафер %ld" + +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: netbeans није подржан са овим GUI" + +msgid "E511: netbeans already connected" +msgstr "E511: netbeans је већ повезан" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s је само за читање (додајте ! за премошћавање)" + +msgid "E349: No identifier under cursor" +msgstr "E349: Под курсором није идентификатор" + +msgid "E774: 'operatorfunc' is empty" +msgstr "E774: 'operatorfunc' је празна" + +msgid "E775: Eval feature not available" +msgstr "E775: Eval могућност није доступна" + +msgid "Warning: terminal cannot highlight" +msgstr "Упозорење: терминал не може да истакне текст" + +msgid "E348: No string under cursor" +msgstr "E348: Под курсором нема стринга" + +msgid "E352: Cannot erase folds with current 'foldmethod'" +msgstr "E352: Са текућим 'foldmethod' не могу да се обришу склапања" + +msgid "E664: changelist is empty" +msgstr "E664: листа промена је празна" + +msgid "E662: At start of changelist" +msgstr "E662: На почетку листе промена" + +msgid "E663: At end of changelist" +msgstr "E663: На крају листе промена" + +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "" +"Откуцајте :qa! и притисните <Ентер> да одбаците све измене и напустите Vim" + +#, c-format +msgid "1 line %sed 1 time" +msgstr "1 линија %sрана 1 пут" + +#, c-format +msgid "1 line %sed %d times" +msgstr "1 линија %sрана %d пута" + +#, c-format +msgid "%ld lines %sed 1 time" +msgstr "%ld линија %sрано 1 пут" + +#, c-format +msgid "%ld lines %sed %d times" +msgstr "%ld линија %sрано %d пута" + +#, c-format +msgid "%ld lines to indent... " +msgstr "%ld за увлачење... " + +msgid "1 line indented " +msgstr "1 линија увучена " + +#, c-format +msgid "%ld lines indented " +msgstr "%ld инија увучено " + +msgid "E748: No previously used register" +msgstr "E748: Нема претходно коришћеног регистра" + +msgid "cannot yank; delete anyway" +msgstr "не може да се тргне; ипак обрисати" + +msgid "1 line changed" +msgstr "1 линија је промењена" + +#, c-format +msgid "%ld lines changed" +msgstr "%ld линија је промењено" + +#, c-format +msgid "freeing %ld lines" +msgstr "ослобађа се %ld линија" + +#, c-format +msgid " into \"%c" +msgstr " у \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "блок од 1 линије је тргнут%s" + +#, c-format +msgid "1 line yanked%s" +msgstr "1 линија је тргнута%s" + +#, c-format +msgid "block of %ld lines yanked%s" +msgstr "блок од %ld линија је тргнут%s" + +#, c-format +msgid "%ld lines yanked%s" +msgstr "%ld линија је тргнуто%s" + +#, c-format +msgid "E353: Nothing in register %s" +msgstr "E353: Регистар %s је празан" + +msgid "" +"\n" +"--- Registers ---" +msgstr "" +"\n" +"--- Регистри ---" + +msgid "Illegal register name" +msgstr "Неважеће име регистра" + +msgid "" +"\n" +"# Registers:\n" +msgstr "" +"\n" +"# Регистри:\n" + +#, c-format +msgid "E574: Unknown register type %d" +msgstr "E574: Непознат тип регистра %d" + +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: регистар за шаблон претраге и израз не може да садржи две или више " +"линија" + +#, c-format +msgid "%ld Cols; " +msgstr "%ld Кол; " + +#, c-format +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Изабрано %s%ld од %ld Линија; %lld од %lld Речи; %lld од %lld Бајтова" + +#, c-format +msgid "" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"Изабрано %s%ld од %ld Линија; %lld од %lld Речи; %lld од %lld Знака; %lld од " +"%lld Бајтова" + +#, c-format +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Кол %s од %s; Линија %ld од %ld; Реч %lld од %lld; Бајт %lld од %lld" + +#, c-format +msgid "" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %" +"lld of %lld" +msgstr "" +"Кол %s од %s; Линија %ld од %ld; Реч %lld од %lld; Знак %lld од %lld; Бајт %" +"lld од %lld" + +#, c-format +msgid "(+%lld for BOM)" +msgstr "(+%lld за BOM)" + +msgid "Thanks for flying Vim" +msgstr "Хвала што летите са Vim" + +msgid "E518: Unknown option" +msgstr "E518: Непозната опција" + +msgid "E519: Option not supported" +msgstr "E519: Опција није подржана" + +msgid "E520: Not allowed in a modeline" +msgstr "E520: Није довољено у режимској линији" + +msgid "E846: Key code not set" +msgstr "E846: Није постављрн код тастера" + +msgid "E521: Number required after =" +msgstr "E521: Потребан је број након =" + +msgid "E522: Not found in termcap" +msgstr "E522: Није пронађено у termcap" + +#, c-format +msgid "E539: Illegal character <%s>" +msgstr "E539: Недозвољен карактер <%s>" + +#, c-format +msgid "For option %s" +msgstr "За опцију %s" + +msgid "E529: Cannot set 'term' to empty string" +msgstr "E529: 'term' не може да се постави на празан стринг" + +msgid "E530: Cannot change term in GUI" +msgstr "E530: term не може да се промени из GUI" + +msgid "E531: Use \":gui\" to start the GUI" +msgstr "E531: Користите \":gui\" да покренете GUI" + +msgid "E589: 'backupext' and 'patchmode' are equal" +msgstr "E589: 'backupext' и 'patchmode' су истоветни" + +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: У конфликту са вредношћу 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: У конфликту са вредношћу 'fillchars'" + +msgid "E617: Cannot be changed in the GTK+ 2 GUI" +msgstr "E617: Не може да се промени у GTK+ 2 GUI" + +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Не може да се конвертује између %s и %s" + +msgid "E524: Missing colon" +msgstr "E524: Недостаје двотачка" + +msgid "E525: Zero length string" +msgstr "E525: Стринг дужине нула" + +#, c-format +msgid "E526: Missing number after <%s>" +msgstr "E526: Недостаје број након <%s>" + +msgid "E527: Missing comma" +msgstr "E527: Недостаје зарез" + +msgid "E528: Must specify a ' value" +msgstr "E528: Мора да се наведе ' вредност" + +msgid "E595: contains unprintable or wide character" +msgstr "E595: садржи карактер који не може да се одштампа, или широки карактер" + +msgid "E596: Invalid font(s)" +msgstr "E596: Неисправни фонт(ови)" + +msgid "E597: can't select fontset" +msgstr "E597: fontset не може да се изабере" + +msgid "E598: Invalid fontset" +msgstr "E598: Неисправан fontset" + +msgid "E533: can't select wide font" +msgstr "E533: широки фонт не може да се изабере" + +msgid "E534: Invalid wide font" +msgstr "E534: Неисправан широки фонт" + +#, c-format +msgid "E535: Illegal character after <%c>" +msgstr "E535: Неважећи карактер након <%c>" + +msgid "E536: comma required" +msgstr "E536: потребан зарез" + +#, c-format +msgid "E537: 'commentstring' must be empty or contain %s" +msgstr "E537: 'commentstring' мора бити празно или да садржи %s" + +msgid "E538: No mouse support" +msgstr "E538: Нема подршке за миша" + +msgid "E540: Unclosed expression sequence" +msgstr "E540: Низ израза није затворен" + +msgid "E541: too many items" +msgstr "E541: превише ставки" + +msgid "E542: unbalanced groups" +msgstr "E542: неуравнотежене групе" + +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "" +"E946: Терминал са задатком који се извршава не може да се учини измењивим" + +msgid "E590: A preview window already exists" +msgstr "E590: Прозор за преглед већ постоји" + +msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" +msgstr "W17: Арапски захтева UTF-8, извршите ':set encoding=utf-8'" + +msgid "E954: 24-bit colors are not supported on this environment" +msgstr "E954: Ово окружење не подржава 24-битне боје" + +#, c-format +msgid "E593: Need at least %d lines" +msgstr "E593: Потребно је најмање %d линија" + +#, c-format +msgid "E594: Need at least %d columns" +msgstr "E594: Потребно је најмање %d колона" + +#, c-format +msgid "E355: Unknown option: %s" +msgstr "E355: Непозната опција: %s" + +#, c-format +msgid "E521: Number required: &%s = '%s'" +msgstr "E521: Захтева се број: &%s = '%s'" + +msgid "" +"\n" +"--- Terminal codes ---" +msgstr "" +"\n" +"--- Кодови терминала ---" + +msgid "" +"\n" +"--- Global option values ---" +msgstr "" +"\n" +"--- Вредности глобалних опција ---" + +msgid "" +"\n" +"--- Local option values ---" +msgstr "" +"\n" +"--- Вредности локалних опција ---" + +msgid "" +"\n" +"--- Options ---" +msgstr "" +"\n" +"--- Опције ---" + +msgid "E356: get_varp ERROR" +msgstr "E356: get_varp ГРЕШКА" + +#, c-format +msgid "E357: 'langmap': Matching character missing for %s" +msgstr "E357: 'langmap': Недостаје одговарајући карактер за %s" + +#, c-format +msgid "E358: 'langmap': Extra characters after semicolon: %s" +msgstr "E358: 'langmap': Има још карактера након тачказареза: %s" + +msgid "cannot open " +msgstr "не може да се отвори " + +msgid "VIM: Can't open window!\n" +msgstr "VIM: Прозор не може да се отвори!\n" + +msgid "Need Amigados version 2.04 or later\n" +msgstr "Потребан је Amigados верзија 2.04 или каснији\n" + +#, c-format +msgid "Need %s version %ld\n" +msgstr "Потребан је %s верзија %ld\n" + +msgid "Cannot open NIL:\n" +msgstr "Не може да се отвори NIL:\n" + +msgid "Cannot create " +msgstr "Не може да се креира " + +#, c-format +msgid "Vim exiting with %d\n" +msgstr "Vim излази са %d\n" + +msgid "cannot change console mode ?!\n" +msgstr "конзолни режим не може да се промени ?!\n" + +msgid "mch_get_shellsize: not a console??\n" +msgstr "mch_get_shellsize: није конзола??\n" + +msgid "E360: Cannot execute shell with -f option" +msgstr "E360: Командно окружење не може да се изврши са -f опцијом" + +msgid "Cannot execute " +msgstr "Не може да се изврши " + +msgid "shell " +msgstr "командно окружење " + +msgid " returned\n" +msgstr " вратило\n" + +msgid "ANCHOR_BUF_SIZE too small." +msgstr "ANCHOR_BUF_SIZE сувише мали." + +msgid "I/O ERROR" +msgstr "У/И ГРЕШКА" + +msgid "Message" +msgstr "Порука" + +msgid "E237: Printer selection failed" +msgstr "E237: Избор штампача није успео" + +#, c-format +msgid "to %s on %s" +msgstr "у %s на %s" + +#, c-format +msgid "E613: Unknown printer font: %s" +msgstr "E613: Непознат фонт штампача: %s" + +#, c-format +msgid "E238: Print error: %s" +msgstr "E238: Грешка код штампања: %s" + +#, c-format +msgid "Printing '%s'" +msgstr "Штампа се '%s'" + +#, c-format +msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" +msgstr "E244: Недозвољено име сета карактера \"%s\" у имену фонту \"%s\"" + +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Недозвољено име варијанте \"%s\" у имену фонту \"%s\"" + +#, c-format +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: Неисправан карактер '%c' у имену фонта \"%s\"" + +#, c-format +msgid "Opening the X display took %ld msec" +msgstr "Отварање X приказа је трајало %ld мсек" + +msgid "" +"\n" +"Vim: Got X error\n" +msgstr "" +"\n" +"Vim: Дошло је до X грешке\n" + +msgid "Testing the X display failed" +msgstr "Тестирање X приказа није успело" + +msgid "Opening the X display timed out" +msgstr "Истекло је максимално време за отварање X приказа" + +msgid "" +"\n" +"Could not get security context for " +msgstr "" +"\n" +"Није могао да се очита безбедносни контекст за " + +msgid "" +"\n" +"Could not set security context for " +msgstr "" +"\n" +"Није могао да се постави безбедносни контекст за " + +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Безбедносни контекст %s за %s није могао да се постави" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Безбедносни контекст %s за %s није могао да се очита. Уклања се!" + +msgid "" +"\n" +"Cannot execute shell sh\n" +msgstr "" +"\n" +"Командно окружење sh не може да се изврши\n" + +msgid "" +"\n" +"shell returned " +msgstr "" +"\n" +"командно окружење је вратило " + +msgid "" +"\n" +"Cannot create pipes\n" +msgstr "" +"\n" +"Токови података не могу да се креирају\n" + +msgid "" +"\n" +"Cannot fork\n" +msgstr "" +"\n" +"Рачвање није могуће\n" + +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Командно окружење не може да се изврши " + +msgid "" +"\n" +"Command terminated\n" +msgstr "" +"\n" +"Команда је прекинута\n" + +msgid "XSMP lost ICE connection" +msgstr "XSMP је изгубио ICE везу" + +#, c-format +msgid "dlerror = \"%s\"" +msgstr "dlerror = \"%s\"" + +msgid "Opening the X display failed" +msgstr "Отварање X приказа није успело" + +msgid "XSMP handling save-yourself request" +msgstr "XSMP опслужује сачувај-се захтев" + +msgid "XSMP opening connection" +msgstr "XSMP отвара везу" + +msgid "XSMP ICE connection watch failed" +msgstr "XSMP ICE надгледање везе није успело" + +#, c-format +msgid "XSMP SmcOpenConnection failed: %s" +msgstr "XSMP SmcOpenConnection није успело: %s" + +msgid "At line" +msgstr "Код линије" + +msgid "Could not load vim32.dll!" +msgstr "vim32.dll није могла да се учита!" + +msgid "VIM Error" +msgstr "VIM Грешка" + +msgid "Could not fix up function pointers to the DLL!" +msgstr "Показивачи на функције у DLL-у нису могли да се поправе!" + +#, c-format +msgid "Vim: Caught %s event\n" +msgstr "Vim: Ухваћен је %s догађај\n" + +msgid "close" +msgstr "затварање" + +msgid "logoff" +msgstr "одјављивање" + +msgid "shutdown" +msgstr "искључивање" + +msgid "E371: Command not found" +msgstr "E371: Команда није пронађена" + +msgid "" +"VIMRUN.EXE not found in your $PATH.\n" +"External commands will not pause after completion.\n" +"See :help win32-vimrun for more information." +msgstr "" +"VIMRUN.EXE није пронађен у вашем $PATH.\n" +"Екстерне команде неће моћи да се паузирају након завршетка.\n" +"Погледајте :help win32-vimrun за више информација." + +msgid "Vim Warning" +msgstr "Vim Упозорење" + +#, c-format +msgid "shell returned %d" +msgstr "командно окружење је вратило %d" + +msgid "E926: Current location list was changed" +msgstr "E926: Текућа листа локација је промењена" + +#, c-format +msgid "E372: Too many %%%c in format string" +msgstr "E372: Превише %%%c стрингу формата" + +#, c-format +msgid "E373: Unexpected %%%c in format string" +msgstr "E373: Неочекивано %%%c стрингу формата" + +msgid "E374: Missing ] in format string" +msgstr "E374: Недостаје ] у стрингу формата" + +#, c-format +msgid "E375: Unsupported %%%c in format string" +msgstr "E375: Неподржано %%%c у стрингу формата" + +#, c-format +msgid "E376: Invalid %%%c in format string prefix" +msgstr "E376: Неважеће %%%c у префиксу стринга формата" + +#, c-format +msgid "E377: Invalid %%%c in format string" +msgstr "E377: Неважеће %%%c у стрингу формата" + +msgid "E378: 'errorformat' contains no pattern" +msgstr "E378: 'errorformat' не садржи шаблон" + +msgid "E379: Missing or empty directory name" +msgstr "E379: Име директоријума недостаје или је празно" + +msgid "E553: No more items" +msgstr "E553: Нема више ставки" + +msgid "E924: Current window was closed" +msgstr "E924: Текући прозор је затворен" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Текући quickfix је промењен" + +#, c-format +msgid "(%d of %d)%s%s: " +msgstr "(%d од %d)%s%s: " + +msgid " (line deleted)" +msgstr " (линија обрисана)" + +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sлиста грешака %d од %d; %d грешака " + +msgid "E380: At bottom of quickfix stack" +msgstr "E380: На дну quickfix стека" + +msgid "E381: At top of quickfix stack" +msgstr "E381: На врху quickfix стека" + +msgid "No entries" +msgstr "Нема уноса" + +msgid "Error file" +msgstr "Датотека грешака" + +msgid "E683: File name missing or invalid pattern" +msgstr "E683: Недостаје име датотеке или неважећи шаблон" + +#, c-format +msgid "Cannot open file \"%s\"" +msgstr "Датотека \"%s\" не може да се отвори" + +msgid "E681: Buffer is not loaded" +msgstr "E681: Бафер није учитан" + +msgid "E777: String or List expected" +msgstr "E777: Очекује се String или List" + +#, c-format +msgid "E369: invalid item in %s%%[]" +msgstr "E369: неважећа ставка у %s%%[]" + +#, c-format +msgid "E769: Missing ] after %s[" +msgstr "E769: Недостаје ] након %s[" + +msgid "E944: Reverse range in character class" +msgstr "E944: Обрнути опсег у карактер класи" + +msgid "E945: Range too large in character class" +msgstr "E945: Превелики опсег у карактер класи" + +#, c-format +msgid "E53: Unmatched %s%%(" +msgstr "E53: Неупарена %s%%(" + +#, c-format +msgid "E54: Unmatched %s(" +msgstr "E54: Неупарена %s(" + +#, c-format +msgid "E55: Unmatched %s)" +msgstr "E55: Неупарена %s)" + +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( овде није дозвољено" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 и остали онвде нису дозвољени" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: Недостаје ] након %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: Празан %s%%[]" + +msgid "E65: Illegal back reference" +msgstr "E65: Неважећа повратна референца" + +msgid "E339: Pattern too long" +msgstr "E339: Шаблон је предугачак" + +msgid "E50: Too many \\z(" +msgstr "E50: Превише \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Превише %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: Неупарено \\z(" + +#, c-format +msgid "E59: invalid character after %s@" +msgstr "E59: неважећи карактер након %s@" + +#, c-format +msgid "E60: Too many complex %s{...}s" +msgstr "E60: Превише комплексних %s{...}s" + +#, c-format +msgid "E61: Nested %s*" +msgstr "E61: Угњеждено %s*" + +#, c-format +msgid "E62: Nested %s%c" +msgstr "E62: Угњеждено %s%c" + +msgid "E63: invalid use of \\_" +msgstr "E63: неисправна употреба \\_" + +#, c-format +msgid "E64: %s%c follows nothing" +msgstr "E64: %s%c je иза ничега" + +msgid "E68: Invalid character after \\z" +msgstr "E68: Неважећи карактер након \\z" + +#, c-format +msgid "E678: Invalid character after %s%%[dxouU]" +msgstr "E678: Неважећи карактер након %s%%[dxouU]" + +#, c-format +msgid "E71: Invalid character after %s%%" +msgstr "E71: Неважећи карактер након %s%%" + +#, c-format +msgid "E554: Syntax error in %s{...}" +msgstr "E554: Синтаксна грешка у %s{...}" + +msgid "External submatches:\n" +msgstr "Спољна подпоклапања:\n" + +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) не може да се понови %s" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: Иза \\%#= може да следи једино 0, 1, или 2. Користиће се аутоматски " +"енџин " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Пребацивање на backtracking RE енџин за шаблон: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: Крај (NFA) Regexp израза је достигнут прерано" + +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA regexp) %c је на погрешном месту" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Неважећа карактер класа: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Непознати оператор '\\z%c'" + +msgid "E951: \\% value too large" +msgstr "E951: Вредност \\% је предугачка" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Непознати оператор '\\%%%c'" + +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Грешка при грађењу NFA са класом еквиваленције!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Непознати оператор '\\@%c'" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA regexp) Грешка при читању граница понављања" + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Мулти не може следи иза мулти !" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA regexp) Превише '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA regexp) Превише \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA regexp) грешка правилне терминације" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) Скидање са стека није успело !" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (NFA regexp) (Док је вршена конверзија из postfix у NFA), превише " +"стања је остало на стеку" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "" +"E876: (NFA regexp) Нема довољно простора да се ускладишти комплетан NFA " + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) Није могла да се алоцира меморија за обилазак грана!" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Привремена лог датотека није могла да се отвори за упис, приказује се на " +"stderr ... " + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) %s НЕ МОЖЕ ДА СЕ ОТВОРИ !" + +msgid "Could not open temporary log file for writing " +msgstr "Привремена лог датотека није могла да се отвори за упис " + +msgid " VREPLACE" +msgstr "ВЗАМЕНА" + +msgid " REPLACE" +msgstr " ЗАМЕНА" + +msgid " REVERSE" +msgstr " ОБРНУТО" + +msgid " INSERT" +msgstr " УМЕТАЊЕ" + +msgid " (insert)" +msgstr " (уметање)" + +msgid " (replace)" +msgstr " (замена)" + +msgid " (vreplace)" +msgstr " (взамена)" + +msgid " Hebrew" +msgstr " хебрејски" + +msgid " Arabic" +msgstr " арапски" + +msgid " (paste)" +msgstr " (налепи)" + +msgid " VISUAL" +msgstr " ВИЗУЕЛНО" + +msgid " VISUAL LINE" +msgstr " ВИЗУЕЛНА ЛИНИЈА" + +msgid " VISUAL BLOCK" +msgstr " ВИЗУЕЛНИ БЛОК" + +msgid " SELECT" +msgstr " ИЗБОР" + +msgid " SELECT LINE" +msgstr " ИЗБОР ЛИНИЈА" + +msgid " SELECT BLOCK" +msgstr " ИЗБОР БЛОКА" + +msgid "recording" +msgstr "снимање" + +#, c-format +msgid "E383: Invalid search string: %s" +msgstr "E383: Неисправан стринг за претрагу: %s" + +#, c-format +msgid "E384: search hit TOP without match for: %s" +msgstr "E384: претрага је достигла ВРХ без подударања за: %s" + +#, c-format +msgid "E385: search hit BOTTOM without match for: %s" +msgstr "E385: претрага је достигла ДНО без подударања за: %s" + +msgid "E386: Expected '?' or '/' after ';'" +msgstr "E386: Након ';' се очекује '?' или '/'" + +msgid " (includes previously listed match)" +msgstr " (укључује претходно наведена подударања)" + +msgid "--- Included files " +msgstr "--- Прикључене датотеке " + +msgid "not found " +msgstr "нису пронађене " + +msgid "in path ---\n" +msgstr "у путањи ---\n" + +msgid " (Already listed)" +msgstr " (Већ наведено)" + +msgid " NOT FOUND" +msgstr " НИЈЕ ПРОНАЂЕНО" + +#, c-format +msgid "Scanning included file: %s" +msgstr "Прегледање уметнуте датотеке: %s" + +#, c-format +msgid "Searching included file %s" +msgstr "Претраживање уметнуте датотеке %s" + +msgid "E387: Match is on current line" +msgstr "E387: Подударање је у текућој линији" + +msgid "All included files were found" +msgstr "Све уметнуте датотеке су пронађене" + +msgid "No included files" +msgstr "Нема уметнутих датотека" + +msgid "E388: Couldn't find definition" +msgstr "E388: Дефиниција не може да се пронађе" + +msgid "E389: Couldn't find pattern" +msgstr "E389: Шаблон за претрагу није пронађен" + +msgid "Substitute " +msgstr "Замена " + +#, c-format +msgid "" +"\n" +"# Last %sSearch Pattern:\n" +"~" +msgstr "" +"\n" +"# Последњи %sШаблон Претраге:\n" +"~" + +msgid "E756: Spell checking is not enabled" +msgstr "E756: Провера правописа није омогућена" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Упозорење: Листа речи \"%s_%s.spl\" или \"%s_ascii.spl\" не може да се " +"пронађе" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Упозорење: Листа речи \"%s.%s.spl\" или \"%s.ascii.spl\" не може да се " +"пронађе" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing аутокоманда је обрисала бафер" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Упозорење: регион %s није подржан" + +msgid "Sorry, no suggestions" +msgstr "Жао нам је, нема сугестија" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Жао нам је, само %ld сугестија" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Променити \"%.*s\" у:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Нема претходне правописне замене" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Није пронађено: %s" + +msgid "E758: Truncated spell file" +msgstr "E758: Правописна датотека је прекраћена" + +#, c-format +msgid "Trailing text in %s line %d: %s" +msgstr "Текст вишак у %s линија %d: %s" + +#, c-format +msgid "Affix name too long in %s line %d: %s" +msgstr "Име наставка је предугачко у %s линија %d: %s" + +msgid "E761: Format error in affix file FOL, LOW or UPP" +msgstr "E761: Грешка формата у датотеци наставака FOL, LOW или UPP" + +msgid "E762: Character in FOL, LOW or UPP is out of range" +msgstr "E762: Карактер у FOL, LOW или UPP је ван опсега" + +msgid "Compressing word tree..." +msgstr "Стабло речи се компресује..." + +#, c-format +msgid "Reading spell file \"%s\"" +msgstr "Читање правописне датотеке \"%s\"" + +msgid "E757: This does not look like a spell file" +msgstr "E757: Ово не изгледа као правописна датотека" + +msgid "E771: Old spell file, needs to be updated" +msgstr "E771: Стара правописна датотека, потребно је да се освежи" + +msgid "E772: Spell file is for newer version of Vim" +msgstr "E772: Правописна датотека је за новију верзију Vim-а" + +msgid "E770: Unsupported section in spell file" +msgstr "E770: Неподржана секција у правописној датотеци" + +#, c-format +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Ово не изгледа као .sug датотека: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Стара .sug датотека, потребно је да се освежи: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug датотека је за новију верзију Vim-а: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug датотека не одговара .spl датотеци: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: грешка приликом читања .sug датотеке: %s" + +#, c-format +msgid "Reading affix file %s ..." +msgstr "Читање датотеке наставака %s ..." + +#, c-format +msgid "Conversion failure for word in %s line %d: %s" +msgstr "Неуспешна конверзија за реч у %s линија %d: %s" + +#, c-format +msgid "Conversion in %s not supported: from %s to %s" +msgstr "Конверзија у %s није подржана: из %s у %s" + +#, c-format +msgid "Conversion in %s not supported" +msgstr "Конверзија у %s није подржана" + +#, c-format +msgid "Invalid value for FLAG in %s line %d: %s" +msgstr "Неважећа вредност за FLAG у %s линија %d: %s" + +#, c-format +msgid "FLAG after using flags in %s line %d: %s" +msgstr "FLAG након коришћења индикатора у %s линија %d: %s" + +#, c-format +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Дефинисање COMPOUNDFORBIDFLAG након PFX ставке може да дâ погрешне резултате " +"у %s line %d" + +#, c-format +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"Дефинисање COMPOUNDPERMITFLAG након PFX ставке може да дâ погрешне резултате " +"у %s line %d" + +#, c-format +msgid "Wrong COMPOUNDRULES value in %s line %d: %s" +msgstr "Погрешна COMPOUNDRULES вредност у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" +msgstr "Погрешна COMPOUNDWORDMAX вредност у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDMIN value in %s line %d: %s" +msgstr "Погрешна COMPOUNDMIN вредност у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" +msgstr "Погрешна COMPOUNDSYLMAX вредност у %s линија %d: %s" + +#, c-format +msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" +msgstr "Погрешна CHECKCOMPOUNDPATTERN вредност у %s линија %d: %s" + +#, c-format +msgid "Different combining flag in continued affix block in %s line %d: %s" +msgstr "" +"Различит индикатор комбиновања у настављеном блоку наставака у %s линија %d: " +"%s" + +#, c-format +msgid "Duplicate affix in %s line %d: %s" +msgstr "Дупликат наставка у %s линија %d: %s" + +#, c-format +msgid "" +"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " +"line %d: %s" +msgstr "" +"Наставак се такође користи за BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST у %s" +"линија %d: %s" + +#, c-format +msgid "Expected Y or N in %s line %d: %s" +msgstr "Очекује се Y или N у %s линија %d: %s" + +#, c-format +msgid "Broken condition in %s line %d: %s" +msgstr "Неправилан услов у %s линија %d: %s" + +#, c-format +msgid "Expected REP(SAL) count in %s line %d" +msgstr "Очекује се број REP(SAL) у %s линија %d" + +#, c-format +msgid "Expected MAP count in %s line %d" +msgstr "Очекује се број MAP у %s линија %d" + +#, c-format +msgid "Duplicate character in MAP in %s line %d" +msgstr "Дупликат карактера у MAP у %s линија %d" + +#, c-format +msgid "Unrecognized or duplicate item in %s line %d: %s" +msgstr "Непрепосната или дупла ставка у %s линија %d: %s" + +#, c-format +msgid "Missing FOL/LOW/UPP line in %s" +msgstr "Недостаје FOL/LOW/UPP линија у %s" + +msgid "COMPOUNDSYLMAX used without SYLLABLE" +msgstr "COMPOUNDSYLMAX се користи без SYLLABLE" + +msgid "Too many postponed prefixes" +msgstr "Превише закашњених префикса" + +msgid "Too many compound flags" +msgstr "Превише индикатора сложеница" + +msgid "Too many postponed prefixes and/or compound flags" +msgstr "Превише закашњених префикса и/или индикатора сложеница" + +#, c-format +msgid "Missing SOFO%s line in %s" +msgstr "Недостаје SOFO%s линија у %s" + +#, c-format +msgid "Both SAL and SOFO lines in %s" +msgstr "И SAL и SOFO линије у %s" + +#, c-format +msgid "Flag is not a number in %s line %d: %s" +msgstr "Индикатор није број у %s линија %d: %s" + +#, c-format +msgid "Illegal flag in %s line %d: %s" +msgstr "Неважећи индикатор у %s линија %d: %s" + +#, c-format +msgid "%s value differs from what is used in another .aff file" +msgstr "" +"%s вредност се разликује од онога што је коришћено у другој .aff датотеци" + +#, c-format +msgid "Reading dictionary file %s ..." +msgstr "Читање датотеке речника %s ..." + +#, c-format +msgid "E760: No word count in %s" +msgstr "E760: Нема броја речи у %s" + +#, c-format +msgid "line %6d, word %6ld - %s" +msgstr "линија %6d, реч %6ld - %s" + +#, c-format +msgid "Duplicate word in %s line %d: %s" +msgstr "Дупликат речи у %s линија %d: %s" + +#, c-format +msgid "First duplicate word in %s line %d: %s" +msgstr "Прва реч дупликат у %s линија %d: %s" + +#, c-format +msgid "%d duplicate word(s) in %s" +msgstr "%d реч(и) дупликат(а) у %s" + +#, c-format +msgid "Ignored %d word(s) with non-ASCII characters in %s" +msgstr "Игнорисана/о %d реч(и) са не-ASCII карактерима у %s" + +#, c-format +msgid "Reading word file %s ..." +msgstr "Читање датотеке речи %s ..." + +#, c-format +msgid "Duplicate /encoding= line ignored in %s line %d: %s" +msgstr "Дупликат /encoding= линија је игнорисана у %s линија %d: %s" + +#, c-format +msgid "/encoding= line after word ignored in %s line %d: %s" +msgstr "/encoding= линија након речи је игнорисана у %s линија %d: %s" + +#, c-format +msgid "Duplicate /regions= line ignored in %s line %d: %s" +msgstr "Дупликат /regions= линија је игнорисана у %s линија %d: %s" + +#, c-format +msgid "Too many regions in %s line %d: %s" +msgstr "Превише региона у %s линија %d: %s" + +#, c-format +msgid "/ line ignored in %s line %d: %s" +msgstr "/ линија игнорисана у %s линија %d: %s" + +#, c-format +msgid "Invalid region nr in %s line %d: %s" +msgstr "Неважећи број региона у %s линија %d: %s" + +#, c-format +msgid "Unrecognized flags in %s line %d: %s" +msgstr "Непрепознати индикатори у %s линија %d: %s" + +#, c-format +msgid "Ignored %d words with non-ASCII characters" +msgstr "Игнорисано је %d рћи са не-ASCII карактерима" + +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Недовољно меморије, листа речи неће бити комплетна" + +#, c-format +msgid "Compressed %d of %d nodes; %d (%d%%) remaining" +msgstr "Компресовано је %d од %d чворова; преостало је још %d (%d%%)" + +msgid "Reading back spell file..." +msgstr "Читање правописне датотеке..." + +msgid "Performing soundfolding..." +msgstr "Извођење склапања по звучности..." + +#, c-format +msgid "Number of words after soundfolding: %ld" +msgstr "Број речи након склапања по звучности: %ld" + +#, c-format +msgid "Total number of words: %d" +msgstr "Укупан број речи: %d" + +#, c-format +msgid "Writing suggestion file %s ..." +msgstr "Уписивање датотеке предлога %s ..." + +#, c-format +msgid "Estimated runtime memory use: %d bytes" +msgstr "Процењена потребна величина меморије у време извршавања: %d бајтова" + +msgid "E751: Output file name must not have region name" +msgstr "E751: Име излазне датотеке не сме да има име региона" + +#, c-format +msgid "E754: Only up to %ld regions supported" +msgstr "E754: Подржано је само до %ld региона" + +#, c-format +msgid "E755: Invalid region in %s" +msgstr "E755: Неважећи регион у %s" + +msgid "Warning: both compounding and NOBREAK specified" +msgstr "Упозорење: наведени су и слагање и NOBREAK" + +#, c-format +msgid "Writing spell file %s ..." +msgstr "Уписивање правописне датотеке %s ..." + +msgid "Done!" +msgstr "Завршено!" + +#, c-format +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' не садржи %ld ставке" + +#, c-format +msgid "Word '%.*s' removed from %s" +msgstr "Реч '%.*s' је уклоњена из %s" + +#, c-format +msgid "Word '%.*s' added to %s" +msgstr "Реч '%.*s' је додата у %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: Карактери у речи се разликују између правописних датотека" + +msgid "E783: duplicate char in MAP entry" +msgstr "E783: карактер дупликат у MAP ставци" + +msgid "No Syntax items defined for this buffer" +msgstr "За оба јбафер нису дефинисане синтаксне ставке" + +msgid "syntax conceal on" +msgstr "скривање синтаксе укључено" + +msgid "syntax conceal off" +msgstr "скривање синтаксе искључено" + +#, c-format +msgid "E390: Illegal argument: %s" +msgstr "E390: Неважећи аргумент: %s" + +msgid "syntax case ignore" +msgstr "мала/велика слова се не разликују у синтакси" + +msgid "syntax case match" +msgstr "мала/велика слова се разликују у синтакси" + +msgid "syntax spell toplevel" +msgstr "синтакса правописа toplevel" + +msgid "syntax spell notoplevel" +msgstr "синтакса правописа notoplevel" + +msgid "syntax spell default" +msgstr "синтакса правописа подразумевано" + +msgid "syntax iskeyword " +msgstr "синтакса iskeyword " + +#, c-format +msgid "E391: No such syntax cluster: %s" +msgstr "E391: Не постоји такав синтаксни кластер: %s" + +msgid "syncing on C-style comments" +msgstr "синхронизација на коментарима C-стила" + +msgid "no syncing" +msgstr "без синхронизације" + +msgid "syncing starts " +msgstr "синхронизација почиње " + +msgid " lines before top line" +msgstr " линија пре линије на врху" + +msgid "" +"\n" +"--- Syntax sync items ---" +msgstr "" +"\n" +"--- Ставке синхро синтаксе ---" + +msgid "" +"\n" +"syncing on items" +msgstr "" +"\n" +"синхро на ставкама" + +msgid "" +"\n" +"--- Syntax items ---" +msgstr "" +"\n" +"--- Ставке синтаксе ---" + +#, c-format +msgid "E392: No such syntax cluster: %s" +msgstr "E392: не постоји такав синтаксни кластер: %s" + +msgid "minimal " +msgstr "минимално " + +msgid "maximal " +msgstr "максимално " + +msgid "; match " +msgstr "; подударања " + +msgid " line breaks" +msgstr " прелома линије" + +msgid "E395: contains argument not accepted here" +msgstr "E395: садржи аргумент који се овде не прихвата" + +msgid "E844: invalid cchar value" +msgstr "E844: неважећа cchar вредност" + +msgid "E393: group[t]here not accepted here" +msgstr "E393: group[t]here се овде не прихвата" + +#, c-format +msgid "E394: Didn't find region item for %s" +msgstr "E394: Ставка региона није пронађена за %s" + +msgid "E397: Filename required" +msgstr "E397: Потребно име датотеке" + +msgid "E847: Too many syntax includes" +msgstr "E847: Превише синтаксних уметања" + +#, c-format +msgid "E789: Missing ']': %s" +msgstr "E789: Недостаје ']': %s" + +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: карактер вишка након ']': %s]%s" + +#, c-format +msgid "E398: Missing '=': %s" +msgstr "E398: Недостаје '=': %s" + +#, c-format +msgid "E399: Not enough arguments: syntax region %s" +msgstr "E399: Нема довољно аргумената: синтаксни регион %s" + +msgid "E848: Too many syntax clusters" +msgstr "E848: Превише синтаксних кластера" + +msgid "E400: No cluster specified" +msgstr "E400: Није наведен ниједан кластер" + +#, c-format +msgid "E401: Pattern delimiter not found: %s" +msgstr "E401: Није пронађен граничник шаблона: %s" + +#, c-format +msgid "E402: Garbage after pattern: %s" +msgstr "E402: Смеће након шаблона: %s" + +msgid "E403: syntax sync: line continuations pattern specified twice" +msgstr "E403: синтаксна синхро: шаблон настављања линије је наведен двапут" + +#, c-format +msgid "E404: Illegal arguments: %s" +msgstr "E404: Неважећи аргументи: %s" + +#, c-format +msgid "E405: Missing equal sign: %s" +msgstr "E405: недостаје знак једнакости: %s" + +#, c-format +msgid "E406: Empty argument: %s" +msgstr "E406: Празан аргумент: %s" + +#, c-format +msgid "E407: %s not allowed here" +msgstr "E407: %s овде није дозвољено" + +#, c-format +msgid "E408: %s must be first in contains list" +msgstr "E408: %s мора да буде прво у contains листи" + +#, c-format +msgid "E409: Unknown group name: %s" +msgstr "E409: Непознато име групе: %s" + +#, c-format +msgid "E410: Invalid :syntax subcommand: %s" +msgstr "E410: Неважећа :syntax подкоманда: %s" + +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" УКУПНО БРОЈ ПОДУД НАЈСПОРИЈЕ ПРОСЕК ИМЕ ШАБЛОН" + +msgid "E679: recursive loop loading syncolor.vim" +msgstr "E679: Рекурзивна петља код учитавања syncolor.vim" + +#, c-format +msgid "E411: highlight group not found: %s" +msgstr "E411: група истицања није пронађена: %s" + +#, c-format +msgid "E412: Not enough arguments: \":highlight link %s\"" +msgstr "E412: Нема довољно аргумената: \":highlight link %s\"" + +#, c-format +msgid "E413: Too many arguments: \":highlight link %s\"" +msgstr "E413: Сувише аргумената: \":highlight link %s\"" + +msgid "E414: group has settings, highlight link ignored" +msgstr "E414: група има поставке, highlight link се игнорише" + +#, c-format +msgid "E415: unexpected equal sign: %s" +msgstr "E415: неочкиван знак једнакости: %s" + +#, c-format +msgid "E416: missing equal sign: %s" +msgstr "E416: недостаје знак једнакости: %s" + +#, c-format +msgid "E417: missing argument: %s" +msgstr "E417: недостаје аргумент: %s" + +#, c-format +msgid "E418: Illegal value: %s" +msgstr "E418: Неважећа вредност: %s" + +msgid "E419: FG color unknown" +msgstr "E419: Непозната FG боја" + +msgid "E420: BG color unknown" +msgstr "E420: Непозната BG боја" + +#, c-format +msgid "E421: Color name or number not recognized: %s" +msgstr "E421: Име боје или број нису препознати: %s" + +#, c-format +msgid "E422: terminal code too long: %s" +msgstr "E422: код терминала је предугачак: %s" + +#, c-format +msgid "E423: Illegal argument: %s" +msgstr "E423: Неважећи аргумент: %s" + +msgid "E424: Too many different highlighting attributes in use" +msgstr "E424: У употреби је превише различитих атрибута истицања" + +msgid "E669: Unprintable character in group name" +msgstr "E669: У имену групе је карактер који не може да се штампа" + +msgid "W18: Invalid character in group name" +msgstr "W18: Неважећи карактер у имену групе" + +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Превише синтаксних и група истицања" + +msgid "E555: at bottom of tag stack" +msgstr "E555: на дну стека ознака" + +msgid "E556: at top of tag stack" +msgstr "E556: на врху стека ознака" + +msgid "E425: Cannot go before first matching tag" +msgstr "E425: Не може да се иде испред прве подударајуће ознаке" + +#, c-format +msgid "E426: tag not found: %s" +msgstr "E426: ознака није пронађена: %s" + +msgid " # pri kind tag" +msgstr " # ознака pri врсте" + +msgid "file\n" +msgstr "датотека\n" + +msgid "E427: There is only one matching tag" +msgstr "E427: Постоји само једна подударајућа ознака" + +msgid "E428: Cannot go beyond last matching tag" +msgstr "E428: Не може да се иде иза последње подударајуће ознаке" + +#, c-format +msgid "File \"%s\" does not exist" +msgstr "Датотека \"%s\" не постоји" + +#, c-format +msgid "tag %d of %d%s" +msgstr "ознака %d од %d%s" + +msgid " or more" +msgstr " или више" + +msgid " Using tag with different case!" +msgstr " Користи се ознака за другом врстом слова (мала/велика)!" + +#, c-format +msgid "E429: File \"%s\" does not exist" +msgstr "E429: Датотека \"%s\" не постоји" + +msgid "" +"\n" +" # TO tag FROM line in file/text" +msgstr "" +"\n" +" # НА ознака ОД линије у датот/текст" + +#, c-format +msgid "Searching tags file %s" +msgstr "Претраживање датотеке ознака %s" + +#, c-format +msgid "E430: Tag file path truncated for %s\n" +msgstr "E430: Путања датотеке ознака је прекинута за %s\n" + +msgid "Ignoring long line in tags file" +msgstr "Дугачка линија у датотеци ознака се игнорише" + +#, c-format +msgid "E431: Format error in tags file \"%s\"" +msgstr "E431: Грешка формата у датотеци ознака \"%s\"" + +#, c-format +msgid "Before byte %ld" +msgstr "Пре бајта %ld" + +#, c-format +msgid "E432: Tags file not sorted: %s" +msgstr "E432: Датотека ознака није сортирана: %s" + +msgid "E433: No tags file" +msgstr "E433: Нема датотеке ознака" + +msgid "E434: Can't find tag pattern" +msgstr "E434: Не може да се пронађе шаблон ознаке" + +msgid "E435: Couldn't find tag, just guessing!" +msgstr "E435: Ознака није могла да се пронађе, само нагађам!" + +#, c-format +msgid "Duplicate field name: %s" +msgstr "Дупло име поља: %s" + +msgid "' not known. Available builtin terminals are:" +msgstr "' није познат. Доступни уграђени терминали су:" + +msgid "defaulting to '" +msgstr "подразумева се '" + +msgid "E557: Cannot open termcap file" +msgstr "E557: termcap датотека не може да се отвори" + +msgid "E558: Terminal entry not found in terminfo" +msgstr "E558: У terminfo није пронађена ставка за терминал" + +msgid "E559: Terminal entry not found in termcap" +msgstr "E559: У termcap није пронађена ставка терминала" + +#, c-format +msgid "E436: No \"%s\" entry in termcap" +msgstr "E436: Нема \"%s\" ставке у termcap" + +msgid "E437: terminal capability \"cm\" required" +msgstr "E437: потребна је могућност терминала \"cm\"" + +msgid "" +"\n" +"--- Terminal keys ---" +msgstr "" +"\n" +"--- Тастери терминала ---" + +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Не може да се отвори $VIMRUNTIME/rgb.txt" + +#, c-format +msgid "Kill job in \"%s\"?" +msgstr "Да ли да се уништи задатак у \"%s\"?" + +msgid "Terminal" +msgstr "Терминал" + +msgid "Terminal-finished" +msgstr "Терминал-завршен" + +msgid "active" +msgstr "aktivan" + +msgid "running" +msgstr "ради" + +msgid "finished" +msgstr "завршен" + +#, c-format +msgid "E953: File exists: %s" +msgstr "E953: Датотека већ постоји: %s" + +msgid "E955: Not a terminal buffer" +msgstr "E955: Није терминалски бафер" + +msgid "new shell started\n" +msgstr "покренуто ново командно окружење\n" + +msgid "Vim: Error reading input, exiting...\n" +msgstr "Vim: Грешка при читању улаза, излазак...\n" + +msgid "Used CUT_BUFFER0 instead of empty selection" +msgstr "Уместо празне селекције корићен је CUT_BUFFER0" + +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Број линија се неочекивано променио" + +msgid "No undo possible; continue anyway" +msgstr "Није могућ опозив; ипак настави" + +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: Датотека опозива не може да се отвори за упис: %s" + +#, c-format +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: Искварена датотека за опозив (%s): %s" + +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "" +"Датотека за опозив не може да се упише ни у један директоријум из 'undodir'" + +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "" +"Неће се вршити преписивање са датотеком опозива, читање није могуће: %s" + +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "Неће се цршити преписивање, ово није датотека за опозив: %s" + +msgid "Skipping undo file write, nothing to undo" +msgstr "Прескакање уписа у датотеку за опозив, нема шта да се опозове" + +#, c-format +msgid "Writing undo file: %s" +msgstr "Упис датотеке за опозив: %s" + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: грешка код уписа у датотеку за опозив: %s" + +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "Датотека за опозив се не чита, власник се разликује: %s" + +#, c-format +msgid "Reading undo file: %s" +msgstr "Читање датотеке за опозив: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: Датотека за опозив не може да се отвори за читање: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: Није датотека за опозив: %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "" +"E832: Датотека која није шифрована има шифровану датотеку за опозив: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Дешифровање датотеке за опозив није успело: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: Датотека за опозив је шифрована: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Некомпатибилна датотека за опозив: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "" +"Садржај датотеке је промењен, информације за опозив не могу да се користе" + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Тавршено је читање датотеке за опозив %s" + +msgid "Already at oldest change" +msgstr "Већ сте на најстаријој измени" + +msgid "Already at newest change" +msgstr "Већ сте на најновијој измени" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: Број опозива %ld није пронађен" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: погрешни бројеви линије" + +msgid "more line" +msgstr "линија више" + +msgid "more lines" +msgstr "линија више" + +msgid "line less" +msgstr "линија мање" + +msgid "fewer lines" +msgstr "линија мање" + +msgid "change" +msgstr "измена" + +msgid "changes" +msgstr "измена" + +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s; %s #%ld %s" + +msgid "before" +msgstr "пре" + +msgid "after" +msgstr "након" + +msgid "Nothing to undo" +msgstr "Ништа за опозив" + +msgid "number changes when saved" +msgstr "број измене када сачувано" + +#, c-format +msgid "%ld seconds ago" +msgstr "пре %ld секунди" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin ије дозвољен након undo" + +msgid "E439: undo list corrupt" +msgstr "E439: листа опозива је искварена" + +msgid "E440: undo line missing" +msgstr "E440: недостаје линија опозива" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Функција %s већ постоји, додајте ! да је замените" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Унос већ постоји у речнику" + +msgid "E718: Funcref required" +msgstr "E718: Потребна funcref" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Непозната функција: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Неважећи аргумент: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Име аргумента је дуплирано: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Превише аргумената за функцију %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Неважећи аргументи за функцију %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Дубина позива функције је већа од 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "позива се %s" + +#, c-format +msgid "%s aborted" +msgstr "%s је прекинута" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s враћа #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s враћа %s" + +msgid "E699: Too many arguments" +msgstr "E699: Сувише аргумената" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Непозната функција: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Функција је обрисана: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Нема довољно аргумената за функцију: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: Коришћење <SID> ван скрипт контекста: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Позивање dict функције без Речника: %s" + +msgid "E129: Function name required" +msgstr "E129: Потребно је име функције" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Име функције мора да почне великим словом или \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Име функције не може да садржи двотачку: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Недефинисана функција: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Недостаје '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: g: не може овде да се користи" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Затварајућа функција не би требало да буде на највишем нивоу: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: Недостаје :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Пронађен текст након :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Име функције је у конфликту са променљивом: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Функција %s не може да се редефинише: Тренутно се користи" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Име функције се не поклапа са именом скрипт датотеке: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Функција %s не може да се обрише: Тренутно се користи" + +msgid "E133: :return not inside a function" +msgstr "E133: :return није унутар функције" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Недостају заграде: %s" + +msgid "" +"\n" +"MS-Windows 64-bit GUI version" +msgstr "" +"\n" +"MS-Windows 64-битна GUI верзија" + +msgid "" +"\n" +"MS-Windows 32-bit GUI version" +msgstr "" +"\n" +"MS-Windows 32-битна GUI верзија" + +msgid " with OLE support" +msgstr " са OLE подршком" + +msgid "" +"\n" +"MS-Windows 64-bit console version" +msgstr "" +"\n" +"MS-Windows 64-битна конзолна верзија" + +msgid "" +"\n" +"MS-Windows 32-bit console version" +msgstr "" +"\n" +"MS-Windows 32-битна конзолна верзија" + +msgid "" +"\n" +"macOS version" +msgstr "" +"\n" +"macOS верзија" + +msgid "" +"\n" +"macOS version w/o darwin feat." +msgstr "" +"\n" +"macOS верзија без darwin могућ." + +msgid "" +"\n" +"OpenVMS version" +msgstr "" +"\n" +"OpenVMS верзија" + +msgid "" +"\n" +"Included patches: " +msgstr "" +"\n" +"Укључене исправке: " + +msgid "" +"\n" +"Extra patches: " +msgstr "" +"\n" +"Екстра исправке: " + +msgid "Modified by " +msgstr "Модификовао " + +msgid "" +"\n" +"Compiled " +msgstr "" +"\n" +"Компајлирао" + +msgid "by " +msgstr " " + +msgid "" +"\n" +"Huge version " +msgstr "" +"\n" +"Огромна верзија " + +msgid "" +"\n" +"Big version " +msgstr "" +"\n" +"Велика верзија " + +msgid "" +"\n" +"Normal version " +msgstr "" +"\n" +"Нормална верзија " + +msgid "" +"\n" +"Small version " +msgstr "" +"\n" +"Мала верзија " + +msgid "" +"\n" +"Tiny version " +msgstr "" +"\n" +"Сићушна верзија " + +msgid "without GUI." +msgstr "без GUI." + +msgid "with GTK3 GUI." +msgstr "са GTK3 GUI." + +msgid "with GTK2-GNOME GUI." +msgstr "са GTK2-GNOME GUI." + +msgid "with GTK2 GUI." +msgstr "са GTK2 GUI." + +msgid "with X11-Motif GUI." +msgstr "са X11-Motif GUI." + +msgid "with X11-neXtaw GUI." +msgstr "са X11-neXtaw GUI." + +msgid "with X11-Athena GUI." +msgstr "са X11-Athena GUI." + +msgid "with Photon GUI." +msgstr "са Photon GUI." + +msgid "with GUI." +msgstr "са GUI." + +msgid "with Carbon GUI." +msgstr "са Carbon GUI." + +msgid "with Cocoa GUI." +msgstr "са Cocoa GUI." + +msgid " Features included (+) or not (-):\n" +msgstr " Могућности укључене (+) или не (-):\n" + +msgid " system vimrc file: \"" +msgstr " системскa vimrc датотека: \"" + +msgid " user vimrc file: \"" +msgstr " корисничка vimrc датотека: \"" + +msgid " 2nd user vimrc file: \"" +msgstr " 2га корисничка vimrc датотека: \"" + +msgid " 3rd user vimrc file: \"" +msgstr " 3ћа корисничка vimrc датотека: \"" + +msgid " user exrc file: \"" +msgstr " корисничка exrc датотека: \"" + +msgid " 2nd user exrc file: \"" +msgstr " 2га корисничка exrc датотека: \"" + +msgid " system gvimrc file: \"" +msgstr " системска gvimrc датотека: \"" + +msgid " user gvimrc file: \"" +msgstr " корисничка gvimrc датотека: \"" + +msgid "2nd user gvimrc file: \"" +msgstr "2га корисничка gvimrc датотека: \"" + +msgid "3rd user gvimrc file: \"" +msgstr "3ћа корисничка gvimrc датотека: \"" + +msgid " defaults file: \"" +msgstr " датотека са подраз. опцијама: \"" + +msgid " system menu file: \"" +msgstr " системска датотека менија: \"" + +msgid " fall-back for $VIM: \"" +msgstr " резервна вредност за $VIM: \"" + +msgid " f-b for $VIMRUNTIME: \"" +msgstr "резервна вредн. за $VIMRUNTIME: \"" + +msgid "Compilation: " +msgstr "Компилација: " + +msgid "Compiler: " +msgstr "Компајлер: " + +msgid "Linking: " +msgstr "Повезивање: " + +msgid " DEBUG BUILD" +msgstr " DEBUG ИЗДАЊЕ" + +msgid "VIM - Vi IMproved" +msgstr "VIM - Vi IMproved" + +msgid "version " +msgstr "верзија " + +msgid "by Bram Moolenaar et al." +msgstr "написали Bram Moolenaar et al." + +msgid "Vim is open source and freely distributable" +msgstr "Vim је отвореног кода и може слободно да се дистрибуира" + +msgid "Help poor children in Uganda!" +msgstr "Помозите сиромашној деци у Уганди!" + +msgid "type :help iccf<Enter> for information " +msgstr "откуцајте :help iccf<Enter> за информације " + +msgid "type :q<Enter> to exit " +msgstr "откуцајте :q<Enter> за излаз " + +msgid "type :help<Enter> or <F1> for on-line help" +msgstr "откуцајте :help<Enter> или <F1> за on-line помоћ " + +msgid "type :help version8<Enter> for version info" +msgstr "откуцајте :help version8<Enter> за инфо о верзији" + +msgid "Running in Vi compatible mode" +msgstr "Рад у Vi компатибилном режиму" + +msgid "type :set nocp<Enter> for Vim defaults" +msgstr "откуцајте :set nocp<Enter> за Vim подразумевано" + +msgid "type :help cp-default<Enter> for info on this" +msgstr "откуцајте :help cp-default<Enter> за инфо о овоме" + +msgid "menu Help->Orphans for information " +msgstr "мени Помоћ->Сирочићи за информације " + +msgid "Running modeless, typed text is inserted" +msgstr "Безрежимски рад, умеће се откуцани текст" + +msgid "menu Edit->Global Settings->Toggle Insert Mode " +msgstr "мени Уређивање->Глобална подешавања->Преклапај режим Уметање " + +msgid " for two modes " +msgstr " за два режима " + +msgid "menu Edit->Global Settings->Toggle Vi Compatible" +msgstr "мени Уређивање->Глобална подешавања->Преклапај Vi Компатибилно" + +msgid " for Vim defaults " +msgstr " за Vim подразумевано " + +msgid "Sponsor Vim development!" +msgstr "Спонзоришите Vim развој!" + +msgid "Become a registered Vim user!" +msgstr "Постаните регистровани Vim корисник!" + +msgid "type :help sponsor<Enter> for information " +msgstr "откуцајте :help sponsor<Enter> за информације " + +msgid "type :help register<Enter> for information " +msgstr "откуцајте :help register<Enter> за информације " + +msgid "menu Help->Sponsor/Register for information " +msgstr "мени Помоћ->Спонзор/Региструј се за информације " + +msgid "Already only one window" +msgstr "Већ постоји само један прозор" + +msgid "E441: There is no preview window" +msgstr "E441: Нема прозора за преглед" + +msgid "E442: Can't split topleft and botright at the same time" +msgstr "E442: topleft и botright не могу да се поделе у исто време" + +msgid "E443: Cannot rotate when another window is split" +msgstr "E443: Не може да се ротира када је подељен други прозор" + +msgid "E444: Cannot close last window" +msgstr "E444: Последњи прозор не може да се затвори" + +msgid "E813: Cannot close autocmd window" +msgstr "E813: autocmd прозор не може да се затвори" + +msgid "E814: Cannot close window, only autocmd window would remain" +msgstr "E814: Прозор не може да се затвори, преостао би једино autocmd прозор" + +msgid "E445: Other window contains changes" +msgstr "E445: Други прозори садрже измене" + +msgid "E446: No file name under cursor" +msgstr "E446: Под курсором се не налази име датотеке" + +#, c-format +msgid "E447: Can't find file \"%s\" in path" +msgstr "E447: Датотека \"%s\" не може да се пронађе у путањи" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Неважећи ИД: %ld (мора бити већи од или једнак 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ИД је већ заузет: %ld" + +msgid "List or number required" +msgstr "Захтева се листа или број" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Неважећи ИД: %ld (мора бити већи од или једнак 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ИД није пронађен: %ld" + +msgid "Edit with &multiple Vims" +msgstr "Уређуј са &више Vim-ова" + +msgid "Edit with single &Vim" +msgstr "Уређуј са једним &Vim-ом" + +msgid "Diff with Vim" +msgstr "Diff са Vim" + +msgid "Edit with &Vim" +msgstr "Уређуј са &Vim-ом" + +msgid "Edit with existing Vim - " +msgstr "Уређуј са постојећим Vim - " + +msgid "Edits the selected file(s) with Vim" +msgstr "Уређује селектовауе датотеку(е) са Vim-ом" + +msgid "Error creating process: Check if gvim is in your path!" +msgstr "" +"Грешка приликом креирања процеса: Проверите да ли је gvim у вашој путањи!" + +msgid "gvimext.dll error" +msgstr "gvimext.dll грешка" + +msgid "Path length too long!" +msgstr "Путања је предугачка!" + +msgid "--No lines in buffer--" +msgstr "--У баферу нема линија--" + +msgid "E470: Command aborted" +msgstr "E470: Команда прекинута" + +msgid "E471: Argument required" +msgstr "E471: Потребан је аргумент" + +msgid "E10: \\ should be followed by /, ? or &" +msgstr "E10: Иза \\ треба да је /, ? или &" + +msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" +msgstr "" +"E11: Неважеће у прозору командне линије; <CR> извршава, CTRL-C отказује" + +msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" +msgstr "" +"E12: Постоји забрана за команду у exrc/vimrc у текућој претрази " +"директоријума или ознаке" + +msgid "E171: Missing :endif" +msgstr "E171: Недостаје :endif" + +msgid "E600: Missing :endtry" +msgstr "E600: Недостаје :endtry" + +msgid "E170: Missing :endwhile" +msgstr "E170: Недостаје :endwhile" + +msgid "E170: Missing :endfor" +msgstr "E170: Недостаје :endfor" + +msgid "E588: :endwhile without :while" +msgstr "E588: :endwhile без :while" + +msgid "E588: :endfor without :for" +msgstr "E588: :endfor без :for" + +msgid "E13: File exists (add ! to override)" +msgstr "E13: Датотека постоји (додајте ! за премошћавање)" + +msgid "E472: Command failed" +msgstr "E472: Команда није успела" + +#, c-format +msgid "E234: Unknown fontset: %s" +msgstr "E234: Непознат fontset: %s" + +#, c-format +msgid "E235: Unknown font: %s" +msgstr "E235: Непознат фонт: %s" + +#, c-format +msgid "E236: Font \"%s\" is not fixed-width" +msgstr "E236: Фонт \"%s\" није фиксне ширине" + +msgid "E473: Internal error" +msgstr "E473: Интерна грешка" + +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Интерна грешка: %s" + +msgid "Interrupted" +msgstr "Прекинуто" + +msgid "E14: Invalid address" +msgstr "E14: Неважећа адреса" + +msgid "E474: Invalid argument" +msgstr "E474: Неважећи аргумент" + +#, c-format +msgid "E475: Invalid argument: %s" +msgstr "E475: Неважећи аргумент: %s" + +#, c-format +msgid "E475: Invalid value for argument %s" +msgstr "E475: Неважећa вредност за аргумент: %s" + +#, c-format +msgid "E475: Invalid value for argument %s: %s" +msgstr "E475: Неважећa вредност за аргумент %s: %s" + +#, c-format +msgid "E15: Invalid expression: %s" +msgstr "E15: Неважећи израз: %s" + +msgid "E16: Invalid range" +msgstr "E16: Неважећи опсег" + +msgid "E476: Invalid command" +msgstr "E476: Неважећа команда" + +#, c-format +msgid "E17: \"%s\" is a directory" +msgstr "E17: \"%s\" је директоријум" + +#, c-format +msgid "E364: Library call failed for \"%s()\"" +msgstr "E364: Позив библиотеке није успео за \"%s()\"" + +msgid "E667: Fsync failed" +msgstr "E667: Fsync није успео" + +#, c-format +msgid "E448: Could not load library function %s" +msgstr "E448: Библиотечка функција %s није могла да се учита" + +msgid "E19: Mark has invalid line number" +msgstr "E19: Маркер садржи неисправан број линије" + +msgid "E20: Mark not set" +msgstr "E20: Маркер није постављен" + +msgid "E21: Cannot make changes, 'modifiable' is off" +msgstr "E21: Измене не могу да се учине, опција 'modifiable' је искључена" + +msgid "E22: Scripts nested too deep" +msgstr "E22: Скрипте су предубоко угњеждене" + +msgid "E23: No alternate file" +msgstr "E23: Нема алтернативне датотеке" + +msgid "E24: No such abbreviation" +msgstr "E24: Таква скраћеница не постоји" + +msgid "E477: No ! allowed" +msgstr "E477: ! није дозвољен" + +msgid "E25: GUI cannot be used: Not enabled at compile time" +msgstr "E25: GUI не може да се користи: Није омогућен у време компилације" + +msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" +msgstr "" +"E26: хебрејски не може да се користи: Није омогућен у време компилације\n" + +msgid "E27: Farsi cannot be used: Not enabled at compile time\n" +msgstr "E27: фарси не може да се користи: Није омогућен у време компилације\n" + +msgid "E800: Arabic cannot be used: Not enabled at compile time\n" +msgstr "" +"E800: арапски не може да се користи: Није омогућен у време компилације\n" + +#, c-format +msgid "E28: No such highlight group name: %s" +msgstr "E28: Нема групе истицања са таквим именом: %s" + +msgid "E29: No inserted text yet" +msgstr "E29: Текст још није унет" + +msgid "E30: No previous command line" +msgstr "E30: Нема претходне командне линије" + +msgid "E31: No such mapping" +msgstr "E31: Такво мапирање не постоји" + +msgid "E479: No match" +msgstr "E479: Нема подударања" + +#, c-format +msgid "E480: No match: %s" +msgstr "E480: Нема подударања: %s" + +msgid "E32: No file name" +msgstr "E32: Нема имена датотеке" + +msgid "E33: No previous substitute regular expression" +msgstr "E33: Нема претходног регуларног израза за замену" + +msgid "E34: No previous command" +msgstr "E34: Нема претходне команде" + +msgid "E35: No previous regular expression" +msgstr "E35: Нема претходног регуларног израза" + +msgid "E481: No range allowed" +msgstr "E481: Опсег није дозвољен" + +msgid "E36: Not enough room" +msgstr "E36: Нема довољно простора" + +#, c-format +msgid "E247: no registered server named \"%s\"" +msgstr "E247: нема регистованог сервера под именом \"%s\"" + +#, c-format +msgid "E482: Can't create file %s" +msgstr "E482: Датотека %s не може да се креира" + +msgid "E483: Can't get temp file name" +msgstr "E483: Име привремене датотке не може да се добије" + +#, c-format +msgid "E484: Can't open file %s" +msgstr "E484: Датотека %s не може да се отвори" + +#, c-format +msgid "E485: Can't read file %s" +msgstr "E485: Датотека %s не може да се прочита" + +msgid "E38: Null argument" +msgstr "E38: Празан аргумент" + +msgid "E39: Number expected" +msgstr "E39: Очекује се број" + +#, c-format +msgid "E40: Can't open errorfile %s" +msgstr "E40: Датотека грешке %s не може да се отвори" + +msgid "E233: cannot open display" +msgstr "E233: проказ не може да се отвори" + +msgid "E41: Out of memory!" +msgstr "E41: Нема више меморије!" + +msgid "Pattern not found" +msgstr "Шаблон није пронађен" + +#, c-format +msgid "E486: Pattern not found: %s" +msgstr "E486: Шаблон није пронађен: %s" + +msgid "E487: Argument must be positive" +msgstr "E487: Аргумент мора бити позитиван" + +msgid "E459: Cannot go back to previous directory" +msgstr "E459: Не може да се оде назад на претходни директоријум" + +msgid "E42: No Errors" +msgstr "E42: Нема грешака" + +msgid "E776: No location list" +msgstr "E776: Нема листе локација" + +msgid "E43: Damaged match string" +msgstr "E43: Оштећен стринг за подударање" + +msgid "E44: Corrupted regexp program" +msgstr "E44: regexp програм је покварен" + +msgid "E45: 'readonly' option is set (add ! to override)" +msgstr "E45: Постављена је 'readonly' опција (додајте ! за премошћавање)" + +#, c-format +msgid "E46: Cannot change read-only variable \"%s\"" +msgstr "E46: Променљива само за читање \"%s\" не може да се измени" + +#, c-format +msgid "E794: Cannot set variable in the sandbox: \"%s\"" +msgstr "E794: Не може да се постави променљива у sandbox-у: \"%s\"" + +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Не може да се користи празан кључ за Речник" + +msgid "E715: Dictionary required" +msgstr "E715: Потребан Речник" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: индекс листе је ван опсега: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Превише аргумената за функцију: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: У Речнику нема кључа: %s" + +msgid "E714: List required" +msgstr "E714: Потребна Листа" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Аргумент за %s мора бити Листа или Речник" + +msgid "E47: Error while reading errorfile" +msgstr "E47: Грешка приликом читаља датотеке грешке" + +msgid "E48: Not allowed in sandbox" +msgstr "E48: Није дозвољено у sandbox-у" + +msgid "E523: Not allowed here" +msgstr "E523: Није дозвољено овде" + +msgid "E359: Screen mode setting not supported" +msgstr "E359: Подешавање режима екрана није подржано" + +msgid "E49: Invalid scroll size" +msgstr "E49: Неважећа величина линије за скроловање" + +msgid "E91: 'shell' option is empty" +msgstr "E91: Опција 'shell' је празна" + +msgid "E255: Couldn't read in sign data!" +msgstr "E255: Подаци за знак нису могли да се прочитају!" + +msgid "E72: Close error on swap file" +msgstr "E72: Грешка код затвањара swap датотеке" + +msgid "E73: tag stack empty" +msgstr "E73: стек ознака је празан" + +msgid "E74: Command too complex" +msgstr "E74: Команда је сувише комплексна" + +msgid "E75: Name too long" +msgstr "E75: Име је предугачко" + +msgid "E76: Too many [" +msgstr "E76: Превише [" + +msgid "E77: Too many file names" +msgstr "E77: Превише имена датотека" + +msgid "E488: Trailing characters" +msgstr "E488: Карактери вишка на крају" + +msgid "E78: Unknown mark" +msgstr "E78: Непознат маркер" + +msgid "E79: Cannot expand wildcards" +msgstr "E79: Џокери не могу да се развију" + +msgid "E591: 'winheight' cannot be smaller than 'winminheight'" +msgstr "E591: 'winheight' не може да буде мање од 'winminheight'" + +msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" +msgstr "E592: 'winwidth' не може да буде мање од 'winminwidth'" + +msgid "E80: Error while writing" +msgstr "E80: Грешка приликом уписа" + +msgid "E939: Positive count required" +msgstr "E939: Потребан је позитиван број" + +msgid "E81: Using <SID> not in a script context" +msgstr "E81: <SID> се користи ван скрипт контекста" + +msgid "E449: Invalid expression received" +msgstr "E449: Примљен је неважећи израз" + +msgid "E463: Region is guarded, cannot modify" +msgstr "E463: Регион је чуван, измена није могућа" + +msgid "E744: NetBeans does not allow changes in read-only files" +msgstr "" +"E744: NetBeans не дозвољава измене датотека које смеју само да се читају" + +msgid "E363: pattern uses more memory than 'maxmempattern'" +msgstr "E363: шаблон користи више меморије од 'maxmempattern'" + +msgid "E749: empty buffer" +msgstr "E749: празан бафер" + +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Бафер %ld не постоји" + +msgid "E682: Invalid search pattern or delimiter" +msgstr "E682: Неважећи шаблон претраге или раздвојни карактер" + +msgid "E139: File is loaded in another buffer" +msgstr "E139: Датотека је учитана у други бафер" + +#, c-format +msgid "E764: Option '%s' is not set" +msgstr "E764: Опција '%s' није постављена" + +msgid "E850: Invalid register name" +msgstr "E850: Неважеће име регистра" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Није пронађен директоријум у '%s': \"%s\"" + +msgid "E952: Autocommand caused recursive behavior" +msgstr "E952: Аутокомандa je изазвала рекурзивно понашање" + +msgid "search hit TOP, continuing at BOTTOM" +msgstr "претрага је достигла ВРХ, наставља се на ДНУ" + +msgid "search hit BOTTOM, continuing at TOP" +msgstr "претрага је достигла ДНО, наставља се на ВРХУ" + +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Потребан је кључ за шифровање \"%s\"" + +msgid "empty keys are not allowed" +msgstr "празни кључеви нису дозвољени" + +msgid "dictionary is locked" +msgstr "речник је закључан" + +msgid "list is locked" +msgstr "листа је закључана" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "кључ '%s' није могао да се дода у речник" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "index мора бити типа int или slice, не %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "очекивала се инстанца str() или unicode(), али је добијена %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "очекивала се инстанца bytes() или str(), али је добијена %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"очекивало се int(), long() или нешто што подржава спајање са long(), али је " +"добијено %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "" +"очекивало се int() или нешто што подржава спајање са int(), али је добијено %" +"s" + +msgid "value is too large to fit into C int type" +msgstr "вредност је сувише велика да се смести у C int тип" + +msgid "value is too small to fit into C int type" +msgstr "вредност је сувише мала да се смести у C int тип" + +msgid "number must be greater than zero" +msgstr "број мора бити већи од нуле" + +msgid "number must be greater or equal to zero" +msgstr "број мора бити већи од или једнак нули" + +msgid "can't delete OutputObject attributes" +msgstr "атрибути OutputObject не могу да се обришу" + +#, c-format +msgid "invalid attribute: %s" +msgstr "неважећи атрибут: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Грешка код иницијализације У/И објеката" + +msgid "failed to change directory" +msgstr "не може да се промени директоријум" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "Као резултат imp.find_module() очекује се триплет, али је добијено %s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"Као резултат imp.find_module() очекује се триплет, али је добијена н-торка " +"величине %d" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "интерна грешка: imp.find_module је вратио н-торку са NULL" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "vim.Dictionary атрибути не могу да се обришу" + +msgid "cannot modify fixed dictionary" +msgstr "фиксни речник не може да се измени" + +#, c-format +msgid "cannot set attribute %s" +msgstr "атрибут %s не може да се постави" + +msgid "hashtab changed during iteration" +msgstr "hashtab је промењен током итерације" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "" +"очекивао се елемент секвенце величине 2, али је добијена секвенца " +"величине %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "конструктор листе не прихвата кључне речи за аргументе" + +msgid "list index out of range" +msgstr "индекс листе је ван опсега" + +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "интерна грешка: ставка %d vim листе није могла да се добије" + +msgid "slice step cannot be zero" +msgstr "slice корак не може да буде нула" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "покушај доделе секвенце величине веће од %d како би се продужио slice" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "интерна грешка: нема ставке %d у vim листи" + +msgid "internal error: not enough list items" +msgstr "интерна грешка: нема довољно ставки листе" + +msgid "internal error: failed to add item to list" +msgstr "интерна грешка: ставка није могла да се дода листи" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"покушај доделе секвенце величине %d како би се продужио slice величине %d" + +msgid "failed to add item to list" +msgstr "ставка није могла да се дода листи" + +msgid "cannot delete vim.List attributes" +msgstr "vim.List атрибути не могу да се обришу" + +msgid "cannot modify fixed list" +msgstr "фиксна листа не може да се измени" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "неименована функција %s не постоји" + +#, c-format +msgid "function %s does not exist" +msgstr "функција %s не постоји" + +#, c-format +msgid "failed to run function %s" +msgstr "функција %s није могла да се покрене" + +msgid "unable to get option value" +msgstr "вредност опције није могла да се добије" + +msgid "internal error: unknown option type" +msgstr "интерна грешка: непознат тип опције" + +msgid "problem while switching windows" +msgstr "проблем код пребацивања прозора" + +#, c-format +msgid "unable to unset global option %s" +msgstr "глобална опција %s није могла да се искључи" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "опција %s која нема глобалну вредност није могла да се искључи" + +msgid "attempt to refer to deleted tab page" +msgstr "покушај реферисања на обрисану картицу" + +msgid "no such tab page" +msgstr "не постоји таква картица" + +msgid "attempt to refer to deleted window" +msgstr "покушај реферисања на обрисан прозор" + +msgid "readonly attribute: buffer" +msgstr "атрибут само за читање: бафер" + +msgid "cursor position outside buffer" +msgstr "позиција курсора је ван бафера" + +msgid "no such window" +msgstr "нема таквог прозора" + +msgid "attempt to refer to deleted buffer" +msgstr "покушај реферисања на обрисан бафер" + +msgid "failed to rename buffer" +msgstr "име бафера није могло да се промени" + +msgid "mark name must be a single character" +msgstr "име маркера мора бити само један карактер" + +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "очекивао се vim.Buffer објекат, али је добијен %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "прелазак на бафер %d није био могућ" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "очекивао се vim.Window објекат, али је добијен %s" + +msgid "failed to find window in the current tab page" +msgstr "прозор није пронађен у текућој картици" + +msgid "did not switch to the specified window" +msgstr "није се прешло у наведени прозор" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "очекивао се vim.TabPage објекат, али је добијен %s" + +msgid "did not switch to the specified tab page" +msgstr "није се прешло у наведену картицу" + +msgid "failed to run the code" +msgstr "кôд није могао да се покрене" + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval није вратио важећи python објекат" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "E859: Конверзија враћеног python објекта у vim вредност није успела" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "%s не може да се конвертује у vim речник" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s не може да се конвертује у vim листу" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "%s не може да се конвертује у vim структуру" + +msgid "internal error: NULL reference passed" +msgstr "интерна грешка: прослеђена је NULL референца" + +msgid "internal error: invalid value type" +msgstr "интерна грешка: вредност неважећег типа" + +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Кука за путању није могла да се постави: sys.path_hooks није у листи\n" +"Сада би требало да урадите следеће:\n" +"- додајте vim.path_hook на крај sys.path_hooks\n" +"- додајте vim.VIM_SPECIAL_PATH на крај sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Путања није могла да се постави: sys.path није у листи\n" +"Сада би требало да додате vim.VIM_SPECIAL_PATH на крај sys.path" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*.*)\t*.*\n" +msgstr "" +"Vim макро датотеке (*.vim)\t*.vim\n" +"Све датотеке (*.*)\t*.*\n" + +msgid "All Files (*.*)\t*.*\n" +msgstr "Све датотеке (*.*)\t*.*\n" + +msgid "" +"All Files (*.*)\t*.*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB code (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Све датотеке (*.*)\t*.*\n" +"C изворни код (*.c, *.h)\t*.c;*.h\n" +"C++ изворни код (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"VB код (*.bas, *.frm)\t*.bas;*.frm\n" +"Vim датотеке (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +msgid "" +"Vim macro files (*.vim)\t*.vim\n" +"All Files (*)\t*\n" +msgstr "" +"Vim макро датотеке (*.vim)\t*.vim\n" +"Све датотеке (*)\t*\n" + +msgid "All Files (*)\t*\n" +msgstr "Све датотеке (*)\t*\n" + +msgid "" +"All Files (*)\t*\n" +"C source (*.c, *.h)\t*.c;*.h\n" +"C++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" +msgstr "" +"Све датотеке (*)\t*\n" +"C изворни код (*.c, *.h)\t*.c;*.h\n" +"C++ изворни код (*.cpp, *.hpp)\t*.cpp;*.hpp\n" +"Vim датотеке (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" diff --git a/src/po/sv.po b/src/po/sv.po index 8cfe6c1b99..5e7bbc2c6e 100644 --- a/src/po/sv.po +++ b/src/po/sv.po @@ -5689,8 +5689,8 @@ msgstr "skriv :q<Enter> f msgid "type :help<Enter> or <F1> for on-line help" msgstr "skriv :help<Enter> eller <F1> fr online-hjlp " -msgid "type :help version7<Enter> for version info" -msgstr "skriv :help version7<Enter> fr versioninformation " +msgid "type :help version8<Enter> for version info" +msgstr "skriv :help version8<Enter> fr versioninformation " msgid "Running in Vi compatible mode" msgstr "Kr i Vi-kompatibelt lge" diff --git a/src/po/uk.cp1251.po b/src/po/uk.cp1251.po index e97aaf1caf..ea4bf38832 100644 --- a/src/po/uk.cp1251.po +++ b/src/po/uk.cp1251.po @@ -1,6 +1,8 @@ # # Ukrainian Vim translation [uk] # +# Generated from uk.po, DO NOT EDIT +# # Copyright (C) 2001 Bohdan Vlasyuk <bohdan@vstu.edu.ua> # Bohdan donated this work to be distributed with Vim under the Vim license. # @@ -10,9 +12,9 @@ # msgid "" msgstr "" -"Project-Id-Version: vim 7.4\n" +"Project-Id-Version: vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-29 09:05+0300\n" +"POT-Creation-Date: 2017-07-12 12:22+0300\n" "PO-Revision-Date: 2010-06-18 21:53+0300\n" "Last-Translator: <sakhnik@gmail.com>\n" "Language-Team: Bohdan Vlasyuk <bohdan@vstu.edu.ua>\n" @@ -51,6 +53,12 @@ msgstr "E82: msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: , ..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: " + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: , " + msgid "E515: No buffers were unloaded" msgstr "E515: " @@ -81,6 +89,9 @@ msgstr " msgid "%d buffers wiped out" msgstr " %d ()" +msgid "E90: Cannot unload last buffer" +msgstr "E90: " + msgid "E84: No modified buffer found" msgstr "E84: " @@ -88,10 +99,6 @@ msgstr "E84: msgid "E85: There is no listed buffer" msgstr "E85: " -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: %ld " - msgid "E87: Cannot go beyond last buffer" msgstr "E87: " @@ -102,9 +109,6 @@ msgstr "E88: msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: %ld (! )" -msgid "E90: Cannot unload last buffer" -msgstr "E90: " - msgid "W14: Warning: List of file names overflow" msgstr "W14: : " @@ -204,8 +208,104 @@ msgstr " msgid " line=%ld id=%d name=%s" msgstr " =%ld id=%d =%s" +msgid "E902: Cannot connect to port" +msgstr "E902: ' " + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: " + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: / " + +msgid "E904: third argument for call must be a list" +msgstr "E904: " + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: : %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): 䒺" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): " + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: ch_evalexpr()/ch_sendexpr() raw nl " + +msgid "E906: not an open channel" +msgstr "E906: " + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io in_buf in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: : %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: " + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr ": ; . :help 'cm'" + +msgid "Enter encryption key: " +msgstr " : " + +msgid "Enter same key again: " +msgstr " : " + +msgid "Keys don't match!" +msgstr " !" + +msgid "[crypted]" +msgstr "[]" + +# msgstr "E235: " +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: : %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: : %s" + +# msgstr "E235: " +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: : %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: '}': %s" + +# msgstr "E14: " +msgid "extend() argument" +msgstr " extend()" + +# msgstr "E226: " +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: : %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: %ld ()" msgid "E810: Cannot read or write temp files" @@ -274,7 +374,7 @@ msgid " File name completion (^F^N^P)" msgstr " (^F^N^P)" msgid " Tag completion (^]^N^P)" -msgstr " 崳 (^]^N^P)" +msgstr " (^]^N^P)" msgid " Path pattern completion (^N^P)" msgstr " (^N^P)" @@ -334,7 +434,10 @@ msgid "Scanning: %s" msgstr " : %s" msgid "Scanning tags." -msgstr " 崳." +msgstr " ." + +msgid "match in file" +msgstr " " msgid " Adding" msgstr " " @@ -364,13 +467,10 @@ msgid "match %d" msgstr " %d" # msgstr "E17: " +#. maximum nesting of lists and dicts msgid "E18: Unexpected characters in :let" msgstr "E18: :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: : %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: : %s" @@ -378,42 +478,6 @@ msgstr "E121: msgid "E111: Missing ']'" msgstr "E111: ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: %s " - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: %s " - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: " - -# msgstr "E396: " -msgid "E714: List required" -msgstr "E714: " - -msgid "E715: Dictionary required" -msgstr "E715: " - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: : %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: : %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: %s , ! " - -msgid "E717: Dictionary entry already exists" -msgstr "E717: " - -msgid "E718: Funcref required" -msgstr "E718: " - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: [:] " @@ -421,10 +485,6 @@ msgstr "E719: msgid "E734: Wrong variable type for %s=" msgstr "E734: %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: : %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: : %s" @@ -465,14 +525,16 @@ msgstr "E711: msgid "E690: Missing \"in\" after :for" msgstr "E690: in :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: : %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: : %s" +#. For historic reasons this error is not given for a list or dict. +#. * E.g., the b: dict could be locked/unlocked. +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: -/." @@ -491,9 +553,6 @@ msgstr "E735: msgid "E736: Invalid operation for Dictionary" msgstr "E736: " -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: " - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: " @@ -506,6 +565,9 @@ msgstr "E110: msgid "E695: Cannot index a Funcref" msgstr "E695: " +msgid "E909: Cannot index a special variable" +msgstr "E909: " + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: : %s" @@ -522,60 +584,121 @@ msgstr "E114: msgid "E115: Missing quote: %s" msgstr "E115: : %s" -# msgstr "E404: " -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: : %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr " , , !" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: ']': %s" +# msgstr "E21: " +msgid "E724: variable nested too deep for displaying" +msgstr "E724: " -# msgstr "E235: " -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: : %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float Number" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: : %s" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref Number" -# msgstr "E235: " -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: : %s" +msgid "E745: Using a List as a Number" +msgstr "E745: List Number" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dictionary Number" -# msgstr "E21: " -msgid "E724: variable nested too deep for displaying" -msgstr "E724: " +msgid "E910: Using a Job as a Number" +msgstr "E910: Job Number" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel Number" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: String Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: List Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dictionary Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Channel Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref String" + +# msgstr "E373: " +msgid "E730: using List as a String" +msgstr "E730: List String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dictionary String" + +# msgstr "E373: " +msgid "E908: using an invalid value as a String" +msgstr "E908: String" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: %s" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Funcref : %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: : %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: : %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: %s" +msgid "E741: Value is locked: %s" +msgstr "E741: : %s" + +msgid "Unknown" +msgstr "" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> : %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: %s" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: " + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# :\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\t " + +# msgstr "E14: " +msgid "map() argument" +msgstr " map()" + +# msgstr "E14: " +msgid "filter() argument" +msgstr " filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: dict- : %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: %s " + +# msgstr "E396: " +msgid "E928: String required" +msgstr "E928: String" msgid "E808: Number or Float required" msgstr "E808: Number Float" @@ -584,9 +707,6 @@ msgstr "E808: msgid "add() argument" msgstr " add()" -msgid "E699: Too many arguments" -msgstr "E699: " - # msgstr "E327: " msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() " @@ -599,31 +719,16 @@ msgstr "E785: complete() msgid "&Ok" msgstr "&O:" -# msgstr "E226: " -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: : %s" - -# msgstr "E14: " -msgid "extend() argument" -msgstr " extend()" - -# msgstr "E14: " -msgid "map() argument" -msgstr " map()" - -# msgstr "E14: " -msgid "filter() argument" -msgstr " filter()" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld : " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: : %s" +msgid "E922: expected a dict" +msgstr "E922: dict" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: function() " + msgid "" "&OK\n" "&Cancel" @@ -642,10 +747,17 @@ msgstr " msgid "E786: Range not allowed" msgstr "E786: " +msgid "E916: not a valid job" +msgstr "E916: " + # msgstr "E177: " msgid "E701: Invalid type for len()" msgstr "E701: len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID :match: %ld" + msgid "E726: Stride is zero" msgstr "E726: " @@ -655,8 +767,8 @@ msgstr "E727: msgid "<empty>" msgstr "<>" -msgid "E240: No connection to Vim server" -msgstr "E240: ' Vim" +msgid "E240: No connection to the X server" +msgstr "E240: ' X" #, c-format msgid "E241: Unable to send to %s" @@ -665,6 +777,12 @@ msgstr "E241: msgid "E277: Unable to read a server reply" msgstr "E277: " +msgid "E941: already started a server" +msgstr "E941: " + +msgid "E942: +clientserver feature not available" +msgstr "E942: +clientserver " + # msgstr "E14: " msgid "remove() argument" msgstr " remove()" @@ -679,160 +797,39 @@ msgstr " msgid "E258: Unable to send to client" msgstr "E258: 볺" +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: : '%s'" + # msgstr "E14: " msgid "sort() argument" msgstr " sort()" +# msgstr "E14: " +msgid "uniq() argument" +msgstr " unique()" + # msgstr "E364: " msgid "E702: Sort compare function failed" -msgstr "E702: " +msgstr "E702: sort" + +# msgstr "E364: " +msgid "E882: Uniq compare function failed" +msgstr "E882: uniq" msgid "(Invalid)" msgstr "()" -msgid "E677: Error writing temp file" -msgstr "E677: " - -msgid "E805: Using a Float as a Number" -msgstr "E805: Float Number" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref Number" - -msgid "E745: Using a List as a Number" -msgstr "E745: List Number" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Dictionary Number" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref String" - -# msgstr "E373: " -msgid "E730: using List as a String" -msgstr "E730: List String" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Dictionary String" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: : %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funcref : %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: : %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: : %s" - -msgid "Unknown" -msgstr "" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: %s" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: " - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: : %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: '(': %s" - -msgid "E862: Cannot use g: here" -msgstr "E862: g:" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: : %s" - -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: : %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: :endfunction" - -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: : %s" - -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: %s: " - -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: : %s" - -msgid "E129: Function name required" -msgstr "E129: " - -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: : %s" - -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: %s: " - -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: 'maxfuncdepth'" - -#, c-format -msgid "calling %s" -msgstr " %s" - #, c-format -msgid "%s aborted" -msgstr "%s " - -#, c-format -msgid "%s returning #%ld" -msgstr "%s #%ld" - -#, c-format -msgid "%s returning %s" -msgstr "%s %s" - -#, c-format -msgid "continuing in %s" -msgstr " %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return " - -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# :\n" +msgid "E935: invalid submatch number: %d" +msgstr "E935: -: %d" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\t " +msgid "E677: Error writing temp file" +msgstr "E677: " -msgid "No old files" -msgstr " " +# msgstr "E14: " +msgid "E921: Invalid callback argument" +msgstr "E921: " msgid "Entering Debug mode. Type \"cont\" to continue." msgstr " . cont." @@ -845,6 +842,13 @@ msgstr " msgid "cmd: %s" msgstr ": %s" +msgid "frame is zero" +msgstr " " + +#, c-format +msgid "frame at highest level: %d" +msgstr " : %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr " %s%s %ld" @@ -875,7 +879,7 @@ msgstr " #, c-format msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: %s " +msgstr "E162: %s " msgid "Warning: Entered other buffer unexpectedly (check autocommands)" msgstr "" @@ -904,8 +908,16 @@ msgid "Searching for \"%s\"" msgstr " %s" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr " 'runtimepath' %s" +msgid "not found in '%s': \"%s\"" +msgstr " '%s': %s" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: python 2.x , : %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: python 3.x , : %s" msgid "Source Vim script" msgstr " Vim" @@ -934,6 +946,10 @@ msgstr " msgid "finished sourcing %s" msgstr " %s" +#, c-format +msgid "continuing in %s" +msgstr " %s" + msgid "modeline" msgstr "modeline" @@ -1028,6 +1044,10 @@ msgstr " msgid "E137: Viminfo file is not writable: %s" msgstr "E137: viminfo: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: viminfo, %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: viminfo %s!" @@ -1036,6 +1056,10 @@ msgstr "E138: msgid "Writing viminfo file \"%s\"" msgstr " viminfo %s" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1054,6 +1078,13 @@ msgstr "# msgid "Illegal starting char" msgstr " " +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# bar, :\n" + msgid "Write partial file?" msgstr " ?" @@ -1109,7 +1140,7 @@ msgid "E143: Autocommands unexpectedly deleted new buffer %s" msgstr "E143: %s" msgid "E144: non-numeric argument to :z" -msgstr "E144: :z" +msgstr "E144: :z" msgid "E145: Shell commands not allowed in rvim" msgstr "E145: rvim " @@ -1146,8 +1177,9 @@ msgstr " msgid " on %ld lines" msgstr " %ld " -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global " +#. will increment global_busy to break out of the loop +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global " msgid "E148: Regular expression missing from global" msgstr "E148: global " @@ -1185,8 +1217,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr ", %s " #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: : %s" +msgid "E151: No match: %s" +msgstr "E151: : %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1202,7 +1234,11 @@ msgstr "E670: ̳ #, c-format msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: %s %s/%s" +msgstr "E154: %s %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: : %s" #, c-format msgid "E160: Unknown sign command: %s" @@ -1229,10 +1265,17 @@ msgstr "E159: msgid "E158: Invalid buffer name: %s" msgstr "E158: : %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: , " + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID : %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: %s" + msgid " (NOT FOUND)" msgstr " ( )" @@ -1242,6 +1285,9 @@ msgstr " ( msgid "[Deleted]" msgstr "[]" +msgid "No old files" +msgstr " " + msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr " Ex. visual" @@ -1276,6 +1322,9 @@ msgstr " msgid "E494: Use w or w>>" msgstr "E494: w w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: , 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: , " @@ -1301,10 +1350,10 @@ msgstr "E174: msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" . " +" . " msgid "No user-defined commands found" msgstr " " @@ -1326,6 +1375,10 @@ msgstr "E178: msgid "E179: argument required for -complete" msgstr "E179: -complete " +# msgstr "E178: " +msgid "E179: argument required for -addr" +msgstr "E179: -addr " + # msgstr "E180: " #, c-format msgid "E181: Invalid attribute: %s" @@ -1341,20 +1394,25 @@ msgstr "E183: msgid "E841: Reserved name, cannot be used for user defined command" msgstr "" -"E841: , " +"E841: , " # msgstr "E183: " #, c-format msgid "E184: No such user-defined command: %s" msgstr "E184: : %s" +# msgstr "E179: " +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: : %s" + # msgstr "E179: " #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: : %s" msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: " +msgstr "E468: " msgid "E467: Custom completion requires a function argument" msgstr "E467: -" @@ -1416,6 +1474,9 @@ msgstr "E188: msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos " +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: :redir execute()" + # msgstr "E188: " msgid "Save Redirection" msgstr " " @@ -1602,7 +1663,7 @@ msgstr "E811: # msgstr "E197: " msgid "tagname" -msgstr " " +msgstr " " msgid " kind file\n" msgstr " \n" @@ -1630,6 +1691,9 @@ msgstr " msgid "Input Line" msgstr " " +msgid "Debug Line" +msgstr " " + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar " @@ -1684,13 +1748,13 @@ msgstr "E202: # msgstr "E202: " msgid "[fifo/socket]" -msgstr "[/]" +msgstr "[/]" msgid "[fifo]" msgstr "[]" msgid "[socket]" -msgstr "[]" +msgstr "[]" msgid "[character special]" msgstr "[. ]" @@ -1707,12 +1771,6 @@ msgstr "[ msgid "[converted]" msgstr "[]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ ֲ %ld]" @@ -1733,9 +1791,6 @@ msgstr " msgid "can't read output of 'charconvert'" msgstr " 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: " - # msgstr "E217: " msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: " @@ -1889,11 +1944,6 @@ msgstr " msgid "%lld characters" msgstr "%lld " -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld " - msgid "[noeol]" msgstr "[noeol]" @@ -1985,6 +2035,12 @@ msgstr " msgid "E367: No such group: \"%s\"" msgstr "E367: : %s" +msgid "E936: Cannot delete the current group" +msgstr "E936: " + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: " + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: *: %s" @@ -2053,10 +2109,6 @@ msgstr "E350: msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: 'foldmethod'" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+-- %3ld " - msgid "E222: Add to read buffer" msgstr "E222: " @@ -2156,6 +2208,18 @@ msgstr "E254: msgid "No match at cursor, finding next" msgstr " , " +msgid "_Cancel" +msgstr "" + +msgid "_Save" +msgstr "" + +msgid "_Open" +msgstr "³" + +msgid "_OK" +msgstr "" + msgid "" "&Yes\n" "&No\n" @@ -2165,6 +2229,12 @@ msgstr "" "&N:ͳ\n" "&C:" +msgid "Yes" +msgstr "" + +msgid "No" +msgstr "ͳ" + msgid "Input _Methods" msgstr " " @@ -2198,23 +2268,23 @@ msgstr " msgid "Down" msgstr "" -#. 'Find Next' button msgid "Find Next" msgstr "" -#. 'Replace' button msgid "Replace" msgstr "" -#. 'Replace All' button msgid "Replace All" msgstr " " +msgid "_Close" +msgstr "" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: die \n" -msgid "Close" -msgstr "" +msgid "Close tab" +msgstr " " msgid "New tab" msgstr " " @@ -2261,20 +2331,6 @@ msgstr "&A: msgid "&Undo" msgstr "&U:" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: %s" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: : -%s; OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: MDI" - -msgid "Close tab" -msgstr " " - msgid "Open tab..." msgstr "³ ..." @@ -2293,6 +2349,17 @@ msgstr " msgid "Directory\t*.nothing\n" msgstr "\t*.\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: %s" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: : -%s; OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: , " @@ -2496,7 +2563,7 @@ msgid "E562: Usage: cstag <ident>" msgstr "E562: : cstag <->" msgid "E257: cstag: tag not found" -msgstr "E257: cstag: " +msgstr "E257: cstag: " # msgstr "E257: " #, c-format @@ -2564,6 +2631,7 @@ msgstr "%-5s: %s%*s ( msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2574,6 +2642,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: \n" " c: , \n" " d: , \n" " e: egrep\n" @@ -2646,6 +2715,13 @@ msgstr "" "E815: , , MzScheme " "." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: , , MzScheme " +"." + msgid "invalid expression" msgstr " " @@ -2710,6 +2786,13 @@ msgstr "" msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Python: :py :py3 " +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: , , Python " +"." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Python" @@ -2745,95 +2828,6 @@ msgstr "E272: msgid "E273: unknown longjmp status %d" msgstr "E273: longjmp: %d" -msgid "Toggle implementation/definition" -msgstr " /" - -msgid "Show base class of" -msgstr " " - -msgid "Show overridden member function" -msgstr " -" - -msgid "Retrieve from file" -msgstr " " - -msgid "Retrieve from project" -msgstr " " - -msgid "Retrieve from all projects" -msgstr " " - -msgid "Retrieve" -msgstr "" - -msgid "Show source of" -msgstr "" - -msgid "Find symbol" -msgstr " " - -msgid "Browse class" -msgstr " " - -msgid "Show class in hierarchy" -msgstr " " - -msgid "Show class in restricted hierarchy" -msgstr " " - -msgid "Xref refers to" -msgstr "Xref " - -msgid "Xref referred by" -msgstr " Xref " - -msgid "Xref has a" -msgstr "Xref " - -msgid "Xref used by" -msgstr "Xref " - -msgid "Show docu of" -msgstr " docu" - -msgid "Generate docu for" -msgstr " docu " - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -" ' SNiFF+. (sniffemacs " -"$PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: . ³'" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ " - -msgid "not " -msgstr " " - -msgid "connected" -msgstr "'" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: SNiFF+: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: ' SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ '" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: . ³'" - msgid "invalid buffer number" msgstr " " @@ -2917,6 +2911,19 @@ msgstr "E573: msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM . !" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: JSON: %s" + +# msgstr "E404: " +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: : %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: ']': %s" + msgid "Unknown option argument" msgstr " " @@ -2943,12 +2950,12 @@ msgstr "%d msgid "netbeans is not supported with this GUI\n" msgstr "netbeans GUI\n" -msgid "This Vim was not compiled with the diff feature." -msgstr " Vim ." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr " '-nb': \n" +msgid "This Vim was not compiled with the diff feature." +msgstr " Vim ." + msgid "Attempt to open script file again: \"" msgstr " : \"" @@ -2961,6 +2968,9 @@ msgstr " msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: : gvim NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: : Vim Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: : \n" @@ -2990,7 +3000,7 @@ msgid "- read text from stdin" msgstr "- stdin" msgid "-t tag edit file where tag is defined" -msgstr "-t " +msgstr "-t " msgid "-q [errorfile] edit file with first error" msgstr "-q [] " @@ -3127,6 +3137,12 @@ msgstr "-F\t\t\t msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <>\t <>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\t / " + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\t, / " + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\t .vimrc" @@ -3831,15 +3847,13 @@ msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) , . ,\n" " , \n" -" ." - -msgid " Quit, or continue with caution.\n" -msgstr " .\n" +" . " +".\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) .\n" @@ -3863,7 +3877,6 @@ msgid "" msgstr "" ",\n" " .\n" -"\n" msgid "Swap file \"" msgstr " " @@ -4130,15 +4143,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: " -msgid "Enter encryption key: " -msgstr " : " - -msgid "Enter same key again: " -msgstr " : " - -msgid "Keys don't match!" -msgstr " !" - msgid "E854: path too long for completion" msgstr "E854: " @@ -4170,21 +4174,12 @@ msgstr "E346: msgid "E347: No more file \"%s\" found in path" msgstr "E347: %s" -msgid "Cannot connect to Netbeans #2" -msgstr " ' Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr " ' Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: ' " "NetBenans: %s" -msgid "read from Netbeans socket" -msgstr " Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: ' NetBeans %ld" @@ -4227,8 +4222,8 @@ msgstr "E662: msgid "E663: At end of changelist" msgstr "E663: ʳ " -msgid "Type :quit<Enter> to exit Vim" -msgstr " :quit<Enter> Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr " :qa! <Enter>, Vim" #, c-format msgid "1 line %sed 1 time" @@ -4316,33 +4311,40 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: " +"" + #, c-format msgid "%ld Cols; " msgstr ".: %ld; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr " %s%ld %ld ; %ld %ld ; %ld %ld " +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr " %s%ld %ld ; %lld %lld ; %lld %lld " #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -" %s%ld %ld ; %ld %ld ; %ld of %ld ; %ld %ld " -"" +" %s%ld %ld ; %lld %lld ; %lld of %lld ; %lld " +"%lld " #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr " %s %s; %ld %ld; %ld %ld; %ld %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr " %s %s; %ld %ld; %lld %lld; %lld %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -" %s %s; %ld %ld; %ld %ld; %ld of %ld; " -"%ld %ld" +" %s %s; %ld %ld; %lld %lld; %lld of %lld; " +" %lld %lld" #, c-format msgid "(+%ld for BOM)" @@ -4376,6 +4378,10 @@ msgstr "E522: msgid "E539: Illegal character <%s>" msgstr "E539: <%s>" +#, c-format +msgid "For option %s" +msgstr " %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: 'term'" @@ -4576,9 +4582,6 @@ msgstr " msgid "Message" msgstr "" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' 80, " - # msgstr "E364: " msgid "E237: Printer selection failed" msgstr "E237: " @@ -4603,6 +4606,10 @@ msgstr " msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: %s %s" +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: %s %s" + #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: %c %s" @@ -4638,12 +4645,13 @@ msgstr "" "\n" " " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -" " +#, c-format +msgid "Could not set security context %s for %s" +msgstr " %s %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr " %s %s. !" msgid "" "\n" @@ -4674,6 +4682,13 @@ msgstr "" "\n" " \n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +" " + msgid "" "\n" "Command terminated\n" @@ -4716,10 +4731,6 @@ msgstr " msgid "Could not fix up function pointers to the DLL!" msgstr " DLL!" -#, c-format -msgid "shell returned %d" -msgstr " %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: %s\n" @@ -4748,6 +4759,10 @@ msgstr "" msgid "Vim Warning" msgstr " Vim" +#, c-format +msgid "shell returned %d" +msgstr " %d" + # msgstr "E371: " #, c-format msgid "E372: Too many %%%c in format string" @@ -4778,6 +4793,7 @@ msgid "E377: Invalid %%%c in format string" msgstr "E377: `%%%c' " # msgstr "E377: " +#. nothing found msgid "E378: 'errorformat' contains no pattern" msgstr "E378: 'errorformat' " @@ -4788,6 +4804,15 @@ msgstr "E379: msgid "E553: No more items" msgstr "E553: " +msgid "E924: Current window was closed" +msgstr "E924: " + +msgid "E925: Current quickfix was changed" +msgstr "E925: quickfix " + +msgid "E926: Current location list was changed" +msgstr "E926: " + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d %d)%s%s: " @@ -4795,15 +4820,18 @@ msgstr "(%d msgid " (line deleted)" msgstr " ( )" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%s %d %d; %d " + msgid "E380: At bottom of quickfix stack" msgstr "E380: " msgid "E381: At top of quickfix stack" msgstr "E381: " -#, c-format -msgid "error list %d of %d; %d errors" -msgstr " %d %d; %d " +msgid "No entries" +msgstr "ͳ" msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: , 'buftype'" @@ -4833,6 +4861,12 @@ msgstr "E369: msgid "E769: Missing ] after %s[" msgstr "E769: ] %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: " + +msgid "E945: Range too large in character class" +msgstr "E945: " + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: %s%%(" @@ -4861,6 +4895,9 @@ msgstr "E69: msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] " +msgid "E65: Illegal back reference" +msgstr "E65: " + # msgstr "E382: " msgid "E339: Pattern too long" msgstr "E339: " @@ -4901,9 +4938,6 @@ msgstr "E63: msgid "E64: %s%c follows nothing" msgstr "E64: ϳ %s%c " -msgid "E65: Illegal back reference" -msgstr "E65: " - msgid "E68: Invalid character after \\z" msgstr "E68: \\z" @@ -4923,18 +4957,30 @@ msgstr "E554: msgid "External submatches:\n" msgstr " -:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= 0, 1, or 2. " +"E864: \\%#= 0, 1, or 2. " +" " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr " : " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) " #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA regexp) %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) " +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) : %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" @@ -4988,7 +5034,8 @@ msgstr "E878: (NFA) msgid "" "Could not open temporary log file for writing, displaying on stderr ... " msgstr "" -" , stderr ... " +" , " +"stderr ... " #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -5024,9 +5071,6 @@ msgstr " msgid " Arabic" msgstr " " -msgid " (lang)" -msgstr " ()" - msgid " (paste)" msgstr " ()" @@ -5122,8 +5166,51 @@ msgstr "" "# . %s :\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: " +msgid "E756: Spell checking is not enabled" +msgstr "E756: " + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +": %s_%s.spl %s_ascii.spl" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +": %s.%s.spl %s.ascii.spl" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing " + +#, c-format +msgid "Warning: region %s not supported" +msgstr ": %s " + +msgid "Sorry, no suggestions" +msgstr ", " + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr ", %ld " + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr " %.*s :" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < %.*s" + +# msgstr "E34: " +msgid "E752: No previous spell replacement" +msgstr "E752: " + +# msgstr "E333: " +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: : %s" # msgstr "E364: " msgid "E758: Truncated spell file" @@ -5147,19 +5234,6 @@ msgstr "E762: msgid "Compressing word tree..." msgstr " ..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: " - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -": %s_%s.spl %s_ascii.spl" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -": %s.%s.spl %s.ascii.spl" - #, c-format msgid "Reading spell file \"%s\"" msgstr " %s" @@ -5177,8 +5251,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: " #, c-format -msgid "Warning: region %s not supported" -msgstr ": %s " +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: .sug, : %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5417,83 +5507,37 @@ msgstr " msgid "E751: Output file name must not have region name" msgstr "E751: " -msgid "E754: Only up to 8 regions supported" -msgstr "E754: ϳ " - -#, c-format -msgid "E755: Invalid region in %s" -msgstr "E755: %s" - -msgid "Warning: both compounding and NOBREAK specified" -msgstr ": ` ' NOBREAK" - -#, c-format -msgid "Writing spell file %s ..." -msgstr " %s ..." - -msgid "Done!" -msgstr "!" - -#, c-format -msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' %ld " - -#, c-format -msgid "Word '%.*s' removed from %s" -msgstr " '%.*s' %s" - -#, c-format -msgid "Word '%.*s' added to %s" -msgstr " '%.*s' %s" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: " - -msgid "Sorry, no suggestions" -msgstr ", " - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr ", %ld " - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr " %.*s :" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < %.*s" - -# msgstr "E34: " -msgid "E752: No previous spell replacement" -msgstr "E752: " +msgid "E754: Only up to 8 regions supported" +msgstr "E754: ϳ " -# msgstr "E333: " #, c-format -msgid "E753: Not found: %s" -msgstr "E753: : %s" +msgid "E755: Invalid region in %s" +msgstr "E755: %s" -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: .sug: %s" +msgid "Warning: both compounding and NOBREAK specified" +msgstr ": ` ' NOBREAK" #, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: .sug, : %s" +msgid "Writing spell file %s ..." +msgstr " %s ..." + +msgid "Done!" +msgstr "!" #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug Vim: %s" +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' %ld " #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug .spl: %s" +msgid "Word '%.*s' removed from %s" +msgstr " '%.*s' %s" #, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: .sug: %s" +msgid "Word '%.*s' added to %s" +msgstr " '%.*s' %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: " #. This should have been checked when generating the .spl #. * file. @@ -5504,10 +5548,34 @@ msgstr "E783: msgid "No Syntax items defined for this buffer" msgstr " " +msgid "syntax conceal on" +msgstr " " + +msgid "syntax conceal off" +msgstr " " + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: : %s" +msgid "syntax case ignore" +msgstr " " + +msgid "syntax case match" +msgstr " " + +msgid "syntax spell toplevel" +msgstr " " + +msgid "syntax spell notoplevel" +msgstr " " + +msgid "syntax spell default" +msgstr " " + +msgid "syntax iskeyword " +msgstr " iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: : %s" @@ -5569,7 +5637,7 @@ msgid "E844: invalid cchar value" msgstr "E844: cchar" msgid "E393: group[t]here not accepted here" -msgstr "E393: group[t]hete " +msgstr "E393: group[t]here " #, c-format msgid "E394: Didn't find region item for %s" @@ -5586,6 +5654,10 @@ msgstr "E847: msgid "E789: Missing ']': %s" msgstr "E789: ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: `=': %s" @@ -5730,32 +5802,32 @@ msgstr "E849: # msgstr "E424: " msgid "E555: at bottom of tag stack" -msgstr "E555: ʳ 崳" +msgstr "E555: ʳ " msgid "E556: at top of tag stack" -msgstr "E556: 崳" +msgstr "E556: " msgid "E425: Cannot go before first matching tag" -msgstr "E425: " +msgstr "E425: " # msgstr "E425: " #, c-format msgid "E426: tag not found: %s" -msgstr "E426: : %s" +msgstr "E426: ̳ : %s" # msgstr "E426: " msgid " # pri kind tag" -msgstr " # " +msgstr " # " msgid "file\n" msgstr "\n" msgid "E427: There is only one matching tag" -msgstr "E427: " +msgstr "E427: " # msgstr "E427: " msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: " +msgstr "E428: " # msgstr "E428: " #, c-format @@ -5765,13 +5837,13 @@ msgstr " #. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" -msgstr " %d %d%s" +msgstr " %d %d%s" msgid " or more" msgstr " " msgid " Using tag with different case!" -msgstr " , " +msgstr " , " #, c-format msgid "E429: File \"%s\" does not exist" @@ -5784,15 +5856,15 @@ msgid "" " # TO tag FROM line in file/text" msgstr "" "\n" -" # /" +" # /" #, c-format msgid "Searching tags file %s" -msgstr " 崳 %s" +msgstr " %s" #, c-format msgid "E430: Tag file path truncated for %s\n" -msgstr "E430: 崳 %s\n" +msgstr "E430: %s\n" msgid "Ignoring long line in tags file" msgstr " " @@ -5800,7 +5872,7 @@ msgstr " # msgstr "E430: " #, c-format msgid "E431: Format error in tags file \"%s\"" -msgstr "E431: 崳 %s" +msgstr "E431: %s" # msgstr "E431: " #, c-format @@ -5809,20 +5881,20 @@ msgstr " #, c-format msgid "E432: Tags file not sorted: %s" -msgstr "E432: 崳 : %s" +msgstr "E432: : %s" # msgstr "E432: " #. never opened any tags file msgid "E433: No tags file" -msgstr "E433: 崳" +msgstr "E433: " # msgstr "E433: " msgid "E434: Can't find tag pattern" -msgstr "E434: " +msgstr "E434: " # msgstr "E434: " msgid "E435: Couldn't find tag, just guessing!" -msgstr "E435: , !" +msgstr "E435: , !" #, c-format msgid "Duplicate field name: %s" @@ -5859,6 +5931,9 @@ msgstr "" "\n" "--- ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr " $VIMRUNTIME/rgb.txt" + msgid "new shell started\n" msgstr " \n" @@ -5871,8 +5946,8 @@ msgstr " #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: ʳ " +msgid "E881: Line count changed unexpectedly" +msgstr "E881: ʳ " #. must display the prompt msgid "No undo possible; continue anyway" @@ -5891,7 +5966,7 @@ msgstr " #, c-format msgid "Will not overwrite with undo file, cannot read: %s" -msgstr "Will not overwrite with undo file, cannot read: %s" +msgstr " , : %s" #, c-format msgid "Will not overwrite, this is not an undo file: %s" @@ -5927,7 +6002,7 @@ msgstr "E823: #, c-format msgid "E832: Non-encrypted file has encrypted undo file: %s" -msgstr "E832: : %s" +msgstr "E832: : %s" #, c-format msgid "E826: Undo file decryption failed: %s" @@ -6012,15 +6087,133 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: ³ " -# msgstr "E440: " -# --------------------------------------- -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -" GUI 16/32- Windows" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: %s , ! " + +msgid "E717: Dictionary entry already exists" +msgstr "E717: " + +msgid "E718: Funcref required" +msgstr "E718: " + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: : %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: : %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: : %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr " %s" + +#, c-format +msgid "%s aborted" +msgstr "%s " + +#, c-format +msgid "%s returning #%ld" +msgstr "%s #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s %s" + +msgid "E699: Too many arguments" +msgstr "E699: " + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: : %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: : %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> : %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: dict- : %s" + +msgid "E129: Function name required" +msgstr "E129: " + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: s:: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: : %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: : %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: g:" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: : %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: : %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: %s: " + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: : %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: %s: " + +msgid "E133: :return not inside a function" +msgstr "E133: :return " + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: : %s" msgid "" "\n" @@ -6036,9 +6229,6 @@ msgstr "" "\n" " GUI 32- Windows" -msgid " in Win32s mode" -msgstr " Win32s" - msgid " with OLE support" msgstr " OLE" @@ -6056,27 +6246,6 @@ msgstr "" "\n" " 32- Windows" -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -" 16- Windows" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -" 32- MS-DOS" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -" 16- MS-DOS" - msgid "" "\n" "MacOS X (unix) version" @@ -6170,6 +6339,9 @@ msgstr "" msgid "without GUI." msgstr " GUI." +msgid "with GTK3 GUI." +msgstr " GUI GTK3." + msgid "with GTK2-GNOME GUI." msgstr " GUI GTK2-GNOME." @@ -6233,6 +6405,9 @@ msgstr " msgid "3rd user gvimrc file: \"" msgstr " gvimrc : \"" +msgid " defaults file: \"" +msgstr " defaults: \"" + msgid " system menu file: \"" msgstr " : \"" @@ -6278,8 +6453,8 @@ msgstr ":q<Enter> msgid "type :help<Enter> or <F1> for on-line help" msgstr ":help<Enter> <F1> " -msgid "type :help version7<Enter> for version info" -msgstr ":help version7<Enter> " +msgid "type :help version8<Enter> for version info" +msgstr ":help version8<Enter> " msgid "Running in Vi compatible mode" msgstr " Vi" @@ -6323,12 +6498,6 @@ msgstr ":help register<Enter> msgid "menu Help->Sponsor/Register for information " msgstr " ->/ " -msgid "WARNING: Windows 95/98/ME detected" -msgstr ": Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr ":help windows95<Enter> " - # msgstr "E444: " msgid "Already only one window" msgstr " " @@ -6368,6 +6537,27 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: %s " +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: ID: %ld ( , 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID : %ld" + +# msgstr "E396: " +msgid "List or number required" +msgstr " " + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: ID: %ld ( , 1)" + +# msgstr "E333: " +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID : %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s" @@ -6473,6 +6663,10 @@ msgstr "E236: msgid "E473: Internal error" msgstr "E473: " +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: : %s" + msgid "Interrupted" msgstr "" @@ -6622,6 +6816,9 @@ msgstr "E485: msgid "E37: No write since last change (add ! to override)" msgstr "E37: (! )" +msgid "E37: No write since last change" +msgstr "E37: " + msgid "E38: Null argument" msgstr "E38: ³ " @@ -6674,6 +6871,32 @@ msgstr "E46: msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: : %s" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: " + +msgid "E715: Dictionary required" +msgstr "E715: " + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: : %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: : %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: : %s" + +# msgstr "E396: " +msgid "E714: List required" +msgstr "E714: " + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: %s " + msgid "E47: Error while reading errorfile" msgstr "E47: " @@ -6700,7 +6923,7 @@ msgid "E72: Close error on swap file" msgstr "E72: " msgid "E73: tag stack empty" -msgstr "E73: 崳 " +msgstr "E73: " msgid "E74: Command too complex" msgstr "E74: " @@ -6733,8 +6956,9 @@ msgstr "E592: 'winwidth' msgid "E80: Error while writing" msgstr "E80: " -msgid "Zero count" -msgstr " " +# msgstr "E396: " +msgid "E939: Positive count required" +msgstr "E939: " msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> " @@ -6748,16 +6972,16 @@ msgstr "E463: msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans " -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: : %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: , 'maxmempattern', '" msgid "E749: empty buffer" msgstr "E749: " +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: %ld " + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: " @@ -6772,6 +6996,10 @@ msgstr "E764: msgid "E850: Invalid register name" msgstr "E850: " +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: : '%s': %s" + msgid "search hit TOP, continuing at BOTTOM" msgstr " , ʲ" @@ -6812,7 +7040,8 @@ msgstr " msgid "" "expected int(), long() or something supporting coercing to long(), but got %s" msgstr "" -" int(), long() , long(), %s" +" int(), long() , long(), " +"%s" #, c-format msgid "expected int() or something supporting coercing to int(), but got %s" @@ -6824,7 +7053,7 @@ msgstr " msgid "value is too small to fit into C int type" msgstr " , C int" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr " , " msgid "number must be greater or equal to zero" @@ -6870,7 +7099,8 @@ msgstr " #, c-format msgid "expected sequence element of size 2, but got sequence of size %d" -msgstr " 2, %d" +msgstr "" +" 2, %d" msgid "list constructor does not accept keyword arguments" msgstr " " @@ -6883,16 +7113,32 @@ msgstr " msgid "internal error: failed to get vim list item %d" msgstr " : vim %d" -msgid "failed to add item to list" -msgstr " " +msgid "slice step cannot be zero" +msgstr " " + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +" , %d, " #, c-format msgid "internal error: no vim list item %d" msgstr " : vim %d" +msgid "internal error: not enough list items" +msgstr " : " + msgid "internal error: failed to add item to list" msgstr " : " +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +" %d %d" + +msgid "failed to add item to list" +msgstr " " + msgid "cannot delete vim.List attributes" msgstr " vim.List" @@ -6909,9 +7155,6 @@ msgstr " msgid "function %s does not exist" msgstr " %s " -msgid "function constructor does not accept keyword arguments" -msgstr " " - #, c-format msgid "failed to run function %s" msgstr " %s" @@ -6998,6 +7241,10 @@ msgstr "E859: msgid "unable to convert %s to vim dictionary" msgstr " %s vim" +#, c-format +msgid "unable to convert %s to vim list" +msgstr " %s vim" + #, c-format msgid "unable to convert %s to vim structure" msgstr " %s vim" diff --git a/src/po/uk.po b/src/po/uk.po index 0c74293955..ce4e7693ff 100644 --- a/src/po/uk.po +++ b/src/po/uk.po @@ -1,6 +1,8 @@ # # Ukrainian Vim translation [uk] # +# Original translations +# # Copyright (C) 2001 Bohdan Vlasyuk <bohdan@vstu.edu.ua> # Bohdan donated this work to be distributed with Vim under the Vim license. # @@ -10,9 +12,9 @@ # msgid "" msgstr "" -"Project-Id-Version: vim 7.4\n" +"Project-Id-Version: vim 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-29 09:05+0300\n" +"POT-Creation-Date: 2017-07-12 12:22+0300\n" "PO-Revision-Date: 2010-06-18 21:53+0300\n" "Last-Translator: Анатолій Сахнік <sakhnik@gmail.com>\n" "Language-Team: Bohdan Vlasyuk <bohdan@vstu.edu.ua>\n" @@ -51,6 +53,12 @@ msgstr "E82: Немає можливості розмістити хоч оди msgid "E83: Cannot allocate buffer, using other one..." msgstr "E83: Немає можливості розмістити буфер, буде використано інший..." +msgid "E931: Buffer cannot be registered" +msgstr "E931: Неможливо зареєструвати буфер" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Спроба видалити буфер, що використовується" + msgid "E515: No buffers were unloaded" msgstr "E515: Жоден з буферів не був вивантажений" @@ -81,6 +89,9 @@ msgstr "Витерто один буфер" msgid "%d buffers wiped out" msgstr "Витерто %d буфери(ів)" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Не можу вивантажити останній буфер" + msgid "E84: No modified buffer found" msgstr "E84: Жоден буфер не змінено" @@ -88,10 +99,6 @@ msgstr "E84: Жоден буфер не змінено" msgid "E85: There is no listed buffer" msgstr "E85: У списку немає буферів" -#, c-format -msgid "E86: Buffer %ld does not exist" -msgstr "E86: Буфера %ld немає" - msgid "E87: Cannot go beyond last buffer" msgstr "E87: Це вже останній буфер" @@ -102,9 +109,6 @@ msgstr "E88: Це вже найперший буфер" msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: Буфер %ld має зміни (! щоб не зважати)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Не можу вивантажити останній буфер" - msgid "W14: Warning: List of file names overflow" msgstr "W14: Обережно: Список назв файлів переповнено" @@ -204,8 +208,104 @@ msgstr "Позначки для %s:" msgid " line=%ld id=%d name=%s" msgstr " рядок=%ld id=%d назва=%s" +msgid "E902: Cannot connect to port" +msgstr "E902: Не вдалося з'єднатися з портом" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() у channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() у channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: отримано команду з нетекстовим аргументом" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: останній аргумент у виразі/виклику має бути числом" + +msgid "E904: third argument for call must be a list" +msgstr "E904: третій аргумент у виклику має бути списком" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: отримано невідому команду: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): запис до під’єднання" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): збереження не вдалося" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Не можна використати зворотній виклик у %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "" +"E912: не можна використати ch_evalexpr()/ch_sendexpr() з raw чи nl каналом" + +msgid "E906: not an open channel" +msgstr "E906: не відкритий канал" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: файл _io потребує встановленого _name" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: буфер in_io потребує встановленого in_buf чи in_name" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: буфер має бути завантажений: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Файл зашифровано невідомим методом" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Увага: Використовується слабкий метод шифрування; див. :help 'cm'" + +msgid "Enter encryption key: " +msgstr "Вкажіть ключ шифру: " + +msgid "Enter same key again: " +msgstr "Повторіть ключ: " + +msgid "Keys don't match!" +msgstr "Ключі не однакові!" + +msgid "[crypted]" +msgstr "[зашифровано]" + +# msgstr "E235: " +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: Бракує двокрапки у словнику: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Повторення ключа в словнику: «%s»" + +# msgstr "E235: " +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: Бракує коми у словнику: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: Немає кінцівки словника '}': %s" + +# msgstr "E14: " +msgid "extend() argument" +msgstr "аргумент extend()" + +# msgstr "E226: " +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Ключ вже існує: %s" + #, c-format -msgid "E96: Can not diff more than %ld buffers" +msgid "E96: Cannot diff more than %ld buffers" msgstr "E96: Не можна порівнювати понад %ld буфери(ів)" msgid "E810: Cannot read or write temp files" @@ -274,7 +374,7 @@ msgid " File name completion (^F^N^P)" msgstr " Доповнення назви файлу (^F^N^P)" msgid " Tag completion (^]^N^P)" -msgstr " Доповнення теґів (^]^N^P)" +msgstr " Доповнення міток (^]^N^P)" msgid " Path pattern completion (^N^P)" msgstr " Доповнення шляху за зразком (^N^P)" @@ -334,7 +434,10 @@ msgid "Scanning: %s" msgstr "Пошук у: %s" msgid "Scanning tags." -msgstr "Пошук серед теґів." +msgstr "Пошук серед міток." + +msgid "match in file" +msgstr "збіг у файлі" msgid " Adding" msgstr " Додається" @@ -364,13 +467,10 @@ msgid "match %d" msgstr "збіг %d" # msgstr "E17: " +#. maximum nesting of lists and dicts msgid "E18: Unexpected characters in :let" msgstr "E18: Неочікувані символи у :let" -#, c-format -msgid "E684: list index out of range: %ld" -msgstr "E684: Індекс списку поза межами: %ld" - #, c-format msgid "E121: Undefined variable: %s" msgstr "E121: Невизначена змінна: %s" @@ -378,42 +478,6 @@ msgstr "E121: Невизначена змінна: %s" msgid "E111: Missing ']'" msgstr "E111: Бракує ']'" -#, c-format -msgid "E686: Argument of %s must be a List" -msgstr "E686: Аргумент у %s має бути списком" - -#, c-format -msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Аргумент у %s має бути списком чи словником" - -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Ключ словника не може бути порожнім" - -# msgstr "E396: " -msgid "E714: List required" -msgstr "E714: Потрібен список" - -msgid "E715: Dictionary required" -msgstr "E715: Потрібен словник" - -#, c-format -msgid "E118: Too many arguments for function: %s" -msgstr "E118: Забагато аргументів для функції: %s" - -#, c-format -msgid "E716: Key not present in Dictionary: %s" -msgstr "E716: Немає такого ключа у словнику: %s" - -#, c-format -msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Функція %s уже існує, ! щоб замінити" - -msgid "E717: Dictionary entry already exists" -msgstr "E717: Запис у словнику вже існує" - -msgid "E718: Funcref required" -msgstr "E718: Треба посилання на функцію" - msgid "E719: Cannot use [:] with a Dictionary" msgstr "E719: Не можна використати [:] зі словником" @@ -421,10 +485,6 @@ msgstr "E719: Не можна використати [:] зі словником msgid "E734: Wrong variable type for %s=" msgstr "E734: Неправильний тип змінної для %s=" -#, c-format -msgid "E130: Unknown function: %s" -msgstr "E130: Невідома функція: %s" - #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Неприпустима назва змінної: %s" @@ -465,14 +525,16 @@ msgstr "E711: Список має недостатньо елементів" msgid "E690: Missing \"in\" after :for" msgstr "E690: Пропущено «in» після :for" -#, c-format -msgid "E107: Missing parentheses: %s" -msgstr "E107: Пропущено дужки: %s" - #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Змінної немає: «%s»" +#. For historic reasons this error is not given for a list or dict. +#. * E.g., the b: dict could be locked/unlocked. +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Неможливо заблокувати чи розблокувати змінну %s" + msgid "E743: variable nested too deep for (un)lock" msgstr "E743: Змінна має забагато вкладень щоб бути за-/відкритою." @@ -491,9 +553,6 @@ msgstr "E735: Словник можна порівняти тільки із с msgid "E736: Invalid operation for Dictionary" msgstr "E736: Некоректна операція над словником" -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Функцію можна порівняти тільки з функцією" - msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Некоректна операція над функцією" @@ -506,6 +565,9 @@ msgstr "E110: Пропущено ')'" msgid "E695: Cannot index a Funcref" msgstr "E695: Функція не має індексації" +msgid "E909: Cannot index a special variable" +msgstr "E909: Не можна індексувати спеціальну змінну" + #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Бракує назви опції: %s" @@ -522,60 +584,121 @@ msgstr "E114: Бракує лапки: %s" msgid "E115: Missing quote: %s" msgstr "E115: Бракує лапки: %s" -# msgstr "E404: " -#, c-format -msgid "E696: Missing comma in List: %s" -msgstr "E696: Бракує коми у списку: %s" +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "Недостатньо пам’яті, щоб встановити посилання, збір сміття скасовано!" -#, c-format -msgid "E697: Missing end of List ']': %s" -msgstr "E697: Немає кінцівки списку ']': %s" +# msgstr "E21: " +msgid "E724: variable nested too deep for displaying" +msgstr "E724: У змінній забагато вкладень щоб її показати" -# msgstr "E235: " -#, c-format -msgid "E720: Missing colon in Dictionary: %s" -msgstr "E720: Бракує двокрапки у словнику: %s" +msgid "E805: Using a Float as a Number" +msgstr "E805: Float вжито як Number" -#, c-format -msgid "E721: Duplicate key in Dictionary: \"%s\"" -msgstr "E721: Повторення ключа в словнику: «%s»" +msgid "E703: Using a Funcref as a Number" +msgstr "E703: Funcref вжито як Number" -# msgstr "E235: " -#, c-format -msgid "E722: Missing comma in Dictionary: %s" -msgstr "E722: Бракує коми у словнику: %s" +msgid "E745: Using a List as a Number" +msgstr "E745: List вжито як Number" -#, c-format -msgid "E723: Missing end of Dictionary '}': %s" -msgstr "E723: Немає кінцівки словника '}': %s" +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Dictionary вжито як Number" -# msgstr "E21: " -msgid "E724: variable nested too deep for displaying" -msgstr "E724: У змінній забагато вкладень щоб її показати" +msgid "E910: Using a Job as a Number" +msgstr "E910: Job вжито як Number" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: Channel вжито як Number" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref вжито як Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: String вжито як Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: List вжито як Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Dictionary вжито як Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Спеціальне значення вжито як Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: Job вжито як Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: Channel вжито як Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: Funcref вжито як String" + +# msgstr "E373: " +msgid "E730: using List as a String" +msgstr "E730: List вжито як String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Dictionary вжито як String" + +# msgstr "E373: " +msgid "E908: using an invalid value as a String" +msgstr "E908: неправильне значення вжито як String" #, c-format -msgid "E740: Too many arguments for function %s" -msgstr "E740: Забагато аргументів для функції %s" +msgid "E795: Cannot delete variable %s" +msgstr "E795: Не можна знищити змінну %s" #, c-format -msgid "E116: Invalid arguments for function %s" -msgstr "E116: Неправильні аргументи функції %s" +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Назва змінної Funcref має починатися з великої літери: %s" #, c-format -msgid "E117: Unknown function: %s" -msgstr "E117: Невідома функція: %s" +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Назва змінної співпадає з існуючою функцією: %s" #, c-format -msgid "E119: Not enough arguments for function: %s" -msgstr "E119: Замало аргументів для функції %s" +msgid "E741: Value is locked: %s" +msgstr "E741: Значення захищене: %s" + +msgid "Unknown" +msgstr "Невідомо" #, c-format -msgid "E120: Using <SID> not in a script context: %s" -msgstr "E120: <SID> використовується не у контексті скрипту: %s" +msgid "E742: Cannot change value of %s" +msgstr "E742: Не можна змінити значення %s" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: Змінна вкладена занадто глибоко щоб зробити її копію" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# глобальні змінні:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tВостаннє змінена у " + +# msgstr "E14: " +msgid "map() argument" +msgstr "аргумент map()" + +# msgstr "E14: " +msgid "filter() argument" +msgstr "аргумент filter()" #, c-format -msgid "E725: Calling dict function without Dictionary: %s" -msgstr "E725: Виклик dict-функції без словника: %s" +msgid "E686: Argument of %s must be a List" +msgstr "E686: Аргумент у %s має бути списком" + +# msgstr "E396: " +msgid "E928: String required" +msgstr "E928: Потрібно String" msgid "E808: Number or Float required" msgstr "E808: Треба вказати Number чи Float" @@ -584,9 +707,6 @@ msgstr "E808: Треба вказати Number чи Float" msgid "add() argument" msgstr "аргумент add()" -msgid "E699: Too many arguments" -msgstr "E699: Забагато аргументів" - # msgstr "E327: " msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() можна вживати тільки в режимі вставки" @@ -599,31 +719,16 @@ msgstr "E785: complete() можна вживати тільки в режимі msgid "&Ok" msgstr "&O:Гаразд" -# msgstr "E226: " -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Ключ вже існує: %s" - -# msgstr "E14: " -msgid "extend() argument" -msgstr "аргумент extend()" - -# msgstr "E14: " -msgid "map() argument" -msgstr "аргумент map()" - -# msgstr "E14: " -msgid "filter() argument" -msgstr "аргумент filter()" - -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld рядків: " - #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Невідома функція: %s" +msgid "E922: expected a dict" +msgstr "E922: очікується dict" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Другий аргумент function() має бути списком чи словником" + msgid "" "&OK\n" "&Cancel" @@ -642,10 +747,17 @@ msgstr "аргумент insert()" msgid "E786: Range not allowed" msgstr "E786: Інтервал не дозволено" +msgid "E916: not a valid job" +msgstr "E916: некоректне завдання" + # msgstr "E177: " msgid "E701: Invalid type for len()" msgstr "E701: Некоректний тип для len()" +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ID зарезервовано для «:match»: %ld" + msgid "E726: Stride is zero" msgstr "E726: Крок нульовий" @@ -655,8 +767,8 @@ msgstr "E727: Початок за кінцем" msgid "<empty>" msgstr "<нічого>" -msgid "E240: No connection to Vim server" -msgstr "E240: Немає з'єднання із сервером Vim" +msgid "E240: No connection to the X server" +msgstr "E240: Немає з'єднання із сервером X" #, c-format msgid "E241: Unable to send to %s" @@ -665,6 +777,12 @@ msgstr "E241: Не вдалося відіслати до %s" msgid "E277: Unable to read a server reply" msgstr "E277: Не вдалося прочитати відповідь сервера" +msgid "E941: already started a server" +msgstr "E941: сервер вже запущено" + +msgid "E942: +clientserver feature not available" +msgstr "E942: можливість +clientserver відсутня" + # msgstr "E14: " msgid "remove() argument" msgstr "аргумент remove()" @@ -679,160 +797,39 @@ msgstr "аргумент reverse()" msgid "E258: Unable to send to client" msgstr "E258: Не вдалося надіслати клієнту" +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Неправильна дія: '%s'" + # msgstr "E14: " msgid "sort() argument" msgstr "аргумент sort()" +# msgstr "E14: " +msgid "uniq() argument" +msgstr "аргумент unique()" + # msgstr "E364: " msgid "E702: Sort compare function failed" -msgstr "E702: Помилка у функції порівняння" +msgstr "E702: Помилка у функції порівняння sort" + +# msgstr "E364: " +msgid "E882: Uniq compare function failed" +msgstr "E882: Помилка у функції порівняння uniq" msgid "(Invalid)" msgstr "(Неможливо)" -msgid "E677: Error writing temp file" -msgstr "E677: Не вдалося записати тимчасовий файл" - -msgid "E805: Using a Float as a Number" -msgstr "E805: Float вжито як Number" - -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref вжито як Number" - -msgid "E745: Using a List as a Number" -msgstr "E745: List вжито як Number" - -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Dictionary вжито як Number" - -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref вжито як String" - -# msgstr "E373: " -msgid "E730: using List as a String" -msgstr "E730: List вжито як String" - -msgid "E731: using Dictionary as a String" -msgstr "E731: Dictionary вжито як String" - -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Неправильний тип змінної: %s" - -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Не можна знищити змінну %s" - -#, c-format -msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Назва змінної Funcref має починатися з великої літери: %s" - -#, c-format -msgid "E705: Variable name conflicts with existing function: %s" -msgstr "E705: Назва змінної співпадає з існуючою функцією: %s" - -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Значення захищене: %s" - -msgid "Unknown" -msgstr "Невідомо" - -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Не можна змінити значення %s" - -msgid "E698: variable nested too deep for making a copy" -msgstr "E698: Змінна вкладена занадто глибоко щоб зробити її копію" - -#, c-format -msgid "E123: Undefined function: %s" -msgstr "E123: Невизначена функція: %s" - -#, c-format -msgid "E124: Missing '(': %s" -msgstr "E124: Бракує '(': %s" - -msgid "E862: Cannot use g: here" -msgstr "E862: Тут не можна використати g:" - -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Недозволений аргумент: %s" - -#, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "E853: Назва аргументу повторюється: %s" - -msgid "E126: Missing :endfunction" -msgstr "E126: Бракує :endfunction" - -#, c-format -msgid "E707: Function name conflicts with variable: %s" -msgstr "E707: Назва функції співпадає зі змінною: %s" - -#, c-format -msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Не вдалося перевизначити функцію %s: вона використовується" - -#, c-format -msgid "E746: Function name does not match script file name: %s" -msgstr "E746: Назва функції не збігається з назвою файлу скрипту: %s" - -msgid "E129: Function name required" -msgstr "E129: Не вказано назву функції" - -#, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Назва функції має починатися з великої літери або містити двокрапку: %s" - -#, c-format -msgid "E131: Cannot delete function %s: It is in use" -msgstr "E131: Не вдалося знищити функцію %s: Вона використовується" - -msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Глибина викликів функції перевищує 'maxfuncdepth'" - -#, c-format -msgid "calling %s" -msgstr "викликається %s" - #, c-format -msgid "%s aborted" -msgstr "%s припинено" - -#, c-format -msgid "%s returning #%ld" -msgstr "%s повертає #%ld" - -#, c-format -msgid "%s returning %s" -msgstr "%s повертає %s" - -#, c-format -msgid "continuing in %s" -msgstr "продовження в %s" - -msgid "E133: :return not inside a function" -msgstr "E133: :return поза межами функції" - -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# глобальні змінні:\n" +msgid "E935: invalid submatch number: %d" +msgstr "E935: неправильний номер під-збігу: %d" -msgid "" -"\n" -"\tLast set from " -msgstr "" -"\n" -"\tВостаннє змінена у " +msgid "E677: Error writing temp file" +msgstr "E677: Не вдалося записати тимчасовий файл" -msgid "No old files" -msgstr "Жодного старого файлу" +# msgstr "E14: " +msgid "E921: Invalid callback argument" +msgstr "E921: Некоректний аргумент зворотного виклику" msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Режим налагодження. Щоб продовжити введіть «cont»." @@ -845,6 +842,13 @@ msgstr "рядок %ld: %s" msgid "cmd: %s" msgstr "команда: %s" +msgid "frame is zero" +msgstr "кадр стеку нульовий" + +#, c-format +msgid "frame at highest level: %d" +msgstr "кадр стеку на найвищому рівні: %d" + #, c-format msgid "Breakpoint in \"%s%s\" line %ld" msgstr "Точка зупинки в «%s%s» рядок %ld" @@ -875,7 +879,7 @@ msgstr "Неназваний" #, c-format msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: Буфер «%s» має незбережені зміни" +msgstr "E162: Буфер «%s» має не збережені зміни" msgid "Warning: Entered other buffer unexpectedly (check autocommands)" msgstr "" @@ -904,8 +908,16 @@ msgid "Searching for \"%s\"" msgstr "Пошук «%s»" #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "В 'runtimepath' не знайдено «%s»" +msgid "not found in '%s': \"%s\"" +msgstr "не знайдено у '%s': «%s»" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Потрібна версія python 2.x не підтримується, ігнорується файл: %s" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Потрібна версія python 3.x не підтримується, ігнорується файл: %s" msgid "Source Vim script" msgstr "Прочитати скрипт Vim" @@ -934,6 +946,10 @@ msgstr "рядок %ld: виконується «%s»" msgid "finished sourcing %s" msgstr "закінчено виконання %s" +#, c-format +msgid "continuing in %s" +msgstr "продовження в %s" + msgid "modeline" msgstr "modeline" @@ -1028,6 +1044,10 @@ msgstr " НЕ ВДАЛОСЯ" msgid "E137: Viminfo file is not writable: %s" msgstr "E137: Не дозволено запис у файл viminfo: %s" +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Забагато тимчасових файлів viminfo, як %s!" + #, c-format msgid "E138: Can't write viminfo file %s!" msgstr "E138: Не вдалося записати файл viminfo %s!" @@ -1036,6 +1056,10 @@ msgstr "E138: Не вдалося записати файл viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Записується файл viminfo «%s»" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Не вдалося перейменувати файл viminfo у %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1054,6 +1078,13 @@ msgstr "# Значення 'encoding' під час створення цьог msgid "Illegal starting char" msgstr "Недозволений символ на початку рядка" +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Рядки bar, скопійовано посимвольно:\n" + msgid "Write partial file?" msgstr "Записати частину файлу?" @@ -1109,7 +1140,7 @@ msgid "E143: Autocommands unexpectedly deleted new buffer %s" msgstr "E143: Автокоманди несподівано знищили новий буфер %s" msgid "E144: non-numeric argument to :z" -msgstr "E144: нечисловий аргумент для :z" +msgstr "E144: не числовий аргумент для :z" msgid "E145: Shell commands not allowed in rvim" msgstr "E145: У rvim не дозволені команди оболонки" @@ -1146,8 +1177,9 @@ msgstr " в одному рядку" msgid " on %ld lines" msgstr " в %ld рядках" -msgid "E147: Cannot do :global recursive" -msgstr "E147: :global не можна вживати рекурсивно" +#. will increment global_busy to break out of the loop +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global не можна вживати рекурсивно з діапазоном" msgid "E148: Regular expression missing from global" msgstr "E148: У global бракує зразка" @@ -1185,8 +1217,8 @@ msgid "Sorry, help file \"%s\" not found" msgstr "Вибачте, файл допомоги «%s» не знайдено" #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: Не є каталогом: %s" +msgid "E151: No match: %s" +msgstr "E151: Жодного збігу: %s" #, c-format msgid "E152: Cannot open %s for writing" @@ -1202,7 +1234,11 @@ msgstr "E670: Мішанина кодувань файлу допомоги дл #, c-format msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Повторення теґу «%s» у файлі %s/%s" +msgstr "E154: Повторення мітки «%s» у файлі %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Не є каталогом: %s" #, c-format msgid "E160: Unknown sign command: %s" @@ -1229,10 +1265,17 @@ msgstr "E159: Пропущено номер надпису" msgid "E158: Invalid buffer name: %s" msgstr "E158: Некоректна назва буфера: %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Не можна перейти до буфера, який не має назви" + #, c-format msgid "E157: Invalid sign ID: %ld" msgstr "E157: Неправильний ID надпису: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Неможливо змінити знак %s" + msgid " (NOT FOUND)" msgstr " (НЕ ЗНАЙДЕНО)" @@ -1242,6 +1285,9 @@ msgstr " (не підтримується)" msgid "[Deleted]" msgstr "[Знищено]" +msgid "No old files" +msgstr "Жодного старого файлу" + msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "Режим Ex. Для повернення до нормального режиму виконайте «visual»" @@ -1276,6 +1322,9 @@ msgstr "Інтервал задано навиворіт, щоб помінят msgid "E494: Use w or w>>" msgstr "E494: Спробуйте w або w>>" +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Таблицю команд потрібно поновити, запустіть 'make cmdidxs'" + msgid "E319: Sorry, the command is not available in this version" msgstr "E319: Вибачте, цієї команди немає у цій версії" @@ -1301,10 +1350,10 @@ msgstr "E174: Команда вже існує, ! щоб замінити її" msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Назва Арг. Межа Доповнення Визначення" +" Назва Арг. Адреса Доповнення Визначення" msgid "No user-defined commands found" msgstr "Не знайдено команд користувача" @@ -1326,6 +1375,10 @@ msgstr "E178: Неправильне початкове значення ліч msgid "E179: argument required for -complete" msgstr "E179: для -complete потрібний аргумент" +# msgstr "E178: " +msgid "E179: argument required for -addr" +msgstr "E179: для -addr потрібний аргумент" + # msgstr "E180: " #, c-format msgid "E181: Invalid attribute: %s" @@ -1341,20 +1394,25 @@ msgstr "E183: Команди користувача повинні почина msgid "E841: Reserved name, cannot be used for user defined command" msgstr "" -"E841: Зарезервована назва, не можна використати для користувацької команди" +"E841: Зарезервована назва, не можна використати для команди користувача" # msgstr "E183: " #, c-format msgid "E184: No such user-defined command: %s" msgstr "E184: Команду користувача не знайдено: %s" +# msgstr "E179: " +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Неправильне значення типу адреси: %s" + # msgstr "E179: " #, c-format msgid "E180: Invalid complete value: %s" msgstr "E180: Неправильне доповнення: %s" msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: Аргумент дозволений тільки для користувацького доповнення" +msgstr "E468: Аргумент дозволений тільки для доповнення користувача" msgid "E467: Custom completion requires a function argument" msgstr "E467: Користувацьке доповнення вимагає аргумент-функцію" @@ -1416,6 +1474,9 @@ msgstr "E188: Не можна отримати позицію вікна на ц msgid "E466: :winpos requires two number arguments" msgstr "E466: :winpos вимагає два числових аргументи" +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: Не можна використати :redir всередині execute()" + # msgstr "E188: " msgid "Save Redirection" msgstr "Зберегти переадресований вивід" @@ -1602,7 +1663,7 @@ msgstr "E811: Зараз не можна змінювати інформацію # msgstr "E197: " msgid "tagname" -msgstr "назва теґу" +msgstr "назва мітки" msgid " kind file\n" msgstr " тип файлу\n" @@ -1630,6 +1691,9 @@ msgstr "вирази" msgid "Input Line" msgstr "введені рядки" +msgid "Debug Line" +msgstr "Рядок налагодження" + msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar поза межами команди" @@ -1684,13 +1748,13 @@ msgstr "E202: Конвертація унеможливила читання ф # msgstr "E202: " msgid "[fifo/socket]" -msgstr "[канал/сокет]" +msgstr "[канал/гніздо]" msgid "[fifo]" msgstr "[канал]" msgid "[socket]" -msgstr "[сокет]" +msgstr "[гніздо]" msgid "[character special]" msgstr "[спец. символьний]" @@ -1707,12 +1771,6 @@ msgstr "[НЕ конвертовано]" msgid "[converted]" msgstr "[конвертовано]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[зашифровано]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ПОМИЛКА КОНВЕРТАЦІЇ у рядку %ld]" @@ -1733,9 +1791,6 @@ msgstr "Конвертація з 'charconvert' не вдалася" msgid "can't read output of 'charconvert'" msgstr "не вдалося прочитати вивід 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Файл зашифровано невідомим методом" - # msgstr "E217: " msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Немає відповідних автокоманд" @@ -1889,11 +1944,6 @@ msgstr "один символ" msgid "%lld characters" msgstr "%lld символів" -#. Explicit typecast avoids warning on Mac OS X 10.6 -#, c-format -msgid "%ld characters" -msgstr "%ld символів" - msgid "[noeol]" msgstr "[noeol]" @@ -1985,6 +2035,12 @@ msgstr "Автоматичне знищення автокоманди: %s <бу msgid "E367: No such group: \"%s\"" msgstr "E367: Немає такої групи: «%s»" +msgid "E936: Cannot delete the current group" +msgstr "E936: Не вдалося знищити цю групу" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: Знищується автогрупа все ще у вжитку" + #, c-format msgid "E215: Illegal character after *: %s" msgstr "E215: Недозволений символ після *: %s" @@ -2053,10 +2109,6 @@ msgstr "E350: Не вдалося створити згортку методом msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: Не вдалося знищити згортку методом 'foldmethod'" -#, c-format -msgid "+--%3ld lines folded " -msgstr "+-- згорнуто %3ld рядків " - msgid "E222: Add to read buffer" msgstr "E222: Додати до буфера читання" @@ -2156,6 +2208,18 @@ msgstr "E254: Не вдалося отримати колір %s" msgid "No match at cursor, finding next" msgstr "Немає над курсором, пошук триває" +msgid "_Cancel" +msgstr "Скасувати" + +msgid "_Save" +msgstr "Зберегти" + +msgid "_Open" +msgstr "Відкрити" + +msgid "_OK" +msgstr "Гаразд" + msgid "" "&Yes\n" "&No\n" @@ -2165,6 +2229,12 @@ msgstr "" "&N:Ні\n" "&C:Скасувати" +msgid "Yes" +msgstr "Так" + +msgid "No" +msgstr "Ні" + msgid "Input _Methods" msgstr "Методи введення" @@ -2198,23 +2268,23 @@ msgstr "Вгору" msgid "Down" msgstr "Униз" -#. 'Find Next' button msgid "Find Next" msgstr "Наступне" -#. 'Replace' button msgid "Replace" msgstr "Замінити" -#. 'Replace All' button msgid "Replace All" msgstr "Замінити усі" +msgid "_Close" +msgstr "Закрити" + msgid "Vim: Received \"die\" request from session manager\n" msgstr "Vim: Отримав запит «die» від менеджера сесій\n" -msgid "Close" -msgstr "Закрити" +msgid "Close tab" +msgstr "Закрити вкладку" msgid "New tab" msgstr "Нова вкладка" @@ -2261,20 +2331,6 @@ msgstr "&A:Замінити усі" msgid "&Undo" msgstr "&U:Скасувати" -#, c-format -msgid "E671: Cannot find window title \"%s\"" -msgstr "E671: Не вдалося знайти вікно «%s»" - -#, c-format -msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -msgstr "E243: Аргумент не підтримується: «-%s»; користуйтесь версією з OLE." - -msgid "E672: Unable to open window inside MDI application" -msgstr "E672: Не вдалося відкрити вікно всередині програми MDI" - -msgid "Close tab" -msgstr "Закрити вкладку" - msgid "Open tab..." msgstr "Відкрити вкладку..." @@ -2293,6 +2349,17 @@ msgstr "Немає" msgid "Directory\t*.nothing\n" msgstr "Каталог\t*.нічого\n" +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: Не вдалося знайти вікно «%s»" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Аргумент не підтримується: «-%s»; користуйтесь версією з OLE." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Не вдалося відкрити вікно всередині програми MDI" + msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" "Vim E458: Немає вільних комірок у палітрі, деякі кольори можуть бути " @@ -2496,7 +2563,7 @@ msgid "E562: Usage: cstag <ident>" msgstr "E562: Використання: cstag <ідентиф-ор>" msgid "E257: cstag: tag not found" -msgstr "E257: cstag: теґ не знайдено" +msgstr "E257: cstag: мітку не знайдено" # msgstr "E257: " #, c-format @@ -2564,6 +2631,7 @@ msgstr "%-5s: %s%*s (Використання: %s)" msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -2574,6 +2642,7 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" +" a: Знайти присвоєння цього символу\n" " c: Знайти функції, що викликають цю функцію\n" " d: Знайти функції, що викликаються цією функцією\n" " e: Знайти цей шаблон egrep\n" @@ -2646,6 +2715,13 @@ msgstr "" "E815: Вибачте, ця команда вимкнена, бібліотеки MzScheme не можуть бути " "завантажені." +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Вибачте, ця команда вимкнена, бібліотеки MzScheme не можуть бути " +"завантажені." + msgid "invalid expression" msgstr "некоректний вираз" @@ -2710,6 +2786,13 @@ msgstr "" msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Python: Не можна використати :py і :py3 в одному сеансі" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Вибачте, ця команда вимкнена, місцева бібліотека Python не може бути " +"завантажена." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Не можна рекурсивно викликати Python" @@ -2745,95 +2828,6 @@ msgstr "E272: Необроблений виняток" msgid "E273: unknown longjmp status %d" msgstr "E273: Невідомий статус longjmp: %d" -msgid "Toggle implementation/definition" -msgstr "Перемкнути реалізацію/визначення" - -msgid "Show base class of" -msgstr "Знайти базовий клас" - -msgid "Show overridden member function" -msgstr "Показати замінені функції-члени" - -msgid "Retrieve from file" -msgstr "Прочитати з файлу" - -msgid "Retrieve from project" -msgstr "Отримати з проекту" - -msgid "Retrieve from all projects" -msgstr "Отримати з усіх проектів" - -msgid "Retrieve" -msgstr "Отримати" - -msgid "Show source of" -msgstr "Джерело" - -msgid "Find symbol" -msgstr "Знайти символ" - -msgid "Browse class" -msgstr "Переглянути клас" - -msgid "Show class in hierarchy" -msgstr "Показати клас в ієрархії" - -msgid "Show class in restricted hierarchy" -msgstr "Показати клас в обмеженій ієрархії" - -msgid "Xref refers to" -msgstr "Xref вказує на" - -msgid "Xref referred by" -msgstr "На Xref вказано з" - -msgid "Xref has a" -msgstr "Xref має" - -msgid "Xref used by" -msgstr "Xref використано" - -msgid "Show docu of" -msgstr "Показати docu" - -msgid "Generate docu for" -msgstr "Створити docu для" - -msgid "" -"Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -"$PATH).\n" -msgstr "" -"Не вдалося з'єднатися зі SNiFF+. Перевірте оточення (sniffemacs має бути у " -"$PATH).\n" - -msgid "E274: Sniff: Error during read. Disconnected" -msgstr "E274: Sniff: Помилка під час читання. Від'єднано" - -msgid "SNiFF+ is currently " -msgstr "SNiFF+ зараз " - -msgid "not " -msgstr "не " - -msgid "connected" -msgstr "під'єднаний" - -#, c-format -msgid "E275: Unknown SNiFF+ request: %s" -msgstr "E275: Невідомий запит до SNiFF+: %s" - -msgid "E276: Error connecting to SNiFF+" -msgstr "E276: Помилка з'єднання до SNiFF+" - -msgid "E278: SNiFF+ not connected" -msgstr "E278: SNiFF+ не під'єднано" - -msgid "E279: Not a SNiFF+ buffer" -msgstr "E279: Не є буфером SNiFF+" - -msgid "Sniff: Error during write. Disconnected" -msgstr "Sniff: Помилка запису. Від'єднано" - msgid "invalid buffer number" msgstr "неправильна назва буфера" @@ -2917,6 +2911,19 @@ msgstr "E573: Використано некоректний ідентифіка msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: Реквізит реєстру зразку VIM сформований неправильно. Знищено!" +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Повторення ключа в JSON: «%s»" + +# msgstr "E404: " +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: Бракує коми у списку: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: Немає кінцівки списку ']': %s" + msgid "Unknown option argument" msgstr "Невідомий аргумент опції" @@ -2943,12 +2950,12 @@ msgstr "%d файли(ів)\n" msgid "netbeans is not supported with this GUI\n" msgstr "netbeans не підтримується з цим GUI\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Ця версія Vim не була скомпільована з підтримкою порівняння." - msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "Не можна використати '-nb': не дозволено під час компіляції\n" +msgid "This Vim was not compiled with the diff feature." +msgstr "Ця версія Vim не була скомпільована з підтримкою порівняння." + msgid "Attempt to open script file again: \"" msgstr "Спроба повторно відкрити скрипт: \"" @@ -2961,6 +2968,9 @@ msgstr "Не вдалося відкрити як вихідний файл: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" msgstr "Vim: Помилка: Не вдалося запустити gvim для NetBeans\n" +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Помилка: Ця версія Vim не працює у терміналі Cygwin\n" + msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Застереження: Вивід не у термінал\n" @@ -2990,7 +3000,7 @@ msgid "- read text from stdin" msgstr "- читати текст з stdin" msgid "-t tag edit file where tag is defined" -msgstr "-t помітка перейти до теґу" +msgstr "-t помітка перейти до мітки" msgid "-q [errorfile] edit file with first error" msgstr "-q [файл] перейти до першої помилки" @@ -3127,6 +3137,12 @@ msgstr "-F\t\t\tЗапустити в режимі перської мови" msgid "-T <terminal>\tSet terminal type to <terminal>" msgstr "-T <термінал>\tВстановити тип терміналу у <термінал>" +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tПропустити попередження вводу/виводу не в термінал" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tВийти, якщо введення/виведення не в термінал" + msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc" msgstr "-u <vimrc>\t\tВикористати поданий файл замість .vimrc" @@ -3831,15 +3847,13 @@ msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" "(1) Можливо, інша програма вже редагує цей самий файл. Якщо це так,\n" " будьте обережні, щоб не залишилися два різні екземпляри\n" -" одного й того самого файлу після змін." - -msgid " Quit, or continue with caution.\n" -msgstr " Вийдіть або продовжуйте обережно.\n" +" одного й того самого файлу після змін. Вийдіть чи продовжуйте з " +"обережністю.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "(2) Сеанс редагування цього файлу зазнав краху.\n" @@ -3863,7 +3877,6 @@ msgid "" msgstr "" "»,\n" " щоб позбутися цього повідомлення.\n" -"\n" msgid "Swap file \"" msgstr "Файл обміну «" @@ -4130,15 +4143,6 @@ msgstr "E548: Потрібна цифра" msgid "E549: Illegal percentage" msgstr "E549: Неправильний відсоток" -msgid "Enter encryption key: " -msgstr "Вкажіть ключ шифру: " - -msgid "Enter same key again: " -msgstr "Повторіть ключ: " - -msgid "Keys don't match!" -msgstr "Ключі не однакові!" - msgid "E854: path too long for completion" msgstr "E854: шлях занадто довгий для доповнення" @@ -4170,21 +4174,12 @@ msgstr "E346: У cdpath немає більше каталогу «%s»" msgid "E347: No more file \"%s\" found in path" msgstr "E347: У шляху пошуку більше немає файлів «%s»" -msgid "Cannot connect to Netbeans #2" -msgstr "Не вдалося з'єднатися із Netbeans #2" - -msgid "Cannot connect to Netbeans" -msgstr "Не вдалося з'єднатися із Netbeans" - #, c-format msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" "E668: Неправильний режим доступу до файлу інформації про з'єднання з " "NetBenans: «%s»" -msgid "read from Netbeans socket" -msgstr "читається з сокета Netbeans" - #, c-format msgid "E658: NetBeans connection lost for buffer %ld" msgstr "E658: Втрачено зв'язок із NetBeans для буфера %ld" @@ -4227,8 +4222,8 @@ msgstr "E662: Початок списку змін" msgid "E663: At end of changelist" msgstr "E663: Кінець списку змін" -msgid "Type :quit<Enter> to exit Vim" -msgstr "Уведіть :quit<Enter> щоб вийти з Vim" +msgid "Type :qa! and press <Enter> to abandon all changes and exit Vim" +msgstr "Уведіть :qa! і натисніть <Enter>, щоб відкинути всі зміни і вийти з Vim" #, c-format msgid "1 line %sed 1 time" @@ -4316,33 +4311,40 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Невідомий тип регістру %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: шаблон пошуку і регістровий вираз не можуть містити два чи більше " +"рядків" + #, c-format msgid "%ld Cols; " msgstr "довж.: %ld; " #, c-format -msgid "Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes" -msgstr "Вибрано %s%ld з %ld рядків; %ld з %ld слів; %ld з %ld байтів" +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Вибрано %s%ld з %ld рядків; %lld з %lld слів; %lld з %lld байтів" #, c-format msgid "" -"Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld " -"Bytes" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" msgstr "" -"Вибрано %s%ld з %ld рядків; %ld з %ld слів; %ld of %ld символів; %ld з %ld " -"байтів" +"Вибрано %s%ld з %ld рядків; %lld з %lld слів; %lld of %lld символів; %lld з " +"%lld байтів" #, c-format -msgid "Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld" -msgstr "Колонка %s з %s; рядок %ld з %ld; слово %ld з %ld; байт %ld з %ld" +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Колонка %s з %s; рядок %ld з %ld; слово %lld з %lld; байт %lld з %lld" #, c-format msgid "" -"Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of " -"%ld" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte " +"%lld of %lld" msgstr "" -"Колонка %s з %s; рядок %ld з %ld; слово %ld з %ld; символ %ld of %ld; байт " -"%ld з %ld" +"Колонка %s з %s; рядок %ld з %ld; слово %lld з %lld; символ %lld of %lld; " +"байт %lld з %lld" #, c-format msgid "(+%ld for BOM)" @@ -4376,6 +4378,10 @@ msgstr "E522: Не знайдено серед можливостей термі msgid "E539: Illegal character <%s>" msgstr "E539: Недозволений символ <%s>" +#, c-format +msgid "For option %s" +msgstr "Для опції %s" + msgid "E529: Cannot set 'term' to empty string" msgstr "E529: Не вдалося спорожнити 'term'" @@ -4576,9 +4582,6 @@ msgstr "Помилка вводу/виводу" msgid "Message" msgstr "Повідомлення" -msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' не 80, не можна виконувати зовнішні команди" - # msgstr "E364: " msgid "E237: Printer selection failed" msgstr "E237: Не вдалося вибрати принтер" @@ -4603,6 +4606,10 @@ msgstr "Друкується '%s'" msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" msgstr "E244: Некоректна назва набору символів «%s» у назві шрифту «%s»" +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Некоректна назва якості «%s» у назві шрифту «%s»" + #, c-format msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: Помилковий символ %c в назві шрифту «%s»" @@ -4638,12 +4645,13 @@ msgstr "" "\n" "Не вдалося встановити контекст безпеки для " -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Не вдалося запустити оболонку" +#, c-format +msgid "Could not set security context %s for %s" +msgstr "Не вдалося встановити контекст безпеки %s для %s" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "Не вдалося отримати контекст безпеки %s для %s. Видаляємо!" msgid "" "\n" @@ -4674,6 +4682,13 @@ msgstr "" "\n" "Не вдалося роздвоїтися\n" +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Не вдалося запустити оболонку" + msgid "" "\n" "Command terminated\n" @@ -4716,10 +4731,6 @@ msgstr "Помилка VIM" msgid "Could not fix up function pointers to the DLL!" msgstr "Не вдалося виправити вказівники на функції DLL!" -#, c-format -msgid "shell returned %d" -msgstr "оболонка повернула %d" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Виявлено подію %s\n" @@ -4748,6 +4759,10 @@ msgstr "" msgid "Vim Warning" msgstr "Застереження Vim" +#, c-format +msgid "shell returned %d" +msgstr "оболонка повернула %d" + # msgstr "E371: " #, c-format msgid "E372: Too many %%%c in format string" @@ -4778,6 +4793,7 @@ msgid "E377: Invalid %%%c in format string" msgstr "E377: Помилковий `%%%c' у рядку формату" # msgstr "E377: " +#. nothing found msgid "E378: 'errorformat' contains no pattern" msgstr "E378: 'errorformat' не містить зразок" @@ -4788,6 +4804,15 @@ msgstr "E379: Пропущена чи порожня назва каталогу msgid "E553: No more items" msgstr "E553: Немає більше елементів" +msgid "E924: Current window was closed" +msgstr "E924: Поточне вікно було закрито" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Поточний quickfix змінився" + +msgid "E926: Current location list was changed" +msgstr "E926: Поточний список місць змінився" + #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d з %d)%s%s: " @@ -4795,15 +4820,18 @@ msgstr "(%d з %d)%s%s: " msgid " (line deleted)" msgstr " (рядок знищено)" +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sсписок помилок %d з %d; %d помилок" + msgid "E380: At bottom of quickfix stack" msgstr "E380: Дно стеку виправлень" msgid "E381: At top of quickfix stack" msgstr "E381: Вершина стеку виправлень" -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "список помилок %d з %d; %d помилок" +msgid "No entries" +msgstr "Нічого" msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: Не можу записати, вказана опція 'buftype'" @@ -4833,6 +4861,12 @@ msgstr "E369: Некоректний елемент у %s%%[]" msgid "E769: Missing ] after %s[" msgstr "E769: Бракує ] після %s[" +msgid "E944: Reverse range in character class" +msgstr "E944: Зворотній діапазон у класі символів" + +msgid "E945: Range too large in character class" +msgstr "E945: Завеликий діапазон у класі символів" + #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: Немає пари %s%%(" @@ -4861,6 +4895,9 @@ msgstr "E69: Пропущено ] після %s%%[" msgid "E70: Empty %s%%[]" msgstr "E70: %s%%[] порожній" +msgid "E65: Illegal back reference" +msgstr "E65: Некоректне зворотне посилання" + # msgstr "E382: " msgid "E339: Pattern too long" msgstr "E339: Зразок занадто довгий" @@ -4901,9 +4938,6 @@ msgstr "E63: Некоректно вжито \\_" msgid "E64: %s%c follows nothing" msgstr "E64: Після %s%c нічого немає" -msgid "E65: Illegal back reference" -msgstr "E65: Некоректне зворотнє посилання" - msgid "E68: Invalid character after \\z" msgstr "E68: Неправильний символ після \\z" @@ -4923,18 +4957,30 @@ msgstr "E554: Синтаксична помилка в %s{...}" msgid "External submatches:\n" msgstr "Зовнішні під-збіги:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) не можна повторити %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: після \\%#= може бути тільки 0, 1, or 2. Буде використано автоматичний механізм " +"E864: після \\%#= може бути тільки 0, 1, or 2. Буде використано автоматичний " +"механізм " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Перемикаємося до пошуку з поверненням для шаблона: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Зарано трапився кінець регулярного виразу" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA regexp) Не на місці %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) Зарано трапився кінець регулярного виразу" +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Неправильний клас символу: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" @@ -4988,7 +5034,8 @@ msgstr "E878: (NFA) Не вдалося отримати пам’ять для msgid "" "Could not open temporary log file for writing, displaying on stderr ... " msgstr "" -"Не вдалося відкрити тимчасовий файл журналу для запису, показується на stderr ... " +"Не вдалося відкрити тимчасовий файл журналу для запису, показується на " +"stderr ... " #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -5024,9 +5071,6 @@ msgstr " Іврит" msgid " Arabic" msgstr " Арабська" -msgid " (lang)" -msgstr " (мова)" - msgid " (paste)" msgstr " (клей)" @@ -5122,8 +5166,51 @@ msgstr "" "# Ост. %sЗразок пошуку:\n" "~" -msgid "E759: Format error in spell file" -msgstr "E759: Помилка формату у файлі орфографії" +msgid "E756: Spell checking is not enabled" +msgstr "E756: Перевірка орфографії не дозволена" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "" +"Застереження: Не вдалося знайти список слів «%s_%s.spl» чи «%s_ascii.spl»" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "" +"Застереження: Не вдалося знайти список слів «%s.%s.spl» чи «%s.ascii.spl»" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: Автокоманда SpellFileMissing знищила буфер" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Застереження: регіон %s не підтримується" + +msgid "Sorry, no suggestions" +msgstr "Пробачте, немає пропозицій" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Пробачте, тільки %ld пропозицій" + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Замінити «%.*s» на:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < «%.*s»" + +# msgstr "E34: " +msgid "E752: No previous spell replacement" +msgstr "E752: Немає попередньої заміни" + +# msgstr "E333: " +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Не знайдено: %s" # msgstr "E364: " msgid "E758: Truncated spell file" @@ -5147,19 +5234,6 @@ msgstr "E762: Символ у FOL, LOW чи UPP поза межами" msgid "Compressing word tree..." msgstr "Стискується дерево слів..." -msgid "E756: Spell checking is not enabled" -msgstr "E756: Перевірка орфографії не дозволена" - -#, c-format -msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" -msgstr "" -"Застереження: Не вдалося знайти список слів «%s_%s.spl» чи «%s_ascii.spl»" - -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "" -"Застереження: Не вдалося знайти список слів «%s.%s.spl» чи «%s.ascii.spl»" - #, c-format msgid "Reading spell file \"%s\"" msgstr "Читається файл орфографії «%s»" @@ -5177,8 +5251,24 @@ msgid "E770: Unsupported section in spell file" msgstr "E770: Недозволена секція у файлі орфографії" #, c-format -msgid "Warning: region %s not supported" -msgstr "Застереження: регіон %s не підтримується" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Не схоже на файл .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Застарілий файл .sug, треба поновити: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Файл .sug для більш нової версії Vim: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Файл .sug не відповідає файлу .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Помилка читання файлу .sug: %s" #, c-format msgid "Reading affix file %s ..." @@ -5417,83 +5507,37 @@ msgstr "Оцінка споживання пам'яті: %d байт" msgid "E751: Output file name must not have region name" msgstr "E751: Вихідний файл не повинен мати назву регіону" -msgid "E754: Only up to 8 regions supported" -msgstr "E754: Підтримується тільки до восьми регіонів" - -#, c-format -msgid "E755: Invalid region in %s" -msgstr "E755: Некоректний регіон у %s" - -msgid "Warning: both compounding and NOBREAK specified" -msgstr "Застереження: зазначено обидва `складні слова' і NOBREAK" - -#, c-format -msgid "Writing spell file %s ..." -msgstr "Записується файл орфографії %s ..." - -msgid "Done!" -msgstr "Зроблено!" - -#, c-format -msgid "E765: 'spellfile' does not have %ld entries" -msgstr "E765: 'spellfile' не містить %ld елементів" - -#, c-format -msgid "Word '%.*s' removed from %s" -msgstr "Слово '%.*s' знищено з %s" - -#, c-format -msgid "Word '%.*s' added to %s" -msgstr "Слово '%.*s' додано до %s" - -msgid "E763: Word characters differ between spell files" -msgstr "E763: Символи у слові відрізняються у файлах орфографії" - -msgid "Sorry, no suggestions" -msgstr "Пробачте, немає пропозицій" - -#, c-format -msgid "Sorry, only %ld suggestions" -msgstr "Пробачте, тільки %ld пропозицій" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Замінити «%.*s» на:" - -#, c-format -msgid " < \"%.*s\"" -msgstr " < «%.*s»" - -# msgstr "E34: " -msgid "E752: No previous spell replacement" -msgstr "E752: Немає попередньої заміни" +msgid "E754: Only up to 8 regions supported" +msgstr "E754: Підтримується тільки до восьми регіонів" -# msgstr "E333: " #, c-format -msgid "E753: Not found: %s" -msgstr "E753: Не знайдено: %s" +msgid "E755: Invalid region in %s" +msgstr "E755: Некоректний регіон у %s" -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Не схоже на файл .sug: %s" +msgid "Warning: both compounding and NOBREAK specified" +msgstr "Застереження: зазначено обидва `складні слова' і NOBREAK" #, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Застарілий файл .sug, треба поновити: %s" +msgid "Writing spell file %s ..." +msgstr "Записується файл орфографії %s ..." + +msgid "Done!" +msgstr "Зроблено!" #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: Файл .sug для більш нової версії Vim: %s" +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' не містить %ld елементів" #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: Файл .sug не відповідає файлу .spl: %s" +msgid "Word '%.*s' removed from %s" +msgstr "Слово '%.*s' знищено з %s" #, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: Помилка читання файлу .sug: %s" +msgid "Word '%.*s' added to %s" +msgstr "Слово '%.*s' додано до %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: Символи у слові відрізняються у файлах орфографії" #. This should have been checked when generating the .spl #. * file. @@ -5504,10 +5548,34 @@ msgstr "E783: Повторено символ у елементі MAP" msgid "No Syntax items defined for this buffer" msgstr "Для буфера не визначено елементів синтаксису" +msgid "syntax conceal on" +msgstr "маскування синтаксису увімк" + +msgid "syntax conceal off" +msgstr "маскування синтаксису вимк" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Неправильний аргумент: %s" +msgid "syntax case ignore" +msgstr "синтаксис ігнорувати регістр" + +msgid "syntax case match" +msgstr "синтаксис дотримуватися регістру" + +msgid "syntax spell toplevel" +msgstr "синтаксис перевіряти всюди" + +msgid "syntax spell notoplevel" +msgstr "синтаксис не перевіряти" + +msgid "syntax spell default" +msgstr "синтаксис початково" + +msgid "syntax iskeyword " +msgstr "синтаксис iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Немає такого синтаксичного кластера: %s" @@ -5569,7 +5637,7 @@ msgid "E844: invalid cchar value" msgstr "E844: Некоректне значення cchar" msgid "E393: group[t]here not accepted here" -msgstr "E393: group[t]hete тут неприйнятний" +msgstr "E393: group[t]here тут неприйнятний" #, c-format msgid "E394: Didn't find region item for %s" @@ -5586,6 +5654,10 @@ msgstr "E847: Забагато синтаксичних включень" msgid "E789: Missing ']': %s" msgstr "E789: Пропущено ']': %s" +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: надлишкові символи після ']': %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: Пропущено `=': %s" @@ -5730,32 +5802,32 @@ msgstr "E849: Забагато груп підсвічування і синта # msgstr "E424: " msgid "E555: at bottom of tag stack" -msgstr "E555: Кінець стеку теґів" +msgstr "E555: Кінець стеку міток" msgid "E556: at top of tag stack" -msgstr "E556: Вершина стеку теґів" +msgstr "E556: Вершина стеку міток" msgid "E425: Cannot go before first matching tag" -msgstr "E425: Це вже найперший відповідний теґ" +msgstr "E425: Це вже найперша відповідна мітка" # msgstr "E425: " #, c-format msgid "E426: tag not found: %s" -msgstr "E426: Теґ не знайдено: %s" +msgstr "E426: Мітку не знайдено: %s" # msgstr "E426: " msgid " # pri kind tag" -msgstr " # прі тип теґ" +msgstr " # прі тип мітка" msgid "file\n" msgstr "файл\n" msgid "E427: There is only one matching tag" -msgstr "E427: Лише один відповідний теґ" +msgstr "E427: Лише одна відповідна мітка" # msgstr "E427: " msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: Це вже останній відповідний теґ" +msgstr "E428: Це вже остання відповідна мітка" # msgstr "E428: " #, c-format @@ -5765,13 +5837,13 @@ msgstr "Файл «%s» не існує" #. Give an indication of the number of matching tags #, c-format msgid "tag %d of %d%s" -msgstr "теґ %d з %d%s" +msgstr "мітка %d з %d%s" msgid " or more" msgstr " або більше" msgid " Using tag with different case!" -msgstr " Використано теґ, не розрізняючи великі й малі літери" +msgstr " Використано мітку, не розрізняючи великі й малі літери" #, c-format msgid "E429: File \"%s\" does not exist" @@ -5784,15 +5856,15 @@ msgid "" " # TO tag FROM line in file/text" msgstr "" "\n" -" # ДО теґу З рядка у файлі/тексті" +" # ДО мітки З рядка у файлі/тексті" #, c-format msgid "Searching tags file %s" -msgstr "Шукається у файлі теґів %s" +msgstr "Шукається у файлі міток %s" #, c-format msgid "E430: Tag file path truncated for %s\n" -msgstr "E430: Шлях файлу теґів скорочено до %s\n" +msgstr "E430: Шлях файлу міток скорочено до %s\n" msgid "Ignoring long line in tags file" msgstr "Ігнорується довгий рядок у файлі з позначками" @@ -5800,7 +5872,7 @@ msgstr "Ігнорується довгий рядок у файлі з позн # msgstr "E430: " #, c-format msgid "E431: Format error in tags file \"%s\"" -msgstr "E431: Помилка формату у файлі теґів «%s»" +msgstr "E431: Помилка формату у файлі міток «%s»" # msgstr "E431: " #, c-format @@ -5809,20 +5881,20 @@ msgstr "Перед байтом %ld" #, c-format msgid "E432: Tags file not sorted: %s" -msgstr "E432: Файл теґів не впорядкований: %s" +msgstr "E432: Файл міток не впорядкований: %s" # msgstr "E432: " #. never opened any tags file msgid "E433: No tags file" -msgstr "E433: Немає файлу теґів" +msgstr "E433: Немає файлу міток" # msgstr "E433: " msgid "E434: Can't find tag pattern" -msgstr "E434: Не вдалося знайти зразок теґу" +msgstr "E434: Не вдалося знайти зразок мітки" # msgstr "E434: " msgid "E435: Couldn't find tag, just guessing!" -msgstr "E435: Не вдалося знайти теґ, тільки припущення!" +msgstr "E435: Не вдалося знайти мітку, тільки припущення!" #, c-format msgid "Duplicate field name: %s" @@ -5859,6 +5931,9 @@ msgstr "" "\n" "--- Клавіші терміналу ---" +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Неможливо відкрити $VIMRUNTIME/rgb.txt" + msgid "new shell started\n" msgstr "запущено нову оболонку\n" @@ -5871,8 +5946,8 @@ msgstr "Використано CUT_BUFFER0 замість порожнього #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Кількість рядків несподівано змінилася" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Кількість рядків несподівано змінилася" #. must display the prompt msgid "No undo possible; continue anyway" @@ -5891,7 +5966,7 @@ msgstr "Не вдалося записати файл історії у жодн #, c-format msgid "Will not overwrite with undo file, cannot read: %s" -msgstr "Will not overwrite with undo file, cannot read: %s" +msgstr "Не можна перезаписати з файлу скасувань, не можна прочитати: %s" #, c-format msgid "Will not overwrite, this is not an undo file: %s" @@ -5927,7 +6002,7 @@ msgstr "E823: Не файл історії: %s" #, c-format msgid "E832: Non-encrypted file has encrypted undo file: %s" -msgstr "E832: Незашифрований файл має зашифрований файл історії: %s" +msgstr "E832: Не зашифрований файл має зашифрований файл історії: %s" #, c-format msgid "E826: Undo file decryption failed: %s" @@ -6012,15 +6087,133 @@ msgstr "E439: Список скасування пошкоджено" msgid "E440: undo line missing" msgstr "E440: Відсутній рядок скасування" -# msgstr "E440: " -# --------------------------------------- -#. Only MS VC 4.1 and earlier can do Win32s -msgid "" -"\n" -"MS-Windows 16/32-bit GUI version" -msgstr "" -"\n" -"Версія з GUI для 16/32-розрядної Windows" +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Функція %s уже існує, ! щоб замінити" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Запис у словнику вже існує" + +msgid "E718: Funcref required" +msgstr "E718: Треба посилання на функцію" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Невідома функція: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Недозволений аргумент: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Назва аргументу повторюється: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Забагато аргументів для функції %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Неправильні аргументи функції %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Глибина викликів функції перевищує 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "викликається %s" + +#, c-format +msgid "%s aborted" +msgstr "%s припинено" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s повертає #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s повертає %s" + +msgid "E699: Too many arguments" +msgstr "E699: Забагато аргументів" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Невідома функція: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Функцію видалено: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Замало аргументів для функції %s" + +#, c-format +msgid "E120: Using <SID> not in a script context: %s" +msgstr "E120: <SID> використовується не у контексті скрипту: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Виклик dict-функції без словника: %s" + +msgid "E129: Function name required" +msgstr "E129: Не вказано назву функції" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Назва функції має починатися з великої літери або «s:»: %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Назва функції не може мати двокрапку: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: Невизначена функція: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: Бракує '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: Тут не можна використати g:" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Функція замикання не повинна бути на верхньому рівні: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: Бракує :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Трапився текст після :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Назва функції співпадає зі змінною: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Не вдалося перевизначити функцію %s: вона використовується" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Назва функції не збігається з назвою файлу скрипту: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Не вдалося знищити функцію %s: Вона використовується" + +msgid "E133: :return not inside a function" +msgstr "E133: :return поза межами функції" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: Пропущено дужки: %s" msgid "" "\n" @@ -6036,9 +6229,6 @@ msgstr "" "\n" "Версія з GUI для 32-розрядної Windows" -msgid " in Win32s mode" -msgstr " в режимі Win32s" - msgid " with OLE support" msgstr " з підтримкою OLE" @@ -6056,27 +6246,6 @@ msgstr "" "\n" "Консольна версія для 32-розрядної Windows" -msgid "" -"\n" -"MS-Windows 16-bit version" -msgstr "" -"\n" -"Версія для 16-розрядної Windows" - -msgid "" -"\n" -"32-bit MS-DOS version" -msgstr "" -"\n" -"Версія для 32-розрядної MS-DOS" - -msgid "" -"\n" -"16-bit MS-DOS version" -msgstr "" -"\n" -"Версія для 16-розрядної MS-DOS" - msgid "" "\n" "MacOS X (unix) version" @@ -6170,6 +6339,9 @@ msgstr "" msgid "without GUI." msgstr "без GUI." +msgid "with GTK3 GUI." +msgstr "з GUI GTK3." + msgid "with GTK2-GNOME GUI." msgstr "з GUI GTK2-GNOME." @@ -6233,6 +6405,9 @@ msgstr "другий gvimrc користувача: \"" msgid "3rd user gvimrc file: \"" msgstr "третій gvimrc користувача: \"" +msgid " defaults file: \"" +msgstr " файл defaults: \"" + msgid " system menu file: \"" msgstr " системне меню: \"" @@ -6278,8 +6453,8 @@ msgstr ":q<Enter> вихід з Vim " msgid "type :help<Enter> or <F1> for on-line help" msgstr ":help<Enter> або <F1> перегляд допомоги " -msgid "type :help version7<Enter> for version info" -msgstr ":help version7<Enter> інформація про версію " +msgid "type :help version8<Enter> for version info" +msgstr ":help version8<Enter> інформація про версію " msgid "Running in Vi compatible mode" msgstr "Ви працюєте в режимі сумісному з Vi" @@ -6323,12 +6498,6 @@ msgstr ":help register<Enter> подальша інформація " msgid "menu Help->Sponsor/Register for information " msgstr "меню Допомога->Спонсор/Реєстрація подробиці " -msgid "WARNING: Windows 95/98/ME detected" -msgstr "ЗАСТЕРЕЖЕННЯ: Ви користуєтеся Windows 95/98/ME" - -msgid "type :help windows95<Enter> for info on this" -msgstr ":help windows95<Enter> інформація про це " - # msgstr "E444: " msgid "Already only one window" msgstr "Це вже єдине вікно" @@ -6368,6 +6537,27 @@ msgstr "E446: Немає назви файлу над курсором" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Файл «%s» не знайдено у шляху пошуку" +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Неправильний ID: %ld (має бути не менший, ніж 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ID вже зайнято: %ld" + +# msgstr "E396: " +msgid "List or number required" +msgstr "Потрібен список чи число" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Неправильний ID: %ld (має бути не менший, ніж 1)" + +# msgstr "E333: " +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ID не знайдено: %ld" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Не вдалося завантажити бібліотеку %s" @@ -6473,6 +6663,10 @@ msgstr "E236: Шрифт «%s» не моноширинний" msgid "E473: Internal error" msgstr "E473: Внутрішня помилка" +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Внутрішня помилка: %s" + msgid "Interrupted" msgstr "Перервано" @@ -6622,6 +6816,9 @@ msgstr "E485: Не вдалося прочитати файл %s" msgid "E37: No write since last change (add ! to override)" msgstr "E37: Зміни не було записано (! щоб не зважати)" +msgid "E37: No write since last change" +msgstr "E37: Не записано попередні зміни" + msgid "E38: Null argument" msgstr "E38: Відсутній аргумент" @@ -6674,6 +6871,32 @@ msgstr "E46: Змінна тільки для читання: «%s»" msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "E794: Не можна встановити змінну у пісочниці: «%s»" +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Ключ словника не може бути порожнім" + +msgid "E715: Dictionary required" +msgstr "E715: Потрібен словник" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Індекс списку поза межами: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Забагато аргументів для функції: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: Немає такого ключа у словнику: %s" + +# msgstr "E396: " +msgid "E714: List required" +msgstr "E714: Потрібен список" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Аргумент у %s має бути списком чи словником" + msgid "E47: Error while reading errorfile" msgstr "E47: Помилка читання файлу помилок" @@ -6700,7 +6923,7 @@ msgid "E72: Close error on swap file" msgstr "E72: Помилка під час закриття файлу обміну" msgid "E73: tag stack empty" -msgstr "E73: Стек теґів порожній" +msgstr "E73: Стек міток порожній" msgid "E74: Command too complex" msgstr "E74: Занадто складна команда" @@ -6733,8 +6956,9 @@ msgstr "E592: 'winwidth' не може бути меншим за 'winminwidth'" msgid "E80: Error while writing" msgstr "E80: Помилка під час запису" -msgid "Zero count" -msgstr "Нульова кількість" +# msgstr "E396: " +msgid "E939: Positive count required" +msgstr "E939: Потрібна додатна кількість" msgid "E81: Using <SID> not in a script context" msgstr "E81: <SID> використовується не в контексті скрипту" @@ -6748,16 +6972,16 @@ msgstr "E463: Не можна змінити захищений регіон" msgid "E744: NetBeans does not allow changes in read-only files" msgstr "E744: NetBeans не дозволяє змінювати захищені від запису файли" -#, c-format -msgid "E685: Internal error: %s" -msgstr "E685: Внутрішня помилка: %s" - msgid "E363: pattern uses more memory than 'maxmempattern'" msgstr "E363: Зразок використовує більше, ніж 'maxmempattern', пам'яті" msgid "E749: empty buffer" msgstr "E749: Порожній буфер" +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Буфера %ld немає" + msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Некоректний зразок для пошуку чи роздільник" @@ -6772,6 +6996,10 @@ msgstr "E764: Опція '%s' не встановлена" msgid "E850: Invalid register name" msgstr "E850: Неправильна назва регістру" +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Теку не знайдено: '%s': «%s»" + msgid "search hit TOP, continuing at BOTTOM" msgstr "Пошук дійшов до ПОЧАТКУ, продовжується з КІНЦЯ" @@ -6812,7 +7040,8 @@ msgstr "очікувався екземпляр bytes() чи str(), але от msgid "" "expected int(), long() or something supporting coercing to long(), but got %s" msgstr "" -"очікувався int(), long() чи щось, що може бути вміщене long(), але отримано %s" +"очікувався int(), long() чи щось, що може бути вміщене long(), але отримано " +"%s" #, c-format msgid "expected int() or something supporting coercing to int(), but got %s" @@ -6824,7 +7053,7 @@ msgstr "значення завелике, щоб вміститися у тип msgid "value is too small to fit into C int type" msgstr "значення замале, щоб вміститися у тип C int" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr "число має бути більше, ніж нуль" msgid "number must be greater or equal to zero" @@ -6870,7 +7099,8 @@ msgstr "хеш-таблиця змінилася під час перебира #, c-format msgid "expected sequence element of size 2, but got sequence of size %d" -msgstr "очікувалась послідовність розміром 2, але отримано послідовність розміру %d" +msgstr "" +"очікувалась послідовність розміром 2, але отримано послідовність розміру %d" msgid "list constructor does not accept keyword arguments" msgstr "списковий конструктор не приймає іменовані аргументи" @@ -6883,16 +7113,32 @@ msgstr "індекс списку за межами" msgid "internal error: failed to get vim list item %d" msgstr "внутрішня помилка: не вдалося отримати елемент списку vim %d" -msgid "failed to add item to list" -msgstr "не вдалося додати елемент до списку" +msgid "slice step cannot be zero" +msgstr "крок зрізу не може бути нуль" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"спроба призначити послідовність розміру більше, ніж %d, у розширений зріз" #, c-format msgid "internal error: no vim list item %d" msgstr "внутрішня помилка: немає елемента списку vim %d" +msgid "internal error: not enough list items" +msgstr "внутрішня помилка: бракує елементів у списку" + msgid "internal error: failed to add item to list" msgstr "внутрішня помилка: не вдалося додати елемент до списку" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"спроба призначити послідовність розміром %d у розширений зріз розміру %d" + +msgid "failed to add item to list" +msgstr "не вдалося додати елемент до списку" + msgid "cannot delete vim.List attributes" msgstr "не вдалося знищити атрибути vim.List" @@ -6909,9 +7155,6 @@ msgstr "безіменної функції %s не існує" msgid "function %s does not exist" msgstr "функції %s не існує" -msgid "function constructor does not accept keyword arguments" -msgstr "конструктор функції не приймає іменовані аргументи" - #, c-format msgid "failed to run function %s" msgstr "не вдалося виконати функцію %s" @@ -6998,6 +7241,10 @@ msgstr "E859: Не вдалося перетворити об’єкт python у msgid "unable to convert %s to vim dictionary" msgstr "не вдалося перетворити %s у словник vim" +#, c-format +msgid "unable to convert %s to vim list" +msgstr "не вдалося перетворити %s у список vim" + #, c-format msgid "unable to convert %s to vim structure" msgstr "не вдалося перетворити %s у структуру vim" diff --git a/src/po/vi.po b/src/po/vi.po index 908b2eb158..ceb1865264 100644 --- a/src/po/vi.po +++ b/src/po/vi.po @@ -4774,8 +4774,8 @@ msgstr " hãy gõ :q<Enter> để thoát khỏi chương trình msgid "type :help<Enter> or <F1> for on-line help" msgstr " hãy gõ :help<Enter> hoặc <F1> để có được trợ giúp " -msgid "type :help version7<Enter> for version info" -msgstr "hãy gõ :help version7<Enter> để biết về phiên bản này " +msgid "type :help version8<Enter> for version info" +msgstr "hãy gõ :help version8<Enter> để biết về phiên bản này " msgid "Running in Vi compatible mode" msgstr "Làm việc trong chế độ tương thích với Vi" diff --git a/src/po/zh_CN.UTF-8.po b/src/po/zh_CN.UTF-8.po index d7d0ffa730..35ba8b3dfc 100644 --- a/src/po/zh_CN.UTF-8.po +++ b/src/po/zh_CN.UTF-8.po @@ -17,8 +17,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-04-21 15:16+0800\n" "PO-Revision-Date: 2006-04-21 14:00+0800\n" -"Last-Translator: Yuheng Xie <elephant@linux.net.cn>\n" -"Language-Team: Simplified Chinese <i18n-translation@lists.linux.net.cn>\n" +"Last-Translator: Yuheng Xie\n" +"Language-Team: Simplified Chinese\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" @@ -2894,7 +2894,8 @@ msgstr "-X\t\t\t不连接到 X Server" msgid "--remote <files>\tEdit <files> in a Vim server if possible" msgstr "--remote <files>\t如有可能,在 Vim 服务器上编辑文件 <files>" -msgid "--remote-silent <files> Same, don't complain if there is no server" +msgid "" +"--remote-silent <files> Same, don't complain if there is no server" msgstr "--remote-silent <files> 同上,找不到服务器时不抱怨" msgid "" @@ -5587,8 +5588,8 @@ msgstr "输入 :q<Enter> 退出 " msgid "type :help<Enter> or <F1> for on-line help" msgstr "输入 :help<Enter> 或 <F1> 查看在线帮助 " -msgid "type :help version7<Enter> for version info" -msgstr "输入 :help version7<Enter> 查看版本信息 " +msgid "type :help version8<Enter> for version info" +msgstr "输入 :help version8<Enter> 查看版本信息 " msgid "Running in Vi compatible mode" msgstr "运行于 Vi 兼容模式" diff --git a/src/po/zh_CN.cp936.po b/src/po/zh_CN.cp936.po index 8169b43219..f7f7f913ae 100644 --- a/src/po/zh_CN.cp936.po +++ b/src/po/zh_CN.cp936.po @@ -9,7 +9,7 @@ # Edyfox <edyfox@gmail.com> # Yuheng Xie <elephant@linux.net.cn> # -# Generated from zh_CN.po, DO NOT EDIT. +# Generated from zh_CN.UTF-8.po, DO NOT EDIT. # msgid "" msgstr "" @@ -17,8 +17,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-04-21 15:16+0800\n" "PO-Revision-Date: 2006-04-21 14:00+0800\n" -"Last-Translator: Yuheng Xie <elephant@linux.net.cn>\n" -"Language-Team: Simplified Chinese <i18n-translation@lists.linux.net.cn>\n" +"Last-Translator: Yuheng Xie\n" +"Language-Team: Simplified Chinese\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=gbk\n" "Content-Transfer-Encoding: 8-bit\n" @@ -241,9 +241,8 @@ msgstr " msgid " Tag completion (^]^N^P)" msgstr " Tag ȫ (^]^N^P)" -#, fuzzy -#~ msgid " Path pattern completion (^N^P)" -#~ msgstr " ·ģʽȫ (^N^P)" +msgid " Path pattern completion (^N^P)" +msgstr " ͷļģʽȫ (^N^P)" msgid " Definition completion (^D^N^P)" msgstr " 岹ȫ (^D^N^P)" @@ -2895,8 +2894,9 @@ msgstr "-X\t\t\t msgid "--remote <files>\tEdit <files> in a Vim server if possible" msgstr "--remote <files>\tпܣ Vim ϱ༭ļ <files>" -msgid "--remote-silent <files> Same, don't complain if there is no server" -msgstr "--remote-silent <files> ͬϣҲʱԹ" +msgid "" +"--remote-silent <files> Same, don't complain if there is no server" +msgstr "--remote-silent <files> ͬϣҲʱԹ" msgid "" "--remote-wait <files> As --remote but wait for files to have been edited" @@ -5284,7 +5284,7 @@ msgstr "Vim: #. must display the prompt msgid "No undo possible; continue anyway" -msgstr "޷" +msgstr "޷Ȼ" msgid "Already at oldest change" msgstr "λɵĸı" @@ -5588,8 +5588,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr " :help<Enter> <F1> 鿴߰ " -msgid "type :help version7<Enter> for version info" -msgstr " :help version7<Enter> 鿴汾Ϣ " +msgid "type :help version8<Enter> for version info" +msgstr " :help version8<Enter> 鿴汾Ϣ " msgid "Running in Vi compatible mode" msgstr " Vi ģʽ" @@ -5601,13 +5601,13 @@ msgid "type :help cp-default<Enter> for info on this" msgstr " :help cp-default<Enter> 鿴˵ " msgid "menu Help->Orphans for information " -msgstr "˵ Help->Orphans 鿴˵ " +msgstr "˵ ->¶ 鿴˵ " msgid "Running modeless, typed text is inserted" msgstr "ģʽУּ" msgid "menu Edit->Global Settings->Toggle Insert Mode " -msgstr "˵ Edit->Global Settings->Toggle Insert Mode " +msgstr "˵ ༭->ȫ趨->/زģʽ " #, fuzzy #~ msgid " for two modes " diff --git a/src/po/zh_CN.po b/src/po/zh_CN.po index df65aa66f1..e9a876bf04 100644 --- a/src/po/zh_CN.po +++ b/src/po/zh_CN.po @@ -5588,8 +5588,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr " :help<Enter> <F1> 鿴߰ " -msgid "type :help version7<Enter> for version info" -msgstr " :help version7<Enter> 鿴汾Ϣ " +msgid "type :help version8<Enter> for version info" +msgstr " :help version8<Enter> 鿴汾Ϣ " msgid "Running in Vi compatible mode" msgstr " Vi ģʽ" diff --git a/src/po/zh_TW.UTF-8.po b/src/po/zh_TW.UTF-8.po index d7b6501a17..250b37be5a 100644 --- a/src/po/zh_TW.UTF-8.po +++ b/src/po/zh_TW.UTF-8.po @@ -4759,8 +4759,8 @@ msgstr "要離開請輸入 :q<Enter> " msgid "type :help<Enter> or <F1> for on-line help" msgstr "線上說明請輸入 :help<Enter> " -msgid "type :help version7<Enter> for version info" -msgstr "新版本資訊請輸入 :help version7<Enter>" +msgid "type :help version8<Enter> for version info" +msgstr "新版本資訊請輸入 :help version8<Enter>" msgid "Running in Vi compatible mode" msgstr "Vi 相容模式" diff --git a/src/po/zh_TW.po b/src/po/zh_TW.po index 6f43c8025a..b3f84201ae 100644 --- a/src/po/zh_TW.po +++ b/src/po/zh_TW.po @@ -4752,8 +4752,8 @@ msgstr " msgid "type :help<Enter> or <F1> for on-line help" msgstr "uWпJ :help<Enter> " -msgid "type :help version7<Enter> for version info" -msgstr "sTпJ :help version7<Enter>" +msgid "type :help version8<Enter> for version info" +msgstr "sTпJ :help version8<Enter>" msgid "Running in Vi compatible mode" msgstr "Vi ۮeҦ" diff --git a/src/popupmnu.c b/src/popupmnu.c index 68ee2d5623..5248217255 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -23,247 +23,342 @@ static int pum_height; /* nr of displayed pum items */ static int pum_width; /* width of displayed pum items */ static int pum_base_width; /* width of pum items base */ static int pum_kind_width; /* width of pum items kind column */ +static int pum_extra_width; /* width of extra stuff */ static int pum_scrollbar; /* TRUE when scrollbar present */ static int pum_row; /* top row of pum */ static int pum_col; /* left column of pum */ +static win_T *pum_window = NULL; +static int pum_win_row; +static int pum_win_height; +static int pum_win_col; +static int pum_win_wcol; +static int pum_win_width; + static int pum_do_redraw = FALSE; /* do redraw anyway */ -static int pum_set_selected __ARGS((int n, int repeat)); +static int pum_set_selected(int n, int repeat); #define PUM_DEF_HEIGHT 10 #define PUM_DEF_WIDTH 15 + static void +pum_compute_size(void) +{ + int i; + int w; + + /* Compute the width of the widest match and the widest extra. */ + pum_base_width = 0; + pum_kind_width = 0; + pum_extra_width = 0; + for (i = 0; i < pum_size; ++i) + { + w = vim_strsize(pum_array[i].pum_text); + if (pum_base_width < w) + pum_base_width = w; + if (pum_array[i].pum_kind != NULL) + { + w = vim_strsize(pum_array[i].pum_kind) + 1; + if (pum_kind_width < w) + pum_kind_width = w; + } + if (pum_array[i].pum_extra != NULL) + { + w = vim_strsize(pum_array[i].pum_extra) + 1; + if (pum_extra_width < w) + pum_extra_width = w; + } + } +} + /* * Show the popup menu with items "array[size]". * "array" must remain valid until pum_undisplay() is called! - * When possible the leftmost character is aligned with screen column "col". + * When possible the leftmost character is aligned with cursor column. * The menu appears above the screen line "row" or at "row" + "height" - 1. */ void -pum_display(array, size, selected) - pumitem_T *array; - int size; - int selected; /* index of initially selected item, none if +pum_display( + pumitem_T *array, + int size, + int selected) /* index of initially selected item, none if out of range */ { - int w; int def_width; int max_width; - int kind_width; - int extra_width; - int i; - int top_clear; - int row; int context_lines; - int col; - int above_row = cmdline_row; + int cursor_col; + int above_row; + int below_row; int redo_count = 0; +#if defined(FEAT_QUICKFIX) + win_T *pvwin; +#endif -redo: - def_width = PUM_DEF_WIDTH; - max_width = 0; - kind_width = 0; - extra_width = 0; - - /* Pretend the pum is already there to avoid that must_redraw is set when - * 'cuc' is on. */ - pum_array = (pumitem_T *)1; - validate_cursor_col(); - pum_array = NULL; - - row = curwin->w_wrow + W_WINROW(curwin); - - if (firstwin->w_p_pvw) - top_clear = firstwin->w_height; - else - top_clear = 0; - - /* When the preview window is at the bottom stop just above it. Also - * avoid drawing over the status line so that it's clear there is a window - * boundary. */ - if (lastwin->w_p_pvw) - above_row -= lastwin->w_height + lastwin->w_status_height + 1; - - /* - * Figure out the size and position of the pum. - */ - if (size < PUM_DEF_HEIGHT) - pum_height = size; - else - pum_height = PUM_DEF_HEIGHT; - if (p_ph > 0 && pum_height > p_ph) - pum_height = p_ph; - - /* Put the pum below "row" if possible. If there are few lines decide on - * where there is more room. */ - if (row + 2 >= above_row - pum_height - && row > (above_row - top_clear) / 2) + do { - /* pum above "row" */ + def_width = p_pw; + above_row = 0; + below_row = cmdline_row; + + /* Pretend the pum is already there to avoid that must_redraw is set + * when 'cuc' is on. */ + pum_array = (pumitem_T *)1; + validate_cursor_col(); + pum_array = NULL; + + // Remember the essential parts of the window position and size, so we + // can decide when to reposition the popup menu. + pum_window = curwin; + pum_win_row = curwin->w_wrow + W_WINROW(curwin); + pum_win_height = curwin->w_height; + pum_win_col = curwin->w_wincol; + pum_win_wcol = curwin->w_wcol; + pum_win_width = curwin->w_width; + +#if defined(FEAT_QUICKFIX) + FOR_ALL_WINDOWS(pvwin) + if (pvwin->w_p_pvw) + break; + if (pvwin != NULL) + { + if (W_WINROW(pvwin) < W_WINROW(curwin)) + above_row = W_WINROW(pvwin) + pvwin->w_height; + else if (W_WINROW(pvwin) > W_WINROW(curwin) + curwin->w_height) + below_row = W_WINROW(pvwin); + } +#endif - /* Leave two lines of context if possible */ - if (curwin->w_wrow - curwin->w_cline_row >= 2) - context_lines = 2; + /* + * Figure out the size and position of the pum. + */ + if (size < PUM_DEF_HEIGHT) + pum_height = size; else - context_lines = curwin->w_wrow - curwin->w_cline_row; + pum_height = PUM_DEF_HEIGHT; + if (p_ph > 0 && pum_height > p_ph) + pum_height = p_ph; - if (row >= size + context_lines) + /* Put the pum below "pum_win_row" if possible. If there are few lines decide + * on where there is more room. */ + if (pum_win_row + 2 >= below_row - pum_height + && pum_win_row - above_row > (below_row - above_row) / 2) { - pum_row = row - size - context_lines; - pum_height = size; + /* pum above "pum_win_row" */ + + /* Leave two lines of context if possible */ + if (curwin->w_wrow - curwin->w_cline_row >= 2) + context_lines = 2; + else + context_lines = curwin->w_wrow - curwin->w_cline_row; + + if (pum_win_row >= size + context_lines) + { + pum_row = pum_win_row - size - context_lines; + pum_height = size; + } + else + { + pum_row = 0; + pum_height = pum_win_row - context_lines; + } + if (p_ph > 0 && pum_height > p_ph) + { + pum_row += pum_height - p_ph; + pum_height = p_ph; + } } else { - pum_row = 0; - pum_height = row - context_lines; + /* pum below "pum_win_row" */ + + /* Leave two lines of context if possible */ + if (curwin->w_cline_row + + curwin->w_cline_height - curwin->w_wrow >= 3) + context_lines = 3; + else + context_lines = curwin->w_cline_row + + curwin->w_cline_height - curwin->w_wrow; + + pum_row = pum_win_row + context_lines; + if (size > below_row - pum_row) + pum_height = below_row - pum_row; + else + pum_height = size; + if (p_ph > 0 && pum_height > p_ph) + pum_height = p_ph; } - if (p_ph > 0 && pum_height > p_ph) + + /* don't display when we only have room for one line */ + if (pum_height < 1 || (pum_height == 1 && size > 1)) + return; + +#if defined(FEAT_QUICKFIX) + /* If there is a preview window at the above avoid drawing over it. */ + if (pvwin != NULL && pum_row < above_row && pum_height > above_row) { - pum_row += pum_height - p_ph; - pum_height = p_ph; + pum_row += above_row; + pum_height -= above_row; } - } - else - { - /* pum below "row" */ +#endif - /* Leave two lines of context if possible */ - if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3) - context_lines = 3; - else - context_lines = curwin->w_cline_row - + curwin->w_cline_height - curwin->w_wrow; + pum_array = array; + pum_size = size; + pum_compute_size(); + max_width = pum_base_width; - pum_row = row + context_lines; - if (size > above_row - pum_row) - pum_height = above_row - pum_row; + /* Calculate column */ +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl) + cursor_col = curwin->w_wincol + curwin->w_width + - curwin->w_wcol - 1; else - pum_height = size; - if (p_ph > 0 && pum_height > p_ph) - pum_height = p_ph; - } - - /* don't display when we only have room for one line */ - if (pum_height < 1 || (pum_height == 1 && size > 1)) - return; - - /* If there is a preview window at the top avoid drawing over it. */ - if (firstwin->w_p_pvw - && pum_row < firstwin->w_height - && pum_height > firstwin->w_height + 4) - { - pum_row += firstwin->w_height; - pum_height -= firstwin->w_height; - } +#endif + cursor_col = curwin->w_wincol + curwin->w_wcol; - /* Compute the width of the widest match and the widest extra. */ - for (i = 0; i < size; ++i) - { - w = vim_strsize(array[i].pum_text); - if (max_width < w) - max_width = w; - if (array[i].pum_kind != NULL) + /* if there are more items than room we need a scrollbar */ + if (pum_height < size) { - w = vim_strsize(array[i].pum_kind) + 1; - if (kind_width < w) - kind_width = w; + pum_scrollbar = 1; + ++max_width; } - if (array[i].pum_extra != NULL) - { - w = vim_strsize(array[i].pum_extra) + 1; - if (extra_width < w) - extra_width = w; - } - } - pum_base_width = max_width; - pum_kind_width = kind_width; + else + pum_scrollbar = 0; - /* Calculate column */ + if (def_width < max_width) + def_width = max_width; + + if (((cursor_col < Columns - p_pw + || cursor_col < Columns - max_width) #ifdef FEAT_RIGHTLEFT - if (curwin->w_p_rl) - col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 1; - else + && !curwin->w_p_rl) + || (curwin->w_p_rl + && (cursor_col > p_pw || cursor_col > max_width) #endif - col = W_WINCOL(curwin) + curwin->w_wcol; + )) + { + /* align pum with "cursor_col" */ + pum_col = cursor_col; - /* if there are more items than room we need a scrollbar */ - if (pum_height < size) - { - pum_scrollbar = 1; - ++max_width; - } - else - pum_scrollbar = 0; + /* start with the maximum space available */ +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl) + pum_width = pum_col - pum_scrollbar + 1; + else +#endif + pum_width = Columns - pum_col - pum_scrollbar; - if (def_width < max_width) - def_width = max_width; + if (pum_width > max_width + pum_kind_width + pum_extra_width + 1 + && pum_width > p_pw) + { + /* the width is more than needed for the items, make it + * narrower */ + pum_width = max_width + pum_kind_width + pum_extra_width + 1; + if (pum_width < p_pw) + pum_width = p_pw; + } + else if (((cursor_col > p_pw || cursor_col > max_width) +#ifdef FEAT_RIGHTLEFT + && !curwin->w_p_rl) + || (curwin->w_p_rl && (cursor_col < Columns - p_pw + || cursor_col < Columns - max_width) +#endif + )) + { + /* align pum edge with "cursor_col" */ +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl + && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) + { + pum_col = cursor_col + max_width + pum_scrollbar + 1; + if (pum_col >= Columns) + pum_col = Columns - 1; + } + else if (!curwin->w_p_rl) +#endif + { + if (curwin->w_wincol > Columns - max_width - pum_scrollbar + && max_width <= p_pw) + { + /* use full width to end of the screen */ + pum_col = Columns - max_width - pum_scrollbar; + if (pum_col < 0) + pum_col = 0; + } + } - if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width) #ifdef FEAT_RIGHTLEFT - && !curwin->w_p_rl) - || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width) + if (curwin->w_p_rl) + pum_width = pum_col - pum_scrollbar + 1; + else #endif - )) - { - /* align pum column with "col" */ - pum_col = col; + pum_width = Columns - pum_col - pum_scrollbar; + if (pum_width < p_pw) + { + pum_width = p_pw; #ifdef FEAT_RIGHTLEFT - if (curwin->w_p_rl) - pum_width = pum_col - pum_scrollbar + 1; - else + if (curwin->w_p_rl) + { + if (pum_width > pum_col) + pum_width = pum_col; + } + else #endif - pum_width = Columns - pum_col - pum_scrollbar; + { + if (pum_width >= Columns - pum_col) + pum_width = Columns - pum_col - 1; + } + } + else if (pum_width > max_width + pum_kind_width + + pum_extra_width + 1 + && pum_width > p_pw) + { + pum_width = max_width + pum_kind_width + + pum_extra_width + 1; + if (pum_width < p_pw) + pum_width = p_pw; + } + } - if (pum_width > max_width + kind_width + extra_width + 1 - && pum_width > PUM_DEF_WIDTH) - { - pum_width = max_width + kind_width + extra_width + 1; - if (pum_width < PUM_DEF_WIDTH) - pum_width = PUM_DEF_WIDTH; } - } - else if (Columns < def_width) - { - /* not enough room, will use what we have */ + else if (Columns < def_width) + { + /* not enough room, will use what we have */ #ifdef FEAT_RIGHTLEFT - if (curwin->w_p_rl) - pum_col = Columns - 1; - else + if (curwin->w_p_rl) + pum_col = Columns - 1; + else #endif - pum_col = 0; - pum_width = Columns - 1; - } - else - { - if (max_width > PUM_DEF_WIDTH) - max_width = PUM_DEF_WIDTH; /* truncate */ -#ifdef FEAT_RIGHTLEFT - if (curwin->w_p_rl) - pum_col = max_width - 1; + pum_col = 0; + pum_width = Columns - 1; + } else + { + if (max_width > p_pw) + max_width = p_pw; /* truncate */ +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl) + pum_col = max_width - 1; + else #endif - pum_col = Columns - max_width; - pum_width = max_width - pum_scrollbar; - } - - pum_array = array; - pum_size = size; + pum_col = Columns - max_width; + pum_width = max_width - pum_scrollbar; + } - /* Set selected item and redraw. If the window size changed need to redo - * the positioning. Limit this to two times, when there is not much - * room the window size will keep changing. */ - if (pum_set_selected(selected, redo_count) && ++redo_count <= 2) - goto redo; + /* Set selected item and redraw. If the window size changed need to + * redo the positioning. Limit this to two times, when there is not + * much room the window size will keep changing. */ + } while (pum_set_selected(selected, redo_count) && ++redo_count <= 2); } /* * Redraw the popup menu, using "pum_first" and "pum_selected". */ void -pum_redraw() +pum_redraw(void) { int row = pum_row; int col; @@ -305,7 +400,7 @@ pum_redraw() #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { - if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1) + if (pum_col < curwin->w_wincol + curwin->w_width - 1) screen_putchar(' ', row, pum_col + 1, attr); } else @@ -328,7 +423,7 @@ pum_redraw() case 3: p = pum_array[idx].pum_extra; break; } if (p != NULL) - for ( ; ; mb_ptr_adv(p)) + for ( ; ; MB_PTR_ADV(p)) { if (s == NULL) s = p; @@ -340,9 +435,11 @@ pum_redraw() char_u *st; int saved = *p; - *p = NUL; + if (saved != NUL) + *p = NUL; st = transstr(s); - *p = saved; + if (saved != NUL) + *p = saved; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { @@ -362,7 +459,7 @@ pum_redraw() { size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1; - mb_ptr_adv(rt); + MB_PTR_ADV(rt); } while (size > pum_width); if (size < pum_width) @@ -487,9 +584,7 @@ pum_redraw() * must be recomputed. */ static int -pum_set_selected(n, repeat) - int n; - int repeat; +pum_set_selected(int n, int repeat) { int resized = FALSE; int context = pum_height / 2; @@ -546,7 +641,7 @@ pum_set_selected(n, repeat) } } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* * Show extra info in the preview window if there is something and * 'completeopt' contains "preview". @@ -560,6 +655,7 @@ pum_set_selected(n, repeat) && vim_strchr(p_cot, 'p') != NULL) { win_T *curwin_save = curwin; + tabpage_T *curtab_save = curtab; int res = OK; /* Open a preview window. 3 lines by default. Prefer @@ -568,18 +664,24 @@ pum_set_selected(n, repeat) if (p_pvh > 0 && p_pvh < g_do_tagpreview) g_do_tagpreview = p_pvh; ++RedrawingDisabled; + /* Prevent undo sync here, if an autocommand syncs undo weird + * things can happen to the undo tree. */ + ++no_u_sync; resized = prepare_tagpreview(FALSE); + --no_u_sync; --RedrawingDisabled; g_do_tagpreview = 0; if (curwin->w_p_pvw) { - if (curbuf->b_fname == NULL + if (!resized + && curbuf->b_nwindows == 1 + && curbuf->b_fname == NULL && curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f' && curbuf->b_p_bh[0] == 'w') { /* Already a "wipeout" buffer, make it empty. */ - while (!bufempty()) + while (!BUFEMPTY()) ml_delete((linenr_T)1, FALSE); } else @@ -641,8 +743,13 @@ pum_set_selected(n, repeat) curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; - if (curwin != curwin_save && win_valid(curwin_save)) + if ((curwin != curwin_save && win_valid(curwin_save)) + || (curtab != curtab_save + && valid_tabpage(curtab_save))) { + if (curtab != curtab_save && valid_tabpage(curtab_save)) + goto_tabpage_tp(curtab_save, FALSE, FALSE); + /* When the first completion is done and the preview * window is not resized, skip the preview window's * status line redrawing. */ @@ -659,7 +766,9 @@ pum_set_selected(n, repeat) * redraw. */ if (resized) { + ++no_u_sync; win_enter(curwin_save, TRUE); + --no_u_sync; update_topline(); } @@ -670,7 +779,11 @@ pum_set_selected(n, repeat) pum_do_redraw = FALSE; if (!resized && win_valid(curwin_save)) + { + ++no_u_sync; win_enter(curwin_save, TRUE); + --no_u_sync; + } /* May need to update the screen again when there are * autocommands involved. */ @@ -694,13 +807,11 @@ pum_set_selected(n, repeat) * Undisplay the popup menu (later). */ void -pum_undisplay() +pum_undisplay(void) { pum_array = NULL; - redraw_all_later(SOME_VALID); -#ifdef FEAT_WINDOWS + redraw_all_later(NOT_VALID); redraw_tabline = TRUE; -#endif status_redraw_all(); } @@ -709,7 +820,7 @@ pum_undisplay() * displayed item. */ void -pum_clear() +pum_clear(void) { pum_first = 0; } @@ -719,19 +830,483 @@ pum_clear() * Overruled when "pum_do_redraw" is set, used to redraw the status lines. */ int -pum_visible() +pum_visible(void) { return !pum_do_redraw && pum_array != NULL; } +/* + * Reposition the popup menu to adjust for window layout changes. + */ + void +pum_may_redraw(void) +{ + pumitem_T *array = pum_array; + int len = pum_size; + int selected = pum_selected; + + if (!pum_visible()) + return; // nothing to do + + if (pum_window != curwin + || (pum_win_row == curwin->w_wrow + W_WINROW(curwin) + && pum_win_height == curwin->w_height + && pum_win_col == curwin->w_wincol + && pum_win_width == curwin->w_width)) + { + // window position didn't change, redraw in the same position + pum_redraw(); + } + else + { + int wcol = curwin->w_wcol; + + // Window layout changed, recompute the position. + // Use the remembered w_wcol value, the cursor may have moved when a + // completion was inserted, but we want the menu in the same position. + pum_undisplay(); + curwin->w_wcol = pum_win_wcol; + curwin->w_valid |= VALID_WCOL; + pum_display(array, len, selected); + curwin->w_wcol = wcol; + } +} + /* * Return the height of the popup menu, the number of entries visible. * Only valid when pum_visible() returns TRUE! */ int -pum_get_height() +pum_get_height(void) { return pum_height; } +# if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) + static void +pum_position_at_mouse(int min_width) +{ + if (Rows - mouse_row > pum_size) + { + /* Enough space below the mouse row. */ + pum_row = mouse_row + 1; + if (pum_height > Rows - pum_row) + pum_height = Rows - pum_row; + } + else + { + /* Show above the mouse row, reduce height if it does not fit. */ + pum_row = mouse_row - pum_size; + if (pum_row < 0) + { + pum_height += pum_row; + pum_row = 0; + } + } + if (Columns - mouse_col >= pum_base_width + || Columns - mouse_col > min_width) + /* Enough space to show at mouse column. */ + pum_col = mouse_col; + else + /* Not enough space, right align with window. */ + pum_col = Columns - (pum_base_width > min_width + ? min_width : pum_base_width); + + pum_width = Columns - pum_col; + if (pum_width > pum_base_width + 1) + pum_width = pum_base_width + 1; + + // Do not redraw at cursor position. + pum_window = NULL; +} + +# endif + +# if defined(FEAT_BEVAL_TERM) || defined(PROTO) +static pumitem_T *balloon_array = NULL; +static int balloon_arraysize; +static int balloon_mouse_row = 0; +static int balloon_mouse_col = 0; + +#define BALLOON_MIN_WIDTH 50 +#define BALLOON_MIN_HEIGHT 10 + +typedef struct { + char_u *start; + int bytelen; + int cells; + int indent; +} balpart_T; + +/* + * Split a string into parts to display in the balloon. + * Aimed at output from gdb. Attempts to split at white space, preserve quoted + * strings and make a struct look good. + * Resulting array is stored in "array" and returns the size of the array. + */ + int +split_message(char_u *mesg, pumitem_T **array) +{ + garray_T ga; + char_u *p; + balpart_T *item; + int quoted = FALSE; + int height; + int line; + int item_idx; + int indent = 0; + int max_cells = 0; + int max_height = Rows / 2 - 2; + int long_item_count = 0; + int split_long_items = FALSE; + + ga_init2(&ga, sizeof(balpart_T), 20); + p = mesg; + + while (*p != NUL) + { + if (ga_grow(&ga, 1) == FAIL) + goto failed; + item = ((balpart_T *)ga.ga_data) + ga.ga_len; + item->start = p; + item->indent = indent; + item->cells = indent * 2; + ++ga.ga_len; + while (*p != NUL) + { + if (*p == '"') + quoted = !quoted; + else if (*p == '\\' && p[1] != NUL) + ++p; + else if (!quoted) + { + if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}') + { + /* Looks like a good point to break. */ + if (*p == '{') + ++indent; + else if (*p == '}' && indent > 0) + --indent; + ++item->cells; + p = skipwhite(p + 1); + break; + } + } + item->cells += ptr2cells(p); + p += MB_PTR2LEN(p); + } + item->bytelen = p - item->start; + if (item->cells > max_cells) + max_cells = item->cells; + long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH; + } + + height = 2 + ga.ga_len; + + /* If there are long items and the height is below the limit: split lines */ + if (long_item_count > 0 && height + long_item_count <= max_height) + { + split_long_items = TRUE; + height += long_item_count; + } + + /* Limit to half the window height, it has to fit above or below the mouse + * position. */ + if (height > max_height) + height = max_height; + *array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * height); + if (*array == NULL) + goto failed; + + /* Add an empty line above and below, looks better. */ + (*array)->pum_text = vim_strsave((char_u *)""); + (*array + height - 1)->pum_text = vim_strsave((char_u *)""); + + for (line = 1, item_idx = 0; line < height - 1; ++item_idx) + { + int skip; + int thislen; + int copylen; + int ind; + int cells; + + item = ((balpart_T *)ga.ga_data) + item_idx; + for (skip = 0; skip < item->bytelen; skip += thislen) + { + if (split_long_items && item->cells >= BALLOON_MIN_WIDTH) + { + cells = item->indent * 2; + for (p = item->start + skip; p < item->start + item->bytelen; + p += MB_PTR2LEN(p)) + if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH) + break; + thislen = p - (item->start + skip); + } + else + thislen = item->bytelen; + + /* put indent at the start */ + p = alloc(thislen + item->indent * 2 + 1); + for (ind = 0; ind < item->indent * 2; ++ind) + p[ind] = ' '; + + /* exclude spaces at the end of the string */ + for (copylen = thislen; copylen > 0; --copylen) + if (item->start[skip + copylen - 1] != ' ') + break; + + vim_strncpy(p + ind, item->start + skip, copylen); + (*array)[line].pum_text = p; + item->indent = 0; /* wrapped line has no indent */ + ++line; + } + } + ga_clear(&ga); + return height; + +failed: + ga_clear(&ga); + return 0; +} + + void +ui_remove_balloon(void) +{ + if (balloon_array != NULL) + { + pum_undisplay(); + while (balloon_arraysize > 0) + vim_free(balloon_array[--balloon_arraysize].pum_text); + VIM_CLEAR(balloon_array); + } +} + +/* + * Terminal version of a balloon, uses the popup menu code. + */ + void +ui_post_balloon(char_u *mesg, list_T *list) +{ + ui_remove_balloon(); + + if (mesg == NULL && list == NULL) + return; + if (list != NULL) + { + listitem_T *li; + int idx; + + balloon_arraysize = list->lv_len; + balloon_array = (pumitem_T *)alloc_clear( + (unsigned)sizeof(pumitem_T) * list->lv_len); + if (balloon_array == NULL) + return; + for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx) + { + char_u *text = get_tv_string_chk(&li->li_tv); + + balloon_array[idx].pum_text = vim_strsave( + text == NULL ? (char_u *)"" : text); + } + } + else + balloon_arraysize = split_message(mesg, &balloon_array); + + if (balloon_arraysize > 0) + { + pum_array = balloon_array; + pum_size = balloon_arraysize; + pum_compute_size(); + pum_scrollbar = 0; + pum_height = balloon_arraysize; + + pum_position_at_mouse(BALLOON_MIN_WIDTH); + pum_selected = -1; + pum_first = 0; + pum_redraw(); + } +} + +/* + * Called when the mouse moved, may remove any displayed balloon. + */ + void +ui_may_remove_balloon(void) +{ + if (mouse_row != balloon_mouse_row || mouse_col != balloon_mouse_col) + ui_remove_balloon(); +} +# endif + +# if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) +/* + * Select the pum entry at the mouse position. + */ + static void +pum_select_mouse_pos(void) +{ + int idx = mouse_row - pum_row; + + if (idx < 0 || idx >= pum_size) + pum_selected = -1; + else if (*pum_array[idx].pum_text != NUL) + pum_selected = idx; +} + +/* + * Execute the currently selected popup menu item. + */ + static void +pum_execute_menu(vimmenu_T *menu, int mode) +{ + vimmenu_T *mp; + int idx = 0; + exarg_T ea; + + for (mp = menu->children; mp != NULL; mp = mp->next) + if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected) + { + vim_memset(&ea, 0, sizeof(ea)); + execute_menu(&ea, mp); + break; + } +} + +/* + * Open the terminal version of the popup menu and don't return until it is + * closed. + */ + void +pum_show_popupmenu(vimmenu_T *menu) +{ + vimmenu_T *mp; + int idx = 0; + pumitem_T *array; +#ifdef FEAT_BEVAL_TERM + int save_bevalterm = p_bevalterm; +#endif + int mode; + + pum_undisplay(); + pum_size = 0; + mode = get_menu_mode_flag(); + + for (mp = menu->children; mp != NULL; mp = mp->next) + if (menu_is_separator(mp->dname) + || (mp->modes & mp->enabled & mode)) + ++pum_size; + + array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size); + if (array == NULL) + return; + + for (mp = menu->children; mp != NULL; mp = mp->next) + if (menu_is_separator(mp->dname)) + array[idx++].pum_text = (char_u *)""; + else if (mp->modes & mp->enabled & mode) + array[idx++].pum_text = mp->dname; + + pum_array = array; + pum_compute_size(); + pum_scrollbar = 0; + pum_height = pum_size; + pum_position_at_mouse(20); + + pum_selected = -1; + pum_first = 0; +# ifdef FEAT_BEVAL_TERM + p_bevalterm = TRUE; /* track mouse movement */ + mch_setmouse(TRUE); +# endif + + for (;;) + { + int c; + + pum_redraw(); + setcursor_mayforce(TRUE); + out_flush(); + + c = vgetc(); + if (c == ESC || c == Ctrl_C) + break; + else if (c == CAR || c == NL) + { + /* enter: select current item, if any, and close */ + pum_execute_menu(menu, mode); + break; + } + else if (c == 'k' || c == K_UP || c == K_MOUSEUP) + { + /* cursor up: select previous item */ + while (pum_selected > 0) + { + --pum_selected; + if (*array[pum_selected].pum_text != NUL) + break; + } + } + else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN) + { + /* cursor down: select next item */ + while (pum_selected < pum_size - 1) + { + ++pum_selected; + if (*array[pum_selected].pum_text != NUL) + break; + } + } + else if (c == K_RIGHTMOUSE) + { + /* Right mouse down: reposition the menu. */ + vungetc(c); + break; + } + else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE) + { + /* mouse moved: select item in the mouse row */ + pum_select_mouse_pos(); + } + else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE) + { + /* left mouse click: select clicked item, if any, and close; + * right mouse release: select clicked item, close if any */ + pum_select_mouse_pos(); + if (pum_selected >= 0) + { + pum_execute_menu(menu, mode); + break; + } + if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM) + break; + } + } + + vim_free(array); + pum_undisplay(); +# ifdef FEAT_BEVAL_TERM + p_bevalterm = save_bevalterm; + mch_setmouse(TRUE); +# endif +} + + void +pum_make_popup(char_u *path_name, int use_mouse_pos) +{ + vimmenu_T *menu; + + if (!use_mouse_pos) + { + /* Hack: set mouse position at the cursor so that the menu pops up + * around there. */ + mouse_row = curwin->w_winrow + curwin->w_wrow; + mouse_col = curwin->w_wincol + curwin->w_wcol; + } + + menu = gui_find_menu(path_name); + if (menu != NULL) + pum_show_popupmenu(menu); +} +# endif + #endif diff --git a/src/proto.h b/src/proto.h index 14f5a6b1ec..48b71e6f4e 100644 --- a/src/proto.h +++ b/src/proto.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -35,27 +35,16 @@ # ifdef AMIGA # include "os_amiga.pro" # endif -# if defined(UNIX) || defined(__EMX__) || defined(VMS) +# if defined(UNIX) || defined(VMS) # include "os_unix.pro" # endif -# if defined(MSDOS) || defined(WIN16) -# include "os_msdos.pro" -# endif -# ifdef WIN16 - typedef LPSTR LPWSTR; - typedef LPCSTR LPCWSTR; - typedef int LPBOOL; -# include "os_win16.pro" -# include "os_mswin.pro" -# include "winclip.pro" -# endif # ifdef WIN3264 # include "os_win32.pro" # include "os_mswin.pro" # include "winclip.pro" # if (defined(__GNUC__) && !defined(__MINGW32__)) \ || (defined(__BORLANDC__) && __BORLANDC__ < 0x502) -extern int _stricoll __ARGS((char *a, char *b)); +extern int _stricoll(char *a, char *b); # endif # endif # ifdef VMS @@ -70,16 +59,20 @@ extern int _stricoll __ARGS((char *a, char *b)); # ifdef FEAT_CRYPT # include "blowfish.pro" +# include "crypt.pro" +# include "crypt_zip.pro" # endif # include "buffer.pro" # include "charset.pro" # ifdef FEAT_CSCOPE # include "if_cscope.pro" # endif +# include "dict.pro" # include "diff.pro" # include "digraph.pro" # include "edit.pro" # include "eval.pro" +# include "evalfunc.pro" # include "ex_cmds.pro" # include "ex_cmds2.pro" # include "ex_docmd.pro" @@ -93,6 +86,8 @@ extern int _stricoll __ARGS((char *a, char *b)); # endif # include "hardcopy.pro" # include "hashtab.pro" +# include "json.pro" +# include "list.pro" # include "main.pro" # include "mark.pro" # include "memfile.pro" @@ -100,48 +95,58 @@ extern int _stricoll __ARGS((char *a, char *b)); # ifdef FEAT_MENU # include "menu.pro" # endif +# ifdef FEAT_FKMAP +# include "farsi.pro" +# endif +# ifdef FEAT_ARABIC +# include "arabic.pro" +# endif -# if !defined MESSAGE_FILE || defined(HAVE_STDARG_H) - /* These prototypes cannot be produced automatically and conflict with - * the old-style prototypes in message.c. */ +/* These prototypes cannot be produced automatically. */ int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg __ARGS((char_u *, ...)); +smsg(char_u *, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg_attr __ARGS((int, char_u *, ...)); +smsg_attr(int, char_u *, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf_add __ARGS((char *, size_t, char *, ...)); +vim_snprintf_add(char *, size_t, char *, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 3, 4))) +#endif + ; int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf __ARGS((char *, size_t, char *, ...)); +vim_snprintf(char *, size_t, char *, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 3, 4))) +#endif + ; -# if defined(HAVE_STDARG_H) -int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); -# endif -# endif +int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap); +int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); # include "message.pro" # include "misc1.pro" # include "misc2.pro" #ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */ -char_u *vim_strpbrk __ARGS((char_u *s, char_u *charset)); +char_u *vim_strpbrk(char_u *s, char_u *charset); #endif #ifndef HAVE_QSORT /* Use our own qsort(), don't define the prototype when not used. */ -void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void *, const void *))); +void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void *, const void *)); #endif # include "move.pro" # if defined(FEAT_MBYTE) || defined(FEAT_XIM) || defined(FEAT_KEYMAP) \ @@ -162,19 +167,25 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con # endif # include "search.pro" # include "spell.pro" +# include "spellfile.pro" # include "syntax.pro" # include "tag.pro" # include "term.pro" +# ifdef FEAT_TERMINAL +# include "terminal.pro" +# endif # if defined(HAVE_TGETENT) && (defined(AMIGA) || defined(VMS)) # include "termlib.pro" # endif # include "ui.pro" # include "undo.pro" +# include "userfunc.pro" # include "version.pro" # include "window.pro" # ifdef FEAT_LUA # include "if_lua.pro" +# include "if_lua52.pro" # endif # ifdef FEAT_MZSCHEME @@ -199,28 +210,41 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con /* Ugly solution for "BalloonEval" not being defined while it's used in some * .pro files. */ -# ifndef FEAT_BEVAL +# ifdef FEAT_BEVAL +# include "beval.pro" +# else # define BalloonEval int # endif # ifdef FEAT_NETBEANS_INTG # include "netbeans.pro" # endif +# ifdef FEAT_JOB_CHANNEL +# include "channel.pro" -# ifdef FEAT_GUI -# include "gui.pro" -# if defined(UNIX) || defined(MACOS) +/* Not generated automatically, to add extra attribute. */ +void ch_log(channel_T *ch, const char *fmt, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 2, 3))) +#endif + ; + +# endif + +# if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) +# if defined(UNIX) || defined(MACOS_X) # include "pty.pro" # endif +# endif + +# ifdef FEAT_GUI +# include "gui.pro" # if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) && !defined(VMS) -extern int putenv __ARGS((const char *string)); /* from pty.c */ +extern int putenv(const char *string); /* in misc2.c */ # ifdef USE_VIMPTY_GETENV -extern char_u *vimpty_getenv __ARGS((const char_u *string)); /* from pty.c */ +extern char_u *vimpty_getenv(const char_u *string); /* in misc2.c */ # endif # endif -# ifdef FEAT_GUI_W16 -# include "gui_w16.pro" -# endif # ifdef FEAT_GUI_W32 # include "gui_w32.pro" # endif @@ -235,7 +259,7 @@ extern char_u *vimpty_getenv __ARGS((const char_u *string)); /* from pty.c */ # ifdef FEAT_GUI_ATHENA # include "gui_athena.pro" # ifdef FEAT_BROWSE -extern char *vim_SelFile __ARGS((Widget toplevel, char *prompt, char *init_path, int (*show_entry)(), int x, int y, guicolor_T fg, guicolor_T bg, guicolor_T scroll_fg, guicolor_T scroll_bg)); +extern char *vim_SelFile(Widget toplevel, char *prompt, char *init_path, int (*show_entry)(), int x, int y, guicolor_T fg, guicolor_T bg, guicolor_T scroll_fg, guicolor_T scroll_bg); # endif # endif # ifdef FEAT_GUI_MAC @@ -284,8 +308,15 @@ extern char *vim_SelFile __ARGS((Widget toplevel, char *prompt, char *init_path, #ifdef MACOS_CONVERT # include "os_mac_conv.pro" #endif -#ifdef MACOS_X -# include "os_macosx.pro" +#if defined(MACOS_X_DARWIN) && defined(FEAT_CLIPBOARD) && !defined(FEAT_GUI) +/* functions in os_macosx.m */ +void clip_mch_lose_selection(VimClipboard *cbd); +int clip_mch_own_selection(VimClipboard *cbd); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); +#endif +#if defined(MACOS_X) && defined(FEAT_GUI) +void macosx_fork(); #endif #ifdef __BORLANDC__ diff --git a/src/proto/arabic.pro b/src/proto/arabic.pro new file mode 100644 index 0000000000..a004ef9344 --- /dev/null +++ b/src/proto/arabic.pro @@ -0,0 +1,3 @@ +/* arabic.c */ +int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c); +/* vim: set ft=c : */ diff --git a/src/proto/beval.pro b/src/proto/beval.pro new file mode 100644 index 0000000000..2be64a0da1 --- /dev/null +++ b/src/proto/beval.pro @@ -0,0 +1,6 @@ +/* beval.c */ +int get_beval_info(BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp); +void post_balloon(BalloonEval *beval, char_u *mesg, list_T *list); +int can_use_beval(void); +void general_beval_cb(BalloonEval *beval, int state); +/* vim: set ft=c : */ diff --git a/src/proto/blowfish.pro b/src/proto/blowfish.pro index 4d64e10e80..d959846105 100644 --- a/src/proto/blowfish.pro +++ b/src/proto/blowfish.pro @@ -1,10 +1,6 @@ /* blowfish.c */ -void bf_key_init __ARGS((char_u *password, char_u *salt, int salt_len)); -void bf_cfb_init __ARGS((char_u *iv, int iv_len)); -void bf_crypt_encode __ARGS((char_u *from, size_t len, char_u *to)); -void bf_crypt_decode __ARGS((char_u *ptr, long len)); -void bf_crypt_init_keys __ARGS((char_u *passwd)); -void bf_crypt_save __ARGS((void)); -void bf_crypt_restore __ARGS((void)); -int blowfish_self_test __ARGS((void)); +void crypt_blowfish_encode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +void crypt_blowfish_decode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +void crypt_blowfish_init(cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len); +int blowfish_self_test(void); /* vim: set ft=c : */ diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro index 9e97f67e44..9e63fb6055 100644 --- a/src/proto/buffer.pro +++ b/src/proto/buffer.pro @@ -1,71 +1,86 @@ /* buffer.c */ -int open_buffer __ARGS((int read_stdin, exarg_T *eap, int flags)); -int buf_valid __ARGS((buf_T *buf)); -void close_buffer __ARGS((win_T *win, buf_T *buf, int action, int abort_if_last)); -void buf_clear_file __ARGS((buf_T *buf)); -void buf_freeall __ARGS((buf_T *buf, int flags)); -void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count)); -void handle_swap_exists __ARGS((buf_T *old_curbuf)); -char_u *do_bufdel __ARGS((int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)); -int do_buffer __ARGS((int action, int start, int dir, int count, int forceit)); -void set_curbuf __ARGS((buf_T *buf, int action)); -void enter_buffer __ARGS((buf_T *buf)); -void do_autochdir __ARGS((void)); -buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags)); -void free_buf_options __ARGS((buf_T *buf, int free_p_ff)); -int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit)); -void buflist_getfpos __ARGS((void)); -buf_T *buflist_findname_exp __ARGS((char_u *fname)); -buf_T *buflist_findname __ARGS((char_u *ffname)); -int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode, int curtab_only)); -int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options)); -buf_T *buflist_findnr __ARGS((int nr)); -char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail)); -void get_winopts __ARGS((buf_T *buf)); -pos_T *buflist_findfpos __ARGS((buf_T *buf)); -linenr_T buflist_findlnum __ARGS((buf_T *buf)); -void buflist_list __ARGS((exarg_T *eap)); -int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_T *lnum)); -int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int message)); -void buf_set_name __ARGS((int fnum, char_u *name)); -void buf_name_changed __ARGS((buf_T *buf)); -buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum)); -char_u *getaltfname __ARGS((int errmsg)); -int buflist_add __ARGS((char_u *fname, int flags)); -void buflist_slash_adjust __ARGS((void)); -void buflist_altfpos __ARGS((win_T *win)); -int otherfile __ARGS((char_u *ffname)); -void buf_setino __ARGS((buf_T *buf)); -void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate)); -void col_print __ARGS((char_u *buf, size_t buflen, int col, int vcol)); -void maketitle __ARGS((void)); -void resettitle __ARGS((void)); -void free_titles __ARGS((void)); -int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab)); -void get_rel_pos __ARGS((win_T *wp, char_u *buf, int buflen)); -char_u *fix_fname __ARGS((char_u *fname)); -void fname_expand __ARGS((buf_T *buf, char_u **ffname, char_u **sfname)); -char_u *alist_name __ARGS((aentry_T *aep)); -void do_arg_all __ARGS((int count, int forceit, int keep_tabs)); -void ex_buffer_all __ARGS((exarg_T *eap)); -void do_modelines __ARGS((int flags)); -int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing)); -void write_viminfo_bufferlist __ARGS((FILE *fp)); -char_u *buf_spname __ARGS((buf_T *buf)); -int find_win_for_buf __ARGS((buf_T *buf, win_T **wp, tabpage_T **tp)); -void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr)); -linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr)); -int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type)); -linenr_T buf_delsign __ARGS((buf_T *buf, int id)); -int buf_findsign __ARGS((buf_T *buf, int id)); -int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum)); -int buf_findsigntype_id __ARGS((buf_T *buf, linenr_T lnum, int typenr)); -int buf_signcount __ARGS((buf_T *buf, linenr_T lnum)); -void buf_delete_signs __ARGS((buf_T *buf)); -void buf_delete_all_signs __ARGS((void)); -void sign_list_placed __ARGS((buf_T *rbuf)); -void sign_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after)); -void set_buflisted __ARGS((int on)); -int buf_contents_changed __ARGS((buf_T *buf)); -void wipe_buffer __ARGS((buf_T *buf, int aucmd)); +int open_buffer(int read_stdin, exarg_T *eap, int flags); +void set_bufref(bufref_T *bufref, buf_T *buf); +int bufref_valid(bufref_T *bufref); +int buf_valid(buf_T *buf); +void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last); +void buf_clear_file(buf_T *buf); +void buf_freeall(buf_T *buf, int flags); +void goto_buffer(exarg_T *eap, int start, int dir, int count); +void handle_swap_exists(bufref_T *old_curbuf); +char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit); +int do_buffer(int action, int start, int dir, int count, int forceit); +void set_curbuf(buf_T *buf, int action); +void enter_buffer(buf_T *buf); +void do_autochdir(void); +void no_write_message(void); +void no_write_message_nobang(buf_T *buf); +int curbuf_reusable(void); +buf_T *buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags); +void free_buf_options(buf_T *buf, int free_p_ff); +int buflist_getfile(int n, linenr_T lnum, int options, int forceit); +void buflist_getfpos(void); +buf_T *buflist_findname_exp(char_u *fname); +buf_T *buflist_findname(char_u *ffname); +int buflist_findpat(char_u *pattern, char_u *pattern_end, int unlisted, int diffmode, int curtab_only); +int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options); +buf_T *buflist_findnr(int nr); +char_u *buflist_nr2name(int n, int fullname, int helptail); +void get_winopts(buf_T *buf); +pos_T *buflist_findfpos(buf_T *buf); +linenr_T buflist_findlnum(buf_T *buf); +void buflist_list(exarg_T *eap); +int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum); +int setfname(buf_T *buf, char_u *ffname, char_u *sfname, int message); +void buf_set_name(int fnum, char_u *name); +void buf_name_changed(buf_T *buf); +buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum); +char_u *getaltfname(int errmsg); +int buflist_add(char_u *fname, int flags); +void buflist_slash_adjust(void); +void buflist_altfpos(win_T *win); +int otherfile(char_u *ffname); +void buf_setino(buf_T *buf); +void fileinfo(int fullname, int shorthelp, int dont_truncate); +void col_print(char_u *buf, size_t buflen, int col, int vcol); +void maketitle(void); +void resettitle(void); +void free_titles(void); +int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab); +void get_rel_pos(win_T *wp, char_u *buf, int buflen); +char_u *fix_fname(char_u *fname); +void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname); +char_u *alist_name(aentry_T *aep); +void do_arg_all(int count, int forceit, int keep_tabs); +void ex_buffer_all(exarg_T *eap); +void do_modelines(int flags); +int read_viminfo_bufferlist(vir_T *virp, int writing); +void write_viminfo_bufferlist(FILE *fp); +int bt_quickfix(buf_T *buf); +int bt_terminal(buf_T *buf); +int bt_help(buf_T *buf); +int bt_prompt(buf_T *buf); +int bt_nofile(buf_T *buf); +int bt_dontwrite(buf_T *buf); +int bt_dontwrite_msg(buf_T *buf); +int buf_hide(buf_T *buf); +char_u *buf_spname(buf_T *buf); +void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf); +void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf); +int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp); +void buf_addsign(buf_T *buf, int id, linenr_T lnum, int typenr); +linenr_T buf_change_sign_type(buf_T *buf, int markId, int typenr); +int buf_getsigntype(buf_T *buf, linenr_T lnum, int type); +linenr_T buf_delsign(buf_T *buf, int id); +int buf_findsign(buf_T *buf, int id); +int buf_findsign_id(buf_T *buf, linenr_T lnum); +int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr); +int buf_signcount(buf_T *buf, linenr_T lnum); +void buf_delete_signs(buf_T *buf); +void buf_delete_all_signs(void); +void sign_list_placed(buf_T *rbuf); +void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after); +void set_buflisted(int on); +int buf_contents_changed(buf_T *buf); +void wipe_buffer(buf_T *buf, int aucmd); /* vim: set ft=c : */ diff --git a/src/proto/channel.pro b/src/proto/channel.pro new file mode 100644 index 0000000000..f0be946ad7 --- /dev/null +++ b/src/proto/channel.pro @@ -0,0 +1,78 @@ +/* channel.c */ +void ch_logfile(char_u *fname, char_u *opt); +int ch_log_active(void); +channel_T *add_channel(void); +int has_any_channel(void); +int channel_unref(channel_T *channel); +int free_unused_channels_contents(int copyID, int mask); +void free_unused_channels(int copyID, int mask); +void channel_gui_register_all(void); +channel_T *channel_open(char *hostname, int port_in, int waittime, void (*nb_close_cb)(void)); +channel_T *channel_open_func(typval_T *argvars); +void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err); +void channel_set_job(channel_T *channel, job_T *job, jobopt_T *options); +void channel_set_options(channel_T *channel, jobopt_T *opt); +void channel_set_req_callback(channel_T *channel, ch_part_T part, char_u *callback, partial_T *partial, int id); +void channel_buffer_free(buf_T *buf); +void channel_write_any_lines(void); +void channel_write_new_lines(buf_T *buf); +readq_T *channel_peek(channel_T *channel, ch_part_T part); +char_u *channel_first_nl(readq_T *node); +char_u *channel_get(channel_T *channel, ch_part_T part); +void channel_consume(channel_T *channel, ch_part_T part, int len); +int channel_collapse(channel_T *channel, ch_part_T part, int want_nl); +int channel_can_write_to(channel_T *channel); +int channel_is_open(channel_T *channel); +int channel_has_readahead(channel_T *channel, ch_part_T part); +char *channel_status(channel_T *channel, int req_part); +void channel_info(channel_T *channel, dict_T *dict); +void channel_close(channel_T *channel, int invoke_close_cb); +void channel_close_in(channel_T *channel); +void channel_clear(channel_T *channel); +void channel_free_all(void); +void common_channel_read(typval_T *argvars, typval_T *rettv, int raw); +void channel_may_read(channel_T *channel, ch_part_T part, char *func); +channel_T *channel_fd2channel(sock_T fd, ch_part_T *partp); +void channel_handle_events(int only_keep_open); +int channel_any_keep_open(void); +void channel_set_nonblock(channel_T *channel, ch_part_T part); +int channel_send(channel_T *channel, ch_part_T part, char_u *buf_arg, int len_arg, char *fun); +void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval); +void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval); +int channel_poll_setup(int nfd_in, void *fds_in, int *towait); +int channel_poll_check(int ret_in, void *fds_in); +int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in, struct timeval *tv, struct timeval **tvp); +int channel_select_check(int ret_in, void *rfds_in, void *wfds_in); +int channel_parse_messages(void); +int channel_any_readahead(void); +int set_ref_in_channel(int copyID); +ch_part_T channel_part_send(channel_T *channel); +ch_part_T channel_part_read(channel_T *channel); +ch_mode_T channel_get_mode(channel_T *channel, ch_part_T part); +int channel_get_timeout(channel_T *channel, ch_part_T part); +void clear_job_options(jobopt_T *opt); +void free_job_options(jobopt_T *opt); +int get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2); +channel_T *get_channel_arg(typval_T *tv, int check_open, int reading, ch_part_T part); +void job_free_all(void); +int job_any_running(void); +int win32_build_cmd(list_T *l, garray_T *gap); +void job_cleanup(job_T *job); +int set_ref_in_job(int copyID); +void job_unref(job_T *job); +int free_unused_jobs_contents(int copyID, int mask); +void free_unused_jobs(int copyID, int mask); +job_T *job_alloc(void); +void job_set_options(job_T *job, jobopt_T *opt); +void job_stop_on_exit(void); +int has_pending_job(void); +void job_check_ended(void); +job_T *job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg, int is_terminal); +char *job_status(job_T *job); +void job_info(job_T *job, dict_T *dict); +void job_info_all(list_T *l); +int job_stop(job_T *job, typval_T *argvars, char *type); +void invoke_prompt_callback(void); +int invoke_prompt_interrupt(void); +void job_cleanup_all(void); +/* vim: set ft=c : */ diff --git a/src/proto/charset.pro b/src/proto/charset.pro index fc7769ce36..bb4132fe79 100644 --- a/src/proto/charset.pro +++ b/src/proto/charset.pro @@ -1,59 +1,64 @@ /* charset.c */ -int init_chartab __ARGS((void)); -int buf_init_chartab __ARGS((buf_T *buf, int global)); -void trans_characters __ARGS((char_u *buf, int bufsize)); -char_u *transstr __ARGS((char_u *s)); -char_u *str_foldcase __ARGS((char_u *str, int orglen, char_u *buf, int buflen)); -char_u *transchar __ARGS((int c)); -char_u *transchar_byte __ARGS((int c)); -void transchar_nonprint __ARGS((char_u *buf, int c)); -void transchar_hex __ARGS((char_u *buf, int c)); -int byte2cells __ARGS((int b)); -int char2cells __ARGS((int c)); -int ptr2cells __ARGS((char_u *p)); -int vim_strsize __ARGS((char_u *s)); -int vim_strnsize __ARGS((char_u *s, int len)); -int chartabsize __ARGS((char_u *p, colnr_T col)); -int linetabsize __ARGS((char_u *s)); -int linetabsize_col __ARGS((int startcol, char_u *s)); -int win_linetabsize __ARGS((win_T *wp, char_u *line, colnr_T len)); -int vim_isIDc __ARGS((int c)); -int vim_iswordc __ARGS((int c)); -int vim_iswordc_buf __ARGS((int c, buf_T *buf)); -int vim_iswordp __ARGS((char_u *p)); -int vim_iswordp_buf __ARGS((char_u *p, buf_T *buf)); -int vim_isfilec __ARGS((int c)); -int vim_isfilec_or_wc __ARGS((int c)); -int vim_isprintc __ARGS((int c)); -int vim_isprintc_strict __ARGS((int c)); -int lbr_chartabsize __ARGS((char_u *line, unsigned char *s, colnr_T col)); -int lbr_chartabsize_adv __ARGS((char_u *line, char_u **s, colnr_T col)); -int win_lbr_chartabsize __ARGS((win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp)); -int in_win_border __ARGS((win_T *wp, colnr_T vcol)); -void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end)); -colnr_T getvcol_nolist __ARGS((pos_T *posp)); -void getvvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end)); -void getvcols __ARGS((win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right)); -char_u *skipwhite __ARGS((char_u *q)); -char_u *skipdigits __ARGS((char_u *q)); -char_u *skiphex __ARGS((char_u *q)); -char_u *skiptodigit __ARGS((char_u *q)); -char_u *skiptohex __ARGS((char_u *q)); -int vim_isdigit __ARGS((int c)); -int vim_isxdigit __ARGS((int c)); -int vim_islower __ARGS((int c)); -int vim_isupper __ARGS((int c)); -int vim_toupper __ARGS((int c)); -int vim_tolower __ARGS((int c)); -char_u *skiptowhite __ARGS((char_u *p)); -char_u *skiptowhite_esc __ARGS((char_u *p)); -long getdigits __ARGS((char_u **pp)); -int vim_isblankline __ARGS((char_u *lbuf)); -void vim_str2nr __ARGS((char_u *start, int *hexp, int *len, int dooct, int dohex, long *nptr, unsigned long *unptr)); -int hex2nr __ARGS((int c)); -int hexhex2nr __ARGS((char_u *p)); -int rem_backslash __ARGS((char_u *str)); -void backslash_halve __ARGS((char_u *p)); -char_u *backslash_halve_save __ARGS((char_u *p)); -void ebcdic2ascii __ARGS((char_u *buffer, int len)); +int init_chartab(void); +int buf_init_chartab(buf_T *buf, int global); +void trans_characters(char_u *buf, int bufsize); +char_u *transstr(char_u *s); +char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen); +char_u *transchar(int c); +char_u *transchar_byte(int c); +void transchar_nonprint(char_u *buf, int c); +void transchar_hex(char_u *buf, int c); +int byte2cells(int b); +int char2cells(int c); +int ptr2cells(char_u *p); +int vim_strsize(char_u *s); +int vim_strnsize(char_u *s, int len); +int chartabsize(char_u *p, colnr_T col); +int linetabsize(char_u *s); +int linetabsize_col(int startcol, char_u *s); +int win_linetabsize(win_T *wp, char_u *line, colnr_T len); +int vim_isIDc(int c); +int vim_iswordc(int c); +int vim_iswordc_buf(int c, buf_T *buf); +int vim_iswordp(char_u *p); +int vim_iswordp_buf(char_u *p, buf_T *buf); +int vim_isfilec(int c); +int vim_isfilec_or_wc(int c); +int vim_isprintc(int c); +int vim_isprintc_strict(int c); +int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col); +int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col); +int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp); +int in_win_border(win_T *wp, colnr_T vcol); +void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end); +colnr_T getvcol_nolist(pos_T *posp); +void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end); +void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right); +char_u *skipwhite(char_u *q); +int getwhitecols_curline(void); +int getwhitecols(char_u *p); +char_u *skipdigits(char_u *q); +char_u *skipbin(char_u *q); +char_u *skiphex(char_u *q); +char_u *skiptobin(char_u *q); +char_u *skiptodigit(char_u *q); +char_u *skiptohex(char_u *q); +int vim_isdigit(int c); +int vim_isxdigit(int c); +int vim_isbdigit(int c); +int vim_islower(int c); +int vim_isupper(int c); +int vim_toupper(int c); +int vim_tolower(int c); +char_u *skiptowhite(char_u *p); +char_u *skiptowhite_esc(char_u *p); +long getdigits(char_u **pp); +int vim_isblankline(char_u *lbuf); +void vim_str2nr(char_u *start, int *prep, int *len, int what, varnumber_T *nptr, uvarnumber_T *unptr, int maxlen); +int hex2nr(int c); +int hexhex2nr(char_u *p); +int rem_backslash(char_u *str); +void backslash_halve(char_u *p); +char_u *backslash_halve_save(char_u *p); +void ebcdic2ascii(char_u *buffer, int len); /* vim: set ft=c : */ diff --git a/src/proto/crypt.pro b/src/proto/crypt.pro new file mode 100644 index 0000000000..c944b45cef --- /dev/null +++ b/src/proto/crypt.pro @@ -0,0 +1,26 @@ +/* crypt.c */ +int crypt_method_nr_from_name(char_u *name); +int crypt_method_nr_from_magic(char *ptr, int len); +int crypt_works_inplace(cryptstate_T *state); +int crypt_get_method_nr(buf_T *buf); +int crypt_whole_undofile(int method_nr); +int crypt_get_header_len(int method_nr); +void crypt_set_cm_option(buf_T *buf, int method_nr); +int crypt_self_test(void); +cryptstate_T *crypt_create(int method_nr, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len); +cryptstate_T *crypt_create_from_header(int method_nr, char_u *key, char_u *header); +cryptstate_T *crypt_create_from_file(FILE *fp, char_u *key); +cryptstate_T *crypt_create_for_writing(int method_nr, char_u *key, char_u **header, int *header_len); +void crypt_free_state(cryptstate_T *state); +long crypt_encode_alloc(cryptstate_T *state, char_u *from, size_t len, char_u **newptr); +long crypt_decode_alloc(cryptstate_T *state, char_u *ptr, long len, char_u **newptr); +void crypt_encode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +void crypt_decode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +void crypt_encode_inplace(cryptstate_T *state, char_u *buf, size_t len); +void crypt_decode_inplace(cryptstate_T *state, char_u *buf, size_t len); +void crypt_free_key(char_u *key); +void crypt_check_method(int method); +void crypt_check_current_method(void); +char_u *crypt_get_key(int store, int twice); +void crypt_append_msg(buf_T *buf); +/* vim: set ft=c : */ diff --git a/src/proto/crypt_zip.pro b/src/proto/crypt_zip.pro new file mode 100644 index 0000000000..74784e1a47 --- /dev/null +++ b/src/proto/crypt_zip.pro @@ -0,0 +1,5 @@ +/* crypt_zip.c */ +void crypt_zip_init(cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len); +void crypt_zip_encode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +void crypt_zip_decode(cryptstate_T *state, char_u *from, size_t len, char_u *to); +/* vim: set ft=c : */ diff --git a/src/proto/dict.pro b/src/proto/dict.pro new file mode 100644 index 0000000000..9db43b944b --- /dev/null +++ b/src/proto/dict.pro @@ -0,0 +1,29 @@ +/* dict.c */ +dict_T *dict_alloc(void); +dict_T *dict_alloc_lock(int lock); +int rettv_dict_alloc(typval_T *rettv); +void rettv_dict_set(typval_T *rettv, dict_T *d); +void dict_free_contents(dict_T *d); +void dict_unref(dict_T *d); +int dict_free_nonref(int copyID); +void dict_free_items(int copyID); +dictitem_T *dictitem_alloc(char_u *key); +void dictitem_remove(dict_T *dict, dictitem_T *item); +void dictitem_free(dictitem_T *item); +dict_T *dict_copy(dict_T *orig, int deep, int copyID); +int dict_add(dict_T *d, dictitem_T *item); +int dict_add_nr_str(dict_T *d, char *key, varnumber_T nr, char_u *str); +int dict_add_list(dict_T *d, char *key, list_T *list); +int dict_add_dict(dict_T *d, char *key, dict_T *dict); +long dict_len(dict_T *d); +dictitem_T *dict_find(dict_T *d, char_u *key, int len); +char_u *get_dict_string(dict_T *d, char_u *key, int save); +varnumber_T get_dict_number(dict_T *d, char_u *key); +char_u *dict2string(typval_T *tv, int copyID, int restore_copyID); +int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate); +void dict_extend(dict_T *d1, dict_T *d2, char_u *action); +dictitem_T *dict_lookup(hashitem_T *hi); +int dict_equal(dict_T *d1, dict_T *d2, int ic, int recursive); +void dict_list(typval_T *argvars, typval_T *rettv, int what); +void dict_set_items_ro(dict_T *di); +/* vim: set ft=c : */ diff --git a/src/proto/diff.pro b/src/proto/diff.pro index 18c42651fd..f1afeecec8 100644 --- a/src/proto/diff.pro +++ b/src/proto/diff.pro @@ -1,27 +1,28 @@ /* diff.c */ -void diff_buf_delete __ARGS((buf_T *buf)); -void diff_buf_adjust __ARGS((win_T *win)); -void diff_buf_add __ARGS((buf_T *buf)); -void diff_invalidate __ARGS((buf_T *buf)); -void diff_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after)); -void ex_diffupdate __ARGS((exarg_T *eap)); -void ex_diffpatch __ARGS((exarg_T *eap)); -void ex_diffsplit __ARGS((exarg_T *eap)); -void ex_diffthis __ARGS((exarg_T *eap)); -void diff_win_options __ARGS((win_T *wp, int addbuf)); -void ex_diffoff __ARGS((exarg_T *eap)); -void diff_clear __ARGS((tabpage_T *tp)); -int diff_check __ARGS((win_T *wp, linenr_T lnum)); -int diff_check_fill __ARGS((win_T *wp, linenr_T lnum)); -void diff_set_topline __ARGS((win_T *fromwin, win_T *towin)); -int diffopt_changed __ARGS((void)); -int diffopt_horizontal __ARGS((void)); -int diff_find_change __ARGS((win_T *wp, linenr_T lnum, int *startp, int *endp)); -int diff_infold __ARGS((win_T *wp, linenr_T lnum)); -void nv_diffgetput __ARGS((int put)); -void ex_diffgetput __ARGS((exarg_T *eap)); -int diff_mode_buf __ARGS((buf_T *buf)); -int diff_move_to __ARGS((int dir, long count)); -linenr_T diff_get_corresponding_line __ARGS((buf_T *buf1, linenr_T lnum1, buf_T *buf2, linenr_T lnum3)); -linenr_T diff_lnum_win __ARGS((linenr_T lnum, win_T *wp)); +void diff_buf_delete(buf_T *buf); +void diff_buf_adjust(win_T *win); +void diff_buf_add(buf_T *buf); +void diff_invalidate(buf_T *buf); +void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after); +void ex_diffupdate(exarg_T *eap); +void ex_diffpatch(exarg_T *eap); +void ex_diffsplit(exarg_T *eap); +void ex_diffthis(exarg_T *eap); +void diff_win_options(win_T *wp, int addbuf); +void ex_diffoff(exarg_T *eap); +void diff_clear(tabpage_T *tp); +int diff_check(win_T *wp, linenr_T lnum); +int diff_check_fill(win_T *wp, linenr_T lnum); +void diff_set_topline(win_T *fromwin, win_T *towin); +int diffopt_changed(void); +int diffopt_horizontal(void); +int diffopt_hiddenoff(void); +int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp); +int diff_infold(win_T *wp, linenr_T lnum); +void nv_diffgetput(int put, long count); +void ex_diffgetput(exarg_T *eap); +int diff_mode_buf(buf_T *buf); +int diff_move_to(int dir, long count); +linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1); +linenr_T diff_lnum_win(linenr_T lnum, win_T *wp); /* vim: set ft=c : */ diff --git a/src/proto/digraph.pro b/src/proto/digraph.pro index 5573b8c36d..dfadc9dad0 100644 --- a/src/proto/digraph.pro +++ b/src/proto/digraph.pro @@ -1,9 +1,11 @@ /* digraph.c */ -int do_digraph __ARGS((int c)); -int get_digraph __ARGS((int cmdline)); -int getdigraph __ARGS((int char1, int char2, int meta_char)); -void putdigraph __ARGS((char_u *str)); -void listdigraphs __ARGS((void)); -char_u *keymap_init __ARGS((void)); -void ex_loadkeymap __ARGS((exarg_T *eap)); +int do_digraph(int c); +char_u *get_digraph_for_char(int val); +int get_digraph(int cmdline); +int getdigraph(int char1, int char2, int meta_char); +void putdigraph(char_u *str); +void listdigraphs(void); +char_u *keymap_init(void); +void ex_loadkeymap(exarg_T *eap); +void keymap_clear(garray_T *kmap); /* vim: set ft=c : */ diff --git a/src/proto/edit.pro b/src/proto/edit.pro index 1eed378706..9ba71645b5 100644 --- a/src/proto/edit.pro +++ b/src/proto/edit.pro @@ -1,43 +1,49 @@ /* edit.c */ -int edit __ARGS((int cmdchar, int startln, long count)); -void edit_putchar __ARGS((int c, int highlight)); -void edit_unputchar __ARGS((void)); -void display_dollar __ARGS((colnr_T col)); -void change_indent __ARGS((int type, int amount, int round, int replaced, int call_changed_bytes)); -void truncate_spaces __ARGS((char_u *line)); -void backspace_until_column __ARGS((int col)); -int vim_is_ctrl_x_key __ARGS((int c)); -int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags)); -void set_completion __ARGS((colnr_T startcol, list_T *list)); -void ins_compl_show_pum __ARGS((void)); -char_u *find_word_start __ARGS((char_u *ptr)); -char_u *find_word_end __ARGS((char_u *ptr)); -int ins_compl_active __ARGS((void)); -int ins_compl_add_tv __ARGS((typval_T *tv, int dir)); -void ins_compl_check_keys __ARGS((int frequency)); -int get_literal __ARGS((void)); -void insertchar __ARGS((int c, int flags, int second_indent)); -void auto_format __ARGS((int trailblank, int prev_line)); -int comp_textwidth __ARGS((int ff)); -int stop_arrow __ARGS((void)); -void set_last_insert __ARGS((int c)); -void free_last_insert __ARGS((void)); -char_u *add_char2buf __ARGS((int c, char_u *s)); -void beginline __ARGS((int flags)); -int oneright __ARGS((void)); -int oneleft __ARGS((void)); -int cursor_up __ARGS((long n, int upd_topline)); -int cursor_down __ARGS((long n, int upd_topline)); -int stuff_inserted __ARGS((int c, long count, int no_esc)); -char_u *get_last_insert __ARGS((void)); -char_u *get_last_insert_save __ARGS((void)); -void replace_push __ARGS((int c)); -int replace_push_mb __ARGS((char_u *p)); -void fixthisline __ARGS((int (*get_the_indent)(void))); -void fix_indent __ARGS((void)); -int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty)); -int hkmap __ARGS((int c)); -void ins_scroll __ARGS((void)); -void ins_horscroll __ARGS((void)); -int ins_copychar __ARGS((linenr_T lnum)); +int edit(int cmdchar, int startln, long count); +void edit_putchar(int c, int highlight); +char_u *prompt_text(void); +int prompt_curpos_editable(void); +void edit_unputchar(void); +void display_dollar(colnr_T col); +void change_indent(int type, int amount, int round, int replaced, int call_changed_bytes); +void truncate_spaces(char_u *line); +void backspace_until_column(int col); +int ctrl_x_mode_not_default(void); +int ctrl_x_mode_not_defined_yet(void); +int vim_is_ctrl_x_key(int c); +int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int dir, int flags); +void completeopt_was_set(void); +void set_completion(colnr_T startcol, list_T *list); +void ins_compl_show_pum(void); +char_u *find_word_start(char_u *ptr); +char_u *find_word_end(char_u *ptr); +int ins_compl_active(void); +int ins_compl_add_tv(typval_T *tv, int dir); +void ins_compl_check_keys(int frequency, int in_compl_func); +int get_literal(void); +void insertchar(int c, int flags, int second_indent); +void auto_format(int trailblank, int prev_line); +int comp_textwidth(int ff); +int stop_arrow(void); +void set_last_insert(int c); +void free_last_insert(void); +char_u *add_char2buf(int c, char_u *s); +void beginline(int flags); +int oneright(void); +int oneleft(void); +int cursor_up(long n, int upd_topline); +int cursor_down(long n, int upd_topline); +int stuff_inserted(int c, long count, int no_esc); +char_u *get_last_insert(void); +char_u *get_last_insert_save(void); +void replace_push(int c); +int replace_push_mb(char_u *p); +void fixthisline(int (*get_the_indent)(void)); +void fix_indent(void); +int in_cinkeys(int keytyped, int when, int line_is_empty); +int hkmap(int c); +int bracketed_paste(paste_mode_T mode, int drop, garray_T *gap); +void ins_scroll(void); +void ins_horscroll(void); +int ins_copychar(linenr_T lnum); /* vim: set ft=c : */ diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 517d9e71af..0906a68d3f 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -1,137 +1,142 @@ /* eval.c */ -void eval_init __ARGS((void)); -void eval_clear __ARGS((void)); -char_u *func_name __ARGS((void *cookie)); -linenr_T *func_breakpoint __ARGS((void *cookie)); -int *func_dbg_tick __ARGS((void *cookie)); -int func_level __ARGS((void *cookie)); -int current_func_returned __ARGS((void)); -void set_internal_string_var __ARGS((char_u *name, char_u *value)); -int var_redir_start __ARGS((char_u *name, int append)); -void var_redir_str __ARGS((char_u *value, int value_len)); -void var_redir_stop __ARGS((void)); -int eval_charconvert __ARGS((char_u *enc_from, char_u *enc_to, char_u *fname_from, char_u *fname_to)); -int eval_printexpr __ARGS((char_u *fname, char_u *args)); -void eval_diff __ARGS((char_u *origfile, char_u *newfile, char_u *outfile)); -void eval_patch __ARGS((char_u *origfile, char_u *difffile, char_u *outfile)); -int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip)); -char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip)); -int skip_expr __ARGS((char_u **pp)); -char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert)); -char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox)); -int eval_to_number __ARGS((char_u *expr)); -list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr)); -int get_spellword __ARGS((list_T *list, char_u **pp)); -typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd)); -int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv)); -long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe)); -void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe)); -void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe)); -void *save_funccal __ARGS((void)); -void restore_funccal __ARGS((void *vfc)); -void prof_child_enter __ARGS((proftime_T *tm)); -void prof_child_exit __ARGS((proftime_T *tm)); -int eval_foldexpr __ARGS((char_u *arg, int *cp)); -void ex_let __ARGS((exarg_T *eap)); -void list_add_watch __ARGS((list_T *l, listwatch_T *lw)); -void list_rem_watch __ARGS((list_T *l, listwatch_T *lwrem)); -void *eval_for_line __ARGS((char_u *arg, int *errp, char_u **nextcmdp, int skip)); -int next_for_item __ARGS((void *fi_void, char_u *arg)); -void free_for_info __ARGS((void *fi_void)); -void set_context_for_expression __ARGS((expand_T *xp, char_u *arg, cmdidx_T cmdidx)); -void ex_call __ARGS((exarg_T *eap)); -void ex_unlet __ARGS((exarg_T *eap)); -void ex_lockvar __ARGS((exarg_T *eap)); -int do_unlet __ARGS((char_u *name, int forceit)); -void del_menutrans_vars __ARGS((void)); -char_u *get_user_var_name __ARGS((expand_T *xp, int idx)); -list_T *list_alloc __ARGS((void)); -void list_unref __ARGS((list_T *l)); -void list_free __ARGS((list_T *l, int recurse)); -listitem_T *listitem_alloc __ARGS((void)); -void listitem_free __ARGS((listitem_T *item)); -void listitem_remove __ARGS((list_T *l, listitem_T *item)); -dictitem_T *dict_lookup __ARGS((hashitem_T *hi)); -listitem_T *list_find __ARGS((list_T *l, long n)); -char_u *list_find_str __ARGS((list_T *l, long idx)); -void list_append __ARGS((list_T *l, listitem_T *item)); -int list_append_tv __ARGS((list_T *l, typval_T *tv)); -int list_append_dict __ARGS((list_T *list, dict_T *dict)); -int list_append_string __ARGS((list_T *l, char_u *str, int len)); -int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item)); -void vimlist_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2)); -void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item)); -int garbage_collect __ARGS((void)); -void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID)); -void set_ref_in_list __ARGS((list_T *l, int copyID)); -void set_ref_in_item __ARGS((typval_T *tv, int copyID)); -dict_T *dict_alloc __ARGS((void)); -void dict_unref __ARGS((dict_T *d)); -void dict_free __ARGS((dict_T *d, int recurse)); -dictitem_T *dictitem_alloc __ARGS((char_u *key)); -void dictitem_free __ARGS((dictitem_T *item)); -int dict_add __ARGS((dict_T *d, dictitem_T *item)); -int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str)); -int dict_add_list __ARGS((dict_T *d, char *key, list_T *list)); -dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len)); -char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save)); -long get_dict_number __ARGS((dict_T *d, char_u *key)); -char_u *get_function_name __ARGS((expand_T *xp, int idx)); -char_u *get_expr_name __ARGS((expand_T *xp, int idx)); -int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv)); -void dict_extend __ARGS((dict_T *d1, dict_T *d2, char_u *action)); -void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv)); -float_T vim_round __ARGS((float_T f)); -long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit)); -void set_vim_var_nr __ARGS((int idx, long val)); -long get_vim_var_nr __ARGS((int idx)); -char_u *get_vim_var_str __ARGS((int idx)); -list_T *get_vim_var_list __ARGS((int idx)); -void set_vim_var_char __ARGS((int c)); -void set_vcount __ARGS((long count, long count1, int set_prevcount)); -void set_vim_var_string __ARGS((int idx, char_u *val, int len)); -void set_vim_var_list __ARGS((int idx, list_T *val)); -void set_reg_var __ARGS((int c)); -char_u *v_exception __ARGS((char_u *oldval)); -char_u *v_throwpoint __ARGS((char_u *oldval)); -char_u *set_cmdarg __ARGS((exarg_T *eap, char_u *oldarg)); -void free_tv __ARGS((typval_T *varp)); -void clear_tv __ARGS((typval_T *varp)); -long get_tv_number_chk __ARGS((typval_T *varp, int *denote)); -char_u *get_tv_string_chk __ARGS((typval_T *varp)); -char_u *get_var_value __ARGS((char_u *name)); -void new_script_vars __ARGS((scid_T id)); -void init_var_dict __ARGS((dict_T *dict, dictitem_T *dict_var, int scope)); -void unref_var_dict __ARGS((dict_T *dict)); -void vars_clear __ARGS((hashtab_T *ht)); -void copy_tv __ARGS((typval_T *from, typval_T *to)); -void ex_echo __ARGS((exarg_T *eap)); -void ex_echohl __ARGS((exarg_T *eap)); -void ex_execute __ARGS((exarg_T *eap)); -void ex_function __ARGS((exarg_T *eap)); -void free_all_functions __ARGS((void)); -int translated_function_exists __ARGS((char_u *name)); -char_u *get_expanded_name __ARGS((char_u *name, int check)); -void func_dump_profile __ARGS((FILE *fd)); -char_u *get_user_func_name __ARGS((expand_T *xp, int idx)); -void ex_delfunction __ARGS((exarg_T *eap)); -void func_unref __ARGS((char_u *name)); -void func_ref __ARGS((char_u *name)); -void ex_return __ARGS((exarg_T *eap)); -int do_return __ARGS((exarg_T *eap, int reanimate, int is_cmd, void *rettv)); -void discard_pending_return __ARGS((void *rettv)); -char_u *get_return_cmd __ARGS((void *rettv)); -char_u *get_func_line __ARGS((int c, void *cookie, int indent)); -void func_line_start __ARGS((void *cookie)); -void func_line_exec __ARGS((void *cookie)); -void func_line_end __ARGS((void *cookie)); -int func_has_ended __ARGS((void *cookie)); -int func_has_abort __ARGS((void *cookie)); -int read_viminfo_varlist __ARGS((vir_T *virp, int writing)); -void write_viminfo_varlist __ARGS((FILE *fp)); -int store_session_globals __ARGS((FILE *fd)); -void last_set_msg __ARGS((scid_T scriptID)); -void ex_oldfiles __ARGS((exarg_T *eap)); -int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen)); -char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags)); +void eval_init(void); +void eval_clear(void); +void set_internal_string_var(char_u *name, char_u *value); +int var_redir_start(char_u *name, int append); +void var_redir_str(char_u *value, int value_len); +void var_redir_stop(void); +int eval_charconvert(char_u *enc_from, char_u *enc_to, char_u *fname_from, char_u *fname_to); +int eval_printexpr(char_u *fname, char_u *args); +void eval_diff(char_u *origfile, char_u *newfile, char_u *outfile); +void eval_patch(char_u *origfile, char_u *difffile, char_u *outfile); +int eval_to_bool(char_u *arg, int *error, char_u **nextcmd, int skip); +int eval_expr_to_bool(typval_T *expr, int *error); +char_u *eval_to_string_skip(char_u *arg, char_u **nextcmd, int skip); +int skip_expr(char_u **pp); +char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert); +char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox); +varnumber_T eval_to_number(char_u *expr); +list_T *eval_spell_expr(char_u *badword, char_u *expr); +int get_spellword(list_T *list, char_u **pp); +typval_T *eval_expr(char_u *arg, char_u **nextcmd); +int call_vim_function(char_u *func, int argc, typval_T *argv, typval_T *rettv, int safe); +varnumber_T call_func_retnr(char_u *func, int argc, typval_T *argv, int safe); +void *call_func_retstr(char_u *func, int argc, typval_T *argv, int safe); +void *call_func_retlist(char_u *func, int argc, typval_T *argv, int safe); +int eval_foldexpr(char_u *arg, int *cp); +void ex_let(exarg_T *eap); +void list_hashtable_vars(hashtab_T *ht, char_u *prefix, int empty, int *first); +char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags); +void clear_lval(lval_T *lp); +void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip); +int next_for_item(void *fi_void, char_u *arg); +void free_for_info(void *fi_void); +void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx); +void ex_unlet(exarg_T *eap); +void ex_lockvar(exarg_T *eap); +int do_unlet(char_u *name, int forceit); +void del_menutrans_vars(void); +char_u *get_user_var_name(expand_T *xp, int idx); +int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate); +int eval1(char_u **arg, typval_T *rettv, int evaluate); +int get_option_tv(char_u **arg, typval_T *rettv, int evaluate); +char_u *partial_name(partial_T *pt); +void partial_unref(partial_T *pt); +int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive); +int get_copyID(void); +int garbage_collect(int testing); +int set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack); +int set_ref_in_list(list_T *l, int copyID, ht_stack_T **ht_stack); +int set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack_T **list_stack); +char_u *echo_string_core(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID, int echo_style, int restore_copyID, int composite_val); +char_u *echo_string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID); +char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID); +char_u *string_quote(char_u *str, int function); +int string2float(char_u *text, float_T *value); +pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum); +int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp); +int get_id_len(char_u **arg); +int get_name_len(char_u **arg, char_u **alias, int evaluate, int verbose); +char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end, int flags); +int eval_isnamec(int c); +int eval_isnamec1(int c); +void set_vim_var_nr(int idx, varnumber_T val); +varnumber_T get_vim_var_nr(int idx); +char_u *get_vim_var_str(int idx); +list_T *get_vim_var_list(int idx); +dict_T *get_vim_var_dict(int idx); +void set_vim_var_char(int c); +void set_vcount(long count, long count1, int set_prevcount); +void save_vimvars(vimvars_save_T *vvsave); +void restore_vimvars(vimvars_save_T *vvsave); +void set_vim_var_string(int idx, char_u *val, int len); +void set_vim_var_list(int idx, list_T *val); +void set_vim_var_dict(int idx, dict_T *val); +void set_reg_var(int c); +char_u *v_exception(char_u *oldval); +char_u *v_throwpoint(char_u *oldval); +char_u *set_cmdarg(exarg_T *eap, char_u *oldarg); +int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload); +int handle_subscript(char_u **arg, typval_T *rettv, int evaluate, int verbose); +typval_T *alloc_tv(void); +void free_tv(typval_T *varp); +void clear_tv(typval_T *varp); +void init_tv(typval_T *varp); +varnumber_T get_tv_number(typval_T *varp); +varnumber_T get_tv_number_chk(typval_T *varp, int *denote); +float_T get_tv_float(typval_T *varp); +char_u *get_tv_string(typval_T *varp); +char_u *get_tv_string_buf(typval_T *varp, char_u *buf); +char_u *get_tv_string_chk(typval_T *varp); +char_u *get_tv_string_buf_chk(typval_T *varp, char_u *buf); +dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload); +dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload); +hashtab_T *find_var_ht(char_u *name, char_u **varname); +char_u *get_var_value(char_u *name); +void new_script_vars(scid_T id); +void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope); +void unref_var_dict(dict_T *dict); +void vars_clear(hashtab_T *ht); +void vars_clear_ext(hashtab_T *ht, int free_val); +void set_var(char_u *name, typval_T *tv, int copy); +int var_check_ro(int flags, char_u *name, int use_gettext); +int var_check_fixed(int flags, char_u *name, int use_gettext); +int var_check_func_name(char_u *name, int new_var); +int valid_varname(char_u *varname); +int tv_check_lock(int lock, char_u *name, int use_gettext); +void copy_tv(typval_T *from, typval_T *to); +int item_copy(typval_T *from, typval_T *to, int deep, int copyID); +void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog, int secret); +void ex_echo(exarg_T *eap); +void ex_echohl(exarg_T *eap); +void ex_execute(exarg_T *eap); +win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp); +win_T *find_tabwin(typval_T *wvp, typval_T *tvp); +void getwinvar(typval_T *argvars, typval_T *rettv, int off); +void setwinvar(typval_T *argvars, typval_T *rettv, int off); +char_u *autoload_name(char_u *name); +int script_autoload(char_u *name, int reload); +int read_viminfo_varlist(vir_T *virp, int writing); +void write_viminfo_varlist(FILE *fp); +int store_session_globals(FILE *fd); +void last_set_msg(scid_T scriptID); +void reset_v_option_vars(void); +void prepare_assert_error(garray_T *gap); +void assert_error(garray_T *gap); +int assert_equal_common(typval_T *argvars, assert_type_T atype); +int assert_equalfile(typval_T *argvars); +int assert_match_common(typval_T *argvars, assert_type_T atype); +int assert_inrange(typval_T *argvars); +int assert_bool(typval_T *argvars, int isTrue); +int assert_report(typval_T *argvars); +int assert_exception(typval_T *argvars); +int assert_beeps(typval_T *argvars); +int assert_fails(typval_T *argvars); +void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, assert_type_T atype); +int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int type_is, int ic); +char_u *typval_tostring(typval_T *arg); +int var_exists(char_u *var); +int modify_fname(char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen); +char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags); +void filter_map(typval_T *argvars, typval_T *rettv, int map); /* vim: set ft=c : */ diff --git a/src/proto/evalfunc.pro b/src/proto/evalfunc.pro new file mode 100644 index 0000000000..c79b59c0d9 --- /dev/null +++ b/src/proto/evalfunc.pro @@ -0,0 +1,14 @@ +/* evalfunc.c */ +char_u *get_function_name(expand_T *xp, int idx); +char_u *get_expr_name(expand_T *xp, int idx); +int find_internal_func(char_u *name); +int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T *rettv); +buf_T *buflist_find_by_name(char_u *name, int curtab_only); +buf_T *get_buf_tv(typval_T *tv, int curtab_only); +void execute_redir_str(char_u *value, int value_len); +void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv); +float_T vim_round(float_T f); +long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, typval_T *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit); +char_u *get_callback(typval_T *arg, partial_T **pp); +void free_callback(char_u *callback, partial_T *partial); +/* vim: set ft=c : */ diff --git a/src/proto/ex_cmds.pro b/src/proto/ex_cmds.pro index a94f5d0486..63f25b50f4 100644 --- a/src/proto/ex_cmds.pro +++ b/src/proto/ex_cmds.pro @@ -1,64 +1,70 @@ /* ex_cmds.c */ -void do_ascii __ARGS((exarg_T *eap)); -void ex_align __ARGS((exarg_T *eap)); -void ex_sort __ARGS((exarg_T *eap)); -void ex_retab __ARGS((exarg_T *eap)); -int do_move __ARGS((linenr_T line1, linenr_T line2, linenr_T dest)); -void ex_copy __ARGS((linenr_T line1, linenr_T line2, linenr_T n)); -void free_prev_shellcmd __ARGS((void)); -void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)); -void do_shell __ARGS((char_u *cmd, int flags)); -char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp)); -void append_redir __ARGS((char_u *buf, int buflen, char_u *opt, char_u *fname)); -int viminfo_error __ARGS((char *errnum, char *message, char_u *line)); -int read_viminfo __ARGS((char_u *file, int flags)); -void write_viminfo __ARGS((char_u *file, int forceit)); -int viminfo_readline __ARGS((vir_T *virp)); -char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert)); -void viminfo_writestring __ARGS((FILE *fd, char_u *p)); -void do_fixdel __ARGS((exarg_T *eap)); -void print_line_no_prefix __ARGS((linenr_T lnum, int use_number, int list)); -void print_line __ARGS((linenr_T lnum, int use_number, int list)); -int rename_buffer __ARGS((char_u *new_fname)); -void ex_file __ARGS((exarg_T *eap)); -void ex_update __ARGS((exarg_T *eap)); -void ex_write __ARGS((exarg_T *eap)); -int do_write __ARGS((exarg_T *eap)); -int check_overwrite __ARGS((exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other)); -void ex_wnext __ARGS((exarg_T *eap)); -void do_wqall __ARGS((exarg_T *eap)); -int not_writing __ARGS((void)); -int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit)); -int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, win_T *oldwin)); -void ex_append __ARGS((exarg_T *eap)); -void ex_change __ARGS((exarg_T *eap)); -void ex_z __ARGS((exarg_T *eap)); -int check_restricted __ARGS((void)); -int check_secure __ARGS((void)); -void do_sub __ARGS((exarg_T *eap)); -int do_sub_msg __ARGS((int count_only)); -void ex_global __ARGS((exarg_T *eap)); -void global_exe __ARGS((char_u *cmd)); -int read_viminfo_sub_string __ARGS((vir_T *virp, int force)); -void write_viminfo_sub_string __ARGS((FILE *fp)); -void free_old_sub __ARGS((void)); -int prepare_tagpreview __ARGS((int undo_sync)); -void ex_help __ARGS((exarg_T *eap)); -char_u *check_help_lang __ARGS((char_u *arg)); -int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case)); -int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang)); -void fix_help_buffer __ARGS((void)); -void ex_exusage __ARGS((exarg_T *eap)); -void ex_viusage __ARGS((exarg_T *eap)); -void ex_helptags __ARGS((exarg_T *eap)); -void ex_sign __ARGS((exarg_T *eap)); -void sign_gui_started __ARGS((void)); -int sign_get_attr __ARGS((int typenr, int line)); -char_u *sign_get_text __ARGS((int typenr)); -void *sign_get_image __ARGS((int typenr)); -char_u *sign_typenr2name __ARGS((int typenr)); -void free_signs __ARGS((void)); -char_u *get_sign_name __ARGS((expand_T *xp, int idx)); -void set_context_in_sign_cmd __ARGS((expand_T *xp, char_u *arg)); -void ex_drop __ARGS((exarg_T *eap)); +void do_ascii(exarg_T *eap); +void ex_align(exarg_T *eap); +void ex_sort(exarg_T *eap); +void ex_retab(exarg_T *eap); +int do_move(linenr_T line1, linenr_T line2, linenr_T dest); +void ex_copy(linenr_T line1, linenr_T line2, linenr_T n); +void free_prev_shellcmd(void); +void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out); +void do_shell(char_u *cmd, int flags); +char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp); +void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname); +int viminfo_error(char *errnum, char *message, char_u *line); +int read_viminfo(char_u *file, int flags); +void write_viminfo(char_u *file, int forceit); +int viminfo_readline(vir_T *virp); +char_u *viminfo_readstring(vir_T *virp, int off, int convert); +void viminfo_writestring(FILE *fd, char_u *p); +int barline_writestring(FILE *fd, char_u *s, int remaining_start); +time_T vim_time(void); +void do_fixdel(exarg_T *eap); +void print_line_no_prefix(linenr_T lnum, int use_number, int list); +void print_line(linenr_T lnum, int use_number, int list); +int rename_buffer(char_u *new_fname); +void ex_file(exarg_T *eap); +void ex_update(exarg_T *eap); +void ex_write(exarg_T *eap); +int do_write(exarg_T *eap); +int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int other); +void ex_wnext(exarg_T *eap); +void do_wqall(exarg_T *eap); +int not_writing(void); +int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit); +int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, win_T *oldwin); +void ex_append(exarg_T *eap); +void ex_change(exarg_T *eap); +void ex_z(exarg_T *eap); +int check_restricted(void); +int check_secure(void); +void do_sub(exarg_T *eap); +int do_sub_msg(int count_only); +void ex_global(exarg_T *eap); +void global_exe(char_u *cmd); +int read_viminfo_sub_string(vir_T *virp, int force); +void write_viminfo_sub_string(FILE *fp); +void free_old_sub(void); +int prepare_tagpreview(int undo_sync); +void ex_help(exarg_T *eap); +void ex_helpclose(exarg_T *eap); +char_u *check_help_lang(char_u *arg); +int help_heuristic(char_u *matched_string, int offset, int wrong_case); +int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_lang); +void fix_help_buffer(void); +void ex_exusage(exarg_T *eap); +void ex_viusage(exarg_T *eap); +void ex_helptags(exarg_T *eap); +void ex_sign(exarg_T *eap); +void sign_gui_started(void); +int sign_get_attr(int typenr, int line); +char_u *sign_get_text(int typenr); +void *sign_get_image(int typenr); +char_u *sign_typenr2name(int typenr); +void free_signs(void); +char_u *get_sign_name(expand_T *xp, int idx); +void set_context_in_sign_cmd(expand_T *xp, char_u *arg); +void ex_smile(exarg_T *eap); +void ex_drop(exarg_T *eap); +char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags); +void ex_oldfiles(exarg_T *eap); /* vim: set ft=c : */ diff --git a/src/proto/ex_cmds2.pro b/src/proto/ex_cmds2.pro index 0ac3e14924..ac9b291e5c 100644 --- a/src/proto/ex_cmds2.pro +++ b/src/proto/ex_cmds2.pro @@ -1,90 +1,112 @@ /* ex_cmds2.c */ -void do_debug __ARGS((char_u *cmd)); -void ex_debug __ARGS((exarg_T *eap)); -void dbg_check_breakpoint __ARGS((exarg_T *eap)); -int dbg_check_skipped __ARGS((exarg_T *eap)); -void ex_breakadd __ARGS((exarg_T *eap)); -void ex_debuggreedy __ARGS((exarg_T *eap)); -void ex_breakdel __ARGS((exarg_T *eap)); -void ex_breaklist __ARGS((exarg_T *eap)); -linenr_T dbg_find_breakpoint __ARGS((int file, char_u *fname, linenr_T after)); -int has_profiling __ARGS((int file, char_u *fname, int *fp)); -void dbg_breakpoint __ARGS((char_u *name, linenr_T lnum)); -void profile_start __ARGS((proftime_T *tm)); -void profile_end __ARGS((proftime_T *tm)); -void profile_sub __ARGS((proftime_T *tm, proftime_T *tm2)); -char *profile_msg __ARGS((proftime_T *tm)); -void profile_setlimit __ARGS((long msec, proftime_T *tm)); -int profile_passed_limit __ARGS((proftime_T *tm)); -void profile_zero __ARGS((proftime_T *tm)); -void profile_divide __ARGS((proftime_T *tm, int count, proftime_T *tm2)); -void profile_add __ARGS((proftime_T *tm, proftime_T *tm2)); -void profile_self __ARGS((proftime_T *self, proftime_T *total, proftime_T *children)); -void profile_get_wait __ARGS((proftime_T *tm)); -void profile_sub_wait __ARGS((proftime_T *tm, proftime_T *tma)); -int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2)); -int profile_cmp __ARGS((const proftime_T *tm1, const proftime_T *tm2)); -void ex_profile __ARGS((exarg_T *eap)); -char_u *get_profile_name __ARGS((expand_T *xp, int idx)); -void set_context_in_profile_cmd __ARGS((expand_T *xp, char_u *arg)); -void profile_dump __ARGS((void)); -void script_prof_save __ARGS((proftime_T *tm)); -void script_prof_restore __ARGS((proftime_T *tm)); -void prof_inchar_enter __ARGS((void)); -void prof_inchar_exit __ARGS((void)); -int prof_def_func __ARGS((void)); -int autowrite __ARGS((buf_T *buf, int forceit)); -void autowrite_all __ARGS((void)); -int check_changed __ARGS((buf_T *buf, int flags)); -void browse_save_fname __ARGS((buf_T *buf)); -void dialog_changed __ARGS((buf_T *buf, int checkall)); -int can_abandon __ARGS((buf_T *buf, int forceit)); -int check_changed_any __ARGS((int hidden)); -int check_fname __ARGS((void)); -int buf_write_all __ARGS((buf_T *buf, int forceit)); -int get_arglist __ARGS((garray_T *gap, char_u *str)); -int get_arglist_exp __ARGS((char_u *str, int *fcountp, char_u ***fnamesp, int wig)); -void set_arglist __ARGS((char_u *str)); -void check_arg_idx __ARGS((win_T *win)); -void ex_args __ARGS((exarg_T *eap)); -void ex_previous __ARGS((exarg_T *eap)); -void ex_rewind __ARGS((exarg_T *eap)); -void ex_last __ARGS((exarg_T *eap)); -void ex_argument __ARGS((exarg_T *eap)); -void do_argfile __ARGS((exarg_T *eap, int argn)); -void ex_next __ARGS((exarg_T *eap)); -void ex_argedit __ARGS((exarg_T *eap)); -void ex_argadd __ARGS((exarg_T *eap)); -void ex_argdelete __ARGS((exarg_T *eap)); -void ex_listdo __ARGS((exarg_T *eap)); -void ex_compiler __ARGS((exarg_T *eap)); -void ex_runtime __ARGS((exarg_T *eap)); -int source_runtime __ARGS((char_u *name, int all)); -int do_in_runtimepath __ARGS((char_u *name, int all, void (*callback)(char_u *fname, void *ck), void *cookie)); -void ex_options __ARGS((exarg_T *eap)); -void ex_source __ARGS((exarg_T *eap)); -linenr_T *source_breakpoint __ARGS((void *cookie)); -int *source_dbg_tick __ARGS((void *cookie)); -int source_level __ARGS((void *cookie)); -int do_source __ARGS((char_u *fname, int check_other, int is_vimrc)); -void ex_scriptnames __ARGS((exarg_T *eap)); -void scriptnames_slash_adjust __ARGS((void)); -char_u *get_scriptname __ARGS((scid_T id)); -void free_scriptnames __ARGS((void)); -char *fgets_cr __ARGS((char *s, int n, FILE *stream)); -char_u *getsourceline __ARGS((int c, void *cookie, int indent)); -void script_line_start __ARGS((void)); -void script_line_exec __ARGS((void)); -void script_line_end __ARGS((void)); -void ex_scriptencoding __ARGS((exarg_T *eap)); -void ex_finish __ARGS((exarg_T *eap)); -void do_finish __ARGS((exarg_T *eap, int reanimate)); -int source_finished __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie)); -void ex_checktime __ARGS((exarg_T *eap)); -char_u *get_mess_lang __ARGS((void)); -void set_lang_var __ARGS((void)); -void ex_language __ARGS((exarg_T *eap)); -void free_locales __ARGS((void)); -char_u *get_lang_arg __ARGS((expand_T *xp, int idx)); -char_u *get_locales __ARGS((expand_T *xp, int idx)); +int has_watchexpr(void); +void do_debug(char_u *cmd); +void ex_debug(exarg_T *eap); +void dbg_check_breakpoint(exarg_T *eap); +int dbg_check_skipped(exarg_T *eap); +void ex_breakadd(exarg_T *eap); +void ex_debuggreedy(exarg_T *eap); +void ex_breakdel(exarg_T *eap); +void ex_breaklist(exarg_T *eap); +linenr_T dbg_find_breakpoint(int file, char_u *fname, linenr_T after); +int has_profiling(int file, char_u *fname, int *fp); +void dbg_breakpoint(char_u *name, linenr_T lnum); +void profile_start(proftime_T *tm); +void profile_end(proftime_T *tm); +void profile_sub(proftime_T *tm, proftime_T *tm2); +char *profile_msg(proftime_T *tm); +float_T profile_float(proftime_T *tm); +void profile_setlimit(long msec, proftime_T *tm); +int profile_passed_limit(proftime_T *tm); +void profile_zero(proftime_T *tm); +long proftime_time_left(proftime_T *due, proftime_T *now); +timer_T *create_timer(long msec, int repeat); +long check_due_timer(void); +timer_T *find_timer(long id); +void stop_timer(timer_T *timer); +void stop_all_timers(void); +void add_timer_info(typval_T *rettv, timer_T *timer); +void add_timer_info_all(typval_T *rettv); +int set_ref_in_timer(int copyID); +void timer_free_all(void); +void profile_divide(proftime_T *tm, int count, proftime_T *tm2); +void profile_add(proftime_T *tm, proftime_T *tm2); +void profile_self(proftime_T *self, proftime_T *total, proftime_T *children); +void profile_get_wait(proftime_T *tm); +void profile_sub_wait(proftime_T *tm, proftime_T *tma); +int profile_equal(proftime_T *tm1, proftime_T *tm2); +int profile_cmp(const proftime_T *tm1, const proftime_T *tm2); +void ex_profile(exarg_T *eap); +char_u *get_profile_name(expand_T *xp, int idx); +void set_context_in_profile_cmd(expand_T *xp, char_u *arg); +void profile_dump(void); +void script_prof_save(proftime_T *tm); +void script_prof_restore(proftime_T *tm); +void prof_inchar_enter(void); +void prof_inchar_exit(void); +int prof_def_func(void); +int autowrite(buf_T *buf, int forceit); +void autowrite_all(void); +int check_changed(buf_T *buf, int flags); +void browse_save_fname(buf_T *buf); +void dialog_changed(buf_T *buf, int checkall); +int can_abandon(buf_T *buf, int forceit); +int check_changed_any(int hidden, int unload); +int check_fname(void); +int buf_write_all(buf_T *buf, int forceit); +int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, int wig); +void set_arglist(char_u *str); +void check_arg_idx(win_T *win); +void ex_args(exarg_T *eap); +void ex_previous(exarg_T *eap); +void ex_rewind(exarg_T *eap); +void ex_last(exarg_T *eap); +void ex_argument(exarg_T *eap); +void do_argfile(exarg_T *eap, int argn); +void ex_next(exarg_T *eap); +void ex_argedit(exarg_T *eap); +void ex_argadd(exarg_T *eap); +void ex_argdelete(exarg_T *eap); +void ex_listdo(exarg_T *eap); +char_u *get_arglist_name(expand_T *xp, int idx); +void ex_compiler(exarg_T *eap); +void ex_runtime(exarg_T *eap); +int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); +int do_in_runtimepath(char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); +int source_runtime(char_u *name, int flags); +int source_in_path(char_u *path, char_u *name, int flags); +void add_pack_start_dirs(void); +void load_start_packages(void); +void ex_packloadall(exarg_T *eap); +void ex_packadd(exarg_T *eap); +void ex_options(exarg_T *eap); +void init_pyxversion(void); +void ex_pyxfile(exarg_T *eap); +void ex_pyx(exarg_T *eap); +void ex_pyxdo(exarg_T *eap); +void ex_source(exarg_T *eap); +linenr_T *source_breakpoint(void *cookie); +int *source_dbg_tick(void *cookie); +int source_level(void *cookie); +int do_source(char_u *fname, int check_other, int is_vimrc); +void ex_scriptnames(exarg_T *eap); +void scriptnames_slash_adjust(void); +char_u *get_scriptname(scid_T id); +void free_scriptnames(void); +char *fgets_cr(char *s, int n, FILE *stream); +char_u *getsourceline(int c, void *cookie, int indent); +void script_line_start(void); +void script_line_exec(void); +void script_line_end(void); +void ex_scriptencoding(exarg_T *eap); +void ex_finish(exarg_T *eap); +void do_finish(exarg_T *eap, int reanimate); +int source_finished(char_u *(*fgetline)(int, void *, int), void *cookie); +void ex_checktime(exarg_T *eap); +char_u *get_mess_lang(void); +void set_lang_var(void); +void ex_language(exarg_T *eap); +void free_locales(void); +char_u *get_lang_arg(expand_T *xp, int idx); +char_u *get_locales(expand_T *xp, int idx); /* vim: set ft=c : */ diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro index ebc54c9deb..3a0a9c6b9b 100644 --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -1,58 +1,72 @@ /* ex_docmd.c */ -void do_exmode __ARGS((int improved)); -int do_cmdline_cmd __ARGS((char_u *cmd)); -int do_cmdline __ARGS((char_u *cmdline, char_u *(*fgetline)(int, void *, int), void *cookie, int flags)); -int getline_equal __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int))); -void *getline_cookie __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie)); -int checkforcmd __ARGS((char_u **pp, char *cmd, int len)); -int modifier_len __ARGS((char_u *cmd)); -int cmd_exists __ARGS((char_u *name)); -char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff)); -char_u *skip_range __ARGS((char_u *cmd, int *ctx)); -void ex_ni __ARGS((exarg_T *eap)); -int expand_filename __ARGS((exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)); -void separate_nextcmd __ARGS((exarg_T *eap)); -int ends_excmd __ARGS((int c)); -char_u *find_nextcmd __ARGS((char_u *p)); -char_u *check_nextcmd __ARGS((char_u *p)); -char_u *get_command_name __ARGS((expand_T *xp, int idx)); -void ex_comclear __ARGS((exarg_T *eap)); -void uc_clear __ARGS((garray_T *gap)); -char_u *get_user_commands __ARGS((expand_T *xp, int idx)); -char_u *get_user_cmd_flags __ARGS((expand_T *xp, int idx)); -char_u *get_user_cmd_nargs __ARGS((expand_T *xp, int idx)); -char_u *get_user_cmd_complete __ARGS((expand_T *xp, int idx)); -int parse_compl_arg __ARGS((char_u *value, int vallen, int *complp, long *argt, char_u **compl_arg)); -void not_exiting __ARGS((void)); -void tabpage_close __ARGS((int forceit)); -void tabpage_close_other __ARGS((tabpage_T *tp, int forceit)); -void ex_all __ARGS((exarg_T *eap)); -void handle_drop __ARGS((int filec, char_u **filev, int split)); -void alist_clear __ARGS((alist_T *al)); -void alist_init __ARGS((alist_T *al)); -void alist_unlink __ARGS((alist_T *al)); -void alist_new __ARGS((void)); -void alist_expand __ARGS((int *fnum_list, int fnum_len)); -void alist_set __ARGS((alist_T *al, int count, char_u **files, int use_curbuf, int *fnum_list, int fnum_len)); -void alist_add __ARGS((alist_T *al, char_u *fname, int set_fnum)); -void alist_slash_adjust __ARGS((void)); -void ex_splitview __ARGS((exarg_T *eap)); -void tabpage_new __ARGS((void)); -void do_exedit __ARGS((exarg_T *eap, win_T *old_curwin)); -void free_cd_dir __ARGS((void)); -void post_chdir __ARGS((int local)); -void ex_cd __ARGS((exarg_T *eap)); -void do_sleep __ARGS((long msec)); -int vim_mkdir_emsg __ARGS((char_u *name, int prot)); -FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode)); -void update_topline_cursor __ARGS((void)); -void exec_normal_cmd __ARGS((char_u *cmd, int remap, int silent)); -int find_cmdline_var __ARGS((char_u *src, int *usedlen)); -char_u *eval_vars __ARGS((char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char_u **errormsg, int *escaped)); -char_u *expand_sfile __ARGS((char_u *arg)); -int put_eol __ARGS((FILE *fd)); -int put_line __ARGS((FILE *fd, char *s)); -void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname)); -char_u *get_behave_arg __ARGS((expand_T *xp, int idx)); -void ex_may_print __ARGS((exarg_T *eap)); +void do_exmode(int improved); +int do_cmdline_cmd(char_u *cmd); +int do_cmdline(char_u *cmdline, char_u *(*fgetline)(int, void *, int), void *cookie, int flags); +int getline_equal(char_u *(*fgetline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)); +void *getline_cookie(char_u *(*fgetline)(int, void *, int), void *cookie); +int checkforcmd(char_u **pp, char *cmd, int len); +int modifier_len(char_u *cmd); +int cmd_exists(char_u *name); +char_u *set_one_cmd_context(expand_T *xp, char_u *buff); +char_u *skip_range(char_u *cmd, int *ctx); +void ex_ni(exarg_T *eap); +int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp); +void separate_nextcmd(exarg_T *eap); +int get_bad_opt(char_u *p, exarg_T *eap); +int ends_excmd(int c); +char_u *find_nextcmd(char_u *p); +char_u *check_nextcmd(char_u *p); +char_u *get_command_name(expand_T *xp, int idx); +void ex_comclear(exarg_T *eap); +void uc_clear(garray_T *gap); +char_u *get_user_commands(expand_T *xp, int idx); +char_u *get_user_cmd_addr_type(expand_T *xp, int idx); +char_u *get_user_cmd_flags(expand_T *xp, int idx); +char_u *get_user_cmd_nargs(expand_T *xp, int idx); +char_u *get_user_cmd_complete(expand_T *xp, int idx); +int parse_addr_type_arg(char_u *value, int vallen, long *argt, int *addr_type_arg); +int parse_compl_arg(char_u *value, int vallen, int *complp, long *argt, char_u **compl_arg); +int cmdcomplete_str_to_type(char_u *complete_str); +void not_exiting(void); +void tabpage_close(int forceit); +void tabpage_close_other(tabpage_T *tp, int forceit); +void ex_all(exarg_T *eap); +void handle_drop(int filec, char_u **filev, int split); +void alist_clear(alist_T *al); +void alist_init(alist_T *al); +void alist_unlink(alist_T *al); +void alist_new(void); +void alist_expand(int *fnum_list, int fnum_len); +void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum_list, int fnum_len); +void alist_add(alist_T *al, char_u *fname, int set_fnum); +void alist_slash_adjust(void); +void ex_splitview(exarg_T *eap); +void tabpage_new(void); +void do_exedit(exarg_T *eap, win_T *old_curwin); +void free_cd_dir(void); +void post_chdir(int local); +void ex_cd(exarg_T *eap); +void do_sleep(long msec); +void ex_may_print(exarg_T *eap); +void ex_redraw(exarg_T *eap); +int vim_mkdir_emsg(char_u *name, int prot); +FILE *open_exfile(char_u *fname, int forceit, char *mode); +void update_topline_cursor(void); +int save_current_state(save_state_T *sst); +void restore_current_state(save_state_T *sst); +void ex_normal(exarg_T *eap); +void exec_normal_cmd(char_u *cmd, int remap, int silent); +void exec_normal(int was_typed, int may_use_terminal_loop); +int find_cmdline_var(char_u *src, int *usedlen); +char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char_u **errormsg, int *escaped); +char_u *expand_sfile(char_u *arg); +int put_eol(FILE *fd); +int put_line(FILE *fd, char *s); +void dialog_msg(char_u *buff, char *format, char_u *fname); +char_u *get_behave_arg(expand_T *xp, int idx); +char_u *get_messages_arg(expand_T *xp, int idx); +char_u *get_mapclear_arg(expand_T *xp, int idx); +void set_no_hlsearch(int flag); +int get_pressedreturn(void); +void set_pressedreturn(int val); /* vim: set ft=c : */ diff --git a/src/proto/ex_eval.pro b/src/proto/ex_eval.pro index 6c63f67240..9274bce59c 100644 --- a/src/proto/ex_eval.pro +++ b/src/proto/ex_eval.pro @@ -1,34 +1,34 @@ /* ex_eval.c */ -int aborting __ARGS((void)); -void update_force_abort __ARGS((void)); -int should_abort __ARGS((int retcode)); -int aborted_in_try __ARGS((void)); -int cause_errthrow __ARGS((char_u *mesg, int severe, int *ignore)); -void free_global_msglist __ARGS((void)); -void do_errthrow __ARGS((struct condstack *cstack, char_u *cmdname)); -int do_intthrow __ARGS((struct condstack *cstack)); -char_u *get_exception_string __ARGS((void *value, int type, char_u *cmdname, int *should_free)); -void discard_current_exception __ARGS((void)); -void report_make_pending __ARGS((int pending, void *value)); -void report_resume_pending __ARGS((int pending, void *value)); -void report_discard_pending __ARGS((int pending, void *value)); -void ex_if __ARGS((exarg_T *eap)); -void ex_endif __ARGS((exarg_T *eap)); -void ex_else __ARGS((exarg_T *eap)); -void ex_while __ARGS((exarg_T *eap)); -void ex_continue __ARGS((exarg_T *eap)); -void ex_break __ARGS((exarg_T *eap)); -void ex_endwhile __ARGS((exarg_T *eap)); -void ex_throw __ARGS((exarg_T *eap)); -void do_throw __ARGS((struct condstack *cstack)); -void ex_try __ARGS((exarg_T *eap)); -void ex_catch __ARGS((exarg_T *eap)); -void ex_finally __ARGS((exarg_T *eap)); -void ex_endtry __ARGS((exarg_T *eap)); -void enter_cleanup __ARGS((cleanup_T *csp)); -void leave_cleanup __ARGS((cleanup_T *csp)); -int cleanup_conditionals __ARGS((struct condstack *cstack, int searched_cond, int inclusive)); -void rewind_conditionals __ARGS((struct condstack *cstack, int idx, int cond_type, int *cond_level)); -void ex_endfunction __ARGS((exarg_T *eap)); -int has_loop_cmd __ARGS((char_u *p)); +int aborting(void); +void update_force_abort(void); +int should_abort(int retcode); +int aborted_in_try(void); +int cause_errthrow(char_u *mesg, int severe, int *ignore); +void free_global_msglist(void); +void do_errthrow(struct condstack *cstack, char_u *cmdname); +int do_intthrow(struct condstack *cstack); +char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free); +void discard_current_exception(void); +void report_make_pending(int pending, void *value); +void report_resume_pending(int pending, void *value); +void report_discard_pending(int pending, void *value); +void ex_if(exarg_T *eap); +void ex_endif(exarg_T *eap); +void ex_else(exarg_T *eap); +void ex_while(exarg_T *eap); +void ex_continue(exarg_T *eap); +void ex_break(exarg_T *eap); +void ex_endwhile(exarg_T *eap); +void ex_throw(exarg_T *eap); +void do_throw(struct condstack *cstack); +void ex_try(exarg_T *eap); +void ex_catch(exarg_T *eap); +void ex_finally(exarg_T *eap); +void ex_endtry(exarg_T *eap); +void enter_cleanup(cleanup_T *csp); +void leave_cleanup(cleanup_T *csp); +int cleanup_conditionals(struct condstack *cstack, int searched_cond, int inclusive); +void rewind_conditionals(struct condstack *cstack, int idx, int cond_type, int *cond_level); +void ex_endfunction(exarg_T *eap); +int has_loop_cmd(char_u *p); /* vim: set ft=c : */ diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro index 86e01b58c6..6f82904235 100644 --- a/src/proto/ex_getln.pro +++ b/src/proto/ex_getln.pro @@ -1,58 +1,61 @@ /* ex_getln.c */ -char_u *getcmdline __ARGS((int firstc, long count, int indent)); -char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg)); -int text_locked __ARGS((void)); -void text_locked_msg __ARGS((void)); -int curbuf_locked __ARGS((void)); -int allbuf_locked __ARGS((void)); -char_u *getexline __ARGS((int c, void *cookie, int indent)); -char_u *getexmodeline __ARGS((int promptc, void *cookie, int indent)); -int cmdline_overstrike __ARGS((void)); -int cmdline_at_end __ARGS((void)); -colnr_T cmdline_getvcol_cursor __ARGS((void)); -void free_cmdline_buf __ARGS((void)); -void putcmdline __ARGS((int c, int shift)); -void unputcmdline __ARGS((void)); -int put_on_cmdline __ARGS((char_u *str, int len, int redraw)); -char_u *save_cmdline_alloc __ARGS((void)); -void restore_cmdline_alloc __ARGS((char_u *p)); -void cmdline_paste_str __ARGS((char_u *s, int literally)); -void redrawcmdline __ARGS((void)); -void redrawcmd __ARGS((void)); -void compute_cmdrow __ARGS((void)); -void gotocmdline __ARGS((int clr)); -char_u *ExpandOne __ARGS((expand_T *xp, char_u *str, char_u *orig, int options, int mode)); -void ExpandInit __ARGS((expand_T *xp)); -void ExpandCleanup __ARGS((expand_T *xp)); -void ExpandEscape __ARGS((expand_T *xp, char_u *str, int numfiles, char_u **files, int options)); -char_u *vim_strsave_fnameescape __ARGS((char_u *fname, int shell)); -void tilde_replace __ARGS((char_u *orig_pat, int num_files, char_u **files)); -char_u *sm_gettail __ARGS((char_u *s)); -char_u *addstar __ARGS((char_u *fname, int len, int context)); -void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col)); -int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); -int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)), int escaped)); -void globpath __ARGS((char_u *path, char_u *file, garray_T *ga, int expand_options)); -void init_history __ARGS((void)); -int get_histtype __ARGS((char_u *name)); -void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep)); -int get_history_idx __ARGS((int histype)); -char_u *get_cmdline_str __ARGS((void)); -int get_cmdline_pos __ARGS((void)); -int set_cmdline_pos __ARGS((int pos)); -int get_cmdline_type __ARGS((void)); -char_u *get_history_entry __ARGS((int histype, int idx)); -int clr_history __ARGS((int histype)); -int del_history_entry __ARGS((int histype, char_u *str)); -int del_history_idx __ARGS((int histype, int idx)); -void remove_key_from_history __ARGS((void)); -int get_list_range __ARGS((char_u **str, int *num1, int *num2)); -void ex_history __ARGS((exarg_T *eap)); -void prepare_viminfo_history __ARGS((int asklen, int writing)); -int read_viminfo_history __ARGS((vir_T *virp, int writing)); -void finish_viminfo_history __ARGS((void)); -void write_viminfo_history __ARGS((FILE *fp, int merge)); -void cmd_pchar __ARGS((int c, int offset)); -int cmd_gchar __ARGS((int offset)); -char_u *script_get __ARGS((exarg_T *eap, char_u *cmd)); +char_u *getcmdline(int firstc, long count, int indent); +char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg); +int text_locked(void); +void text_locked_msg(void); +char_u *get_text_locked_msg(void); +int curbuf_locked(void); +int allbuf_locked(void); +char_u *getexline(int c, void *cookie, int indent); +char_u *getexmodeline(int promptc, void *cookie, int indent); +int cmdline_overstrike(void); +int cmdline_at_end(void); +colnr_T cmdline_getvcol_cursor(void); +void free_cmdline_buf(void); +void putcmdline(int c, int shift); +void unputcmdline(void); +int put_on_cmdline(char_u *str, int len, int redraw); +char_u *save_cmdline_alloc(void); +void restore_cmdline_alloc(char_u *p); +void cmdline_paste_str(char_u *s, int literally); +void redrawcmdline(void); +void redrawcmdline_ex(int do_compute_cmdrow); +void redrawcmd(void); +void compute_cmdrow(void); +void gotocmdline(int clr); +char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode); +void ExpandInit(expand_T *xp); +void ExpandCleanup(expand_T *xp); +void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int options); +char_u *vim_strsave_fnameescape(char_u *fname, int shell); +void tilde_replace(char_u *orig_pat, int num_files, char_u **files); +char_u *sm_gettail(char_u *s); +char_u *addstar(char_u *fname, int len, int context); +void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline); +int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches); +int ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)), int escaped); +void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options); +void init_history(void); +int get_histtype(char_u *name); +void add_to_history(int histype, char_u *new_entry, int in_map, int sep); +int get_history_idx(int histype); +char_u *get_history_entry(int histype, int idx); +int clr_history(int histype); +int del_history_entry(int histype, char_u *str); +int del_history_idx(int histype, int idx); +void remove_key_from_history(void); +char_u *get_cmdline_str(void); +int get_cmdline_pos(void); +int set_cmdline_pos(int pos); +int get_cmdline_type(void); +int get_list_range(char_u **str, int *num1, int *num2); +void ex_history(exarg_T *eap); +void prepare_viminfo_history(int asklen, int writing); +int read_viminfo_history(vir_T *virp, int writing); +void handle_viminfo_history(garray_T *values, int writing); +void finish_viminfo_history(vir_T *virp); +void write_viminfo_history(FILE *fp, int merge); +void cmd_pchar(int c, int offset); +int cmd_gchar(int offset); +char_u *script_get(exarg_T *eap, char_u *cmd); /* vim: set ft=c : */ diff --git a/src/proto/farsi.pro b/src/proto/farsi.pro new file mode 100644 index 0000000000..b6e1836511 --- /dev/null +++ b/src/proto/farsi.pro @@ -0,0 +1,12 @@ +/* farsi.c */ +int fkmap(int c); +char_u *lrswap(char_u *ibuf); +char_u *lrFswap(char_u *cmdbuf, int len); +char_u *lrF_sub(char_u *ibuf); +int cmdl_fkmap(int c); +int F_isalpha(int c); +int F_isdigit(int c); +int F_ischar(int c); +void farsi_f8(cmdarg_T *cap); +void farsi_f9(cmdarg_T *cap); +/* vim: set ft=c : */ diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index 7aa99cfa8a..990348143b 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -1,67 +1,71 @@ /* fileio.c */ -void filemess __ARGS((buf_T *buf, char_u *name, char_u *s, int attr)); -int readfile __ARGS((char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, int flags)); -int prep_exarg __ARGS((exarg_T *eap, buf_T *buf)); -void set_file_options __ARGS((int set_options, exarg_T *eap)); -void set_forced_fenc __ARGS((exarg_T *eap)); -int prepare_crypt_read __ARGS((FILE *fp)); -char_u *prepare_crypt_write __ARGS((buf_T *buf, int *lenp)); -int check_file_readonly __ARGS((char_u *fname, int perm)); -int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering)); -void msg_add_fname __ARGS((buf_T *buf, char_u *fname)); -void msg_add_lines __ARGS((int insert_space, long lnum, off_t nchars)); -char_u *shorten_fname1 __ARGS((char_u *full_path)); -char_u *shorten_fname __ARGS((char_u *full_path, char_u *dir_name)); -void shorten_fnames __ARGS((int force)); -void shorten_filenames __ARGS((char_u **fnames, int count)); -char_u *modname __ARGS((char_u *fname, char_u *ext, int prepend_dot)); -char_u *buf_modname __ARGS((int shortname, char_u *fname, char_u *ext, int prepend_dot)); -int vim_fgets __ARGS((char_u *buf, int size, FILE *fp)); -int tag_fgets __ARGS((char_u *buf, int size, FILE *fp)); -int vim_rename __ARGS((char_u *from, char_u *to)); -int check_timestamps __ARGS((int focus)); -int buf_check_timestamp __ARGS((buf_T *buf, int focus)); -void buf_reload __ARGS((buf_T *buf, int orig_mode)); -void buf_store_time __ARGS((buf_T *buf, struct stat *st, char_u *fname)); -void write_lnum_adjust __ARGS((linenr_T offset)); -void vim_deltempdir __ARGS((void)); -char_u *vim_tempname __ARGS((int extra_char)); -void forward_slash __ARGS((char_u *fname)); -void aubuflocal_remove __ARGS((buf_T *buf)); -int au_has_group __ARGS((char_u *name)); -void do_augroup __ARGS((char_u *arg, int del_group)); -void free_all_autocmds __ARGS((void)); -int check_ei __ARGS((void)); -char_u *au_event_disable __ARGS((char *what)); -void au_event_restore __ARGS((char_u *old_ei)); -void do_autocmd __ARGS((char_u *arg, int forceit)); -int do_doautocmd __ARGS((char_u *arg, int do_msg)); -void ex_doautoall __ARGS((exarg_T *eap)); -int check_nomodeline __ARGS((char_u **argp)); -void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf)); -void aucmd_restbuf __ARGS((aco_save_T *aco)); -int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf)); -int apply_autocmds_retval __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, int *retval)); -int has_cursorhold __ARGS((void)); -int trigger_cursorhold __ARGS((void)); -int has_cursormoved __ARGS((void)); -int has_cursormovedI __ARGS((void)); -int has_textchanged __ARGS((void)); -int has_textchangedI __ARGS((void)); -int has_insertcharpre __ARGS((void)); -void block_autocmds __ARGS((void)); -void unblock_autocmds __ARGS((void)); -int is_autocmd_blocked __ARGS((void)); -char_u *getnextac __ARGS((int c, void *cookie, int indent)); -int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf)); -char_u *get_augroup_name __ARGS((expand_T *xp, int idx)); -char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd)); -char_u *get_event_name __ARGS((expand_T *xp, int idx)); -int autocmd_supported __ARGS((char_u *name)); -int au_exists __ARGS((char_u *arg)); -int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs)); -int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname)); -char_u *file_pat_to_reg_pat __ARGS((char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash)); -long read_eintr __ARGS((int fd, void *buf, size_t bufsize)); -long write_eintr __ARGS((int fd, void *buf, size_t bufsize)); +void filemess(buf_T *buf, char_u *name, char_u *s, int attr); +int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, int flags); +int is_dev_fd_file(char_u *fname); +int prep_exarg(exarg_T *eap, buf_T *buf); +void set_file_options(int set_options, exarg_T *eap); +void set_forced_fenc(exarg_T *eap); +int check_file_readonly(char_u *fname, int perm); +int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering); +void msg_add_fname(buf_T *buf, char_u *fname); +void msg_add_lines(int insert_space, long lnum, off_T nchars); +char_u *shorten_fname1(char_u *full_path); +char_u *shorten_fname(char_u *full_path, char_u *dir_name); +void shorten_buf_fname(buf_T *buf, char_u *dirname, int force); +void shorten_fnames(int force); +void shorten_filenames(char_u **fnames, int count); +char_u *modname(char_u *fname, char_u *ext, int prepend_dot); +char_u *buf_modname(int shortname, char_u *fname, char_u *ext, int prepend_dot); +int vim_fgets(char_u *buf, int size, FILE *fp); +int tag_fgets(char_u *buf, int size, FILE *fp); +int vim_rename(char_u *from, char_u *to); +int check_timestamps(int focus); +int buf_check_timestamp(buf_T *buf, int focus); +void buf_reload(buf_T *buf, int orig_mode); +void buf_store_time(buf_T *buf, stat_T *st, char_u *fname); +void write_lnum_adjust(linenr_T offset); +int delete_recursive(char_u *name); +void vim_deltempdir(void); +char_u *vim_tempname(int extra_char, int keep); +void forward_slash(char_u *fname); +void aubuflocal_remove(buf_T *buf); +int au_has_group(char_u *name); +void do_augroup(char_u *arg, int del_group); +void free_all_autocmds(void); +int check_ei(void); +char_u *au_event_disable(char *what); +void au_event_restore(char_u *old_ei); +void do_autocmd(char_u *arg_in, int forceit); +int do_doautocmd(char_u *arg, int do_msg, int *did_something); +void ex_doautoall(exarg_T *eap); +int check_nomodeline(char_u **argp); +void aucmd_prepbuf(aco_save_T *aco, buf_T *buf); +void aucmd_restbuf(aco_save_T *aco); +int apply_autocmds(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf); +int apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, int *retval); +int has_cursorhold(void); +int trigger_cursorhold(void); +int has_cursormoved(void); +int has_cursormovedI(void); +int has_textchanged(void); +int has_textchangedI(void); +int has_textchangedP(void); +int has_insertcharpre(void); +int has_cmdundefined(void); +int has_funcundefined(void); +int has_textyankpost(void); +void block_autocmds(void); +void unblock_autocmds(void); +int is_autocmd_blocked(void); +char_u *getnextac(int c, void *cookie, int indent); +int has_autocmd(event_T event, char_u *sfname, buf_T *buf); +char_u *get_augroup_name(expand_T *xp, int idx); +char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd); +char_u *get_event_name(expand_T *xp, int idx); +int autocmd_supported(char_u *name); +int au_exists(char_u *arg); +int match_file_list(char_u *list, char_u *sfname, char_u *ffname); +char_u *file_pat_to_reg_pat(char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash); +long read_eintr(int fd, void *buf, size_t bufsize); +long write_eintr(int fd, void *buf, size_t bufsize); /* vim: set ft=c : */ diff --git a/src/proto/fold.pro b/src/proto/fold.pro index 10f72012a2..d8e349420d 100644 --- a/src/proto/fold.pro +++ b/src/proto/fold.pro @@ -1,41 +1,42 @@ /* fold.c */ -void copyFoldingState __ARGS((win_T *wp_from, win_T *wp_to)); -int hasAnyFolding __ARGS((win_T *win)); -int hasFolding __ARGS((linenr_T lnum, linenr_T *firstp, linenr_T *lastp)); -int hasFoldingWin __ARGS((win_T *win, linenr_T lnum, linenr_T *firstp, linenr_T *lastp, int cache, foldinfo_T *infop)); -int foldLevel __ARGS((linenr_T lnum)); -int lineFolded __ARGS((win_T *win, linenr_T lnum)); -long foldedCount __ARGS((win_T *win, linenr_T lnum, foldinfo_T *infop)); -int foldmethodIsManual __ARGS((win_T *wp)); -int foldmethodIsIndent __ARGS((win_T *wp)); -int foldmethodIsExpr __ARGS((win_T *wp)); -int foldmethodIsMarker __ARGS((win_T *wp)); -int foldmethodIsSyntax __ARGS((win_T *wp)); -int foldmethodIsDiff __ARGS((win_T *wp)); -void closeFold __ARGS((linenr_T lnum, long count)); -void closeFoldRecurse __ARGS((linenr_T lnum)); -void opFoldRange __ARGS((linenr_T first, linenr_T last, int opening, int recurse, int had_visual)); -void openFold __ARGS((linenr_T lnum, long count)); -void openFoldRecurse __ARGS((linenr_T lnum)); -void foldOpenCursor __ARGS((void)); -void newFoldLevel __ARGS((void)); -void foldCheckClose __ARGS((void)); -int foldManualAllowed __ARGS((int create)); -void foldCreate __ARGS((linenr_T start, linenr_T end)); -void deleteFold __ARGS((linenr_T start, linenr_T end, int recursive, int had_visual)); -void clearFolding __ARGS((win_T *win)); -void foldUpdate __ARGS((win_T *wp, linenr_T top, linenr_T bot)); -void foldUpdateAll __ARGS((win_T *win)); -int foldMoveTo __ARGS((int updown, int dir, long count)); -void foldInitWin __ARGS((win_T *new_win)); -int find_wl_entry __ARGS((win_T *win, linenr_T lnum)); -void foldAdjustVisual __ARGS((void)); -void foldAdjustCursor __ARGS((void)); -void cloneFoldGrowArray __ARGS((garray_T *from, garray_T *to)); -void deleteFoldRecurse __ARGS((garray_T *gap)); -void foldMarkAdjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)); -int getDeepestNesting __ARGS((void)); -char_u *get_foldtext __ARGS((win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldinfo, char_u *buf)); -void foldtext_cleanup __ARGS((char_u *str)); -int put_folds __ARGS((FILE *fd, win_T *wp)); +void copyFoldingState(win_T *wp_from, win_T *wp_to); +int hasAnyFolding(win_T *win); +int hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp); +int hasFoldingWin(win_T *win, linenr_T lnum, linenr_T *firstp, linenr_T *lastp, int cache, foldinfo_T *infop); +int foldLevel(linenr_T lnum); +int lineFolded(win_T *win, linenr_T lnum); +long foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop); +int foldmethodIsManual(win_T *wp); +int foldmethodIsIndent(win_T *wp); +int foldmethodIsExpr(win_T *wp); +int foldmethodIsMarker(win_T *wp); +int foldmethodIsSyntax(win_T *wp); +int foldmethodIsDiff(win_T *wp); +void closeFold(linenr_T lnum, long count); +void closeFoldRecurse(linenr_T lnum); +void opFoldRange(linenr_T first, linenr_T last, int opening, int recurse, int had_visual); +void openFold(linenr_T lnum, long count); +void openFoldRecurse(linenr_T lnum); +void foldOpenCursor(void); +void newFoldLevel(void); +void foldCheckClose(void); +int foldManualAllowed(int create); +void foldCreate(linenr_T start, linenr_T end); +void deleteFold(linenr_T start, linenr_T end, int recursive, int had_visual); +void clearFolding(win_T *win); +void foldUpdate(win_T *wp, linenr_T top, linenr_T bot); +void foldUpdateAll(win_T *win); +int foldMoveTo(int updown, int dir, long count); +void foldInitWin(win_T *new_win); +int find_wl_entry(win_T *win, linenr_T lnum); +void foldAdjustVisual(void); +void foldAdjustCursor(void); +void cloneFoldGrowArray(garray_T *from, garray_T *to); +void deleteFoldRecurse(garray_T *gap); +void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after); +int getDeepestNesting(void); +char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldinfo, char_u *buf); +void foldtext_cleanup(char_u *str); +void foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest); +int put_folds(FILE *fd, win_T *wp); /* vim: set ft=c : */ diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro index 897cad37fc..aac522f152 100644 --- a/src/proto/getchar.pro +++ b/src/proto/getchar.pro @@ -1,70 +1,70 @@ /* getchar.c */ -void free_buff __ARGS((buffheader_T *buf)); -char_u *get_recorded __ARGS((void)); -char_u *get_inserted __ARGS((void)); -int stuff_empty __ARGS((void)); -int readbuf1_empty __ARGS((void)); -void typeahead_noflush __ARGS((int c)); -void flush_buffers __ARGS((int flush_typeahead)); -void ResetRedobuff __ARGS((void)); -void CancelRedo __ARGS((void)); -void saveRedobuff __ARGS((void)); -void restoreRedobuff __ARGS((void)); -void AppendToRedobuff __ARGS((char_u *s)); -void AppendToRedobuffLit __ARGS((char_u *str, int len)); -void AppendCharToRedobuff __ARGS((int c)); -void AppendNumberToRedobuff __ARGS((long n)); -void stuffReadbuff __ARGS((char_u *s)); -void stuffReadbuffLen __ARGS((char_u *s, long len)); -void stuffReadbuffSpec __ARGS((char_u *s)); -void stuffcharReadbuff __ARGS((int c)); -void stuffnumReadbuff __ARGS((long n)); -int start_redo __ARGS((long count, int old_redo)); -int start_redo_ins __ARGS((void)); -void stop_redo_ins __ARGS((void)); -int ins_typebuf __ARGS((char_u *str, int noremap, int offset, int nottyped, int silent)); -void ins_char_typebuf __ARGS((int c)); -int typebuf_changed __ARGS((int tb_change_cnt)); -int typebuf_typed __ARGS((void)); -int typebuf_maplen __ARGS((void)); -void del_typebuf __ARGS((int len, int offset)); -int alloc_typebuf __ARGS((void)); -void free_typebuf __ARGS((void)); -int save_typebuf __ARGS((void)); -void save_typeahead __ARGS((tasave_T *tp)); -void restore_typeahead __ARGS((tasave_T *tp)); -void openscript __ARGS((char_u *name, int directly)); -void close_all_scripts __ARGS((void)); -int using_script __ARGS((void)); -void before_blocking __ARGS((void)); -void updatescript __ARGS((int c)); -int vgetc __ARGS((void)); -int safe_vgetc __ARGS((void)); -int plain_vgetc __ARGS((void)); -int vpeekc __ARGS((void)); -int vpeekc_nomap __ARGS((void)); -int vpeekc_any __ARGS((void)); -int char_avail __ARGS((void)); -void vungetc __ARGS((int c)); -int inchar __ARGS((char_u *buf, int maxlen, long wait_time, int tb_change_cnt)); -int fix_input_buffer __ARGS((char_u *buf, int len, int script)); -int input_available __ARGS((void)); -int do_map __ARGS((int maptype, char_u *arg, int mode, int abbrev)); -int get_map_mode __ARGS((char_u **cmdp, int forceit)); -void map_clear __ARGS((char_u *cmdp, char_u *arg, int forceit, int abbr)); -void map_clear_int __ARGS((buf_T *buf, int mode, int local, int abbr)); -char_u *map_mode_to_chars __ARGS((int mode)); -int map_to_exists __ARGS((char_u *str, char_u *modechars, int abbr)); -int map_to_exists_mode __ARGS((char_u *rhs, int mode, int abbr)); -char_u *set_context_in_map_cmd __ARGS((expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx)); -int ExpandMappings __ARGS((regmatch_T *regmatch, int *num_file, char_u ***file)); -int check_abbr __ARGS((int c, char_u *ptr, int col, int mincol)); -char_u *vim_strsave_escape_csi __ARGS((char_u *p)); -void vim_unescape_csi __ARGS((char_u *p)); -int makemap __ARGS((FILE *fd, buf_T *buf)); -int put_escstr __ARGS((FILE *fd, char_u *strstart, int what)); -void check_map_keycodes __ARGS((void)); -char_u *check_map __ARGS((char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr)); -void init_mappings __ARGS((void)); -void add_map __ARGS((char_u *map, int mode)); +void free_buff(buffheader_T *buf); +char_u *get_recorded(void); +char_u *get_inserted(void); +int stuff_empty(void); +int readbuf1_empty(void); +void typeahead_noflush(int c); +void flush_buffers(int flush_typeahead); +void ResetRedobuff(void); +void CancelRedo(void); +void saveRedobuff(save_redo_T *save_redo); +void restoreRedobuff(save_redo_T *save_redo); +void AppendToRedobuff(char_u *s); +void AppendToRedobuffLit(char_u *str, int len); +void AppendCharToRedobuff(int c); +void AppendNumberToRedobuff(long n); +void stuffReadbuff(char_u *s); +void stuffRedoReadbuff(char_u *s); +void stuffReadbuffLen(char_u *s, long len); +void stuffReadbuffSpec(char_u *s); +void stuffcharReadbuff(int c); +void stuffnumReadbuff(long n); +int start_redo(long count, int old_redo); +int start_redo_ins(void); +void stop_redo_ins(void); +int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent); +void ins_char_typebuf(int c); +int typebuf_changed(int tb_change_cnt); +int typebuf_typed(void); +int typebuf_maplen(void); +void del_typebuf(int len, int offset); +int alloc_typebuf(void); +void free_typebuf(void); +int save_typebuf(void); +void save_typeahead(tasave_T *tp); +void restore_typeahead(tasave_T *tp); +void openscript(char_u *name, int directly); +void close_all_scripts(void); +int using_script(void); +void before_blocking(void); +void updatescript(int c); +int vgetc(void); +int safe_vgetc(void); +int plain_vgetc(void); +int vpeekc(void); +int vpeekc_nomap(void); +int vpeekc_any(void); +int char_avail(void); +void vungetc(int c); +int fix_input_buffer(char_u *buf, int len); +int input_available(void); +int do_map(int maptype, char_u *arg, int mode, int abbrev); +int get_map_mode(char_u **cmdp, int forceit); +void map_clear(char_u *cmdp, char_u *arg, int forceit, int abbr); +void map_clear_int(buf_T *buf, int mode, int local, int abbr); +char_u *map_mode_to_chars(int mode); +int map_to_exists(char_u *str, char_u *modechars, int abbr); +int map_to_exists_mode(char_u *rhs, int mode, int abbr); +char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx); +int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file); +int check_abbr(int c, char_u *ptr, int col, int mincol); +char_u *vim_strsave_escape_csi(char_u *p); +void vim_unescape_csi(char_u *p); +int makemap(FILE *fd, buf_T *buf); +int put_escstr(FILE *fd, char_u *strstart, int what); +void check_map_keycodes(void); +char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr); +void init_mappings(void); +void add_map(char_u *map, int mode); /* vim: set ft=c : */ diff --git a/src/proto/gui.pro b/src/proto/gui.pro index 29f87ef65d..4004bc7786 100644 --- a/src/proto/gui.pro +++ b/src/proto/gui.pro @@ -1,66 +1,70 @@ /* gui.c */ -void gui_start __ARGS((void)); -void gui_prepare __ARGS((int *argc, char **argv)); -int gui_init_check __ARGS((void)); -void gui_init __ARGS((void)); -void gui_exit __ARGS((int rc)); -void gui_shell_closed __ARGS((void)); -int gui_init_font __ARGS((char_u *font_list, int fontset)); -int gui_get_wide_font __ARGS((void)); -void gui_set_cursor __ARGS((int row, int col)); -void gui_update_cursor __ARGS((int force, int clear_selection)); -void gui_position_menu __ARGS((void)); -int gui_get_base_width __ARGS((void)); -int gui_get_base_height __ARGS((void)); -void gui_resize_shell __ARGS((int pixel_width, int pixel_height)); -void gui_may_resize_shell __ARGS((void)); -int gui_get_shellsize __ARGS((void)); -void gui_set_shellsize __ARGS((int mustset, int fit_to_display, int direction)); -void gui_new_shellsize __ARGS((void)); -void gui_reset_scroll_region __ARGS((void)); -void gui_start_highlight __ARGS((int mask)); -void gui_stop_highlight __ARGS((int mask)); -void gui_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_update_cursor_later __ARGS((void)); -void gui_write __ARGS((char_u *s, int len)); -void gui_dont_update_cursor __ARGS((void)); -void gui_can_update_cursor __ARGS((void)); -int gui_outstr_nowrap __ARGS((char_u *s, int len, int flags, guicolor_T fg, guicolor_T bg, int back)); -void gui_undraw_cursor __ARGS((void)); -void gui_redraw __ARGS((int x, int y, int w, int h)); -int gui_redraw_block __ARGS((int row1, int col1, int row2, int col2, int flags)); -int gui_wait_for_chars __ARGS((long wtime)); -void gui_send_mouse_event __ARGS((int button, int x, int y, int repeated_click, int_u modifiers)); -int gui_xy2colrow __ARGS((int x, int y, int *colp)); -void gui_menu_cb __ARGS((vimmenu_T *menu)); -void gui_init_which_components __ARGS((char_u *oldval)); -int gui_use_tabline __ARGS((void)); -void gui_update_tabline __ARGS((void)); -void get_tabline_label __ARGS((tabpage_T *tp, int tooltip)); -int send_tabline_event __ARGS((int nr)); -void send_tabline_menu_event __ARGS((int tabidx, int event)); -void gui_remove_scrollbars __ARGS((void)); -void gui_create_scrollbar __ARGS((scrollbar_T *sb, int type, win_T *wp)); -scrollbar_T *gui_find_scrollbar __ARGS((long ident)); -void gui_drag_scrollbar __ARGS((scrollbar_T *sb, long value, int still_dragging)); -void gui_may_update_scrollbars __ARGS((void)); -void gui_update_scrollbars __ARGS((int force)); -int gui_do_scroll __ARGS((void)); -int gui_do_horiz_scroll __ARGS((long_u leftcol, int compute_longest_lnum)); -void gui_check_colors __ARGS((void)); -guicolor_T gui_get_color __ARGS((char_u *name)); -int gui_get_lightness __ARGS((guicolor_T pixel)); -void gui_new_scrollbar_colors __ARGS((void)); -void gui_focus_change __ARGS((int in_focus)); -void gui_mouse_moved __ARGS((int x, int y)); -void gui_mouse_correct __ARGS((void)); -void ex_gui __ARGS((exarg_T *eap)); -int gui_find_bitmap __ARGS((char_u *name, char_u *buffer, char *ext)); -void gui_find_iconfile __ARGS((char_u *name, char_u *buffer, char *ext)); -void display_errors __ARGS((void)); -int no_console_input __ARGS((void)); -void gui_update_screen __ARGS((void)); -char_u *get_find_dialog_text __ARGS((char_u *arg, int *wwordp, int *mcasep)); -int gui_do_findrepl __ARGS((int flags, char_u *find_text, char_u *repl_text, int down)); -void gui_handle_drop __ARGS((int x, int y, int_u modifiers, char_u **fnames, int count)); +void gui_start(void); +void gui_prepare(int *argc, char **argv); +int gui_init_check(void); +void gui_init(void); +void gui_exit(int rc); +void gui_shell_closed(void); +int gui_init_font(char_u *font_list, int fontset); +int gui_get_wide_font(void); +void gui_set_cursor(int row, int col); +void gui_update_cursor(int force, int clear_selection); +void gui_position_menu(void); +int gui_get_base_width(void); +int gui_get_base_height(void); +void gui_resize_shell(int pixel_width, int pixel_height); +void gui_may_resize_shell(void); +int gui_get_shellsize(void); +void gui_set_shellsize(int mustset, int fit_to_display, int direction); +void gui_new_shellsize(void); +void gui_reset_scroll_region(void); +void gui_start_highlight(int mask); +void gui_stop_highlight(int mask); +void gui_clear_block(int row1, int col1, int row2, int col2); +void gui_update_cursor_later(void); +void gui_write(char_u *s, int len); +void gui_dont_update_cursor(int undraw); +void gui_can_update_cursor(void); +void gui_disable_flush(void); +void gui_enable_flush(void); +void gui_may_flush(void); +int gui_outstr_nowrap(char_u *s, int len, int flags, guicolor_T fg, guicolor_T bg, int back); +void gui_undraw_cursor(void); +void gui_redraw(int x, int y, int w, int h); +int gui_redraw_block(int row1, int col1, int row2, int col2, int flags); +int gui_wait_for_chars(long wtime, int tb_change_cnt); +int gui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt); +void gui_send_mouse_event(int button, int x, int y, int repeated_click, int_u modifiers); +int gui_xy2colrow(int x, int y, int *colp); +void gui_menu_cb(vimmenu_T *menu); +void gui_init_which_components(char_u *oldval); +int gui_use_tabline(void); +void gui_update_tabline(void); +void get_tabline_label(tabpage_T *tp, int tooltip); +int send_tabline_event(int nr); +void send_tabline_menu_event(int tabidx, int event); +void gui_remove_scrollbars(void); +void gui_create_scrollbar(scrollbar_T *sb, int type, win_T *wp); +scrollbar_T *gui_find_scrollbar(long ident); +void gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging); +void gui_may_update_scrollbars(void); +void gui_update_scrollbars(int force); +int gui_do_scroll(void); +int gui_do_horiz_scroll(long_u leftcol, int compute_longest_lnum); +void gui_check_colors(void); +guicolor_T gui_get_color(char_u *name); +int gui_get_lightness(guicolor_T pixel); +void gui_new_scrollbar_colors(void); +void gui_focus_change(int in_focus); +void gui_mouse_moved(int x, int y); +void gui_mouse_correct(void); +void ex_gui(exarg_T *eap); +int gui_find_bitmap(char_u *name, char_u *buffer, char *ext); +void gui_find_iconfile(char_u *name, char_u *buffer, char *ext); +void display_errors(void); +int no_console_input(void); +void gui_update_screen(void); +char_u *get_find_dialog_text(char_u *arg, int *wwordp, int *mcasep); +int gui_do_findrepl(int flags, char_u *find_text, char_u *repl_text, int down); +void gui_handle_drop(int x, int y, int_u modifiers, char_u **fnames, int count); /* vim: set ft=c : */ diff --git a/src/proto/gui_athena.pro b/src/proto/gui_athena.pro index efc8e40d3c..a834dac4a3 100644 --- a/src/proto/gui_athena.pro +++ b/src/proto/gui_athena.pro @@ -1,31 +1,31 @@ /* gui_athena.c */ -void gui_x11_create_widgets __ARGS((void)); -void gui_x11_destroy_widgets __ARGS((void)); -void gui_mch_set_toolbar_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_x11_set_back_color __ARGS((void)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_mch_set_menu_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_new_menu_font __ARGS((void)); -void gui_mch_new_tooltip_font __ARGS((void)); -void gui_mch_new_tooltip_colors __ARGS((void)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_show_toolbar __ARGS((int showit)); -int gui_mch_compute_toolbar_height __ARGS((void)); -void gui_mch_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp)); -void gui_mch_toggle_tearoffs __ARGS((int enable)); -void gui_mch_new_menu_colors __ARGS((void)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_mch_def_colors __ARGS((void)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -void gui_mch_set_scrollbar_colors __ARGS((scrollbar_T *sb)); -Window gui_x11_get_wid __ARGS((void)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd)); +void gui_x11_create_widgets(void); +void gui_x11_destroy_widgets(void); +void gui_mch_set_toolbar_pos(int x, int y, int w, int h); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +void gui_x11_set_back_color(void); +void gui_mch_enable_menu(int flag); +void gui_mch_set_menu_pos(int x, int y, int w, int h); +void gui_mch_add_menu(vimmenu_T *menu, int idx); +void gui_mch_new_menu_font(void); +void gui_mch_new_tooltip_font(void); +void gui_mch_new_tooltip_colors(void); +void gui_mch_add_menu_item(vimmenu_T *menu, int idx); +void gui_mch_show_toolbar(int showit); +int gui_mch_compute_toolbar_height(void); +void gui_mch_get_toolbar_colors(Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp); +void gui_mch_toggle_tearoffs(int enable); +void gui_mch_new_menu_colors(void); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_mch_def_colors(void); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +void gui_mch_set_scrollbar_colors(scrollbar_T *sb); +Window gui_x11_get_wid(void); +char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd); /* vim: set ft=c : */ diff --git a/src/proto/gui_beval.pro b/src/proto/gui_beval.pro index 33c1738d3f..4edb45c169 100644 --- a/src/proto/gui_beval.pro +++ b/src/proto/gui_beval.pro @@ -1,11 +1,9 @@ /* gui_beval.c */ -void general_beval_cb __ARGS((BalloonEval *beval, int state)); -BalloonEval *gui_mch_create_beval_area __ARGS((void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData)); -void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval)); -void gui_mch_enable_beval_area __ARGS((BalloonEval *beval)); -void gui_mch_disable_beval_area __ARGS((BalloonEval *beval)); -BalloonEval *gui_mch_currently_showing_beval __ARGS((void)); -int get_beval_info __ARGS((BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp)); -void gui_mch_post_balloon __ARGS((BalloonEval *beval, char_u *mesg)); -void gui_mch_unpost_balloon __ARGS((BalloonEval *beval)); +BalloonEval *gui_mch_create_beval_area(void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData); +void gui_mch_destroy_beval_area(BalloonEval *beval); +void gui_mch_enable_beval_area(BalloonEval *beval); +void gui_mch_disable_beval_area(BalloonEval *beval); +BalloonEval *gui_mch_currently_showing_beval(void); +void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg); +void gui_mch_unpost_balloon(BalloonEval *beval); /* vim: set ft=c : */ diff --git a/src/proto/gui_gtk.pro b/src/proto/gui_gtk.pro index 2bff89be72..319e27d79b 100644 --- a/src/proto/gui_gtk.pro +++ b/src/proto/gui_gtk.pro @@ -1,22 +1,22 @@ /* gui_gtk.c */ -void gui_gtk_register_stock_icons __ARGS((void)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_gtk_set_mnemonics __ARGS((int enable)); -void gui_mch_toggle_tearoffs __ARGS((int enable)); -void gui_mch_menu_set_tip __ARGS((vimmenu_T *menu)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield, int ex_cmd)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_make_popup __ARGS((char_u *path_name, int mouse_pos)); -void gui_mch_find_dialog __ARGS((exarg_T *eap)); -void gui_mch_replace_dialog __ARGS((exarg_T *eap)); -void ex_helpfind __ARGS((exarg_T *eap)); +void gui_gtk_register_stock_icons(void); +void gui_mch_add_menu(vimmenu_T *menu, int idx); +void gui_mch_add_menu_item(vimmenu_T *menu, int idx); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +void gui_gtk_set_mnemonics(int enable); +void gui_mch_toggle_tearoffs(int enable); +void gui_mch_menu_set_tip(vimmenu_T *menu); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); +char_u *gui_mch_browsedir(char_u *title, char_u *initdir); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield, int ex_cmd); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_make_popup(char_u *path_name, int mouse_pos); +void gui_mch_find_dialog(exarg_T *eap); +void gui_mch_replace_dialog(exarg_T *eap); +void ex_helpfind(exarg_T *eap); /* vim: set ft=c : */ diff --git a/src/proto/gui_gtk_gresources.pro b/src/proto/gui_gtk_gresources.pro new file mode 100644 index 0000000000..c09c7937cf --- /dev/null +++ b/src/proto/gui_gtk_gresources.pro @@ -0,0 +1,5 @@ +/* auto/gui_gtk_gresources.c */ +GResource *gui_gtk_get_resource(void); +void gui_gtk_unregister_resource(void); +void gui_gtk_register_resource(void); +/* vim: set ft=c : */ diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro index e4b21113cc..aea8d0b68e 100644 --- a/src/proto/gui_gtk_x11.pro +++ b/src/proto/gui_gtk_x11.pro @@ -1,75 +1,79 @@ /* gui_gtk_x11.c */ -void gui_mch_prepare __ARGS((int *argc, char **argv)); -void gui_mch_free_all __ARGS((void)); -void gui_mch_set_blinking __ARGS((long waittime, long on, long off)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_start_blink __ARGS((void)); -int gui_mch_early_init_check __ARGS((void)); -int gui_mch_init_check __ARGS((void)); -void gui_mch_show_tabline __ARGS((int showit)); -int gui_mch_showing_tabline __ARGS((void)); -void gui_mch_update_tabline __ARGS((void)); -void gui_mch_set_curtab __ARGS((int nr)); -void gui_gtk_set_selection_targets __ARGS((void)); -void gui_gtk_set_dnd_targets __ARGS((void)); -int gui_mch_init __ARGS((void)); -void gui_mch_forked __ARGS((void)); -void gui_mch_new_colors __ARGS((void)); -int gui_mch_open __ARGS((void)); -void gui_mch_exit __ARGS((int rc)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -int gui_mch_maximized __ARGS((void)); -void gui_mch_unmaximize __ARGS((void)); -void gui_mch_newfont __ARGS((void)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); -void gui_mch_enable_menu __ARGS((int showit)); -void gui_mch_show_toolbar __ARGS((int showit)); -int gui_mch_adjust_charheight __ARGS((void)); -char_u *gui_mch_font_dialog __ARGS((char_u *oldval)); -int gui_mch_init_font __ARGS((char_u *font_name, int fontset)); -GuiFont gui_mch_get_font __ARGS((char_u *name, int report_error)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -void gui_mch_free_font __ARGS((GuiFont font)); -guicolor_T gui_mch_get_color __ARGS((char_u *name)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -int gui_gtk2_draw_string __ARGS((int row, int col, char_u *s, int len, int flags)); -int gui_mch_haskey __ARGS((char_u *name)); -int gui_get_x11_windis __ARGS((Window *win, Display **dis)); -Display *gui_mch_get_display __ARGS((void)); -void gui_mch_beep __ARGS((void)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_invert_rectangle __ARGS((int r, int c, int nr, int nc)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_set_foreground __ARGS((void)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((long wtime)); -void gui_mch_flush __ARGS((void)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); -int clip_gtk_owner_exists __ARGS((VimClipboard *cbd)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -void gui_mch_mousehide __ARGS((int hide)); -void mch_set_mouse_shape __ARGS((int shape)); -void gui_mch_drawsign __ARGS((int row, int col, int typenr)); -void *gui_mch_register_sign __ARGS((char_u *signfile)); -void gui_mch_destroy_sign __ARGS((void *sign)); +void gui_mch_prepare(int *argc, char **argv); +void gui_mch_free_all(void); +int gui_mch_is_blinking(void); +int gui_mch_is_blink_off(void); +void gui_mch_set_blinking(long waittime, long on, long off); +void gui_mch_stop_blink(int may_call_gui_update_cursor); +void gui_mch_start_blink(void); +int gui_mch_early_init_check(int give_message); +int gui_mch_init_check(void); +void gui_mch_show_tabline(int showit); +int gui_mch_showing_tabline(void); +void gui_mch_update_tabline(void); +void gui_mch_set_curtab(int nr); +void gui_gtk_set_selection_targets(void); +void gui_gtk_set_dnd_targets(void); +int gui_mch_init(void); +void gui_mch_forked(void); +void gui_mch_new_colors(void); +int gui_mch_open(void); +void gui_mch_exit(int rc); +int gui_mch_get_winpos(int *x, int *y); +void gui_mch_set_winpos(int x, int y); +int gui_mch_maximized(void); +void gui_mch_unmaximize(void); +void gui_mch_newfont(void); +void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction); +void gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height); +void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); +void gui_mch_settitle(char_u *title, char_u *icon); +void gui_mch_enable_menu(int showit); +void gui_mch_show_toolbar(int showit); +int gui_mch_adjust_charheight(void); +char_u *gui_mch_font_dialog(char_u *oldval); +int gui_mch_init_font(char_u *font_name, int fontset); +GuiFont gui_mch_get_font(char_u *name, int report_error); +char_u *gui_mch_get_fontname(GuiFont font, char_u *name); +void gui_mch_free_font(GuiFont font); +guicolor_T gui_mch_get_color(char_u *name); +guicolor_T gui_mch_get_rgb_color(int r, int g, int b); +void gui_mch_set_fg_color(guicolor_T color); +void gui_mch_set_bg_color(guicolor_T color); +void gui_mch_set_sp_color(guicolor_T color); +int gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags); +int gui_mch_haskey(char_u *name); +int gui_get_x11_windis(Window *win, Display **dis); +Display *gui_mch_get_display(void); +void gui_mch_beep(void); +void gui_mch_flash(int msec); +void gui_mch_invert_rectangle(int r, int c, int nr, int nc); +void gui_mch_iconify(void); +void gui_mch_set_foreground(void); +void gui_mch_draw_hollow_cursor(guicolor_T color); +void gui_mch_draw_part_cursor(int w, int h, guicolor_T color); +void gui_mch_update(void); +int gui_mch_wait_for_chars(long wtime); +void gui_mch_flush(void); +void gui_mch_clear_block(int row1arg, int col1arg, int row2arg, int col2arg); +void gui_mch_clear_all(void); +void gui_mch_delete_lines(int row, int num_lines); +void gui_mch_insert_lines(int row, int num_lines); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_lose_selection(VimClipboard *cbd); +int clip_mch_own_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); +int clip_gtk_owner_exists(VimClipboard *cbd); +void gui_mch_menu_grey(vimmenu_T *menu, int grey); +void gui_mch_menu_hidden(vimmenu_T *menu, int hidden); +void gui_mch_draw_menubar(void); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +guicolor_T gui_mch_get_rgb(guicolor_T pixel); +void gui_mch_getmouse(int *x, int *y); +void gui_mch_setmouse(int x, int y); +void gui_mch_mousehide(int hide); +void mch_set_mouse_shape(int shape); +void gui_mch_drawsign(int row, int col, int typenr); +void *gui_mch_register_sign(char_u *signfile); +void gui_mch_destroy_sign(void *sign); /* vim: set ft=c : */ diff --git a/src/proto/gui_mac.pro b/src/proto/gui_mac.pro index 2010f978c6..011ef2888e 100644 --- a/src/proto/gui_mac.pro +++ b/src/proto/gui_mac.pro @@ -4,114 +4,117 @@ * Mac specific prototypes */ -pascal Boolean WaitNextEventWrp __ARGS((EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)); -pascal void gui_mac_scroll_action __ARGS((ControlHandle theControl, short partCode)); +pascal Boolean WaitNextEventWrp(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn); +pascal void gui_mac_scroll_action(ControlHandle theControl, short partCode); pascal void gui_mac_drag_thumb (ControlHandle theControl, short partCode); -void gui_mac_handle_event __ARGS((EventRecord *event)); -void gui_mac_doMouseDown __ARGS((EventRecord *theEvent)); -void gui_mac_do_key __ARGS((EventRecord *theEvent)); -void gui_mac_handle_menu __ARGS((long menuChoice)); -void gui_mac_focus_change __ARGS((EventRecord *event)); -void gui_mac_update __ARGS((EventRecord *event)); -short gui_mch_get_mac_menu_item_index __ARGS((vimmenu_T *menu, vimmenu_T *parent)); -void gui_mch_set_blinking __ARGS((long wait, long on, long off)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_start_blink __ARGS((void)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -void gui_mch_prepare __ARGS((int *argc, char **argv)); -int gui_mch_init_check __ARGS((void)); -int gui_mch_init __ARGS((void)); -void gui_mch_new_colors __ARGS((void)); -int gui_mch_open __ARGS((void)); -void gui_mch_exit __ARGS((int)); -void gui_mch_set_winsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -int gui_mch_adjust_charheight __ARGS((void)); -int gui_mch_init_font __ARGS((char_u *font_name, int fontset)); -GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -GuiFont gui_mac_find_font __ARGS((char_u *font_name)); -void gui_mch_set_font __ARGS((GuiFont font)); -int gui_mch_same_font __ARGS((GuiFont f1, GuiFont f2)); -void gui_mch_free_font __ARGS((GuiFont font)); -guicolor_T gui_mch_get_color __ARGS((char_u *name)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags)); -int gui_mch_haskey __ARGS((char_u *name)); -void gui_mch_beep __ARGS((void)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_invert_rectangle __ARGS((int r, int c, int nr, int nc)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((int wtime)); -void gui_mch_flush __ARGS((void)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_mch_set_menu_pos __ARGS((int x, int y, int w, int h)); -/*void gui_mch_add_menu __ARGS((vimmenu_T *menu, vimmenu_T *parent, int idx));*/ -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int pos)); -/*void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, vimmenu_T *parent, int idx));*/ -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -int gui_mch_get_lightness __ARGS((guicolor_T pixel)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); -void gui_mch_setmouse __ARGS((int x, int y)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -void gui_mch_set_foreground __ARGS((void)); -void gui_mch_show_tabline __ARGS((int showit)); -int gui_mch_showing_tabline __ARGS((void)); -void gui_mch_update_tabline __ARGS((void)); -void gui_mch_set_curtab __ARGS((int nr)); +void gui_mac_handle_event(EventRecord *event); +void gui_mac_doMouseDown(EventRecord *theEvent); +void gui_mac_do_key(EventRecord *theEvent); +void gui_mac_handle_menu(long menuChoice); +void gui_mac_focus_change(EventRecord *event); +void gui_mac_update(EventRecord *event); +short gui_mch_get_mac_menu_item_index(vimmenu_T *menu, vimmenu_T *parent); +int gui_mch_is_blinking(void); +int gui_mch_is_blink_off(void); +void gui_mch_set_blinking(long wait, long on, long off); +void gui_mch_stop_blink(int may_call_gui_update_cursor); +void gui_mch_start_blink(void); +void gui_mch_getmouse(int *x, int *y); +void gui_mch_setmouse(int x, int y); +void gui_mch_prepare(int *argc, char **argv); +int gui_mch_init_check(void); +int gui_mch_init(void); +void gui_mch_new_colors(void); +int gui_mch_open(void); +void gui_mch_exit(int); +void gui_mch_set_winsize(int width, int height, int min_width, int min_height, int base_width, int base_height); +int gui_mch_get_winpos(int *x, int *y); +void gui_mch_set_winpos(int x, int y); +void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction); +void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +int gui_mch_adjust_charheight(void); +int gui_mch_init_font(char_u *font_name, int fontset); +GuiFont gui_mch_get_font(char_u *name, int giveErrorIfMissing); +char_u *gui_mch_get_fontname(GuiFont font, char_u *name); +GuiFont gui_mac_find_font(char_u *font_name); +void gui_mch_set_font(GuiFont font); +int gui_mch_same_font(GuiFont f1, GuiFont f2); +void gui_mch_free_font(GuiFont font); +guicolor_T gui_mch_get_color(char_u *name); +guicolor_T gui_mch_get_rgb_color(int r, int g, int b); +void gui_mch_set_fg_color(guicolor_T color); +void gui_mch_set_bg_color(guicolor_T color); +void gui_mch_set_sp_color(guicolor_T color); +void gui_mch_draw_string(int row, int col, char_u *s, int len, int flags); +int gui_mch_haskey(char_u *name); +void gui_mch_beep(void); +void gui_mch_flash(int msec); +void gui_mch_invert_rectangle(int r, int c, int nr, int nc); +void gui_mch_iconify(void); +void gui_mch_settitle(char_u *title, char_u *icon); +void gui_mch_draw_hollow_cursor(guicolor_T color); +void gui_mch_draw_part_cursor(int w, int h, guicolor_T color); +void gui_mch_update(void); +int gui_mch_wait_for_chars(int wtime); +void gui_mch_flush(void); +void gui_mch_clear_block(int row1, int col1, int row2, int col2); +void gui_mch_clear_all(void); +void gui_mch_delete_lines(int row, int num_lines); +void gui_mch_insert_lines(int row, int num_lines); +void gui_mch_enable_menu(int flag); +void gui_mch_set_menu_pos(int x, int y, int w, int h); +/*void gui_mch_add_menu(vimmenu_T *menu, vimmenu_T *parent, int idx);*/ +void gui_mch_add_menu(vimmenu_T *menu, int pos); +/*void gui_mch_add_menu_item(vimmenu_T *menu, vimmenu_T *parent, int idx);*/ +void gui_mch_add_menu_item(vimmenu_T *menu, int idx); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_menu_grey(vimmenu_T *menu, int grey); +void gui_mch_menu_hidden(vimmenu_T *menu, int hidden); +void gui_mch_draw_menubar(void); +int gui_mch_get_lightness(guicolor_T pixel); +guicolor_T gui_mch_get_rgb(guicolor_T pixel); +int gui_mch_get_mouse_x(void); +int gui_mch_get_mouse_y(void); +void gui_mch_setmouse(int x, int y); +void gui_mch_show_popupmenu(vimmenu_T *menu); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd); +char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); +void gui_mch_set_foreground(void); +void gui_mch_show_tabline(int showit); +int gui_mch_showing_tabline(void); +void gui_mch_update_tabline(void); +void gui_mch_set_curtab(int nr); -char_u *C2Pascal_save __ARGS((char_u *Cstring)); -char_u *C2Pascal_save_and_remove_backslash __ARGS((char_u *Cstring)); -int_u EventModifiers2VimMouseModifiers __ARGS((EventModifiers macModifiers)); -char_u **new_fnames_from_AEDesc __ARGS((AEDesc *theList, long *numFiles, OSErr *error)); +char_u *C2Pascal_save(char_u *Cstring); +char_u *C2Pascal_save_and_remove_backslash(char_u *Cstring); +int_u EventModifiers2VimMouseModifiers(EventModifiers macModifiers); +char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error); -void gui_request_selection __ARGS((void)); -void gui_mch_lose_selection __ARGS((void)); -int gui_mch_own_selection __ARGS((void)); -void gui_mch_clear_selection __ARGS((void)); +void gui_request_selection(void); +void gui_mch_lose_selection(void); +int gui_mch_own_selection(void); +void gui_mch_clear_selection(void); -void gui_win_new_height __ARGS((win_T *wp)); -void gui_win_comp_pos __ARGS((void)); -void gui_win_free __ARGS((win_T *wp)); -void gui_win_alloc __ARGS((win_T *wp)); +void gui_win_new_height(win_T *wp); +void gui_win_comp_pos(void); +void gui_win_free(win_T *wp); +void gui_win_alloc(win_T *wp); void mch_post_buffer_write (buf_T *buf); -void mch_errmsg __ARGS((char *str)); -void mch_display_error __ARGS((void)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); +void mch_errmsg(char *str); +void mch_display_error(void); +void clip_mch_lose_selection(VimClipboard *cbd); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); +int clip_mch_own_selection(VimClipboard *cbd); pascal OSErr FindProcessBySignature( const OSType targetType, const OSType targetCreator, ProcessSerialNumberPtr psnPtr ); @@ -129,17 +132,17 @@ pascal OSErr Handle_KAHL_MOD_AE (const AppleEvent *theAEvent, AppleEvent *theRe pascal OSErr Handle_KAHL_GTTX_AE (const AppleEvent *theAEvent, AppleEvent *theReply, long refCon); void Send_KAHL_MOD_AE (buf_T *buf); -void gui_mac_doInContentClick __ARGS((EventRecord *theEvent, WindowPtr whichWindow)); -void gui_mac_doInDragClick __ARGS((Point where, WindowPtr whichWindow)); -void gui_mac_doInGrowClick __ARGS((Point where, WindowPtr whichWindow)); -void gui_mac_doUpdateEvent __ARGS((EventRecord *event)); -void gui_mac_doActivateEvent __ARGS((EventRecord *event)); -void gui_mac_doSuspendEvent __ARGS((EventRecord *event)); -void gui_mac_doKeyEvent __ARGS((EventRecord *theEvent)); -void gui_mac_doMouseDownEvent __ARGS((EventRecord *theEvent)); -void gui_mac_doMouseMovedEvent __ARGS((EventRecord *event)); -void gui_mac_doMouseUpEvent __ARGS((EventRecord *theEvent)); -void gui_mch_mousehide __ARGS((int hide)); +void gui_mac_doInContentClick(EventRecord *theEvent, WindowPtr whichWindow); +void gui_mac_doInDragClick(Point where, WindowPtr whichWindow); +void gui_mac_doInGrowClick(Point where, WindowPtr whichWindow); +void gui_mac_doUpdateEvent(EventRecord *event); +void gui_mac_doActivateEvent(EventRecord *event); +void gui_mac_doSuspendEvent(EventRecord *event); +void gui_mac_doKeyEvent(EventRecord *theEvent); +void gui_mac_doMouseDownEvent(EventRecord *theEvent); +void gui_mac_doMouseMovedEvent(EventRecord *event); +void gui_mac_doMouseUpEvent(EventRecord *theEvent); +void gui_mch_mousehide(int hide); int C2PascalString (char_u *CString, Str255 *PascalString); int GetFSSpecFromPath ( char_u *file, FSSpec *fileFSSpec); diff --git a/src/proto/gui_macvim.pro b/src/proto/gui_macvim.pro index 427205d76f..42fd7bf366 100644 --- a/src/proto/gui_macvim.pro +++ b/src/proto/gui_macvim.pro @@ -30,8 +30,6 @@ gui_mch_clear_all(void); gui_mch_clear_block(int row1, int col1, int row2, int col2); void gui_mch_delete_lines(int row, int num_lines); - void -gui_mch_draw_string(int row, int col, char_u *s, int len, int cells, int flags); int gui_macvim_draw_string(int row, int col, char_u *s, int len, int flags); void @@ -82,6 +80,8 @@ gui_mch_init_font(char_u *font_name, int fontset); gui_mch_set_font(GuiFont font); int gui_mch_adjust_charheight(void); + int +gui_mch_adjust_charwidth(void); void gui_mch_beep(void); char_u * @@ -121,8 +121,10 @@ gui_mch_enable_scrollbar( gui_mch_flash(int msec); guicolor_T gui_mch_get_color(char_u *name); - long_u + guicolor_T gui_mch_get_rgb(guicolor_T pixel); + guicolor_T +gui_mch_get_rgb_color(int r, int g, int b); void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); int @@ -139,6 +141,10 @@ gui_mch_invert_rectangle(int r, int c, int nr, int nc, int invert); gui_mch_new_colors(void); void gui_mch_set_bg_color(guicolor_T color); + int +gui_mch_is_blinking(void); + int +gui_mch_is_blink_off(void); void gui_mch_set_blinking(long wait, long on, long off); void @@ -180,7 +186,7 @@ gui_mch_settitle(char_u *title, char_u *icon); void gui_mch_start_blink(void); void -gui_mch_stop_blink(void); +gui_mch_stop_blink(int may_call_gui_update_cursor); void gui_mch_toggle_tearoffs(int enable); void @@ -193,7 +199,7 @@ ex_macaction(exarg_T *eap); gui_make_popup(char_u *path_name, int mouse_pos); void serverRegisterName(char_u *name); -int serverSendToVim(char_u *name, char_u *cmd, char_u **result, int *server, int asExpr, int silent); +int serverSendToVim(char_u *name, char_u *cmd, char_u **result, int *server, int asExpr, int timeout, int silent); char_u *serverGetVimNames(void); int serverStrToPort(char_u *str); int serverPeekReply(int port, char_u **str); @@ -207,6 +213,10 @@ void gui_mch_fuopt_update(void); void gui_macvim_update_modified_flag(); void gui_macvim_add_to_find_pboard(char_u *pat); void gui_macvim_set_antialias(int antialias); +void gui_macvim_set_ligatures(int ligatures); +void gui_macvim_set_thinstrokes(int thinStrokes); +void gui_macvim_set_blur(int blur); +void gui_macvim_set_proportional_font(int proportional_font); int16_t odb_buffer_close(buf_T *buf); int16_t odb_post_buffer_write(buf_T *buf); @@ -225,8 +235,12 @@ gui_mch_replace_dialog(exarg_T *eap); void im_set_control(int enable); + void * +gui_macvim_add_channel(channel_T *channel, ch_part_T part); + void +gui_macvim_remove_channel(void *cookie); void -gui_macvim_set_netbeans_socket(int socket); +gui_macvim_cleanup_job_all(void); void gui_mch_drawsign(int row, int col, int typenr); diff --git a/src/proto/gui_motif.pro b/src/proto/gui_motif.pro index e455f0161b..493f5e78ce 100644 --- a/src/proto/gui_motif.pro +++ b/src/proto/gui_motif.pro @@ -1,46 +1,46 @@ /* gui_motif.c */ -void gui_x11_create_widgets __ARGS((void)); -void gui_x11_destroy_widgets __ARGS((void)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_x11_set_back_color __ARGS((void)); -void manage_centered __ARGS((Widget dialog_child)); -XmFontList gui_motif_create_fontlist __ARGS((XFontStruct *font)); -XmFontList gui_motif_fontset2fontlist __ARGS((XFontSet *fontset)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_motif_set_mnemonics __ARGS((int enable)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_toggle_tearoffs __ARGS((int enable)); -int gui_mch_text_area_extra_height __ARGS((void)); -void gui_mch_compute_menu_height __ARGS((Widget id)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_motif_update_mousemodel __ARGS((vimmenu_T *menu)); -void gui_mch_new_menu_colors __ARGS((void)); -void gui_mch_new_menu_font __ARGS((void)); -void gui_mch_new_tooltip_font __ARGS((void)); -void gui_mch_new_tooltip_colors __ARGS((void)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_mch_def_colors __ARGS((void)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -void gui_mch_set_scrollbar_colors __ARGS((scrollbar_T *sb)); -Window gui_x11_get_wid __ARGS((void)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *button_names, int dfltbutton, char_u *textfield, int ex_cmd)); -void gui_mch_enable_footer __ARGS((int showit)); -void gui_mch_set_footer __ARGS((char_u *s)); -void gui_mch_show_toolbar __ARGS((int showit)); -int gui_mch_compute_toolbar_height __ARGS((void)); -void motif_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp)); -void gui_mch_show_tabline __ARGS((int showit)); -int gui_mch_showing_tabline __ARGS((void)); -void gui_mch_update_tabline __ARGS((void)); -void gui_mch_set_curtab __ARGS((int nr)); -void gui_motif_menu_fontlist __ARGS((Widget id)); -void gui_mch_find_dialog __ARGS((exarg_T *eap)); -void gui_mch_replace_dialog __ARGS((exarg_T *eap)); -void gui_motif_synch_fonts __ARGS((void)); +void gui_x11_create_widgets(void); +void gui_x11_destroy_widgets(void); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +void gui_x11_set_back_color(void); +void manage_centered(Widget dialog_child); +XmFontList gui_motif_create_fontlist(XFontStruct *font); +XmFontList gui_motif_fontset2fontlist(XFontSet *fontset); +void gui_mch_enable_menu(int flag); +void gui_motif_set_mnemonics(int enable); +void gui_mch_add_menu(vimmenu_T *menu, int idx); +void gui_mch_toggle_tearoffs(int enable); +int gui_mch_text_area_extra_height(void); +void gui_mch_compute_menu_height(Widget id); +void gui_mch_add_menu_item(vimmenu_T *menu, int idx); +void gui_motif_update_mousemodel(vimmenu_T *menu); +void gui_mch_new_menu_colors(void); +void gui_mch_new_menu_font(void); +void gui_mch_new_tooltip_font(void); +void gui_mch_new_tooltip_colors(void); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_mch_def_colors(void); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +void gui_mch_set_scrollbar_colors(scrollbar_T *sb); +Window gui_x11_get_wid(void); +char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *button_names, int dfltbutton, char_u *textfield, int ex_cmd); +void gui_mch_enable_footer(int showit); +void gui_mch_set_footer(char_u *s); +void gui_mch_show_toolbar(int showit); +int gui_mch_compute_toolbar_height(void); +void motif_get_toolbar_colors(Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp); +void gui_mch_show_tabline(int showit); +int gui_mch_showing_tabline(void); +void gui_mch_update_tabline(void); +void gui_mch_set_curtab(int nr); +void gui_motif_menu_fontlist(Widget id); +void gui_mch_find_dialog(exarg_T *eap); +void gui_mch_replace_dialog(exarg_T *eap); +void gui_motif_synch_fonts(void); /* vim: set ft=c : */ diff --git a/src/proto/gui_photon.pro b/src/proto/gui_photon.pro index 0a5041e506..9fcc51264e 100644 --- a/src/proto/gui_photon.pro +++ b/src/proto/gui_photon.pro @@ -1,67 +1,70 @@ /* gui_photon.c */ -void gui_ph_encoding_changed __ARGS((int new_encoding)); -void gui_mch_prepare __ARGS((int *argc, char **argv)); -int gui_mch_init __ARGS((void)); -int gui_mch_init_check __ARGS((void)); -int gui_mch_open __ARGS((void)); -void gui_mch_exit __ARGS((int rc)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((int wtime)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *default_name, char_u *ext, char_u *initdir, char_u *filter)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int default_button, char_u *textfield, int ex_cmd)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_set_foreground __ARGS((void)); -void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, int val, int size, int max)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -void mch_set_mouse_shape __ARGS((int shape)); -void gui_mch_mousehide __ARGS((int hide)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -void gui_mch_new_colors __ARGS((void)); -guicolor_T gui_mch_get_color __ARGS((char_u *name)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -void gui_mch_invert_rectangle __ARGS((int row, int col, int nr, int nc)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_set_blinking __ARGS((long wait, long on, long off)); -void gui_mch_start_blink __ARGS((void)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_beep __ARGS((void)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_flush __ARGS((void)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -int gui_mch_haskey __ARGS((char_u *name)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_mch_set_menu_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int index)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int index)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_mch_toggle_tearoffs __ARGS((int enable)); -void gui_mch_show_toolbar __ARGS((int showit)); -int gui_mch_init_font __ARGS((char_u *vim_font_name, int fontset)); -int gui_mch_adjust_charheight __ARGS((void)); -GuiFont gui_mch_get_font __ARGS((char_u *vim_font_name, int report_error)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -void gui_mch_set_font __ARGS((GuiFont font)); -void gui_mch_free_font __ARGS((GuiFont font)); +void gui_ph_encoding_changed(int new_encoding); +void gui_mch_prepare(int *argc, char **argv); +int gui_mch_init(void); +int gui_mch_init_check(void); +int gui_mch_open(void); +void gui_mch_exit(int rc); +void gui_mch_update(void); +int gui_mch_wait_for_chars(int wtime); +char_u *gui_mch_browse(int saving, char_u *title, char_u *default_name, char_u *ext, char_u *initdir, char_u *filter); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int default_button, char_u *textfield, int ex_cmd); +int gui_mch_get_winpos(int *x, int *y); +void gui_mch_set_winpos(int x, int y); +void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction); +void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); +void gui_mch_iconify(void); +void gui_mch_set_foreground(void); +void gui_mch_settitle(char_u *title, char_u *icon); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +void mch_set_mouse_shape(int shape); +void gui_mch_mousehide(int hide); +void gui_mch_getmouse(int *x, int *y); +void gui_mch_setmouse(int x, int y); +guicolor_T gui_mch_get_rgb(guicolor_T pixel); +void gui_mch_new_colors(void); +guicolor_T gui_mch_get_color(char_u *name); +guicolor_T gui_mch_get_rgb_color(int r, int g, int b); +void gui_mch_set_fg_color(guicolor_T color); +void gui_mch_set_bg_color(guicolor_T color); +void gui_mch_set_sp_color(guicolor_T color); +void gui_mch_invert_rectangle(int row, int col, int nr, int nc); +void gui_mch_clear_block(int row1, int col1, int row2, int col2); +void gui_mch_clear_all(void); +void gui_mch_delete_lines(int row, int num_lines); +void gui_mch_insert_lines(int row, int num_lines); +void gui_mch_draw_string(int row, int col, char_u *s, int len, int flags); +void gui_mch_draw_hollow_cursor(guicolor_T color); +void gui_mch_draw_part_cursor(int w, int h, guicolor_T color); +int gui_mch_is_blinking(void); +int gui_mch_is_blink_off(void); +void gui_mch_set_blinking(long wait, long on, long off); +void gui_mch_start_blink(void); +void gui_mch_stop_blink(int may_call_gui_update_cursor); +void gui_mch_beep(void); +void gui_mch_flash(int msec); +void gui_mch_flush(void); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +int gui_mch_haskey(char_u *name); +void gui_mch_enable_menu(int flag); +void gui_mch_set_menu_pos(int x, int y, int w, int h); +void gui_mch_add_menu(vimmenu_T *menu, int index); +void gui_mch_add_menu_item(vimmenu_T *menu, int index); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_menu_grey(vimmenu_T *menu, int grey); +void gui_mch_menu_hidden(vimmenu_T *menu, int hidden); +void gui_mch_draw_menubar(void); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_mch_toggle_tearoffs(int enable); +void gui_mch_show_toolbar(int showit); +int gui_mch_init_font(char_u *vim_font_name, int fontset); +int gui_mch_adjust_charheight(void); +GuiFont gui_mch_get_font(char_u *vim_font_name, int report_error); +char_u *gui_mch_get_fontname(GuiFont font, char_u *name); +void gui_mch_set_font(GuiFont font); +void gui_mch_free_font(GuiFont font); /* vim: set ft=c : */ diff --git a/src/proto/gui_w16.pro b/src/proto/gui_w16.pro deleted file mode 100644 index a7802a9692..0000000000 --- a/src/proto/gui_w16.pro +++ /dev/null @@ -1,80 +0,0 @@ -/* gui_w16.c */ -void gui_mch_set_blinking __ARGS((long wait, long on, long off)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_start_blink __ARGS((void)); -LRESULT WINAPI vim_WindowProc __ARGS((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); -void gui_mch_new_colors __ARGS((void)); -void gui_mch_def_colors __ARGS((void)); -int gui_mch_open __ARGS((void)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -int gui_mch_adjust_charheight __ARGS((void)); -GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -void gui_mch_free_font __ARGS((GuiFont font)); -guicolor_T gui_mch_get_color __ARGS((char_u *name)); -int gui_mch_haskey __ARGS((char_u *name)); -void gui_mch_beep __ARGS((void)); -void gui_mch_invert_rectangle __ARGS((int r, int c, int nr, int nc)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((int wtime)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_mch_set_menu_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -void gui_mch_activate_window __ARGS((void)); -void gui_mch_show_toolbar __ARGS((int showit)); -void gui_mch_show_tabline __ARGS((int showit)); -int gui_mch_showing_tabline __ARGS((void)); -void gui_mch_update_tabline __ARGS((void)); -void gui_mch_set_curtab __ARGS((int nr)); -void ex_simalt __ARGS((exarg_T *eap)); -void gui_mch_find_dialog __ARGS((exarg_T *eap)); -void gui_mch_replace_dialog __ARGS((exarg_T *eap)); -void gui_mch_mousehide __ARGS((int hide)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void gui_mch_exit __ARGS((int rc)); -void gui_mch_wide_font_changed __ARGS((void)); -int gui_mch_init_font __ARGS((char_u *font_name, int fontset)); -int gui_mch_maximized __ARGS((void)); -void gui_mch_newfont __ARGS((void)); -void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); -void mch_set_mouse_shape __ARGS((int shape)); -char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -int get_cmd_args __ARGS((char *prog, char *cmdline, char ***argvp, char **tofree)); -void gui_mch_prepare __ARGS((int *argc, char **argv)); -int gui_mch_init __ARGS((void)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_font __ARGS((GuiFont font)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -void gui_mch_draw_string __ARGS((int row, int col, char_u *text, int len, int flags)); -void gui_mch_flush __ARGS((void)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int pos)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_make_popup __ARGS((char_u *path_name, int mouse_pos)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd)); -void gui_mch_set_foreground __ARGS((void)); -/* vim: set ft=c : */ diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro index a333233d78..4cef003e1a 100644 --- a/src/proto/gui_w32.pro +++ b/src/proto/gui_w32.pro @@ -1,98 +1,103 @@ /* gui_w32.c */ -void gui_mch_set_blinking __ARGS((long wait, long on, long off)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_start_blink __ARGS((void)); -LRESULT WINAPI vim_WindowProc __ARGS((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)); -void gui_mch_new_colors __ARGS((void)); -void gui_mch_def_colors __ARGS((void)); -int gui_mch_open __ARGS((void)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); -void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h)); -void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient)); -int gui_mch_adjust_charheight __ARGS((void)); -GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -void gui_mch_free_font __ARGS((GuiFont font)); -guicolor_T gui_mch_get_color __ARGS((char_u *name)); -int gui_mch_haskey __ARGS((char_u *name)); -void gui_mch_beep __ARGS((void)); -void gui_mch_invert_rectangle __ARGS((int r, int c, int nr, int nc)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((int wtime)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_enable_menu __ARGS((int flag)); -void gui_mch_set_menu_pos __ARGS((int x, int y, int w, int h)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -void gui_mch_activate_window __ARGS((void)); -void gui_mch_show_toolbar __ARGS((int showit)); -void gui_mch_show_tabline __ARGS((int showit)); -int gui_mch_showing_tabline __ARGS((void)); -void gui_mch_update_tabline __ARGS((void)); -void gui_mch_set_curtab __ARGS((int nr)); -void ex_simalt __ARGS((exarg_T *eap)); -void gui_mch_find_dialog __ARGS((exarg_T *eap)); -void gui_mch_replace_dialog __ARGS((exarg_T *eap)); -void gui_mch_mousehide __ARGS((int hide)); -void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void gui_mch_exit __ARGS((int rc)); -void gui_mch_wide_font_changed __ARGS((void)); -int gui_mch_init_font __ARGS((char_u *font_name, int fontset)); -int gui_mch_maximized __ARGS((void)); -void gui_mch_newfont __ARGS((void)); -void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); -void mch_set_mouse_shape __ARGS((int shape)); -char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir)); -char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); -int get_cmd_args __ARGS((char *prog, char *cmdline, char ***argvp, char **tofree)); -int gui_is_win32s __ARGS((void)); -void gui_mch_set_parent __ARGS((char *title)); -void gui_mch_prepare __ARGS((int *argc, char **argv)); -int gui_mch_init __ARGS((void)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max)); -void gui_mch_set_font __ARGS((GuiFont font)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -void im_set_font __ARGS((LOGFONT *lf)); -void im_set_position __ARGS((int row, int col)); -void im_set_active __ARGS((int active)); -int im_get_status __ARGS((void)); -void gui_mch_draw_string __ARGS((int row, int col, char_u *text, int len, int flags)); -void gui_mch_flush __ARGS((void)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -void gui_mch_add_menu __ARGS((vimmenu_T *menu, int pos)); -void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); -void gui_make_popup __ARGS((char_u *path_name, int mouse_pos)); -void gui_make_tearoff __ARGS((char_u *path_name)); -void gui_mch_add_menu_item __ARGS((vimmenu_T *menu, int idx)); -void gui_mch_destroy_menu __ARGS((vimmenu_T *menu)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd)); -void gui_mch_set_foreground __ARGS((void)); -void gui_mch_drawsign __ARGS((int row, int col, int typenr)); -void *gui_mch_register_sign __ARGS((char_u *signfile)); -void gui_mch_destroy_sign __ARGS((void *sign)); -int multiline_balloon_available __ARGS((void)); -void gui_mch_disable_beval_area __ARGS((BalloonEval *beval)); -void gui_mch_enable_beval_area __ARGS((BalloonEval *beval)); -void gui_mch_post_balloon __ARGS((BalloonEval *beval, char_u *mesg)); -BalloonEval *gui_mch_create_beval_area __ARGS((void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData)); -void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval)); -void netbeans_draw_multisign_indicator __ARGS((int row)); -void netbeans_init_winsock __ARGS((void)); +int gui_mch_set_rendering_options(char_u *s); +int gui_mch_is_blinking(void); +int gui_mch_is_blink_off(void); +void gui_mch_set_blinking(long wait, long on, long off); +void gui_mch_stop_blink(int may_call_gui_update_cursor); +void gui_mch_start_blink(void); +LRESULT WINAPI vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +void gui_mch_new_colors(void); +void gui_mch_def_colors(void); +int gui_mch_open(void); +int gui_mch_get_winpos(int *x, int *y); +void gui_mch_set_winpos(int x, int y); +void gui_mch_set_text_area_pos(int x, int y, int w, int h); +void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag); +void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h); +void gui_mch_create_scrollbar(scrollbar_T *sb, int orient); +int gui_mch_adjust_charheight(void); +GuiFont gui_mch_get_font(char_u *name, int giveErrorIfMissing); +char_u *gui_mch_get_fontname(GuiFont font, char_u *name); +void gui_mch_free_font(GuiFont font); +guicolor_T gui_mch_get_color(char_u *name); +guicolor_T gui_mch_get_rgb_color(int r, int g, int b); +int gui_mch_haskey(char_u *name); +void gui_mch_beep(void); +void gui_mch_invert_rectangle(int r, int c, int nr, int nc); +void gui_mch_iconify(void); +void gui_mch_draw_hollow_cursor(guicolor_T color); +void gui_mch_draw_part_cursor(int w, int h, guicolor_T color); +void gui_mch_update(void); +int gui_mch_wait_for_chars(int wtime); +void gui_mch_clear_block(int row1, int col1, int row2, int col2); +void gui_mch_clear_all(void); +void gui_mch_enable_menu(int flag); +void gui_mch_set_menu_pos(int x, int y, int w, int h); +void gui_mch_menu_hidden(vimmenu_T *menu, int hidden); +void gui_mch_draw_menubar(void); +guicolor_T gui_mch_get_rgb(guicolor_T pixel); +void gui_mch_activate_window(void); +void gui_mch_show_toolbar(int showit); +void gui_mch_show_tabline(int showit); +int gui_mch_showing_tabline(void); +void gui_mch_update_tabline(void); +void gui_mch_set_curtab(int nr); +void ex_simalt(exarg_T *eap); +void gui_mch_find_dialog(exarg_T *eap); +void gui_mch_replace_dialog(exarg_T *eap); +void gui_mch_mousehide(int hide); +void gui_mch_destroy_scrollbar(scrollbar_T *sb); +void gui_mch_getmouse(int *x, int *y); +void gui_mch_setmouse(int x, int y); +void gui_mch_flash(int msec); +void gui_mch_delete_lines(int row, int num_lines); +void gui_mch_insert_lines(int row, int num_lines); +void gui_mch_exit(int rc); +void gui_mch_wide_font_changed(void); +int gui_mch_init_font(char_u *font_name, int fontset); +int gui_mch_maximized(void); +void gui_mch_newfont(void); +void gui_mch_settitle(char_u *title, char_u *icon); +void mch_set_mouse_shape(int shape); +char_u *gui_mch_browsedir(char_u *title, char_u *initdir); +char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); +int get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree); +void gui_mch_show_caption(int show); +void gui_mch_set_parent(char *title); +void gui_mch_prepare(int *argc, char **argv); +int gui_mch_init(void); +void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction); +void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max); +void gui_mch_set_font(GuiFont font); +void gui_mch_set_fg_color(guicolor_T color); +void gui_mch_set_bg_color(guicolor_T color); +void gui_mch_set_sp_color(guicolor_T color); +void gui_mch_set_transparency(int alpha); +void im_set_font(LOGFONT *lf); +void im_set_position(int row, int col); +void im_set_active(int active); +int im_get_status(void); +void gui_mch_draw_string(int row, int col, char_u *text, int len, int flags); +void gui_mch_flush(void); +int gui_mch_get_charwidth(int c); +void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); +void gui_mch_add_menu(vimmenu_T *menu, int pos); +void gui_mch_show_popupmenu(vimmenu_T *menu); +void gui_make_popup(char_u *path_name, int mouse_pos); +void gui_make_tearoff(char_u *path_name); +void gui_mch_add_menu_item(vimmenu_T *menu, int idx); +void gui_mch_destroy_menu(vimmenu_T *menu); +void gui_mch_menu_grey(vimmenu_T *menu, int grey); +int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd); +void gui_mch_set_foreground(void); +void gui_mch_drawsign(int row, int col, int typenr); +void *gui_mch_register_sign(char_u *signfile); +void gui_mch_destroy_sign(void *sign); +int multiline_balloon_available(void); +void gui_mch_disable_beval_area(BalloonEval *beval); +void gui_mch_enable_beval_area(BalloonEval *beval); +void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg); +BalloonEval *gui_mch_create_beval_area(void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData); +void gui_mch_destroy_beval_area(BalloonEval *beval); +void netbeans_draw_multisign_indicator(int row); /* vim: set ft=c : */ diff --git a/src/proto/gui_x11.pro b/src/proto/gui_x11.pro index d0aec94d60..955f374a66 100644 --- a/src/proto/gui_x11.pro +++ b/src/proto/gui_x11.pro @@ -1,70 +1,73 @@ /* gui_x11.c */ -void gui_x11_key_hit_cb __ARGS((Widget w, XtPointer dud, XEvent *event, Boolean *dum)); -void gui_mch_prepare __ARGS((int *argc, char **argv)); -int gui_mch_init_check __ARGS((void)); -int gui_mch_init __ARGS((void)); -void gui_mch_uninit __ARGS((void)); -void gui_mch_new_colors __ARGS((void)); -int gui_mch_open __ARGS((void)); -void gui_init_tooltip_font __ARGS((void)); -void gui_init_menu_font __ARGS((void)); -void gui_mch_exit __ARGS((int rc)); -int gui_mch_get_winpos __ARGS((int *x, int *y)); -void gui_mch_set_winpos __ARGS((int x, int y)); -void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); -void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); -int gui_mch_init_font __ARGS((char_u *font_name, int do_fontset)); -GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing)); -char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name)); -int gui_mch_adjust_charheight __ARGS((void)); -void gui_mch_set_font __ARGS((GuiFont font)); -void gui_mch_set_fontset __ARGS((GuiFontset fontset)); -void gui_mch_free_font __ARGS((GuiFont font)); -void gui_mch_free_fontset __ARGS((GuiFontset fontset)); -GuiFontset gui_mch_get_fontset __ARGS((char_u *name, int giveErrorIfMissing, int fixed_width)); -int fontset_height __ARGS((XFontSet fs)); -int fontset_height2 __ARGS((XFontSet fs)); -guicolor_T gui_mch_get_color __ARGS((char_u *reqname)); -void gui_mch_set_fg_color __ARGS((guicolor_T color)); -void gui_mch_set_bg_color __ARGS((guicolor_T color)); -void gui_mch_set_sp_color __ARGS((guicolor_T color)); -void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags)); -int gui_mch_haskey __ARGS((char_u *name)); -int gui_get_x11_windis __ARGS((Window *win, Display **dis)); -void gui_mch_beep __ARGS((void)); -void gui_mch_flash __ARGS((int msec)); -void gui_mch_invert_rectangle __ARGS((int r, int c, int nr, int nc)); -void gui_mch_iconify __ARGS((void)); -void gui_mch_set_foreground __ARGS((void)); -void gui_mch_draw_hollow_cursor __ARGS((guicolor_T color)); -void gui_mch_draw_part_cursor __ARGS((int w, int h, guicolor_T color)); -void gui_mch_update __ARGS((void)); -int gui_mch_wait_for_chars __ARGS((long wtime)); -void gui_mch_flush __ARGS((void)); -void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2)); -void gui_mch_clear_all __ARGS((void)); -void gui_mch_delete_lines __ARGS((int row, int num_lines)); -void gui_mch_insert_lines __ARGS((int row, int num_lines)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); -void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey)); -void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); -void gui_mch_draw_menubar __ARGS((void)); -void gui_x11_menu_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); -void gui_mch_set_blinking __ARGS((long waittime, long on, long off)); -void gui_mch_stop_blink __ARGS((void)); -void gui_mch_start_blink __ARGS((void)); -long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -void gui_x11_callbacks __ARGS((Widget textArea, Widget vimForm)); -void gui_mch_getmouse __ARGS((int *x, int *y)); -void gui_mch_setmouse __ARGS((int x, int y)); -XButtonPressedEvent *gui_x11_get_last_mouse_event __ARGS((void)); -void gui_mch_drawsign __ARGS((int row, int col, int typenr)); -void *gui_mch_register_sign __ARGS((char_u *signfile)); -void gui_mch_destroy_sign __ARGS((void *sign)); -void gui_mch_mousehide __ARGS((int hide)); -void mch_set_mouse_shape __ARGS((int shape)); -void gui_mch_menu_set_tip __ARGS((vimmenu_T *menu)); +void gui_x11_key_hit_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum); +void gui_mch_prepare(int *argc, char **argv); +int gui_mch_init_check(void); +int gui_mch_init(void); +void gui_mch_uninit(void); +void gui_mch_new_colors(void); +int gui_mch_open(void); +void gui_init_tooltip_font(void); +void gui_init_menu_font(void); +void gui_mch_exit(int rc); +int gui_mch_get_winpos(int *x, int *y); +void gui_mch_set_winpos(int x, int y); +void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction); +void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h); +int gui_mch_init_font(char_u *font_name, int do_fontset); +GuiFont gui_mch_get_font(char_u *name, int giveErrorIfMissing); +char_u *gui_mch_get_fontname(GuiFont font, char_u *name); +int gui_mch_adjust_charheight(void); +void gui_mch_set_font(GuiFont font); +void gui_mch_set_fontset(GuiFontset fontset); +void gui_mch_free_font(GuiFont font); +void gui_mch_free_fontset(GuiFontset fontset); +GuiFontset gui_mch_get_fontset(char_u *name, int giveErrorIfMissing, int fixed_width); +int fontset_height(XFontSet fs); +int fontset_height2(XFontSet fs); +guicolor_T gui_mch_get_color(char_u *name); +guicolor_T gui_mch_get_rgb_color(int r, int g, int b); +void gui_mch_set_fg_color(guicolor_T color); +void gui_mch_set_bg_color(guicolor_T color); +void gui_mch_set_sp_color(guicolor_T color); +void gui_mch_draw_string(int row, int col, char_u *s, int len, int flags); +int gui_mch_haskey(char_u *name); +int gui_get_x11_windis(Window *win, Display **dis); +void gui_mch_beep(void); +void gui_mch_flash(int msec); +void gui_mch_invert_rectangle(int r, int c, int nr, int nc); +void gui_mch_iconify(void); +void gui_mch_set_foreground(void); +void gui_mch_draw_hollow_cursor(guicolor_T color); +void gui_mch_draw_part_cursor(int w, int h, guicolor_T color); +void gui_mch_update(void); +int gui_mch_wait_for_chars(long wtime); +void gui_mch_flush(void); +void gui_mch_clear_block(int row1, int col1, int row2, int col2); +void gui_mch_clear_all(void); +void gui_mch_delete_lines(int row, int num_lines); +void gui_mch_insert_lines(int row, int num_lines); +void clip_mch_lose_selection(VimClipboard *cbd); +int clip_mch_own_selection(VimClipboard *cbd); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); +void gui_mch_menu_grey(vimmenu_T *menu, int grey); +void gui_mch_menu_hidden(vimmenu_T *menu, int hidden); +void gui_mch_draw_menubar(void); +void gui_x11_menu_cb(Widget w, XtPointer client_data, XtPointer call_data); +int gui_mch_is_blinking(void); +int gui_mch_is_blink_off(void); +void gui_mch_set_blinking(long waittime, long on, long off); +void gui_mch_stop_blink(int may_call_gui_update_cursor); +void gui_mch_start_blink(void); +guicolor_T gui_mch_get_rgb(guicolor_T pixel); +void gui_x11_callbacks(Widget textArea, Widget vimForm); +void gui_mch_getmouse(int *x, int *y); +void gui_mch_setmouse(int x, int y); +XButtonPressedEvent *gui_x11_get_last_mouse_event(void); +void gui_mch_drawsign(int row, int col, int typenr); +void *gui_mch_register_sign(char_u *signfile); +void gui_mch_destroy_sign(void *sign); +void gui_mch_mousehide(int hide); +void mch_set_mouse_shape(int shape); +void gui_mch_menu_set_tip(vimmenu_T *menu); /* vim: set ft=c : */ diff --git a/src/proto/gui_xmdlg.pro b/src/proto/gui_xmdlg.pro index 4f88c2ff17..256fad78c9 100644 --- a/src/proto/gui_xmdlg.pro +++ b/src/proto/gui_xmdlg.pro @@ -1,3 +1,3 @@ /* gui_xmdlg.c */ -char_u *gui_xm_select_font __ARGS((char_u *current)); +char_u *gui_xm_select_font(char_u *current); /* vim: set ft=c : */ diff --git a/src/proto/hangulin.pro b/src/proto/hangulin.pro index adfde142ff..3aef39df4a 100644 --- a/src/proto/hangulin.pro +++ b/src/proto/hangulin.pro @@ -1,9 +1,11 @@ /* hangulin.c */ -int hangul_input_state_get __ARGS((void)); -void hangul_input_state_set __ARGS((int state)); -int im_get_status __ARGS((void)); -void hangul_input_state_toggle __ARGS((void)); -void hangul_keyboard_set __ARGS((void)); -int hangul_input_process __ARGS((char_u *s, int len)); -void hangul_input_clear __ARGS((void)); +int hangul_input_state_get(void); +void hangul_input_state_set(int state); +int im_get_status(void); +void hangul_input_state_toggle(void); +void hangul_keyboard_set(void); +int hangul_input_process(char_u *s, int len); +void hangul_input_clear(void); +char_u *hangul_string_convert(char_u *buf, int *p_len); +char_u *hangul_composing_buffer_get(int *p_len); /* vim: set ft=c : */ diff --git a/src/proto/hardcopy.pro b/src/proto/hardcopy.pro index ff9d320183..d2c68ff8c0 100644 --- a/src/proto/hardcopy.pro +++ b/src/proto/hardcopy.pro @@ -1,20 +1,20 @@ /* hardcopy.c */ -char_u *parse_printoptions __ARGS((void)); -char_u *parse_printmbfont __ARGS((void)); -int prt_header_height __ARGS((void)); -int prt_use_number __ARGS((void)); -int prt_get_unit __ARGS((int idx)); -void ex_hardcopy __ARGS((exarg_T *eap)); -void mch_print_cleanup __ARGS((void)); -int mch_print_init __ARGS((prt_settings_T *psettings, char_u *jobname, int forceit)); -int mch_print_begin __ARGS((prt_settings_T *psettings)); -void mch_print_end __ARGS((prt_settings_T *psettings)); -int mch_print_end_page __ARGS((void)); -int mch_print_begin_page __ARGS((char_u *str)); -int mch_print_blank_page __ARGS((void)); -void mch_print_start_line __ARGS((int margin, int page_line)); -int mch_print_text_out __ARGS((char_u *p, int len)); -void mch_print_set_font __ARGS((int iBold, int iItalic, int iUnderline)); -void mch_print_set_bg __ARGS((long_u bgcol)); -void mch_print_set_fg __ARGS((long_u fgcol)); +char_u *parse_printoptions(void); +char_u *parse_printmbfont(void); +int prt_header_height(void); +int prt_use_number(void); +int prt_get_unit(int idx); +void ex_hardcopy(exarg_T *eap); +void mch_print_cleanup(void); +int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit); +int mch_print_begin(prt_settings_T *psettings); +void mch_print_end(prt_settings_T *psettings); +int mch_print_end_page(void); +int mch_print_begin_page(char_u *str); +int mch_print_blank_page(void); +void mch_print_start_line(int margin, int page_line); +int mch_print_text_out(char_u *p, int len); +void mch_print_set_font(int iBold, int iItalic, int iUnderline); +void mch_print_set_bg(long_u bgcol); +void mch_print_set_fg(long_u fgcol); /* vim: set ft=c : */ diff --git a/src/proto/hashtab.pro b/src/proto/hashtab.pro index e3c22b726a..96907147d1 100644 --- a/src/proto/hashtab.pro +++ b/src/proto/hashtab.pro @@ -1,14 +1,14 @@ /* hashtab.c */ -void hash_init __ARGS((hashtab_T *ht)); -void hash_clear __ARGS((hashtab_T *ht)); -void hash_clear_all __ARGS((hashtab_T *ht, int off)); -hashitem_T *hash_find __ARGS((hashtab_T *ht, char_u *key)); -hashitem_T *hash_lookup __ARGS((hashtab_T *ht, char_u *key, hash_T hash)); -void hash_debug_results __ARGS((void)); -int hash_add __ARGS((hashtab_T *ht, char_u *key)); -int hash_add_item __ARGS((hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash)); -void hash_remove __ARGS((hashtab_T *ht, hashitem_T *hi)); -void hash_lock __ARGS((hashtab_T *ht)); -void hash_unlock __ARGS((hashtab_T *ht)); -hash_T hash_hash __ARGS((char_u *key)); +void hash_init(hashtab_T *ht); +void hash_clear(hashtab_T *ht); +void hash_clear_all(hashtab_T *ht, int off); +hashitem_T *hash_find(hashtab_T *ht, char_u *key); +hashitem_T *hash_lookup(hashtab_T *ht, char_u *key, hash_T hash); +void hash_debug_results(void); +int hash_add(hashtab_T *ht, char_u *key); +int hash_add_item(hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash); +void hash_remove(hashtab_T *ht, hashitem_T *hi); +void hash_lock(hashtab_T *ht); +void hash_unlock(hashtab_T *ht); +hash_T hash_hash(char_u *key); /* vim: set ft=c : */ diff --git a/src/proto/if_cscope.pro b/src/proto/if_cscope.pro index af2c076a33..f9919c4da7 100644 --- a/src/proto/if_cscope.pro +++ b/src/proto/if_cscope.pro @@ -1,12 +1,12 @@ /* if_cscope.c */ -char_u *get_cscope_name __ARGS((expand_T *xp, int idx)); -void set_context_in_cscope_cmd __ARGS((expand_T *xp, char_u *arg, cmdidx_T cmdidx)); -void do_cscope __ARGS((exarg_T *eap)); -void do_scscope __ARGS((exarg_T *eap)); -void do_cstag __ARGS((exarg_T *eap)); -int cs_fgets __ARGS((char_u *buf, int size)); -void cs_free_tags __ARGS((void)); -void cs_print_tags __ARGS((void)); -int cs_connection __ARGS((int num, char_u *dbpath, char_u *ppath)); -void cs_end __ARGS((void)); +char_u *get_cscope_name(expand_T *xp, int idx); +void set_context_in_cscope_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx); +void ex_cscope(exarg_T *eap); +void ex_scscope(exarg_T *eap); +void ex_cstag(exarg_T *eap); +int cs_fgets(char_u *buf, int size); +void cs_free_tags(void); +void cs_print_tags(void); +int cs_connection(int num, char_u *dbpath, char_u *ppath); +void cs_end(void); /* vim: set ft=c : */ diff --git a/src/proto/if_lua.pro b/src/proto/if_lua.pro index 8db66a693e..c33678e13d 100644 --- a/src/proto/if_lua.pro +++ b/src/proto/if_lua.pro @@ -1,11 +1,11 @@ /* if_lua.c */ -int lua_enabled __ARGS((int verbose)); -void lua_end __ARGS((void)); -void ex_lua __ARGS((exarg_T *eap)); -void ex_luado __ARGS((exarg_T *eap)); -void ex_luafile __ARGS((exarg_T *eap)); -void lua_buffer_free __ARGS((buf_T *buf)); -void lua_window_free __ARGS((win_T *win)); -void do_luaeval __ARGS((char_u *str, typval_T *arg, typval_T *rettv)); -void set_ref_in_lua __ARGS((int copyID)); +int lua_enabled(int verbose); +void lua_end(void); +void ex_lua(exarg_T *eap); +void ex_luado(exarg_T *eap); +void ex_luafile(exarg_T *eap); +void lua_buffer_free(buf_T *o); +void lua_window_free(win_T *o); +void do_luaeval(char_u *str, typval_T *arg, typval_T *rettv); +int set_ref_in_lua(int copyID); /* vim: set ft=c : */ diff --git a/src/proto/if_lua52.pro b/src/proto/if_lua52.pro new file mode 100644 index 0000000000..e56a800116 --- /dev/null +++ b/src/proto/if_lua52.pro @@ -0,0 +1,11 @@ +/* if_lua52.c */ +int lua52_enabled(int verbose); +void lua52_end(void); +void ex_lua52(exarg_T *eap); +void ex_lua52do(exarg_T *eap); +void ex_lua52file(exarg_T *eap); +void lua52_buffer_free(buf_T *buf); +void lua52_window_free(win_T *win); +void do_lua52eval(char_u *str, typval_T *arg, typval_T *rettv); +int set_ref_in_lua52(int copyID); +/* vim: set ft=c : */ diff --git a/src/proto/if_mzsch.pro b/src/proto/if_mzsch.pro index d1180bfa1e..bab82cef3f 100644 --- a/src/proto/if_mzsch.pro +++ b/src/proto/if_mzsch.pro @@ -1,20 +1,17 @@ /* if_mzsch.c */ -int mzscheme_enabled __ARGS((int verbose)); -void mzscheme_end __ARGS((void)); -void ex_mzscheme __ARGS((exarg_T *eap)); -void ex_mzfile __ARGS((exarg_T *eap)); -void mzscheme_buffer_free __ARGS((buf_T *buf)); -void mzscheme_window_free __ARGS((win_T *win)); -char *mzscheme_version __ARGS((void)); +int mzscheme_enabled(int verbose); +void mzvim_check_threads(void); +void mzvim_reset_timer(void); +void mzscheme_end(void); +int mzscheme_main(void); +void mzscheme_buffer_free(buf_T *buf); +void mzscheme_window_free(win_T *win); +void ex_mzscheme(exarg_T *eap); +void ex_mzfile(exarg_T *eap); +void do_mzeval(char_u *str, typval_T *rettv); void raise_vim_exn(const char *add_info); -void raise_if_error __ARGS((void)); -buf_T *get_valid_buffer __ARGS((void *)); -win_T *get_valid_window __ARGS((void *)); -void mzvim_check_threads __ARGS((void)); -void mzvim_reset_timer __ARGS((void)); -void *mzvim_eval_string __ARGS((char_u *str)); -int mzthreads_allowed __ARGS((void)); -int mzscheme_main __ARGS((int argc, char **argv)); -void do_mzeval __ARGS((char_u *str, typval_T *rettv)); -int vim_main2 __ARGS((int argc, char **argv)); +void raise_if_error(void); +buf_T *get_valid_buffer(void *obj); +win_T *get_valid_window(void *obj); +int mzthreads_allowed(void); /* vim: set ft=c : */ diff --git a/src/proto/if_ole.pro b/src/proto/if_ole.pro index 36edcb0d27..adedf6aba0 100644 --- a/src/proto/if_ole.pro +++ b/src/proto/if_ole.pro @@ -1,5 +1,5 @@ /* if_ole.cpp */ -void InitOLE __ARGS((int* pbDoRestart)); -void UninitOLE __ARGS((void)); -void RegisterMe __ARGS((int silent)); -void UnregisterMe __ARGS((int bNotifyUser)); +void InitOLE(int* pbDoRestart); +void UninitOLE(void); +void RegisterMe(int silent); +void UnregisterMe(int bNotifyUser); diff --git a/src/proto/if_perl.pro b/src/proto/if_perl.pro index fe0301b0b0..066c0db254 100644 --- a/src/proto/if_perl.pro +++ b/src/proto/if_perl.pro @@ -1,8 +1,9 @@ /* auto/if_perl.c */ -int perl_enabled __ARGS((int verbose)); -void perl_end __ARGS((void)); -void msg_split __ARGS((char_u *s, int attr)); -void perl_win_free __ARGS((win_T *wp)); -void perl_buf_free __ARGS((buf_T *bp)); -void ex_perl __ARGS((exarg_T *eap)); -void ex_perldo __ARGS((exarg_T *eap)); +int perl_enabled(int verbose); +void perl_end(void); +void msg_split(char_u *s, int attr); +void perl_win_free(win_T *wp); +void perl_buf_free(buf_T *bp); +void ex_perl(exarg_T *eap); +void do_perleval(char_u *str, typval_T *rettv); +void ex_perldo(exarg_T *eap); diff --git a/src/proto/if_perlsfio.pro b/src/proto/if_perlsfio.pro index bb9046809f..df8e43887b 100644 --- a/src/proto/if_perlsfio.pro +++ b/src/proto/if_perlsfio.pro @@ -1,3 +1,3 @@ /* if_perlsfio.c */ -int *sfdcnewvim __ARGS((void)); +int *sfdcnewvim(void); /* vim: set ft=c : */ diff --git a/src/proto/if_python.pro b/src/proto/if_python.pro index 369a5d8955..51054caf2d 100644 --- a/src/proto/if_python.pro +++ b/src/proto/if_python.pro @@ -1,13 +1,13 @@ /* if_python.c */ -int python_enabled __ARGS((int verbose)); -void python_end __ARGS((void)); -int python_loaded __ARGS((void)); -void ex_python __ARGS((exarg_T *eap)); -void ex_pyfile __ARGS((exarg_T *eap)); -void ex_pydo __ARGS((exarg_T *eap)); -void python_buffer_free __ARGS((buf_T *buf)); -void python_window_free __ARGS((win_T *win)); -void python_tabpage_free __ARGS((tabpage_T *tab)); -void do_pyeval __ARGS((char_u *str, typval_T *rettv)); -void set_ref_in_python __ARGS((int copyID)); +int python_enabled(int verbose); +void python_end(void); +int python_loaded(void); +void ex_python(exarg_T *eap); +void ex_pyfile(exarg_T *eap); +void ex_pydo(exarg_T *eap); +void python_buffer_free(buf_T *buf); +void python_window_free(win_T *win); +void python_tabpage_free(tabpage_T *tab); +void do_pyeval(char_u *str, typval_T *rettv); +int set_ref_in_python(int copyID); /* vim: set ft=c : */ diff --git a/src/proto/if_python3.pro b/src/proto/if_python3.pro index 1e2a522fbb..4e71ad2a05 100644 --- a/src/proto/if_python3.pro +++ b/src/proto/if_python3.pro @@ -1,13 +1,13 @@ /* if_python3.c */ -int python3_enabled __ARGS((int verbose)); -void python3_end __ARGS((void)); -int python3_loaded __ARGS((void)); -void ex_py3 __ARGS((exarg_T *eap)); -void ex_py3file __ARGS((exarg_T *eap)); -void ex_py3do __ARGS((exarg_T *eap)); -void python3_buffer_free __ARGS((buf_T *buf)); -void python3_window_free __ARGS((win_T *win)); -void python3_tabpage_free __ARGS((tabpage_T *tab)); -void do_py3eval __ARGS((char_u *str, typval_T *rettv)); -void set_ref_in_python3 __ARGS((int copyID)); +int python3_enabled(int verbose); +void python3_end(void); +int python3_loaded(void); +void ex_py3(exarg_T *eap); +void ex_py3file(exarg_T *eap); +void ex_py3do(exarg_T *eap); +void python3_buffer_free(buf_T *buf); +void python3_window_free(win_T *win); +void python3_tabpage_free(tabpage_T *tab); +void do_py3eval(char_u *str, typval_T *rettv); +int set_ref_in_python3(int copyID); /* vim: set ft=c : */ diff --git a/src/proto/if_ruby.pro b/src/proto/if_ruby.pro index 3e03b1f091..496859ce5d 100644 --- a/src/proto/if_ruby.pro +++ b/src/proto/if_ruby.pro @@ -1,10 +1,10 @@ /* if_ruby.c */ -int ruby_enabled __ARGS((int verbose)); -void ruby_end __ARGS((void)); -void ex_ruby __ARGS((exarg_T *eap)); -void ex_rubydo __ARGS((exarg_T *eap)); -void ex_rubyfile __ARGS((exarg_T *eap)); -void ruby_buffer_free __ARGS((buf_T *buf)); -void ruby_window_free __ARGS((win_T *win)); -void vim_ruby_init __ARGS((void *stack_start)); +int ruby_enabled(int verbose); +void ruby_end(void); +void ex_ruby(exarg_T *eap); +void ex_rubydo(exarg_T *eap); +void ex_rubyfile(exarg_T *eap); +void ruby_buffer_free(buf_T *buf); +void ruby_window_free(win_T *win); +void vim_ruby_init(void *stack_start); /* vim: set ft=c : */ diff --git a/src/proto/if_tcl.pro b/src/proto/if_tcl.pro index 0679ed41a6..b572fb84ca 100644 --- a/src/proto/if_tcl.pro +++ b/src/proto/if_tcl.pro @@ -1,10 +1,10 @@ /* if_tcl.c */ -void vim_tcl_init __ARGS((char *arg)); -int tcl_enabled __ARGS((int verbose)); -void tcl_end __ARGS((void)); -void ex_tcl __ARGS((exarg_T *eap)); -void ex_tclfile __ARGS((exarg_T *eap)); -void ex_tcldo __ARGS((exarg_T *eap)); -void tcl_buffer_free __ARGS((buf_T *buf)); -void tcl_window_free __ARGS((win_T *win)); +void vim_tcl_init(char *arg); +int tcl_enabled(int verbose); +void tcl_end(void); +void ex_tcl(exarg_T *eap); +void ex_tclfile(exarg_T *eap); +void ex_tcldo(exarg_T *eap); +void tcl_buffer_free(buf_T *buf); +void tcl_window_free(win_T *win); /* vim: set ft=c : */ diff --git a/src/proto/if_xcmdsrv.pro b/src/proto/if_xcmdsrv.pro index dd6a12084d..801dc00e0c 100644 --- a/src/proto/if_xcmdsrv.pro +++ b/src/proto/if_xcmdsrv.pro @@ -1,11 +1,13 @@ /* if_xcmdsrv.c */ -int serverRegisterName __ARGS((Display *dpy, char_u *name)); -void serverChangeRegisteredWindow __ARGS((Display *dpy, Window newwin)); -int serverSendToVim __ARGS((Display *dpy, char_u *name, char_u *cmd, char_u **result, Window *server, int asExpr, int localLoop, int silent)); -char_u *serverGetVimNames __ARGS((Display *dpy)); -Window serverStrToWin __ARGS((char_u *str)); -int serverSendReply __ARGS((char_u *name, char_u *str)); -int serverReadReply __ARGS((Display *dpy, Window win, char_u **str, int localLoop)); -int serverPeekReply __ARGS((Display *dpy, Window win, char_u **str)); -void serverEventProc __ARGS((Display *dpy, XEvent *eventPtr)); +int serverRegisterName(Display *dpy, char_u *name); +void serverChangeRegisteredWindow(Display *dpy, Window newwin); +int serverSendToVim(Display *dpy, char_u *name, char_u *cmd, char_u **result, Window *server, int asExpr, int timeout, int localLoop, int silent); +char_u *serverGetVimNames(Display *dpy); +Window serverStrToWin(char_u *str); +int serverSendReply(char_u *name, char_u *str); +int serverReadReply(Display *dpy, Window win, char_u **str, int localLoop, int timeout); +int serverPeekReply(Display *dpy, Window win, char_u **str); +void serverEventProc(Display *dpy, XEvent *eventPtr, int immediate); +void server_parse_messages(void); +int server_waiting(void); /* vim: set ft=c : */ diff --git a/src/proto/json.pro b/src/proto/json.pro new file mode 100644 index 0000000000..b98c2c9fb4 --- /dev/null +++ b/src/proto/json.pro @@ -0,0 +1,7 @@ +/* json.c */ +char_u *json_encode(typval_T *val, int options); +char_u *json_encode_nr_expr(int nr, typval_T *val, int options); +int json_decode_all(js_read_T *reader, typval_T *res, int options); +int json_decode(js_read_T *reader, typval_T *res, int options); +int json_find_end(js_read_T *reader, int options); +/* vim: set ft=c : */ diff --git a/src/proto/list.pro b/src/proto/list.pro new file mode 100644 index 0000000000..c4fd195f1f --- /dev/null +++ b/src/proto/list.pro @@ -0,0 +1,38 @@ +/* list.c */ +void list_add_watch(list_T *l, listwatch_T *lw); +void list_rem_watch(list_T *l, listwatch_T *lwrem); +void list_fix_watch(list_T *l, listitem_T *item); +list_T *list_alloc(void); +int rettv_list_alloc(typval_T *rettv); +void rettv_list_set(typval_T *rettv, list_T *l); +void list_unref(list_T *l); +int list_free_nonref(int copyID); +void list_free_items(int copyID); +void list_free(list_T *l); +listitem_T *listitem_alloc(void); +void listitem_free(listitem_T *item); +void listitem_remove(list_T *l, listitem_T *item); +long list_len(list_T *l); +int list_equal(list_T *l1, list_T *l2, int ic, int recursive); +listitem_T *list_find(list_T *l, long n); +long list_find_nr(list_T *l, long idx, int *errorp); +char_u *list_find_str(list_T *l, long idx); +long list_idx_of_item(list_T *l, listitem_T *item); +void list_append(list_T *l, listitem_T *item); +int list_append_tv(list_T *l, typval_T *tv); +int list_append_dict(list_T *list, dict_T *dict); +int list_append_list(list_T *list1, list_T *list2); +int list_append_string(list_T *l, char_u *str, int len); +int list_append_number(list_T *l, varnumber_T n); +int list_insert_tv(list_T *l, typval_T *tv, listitem_T *item); +void list_insert(list_T *l, listitem_T *ni, listitem_T *item); +int list_extend(list_T *l1, list_T *l2, listitem_T *bef); +int list_concat(list_T *l1, list_T *l2, typval_T *tv); +list_T *list_copy(list_T *orig, int deep, int copyID); +void vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2); +char_u *list2string(typval_T *tv, int copyID, int restore_copyID); +int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int restore_copyID, int copyID); +int get_list_tv(char_u **arg, typval_T *rettv, int evaluate); +int write_list(FILE *fd, list_T *list, int binary); +void init_static_list(staticList10_T *sl); +/* vim: set ft=c : */ diff --git a/src/proto/main.pro b/src/proto/main.pro index 62e80b87fd..278d1addfd 100644 --- a/src/proto/main.pro +++ b/src/proto/main.pro @@ -1,26 +1,17 @@ /* main.c */ -void main_loop __ARGS((int cmdwin, int noexmode)); -void getout_preserve_modified __ARGS((int exitval)); -void getout __ARGS((int exitval)); -int process_env __ARGS((char_u *env, int is_viminit)); -void mainerr_arg_missing __ARGS((char_u *str)); -void time_push __ARGS((void *tv_rel, void *tv_start)); -void time_pop __ARGS((void *tp)); -void time_msg __ARGS((char *mesg, void *tv_start)); -void server_to_input_buf __ARGS((char_u *str)); -char_u *eval_client_expr_to_string __ARGS((char_u *expr)); -char_u *serverConvert __ARGS((char_u *client_enc, char_u *data, char_u **tofree)); -int toF_TyA __ARGS((int c)); -int fkmap __ARGS((int c)); -void conv_to_pvim __ARGS((void)); -void conv_to_pstd __ARGS((void)); -char_u *lrswap __ARGS((char_u *ibuf)); -char_u *lrFswap __ARGS((char_u *cmdbuf, int len)); -char_u *lrF_sub __ARGS((char_u *ibuf)); -int cmdl_fkmap __ARGS((int c)); -int F_isalpha __ARGS((int c)); -int F_isdigit __ARGS((int c)); -int F_ischar __ARGS((int c)); -void farsi_fkey __ARGS((cmdarg_T *cap)); -int arabic_shape __ARGS((int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c)); +int vim_main2(void); +void common_init(mparm_T *paramp); +int is_not_a_term(void); +void main_loop(int cmdwin, int noexmode); +void getout_preserve_modified(int exitval); +void getout(int exitval); +int process_env(char_u *env, int is_viminit); +void mainerr_arg_missing(char_u *str); +void time_push(void *tv_rel, void *tv_start); +void time_pop(void *tp); +void time_msg(char *mesg, void *tv_start); +void server_to_input_buf(char_u *str); +char_u *eval_client_expr_to_string(char_u *expr); +int sendToLocalVim(char_u *cmd, int asExpr, char_u **result); +char_u *serverConvert(char_u *client_enc, char_u *data, char_u **tofree); /* vim: set ft=c : */ diff --git a/src/proto/mark.pro b/src/proto/mark.pro index e8cef9dd26..623a0599e1 100644 --- a/src/proto/mark.pro +++ b/src/proto/mark.pro @@ -1,31 +1,38 @@ /* mark.c */ -int setmark __ARGS((int c)); -int setmark_pos __ARGS((int c, pos_T *pos, int fnum)); -void setpcmark __ARGS((void)); -void checkpcmark __ARGS((void)); -pos_T *movemark __ARGS((int count)); -pos_T *movechangelist __ARGS((int count)); -pos_T *getmark_buf __ARGS((buf_T *buf, int c, int changefile)); -pos_T *getmark __ARGS((int c, int changefile)); -pos_T *getmark_buf_fnum __ARGS((buf_T *buf, int c, int changefile, int *fnum)); -pos_T *getnextmark __ARGS((pos_T *startpos, int dir, int begin_line)); -void fmarks_check_names __ARGS((buf_T *buf)); -int check_mark __ARGS((pos_T *pos)); -void clrallmarks __ARGS((buf_T *buf)); -char_u *fm_getname __ARGS((fmark_T *fmark, int lead_len)); -void do_marks __ARGS((exarg_T *eap)); -void ex_delmarks __ARGS((exarg_T *eap)); -void ex_jumps __ARGS((exarg_T *eap)); -void ex_changes __ARGS((exarg_T *eap)); -void mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after)); -void mark_col_adjust __ARGS((linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount)); -void copy_jumplist __ARGS((win_T *from, win_T *to)); -void free_jumplist __ARGS((win_T *wp)); -void set_last_cursor __ARGS((win_T *win)); -void free_all_marks __ARGS((void)); -int read_viminfo_filemark __ARGS((vir_T *virp, int force)); -void write_viminfo_filemarks __ARGS((FILE *fp)); -int removable __ARGS((char_u *name)); -int write_viminfo_marks __ARGS((FILE *fp_out)); -void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags)); +int setmark(int c); +int setmark_pos(int c, pos_T *pos, int fnum); +void setpcmark(void); +void checkpcmark(void); +pos_T *movemark(int count); +pos_T *movechangelist(int count); +pos_T *getmark_buf(buf_T *buf, int c, int changefile); +pos_T *getmark(int c, int changefile); +pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum); +pos_T *getnextmark(pos_T *startpos, int dir, int begin_line); +void fname2fnum(xfmark_T *fm); +void fmarks_check_names(buf_T *buf); +int check_mark(pos_T *pos); +void clrallmarks(buf_T *buf); +char_u *fm_getname(fmark_T *fmark, int lead_len); +void do_marks(exarg_T *eap); +void ex_delmarks(exarg_T *eap); +void ex_jumps(exarg_T *eap); +void ex_clearjumps(exarg_T *eap); +void ex_changes(exarg_T *eap); +void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after); +void mark_adjust_nofold(linenr_T line1, linenr_T line2, long amount, long amount_after); +void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount); +void cleanup_jumplist(win_T *wp, int loadfiles); +void copy_jumplist(win_T *from, win_T *to); +void free_jumplist(win_T *wp); +void set_last_cursor(win_T *win); +void free_all_marks(void); +int read_viminfo_filemark(vir_T *virp, int force); +void prepare_viminfo_marks(void); +void finish_viminfo_marks(void); +void handle_viminfo_mark(garray_T *values, int force); +void write_viminfo_filemarks(FILE *fp); +int removable(char_u *name); +void write_viminfo_marks(FILE *fp_out, garray_T *buflist); +void copy_viminfo_marks(vir_T *virp, FILE *fp_out, garray_T *buflist, int eof, int flags); /* vim: set ft=c : */ diff --git a/src/proto/mbyte.pro b/src/proto/mbyte.pro index c599dacec9..b94f7b85b6 100644 --- a/src/proto/mbyte.pro +++ b/src/proto/mbyte.pro @@ -1,96 +1,105 @@ /* mbyte.c */ -int enc_canon_props __ARGS((char_u *name)); -char_u *mb_init __ARGS((void)); -int bomb_size __ARGS((void)); -void remove_bom __ARGS((char_u *s)); -int mb_get_class __ARGS((char_u *p)); -int mb_get_class_buf __ARGS((char_u *p, buf_T *buf)); -int dbcs_class __ARGS((unsigned lead, unsigned trail)); -int latin_char2len __ARGS((int c)); -int latin_char2bytes __ARGS((int c, char_u *buf)); -int latin_ptr2len __ARGS((char_u *p)); -int latin_ptr2len_len __ARGS((char_u *p, int size)); -int utf_char2cells __ARGS((int c)); -int latin_ptr2cells __ARGS((char_u *p)); -int utf_ptr2cells __ARGS((char_u *p)); -int dbcs_ptr2cells __ARGS((char_u *p)); -int latin_ptr2cells_len __ARGS((char_u *p, int size)); -int latin_char2cells __ARGS((int c)); -int mb_string2cells __ARGS((char_u *p, int len)); -int latin_off2cells __ARGS((unsigned off, unsigned max_off)); -int dbcs_off2cells __ARGS((unsigned off, unsigned max_off)); -int utf_off2cells __ARGS((unsigned off, unsigned max_off)); -int latin_ptr2char __ARGS((char_u *p)); -int utf_ptr2char __ARGS((char_u *p)); -int mb_ptr2char_adv __ARGS((char_u **pp)); -int mb_cptr2char_adv __ARGS((char_u **pp)); -int arabic_combine __ARGS((int one, int two)); -int arabic_maycombine __ARGS((int two)); -int utf_composinglike __ARGS((char_u *p1, char_u *p2)); -int utfc_ptr2char __ARGS((char_u *p, int *pcc)); -int utfc_ptr2char_len __ARGS((char_u *p, int *pcc, int maxlen)); -int utfc_char2bytes __ARGS((int off, char_u *buf)); -int utf_ptr2len __ARGS((char_u *p)); -int utf_byte2len __ARGS((int b)); -int utf_ptr2len_len __ARGS((char_u *p, int size)); -int utfc_ptr2len __ARGS((char_u *p)); -int utfc_ptr2len_len __ARGS((char_u *p, int size)); -int utf_char2len __ARGS((int c)); -int utf_char2bytes __ARGS((int c, char_u *buf)); -int utf_iscomposing __ARGS((int c)); -int utf_printable __ARGS((int c)); -int utf_class __ARGS((int c)); -int utf_fold __ARGS((int a)); -int utf_toupper __ARGS((int a)); -int utf_islower __ARGS((int a)); -int utf_tolower __ARGS((int a)); -int utf_isupper __ARGS((int a)); -int mb_strnicmp __ARGS((char_u *s1, char_u *s2, size_t nn)); -void show_utf8 __ARGS((void)); -int latin_head_off __ARGS((char_u *base, char_u *p)); -int dbcs_head_off __ARGS((char_u *base, char_u *p)); -int dbcs_screen_head_off __ARGS((char_u *base, char_u *p)); -int utf_head_off __ARGS((char_u *base, char_u *p)); -void mb_copy_char __ARGS((char_u **fp, char_u **tp)); -int mb_off_next __ARGS((char_u *base, char_u *p)); -int mb_tail_off __ARGS((char_u *base, char_u *p)); -void utf_find_illegal __ARGS((void)); -int utf_valid_string __ARGS((char_u *s, char_u *end)); -int dbcs_screen_tail_off __ARGS((char_u *base, char_u *p)); -void mb_adjust_cursor __ARGS((void)); -void mb_adjustpos __ARGS((buf_T *buf, pos_T *lp)); -char_u *mb_prevptr __ARGS((char_u *line, char_u *p)); -int mb_charlen __ARGS((char_u *str)); -int mb_charlen_len __ARGS((char_u *str, int len)); -char_u *mb_unescape __ARGS((char_u **pp)); -int mb_lefthalve __ARGS((int row, int col)); -int mb_fix_col __ARGS((int col, int row)); -char_u *enc_skip __ARGS((char_u *p)); -char_u *enc_canonize __ARGS((char_u *enc)); -char_u *enc_locale __ARGS((void)); -int encname2codepage __ARGS((char_u *name)); -void *my_iconv_open __ARGS((char_u *to, char_u *from)); -int iconv_enabled __ARGS((int verbose)); -void iconv_end __ARGS((void)); -void im_set_active __ARGS((int active)); -void xim_set_focus __ARGS((int focus)); -void im_set_position __ARGS((int row, int col)); -void xim_set_preedit __ARGS((void)); -int im_get_feedback_attr __ARGS((int col)); -void xim_init __ARGS((void)); -void im_shutdown __ARGS((void)); -int im_xim_isvalid_imactivate __ARGS((void)); -void xim_reset __ARGS((void)); -int xim_queue_key_press_event __ARGS((GdkEventKey *event, int down)); -int im_get_status __ARGS((void)); -int preedit_get_status __ARGS((void)); -int im_is_preediting __ARGS((void)); -void xim_set_status_area __ARGS((void)); -int xim_get_status_area_height __ARGS((void)); -int convert_setup __ARGS((vimconv_T *vcp, char_u *from, char_u *to)); -int convert_setup_ext __ARGS((vimconv_T *vcp, char_u *from, int from_unicode_is_utf8, char_u *to, int to_unicode_is_utf8)); -int convert_input __ARGS((char_u *ptr, int len, int maxlen)); -int convert_input_safe __ARGS((char_u *ptr, int len, int maxlen, char_u **restp, int *restlenp)); -char_u *string_convert __ARGS((vimconv_T *vcp, char_u *ptr, int *lenp)); -char_u *string_convert_ext __ARGS((vimconv_T *vcp, char_u *ptr, int *lenp, int *unconvlenp)); +int enc_canon_props(char_u *name); +char_u *mb_init(void); +int bomb_size(void); +void remove_bom(char_u *s); +int mb_get_class(char_u *p); +int mb_get_class_buf(char_u *p, buf_T *buf); +int dbcs_class(unsigned lead, unsigned trail); +int latin_char2len(int c); +int latin_char2bytes(int c, char_u *buf); +int latin_ptr2len(char_u *p); +int latin_ptr2len_len(char_u *p, int size); +int utf_uint2cells(UINT32_T c); +int utf_char2cells(int c); +int latin_ptr2cells(char_u *p); +int utf_ptr2cells(char_u *p); +int dbcs_ptr2cells(char_u *p); +int latin_ptr2cells_len(char_u *p, int size); +int latin_char2cells(int c); +int mb_string2cells(char_u *p, int len); +int latin_off2cells(unsigned off, unsigned max_off); +int dbcs_off2cells(unsigned off, unsigned max_off); +int utf_off2cells(unsigned off, unsigned max_off); +int latin_ptr2char(char_u *p); +int utf_ptr2char(char_u *p); +int mb_ptr2char_adv(char_u **pp); +int mb_cptr2char_adv(char_u **pp); +int arabic_combine(int one, int two); +int arabic_maycombine(int two); +int utf_composinglike(char_u *p1, char_u *p2); +int utfc_ptr2char(char_u *p, int *pcc); +int utfc_ptr2char_len(char_u *p, int *pcc, int maxlen); +int utfc_char2bytes(int off, char_u *buf); +int utf_ptr2len(char_u *p); +int utf_byte2len(int b); +int utf_ptr2len_len(char_u *p, int size); +int utfc_ptr2len(char_u *p); +int utfc_ptr2len_len(char_u *p, int size); +int utf_char2len(int c); +int utf_char2bytes(int c, char_u *buf); +int utf_iscomposing_uint(UINT32_T c); +int utf_iscomposing(int c); +int utf_printable(int c); +int utf_class(int c); +int utf_class_buf(int c, buf_T *buf); +int utf_ambiguous_width(int c); +int utf_fold(int a); +int utf_toupper(int a); +int utf_islower(int a); +int utf_tolower(int a); +int utf_isupper(int a); +int mb_strnicmp(char_u *s1, char_u *s2, size_t nn); +void show_utf8(void); +int latin_head_off(char_u *base, char_u *p); +int dbcs_head_off(char_u *base, char_u *p); +int dbcs_screen_head_off(char_u *base, char_u *p); +int utf_head_off(char_u *base, char_u *p); +void mb_copy_char(char_u **fp, char_u **tp); +int mb_off_next(char_u *base, char_u *p); +int mb_tail_off(char_u *base, char_u *p); +void utf_find_illegal(void); +int utf_valid_string(char_u *s, char_u *end); +int dbcs_screen_tail_off(char_u *base, char_u *p); +void mb_adjust_cursor(void); +void mb_adjustpos(buf_T *buf, pos_T *lp); +char_u *mb_prevptr(char_u *line, char_u *p); +int mb_charlen(char_u *str); +int mb_charlen_len(char_u *str, int len); +char_u *mb_unescape(char_u **pp); +int mb_lefthalve(int row, int col); +int mb_fix_col(int col, int row); +char_u *enc_skip(char_u *p); +char_u *enc_canonize(char_u *enc); +char_u *enc_locale_env(char *locale); +char_u *enc_locale(void); +int encname2codepage(char_u *name); +void *my_iconv_open(char_u *to, char_u *from); +int iconv_enabled(int verbose); +void iconv_end(void); +void im_set_active(int active); +void xim_set_focus(int focus); +void im_set_position(int row, int col); +void xim_set_preedit(void); +int im_get_feedback_attr(int col); +void xim_init(void); +void im_shutdown(void); +int im_xim_isvalid_imactivate(void); +void xim_reset(void); +int xim_queue_key_press_event(GdkEventKey *event, int down); +int im_get_status(void); +int preedit_get_status(void); +int im_is_preediting(void); +void xim_set_status_area(void); +int xim_get_status_area_height(void); +int convert_setup(vimconv_T *vcp, char_u *from, char_u *to); +int convert_setup_ext(vimconv_T *vcp, char_u *from, int from_unicode_is_utf8, char_u *to, int to_unicode_is_utf8); +int convert_input(char_u *ptr, int len, int maxlen); +int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp, int *restlenp); +char_u *string_convert(vimconv_T *vcp, char_u *ptr, int *lenp); +char_u *string_convert_ext(vimconv_T *vcp, char_u *ptr, int *lenp, int *unconvlenp); +#ifdef FEAT_GUI_MACVIM +void call_imactivatefunc(int active); +int call_imstatusfunc(void); +#endif /* vim: set ft=c : */ diff --git a/src/proto/memfile.pro b/src/proto/memfile.pro index 3983b4799c..4662194a70 100644 --- a/src/proto/memfile.pro +++ b/src/proto/memfile.pro @@ -1,18 +1,18 @@ /* memfile.c */ -memfile_T *mf_open __ARGS((char_u *fname, int flags)); -int mf_open_file __ARGS((memfile_T *mfp, char_u *fname)); -void mf_close __ARGS((memfile_T *mfp, int del_file)); -void mf_close_file __ARGS((buf_T *buf, int getlines)); -void mf_new_page_size __ARGS((memfile_T *mfp, unsigned new_size)); -bhdr_T *mf_new __ARGS((memfile_T *mfp, int negative, int page_count)); -bhdr_T *mf_get __ARGS((memfile_T *mfp, blocknr_T nr, int page_count)); -void mf_put __ARGS((memfile_T *mfp, bhdr_T *hp, int dirty, int infile)); -void mf_free __ARGS((memfile_T *mfp, bhdr_T *hp)); -int mf_sync __ARGS((memfile_T *mfp, int flags)); -void mf_set_dirty __ARGS((memfile_T *mfp)); -int mf_release_all __ARGS((void)); -blocknr_T mf_trans_del __ARGS((memfile_T *mfp, blocknr_T old_nr)); -void mf_set_ffname __ARGS((memfile_T *mfp)); -void mf_fullname __ARGS((memfile_T *mfp)); -int mf_need_trans __ARGS((memfile_T *mfp)); +memfile_T *mf_open(char_u *fname, int flags); +int mf_open_file(memfile_T *mfp, char_u *fname); +void mf_close(memfile_T *mfp, int del_file); +void mf_close_file(buf_T *buf, int getlines); +void mf_new_page_size(memfile_T *mfp, unsigned new_size); +bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count); +bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, int page_count); +void mf_put(memfile_T *mfp, bhdr_T *hp, int dirty, int infile); +void mf_free(memfile_T *mfp, bhdr_T *hp); +int mf_sync(memfile_T *mfp, int flags); +void mf_set_dirty(memfile_T *mfp); +int mf_release_all(void); +blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr); +void mf_set_ffname(memfile_T *mfp); +void mf_fullname(memfile_T *mfp); +int mf_need_trans(memfile_T *mfp); /* vim: set ft=c : */ diff --git a/src/proto/memline.pro b/src/proto/memline.pro index 62a3ce6408..bddb902f48 100644 --- a/src/proto/memline.pro +++ b/src/proto/memline.pro @@ -1,37 +1,37 @@ /* memline.c */ -int ml_open __ARGS((buf_T *buf)); -void ml_set_crypt_key __ARGS((buf_T *buf, char_u *old_key, int old_cm)); -void ml_setname __ARGS((buf_T *buf)); -void ml_open_files __ARGS((void)); -void ml_open_file __ARGS((buf_T *buf)); -void check_need_swap __ARGS((int newfile)); -void ml_close __ARGS((buf_T *buf, int del_file)); -void ml_close_all __ARGS((int del_file)); -void ml_close_notmod __ARGS((void)); -void ml_timestamp __ARGS((buf_T *buf)); -void ml_recover __ARGS((void)); -int recover_names __ARGS((char_u *fname, int list, int nr, char_u **fname_out)); -void ml_sync_all __ARGS((int check_file, int check_char)); -void ml_preserve __ARGS((buf_T *buf, int message)); -char_u *ml_get __ARGS((linenr_T lnum)); -char_u *ml_get_pos __ARGS((pos_T *pos)); -char_u *ml_get_curline __ARGS((void)); -char_u *ml_get_cursor __ARGS((void)); -char_u *ml_get_buf __ARGS((buf_T *buf, linenr_T lnum, int will_change)); -int ml_line_alloced __ARGS((void)); -int ml_append __ARGS((linenr_T lnum, char_u *line, colnr_T len, int newfile)); -int ml_append_buf __ARGS((buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, int newfile)); -int ml_replace __ARGS((linenr_T lnum, char_u *line, int copy)); -int ml_delete __ARGS((linenr_T lnum, int message)); -void ml_setmarked __ARGS((linenr_T lnum)); -linenr_T ml_firstmarked __ARGS((void)); -void ml_clearmarked __ARGS((void)); -int resolve_symlink __ARGS((char_u *fname, char_u *buf)); -char_u *makeswapname __ARGS((char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name)); -char_u *get_file_in_dir __ARGS((char_u *fname, char_u *dname)); -void ml_setflags __ARGS((buf_T *buf)); -char_u *ml_encrypt_data __ARGS((memfile_T *mfp, char_u *data, off_t offset, unsigned size)); -void ml_decrypt_data __ARGS((memfile_T *mfp, char_u *data, off_t offset, unsigned size)); -long ml_find_line_or_offset __ARGS((buf_T *buf, linenr_T lnum, long *offp)); -void goto_byte __ARGS((long cnt)); +int ml_open(buf_T *buf); +void ml_set_crypt_key(buf_T *buf, char_u *old_key, char_u *old_cm); +void ml_setname(buf_T *buf); +void ml_open_files(void); +void ml_open_file(buf_T *buf); +void check_need_swap(int newfile); +void ml_close(buf_T *buf, int del_file); +void ml_close_all(int del_file); +void ml_close_notmod(void); +void ml_timestamp(buf_T *buf); +void ml_recover(void); +int recover_names(char_u *fname, int list, int nr, char_u **fname_out); +void ml_sync_all(int check_file, int check_char); +void ml_preserve(buf_T *buf, int message); +char_u *ml_get(linenr_T lnum); +char_u *ml_get_pos(pos_T *pos); +char_u *ml_get_curline(void); +char_u *ml_get_cursor(void); +char_u *ml_get_buf(buf_T *buf, linenr_T lnum, int will_change); +int ml_line_alloced(void); +int ml_append(linenr_T lnum, char_u *line, colnr_T len, int newfile); +int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, int newfile); +int ml_replace(linenr_T lnum, char_u *line, int copy); +int ml_delete(linenr_T lnum, int message); +void ml_setmarked(linenr_T lnum); +linenr_T ml_firstmarked(void); +void ml_clearmarked(void); +int resolve_symlink(char_u *fname, char_u *buf); +char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name); +char_u *get_file_in_dir(char_u *fname, char_u *dname); +void ml_setflags(buf_T *buf); +char_u *ml_encrypt_data(memfile_T *mfp, char_u *data, off_T offset, unsigned size); +void ml_decrypt_data(memfile_T *mfp, char_u *data, off_T offset, unsigned size); +long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp); +void goto_byte(long cnt); /* vim: set ft=c : */ diff --git a/src/proto/menu.pro b/src/proto/menu.pro index f5df4e2891..f52f5f645e 100644 --- a/src/proto/menu.pro +++ b/src/proto/menu.pro @@ -1,27 +1,32 @@ /* menu.c */ -void ex_menu __ARGS((exarg_T *eap)); -char_u *set_context_in_menu_cmd __ARGS((expand_T *xp, char_u *cmd, char_u *arg, int forceit)); -char_u *get_menu_name __ARGS((expand_T *xp, int idx)); -char_u *get_menu_names __ARGS((expand_T *xp, int idx)); -char_u *menu_name_skip __ARGS((char_u *name)); -int get_menu_index __ARGS((vimmenu_T *menu, int state)); -int menu_is_menubar __ARGS((char_u *name)); -int menu_is_popup __ARGS((char_u *name)); -int menu_is_child_of_popup __ARGS((vimmenu_T *menu)); -int menu_is_toolbar __ARGS((char_u *name)); -int menu_is_separator __ARGS((char_u *name)); -int check_menu_pointer __ARGS((vimmenu_T *root, vimmenu_T *menu_to_check)); -void gui_create_initial_menus __ARGS((vimmenu_T *menu)); -void gui_update_menus __ARGS((int modes)); -int gui_is_menu_shortcut __ARGS((int key)); -void gui_show_popupmenu __ARGS((void)); -void gui_mch_toggle_tearoffs __ARGS((int enable)); -void ex_emenu __ARGS((exarg_T *eap)); -vimmenu_T *gui_find_menu __ARGS((char_u *path_name)); -void ex_menutranslate __ARGS((exarg_T *eap)); +int winbar_height(win_T *wp); +void ex_menu(exarg_T *eap); +void remove_winbar(win_T *wp); +char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forceit); +char_u *get_menu_name(expand_T *xp, int idx); +char_u *get_menu_names(expand_T *xp, int idx); +char_u *menu_name_skip(char_u *name); +int get_menu_index(vimmenu_T *menu, int state); +int menu_is_menubar(char_u *name); +int menu_is_popup(char_u *name); +int menu_is_child_of_popup(vimmenu_T *menu); +int menu_is_toolbar(char_u *name); +int menu_is_separator(char_u *name); +int get_menu_mode_flag(void); +void show_popupmenu(void); +int check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check); +void gui_create_initial_menus(vimmenu_T *menu); +void gui_update_menus(int modes); +int gui_is_menu_shortcut(int key); +void gui_mch_toggle_tearoffs(int enable); +void execute_menu(exarg_T *eap, vimmenu_T *menu); +void ex_emenu(exarg_T *eap); +void winbar_click(win_T *wp, int col); +vimmenu_T *gui_find_menu(char_u *path_name); +void ex_menutranslate(exarg_T *eap); #ifdef FEAT_GUI_MACVIM -void ex_macmenu __ARGS((exarg_T *eap)); -void ex_macmenukey __ARGS((exarg_T *eap)); -char_u *lookup_toolbar_item __ARGS((int idx)); +void ex_macmenu(exarg_T *eap); +void ex_macmenukey(exarg_T *eap); +char_u *lookup_toolbar_item(int idx); #endif /* vim: set ft=c : */ diff --git a/src/proto/message.pro b/src/proto/message.pro index f67b8e0313..f8b6f684c3 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -1,74 +1,86 @@ /* message.c */ -int msg __ARGS((char_u *s)); -int verb_msg __ARGS((char_u *s)); -int msg_attr __ARGS((char_u *s, int attr)); -int msg_attr_keep __ARGS((char_u *s, int attr, int keep)); -char_u *msg_strtrunc __ARGS((char_u *s, int force)); -void trunc_string __ARGS((char_u *s, char_u *buf, int room, int buflen)); -void reset_last_sourcing __ARGS((void)); -void msg_source __ARGS((int attr)); -int emsg_not_now __ARGS((void)); -int emsg __ARGS((char_u *s)); -int emsg2 __ARGS((char_u *s, char_u *a1)); -void emsg_invreg __ARGS((int name)); -char_u *msg_trunc_attr __ARGS((char_u *s, int force, int attr)); -char_u *msg_may_trunc __ARGS((int force, char_u *s)); -int delete_first_msg __ARGS((void)); -void ex_messages __ARGS((exarg_T *eap)); -void msg_end_prompt __ARGS((void)); -void wait_return __ARGS((int redraw)); -void set_keep_msg __ARGS((char_u *s, int attr)); -void set_keep_msg_from_hist __ARGS((void)); -void msg_start __ARGS((void)); -void msg_starthere __ARGS((void)); -void msg_putchar __ARGS((int c)); -void msg_putchar_attr __ARGS((int c, int attr)); -void msg_outnum __ARGS((long n)); -void msg_home_replace __ARGS((char_u *fname)); -void msg_home_replace_hl __ARGS((char_u *fname)); -int msg_outtrans __ARGS((char_u *str)); -int msg_outtrans_attr __ARGS((char_u *str, int attr)); -int msg_outtrans_len __ARGS((char_u *str, int len)); -char_u *msg_outtrans_one __ARGS((char_u *p, int attr)); -int msg_outtrans_len_attr __ARGS((char_u *msgstr, int len, int attr)); -void msg_make __ARGS((char_u *arg)); -int msg_outtrans_special __ARGS((char_u *strstart, int from)); -char_u *str2special_save __ARGS((char_u *str, int is_lhs)); -char_u *str2special __ARGS((char_u **sp, int from)); -void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len)); -void msg_prt_line __ARGS((char_u *s, int list)); -void msg_puts __ARGS((char_u *s)); -void msg_puts_title __ARGS((char_u *s)); -void msg_puts_long_attr __ARGS((char_u *longstr, int attr)); -void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr)); -void msg_puts_attr __ARGS((char_u *s, int attr)); -void may_clear_sb_text __ARGS((void)); -void clear_sb_text __ARGS((void)); -void show_sb_text __ARGS((void)); -void msg_sb_eol __ARGS((void)); -int msg_use_printf __ARGS((void)); -void mch_errmsg __ARGS((char *str)); -void mch_msg __ARGS((char *str)); -void msg_moremsg __ARGS((int full)); -void repeat_message __ARGS((void)); -void msg_clr_eos __ARGS((void)); -void msg_clr_eos_force __ARGS((void)); -void msg_clr_cmdline __ARGS((void)); -int msg_end __ARGS((void)); -void msg_check __ARGS((void)); -int redirecting __ARGS((void)); -void verbose_enter __ARGS((void)); -void verbose_leave __ARGS((void)); -void verbose_enter_scroll __ARGS((void)); -void verbose_leave_scroll __ARGS((void)); -void verbose_stop __ARGS((void)); -int verbose_open __ARGS((void)); -void give_warning __ARGS((char_u *message, int hl)); -void msg_advance __ARGS((int col)); -int do_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd)); -void display_confirm_msg __ARGS((void)); -int vim_dialog_yesno __ARGS((int type, char_u *title, char_u *message, int dflt)); -int vim_dialog_yesnocancel __ARGS((int type, char_u *title, char_u *message, int dflt)); -int vim_dialog_yesnoallcancel __ARGS((int type, char_u *title, char_u *message, int dflt)); -char_u *do_browse __ARGS((int flags, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter, buf_T *buf)); +int msg(char_u *s); +int verb_msg(char_u *s); +int msg_attr(char_u *s, int attr); +int msg_attr_keep(char_u *s, int attr, int keep); +char_u *msg_strtrunc(char_u *s, int force); +void trunc_string(char_u *s, char_u *buf, int room_in, int buflen); +void reset_last_sourcing(void); +void msg_source(int attr); +int emsg_not_now(void); +void ignore_error_for_testing(char_u *error); +void do_perror(char *msg); +int emsg(char_u *s); +int emsg2(char_u *s, char_u *a1); +int emsg3(char_u *s, char_u *a1, char_u *a2); +int emsgn(char_u *s, long n); +void iemsg(char_u *s); +void iemsg2(char_u *s, char_u *a1); +void iemsgn(char_u *s, long n); +void internal_error(char *where); +void emsg_invreg(int name); +char_u *msg_trunc_attr(char_u *s, int force, int attr); +char_u *msg_may_trunc(int force, char_u *s); +int delete_first_msg(void); +void ex_messages(exarg_T *eap); +void msg_end_prompt(void); +void wait_return(int redraw); +void set_keep_msg(char_u *s, int attr); +void set_keep_msg_from_hist(void); +void msg_start(void); +void msg_starthere(void); +void msg_putchar(int c); +void msg_putchar_attr(int c, int attr); +void msg_outnum(long n); +void msg_home_replace(char_u *fname); +void msg_home_replace_hl(char_u *fname); +int msg_outtrans(char_u *str); +int msg_outtrans_attr(char_u *str, int attr); +int msg_outtrans_len(char_u *str, int len); +char_u *msg_outtrans_one(char_u *p, int attr); +int msg_outtrans_len_attr(char_u *msgstr, int len, int attr); +void msg_make(char_u *arg); +int msg_outtrans_special(char_u *strstart, int from); +char_u *str2special_save(char_u *str, int is_lhs); +char_u *str2special(char_u **sp, int from); +void str2specialbuf(char_u *sp, char_u *buf, int len); +void msg_prt_line(char_u *s, int list); +void msg_puts(char_u *s); +void msg_puts_title(char_u *s); +void msg_puts_long_attr(char_u *longstr, int attr); +void msg_puts_long_len_attr(char_u *longstr, int len, int attr); +void msg_puts_attr(char_u *s, int attr); +int message_filtered(char_u *msg); +void may_clear_sb_text(void); +void sb_text_start_cmdline(void); +void sb_text_end_cmdline(void); +void clear_sb_text(int all); +void show_sb_text(void); +void msg_sb_eol(void); +int msg_use_printf(void); +void mch_errmsg(char *str); +void mch_msg(char *str); +void msg_moremsg(int full); +void repeat_message(void); +void msg_clr_eos(void); +void msg_clr_eos_force(void); +void msg_clr_cmdline(void); +int msg_end(void); +void msg_check(void); +int redirecting(void); +void verbose_enter(void); +void verbose_leave(void); +void verbose_enter_scroll(void); +void verbose_leave_scroll(void); +void verbose_stop(void); +int verbose_open(void); +void give_warning(char_u *message, int hl); +void give_warning2(char_u *message, char_u *a1, int hl); +void msg_advance(int col); +int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd); +void display_confirm_msg(void); +int vim_dialog_yesno(int type, char_u *title, char_u *message, int dflt); +int vim_dialog_yesnocancel(int type, char_u *title, char_u *message, int dflt); +int vim_dialog_yesnoallcancel(int type, char_u *title, char_u *message, int dflt); +char_u *do_browse(int flags, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter, buf_T *buf); /* vim: set ft=c : */ diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro index 274c7af46f..0e1d22e60f 100644 --- a/src/proto/misc1.pro +++ b/src/proto/misc1.pro @@ -1,108 +1,109 @@ /* misc1.c */ -int get_indent __ARGS((void)); -int get_indent_lnum __ARGS((linenr_T lnum)); -int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum)); -int get_indent_str __ARGS((char_u *ptr, int ts, int list)); -int set_indent __ARGS((int size, int flags)); -int get_number_indent __ARGS((linenr_T lnum)); -int get_breakindent_win __ARGS((win_T *wp, char_u *ptr)); -int open_line __ARGS((int dir, int flags, int second_line_indent)); -int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space)); -int get_last_leader_offset __ARGS((char_u *line, char_u **flags)); -int plines __ARGS((linenr_T lnum)); -int plines_win __ARGS((win_T *wp, linenr_T lnum, int winheight)); -int plines_nofill __ARGS((linenr_T lnum)); -int plines_win_nofill __ARGS((win_T *wp, linenr_T lnum, int winheight)); -int plines_win_nofold __ARGS((win_T *wp, linenr_T lnum)); -int plines_win_col __ARGS((win_T *wp, linenr_T lnum, long column)); -int plines_m_win __ARGS((win_T *wp, linenr_T first, linenr_T last)); -void ins_bytes __ARGS((char_u *p)); -void ins_bytes_len __ARGS((char_u *p, int len)); -void ins_char __ARGS((int c)); -void ins_char_bytes __ARGS((char_u *buf, int charlen)); -void ins_str __ARGS((char_u *s)); -int del_char __ARGS((int fixpos)); -int del_chars __ARGS((long count, int fixpos)); -int del_bytes __ARGS((long count, int fixpos_arg, int use_delcombine)); -int truncate_line __ARGS((int fixpos)); -void del_lines __ARGS((long nlines, int undo)); -int gchar_pos __ARGS((pos_T *pos)); -int gchar_cursor __ARGS((void)); -void pchar_cursor __ARGS((int c)); -int inindent __ARGS((int extra)); -char_u *skip_to_option_part __ARGS((char_u *p)); -void changed __ARGS((void)); -void changed_int __ARGS((void)); -void changed_bytes __ARGS((linenr_T lnum, colnr_T col)); -void appended_lines __ARGS((linenr_T lnum, long count)); -void appended_lines_mark __ARGS((linenr_T lnum, long count)); -void deleted_lines __ARGS((linenr_T lnum, long count)); -void deleted_lines_mark __ARGS((linenr_T lnum, long count)); -void changed_lines __ARGS((linenr_T lnum, colnr_T col, linenr_T lnume, long xtra)); -void unchanged __ARGS((buf_T *buf, int ff)); -void check_status __ARGS((buf_T *buf)); -void change_warning __ARGS((int col)); -int ask_yesno __ARGS((char_u *str, int direct)); -int is_mouse_key __ARGS((int c)); -int get_keystroke __ARGS((void)); -int get_number __ARGS((int colon, int *mouse_used)); -int prompt_for_number __ARGS((int *mouse_used)); -void msgmore __ARGS((long n)); -void beep_flush __ARGS((void)); -void vim_beep __ARGS((void)); -void init_homedir __ARGS((void)); -void free_homedir __ARGS((void)); -void free_users __ARGS((void)); -char_u *expand_env_save __ARGS((char_u *src)); -char_u *expand_env_save_opt __ARGS((char_u *src, int one)); -void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); -void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr)); -char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); -void vim_setenv __ARGS((char_u *name, char_u *val)); -char_u *get_env_name __ARGS((expand_T *xp, int idx)); -char_u *get_users __ARGS((expand_T *xp, int idx)); -int match_user __ARGS((char_u *name)); -void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one)); -char_u *home_replace_save __ARGS((buf_T *buf, char_u *src)); -int fullpathcmp __ARGS((char_u *s1, char_u *s2, int checkname)); -char_u *gettail __ARGS((char_u *fname)); -char_u *gettail_sep __ARGS((char_u *fname)); -char_u *getnextcomp __ARGS((char_u *fname)); -char_u *get_past_head __ARGS((char_u *path)); -int vim_ispathsep __ARGS((int c)); -int vim_ispathsep_nocolon __ARGS((int c)); -int vim_ispathlistsep __ARGS((int c)); -void shorten_dir __ARGS((char_u *str)); -int dir_of_file_exists __ARGS((char_u *fname)); -int vim_fnamecmp __ARGS((char_u *x, char_u *y)); -int vim_fnamencmp __ARGS((char_u *x, char_u *y, size_t len)); -char_u *concat_fnames __ARGS((char_u *fname1, char_u *fname2, int sep)); -char_u *concat_str __ARGS((char_u *str1, char_u *str2)); -void add_pathsep __ARGS((char_u *p)); -char_u *FullName_save __ARGS((char_u *fname, int force)); -pos_T *find_start_comment __ARGS((int ind_maxcomment)); -void do_c_expr_indent __ARGS((void)); -int cin_islabel __ARGS((void)); -int cin_iscase __ARGS((char_u *s, int strict)); -int cin_isscopedecl __ARGS((char_u *s)); -void parse_cino __ARGS((buf_T *buf)); -int get_c_indent __ARGS((void)); -int get_expr_indent __ARGS((void)); -int get_lisp_indent __ARGS((void)); -void prepare_to_exit __ARGS((void)); -void preserve_exit __ARGS((void)); -int vim_fexists __ARGS((char_u *fname)); -void line_breakcheck __ARGS((void)); -void fast_breakcheck __ARGS((void)); -int expand_wildcards_eval __ARGS((char_u **pat, int *num_file, char_u ***file, int flags)); -int expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)); -int match_suffix __ARGS((char_u *fname)); -int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags, int didstar)); -void remove_duplicates __ARGS((garray_T *gap)); -int gen_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)); -void addfile __ARGS((garray_T *gap, char_u *f, int flags)); -char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len)); -void FreeWild __ARGS((int count, char_u **files)); -int goto_im __ARGS((void)); -char_u *get_isolated_shell_name __ARGS((void)); +int get_indent(void); +int get_indent_lnum(linenr_T lnum); +int get_indent_buf(buf_T *buf, linenr_T lnum); +int get_indent_str(char_u *ptr, int ts, int list); +int set_indent(int size, int flags); +int get_number_indent(linenr_T lnum); +int get_breakindent_win(win_T *wp, char_u *line); +int open_line(int dir, int flags, int second_line_indent); +int get_leader_len(char_u *line, char_u **flags, int backward, int include_space); +int get_last_leader_offset(char_u *line, char_u **flags); +int plines(linenr_T lnum); +int plines_win(win_T *wp, linenr_T lnum, int winheight); +int plines_nofill(linenr_T lnum); +int plines_win_nofill(win_T *wp, linenr_T lnum, int winheight); +int plines_win_nofold(win_T *wp, linenr_T lnum); +int plines_win_col(win_T *wp, linenr_T lnum, long column); +int plines_m_win(win_T *wp, linenr_T first, linenr_T last); +void ins_bytes(char_u *p); +void ins_bytes_len(char_u *p, int len); +void ins_char(int c); +void ins_char_bytes(char_u *buf, int charlen); +void ins_str(char_u *s); +int del_char(int fixpos); +int del_chars(long count, int fixpos); +int del_bytes(long count, int fixpos_arg, int use_delcombine); +int truncate_line(int fixpos); +void del_lines(long nlines, int undo); +int gchar_pos(pos_T *pos); +int gchar_cursor(void); +void pchar_cursor(int c); +int inindent(int extra); +char_u *skip_to_option_part(char_u *p); +void changed(void); +void changed_int(void); +void changed_bytes(linenr_T lnum, colnr_T col); +void appended_lines(linenr_T lnum, long count); +void appended_lines_mark(linenr_T lnum, long count); +void deleted_lines(linenr_T lnum, long count); +void deleted_lines_mark(linenr_T lnum, long count); +void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); +void unchanged(buf_T *buf, int ff); +void check_status(buf_T *buf); +void change_warning(int col); +int ask_yesno(char_u *str, int direct); +int is_mouse_key(int c); +int get_keystroke(void); +int get_number(int colon, int *mouse_used); +int prompt_for_number(int *mouse_used); +void msgmore(long n); +void beep_flush(void); +void vim_beep(unsigned val); +void init_homedir(void); +void free_homedir(void); +void free_users(void); +char_u *expand_env_save(char_u *src); +char_u *expand_env_save_opt(char_u *src, int one); +void expand_env(char_u *src, char_u *dst, int dstlen); +void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr); +char_u *vim_getenv(char_u *name, int *mustfree); +void vim_unsetenv(char_u *var); +void vim_setenv(char_u *name, char_u *val); +char_u *get_env_name(expand_T *xp, int idx); +char_u *get_users(expand_T *xp, int idx); +int match_user(char_u *name); +void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, int one); +char_u *home_replace_save(buf_T *buf, char_u *src); +int fullpathcmp(char_u *s1, char_u *s2, int checkname); +char_u *gettail(char_u *fname); +char_u *gettail_sep(char_u *fname); +char_u *getnextcomp(char_u *fname); +char_u *get_past_head(char_u *path); +int vim_ispathsep(int c); +int vim_ispathsep_nocolon(int c); +int vim_ispathlistsep(int c); +void shorten_dir(char_u *str); +int dir_of_file_exists(char_u *fname); +int vim_fnamecmp(char_u *x, char_u *y); +int vim_fnamencmp(char_u *x, char_u *y, size_t len); +char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep); +char_u *concat_str(char_u *str1, char_u *str2); +void add_pathsep(char_u *p); +char_u *FullName_save(char_u *fname, int force); +pos_T *find_start_comment(int ind_maxcomment); +void do_c_expr_indent(void); +int cin_islabel(void); +int cin_iscase(char_u *s, int strict); +int cin_isscopedecl(char_u *s); +void parse_cino(buf_T *buf); +int get_c_indent(void); +int get_expr_indent(void); +int get_lisp_indent(void); +void prepare_to_exit(void); +void preserve_exit(void); +int vim_fexists(char_u *fname); +void line_breakcheck(void); +void fast_breakcheck(void); +int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags); +int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, int flags); +int match_suffix(char_u *fname); +int unix_expandpath(garray_T *gap, char_u *path, int wildoff, int flags, int didstar); +void remove_duplicates(garray_T *gap); +int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags); +void addfile(garray_T *gap, char_u *f, int flags); +char_u *get_cmd_output(char_u *cmd, char_u *infile, int flags, int *ret_len); +void FreeWild(int count, char_u **files); +int goto_im(void); +char_u *get_isolated_shell_name(void); /* vim: set ft=c : */ diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro index 4fd457382f..770bd33c41 100644 --- a/src/proto/misc2.pro +++ b/src/proto/misc2.pro @@ -1,120 +1,116 @@ /* misc2.c */ -int virtual_active __ARGS((void)); -int getviscol __ARGS((void)); -int getviscol2 __ARGS((colnr_T col, colnr_T coladd)); -int coladvance_force __ARGS((colnr_T wcol)); -int coladvance __ARGS((colnr_T wcol)); -int getvpos __ARGS((pos_T *pos, colnr_T wcol)); -int inc_cursor __ARGS((void)); -int inc __ARGS((pos_T *lp)); -int incl __ARGS((pos_T *lp)); -int dec_cursor __ARGS((void)); -int dec __ARGS((pos_T *lp)); -int decl __ARGS((pos_T *lp)); -linenr_T get_cursor_rel_lnum __ARGS((win_T *wp, linenr_T lnum)); -void check_cursor_lnum __ARGS((void)); -void check_cursor_col __ARGS((void)); -void check_cursor_col_win __ARGS((win_T *win)); -void check_cursor __ARGS((void)); -void adjust_cursor_col __ARGS((void)); -int leftcol_changed __ARGS((void)); -void vim_mem_profile_dump __ARGS((void)); -char_u *alloc __ARGS((unsigned size)); -char_u *alloc_clear __ARGS((unsigned size)); -char_u *alloc_check __ARGS((unsigned size)); -char_u *lalloc_clear __ARGS((long_u size, int message)); -char_u *lalloc __ARGS((long_u size, int message)); -void *mem_realloc __ARGS((void *ptr, size_t size)); -void do_outofmem_msg __ARGS((long_u size)); -void free_all_mem __ARGS((void)); -char_u *vim_strsave __ARGS((char_u *string)); -char_u *vim_strnsave __ARGS((char_u *string, int len)); -char_u *vim_strsave_escaped __ARGS((char_u *string, char_u *esc_chars)); -char_u *vim_strsave_escaped_ext __ARGS((char_u *string, char_u *esc_chars, int cc, int bsl)); -int csh_like_shell __ARGS((void)); -char_u *vim_strsave_shellescape __ARGS((char_u *string, int do_special, int do_newline)); -char_u *vim_strsave_up __ARGS((char_u *string)); -char_u *vim_strnsave_up __ARGS((char_u *string, int len)); -void vim_strup __ARGS((char_u *p)); -char_u *strup_save __ARGS((char_u *orig)); -void copy_spaces __ARGS((char_u *ptr, size_t count)); -void copy_chars __ARGS((char_u *ptr, size_t count, int c)); -void del_trailing_spaces __ARGS((char_u *ptr)); -void vim_strncpy __ARGS((char_u *to, char_u *from, size_t len)); -void vim_strcat __ARGS((char_u *to, char_u *from, size_t tosize)); -int copy_option_part __ARGS((char_u **option, char_u *buf, int maxlen, char *sep_chars)); -void vim_free __ARGS((void *x)); -int vim_stricmp __ARGS((char *s1, char *s2)); -int vim_strnicmp __ARGS((char *s1, char *s2, size_t len)); -char_u *vim_strchr __ARGS((char_u *string, int c)); -char_u *vim_strbyte __ARGS((char_u *string, int c)); -char_u *vim_strrchr __ARGS((char_u *string, int c)); -int vim_isspace __ARGS((int x)); -void ga_clear __ARGS((garray_T *gap)); -void ga_clear_strings __ARGS((garray_T *gap)); -void ga_init __ARGS((garray_T *gap)); -void ga_init2 __ARGS((garray_T *gap, int itemsize, int growsize)); -int ga_grow __ARGS((garray_T *gap, int n)); -char_u *ga_concat_strings __ARGS((garray_T *gap, char *sep)); -void ga_concat __ARGS((garray_T *gap, char_u *s)); -void ga_append __ARGS((garray_T *gap, int c)); -void append_ga_line __ARGS((garray_T *gap)); -int name_to_mod_mask __ARGS((int c)); -int simplify_key __ARGS((int key, int *modifiers)); -int handle_x_keys __ARGS((int key)); -char_u *get_special_key_name __ARGS((int c, int modifiers)); -int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode)); -int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key)); -int extract_modifiers __ARGS((int key, int *modp)); -int find_special_key_in_table __ARGS((int c)); -int get_special_key_code __ARGS((char_u *name)); -char_u *get_key_name __ARGS((int i)); -int get_mouse_button __ARGS((int code, int *is_click, int *is_drag)); -int get_pseudo_mouse_code __ARGS((int button, int is_click, int is_drag)); -int get_fileformat __ARGS((buf_T *buf)); -int get_fileformat_force __ARGS((buf_T *buf, exarg_T *eap)); -void set_fileformat __ARGS((int t, int opt_flags)); -int default_fileformat __ARGS((void)); -int call_shell __ARGS((char_u *cmd, int opt)); -int get_real_state __ARGS((void)); -int after_pathsep __ARGS((char_u *b, char_u *p)); -int same_directory __ARGS((char_u *f1, char_u *f2)); -int vim_chdirfile __ARGS((char_u *fname)); -int illegal_slash __ARGS((char *name)); -char_u *parse_shape_opt __ARGS((int what)); -int get_shape_idx __ARGS((int mouse)); -void update_mouseshape __ARGS((int shape_idx)); -int crypt_method_from_string __ARGS((char_u *s)); -int get_crypt_method __ARGS((buf_T *buf)); -void set_crypt_method __ARGS((buf_T *buf, int method)); -void crypt_push_state __ARGS((void)); -void crypt_pop_state __ARGS((void)); -void crypt_encode __ARGS((char_u *from, size_t len, char_u *to)); -void crypt_decode __ARGS((char_u *ptr, long len)); -void crypt_init_keys __ARGS((char_u *passwd)); -void free_crypt_key __ARGS((char_u *key)); -char_u *get_crypt_key __ARGS((int store, int twice)); -void *vim_findfile_init __ARGS((char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname)); -char_u *vim_findfile_stopdir __ARGS((char_u *buf)); -void vim_findfile_cleanup __ARGS((void *ctx)); -char_u *vim_findfile __ARGS((void *search_ctx_arg)); -void vim_findfile_free_visited __ARGS((void *search_ctx_arg)); -char_u *find_file_in_path __ARGS((char_u *ptr, int len, int options, int first, char_u *rel_fname)); -char_u *find_directory_in_path __ARGS((char_u *ptr, int len, int options, char_u *rel_fname)); -char_u *find_file_in_path_option __ARGS((char_u *ptr, int len, int options, int first, char_u *path_option, int find_what, char_u *rel_fname, char_u *suffixes)); -int vim_chdir __ARGS((char_u *new_dir)); -int get_user_name __ARGS((char_u *buf, int len)); -void sort_strings __ARGS((char_u **files, int count)); -int pathcmp __ARGS((const char *p, const char *q, int maxlen)); -int filewritable __ARGS((char_u *fname)); -int emsg3 __ARGS((char_u *s, char_u *a1, char_u *a2)); -int emsgn __ARGS((char_u *s, long n)); -int get2c __ARGS((FILE *fd)); -int get3c __ARGS((FILE *fd)); -int get4c __ARGS((FILE *fd)); -time_t get8ctime __ARGS((FILE *fd)); -char_u *read_string __ARGS((FILE *fd, int cnt)); -int put_bytes __ARGS((FILE *fd, long_u nr, int len)); -void put_time __ARGS((FILE *fd, time_t the_time)); -int has_non_ascii __ARGS((char_u *s)); +int virtual_active(void); +int getviscol(void); +int getviscol2(colnr_T col, colnr_T coladd); +int coladvance_force(colnr_T wcol); +int coladvance(colnr_T wcol); +int getvpos(pos_T *pos, colnr_T wcol); +int inc_cursor(void); +int inc(pos_T *lp); +int incl(pos_T *lp); +int dec_cursor(void); +int dec(pos_T *lp); +int decl(pos_T *lp); +linenr_T get_cursor_rel_lnum(win_T *wp, linenr_T lnum); +void check_pos(buf_T *buf, pos_T *pos); +void check_cursor_lnum(void); +void check_cursor_col(void); +void check_cursor_col_win(win_T *win); +void check_cursor(void); +void adjust_cursor_col(void); +int leftcol_changed(void); +void vim_mem_profile_dump(void); +char_u *alloc(unsigned size); +char_u *alloc_id(unsigned size, alloc_id_T id); +char_u *alloc_clear(unsigned size); +char_u *alloc_check(unsigned size); +char_u *lalloc_clear(long_u size, int message); +char_u *lalloc(long_u size, int message); +char_u *lalloc_id(long_u size, int message, alloc_id_T id); +void *mem_realloc(void *ptr, size_t size); +void do_outofmem_msg(long_u size); +void free_all_mem(void); +char_u *vim_strsave(char_u *string); +char_u *vim_strnsave(char_u *string, int len); +char_u *vim_strsave_escaped(char_u *string, char_u *esc_chars); +char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int bsl); +int csh_like_shell(void); +char_u *vim_strsave_shellescape(char_u *string, int do_special, int do_newline); +char_u *vim_strsave_up(char_u *string); +char_u *vim_strnsave_up(char_u *string, int len); +void vim_strup(char_u *p); +char_u *strup_save(char_u *orig); +char_u *strlow_save(char_u *orig); +void del_trailing_spaces(char_u *ptr); +void vim_strncpy(char_u *to, char_u *from, size_t len); +void vim_strcat(char_u *to, char_u *from, size_t tosize); +int copy_option_part(char_u **option, char_u *buf, int maxlen, char *sep_chars); +void vim_free(void *x); +int vim_stricmp(char *s1, char *s2); +int vim_strnicmp(char *s1, char *s2, size_t len); +char_u *vim_strchr(char_u *string, int c); +char_u *vim_strbyte(char_u *string, int c); +char_u *vim_strrchr(char_u *string, int c); +int vim_isspace(int x); +void ga_clear(garray_T *gap); +void ga_clear_strings(garray_T *gap); +void ga_init(garray_T *gap); +void ga_init2(garray_T *gap, int itemsize, int growsize); +int ga_grow(garray_T *gap, int n); +char_u *ga_concat_strings(garray_T *gap, char *sep); +void ga_add_string(garray_T *gap, char_u *p); +void ga_concat(garray_T *gap, char_u *s); +void ga_append(garray_T *gap, int c); +void append_ga_line(garray_T *gap); +int name_to_mod_mask(int c); +int simplify_key(int key, int *modifiers); +int handle_x_keys(int key); +char_u *get_special_key_name(int c, int modifiers); +int trans_special(char_u **srcp, char_u *dst, int keycode, int in_string); +int find_special_key(char_u **srcp, int *modp, int keycode, int keep_x_key, int in_string); +int extract_modifiers(int key, int *modp); +int find_special_key_in_table(int c); +int get_special_key_code(char_u *name); +char_u *get_key_name(int i); +int get_mouse_button(int code, int *is_click, int *is_drag); +int get_pseudo_mouse_code(int button, int is_click, int is_drag); +int get_fileformat(buf_T *buf); +int get_fileformat_force(buf_T *buf, exarg_T *eap); +void set_fileformat(int t, int opt_flags); +int default_fileformat(void); +int call_shell(char_u *cmd, int opt); +int get_real_state(void); +int after_pathsep(char_u *b, char_u *p); +int same_directory(char_u *f1, char_u *f2); +int vim_chdirfile(char_u *fname, char *trigger_autocmd); +int vim_stat(const char *name, stat_T *stp); +char_u *parse_shape_opt(int what); +int get_shape_idx(int mouse); +void update_mouseshape(int shape_idx); +void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname); +char_u *vim_findfile_stopdir(char_u *buf); +void vim_findfile_cleanup(void *ctx); +char_u *vim_findfile(void *search_ctx_arg); +void vim_findfile_free_visited(void *search_ctx_arg); +char_u *find_file_in_path(char_u *ptr, int len, int options, int first, char_u *rel_fname); +char_u *find_directory_in_path(char_u *ptr, int len, int options, char_u *rel_fname); +char_u *find_file_in_path_option(char_u *ptr, int len, int options, int first, char_u *path_option, int find_what, char_u *rel_fname, char_u *suffixes); +int vim_chdir(char_u *new_dir); +int get_user_name(char_u *buf, int len); +void sort_strings(char_u **files, int count); +int pathcmp(const char *p, const char *q, int maxlen); +int filewritable(char_u *fname); +int get2c(FILE *fd); +int get3c(FILE *fd); +int get4c(FILE *fd); +time_T get8ctime(FILE *fd); +char_u *read_string(FILE *fd, int cnt); +int put_bytes(FILE *fd, long_u nr, int len); +int put_time(FILE *fd, time_T the_time); +void time_to_bytes(time_T the_time, char_u *buf); +int has_non_ascii(char_u *s); +void parse_queued_messages(void); +int mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc); +int build_argv_from_string(char_u *cmd, char ***argv, int *argc); +int build_argv_from_list(list_T *l, char ***argv, int *argc); /* vim: set ft=c : */ diff --git a/src/proto/move.pro b/src/proto/move.pro index 595e3b8dd7..3bc3fd9c33 100644 --- a/src/proto/move.pro +++ b/src/proto/move.pro @@ -1,41 +1,41 @@ /* move.c */ -void update_topline_redraw __ARGS((void)); -void update_topline __ARGS((void)); -void update_curswant __ARGS((void)); -void check_cursor_moved __ARGS((win_T *wp)); -void changed_window_setting __ARGS((void)); -void changed_window_setting_win __ARGS((win_T *wp)); -void set_topline __ARGS((win_T *wp, linenr_T lnum)); -void changed_cline_bef_curs __ARGS((void)); -void changed_cline_bef_curs_win __ARGS((win_T *wp)); -void changed_line_abv_curs __ARGS((void)); -void changed_line_abv_curs_win __ARGS((win_T *wp)); -void validate_botline __ARGS((void)); -void invalidate_botline __ARGS((void)); -void invalidate_botline_win __ARGS((win_T *wp)); -void approximate_botline_win __ARGS((win_T *wp)); -int cursor_valid __ARGS((void)); -void validate_cursor __ARGS((void)); -void validate_cline_row __ARGS((void)); -void validate_virtcol __ARGS((void)); -void validate_virtcol_win __ARGS((win_T *wp)); -void validate_cursor_col __ARGS((void)); -int win_col_off __ARGS((win_T *wp)); -int curwin_col_off __ARGS((void)); -int win_col_off2 __ARGS((win_T *wp)); -int curwin_col_off2 __ARGS((void)); -void curs_columns __ARGS((int may_scroll)); -void scrolldown __ARGS((long line_count, int byfold)); -void scrollup __ARGS((long line_count, int byfold)); -void check_topfill __ARGS((win_T *wp, int down)); -void scrolldown_clamp __ARGS((void)); -void scrollup_clamp __ARGS((void)); -void scroll_cursor_top __ARGS((int min_scroll, int always)); -void set_empty_rows __ARGS((win_T *wp, int used)); -void scroll_cursor_bot __ARGS((int min_scroll, int set_topbot)); -void scroll_cursor_halfway __ARGS((int atend)); -void cursor_correct __ARGS((void)); -int onepage __ARGS((int dir, long count)); -void halfpage __ARGS((int flag, linenr_T Prenum)); -void do_check_cursorbind __ARGS((void)); +void update_topline_redraw(void); +void update_topline(void); +void update_curswant(void); +void check_cursor_moved(win_T *wp); +void changed_window_setting(void); +void changed_window_setting_win(win_T *wp); +void set_topline(win_T *wp, linenr_T lnum); +void changed_cline_bef_curs(void); +void changed_cline_bef_curs_win(win_T *wp); +void changed_line_abv_curs(void); +void changed_line_abv_curs_win(win_T *wp); +void validate_botline(void); +void invalidate_botline(void); +void invalidate_botline_win(win_T *wp); +void approximate_botline_win(win_T *wp); +int cursor_valid(void); +void validate_cursor(void); +void validate_cline_row(void); +void validate_virtcol(void); +void validate_virtcol_win(win_T *wp); +void validate_cursor_col(void); +int win_col_off(win_T *wp); +int curwin_col_off(void); +int win_col_off2(win_T *wp); +int curwin_col_off2(void); +void curs_columns(int may_scroll); +void scrolldown(long line_count, int byfold); +void scrollup(long line_count, int byfold); +void check_topfill(win_T *wp, int down); +void scrolldown_clamp(void); +void scrollup_clamp(void); +void scroll_cursor_top(int min_scroll, int always); +void set_empty_rows(win_T *wp, int used); +void scroll_cursor_bot(int min_scroll, int set_topbot); +void scroll_cursor_halfway(int atend); +void cursor_correct(void); +int onepage(int dir, long count); +void halfpage(int flag, linenr_T Prenum); +void do_check_cursorbind(void); /* vim: set ft=c : */ diff --git a/src/proto/netbeans.pro b/src/proto/netbeans.pro index a6e5f5f5f8..869e9663c5 100644 --- a/src/proto/netbeans.pro +++ b/src/proto/netbeans.pro @@ -1,30 +1,28 @@ /* netbeans.c */ -void netbeans_parse_messages __ARGS((void)); -void netbeans_read __ARGS((void)); -int isNetbeansBuffer __ARGS((buf_T *bufp)); -int isNetbeansModified __ARGS((buf_T *bufp)); -void netbeans_end __ARGS((void)); -void ex_nbclose __ARGS((exarg_T *eap)); -void ex_nbkey __ARGS((exarg_T *eap)); -void ex_nbstart __ARGS((exarg_T *eap)); -void netbeans_beval_cb __ARGS((BalloonEval *beval, int state)); -int netbeans_active __ARGS((void)); -int netbeans_filedesc __ARGS((void)); -void netbeans_gui_register __ARGS((void)); -void netbeans_open __ARGS((char *params, int doabort)); -void netbeans_send_disconnect __ARGS((void)); -void netbeans_frame_moved __ARGS((int new_x, int new_y)); -void netbeans_file_activated __ARGS((buf_T *bufp)); -void netbeans_file_opened __ARGS((buf_T *bufp)); -void netbeans_file_killed __ARGS((buf_T *bufp)); -void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen)); -void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len)); -void netbeans_unmodified __ARGS((buf_T *bufp)); -void netbeans_button_release __ARGS((int button)); -int netbeans_keycommand __ARGS((int key)); -void netbeans_save_buffer __ARGS((buf_T *bufp)); -void netbeans_deleted_all_lines __ARGS((buf_T *bufp)); -int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot)); -void netbeans_draw_multisign_indicator __ARGS((int row)); -void netbeans_gutter_click __ARGS((linenr_T lnum)); +void netbeans_parse_messages(void); +int isNetbeansBuffer(buf_T *bufp); +int isNetbeansModified(buf_T *bufp); +void netbeans_end(void); +void ex_nbclose(exarg_T *eap); +void ex_nbkey(exarg_T *eap); +void ex_nbstart(exarg_T *eap); +void netbeans_beval_cb(BalloonEval *beval, int state); +int netbeans_active(void); +void netbeans_open(char *params, int doabort); +void netbeans_send_disconnect(void); +int set_ref_in_nb_channel(int copyID); +void netbeans_frame_moved(int new_x, int new_y); +void netbeans_file_activated(buf_T *bufp); +void netbeans_file_opened(buf_T *bufp); +void netbeans_file_killed(buf_T *bufp); +void netbeans_inserted(buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen); +void netbeans_removed(buf_T *bufp, linenr_T linenr, colnr_T col, long len); +void netbeans_unmodified(buf_T *bufp); +void netbeans_button_release(int button); +int netbeans_keycommand(int key); +void netbeans_save_buffer(buf_T *bufp); +void netbeans_deleted_all_lines(buf_T *bufp); +int netbeans_is_guarded(linenr_T top, linenr_T bot); +void netbeans_draw_multisign_indicator(int row); +void netbeans_gutter_click(linenr_T lnum); /* vim: set ft=c : */ diff --git a/src/proto/normal.pro b/src/proto/normal.pro index 55e81635e8..55d12bb292 100644 --- a/src/proto/normal.pro +++ b/src/proto/normal.pro @@ -1,26 +1,26 @@ /* normal.c */ -void init_normal_cmds __ARGS((void)); -void normal_cmd __ARGS((oparg_T *oap, int toplevel)); -void do_pending_operator __ARGS((cmdarg_T *cap, int old_col, int gui_yank)); -int do_mouse __ARGS((oparg_T *oap, int c, int dir, long count, int fixindent)); -void check_visual_highlight __ARGS((void)); -void end_visual_mode __ARGS((void)); -void reset_VIsual_and_resel __ARGS((void)); -void reset_VIsual __ARGS((void)); -int find_ident_under_cursor __ARGS((char_u **string, int find_type)); -int find_ident_at_pos __ARGS((win_T *wp, linenr_T lnum, colnr_T startcol, char_u **string, int find_type)); -void clear_showcmd __ARGS((void)); -int add_to_showcmd __ARGS((int c)); -void add_to_showcmd_c __ARGS((int c)); -void push_showcmd __ARGS((void)); -void pop_showcmd __ARGS((void)); -void do_check_scrollbind __ARGS((int check)); -void check_scrollbind __ARGS((linenr_T topline_diff, long leftcol_diff)); -int find_decl __ARGS((char_u *ptr, int len, int locally, int thisblock, int searchflags)); -void scroll_redraw __ARGS((int up, long count)); -void handle_tabmenu __ARGS((void)); -void do_nv_ident __ARGS((int c1, int c2)); -int get_visual_text __ARGS((cmdarg_T *cap, char_u **pp, int *lenp)); -void start_selection __ARGS((void)); -void may_start_select __ARGS((int c)); +void init_normal_cmds(void); +void normal_cmd(oparg_T *oap, int toplevel); +void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank); +int do_mouse(oparg_T *oap, int c, int dir, long count, int fixindent); +void check_visual_highlight(void); +void end_visual_mode(void); +void reset_VIsual_and_resel(void); +void reset_VIsual(void); +int find_ident_under_cursor(char_u **string, int find_type); +int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **string, int find_type); +void clear_showcmd(void); +int add_to_showcmd(int c); +void add_to_showcmd_c(int c); +void push_showcmd(void); +void pop_showcmd(void); +void do_check_scrollbind(int check); +void check_scrollbind(linenr_T topline_diff, long leftcol_diff); +int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg); +void scroll_redraw(int up, long count); +void handle_tabmenu(void); +void do_nv_ident(int c1, int c2); +int get_visual_text(cmdarg_T *cap, char_u **pp, int *lenp); +void start_selection(void); +void may_start_select(int c); /* vim: set ft=c : */ diff --git a/src/proto/ops.pro b/src/proto/ops.pro index fe40151cd4..01df56f2f7 100644 --- a/src/proto/ops.pro +++ b/src/proto/ops.pro @@ -1,62 +1,68 @@ /* ops.c */ -int get_op_type __ARGS((int char1, int char2)); -int op_on_lines __ARGS((int op)); -int get_op_char __ARGS((int optype)); -int get_extra_op_char __ARGS((int optype)); -void op_shift __ARGS((oparg_T *oap, int curs_top, int amount)); -void shift_line __ARGS((int left, int round, int amount, int call_changed_bytes)); -void op_reindent __ARGS((oparg_T *oap, int (*how)(void))); -int get_expr_register __ARGS((void)); -void set_expr_line __ARGS((char_u *new_line)); -char_u *get_expr_line __ARGS((void)); -char_u *get_expr_line_src __ARGS((void)); -int valid_yank_reg __ARGS((int regname, int writing)); -void get_yank_register __ARGS((int regname, int writing)); -int may_get_selection __ARGS((int regname)); -void *get_register __ARGS((int name, int copy)); -void put_register __ARGS((int name, void *reg)); -void free_register __ARGS((void *reg)); -int yank_register_mline __ARGS((int regname)); -int do_record __ARGS((int c)); -int do_execreg __ARGS((int regname, int colon, int addcr, int silent)); -int insert_reg __ARGS((int regname, int literally)); -int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg)); -int cmdline_paste_reg __ARGS((int regname, int literally, int remcr)); -void adjust_clip_reg __ARGS((int *rp)); -int op_delete __ARGS((oparg_T *oap)); -int op_replace __ARGS((oparg_T *oap, int c)); -void op_tilde __ARGS((oparg_T *oap)); -int swapchar __ARGS((int op_type, pos_T *pos)); -void op_insert __ARGS((oparg_T *oap, long count1)); -int op_change __ARGS((oparg_T *oap)); -void init_yank __ARGS((void)); -void clear_registers __ARGS((void)); -int op_yank __ARGS((oparg_T *oap, int deleting, int mess)); -void do_put __ARGS((int regname, int dir, long count, int flags)); -void adjust_cursor_eol __ARGS((void)); -int preprocs_left __ARGS((void)); -int get_register_name __ARGS((int num)); -void ex_display __ARGS((exarg_T *eap)); -int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions, int setmark)); -void op_format __ARGS((oparg_T *oap, int keep_cursor)); -void op_formatexpr __ARGS((oparg_T *oap)); -int fex_format __ARGS((linenr_T lnum, long count, int c)); -void format_lines __ARGS((linenr_T line_count, int avoid_fex)); -int paragraph_start __ARGS((linenr_T lnum)); -int do_addsub __ARGS((int command, linenr_T Prenum1)); -int read_viminfo_register __ARGS((vir_T *virp, int force)); -void write_viminfo_registers __ARGS((FILE *fp)); -void x11_export_final_selection __ARGS((void)); -void clip_free_selection __ARGS((VimClipboard *cbd)); -void clip_get_selection __ARGS((VimClipboard *cbd)); -void clip_yank_selection __ARGS((int type, char_u *str, long len, VimClipboard *cbd)); -int clip_convert_selection __ARGS((char_u **str, long_u *len, VimClipboard *cbd)); -void dnd_yank_drag_data __ARGS((char_u *str, long len)); -char_u get_reg_type __ARGS((int regname, long *reglen)); -char_u *get_reg_contents __ARGS((int regname, int flags)); -void write_reg_contents __ARGS((int name, char_u *str, int maxlen, int must_append)); -void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len)); -void write_reg_contents_lst __ARGS((int name, char_u **strings, int maxlen, int must_append, int yank_type, long block_len)); -void clear_oparg __ARGS((oparg_T *oap)); -void cursor_pos_info __ARGS((void)); +int get_op_type(int char1, int char2); +int op_on_lines(int op); +int op_is_change(int op); +int get_op_char(int optype); +int get_extra_op_char(int optype); +void op_shift(oparg_T *oap, int curs_top, int amount); +void shift_line(int left, int round, int amount, int call_changed_bytes); +void op_reindent(oparg_T *oap, int (*how)(void)); +int get_expr_register(void); +void set_expr_line(char_u *new_line); +char_u *get_expr_line(void); +char_u *get_expr_line_src(void); +int valid_yank_reg(int regname, int writing); +int get_yank_register(int regname, int writing); +int may_get_selection(int regname); +void *get_register(int name, int copy); +void put_register(int name, void *reg); +void free_register(void *reg); +int yank_register_mline(int regname); +int do_record(int c); +int do_execreg(int regname, int colon, int addcr, int silent); +int insert_reg(int regname, int literally_arg); +int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg); +int cmdline_paste_reg(int regname, int literally_arg, int remcr); +void adjust_clip_reg(int *rp); +void shift_delete_registers(void); +int op_delete(oparg_T *oap); +int op_replace(oparg_T *oap, int c); +void op_tilde(oparg_T *oap); +int swapchar(int op_type, pos_T *pos); +void op_insert(oparg_T *oap, long count1); +int op_change(oparg_T *oap); +void init_yank(void); +void clear_registers(void); +int op_yank(oparg_T *oap, int deleting, int mess); +void do_put(int regname, int dir, long count, int flags); +void adjust_cursor_eol(void); +int preprocs_left(void); +int get_register_name(int num); +void ex_display(exarg_T *eap); +char_u *skip_comment(char_u *line, int process, int include_space, int *is_comment); +int do_join(long count, int insert_space, int save_undo, int use_formatoptions, int setmark); +void op_format(oparg_T *oap, int keep_cursor); +void op_formatexpr(oparg_T *oap); +int fex_format(linenr_T lnum, long count, int c); +void format_lines(linenr_T line_count, int avoid_fex); +int paragraph_start(linenr_T lnum); +void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd); +void prepare_viminfo_registers(void); +void finish_viminfo_registers(void); +int read_viminfo_register(vir_T *virp, int force); +void handle_viminfo_register(garray_T *values, int force); +void write_viminfo_registers(FILE *fp); +void x11_export_final_selection(void); +void clip_free_selection(VimClipboard *cbd); +void clip_get_selection(VimClipboard *cbd); +void clip_yank_selection(int type, char_u *str, long len, VimClipboard *cbd); +int clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd); +void dnd_yank_drag_data(char_u *str, long len); +char_u get_reg_type(int regname, long *reglen); +char_u *get_reg_contents(int regname, int flags); +void write_reg_contents(int name, char_u *str, int maxlen, int must_append); +void write_reg_contents_lst(int name, char_u **strings, int maxlen, int must_append, int yank_type, long block_len); +void write_reg_contents_ex(int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len); +void clear_oparg(oparg_T *oap); +void cursor_pos_info(dict_T *dict); /* vim: set ft=c : */ diff --git a/src/proto/option.pro b/src/proto/option.pro index e426e6cfac..60a45e6d81 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -1,66 +1,69 @@ /* option.c */ -void set_init_1 __ARGS((void)); -void set_string_default __ARGS((char *name, char_u *val)); -void set_number_default __ARGS((char *name, long val)); -void free_all_options __ARGS((void)); -void set_init_2 __ARGS((void)); -void set_init_3 __ARGS((void)); -void set_helplang_default __ARGS((char_u *lang)); -void init_gui_options __ARGS((void)); -void set_title_defaults __ARGS((void)); -int do_set __ARGS((char_u *arg, int opt_flags)); -void set_options_bin __ARGS((int oldval, int newval, int opt_flags)); -int get_viminfo_parameter __ARGS((int type)); -char_u *find_viminfo_parameter __ARGS((int type)); -void check_options __ARGS((void)); -void check_buf_options __ARGS((buf_T *buf)); -void free_string_option __ARGS((char_u *p)); -void clear_string_option __ARGS((char_u **pp)); -void set_term_option_alloced __ARGS((char_u **p)); -int was_set_insecurely __ARGS((char_u *opt, int opt_flags)); -void set_string_option_direct __ARGS((char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid)); -char_u *check_colorcolumn __ARGS((win_T *wp)); -char_u *check_stl_option __ARGS((char_u *s)); -int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags)); -int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from)); -char_u *option_iter_next __ARGS((void **option, int opt_type)); -char_u *set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags)); -char_u *get_term_code __ARGS((char_u *tname)); -char_u *get_highlight_default __ARGS((void)); -char_u *get_encoding_default __ARGS((void)); -int makeset __ARGS((FILE *fd, int opt_flags, int local_only)); -int makefoldset __ARGS((FILE *fd)); -void clear_termoptions __ARGS((void)); -void free_termoptions __ARGS((void)); -void free_one_termoption __ARGS((char_u *var)); -void set_term_defaults __ARGS((void)); -void comp_col __ARGS((void)); -void unset_global_local_option __ARGS((char_u *name, void *from)); -char_u *get_equalprg __ARGS((void)); -void win_copy_options __ARGS((win_T *wp_from, win_T *wp_to)); -void copy_winopt __ARGS((winopt_T *from, winopt_T *to)); -void check_win_options __ARGS((win_T *win)); -void clear_winopt __ARGS((winopt_T *wop)); -void buf_copy_options __ARGS((buf_T *buf, int flags)); -void reset_modifiable __ARGS((void)); -void set_iminsert_global __ARGS((void)); -void set_imsearch_global __ARGS((void)); -void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags)); -int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)); -int ExpandOldSetting __ARGS((int *num_file, char_u ***file)); -int langmap_adjust_mb __ARGS((int c)); -int has_format_option __ARGS((int x)); -int shortmess __ARGS((int x)); -void vimrc_found __ARGS((char_u *fname, char_u *envname)); -void change_compatible __ARGS((int on)); -int option_was_set __ARGS((char_u *name)); -void reset_option_was_set __ARGS((char_u *name)); -int can_bs __ARGS((int what)); -void save_file_ff __ARGS((buf_T *buf)); -int file_ff_differs __ARGS((buf_T *buf, int ignore_empty)); -int check_ff_value __ARGS((char_u *p)); -long get_sw_value __ARGS((buf_T *buf)); -long get_sts_value __ARGS((void)); -void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit)); -int briopt_check __ARGS((void)); +void set_init_1(int clean_arg); +void set_string_default(char *name, char_u *val); +void set_number_default(char *name, long val); +void free_all_options(void); +void set_init_2(void); +void set_init_3(void); +void set_helplang_default(char_u *lang); +void init_gui_options(void); +void set_title_defaults(void); +int do_set(char_u *arg, int opt_flags); +int string_to_key(char_u *arg, int multi_byte); +void set_options_bin(int oldval, int newval, int opt_flags); +int get_viminfo_parameter(int type); +char_u *find_viminfo_parameter(int type); +void check_options(void); +void check_buf_options(buf_T *buf); +void free_string_option(char_u *p); +void clear_string_option(char_u **pp); +void set_term_option_alloced(char_u **p); +int was_set_insecurely(char_u *opt, int opt_flags); +void set_string_option_direct(char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid); +char_u *check_colorcolumn(win_T *wp); +char_u *check_stl_option(char_u *s); +int get_option_value(char_u *name, long *numval, char_u **stringval, int opt_flags); +int get_option_value_strict(char_u *name, long *numval, char_u **stringval, int opt_type, void *from); +char_u *option_iter_next(void **option, int opt_type); +char_u *set_option_value(char_u *name, long number, char_u *string, int opt_flags); +char_u *get_term_code(char_u *tname); +char_u *get_highlight_default(void); +char_u *get_encoding_default(void); +int makeset(FILE *fd, int opt_flags, int local_only); +int makefoldset(FILE *fd); +void clear_termoptions(void); +void free_termoptions(void); +void free_one_termoption(char_u *var); +void set_term_defaults(void); +void comp_col(void); +void unset_global_local_option(char_u *name, void *from); +char_u *get_equalprg(void); +void win_copy_options(win_T *wp_from, win_T *wp_to); +void copy_winopt(winopt_T *from, winopt_T *to); +void check_win_options(win_T *win); +void clear_winopt(winopt_T *wop); +void buf_copy_options(buf_T *buf, int flags); +void reset_modifiable(void); +void set_iminsert_global(void); +void set_imsearch_global(void); +void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags); +int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file); +int ExpandOldSetting(int *num_file, char_u ***file); +int langmap_adjust_mb(int c); +int has_format_option(int x); +int shortmess(int x); +void vimrc_found(char_u *fname, char_u *envname); +void change_compatible(int on); +int option_was_set(char_u *name); +void reset_option_was_set(char_u *name); +int can_bs(int what); +void save_file_ff(buf_T *buf); +int file_ff_differs(buf_T *buf, int ignore_empty); +int check_ff_value(char_u *p); +long get_sw_value(buf_T *buf); +long get_sts_value(void); +void find_mps_values(int *initc, int *findc, int *backwards, int switchit); +unsigned int get_bkc_value(buf_T *buf); +int signcolumn_on(win_T *wp); +dict_T *get_winbuf_options(int bufopt); /* vim: set ft=c : */ diff --git a/src/proto/os_amiga.pro b/src/proto/os_amiga.pro index 16ee6571df..b781680a8c 100644 --- a/src/proto/os_amiga.pro +++ b/src/proto/os_amiga.pro @@ -1,46 +1,46 @@ /* os_amiga.c */ -void win_resize_on __ARGS((void)); -void win_resize_off __ARGS((void)); -void mch_write __ARGS((char_u *p, int len)); -int mch_inchar __ARGS((char_u *buf, int maxlen, long time, int tb_change_cnt)); -int mch_char_avail __ARGS((void)); -long_u mch_avail_mem __ARGS((int special)); -void mch_delay __ARGS((long msec, int ignoreinput)); -void mch_suspend __ARGS((void)); -void mch_init __ARGS((void)); -int mch_check_win __ARGS((int argc, char **argv)); -int mch_input_isatty __ARGS((void)); -void fname_case __ARGS((char_u *name, int len)); -void mch_settitle __ARGS((char_u *title, char_u *icon)); -void mch_restore_title __ARGS((int which)); -int mch_can_restore_title __ARGS((void)); -int mch_can_restore_icon __ARGS((void)); -int mch_get_user_name __ARGS((char_u *s, int len)); -void mch_get_host_name __ARGS((char_u *s, int len)); -long mch_get_pid __ARGS((void)); -int mch_dirname __ARGS((char_u *buf, int len)); -int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force)); -int mch_isFullName __ARGS((char_u *fname)); -long mch_getperm __ARGS((char_u *name)); -int mch_setperm __ARGS((char_u *name, long perm)); -void mch_hide __ARGS((char_u *name)); -int mch_isdir __ARGS((char_u *name)); -int mch_mkdir __ARGS((char_u *name)); -int mch_can_exe __ARGS((char_u *name, char_u **path)); -int mch_nodetype __ARGS((char_u *name)); -void mch_early_init __ARGS((void)); -void mch_exit __ARGS((int r)); -void mch_settmode __ARGS((int tmode)); -int mch_screenmode __ARGS((char_u *arg)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -void mch_new_shellsize __ARGS((void)); -int mch_call_shell __ARGS((char_u *cmd, int options)); -void mch_breakcheck __ARGS((void)); -long Chk_Abort __ARGS((void)); -int mch_expandpath __ARGS((garray_T *gap, char_u *pat, int flags)); -int mch_has_exp_wildcard __ARGS((char_u *p)); -int mch_has_wildcard __ARGS((char_u *p)); -char_u *mch_getenv __ARGS((char_u *var)); -int mch_setenv __ARGS((char *var, char *value, int x)); +void win_resize_on(void); +void win_resize_off(void); +void mch_write(char_u *p, int len); +int mch_inchar(char_u *buf, int maxlen, long time, int tb_change_cnt); +int mch_char_avail(void); +long_u mch_avail_mem(int special); +void mch_delay(long msec, int ignoreinput); +void mch_suspend(void); +void mch_init(void); +int mch_check_win(int argc, char **argv); +int mch_input_isatty(void); +void fname_case(char_u *name, int len); +void mch_settitle(char_u *title, char_u *icon); +void mch_restore_title(int which); +int mch_can_restore_title(void); +int mch_can_restore_icon(void); +int mch_get_user_name(char_u *s, int len); +void mch_get_host_name(char_u *s, int len); +long mch_get_pid(void); +int mch_dirname(char_u *buf, int len); +int mch_FullName(char_u *fname, char_u *buf, int len, int force); +int mch_isFullName(char_u *fname); +long mch_getperm(char_u *name); +int mch_setperm(char_u *name, long perm); +void mch_hide(char_u *name); +int mch_isdir(char_u *name); +int mch_mkdir(char_u *name); +int mch_can_exe(char_u *name, char_u **path, int use_path); +int mch_nodetype(char_u *name); +void mch_early_init(void); +void mch_exit(int r); +void mch_settmode(int tmode); +int mch_screenmode(char_u *arg); +int mch_get_shellsize(void); +void mch_set_shellsize(void); +void mch_new_shellsize(void); +int mch_call_shell(char_u *cmd, int options); +void mch_breakcheck(int force); +long Chk_Abort(void); +int mch_expandpath(garray_T *gap, char_u *pat, int flags); +int mch_has_exp_wildcard(char_u *p); +int mch_has_wildcard(char_u *p); +char_u *mch_getenv(char_u *var); +int mch_setenv(char *var, char *value, int x); /* vim: set ft=c : */ diff --git a/src/proto/os_beos.pro b/src/proto/os_beos.pro index c537101262..bccf45d0a4 100644 --- a/src/proto/os_beos.pro +++ b/src/proto/os_beos.pro @@ -1,4 +1,4 @@ /* os_beos.c */ -void beos_cleanup_read_thread __ARGS((void)); -int beos_select __ARGS((int nbits, struct fd_set *rbits, struct fd_set *wbits, struct fd_set *ebits, struct timeval *timeout)); +void beos_cleanup_read_thread(void); +int beos_select(int nbits, struct fd_set *rbits, struct fd_set *wbits, struct fd_set *ebits, struct timeval *timeout); /* vim: set ft=c : */ diff --git a/src/proto/os_mac_conv.pro b/src/proto/os_mac_conv.pro index e9417889af..e86e40870b 100644 --- a/src/proto/os_mac_conv.pro +++ b/src/proto/os_mac_conv.pro @@ -1,12 +1,12 @@ /* os_mac_conv.c */ -char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from_enc, int to_enc, int *unconvlenp)); -int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size)); -int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp)); -void mac_conv_init __ARGS((void)); -void mac_conv_cleanup __ARGS((void)); -char_u *mac_utf16_to_enc __ARGS((unsigned short *from, size_t fromLen, size_t *actualLen)); -unsigned short *mac_enc_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen)); -void * mac_enc_to_cfstring __ARGS((char_u *from, size_t fromLen)); -char_u *mac_precompose_path __ARGS((char_u *decompPath, size_t decompLen, size_t *precompLen)); -void mac_lang_init __ARGS((void)); +char_u *mac_string_convert(char_u *ptr, int len, int *lenp, int fail_on_error, int from_enc, int to_enc, int *unconvlenp); +int macroman2enc(char_u *ptr, long *sizep, long real_size); +int enc2macroman(char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp); +void mac_conv_init(void); +void mac_conv_cleanup(void); +char_u *mac_utf16_to_enc(unsigned short *from, size_t fromLen, size_t *actualLen); +unsigned short *mac_enc_to_utf16(char_u *from, size_t fromLen, size_t *actualLen); +void *mac_enc_to_cfstring(char_u *from, size_t fromLen); +char_u *mac_precompose_path(char_u *decompPath, size_t decompLen, size_t *precompLen); +void mac_lang_init(void); /* vim: set ft=c : */ diff --git a/src/proto/os_macosx.pro b/src/proto/os_macosx.pro deleted file mode 100644 index af2ac69dfe..0000000000 --- a/src/proto/os_macosx.pro +++ /dev/null @@ -1,13 +0,0 @@ -/* os_macosx.pro */ -/* functions in os_macosx.m */ - -#if defined(FEAT_CLIPBOARD) && !defined(FEAT_GUI) -void clip_mch_lose_selection(VimClipboard *cbd); -int clip_mch_own_selection(VimClipboard *cbd); -void clip_mch_request_selection(VimClipboard *cbd); -void clip_mch_set_selection(VimClipboard *cbd); -#endif - -void macosx_fork __ARGS((void)); - -/* vim: set ft=c : */ diff --git a/src/proto/os_msdos.pro b/src/proto/os_msdos.pro deleted file mode 100644 index e75521110a..0000000000 --- a/src/proto/os_msdos.pro +++ /dev/null @@ -1,48 +0,0 @@ -/* os_msdos.c */ -void mch_set_normal_colors __ARGS((void)); -void mch_update_cursor __ARGS((void)); -long_u mch_avail_mem __ARGS((int special)); -void mch_delay __ARGS((long msec, int ignoreinput)); -void mch_write __ARGS((char_u *s, int len)); -int mch_inchar __ARGS((char_u *buf, int maxlen, long time, int tb_change_cnt)); -int mch_char_avail __ARGS((void)); -void mch_suspend __ARGS((void)); -void mch_init __ARGS((void)); -int mch_check_win __ARGS((int argc, char **argv)); -int mch_input_isatty __ARGS((void)); -void fname_case __ARGS((char_u *name, int len)); -long mch_get_pid __ARGS((void)); -int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force)); -void slash_adjust __ARGS((char_u *p)); -int mch_isFullName __ARGS((char_u *fname)); -void mch_early_init __ARGS((void)); -void mch_exit __ARGS((int r)); -void mch_settmode __ARGS((int tmode)); -void mch_setmouse __ARGS((int on)); -int mch_screenmode __ARGS((char_u *arg)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -void mch_new_shellsize __ARGS((void)); -void mch_check_columns __ARGS((void)); -int mch_call_shell __ARGS((char_u *cmd, int options)); -void mch_breakcheck __ARGS((void)); -int mch_has_exp_wildcard __ARGS((char_u *p)); -int mch_has_wildcard __ARGS((char_u *p)); -int mch_chdir __ARGS((char *path)); -char *djgpp_setlocale __ARGS((void)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); -long mch_getperm __ARGS((char_u *name)); -int mch_setperm __ARGS((char_u *name, long perm)); -void mch_hide __ARGS((char_u *name)); -int mch_isdir __ARGS((char_u *name)); -int mch_can_exe __ARGS((char_u *name, char_u **path)); -int mch_nodetype __ARGS((char_u *name)); -int mch_dirname __ARGS((char_u *buf, int len)); -int mch_remove __ARGS((char_u *name)); -char_u *mch_getenv __ARGS((char_u *name)); -int mch_get_user_name __ARGS((char_u *s, int len)); -void mch_get_host_name __ARGS((char_u *s, int len)); -/* vim: set ft=c : */ diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro index 0d29979cf8..cc660a6d97 100644 --- a/src/proto/os_mswin.pro +++ b/src/proto/os_mswin.pro @@ -1,52 +1,54 @@ /* os_mswin.c */ -void mch_exit __ARGS((int r)); -void mch_early_init __ARGS((void)); -int mch_input_isatty __ARGS((void)); -void mch_settitle __ARGS((char_u *title, char_u *icon)); -void mch_restore_title __ARGS((int which)); -int mch_can_restore_title __ARGS((void)); -int mch_can_restore_icon __ARGS((void)); -int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force)); -int mch_isFullName __ARGS((char_u *fname)); -void slash_adjust __ARGS((char_u *p)); -int vim_stat __ARGS((const char *name, struct stat *stp)); -void mch_settmode __ARGS((int tmode)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -void mch_new_shellsize __ARGS((void)); -void mch_suspend __ARGS((void)); -void display_errors __ARGS((void)); -int mch_has_exp_wildcard __ARGS((char_u *p)); -int mch_has_wildcard __ARGS((char_u *p)); -int mch_chdir __ARGS((char *path)); -int can_end_termcap_mode __ARGS((int give_msg)); -int mch_screenmode __ARGS((char_u *arg)); -int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result)); -void DumpPutS __ARGS((const char *psz)); -int mch_get_winpos __ARGS((int *x, int *y)); -void mch_set_winpos __ARGS((int x, int y)); -void mch_print_cleanup __ARGS((void)); -int mch_print_init __ARGS((prt_settings_T *psettings, char_u *jobname, int forceit)); -int mch_print_begin __ARGS((prt_settings_T *psettings)); -void mch_print_end __ARGS((prt_settings_T *psettings)); -int mch_print_end_page __ARGS((void)); -int mch_print_begin_page __ARGS((char_u *msg)); -int mch_print_blank_page __ARGS((void)); -void mch_print_start_line __ARGS((int margin, int page_line)); -int mch_print_text_out __ARGS((char_u *p, int len)); -void mch_print_set_font __ARGS((int iBold, int iItalic, int iUnderline)); -void mch_print_set_bg __ARGS((long_u bgcol)); -void mch_print_set_fg __ARGS((long_u fgcol)); -char_u *mch_resolve_shortcut __ARGS((char_u *fname)); -void win32_set_foreground __ARGS((void)); -void serverInitMessaging __ARGS((void)); -void serverSetName __ARGS((char_u *name)); -char_u *serverGetVimNames __ARGS((void)); -int serverSendReply __ARGS((char_u *name, char_u *reply)); -int serverSendToVim __ARGS((char_u *name, char_u *cmd, char_u **result, void *ptarget, int asExpr, int silent)); -void serverForeground __ARGS((char_u *name)); -char_u *serverGetReply __ARGS((HWND server, int *expr_res, int remove, int wait)); -void serverProcessPendingMessages __ARGS((void)); -char *charset_id2name __ARGS((int id)); -int get_logfont __ARGS((LOGFONT *lf, char_u *name, HDC printer_dc, int verbose)); +void mch_exit(int r); +void mch_early_init(void); +int mch_input_isatty(void); +void mch_settitle(char_u *title, char_u *icon); +void mch_restore_title(int which); +int mch_can_restore_title(void); +int mch_can_restore_icon(void); +int mch_FullName(char_u *fname, char_u *buf, int len, int force); +int mch_isFullName(char_u *fname); +void slash_adjust(char_u *p); +int vim_stat(const char *name, stat_T *stp); +void mch_settmode(int tmode); +int mch_get_shellsize(void); +void mch_set_shellsize(void); +void mch_new_shellsize(void); +void mch_suspend(void); +void display_errors(void); +int mch_has_exp_wildcard(char_u *p); +int mch_has_wildcard(char_u *p); +int mch_chdir(char *path); +int mch_screenmode(char_u *arg); +int mch_icon_load(HANDLE *iconp); +int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result); +void DumpPutS(const char *psz); +int mch_get_winpos(int *x, int *y); +void mch_set_winpos(int x, int y); +void mch_print_cleanup(void); +int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit); +int mch_print_begin(prt_settings_T *psettings); +void mch_print_end(prt_settings_T *psettings); +int mch_print_end_page(void); +int mch_print_begin_page(char_u *msg); +int mch_print_blank_page(void); +void mch_print_start_line(int margin, int page_line); +int mch_print_text_out(char_u *p, int len); +void mch_print_set_font(int iBold, int iItalic, int iUnderline); +void mch_print_set_bg(long_u bgcol); +void mch_print_set_fg(long_u fgcol); +char_u *mch_resolve_shortcut(char_u *fname); +void win32_set_foreground(void); +void serverInitMessaging(void); +void serverSetName(char_u *name); +char_u *serverGetVimNames(void); +int serverSendReply(char_u *name, char_u *reply); +int serverSendToVim(char_u *name, char_u *cmd, char_u **result, void *ptarget, int asExpr, int timeout, int silent); +void serverForeground(char_u *name); +char_u *serverGetReply(HWND server, int *expr_res, int remove, int wait, int timeout); +void serverProcessPendingMessages(void); +char *charset_id2name(int id); +char *quality_id2name(DWORD id); +int get_logfont(LOGFONT *lf, char_u *name, HDC printer_dc, int verbose); +void channel_init_winsock(void); /* vim: set ft=c : */ diff --git a/src/proto/os_qnx.pro b/src/proto/os_qnx.pro index 54a63149a4..89a250f94d 100644 --- a/src/proto/os_qnx.pro +++ b/src/proto/os_qnx.pro @@ -1,8 +1,8 @@ /* os_qnx.c */ -void qnx_init __ARGS((void)); -void qnx_clip_init __ARGS((void)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); +void qnx_init(void); +void qnx_clip_init (void); +int clip_mch_own_selection(VimClipboard *cbd); +void clip_mch_lose_selection(VimClipboard *cbd); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); /* vim: set ft=c : */ diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro index a59b6aa5e5..262a8d54de 100644 --- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -1,76 +1,89 @@ /* os_unix.c */ -int mch_chdir __ARGS((char *path)); -void mch_write __ARGS((char_u *s, int len)); -int mch_inchar __ARGS((char_u *buf, int maxlen, long wtime, int tb_change_cnt)); -int mch_char_avail __ARGS((void)); -long_u mch_total_mem __ARGS((int special)); -void mch_delay __ARGS((long msec, int ignoreinput)); -int mch_stackcheck __ARGS((char *p)); -void mch_startjmp __ARGS((void)); -void mch_endjmp __ARGS((void)); -void mch_didjmp __ARGS((void)); -void mch_suspend __ARGS((void)); -void mch_init __ARGS((void)); -void reset_signals __ARGS((void)); -int vim_handle_signal __ARGS((int sig)); -int mch_check_win __ARGS((int argc, char **argv)); -int mch_input_isatty __ARGS((void)); -int mch_can_restore_title __ARGS((void)); -int mch_can_restore_icon __ARGS((void)); -void mch_settitle __ARGS((char_u *title, char_u *icon)); -void mch_restore_title __ARGS((int which)); -int vim_is_xterm __ARGS((char_u *name)); -int use_xterm_like_mouse __ARGS((char_u *name)); -int use_xterm_mouse __ARGS((void)); -int vim_is_iris __ARGS((char_u *name)); -int vim_is_vt300 __ARGS((char_u *name)); -int vim_is_fastterm __ARGS((char_u *name)); -int mch_get_user_name __ARGS((char_u *s, int len)); -int mch_get_uname __ARGS((uid_t uid, char_u *s, int len)); -void mch_get_host_name __ARGS((char_u *s, int len)); -long mch_get_pid __ARGS((void)); -int mch_dirname __ARGS((char_u *buf, int len)); -void slash_adjust __ARGS((char_u *p)); -int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force)); -int mch_isFullName __ARGS((char_u *fname)); -void fname_case __ARGS((char_u *name, int len)); -long mch_getperm __ARGS((char_u *name)); -int mch_setperm __ARGS((char_u *name, long perm)); -void mch_copy_sec __ARGS((char_u *from_file, char_u *to_file)); -vim_acl_T mch_get_acl __ARGS((char_u *fname)); -void mch_set_acl __ARGS((char_u *fname, vim_acl_T aclent)); -void mch_free_acl __ARGS((vim_acl_T aclent)); -void mch_hide __ARGS((char_u *name)); -int mch_isdir __ARGS((char_u *name)); -int mch_can_exe __ARGS((char_u *name, char_u **path)); -int mch_nodetype __ARGS((char_u *name)); -void mch_early_init __ARGS((void)); -void mch_free_mem __ARGS((void)); -void mch_exit __ARGS((int r)); -void mch_settmode __ARGS((int tmode)); -void get_stty __ARGS((void)); -void mch_setmouse __ARGS((int on)); -void check_mouse_termcode __ARGS((void)); -int mch_screenmode __ARGS((char_u *arg)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -void mch_new_shellsize __ARGS((void)); -int mch_call_shell __ARGS((char_u *cmd, int options)); -void mch_breakcheck __ARGS((void)); -int mch_expandpath __ARGS((garray_T *gap, char_u *path, int flags)); -int mch_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)); -int mch_has_exp_wildcard __ARGS((char_u *p)); -int mch_has_wildcard __ARGS((char_u *p)); -int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result)); -void setup_term_clip __ARGS((void)); -void start_xterm_trace __ARGS((int button)); -void stop_xterm_trace __ARGS((void)); -void clear_xterm_clip __ARGS((void)); -int clip_xterm_own_selection __ARGS((VimClipboard *cbd)); -void clip_xterm_lose_selection __ARGS((VimClipboard *cbd)); -void clip_xterm_request_selection __ARGS((VimClipboard *cbd)); -void clip_xterm_set_selection __ARGS((VimClipboard *cbd)); -int xsmp_handle_requests __ARGS((void)); -void xsmp_init __ARGS((void)); -void xsmp_close __ARGS((void)); +int mch_chdir(char *path); +void mch_write(char_u *s, int len); +int mch_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt); +int mch_char_avail(void); +int mch_check_messages(void); +long_u mch_total_mem(int special); +void mch_delay(long msec, int ignoreinput); +int mch_stackcheck(char *p); +void mch_startjmp(void); +void mch_endjmp(void); +void mch_didjmp(void); +void mch_suspend(void); +void mch_init(void); +void reset_signals(void); +int vim_handle_signal(int sig); +int mch_check_win(int argc, char **argv); +int mch_input_isatty(void); +int mch_can_restore_title(void); +int mch_can_restore_icon(void); +void mch_settitle(char_u *title, char_u *icon); +void mch_restore_title(int which); +int vim_is_xterm(char_u *name); +int use_xterm_like_mouse(char_u *name); +int use_xterm_mouse(void); +int vim_is_iris(char_u *name); +int vim_is_vt300(char_u *name); +int vim_is_fastterm(char_u *name); +int mch_get_user_name(char_u *s, int len); +int mch_get_uname(uid_t uid, char_u *s, int len); +void mch_get_host_name(char_u *s, int len); +long mch_get_pid(void); +int mch_dirname(char_u *buf, int len); +int mch_FullName(char_u *fname, char_u *buf, int len, int force); +int mch_isFullName(char_u *fname); +void fname_case(char_u *name, int len); +long mch_getperm(char_u *name); +int mch_setperm(char_u *name, long perm); +int mch_fsetperm(int fd, long perm); +void mch_copy_sec(char_u *from_file, char_u *to_file); +vim_acl_T mch_get_acl(char_u *fname); +void mch_set_acl(char_u *fname, vim_acl_T aclent); +void mch_free_acl(vim_acl_T aclent); +void mch_hide(char_u *name); +int mch_isdir(char_u *name); +int mch_isrealdir(char_u *name); +int mch_can_exe(char_u *name, char_u **path, int use_path); +int mch_nodetype(char_u *name); +void mch_early_init(void); +void mch_free_mem(void); +void mch_exit(int r); +void mch_settmode(int tmode); +void get_stty(void); +int get_tty_info(int fd, ttyinfo_T *info); +void mch_setmouse(int on); +void mch_bevalterm_changed(void); +void check_mouse_termcode(void); +int mch_screenmode(char_u *arg); +int mch_get_shellsize(void); +int mch_report_winsize(int fd, int rows, int cols); +void mch_set_shellsize(void); +void mch_new_shellsize(void); +void may_send_sigint(int c, pid_t pid, pid_t wpid); +int mch_call_shell(char_u *cmd, int options); +void mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal); +char *mch_job_status(job_T *job); +job_T *mch_detect_ended_job(job_T *job_list); +int mch_signal_job(job_T *job, char_u *how); +void mch_clear_job(job_T *job); +int mch_create_pty_channel(job_T *job, jobopt_T *options); +void mch_breakcheck(int force); +int mch_expandpath(garray_T *gap, char_u *path, int flags); +int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags); +int mch_has_exp_wildcard(char_u *p); +int mch_has_wildcard(char_u *p); +int mch_rename(const char *src, const char *dest); +int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result); +void setup_term_clip(void); +void start_xterm_trace(int button); +void stop_xterm_trace(void); +void clear_xterm_clip(void); +int clip_xterm_own_selection(VimClipboard *cbd); +void clip_xterm_lose_selection(VimClipboard *cbd); +void clip_xterm_request_selection(VimClipboard *cbd); +void clip_xterm_set_selection(VimClipboard *cbd); +int xsmp_handle_requests(void); +void xsmp_init(void); +void xsmp_close(void); /* vim: set ft=c : */ diff --git a/src/proto/os_vms.pro b/src/proto/os_vms.pro index 6408455e46..c1cfd4442a 100644 --- a/src/proto/os_vms.pro +++ b/src/proto/os_vms.pro @@ -1,15 +1,16 @@ /* os_vms.c */ -void mch_settmode __ARGS((int tmode)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -char_u *mch_getenv __ARGS((char_u *lognam)); -int mch_setenv __ARGS((char *var, char *value, int x)); -int vms_sys __ARGS((char *cmd, char *out, char *inp)); -int vms_sys_status __ARGS((int status)); -int vms_read __ARGS((char *inbuf, size_t nbytes)); -char *vms_tolower __ARGS((char *name)); -int mch_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)); -int mch_expandpath __ARGS((garray_T *gap, char_u *path, int flags)); -void *vms_fixfilename __ARGS((void *instring)); -void vms_remove_version __ARGS((void *fname)); +void mch_settmode(int tmode); +int mch_get_shellsize(void); +void mch_set_shellsize(void); +char_u *mch_getenv(char_u *lognam); +int mch_setenv(char *var, char *value, int x); +int vms_sys(char *cmd, char *out, char *inp); +char *vms_tolower(char *name); +int vms_sys_status(int status); +int vms_read(char *inbuf, size_t nbytes); +int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags); +int mch_expandpath(garray_T *gap, char_u *path, int flags); +void *vms_fixfilename(void *instring); +void vms_remove_version(void *fname); +int RealWaitForChar(int fd, long msec, int *check_for_gpm, int *interrupted); /* vim: set ft=c : */ diff --git a/src/proto/os_win16.pro b/src/proto/os_win16.pro deleted file mode 100644 index 31fa72c05b..0000000000 --- a/src/proto/os_win16.pro +++ /dev/null @@ -1,12 +0,0 @@ -/* os_win16.c */ -void mch_setmouse __ARGS((int on)); -void mch_init __ARGS((void)); -int mch_check_win __ARGS((int argc, char **argv)); -long mch_get_pid __ARGS((void)); -int mch_call_shell __ARGS((char_u *cmd, int options)); -void mch_delay __ARGS((long msec, int ignoreinput)); -void mch_breakcheck __ARGS((void)); -long_u mch_avail_mem __ARGS((int special)); -int mch_rename __ARGS((const char *pszOldFile, const char *pszNewFile)); -char *default_shell __ARGS((void)); -/* vim: set ft=c : */ diff --git a/src/proto/os_win32.pro b/src/proto/os_win32.pro index c149bc89f5..7f45c5cf16 100644 --- a/src/proto/os_win32.pro +++ b/src/proto/os_win32.pro @@ -1,58 +1,76 @@ /* os_win32.c */ -HINSTANCE vimLoadLib __ARGS((char *name)); -int dyn_libintl_init __ARGS((char *libname)); -void dyn_libintl_end __ARGS((void)); -void PlatformId __ARGS((void)); -int mch_windows95 __ARGS((void)); -void mch_setmouse __ARGS((int on)); -void mch_update_cursor __ARGS((void)); -int mch_char_avail __ARGS((void)); -int mch_inchar __ARGS((char_u *buf, int maxlen, long time, int tb_change_cnt)); -void mch_init __ARGS((void)); -void mch_exit __ARGS((int r)); -int mch_check_win __ARGS((int argc, char **argv)); -void fname_case __ARGS((char_u *name, int len)); -int mch_get_user_name __ARGS((char_u *s, int len)); -void mch_get_host_name __ARGS((char_u *s, int len)); -long mch_get_pid __ARGS((void)); -int mch_dirname __ARGS((char_u *buf, int len)); -long mch_getperm __ARGS((char_u *name)); -int mch_setperm __ARGS((char_u *name, long perm)); -void mch_hide __ARGS((char_u *name)); -int mch_isdir __ARGS((char_u *name)); -int mch_mkdir __ARGS((char_u *name)); -int mch_is_hard_link __ARGS((char_u *fname)); -int mch_is_symbolic_link __ARGS((char_u *fname)); -int mch_is_linked __ARGS((char_u *fname)); -int win32_fileinfo __ARGS((char_u *fname, BY_HANDLE_FILE_INFORMATION *info)); -int mch_writable __ARGS((char_u *name)); -int mch_can_exe __ARGS((char_u *name, char_u **path)); -int mch_nodetype __ARGS((char_u *name)); -vim_acl_T mch_get_acl __ARGS((char_u *fname)); -void mch_set_acl __ARGS((char_u *fname, vim_acl_T acl)); -void mch_free_acl __ARGS((vim_acl_T acl)); -void mch_settmode __ARGS((int tmode)); -int mch_get_shellsize __ARGS((void)); -void mch_set_shellsize __ARGS((void)); -void mch_new_shellsize __ARGS((void)); -void mch_set_winsize_now __ARGS((void)); -int mch_call_shell __ARGS((char_u *cmd, int options)); -void mch_set_normal_colors __ARGS((void)); -void mch_write __ARGS((char_u *s, int len)); -void mch_delay __ARGS((long msec, int ignoreinput)); -int mch_remove __ARGS((char_u *name)); -void mch_breakcheck __ARGS((void)); -int mch_wrename __ARGS((WCHAR *wold, WCHAR *wnew)); -int mch_rename __ARGS((const char *pszOldFile, const char *pszNewFile)); -char *default_shell __ARGS((void)); -int mch_access __ARGS((char *n, int p)); -int mch_open __ARGS((char *name, int flags, int mode)); -FILE *mch_fopen __ARGS((char *name, char *mode)); -int mch_copy_file_attribute __ARGS((char_u *from, char_u *to)); -int myresetstkoflw __ARGS((void)); -int get_cmd_argsW __ARGS((char ***argvp)); -void free_cmd_argsW __ARGS((void)); -void used_file_arg __ARGS((char *name, int literal, int full_path, int diff_mode)); -void set_alist_count __ARGS((void)); -void fix_arg_enc __ARGS((void)); +HINSTANCE vimLoadLib(char *name); +HINSTANCE find_imported_module_by_funcname(HINSTANCE hInst, const char *funcname); +void *get_dll_import_func(HINSTANCE hInst, const char *funcname); +int dyn_libintl_init(void); +void dyn_libintl_end(void); +void PlatformId(void); +void mch_setmouse(int on); +void mch_bevalterm_changed(void); +void mch_update_cursor(void); +int mch_char_avail(void); +int mch_check_messages(void); +int mch_inchar(char_u *buf, int maxlen, long time, int tb_change_cnt); +void mch_init(void); +void mch_exit(int r); +int mch_check_win(int argc, char **argv); +void fname_case(char_u *name, int len); +int mch_get_user_name(char_u *s, int len); +void mch_get_host_name(char_u *s, int len); +long mch_get_pid(void); +int mch_dirname(char_u *buf, int len); +long mch_getperm(char_u *name); +int mch_setperm(char_u *name, long perm); +void mch_hide(char_u *name); +int mch_ishidden(char_u *name); +int mch_isdir(char_u *name); +int mch_isrealdir(char_u *name); +int mch_mkdir(char_u *name); +int mch_rmdir(char_u *name); +int mch_is_hard_link(char_u *fname); +int mch_is_symbolic_link(char_u *name); +int mch_is_linked(char_u *fname); +int win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info); +int mch_writable(char_u *name); +int mch_can_exe(char_u *name, char_u **path, int use_path); +int mch_nodetype(char_u *name); +vim_acl_T mch_get_acl(char_u *fname); +void mch_set_acl(char_u *fname, vim_acl_T acl); +void mch_free_acl(vim_acl_T acl); +void mch_settmode(int tmode); +int mch_get_shellsize(void); +void mch_set_shellsize(void); +void mch_new_shellsize(void); +void mch_set_winsize_now(void); +int mch_call_shell(char_u *cmd, int options); +void win32_build_env(dict_T *env, garray_T *gap, int is_terminal); +void mch_job_start(char *cmd, job_T *job, jobopt_T *options); +char *mch_job_status(job_T *job); +job_T *mch_detect_ended_job(job_T *job_list); +int mch_signal_job(job_T *job, char_u *how); +void mch_clear_job(job_T *job); +void mch_set_normal_colors(void); +void mch_write(char_u *s, int len); +void mch_delay(long msec, int ignoreinput); +int mch_remove(char_u *name); +void mch_breakcheck(int force); +long_u mch_total_mem(int special); +int mch_wrename(WCHAR *wold, WCHAR *wnew); +int mch_rename(const char *pszOldFile, const char *pszNewFile); +char *default_shell(void); +int mch_access(char *n, int p); +int mch_open(const char *name, int flags, int mode); +FILE *mch_fopen(const char *name, const char *mode); +int mch_copy_file_attribute(char_u *from, char_u *to); +int myresetstkoflw(void); +int get_cmd_argsW(char ***argvp); +void free_cmd_argsW(void); +void used_file_arg(char *name, int literal, int full_path, int diff_mode); +void set_alist_count(void); +void fix_arg_enc(void); +int mch_setenv(char *var, char *value, int x); +void control_console_color_rgb(void); +int has_vtp_working(void); +int use_vtp(void); +int is_term_win32(void); /* vim: set ft=c : */ diff --git a/src/proto/popupmnu.pro b/src/proto/popupmnu.pro index 74a53e2f0e..f553100bb1 100644 --- a/src/proto/popupmnu.pro +++ b/src/proto/popupmnu.pro @@ -1,8 +1,15 @@ /* popupmnu.c */ -void pum_display __ARGS((pumitem_T *array, int size, int selected)); -void pum_redraw __ARGS((void)); -void pum_undisplay __ARGS((void)); -void pum_clear __ARGS((void)); -int pum_visible __ARGS((void)); -int pum_get_height __ARGS((void)); +void pum_display(pumitem_T *array, int size, int selected); +void pum_redraw(void); +void pum_undisplay(void); +void pum_clear(void); +int pum_visible(void); +void pum_may_redraw(void); +int pum_get_height(void); +int split_message(char_u *mesg, pumitem_T **array); +void ui_remove_balloon(void); +void ui_post_balloon(char_u *mesg, list_T *list); +void ui_may_remove_balloon(void); +void pum_show_popupmenu(vimmenu_T *menu); +void pum_make_popup(char_u *path_name, int use_mouse_pos); /* vim: set ft=c : */ diff --git a/src/proto/pty.pro b/src/proto/pty.pro index f2424a5096..35e5c2b7ac 100644 --- a/src/proto/pty.pro +++ b/src/proto/pty.pro @@ -1,3 +1,4 @@ /* pty.c */ -int OpenPTY __ARGS((char **ttyn)); -int SetupSlavePTY __ARGS((int fd)); +int SetupSlavePTY(int fd); +int OpenPTY(char **ttyn); +/* vim: set ft=c : */ diff --git a/src/proto/quickfix.pro b/src/proto/quickfix.pro index a5c690f646..d32655f078 100644 --- a/src/proto/quickfix.pro +++ b/src/proto/quickfix.pro @@ -1,30 +1,31 @@ /* quickfix.c */ -int qf_init __ARGS((win_T *wp, char_u *efile, char_u *errorformat, int newlist, char_u *qf_title)); -void qf_free_all __ARGS((win_T *wp)); -void copy_loclist __ARGS((win_T *from, win_T *to)); -void qf_jump __ARGS((qf_info_T *qi, int dir, int errornr, int forceit)); -void qf_list __ARGS((exarg_T *eap)); -void qf_age __ARGS((exarg_T *eap)); -void qf_mark_adjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)); -void ex_cwindow __ARGS((exarg_T *eap)); -void ex_cclose __ARGS((exarg_T *eap)); -void ex_copen __ARGS((exarg_T *eap)); -linenr_T qf_current_entry __ARGS((win_T *wp)); -int bt_quickfix __ARGS((buf_T *buf)); -int bt_nofile __ARGS((buf_T *buf)); -int bt_dontwrite __ARGS((buf_T *buf)); -int bt_dontwrite_msg __ARGS((buf_T *buf)); -int buf_hide __ARGS((buf_T *buf)); -int grep_internal __ARGS((cmdidx_T cmdidx)); -void ex_make __ARGS((exarg_T *eap)); -void ex_cc __ARGS((exarg_T *eap)); -void ex_cnext __ARGS((exarg_T *eap)); -void ex_cfile __ARGS((exarg_T *eap)); -void ex_vimgrep __ARGS((exarg_T *eap)); -char_u *skip_vimgrep_pat __ARGS((char_u *p, char_u **s, int *flags)); -int get_errorlist __ARGS((win_T *wp, list_T *list)); -int set_errorlist __ARGS((win_T *wp, list_T *list, int action, char_u *title)); -void ex_cbuffer __ARGS((exarg_T *eap)); -void ex_cexpr __ARGS((exarg_T *eap)); -void ex_helpgrep __ARGS((exarg_T *eap)); +int qf_init(win_T *wp, char_u *efile, char_u *errorformat, int newlist, char_u *qf_title, char_u *enc); +void qf_free_all(win_T *wp); +void copy_loclist(win_T *from, win_T *to); +void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit); +void qf_list(exarg_T *eap); +void qf_age(exarg_T *eap); +void qf_history(exarg_T *eap); +void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after); +void ex_cwindow(exarg_T *eap); +void ex_cclose(exarg_T *eap); +void ex_copen(exarg_T *eap); +void ex_cbottom(exarg_T *eap); +linenr_T qf_current_entry(win_T *wp); +int grep_internal(cmdidx_T cmdidx); +void ex_make(exarg_T *eap); +int qf_get_size(exarg_T *eap); +int qf_get_cur_idx(exarg_T *eap); +int qf_get_cur_valid_idx(exarg_T *eap); +void ex_cc(exarg_T *eap); +void ex_cnext(exarg_T *eap); +void ex_cfile(exarg_T *eap); +void ex_vimgrep(exarg_T *eap); +int get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list); +int qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict); +int set_errorlist(win_T *wp, list_T *list, int action, char_u *title, dict_T *what); +int set_ref_in_quickfix(int copyID); +void ex_cbuffer(exarg_T *eap); +void ex_cexpr(exarg_T *eap); +void ex_helpgrep(exarg_T *eap); /* vim: set ft=c : */ diff --git a/src/proto/regexp.pro b/src/proto/regexp.pro index a42c5944a8..d22a83b0ee 100644 --- a/src/proto/regexp.pro +++ b/src/proto/regexp.pro @@ -1,19 +1,20 @@ /* regexp.c */ -int re_multiline __ARGS((regprog_T *prog)); -int re_lookbehind __ARGS((regprog_T *prog)); -char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp)); -int vim_regcomp_had_eol __ARGS((void)); -void free_regexp_stuff __ARGS((void)); -reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em)); -void unref_extmatch __ARGS((reg_extmatch_T *em)); -char_u *regtilde __ARGS((char_u *source, int magic)); -int vim_regsub __ARGS((regmatch_T *rmp, char_u *source, char_u *dest, int copy, int magic, int backslash)); -int vim_regsub_multi __ARGS((regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash)); -char_u *reg_submatch __ARGS((int no)); -list_T *reg_submatch_list __ARGS((int no)); -regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags)); -void vim_regfree __ARGS((regprog_T *prog)); -int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); -int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); -long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); +int re_multiline(regprog_T *prog); +int re_lookbehind(regprog_T *prog); +char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp); +int vim_regcomp_had_eol(void); +void free_regexp_stuff(void); +reg_extmatch_T *ref_extmatch(reg_extmatch_T *em); +void unref_extmatch(reg_extmatch_T *em); +char_u *regtilde(char_u *source, int magic); +int vim_regsub(regmatch_T *rmp, char_u *source, typval_T *expr, char_u *dest, int copy, int magic, int backslash); +int vim_regsub_multi(regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash); +char_u *reg_submatch(int no); +list_T *reg_submatch_list(int no); +regprog_T *vim_regcomp(char_u *expr_arg, int re_flags); +void vim_regfree(regprog_T *prog); +int vim_regexec_prog(regprog_T **prog, int ignore_case, char_u *line, colnr_T col); +int vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col); +int vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col); +long vim_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm, int *timed_out); /* vim: set ft=c : */ diff --git a/src/proto/screen.pro b/src/proto/screen.pro index 31f97d5444..2b8a6fd028 100644 --- a/src/proto/screen.pro +++ b/src/proto/screen.pro @@ -1,56 +1,62 @@ /* screen.c */ -void redraw_later __ARGS((int type)); -void redraw_win_later __ARGS((win_T *wp, int type)); -void redraw_later_clear __ARGS((void)); -void redraw_all_later __ARGS((int type)); -void redraw_curbuf_later __ARGS((int type)); -void redraw_buf_later __ARGS((buf_T *buf, int type)); -int redraw_asap __ARGS((int type)); -void redrawWinline __ARGS((linenr_T lnum, int invalid)); -void update_curbuf __ARGS((int type)); -void update_screen __ARGS((int type)); -int conceal_cursor_line __ARGS((win_T *wp)); -void conceal_check_cursur_line __ARGS((void)); -void update_single_line __ARGS((win_T *wp, linenr_T lnum)); -void update_debug_sign __ARGS((buf_T *buf, linenr_T lnum)); -void updateWindow __ARGS((win_T *wp)); -void rl_mirror __ARGS((char_u *str)); -void status_redraw_all __ARGS((void)); -void status_redraw_curbuf __ARGS((void)); -void redraw_statuslines __ARGS((void)); -void win_redraw_last_status __ARGS((frame_T *frp)); -void win_redr_status_matches __ARGS((expand_T *xp, int num_matches, char_u **matches, int match, int showtail)); -void win_redr_status __ARGS((win_T *wp)); -int stl_connected __ARGS((win_T *wp)); -int get_keymap_str __ARGS((win_T *wp, char_u *buf, int len)); -void screen_putchar __ARGS((int c, int row, int col, int attr)); -void screen_getbytes __ARGS((int row, int col, char_u *bytes, int *attrp)); -void screen_puts __ARGS((char_u *text, int row, int col, int attr)); -void screen_puts_len __ARGS((char_u *text, int len, int row, int col, int attr)); -void screen_stop_highlight __ARGS((void)); -void reset_cterm_colors __ARGS((void)); -void screen_draw_rectangle __ARGS((int row, int col, int height, int width, int invert)); -void screen_fill __ARGS((int start_row, int end_row, int start_col, int end_col, int c1, int c2, int attr)); -void check_for_delay __ARGS((int check_msg_scroll)); -int screen_valid __ARGS((int doclear)); -void screenalloc __ARGS((int doclear)); -void free_screenlines __ARGS((void)); -void screenclear __ARGS((void)); -int can_clear __ARGS((char_u *p)); -void screen_start __ARGS((void)); -void windgoto __ARGS((int row, int col)); -void setcursor __ARGS((void)); -int win_ins_lines __ARGS((win_T *wp, int row, int line_count, int invalid, int mayclear)); -int win_del_lines __ARGS((win_T *wp, int row, int line_count, int invalid, int mayclear)); -int screen_ins_lines __ARGS((int off, int row, int line_count, int end, win_T *wp)); -int screen_del_lines __ARGS((int off, int row, int line_count, int end, int force, win_T *wp)); -int showmode __ARGS((void)); -void unshowmode __ARGS((int force)); -void get_trans_bufname __ARGS((buf_T *buf)); -int redrawing __ARGS((void)); -int messaging __ARGS((void)); -void showruler __ARGS((int always)); -int number_width __ARGS((win_T *wp)); -int screen_screencol __ARGS((void)); -int screen_screenrow __ARGS((void)); +void redraw_later(int type); +void redraw_win_later(win_T *wp, int type); +void redraw_later_clear(void); +void redraw_all_later(int type); +void redraw_curbuf_later(int type); +void redraw_buf_later(buf_T *buf, int type); +void redraw_buf_and_status_later(buf_T *buf, int type); +int redraw_asap(int type); +void redraw_after_callback(int call_update_screen); +void redrawWinline(linenr_T lnum, int invalid); +void reset_updating_screen(int may_resize_shell); +void update_curbuf(int type); +int update_screen(int type_arg); +int conceal_cursor_line(win_T *wp); +void conceal_check_cursor_line(void); +void update_single_line(win_T *wp, linenr_T lnum); +void update_debug_sign(buf_T *buf, linenr_T lnum); +void updateWindow(win_T *wp); +int screen_get_current_line_off(void); +void screen_line(int row, int coloff, int endcol, int clear_width, int rlflag); +void rl_mirror(char_u *str); +void status_redraw_all(void); +void status_redraw_curbuf(void); +void redraw_statuslines(void); +void win_redraw_last_status(frame_T *frp); +void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, int match, int showtail); +int stl_connected(win_T *wp); +int get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len); +void screen_putchar(int c, int row, int col, int attr); +void screen_getbytes(int row, int col, char_u *bytes, int *attrp); +void screen_puts(char_u *text, int row, int col, int attr); +void screen_puts_len(char_u *text, int textlen, int row, int col, int attr); +void screen_stop_highlight(void); +void reset_cterm_colors(void); +void screen_draw_rectangle(int row, int col, int height, int width, int invert); +void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1, int c2, int attr); +void check_for_delay(int check_msg_scroll); +int screen_valid(int doclear); +void screenalloc(int doclear); +void free_screenlines(void); +void screenclear(void); +int can_clear(char_u *p); +void screen_start(void); +void windgoto(int row, int col); +void setcursor(void); +void setcursor_mayforce(int force); +int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear); +int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr); +int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp); +int screen_del_lines(int off, int row, int line_count, int end, int force, int clear_attr, win_T *wp); +int showmode(void); +void unshowmode(int force); +void clearmode(void); +void get_trans_bufname(buf_T *buf); +int redrawing(void); +int messaging(void); +void showruler(int always); +int number_width(win_T *wp); +int screen_screencol(void); +int screen_screenrow(void); /* vim: set ft=c : */ diff --git a/src/proto/search.pro b/src/proto/search.pro index f94fb69ab2..88cc4746c6 100644 --- a/src/proto/search.pro +++ b/src/proto/search.pro @@ -1,40 +1,54 @@ /* search.c */ -int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch)); -char_u *get_search_pat __ARGS((void)); -char_u *reverse_text __ARGS((char_u *s)); -void save_search_patterns __ARGS((void)); -void restore_search_patterns __ARGS((void)); -void free_search_patterns __ARGS((void)); -int ignorecase __ARGS((char_u *pat)); -int pat_has_uppercase __ARGS((char_u *pat)); -char_u *last_search_pat __ARGS((void)); -void reset_search_dir __ARGS((void)); -void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast)); -void last_pat_prog __ARGS((regmmatch_T *regmatch)); -int searchit __ARGS((win_T *win, buf_T *buf, pos_T *pos, int dir, char_u *pat, long count, int options, int pat_use, linenr_T stop_lnum, proftime_T *tm)); -void set_search_direction __ARGS((int cdir)); -int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm)); -int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat)); -int searchc __ARGS((cmdarg_T *cap, int t_cmd)); -pos_T *findmatch __ARGS((oparg_T *oap, int initc)); -pos_T *findmatchlimit __ARGS((oparg_T *oap, int initc, int flags, int maxtravel)); -void showmatch __ARGS((int c)); -int findsent __ARGS((int dir, long count)); -int findpar __ARGS((int *pincl, int dir, long count, int what, int both)); -int startPS __ARGS((linenr_T lnum, int para, int both)); -int fwd_word __ARGS((long count, int bigword, int eol)); -int bck_word __ARGS((long count, int bigword, int stop)); -int end_word __ARGS((long count, int bigword, int stop, int empty)); -int bckend_word __ARGS((long count, int bigword, int eol)); -int current_word __ARGS((oparg_T *oap, long count, int include, int bigword)); -int current_sent __ARGS((oparg_T *oap, long count, int include)); -int current_block __ARGS((oparg_T *oap, long count, int include, int what, int other)); -int current_tagblock __ARGS((oparg_T *oap, long count_arg, int include)); -int current_par __ARGS((oparg_T *oap, long count, int include, int type)); -int current_quote __ARGS((oparg_T *oap, long count, int include, int quotechar)); -int current_search __ARGS((long count, int forward)); -int linewhite __ARGS((linenr_T lnum)); -void find_pattern_in_path __ARGS((char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum)); -int read_viminfo_search_pattern __ARGS((vir_T *virp, int force)); -void write_viminfo_search_pattern __ARGS((FILE *fp)); +int search_regcomp(char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch); +char_u *get_search_pat(void); +char_u *reverse_text(char_u *s); +void save_re_pat(int idx, char_u *pat, int magic); +void save_search_patterns(void); +void restore_search_patterns(void); +void free_search_patterns(void); +void save_last_search_pattern(void); +void restore_last_search_pattern(void); +char_u *last_search_pattern(void); +int ignorecase(char_u *pat); +int ignorecase_opt(char_u *pat, int ic_in, int scs); +int pat_has_uppercase(char_u *pat); +char_u *last_csearch(void); +int last_csearch_forward(void); +int last_csearch_until(void); +void set_last_csearch(int c, char_u *s, int len); +void set_csearch_direction(int cdir); +void set_csearch_until(int t_cmd); +char_u *last_search_pat(void); +void reset_search_dir(void); +void set_last_search_pat(char_u *s, int idx, int magic, int setlast); +void last_pat_prog(regmmatch_T *regmatch); +int searchit(win_T *win, buf_T *buf, pos_T *pos, int dir, char_u *pat, long count, int options, int pat_use, linenr_T stop_lnum, proftime_T *tm, int *timed_out); +void set_search_direction(int cdir); +int migemo_enabled(void); +void reset_migemo(int lastcall); +char_u* query_migemo(char_u* str); +int do_search(oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm, int *timed_out); +int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat); +int searchc(cmdarg_T *cap, int t_cmd); +pos_T *findmatch(oparg_T *oap, int initc); +pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int maxtravel); +void showmatch(int c); +int findsent(int dir, long count); +int findpar(int *pincl, int dir, long count, int what, int both); +int startPS(linenr_T lnum, int para, int both); +int fwd_word(long count, int bigword, int eol); +int bck_word(long count, int bigword, int stop); +int end_word(long count, int bigword, int stop, int empty); +int bckend_word(long count, int bigword, int eol); +int current_word(oparg_T *oap, long count, int include, int bigword); +int current_sent(oparg_T *oap, long count, int include); +int current_block(oparg_T *oap, long count, int include, int what, int other); +int current_tagblock(oparg_T *oap, long count_arg, int include); +int current_par(oparg_T *oap, long count, int include, int type); +int current_quote(oparg_T *oap, long count, int include, int quotechar); +int current_search(long count, int forward); +int linewhite(linenr_T lnum); +void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum); +int read_viminfo_search_pattern(vir_T *virp, int force); +void write_viminfo_search_pattern(FILE *fp); /* vim: set ft=c : */ diff --git a/src/proto/sha256.pro b/src/proto/sha256.pro index 464b35434d..157fa73c8c 100644 --- a/src/proto/sha256.pro +++ b/src/proto/sha256.pro @@ -1,9 +1,9 @@ /* sha256.c */ -void sha256_start __ARGS((context_sha256_T *ctx)); -void sha256_update __ARGS((context_sha256_T *ctx, char_u *input, UINT32_T length)); -void sha256_finish __ARGS((context_sha256_T *ctx, char_u digest[32])); -char_u *sha256_bytes __ARGS((char_u *buf, int buf_len, char_u *salt, int salt_len)); -char_u *sha256_key __ARGS((char_u *buf, char_u *salt, int salt_len)); -int sha256_self_test __ARGS((void)); -void sha2_seed __ARGS((char_u *header, int header_len, char_u *salt, int salt_len)); +void sha256_start(context_sha256_T *ctx); +void sha256_update(context_sha256_T *ctx, char_u *input, UINT32_T length); +void sha256_finish(context_sha256_T *ctx, char_u digest[32]); +char_u *sha256_bytes(char_u *buf, int buf_len, char_u *salt, int salt_len); +char_u *sha256_key(char_u *buf, char_u *salt, int salt_len); +int sha256_self_test(void); +void sha2_seed(char_u *header, int header_len, char_u *salt, int salt_len); /* vim: set ft=c : */ diff --git a/src/proto/spell.pro b/src/proto/spell.pro index 5c399b3709..ed0c495240 100644 --- a/src/proto/spell.pro +++ b/src/proto/spell.pro @@ -1,26 +1,38 @@ /* spell.c */ -int spell_check __ARGS((win_T *wp, char_u *ptr, hlf_T *attrp, int *capcol, int docount)); -int spell_move_to __ARGS((win_T *wp, int dir, int allwords, int curline, hlf_T *attrp)); -void spell_cat_line __ARGS((char_u *buf, char_u *line, int maxlen)); -char_u *did_set_spelllang __ARGS((win_T *wp)); -void spell_delete_wordlist __ARGS((void)); -void spell_free_all __ARGS((void)); -void spell_reload __ARGS((void)); -int spell_check_msm __ARGS((void)); -void ex_mkspell __ARGS((exarg_T *eap)); -void ex_spell __ARGS((exarg_T *eap)); -void spell_add_word __ARGS((char_u *word, int len, int bad, int idx, int undo)); -void init_spell_chartab __ARGS((void)); -int spell_check_sps __ARGS((void)); -void spell_suggest __ARGS((int count)); -void ex_spellrepall __ARGS((exarg_T *eap)); -void spell_suggest_list __ARGS((garray_T *gap, char_u *word, int maxcount, int need_cap, int interactive)); -char_u *eval_soundfold __ARGS((char_u *word)); -void ex_spellinfo __ARGS((exarg_T *eap)); -void ex_spelldump __ARGS((exarg_T *eap)); -void spell_dump_compl __ARGS((char_u *pat, int ic, int *dir, int dumpflags_arg)); -char_u *spell_to_word_end __ARGS((char_u *start, win_T *win)); -int spell_word_start __ARGS((int startcol)); -void spell_expand_check_cap __ARGS((colnr_T col)); -int expand_spelling __ARGS((linenr_T lnum, char_u *pat, char_u ***matchp)); +int spell_check(win_T *wp, char_u *ptr, hlf_T *attrp, int *capcol, int docount); +int spell_move_to(win_T *wp, int dir, int allwords, int curline, hlf_T *attrp); +void spell_cat_line(char_u *buf, char_u *line, int maxlen); +char_u *spell_enc(void); +slang_T *slang_alloc(char_u *lang); +void slang_free(slang_T *lp); +void slang_clear(slang_T *lp); +void slang_clear_sug(slang_T *lp); +void count_common_word(slang_T *lp, char_u *word, int len, int count); +int byte_in_str(char_u *str, int n); +int init_syl_tab(slang_T *slang); +char_u *did_set_spelllang(win_T *wp); +int captype(char_u *word, char_u *end); +void spell_delete_wordlist(void); +void spell_free_all(void); +void spell_reload(void); +buf_T *open_spellbuf(void); +void close_spellbuf(buf_T *buf); +void clear_spell_chartab(spelltab_T *sp); +void init_spell_chartab(void); +int spell_iswordp_nmw(char_u *p, win_T *wp); +int spell_casefold(char_u *str, int len, char_u *buf, int buflen); +int spell_check_sps(void); +void spell_suggest(int count); +void ex_spellrepall(exarg_T *eap); +void spell_suggest_list(garray_T *gap, char_u *word, int maxcount, int need_cap, int interactive); +void onecap_copy(char_u *word, char_u *wcopy, int upper); +char_u *eval_soundfold(char_u *word); +void spell_soundfold(slang_T *slang, char_u *inword, int folded, char_u *res); +void ex_spellinfo(exarg_T *eap); +void ex_spelldump(exarg_T *eap); +void spell_dump_compl(char_u *pat, int ic, int *dir, int dumpflags_arg); +char_u *spell_to_word_end(char_u *start, win_T *win); +int spell_word_start(int startcol); +void spell_expand_check_cap(colnr_T col); +int expand_spelling(linenr_T lnum, char_u *pat, char_u ***matchp); /* vim: set ft=c : */ diff --git a/src/proto/spellfile.pro b/src/proto/spellfile.pro new file mode 100644 index 0000000000..70e993aae7 --- /dev/null +++ b/src/proto/spellfile.pro @@ -0,0 +1,9 @@ +/* spellfile.c */ +slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, int silent); +void suggest_load_files(void); +int spell_check_msm(void); +void ex_mkspell(exarg_T *eap); +void mkspell(int fcount, char_u **fnames, int ascii, int over_write, int added_word); +void ex_spell(exarg_T *eap); +void spell_add_word(char_u *word, int len, int bad, int idx, int undo); +/* vim: set ft=c : */ diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro index af81ac68e0..966a5cb0a5 100644 --- a/src/proto/syntax.pro +++ b/src/proto/syntax.pro @@ -1,56 +1,65 @@ /* syntax.c */ -void syntax_start __ARGS((win_T *wp, linenr_T lnum)); -void syn_stack_free_all __ARGS((synblock_T *block)); -void syn_stack_apply_changes __ARGS((buf_T *buf)); -void syntax_end_parsing __ARGS((linenr_T lnum)); -int syntax_check_changed __ARGS((linenr_T lnum)); -int get_syntax_attr __ARGS((colnr_T col, int *can_spell, int keep_state)); -void syntax_clear __ARGS((synblock_T *block)); -void reset_synblock __ARGS((win_T *wp)); -void ex_syntax __ARGS((exarg_T *eap)); -void ex_ownsyntax __ARGS((exarg_T *eap)); -int syntax_present __ARGS((win_T *win)); -void reset_expand_highlight __ARGS((void)); -void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg)); -void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg)); -char_u *get_syntax_name __ARGS((expand_T *xp, int idx)); -int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp, int keep_state)); -int get_syntax_info __ARGS((int *seqnrp)); -int syn_get_sub_char __ARGS((void)); -int syn_get_stack_item __ARGS((int i)); -int syn_get_foldlevel __ARGS((win_T *wp, long lnum)); -void ex_syntime __ARGS((exarg_T *eap)); -char_u *get_syntime_arg __ARGS((expand_T *xp, int idx)); -void init_highlight __ARGS((int both, int reset)); -int load_colors __ARGS((char_u *name)); -void do_highlight __ARGS((char_u *line, int forceit, int init)); -void free_highlight __ARGS((void)); -void restore_cterm_colors __ARGS((void)); -void set_normal_colors __ARGS((void)); -char_u *hl_get_font_name __ARGS((void)); -void hl_set_font_name __ARGS((char_u *font_name)); -void hl_set_bg_color_name __ARGS((char_u *name)); -void hl_set_fg_color_name __ARGS((char_u *name)); -void clear_hl_tables __ARGS((void)); -int hl_combine_attr __ARGS((int char_attr, int prim_attr)); -attrentry_T *syn_gui_attr2entry __ARGS((int attr)); -int syn_attr2attr __ARGS((int attr)); -attrentry_T *syn_term_attr2entry __ARGS((int attr)); -attrentry_T *syn_cterm_attr2entry __ARGS((int attr)); -char_u *highlight_has_attr __ARGS((int id, int flag, int modec)); -char_u *highlight_color __ARGS((int id, char_u *what, int modec)); -long_u highlight_gui_color_rgb __ARGS((int id, int fg)); -int syn_name2id __ARGS((char_u *name)); -int highlight_exists __ARGS((char_u *name)); -char_u *syn_id2name __ARGS((int id)); -int syn_namen2id __ARGS((char_u *linep, int len)); -int syn_check_group __ARGS((char_u *pp, int len)); -int syn_id2attr __ARGS((int hl_id)); -int syn_id2colors __ARGS((int hl_id, guicolor_T *fgp, guicolor_T *bgp)); -int syn_get_final_id __ARGS((int hl_id)); -void highlight_gui_started __ARGS((void)); -int highlight_changed __ARGS((void)); -void set_context_in_highlight_cmd __ARGS((expand_T *xp, char_u *arg)); -char_u *get_highlight_name __ARGS((expand_T *xp, int idx)); -void free_highlight_fonts __ARGS((void)); +void syn_set_timeout(proftime_T *tm); +void syntax_start(win_T *wp, linenr_T lnum); +void syn_stack_free_all(synblock_T *block); +void syn_stack_apply_changes(buf_T *buf); +void syntax_end_parsing(linenr_T lnum); +int syntax_check_changed(linenr_T lnum); +int get_syntax_attr(colnr_T col, int *can_spell, int keep_state); +void syntax_clear(synblock_T *block); +void reset_synblock(win_T *wp); +void ex_syntax(exarg_T *eap); +void ex_ownsyntax(exarg_T *eap); +int syntax_present(win_T *win); +void reset_expand_highlight(void); +void set_context_in_echohl_cmd(expand_T *xp, char_u *arg); +void set_context_in_syntax_cmd(expand_T *xp, char_u *arg); +char_u *get_syntax_name(expand_T *xp, int idx); +int syn_get_id(win_T *wp, long lnum, colnr_T col, int trans, int *spellp, int keep_state); +int get_syntax_info(int *seqnrp); +int syn_get_sub_char(void); +int syn_get_stack_item(int i); +int syn_get_foldlevel(win_T *wp, long lnum); +void ex_syntime(exarg_T *eap); +char_u *get_syntime_arg(expand_T *xp, int idx); +void init_highlight(int both, int reset); +int load_colors(char_u *name); +int lookup_color(int idx, int foreground, int *boldp); +void do_highlight(char_u *line, int forceit, int init); +void free_highlight(void); +void restore_cterm_colors(void); +void set_normal_colors(void); +char_u *hl_get_font_name(void); +void hl_set_font_name(char_u *font_name); +void hl_set_bg_color_name(char_u *name); +void hl_set_fg_color_name(char_u *name); +guicolor_T color_name2handle(char_u *name); +int get_cterm_attr_idx(int attr, int fg, int bg); +int get_tgc_attr_idx(int attr, guicolor_T fg, guicolor_T bg); +int get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg); +void clear_hl_tables(void); +int hl_combine_attr(int char_attr, int prim_attr); +attrentry_T *syn_gui_attr2entry(int attr); +int syn_attr2attr(int attr); +attrentry_T *syn_term_attr2entry(int attr); +attrentry_T *syn_cterm_attr2entry(int attr); +char_u *highlight_has_attr(int id, int flag, int modec); +char_u *highlight_color(int id, char_u *what, int modec); +long_u highlight_gui_color_rgb(int id, int fg); +int syn_name2id(char_u *name); +int syn_name2attr(char_u *name); +int highlight_exists(char_u *name); +char_u *syn_id2name(int id); +int syn_namen2id(char_u *linep, int len); +int syn_check_group(char_u *pp, int len); +int syn_id2attr(int hl_id); +int syn_id2colors(int hl_id, guicolor_T *fgp, guicolor_T *bgp); +void syn_id2cterm_bg(int hl_id, int *fgp, int *bgp); +int syn_get_final_id(int hl_id); +void highlight_gui_started(void); +int highlight_changed(void); +void set_context_in_highlight_cmd(expand_T *xp, char_u *arg); +char_u *get_highlight_name(expand_T *xp, int idx); +char_u *get_highlight_name_ext(expand_T *xp, int idx, int skip_cleared); +void free_highlight_fonts(void); /* vim: set ft=c : */ diff --git a/src/proto/tag.pro b/src/proto/tag.pro index 01388f65b8..497a76e38b 100644 --- a/src/proto/tag.pro +++ b/src/proto/tag.pro @@ -1,12 +1,12 @@ /* tag.c */ -int do_tag __ARGS((char_u *tag, int type, int count, int forceit, int verbose)); -void tag_freematch __ARGS((void)); -void do_tags __ARGS((exarg_T *eap)); -int find_tags __ARGS((char_u *pat, int *num_matches, char_u ***matchesp, int flags, int mincount, char_u *buf_ffname)); -void free_tag_stuff __ARGS((void)); -int get_tagfname __ARGS((tagname_T *tnp, int first, char_u *buf)); -void tagname_free __ARGS((tagname_T *tnp)); -void simplify_filename __ARGS((char_u *filename)); -int expand_tags __ARGS((int tagnames, char_u *pat, int *num_file, char_u ***file)); -int get_tags __ARGS((list_T *list, char_u *pat)); +int do_tag(char_u *tag, int type, int count, int forceit, int verbose); +void tag_freematch(void); +void do_tags(exarg_T *eap); +int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int mincount, char_u *buf_ffname); +void free_tag_stuff(void); +int get_tagfname(tagname_T *tnp, int first, char_u *buf); +void tagname_free(tagname_T *tnp); +void simplify_filename(char_u *filename); +int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file); +int get_tags(list_T *list, char_u *pat, char_u *buf_fname); /* vim: set ft=c : */ diff --git a/src/proto/term.pro b/src/proto/term.pro index 89d58a0d0f..7eafdeffa9 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -1,64 +1,80 @@ /* term.c */ -int set_termname __ARGS((char_u *term)); -void set_mouse_termcode __ARGS((int n, char_u *s)); -void del_mouse_termcode __ARGS((int n)); -void getlinecol __ARGS((long *cp, long *rp)); -int add_termcap_entry __ARGS((char_u *name, int force)); -int term_is_8bit __ARGS((char_u *name)); -int term_is_gui __ARGS((char_u *name)); -char_u *tltoa __ARGS((unsigned long i)); -void termcapinit __ARGS((char_u *name)); -void out_flush __ARGS((void)); -void out_flush_check __ARGS((void)); -void out_trash __ARGS((void)); -void out_char __ARGS((unsigned c)); -void out_str_nf __ARGS((char_u *s)); -void out_str __ARGS((char_u *s)); -void term_windgoto __ARGS((int row, int col)); -void term_cursor_right __ARGS((int i)); -void term_append_lines __ARGS((int line_count)); -void term_delete_lines __ARGS((int line_count)); -void term_set_winpos __ARGS((int x, int y)); -void term_set_winsize __ARGS((int width, int height)); -void term_fg_color __ARGS((int n)); -void term_bg_color __ARGS((int n)); -void term_settitle __ARGS((char_u *title)); -void ttest __ARGS((int pairs)); -void add_long_to_buf __ARGS((long_u val, char_u *dst)); -void check_shellsize __ARGS((void)); -void limit_screen_size __ARGS((void)); -void win_new_shellsize __ARGS((void)); -void shell_resized __ARGS((void)); -void shell_resized_check __ARGS((void)); -void set_shellsize __ARGS((int width, int height, int mustset)); -void settmode __ARGS((int tmode)); -void starttermcap __ARGS((void)); -void stoptermcap __ARGS((void)); -int did_request_esc_sequence __ARGS((void)); -void resume_get_esc_sequence __ARGS((void)); -void may_req_termresponse __ARGS((void)); -void may_req_ambiguous_char_width __ARGS((void)); -int swapping_screen __ARGS((void)); -void setmouse __ARGS((void)); -int mouse_has __ARGS((int c)); -int mouse_model_popup __ARGS((void)); -void scroll_start __ARGS((void)); -void cursor_on __ARGS((void)); -void cursor_off __ARGS((void)); -void term_cursor_shape __ARGS((void)); -void scroll_region_set __ARGS((win_T *wp, int off)); -void scroll_region_reset __ARGS((void)); -void clear_termcodes __ARGS((void)); -void add_termcode __ARGS((char_u *name, char_u *string, int flags)); -char_u *find_termcode __ARGS((char_u *name)); -char_u *get_termcode __ARGS((int i)); -void del_termcode __ARGS((char_u *name)); -void set_mouse_topline __ARGS((win_T *wp)); -int check_termcode __ARGS((int max_offset, char_u *buf, int bufsize, int *buflen)); -char_u *replace_termcodes __ARGS((char_u *from, char_u **bufp, int from_part, int do_lt, int special)); -int find_term_bykeys __ARGS((char_u *src)); -void show_termcodes __ARGS((void)); -int show_one_termcode __ARGS((char_u *name, char_u *code, int printit)); -char_u *translate_mapping __ARGS((char_u *str, int expmap)); -void update_tcap __ARGS((int attr)); +guicolor_T termgui_mch_get_color(char_u *name); +guicolor_T termgui_get_color(char_u *name); +guicolor_T termgui_mch_get_rgb(guicolor_T color); +int set_termname(char_u *term); +void set_mouse_termcode(int n, char_u *s); +void del_mouse_termcode(int n); +void getlinecol(long *cp, long *rp); +int add_termcap_entry(char_u *name, int force); +int term_is_8bit(char_u *name); +int term_is_gui(char_u *name); +char_u *tltoa(unsigned long i); +void termcapinit(char_u *name); +void out_flush(void); +void out_flush_cursor(int force, int clear_selection); +void out_flush_check(void); +void out_trash(void); +void out_char(unsigned c); +void out_str_nf(char_u *s); +void out_str_cf(char_u *s); +void out_str(char_u *s); +void term_windgoto(int row, int col); +void term_cursor_right(int i); +void term_append_lines(int line_count); +void term_delete_lines(int line_count); +void term_set_winpos(int x, int y); +int term_get_winpos(int *x, int *y, varnumber_T timeout); +void term_set_winsize(int height, int width); +void term_fg_color(int n); +void term_bg_color(int n); +void term_fg_rgb_color(guicolor_T rgb); +void term_bg_rgb_color(guicolor_T rgb); +void term_settitle(char_u *title); +void ttest(int pairs); +void add_long_to_buf(long_u val, char_u *dst); +void check_shellsize(void); +void limit_screen_size(void); +void win_new_shellsize(void); +void shell_resized(void); +void shell_resized_check(void); +void set_shellsize(int width, int height, int mustset); +void settmode(int tmode); +void starttermcap(void); +void stoptermcap(void); +void may_req_termresponse(void); +void may_req_ambiguous_char_width(void); +void may_req_bg_color(void); +int swapping_screen(void); +void setmouse(void); +int mouse_has(int c); +int mouse_model_popup(void); +void scroll_start(void); +void cursor_on(void); +void cursor_off(void); +void term_cursor_mode(int forced); +void term_cursor_color(char_u *color); +int blink_state_is_inverted(void); +void term_cursor_shape(int shape, int blink); +void scroll_region_set(win_T *wp, int off); +void scroll_region_reset(void); +void clear_termcodes(void); +void add_termcode(char_u *name, char_u *string, int flags); +char_u *find_termcode(char_u *name); +char_u *get_termcode(int i); +void del_termcode(char_u *name); +void set_mouse_topline(win_T *wp); +int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen); +void term_get_fg_color(char_u *r, char_u *g, char_u *b); +void term_get_bg_color(char_u *r, char_u *g, char_u *b); +char_u *replace_termcodes(char_u *from, char_u **bufp, int from_part, int do_lt, int special); +int find_term_bykeys(char_u *src); +void show_termcodes(void); +int show_one_termcode(char_u *name, char_u *code, int printit); +char_u *translate_mapping(char_u *str, int expmap); +void update_tcap(int attr); +void swap_tcap(void); +guicolor_T gui_get_color_cmn(char_u *name); +guicolor_T gui_get_rgb_color_cmn(int r, int g, int b); +void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx); /* vim: set ft=c : */ diff --git a/src/proto/terminal.pro b/src/proto/terminal.pro new file mode 100644 index 0000000000..25f9647f25 --- /dev/null +++ b/src/proto/terminal.pro @@ -0,0 +1,59 @@ +/* terminal.c */ +void init_job_options(jobopt_T *opt); +buf_T *term_start(typval_T *argvar, char **argv, jobopt_T *opt, int flags); +void ex_terminal(exarg_T *eap); +int term_write_session(FILE *fd, win_T *wp); +int term_should_restore(buf_T *buf); +void free_terminal(buf_T *buf); +void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel); +int term_job_running(term_T *term); +int term_none_open(term_T *term); +int term_try_stop_job(buf_T *buf); +int term_check_timers(int next_due_arg, proftime_T *now); +int term_in_normal_mode(void); +void term_enter_job_mode(void); +int send_keys_to_term(term_T *term, int c, int typed); +int terminal_is_active(void); +cursorentry_T *term_get_cursor_shape(guicolor_T *fg, guicolor_T *bg); +int term_use_loop(void); +void term_win_entered(void); +int terminal_loop(int blocking); +void term_job_ended(job_T *job); +void term_channel_closed(channel_T *ch); +void term_check_channel_closed_recently(void); +int term_do_update_window(win_T *wp); +void term_update_window(win_T *wp); +int term_is_finished(buf_T *buf); +int term_show_buffer(buf_T *buf); +void term_change_in_curbuf(void); +int term_get_attr(buf_T *buf, linenr_T lnum, int col); +char_u *term_get_status_text(term_T *term); +int set_ref_in_term(int copyID); +void set_terminal_default_colors(int cterm_fg, int cterm_bg); +void f_term_dumpwrite(typval_T *argvars, typval_T *rettv); +int term_swap_diff(void); +void f_term_dumpdiff(typval_T *argvars, typval_T *rettv); +void f_term_dumpload(typval_T *argvars, typval_T *rettv); +void f_term_getaltscreen(typval_T *argvars, typval_T *rettv); +void f_term_getattr(typval_T *argvars, typval_T *rettv); +void f_term_getcursor(typval_T *argvars, typval_T *rettv); +void f_term_getjob(typval_T *argvars, typval_T *rettv); +void f_term_getline(typval_T *argvars, typval_T *rettv); +void f_term_getscrolled(typval_T *argvars, typval_T *rettv); +void f_term_getsize(typval_T *argvars, typval_T *rettv); +void f_term_setsize(typval_T *argvars, typval_T *rettv); +void f_term_getstatus(typval_T *argvars, typval_T *rettv); +void f_term_gettitle(typval_T *argvars, typval_T *rettv); +void f_term_gettty(typval_T *argvars, typval_T *rettv); +void f_term_list(typval_T *argvars, typval_T *rettv); +void f_term_scrape(typval_T *argvars, typval_T *rettv); +void f_term_sendkeys(typval_T *argvars, typval_T *rettv); +void f_term_getansicolors(typval_T *argvars, typval_T *rettv); +void f_term_setansicolors(typval_T *argvars, typval_T *rettv); +void f_term_setrestore(typval_T *argvars, typval_T *rettv); +void f_term_setkill(typval_T *argvars, typval_T *rettv); +void f_term_start(typval_T *argvars, typval_T *rettv); +void f_term_wait(typval_T *argvars, typval_T *rettv); +void term_send_eof(channel_T *ch); +int terminal_enabled(void); +/* vim: set ft=c : */ diff --git a/src/proto/termlib.pro b/src/proto/termlib.pro index 4369ecfc63..3dd120f183 100644 --- a/src/proto/termlib.pro +++ b/src/proto/termlib.pro @@ -1,8 +1,8 @@ /* termlib.c */ -int tgetent __ARGS((char *tbuf, char *term)); -int tgetflag __ARGS((char *id)); -int tgetnum __ARGS((char *id)); -char *tgetstr __ARGS((char *id, char **buf)); -char *tgoto __ARGS((char *cm, int col, int line)); -int tputs __ARGS((char *cp, int affcnt, void (*outc)(unsigned int))); +int tgetent(char *tbuf, char *term); +int tgetflag(char *id); +int tgetnum(char *id); +char *tgetstr(char *id, char **buf); +char *tgoto(char *cm, int col, int line); +int tputs(char *cp, int affcnt, void (*outc)(unsigned int)); /* vim: set ft=c : */ diff --git a/src/proto/ui.pro b/src/proto/ui.pro index 234e99fd7e..ac830f0fcb 100644 --- a/src/proto/ui.pro +++ b/src/proto/ui.pro @@ -1,65 +1,71 @@ /* ui.c */ -void ui_write __ARGS((char_u *s, int len)); -void ui_inchar_undo __ARGS((char_u *s, int len)); -int ui_inchar __ARGS((char_u *buf, int maxlen, long wtime, int tb_change_cnt)); -int ui_char_avail __ARGS((void)); -void ui_delay __ARGS((long msec, int ignoreinput)); -void ui_suspend __ARGS((void)); -void suspend_shell __ARGS((void)); -int ui_get_shellsize __ARGS((void)); -void ui_set_shellsize __ARGS((int mustset)); -void ui_new_shellsize __ARGS((void)); -void ui_breakcheck __ARGS((void)); -void clip_init __ARGS((int can_use)); -void clip_update_selection __ARGS((VimClipboard *clip)); -void clip_own_selection __ARGS((VimClipboard *cbd)); -void clip_lose_selection __ARGS((VimClipboard *cbd)); -void clip_auto_select __ARGS((void)); -int clip_isautosel_star __ARGS((void)); -int clip_isautosel_plus __ARGS((void)); -void clip_modeless __ARGS((int button, int is_click, int is_drag)); -void clip_start_selection __ARGS((int col, int row, int repeated_click)); -void clip_process_selection __ARGS((int button, int col, int row, int_u repeated_click)); -void clip_may_redraw_selection __ARGS((int row, int col, int len)); -void clip_clear_selection __ARGS((VimClipboard *cbd)); -void clip_may_clear_selection __ARGS((int row1, int row2)); -void clip_scroll_selection __ARGS((int rows)); -void clip_copy_modeless_selection __ARGS((int both)); -int clip_gen_own_selection __ARGS((VimClipboard *cbd)); -void clip_gen_lose_selection __ARGS((VimClipboard *cbd)); -void clip_gen_set_selection __ARGS((VimClipboard *cbd)); -void clip_gen_request_selection __ARGS((VimClipboard *cbd)); -int clip_gen_owner_exists __ARGS((VimClipboard *cbd)); -int vim_is_input_buf_full __ARGS((void)); -int vim_is_input_buf_empty __ARGS((void)); -int vim_free_in_input_buf __ARGS((void)); -int vim_used_in_input_buf __ARGS((void)); -char_u *get_input_buf __ARGS((void)); -void set_input_buf __ARGS((char_u *p)); -void add_to_input_buf __ARGS((char_u *s, int len)); -void add_to_input_buf_csi __ARGS((char_u *str, int len)); -void push_raw_key __ARGS((char_u *s, int len)); -void trash_input_buf __ARGS((void)); -int read_from_input_buf __ARGS((char_u *buf, long maxlen)); -void fill_input_buf __ARGS((int exit_on_error)); -void read_error_exit __ARGS((void)); -void ui_cursor_shape __ARGS((void)); -int check_col __ARGS((int col)); -int check_row __ARGS((int row)); -void open_app_context __ARGS((void)); -void x11_setup_atoms __ARGS((Display *dpy)); -void x11_setup_selection __ARGS((Widget w)); -void clip_x11_request_selection __ARGS((Widget myShell, Display *dpy, VimClipboard *cbd)); -void clip_x11_lose_selection __ARGS((Widget myShell, VimClipboard *cbd)); -int clip_x11_own_selection __ARGS((Widget myShell, VimClipboard *cbd)); -void clip_x11_set_selection __ARGS((VimClipboard *cbd)); -int clip_x11_owner_exists __ARGS((VimClipboard *cbd)); -void yank_cut_buffer0 __ARGS((Display *dpy, VimClipboard *cbd)); -int jump_to_mouse __ARGS((int flags, int *inclusive, int which_button)); -int mouse_comp_pos __ARGS((win_T *win, int *rowp, int *colp, linenr_T *lnump)); -win_T *mouse_find_win __ARGS((int *rowp, int *colp)); -int get_fpos_of_mouse __ARGS((pos_T *mpos)); -int vcol2col __ARGS((win_T *wp, linenr_T lnum, int vcol)); -void ui_focus_change __ARGS((int in_focus)); -void im_save_status __ARGS((long *psave)); +void ui_write(char_u *s, int len); +void ui_inchar_undo(char_u *s, int len); +int ui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt); +int ui_wait_for_chars_or_timer(long wtime, int (*wait_func)(long wtime, int *interrupted, int ignore_input), int *interrupted, int ignore_input); +int ui_char_avail(void); +void ui_delay(long msec, int ignoreinput); +void ui_suspend(void); +void suspend_shell(void); +int ui_get_shellsize(void); +void ui_set_shellsize(int mustset); +void ui_new_shellsize(void); +void ui_breakcheck(void); +void ui_breakcheck_force(int force); +void clip_init(int can_use); +void clip_update_selection(VimClipboard *clip); +void clip_own_selection(VimClipboard *cbd); +void clip_lose_selection(VimClipboard *cbd); +void start_global_changes(void); +int is_clipboard_needs_update(void); +void end_global_changes(void); +void clip_auto_select(void); +int clip_isautosel_star(void); +int clip_isautosel_plus(void); +void clip_modeless(int button, int is_click, int is_drag); +void clip_start_selection(int col, int row, int repeated_click); +void clip_process_selection(int button, int col, int row, int_u repeated_click); +void clip_may_redraw_selection(int row, int col, int len); +void clip_clear_selection(VimClipboard *cbd); +void clip_may_clear_selection(int row1, int row2); +void clip_scroll_selection(int rows); +void clip_copy_modeless_selection(int both); +int clip_gen_own_selection(VimClipboard *cbd); +void clip_gen_lose_selection(VimClipboard *cbd); +void clip_gen_set_selection(VimClipboard *cbd); +void clip_gen_request_selection(VimClipboard *cbd); +int clip_gen_owner_exists(VimClipboard *cbd); +int vim_is_input_buf_full(void); +int vim_is_input_buf_empty(void); +int vim_free_in_input_buf(void); +int vim_used_in_input_buf(void); +char_u *get_input_buf(void); +void set_input_buf(char_u *p); +void add_to_input_buf(char_u *s, int len); +void add_to_input_buf_csi(char_u *str, int len); +void push_raw_key(char_u *s, int len); +void trash_input_buf(void); +int read_from_input_buf(char_u *buf, long maxlen); +void fill_input_buf(int exit_on_error); +void read_error_exit(void); +void ui_cursor_shape_forced(int forced); +void ui_cursor_shape(void); +int check_col(int col); +int check_row(int row); +void open_app_context(void); +void x11_setup_atoms(Display *dpy); +void x11_setup_selection(Widget w); +void clip_x11_request_selection(Widget myShell, Display *dpy, VimClipboard *cbd); +void clip_x11_lose_selection(Widget myShell, VimClipboard *cbd); +int clip_x11_own_selection(Widget myShell, VimClipboard *cbd); +void clip_x11_set_selection(VimClipboard *cbd); +int clip_x11_owner_exists(VimClipboard *cbd); +void yank_cut_buffer0(Display *dpy, VimClipboard *cbd); +int jump_to_mouse(int flags, int *inclusive, int which_button); +int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump); +win_T *mouse_find_win(int *rowp, int *colp); +int get_fpos_of_mouse(pos_T *mpos); +int vcol2col(win_T *wp, linenr_T lnum, int vcol); +void ui_focus_change(int in_focus); +void im_save_status(long *psave); /* vim: set ft=c : */ diff --git a/src/proto/undo.pro b/src/proto/undo.pro index f6741c6bc1..1052d40c2b 100644 --- a/src/proto/undo.pro +++ b/src/proto/undo.pro @@ -1,30 +1,31 @@ /* undo.c */ -int u_save_cursor __ARGS((void)); -int u_save __ARGS((linenr_T top, linenr_T bot)); -int u_savesub __ARGS((linenr_T lnum)); -int u_inssub __ARGS((linenr_T lnum)); -int u_savedel __ARGS((linenr_T lnum, long nlines)); -int undo_allowed __ARGS((void)); -int u_savecommon __ARGS((linenr_T top, linenr_T bot, linenr_T newbot, int reload)); -void u_compute_hash __ARGS((char_u *hash)); -char_u *u_get_undo_file_name __ARGS((char_u *buf_ffname, int reading)); -void u_write_undo __ARGS((char_u *name, int forceit, buf_T *buf, char_u *hash)); -void u_read_undo __ARGS((char_u *name, char_u *hash, char_u *orig_name)); -void u_undo __ARGS((int count)); -void u_redo __ARGS((int count)); -void undo_time __ARGS((long step, int sec, int file, int absolute)); -void u_sync __ARGS((int force)); -void ex_undolist __ARGS((exarg_T *eap)); -void ex_undojoin __ARGS((exarg_T *eap)); -void u_unchanged __ARGS((buf_T *buf)); -void u_find_first_changed __ARGS((void)); -void u_update_save_nr __ARGS((buf_T *buf)); -void u_clearall __ARGS((buf_T *buf)); -void u_saveline __ARGS((linenr_T lnum)); -void u_clearline __ARGS((void)); -void u_undoline __ARGS((void)); -void u_blockfree __ARGS((buf_T *buf)); -int bufIsChanged __ARGS((buf_T *buf)); -int curbufIsChanged __ARGS((void)); -void u_eval_tree __ARGS((u_header_T *first_uhp, list_T *list)); +int u_save_cursor(void); +int u_save(linenr_T top, linenr_T bot); +int u_savesub(linenr_T lnum); +int u_inssub(linenr_T lnum); +int u_savedel(linenr_T lnum, long nlines); +int undo_allowed(void); +int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload); +void u_compute_hash(char_u *hash); +char_u *u_get_undo_file_name(char_u *buf_ffname, int reading); +void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash); +void u_read_undo(char_u *name, char_u *hash, char_u *orig_name); +void u_undo(int count); +void u_redo(int count); +void undo_time(long step, int sec, int file, int absolute); +void u_sync(int force); +void ex_undolist(exarg_T *eap); +void ex_undojoin(exarg_T *eap); +void u_unchanged(buf_T *buf); +void u_find_first_changed(void); +void u_update_save_nr(buf_T *buf); +void u_clearall(buf_T *buf); +void u_saveline(linenr_T lnum); +void u_clearline(void); +void u_undoline(void); +void u_blockfree(buf_T *buf); +int bufIsChanged(buf_T *buf); +int bufIsChangedNotTerm(buf_T *buf); +int curbufIsChanged(void); +void u_eval_tree(u_header_T *first_uhp, list_T *list); /* vim: set ft=c : */ diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro new file mode 100644 index 0000000000..3149ec50a2 --- /dev/null +++ b/src/proto/userfunc.pro @@ -0,0 +1,60 @@ +/* userfunc.c */ +void func_init(void); +int get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate); +char_u *deref_func_name(char_u *name, int *lenp, partial_T **partialp, int no_autoload); +int get_func_tv(char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, partial_T *partial, dict_T *selfdict); +ufunc_T *find_func(char_u *name); +void free_all_functions(void); +int func_call(char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict, typval_T *rettv); +int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, int (*argv_func)(int, typval_T *, int), linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, partial_T *partial, dict_T *selfdict_in); +char_u *trans_function_name(char_u **pp, int skip, int flags, funcdict_T *fdp, partial_T **partial); +void ex_function(exarg_T *eap); +int eval_fname_script(char_u *p); +int translated_function_exists(char_u *name); +int function_exists(char_u *name, int no_deref); +char_u *get_expanded_name(char_u *name, int check); +void func_dump_profile(FILE *fd); +void prof_child_enter(proftime_T *tm); +void prof_child_exit(proftime_T *tm); +char_u *get_user_func_name(expand_T *xp, int idx); +void ex_delfunction(exarg_T *eap); +void func_unref(char_u *name); +void func_ptr_unref(ufunc_T *fp); +void func_ref(char_u *name); +void func_ptr_ref(ufunc_T *fp); +void ex_return(exarg_T *eap); +void ex_call(exarg_T *eap); +int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv); +void discard_pending_return(void *rettv); +char_u *get_return_cmd(void *rettv); +char_u *get_func_line(int c, void *cookie, int indent); +void func_line_start(void *cookie); +void func_line_exec(void *cookie); +void func_line_end(void *cookie); +int func_has_ended(void *cookie); +int func_has_abort(void *cookie); +dict_T *make_partial(dict_T *selfdict_in, typval_T *rettv); +char_u *func_name(void *cookie); +linenr_T *func_breakpoint(void *cookie); +int *func_dbg_tick(void *cookie); +int func_level(void *cookie); +int current_func_returned(void); +void *save_funccal(void); +void restore_funccal(void *vfc); +int free_unref_funccal(int copyID, int testing); +hashtab_T *get_funccal_local_ht(void); +dictitem_T *get_funccal_local_var(void); +hashtab_T *get_funccal_args_ht(void); +dictitem_T *get_funccal_args_var(void); +void *clear_current_funccal(void); +void restore_current_funccal(void *f); +void list_func_vars(int *first); +dict_T *get_current_funccal_dict(hashtab_T *ht); +hashitem_T *find_hi_in_scoped_ht(char_u *name, hashtab_T **pht); +dictitem_T *find_var_in_scoped_ht(char_u *name, int no_autoload); +int set_ref_in_previous_funccal(int copyID); +int set_ref_in_call_stack(int copyID); +int set_ref_in_functions(int copyID); +int set_ref_in_func_args(int copyID); +int set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID); +/* vim: set ft=c : */ diff --git a/src/proto/version.pro b/src/proto/version.pro index e6fb78f069..cd44e8b882 100644 --- a/src/proto/version.pro +++ b/src/proto/version.pro @@ -1,10 +1,11 @@ /* version.c */ -void make_version __ARGS((void)); -int highest_patch __ARGS((void)); -int has_patch __ARGS((int n)); -void ex_version __ARGS((exarg_T *eap)); -void list_version __ARGS((void)); -void maybe_intro_message __ARGS((void)); -void intro_message __ARGS((int colon)); -void ex_intro __ARGS((exarg_T *eap)); +void make_version(void); +int highest_patch(void); +int has_patch(int n); +void ex_version(exarg_T *eap); +void list_in_columns(char_u **items, int size, int current); +void list_version(void); +void maybe_intro_message(void); +void intro_message(int colon); +void ex_intro(exarg_T *eap); /* vim: set ft=c : */ diff --git a/src/proto/winclip.pro b/src/proto/winclip.pro index 5eee35d32e..990c1cfb09 100644 --- a/src/proto/winclip.pro +++ b/src/proto/winclip.pro @@ -1,15 +1,15 @@ /* winclip.c */ -int utf8_to_utf16 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp)); -int utf16_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr)); -void MultiByteToWideChar_alloc __ARGS((UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen)); -void WideCharToMultiByte_alloc __ARGS((UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef)); -void win_clip_init __ARGS((void)); -int clip_mch_own_selection __ARGS((VimClipboard *cbd)); -void clip_mch_lose_selection __ARGS((VimClipboard *cbd)); -void clip_mch_request_selection __ARGS((VimClipboard *cbd)); -void clip_mch_set_selection __ARGS((VimClipboard *cbd)); -short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp)); -char_u *utf16_to_enc __ARGS((short_u *str, int *lenp)); -void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen)); -void enc_to_acp __ARGS((char_u *str, int str_size, char_u **out, int *outlen)); +int utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp); +int utf16_to_utf8(short_u *instr, int inlen, char_u *outstr); +void MultiByteToWideChar_alloc(UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen); +void WideCharToMultiByte_alloc(UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef); +void win_clip_init(void); +int clip_mch_own_selection(VimClipboard *cbd); +void clip_mch_lose_selection(VimClipboard *cbd); +void clip_mch_request_selection(VimClipboard *cbd); +void clip_mch_set_selection(VimClipboard *cbd); +short_u *enc_to_utf16(char_u *str, int *lenp); +char_u *utf16_to_enc(short_u *str, int *lenp); +void acp_to_enc(char_u *str, int str_size, char_u **out, int *outlen); +void enc_to_acp(char_u *str, int str_size, char_u **out, int *outlen); /* vim: set ft=c : */ diff --git a/src/proto/window.pro b/src/proto/window.pro index 2d33c17576..7ed8042f7b 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -1,84 +1,97 @@ /* window.c */ -void do_window __ARGS((int nchar, long Prenum, int xchar)); -int win_split __ARGS((int size, int flags)); -int win_split_ins __ARGS((int size, int flags, win_T *new_wp, int dir)); -int win_valid __ARGS((win_T *win)); -int win_count __ARGS((void)); -int make_windows __ARGS((int count, int vertical)); -void win_move_after __ARGS((win_T *win1, win_T *win2)); -void win_equal __ARGS((win_T *next_curwin, int current, int dir)); -void close_windows __ARGS((buf_T *buf, int keep_curwin)); -int one_window __ARGS((void)); -int win_close __ARGS((win_T *win, int free_buf)); -void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp)); -void win_free_all __ARGS((void)); -win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp)); -void close_others __ARGS((int message, int forceit)); -void curwin_init __ARGS((void)); -void win_init_empty __ARGS((win_T *wp)); -int win_alloc_first __ARGS((void)); -void win_alloc_aucmd_win __ARGS((void)); -void win_init_size __ARGS((void)); -void free_tabpage __ARGS((tabpage_T *tp)); -int win_new_tabpage __ARGS((int after)); -int may_open_tabpage __ARGS((void)); -int make_tabpages __ARGS((int maxcount)); -int valid_tabpage __ARGS((tabpage_T *tpc)); -tabpage_T *find_tabpage __ARGS((int n)); -int tabpage_index __ARGS((tabpage_T *ftp)); -void goto_tabpage __ARGS((int n)); -void goto_tabpage_tp __ARGS((tabpage_T *tp, int trigger_enter_autocmds, int trigger_leave_autocmds)); -void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp)); -void tabpage_move __ARGS((int nr)); -void win_goto __ARGS((win_T *wp)); -win_T *win_find_nr __ARGS((int winnr)); -tabpage_T *win_find_tabpage __ARGS((win_T *win)); -void win_enter __ARGS((win_T *wp, int undo_sync)); -win_T *buf_jump_open_win __ARGS((buf_T *buf)); -win_T *buf_jump_open_tab __ARGS((buf_T *buf)); -void win_append __ARGS((win_T *after, win_T *wp)); -void win_remove __ARGS((win_T *wp, tabpage_T *tp)); -int win_alloc_lines __ARGS((win_T *wp)); -void win_free_lsize __ARGS((win_T *wp)); -void shell_new_rows __ARGS((void)); -void shell_new_columns __ARGS((void)); -void win_size_save __ARGS((garray_T *gap)); -void win_size_restore __ARGS((garray_T *gap)); -int win_comp_pos __ARGS((void)); -void win_setheight __ARGS((int height)); -void win_setheight_win __ARGS((int height, win_T *win)); -void win_setwidth __ARGS((int width)); -void win_setwidth_win __ARGS((int width, win_T *wp)); -void win_setminheight __ARGS((void)); -void win_drag_status_line __ARGS((win_T *dragwin, int offset)); -void win_drag_vsep_line __ARGS((win_T *dragwin, int offset)); -void win_new_height __ARGS((win_T *wp, int height)); -void win_new_width __ARGS((win_T *wp, int width)); -void win_comp_scroll __ARGS((win_T *wp)); -void command_height __ARGS((void)); -void last_status __ARGS((int morewin)); -int tabline_height __ARGS((void)); -char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum)); -char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum)); -char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum)); -char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname)); -int path_with_url __ARGS((char_u *fname)); -int vim_isAbsName __ARGS((char_u *name)); -int vim_FullName __ARGS((char_u *fname, char_u *buf, int len, int force)); -int min_rows __ARGS((void)); -int only_one_window __ARGS((void)); -void check_lnums __ARGS((int do_curwin)); -void make_snapshot __ARGS((int idx)); -void restore_snapshot __ARGS((int idx, int close_curwin)); -int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display)); -void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab, int no_display)); -void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf)); -void restore_buffer __ARGS((buf_T *save_curbuf)); -int win_hasvertsplit __ARGS((void)); -int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos)); -int match_delete __ARGS((win_T *wp, int id, int perr)); -void clear_matches __ARGS((win_T *wp)); -matchitem_T *get_match __ARGS((win_T *wp, int id)); -int get_win_number __ARGS((win_T *wp, win_T *first_win)); -int get_tab_number __ARGS((tabpage_T *tp)); +void do_window(int nchar, long Prenum, int xchar); +void get_wincmd_addr_type(char_u *arg, exarg_T *eap); +int win_split(int size, int flags); +int win_split_ins(int size, int flags, win_T *new_wp, int dir); +int win_valid(win_T *win); +int win_valid_any_tab(win_T *win); +int win_count(void); +int make_windows(int count, int vertical); +void win_move_after(win_T *win1, win_T *win2); +void win_equal(win_T *next_curwin, int current, int dir); +void close_windows(buf_T *buf, int keep_curwin); +int one_window(void); +int win_close(win_T *win, int free_buf); +void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp); +void win_free_all(void); +win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp); +void close_others(int message, int forceit); +void curwin_init(void); +void win_init_empty(win_T *wp); +int win_alloc_first(void); +void win_alloc_aucmd_win(void); +void win_init_size(void); +void free_tabpage(tabpage_T *tp); +int win_new_tabpage(int after); +int may_open_tabpage(void); +int make_tabpages(int maxcount); +int valid_tabpage(tabpage_T *tpc); +int valid_tabpage_win(tabpage_T *tpc); +void close_tabpage(tabpage_T *tab); +tabpage_T *find_tabpage(int n); +int tabpage_index(tabpage_T *ftp); +void goto_tabpage(int n); +void goto_tabpage_tp(tabpage_T *tp, int trigger_enter_autocmds, int trigger_leave_autocmds); +void goto_tabpage_win(tabpage_T *tp, win_T *wp); +void tabpage_move(int nr); +void win_goto(win_T *wp); +win_T *win_find_nr(int winnr); +tabpage_T *win_find_tabpage(win_T *win); +void win_enter(win_T *wp, int undo_sync); +win_T *buf_jump_open_win(buf_T *buf); +win_T *buf_jump_open_tab(buf_T *buf); +void win_append(win_T *after, win_T *wp); +void win_remove(win_T *wp, tabpage_T *tp); +int win_alloc_lines(win_T *wp); +void win_free_lsize(win_T *wp); +void shell_new_rows(void); +void shell_new_columns(void); +void win_size_save(garray_T *gap); +void win_size_restore(garray_T *gap); +int win_comp_pos(void); +void win_setheight(int height); +void win_setheight_win(int height, win_T *win); +void win_setwidth(int width); +void win_setwidth_win(int width, win_T *wp); +void win_setminheight(void); +void win_setminwidth(void); +void win_drag_status_line(win_T *dragwin, int offset); +void win_drag_vsep_line(win_T *dragwin, int offset); +void set_fraction(win_T *wp); +void win_new_height(win_T *wp, int height); +void scroll_to_fraction(win_T *wp, int prev_height); +void win_new_width(win_T *wp, int width); +void win_comp_scroll(win_T *wp); +void command_height(void); +void last_status(int morewin); +int tabline_height(void); +char_u *grab_file_name(long count, linenr_T *file_lnum); +char_u *file_name_at_cursor(int options, long count, linenr_T *file_lnum); +char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum); +char_u *find_file_name_in_path(char_u *ptr, int len, int options, long count, char_u *rel_fname); +int path_with_url(char_u *fname); +int vim_isAbsName(char_u *name); +int vim_FullName(char_u *fname, char_u *buf, int len, int force); +int min_rows(void); +int only_one_window(void); +void check_lnums(int do_curwin); +void make_snapshot(int idx); +void restore_snapshot(int idx, int close_curwin); +int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display); +void restore_win(win_T *save_curwin, tabpage_T *save_curtab, int no_display); +void switch_buffer(bufref_T *save_curbuf, buf_T *buf); +void restore_buffer(bufref_T *save_curbuf); +int win_hasvertsplit(void); +int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos_list, char_u *conceal_char); +int match_delete(win_T *wp, int id, int perr); +void clear_matches(win_T *wp); +matchitem_T *get_match(win_T *wp, int id); +int get_win_number(win_T *wp, win_T *first_win); +int get_tab_number(tabpage_T *tp); +int win_getid(typval_T *argvars); +int win_gotoid(typval_T *argvars); +void win_id2tabwin(typval_T *argvars, list_T *list); +win_T *win_id2wp(typval_T *argvars); +int win_id2win(typval_T *argvars); +void win_findbuf(typval_T *argvars, list_T *list); /* vim: set ft=c : */ diff --git a/src/proto/workshop.pro b/src/proto/workshop.pro index 426fded0b4..c4d101b941 100644 --- a/src/proto/workshop.pro +++ b/src/proto/workshop.pro @@ -1,49 +1,49 @@ /* workshop.c */ -void workshop_init __ARGS((void)); -void workshop_postinit __ARGS((void)); -void ex_wsverb __ARGS((exarg_T *eap)); -char *workshop_get_editor_name __ARGS((void)); -char *workshop_get_editor_version __ARGS((void)); -void workshop_load_file __ARGS((char *filename, int line, char *frameid)); -void workshop_reload_file __ARGS((char *filename, int line)); -void workshop_show_file __ARGS((char *filename)); -void workshop_goto_line __ARGS((char *filename, int lineno)); -void workshop_front_file __ARGS((char *filename)); -void workshop_save_file __ARGS((char *filename)); -void workshop_save_files __ARGS((void)); -void workshop_quit __ARGS((void)); -void workshop_minimize __ARGS((void)); -void workshop_maximize __ARGS((void)); -void workshop_add_mark_type __ARGS((int idx, char *colorspec, char *sign)); -void workshop_set_mark __ARGS((char *filename, int lineno, int markId, int idx)); -void workshop_change_mark_type __ARGS((char *filename, int markId, int idx)); -void workshop_goto_mark __ARGS((char *filename, int markId, char *message)); -void workshop_delete_mark __ARGS((char *filename, int markId)); -int workshop_get_mark_lineno __ARGS((char *filename, int markId)); -void workshop_moved_marks __ARGS((char *filename)); -int workshop_get_font_height __ARGS((void)); -void workshop_footer_message __ARGS((char *message, int severity)); -void workshop_menu_begin __ARGS((char *label)); -void workshop_submenu_begin __ARGS((char *label)); -void workshop_submenu_end __ARGS((void)); -void workshop_menu_item __ARGS((char *label, char *verb, char *accelerator, char *acceleratorText, char *name, char *filepos, char *sensitive)); -void workshop_menu_end __ARGS((void)); -void workshop_toolbar_begin __ARGS((void)); -void workshop_toolbar_end __ARGS((void)); -void workshop_toolbar_button __ARGS((char *label, char *verb, char *senseVerb, char *filepos, char *help, char *sense, char *file, char *left)); -void workshop_frame_sensitivities __ARGS((VerbSense *vs)); -void workshop_set_option __ARGS((char *option, char *value)); -void workshop_balloon_mode __ARGS((Boolean on)); -void workshop_balloon_delay __ARGS((int delay)); -void workshop_show_balloon_tip __ARGS((char *tip)); -void workshop_hotkeys __ARGS((Boolean on)); -int workshop_get_positions __ARGS((void *clientData, char **filename, int *curLine, int *curCol, int *selStartLine, int *selStartCol, int *selEndLine, int *selEndCol, int *selLength, char **selection)); -char *workshop_test_getcurrentfile __ARGS((void)); -int workshop_test_getcursorrow __ARGS((void)); -int workshop_test_getcursorcol __ARGS((void)); -char *workshop_test_getcursorrowtext __ARGS((void)); -char *workshop_test_getselectedtext __ARGS((void)); -void workshop_save_sensitivity __ARGS((char *filename)); -void workshop_beval_cb __ARGS((BalloonEval *beval, int state)); -void findYourself __ARGS((char *argv0)); +void workshop_init(void); +void workshop_postinit(void); +void ex_wsverb(exarg_T *eap); +char *workshop_get_editor_name(void); +char *workshop_get_editor_version(void); +void workshop_load_file(char *filename, int line, char *frameid); +void workshop_reload_file(char *filename, int line); +void workshop_show_file(char *filename); +void workshop_goto_line(char *filename, int lineno); +void workshop_front_file(char *filename); +void workshop_save_file(char *filename); +void workshop_save_files(void); +void workshop_quit(void); +void workshop_minimize(void); +void workshop_maximize(void); +void workshop_add_mark_type(int idx, char *colorspec, char *sign); +void workshop_set_mark(char *filename, int lineno, int markId, int idx); +void workshop_change_mark_type(char *filename, int markId, int idx); +void workshop_goto_mark(char *filename, int markId, char *message); +void workshop_delete_mark(char *filename, int markId); +int workshop_get_mark_lineno(char *filename, int markId); +void workshop_moved_marks(char *filename); +int workshop_get_font_height(void); +void workshop_footer_message(char *message, int severity); +void workshop_menu_begin(char *label); +void workshop_submenu_begin(char *label); +void workshop_submenu_end(void); +void workshop_menu_item(char *label, char *verb, char *accelerator, char *acceleratorText, char *name, char *filepos, char *sensitive); +void workshop_menu_end(void); +void workshop_toolbar_begin(void); +void workshop_toolbar_end(void); +void workshop_toolbar_button(char *label, char *verb, char *senseVerb, char *filepos, char *help, char *sense, char *file, char *left); +void workshop_frame_sensitivities(VerbSense *vs); +void workshop_set_option(char *option, char *value); +void workshop_balloon_mode(Boolean on); +void workshop_balloon_delay(int delay); +void workshop_show_balloon_tip(char *tip); +void workshop_hotkeys(Boolean on); +int workshop_get_positions(void *clientData, char **filename, int *curLine, int *curCol, int *selStartLine, int *selStartCol, int *selEndLine, int *selEndCol, int *selLength, char **selection); +char *workshop_test_getcurrentfile(void); +int workshop_test_getcursorrow(void); +int workshop_test_getcursorcol(void); +char *workshop_test_getcursorrowtext(void); +char *workshop_test_getselectedtext(void); +void workshop_save_sensitivity(char *filename); +void workshop_beval_cb(BalloonEval *beval, int state); +void findYourself(char *argv0); /* vim: set ft=c : */ diff --git a/src/pty.c b/src/pty.c index 4dad54c1f2..940f63e027 100644 --- a/src/pty.c +++ b/src/pty.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -43,6 +43,8 @@ #include "vim.h" +#if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) + #include <signal.h> #ifdef __CYGWIN32__ @@ -62,7 +64,7 @@ #ifdef sinix #undef buf_T #endif -# ifdef sun +# ifdef SUN_SYSTEM # include <sys/conf.h> # endif #endif @@ -87,11 +89,11 @@ # include <sys/ptem.h> #endif -#if !defined(sun) && !defined(VMS) && !defined(MACOS) +#if !defined(SUN_SYSTEM) && !defined(VMS) # include <sys/ioctl.h> #endif -#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) +#if defined(SUN_SYSTEM) && defined(LOCKPTY) && !defined(TIOCEXCL) # include <sys/ttold.h> #endif @@ -124,7 +126,7 @@ # undef HAVE_SVR4_PTYS #endif -static void initmaster __ARGS((int)); +static void initmaster(int); /* * Open all ptys with O_NOCTTY, just to be on the safe side. @@ -134,8 +136,7 @@ static void initmaster __ARGS((int)); #endif static void -initmaster(f) - int f UNUSED; +initmaster(int f UNUSED) { #ifndef VMS # ifdef POSIX @@ -156,8 +157,7 @@ initmaster(f) * pty on others. Needs to be tuned... */ int -SetupSlavePTY(fd) - int fd; +SetupSlavePTY(int fd) { if (fd < 0) return 0; @@ -168,7 +168,7 @@ SetupSlavePTY(fd) # endif if (ioctl(fd, I_PUSH, "ldterm") != 0) return -1; -# ifdef sun +# ifdef SUN_SYSTEM if (ioctl(fd, I_PUSH, "ttcompat") != 0) return -1; # endif @@ -180,8 +180,7 @@ SetupSlavePTY(fd) #if defined(OSX) && !defined(PTY_DONE) #define PTY_DONE int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { int f; static char TtyName[32]; @@ -198,8 +197,7 @@ OpenPTY(ttyn) && !defined(PTY_DONE) #define PTY_DONE int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { char *m, *s; int f; @@ -223,12 +221,11 @@ OpenPTY(ttyn) #if defined(__sgi) && !defined(PTY_DONE) #define PTY_DONE int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { int f; char *name; - RETSIGTYPE (*sigcld)__ARGS(SIGPROTOARG); + RETSIGTYPE (*sigcld) SIGPROTOARG; /* * SIGCHLD set to SIG_DFL for _getpty() because it may fork() and @@ -249,11 +246,10 @@ OpenPTY(ttyn) #if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) #define PTY_DONE int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { int f; - struct stat buf; + stat_T buf; /* used for opening a new pty-pair: */ static char TtyName[32]; @@ -271,21 +267,21 @@ OpenPTY(ttyn) } #endif -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X) +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \ + && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! - * Same for Mac OS X Leopard. */ + * Same for Mac OS X Leopard (10.5). */ #define PTY_DONE int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { int f; char *m; - char *(ptsname __ARGS((int))); - int unlockpt __ARGS((int)); - int grantpt __ARGS((int)); - RETSIGTYPE (*sigcld)__ARGS(SIGPROTOARG); + char *(ptsname(int)); + int unlockpt(int); + int grantpt(int); + RETSIGTYPE (*sigcld) SIGPROTOARG; /* used for opening a new pty-pair: */ static char TtyName[32]; @@ -319,8 +315,7 @@ int aixhack = -1; #endif int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { int f; /* used for opening a new pty-pair: */ @@ -366,8 +361,7 @@ static char TtyProto[] = "/dev/ttyXY"; # endif int -OpenPTY(ttyn) - char **ttyn; +OpenPTY(char **ttyn) { char *p, *q, *l, *d; int f; @@ -385,22 +379,16 @@ OpenPTY(ttyn) { for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++) { -#if !defined(MACOS) || defined(USE_CARBONIZED) if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1) -#else - if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_EXTRA)) == -1) -#endif continue; q[0] = *l; q[1] = *d; -#ifndef MACOS if (geteuid() != ROOT_UID && mch_access(TtyName, R_OK | W_OK)) { close(f); continue; } -#endif -#if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3) +#if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3) /* Hack to ensure that the slave side of the pty is * unused. May not work in anything other than SunOS4.1 */ @@ -423,3 +411,5 @@ OpenPTY(ttyn) return -1; } #endif + +#endif /* FEAT_GUI || FEAT_TERMINAL */ diff --git a/src/quickfix.c b/src/quickfix.c index c8954cc531..031c6e7a6b 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -21,8 +21,6 @@ struct dir_stack_T char_u *dirname; }; -static struct dir_stack_T *dir_stack = NULL; - /* * For each error the next struct is allocated and linked in a list. */ @@ -35,6 +33,7 @@ struct qfline_S int qf_fnum; /* file number for the line */ int qf_col; /* column where the error occurred */ int qf_nr; /* error number */ + char_u *qf_module; /* module name for this error */ char_u *qf_pattern; /* search pattern for the error */ char_u *qf_text; /* description of the error */ char_u qf_viscol; /* set to TRUE if qf_col is screen column */ @@ -48,18 +47,44 @@ struct qfline_S * There is a stack of error lists. */ #define LISTCOUNT 10 +#define INVALID_QFIDX (-1) +/* + * Quickfix/Location list definition + * Contains a list of entries (qfline_T). qf_start points to the first entry + * and qf_last points to the last entry. qf_count contains the list size. + * + * Usually the list contains one or more entries. But an empty list can be + * created using setqflist()/setloclist() with a title and/or user context + * information and entries can be added later using setqflist()/setloclist(). + */ typedef struct qf_list_S { + int_u qf_id; /* Unique identifier for this list */ qfline_T *qf_start; /* pointer to the first error */ + qfline_T *qf_last; /* pointer to the last error */ qfline_T *qf_ptr; /* pointer to the current error */ - int qf_count; /* number of errors (0 means no error list) */ + int qf_count; /* number of errors (0 means empty list) */ int qf_index; /* current index in the error list */ int qf_nonevalid; /* TRUE if not a single valid entry found */ char_u *qf_title; /* title derived from the command that created - * the error list */ + * the error list or set by setqflist */ + typval_T *qf_ctx; /* context set by setqflist/setloclist */ + + struct dir_stack_T *qf_dir_stack; + char_u *qf_directory; + struct dir_stack_T *qf_file_stack; + char_u *qf_currfile; + int qf_multiline; + int qf_multiignore; + int qf_multiscan; + long qf_changedtick; } qf_list_T; +/* + * Quickfix/Location list stack definition + * Contains a list of quickfix/location lists (qf_list_T) + */ struct qf_info_S { /* @@ -75,8 +100,9 @@ struct qf_info_S }; static qf_info_T ql_info; /* global quickfix list */ +static int_u last_qf_id = 0; /* Last used quickfix list id */ -#define FMT_PATTERNS 10 /* maximum number of % recognized */ +#define FMT_PATTERNS 11 /* maximum number of % recognized */ /* * Structure used to hold the info of one part of 'errorformat' @@ -106,36 +132,28 @@ struct efm_S int conthere; /* %> used */ }; -static int qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast, char_u *qf_title)); -static void qf_store_title __ARGS((qf_info_T *qi, char_u *title)); -static void qf_new_list __ARGS((qf_info_T *qi, char_u *qf_title)); -static void ll_free_all __ARGS((qf_info_T **pqi)); -static int qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid)); -static qf_info_T *ll_new_list __ARGS((void)); -static void qf_msg __ARGS((qf_info_T *qi)); -static void qf_free __ARGS((qf_info_T *qi, int idx)); -static char_u *qf_types __ARGS((int, int)); -static int qf_get_fnum __ARGS((char_u *, char_u *)); -static char_u *qf_push_dir __ARGS((char_u *, struct dir_stack_T **)); -static char_u *qf_pop_dir __ARGS((struct dir_stack_T **)); -static char_u *qf_guess_filepath __ARGS((char_u *)); -static void qf_fmt_text __ARGS((char_u *text, char_u *buf, int bufsize)); -static void qf_clean_dir_stack __ARGS((struct dir_stack_T **)); -#ifdef FEAT_WINDOWS -static int qf_win_pos_update __ARGS((qf_info_T *qi, int old_qf_index)); -static int is_qf_win __ARGS((win_T *win, qf_info_T *qi)); -static win_T *qf_find_win __ARGS((qf_info_T *qi)); -static buf_T *qf_find_buf __ARGS((qf_info_T *qi)); -static void qf_update_buffer __ARGS((qf_info_T *qi)); -static void qf_set_title_var __ARGS((qf_info_T *qi)); -static void qf_fill_buffer __ARGS((qf_info_T *qi)); -#endif -static char_u *get_mef_name __ARGS((void)); -static void restore_start_dir __ARGS((char_u *dirname_start)); -static buf_T *load_dummy_buffer __ARGS((char_u *fname, char_u *dirname_start, char_u *resulting_dir)); -static void wipe_dummy_buffer __ARGS((buf_T *buf, char_u *dirname_start)); -static void unload_dummy_buffer __ARGS((buf_T *buf, char_u *dirname_start)); -static qf_info_T *ll_get_or_alloc_list __ARGS((win_T *)); +static efm_T *fmt_start = NULL; /* cached across qf_parse_line() calls */ + +static void qf_new_list(qf_info_T *qi, char_u *qf_title); +static int qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid); +static void qf_free(qf_info_T *qi, int idx); +static char_u *qf_types(int, int); +static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *); +static char_u *qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack); +static char_u *qf_pop_dir(struct dir_stack_T **); +static char_u *qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *); +static void qf_fmt_text(char_u *text, char_u *buf, int bufsize); +static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); +static win_T *qf_find_win(qf_info_T *qi); +static buf_T *qf_find_buf(qf_info_T *qi); +static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last); +static void qf_set_title_var(qf_info_T *qi); +static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last); +static char_u *get_mef_name(void); +static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir); +static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); +static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); +static qf_info_T *ll_get_or_alloc_list(win_T *); /* Quickfix window check helper macro */ #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL) @@ -148,154 +166,323 @@ static qf_info_T *ll_get_or_alloc_list __ARGS((win_T *)); #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) /* - * Read the errorfile "efile" into memory, line by line, building the error - * list. Set the error list's title to qf_title. - * Return -1 for error, number of errors for success. + * Looking up a buffer can be slow if there are many. Remember the last one + * to make this a lot faster if there are multiple matches in the same file. */ - int -qf_init(wp, efile, errorformat, newlist, qf_title) - win_T *wp; - char_u *efile; - char_u *errorformat; - int newlist; /* TRUE: start a new error list */ - char_u *qf_title; +static char_u *qf_last_bufname = NULL; +static bufref_T qf_last_bufref = {NULL, 0, 0}; + +static char *e_loc_list_changed = + N_("E926: Current location list was changed"); + +/* + * Maximum number of bytes allowed per line while reading a errorfile. + */ +#define LINE_MAXLEN 4096 + +static struct fmtpattern { - qf_info_T *qi = &ql_info; + char_u convchar; + char *pattern; +} fmt_pat[FMT_PATTERNS] = + { + {'f', ".\\+"}, /* only used when at end */ + {'n', "\\d\\+"}, + {'l', "\\d\\+"}, + {'c', "\\d\\+"}, + {'t', "."}, + {'m', ".\\+"}, + {'r', ".*"}, + {'p', "[- .]*"}, + {'v', "\\d\\+"}, + {'s', ".\\+"}, + {'o', ".\\+"} + }; - if (efile == NULL) - return FAIL; +/* + * Convert an errorformat pattern to a regular expression pattern. + * See fmt_pat definition above for the list of supported patterns. + */ + static char_u * +fmtpat_to_regpat( + char_u *efmp, + efm_T *fmt_ptr, + int idx, + int round, + char_u *ptr, + char_u *errmsg) +{ + char_u *srcptr; - if (wp != NULL) + if (fmt_ptr->addr[idx]) { - qi = ll_get_or_alloc_list(wp); - if (qi == NULL) - return FAIL; + /* Each errorformat pattern can occur only once */ + sprintf((char *)errmsg, + _("E372: Too many %%%c in format string"), *efmp); + EMSG(errmsg); + return NULL; + } + if ((idx && idx < 6 + && vim_strchr((char_u *)"DXOPQ", fmt_ptr->prefix) != NULL) + || (idx == 6 + && vim_strchr((char_u *)"OPQ", fmt_ptr->prefix) == NULL)) + { + sprintf((char *)errmsg, + _("E373: Unexpected %%%c in format string"), *efmp); + EMSG(errmsg); + return NULL; + } + fmt_ptr->addr[idx] = (char_u)++round; + *ptr++ = '\\'; + *ptr++ = '('; +#ifdef BACKSLASH_IN_FILENAME + if (*efmp == 'f') + { + /* Also match "c:" in the file name, even when + * checking for a colon next: "%f:". + * "\%(\a:\)\=" */ + STRCPY(ptr, "\\%(\\a:\\)\\="); + ptr += 10; + } +#endif + if (*efmp == 'f' && efmp[1] != NUL) + { + if (efmp[1] != '\\' && efmp[1] != '%') + { + /* A file name may contain spaces, but this isn't + * in "\f". For "%f:%l:%m" there may be a ":" in + * the file name. Use ".\{-1,}x" instead (x is + * the next character), the requirement that :999: + * follows should work. */ + STRCPY(ptr, ".\\{-1,}"); + ptr += 7; + } + else + { + /* File name followed by '\\' or '%': include as + * many file name chars as possible. */ + STRCPY(ptr, "\\f\\+"); + ptr += 4; + } + } + else + { + srcptr = (char_u *)fmt_pat[idx].pattern; + while ((*ptr = *srcptr++) != NUL) + ++ptr; } + *ptr++ = '\\'; + *ptr++ = ')'; - return qf_init_ext(qi, efile, curbuf, NULL, errorformat, newlist, - (linenr_T)0, (linenr_T)0, - qf_title); + return ptr; } /* - * Read the errorfile "efile" into memory, line by line, building the error - * list. - * Alternative: when "efile" is null read errors from buffer "buf". - * Always use 'errorformat' from "buf" if there is a local value. - * Then "lnumfirst" and "lnumlast" specify the range of lines to use. - * Set the title of the list to "qf_title". - * Return -1 for error, number of errors for success. + * Convert a scanf like format in 'errorformat' to a regular expression. */ - static int -qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast, - qf_title) - qf_info_T *qi; - char_u *efile; - buf_T *buf; - typval_T *tv; - char_u *errorformat; - int newlist; /* TRUE: start a new error list */ - linenr_T lnumfirst; /* first line number to use */ - linenr_T lnumlast; /* last line number to use */ - char_u *qf_title; -{ - char_u *namebuf; - char_u *errmsg; - char_u *pattern; - char_u *fmtstr = NULL; - int col = 0; - char_u use_viscol = FALSE; - int type = 0; - int valid; - linenr_T buflnum = lnumfirst; - long lnum = 0L; - int enr = 0; - FILE *fd = NULL; - qfline_T *qfprev = NULL; /* init to make SASC shut up */ - char_u *efmp; - efm_T *fmt_first = NULL; - efm_T *fmt_last = NULL; - efm_T *fmt_ptr; - efm_T *fmt_start = NULL; - char_u *efm; - char_u *ptr; - char_u *srcptr; - int len; - int i; - int round; - int idx = 0; - int multiline = FALSE; - int multiignore = FALSE; - int multiscan = FALSE; - int retval = -1; /* default: return error flag */ - char_u *directory = NULL; - char_u *currfile = NULL; - char_u *tail = NULL; - char_u *p_str = NULL; - listitem_T *p_li = NULL; - struct dir_stack_T *file_stack = NULL; - regmatch_T regmatch; - static struct fmtpattern - { - char_u convchar; - char *pattern; - } fmt_pat[FMT_PATTERNS] = - { - {'f', ".\\+"}, /* only used when at end */ - {'n', "\\d\\+"}, - {'l', "\\d\\+"}, - {'c', "\\d\\+"}, - {'t', "."}, - {'m', ".\\+"}, - {'r', ".*"}, - {'p', "[- .]*"}, - {'v', "\\d\\+"}, - {'s', ".\\+"} - }; - - namebuf = alloc(CMDBUFFSIZE + 1); - errmsg = alloc(CMDBUFFSIZE + 1); - pattern = alloc(CMDBUFFSIZE + 1); - if (namebuf == NULL || errmsg == NULL || pattern == NULL) - goto qf_init_end; + static char_u * +scanf_fmt_to_regpat( + char_u *efm, + int len, + char_u **pefmp, + char_u *ptr, + char_u *errmsg) +{ + char_u *efmp = *pefmp; - if (efile != NULL && (fd = mch_fopen((char *)efile, "r")) == NULL) + if (*++efmp == '[' || *efmp == '\\') { - EMSG2(_(e_openerrf), efile); - goto qf_init_end; + if ((*ptr++ = *efmp) == '[') /* %*[^a-z0-9] etc. */ + { + if (efmp[1] == '^') + *ptr++ = *++efmp; + if (efmp < efm + len) + { + *ptr++ = *++efmp; /* could be ']' */ + while (efmp < efm + len + && (*ptr++ = *++efmp) != ']') + /* skip */; + if (efmp == efm + len) + { + EMSG(_("E374: Missing ] in format string")); + return NULL; + } + } + } + else if (efmp < efm + len) /* %*\D, %*\s etc. */ + *ptr++ = *++efmp; + *ptr++ = '\\'; + *ptr++ = '+'; + } + else + { + /* TODO: scanf()-like: %*ud, %*3c, %*f, ... ? */ + sprintf((char *)errmsg, + _("E375: Unsupported %%%c in format string"), *efmp); + EMSG(errmsg); + return NULL; } - if (newlist || qi->qf_curlist == qi->qf_listcount) - /* make place for a new list */ - qf_new_list(qi, qf_title); - else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) - /* Adding to existing list, find last entry. */ - for (qfprev = qi->qf_lists[qi->qf_curlist].qf_start; - qfprev->qf_next != qfprev; qfprev = qfprev->qf_next) - ; + *pefmp = efmp; + + return ptr; +} /* - * Each part of the format string is copied and modified from errorformat to - * regex prog. Only a few % characters are allowed. + * Analyze/parse an errorformat prefix. */ - /* Use the local value of 'errorformat' if it's set. */ - if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) - efm = buf->b_p_efm; + static int +efm_analyze_prefix(char_u **pefmp, efm_T *fmt_ptr, char_u *errmsg) +{ + char_u *efmp = *pefmp; + + if (vim_strchr((char_u *)"+-", *efmp) != NULL) + fmt_ptr->flags = *efmp++; + if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) + fmt_ptr->prefix = *efmp; else - efm = errorformat; + { + sprintf((char *)errmsg, + _("E376: Invalid %%%c in format string prefix"), *efmp); + EMSG(errmsg); + return FAIL; + } + + *pefmp = efmp; + + return OK; +} + +/* + * Converts a 'errorformat' string to regular expression pattern + */ + static int +efm_to_regpat( + char_u *efm, + int len, + efm_T *fmt_ptr, + char_u *regpat, + char_u *errmsg) +{ + char_u *ptr; + char_u *efmp; + int round; + int idx = 0; + + /* + * Build regexp pattern from current 'errorformat' option + */ + ptr = regpat; + *ptr++ = '^'; + round = 0; + for (efmp = efm; efmp < efm + len; ++efmp) + { + if (*efmp == '%') + { + ++efmp; + for (idx = 0; idx < FMT_PATTERNS; ++idx) + if (fmt_pat[idx].convchar == *efmp) + break; + if (idx < FMT_PATTERNS) + { + ptr = fmtpat_to_regpat(efmp, fmt_ptr, idx, round, ptr, + errmsg); + if (ptr == NULL) + return -1; + round++; + } + else if (*efmp == '*') + { + ptr = scanf_fmt_to_regpat(efm, len, &efmp, ptr, errmsg); + if (ptr == NULL) + return -1; + } + else if (vim_strchr((char_u *)"%\\.^$~[", *efmp) != NULL) + *ptr++ = *efmp; /* regexp magic characters */ + else if (*efmp == '#') + *ptr++ = '*'; + else if (*efmp == '>') + fmt_ptr->conthere = TRUE; + else if (efmp == efm + 1) /* analyse prefix */ + { + if (efm_analyze_prefix(&efmp, fmt_ptr, errmsg) == FAIL) + return -1; + } + else + { + sprintf((char *)errmsg, + _("E377: Invalid %%%c in format string"), *efmp); + EMSG(errmsg); + return -1; + } + } + else /* copy normal character */ + { + if (*efmp == '\\' && efmp + 1 < efm + len) + ++efmp; + else if (vim_strchr((char_u *)".*^$~[", *efmp) != NULL) + *ptr++ = '\\'; /* escape regexp atoms */ + if (*efmp) + *ptr++ = *efmp; + } + } + *ptr++ = '$'; + *ptr = NUL; + + return 0; +} + + static void +free_efm_list(efm_T **efm_first) +{ + efm_T *efm_ptr; + + for (efm_ptr = *efm_first; efm_ptr != NULL; efm_ptr = *efm_first) + { + *efm_first = efm_ptr->next; + vim_regfree(efm_ptr->prog); + vim_free(efm_ptr); + } + fmt_start = NULL; +} + +/* Parse 'errorformat' option */ + static efm_T * +parse_efm_option(char_u *efm) +{ + char_u *errmsg = NULL; + int errmsglen; + efm_T *fmt_ptr = NULL; + efm_T *fmt_first = NULL; + efm_T *fmt_last = NULL; + char_u *fmtstr = NULL; + int len; + int i; + int round; + + errmsglen = CMDBUFFSIZE + 1; + errmsg = alloc_id(errmsglen, aid_qf_errmsg); + if (errmsg == NULL) + goto parse_efm_end; + + /* + * Each part of the format string is copied and modified from errorformat + * to regex prog. Only a few % characters are allowed. + */ + /* * Get some space to modify the format string into. */ i = (FMT_PATTERNS * 3) + ((int)STRLEN(efm) << 2); for (round = FMT_PATTERNS; round > 0; ) i += (int)STRLEN(fmt_pat[--round].pattern); -#ifdef COLON_IN_FILENAME - i += 12; /* "%f" can become twelve chars longer */ +#ifdef BACKSLASH_IN_FILENAME + i += 12; /* "%f" can become twelve chars longer (see efm_to_regpat) */ #else i += 2; /* "%f" can become two chars longer */ #endif if ((fmtstr = alloc(i)) == NULL) - goto error2; + goto parse_efm_error; while (efm[0] != NUL) { @@ -304,7 +491,7 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast, */ fmt_ptr = (efm_T *)alloc_clear((unsigned)sizeof(efm_T)); if (fmt_ptr == NULL) - goto error2; + goto parse_efm_error; if (fmt_first == NULL) /* first one */ fmt_first = fmt_ptr; else @@ -318,3526 +505,5606 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast, if (efm[len] == '\\' && efm[len + 1] != NUL) ++len; - /* - * Build regexp pattern from current 'errorformat' option - */ - ptr = fmtstr; - *ptr++ = '^'; - round = 0; - for (efmp = efm; efmp < efm + len; ++efmp) - { - if (*efmp == '%') - { - ++efmp; - for (idx = 0; idx < FMT_PATTERNS; ++idx) - if (fmt_pat[idx].convchar == *efmp) - break; - if (idx < FMT_PATTERNS) - { - if (fmt_ptr->addr[idx]) - { - sprintf((char *)errmsg, - _("E372: Too many %%%c in format string"), *efmp); - EMSG(errmsg); - goto error2; - } - if ((idx - && idx < 6 - && vim_strchr((char_u *)"DXOPQ", - fmt_ptr->prefix) != NULL) - || (idx == 6 - && vim_strchr((char_u *)"OPQ", - fmt_ptr->prefix) == NULL)) - { - sprintf((char *)errmsg, - _("E373: Unexpected %%%c in format string"), *efmp); - EMSG(errmsg); - goto error2; - } - fmt_ptr->addr[idx] = (char_u)++round; - *ptr++ = '\\'; - *ptr++ = '('; -#ifdef BACKSLASH_IN_FILENAME - if (*efmp == 'f') - { - /* Also match "c:" in the file name, even when - * checking for a colon next: "%f:". - * "\%(\a:\)\=" */ - STRCPY(ptr, "\\%(\\a:\\)\\="); - ptr += 10; - } -#endif - if (*efmp == 'f' && efmp[1] != NUL) - { - if (efmp[1] != '\\' && efmp[1] != '%') - { - /* A file name may contain spaces, but this isn't - * in "\f". For "%f:%l:%m" there may be a ":" in - * the file name. Use ".\{-1,}x" instead (x is - * the next character), the requirement that :999: - * follows should work. */ - STRCPY(ptr, ".\\{-1,}"); - ptr += 7; - } - else - { - /* File name followed by '\\' or '%': include as - * many file name chars as possible. */ - STRCPY(ptr, "\\f\\+"); - ptr += 4; - } - } - else - { - srcptr = (char_u *)fmt_pat[idx].pattern; - while ((*ptr = *srcptr++) != NUL) - ++ptr; - } - *ptr++ = '\\'; - *ptr++ = ')'; - } - else if (*efmp == '*') - { - if (*++efmp == '[' || *efmp == '\\') - { - if ((*ptr++ = *efmp) == '[') /* %*[^a-z0-9] etc. */ - { - if (efmp[1] == '^') - *ptr++ = *++efmp; - if (efmp < efm + len) - { - *ptr++ = *++efmp; /* could be ']' */ - while (efmp < efm + len - && (*ptr++ = *++efmp) != ']') - /* skip */; - if (efmp == efm + len) - { - EMSG(_("E374: Missing ] in format string")); - goto error2; - } - } - } - else if (efmp < efm + len) /* %*\D, %*\s etc. */ - *ptr++ = *++efmp; - *ptr++ = '\\'; - *ptr++ = '+'; - } - else - { - /* TODO: scanf()-like: %*ud, %*3c, %*f, ... ? */ - sprintf((char *)errmsg, - _("E375: Unsupported %%%c in format string"), *efmp); - EMSG(errmsg); - goto error2; - } - } - else if (vim_strchr((char_u *)"%\\.^$~[", *efmp) != NULL) - *ptr++ = *efmp; /* regexp magic characters */ - else if (*efmp == '#') - *ptr++ = '*'; - else if (*efmp == '>') - fmt_ptr->conthere = TRUE; - else if (efmp == efm + 1) /* analyse prefix */ - { - if (vim_strchr((char_u *)"+-", *efmp) != NULL) - fmt_ptr->flags = *efmp++; - if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) - fmt_ptr->prefix = *efmp; - else - { - sprintf((char *)errmsg, - _("E376: Invalid %%%c in format string prefix"), *efmp); - EMSG(errmsg); - goto error2; - } - } - else - { - sprintf((char *)errmsg, - _("E377: Invalid %%%c in format string"), *efmp); - EMSG(errmsg); - goto error2; - } - } - else /* copy normal character */ - { - if (*efmp == '\\' && efmp + 1 < efm + len) - ++efmp; - else if (vim_strchr((char_u *)".*^$~[", *efmp) != NULL) - *ptr++ = '\\'; /* escape regexp atoms */ - if (*efmp) - *ptr++ = *efmp; - } - } - *ptr++ = '$'; - *ptr = NUL; + if (efm_to_regpat(efm, len, fmt_ptr, fmtstr, errmsg) == -1) + goto parse_efm_error; if ((fmt_ptr->prog = vim_regcomp(fmtstr, RE_MAGIC + RE_STRING)) == NULL) - goto error2; + goto parse_efm_error; /* * Advance to next part */ efm = skip_to_option_part(efm + len); /* skip comma and spaces */ } + if (fmt_first == NULL) /* nothing found */ - { EMSG(_("E378: 'errorformat' contains no pattern")); - goto error2; - } + + goto parse_efm_end; + +parse_efm_error: + free_efm_list(&fmt_first); + +parse_efm_end: + vim_free(fmtstr); + vim_free(errmsg); + + return fmt_first; +} + +enum { + QF_FAIL = 0, + QF_OK = 1, + QF_END_OF_INPUT = 2, + QF_NOMEM = 3, + QF_IGNORE_LINE = 4, + QF_MULTISCAN = 5, +}; + +typedef struct { + char_u *linebuf; + int linelen; + char_u *growbuf; + int growbufsiz; + FILE *fd; + typval_T *tv; + char_u *p_str; + listitem_T *p_li; + buf_T *buf; + linenr_T buflnum; + linenr_T lnumlast; + vimconv_T vc; +} qfstate_T; + + static char_u * +qf_grow_linebuf(qfstate_T *state, int newsz) +{ + char_u *p; /* - * got_int is reset here, because it was probably set when killing the - * ":make" command, but we still want to read the errorfile then. + * If the line exceeds LINE_MAXLEN exclude the last + * byte since it's not a NL character. */ - got_int = FALSE; + state->linelen = newsz > LINE_MAXLEN ? LINE_MAXLEN - 1 : newsz; + if (state->growbuf == NULL) + { + state->growbuf = alloc(state->linelen + 1); + if (state->growbuf == NULL) + return NULL; + state->growbufsiz = state->linelen; + } + else if (state->linelen > state->growbufsiz) + { + if ((p = vim_realloc(state->growbuf, state->linelen + 1)) == NULL) + return NULL; + state->growbuf = p; + state->growbufsiz = state->linelen; + } + return state->growbuf; +} - /* Always ignore case when looking for a matching error. */ - regmatch.rm_ic = TRUE; +/* + * Get the next string (separated by newline) from state->p_str. + */ + static int +qf_get_next_str_line(qfstate_T *state) +{ + /* Get the next line from the supplied string */ + char_u *p_str = state->p_str; + char_u *p; + int len; - if (tv != NULL) + if (*p_str == NUL) /* Reached the end of the string */ + return QF_END_OF_INPUT; + + p = vim_strchr(p_str, '\n'); + if (p != NULL) + len = (int)(p - p_str) + 1; + else + len = (int)STRLEN(p_str); + + if (len > IOSIZE - 2) { - if (tv->v_type == VAR_STRING) - p_str = tv->vval.v_string; - else if (tv->v_type == VAR_LIST) - p_li = tv->vval.v_list->lv_first; + state->linebuf = qf_grow_linebuf(state, len); + if (state->linebuf == NULL) + return QF_NOMEM; + } + else + { + state->linebuf = IObuff; + state->linelen = len; } + vim_strncpy(state->linebuf, p_str, state->linelen); /* - * Read the lines in the error file one by one. - * Try to recognize one of the error formats in each line. + * Increment using len in order to discard the rest of the + * line if it exceeds LINE_MAXLEN. */ - while (!got_int) - { - /* Get the next line. */ - if (fd == NULL) - { - if (tv != NULL) - { - if (tv->v_type == VAR_STRING) - { - /* Get the next line from the supplied string */ - char_u *p; + p_str += len; + state->p_str = p_str; - if (!*p_str) /* Reached the end of the string */ - break; + return QF_OK; +} - p = vim_strchr(p_str, '\n'); - if (p) - len = (int)(p - p_str + 1); - else - len = (int)STRLEN(p_str); +/* + * Get the next string from state->p_Li. + */ + static int +qf_get_next_list_line(qfstate_T *state) +{ + listitem_T *p_li = state->p_li; + int len; - if (len > CMDBUFFSIZE - 2) - vim_strncpy(IObuff, p_str, CMDBUFFSIZE - 2); - else - vim_strncpy(IObuff, p_str, len); + while (p_li != NULL + && (p_li->li_tv.v_type != VAR_STRING + || p_li->li_tv.vval.v_string == NULL)) + p_li = p_li->li_next; /* Skip non-string items */ - p_str += len; - } - else if (tv->v_type == VAR_LIST) - { - /* Get the next line from the supplied list */ - while (p_li && p_li->li_tv.v_type != VAR_STRING) - p_li = p_li->li_next; /* Skip non-string items */ + if (p_li == NULL) /* End of the list */ + { + state->p_li = NULL; + return QF_END_OF_INPUT; + } - if (!p_li) /* End of the list */ - break; + len = (int)STRLEN(p_li->li_tv.vval.v_string); + if (len > IOSIZE - 2) + { + state->linebuf = qf_grow_linebuf(state, len); + if (state->linebuf == NULL) + return QF_NOMEM; + } + else + { + state->linebuf = IObuff; + state->linelen = len; + } - len = (int)STRLEN(p_li->li_tv.vval.v_string); - if (len > CMDBUFFSIZE - 2) - len = CMDBUFFSIZE - 2; + vim_strncpy(state->linebuf, p_li->li_tv.vval.v_string, state->linelen); - vim_strncpy(IObuff, p_li->li_tv.vval.v_string, len); + state->p_li = p_li->li_next; /* next item */ + return QF_OK; +} - p_li = p_li->li_next; /* next item */ - } - } - else - { - /* Get the next line from the supplied buffer */ - if (buflnum > lnumlast) - break; - vim_strncpy(IObuff, ml_get_buf(buf, buflnum++, FALSE), - CMDBUFFSIZE - 2); - } - } - else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL) - break; +/* + * Get the next string from state->buf. + */ + static int +qf_get_next_buf_line(qfstate_T *state) +{ + char_u *p_buf = NULL; + int len; - IObuff[CMDBUFFSIZE - 2] = NUL; /* for very long lines */ -#ifdef FEAT_MBYTE - remove_bom(IObuff); -#endif + /* Get the next line from the supplied buffer */ + if (state->buflnum > state->lnumlast) + return QF_END_OF_INPUT; - if ((efmp = vim_strrchr(IObuff, '\n')) != NULL) - *efmp = NUL; -#ifdef USE_CRNL - if ((efmp = vim_strrchr(IObuff, '\r')) != NULL) - *efmp = NUL; -#endif + p_buf = ml_get_buf(state->buf, state->buflnum, FALSE); + state->buflnum += 1; - /* If there was no %> item start at the first pattern */ - if (fmt_start == NULL) - fmt_ptr = fmt_first; - else - { - fmt_ptr = fmt_start; - fmt_start = NULL; - } + len = (int)STRLEN(p_buf); + if (len > IOSIZE - 2) + { + state->linebuf = qf_grow_linebuf(state, len); + if (state->linebuf == NULL) + return QF_NOMEM; + } + else + { + state->linebuf = IObuff; + state->linelen = len; + } + vim_strncpy(state->linebuf, p_buf, state->linelen); + + return QF_OK; +} + +/* + * Get the next string from file state->fd. + */ + static int +qf_get_next_file_line(qfstate_T *state) +{ + int discard; + int growbuflen; + + if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL) + return QF_END_OF_INPUT; + discard = FALSE; + state->linelen = (int)STRLEN(IObuff); + if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n')) + { /* - * Try to match each part of 'errorformat' until we find a complete - * match or no match. + * The current line exceeds IObuff, continue reading using + * growbuf until EOL or LINE_MAXLEN bytes is read. */ - valid = TRUE; -restofline: - for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) + if (state->growbuf == NULL) { - idx = fmt_ptr->prefix; - if (multiscan && vim_strchr((char_u *)"OPQ", idx) == NULL) - continue; - namebuf[0] = NUL; - pattern[0] = NUL; - if (!multiscan) - errmsg[0] = NUL; - lnum = 0; - col = 0; - use_viscol = FALSE; - enr = -1; - type = 0; - tail = NULL; - - regmatch.regprog = fmt_ptr->prog; - if (vim_regexec(®match, IObuff, (colnr_T)0)) - { - if ((idx == 'C' || idx == 'Z') && !multiline) - continue; - if (vim_strchr((char_u *)"EWI", idx) != NULL) - type = idx; - else - type = 0; - /* - * Extract error message data from matched line. - * We check for an actual submatch, because "\[" and "\]" in - * the 'errorformat' may cause the wrong submatch to be used. - */ - if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */ - { - int c; - - if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) - continue; + state->growbufsiz = 2 * (IOSIZE - 1); + state->growbuf = alloc(state->growbufsiz); + if (state->growbuf == NULL) + return QF_NOMEM; + } - /* Expand ~/file and $HOME/file to full path. */ - c = *regmatch.endp[i]; - *regmatch.endp[i] = NUL; - expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE); - *regmatch.endp[i] = c; + /* Copy the read part of the line, excluding null-terminator */ + memcpy(state->growbuf, IObuff, IOSIZE - 1); + growbuflen = state->linelen; - if (vim_strchr((char_u *)"OPQ", idx) != NULL - && mch_getperm(namebuf) == -1) - continue; - } - if ((i = (int)fmt_ptr->addr[1]) > 0) /* %n */ - { - if (regmatch.startp[i] == NULL) - continue; - enr = (int)atol((char *)regmatch.startp[i]); - } - if ((i = (int)fmt_ptr->addr[2]) > 0) /* %l */ - { - if (regmatch.startp[i] == NULL) - continue; - lnum = atol((char *)regmatch.startp[i]); - } - if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */ - { - if (regmatch.startp[i] == NULL) - continue; - col = (int)atol((char *)regmatch.startp[i]); - } - if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */ - { - if (regmatch.startp[i] == NULL) - continue; - type = *regmatch.startp[i]; - } - if (fmt_ptr->flags == '+' && !multiscan) /* %+ */ - STRCPY(errmsg, IObuff); - else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */ - { - if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) - continue; - len = (int)(regmatch.endp[i] - regmatch.startp[i]); - vim_strncpy(errmsg, regmatch.startp[i], len); - } - if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */ - { - if (regmatch.startp[i] == NULL) - continue; - tail = regmatch.startp[i]; - } - if ((i = (int)fmt_ptr->addr[7]) > 0) /* %p */ - { - char_u *match_ptr; + for (;;) + { + char_u *p; - if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) - continue; - col = 0; - for (match_ptr = regmatch.startp[i]; - match_ptr != regmatch.endp[i]; ++match_ptr) - { - ++col; - if (*match_ptr == TAB) - { - col += 7; - col -= col % 8; - } - } - ++col; - use_viscol = TRUE; - } - if ((i = (int)fmt_ptr->addr[8]) > 0) /* %v */ - { - if (regmatch.startp[i] == NULL) - continue; - col = (int)atol((char *)regmatch.startp[i]); - use_viscol = TRUE; - } - if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */ - { - if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) - continue; - len = (int)(regmatch.endp[i] - regmatch.startp[i]); - if (len > CMDBUFFSIZE - 5) - len = CMDBUFFSIZE - 5; - STRCPY(pattern, "^\\V"); - STRNCAT(pattern, regmatch.startp[i], len); - pattern[len + 3] = '\\'; - pattern[len + 4] = '$'; - pattern[len + 5] = NUL; - } + if (fgets((char *)state->growbuf + growbuflen, + state->growbufsiz - growbuflen, state->fd) == NULL) + break; + state->linelen = (int)STRLEN(state->growbuf + growbuflen); + growbuflen += state->linelen; + if ((state->growbuf)[growbuflen - 1] == '\n') + break; + if (state->growbufsiz == LINE_MAXLEN) + { + discard = TRUE; break; } + + state->growbufsiz = 2 * state->growbufsiz < LINE_MAXLEN + ? 2 * state->growbufsiz : LINE_MAXLEN; + if ((p = vim_realloc(state->growbuf, state->growbufsiz)) == NULL) + return QF_NOMEM; + state->growbuf = p; } - multiscan = FALSE; - if (fmt_ptr == NULL || idx == 'D' || idx == 'X') + while (discard) { - if (fmt_ptr != NULL) - { - if (idx == 'D') /* enter directory */ - { - if (*namebuf == NUL) - { - EMSG(_("E379: Missing or empty directory name")); - goto error2; - } - if ((directory = qf_push_dir(namebuf, &dir_stack)) == NULL) - goto error2; - } - else if (idx == 'X') /* leave directory */ - directory = qf_pop_dir(&dir_stack); - } - namebuf[0] = NUL; /* no match found, remove file name */ - lnum = 0; /* don't jump to this line */ - valid = FALSE; - STRCPY(errmsg, IObuff); /* copy whole line to error message */ - if (fmt_ptr == NULL) - multiline = multiignore = FALSE; + /* + * The current line is longer than LINE_MAXLEN, continue + * reading but discard everything until EOL or EOF is + * reached. + */ + if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL + || (int)STRLEN(IObuff) < IOSIZE - 1 + || IObuff[IOSIZE - 1] == '\n') + break; } - else if (fmt_ptr != NULL) - { - /* honor %> item */ - if (fmt_ptr->conthere) - fmt_start = fmt_ptr; - if (vim_strchr((char_u *)"AEWI", idx) != NULL) - { - multiline = TRUE; /* start of a multi-line message */ - multiignore = FALSE; /* reset continuation */ - } - else if (vim_strchr((char_u *)"CZ", idx) != NULL) - { /* continuation of multi-line msg */ - if (qfprev == NULL) - goto error2; - if (*errmsg && !multiignore) - { - len = (int)STRLEN(qfprev->qf_text); - if ((ptr = alloc((unsigned)(len + STRLEN(errmsg) + 2))) - == NULL) - goto error2; - STRCPY(ptr, qfprev->qf_text); - vim_free(qfprev->qf_text); - qfprev->qf_text = ptr; - *(ptr += len) = '\n'; - STRCPY(++ptr, errmsg); - } - if (qfprev->qf_nr == -1) - qfprev->qf_nr = enr; - if (vim_isprintc(type) && !qfprev->qf_type) - qfprev->qf_type = type; /* only printable chars allowed */ - if (!qfprev->qf_lnum) - qfprev->qf_lnum = lnum; - if (!qfprev->qf_col) - qfprev->qf_col = col; - qfprev->qf_viscol = use_viscol; - if (!qfprev->qf_fnum) - qfprev->qf_fnum = qf_get_fnum(directory, - *namebuf || directory ? namebuf - : currfile && valid ? currfile : 0); - if (idx == 'Z') - multiline = multiignore = FALSE; - line_breakcheck(); - continue; - } - else if (vim_strchr((char_u *)"OPQ", idx) != NULL) + state->linebuf = state->growbuf; + state->linelen = growbuflen; + } + else + state->linebuf = IObuff; + +#ifdef FEAT_MBYTE + /* Convert a line if it contains a non-ASCII character. */ + if (state->vc.vc_type != CONV_NONE && has_non_ascii(state->linebuf)) + { + char_u *line; + + line = string_convert(&state->vc, state->linebuf, &state->linelen); + if (line != NULL) + { + if (state->linelen < IOSIZE) { - /* global file names */ - valid = FALSE; - if (*namebuf == NUL || mch_getperm(namebuf) >= 0) - { - if (*namebuf && idx == 'P') - currfile = qf_push_dir(namebuf, &file_stack); - else if (idx == 'Q') - currfile = qf_pop_dir(&file_stack); - *namebuf = NUL; - if (tail && *tail) - { - STRMOVE(IObuff, skipwhite(tail)); - multiscan = TRUE; - goto restofline; - } - } + STRCPY(state->linebuf, line); + vim_free(line); } - if (fmt_ptr->flags == '-') /* generally exclude this line */ + else { - if (multiline) - multiignore = TRUE; /* also exclude continuation lines */ - continue; + vim_free(state->growbuf); + state->linebuf = state->growbuf = line; + state->growbufsiz = state->linelen < LINE_MAXLEN + ? state->linelen : LINE_MAXLEN; } } - - if (qf_add_entry(qi, &qfprev, - directory, - (*namebuf || directory) - ? namebuf - : ((currfile && valid) ? currfile : (char_u *)NULL), - 0, - errmsg, - lnum, - col, - use_viscol, - pattern, - enr, - type, - valid) == FAIL) - goto error2; - line_breakcheck(); } - if (fd == NULL || !ferror(fd)) +#endif + + return QF_OK; +} + +/* + * Get the next string from a file/buffer/list/string. + */ + static int +qf_get_nextline(qfstate_T *state) +{ + int status = QF_FAIL; + + if (state->fd == NULL) { - if (qi->qf_lists[qi->qf_curlist].qf_index == 0) + if (state->tv != NULL) { - /* no valid entry found */ - qi->qf_lists[qi->qf_curlist].qf_ptr = - qi->qf_lists[qi->qf_curlist].qf_start; - qi->qf_lists[qi->qf_curlist].qf_index = 1; - qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE; + if (state->tv->v_type == VAR_STRING) + /* Get the next line from the supplied string */ + status = qf_get_next_str_line(state); + else if (state->tv->v_type == VAR_LIST) + /* Get the next line from the supplied list */ + status = qf_get_next_list_line(state); } else - { - qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; - if (qi->qf_lists[qi->qf_curlist].qf_ptr == NULL) - qi->qf_lists[qi->qf_curlist].qf_ptr = - qi->qf_lists[qi->qf_curlist].qf_start; - } - /* return number of matches */ - retval = qi->qf_lists[qi->qf_curlist].qf_count; - goto qf_init_ok; + /* Get the next line from the supplied buffer */ + status = qf_get_next_buf_line(state); } - EMSG(_(e_readerrf)); -error2: - qf_free(qi, qi->qf_curlist); - qi->qf_listcount--; - if (qi->qf_curlist > 0) - --qi->qf_curlist; -qf_init_ok: - if (fd != NULL) - fclose(fd); - for (fmt_ptr = fmt_first; fmt_ptr != NULL; fmt_ptr = fmt_first) - { - fmt_first = fmt_ptr->next; - vim_regfree(fmt_ptr->prog); - vim_free(fmt_ptr); - } - qf_clean_dir_stack(&dir_stack); - qf_clean_dir_stack(&file_stack); -qf_init_end: - vim_free(namebuf); - vim_free(errmsg); - vim_free(pattern); - vim_free(fmtstr); - -#ifdef FEAT_WINDOWS - qf_update_buffer(qi); -#endif + else + /* Get the next line from the supplied file */ + status = qf_get_next_file_line(state); - return retval; -} + if (status != QF_OK) + return status; - static void -qf_store_title(qi, title) - qf_info_T *qi; - char_u *title; -{ - if (title != NULL) + /* remove newline/CR from the line */ + if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n') { - char_u *p = alloc((int)STRLEN(title) + 2); - - qi->qf_lists[qi->qf_curlist].qf_title = p; - if (p != NULL) - sprintf((char *)p, ":%s", (char *)title); + state->linebuf[state->linelen - 1] = NUL; +#ifdef USE_CRNL + if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r') + state->linebuf[state->linelen - 2] = NUL; +#endif } + +#ifdef FEAT_MBYTE + remove_bom(state->linebuf); +#endif + + return QF_OK; } +typedef struct { + char_u *namebuf; + char_u *module; + char_u *errmsg; + int errmsglen; + long lnum; + int col; + char_u use_viscol; + char_u *pattern; + int enr; + int type; + int valid; +} qffields_T; + /* - * Prepare for adding a new quickfix list. + * Parse the error format matches in 'regmatch' and set the values in 'fields'. + * fmt_ptr contains the 'efm' format specifiers/prefixes that have a match. + * Returns QF_OK if all the matches are successfully parsed. On failure, + * returns QF_FAIL or QF_NOMEM. */ - static void -qf_new_list(qi, qf_title) - qf_info_T *qi; - char_u *qf_title; + static int +qf_parse_match( + char_u *linebuf, + int linelen, + efm_T *fmt_ptr, + regmatch_T *regmatch, + qffields_T *fields, + int qf_multiline, + int qf_multiscan, + char_u **tail) { + char_u *p; + int idx = fmt_ptr->prefix; int i; + int len; + if ((idx == 'C' || idx == 'Z') && !qf_multiline) + return QF_FAIL; + if (vim_strchr((char_u *)"EWI", idx) != NULL) + fields->type = idx; + else + fields->type = 0; /* - * If the current entry is not the last entry, delete entries beyond - * the current entry. This makes it possible to browse in a tree-like - * way with ":grep'. + * Extract error message data from matched line. + * We check for an actual submatch, because "\[" and "\]" in + * the 'errorformat' may cause the wrong submatch to be used. */ - while (qi->qf_listcount > qi->qf_curlist + 1) - qf_free(qi, --qi->qf_listcount); + if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */ + { + int c; - /* - * When the stack is full, remove to oldest entry - * Otherwise, add a new entry. - */ - if (qi->qf_listcount == LISTCOUNT) + if (regmatch->startp[i] == NULL || regmatch->endp[i] == NULL) + return QF_FAIL; + + /* Expand ~/file and $HOME/file to full path. */ + c = *regmatch->endp[i]; + *regmatch->endp[i] = NUL; + expand_env(regmatch->startp[i], fields->namebuf, CMDBUFFSIZE); + *regmatch->endp[i] = c; + + if (vim_strchr((char_u *)"OPQ", idx) != NULL + && mch_getperm(fields->namebuf) == -1) + return QF_FAIL; + } + if ((i = (int)fmt_ptr->addr[1]) > 0) /* %n */ { - qf_free(qi, 0); - for (i = 1; i < LISTCOUNT; ++i) - qi->qf_lists[i - 1] = qi->qf_lists[i]; - qi->qf_curlist = LISTCOUNT - 1; + if (regmatch->startp[i] == NULL) + return QF_FAIL; + fields->enr = (int)atol((char *)regmatch->startp[i]); } - else - qi->qf_curlist = qi->qf_listcount++; - vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T))); - qf_store_title(qi, qf_title); + if ((i = (int)fmt_ptr->addr[2]) > 0) /* %l */ + { + if (regmatch->startp[i] == NULL) + return QF_FAIL; + fields->lnum = atol((char *)regmatch->startp[i]); + } + if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */ + { + if (regmatch->startp[i] == NULL) + return QF_FAIL; + fields->col = (int)atol((char *)regmatch->startp[i]); + } + if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */ + { + if (regmatch->startp[i] == NULL) + return QF_FAIL; + fields->type = *regmatch->startp[i]; + } + if (fmt_ptr->flags == '+' && !qf_multiscan) /* %+ */ + { + if (linelen >= fields->errmsglen) + { + /* linelen + null terminator */ + if ((p = vim_realloc(fields->errmsg, linelen + 1)) == NULL) + return QF_NOMEM; + fields->errmsg = p; + fields->errmsglen = linelen + 1; + } + vim_strncpy(fields->errmsg, linebuf, linelen); + } + else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */ + { + if (regmatch->startp[i] == NULL || regmatch->endp[i] == NULL) + return QF_FAIL; + len = (int)(regmatch->endp[i] - regmatch->startp[i]); + if (len >= fields->errmsglen) + { + /* len + null terminator */ + if ((p = vim_realloc(fields->errmsg, len + 1)) == NULL) + return QF_NOMEM; + fields->errmsg = p; + fields->errmsglen = len + 1; + } + vim_strncpy(fields->errmsg, regmatch->startp[i], len); + } + if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */ + { + if (regmatch->startp[i] == NULL) + return QF_FAIL; + *tail = regmatch->startp[i]; + } + if ((i = (int)fmt_ptr->addr[7]) > 0) /* %p */ + { + char_u *match_ptr; + + if (regmatch->startp[i] == NULL || regmatch->endp[i] == NULL) + return QF_FAIL; + fields->col = 0; + for (match_ptr = regmatch->startp[i]; + match_ptr != regmatch->endp[i]; ++match_ptr) + { + ++fields->col; + if (*match_ptr == TAB) + { + fields->col += 7; + fields->col -= fields->col % 8; + } + } + ++fields->col; + fields->use_viscol = TRUE; + } + if ((i = (int)fmt_ptr->addr[8]) > 0) /* %v */ + { + if (regmatch->startp[i] == NULL) + return QF_FAIL; + fields->col = (int)atol((char *)regmatch->startp[i]); + fields->use_viscol = TRUE; + } + if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */ + { + if (regmatch->startp[i] == NULL || regmatch->endp[i] == NULL) + return QF_FAIL; + len = (int)(regmatch->endp[i] - regmatch->startp[i]); + if (len > CMDBUFFSIZE - 5) + len = CMDBUFFSIZE - 5; + STRCPY(fields->pattern, "^\\V"); + STRNCAT(fields->pattern, regmatch->startp[i], len); + fields->pattern[len + 3] = '\\'; + fields->pattern[len + 4] = '$'; + fields->pattern[len + 5] = NUL; + } + if ((i = (int)fmt_ptr->addr[10]) > 0) /* %o */ + { + if (regmatch->startp[i] == NULL || regmatch->endp[i] == NULL) + return QF_FAIL; + len = (int)(regmatch->endp[i] - regmatch->startp[i]); + if (len > CMDBUFFSIZE) + len = CMDBUFFSIZE; + STRNCAT(fields->module, regmatch->startp[i], len); + } + + return QF_OK; } /* - * Free a location list + * Parse an error line in 'linebuf' using a single error format string in + * 'fmt_ptr->prog' and return the matching values in 'fields'. + * Returns QF_OK if the efm format matches completely and the fields are + * successfully copied. Otherwise returns QF_FAIL or QF_NOMEM. */ - static void -ll_free_all(pqi) - qf_info_T **pqi; + static int +qf_parse_get_fields( + char_u *linebuf, + int linelen, + efm_T *fmt_ptr, + qffields_T *fields, + int qf_multiline, + int qf_multiscan, + char_u **tail) { - int i; - qf_info_T *qi; + regmatch_T regmatch; + int status = QF_FAIL; + int r; + + if (qf_multiscan && + vim_strchr((char_u *)"OPQ", fmt_ptr->prefix) == NULL) + return QF_FAIL; + + fields->namebuf[0] = NUL; + fields->module[0] = NUL; + fields->pattern[0] = NUL; + if (!qf_multiscan) + fields->errmsg[0] = NUL; + fields->lnum = 0; + fields->col = 0; + fields->use_viscol = FALSE; + fields->enr = -1; + fields->type = 0; + *tail = NULL; - qi = *pqi; - if (qi == NULL) - return; - *pqi = NULL; /* Remove reference to this list */ + /* Always ignore case when looking for a matching error. */ + regmatch.rm_ic = TRUE; + regmatch.regprog = fmt_ptr->prog; + r = vim_regexec(®match, linebuf, (colnr_T)0); + fmt_ptr->prog = regmatch.regprog; + if (r) + status = qf_parse_match(linebuf, linelen, fmt_ptr, ®match, + fields, qf_multiline, qf_multiscan, tail); + + return status; +} - qi->qf_refcount--; - if (qi->qf_refcount < 1) +/* + * Parse directory error format prefixes (%D and %X). + * Push and pop directories from the directory stack when scanning directory + * names. + */ + static int +qf_parse_dir_pfx(int idx, qffields_T *fields, qf_list_T *qfl) +{ + if (idx == 'D') /* enter directory */ { - /* No references to this location list */ - for (i = 0; i < qi->qf_listcount; ++i) - qf_free(qi, i); - vim_free(qi); + if (*fields->namebuf == NUL) + { + EMSG(_("E379: Missing or empty directory name")); + return QF_FAIL; + } + qfl->qf_directory = + qf_push_dir(fields->namebuf, &qfl->qf_dir_stack, FALSE); + if (qfl->qf_directory == NULL) + return QF_FAIL; } + else if (idx == 'X') /* leave directory */ + qfl->qf_directory = qf_pop_dir(&qfl->qf_dir_stack); + + return QF_OK; } - void -qf_free_all(wp) - win_T *wp; +/* + * Parse global file name error format prefixes (%O, %P and %Q). + */ + static int +qf_parse_file_pfx( + int idx, + qffields_T *fields, + qf_list_T *qfl, + char_u *tail) { - int i; - qf_info_T *qi = &ql_info; - - if (wp != NULL) + fields->valid = FALSE; + if (*fields->namebuf == NUL || mch_getperm(fields->namebuf) >= 0) { - /* location list */ - ll_free_all(&wp->w_llist); - ll_free_all(&wp->w_llist_ref); + if (*fields->namebuf && idx == 'P') + qfl->qf_currfile = + qf_push_dir(fields->namebuf, &qfl->qf_file_stack, TRUE); + else if (idx == 'Q') + qfl->qf_currfile = qf_pop_dir(&qfl->qf_file_stack); + *fields->namebuf = NUL; + if (tail && *tail) + { + STRMOVE(IObuff, skipwhite(tail)); + qfl->qf_multiscan = TRUE; + return QF_MULTISCAN; + } } - else - /* quickfix list */ - for (i = 0; i < qi->qf_listcount; ++i) - qf_free(qi, i); + + return QF_OK; } /* - * Add an entry to the end of the list of errors. - * Returns OK or FAIL. + * Parse a non-error line (a line which doesn't match any of the error + * format in 'efm'). */ static int -qf_add_entry(qi, prevp, dir, fname, bufnum, mesg, lnum, col, vis_col, pattern, - nr, type, valid) - qf_info_T *qi; /* quickfix list */ - qfline_T **prevp; /* pointer to previously added entry or NULL */ - char_u *dir; /* optional directory name */ - char_u *fname; /* file name or NULL */ - int bufnum; /* buffer number or zero */ - char_u *mesg; /* message */ - long lnum; /* line number */ - int col; /* column */ - int vis_col; /* using visual column */ - char_u *pattern; /* search pattern */ - int nr; /* error number */ - int type; /* type character */ - int valid; /* valid entry */ +qf_parse_line_nomatch(char_u *linebuf, int linelen, qffields_T *fields) { - qfline_T *qfp; + char_u *p; - if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL) - return FAIL; - if (bufnum != 0) - qfp->qf_fnum = bufnum; - else - qfp->qf_fnum = qf_get_fnum(dir, fname); - if ((qfp->qf_text = vim_strsave(mesg)) == NULL) + fields->namebuf[0] = NUL; /* no match found, remove file name */ + fields->lnum = 0; /* don't jump to this line */ + fields->valid = FALSE; + if (linelen >= fields->errmsglen) { - vim_free(qfp); - return FAIL; - } - qfp->qf_lnum = lnum; - qfp->qf_col = col; - qfp->qf_viscol = vis_col; - if (pattern == NULL || *pattern == NUL) - qfp->qf_pattern = NULL; - else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) - { - vim_free(qfp->qf_text); - vim_free(qfp); - return FAIL; - } - qfp->qf_nr = nr; - if (type != 1 && !vim_isprintc(type)) /* only printable chars allowed */ - type = 0; - qfp->qf_type = type; - qfp->qf_valid = valid; - - if (qi->qf_lists[qi->qf_curlist].qf_count == 0) - /* first element in the list */ - { - qi->qf_lists[qi->qf_curlist].qf_start = qfp; - qfp->qf_prev = qfp; /* first element points to itself */ - } - else - { - qfp->qf_prev = *prevp; - (*prevp)->qf_next = qfp; - } - qfp->qf_next = qfp; /* last element points to itself */ - qfp->qf_cleared = FALSE; - *prevp = qfp; - ++qi->qf_lists[qi->qf_curlist].qf_count; - if (qi->qf_lists[qi->qf_curlist].qf_index == 0 && qfp->qf_valid) - /* first valid entry */ - { - qi->qf_lists[qi->qf_curlist].qf_index = - qi->qf_lists[qi->qf_curlist].qf_count; - qi->qf_lists[qi->qf_curlist].qf_ptr = qfp; + /* linelen + null terminator */ + if ((p = vim_realloc(fields->errmsg, linelen + 1)) == NULL) + return QF_NOMEM; + fields->errmsg = p; + fields->errmsglen = linelen + 1; } + /* copy whole line to error message */ + vim_strncpy(fields->errmsg, linebuf, linelen); - return OK; + return QF_OK; } /* - * Allocate a new location list + * Parse multi-line error format prefixes (%C and %Z) */ - static qf_info_T * -ll_new_list() + static int +qf_parse_multiline_pfx( + qf_info_T *qi, + int qf_idx, + int idx, + qf_list_T *qfl, + qffields_T *fields) { - qf_info_T *qi; + char_u *ptr; + int len; - qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T)); - if (qi != NULL) + if (!qfl->qf_multiignore) { - vim_memset(qi, 0, (size_t)(sizeof(qf_info_T))); - qi->qf_refcount++; + qfline_T *qfprev = qfl->qf_last; + + if (qfprev == NULL) + return QF_FAIL; + if (*fields->errmsg && !qfl->qf_multiignore) + { + len = (int)STRLEN(qfprev->qf_text); + if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2))) + == NULL) + return QF_FAIL; + STRCPY(ptr, qfprev->qf_text); + vim_free(qfprev->qf_text); + qfprev->qf_text = ptr; + *(ptr += len) = '\n'; + STRCPY(++ptr, fields->errmsg); + } + if (qfprev->qf_nr == -1) + qfprev->qf_nr = fields->enr; + if (vim_isprintc(fields->type) && !qfprev->qf_type) + /* only printable chars allowed */ + qfprev->qf_type = fields->type; + + if (!qfprev->qf_lnum) + qfprev->qf_lnum = fields->lnum; + if (!qfprev->qf_col) + qfprev->qf_col = fields->col; + qfprev->qf_viscol = fields->use_viscol; + if (!qfprev->qf_fnum) + qfprev->qf_fnum = qf_get_fnum(qi, qf_idx, + qfl->qf_directory, + *fields->namebuf || qfl->qf_directory != NULL + ? fields->namebuf + : qfl->qf_currfile != NULL && fields->valid + ? qfl->qf_currfile : 0); } + if (idx == 'Z') + qfl->qf_multiline = qfl->qf_multiignore = FALSE; + line_breakcheck(); - return qi; + return QF_IGNORE_LINE; } /* - * Return the location list for window 'wp'. - * If not present, allocate a location list + * Parse a line and get the quickfix fields. + * Return the QF_ status. */ - static qf_info_T * -ll_get_or_alloc_list(wp) - win_T *wp; + static int +qf_parse_line( + qf_info_T *qi, + int qf_idx, + char_u *linebuf, + int linelen, + efm_T *fmt_first, + qffields_T *fields) { - if (IS_LL_WINDOW(wp)) - /* For a location list window, use the referenced location list */ - return wp->w_llist_ref; - - /* - * For a non-location list window, w_llist_ref should not point to a - * location list. - */ - ll_free_all(&wp->w_llist_ref); - - if (wp->w_llist == NULL) - wp->w_llist = ll_new_list(); /* new location list */ - return wp->w_llist; -} + efm_T *fmt_ptr; + int idx = 0; + char_u *tail = NULL; + qf_list_T *qfl = &qi->qf_lists[qf_idx]; + int status; -/* - * Copy the location list from window "from" to window "to". - */ - void -copy_loclist(from, to) - win_T *from; - win_T *to; -{ - qf_info_T *qi; - int idx; - int i; +restofline: + /* If there was no %> item start at the first pattern */ + if (fmt_start == NULL) + fmt_ptr = fmt_first; + else + { + /* Otherwise start from the last used pattern */ + fmt_ptr = fmt_start; + fmt_start = NULL; + } /* - * When copying from a location list window, copy the referenced - * location list. For other windows, copy the location list for - * that window. + * Try to match each part of 'errorformat' until we find a complete + * match or no match. */ - if (IS_LL_WINDOW(from)) - qi = from->w_llist_ref; - else - qi = from->w_llist; - - if (qi == NULL) /* no location list to copy */ - return; - - /* allocate a new location list */ - if ((to->w_llist = ll_new_list()) == NULL) - return; - - to->w_llist->qf_listcount = qi->qf_listcount; - - /* Copy the location lists one at a time */ - for (idx = 0; idx < qi->qf_listcount; idx++) + fields->valid = TRUE; + for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) { - qf_list_T *from_qfl; - qf_list_T *to_qfl; + idx = fmt_ptr->prefix; + status = qf_parse_get_fields(linebuf, linelen, fmt_ptr, fields, + qfl->qf_multiline, qfl->qf_multiscan, &tail); + if (status == QF_NOMEM) + return status; + if (status == QF_OK) + break; + } + qfl->qf_multiscan = FALSE; - to->w_llist->qf_curlist = idx; + if (fmt_ptr == NULL || idx == 'D' || idx == 'X') + { + if (fmt_ptr != NULL) + { + /* 'D' and 'X' directory specifiers */ + status = qf_parse_dir_pfx(idx, fields, qfl); + if (status != QF_OK) + return status; + } - from_qfl = &qi->qf_lists[idx]; - to_qfl = &to->w_llist->qf_lists[idx]; + status = qf_parse_line_nomatch(linebuf, linelen, fields); + if (status != QF_OK) + return status; - /* Some of the fields are populated by qf_add_entry() */ - to_qfl->qf_nonevalid = from_qfl->qf_nonevalid; - to_qfl->qf_count = 0; - to_qfl->qf_index = 0; - to_qfl->qf_start = NULL; - to_qfl->qf_ptr = NULL; - if (from_qfl->qf_title != NULL) - to_qfl->qf_title = vim_strsave(from_qfl->qf_title); - else - to_qfl->qf_title = NULL; + if (fmt_ptr == NULL) + qfl->qf_multiline = qfl->qf_multiignore = FALSE; + } + else if (fmt_ptr != NULL) + { + /* honor %> item */ + if (fmt_ptr->conthere) + fmt_start = fmt_ptr; - if (from_qfl->qf_count) + if (vim_strchr((char_u *)"AEWI", idx) != NULL) { - qfline_T *from_qfp; - qfline_T *prevp = NULL; - - /* copy all the location entries in this list */ - for (i = 0, from_qfp = from_qfl->qf_start; i < from_qfl->qf_count; - ++i, from_qfp = from_qfp->qf_next) - { - if (qf_add_entry(to->w_llist, &prevp, - NULL, - NULL, - 0, - from_qfp->qf_text, - from_qfp->qf_lnum, - from_qfp->qf_col, - from_qfp->qf_viscol, - from_qfp->qf_pattern, - from_qfp->qf_nr, - 0, - from_qfp->qf_valid) == FAIL) - { - qf_free_all(to); - return; - } - /* - * qf_add_entry() will not set the qf_num field, as the - * directory and file names are not supplied. So the qf_fnum - * field is copied here. - */ - prevp->qf_fnum = from_qfp->qf_fnum; /* file number */ - prevp->qf_type = from_qfp->qf_type; /* error type */ - if (from_qfl->qf_ptr == from_qfp) - to_qfl->qf_ptr = prevp; /* current location */ - } + qfl->qf_multiline = TRUE; /* start of a multi-line message */ + qfl->qf_multiignore = FALSE;/* reset continuation */ } - - to_qfl->qf_index = from_qfl->qf_index; /* current index in the list */ - - /* When no valid entries are present in the list, qf_ptr points to - * the first item in the list */ - if (to_qfl->qf_nonevalid) + else if (vim_strchr((char_u *)"CZ", idx) != NULL) + { /* continuation of multi-line msg */ + status = qf_parse_multiline_pfx(qi, qf_idx, idx, qfl, fields); + if (status != QF_OK) + return status; + } + else if (vim_strchr((char_u *)"OPQ", idx) != NULL) + { /* global file names */ + status = qf_parse_file_pfx(idx, fields, qfl, tail); + if (status == QF_MULTISCAN) + goto restofline; + } + if (fmt_ptr->flags == '-') /* generally exclude this line */ { - to_qfl->qf_ptr = to_qfl->qf_start; - to_qfl->qf_index = 1; + if (qfl->qf_multiline) + /* also exclude continuation lines */ + qfl->qf_multiignore = TRUE; + return QF_IGNORE_LINE; } } - to->w_llist->qf_curlist = qi->qf_curlist; /* current list */ + return QF_OK; } /* - * get buffer number for file "dir.name" + * Allocate the fields used for parsing lines and populating a quickfix list. */ static int -qf_get_fnum(directory, fname) - char_u *directory; - char_u *fname; +qf_alloc_fields(qffields_T *pfields) { - if (fname == NULL || *fname == NUL) /* no file name */ - return 0; - { - char_u *ptr; - int fnum; + pfields->namebuf = alloc_id(CMDBUFFSIZE + 1, aid_qf_namebuf); + pfields->module = alloc_id(CMDBUFFSIZE + 1, aid_qf_module); + pfields->errmsglen = CMDBUFFSIZE + 1; + pfields->errmsg = alloc_id(pfields->errmsglen, aid_qf_errmsg); + pfields->pattern = alloc_id(CMDBUFFSIZE + 1, aid_qf_pattern); + if (pfields->namebuf == NULL || pfields->errmsg == NULL + || pfields->pattern == NULL || pfields->module == NULL) + return FAIL; -#ifdef VMS - vms_remove_version(fname); -#endif -#ifdef BACKSLASH_IN_FILENAME - if (directory != NULL) - slash_adjust(directory); - slash_adjust(fname); -#endif - if (directory != NULL && !vim_isAbsName(fname) - && (ptr = concat_fnames(directory, fname, TRUE)) != NULL) - { - /* - * Here we check if the file really exists. - * This should normally be true, but if make works without - * "leaving directory"-messages we might have missed a - * directory change. - */ - if (mch_getperm(ptr) < 0) - { - vim_free(ptr); - directory = qf_guess_filepath(fname); - if (directory) - ptr = concat_fnames(directory, fname, TRUE); - else - ptr = vim_strsave(fname); - } - /* Use concatenated directory name and file name */ - fnum = buflist_add(ptr, 0); - vim_free(ptr); - return fnum; - } - return buflist_add(fname, 0); - } + return OK; } /* - * push dirbuf onto the directory stack and return pointer to actual dir or - * NULL on error + * Free the fields used for parsing lines and populating a quickfix list. */ - static char_u * -qf_push_dir(dirbuf, stackptr) - char_u *dirbuf; - struct dir_stack_T **stackptr; + static void +qf_free_fields(qffields_T *pfields) { - struct dir_stack_T *ds_new; - struct dir_stack_T *ds_ptr; - - /* allocate new stack element and hook it in */ - ds_new = (struct dir_stack_T *)alloc((unsigned)sizeof(struct dir_stack_T)); - if (ds_new == NULL) - return NULL; + vim_free(pfields->namebuf); + vim_free(pfields->module); + vim_free(pfields->errmsg); + vim_free(pfields->pattern); +} - ds_new->next = *stackptr; - *stackptr = ds_new; +/* + * Setup the state information used for parsing lines and populating a + * quickfix list. + */ + static int +qf_setup_state( + qfstate_T *pstate, + char_u *enc, + char_u *efile, + typval_T *tv, + buf_T *buf, + linenr_T lnumfirst, + linenr_T lnumlast) +{ +#ifdef FEAT_MBYTE + pstate->vc.vc_type = CONV_NONE; + if (enc != NULL && *enc != NUL) + convert_setup(&pstate->vc, enc, p_enc); +#endif - /* store directory on the stack */ - if (vim_isAbsName(dirbuf) - || (*stackptr)->next == NULL - || (*stackptr && dir_stack != *stackptr)) - (*stackptr)->dirname = vim_strsave(dirbuf); - else + if (efile != NULL && (pstate->fd = mch_fopen((char *)efile, "r")) == NULL) { - /* Okay we don't have an absolute path. - * dirbuf must be a subdir of one of the directories on the stack. - * Let's search... - */ - ds_new = (*stackptr)->next; - (*stackptr)->dirname = NULL; - while (ds_new) - { - vim_free((*stackptr)->dirname); - (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, - TRUE); - if (mch_isdir((*stackptr)->dirname) == TRUE) - break; - - ds_new = ds_new->next; - } - - /* clean up all dirs we already left */ - while ((*stackptr)->next != ds_new) - { - ds_ptr = (*stackptr)->next; - (*stackptr)->next = (*stackptr)->next->next; - vim_free(ds_ptr->dirname); - vim_free(ds_ptr); - } - - /* Nothing found -> it must be on top level */ - if (ds_new == NULL) - { - vim_free((*stackptr)->dirname); - (*stackptr)->dirname = vim_strsave(dirbuf); - } + EMSG2(_(e_openerrf), efile); + return FAIL; } - if ((*stackptr)->dirname != NULL) - return (*stackptr)->dirname; - else + if (tv != NULL) { - ds_ptr = *stackptr; - *stackptr = (*stackptr)->next; - vim_free(ds_ptr); - return NULL; + if (tv->v_type == VAR_STRING) + pstate->p_str = tv->vval.v_string; + else if (tv->v_type == VAR_LIST) + pstate->p_li = tv->vval.v_list->lv_first; + pstate->tv = tv; } -} + pstate->buf = buf; + pstate->buflnum = lnumfirst; + pstate->lnumlast = lnumlast; + return OK; +} /* - * pop dirbuf from the directory stack and return previous directory or NULL if - * stack is empty + * Cleanup the state information used for parsing lines and populating a + * quickfix list. */ - static char_u * -qf_pop_dir(stackptr) - struct dir_stack_T **stackptr; + static void +qf_cleanup_state(qfstate_T *pstate) { - struct dir_stack_T *ds_ptr; + if (pstate->fd != NULL) + fclose(pstate->fd); - /* TODO: Should we check if dirbuf is the directory on top of the stack? - * What to do if it isn't? */ - - /* pop top element and free it */ - if (*stackptr != NULL) - { - ds_ptr = *stackptr; - *stackptr = (*stackptr)->next; - vim_free(ds_ptr->dirname); - vim_free(ds_ptr); - } - - /* return NEW top element as current dir or NULL if stack is empty*/ - return *stackptr ? (*stackptr)->dirname : NULL; -} + vim_free(pstate->growbuf); +#ifdef FEAT_MBYTE + if (pstate->vc.vc_type != CONV_NONE) + convert_setup(&pstate->vc, NULL, NULL); +#endif +} /* - * clean up directory stack + * Read the errorfile "efile" into memory, line by line, building the error + * list. + * Alternative: when "efile" is NULL read errors from buffer "buf". + * Alternative: when "tv" is not NULL get errors from the string or list. + * Always use 'errorformat' from "buf" if there is a local value. + * Then "lnumfirst" and "lnumlast" specify the range of lines to use. + * Set the title of the list to "qf_title". + * Return -1 for error, number of errors for success. */ - static void -qf_clean_dir_stack(stackptr) - struct dir_stack_T **stackptr; + static int +qf_init_ext( + qf_info_T *qi, + int qf_idx, + char_u *efile, + buf_T *buf, + typval_T *tv, + char_u *errorformat, + int newlist, /* TRUE: start a new error list */ + linenr_T lnumfirst, /* first line number to use */ + linenr_T lnumlast, /* last line number to use */ + char_u *qf_title, + char_u *enc) { - struct dir_stack_T *ds_ptr; - - while ((ds_ptr = *stackptr) != NULL) - { - *stackptr = (*stackptr)->next; - vim_free(ds_ptr->dirname); - vim_free(ds_ptr); - } -} + qf_list_T *qfl; + qfstate_T state; + qffields_T fields; + qfline_T *old_last = NULL; + int adding = FALSE; + static efm_T *fmt_first = NULL; + char_u *efm; + static char_u *last_efm = NULL; + int retval = -1; /* default: return error flag */ + int status; -/* - * Check in which directory of the directory stack the given file can be - * found. - * Returns a pointer to the directory name or NULL if not found - * Cleans up intermediate directory entries. - * - * TODO: How to solve the following problem? - * If we have the this directory tree: - * ./ - * ./aa - * ./aa/bb - * ./bb - * ./bb/x.c - * and make says: - * making all in aa - * making all in bb - * x.c:9: Error - * Then qf_push_dir thinks we are in ./aa/bb, but we are in ./bb. - * qf_guess_filepath will return NULL. - */ - static char_u * -qf_guess_filepath(filename) - char_u *filename; -{ - struct dir_stack_T *ds_ptr; - struct dir_stack_T *ds_tmp; - char_u *fullname; + /* Do not used the cached buffer, it may have been wiped out. */ + VIM_CLEAR(qf_last_bufname); - /* no dirs on the stack - there's nothing we can do */ - if (dir_stack == NULL) - return NULL; + vim_memset(&state, 0, sizeof(state)); + vim_memset(&fields, 0, sizeof(fields)); + if ((qf_alloc_fields(&fields) == FAIL) || + (qf_setup_state(&state, enc, efile, tv, buf, + lnumfirst, lnumlast) == FAIL)) + goto qf_init_end; - ds_ptr = dir_stack->next; - fullname = NULL; - while (ds_ptr) + if (newlist || qf_idx == qi->qf_listcount) { - vim_free(fullname); - fullname = concat_fnames(ds_ptr->dirname, filename, TRUE); - - /* If concat_fnames failed, just go on. The worst thing that can happen - * is that we delete the entire stack. - */ - if ((fullname != NULL) && (mch_getperm(fullname) >= 0)) - break; - - ds_ptr = ds_ptr->next; + /* make place for a new list */ + qf_new_list(qi, qf_title); + qf_idx = qi->qf_curlist; + } + else + { + /* Adding to existing list, use last entry. */ + adding = TRUE; + if (qi->qf_lists[qf_idx].qf_count > 0) + old_last = qi->qf_lists[qf_idx].qf_last; } - vim_free(fullname); + qfl = &qi->qf_lists[qf_idx]; - /* clean up all dirs we already left */ - while (dir_stack->next != ds_ptr) + /* Use the local value of 'errorformat' if it's set. */ + if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) + efm = buf->b_p_efm; + else + efm = errorformat; + + /* + * If the errorformat didn't change between calls, then reuse the + * previously parsed values. + */ + if (last_efm == NULL || (STRCMP(last_efm, efm) != 0)) { - ds_tmp = dir_stack->next; - dir_stack->next = dir_stack->next->next; - vim_free(ds_tmp->dirname); - vim_free(ds_tmp); + /* free the previously parsed data */ + VIM_CLEAR(last_efm); + free_efm_list(&fmt_first); + + /* parse the current 'efm' */ + fmt_first = parse_efm_option(efm); + if (fmt_first != NULL) + last_efm = vim_strsave(efm); } - return ds_ptr==NULL? NULL: ds_ptr->dirname; + if (fmt_first == NULL) /* nothing found */ + goto error2; -} + /* + * got_int is reset here, because it was probably set when killing the + * ":make" command, but we still want to read the errorfile then. + */ + got_int = FALSE; -/* - * jump to a quickfix line - * if dir == FORWARD go "errornr" valid entries forward - * if dir == BACKWARD go "errornr" valid entries backward - * if dir == FORWARD_FILE go "errornr" valid entries files backward - * if dir == BACKWARD_FILE go "errornr" valid entries files backward - * else if "errornr" is zero, redisplay the same line - * else go to entry "errornr" - */ - void -qf_jump(qi, dir, errornr, forceit) - qf_info_T *qi; - int dir; - int errornr; - int forceit; -{ - qf_info_T *ll_ref; - qfline_T *qf_ptr; - qfline_T *old_qf_ptr; - int qf_index; - int old_qf_fnum; - int old_qf_index; - int prev_index; - static char_u *e_no_more_items = (char_u *)N_("E553: No more items"); - char_u *err = e_no_more_items; - linenr_T i; - buf_T *old_curbuf; - linenr_T old_lnum; - colnr_T screen_col; - colnr_T char_col; - char_u *line; -#ifdef FEAT_WINDOWS - char_u *old_swb = p_swb; - unsigned old_swb_flags = swb_flags; - int opened_window = FALSE; - win_T *win; - win_T *altwin; - int flags; -#endif - win_T *oldwin = curwin; - int print_message = TRUE; - int len; -#ifdef FEAT_FOLDING - int old_KeyTyped = KeyTyped; /* getting file may reset it */ -#endif - int ok = OK; - int usable_win; + /* + * Read the lines in the error file one by one. + * Try to recognize one of the error formats in each line. + */ + while (!got_int) + { + /* Get the next line from a file/buffer/list/string */ + status = qf_get_nextline(&state); + if (status == QF_NOMEM) /* memory alloc failure */ + goto qf_init_end; + if (status == QF_END_OF_INPUT) /* end of input */ + break; - if (qi == NULL) - qi = &ql_info; + status = qf_parse_line(qi, qf_idx, state.linebuf, state.linelen, + fmt_first, &fields); + if (status == QF_FAIL) + goto error2; + if (status == QF_NOMEM) + goto qf_init_end; + if (status == QF_IGNORE_LINE) + continue; - if (qi->qf_curlist >= qi->qf_listcount - || qi->qf_lists[qi->qf_curlist].qf_count == 0) - { - EMSG(_(e_quickfix)); - return; + if (qf_add_entry(qi, + qf_idx, + qfl->qf_directory, + (*fields.namebuf || qfl->qf_directory != NULL) + ? fields.namebuf + : ((qfl->qf_currfile != NULL && fields.valid) + ? qfl->qf_currfile : (char_u *)NULL), + fields.module, + 0, + fields.errmsg, + fields.lnum, + fields.col, + fields.use_viscol, + fields.pattern, + fields.enr, + fields.type, + fields.valid) == FAIL) + goto error2; + line_breakcheck(); } - - qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr; - old_qf_ptr = qf_ptr; - qf_index = qi->qf_lists[qi->qf_curlist].qf_index; - old_qf_index = qf_index; - if (dir == FORWARD || dir == FORWARD_FILE) /* next valid entry */ + if (state.fd == NULL || !ferror(state.fd)) { - while (errornr--) + if (qfl->qf_index == 0) { - old_qf_ptr = qf_ptr; - prev_index = qf_index; - old_qf_fnum = qf_ptr->qf_fnum; - do - { - if (qf_index == qi->qf_lists[qi->qf_curlist].qf_count - || qf_ptr->qf_next == NULL) - { - qf_ptr = old_qf_ptr; - qf_index = prev_index; - if (err != NULL) - { - EMSG(_(err)); - goto theend; - } - errornr = 0; - break; - } - ++qf_index; - qf_ptr = qf_ptr->qf_next; - } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid - && !qf_ptr->qf_valid) - || (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); - err = NULL; + /* no valid entry found */ + qfl->qf_ptr = qfl->qf_start; + qfl->qf_index = 1; + qfl->qf_nonevalid = TRUE; } - } - else if (dir == BACKWARD || dir == BACKWARD_FILE) /* prev. valid entry */ - { - while (errornr--) + else { - old_qf_ptr = qf_ptr; - prev_index = qf_index; - old_qf_fnum = qf_ptr->qf_fnum; - do - { - if (qf_index == 1 || qf_ptr->qf_prev == NULL) - { - qf_ptr = old_qf_ptr; - qf_index = prev_index; - if (err != NULL) - { - EMSG(_(err)); - goto theend; - } - errornr = 0; - break; - } - --qf_index; - qf_ptr = qf_ptr->qf_prev; - } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid - && !qf_ptr->qf_valid) - || (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); - err = NULL; + qfl->qf_nonevalid = FALSE; + if (qfl->qf_ptr == NULL) + qfl->qf_ptr = qfl->qf_start; } + /* return number of matches */ + retval = qfl->qf_count; + goto qf_init_end; } - else if (errornr != 0) /* go to specified number */ + EMSG(_(e_readerrf)); +error2: + if (!adding) { - while (errornr < qf_index && qf_index > 1 && qf_ptr->qf_prev != NULL) - { - --qf_index; - qf_ptr = qf_ptr->qf_prev; - } - while (errornr > qf_index && qf_index < - qi->qf_lists[qi->qf_curlist].qf_count - && qf_ptr->qf_next != NULL) - { - ++qf_index; - qf_ptr = qf_ptr->qf_next; - } + /* Error when creating a new list. Free the new list */ + qf_free(qi, qi->qf_curlist); + qi->qf_listcount--; + if (qi->qf_curlist > 0) + --qi->qf_curlist; } +qf_init_end: + if (qf_idx == qi->qf_curlist) + qf_update_buffer(qi, old_last); + qf_cleanup_state(&state); + qf_free_fields(&fields); -#ifdef FEAT_WINDOWS - qi->qf_lists[qi->qf_curlist].qf_index = qf_index; - if (qf_win_pos_update(qi, old_qf_index)) - /* No need to print the error message if it's visible in the error - * window */ - print_message = FALSE; + return retval; +} - /* - * For ":helpgrep" find a help window or open one. - */ - if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0)) +/* + * Read the errorfile "efile" into memory, line by line, building the error + * list. Set the error list's title to qf_title. + * Return -1 for error, number of errors for success. + */ + int +qf_init(win_T *wp, + char_u *efile, + char_u *errorformat, + int newlist, /* TRUE: start a new error list */ + char_u *qf_title, + char_u *enc) +{ + qf_info_T *qi = &ql_info; + + if (wp != NULL) { - win_T *wp; + qi = ll_get_or_alloc_list(wp); + if (qi == NULL) + return FAIL; + } - if (cmdmod.tab != 0) - wp = NULL; - else - for (wp = firstwin; wp != NULL; wp = wp->w_next) - if (wp->w_buffer != NULL && wp->w_buffer->b_help) - break; - if (wp != NULL && wp->w_buffer->b_nwindows > 0) - win_enter(wp, TRUE); - else - { - /* - * Split off help window; put it at far top if no position - * specified, the current window is vertically split and narrow. - */ - flags = WSP_HELP; -# ifdef FEAT_VERTSPLIT - if (cmdmod.split == 0 && curwin->w_width != Columns - && curwin->w_width < 80) - flags |= WSP_TOP; -# endif - if (qi != &ql_info) - flags |= WSP_NEWLOC; /* don't copy the location list */ - - if (win_split(0, flags) == FAIL) - goto theend; - opened_window = TRUE; /* close it when fail */ - - if (curwin->w_height < p_hh) - win_setheight((int)p_hh); - - if (qi != &ql_info) /* not a quickfix list */ - { - /* The new window should use the supplied location list */ - curwin->w_llist = qi; - qi->qf_refcount++; - } - } + return qf_init_ext(qi, qi->qf_curlist, efile, curbuf, NULL, errorformat, + newlist, (linenr_T)0, (linenr_T)0, qf_title, enc); +} - if (!p_im) - restart_edit = 0; /* don't want insert mode in help file */ - } +/* + * Set the title of the specified quickfix list. Frees the previous title. + * Prepends ':' to the title. + */ + static void +qf_store_title(qf_info_T *qi, int qf_idx, char_u *title) +{ + VIM_CLEAR(qi->qf_lists[qf_idx].qf_title); - /* - * If currently in the quickfix window, find another window to show the - * file in. - */ - if (bt_quickfix(curbuf) && !opened_window) + if (title != NULL) { - win_T *usable_win_ptr = NULL; - - /* - * If there is no file specified, we don't know where to go. - * But do advance, otherwise ":cn" gets stuck. - */ - if (qf_ptr->qf_fnum == 0) - goto theend; + char_u *p = alloc((int)STRLEN(title) + 2); - usable_win = 0; + qi->qf_lists[qf_idx].qf_title = p; + if (p != NULL) + STRCPY(p, title); + } +} - ll_ref = curwin->w_llist_ref; - if (ll_ref != NULL) - { - /* Find a window using the same location list that is not a - * quickfix window. */ - FOR_ALL_WINDOWS(usable_win_ptr) - if (usable_win_ptr->w_llist == ll_ref - && usable_win_ptr->w_buffer->b_p_bt[0] != 'q') - { - usable_win = 1; - break; - } - } +/* + * The title of a quickfix/location list is set, by default, to the command + * that created the quickfix list with the ":" prefix. + * Create a quickfix list title string by prepending ":" to a user command. + * Returns a pointer to a static buffer with the title. + */ + static char_u * +qf_cmdtitle(char_u *cmd) +{ + static char_u qftitle_str[IOSIZE]; - if (!usable_win) - { - /* Locate a window showing a normal buffer */ - FOR_ALL_WINDOWS(win) - if (win->w_buffer->b_p_bt[0] == NUL) - { - usable_win = 1; - break; - } - } + vim_snprintf((char *)qftitle_str, IOSIZE, ":%s", (char *)cmd); + return qftitle_str; +} - /* - * If no usable window is found and 'switchbuf' contains "usetab" - * then search in other tabs. - */ - if (!usable_win && (swb_flags & SWB_USETAB)) - { - tabpage_T *tp; - win_T *wp; +/* + * Prepare for adding a new quickfix list. If the current list is in the + * middle of the stack, then all the following lists are freed and then + * the new list is added. + */ + static void +qf_new_list(qf_info_T *qi, char_u *qf_title) +{ + int i; + + /* + * If the current entry is not the last entry, delete entries beyond + * the current entry. This makes it possible to browse in a tree-like + * way with ":grep'. + */ + while (qi->qf_listcount > qi->qf_curlist + 1) + qf_free(qi, --qi->qf_listcount); + + /* + * When the stack is full, remove to oldest entry + * Otherwise, add a new entry. + */ + if (qi->qf_listcount == LISTCOUNT) + { + qf_free(qi, 0); + for (i = 1; i < LISTCOUNT; ++i) + qi->qf_lists[i - 1] = qi->qf_lists[i]; + qi->qf_curlist = LISTCOUNT - 1; + } + else + qi->qf_curlist = qi->qf_listcount++; + vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T))); + qf_store_title(qi, qi->qf_curlist, qf_title); + qi->qf_lists[qi->qf_curlist].qf_id = ++last_qf_id; +} + +/* + * Free a location list + */ + static void +ll_free_all(qf_info_T **pqi) +{ + int i; + qf_info_T *qi; + + qi = *pqi; + if (qi == NULL) + return; + *pqi = NULL; /* Remove reference to this list */ + + qi->qf_refcount--; + if (qi->qf_refcount < 1) + { + /* No references to this location list */ + for (i = 0; i < qi->qf_listcount; ++i) + qf_free(qi, i); + vim_free(qi); + } +} + +/* + * Free all the quickfix/location lists in the stack. + */ + void +qf_free_all(win_T *wp) +{ + int i; + qf_info_T *qi = &ql_info; + + if (wp != NULL) + { + /* location list */ + ll_free_all(&wp->w_llist); + ll_free_all(&wp->w_llist_ref); + } + else + /* quickfix list */ + for (i = 0; i < qi->qf_listcount; ++i) + qf_free(qi, i); +} + +/* + * Add an entry to the end of the list of errors. + * Returns OK or FAIL. + */ + static int +qf_add_entry( + qf_info_T *qi, /* quickfix list */ + int qf_idx, /* list index */ + char_u *dir, /* optional directory name */ + char_u *fname, /* file name or NULL */ + char_u *module, /* module name or NULL */ + int bufnum, /* buffer number or zero */ + char_u *mesg, /* message */ + long lnum, /* line number */ + int col, /* column */ + int vis_col, /* using visual column */ + char_u *pattern, /* search pattern */ + int nr, /* error number */ + int type, /* type character */ + int valid) /* valid entry */ +{ + qfline_T *qfp; + qfline_T **lastp; /* pointer to qf_last or NULL */ + + if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL) + return FAIL; + if (bufnum != 0) + { + buf_T *buf = buflist_findnr(bufnum); + + qfp->qf_fnum = bufnum; + if (buf != NULL) + buf->b_has_qf_entry |= + (qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; + } + else + qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname); + if ((qfp->qf_text = vim_strsave(mesg)) == NULL) + { + vim_free(qfp); + return FAIL; + } + qfp->qf_lnum = lnum; + qfp->qf_col = col; + qfp->qf_viscol = vis_col; + if (pattern == NULL || *pattern == NUL) + qfp->qf_pattern = NULL; + else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) + { + vim_free(qfp->qf_text); + vim_free(qfp); + return FAIL; + } + if (module == NULL || *module == NUL) + qfp->qf_module = NULL; + else if ((qfp->qf_module = vim_strsave(module)) == NULL) + { + vim_free(qfp->qf_text); + vim_free(qfp->qf_pattern); + vim_free(qfp); + return FAIL; + } + qfp->qf_nr = nr; + if (type != 1 && !vim_isprintc(type)) /* only printable chars allowed */ + type = 0; + qfp->qf_type = type; + qfp->qf_valid = valid; + + lastp = &qi->qf_lists[qf_idx].qf_last; + if (qi->qf_lists[qf_idx].qf_count == 0) + /* first element in the list */ + { + qi->qf_lists[qf_idx].qf_start = qfp; + qi->qf_lists[qf_idx].qf_ptr = qfp; + qi->qf_lists[qf_idx].qf_index = 0; + qfp->qf_prev = NULL; + } + else + { + qfp->qf_prev = *lastp; + (*lastp)->qf_next = qfp; + } + qfp->qf_next = NULL; + qfp->qf_cleared = FALSE; + *lastp = qfp; + ++qi->qf_lists[qf_idx].qf_count; + if (qi->qf_lists[qf_idx].qf_index == 0 && qfp->qf_valid) + /* first valid entry */ + { + qi->qf_lists[qf_idx].qf_index = + qi->qf_lists[qf_idx].qf_count; + qi->qf_lists[qf_idx].qf_ptr = qfp; + } + + return OK; +} + +/* + * Allocate a new location list + */ + static qf_info_T * +ll_new_list(void) +{ + qf_info_T *qi; + + qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T)); + if (qi != NULL) + { + vim_memset(qi, 0, (size_t)(sizeof(qf_info_T))); + qi->qf_refcount++; + } + + return qi; +} + +/* + * Return the location list for window 'wp'. + * If not present, allocate a location list + */ + static qf_info_T * +ll_get_or_alloc_list(win_T *wp) +{ + if (IS_LL_WINDOW(wp)) + /* For a location list window, use the referenced location list */ + return wp->w_llist_ref; + + /* + * For a non-location list window, w_llist_ref should not point to a + * location list. + */ + ll_free_all(&wp->w_llist_ref); + + if (wp->w_llist == NULL) + wp->w_llist = ll_new_list(); /* new location list */ + return wp->w_llist; +} + +/* + * Copy the location list from window "from" to window "to". + */ + void +copy_loclist(win_T *from, win_T *to) +{ + qf_info_T *qi; + int idx; + int i; + + /* + * When copying from a location list window, copy the referenced + * location list. For other windows, copy the location list for + * that window. + */ + if (IS_LL_WINDOW(from)) + qi = from->w_llist_ref; + else + qi = from->w_llist; + + if (qi == NULL) /* no location list to copy */ + return; + + /* allocate a new location list */ + if ((to->w_llist = ll_new_list()) == NULL) + return; + + to->w_llist->qf_listcount = qi->qf_listcount; + + /* Copy the location lists one at a time */ + for (idx = 0; idx < qi->qf_listcount; idx++) + { + qf_list_T *from_qfl; + qf_list_T *to_qfl; + + to->w_llist->qf_curlist = idx; + + from_qfl = &qi->qf_lists[idx]; + to_qfl = &to->w_llist->qf_lists[idx]; + + /* Some of the fields are populated by qf_add_entry() */ + to_qfl->qf_nonevalid = from_qfl->qf_nonevalid; + to_qfl->qf_count = 0; + to_qfl->qf_index = 0; + to_qfl->qf_start = NULL; + to_qfl->qf_last = NULL; + to_qfl->qf_ptr = NULL; + if (from_qfl->qf_title != NULL) + to_qfl->qf_title = vim_strsave(from_qfl->qf_title); + else + to_qfl->qf_title = NULL; + if (from_qfl->qf_ctx != NULL) + { + to_qfl->qf_ctx = alloc_tv(); + if (to_qfl->qf_ctx != NULL) + copy_tv(from_qfl->qf_ctx, to_qfl->qf_ctx); + } + else + to_qfl->qf_ctx = NULL; + + if (from_qfl->qf_count) + { + qfline_T *from_qfp; + qfline_T *prevp; + + /* copy all the location entries in this list */ + for (i = 0, from_qfp = from_qfl->qf_start; + i < from_qfl->qf_count && from_qfp != NULL; + ++i, from_qfp = from_qfp->qf_next) + { + if (qf_add_entry(to->w_llist, + to->w_llist->qf_curlist, + NULL, + NULL, + from_qfp->qf_module, + 0, + from_qfp->qf_text, + from_qfp->qf_lnum, + from_qfp->qf_col, + from_qfp->qf_viscol, + from_qfp->qf_pattern, + from_qfp->qf_nr, + 0, + from_qfp->qf_valid) == FAIL) + { + qf_free_all(to); + return; + } + /* + * qf_add_entry() will not set the qf_num field, as the + * directory and file names are not supplied. So the qf_fnum + * field is copied here. + */ + prevp = to->w_llist->qf_lists[to->w_llist->qf_curlist].qf_last; + prevp->qf_fnum = from_qfp->qf_fnum; /* file number */ + prevp->qf_type = from_qfp->qf_type; /* error type */ + if (from_qfl->qf_ptr == from_qfp) + to_qfl->qf_ptr = prevp; /* current location */ + } + } + + to_qfl->qf_index = from_qfl->qf_index; /* current index in the list */ + + /* Assign a new ID for the location list */ + to_qfl->qf_id = ++last_qf_id; + to_qfl->qf_changedtick = 0L; + + /* When no valid entries are present in the list, qf_ptr points to + * the first item in the list */ + if (to_qfl->qf_nonevalid) + { + to_qfl->qf_ptr = to_qfl->qf_start; + to_qfl->qf_index = 1; + } + } + + to->w_llist->qf_curlist = qi->qf_curlist; /* current list */ +} + +/* + * Get buffer number for file "directory/fname". + * Also sets the b_has_qf_entry flag. + */ + static int +qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *directory, char_u *fname) +{ + char_u *ptr = NULL; + buf_T *buf; + char_u *bufname; + + if (fname == NULL || *fname == NUL) /* no file name */ + return 0; + +#ifdef VMS + vms_remove_version(fname); +#endif +#ifdef BACKSLASH_IN_FILENAME + if (directory != NULL) + slash_adjust(directory); + slash_adjust(fname); +#endif + if (directory != NULL && !vim_isAbsName(fname) + && (ptr = concat_fnames(directory, fname, TRUE)) != NULL) + { + /* + * Here we check if the file really exists. + * This should normally be true, but if make works without + * "leaving directory"-messages we might have missed a + * directory change. + */ + if (mch_getperm(ptr) < 0) + { + vim_free(ptr); + directory = qf_guess_filepath(qi, qf_idx, fname); + if (directory) + ptr = concat_fnames(directory, fname, TRUE); + else + ptr = vim_strsave(fname); + } + /* Use concatenated directory name and file name */ + bufname = ptr; + } + else + bufname = fname; + + if (qf_last_bufname != NULL && STRCMP(bufname, qf_last_bufname) == 0 + && bufref_valid(&qf_last_bufref)) + { + buf = qf_last_bufref.br_buf; + vim_free(ptr); + } + else + { + vim_free(qf_last_bufname); + buf = buflist_new(bufname, NULL, (linenr_T)0, BLN_NOOPT); + if (bufname == ptr) + qf_last_bufname = bufname; + else + qf_last_bufname = vim_strsave(bufname); + set_bufref(&qf_last_bufref, buf); + } + if (buf == NULL) + return 0; + + buf->b_has_qf_entry = + (qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; + return buf->b_fnum; +} + +/* + * Push dirbuf onto the directory stack and return pointer to actual dir or + * NULL on error. + */ + static char_u * +qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr, int is_file_stack) +{ + struct dir_stack_T *ds_new; + struct dir_stack_T *ds_ptr; + + /* allocate new stack element and hook it in */ + ds_new = (struct dir_stack_T *)alloc((unsigned)sizeof(struct dir_stack_T)); + if (ds_new == NULL) + return NULL; + + ds_new->next = *stackptr; + *stackptr = ds_new; + + /* store directory on the stack */ + if (vim_isAbsName(dirbuf) + || (*stackptr)->next == NULL + || (*stackptr && is_file_stack)) + (*stackptr)->dirname = vim_strsave(dirbuf); + else + { + /* Okay we don't have an absolute path. + * dirbuf must be a subdir of one of the directories on the stack. + * Let's search... + */ + ds_new = (*stackptr)->next; + (*stackptr)->dirname = NULL; + while (ds_new) + { + vim_free((*stackptr)->dirname); + (*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf, + TRUE); + if (mch_isdir((*stackptr)->dirname) == TRUE) + break; + + ds_new = ds_new->next; + } + + /* clean up all dirs we already left */ + while ((*stackptr)->next != ds_new) + { + ds_ptr = (*stackptr)->next; + (*stackptr)->next = (*stackptr)->next->next; + vim_free(ds_ptr->dirname); + vim_free(ds_ptr); + } + + /* Nothing found -> it must be on top level */ + if (ds_new == NULL) + { + vim_free((*stackptr)->dirname); + (*stackptr)->dirname = vim_strsave(dirbuf); + } + } + + if ((*stackptr)->dirname != NULL) + return (*stackptr)->dirname; + else + { + ds_ptr = *stackptr; + *stackptr = (*stackptr)->next; + vim_free(ds_ptr); + return NULL; + } +} + +/* + * pop dirbuf from the directory stack and return previous directory or NULL if + * stack is empty + */ + static char_u * +qf_pop_dir(struct dir_stack_T **stackptr) +{ + struct dir_stack_T *ds_ptr; + + /* TODO: Should we check if dirbuf is the directory on top of the stack? + * What to do if it isn't? */ + + /* pop top element and free it */ + if (*stackptr != NULL) + { + ds_ptr = *stackptr; + *stackptr = (*stackptr)->next; + vim_free(ds_ptr->dirname); + vim_free(ds_ptr); + } + + /* return NEW top element as current dir or NULL if stack is empty*/ + return *stackptr ? (*stackptr)->dirname : NULL; +} + +/* + * clean up directory stack + */ + static void +qf_clean_dir_stack(struct dir_stack_T **stackptr) +{ + struct dir_stack_T *ds_ptr; + + while ((ds_ptr = *stackptr) != NULL) + { + *stackptr = (*stackptr)->next; + vim_free(ds_ptr->dirname); + vim_free(ds_ptr); + } +} + +/* + * Check in which directory of the directory stack the given file can be + * found. + * Returns a pointer to the directory name or NULL if not found. + * Cleans up intermediate directory entries. + * + * TODO: How to solve the following problem? + * If we have this directory tree: + * ./ + * ./aa + * ./aa/bb + * ./bb + * ./bb/x.c + * and make says: + * making all in aa + * making all in bb + * x.c:9: Error + * Then qf_push_dir thinks we are in ./aa/bb, but we are in ./bb. + * qf_guess_filepath will return NULL. + */ + static char_u * +qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *filename) +{ + struct dir_stack_T *ds_ptr; + struct dir_stack_T *ds_tmp; + char_u *fullname; + qf_list_T *qfl = &qi->qf_lists[qf_idx]; + + /* no dirs on the stack - there's nothing we can do */ + if (qfl->qf_dir_stack == NULL) + return NULL; + + ds_ptr = qfl->qf_dir_stack->next; + fullname = NULL; + while (ds_ptr) + { + vim_free(fullname); + fullname = concat_fnames(ds_ptr->dirname, filename, TRUE); + + /* If concat_fnames failed, just go on. The worst thing that can happen + * is that we delete the entire stack. + */ + if ((fullname != NULL) && (mch_getperm(fullname) >= 0)) + break; + + ds_ptr = ds_ptr->next; + } + + vim_free(fullname); + + /* clean up all dirs we already left */ + while (qfl->qf_dir_stack->next != ds_ptr) + { + ds_tmp = qfl->qf_dir_stack->next; + qfl->qf_dir_stack->next = qfl->qf_dir_stack->next->next; + vim_free(ds_tmp->dirname); + vim_free(ds_tmp); + } + + return ds_ptr == NULL ? NULL : ds_ptr->dirname; +} + +/* + * Returns TRUE if a quickfix/location list with the given identifier exists. + */ + static int +qflist_valid (win_T *wp, int_u qf_id) +{ + qf_info_T *qi = &ql_info; + int i; + + if (wp != NULL) + { + qi = GET_LOC_LIST(wp); /* Location list */ + if (qi == NULL) + return FALSE; + } + + for (i = 0; i < qi->qf_listcount; ++i) + if (qi->qf_lists[i].qf_id == qf_id) + return TRUE; + + return FALSE; +} + +/* + * When loading a file from the quickfix, the auto commands may modify it. + * This may invalidate the current quickfix entry. This function checks + * whether an entry is still present in the quickfix list. + * Similar to location list. + */ + static int +is_qf_entry_present(qf_info_T *qi, qfline_T *qf_ptr) +{ + qf_list_T *qfl; + qfline_T *qfp; + int i; + + qfl = &qi->qf_lists[qi->qf_curlist]; + + /* Search for the entry in the current list */ + for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count; + ++i, qfp = qfp->qf_next) + if (qfp == NULL || qfp == qf_ptr) + break; + + if (i == qfl->qf_count) /* Entry is not found */ + return FALSE; + + return TRUE; +} + +/* + * Get the next valid entry in the current quickfix/location list. The search + * starts from the current entry. Returns NULL on failure. + */ + static qfline_T * +get_next_valid_entry( + qf_info_T *qi, + qfline_T *qf_ptr, + int *qf_index, + int dir) +{ + int idx; + int old_qf_fnum; + + idx = *qf_index; + old_qf_fnum = qf_ptr->qf_fnum; + + do + { + if (idx == qi->qf_lists[qi->qf_curlist].qf_count + || qf_ptr->qf_next == NULL) + return NULL; + ++idx; + qf_ptr = qf_ptr->qf_next; + } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid + && !qf_ptr->qf_valid) + || (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); + + *qf_index = idx; + return qf_ptr; +} + +/* + * Get the previous valid entry in the current quickfix/location list. The + * search starts from the current entry. Returns NULL on failure. + */ + static qfline_T * +get_prev_valid_entry( + qf_info_T *qi, + qfline_T *qf_ptr, + int *qf_index, + int dir) +{ + int idx; + int old_qf_fnum; + + idx = *qf_index; + old_qf_fnum = qf_ptr->qf_fnum; + + do + { + if (idx == 1 || qf_ptr->qf_prev == NULL) + return NULL; + --idx; + qf_ptr = qf_ptr->qf_prev; + } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid + && !qf_ptr->qf_valid) + || (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum)); + + *qf_index = idx; + return qf_ptr; +} + +/* + * Get the n'th (errornr) previous/next valid entry from the current entry in + * the quickfix list. + * dir == FORWARD or FORWARD_FILE: next valid entry + * dir == BACKWARD or BACKWARD_FILE: previous valid entry + */ + static qfline_T * +get_nth_valid_entry( + qf_info_T *qi, + int errornr, + qfline_T *qf_ptr, + int *qf_index, + int dir) +{ + qfline_T *prev_qf_ptr; + int prev_index; + static char_u *e_no_more_items = (char_u *)N_("E553: No more items"); + char_u *err = e_no_more_items; + + while (errornr--) + { + prev_qf_ptr = qf_ptr; + prev_index = *qf_index; + + if (dir == FORWARD || dir == FORWARD_FILE) + qf_ptr = get_next_valid_entry(qi, qf_ptr, qf_index, dir); + else + qf_ptr = get_prev_valid_entry(qi, qf_ptr, qf_index, dir); + if (qf_ptr == NULL) + { + qf_ptr = prev_qf_ptr; + *qf_index = prev_index; + if (err != NULL) + { + EMSG(_(err)); + return NULL; + } + break; + } + + err = NULL; + } + + return qf_ptr; +} + +/* + * Get n'th (errornr) quickfix entry + */ + static qfline_T * +get_nth_entry( + qf_info_T *qi, + int errornr, + qfline_T *qf_ptr, + int *cur_qfidx) +{ + int qf_idx = *cur_qfidx; + + /* New error number is less than the current error number */ + while (errornr < qf_idx && qf_idx > 1 && qf_ptr->qf_prev != NULL) + { + --qf_idx; + qf_ptr = qf_ptr->qf_prev; + } + /* New error number is greater than the current error number */ + while (errornr > qf_idx && + qf_idx < qi->qf_lists[qi->qf_curlist].qf_count && + qf_ptr->qf_next != NULL) + { + ++qf_idx; + qf_ptr = qf_ptr->qf_next; + } + + *cur_qfidx = qf_idx; + return qf_ptr; +} + +/* + * Find a window displaying a Vim help file. + */ + static win_T * +qf_find_help_win(void) +{ + win_T *wp; + + FOR_ALL_WINDOWS(wp) + if (bt_help(wp->w_buffer)) + return wp; + + return NULL; +} + +/* + * Find a help window or open one. + */ + static int +jump_to_help_window(qf_info_T *qi, int *opened_window) +{ + win_T *wp; + int flags; + + if (cmdmod.tab != 0) + wp = NULL; + else + wp = qf_find_help_win(); + if (wp != NULL && wp->w_buffer->b_nwindows > 0) + win_enter(wp, TRUE); + else + { + /* + * Split off help window; put it at far top if no position + * specified, the current window is vertically split and narrow. + */ + flags = WSP_HELP; + if (cmdmod.split == 0 && curwin->w_width != Columns + && curwin->w_width < 80) + flags |= WSP_TOP; + if (qi != &ql_info) + flags |= WSP_NEWLOC; /* don't copy the location list */ + + if (win_split(0, flags) == FAIL) + return FAIL; + + *opened_window = TRUE; + + if (curwin->w_height < p_hh) + win_setheight((int)p_hh); + + if (qi != &ql_info) /* not a quickfix list */ + { + /* The new window should use the supplied location list */ + curwin->w_llist = qi; + qi->qf_refcount++; + } + } + + if (!p_im) + restart_edit = 0; /* don't want insert mode in help file */ + + return OK; +} + +/* + * Find a non-quickfix window using the given location list. + * Returns NULL if a matching window is not found. + */ + static win_T * +qf_find_win_with_loclist(qf_info_T *ll) +{ + win_T *wp; + + FOR_ALL_WINDOWS(wp) + if (wp->w_llist == ll && !bt_quickfix(wp->w_buffer)) + return wp; + + return NULL; +} + +/* + * Find a window containing a normal buffer + */ + static win_T * +qf_find_win_with_normal_buf(void) +{ + win_T *wp; + + FOR_ALL_WINDOWS(wp) + if (wp->w_buffer->b_p_bt[0] == NUL) + return wp; + + return NULL; +} + +/* + * Go to a window in any tabpage containing the specified file. Returns TRUE + * if successfully jumped to the window. Otherwise returns FALSE. + */ + static int +qf_goto_tabwin_with_file(int fnum) +{ + tabpage_T *tp; + win_T *wp; + + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer->b_fnum == fnum) + { + goto_tabpage_win(tp, wp); + return TRUE; + } + + return FALSE; +} + +/* + * Create a new window to show a file above the quickfix window. Called when + * only the quickfix window is present. + */ + static int +qf_open_new_file_win(qf_info_T *ll_ref) +{ + int flags; + + flags = WSP_ABOVE; + if (ll_ref != NULL) + flags |= WSP_NEWLOC; + if (win_split(0, flags) == FAIL) + return FAIL; /* not enough room for window */ + p_swb = empty_option; /* don't split again */ + swb_flags = 0; + RESET_BINDING(curwin); + if (ll_ref != NULL) + { + /* The new window should use the location list from the + * location list window */ + curwin->w_llist = ll_ref; + ll_ref->qf_refcount++; + } + return OK; +} + +/* + * Go to a window that shows the right buffer. If the window is not found, go + * to the window just above the location list window. This is used for opening + * a file from a location window and not from a quickfix window. If some usable + * window is previously found, then it is supplied in 'use_win'. + */ + static void +qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref) +{ + win_T *win = use_win; + + if (win == NULL) + { + /* Find the window showing the selected file */ + FOR_ALL_WINDOWS(win) + if (win->w_buffer->b_fnum == qf_fnum) + break; + if (win == NULL) + { + /* Find a previous usable window */ + win = curwin; + do + { + if (win->w_buffer->b_p_bt[0] == NUL) + break; + if (win->w_prev == NULL) + win = lastwin; /* wrap around the top */ + else + win = win->w_prev; /* go to previous window */ + } while (win != curwin); + } + } + win_goto(win); + + /* If the location list for the window is not set, then set it + * to the location list from the location window */ + if (win->w_llist == NULL) + { + win->w_llist = ll_ref; + ll_ref->qf_refcount++; + } +} + +/* + * Go to a window that shows the specified file. If a window is not found, go + * to the window just above the quickfix window. This is used for opening a + * file from a quickfix window and not from a location window. + */ + static void +qf_goto_win_with_qfl_file(int qf_fnum) +{ + win_T *win; + win_T *altwin; + + win = curwin; + altwin = NULL; + for (;;) + { + if (win->w_buffer->b_fnum == qf_fnum) + break; + if (win->w_prev == NULL) + win = lastwin; /* wrap around the top */ + else + win = win->w_prev; /* go to previous window */ + + if (IS_QF_WINDOW(win)) + { + /* Didn't find it, go to the window before the quickfix + * window. */ + if (altwin != NULL) + win = altwin; + else if (curwin->w_prev != NULL) + win = curwin->w_prev; + else + win = curwin->w_next; + break; + } + + /* Remember a usable window. */ + if (altwin == NULL && !win->w_p_pvw + && win->w_buffer->b_p_bt[0] == NUL) + altwin = win; + } + + win_goto(win); +} + +/* + * Find a suitable window for opening a file (qf_fnum) from the + * quickfix/location list and jump to it. If the file is already opened in a + * window, jump to it. Otherwise open a new window to display the file. This is + * called from either a quickfix or a location list window. + */ + static int +qf_jump_to_usable_window(int qf_fnum, int *opened_window) +{ + win_T *usable_win_ptr = NULL; + int usable_win; + qf_info_T *ll_ref; + win_T *win; + + usable_win = 0; + + ll_ref = curwin->w_llist_ref; + if (ll_ref != NULL) + { + /* Find a non-quickfix window with this location list */ + usable_win_ptr = qf_find_win_with_loclist(ll_ref); + if (usable_win_ptr != NULL) + usable_win = 1; + } + + if (!usable_win) + { + /* Locate a window showing a normal buffer */ + win = qf_find_win_with_normal_buf(); + if (win != NULL) + usable_win = 1; + } + + /* + * If no usable window is found and 'switchbuf' contains "usetab" + * then search in other tabs. + */ + if (!usable_win && (swb_flags & SWB_USETAB)) + usable_win = qf_goto_tabwin_with_file(qf_fnum); + + /* + * If there is only one window and it is the quickfix window, create a + * new one above the quickfix window. + */ + if ((ONE_WINDOW && bt_quickfix(curbuf)) || !usable_win) + { + if (qf_open_new_file_win(ll_ref) != OK) + return FAIL; + *opened_window = TRUE; /* close it when fail */ + } + else + { + if (curwin->w_llist_ref != NULL) /* In a location window */ + qf_goto_win_with_ll_file(usable_win_ptr, qf_fnum, ll_ref); + else /* In a quickfix window */ + qf_goto_win_with_qfl_file(qf_fnum); + } + + return OK; +} + +/* + * Edit the selected file or help file. + */ + static int +qf_jump_edit_buffer( + qf_info_T *qi, + qfline_T *qf_ptr, + int forceit, + win_T *oldwin, + int *opened_window, + int *abort) +{ + int retval = OK; + + if (qf_ptr->qf_type == 1) + { + /* Open help file (do_ecmd() will set b_help flag, readfile() will + * set b_p_ro flag). */ + if (!can_abandon(curbuf, forceit)) + { + no_write_message(); + retval = FAIL; + } + else + retval = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1, + ECMD_HIDE + ECMD_SET_HELP, + oldwin == curwin ? curwin : NULL); + } + else + { + int old_qf_curlist = qi->qf_curlist; + int save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; + + retval = buflist_getfile(qf_ptr->qf_fnum, + (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); + + if (qi != &ql_info) + { + /* + * Location list. Check whether the associated window is still + * present and the list is still valid. + */ + if (!win_valid_any_tab(oldwin)) + { + EMSG(_("E924: Current window was closed")); + *abort = TRUE; + *opened_window = FALSE; + } + else if (!qflist_valid(oldwin, save_qfid)) + { + EMSG(_(e_loc_list_changed)); + *abort = TRUE; + } + } + else if (old_qf_curlist != qi->qf_curlist + || !is_qf_entry_present(qi, qf_ptr)) + { + if (qi == &ql_info) + EMSG(_("E925: Current quickfix was changed")); + else + EMSG(_(e_loc_list_changed)); + *abort = TRUE; + } + + if (*abort) + retval = FAIL; + } + + return retval; +} + +/* + * Go to the error line in the current file using either line/column number or + * a search pattern. + */ + static void +qf_jump_goto_line( + linenr_T qf_lnum, + int qf_col, + char_u qf_viscol, + char_u *qf_pattern) +{ + linenr_T i; + char_u *line; + colnr_T screen_col; + colnr_T char_col; + + if (qf_pattern == NULL) + { + /* + * Go to line with error, unless qf_lnum is 0. + */ + i = qf_lnum; + if (i > 0) + { + if (i > curbuf->b_ml.ml_line_count) + i = curbuf->b_ml.ml_line_count; + curwin->w_cursor.lnum = i; + } + if (qf_col > 0) + { + curwin->w_cursor.col = qf_col - 1; +#ifdef FEAT_VIRTUALEDIT + curwin->w_cursor.coladd = 0; +#endif + if (qf_viscol == TRUE) + { + /* + * Check each character from the beginning of the error + * line up to the error column. For each tab character + * found, reduce the error column value by the length of + * a tab character. + */ + line = ml_get_curline(); + screen_col = 0; + for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) + { + if (*line == NUL) + break; + if (*line++ == '\t') + { + curwin->w_cursor.col -= 7 - (screen_col % 8); + screen_col += 8 - (screen_col % 8); + } + else + ++screen_col; + } + } + check_cursor(); + } + else + beginline(BL_WHITE | BL_FIX); + } + else + { + pos_T save_cursor; + + /* Move the cursor to the first line in the buffer */ + save_cursor = curwin->w_cursor; + curwin->w_cursor.lnum = 0; + if (!do_search(NULL, '/', qf_pattern, (long)1, + SEARCH_KEEP, NULL, NULL)) + curwin->w_cursor = save_cursor; + } +} + +/* + * Display quickfix list index and size message + */ + static void +qf_jump_print_msg( + qf_info_T *qi, + int qf_index, + qfline_T *qf_ptr, + buf_T *old_curbuf, + linenr_T old_lnum) +{ + linenr_T i; + int len; + + /* Update the screen before showing the message, unless the screen + * scrolled up. */ + if (!msg_scrolled) + update_topline_redraw(); + sprintf((char *)IObuff, _("(%d of %d)%s%s: "), qf_index, + qi->qf_lists[qi->qf_curlist].qf_count, + qf_ptr->qf_cleared ? _(" (line deleted)") : "", + (char *)qf_types(qf_ptr->qf_type, qf_ptr->qf_nr)); + /* Add the message, skipping leading whitespace and newlines. */ + len = (int)STRLEN(IObuff); + qf_fmt_text(skipwhite(qf_ptr->qf_text), IObuff + len, IOSIZE - len); + + /* Output the message. Overwrite to avoid scrolling when the 'O' + * flag is present in 'shortmess'; But when not jumping, print the + * whole message. */ + i = msg_scroll; + if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum) + msg_scroll = TRUE; + else if (!msg_scrolled && shortmess(SHM_OVERALL)) + msg_scroll = FALSE; + msg_attr_keep(IObuff, 0, TRUE); + msg_scroll = i; +} + +/* + * jump to a quickfix line + * if dir == FORWARD go "errornr" valid entries forward + * if dir == BACKWARD go "errornr" valid entries backward + * if dir == FORWARD_FILE go "errornr" valid entries files backward + * if dir == BACKWARD_FILE go "errornr" valid entries files backward + * else if "errornr" is zero, redisplay the same line + * else go to entry "errornr" + */ + void +qf_jump(qf_info_T *qi, + int dir, + int errornr, + int forceit) +{ + qfline_T *qf_ptr; + qfline_T *old_qf_ptr; + int qf_index; + int old_qf_index; + buf_T *old_curbuf; + linenr_T old_lnum; + char_u *old_swb = p_swb; + unsigned old_swb_flags = swb_flags; + int opened_window = FALSE; + win_T *oldwin = curwin; + int print_message = TRUE; +#ifdef FEAT_FOLDING + int old_KeyTyped = KeyTyped; /* getting file may reset it */ +#endif + int retval = OK; + + if (qi == NULL) + qi = &ql_info; + + if (qi->qf_curlist >= qi->qf_listcount + || qi->qf_lists[qi->qf_curlist].qf_count == 0) + { + EMSG(_(e_quickfix)); + return; + } + + qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr; + old_qf_ptr = qf_ptr; + qf_index = qi->qf_lists[qi->qf_curlist].qf_index; + old_qf_index = qf_index; + if (dir != 0) /* next/prev valid entry */ + { + qf_ptr = get_nth_valid_entry(qi, errornr, qf_ptr, &qf_index, dir); + if (qf_ptr == NULL) + { + qf_ptr = old_qf_ptr; + qf_index = old_qf_index; + goto theend; + } + } + else if (errornr != 0) /* go to specified number */ + qf_ptr = get_nth_entry(qi, errornr, qf_ptr, &qf_index); + + qi->qf_lists[qi->qf_curlist].qf_index = qf_index; + if (qf_win_pos_update(qi, old_qf_index)) + /* No need to print the error message if it's visible in the error + * window */ + print_message = FALSE; + + /* + * For ":helpgrep" find a help window or open one. + */ + if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0)) + if (jump_to_help_window(qi, &opened_window) == FAIL) + goto theend; + + /* + * If currently in the quickfix window, find another window to show the + * file in. + */ + if (bt_quickfix(curbuf) && !opened_window) + { + /* + * If there is no file specified, we don't know where to go. + * But do advance, otherwise ":cn" gets stuck. + */ + if (qf_ptr->qf_fnum == 0) + goto theend; + + if (qf_jump_to_usable_window(qf_ptr->qf_fnum, &opened_window) == FAIL) + goto failed; + } + + /* + * If there is a file name, + * read the wanted file if needed, and check autowrite etc. + */ + old_curbuf = curbuf; + old_lnum = curwin->w_cursor.lnum; + + if (qf_ptr->qf_fnum != 0) + { + int abort = FALSE; + + retval = qf_jump_edit_buffer(qi, qf_ptr, forceit, oldwin, + &opened_window, &abort); + if (abort) + { + qi = NULL; + qf_ptr = NULL; + } + } + + if (retval == OK) + { + /* When not switched to another buffer, still need to set pc mark */ + if (curbuf == old_curbuf) + setpcmark(); + + qf_jump_goto_line(qf_ptr->qf_lnum, qf_ptr->qf_col, qf_ptr->qf_viscol, + qf_ptr->qf_pattern); + +#ifdef FEAT_FOLDING + if ((fdo_flags & FDO_QUICKFIX) && old_KeyTyped) + foldOpenCursor(); +#endif + if (print_message) + qf_jump_print_msg(qi, qf_index, qf_ptr, old_curbuf, old_lnum); + } + else + { + if (opened_window) + win_close(curwin, TRUE); /* Close opened window */ + if (qf_ptr != NULL && qf_ptr->qf_fnum != 0) + { + /* + * Couldn't open file, so put index back where it was. This could + * happen if the file was readonly and we changed something. + */ +failed: + qf_ptr = old_qf_ptr; + qf_index = old_qf_index; + } + } +theend: + if (qi != NULL) + { + qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr; + qi->qf_lists[qi->qf_curlist].qf_index = qf_index; + } + if (p_swb != old_swb && opened_window) + { + /* Restore old 'switchbuf' value, but not when an autocommand or + * modeline has changed the value. */ + if (p_swb == empty_option) + { + p_swb = old_swb; + swb_flags = old_swb_flags; + } + else + free_string_option(old_swb); + } +} + +/* + * ":clist": list all errors + * ":llist": list all locations + */ + void +qf_list(exarg_T *eap) +{ + buf_T *buf; + char_u *fname; + qfline_T *qfp; + int i; + int idx1 = 1; + int idx2 = -1; + char_u *arg = eap->arg; + int plus = FALSE; + int qfFileAttr; + int qfSepAttr; + int qfLineAttr; + int all = eap->forceit; /* if not :cl!, only show + recognised errors */ + qf_info_T *qi = &ql_info; + + if (eap->cmdidx == CMD_llist) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); + return; + } + } + + if (qi->qf_curlist >= qi->qf_listcount + || qi->qf_lists[qi->qf_curlist].qf_count == 0) + { + EMSG(_(e_quickfix)); + return; + } + if (*arg == '+') + { + ++arg; + plus = TRUE; + } + if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) + { + EMSG(_(e_trailing)); + return; + } + if (plus) + { + i = qi->qf_lists[qi->qf_curlist].qf_index; + idx2 = i + idx1; + idx1 = i; + } + else + { + i = qi->qf_lists[qi->qf_curlist].qf_count; + if (idx1 < 0) + idx1 = (-idx1 > i) ? 0 : idx1 + i + 1; + if (idx2 < 0) + idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; + } + + /* Shorten all the file names, so that it is easy to read */ + shorten_fnames(FALSE); + + /* + * Get the attributes for the different quickfix highlight items. Note + * that this depends on syntax items defined in the qf.vim syntax file + */ + qfFileAttr = syn_name2attr((char_u *)"qfFileName"); + if (qfFileAttr == 0) + qfFileAttr = HL_ATTR(HLF_D); + qfSepAttr = syn_name2attr((char_u *)"qfSeparator"); + if (qfSepAttr == 0) + qfSepAttr = HL_ATTR(HLF_D); + qfLineAttr = syn_name2attr((char_u *)"qfLineNr"); + if (qfLineAttr == 0) + qfLineAttr = HL_ATTR(HLF_N); + + if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) + all = TRUE; + qfp = qi->qf_lists[qi->qf_curlist].qf_start; + for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) + { + if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) + { + msg_putchar('\n'); + if (got_int) + break; + + fname = NULL; + if (qfp->qf_module != NULL && *qfp->qf_module != NUL) + vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", i, (char *)qfp->qf_module); + else { + if (qfp->qf_fnum != 0 + && (buf = buflist_findnr(qfp->qf_fnum)) != NULL) + { + fname = buf->b_fname; + if (qfp->qf_type == 1) /* :helpgrep */ + fname = gettail(fname); + } + if (fname == NULL) + sprintf((char *)IObuff, "%2d", i); + else + vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", + i, (char *)fname); + } + msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index + ? HL_ATTR(HLF_QFL) : qfFileAttr); + + if (qfp->qf_lnum != 0) + msg_puts_attr((char_u *)":", qfSepAttr); + if (qfp->qf_lnum == 0) + IObuff[0] = NUL; + else if (qfp->qf_col == 0) + sprintf((char *)IObuff, "%ld", qfp->qf_lnum); + else + sprintf((char *)IObuff, "%ld col %d", + qfp->qf_lnum, qfp->qf_col); + sprintf((char *)IObuff + STRLEN(IObuff), "%s", + (char *)qf_types(qfp->qf_type, qfp->qf_nr)); + msg_puts_attr(IObuff, qfLineAttr); + msg_puts_attr((char_u *)":", qfSepAttr); + if (qfp->qf_pattern != NULL) + { + qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); + msg_puts(IObuff); + msg_puts_attr((char_u *)":", qfSepAttr); + } + msg_puts((char_u *)" "); + + /* Remove newlines and leading whitespace from the text. For an + * unrecognized line keep the indent, the compiler may mark a word + * with ^^^^. */ + qf_fmt_text((fname != NULL || qfp->qf_lnum != 0) + ? skipwhite(qfp->qf_text) : qfp->qf_text, + IObuff, IOSIZE); + msg_prt_line(IObuff, FALSE); + out_flush(); /* show one line at a time */ + } + + qfp = qfp->qf_next; + if (qfp == NULL) + break; + ++i; + ui_breakcheck(); + } +} + +/* + * Remove newlines and leading whitespace from an error message. + * Put the result in "buf[bufsize]". + */ + static void +qf_fmt_text(char_u *text, char_u *buf, int bufsize) +{ + int i; + char_u *p = text; + + for (i = 0; *p != NUL && i < bufsize - 1; ++i) + { + if (*p == '\n') + { + buf[i] = ' '; + while (*++p != NUL) + if (!VIM_ISWHITE(*p) && *p != '\n') + break; + } + else + buf[i] = *p++; + } + buf[i] = NUL; +} + +/* + * Display information (list number, list size and the title) about a + * quickfix/location list. + */ + static void +qf_msg(qf_info_T *qi, int which, char *lead) +{ + char *title = (char *)qi->qf_lists[which].qf_title; + int count = qi->qf_lists[which].qf_count; + char_u buf[IOSIZE]; + + vim_snprintf((char *)buf, IOSIZE, _("%serror list %d of %d; %d errors "), + lead, + which + 1, + qi->qf_listcount, + count); + + if (title != NULL) + { + size_t len = STRLEN(buf); + + if (len < 34) + { + vim_memset(buf + len, ' ', 34 - len); + buf[34] = NUL; + } + vim_strcat(buf, (char_u *)title, IOSIZE); + } + trunc_string(buf, buf, Columns - 1, IOSIZE); + msg(buf); +} + +/* + * ":colder [count]": Up in the quickfix stack. + * ":cnewer [count]": Down in the quickfix stack. + * ":lolder [count]": Up in the location list stack. + * ":lnewer [count]": Down in the location list stack. + */ + void +qf_age(exarg_T *eap) +{ + qf_info_T *qi = &ql_info; + int count; + + if (eap->cmdidx == CMD_lolder || eap->cmdidx == CMD_lnewer) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); + return; + } + } + + if (eap->addr_count != 0) + count = eap->line2; + else + count = 1; + while (count--) + { + if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) + { + if (qi->qf_curlist == 0) + { + EMSG(_("E380: At bottom of quickfix stack")); + break; + } + --qi->qf_curlist; + } + else + { + if (qi->qf_curlist >= qi->qf_listcount - 1) + { + EMSG(_("E381: At top of quickfix stack")); + break; + } + ++qi->qf_curlist; + } + } + qf_msg(qi, qi->qf_curlist, ""); + qf_update_buffer(qi, NULL); +} + +/* + * Display the information about all the quickfix/location lists in the stack + */ + void +qf_history(exarg_T *eap) +{ + qf_info_T *qi = &ql_info; + int i; + + if (eap->cmdidx == CMD_lhistory) + qi = GET_LOC_LIST(curwin); + if (qi == NULL || (qi->qf_listcount == 0 + && qi->qf_lists[qi->qf_curlist].qf_count == 0)) + MSG(_("No entries")); + else + for (i = 0; i < qi->qf_listcount; ++i) + qf_msg(qi, i, i == qi->qf_curlist ? "> " : " "); +} + +/* + * Free all the entries in the error list "idx". Note that other information + * associated with the list like context and title are not freed. + */ + static void +qf_free_items(qf_info_T *qi, int idx) +{ + qfline_T *qfp; + qfline_T *qfpnext; + int stop = FALSE; + qf_list_T *qfl = &qi->qf_lists[idx]; + + while (qfl->qf_count && qfl->qf_start != NULL) + { + qfp = qfl->qf_start; + qfpnext = qfp->qf_next; + if (!stop) + { + vim_free(qfp->qf_module); + vim_free(qfp->qf_text); + vim_free(qfp->qf_pattern); + stop = (qfp == qfpnext); + vim_free(qfp); + if (stop) + /* Somehow qf_count may have an incorrect value, set it to 1 + * to avoid crashing when it's wrong. + * TODO: Avoid qf_count being incorrect. */ + qfl->qf_count = 1; + } + qfl->qf_start = qfpnext; + --qfl->qf_count; + } + + qfl->qf_index = 0; + qfl->qf_start = NULL; + qfl->qf_last = NULL; + qfl->qf_ptr = NULL; + qfl->qf_nonevalid = TRUE; + + qf_clean_dir_stack(&qfl->qf_dir_stack); + qfl->qf_directory = NULL; + qf_clean_dir_stack(&qfl->qf_file_stack); + qfl->qf_currfile = NULL; + qfl->qf_multiline = FALSE; + qfl->qf_multiignore = FALSE; + qfl->qf_multiscan = FALSE; +} + +/* + * Free error list "idx". Frees all the entries in the quickfix list, + * associated context information and the title. + */ + static void +qf_free(qf_info_T *qi, int idx) +{ + qf_list_T *qfl = &qi->qf_lists[idx]; + + qf_free_items(qi, idx); + + VIM_CLEAR(qfl->qf_title); + free_tv(qfl->qf_ctx); + qfl->qf_ctx = NULL; + qfl->qf_id = 0; + qfl->qf_changedtick = 0L; +} + +/* + * qf_mark_adjust: adjust marks + */ + void +qf_mark_adjust( + win_T *wp, + linenr_T line1, + linenr_T line2, + long amount, + long amount_after) +{ + int i; + qfline_T *qfp; + int idx; + qf_info_T *qi = &ql_info; + int found_one = FALSE; + int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; + + if (!(curbuf->b_has_qf_entry & buf_has_flag)) + return; + if (wp != NULL) + { + if (wp->w_llist == NULL) + return; + qi = wp->w_llist; + } + + for (idx = 0; idx < qi->qf_listcount; ++idx) + if (qi->qf_lists[idx].qf_count) + for (i = 0, qfp = qi->qf_lists[idx].qf_start; + i < qi->qf_lists[idx].qf_count && qfp != NULL; + ++i, qfp = qfp->qf_next) + if (qfp->qf_fnum == curbuf->b_fnum) + { + found_one = TRUE; + if (qfp->qf_lnum >= line1 && qfp->qf_lnum <= line2) + { + if (amount == MAXLNUM) + qfp->qf_cleared = TRUE; + else + qfp->qf_lnum += amount; + } + else if (amount_after && qfp->qf_lnum > line2) + qfp->qf_lnum += amount_after; + } + + if (!found_one) + curbuf->b_has_qf_entry &= ~buf_has_flag; +} + +/* + * Make a nice message out of the error character and the error number: + * char number message + * e or E 0 " error" + * w or W 0 " warning" + * i or I 0 " info" + * 0 0 "" + * other 0 " c" + * e or E n " error n" + * w or W n " warning n" + * i or I n " info n" + * 0 n " error n" + * other n " c n" + * 1 x "" :helpgrep + */ + static char_u * +qf_types(int c, int nr) +{ + static char_u buf[20]; + static char_u cc[3]; + char_u *p; + + if (c == 'W' || c == 'w') + p = (char_u *)" warning"; + else if (c == 'I' || c == 'i') + p = (char_u *)" info"; + else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) + p = (char_u *)" error"; + else if (c == 0 || c == 1) + p = (char_u *)""; + else + { + cc[0] = ' '; + cc[1] = c; + cc[2] = NUL; + p = cc; + } + + if (nr <= 0) + return p; + + sprintf((char *)buf, "%s %3d", (char *)p, nr); + return buf; +} + +/* + * ":cwindow": open the quickfix window if we have errors to display, + * close it if not. + * ":lwindow": open the location list window if we have locations to display, + * close it if not. + */ + void +ex_cwindow(exarg_T *eap) +{ + qf_info_T *qi = &ql_info; + win_T *win; + + if (eap->cmdidx == CMD_lwindow) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + return; + } + + /* Look for an existing quickfix window. */ + win = qf_find_win(qi); + + /* + * If a quickfix window is open but we have no errors to display, + * close the window. If a quickfix window is not open, then open + * it if we have errors; otherwise, leave it closed. + */ + if (qi->qf_lists[qi->qf_curlist].qf_nonevalid + || qi->qf_lists[qi->qf_curlist].qf_count == 0 + || qi->qf_curlist >= qi->qf_listcount) + { + if (win != NULL) + ex_cclose(eap); + } + else if (win == NULL) + ex_copen(eap); +} + +/* + * ":cclose": close the window showing the list of errors. + * ":lclose": close the window showing the location list + */ + void +ex_cclose(exarg_T *eap) +{ + win_T *win = NULL; + qf_info_T *qi = &ql_info; + + if (eap->cmdidx == CMD_lclose || eap->cmdidx == CMD_lwindow) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + return; + } + + /* Find existing quickfix window and close it. */ + win = qf_find_win(qi); + if (win != NULL) + win_close(win, FALSE); +} + +/* + * ":copen": open a window that shows the list of errors. + * ":lopen": open a window that shows the location list. + */ + void +ex_copen(exarg_T *eap) +{ + qf_info_T *qi = &ql_info; + int height; + win_T *win; + tabpage_T *prevtab = curtab; + buf_T *qf_buf; + win_T *oldwin = curwin; + + if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); + return; + } + } + + if (eap->addr_count != 0) + height = eap->line2; + else + height = QF_WINHEIGHT; + + reset_VIsual_and_resel(); /* stop Visual mode */ +#ifdef FEAT_GUI + need_mouse_correct = TRUE; +#endif + + /* + * Find existing quickfix window, or open a new one. + */ + win = qf_find_win(qi); + + if (win != NULL && cmdmod.tab == 0) + { + win_goto(win); + if (eap->addr_count != 0) + { + if (cmdmod.split & WSP_VERT) + { + if (height != win->w_width) + win_setwidth(height); + } + else if (height != win->w_height) + win_setheight(height); + } + } + else + { + int flags = 0; + + qf_buf = qf_find_buf(qi); + + /* The current window becomes the previous window afterwards. */ + win = curwin; + + if ((eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow) + && cmdmod.split == 0) + /* Create the new quickfix window at the very bottom, except when + * :belowright or :aboveleft is used. */ + win_goto(lastwin); + /* Default is to open the window below the current window */ + if (cmdmod.split == 0) + flags = WSP_BELOW; + flags |= WSP_NEWLOC; + if (win_split(height, flags) == FAIL) + return; /* not enough room for window */ + RESET_BINDING(curwin); + + if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) + { + /* + * For the location list window, create a reference to the + * location list from the window 'win'. + */ + curwin->w_llist_ref = win->w_llist; + win->w_llist->qf_refcount++; + } + + if (oldwin != curwin) + oldwin = NULL; /* don't store info when in another window */ + if (qf_buf != NULL) + /* Use the existing quickfix buffer */ + (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE, + ECMD_HIDE + ECMD_OLDBUF, oldwin); + else + { + /* Create a new quickfix buffer */ + (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin); + /* switch off 'swapfile' */ + set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); + set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", + OPT_LOCAL); + set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL); + RESET_BINDING(curwin); +#ifdef FEAT_DIFF + curwin->w_p_diff = FALSE; +#endif +#ifdef FEAT_FOLDING + set_option_value((char_u *)"fdm", 0L, (char_u *)"manual", + OPT_LOCAL); +#endif + } + + /* Only set the height when still in the same tab page and there is no + * window to the side. */ + if (curtab == prevtab && curwin->w_width == Columns) + win_setheight(height); + curwin->w_p_wfh = TRUE; /* set 'winfixheight' */ + if (win_valid(win)) + prevwin = win; + } + + qf_set_title_var(qi); + + /* + * Fill the buffer with the quickfix list. + */ + qf_fill_buffer(qi, curbuf, NULL); + + curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index; + curwin->w_cursor.col = 0; + check_cursor(); + update_topline(); /* scroll to show the line */ +} + +/* + * Move the cursor in the quickfix window to "lnum". + */ + static void +qf_win_goto(win_T *win, linenr_T lnum) +{ + win_T *old_curwin = curwin; + + curwin = win; + curbuf = win->w_buffer; + curwin->w_cursor.lnum = lnum; + curwin->w_cursor.col = 0; +#ifdef FEAT_VIRTUALEDIT + curwin->w_cursor.coladd = 0; +#endif + curwin->w_curswant = 0; + update_topline(); /* scroll to show the line */ + redraw_later(VALID); + curwin->w_redr_status = TRUE; /* update ruler */ + curwin = old_curwin; + curbuf = curwin->w_buffer; +} + +/* + * :cbottom/:lbottom commands. + */ + void +ex_cbottom(exarg_T *eap UNUSED) +{ + qf_info_T *qi = &ql_info; + win_T *win; + + if (eap->cmdidx == CMD_lbottom) + { + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); + return; + } + } + + win = qf_find_win(qi); + if (win != NULL && win->w_cursor.lnum != win->w_buffer->b_ml.ml_line_count) + qf_win_goto(win, win->w_buffer->b_ml.ml_line_count); +} + +/* + * Return the number of the current entry (line number in the quickfix + * window). + */ + linenr_T +qf_current_entry(win_T *wp) +{ + qf_info_T *qi = &ql_info; + + if (IS_LL_WINDOW(wp)) + /* In the location list window, use the referenced location list */ + qi = wp->w_llist_ref; - FOR_ALL_TAB_WINDOWS(tp, wp) - { - if (wp->w_buffer->b_fnum == qf_ptr->qf_fnum) - { - goto_tabpage_win(tp, wp); - usable_win = 1; - goto win_found; - } - } + return qi->qf_lists[qi->qf_curlist].qf_index; +} + +/* + * Update the cursor position in the quickfix window to the current error. + * Return TRUE if there is a quickfix window. + */ + static int +qf_win_pos_update( + qf_info_T *qi, + int old_qf_index) /* previous qf_index or zero */ +{ + win_T *win; + int qf_index = qi->qf_lists[qi->qf_curlist].qf_index; + + /* + * Put the cursor on the current error in the quickfix window, so that + * it's viewable. + */ + win = qf_find_win(qi); + if (win != NULL + && qf_index <= win->w_buffer->b_ml.ml_line_count + && old_qf_index != qf_index) + { + if (qf_index > old_qf_index) + { + win->w_redraw_top = old_qf_index; + win->w_redraw_bot = qf_index; + } + else + { + win->w_redraw_top = qf_index; + win->w_redraw_bot = old_qf_index; } -win_found: + qf_win_goto(win, qf_index); + } + return win != NULL; +} - /* - * If there is only one window and it is the quickfix window, create a - * new one above the quickfix window. - */ - if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win) +/* + * Check whether the given window is displaying the specified quickfix/location + * list buffer + */ + static int +is_qf_win(win_T *win, qf_info_T *qi) +{ + /* + * A window displaying the quickfix buffer will have the w_llist_ref field + * set to NULL. + * A window displaying a location list buffer will have the w_llist_ref + * pointing to the location list. + */ + if (bt_quickfix(win->w_buffer)) + if ((qi == &ql_info && win->w_llist_ref == NULL) + || (qi != &ql_info && win->w_llist_ref == qi)) + return TRUE; + + return FALSE; +} + +/* + * Find a window displaying the quickfix/location list 'qi' + * Only searches in the current tabpage. + */ + static win_T * +qf_find_win(qf_info_T *qi) +{ + win_T *win; + + FOR_ALL_WINDOWS(win) + if (is_qf_win(win, qi)) + return win; + return NULL; +} + +/* + * Find a quickfix buffer. + * Searches in windows opened in all the tabs. + */ + static buf_T * +qf_find_buf(qf_info_T *qi) +{ + tabpage_T *tp; + win_T *win; + + FOR_ALL_TAB_WINDOWS(tp, win) + if (is_qf_win(win, qi)) + return win->w_buffer; + + return NULL; +} + +/* + * Update the w:quickfix_title variable in the quickfix/location list window + */ + static void +qf_update_win_titlevar(qf_info_T *qi) +{ + win_T *win; + win_T *curwin_save; + + if ((win = qf_find_win(qi)) != NULL) + { + curwin_save = curwin; + curwin = win; + qf_set_title_var(qi); + curwin = curwin_save; + } +} + +/* + * Find the quickfix buffer. If it exists, update the contents. + */ + static void +qf_update_buffer(qf_info_T *qi, qfline_T *old_last) +{ + buf_T *buf; + win_T *win; + aco_save_T aco; + + /* Check if a buffer for the quickfix list exists. Update it. */ + buf = qf_find_buf(qi); + if (buf != NULL) + { + linenr_T old_line_count = buf->b_ml.ml_line_count; + + if (old_last == NULL) + /* set curwin/curbuf to buf and save a few things */ + aucmd_prepbuf(&aco, buf); + + qf_update_win_titlevar(qi); + + qf_fill_buffer(qi, buf, old_last); + ++CHANGEDTICK(buf); + + if (old_last == NULL) { - flags = WSP_ABOVE; - if (ll_ref != NULL) - flags |= WSP_NEWLOC; - if (win_split(0, flags) == FAIL) - goto failed; /* not enough room for window */ - opened_window = TRUE; /* close it when fail */ - p_swb = empty_option; /* don't split again */ - swb_flags = 0; - RESET_BINDING(curwin); - if (ll_ref != NULL) + (void)qf_win_pos_update(qi, 0); + + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + } + + /* Only redraw when added lines are visible. This avoids flickering + * when the added lines are not visible. */ + if ((win = qf_find_win(qi)) != NULL && old_line_count < win->w_botline) + redraw_buf_later(buf, NOT_VALID); + } +} + +/* + * Set "w:quickfix_title" if "qi" has a title. + */ + static void +qf_set_title_var(qf_info_T *qi) +{ + if (qi->qf_lists[qi->qf_curlist].qf_title != NULL) + set_internal_string_var((char_u *)"w:quickfix_title", + qi->qf_lists[qi->qf_curlist].qf_title); +} + +/* + * Add an error line to the quickfix buffer. + */ + static int +qf_buf_add_line(buf_T *buf, linenr_T lnum, qfline_T *qfp, char_u *dirname) +{ + int len; + buf_T *errbuf; + + if (qfp->qf_module != NULL) + { + STRCPY(IObuff, qfp->qf_module); + len = (int)STRLEN(IObuff); + } + else if (qfp->qf_fnum != 0 + && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL + && errbuf->b_fname != NULL) + { + if (qfp->qf_type == 1) /* :helpgrep */ + STRCPY(IObuff, gettail(errbuf->b_fname)); + else + { + /* shorten the file name if not done already */ + if (errbuf->b_sfname == NULL + || mch_isFullName(errbuf->b_sfname)) { - /* The new window should use the location list from the - * location list window */ - curwin->w_llist = ll_ref; - ll_ref->qf_refcount++; + if (*dirname == NUL) + mch_dirname(dirname, MAXPATHL); + shorten_buf_fname(errbuf, dirname, FALSE); } + STRCPY(IObuff, errbuf->b_fname); + } + len = (int)STRLEN(IObuff); + } + else + len = 0; + IObuff[len++] = '|'; + + if (qfp->qf_lnum > 0) + { + sprintf((char *)IObuff + len, "%ld", qfp->qf_lnum); + len += (int)STRLEN(IObuff + len); + + if (qfp->qf_col > 0) + { + sprintf((char *)IObuff + len, " col %d", qfp->qf_col); + len += (int)STRLEN(IObuff + len); + } + + sprintf((char *)IObuff + len, "%s", + (char *)qf_types(qfp->qf_type, qfp->qf_nr)); + len += (int)STRLEN(IObuff + len); + } + else if (qfp->qf_pattern != NULL) + { + qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); + len += (int)STRLEN(IObuff + len); + } + IObuff[len++] = '|'; + IObuff[len++] = ' '; + + /* Remove newlines and leading whitespace from the text. + * For an unrecognized line keep the indent, the compiler may + * mark a word with ^^^^. */ + qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, + IObuff + len, IOSIZE - len); + + if (ml_append_buf(buf, lnum, IObuff, + (colnr_T)STRLEN(IObuff) + 1, FALSE) == FAIL) + return FAIL; + + return OK; +} + +/* + * Fill current buffer with quickfix errors, replacing any previous contents. + * curbuf must be the quickfix buffer! + * If "old_last" is not NULL append the items after this one. + * When "old_last" is NULL then "buf" must equal "curbuf"! Because + * ml_delete() is used and autocommands will be triggered. + */ + static void +qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) +{ + linenr_T lnum; + qfline_T *qfp; + int old_KeyTyped = KeyTyped; + + if (old_last == NULL) + { + if (buf != curbuf) + { + internal_error("qf_fill_buffer()"); + return; + } + + /* delete all existing lines */ + while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) + (void)ml_delete((linenr_T)1, FALSE); + } + + /* Check if there is anything to display */ + if (qi->qf_curlist < qi->qf_listcount) + { + char_u dirname[MAXPATHL]; + + *dirname = NUL; + + /* Add one line for each error */ + if (old_last == NULL) + { + qfp = qi->qf_lists[qi->qf_curlist].qf_start; + lnum = 0; } else { - if (curwin->w_llist_ref != NULL) - { - /* In a location window */ - win = usable_win_ptr; - if (win == NULL) - { - /* Find the window showing the selected file */ - FOR_ALL_WINDOWS(win) - if (win->w_buffer->b_fnum == qf_ptr->qf_fnum) - break; - if (win == NULL) - { - /* Find a previous usable window */ - win = curwin; - do - { - if (win->w_buffer->b_p_bt[0] == NUL) - break; - if (win->w_prev == NULL) - win = lastwin; /* wrap around the top */ - else - win = win->w_prev; /* go to previous window */ - } while (win != curwin); - } - } - win_goto(win); + qfp = old_last->qf_next; + lnum = buf->b_ml.ml_line_count; + } + while (lnum < qi->qf_lists[qi->qf_curlist].qf_count) + { + if (qf_buf_add_line(buf, lnum, qfp, dirname) == FAIL) + break; - /* If the location list for the window is not set, then set it - * to the location list from the location window */ - if (win->w_llist == NULL) - { - win->w_llist = ll_ref; - ll_ref->qf_refcount++; - } - } - else - { + ++lnum; + qfp = qfp->qf_next; + if (qfp == NULL) + break; + } - /* - * Try to find a window that shows the right buffer. - * Default to the window just above the quickfix buffer. - */ - win = curwin; - altwin = NULL; - for (;;) - { - if (win->w_buffer->b_fnum == qf_ptr->qf_fnum) - break; - if (win->w_prev == NULL) - win = lastwin; /* wrap around the top */ - else - win = win->w_prev; /* go to previous window */ + if (old_last == NULL) + /* Delete the empty line which is now at the end */ + (void)ml_delete(lnum + 1, FALSE); + } - if (IS_QF_WINDOW(win)) - { - /* Didn't find it, go to the window before the quickfix - * window. */ - if (altwin != NULL) - win = altwin; - else if (curwin->w_prev != NULL) - win = curwin->w_prev; - else - win = curwin->w_next; - break; - } + /* correct cursor position */ + check_lnums(TRUE); + + if (old_last == NULL) + { + /* Set the 'filetype' to "qf" each time after filling the buffer. + * This resembles reading a file into a buffer, it's more logical when + * using autocommands. */ + ++curbuf_lock; + set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); + curbuf->b_p_ma = FALSE; + + keep_filetype = TRUE; /* don't detect 'filetype' */ + apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, + FALSE, curbuf); + apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, + FALSE, curbuf); + keep_filetype = FALSE; + --curbuf_lock; + + /* make sure it will be redrawn */ + redraw_curbuf_later(NOT_VALID); + } + + /* Restore KeyTyped, setting 'filetype' may reset it. */ + KeyTyped = old_KeyTyped; +} + +/* + * For every change made to the quickfix list, update the changed tick. + */ + static void +qf_list_changed(qf_info_T *qi, int qf_idx) +{ + qi->qf_lists[qf_idx].qf_changedtick++; +} + +/* + * Return TRUE when using ":vimgrep" for ":grep". + */ + int +grep_internal(cmdidx_T cmdidx) +{ + return ((cmdidx == CMD_grep + || cmdidx == CMD_lgrep + || cmdidx == CMD_grepadd + || cmdidx == CMD_lgrepadd) + && STRCMP("internal", + *curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0); +} + +/* + * Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd" + */ + void +ex_make(exarg_T *eap) +{ + char_u *fname; + char_u *cmd; + char_u *enc = NULL; + unsigned len; + win_T *wp = NULL; + qf_info_T *qi = &ql_info; + int res; + char_u *au_name = NULL; - /* Remember a usable window. */ - if (altwin == NULL && !win->w_p_pvw - && win->w_buffer->b_p_bt[0] == NUL) - altwin = win; - } + /* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */ + if (grep_internal(eap->cmdidx)) + { + ex_vimgrep(eap); + return; + } - win_goto(win); - } - } + switch (eap->cmdidx) + { + case CMD_make: au_name = (char_u *)"make"; break; + case CMD_lmake: au_name = (char_u *)"lmake"; break; + case CMD_grep: au_name = (char_u *)"grep"; break; + case CMD_lgrep: au_name = (char_u *)"lgrep"; break; + case CMD_grepadd: au_name = (char_u *)"grepadd"; break; + case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; + default: break; + } + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) + { +#ifdef FEAT_EVAL + if (aborting()) + return; +#endif } +#ifdef FEAT_MBYTE + enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif + if (eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_lgrep + || eap->cmdidx == CMD_lgrepadd) + wp = curwin; + + autowrite_all(); + fname = get_mef_name(); + if (fname == NULL) + return; + mch_remove(fname); /* in case it's not unique */ + /* - * If there is a file name, - * read the wanted file if needed, and check autowrite etc. + * If 'shellpipe' empty: don't redirect to 'errorfile'. */ - old_curbuf = curbuf; - old_lnum = curwin->w_cursor.lnum; + len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(eap->arg) + 1; + if (*p_sp != NUL) + len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3; + cmd = alloc(len); + if (cmd == NULL) + return; + sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg, + (char *)p_shq); + if (*p_sp != NUL) + append_redir(cmd, len, p_sp, fname); + /* + * Output a newline if there's something else than the :make command that + * was typed (in which case the cursor is in column 0). + */ + if (msg_col == 0) + msg_didout = FALSE; + msg_start(); + MSG_PUTS(":!"); + msg_outtrans(cmd); /* show what we are doing */ - if (qf_ptr->qf_fnum != 0) + /* let the shell know if we are redirecting output or not */ + do_shell(cmd, *p_sp != NUL ? SHELL_DOOUT : 0); + +#ifdef AMIGA + out_flush(); + /* read window status report and redraw before message */ + (void)char_avail(); +#endif + + res = qf_init(wp, fname, (eap->cmdidx != CMD_make + && eap->cmdidx != CMD_lmake) ? p_gefm : p_efm, + (eap->cmdidx != CMD_grepadd + && eap->cmdidx != CMD_lgrepadd), + qf_cmdtitle(*eap->cmdlinep), enc); + if (wp != NULL) + qi = GET_LOC_LIST(wp); + if (res >= 0 && qi != NULL) + qf_list_changed(qi, qi->qf_curlist); + if (au_name != NULL) { - if (qf_ptr->qf_type == 1) - { - /* Open help file (do_ecmd() will set b_help flag, readfile() will - * set b_p_ro flag). */ - if (!can_abandon(curbuf, forceit)) - { - EMSG(_(e_nowrtmsg)); - ok = FALSE; - } - else - ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1, - ECMD_HIDE + ECMD_SET_HELP, - oldwin == curwin ? curwin : NULL); - } + apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, + curbuf->b_fname, TRUE, curbuf); + if (qi != NULL && qi->qf_curlist < qi->qf_listcount) + res = qi->qf_lists[qi->qf_curlist].qf_count; else - ok = buflist_getfile(qf_ptr->qf_fnum, - (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); + res = 0; } + if (res > 0 && !eap->forceit) + qf_jump(qi, 0, 0, FALSE); /* display first error */ - if (ok == OK) - { - /* When not switched to another buffer, still need to set pc mark */ - if (curbuf == old_curbuf) - setpcmark(); - - if (qf_ptr->qf_pattern == NULL) - { - /* - * Go to line with error, unless qf_lnum is 0. - */ - i = qf_ptr->qf_lnum; - if (i > 0) - { - if (i > curbuf->b_ml.ml_line_count) - i = curbuf->b_ml.ml_line_count; - curwin->w_cursor.lnum = i; - } - if (qf_ptr->qf_col > 0) - { - curwin->w_cursor.col = qf_ptr->qf_col - 1; - if (qf_ptr->qf_viscol == TRUE) - { - /* - * Check each character from the beginning of the error - * line up to the error column. For each tab character - * found, reduce the error column value by the length of - * a tab character. - */ - line = ml_get_curline(); - screen_col = 0; - for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) - { - if (*line == NUL) - break; - if (*line++ == '\t') - { - curwin->w_cursor.col -= 7 - (screen_col % 8); - screen_col += 8 - (screen_col % 8); - } - else - ++screen_col; - } - } - check_cursor(); - } - else - beginline(BL_WHITE | BL_FIX); - } - else - { - pos_T save_cursor; - - /* Move the cursor to the first line in the buffer */ - save_cursor = curwin->w_cursor; - curwin->w_cursor.lnum = 0; - if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, - SEARCH_KEEP, NULL)) - curwin->w_cursor = save_cursor; - } + mch_remove(fname); + vim_free(fname); + vim_free(cmd); +} -#ifdef FEAT_FOLDING - if ((fdo_flags & FDO_QUICKFIX) && old_KeyTyped) - foldOpenCursor(); +/* + * Return the name for the errorfile, in allocated memory. + * Find a new unique name when 'makeef' contains "##". + * Returns NULL for error. + */ + static char_u * +get_mef_name(void) +{ + char_u *p; + char_u *name; + static int start = -1; + static int off = 0; +#ifdef HAVE_LSTAT + stat_T sb; #endif - if (print_message) - { - /* Update the screen before showing the message, unless the screen - * scrolled up. */ - if (!msg_scrolled) - update_topline_redraw(); - sprintf((char *)IObuff, _("(%d of %d)%s%s: "), qf_index, - qi->qf_lists[qi->qf_curlist].qf_count, - qf_ptr->qf_cleared ? _(" (line deleted)") : "", - (char *)qf_types(qf_ptr->qf_type, qf_ptr->qf_nr)); - /* Add the message, skipping leading whitespace and newlines. */ - len = (int)STRLEN(IObuff); - qf_fmt_text(skipwhite(qf_ptr->qf_text), IObuff + len, IOSIZE - len); - - /* Output the message. Overwrite to avoid scrolling when the 'O' - * flag is present in 'shortmess'; But when not jumping, print the - * whole message. */ - i = msg_scroll; - if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum) - msg_scroll = TRUE; - else if (!msg_scrolled && shortmess(SHM_OVERALL)) - msg_scroll = FALSE; - msg_attr_keep(IObuff, 0, TRUE); - msg_scroll = i; - } - } - else + + if (*p_mef == NUL) { -#ifdef FEAT_WINDOWS - if (opened_window) - win_close(curwin, TRUE); /* Close opened window */ -#endif - if (qf_ptr->qf_fnum != 0) - { - /* - * Couldn't open file, so put index back where it was. This could - * happen if the file was readonly and we changed something. - */ -#ifdef FEAT_WINDOWS -failed: -#endif - qf_ptr = old_qf_ptr; - qf_index = old_qf_index; - } + name = vim_tempname('e', FALSE); + if (name == NULL) + EMSG(_(e_notmp)); + return name; } -theend: - qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr; - qi->qf_lists[qi->qf_curlist].qf_index = qf_index; -#ifdef FEAT_WINDOWS - if (p_swb != old_swb && opened_window) + + for (p = p_mef; *p; ++p) + if (p[0] == '#' && p[1] == '#') + break; + + if (*p == NUL) + return vim_strsave(p_mef); + + /* Keep trying until the name doesn't exist yet. */ + for (;;) { - /* Restore old 'switchbuf' value, but not when an autocommand or - * modeline has changed the value. */ - if (p_swb == empty_option) - { - p_swb = old_swb; - swb_flags = old_swb_flags; - } + if (start == -1) + start = mch_get_pid(); else - free_string_option(old_swb); - } + off += 19; + + name = alloc((unsigned)STRLEN(p_mef) + 30); + if (name == NULL) + break; + STRCPY(name, p_mef); + sprintf((char *)name + (p - p_mef), "%d%d", start, off); + STRCAT(name, p + 2); + if (mch_getperm(name) < 0 +#ifdef HAVE_LSTAT + /* Don't accept a symbolic link, it's a security risk. */ + && mch_lstat((char *)name, &sb) < 0 #endif + ) + break; + vim_free(name); + } + return name; } /* - * ":clist": list all errors - * ":llist": list all locations + * Returns the number of valid entries in the current quickfix/location list. */ - void -qf_list(eap) - exarg_T *eap; + int +qf_get_size(exarg_T *eap) { - buf_T *buf; - char_u *fname; - qfline_T *qfp; - int i; - int idx1 = 1; - int idx2 = -1; - char_u *arg = eap->arg; - int all = eap->forceit; /* if not :cl!, only show - recognised errors */ qf_info_T *qi = &ql_info; + qfline_T *qfp; + int i, sz = 0; + int prev_fnum = 0; - if (eap->cmdidx == CMD_llist) + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { + /* Location list */ qi = GET_LOC_LIST(curwin); if (qi == NULL) - { - EMSG(_(e_loclist)); - return; - } - } - - if (qi->qf_curlist >= qi->qf_listcount - || qi->qf_lists[qi->qf_curlist].qf_count == 0) - { - EMSG(_(e_quickfix)); - return; - } - if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) - { - EMSG(_(e_trailing)); - return; + return 0; } - i = qi->qf_lists[qi->qf_curlist].qf_count; - if (idx1 < 0) - idx1 = (-idx1 > i) ? 0 : idx1 + i + 1; - if (idx2 < 0) - idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; - if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) - all = TRUE; - qfp = qi->qf_lists[qi->qf_curlist].qf_start; - for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) + for (i = 0, qfp = qi->qf_lists[qi->qf_curlist].qf_start; + i < qi->qf_lists[qi->qf_curlist].qf_count && qfp != NULL; + ++i, qfp = qfp->qf_next) { - if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) + if (qfp->qf_valid) { - msg_putchar('\n'); - if (got_int) - break; - - fname = NULL; - if (qfp->qf_fnum != 0 - && (buf = buflist_findnr(qfp->qf_fnum)) != NULL) - { - fname = buf->b_fname; - if (qfp->qf_type == 1) /* :helpgrep */ - fname = gettail(fname); - } - if (fname == NULL) - sprintf((char *)IObuff, "%2d", i); - else - vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", - i, (char *)fname); - msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index - ? hl_attr(HLF_L) : hl_attr(HLF_D)); - if (qfp->qf_lnum == 0) - IObuff[0] = NUL; - else if (qfp->qf_col == 0) - sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); - else - sprintf((char *)IObuff, ":%ld col %d", - qfp->qf_lnum, qfp->qf_col); - sprintf((char *)IObuff + STRLEN(IObuff), "%s:", - (char *)qf_types(qfp->qf_type, qfp->qf_nr)); - msg_puts_attr(IObuff, hl_attr(HLF_N)); - if (qfp->qf_pattern != NULL) + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo) + sz++; /* Count all valid entries */ + else if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) { - qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); - STRCAT(IObuff, ":"); - msg_puts(IObuff); + /* Count the number of files */ + sz++; + prev_fnum = qfp->qf_fnum; } - msg_puts((char_u *)" "); - - /* Remove newlines and leading whitespace from the text. For an - * unrecognized line keep the indent, the compiler may mark a word - * with ^^^^. */ - qf_fmt_text((fname != NULL || qfp->qf_lnum != 0) - ? skipwhite(qfp->qf_text) : qfp->qf_text, - IObuff, IOSIZE); - msg_prt_line(IObuff, FALSE); - out_flush(); /* show one line at a time */ } - - qfp = qfp->qf_next; - ++i; - ui_breakcheck(); } + + return sz; } /* - * Remove newlines and leading whitespace from an error message. - * Put the result in "buf[bufsize]". + * Returns the current index of the quickfix/location list. + * Returns 0 if there is an error. */ - static void -qf_fmt_text(text, buf, bufsize) - char_u *text; - char_u *buf; - int bufsize; + int +qf_get_cur_idx(exarg_T *eap) { - int i; - char_u *p = text; + qf_info_T *qi = &ql_info; - for (i = 0; *p != NUL && i < bufsize - 1; ++i) + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { - if (*p == '\n') - { - buf[i] = ' '; - while (*++p != NUL) - if (!vim_iswhite(*p) && *p != '\n') - break; - } - else - buf[i] = *p++; + /* Location list */ + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + return 0; } - buf[i] = NUL; + + return qi->qf_lists[qi->qf_curlist].qf_index; } /* - * ":colder [count]": Up in the quickfix stack. - * ":cnewer [count]": Down in the quickfix stack. - * ":lolder [count]": Up in the location list stack. - * ":lnewer [count]": Down in the location list stack. + * Returns the current index in the quickfix/location list (counting only valid + * entries). If no valid entries are in the list, then returns 1. */ - void -qf_age(eap) - exarg_T *eap; + int +qf_get_cur_valid_idx(exarg_T *eap) { qf_info_T *qi = &ql_info; - int count; + qf_list_T *qfl; + qfline_T *qfp; + int i, eidx = 0; + int prev_fnum = 0; - if (eap->cmdidx == CMD_lolder || eap->cmdidx == CMD_lnewer) + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { + /* Location list */ qi = GET_LOC_LIST(curwin); if (qi == NULL) - { - EMSG(_(e_loclist)); - return; - } + return 1; } - if (eap->addr_count != 0) - count = eap->line2; - else - count = 1; - while (count--) + qfl = &qi->qf_lists[qi->qf_curlist]; + qfp = qfl->qf_start; + + /* check if the list has valid errors */ + if (qfl->qf_count <= 0 || qfl->qf_nonevalid) + return 1; + + for (i = 1; i <= qfl->qf_index && qfp!= NULL; i++, qfp = qfp->qf_next) { - if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) - { - if (qi->qf_curlist == 0) - { - EMSG(_("E380: At bottom of quickfix stack")); - break; - } - --qi->qf_curlist; - } - else + if (qfp->qf_valid) { - if (qi->qf_curlist >= qi->qf_listcount - 1) + if (eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { - EMSG(_("E381: At top of quickfix stack")); - break; + if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) + { + /* Count the number of files */ + eidx++; + prev_fnum = qfp->qf_fnum; + } } - ++qi->qf_curlist; + else + eidx++; } } - qf_msg(qi); -} - static void -qf_msg(qi) - qf_info_T *qi; -{ - smsg((char_u *)_("error list %d of %d; %d errors"), - qi->qf_curlist + 1, qi->qf_listcount, - qi->qf_lists[qi->qf_curlist].qf_count); -#ifdef FEAT_WINDOWS - qf_update_buffer(qi); -#endif + return eidx ? eidx : 1; } /* - * Free error list "idx". + * Get the 'n'th valid error entry in the quickfix or location list. + * Used by :cdo, :ldo, :cfdo and :lfdo commands. + * For :cdo and :ldo returns the 'n'th valid error entry. + * For :cfdo and :lfdo returns the 'n'th valid file entry. */ - static void -qf_free(qi, idx) - qf_info_T *qi; - int idx; + static int +qf_get_nth_valid_entry(qf_info_T *qi, int n, int fdo) { - qfline_T *qfp; - int stop = FALSE; + qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist]; + qfline_T *qfp = qfl->qf_start; + int i, eidx; + int prev_fnum = 0; - while (qi->qf_lists[idx].qf_count) + /* check if the list has valid errors */ + if (qfl->qf_count <= 0 || qfl->qf_nonevalid) + return 1; + + for (i = 1, eidx = 0; i <= qfl->qf_count && qfp != NULL; + i++, qfp = qfp->qf_next) { - qfp = qi->qf_lists[idx].qf_start->qf_next; - if (qi->qf_lists[idx].qf_title != NULL && !stop) + if (qfp->qf_valid) { - vim_free(qi->qf_lists[idx].qf_start->qf_text); - stop = (qi->qf_lists[idx].qf_start == qfp); - vim_free(qi->qf_lists[idx].qf_start->qf_pattern); - vim_free(qi->qf_lists[idx].qf_start); - if (stop) - /* Somehow qf_count may have an incorrect value, set it to 1 - * to avoid crashing when it's wrong. - * TODO: Avoid qf_count being incorrect. */ - qi->qf_lists[idx].qf_count = 1; + if (fdo) + { + if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) + { + /* Count the number of files */ + eidx++; + prev_fnum = qfp->qf_fnum; + } + } + else + eidx++; } - qi->qf_lists[idx].qf_start = qfp; - --qi->qf_lists[idx].qf_count; + + if (eidx == n) + break; } - vim_free(qi->qf_lists[idx].qf_title); - qi->qf_lists[idx].qf_title = NULL; - qi->qf_lists[idx].qf_index = 0; + + if (i <= qfl->qf_count) + return i; + else + return 1; } /* - * qf_mark_adjust: adjust marks + * ":cc", ":crewind", ":cfirst" and ":clast". + * ":ll", ":lrewind", ":lfirst" and ":llast". + * ":cdo", ":ldo", ":cfdo" and ":lfdo" */ - void -qf_mark_adjust(wp, line1, line2, amount, amount_after) - win_T *wp; - linenr_T line1; - linenr_T line2; - long amount; - long amount_after; + void +ex_cc(exarg_T *eap) { - int i; - qfline_T *qfp; - int idx; qf_info_T *qi = &ql_info; + int errornr; - if (wp != NULL) + if (eap->cmdidx == CMD_ll + || eap->cmdidx == CMD_lrewind + || eap->cmdidx == CMD_lfirst + || eap->cmdidx == CMD_llast + || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_lfdo) { - if (wp->w_llist == NULL) + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); return; - qi = wp->w_llist; + } } - for (idx = 0; idx < qi->qf_listcount; ++idx) - if (qi->qf_lists[idx].qf_count) - for (i = 0, qfp = qi->qf_lists[idx].qf_start; - i < qi->qf_lists[idx].qf_count; ++i, qfp = qfp->qf_next) - if (qfp->qf_fnum == curbuf->b_fnum) - { - if (qfp->qf_lnum >= line1 && qfp->qf_lnum <= line2) - { - if (amount == MAXLNUM) - qfp->qf_cleared = TRUE; - else - qfp->qf_lnum += amount; - } - else if (amount_after && qfp->qf_lnum > line2) - qfp->qf_lnum += amount_after; - } + if (eap->addr_count > 0) + errornr = (int)eap->line2; + else + { + if (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) + errornr = 0; + else if (eap->cmdidx == CMD_crewind || eap->cmdidx == CMD_lrewind + || eap->cmdidx == CMD_cfirst || eap->cmdidx == CMD_lfirst) + errornr = 1; + else + errornr = 32767; + } + + /* For cdo and ldo commands, jump to the nth valid error. + * For cfdo and lfdo commands, jump to the nth valid file entry. + */ + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) + errornr = qf_get_nth_valid_entry(qi, + eap->addr_count > 0 ? (int)eap->line1 : 1, + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo); + + qf_jump(qi, 0, errornr, eap->forceit); } /* - * Make a nice message out of the error character and the error number: - * char number message - * e or E 0 " error" - * w or W 0 " warning" - * i or I 0 " info" - * 0 0 "" - * other 0 " c" - * e or E n " error n" - * w or W n " warning n" - * i or I n " info n" - * 0 n " error n" - * other n " c n" - * 1 x "" :helpgrep + * ":cnext", ":cnfile", ":cNext" and ":cprevious". + * ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". + * Also, used by ":cdo", ":ldo", ":cfdo" and ":lfdo" commands. */ - static char_u * -qf_types(c, nr) - int c, nr; + void +ex_cnext(exarg_T *eap) { - static char_u buf[20]; - static char_u cc[3]; - char_u *p; + qf_info_T *qi = &ql_info; + int errornr; - if (c == 'W' || c == 'w') - p = (char_u *)" warning"; - else if (c == 'I' || c == 'i') - p = (char_u *)" info"; - else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) - p = (char_u *)" error"; - else if (c == 0 || c == 1) - p = (char_u *)""; - else + if (eap->cmdidx == CMD_lnext + || eap->cmdidx == CMD_lNext + || eap->cmdidx == CMD_lprevious + || eap->cmdidx == CMD_lnfile + || eap->cmdidx == CMD_lNfile + || eap->cmdidx == CMD_lpfile + || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_lfdo) { - cc[0] = ' '; - cc[1] = c; - cc[2] = NUL; - p = cc; + qi = GET_LOC_LIST(curwin); + if (qi == NULL) + { + EMSG(_(e_loclist)); + return; + } } - if (nr <= 0) - return p; + if (eap->addr_count > 0 + && (eap->cmdidx != CMD_cdo && eap->cmdidx != CMD_ldo + && eap->cmdidx != CMD_cfdo && eap->cmdidx != CMD_lfdo)) + errornr = (int)eap->line2; + else + errornr = 1; - sprintf((char *)buf, "%s %3d", (char *)p, nr); - return buf; + qf_jump(qi, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext + || eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo) + ? FORWARD + : (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile + || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) + ? FORWARD_FILE + : (eap->cmdidx == CMD_cpfile || eap->cmdidx == CMD_lpfile + || eap->cmdidx == CMD_cNfile || eap->cmdidx == CMD_lNfile) + ? BACKWARD_FILE + : BACKWARD, + errornr, eap->forceit); } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* - * ":cwindow": open the quickfix window if we have errors to display, - * close it if not. - * ":lwindow": open the location list window if we have locations to display, - * close it if not. + * ":cfile"/":cgetfile"/":caddfile" commands. + * ":lfile"/":lgetfile"/":laddfile" commands. */ void -ex_cwindow(eap) - exarg_T *eap; +ex_cfile(exarg_T *eap) { + char_u *enc = NULL; + win_T *wp = NULL; qf_info_T *qi = &ql_info; - win_T *win; + char_u *au_name = NULL; + int save_qfid = 0; /* init for gcc */ + int res; - if (eap->cmdidx == CMD_lwindow) + switch (eap->cmdidx) { - qi = GET_LOC_LIST(curwin); - if (qi == NULL) + case CMD_cfile: au_name = (char_u *)"cfile"; break; + case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break; + case CMD_caddfile: au_name = (char_u *)"caddfile"; break; + case CMD_lfile: au_name = (char_u *)"lfile"; break; + case CMD_lgetfile: au_name = (char_u *)"lgetfile"; break; + case CMD_laddfile: au_name = (char_u *)"laddfile"; break; + default: break; + } + if (au_name != NULL) + apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf); +#ifdef FEAT_MBYTE + enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; +#endif +#ifdef FEAT_BROWSE + if (cmdmod.browse) + { + char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg, + NULL, NULL, + (char_u *)_(BROWSE_FILTER_ALL_FILES), NULL); + if (browse_file == NULL) return; + set_string_option_direct((char_u *)"ef", -1, browse_file, OPT_FREE, 0); + vim_free(browse_file); } + else +#endif + if (*eap->arg != NUL) + set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); - /* Look for an existing quickfix window. */ - win = qf_find_win(qi); + if (eap->cmdidx == CMD_lfile + || eap->cmdidx == CMD_lgetfile + || eap->cmdidx == CMD_laddfile) + wp = curwin; /* - * If a quickfix window is open but we have no errors to display, - * close the window. If a quickfix window is not open, then open - * it if we have errors; otherwise, leave it closed. + * This function is used by the :cfile, :cgetfile and :caddfile + * commands. + * :cfile always creates a new quickfix list and jumps to the + * first error. + * :cgetfile creates a new quickfix list but doesn't jump to the + * first error. + * :caddfile adds to an existing quickfix list. If there is no + * quickfix list then a new list is created. */ - if (qi->qf_lists[qi->qf_curlist].qf_nonevalid - || qi->qf_lists[qi->qf_curlist].qf_count == 0 - || qi->qf_curlist >= qi->qf_listcount) - { - if (win != NULL) - ex_cclose(eap); - } - else if (win == NULL) - ex_copen(eap); + res = qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile + && eap->cmdidx != CMD_laddfile), + qf_cmdtitle(*eap->cmdlinep), enc); + if (wp != NULL) + qi = GET_LOC_LIST(wp); + if (res >= 0 && qi != NULL) + qf_list_changed(qi, qi->qf_curlist); + if (qi != NULL) + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; + if (au_name != NULL) + apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); + + /* An autocmd might have freed the quickfix/location list. Check whether it + * is still valid. */ + if (qi != NULL && !qflist_valid(wp, save_qfid)) + return; + if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) + qf_jump(qi, 0, 0, eap->forceit); /* display first error */ } /* - * ":cclose": close the window showing the list of errors. - * ":lclose": close the window showing the location list + * Return the quickfix/location list number with the given identifier. + * Returns -1 if list is not found. */ - void -ex_cclose(eap) - exarg_T *eap; + static int +qf_id2nr(qf_info_T *qi, int_u qfid) { - win_T *win = NULL; - qf_info_T *qi = &ql_info; + int qf_idx; - if (eap->cmdidx == CMD_lclose || eap->cmdidx == CMD_lwindow) + for (qf_idx = 0; qf_idx < qi->qf_listcount; qf_idx++) + if (qi->qf_lists[qf_idx].qf_id == qfid) + return qf_idx; + return INVALID_QFIDX; +} + +/* + * Return the vimgrep autocmd name. + */ + static char_u * +vgr_get_auname(cmdidx_T cmdidx) +{ + switch (cmdidx) { - qi = GET_LOC_LIST(curwin); - if (qi == NULL) - return; + case CMD_vimgrep: return (char_u *)"vimgrep"; + case CMD_lvimgrep: return (char_u *)"lvimgrep"; + case CMD_vimgrepadd: return (char_u *)"vimgrepadd"; + case CMD_lvimgrepadd: return (char_u *)"lvimgrepadd"; + case CMD_grep: return (char_u *)"grep"; + case CMD_lgrep: return (char_u *)"lgrep"; + case CMD_grepadd: return (char_u *)"grepadd"; + case CMD_lgrepadd: return (char_u *)"lgrepadd"; + default: return NULL; } - - /* Find existing quickfix window and close it. */ - win = qf_find_win(qi); - if (win != NULL) - win_close(win, FALSE); } /* - * ":copen": open a window that shows the list of errors. - * ":lopen": open a window that shows the location list. + * Initialize the regmatch used by vimgrep for pattern "s". */ - void -ex_copen(eap) - exarg_T *eap; + static void +vgr_init_regmatch(regmmatch_T *regmatch, char_u *s) { - qf_info_T *qi = &ql_info; - int height; - win_T *win; - tabpage_T *prevtab = curtab; - buf_T *qf_buf; - win_T *oldwin = curwin; + /* Get the search pattern: either white-separated or enclosed in // */ + regmatch->regprog = NULL; - if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) + if (s == NULL || *s == NUL) { - qi = GET_LOC_LIST(curwin); - if (qi == NULL) + /* Pattern is empty, use last search pattern. */ + if (last_search_pat() == NULL) { - EMSG(_(e_loclist)); + EMSG(_(e_noprevre)); return; } + regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC); } - - if (eap->addr_count != 0) - height = eap->line2; else - height = QF_WINHEIGHT; + regmatch->regprog = vim_regcomp(s, RE_MAGIC); - reset_VIsual_and_resel(); /* stop Visual mode */ -#ifdef FEAT_GUI - need_mouse_correct = TRUE; -#endif + regmatch->rmm_ic = p_ic; + regmatch->rmm_maxcol = 0; +} - /* - * Find existing quickfix window, or open a new one. - */ - win = qf_find_win(qi); +/* + * Display a file name when vimgrep is running. + */ + static void +vgr_display_fname(char_u *fname) +{ + char_u *p; - if (win != NULL && cmdmod.tab == 0) - { - win_goto(win); - if (eap->addr_count != 0) - { -#ifdef FEAT_VERTSPLIT - if (cmdmod.split & WSP_VERT) - { - if (height != W_WIDTH(win)) - win_setwidth(height); - } - else -#endif - if (height != win->w_height) - win_setheight(height); - } - } + msg_start(); + p = msg_strtrunc(fname, TRUE); + if (p == NULL) + msg_outtrans(fname); else { - qf_buf = qf_find_buf(qi); - - /* The current window becomes the previous window afterwards. */ - win = curwin; - - if ((eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow) - && cmdmod.split == 0) - /* Create the new window at the very bottom, except when - * :belowright or :aboveleft is used. */ - win_goto(lastwin); - if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL) - return; /* not enough room for window */ - RESET_BINDING(curwin); - - if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) - { - /* - * For the location list window, create a reference to the - * location list from the window 'win'. - */ - curwin->w_llist_ref = win->w_llist; - win->w_llist->qf_refcount++; - } + msg_outtrans(p); + vim_free(p); + } + msg_clr_eos(); + msg_didout = FALSE; /* overwrite this message */ + msg_nowait = TRUE; /* don't wait for this message */ + msg_col = 0; + out_flush(); +} - if (oldwin != curwin) - oldwin = NULL; /* don't store info when in another window */ - if (qf_buf != NULL) - /* Use the existing quickfix buffer */ - (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE, - ECMD_HIDE + ECMD_OLDBUF, oldwin); - else - { - /* Create a new quickfix buffer */ - (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin); - /* switch off 'swapfile' */ - set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); - set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", - OPT_LOCAL); - set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL); - RESET_BINDING(curwin); -#ifdef FEAT_DIFF - curwin->w_p_diff = FALSE; -#endif -#ifdef FEAT_FOLDING - set_option_value((char_u *)"fdm", 0L, (char_u *)"manual", - OPT_LOCAL); +/* + * Load a dummy buffer to search for a pattern using vimgrep. + */ + static buf_T * +vgr_load_dummy_buf( + char_u *fname, + char_u *dirname_start, + char_u *dirname_now) +{ + int save_mls; +#if defined(FEAT_SYN_HL) + char_u *save_ei = NULL; #endif - } + buf_T *buf; - /* Only set the height when still in the same tab page and there is no - * window to the side. */ - if (curtab == prevtab -#ifdef FEAT_VERTSPLIT - && curwin->w_width == Columns +#if defined(FEAT_SYN_HL) + /* Don't do Filetype autocommands to avoid loading syntax and + * indent scripts, a great speed improvement. */ + save_ei = au_event_disable(",Filetype"); #endif - ) - win_setheight(height); - curwin->w_p_wfh = TRUE; /* set 'winfixheight' */ - if (win_valid(win)) - prevwin = win; - } + /* Don't use modelines here, it's useless. */ + save_mls = p_mls; + p_mls = 0; - /* - * Fill the buffer with the quickfix list. - */ - qf_fill_buffer(qi); + /* Load file into a buffer, so that 'fileencoding' is detected, + * autocommands applied, etc. */ + buf = load_dummy_buffer(fname, dirname_start, dirname_now); - if (qi->qf_lists[qi->qf_curlist].qf_title != NULL) - qf_set_title_var(qi); + p_mls = save_mls; +#if defined(FEAT_SYN_HL) + au_event_restore(save_ei); +#endif - curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index; - curwin->w_cursor.col = 0; - check_cursor(); - update_topline(); /* scroll to show the line */ + return buf; } /* - * Return the number of the current entry (line number in the quickfix - * window). + * Check whether a quickfix/location list valid. Autocmds may remove or change + * a quickfix list when vimgrep is running. If the list is not found, create a + * new list. */ - linenr_T -qf_current_entry(wp) - win_T *wp; + static int +vgr_qflist_valid( + win_T *wp, + qf_info_T *qi, + int_u qfid, + char_u *title) { - qf_info_T *qi = &ql_info; + /* Verify that the quickfix/location list was not freed by an autocmd */ + if (!qflist_valid(wp, qfid)) + { + if (wp != NULL) + { + /* An autocmd has freed the location list. */ + EMSG(_(e_loc_list_changed)); + return FALSE; + } + else + { + /* Quickfix list is not found, create a new one. */ + qf_new_list(qi, title); + return TRUE; + } + } - if (IS_LL_WINDOW(wp)) - /* In the location list window, use the referenced location list */ - qi = wp->w_llist_ref; + if (qi->qf_lists[qi->qf_curlist].qf_id != qfid) + /* Autocommands changed the quickfix list. Find the one we were + * using and restore it. */ + qi->qf_curlist = qf_id2nr(qi, qfid); - return qi->qf_lists[qi->qf_curlist].qf_index; + return TRUE; } /* - * Update the cursor position in the quickfix window to the current error. - * Return TRUE if there is a quickfix window. + * Search for a pattern in all the lines in a buffer and add the matching lines + * to a quickfix list. */ static int -qf_win_pos_update(qi, old_qf_index) - qf_info_T *qi; - int old_qf_index; /* previous qf_index or zero */ +vgr_match_buflines( + qf_info_T *qi, + char_u *fname, + buf_T *buf, + regmmatch_T *regmatch, + long tomatch, + int duplicate_name, + int flags) { - win_T *win; - int qf_index = qi->qf_lists[qi->qf_curlist].qf_index; + int found_match = FALSE; + long lnum; + colnr_T col; - /* - * Put the cursor on the current error in the quickfix window, so that - * it's viewable. - */ - win = qf_find_win(qi); - if (win != NULL - && qf_index <= win->w_buffer->b_ml.ml_line_count - && old_qf_index != qf_index) + for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; ++lnum) { - win_T *old_curwin = curwin; - - curwin = win; - curbuf = win->w_buffer; - if (qf_index > old_qf_index) - { - curwin->w_redraw_top = old_qf_index; - curwin->w_redraw_bot = qf_index; - } - else + col = 0; + while (vim_regexec_multi(regmatch, curwin, buf, lnum, + col, NULL, NULL) > 0) { - curwin->w_redraw_top = qf_index; - curwin->w_redraw_bot = old_qf_index; + /* Pass the buffer number so that it gets used even for a + * dummy buffer, unless duplicate_name is set, then the + * buffer will be wiped out below. */ + if (qf_add_entry(qi, + qi->qf_curlist, + NULL, /* dir */ + fname, + NULL, + duplicate_name ? 0 : buf->b_fnum, + ml_get_buf(buf, + regmatch->startpos[0].lnum + lnum, FALSE), + regmatch->startpos[0].lnum + lnum, + regmatch->startpos[0].col + 1, + FALSE, /* vis_col */ + NULL, /* search pattern */ + 0, /* nr */ + 0, /* type */ + TRUE /* valid */ + ) == FAIL) + { + got_int = TRUE; + break; + } + found_match = TRUE; + if (--tomatch == 0) + break; + if ((flags & VGR_GLOBAL) == 0 + || regmatch->endpos[0].lnum > 0) + break; + col = regmatch->endpos[0].col + + (col == regmatch->endpos[0].col); + if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) + break; } - curwin->w_cursor.lnum = qf_index; - curwin->w_cursor.col = 0; - update_topline(); /* scroll to show the line */ - redraw_later(VALID); - curwin->w_redr_status = TRUE; /* update ruler */ - curwin = old_curwin; - curbuf = curwin->w_buffer; + line_breakcheck(); + if (got_int) + break; } - return win != NULL; + + return found_match; } /* - * Check whether the given window is displaying the specified quickfix/location - * list buffer + * Jump to the first match and update the directory. */ - static int -is_qf_win(win, qi) - win_T *win; - qf_info_T *qi; + static void +vgr_jump_to_match( + qf_info_T *qi, + int forceit, + int *redraw_for_dummy, + buf_T *first_match_buf, + char_u *target_dir) { - /* - * A window displaying the quickfix buffer will have the w_llist_ref field - * set to NULL. - * A window displaying a location list buffer will have the w_llist_ref - * pointing to the location list. - */ - if (bt_quickfix(win->w_buffer)) - if ((qi == &ql_info && win->w_llist_ref == NULL) - || (qi != &ql_info && win->w_llist_ref == qi)) - return TRUE; + buf_T *buf; - return FALSE; + buf = curbuf; + qf_jump(qi, 0, 0, forceit); + if (buf != curbuf) + /* If we jumped to another buffer redrawing will already be + * taken care of. */ + *redraw_for_dummy = FALSE; + + /* Jump to the directory used after loading the buffer. */ + if (curbuf == first_match_buf && target_dir != NULL) + { + exarg_T ea; + + ea.arg = target_dir; + ea.cmdidx = CMD_lcd; + ex_cd(&ea); + } } /* - * Find a window displaying the quickfix/location list 'qi' - * Searches in only the windows opened in the current tab. + * ":vimgrep {pattern} file(s)" + * ":vimgrepadd {pattern} file(s)" + * ":lvimgrep {pattern} file(s)" + * ":lvimgrepadd {pattern} file(s)" */ - static win_T * -qf_find_win(qi) - qf_info_T *qi; + void +ex_vimgrep(exarg_T *eap) { - win_T *win; + regmmatch_T regmatch; + int fcount; + char_u **fnames; + char_u *fname; + char_u *title; + char_u *s; + char_u *p; + int fi; + qf_info_T *qi = &ql_info; + int_u save_qfid; + win_T *wp = NULL; + buf_T *buf; + int duplicate_name = FALSE; + int using_dummy; + int redraw_for_dummy = FALSE; + int found_match; + buf_T *first_match_buf = NULL; + time_t seconds = 0; + aco_save_T aco; + int flags = 0; + long tomatch; + char_u *dirname_start = NULL; + char_u *dirname_now = NULL; + char_u *target_dir = NULL; + char_u *au_name = NULL; + + au_name = vgr_get_auname(eap->cmdidx); + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) + { +#ifdef FEAT_EVAL + if (aborting()) + return; +#endif + } + + if (eap->cmdidx == CMD_lgrep + || eap->cmdidx == CMD_lvimgrep + || eap->cmdidx == CMD_lgrepadd + || eap->cmdidx == CMD_lvimgrepadd) + { + qi = ll_get_or_alloc_list(curwin); + if (qi == NULL) + return; + wp = curwin; + } - FOR_ALL_WINDOWS(win) - if (is_qf_win(win, qi)) - break; + if (eap->addr_count > 0) + tomatch = eap->line2; + else + tomatch = MAXLNUM; - return win; -} + /* Get the search pattern: either white-separated or enclosed in // */ + regmatch.regprog = NULL; + title = vim_strsave(qf_cmdtitle(*eap->cmdlinep)); + p = skip_vimgrep_pat(eap->arg, &s, &flags); + if (p == NULL) + { + EMSG(_(e_invalpat)); + goto theend; + } -/* - * Find a quickfix buffer. - * Searches in windows opened in all the tabs. - */ - static buf_T * -qf_find_buf(qi) - qf_info_T *qi; -{ - tabpage_T *tp; - win_T *win; + vgr_init_regmatch(®match, s); + if (regmatch.regprog == NULL) + goto theend; - FOR_ALL_TAB_WINDOWS(tp, win) - if (is_qf_win(win, qi)) - return win->w_buffer; + p = skipwhite(p); + if (*p == NUL) + { + EMSG(_("E683: File name missing or invalid pattern")); + goto theend; + } - return NULL; -} + if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd + && eap->cmdidx != CMD_vimgrepadd + && eap->cmdidx != CMD_lvimgrepadd) + || qi->qf_curlist == qi->qf_listcount) + /* make place for a new list */ + qf_new_list(qi, title != NULL ? title : qf_cmdtitle(*eap->cmdlinep)); -/* - * Find the quickfix buffer. If it exists, update the contents. - */ - static void -qf_update_buffer(qi) - qf_info_T *qi; -{ - buf_T *buf; - win_T *win; - win_T *curwin_save; - aco_save_T aco; + /* parse the list of arguments */ + if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL) + goto theend; + if (fcount == 0) + { + EMSG(_(e_nomatch)); + goto theend; + } - /* Check if a buffer for the quickfix list exists. Update it. */ - buf = qf_find_buf(qi); - if (buf != NULL) + dirname_start = alloc_id(MAXPATHL, aid_qf_dirname_start); + dirname_now = alloc_id(MAXPATHL, aid_qf_dirname_now); + if (dirname_start == NULL || dirname_now == NULL) { - /* set curwin/curbuf to buf and save a few things */ - aucmd_prepbuf(&aco, buf); + FreeWild(fcount, fnames); + goto theend; + } - qf_fill_buffer(qi); + /* Remember the current directory, because a BufRead autocommand that does + * ":lcd %:p:h" changes the meaning of short path names. */ + mch_dirname(dirname_start, MAXPATHL); - if (qi->qf_lists[qi->qf_curlist].qf_title != NULL - && (win = qf_find_win(qi)) != NULL) - { - curwin_save = curwin; - curwin = win; - qf_set_title_var(qi); - curwin = curwin_save; + /* Remember the current quickfix list identifier, so that we can check for + * autocommands changing the current quickfix list. */ + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; + seconds = (time_t)0; + for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) + { + fname = shorten_fname1(fnames[fi]); + if (time(NULL) > seconds) + { + /* Display the file name every second or so, show the user we are + * working on it. */ + seconds = time(NULL); + vgr_display_fname(fname); } - /* restore curwin/curbuf and a few other things */ - aucmd_restbuf(&aco); - - (void)qf_win_pos_update(qi, 0); - } -} - - static void -qf_set_title_var(qi) - qf_info_T *qi; -{ - set_internal_string_var((char_u *)"w:quickfix_title", - qi->qf_lists[qi->qf_curlist].qf_title); -} + buf = buflist_findname_exp(fnames[fi]); + if (buf == NULL || buf->b_ml.ml_mfp == NULL) + { + /* Remember that a buffer with this name already exists. */ + duplicate_name = (buf != NULL); + using_dummy = TRUE; + redraw_for_dummy = TRUE; -/* - * Fill current buffer with quickfix errors, replacing any previous contents. - * curbuf must be the quickfix buffer! - */ - static void -qf_fill_buffer(qi) - qf_info_T *qi; -{ - linenr_T lnum; - qfline_T *qfp; - buf_T *errbuf; - int len; - int old_KeyTyped = KeyTyped; + buf = vgr_load_dummy_buf(fname, dirname_start, dirname_now); + } + else + /* Use existing, loaded buffer. */ + using_dummy = FALSE; - /* delete all existing lines */ - while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) - (void)ml_delete((linenr_T)1, FALSE); + /* Check whether the quickfix list is still valid. When loading a + * buffer above, autocommands might have changed the quickfix list. */ + if (!vgr_qflist_valid(wp, qi, save_qfid, qf_cmdtitle(*eap->cmdlinep))) + { + FreeWild(fcount, fnames); + goto theend; + } + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; - /* Check if there is anything to display */ - if (qi->qf_curlist < qi->qf_listcount) - { - /* Add one line for each error */ - qfp = qi->qf_lists[qi->qf_curlist].qf_start; - for (lnum = 0; lnum < qi->qf_lists[qi->qf_curlist].qf_count; ++lnum) + if (buf == NULL) { - if (qfp->qf_fnum != 0 - && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL - && errbuf->b_fname != NULL) - { - if (qfp->qf_type == 1) /* :helpgrep */ - STRCPY(IObuff, gettail(errbuf->b_fname)); - else - STRCPY(IObuff, errbuf->b_fname); - len = (int)STRLEN(IObuff); - } - else - len = 0; - IObuff[len++] = '|'; + if (!got_int) + smsg((char_u *)_("Cannot open file \"%s\""), fname); + } + else + { + /* Try for a match in all lines of the buffer. + * For ":1vimgrep" look for first match only. */ + found_match = vgr_match_buflines(qi, fname, buf, ®match, + tomatch, duplicate_name, flags); - if (qfp->qf_lnum > 0) + if (using_dummy) { - sprintf((char *)IObuff + len, "%ld", qfp->qf_lnum); - len += (int)STRLEN(IObuff + len); - - if (qfp->qf_col > 0) + if (found_match && first_match_buf == NULL) + first_match_buf = buf; + if (duplicate_name) + { + /* Never keep a dummy buffer if there is another buffer + * with the same name. */ + wipe_dummy_buffer(buf, dirname_start); + buf = NULL; + } + else if (!cmdmod.hide + || buf->b_p_bh[0] == 'u' /* "unload" */ + || buf->b_p_bh[0] == 'w' /* "wipe" */ + || buf->b_p_bh[0] == 'd') /* "delete" */ { - sprintf((char *)IObuff + len, " col %d", qfp->qf_col); - len += (int)STRLEN(IObuff + len); + /* When no match was found we don't need to remember the + * buffer, wipe it out. If there was a match and it + * wasn't the first one or we won't jump there: only + * unload the buffer. + * Ignore 'hidden' here, because it may lead to having too + * many swap files. */ + if (!found_match) + { + wipe_dummy_buffer(buf, dirname_start); + buf = NULL; + } + else if (buf != first_match_buf || (flags & VGR_NOJUMP)) + { + unload_dummy_buffer(buf, dirname_start); + /* Keeping the buffer, remove the dummy flag. */ + buf->b_flags &= ~BF_DUMMY; + buf = NULL; + } } - sprintf((char *)IObuff + len, "%s", - (char *)qf_types(qfp->qf_type, qfp->qf_nr)); - len += (int)STRLEN(IObuff + len); - } - else if (qfp->qf_pattern != NULL) - { - qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); - len += (int)STRLEN(IObuff + len); - } - IObuff[len++] = '|'; - IObuff[len++] = ' '; + if (buf != NULL) + { + /* Keeping the buffer, remove the dummy flag. */ + buf->b_flags &= ~BF_DUMMY; - /* Remove newlines and leading whitespace from the text. - * For an unrecognized line keep the indent, the compiler may - * mark a word with ^^^^. */ - qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text, - IObuff + len, IOSIZE - len); + /* If the buffer is still loaded we need to use the + * directory we jumped to below. */ + if (buf == first_match_buf + && target_dir == NULL + && STRCMP(dirname_start, dirname_now) != 0) + target_dir = vim_strsave(dirname_now); - if (ml_append(lnum, IObuff, (colnr_T)STRLEN(IObuff) + 1, FALSE) - == FAIL) - break; - qfp = qfp->qf_next; + /* The buffer is still loaded, the Filetype autocommands + * need to be done now, in that buffer. And the modelines + * need to be done (again). But not the window-local + * options! */ + aucmd_prepbuf(&aco, buf); +#if defined(FEAT_SYN_HL) + apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, + buf->b_fname, TRUE, buf); +#endif + do_modelines(OPT_NOWIN); + aucmd_restbuf(&aco); + } + } } - /* Delete the empty line which is now at the end */ - (void)ml_delete(lnum + 1, FALSE); } - /* correct cursor position */ - check_lnums(TRUE); - - /* Set the 'filetype' to "qf" each time after filling the buffer. This - * resembles reading a file into a buffer, it's more logical when using - * autocommands. */ - set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); - curbuf->b_p_ma = FALSE; - -#ifdef FEAT_AUTOCMD - keep_filetype = TRUE; /* don't detect 'filetype' */ - apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, - FALSE, curbuf); - apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, - FALSE, curbuf); - keep_filetype = FALSE; -#endif - - /* make sure it will be redrawn */ - redraw_curbuf_later(NOT_VALID); - - /* Restore KeyTyped, setting 'filetype' may reset it. */ - KeyTyped = old_KeyTyped; -} + FreeWild(fcount, fnames); -#endif /* FEAT_WINDOWS */ + qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; + qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; + qi->qf_lists[qi->qf_curlist].qf_index = 1; + qf_list_changed(qi, qi->qf_curlist); -/* - * Return TRUE if "buf" is the quickfix buffer. - */ - int -bt_quickfix(buf) - buf_T *buf; -{ - return buf != NULL && buf->b_p_bt[0] == 'q'; -} + qf_update_buffer(qi, NULL); -/* - * Return TRUE if "buf" is a "nofile" or "acwrite" buffer. - * This means the buffer name is not a file name. - */ - int -bt_nofile(buf) - buf_T *buf; -{ - return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') - || buf->b_p_bt[0] == 'a'); -} + if (au_name != NULL) + apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, + curbuf->b_fname, TRUE, curbuf); + /* + * The QuickFixCmdPost autocmd may free the quickfix list. Check the list + * is still valid. + */ + if (!qflist_valid(wp, save_qfid)) + goto theend; -/* - * Return TRUE if "buf" is a "nowrite" or "nofile" buffer. - */ - int -bt_dontwrite(buf) - buf_T *buf; -{ - return buf != NULL && buf->b_p_bt[0] == 'n'; -} + /* Jump to first match. */ + if (qi->qf_lists[qi->qf_curlist].qf_count > 0) + { + if ((flags & VGR_NOJUMP) == 0) + vgr_jump_to_match(qi, eap->forceit, &redraw_for_dummy, + first_match_buf, target_dir); + } + else + EMSG2(_(e_nomatch2), s); - int -bt_dontwrite_msg(buf) - buf_T *buf; -{ - if (bt_dontwrite(buf)) + /* If we loaded a dummy buffer into the current window, the autocommands + * may have messed up things, need to redraw and recompute folds. */ + if (redraw_for_dummy) { - EMSG(_("E382: Cannot write, 'buftype' option is set")); - return TRUE; +#ifdef FEAT_FOLDING + foldUpdateAll(curwin); +#else + redraw_later(NOT_VALID); +#endif } - return FALSE; + +theend: + vim_free(title); + vim_free(dirname_now); + vim_free(dirname_start); + vim_free(target_dir); + vim_regfree(regmatch.regprog); } /* - * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" - * and 'bufhidden'. + * Restore current working directory to "dirname_start" if they differ, taking + * into account whether it is set locally or globally. */ - int -buf_hide(buf) - buf_T *buf; + static void +restore_start_dir(char_u *dirname_start) { - /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ - switch (buf->b_p_bh[0]) + char_u *dirname_now = alloc(MAXPATHL); + + if (NULL != dirname_now) { - case 'u': /* "unload" */ - case 'w': /* "wipe" */ - case 'd': return FALSE; /* "delete" */ - case 'h': return TRUE; /* "hide" */ + mch_dirname(dirname_now, MAXPATHL); + if (STRCMP(dirname_start, dirname_now) != 0) + { + /* If the directory has changed, change it back by building up an + * appropriate ex command and executing it. */ + exarg_T ea; + + ea.arg = dirname_start; + ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; + ex_cd(&ea); + } + vim_free(dirname_now); } - return (p_hid || cmdmod.hide); } /* - * Return TRUE when using ":vimgrep" for ":grep". + * Load file "fname" into a dummy buffer and return the buffer pointer, + * placing the directory resulting from the buffer load into the + * "resulting_dir" pointer. "resulting_dir" must be allocated by the caller + * prior to calling this function. Restores directory to "dirname_start" prior + * to returning, if autocmds or the 'autochdir' option have changed it. + * + * If creating the dummy buffer does not fail, must call unload_dummy_buffer() + * or wipe_dummy_buffer() later! + * + * Returns NULL if it fails. */ - int -grep_internal(cmdidx) - cmdidx_T cmdidx; + static buf_T * +load_dummy_buffer( + char_u *fname, + char_u *dirname_start, /* in: old directory */ + char_u *resulting_dir) /* out: new directory */ { - return ((cmdidx == CMD_grep - || cmdidx == CMD_lgrep - || cmdidx == CMD_grepadd - || cmdidx == CMD_lgrepadd) - && STRCMP("internal", - *curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0); -} + buf_T *newbuf; + bufref_T newbufref; + bufref_T newbuf_to_wipe; + int failed = TRUE; + aco_save_T aco; + int readfile_result; -/* - * Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd" - */ - void -ex_make(eap) - exarg_T *eap; -{ - char_u *fname; - char_u *cmd; - unsigned len; - win_T *wp = NULL; - qf_info_T *qi = &ql_info; - int res; -#ifdef FEAT_AUTOCMD - char_u *au_name = NULL; + /* Allocate a buffer without putting it in the buffer list. */ + newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); + if (newbuf == NULL) + return NULL; + set_bufref(&newbufref, newbuf); - /* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */ - if (grep_internal(eap->cmdidx)) - { - ex_vimgrep(eap); - return; - } + /* Init the options. */ + buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); - switch (eap->cmdidx) - { - case CMD_make: au_name = (char_u *)"make"; break; - case CMD_lmake: au_name = (char_u *)"lmake"; break; - case CMD_grep: au_name = (char_u *)"grep"; break; - case CMD_lgrep: au_name = (char_u *)"lgrep"; break; - case CMD_grepadd: au_name = (char_u *)"grepadd"; break; - case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; - default: break; - } - if (au_name != NULL) + /* need to open the memfile before putting the buffer in a window */ + if (ml_open(newbuf) == OK) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); -# ifdef FEAT_EVAL - if (did_throw || force_abort) - return; -# endif - } -#endif + /* Make sure this buffer isn't wiped out by auto commands. */ + ++newbuf->b_locked; - if (eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_lgrep - || eap->cmdidx == CMD_lgrepadd) - wp = curwin; + /* set curwin/curbuf to buf and save a few things */ + aucmd_prepbuf(&aco, newbuf); - autowrite_all(); - fname = get_mef_name(); - if (fname == NULL) - return; - mch_remove(fname); /* in case it's not unique */ + /* Need to set the filename for autocommands. */ + (void)setfname(curbuf, fname, NULL, FALSE); - /* - * If 'shellpipe' empty: don't redirect to 'errorfile'. - */ - len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(eap->arg) + 1; - if (*p_sp != NUL) - len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3; - cmd = alloc(len); - if (cmd == NULL) - return; - sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg, - (char *)p_shq); - if (*p_sp != NUL) - append_redir(cmd, len, p_sp, fname); - /* - * Output a newline if there's something else than the :make command that - * was typed (in which case the cursor is in column 0). - */ - if (msg_col == 0) - msg_didout = FALSE; - msg_start(); - MSG_PUTS(":!"); - msg_outtrans(cmd); /* show what we are doing */ + /* Create swap file now to avoid the ATTENTION message. */ + check_need_swap(TRUE); - /* let the shell know if we are redirecting output or not */ - do_shell(cmd, *p_sp != NUL ? SHELL_DOOUT : 0); + /* Remove the "dummy" flag, otherwise autocommands may not + * work. */ + curbuf->b_flags &= ~BF_DUMMY; -#ifdef AMIGA - out_flush(); - /* read window status report and redraw before message */ - (void)char_avail(); -#endif + newbuf_to_wipe.br_buf = NULL; + readfile_result = readfile(fname, NULL, + (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, + NULL, READ_NEW | READ_DUMMY); + --newbuf->b_locked; + if (readfile_result == OK + && !got_int + && !(curbuf->b_flags & BF_NEW)) + { + failed = FALSE; + if (curbuf != newbuf) + { + /* Bloody autocommands changed the buffer! Can happen when + * using netrw and editing a remote file. Use the current + * buffer instead, delete the dummy one after restoring the + * window stuff. */ + set_bufref(&newbuf_to_wipe, newbuf); + newbuf = curbuf; + } + } - res = qf_init(wp, fname, (eap->cmdidx != CMD_make - && eap->cmdidx != CMD_lmake) ? p_gefm : p_efm, - (eap->cmdidx != CMD_grepadd - && eap->cmdidx != CMD_lgrepadd), - *eap->cmdlinep); - if (wp != NULL) - qi = GET_LOC_LIST(wp); -#ifdef FEAT_AUTOCMD - if (au_name != NULL) - { - apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, - curbuf->b_fname, TRUE, curbuf); - if (qi->qf_curlist < qi->qf_listcount) - res = qi->qf_lists[qi->qf_curlist].qf_count; - else - res = 0; + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + if (newbuf_to_wipe.br_buf != NULL && bufref_valid(&newbuf_to_wipe)) + wipe_buffer(newbuf_to_wipe.br_buf, FALSE); + + /* Add back the "dummy" flag, otherwise buflist_findname_stat() won't + * skip it. */ + newbuf->b_flags |= BF_DUMMY; } -#endif - if (res > 0 && !eap->forceit) - qf_jump(qi, 0, 0, FALSE); /* display first error */ - mch_remove(fname); - vim_free(fname); - vim_free(cmd); + /* + * When autocommands/'autochdir' option changed directory: go back. + * Let the caller know what the resulting dir was first, in case it is + * important. + */ + mch_dirname(resulting_dir, MAXPATHL); + restore_start_dir(dirname_start); + + if (!bufref_valid(&newbufref)) + return NULL; + if (failed) + { + wipe_dummy_buffer(newbuf, dirname_start); + return NULL; + } + return newbuf; } /* - * Return the name for the errorfile, in allocated memory. - * Find a new unique name when 'makeef' contains "##". - * Returns NULL for error. + * Wipe out the dummy buffer that load_dummy_buffer() created. Restores + * directory to "dirname_start" prior to returning, if autocmds or the + * 'autochdir' option have changed it. */ - static char_u * -get_mef_name() + static void +wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) { - char_u *p; - char_u *name; - static int start = -1; - static int off = 0; -#ifdef HAVE_LSTAT - struct stat sb; -#endif - - if (*p_mef == NUL) + if (curbuf != buf) /* safety check */ { - name = vim_tempname('e'); - if (name == NULL) - EMSG(_(e_notmp)); - return name; - } - - for (p = p_mef; *p; ++p) - if (p[0] == '#' && p[1] == '#') - break; +#if defined(FEAT_EVAL) + cleanup_T cs; - if (*p == NUL) - return vim_strsave(p_mef); + /* Reset the error/interrupt/exception state here so that aborting() + * returns FALSE when wiping out the buffer. Otherwise it doesn't + * work when got_int is set. */ + enter_cleanup(&cs); +#endif - /* Keep trying until the name doesn't exist yet. */ - for (;;) - { - if (start == -1) - start = mch_get_pid(); - else - off += 19; + wipe_buffer(buf, FALSE); - name = alloc((unsigned)STRLEN(p_mef) + 30); - if (name == NULL) - break; - STRCPY(name, p_mef); - sprintf((char *)name + (p - p_mef), "%d%d", start, off); - STRCAT(name, p + 2); - if (mch_getperm(name) < 0 -#ifdef HAVE_LSTAT - /* Don't accept a symbolic link, its a security risk. */ - && mch_lstat((char *)name, &sb) < 0 +#if defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not discarded by a + * new aborting error, interrupt, or uncaught exception. */ + leave_cleanup(&cs); #endif - ) - break; - vim_free(name); + /* When autocommands/'autochdir' option changed directory: go back. */ + restore_start_dir(dirname_start); + } +} + +/* + * Unload the dummy buffer that load_dummy_buffer() created. Restores + * directory to "dirname_start" prior to returning, if autocmds or the + * 'autochdir' option have changed it. + */ + static void +unload_dummy_buffer(buf_T *buf, char_u *dirname_start) +{ + if (curbuf != buf) /* safety check */ + { + close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE); + + /* When autocommands/'autochdir' option changed directory: go back. */ + restore_start_dir(dirname_start); } - return name; } +#if defined(FEAT_EVAL) || defined(PROTO) /* - * ":cc", ":crewind", ":cfirst" and ":clast". - * ":ll", ":lrewind", ":lfirst" and ":llast". + * Add each quickfix error to list "list" as a dictionary. + * If qf_idx is -1, use the current list. Otherwise, use the specified list. */ - void -ex_cc(eap) - exarg_T *eap; + int +get_errorlist(qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list) { - qf_info_T *qi = &ql_info; + qf_info_T *qi = qi_arg; + dict_T *dict; + char_u buf[2]; + qfline_T *qfp; + int i; + int bufnum; - if (eap->cmdidx == CMD_ll - || eap->cmdidx == CMD_lrewind - || eap->cmdidx == CMD_lfirst - || eap->cmdidx == CMD_llast) + if (qi == NULL) { - qi = GET_LOC_LIST(curwin); - if (qi == NULL) + qi = &ql_info; + if (wp != NULL) { - EMSG(_(e_loclist)); - return; + qi = GET_LOC_LIST(wp); + if (qi == NULL) + return FAIL; } } - qf_jump(qi, 0, - eap->addr_count > 0 - ? (int)eap->line2 - : (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) - ? 0 - : (eap->cmdidx == CMD_crewind || eap->cmdidx == CMD_lrewind - || eap->cmdidx == CMD_cfirst || eap->cmdidx == CMD_lfirst) - ? 1 - : 32767, - eap->forceit); + if (qf_idx == INVALID_QFIDX) + qf_idx = qi->qf_curlist; + + if (qf_idx >= qi->qf_listcount + || qi->qf_lists[qf_idx].qf_count == 0) + return FAIL; + + qfp = qi->qf_lists[qf_idx].qf_start; + for (i = 1; !got_int && i <= qi->qf_lists[qf_idx].qf_count; ++i) + { + /* Handle entries with a non-existing buffer number. */ + bufnum = qfp->qf_fnum; + if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) + bufnum = 0; + + if ((dict = dict_alloc()) == NULL) + return FAIL; + if (list_append_dict(list, dict) == FAIL) + return FAIL; + + buf[0] = qfp->qf_type; + buf[1] = NUL; + if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL + || dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL + || dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL + || dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL + || dict_add_nr_str(dict, "nr", (long)qfp->qf_nr, NULL) == FAIL + || dict_add_nr_str(dict, "module", 0L, + qfp->qf_module == NULL ? (char_u *)"" : qfp->qf_module) == FAIL + || dict_add_nr_str(dict, "pattern", 0L, + qfp->qf_pattern == NULL ? (char_u *)"" : qfp->qf_pattern) == FAIL + || dict_add_nr_str(dict, "text", 0L, + qfp->qf_text == NULL ? (char_u *)"" : qfp->qf_text) == FAIL + || dict_add_nr_str(dict, "type", 0L, buf) == FAIL + || dict_add_nr_str(dict, "valid", (long)qfp->qf_valid, NULL) == FAIL) + return FAIL; + + qfp = qfp->qf_next; + if (qfp == NULL) + break; + } + return OK; } /* - * ":cnext", ":cnfile", ":cNext" and ":cprevious". - * ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". + * Flags used by getqflist()/getloclist() to determine which fields to return. */ - void -ex_cnext(eap) - exarg_T *eap; +enum { + QF_GETLIST_NONE = 0x0, + QF_GETLIST_TITLE = 0x1, + QF_GETLIST_ITEMS = 0x2, + QF_GETLIST_NR = 0x4, + QF_GETLIST_WINID = 0x8, + QF_GETLIST_CONTEXT = 0x10, + QF_GETLIST_ID = 0x20, + QF_GETLIST_IDX = 0x40, + QF_GETLIST_SIZE = 0x80, + QF_GETLIST_TICK = 0x100, + QF_GETLIST_ALL = 0x1FF, +}; + +/* + * Parse text from 'di' and return the quickfix list items. + * Existing quickfix lists are not modified. + */ + static int +qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict) { - qf_info_T *qi = &ql_info; + int status = FAIL; + qf_info_T *qi; + char_u *errorformat = p_efm; + dictitem_T *efm_di; + list_T *l; - if (eap->cmdidx == CMD_lnext - || eap->cmdidx == CMD_lNext - || eap->cmdidx == CMD_lprevious - || eap->cmdidx == CMD_lnfile - || eap->cmdidx == CMD_lNfile - || eap->cmdidx == CMD_lpfile) + /* Only a List value is supported */ + if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) { - qi = GET_LOC_LIST(curwin); - if (qi == NULL) + /* If errorformat is supplied then use it, otherwise use the 'efm' + * option setting + */ + if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL) { - EMSG(_(e_loclist)); - return; + if (efm_di->di_tv.v_type != VAR_STRING || + efm_di->di_tv.vval.v_string == NULL) + return FAIL; + errorformat = efm_di->di_tv.vval.v_string; + } + + l = list_alloc(); + if (l == NULL) + return FAIL; + + qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T)); + if (qi != NULL) + { + vim_memset(qi, 0, (size_t)(sizeof(qf_info_T))); + qi->qf_refcount++; + + if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat, + TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) + { + (void)get_errorlist(qi, NULL, 0, l); + qf_free(qi, 0); + } + free(qi); } + dict_add_list(retdict, "items", l); + status = OK; } - qf_jump(qi, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext) - ? FORWARD - : (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile) - ? FORWARD_FILE - : (eap->cmdidx == CMD_cpfile || eap->cmdidx == CMD_lpfile - || eap->cmdidx == CMD_cNfile || eap->cmdidx == CMD_lNfile) - ? BACKWARD_FILE - : BACKWARD, - eap->addr_count > 0 ? (int)eap->line2 : 1, eap->forceit); + return status; } /* - * ":cfile"/":cgetfile"/":caddfile" commands. - * ":lfile"/":lgetfile"/":laddfile" commands. + * Return the quickfix/location list window identifier in the current tabpage. */ - void -ex_cfile(eap) - exarg_T *eap; + static int +qf_winid(qf_info_T *qi) { - win_T *wp = NULL; - qf_info_T *qi = &ql_info; -#ifdef FEAT_AUTOCMD - char_u *au_name = NULL; -#endif - - if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile - || eap->cmdidx == CMD_laddfile) - wp = curwin; - -#ifdef FEAT_AUTOCMD - switch (eap->cmdidx) - { - case CMD_cfile: au_name = (char_u *)"cfile"; break; - case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break; - case CMD_caddfile: au_name = (char_u *)"caddfile"; break; - case CMD_lfile: au_name = (char_u *)"lfile"; break; - case CMD_lgetfile: au_name = (char_u *)"lgetfile"; break; - case CMD_laddfile: au_name = (char_u *)"laddfile"; break; - default: break; - } - if (au_name != NULL) - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf); -#endif -#ifdef FEAT_BROWSE - if (cmdmod.browse) - { - char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg, - NULL, NULL, BROWSE_FILTER_ALL_FILES, NULL); - if (browse_file == NULL) - return; - set_string_option_direct((char_u *)"ef", -1, browse_file, OPT_FREE, 0); - vim_free(browse_file); - } - else -#endif - if (*eap->arg != NUL) - set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); - - /* - * This function is used by the :cfile, :cgetfile and :caddfile - * commands. - * :cfile always creates a new quickfix list and jumps to the - * first error. - * :cgetfile creates a new quickfix list but doesn't jump to the - * first error. - * :caddfile adds to an existing quickfix list. If there is no - * quickfix list then a new list is created. - */ - if (qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile - && eap->cmdidx != CMD_laddfile), - *eap->cmdlinep) > 0 - && (eap->cmdidx == CMD_cfile - || eap->cmdidx == CMD_lfile)) - { -#ifdef FEAT_AUTOCMD - if (au_name != NULL) - apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); -#endif - if (wp != NULL) - qi = GET_LOC_LIST(wp); - qf_jump(qi, 0, 0, eap->forceit); /* display first error */ - } + win_T *win; - else - { -#ifdef FEAT_AUTOCMD - if (au_name != NULL) - apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); -#endif - } + /* The quickfix window can be opened even if the quickfix list is not set + * using ":copen". This is not true for location lists. */ + if (qi == NULL) + return 0; + win = qf_find_win(qi); + if (win != NULL) + return win->w_id; + return 0; } /* - * ":vimgrep {pattern} file(s)" - * ":vimgrepadd {pattern} file(s)" - * ":lvimgrep {pattern} file(s)" - * ":lvimgrepadd {pattern} file(s)" + * Convert the keys in 'what' to quickfix list property flags. */ - void -ex_vimgrep(eap) - exarg_T *eap; + static int +qf_getprop_keys2flags(dict_T *what) { - regmmatch_T regmatch; - int fcount; - char_u **fnames; - char_u *fname; - char_u *s; - char_u *p; - int fi; - qf_info_T *qi = &ql_info; -#ifdef FEAT_AUTOCMD - qfline_T *cur_qf_start; -#endif - qfline_T *prevp = NULL; - long lnum; - buf_T *buf; - int duplicate_name = FALSE; - int using_dummy; - int redraw_for_dummy = FALSE; - int found_match; - buf_T *first_match_buf = NULL; - time_t seconds = 0; - int save_mls; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - char_u *save_ei = NULL; -#endif - aco_save_T aco; - int flags = 0; - colnr_T col; - long tomatch; - char_u *dirname_start = NULL; - char_u *dirname_now = NULL; - char_u *target_dir = NULL; -#ifdef FEAT_AUTOCMD - char_u *au_name = NULL; - - switch (eap->cmdidx) - { - case CMD_vimgrep: au_name = (char_u *)"vimgrep"; break; - case CMD_lvimgrep: au_name = (char_u *)"lvimgrep"; break; - case CMD_vimgrepadd: au_name = (char_u *)"vimgrepadd"; break; - case CMD_lvimgrepadd: au_name = (char_u *)"lvimgrepadd"; break; - case CMD_grep: au_name = (char_u *)"grep"; break; - case CMD_lgrep: au_name = (char_u *)"lgrep"; break; - case CMD_grepadd: au_name = (char_u *)"grepadd"; break; - case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; - default: break; - } - if (au_name != NULL) - { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) - return; - } -#endif - - if (eap->cmdidx == CMD_lgrep - || eap->cmdidx == CMD_lvimgrep - || eap->cmdidx == CMD_lgrepadd - || eap->cmdidx == CMD_lvimgrepadd) - { - qi = ll_get_or_alloc_list(curwin); - if (qi == NULL) - return; - } - - if (eap->addr_count > 0) - tomatch = eap->line2; - else - tomatch = MAXLNUM; - - /* Get the search pattern: either white-separated or enclosed in // */ - regmatch.regprog = NULL; - p = skip_vimgrep_pat(eap->arg, &s, &flags); - if (p == NULL) - { - EMSG(_(e_invalpat)); - goto theend; - } + int flags = QF_GETLIST_NONE; - if (s != NULL && *s == NUL) - { - /* Pattern is empty, use last search pattern. */ - if (last_search_pat() == NULL) - { - EMSG(_(e_noprevre)); - goto theend; - } - regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); - } - else - regmatch.regprog = vim_regcomp(s, RE_MAGIC); + if (dict_find(what, (char_u *)"all", -1) != NULL) + flags |= QF_GETLIST_ALL; - if (regmatch.regprog == NULL) - goto theend; - regmatch.rmm_ic = p_ic; - regmatch.rmm_maxcol = 0; + if (dict_find(what, (char_u *)"title", -1) != NULL) + flags |= QF_GETLIST_TITLE; - p = skipwhite(p); - if (*p == NUL) - { - EMSG(_("E683: File name missing or invalid pattern")); - goto theend; - } + if (dict_find(what, (char_u *)"nr", -1) != NULL) + flags |= QF_GETLIST_NR; - if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd && - eap->cmdidx != CMD_vimgrepadd && eap->cmdidx != CMD_lvimgrepadd) - || qi->qf_curlist == qi->qf_listcount) - /* make place for a new list */ - qf_new_list(qi, *eap->cmdlinep); - else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) - /* Adding to existing list, find last entry. */ - for (prevp = qi->qf_lists[qi->qf_curlist].qf_start; - prevp->qf_next != prevp; prevp = prevp->qf_next) - ; + if (dict_find(what, (char_u *)"winid", -1) != NULL) + flags |= QF_GETLIST_WINID; - /* parse the list of arguments */ - if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL) - goto theend; - if (fcount == 0) - { - EMSG(_(e_nomatch)); - goto theend; - } + if (dict_find(what, (char_u *)"context", -1) != NULL) + flags |= QF_GETLIST_CONTEXT; - dirname_start = alloc(MAXPATHL); - dirname_now = alloc(MAXPATHL); - if (dirname_start == NULL || dirname_now == NULL) - goto theend; + if (dict_find(what, (char_u *)"id", -1) != NULL) + flags |= QF_GETLIST_ID; - /* Remember the current directory, because a BufRead autocommand that does - * ":lcd %:p:h" changes the meaning of short path names. */ - mch_dirname(dirname_start, MAXPATHL); + if (dict_find(what, (char_u *)"items", -1) != NULL) + flags |= QF_GETLIST_ITEMS; -#ifdef FEAT_AUTOCMD - /* Remember the value of qf_start, so that we can check for autocommands - * changing the current quickfix list. */ - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; -#endif + if (dict_find(what, (char_u *)"idx", -1) != NULL) + flags |= QF_GETLIST_IDX; - seconds = (time_t)0; - for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) + if (dict_find(what, (char_u *)"size", -1) != NULL) + flags |= QF_GETLIST_SIZE; + + if (dict_find(what, (char_u *)"changedtick", -1) != NULL) + flags |= QF_GETLIST_TICK; + + return flags; +} + +/* + * Return the quickfix list index based on 'nr' or 'id' in 'what'. + * If 'nr' and 'id' are not present in 'what' then return the current + * quickfix list index. + * If 'nr' is zero then return the current quickfix list index. + * If 'nr' is '$' then return the last quickfix list index. + * If 'id' is present then return the index of the quickfix list with that id. + * If 'id' is zero then return the quickfix list index specified by 'nr'. + * Return -1, if quickfix list is not present or if the stack is empty. + */ + static int +qf_getprop_qfidx(qf_info_T *qi, dict_T *what) +{ + int qf_idx; + dictitem_T *di; + + qf_idx = qi->qf_curlist; /* default is the current list */ + if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) { - fname = shorten_fname1(fnames[fi]); - if (time(NULL) > seconds) + /* Use the specified quickfix/location list */ + if (di->di_tv.v_type == VAR_NUMBER) { - /* Display the file name every second or so, show the user we are - * working on it. */ - seconds = time(NULL); - msg_start(); - p = msg_strtrunc(fname, TRUE); - if (p == NULL) - msg_outtrans(fname); - else + /* for zero use the current list */ + if (di->di_tv.vval.v_number != 0) { - msg_outtrans(p); - vim_free(p); + qf_idx = di->di_tv.vval.v_number - 1; + if (qf_idx < 0 || qf_idx >= qi->qf_listcount) + qf_idx = INVALID_QFIDX; } - msg_clr_eos(); - msg_didout = FALSE; /* overwrite this message */ - msg_nowait = TRUE; /* don't wait for this message */ - msg_col = 0; - out_flush(); } + else if (di->di_tv.v_type == VAR_STRING + && di->di_tv.vval.v_string != NULL + && STRCMP(di->di_tv.vval.v_string, "$") == 0) + /* Get the last quickfix list number */ + qf_idx = qi->qf_listcount - 1; + else + qf_idx = INVALID_QFIDX; + } - buf = buflist_findname_exp(fnames[fi]); - if (buf == NULL || buf->b_ml.ml_mfp == NULL) + if ((di = dict_find(what, (char_u *)"id", -1)) != NULL) + { + /* Look for a list with the specified id */ + if (di->di_tv.v_type == VAR_NUMBER) { - /* Remember that a buffer with this name already exists. */ - duplicate_name = (buf != NULL); - using_dummy = TRUE; - redraw_for_dummy = TRUE; + /* + * For zero, use the current list or the list specified by 'nr' + */ + if (di->di_tv.vval.v_number != 0) + qf_idx = qf_id2nr(qi, di->di_tv.vval.v_number); + } + else + qf_idx = INVALID_QFIDX; + } -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - /* Don't do Filetype autocommands to avoid loading syntax and - * indent scripts, a great speed improvement. */ - save_ei = au_event_disable(",Filetype"); -#endif - /* Don't use modelines here, it's useless. */ - save_mls = p_mls; - p_mls = 0; + return qf_idx; +} - /* Load file into a buffer, so that 'fileencoding' is detected, - * autocommands applied, etc. */ - buf = load_dummy_buffer(fname, dirname_start, dirname_now); +/* + * Return default values for quickfix list properties in retdict. + */ + static int +qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict) +{ + int status = OK; - p_mls = save_mls; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - au_event_restore(save_ei); -#endif - } + if (flags & QF_GETLIST_TITLE) + status = dict_add_nr_str(retdict, "title", 0L, (char_u *)""); + if ((status == OK) && (flags & QF_GETLIST_ITEMS)) + { + list_T *l = list_alloc(); + if (l != NULL) + status = dict_add_list(retdict, "items", l); else - /* Use existing, loaded buffer. */ - using_dummy = FALSE; + status = FAIL; + } + if ((status == OK) && (flags & QF_GETLIST_NR)) + status = dict_add_nr_str(retdict, "nr", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_WINID)) + status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); + if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) + status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); + if ((status == OK) && (flags & QF_GETLIST_ID)) + status = dict_add_nr_str(retdict, "id", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_IDX)) + status = dict_add_nr_str(retdict, "idx", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_SIZE)) + status = dict_add_nr_str(retdict, "size", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_TICK)) + status = dict_add_nr_str(retdict, "changedtick", 0L, NULL); + + return status; +} -#ifdef FEAT_AUTOCMD - if (cur_qf_start != qi->qf_lists[qi->qf_curlist].qf_start) - { - int idx; +/* + * Return the quickfix list title as 'title' in retdict + */ + static int +qf_getprop_title(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + char_u *t; - /* Autocommands changed the quickfix list. Find the one we were - * using and restore it. */ - for (idx = 0; idx < LISTCOUNT; ++idx) - if (cur_qf_start == qi->qf_lists[idx].qf_start) - { - qi->qf_curlist = idx; - break; - } - if (idx == LISTCOUNT) - { - /* List cannot be found, create a new one. */ - qf_new_list(qi, *eap->cmdlinep); - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; - } - } -#endif + t = qi->qf_lists[qf_idx].qf_title; + if (t == NULL) + t = (char_u *)""; + return dict_add_nr_str(retdict, "title", 0L, t); +} - if (buf == NULL) +/* + * Return the quickfix list items/entries as 'items' in retdict + */ + static int +qf_getprop_items(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int status = OK; + list_T *l = list_alloc(); + if (l != NULL) + { + (void)get_errorlist(qi, NULL, qf_idx, l); + dict_add_list(retdict, "items", l); + } + else + status = FAIL; + + return status; +} + +/* + * Return the quickfix list context (if any) as 'context' in retdict. + */ + static int +qf_getprop_ctx(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int status; + dictitem_T *di; + + if (qi->qf_lists[qf_idx].qf_ctx != NULL) + { + di = dictitem_alloc((char_u *)"context"); + if (di != NULL) { - if (!got_int) - smsg((char_u *)_("Cannot open file \"%s\""), fname); + copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); + status = dict_add(retdict, di); + if (status == FAIL) + dictitem_free(di); } else - { - /* Try for a match in all lines of the buffer. - * For ":1vimgrep" look for first match only. */ - found_match = FALSE; - for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; - ++lnum) - { - col = 0; - while (vim_regexec_multi(®match, curwin, buf, lnum, - col, NULL) > 0) - { - ; - if (qf_add_entry(qi, &prevp, - NULL, /* dir */ - fname, - 0, - ml_get_buf(buf, - regmatch.startpos[0].lnum + lnum, FALSE), - regmatch.startpos[0].lnum + lnum, - regmatch.startpos[0].col + 1, - FALSE, /* vis_col */ - NULL, /* search pattern */ - 0, /* nr */ - 0, /* type */ - TRUE /* valid */ - ) == FAIL) - { - got_int = TRUE; - break; - } - found_match = TRUE; - if (--tomatch == 0) - break; - if ((flags & VGR_GLOBAL) == 0 - || regmatch.endpos[0].lnum > 0) - break; - col = regmatch.endpos[0].col - + (col == regmatch.endpos[0].col); - if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) - break; - } - line_breakcheck(); - if (got_int) - break; - } -#ifdef FEAT_AUTOCMD - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; -#endif + status = FAIL; + } + else + status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); - if (using_dummy) - { - if (found_match && first_match_buf == NULL) - first_match_buf = buf; - if (duplicate_name) - { - /* Never keep a dummy buffer if there is another buffer - * with the same name. */ - wipe_dummy_buffer(buf, dirname_start); - buf = NULL; - } - else if (!cmdmod.hide - || buf->b_p_bh[0] == 'u' /* "unload" */ - || buf->b_p_bh[0] == 'w' /* "wipe" */ - || buf->b_p_bh[0] == 'd') /* "delete" */ - { - /* When no match was found we don't need to remember the - * buffer, wipe it out. If there was a match and it - * wasn't the first one or we won't jump there: only - * unload the buffer. - * Ignore 'hidden' here, because it may lead to having too - * many swap files. */ - if (!found_match) - { - wipe_dummy_buffer(buf, dirname_start); - buf = NULL; - } - else if (buf != first_match_buf || (flags & VGR_NOJUMP)) - { - unload_dummy_buffer(buf, dirname_start); - buf = NULL; - } - } + return status; +} - if (buf != NULL) - { - /* If the buffer is still loaded we need to use the - * directory we jumped to below. */ - if (buf == first_match_buf - && target_dir == NULL - && STRCMP(dirname_start, dirname_now) != 0) - target_dir = vim_strsave(dirname_now); +/* + * Return the quickfix list index as 'idx' in retdict + */ + static int +qf_getprop_idx(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int idx = qi->qf_lists[qf_idx].qf_index; + if (qi->qf_lists[qf_idx].qf_count == 0) + /* For empty lists, qf_index is set to 1 */ + idx = 0; + return dict_add_nr_str(retdict, "idx", idx, NULL); +} - /* The buffer is still loaded, the Filetype autocommands - * need to be done now, in that buffer. And the modelines - * need to be done (again). But not the window-local - * options! */ - aucmd_prepbuf(&aco, buf); -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, - buf->b_fname, TRUE, buf); -#endif - do_modelines(OPT_NOWIN); - aucmd_restbuf(&aco); - } - } - } - } +/* + * Return quickfix/location list details (title) as a + * dictionary. 'what' contains the details to return. If 'list_idx' is -1, + * then current list is used. Otherwise the specified list is used. + */ + int +qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict) +{ + qf_info_T *qi = &ql_info; + int status = OK; + int qf_idx; + dictitem_T *di; + int flags = QF_GETLIST_NONE; - FreeWild(fcount, fnames); + if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) + return qf_get_list_from_lines(what, di, retdict); - qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; - qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; - qi->qf_lists[qi->qf_curlist].qf_index = 1; + if (wp != NULL) + qi = GET_LOC_LIST(wp); -#ifdef FEAT_WINDOWS - qf_update_buffer(qi); -#endif + flags = qf_getprop_keys2flags(what); + + if (qi != NULL && qi->qf_listcount != 0) + qf_idx = qf_getprop_qfidx(qi, what); + + /* List is not present or is empty */ + if (qi == NULL || qi->qf_listcount == 0 || qf_idx == INVALID_QFIDX) + return qf_getprop_defaults(qi, flags, retdict); + + if (flags & QF_GETLIST_TITLE) + status = qf_getprop_title(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_NR)) + status = dict_add_nr_str(retdict, "nr", qf_idx + 1, NULL); + if ((status == OK) && (flags & QF_GETLIST_WINID)) + status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); + if ((status == OK) && (flags & QF_GETLIST_ITEMS)) + status = qf_getprop_items(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) + status = qf_getprop_ctx(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_ID)) + status = dict_add_nr_str(retdict, "id", qi->qf_lists[qf_idx].qf_id, + NULL); + if ((status == OK) && (flags & QF_GETLIST_IDX)) + status = qf_getprop_idx(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_SIZE)) + status = dict_add_nr_str(retdict, "size", + qi->qf_lists[qf_idx].qf_count, NULL); + if ((status == OK) && (flags & QF_GETLIST_TICK)) + status = dict_add_nr_str(retdict, "changedtick", + qi->qf_lists[qf_idx].qf_changedtick, NULL); + + return status; +} -#ifdef FEAT_AUTOCMD - if (au_name != NULL) - apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, - curbuf->b_fname, TRUE, curbuf); -#endif +/* + * Add list of entries to quickfix/location list. Each list entry is + * a dictionary with item information. + */ + static int +qf_add_entries( + qf_info_T *qi, + int qf_idx, + list_T *list, + char_u *title, + int action) +{ + listitem_T *li; + dict_T *d; + char_u *filename, *module, *pattern, *text, *type; + int bufnum; + long lnum; + int col, nr; + int vcol; + qfline_T *old_last = NULL; + int valid, status; + int retval = OK; + int did_bufnr_emsg = FALSE; - /* Jump to first match. */ - if (qi->qf_lists[qi->qf_curlist].qf_count > 0) + if (action == ' ' || qf_idx == qi->qf_listcount) { - if ((flags & VGR_NOJUMP) == 0) + /* make place for a new list */ + qf_new_list(qi, title); + qf_idx = qi->qf_curlist; + } + else if (action == 'a' && qi->qf_lists[qf_idx].qf_count > 0) + /* Adding to existing list, use last entry. */ + old_last = qi->qf_lists[qf_idx].qf_last; + else if (action == 'r') + { + qf_free_items(qi, qf_idx); + qf_store_title(qi, qf_idx, title); + } + + for (li = list->lv_first; li != NULL; li = li->li_next) + { + if (li->li_tv.v_type != VAR_DICT) + continue; /* Skip non-dict items */ + + d = li->li_tv.vval.v_dict; + if (d == NULL) + continue; + + filename = get_dict_string(d, (char_u *)"filename", TRUE); + module = get_dict_string(d, (char_u *)"module", TRUE); + bufnum = (int)get_dict_number(d, (char_u *)"bufnr"); + lnum = (int)get_dict_number(d, (char_u *)"lnum"); + col = (int)get_dict_number(d, (char_u *)"col"); + vcol = (int)get_dict_number(d, (char_u *)"vcol"); + nr = (int)get_dict_number(d, (char_u *)"nr"); + type = get_dict_string(d, (char_u *)"type", TRUE); + pattern = get_dict_string(d, (char_u *)"pattern", TRUE); + text = get_dict_string(d, (char_u *)"text", TRUE); + if (text == NULL) + text = vim_strsave((char_u *)""); + + valid = TRUE; + if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL)) + valid = FALSE; + + /* Mark entries with non-existing buffer number as not valid. Give the + * error message only once. */ + if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) { - buf = curbuf; - qf_jump(qi, 0, 0, eap->forceit); - if (buf != curbuf) - /* If we jumped to another buffer redrawing will already be - * taken care of. */ - redraw_for_dummy = FALSE; - - /* Jump to the directory used after loading the buffer. */ - if (curbuf == first_match_buf && target_dir != NULL) + if (!did_bufnr_emsg) { - exarg_T ea; - - ea.arg = target_dir; - ea.cmdidx = CMD_lcd; - ex_cd(&ea); + did_bufnr_emsg = TRUE; + EMSGN(_("E92: Buffer %ld not found"), bufnum); } + valid = FALSE; + bufnum = 0; } - } - else - EMSG2(_(e_nomatch2), s); - /* If we loaded a dummy buffer into the current window, the autocommands - * may have messed up things, need to redraw and recompute folds. */ - if (redraw_for_dummy) + /* If the 'valid' field is present it overrules the detected value. */ + if ((dict_find(d, (char_u *)"valid", -1)) != NULL) + valid = (int)get_dict_number(d, (char_u *)"valid"); + + status = qf_add_entry(qi, + qf_idx, + NULL, /* dir */ + filename, + module, + bufnum, + text, + lnum, + col, + vcol, /* vis_col */ + pattern, /* search pattern */ + nr, + type == NULL ? NUL : *type, + valid); + + vim_free(filename); + vim_free(module); + vim_free(pattern); + vim_free(text); + vim_free(type); + + if (status == FAIL) + { + retval = FAIL; + break; + } + } + + if (qi->qf_lists[qf_idx].qf_index == 0) + /* no valid entry */ + qi->qf_lists[qf_idx].qf_nonevalid = TRUE; + else + qi->qf_lists[qf_idx].qf_nonevalid = FALSE; + if (action != 'a') { -#ifdef FEAT_FOLDING - foldUpdateAll(curwin); -#else - redraw_later(NOT_VALID); -#endif + qi->qf_lists[qf_idx].qf_ptr = + qi->qf_lists[qf_idx].qf_start; + if (qi->qf_lists[qf_idx].qf_count > 0) + qi->qf_lists[qf_idx].qf_index = 1; } -theend: - vim_free(dirname_now); - vim_free(dirname_start); - vim_free(target_dir); - vim_regfree(regmatch.regprog); + /* Don't update the cursor in quickfix window when appending entries */ + qf_update_buffer(qi, old_last); + + return retval; } /* - * Skip over the pattern argument of ":vimgrep /pat/[g][j]". - * Put the start of the pattern in "*s", unless "s" is NULL. - * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. - * If "s" is not NULL terminate the pattern with a NUL. - * Return a pointer to the char just past the pattern plus flags. + * Get the quickfix list index from 'nr' or 'id' */ - char_u * -skip_vimgrep_pat(p, s, flags) - char_u *p; - char_u **s; - int *flags; + static int +qf_setprop_get_qfidx( + qf_info_T *qi, + dict_T *what, + int action, + int *newlist) { - int c; + dictitem_T *di; + int qf_idx = qi->qf_curlist; /* default is the current list */ - if (vim_isIDc(*p)) - { - /* ":vimgrep pattern fname" */ - if (s != NULL) - *s = p; - p = skiptowhite(p); - if (s != NULL && *p != NUL) - *p++ = NUL; - } - else + if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) { - /* ":vimgrep /pattern/[g][j] fname" */ - if (s != NULL) - *s = p + 1; - c = *p; - p = skip_regexp(p + 1, c, TRUE, NULL); - if (*p != c) - return NULL; - - /* Truncate the pattern. */ - if (s != NULL) - *p = NUL; - ++p; - - /* Find the flags */ - while (*p == 'g' || *p == 'j') + /* Use the specified quickfix/location list */ + if (di->di_tv.v_type == VAR_NUMBER) { - if (flags != NULL) + /* for zero use the current list */ + if (di->di_tv.vval.v_number != 0) + qf_idx = di->di_tv.vval.v_number - 1; + + if ((action == ' ' || action == 'a') && qf_idx == qi->qf_listcount) { - if (*p == 'g') - *flags |= VGR_GLOBAL; - else - *flags |= VGR_NOJUMP; + /* + * When creating a new list, accept qf_idx pointing to the next + * non-available list and add the new list at the end of the + * stack. + */ + *newlist = TRUE; + qf_idx = qi->qf_listcount > 0 ? qi->qf_listcount - 1 : 0; } - ++p; + else if (qf_idx < 0 || qf_idx >= qi->qf_listcount) + return INVALID_QFIDX; + else if (action != ' ') + *newlist = FALSE; /* use the specified list */ + } + else if (di->di_tv.v_type == VAR_STRING + && di->di_tv.vval.v_string != NULL + && STRCMP(di->di_tv.vval.v_string, "$") == 0) + { + if (qi->qf_listcount > 0) + qf_idx = qi->qf_listcount - 1; + else if (*newlist) + qf_idx = 0; + else + return INVALID_QFIDX; } + else + return INVALID_QFIDX; + } + + if (!*newlist && (di = dict_find(what, (char_u *)"id", -1)) != NULL) + { + /* Use the quickfix/location list with the specified id */ + if (di->di_tv.v_type != VAR_NUMBER) + return INVALID_QFIDX; + + return qf_id2nr(qi, di->di_tv.vval.v_number); } - return p; + + return qf_idx; } /* - * Restore current working directory to "dirname_start" if they differ, taking - * into account whether it is set locally or globally. + * Set the quickfix list title. */ - static void -restore_start_dir(dirname_start) - char_u *dirname_start; + static int +qf_setprop_title(qf_info_T *qi, int qf_idx, dict_T *what, dictitem_T *di) { - char_u *dirname_now = alloc(MAXPATHL); + if (di->di_tv.v_type != VAR_STRING) + return FAIL; - if (NULL != dirname_now) - { - mch_dirname(dirname_now, MAXPATHL); - if (STRCMP(dirname_start, dirname_now) != 0) - { - /* If the directory has changed, change it back by building up an - * appropriate ex command and executing it. */ - exarg_T ea; + vim_free(qi->qf_lists[qf_idx].qf_title); + qi->qf_lists[qf_idx].qf_title = + get_dict_string(what, (char_u *)"title", TRUE); + if (qf_idx == qi->qf_curlist) + qf_update_win_titlevar(qi); - ea.arg = dirname_start; - ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; - ex_cd(&ea); - } - vim_free(dirname_now); - } + return OK; } /* - * Load file "fname" into a dummy buffer and return the buffer pointer, - * placing the directory resulting from the buffer load into the - * "resulting_dir" pointer. "resulting_dir" must be allocated by the caller - * prior to calling this function. Restores directory to "dirname_start" prior - * to returning, if autocmds or the 'autochdir' option have changed it. - * - * If creating the dummy buffer does not fail, must call unload_dummy_buffer() - * or wipe_dummy_buffer() later! - * - * Returns NULL if it fails. + * Set quickfix list items/entries. */ - static buf_T * -load_dummy_buffer(fname, dirname_start, resulting_dir) - char_u *fname; - char_u *dirname_start; /* in: old directory */ - char_u *resulting_dir; /* out: new directory */ + static int +qf_setprop_items(qf_info_T *qi, int qf_idx, dictitem_T *di, int action) { - buf_T *newbuf; - buf_T *newbuf_to_wipe = NULL; - int failed = TRUE; - aco_save_T aco; + int retval = FAIL; + char_u *title_save; - /* Allocate a buffer without putting it in the buffer list. */ - newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); - if (newbuf == NULL) - return NULL; + if (di->di_tv.v_type != VAR_LIST) + return FAIL; - /* Init the options. */ - buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); + title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title); + retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list, + title_save, action == ' ' ? 'a' : action); + vim_free(title_save); - /* need to open the memfile before putting the buffer in a window */ - if (ml_open(newbuf) == OK) - { - /* set curwin/curbuf to buf and save a few things */ - aucmd_prepbuf(&aco, newbuf); + return retval; +} - /* Need to set the filename for autocommands. */ - (void)setfname(curbuf, fname, NULL, FALSE); +/* + * Set quickfix list items/entries from a list of lines. + */ + static int +qf_setprop_items_from_lines( + qf_info_T *qi, + int qf_idx, + dict_T *what, + dictitem_T *di, + int action) +{ + char_u *errorformat = p_efm; + dictitem_T *efm_di; + int retval = FAIL; - /* Create swap file now to avoid the ATTENTION message. */ - check_need_swap(TRUE); + /* Use the user supplied errorformat settings (if present) */ + if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL) + { + if (efm_di->di_tv.v_type != VAR_STRING || + efm_di->di_tv.vval.v_string == NULL) + return FAIL; + errorformat = efm_di->di_tv.vval.v_string; + } - /* Remove the "dummy" flag, otherwise autocommands may not - * work. */ - curbuf->b_flags &= ~BF_DUMMY; + /* Only a List value is supported */ + if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) + return FAIL; - if (readfile(fname, NULL, - (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, - NULL, READ_NEW | READ_DUMMY) == OK - && !got_int - && !(curbuf->b_flags & BF_NEW)) - { - failed = FALSE; - if (curbuf != newbuf) - { - /* Bloody autocommands changed the buffer! Can happen when - * using netrw and editing a remote file. Use the current - * buffer instead, delete the dummy one after restoring the - * window stuff. */ - newbuf_to_wipe = newbuf; - newbuf = curbuf; - } - } + if (action == 'r') + qf_free_items(qi, qf_idx); + if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, + FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) + retval = OK; - /* restore curwin/curbuf and a few other things */ - aucmd_restbuf(&aco); - if (newbuf_to_wipe != NULL && buf_valid(newbuf_to_wipe)) - wipe_buffer(newbuf_to_wipe, FALSE); - } + return retval; +} - /* - * When autocommands/'autochdir' option changed directory: go back. - * Let the caller know what the resulting dir was first, in case it is - * important. - */ - mch_dirname(resulting_dir, MAXPATHL); - restore_start_dir(dirname_start); +/* + * Set quickfix list context. + */ + static int +qf_setprop_context(qf_info_T *qi, int qf_idx, dictitem_T *di) +{ + typval_T *ctx; - if (!buf_valid(newbuf)) - return NULL; - if (failed) - { - wipe_dummy_buffer(newbuf, dirname_start); - return NULL; - } - return newbuf; + free_tv(qi->qf_lists[qf_idx].qf_ctx); + ctx = alloc_tv(); + if (ctx != NULL) + copy_tv(&di->di_tv, ctx); + qi->qf_lists[qf_idx].qf_ctx = ctx; + + return OK; } /* - * Wipe out the dummy buffer that load_dummy_buffer() created. Restores - * directory to "dirname_start" prior to returning, if autocmds or the - * 'autochdir' option have changed it. + * Set quickfix/location list properties (title, items, context). + * Also used to add items from parsing a list of lines. + * Used by the setqflist() and setloclist() Vim script functions. */ - static void -wipe_dummy_buffer(buf, dirname_start) - buf_T *buf; - char_u *dirname_start; + static int +qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title) { - if (curbuf != buf) /* safety check */ - { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) - cleanup_T cs; + dictitem_T *di; + int retval = FAIL; + int qf_idx; + int newlist = FALSE; - /* Reset the error/interrupt/exception state here so that aborting() - * returns FALSE when wiping out the buffer. Otherwise it doesn't - * work when got_int is set. */ - enter_cleanup(&cs); -#endif + if (action == ' ' || qi->qf_curlist == qi->qf_listcount) + newlist = TRUE; - wipe_buffer(buf, FALSE); + qf_idx = qf_setprop_get_qfidx(qi, what, action, &newlist); + if (qf_idx == INVALID_QFIDX) /* List not found */ + return FAIL; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) - /* Restore the error/interrupt/exception state if not discarded by a - * new aborting error, interrupt, or uncaught exception. */ - leave_cleanup(&cs); -#endif - /* When autocommands/'autochdir' option changed directory: go back. */ - restore_start_dir(dirname_start); + if (newlist) + { + qi->qf_curlist = qf_idx; + qf_new_list(qi, title); + qf_idx = qi->qf_curlist; } + + if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) + retval = qf_setprop_title(qi, qf_idx, what, di); + if ((di = dict_find(what, (char_u *)"items", -1)) != NULL) + retval = qf_setprop_items(qi, qf_idx, di, action); + if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) + retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action); + if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) + retval = qf_setprop_context(qi, qf_idx, di); + + if (retval == OK) + qf_list_changed(qi, qf_idx); + + return retval; } /* - * Unload the dummy buffer that load_dummy_buffer() created. Restores - * directory to "dirname_start" prior to returning, if autocmds or the - * 'autochdir' option have changed it. + * Find the non-location list window with the specified location list. */ - static void -unload_dummy_buffer(buf, dirname_start) - buf_T *buf; - char_u *dirname_start; + static win_T * +find_win_with_ll(qf_info_T *qi) { - if (curbuf != buf) /* safety check */ - { - close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE); + win_T *wp = NULL; - /* When autocommands/'autochdir' option changed directory: go back. */ - restore_start_dir(dirname_start); - } + FOR_ALL_WINDOWS(wp) + if ((wp->w_llist == qi) && !bt_quickfix(wp->w_buffer)) + return wp; + + return NULL; } -#if defined(FEAT_EVAL) || defined(PROTO) /* - * Add each quickfix error to list "list" as a dictionary. + * Free the entire quickfix/location list stack. + * If the quickfix/location list window is open, then clear it. */ - int -get_errorlist(wp, list) - win_T *wp; - list_T *list; + static void +qf_free_stack(win_T *wp, qf_info_T *qi) { - qf_info_T *qi = &ql_info; - dict_T *dict; - char_u buf[2]; - qfline_T *qfp; - int i; - int bufnum; + win_T *qfwin = qf_find_win(qi); + win_T *llwin = NULL; + win_T *orig_wp = wp; - if (wp != NULL) + if (qfwin != NULL) { - qi = GET_LOC_LIST(wp); - if (qi == NULL) - return FAIL; + /* If the quickfix/location list window is open, then clear it */ + if (qi->qf_curlist < qi->qf_listcount) + qf_free(qi, qi->qf_curlist); + qf_update_buffer(qi, NULL); } - if (qi->qf_curlist >= qi->qf_listcount - || qi->qf_lists[qi->qf_curlist].qf_count == 0) - return FAIL; - - qfp = qi->qf_lists[qi->qf_curlist].qf_start; - for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ++i) + if (wp != NULL && IS_LL_WINDOW(wp)) { - /* Handle entries with a non-existing buffer number. */ - bufnum = qfp->qf_fnum; - if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) - bufnum = 0; + /* If in the location list window, then use the non-location list + * window with this location list (if present) + */ + llwin = find_win_with_ll(qi); + if (llwin != NULL) + wp = llwin; + } - if ((dict = dict_alloc()) == NULL) - return FAIL; - if (list_append_dict(list, dict) == FAIL) - return FAIL; + qf_free_all(wp); + if (wp == NULL) + { + /* quickfix list */ + qi->qf_curlist = 0; + qi->qf_listcount = 0; + } + else if (IS_LL_WINDOW(orig_wp)) + { + /* If the location list window is open, then create a new empty + * location list */ + qf_info_T *new_ll = ll_new_list(); - buf[0] = qfp->qf_type; - buf[1] = NUL; - if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL - || dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL - || dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL - || dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL - || dict_add_nr_str(dict, "nr", (long)qfp->qf_nr, NULL) == FAIL - || dict_add_nr_str(dict, "pattern", 0L, - qfp->qf_pattern == NULL ? (char_u *)"" : qfp->qf_pattern) == FAIL - || dict_add_nr_str(dict, "text", 0L, - qfp->qf_text == NULL ? (char_u *)"" : qfp->qf_text) == FAIL - || dict_add_nr_str(dict, "type", 0L, buf) == FAIL - || dict_add_nr_str(dict, "valid", (long)qfp->qf_valid, NULL) == FAIL) - return FAIL; + /* first free the list reference in the location list window */ + ll_free_all(&orig_wp->w_llist_ref); - qfp = qfp->qf_next; + orig_wp->w_llist_ref = new_ll; + if (llwin != NULL) + { + llwin->w_llist = new_ll; + new_ll->qf_refcount++; + } } - return OK; } /* * Populate the quickfix list with the items supplied in the list - * of dictionaries. "title" will be copied to w:quickfix_title + * of dictionaries. "title" will be copied to w:quickfix_title. + * "action" is 'a' for add, 'r' for replace. Otherwise create a new list. */ int -set_errorlist(wp, list, action, title) - win_T *wp; - list_T *list; - int action; - char_u *title; +set_errorlist( + win_T *wp, + list_T *list, + int action, + char_u *title, + dict_T *what) { - listitem_T *li; - dict_T *d; - char_u *filename, *pattern, *text, *type; - int bufnum; - long lnum; - int col, nr; - int vcol; - qfline_T *prevp = NULL; - int valid, status; - int retval = OK; qf_info_T *qi = &ql_info; - int did_bufnr_emsg = FALSE; + int retval = OK; if (wp != NULL) { @@ -3846,96 +6113,80 @@ set_errorlist(wp, list, action, title) return FAIL; } - if (action == ' ' || qi->qf_curlist == qi->qf_listcount) - /* make place for a new list */ - qf_new_list(qi, title); - else if (action == 'a' && qi->qf_lists[qi->qf_curlist].qf_count > 0) - /* Adding to existing list, find last entry. */ - for (prevp = qi->qf_lists[qi->qf_curlist].qf_start; - prevp->qf_next != prevp; prevp = prevp->qf_next) - ; - else if (action == 'r') + if (action == 'f') + { + /* Free the entire quickfix or location list stack */ + qf_free_stack(wp, qi); + } + else if (what != NULL) + retval = qf_set_properties(qi, what, action, title); + else { - qf_free(qi, qi->qf_curlist); - qf_store_title(qi, title); + retval = qf_add_entries(qi, qi->qf_curlist, list, title, action); + if (retval == OK) + qf_list_changed(qi, qi->qf_curlist); } - for (li = list->lv_first; li != NULL; li = li->li_next) + return retval; +} + +/* + * Mark the context as in use for all the lists in a quickfix stack. + */ + static int +mark_quickfix_ctx(qf_info_T *qi, int copyID) +{ + int i; + int abort = FALSE; + typval_T *ctx; + + for (i = 0; i < LISTCOUNT && !abort; ++i) { - if (li->li_tv.v_type != VAR_DICT) - continue; /* Skip non-dict items */ + ctx = qi->qf_lists[i].qf_ctx; + if (ctx != NULL && ctx->v_type != VAR_NUMBER + && ctx->v_type != VAR_STRING && ctx->v_type != VAR_FLOAT) + abort = set_ref_in_item(ctx, copyID, NULL, NULL); + } - d = li->li_tv.vval.v_dict; - if (d == NULL) - continue; + return abort; +} - filename = get_dict_string(d, (char_u *)"filename", TRUE); - bufnum = get_dict_number(d, (char_u *)"bufnr"); - lnum = get_dict_number(d, (char_u *)"lnum"); - col = get_dict_number(d, (char_u *)"col"); - vcol = get_dict_number(d, (char_u *)"vcol"); - nr = get_dict_number(d, (char_u *)"nr"); - type = get_dict_string(d, (char_u *)"type", TRUE); - pattern = get_dict_string(d, (char_u *)"pattern", TRUE); - text = get_dict_string(d, (char_u *)"text", TRUE); - if (text == NULL) - text = vim_strsave((char_u *)""); +/* + * Mark the context of the quickfix list and the location lists (if present) as + * "in use". So that garbage collection doesn't free the context. + */ + int +set_ref_in_quickfix(int copyID) +{ + int abort = FALSE; + tabpage_T *tp; + win_T *win; - valid = TRUE; - if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL)) - valid = FALSE; + abort = mark_quickfix_ctx(&ql_info, copyID); + if (abort) + return abort; - /* Mark entries with non-existing buffer number as not valid. Give the - * error message only once. */ - if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) + FOR_ALL_TAB_WINDOWS(tp, win) + { + if (win->w_llist != NULL) { - if (!did_bufnr_emsg) - { - did_bufnr_emsg = TRUE; - EMSGN(_("E92: Buffer %ld not found"), bufnum); - } - valid = FALSE; - bufnum = 0; + abort = mark_quickfix_ctx(win->w_llist, copyID); + if (abort) + return abort; } - - status = qf_add_entry(qi, &prevp, - NULL, /* dir */ - filename, - bufnum, - text, - lnum, - col, - vcol, /* vis_col */ - pattern, /* search pattern */ - nr, - type == NULL ? NUL : *type, - valid); - - vim_free(filename); - vim_free(pattern); - vim_free(text); - vim_free(type); - - if (status == FAIL) + if (IS_LL_WINDOW(win) && (win->w_llist_ref->qf_refcount == 1)) { - retval = FAIL; - break; + /* In a location list window and none of the other windows is + * referring to this location list. Mark the location list + * context as still in use. + */ + abort = mark_quickfix_ctx(win->w_llist_ref, copyID); + if (abort) + return abort; } } - if (qi->qf_lists[qi->qf_curlist].qf_index == 0) - /* no valid entry */ - qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE; - else - qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; - qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; - qi->qf_lists[qi->qf_curlist].qf_index = 1; - -#ifdef FEAT_WINDOWS - qf_update_buffer(qi); -#endif - - return retval; + return abort; } #endif @@ -3948,13 +6199,35 @@ set_errorlist(wp, list, action, title) * ":[range]lgetbuffer [bufnr]" command. */ void -ex_cbuffer(eap) - exarg_T *eap; +ex_cbuffer(exarg_T *eap) { buf_T *buf = NULL; qf_info_T *qi = &ql_info; + char_u *au_name = NULL; + int res; - if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer + switch (eap->cmdidx) + { + case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; + case CMD_cgetbuffer: au_name = (char_u *)"cgetbuffer"; break; + case CMD_caddbuffer: au_name = (char_u *)"caddbuffer"; break; + case CMD_lbuffer: au_name = (char_u *)"lbuffer"; break; + case CMD_lgetbuffer: au_name = (char_u *)"lgetbuffer"; break; + case CMD_laddbuffer: au_name = (char_u *)"laddbuffer"; break; + default: break; + } + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) + { +#ifdef FEAT_EVAL + if (aborting()) + return; +#endif + } + + /* Must come after autocommands. */ + if (eap->cmdidx == CMD_lbuffer + || eap->cmdidx == CMD_lgetbuffer || eap->cmdidx == CMD_laddbuffer) { qi = ll_get_or_alloc_list(curwin); @@ -3982,7 +6255,7 @@ ex_cbuffer(eap) EMSG(_(e_invrange)); else { - char_u *qf_title = *eap->cmdlinep; + char_u *qf_title = qf_cmdtitle(*eap->cmdlinep); if (buf->b_sfname) { @@ -3991,13 +6264,26 @@ ex_cbuffer(eap) qf_title = IObuff; } - if (qf_init_ext(qi, NULL, buf, NULL, p_efm, + res = qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm, (eap->cmdidx != CMD_caddbuffer && eap->cmdidx != CMD_laddbuffer), eap->line1, eap->line2, - qf_title) > 0 - && (eap->cmdidx == CMD_cbuffer - || eap->cmdidx == CMD_lbuffer)) + qf_title, NULL); + if (res >= 0) + qf_list_changed(qi, qi->qf_curlist); + if (au_name != NULL) + { + buf_T *curbuf_old = curbuf; + + apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, + curbuf->b_fname, TRUE, curbuf); + if (curbuf != curbuf_old) + // Autocommands changed buffer, don't jump now, "qi" may + // be invalid. + res = 0; + } + if (res > 0 && (eap->cmdidx == CMD_cbuffer || + eap->cmdidx == CMD_lbuffer)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ } } @@ -4009,13 +6295,34 @@ ex_cbuffer(eap) * ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command. */ void -ex_cexpr(eap) - exarg_T *eap; +ex_cexpr(exarg_T *eap) { typval_T *tv; qf_info_T *qi = &ql_info; + char_u *au_name = NULL; + int res; + + switch (eap->cmdidx) + { + case CMD_cexpr: au_name = (char_u *)"cexpr"; break; + case CMD_cgetexpr: au_name = (char_u *)"cgetexpr"; break; + case CMD_caddexpr: au_name = (char_u *)"caddexpr"; break; + case CMD_lexpr: au_name = (char_u *)"lexpr"; break; + case CMD_lgetexpr: au_name = (char_u *)"lgetexpr"; break; + case CMD_laddexpr: au_name = (char_u *)"laddexpr"; break; + default: break; + } + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) + { +#ifdef FEAT_EVAL + if (aborting()) + return; +#endif + } - if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr + if (eap->cmdidx == CMD_lexpr + || eap->cmdidx == CMD_lgetexpr || eap->cmdidx == CMD_laddexpr) { qi = ll_get_or_alloc_list(curwin); @@ -4031,12 +6338,18 @@ ex_cexpr(eap) if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL) || (tv->v_type == VAR_LIST && tv->vval.v_list != NULL)) { - if (qf_init_ext(qi, NULL, NULL, tv, p_efm, + res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm, (eap->cmdidx != CMD_caddexpr && eap->cmdidx != CMD_laddexpr), - (linenr_T)0, (linenr_T)0, *eap->cmdlinep) > 0 - && (eap->cmdidx == CMD_cexpr - || eap->cmdidx == CMD_lexpr)) + (linenr_T)0, (linenr_T)0, + qf_cmdtitle(*eap->cmdlinep), NULL); + if (res >= 0) + qf_list_changed(qi, qi->qf_curlist); + if (au_name != NULL) + apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, + curbuf->b_fname, TRUE, curbuf); + if (res > 0 && (eap->cmdidx == CMD_cexpr || + eap->cmdidx == CMD_lexpr)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ } else @@ -4047,51 +6360,243 @@ ex_cexpr(eap) #endif /* - * ":helpgrep {pattern}" + * Get the location list for ":lhelpgrep" */ - void -ex_helpgrep(eap) - exarg_T *eap; + static qf_info_T * +hgr_get_ll(int *new_ll) +{ + win_T *wp; + qf_info_T *qi; + + /* If the current window is a help window, then use it */ + if (bt_help(curwin->w_buffer)) + wp = curwin; + else + /* Find an existing help window */ + wp = qf_find_help_win(); + + if (wp == NULL) /* Help window not found */ + qi = NULL; + else + qi = wp->w_llist; + + if (qi == NULL) + { + /* Allocate a new location list for help text matches */ + if ((qi = ll_new_list()) == NULL) + return NULL; + *new_ll = TRUE; + } + + return qi; +} + +/* + * Search for a pattern in a help file. + */ + static void +hgr_search_file( + qf_info_T *qi, + char_u *fname, +#ifdef FEAT_MBYTE + vimconv_T *p_vc, +#endif + regmatch_T *p_regmatch) +{ + FILE *fd; + long lnum; + + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + return; + + lnum = 1; + while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) + { + char_u *line = IObuff; +#ifdef FEAT_MBYTE + /* Convert a line if 'encoding' is not utf-8 and + * the line contains a non-ASCII character. */ + if (p_vc->vc_type != CONV_NONE + && has_non_ascii(IObuff)) + { + line = string_convert(p_vc, IObuff, NULL); + if (line == NULL) + line = IObuff; + } +#endif + + if (vim_regexec(p_regmatch, line, (colnr_T)0)) + { + int l = (int)STRLEN(line); + + /* remove trailing CR, LF, spaces, etc. */ + while (l > 0 && line[l - 1] <= ' ') + line[--l] = NUL; + + if (qf_add_entry(qi, + qi->qf_curlist, + NULL, /* dir */ + fname, + NULL, + 0, + line, + lnum, + (int)(p_regmatch->startp[0] - line) + + 1, /* col */ + FALSE, /* vis_col */ + NULL, /* search pattern */ + 0, /* nr */ + 1, /* type */ + TRUE /* valid */ + ) == FAIL) + { + got_int = TRUE; +#ifdef FEAT_MBYTE + if (line != IObuff) + vim_free(line); +#endif + break; + } + } +#ifdef FEAT_MBYTE + if (line != IObuff) + vim_free(line); +#endif + ++lnum; + line_breakcheck(); + } + fclose(fd); +} + +/* + * Search for a pattern in all the help files in the doc directory under + * the given directory. + */ + static void +hgr_search_files_in_dir( + qf_info_T *qi, + char_u *dirname, + regmatch_T *p_regmatch +#ifdef FEAT_MBYTE + , vimconv_T *p_vc +#endif +#ifdef FEAT_MULTI_LANG + , char_u *lang +#endif + ) { - regmatch_T regmatch; - char_u *save_cpo; - char_u *p; int fcount; char_u **fnames; - FILE *fd; int fi; - qfline_T *prevp = NULL; - long lnum; + + /* Find all "*.txt" and "*.??x" files in the "doc" directory. */ + add_pathsep(dirname); + STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); + if (gen_expand_wildcards(1, &dirname, &fcount, + &fnames, EW_FILE|EW_SILENT) == OK + && fcount > 0) + { + for (fi = 0; fi < fcount && !got_int; ++fi) + { +#ifdef FEAT_MULTI_LANG + /* Skip files for a different language. */ + if (lang != NULL + && STRNICMP(lang, fnames[fi] + + STRLEN(fnames[fi]) - 3, 2) != 0 + && !(STRNICMP(lang, "en", 2) == 0 + && STRNICMP("txt", fnames[fi] + + STRLEN(fnames[fi]) - 3, 3) == 0)) + continue; +#endif + + hgr_search_file(qi, fnames[fi], +#ifdef FEAT_MBYTE + p_vc, +#endif + p_regmatch); + } + FreeWild(fcount, fnames); + } +} + +/* + * Search for a pattern in all the help files in the 'runtimepath' + * and add the matches to a quickfix list. + * 'arg' is the language specifier. If supplied, then only matches in the + * specified language are found. + */ + static void +hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *arg) +{ + char_u *p; #ifdef FEAT_MULTI_LANG char_u *lang; #endif - qf_info_T *qi = &ql_info; - int new_qi = FALSE; - win_T *wp; -#ifdef FEAT_AUTOCMD - char_u *au_name = NULL; + +#ifdef FEAT_MBYTE + vimconv_T vc; + + /* Help files are in utf-8 or latin1, convert lines when 'encoding' + * differs. */ + vc.vc_type = CONV_NONE; + if (!enc_utf8) + convert_setup(&vc, (char_u *)"utf-8", p_enc); #endif #ifdef FEAT_MULTI_LANG /* Check for a specified language */ - lang = check_help_lang(eap->arg); + lang = check_help_lang(arg); +#endif + + /* Go through all the directories in 'runtimepath' */ + p = p_rtp; + while (*p != NUL && !got_int) + { + copy_option_part(&p, NameBuff, MAXPATHL, ","); + + hgr_search_files_in_dir(qi, NameBuff, p_regmatch +#ifdef FEAT_MBYTE + , &vc #endif +#ifdef FEAT_MULTI_LANG + , lang +#endif + ); + } + +#ifdef FEAT_MBYTE + if (vc.vc_type != CONV_NONE) + convert_setup(&vc, NULL, NULL); +#endif +} + +/* + * ":helpgrep {pattern}" + */ + void +ex_helpgrep(exarg_T *eap) +{ + regmatch_T regmatch; + char_u *save_cpo; + qf_info_T *qi = &ql_info; + int new_qi = FALSE; + char_u *au_name = NULL; -#ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break; case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) +#ifdef FEAT_EVAL + if (aborting()) return; - } #endif + } /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ save_cpo = p_cpo; @@ -4099,135 +6604,21 @@ ex_helpgrep(eap) if (eap->cmdidx == CMD_lhelpgrep) { - /* Find an existing help window */ - FOR_ALL_WINDOWS(wp) - if (wp->w_buffer != NULL && wp->w_buffer->b_help) - break; - - if (wp == NULL) /* Help window not found */ - qi = NULL; - else - qi = wp->w_llist; - + qi = hgr_get_ll(&new_qi); if (qi == NULL) - { - /* Allocate a new location list for help text matches */ - if ((qi = ll_new_list()) == NULL) - return; - new_qi = TRUE; - } + return; } regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.rm_ic = FALSE; if (regmatch.regprog != NULL) { -#ifdef FEAT_MBYTE - vimconv_T vc; - - /* Help files are in utf-8 or latin1, convert lines when 'encoding' - * differs. */ - vc.vc_type = CONV_NONE; - if (!enc_utf8) - convert_setup(&vc, (char_u *)"utf-8", p_enc); -#endif - /* create a new quickfix list */ - qf_new_list(qi, *eap->cmdlinep); - - /* Go through all directories in 'runtimepath' */ - p = p_rtp; - while (*p != NUL && !got_int) - { - copy_option_part(&p, NameBuff, MAXPATHL, ","); - - /* Find all "*.txt" and "*.??x" files in the "doc" directory. */ - add_pathsep(NameBuff); - STRCAT(NameBuff, "doc/*.\\(txt\\|??x\\)"); - if (gen_expand_wildcards(1, &NameBuff, &fcount, - &fnames, EW_FILE|EW_SILENT) == OK - && fcount > 0) - { - for (fi = 0; fi < fcount && !got_int; ++fi) - { -#ifdef FEAT_MULTI_LANG - /* Skip files for a different language. */ - if (lang != NULL - && STRNICMP(lang, fnames[fi] - + STRLEN(fnames[fi]) - 3, 2) != 0 - && !(STRNICMP(lang, "en", 2) == 0 - && STRNICMP("txt", fnames[fi] - + STRLEN(fnames[fi]) - 3, 3) == 0)) - continue; -#endif - fd = mch_fopen((char *)fnames[fi], "r"); - if (fd != NULL) - { - lnum = 1; - while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) - { - char_u *line = IObuff; -#ifdef FEAT_MBYTE - /* Convert a line if 'encoding' is not utf-8 and - * the line contains a non-ASCII character. */ - if (vc.vc_type != CONV_NONE - && has_non_ascii(IObuff)) { - line = string_convert(&vc, IObuff, NULL); - if (line == NULL) - line = IObuff; - } -#endif + qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep)); - if (vim_regexec(®match, line, (colnr_T)0)) - { - int l = (int)STRLEN(line); - - /* remove trailing CR, LF, spaces, etc. */ - while (l > 0 && line[l - 1] <= ' ') - line[--l] = NUL; - - if (qf_add_entry(qi, &prevp, - NULL, /* dir */ - fnames[fi], - 0, - line, - lnum, - (int)(regmatch.startp[0] - line) - + 1, /* col */ - FALSE, /* vis_col */ - NULL, /* search pattern */ - 0, /* nr */ - 1, /* type */ - TRUE /* valid */ - ) == FAIL) - { - got_int = TRUE; -#ifdef FEAT_MBYTE - if (line != IObuff) - vim_free(line); -#endif - break; - } - } -#ifdef FEAT_MBYTE - if (line != IObuff) - vim_free(line); -#endif - ++lnum; - line_breakcheck(); - } - fclose(fd); - } - } - FreeWild(fcount, fnames); - } - } + hgr_search_in_rtp(qi, ®match, eap->arg); vim_regfree(regmatch.regprog); -#ifdef FEAT_MBYTE - if (vc.vc_type != CONV_NONE) - convert_setup(&vc, NULL, NULL); -#endif qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; qi->qf_lists[qi->qf_curlist].qf_ptr = @@ -4241,11 +6632,9 @@ ex_helpgrep(eap) /* Darn, some plugin changed the value. */ free_string_option(save_cpo); -#ifdef FEAT_WINDOWS - qf_update_buffer(qi); -#endif + qf_list_changed(qi, qi->qf_curlist); + qf_update_buffer(qi, NULL); -#ifdef FEAT_AUTOCMD if (au_name != NULL) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, @@ -4254,7 +6643,6 @@ ex_helpgrep(eap) /* autocommands made "qi" invalid */ return; } -#endif /* Jump to first match. */ if (qi->qf_lists[qi->qf_curlist].qf_count > 0) @@ -4266,7 +6654,7 @@ ex_helpgrep(eap) { /* If the help window is not opened or if it already points to the * correct location list, then free the new location list. */ - if (!curwin->w_buffer->b_help || curwin->w_llist == qi) + if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi) { if (new_qi) ll_free_all(&qi); diff --git a/src/regexp.c b/src/regexp.c index dcb9a3b4e8..698038959c 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * Handling of regular expressions: vim_regcomp(), vim_regexec(), vim_regsub() * @@ -48,10 +48,10 @@ #ifdef DEBUG /* show/save debugging data when BT engine is used */ -# define BT_REGEXP_DUMP +/*# define BT_REGEXP_DUMP*/ /* save the debugging data to a file instead of displaying it */ -# define BT_REGEXP_LOG -# define BT_REGEXP_DEBUG_LOG +/*# define BT_REGEXP_LOG*/ +/*# define BT_REGEXP_DEBUG_LOG*/ # define BT_REGEXP_DEBUG_LOG_NAME "bt_regexp_debug.log" #endif @@ -255,12 +255,8 @@ #define un_Magic(x) ((x) + 256) #define is_Magic(x) ((x) < 0) -static int no_Magic __ARGS((int x)); -static int toggle_Magic __ARGS((int x)); - static int -no_Magic(x) - int x; +no_Magic(int x) { if (is_Magic(x)) return un_Magic(x); @@ -268,8 +264,7 @@ no_Magic(x) } static int -toggle_Magic(x) - int x; +toggle_Magic(int x) { if (is_Magic(x)) return un_Magic(x); @@ -340,25 +335,33 @@ toggle_Magic(x) /* Used for an error (down from) vim_regcomp(): give the error message, set * rc_did_emsg and return NULL */ #define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = TRUE, (void *)NULL) +#define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = TRUE, (void *)NULL) #define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = TRUE, FAIL) #define EMSG2_RET_NULL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, (void *)NULL) #define EMSG2_RET_FAIL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, FAIL) #define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL) + #define MAX_LIMIT (32767L << 16L) -static int re_multi_type __ARGS((int)); -static int cstrncmp __ARGS((char_u *s1, char_u *s2, int *n)); -static char_u *cstrchr __ARGS((char_u *, int)); +static int re_multi_type(int); +static int cstrncmp(char_u *s1, char_u *s2, int *n); +static char_u *cstrchr(char_u *, int); #ifdef BT_REGEXP_DUMP -static void regdump __ARGS((char_u *, bt_regprog_T *)); +static void regdump(char_u *, bt_regprog_T *); #endif #ifdef DEBUG -static char_u *regprop __ARGS((char_u *)); +static char_u *regprop(char_u *); #endif +static int re_mult_next(char *what); + static char_u e_missingbracket[] = N_("E769: Missing ] after %s["); +static char_u e_reverse_range[] = N_("E944: Reverse range in character class"); +#ifdef FEAT_MBYTE +static char_u e_large_class[] = N_("E945: Range too large in character class"); +#endif static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%("); static char_u e_unmatchedp[] = N_("E54: Unmatched %s("); static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)"); @@ -377,8 +380,7 @@ static char_u e_empty_sb[] = N_("E70: Empty %s%%[]"); * Return MULTI_MULT if c is a multi "multi" operator. */ static int -re_multi_type(c) - int c; +re_multi_type(int c) { if (c == Magic('@') || c == Magic('=') || c == Magic('?')) return MULTI_ONE; @@ -424,20 +426,19 @@ static char_u *reg_prev_sub = NULL; static char_u REGEXP_INRANGE[] = "]^-n\\"; static char_u REGEXP_ABBR[] = "nrtebdoxuU"; -static int backslash_trans __ARGS((int c)); -static int get_char_class __ARGS((char_u **pp)); -static int get_equi_class __ARGS((char_u **pp)); -static void reg_equi_class __ARGS((int c)); -static int get_coll_element __ARGS((char_u **pp)); -static char_u *skip_anyof __ARGS((char_u *p)); -static void init_class_tab __ARGS((void)); +static int backslash_trans(int c); +static int get_char_class(char_u **pp); +static int get_equi_class(char_u **pp); +static void reg_equi_class(int c); +static int get_coll_element(char_u **pp); +static char_u *skip_anyof(char_u *p); +static void init_class_tab(void); /* * Translate '\x' to its control character, except "\n", which is Magic. */ static int -backslash_trans(c) - int c; +backslash_trans(int c) { switch (c) { @@ -455,8 +456,7 @@ backslash_trans(c) * recognized. Otherwise "pp" is advanced to after the item. */ static int -get_char_class(pp) - char_u **pp; +get_char_class(char_u **pp) { static const char *(class_names[]) = { @@ -525,7 +525,7 @@ static short class_tab[256]; #define RI_WHITE 0x100 static void -init_class_tab() +init_class_tab(void) { int i; static int done = FALSE; @@ -687,33 +687,33 @@ typedef struct /* * Forward declarations for vim_regcomp()'s friends. */ -static void initchr __ARGS((char_u *)); -static void save_parse_state __ARGS((parse_state_T *ps)); -static void restore_parse_state __ARGS((parse_state_T *ps)); -static int getchr __ARGS((void)); -static void skipchr_keepstart __ARGS((void)); -static int peekchr __ARGS((void)); -static void skipchr __ARGS((void)); -static void ungetchr __ARGS((void)); -static int gethexchrs __ARGS((int maxinputlen)); -static int getoctchrs __ARGS((void)); -static int getdecchrs __ARGS((void)); -static int coll_get_char __ARGS((void)); -static void regcomp_start __ARGS((char_u *expr, int flags)); -static char_u *reg __ARGS((int, int *)); -static char_u *regbranch __ARGS((int *flagp)); -static char_u *regconcat __ARGS((int *flagp)); -static char_u *regpiece __ARGS((int *)); -static char_u *regatom __ARGS((int *)); -static char_u *regnode __ARGS((int)); +static void initchr(char_u *); +static void save_parse_state(parse_state_T *ps); +static void restore_parse_state(parse_state_T *ps); +static int getchr(void); +static void skipchr_keepstart(void); +static int peekchr(void); +static void skipchr(void); +static void ungetchr(void); +static long gethexchrs(int maxinputlen); +static long getoctchrs(void); +static long getdecchrs(void); +static int coll_get_char(void); +static void regcomp_start(char_u *expr, int flags); +static char_u *reg(int, int *); +static char_u *regbranch(int *flagp); +static char_u *regconcat(int *flagp); +static char_u *regpiece(int *); +static char_u *regatom(int *); +static char_u *regnode(int); #ifdef FEAT_MBYTE -static int use_multibytecode __ARGS((int c)); +static int use_multibytecode(int c); #endif -static int prog_magic_wrong __ARGS((void)); -static char_u *regnext __ARGS((char_u *)); -static void regc __ARGS((int b)); +static int prog_magic_wrong(void); +static char_u *regnext(char_u *); +static void regc(int b); #ifdef FEAT_MBYTE -static void regmbc __ARGS((int c)); +static void regmbc(int c); # define REGMBC(x) regmbc(x); # define CASEMBC(x) case x: #else @@ -721,13 +721,13 @@ static void regmbc __ARGS((int c)); # define REGMBC(x) # define CASEMBC(x) #endif -static void reginsert __ARGS((int, char_u *)); -static void reginsert_nr __ARGS((int op, long val, char_u *opnd)); -static void reginsert_limits __ARGS((int, long, long, char_u *)); -static char_u *re_put_long __ARGS((char_u *pr, long_u val)); -static int read_limits __ARGS((long *, long *)); -static void regtail __ARGS((char_u *, char_u *)); -static void regoptail __ARGS((char_u *, char_u *)); +static void reginsert(int, char_u *); +static void reginsert_nr(int op, long val, char_u *opnd); +static void reginsert_limits(int, long, long, char_u *); +static char_u *re_put_long(char_u *pr, long_u val); +static int read_limits(long *, long *); +static void regtail(char_u *, char_u *); +static void regoptail(char_u *, char_u *); static regengine_T bt_regengine; static regengine_T nfa_regengine; @@ -736,8 +736,7 @@ static regengine_T nfa_regengine; * Return TRUE if compiled regular expression "prog" can match a line break. */ int -re_multiline(prog) - regprog_T *prog; +re_multiline(regprog_T *prog) { return (prog->regflags & RF_HASNL); } @@ -747,8 +746,7 @@ re_multiline(prog) * position (pattern contains "\@<=" or "\@<!"). */ int -re_lookbehind(prog) - regprog_T *prog; +re_lookbehind(regprog_T *prog) { return (prog->regflags & RF_LOOKBH); } @@ -759,8 +757,7 @@ re_lookbehind(prog) * recognized. Otherwise "pp" is advanced to after the item. */ static int -get_equi_class(pp) - char_u **pp; +get_equi_class(char_u **pp) { int c; int l = 1; @@ -797,7 +794,7 @@ char *EQUIVAL_CLASS_C[16] = { "E\x71\x72\x73\x74", "I\x75\x76\x77\x78", "N\x69", - "O\xEB\xEC\xED\xEE\xEF", + "O\xEB\xEC\xED\xEE\xEF\x80", "U\xFB\xFC\xFD\xFE", "Y\xBA", "a\x42\x43\x44\x45\x46\x47", @@ -805,7 +802,7 @@ char *EQUIVAL_CLASS_C[16] = { "e\x51\x52\x53\x54", "i\x55\x56\x57\x58", "n\x49", - "o\xCB\xCC\xCD\xCE\xCF", + "o\xCB\xCC\xCD\xCE\xCF\x70", "u\xDB\xDC\xDD\xDE", "y\x8D\xDF", }; @@ -817,8 +814,7 @@ char *EQUIVAL_CLASS_C[16] = { * NOTE: When changing this function, also change nfa_emit_equi_class() */ static void -reg_equi_class(c) - int c; +reg_equi_class(int c) { #ifdef FEAT_MBYTE if (enc_utf8 || STRCMP(p_enc, "latin1") == 0 @@ -843,13 +839,14 @@ reg_equi_class(c) #else switch (c) { - case 'A': case '\300': case '\301': case '\302': + /* Do not use '\300' style, it results in a negative number. */ + case 'A': case 0xc0: case 0xc1: case 0xc2: + case 0xc3: case 0xc4: case 0xc5: CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) CASEMBC(0x1cd) CASEMBC(0x1de) CASEMBC(0x1e0) CASEMBC(0x1ea2) - case '\303': case '\304': case '\305': - regmbc('A'); regmbc('\300'); regmbc('\301'); - regmbc('\302'); regmbc('\303'); regmbc('\304'); - regmbc('\305'); + regmbc('A'); regmbc(0xc0); regmbc(0xc1); + regmbc(0xc2); regmbc(0xc3); regmbc(0xc4); + regmbc(0xc5); REGMBC(0x100) REGMBC(0x102) REGMBC(0x104) REGMBC(0x1cd) REGMBC(0x1de) REGMBC(0x1e0) REGMBC(0x1ea2) @@ -857,9 +854,9 @@ reg_equi_class(c) case 'B': CASEMBC(0x1e02) CASEMBC(0x1e06) regmbc('B'); REGMBC(0x1e02) REGMBC(0x1e06) return; - case 'C': case '\307': + case 'C': case 0xc7: CASEMBC(0x106) CASEMBC(0x108) CASEMBC(0x10a) CASEMBC(0x10c) - regmbc('C'); regmbc('\307'); + regmbc('C'); regmbc(0xc7); REGMBC(0x106) REGMBC(0x108) REGMBC(0x10a) REGMBC(0x10c) return; @@ -868,11 +865,11 @@ reg_equi_class(c) regmbc('D'); REGMBC(0x10e) REGMBC(0x110) REGMBC(0x1e0a) REGMBC(0x1e0e) REGMBC(0x1e10) return; - case 'E': case '\310': case '\311': case '\312': case '\313': + case 'E': case 0xc8: case 0xc9: case 0xca: case 0xcb: CASEMBC(0x112) CASEMBC(0x114) CASEMBC(0x116) CASEMBC(0x118) CASEMBC(0x11a) CASEMBC(0x1eba) CASEMBC(0x1ebc) - regmbc('E'); regmbc('\310'); regmbc('\311'); - regmbc('\312'); regmbc('\313'); + regmbc('E'); regmbc(0xc8); regmbc(0xc9); + regmbc(0xca); regmbc(0xcb); REGMBC(0x112) REGMBC(0x114) REGMBC(0x116) REGMBC(0x118) REGMBC(0x11a) REGMBC(0x1eba) REGMBC(0x1ebc) @@ -892,11 +889,11 @@ reg_equi_class(c) regmbc('H'); REGMBC(0x124) REGMBC(0x126) REGMBC(0x1e22) REGMBC(0x1e26) REGMBC(0x1e28) return; - case 'I': case '\314': case '\315': case '\316': case '\317': + case 'I': case 0xcc: case 0xcd: case 0xce: case 0xcf: CASEMBC(0x128) CASEMBC(0x12a) CASEMBC(0x12c) CASEMBC(0x12e) CASEMBC(0x130) CASEMBC(0x1cf) CASEMBC(0x1ec8) - regmbc('I'); regmbc('\314'); regmbc('\315'); - regmbc('\316'); regmbc('\317'); + regmbc('I'); regmbc(0xcc); regmbc(0xcd); + regmbc(0xce); regmbc(0xcf); REGMBC(0x128) REGMBC(0x12a) REGMBC(0x12c) REGMBC(0x12e) REGMBC(0x130) REGMBC(0x1cf) REGMBC(0x1ec8) @@ -918,20 +915,20 @@ reg_equi_class(c) case 'M': CASEMBC(0x1e3e) CASEMBC(0x1e40) regmbc('M'); REGMBC(0x1e3e) REGMBC(0x1e40) return; - case 'N': case '\321': + case 'N': case 0xd1: CASEMBC(0x143) CASEMBC(0x145) CASEMBC(0x147) CASEMBC(0x1e44) CASEMBC(0x1e48) - regmbc('N'); regmbc('\321'); + regmbc('N'); regmbc(0xd1); REGMBC(0x143) REGMBC(0x145) REGMBC(0x147) REGMBC(0x1e44) REGMBC(0x1e48) return; - case 'O': case '\322': case '\323': case '\324': case '\325': - case '\326': case '\330': + case 'O': case 0xd2: case 0xd3: case 0xd4: case 0xd5: + case 0xd6: case 0xd8: CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) CASEMBC(0x1a0) CASEMBC(0x1d1) CASEMBC(0x1ea) CASEMBC(0x1ec) CASEMBC(0x1ece) - regmbc('O'); regmbc('\322'); regmbc('\323'); - regmbc('\324'); regmbc('\325'); regmbc('\326'); - regmbc('\330'); + regmbc('O'); regmbc(0xd2); regmbc(0xd3); + regmbc(0xd4); regmbc(0xd5); regmbc(0xd6); + regmbc(0xd8); REGMBC(0x14c) REGMBC(0x14e) REGMBC(0x150) REGMBC(0x1a0) REGMBC(0x1d1) REGMBC(0x1ea) REGMBC(0x1ec) REGMBC(0x1ece) @@ -954,12 +951,12 @@ reg_equi_class(c) regmbc('T'); REGMBC(0x162) REGMBC(0x164) REGMBC(0x166) REGMBC(0x1e6a) REGMBC(0x1e6e) return; - case 'U': case '\331': case '\332': case '\333': case '\334': + case 'U': case 0xd9: case 0xda: case 0xdb: case 0xdc: CASEMBC(0x168) CASEMBC(0x16a) CASEMBC(0x16c) CASEMBC(0x16e) CASEMBC(0x170) CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) CASEMBC(0x1ee6) - regmbc('U'); regmbc('\331'); regmbc('\332'); - regmbc('\333'); regmbc('\334'); + regmbc('U'); regmbc(0xd9); regmbc(0xda); + regmbc(0xdb); regmbc(0xdc); REGMBC(0x168) REGMBC(0x16a) REGMBC(0x16c) REGMBC(0x16e) REGMBC(0x170) REGMBC(0x172) REGMBC(0x1af) REGMBC(0x1d3) REGMBC(0x1ee6) @@ -975,10 +972,10 @@ reg_equi_class(c) case 'X': CASEMBC(0x1e8a) CASEMBC(0x1e8c) regmbc('X'); REGMBC(0x1e8a) REGMBC(0x1e8c) return; - case 'Y': case '\335': + case 'Y': case 0xdd: CASEMBC(0x176) CASEMBC(0x178) CASEMBC(0x1e8e) CASEMBC(0x1ef2) CASEMBC(0x1ef6) CASEMBC(0x1ef8) - regmbc('Y'); regmbc('\335'); + regmbc('Y'); regmbc(0xdd); REGMBC(0x176) REGMBC(0x178) REGMBC(0x1e8e) REGMBC(0x1ef2) REGMBC(0x1ef6) REGMBC(0x1ef8) return; @@ -988,13 +985,13 @@ reg_equi_class(c) REGMBC(0x17d) REGMBC(0x1b5) REGMBC(0x1e90) REGMBC(0x1e94) return; - case 'a': case '\340': case '\341': case '\342': - case '\343': case '\344': case '\345': + case 'a': case 0xe0: case 0xe1: case 0xe2: + case 0xe3: case 0xe4: case 0xe5: CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) CASEMBC(0x1ce) CASEMBC(0x1df) CASEMBC(0x1e1) CASEMBC(0x1ea3) - regmbc('a'); regmbc('\340'); regmbc('\341'); - regmbc('\342'); regmbc('\343'); regmbc('\344'); - regmbc('\345'); + regmbc('a'); regmbc(0xe0); regmbc(0xe1); + regmbc(0xe2); regmbc(0xe3); regmbc(0xe4); + regmbc(0xe5); REGMBC(0x101) REGMBC(0x103) REGMBC(0x105) REGMBC(0x1ce) REGMBC(0x1df) REGMBC(0x1e1) REGMBC(0x1ea3) @@ -1002,22 +999,22 @@ reg_equi_class(c) case 'b': CASEMBC(0x1e03) CASEMBC(0x1e07) regmbc('b'); REGMBC(0x1e03) REGMBC(0x1e07) return; - case 'c': case '\347': + case 'c': case 0xe7: CASEMBC(0x107) CASEMBC(0x109) CASEMBC(0x10b) CASEMBC(0x10d) - regmbc('c'); regmbc('\347'); + regmbc('c'); regmbc(0xe7); REGMBC(0x107) REGMBC(0x109) REGMBC(0x10b) REGMBC(0x10d) return; - case 'd': CASEMBC(0x10f) CASEMBC(0x111) CASEMBC(0x1d0b) - CASEMBC(0x1e11) + case 'd': CASEMBC(0x10f) CASEMBC(0x111) CASEMBC(0x1e0b) + CASEMBC(0x1e0f) CASEMBC(0x1e11) regmbc('d'); REGMBC(0x10f) REGMBC(0x111) - REGMBC(0x1e0b) REGMBC(0x01e0f) REGMBC(0x1e11) + REGMBC(0x1e0b) REGMBC(0x1e0f) REGMBC(0x1e11) return; - case 'e': case '\350': case '\351': case '\352': case '\353': + case 'e': case 0xe8: case 0xe9: case 0xea: case 0xeb: CASEMBC(0x113) CASEMBC(0x115) CASEMBC(0x117) CASEMBC(0x119) CASEMBC(0x11b) CASEMBC(0x1ebb) CASEMBC(0x1ebd) - regmbc('e'); regmbc('\350'); regmbc('\351'); - regmbc('\352'); regmbc('\353'); + regmbc('e'); regmbc(0xe8); regmbc(0xe9); + regmbc(0xea); regmbc(0xeb); REGMBC(0x113) REGMBC(0x115) REGMBC(0x117) REGMBC(0x119) REGMBC(0x11b) REGMBC(0x1ebb) REGMBC(0x1ebd) @@ -1038,11 +1035,11 @@ reg_equi_class(c) REGMBC(0x1e23) REGMBC(0x1e27) REGMBC(0x1e29) REGMBC(0x1e96) return; - case 'i': case '\354': case '\355': case '\356': case '\357': + case 'i': case 0xec: case 0xed: case 0xee: case 0xef: CASEMBC(0x129) CASEMBC(0x12b) CASEMBC(0x12d) CASEMBC(0x12f) CASEMBC(0x1d0) CASEMBC(0x1ec9) - regmbc('i'); regmbc('\354'); regmbc('\355'); - regmbc('\356'); regmbc('\357'); + regmbc('i'); regmbc(0xec); regmbc(0xed); + regmbc(0xee); regmbc(0xef); REGMBC(0x129) REGMBC(0x12b) REGMBC(0x12d) REGMBC(0x12f) REGMBC(0x1d0) REGMBC(0x1ec9) return; @@ -1063,20 +1060,20 @@ reg_equi_class(c) case 'm': CASEMBC(0x1e3f) CASEMBC(0x1e41) regmbc('m'); REGMBC(0x1e3f) REGMBC(0x1e41) return; - case 'n': case '\361': + case 'n': case 0xf1: CASEMBC(0x144) CASEMBC(0x146) CASEMBC(0x148) CASEMBC(0x149) CASEMBC(0x1e45) CASEMBC(0x1e49) - regmbc('n'); regmbc('\361'); + regmbc('n'); regmbc(0xf1); REGMBC(0x144) REGMBC(0x146) REGMBC(0x148) REGMBC(0x149) REGMBC(0x1e45) REGMBC(0x1e49) return; - case 'o': case '\362': case '\363': case '\364': case '\365': - case '\366': case '\370': + case 'o': case 0xf2: case 0xf3: case 0xf4: case 0xf5: + case 0xf6: case 0xf8: CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) CASEMBC(0x1a1) CASEMBC(0x1d2) CASEMBC(0x1eb) CASEMBC(0x1ed) CASEMBC(0x1ecf) - regmbc('o'); regmbc('\362'); regmbc('\363'); - regmbc('\364'); regmbc('\365'); regmbc('\366'); - regmbc('\370'); + regmbc('o'); regmbc(0xf2); regmbc(0xf3); + regmbc(0xf4); regmbc(0xf5); regmbc(0xf6); + regmbc(0xf8); REGMBC(0x14d) REGMBC(0x14f) REGMBC(0x151) REGMBC(0x1a1) REGMBC(0x1d2) REGMBC(0x1eb) REGMBC(0x1ed) REGMBC(0x1ecf) @@ -1099,12 +1096,12 @@ reg_equi_class(c) regmbc('t'); REGMBC(0x163) REGMBC(0x165) REGMBC(0x167) REGMBC(0x1e6b) REGMBC(0x1e6f) REGMBC(0x1e97) return; - case 'u': case '\371': case '\372': case '\373': case '\374': + case 'u': case 0xf9: case 0xfa: case 0xfb: case 0xfc: CASEMBC(0x169) CASEMBC(0x16b) CASEMBC(0x16d) CASEMBC(0x16f) CASEMBC(0x171) CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) CASEMBC(0x1ee7) - regmbc('u'); regmbc('\371'); regmbc('\372'); - regmbc('\373'); regmbc('\374'); + regmbc('u'); regmbc(0xf9); regmbc(0xfa); + regmbc(0xfb); regmbc(0xfc); REGMBC(0x169) REGMBC(0x16b) REGMBC(0x16d) REGMBC(0x16f) REGMBC(0x171) REGMBC(0x173) REGMBC(0x1b0) REGMBC(0x1d4) REGMBC(0x1ee7) @@ -1121,10 +1118,10 @@ reg_equi_class(c) case 'x': CASEMBC(0x1e8b) CASEMBC(0x1e8d) regmbc('x'); REGMBC(0x1e8b) REGMBC(0x1e8d) return; - case 'y': case '\375': case '\377': + case 'y': case 0xfd: case 0xff: CASEMBC(0x177) CASEMBC(0x1e8f) CASEMBC(0x1e99) CASEMBC(0x1ef3) CASEMBC(0x1ef7) CASEMBC(0x1ef9) - regmbc('y'); regmbc('\375'); regmbc('\377'); + regmbc('y'); regmbc(0xfd); regmbc(0xff); REGMBC(0x177) REGMBC(0x1e8f) REGMBC(0x1e99) REGMBC(0x1ef3) REGMBC(0x1ef7) REGMBC(0x1ef9) return; @@ -1147,14 +1144,13 @@ reg_equi_class(c) * Currently only single characters are recognized! */ static int -get_coll_element(pp) - char_u **pp; +get_coll_element(char_u **pp) { int c; int l = 1; char_u *p = *pp; - if (p[1] == '.') + if (p[0] != NUL && p[1] == '.') { #ifdef FEAT_MBYTE if (has_mbyte) @@ -1175,12 +1171,12 @@ get_coll_element(pp) return 0; } -static void get_cpo_flags __ARGS((void)); +static void get_cpo_flags(void); static int reg_cpo_lit; /* 'cpoptions' contains 'l' flag */ static int reg_cpo_bsl; /* 'cpoptions' contains '\' flag */ static void -get_cpo_flags() +get_cpo_flags(void) { reg_cpo_lit = vim_strchr(p_cpo, CPO_LITERAL) != NULL; reg_cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL; @@ -1192,8 +1188,7 @@ get_cpo_flags() * The returned pointer is on the matching ']', or the terminating NUL. */ static char_u * -skip_anyof(p) - char_u *p; +skip_anyof(char_u *p) { #ifdef FEAT_MBYTE int l; @@ -1214,7 +1209,7 @@ skip_anyof(p) { ++p; if (*p != ']' && *p != NUL) - mb_ptr_adv(p); + MB_PTR_ADV(p); } else if (*p == '\\' && !reg_cpo_bsl @@ -1225,8 +1220,9 @@ skip_anyof(p) { if (get_char_class(&p) == CLASS_NONE && get_equi_class(&p) == 0 - && get_coll_element(&p) == 0) - ++p; /* It was not a class name */ + && get_coll_element(&p) == 0 + && *p != NUL) + ++p; /* it is not a class name and not NUL */ } else ++p; @@ -1245,11 +1241,11 @@ skip_anyof(p) * is changed in-place. */ char_u * -skip_regexp(startp, dirc, magic, newp) - char_u *startp; - int dirc; - int magic; - char_u **newp; +skip_regexp( + char_u *startp, + int dirc, + int magic, + char_u **newp) { int mymagic; char_u *p = startp; @@ -1260,7 +1256,7 @@ skip_regexp(startp, dirc, magic, newp) mymagic = MAGIC_OFF; get_cpo_flags(); - for (; p[0] != NUL; mb_ptr_adv(p)) + for (; p[0] != NUL; MB_PTR_ADV(p)) { if (p[0] == dirc) /* found end of regexp */ break; @@ -1298,8 +1294,36 @@ skip_regexp(startp, dirc, magic, newp) return p; } -static regprog_T *bt_regcomp __ARGS((char_u *expr, int re_flags)); -static void bt_regfree __ARGS((regprog_T *prog)); +/* + * Return TRUE if the back reference is legal. We must have seen the close + * brace. + * TODO: Should also check that we don't refer to something that is repeated + * (+*=): what instance of the repetition should we match? + */ + static int +seen_endbrace(int refnum) +{ + if (!had_endbrace[refnum]) + { + char_u *p; + + /* Trick: check if "@<=" or "@<!" follows, in which case + * the \1 can appear before the referenced match. */ + for (p = regparse; *p != NUL; ++p) + if (p[0] == '@' && p[1] == '<' && (p[2] == '!' || p[2] == '=')) + break; + if (*p == NUL) + { + EMSG(_("E65: Illegal back reference")); + rc_did_emsg = TRUE; + return FALSE; + } + } + return TRUE; +} + +static regprog_T *bt_regcomp(char_u *expr, int re_flags); +static void bt_regfree(regprog_T *prog); /* * bt_regcomp() - compile a regular expression into internal code for the @@ -1323,9 +1347,7 @@ static void bt_regfree __ARGS((regprog_T *prog)); * "re_flags": RE_MAGIC and/or RE_STRING. */ static regprog_T * -bt_regcomp(expr, re_flags) - char_u *expr; - int re_flags; +bt_regcomp(char_u *expr, int re_flags) { bt_regprog_T *r; char_u *scan; @@ -1347,12 +1369,6 @@ bt_regcomp(expr, re_flags) if (reg(REG_NOPAREN, &flags) == NULL) return NULL; - /* Small enough for pointer-storage convention? */ -#ifdef SMALL_MALLOC /* 16 bit storage allocation */ - if (regsize >= 65536L - 256L) - EMSG_RET_NULL(_("E339: Pattern too long")); -#endif - /* Allocate space. */ r = (bt_regprog_T *)lalloc(sizeof(bt_regprog_T) + regsize, TRUE); if (r == NULL) @@ -1460,8 +1476,7 @@ bt_regcomp(expr, re_flags) * Free a compiled regexp program, returned by bt_regcomp(). */ static void -bt_regfree(prog) - regprog_T *prog; +bt_regfree(regprog_T *prog) { vim_free(prog); } @@ -1470,9 +1485,9 @@ bt_regfree(prog) * Setup to parse the regexp. Used once to get the length and once to do it. */ static void -regcomp_start(expr, re_flags) - char_u *expr; - int re_flags; /* see vim_regcomp() */ +regcomp_start( + char_u *expr, + int re_flags) /* see vim_regcomp() */ { initchr(expr); if (re_flags & RE_MAGIC) @@ -1504,12 +1519,16 @@ regcomp_start(expr, re_flags) * found. This is messy, but it works fine. */ int -vim_regcomp_had_eol() +vim_regcomp_had_eol(void) { return had_eol; } #endif +/* variables for parsing reginput */ +static int at_start; /* True when on the first character */ +static int prev_at_start; /* True when on the second character */ + /* * Parse regular expression, i.e. main body or parenthesized thing. * @@ -1520,9 +1539,9 @@ vim_regcomp_had_eol() * follows makes it hard to avoid. */ static char_u * -reg(paren, flagp) - int paren; /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */ - int *flagp; +reg( + int paren, /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */ + int *flagp) { char_u *ret; char_u *br; @@ -1635,8 +1654,7 @@ reg(paren, flagp) * Implements the & operator. */ static char_u * -regbranch(flagp) - int *flagp; +regbranch(int *flagp) { char_u *ret; char_u *chain = NULL; @@ -1678,8 +1696,7 @@ regbranch(flagp) * Implements the concatenation operator. */ static char_u * -regconcat(flagp) - int *flagp; +regconcat(int *flagp) { char_u *first = NULL; char_u *chain = NULL; @@ -1763,8 +1780,7 @@ regconcat(flagp) * endmarker role is not redundant. */ static char_u * -regpiece(flagp) - int *flagp; +regpiece(int *flagp) { char_u *ret; int op; @@ -1821,7 +1837,7 @@ regpiece(flagp) case Magic('@'): { int lop = END; - int nr; + long nr; nr = getdecchrs(); switch (no_Magic(getchr())) @@ -1924,14 +1940,14 @@ static int classcodes[] = { * faster to run. Don't do this when one_exactly is set. */ static char_u * -regatom(flagp) - int *flagp; +regatom(int *flagp) { char_u *ret; int flags; int c; char_u *p; int extra = 0; + int save_prev_at_start = prev_at_start; *flagp = WORST; /* Tentatively. */ @@ -1981,7 +1997,7 @@ regatom(flagp) goto collection; /* "\_x" is character class plus newline */ - /*FALLTHROUGH*/ + /* FALLTHROUGH */ /* * Character classes. @@ -2061,7 +2077,7 @@ regatom(flagp) case Magic(')'): if (one_exactly) EMSG_ONE_RET_NULL; - EMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */ + IEMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */ /* NOTREACHED */ case Magic('='): @@ -2111,24 +2127,8 @@ regatom(flagp) int refnum; refnum = c - Magic('0'); - /* - * Check if the back reference is legal. We must have seen the - * close brace. - * TODO: Should also check that we don't refer to something - * that is repeated (+*=): what instance of the repetition - * should we match? - */ - if (!had_endbrace[refnum]) - { - /* Trick: check if "@<=" or "@<!" follows, in which case - * the \1 can appear before the referenced match. */ - for (p = regparse; *p != NUL; ++p) - if (p[0] == '@' && p[1] == '<' - && (p[2] == '!' || p[2] == '=')) - break; - if (*p == NUL) - EMSG_RET_NULL(_("E65: Illegal back reference")); - } + if (!seen_endbrace(refnum)) + return NULL; ret = regnode(BACKREF + refnum); } break; @@ -2166,9 +2166,13 @@ regatom(flagp) #endif case 's': ret = regnode(MOPEN + 0); + if (re_mult_next("\\zs") == FAIL) + return NULL; break; case 'e': ret = regnode(MCLOSE + 0); + if (re_mult_next("\\ze") == FAIL) + return NULL; break; default: EMSG_RET_NULL(_("E68: Invalid character after \\z")); @@ -2274,7 +2278,7 @@ regatom(flagp) case 'u': /* %uabcd hex 4 */ case 'U': /* %U1234abcd hex 8 */ { - int i; + long i; switch (c) { @@ -2341,7 +2345,11 @@ regatom(flagp) else if (c == 'l' || c == 'c' || c == 'v') { if (c == 'l') + { ret = regnode(RE_LNUM); + if (save_prev_at_start) + at_start = TRUE; + } else if (c == 'c') ret = regnode(RE_COL); else @@ -2434,14 +2442,14 @@ regatom(flagp) endc = coll_get_char(); if (startc > endc) - EMSG_RET_NULL(_(e_invrange)); + EMSG_RET_NULL(_(e_reverse_range)); #ifdef FEAT_MBYTE if (has_mbyte && ((*mb_char2len)(startc) > 1 || (*mb_char2len)(endc) > 1)) { - /* Limit to a range of 256 chars */ + /* Limit to a range of 256 chars. */ if (endc > startc + 256) - EMSG_RET_NULL(_(e_invrange)); + EMSG_RET_NULL(_(e_large_class)); while (++startc <= endc) regmbc(startc); } @@ -2549,48 +2557,49 @@ regatom(flagp) } break; case CLASS_ALNUM: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu < 128; cu++) if (isalnum(cu)) - regc(cu); + regmbc(cu); break; case CLASS_ALPHA: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu < 128; cu++) if (isalpha(cu)) - regc(cu); + regmbc(cu); break; case CLASS_BLANK: regc(' '); regc('\t'); break; case CLASS_CNTRL: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu <= 127; cu++) if (iscntrl(cu)) - regc(cu); + regmbc(cu); break; case CLASS_DIGIT: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu <= 127; cu++) if (VIM_ISDIGIT(cu)) - regc(cu); + regmbc(cu); break; case CLASS_GRAPH: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu <= 127; cu++) if (isgraph(cu)) - regc(cu); + regmbc(cu); break; case CLASS_LOWER: for (cu = 1; cu <= 255; cu++) - if (MB_ISLOWER(cu)) - regc(cu); + if (MB_ISLOWER(cu) && cu != 170 + && cu != 186) + regmbc(cu); break; case CLASS_PRINT: for (cu = 1; cu <= 255; cu++) if (vim_isprintc(cu)) - regc(cu); + regmbc(cu); break; case CLASS_PUNCT: - for (cu = 1; cu <= 255; cu++) + for (cu = 1; cu < 128; cu++) if (ispunct(cu)) - regc(cu); + regmbc(cu); break; case CLASS_SPACE: for (cu = 9; cu <= 13; cu++) @@ -2600,12 +2609,12 @@ regatom(flagp) case CLASS_UPPER: for (cu = 1; cu <= 255; cu++) if (MB_ISUPPER(cu)) - regc(cu); + regmbc(cu); break; case CLASS_XDIGIT: for (cu = 1; cu <= 255; cu++) if (vim_isxdigit(cu)) - regc(cu); + regmbc(cu); break; case CLASS_TAB: regc('\t'); @@ -2735,8 +2744,7 @@ regatom(flagp) * character "c". */ static int -use_multibytecode(c) - int c; +use_multibytecode(int c) { return has_mbyte && (*mb_char2len)(c) > 1 && (re_multi_type(peekchr()) != NOT_MULTI @@ -2749,8 +2757,7 @@ use_multibytecode(c) * Return pointer to generated code. */ static char_u * -regnode(op) - int op; +regnode(int op) { char_u *ret; @@ -2770,8 +2777,7 @@ regnode(op) * Emit (if appropriate) a byte of code */ static void -regc(b) - int b; +regc(int b) { if (regcode == JUST_CALC_SIZE) regsize++; @@ -2784,8 +2790,7 @@ regc(b) * Emit (if appropriate) a multi-byte character of code */ static void -regmbc(c) - int c; +regmbc(int c) { if (!has_mbyte && c > 0xff) return; @@ -2802,9 +2807,7 @@ regmbc(c) * Means relocating the operand. */ static void -reginsert(op, opnd) - int op; - char_u *opnd; +reginsert(int op, char_u *opnd) { char_u *src; char_u *dst; @@ -2832,10 +2835,7 @@ reginsert(op, opnd) * Add a number to the operator. */ static void -reginsert_nr(op, val, opnd) - int op; - long val; - char_u *opnd; +reginsert_nr(int op, long val, char_u *opnd) { char_u *src; char_u *dst; @@ -2866,11 +2866,11 @@ reginsert_nr(op, val, opnd) * Means relocating the operand. */ static void -reginsert_limits(op, minval, maxval, opnd) - int op; - long minval; - long maxval; - char_u *opnd; +reginsert_limits( + int op, + long minval, + long maxval, + char_u *opnd) { char_u *src; char_u *dst; @@ -2900,9 +2900,7 @@ reginsert_limits(op, minval, maxval, opnd) * Write a long as four bytes at "p" and return pointer to the next char. */ static char_u * -re_put_long(p, val) - char_u *p; - long_u val; +re_put_long(char_u *p, long_u val) { *p++ = (char_u) ((val >> 24) & 0377); *p++ = (char_u) ((val >> 16) & 0377); @@ -2915,9 +2913,7 @@ re_put_long(p, val) * Set the next-pointer at the end of a node chain. */ static void -regtail(p, val) - char_u *p; - char_u *val; +regtail(char_u *p, char_u *val) { char_u *scan; char_u *temp; @@ -2956,9 +2952,7 @@ regtail(p, val) * Like regtail, on item after a BRANCH; nop if none. */ static void -regoptail(p, val) - char_u *p; - char_u *val; +regoptail(char_u *p, char_u *val) { /* When op is neither BRANCH nor BRACE_COMPLEX0-9, it is "operandless" */ if (p == NULL || p == JUST_CALC_SIZE @@ -2971,16 +2965,11 @@ regoptail(p, val) /* * Functions for getting characters from the regexp input. */ - -static int at_start; /* True when on the first character */ -static int prev_at_start; /* True when on the second character */ - /* * Start parsing at "str". */ static void -initchr(str) - char_u *str; +initchr(char_u *str) { regparse = str; prevchr_len = 0; @@ -2994,8 +2983,7 @@ initchr(str) * starts in the same state again. */ static void -save_parse_state(ps) - parse_state_T *ps; +save_parse_state(parse_state_T *ps) { ps->regparse = regparse; ps->prevchr_len = prevchr_len; @@ -3012,8 +3000,7 @@ save_parse_state(ps) * Restore a previously saved parse state. */ static void -restore_parse_state(ps) - parse_state_T *ps; +restore_parse_state(parse_state_T *ps) { regparse = ps->regparse; prevchr_len = ps->prevchr_len; @@ -3031,7 +3018,7 @@ restore_parse_state(ps) * Get the next character without advancing. */ static int -peekchr() +peekchr(void) { static int after_slash = FALSE; @@ -3149,7 +3136,7 @@ peekchr() /* * META contains everything that may be magic sometimes, * except ^ and $ ("\^" and "\$" are only magic after - * "\v"). We now fetch the next character and toggle its + * "\V"). We now fetch the next character and toggle its * magicness. Therefore, \ is so meta-magic that it is * not in META. */ @@ -3203,7 +3190,7 @@ peekchr() * Eat one lexed character. Do this in a way that we can undo it. */ static void -skipchr() +skipchr(void) { /* peekchr() eats a backslash, do the same here */ if (*regparse == '\\') @@ -3236,7 +3223,7 @@ skipchr() * prevchr and prevprevchr are also kept. */ static void -skipchr_keepstart() +skipchr_keepstart(void) { int as = prev_at_start; int pr = prevchr; @@ -3253,7 +3240,7 @@ skipchr_keepstart() * therefore we need a lexical analyzer. */ static int -getchr() +getchr(void) { int chr = peekchr(); @@ -3265,7 +3252,7 @@ getchr() * put character back. Works only once! */ static void -ungetchr() +ungetchr(void) { nextchr = curchr; curchr = prevchr; @@ -3287,11 +3274,10 @@ ungetchr() * The parameter controls the maximum number of input characters. This will be * 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence. */ - static int -gethexchrs(maxinputlen) - int maxinputlen; + static long +gethexchrs(int maxinputlen) { - int nr = 0; + long_u nr = 0; int c; int i; @@ -3307,17 +3293,17 @@ gethexchrs(maxinputlen) if (i == 0) return -1; - return nr; + return (long)nr; } /* * Get and return the value of the decimal string immediately after the * current position. Return -1 for invalid. Consumes all digits. */ - static int -getdecchrs() + static long +getdecchrs(void) { - int nr = 0; + long_u nr = 0; int c; int i; @@ -3334,7 +3320,7 @@ getdecchrs() if (i == 0) return -1; - return nr; + return (long)nr; } /* @@ -3345,10 +3331,10 @@ getdecchrs() * blahblah\%o210asdf * before-^ ^-after */ - static int -getoctchrs() + static long +getoctchrs(void) { - int nr = 0; + long_u nr = 0; int c; int i; @@ -3364,7 +3350,7 @@ getoctchrs() if (i == 0) return -1; - return nr; + return (long)nr; } /* @@ -3372,9 +3358,9 @@ getoctchrs() * When nothing is recognized return a backslash. */ static int -coll_get_char() +coll_get_char(void) { - int nr = -1; + long nr = -1; switch (*regparse++) { @@ -3401,9 +3387,7 @@ coll_get_char() * missing, a very big number is the default. */ static int -read_limits(minval, maxval) - long *minval; - long *maxval; +read_limits(long *minval, long *maxval) { int reverse = FALSE; char_u *first_char; @@ -3506,21 +3490,21 @@ typedef struct regbehind_S save_se_T save_end[NSUBEXP]; } regbehind_T; -static char_u *reg_getline __ARGS((linenr_T lnum)); -static long bt_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm)); -static long regtry __ARGS((bt_regprog_T *prog, colnr_T col)); -static void cleanup_subexpr __ARGS((void)); +static char_u *reg_getline(linenr_T lnum); +static long bt_regexec_both(char_u *line, colnr_T col, proftime_T *tm, int *timed_out); +static long regtry(bt_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out); +static void cleanup_subexpr(void); #ifdef FEAT_SYN_HL -static void cleanup_zsubexpr __ARGS((void)); +static void cleanup_zsubexpr(void); #endif -static void save_subexpr __ARGS((regbehind_T *bp)); -static void restore_subexpr __ARGS((regbehind_T *bp)); -static void reg_nextline __ARGS((void)); -static void reg_save __ARGS((regsave_T *save, garray_T *gap)); -static void reg_restore __ARGS((regsave_T *save, garray_T *gap)); -static int reg_save_equal __ARGS((regsave_T *save)); -static void save_se_multi __ARGS((save_se_T *savep, lpos_T *posp)); -static void save_se_one __ARGS((save_se_T *savep, char_u **pp)); +static void save_subexpr(regbehind_T *bp); +static void restore_subexpr(regbehind_T *bp); +static void reg_nextline(void); +static void reg_save(regsave_T *save, garray_T *gap); +static void reg_restore(regsave_T *save, garray_T *gap); +static int reg_save_equal(regsave_T *save); +static void save_se_multi(save_se_T *savep, lpos_T *posp); +static void save_se_one(save_se_T *savep, char_u **pp); /* Save the sub-expressions before attempting a match. */ #define save_se(savep, posp, pp) \ @@ -3533,36 +3517,15 @@ static void save_se_one __ARGS((save_se_T *savep, char_u **pp)); else \ *(pp) = (savep)->se_u.ptr; } -static int re_num_cmp __ARGS((long_u val, char_u *scan)); -static int match_with_backref __ARGS((linenr_T start_lnum, colnr_T start_col, linenr_T end_lnum, colnr_T end_col, int *bytelen)); -static int regmatch __ARGS((char_u *prog)); -static int regrepeat __ARGS((char_u *p, long maxcount)); +static int re_num_cmp(long_u val, char_u *scan); +static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T end_lnum, colnr_T end_col, int *bytelen); +static int regmatch(char_u *prog, proftime_T *tm, int *timed_out); +static int regrepeat(char_u *p, long maxcount); #ifdef DEBUG int regnarrate = 0; #endif -/* - * Internal copy of 'ignorecase'. It is set at each call to vim_regexec(). - * Normally it gets the value of "rm_ic" or "rmm_ic", but when the pattern - * contains '\c' or '\C' the value is overruled. - */ -static int ireg_ic; - -#ifdef FEAT_MBYTE -/* - * Similar to ireg_ic, but only for 'combining' characters. Set with \Z flag - * in the regexp. Defaults to false, always. - */ -static int ireg_icombine; -#endif - -/* - * Copy of "rmm_maxcol": maximum column to search for a match. Zero when - * there is no maximum. - */ -static colnr_T ireg_maxcol; - /* * Sometimes need to save a copy of a line. Since alloc()/free() is very * slow, we keep one allocated piece of memory and only re-allocate it when @@ -3572,7 +3535,7 @@ static char_u *reg_tofree = NULL; static unsigned reg_tofreelen; /* - * These variables are set when executing a regexp to speed up the execution. + * Structure used to store the execution state of the regex engine. * Which ones are set depends on whether a single-line or multi-line match is * done: * single-line multi-line @@ -3588,17 +3551,38 @@ static unsigned reg_tofreelen; * reg_maxline 0 last line nr * reg_line_lbr FALSE or TRUE FALSE */ -static regmatch_T *reg_match; -static regmmatch_T *reg_mmatch; -static char_u **reg_startp = NULL; -static char_u **reg_endp = NULL; -static lpos_T *reg_startpos = NULL; -static lpos_T *reg_endpos = NULL; -static win_T *reg_win; -static buf_T *reg_buf; -static linenr_T reg_firstlnum; -static linenr_T reg_maxline; -static int reg_line_lbr; /* "\n" in string is line break */ +typedef struct { + regmatch_T *reg_match; + regmmatch_T *reg_mmatch; + char_u **reg_startp; + char_u **reg_endp; + lpos_T *reg_startpos; + lpos_T *reg_endpos; + win_T *reg_win; + buf_T *reg_buf; + linenr_T reg_firstlnum; + linenr_T reg_maxline; + int reg_line_lbr; /* "\n" in string is line break */ + + /* Internal copy of 'ignorecase'. It is set at each call to vim_regexec(). + * Normally it gets the value of "rm_ic" or "rmm_ic", but when the pattern + * contains '\c' or '\C' the value is overruled. */ + int reg_ic; + +#ifdef FEAT_MBYTE + /* Similar to rex.reg_ic, but only for 'combining' characters. Set with \Z + * flag in the regexp. Defaults to false, always. */ + int reg_icombine; +#endif + + /* Copy of "rmm_maxcol": maximum column to search for a match. Zero when + * there is no maximum. */ + colnr_T reg_maxcol; +} regexec_T; + +static regexec_T rex; +static int rex_in_use = FALSE; + /* Values for rs_state in regitem_T. */ typedef enum regstate_E @@ -3639,8 +3623,8 @@ typedef struct regitem_S short rs_no; /* submatch nr or BEHIND/NOBEHIND */ } regitem_T; -static regitem_T *regstack_push __ARGS((regstate_T state, char_u *scan)); -static void regstack_pop __ARGS((char_u **scan)); +static regitem_T *regstack_push(regstate_T state, char_u *scan); +static void regstack_pop(char_u **scan); /* used for STAR, PLUS and BRACE_SIMPLE matching */ typedef struct regstar_S @@ -3686,7 +3670,7 @@ static garray_T backpos = {0, 0, 0, 0, NULL}; #if defined(EXITFREE) || defined(PROTO) void -free_regexp_stuff() +free_regexp_stuff(void) { ga_clear(®stack); ga_clear(&backpos); @@ -3699,17 +3683,16 @@ free_regexp_stuff() * Get pointer to the line "lnum", which is relative to "reg_firstlnum". */ static char_u * -reg_getline(lnum) - linenr_T lnum; +reg_getline(linenr_T lnum) { /* when looking behind for a match/no-match lnum is negative. But we * can't go before line 1 */ - if (reg_firstlnum + lnum < 1) + if (rex.reg_firstlnum + lnum < 1) return NULL; - if (lnum > reg_maxline) + if (lnum > rex.reg_maxline) /* Must have matched the "\n" in the last line. */ return (char_u *)""; - return ml_get_buf(reg_buf, reg_firstlnum + lnum, FALSE); + return ml_get_buf(rex.reg_buf, rex.reg_firstlnum + lnum, FALSE); } static regsave_T behind_pos; @@ -3722,10 +3705,7 @@ static lpos_T reg_endzpos[NSUBEXP]; /* idem, end pos */ #endif /* TRUE if using multi-line regexp. */ -#define REG_MULTI (reg_match == NULL) - -static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr)); - +#define REG_MULTI (rex.reg_match == NULL) /* * Match a regexp against a string. @@ -3733,30 +3713,29 @@ static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, in * Uses curbuf for line count and 'iskeyword'. * if "line_lbr" is TRUE consider a "\n" in "line" to be a line break. * - * Return TRUE if there is a match, FALSE if not. + * Returns 0 for failure, number of lines contained in the match otherwise. */ static int -bt_regexec_nl(rmp, line, col, line_lbr) - regmatch_T *rmp; - char_u *line; /* string to match against */ - colnr_T col; /* column to start looking for match */ - int line_lbr; +bt_regexec_nl( + regmatch_T *rmp, + char_u *line, /* string to match against */ + colnr_T col, /* column to start looking for match */ + int line_lbr) { - reg_match = rmp; - reg_mmatch = NULL; - reg_maxline = 0; - reg_line_lbr = line_lbr; - reg_buf = curbuf; - reg_win = NULL; - ireg_ic = rmp->rm_ic; + rex.reg_match = rmp; + rex.reg_mmatch = NULL; + rex.reg_maxline = 0; + rex.reg_line_lbr = line_lbr; + rex.reg_buf = curbuf; + rex.reg_win = NULL; + rex.reg_ic = rmp->rm_ic; #ifdef FEAT_MBYTE - ireg_icombine = FALSE; + rex.reg_icombine = FALSE; #endif - ireg_maxcol = 0; - return (bt_regexec_both(line, col, NULL) != 0); -} + rex.reg_maxcol = 0; -static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); + return bt_regexec_both(line, col, NULL, NULL); +} /* * Match a regexp against multiple lines. @@ -3767,47 +3746,46 @@ static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, l * match otherwise. */ static long -bt_regexec_multi(rmp, win, buf, lnum, col, tm) - regmmatch_T *rmp; - win_T *win; /* window in which to search or NULL */ - buf_T *buf; /* buffer in which to search */ - linenr_T lnum; /* nr of line to start looking for match */ - colnr_T col; /* column to start looking for match */ - proftime_T *tm; /* timeout limit or NULL */ +bt_regexec_multi( + regmmatch_T *rmp, + win_T *win, /* window in which to search or NULL */ + buf_T *buf, /* buffer in which to search */ + linenr_T lnum, /* nr of line to start looking for match */ + colnr_T col, /* column to start looking for match */ + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { - long r; - - reg_match = NULL; - reg_mmatch = rmp; - reg_buf = buf; - reg_win = win; - reg_firstlnum = lnum; - reg_maxline = reg_buf->b_ml.ml_line_count - lnum; - reg_line_lbr = FALSE; - ireg_ic = rmp->rmm_ic; + rex.reg_match = NULL; + rex.reg_mmatch = rmp; + rex.reg_buf = buf; + rex.reg_win = win; + rex.reg_firstlnum = lnum; + rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum; + rex.reg_line_lbr = FALSE; + rex.reg_ic = rmp->rmm_ic; #ifdef FEAT_MBYTE - ireg_icombine = FALSE; + rex.reg_icombine = FALSE; #endif - ireg_maxcol = rmp->rmm_maxcol; - - r = bt_regexec_both(NULL, col, tm); + rex.reg_maxcol = rmp->rmm_maxcol; - return r; + return bt_regexec_both(NULL, col, tm, timed_out); } /* * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). + * Returns 0 for failure, number of lines contained in the match otherwise. */ static long -bt_regexec_both(line, col, tm) - char_u *line; - colnr_T col; /* column to start looking for match */ - proftime_T *tm UNUSED; /* timeout limit or NULL */ +bt_regexec_both( + char_u *line, + colnr_T col, /* column to start looking for match */ + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { - bt_regprog_T *prog; - char_u *s; - long retval = 0L; + bt_regprog_T *prog; + char_u *s; + long retval = 0L; /* Create "regstack" and "backpos" if they are not allocated yet. * We allocate *_INITIAL amount of bytes first and then set the grow size @@ -3818,29 +3796,29 @@ bt_regexec_both(line, col, tm) /* Use an item size of 1 byte, since we push different things * onto the regstack. */ ga_init2(®stack, 1, REGSTACK_INITIAL); - ga_grow(®stack, REGSTACK_INITIAL); + (void)ga_grow(®stack, REGSTACK_INITIAL); regstack.ga_growsize = REGSTACK_INITIAL * 8; } if (backpos.ga_data == NULL) { ga_init2(&backpos, sizeof(backpos_T), BACKPOS_INITIAL); - ga_grow(&backpos, BACKPOS_INITIAL); + (void)ga_grow(&backpos, BACKPOS_INITIAL); backpos.ga_growsize = BACKPOS_INITIAL * 8; } if (REG_MULTI) { - prog = (bt_regprog_T *)reg_mmatch->regprog; + prog = (bt_regprog_T *)rex.reg_mmatch->regprog; line = reg_getline((linenr_T)0); - reg_startpos = reg_mmatch->startpos; - reg_endpos = reg_mmatch->endpos; + rex.reg_startpos = rex.reg_mmatch->startpos; + rex.reg_endpos = rex.reg_mmatch->endpos; } else { - prog = (bt_regprog_T *)reg_match->regprog; - reg_startp = reg_match->startp; - reg_endp = reg_match->endp; + prog = (bt_regprog_T *)rex.reg_match->regprog; + rex.reg_startp = rex.reg_match->startp; + rex.reg_endp = rex.reg_match->endp; } /* Be paranoid... */ @@ -3855,19 +3833,19 @@ bt_regexec_both(line, col, tm) goto theend; /* If the start column is past the maximum column: no need to try. */ - if (ireg_maxcol > 0 && col >= ireg_maxcol) + if (rex.reg_maxcol > 0 && col >= rex.reg_maxcol) goto theend; - /* If pattern contains "\c" or "\C": overrule value of ireg_ic */ + /* If pattern contains "\c" or "\C": overrule value of rex.reg_ic */ if (prog->regflags & RF_ICASE) - ireg_ic = TRUE; + rex.reg_ic = TRUE; else if (prog->regflags & RF_NOICASE) - ireg_ic = FALSE; + rex.reg_ic = FALSE; #ifdef FEAT_MBYTE - /* If pattern contains "\Z" overrule value of ireg_icombine */ + /* If pattern contains "\Z" overrule value of rex.reg_icombine */ if (prog->regflags & RF_ICOMBINE) - ireg_icombine = TRUE; + rex.reg_icombine = TRUE; #endif /* If there is a "must appear" string, look for it. */ @@ -3887,7 +3865,7 @@ bt_regexec_both(line, col, tm) * This is used very often, esp. for ":global". Use three versions of * the loop to avoid overhead of conditions. */ - if (!ireg_ic + if (!rex.reg_ic #ifdef FEAT_MBYTE && !has_mbyte #endif @@ -3899,12 +3877,12 @@ bt_regexec_both(line, col, tm) ++s; } #ifdef FEAT_MBYTE - else if (!ireg_ic || (!enc_utf8 && mb_char2len(c) > 1)) + else if (!rex.reg_ic || (!enc_utf8 && mb_char2len(c) > 1)) while ((s = vim_strchr(s, c)) != NULL) { if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) break; /* Found it. */ - mb_ptr_adv(s); + MB_PTR_ADV(s); } #endif else @@ -3912,7 +3890,7 @@ bt_regexec_both(line, col, tm) { if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) break; /* Found it. */ - mb_ptr_adv(s); + MB_PTR_ADV(s); } if (s == NULL) /* Not present. */ goto theend; @@ -3935,13 +3913,13 @@ bt_regexec_both(line, col, tm) c = regline[col]; if (prog->regstart == NUL || prog->regstart == c - || (ireg_ic && (( + || (rex.reg_ic && (( #ifdef FEAT_MBYTE (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) || (c < 255 && prog->regstart < 255 && #endif MB_TOLOWER(prog->regstart) == MB_TOLOWER(c))))) - retval = regtry(prog, col); + retval = regtry(prog, col, tm, timed_out); else retval = 0; } @@ -3957,7 +3935,7 @@ bt_regexec_both(line, col, tm) { /* Skip until the char we know it must start with. * Used often, do some work to avoid call overhead. */ - if (!ireg_ic + if (!rex.reg_ic #ifdef FEAT_MBYTE && !has_mbyte #endif @@ -3974,13 +3952,13 @@ bt_regexec_both(line, col, tm) } /* Check for maximum column to try. */ - if (ireg_maxcol > 0 && col >= ireg_maxcol) + if (rex.reg_maxcol > 0 && col >= rex.reg_maxcol) { retval = 0; break; } - retval = regtry(prog, col); + retval = regtry(prog, col, tm, timed_out); if (retval > 0) break; @@ -4004,7 +3982,11 @@ bt_regexec_both(line, col, tm) { tm_count = 0; if (profile_passed_limit(tm)) + { + if (timed_out != NULL) + *timed_out = TRUE; break; + } } #endif } @@ -4014,10 +3996,7 @@ bt_regexec_both(line, col, tm) /* Free "reg_tofree" when it's a bit big. * Free regstack and backpos if they are bigger than their initial size. */ if (reg_tofreelen > 400) - { - vim_free(reg_tofree); - reg_tofree = NULL; - } + VIM_CLEAR(reg_tofree); if (regstack.ga_maxlen > REGSTACK_INITIAL) ga_clear(®stack); if (backpos.ga_maxlen > BACKPOS_INITIAL) @@ -4027,13 +4006,13 @@ bt_regexec_both(line, col, tm) } #ifdef FEAT_SYN_HL -static reg_extmatch_T *make_extmatch __ARGS((void)); +static reg_extmatch_T *make_extmatch(void); /* * Create a new extmatch and mark it as referenced once. */ static reg_extmatch_T * -make_extmatch() +make_extmatch(void) { reg_extmatch_T *em; @@ -4047,8 +4026,7 @@ make_extmatch() * Add a reference to an extmatch. */ reg_extmatch_T * -ref_extmatch(em) - reg_extmatch_T *em; +ref_extmatch(reg_extmatch_T *em) { if (em != NULL) em->refcnt++; @@ -4060,8 +4038,7 @@ ref_extmatch(em) * the info. */ void -unref_extmatch(em) - reg_extmatch_T *em; +unref_extmatch(reg_extmatch_T *em) { int i; @@ -4079,9 +4056,11 @@ unref_extmatch(em) * Returns 0 for failure, number of lines contained in the match otherwise. */ static long -regtry(prog, col) - bt_regprog_T *prog; - colnr_T col; +regtry( + bt_regprog_T *prog, + colnr_T col, + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { reginput = regline + col; need_clear_subexpr = TRUE; @@ -4091,32 +4070,32 @@ regtry(prog, col) need_clear_zsubexpr = TRUE; #endif - if (regmatch(prog->program + 1) == 0) + if (regmatch(prog->program + 1, tm, timed_out) == 0) return 0; cleanup_subexpr(); if (REG_MULTI) { - if (reg_startpos[0].lnum < 0) + if (rex.reg_startpos[0].lnum < 0) { - reg_startpos[0].lnum = 0; - reg_startpos[0].col = col; + rex.reg_startpos[0].lnum = 0; + rex.reg_startpos[0].col = col; } - if (reg_endpos[0].lnum < 0) + if (rex.reg_endpos[0].lnum < 0) { - reg_endpos[0].lnum = reglnum; - reg_endpos[0].col = (int)(reginput - regline); + rex.reg_endpos[0].lnum = reglnum; + rex.reg_endpos[0].col = (int)(reginput - regline); } else /* Use line number of "\ze". */ - reglnum = reg_endpos[0].lnum; + reglnum = rex.reg_endpos[0].lnum; } else { - if (reg_startp[0] == NULL) - reg_startp[0] = regline + col; - if (reg_endp[0] == NULL) - reg_endp[0] = reginput; + if (rex.reg_startp[0] == NULL) + rex.reg_startp[0] = regline + col; + if (rex.reg_endp[0] == NULL) + rex.reg_endp[0] = reginput; } #ifdef FEAT_SYN_HL /* Package any found \z(...\) matches for export. Default is none. */ @@ -4156,45 +4135,45 @@ regtry(prog, col) } #ifdef FEAT_MBYTE -static int reg_prev_class __ARGS((void)); +static int reg_prev_class(void); /* * Get class of previous character. */ static int -reg_prev_class() +reg_prev_class(void) { if (reginput > regline) return mb_get_class_buf(reginput - 1 - - (*mb_head_off)(regline, reginput - 1), reg_buf); + - (*mb_head_off)(regline, reginput - 1), rex.reg_buf); return -1; } #endif -static int reg_match_visual __ARGS((void)); +static int reg_match_visual(void); /* * Return TRUE if the current reginput position matches the Visual area. */ static int -reg_match_visual() +reg_match_visual(void) { pos_T top, bot; linenr_T lnum; colnr_T col; - win_T *wp = reg_win == NULL ? curwin : reg_win; + win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win; int mode; colnr_T start, end; colnr_T start2, end2; colnr_T cols; /* Check if the buffer is the current buffer. */ - if (reg_buf != curbuf || VIsual.lnum == 0) + if (rex.reg_buf != curbuf || VIsual.lnum == 0) return FALSE; if (VIsual_active) { - if (lt(VIsual, wp->w_cursor)) + if (LT_POS(VIsual, wp->w_cursor)) { top = VIsual; bot = wp->w_cursor; @@ -4208,7 +4187,7 @@ reg_match_visual() } else { - if (lt(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end)) + if (LT_POS(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end)) { top = curbuf->b_visual.vi_start; bot = curbuf->b_visual.vi_end; @@ -4220,7 +4199,7 @@ reg_match_visual() } mode = curbuf->b_visual.vi_mode; } - lnum = reglnum + reg_firstlnum; + lnum = reglnum + rex.reg_firstlnum; if (lnum < top.lnum || lnum > bot.lnum) return FALSE; @@ -4248,7 +4227,7 @@ reg_match_visual() return TRUE; } -#define ADVANCE_REGINPUT() mb_ptr_adv(reginput) +#define ADVANCE_REGINPUT() MB_PTR_ADV(reginput) /* * The arguments from BRACE_LIMITS are stored here. They are actually local @@ -4274,8 +4253,10 @@ static long bl_maxval; * undefined state! */ static int -regmatch(scan) - char_u *scan; /* Current node. */ +regmatch( + char_u *scan, /* Current node. */ + proftime_T *tm UNUSED, /* timeout limit or NULL */ + int *timed_out UNUSED) /* flag set on timeout or NULL */ { char_u *next; /* Next node. */ int op; @@ -4288,6 +4269,9 @@ regmatch(scan) #define RA_BREAK 3 /* break inner loop */ #define RA_MATCH 4 /* successful match */ #define RA_NOMATCH 5 /* didn't match */ +#ifdef FEAT_RELTIME + int tm_count = 0; +#endif /* Make "regstack" and "backpos" empty. They are allocated and freed in * bt_regexec_both() to reduce malloc()/free() calls. */ @@ -4322,6 +4306,20 @@ regmatch(scan) status = RA_FAIL; break; } +#ifdef FEAT_RELTIME + /* Check for timeout once in a 100 times to avoid overhead. */ + if (tm != NULL && ++tm_count == 100) + { + tm_count = 0; + if (profile_passed_limit(tm)) + { + if (timed_out != NULL) + *timed_out = TRUE; + status = RA_FAIL; + break; + } + } +#endif status = RA_CONT; #ifdef DEBUG @@ -4350,12 +4348,12 @@ regmatch(scan) op = OP(scan); /* Check for character class with NL added. */ - if (!reg_line_lbr && WITH_NL(op) && REG_MULTI - && *reginput == NUL && reglnum <= reg_maxline) + if (!rex.reg_line_lbr && WITH_NL(op) && REG_MULTI + && *reginput == NUL && reglnum <= rex.reg_maxline) { reg_nextline(); } - else if (reg_line_lbr && WITH_NL(op) && *reginput == '\n') + else if (rex.reg_line_lbr && WITH_NL(op) && *reginput == '\n') { ADVANCE_REGINPUT(); } @@ -4386,21 +4384,23 @@ regmatch(scan) * line where we started, not at the start of the line or we * didn't start at the first line of the buffer. */ if (reglnum != 0 || reginput != regline - || (REG_MULTI && reg_firstlnum > 1)) + || (REG_MULTI && rex.reg_firstlnum > 1)) status = RA_NOMATCH; break; case RE_EOF: - if (reglnum != reg_maxline || c != NUL) + if (reglnum != rex.reg_maxline || c != NUL) status = RA_NOMATCH; break; case CURSOR: /* Check if the buffer is in a window and compare the - * reg_win->w_cursor position to the match position. */ - if (reg_win == NULL - || (reglnum + reg_firstlnum != reg_win->w_cursor.lnum) - || ((colnr_T)(reginput - regline) != reg_win->w_cursor.col)) + * rex.reg_win->w_cursor position to the match position. */ + if (rex.reg_win == NULL + || (reglnum + rex.reg_firstlnum + != rex.reg_win->w_cursor.lnum) + || ((colnr_T)(reginput - regline) + != rex.reg_win->w_cursor.col)) status = RA_NOMATCH; break; @@ -4411,16 +4411,16 @@ regmatch(scan) int cmp = OPERAND(scan)[1]; pos_T *pos; - pos = getmark_buf(reg_buf, mark, FALSE); + pos = getmark_buf(rex.reg_buf, mark, FALSE); if (pos == NULL /* mark doesn't exist */ || pos->lnum <= 0 /* mark isn't set in reg_buf */ - || (pos->lnum == reglnum + reg_firstlnum + || (pos->lnum == reglnum + rex.reg_firstlnum ? (pos->col == (colnr_T)(reginput - regline) ? (cmp == '<' || cmp == '>') : (pos->col < (colnr_T)(reginput - regline) ? cmp != '>' : cmp != '<')) - : (pos->lnum < reglnum + reg_firstlnum + : (pos->lnum < reglnum + rex.reg_firstlnum ? cmp != '>' : cmp != '<'))) status = RA_NOMATCH; @@ -4433,7 +4433,7 @@ regmatch(scan) break; case RE_LNUM: - if (!REG_MULTI || !re_num_cmp((long_u)(reglnum + reg_firstlnum), + if (!REG_MULTI || !re_num_cmp((long_u)(reglnum + rex.reg_firstlnum), scan)) status = RA_NOMATCH; break; @@ -4445,7 +4445,7 @@ regmatch(scan) case RE_VCOL: if (!re_num_cmp((long_u)win_linetabsize( - reg_win == NULL ? curwin : reg_win, + rex.reg_win == NULL ? curwin : rex.reg_win, regline, (colnr_T)(reginput - regline)) + 1, scan)) status = RA_NOMATCH; break; @@ -4459,7 +4459,7 @@ regmatch(scan) int this_class; /* Get class of current and previous char (if it exists). */ - this_class = mb_get_class_buf(reginput, reg_buf); + this_class = mb_get_class_buf(reginput, rex.reg_buf); if (this_class <= 1) status = RA_NOMATCH; /* not on a word at all */ else if (reg_prev_class() == this_class) @@ -4468,8 +4468,8 @@ regmatch(scan) #endif else { - if (!vim_iswordc_buf(c, reg_buf) || (reginput > regline - && vim_iswordc_buf(reginput[-1], reg_buf))) + if (!vim_iswordc_buf(c, rex.reg_buf) || (reginput > regline + && vim_iswordc_buf(reginput[-1], rex.reg_buf))) status = RA_NOMATCH; } break; @@ -4483,7 +4483,7 @@ regmatch(scan) int this_class, prev_class; /* Get class of current and previous char (if it exists). */ - this_class = mb_get_class_buf(reginput, reg_buf); + this_class = mb_get_class_buf(reginput, rex.reg_buf); prev_class = reg_prev_class(); if (this_class == prev_class || prev_class == 0 || prev_class == 1) @@ -4492,8 +4492,9 @@ regmatch(scan) #endif else { - if (!vim_iswordc_buf(reginput[-1], reg_buf) - || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf))) + if (!vim_iswordc_buf(reginput[-1], rex.reg_buf) + || (reginput[0] != NUL + && vim_iswordc_buf(c, rex.reg_buf))) status = RA_NOMATCH; } break; /* Matched with EOW */ @@ -4521,14 +4522,15 @@ regmatch(scan) break; case KWORD: - if (!vim_iswordp_buf(reginput, reg_buf)) + if (!vim_iswordp_buf(reginput, rex.reg_buf)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case SKWORD: - if (VIM_ISDIGIT(*reginput) || !vim_iswordp_buf(reginput, reg_buf)) + if (VIM_ISDIGIT(*reginput) + || !vim_iswordp_buf(reginput, rex.reg_buf)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); @@ -4563,14 +4565,14 @@ regmatch(scan) break; case WHITE: - if (!vim_iswhite(c)) + if (!VIM_ISWHITE(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NWHITE: - if (c == NUL || vim_iswhite(c)) + if (c == NUL || VIM_ISWHITE(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); @@ -4696,7 +4698,7 @@ regmatch(scan) opnd = OPERAND(scan); /* Inline the first byte, for speed. */ if (*opnd != *reginput - && (!ireg_ic || ( + && (!rex.reg_ic || ( #ifdef FEAT_MBYTE !enc_utf8 && #endif @@ -4711,7 +4713,7 @@ regmatch(scan) { if (opnd[1] == NUL #ifdef FEAT_MBYTE - && !(enc_utf8 && ireg_ic) + && !(enc_utf8 && rex.reg_ic) #endif ) { @@ -4730,7 +4732,7 @@ regmatch(scan) if (status != RA_NOMATCH && enc_utf8 && UTF_COMPOSINGLIKE(reginput, reginput + len) - && !ireg_icombine + && !rex.reg_icombine && OP(next) != RE_COMPOSING) { /* raaron: This code makes a composing character get @@ -4772,15 +4774,16 @@ regmatch(scan) break; } if (enc_utf8) - opndc = mb_ptr2char(opnd); + opndc = utf_ptr2char(opnd); if (enc_utf8 && utf_iscomposing(opndc)) { /* When only a composing char is given match at any * position where that composing char appears. */ status = RA_NOMATCH; - for (i = 0; reginput[i] != NUL; i += utf_char2len(inpc)) + for (i = 0; reginput[i] != NUL; + i += utf_ptr2len(reginput + i)) { - inpc = mb_ptr2char(reginput + i); + inpc = utf_ptr2char(reginput + i); if (!utf_iscomposing(inpc)) { if (i > 0) @@ -4789,7 +4792,7 @@ regmatch(scan) else if (opndc == inpc) { /* Include all following composing chars. */ - len = i + mb_ptr2len(reginput + i); + len = i + utfc_ptr2len(reginput + i); status = RA_MATCH; break; } @@ -4814,7 +4817,7 @@ regmatch(scan) { /* Skip composing characters. */ while (utf_iscomposing(utf_ptr2char(reginput))) - mb_cptr_adv(reginput); + MB_CPTR_ADV(reginput); } #endif break; @@ -4880,8 +4883,8 @@ regmatch(scan) else { rp->rs_no = no; - save_se(&rp->rs_un.sesave, ®_startpos[no], - ®_startp[no]); + save_se(&rp->rs_un.sesave, &rex.reg_startpos[no], + &rex.reg_startp[no]); /* We simply continue and handle the result when done. */ } } @@ -4940,7 +4943,8 @@ regmatch(scan) else { rp->rs_no = no; - save_se(&rp->rs_un.sesave, ®_endpos[no], ®_endp[no]); + save_se(&rp->rs_un.sesave, &rex.reg_endpos[no], + &rex.reg_endp[no]); /* We simply continue and handle the result when done. */ } } @@ -4989,7 +4993,7 @@ regmatch(scan) cleanup_subexpr(); if (!REG_MULTI) /* Single-line regexp */ { - if (reg_startp[no] == NULL || reg_endp[no] == NULL) + if (rex.reg_startp[no] == NULL || rex.reg_endp[no] == NULL) { /* Backref was not set: Match an empty string. */ len = 0; @@ -4998,26 +5002,28 @@ regmatch(scan) { /* Compare current input with back-ref in the same * line. */ - len = (int)(reg_endp[no] - reg_startp[no]); - if (cstrncmp(reg_startp[no], reginput, &len) != 0) + len = (int)(rex.reg_endp[no] - rex.reg_startp[no]); + if (cstrncmp(rex.reg_startp[no], reginput, &len) != 0) status = RA_NOMATCH; } } else /* Multi-line regexp */ { - if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0) + if (rex.reg_startpos[no].lnum < 0 + || rex.reg_endpos[no].lnum < 0) { /* Backref was not set: Match an empty string. */ len = 0; } else { - if (reg_startpos[no].lnum == reglnum - && reg_endpos[no].lnum == reglnum) + if (rex.reg_startpos[no].lnum == reglnum + && rex.reg_endpos[no].lnum == reglnum) { /* Compare back-ref within the current line. */ - len = reg_endpos[no].col - reg_startpos[no].col; - if (cstrncmp(regline + reg_startpos[no].col, + len = rex.reg_endpos[no].col + - rex.reg_startpos[no].col; + if (cstrncmp(regline + rex.reg_startpos[no].col, reginput, &len) != 0) status = RA_NOMATCH; } @@ -5026,10 +5032,10 @@ regmatch(scan) /* Messy situation: Need to compare between two * lines. */ int r = match_with_backref( - reg_startpos[no].lnum, - reg_startpos[no].col, - reg_endpos[no].lnum, - reg_endpos[no].col, + rex.reg_startpos[no].lnum, + rex.reg_startpos[no].col, + rex.reg_endpos[no].lnum, + rex.reg_endpos[no].col, &len); if (r != RA_MATCH) @@ -5108,7 +5114,7 @@ regmatch(scan) } else { - EMSG(_(e_internal)); /* Shouldn't happen */ + internal_error("BRACE_LIMITS"); status = RA_FAIL; } } @@ -5194,7 +5200,7 @@ regmatch(scan) if (OP(next) == EXACTLY) { rst.nextb = *OPERAND(next); - if (ireg_ic) + if (rex.reg_ic) { if (MB_ISUPPER(rst.nextb)) rst.nextb_ic = MB_TOLOWER(rst.nextb); @@ -5322,10 +5328,11 @@ regmatch(scan) break; case NEWL: - if ((c != NUL || !REG_MULTI || reglnum > reg_maxline - || reg_line_lbr) && (c != '\n' || !reg_line_lbr)) + if ((c != NUL || !REG_MULTI || reglnum > rex.reg_maxline + || rex.reg_line_lbr) + && (c != '\n' || !rex.reg_line_lbr)) status = RA_NOMATCH; - else if (reg_line_lbr) + else if (rex.reg_line_lbr) ADVANCE_REGINPUT(); else reg_nextline(); @@ -5371,8 +5378,8 @@ regmatch(scan) case RS_MOPEN: /* Pop the state. Restore pointers when there is no match. */ if (status == RA_NOMATCH) - restore_se(&rp->rs_un.sesave, ®_startpos[rp->rs_no], - ®_startp[rp->rs_no]); + restore_se(&rp->rs_un.sesave, &rex.reg_startpos[rp->rs_no], + &rex.reg_startp[rp->rs_no]); regstack_pop(&scan); break; @@ -5389,8 +5396,8 @@ regmatch(scan) case RS_MCLOSE: /* Pop the state. Restore pointers when there is no match. */ if (status == RA_NOMATCH) - restore_se(&rp->rs_un.sesave, ®_endpos[rp->rs_no], - ®_endp[rp->rs_no]); + restore_se(&rp->rs_un.sesave, &rex.reg_endpos[rp->rs_no], + &rex.reg_endp[rp->rs_no]); regstack_pop(&scan); break; @@ -5578,9 +5585,14 @@ regmatch(scan) { #ifdef FEAT_MBYTE if (has_mbyte) + { + char_u *line = + reg_getline(behind_pos.rs_u.pos.lnum); + rp->rs_un.regsave.rs_u.pos.col -= - (*mb_head_off)(regline, regline + (*mb_head_off)(line, line + rp->rs_un.regsave.rs_u.pos.col - 1) + 1; + } else #endif --rp->rs_un.regsave.rs_u.pos.col; @@ -5592,7 +5604,7 @@ regmatch(scan) no = FAIL; else { - mb_ptr_back(regline, rp->rs_un.regsave.rs_u.ptr); + MB_PTR_BACK(regline, rp->rs_un.regsave.rs_u.ptr); if (limit > 0 && (long)(behind_pos.rs_u.ptr - rp->rs_un.regsave.rs_u.ptr) > limit) no = FAIL; @@ -5679,7 +5691,7 @@ regmatch(scan) fast_breakcheck(); } else - mb_ptr_back(regline, reginput); + MB_PTR_BACK(regline, reginput); } else { @@ -5746,8 +5758,6 @@ regmatch(scan) printf("Premature EOL\n"); #endif } - if (status == RA_FAIL) - got_int = TRUE; return (status == RA_MATCH); } @@ -5761,9 +5771,7 @@ regmatch(scan) * Returns pointer to new item. Returns NULL when out of memory. */ static regitem_T * -regstack_push(state, scan) - regstate_T state; - char_u *scan; +regstack_push(regstate_T state, char_u *scan) { regitem_T *rp; @@ -5787,8 +5795,7 @@ regstack_push(state, scan) * Pop an item from the regstack. */ static void -regstack_pop(scan) - char_u **scan; +regstack_pop(char_u **scan) { regitem_T *rp; @@ -5803,9 +5810,9 @@ regstack_pop(scan) * Advances reginput (and reglnum) to just after the matched chars. */ static int -regrepeat(p, maxcount) - char_u *p; - long maxcount; /* maximum number of matches allowed */ +regrepeat( + char_u *p, + long maxcount) /* maximum number of matches allowed */ { long count = 0; char_u *scan; @@ -5826,10 +5833,10 @@ regrepeat(p, maxcount) while (*scan != NUL && count < maxcount) { ++count; - mb_ptr_adv(scan); + MB_PTR_ADV(scan); } - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr || count == maxcount) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr || count == maxcount) break; ++count; /* count the line-break */ reg_nextline(); @@ -5842,26 +5849,26 @@ regrepeat(p, maxcount) case IDENT: case IDENT + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SIDENT: case SIDENT + ADD_NL: while (count < maxcount) { if (vim_isIDc(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan))) { - mb_ptr_adv(scan); + MB_PTR_ADV(scan); } else if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; if (got_int) break; } - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; else break; @@ -5872,27 +5879,27 @@ regrepeat(p, maxcount) case KWORD: case KWORD + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SKWORD: case SKWORD + ADD_NL: while (count < maxcount) { - if (vim_iswordp_buf(scan, reg_buf) + if (vim_iswordp_buf(scan, rex.reg_buf) && (testval || !VIM_ISDIGIT(*scan))) { - mb_ptr_adv(scan); + MB_PTR_ADV(scan); } else if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; if (got_int) break; } - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; else break; @@ -5903,26 +5910,26 @@ regrepeat(p, maxcount) case FNAME: case FNAME + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SFNAME: case SFNAME + ADD_NL: while (count < maxcount) { if (vim_isfilec(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan))) { - mb_ptr_adv(scan); + MB_PTR_ADV(scan); } else if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; if (got_int) break; } - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; else break; @@ -5933,15 +5940,15 @@ regrepeat(p, maxcount) case PRINT: case PRINT + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SPRINT: case SPRINT + ADD_NL: while (count < maxcount) { if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; @@ -5951,9 +5958,9 @@ regrepeat(p, maxcount) else if (vim_isprintc(PTR2CHAR(scan)) == 1 && (testval || !VIM_ISDIGIT(*scan))) { - mb_ptr_adv(scan); + MB_PTR_ADV(scan); } - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; else break; @@ -5972,8 +5979,8 @@ regrepeat(p, maxcount) #endif if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; @@ -5990,7 +5997,7 @@ regrepeat(p, maxcount) #endif else if ((class_tab[*scan] & mask) == testval) ++scan; - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; else break; @@ -6074,7 +6081,7 @@ regrepeat(p, maxcount) /* This doesn't do a multi-byte character, because a MULTIBYTECODE * would have been used for it. It does handle single-byte * characters, such as latin1. */ - if (ireg_ic) + if (rex.reg_ic) { cu = MB_TOUPPER(*opnd); cl = MB_TOLOWER(*opnd); @@ -6105,14 +6112,14 @@ regrepeat(p, maxcount) * compiling the program). */ if ((len = (*mb_ptr2len)(opnd)) > 1) { - if (ireg_ic && enc_utf8) + if (rex.reg_ic && enc_utf8) cf = utf_fold(utf_ptr2char(opnd)); - while (count < maxcount) + while (count < maxcount && (*mb_ptr2len)(scan) >= len) { for (i = 0; i < len; ++i) if (opnd[i] != scan[i]) break; - if (i < len && (!ireg_ic || !enc_utf8 + if (i < len && (!rex.reg_ic || !enc_utf8 || utf_fold(utf_ptr2char(scan)) != cf)) break; scan += len; @@ -6126,7 +6133,7 @@ regrepeat(p, maxcount) case ANYOF: case ANYOF + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case ANYBUT: case ANYBUT + ADD_NL: @@ -6137,15 +6144,15 @@ regrepeat(p, maxcount) #endif if (*scan == NUL) { - if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline - || reg_line_lbr) + if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > rex.reg_maxline + || rex.reg_line_lbr) break; reg_nextline(); scan = reginput; if (got_int) break; } - else if (reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) + else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p))) ++scan; #ifdef FEAT_MBYTE else if (has_mbyte && (len = (*mb_ptr2len)(scan)) > 1) @@ -6167,11 +6174,12 @@ regrepeat(p, maxcount) case NEWL: while (count < maxcount - && ((*scan == NUL && reglnum <= reg_maxline && !reg_line_lbr - && REG_MULTI) || (*scan == '\n' && reg_line_lbr))) + && ((*scan == NUL && reglnum <= rex.reg_maxline + && !rex.reg_line_lbr && REG_MULTI) + || (*scan == '\n' && rex.reg_line_lbr))) { count++; - if (reg_line_lbr) + if (rex.reg_line_lbr) ADVANCE_REGINPUT(); else reg_nextline(); @@ -6200,8 +6208,7 @@ regrepeat(p, maxcount) * there is an error. */ static char_u * -regnext(p) - char_u *p; +regnext(char_u *p) { int offset; @@ -6223,11 +6230,11 @@ regnext(p) * Return TRUE if it's wrong. */ static int -prog_magic_wrong() +prog_magic_wrong(void) { regprog_T *prog; - prog = REG_MULTI ? reg_mmatch->regprog : reg_match->regprog; + prog = REG_MULTI ? rex.reg_mmatch->regprog : rex.reg_match->regprog; if (prog->engine == &nfa_regengine) /* For NFA matcher we don't check the magic */ return FALSE; @@ -6246,20 +6253,20 @@ prog_magic_wrong() * used (to increase speed). */ static void -cleanup_subexpr() +cleanup_subexpr(void) { if (need_clear_subexpr) { if (REG_MULTI) { /* Use 0xff to set lnum to -1 */ - vim_memset(reg_startpos, 0xff, sizeof(lpos_T) * NSUBEXP); - vim_memset(reg_endpos, 0xff, sizeof(lpos_T) * NSUBEXP); + vim_memset(rex.reg_startpos, 0xff, sizeof(lpos_T) * NSUBEXP); + vim_memset(rex.reg_endpos, 0xff, sizeof(lpos_T) * NSUBEXP); } else { - vim_memset(reg_startp, 0, sizeof(char_u *) * NSUBEXP); - vim_memset(reg_endp, 0, sizeof(char_u *) * NSUBEXP); + vim_memset(rex.reg_startp, 0, sizeof(char_u *) * NSUBEXP); + vim_memset(rex.reg_endp, 0, sizeof(char_u *) * NSUBEXP); } need_clear_subexpr = FALSE; } @@ -6267,7 +6274,7 @@ cleanup_subexpr() #ifdef FEAT_SYN_HL static void -cleanup_zsubexpr() +cleanup_zsubexpr(void) { if (need_clear_zsubexpr) { @@ -6292,8 +6299,7 @@ cleanup_zsubexpr() * later by restore_subexpr(). */ static void -save_subexpr(bp) - regbehind_T *bp; +save_subexpr(regbehind_T *bp) { int i; @@ -6306,13 +6312,13 @@ save_subexpr(bp) { if (REG_MULTI) { - bp->save_start[i].se_u.pos = reg_startpos[i]; - bp->save_end[i].se_u.pos = reg_endpos[i]; + bp->save_start[i].se_u.pos = rex.reg_startpos[i]; + bp->save_end[i].se_u.pos = rex.reg_endpos[i]; } else { - bp->save_start[i].se_u.ptr = reg_startp[i]; - bp->save_end[i].se_u.ptr = reg_endp[i]; + bp->save_start[i].se_u.ptr = rex.reg_startp[i]; + bp->save_end[i].se_u.ptr = rex.reg_endp[i]; } } } @@ -6322,8 +6328,7 @@ save_subexpr(bp) * Restore the subexpr from "bp". */ static void -restore_subexpr(bp) - regbehind_T *bp; +restore_subexpr(regbehind_T *bp) { int i; @@ -6335,13 +6340,13 @@ restore_subexpr(bp) { if (REG_MULTI) { - reg_startpos[i] = bp->save_start[i].se_u.pos; - reg_endpos[i] = bp->save_end[i].se_u.pos; + rex.reg_startpos[i] = bp->save_start[i].se_u.pos; + rex.reg_endpos[i] = bp->save_end[i].se_u.pos; } else { - reg_startp[i] = bp->save_start[i].se_u.ptr; - reg_endp[i] = bp->save_end[i].se_u.ptr; + rex.reg_startp[i] = bp->save_start[i].se_u.ptr; + rex.reg_endp[i] = bp->save_end[i].se_u.ptr; } } } @@ -6351,7 +6356,7 @@ restore_subexpr(bp) * Advance reglnum, regline and reginput to the next line. */ static void -reg_nextline() +reg_nextline(void) { regline = reg_getline(++reglnum); reginput = regline; @@ -6362,9 +6367,7 @@ reg_nextline() * Save the input line and position in a regsave_T. */ static void -reg_save(save, gap) - regsave_T *save; - garray_T *gap; +reg_save(regsave_T *save, garray_T *gap) { if (REG_MULTI) { @@ -6380,9 +6383,7 @@ reg_save(save, gap) * Restore the input line and position from a regsave_T. */ static void -reg_restore(save, gap) - regsave_T *save; - garray_T *gap; +reg_restore(regsave_T *save, garray_T *gap) { if (REG_MULTI) { @@ -6404,8 +6405,7 @@ reg_restore(save, gap) * Return TRUE if current position is equal to saved position. */ static int -reg_save_equal(save) - regsave_T *save; +reg_save_equal(regsave_T *save) { if (REG_MULTI) return reglnum == save->rs_u.pos.lnum @@ -6421,9 +6421,7 @@ reg_save_equal(save) * depending on REG_MULTI. */ static void -save_se_multi(savep, posp) - save_se_T *savep; - lpos_T *posp; +save_se_multi(save_se_T *savep, lpos_T *posp) { savep->se_u.pos = *posp; posp->lnum = reglnum; @@ -6431,9 +6429,7 @@ save_se_multi(savep, posp) } static void -save_se_one(savep, pp) - save_se_T *savep; - char_u **pp; +save_se_one(save_se_T *savep, char_u **pp) { savep->se_u.ptr = *pp; *pp = reginput; @@ -6443,9 +6439,7 @@ save_se_one(savep, pp) * Compare a number with the operand of RE_LNUM, RE_COL or RE_VCOL. */ static int -re_num_cmp(val, scan) - long_u val; - char_u *scan; +re_num_cmp(long_u val, char_u *scan) { long_u n = OPERAND_MIN(scan); @@ -6463,12 +6457,12 @@ re_num_cmp(val, scan) * last line. */ static int -match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen) - linenr_T start_lnum; - colnr_T start_col; - linenr_T end_lnum; - colnr_T end_col; - int *bytelen; +match_with_backref( + linenr_T start_lnum, + colnr_T start_col, + linenr_T end_lnum, + colnr_T end_col, + int *bytelen) { linenr_T clnum = start_lnum; colnr_T ccol = start_col; @@ -6511,7 +6505,7 @@ match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen) *bytelen += len; if (clnum == end_lnum) break; /* match and at end! */ - if (reglnum >= reg_maxline) + if (reglnum >= rex.reg_maxline) return RA_NOMATCH; /* text too short */ /* Advance to next line. */ @@ -6535,9 +6529,7 @@ match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen) * regdump - dump a regexp onto stdout in vaguely comprehensible form */ static void -regdump(pattern, r) - char_u *pattern; - bt_regprog_T *r; +regdump(char_u *pattern, bt_regprog_T *r) { char_u *s; int op = EXACTLY; /* Arbitrary non-END op. */ @@ -6625,8 +6617,7 @@ regdump(pattern, r) * regprop - printable representation of opcode */ static char_u * -regprop(op) - char_u *op; +regprop(char_u *op) { char *p; static char buf[50]; @@ -7005,8 +6996,19 @@ regprop(op) } #endif /* DEBUG */ +/* + * Used in a place where no * or \+ can follow. + */ + static int +re_mult_next(char *what) +{ + if (re_multi_type(peekchr()) == MULTI_MULT) + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + return OK; +} + #ifdef FEAT_MBYTE -static void mb_decompose __ARGS((int c, int *c1, int *c2, int *c3)); +static void mb_decompose(int c, int *c1, int *c2, int *c3); typedef struct { @@ -7068,8 +7070,7 @@ static decomp_T decomp_table[0xfb4f-0xfb20+1] = }; static void -mb_decompose(c, c1, c2, c3) - int c, *c1, *c2, *c3; +mb_decompose(int c, int *c1, int *c2, int *c3) { decomp_T d; @@ -7089,25 +7090,23 @@ mb_decompose(c, c1, c2, c3) #endif /* - * Compare two strings, ignore case if ireg_ic set. + * Compare two strings, ignore case if rex.reg_ic set. * Return 0 if strings match, non-zero otherwise. * Correct the length "*n" when composing characters are ignored. */ static int -cstrncmp(s1, s2, n) - char_u *s1, *s2; - int *n; +cstrncmp(char_u *s1, char_u *s2, int *n) { int result; - if (!ireg_ic) + if (!rex.reg_ic) result = STRNCMP(s1, s2, *n); else result = MB_STRNICMP(s1, s2, *n); #ifdef FEAT_MBYTE /* if it failed and it's utf8 and we want to combineignore: */ - if (result != 0 && enc_utf8 && ireg_icombine) + if (result != 0 && enc_utf8 && rex.reg_icombine) { char_u *str1, *str2; int c1, c2, c11, c12; @@ -7126,14 +7125,15 @@ cstrncmp(s1, s2, n) /* decompose the character if necessary, into 'base' characters * because I don't care about Arabic, I will hard-code the Hebrew * which I *do* care about! So sue me... */ - if (c1 != c2 && (!ireg_ic || utf_fold(c1) != utf_fold(c2))) + if (c1 != c2 && (!rex.reg_ic || utf_fold(c1) != utf_fold(c2))) { /* decomposition necessary? */ mb_decompose(c1, &c11, &junk, &junk); mb_decompose(c2, &c12, &junk, &junk); c1 = c11; c2 = c12; - if (c11 != c12 && (!ireg_ic || utf_fold(c11) != utf_fold(c12))) + if (c11 != c12 + && (!rex.reg_ic || utf_fold(c11) != utf_fold(c12))) break; } } @@ -7150,14 +7150,12 @@ cstrncmp(s1, s2, n) * cstrchr: This function is used a lot for simple searches, keep it fast! */ static char_u * -cstrchr(s, c) - char_u *s; - int c; +cstrchr(char_u *s, int c) { char_u *p; int cc; - if (!ireg_ic + if (!rex.reg_ic #ifdef FEAT_MBYTE || (!enc_utf8 && mb_char2len(c) > 1) #endif @@ -7207,31 +7205,23 @@ cstrchr(s, c) * regsub stuff * ***************************************************************/ -/* This stuff below really confuses cc on an SGI -- webb */ -#ifdef __sgi -# undef __ARGS -# define __ARGS(x) () -#endif - /* * We should define ftpr as a pointer to a function returning a pointer to * a function returning a pointer to a function ... * This is impossible, so we declare a pointer to a function returning a * pointer to a function returning void. This should work for all compilers. */ -typedef void (*(*fptr_T) __ARGS((int *, int)))(); +typedef void (*(*fptr_T)(int *, int))(); -static fptr_T do_upper __ARGS((int *, int)); -static fptr_T do_Upper __ARGS((int *, int)); -static fptr_T do_lower __ARGS((int *, int)); -static fptr_T do_Lower __ARGS((int *, int)); +static fptr_T do_upper(int *, int); +static fptr_T do_Upper(int *, int); +static fptr_T do_lower(int *, int); +static fptr_T do_Lower(int *, int); -static int vim_regsub_both __ARGS((char_u *source, char_u *dest, int copy, int magic, int backslash)); +static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int copy, int magic, int backslash); static fptr_T -do_upper(d, c) - int *d; - int c; +do_upper(int *d, int c) { *d = MB_TOUPPER(c); @@ -7239,9 +7229,7 @@ do_upper(d, c) } static fptr_T -do_Upper(d, c) - int *d; - int c; +do_Upper(int *d, int c) { *d = MB_TOUPPER(c); @@ -7249,9 +7237,7 @@ do_Upper(d, c) } static fptr_T -do_lower(d, c) - int *d; - int c; +do_lower(int *d, int c) { *d = MB_TOLOWER(c); @@ -7259,9 +7245,7 @@ do_lower(d, c) } static fptr_T -do_Lower(d, c) - int *d; - int c; +do_Lower(int *d, int c) { *d = MB_TOLOWER(c); @@ -7281,9 +7265,7 @@ do_Lower(d, c) * The tildes are parsed once before the first call to vim_regsub(). */ char_u * -regtilde(source, magic) - char_u *source; - int magic; +regtilde(char_u *source, int magic) { char_u *newsub = source; char_u *tmpsub; @@ -7346,17 +7328,65 @@ regtilde(source, magic) #ifdef FEAT_EVAL static int can_f_submatch = FALSE; /* TRUE when submatch() can be used */ -/* These pointers are used instead of reg_match and reg_mmatch for - * reg_submatch(). Needed for when the substitution string is an expression - * that contains a call to substitute() and submatch(). */ -static regmatch_T *submatch_match; -static regmmatch_T *submatch_mmatch; -static linenr_T submatch_firstlnum; -static linenr_T submatch_maxline; -static int submatch_line_lbr; +/* These pointers are used for reg_submatch(). Needed for when the + * substitution string is an expression that contains a call to substitute() + * and submatch(). */ +typedef struct { + regmatch_T *sm_match; + regmmatch_T *sm_mmatch; + linenr_T sm_firstlnum; + linenr_T sm_maxline; + int sm_line_lbr; +} regsubmatch_T; + +static regsubmatch_T rsm; /* can only be used when can_f_submatch is TRUE */ #endif #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) || defined(PROTO) + +/* + * Put the submatches in "argv[0]" which is a list passed into call_func() by + * vim_regsub_both(). + */ + static int +fill_submatch_list(int argc UNUSED, typval_T *argv, int argcount) +{ + listitem_T *li; + int i; + char_u *s; + + if (argcount == 0) + /* called function doesn't take an argument */ + return 0; + + /* Relies on sl_list to be the first item in staticList10_T. */ + init_static_list((staticList10_T *)(argv->vval.v_list)); + + /* There are always 10 list items in staticList10_T. */ + li = argv->vval.v_list->lv_first; + for (i = 0; i < 10; ++i) + { + s = rsm.sm_match->startp[i]; + if (s == NULL || rsm.sm_match->endp[i] == NULL) + s = NULL; + else + s = vim_strnsave(s, (int)(rsm.sm_match->endp[i] - s)); + li->li_tv.v_type = VAR_STRING; + li->li_tv.vval.v_string = s; + li = li->li_next; + } + return 1; +} + + static void +clear_submatch_list(staticList10_T *sl) +{ + int i; + + for (i = 0; i < 10; ++i) + vim_free(sl->sl_items[i].li_tv.vval.v_string); +} + /* * vim_regsub() - perform substitutions after a vim_regexec() or * vim_regexec_multi() match. @@ -7376,49 +7406,81 @@ static int submatch_line_lbr; * Returns the size of the replacement, including terminating NUL. */ int -vim_regsub(rmp, source, dest, copy, magic, backslash) - regmatch_T *rmp; - char_u *source; - char_u *dest; - int copy; - int magic; - int backslash; +vim_regsub( + regmatch_T *rmp, + char_u *source, + typval_T *expr, + char_u *dest, + int copy, + int magic, + int backslash) { - reg_match = rmp; - reg_mmatch = NULL; - reg_maxline = 0; - reg_buf = curbuf; - reg_line_lbr = TRUE; - return vim_regsub_both(source, dest, copy, magic, backslash); + int result; + regexec_T rex_save; + int rex_in_use_save = rex_in_use; + + if (rex_in_use) + /* Being called recursively, save the state. */ + rex_save = rex; + rex_in_use = TRUE; + + rex.reg_match = rmp; + rex.reg_mmatch = NULL; + rex.reg_maxline = 0; + rex.reg_buf = curbuf; + rex.reg_line_lbr = TRUE; + result = vim_regsub_both(source, expr, dest, copy, magic, backslash); + + rex_in_use = rex_in_use_save; + if (rex_in_use) + rex = rex_save; + + return result; } #endif int -vim_regsub_multi(rmp, lnum, source, dest, copy, magic, backslash) - regmmatch_T *rmp; - linenr_T lnum; - char_u *source; - char_u *dest; - int copy; - int magic; - int backslash; +vim_regsub_multi( + regmmatch_T *rmp, + linenr_T lnum, + char_u *source, + char_u *dest, + int copy, + int magic, + int backslash) { - reg_match = NULL; - reg_mmatch = rmp; - reg_buf = curbuf; /* always works on the current buffer! */ - reg_firstlnum = lnum; - reg_maxline = curbuf->b_ml.ml_line_count - lnum; - reg_line_lbr = FALSE; - return vim_regsub_both(source, dest, copy, magic, backslash); + int result; + regexec_T rex_save; + int rex_in_use_save = rex_in_use; + + if (rex_in_use) + /* Being called recursively, save the state. */ + rex_save = rex; + rex_in_use = TRUE; + + rex.reg_match = NULL; + rex.reg_mmatch = rmp; + rex.reg_buf = curbuf; /* always works on the current buffer! */ + rex.reg_firstlnum = lnum; + rex.reg_maxline = curbuf->b_ml.ml_line_count - lnum; + rex.reg_line_lbr = FALSE; + result = vim_regsub_both(source, NULL, dest, copy, magic, backslash); + + rex_in_use = rex_in_use_save; + if (rex_in_use) + rex = rex_save; + + return result; } static int -vim_regsub_both(source, dest, copy, magic, backslash) - char_u *source; - char_u *dest; - int copy; - int magic; - int backslash; +vim_regsub_both( + char_u *source, + typval_T *expr, + char_u *dest, + int copy, + int magic, + int backslash) { char_u *src; char_u *dst; @@ -7431,11 +7493,11 @@ vim_regsub_both(source, dest, copy, magic, backslash) linenr_T clnum = 0; /* init for GCC */ int len = 0; /* init for GCC */ #ifdef FEAT_EVAL - static char_u *eval_result = NULL; + static char_u *eval_result = NULL; #endif /* Be paranoid... */ - if (source == NULL || dest == NULL) + if ((source == NULL && expr == NULL) || dest == NULL) { EMSG(_(e_null)); return 0; @@ -7448,11 +7510,7 @@ vim_regsub_both(source, dest, copy, magic, backslash) /* * When the substitute part starts with "\=" evaluate it as an expression. */ - if (source[0] == '\\' && source[1] == '=' -#ifdef FEAT_EVAL - && !can_f_submatch /* can't do this recursively */ -#endif - ) + if (expr != NULL || (source[0] == '\\' && source[1] == '=')) { #ifdef FEAT_EVAL /* To make sure that the length doesn't change between checking the @@ -7465,41 +7523,79 @@ vim_regsub_both(source, dest, copy, magic, backslash) { STRCPY(dest, eval_result); dst += STRLEN(eval_result); - vim_free(eval_result); - eval_result = NULL; + VIM_CLEAR(eval_result); } } else { - win_T *save_reg_win; - int save_ireg_ic; + int prev_can_f_submatch = can_f_submatch; + regsubmatch_T rsm_save; vim_free(eval_result); /* The expression may contain substitute(), which calls us * recursively. Make sure submatch() gets the text from the first - * level. Don't need to save "reg_buf", because - * vim_regexec_multi() can't be called recursively. */ - submatch_match = reg_match; - submatch_mmatch = reg_mmatch; - submatch_firstlnum = reg_firstlnum; - submatch_maxline = reg_maxline; - submatch_line_lbr = reg_line_lbr; - save_reg_win = reg_win; - save_ireg_ic = ireg_ic; + * level. */ + if (can_f_submatch) + rsm_save = rsm; can_f_submatch = TRUE; + rsm.sm_match = rex.reg_match; + rsm.sm_mmatch = rex.reg_mmatch; + rsm.sm_firstlnum = rex.reg_firstlnum; + rsm.sm_maxline = rex.reg_maxline; + rsm.sm_line_lbr = rex.reg_line_lbr; + + if (expr != NULL) + { + typval_T argv[2]; + int dummy; + char_u buf[NUMBUFLEN]; + typval_T rettv; + staticList10_T matchList; + + rettv.v_type = VAR_STRING; + rettv.vval.v_string = NULL; + argv[0].v_type = VAR_LIST; + argv[0].vval.v_list = &matchList.sl_list; + matchList.sl_list.lv_len = 0; + if (expr->v_type == VAR_FUNC) + { + s = expr->vval.v_string; + call_func(s, (int)STRLEN(s), &rettv, + 1, argv, fill_submatch_list, + 0L, 0L, &dummy, TRUE, NULL, NULL); + } + else if (expr->v_type == VAR_PARTIAL) + { + partial_T *partial = expr->vval.v_partial; + + s = partial_name(partial); + call_func(s, (int)STRLEN(s), &rettv, + 1, argv, fill_submatch_list, + 0L, 0L, &dummy, TRUE, partial, NULL); + } + if (matchList.sl_list.lv_len > 0) + /* fill_submatch_list() was called */ + clear_submatch_list(&matchList); + + eval_result = get_tv_string_buf_chk(&rettv, buf); + if (eval_result != NULL) + eval_result = vim_strsave(eval_result); + clear_tv(&rettv); + } + else + eval_result = eval_to_string(source + 2, NULL, TRUE); - eval_result = eval_to_string(source + 2, NULL, TRUE); if (eval_result != NULL) { int had_backslash = FALSE; - for (s = eval_result; *s != NUL; mb_ptr_adv(s)) + for (s = eval_result; *s != NUL; MB_PTR_ADV(s)) { /* Change NL to CR, so that it becomes a line break, * unless called from vim_regexec_nl(). * Skip over a backslashed character. */ - if (*s == NL && !submatch_line_lbr) + if (*s == NL && !rsm.sm_line_lbr) *s = CAR; else if (*s == '\\' && s[1] != NUL) { @@ -7510,7 +7606,7 @@ vim_regsub_both(source, dest, copy, magic, backslash) * def * Not when called from vim_regexec_nl(). */ - if (*s == NL && !submatch_line_lbr) + if (*s == NL && !rsm.sm_line_lbr) *s = CAR; had_backslash = TRUE; } @@ -7529,14 +7625,9 @@ vim_regsub_both(source, dest, copy, magic, backslash) dst += STRLEN(eval_result); } - reg_match = submatch_match; - reg_mmatch = submatch_mmatch; - reg_firstlnum = submatch_firstlnum; - reg_maxline = submatch_maxline; - reg_line_lbr = submatch_line_lbr; - reg_win = save_reg_win; - ireg_ic = save_ireg_ic; - can_f_submatch = FALSE; + can_f_submatch = prev_can_f_submatch; + if (can_f_submatch) + rsm = rsm_save; } #endif } @@ -7665,26 +7756,26 @@ vim_regsub_both(source, dest, copy, magic, backslash) { if (REG_MULTI) { - clnum = reg_mmatch->startpos[no].lnum; - if (clnum < 0 || reg_mmatch->endpos[no].lnum < 0) + clnum = rex.reg_mmatch->startpos[no].lnum; + if (clnum < 0 || rex.reg_mmatch->endpos[no].lnum < 0) s = NULL; else { - s = reg_getline(clnum) + reg_mmatch->startpos[no].col; - if (reg_mmatch->endpos[no].lnum == clnum) - len = reg_mmatch->endpos[no].col - - reg_mmatch->startpos[no].col; + s = reg_getline(clnum) + rex.reg_mmatch->startpos[no].col; + if (rex.reg_mmatch->endpos[no].lnum == clnum) + len = rex.reg_mmatch->endpos[no].col + - rex.reg_mmatch->startpos[no].col; else len = (int)STRLEN(s); } } else { - s = reg_match->startp[no]; - if (reg_match->endp[no] == NULL) + s = rex.reg_match->startp[no]; + if (rex.reg_match->endp[no] == NULL) s = NULL; else - len = (int)(reg_match->endp[no] - s); + len = (int)(rex.reg_match->endp[no] - s); } if (s != NULL) { @@ -7694,14 +7785,14 @@ vim_regsub_both(source, dest, copy, magic, backslash) { if (REG_MULTI) { - if (reg_mmatch->endpos[no].lnum == clnum) + if (rex.reg_mmatch->endpos[no].lnum == clnum) break; if (copy) *dst = CAR; ++dst; s = reg_getline(++clnum); - if (reg_mmatch->endpos[no].lnum == clnum) - len = reg_mmatch->endpos[no].col; + if (rex.reg_mmatch->endpos[no].lnum == clnum) + len = rex.reg_mmatch->endpos[no].col; else len = (int)STRLEN(s); } @@ -7790,7 +7881,7 @@ vim_regsub_both(source, dest, copy, magic, backslash) } #ifdef FEAT_EVAL -static char_u *reg_getline_submatch __ARGS((linenr_T lnum)); +static char_u *reg_getline_submatch(linenr_T lnum); /* * Call reg_getline() with the line numbers from the submatch. If a @@ -7798,20 +7889,19 @@ static char_u *reg_getline_submatch __ARGS((linenr_T lnum)); * overwritten. */ static char_u * -reg_getline_submatch(lnum) - linenr_T lnum; +reg_getline_submatch(linenr_T lnum) { char_u *s; - linenr_T save_first = reg_firstlnum; - linenr_T save_max = reg_maxline; + linenr_T save_first = rex.reg_firstlnum; + linenr_T save_max = rex.reg_maxline; - reg_firstlnum = submatch_firstlnum; - reg_maxline = submatch_maxline; + rex.reg_firstlnum = rsm.sm_firstlnum; + rex.reg_maxline = rsm.sm_maxline; s = reg_getline(lnum); - reg_firstlnum = save_first; - reg_maxline = save_max; + rex.reg_firstlnum = save_first; + rex.reg_maxline = save_max; return s; } @@ -7821,8 +7911,7 @@ reg_getline_submatch(lnum) * Returns NULL when not in a ":s" command and for a non-existing submatch. */ char_u * -reg_submatch(no) - int no; +reg_submatch(int no) { char_u *retval = NULL; char_u *s; @@ -7833,7 +7922,7 @@ reg_submatch(no) if (!can_f_submatch || no < 0) return NULL; - if (submatch_match == NULL) + if (rsm.sm_match == NULL) { /* * First round: compute the length and allocate memory. @@ -7841,18 +7930,18 @@ reg_submatch(no) */ for (round = 1; round <= 2; ++round) { - lnum = submatch_mmatch->startpos[no].lnum; - if (lnum < 0 || submatch_mmatch->endpos[no].lnum < 0) + lnum = rsm.sm_mmatch->startpos[no].lnum; + if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0) return NULL; - s = reg_getline_submatch(lnum) + submatch_mmatch->startpos[no].col; + s = reg_getline_submatch(lnum) + rsm.sm_mmatch->startpos[no].col; if (s == NULL) /* anti-crash check, cannot happen? */ break; - if (submatch_mmatch->endpos[no].lnum == lnum) + if (rsm.sm_mmatch->endpos[no].lnum == lnum) { /* Within one line: take form start to end col. */ - len = submatch_mmatch->endpos[no].col - - submatch_mmatch->startpos[no].col; + len = rsm.sm_mmatch->endpos[no].col + - rsm.sm_mmatch->startpos[no].col; if (round == 2) vim_strncpy(retval, s, len); ++len; @@ -7869,7 +7958,7 @@ reg_submatch(no) } ++len; ++lnum; - while (lnum < submatch_mmatch->endpos[no].lnum) + while (lnum < rsm.sm_mmatch->endpos[no].lnum) { s = reg_getline_submatch(lnum++); if (round == 2) @@ -7881,8 +7970,8 @@ reg_submatch(no) } if (round == 2) STRNCPY(retval + len, reg_getline_submatch(lnum), - submatch_mmatch->endpos[no].col); - len += submatch_mmatch->endpos[no].col; + rsm.sm_mmatch->endpos[no].col); + len += rsm.sm_mmatch->endpos[no].col; if (round == 2) retval[len] = NUL; ++len; @@ -7898,11 +7987,11 @@ reg_submatch(no) } else { - s = submatch_match->startp[no]; - if (s == NULL || submatch_match->endp[no] == NULL) + s = rsm.sm_match->startp[no]; + if (s == NULL || rsm.sm_match->endp[no] == NULL) retval = NULL; else - retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s)); + retval = vim_strnsave(s, (int)(rsm.sm_match->endp[no] - s)); } return retval; @@ -7916,8 +8005,7 @@ reg_submatch(no) * command, for a non-existing submatch and for any error. */ list_T * -reg_submatch_list(no) - int no; +reg_submatch_list(int no) { char_u *s; linenr_T slnum; @@ -7931,15 +8019,15 @@ reg_submatch_list(no) if (!can_f_submatch || no < 0) return NULL; - if (submatch_match == NULL) + if (rsm.sm_match == NULL) { - slnum = submatch_mmatch->startpos[no].lnum; - elnum = submatch_mmatch->endpos[no].lnum; + slnum = rsm.sm_mmatch->startpos[no].lnum; + elnum = rsm.sm_mmatch->endpos[no].lnum; if (slnum < 0 || elnum < 0) return NULL; - scol = submatch_mmatch->startpos[no].col; - ecol = submatch_mmatch->endpos[no].col; + scol = rsm.sm_mmatch->startpos[no].col; + ecol = rsm.sm_mmatch->endpos[no].col; list = list_alloc(); if (list == NULL) @@ -7968,20 +8056,20 @@ reg_submatch_list(no) } else { - s = submatch_match->startp[no]; - if (s == NULL || submatch_match->endp[no] == NULL) + s = rsm.sm_match->startp[no]; + if (s == NULL || rsm.sm_match->endp[no] == NULL) return NULL; list = list_alloc(); if (list == NULL) return NULL; if (list_append_string(list, s, - (int)(submatch_match->endp[no] - s)) == FAIL) + (int)(rsm.sm_match->endp[no] - s)) == FAIL) error = TRUE; } if (error) { - list_free(list, TRUE); + list_free(list); return NULL; } return list; @@ -7993,13 +8081,10 @@ static regengine_T bt_regengine = bt_regcomp, bt_regfree, bt_regexec_nl, - bt_regexec_multi -#ifdef DEBUG - ,(char_u *)"" -#endif + bt_regexec_multi, + (char_u *)"" }; - #include "regexp_nfa.c" static regengine_T nfa_regengine = @@ -8007,18 +8092,14 @@ static regengine_T nfa_regengine = nfa_regcomp, nfa_regfree, nfa_regexec_nl, - nfa_regexec_multi -#ifdef DEBUG - ,(char_u *)"" -#endif + nfa_regexec_multi, + (char_u *)"" }; /* Which regexp engine to use? Needed for vim_regcomp(). * Must match with 'regexpengine'. */ static int regexp_engine = 0; -#define AUTOMATIC_ENGINE 0 -#define BACKTRACKING_ENGINE 1 -#define NFA_ENGINE 2 + #ifdef DEBUG static char_u regname[][30] = { "AUTOMATIC Regexp Engine", @@ -8034,9 +8115,7 @@ static char_u regname[][30] = { * Returns NULL for an error. */ regprog_T * -vim_regcomp(expr_arg, re_flags) - char_u *expr_arg; - int re_flags; +vim_regcomp(char_u *expr_arg, int re_flags) { regprog_T *prog = NULL; char_u *expr = expr_arg; @@ -8065,20 +8144,20 @@ vim_regcomp(expr_arg, re_flags) regexp_engine = AUTOMATIC_ENGINE; } } -#ifdef DEBUG bt_regengine.expr = expr; nfa_regengine.expr = expr; -#endif /* * First try the NFA engine, unless backtracking was requested. */ if (regexp_engine != BACKTRACKING_ENGINE) - prog = nfa_regengine.regcomp(expr, re_flags); + prog = nfa_regengine.regcomp(expr, + re_flags + (regexp_engine == AUTOMATIC_ENGINE ? RE_AUTO : 0)); else prog = bt_regengine.regcomp(expr, re_flags); - if (prog == NULL) /* error compiling regexp with initial engine */ + /* Check for error compiling regexp with initial engine. */ + if (prog == NULL) { #ifdef BT_REGEXP_DEBUG_LOG if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */ @@ -8092,15 +8171,27 @@ vim_regcomp(expr_arg, re_flags) } else EMSG2("(NFA) Could not open \"%s\" to write !!!", - BT_REGEXP_DEBUG_LOG_NAME); + BT_REGEXP_DEBUG_LOG_NAME); } #endif /* - * If the NFA engine failed, the backtracking engine won't work either. - * + * If the NFA engine failed, try the backtracking engine. + * The NFA engine also fails for patterns that it can't handle well + * but are still valid patterns, thus a retry should work. + */ if (regexp_engine == AUTOMATIC_ENGINE) + { + regexp_engine = BACKTRACKING_ENGINE; prog = bt_regengine.regcomp(expr, re_flags); - */ + } + } + + if (prog != NULL) + { + /* Store the info needed to call regcomp() again when the engine turns + * out to be very slow when executing it. */ + prog->re_engine = regexp_engine; + prog->re_flags = re_flags; } return prog; @@ -8110,60 +8201,193 @@ vim_regcomp(expr_arg, re_flags) * Free a compiled regexp program, returned by vim_regcomp(). */ void -vim_regfree(prog) - regprog_T *prog; +vim_regfree(regprog_T *prog) { if (prog != NULL) prog->engine->regfree(prog); } +#ifdef FEAT_EVAL +static void report_re_switch(char_u *pat); + + static void +report_re_switch(char_u *pat) +{ + if (p_verbose > 0) + { + verbose_enter(); + MSG_PUTS(_("Switching to backtracking RE engine for pattern: ")); + MSG_PUTS(pat); + verbose_leave(); + } +} +#endif + /* * Match a regexp against a string. * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). + * Note: "rmp->regprog" may be freed and changed. * Uses curbuf for line count and 'iskeyword'. + * When "nl" is TRUE consider a "\n" in "line" to be a line break. * * Return TRUE if there is a match, FALSE if not. + */ + static int +vim_regexec_string( + regmatch_T *rmp, + char_u *line, /* string to match against */ + colnr_T col, /* column to start looking for match */ + int nl) +{ + int result; + regexec_T rex_save; + int rex_in_use_save = rex_in_use; + + if (rex_in_use) + /* Being called recursively, save the state. */ + rex_save = rex; + rex_in_use = TRUE; + rex.reg_startp = NULL; + rex.reg_endp = NULL; + rex.reg_startpos = NULL; + rex.reg_endpos = NULL; + + result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + + /* NFA engine aborted because it's very slow. */ + if (rmp->regprog->re_engine == AUTOMATIC_ENGINE + && result == NFA_TOO_EXPENSIVE) + { + int save_p_re = p_re; + int re_flags = rmp->regprog->re_flags; + char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern); + + p_re = BACKTRACKING_ENGINE; + vim_regfree(rmp->regprog); + if (pat != NULL) + { +#ifdef FEAT_EVAL + report_re_switch(pat); +#endif + rmp->regprog = vim_regcomp(pat, re_flags); + if (rmp->regprog != NULL) + result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + vim_free(pat); + } + + p_re = save_p_re; + } + + rex_in_use = rex_in_use_save; + if (rex_in_use) + rex = rex_save; + + return result > 0; +} + +/* + * Note: "*prog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. */ int -vim_regexec(rmp, line, col) - regmatch_T *rmp; - char_u *line; /* string to match against */ - colnr_T col; /* column to start looking for match */ +vim_regexec_prog( + regprog_T **prog, + int ignore_case, + char_u *line, + colnr_T col) { - return rmp->regprog->engine->regexec_nl(rmp, line, col, FALSE); + int r; + regmatch_T regmatch; + + regmatch.regprog = *prog; + regmatch.rm_ic = ignore_case; + r = vim_regexec_string(®match, line, col, FALSE); + *prog = regmatch.regprog; + return r; +} + +/* + * Note: "rmp->regprog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. + */ + int +vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col) +{ + return vim_regexec_string(rmp, line, col, FALSE); } #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ || defined(FIND_REPLACE_DIALOG) || defined(PROTO) /* * Like vim_regexec(), but consider a "\n" in "line" to be a line break. + * Note: "rmp->regprog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. */ int -vim_regexec_nl(rmp, line, col) - regmatch_T *rmp; - char_u *line; - colnr_T col; +vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col) { - return rmp->regprog->engine->regexec_nl(rmp, line, col, TRUE); + return vim_regexec_string(rmp, line, col, TRUE); } #endif /* * Match a regexp against multiple lines. * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). + * Note: "rmp->regprog" may be freed and changed. * Uses curbuf for line count and 'iskeyword'. * * Return zero if there is no match. Return number of lines contained in the * match otherwise. */ long -vim_regexec_multi(rmp, win, buf, lnum, col, tm) - regmmatch_T *rmp; - win_T *win; /* window in which to search or NULL */ - buf_T *buf; /* buffer in which to search */ - linenr_T lnum; /* nr of line to start looking for match */ - colnr_T col; /* column to start looking for match */ - proftime_T *tm; /* timeout limit or NULL */ +vim_regexec_multi( + regmmatch_T *rmp, + win_T *win, /* window in which to search or NULL */ + buf_T *buf, /* buffer in which to search */ + linenr_T lnum, /* nr of line to start looking for match */ + colnr_T col, /* column to start looking for match */ + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag is set when timeout limit reached */ { - return rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm); + int result; + regexec_T rex_save; + int rex_in_use_save = rex_in_use; + + if (rex_in_use) + /* Being called recursively, save the state. */ + rex_save = rex; + rex_in_use = TRUE; + + result = rmp->regprog->engine->regexec_multi( + rmp, win, buf, lnum, col, tm, timed_out); + + /* NFA engine aborted because it's very slow. */ + if (rmp->regprog->re_engine == AUTOMATIC_ENGINE + && result == NFA_TOO_EXPENSIVE) + { + int save_p_re = p_re; + int re_flags = rmp->regprog->re_flags; + char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern); + + p_re = BACKTRACKING_ENGINE; + vim_regfree(rmp->regprog); + if (pat != NULL) + { +#ifdef FEAT_EVAL + report_re_switch(pat); +#endif + rmp->regprog = vim_regcomp(pat, re_flags); + if (rmp->regprog != NULL) + result = rmp->regprog->engine->regexec_multi( + rmp, win, buf, lnum, col, tm, timed_out); + vim_free(pat); + } + p_re = save_p_re; + } + + rex_in_use = rex_in_use_save; + if (rex_in_use) + rex = rex_save; + + return result <= 0 ? 0 : result; } diff --git a/src/regexp.h b/src/regexp.h index cd619daf41..a3526e6975 100644 --- a/src/regexp.h +++ b/src/regexp.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE * @@ -27,6 +27,18 @@ */ #define NFA_MAX_BRACES 20 +/* + * In the NFA engine: how many states are allowed + */ +#define NFA_MAX_STATES 100000 +#define NFA_TOO_EXPENSIVE -1 + +/* Which regexp engine to use? Needed for vim_regcomp(). + * Must match with 'regexpengine'. */ +#define AUTOMATIC_ENGINE 0 +#define BACKTRACKING_ENGINE 1 +#define NFA_ENGINE 2 + typedef struct regengine regengine_T; /* @@ -38,6 +50,8 @@ typedef struct regprog { regengine_T *engine; unsigned regflags; + unsigned re_engine; /* automatic, backtracking or nfa engine */ + unsigned re_flags; /* second argument for vim_regcomp() */ } regprog_T; /* @@ -47,9 +61,11 @@ typedef struct regprog */ typedef struct { - /* These two members implement regprog_T */ + /* These four members implement regprog_T */ regengine_T *engine; unsigned regflags; + unsigned re_engine; + unsigned re_flags; /* second argument for vim_regcomp() */ int regstart; char_u reganch; @@ -81,9 +97,11 @@ struct nfa_state */ typedef struct { - /* These two members implement regprog_T */ + /* These three members implement regprog_T */ regengine_T *engine; unsigned regflags; + unsigned re_engine; + unsigned re_flags; /* second argument for vim_regcomp() */ nfa_state_T *start; /* points into state[] */ @@ -96,9 +114,7 @@ typedef struct #ifdef FEAT_SYN_HL int reghasz; #endif -#ifdef DEBUG char_u *pattern; -#endif int nsubexp; /* number of () */ int nstate; nfa_state_T state[1]; /* actually longer.. */ @@ -149,11 +165,9 @@ struct regengine { regprog_T *(*regcomp)(char_u*, int); void (*regfree)(regprog_T *); - int (*regexec_nl)(regmatch_T*, char_u*, colnr_T, int); - long (*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*); -#ifdef DEBUG + int (*regexec_nl)(regmatch_T *, char_u *, colnr_T, int); + long (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, proftime_T *, int *); char_u *expr; -#endif }; #endif /* _REGEXP_H */ diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index a7fbe7b254..193fc30eca 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * NFA regular expression implementation. * @@ -22,11 +22,13 @@ * regexp.c */ #ifdef DEBUG +/* # define NFA_REGEXP_ERROR_LOG "nfa_regexp_error.log" # define ENABLE_LOG # define NFA_REGEXP_DUMP_LOG "nfa_regexp_dump.log" # define NFA_REGEXP_RUN_LOG "nfa_regexp_run.log" # define NFA_REGEXP_DEBUG_LOG "nfa_regexp_debug.log" +*/ #endif /* Added to NFA_ANY - NFA_NUPPER_IC to include a NL. */ @@ -50,7 +52,7 @@ enum NFA_CONCAT, /* concatenate two previous items (postfix * only) */ NFA_OR, /* \| (postfix only) */ - NFA_STAR, /* greedy * (posfix only) */ + NFA_STAR, /* greedy * (postfix only) */ NFA_STAR_NONGREEDY, /* non-greedy * (postfix only) */ NFA_QUEST, /* greedy \? (postfix only) */ NFA_QUEST_NONGREEDY, /* non-greedy \? (postfix only) */ @@ -244,6 +246,9 @@ static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c"); static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %ld"); +/* re_flags passed to nfa_regcomp() */ +static int nfa_re_flags; + /* NFA regexp \ze operator encountered. */ static int nfa_has_zend; @@ -279,43 +284,43 @@ static int nfa_alt_listid; /* 0 for first call to nfa_regmatch(), 1 for recursive call. */ static int nfa_ll_index = 0; -static int nfa_regcomp_start __ARGS((char_u *expr, int re_flags)); -static int nfa_get_reganch __ARGS((nfa_state_T *start, int depth)); -static int nfa_get_regstart __ARGS((nfa_state_T *start, int depth)); -static char_u *nfa_get_match_text __ARGS((nfa_state_T *start)); -static int realloc_post_list __ARGS((void)); -static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl)); -static int nfa_emit_equi_class __ARGS((int c)); -static int nfa_regatom __ARGS((void)); -static int nfa_regpiece __ARGS((void)); -static int nfa_regconcat __ARGS((void)); -static int nfa_regbranch __ARGS((void)); -static int nfa_reg __ARGS((int paren)); +static int nfa_regcomp_start(char_u *expr, int re_flags); +static int nfa_get_reganch(nfa_state_T *start, int depth); +static int nfa_get_regstart(nfa_state_T *start, int depth); +static char_u *nfa_get_match_text(nfa_state_T *start); +static int realloc_post_list(void); +static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl); +static int nfa_emit_equi_class(int c); +static int nfa_regatom(void); +static int nfa_regpiece(void); +static int nfa_regconcat(void); +static int nfa_regbranch(void); +static int nfa_reg(int paren); #ifdef DEBUG -static void nfa_set_code __ARGS((int c)); -static void nfa_postfix_dump __ARGS((char_u *expr, int retval)); -static void nfa_print_state __ARGS((FILE *debugf, nfa_state_T *state)); -static void nfa_print_state2 __ARGS((FILE *debugf, nfa_state_T *state, garray_T *indent)); -static void nfa_dump __ARGS((nfa_regprog_T *prog)); -#endif -static int *re2post __ARGS((void)); -static nfa_state_T *alloc_state __ARGS((int c, nfa_state_T *out, nfa_state_T *out1)); -static void st_error __ARGS((int *postfix, int *end, int *p)); -static int nfa_max_width __ARGS((nfa_state_T *startstate, int depth)); -static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size)); -static void nfa_postprocess __ARGS((nfa_regprog_T *prog)); -static int check_char_class __ARGS((int class, int c)); -static void nfa_save_listids __ARGS((nfa_regprog_T *prog, int *list)); -static void nfa_restore_listids __ARGS((nfa_regprog_T *prog, int *list)); -static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos)); -static long nfa_regtry __ARGS((nfa_regprog_T *prog, colnr_T col)); -static long nfa_regexec_both __ARGS((char_u *line, colnr_T col)); -static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags)); -static void nfa_regfree __ARGS((regprog_T *prog)); -static int nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr)); -static long nfa_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); -static int match_follows __ARGS((nfa_state_T *startstate, int depth)); -static int failure_chance __ARGS((nfa_state_T *state, int depth)); +static void nfa_set_code(int c); +static void nfa_postfix_dump(char_u *expr, int retval); +static void nfa_print_state(FILE *debugf, nfa_state_T *state); +static void nfa_print_state2(FILE *debugf, nfa_state_T *state, garray_T *indent); +static void nfa_dump(nfa_regprog_T *prog); +#endif +static int *re2post(void); +static nfa_state_T *alloc_state(int c, nfa_state_T *out, nfa_state_T *out1); +static void st_error(int *postfix, int *end, int *p); +static int nfa_max_width(nfa_state_T *startstate, int depth); +static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size); +static void nfa_postprocess(nfa_regprog_T *prog); +static int check_char_class(int class, int c); +static void nfa_save_listids(nfa_regprog_T *prog, int *list); +static void nfa_restore_listids(nfa_regprog_T *prog, int *list); +static int nfa_re_num_cmp(long_u val, int op, long_u pos); +static long nfa_regtry(nfa_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out); +static long nfa_regexec_both(char_u *line, colnr_T col, proftime_T *tm, int *timed_out); +static regprog_T *nfa_regcomp(char_u *expr, int re_flags); +static void nfa_regfree(regprog_T *prog); +static int nfa_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr); +static long nfa_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm, int *timed_out); +static int match_follows(nfa_state_T *startstate, int depth); +static int failure_chance(nfa_state_T *state, int depth); /* helper functions used when doing re2post() ... regatom() parsing */ #define EMIT(c) do { \ @@ -329,9 +334,9 @@ static int failure_chance __ARGS((nfa_state_T *state, int depth)); * Return OK on success, FAIL otherwise. */ static int -nfa_regcomp_start(expr, re_flags) - char_u *expr; - int re_flags; /* see vim_regcomp() */ +nfa_regcomp_start( + char_u *expr, + int re_flags) /* see vim_regcomp() */ { size_t postfix_size; int nstate_max; @@ -367,9 +372,7 @@ nfa_regcomp_start(expr, re_flags) * of the line. */ static int -nfa_get_reganch(start, depth) - nfa_state_T *start; - int depth; +nfa_get_reganch(nfa_state_T *start, int depth) { nfa_state_T *p = start; @@ -431,9 +434,7 @@ nfa_get_reganch(start, depth) * at start of the match. */ static int -nfa_get_regstart(start, depth) - nfa_state_T *start; - int depth; +nfa_get_regstart(nfa_state_T *start, int depth) { nfa_state_T *p = start; @@ -517,8 +518,7 @@ nfa_get_regstart(start, depth) * regstart. Otherwise return NULL. */ static char_u * -nfa_get_match_text(start) - nfa_state_T *start; +nfa_get_match_text(nfa_state_T *start) { nfa_state_T *p = start; int len = 0; @@ -539,7 +539,6 @@ nfa_get_match_text(start) ret = alloc(len); if (ret != NULL) { - len = 0; p = start->out->out; /* skip first char, it goes into regstart */ s = ret; while (p->c > 0) @@ -562,7 +561,7 @@ nfa_get_match_text(start) * running above the estimated number of states. */ static int -realloc_post_list() +realloc_post_list(void) { int nstate_max = (int)(post_end - post_start); int new_max = nstate_max + 1000; @@ -592,10 +591,7 @@ realloc_post_list() * need to be interpreted as [a-zA-Z]. */ static int -nfa_recognize_char_class(start, end, extra_newl) - char_u *start; - char_u *end; - int extra_newl; +nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl) { # define CLASS_not 0x80 # define CLASS_af 0x40 @@ -634,37 +630,39 @@ nfa_recognize_char_class(start, end, extra_newl) config |= CLASS_o9; break; } - else if (*(p + 2) == '7') { config |= CLASS_o7; break; } + return FAIL; + case 'a': if (*(p + 2) == 'z') { config |= CLASS_az; break; } - else if (*(p + 2) == 'f') { config |= CLASS_af; break; } + return FAIL; + case 'A': if (*(p + 2) == 'Z') { config |= CLASS_AZ; break; } - else if (*(p + 2) == 'F') { config |= CLASS_AF; break; } - /* FALLTHROUGH */ + return FAIL; + default: return FAIL; } @@ -742,8 +740,7 @@ nfa_recognize_char_class(start, end, extra_newl) * NOTE! When changing this function, also update reg_equi_class() */ static int -nfa_emit_equi_class(c) - int c; +nfa_emit_equi_class(int c) { #define EMIT2(c) EMIT(c); EMIT(NFA_CONCAT); #ifdef FEAT_MBYTE @@ -757,14 +754,129 @@ nfa_emit_equi_class(c) || STRCMP(p_enc, "iso-8859-15") == 0) #endif { +#ifdef EBCDIC +# define A_circumflex 0x62 +# define A_diaeresis 0x63 +# define A_grave 0x64 +# define A_acute 0x65 +# define A_virguilla 0x66 +# define A_ring 0x67 +# define C_cedilla 0x68 +# define E_acute 0x71 +# define E_circumflex 0x72 +# define E_diaeresis 0x73 +# define E_grave 0x74 +# define I_acute 0x75 +# define I_circumflex 0x76 +# define I_diaeresis 0x77 +# define I_grave 0x78 +# define N_virguilla 0x69 +# define O_circumflex 0xeb +# define O_diaeresis 0xec +# define O_grave 0xed +# define O_acute 0xee +# define O_virguilla 0xef +# define O_slash 0x80 +# define U_circumflex 0xfb +# define U_diaeresis 0xfc +# define U_grave 0xfd +# define U_acute 0xfe +# define Y_acute 0xba +# define a_grave 0x42 +# define a_acute 0x43 +# define a_circumflex 0x44 +# define a_virguilla 0x45 +# define a_diaeresis 0x46 +# define a_ring 0x47 +# define c_cedilla 0x48 +# define e_grave 0x51 +# define e_acute 0x52 +# define e_circumflex 0x53 +# define e_diaeresis 0x54 +# define i_grave 0x55 +# define i_acute 0x56 +# define i_circumflex 0x57 +# define i_diaeresis 0x58 +# define n_virguilla 0x49 +# define o_grave 0xcb +# define o_acute 0xcc +# define o_circumflex 0xcd +# define o_virguilla 0xce +# define o_diaeresis 0xcf +# define o_slash 0x70 +# define u_grave 0xdb +# define u_acute 0xdc +# define u_circumflex 0xdd +# define u_diaeresis 0xde +# define y_acute 0x8d +# define y_diaeresis 0xdf +#else +# define A_grave 0xc0 +# define A_acute 0xc1 +# define A_circumflex 0xc2 +# define A_virguilla 0xc3 +# define A_diaeresis 0xc4 +# define A_ring 0xc5 +# define C_cedilla 0xc7 +# define E_grave 0xc8 +# define E_acute 0xc9 +# define E_circumflex 0xca +# define E_diaeresis 0xcb +# define I_grave 0xcc +# define I_acute 0xcd +# define I_circumflex 0xce +# define I_diaeresis 0xcf +# define N_virguilla 0xd1 +# define O_grave 0xd2 +# define O_acute 0xd3 +# define O_circumflex 0xd4 +# define O_virguilla 0xd5 +# define O_diaeresis 0xd6 +# define O_slash 0xd8 +# define U_grave 0xd9 +# define U_acute 0xda +# define U_circumflex 0xdb +# define U_diaeresis 0xdc +# define Y_acute 0xdd +# define a_grave 0xe0 +# define a_acute 0xe1 +# define a_circumflex 0xe2 +# define a_virguilla 0xe3 +# define a_diaeresis 0xe4 +# define a_ring 0xe5 +# define c_cedilla 0xe7 +# define e_grave 0xe8 +# define e_acute 0xe9 +# define e_circumflex 0xea +# define e_diaeresis 0xeb +# define i_grave 0xec +# define i_acute 0xed +# define i_circumflex 0xee +# define i_diaeresis 0xef +# define n_virguilla 0xf1 +# define o_grave 0xf2 +# define o_acute 0xf3 +# define o_circumflex 0xf4 +# define o_virguilla 0xf5 +# define o_diaeresis 0xf6 +# define o_slash 0xf8 +# define u_grave 0xf9 +# define u_acute 0xfa +# define u_circumflex 0xfb +# define u_diaeresis 0xfc +# define y_acute 0xfd +# define y_diaeresis 0xff +#endif switch (c) { - case 'A': case 0300: case 0301: case 0302: - case 0303: case 0304: case 0305: - CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) CASEMBC(0x1cd) - CASEMBC(0x1de) CASEMBC(0x1e0) CASEMBC(0x1ea2) - EMIT2('A'); EMIT2(0300); EMIT2(0301); EMIT2(0302); - EMIT2(0303); EMIT2(0304); EMIT2(0305); + case 'A': case A_grave: case A_acute: case A_circumflex: + case A_virguilla: case A_diaeresis: case A_ring: + CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) + CASEMBC(0x1cd) CASEMBC(0x1de) CASEMBC(0x1e0) + CASEMBC(0x1ea2) + EMIT2('A'); EMIT2(A_grave); EMIT2(A_acute); + EMIT2(A_circumflex); EMIT2(A_virguilla); + EMIT2(A_diaeresis); EMIT2(A_ring); EMITMBC(0x100) EMITMBC(0x102) EMITMBC(0x104) EMITMBC(0x1cd) EMITMBC(0x1de) EMITMBC(0x1e0) EMITMBC(0x1ea2) @@ -774,23 +886,25 @@ nfa_emit_equi_class(c) EMIT2('B'); EMITMBC(0x1e02) EMITMBC(0x1e06) return OK; - case 'C': case 0307: - CASEMBC(0x106) CASEMBC(0x108) CASEMBC(0x10a) CASEMBC(0x10c) - EMIT2('C'); EMIT2(0307); EMITMBC(0x106) EMITMBC(0x108) + case 'C': case C_cedilla: CASEMBC(0x106) CASEMBC(0x108) + CASEMBC(0x10a) CASEMBC(0x10c) + EMIT2('C'); EMIT2(C_cedilla); + EMITMBC(0x106) EMITMBC(0x108) EMITMBC(0x10a) EMITMBC(0x10c) return OK; case 'D': CASEMBC(0x10e) CASEMBC(0x110) CASEMBC(0x1e0a) - CASEMBC(0x1e0e) CASEMBC(0x1e10) + CASEMBC(0x1e0e) CASEMBC(0x1e10) EMIT2('D'); EMITMBC(0x10e) EMITMBC(0x110) EMITMBC(0x1e0a) EMITMBC(0x1e0e) EMITMBC(0x1e10) return OK; - case 'E': case 0310: case 0311: case 0312: case 0313: - CASEMBC(0x112) CASEMBC(0x114) CASEMBC(0x116) CASEMBC(0x118) - CASEMBC(0x11a) CASEMBC(0x1eba) CASEMBC(0x1ebc) - EMIT2('E'); EMIT2(0310); EMIT2(0311); EMIT2(0312); - EMIT2(0313); + case 'E': case E_grave: case E_acute: case E_circumflex: + case E_diaeresis: CASEMBC(0x112) CASEMBC(0x114) + CASEMBC(0x116) CASEMBC(0x118) CASEMBC(0x11a) + CASEMBC(0x1eba) CASEMBC(0x1ebc) + EMIT2('E'); EMIT2(E_grave); EMIT2(E_acute); + EMIT2(E_circumflex); EMIT2(E_diaeresis); EMITMBC(0x112) EMITMBC(0x114) EMITMBC(0x116) EMITMBC(0x118) EMITMBC(0x11a) EMITMBC(0x1eba) EMITMBC(0x1ebc) @@ -801,24 +915,26 @@ nfa_emit_equi_class(c) return OK; case 'G': CASEMBC(0x11c) CASEMBC(0x11e) CASEMBC(0x120) - CASEMBC(0x122) CASEMBC(0x1e4) CASEMBC(0x1e6) CASEMBC(0x1f4) - CASEMBC(0x1e20) + CASEMBC(0x122) CASEMBC(0x1e4) CASEMBC(0x1e6) + CASEMBC(0x1f4) CASEMBC(0x1e20) EMIT2('G'); EMITMBC(0x11c) EMITMBC(0x11e) EMITMBC(0x120) EMITMBC(0x122) EMITMBC(0x1e4) EMITMBC(0x1e6) EMITMBC(0x1f4) EMITMBC(0x1e20) return OK; case 'H': CASEMBC(0x124) CASEMBC(0x126) CASEMBC(0x1e22) - CASEMBC(0x1e26) CASEMBC(0x1e28) + CASEMBC(0x1e26) CASEMBC(0x1e28) EMIT2('H'); EMITMBC(0x124) EMITMBC(0x126) EMITMBC(0x1e22) EMITMBC(0x1e26) EMITMBC(0x1e28) return OK; - case 'I': case 0314: case 0315: case 0316: case 0317: - CASEMBC(0x128) CASEMBC(0x12a) CASEMBC(0x12c) CASEMBC(0x12e) - CASEMBC(0x130) CASEMBC(0x1cf) CASEMBC(0x1ec8) - EMIT2('I'); EMIT2(0314); EMIT2(0315); EMIT2(0316); - EMIT2(0317); EMITMBC(0x128) EMITMBC(0x12a) + case 'I': case I_grave: case I_acute: case I_circumflex: + case I_diaeresis: CASEMBC(0x128) CASEMBC(0x12a) + CASEMBC(0x12c) CASEMBC(0x12e) CASEMBC(0x130) + CASEMBC(0x1cf) CASEMBC(0x1ec8) + EMIT2('I'); EMIT2(I_grave); EMIT2(I_acute); + EMIT2(I_circumflex); EMIT2(I_diaeresis); + EMITMBC(0x128) EMITMBC(0x12a) EMITMBC(0x12c) EMITMBC(0x12e) EMITMBC(0x130) EMITMBC(0x1cf) EMITMBC(0x1ec8) return OK; @@ -828,13 +944,13 @@ nfa_emit_equi_class(c) return OK; case 'K': CASEMBC(0x136) CASEMBC(0x1e8) CASEMBC(0x1e30) - CASEMBC(0x1e34) + CASEMBC(0x1e34) EMIT2('K'); EMITMBC(0x136) EMITMBC(0x1e8) EMITMBC(0x1e30) EMITMBC(0x1e34) return OK; case 'L': CASEMBC(0x139) CASEMBC(0x13b) CASEMBC(0x13d) - CASEMBC(0x13f) CASEMBC(0x141) CASEMBC(0x1e3a) + CASEMBC(0x13f) CASEMBC(0x141) CASEMBC(0x1e3a) EMIT2('L'); EMITMBC(0x139) EMITMBC(0x13b) EMITMBC(0x13d) EMITMBC(0x13f) EMITMBC(0x141) EMITMBC(0x1e3a) return OK; @@ -843,19 +959,21 @@ nfa_emit_equi_class(c) EMIT2('M'); EMITMBC(0x1e3e) EMITMBC(0x1e40) return OK; - case 'N': case 0321: - CASEMBC(0x143) CASEMBC(0x145) CASEMBC(0x147) CASEMBC(0x1e44) - CASEMBC(0x1e48) - EMIT2('N'); EMIT2(0321); EMITMBC(0x143) EMITMBC(0x145) + case 'N': case N_virguilla: CASEMBC(0x143) CASEMBC(0x145) + CASEMBC(0x147) CASEMBC(0x1e44) CASEMBC(0x1e48) + EMIT2('N'); EMIT2(N_virguilla); + EMITMBC(0x143) EMITMBC(0x145) EMITMBC(0x147) EMITMBC(0x1e44) EMITMBC(0x1e48) return OK; - case 'O': case 0322: case 0323: case 0324: case 0325: - case 0326: case 0330: - CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) CASEMBC(0x1a0) - CASEMBC(0x1d1) CASEMBC(0x1ea) CASEMBC(0x1ec) CASEMBC(0x1ece) - EMIT2('O'); EMIT2(0322); EMIT2(0323); EMIT2(0324); - EMIT2(0325); EMIT2(0326); EMIT2(0330); + case 'O': case O_grave: case O_acute: case O_circumflex: + case O_virguilla: case O_diaeresis: case O_slash: + CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) + CASEMBC(0x1a0) CASEMBC(0x1d1) CASEMBC(0x1ea) + CASEMBC(0x1ec) CASEMBC(0x1ece) + EMIT2('O'); EMIT2(O_grave); EMIT2(O_acute); + EMIT2(O_circumflex); EMIT2(O_virguilla); + EMIT2(O_diaeresis); EMIT2(O_slash); EMITMBC(0x14c) EMITMBC(0x14e) EMITMBC(0x150) EMITMBC(0x1a0) EMITMBC(0x1d1) EMITMBC(0x1ea) EMITMBC(0x1ec) EMITMBC(0x1ece) @@ -866,29 +984,31 @@ nfa_emit_equi_class(c) return OK; case 'R': CASEMBC(0x154) CASEMBC(0x156) CASEMBC(0x158) - CASEMBC(0x1e58) CASEMBC(0x1e5e) + CASEMBC(0x1e58) CASEMBC(0x1e5e) EMIT2('R'); EMITMBC(0x154) EMITMBC(0x156) EMITMBC(0x158) EMITMBC(0x1e58) EMITMBC(0x1e5e) return OK; case 'S': CASEMBC(0x15a) CASEMBC(0x15c) CASEMBC(0x15e) - CASEMBC(0x160) CASEMBC(0x1e60) + CASEMBC(0x160) CASEMBC(0x1e60) EMIT2('S'); EMITMBC(0x15a) EMITMBC(0x15c) EMITMBC(0x15e) EMITMBC(0x160) EMITMBC(0x1e60) return OK; case 'T': CASEMBC(0x162) CASEMBC(0x164) CASEMBC(0x166) - CASEMBC(0x1e6a) CASEMBC(0x1e6e) + CASEMBC(0x1e6a) CASEMBC(0x1e6e) EMIT2('T'); EMITMBC(0x162) EMITMBC(0x164) EMITMBC(0x166) EMITMBC(0x1e6a) EMITMBC(0x1e6e) return OK; - case 'U': case 0331: case 0332: case 0333: case 0334: - CASEMBC(0x168) CASEMBC(0x16a) CASEMBC(0x16c) CASEMBC(0x16e) - CASEMBC(0x170) CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) - CASEMBC(0x1ee6) - EMIT2('U'); EMIT2(0331); EMIT2(0332); EMIT2(0333); - EMIT2(0334); EMITMBC(0x168) EMITMBC(0x16a) + case 'U': case U_grave: case U_acute: case U_diaeresis: + case U_circumflex: CASEMBC(0x168) CASEMBC(0x16a) + CASEMBC(0x16c) CASEMBC(0x16e) CASEMBC(0x170) + CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) + CASEMBC(0x1ee6) + EMIT2('U'); EMIT2(U_grave); EMIT2(U_acute); + EMIT2(U_diaeresis); EMIT2(U_circumflex); + EMITMBC(0x168) EMITMBC(0x16a) EMITMBC(0x16c) EMITMBC(0x16e) EMITMBC(0x170) EMITMBC(0x172) EMITMBC(0x1af) EMITMBC(0x1d3) EMITMBC(0x1ee6) @@ -899,7 +1019,7 @@ nfa_emit_equi_class(c) return OK; case 'W': CASEMBC(0x174) CASEMBC(0x1e80) CASEMBC(0x1e82) - CASEMBC(0x1e84) CASEMBC(0x1e86) + CASEMBC(0x1e84) CASEMBC(0x1e86) EMIT2('W'); EMITMBC(0x174) EMITMBC(0x1e80) EMITMBC(0x1e82) EMITMBC(0x1e84) EMITMBC(0x1e86) return OK; @@ -908,26 +1028,29 @@ nfa_emit_equi_class(c) EMIT2('X'); EMITMBC(0x1e8a) EMITMBC(0x1e8c) return OK; - case 'Y': case 0335: - CASEMBC(0x176) CASEMBC(0x178) CASEMBC(0x1e8e) CASEMBC(0x1ef2) - CASEMBC(0x1ef6) CASEMBC(0x1ef8) - EMIT2('Y'); EMIT2(0335); EMITMBC(0x176) EMITMBC(0x178) + case 'Y': case Y_acute: CASEMBC(0x176) CASEMBC(0x178) + CASEMBC(0x1e8e) CASEMBC(0x1ef2) CASEMBC(0x1ef6) + CASEMBC(0x1ef8) + EMIT2('Y'); EMIT2(Y_acute); + EMITMBC(0x176) EMITMBC(0x178) EMITMBC(0x1e8e) EMITMBC(0x1ef2) EMITMBC(0x1ef6) EMITMBC(0x1ef8) return OK; case 'Z': CASEMBC(0x179) CASEMBC(0x17b) CASEMBC(0x17d) - CASEMBC(0x1b5) CASEMBC(0x1e90) CASEMBC(0x1e94) + CASEMBC(0x1b5) CASEMBC(0x1e90) CASEMBC(0x1e94) EMIT2('Z'); EMITMBC(0x179) EMITMBC(0x17b) EMITMBC(0x17d) EMITMBC(0x1b5) EMITMBC(0x1e90) EMITMBC(0x1e94) return OK; - case 'a': case 0340: case 0341: case 0342: - case 0343: case 0344: case 0345: - CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) CASEMBC(0x1ce) - CASEMBC(0x1df) CASEMBC(0x1e1) CASEMBC(0x1ea3) - EMIT2('a'); EMIT2(0340); EMIT2(0341); EMIT2(0342); - EMIT2(0343); EMIT2(0344); EMIT2(0345); + case 'a': case a_grave: case a_acute: case a_circumflex: + case a_virguilla: case a_diaeresis: case a_ring: + CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) + CASEMBC(0x1ce) CASEMBC(0x1df) CASEMBC(0x1e1) + CASEMBC(0x1ea3) + EMIT2('a'); EMIT2(a_grave); EMIT2(a_acute); + EMIT2(a_circumflex); EMIT2(a_virguilla); + EMIT2(a_diaeresis); EMIT2(a_ring); EMITMBC(0x101) EMITMBC(0x103) EMITMBC(0x105) EMITMBC(0x1ce) EMITMBC(0x1df) EMITMBC(0x1e1) EMITMBC(0x1ea3) @@ -937,23 +1060,26 @@ nfa_emit_equi_class(c) EMIT2('b'); EMITMBC(0x1e03) EMITMBC(0x1e07) return OK; - case 'c': case 0347: - CASEMBC(0x107) CASEMBC(0x109) CASEMBC(0x10b) CASEMBC(0x10d) - EMIT2('c'); EMIT2(0347); EMITMBC(0x107) EMITMBC(0x109) + case 'c': case c_cedilla: CASEMBC(0x107) CASEMBC(0x109) + CASEMBC(0x10b) CASEMBC(0x10d) + EMIT2('c'); EMIT2(c_cedilla); + EMITMBC(0x107) EMITMBC(0x109) EMITMBC(0x10b) EMITMBC(0x10d) return OK; - case 'd': CASEMBC(0x10f) CASEMBC(0x111) CASEMBC(0x1d0b) - CASEMBC(0x1e11) - EMIT2('d'); EMITMBC(0x10f) EMITMBC(0x111) EMITMBC(0x1e0b) - EMITMBC(0x01e0f) EMITMBC(0x1e11) + case 'd': CASEMBC(0x10f) CASEMBC(0x111) CASEMBC(0x1e0b) + CASEMBC(0x1e0f) CASEMBC(0x1e11) + EMIT2('d'); EMITMBC(0x10f) EMITMBC(0x111) + EMITMBC(0x1e0b) EMITMBC(0x1e0f) EMITMBC(0x1e11) return OK; - case 'e': case 0350: case 0351: case 0352: case 0353: - CASEMBC(0x113) CASEMBC(0x115) CASEMBC(0x117) CASEMBC(0x119) - CASEMBC(0x11b) CASEMBC(0x1ebb) CASEMBC(0x1ebd) - EMIT2('e'); EMIT2(0350); EMIT2(0351); EMIT2(0352); - EMIT2(0353); EMITMBC(0x113) EMITMBC(0x115) + case 'e': case e_grave: case e_acute: case e_circumflex: + case e_diaeresis: CASEMBC(0x113) CASEMBC(0x115) + CASEMBC(0x117) CASEMBC(0x119) CASEMBC(0x11b) + CASEMBC(0x1ebb) CASEMBC(0x1ebd) + EMIT2('e'); EMIT2(e_grave); EMIT2(e_acute); + EMIT2(e_circumflex); EMIT2(e_diaeresis); + EMITMBC(0x113) EMITMBC(0x115) EMITMBC(0x117) EMITMBC(0x119) EMITMBC(0x11b) EMITMBC(0x1ebb) EMITMBC(0x1ebd) return OK; @@ -963,24 +1089,26 @@ nfa_emit_equi_class(c) return OK; case 'g': CASEMBC(0x11d) CASEMBC(0x11f) CASEMBC(0x121) - CASEMBC(0x123) CASEMBC(0x1e5) CASEMBC(0x1e7) CASEMBC(0x1f5) - CASEMBC(0x1e21) + CASEMBC(0x123) CASEMBC(0x1e5) CASEMBC(0x1e7) + CASEMBC(0x1f5) CASEMBC(0x1e21) EMIT2('g'); EMITMBC(0x11d) EMITMBC(0x11f) EMITMBC(0x121) EMITMBC(0x123) EMITMBC(0x1e5) EMITMBC(0x1e7) EMITMBC(0x1f5) EMITMBC(0x1e21) return OK; case 'h': CASEMBC(0x125) CASEMBC(0x127) CASEMBC(0x1e23) - CASEMBC(0x1e27) CASEMBC(0x1e29) CASEMBC(0x1e96) + CASEMBC(0x1e27) CASEMBC(0x1e29) CASEMBC(0x1e96) EMIT2('h'); EMITMBC(0x125) EMITMBC(0x127) EMITMBC(0x1e23) EMITMBC(0x1e27) EMITMBC(0x1e29) EMITMBC(0x1e96) return OK; - case 'i': case 0354: case 0355: case 0356: case 0357: - CASEMBC(0x129) CASEMBC(0x12b) CASEMBC(0x12d) CASEMBC(0x12f) - CASEMBC(0x1d0) CASEMBC(0x1ec9) - EMIT2('i'); EMIT2(0354); EMIT2(0355); EMIT2(0356); - EMIT2(0357); EMITMBC(0x129) EMITMBC(0x12b) + case 'i': case i_grave: case i_acute: case i_circumflex: + case i_diaeresis: CASEMBC(0x129) CASEMBC(0x12b) + CASEMBC(0x12d) CASEMBC(0x12f) CASEMBC(0x1d0) + CASEMBC(0x1ec9) + EMIT2('i'); EMIT2(i_grave); EMIT2(i_acute); + EMIT2(i_circumflex); EMIT2(i_diaeresis); + EMITMBC(0x129) EMITMBC(0x12b) EMITMBC(0x12d) EMITMBC(0x12f) EMITMBC(0x1d0) EMITMBC(0x1ec9) return OK; @@ -990,13 +1118,13 @@ nfa_emit_equi_class(c) return OK; case 'k': CASEMBC(0x137) CASEMBC(0x1e9) CASEMBC(0x1e31) - CASEMBC(0x1e35) + CASEMBC(0x1e35) EMIT2('k'); EMITMBC(0x137) EMITMBC(0x1e9) EMITMBC(0x1e31) EMITMBC(0x1e35) return OK; case 'l': CASEMBC(0x13a) CASEMBC(0x13c) CASEMBC(0x13e) - CASEMBC(0x140) CASEMBC(0x142) CASEMBC(0x1e3b) + CASEMBC(0x140) CASEMBC(0x142) CASEMBC(0x1e3b) EMIT2('l'); EMITMBC(0x13a) EMITMBC(0x13c) EMITMBC(0x13e) EMITMBC(0x140) EMITMBC(0x142) EMITMBC(0x1e3b) return OK; @@ -1005,20 +1133,23 @@ nfa_emit_equi_class(c) EMIT2('m'); EMITMBC(0x1e3f) EMITMBC(0x1e41) return OK; - case 'n': case 0361: - CASEMBC(0x144) CASEMBC(0x146) CASEMBC(0x148) CASEMBC(0x149) - CASEMBC(0x1e45) CASEMBC(0x1e49) - EMIT2('n'); EMIT2(0361); EMITMBC(0x144) EMITMBC(0x146) + case 'n': case n_virguilla: CASEMBC(0x144) CASEMBC(0x146) + CASEMBC(0x148) CASEMBC(0x149) CASEMBC(0x1e45) + CASEMBC(0x1e49) + EMIT2('n'); EMIT2(n_virguilla); + EMITMBC(0x144) EMITMBC(0x146) EMITMBC(0x148) EMITMBC(0x149) EMITMBC(0x1e45) EMITMBC(0x1e49) return OK; - case 'o': case 0362: case 0363: case 0364: case 0365: - case 0366: case 0370: - CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) CASEMBC(0x1a1) - CASEMBC(0x1d2) CASEMBC(0x1eb) CASEMBC(0x1ed) CASEMBC(0x1ecf) - EMIT2('o'); EMIT2(0362); EMIT2(0363); EMIT2(0364); - EMIT2(0365); EMIT2(0366); EMIT2(0370); + case 'o': case o_grave: case o_acute: case o_circumflex: + case o_virguilla: case o_diaeresis: case o_slash: + CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) + CASEMBC(0x1a1) CASEMBC(0x1d2) CASEMBC(0x1eb) + CASEMBC(0x1ed) CASEMBC(0x1ecf) + EMIT2('o'); EMIT2(o_grave); EMIT2(o_acute); + EMIT2(o_circumflex); EMIT2(o_virguilla); + EMIT2(o_diaeresis); EMIT2(o_slash); EMITMBC(0x14d) EMITMBC(0x14f) EMITMBC(0x151) EMITMBC(0x1a1) EMITMBC(0x1d2) EMITMBC(0x1eb) EMITMBC(0x1ed) EMITMBC(0x1ecf) @@ -1029,29 +1160,31 @@ nfa_emit_equi_class(c) return OK; case 'r': CASEMBC(0x155) CASEMBC(0x157) CASEMBC(0x159) - CASEMBC(0x1e59) CASEMBC(0x1e5f) + CASEMBC(0x1e59) CASEMBC(0x1e5f) EMIT2('r'); EMITMBC(0x155) EMITMBC(0x157) EMITMBC(0x159) EMITMBC(0x1e59) EMITMBC(0x1e5f) return OK; case 's': CASEMBC(0x15b) CASEMBC(0x15d) CASEMBC(0x15f) - CASEMBC(0x161) CASEMBC(0x1e61) + CASEMBC(0x161) CASEMBC(0x1e61) EMIT2('s'); EMITMBC(0x15b) EMITMBC(0x15d) EMITMBC(0x15f) EMITMBC(0x161) EMITMBC(0x1e61) return OK; case 't': CASEMBC(0x163) CASEMBC(0x165) CASEMBC(0x167) - CASEMBC(0x1e6b) CASEMBC(0x1e6f) CASEMBC(0x1e97) + CASEMBC(0x1e6b) CASEMBC(0x1e6f) CASEMBC(0x1e97) EMIT2('t'); EMITMBC(0x163) EMITMBC(0x165) EMITMBC(0x167) EMITMBC(0x1e6b) EMITMBC(0x1e6f) EMITMBC(0x1e97) return OK; - case 'u': case 0371: case 0372: case 0373: case 0374: - CASEMBC(0x169) CASEMBC(0x16b) CASEMBC(0x16d) CASEMBC(0x16f) - CASEMBC(0x171) CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) - CASEMBC(0x1ee7) - EMIT2('u'); EMIT2(0371); EMIT2(0372); EMIT2(0373); - EMIT2(0374); EMITMBC(0x169) EMITMBC(0x16b) + case 'u': case u_grave: case u_acute: case u_circumflex: + case u_diaeresis: CASEMBC(0x169) CASEMBC(0x16b) + CASEMBC(0x16d) CASEMBC(0x16f) CASEMBC(0x171) + CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) + CASEMBC(0x1ee7) + EMIT2('u'); EMIT2(u_grave); EMIT2(u_acute); + EMIT2(u_circumflex); EMIT2(u_diaeresis); + EMITMBC(0x169) EMITMBC(0x16b) EMITMBC(0x16d) EMITMBC(0x16f) EMITMBC(0x171) EMITMBC(0x173) EMITMBC(0x1b0) EMITMBC(0x1d4) EMITMBC(0x1ee7) @@ -1062,7 +1195,7 @@ nfa_emit_equi_class(c) return OK; case 'w': CASEMBC(0x175) CASEMBC(0x1e81) CASEMBC(0x1e83) - CASEMBC(0x1e85) CASEMBC(0x1e87) CASEMBC(0x1e98) + CASEMBC(0x1e85) CASEMBC(0x1e87) CASEMBC(0x1e98) EMIT2('w'); EMITMBC(0x175) EMITMBC(0x1e81) EMITMBC(0x1e83) EMITMBC(0x1e85) EMITMBC(0x1e87) EMITMBC(0x1e98) return OK; @@ -1071,16 +1204,17 @@ nfa_emit_equi_class(c) EMIT2('x'); EMITMBC(0x1e8b) EMITMBC(0x1e8d) return OK; - case 'y': case 0375: case 0377: - CASEMBC(0x177) CASEMBC(0x1e8f) CASEMBC(0x1e99) - CASEMBC(0x1ef3) CASEMBC(0x1ef7) CASEMBC(0x1ef9) - EMIT2('y'); EMIT2(0375); EMIT2(0377); EMITMBC(0x177) + case 'y': case y_acute: case y_diaeresis: CASEMBC(0x177) + CASEMBC(0x1e8f) CASEMBC(0x1e99) CASEMBC(0x1ef3) + CASEMBC(0x1ef7) CASEMBC(0x1ef9) + EMIT2('y'); EMIT2(y_acute); EMIT2(y_diaeresis); + EMITMBC(0x177) EMITMBC(0x1e8f) EMITMBC(0x1e99) EMITMBC(0x1ef3) EMITMBC(0x1ef7) EMITMBC(0x1ef9) return OK; case 'z': CASEMBC(0x17a) CASEMBC(0x17c) CASEMBC(0x17e) - CASEMBC(0x1b6) CASEMBC(0x1e91) CASEMBC(0x1e95) + CASEMBC(0x1b6) CASEMBC(0x1e91) CASEMBC(0x1e95) EMIT2('z'); EMITMBC(0x17a) EMITMBC(0x17c) EMITMBC(0x17e) EMITMBC(0x1b6) EMITMBC(0x1e91) EMITMBC(0x1e95) return OK; @@ -1116,7 +1250,7 @@ nfa_emit_equi_class(c) * or \z( pattern \) */ static int -nfa_regatom() +nfa_regatom(void) { int c; int charclass; @@ -1135,6 +1269,7 @@ nfa_regatom() int startc = -1; int endc = -1; int oldstartc = -1; + int save_prev_at_start = prev_at_start; c = getchr(); switch (c) @@ -1187,7 +1322,7 @@ nfa_regatom() goto collection; /* "\_x" is character class plus newline */ - /*FALLTHROUGH*/ + /* FALLTHROUGH */ /* * Character classes. @@ -1228,7 +1363,7 @@ nfa_regatom() rc_did_emsg = TRUE; return FAIL; } - EMSGN("INTERNAL: Unknown character class char: %ld", c); + IEMSGN("INTERNAL: Unknown character class char: %ld", c); return FAIL; } #ifdef FEAT_MBYTE @@ -1294,7 +1429,7 @@ nfa_regatom() EMSG(_(e_nopresub)); return FAIL; } - for (lp = reg_prev_sub; *lp != NUL; mb_cptr_adv(lp)) + for (lp = reg_prev_sub; *lp != NUL; MB_CPTR_ADV(lp)) { EMIT(PTR2CHAR(lp)); if (lp != reg_prev_sub) @@ -1313,8 +1448,14 @@ nfa_regatom() case Magic('7'): case Magic('8'): case Magic('9'): - EMIT(NFA_BACKREF1 + (no_Magic(c) - '1')); - nfa_has_backref = TRUE; + { + int refnum = no_Magic(c) - '1'; + + if (!seen_endbrace(refnum + 1)) + return FAIL; + EMIT(NFA_BACKREF1 + refnum); + nfa_has_backref = TRUE; + } break; case Magic('z'): @@ -1323,10 +1464,14 @@ nfa_regatom() { case 's': EMIT(NFA_ZSTART); + if (re_mult_next("\\zs") == FAIL) + return FAIL; break; case 'e': EMIT(NFA_ZEND); nfa_has_zend = TRUE; + if (re_mult_next("\\ze") == FAIL) + return FAIL; break; #ifdef FEAT_SYN_HL case '1': @@ -1379,7 +1524,7 @@ nfa_regatom() case 'u': /* %uabcd hex 4 */ case 'U': /* %U1234abcd hex 8 */ { - int nr; + long nr; switch (c) { @@ -1449,7 +1594,7 @@ nfa_regatom() * matched an unlimited number of times. NFA_NOPEN is * added only once at a position, while NFA_SPLIT is * added multiple times. This is more efficient than - * not allowsing NFA_SPLIT multiple times, it is used + * not allowing NFA_SPLIT multiple times, it is used * a lot. */ EMIT(NFA_NOPEN); break; @@ -1457,7 +1602,7 @@ nfa_regatom() default: { - int n = 0; + long n = 0; int cmp = c; if (c == '<' || c == '>') @@ -1470,9 +1615,13 @@ nfa_regatom() if (c == 'l' || c == 'c' || c == 'v') { if (c == 'l') + { /* \%{n}l \%{n}<l \%{n}>l */ EMIT(cmp == '<' ? NFA_LNUM_LT : cmp == '>' ? NFA_LNUM_GT : NFA_LNUM); + if (save_prev_at_start) + at_start = TRUE; + } else if (c == 'c') /* \%{n}c \%{n}<c \%{n}>c */ EMIT(cmp == '<' ? NFA_COL_LT : @@ -1481,7 +1630,14 @@ nfa_regatom() /* \%{n}v \%{n}<v \%{n}>v */ EMIT(cmp == '<' ? NFA_VCOL_LT : cmp == '>' ? NFA_VCOL_GT : NFA_VCOL); - EMIT(n); +#if VIM_SIZEOF_INT < VIM_SIZEOF_LONG + if (n > INT_MAX) + { + EMSG(_("E951: \\% value too large")); + return FAIL; + } +#endif + EMIT((int)n); break; } else if (c == '\'' && n == 0) @@ -1533,7 +1689,7 @@ nfa_regatom() else EMIT(result); regparse = endp; - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); return OK; } /* @@ -1545,7 +1701,7 @@ nfa_regatom() if (*regparse == '^') /* negated range */ { negated = TRUE; - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); EMIT(NFA_START_NEG_COLL); } else @@ -1555,7 +1711,7 @@ nfa_regatom() startc = '-'; EMIT(startc); EMIT(NFA_CONCAT); - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); } /* Emit the OR branches for each character in the [] */ emit_range = FALSE; @@ -1658,7 +1814,7 @@ nfa_regatom() { emit_range = TRUE; startc = oldstartc; - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); continue; /* reading the end of the range */ } @@ -1678,7 +1834,7 @@ nfa_regatom() ) ) { - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); if (*regparse == 'n') startc = reg_string ? NL : NFA_NEWL; @@ -1693,7 +1849,7 @@ nfa_regatom() /* TODO(RE) This needs more testing */ startc = coll_get_char(); got_coll_char = TRUE; - mb_ptr_back(old_regparse, regparse); + MB_PTR_BACK(old_regparse, regparse); } else { @@ -1712,7 +1868,7 @@ nfa_regatom() endc = startc; startc = oldstartc; if (startc > endc) - EMSG_RET_FAIL(_(e_invrange)); + EMSG_RET_FAIL(_(e_reverse_range)); if (endc > startc + 2) { @@ -1793,10 +1949,10 @@ nfa_regatom() } } - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); } /* while (p < endp) */ - mb_ptr_back(old_regparse, regparse); + MB_PTR_BACK(old_regparse, regparse); if (*regparse == '-') /* if last, '-' is just a char */ { EMIT('-'); @@ -1805,7 +1961,7 @@ nfa_regatom() /* skip the trailing ] */ regparse = endp; - mb_ptr_adv(regparse); + MB_PTR_ADV(regparse); /* Mark end of the collection. */ if (negated == TRUE) @@ -1835,7 +1991,7 @@ nfa_regatom() nfa_do_multibyte: /* plen is length of current char with composing chars */ if (enc_utf8 && ((*mb_char2len)(c) - != (plen = (*mb_ptr2len)(old_regparse)) + != (plen = utfc_ptr2len(old_regparse)) || utf_iscomposing(c))) { int i = 0; @@ -1884,7 +2040,7 @@ nfa_regatom() * or atom multi */ static int -nfa_regpiece() +nfa_regpiece(void) { int i; int op; @@ -1893,7 +2049,7 @@ nfa_regpiece() int greedy = TRUE; /* Braces are prefixed with '-' ? */ parse_state_T old_state; parse_state_T new_state; - int c2; + long c2; int old_post_pos; int my_post_start; int quest; @@ -2007,10 +2163,10 @@ nfa_regpiece() * <atom>* */ if (minval == 0 && maxval == MAX_LIMIT) { - if (greedy) + if (greedy) /* { { (match the braces) */ /* \{}, \{0,} */ EMIT(NFA_STAR); - else + else /* { { (match the braces) */ /* \{-}, \{-0,} */ EMIT(NFA_STAR_NONGREEDY); break; @@ -2026,6 +2182,13 @@ nfa_regpiece() return OK; } + /* The engine is very inefficient (uses too many states) when the + * maximum is much larger than the minimum and when the maximum is + * large. Bail out if we can use the other engine. */ + if ((nfa_re_flags & RE_AUTO) + && (maxval > 500 || maxval > minval + 200)) + return FAIL; + /* Ignore previous call to nfa_regatom() */ post_ptr = post_start + my_post_start; /* Save parse state after the repeated atom and the \{} */ @@ -2087,7 +2250,7 @@ nfa_regpiece() * etc. */ static int -nfa_regconcat() +nfa_regconcat(void) { int cont = TRUE; int first = TRUE; @@ -2165,9 +2328,8 @@ nfa_regconcat() * etc. */ static int -nfa_regbranch() +nfa_regbranch(void) { - int ch; int old_post_pos; old_post_pos = (int)(post_ptr - post_start); @@ -2176,11 +2338,13 @@ nfa_regbranch() if (nfa_regconcat() == FAIL) return FAIL; - ch = peekchr(); /* Try next concats */ - while (ch == Magic('&')) + while (peekchr() == Magic('&')) { skipchr(); + /* if concat is empty do emit a node */ + if (old_post_pos == (int)(post_ptr - post_start)) + EMIT(NFA_EMPTY); EMIT(NFA_NOPEN); EMIT(NFA_PREV_ATOM_NO_WIDTH); old_post_pos = (int)(post_ptr - post_start); @@ -2190,7 +2354,6 @@ nfa_regbranch() if (old_post_pos == (int)(post_ptr - post_start)) EMIT(NFA_EMPTY); EMIT(NFA_CONCAT); - ch = peekchr(); } /* if a branch is empty, emit one node for it */ @@ -2212,8 +2375,8 @@ nfa_regbranch() * etc. */ static int -nfa_reg(paren) - int paren; /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */ +nfa_reg( + int paren) /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */ { int parno = 0; @@ -2280,8 +2443,7 @@ nfa_reg(paren) static char_u code[50]; static void -nfa_set_code(c) - int c; +nfa_set_code(int c) { int addnl = FALSE; @@ -2517,9 +2679,7 @@ static FILE *log_fd; * Print the postfix notation of the current regexp. */ static void -nfa_postfix_dump(expr, retval) - char_u *expr; - int retval; +nfa_postfix_dump(char_u *expr, int retval) { int *p; FILE *f; @@ -2550,9 +2710,7 @@ nfa_postfix_dump(expr, retval) * Print the NFA starting with a root node "state". */ static void -nfa_print_state(debugf, state) - FILE *debugf; - nfa_state_T *state; +nfa_print_state(FILE *debugf, nfa_state_T *state) { garray_T indent; @@ -2563,10 +2721,7 @@ nfa_print_state(debugf, state) } static void -nfa_print_state2(debugf, state, indent) - FILE *debugf; - nfa_state_T *state; - garray_T *indent; +nfa_print_state2(FILE *debugf, nfa_state_T *state, garray_T *indent) { char_u *p; @@ -2627,8 +2782,7 @@ nfa_print_state2(debugf, state, indent) * Print the NFA state machine. */ static void -nfa_dump(prog) - nfa_regprog_T *prog; +nfa_dump(nfa_regprog_T *prog) { FILE *debugf = fopen(NFA_REGEXP_DUMP_LOG, "a"); @@ -2655,7 +2809,7 @@ nfa_dump(prog) * Return the postfix string on success, NULL otherwise. */ static int * -re2post() +re2post(void) { if (nfa_reg(REG_NOPAREN) == FAIL) return NULL; @@ -2678,10 +2832,7 @@ static nfa_state_T *state_ptr; /* points to nfa_prog->state */ * Allocate and initialize nfa_state_T. */ static nfa_state_T * -alloc_state(c, out, out1) - int c; - nfa_state_T *out; - nfa_state_T *out1; +alloc_state(int c, nfa_state_T *out, nfa_state_T *out1) { nfa_state_T *s; @@ -2726,20 +2877,18 @@ struct Frag }; typedef struct Frag Frag_T; -static Frag_T frag __ARGS((nfa_state_T *start, Ptrlist *out)); -static Ptrlist *list1 __ARGS((nfa_state_T **outp)); -static void patch __ARGS((Ptrlist *l, nfa_state_T *s)); -static Ptrlist *append __ARGS((Ptrlist *l1, Ptrlist *l2)); -static void st_push __ARGS((Frag_T s, Frag_T **p, Frag_T *stack_end)); -static Frag_T st_pop __ARGS((Frag_T **p, Frag_T *stack)); +static Frag_T frag(nfa_state_T *start, Ptrlist *out); +static Ptrlist *list1(nfa_state_T **outp); +static void patch(Ptrlist *l, nfa_state_T *s); +static Ptrlist *append(Ptrlist *l1, Ptrlist *l2); +static void st_push(Frag_T s, Frag_T **p, Frag_T *stack_end); +static Frag_T st_pop(Frag_T **p, Frag_T *stack); /* * Initialize a Frag_T struct and return it. */ static Frag_T -frag(start, out) - nfa_state_T *start; - Ptrlist *out; +frag(nfa_state_T *start, Ptrlist *out) { Frag_T n; @@ -2752,8 +2901,8 @@ frag(start, out) * Create singleton list containing just outp. */ static Ptrlist * -list1(outp) - nfa_state_T **outp; +list1( + nfa_state_T **outp) { Ptrlist *l; @@ -2766,9 +2915,7 @@ list1(outp) * Patch the list of states at out to point to start. */ static void -patch(l, s) - Ptrlist *l; - nfa_state_T *s; +patch(Ptrlist *l, nfa_state_T *s) { Ptrlist *next; @@ -2784,9 +2931,7 @@ patch(l, s) * Join the two lists l1 and l2, returning the combination. */ static Ptrlist * -append(l1, l2) - Ptrlist *l1; - Ptrlist *l2; +append(Ptrlist *l1, Ptrlist *l2) { Ptrlist *oldl1; @@ -2803,10 +2948,7 @@ append(l1, l2) static Frag_T empty; static void -st_error(postfix, end, p) - int *postfix UNUSED; - int *end UNUSED; - int *p UNUSED; +st_error(int *postfix UNUSED, int *end UNUSED, int *p UNUSED) { #ifdef NFA_REGEXP_ERROR_LOG FILE *df; @@ -2855,10 +2997,7 @@ st_error(postfix, end, p) * Push an item onto the stack. */ static void -st_push(s, p, stack_end) - Frag_T s; - Frag_T **p; - Frag_T *stack_end; +st_push(Frag_T s, Frag_T **p, Frag_T *stack_end) { Frag_T *stackp = *p; @@ -2872,9 +3011,7 @@ st_push(s, p, stack_end) * Pop an item from the stack. */ static Frag_T -st_pop(p, stack) - Frag_T **p; - Frag_T *stack; +st_pop(Frag_T **p, Frag_T *stack) { Frag_T *stackp; @@ -2890,9 +3027,7 @@ st_pop(p, stack) * When unknown or unlimited return -1. */ static int -nfa_max_width(startstate, depth) - nfa_state_T *startstate; - int depth; +nfa_max_width(nfa_state_T *startstate, int depth) { int l, r; nfa_state_T *state = startstate; @@ -3115,10 +3250,7 @@ nfa_max_width(startstate, depth) * Return the NFA start state on success, NULL otherwise. */ static nfa_state_T * -post2nfa(postfix, end, nfa_calc_size) - int *postfix; - int *end; - int nfa_calc_size; +post2nfa(int *postfix, int *end, int nfa_calc_size) { int *p; int mopen; @@ -3142,6 +3274,7 @@ post2nfa(postfix, end, nfa_calc_size) if (stackp < stack) \ { \ st_error(postfix, end, p); \ + vim_free(stack); \ return NULL; \ } @@ -3403,7 +3536,11 @@ post2nfa(postfix, end, nfa_calc_size) { /* NFA_ZEND -> NFA_END_PATTERN -> NFA_SKIP -> what follows. */ skip = alloc_state(NFA_SKIP, NULL, NULL); + if (skip == NULL) + goto theend; zend = alloc_state(NFA_ZEND, s1, NULL); + if (zend == NULL) + goto theend; s1->out= skip; patch(e.out, zend); PUSH(frag(s, list1(&skip->out))); @@ -3618,10 +3755,16 @@ post2nfa(postfix, end, nfa_calc_size) e = POP(); if (stackp != stack) + { + vim_free(stack); EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack")); + } if (istate >= nstate) + { + vim_free(stack); EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA ")); + } matchstate = &state_ptr[istate++]; /* the match state */ matchstate->c = NFA_MATCH; @@ -3647,8 +3790,7 @@ post2nfa(postfix, end, nfa_calc_size) * After building the NFA program, inspect it to add optimization hints. */ static void -nfa_postprocess(prog) - nfa_regprog_T *prog; +nfa_postprocess(nfa_regprog_T *prog) { int i; int c; @@ -3713,8 +3855,10 @@ typedef struct { struct multipos { - lpos_T start; - lpos_T end; + linenr_T start_lnum; + linenr_T end_lnum; + colnr_T start_col; + colnr_T end_col; } multi[NSUBEXP]; struct linepos { @@ -3774,13 +3918,12 @@ typedef struct } nfa_list_T; #ifdef ENABLE_LOG -static void log_subsexpr __ARGS((regsubs_T *subs)); -static void log_subexpr __ARGS((regsub_T *sub)); -static char *pim_info __ARGS((nfa_pim_T *pim)); +static void log_subsexpr(regsubs_T *subs); +static void log_subexpr(regsub_T *sub); +static char *pim_info(nfa_pim_T *pim); static void -log_subsexpr(subs) - regsubs_T *subs; +log_subsexpr(regsubs_T *subs) { log_subexpr(&subs->norm); # ifdef FEAT_SYN_HL @@ -3790,8 +3933,7 @@ log_subsexpr(subs) } static void -log_subexpr(sub) - regsub_T *sub; +log_subexpr(regsub_T *sub) { int j; @@ -3799,10 +3941,10 @@ log_subexpr(sub) if (REG_MULTI) fprintf(log_fd, "*** group %d, start: c=%d, l=%d, end: c=%d, l=%d\n", j, - sub->list.multi[j].start.col, - (int)sub->list.multi[j].start.lnum, - sub->list.multi[j].end.col, - (int)sub->list.multi[j].end.lnum); + sub->list.multi[j].start_col, + (int)sub->list.multi[j].start_lnum, + sub->list.multi[j].end_col, + (int)sub->list.multi[j].end_lnum); else { char *s = (char *)sub->list.line[j].start; @@ -3816,8 +3958,7 @@ log_subexpr(sub) } static char * -pim_info(pim) - nfa_pim_T *pim; +pim_info(nfa_pim_T *pim) { static char buf[30]; @@ -3835,27 +3976,30 @@ pim_info(pim) /* Used during execution: whether a match has been found. */ static int nfa_match; - -static void copy_pim __ARGS((nfa_pim_T *to, nfa_pim_T *from)); -static void clear_sub __ARGS((regsub_T *sub)); -static void copy_sub __ARGS((regsub_T *to, regsub_T *from)); -static void copy_sub_off __ARGS((regsub_T *to, regsub_T *from)); -static void copy_ze_off __ARGS((regsub_T *to, regsub_T *from)); -static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2)); -static int match_backref __ARGS((regsub_T *sub, int subidx, int *bytelen)); -static int has_state_with_pos __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim)); -static int pim_equal __ARGS((nfa_pim_T *one, nfa_pim_T *two)); -static int state_in_list __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs)); -static regsubs_T *addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs_arg, nfa_pim_T *pim, int off)); -static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim, int *ip)); +#ifdef FEAT_RELTIME +static proftime_T *nfa_time_limit; +static int *nfa_timed_out; +static int nfa_time_count; +#endif + +static void copy_pim(nfa_pim_T *to, nfa_pim_T *from); +static void clear_sub(regsub_T *sub); +static void copy_sub(regsub_T *to, regsub_T *from); +static void copy_sub_off(regsub_T *to, regsub_T *from); +static void copy_ze_off(regsub_T *to, regsub_T *from); +static int sub_equal(regsub_T *sub1, regsub_T *sub2); +static int match_backref(regsub_T *sub, int subidx, int *bytelen); +static int has_state_with_pos(nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim); +static int pim_equal(nfa_pim_T *one, nfa_pim_T *two); +static int state_in_list(nfa_list_T *l, nfa_state_T *state, regsubs_T *subs); +static regsubs_T *addstate(nfa_list_T *l, nfa_state_T *state, regsubs_T *subs_arg, nfa_pim_T *pim, int off); +static void addstate_here(nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim, int *ip); /* * Copy postponed invisible match info from "from" to "to". */ static void -copy_pim(to, from) - nfa_pim_T *to; - nfa_pim_T *from; +copy_pim(nfa_pim_T *to, nfa_pim_T *from) { to->result = from->result; to->state = from->state; @@ -3868,8 +4012,7 @@ copy_pim(to, from) } static void -clear_sub(sub) - regsub_T *sub; +clear_sub(regsub_T *sub) { if (REG_MULTI) /* Use 0xff to set lnum to -1 */ @@ -3884,9 +4027,7 @@ clear_sub(sub) * Copy the submatches from "from" to "to". */ static void -copy_sub(to, from) - regsub_T *to; - regsub_T *from; +copy_sub(regsub_T *to, regsub_T *from) { to->in_use = from->in_use; if (from->in_use > 0) @@ -3907,9 +4048,7 @@ copy_sub(to, from) * Like copy_sub() but exclude the main match. */ static void -copy_sub_off(to, from) - regsub_T *to; - regsub_T *from; +copy_sub_off(regsub_T *to, regsub_T *from) { if (to->in_use < from->in_use) to->in_use = from->in_use; @@ -3931,16 +4070,17 @@ copy_sub_off(to, from) * Like copy_sub() but only do the end of the main match if \ze is present. */ static void -copy_ze_off(to, from) - regsub_T *to; - regsub_T *from; +copy_ze_off(regsub_T *to, regsub_T *from) { if (nfa_has_zend) { if (REG_MULTI) { - if (from->list.multi[0].end.lnum >= 0) - to->list.multi[0].end = from->list.multi[0].end; + if (from->list.multi[0].end_lnum >= 0) + { + to->list.multi[0].end_lnum = from->list.multi[0].end_lnum; + to->list.multi[0].end_col = from->list.multi[0].end_col; + } } else { @@ -3955,9 +4095,7 @@ copy_ze_off(to, from) * When using back-references also check the end position. */ static int -sub_equal(sub1, sub2) - regsub_T *sub1; - regsub_T *sub2; +sub_equal(regsub_T *sub1, regsub_T *sub2) { int i; int todo; @@ -3972,33 +4110,33 @@ sub_equal(sub1, sub2) for (i = 0; i < todo; ++i) { if (i < sub1->in_use) - s1 = sub1->list.multi[i].start.lnum; + s1 = sub1->list.multi[i].start_lnum; else s1 = -1; if (i < sub2->in_use) - s2 = sub2->list.multi[i].start.lnum; + s2 = sub2->list.multi[i].start_lnum; else s2 = -1; if (s1 != s2) return FALSE; - if (s1 != -1 && sub1->list.multi[i].start.col - != sub2->list.multi[i].start.col) + if (s1 != -1 && sub1->list.multi[i].start_col + != sub2->list.multi[i].start_col) return FALSE; if (nfa_has_backref) { if (i < sub1->in_use) - s1 = sub1->list.multi[i].end.lnum; + s1 = sub1->list.multi[i].end_lnum; else s1 = -1; if (i < sub2->in_use) - s2 = sub2->list.multi[i].end.lnum; + s2 = sub2->list.multi[i].end_lnum; else s2 = -1; if (s1 != s2) return FALSE; - if (s1 != -1 && sub1->list.multi[i].end.col - != sub2->list.multi[i].end.col) + if (s1 != -1 && sub1->list.multi[i].end_col + != sub2->list.multi[i].end_col) return FALSE; } } @@ -4049,7 +4187,7 @@ report_state(char *action, if (sub->in_use <= 0) col = -1; else if (REG_MULTI) - col = sub->list.multi[0].start.col; + col = sub->list.multi[0].start_col; else col = (int)(sub->list.line[0].start - regline); nfa_set_code(state->c); @@ -4064,11 +4202,11 @@ report_state(char *action, * positions as "subs". */ static int -has_state_with_pos(l, state, subs, pim) - nfa_list_T *l; /* runtime state list */ - nfa_state_T *state; /* state to update */ - regsubs_T *subs; /* pointers to subexpressions */ - nfa_pim_T *pim; /* postponed match or NULL */ +has_state_with_pos( + nfa_list_T *l, /* runtime state list */ + nfa_state_T *state, /* state to update */ + regsubs_T *subs, /* pointers to subexpressions */ + nfa_pim_T *pim) /* postponed match or NULL */ { nfa_thread_T *thread; int i; @@ -4093,9 +4231,7 @@ has_state_with_pos(l, state, subs, pim) * set. */ static int -pim_equal(one, two) - nfa_pim_T *one; - nfa_pim_T *two; +pim_equal(nfa_pim_T *one, nfa_pim_T *two) { int one_unused = (one == NULL || one->result == NFA_PIM_UNUSED); int two_unused = (two == NULL || two->result == NFA_PIM_UNUSED); @@ -4120,9 +4256,7 @@ pim_equal(one, two) * Return TRUE if "state" leads to a NFA_MATCH without advancing the input. */ static int -match_follows(startstate, depth) - nfa_state_T *startstate; - int depth; +match_follows(nfa_state_T *startstate, int depth) { nfa_state_T *state = startstate; @@ -4215,10 +4349,10 @@ match_follows(startstate, depth) * Return TRUE if "state" is already in list "l". */ static int -state_in_list(l, state, subs) - nfa_list_T *l; /* runtime state list */ - nfa_state_T *state; /* state to update */ - regsubs_T *subs; /* pointers to subexpressions */ +state_in_list( + nfa_list_T *l, /* runtime state list */ + nfa_state_T *state, /* state to update */ + regsubs_T *subs) /* pointers to subexpressions */ { if (state->lastlist[nfa_ll_index] == l->id) { @@ -4228,22 +4362,29 @@ state_in_list(l, state, subs) return FALSE; } +/* Offset used for "off" by addstate_here(). */ +#define ADDSTATE_HERE_OFFSET 10 + /* * Add "state" and possibly what follows to state list ".". * Returns "subs_arg", possibly copied into temp_subs. */ - static regsubs_T * -addstate(l, state, subs_arg, pim, off) - nfa_list_T *l; /* runtime state list */ - nfa_state_T *state; /* state to update */ - regsubs_T *subs_arg; /* pointers to subexpressions */ - nfa_pim_T *pim; /* postponed look-behind match */ - int off; /* byte offset, when -1 go to next line */ +addstate( + nfa_list_T *l, /* runtime state list */ + nfa_state_T *state, /* state to update */ + regsubs_T *subs_arg, /* pointers to subexpressions */ + nfa_pim_T *pim, /* postponed look-behind match */ + int off_arg) /* byte offset, when -1 go to next line */ { int subidx; + int off = off_arg; + int add_here = FALSE; + int listindex = 0; + int k; + int found = FALSE; nfa_thread_T *thread; - lpos_T save_lpos; + struct multipos save_multipos; int save_in_use; char_u *save_ptr; int i; @@ -4254,6 +4395,13 @@ addstate(l, state, subs_arg, pim, off) int did_print = FALSE; #endif + if (off_arg <= -ADDSTATE_HERE_OFFSET) + { + add_here = TRUE; + off = 0; + listindex = -(off_arg + ADDSTATE_HERE_OFFSET); + } + switch (state->c) { case NFA_NCLOSE: @@ -4337,13 +4485,28 @@ addstate(l, state, subs_arg, pim, off) if (!nfa_has_backref && pim == NULL && !l->has_pim && state->c != NFA_MATCH) { + /* When called from addstate_here() do insert before + * existing states. */ + if (add_here) + { + for (k = 0; k < l->n && k < listindex; ++k) + if (l->t[k].state->id == state->id) + { + found = TRUE; + break; + } + } + if (!add_here || found) + { skip_add: #ifdef ENABLE_LOG - nfa_set_code(state->c); - fprintf(log_fd, "> Not adding state %d to list %d. char %d: %s\n", - abs(state->id), l->id, state->c, code); + nfa_set_code(state->c); + fprintf(log_fd, "> Not adding state %d to list %d. char %d: %s pim: %s has_pim: %d found: %d\n", + abs(state->id), l->id, state->c, code, + pim == NULL ? "NULL" : "yes", l->has_pim, found); #endif - return subs; + return subs; + } } /* Do not add the state again when it exists with the same @@ -4370,6 +4533,7 @@ addstate(l, state, subs_arg, pim, off) subs = &temp_subs; } + /* TODO: check for vim_realloc() returning NULL. */ l->t = vim_realloc(l->t, newlen * sizeof(nfa_thread_T)); l->len = newlen; } @@ -4403,19 +4567,18 @@ addstate(l, state, subs_arg, pim, off) switch (state->c) { case NFA_MATCH: -// nfa_match = TRUE; break; case NFA_SPLIT: /* order matters here */ - subs = addstate(l, state->out, subs, pim, off); - subs = addstate(l, state->out1, subs, pim, off); + subs = addstate(l, state->out, subs, pim, off_arg); + subs = addstate(l, state->out1, subs, pim, off_arg); break; case NFA_EMPTY: case NFA_NOPEN: case NFA_NCLOSE: - subs = addstate(l, state->out, subs, pim, off); + subs = addstate(l, state->out, subs, pim, off_arg); break; case NFA_MOPEN: @@ -4461,8 +4624,7 @@ addstate(l, state, subs_arg, pim, off) /* avoid compiler warnings */ save_ptr = NULL; - save_lpos.lnum = 0; - save_lpos.col = 0; + vim_memset(&save_multipos, 0, sizeof(save_multipos)); /* Set the position (with "off" added) in the subexpression. Save * and restore it when it was in use. Otherwise fill any gap. */ @@ -4470,7 +4632,7 @@ addstate(l, state, subs_arg, pim, off) { if (subidx < sub->in_use) { - save_lpos = sub->list.multi[subidx].start; + save_multipos = sub->list.multi[subidx]; save_in_use = -1; } else @@ -4478,22 +4640,23 @@ addstate(l, state, subs_arg, pim, off) save_in_use = sub->in_use; for (i = sub->in_use; i < subidx; ++i) { - sub->list.multi[i].start.lnum = -1; - sub->list.multi[i].end.lnum = -1; + sub->list.multi[i].start_lnum = -1; + sub->list.multi[i].end_lnum = -1; } sub->in_use = subidx + 1; } if (off == -1) { - sub->list.multi[subidx].start.lnum = reglnum + 1; - sub->list.multi[subidx].start.col = 0; + sub->list.multi[subidx].start_lnum = reglnum + 1; + sub->list.multi[subidx].start_col = 0; } else { - sub->list.multi[subidx].start.lnum = reglnum; - sub->list.multi[subidx].start.col = + sub->list.multi[subidx].start_lnum = reglnum; + sub->list.multi[subidx].start_col = (colnr_T)(reginput - regline + off); } + sub->list.multi[subidx].end_lnum = -1; } else { @@ -4515,7 +4678,7 @@ addstate(l, state, subs_arg, pim, off) sub->list.line[subidx].start = reginput + off; } - subs = addstate(l, state->out, subs, pim, off); + subs = addstate(l, state->out, subs, pim, off_arg); /* "subs" may have changed, need to set "sub" again */ #ifdef FEAT_SYN_HL if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9) @@ -4527,7 +4690,7 @@ addstate(l, state, subs_arg, pim, off) if (save_in_use == -1) { if (REG_MULTI) - sub->list.multi[subidx].start = save_lpos; + sub->list.multi[subidx] = save_multipos; else sub->list.line[subidx].start = save_ptr; } @@ -4537,13 +4700,14 @@ addstate(l, state, subs_arg, pim, off) case NFA_MCLOSE: if (nfa_has_zend && (REG_MULTI - ? subs->norm.list.multi[0].end.lnum >= 0 + ? subs->norm.list.multi[0].end_lnum >= 0 : subs->norm.list.line[0].end != NULL)) { /* Do not overwrite the position set by \ze. */ - subs = addstate(l, state->out, subs, pim, off); + subs = addstate(l, state->out, subs, pim, off_arg); break; } + /* FALLTHROUGH */ case NFA_MCLOSE1: case NFA_MCLOSE2: case NFA_MCLOSE3: @@ -4591,16 +4755,16 @@ addstate(l, state, subs_arg, pim, off) sub->in_use = subidx + 1; if (REG_MULTI) { - save_lpos = sub->list.multi[subidx].end; + save_multipos = sub->list.multi[subidx]; if (off == -1) { - sub->list.multi[subidx].end.lnum = reglnum + 1; - sub->list.multi[subidx].end.col = 0; + sub->list.multi[subidx].end_lnum = reglnum + 1; + sub->list.multi[subidx].end_col = 0; } else { - sub->list.multi[subidx].end.lnum = reglnum; - sub->list.multi[subidx].end.col = + sub->list.multi[subidx].end_lnum = reglnum; + sub->list.multi[subidx].end_col = (colnr_T)(reginput - regline + off); } /* avoid compiler warnings */ @@ -4611,11 +4775,10 @@ addstate(l, state, subs_arg, pim, off) save_ptr = sub->list.line[subidx].end; sub->list.line[subidx].end = reginput + off; /* avoid compiler warnings */ - save_lpos.lnum = 0; - save_lpos.col = 0; + vim_memset(&save_multipos, 0, sizeof(save_multipos)); } - subs = addstate(l, state->out, subs, pim, off); + subs = addstate(l, state->out, subs, pim, off_arg); /* "subs" may have changed, need to set "sub" again */ #ifdef FEAT_SYN_HL if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9) @@ -4625,7 +4788,7 @@ addstate(l, state, subs_arg, pim, off) sub = &subs->norm; if (REG_MULTI) - sub->list.multi[subidx].end = save_lpos; + sub->list.multi[subidx] = save_multipos; else sub->list.line[subidx].end = save_ptr; sub->in_use = save_in_use; @@ -4641,19 +4804,21 @@ addstate(l, state, subs_arg, pim, off) * matters for alternatives. */ static void -addstate_here(l, state, subs, pim, ip) - nfa_list_T *l; /* runtime state list */ - nfa_state_T *state; /* state to update */ - regsubs_T *subs; /* pointers to subexpressions */ - nfa_pim_T *pim; /* postponed look-behind match */ - int *ip; +addstate_here( + nfa_list_T *l, /* runtime state list */ + nfa_state_T *state, /* state to update */ + regsubs_T *subs, /* pointers to subexpressions */ + nfa_pim_T *pim, /* postponed look-behind match */ + int *ip) { int tlen = l->n; int count; int listidx = *ip; - /* first add the state(s) at the end, so that we know how many there are */ - addstate(l, state, subs, pim, 0); + /* First add the state(s) at the end, so that we know how many there are. + * Pass the listidx as offset (avoids adding another argument to + * addstate(). */ + addstate(l, state, subs, pim, -listidx - ADDSTATE_HERE_OFFSET); /* when "*ip" was at the end of the list, nothing to do */ if (listidx + 1 == tlen) @@ -4712,18 +4877,16 @@ addstate_here(l, state, subs, pim, ip) * Check character class "class" against current character c. */ static int -check_char_class(class, c) - int class; - int c; +check_char_class(int class, int c) { switch (class) { case NFA_CLASS_ALNUM: - if (c >= 1 && c <= 255 && isalnum(c)) + if (c >= 1 && c < 128 && isalnum(c)) return OK; break; case NFA_CLASS_ALPHA: - if (c >= 1 && c <= 255 && isalpha(c)) + if (c >= 1 && c < 128 && isalpha(c)) return OK; break; case NFA_CLASS_BLANK: @@ -4731,7 +4894,7 @@ check_char_class(class, c) return OK; break; case NFA_CLASS_CNTRL: - if (c >= 1 && c <= 255 && iscntrl(c)) + if (c >= 1 && c <= 127 && iscntrl(c)) return OK; break; case NFA_CLASS_DIGIT: @@ -4739,11 +4902,11 @@ check_char_class(class, c) return OK; break; case NFA_CLASS_GRAPH: - if (c >= 1 && c <= 255 && isgraph(c)) + if (c >= 1 && c <= 127 && isgraph(c)) return OK; break; case NFA_CLASS_LOWER: - if (MB_ISLOWER(c)) + if (MB_ISLOWER(c) && c != 170 && c != 186) return OK; break; case NFA_CLASS_PRINT: @@ -4751,7 +4914,7 @@ check_char_class(class, c) return OK; break; case NFA_CLASS_PUNCT: - if (c >= 1 && c <= 255 && ispunct(c)) + if (c >= 1 && c < 128 && ispunct(c)) return OK; break; case NFA_CLASS_SPACE: @@ -4785,7 +4948,7 @@ check_char_class(class, c) default: /* should not be here :P */ - EMSGN(_(e_ill_char_class), class); + IEMSGN(_(e_ill_char_class), class); return FAIL; } return FAIL; @@ -4796,10 +4959,10 @@ check_char_class(class, c) * Return TRUE if it matches. */ static int -match_backref(sub, subidx, bytelen) - regsub_T *sub; /* pointers to subexpressions */ - int subidx; - int *bytelen; /* out: length of match in bytes */ +match_backref( + regsub_T *sub, /* pointers to subexpressions */ + int subidx, + int *bytelen) /* out: length of match in bytes */ { int len; @@ -4813,15 +4976,15 @@ match_backref(sub, subidx, bytelen) if (REG_MULTI) { - if (sub->list.multi[subidx].start.lnum < 0 - || sub->list.multi[subidx].end.lnum < 0) + if (sub->list.multi[subidx].start_lnum < 0 + || sub->list.multi[subidx].end_lnum < 0) goto retempty; - if (sub->list.multi[subidx].start.lnum == reglnum - && sub->list.multi[subidx].end.lnum == reglnum) + if (sub->list.multi[subidx].start_lnum == reglnum + && sub->list.multi[subidx].end_lnum == reglnum) { - len = sub->list.multi[subidx].end.col - - sub->list.multi[subidx].start.col; - if (cstrncmp(regline + sub->list.multi[subidx].start.col, + len = sub->list.multi[subidx].end_col + - sub->list.multi[subidx].start_col; + if (cstrncmp(regline + sub->list.multi[subidx].start_col, reginput, &len) == 0) { *bytelen = len; @@ -4831,10 +4994,10 @@ match_backref(sub, subidx, bytelen) else { if (match_with_backref( - sub->list.multi[subidx].start.lnum, - sub->list.multi[subidx].start.col, - sub->list.multi[subidx].end.lnum, - sub->list.multi[subidx].end.col, + sub->list.multi[subidx].start_lnum, + sub->list.multi[subidx].start_col, + sub->list.multi[subidx].end_lnum, + sub->list.multi[subidx].end_col, bytelen) == RA_MATCH) return TRUE; } @@ -4856,16 +5019,16 @@ match_backref(sub, subidx, bytelen) #ifdef FEAT_SYN_HL -static int match_zref __ARGS((int subidx, int *bytelen)); +static int match_zref(int subidx, int *bytelen); /* * Check for a match with \z subexpression "subidx". * Return TRUE if it matches. */ static int -match_zref(subidx, bytelen) - int subidx; - int *bytelen; /* out: length of match in bytes */ +match_zref( + int subidx, + int *bytelen) /* out: length of match in bytes */ { int len; @@ -4893,9 +5056,7 @@ match_zref(subidx, bytelen) * Only used for the recursive value lastlist[1]. */ static void -nfa_save_listids(prog, list) - nfa_regprog_T *prog; - int *list; +nfa_save_listids(nfa_regprog_T *prog, int *list) { int i; nfa_state_T *p; @@ -4914,9 +5075,7 @@ nfa_save_listids(prog, list) * Restore list IDs from "list" to all NFA states. */ static void -nfa_restore_listids(prog, list) - nfa_regprog_T *prog; - int *list; +nfa_restore_listids(nfa_regprog_T *prog, int *list) { int i; nfa_state_T *p; @@ -4930,18 +5089,15 @@ nfa_restore_listids(prog, list) } static int -nfa_re_num_cmp(val, op, pos) - long_u val; - int op; - long_u pos; +nfa_re_num_cmp(long_u val, int op, long_u pos) { if (op == 1) return pos > val; if (op == 2) return pos < val; return val == pos; } -static int recursive_regmatch __ARGS((nfa_state_T *state, nfa_pim_T *pim, nfa_regprog_T *prog, regsubs_T *submatch, regsubs_T *m, int **listids)); -static int nfa_regmatch __ARGS((nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *submatch, regsubs_T *m)); +static int recursive_regmatch(nfa_state_T *state, nfa_pim_T *pim, nfa_regprog_T *prog, regsubs_T *submatch, regsubs_T *m, int **listids); +static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *submatch, regsubs_T *m); /* * Recursively call nfa_regmatch() @@ -4949,13 +5105,13 @@ static int nfa_regmatch __ARGS((nfa_regprog_T *prog, nfa_state_T *start, regsubs * position). */ static int -recursive_regmatch(state, pim, prog, submatch, m, listids) - nfa_state_T *state; - nfa_pim_T *pim; - nfa_regprog_T *prog; - regsubs_T *submatch; - regsubs_T *m; - int **listids; +recursive_regmatch( + nfa_state_T *state, + nfa_pim_T *pim, + nfa_regprog_T *prog, + regsubs_T *submatch, + regsubs_T *m, + int **listids) { int save_reginput_col = (int)(reginput - regline); int save_reglnum = reglnum; @@ -4977,9 +5133,9 @@ recursive_regmatch(state, pim, prog, submatch, m, listids) } if (state->c == NFA_START_INVISIBLE_BEFORE - || state->c == NFA_START_INVISIBLE_BEFORE_FIRST - || state->c == NFA_START_INVISIBLE_BEFORE_NEG - || state->c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST) + || state->c == NFA_START_INVISIBLE_BEFORE_FIRST + || state->c == NFA_START_INVISIBLE_BEFORE_NEG + || state->c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST) { /* The recursive match must end at the current position. When "pim" is * not NULL it specifies the current position. */ @@ -5098,9 +5254,12 @@ recursive_regmatch(state, pim, prog, submatch, m, listids) if (REG_MULTI) regline = reg_getline(reglnum); reginput = regline + save_reginput_col; - nfa_match = save_nfa_match; + if (result != NFA_TOO_EXPENSIVE) + { + nfa_match = save_nfa_match; + nfa_listid = save_nfa_listid; + } nfa_endp = save_nfa_endp; - nfa_listid = save_nfa_listid; #ifdef ENABLE_LOG log_fd = fopen(NFA_REGEXP_RUN_LOG, "a"); @@ -5121,8 +5280,8 @@ recursive_regmatch(state, pim, prog, submatch, m, listids) return result; } -static int skip_to_start __ARGS((int c, colnr_T *colp)); -static long find_match_text __ARGS((colnr_T startcol, int regstart, char_u *match_text)); +static int skip_to_start(int c, colnr_T *colp); +static long find_match_text(colnr_T startcol, int regstart, char_u *match_text); /* * Estimate the chance of a match with "state" failing. @@ -5131,9 +5290,7 @@ static long find_match_text __ARGS((colnr_T startcol, int regstart, char_u *matc * specific character: 99 */ static int -failure_chance(state, depth) - nfa_state_T *state; - int depth; +failure_chance(nfa_state_T *state, int depth) { int c = state->c; int l, r; @@ -5293,14 +5450,12 @@ failure_chance(state, depth) * Skip until the char "c" we know a match must start with. */ static int -skip_to_start(c, colp) - int c; - colnr_T *colp; +skip_to_start(int c, colnr_T *colp) { char_u *s; /* Used often, do some work to avoid call overhead. */ - if (!ireg_ic + if (!rex.reg_ic #ifdef FEAT_MBYTE && !has_mbyte #endif @@ -5320,10 +5475,7 @@ skip_to_start(c, colp) * Returns zero for no match, 1 for a match. */ static long -find_match_text(startcol, regstart, match_text) - colnr_T startcol; - int regstart; - char_u *match_text; +find_match_text(colnr_T startcol, int regstart, char_u *match_text) { colnr_T col = startcol; int c1, c2; @@ -5338,7 +5490,7 @@ find_match_text(startcol, regstart, match_text) { c1 = PTR2CHAR(match_text + len1); c2 = PTR2CHAR(regline + col + len2); - if (c1 != c2 && (!ireg_ic || MB_TOLOWER(c1) != MB_TOLOWER(c2))) + if (c1 != c2 && (!rex.reg_ic || MB_TOLOWER(c1) != MB_TOLOWER(c2))) { match = FALSE; break; @@ -5356,15 +5508,15 @@ find_match_text(startcol, regstart, match_text) cleanup_subexpr(); if (REG_MULTI) { - reg_startpos[0].lnum = reglnum; - reg_startpos[0].col = col; - reg_endpos[0].lnum = reglnum; - reg_endpos[0].col = col + len2; + rex.reg_startpos[0].lnum = reglnum; + rex.reg_startpos[0].col = col; + rex.reg_endpos[0].lnum = reglnum; + rex.reg_endpos[0].col = col + len2; } else { - reg_startp[0] = regline + col; - reg_endp[0] = regline + col + len2; + rex.reg_startp[0] = regline + col; + rex.reg_endp[0] = regline + col + len2; } return 1L; } @@ -5377,6 +5529,20 @@ find_match_text(startcol, regstart, match_text) return 0L; } +#ifdef FEAT_RELTIME + static int +nfa_did_time_out() +{ + if (nfa_time_limit != NULL && profile_passed_limit(nfa_time_limit)) + { + if (nfa_timed_out != NULL) + *nfa_timed_out = TRUE; + return TRUE; + } + return FALSE; +} +#endif + /* * Main matching routine. * @@ -5389,14 +5555,14 @@ find_match_text(startcol, regstart, match_text) * Note: Caller must ensure that: start != NULL. */ static int -nfa_regmatch(prog, start, submatch, m) - nfa_regprog_T *prog; - nfa_state_T *start; - regsubs_T *submatch; - regsubs_T *m; +nfa_regmatch( + nfa_regprog_T *prog, + nfa_state_T *start, + regsubs_T *submatch, + regsubs_T *m) { int result; - int size = 0; + size_t size = 0; int flag = 0; int go_to_nextline = FALSE; nfa_thread_T *t; @@ -5411,24 +5577,32 @@ nfa_regmatch(prog, start, submatch, m) int add_off = 0; int toplevel = start->c == NFA_MOPEN; #ifdef NFA_REGEXP_DEBUG_LOG - FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a"); - - if (debug == NULL) - { - EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG); - return FALSE; - } + FILE *debug; #endif + /* Some patterns may take a long time to match, especially when using * recursive_regmatch(). Allow interrupting them with CTRL-C. */ fast_breakcheck(); if (got_int) return FALSE; +#ifdef FEAT_RELTIME + if (nfa_did_time_out()) + return FALSE; +#endif +#ifdef NFA_REGEXP_DEBUG_LOG + debug = fopen(NFA_REGEXP_DEBUG_LOG, "a"); + if (debug == NULL) + { + EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG); + return FALSE; + } +#endif nfa_match = FALSE; /* Allocate memory for the lists of nodes. */ size = (nstate + 1) * sizeof(nfa_thread_T); + list[0].t = (nfa_thread_T *)lalloc(size, TRUE); list[0].len = nstate + 1; list[1].t = (nfa_thread_T *)lalloc(size, TRUE); @@ -5470,8 +5644,8 @@ nfa_regmatch(prog, start, submatch, m) { if (REG_MULTI) { - m->norm.list.multi[0].start.lnum = reglnum; - m->norm.list.multi[0].start.col = (colnr_T)(reginput - regline); + m->norm.list.multi[0].start_lnum = reglnum; + m->norm.list.multi[0].start_col = (colnr_T)(reginput - regline); } else m->norm.list.line[0].start = reginput; @@ -5519,6 +5693,13 @@ nfa_regmatch(prog, start, submatch, m) nextlist->n = 0; /* clear nextlist */ nextlist->has_pim = FALSE; ++nfa_listid; + if (prog->re_engine == AUTOMATIC_ENGINE && nfa_listid >= NFA_MAX_STATES) + { + /* too many states, retry with old engine */ + nfa_match = NFA_TOO_EXPENSIVE; + goto theend; + } + thislist->id = nfa_listid; nextlist->id = nfa_listid + 1; @@ -5548,6 +5729,19 @@ nfa_regmatch(prog, start, submatch, m) /* compute nextlist */ for (listidx = 0; listidx < thislist->n; ++listidx) { + /* If the list gets very long there probably is something wrong. + * At least allow interrupting with CTRL-C. */ + fast_breakcheck(); + if (got_int) + break; +#ifdef FEAT_RELTIME + if (nfa_time_limit != NULL && ++nfa_time_count == 20) + { + nfa_time_count = 0; + if (nfa_did_time_out()) + break; + } +#endif t = &thislist->t[listidx]; #ifdef NFA_REGEXP_DEBUG_LOG @@ -5561,7 +5755,7 @@ nfa_regmatch(prog, start, submatch, m) if (t->subs.norm.in_use <= 0) col = -1; else if (REG_MULTI) - col = t->subs.norm.list.multi[0].start.col; + col = t->subs.norm.list.multi[0].start_col; else col = (int)(t->subs.norm.list.line[0].start - regline); nfa_set_code(t->state->c); @@ -5584,8 +5778,8 @@ nfa_regmatch(prog, start, submatch, m) { #ifdef FEAT_MBYTE /* If the match ends before a composing characters and - * ireg_icombine is not set, that is not really a match. */ - if (enc_utf8 && !ireg_icombine && utf_iscomposing(curc)) + * rex.reg_icombine is not set, that is not really a match. */ + if (enc_utf8 && !rex.reg_icombine && utf_iscomposing(curc)) break; #endif nfa_match = TRUE; @@ -5701,6 +5895,11 @@ nfa_regmatch(prog, start, submatch, m) */ result = recursive_regmatch(t->state, NULL, prog, submatch, m, &listids); + if (result == NFA_TOO_EXPENSIVE) + { + nfa_match = result; + goto theend; + } /* for \@! and \@<! it is a match when the result is * FALSE */ @@ -5814,6 +6013,11 @@ nfa_regmatch(prog, start, submatch, m) /* First try matching the pattern. */ result = recursive_regmatch(t->state, NULL, prog, submatch, m, &listids); + if (result == NFA_TOO_EXPENSIVE) + { + nfa_match = result; + goto theend; + } if (result) { int bytelen; @@ -5832,7 +6036,7 @@ nfa_regmatch(prog, start, submatch, m) * continue with what follows. */ if (REG_MULTI) /* TODO: multi-line match */ - bytelen = m->norm.list.multi[0].end.col + bytelen = m->norm.list.multi[0].end_col - (int)(reginput - regline); else bytelen = (int)(m->norm.list.line[0].end - reginput); @@ -5894,16 +6098,16 @@ nfa_regmatch(prog, start, submatch, m) int this_class; /* Get class of current and previous char (if it exists). */ - this_class = mb_get_class_buf(reginput, reg_buf); + this_class = mb_get_class_buf(reginput, rex.reg_buf); if (this_class <= 1) result = FALSE; else if (reg_prev_class() == this_class) result = FALSE; } #endif - else if (!vim_iswordc_buf(curc, reg_buf) + else if (!vim_iswordc_buf(curc, rex.reg_buf) || (reginput > regline - && vim_iswordc_buf(reginput[-1], reg_buf))) + && vim_iswordc_buf(reginput[-1], rex.reg_buf))) result = FALSE; if (result) { @@ -5922,16 +6126,16 @@ nfa_regmatch(prog, start, submatch, m) int this_class, prev_class; /* Get class of current and previous char (if it exists). */ - this_class = mb_get_class_buf(reginput, reg_buf); + this_class = mb_get_class_buf(reginput, rex.reg_buf); prev_class = reg_prev_class(); if (this_class == prev_class || prev_class == 0 || prev_class == 1) result = FALSE; } #endif - else if (!vim_iswordc_buf(reginput[-1], reg_buf) + else if (!vim_iswordc_buf(reginput[-1], rex.reg_buf) || (reginput[0] != NUL - && vim_iswordc_buf(curc, reg_buf))) + && vim_iswordc_buf(curc, rex.reg_buf))) result = FALSE; if (result) { @@ -5942,7 +6146,7 @@ nfa_regmatch(prog, start, submatch, m) case NFA_BOF: if (reglnum == 0 && reginput == regline - && (!REG_MULTI || reg_firstlnum == 1)) + && (!REG_MULTI || rex.reg_firstlnum == 1)) { add_here = TRUE; add_state = t->state->out; @@ -5950,7 +6154,7 @@ nfa_regmatch(prog, start, submatch, m) break; case NFA_EOF: - if (reglnum == reg_maxline && curc == NUL) + if (reglnum == rex.reg_maxline && curc == NUL) { add_here = TRUE; add_state = t->state->out; @@ -5977,11 +6181,11 @@ nfa_regmatch(prog, start, submatch, m) * (no preceding character). */ len += mb_char2len(mc); } - if (ireg_icombine && len == 0) + if (rex.reg_icombine && len == 0) { /* If \Z was present, then ignore composing characters. * When ignoring the base character this always matches. */ - if (len == 0 && sta->c != curc) + if (sta->c != curc) result = FAIL; else result = OK; @@ -6036,8 +6240,8 @@ nfa_regmatch(prog, start, submatch, m) #endif case NFA_NEWL: - if (curc == NUL && !reg_line_lbr && REG_MULTI - && reglnum <= reg_maxline) + if (curc == NUL && !rex.reg_line_lbr && REG_MULTI + && reglnum <= rex.reg_maxline) { go_to_nextline = TRUE; /* Pass -1 for the offset, which means taking the position @@ -6045,7 +6249,7 @@ nfa_regmatch(prog, start, submatch, m) add_state = t->state->out; add_off = -1; } - else if (curc == '\n' && reg_line_lbr) + else if (curc == '\n' && rex.reg_line_lbr) { /* match \n as if it is an ordinary character */ add_state = t->state->out; @@ -6090,7 +6294,7 @@ nfa_regmatch(prog, start, submatch, m) result = result_if_matched; break; } - if (ireg_ic) + if (rex.reg_ic) { int curc_low = MB_TOLOWER(curc); int done = FALSE; @@ -6107,8 +6311,8 @@ nfa_regmatch(prog, start, submatch, m) } } else if (state->c < 0 ? check_char_class(state->c, curc) - : (curc == state->c - || (ireg_ic && MB_TOLOWER(curc) + : (curc == state->c + || (rex.reg_ic && MB_TOLOWER(curc) == MB_TOLOWER(state->c)))) { result = result_if_matched; @@ -6166,13 +6370,13 @@ nfa_regmatch(prog, start, submatch, m) break; case NFA_KWORD: /* \k */ - result = vim_iswordp_buf(reginput, reg_buf); + result = vim_iswordp_buf(reginput, rex.reg_buf); ADD_STATE_IF_MATCH(t->state); break; case NFA_SKWORD: /* \K */ result = !VIM_ISDIGIT(curc) - && vim_iswordp_buf(reginput, reg_buf); + && vim_iswordp_buf(reginput, rex.reg_buf); ADD_STATE_IF_MATCH(t->state); break; @@ -6197,12 +6401,12 @@ nfa_regmatch(prog, start, submatch, m) break; case NFA_WHITE: /* \s */ - result = vim_iswhite(curc); + result = VIM_ISWHITE(curc); ADD_STATE_IF_MATCH(t->state); break; case NFA_NWHITE: /* \S */ - result = curc != NUL && !vim_iswhite(curc); + result = curc != NUL && !VIM_ISWHITE(curc); ADD_STATE_IF_MATCH(t->state); break; @@ -6287,24 +6491,24 @@ nfa_regmatch(prog, start, submatch, m) break; case NFA_LOWER_IC: /* [a-z] */ - result = ri_lower(curc) || (ireg_ic && ri_upper(curc)); + result = ri_lower(curc) || (rex.reg_ic && ri_upper(curc)); ADD_STATE_IF_MATCH(t->state); break; case NFA_NLOWER_IC: /* [^a-z] */ result = curc != NUL - && !(ri_lower(curc) || (ireg_ic && ri_upper(curc))); + && !(ri_lower(curc) || (rex.reg_ic && ri_upper(curc))); ADD_STATE_IF_MATCH(t->state); break; case NFA_UPPER_IC: /* [A-Z] */ - result = ri_upper(curc) || (ireg_ic && ri_lower(curc)); + result = ri_upper(curc) || (rex.reg_ic && ri_lower(curc)); ADD_STATE_IF_MATCH(t->state); break; case NFA_NUPPER_IC: /* ^[A-Z] */ result = curc != NUL - && !(ri_upper(curc) || (ireg_ic && ri_lower(curc))); + && !(ri_upper(curc) || (rex.reg_ic && ri_lower(curc))); ADD_STATE_IF_MATCH(t->state); break; @@ -6395,7 +6599,7 @@ nfa_regmatch(prog, start, submatch, m) case NFA_LNUM_LT: result = (REG_MULTI && nfa_re_num_cmp(t->state->val, t->state->c - NFA_LNUM, - (long_u)(reglnum + reg_firstlnum))); + (long_u)(reglnum + rex.reg_firstlnum))); if (result) { add_here = TRUE; @@ -6418,14 +6622,38 @@ nfa_regmatch(prog, start, submatch, m) case NFA_VCOL: case NFA_VCOL_GT: case NFA_VCOL_LT: - result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_VCOL, - (long_u)win_linetabsize( - reg_win == NULL ? curwin : reg_win, - regline, (colnr_T)(reginput - regline)) + 1); - if (result) { - add_here = TRUE; - add_state = t->state->out; + int op = t->state->c - NFA_VCOL; + colnr_T col = (colnr_T)(reginput - regline); + win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win; + + /* Bail out quickly when there can't be a match, avoid the + * overhead of win_linetabsize() on long lines. */ + if (op != 1 && col > t->state->val +#ifdef FEAT_MBYTE + * (has_mbyte ? MB_MAXBYTES : 1) +#endif + ) + break; + result = FALSE; + if (op == 1 && col - 1 > t->state->val && col > 100) + { + int ts = wp->w_buffer->b_p_ts; + + /* Guess that a character won't use more columns than + * 'tabstop', with a minimum of 4. */ + if (ts < 4) + ts = 4; + result = col > t->state->val * ts; + } + if (!result) + result = nfa_re_num_cmp(t->state->val, op, + (long_u)win_linetabsize(wp, regline, col) + 1); + if (result) + { + add_here = TRUE; + add_state = t->state->out; + } } break; @@ -6433,18 +6661,18 @@ nfa_regmatch(prog, start, submatch, m) case NFA_MARK_GT: case NFA_MARK_LT: { - pos_T *pos = getmark_buf(reg_buf, t->state->val, FALSE); + pos_T *pos = getmark_buf(rex.reg_buf, t->state->val, FALSE); /* Compare the mark position to the match position. */ result = (pos != NULL /* mark doesn't exist */ && pos->lnum > 0 /* mark isn't set in reg_buf */ - && (pos->lnum == reglnum + reg_firstlnum + && (pos->lnum == reglnum + rex.reg_firstlnum ? (pos->col == (colnr_T)(reginput - regline) ? t->state->c == NFA_MARK : (pos->col < (colnr_T)(reginput - regline) ? t->state->c == NFA_MARK_GT : t->state->c == NFA_MARK_LT)) - : (pos->lnum < reglnum + reg_firstlnum + : (pos->lnum < reglnum + rex.reg_firstlnum ? t->state->c == NFA_MARK_GT : t->state->c == NFA_MARK_LT))); if (result) @@ -6456,10 +6684,11 @@ nfa_regmatch(prog, start, submatch, m) } case NFA_CURSOR: - result = (reg_win != NULL - && (reglnum + reg_firstlnum == reg_win->w_cursor.lnum) + result = (rex.reg_win != NULL + && (reglnum + rex.reg_firstlnum + == rex.reg_win->w_cursor.lnum) && ((colnr_T)(reginput - regline) - == reg_win->w_cursor.col)); + == rex.reg_win->w_cursor.col)); if (result) { add_here = TRUE; @@ -6509,17 +6738,17 @@ nfa_regmatch(prog, start, submatch, m) #ifdef DEBUG if (c < 0) - EMSGN("INTERNAL: Negative state char: %ld", c); + IEMSGN("INTERNAL: Negative state char: %ld", c); #endif result = (c == curc); - if (!result && ireg_ic) + if (!result && rex.reg_ic) result = MB_TOLOWER(c) == MB_TOLOWER(curc); #ifdef FEAT_MBYTE - /* If ireg_icombine is not set only skip over the character + /* If rex.reg_icombine is not set only skip over the character * itself. When it is set skip over composing characters. */ - if (result && enc_utf8 && !ireg_icombine) - clen = utf_char2len(curc); + if (result && enc_utf8 && !rex.reg_icombine) + clen = utf_ptr2len(reginput); #endif ADD_STATE_IF_MATCH(t->state); break; @@ -6637,13 +6866,13 @@ nfa_regmatch(prog, start, submatch, m) && ((toplevel && reglnum == 0 && clen != 0 - && (ireg_maxcol == 0 - || (colnr_T)(reginput - regline) < ireg_maxcol)) + && (rex.reg_maxcol == 0 + || (colnr_T)(reginput - regline) < rex.reg_maxcol)) || (nfa_endp != NULL && (REG_MULTI ? (reglnum < nfa_endp->se_u.pos.lnum || (reglnum == nfa_endp->se_u.pos.lnum - && (int)(reginput - regline) + && (int)(reginput - regline) < nfa_endp->se_u.pos.col)) : reginput < nfa_endp->se_u.ptr)))) { @@ -6678,8 +6907,8 @@ nfa_regmatch(prog, start, submatch, m) /* Checking if the required start character matches is * cheaper than adding a state that won't match. */ c = PTR2CHAR(reginput + clen); - if (c != prog->regstart && (!ireg_ic || MB_TOLOWER(c) - != MB_TOLOWER(prog->regstart))) + if (c != prog->regstart && (!rex.reg_ic + || MB_TOLOWER(c) != MB_TOLOWER(prog->regstart))) { #ifdef ENABLE_LOG fprintf(log_fd, " Skipping start state, regstart does not match\n"); @@ -6692,7 +6921,7 @@ nfa_regmatch(prog, start, submatch, m) if (add) { if (REG_MULTI) - m->norm.list.multi[0].start.col = + m->norm.list.multi[0].start_col = (colnr_T)(reginput - regline) + clen; else m->norm.list.line[0].start = reginput + clen; @@ -6724,6 +6953,20 @@ nfa_regmatch(prog, start, submatch, m) reg_nextline(); else break; + + /* Allow interrupting with CTRL-C. */ + line_breakcheck(); + if (got_int) + break; +#ifdef FEAT_RELTIME + /* Check for timeout once in a twenty times to avoid overhead. */ + if (nfa_time_limit != NULL && ++nfa_time_count == 20) + { + nfa_time_count = 0; + if (nfa_did_time_out()) + break; + } +#endif } #ifdef ENABLE_LOG @@ -6747,21 +6990,29 @@ nfa_regmatch(prog, start, submatch, m) /* * Try match of "prog" with at regline["col"]. - * Returns 0 for failure, number of lines contained in the match otherwise. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static long -nfa_regtry(prog, col) - nfa_regprog_T *prog; - colnr_T col; +nfa_regtry( + nfa_regprog_T *prog, + colnr_T col, + proftime_T *tm UNUSED, /* timeout limit or NULL */ + int *timed_out UNUSED) /* flag set on timeout or NULL */ { int i; regsubs_T subs, m; nfa_state_T *start = prog->start; + int result; #ifdef ENABLE_LOG FILE *f; #endif reginput = regline + col; +#ifdef FEAT_RELTIME + nfa_time_limit = tm; + nfa_timed_out = timed_out; + nfa_time_count = 0; +#endif #ifdef ENABLE_LOG f = fopen(NFA_REGEXP_RUN_LOG, "a"); @@ -6788,45 +7039,51 @@ nfa_regtry(prog, col) clear_sub(&m.synt); #endif - if (nfa_regmatch(prog, start, &subs, &m) == FALSE) + result = nfa_regmatch(prog, start, &subs, &m); + if (result == FALSE) return 0; + else if (result == NFA_TOO_EXPENSIVE) + return result; cleanup_subexpr(); if (REG_MULTI) { for (i = 0; i < subs.norm.in_use; i++) { - reg_startpos[i] = subs.norm.list.multi[i].start; - reg_endpos[i] = subs.norm.list.multi[i].end; + rex.reg_startpos[i].lnum = subs.norm.list.multi[i].start_lnum; + rex.reg_startpos[i].col = subs.norm.list.multi[i].start_col; + + rex.reg_endpos[i].lnum = subs.norm.list.multi[i].end_lnum; + rex.reg_endpos[i].col = subs.norm.list.multi[i].end_col; } - if (reg_startpos[0].lnum < 0) + if (rex.reg_startpos[0].lnum < 0) { - reg_startpos[0].lnum = 0; - reg_startpos[0].col = col; + rex.reg_startpos[0].lnum = 0; + rex.reg_startpos[0].col = col; } - if (reg_endpos[0].lnum < 0) + if (rex.reg_endpos[0].lnum < 0) { /* pattern has a \ze but it didn't match, use current end */ - reg_endpos[0].lnum = reglnum; - reg_endpos[0].col = (int)(reginput - regline); + rex.reg_endpos[0].lnum = reglnum; + rex.reg_endpos[0].col = (int)(reginput - regline); } else /* Use line number of "\ze". */ - reglnum = reg_endpos[0].lnum; + reglnum = rex.reg_endpos[0].lnum; } else { for (i = 0; i < subs.norm.in_use; i++) { - reg_startp[i] = subs.norm.list.line[i].start; - reg_endp[i] = subs.norm.list.line[i].end; + rex.reg_startp[i] = subs.norm.list.line[i].start; + rex.reg_endp[i] = subs.norm.list.line[i].end; } - if (reg_startp[0] == NULL) - reg_startp[0] = regline + col; - if (reg_endp[0] == NULL) - reg_endp[0] = reginput; + if (rex.reg_startp[0] == NULL) + rex.reg_startp[0] = regline + col; + if (rex.reg_endp[0] == NULL) + rex.reg_endp[0] = reginput; } #ifdef FEAT_SYN_HL @@ -6838,20 +7095,21 @@ nfa_regtry(prog, col) { cleanup_zsubexpr(); re_extmatch_out = make_extmatch(); - for (i = 0; i < subs.synt.in_use; i++) + /* Loop over \z1, \z2, etc. There is no \z0. */ + for (i = 1; i < subs.synt.in_use; i++) { if (REG_MULTI) { struct multipos *mpos = &subs.synt.list.multi[i]; /* Only accept single line matches that are valid. */ - if (mpos->start.lnum >= 0 - && mpos->start.lnum == mpos->end.lnum - && mpos->end.col >= mpos->start.col) + if (mpos->start_lnum >= 0 + && mpos->start_lnum == mpos->end_lnum + && mpos->end_col >= mpos->start_col) re_extmatch_out->matches[i] = - vim_strnsave(reg_getline(mpos->start.lnum) - + mpos->start.col, - mpos->end.col - mpos->start.col); + vim_strnsave(reg_getline(mpos->start_lnum) + + mpos->start_col, + mpos->end_col - mpos->start_col); } else { @@ -6873,12 +7131,14 @@ nfa_regtry(prog, col) * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). * - * Returns 0 for failure, number of lines contained in the match otherwise. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static long -nfa_regexec_both(line, startcol) - char_u *line; - colnr_T startcol; /* column to start looking for match */ +nfa_regexec_both( + char_u *line, + colnr_T startcol, /* column to start looking for match */ + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { nfa_regprog_T *prog; long retval = 0L; @@ -6887,16 +7147,16 @@ nfa_regexec_both(line, startcol) if (REG_MULTI) { - prog = (nfa_regprog_T *)reg_mmatch->regprog; + prog = (nfa_regprog_T *)rex.reg_mmatch->regprog; line = reg_getline((linenr_T)0); /* relative to the cursor */ - reg_startpos = reg_mmatch->startpos; - reg_endpos = reg_mmatch->endpos; + rex.reg_startpos = rex.reg_mmatch->startpos; + rex.reg_endpos = rex.reg_mmatch->endpos; } else { - prog = (nfa_regprog_T *)reg_match->regprog; - reg_startp = reg_match->startp; - reg_endp = reg_match->endp; + prog = (nfa_regprog_T *)rex.reg_match->regprog; + rex.reg_startp = rex.reg_match->startp; + rex.reg_endp = rex.reg_match->endp; } /* Be paranoid... */ @@ -6906,16 +7166,16 @@ nfa_regexec_both(line, startcol) goto theend; } - /* If pattern contains "\c" or "\C": overrule value of ireg_ic */ + /* If pattern contains "\c" or "\C": overrule value of rex.reg_ic */ if (prog->regflags & RF_ICASE) - ireg_ic = TRUE; + rex.reg_ic = TRUE; else if (prog->regflags & RF_NOICASE) - ireg_ic = FALSE; + rex.reg_ic = FALSE; #ifdef FEAT_MBYTE - /* If pattern contains "\Z" overrule value of ireg_icombine */ + /* If pattern contains "\Z" overrule value of rex.reg_icombine */ if (prog->regflags & RF_ICOMBINE) - ireg_icombine = TRUE; + rex.reg_icombine = TRUE; #endif regline = line; @@ -6926,9 +7186,7 @@ nfa_regexec_both(line, startcol) nfa_nsubexpr = prog->nsubexp; nfa_listid = 1; nfa_alt_listid = 2; -#ifdef DEBUG nfa_regengine.expr = prog->pattern; -#endif if (prog->reganch && col > 0) return 0L; @@ -6956,14 +7214,14 @@ nfa_regexec_both(line, startcol) * Nothing else to try. Doesn't handle combining chars well. */ if (prog->match_text != NULL #ifdef FEAT_MBYTE - && !ireg_icombine + && !rex.reg_icombine #endif ) return find_match_text(col, prog->regstart, prog->match_text); } /* If the start column is past the maximum column: no need to try. */ - if (ireg_maxcol > 0 && col >= ireg_maxcol) + if (rex.reg_maxcol > 0 && col >= rex.reg_maxcol) goto theend; nstate = prog->nstate; @@ -6974,11 +7232,9 @@ nfa_regexec_both(line, startcol) prog->state[i].lastlist[1] = 0; } - retval = nfa_regtry(prog, col); + retval = nfa_regtry(prog, col, tm, timed_out); -#ifdef DEBUG nfa_regengine.expr = NULL; -#endif theend: return retval; @@ -6989,9 +7245,7 @@ nfa_regexec_both(line, startcol) * Returns the program in allocated space. Returns NULL for an error. */ static regprog_T * -nfa_regcomp(expr, re_flags) - char_u *expr; - int re_flags; +nfa_regcomp(char_u *expr, int re_flags) { nfa_regprog_T *prog = NULL; size_t prog_size; @@ -7000,9 +7254,8 @@ nfa_regcomp(expr, re_flags) if (expr == NULL) return NULL; -#ifdef DEBUG nfa_regengine.expr = expr; -#endif + nfa_re_flags = re_flags; init_class_tab(); @@ -7016,7 +7269,7 @@ nfa_regcomp(expr, re_flags) { /* TODO: only give this error for debugging? */ if (post_ptr >= post_end) - EMSGN("Internal error: estimated max number of states insufficient: %ld", post_end - post_start); + IEMSGN("Internal error: estimated max number of states insufficient: %ld", post_end - post_start); goto fail; /* Cascaded (syntax?) error */ } @@ -7079,26 +7332,21 @@ nfa_regcomp(expr, re_flags) /* Remember whether this pattern has any \z specials in it. */ prog->reghasz = re_has_z; #endif -#ifdef DEBUG prog->pattern = vim_strsave(expr); nfa_regengine.expr = NULL; -#endif out: - vim_free(post_start); - post_start = post_ptr = post_end = NULL; + VIM_CLEAR(post_start); + post_ptr = post_end = NULL; state_ptr = NULL; return (regprog_T *)prog; fail: - vim_free(prog); - prog = NULL; + VIM_CLEAR(prog); #ifdef ENABLE_LOG nfa_postfix_dump(expr, FAIL); #endif -#ifdef DEBUG nfa_regengine.expr = NULL; -#endif goto out; } @@ -7106,15 +7354,12 @@ nfa_regcomp(expr, re_flags) * Free a compiled regexp program, returned by nfa_regcomp(). */ static void -nfa_regfree(prog) - regprog_T *prog; +nfa_regfree(regprog_T *prog) { if (prog != NULL) { vim_free(((nfa_regprog_T *)prog)->match_text); -#ifdef DEBUG vim_free(((nfa_regprog_T *)prog)->pattern); -#endif vim_free(prog); } } @@ -7125,27 +7370,27 @@ nfa_regfree(prog) * Uses curbuf for line count and 'iskeyword'. * If "line_lbr" is TRUE consider a "\n" in "line" to be a line break. * - * Return TRUE if there is a match, FALSE if not. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static int -nfa_regexec_nl(rmp, line, col, line_lbr) - regmatch_T *rmp; - char_u *line; /* string to match against */ - colnr_T col; /* column to start looking for match */ - int line_lbr; +nfa_regexec_nl( + regmatch_T *rmp, + char_u *line, /* string to match against */ + colnr_T col, /* column to start looking for match */ + int line_lbr) { - reg_match = rmp; - reg_mmatch = NULL; - reg_maxline = 0; - reg_line_lbr = line_lbr; - reg_buf = curbuf; - reg_win = NULL; - ireg_ic = rmp->rm_ic; + rex.reg_match = rmp; + rex.reg_mmatch = NULL; + rex.reg_maxline = 0; + rex.reg_line_lbr = line_lbr; + rex.reg_buf = curbuf; + rex.reg_win = NULL; + rex.reg_ic = rmp->rm_ic; #ifdef FEAT_MBYTE - ireg_icombine = FALSE; + rex.reg_icombine = FALSE; #endif - ireg_maxcol = 0; - return (nfa_regexec_both(line, col) != 0); + rex.reg_maxcol = 0; + return nfa_regexec_both(line, col, NULL, NULL); } @@ -7154,7 +7399,7 @@ nfa_regexec_nl(rmp, line, col, line_lbr) * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). * Uses curbuf for line count and 'iskeyword'. * - * Return zero if there is no match. Return number of lines contained in the + * Return <= 0 if there is no match. Return number of lines contained in the * match otherwise. * * Note: the body is the same as bt_regexec() except for nfa_regexec_both() @@ -7175,28 +7420,29 @@ nfa_regexec_nl(rmp, line, col, line_lbr) * FIXME if this behavior is not compatible. */ static long -nfa_regexec_multi(rmp, win, buf, lnum, col, tm) - regmmatch_T *rmp; - win_T *win; /* window in which to search or NULL */ - buf_T *buf; /* buffer in which to search */ - linenr_T lnum; /* nr of line to start looking for match */ - colnr_T col; /* column to start looking for match */ - proftime_T *tm UNUSED; /* timeout limit or NULL */ +nfa_regexec_multi( + regmmatch_T *rmp, + win_T *win, /* window in which to search or NULL */ + buf_T *buf, /* buffer in which to search */ + linenr_T lnum, /* nr of line to start looking for match */ + colnr_T col, /* column to start looking for match */ + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { - reg_match = NULL; - reg_mmatch = rmp; - reg_buf = buf; - reg_win = win; - reg_firstlnum = lnum; - reg_maxline = reg_buf->b_ml.ml_line_count - lnum; - reg_line_lbr = FALSE; - ireg_ic = rmp->rmm_ic; + rex.reg_match = NULL; + rex.reg_mmatch = rmp; + rex.reg_buf = buf; + rex.reg_win = win; + rex.reg_firstlnum = lnum; + rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum; + rex.reg_line_lbr = FALSE; + rex.reg_ic = rmp->rmm_ic; #ifdef FEAT_MBYTE - ireg_icombine = FALSE; + rex.reg_icombine = FALSE; #endif - ireg_maxcol = rmp->rmm_maxcol; + rex.reg_maxcol = rmp->rmm_maxcol; - return nfa_regexec_both(NULL, col); + return nfa_regexec_both(NULL, col, tm, timed_out); } #ifdef DEBUG diff --git a/src/screen.c b/src/screen.c index bb89f50b4a..8da82ec2e9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -107,80 +107,85 @@ static int screen_cur_row, screen_cur_col; /* last known cursor position */ static match_T search_hl; /* used for 'hlsearch' highlight matching */ #endif +#if defined(FEAT_MENU) || defined(FEAT_FOLDING) +static int text_to_screenline(win_T *wp, char_u *text, int col); +#endif #ifdef FEAT_FOLDING static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */ +static int compute_foldcolumn(win_T *wp, int col); #endif +/* Flag that is set when drawing for a callback, not from the main command + * loop. */ +static int redrawing_for_callback = 0; + /* * Buffer for one screen line (characters and attributes). */ static schar_T *current_ScreenLine; -static void win_update __ARGS((win_T *wp)); -static void win_draw_end __ARGS((win_T *wp, int c1, int c2, int row, int endrow, hlf_T hl)); +static void win_update(win_T *wp); +static void win_redr_status(win_T *wp, int ignore_pum); +static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T hl); #ifdef FEAT_FOLDING -static void fold_line __ARGS((win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row)); -static void fill_foldcolumn __ARGS((char_u *p, win_T *wp, int closed, linenr_T lnum)); -static void copy_text_attr __ARGS((int off, char_u *buf, int len, int attr)); -#endif -static int win_line __ARGS((win_T *, linenr_T, int, int, int nochange)); -static int char_needs_redraw __ARGS((int off_from, int off_to, int cols)); -#ifdef FEAT_RIGHTLEFT -static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width, int rlflag)); -# define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c), (rl)) -#else -static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width)); -# define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c)) -#endif -#ifdef FEAT_VERTSPLIT -static void draw_vsep_win __ARGS((win_T *wp, int row)); +static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row); +static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); +static void copy_text_attr(int off, char_u *buf, int len, int attr); #endif +static int win_line(win_T *, linenr_T, int, int, int nochange); +static int char_needs_redraw(int off_from, int off_to, int cols); +static void draw_vsep_win(win_T *wp, int row); #ifdef FEAT_STL_OPT -static void redraw_custom_statusline __ARGS((win_T *wp)); +static void redraw_custom_statusline(win_T *wp); #endif #ifdef FEAT_SEARCH_EXTRA # define SEARCH_HL_PRIORITY 0 -static void start_search_hl __ARGS((void)); -static void end_search_hl __ARGS((void)); -static void init_search_hl __ARGS((win_T *wp)); -static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum)); -static void next_search_hl __ARGS((win_T *win, match_T *shl, linenr_T lnum, colnr_T mincol, matchitem_T *cur)); -static int next_search_hl_pos __ARGS((match_T *shl, linenr_T lnum, posmatch_T *pos, colnr_T mincol)); -#endif -static void screen_start_highlight __ARGS((int attr)); -static void screen_char __ARGS((unsigned off, int row, int col)); +static void start_search_hl(void); +static void end_search_hl(void); +static void init_search_hl(win_T *wp); +static void prepare_search_hl(win_T *wp, linenr_T lnum); +static void next_search_hl(win_T *win, match_T *shl, linenr_T lnum, colnr_T mincol, matchitem_T *cur); +static int next_search_hl_pos(match_T *shl, linenr_T lnum, posmatch_T *pos, colnr_T mincol); +#endif +static void screen_start_highlight(int attr); +static void screen_char(unsigned off, int row, int col); #ifdef FEAT_MBYTE -static void screen_char_2 __ARGS((unsigned off, int row, int col)); -#endif -static void screenclear2 __ARGS((void)); -static void lineclear __ARGS((unsigned off, int width)); -static void lineinvalid __ARGS((unsigned off, int width)); -#ifdef FEAT_VERTSPLIT -static void linecopy __ARGS((int to, int from, win_T *wp)); -static void redraw_block __ARGS((int row, int end, win_T *wp)); -#endif -static int win_do_lines __ARGS((win_T *wp, int row, int line_count, int mayclear, int del)); -static void win_rest_invalid __ARGS((win_T *wp)); -static void msg_pos_mode __ARGS((void)); -#if defined(FEAT_WINDOWS) -static void draw_tabline __ARGS((void)); -#endif -#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) -static int fillchar_status __ARGS((int *attr, int is_curwin)); -#endif -#ifdef FEAT_VERTSPLIT -static int fillchar_vsep __ARGS((int *attr)); +static void screen_char_2(unsigned off, int row, int col); +#endif +static void screenclear2(void); +static void lineclear(unsigned off, int width, int attr); +static void lineinvalid(unsigned off, int width); +static void linecopy(int to, int from, win_T *wp); +static void redraw_block(int row, int end, win_T *wp); +static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr); +static void win_rest_invalid(win_T *wp); +static void msg_pos_mode(void); +static void recording_mode(int attr); +static void draw_tabline(void); +static int fillchar_status(int *attr, win_T *wp); +static int fillchar_vsep(int *attr); +#ifdef FEAT_MENU +static void redraw_win_toolbar(win_T *wp); #endif #ifdef FEAT_STL_OPT -static void win_redr_custom __ARGS((win_T *wp, int draw_ruler)); +static void win_redr_custom(win_T *wp, int draw_ruler); #endif #ifdef FEAT_CMDL_INFO -static void win_redr_ruler __ARGS((win_T *wp, int always)); +static void win_redr_ruler(win_T *wp, int always, int ignore_pum); #endif -#if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT) /* Ugly global: overrule attribute used by screen_char() */ static int screen_char_attr = 0; + +#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) +/* Can limit syntax highlight time to 'redrawtime'. */ +# define SYN_TIME_LIMIT 1 +#endif + +#ifdef FEAT_RIGHTLEFT +# define HAS_RIGHTLEFT(x) x +#else +# define HAS_RIGHTLEFT(x) FALSE #endif /* @@ -189,18 +194,17 @@ static int screen_char_attr = 0; * e.g. if must_redraw is CLEAR, type NOT_VALID will do nothing. */ void -redraw_later(type) - int type; +redraw_later(int type) { redraw_win_later(curwin, type); } void -redraw_win_later(wp, type) - win_T *wp; - int type; +redraw_win_later( + win_T *wp, + int type) { - if (wp->w_redr_type < type) + if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= NOT_VALID) @@ -215,7 +219,7 @@ redraw_win_later(wp, type) * after executing a shell command that messes up the screen. */ void -redraw_later_clear() +redraw_later_clear(void) { redraw_all_later(CLEAR); #ifdef FEAT_GUI @@ -226,15 +230,14 @@ redraw_later_clear() else #endif /* Use attributes that is very unlikely to appear in text. */ - screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE; + screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE | HL_STRIKETHROUGH; } /* * Mark all windows to be redrawn later. */ void -redraw_all_later(type) - int type; +redraw_all_later(int type) { win_T *wp; @@ -248,23 +251,41 @@ redraw_all_later(type) * Mark all windows that are editing the current buffer to be updated later. */ void -redraw_curbuf_later(type) - int type; +redraw_curbuf_later(int type) { redraw_buf_later(curbuf, type); } void -redraw_buf_later(buf, type) - buf_T *buf; - int type; +redraw_buf_later(buf_T *buf, int type) +{ + win_T *wp; + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == buf) + redraw_win_later(wp, type); + } +} + + void +redraw_buf_and_status_later(buf_T *buf, int type) { win_T *wp; +#ifdef FEAT_WILDMENU + if (wild_menu_showing != 0) + /* Don't redraw while the command line completion is displayed, it + * would disappear. */ + return; +#endif FOR_ALL_WINDOWS(wp) { if (wp->w_buffer == buf) + { redraw_win_later(wp, type); + wp->w_redr_status = TRUE; + } } } @@ -274,10 +295,10 @@ redraw_buf_later(buf, type) * Return a code indicating what happened. */ int -redraw_asap(type) - int type; +redraw_asap(int type) { int rows; + int cols = screen_Columns; int r; int ret = 0; schar_T *screenline; /* copy from ScreenLines[] */ @@ -290,28 +311,28 @@ redraw_asap(type) #endif redraw_later(type); - if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY)) + if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY) || exiting) return ret; /* Allocate space to save the text displayed in the command line area. */ - rows = Rows - cmdline_row; + rows = screen_Rows - cmdline_row; screenline = (schar_T *)lalloc( - (long_u)(rows * Columns * sizeof(schar_T)), FALSE); + (long_u)(rows * cols * sizeof(schar_T)), FALSE); screenattr = (sattr_T *)lalloc( - (long_u)(rows * Columns * sizeof(sattr_T)), FALSE); + (long_u)(rows * cols * sizeof(sattr_T)), FALSE); if (screenline == NULL || screenattr == NULL) ret = 2; #ifdef FEAT_MBYTE if (enc_utf8) { screenlineUC = (u8char_T *)lalloc( - (long_u)(rows * Columns * sizeof(u8char_T)), FALSE); + (long_u)(rows * cols * sizeof(u8char_T)), FALSE); if (screenlineUC == NULL) ret = 2; for (i = 0; i < p_mco; ++i) { screenlineC[i] = (u8char_T *)lalloc( - (long_u)(rows * Columns * sizeof(u8char_T)), FALSE); + (long_u)(rows * cols * sizeof(u8char_T)), FALSE); if (screenlineC[i] == NULL) ret = 2; } @@ -319,7 +340,7 @@ redraw_asap(type) if (enc_dbcs == DBCS_JPNU) { screenline2 = (schar_T *)lalloc( - (long_u)(rows * Columns * sizeof(schar_T)), FALSE); + (long_u)(rows * cols * sizeof(schar_T)), FALSE); if (screenline2 == NULL) ret = 2; } @@ -330,27 +351,27 @@ redraw_asap(type) /* Save the text displayed in the command line area. */ for (r = 0; r < rows; ++r) { - mch_memmove(screenline + r * Columns, + mch_memmove(screenline + r * cols, ScreenLines + LineOffset[cmdline_row + r], - (size_t)Columns * sizeof(schar_T)); - mch_memmove(screenattr + r * Columns, + (size_t)cols * sizeof(schar_T)); + mch_memmove(screenattr + r * cols, ScreenAttrs + LineOffset[cmdline_row + r], - (size_t)Columns * sizeof(sattr_T)); + (size_t)cols * sizeof(sattr_T)); #ifdef FEAT_MBYTE if (enc_utf8) { - mch_memmove(screenlineUC + r * Columns, + mch_memmove(screenlineUC + r * cols, ScreenLinesUC + LineOffset[cmdline_row + r], - (size_t)Columns * sizeof(u8char_T)); + (size_t)cols * sizeof(u8char_T)); for (i = 0; i < p_mco; ++i) - mch_memmove(screenlineC[i] + r * Columns, - ScreenLinesC[r] + LineOffset[cmdline_row + r], - (size_t)Columns * sizeof(u8char_T)); + mch_memmove(screenlineC[i] + r * cols, + ScreenLinesC[i] + LineOffset[cmdline_row + r], + (size_t)cols * sizeof(u8char_T)); } if (enc_dbcs == DBCS_JPNU) - mch_memmove(screenline2 + r * Columns, + mch_memmove(screenline2 + r * cols, ScreenLines2 + LineOffset[cmdline_row + r], - (size_t)Columns * sizeof(schar_T)); + (size_t)cols * sizeof(schar_T)); #endif } @@ -365,28 +386,28 @@ redraw_asap(type) for (r = 0; r < rows; ++r) { mch_memmove(current_ScreenLine, - screenline + r * Columns, - (size_t)Columns * sizeof(schar_T)); + screenline + r * cols, + (size_t)cols * sizeof(schar_T)); mch_memmove(ScreenAttrs + off, - screenattr + r * Columns, - (size_t)Columns * sizeof(sattr_T)); + screenattr + r * cols, + (size_t)cols * sizeof(sattr_T)); #ifdef FEAT_MBYTE if (enc_utf8) { mch_memmove(ScreenLinesUC + off, - screenlineUC + r * Columns, - (size_t)Columns * sizeof(u8char_T)); + screenlineUC + r * cols, + (size_t)cols * sizeof(u8char_T)); for (i = 0; i < p_mco; ++i) mch_memmove(ScreenLinesC[i] + off, - screenlineC[i] + r * Columns, - (size_t)Columns * sizeof(u8char_T)); + screenlineC[i] + r * cols, + (size_t)cols * sizeof(u8char_T)); } if (enc_dbcs == DBCS_JPNU) mch_memmove(ScreenLines2 + off, - screenline2 + r * Columns, - (size_t)Columns * sizeof(schar_T)); + screenline2 + r * cols, + (size_t)cols * sizeof(schar_T)); #endif - SCREEN_LINE(cmdline_row + r, 0, Columns, Columns, FALSE); + screen_line(cmdline_row + r, 0, cols, cols, FALSE); } ret = 4; } @@ -413,6 +434,57 @@ redraw_asap(type) return ret; } +/* + * Invoked after an asynchronous callback is called. + * If an echo command was used the cursor needs to be put back where + * it belongs. If highlighting was changed a redraw is needed. + * If "call_update_screen" is FALSE don't call update_screen() when at the + * command line. + */ + void +redraw_after_callback(int call_update_screen) +{ + ++redrawing_for_callback; + + if (State == HITRETURN || State == ASKMORE) + ; /* do nothing */ + else if (State & CMDLINE) + { + /* Redrawing only works when the screen didn't scroll. Don't clear + * wildmenu entries. */ + if (msg_scrolled == 0 +#ifdef FEAT_WILDMENU + && wild_menu_showing == 0 +#endif + && call_update_screen) + update_screen(0); + /* Redraw in the same position, so that the user can continue + * editing the command. */ + redrawcmdline_ex(FALSE); + } + else if (State & (NORMAL | INSERT | TERMINAL)) + { + /* keep the command line if possible */ + update_screen(VALID_NO_UPDATE); + setcursor(); + } + cursor_on(); +#ifdef FEAT_GUI + if (gui.in_use && !gui_mch_is_blink_off()) + /* Don't update the cursor when it is blinking and off to avoid + * flicker. */ + out_flush_cursor(FALSE, FALSE); + else +#endif + out_flush(); +#ifdef FEAT_GUI_MACVIM + if (gui.in_use) + gui_macvim_force_flush(); +#endif + + --redrawing_for_callback; +} + /* * Changed something in the current window, at buffer line "lnum", that * requires that line and possibly other lines to be redrawn. @@ -422,9 +494,9 @@ redraw_asap(type) * may become invalid and the whole window will have to be redrawn. */ void -redrawWinline(lnum, invalid) - linenr_T lnum; - int invalid UNUSED; /* window line height is invalid now */ +redrawWinline( + linenr_T lnum, + int invalid UNUSED) /* window line height is invalid now */ { #ifdef FEAT_FOLDING int i; @@ -445,38 +517,61 @@ redrawWinline(lnum, invalid) curwin->w_lines[i].wl_valid = FALSE; } #endif +} + + void +reset_updating_screen(int may_resize_shell UNUSED) +{ + updating_screen = FALSE; +#ifdef FEAT_GUI + if (may_resize_shell) + gui_may_resize_shell(); +#endif +#ifdef FEAT_TERMINAL + term_check_channel_closed_recently(); +#endif } /* - * update all windows that are editing the current buffer + * Update all windows that are editing the current buffer. */ void -update_curbuf(type) - int type; +update_curbuf(int type) { redraw_curbuf_later(type); update_screen(type); } /* - * update_screen() - * * Based on the current value of curwin->w_topline, transfer a screenfull * of stuff from Filemem to ScreenLines[], and update curwin->w_botline. + * Return OK when the screen was updated, FAIL if it was not done. */ - void -update_screen(type) - int type; + int +update_screen(int type_arg) { + int type = type_arg; win_T *wp; static int did_intro = FALSE; #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD) int did_one; #endif +#ifdef FEAT_GUI + int did_undraw = FALSE; + int gui_cursor_col; + int gui_cursor_row; +#endif + int no_update = FALSE; /* Don't do anything if the screen structures are (not yet) valid. */ if (!screen_valid(TRUE)) - return; + return FAIL; + + if (type == VALID_NO_UPDATE) + { + no_update = TRUE; + type = 0; + } if (must_redraw) { @@ -490,8 +585,12 @@ update_screen(type) must_redraw = 0; } - /* Need to update w_lines[]. */ - if (curwin->w_lines_valid == 0 && type < NOT_VALID) + /* May need to update w_lines[]. */ + if (curwin->w_lines_valid == 0 && type < NOT_VALID +#ifdef FEAT_TERMINAL + && !term_do_update_window(curwin) +#endif + ) type = NOT_VALID; /* Postpone the redrawing when it's not needed and when being called @@ -502,7 +601,7 @@ update_screen(type) must_redraw = type; if (type > INVERTED_ALL) curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */ - return; + return FAIL; } updating_screen = TRUE; @@ -510,6 +609,8 @@ update_screen(type) ++display_tick; /* let syntax code know we're in a next round of * display updating */ #endif + if (no_update) + ++no_win_do_lines_ins; /* * if the screen was scrolled up when displaying a message, scroll it down @@ -522,7 +623,8 @@ update_screen(type) else if (type != CLEAR) { check_for_delay(FALSE); - if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, NULL) == FAIL) + if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, 0, NULL) + == FAIL) type = CLEAR; FOR_ALL_WINDOWS(wp) { @@ -539,18 +641,15 @@ update_screen(type) else { wp->w_redr_type = NOT_VALID; -#ifdef FEAT_WINDOWS - if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp) - <= msg_scrolled) + if (W_WINROW(wp) + wp->w_height + wp->w_status_height + <= msg_scrolled) wp->w_redr_status = TRUE; -#endif } } } - redraw_cmdline = TRUE; -#ifdef FEAT_WINDOWS + if (!no_update) + redraw_cmdline = TRUE; redraw_tabline = TRUE; -#endif } msg_scrolled = 0; need_wait_return = FALSE; @@ -567,6 +666,8 @@ update_screen(type) { screenclear(); /* will reset clear_cmdline */ type = NOT_VALID; + /* must_redraw may be set indirectly, avoid another redraw later */ + must_redraw = 0; } if (clear_cmdline) /* going to clear cmdline (done below) */ @@ -603,11 +704,9 @@ update_screen(type) )) curwin->w_redr_type = type; -#ifdef FEAT_WINDOWS /* Redraw the tab pages line if needed. */ if (redraw_tabline || type >= NOT_VALID) draw_tabline(); -#endif #ifdef FEAT_SYN_HL /* @@ -618,19 +717,13 @@ update_screen(type) { if (wp->w_buffer->b_mod_set) { -# ifdef FEAT_WINDOWS win_T *wwp; /* Check if we already did this buffer. */ for (wwp = firstwin; wwp != wp; wwp = wwp->w_next) if (wwp->w_buffer == wp->w_buffer) break; -# endif - if ( -# ifdef FEAT_WINDOWS - wwp == wp && -# endif - syntax_present(wp)) + if (wwp == wp && syntax_present(wp)) syn_stack_apply_changes(wp->w_buffer); } } @@ -669,51 +762,49 @@ update_screen(type) /* Remove the cursor before starting to do anything, because * scrolling may make it difficult to redraw the text under * it. */ - if (gui.in_use) + if (gui.in_use && wp == curwin) + { + gui_cursor_col = gui.cursor_col; + gui_cursor_row = gui.cursor_row; gui_undraw_cursor(); + did_undraw = TRUE; + } #endif } #endif win_update(wp); } -#ifdef FEAT_WINDOWS /* redraw status line after the window to minimize cursor movement */ if (wp->w_redr_status) { cursor_off(); - win_redr_status(wp); + win_redr_status(wp, TRUE); // any popup menu will be redrawn below } -#endif } #if defined(FEAT_SEARCH_EXTRA) end_search_hl(); #endif #ifdef FEAT_INS_EXPAND /* May need to redraw the popup menu. */ - if (pum_visible()) - pum_redraw(); + pum_may_redraw(); #endif -#ifdef FEAT_WINDOWS /* Reset b_mod_set flags. Going through all windows is probably faster * than going through all buffers (there could be many buffers). */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) wp->w_buffer->b_mod_set = FALSE; -#else - curbuf->b_mod_set = FALSE; -#endif - updating_screen = FALSE; -#ifdef FEAT_GUI - gui_may_resize_shell(); -#endif + reset_updating_screen(TRUE); /* Clear or redraw the command line. Done last, because scrolling may * mess up the command line. */ if (clear_cmdline || redraw_cmdline) showmode(); + if (no_update) + --no_win_do_lines_ins; + /* May put up an introductory message when not editing a file */ if (!did_intro) maybe_intro_message(); @@ -724,13 +815,79 @@ update_screen(type) * done. */ if (gui.in_use) { - out_flush(); /* required before updating the cursor */ - if (did_one) + if (did_undraw && !gui_mch_is_blink_off()) + { + mch_disable_flush(); + out_flush(); /* required before updating the cursor */ + mch_enable_flush(); + + /* Put the GUI position where the cursor was, gui_update_cursor() + * uses that. */ + gui.col = gui_cursor_col; + gui.row = gui_cursor_row; +# ifdef FEAT_MBYTE + gui.col = mb_fix_col(gui.col, gui.row); +# endif gui_update_cursor(FALSE, FALSE); + gui_may_flush(); + screen_cur_col = gui.col; + screen_cur_row = gui.row; + } + else + out_flush(); gui_update_scrollbars(FALSE); } #endif + return OK; +} + +#if defined(FEAT_SIGNS) || defined(FEAT_GUI) || defined(FEAT_CONCEAL) +/* + * Prepare for updating one or more windows. + * Caller must check for "updating_screen" already set to avoid recursiveness. + */ + static void +update_prepare(void) +{ + cursor_off(); + updating_screen = TRUE; +#ifdef FEAT_GUI + /* Remove the cursor before starting to do anything, because scrolling may + * make it difficult to redraw the text under it. */ + if (gui.in_use) + gui_undraw_cursor(); +#endif +#ifdef FEAT_SEARCH_EXTRA + start_search_hl(); +#endif +} + +/* + * Finish updating one or more windows. + */ + static void +update_finish(void) +{ + if (redraw_cmdline) + showmode(); + +# ifdef FEAT_SEARCH_EXTRA + end_search_hl(); +# endif + + reset_updating_screen(TRUE); + +# ifdef FEAT_GUI + /* Redraw the cursor and update the scrollbars when all screen updating is + * done. */ + if (gui.in_use) + { + out_flush_cursor(FALSE, FALSE); + gui_update_scrollbars(FALSE); + } +# endif } +#endif #if defined(FEAT_CONCEAL) || defined(PROTO) /* @@ -738,8 +895,7 @@ update_screen(type) * to the 'concealcursor' option. */ int -conceal_cursor_line(wp) - win_T *wp; +conceal_cursor_line(win_T *wp) { int c; @@ -762,7 +918,7 @@ conceal_cursor_line(wp) * Check if the cursor line needs to be redrawn because of 'concealcursor'. */ void -conceal_check_cursur_line() +conceal_check_cursor_line(void) { if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin)) { @@ -774,22 +930,28 @@ conceal_check_cursur_line() } void -update_single_line(wp, lnum) - win_T *wp; - linenr_T lnum; +update_single_line(win_T *wp, linenr_T lnum) { int row; int j; +#ifdef SYN_TIME_LIMIT + proftime_T syntax_tm; +#endif + + /* Don't do anything if the screen structures are (not yet) valid. */ + if (!screen_valid(TRUE) || updating_screen) + return; if (lnum >= wp->w_topline && lnum < wp->w_botline && foldedCount(wp, lnum, &win_foldinfo) == 0) { -# ifdef FEAT_GUI - /* Remove the cursor before starting to do anything, because scrolling - * may make it difficult to redraw the text under it. */ - if (gui.in_use) - gui_undraw_cursor(); -# endif +#ifdef SYN_TIME_LIMIT + /* Set the time limit to 'redrawtime'. */ + profile_setlimit(p_rdt, &syntax_tm); + syn_set_timeout(&syntax_tm); +#endif + update_prepare(); + row = 0; for (j = 0; j < wp->w_lines_valid; ++j) { @@ -809,78 +971,20 @@ update_single_line(wp, lnum) } row += wp->w_lines[j].wl_size; } -# ifdef FEAT_GUI - /* Redraw the cursor */ - if (gui.in_use) - { - out_flush(); /* required before updating the cursor */ - gui_update_cursor(FALSE, FALSE); - } -# endif - } - need_cursor_line_redraw = FALSE; -} -#endif -#if defined(FEAT_SIGNS) || defined(FEAT_GUI) -static void update_prepare __ARGS((void)); -static void update_finish __ARGS((void)); + update_finish(); -/* - * Prepare for updating one or more windows. - * Caller must check for "updating_screen" already set to avoid recursiveness. - */ - static void -update_prepare() -{ - cursor_off(); - updating_screen = TRUE; -#ifdef FEAT_GUI - /* Remove the cursor before starting to do anything, because scrolling may - * make it difficult to redraw the text under it. */ - if (gui.in_use) - gui_undraw_cursor(); -#endif -#ifdef FEAT_SEARCH_EXTRA - start_search_hl(); +#ifdef SYN_TIME_LIMIT + syn_set_timeout(NULL); #endif -} - -/* - * Finish updating one or more windows. - */ - static void -update_finish() -{ - if (redraw_cmdline) - showmode(); - -# ifdef FEAT_SEARCH_EXTRA - end_search_hl(); -# endif - - updating_screen = FALSE; - -# ifdef FEAT_GUI - gui_may_resize_shell(); - - /* Redraw the cursor and update the scrollbars when all screen updating is - * done. */ - if (gui.in_use) - { - out_flush(); /* required before updating the cursor */ - gui_update_cursor(FALSE, FALSE); - gui_update_scrollbars(FALSE); } -# endif + need_cursor_line_redraw = FALSE; } #endif #if defined(FEAT_SIGNS) || defined(PROTO) void -update_debug_sign(buf, lnum) - buf_T *buf; - linenr_T lnum; +update_debug_sign(buf_T *buf, linenr_T lnum) { win_T *wp; int doit = FALSE; @@ -911,8 +1015,11 @@ update_debug_sign(buf, lnum) } /* Return when there is nothing to do, screen updating is already - * happening (recursive call) or still starting up. */ + * happening (recursive call), messages on the screen or still starting up. + */ if (!doit || updating_screen + || State == ASKMORE || State == HITRETURN + || msg_scrolled #ifdef FEAT_GUI || gui.starting #endif @@ -922,18 +1029,13 @@ update_debug_sign(buf, lnum) /* update all windows that need updating */ update_prepare(); -# ifdef FEAT_WINDOWS - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { if (wp->w_redr_type != 0) win_update(wp); if (wp->w_redr_status) - win_redr_status(wp); + win_redr_status(wp, FALSE); } -# else - if (curwin->w_redr_type != 0) - win_update(curwin); -# endif update_finish(); } @@ -946,8 +1048,7 @@ update_debug_sign(buf, lnum) * Used for the GUI scrollbar. */ void -updateWindow(wp) - win_T *wp; +updateWindow(win_T *wp) { /* return if already busy updating */ if (updating_screen) @@ -965,7 +1066,6 @@ updateWindow(wp) win_update(wp); -#ifdef FEAT_WINDOWS /* When the screen was cleared redraw the tab pages line. */ if (redraw_tabline) draw_tabline(); @@ -978,8 +1078,7 @@ updateWindow(wp) || *p_stl != NUL || *wp->w_p_stl != NUL # endif ) - win_redr_status(wp); -#endif + win_redr_status(wp, FALSE); update_finish(); } @@ -1013,8 +1112,7 @@ updateWindow(wp) * bot: from bot_start to last row (when scrolled up) */ static void -win_update(wp) - win_T *wp; +win_update(win_T *wp) { buf_T *buf = wp->w_buffer; int type; @@ -1061,25 +1159,25 @@ win_update(wp) #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA) int save_got_int; #endif +#ifdef SYN_TIME_LIMIT + proftime_T syntax_tm; +#endif type = wp->w_redr_type; if (type == NOT_VALID) { -#ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; -#endif wp->w_lines_valid = 0; } /* Window is zero-height: nothing to draw. */ - if (wp->w_height == 0) + if (wp->w_height + WINBAR_HEIGHT(wp) == 0) { wp->w_redr_type = 0; return; } -#ifdef FEAT_VERTSPLIT /* Window is zero-width: Only need to draw the separator. */ if (wp->w_width == 0) { @@ -1088,6 +1186,20 @@ win_update(wp) wp->w_redr_type = 0; return; } + +#ifdef FEAT_TERMINAL + // If this window contains a terminal, redraw works completely differently. + if (term_do_update_window(wp)) + { + term_update_window(wp); +# ifdef FEAT_MENU + /* Draw the window toolbar, if there is one. */ + if (winbar_height(wp) > 0) + redraw_win_toolbar(wp); +# endif + wp->w_redr_type = 0; + return; + } #endif #ifdef FEAT_SEARCH_EXTRA @@ -1202,7 +1314,7 @@ win_update(wp) lnumb = wp->w_lines[i].wl_lnum; /* When there is a fold column it might need updating * in the next line ("J" just above an open fold). */ - if (wp->w_p_fdc > 0) + if (compute_foldcolumn(wp, 0) > 0) ++lnumb; } } @@ -1415,7 +1527,8 @@ win_update(wp) if (row > 0) { check_for_delay(FALSE); - if (win_del_lines(wp, 0, row, FALSE, wp == firstwin) == OK) + if (win_del_lines(wp, 0, row, FALSE, wp == firstwin, 0) + == OK) bot_start = wp->w_height - row; else mid_start = 0; /* redraw all lines */ @@ -1468,18 +1581,16 @@ win_update(wp) if (mid_start == 0) { mid_end = wp->w_height; - if (lastwin == firstwin) + if (ONE_WINDOW) { /* Clear the screen when it was not done by win_del_lines() or * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE * then. */ if (screen_cleared != TRUE) screenclear(); -#ifdef FEAT_WINDOWS /* The screen was cleared, redraw the tab pages line. */ if (redraw_tabline) draw_tabline(); -#endif } } @@ -1584,9 +1695,17 @@ win_update(wp) */ if (VIsual_mode == Ctrl_V) { - colnr_T fromc, toc; + colnr_T fromc, toc; +#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK) + int save_ve_flags = ve_flags; + if (curwin->w_p_lbr) + ve_flags = VE_ALL; +#endif getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc); +#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK) + ve_flags = save_ve_flags; +#endif ++toc; if (curwin->w_curswant == MAXCOL) toc = MAXCOL; @@ -1705,10 +1824,24 @@ win_update(wp) save_got_int = got_int; got_int = 0; #endif +#ifdef SYN_TIME_LIMIT + /* Set the time limit to 'redrawtime'. */ + profile_setlimit(p_rdt, &syntax_tm); + syn_set_timeout(&syntax_tm); +#endif #ifdef FEAT_FOLDING win_foldinfo.fi_level = 0; #endif +#ifdef FEAT_MENU + /* + * Draw the window toolbar, if there is one. + * TODO: only when needed. + */ + if (winbar_height(wp) > 0) + redraw_win_toolbar(wp); +#endif + /* * Update all the window rows. */ @@ -1869,7 +2002,7 @@ win_update(wp) { check_for_delay(FALSE); if (win_del_lines(wp, row, - -xtra_rows, FALSE, FALSE) == FAIL) + -xtra_rows, FALSE, FALSE, 0) == FAIL) mod_bot = MAXLNUM; else bot_start = wp->w_height + xtra_rows; @@ -1973,7 +2106,7 @@ win_update(wp) && wp->w_lines[idx].wl_valid && wp->w_lines[idx].wl_lnum == lnum && lnum > wp->w_topline - && !(dy_flags & DY_LASTLINE) + && !(dy_flags & (DY_LASTLINE | DY_TRUNCATE)) && srow + wp->w_lines[idx].wl_size > wp->w_height #ifdef FEAT_DIFF && diff_check_fill(wp, lnum) == 0 @@ -2013,7 +2146,11 @@ win_update(wp) wp->w_lines[idx].wl_lnum = lnum; wp->w_lines[idx].wl_valid = TRUE; - if (row > wp->w_height) /* past end of screen */ + + /* Past end of the window or end of the screen. Note that after + * resizing wp->w_height may be end up too big. That's a problem + * elsewhere, but prevent a crash here. */ + if (row > wp->w_height || row + wp->w_winrow >= Rows) { /* we may need the size of that too long line later on */ if (dollar_vcol == -1) @@ -2056,13 +2193,32 @@ win_update(wp) * End of loop over all window lines. */ +#ifdef FEAT_VTP + /* Rewrite the character at the end of the screen line. */ + if (use_vtp()) + { + int i; - if (idx > wp->w_lines_valid) - wp->w_lines_valid = idx; - -#ifdef FEAT_SYN_HL - /* - * Let the syntax stuff know we stop parsing here. + for (i = 0; i < Rows; ++i) +# ifdef FEAT_MBYTE + if (enc_utf8) + if ((*mb_off2cells)(LineOffset[i] + Columns - 2, + LineOffset[i] + screen_Columns) > 1) + screen_draw_rectangle(i, Columns - 2, 1, 2, FALSE); + else + screen_draw_rectangle(i, Columns - 1, 1, 1, FALSE); + else +# endif + screen_char(LineOffset[i] + Columns - 1, i, Columns - 1); + } +#endif + + if (idx > wp->w_lines_valid) + wp->w_lines_valid = idx; + +#ifdef FEAT_SYN_HL + /* + * Let the syntax stuff know we stop parsing here. */ if (syntax_last_parsed != 0 && syntax_present(wp)) syntax_end_parsing(syntax_last_parsed + 1); @@ -2094,6 +2250,21 @@ win_update(wp) wp->w_filler_rows = wp->w_height - srow; } #endif + else if (dy_flags & DY_TRUNCATE) /* 'display' has "truncate" */ + { + int scr_row = W_WINROW(wp) + wp->w_height - 1; + + /* + * Last line isn't finished: Display "@@@" in the last screen line. + */ + screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol, + HL_ATTR(HLF_AT)); + screen_fill(scr_row, scr_row + 1, + (int)wp->w_wincol + 2, (int)W_ENDCOL(wp), + '@', ' ', HL_ATTR(HLF_AT)); + set_empty_rows(wp, srow); + wp->w_botline = lnum; + } else if (dy_flags & DY_LASTLINE) /* 'display' has "lastline" */ { /* @@ -2102,7 +2273,7 @@ win_update(wp) screen_fill(W_WINROW(wp) + wp->w_height - 1, W_WINROW(wp) + wp->w_height, (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp), - '@', '@', hl_attr(HLF_AT)); + '@', '@', HL_ATTR(HLF_AT)); set_empty_rows(wp, srow); wp->w_botline = lnum; } @@ -2114,9 +2285,7 @@ win_update(wp) } else { -#ifdef FEAT_VERTSPLIT draw_vsep_win(wp, row); -#endif if (eof) /* we hit the end of the file */ { wp->w_botline = buf->b_ml.ml_line_count + 1; @@ -2143,9 +2312,13 @@ win_update(wp) /* make sure the rest of the screen is blank */ /* put '~'s on rows that aren't part of the file. */ - win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_AT); + win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB); } +#ifdef SYN_TIME_LIMIT + syn_set_timeout(NULL); +#endif + /* Reset the type of redrawing required, the window has been updated. */ wp->w_redr_type = 0; #ifdef FEAT_DIFF @@ -2193,36 +2366,18 @@ win_update(wp) #endif } -#ifdef FEAT_SIGNS -static int draw_signcolumn __ARGS((win_T *wp)); - -/* - * Return TRUE when window "wp" has a column to draw signs in. - */ - static int -draw_signcolumn(wp) - win_T *wp; -{ - return (wp->w_buffer->b_signlist != NULL -# ifdef FEAT_NETBEANS_INTG - || netbeans_active() -# endif - ); -} -#endif - /* * Clear the rest of the window and mark the unused lines with "c1". use "c2" * as the filler character. */ static void -win_draw_end(wp, c1, c2, row, endrow, hl) - win_T *wp; - int c1; - int c2; - int row; - int endrow; - hlf_T hl; +win_draw_end( + win_T *wp, + int c1, + int c2, + int row, + int endrow, + hlf_T hl) { #if defined(FEAT_FOLDING) || defined(FEAT_SIGNS) || defined(FEAT_CMDWIN) int n = 0; @@ -2230,44 +2385,47 @@ win_draw_end(wp, c1, c2, row, endrow, hl) #else # define FDC_OFF 0 #endif +#ifdef FEAT_FOLDING + int fdc = compute_foldcolumn(wp, 0); +#endif #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) { /* No check for cmdline window: should never be right-left. */ # ifdef FEAT_FOLDING - n = wp->w_p_fdc; + n = fdc; if (n > 0) { /* draw the fold column at the right */ - if (n > W_WIDTH(wp)) - n = W_WIDTH(wp); + if (n > wp->w_width) + n = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - n, (int)W_ENDCOL(wp), - ' ', ' ', hl_attr(HLF_FC)); + ' ', ' ', HL_ATTR(HLF_FC)); } # endif # ifdef FEAT_SIGNS - if (draw_signcolumn(wp)) + if (signcolumn_on(wp)) { int nn = n + 2; /* draw the sign column left of the fold column */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n, - ' ', ' ', hl_attr(HLF_SC)); + ' ', ' ', HL_ATTR(HLF_SC)); n = nn; } # endif screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF, - c2, c2, hl_attr(hl)); + wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF, + c2, c2, HL_ATTR(hl)); screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF, - c1, c2, hl_attr(hl)); + c1, c2, HL_ATTR(hl)); } else #endif @@ -2280,55 +2438,53 @@ win_draw_end(wp, c1, c2, row, endrow, hl) if (n > wp->w_width) n = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), (int)W_WINCOL(wp) + n, - cmdwin_type, ' ', hl_attr(HLF_AT)); + wp->w_wincol, (int)wp->w_wincol + n, + cmdwin_type, ' ', HL_ATTR(HLF_AT)); } #endif #ifdef FEAT_FOLDING - if (wp->w_p_fdc > 0) + if (fdc > 0) { - int nn = n + wp->w_p_fdc; + int nn = n + fdc; /* draw the fold column at the left */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, - ' ', ' ', hl_attr(HLF_FC)); + wp->w_wincol + n, (int)wp->w_wincol + nn, + ' ', ' ', HL_ATTR(HLF_FC)); n = nn; } #endif #ifdef FEAT_SIGNS - if (draw_signcolumn(wp)) + if (signcolumn_on(wp)) { int nn = n + 2; /* draw the sign column after the fold column */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, - ' ', ' ', hl_attr(HLF_SC)); + wp->w_wincol + n, (int)wp->w_wincol + nn, + ' ', ' ', HL_ATTR(HLF_SC)); n = nn; } #endif screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp), - c1, c2, hl_attr(hl)); + wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp), + c1, c2, HL_ATTR(hl)); } set_empty_rows(wp, row); } #ifdef FEAT_SYN_HL -static int advance_color_col __ARGS((int vcol, int **color_cols)); +static int advance_color_col(int vcol, int **color_cols); /* * Advance **color_cols and return TRUE when there are columns to draw. */ static int -advance_color_col(vcol, color_cols) - int vcol; - int **color_cols; +advance_color_col(int vcol, int **color_cols) { while (**color_cols >= 0 && vcol > **color_cols) ++*color_cols; @@ -2336,19 +2492,172 @@ advance_color_col(vcol, color_cols) } #endif +#if defined(FEAT_MENU) || defined(FEAT_FOLDING) +/* + * Copy "text" to ScreenLines using "attr". + * Returns the next screen column. + */ + static int +text_to_screenline(win_T *wp, char_u *text, int col) +{ + int off = (int)(current_ScreenLine - ScreenLines); + +#ifdef FEAT_MBYTE + if (has_mbyte) + { + int cells; + int u8c, u8cc[MAX_MCO]; + int i; + int idx; + int c_len; + char_u *p; +# ifdef FEAT_ARABIC + int prev_c = 0; /* previous Arabic character */ + int prev_c1 = 0; /* first composing char for prev_c */ +# endif + +# ifdef FEAT_RIGHTLEFT + if (wp->w_p_rl) + idx = off; + else +# endif + idx = off + col; + + /* Store multibyte characters in ScreenLines[] et al. correctly. */ + for (p = text; *p != NUL; ) + { + cells = (*mb_ptr2cells)(p); + c_len = (*mb_ptr2len)(p); + if (col + cells > wp->w_width +# ifdef FEAT_RIGHTLEFT + - (wp->w_p_rl ? col : 0) +# endif + ) + break; + ScreenLines[idx] = *p; + if (enc_utf8) + { + u8c = utfc_ptr2char(p, u8cc); + if (*p < 0x80 && u8cc[0] == 0) + { + ScreenLinesUC[idx] = 0; +#ifdef FEAT_ARABIC + prev_c = u8c; +#endif + } + else + { +#ifdef FEAT_ARABIC + if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) + { + /* Do Arabic shaping. */ + int pc, pc1, nc; + int pcc[MAX_MCO]; + int firstbyte = *p; + + /* The idea of what is the previous and next + * character depends on 'rightleft'. */ + if (wp->w_p_rl) + { + pc = prev_c; + pc1 = prev_c1; + nc = utf_ptr2char(p + c_len); + prev_c1 = u8cc[0]; + } + else + { + pc = utfc_ptr2char(p + c_len, pcc); + nc = prev_c; + pc1 = pcc[0]; + } + prev_c = u8c; + + u8c = arabic_shape(u8c, &firstbyte, &u8cc[0], + pc, pc1, nc); + ScreenLines[idx] = firstbyte; + } + else + prev_c = u8c; +#endif + /* Non-BMP character: display as ? or fullwidth ?. */ +#ifdef UNICODE16 + if (u8c >= 0x10000) + ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; + else +#endif + ScreenLinesUC[idx] = u8c; + for (i = 0; i < Screen_mco; ++i) + { + ScreenLinesC[i][idx] = u8cc[i]; + if (u8cc[i] == 0) + break; + } + } + if (cells > 1) + ScreenLines[idx + 1] = 0; + } + else if (enc_dbcs == DBCS_JPNU && *p == 0x8e) + /* double-byte single width character */ + ScreenLines2[idx] = p[1]; + else if (cells > 1) + /* double-width character */ + ScreenLines[idx + 1] = p[1]; + col += cells; + idx += cells; + p += c_len; + } + } + else +#endif + { + int len = (int)STRLEN(text); + + if (len > wp->w_width - col) + len = wp->w_width - col; + if (len > 0) + { +#ifdef FEAT_RIGHTLEFT + if (wp->w_p_rl) + STRNCPY(current_ScreenLine, text, len); + else +#endif + STRNCPY(current_ScreenLine + col, text, len); + col += len; + } + } + return col; +} +#endif + #ifdef FEAT_FOLDING +/* + * Compute the width of the foldcolumn. Based on 'foldcolumn' and how much + * space is available for window "wp", minus "col". + */ + static int +compute_foldcolumn(win_T *wp, int col) +{ + int fdc = wp->w_p_fdc; + int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw; + int wwidth = wp->w_width; + + if (fdc > wwidth - (col + wmw)) + fdc = wwidth - (col + wmw); + return fdc; +} + /* * Display one folded line. */ static void -fold_line(wp, fold_count, foldinfo, lnum, row) - win_T *wp; - long fold_count; - foldinfo_T *foldinfo; - linenr_T lnum; - int row; +fold_line( + win_T *wp, + long fold_count, + foldinfo_T *foldinfo, + linenr_T lnum, + int row) { - char_u buf[51]; + char_u buf[FOLD_TEXT_LEN]; pos_T *top, *bot; linenr_T lnume = lnum + fold_count - 1; int len; @@ -2377,7 +2686,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row) if (cmdwin_type != 0 && wp == curwin) { ScreenLines[off] = cmdwin_type; - ScreenAttrs[off] = hl_attr(HLF_AT); + ScreenAttrs[off] = HL_ATTR(HLF_AT); #ifdef FEAT_MBYTE if (enc_utf8) ScreenLinesUC[off] = 0; @@ -2388,10 +2697,9 @@ fold_line(wp, fold_count, foldinfo, lnum, row) /* * 2. Add the 'foldcolumn' + * Reduce the width when there is not enough space. */ - fdc = wp->w_p_fdc; - if (fdc > W_WIDTH(wp) - col) - fdc = W_WIDTH(wp) - col; + fdc = compute_foldcolumn(wp, col); if (fdc > 0) { fill_foldcolumn(buf, wp, TRUE, lnum); @@ -2400,39 +2708,45 @@ fold_line(wp, fold_count, foldinfo, lnum, row) { int i; - copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc, - hl_attr(HLF_FC)); + copy_text_attr(off + wp->w_width - fdc - col, buf, fdc, + HL_ATTR(HLF_FC)); /* reverse the fold column */ for (i = 0; i < fdc; ++i) - ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i]; + ScreenLines[off + wp->w_width - i - 1 - col] = buf[i]; } else #endif - copy_text_attr(off + col, buf, fdc, hl_attr(HLF_FC)); + copy_text_attr(off + col, buf, fdc, HL_ATTR(HLF_FC)); col += fdc; } #ifdef FEAT_RIGHTLEFT -# define RL_MEMSET(p, v, l) if (wp->w_p_rl) \ - for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \ - else \ - for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (p) + ri] = v +# define RL_MEMSET(p, v, l) \ + do { \ + if (wp->w_p_rl) \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \ + else \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (p) + ri] = v; \ + } while (0) #else -# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (p) + ri] = v +# define RL_MEMSET(p, v, l) \ + do { \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (p) + ri] = v; \ + } while (0) #endif /* Set all attributes of the 'number' or 'relativenumber' column and the * text */ - RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col); + RL_MEMSET(col, HL_ATTR(HLF_FL), wp->w_width - col); #ifdef FEAT_SIGNS /* If signs are being displayed, add two spaces. */ - if (draw_signcolumn(wp)) + if (signcolumn_on(wp)) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { if (len > 2) @@ -2440,11 +2754,11 @@ fold_line(wp, fold_count, foldinfo, lnum, row) # ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* the line number isn't reversed */ - copy_text_attr(off + W_WIDTH(wp) - len - col, - (char_u *)" ", len, hl_attr(HLF_FL)); + copy_text_attr(off + wp->w_width - len - col, + (char_u *)" ", len, HL_ATTR(HLF_FL)); else # endif - copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL)); + copy_text_attr(off + col, (char_u *)" ", len, HL_ATTR(HLF_FL)); col += len; } } @@ -2455,7 +2769,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row) */ if (wp->w_p_nu || wp->w_p_rnu) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { int w = number_width(wp); @@ -2485,11 +2799,11 @@ fold_line(wp, fold_count, foldinfo, lnum, row) #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* the line number isn't reversed */ - copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len, - hl_attr(HLF_FL)); + copy_text_attr(off + wp->w_width - len - col, buf, len, + HL_ATTR(HLF_FL)); else #endif - copy_text_attr(off + col, buf, len, hl_attr(HLF_FL)); + copy_text_attr(off + col, buf, len, HL_ATTR(HLF_FL)); col += len; } } @@ -2506,135 +2820,14 @@ fold_line(wp, fold_count, foldinfo, lnum, row) * Right-left text is put in columns 0 - number-col, normal text is put * in columns number-col - window-width. */ -#ifdef FEAT_MBYTE - if (has_mbyte) - { - int cells; - int u8c, u8cc[MAX_MCO]; - int i; - int idx; - int c_len; - char_u *p; -# ifdef FEAT_ARABIC - int prev_c = 0; /* previous Arabic character */ - int prev_c1 = 0; /* first composing char for prev_c */ -# endif - -# ifdef FEAT_RIGHTLEFT - if (wp->w_p_rl) - idx = off; - else -# endif - idx = off + col; - - /* Store multibyte characters in ScreenLines[] et al. correctly. */ - for (p = text; *p != NUL; ) - { - cells = (*mb_ptr2cells)(p); - c_len = (*mb_ptr2len)(p); - if (col + cells > W_WIDTH(wp) -# ifdef FEAT_RIGHTLEFT - - (wp->w_p_rl ? col : 0) -# endif - ) - break; - ScreenLines[idx] = *p; - if (enc_utf8) - { - u8c = utfc_ptr2char(p, u8cc); - if (*p < 0x80 && u8cc[0] == 0) - { - ScreenLinesUC[idx] = 0; -#ifdef FEAT_ARABIC - prev_c = u8c; -#endif - } - else - { -#ifdef FEAT_ARABIC - if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) - { - /* Do Arabic shaping. */ - int pc, pc1, nc; - int pcc[MAX_MCO]; - int firstbyte = *p; - - /* The idea of what is the previous and next - * character depends on 'rightleft'. */ - if (wp->w_p_rl) - { - pc = prev_c; - pc1 = prev_c1; - nc = utf_ptr2char(p + c_len); - prev_c1 = u8cc[0]; - } - else - { - pc = utfc_ptr2char(p + c_len, pcc); - nc = prev_c; - pc1 = pcc[0]; - } - prev_c = u8c; - - u8c = arabic_shape(u8c, &firstbyte, &u8cc[0], - pc, pc1, nc); - ScreenLines[idx] = firstbyte; - } - else - prev_c = u8c; -#endif - /* Non-BMP character: display as ? or fullwidth ?. */ -#ifdef UNICODE16 - if (u8c >= 0x10000) - ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; - else -#endif - ScreenLinesUC[idx] = u8c; - for (i = 0; i < Screen_mco; ++i) - { - ScreenLinesC[i][idx] = u8cc[i]; - if (u8cc[i] == 0) - break; - } - } - if (cells > 1) - ScreenLines[idx + 1] = 0; - } - else if (enc_dbcs == DBCS_JPNU && *p == 0x8e) - /* double-byte single width character */ - ScreenLines2[idx] = p[1]; - else if (cells > 1) - /* double-width character */ - ScreenLines[idx + 1] = p[1]; - col += cells; - idx += cells; - p += c_len; - } - } - else -#endif - { - len = (int)STRLEN(text); - if (len > W_WIDTH(wp) - col) - len = W_WIDTH(wp) - col; - if (len > 0) - { -#ifdef FEAT_RIGHTLEFT - if (wp->w_p_rl) - STRNCPY(current_ScreenLine, text, len); - else -#endif - STRNCPY(current_ScreenLine + col, text, len); - col += len; - } - } + col = text_to_screenline(wp, text, col); /* Fill the rest of the line with the fold filler */ #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) col -= txtcol; #endif - while (col < W_WIDTH(wp) + while (col < wp->w_width #ifdef FEAT_RIGHTLEFT - (wp->w_p_rl ? txtcol : 0) #endif @@ -2647,12 +2840,18 @@ fold_line(wp, fold_count, foldinfo, lnum, row) { ScreenLinesUC[off + col] = fill_fold; ScreenLinesC[0][off + col] = 0; + ScreenLines[off + col] = 0x80; /* avoid storing zero */ } else + { ScreenLinesUC[off + col] = 0; + ScreenLines[off + col] = fill_fold; + } + col++; } + else #endif - ScreenLines[off + col++] = fill_fold; + ScreenLines[off + col++] = fill_fold; } if (text != buf) @@ -2664,7 +2863,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row) */ if (VIsual_active && wp->w_buffer == curwin->w_buffer) { - if (ltoreq(curwin->w_cursor, VIsual)) + if (LTOREQ_POS(curwin->w_cursor, VIsual)) { /* Visual is after curwin->w_cursor */ top = &curwin->w_cursor; @@ -2690,27 +2889,49 @@ fold_line(wp, fold_count, foldinfo, lnum, row) if (VIsual_mode == Ctrl_V) { /* Visual block mode: highlight the chars part of the block */ - if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp)) + if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_width) { if (wp->w_old_cursor_lcol != MAXCOL && wp->w_old_cursor_lcol + txtcol - < (colnr_T)W_WIDTH(wp)) + < (colnr_T)wp->w_width) len = wp->w_old_cursor_lcol; else - len = W_WIDTH(wp) - txtcol; - RL_MEMSET(wp->w_old_cursor_fcol + txtcol, hl_attr(HLF_V), + len = wp->w_width - txtcol; + RL_MEMSET(wp->w_old_cursor_fcol + txtcol, HL_ATTR(HLF_V), len - (int)wp->w_old_cursor_fcol); } } else { /* Set all attributes of the text */ - RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol); + RL_MEMSET(txtcol, HL_ATTR(HLF_V), wp->w_width - txtcol); } } } #ifdef FEAT_SYN_HL + /* Show colorcolumn in the fold line, but let cursorcolumn override it. */ + if (wp->w_p_cc_cols) + { + int i = 0; + int j = wp->w_p_cc_cols[i]; + int old_txtcol = txtcol; + + while (j > -1) + { + txtcol += j; + if (wp->w_p_wrap) + txtcol -= wp->w_skipcol; + else + txtcol -= wp->w_leftcol; + if (txtcol >= 0 && txtcol < wp->w_width) + ScreenAttrs[off + txtcol] = hl_combine_attr( + ScreenAttrs[off + txtcol], HL_ATTR(HLF_MC)); + txtcol = old_txtcol; + j = wp->w_p_cc_cols[++i]; + } + } + /* Show 'cursorcolumn' in the fold line. */ if (wp->w_p_cuc) { @@ -2719,14 +2940,14 @@ fold_line(wp, fold_count, foldinfo, lnum, row) txtcol -= wp->w_skipcol; else txtcol -= wp->w_leftcol; - if (txtcol >= 0 && txtcol < W_WIDTH(wp)) + if (txtcol >= 0 && txtcol < wp->w_width) ScreenAttrs[off + txtcol] = hl_combine_attr( - ScreenAttrs[off + txtcol], hl_attr(HLF_CUC)); + ScreenAttrs[off + txtcol], HL_ATTR(HLF_CUC)); } #endif - SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), - (int)W_WIDTH(wp), FALSE); + screen_line(row + W_WINROW(wp), wp->w_wincol, (int)wp->w_width, + (int)wp->w_width, FALSE); /* * Update w_cline_height and w_cline_folded if the cursor line was @@ -2747,11 +2968,11 @@ fold_line(wp, fold_count, foldinfo, lnum, row) * Copy "buf[len]" to ScreenLines["off"] and set attributes to "attr". */ static void -copy_text_attr(off, buf, len, attr) - int off; - char_u *buf; - int len; - int attr; +copy_text_attr( + int off, + char_u *buf, + int len, + int attr) { int i; @@ -2769,33 +2990,34 @@ copy_text_attr(off, buf, len, attr) * Only to be called when 'foldcolumn' > 0. */ static void -fill_foldcolumn(p, wp, closed, lnum) - char_u *p; - win_T *wp; - int closed; /* TRUE of FALSE */ - linenr_T lnum; /* current line number */ +fill_foldcolumn( + char_u *p, + win_T *wp, + int closed, /* TRUE of FALSE */ + linenr_T lnum) /* current line number */ { int i = 0; int level; int first_level; int empty; + int fdc = compute_foldcolumn(wp, 0); /* Init to all spaces. */ - copy_spaces(p, (size_t)wp->w_p_fdc); + vim_memset(p, ' ', (size_t)fdc); level = win_foldinfo.fi_level; if (level > 0) { /* If there is only one column put more info in it. */ - empty = (wp->w_p_fdc == 1) ? 0 : 1; + empty = (fdc == 1) ? 0 : 1; /* If the column is too narrow, we start at the lowest level that * fits and use numbers to indicated the depth. */ - first_level = level - wp->w_p_fdc - closed + 1 + empty; + first_level = level - fdc - closed + 1 + empty; if (first_level < 1) first_level = 1; - for (i = 0; i + empty < wp->w_p_fdc; ++i) + for (i = 0; i + empty < fdc; ++i) { if (win_foldinfo.fi_lnum == lnum && first_level + i >= win_foldinfo.fi_low_level) @@ -2811,7 +3033,7 @@ fill_foldcolumn(p, wp, closed, lnum) } } if (closed) - p[i >= wp->w_p_fdc ? i - 1 : i] = '+'; + p[i >= fdc ? i - 1 : i] = '+'; } #endif /* FEAT_FOLDING */ @@ -2823,17 +3045,20 @@ fill_foldcolumn(p, wp, closed, lnum) * Return the number of last row the line occupies. */ static int -win_line(wp, lnum, startrow, endrow, nochange) - win_T *wp; - linenr_T lnum; - int startrow; - int endrow; - int nochange UNUSED; /* not updating for changed text */ +win_line( + win_T *wp, + linenr_T lnum, + int startrow, + int endrow, + int nochange UNUSED) /* not updating for changed text */ { - int col; /* visual column on screen */ + int col = 0; /* visual column on screen */ unsigned off; /* offset in ScreenLines/ScreenAttrs */ int c = 0; /* init for GCC */ long vcol = 0; /* virtual column (for tabs) */ +#ifdef FEAT_LINEBREAK + long vcol_sbr = -1; /* virtual column after showbreak */ +#endif long vcol_prev = -1; /* "vcol" of previous character */ char_u *line; /* current line */ char_u *ptr; /* current position in "line" */ @@ -2921,9 +3146,10 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif colnr_T trailcol = MAXCOL; /* start of trailing spaces */ #ifdef FEAT_LINEBREAK - int need_showbreak = FALSE; + int need_showbreak = FALSE; /* overlong line, skipping first x + chars */ #endif -#if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ +#if defined(FEAT_SIGNS) || defined(FEAT_QUICKFIX) \ || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) # define LINE_ATTR int line_attr = 0; /* attribute for the whole line */ @@ -2946,6 +3172,10 @@ win_line(wp, lnum, startrow, endrow, nochange) #if defined(LINE_ATTR) int did_line_attr = 0; #endif +#ifdef FEAT_TERMINAL + int get_term_attr = FALSE; + int term_attr = 0; /* background for terminal window */ +#endif /* draw_state: items that are drawn in sequence: */ #define WL_START 0 /* nothing done yet */ @@ -2986,12 +3216,15 @@ win_line(wp, lnum, startrow, endrow, nochange) int syntax_flags = 0; int syntax_seqnr = 0; int prev_syntax_id = 0; - int conceal_attr = hl_attr(HLF_CONCEAL); + int conceal_attr = HL_ATTR(HLF_CONCEAL); int is_concealing = FALSE; int boguscols = 0; /* nonexistent columns added to force wrapping */ int vcol_off = 0; /* offset for concealed characters */ int did_wcol = FALSE; + int match_conc = 0; /* cchar for match functions */ + int has_match_conc = 0; /* match wants to conceal */ + int old_boguscols = 0; # define VCOL_HLC (vcol - vcol_off) # define FIX_FOR_BOGUSCOLS \ { \ @@ -2999,6 +3232,7 @@ win_line(wp, lnum, startrow, endrow, nochange) vcol -= vcol_off; \ vcol_off = 0; \ col -= boguscols; \ + old_boguscols = boguscols; \ boguscols = 0; \ } #else @@ -3021,7 +3255,11 @@ win_line(wp, lnum, startrow, endrow, nochange) extra_check = 0; #endif #ifdef FEAT_SYN_HL - if (syntax_present(wp) && !wp->w_s->b_syn_error) + if (syntax_present(wp) && !wp->w_s->b_syn_error +# ifdef SYN_TIME_LIMIT + && !wp->w_s->b_syn_slow +# endif + ) { /* Prepare for syntax highlighting in this line. When there is an * error, stop syntax highlighting. */ @@ -3033,8 +3271,13 @@ win_line(wp, lnum, startrow, endrow, nochange) else { did_emsg = save_did_emsg; - has_syntax = TRUE; - extra_check = TRUE; +#ifdef SYN_TIME_LIMIT + if (!wp->w_s->b_syn_slow) +#endif + { + has_syntax = TRUE; + extra_check = TRUE; + } } } @@ -3044,6 +3287,15 @@ win_line(wp, lnum, startrow, endrow, nochange) draw_color_col = advance_color_col(VCOL_HLC, &color_cols); #endif +#ifdef FEAT_TERMINAL + if (term_show_buffer(wp->w_buffer)) + { + extra_check = TRUE; + get_term_attr = TRUE; + term_attr = term_get_attr(wp->w_buffer, lnum, -1); + } +#endif + #ifdef FEAT_SPELL if (wp->w_p_spell && *wp->w_s->b_p_spl != NUL @@ -3089,7 +3341,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (VIsual_active && wp->w_buffer == curwin->w_buffer) { /* Visual is after curwin->w_cursor */ - if (ltoreq(curwin->w_cursor, VIsual)) + if (LTOREQ_POS(curwin->w_cursor, VIsual)) { top = &curwin->w_cursor; bot = &VIsual; @@ -3150,27 +3402,25 @@ win_line(wp, lnum, startrow, endrow, nochange) } } -#ifndef MSDOS /* Check if the character under the cursor should not be inverted */ if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin -# ifdef FEAT_GUI +#ifdef FEAT_GUI && !gui.in_use -# endif +#endif ) noinvcur = TRUE; -#endif /* if inverting in this line set area_highlighting */ if (fromcol >= 0) { area_highlighting = TRUE; - attr = hl_attr(HLF_V); + attr = HL_ATTR(HLF_V); #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) if ((clip_star.available && !clip_star.owned && clip_isautosel_star()) || (clip_plus.available && !clip_plus.owned && clip_isautosel_plus())) - attr = hl_attr(HLF_VNC); + attr = HL_ATTR(HLF_VNC); #endif } } @@ -3200,7 +3450,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (fromcol == tocol) tocol = fromcol + 1; area_highlighting = TRUE; - attr = hl_attr(HLF_I); + attr = HL_ATTR(HLF_I); } #ifdef FEAT_DIFF @@ -3233,10 +3483,10 @@ win_line(wp, lnum, startrow, endrow, nochange) if (v != 0) line_attr = sign_get_attr((int)v, TRUE); # endif -# if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS) +# if defined(FEAT_QUICKFIX) /* Highlight the current line in the quickfix window. */ if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum) - line_attr = hl_attr(HLF_L); + line_attr = HL_ATTR(HLF_QFL); # endif if (line_attr != 0) area_highlighting = TRUE; @@ -3250,7 +3500,7 @@ win_line(wp, lnum, startrow, endrow, nochange) { /* For checking first word with a capital skip white space. */ if (cap_col == 0) - cap_col = (int)(skipwhite(line) - line); + cap_col = getwhitecols(line); /* To be able to spell-check over line boundaries copy the end of the * current line into nextline[]. Above the start of the next line was @@ -3284,14 +3534,18 @@ win_line(wp, lnum, startrow, endrow, nochange) } #endif - /* find start of trailing whitespace */ - if (wp->w_p_list && lcs_trail) + if (wp->w_p_list) { - trailcol = (colnr_T)STRLEN(ptr); - while (trailcol > (colnr_T)0 && vim_iswhite(ptr[trailcol - 1])) - --trailcol; - trailcol += (colnr_T) (ptr - line); - extra_check = TRUE; + if (lcs_space || lcs_trail) + extra_check = TRUE; + /* find start of trailing whitespace */ + if (lcs_trail) + { + trailcol = (colnr_T)STRLEN(ptr); + while (trailcol > (colnr_T)0 && VIM_ISWHITE(ptr[trailcol - 1])) + --trailcol; + trailcol += (colnr_T) (ptr - line); + } } /* @@ -3314,7 +3568,7 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_MBYTE prev_ptr = ptr; #endif - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); } /* When: @@ -3346,7 +3600,14 @@ win_line(wp, lnum, startrow, endrow, nochange) #else --ptr; #endif - n_skip = v - vcol; + /* If the character fits on the screen, don't need to skip it. + * Except for a TAB. */ + if (( +#ifdef FEAT_MBYTE + (*mb_ptr2cells)(ptr) >= c || +#endif + *ptr == TAB) && col == 0) + n_skip = v - vcol; } /* @@ -3450,10 +3711,12 @@ win_line(wp, lnum, startrow, endrow, nochange) shl->startcol = MAXCOL; shl->endcol = MAXCOL; shl->attr_cur = 0; + shl->is_addpos = FALSE; v = (long)(ptr - line); if (cur != NULL) cur->pos.cur = 0; - next_search_hl(wp, shl, lnum, (colnr_T)v, cur); + next_search_hl(wp, shl, lnum, (colnr_T)v, + shl == &search_hl ? NULL : cur); /* Need to get the line again, a multi-line regexp may have made it * invalid. */ @@ -3500,7 +3763,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (wp->w_p_cul && lnum == wp->w_cursor.lnum && !(wp == curwin && VIsual_active)) { - line_attr = hl_attr(HLF_CUL); + line_attr = HL_ATTR(HLF_CUL); area_highlighting = TRUE; } #endif @@ -3513,7 +3776,7 @@ win_line(wp, lnum, startrow, endrow, nochange) /* Rightleft window: process the text in the normal direction, but put * it in current_ScreenLine[] from right to left. Start at the * rightmost column of the window. */ - col = W_WIDTH(wp) - 1; + col = wp->w_width - 1; off += col; } #endif @@ -3523,6 +3786,9 @@ win_line(wp, lnum, startrow, endrow, nochange) */ for (;;) { +#ifdef FEAT_CONCEAL + has_match_conc = 0; +#endif /* Skip this quickly when working on the text. */ if (draw_state != WL_LINE) { @@ -3535,7 +3801,7 @@ win_line(wp, lnum, startrow, endrow, nochange) /* Draw the cmdline character. */ n_extra = 1; c_extra = cmdwin_type; - char_attr = hl_attr(HLF_AT); + char_attr = HL_ATTR(HLF_AT); } } #endif @@ -3543,16 +3809,25 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_FOLDING if (draw_state == WL_FOLD - 1 && n_extra == 0) { + int fdc = compute_foldcolumn(wp, 0); + draw_state = WL_FOLD; - if (wp->w_p_fdc > 0) + if (fdc > 0) { - /* Draw the 'foldcolumn'. */ - fill_foldcolumn(extra, wp, FALSE, lnum); - n_extra = wp->w_p_fdc; - p_extra = extra; - p_extra[n_extra] = NUL; - c_extra = NUL; - char_attr = hl_attr(HLF_FC); + /* Draw the 'foldcolumn'. Allocate a buffer, "extra" may + * already be in use. */ + vim_free(p_extra_free); + p_extra_free = alloc(12 + 1); + + if (p_extra_free != NULL) + { + fill_foldcolumn(p_extra_free, wp, FALSE, lnum); + n_extra = fdc; + p_extra_free[n_extra] = NUL; + p_extra = p_extra_free; + c_extra = NUL; + char_attr = HL_ATTR(HLF_FC); + } } } #endif @@ -3563,7 +3838,7 @@ win_line(wp, lnum, startrow, endrow, nochange) draw_state = WL_SIGN; /* Show the sign column when there are any signs in this * buffer or when using Netbeans. */ - if (draw_signcolumn(wp)) + if (signcolumn_on(wp)) { int text_sign; # ifdef FEAT_SIGN_ICONS @@ -3572,7 +3847,7 @@ win_line(wp, lnum, startrow, endrow, nochange) /* Draw two cells with the sign value or blank. */ c_extra = ' '; - char_attr = hl_attr(HLF_SC); + char_attr = HL_ATTR(HLF_SC); n_extra = 2; if (row == startrow @@ -3665,7 +3940,7 @@ win_line(wp, lnum, startrow, endrow, nochange) else c_extra = ' '; n_extra = number_width(wp) + 1; - char_attr = hl_attr(HLF_N); + char_attr = HL_ATTR(HLF_N); #ifdef FEAT_SYN_HL /* When 'cursorline' is set highlight the line number of * the current line differently. @@ -3673,7 +3948,7 @@ win_line(wp, lnum, startrow, endrow, nochange) * when CursorLineNr isn't set? */ if ((wp->w_p_cul || wp->w_p_rnu) && lnum == wp->w_cursor.lnum) - char_attr = hl_attr(HLF_CLN); + char_attr = HL_ATTR(HLF_CLN); #endif } } @@ -3691,19 +3966,26 @@ win_line(wp, lnum, startrow, endrow, nochange) if (draw_state == WL_BRI - 1 && n_extra == 0) { draw_state = WL_BRI; + /* if need_showbreak is set, breakindent also applies */ + if (wp->w_p_bri && n_extra == 0 + && (row != startrow || need_showbreak) # ifdef FEAT_DIFF -# endif - if (wp->w_p_bri && n_extra == 0 && row != startrow -#ifdef FEAT_DIFF && filler_lines == 0 -#endif +# endif ) { - char_attr = 0; /* was: hl_attr(HLF_AT); */ -#ifdef FEAT_DIFF + char_attr = 0; +# ifdef FEAT_DIFF if (diff_hlf != (hlf_T)0) - char_attr = hl_attr(diff_hlf); -#endif + { + char_attr = HL_ATTR(diff_hlf); +# ifdef FEAT_SYN_HL + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + char_attr = hl_combine_attr(char_attr, + HL_ATTR(HLF_CUL)); +# endif + } +# endif p_extra = NULL; c_extra = ' '; n_extra = get_breakindent_win(wp, @@ -3733,8 +4015,8 @@ win_line(wp, lnum, startrow, endrow, nochange) n_extra = col + 1; else # endif - n_extra = W_WIDTH(wp) - col; - char_attr = hl_attr(HLF_DED); + n_extra = wp->w_width - col; + char_attr = HL_ATTR(HLF_DED); } # endif # ifdef FEAT_LINEBREAK @@ -3744,8 +4026,9 @@ win_line(wp, lnum, startrow, endrow, nochange) p_extra = p_sbr; c_extra = NUL; n_extra = (int)STRLEN(p_sbr); - char_attr = hl_attr(HLF_AT); + char_attr = HL_ATTR(HLF_AT); need_showbreak = FALSE; + vcol_sbr = vcol + MB_CHARLEN(p_sbr); /* Correct end of highlighted area for 'showbreak', * required when 'linebreak' is also set. */ if (tocol == vcol) @@ -3753,7 +4036,8 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_SYN_HL /* combine 'showbreak' with 'cursorline' */ if (wp->w_p_cul && lnum == wp->w_cursor.lnum) - char_attr = hl_combine_attr(char_attr, HLF_CLN); + char_attr = hl_combine_attr(char_attr, + HL_ATTR(HLF_CUL)); #endif } # endif @@ -3784,8 +4068,8 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif ) { - SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), - wp->w_p_rl); + screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width, + HAS_RIGHTLEFT(wp->w_p_rl)); /* Pretend we have finished updating the window. Except when * 'cursorcolumn' is set. */ #ifdef FEAT_SYN_HL @@ -3850,14 +4134,32 @@ win_line(wp, lnum, startrow, endrow, nochange) && v >= (long)shl->startcol && v < (long)shl->endcol) { +#ifdef FEAT_MBYTE + int tmp_col = v + MB_PTR2LEN(ptr); + + if (shl->endcol < tmp_col) + shl->endcol = tmp_col; +#endif shl->attr_cur = shl->attr; +#ifdef FEAT_CONCEAL + if (cur != NULL && syn_name2id((char_u *)"Conceal") + == cur->hlg_id) + { + has_match_conc = + v == (long)shl->startcol ? 2 : 1; + match_conc = cur->conceal_char; + } + else + has_match_conc = match_conc = 0; +#endif } - else if (v >= (long)shl->endcol) + else if (v == (long)shl->endcol) { shl->attr_cur = 0; - next_search_hl(wp, shl, lnum, (colnr_T)v, cur); + next_search_hl(wp, shl, lnum, (colnr_T)v, + shl == &search_hl ? NULL : cur); pos_inprogress = cur == NULL || cur->pos.cur == 0 - ? FALSE : TRUE; + ? FALSE : TRUE; /* Need to get the line again, a multi-line regexp * may have made it invalid. */ @@ -3918,6 +4220,10 @@ win_line(wp, lnum, startrow, endrow, nochange) if (shl != &search_hl && cur != NULL) cur = cur->next; } + /* Only highlight one character after the last column. */ + if (*ptr == NUL && (did_line_attr >= 1 + || (wp->w_p_list && lcs_eol_one == -1))) + search_attr = 0; } #endif @@ -3930,23 +4236,30 @@ win_line(wp, lnum, startrow, endrow, nochange) if (diff_hlf == HLF_TXD && ptr - line > change_end && n_extra == 0) diff_hlf = HLF_CHD; /* changed line */ - line_attr = hl_attr(diff_hlf); + line_attr = HL_ATTR(diff_hlf); + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + line_attr = hl_combine_attr(line_attr, HL_ATTR(HLF_CUL)); } #endif /* Decide which of the highlight attributes to use. */ attr_pri = TRUE; +#ifdef LINE_ATTR if (area_attr != 0) - char_attr = area_attr; + char_attr = hl_combine_attr(line_attr, area_attr); else if (search_attr != 0) - char_attr = search_attr; -#ifdef LINE_ATTR + char_attr = hl_combine_attr(line_attr, search_attr); /* Use line_attr when not in the Visual or 'incsearch' area * (area_attr may be 0 when "noinvcur" is set). */ else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) || vcol < fromcol || vcol_prev < fromcol_prev || vcol >= tocol)) char_attr = line_attr; +#else + if (area_attr != 0) + char_attr = area_attr; + else if (search_attr != 0) + char_attr = search_attr; #endif else { @@ -3978,7 +4291,7 @@ win_line(wp, lnum, startrow, endrow, nochange) c = c_extra; #ifdef FEAT_MBYTE mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -3999,7 +4312,7 @@ win_line(wp, lnum, startrow, endrow, nochange) { /* If the UTF-8 character is more than one byte: * Decode it into "mb_c". */ - mb_l = (*mb_ptr2len)(p_extra); + mb_l = utfc_ptr2len(p_extra); mb_utf8 = FALSE; if (mb_l > n_extra) mb_l = 1; @@ -4028,14 +4341,14 @@ win_line(wp, lnum, startrow, endrow, nochange) # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col <= 0) : # endif - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; mb_c = c; mb_l = 1; mb_utf8 = FALSE; - multi_attr = hl_attr(HLF_AT); + multi_attr = HL_ATTR(HLF_AT); /* put the pointer back to output the double-width * character at the start of the next line. */ ++n_extra; @@ -4054,15 +4367,19 @@ win_line(wp, lnum, startrow, endrow, nochange) } else { +#ifdef FEAT_LINEBREAK + int c0; +#endif + if (p_extra_free != NULL) - { - vim_free(p_extra_free); - p_extra_free = NULL; - } + VIM_CLEAR(p_extra_free); /* * Get a character from the line itself. */ c = *ptr; +#ifdef FEAT_LINEBREAK + c0 = *ptr; +#endif #ifdef FEAT_MBYTE if (has_mbyte) { @@ -4071,7 +4388,7 @@ win_line(wp, lnum, startrow, endrow, nochange) { /* If the UTF-8 character is more than one byte: Decode it * into "mb_c". */ - mb_l = (*mb_ptr2len)(ptr); + mb_l = utfc_ptr2len(ptr); mb_utf8 = FALSE; if (mb_l > 1) { @@ -4079,7 +4396,12 @@ win_line(wp, lnum, startrow, endrow, nochange) /* Overlong encoded ASCII or ASCII with composing char * is displayed normally, except a NUL. */ if (mb_c < 0x80) + { c = mb_c; +# ifdef FEAT_LINEBREAK + c0 = mb_c; +# endif + } mb_utf8 = TRUE; /* At start of the line we can have a composing char. @@ -4134,7 +4456,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (area_attr == 0 && search_attr == 0) { n_attr = n_extra + 1; - extra_attr = hl_attr(HLF_8); + extra_attr = HL_ATTR(HLF_8); saved_attr2 = char_attr; /* save current attr */ } } @@ -4203,7 +4525,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (area_attr == 0 && search_attr == 0) { n_attr = n_extra + 1; - extra_attr = hl_attr(HLF_8); + extra_attr = HL_ATTR(HLF_8); saved_attr2 = char_attr; /* save current attr */ } mb_c = c; @@ -4217,14 +4539,14 @@ win_line(wp, lnum, startrow, endrow, nochange) # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col <= 0) : # endif - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; mb_c = c; mb_utf8 = FALSE; mb_l = 1; - multi_attr = hl_attr(HLF_AT); + multi_attr = HL_ATTR(HLF_AT); /* Put pointer back so that the character will be * displayed at the start of the next line. */ --ptr; @@ -4243,7 +4565,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (area_attr == 0 && search_attr == 0) { n_attr = n_extra + 1; - extra_attr = hl_attr(HLF_AT); + extra_attr = HL_ATTR(HLF_AT); saved_attr2 = char_attr; /* save current attr */ } mb_c = c; @@ -4255,39 +4577,24 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif ++ptr; - /* 'list' : change char 160 to lcs_nbsp. */ - if (wp->w_p_list && (c == 160 -#ifdef FEAT_MBYTE - || (mb_utf8 && mb_c == 160) -#endif - ) && lcs_nbsp) - { - c = lcs_nbsp; - if (area_attr == 0 && search_attr == 0) - { - n_attr = 1; - extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ - } -#ifdef FEAT_MBYTE - mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) - { - mb_utf8 = TRUE; - u8cc[0] = 0; - c = 0xc0; - } - else - mb_utf8 = FALSE; -#endif - } - if (extra_check) { #ifdef FEAT_SPELL int can_spell = TRUE; #endif +#ifdef FEAT_TERMINAL + if (get_term_attr) + { + syntax_attr = term_get_attr(wp->w_buffer, lnum, vcol); + + if (!attr_pri) + char_attr = syntax_attr; + else + char_attr = hl_combine_attr(syntax_attr, char_attr); + } +#endif + #ifdef FEAT_SYN_HL /* Get syntax attribute, unless still at the start of the line * (double-wide char that doesn't fit). */ @@ -4312,6 +4619,10 @@ win_line(wp, lnum, startrow, endrow, nochange) } else did_emsg = save_did_emsg; +#ifdef SYN_TIME_LIMIT + if (wp->w_s->b_syn_slow) + has_syntax = FALSE; +#endif /* Need to get the line again, a multi-line regexp may * have made it invalid. */ @@ -4430,18 +4741,31 @@ win_line(wp, lnum, startrow, endrow, nochange) /* * Found last space before word: check for line break. */ - if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) + if (wp->w_p_lbr && c0 == c + && VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr)) { +# ifdef FEAT_MBYTE + int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0; +# endif char_u *p = ptr - ( # ifdef FEAT_MBYTE - has_mbyte ? mb_l : + mb_off + # endif 1); + /* TODO: is passing p for start of the line OK? */ n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; + if (c == TAB && n_extra + col > wp->w_width) + n_extra = (int)wp->w_buffer->b_p_ts + - vcol % (int)wp->w_buffer->b_p_ts - 1; + +# ifdef FEAT_MBYTE + c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' '; +# else c_extra = ' '; - if (vim_iswhite(c)) +# endif + if (VIM_ISWHITE(c)) { #ifdef FEAT_CONCEAL if (c == TAB) @@ -4454,18 +4778,48 @@ win_line(wp, lnum, startrow, endrow, nochange) } #endif + /* 'list': change char 160 to lcs_nbsp and space to lcs_space. + */ + if (wp->w_p_list + && (((c == 160 +#ifdef FEAT_MBYTE + || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)) +#endif + ) && lcs_nbsp) + || (c == ' ' && lcs_space && ptr - line <= trailcol))) + { + c = (c == ' ') ? lcs_space : lcs_nbsp; + if (area_attr == 0 && search_attr == 0) + { + n_attr = 1; + extra_attr = HL_ATTR(HLF_8); + saved_attr2 = char_attr; /* save current attr */ + } +#ifdef FEAT_MBYTE + mb_c = c; + if (enc_utf8 && utf_char2len(c) > 1) + { + mb_utf8 = TRUE; + u8cc[0] = 0; + c = 0xc0; + } + else + mb_utf8 = FALSE; +#endif + } + if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') { c = lcs_trail; if (!attr_pri) { n_attr = 1; - extra_attr = hl_attr(HLF_8); + extra_attr = HL_ATTR(HLF_8); saved_attr2 = char_attr; /* save current attr */ } #ifdef FEAT_MBYTE mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -4480,7 +4834,7 @@ win_line(wp, lnum, startrow, endrow, nochange) /* * Handling of non-printable characters. */ - if (!(chartab[c & 0xff] & CT_PRINT_CHAR)) + if (!vim_isprintc(c)) { /* * when getting a character from the file, we may have to @@ -4490,11 +4844,19 @@ win_line(wp, lnum, startrow, endrow, nochange) if (c == TAB && (!wp->w_p_list || lcs_tab1)) { int tab_len = 0; + long vcol_adjusted = vcol; /* removed showbreak length */ +#ifdef FEAT_LINEBREAK + /* only adjust the tab_len, when at the first column + * after the showbreak value was drawn */ + if (*p_sbr != NUL && vcol == vcol_sbr && wp->w_p_wrap) + vcol_adjusted = vcol - MB_CHARLEN(p_sbr); +#endif /* tab amount depends on current column */ tab_len = (int)wp->w_buffer->b_p_ts - - vcol % (int)wp->w_buffer->b_p_ts - 1; + - vcol_adjusted % (int)wp->w_buffer->b_p_ts - 1; + #ifdef FEAT_LINEBREAK - if (!wp->w_p_lbr) + if (!wp->w_p_lbr || !wp->w_p_list) #endif /* tab amount depends on current column */ n_extra = tab_len; @@ -4506,6 +4868,17 @@ win_line(wp, lnum, startrow, endrow, nochange) int i; int saved_nextra = n_extra; +#ifdef FEAT_CONCEAL + if (vcol_off > 0) + /* there are characters to conceal */ + tab_len += vcol_off; + /* boguscols before FIX_FOR_BOGUSCOLS macro from above + */ + if (wp->w_p_list && lcs_tab1 && old_boguscols > 0 + && n_extra > tab_len) + tab_len += n_extra - tab_len; +#endif + /* if n_extra > 0, it gives the number of chars, to * use for a tab, else we need to calculate the width * for a tab */ @@ -4518,6 +4891,7 @@ win_line(wp, lnum, startrow, endrow, nochange) p = alloc((unsigned)(len + 1)); vim_memset(p, ' ', len); p[len] = NUL; + vim_free(p_extra_free); p_extra_free = p; for (i = 0; i < tab_len; i++) { @@ -4531,16 +4905,33 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif } p_extra = p_extra_free; +#ifdef FEAT_CONCEAL + /* n_extra will be increased by FIX_FOX_BOGUSCOLS + * macro below, so need to adjust for that here */ + if (vcol_off > 0) + n_extra -= vcol_off; +#endif } #endif #ifdef FEAT_CONCEAL - /* Tab alignment should be identical regardless of - * 'conceallevel' value. So tab compensates of all - * previous concealed characters, and thus resets vcol_off - * and boguscols accumulated so far in the line. Note that - * the tab can be longer than 'tabstop' when there - * are concealed characters. */ - FIX_FOR_BOGUSCOLS; + { + int vc_saved = vcol_off; + + /* Tab alignment should be identical regardless of + * 'conceallevel' value. So tab compensates of all + * previous concealed characters, and thus resets + * vcol_off and boguscols accumulated so far in the + * line. Note that the tab can be longer than + * 'tabstop' when there are concealed characters. */ + FIX_FOR_BOGUSCOLS; + + /* Make sure, the highlighting for the tab char will be + * correctly set further below (effectively reverts the + * FIX_FOR_BOGSUCOLS macro */ + if (n_extra == tab_len + vc_saved && wp->w_p_list + && lcs_tab1) + tab_len += vc_saved; + } #endif #ifdef FEAT_MBYTE mb_utf8 = FALSE; /* don't draw as UTF-8 */ @@ -4555,11 +4946,11 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif c_extra = lcs_tab2; n_attr = tab_len + 1; - extra_attr = hl_attr(HLF_8); + extra_attr = HL_ATTR(HLF_8); saved_attr2 = char_attr; /* save current attr */ #ifdef FEAT_MBYTE mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -4574,7 +4965,7 @@ win_line(wp, lnum, startrow, endrow, nochange) } } else if (c == NUL - && ((wp->w_p_list && lcs_eol > 0) + && (wp->w_p_list || ((fromcol >= 0 || fromcol_prev >= 0) && tocol > vcol && VIsual_mode != Ctrl_V @@ -4582,11 +4973,11 @@ win_line(wp, lnum, startrow, endrow, nochange) # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col >= 0) : # endif - (col < W_WIDTH(wp))) + (col < wp->w_width)) && !(noinvcur && lnum == wp->w_cursor.lnum && (colnr_T)vcol == wp->w_virtcol))) - && lcs_eol_one >= 0) + && lcs_eol_one > 0) { /* Display a '$' after the line or highlight an extra * character if the line break is included. */ @@ -4620,7 +5011,7 @@ win_line(wp, lnum, startrow, endrow, nochange) c_extra = NUL; } } - if (wp->w_p_list) + if (wp->w_p_list && lcs_eol > 0) c = lcs_eol; else c = ' '; @@ -4628,12 +5019,12 @@ win_line(wp, lnum, startrow, endrow, nochange) --ptr; /* put it back at the NUL */ if (!attr_pri) { - extra_attr = hl_attr(HLF_AT); + extra_attr = HL_ATTR(HLF_AT); n_attr = 1; } #ifdef FEAT_MBYTE mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -4663,6 +5054,7 @@ win_line(wp, lnum, startrow, endrow, nochange) vim_memset(p, ' ', n_extra); STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); p[n_extra] = NUL; + vim_free(p_extra_free); p_extra_free = p_extra = p; } else @@ -4674,7 +5066,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (!attr_pri) { n_attr = n_extra + 1; - extra_attr = hl_attr(HLF_8); + extra_attr = HL_ATTR(HLF_8); saved_attr2 = char_attr; /* save current attr */ } #ifdef FEAT_MBYTE @@ -4692,7 +5084,7 @@ win_line(wp, lnum, startrow, endrow, nochange) # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col >= 0) : # endif - (col < W_WIDTH(wp)))) + (col < wp->w_width))) { c = ' '; --ptr; /* put it back at the NUL */ @@ -4702,6 +5094,9 @@ win_line(wp, lnum, startrow, endrow, nochange) else if (( # ifdef FEAT_DIFF diff_hlf != (hlf_T)0 || +# endif +# ifdef FEAT_TERMINAL + term_attr != 0 || # endif line_attr != 0 ) && ( @@ -4712,7 +5107,7 @@ win_line(wp, lnum, startrow, endrow, nochange) # ifdef FEAT_CONCEAL - boguscols # endif - < W_WIDTH(wp)))) + < wp->w_width))) { /* Highlight until the right side of the window */ c = ' '; @@ -4722,14 +5117,30 @@ win_line(wp, lnum, startrow, endrow, nochange) ++did_line_attr; /* don't do search HL for the rest of the line */ - if (line_attr != 0 && char_attr == search_attr && col > 0) + if (line_attr != 0 && char_attr == search_attr + && (did_line_attr > 1 + || (wp->w_p_list && lcs_eol > 0))) char_attr = line_attr; # ifdef FEAT_DIFF if (diff_hlf == HLF_TXD) { diff_hlf = HLF_CHD; if (attr == 0 || char_attr != attr) - char_attr = hl_attr(diff_hlf); + { + char_attr = HL_ATTR(diff_hlf); + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + char_attr = hl_combine_attr(char_attr, + HL_ATTR(HLF_CUL)); + } + } +# endif +# ifdef FEAT_TERMINAL + if (term_attr != 0) + { + char_attr = term_attr; + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + char_attr = hl_combine_attr(char_attr, + HL_ATTR(HLF_CUL)); } # endif } @@ -4739,19 +5150,22 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_CONCEAL if ( wp->w_p_cole > 0 && (wp != curwin || lnum != wp->w_cursor.lnum || - conceal_cursor_line(wp)) - && (syntax_flags & HL_CONCEAL) != 0 + conceal_cursor_line(wp) ) + && ( (syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0) && !(lnum_in_visual_area && vim_strchr(wp->w_p_cocu, 'v') == NULL)) { char_attr = conceal_attr; - if (prev_syntax_id != syntax_seqnr - && (syn_get_sub_char() != NUL || wp->w_p_cole == 1) + if ((prev_syntax_id != syntax_seqnr || has_match_conc > 1) + && (syn_get_sub_char() != NUL || match_conc + || wp->w_p_cole == 1) && wp->w_p_cole != 3) { /* First time at this concealed item: display one * character. */ - if (syn_get_sub_char() != NUL) + if (match_conc) + c = match_conc; + else if (syn_get_sub_char() != NUL) c = syn_get_sub_char(); else if (lcs_conceal != NUL) c = lcs_conceal; @@ -4788,7 +5202,7 @@ win_line(wp, lnum, startrow, endrow, nochange) } # ifdef FEAT_MBYTE mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -4814,7 +5228,12 @@ win_line(wp, lnum, startrow, endrow, nochange) && conceal_cursor_line(wp) && (int)wp->w_virtcol <= vcol + n_skip) { - wp->w_wcol = col - boguscols; +# ifdef FEAT_RIGHTLEFT + if (wp->w_p_rl) + wp->w_wcol = wp->w_width - col + boguscols - 1; + else +# endif + wp->w_wcol = col - boguscols; wp->w_wrow = row; did_wcol = TRUE; } @@ -4830,15 +5249,13 @@ win_line(wp, lnum, startrow, endrow, nochange) /* XIM don't send preedit_start and preedit_end, but they send * preedit_changed and commit. Thus Vim can't set "im_is_active", use * im_is_preediting() here. */ - if ( + if (p_imst == IM_ON_THE_SPOT # ifndef FEAT_GUI_MACVIM - xic != NULL && + && xic != NULL # endif - lnum == wp->w_cursor.lnum + && lnum == wp->w_cursor.lnum && (State & INSERT) -# ifndef FEAT_GUI_MACVIM && !p_imdisable -# endif && im_is_preediting() && draw_state == WL_LINE) { @@ -4874,6 +5291,7 @@ win_line(wp, lnum, startrow, endrow, nochange) * special character (via 'listchars' option "precedes:<char>". */ if (lcs_prec_todo != NUL + && wp->w_p_list && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0) #ifdef FEAT_DIFF && filler_todo <= 0 @@ -4891,10 +5309,10 @@ win_line(wp, lnum, startrow, endrow, nochange) c_extra = MB_FILLER_CHAR; n_extra = 1; n_attr = 2; - extra_attr = hl_attr(HLF_AT); + extra_attr = HL_ATTR(HLF_AT); } mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -4906,7 +5324,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (!attr_pri) { saved_attr3 = char_attr; /* save current attr */ - char_attr = hl_attr(HLF_AT); /* later copied to char_attr */ + char_attr = HL_ATTR(HLF_AT); /* later copied to char_attr */ n_attr3 = 1; } } @@ -4934,14 +5352,14 @@ win_line(wp, lnum, startrow, endrow, nochange) * needed when a '$' was displayed for 'list'. */ #ifdef FEAT_SEARCH_EXTRA prevcol_hl_flag = FALSE; - if (prevcol == (long)search_hl.startcol) + if (!search_hl.is_addpos && prevcol == (long)search_hl.startcol) prevcol_hl_flag = TRUE; else { cur = wp->w_match_head; while (cur != NULL) { - if (prevcol == (long)cur->hl.startcol) + if (!cur->hl.is_addpos && prevcol == (long)cur->hl.startcol) { prevcol_hl_flag = TRUE; break; @@ -4959,6 +5377,13 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_SEARCH_EXTRA /* highlight 'hlsearch' match at end of line */ || (prevcol_hl_flag == TRUE +# ifdef FEAT_SYN_HL + && !(wp->w_p_cul && lnum == wp->w_cursor.lnum + && !(wp == curwin && VIsual_active)) +# endif +# ifdef FEAT_DIFF + && diff_hlf == (hlf_T)0 +# endif # if defined(LINE_ATTR) && did_line_attr <= 1 # endif @@ -4977,7 +5402,7 @@ win_line(wp, lnum, startrow, endrow, nochange) else #endif { - if (col >= W_WIDTH(wp)) + if (col >= wp->w_width) n = -1; } if (n != 0) @@ -5016,7 +5441,8 @@ win_line(wp, lnum, startrow, endrow, nochange) } else shl = &cur->hl; - if ((ptr - line) - 1 == (long)shl->startcol) + if ((ptr - line) - 1 == (long)shl->startcol + && (shl == &search_hl || !shl->is_addpos)) char_attr = shl->attr; if (shl != &search_hl && cur != NULL) cur = cur->next; @@ -5080,7 +5506,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (((wp->w_p_cuc && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off && (int)wp->w_virtcol < - W_WIDTH(wp) * (row - startrow + 1) + v + wp->w_width * (row - startrow + 1) + v && lnum != wp->w_cursor.lnum) || draw_color_col) # ifdef FEAT_RIGHTLEFT @@ -5099,7 +5525,7 @@ win_line(wp, lnum, startrow, endrow, nochange) if (rightmost_vcol < color_cols[i]) rightmost_vcol = color_cols[i]; - while (col < W_WIDTH(wp)) + while (col < wp->w_width) { ScreenLines[off] = ' '; #ifdef FEAT_MBYTE @@ -5112,9 +5538,9 @@ win_line(wp, lnum, startrow, endrow, nochange) &color_cols); if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol) - ScreenAttrs[off++] = hl_attr(HLF_CUC); + ScreenAttrs[off++] = HL_ATTR(HLF_CUC); else if (draw_color_col && VCOL_HLC == *color_cols) - ScreenAttrs[off++] = hl_attr(HLF_MC); + ScreenAttrs[off++] = HL_ATTR(HLF_MC); else ScreenAttrs[off++] = 0; @@ -5126,8 +5552,8 @@ win_line(wp, lnum, startrow, endrow, nochange) } #endif - SCREEN_LINE(screen_row, W_WINCOL(wp), col, - (int)W_WIDTH(wp), wp->w_p_rl); + screen_line(screen_row, wp->w_wincol, col, + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); row++; /* @@ -5157,16 +5583,16 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_RIGHTLEFT wp->w_p_rl ? col == 0 : #endif - col == W_WIDTH(wp) - 1) + col == wp->w_width - 1) && (*ptr != NUL || (wp->w_p_list && lcs_eol_one > 0) || (n_extra && (c_extra != NUL || *p_extra != NUL)))) { c = lcs_ext; - char_attr = hl_attr(HLF_AT); + char_attr = HL_ATTR(HLF_AT); #ifdef FEAT_MBYTE mb_c = c; - if (enc_utf8 && (*mb_char2len)(c) > 1) + if (enc_utf8 && utf_char2len(c) > 1) { mb_utf8 = TRUE; u8cc[0] = 0; @@ -5187,18 +5613,19 @@ win_line(wp, lnum, startrow, endrow, nochange) * Also highlight the 'colorcolumn' if it is different than * 'cursorcolumn' */ vcol_save_attr = -1; - if (draw_state == WL_LINE && !lnum_in_visual_area) + if (draw_state == WL_LINE && !lnum_in_visual_area + && search_attr == 0 && area_attr == 0) { if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol && lnum != wp->w_cursor.lnum) { vcol_save_attr = char_attr; - char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC)); + char_attr = hl_combine_attr(char_attr, HL_ATTR(HLF_CUC)); } else if (draw_color_col && VCOL_HLC == *color_cols) { vcol_save_attr = char_attr; - char_attr = hl_combine_attr(char_attr, hl_attr(HLF_MC)); + char_attr = hl_combine_attr(char_attr, HL_ATTR(HLF_MC)); } } #endif @@ -5269,7 +5696,12 @@ win_line(wp, lnum, startrow, endrow, nochange) else /* DBCS: Put second byte in the second screen char. */ ScreenLines[off] = mb_c & 0xff; - ++vcol; + if (draw_state > WL_NR +#ifdef FEAT_DIFF + && filler_todo <= 0 +#endif + ) + ++vcol; /* When "tocol" is halfway a character, set it to the end of * the character, otherwise highlighting won't stop. */ if (tocol == vcol) @@ -5416,7 +5848,7 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col < 0) : #endif - (col >= W_WIDTH(wp))) + (col >= wp->w_width)) && (*ptr != NUL #ifdef FEAT_DIFF || filler_todo > 0 @@ -5426,12 +5858,12 @@ win_line(wp, lnum, startrow, endrow, nochange) ) { #ifdef FEAT_CONCEAL - SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols, - (int)W_WIDTH(wp), wp->w_p_rl); + screen_line(screen_row, wp->w_wincol, col - boguscols, + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); boguscols = 0; #else - SCREEN_LINE(screen_row, W_WINCOL(wp), col, - (int)W_WIDTH(wp), wp->w_p_rl); + screen_line(screen_row, wp->w_wincol, col, + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); #endif ++row; ++screen_row; @@ -5453,9 +5885,7 @@ win_line(wp, lnum, startrow, endrow, nochange) ) { win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT); -#ifdef FEAT_VERTSPLIT draw_vsep_win(wp, row); -#endif row = endrow; } @@ -5470,7 +5900,7 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_DIFF && filler_todo <= 0 #endif - && W_WIDTH(wp) == Columns) + && wp->w_width == Columns) { /* Remember that the line wraps, used for modeless copy. */ LineWraps[screen_row - 1] = TRUE; @@ -5507,7 +5937,7 @@ win_line(wp, lnum, startrow, endrow, nochange) * then output the same character again to let the * terminal know about the wrap. If the terminal doesn't * auto-wrap, we overwrite the character. */ - if (screen_cur_col != W_WIDTH(wp)) + if (screen_cur_col != wp->w_width) screen_char(LineOffset[screen_row - 1] + (unsigned)Columns - 1, screen_row - 1, (int)(Columns - 1)); @@ -5533,7 +5963,7 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) { - col = W_WIDTH(wp) - 1; /* col is not used if breaking! */ + col = wp->w_width - 1; /* col is not used if breaking! */ off += col; } #endif @@ -5572,20 +6002,19 @@ win_line(wp, lnum, startrow, endrow, nochange) } #endif + vim_free(p_extra_free); return row; } #ifdef FEAT_MBYTE -static int comp_char_differs __ARGS((int, int)); +static int comp_char_differs(int, int); /* * Return if the composing characters at "off_from" and "off_to" differ. * Only to be used when ScreenLinesUC[off_from] != 0. */ static int -comp_char_differs(off_from, off_to) - int off_from; - int off_to; +comp_char_differs(int off_from, int off_to) { int i; @@ -5608,10 +6037,7 @@ comp_char_differs(off_from, off_to) * - the character is two cells wide and the second cell differs. */ static int -char_needs_redraw(off_from, off_to, cols) - int off_from; - int off_to; - int cols; +char_needs_redraw(int off_from, int off_to, int cols) { if (cols > 0 && ((ScreenLines[off_from] != ScreenLines[off_to] @@ -5637,6 +6063,17 @@ char_needs_redraw(off_from, off_to, cols) return FALSE; } +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * Return the index in ScreenLines[] for the current screen line. + */ + int +screen_get_current_line_off() +{ + return (int)(current_ScreenLine - ScreenLines); +} +#endif + /* * Move one "cooked" screen line to the screen, but only the characters that * have actually changed. Handle insert/delete character. @@ -5648,19 +6085,13 @@ char_needs_redraw(off_from, off_to, cols) * When TRUE and "clear_width" > 0, clear columns 0 to "endcol" * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width" */ - static void -screen_line(row, coloff, endcol, clear_width -#ifdef FEAT_RIGHTLEFT - , rlflag -#endif - ) - int row; - int coloff; - int endcol; - int clear_width; -#ifdef FEAT_RIGHTLEFT - int rlflag; -#endif + void +screen_line( + int row, + int coloff, + int endcol, + int clear_width, + int rlflag UNUSED) { unsigned off_from; unsigned off_to; @@ -5669,9 +6100,7 @@ screen_line(row, coloff, endcol, clear_width unsigned max_off_to; #endif int col = 0; -#if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT) int hl; -#endif int force = FALSE; /* force update rest of the line */ int redraw_this /* bool: does character need redraw? */ #ifdef FEAT_GUI @@ -5757,9 +6186,11 @@ screen_line(row, coloff, endcol, clear_width hl = ScreenAttrs[off_to + CHAR_CELLS]; if (hl > HL_ALL) hl = syn_attr2attr(hl); -# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ - if (hl & HL_BOLD) + if ((hl & HL_BOLD) +# ifdef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ + || gui.in_use # endif + ) redraw_this = TRUE; } #endif @@ -5890,9 +6321,11 @@ screen_line(row, coloff, endcol, clear_width hl = ScreenAttrs[off_to]; if (hl > HL_ALL) hl = syn_attr2attr(hl); -# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ - if (hl & HL_BOLD) + if ((hl & HL_BOLD) +# ifdef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ + || gui.in_use # endif + ) redraw_next = TRUE; } #endif @@ -5978,9 +6411,11 @@ screen_line(row, coloff, endcol, clear_width if (gui.in_use && (col > startCol || !redraw_this)) { hl = ScreenAttrs[off_to]; -# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ - if (hl > HL_ALL || (hl & HL_BOLD)) + if (hl > HL_ALL || (hl & HL_BOLD) +# ifdef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ + || gui.in_use # endif + ) { int prev_cells = 1; # ifdef FEAT_MBYTE @@ -6014,32 +6449,29 @@ screen_line(row, coloff, endcol, clear_width #endif screen_fill(row, row + 1, col + coloff, clear_width + coloff, ' ', ' ', 0); -#ifdef FEAT_VERTSPLIT off_to += clear_width - col; col = clear_width; -#endif } } if (clear_width > 0) { -#ifdef FEAT_VERTSPLIT /* For a window that's left of another, draw the separator char. */ if (col + coloff < Columns) { int c; c = fillchar_vsep(&hl); - if (ScreenLines[off_to] != c -# ifdef FEAT_MBYTE + if (ScreenLines[off_to] != (schar_T)c +#ifdef FEAT_MBYTE || (enc_utf8 && (int)ScreenLinesUC[off_to] != (c >= 0x80 ? c : 0)) -# endif +#endif || ScreenAttrs[off_to] != hl) { ScreenLines[off_to] = c; ScreenAttrs[off_to] = hl; -# ifdef FEAT_MBYTE +#ifdef FEAT_MBYTE if (enc_utf8) { if (c >= 0x80) @@ -6050,12 +6482,11 @@ screen_line(row, coloff, endcol, clear_width else ScreenLinesUC[off_to] = 0; } -# endif +#endif screen_char(off_to, row, col + coloff); } } else -#endif LineWraps[row] = FALSE; } } @@ -6066,8 +6497,7 @@ screen_line(row, coloff, endcol, clear_width * Only works for single-byte characters (e.g., numbers). */ void -rl_mirror(str) - char_u *str; +rl_mirror(char_u *str) { char_u *p1, *p2; int t; @@ -6081,16 +6511,15 @@ rl_mirror(str) } #endif -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * mark all status lines for redraw; used after first :cd */ void -status_redraw_all() +status_redraw_all(void) { win_T *wp; - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_status_height) { wp->w_redr_status = TRUE; @@ -6102,11 +6531,11 @@ status_redraw_all() * mark all status lines of the current buffer for redraw */ void -status_redraw_curbuf() +status_redraw_curbuf(void) { win_T *wp; - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_status_height != 0 && wp->w_buffer == curbuf) { wp->w_redr_status = TRUE; @@ -6118,25 +6547,23 @@ status_redraw_curbuf() * Redraw all status lines that need to be redrawn. */ void -redraw_statuslines() +redraw_statuslines(void) { win_T *wp; - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_redr_status) - win_redr_status(wp); + win_redr_status(wp, FALSE); if (redraw_tabline) draw_tabline(); } -#endif -#if (defined(FEAT_WILDMENU) && defined(FEAT_VERTSPLIT)) || defined(PROTO) +#if defined(FEAT_WILDMENU) || defined(PROTO) /* * Redraw all status lines at the bottom of frame "frp". */ void -win_redraw_last_status(frp) - frame_T *frp; +win_redraw_last_status(frame_T *frp) { if (frp->fr_layout == FR_LEAF) frp->fr_win->w_redr_status = TRUE; @@ -6155,14 +6582,11 @@ win_redraw_last_status(frp) } #endif -#ifdef FEAT_VERTSPLIT /* * Draw the verticap separator right of window "wp" starting with line "row". */ static void -draw_vsep_win(wp, row) - win_T *wp; - int row; +draw_vsep_win(win_T *wp, int row) { int hl; int c; @@ -6176,19 +6600,16 @@ draw_vsep_win(wp, row) c, ' ', hl); } } -#endif #ifdef FEAT_WILDMENU -static int status_match_len __ARGS((expand_T *xp, char_u *s)); -static int skip_status_match_char __ARGS((expand_T *xp, char_u *s)); +static int status_match_len(expand_T *xp, char_u *s); +static int skip_status_match_char(expand_T *xp, char_u *s); /* * Get the length of an item as it will be shown in the status line. */ static int -status_match_len(xp, s) - expand_T *xp; - char_u *s; +status_match_len(expand_T *xp, char_u *s) { int len = 0; @@ -6205,7 +6626,7 @@ status_match_len(xp, s) { s += skip_status_match_char(xp, s); len += ptr2cells(s); - mb_ptr_adv(s); + MB_PTR_ADV(s); } return len; @@ -6216,9 +6637,7 @@ status_match_len(xp, s) * These are backslashes used for escaping. Do show backslashes in help tags. */ static int -skip_status_match_char(xp, s) - expand_T *xp; - char_u *s; +skip_status_match_char(expand_T *xp, char_u *s) { if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP) #ifdef FEAT_MENU @@ -6245,12 +6664,12 @@ skip_status_match_char(xp, s) * If inversion is possible we use it. Else '=' characters are used. */ void -win_redr_status_matches(xp, num_matches, matches, match, showtail) - expand_T *xp; - int num_matches; - char_u **matches; /* list of matches */ - int match; - int showtail; +win_redr_status_matches( + expand_T *xp, + int num_matches, + char_u **matches, /* list of matches */ + int match, + int showtail) { #define L_MATCH(m) (showtail ? sm_gettail(matches[m]) : matches[m]) int row; @@ -6333,7 +6752,7 @@ win_redr_status_matches(xp, num_matches, matches, match, showtail) --first_match; } - fillchar = fillchar_status(&attr, TRUE); + fillchar = fillchar_status(&attr, curwin); if (first_match == 0) { @@ -6417,7 +6836,7 @@ win_redr_status_matches(xp, num_matches, matches, match, showtail) * no room, scroll the screen one line up. */ if (cmdline_row == Rows - 1) { - screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL); + screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL); ++msg_scrolled; } else @@ -6448,30 +6867,26 @@ win_redr_status_matches(xp, num_matches, matches, match, showtail) if (selstart != NULL && highlight) { *selend = NUL; - screen_puts(selstart, row, selstart_col, hl_attr(HLF_WM)); + screen_puts(selstart, row, selstart_col, HL_ATTR(HLF_WM)); } screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr); } -#ifdef FEAT_VERTSPLIT win_redraw_last_status(topframe); -#else - lastwin->w_redr_status = TRUE; -#endif vim_free(buf); } #endif -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Redraw the status line of window wp. * * If inversion is possible we use it. Else '=' characters are used. + * If "ignore_pum" is TRUE, also redraw statusline when the popup menu is + * displayed. */ - void -win_redr_status(wp) - win_T *wp; + static void +win_redr_status(win_T *wp, int ignore_pum) { int row; char_u *p; @@ -6495,9 +6910,9 @@ win_redr_status(wp) } else if (!redrawing() #ifdef FEAT_INS_EXPAND - /* don't update status line when popup menu is visible and may be - * drawn over it */ - || pum_visible() + // don't update status line when popup menu is visible and may be + // drawn over it, unless it will be redrawn later + || (!ignore_pum && pum_visible()) #endif ) { @@ -6513,20 +6928,20 @@ win_redr_status(wp) #endif else { - fillchar = fillchar_status(&attr, wp == curwin); + fillchar = fillchar_status(&attr, wp); get_trans_bufname(wp->w_buffer); p = NameBuff; len = (int)STRLEN(p); - if (wp->w_buffer->b_help + if (bt_help(wp->w_buffer) #ifdef FEAT_QUICKFIX || wp->w_p_pvw #endif || bufIsChanged(wp->w_buffer) || wp->w_buffer->b_p_ro) *(p + len++) = ' '; - if (wp->w_buffer->b_help) + if (bt_help(wp->w_buffer)) { STRCPY(p + len, _("[Help]")); len += (int)STRLEN(p + len); @@ -6538,7 +6953,11 @@ win_redr_status(wp) len += (int)STRLEN(p + len); } #endif - if (bufIsChanged(wp->w_buffer)) + if (bufIsChanged(wp->w_buffer) +#ifdef FEAT_TERMINAL + && !bt_terminal(wp->w_buffer) +#endif + ) { STRCPY(p + len, "[+]"); len += 3; @@ -6546,24 +6965,18 @@ win_redr_status(wp) if (wp->w_buffer->b_p_ro) { STRCPY(p + len, _("[RO]")); - len += 4; + len += (int)STRLEN(p + len); } -#ifndef FEAT_VERTSPLIT - this_ru_col = ru_col; - if (this_ru_col < (Columns + 1) / 2) - this_ru_col = (Columns + 1) / 2; -#else - this_ru_col = ru_col - (Columns - W_WIDTH(wp)); - if (this_ru_col < (W_WIDTH(wp) + 1) / 2) - this_ru_col = (W_WIDTH(wp) + 1) / 2; + this_ru_col = ru_col - (Columns - wp->w_width); + if (this_ru_col < (wp->w_width + 1) / 2) + this_ru_col = (wp->w_width + 1) / 2; if (this_ru_col <= 1) { p = (char_u *)"<"; /* No room for file name! */ len = 1; } else -#endif #ifdef FEAT_MBYTE if (has_mbyte) { @@ -6596,34 +7009,32 @@ win_redr_status(wp) } row = W_WINROW(wp) + wp->w_height; - screen_puts(p, row, W_WINCOL(wp), attr); - screen_fill(row, row + 1, len + W_WINCOL(wp), - this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr); + screen_puts(p, row, wp->w_wincol, attr); + screen_fill(row, row + 1, len + wp->w_wincol, + this_ru_col + wp->w_wincol, fillchar, fillchar, attr); - if (get_keymap_str(wp, NameBuff, MAXPATHL) + if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL) && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1)) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) - - 1 + W_WINCOL(wp)), attr); + - 1 + wp->w_wincol), attr); #ifdef FEAT_CMDL_INFO - win_redr_ruler(wp, TRUE); + win_redr_ruler(wp, TRUE, ignore_pum); #endif } -#ifdef FEAT_VERTSPLIT /* * May need to draw the character below the vertical separator. */ if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing()) { if (stl_connected(wp)) - fillchar = fillchar_status(&attr, wp == curwin); + fillchar = fillchar_status(&attr, wp); else fillchar = fillchar_vsep(&attr); screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp), attr); } -#endif busy = FALSE; } @@ -6633,11 +7044,10 @@ win_redr_status(wp) * errors encountered. */ static void -redraw_custom_statusline(wp) - win_T *wp; +redraw_custom_statusline(win_T *wp) { static int entered = FALSE; - int save_called_emsg = called_emsg; + int saved_did_emsg = did_emsg; /* When called recursively return. This can happen when the statusline * contains an expression that triggers a redraw. */ @@ -6645,9 +7055,9 @@ redraw_custom_statusline(wp) return; entered = TRUE; - called_emsg = FALSE; + did_emsg = FALSE; win_redr_custom(wp, FALSE); - if (called_emsg) + if (did_emsg) { /* When there is an error disable the statusline, otherwise the * display is messed up with errors and a redraw triggers the problem @@ -6656,20 +7066,18 @@ redraw_custom_statusline(wp) (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR); } - called_emsg |= save_called_emsg; + did_emsg |= saved_did_emsg; entered = FALSE; } #endif -# ifdef FEAT_VERTSPLIT /* * Return TRUE if the status line of window "wp" is connected to the status * line of the window right of it. If not, then it's a vertical separator. * Only call if (wp->w_vsep_width != 0). */ int -stl_connected(wp) - win_T *wp; +stl_connected(win_T *wp) { frame_T *fr; @@ -6690,19 +7098,17 @@ stl_connected(wp) } return FALSE; } -# endif -#endif /* FEAT_WINDOWS */ -#if defined(FEAT_WINDOWS) || defined(FEAT_STL_OPT) || defined(PROTO) /* * Get the value to show for the language mappings, active 'keymap'. */ int -get_keymap_str(wp, buf, len) - win_T *wp; - char_u *buf; /* buffer for the result */ - int len; /* length of buffer */ +get_keymap_str( + win_T *wp, + char_u *fmt, /* format string containing one %s item */ + char_u *buf, /* buffer for the result */ + int len) /* length of buffer */ { char_u *p; @@ -6733,9 +7139,7 @@ get_keymap_str(wp, buf, len) #endif p = (char_u *)"lang"; } - if ((int)(STRLEN(p) + 3) < len) - sprintf((char *)buf, "<%s>", p); - else + if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1) buf[0] = NUL; #ifdef FEAT_EVAL vim_free(s); @@ -6743,7 +7147,6 @@ get_keymap_str(wp, buf, len) } return buf[0] != NUL; } -#endif #if defined(FEAT_STL_OPT) || defined(PROTO) /* @@ -6751,9 +7154,9 @@ get_keymap_str(wp, buf, len) * When "wp" is NULL redraw the tab pages line from 'tabline'. */ static void -win_redr_custom(wp, draw_ruler) - win_T *wp; - int draw_ruler; /* TRUE or FALSE */ +win_redr_custom( + win_T *wp, + int draw_ruler) /* TRUE or FALSE */ { static int entered = FALSE; int attr; @@ -6788,7 +7191,7 @@ win_redr_custom(wp, draw_ruler) stl = p_tal; row = 0; fillchar = ' '; - attr = hl_attr(HLF_TPF); + attr = HL_ATTR(HLF_TPF); maxwidth = Columns; # ifdef FEAT_EVAL use_sandbox = was_set_insecurely((char_u *)"tabline", 0); @@ -6797,8 +7200,8 @@ win_redr_custom(wp, draw_ruler) else { row = W_WINROW(wp) + wp->w_height; - fillchar = fillchar_status(&attr, wp == curwin); - maxwidth = W_WIDTH(wp); + fillchar = fillchar_status(&attr, wp); + maxwidth = wp->w_width; if (draw_ruler) { @@ -6814,19 +7217,11 @@ win_redr_custom(wp, draw_ruler) if (*stl++ != '(') stl = p_ruf; } -#ifdef FEAT_VERTSPLIT - col = ru_col - (Columns - W_WIDTH(wp)); - if (col < (W_WIDTH(wp) + 1) / 2) - col = (W_WIDTH(wp) + 1) / 2; -#else - col = ru_col; - if (col > (Columns + 1) / 2) - col = (Columns + 1) / 2; -#endif - maxwidth = W_WIDTH(wp) - col; -#ifdef FEAT_WINDOWS + col = ru_col - (Columns - wp->w_width); + if (col < (wp->w_width + 1) / 2) + col = (wp->w_width + 1) / 2; + maxwidth = wp->w_width - col; if (!wp->w_status_height) -#endif { row = Rows - 1; --maxwidth; /* writing in last column may cause scrolling */ @@ -6850,9 +7245,7 @@ win_redr_custom(wp, draw_ruler) # endif } -#ifdef FEAT_VERTSPLIT - col += W_WINCOL(wp); -#endif + col += wp->w_wincol; } if (maxwidth <= 0) @@ -6910,10 +7303,16 @@ win_redr_custom(wp, draw_ruler) curattr = attr; else if (hltab[n].userhl < 0) curattr = syn_id2attr(-hltab[n].userhl); -#ifdef FEAT_WINDOWS +#ifdef FEAT_TERMINAL + else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer) + && wp->w_status_height != 0) + curattr = highlight_stltermnc[hltab[n].userhl - 1]; + else if (wp != NULL && bt_terminal(wp->w_buffer) + && wp->w_status_height != 0) + curattr = highlight_stlterm[hltab[n].userhl - 1]; +#endif else if (wp != NULL && wp != curwin && wp->w_status_height != 0) curattr = highlight_stlnc[hltab[n].userhl - 1]; -#endif else curattr = highlight_user[hltab[n].userhl - 1]; } @@ -6948,10 +7347,7 @@ win_redr_custom(wp, draw_ruler) * Output a single character directly to the screen and update ScreenLines. */ void -screen_putchar(c, row, col, attr) - int c; - int row, col; - int attr; +screen_putchar(int c, int row, int col, int attr) { char_u buf[MB_MAXBYTES + 1]; @@ -6972,10 +7368,7 @@ screen_putchar(c, row, col, attr) * Also return its attribute in *attrp; */ void -screen_getbytes(row, col, bytes, attrp) - int row, col; - char_u *bytes; - int *attrp; +screen_getbytes(int row, int col, char_u *bytes, int *attrp) { unsigned off; @@ -7006,7 +7399,7 @@ screen_getbytes(row, col, bytes, attrp) } #ifdef FEAT_MBYTE -static int screen_comp_differs __ARGS((int, int*)); +static int screen_comp_differs(int, int*); /* * Return TRUE if composing characters for screen posn "off" differs from @@ -7014,9 +7407,7 @@ static int screen_comp_differs __ARGS((int, int*)); * Only to be used when ScreenLinesUC[off] != 0. */ static int -screen_comp_differs(off, u8cc) - int off; - int *u8cc; +screen_comp_differs(int off, int *u8cc) { int i; @@ -7038,11 +7429,11 @@ screen_comp_differs(off, u8cc) * Note: if ScreenLines[], row and/or col is invalid, nothing is done. */ void -screen_puts(text, row, col, attr) - char_u *text; - int row; - int col; - int attr; +screen_puts( + char_u *text, + int row, + int col, + int attr) { screen_puts_len(text, -1, row, col, attr); } @@ -7052,12 +7443,12 @@ screen_puts(text, row, col, attr) * a NUL. */ void -screen_puts_len(text, textlen, row, col, attr) - char_u *text; - int textlen; - int row; - int col; - int attr; +screen_puts_len( + char_u *text, + int textlen, + int row, + int col, + int attr) { unsigned off; char_u *ptr = text; @@ -7143,7 +7534,7 @@ screen_puts_len(text, textlen, row, col, attr) { u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?'; if (attr == 0) - attr = hl_attr(HLF_8); + attr = HL_ATTR(HLF_8); } # endif # ifdef FEAT_ARABIC @@ -7228,9 +7619,11 @@ screen_puts_len(text, textlen, row, col, attr) if (n > HL_ALL) n = syn_attr2attr(n); -# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ - if (n & HL_BOLD) + if ((n & HL_BOLD) +# ifdef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ + || gui.in_use # endif + ) force_redraw_next = TRUE; } #endif @@ -7343,12 +7736,12 @@ screen_puts_len(text, textlen, row, col, attr) * Prepare for 'hlsearch' highlighting. */ static void -start_search_hl() +start_search_hl(void) { if (p_hls && !no_hlsearch) { last_pat_prog(&search_hl.rm); - search_hl.attr = hl_attr(HLF_L); + search_hl.attr = HL_ATTR(HLF_L); # ifdef FEAT_RELTIME /* Set the time limit to 'redrawtime'. */ profile_setlimit(p_rdt, &search_hl.tm); @@ -7360,7 +7753,7 @@ start_search_hl() * Clean up for 'hlsearch' highlighting. */ static void -end_search_hl() +end_search_hl(void) { if (search_hl.rm.regprog != NULL) { @@ -7373,8 +7766,7 @@ end_search_hl() * Init for calling prepare_search_hl(). */ static void -init_search_hl(wp) - win_T *wp; +init_search_hl(win_T *wp) { matchitem_T *cur; @@ -7407,9 +7799,7 @@ init_search_hl(wp) * Advance to the match in window "wp" line "lnum" or past it. */ static void -prepare_search_hl(wp, lnum) - win_T *wp; - linenr_T lnum; +prepare_search_hl(win_T *wp, linenr_T lnum) { matchitem_T *cur; /* points to the match list */ match_T *shl; /* points to search_hl or a match */ @@ -7458,7 +7848,8 @@ prepare_search_hl(wp, lnum) while (shl->first_lnum < lnum && (shl->rm.regprog != NULL || (cur != NULL && pos_inprogress))) { - next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, cur); + next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, + shl == &search_hl ? NULL : cur); pos_inprogress = cur == NULL || cur->pos.cur == 0 ? FALSE : TRUE; if (shl->lnum != 0) @@ -7489,12 +7880,12 @@ prepare_search_hl(wp, lnum) * Careful: Any pointers for buffer lines will become invalid. */ static void -next_search_hl(win, shl, lnum, mincol, cur) - win_T *win; - match_T *shl; /* points to search_hl or a match */ - linenr_T lnum; - colnr_T mincol; /* minimal column for a match */ - matchitem_T *cur; /* to retrieve match positions if any */ +next_search_hl( + win_T *win, + match_T *shl, /* points to search_hl or a match */ + linenr_T lnum, + colnr_T mincol, /* minimal column for a match */ + matchitem_T *cur) /* to retrieve match positions if any */ { linenr_T l; colnr_T matchcol; @@ -7564,22 +7955,33 @@ next_search_hl(win, shl, lnum, mincol, cur) shl->lnum = lnum; if (shl->rm.regprog != NULL) { + /* Remember whether shl->rm is using a copy of the regprog in + * cur->match. */ + int regprog_is_copy = (shl != &search_hl && cur != NULL + && shl == &cur->hl + && cur->match.regprog == cur->hl.rm.regprog); + int timed_out = FALSE; + nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, #ifdef FEAT_RELTIME - &(shl->tm) + &(shl->tm), &timed_out #else - NULL + NULL, NULL #endif ); - if (called_emsg || got_int) + /* Copy the regprog, in case it got freed and recompiled. */ + if (regprog_is_copy) + cur->match.regprog = cur->hl.rm.regprog; + + if (called_emsg || got_int || timed_out) { /* Error while handling regexp: stop using this regexp. */ if (shl == &search_hl) { /* don't free regprog in the match list, it's a copy */ vim_regfree(shl->rm.regprog); - SET_NO_HLSEARCH(TRUE); + set_no_hlsearch(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; @@ -7608,66 +8010,69 @@ next_search_hl(win, shl, lnum, mincol, cur) } } +/* + * If there is a match fill "shl" and return one. + * Return zero otherwise. + */ static int -next_search_hl_pos(shl, lnum, posmatch, mincol) - match_T *shl; /* points to a match */ - linenr_T lnum; - posmatch_T *posmatch; /* match positions */ - colnr_T mincol; /* minimal column for a match */ +next_search_hl_pos( + match_T *shl, /* points to a match */ + linenr_T lnum, + posmatch_T *posmatch, /* match positions */ + colnr_T mincol) /* minimal column for a match */ { int i; - int bot = -1; + int found = -1; - shl->lnum = 0; for (i = posmatch->cur; i < MAXPOSMATCH; i++) { - if (posmatch->pos[i].lnum == 0) + llpos_T *pos = &posmatch->pos[i]; + + if (pos->lnum == 0) break; - if (posmatch->pos[i].col < mincol) + if (pos->len == 0 && pos->col < mincol) continue; - if (posmatch->pos[i].lnum == lnum) + if (pos->lnum == lnum) { - if (shl->lnum == lnum) + if (found >= 0) { - /* partially sort positions by column numbers - * on the same line */ - if (posmatch->pos[i].col < posmatch->pos[bot].col) + /* if this match comes before the one at "found" then swap + * them */ + if (pos->col < posmatch->pos[found].col) { - llpos_T tmp = posmatch->pos[i]; + llpos_T tmp = *pos; - posmatch->pos[i] = posmatch->pos[bot]; - posmatch->pos[bot] = tmp; + *pos = posmatch->pos[found]; + posmatch->pos[found] = tmp; } } else - { - bot = i; - shl->lnum = lnum; - } + found = i; } } posmatch->cur = 0; - if (shl->lnum == lnum) + if (found >= 0) { - colnr_T start = posmatch->pos[bot].col == 0 - ? 0 : posmatch->pos[bot].col - 1; - colnr_T end = posmatch->pos[bot].col == 0 - ? MAXCOL : start + posmatch->pos[bot].len; + colnr_T start = posmatch->pos[found].col == 0 + ? 0 : posmatch->pos[found].col - 1; + colnr_T end = posmatch->pos[found].col == 0 + ? MAXCOL : start + posmatch->pos[found].len; + shl->lnum = lnum; shl->rm.startpos[0].lnum = 0; shl->rm.startpos[0].col = start; shl->rm.endpos[0].lnum = 0; shl->rm.endpos[0].col = end; - posmatch->cur = bot + 1; - return TRUE; + shl->is_addpos = TRUE; + posmatch->cur = found + 1; + return 1; } - return FALSE; + return 0; } #endif static void -screen_start_highlight(attr) - int attr; +screen_start_highlight(int attr) { attrentry_T *aep = NULL; @@ -7692,7 +8097,7 @@ screen_start_highlight(attr) { if (attr > HL_ALL) /* special HL attr. */ { - if (t_colors > 1) + if (IS_CTERM) aep = syn_cterm_attr2entry(attr); else aep = syn_term_attr2entry(attr); @@ -7701,22 +8106,32 @@ screen_start_highlight(attr) else attr = aep->ae_attr; } - if ((attr & HL_BOLD) && T_MD != NULL) /* bold */ + if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */ out_str(T_MD); - else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color - && cterm_normal_fg_bold) + else if (aep != NULL && cterm_normal_fg_bold && ( +#ifdef FEAT_TERMGUICOLORS + p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.fg_rgb != INVALCOLOR + : +#endif + t_colors > 1 && aep->ae_u.cterm.fg_color)) /* If the Normal FG color has BOLD attribute and the new HL * has a FG color defined, clear BOLD. */ out_str(T_ME); - if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */ + if ((attr & HL_STANDOUT) && *T_SO != NUL) /* standout */ out_str(T_SO); - if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL) - /* underline or undercurl */ + if ((attr & HL_UNDERCURL) && *T_UCS != NUL) /* undercurl */ + out_str(T_UCS); + if (((attr & HL_UNDERLINE) /* underline or undercurl */ + || ((attr & HL_UNDERCURL) && *T_UCS == NUL)) + && *T_US != NUL) out_str(T_US); - if ((attr & HL_ITALIC) && T_CZH != NULL) /* italic */ + if ((attr & HL_ITALIC) && *T_CZH != NUL) /* italic */ out_str(T_CZH); - if ((attr & HL_INVERSE) && T_MR != NULL) /* inverse (reverse) */ + if ((attr & HL_INVERSE) && *T_MR != NUL) /* inverse (reverse) */ out_str(T_MR); + if ((attr & HL_STRIKETHROUGH) && *T_STS != NUL) /* strike */ + out_str(T_STS); /* * Output the color or start string after bold etc., in case the @@ -7724,14 +8139,37 @@ screen_start_highlight(attr) */ if (aep != NULL) { +#ifdef FEAT_TERMGUICOLORS + /* When 'termguicolors' is set but fg or bg is unset, + * fall back to the cterm colors. This helps for SpellBad, + * where the GUI uses a red undercurl. */ + if (p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR) + { + if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) + term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); + } + else +#endif if (t_colors > 1) { if (aep->ae_u.cterm.fg_color) term_fg_color(aep->ae_u.cterm.fg_color - 1); + } +#ifdef FEAT_TERMGUICOLORS + if (p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR) + { + if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) + term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); + } + else +#endif + if (t_colors > 1) + { if (aep->ae_u.cterm.bg_color) term_bg_color(aep->ae_u.cterm.bg_color - 1); } - else + + if (!IS_CTERM) { if (aep->ae_u.term.start != NULL) out_str(aep->ae_u.term.start); @@ -7742,7 +8180,7 @@ screen_start_highlight(attr) } void -screen_stop_highlight() +screen_stop_highlight(void) { int do_ME = FALSE; /* output T_ME code */ @@ -7768,14 +8206,25 @@ screen_stop_highlight() { attrentry_T *aep; - if (t_colors > 1) + if (IS_CTERM) { /* * Assume that t_me restores the original colors! */ aep = syn_cterm_attr2entry(screen_attr); - if (aep != NULL && (aep->ae_u.cterm.fg_color - || aep->ae_u.cterm.bg_color)) + if (aep != NULL && (( +#ifdef FEAT_TERMGUICOLORS + p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.fg_rgb != INVALCOLOR + : +#endif + aep->ae_u.cterm.fg_color) || ( +#ifdef FEAT_TERMGUICOLORS + p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.bg_rgb != INVALCOLOR + : +#endif + aep->ae_u.cterm.bg_color))) do_ME = TRUE; } else @@ -7806,7 +8255,15 @@ screen_stop_highlight() else out_str(T_SE); } - if (screen_attr & (HL_UNDERLINE | HL_UNDERCURL)) + if ((screen_attr & HL_UNDERCURL) && *T_UCE != NUL) + { + if (STRCMP(T_UCE, T_ME) == 0) + do_ME = TRUE; + else + out_str(T_UCE); + } + if ((screen_attr & HL_UNDERLINE) + || ((screen_attr & HL_UNDERCURL) && *T_UCE == NUL)) { if (STRCMP(T_UE, T_ME) == 0) do_ME = TRUE; @@ -7820,18 +8277,37 @@ screen_stop_highlight() else out_str(T_CZR); } + if (screen_attr & HL_STRIKETHROUGH) + { + if (STRCMP(T_STE, T_ME) == 0) + do_ME = TRUE; + else + out_str(T_STE); + } if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) out_str(T_ME); - if (t_colors > 1) +#ifdef FEAT_TERMGUICOLORS + if (p_tgc) + { + if (cterm_normal_fg_gui_color != INVALCOLOR) + term_fg_rgb_color(cterm_normal_fg_gui_color); + if (cterm_normal_bg_gui_color != INVALCOLOR) + term_bg_rgb_color(cterm_normal_bg_gui_color); + } + else +#endif { - /* set Normal cterm colors */ - if (cterm_normal_fg_color != 0) - term_fg_color(cterm_normal_fg_color - 1); - if (cterm_normal_bg_color != 0) - term_bg_color(cterm_normal_bg_color - 1); - if (cterm_normal_fg_bold) - out_str(T_MD); + if (t_colors > 1) + { + /* set Normal cterm colors */ + if (cterm_normal_fg_color != 0) + term_fg_color(cterm_normal_fg_color - 1); + if (cterm_normal_bg_color != 0) + term_bg_color(cterm_normal_bg_color - 1); + if (cterm_normal_fg_bold) + out_str(T_MD); + } } } } @@ -7843,12 +8319,18 @@ screen_stop_highlight() * The machine specific code may override this again. */ void -reset_cterm_colors() +reset_cterm_colors(void) { - if (t_colors > 1) + if (IS_CTERM) { /* set Normal cterm colors */ +#ifdef FEAT_TERMGUICOLORS + if (p_tgc ? (cterm_normal_fg_gui_color != INVALCOLOR + || cterm_normal_bg_gui_color != INVALCOLOR) + : (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) +#else if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) +#endif { out_str(T_OP); screen_attr = -1; @@ -7866,10 +8348,7 @@ reset_cterm_colors() * using the attributes from ScreenAttrs["off"]. */ static void -screen_char(off, row, col) - unsigned off; - int row; - int col; +screen_char(unsigned off, int row, int col) { int attr; @@ -7878,9 +8357,11 @@ screen_char(off, row, col) if (row >= screen_Rows || col >= screen_Columns) return; - /* Outputting the last character on the screen may scrollup the screen. - * Don't to it! Mark the character invalid (update it when scrolled up) */ - if (row == screen_Rows - 1 && col == screen_Columns - 1 + /* Outputting a character in the last cell on the screen may scroll the + * screen up. Only do it when the "xn" termcap property is set, otherwise + * mark the character invalid (update it when scrolled up). */ + if (*T_XN == NUL + && row == screen_Rows - 1 && col == screen_Columns - 1 #ifdef FEAT_RIGHTLEFT /* account for first command-line character in rightleft mode */ && !cmdmsg_rl @@ -7894,11 +8375,9 @@ screen_char(off, row, col) /* * Stop highlighting first, so it's easier to move the cursor. */ -#if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT) if (screen_char_attr != 0) attr = screen_char_attr; else -#endif attr = ScreenAttrs[off]; if (screen_attr != attr) screen_stop_highlight(); @@ -7913,13 +8392,38 @@ screen_char(off, row, col) { char_u buf[MB_MAXBYTES + 1]; - /* Convert UTF-8 character to bytes and write it. */ + if (utf_ambiguous_width(ScreenLinesUC[off]) +# ifdef FEAT_GUI_MACVIM + /* In the GUI, check if the cell width is actually 1 in order + * to display 2-cells emoji correctly. */ + && (!gui.in_use || utf_char2cells(ScreenLinesUC[off]) == 1) +# endif + ) + { + if (*p_ambw == 'd' +# ifdef FEAT_GUI + && !gui.in_use +# endif + ) + { + /* Clear the two screen cells. If the character is actually + * single width it won't change the second cell. */ + out_str((char_u *)" "); + term_windgoto(row, col); + } + /* not sure where the cursor is after drawing the ambiguous width + * character */ +# ifdef FEAT_GUI_MACVIM + if (*p_ambw == 'd' || !gui.in_use) +# endif + screen_cur_col = 9999; + } + else if (utf_char2cells(ScreenLinesUC[off]) > 1) + ++screen_cur_col; + /* Convert the UTF-8 character to bytes and write it. */ buf[utfc_char2bytes(off, buf)] = NUL; - out_str(buf); - if (utf_char2cells(ScreenLinesUC[off]) > 1) - ++screen_cur_col; } else #endif @@ -7947,10 +8451,7 @@ screen_char(off, row, col) * output the two bytes of a double-byte character with nothing in between. */ static void -screen_char_2(off, row, col) - unsigned off; - int row; - int col; +screen_char_2(unsigned off, int row, int col) { /* Check for illegal values (could be wrong when screen was resized). */ if (off + 1 >= (unsigned)(screen_Rows * screen_Columns)) @@ -7972,18 +8473,17 @@ screen_char_2(off, row, col) } #endif -#if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT) || defined(PROTO) /* * Draw a rectangle of the screen, inverted when "invert" is TRUE. * This uses the contents of ScreenLines[] and doesn't change it. */ void -screen_draw_rectangle(row, col, height, width, invert) - int row; - int col; - int height; - int width; - int invert; +screen_draw_rectangle( + int row, + int col, + int height, + int width, + int invert) { int r, c; int off; @@ -8024,17 +8524,12 @@ screen_draw_rectangle(row, col, height, width, invert) } screen_char_attr = 0; } -#endif -#ifdef FEAT_VERTSPLIT /* * Redraw the characters for a vertically split window. */ static void -redraw_block(row, end, wp) - int row; - int end; - win_T *wp; +redraw_block(int row, int end, win_T *wp) { int col; int width; @@ -8055,7 +8550,17 @@ redraw_block(row, end, wp) } screen_draw_rectangle(row, col, end - row, width, FALSE); } -#endif + + static void +space_to_screenline(int off, int attr) +{ + ScreenLines[off] = ' '; + ScreenAttrs[off] = attr; +# ifdef FEAT_MBYTE + if (enc_utf8) + ScreenLinesUC[off] = 0; +# endif +} /* * Fill the screen from 'start_row' to 'end_row', from 'start_col' to 'end_col' @@ -8063,11 +8568,14 @@ redraw_block(row, end, wp) * Use attributes 'attr'. */ void -screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) - int start_row, end_row; - int start_col, end_col; - int c1, c2; - int attr; +screen_fill( + int start_row, + int end_row, + int start_col, + int end_col, + int c1, + int c2, + int attr) { int row; int col; @@ -8094,7 +8602,7 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) #ifdef FEAT_GUI !gui.in_use && #endif - t_colors <= 1); + !IS_CTERM); for (row = start_row; row < end_row; ++row) { #ifdef FEAT_MBYTE @@ -8159,12 +8667,7 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) col = end_col - col; while (col--) /* clear chars in ScreenLines */ { - ScreenLines[off] = ' '; -#ifdef FEAT_MBYTE - if (enc_utf8) - ScreenLinesUC[off] = 0; -#endif - ScreenAttrs[off] = 0; + space_to_screenline(off, 0); ++off; } } @@ -8209,21 +8712,22 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) # endif ) { -# ifndef FEAT_GUI_MACVIM - if (ScreenLines[off] != ' ' - && (ScreenAttrs[off] > HL_ALL - || ScreenAttrs[off] & HL_BOLD)) - force_next = TRUE; - else - force_next = FALSE; -# else +# ifdef FEAT_GUI_MACVIM /* Mac OS X does subpixel antialiasing which often causes a * glyph to spill over into neighboring cells. For this * reason we always clear the neighboring glyphs whenever a * glyph is cleared, just like other GUIs cope with the * bold trick. */ - force_next = (ScreenLines[off] != ' '); + if (gui.in_use) + force_next = (ScreenLines[off] != ' '); + else # endif + if (ScreenLines[off] != ' ' + && (ScreenAttrs[off] > HL_ALL + || ScreenAttrs[off] & HL_BOLD)) + force_next = TRUE; + else + force_next = FALSE; } #endif ScreenLines[off] = c; @@ -8256,7 +8760,8 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) if (row == Rows - 1) /* overwritten the command line */ { redraw_cmdline = TRUE; - if (c1 == ' ' && c2 == ' ') + if (start_col == 0 && end_col == Columns + && c1 == ' ' && c2 == ' ' && attr == 0) clear_cmdline = FALSE; /* command line has been cleared */ if (start_col == 0) mode_displayed = FALSE; /* mode cleared or overwritten */ @@ -8269,8 +8774,7 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) * screen or the command line. */ void -check_for_delay(check_msg_scroll) - int check_msg_scroll; +check_for_delay(int check_msg_scroll) { if ((emsg_on_display || (check_msg_scroll && msg_scroll)) && !did_wait_return @@ -8291,8 +8795,7 @@ check_for_delay(check_msg_scroll) * Returns FALSE when starting up and screen not initialized yet. */ int -screen_valid(doclear) - int doclear; +screen_valid(int doclear) { screenalloc(doclear); /* allocate screen buffers if size changed */ return (ScreenLines != NULL); @@ -8309,8 +8812,7 @@ screen_valid(doclear) * final size of the shell is needed. */ void -screenalloc(doclear) - int doclear; +screenalloc(int doclear) { int new_row, old_row; #ifdef FEAT_GUI @@ -8329,17 +8831,13 @@ screenalloc(doclear) sattr_T *new_ScreenAttrs; unsigned *new_LineOffset; char_u *new_LineWraps; -#ifdef FEAT_WINDOWS short *new_TabPageIdxs; tabpage_T *tp; -#endif static int entered = FALSE; /* avoid recursiveness */ static int done_outofmem_msg = FALSE; /* did outofmem message */ -#ifdef FEAT_AUTOCMD int retry_count = 0; retry: -#endif /* * Allocation of the screen buffers is done only when the size changes and * when Rows and Columns have been set and we have started doing full @@ -8391,10 +8889,8 @@ screenalloc(doclear) */ FOR_ALL_TAB_WINDOWS(tp, wp) win_free_lsize(wp); -#ifdef FEAT_AUTOCMD if (aucmd_win != NULL) win_free_lsize(aucmd_win); -#endif new_ScreenLines = (schar_T *)lalloc((long_u)( (Rows + 1) * Columns * sizeof(schar_T)), FALSE); @@ -8417,28 +8913,20 @@ screenalloc(doclear) new_LineOffset = (unsigned *)lalloc((long_u)( Rows * sizeof(unsigned)), FALSE); new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE); -#ifdef FEAT_WINDOWS new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE); -#endif FOR_ALL_TAB_WINDOWS(tp, wp) { if (win_alloc_lines(wp) == FAIL) { outofmem = TRUE; -#ifdef FEAT_WINDOWS goto give_up; -#endif } } -#ifdef FEAT_AUTOCMD if (aucmd_win != NULL && aucmd_win->w_lines == NULL && win_alloc_lines(aucmd_win) == FAIL) outofmem = TRUE; -#endif -#ifdef FEAT_WINDOWS give_up: -#endif #ifdef FEAT_MBYTE for (i = 0; i < p_mco; ++i) @@ -8453,9 +8941,7 @@ screenalloc(doclear) || new_ScreenAttrs == NULL || new_LineOffset == NULL || new_LineWraps == NULL -#ifdef FEAT_WINDOWS || new_TabPageIdxs == NULL -#endif || outofmem) { if (ScreenLines != NULL || !done_outofmem_msg) @@ -8467,29 +8953,17 @@ screenalloc(doclear) * and over again. */ done_outofmem_msg = TRUE; } - vim_free(new_ScreenLines); - new_ScreenLines = NULL; + VIM_CLEAR(new_ScreenLines); #ifdef FEAT_MBYTE - vim_free(new_ScreenLinesUC); - new_ScreenLinesUC = NULL; + VIM_CLEAR(new_ScreenLinesUC); for (i = 0; i < p_mco; ++i) - { - vim_free(new_ScreenLinesC[i]); - new_ScreenLinesC[i] = NULL; - } - vim_free(new_ScreenLines2); - new_ScreenLines2 = NULL; -#endif - vim_free(new_ScreenAttrs); - new_ScreenAttrs = NULL; - vim_free(new_LineOffset); - new_LineOffset = NULL; - vim_free(new_LineWraps); - new_LineWraps = NULL; -#ifdef FEAT_WINDOWS - vim_free(new_TabPageIdxs); - new_TabPageIdxs = NULL; + VIM_CLEAR(new_ScreenLinesC[i]); + VIM_CLEAR(new_ScreenLines2); #endif + VIM_CLEAR(new_ScreenAttrs); + VIM_CLEAR(new_LineOffset); + VIM_CLEAR(new_LineWraps); + VIM_CLEAR(new_TabPageIdxs); } else { @@ -8583,9 +9057,7 @@ screenalloc(doclear) ScreenAttrs = new_ScreenAttrs; LineOffset = new_LineOffset; LineWraps = new_LineWraps; -#ifdef FEAT_WINDOWS TabPageIdxs = new_TabPageIdxs; -#endif /* It's important that screen_Rows and screen_Columns reflect the actual * size of ScreenLines[]. Set them before calling anything. */ @@ -8622,7 +9094,6 @@ screenalloc(doclear) entered = FALSE; --RedrawingDisabled; -#ifdef FEAT_AUTOCMD /* * Do not apply autocommands more than 3 times to avoid an endless loop * in case applying autocommands always changes Rows or Columns. @@ -8634,11 +9105,10 @@ screenalloc(doclear) * jump back to check if we need to allocate the screen again. */ goto retry; } -#endif } void -free_screenlines() +free_screenlines(void) { #ifdef FEAT_MBYTE int i; @@ -8652,13 +9122,11 @@ free_screenlines() vim_free(ScreenAttrs); vim_free(LineOffset); vim_free(LineWraps); -#ifdef FEAT_WINDOWS vim_free(TabPageIdxs); -#endif } void -screenclear() +screenclear(void) { check_for_delay(FALSE); screenalloc(FALSE); /* allocate screen buffers if size changed */ @@ -8666,7 +9134,7 @@ screenclear() } static void -screenclear2() +screenclear2(void) { int i; @@ -8691,7 +9159,7 @@ screenclear2() /* blank out ScreenLines */ for (i = 0; i < Rows; ++i) { - lineclear(LineOffset[i], (int)Columns); + lineclear(LineOffset[i], (int)Columns, 0); LineWraps[i] = FALSE; } @@ -8713,9 +9181,7 @@ screenclear2() win_rest_invalid(firstwin); redraw_cmdline = TRUE; -#ifdef FEAT_WINDOWS redraw_tabline = TRUE; -#endif if (must_redraw == CLEAR) /* no need to clear again */ must_redraw = NOT_VALID; compute_cmdrow(); @@ -8731,9 +9197,7 @@ screenclear2() * Clear one line in ScreenLines. */ static void -lineclear(off, width) - unsigned off; - int width; +lineclear(unsigned off, int width, int attr) { (void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T)); #ifdef FEAT_MBYTE @@ -8741,7 +9205,7 @@ lineclear(off, width) (void)vim_memset(ScreenLinesUC + off, 0, (size_t)width * sizeof(u8char_T)); #endif - (void)vim_memset(ScreenAttrs + off, 0, (size_t)width * sizeof(sattr_T)); + (void)vim_memset(ScreenAttrs + off, attr, (size_t)width * sizeof(sattr_T)); } /* @@ -8749,29 +9213,23 @@ lineclear(off, width) * invalid value. */ static void -lineinvalid(off, width) - unsigned off; - int width; +lineinvalid(unsigned off, int width) { (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T)); } -#ifdef FEAT_VERTSPLIT /* * Copy part of a Screenline for vertically split window "wp". */ static void -linecopy(to, from, wp) - int to; - int from; - win_T *wp; +linecopy(int to, int from, win_T *wp) { unsigned off_to = LineOffset[to] + wp->w_wincol; unsigned off_from = LineOffset[from] + wp->w_wincol; mch_memmove(ScreenLines + off_to, ScreenLines + off_from, wp->w_width * sizeof(schar_T)); -# ifdef FEAT_MBYTE +#ifdef FEAT_MBYTE if (enc_utf8) { int i; @@ -8785,25 +9243,29 @@ linecopy(to, from, wp) if (enc_dbcs == DBCS_JPNU) mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, wp->w_width * sizeof(schar_T)); -# endif +#endif mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from, wp->w_width * sizeof(sattr_T)); } -#endif /* * Return TRUE if clearing with term string "p" would work. * It can't work when the string is empty or it won't set the right background. */ int -can_clear(p) - char_u *p; +can_clear(char_u *p) { return (*p != NUL && (t_colors <= 1 #ifdef FEAT_GUI || gui.in_use #endif - || cterm_normal_bg_color == 0 || *T_UT != NUL)); +#ifdef FEAT_TERMGUICOLORS + || (p_tgc && cterm_normal_bg_gui_color == INVALCOLOR) + || (!p_tgc && cterm_normal_bg_color == 0) +#else + || cterm_normal_bg_color == 0 +#endif + || *T_UT != NUL)); } /* @@ -8812,7 +9274,7 @@ can_clear(p) * code. */ void -screen_start() +screen_start(void) { screen_cur_row = screen_cur_col = 9999; } @@ -8823,9 +9285,7 @@ screen_start() * characters sent to the terminal. */ void -windgoto(row, col) - int row; - int col; +windgoto(int row, int col) { sattr_T *p; int i; @@ -9077,17 +9537,27 @@ windgoto(row, col) * Set cursor to its position in the current window. */ void -setcursor() +setcursor(void) { - if (redrawing()) + setcursor_mayforce(FALSE); +} + +/* + * Set cursor to its position in the current window. + * When "force" is TRUE also when not redrawing. + */ + void +setcursor_mayforce(int force) +{ + if (force || redrawing()) { validate_cursor(); windgoto(W_WINROW(curwin) + curwin->w_wrow, - W_WINCOL(curwin) + ( + curwin->w_wincol + ( #ifdef FEAT_RIGHTLEFT /* With 'rightleft' set and the cursor on a double-wide * character, position it on the leftmost column. */ - curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - ( + curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - ( # ifdef FEAT_MBYTE (has_mbyte && (*mb_ptr2cells)(ml_get_cursor()) == 2 @@ -9101,19 +9571,19 @@ setcursor() /* - * insert 'line_count' lines at 'row' in window 'wp' - * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. - * if 'mayclear' is TRUE the screen will be cleared if it is faster than + * Insert 'line_count' lines at 'row' in window 'wp'. + * If 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. + * If 'mayclear' is TRUE the screen will be cleared if it is faster than * scrolling. * Returns FAIL if the lines are not inserted, OK for success. */ int -win_ins_lines(wp, row, line_count, invalid, mayclear) - win_T *wp; - int row; - int line_count; - int invalid; - int mayclear; +win_ins_lines( + win_T *wp, + int row, + int line_count, + int invalid, + int mayclear) { int did_delete; int nextrow; @@ -9129,7 +9599,7 @@ win_ins_lines(wp, row, line_count, invalid, mayclear) if (line_count > wp->w_height - row) line_count = wp->w_height - row; - retval = win_do_lines(wp, row, line_count, mayclear, FALSE); + retval = win_do_lines(wp, row, line_count, mayclear, FALSE, 0); if (retval != MAYBE) return retval; @@ -9140,43 +9610,37 @@ win_ins_lines(wp, row, line_count, invalid, mayclear) * messing up those windows, better just redraw. */ did_delete = FALSE; -#ifdef FEAT_WINDOWS if (wp->w_next != NULL || wp->w_status_height) { if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count, - line_count, (int)Rows, FALSE, NULL) == OK) + line_count, (int)Rows, FALSE, 0, NULL) == OK) did_delete = TRUE; else if (wp->w_next) return FAIL; } -#endif /* * if no lines deleted, blank the lines that will end up below the window */ if (!did_delete) { -#ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; -#endif redraw_cmdline = TRUE; - nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp); + nextrow = W_WINROW(wp) + wp->w_height + wp->w_status_height; lastrow = nextrow + line_count; if (lastrow > Rows) lastrow = Rows; screen_fill(nextrow - line_count, lastrow - line_count, - W_WINCOL(wp), (int)W_ENDCOL(wp), + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); } - if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, NULL) + if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, 0, NULL) == FAIL) { /* deletion will have messed up other windows */ if (did_delete) { -#ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; -#endif win_rest_invalid(W_NEXT(wp)); } return FAIL; @@ -9186,19 +9650,20 @@ win_ins_lines(wp, row, line_count, invalid, mayclear) } /* - * delete "line_count" window lines at "row" in window "wp" + * Delete "line_count" window lines at "row" in window "wp". * If "invalid" is TRUE curwin->w_lines[] is invalidated. * If "mayclear" is TRUE the screen will be cleared if it is faster than * scrolling * Return OK for success, FAIL if the lines are not deleted. */ int -win_del_lines(wp, row, line_count, invalid, mayclear) - win_T *wp; - int row; - int line_count; - int invalid; - int mayclear; +win_del_lines( + win_T *wp, + int row, + int line_count, + int invalid, + int mayclear, + int clear_attr) /* for clearing lines */ { int retval; @@ -9208,15 +9673,14 @@ win_del_lines(wp, row, line_count, invalid, mayclear) if (line_count > wp->w_height - row) line_count = wp->w_height - row; - retval = win_do_lines(wp, row, line_count, mayclear, TRUE); + retval = win_do_lines(wp, row, line_count, mayclear, TRUE, clear_attr); if (retval != MAYBE) return retval; if (screen_del_lines(0, W_WINROW(wp) + row, line_count, - (int)Rows, FALSE, NULL) == FAIL) + (int)Rows, FALSE, clear_attr, NULL) == FAIL) return FAIL; -#ifdef FEAT_WINDOWS /* * If there are windows or status lines below, try to put them at the * correct place. If we can't do that, they have to be redrawn. @@ -9224,7 +9688,7 @@ win_del_lines(wp, row, line_count, invalid, mayclear) if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) { if (screen_ins_lines(0, W_WINROW(wp) + wp->w_height - line_count, - line_count, (int)Rows, NULL) == FAIL) + line_count, (int)Rows, clear_attr, NULL) == FAIL) { wp->w_redr_status = TRUE; win_rest_invalid(wp->w_next); @@ -9235,7 +9699,6 @@ win_del_lines(wp, row, line_count, invalid, mayclear) * command line later. */ else -#endif redraw_cmdline = TRUE; return OK; } @@ -9246,26 +9709,29 @@ win_del_lines(wp, row, line_count, invalid, mayclear) * Returns MAYBE when not finished yet. */ static int -win_do_lines(wp, row, line_count, mayclear, del) - win_T *wp; - int row; - int line_count; - int mayclear; - int del; +win_do_lines( + win_T *wp, + int row, + int line_count, + int mayclear, + int del, + int clear_attr) { int retval; if (!redrawing() || line_count <= 0) return FAIL; + /* When inserting lines would result in loss of command output, just redraw + * the lines. */ + if (no_win_do_lines_ins && !del) + return FAIL; + /* only a few lines left: redraw is faster */ - if (mayclear && Rows - line_count < 5 -#ifdef FEAT_VERTSPLIT - && wp->w_width == Columns -#endif - ) + if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) { - screenclear(); /* will set wp->w_lines_valid to 0 */ + if (!no_win_do_lines_ins) + screenclear(); /* will set wp->w_lines_valid to 0 */ return FAIL; } @@ -9275,16 +9741,18 @@ win_do_lines(wp, row, line_count, mayclear, del) if (row + line_count >= wp->w_height) { screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, - W_WINCOL(wp), (int)W_ENDCOL(wp), + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); return OK; } /* - * when scrolling, the message on the command line should be cleared, + * When scrolling, the message on the command line should be cleared, * otherwise it will stay there forever. + * Don't do this when avoiding to insert lines. */ - clear_cmdline = TRUE; + if (!no_win_do_lines_ins) + clear_cmdline = TRUE; /* * If the terminal can set a scroll region, use that. @@ -9292,36 +9760,26 @@ win_do_lines(wp, row, line_count, mayclear, del) * ScreenLines[] when t_CV isn't defined. That's faster than using * win_line(). * Don't use a scroll region when we are going to redraw the text, writing - * a character in the lower right corner of the scroll region causes a - * scroll-up in the DJGPP version. + * a character in the lower right corner of the scroll region may cause a + * scroll-up . */ - if (scroll_region -#ifdef FEAT_VERTSPLIT - || W_WIDTH(wp) != Columns -#endif - ) + if (scroll_region || wp->w_width != Columns) { -#ifdef FEAT_VERTSPLIT if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) -#endif scroll_region_set(wp, row); if (del) retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count, - wp->w_height - row, FALSE, wp); + wp->w_height - row, FALSE, clear_attr, wp); else retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count, - wp->w_height - row, wp); -#ifdef FEAT_VERTSPLIT + wp->w_height - row, clear_attr, wp); if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) -#endif scroll_region_reset(); return retval; } -#ifdef FEAT_WINDOWS if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */ return FAIL; -#endif return MAYBE; } @@ -9330,20 +9788,13 @@ win_do_lines(wp, row, line_count, mayclear, del) * window 'wp' and everything after it is messed up, mark it for redraw */ static void -win_rest_invalid(wp) - win_T *wp; +win_rest_invalid(win_T *wp) { -#ifdef FEAT_WINDOWS while (wp != NULL) -#else - if (wp != NULL) -#endif { redraw_win_later(wp, NOT_VALID); -#ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; wp = wp->w_next; -#endif } redraw_cmdline = TRUE; } @@ -9380,17 +9831,19 @@ win_rest_invalid(wp) * return FAIL for failure, OK for success. */ int -screen_ins_lines(off, row, line_count, end, wp) - int off; - int row; - int line_count; - int end; - win_T *wp; /* NULL or window to use width from */ +screen_ins_lines( + int off, + int row, + int line_count, + int end, + int clear_attr, + win_T *wp) /* NULL or window to use width from */ { int i; int j; unsigned temp; int cursor_row; + int cursor_col = 0; int type; int result_empty; int can_ce = can_clear(T_CE); @@ -9401,8 +9854,14 @@ screen_ins_lines(off, row, line_count, end, wp) * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' + * - redrawing for a callback and there is a modeless selection */ - if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll) + if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll +#ifdef FEAT_CLIPBOARD + || (clip_star.state != SELECT_CLEARED + && redrawing_for_callback > 0) +#endif + ) return FAIL; /* @@ -9431,12 +9890,9 @@ screen_ins_lines(off, row, line_count, end, wp) * exists. */ result_empty = (row + line_count >= end); -#ifdef FEAT_VERTSPLIT if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) type = USE_REDRAW; - else -#endif - if (can_clear(T_CD) && result_empty) + else if (can_clear(T_CD) && result_empty) type = USE_T_CD; else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) type = USE_T_CAL; @@ -9459,7 +9915,7 @@ screen_ins_lines(off, row, line_count, end, wp) */ if (type == USE_T_CD || type == USE_T_CDL || type == USE_T_CE || type == USE_T_DL) - return screen_del_lines(off, row, line_count, end, FALSE, wp); + return screen_del_lines(off, row, line_count, end, FALSE, 0, wp); /* * If text is retained below the screen, first clear or delete as many @@ -9467,16 +9923,12 @@ screen_ins_lines(off, row, line_count, end, wp) * the deleted lines won't later surface during a screen_del_lines. */ if (*T_DB) - screen_del_lines(off, end - line_count, line_count, end, FALSE, wp); + screen_del_lines(off, end - line_count, line_count, end, FALSE, 0, wp); #ifdef FEAT_CLIPBOARD /* Remove a modeless selection when inserting lines halfway the screen * or not the full width of the screen. */ - if (off + row > 0 -# ifdef FEAT_VERTSPLIT - || (wp != NULL && wp->w_width != Columns) -# endif - ) + if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) clip_clear_selection(&clip_star); else clip_scroll_selection(-line_count); @@ -9485,9 +9937,12 @@ screen_ins_lines(off, row, line_count, end, wp) #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ - gui_dont_update_cursor(); + gui_dont_update_cursor(row + off <= gui.cursor_row); #endif + if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) + cursor_col = wp->w_wincol; + if (*T_CCS != NUL) /* cursor relative to region */ cursor_row = row; else @@ -9501,7 +9956,6 @@ screen_ins_lines(off, row, line_count, end, wp) end += off; for (i = 0; i < line_count; ++i) { -#ifdef FEAT_VERTSPLIT if (wp != NULL && wp->w_width != Columns) { /* need to copy part of a line */ @@ -9510,13 +9964,13 @@ screen_ins_lines(off, row, line_count, end, wp) linecopy(j + line_count, j, wp); j += line_count; if (can_clear((char_u *)" ")) - lineclear(LineOffset[j] + wp->w_wincol, wp->w_width); + lineclear(LineOffset[j] + wp->w_wincol, wp->w_width, + clear_attr); else lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); LineWraps[j] = FALSE; } else -#endif { j = end - 1 - i; temp = LineOffset[j]; @@ -9528,22 +9982,21 @@ screen_ins_lines(off, row, line_count, end, wp) LineOffset[j + line_count] = temp; LineWraps[j + line_count] = FALSE; if (can_clear((char_u *)" ")) - lineclear(temp, (int)Columns); + lineclear(temp, (int)Columns, clear_attr); else lineinvalid(temp, (int)Columns); } } screen_stop_highlight(); - windgoto(cursor_row, 0); + windgoto(cursor_row, cursor_col); + if (clear_attr != 0) + screen_start_highlight(clear_attr); -#ifdef FEAT_VERTSPLIT /* redraw the characters */ if (type == USE_REDRAW) redraw_block(row, end, wp); - else -#endif - if (type == USE_T_CAL) + else if (type == USE_T_CAL) { term_append_lines(line_count); screen_start(); /* don't know where cursor is now */ @@ -9555,7 +10008,7 @@ screen_ins_lines(off, row, line_count, end, wp) if (type == USE_T_AL) { if (i && cursor_row != 0) - windgoto(cursor_row, 0); + windgoto(cursor_row, cursor_col); out_str(T_AL); } else /* type == USE_T_SR */ @@ -9572,7 +10025,7 @@ screen_ins_lines(off, row, line_count, end, wp) { for (i = 0; i < line_count; ++i) { - windgoto(off + i, 0); + windgoto(off + i, cursor_col); out_str(T_CE); screen_start(); /* don't know where cursor is now */ } @@ -9587,26 +10040,28 @@ screen_ins_lines(off, row, line_count, end, wp) } /* - * delete lines on the screen and update ScreenLines[] - * 'end' is the line after the scrolled part. Normally it is Rows. - * When scrolling region used 'off' is the offset from the top for the region. - * 'row' and 'end' are relative to the start of the region. + * Delete lines on the screen and update ScreenLines[]. + * "end" is the line after the scrolled part. Normally it is Rows. + * When scrolling region used "off" is the offset from the top for the region. + * "row" and "end" are relative to the start of the region. * * Return OK for success, FAIL if the lines are not deleted. */ int -screen_del_lines(off, row, line_count, end, force, wp) - int off; - int row; - int line_count; - int end; - int force; /* even when line_count > p_ttyscroll */ - win_T *wp UNUSED; /* NULL or window to use width from */ +screen_del_lines( + int off, + int row, + int line_count, + int end, + int force, /* even when line_count > p_ttyscroll */ + int clear_attr, /* used for clearing lines */ + win_T *wp UNUSED) /* NULL or window to use width from */ { int j; int i; unsigned temp; int cursor_row; + int cursor_col = 0; int cursor_end; int result_empty; /* result is empty until end of region */ int can_delete; /* deleting line codes can be used */ @@ -9618,9 +10073,15 @@ screen_del_lines(off, row, line_count, end, force, wp) * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' + * - redrawing for a callback and there is a modeless selection */ - if (!screen_valid(TRUE) || line_count <= 0 || - (!force && line_count > p_ttyscroll)) + if (!screen_valid(TRUE) || line_count <= 0 + || (!force && line_count > p_ttyscroll) +#ifdef FEAT_CLIPBOARD + || (clip_star.state != SELECT_CLEARED + && redrawing_for_callback > 0) +#endif + ) return FAIL; /* @@ -9646,12 +10107,9 @@ screen_del_lines(off, row, line_count, end, force, wp) * 5. Use T_DL (delete line) if it exists. * 6. redraw the characters from ScreenLines[]. */ -#ifdef FEAT_VERTSPLIT if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) type = USE_REDRAW; - else -#endif - if (can_clear(T_CD) && result_empty) + else if (can_clear(T_CD) && result_empty) type = USE_T_CD; #if defined(__BEOS__) && defined(BEOS_DR8) /* @@ -9678,10 +10136,7 @@ screen_del_lines(off, row, line_count, end, force, wp) else if (*T_CDL != NUL && line_count > 1 && can_delete) type = USE_T_CDL; else if (can_clear(T_CE) && result_empty -#ifdef FEAT_VERTSPLIT - && (wp == NULL || wp->w_width == Columns) -#endif - ) + && (wp == NULL || wp->w_width == Columns)) type = USE_T_CE; else if (*T_DL != NUL && can_delete) type = USE_T_DL; @@ -9693,11 +10148,7 @@ screen_del_lines(off, row, line_count, end, force, wp) #ifdef FEAT_CLIPBOARD /* Remove a modeless selection when deleting lines halfway the screen or * not the full width of the screen. */ - if (off + row > 0 -# ifdef FEAT_VERTSPLIT - || (wp != NULL && wp->w_width != Columns) -# endif - ) + if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) clip_clear_selection(&clip_star); else clip_scroll_selection(line_count); @@ -9706,9 +10157,13 @@ screen_del_lines(off, row, line_count, end, force, wp) #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ - gui_dont_update_cursor(); + gui_dont_update_cursor(gui.cursor_row >= row + off + && gui.cursor_row < end + off); #endif + if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) + cursor_col = wp->w_wincol; + if (*T_CCS != NUL) /* cursor relative to region */ { cursor_row = row; @@ -9728,7 +10183,6 @@ screen_del_lines(off, row, line_count, end, force, wp) end += off; for (i = 0; i < line_count; ++i) { -#ifdef FEAT_VERTSPLIT if (wp != NULL && wp->w_width != Columns) { /* need to copy part of a line */ @@ -9737,13 +10191,13 @@ screen_del_lines(off, row, line_count, end, force, wp) linecopy(j - line_count, j, wp); j -= line_count; if (can_clear((char_u *)" ")) - lineclear(LineOffset[j] + wp->w_wincol, wp->w_width); + lineclear(LineOffset[j] + wp->w_wincol, wp->w_width, + clear_attr); else lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); LineWraps[j] = FALSE; } else -#endif { /* whole width, moving the line pointers is faster */ j = row + i; @@ -9756,29 +10210,29 @@ screen_del_lines(off, row, line_count, end, force, wp) LineOffset[j - line_count] = temp; LineWraps[j - line_count] = FALSE; if (can_clear((char_u *)" ")) - lineclear(temp, (int)Columns); + lineclear(temp, (int)Columns, clear_attr); else lineinvalid(temp, (int)Columns); } } - screen_stop_highlight(); + if (screen_attr != clear_attr) + screen_stop_highlight(); + if (clear_attr != 0) + screen_start_highlight(clear_attr); -#ifdef FEAT_VERTSPLIT /* redraw the characters */ if (type == USE_REDRAW) redraw_block(row, end, wp); - else -#endif - if (type == USE_T_CD) /* delete the lines */ + else if (type == USE_T_CD) /* delete the lines */ { - windgoto(cursor_row, 0); + windgoto(cursor_row, cursor_col); out_str(T_CD); screen_start(); /* don't know where cursor is now */ } else if (type == USE_T_CDL) { - windgoto(cursor_row, 0); + windgoto(cursor_row, cursor_col); term_delete_lines(line_count); screen_start(); /* don't know where cursor is now */ } @@ -9789,7 +10243,7 @@ screen_del_lines(off, row, line_count, end, force, wp) */ else if (type == USE_NL) { - windgoto(cursor_end - 1, 0); + windgoto(cursor_end - 1, cursor_col); for (i = line_count; --i >= 0; ) out_char('\n'); /* cursor will remain on same line */ } @@ -9799,12 +10253,12 @@ screen_del_lines(off, row, line_count, end, force, wp) { if (type == USE_T_DL) { - windgoto(cursor_row, 0); + windgoto(cursor_row, cursor_col); out_str(T_DL); /* delete a line */ } else /* type == USE_T_CE */ { - windgoto(cursor_row + i, 0); + windgoto(cursor_row + i, cursor_col); out_str(T_CE); /* erase a line */ } screen_start(); /* don't know where cursor is now */ @@ -9819,7 +10273,7 @@ screen_del_lines(off, row, line_count, end, force, wp) { for (i = line_count; i > 0; --i) { - windgoto(cursor_end - i, 0); + windgoto(cursor_end - i, cursor_col); out_str(T_CE); /* erase a line */ screen_start(); /* don't know where cursor is now */ } @@ -9835,7 +10289,7 @@ screen_del_lines(off, row, line_count, end, force, wp) } /* - * show the current mode and ruler + * Show the current mode and ruler. * * If clear_cmdline is TRUE, clear the rest of the cmdline. * If clear_cmdline is FALSE there may be a message there that needs to be @@ -9843,7 +10297,7 @@ screen_del_lines(off, row, line_count, end, force, wp) * Return the length of the message (0 if no message). */ int -showmode() +showmode(void) { int need_clear; int length = 0; @@ -9856,9 +10310,9 @@ showmode() do_mode = ((p_smd && msg_silent == 0) && ((State & INSERT) - || restart_edit + || restart_edit != NUL || VIsual_active)); - if (do_mode || Recording) + if (do_mode || reg_recording != 0) { /* * Don't show mode right now, when not redrawing or inside a mapping. @@ -9884,7 +10338,7 @@ showmode() /* Position on the last line in the window, column 0 */ msg_pos_mode(); cursor_off(); - attr = hl_attr(HLF_CM); /* Highlight mode */ + attr = HL_ATTR(HLF_CM); /* Highlight mode */ if (do_mode) { MSG_PUTS_ATTR("--", attr); @@ -9907,7 +10361,13 @@ showmode() if (gui.in_use) { if (hangul_input_state_get()) - MSG_PUTS_ATTR(" \307\321\261\333", attr); /* HANGUL */ + { + /* HANGUL */ + if (enc_utf8) + MSG_PUTS_ATTR(" \355\225\234\352\270\200", attr); + else + MSG_PUTS_ATTR(" \307\321\261\333", attr); + } } #endif #ifdef FEAT_INS_EXPAND @@ -9933,13 +10393,12 @@ showmode() { MSG_PUTS_ATTR(" ", attr); /* add a space in between */ if ((int)edit_submode_highl < (int)HLF_COUNT) - sub_attr = hl_attr(edit_submode_highl); + sub_attr = HL_ATTR(edit_submode_highl); else sub_attr = attr; msg_puts_attr(edit_submode_extra, sub_attr); } } - length = 0; } else #endif @@ -9959,7 +10418,7 @@ showmode() #endif MSG_PUTS_ATTR(_(" INSERT"), attr); } - else if (restart_edit == 'I') + else if (restart_edit == 'I' || restart_edit == 'A') MSG_PUTS_ATTR(_(" (insert)"), attr); else if (restart_edit == 'R') MSG_PUTS_ATTR(_(" (replace)"), attr); @@ -9981,7 +10440,9 @@ showmode() MSG_PUTS_ATTR(_(" Arabic"), attr); else # endif - MSG_PUTS_ATTR(_(" (lang)"), attr); + if (get_keymap_str(curwin, (char_u *)" (%s)", + NameBuff, MAXPATHL)) + MSG_PUTS_ATTR(NameBuff, attr); } #endif if ((State & INSERT) && p_paste) @@ -10011,13 +10472,13 @@ showmode() need_clear = TRUE; } - if (Recording + if (reg_recording != 0 #ifdef FEAT_INS_EXPAND && edit_submode == NULL /* otherwise it gets too long */ #endif ) { - MSG_PUTS_ATTR(_("recording"), attr); + recording_mode(attr); need_clear = TRUE; } @@ -10040,12 +10501,8 @@ showmode() /* If the last window has no status line, the ruler is after the mode * message and must be redrawn */ - if (redrawing() -# ifdef FEAT_WINDOWS - && lastwin->w_status_height == 0 -# endif - ) - win_redr_ruler(lastwin, TRUE); + if (redrawing() && lastwin->w_status_height == 0) + win_redr_ruler(lastwin, TRUE, FALSE); #endif redraw_cmdline = FALSE; clear_cmdline = FALSE; @@ -10057,7 +10514,7 @@ showmode() * Position for a mode message. */ static void -msg_pos_mode() +msg_pos_mode(void) { msg_col = 0; msg_row = Rows - 1; @@ -10069,8 +10526,7 @@ msg_pos_mode() * Caller should check "mode_displayed". */ void -unshowmode(force) - int force; +unshowmode(int force) { /* * Don't delete it right now, when not redrawing or inside a mapping. @@ -10078,20 +10534,44 @@ unshowmode(force) if (!redrawing() || (!force && char_avail() && !KeyTyped)) redraw_cmdline = TRUE; /* delete mode later */ else + clearmode(); +} + +/* + * Clear the mode message. + */ + void +clearmode(void) +{ + int save_msg_row = msg_row; + int save_msg_col = msg_col; + + msg_pos_mode(); + if (reg_recording != 0) + recording_mode(HL_ATTR(HLF_CM)); + msg_clr_eos(); + + msg_col = save_msg_col; + msg_row = save_msg_row; +} + + static void +recording_mode(int attr) +{ + MSG_PUTS_ATTR(_("recording"), attr); + if (!shortmess(SHM_RECORDING)) { - msg_pos_mode(); - if (Recording) - MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM)); - msg_clr_eos(); + char_u s[4]; + sprintf((char *)s, " @%c", reg_recording); + MSG_PUTS_ATTR(s, attr); } } -#if defined(FEAT_WINDOWS) /* * Draw the tab pages line at the top of the Vim window. */ static void -draw_tabline() +draw_tabline(void) { int tabcount = 0; tabpage_T *tp; @@ -10105,17 +10585,22 @@ draw_tabline() int modified; int c; int len; - int attr_sel = hl_attr(HLF_TPS); - int attr_nosel = hl_attr(HLF_TP); - int attr_fill = hl_attr(HLF_TPF); + int attr_sel = HL_ATTR(HLF_TPS); + int attr_nosel = HL_ATTR(HLF_TP); + int attr_fill = HL_ATTR(HLF_TPF); char_u *p; int room; int use_sep_chars = (t_colors < 8 #ifdef FEAT_GUI && !gui.in_use +#endif +#ifdef FEAT_TERMGUICOLORS + && !p_tgc #endif ); + if (ScreenLines == NULL) + return; redraw_tabline = FALSE; #ifdef FEAT_GUI_TABLINE @@ -10139,21 +10624,21 @@ draw_tabline() /* Use the 'tabline' option if it's set. */ if (*p_tal != NUL) { - int save_called_emsg = called_emsg; + int saved_did_emsg = did_emsg; /* Check for an error. If there is one we would loop in redrawing the * screen. Avoid that by making 'tabline' empty. */ - called_emsg = FALSE; + did_emsg = FALSE; win_redr_custom(NULL, FALSE); - if (called_emsg) + if (did_emsg) set_string_option_direct((char_u *)"tabline", -1, (char_u *)"", OPT_FREE, SID_ERROR); - called_emsg |= save_called_emsg; + did_emsg |= saved_did_emsg; } else #endif { - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) ++tabcount; tabwidth = (Columns - 1 + tabcount / 2) / tabcount; @@ -10203,9 +10688,9 @@ draw_tabline() break; screen_puts_len(NameBuff, len, 0, col, #if defined(FEAT_SYN_HL) - hl_combine_attr(attr, hl_attr(HLF_T)) + hl_combine_attr(attr, HL_ATTR(HLF_T)) #else - attr + attr #endif ); col += len; @@ -10228,7 +10713,7 @@ draw_tabline() while (len > room) { len -= ptr2cells(p); - mb_ptr_adv(p); + MB_PTR_ADV(p); } else #endif @@ -10276,8 +10761,7 @@ draw_tabline() * Takes care of special buffer names and translates special characters. */ void -get_trans_bufname(buf) - buf_T *buf; +get_trans_bufname(buf_T *buf) { if (buf_spname(buf) != NULL) vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); @@ -10285,65 +10769,79 @@ get_trans_bufname(buf) home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); trans_characters(NameBuff, MAXPATHL); } -#endif -#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) /* * Get the character to use in a status line. Get its attributes in "*attr". */ static int -fillchar_status(attr, is_curwin) - int *attr; - int is_curwin; +fillchar_status(int *attr, win_T *wp) { int fill; - if (is_curwin) + +#ifdef FEAT_TERMINAL + if (bt_terminal(wp->w_buffer)) + { + if (wp == curwin) + { + *attr = HL_ATTR(HLF_ST); + fill = fill_stl; + } + else + { + *attr = HL_ATTR(HLF_STNC); + fill = fill_stlnc; + } + } + else +#endif + if (wp == curwin) { - *attr = hl_attr(HLF_S); + *attr = HL_ATTR(HLF_S); fill = fill_stl; } else { - *attr = hl_attr(HLF_SNC); + *attr = HL_ATTR(HLF_SNC); fill = fill_stlnc; } /* Use fill when there is highlighting, and highlighting of current * window differs, or the fillchars differ, or this is not the * current window */ - if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC) - || !is_curwin || firstwin == lastwin) + if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC) + || wp != curwin || ONE_WINDOW) || (fill_stl != fill_stlnc))) return fill; - if (is_curwin) + if (wp == curwin) return '^'; return '='; } -#endif -#ifdef FEAT_VERTSPLIT /* * Get the character to use in a separator between vertically split windows. * Get its attributes in "*attr". */ static int -fillchar_vsep(attr) - int *attr; +fillchar_vsep(int *attr) { - *attr = hl_attr(HLF_C); + *attr = HL_ATTR(HLF_C); if (*attr == 0 && fill_vert == ' ') return '|'; else return fill_vert; } -#endif /* * Return TRUE if redrawing should currently be done. */ int -redrawing() +redrawing(void) { - return (!RedrawingDisabled +#ifdef FEAT_EVAL + if (disable_redraw_for_testing) + return 0; + else +#endif + return (!RedrawingDisabled && !(p_lz && char_avail() && !KeyTyped && !do_redraw)); } @@ -10351,32 +10849,97 @@ redrawing() * Return TRUE if printing messages should currently be done. */ int -messaging() +messaging(void) { return (!(p_lz && char_avail() && !KeyTyped)); } +#ifdef FEAT_MENU +/* + * Draw the window toolbar. + */ + static void +redraw_win_toolbar(win_T *wp) +{ + vimmenu_T *menu; + int item_idx = 0; + int item_count = 0; + int col = 0; + int next_col; + int off = (int)(current_ScreenLine - ScreenLines); + int fill_attr = syn_name2attr((char_u *)"ToolbarLine"); + int button_attr = syn_name2attr((char_u *)"ToolbarButton"); + + vim_free(wp->w_winbar_items); + for (menu = wp->w_winbar->children; menu != NULL; menu = menu->next) + ++item_count; + wp->w_winbar_items = (winbar_item_T *)alloc_clear( + (unsigned)sizeof(winbar_item_T) * (item_count + 1)); + + /* TODO: use fewer spaces if there is not enough room */ + for (menu = wp->w_winbar->children; + menu != NULL && col < wp->w_width; menu = menu->next) + { + space_to_screenline(off + col, fill_attr); + if (++col >= wp->w_width) + break; + if (col > 1) + { + space_to_screenline(off + col, fill_attr); + if (++col >= wp->w_width) + break; + } + + wp->w_winbar_items[item_idx].wb_startcol = col; + space_to_screenline(off + col, button_attr); + if (++col >= wp->w_width) + break; + + next_col = text_to_screenline(wp, menu->name, col); + while (col < next_col) + { + ScreenAttrs[off + col] = button_attr; + ++col; + } + wp->w_winbar_items[item_idx].wb_endcol = col; + wp->w_winbar_items[item_idx].wb_menu = menu; + ++item_idx; + + if (col >= wp->w_width) + break; + space_to_screenline(off + col, button_attr); + ++col; + } + while (col < wp->w_width) + { + space_to_screenline(off + col, fill_attr); + ++col; + } + wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */ + + screen_line(wp->w_winrow, wp->w_wincol, (int)wp->w_width, + (int)wp->w_width, FALSE); +} +#endif + /* * Show current status info in ruler and various other places * If always is FALSE, only show ruler if position has changed. */ void -showruler(always) - int always; +showruler(int always) { if (!always && !redrawing()) return; #ifdef FEAT_INS_EXPAND if (pum_visible()) { -# ifdef FEAT_WINDOWS /* Don't redraw right now, do it later. */ curwin->w_redr_status = TRUE; -# endif return; } #endif -#if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS) +#if defined(FEAT_STL_OPT) if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) { redraw_custom_statusline(curwin); @@ -10384,7 +10947,7 @@ showruler(always) else #endif #ifdef FEAT_CMDL_INFO - win_redr_ruler(curwin, always); + win_redr_ruler(curwin, always, FALSE); #endif #ifdef FEAT_TITLE @@ -10396,18 +10959,14 @@ showruler(always) ) maketitle(); #endif -#ifdef FEAT_WINDOWS /* Redraw the tab pages line if needed. */ if (redraw_tabline) draw_tabline(); -#endif } #ifdef FEAT_CMDL_INFO static void -win_redr_ruler(wp, always) - win_T *wp; - int always; +win_redr_ruler(win_T *wp, int always, int ignore_pum) { #define RULER_BUF_LEN 70 char_u buffer[RULER_BUF_LEN]; @@ -10419,17 +10978,9 @@ win_redr_ruler(wp, always) int i; size_t len; int o; -#ifdef FEAT_VERTSPLIT int this_ru_col; int off = 0; int width = Columns; -# define WITH_OFF(x) x -# define WITH_WIDTH(x) x -#else -# define WITH_OFF(x) 0 -# define WITH_WIDTH(x) Columns -# define this_ru_col ru_col -#endif /* If 'ruler' off or redrawing disabled, don't do anything */ if (!p_ru) @@ -10445,13 +10996,12 @@ win_redr_ruler(wp, always) #ifdef FEAT_INS_EXPAND /* Don't draw the ruler while doing insert-completion, it might overwrite * the (long) mode message. */ -# ifdef FEAT_WINDOWS if (wp == lastwin && lastwin->w_status_height == 0) -# endif if (edit_submode != NULL) return; - /* Don't draw the ruler when the popup menu is visible, it may overlap. */ - if (pum_visible()) + // Don't draw the ruler when the popup menu is visible, it may overlap. + // Except when the popup menu will be redrawn anyway. + if (!ignore_pum && pum_visible()) return; #endif @@ -10497,26 +11047,20 @@ win_redr_ruler(wp, always) || empty_line != wp->w_ru_empty) { cursor_off(); -#ifdef FEAT_WINDOWS if (wp->w_status_height) { row = W_WINROW(wp) + wp->w_height; - fillchar = fillchar_status(&attr, wp == curwin); -# ifdef FEAT_VERTSPLIT - off = W_WINCOL(wp); - width = W_WIDTH(wp); -# endif + fillchar = fillchar_status(&attr, wp); + off = wp->w_wincol; + width = wp->w_width; } else -#endif { row = Rows - 1; fillchar = ' '; attr = 0; -#ifdef FEAT_VERTSPLIT width = Columns; off = 0; -#endif } /* In list mode virtcol needs to be recomputed */ @@ -10549,22 +11093,19 @@ win_redr_ruler(wp, always) i = (int)STRLEN(buffer); get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1); o = i + vim_strsize(buffer + i + 1); -#ifdef FEAT_WINDOWS if (wp->w_status_height == 0) /* can't use last char of screen */ -#endif ++o; -#ifdef FEAT_VERTSPLIT this_ru_col = ru_col - (Columns - width); if (this_ru_col < 0) this_ru_col = 0; -#endif /* Never use more than half the window/screen width, leave the other * half for the filename. */ - if (this_ru_col < (WITH_WIDTH(width) + 1) / 2) - this_ru_col = (WITH_WIDTH(width) + 1) / 2; - if (this_ru_col + o < WITH_WIDTH(width)) + if (this_ru_col < (width + 1) / 2) + this_ru_col = (width + 1) / 2; + if (this_ru_col + o < width) { - while (this_ru_col + o < WITH_WIDTH(width)) + /* need at least 3 chars left for get_rel_pos() + NUL */ + while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) { #ifdef FEAT_MBYTE if (has_mbyte) @@ -10584,7 +11125,7 @@ win_redr_ruler(wp, always) for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) { o += (*mb_ptr2cells)(buffer + i); - if (this_ru_col + o > WITH_WIDTH(width)) + if (this_ru_col + o > width) { buffer[i] = NUL; break; @@ -10593,14 +11134,14 @@ win_redr_ruler(wp, always) } else #endif - if (this_ru_col + (int)STRLEN(buffer) > WITH_WIDTH(width)) - buffer[WITH_WIDTH(width) - this_ru_col] = NUL; + if (this_ru_col + (int)STRLEN(buffer) > width) + buffer[width - this_ru_col] = NUL; - screen_puts(buffer, row, this_ru_col + WITH_OFF(off), attr); + screen_puts(buffer, row, this_ru_col + off, attr); i = redraw_cmdline; screen_fill(row, row + 1, - this_ru_col + WITH_OFF(off) + (int)STRLEN(buffer), - (int)(WITH_OFF(off) + WITH_WIDTH(width)), + this_ru_col + off + (int)STRLEN(buffer), + (int)(off + width), fillchar, fillchar, attr); /* don't redraw the cmdline because of showing the ruler */ redraw_cmdline = i; @@ -10623,8 +11164,7 @@ win_redr_ruler(wp, always) * Otherwise it depends on 'numberwidth' and the line count. */ int -number_width(wp) - win_T *wp; +number_width(win_T *wp) { int n; linenr_T lnum; @@ -10636,7 +11176,7 @@ number_width(wp) /* cursor line shows absolute line number */ lnum = wp->w_buffer->b_ml.ml_line_count; - if (lnum == wp->w_nrwidth_line_count) + if (lnum == wp->w_nrwidth_line_count && wp->w_nuw_cached == wp->w_p_nuw) return wp->w_nrwidth_width; wp->w_nrwidth_line_count = lnum; @@ -10652,6 +11192,7 @@ number_width(wp) n = wp->w_p_nuw - 1; wp->w_nrwidth_width = n; + wp->w_nuw_cached = wp->w_p_nuw; return n; } #endif @@ -10661,7 +11202,7 @@ number_width(wp) * screen. First column is 0. */ int -screen_screencol() +screen_screencol(void) { return screen_cur_col; } @@ -10671,7 +11212,7 @@ screen_screencol() * First row is 0. */ int -screen_screenrow() +screen_screenrow(void) { return screen_cur_row; } diff --git a/src/search.c b/src/search.c index fc3a2d78e9..96f074b9bb 100644 --- a/src/search.c +++ b/src/search.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -12,27 +12,26 @@ #include "vim.h" -static void save_re_pat __ARGS((int idx, char_u *pat, int magic)); #ifdef FEAT_EVAL -static void set_vv_searchforward __ARGS((void)); -static int first_submatch __ARGS((regmmatch_T *rp)); -#endif -static int check_prevcol __ARGS((char_u *linep, int col, int ch, int *prevcol)); -static int inmacro __ARGS((char_u *, char_u *)); -static int check_linecomment __ARGS((char_u *line)); -static int cls __ARGS((void)); -static int skip_chars __ARGS((int, int)); +static void set_vv_searchforward(void); +static int first_submatch(regmmatch_T *rp); +#endif +static int check_prevcol(char_u *linep, int col, int ch, int *prevcol); +static int inmacro(char_u *, char_u *); +static int check_linecomment(char_u *line); +static int cls(void); +static int skip_chars(int, int); #ifdef FEAT_TEXTOBJ -static void back_in_line __ARGS((void)); -static void find_first_blank __ARGS((pos_T *)); -static void findsent_forward __ARGS((long count, int at_start_sent)); +static void back_in_line(void); +static void find_first_blank(pos_T *); +static void findsent_forward(long count, int at_start_sent); #endif #ifdef FEAT_FIND_ID -static void show_pat_in_path __ARGS((char_u *, int, - int, int, FILE *, linenr_T *, long)); +static void show_pat_in_path(char_u *, int, + int, int, FILE *, linenr_T *, long); #endif #ifdef FEAT_VIMINFO -static void wvsp_one __ARGS((FILE *fp, int idx, char *s, int sc)); +static void wvsp_one(FILE *fp, int idx, char *s, int sc); #endif /* @@ -90,14 +89,23 @@ static struct spat spats[2] = static int last_idx = 0; /* index in spats[] for RE_LAST */ -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) +static char_u lastc[2] = {NUL, NUL}; /* last character searched for */ +static int lastcdir = FORWARD; /* last direction of character search */ +static int last_t_cmd = TRUE; /* last search t_cmd */ +#ifdef FEAT_MBYTE +static char_u lastc_bytes[MB_MAXBYTES + 1]; +static int lastc_bytelen = 1; /* >1 for multi-byte char */ +#endif + /* copy of spats[], for keeping the search patterns while executing autocmds */ static struct spat saved_spats[2]; -static int saved_last_idx = 0; # ifdef FEAT_SEARCH_EXTRA +/* copy of spats[RE_SEARCH], for keeping the search patterns while incremental + * searching */ +static struct spat saved_last_search_spat; +static int saved_last_idx = 0; static int saved_no_hlsearch = 0; # endif -#endif static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */ #ifdef FEAT_RIGHTLEFT @@ -133,12 +141,12 @@ typedef struct SearchedFile * returns FAIL if failed, OK otherwise. */ int -search_regcomp(pat, pat_save, pat_use, options, regmatch) - char_u *pat; - int pat_save; - int pat_use; - int options; - regmmatch_T *regmatch; /* return: pattern and ignore-case flag */ +search_regcomp( + char_u *pat, + int pat_save, + int pat_use, + int options, + regmmatch_T *regmatch) /* return: pattern and ignore-case flag */ { int magic; int i; @@ -223,7 +231,7 @@ search_regcomp(pat, pat_save, pat_use, options, regmatch) * Get search pattern used by search_regcomp(). */ char_u * -get_search_pat() +get_search_pat(void) { return mr_pattern; } @@ -234,8 +242,7 @@ get_search_pat() * Returns the allocated string, NULL when out of memory. */ char_u * -reverse_text(s) - char_u *s; +reverse_text(char_u *s) { unsigned len; unsigned s_i, rev_i; @@ -272,11 +279,8 @@ reverse_text(s) } #endif - static void -save_re_pat(idx, pat, magic) - int idx; - char_u *pat; - int magic; + void +save_re_pat(int idx, char_u *pat, int magic) { if (spats[idx].pat != pat) { @@ -293,12 +297,11 @@ save_re_pat(idx, pat, magic) /* If 'hlsearch' set and search pat changed: need redraw. */ if (p_hls) redraw_all_later(SOME_VALID); - SET_NO_HLSEARCH(FALSE); + set_no_hlsearch(FALSE); #endif } } -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save the search patterns, so they can be restored later. * Used before/after executing autocommands and user functions. @@ -306,7 +309,7 @@ save_re_pat(idx, pat, magic) static int save_level = 0; void -save_search_patterns() +save_search_patterns(void) { if (save_level++ == 0) { @@ -316,15 +319,15 @@ save_search_patterns() saved_spats[1] = spats[1]; if (spats[1].pat != NULL) saved_spats[1].pat = vim_strsave(spats[1].pat); +#ifdef FEAT_SEARCH_EXTRA saved_last_idx = last_idx; -# ifdef FEAT_SEARCH_EXTRA saved_no_hlsearch = no_hlsearch; -# endif +#endif } } void -restore_search_patterns() +restore_search_patterns(void) { if (--save_level == 0) { @@ -335,17 +338,16 @@ restore_search_patterns() #endif vim_free(spats[1].pat); spats[1] = saved_spats[1]; +#ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; -# ifdef FEAT_SEARCH_EXTRA - SET_NO_HLSEARCH(saved_no_hlsearch); -# endif + set_no_hlsearch(saved_no_hlsearch); +#endif } } -#endif #if defined(EXITFREE) || defined(PROTO) void -free_search_patterns() +free_search_patterns(void) { vim_free(spats[0].pat); vim_free(spats[1].pat); @@ -361,19 +363,65 @@ free_search_patterns() } #endif +#ifdef FEAT_SEARCH_EXTRA +/* + * Save and restore the search pattern for incremental highlight search + * feature. + * + * It's similar but differnt from save_search_patterns() and + * restore_search_patterns(), because the search pattern must be restored when + * cannceling incremental searching even if it's called inside user functions. + */ + void +save_last_search_pattern(void) +{ + saved_last_search_spat = spats[RE_SEARCH]; + if (spats[RE_SEARCH].pat != NULL) + saved_last_search_spat.pat = vim_strsave(spats[RE_SEARCH].pat); + saved_last_idx = last_idx; + saved_no_hlsearch = no_hlsearch; +} + + void +restore_last_search_pattern(void) +{ + vim_free(spats[RE_SEARCH].pat); + spats[RE_SEARCH] = saved_last_search_spat; +# if defined(FEAT_EVAL) + set_vv_searchforward(); +# endif + last_idx = saved_last_idx; + set_no_hlsearch(saved_no_hlsearch); +} + + char_u * +last_search_pattern(void) +{ + return spats[RE_SEARCH].pat; +} +#endif + /* * Return TRUE when case should be ignored for search pattern "pat". * Uses the 'ignorecase' and 'smartcase' options. */ int -ignorecase(pat) - char_u *pat; +ignorecase(char_u *pat) +{ + return ignorecase_opt(pat, p_ic, p_scs); +} + +/* + * As ignorecase() put pass the "ic" and "scs" flags. + */ + int +ignorecase_opt(char_u *pat, int ic_in, int scs) { - int ic = p_ic; + int ic = ic_in; - if (ic && !no_smartcase && p_scs + if (ic && !no_smartcase && scs #ifdef FEAT_INS_EXPAND - && !(ctrl_x_mode && curbuf->b_p_inf) + && !(ctrl_x_mode_not_default() && curbuf->b_p_inf) #endif ) ic = !pat_has_uppercase(pat); @@ -383,11 +431,10 @@ ignorecase(pat) } /* - * Return TRUE if patter "pat" has an uppercase character. + * Return TRUE if pattern "pat" has an uppercase character. */ int -pat_has_uppercase(pat) - char_u *pat; +pat_has_uppercase(char_u *pat) { char_u *p = pat; @@ -424,7 +471,54 @@ pat_has_uppercase(pat) } char_u * -last_search_pat() +last_csearch(void) +{ +#ifdef FEAT_MBYTE + return lastc_bytes; +#else + return lastc; +#endif +} + + int +last_csearch_forward(void) +{ + return lastcdir == FORWARD; +} + + int +last_csearch_until(void) +{ + return last_t_cmd == TRUE; +} + + void +set_last_csearch(int c, char_u *s UNUSED, int len UNUSED) +{ + *lastc = c; +#ifdef FEAT_MBYTE + lastc_bytelen = len; + if (len) + memcpy(lastc_bytes, s, len); + else + vim_memset(lastc_bytes, 0, sizeof(lastc_bytes)); +#endif +} + + void +set_csearch_direction(int cdir) +{ + lastcdir = cdir; +} + + void +set_csearch_until(int t_cmd) +{ + last_t_cmd = t_cmd; +} + + char_u * +last_search_pat(void) { return spats[last_idx].pat; } @@ -433,7 +527,7 @@ last_search_pat() * Reset search direction to forward. For "gd" and "gD" commands. */ void -reset_search_dir() +reset_search_dir(void) { spats[0].off.dir = '/'; #if defined(FEAT_EVAL) @@ -447,11 +541,11 @@ reset_search_dir() * Also set the saved search pattern, so that this works in an autocommand. */ void -set_last_search_pat(s, idx, magic, setlast) - char_u *s; - int idx; - int magic; - int setlast; +set_last_search_pat( + char_u *s, + int idx, + int magic, + int setlast) { #if FEAT_GUI_MACVIM if (RE_SEARCH == idx) @@ -500,8 +594,7 @@ set_last_search_pat(s, idx, magic, setlast) * Values returned in regmatch->regprog and regmatch->rmm_ic. */ void -last_pat_prog(regmatch) - regmmatch_T *regmatch; +last_pat_prog(regmmatch_T *regmatch) { if (spats[last_idx].pat == NULL) { @@ -528,27 +621,36 @@ last_pat_prog(regmatch) * if (options & SEARCH_KEEP) keep previous search pattern * if (options & SEARCH_FOLD) match only once in a closed fold * if (options & SEARCH_PEEK) check for typed char, cancel search + * if (options & SEARCH_COL) start at pos->col instead of zero * * Return FAIL (zero) for failure, non-zero for success. * When FEAT_EVAL is defined, returns the index of the first matching * subpattern plus one; one if there was none. */ +#ifndef USE_MIGEMO int -searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) - win_T *win; /* window to search in; can be NULL for a +searchit +#else + static int +searchit_original /* renamed from "searchit" (USE_MIGEMO) */ +#endif +( + win_T *win, /* window to search in; can be NULL for a buffer without a window! */ - buf_T *buf; - pos_T *pos; - int dir; - char_u *pat; - long count; - int options; - int pat_use; /* which pattern to use when "pat" is empty */ - linenr_T stop_lnum; /* stop after this line number when != 0 */ - proftime_T *tm UNUSED; /* timeout limit or NULL */ + buf_T *buf, + pos_T *pos, + int dir, + char_u *pat, + long count, + int options, + int pat_use, /* which pattern to use when "pat" is empty */ + linenr_T stop_lnum, /* stop after this line number when != 0 */ + proftime_T *tm UNUSED, /* timeout limit or NULL */ + int *timed_out UNUSED) /* set when timed out or NULL */ { int found; linenr_T lnum; /* no init to shut up Apollo cc */ + colnr_T col; regmmatch_T regmatch; char_u *ptr; colnr_T matchcol; @@ -558,9 +660,11 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) pos_T start_pos; int at_first_line; int extra_col; + int start_char_len; int match_ok; long nmatched; int submatch = 0; + int first_match = TRUE; int save_called_emsg = called_emsg; #ifdef FEAT_SEARCH_EXTRA int break_loop = FALSE; @@ -574,33 +678,47 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) return FAIL; } - /* When not accepting a match at the start position set "extra_col" to a - * non-zero value. Don't do that when starting at MAXCOL, since MAXCOL + - * 1 is zero. */ - if ((options & SEARCH_START) || pos->col == MAXCOL) - extra_col = 0; -#ifdef FEAT_MBYTE - /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */ - else if (dir != BACKWARD && has_mbyte - && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count - && pos->col < MAXCOL - 2) - { - ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col; - if (*ptr == NUL) - extra_col = 1; - else - extra_col = (*mb_ptr2len)(ptr); - } -#endif - else - extra_col = 1; - /* * find the string */ called_emsg = FALSE; do /* loop for count */ { + /* When not accepting a match at the start position set "extra_col" to + * a non-zero value. Don't do that when starting at MAXCOL, since + * MAXCOL + 1 is zero. */ + if (pos->col == MAXCOL) + start_char_len = 0; +#ifdef FEAT_MBYTE + /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */ + else if (has_mbyte + && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count + && pos->col < MAXCOL - 2) + { + ptr = ml_get_buf(buf, pos->lnum, FALSE); + if ((int)STRLEN(ptr) <= pos->col) + start_char_len = 1; + else + start_char_len = (*mb_ptr2len)(ptr + pos->col); + } +#endif + else + start_char_len = 1; + if (dir == FORWARD) + { + if (options & SEARCH_START) + extra_col = 0; + else + extra_col = start_char_len; + } + else + { + if (options & SEARCH_START) + extra_col = start_char_len; + else + extra_col = 0; + } + start_pos = *pos; /* remember start pos for detecting no match */ found = 0; /* default: not found */ at_first_line = TRUE; /* default: start in first line */ @@ -645,16 +763,22 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) /* * Look for a match somewhere in line "lnum". */ + col = at_first_line && (options & SEARCH_COL) ? pos->col + : (colnr_T)0; nmatched = vim_regexec_multi(®match, win, buf, - lnum, (colnr_T)0, + lnum, col, #ifdef FEAT_RELTIME - tm + tm, timed_out #else - NULL + NULL, NULL #endif ); /* Abort searching on an error (e.g., out of stack). */ - if (called_emsg) + if (called_emsg +#ifdef FEAT_RELTIME + || (timed_out != NULL && *timed_out) +#endif + ) break; if (nmatched > 0) { @@ -686,7 +810,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) * otherwise "/$" will get stuck on end of line. */ while (matchpos.lnum == 0 - && ((options & SEARCH_END) + && ((options & SEARCH_END) && first_match ? (nmatched == 1 && (int)endpos.col - 1 < (int)start_pos.col + extra_col) @@ -743,9 +867,9 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) win, buf, lnum + matchpos.lnum, matchcol, #ifdef FEAT_RELTIME - tm + tm, timed_out #else - NULL + NULL, NULL #endif )) == 0) { @@ -788,15 +912,15 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) || (lnum + regmatch.endpos[0].lnum == start_pos.lnum && (int)regmatch.endpos[0].col - 1 - + extra_col - <= (int)start_pos.col)) + < (int)start_pos.col + + extra_col)) : (lnum + regmatch.startpos[0].lnum < start_pos.lnum || (lnum + regmatch.startpos[0].lnum == start_pos.lnum && (int)regmatch.startpos[0].col - + extra_col - <= (int)start_pos.col)))) + < (int)start_pos.col + + extra_col)))) { match_ok = TRUE; matchpos = regmatch.startpos[0]; @@ -855,12 +979,21 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) win, buf, lnum + matchpos.lnum, matchcol, #ifdef FEAT_RELTIME - tm + tm, timed_out #else - NULL + NULL, NULL #endif )) == 0) + { +#ifdef FEAT_RELTIME + /* If the search timed out, we did find a match + * but it might be the wrong one, so that's not + * OK. */ + if (timed_out != NULL && *timed_out) + match_ok = FALSE; +#endif break; + } /* Need to get the line pointer again, a * multi-line search may have made it invalid. */ @@ -917,6 +1050,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) pos->coladd = 0; #endif found = 1; + first_match = FALSE; /* Set variables used for 'incsearch' highlighting. */ search_match_lines = endpos.lnum - matchpos.lnum; @@ -951,10 +1085,13 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) * twice. */ if (!p_ws || stop_lnum != 0 || got_int || called_emsg +#ifdef FEAT_RELTIME + || (timed_out != NULL && *timed_out) +#endif #ifdef FEAT_SEARCH_EXTRA - || break_loop + || break_loop #endif - || found || loop) + || found || loop) break; /* @@ -973,6 +1110,9 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) ? top_bot_msg : bot_top_msg), TRUE); } if (got_int || called_emsg +#ifdef FEAT_RELTIME + || (timed_out != NULL && *timed_out) +#endif #ifdef FEAT_SEARCH_EXTRA || break_loop #endif @@ -1017,24 +1157,23 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) #ifdef FEAT_EVAL void -set_search_direction(cdir) - int cdir; +set_search_direction(int cdir) { spats[0].off.dir = cdir; } static void -set_vv_searchforward() +set_vv_searchforward(void) { set_vim_var_nr(VV_SEARCHFORWARD, (long)(spats[0].off.dir == '/')); } /* * Return the number of the first subpat that matched. + * Return zero if none of them matched. */ static int -first_submatch(rp) - regmmatch_T *rp; +first_submatch(regmmatch_T *rp) { int submatch; @@ -1052,6 +1191,350 @@ first_submatch(rp) } #endif +#ifdef USE_MIGEMO +# define MIGEMO_QUERY_MAXSIZE 40960 +/* Load migemo header */ +# ifndef DYNAMIC_MIGEMO +# include <migemo.h> +# else /* DYNAMIC_MIGEMO */ + +# define MIGEMO_PROC FARPROC +# ifndef DYNAMIC_MIGEMO_DLL +# define DYNAMIC_MIGEMO_DLL "migemo.dll" +# endif + +# define MIGEMO_OPINDEX_OR 0 +# define MIGEMO_OPINDEX_NEST_IN 1 +# define MIGEMO_OPINDEX_NEST_OUT 2 +# define MIGEMO_OPINDEX_SELECT_IN 3 +# define MIGEMO_OPINDEX_SELECT_OUT 4 +# define MIGEMO_OPINDEX_NEWLINE 5 + +typedef struct _migemo migemo; +typedef int (*MIGEMO_PROC_CHAR2INT)(unsigned char*, unsigned int*); +typedef int (*MIGEMO_PROC_INT2CHAR)(unsigned int, unsigned char*); +static HANDLE hDllMigemo = NULL; +migemo* (__stdcall *dll_migemo_open)(char*); +void (__stdcall *dll_migemo_close)(migemo*); +unsigned char* (__stdcall *dll_migemo_query)(migemo*, unsigned char*); +void (__stdcall *dll_migemo_release)(migemo*, unsigned char*); +int (__stdcall *dll_migemo_set_operator)(migemo*, int index, unsigned char* op); +const unsigned char* (__stdcall *dll_migemo_get_operator)(migemo*, int index); +void (__stdcall *dll_migemo_setproc_char2int)(migemo*, MIGEMO_PROC_CHAR2INT); +void (__stdcall *dll_migemo_setproc_int2char)(migemo*, MIGEMO_PROC_INT2CHAR); + +# define migemo_open dll_migemo_open +# define migemo_close dll_migemo_close +# define migemo_query dll_migemo_query +# define migemo_release dll_migemo_release +# define migemo_set_operator dll_migemo_set_operator +# define migemo_get_operator dll_migemo_get_operator +# define migemo_setproc_char2int dll_migemo_setproc_char2int +# define migemo_setproc_int2char dll_migemo_setproc_int2char + + static void +dyn_migemo_end() +{ + if (hDllMigemo) + { + FreeLibrary(hDllMigemo); + hDllMigemo = NULL; + } +} + + static int +dyn_migemo_init() +{ + static struct { char* name; MIGEMO_PROC* ptr; } migemo_func_table[] = { + {"migemo_open", (MIGEMO_PROC*)&dll_migemo_open}, + {"migemo_close", (MIGEMO_PROC*)&dll_migemo_close}, + {"migemo_query", (MIGEMO_PROC*)&dll_migemo_query}, + {"migemo_release", (MIGEMO_PROC*)&dll_migemo_release}, + {"migemo_set_operator", (MIGEMO_PROC*)&dll_migemo_set_operator}, + {"migemo_get_operator", (MIGEMO_PROC*)&dll_migemo_get_operator}, + {"migemo_setproc_char2int", (MIGEMO_PROC*)&dll_migemo_setproc_char2int}, + {"migemo_setproc_int2char", (MIGEMO_PROC*)&dll_migemo_setproc_int2char}, + {NULL, NULL}, + }; + int i; + + if (hDllMigemo) + return 1; + if (!(hDllMigemo = LoadLibraryEx(DYNAMIC_MIGEMO_DLL, NULL, 0))) + return 0; + for (i = 0; migemo_func_table[i].ptr; ++i) + { + if (!(*migemo_func_table[i].ptr = GetProcAddress(hDllMigemo, + migemo_func_table[i].name))) + { + dyn_migemo_end(); + return 0; + } + } + return 1; +} +# endif /* DYNAMIC_MIGEMO */ + + static int +vimigemo_char2int(unsigned char* p, unsigned int* code) +{ + unsigned int ch = *p; + int len = 1; + +#ifdef FEAT_MBYTE + if (has_mbyte) + { + ch = (*mb_ptr2char)(p); + len = (*mb_ptr2len)(p); + } +#endif + if (code) + *code = ch; + return len; +} + + static int +vimigemo_int2char(unsigned int code, unsigned char* buf) +{ + int len; + +#ifdef FEAT_MBYTE + if (has_mbyte && (len = (*mb_char2len)(code)) != 1) + { + if (buf) + (*mb_char2bytes)(code, buf); + } + else +#endif + { + len = 0; + switch (code) + { + case '\\': + case '.': case '*': case '^': case '$': case '/': + case '[': case ']': case '~': + if (buf) + buf[len] = '\\'; + ++len; + default: + if (buf) + buf[len] = (unsigned char)(code & 0xFF); + ++len; + break; + } + } + + return len; +} + + int +migemo_enabled() +{ + return +#ifdef DYNAMIC_MIGEMO + dyn_migemo_init() +#else + 1 +#endif + ; +} + +static migemo* migemo_object = NULL; +static int migemo_tryload = 0; + + static void +init_migemo() +{ +# ifdef DYNAMIC_MIGEMO + if (!dyn_migemo_init()) + return; +# endif + if (migemo_tryload || migemo_object) + return; + + migemo_tryload = 1; + migemo_object = migemo_open((char *)p_migdict); + + if (!migemo_object) + return; + + migemo_set_operator(migemo_object, + MIGEMO_OPINDEX_OR, (char_u *)"\\|"); + migemo_set_operator(migemo_object, + MIGEMO_OPINDEX_NEST_IN, (char_u *)"\\%("); + migemo_set_operator(migemo_object, + MIGEMO_OPINDEX_NEST_OUT, (char_u *)"\\)"); + migemo_set_operator(migemo_object, + MIGEMO_OPINDEX_NEST_OUT, (char_u *)"\\)"); + migemo_set_operator(migemo_object, + MIGEMO_OPINDEX_NEWLINE, (char_u *)"\\_s*"); + migemo_setproc_int2char(migemo_object, vimigemo_int2char); + migemo_setproc_char2int(migemo_object, + (MIGEMO_PROC_CHAR2INT)vimigemo_char2int); +} + + void +reset_migemo(int lastcall) +{ + if (migemo_object) + migemo_close(migemo_object); + migemo_object = NULL; + migemo_tryload = 0; +# ifdef DYNAMIC_MIGEMO + if (lastcall) + dyn_migemo_end(); +# endif +} + + char_u* +query_migemo(char_u* str) +{ + char_u *retval = NULL; + + if (str) + { + init_migemo(); + if (migemo_object) + { + char_u *query = migemo_query(migemo_object, str); + + if (query != NULL) + { + retval = vim_strsave(query); + migemo_release(migemo_object, query); + } + } + } + return retval ? retval : str; +} + + int +check_migemo_able_string(char_u* str) +{ + size_t len; + + len = STRLEN(str); + /* Disabled because of adding query size limitation. */ +#if 0 + if (len == 1 && vim_strchr("kstnKSTN", str[0])) + return 0; +#endif + /* TODO: Incomplete method. To be improved. */ + if (len >= 1 && (vim_strchr(str, '^'))) + return 0; + if (len >= 2 && !STRNCMP(str, "\\<", 2)) + return 0; + /* Search for multibyte char */ +#ifdef FEAT_MBYTE + if (has_mbyte) + while (*str) + { + if ((*mb_ptr2len)(str) > 1) + return 0; + ++str; + } +#endif + return 1; +} + +/* + * Search with migemo, mimic of searchit() + */ + static int +searchit_migemo( + win_T *win, + buf_T *buf, + pos_T *pos, + int dir, + char_u *str, + long count, + int options, + int pat_use, + linenr_T stop_lnum, + proftime_T* tm, + int *timed_out, + int *did) +{ + int retval = 0; + int didval = 0; + + if (str && buf && STRLEN(p_migdict) > 0 && check_migemo_able_string(str)) + { + init_migemo(); + if (migemo_object) + { + char_u *query; + char_u *newstr = NULL; + + /* Remove backslash in str */ + if (vim_strchr(str, '\\') && (newstr = vim_strsave(str))) + { + char_u *p, *end = newstr + STRLEN(newstr); + + for (p = newstr; p[0] != NUL; ++p) + { + if ((p = vim_strchr(p, '\\')) == NULL) + break; + mch_memmove(p, p + 1, end - p); + } + str = newstr; + } + query = migemo_query(migemo_object, str); + if (query && STRLEN(query) < MIGEMO_QUERY_MAXSIZE) + { + retval = searchit_original(win, buf, pos, dir, query, count, + options, pat_use, stop_lnum, tm, timed_out); + didval = 1; + } + if (query) + migemo_release(migemo_object, query); + if (newstr) + vim_free(newstr); + } + } + + if (did) + *did = didval; + return retval; +} + +/* + * wrapper of searchit_original(). + * + * This extends original one to accept SEARCH_MIGEMO for options. + * If this flag is set, migemo feature is enabled for the search. + */ + int +searchit( + win_T *win, + buf_T *buf, + pos_T *pos, + int dir, + char_u *pat, + long count, + int options, + int pat_use, + linenr_T stop_lnum, + proftime_T *tm UNUSED, + int *timed_out UNUSED) +{ + if (options & SEARCH_MIGEMO) + { + int did = 0; + int ret; + + options &= ~SEARCH_MIGEMO; + ret = searchit_migemo(win, buf, pos, dir, pat, count, options, pat_use, + stop_lnum, tm, timed_out, &did); + if (did) + return ret; + } + return searchit_original(win, buf, pos, dir, pat, count, options, pat_use, + stop_lnum, tm, timed_out); +} + +#endif /* USE_MIGEMO */ + /* * Highest level string search function. * Search for the 'count'th occurrence of pattern 'pat' in direction 'dirc' @@ -1071,16 +1554,17 @@ first_submatch(rp) * Careful: If spats[0].off.line == TRUE and spats[0].off.off == 0 this * makes the movement linewise without moving the match position. * - * return 0 for failure, 1 for found, 2 for found and line offset added + * Return 0 for failure, 1 for found, 2 for found and line offset added. */ int -do_search(oap, dirc, pat, count, options, tm) - oparg_T *oap; /* can be NULL */ - int dirc; /* '/' or '?' */ - char_u *pat; - long count; - int options; - proftime_T *tm; /* timeout limit or NULL */ +do_search( + oparg_T *oap, /* can be NULL */ + int dirc, /* '/' or '?' */ + char_u *pat, + long count, + int options, + proftime_T *tm, /* timeout limit or NULL */ + int *timed_out) /* flag set on timeout or NULL */ { pos_T pos; /* position of the last match */ char_u *searchstr; @@ -1157,7 +1641,7 @@ do_search(oap, dirc, pat, count, options, tm) if (no_hlsearch && !(options & SEARCH_KEEP)) { redraw_all_later(SOME_VALID); - SET_NO_HLSEARCH(FALSE); + set_no_hlsearch(FALSE); } #endif @@ -1173,14 +1657,13 @@ do_search(oap, dirc, pat, count, options, tm) { if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */ { - pat = spats[RE_SUBST].pat; - if (pat == NULL) + searchstr = spats[RE_SUBST].pat; + if (searchstr == NULL) { EMSG(_(e_noprevre)); retval = 0; goto end_do_search; } - searchstr = pat; } else { @@ -1366,8 +1849,11 @@ do_search(oap, dirc, pat, count, options, tm) searchstr, count, spats[0].off.end + (options & (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS + SEARCH_MSG + SEARCH_START +#ifdef USE_MIGEMO + + SEARCH_MIGEMO +#endif + ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))), - RE_LAST, (linenr_T)0, tm); + RE_LAST, (linenr_T)0, tm, timed_out); if (dircp != NULL) *dircp = dirc; /* restore second '/' or '?' for normal_cmd() */ @@ -1458,17 +1944,17 @@ do_search(oap, dirc, pat, count, options, tm) * search_for_exact_line(buf, pos, dir, pat) * * Search for a line starting with the given pattern (ignoring leading - * white-space), starting from pos and going in direction dir. pos will + * white-space), starting from pos and going in direction "dir". "pos" will * contain the position of the match found. Blank lines match only if - * ADDING is set. if p_ic is set then the pattern must be in lowercase. + * ADDING is set. If p_ic is set then the pattern must be in lowercase. * Return OK for success, or FAIL if no line found. */ int -search_for_exact_line(buf, pos, dir, pat) - buf_T *buf; - pos_T *pos; - int dir; - char_u *pat; +search_for_exact_line( + buf_T *buf, + pos_T *pos, + int dir, + char_u *pat) { linenr_T start = 0; char_u *ptr; @@ -1545,54 +2031,51 @@ search_for_exact_line(buf, pos, dir, pat) * Return FAIL or OK. */ int -searchc(cap, t_cmd) - cmdarg_T *cap; - int t_cmd; +searchc(cmdarg_T *cap, int t_cmd) { int c = cap->nchar; /* char to search for */ int dir = cap->arg; /* TRUE for searching forward */ long count = cap->count1; /* repeat count */ - static int lastc = NUL; /* last character searched for */ - static int lastcdir; /* last direction of character search */ - static int last_t_cmd; /* last search t_cmd */ int col; char_u *p; int len; int stop = TRUE; -#ifdef FEAT_MBYTE - static char_u bytes[MB_MAXBYTES + 1]; - static int bytelen = 1; /* >1 for multi-byte char */ -#endif if (c != NUL) /* normal search: remember args for repeat */ { if (!KeyStuffed) /* don't remember when redoing */ { - lastc = c; - lastcdir = dir; - last_t_cmd = t_cmd; + *lastc = c; + set_csearch_direction(dir); + set_csearch_until(t_cmd); #ifdef FEAT_MBYTE - bytelen = (*mb_char2bytes)(c, bytes); + lastc_bytelen = (*mb_char2bytes)(c, lastc_bytes); if (cap->ncharC1 != 0) { - bytelen += (*mb_char2bytes)(cap->ncharC1, bytes + bytelen); + lastc_bytelen += (*mb_char2bytes)(cap->ncharC1, + lastc_bytes + lastc_bytelen); if (cap->ncharC2 != 0) - bytelen += (*mb_char2bytes)(cap->ncharC2, bytes + bytelen); + lastc_bytelen += (*mb_char2bytes)(cap->ncharC2, + lastc_bytes + lastc_bytelen); } #endif } } else /* repeat previous search */ { - if (lastc == NUL) + if (*lastc == NUL +#ifdef FEAT_MBYTE + && lastc_bytelen == 1 +#endif + ) return FAIL; if (dir) /* repeat in opposite direction */ dir = -lastcdir; else dir = lastcdir; t_cmd = last_t_cmd; - c = lastc; - /* For multi-byte re-use last bytes[] and bytelen. */ + c = *lastc; + /* For multi-byte re-use last lastc_bytes[] and lastc_bytelen. */ /* Force a move of at least one char, so ";" and "," will move the * cursor, even if the cursor is right in front of char we are looking @@ -1629,16 +2112,14 @@ searchc(cap, t_cmd) return FAIL; col -= (*mb_head_off)(p, p + col - 1) + 1; } - if (bytelen == 1) + if (lastc_bytelen == 1) { if (p[col] == c && stop) break; } - else - { - if (vim_memcmp(p + col, bytes, bytelen) == 0 && stop) - break; - } + else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0 + && stop) + break; stop = TRUE; } } @@ -1664,8 +2145,8 @@ searchc(cap, t_cmd) if (has_mbyte) { if (dir < 0) - /* Landed on the search char which is bytelen long */ - col += bytelen - 1; + /* Landed on the search char which is lastc_bytelen long */ + col += lastc_bytelen - 1; else /* To previous char, which may be multi-byte. */ col -= (*mb_head_off)(p, p + col); @@ -1687,9 +2168,7 @@ searchc(cap, t_cmd) * Improvement over vi: Braces inside quotes are ignored. */ pos_T * -findmatch(oap, initc) - oparg_T *oap; - int initc; +findmatch(oparg_T *oap, int initc) { return findmatchlimit(oap, initc, 0, 0); } @@ -1702,11 +2181,11 @@ findmatch(oap, initc) * Handles multibyte string correctly. */ static int -check_prevcol(linep, col, ch, prevcol) - char_u *linep; - int col; - int ch; - int *prevcol; +check_prevcol( + char_u *linep, + int col, + int ch, + int *prevcol) { --col; #ifdef FEAT_MBYTE @@ -1718,35 +2197,84 @@ check_prevcol(linep, col, ch, prevcol) return (col >= 0 && linep[col] == ch) ? TRUE : FALSE; } +static int find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos); + +/* + * Raw string start is found at linep[startpos.col - 1]. + * Return TRUE if the matching end can be found between startpos and endpos. + */ + static int +find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos) +{ + char_u *p; + char_u *delim_copy; + size_t delim_len; + linenr_T lnum; + int found = FALSE; + + for (p = linep + startpos->col + 1; *p && *p != '('; ++p) + ; + delim_len = (p - linep) - startpos->col - 1; + delim_copy = vim_strnsave(linep + startpos->col + 1, (int)delim_len); + if (delim_copy == NULL) + return FALSE; + for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum) + { + char_u *line = ml_get(lnum); + + for (p = line + (lnum == startpos->lnum + ? startpos->col + 1 : 0); *p; ++p) + { + if (lnum == endpos->lnum && (colnr_T)(p - line) >= endpos->col) + break; + if (*p == ')' && p[delim_len + 1] == '"' + && STRNCMP(delim_copy, p + 1, delim_len) == 0) + { + found = TRUE; + break; + } + } + if (found) + break; + } + vim_free(delim_copy); + return found; +} + /* * findmatchlimit -- find the matching paren or brace, if it exists within - * maxtravel lines of here. A maxtravel of 0 means search until falling off - * the edge of the file. + * maxtravel lines of the cursor. A maxtravel of 0 means search until falling + * off the edge of the file. * * "initc" is the character to find a match for. NUL means to find the - * character at or after the cursor. + * character at or after the cursor. Special values: + * '*' look for C-style comment / * + * '/' look for C-style comment / *, ignoring comment-end + * '#' look for preprocessor directives + * 'R' look for raw string start: R"delim(text)delim" (only backwards) * * flags: FM_BACKWARD search backwards (when initc is '/', '*' or '#') * FM_FORWARD search forwards (when initc is '/', '*' or '#') * FM_BLOCKSTOP stop at start/end of block ({ or } in column 0) * FM_SKIPCOMM skip comments (not implemented yet!) * - * "oap" is only used to set oap->motion_type for a linewise motion, it be + * "oap" is only used to set oap->motion_type for a linewise motion, it can be * NULL */ pos_T * -findmatchlimit(oap, initc, flags, maxtravel) - oparg_T *oap; - int initc; - int flags; - int maxtravel; +findmatchlimit( + oparg_T *oap, + int initc, + int flags, + int maxtravel) { static pos_T pos; /* current search position */ int findc = 0; /* matching brace */ int c; int count = 0; /* cumulative number of braces */ int backwards = FALSE; /* init for gcc */ + int raw_string = FALSE; /* search for raw string */ int inquote = FALSE; /* TRUE when inside quotes */ char_u *linep; /* pointer to current line */ char_u *ptr; @@ -1791,12 +2319,13 @@ findmatchlimit(oap, initc, flags, maxtravel) * When '/' is used, we ignore running backwards into an star-slash, for * "[*" command, we just want to find any comment. */ - if (initc == '/' || initc == '*') + if (initc == '/' || initc == '*' || initc == 'R') { comment_dir = dir; if (initc == '/') ignore_cend = TRUE; backwards = (dir == FORWARD) ? FALSE : TRUE; + raw_string = (initc == 'R'); initc = NUL; } else if (initc != '#' && initc != NUL) @@ -1805,12 +2334,12 @@ findmatchlimit(oap, initc, flags, maxtravel) if (findc == NUL) return NULL; } - /* - * Either initc is '#', or no initc was given and we need to look under the - * cursor. - */ else { + /* + * Either initc is '#', or no initc was given and we need to look + * under the cursor. + */ if (initc == '#') { hash_dir = dir; @@ -1991,7 +2520,7 @@ findmatchlimit(oap, initc, flags, maxtravel) do_quotes = -1; start_in_quotes = MAYBE; - clearpos(&match_pos); + CLEAR_POS(&match_pos); /* backward search: Check if this line contains a single-line comment */ if ((backwards && comment_dir) @@ -2124,12 +2653,33 @@ findmatchlimit(oap, initc, flags, maxtravel) { /* * A comment may contain / * or / /, it may also start or end - * with / * /. Ignore a / * after / /. + * with / * /. Ignore a / * after / / and after *. */ if (pos.col == 0) continue; + else if (raw_string) + { + if (linep[pos.col - 1] == 'R' + && linep[pos.col] == '"' + && vim_strchr(linep + pos.col + 1, '(') != NULL) + { + /* Possible start of raw string. Now that we have the + * delimiter we can check if it ends before where we + * started searching, or before the previously found + * raw string start. */ + if (!find_rawstring_end(linep, &pos, + count > 0 ? &match_pos : &curwin->w_cursor)) + { + count++; + match_pos = pos; + match_pos.col--; + } + linep = ml_get(pos.lnum); /* may have been released */ + } + } else if ( linep[pos.col - 1] == '/' && linep[pos.col] == '*' + && (pos.col == 1 || linep[pos.col - 2] != '*') && (int)pos.col < comment_col) { count++; @@ -2364,8 +2914,7 @@ findmatchlimit(oap, initc, flags, maxtravel) * TODO: skip strings. */ static int -check_linecomment(line) - char_u *line; +check_linecomment(char_u *line) { char_u *p; @@ -2425,8 +2974,8 @@ check_linecomment(line) * If there isn't a match, then beep. */ void -showmatch(c) - int c; /* char to show match for */ +showmatch( + int c) /* char to show match for */ { pos_T *lpos, save_cursor; pos_T mpos; @@ -2462,13 +3011,13 @@ showmatch(c) } if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */ - vim_beep(); + vim_beep(BO_MATCH); else if (lpos->lnum >= curwin->w_topline && lpos->lnum < curwin->w_botline) { if (!curwin->w_p_wrap) getvcol(curwin, lpos, NULL, &vcol, NULL); if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol - && vcol < curwin->w_leftcol + W_WIDTH(curwin))) + && vcol < curwin->w_leftcol + curwin->w_width)) { mpos = *lpos; /* save the pos, update_screen() may change it */ save_cursor = curwin->w_cursor; @@ -2493,14 +3042,8 @@ showmatch(c) showruler(FALSE); setcursor(); cursor_on(); /* make sure that the cursor is shown */ - out_flush(); -#ifdef FEAT_GUI - if (gui.in_use) - { - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); - } -#endif + out_flush_cursor(TRUE, FALSE); + /* Restore dollar_vcol(), because setcursor() may call curs_rows() * which resets it if the matching position is in a previous line * and has a higher column number. */ @@ -2532,13 +3075,11 @@ showmatch(c) * Return OK if the next sentence was found. */ int -findsent(dir, count) - int dir; - long count; +findsent(int dir, long count) { pos_T pos, tpos; int c; - int (*func) __ARGS((pos_T *)); + int (*func)(pos_T *); int startlnum; int noskip = FALSE; /* do not skip blanks */ int cpo_J; @@ -2582,7 +3123,12 @@ findsent(dir, count) /* go back to the previous non-blank char */ found_dot = FALSE; while ((c = gchar_pos(&pos)) == ' ' || c == '\t' || - (dir == BACKWARD && vim_strchr((char_u *)".!?)]\"'", c) != NULL)) + (dir == BACKWARD && vim_strchr((char_u *)".!?)]\"'", c) != NULL) +#ifdef FEAT_MBYTE + || (dir == BACKWARD && (*mb_char2len)(c) > 1 + && mb_get_class(ml_get_pos(&pos)) == 1) +#endif + ) { if (vim_strchr((char_u *)".!?", c) != NULL) { @@ -2594,7 +3140,7 @@ findsent(dir, count) if (decl(&pos) == -1) break; /* when going forward: Stop in front of empty line */ - if (lineempty(pos.lnum) && dir == FORWARD) + if (LINEEMPTY(pos.lnum) && dir == FORWARD) { incl(&pos); goto found; @@ -2632,6 +3178,24 @@ findsent(dir, count) break; } } +#ifdef FEAT_MBYTE + if (has_mbyte && (*mb_char2len)(c) > 1 + && mb_get_class(ml_get_pos(&pos)) == 1) + { + tpos = pos; + for (;;) + { + c = inc(&tpos); + if (c == -1 || (*mb_char2len)(c) <= 1 + || mb_get_class(ml_get_pos(&tpos)) != 1) + break; + } + pos = tpos; + if (gchar_pos(&pos) == NUL) + inc(&pos); + break; + } +#endif if ((*func)(&pos) == -1) { if (count) @@ -2661,12 +3225,12 @@ findsent(dir, count) * Return TRUE if the next paragraph or section was found. */ int -findpar(pincl, dir, count, what, both) - int *pincl; /* Return: TRUE if last char is to be included */ - int dir; - long count; - int what; - int both; +findpar( + int *pincl, /* Return: TRUE if last char is to be included */ + int dir, + long count, + int what, + int both) { linenr_T curr; int did_skip; /* TRUE after separating lines have been skipped */ @@ -2725,9 +3289,17 @@ findpar(pincl, dir, count, what, both) curwin->w_cursor.lnum = curr; if (curr == curbuf->b_ml.ml_line_count && what != '}') { - if ((curwin->w_cursor.col = (colnr_T)STRLEN(ml_get(curr))) != 0) + char_u *line = ml_get(curr); + + /* Put the cursor on the last character in the last line and make the + * motion inclusive. */ + if ((curwin->w_cursor.col = (colnr_T)STRLEN(line)) != 0) { --curwin->w_cursor.col; +#ifdef FEAT_MBYTE + curwin->w_cursor.col -= + (*mb_head_off)(line, line + curwin->w_cursor.col); +#endif *pincl = TRUE; } } @@ -2740,9 +3312,7 @@ findpar(pincl, dir, count, what, both) * check if the string 's' is a nroff macro that is in option 'opt' */ static int -inmacro(opt, s) - char_u *opt; - char_u *s; +inmacro(char_u *opt, char_u *s) { char_u *macro; @@ -2771,10 +3341,7 @@ inmacro(opt, s) * If 'both' is TRUE also stop at '}' */ int -startPS(lnum, para, both) - linenr_T lnum; - int para; - int both; +startPS(linenr_T lnum, int para, int both) { char_u *s; @@ -2813,7 +3380,7 @@ static int cls_bigword; /* TRUE for "W", "B" or "E" */ * boundaries are of interest. */ static int -cls() +cls(void) { int c; @@ -2860,10 +3427,10 @@ cls() * If eol is TRUE, last word stops at end of line (for operators). */ int -fwd_word(count, bigword, eol) - long count; - int bigword; /* "W", "E" or "B" */ - int eol; +fwd_word( + long count, + int bigword, /* "W", "E" or "B" */ + int eol) { int sclass; /* starting class */ int i; @@ -2932,10 +3499,7 @@ fwd_word(count, bigword, eol) * Returns FAIL if top of the file was reached. */ int -bck_word(count, bigword, stop) - long count; - int bigword; - int stop; +bck_word(long count, int bigword, int stop) { int sclass; /* starting class */ @@ -2964,7 +3528,7 @@ bck_word(count, bigword, stop) while (cls() == 0) { if (curwin->w_cursor.col == 0 - && lineempty(curwin->w_cursor.lnum)) + && LINEEMPTY(curwin->w_cursor.lnum)) goto finished; if (dec_cursor() == -1) /* hit start of file, stop here */ return OK; @@ -3000,11 +3564,11 @@ bck_word(count, bigword, stop) * If empty is TRUE stop on an empty line. */ int -end_word(count, bigword, stop, empty) - long count; - int bigword; - int stop; - int empty; +end_word( + long count, + int bigword, + int stop, + int empty) { int sclass; /* starting class */ @@ -3045,7 +3609,7 @@ end_word(count, bigword, stop, empty) while (cls() == 0) { if (empty && curwin->w_cursor.col == 0 - && lineempty(curwin->w_cursor.lnum)) + && LINEEMPTY(curwin->w_cursor.lnum)) goto finished; if (inc_cursor() == -1) /* hit end of file, stop here */ return FAIL; @@ -3070,10 +3634,10 @@ end_word(count, bigword, stop, empty) * Returns FAIL if start of the file was reached. */ int -bckend_word(count, bigword, eol) - long count; - int bigword; /* TRUE for "B" */ - int eol; /* TRUE: stop at end of line. */ +bckend_word( + long count, + int bigword, /* TRUE for "B" */ + int eol) /* TRUE: stop at end of line. */ { int sclass; /* starting class */ int i; @@ -3105,7 +3669,7 @@ bckend_word(count, bigword, eol) */ while (cls() == 0) { - if (curwin->w_cursor.col == 0 && lineempty(curwin->w_cursor.lnum)) + if (curwin->w_cursor.col == 0 && LINEEMPTY(curwin->w_cursor.lnum)) break; if ((i = dec_cursor()) == -1 || (eol && i == 1)) return OK; @@ -3119,9 +3683,7 @@ bckend_word(count, bigword, eol) * Return TRUE when end-of-file reached, FALSE otherwise. */ static int -skip_chars(cclass, dir) - int cclass; - int dir; +skip_chars(int cclass, int dir) { while (cls() == cclass) if ((dir == FORWARD ? inc_cursor() : dec_cursor()) == -1) @@ -3134,7 +3696,7 @@ skip_chars(cclass, dir) * Go back to the start of the word or the start of white space */ static void -back_in_line() +back_in_line(void) { int sclass; /* starting class */ @@ -3153,15 +3715,14 @@ back_in_line() } static void -find_first_blank(posp) - pos_T *posp; +find_first_blank(pos_T *posp) { int c; while (decl(posp) != -1) { c = gchar_pos(posp); - if (!vim_iswhite(c)) + if (!VIM_ISWHITE(c)) { incl(posp); break; @@ -3173,9 +3734,9 @@ find_first_blank(posp) * Skip count/2 sentences and count/2 separating white spaces. */ static void -findsent_forward(count, at_start_sent) - long count; - int at_start_sent; /* cursor is at start of sentence */ +findsent_forward( + long count, + int at_start_sent) /* cursor is at start of sentence */ { while (count--) { @@ -3193,11 +3754,11 @@ findsent_forward(count, at_start_sent) * Used while an operator is pending, and in Visual mode. */ int -current_word(oap, count, include, bigword) - oparg_T *oap; - long count; - int include; /* TRUE: include word and white space */ - int bigword; /* FALSE == word, TRUE == WORD */ +current_word( + oparg_T *oap, + long count, + int include, /* TRUE: include word and white space */ + int bigword) /* FALSE == word, TRUE == WORD */ { pos_T start_pos; pos_T pos; @@ -3205,17 +3766,17 @@ current_word(oap, count, include, bigword) int include_white = FALSE; cls_bigword = bigword; - clearpos(&start_pos); + CLEAR_POS(&start_pos); /* Correct cursor when 'selection' is exclusive */ - if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor)) + if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor)) dec_cursor(); /* * When Visual mode is not active, or when the VIsual area is only one * character, select the word and/or white space under the cursor. */ - if (!VIsual_active || equalpos(curwin->w_cursor, VIsual)) + if (!VIsual_active || EQUAL_POS(curwin->w_cursor, VIsual)) { /* * Go to start of current word or white space. @@ -3272,7 +3833,7 @@ current_word(oap, count, include, bigword) while (count > 0) { inclusive = TRUE; - if (VIsual_active && lt(curwin->w_cursor, VIsual)) + if (VIsual_active && LT_POS(curwin->w_cursor, VIsual)) { /* * In Visual mode, with cursor at start: move cursor back. @@ -3348,7 +3909,7 @@ current_word(oap, count, include, bigword) if (VIsual_active) { - if (*p_sel == 'e' && inclusive && ltoreq(VIsual, curwin->w_cursor)) + if (*p_sel == 'e' && inclusive && LTOREQ_POS(VIsual, curwin->w_cursor)) inc_cursor(); if (VIsual_mode == 'V') { @@ -3367,10 +3928,7 @@ current_word(oap, count, include, bigword) * When Visual active, extend it by one or more sentences. */ int -current_sent(oap, count, include) - oparg_T *oap; - long count; - int include; +current_sent(oparg_T *oap, long count, int include) { pos_T start_pos; pos_T pos; @@ -3386,10 +3944,10 @@ current_sent(oap, count, include) /* * When the Visual area is bigger than one character: Extend it. */ - if (VIsual_active && !equalpos(start_pos, VIsual)) + if (VIsual_active && !EQUAL_POS(start_pos, VIsual)) { extend: - if (lt(start_pos, VIsual)) + if (LT_POS(start_pos, VIsual)) { /* * Cursor at start of Visual area. @@ -3400,10 +3958,10 @@ current_sent(oap, count, include) */ at_start_sent = TRUE; decl(&pos); - while (lt(pos, curwin->w_cursor)) + while (LT_POS(pos, curwin->w_cursor)) { c = gchar_pos(&pos); - if (!vim_iswhite(c)) + if (!VIM_ISWHITE(c)) { at_start_sent = FALSE; break; @@ -3413,7 +3971,7 @@ current_sent(oap, count, include) if (!at_start_sent) { findsent(BACKWARD, 1L); - if (equalpos(curwin->w_cursor, start_pos)) + if (EQUAL_POS(curwin->w_cursor, start_pos)) at_start_sent = TRUE; /* exactly at start of sentence */ else /* inside a sentence, go to its end (start of next) */ @@ -3426,7 +3984,7 @@ current_sent(oap, count, include) if (at_start_sent) find_first_blank(&curwin->w_cursor); c = gchar_cursor(); - if (!at_start_sent || (!include && !vim_iswhite(c))) + if (!at_start_sent || (!include && !VIM_ISWHITE(c))) findsent(BACKWARD, 1L); at_start_sent = !at_start_sent; } @@ -3442,13 +4000,14 @@ current_sent(oap, count, include) */ incl(&pos); at_start_sent = TRUE; - if (!equalpos(pos, curwin->w_cursor)) /* not just before a sentence */ + /* not just before a sentence */ + if (!EQUAL_POS(pos, curwin->w_cursor)) { at_start_sent = FALSE; - while (lt(pos, curwin->w_cursor)) + while (LT_POS(pos, curwin->w_cursor)) { c = gchar_pos(&pos); - if (!vim_iswhite(c)) + if (!VIM_ISWHITE(c)) { at_start_sent = TRUE; break; @@ -3474,9 +4033,9 @@ current_sent(oap, count, include) * If the cursor started on a blank, check if it is just before the start * of the next sentence. */ - while (c = gchar_pos(&pos), vim_iswhite(c)) /* vim_iswhite() is a macro */ + while (c = gchar_pos(&pos), VIM_ISWHITE(c)) /* VIM_ISWHITE() is a macro */ incl(&pos); - if (equalpos(pos, curwin->w_cursor)) + if (EQUAL_POS(pos, curwin->w_cursor)) { start_blank = TRUE; find_first_blank(&start_pos); /* go back to first blank */ @@ -3510,23 +4069,24 @@ current_sent(oap, count, include) if (start_blank) { find_first_blank(&curwin->w_cursor); - c = gchar_pos(&curwin->w_cursor); /* vim_iswhite() is a macro */ - if (vim_iswhite(c)) + c = gchar_pos(&curwin->w_cursor); /* VIM_ISWHITE() is a macro */ + if (VIM_ISWHITE(c)) decl(&curwin->w_cursor); } - else if (c = gchar_cursor(), !vim_iswhite(c)) + else if (c = gchar_cursor(), !VIM_ISWHITE(c)) find_first_blank(&start_pos); } if (VIsual_active) { /* Avoid getting stuck with "is" on a single space before a sentence. */ - if (equalpos(start_pos, curwin->w_cursor)) + if (EQUAL_POS(start_pos, curwin->w_cursor)) goto extend; if (*p_sel == 'e') ++curwin->w_cursor.col; VIsual = start_pos; VIsual_mode = 'v'; + redraw_cmdline = TRUE; /* show mode later */ redraw_curbuf_later(INVERTED); /* update the inversion */ } else @@ -3547,12 +4107,12 @@ current_sent(oap, count, include) * "what" and "other" are two matching parenthesis/brace/etc. */ int -current_block(oap, count, include, what, other) - oparg_T *oap; - long count; - int include; /* TRUE == include white space */ - int what; /* '(', '{', etc. */ - int other; /* ')', '}', etc. */ +current_block( + oparg_T *oap, + long count, + int include, /* TRUE == include white space */ + int what, /* '(', '{', etc. */ + int other) /* ')', '}', etc. */ { pos_T old_pos; pos_T *pos = NULL; @@ -3569,7 +4129,7 @@ current_block(oap, count, include, what, other) /* * If we start on '(', '{', ')', '}', etc., use the whole block inclusive. */ - if (!VIsual_active || equalpos(VIsual, curwin->w_cursor)) + if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor)) { setpcmark(); if (what == '{') /* ignore indent */ @@ -3580,7 +4140,7 @@ current_block(oap, count, include, what, other) /* cursor on '(' or '{', move cursor just after it */ ++curwin->w_cursor.col; } - else if (lt(VIsual, curwin->w_cursor)) + else if (LT_POS(VIsual, curwin->w_cursor)) { old_start = VIsual; curwin->w_cursor = VIsual; /* cursor at low end of Visual */ @@ -3591,10 +4151,11 @@ current_block(oap, count, include, what, other) /* * Search backwards for unclosed '(', '{', etc.. * Put this position in start_pos. - * Ignore quotes here. + * Ignore quotes here. Keep the "M" flag in 'cpo', as that is what the + * user wants. */ save_cpo = p_cpo; - p_cpo = (char_u *)"%"; + p_cpo = (char_u *)(vim_strchr(p_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%"); while (count-- > 0) { if ((pos = findmatch(NULL, what)) == NULL) @@ -3637,7 +4198,7 @@ current_block(oap, count, include, what, other) * In Visual mode, when the resulting area is not bigger than what we * started with, extend it to the next block, and then exclude again. */ - if (!lt(start_pos, old_start) && !lt(old_end, curwin->w_cursor) + if (!LT_POS(start_pos, old_start) && !LT_POS(old_end, curwin->w_cursor) && VIsual_active) { curwin->w_cursor = old_start; @@ -3663,7 +4224,7 @@ current_block(oap, count, include, what, other) if (VIsual_active) { if (*p_sel == 'e') - ++curwin->w_cursor.col; + inc(&curwin->w_cursor); if (sol && gchar_cursor() != NUL) inc(&curwin->w_cursor); /* include the line break */ VIsual = start_pos; @@ -3678,7 +4239,7 @@ current_block(oap, count, include, what, other) oap->inclusive = FALSE; if (sol) incl(&curwin->w_cursor); - else if (ltoreq(start_pos, curwin->w_cursor)) + else if (LTOREQ_POS(start_pos, curwin->w_cursor)) /* Include the character under the cursor. */ oap->inclusive = TRUE; else @@ -3690,15 +4251,15 @@ current_block(oap, count, include, what, other) return OK; } -static int in_html_tag __ARGS((int)); +static int in_html_tag(int); /* * Return TRUE if the cursor is on a "<aaa>" tag. Ignore "<aaa/>". * When "end_tag" is TRUE return TRUE if the cursor is on "</aaa>". */ static int -in_html_tag(end_tag) - int end_tag; +in_html_tag( + int end_tag) { char_u *line = ml_get_curline(); char_u *p; @@ -3713,7 +4274,7 @@ in_html_tag(end_tag) /* We search forward until the cursor, because searching backwards is * very slow for DBCS encodings. */ - for (p = line; p < line + curwin->w_cursor.col; mb_ptr_adv(p)) + for (p = line; p < line + curwin->w_cursor.col; MB_PTR_ADV(p)) if (*p == '>' || *p == '<') { lc = *p; @@ -3733,7 +4294,7 @@ in_html_tag(end_tag) { if (*p == '<') /* find '<' under/before cursor */ break; - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); if (*p == '>') /* find '>' before cursor */ break; } @@ -3744,7 +4305,7 @@ in_html_tag(end_tag) pos.lnum = curwin->w_cursor.lnum; pos.col = (colnr_T)(p - line); - mb_ptr_adv(p); + MB_PTR_ADV(p); if (end_tag) /* check that there is a '/' after the '<' */ return *p == '/'; @@ -3770,10 +4331,10 @@ in_html_tag(end_tag) * Find tag block under the cursor, cursor at end. */ int -current_tagblock(oap, count_arg, include) - oparg_T *oap; - long count_arg; - int include; /* TRUE == include white space */ +current_tagblock( + oparg_T *oap, + long count_arg, + int include) /* TRUE == include white space */ { long count = count_arg; long n; @@ -3789,6 +4350,7 @@ current_tagblock(oap, count_arg, include) int do_include = include; int save_p_ws = p_ws; int retval = FAIL; + int is_inclusive = TRUE; p_ws = FALSE; @@ -3801,7 +4363,7 @@ current_tagblock(oap, count_arg, include) /* * If we start on "<aaa>" select that block. */ - if (!VIsual_active || equalpos(VIsual, curwin->w_cursor)) + if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor)) { setpcmark(); @@ -3827,7 +4389,7 @@ current_tagblock(oap, count_arg, include) old_end = curwin->w_cursor; } } - else if (lt(VIsual, curwin->w_cursor)) + else if (LT_POS(VIsual, curwin->w_cursor)) { old_start = VIsual; curwin->w_cursor = VIsual; /* cursor at low end of Visual */ @@ -3844,7 +4406,7 @@ current_tagblock(oap, count_arg, include) { if (do_searchpair((char_u *)"<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|\\_s\\=>\\)", (char_u *)"", - (char_u *)"</[^>]*>", BACKWARD, (char_u *)"", 0, + (char_u *)"</[^>]*>", BACKWARD, NULL, 0, NULL, (linenr_T)0, 0L) <= 0) { curwin->w_cursor = old_pos; @@ -3858,7 +4420,7 @@ current_tagblock(oap, count_arg, include) */ inc_cursor(); p = ml_get_cursor(); - for (cp = p; *cp != NUL && *cp != '>' && !vim_iswhite(*cp); mb_ptr_adv(cp)) + for (cp = p; *cp != NUL && *cp != '>' && !VIM_ISWHITE(*cp); MB_PTR_ADV(cp)) ; len = (int)(cp - p); if (len == 0) @@ -3878,13 +4440,13 @@ current_tagblock(oap, count_arg, include) sprintf((char *)spat, "<%.*s\\>\\%%(\\s\\_[^>]\\{-}[^/]>\\|>\\)\\c", len, p); sprintf((char *)epat, "</%.*s>\\c", len, p); - r = do_searchpair(spat, (char_u *)"", epat, FORWARD, (char_u *)"", + r = do_searchpair(spat, (char_u *)"", epat, FORWARD, NULL, 0, NULL, (linenr_T)0, 0L); vim_free(spat); vim_free(epat); - if (r < 1 || lt(curwin->w_cursor, old_end)) + if (r < 1 || LT_POS(curwin->w_cursor, old_end)) { /* Can't find other end or it's before the previous end. Could be a * HTML tag that doesn't have a matching end. Search backwards for @@ -3894,7 +4456,7 @@ current_tagblock(oap, count_arg, include) goto again; } - if (do_include || r < 1) + if (do_include) { /* Include up to the '>'. */ while (*ml_get_cursor() != '>') @@ -3903,8 +4465,15 @@ current_tagblock(oap, count_arg, include) } else { - /* Exclude the '<' of the end tag. */ - if (*ml_get_cursor() == '<') + char_u *c = ml_get_cursor(); + + /* Exclude the '<' of the end tag. + * If the closing tag is on new line, do not decrement cursor, but + * make operation exclusive, so that the linefeed will be selected */ + if (*c == '<' && !VIsual_active && curwin->w_cursor.col == 0) + /* do not decrement cursor */ + is_inclusive = FALSE; + else if (*c == '<') dec_cursor(); } end_pos = curwin->w_cursor; @@ -3924,7 +4493,7 @@ current_tagblock(oap, count_arg, include) /* If we now have the same text as before reset "do_include" and try * again. */ - if (equalpos(start_pos, old_start) && equalpos(end_pos, old_end)) + if (EQUAL_POS(start_pos, old_start) && EQUAL_POS(end_pos, old_end)) { do_include = TRUE; curwin->w_cursor = old_start; @@ -3937,10 +4506,10 @@ current_tagblock(oap, count_arg, include) { /* If the end is before the start there is no text between tags, select * the char under the cursor. */ - if (lt(end_pos, start_pos)) + if (LT_POS(end_pos, start_pos)) curwin->w_cursor = start_pos; else if (*p_sel == 'e') - ++curwin->w_cursor.col; + inc_cursor(); VIsual = start_pos; VIsual_mode = 'v'; redraw_curbuf_later(INVERTED); /* update the inversion */ @@ -3950,7 +4519,7 @@ current_tagblock(oap, count_arg, include) { oap->start = start_pos; oap->motion_type = MCHAR; - if (lt(end_pos, start_pos)) + if (LT_POS(end_pos, start_pos)) { /* End is before the start: there is no text between tags; operate * on an empty area. */ @@ -3958,7 +4527,7 @@ current_tagblock(oap, count_arg, include) oap->inclusive = FALSE; } else - oap->inclusive = TRUE; + oap->inclusive = is_inclusive; } retval = OK; @@ -3968,11 +4537,11 @@ current_tagblock(oap, count_arg, include) } int -current_par(oap, count, include, type) - oparg_T *oap; - long count; - int include; /* TRUE == include white space */ - int type; /* 'p' for paragraph, 'S' for section */ +current_par( + oparg_T *oap, + long count, + int include, /* TRUE == include white space */ + int type) /* 'p' for paragraph, 'S' for section */ { linenr_T start_lnum; linenr_T end_lnum; @@ -4120,7 +4689,11 @@ current_par(oap, count, include, type) * line, we get stuck there. Trap this here. */ if (VIsual_mode == 'V' && start_lnum == curwin->w_cursor.lnum) goto extend; - VIsual.lnum = start_lnum; + if (VIsual.lnum != start_lnum) + { + VIsual.lnum = start_lnum; + VIsual.col = 0; + } VIsual_mode = 'V'; redraw_curbuf_later(INVERTED); /* update the inversion */ showmode(); @@ -4137,8 +4710,8 @@ current_par(oap, count, include, type) return OK; } -static int find_next_quote __ARGS((char_u *top_ptr, int col, int quotechar, char_u *escape)); -static int find_prev_quote __ARGS((char_u *line, int col_start, int quotechar, char_u *escape)); +static int find_next_quote(char_u *top_ptr, int col, int quotechar, char_u *escape); +static int find_prev_quote(char_u *line, int col_start, int quotechar, char_u *escape); /* * Search quote char from string line[col]. @@ -4147,11 +4720,11 @@ static int find_prev_quote __ARGS((char_u *line, int col_start, int quotechar, c * Returns column number of "quotechar" or -1 when not found. */ static int -find_next_quote(line, col, quotechar, escape) - char_u *line; - int col; - int quotechar; - char_u *escape; /* escape characters, can be NULL */ +find_next_quote( + char_u *line, + int col, + int quotechar, + char_u *escape) /* escape characters, can be NULL */ { int c; @@ -4181,11 +4754,11 @@ find_next_quote(line, col, quotechar, escape) * Return the found column or zero. */ static int -find_prev_quote(line, col_start, quotechar, escape) - char_u *line; - int col_start; - int quotechar; - char_u *escape; /* escape characters, can be NULL */ +find_prev_quote( + char_u *line, + int col_start, + int quotechar, + char_u *escape) /* escape characters, can be NULL */ { int n; @@ -4213,11 +4786,11 @@ find_prev_quote(line, col_start, quotechar, escape) * Returns TRUE if found, else FALSE. */ int -current_quote(oap, count, include, quotechar) - oparg_T *oap; - long count; - int include; /* TRUE == include quote char */ - int quotechar; /* Quote character */ +current_quote( + oparg_T *oap, + long count, + int include, /* TRUE == include quote char */ + int quotechar) /* Quote character */ { char_u *line = ml_get_curline(); int col_end; @@ -4229,13 +4802,28 @@ current_quote(oap, count, include, quotechar) int selected_quote = FALSE; /* Has quote inside selection */ int i; - /* Correct cursor when 'selection' is exclusive */ + /* Correct cursor when 'selection' is "exclusive". */ if (VIsual_active) { - vis_bef_curs = lt(VIsual, curwin->w_cursor); - if (*p_sel == 'e' && vis_bef_curs) + /* this only works within one line */ + if (VIsual.lnum != curwin->w_cursor.lnum) + return FALSE; + + vis_bef_curs = LT_POS(VIsual, curwin->w_cursor); + if (*p_sel == 'e') + { + if (!vis_bef_curs) + { + /* VIsual needs to be start of Visual selection. */ + pos_T t = curwin->w_cursor; + + curwin->w_cursor = VIsual; + VIsual = t; + vis_bef_curs = TRUE; + } dec_cursor(); - vis_empty = equalpos(VIsual, curwin->w_cursor); + } + vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); } if (!vis_empty) @@ -4365,11 +4953,11 @@ current_quote(oap, count, include, quotechar) * the starting quote. */ if (include) { - if (vim_iswhite(line[col_end + 1])) - while (vim_iswhite(line[col_end + 1])) + if (VIM_ISWHITE(line[col_end + 1])) + while (VIM_ISWHITE(line[col_end + 1])) ++col_end; else - while (col_start > 0 && vim_iswhite(line[col_start - 1])) + while (col_start > 0 && VIM_ISWHITE(line[col_start - 1])) --col_start; } @@ -4449,20 +5037,20 @@ current_quote(oap, count, include, quotechar) #endif /* FEAT_TEXTOBJ */ -static int is_one_char __ARGS((char_u *pattern)); +static int is_one_char(char_u *pattern, int move, pos_T *cur, int direction); /* * Find next search match under cursor, cursor at end. * Used while an operator is pending, and in Visual mode. - * TODO: redo only works when used in operator pending mode */ int -current_search(count, forward) - long count; - int forward; /* move forward or backwards */ +current_search( + long count, + int forward) /* move forward or backwards */ { pos_T start_pos; /* position before the pattern */ pos_T orig_pos; /* position of the cursor at beginning */ + pos_T first_match; /* position of first match */ pos_T pos; /* position after the pattern */ int i; int dir; @@ -4471,12 +5059,13 @@ current_search(count, forward) int flags = 0; pos_T save_VIsual = VIsual; int one_char; + int direction = forward ? FORWARD : BACKWARD; /* wrapping should not occur */ p_ws = FALSE; /* Correct cursor when 'selection' is exclusive */ - if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor)) + if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor)) dec_cursor(); if (VIsual_active) @@ -4484,7 +5073,6 @@ current_search(count, forward) orig_pos = curwin->w_cursor; pos = curwin->w_cursor; - start_pos = VIsual; /* make sure, searching further will extend the match */ if (VIsual_active) @@ -4496,10 +5084,12 @@ current_search(count, forward) } } else - orig_pos = pos = start_pos = curwin->w_cursor; + orig_pos = pos = curwin->w_cursor; - /* Is the pattern is zero-width? */ - one_char = is_one_char(spats[last_idx].pat); + /* Is the pattern is zero-width?, this time, don't care about the direction + */ + one_char = is_one_char(spats[last_idx].pat, TRUE, &curwin->w_cursor, + FORWARD); if (one_char == -1) { p_ws = old_p_ws; @@ -4524,7 +5114,7 @@ current_search(count, forward) result = searchit(curwin, curbuf, &pos, (dir ? FORWARD : BACKWARD), spats[last_idx].pat, (long) (i ? count : 1), - SEARCH_KEEP | flags, RE_SEARCH, 0, NULL); + SEARCH_KEEP | flags, RE_SEARCH, 0, NULL, NULL); /* First search may fail, but then start searching from the * beginning of the file (cursor might be on the search match) @@ -4540,29 +5130,57 @@ current_search(count, forward) } else if (!i && !result) { - if (forward) /* try again from start of buffer */ + if (forward) { - clearpos(&pos); + /* try again from start of buffer */ + CLEAR_POS(&pos); } - else /* try again from end of buffer */ + else { + /* try again from end of buffer */ /* searching backwards, so set pos to last line and col */ pos.lnum = curwin->w_buffer->b_ml.ml_line_count; pos.col = (colnr_T)STRLEN( ml_get(curwin->w_buffer->b_ml.ml_line_count)); } } + if (i == 0) + first_match = pos; p_ws = old_p_ws; } start_pos = pos; - flags = forward ? SEARCH_END : 0; + flags = forward ? SEARCH_END : SEARCH_START; + + /* Check again from the current cursor position, + * since the next match might actually by only one char wide */ + one_char = is_one_char(spats[last_idx].pat, FALSE, &pos, direction); + if (one_char < 0) + /* search failed, abort */ + return FAIL; /* move to match, except for zero-width matches, in which case, we are * already on the next match */ if (!one_char) - result = searchit(curwin, curbuf, &pos, (forward ? FORWARD : BACKWARD), - spats[last_idx].pat, 0L, flags | SEARCH_KEEP, RE_SEARCH, 0, NULL); + { + p_ws = FALSE; + for (i = 0; i < 2; i++) + { + result = searchit(curwin, curbuf, &pos, direction, + spats[last_idx].pat, 0L, flags | SEARCH_KEEP, RE_SEARCH, 0, + NULL, NULL); + /* Search successfull, break out from the loop */ + if (result) + break; + /* search failed, try again from the last search position match */ + pos = first_match; + } + } + + p_ws = old_p_ws; + /* not found */ + if (!result) + return FAIL; if (!VIsual_active) VIsual = start_pos; @@ -4577,9 +5195,9 @@ current_search(count, forward) if (*p_sel == 'e') { /* Correction for exclusive selection depends on the direction. */ - if (forward && ltoreq(VIsual, curwin->w_cursor)) + if (forward && LTOREQ_POS(VIsual, curwin->w_cursor)) inc_cursor(); - else if (!forward && ltoreq(curwin->w_cursor, VIsual)) + else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual)) inc(&VIsual); } @@ -4606,41 +5224,68 @@ current_search(count, forward) } /* - * Check if the pattern is one character or zero-width. + * Check if the pattern is one character long or zero-width. + * If move is TRUE, check from the beginning of the buffer, else from position + * "cur". + * "direction" is FORWARD or BACKWARD. * Returns TRUE, FALSE or -1 for failure. */ static int -is_one_char(pattern) - char_u *pattern; +is_one_char(char_u *pattern, int move, pos_T *cur, int direction) { regmmatch_T regmatch; int nmatched = 0; int result = -1; pos_T pos; int save_called_emsg = called_emsg; + int flag = 0; + + if (pattern == NULL) + pattern = spats[last_idx].pat; if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH, SEARCH_KEEP, ®match) == FAIL) return -1; + /* init startcol correctly */ + regmatch.startpos[0].col = -1; /* move to match */ - clearpos(&pos); - if (searchit(curwin, curbuf, &pos, FORWARD, spats[last_idx].pat, 1, - SEARCH_KEEP, RE_SEARCH, 0, NULL) != FAIL) + if (move) + { + CLEAR_POS(&pos); + } + else + { + pos = *cur; + /* accept a match at the cursor position */ + flag = SEARCH_START; + } + + if (searchit(curwin, curbuf, &pos, direction, pattern, 1, + SEARCH_KEEP + flag, RE_SEARCH, 0, NULL, NULL) != FAIL) { /* Zero-width pattern should match somewhere, then we can check if * start and end are in the same position. */ called_emsg = FALSE; - nmatched = vim_regexec_multi(®match, curwin, curbuf, - pos.lnum, (colnr_T)0, NULL); + do + { + regmatch.startpos[0].col++; + nmatched = vim_regexec_multi(®match, curwin, curbuf, + pos.lnum, regmatch.startpos[0].col, NULL, NULL); + if (!nmatched) + break; + } while (direction == FORWARD ? regmatch.startpos[0].col < pos.col + : regmatch.startpos[0].col > pos.col); if (!called_emsg) + { result = (nmatched != 0 && regmatch.startpos[0].lnum == regmatch.endpos[0].lnum && regmatch.startpos[0].col == regmatch.endpos[0].col); - - if (!result && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col) - result = TRUE; + /* one char width */ + if (!result && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col) + result = TRUE; + } } called_emsg |= save_called_emsg; @@ -4654,8 +5299,7 @@ is_one_char(pattern) * return TRUE if line 'lnum' is empty or has white chars only. */ int -linewhite(lnum) - linenr_T lnum; +linewhite(linenr_T lnum) { char_u *p; @@ -4670,19 +5314,18 @@ linewhite(lnum) * If p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase. */ void -find_pattern_in_path(ptr, dir, len, whole, skip_comments, - type, count, action, start_lnum, end_lnum) - char_u *ptr; /* pointer to search pattern */ - int dir UNUSED; /* direction of expansion */ - int len; /* length of search pattern */ - int whole; /* match whole words only */ - int skip_comments; /* don't match inside comments */ - int type; /* Type of search; are we looking for a type? +find_pattern_in_path( + char_u *ptr, /* pointer to search pattern */ + int dir UNUSED, /* direction of expansion */ + int len, /* length of search pattern */ + int whole, /* match whole words only */ + int skip_comments, /* don't match inside comments */ + int type, /* Type of search; are we looking for a type? a macro? */ - long count; - int action; /* What to do when we find it */ - linenr_T start_lnum; /* first line to start searching */ - linenr_T end_lnum; /* last line for searching */ + long count, + int action, /* What to do when we find it */ + linenr_T start_lnum, /* first line to start searching */ + linenr_T end_lnum) /* last line for searching */ { SearchedFile *files; /* Stack of included files */ SearchedFile *bigger; /* When we need more space */ @@ -4713,7 +5356,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, char_u *already = NULL; char_u *startp = NULL; char_u *inc_opt = NULL; -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) win_T *curwin_save = NULL; #endif @@ -4816,8 +5459,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, prev_fname = NULL; } } - vim_free(new_fname); - new_fname = NULL; + VIM_CLEAR(new_fname); already_searched = TRUE; break; } @@ -4855,7 +5497,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, { /* using "new_fname" is more reliable, e.g., when * 'includeexpr' is set. */ - msg_outtrans_attr(new_fname, hl_attr(HLF_D)); + msg_outtrans_attr(new_fname, HL_ATTR(HLF_D)); } else { @@ -4901,7 +5543,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, } save_char = p[i]; p[i] = NUL; - msg_outtrans_attr(p, hl_attr(HLF_D)); + msg_outtrans_attr(p, HL_ATTR(HLF_D)); p[i] = save_char; } @@ -4966,7 +5608,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, vim_snprintf((char*)IObuff, IOSIZE, _("Scanning included file: %s"), (char *)new_fname); - msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); + msg_trunc_attr(IObuff, TRUE, HL_ATTR(HLF_R)); } else #endif @@ -5192,7 +5834,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, { found = TRUE; if (depth == -1 && lnum == curwin->w_cursor.lnum -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) && g_do_tagpreview == 0 #endif ) @@ -5209,7 +5851,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* ":psearch" uses the preview window */ if (g_do_tagpreview != 0) { @@ -5219,31 +5861,32 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, #endif if (action == ACTION_SPLIT) { -#ifdef FEAT_WINDOWS if (win_split(0, 0) == FAIL) -#endif break; RESET_BINDING(curwin); } if (depth == -1) { /* match in current file */ -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { - if (getfile(0, curwin_save->w_buffer->b_fname, - NULL, TRUE, lnum, FALSE) > 0) + if (!GETFILE_SUCCESS(getfile( + curwin_save->w_buffer->b_fnum, NULL, + NULL, TRUE, lnum, FALSE))) break; /* failed to jump to file */ } else #endif setpcmark(); curwin->w_cursor.lnum = lnum; + check_cursor(); } else { - if (getfile(0, files[depth].name, NULL, TRUE, - files[depth].lnum, FALSE) > 0) + if (!GETFILE_SUCCESS(getfile( + 0, files[depth].name, NULL, TRUE, + files[depth].lnum, FALSE))) break; /* failed to jump to file */ /* autocommands may have changed the lnum, we don't * want that here */ @@ -5256,7 +5899,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, curwin->w_set_curswant = TRUE; } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { @@ -5292,7 +5935,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, #endif #ifdef FEAT_INS_EXPAND if (action == ACTION_EXPAND) - ins_compl_check_keys(30); + ins_compl_check_keys(30, FALSE); if (got_int || compl_interrupted) #else if (got_int) @@ -5385,14 +6028,14 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments, } static void -show_pat_in_path(line, type, did_show, action, fp, lnum, count) - char_u *line; - int type; - int did_show; - int action; - FILE *fp; - linenr_T *lnum; - long count; +show_pat_in_path( + char_u *line, + int type, + int did_show, + int action, + FILE *fp, + linenr_T *lnum, + long count) { char_u *p; @@ -5420,7 +6063,7 @@ show_pat_in_path(line, type, did_show, action, fp, lnum, count) msg_puts(IObuff); sprintf((char *)IObuff, "%4ld", *lnum); /* show line nr */ /* Highlight line numbers */ - msg_puts_attr(IObuff, hl_attr(HLF_N)); + msg_puts_attr(IObuff, HL_ATTR(HLF_N)); MSG_PUTS(" "); } msg_prt_line(line, FALSE); @@ -5449,9 +6092,7 @@ show_pat_in_path(line, type, did_show, action, fp, lnum, count) #ifdef FEAT_VIMINFO int -read_viminfo_search_pattern(virp, force) - vir_T *virp; - int force; +read_viminfo_search_pattern(vir_T *virp, int force) { char_u *lp; int idx = -1; @@ -5526,9 +6167,7 @@ read_viminfo_search_pattern(virp, force) spats[idx].off.off = off; #ifdef FEAT_SEARCH_EXTRA if (setlast) - { - SET_NO_HLSEARCH(!hlsearch_on); - } + set_no_hlsearch(!hlsearch_on); #endif } } @@ -5537,8 +6176,7 @@ read_viminfo_search_pattern(virp, force) } void -write_viminfo_search_pattern(fp) - FILE *fp; +write_viminfo_search_pattern(FILE *fp) { if (get_viminfo_parameter('/') != 0) { @@ -5552,11 +6190,11 @@ write_viminfo_search_pattern(fp) } static void -wvsp_one(fp, idx, s, sc) - FILE *fp; /* file to write to */ - int idx; /* spats[] index */ - char *s; /* search pat */ - int sc; /* dir char */ +wvsp_one( + FILE *fp, /* file to write to */ + int idx, /* spats[] index */ + char *s, /* search pat */ + int sc) /* dir char */ { if (spats[idx].pat != NULL) { diff --git a/src/sha256.c b/src/sha256.c index 0cfe0eb593..3bb77915c7 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -24,7 +24,7 @@ #if defined(FEAT_CRYPT) || defined(FEAT_PERSISTENT_UNDO) -static void sha256_process __ARGS((context_sha256_T *ctx, char_u data[64])); +static void sha256_process(context_sha256_T *ctx, char_u data[64]); #define GET_UINT32(n, b, i) \ { \ @@ -43,8 +43,7 @@ static void sha256_process __ARGS((context_sha256_T *ctx, char_u data[64])); } void -sha256_start(ctx) - context_sha256_T *ctx; +sha256_start(context_sha256_T *ctx) { ctx->total[0] = 0; ctx->total[1] = 0; @@ -60,9 +59,7 @@ sha256_start(ctx) } static void -sha256_process(ctx, data) - context_sha256_T *ctx; - char_u data[64]; +sha256_process(context_sha256_T *ctx, char_u data[64]) { UINT32_T temp1, temp2, W[64]; UINT32_T A, B, C, D, E, F, G, H; @@ -194,10 +191,7 @@ sha256_process(ctx, data) } void -sha256_update(ctx, input, length) - context_sha256_T *ctx; - char_u *input; - UINT32_T length; +sha256_update(context_sha256_T *ctx, char_u *input, UINT32_T length) { UINT32_T left, fill; @@ -241,9 +235,7 @@ static char_u sha256_padding[64] = { }; void -sha256_finish(ctx, digest) - context_sha256_T *ctx; - char_u digest[32]; +sha256_finish(context_sha256_T *ctx, char_u digest[32]) { UINT32_T last, padn; UINT32_T high, low; @@ -273,18 +265,18 @@ sha256_finish(ctx, digest) #endif /* FEAT_CRYPT || FEAT_PERSISTENT_UNDO */ #if defined(FEAT_CRYPT) || defined(PROTO) -static unsigned int get_some_time __ARGS((void)); +static unsigned int get_some_time(void); /* * Returns hex digest of "buf[buf_len]" in a static array. * if "salt" is not NULL also do "salt[salt_len]". */ char_u * -sha256_bytes(buf, buf_len, salt, salt_len) - char_u *buf; - int buf_len; - char_u *salt; - int salt_len; +sha256_bytes( + char_u *buf, + int buf_len, + char_u *salt, + int salt_len) { char_u sha256sum[32]; static char_u hexit[65]; @@ -308,10 +300,10 @@ sha256_bytes(buf, buf_len, salt, salt_len) * Returns sha256(buf) as 64 hex chars in static array. */ char_u * -sha256_key(buf, salt, salt_len) - char_u *buf; - char_u *salt; - int salt_len; +sha256_key( + char_u *buf, + char_u *salt, + int salt_len) { /* No passwd means don't encrypt */ if (buf == NULL || *buf == NUL) @@ -344,7 +336,7 @@ static char *sha_self_test_vector[] = { * Return FAIL or OK. */ int -sha256_self_test() +sha256_self_test(void) { int i, j; char output[65]; @@ -389,7 +381,7 @@ sha256_self_test() } static unsigned int -get_some_time() +get_some_time(void) { # ifdef HAVE_GETTIMEOFDAY struct timeval tv; @@ -407,11 +399,11 @@ get_some_time() * Also "salt[salt_len]" when "salt" is not NULL. */ void -sha2_seed(header, header_len, salt, salt_len) - char_u *header; - int header_len; - char_u *salt; - int salt_len; +sha2_seed( + char_u *header, + int header_len, + char_u *salt, + int salt_len) { int i; static char_u random_data[1000]; diff --git a/src/spell.c b/src/spell.c index 50636421ea..05a9d2cd84 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,6 +10,8 @@ /* * spell.c: code for spell checking * + * See spellfile.c for the Vim spell file format. + * * The spell checking mechanism uses a tree (aka trie). Each node in the tree * has a list of bytes that can appear (siblings). For each byte there is a * pointer to the node with the byte that follows in the word (child). @@ -53,18 +55,6 @@ * See ":help develop-spell". */ -/* Use SPELL_PRINTTREE for debugging: dump the word tree after adding a word. - * Only use it for small word lists! */ -#if 0 -# define SPELL_PRINTTREE -#endif - -/* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk() for a - * specific word. */ -#if 0 -# define DEBUG_TRIEWALK -#endif - /* * Use this to adjust the score after finding suggestions, based on the * suggested word sounding like the bad word. This is much faster than doing @@ -81,228 +71,7 @@ */ #define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3) -/* - * Vim spell file format: <HEADER> - * <SECTIONS> - * <LWORDTREE> - * <KWORDTREE> - * <PREFIXTREE> - * - * <HEADER>: <fileID> <versionnr> - * - * <fileID> 8 bytes "VIMspell" - * <versionnr> 1 byte VIMSPELLVERSION - * - * - * Sections make it possible to add information to the .spl file without - * making it incompatible with previous versions. There are two kinds of - * sections: - * 1. Not essential for correct spell checking. E.g. for making suggestions. - * These are skipped when not supported. - * 2. Optional information, but essential for spell checking when present. - * E.g. conditions for affixes. When this section is present but not - * supported an error message is given. - * - * <SECTIONS>: <section> ... <sectionend> - * - * <section>: <sectionID> <sectionflags> <sectionlen> (section contents) - * - * <sectionID> 1 byte number from 0 to 254 identifying the section - * - * <sectionflags> 1 byte SNF_REQUIRED: this section is required for correct - * spell checking - * - * <sectionlen> 4 bytes length of section contents, MSB first - * - * <sectionend> 1 byte SN_END - * - * - * sectionID == SN_INFO: <infotext> - * <infotext> N bytes free format text with spell file info (version, - * website, etc) - * - * sectionID == SN_REGION: <regionname> ... - * <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case. - * First <regionname> is region 1. - * - * sectionID == SN_CHARFLAGS: <charflagslen> <charflags> - * <folcharslen> <folchars> - * <charflagslen> 1 byte Number of bytes in <charflags> (should be 128). - * <charflags> N bytes List of flags (first one is for character 128): - * 0x01 word character CF_WORD - * 0x02 upper-case character CF_UPPER - * <folcharslen> 2 bytes Number of bytes in <folchars>. - * <folchars> N bytes Folded characters, first one is for character 128. - * - * sectionID == SN_MIDWORD: <midword> - * <midword> N bytes Characters that are word characters only when used - * in the middle of a word. - * - * sectionID == SN_PREFCOND: <prefcondcnt> <prefcond> ... - * <prefcondcnt> 2 bytes Number of <prefcond> items following. - * <prefcond> : <condlen> <condstr> - * <condlen> 1 byte Length of <condstr>. - * <condstr> N bytes Condition for the prefix. - * - * sectionID == SN_REP: <repcount> <rep> ... - * <repcount> 2 bytes number of <rep> items, MSB first. - * <rep> : <repfromlen> <repfrom> <reptolen> <repto> - * <repfromlen> 1 byte length of <repfrom> - * <repfrom> N bytes "from" part of replacement - * <reptolen> 1 byte length of <repto> - * <repto> N bytes "to" part of replacement - * - * sectionID == SN_REPSAL: <repcount> <rep> ... - * just like SN_REP but for soundfolded words - * - * sectionID == SN_SAL: <salflags> <salcount> <sal> ... - * <salflags> 1 byte flags for soundsalike conversion: - * SAL_F0LLOWUP - * SAL_COLLAPSE - * SAL_REM_ACCENTS - * <salcount> 2 bytes number of <sal> items following - * <sal> : <salfromlen> <salfrom> <saltolen> <salto> - * <salfromlen> 1 byte length of <salfrom> - * <salfrom> N bytes "from" part of soundsalike - * <saltolen> 1 byte length of <salto> - * <salto> N bytes "to" part of soundsalike - * - * sectionID == SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> - * <sofofromlen> 2 bytes length of <sofofrom> - * <sofofrom> N bytes "from" part of soundfold - * <sofotolen> 2 bytes length of <sofoto> - * <sofoto> N bytes "to" part of soundfold - * - * sectionID == SN_SUGFILE: <timestamp> - * <timestamp> 8 bytes time in seconds that must match with .sug file - * - * sectionID == SN_NOSPLITSUGS: nothing - * - * sectionID == SN_WORDS: <word> ... - * <word> N bytes NUL terminated common word - * - * sectionID == SN_MAP: <mapstr> - * <mapstr> N bytes String with sequences of similar characters, - * separated by slashes. - * - * sectionID == SN_COMPOUND: <compmax> <compminlen> <compsylmax> <compoptions> - * <comppatcount> <comppattern> ... <compflags> - * <compmax> 1 byte Maximum nr of words in compound word. - * <compminlen> 1 byte Minimal word length for compounding. - * <compsylmax> 1 byte Maximum nr of syllables in compound word. - * <compoptions> 2 bytes COMP_ flags. - * <comppatcount> 2 bytes number of <comppattern> following - * <compflags> N bytes Flags from COMPOUNDRULE items, separated by - * slashes. - * - * <comppattern>: <comppatlen> <comppattext> - * <comppatlen> 1 byte length of <comppattext> - * <comppattext> N bytes end or begin chars from CHECKCOMPOUNDPATTERN - * - * sectionID == SN_NOBREAK: (empty, its presence is what matters) - * - * sectionID == SN_SYLLABLE: <syllable> - * <syllable> N bytes String from SYLLABLE item. - * - * <LWORDTREE>: <wordtree> - * - * <KWORDTREE>: <wordtree> - * - * <PREFIXTREE>: <wordtree> - * - * - * <wordtree>: <nodecount> <nodedata> ... - * - * <nodecount> 4 bytes Number of nodes following. MSB first. - * - * <nodedata>: <siblingcount> <sibling> ... - * - * <siblingcount> 1 byte Number of siblings in this node. The siblings - * follow in sorted order. - * - * <sibling>: <byte> [ <nodeidx> <xbyte> - * | <flags> [<flags2>] [<region>] [<affixID>] - * | [<pflags>] <affixID> <prefcondnr> ] - * - * <byte> 1 byte Byte value of the sibling. Special cases: - * BY_NOFLAGS: End of word without flags and for all - * regions. - * For PREFIXTREE <affixID> and - * <prefcondnr> follow. - * BY_FLAGS: End of word, <flags> follow. - * For PREFIXTREE <pflags>, <affixID> - * and <prefcondnr> follow. - * BY_FLAGS2: End of word, <flags> and <flags2> - * follow. Not used in PREFIXTREE. - * BY_INDEX: Child of sibling is shared, <nodeidx> - * and <xbyte> follow. - * - * <nodeidx> 3 bytes Index of child for this sibling, MSB first. - * - * <xbyte> 1 byte byte value of the sibling. - * - * <flags> 1 byte bitmask of: - * WF_ALLCAP word must have only capitals - * WF_ONECAP first char of word must be capital - * WF_KEEPCAP keep-case word - * WF_FIXCAP keep-case word, all caps not allowed - * WF_RARE rare word - * WF_BANNED bad word - * WF_REGION <region> follows - * WF_AFX <affixID> follows - * - * <flags2> 1 byte Bitmask of: - * WF_HAS_AFF >> 8 word includes affix - * WF_NEEDCOMP >> 8 word only valid in compound - * WF_NOSUGGEST >> 8 word not used for suggestions - * WF_COMPROOT >> 8 word already a compound - * WF_NOCOMPBEF >> 8 no compounding before this word - * WF_NOCOMPAFT >> 8 no compounding after this word - * - * <pflags> 1 byte bitmask of: - * WFP_RARE rare prefix - * WFP_NC non-combining prefix - * WFP_UP letter after prefix made upper case - * - * <region> 1 byte Bitmask for regions in which word is valid. When - * omitted it's valid in all regions. - * Lowest bit is for region 1. - * - * <affixID> 1 byte ID of affix that can be used with this word. In - * PREFIXTREE used for the required prefix ID. - * - * <prefcondnr> 2 bytes Prefix condition number, index in <prefcond> list - * from HEADER. - * - * All text characters are in 'encoding', but stored as single bytes. - */ - -/* - * Vim .sug file format: <SUGHEADER> - * <SUGWORDTREE> - * <SUGTABLE> - * - * <SUGHEADER>: <fileID> <versionnr> <timestamp> - * - * <fileID> 6 bytes "VIMsug" - * <versionnr> 1 byte VIMSUGVERSION - * <timestamp> 8 bytes timestamp that must match with .spl file - * - * - * <SUGWORDTREE>: <wordtree> (see above, no flags or region used) - * - * - * <SUGTABLE>: <sugwcount> <sugline> ... - * - * <sugwcount> 4 bytes number of <sugline> following - * - * <sugline>: <sugnr> ... NUL - * - * <sugnr>: X bytes word number that results in this soundfolded word, - * stored as an offset to the previous number in as - * few bytes as possible, see offset2bytes()) - */ - +#define IN_SPELL_C #include "vim.h" #if defined(FEAT_SPELL) || defined(PROTO) @@ -311,268 +80,17 @@ # include <time.h> /* for time_t */ #endif -#define MAXWLEN 250 /* Assume max. word len is this many bytes. - Some places assume a word length fits in a - byte, thus it can't be above 255. */ - -/* Type used for indexes in the word tree need to be at least 4 bytes. If int - * is 8 bytes we could use something smaller, but what? */ -#if VIM_SIZEOF_INT > 3 -typedef int idx_T; -#else -typedef long idx_T; -#endif - -#ifdef VMS -# define SPL_FNAME_TMPL "%s_%s.spl" -# define SPL_FNAME_ADD "_add." -# define SPL_FNAME_ASCII "_ascii." -#else -# define SPL_FNAME_TMPL "%s.%s.spl" -# define SPL_FNAME_ADD ".add." -# define SPL_FNAME_ASCII ".ascii." -#endif - -/* Flags used for a word. Only the lowest byte can be used, the region byte - * comes above it. */ -#define WF_REGION 0x01 /* region byte follows */ -#define WF_ONECAP 0x02 /* word with one capital (or all capitals) */ -#define WF_ALLCAP 0x04 /* word must be all capitals */ -#define WF_RARE 0x08 /* rare word */ -#define WF_BANNED 0x10 /* bad word */ -#define WF_AFX 0x20 /* affix ID follows */ -#define WF_FIXCAP 0x40 /* keep-case word, allcap not allowed */ -#define WF_KEEPCAP 0x80 /* keep-case word */ - -/* for <flags2>, shifted up one byte to be used in wn_flags */ -#define WF_HAS_AFF 0x0100 /* word includes affix */ -#define WF_NEEDCOMP 0x0200 /* word only valid in compound */ -#define WF_NOSUGGEST 0x0400 /* word not to be suggested */ -#define WF_COMPROOT 0x0800 /* already compounded word, COMPOUNDROOT */ -#define WF_NOCOMPBEF 0x1000 /* no compounding before this word */ -#define WF_NOCOMPAFT 0x2000 /* no compounding after this word */ - /* only used for su_badflags */ #define WF_MIXCAP 0x20 /* mix of upper and lower case: macaRONI */ #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP) -/* flags for <pflags> */ -#define WFP_RARE 0x01 /* rare prefix */ -#define WFP_NC 0x02 /* prefix is not combining */ -#define WFP_UP 0x04 /* to-upper prefix */ -#define WFP_COMPPERMIT 0x08 /* prefix with COMPOUNDPERMITFLAG */ -#define WFP_COMPFORBID 0x10 /* prefix with COMPOUNDFORBIDFLAG */ - -/* Flags for postponed prefixes in "sl_pidxs". Must be above affixID (one - * byte) and prefcondnr (two bytes). */ -#define WF_RAREPFX (WFP_RARE << 24) /* rare postponed prefix */ -#define WF_PFX_NC (WFP_NC << 24) /* non-combining postponed prefix */ -#define WF_PFX_UP (WFP_UP << 24) /* to-upper postponed prefix */ -#define WF_PFX_COMPPERMIT (WFP_COMPPERMIT << 24) /* postponed prefix with - * COMPOUNDPERMITFLAG */ -#define WF_PFX_COMPFORBID (WFP_COMPFORBID << 24) /* postponed prefix with - * COMPOUNDFORBIDFLAG */ - - -/* flags for <compoptions> */ -#define COMP_CHECKDUP 1 /* CHECKCOMPOUNDDUP */ -#define COMP_CHECKREP 2 /* CHECKCOMPOUNDREP */ -#define COMP_CHECKCASE 4 /* CHECKCOMPOUNDCASE */ -#define COMP_CHECKTRIPLE 8 /* CHECKCOMPOUNDTRIPLE */ - -/* Special byte values for <byte>. Some are only used in the tree for - * postponed prefixes, some only in the other trees. This is a bit messy... */ -#define BY_NOFLAGS 0 /* end of word without flags or region; for - * postponed prefix: no <pflags> */ -#define BY_INDEX 1 /* child is shared, index follows */ -#define BY_FLAGS 2 /* end of word, <flags> byte follows; for - * postponed prefix: <pflags> follows */ -#define BY_FLAGS2 3 /* end of word, <flags> and <flags2> bytes - * follow; never used in prefix tree */ -#define BY_SPECIAL BY_FLAGS2 /* highest special byte value */ - -/* Info from "REP", "REPSAL" and "SAL" entries in ".aff" file used in si_rep, - * si_repsal, sl_rep, and si_sal. Not for sl_sal! - * One replacement: from "ft_from" to "ft_to". */ -typedef struct fromto_S -{ - char_u *ft_from; - char_u *ft_to; -} fromto_T; - -/* Info from "SAL" entries in ".aff" file used in sl_sal. - * The info is split for quick processing by spell_soundfold(). - * Note that "sm_oneof" and "sm_rules" point into sm_lead. */ -typedef struct salitem_S -{ - char_u *sm_lead; /* leading letters */ - int sm_leadlen; /* length of "sm_lead" */ - char_u *sm_oneof; /* letters from () or NULL */ - char_u *sm_rules; /* rules like ^, $, priority */ - char_u *sm_to; /* replacement. */ -#ifdef FEAT_MBYTE - int *sm_lead_w; /* wide character copy of "sm_lead" */ - int *sm_oneof_w; /* wide character copy of "sm_oneof" */ - int *sm_to_w; /* wide character copy of "sm_to" */ -#endif -} salitem_T; - -#ifdef FEAT_MBYTE -typedef int salfirst_T; -#else -typedef short salfirst_T; -#endif - -/* Values for SP_*ERROR are negative, positive values are used by - * read_cnt_string(). */ -#define SP_TRUNCERROR -1 /* spell file truncated error */ -#define SP_FORMERROR -2 /* format error in spell file */ -#define SP_OTHERERROR -3 /* other error while reading spell file */ - -/* - * Structure used to store words and other info for one language, loaded from - * a .spl file. - * The main access is through the tree in "sl_fbyts/sl_fidxs", storing the - * case-folded words. "sl_kbyts/sl_kidxs" is for keep-case words. - * - * The "byts" array stores the possible bytes in each tree node, preceded by - * the number of possible bytes, sorted on byte value: - * <len> <byte1> <byte2> ... - * The "idxs" array stores the index of the child node corresponding to the - * byte in "byts". - * Exception: when the byte is zero, the word may end here and "idxs" holds - * the flags, region mask and affixID for the word. There may be several - * zeros in sequence for alternative flag/region/affixID combinations. - */ -typedef struct slang_S slang_T; -struct slang_S -{ - slang_T *sl_next; /* next language */ - char_u *sl_name; /* language name "en", "en.rare", "nl", etc. */ - char_u *sl_fname; /* name of .spl file */ - int sl_add; /* TRUE if it's a .add file. */ - - char_u *sl_fbyts; /* case-folded word bytes */ - idx_T *sl_fidxs; /* case-folded word indexes */ - char_u *sl_kbyts; /* keep-case word bytes */ - idx_T *sl_kidxs; /* keep-case word indexes */ - char_u *sl_pbyts; /* prefix tree word bytes */ - idx_T *sl_pidxs; /* prefix tree word indexes */ - - char_u *sl_info; /* infotext string or NULL */ - - char_u sl_regions[17]; /* table with up to 8 region names plus NUL */ - - char_u *sl_midword; /* MIDWORD string or NULL */ - - hashtab_T sl_wordcount; /* hashtable with word count, wordcount_T */ - - int sl_compmax; /* COMPOUNDWORDMAX (default: MAXWLEN) */ - int sl_compminlen; /* COMPOUNDMIN (default: 0) */ - int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */ - int sl_compoptions; /* COMP_* flags */ - garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */ - regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm - * (NULL when no compounding) */ - char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */ - char_u *sl_compstartflags; /* flags for first compound word */ - char_u *sl_compallflags; /* all flags for compound words */ - char_u sl_nobreak; /* When TRUE: no spaces between words */ - char_u *sl_syllable; /* SYLLABLE repeatable chars or NULL */ - garray_T sl_syl_items; /* syllable items */ - - int sl_prefixcnt; /* number of items in "sl_prefprog" */ - regprog_T **sl_prefprog; /* table with regprogs for prefixes */ - - garray_T sl_rep; /* list of fromto_T entries from REP lines */ - short sl_rep_first[256]; /* indexes where byte first appears, -1 if - there is none */ - garray_T sl_sal; /* list of salitem_T entries from SAL lines */ - salfirst_T sl_sal_first[256]; /* indexes where byte first appears, -1 if - there is none */ - int sl_followup; /* SAL followup */ - int sl_collapse; /* SAL collapse_result */ - int sl_rem_accents; /* SAL remove_accents */ - int sl_sofo; /* SOFOFROM and SOFOTO instead of SAL items: - * "sl_sal_first" maps chars, when has_mbyte - * "sl_sal" is a list of wide char lists. */ - garray_T sl_repsal; /* list of fromto_T entries from REPSAL lines */ - short sl_repsal_first[256]; /* sl_rep_first for REPSAL lines */ - int sl_nosplitsugs; /* don't suggest splitting a word */ - - /* Info from the .sug file. Loaded on demand. */ - time_t sl_sugtime; /* timestamp for .sug file */ - char_u *sl_sbyts; /* soundfolded word bytes */ - idx_T *sl_sidxs; /* soundfolded word indexes */ - buf_T *sl_sugbuf; /* buffer with word number table */ - int sl_sugloaded; /* TRUE when .sug file was loaded or failed to - load */ - - int sl_has_map; /* TRUE if there is a MAP line */ -#ifdef FEAT_MBYTE - hashtab_T sl_map_hash; /* MAP for multi-byte chars */ - int sl_map_array[256]; /* MAP for first 256 chars */ -#else - char_u sl_map_array[256]; /* MAP for first 256 chars */ -#endif - hashtab_T sl_sounddone; /* table with soundfolded words that have - handled, see add_sound_suggest() */ -}; - -/* First language that is loaded, start of the linked list of loaded - * languages. */ -static slang_T *first_lang = NULL; - -/* Flags used in .spl file for soundsalike flags. */ -#define SAL_F0LLOWUP 1 -#define SAL_COLLAPSE 2 -#define SAL_REM_ACCENTS 4 - -/* - * Structure used in "b_langp", filled from 'spelllang'. - */ -typedef struct langp_S -{ - slang_T *lp_slang; /* info for this language */ - slang_T *lp_sallang; /* language used for sound folding or NULL */ - slang_T *lp_replang; /* language used for REP items or NULL */ - int lp_region; /* bitmask for region or REGION_ALL */ -} langp_T; - -#define LANGP_ENTRY(ga, i) (((langp_T *)(ga).ga_data) + (i)) - #define REGION_ALL 0xff /* word valid in all regions */ -#define VIMSPELLMAGIC "VIMspell" /* string at start of Vim spell file */ -#define VIMSPELLMAGICL 8 -#define VIMSPELLVERSION 50 - #define VIMSUGMAGIC "VIMsug" /* string at start of Vim .sug file */ #define VIMSUGMAGICL 6 #define VIMSUGVERSION 1 -/* Section IDs. Only renumber them when VIMSPELLVERSION changes! */ -#define SN_REGION 0 /* <regionname> section */ -#define SN_CHARFLAGS 1 /* charflags section */ -#define SN_MIDWORD 2 /* <midword> section */ -#define SN_PREFCOND 3 /* <prefcond> section */ -#define SN_REP 4 /* REP items section */ -#define SN_SAL 5 /* SAL items section */ -#define SN_SOFO 6 /* soundfolding section */ -#define SN_MAP 7 /* MAP items section */ -#define SN_COMPOUND 8 /* compound words section */ -#define SN_SYLLABLE 9 /* syllable section */ -#define SN_NOBREAK 10 /* NOBREAK section */ -#define SN_SUGFILE 11 /* timestamp for .sug file */ -#define SN_REPSAL 12 /* REPSAL items section */ -#define SN_WORDS 13 /* common words */ -#define SN_NOSPLITSUGS 14 /* don't split word for suggestions */ -#define SN_INFO 15 /* info section */ -#define SN_END 255 /* end of sections */ - -#define SNF_REQUIRED 1 /* <sectionflags>: required section */ - /* Result values. Lower number is accepted over higher one. */ #define SP_BANNED -1 #define SP_OK 0 @@ -580,17 +98,13 @@ typedef struct langp_S #define SP_LOCAL 2 #define SP_BAD 3 -/* file used for "zG" and "zW" */ -static char_u *int_wordlist = NULL; - typedef struct wordcount_S { short_u wc_count; /* nr of times word was seen */ char_u wc_word[1]; /* word, actually longer */ } wordcount_T; -static wordcount_T dumwc; -#define WC_KEY_OFF (unsigned)(dumwc.wc_word - (char_u *)&dumwc) +#define WC_KEY_OFF offsetof(wordcount_T, wc_word) #define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF)) #define MAXWORDCOUNT 0xffff @@ -733,33 +247,12 @@ typedef struct matchinf_S char_u *mi_end2; /* "mi_end" without following word */ } matchinf_T; -/* - * The tables used for recognizing word characters according to spelling. - * These are only used for the first 256 characters of 'encoding'. - */ -typedef struct spelltab_S -{ - char_u st_isw[256]; /* flags: is word char */ - char_u st_isu[256]; /* flags: is uppercase char */ - char_u st_fold[256]; /* chars: folded case */ - char_u st_upper[256]; /* chars: upper case */ -} spelltab_T; - -static spelltab_T spelltab; -static int did_set_spelltab; - -#define CF_WORD 0x01 -#define CF_UPPER 0x02 - -static void clear_spell_chartab __ARGS((spelltab_T *sp)); -static int set_spell_finish __ARGS((spelltab_T *new_st)); -static int spell_iswordp __ARGS((char_u *p, win_T *wp)); -static int spell_iswordp_nmw __ARGS((char_u *p, win_T *wp)); + +static int spell_iswordp(char_u *p, win_T *wp); #ifdef FEAT_MBYTE -static int spell_mb_isword_class __ARGS((int cl, win_T *wp)); -static int spell_iswordp_w __ARGS((int *p, win_T *wp)); +static int spell_mb_isword_class(int cl, win_T *wp); +static int spell_iswordp_w(int *p, win_T *wp); #endif -static int write_spell_prefcond __ARGS((FILE *fd, garray_T *gap)); /* * For finding suggestions: At each node in the tree these states are tried: @@ -841,160 +334,73 @@ typedef struct trystate_S #define FIND_COMPOUND 3 /* find case-folded compound word */ #define FIND_KEEPCOMPOUND 4 /* find keep-case compound word */ -static slang_T *slang_alloc __ARGS((char_u *lang)); -static void slang_free __ARGS((slang_T *lp)); -static void slang_clear __ARGS((slang_T *lp)); -static void slang_clear_sug __ARGS((slang_T *lp)); -static void find_word __ARGS((matchinf_T *mip, int mode)); -static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap)); -static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags)); -static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag)); -static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags)); -static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req)); -static void find_prefix __ARGS((matchinf_T *mip, int mode)); -static int fold_more __ARGS((matchinf_T *mip)); -static int spell_valid_case __ARGS((int wordflags, int treeflags)); -static int no_spell_checking __ARGS((win_T *wp)); -static void spell_load_lang __ARGS((char_u *lang)); -static char_u *spell_enc __ARGS((void)); -static void int_wordlist_spl __ARGS((char_u *fname)); -static void spell_load_cb __ARGS((char_u *fname, void *cookie)); -static slang_T *spell_load_file __ARGS((char_u *fname, char_u *lang, slang_T *old_lp, int silent)); -static char_u *read_cnt_string __ARGS((FILE *fd, int cnt_bytes, int *lenp)); -static int read_region_section __ARGS((FILE *fd, slang_T *slang, int len)); -static int read_charflags_section __ARGS((FILE *fd)); -static int read_prefcond_section __ARGS((FILE *fd, slang_T *lp)); -static int read_rep_section __ARGS((FILE *fd, garray_T *gap, short *first)); -static int read_sal_section __ARGS((FILE *fd, slang_T *slang)); -static int read_words_section __ARGS((FILE *fd, slang_T *lp, int len)); -static void count_common_word __ARGS((slang_T *lp, char_u *word, int len, int count)); -static int score_wordcount_adj __ARGS((slang_T *slang, int score, char_u *word, int split)); -static int read_sofo_section __ARGS((FILE *fd, slang_T *slang)); -static int read_compound __ARGS((FILE *fd, slang_T *slang, int len)); -static int byte_in_str __ARGS((char_u *str, int byte)); -static int init_syl_tab __ARGS((slang_T *slang)); -static int count_syllables __ARGS((slang_T *slang, char_u *word)); -static int set_sofo __ARGS((slang_T *lp, char_u *from, char_u *to)); -static void set_sal_first __ARGS((slang_T *lp)); -#ifdef FEAT_MBYTE -static int *mb_str2wide __ARGS((char_u *s)); -#endif -static int spell_read_tree __ARGS((FILE *fd, char_u **bytsp, idx_T **idxsp, int prefixtree, int prefixcnt)); -static idx_T read_tree_node __ARGS((FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx_T startidx, int prefixtree, int maxprefcondnr)); -static void clear_midword __ARGS((win_T *buf)); -static void use_midword __ARGS((slang_T *lp, win_T *buf)); -static int find_region __ARGS((char_u *rp, char_u *region)); -static int captype __ARGS((char_u *word, char_u *end)); -static int badword_captype __ARGS((char_u *word, char_u *end)); -static void spell_reload_one __ARGS((char_u *fname, int added_word)); -static void set_spell_charflags __ARGS((char_u *flags, int cnt, char_u *upp)); -static int set_spell_chartab __ARGS((char_u *fol, char_u *low, char_u *upp)); -static int spell_casefold __ARGS((char_u *p, int len, char_u *buf, int buflen)); -static int check_need_cap __ARGS((linenr_T lnum, colnr_T col)); -static void spell_find_suggest __ARGS((char_u *badptr, int badlen, suginfo_T *su, int maxcount, int banbadword, int need_cap, int interactive)); +static void find_word(matchinf_T *mip, int mode); +static int match_checkcompoundpattern(char_u *ptr, int wlen, garray_T *gap); +static int can_compound(slang_T *slang, char_u *word, char_u *flags); +static int can_be_compound(trystate_T *sp, slang_T *slang, char_u *compflags, int flag); +static int match_compoundrule(slang_T *slang, char_u *compflags); +static int valid_word_prefix(int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req); +static void find_prefix(matchinf_T *mip, int mode); +static int fold_more(matchinf_T *mip); +static int spell_valid_case(int wordflags, int treeflags); +static int no_spell_checking(win_T *wp); +static void spell_load_lang(char_u *lang); +static void int_wordlist_spl(char_u *fname); +static void spell_load_cb(char_u *fname, void *cookie); +static int score_wordcount_adj(slang_T *slang, int score, char_u *word, int split); +static int count_syllables(slang_T *slang, char_u *word); +static void clear_midword(win_T *buf); +static void use_midword(slang_T *lp, win_T *buf); +static int find_region(char_u *rp, char_u *region); +static int badword_captype(char_u *word, char_u *end); +static int check_need_cap(linenr_T lnum, colnr_T col); +static void spell_find_suggest(char_u *badptr, int badlen, suginfo_T *su, int maxcount, int banbadword, int need_cap, int interactive); #ifdef FEAT_EVAL -static void spell_suggest_expr __ARGS((suginfo_T *su, char_u *expr)); -#endif -static void spell_suggest_file __ARGS((suginfo_T *su, char_u *fname)); -static void spell_suggest_intern __ARGS((suginfo_T *su, int interactive)); -static void suggest_load_files __ARGS((void)); -static void tree_count_words __ARGS((char_u *byts, idx_T *idxs)); -static void spell_find_cleanup __ARGS((suginfo_T *su)); -static void onecap_copy __ARGS((char_u *word, char_u *wcopy, int upper)); -static void allcap_copy __ARGS((char_u *word, char_u *wcopy)); -static void suggest_try_special __ARGS((suginfo_T *su)); -static void suggest_try_change __ARGS((suginfo_T *su)); -static void suggest_trie_walk __ARGS((suginfo_T *su, langp_T *lp, char_u *fword, int soundfold)); -static void go_deeper __ARGS((trystate_T *stack, int depth, int score_add)); +static void spell_suggest_expr(suginfo_T *su, char_u *expr); +#endif +static void spell_suggest_file(suginfo_T *su, char_u *fname); +static void spell_suggest_intern(suginfo_T *su, int interactive); +static void spell_find_cleanup(suginfo_T *su); +static void allcap_copy(char_u *word, char_u *wcopy); +static void suggest_try_special(suginfo_T *su); +static void suggest_try_change(suginfo_T *su); +static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int soundfold); +static void go_deeper(trystate_T *stack, int depth, int score_add); #ifdef FEAT_MBYTE -static int nofold_len __ARGS((char_u *fword, int flen, char_u *word)); -#endif -static void find_keepcap_word __ARGS((slang_T *slang, char_u *fword, char_u *kword)); -static void score_comp_sal __ARGS((suginfo_T *su)); -static void score_combine __ARGS((suginfo_T *su)); -static int stp_sal_score __ARGS((suggest_T *stp, suginfo_T *su, slang_T *slang, char_u *badsound)); -static void suggest_try_soundalike_prep __ARGS((void)); -static void suggest_try_soundalike __ARGS((suginfo_T *su)); -static void suggest_try_soundalike_finish __ARGS((void)); -static void add_sound_suggest __ARGS((suginfo_T *su, char_u *goodword, int score, langp_T *lp)); -static int soundfold_find __ARGS((slang_T *slang, char_u *word)); -static void make_case_word __ARGS((char_u *fword, char_u *cword, int flags)); -static void set_map_str __ARGS((slang_T *lp, char_u *map)); -static int similar_chars __ARGS((slang_T *slang, int c1, int c2)); -static void add_suggestion __ARGS((suginfo_T *su, garray_T *gap, char_u *goodword, int badlen, int score, int altscore, int had_bonus, slang_T *slang, int maxsf)); -static void check_suggestions __ARGS((suginfo_T *su, garray_T *gap)); -static void add_banned __ARGS((suginfo_T *su, char_u *word)); -static void rescore_suggestions __ARGS((suginfo_T *su)); -static void rescore_one __ARGS((suginfo_T *su, suggest_T *stp)); -static int cleanup_suggestions __ARGS((garray_T *gap, int maxscore, int keep)); -static void spell_soundfold __ARGS((slang_T *slang, char_u *inword, int folded, char_u *res)); -static void spell_soundfold_sofo __ARGS((slang_T *slang, char_u *inword, char_u *res)); -static void spell_soundfold_sal __ARGS((slang_T *slang, char_u *inword, char_u *res)); +static int nofold_len(char_u *fword, int flen, char_u *word); +#endif +static void find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword); +static void score_comp_sal(suginfo_T *su); +static void score_combine(suginfo_T *su); +static int stp_sal_score(suggest_T *stp, suginfo_T *su, slang_T *slang, char_u *badsound); +static void suggest_try_soundalike_prep(void); +static void suggest_try_soundalike(suginfo_T *su); +static void suggest_try_soundalike_finish(void); +static void add_sound_suggest(suginfo_T *su, char_u *goodword, int score, langp_T *lp); +static int soundfold_find(slang_T *slang, char_u *word); +static void make_case_word(char_u *fword, char_u *cword, int flags); +static int similar_chars(slang_T *slang, int c1, int c2); +static void add_suggestion(suginfo_T *su, garray_T *gap, char_u *goodword, int badlen, int score, int altscore, int had_bonus, slang_T *slang, int maxsf); +static void check_suggestions(suginfo_T *su, garray_T *gap); +static void add_banned(suginfo_T *su, char_u *word); +static void rescore_suggestions(suginfo_T *su); +static void rescore_one(suginfo_T *su, suggest_T *stp); +static int cleanup_suggestions(garray_T *gap, int maxscore, int keep); +static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res); +static void spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res); #ifdef FEAT_MBYTE -static void spell_soundfold_wsal __ARGS((slang_T *slang, char_u *inword, char_u *res)); +static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res); #endif -static int soundalike_score __ARGS((char_u *goodsound, char_u *badsound)); -static int spell_edit_score __ARGS((slang_T *slang, char_u *badword, char_u *goodword)); -static int spell_edit_score_limit __ARGS((slang_T *slang, char_u *badword, char_u *goodword, int limit)); +static int soundalike_score(char_u *goodsound, char_u *badsound); +static int spell_edit_score(slang_T *slang, char_u *badword, char_u *goodword); +static int spell_edit_score_limit(slang_T *slang, char_u *badword, char_u *goodword, int limit); #ifdef FEAT_MBYTE -static int spell_edit_score_limit_w __ARGS((slang_T *slang, char_u *badword, char_u *goodword, int limit)); -#endif -static void dump_word __ARGS((slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T lnum)); -static linenr_T dump_prefixes __ARGS((slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T startlnum)); -static buf_T *open_spellbuf __ARGS((void)); -static void close_spellbuf __ARGS((buf_T *buf)); - -/* - * Use our own character-case definitions, because the current locale may - * differ from what the .spl file uses. - * These must not be called with negative number! - */ -#ifndef FEAT_MBYTE -/* Non-multi-byte implementation. */ -# define SPELL_TOFOLD(c) ((c) < 256 ? (int)spelltab.st_fold[c] : (c)) -# define SPELL_TOUPPER(c) ((c) < 256 ? (int)spelltab.st_upper[c] : (c)) -# define SPELL_ISUPPER(c) ((c) < 256 ? spelltab.st_isu[c] : FALSE) -#else -# if defined(HAVE_WCHAR_H) -# include <wchar.h> /* for towupper() and towlower() */ -# endif -/* Multi-byte implementation. For Unicode we can call utf_*(), but don't do - * that for ASCII, because we don't want to use 'casemap' here. Otherwise use - * the "w" library function for characters above 255 if available. */ -# ifdef HAVE_TOWLOWER -# define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \ - : (c) < 256 ? (int)spelltab.st_fold[c] : (int)towlower(c)) -# else -# define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \ - : (c) < 256 ? (int)spelltab.st_fold[c] : (c)) -# endif - -# ifdef HAVE_TOWUPPER -# define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \ - : (c) < 256 ? (int)spelltab.st_upper[c] : (int)towupper(c)) -# else -# define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \ - : (c) < 256 ? (int)spelltab.st_upper[c] : (c)) -# endif - -# ifdef HAVE_ISWUPPER -# define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \ - : (c) < 256 ? spelltab.st_isu[c] : iswupper(c)) -# else -# define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \ - : (c) < 256 ? spelltab.st_isu[c] : (FALSE)) -# endif +static int spell_edit_score_limit_w(slang_T *slang, char_u *badword, char_u *goodword, int limit); #endif +static void dump_word(slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T lnum); +static linenr_T dump_prefixes(slang_T *slang, char_u *word, char_u *pat, int *dir, int round, int flags, linenr_T startlnum); -static char *e_format = N_("E759: Format error in spell file"); -static char *e_spell_trunc = N_("E758: Truncated spell file"); -static char *e_afftrailing = N_("Trailing text in %s line %d: %s"); -static char *e_affname = N_("Affix name too long in %s line %d: %s"); -static char *e_affform = N_("E761: Format error in affix file FOL, LOW or UPP"); -static char *e_affrange = N_("E762: Character in FOL, LOW or UPP is out of range"); -static char *msg_compressing = N_("Compressing word tree..."); - /* Remember what "z?" replaced. */ static char_u *repl_from = NULL; static char_u *repl_to = NULL; @@ -1015,12 +421,12 @@ static char_u *repl_to = NULL; * caller can skip over the word. */ int -spell_check(wp, ptr, attrp, capcol, docount) - win_T *wp; /* current window */ - char_u *ptr; - hlf_T *attrp; - int *capcol; /* column to check for Capital */ - int docount; /* count good words */ +spell_check( + win_T *wp, /* current window */ + char_u *ptr, + hlf_T *attrp, + int *capcol, /* column to check for Capital */ + int docount) /* count good words */ { matchinf_T mi; /* Most things are put in "mi" so that it can be passed to functions quickly. */ @@ -1046,7 +452,9 @@ spell_check(wp, ptr, attrp, capcol, docount) * julifeest". */ if (*ptr >= '0' && *ptr <= '9') { - if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) + if (*ptr == '0' && (ptr[1] == 'b' || ptr[1] == 'B')) + mi.mi_end = skipbin(ptr + 2); + else if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) mi.mi_end = skiphex(ptr + 2); else mi.mi_end = skipdigits(ptr); @@ -1060,7 +468,7 @@ spell_check(wp, ptr, attrp, capcol, docount) { do { - mb_ptr_adv(mi.mi_fend); + MB_PTR_ADV(mi.mi_fend); } while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp)); if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL) @@ -1086,7 +494,7 @@ spell_check(wp, ptr, attrp, capcol, docount) /* case-fold the word with one non-word character, so that we can check * for the word end. */ if (*mi.mi_fend != NUL) - mb_ptr_adv(mi.mi_fend); + MB_PTR_ADV(mi.mi_fend); (void)spell_casefold(ptr, (int)(mi.mi_fend - ptr), mi.mi_fword, MAXWLEN + 1); @@ -1154,11 +562,14 @@ spell_check(wp, ptr, attrp, capcol, docount) if (capcol != NULL && wp->w_s->b_cap_prog != NULL) { regmatch_T regmatch; + int r; /* Check for end of sentence. */ regmatch.regprog = wp->w_s->b_cap_prog; regmatch.rm_ic = FALSE; - if (vim_regexec(®match, ptr, 0)) + r = vim_regexec(®match, ptr, 0); + wp->w_s->b_cap_prog = regmatch.regprog; + if (r) *capcol = (int)(regmatch.endp[0] - ptr); } @@ -1171,7 +582,7 @@ spell_check(wp, ptr, attrp, capcol, docount) else if (mi.mi_end == ptr) /* Always include at least one character. Required for when there * is a mixup in "midword". */ - mb_ptr_adv(mi.mi_end); + MB_PTR_ADV(mi.mi_end); else if (mi.mi_result == SP_BAD && LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) { @@ -1187,8 +598,8 @@ spell_check(wp, ptr, attrp, capcol, docount) fp = mi.mi_fword; for (;;) { - mb_ptr_adv(p); - mb_ptr_adv(fp); + MB_PTR_ADV(p); + MB_PTR_ADV(fp); if (p >= mi.mi_end) break; mi.mi_compoff = (int)(fp - mi.mi_fword); @@ -1231,9 +642,7 @@ spell_check(wp, ptr, attrp, capcol, docount) * For a match mip->mi_result is updated. */ static void -find_word(mip, mode) - matchinf_T *mip; - int mode; +find_word(matchinf_T *mip, int mode) { idx_T arridx = 0; int endlen[MAXWLEN]; /* length at possible word endings */ @@ -1418,8 +827,8 @@ find_word(mip, mode) p = mip->mi_word; if (STRNCMP(ptr, p, wlen) != 0) { - for (s = ptr; s < ptr + wlen; mb_ptr_adv(s)) - mb_ptr_adv(p); + for (s = ptr; s < ptr + wlen; MB_PTR_ADV(s)) + MB_PTR_ADV(p); wlen = (int)(p - mip->mi_word); } } @@ -1543,8 +952,8 @@ find_word(mip, mode) { /* case folding may have changed the length */ p = mip->mi_word; - for (s = ptr; s < ptr + mip->mi_compoff; mb_ptr_adv(s)) - mb_ptr_adv(p); + for (s = ptr; s < ptr + mip->mi_compoff; MB_PTR_ADV(s)) + MB_PTR_ADV(p); } else #endif @@ -1560,7 +969,7 @@ find_word(mip, mode) * character we do not accept a Onecap word. We do * accept a no-caps word, even when the dictionary * word specifies ONECAP. */ - mb_ptr_back(mip->mi_word, p); + MB_PTR_BACK(mip->mi_word, p); if (spell_iswordp_nmw(p, mip->mi_win) ? capflags == WF_ONECAP : (flags & WF_ONECAP) != 0 @@ -1629,13 +1038,15 @@ find_word(mip, mode) p = mip->mi_fword; if (STRNCMP(ptr, p, wlen) != 0) { - for (s = ptr; s < ptr + wlen; mb_ptr_adv(s)) - mb_ptr_adv(p); + for (s = ptr; s < ptr + wlen; MB_PTR_ADV(s)) + MB_PTR_ADV(p); mip->mi_compoff = (int)(p - mip->mi_fword); } } #endif +#if 0 /* Disabled, see below */ c = mip->mi_compoff; +#endif ++mip->mi_complen; if (flags & WF_COMPROOT) ++mip->mi_compextra; @@ -1751,10 +1162,10 @@ find_word(mip, mode) * end of ptr[wlen] and the second part matches after it. */ static int -match_checkcompoundpattern(ptr, wlen, gap) - char_u *ptr; - int wlen; - garray_T *gap; /* &sl_comppat */ +match_checkcompoundpattern( + char_u *ptr, + int wlen, + garray_T *gap) /* &sl_comppat */ { int i; char_u *p; @@ -1781,12 +1192,8 @@ match_checkcompoundpattern(ptr, wlen, gap) * does not have too many syllables. */ static int -can_compound(slang, word, flags) - slang_T *slang; - char_u *word; - char_u *flags; +can_compound(slang_T *slang, char_u *word, char_u *flags) { - regmatch_T regmatch; #ifdef FEAT_MBYTE char_u uflags[MAXWLEN * 2]; int i; @@ -1801,16 +1208,14 @@ can_compound(slang, word, flags) /* Need to convert the single byte flags to utf8 characters. */ p = uflags; for (i = 0; flags[i] != NUL; ++i) - p += mb_char2bytes(flags[i], p); + p += utf_char2bytes(flags[i], p); *p = NUL; p = uflags; } else #endif p = flags; - regmatch.regprog = slang->sl_compprog; - regmatch.rm_ic = FALSE; - if (!vim_regexec(®match, p, 0)) + if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0)) return FALSE; /* Count the number of syllables. This may be slow, do it last. If there @@ -1828,11 +1233,11 @@ can_compound(slang, word, flags) * lines if they don't contain wildcards. */ static int -can_be_compound(sp, slang, compflags, flag) - trystate_T *sp; - slang_T *slang; - char_u *compflags; - int flag; +can_be_compound( + trystate_T *sp, + slang_T *slang, + char_u *compflags, + int flag) { /* If the flag doesn't appear in sl_compstartflags or sl_compallflags * then it can't possibly compound. */ @@ -1865,9 +1270,7 @@ can_be_compound(sp, slang, compflags, flag) * Caller must check that slang->sl_comprules is not NULL. */ static int -match_compoundrule(slang, compflags) - slang_T *slang; - char_u *compflags; +match_compoundrule(slang_T *slang, char_u *compflags) { char_u *p; int i; @@ -1920,18 +1323,17 @@ match_compoundrule(slang, compflags) * The WF_RAREPFX flag is included in the return value for a rare prefix. */ static int -valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req) - int totprefcnt; /* nr of prefix IDs */ - int arridx; /* idx in sl_pidxs[] */ - int flags; - char_u *word; - slang_T *slang; - int cond_req; /* only use prefixes with a condition */ +valid_word_prefix( + int totprefcnt, /* nr of prefix IDs */ + int arridx, /* idx in sl_pidxs[] */ + int flags, + char_u *word, + slang_T *slang, + int cond_req) /* only use prefixes with a condition */ { int prefcnt; int pidx; - regprog_T *rp; - regmatch_T regmatch; + regprog_T **rp; int prefid; prefid = (unsigned)flags >> 24; @@ -1950,12 +1352,10 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req) /* Check the condition, if there is one. The condition index is * stored in the two bytes above the prefix ID byte. */ - rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff]; - if (rp != NULL) + rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff]; + if (*rp != NULL) { - regmatch.regprog = rp; - regmatch.rm_ic = FALSE; - if (!vim_regexec(®match, word, 0)) + if (!vim_regexec_prog(rp, FALSE, word, 0)) continue; } else if (cond_req) @@ -1977,9 +1377,7 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req) * For a match mip->mi_result is updated. */ static void -find_prefix(mip, mode) - matchinf_T *mip; - int mode; +find_prefix(matchinf_T *mip, int mode) { idx_T arridx = 0; int len; @@ -2100,8 +1498,7 @@ find_prefix(mip, mode) * Return the length of the folded chars in bytes. */ static int -fold_more(mip) - matchinf_T *mip; +fold_more(matchinf_T *mip) { int flen; char_u *p; @@ -2109,12 +1506,12 @@ fold_more(mip) p = mip->mi_fend; do { - mb_ptr_adv(mip->mi_fend); + MB_PTR_ADV(mip->mi_fend); } while (*mip->mi_fend != NUL && spell_iswordp(mip->mi_fend, mip->mi_win)); /* Include the non-word character so that we can check for the word end. */ if (*mip->mi_fend != NUL) - mb_ptr_adv(mip->mi_fend); + MB_PTR_ADV(mip->mi_fend); (void)spell_casefold(p, (int)(mip->mi_fend - p), mip->mi_fword + mip->mi_fwordlen, @@ -2129,9 +1526,9 @@ fold_more(mip) * case. */ static int -spell_valid_case(wordflags, treeflags) - int wordflags; /* flags for the checked word. */ - int treeflags; /* flags for the word in the spell tree */ +spell_valid_case( + int wordflags, /* flags for the checked word. */ + int treeflags) /* flags for the word in the spell tree */ { return ((wordflags == WF_ALLCAP && (treeflags & WF_FIXCAP) == 0) || ((treeflags & (WF_ALLCAP | WF_KEEPCAP)) == 0 @@ -2143,8 +1540,7 @@ spell_valid_case(wordflags, treeflags) * Return TRUE if spell checking is not enabled. */ static int -no_spell_checking(wp) - win_T *wp; +no_spell_checking(win_T *wp) { if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL || wp->w_s->b_langp.ga_len == 0) @@ -2164,12 +1560,12 @@ no_spell_checking(wp) * Return 0 if not found, length of the badly spelled word otherwise. */ int -spell_move_to(wp, dir, allwords, curline, attrp) - win_T *wp; - int dir; /* FORWARD or BACKWARD */ - int allwords; /* TRUE for "[s"/"]s", FALSE for "[S"/"]S" */ - int curline; - hlf_T *attrp; /* return: attributes of bad word or NULL +spell_move_to( + win_T *wp, + int dir, /* FORWARD or BACKWARD */ + int allwords, /* TRUE for "[s"/"]s", FALSE for "[S"/"]S" */ + int curline, + hlf_T *attrp) /* return: attributes of bad word or NULL (only when "dir" is FORWARD) */ { linenr_T lnum; @@ -2207,7 +1603,7 @@ spell_move_to(wp, dir, allwords, curline, attrp) * though... */ lnum = wp->w_cursor.lnum; - clearpos(&found_pos); + CLEAR_POS(&found_pos); while (!got_int) { @@ -2229,11 +1625,11 @@ spell_move_to(wp, dir, allwords, curline, attrp) /* For checking first word with a capital skip white space. */ if (capcol == 0) - capcol = (int)(skipwhite(line) - line); + capcol = getwhitecols(line); else if (curline && wp == curwin) { /* For spellbadword(): check if first word needs a capital. */ - col = (int)(skipwhite(line) - line); + col = getwhitecols(line); if (check_need_cap(lnum, col)) capcol = col; @@ -2338,14 +1734,14 @@ spell_move_to(wp, dir, allwords, curline, attrp) if (curline) break; /* only check cursor line */ + /* If we are back at the starting line and searched it again there + * is no match, give up. */ + if (lnum == wp->w_cursor.lnum && wrapped) + break; + /* Advance to next line. */ if (dir == BACKWARD) { - /* If we are back at the starting line and searched it again there - * is no match, give up. */ - if (lnum == wp->w_cursor.lnum && wrapped) - break; - if (lnum > 1) --lnum; else if (!p_ws) @@ -2379,7 +1775,7 @@ spell_move_to(wp, dir, allwords, curline, attrp) /* If we are back at the starting line and there is no match then * give up. */ - if (lnum == wp->w_cursor.lnum && (!found_one || wrapped)) + if (lnum == wp->w_cursor.lnum && !found_one) break; /* Skip the characters at the start of the next line that were @@ -2411,10 +1807,7 @@ spell_move_to(wp, dir, allwords, curline, attrp) * to skip those bytes if the word was OK. */ void -spell_cat_line(buf, line, maxlen) - char_u *buf; - char_u *line; - int maxlen; +spell_cat_line(char_u *buf, char_u *line, int maxlen) { char_u *p; int n; @@ -2451,15 +1844,12 @@ typedef struct spelload_S * "lang" must be the language without the region: e.g., "en". */ static void -spell_load_lang(lang) - char_u *lang; +spell_load_lang(char_u *lang) { char_u fname_enc[85]; int r; spelload_T sl; -#ifdef FEAT_AUTOCMD int round; -#endif /* Copy the language name to pass it to spell_load_cb() as a cookie. * It's truncated when an error is detected. */ @@ -2467,11 +1857,9 @@ spell_load_lang(lang) sl.sl_slang = NULL; sl.sl_nobreak = FALSE; -#ifdef FEAT_AUTOCMD /* We may retry when no spell file is found for the language, an * autocommand may load it then. */ for (round = 1; round <= 2; ++round) -#endif { /* * Find the first spell file for "lang" in 'runtimepath' and load it. @@ -2483,7 +1871,7 @@ spell_load_lang(lang) "spell/%s.%s.spl", #endif lang, spell_enc()); - r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl); + r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl); if (r == FAIL && *sl.sl_lang != NUL) { @@ -2495,19 +1883,15 @@ spell_load_lang(lang) "spell/%s.ascii.spl", #endif lang); - r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl); + r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl); -#ifdef FEAT_AUTOCMD if (r == FAIL && *sl.sl_lang != NUL && round == 1 && apply_autocmds(EVENT_SPELLFILEMISSING, lang, curbuf->b_fname, FALSE, curbuf)) continue; break; -#endif } -#ifdef FEAT_AUTOCMD break; -#endif } if (r == FAIL) @@ -2524,7 +1908,7 @@ spell_load_lang(lang) { /* At least one file was loaded, now load ALL the additions. */ STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl"); - do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &sl); + do_in_runtimepath(fname_enc, DIP_ALL, spell_load_cb, &sl); } } @@ -2532,8 +1916,8 @@ spell_load_lang(lang) * Return the encoding used for spell checking: Use 'encoding', except that we * use "latin1" for "latin9". And limit to 60 characters (just in case). */ - static char_u * -spell_enc() + char_u * +spell_enc(void) { #ifdef FEAT_MBYTE @@ -2548,8 +1932,7 @@ spell_enc() * "fname[MAXPATHL]". */ static void -int_wordlist_spl(fname) - char_u *fname; +int_wordlist_spl(char_u *fname) { vim_snprintf((char *)fname, MAXPATHL, SPL_FNAME_TMPL, int_wordlist, spell_enc()); @@ -2559,9 +1942,8 @@ int_wordlist_spl(fname) * Allocate a new slang_T for language "lang". "lang" can be NULL. * Caller must fill "sl_next". */ - static slang_T * -slang_alloc(lang) - char_u *lang; + slang_T * +slang_alloc(char_u *lang) { slang_T *lp; @@ -2583,9 +1965,8 @@ slang_alloc(lang) /* * Free the contents of an slang_T and the structure itself. */ - static void -slang_free(lp) - slang_T *lp; + void +slang_free(slang_T *lp) { vim_free(lp->sl_name); vim_free(lp->sl_fname); @@ -2596,9 +1977,8 @@ slang_free(lp) /* * Clear an slang_T so that the file can be reloaded. */ - static void -slang_clear(lp) - slang_T *lp; + void +slang_clear(slang_T *lp) { garray_T *gap; fromto_T *ftp; @@ -2606,19 +1986,13 @@ slang_clear(lp) int i; int round; - vim_free(lp->sl_fbyts); - lp->sl_fbyts = NULL; - vim_free(lp->sl_kbyts); - lp->sl_kbyts = NULL; - vim_free(lp->sl_pbyts); - lp->sl_pbyts = NULL; + VIM_CLEAR(lp->sl_fbyts); + VIM_CLEAR(lp->sl_kbyts); + VIM_CLEAR(lp->sl_pbyts); - vim_free(lp->sl_fidxs); - lp->sl_fidxs = NULL; - vim_free(lp->sl_kidxs); - lp->sl_kidxs = NULL; - vim_free(lp->sl_pidxs); - lp->sl_pidxs = NULL; + VIM_CLEAR(lp->sl_fidxs); + VIM_CLEAR(lp->sl_kidxs); + VIM_CLEAR(lp->sl_pidxs); for (round = 1; round <= 2; ++round) { @@ -2660,26 +2034,19 @@ slang_clear(lp) for (i = 0; i < lp->sl_prefixcnt; ++i) vim_regfree(lp->sl_prefprog[i]); lp->sl_prefixcnt = 0; - vim_free(lp->sl_prefprog); - lp->sl_prefprog = NULL; + VIM_CLEAR(lp->sl_prefprog); - vim_free(lp->sl_info); - lp->sl_info = NULL; + VIM_CLEAR(lp->sl_info); - vim_free(lp->sl_midword); - lp->sl_midword = NULL; + VIM_CLEAR(lp->sl_midword); vim_regfree(lp->sl_compprog); - vim_free(lp->sl_comprules); - vim_free(lp->sl_compstartflags); - vim_free(lp->sl_compallflags); lp->sl_compprog = NULL; - lp->sl_comprules = NULL; - lp->sl_compstartflags = NULL; - lp->sl_compallflags = NULL; + VIM_CLEAR(lp->sl_comprules); + VIM_CLEAR(lp->sl_compstartflags); + VIM_CLEAR(lp->sl_compallflags); - vim_free(lp->sl_syllable); - lp->sl_syllable = NULL; + VIM_CLEAR(lp->sl_syllable); ga_clear(&lp->sl_syl_items); ga_clear_strings(&lp->sl_comppat); @@ -2703,14 +2070,11 @@ slang_clear(lp) /* * Clear the info from the .sug file in "lp". */ - static void -slang_clear_sug(lp) - slang_T *lp; + void +slang_clear_sug(slang_T *lp) { - vim_free(lp->sl_sbyts); - lp->sl_sbyts = NULL; - vim_free(lp->sl_sidxs); - lp->sl_sidxs = NULL; + VIM_CLEAR(lp->sl_sbyts); + VIM_CLEAR(lp->sl_sidxs); close_spellbuf(lp->sl_sugbuf); lp->sl_sugbuf = NULL; lp->sl_sugloaded = FALSE; @@ -2722,9 +2086,7 @@ slang_clear_sug(lp) * Invoked through do_in_runtimepath(). */ static void -spell_load_cb(fname, cookie) - char_u *fname; - void *cookie; +spell_load_cb(char_u *fname, void *cookie) { spelload_T *slp = (spelload_T *)cookie; slang_T *slang; @@ -2743,6916 +2105,883 @@ spell_load_cb(fname, cookie) } } + /* - * Load one spell file and store the info into a slang_T. - * - * This is invoked in three ways: - * - From spell_load_cb() to load a spell file for the first time. "lang" is - * the language name, "old_lp" is NULL. Will allocate an slang_T. - * - To reload a spell file that was changed. "lang" is NULL and "old_lp" - * points to the existing slang_T. - * - Just after writing a .spl file; it's read back to produce the .sug file. - * "old_lp" is NULL and "lang" is NULL. Will allocate an slang_T. - * - * Returns the slang_T the spell file was loaded into. NULL for error. + * Add a word to the hashtable of common words. + * If it's already there then the counter is increased. */ - static slang_T * -spell_load_file(fname, lang, old_lp, silent) - char_u *fname; - char_u *lang; - slang_T *old_lp; - int silent; /* no error if file doesn't exist */ + void +count_common_word( + slang_T *lp, + char_u *word, + int len, /* word length, -1 for upto NUL */ + int count) /* 1 to count once, 10 to init */ { - FILE *fd; - char_u buf[VIMSPELLMAGICL]; + hash_T hash; + hashitem_T *hi; + wordcount_T *wc; + char_u buf[MAXWLEN]; char_u *p; - int i; - int n; - int len; - char_u *save_sourcing_name = sourcing_name; - linenr_T save_sourcing_lnum = sourcing_lnum; - slang_T *lp = NULL; - int c = 0; - int res; - fd = mch_fopen((char *)fname, "r"); - if (fd == NULL) - { - if (!silent) - EMSG2(_(e_notopen), fname); - else if (p_verbose > 2) - { - verbose_enter(); - smsg((char_u *)e_notopen, fname); - verbose_leave(); - } - goto endFAIL; - } - if (p_verbose > 2) + if (len == -1) + p = word; + else { - verbose_enter(); - smsg((char_u *)_("Reading spell file \"%s\""), fname); - verbose_leave(); + vim_strncpy(buf, word, len); + p = buf; } - if (old_lp == NULL) + hash = hash_hash(p); + hi = hash_lookup(&lp->sl_wordcount, p, hash); + if (HASHITEM_EMPTY(hi)) { - lp = slang_alloc(lang); - if (lp == NULL) - goto endFAIL; - - /* Remember the file name, used to reload the file when it's updated. */ - lp->sl_fname = vim_strsave(fname); - if (lp->sl_fname == NULL) - goto endFAIL; - - /* Check for .add.spl (_add.spl for VMS). */ - lp->sl_add = strstr((char *)gettail(fname), SPL_FNAME_ADD) != NULL; + wc = (wordcount_T *)alloc((unsigned)(sizeof(wordcount_T) + STRLEN(p))); + if (wc == NULL) + return; + STRCPY(wc->wc_word, p); + wc->wc_count = count; + hash_add_item(&lp->sl_wordcount, hi, wc->wc_word, hash); } else - lp = old_lp; - - /* Set sourcing_name, so that error messages mention the file name. */ - sourcing_name = fname; - sourcing_lnum = 0; - - /* - * <HEADER>: <fileID> - */ - for (i = 0; i < VIMSPELLMAGICL; ++i) - buf[i] = getc(fd); /* <fileID> */ - if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) - { - EMSG(_("E757: This does not look like a spell file")); - goto endFAIL; - } - c = getc(fd); /* <versionnr> */ - if (c < VIMSPELLVERSION) - { - EMSG(_("E771: Old spell file, needs to be updated")); - goto endFAIL; - } - else if (c > VIMSPELLVERSION) { - EMSG(_("E772: Spell file is for newer version of Vim")); - goto endFAIL; + wc = HI2WC(hi); + if ((wc->wc_count += count) < (unsigned)count) /* check for overflow */ + wc->wc_count = MAXWORDCOUNT; } +} +/* + * Adjust the score of common words. + */ + static int +score_wordcount_adj( + slang_T *slang, + int score, + char_u *word, + int split) /* word was split, less bonus */ +{ + hashitem_T *hi; + wordcount_T *wc; + int bonus; + int newscore; - /* - * <SECTIONS>: <section> ... <sectionend> - * <section>: <sectionID> <sectionflags> <sectionlen> (section contents) - */ - for (;;) + hi = hash_find(&slang->sl_wordcount, word); + if (!HASHITEM_EMPTY(hi)) { - n = getc(fd); /* <sectionID> or <sectionend> */ - if (n == SN_END) - break; - c = getc(fd); /* <sectionflags> */ - len = get4c(fd); /* <sectionlen> */ - if (len < 0) - goto truncerr; + wc = HI2WC(hi); + if (wc->wc_count < SCORE_THRES2) + bonus = SCORE_COMMON1; + else if (wc->wc_count < SCORE_THRES3) + bonus = SCORE_COMMON2; + else + bonus = SCORE_COMMON3; + if (split) + newscore = score - bonus / 2; + else + newscore = score - bonus; + if (newscore < 0) + return 0; + return newscore; + } + return score; +} - res = 0; - switch (n) - { - case SN_INFO: - lp->sl_info = read_string(fd, len); /* <infotext> */ - if (lp->sl_info == NULL) - goto endFAIL; - break; - case SN_REGION: - res = read_region_section(fd, lp, len); - break; +/* + * Return TRUE if byte "n" appears in "str". + * Like strchr() but independent of locale. + */ + int +byte_in_str(char_u *str, int n) +{ + char_u *p; - case SN_CHARFLAGS: - res = read_charflags_section(fd); - break; + for (p = str; *p != NUL; ++p) + if (*p == n) + return TRUE; + return FALSE; +} - case SN_MIDWORD: - lp->sl_midword = read_string(fd, len); /* <midword> */ - if (lp->sl_midword == NULL) - goto endFAIL; - break; - - case SN_PREFCOND: - res = read_prefcond_section(fd, lp); - break; - - case SN_REP: - res = read_rep_section(fd, &lp->sl_rep, lp->sl_rep_first); - break; - - case SN_REPSAL: - res = read_rep_section(fd, &lp->sl_repsal, lp->sl_repsal_first); - break; - - case SN_SAL: - res = read_sal_section(fd, lp); - break; - - case SN_SOFO: - res = read_sofo_section(fd, lp); - break; - - case SN_MAP: - p = read_string(fd, len); /* <mapstr> */ - if (p == NULL) - goto endFAIL; - set_map_str(lp, p); - vim_free(p); - break; - - case SN_WORDS: - res = read_words_section(fd, lp, len); - break; - - case SN_SUGFILE: - lp->sl_sugtime = get8ctime(fd); /* <timestamp> */ - break; - - case SN_NOSPLITSUGS: - lp->sl_nosplitsugs = TRUE; /* <timestamp> */ - break; - - case SN_COMPOUND: - res = read_compound(fd, lp, len); - break; - - case SN_NOBREAK: - lp->sl_nobreak = TRUE; - break; - - case SN_SYLLABLE: - lp->sl_syllable = read_string(fd, len); /* <syllable> */ - if (lp->sl_syllable == NULL) - goto endFAIL; - if (init_syl_tab(lp) == FAIL) - goto endFAIL; - break; - - default: - /* Unsupported section. When it's required give an error - * message. When it's not required skip the contents. */ - if (c & SNF_REQUIRED) - { - EMSG(_("E770: Unsupported section in spell file")); - goto endFAIL; - } - while (--len >= 0) - if (getc(fd) < 0) - goto truncerr; - break; - } -someerror: - if (res == SP_FORMERROR) - { - EMSG(_(e_format)); - goto endFAIL; - } - if (res == SP_TRUNCERROR) - { -truncerr: - EMSG(_(e_spell_trunc)); - goto endFAIL; - } - if (res == SP_OTHERERROR) - goto endFAIL; - } - - /* <LWORDTREE> */ - res = spell_read_tree(fd, &lp->sl_fbyts, &lp->sl_fidxs, FALSE, 0); - if (res != 0) - goto someerror; - - /* <KWORDTREE> */ - res = spell_read_tree(fd, &lp->sl_kbyts, &lp->sl_kidxs, FALSE, 0); - if (res != 0) - goto someerror; - - /* <PREFIXTREE> */ - res = spell_read_tree(fd, &lp->sl_pbyts, &lp->sl_pidxs, TRUE, - lp->sl_prefixcnt); - if (res != 0) - goto someerror; - - /* For a new file link it in the list of spell files. */ - if (old_lp == NULL && lang != NULL) - { - lp->sl_next = first_lang; - first_lang = lp; - } - - goto endOK; - -endFAIL: - if (lang != NULL) - /* truncating the name signals the error to spell_load_lang() */ - *lang = NUL; - if (lp != NULL && old_lp == NULL) - slang_free(lp); - lp = NULL; - -endOK: - if (fd != NULL) - fclose(fd); - sourcing_name = save_sourcing_name; - sourcing_lnum = save_sourcing_lnum; - - return lp; -} - -/* - * Read a length field from "fd" in "cnt_bytes" bytes. - * Allocate memory, read the string into it and add a NUL at the end. - * Returns NULL when the count is zero. - * Sets "*cntp" to SP_*ERROR when there is an error, length of the result - * otherwise. - */ - static char_u * -read_cnt_string(fd, cnt_bytes, cntp) - FILE *fd; - int cnt_bytes; - int *cntp; -{ - int cnt = 0; - int i; - char_u *str; - - /* read the length bytes, MSB first */ - for (i = 0; i < cnt_bytes; ++i) - cnt = (cnt << 8) + getc(fd); - if (cnt < 0) - { - *cntp = SP_TRUNCERROR; - return NULL; - } - *cntp = cnt; - if (cnt == 0) - return NULL; /* nothing to read, return NULL */ - - str = read_string(fd, cnt); - if (str == NULL) - *cntp = SP_OTHERERROR; - return str; -} - -/* - * Read SN_REGION: <regionname> ... - * Return SP_*ERROR flags. - */ - static int -read_region_section(fd, lp, len) - FILE *fd; - slang_T *lp; - int len; -{ - int i; - - if (len > 16) - return SP_FORMERROR; - for (i = 0; i < len; ++i) - lp->sl_regions[i] = getc(fd); /* <regionname> */ - lp->sl_regions[len] = NUL; - return 0; -} - -/* - * Read SN_CHARFLAGS section: <charflagslen> <charflags> - * <folcharslen> <folchars> - * Return SP_*ERROR flags. - */ - static int -read_charflags_section(fd) - FILE *fd; -{ - char_u *flags; - char_u *fol; - int flagslen, follen; - - /* <charflagslen> <charflags> */ - flags = read_cnt_string(fd, 1, &flagslen); - if (flagslen < 0) - return flagslen; - - /* <folcharslen> <folchars> */ - fol = read_cnt_string(fd, 2, &follen); - if (follen < 0) - { - vim_free(flags); - return follen; - } - - /* Set the word-char flags and fill SPELL_ISUPPER() table. */ - if (flags != NULL && fol != NULL) - set_spell_charflags(flags, flagslen, fol); - - vim_free(flags); - vim_free(fol); - - /* When <charflagslen> is zero then <fcharlen> must also be zero. */ - if ((flags == NULL) != (fol == NULL)) - return SP_FORMERROR; - return 0; -} +#define SY_MAXLEN 30 +typedef struct syl_item_S +{ + char_u sy_chars[SY_MAXLEN]; /* the sequence of chars */ + int sy_len; +} syl_item_T; /* - * Read SN_PREFCOND section. - * Return SP_*ERROR flags. + * Truncate "slang->sl_syllable" at the first slash and put the following items + * in "slang->sl_syl_items". */ - static int -read_prefcond_section(fd, lp) - FILE *fd; - slang_T *lp; + int +init_syl_tab(slang_T *slang) { - int cnt; - int i; - int n; char_u *p; - char_u buf[MAXWLEN + 1]; - - /* <prefcondcnt> <prefcond> ... */ - cnt = get2c(fd); /* <prefcondcnt> */ - if (cnt <= 0) - return SP_FORMERROR; - - lp->sl_prefprog = (regprog_T **)alloc_clear( - (unsigned)sizeof(regprog_T *) * cnt); - if (lp->sl_prefprog == NULL) - return SP_OTHERERROR; - lp->sl_prefixcnt = cnt; + char_u *s; + int l; + syl_item_T *syl; - for (i = 0; i < cnt; ++i) + ga_init2(&slang->sl_syl_items, sizeof(syl_item_T), 4); + p = vim_strchr(slang->sl_syllable, '/'); + while (p != NULL) { - /* <prefcond> : <condlen> <condstr> */ - n = getc(fd); /* <condlen> */ - if (n < 0 || n >= MAXWLEN) + *p++ = NUL; + if (*p == NUL) /* trailing slash */ + break; + s = p; + p = vim_strchr(p, '/'); + if (p == NULL) + l = (int)STRLEN(s); + else + l = (int)(p - s); + if (l >= SY_MAXLEN) return SP_FORMERROR; - - /* When <condlen> is zero we have an empty condition. Otherwise - * compile the regexp program used to check for the condition. */ - if (n > 0) - { - buf[0] = '^'; /* always match at one position only */ - p = buf + 1; - while (n-- > 0) - *p++ = getc(fd); /* <condstr> */ - *p = NUL; - lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING); - } + if (ga_grow(&slang->sl_syl_items, 1) == FAIL) + return SP_OTHERERROR; + syl = ((syl_item_T *)slang->sl_syl_items.ga_data) + + slang->sl_syl_items.ga_len++; + vim_strncpy(syl->sy_chars, s, l); + syl->sy_len = l; } - return 0; + return OK; } /* - * Read REP or REPSAL items section from "fd": <repcount> <rep> ... - * Return SP_*ERROR flags. + * Count the number of syllables in "word". + * When "word" contains spaces the syllables after the last space are counted. + * Returns zero if syllables are not defines. */ static int -read_rep_section(fd, gap, first) - FILE *fd; - garray_T *gap; - short *first; +count_syllables(slang_T *slang, char_u *word) { - int cnt; - fromto_T *ftp; + int cnt = 0; + int skip = FALSE; + char_u *p; + int len; int i; + syl_item_T *syl; + int c; - cnt = get2c(fd); /* <repcount> */ - if (cnt < 0) - return SP_TRUNCERROR; - - if (ga_grow(gap, cnt) == FAIL) - return SP_OTHERERROR; + if (slang->sl_syllable == NULL) + return 0; - /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */ - for (; gap->ga_len < cnt; ++gap->ga_len) + for (p = word; *p != NUL; p += len) { - ftp = &((fromto_T *)gap->ga_data)[gap->ga_len]; - ftp->ft_from = read_cnt_string(fd, 1, &i); - if (i < 0) - return i; - if (i == 0) - return SP_FORMERROR; - ftp->ft_to = read_cnt_string(fd, 1, &i); - if (i <= 0) + /* When running into a space reset counter. */ + if (*p == ' ') { - vim_free(ftp->ft_from); - if (i < 0) - return i; - return SP_FORMERROR; + len = 1; + cnt = 0; + continue; } - } - - /* Fill the first-index table. */ - for (i = 0; i < 256; ++i) - first[i] = -1; - for (i = 0; i < gap->ga_len; ++i) - { - ftp = &((fromto_T *)gap->ga_data)[i]; - if (first[*ftp->ft_from] == -1) - first[*ftp->ft_from] = i; - } - return 0; -} - -/* - * Read SN_SAL section: <salflags> <salcount> <sal> ... - * Return SP_*ERROR flags. - */ - static int -read_sal_section(fd, slang) - FILE *fd; - slang_T *slang; -{ - int i; - int cnt; - garray_T *gap; - salitem_T *smp; - int ccnt; - char_u *p; - int c = NUL; - - slang->sl_sofo = FALSE; - - i = getc(fd); /* <salflags> */ - if (i & SAL_F0LLOWUP) - slang->sl_followup = TRUE; - if (i & SAL_COLLAPSE) - slang->sl_collapse = TRUE; - if (i & SAL_REM_ACCENTS) - slang->sl_rem_accents = TRUE; - - cnt = get2c(fd); /* <salcount> */ - if (cnt < 0) - return SP_TRUNCERROR; - - gap = &slang->sl_sal; - ga_init2(gap, sizeof(salitem_T), 10); - if (ga_grow(gap, cnt + 1) == FAIL) - return SP_OTHERERROR; - - /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */ - for (; gap->ga_len < cnt; ++gap->ga_len) - { - smp = &((salitem_T *)gap->ga_data)[gap->ga_len]; - ccnt = getc(fd); /* <salfromlen> */ - if (ccnt < 0) - return SP_TRUNCERROR; - if ((p = alloc(ccnt + 2)) == NULL) - return SP_OTHERERROR; - smp->sm_lead = p; - /* Read up to the first special char into sm_lead. */ - for (i = 0; i < ccnt; ++i) + /* Find longest match of syllable items. */ + len = 0; + for (i = 0; i < slang->sl_syl_items.ga_len; ++i) { - c = getc(fd); /* <salfrom> */ - if (vim_strchr((char_u *)"0123456789(-<^$", c) != NULL) - break; - *p++ = c; + syl = ((syl_item_T *)slang->sl_syl_items.ga_data) + i; + if (syl->sy_len > len + && STRNCMP(p, syl->sy_chars, syl->sy_len) == 0) + len = syl->sy_len; } - smp->sm_leadlen = (int)(p - smp->sm_lead); - *p++ = NUL; - - /* Put (abc) chars in sm_oneof, if any. */ - if (c == '(') + if (len != 0) /* found a match, count syllable */ { - smp->sm_oneof = p; - for (++i; i < ccnt; ++i) - { - c = getc(fd); /* <salfrom> */ - if (c == ')') - break; - *p++ = c; - } - *p++ = NUL; - if (++i < ccnt) - c = getc(fd); + ++cnt; + skip = FALSE; } else - smp->sm_oneof = NULL; - - /* Any following chars go in sm_rules. */ - smp->sm_rules = p; - if (i < ccnt) - /* store the char we got while checking for end of sm_lead */ - *p++ = c; - for (++i; i < ccnt; ++i) - *p++ = getc(fd); /* <salfrom> */ - *p++ = NUL; - - /* <saltolen> <salto> */ - smp->sm_to = read_cnt_string(fd, 1, &ccnt); - if (ccnt < 0) { - vim_free(smp->sm_lead); - return ccnt; - } - + /* No recognized syllable item, at least a syllable char then? */ #ifdef FEAT_MBYTE - if (has_mbyte) - { - /* convert the multi-byte strings to wide char strings */ - smp->sm_lead_w = mb_str2wide(smp->sm_lead); - smp->sm_leadlen = mb_charlen(smp->sm_lead); - if (smp->sm_oneof == NULL) - smp->sm_oneof_w = NULL; - else - smp->sm_oneof_w = mb_str2wide(smp->sm_oneof); - if (smp->sm_to == NULL) - smp->sm_to_w = NULL; - else - smp->sm_to_w = mb_str2wide(smp->sm_to); - if (smp->sm_lead_w == NULL - || (smp->sm_oneof_w == NULL && smp->sm_oneof != NULL) - || (smp->sm_to_w == NULL && smp->sm_to != NULL)) - { - vim_free(smp->sm_lead); - vim_free(smp->sm_to); - vim_free(smp->sm_lead_w); - vim_free(smp->sm_oneof_w); - vim_free(smp->sm_to_w); - return SP_OTHERERROR; - } - } + c = mb_ptr2char(p); + len = (*mb_ptr2len)(p); +#else + c = *p; + len = 1; #endif - } - - if (gap->ga_len > 0) - { - /* Add one extra entry to mark the end with an empty sm_lead. Avoids - * that we need to check the index every time. */ - smp = &((salitem_T *)gap->ga_data)[gap->ga_len]; - if ((p = alloc(1)) == NULL) - return SP_OTHERERROR; - p[0] = NUL; - smp->sm_lead = p; - smp->sm_leadlen = 0; - smp->sm_oneof = NULL; - smp->sm_rules = p; - smp->sm_to = NULL; -#ifdef FEAT_MBYTE - if (has_mbyte) - { - smp->sm_lead_w = mb_str2wide(smp->sm_lead); - smp->sm_leadlen = 0; - smp->sm_oneof_w = NULL; - smp->sm_to_w = NULL; + if (vim_strchr(slang->sl_syllable, c) == NULL) + skip = FALSE; /* No, search for next syllable */ + else if (!skip) + { + ++cnt; /* Yes, count it */ + skip = TRUE; /* don't count following syllable chars */ + } } -#endif - ++gap->ga_len; } - - /* Fill the first-index table. */ - set_sal_first(slang); - - return 0; + return cnt; } /* - * Read SN_WORDS: <word> ... - * Return SP_*ERROR flags. + * Parse 'spelllang' and set w_s->b_langp accordingly. + * Returns NULL if it's OK, an error message otherwise. */ - static int -read_words_section(fd, lp, len) - FILE *fd; - slang_T *lp; - int len; + char_u * +did_set_spelllang(win_T *wp) { - int done = 0; - int i; + garray_T ga; + char_u *splp; + char_u *region; + char_u region_cp[3]; + int filename; + int region_mask; + slang_T *slang; int c; - char_u word[MAXWLEN]; - - while (done < len) - { - /* Read one word at a time. */ - for (i = 0; ; ++i) - { - c = getc(fd); - if (c == EOF) - return SP_TRUNCERROR; - word[i] = c; - if (word[i] == NUL) - break; - if (i == MAXWLEN - 1) - return SP_FORMERROR; - } + char_u lang[MAXWLEN + 1]; + char_u spf_name[MAXPATHL]; + int len; + char_u *p; + int round; + char_u *spf; + char_u *use_region = NULL; + int dont_use_region = FALSE; + int nobreak = FALSE; + int i, j; + langp_T *lp, *lp2; + static int recursive = FALSE; + char_u *ret_msg = NULL; + char_u *spl_copy; + bufref_T bufref; - /* Init the count to 10. */ - count_common_word(lp, word, -1, 10); - done += i + 1; - } - return 0; -} + set_bufref(&bufref, wp->w_buffer); -/* - * Add a word to the hashtable of common words. - * If it's already there then the counter is increased. - */ - static void -count_common_word(lp, word, len, count) - slang_T *lp; - char_u *word; - int len; /* word length, -1 for upto NUL */ - int count; /* 1 to count once, 10 to init */ -{ - hash_T hash; - hashitem_T *hi; - wordcount_T *wc; - char_u buf[MAXWLEN]; - char_u *p; - - if (len == -1) - p = word; - else - { - vim_strncpy(buf, word, len); - p = buf; - } - - hash = hash_hash(p); - hi = hash_lookup(&lp->sl_wordcount, p, hash); - if (HASHITEM_EMPTY(hi)) - { - wc = (wordcount_T *)alloc((unsigned)(sizeof(wordcount_T) + STRLEN(p))); - if (wc == NULL) - return; - STRCPY(wc->wc_word, p); - wc->wc_count = count; - hash_add_item(&lp->sl_wordcount, hi, wc->wc_word, hash); - } - else - { - wc = HI2WC(hi); - if ((wc->wc_count += count) < (unsigned)count) /* check for overflow */ - wc->wc_count = MAXWORDCOUNT; - } -} - -/* - * Adjust the score of common words. - */ - static int -score_wordcount_adj(slang, score, word, split) - slang_T *slang; - int score; - char_u *word; - int split; /* word was split, less bonus */ -{ - hashitem_T *hi; - wordcount_T *wc; - int bonus; - int newscore; - - hi = hash_find(&slang->sl_wordcount, word); - if (!HASHITEM_EMPTY(hi)) - { - wc = HI2WC(hi); - if (wc->wc_count < SCORE_THRES2) - bonus = SCORE_COMMON1; - else if (wc->wc_count < SCORE_THRES3) - bonus = SCORE_COMMON2; - else - bonus = SCORE_COMMON3; - if (split) - newscore = score - bonus / 2; - else - newscore = score - bonus; - if (newscore < 0) - return 0; - return newscore; - } - return score; -} - -/* - * SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> - * Return SP_*ERROR flags. - */ - static int -read_sofo_section(fd, slang) - FILE *fd; - slang_T *slang; -{ - int cnt; - char_u *from, *to; - int res; - - slang->sl_sofo = TRUE; - - /* <sofofromlen> <sofofrom> */ - from = read_cnt_string(fd, 2, &cnt); - if (cnt < 0) - return cnt; - - /* <sofotolen> <sofoto> */ - to = read_cnt_string(fd, 2, &cnt); - if (cnt < 0) - { - vim_free(from); - return cnt; - } - - /* Store the info in slang->sl_sal and/or slang->sl_sal_first. */ - if (from != NULL && to != NULL) - res = set_sofo(slang, from, to); - else if (from != NULL || to != NULL) - res = SP_FORMERROR; /* only one of two strings is an error */ - else - res = 0; + /* We don't want to do this recursively. May happen when a language is + * not available and the SpellFileMissing autocommand opens a new buffer + * in which 'spell' is set. */ + if (recursive) + return NULL; + recursive = TRUE; - vim_free(from); - vim_free(to); - return res; -} + ga_init2(&ga, sizeof(langp_T), 2); + clear_midword(wp); -/* - * Read the compound section from the .spl file: - * <compmax> <compminlen> <compsylmax> <compoptions> <compflags> - * Returns SP_*ERROR flags. - */ - static int -read_compound(fd, slang, len) - FILE *fd; - slang_T *slang; - int len; -{ - int todo = len; - int c; - int atstart; - char_u *pat; - char_u *pp; - char_u *cp; - char_u *ap; - char_u *crp; - int cnt; - garray_T *gap; + /* Make a copy of 'spelllang', the SpellFileMissing autocommands may change + * it under our fingers. */ + spl_copy = vim_strsave(wp->w_s->b_p_spl); + if (spl_copy == NULL) + goto theend; - if (todo < 2) - return SP_FORMERROR; /* need at least two bytes */ - - --todo; - c = getc(fd); /* <compmax> */ - if (c < 2) - c = MAXWLEN; - slang->sl_compmax = c; - - --todo; - c = getc(fd); /* <compminlen> */ - if (c < 1) - c = 0; - slang->sl_compminlen = c; - - --todo; - c = getc(fd); /* <compsylmax> */ - if (c < 1) - c = MAXWLEN; - slang->sl_compsylmax = c; - - c = getc(fd); /* <compoptions> */ - if (c != 0) - ungetc(c, fd); /* be backwards compatible with Vim 7.0b */ - else - { - --todo; - c = getc(fd); /* only use the lower byte for now */ - --todo; - slang->sl_compoptions = c; - - gap = &slang->sl_comppat; - c = get2c(fd); /* <comppatcount> */ - todo -= 2; - ga_init2(gap, sizeof(char_u *), c); - if (ga_grow(gap, c) == OK) - while (--c >= 0) - { - ((char_u **)(gap->ga_data))[gap->ga_len++] = - read_cnt_string(fd, 1, &cnt); - /* <comppatlen> <comppattext> */ - if (cnt < 0) - return cnt; - todo -= cnt + 1; - } - } - if (todo < 0) - return SP_FORMERROR; - - /* Turn the COMPOUNDRULE items into a regexp pattern: - * "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$". - * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. - * Conversion to utf-8 may double the size. */ - c = todo * 2 + 7; #ifdef FEAT_MBYTE - if (enc_utf8) - c += todo * 2; + wp->w_s->b_cjk = 0; #endif - pat = alloc((unsigned)c); - if (pat == NULL) - return SP_OTHERERROR; - /* We also need a list of all flags that can appear at the start and one - * for all flags. */ - cp = alloc(todo + 1); - if (cp == NULL) + /* Loop over comma separated language names. */ + for (splp = spl_copy; *splp != NUL; ) { - vim_free(pat); - return SP_OTHERERROR; - } - slang->sl_compstartflags = cp; - *cp = NUL; + /* Get one language name. */ + copy_option_part(&splp, lang, MAXWLEN, ","); + region = NULL; + len = (int)STRLEN(lang); - ap = alloc(todo + 1); - if (ap == NULL) - { - vim_free(pat); - return SP_OTHERERROR; - } - slang->sl_compallflags = ap; - *ap = NUL; + if (STRCMP(lang, "cjk") == 0) + { +#ifdef FEAT_MBYTE + wp->w_s->b_cjk = 1; +#endif + continue; + } - /* And a list of all patterns in their original form, for checking whether - * compounding may work in match_compoundrule(). This is freed when we - * encounter a wildcard, the check doesn't work then. */ - crp = alloc(todo + 1); - slang->sl_comprules = crp; + /* If the name ends in ".spl" use it as the name of the spell file. + * If there is a region name let "region" point to it and remove it + * from the name. */ + if (len > 4 && fnamecmp(lang + len - 4, ".spl") == 0) + { + filename = TRUE; - pp = pat; - *pp++ = '^'; - *pp++ = '\\'; - *pp++ = '('; + /* Locate a region and remove it from the file name. */ + p = vim_strchr(gettail(lang), '_'); + if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2]) + && !ASCII_ISALPHA(p[3])) + { + vim_strncpy(region_cp, p + 1, 2); + mch_memmove(p, p + 3, len - (p - lang) - 2); + region = region_cp; + } + else + dont_use_region = TRUE; - atstart = 1; - while (todo-- > 0) - { - c = getc(fd); /* <compflags> */ - if (c == EOF) + /* Check if we loaded this language before. */ + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (fullpathcmp(lang, slang->sl_fname, FALSE) == FPC_SAME) + break; + } + else { - vim_free(pat); - return SP_TRUNCERROR; + filename = FALSE; + if (len > 3 && lang[len - 3] == '_') + { + region = lang + len - 2; + len -= 3; + lang[len] = NUL; + } + else + dont_use_region = TRUE; + + /* Check if we loaded this language before. */ + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (STRICMP(lang, slang->sl_name) == 0) + break; } - /* Add all flags to "sl_compallflags". */ - if (vim_strchr((char_u *)"?*+[]/", c) == NULL - && !byte_in_str(slang->sl_compallflags, c)) + if (region != NULL) { - *ap++ = c; - *ap = NUL; + /* If the region differs from what was used before then don't + * use it for 'spellfile'. */ + if (use_region != NULL && STRCMP(region, use_region) != 0) + dont_use_region = TRUE; + use_region = region; } - if (atstart != 0) + /* If not found try loading the language now. */ + if (slang == NULL) { - /* At start of item: copy flags to "sl_compstartflags". For a - * [abc] item set "atstart" to 2 and copy up to the ']'. */ - if (c == '[') - atstart = 2; - else if (c == ']') - atstart = 0; + if (filename) + (void)spell_load_file(lang, lang, NULL, FALSE); else { - if (!byte_in_str(slang->sl_compstartflags, c)) + spell_load_lang(lang); + /* SpellFileMissing autocommands may do anything, including + * destroying the buffer we are using... */ + if (!bufref_valid(&bufref)) { - *cp++ = c; - *cp = NUL; + ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer"); + goto theend; } - if (atstart == 1) - atstart = 0; } } - /* Copy flag to "sl_comprules", unless we run into a wildcard. */ - if (crp != NULL) - { - if (c == '?' || c == '+' || c == '*') + /* + * Loop over the languages, there can be several files for "lang". + */ + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (filename ? fullpathcmp(lang, slang->sl_fname, FALSE) == FPC_SAME + : STRICMP(lang, slang->sl_name) == 0) { - vim_free(slang->sl_comprules); - slang->sl_comprules = NULL; - crp = NULL; + region_mask = REGION_ALL; + if (!filename && region != NULL) + { + /* find region in sl_regions */ + c = find_region(slang->sl_regions, region); + if (c == REGION_ALL) + { + if (slang->sl_add) + { + if (*slang->sl_regions != NUL) + /* This addition file is for other regions. */ + region_mask = 0; + } + else + /* This is probably an error. Give a warning and + * accept the words anyway. */ + smsg((char_u *) + _("Warning: region %s not supported"), + region); + } + else + region_mask = 1 << c; + } + + if (region_mask != 0) + { + if (ga_grow(&ga, 1) == FAIL) + { + ga_clear(&ga); + ret_msg = e_outofmem; + goto theend; + } + LANGP_ENTRY(ga, ga.ga_len)->lp_slang = slang; + LANGP_ENTRY(ga, ga.ga_len)->lp_region = region_mask; + ++ga.ga_len; + use_midword(slang, wp); + if (slang->sl_nobreak) + nobreak = TRUE; + } } - else - *crp++ = c; - } + } - if (c == '/') /* slash separates two items */ + /* round 0: load int_wordlist, if possible. + * round 1: load first name in 'spellfile'. + * round 2: load second name in 'spellfile. + * etc. */ + spf = curwin->w_s->b_p_spf; + for (round = 0; round == 0 || *spf != NUL; ++round) + { + if (round == 0) { - *pp++ = '\\'; - *pp++ = '|'; - atstart = 1; + /* Internal wordlist, if there is one. */ + if (int_wordlist == NULL) + continue; + int_wordlist_spl(spf_name); } - else /* normal char, "[abc]" and '*' are copied as-is */ + else { - if (c == '?' || c == '+' || c == '~') - *pp++ = '\\'; /* "a?" becomes "a\?", "a+" becomes "a\+" */ -#ifdef FEAT_MBYTE - if (enc_utf8) - pp += mb_char2bytes(c, pp); - else -#endif - *pp++ = c; - } - } - - *pp++ = '\\'; - *pp++ = ')'; - *pp++ = '$'; - *pp = NUL; - - if (crp != NULL) - *crp = NUL; - - slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT); - vim_free(pat); - if (slang->sl_compprog == NULL) - return SP_FORMERROR; + /* One entry in 'spellfile'. */ + copy_option_part(&spf, spf_name, MAXPATHL - 5, ","); + STRCAT(spf_name, ".spl"); - return 0; -} - -/* - * Return TRUE if byte "n" appears in "str". - * Like strchr() but independent of locale. - */ - static int -byte_in_str(str, n) - char_u *str; - int n; -{ - char_u *p; - - for (p = str; *p != NUL; ++p) - if (*p == n) - return TRUE; - return FALSE; -} - -#define SY_MAXLEN 30 -typedef struct syl_item_S -{ - char_u sy_chars[SY_MAXLEN]; /* the sequence of chars */ - int sy_len; -} syl_item_T; - -/* - * Truncate "slang->sl_syllable" at the first slash and put the following items - * in "slang->sl_syl_items". - */ - static int -init_syl_tab(slang) - slang_T *slang; -{ - char_u *p; - char_u *s; - int l; - syl_item_T *syl; - - ga_init2(&slang->sl_syl_items, sizeof(syl_item_T), 4); - p = vim_strchr(slang->sl_syllable, '/'); - while (p != NULL) - { - *p++ = NUL; - if (*p == NUL) /* trailing slash */ - break; - s = p; - p = vim_strchr(p, '/'); - if (p == NULL) - l = (int)STRLEN(s); - else - l = (int)(p - s); - if (l >= SY_MAXLEN) - return SP_FORMERROR; - if (ga_grow(&slang->sl_syl_items, 1) == FAIL) - return SP_OTHERERROR; - syl = ((syl_item_T *)slang->sl_syl_items.ga_data) - + slang->sl_syl_items.ga_len++; - vim_strncpy(syl->sy_chars, s, l); - syl->sy_len = l; - } - return OK; -} - -/* - * Count the number of syllables in "word". - * When "word" contains spaces the syllables after the last space are counted. - * Returns zero if syllables are not defines. - */ - static int -count_syllables(slang, word) - slang_T *slang; - char_u *word; -{ - int cnt = 0; - int skip = FALSE; - char_u *p; - int len; - int i; - syl_item_T *syl; - int c; - - if (slang->sl_syllable == NULL) - return 0; - - for (p = word; *p != NUL; p += len) - { - /* When running into a space reset counter. */ - if (*p == ' ') - { - len = 1; - cnt = 0; - continue; - } - - /* Find longest match of syllable items. */ - len = 0; - for (i = 0; i < slang->sl_syl_items.ga_len; ++i) - { - syl = ((syl_item_T *)slang->sl_syl_items.ga_data) + i; - if (syl->sy_len > len - && STRNCMP(p, syl->sy_chars, syl->sy_len) == 0) - len = syl->sy_len; - } - if (len != 0) /* found a match, count syllable */ - { - ++cnt; - skip = FALSE; - } - else - { - /* No recognized syllable item, at least a syllable char then? */ -#ifdef FEAT_MBYTE - c = mb_ptr2char(p); - len = (*mb_ptr2len)(p); -#else - c = *p; - len = 1; -#endif - if (vim_strchr(slang->sl_syllable, c) == NULL) - skip = FALSE; /* No, search for next syllable */ - else if (!skip) + /* If it was already found above then skip it. */ + for (c = 0; c < ga.ga_len; ++c) { - ++cnt; /* Yes, count it */ - skip = TRUE; /* don't count following syllable chars */ + p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname; + if (p != NULL && fullpathcmp(spf_name, p, FALSE) == FPC_SAME) + break; } + if (c < ga.ga_len) + continue; } - } - return cnt; -} - -/* - * Set the SOFOFROM and SOFOTO items in language "lp". - * Returns SP_*ERROR flags when there is something wrong. - */ - static int -set_sofo(lp, from, to) - slang_T *lp; - char_u *from; - char_u *to; -{ - int i; - -#ifdef FEAT_MBYTE - garray_T *gap; - char_u *s; - char_u *p; - int c; - int *inp; - - if (has_mbyte) - { - /* Use "sl_sal" as an array with 256 pointers to a list of wide - * characters. The index is the low byte of the character. - * The list contains from-to pairs with a terminating NUL. - * sl_sal_first[] is used for latin1 "from" characters. */ - gap = &lp->sl_sal; - ga_init2(gap, sizeof(int *), 1); - if (ga_grow(gap, 256) == FAIL) - return SP_OTHERERROR; - vim_memset(gap->ga_data, 0, sizeof(int *) * 256); - gap->ga_len = 256; - /* First count the number of items for each list. Temporarily use - * sl_sal_first[] for this. */ - for (p = from, s = to; *p != NUL && *s != NUL; ) + /* Check if it was loaded already. */ + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (fullpathcmp(spf_name, slang->sl_fname, FALSE) == FPC_SAME) + break; + if (slang == NULL) { - c = mb_cptr2char_adv(&p); - mb_cptr_adv(s); - if (c >= 256) - ++lp->sl_sal_first[c & 0xff]; - } - if (*p != NUL || *s != NUL) /* lengths differ */ - return SP_FORMERROR; - - /* Allocate the lists. */ - for (i = 0; i < 256; ++i) - if (lp->sl_sal_first[i] > 0) + /* Not loaded, try loading it now. The language name includes the + * region name, the region is ignored otherwise. for int_wordlist + * use an arbitrary name. */ + if (round == 0) + STRCPY(lang, "internal wordlist"); + else { - p = alloc(sizeof(int) * (lp->sl_sal_first[i] * 2 + 1)); - if (p == NULL) - return SP_OTHERERROR; - ((int **)gap->ga_data)[i] = (int *)p; - *(int *)p = 0; + vim_strncpy(lang, gettail(spf_name), MAXWLEN); + p = vim_strchr(lang, '.'); + if (p != NULL) + *p = NUL; /* truncate at ".encoding.add" */ } + slang = spell_load_file(spf_name, lang, NULL, TRUE); - /* Put the characters up to 255 in sl_sal_first[] the rest in a sl_sal - * list. */ - vim_memset(lp->sl_sal_first, 0, sizeof(salfirst_T) * 256); - for (p = from, s = to; *p != NUL && *s != NUL; ) - { - c = mb_cptr2char_adv(&p); - i = mb_cptr2char_adv(&s); - if (c >= 256) - { - /* Append the from-to chars at the end of the list with - * the low byte. */ - inp = ((int **)gap->ga_data)[c & 0xff]; - while (*inp != 0) - ++inp; - *inp++ = c; /* from char */ - *inp++ = i; /* to char */ - *inp++ = NUL; /* NUL at the end */ - } - else - /* mapping byte to char is done in sl_sal_first[] */ - lp->sl_sal_first[c] = i; + /* If one of the languages has NOBREAK we assume the addition + * files also have this. */ + if (slang != NULL && nobreak) + slang->sl_nobreak = TRUE; } - } - else -#endif - { - /* mapping bytes to bytes is done in sl_sal_first[] */ - if (STRLEN(from) != STRLEN(to)) - return SP_FORMERROR; - - for (i = 0; to[i] != NUL; ++i) - lp->sl_sal_first[from[i]] = to[i]; - lp->sl_sal.ga_len = 1; /* indicates we have soundfolding */ - } - - return 0; -} - -/* - * Fill the first-index table for "lp". - */ - static void -set_sal_first(lp) - slang_T *lp; -{ - salfirst_T *sfirst; - int i; - salitem_T *smp; - int c; - garray_T *gap = &lp->sl_sal; - - sfirst = lp->sl_sal_first; - for (i = 0; i < 256; ++i) - sfirst[i] = -1; - smp = (salitem_T *)gap->ga_data; - for (i = 0; i < gap->ga_len; ++i) - { -#ifdef FEAT_MBYTE - if (has_mbyte) - /* Use the lowest byte of the first character. For latin1 it's - * the character, for other encodings it should differ for most - * characters. */ - c = *smp[i].sm_lead_w & 0xff; - else -#endif - c = *smp[i].sm_lead; - if (sfirst[c] == -1) + if (slang != NULL && ga_grow(&ga, 1) == OK) { - sfirst[c] = i; -#ifdef FEAT_MBYTE - if (has_mbyte) + region_mask = REGION_ALL; + if (use_region != NULL && !dont_use_region) { - int n; - - /* Make sure all entries with this byte are following each - * other. Move the ones that are in the wrong position. Do - * keep the same ordering! */ - while (i + 1 < gap->ga_len - && (*smp[i + 1].sm_lead_w & 0xff) == c) - /* Skip over entry with same index byte. */ - ++i; + /* find region in sl_regions */ + c = find_region(slang->sl_regions, use_region); + if (c != REGION_ALL) + region_mask = 1 << c; + else if (*slang->sl_regions != NUL) + /* This spell file is for other regions. */ + region_mask = 0; + } - for (n = 1; i + n < gap->ga_len; ++n) - if ((*smp[i + n].sm_lead_w & 0xff) == c) - { - salitem_T tsal; - - /* Move entry with same index byte after the entries - * we already found. */ - ++i; - --n; - tsal = smp[i + n]; - mch_memmove(smp + i + 1, smp + i, - sizeof(salitem_T) * n); - smp[i] = tsal; - } + if (region_mask != 0) + { + LANGP_ENTRY(ga, ga.ga_len)->lp_slang = slang; + LANGP_ENTRY(ga, ga.ga_len)->lp_sallang = NULL; + LANGP_ENTRY(ga, ga.ga_len)->lp_replang = NULL; + LANGP_ENTRY(ga, ga.ga_len)->lp_region = region_mask; + ++ga.ga_len; + use_midword(slang, wp); } -#endif } } -} - -#ifdef FEAT_MBYTE -/* - * Turn a multi-byte string into a wide character string. - * Return it in allocated memory (NULL for out-of-memory) - */ - static int * -mb_str2wide(s) - char_u *s; -{ - int *res; - char_u *p; - int i = 0; - - res = (int *)alloc(sizeof(int) * (mb_charlen(s) + 1)); - if (res != NULL) - { - for (p = s; *p != NUL; ) - res[i++] = mb_ptr2char_adv(&p); - res[i] = NUL; - } - return res; -} -#endif - -/* - * Read a tree from the .spl or .sug file. - * Allocates the memory and stores pointers in "bytsp" and "idxsp". - * This is skipped when the tree has zero length. - * Returns zero when OK, SP_ value for an error. - */ - static int -spell_read_tree(fd, bytsp, idxsp, prefixtree, prefixcnt) - FILE *fd; - char_u **bytsp; - idx_T **idxsp; - int prefixtree; /* TRUE for the prefix tree */ - int prefixcnt; /* when "prefixtree" is TRUE: prefix count */ -{ - int len; - int idx; - char_u *bp; - idx_T *ip; - - /* The tree size was computed when writing the file, so that we can - * allocate it as one long block. <nodecount> */ - len = get4c(fd); - if (len < 0) - return SP_TRUNCERROR; - if (len > 0) - { - /* Allocate the byte array. */ - bp = lalloc((long_u)len, TRUE); - if (bp == NULL) - return SP_OTHERERROR; - *bytsp = bp; - - /* Allocate the index array. */ - ip = (idx_T *)lalloc_clear((long_u)(len * sizeof(int)), TRUE); - if (ip == NULL) - return SP_OTHERERROR; - *idxsp = ip; - /* Recursively read the tree and store it in the array. */ - idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt); - if (idx < 0) - return idx; - } - return 0; -} - -/* - * Read one row of siblings from the spell file and store it in the byte array - * "byts" and index array "idxs". Recursively read the children. - * - * NOTE: The code here must match put_node()! - * - * Returns the index (>= 0) following the siblings. - * Returns SP_TRUNCERROR if the file is shorter than expected. - * Returns SP_FORMERROR if there is a format error. - */ - static idx_T -read_tree_node(fd, byts, idxs, maxidx, startidx, prefixtree, maxprefcondnr) - FILE *fd; - char_u *byts; - idx_T *idxs; - int maxidx; /* size of arrays */ - idx_T startidx; /* current index in "byts" and "idxs" */ - int prefixtree; /* TRUE for reading PREFIXTREE */ - int maxprefcondnr; /* maximum for <prefcondnr> */ -{ - int len; - int i; - int n; - idx_T idx = startidx; - int c; - int c2; -#define SHARED_MASK 0x8000000 - - len = getc(fd); /* <siblingcount> */ - if (len <= 0) - return SP_TRUNCERROR; - - if (startidx + len >= maxidx) - return SP_FORMERROR; - byts[idx++] = len; - - /* Read the byte values, flag/region bytes and shared indexes. */ - for (i = 1; i <= len; ++i) - { - c = getc(fd); /* <byte> */ - if (c < 0) - return SP_TRUNCERROR; - if (c <= BY_SPECIAL) - { - if (c == BY_NOFLAGS && !prefixtree) - { - /* No flags, all regions. */ - idxs[idx] = 0; - c = 0; - } - else if (c != BY_INDEX) - { - if (prefixtree) - { - /* Read the optional pflags byte, the prefix ID and the - * condition nr. In idxs[] store the prefix ID in the low - * byte, the condition index shifted up 8 bits, the flags - * shifted up 24 bits. */ - if (c == BY_FLAGS) - c = getc(fd) << 24; /* <pflags> */ - else - c = 0; - - c |= getc(fd); /* <affixID> */ - - n = get2c(fd); /* <prefcondnr> */ - if (n >= maxprefcondnr) - return SP_FORMERROR; - c |= (n << 8); - } - else /* c must be BY_FLAGS or BY_FLAGS2 */ - { - /* Read flags and optional region and prefix ID. In - * idxs[] the flags go in the low two bytes, region above - * that and prefix ID above the region. */ - c2 = c; - c = getc(fd); /* <flags> */ - if (c2 == BY_FLAGS2) - c = (getc(fd) << 8) + c; /* <flags2> */ - if (c & WF_REGION) - c = (getc(fd) << 16) + c; /* <region> */ - if (c & WF_AFX) - c = (getc(fd) << 24) + c; /* <affixID> */ - } - - idxs[idx] = c; - c = 0; - } - else /* c == BY_INDEX */ - { - /* <nodeidx> */ - n = get3c(fd); - if (n < 0 || n >= maxidx) - return SP_FORMERROR; - idxs[idx] = n + SHARED_MASK; - c = getc(fd); /* <xbyte> */ - } - } - byts[idx++] = c; - } - - /* Recursively read the children for non-shared siblings. - * Skip the end-of-word ones (zero byte value) and the shared ones (and - * remove SHARED_MASK) */ - for (i = 1; i <= len; ++i) - if (byts[startidx + i] != 0) - { - if (idxs[startidx + i] & SHARED_MASK) - idxs[startidx + i] &= ~SHARED_MASK; - else - { - idxs[startidx + i] = idx; - idx = read_tree_node(fd, byts, idxs, maxidx, idx, - prefixtree, maxprefcondnr); - if (idx < 0) - break; - } - } - - return idx; -} - -/* - * Parse 'spelllang' and set w_s->b_langp accordingly. - * Returns NULL if it's OK, an error message otherwise. - */ - char_u * -did_set_spelllang(wp) - win_T *wp; -{ - garray_T ga; - char_u *splp; - char_u *region; - char_u region_cp[3]; - int filename; - int region_mask; - slang_T *slang; - int c; - char_u lang[MAXWLEN + 1]; - char_u spf_name[MAXPATHL]; - int len; - char_u *p; - int round; - char_u *spf; - char_u *use_region = NULL; - int dont_use_region = FALSE; - int nobreak = FALSE; - int i, j; - langp_T *lp, *lp2; - static int recursive = FALSE; - char_u *ret_msg = NULL; - char_u *spl_copy; - - /* We don't want to do this recursively. May happen when a language is - * not available and the SpellFileMissing autocommand opens a new buffer - * in which 'spell' is set. */ - if (recursive) - return NULL; - recursive = TRUE; - - ga_init2(&ga, sizeof(langp_T), 2); - clear_midword(wp); - - /* Make a copy of 'spelllang', the SpellFileMissing autocommands may change - * it under our fingers. */ - spl_copy = vim_strsave(wp->w_s->b_p_spl); - if (spl_copy == NULL) - goto theend; - -#ifdef FEAT_MBYTE - wp->w_s->b_cjk = 0; -#endif - - /* Loop over comma separated language names. */ - for (splp = spl_copy; *splp != NUL; ) - { - /* Get one language name. */ - copy_option_part(&splp, lang, MAXWLEN, ","); - region = NULL; - len = (int)STRLEN(lang); - - if (STRCMP(lang, "cjk") == 0) - { -#ifdef FEAT_MBYTE - wp->w_s->b_cjk = 1; -#endif - continue; - } - - /* If the name ends in ".spl" use it as the name of the spell file. - * If there is a region name let "region" point to it and remove it - * from the name. */ - if (len > 4 && fnamecmp(lang + len - 4, ".spl") == 0) - { - filename = TRUE; - - /* Locate a region and remove it from the file name. */ - p = vim_strchr(gettail(lang), '_'); - if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2]) - && !ASCII_ISALPHA(p[3])) - { - vim_strncpy(region_cp, p + 1, 2); - mch_memmove(p, p + 3, len - (p - lang) - 2); - len -= 3; - region = region_cp; - } - else - dont_use_region = TRUE; - - /* Check if we loaded this language before. */ - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (fullpathcmp(lang, slang->sl_fname, FALSE) == FPC_SAME) - break; - } - else - { - filename = FALSE; - if (len > 3 && lang[len - 3] == '_') - { - region = lang + len - 2; - len -= 3; - lang[len] = NUL; - } - else - dont_use_region = TRUE; - - /* Check if we loaded this language before. */ - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (STRICMP(lang, slang->sl_name) == 0) - break; - } - - if (region != NULL) - { - /* If the region differs from what was used before then don't - * use it for 'spellfile'. */ - if (use_region != NULL && STRCMP(region, use_region) != 0) - dont_use_region = TRUE; - use_region = region; - } - - /* If not found try loading the language now. */ - if (slang == NULL) - { - if (filename) - (void)spell_load_file(lang, lang, NULL, FALSE); - else - { - spell_load_lang(lang); -#ifdef FEAT_AUTOCMD - /* SpellFileMissing autocommands may do anything, including - * destroying the buffer we are using... */ - if (!buf_valid(wp->w_buffer)) - { - ret_msg = (char_u *)"E797: SpellFileMissing autocommand deleted buffer"; - goto theend; - } -#endif - } - } - - /* - * Loop over the languages, there can be several files for "lang". - */ - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (filename ? fullpathcmp(lang, slang->sl_fname, FALSE) == FPC_SAME - : STRICMP(lang, slang->sl_name) == 0) - { - region_mask = REGION_ALL; - if (!filename && region != NULL) - { - /* find region in sl_regions */ - c = find_region(slang->sl_regions, region); - if (c == REGION_ALL) - { - if (slang->sl_add) - { - if (*slang->sl_regions != NUL) - /* This addition file is for other regions. */ - region_mask = 0; - } - else - /* This is probably an error. Give a warning and - * accept the words anyway. */ - smsg((char_u *) - _("Warning: region %s not supported"), - region); - } - else - region_mask = 1 << c; - } - - if (region_mask != 0) - { - if (ga_grow(&ga, 1) == FAIL) - { - ga_clear(&ga); - ret_msg = e_outofmem; - goto theend; - } - LANGP_ENTRY(ga, ga.ga_len)->lp_slang = slang; - LANGP_ENTRY(ga, ga.ga_len)->lp_region = region_mask; - ++ga.ga_len; - use_midword(slang, wp); - if (slang->sl_nobreak) - nobreak = TRUE; - } - } - } - - /* round 0: load int_wordlist, if possible. - * round 1: load first name in 'spellfile'. - * round 2: load second name in 'spellfile. - * etc. */ - spf = curwin->w_s->b_p_spf; - for (round = 0; round == 0 || *spf != NUL; ++round) - { - if (round == 0) - { - /* Internal wordlist, if there is one. */ - if (int_wordlist == NULL) - continue; - int_wordlist_spl(spf_name); - } - else - { - /* One entry in 'spellfile'. */ - copy_option_part(&spf, spf_name, MAXPATHL - 5, ","); - STRCAT(spf_name, ".spl"); - - /* If it was already found above then skip it. */ - for (c = 0; c < ga.ga_len; ++c) - { - p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname; - if (p != NULL && fullpathcmp(spf_name, p, FALSE) == FPC_SAME) - break; - } - if (c < ga.ga_len) - continue; - } - - /* Check if it was loaded already. */ - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (fullpathcmp(spf_name, slang->sl_fname, FALSE) == FPC_SAME) - break; - if (slang == NULL) - { - /* Not loaded, try loading it now. The language name includes the - * region name, the region is ignored otherwise. for int_wordlist - * use an arbitrary name. */ - if (round == 0) - STRCPY(lang, "internal wordlist"); - else - { - vim_strncpy(lang, gettail(spf_name), MAXWLEN); - p = vim_strchr(lang, '.'); - if (p != NULL) - *p = NUL; /* truncate at ".encoding.add" */ - } - slang = spell_load_file(spf_name, lang, NULL, TRUE); - - /* If one of the languages has NOBREAK we assume the addition - * files also have this. */ - if (slang != NULL && nobreak) - slang->sl_nobreak = TRUE; - } - if (slang != NULL && ga_grow(&ga, 1) == OK) - { - region_mask = REGION_ALL; - if (use_region != NULL && !dont_use_region) - { - /* find region in sl_regions */ - c = find_region(slang->sl_regions, use_region); - if (c != REGION_ALL) - region_mask = 1 << c; - else if (*slang->sl_regions != NUL) - /* This spell file is for other regions. */ - region_mask = 0; - } - - if (region_mask != 0) - { - LANGP_ENTRY(ga, ga.ga_len)->lp_slang = slang; - LANGP_ENTRY(ga, ga.ga_len)->lp_sallang = NULL; - LANGP_ENTRY(ga, ga.ga_len)->lp_replang = NULL; - LANGP_ENTRY(ga, ga.ga_len)->lp_region = region_mask; - ++ga.ga_len; - use_midword(slang, wp); - } - } - } - - /* Everything is fine, store the new b_langp value. */ - ga_clear(&wp->w_s->b_langp); - wp->w_s->b_langp = ga; - - /* For each language figure out what language to use for sound folding and - * REP items. If the language doesn't support it itself use another one - * with the same name. E.g. for "en-math" use "en". */ - for (i = 0; i < ga.ga_len; ++i) - { - lp = LANGP_ENTRY(ga, i); - - /* sound folding */ - if (lp->lp_slang->sl_sal.ga_len > 0) - /* language does sound folding itself */ - lp->lp_sallang = lp->lp_slang; - else - /* find first similar language that does sound folding */ - for (j = 0; j < ga.ga_len; ++j) - { - lp2 = LANGP_ENTRY(ga, j); - if (lp2->lp_slang->sl_sal.ga_len > 0 - && STRNCMP(lp->lp_slang->sl_name, - lp2->lp_slang->sl_name, 2) == 0) - { - lp->lp_sallang = lp2->lp_slang; - break; - } - } - - /* REP items */ - if (lp->lp_slang->sl_rep.ga_len > 0) - /* language has REP items itself */ - lp->lp_replang = lp->lp_slang; - else - /* find first similar language that has REP items */ - for (j = 0; j < ga.ga_len; ++j) - { - lp2 = LANGP_ENTRY(ga, j); - if (lp2->lp_slang->sl_rep.ga_len > 0 - && STRNCMP(lp->lp_slang->sl_name, - lp2->lp_slang->sl_name, 2) == 0) - { - lp->lp_replang = lp2->lp_slang; - break; - } - } - } - -theend: - vim_free(spl_copy); - recursive = FALSE; - redraw_win_later(wp, NOT_VALID); - return ret_msg; -} - -/* - * Clear the midword characters for buffer "buf". - */ - static void -clear_midword(wp) - win_T *wp; -{ - vim_memset(wp->w_s->b_spell_ismw, 0, 256); -#ifdef FEAT_MBYTE - vim_free(wp->w_s->b_spell_ismw_mb); - wp->w_s->b_spell_ismw_mb = NULL; -#endif -} - -/* - * Use the "sl_midword" field of language "lp" for buffer "buf". - * They add up to any currently used midword characters. - */ - static void -use_midword(lp, wp) - slang_T *lp; - win_T *wp; -{ - char_u *p; - - if (lp->sl_midword == NULL) /* there aren't any */ - return; - - for (p = lp->sl_midword; *p != NUL; ) -#ifdef FEAT_MBYTE - if (has_mbyte) - { - int c, l, n; - char_u *bp; - - c = mb_ptr2char(p); - l = (*mb_ptr2len)(p); - if (c < 256 && l <= 2) - wp->w_s->b_spell_ismw[c] = TRUE; - else if (wp->w_s->b_spell_ismw_mb == NULL) - /* First multi-byte char in "b_spell_ismw_mb". */ - wp->w_s->b_spell_ismw_mb = vim_strnsave(p, l); - else - { - /* Append multi-byte chars to "b_spell_ismw_mb". */ - n = (int)STRLEN(wp->w_s->b_spell_ismw_mb); - bp = vim_strnsave(wp->w_s->b_spell_ismw_mb, n + l); - if (bp != NULL) - { - vim_free(wp->w_s->b_spell_ismw_mb); - wp->w_s->b_spell_ismw_mb = bp; - vim_strncpy(bp + n, p, l); - } - } - p += l; - } - else -#endif - wp->w_s->b_spell_ismw[*p++] = TRUE; -} - -/* - * Find the region "region[2]" in "rp" (points to "sl_regions"). - * Each region is simply stored as the two characters of it's name. - * Returns the index if found (first is 0), REGION_ALL if not found. - */ - static int -find_region(rp, region) - char_u *rp; - char_u *region; -{ - int i; - - for (i = 0; ; i += 2) - { - if (rp[i] == NUL) - return REGION_ALL; - if (rp[i] == region[0] && rp[i + 1] == region[1]) - break; - } - return i / 2; -} - -/* - * Return case type of word: - * w word 0 - * Word WF_ONECAP - * W WORD WF_ALLCAP - * WoRd wOrd WF_KEEPCAP - */ - static int -captype(word, end) - char_u *word; - char_u *end; /* When NULL use up to NUL byte. */ -{ - char_u *p; - int c; - int firstcap; - int allcap; - int past_second = FALSE; /* past second word char */ - - /* find first letter */ - for (p = word; !spell_iswordp_nmw(p, curwin); mb_ptr_adv(p)) - if (end == NULL ? *p == NUL : p >= end) - return 0; /* only non-word characters, illegal word */ -#ifdef FEAT_MBYTE - if (has_mbyte) - c = mb_ptr2char_adv(&p); - else -#endif - c = *p++; - firstcap = allcap = SPELL_ISUPPER(c); - - /* - * Need to check all letters to find a word with mixed upper/lower. - * But a word with an upper char only at start is a ONECAP. - */ - for ( ; end == NULL ? *p != NUL : p < end; mb_ptr_adv(p)) - if (spell_iswordp_nmw(p, curwin)) - { - c = PTR2CHAR(p); - if (!SPELL_ISUPPER(c)) - { - /* UUl -> KEEPCAP */ - if (past_second && allcap) - return WF_KEEPCAP; - allcap = FALSE; - } - else if (!allcap) - /* UlU -> KEEPCAP */ - return WF_KEEPCAP; - past_second = TRUE; - } - - if (allcap) - return WF_ALLCAP; - if (firstcap) - return WF_ONECAP; - return 0; -} - -/* - * Like captype() but for a KEEPCAP word add ONECAP if the word starts with a - * capital. So that make_case_word() can turn WOrd into Word. - * Add ALLCAP for "WOrD". - */ - static int -badword_captype(word, end) - char_u *word; - char_u *end; -{ - int flags = captype(word, end); - int c; - int l, u; - int first; - char_u *p; - - if (flags & WF_KEEPCAP) - { - /* Count the number of UPPER and lower case letters. */ - l = u = 0; - first = FALSE; - for (p = word; p < end; mb_ptr_adv(p)) - { - c = PTR2CHAR(p); - if (SPELL_ISUPPER(c)) - { - ++u; - if (p == word) - first = TRUE; - } - else - ++l; - } - - /* If there are more UPPER than lower case letters suggest an - * ALLCAP word. Otherwise, if the first letter is UPPER then - * suggest ONECAP. Exception: "ALl" most likely should be "All", - * require three upper case letters. */ - if (u > l && u > 2) - flags |= WF_ALLCAP; - else if (first) - flags |= WF_ONECAP; - - if (u >= 2 && l >= 2) /* maCARONI maCAroni */ - flags |= WF_MIXCAP; - } - return flags; -} - -/* - * Delete the internal wordlist and its .spl file. - */ - void -spell_delete_wordlist() -{ - char_u fname[MAXPATHL]; - - if (int_wordlist != NULL) - { - mch_remove(int_wordlist); - int_wordlist_spl(fname); - mch_remove(fname); - vim_free(int_wordlist); - int_wordlist = NULL; - } -} - -#if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO) -/* - * Free all languages. - */ - void -spell_free_all() -{ - slang_T *slang; - buf_T *buf; - - /* Go through all buffers and handle 'spelllang'. <VN> */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - ga_clear(&buf->b_s.b_langp); - - while (first_lang != NULL) - { - slang = first_lang; - first_lang = slang->sl_next; - slang_free(slang); - } - - spell_delete_wordlist(); - - vim_free(repl_to); - repl_to = NULL; - vim_free(repl_from); - repl_from = NULL; -} -#endif - -#if defined(FEAT_MBYTE) || defined(PROTO) -/* - * Clear all spelling tables and reload them. - * Used after 'encoding' is set and when ":mkspell" was used. - */ - void -spell_reload() -{ - win_T *wp; - - /* Initialize the table for spell_iswordp(). */ - init_spell_chartab(); - - /* Unload all allocated memory. */ - spell_free_all(); - - /* Go through all buffers and handle 'spelllang'. */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) - { - /* Only load the wordlists when 'spelllang' is set and there is a - * window for this buffer in which 'spell' is set. */ - if (*wp->w_s->b_p_spl != NUL) - { - if (wp->w_p_spell) - { - (void)did_set_spelllang(wp); -# ifdef FEAT_WINDOWS - break; -# endif - } - } - } -} -#endif - -/* - * Reload the spell file "fname" if it's loaded. - */ - static void -spell_reload_one(fname, added_word) - char_u *fname; - int added_word; /* invoked through "zg" */ -{ - slang_T *slang; - int didit = FALSE; - - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - { - if (fullpathcmp(fname, slang->sl_fname, FALSE) == FPC_SAME) - { - slang_clear(slang); - if (spell_load_file(fname, NULL, slang, FALSE) == NULL) - /* reloading failed, clear the language */ - slang_clear(slang); - redraw_all_later(SOME_VALID); - didit = TRUE; - } - } - - /* When "zg" was used and the file wasn't loaded yet, should redo - * 'spelllang' to load it now. */ - if (added_word && !didit) - did_set_spelllang(curwin); -} - - -/* - * Functions for ":mkspell". - */ - -#define MAXLINELEN 500 /* Maximum length in bytes of a line in a .aff - and .dic file. */ -/* - * Main structure to store the contents of a ".aff" file. - */ -typedef struct afffile_S -{ - char_u *af_enc; /* "SET", normalized, alloc'ed string or NULL */ - int af_flagtype; /* AFT_CHAR, AFT_LONG, AFT_NUM or AFT_CAPLONG */ - unsigned af_rare; /* RARE ID for rare word */ - unsigned af_keepcase; /* KEEPCASE ID for keep-case word */ - unsigned af_bad; /* BAD ID for banned word */ - unsigned af_needaffix; /* NEEDAFFIX ID */ - unsigned af_circumfix; /* CIRCUMFIX ID */ - unsigned af_needcomp; /* NEEDCOMPOUND ID */ - unsigned af_comproot; /* COMPOUNDROOT ID */ - unsigned af_compforbid; /* COMPOUNDFORBIDFLAG ID */ - unsigned af_comppermit; /* COMPOUNDPERMITFLAG ID */ - unsigned af_nosuggest; /* NOSUGGEST ID */ - int af_pfxpostpone; /* postpone prefixes without chop string and - without flags */ - hashtab_T af_pref; /* hashtable for prefixes, affheader_T */ - hashtab_T af_suff; /* hashtable for suffixes, affheader_T */ - hashtab_T af_comp; /* hashtable for compound flags, compitem_T */ -} afffile_T; - -#define AFT_CHAR 0 /* flags are one character */ -#define AFT_LONG 1 /* flags are two characters */ -#define AFT_CAPLONG 2 /* flags are one or two characters */ -#define AFT_NUM 3 /* flags are numbers, comma separated */ - -typedef struct affentry_S affentry_T; -/* Affix entry from ".aff" file. Used for prefixes and suffixes. */ -struct affentry_S -{ - affentry_T *ae_next; /* next affix with same name/number */ - char_u *ae_chop; /* text to chop off basic word (can be NULL) */ - char_u *ae_add; /* text to add to basic word (can be NULL) */ - char_u *ae_flags; /* flags on the affix (can be NULL) */ - char_u *ae_cond; /* condition (NULL for ".") */ - regprog_T *ae_prog; /* regexp program for ae_cond or NULL */ - char ae_compforbid; /* COMPOUNDFORBIDFLAG found */ - char ae_comppermit; /* COMPOUNDPERMITFLAG found */ -}; - -#ifdef FEAT_MBYTE -# define AH_KEY_LEN 17 /* 2 x 8 bytes + NUL */ -#else -# define AH_KEY_LEN 7 /* 6 digits + NUL */ -#endif - -/* Affix header from ".aff" file. Used for af_pref and af_suff. */ -typedef struct affheader_S -{ - char_u ah_key[AH_KEY_LEN]; /* key for hashtab == name of affix */ - unsigned ah_flag; /* affix name as number, uses "af_flagtype" */ - int ah_newID; /* prefix ID after renumbering; 0 if not used */ - int ah_combine; /* suffix may combine with prefix */ - int ah_follows; /* another affix block should be following */ - affentry_T *ah_first; /* first affix entry */ -} affheader_T; - -#define HI2AH(hi) ((affheader_T *)(hi)->hi_key) - -/* Flag used in compound items. */ -typedef struct compitem_S -{ - char_u ci_key[AH_KEY_LEN]; /* key for hashtab == name of compound */ - unsigned ci_flag; /* affix name as number, uses "af_flagtype" */ - int ci_newID; /* affix ID after renumbering. */ -} compitem_T; - -#define HI2CI(hi) ((compitem_T *)(hi)->hi_key) - -/* - * Structure that is used to store the items in the word tree. This avoids - * the need to keep track of each allocated thing, everything is freed all at - * once after ":mkspell" is done. - * Note: "sb_next" must be just before "sb_data" to make sure the alignment of - * "sb_data" is correct for systems where pointers must be aligned on - * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc). - */ -#define SBLOCKSIZE 16000 /* size of sb_data */ -typedef struct sblock_S sblock_T; -struct sblock_S -{ - int sb_used; /* nr of bytes already in use */ - sblock_T *sb_next; /* next block in list */ - char_u sb_data[1]; /* data, actually longer */ -}; - -/* - * A node in the tree. - */ -typedef struct wordnode_S wordnode_T; -struct wordnode_S -{ - union /* shared to save space */ - { - char_u hashkey[6]; /* the hash key, only used while compressing */ - int index; /* index in written nodes (valid after first - round) */ - } wn_u1; - union /* shared to save space */ - { - wordnode_T *next; /* next node with same hash key */ - wordnode_T *wnode; /* parent node that will write this node */ - } wn_u2; - wordnode_T *wn_child; /* child (next byte in word) */ - wordnode_T *wn_sibling; /* next sibling (alternate byte in word, - always sorted) */ - int wn_refs; /* Nr. of references to this node. Only - relevant for first node in a list of - siblings, in following siblings it is - always one. */ - char_u wn_byte; /* Byte for this node. NUL for word end */ - - /* Info for when "wn_byte" is NUL. - * In PREFIXTREE "wn_region" is used for the prefcondnr. - * In the soundfolded word tree "wn_flags" has the MSW of the wordnr and - * "wn_region" the LSW of the wordnr. */ - char_u wn_affixID; /* supported/required prefix ID or 0 */ - short_u wn_flags; /* WF_ flags */ - short wn_region; /* region mask */ - -#ifdef SPELL_PRINTTREE - int wn_nr; /* sequence nr for printing */ -#endif -}; - -#define WN_MASK 0xffff /* mask relevant bits of "wn_flags" */ - -#define HI2WN(hi) (wordnode_T *)((hi)->hi_key) - -/* - * Info used while reading the spell files. - */ -typedef struct spellinfo_S -{ - wordnode_T *si_foldroot; /* tree with case-folded words */ - long si_foldwcount; /* nr of words in si_foldroot */ - - wordnode_T *si_keeproot; /* tree with keep-case words */ - long si_keepwcount; /* nr of words in si_keeproot */ - - wordnode_T *si_prefroot; /* tree with postponed prefixes */ - - long si_sugtree; /* creating the soundfolding trie */ - - sblock_T *si_blocks; /* memory blocks used */ - long si_blocks_cnt; /* memory blocks allocated */ - int si_did_emsg; /* TRUE when ran out of memory */ - - long si_compress_cnt; /* words to add before lowering - compression limit */ - wordnode_T *si_first_free; /* List of nodes that have been freed during - compression, linked by "wn_child" field. */ - long si_free_count; /* number of nodes in si_first_free */ -#ifdef SPELL_PRINTTREE - int si_wordnode_nr; /* sequence nr for nodes */ -#endif - buf_T *si_spellbuf; /* buffer used to store soundfold word table */ - - int si_ascii; /* handling only ASCII words */ - int si_add; /* addition file */ - int si_clear_chartab; /* when TRUE clear char tables */ - int si_region; /* region mask */ - vimconv_T si_conv; /* for conversion to 'encoding' */ - int si_memtot; /* runtime memory used */ - int si_verbose; /* verbose messages */ - int si_msg_count; /* number of words added since last message */ - char_u *si_info; /* info text chars or NULL */ - int si_region_count; /* number of regions supported (1 when there - are no regions) */ - char_u si_region_name[17]; /* region names; used only if - * si_region_count > 1) */ - - garray_T si_rep; /* list of fromto_T entries from REP lines */ - garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */ - garray_T si_sal; /* list of fromto_T entries from SAL lines */ - char_u *si_sofofr; /* SOFOFROM text */ - char_u *si_sofoto; /* SOFOTO text */ - int si_nosugfile; /* NOSUGFILE item found */ - int si_nosplitsugs; /* NOSPLITSUGS item found */ - int si_followup; /* soundsalike: ? */ - int si_collapse; /* soundsalike: ? */ - hashtab_T si_commonwords; /* hashtable for common words */ - time_t si_sugtime; /* timestamp for .sug file */ - int si_rem_accents; /* soundsalike: remove accents */ - garray_T si_map; /* MAP info concatenated */ - char_u *si_midword; /* MIDWORD chars or NULL */ - int si_compmax; /* max nr of words for compounding */ - int si_compminlen; /* minimal length for compounding */ - int si_compsylmax; /* max nr of syllables for compounding */ - int si_compoptions; /* COMP_ flags */ - garray_T si_comppat; /* CHECKCOMPOUNDPATTERN items, each stored as - a string */ - char_u *si_compflags; /* flags used for compounding */ - char_u si_nobreak; /* NOBREAK */ - char_u *si_syllable; /* syllable string */ - garray_T si_prefcond; /* table with conditions for postponed - * prefixes, each stored as a string */ - int si_newprefID; /* current value for ah_newID */ - int si_newcompID; /* current value for compound ID */ -} spellinfo_T; - -static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); -static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount)); -static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry)); -static int spell_info_item __ARGS((char_u *s)); -static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); -static unsigned get_affitem __ARGS((int flagtype, char_u **pp)); -static void process_compflags __ARGS((spellinfo_T *spin, afffile_T *aff, char_u *compflags)); -static void check_renumber __ARGS((spellinfo_T *spin)); -static int flag_in_afflist __ARGS((int flagtype, char_u *afflist, unsigned flag)); -static void aff_check_number __ARGS((int spinval, int affval, char *name)); -static void aff_check_string __ARGS((char_u *spinval, char_u *affval, char *name)); -static int str_equal __ARGS((char_u *s1, char_u *s2)); -static void add_fromto __ARGS((spellinfo_T *spin, garray_T *gap, char_u *from, char_u *to)); -static int sal_to_bool __ARGS((char_u *s)); -static void spell_free_aff __ARGS((afffile_T *aff)); -static int spell_read_dic __ARGS((spellinfo_T *spin, char_u *fname, afffile_T *affile)); -static int get_affix_flags __ARGS((afffile_T *affile, char_u *afflist)); -static int get_pfxlist __ARGS((afffile_T *affile, char_u *afflist, char_u *store_afflist)); -static void get_compflags __ARGS((afffile_T *affile, char_u *afflist, char_u *store_afflist)); -static int store_aff_word __ARGS((spellinfo_T *spin, char_u *word, char_u *afflist, afffile_T *affile, hashtab_T *ht, hashtab_T *xht, int condit, int flags, char_u *pfxlist, int pfxlen)); -static int spell_read_wordfile __ARGS((spellinfo_T *spin, char_u *fname)); -static void *getroom __ARGS((spellinfo_T *spin, size_t len, int align)); -static char_u *getroom_save __ARGS((spellinfo_T *spin, char_u *s)); -static void free_blocks __ARGS((sblock_T *bl)); -static wordnode_T *wordtree_alloc __ARGS((spellinfo_T *spin)); -static int store_word __ARGS((spellinfo_T *spin, char_u *word, int flags, int region, char_u *pfxlist, int need_affix)); -static int tree_add_word __ARGS((spellinfo_T *spin, char_u *word, wordnode_T *tree, int flags, int region, int affixID)); -static wordnode_T *get_wordnode __ARGS((spellinfo_T *spin)); -static int deref_wordnode __ARGS((spellinfo_T *spin, wordnode_T *node)); -static void free_wordnode __ARGS((spellinfo_T *spin, wordnode_T *n)); -static void wordtree_compress __ARGS((spellinfo_T *spin, wordnode_T *root)); -static int node_compress __ARGS((spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int *tot)); -static int node_equal __ARGS((wordnode_T *n1, wordnode_T *n2)); -static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); -static void clear_node __ARGS((wordnode_T *node)); -static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree)); -static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); -static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); -static int sug_maketable __ARGS((spellinfo_T *spin)); -static int sug_filltable __ARGS((spellinfo_T *spin, wordnode_T *node, int startwordnr, garray_T *gap)); -static int offset2bytes __ARGS((int nr, char_u *buf)); -static int bytes2offset __ARGS((char_u **pp)); -static void sug_write __ARGS((spellinfo_T *spin, char_u *fname)); -static void mkspell __ARGS((int fcount, char_u **fnames, int ascii, int over_write, int added_word)); -static void spell_message __ARGS((spellinfo_T *spin, char_u *str)); -static void init_spellfile __ARGS((void)); - -/* In the postponed prefixes tree wn_flags is used to store the WFP_ flags, - * but it must be negative to indicate the prefix tree to tree_add_word(). - * Use a negative number with the lower 8 bits zero. */ -#define PFX_FLAGS -256 - -/* flags for "condit" argument of store_aff_word() */ -#define CONDIT_COMB 1 /* affix must combine */ -#define CONDIT_CFIX 2 /* affix must have CIRCUMFIX flag */ -#define CONDIT_SUF 4 /* add a suffix for matching flags */ -#define CONDIT_AFF 8 /* word already has an affix */ - -/* - * Tunable parameters for when the tree is compressed. See 'mkspellmem'. - */ -static long compress_start = 30000; /* memory / SBLOCKSIZE */ -static long compress_inc = 100; /* memory / SBLOCKSIZE */ -static long compress_added = 500000; /* word count */ - -#ifdef SPELL_PRINTTREE -/* - * For debugging the tree code: print the current tree in a (more or less) - * readable format, so that we can see what happens when adding a word and/or - * compressing the tree. - * Based on code from Olaf Seibert. - */ -#define PRINTLINESIZE 1000 -#define PRINTWIDTH 6 - -#define PRINTSOME(l, depth, fmt, a1, a2) vim_snprintf(l + depth * PRINTWIDTH, \ - PRINTLINESIZE - PRINTWIDTH * depth, fmt, a1, a2) - -static char line1[PRINTLINESIZE]; -static char line2[PRINTLINESIZE]; -static char line3[PRINTLINESIZE]; - - static void -spell_clear_flags(wordnode_T *node) -{ - wordnode_T *np; - - for (np = node; np != NULL; np = np->wn_sibling) - { - np->wn_u1.index = FALSE; - spell_clear_flags(np->wn_child); - } -} - - static void -spell_print_node(wordnode_T *node, int depth) -{ - if (node->wn_u1.index) - { - /* Done this node before, print the reference. */ - PRINTSOME(line1, depth, "(%d)", node->wn_nr, 0); - PRINTSOME(line2, depth, " ", 0, 0); - PRINTSOME(line3, depth, " ", 0, 0); - msg(line1); - msg(line2); - msg(line3); - } - else - { - node->wn_u1.index = TRUE; - - if (node->wn_byte != NUL) - { - if (node->wn_child != NULL) - PRINTSOME(line1, depth, " %c -> ", node->wn_byte, 0); - else - /* Cannot happen? */ - PRINTSOME(line1, depth, " %c ???", node->wn_byte, 0); - } - else - PRINTSOME(line1, depth, " $ ", 0, 0); - - PRINTSOME(line2, depth, "%d/%d ", node->wn_nr, node->wn_refs); - - if (node->wn_sibling != NULL) - PRINTSOME(line3, depth, " | ", 0, 0); - else - PRINTSOME(line3, depth, " ", 0, 0); - - if (node->wn_byte == NUL) - { - msg(line1); - msg(line2); - msg(line3); - } - - /* do the children */ - if (node->wn_byte != NUL && node->wn_child != NULL) - spell_print_node(node->wn_child, depth + 1); - - /* do the siblings */ - if (node->wn_sibling != NULL) - { - /* get rid of all parent details except | */ - STRCPY(line1, line3); - STRCPY(line2, line3); - spell_print_node(node->wn_sibling, depth); - } - } -} - - static void -spell_print_tree(wordnode_T *root) -{ - if (root != NULL) - { - /* Clear the "wn_u1.index" fields, used to remember what has been - * done. */ - spell_clear_flags(root); - - /* Recursively print the tree. */ - spell_print_node(root, 0); - } -} -#endif /* SPELL_PRINTTREE */ - -/* - * Read the affix file "fname". - * Returns an afffile_T, NULL for complete failure. - */ - static afffile_T * -spell_read_aff(spin, fname) - spellinfo_T *spin; - char_u *fname; -{ - FILE *fd; - afffile_T *aff; - char_u rline[MAXLINELEN]; - char_u *line; - char_u *pc = NULL; -#define MAXITEMCNT 30 - char_u *(items[MAXITEMCNT]); - int itemcnt; - char_u *p; - int lnum = 0; - affheader_T *cur_aff = NULL; - int did_postpone_prefix = FALSE; - int aff_todo = 0; - hashtab_T *tp; - char_u *low = NULL; - char_u *fol = NULL; - char_u *upp = NULL; - int do_rep; - int do_repsal; - int do_sal; - int do_mapline; - int found_map = FALSE; - hashitem_T *hi; - int l; - int compminlen = 0; /* COMPOUNDMIN value */ - int compsylmax = 0; /* COMPOUNDSYLMAX value */ - int compoptions = 0; /* COMP_ flags */ - int compmax = 0; /* COMPOUNDWORDMAX value */ - char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDRULE - concatenated */ - char_u *midword = NULL; /* MIDWORD value */ - char_u *syllable = NULL; /* SYLLABLE value */ - char_u *sofofrom = NULL; /* SOFOFROM value */ - char_u *sofoto = NULL; /* SOFOTO value */ - - /* - * Open the file. - */ - fd = mch_fopen((char *)fname, "r"); - if (fd == NULL) - { - EMSG2(_(e_notopen), fname); - return NULL; - } - - vim_snprintf((char *)IObuff, IOSIZE, _("Reading affix file %s ..."), fname); - spell_message(spin, IObuff); - - /* Only do REP lines when not done in another .aff file already. */ - do_rep = spin->si_rep.ga_len == 0; - - /* Only do REPSAL lines when not done in another .aff file already. */ - do_repsal = spin->si_repsal.ga_len == 0; - - /* Only do SAL lines when not done in another .aff file already. */ - do_sal = spin->si_sal.ga_len == 0; - - /* Only do MAP lines when not done in another .aff file already. */ - do_mapline = spin->si_map.ga_len == 0; - - /* - * Allocate and init the afffile_T structure. - */ - aff = (afffile_T *)getroom(spin, sizeof(afffile_T), TRUE); - if (aff == NULL) - { - fclose(fd); - return NULL; - } - hash_init(&aff->af_pref); - hash_init(&aff->af_suff); - hash_init(&aff->af_comp); - - /* - * Read all the lines in the file one by one. - */ - while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) - { - line_breakcheck(); - ++lnum; - - /* Skip comment lines. */ - if (*rline == '#') - continue; - - /* Convert from "SET" to 'encoding' when needed. */ - vim_free(pc); -#ifdef FEAT_MBYTE - if (spin->si_conv.vc_type != CONV_NONE) - { - pc = string_convert(&spin->si_conv, rline, NULL); - if (pc == NULL) - { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, rline); - continue; - } - line = pc; - } - else -#endif - { - pc = NULL; - line = rline; - } - - /* Split the line up in white separated items. Put a NUL after each - * item. */ - itemcnt = 0; - for (p = line; ; ) - { - while (*p != NUL && *p <= ' ') /* skip white space and CR/NL */ - ++p; - if (*p == NUL) - break; - if (itemcnt == MAXITEMCNT) /* too many items */ - break; - items[itemcnt++] = p; - /* A few items have arbitrary text argument, don't split them. */ - if (itemcnt == 2 && spell_info_item(items[0])) - while (*p >= ' ' || *p == TAB) /* skip until CR/NL */ - ++p; - else - while (*p > ' ') /* skip until white space or CR/NL */ - ++p; - if (*p == NUL) - break; - *p++ = NUL; - } - - /* Handle non-empty lines. */ - if (itemcnt > 0) - { - if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) - { -#ifdef FEAT_MBYTE - /* Setup for conversion from "ENC" to 'encoding'. */ - aff->af_enc = enc_canonize(items[1]); - if (aff->af_enc != NULL && !spin->si_ascii - && convert_setup(&spin->si_conv, aff->af_enc, - p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), - fname, aff->af_enc, p_enc); - spin->si_conv.vc_fail = TRUE; -#else - smsg((char_u *)_("Conversion in %s not supported"), fname); -#endif - } - else if (is_aff_rule(items, itemcnt, "FLAG", 2) - && aff->af_flagtype == AFT_CHAR) - { - if (STRCMP(items[1], "long") == 0) - aff->af_flagtype = AFT_LONG; - else if (STRCMP(items[1], "num") == 0) - aff->af_flagtype = AFT_NUM; - else if (STRCMP(items[1], "caplong") == 0) - aff->af_flagtype = AFT_CAPLONG; - else - smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), - fname, lnum, items[1]); - if (aff->af_rare != 0 - || aff->af_keepcase != 0 - || aff->af_bad != 0 - || aff->af_needaffix != 0 - || aff->af_circumfix != 0 - || aff->af_needcomp != 0 - || aff->af_comproot != 0 - || aff->af_nosuggest != 0 - || compflags != NULL - || aff->af_suff.ht_used > 0 - || aff->af_pref.ht_used > 0) - smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (spell_info_item(items[0])) - { - p = (char_u *)getroom(spin, - (spin->si_info == NULL ? 0 : STRLEN(spin->si_info)) - + STRLEN(items[0]) - + STRLEN(items[1]) + 3, FALSE); - if (p != NULL) - { - if (spin->si_info != NULL) - { - STRCPY(p, spin->si_info); - STRCAT(p, "\n"); - } - STRCAT(p, items[0]); - STRCAT(p, " "); - STRCAT(p, items[1]); - spin->si_info = p; - } - } - else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) - && midword == NULL) - { - midword = getroom_save(spin, items[1]); - } - else if (is_aff_rule(items, itemcnt, "TRY", 2)) - { - /* ignored, we look in the tree for what chars may appear */ - } - /* TODO: remove "RAR" later */ - else if ((is_aff_rule(items, itemcnt, "RAR", 2) - || is_aff_rule(items, itemcnt, "RARE", 2)) - && aff->af_rare == 0) - { - aff->af_rare = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - /* TODO: remove "KEP" later */ - else if ((is_aff_rule(items, itemcnt, "KEP", 2) - || is_aff_rule(items, itemcnt, "KEEPCASE", 2)) - && aff->af_keepcase == 0) - { - aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if ((is_aff_rule(items, itemcnt, "BAD", 2) - || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2)) - && aff->af_bad == 0) - { - aff->af_bad = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2) - && aff->af_needaffix == 0) - { - aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2) - && aff->af_circumfix == 0) - { - aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2) - && aff->af_nosuggest == 0) - { - aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2) - || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2)) - && aff->af_needcomp == 0) - { - aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2) - && aff->af_comproot == 0) - { - aff->af_comproot = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2) - && aff->af_compforbid == 0) - { - aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - if (aff->af_pref.ht_used > 0) - smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) - && aff->af_comppermit == 0) - { - aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - if (aff->af_pref.ht_used > 0) - smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), - fname, lnum); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) - && compflags == NULL) - { - /* Turn flag "c" into COMPOUNDRULE compatible string "c+", - * "Na" into "Na+", "1234" into "1234+". */ - p = getroom(spin, STRLEN(items[1]) + 2, FALSE); - if (p != NULL) - { - STRCPY(p, items[1]); - STRCAT(p, "+"); - compflags = p; - } - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) - { - /* We don't use the count, but do check that it's a number and - * not COMPOUNDRULE mistyped. */ - if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) - { - /* Don't use the first rule if it is a number. */ - if (compflags != NULL || *skipdigits(items[1]) != NUL) - { - /* Concatenate this string to previously defined ones, - * using a slash to separate them. */ - l = (int)STRLEN(items[1]) + 1; - if (compflags != NULL) - l += (int)STRLEN(compflags) + 1; - p = getroom(spin, l, FALSE); - if (p != NULL) - { - if (compflags != NULL) - { - STRCPY(p, compflags); - STRCAT(p, "/"); - } - STRCAT(p, items[1]); - compflags = p; - } - } - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) - && compmax == 0) - { - compmax = atoi((char *)items[1]); - if (compmax == 0) - smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) - && compminlen == 0) - { - compminlen = atoi((char *)items[1]); - if (compminlen == 0) - smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) - && compsylmax == 0) - { - compsylmax = atoi((char *)items[1]); - if (compsylmax == 0) - smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) - { - compoptions |= COMP_CHECKDUP; - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) - { - compoptions |= COMP_CHECKREP; - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1)) - { - compoptions |= COMP_CHECKCASE; - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1)) - { - compoptions |= COMP_CHECKTRIPLE; - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) - { - if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), - fname, lnum, items[1]); - } - else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) - { - garray_T *gap = &spin->si_comppat; - int i; - - /* Only add the couple if it isn't already there. */ - for (i = 0; i < gap->ga_len - 1; i += 2) - if (STRCMP(((char_u **)(gap->ga_data))[i], items[1]) == 0 - && STRCMP(((char_u **)(gap->ga_data))[i + 1], - items[2]) == 0) - break; - if (i >= gap->ga_len && ga_grow(gap, 2) == OK) - { - ((char_u **)(gap->ga_data))[gap->ga_len++] - = getroom_save(spin, items[1]); - ((char_u **)(gap->ga_data))[gap->ga_len++] - = getroom_save(spin, items[2]); - } - } - else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2) - && syllable == NULL) - { - syllable = getroom_save(spin, items[1]); - } - else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) - { - spin->si_nobreak = TRUE; - } - else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) - { - spin->si_nosplitsugs = TRUE; - } - else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1)) - { - spin->si_nosugfile = TRUE; - } - else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1)) - { - aff->af_pfxpostpone = TRUE; - } - else if ((STRCMP(items[0], "PFX") == 0 - || STRCMP(items[0], "SFX") == 0) - && aff_todo == 0 - && itemcnt >= 4) - { - int lasti = 4; - char_u key[AH_KEY_LEN]; - - if (*items[0] == 'P') - tp = &aff->af_pref; - else - tp = &aff->af_suff; - - /* Myspell allows the same affix name to be used multiple - * times. The affix files that do this have an undocumented - * "S" flag on all but the last block, thus we check for that - * and store it in ah_follows. */ - vim_strncpy(key, items[1], AH_KEY_LEN - 1); - hi = hash_find(tp, key); - if (!HASHITEM_EMPTY(hi)) - { - cur_aff = HI2AH(hi); - if (cur_aff->ah_combine != (*items[2] == 'Y')) - smsg((char_u *)_("Different combining flag in continued affix block in %s line %d: %s"), - fname, lnum, items[1]); - if (!cur_aff->ah_follows) - smsg((char_u *)_("Duplicate affix in %s line %d: %s"), - fname, lnum, items[1]); - } - else - { - /* New affix letter. */ - cur_aff = (affheader_T *)getroom(spin, - sizeof(affheader_T), TRUE); - if (cur_aff == NULL) - break; - cur_aff->ah_flag = affitem2flag(aff->af_flagtype, items[1], - fname, lnum); - if (cur_aff->ah_flag == 0 || STRLEN(items[1]) >= AH_KEY_LEN) - break; - if (cur_aff->ah_flag == aff->af_bad - || cur_aff->ah_flag == aff->af_rare - || cur_aff->ah_flag == aff->af_keepcase - || cur_aff->ah_flag == aff->af_needaffix - || cur_aff->ah_flag == aff->af_circumfix - || cur_aff->ah_flag == aff->af_nosuggest - || cur_aff->ah_flag == aff->af_needcomp - || cur_aff->ah_flag == aff->af_comproot) - smsg((char_u *)_("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), - fname, lnum, items[1]); - STRCPY(cur_aff->ah_key, items[1]); - hash_add(tp, cur_aff->ah_key); - - cur_aff->ah_combine = (*items[2] == 'Y'); - } - - /* Check for the "S" flag, which apparently means that another - * block with the same affix name is following. */ - if (itemcnt > lasti && STRCMP(items[lasti], "S") == 0) - { - ++lasti; - cur_aff->ah_follows = TRUE; - } - else - cur_aff->ah_follows = FALSE; - - /* Myspell allows extra text after the item, but that might - * mean mistakes go unnoticed. Require a comment-starter. */ - if (itemcnt > lasti && *items[lasti] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); - - if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0) - smsg((char_u *)_("Expected Y or N in %s line %d: %s"), - fname, lnum, items[2]); - - if (*items[0] == 'P' && aff->af_pfxpostpone) - { - if (cur_aff->ah_newID == 0) - { - /* Use a new number in the .spl file later, to be able - * to handle multiple .aff files. */ - check_renumber(spin); - cur_aff->ah_newID = ++spin->si_newprefID; - - /* We only really use ah_newID if the prefix is - * postponed. We know that only after handling all - * the items. */ - did_postpone_prefix = FALSE; - } - else - /* Did use the ID in a previous block. */ - did_postpone_prefix = TRUE; - } - - aff_todo = atoi((char *)items[3]); - } - else if ((STRCMP(items[0], "PFX") == 0 - || STRCMP(items[0], "SFX") == 0) - && aff_todo > 0 - && STRCMP(cur_aff->ah_key, items[1]) == 0 - && itemcnt >= 5) - { - affentry_T *aff_entry; - int upper = FALSE; - int lasti = 5; - - /* Myspell allows extra text after the item, but that might - * mean mistakes go unnoticed. Require a comment-starter. - * Hunspell uses a "-" item. */ - if (itemcnt > lasti && *items[lasti] != '#' - && (STRCMP(items[lasti], "-") != 0 - || itemcnt != lasti + 1)) - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); - - /* New item for an affix letter. */ - --aff_todo; - aff_entry = (affentry_T *)getroom(spin, - sizeof(affentry_T), TRUE); - if (aff_entry == NULL) - break; - - if (STRCMP(items[2], "0") != 0) - aff_entry->ae_chop = getroom_save(spin, items[2]); - if (STRCMP(items[3], "0") != 0) - { - aff_entry->ae_add = getroom_save(spin, items[3]); - - /* Recognize flags on the affix: abcd/XYZ */ - aff_entry->ae_flags = vim_strchr(aff_entry->ae_add, '/'); - if (aff_entry->ae_flags != NULL) - { - *aff_entry->ae_flags++ = NUL; - aff_process_flags(aff, aff_entry); - } - } - - /* Don't use an affix entry with non-ASCII characters when - * "spin->si_ascii" is TRUE. */ - if (!spin->si_ascii || !(has_non_ascii(aff_entry->ae_chop) - || has_non_ascii(aff_entry->ae_add))) - { - aff_entry->ae_next = cur_aff->ah_first; - cur_aff->ah_first = aff_entry; - - if (STRCMP(items[4], ".") != 0) - { - char_u buf[MAXLINELEN]; - - aff_entry->ae_cond = getroom_save(spin, items[4]); - if (*items[0] == 'P') - sprintf((char *)buf, "^%s", items[4]); - else - sprintf((char *)buf, "%s$", items[4]); - aff_entry->ae_prog = vim_regcomp(buf, - RE_MAGIC + RE_STRING + RE_STRICT); - if (aff_entry->ae_prog == NULL) - smsg((char_u *)_("Broken condition in %s line %d: %s"), - fname, lnum, items[4]); - } - - /* For postponed prefixes we need an entry in si_prefcond - * for the condition. Use an existing one if possible. - * Can't be done for an affix with flags, ignoring - * COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG. */ - if (*items[0] == 'P' && aff->af_pfxpostpone - && aff_entry->ae_flags == NULL) - { - /* When the chop string is one lower-case letter and - * the add string ends in the upper-case letter we set - * the "upper" flag, clear "ae_chop" and remove the - * letters from "ae_add". The condition must either - * be empty or start with the same letter. */ - if (aff_entry->ae_chop != NULL - && aff_entry->ae_add != NULL -#ifdef FEAT_MBYTE - && aff_entry->ae_chop[(*mb_ptr2len)( - aff_entry->ae_chop)] == NUL -#else - && aff_entry->ae_chop[1] == NUL -#endif - ) - { - int c, c_up; - - c = PTR2CHAR(aff_entry->ae_chop); - c_up = SPELL_TOUPPER(c); - if (c_up != c - && (aff_entry->ae_cond == NULL - || PTR2CHAR(aff_entry->ae_cond) == c)) - { - p = aff_entry->ae_add - + STRLEN(aff_entry->ae_add); - mb_ptr_back(aff_entry->ae_add, p); - if (PTR2CHAR(p) == c_up) - { - upper = TRUE; - aff_entry->ae_chop = NULL; - *p = NUL; - - /* The condition is matched with the - * actual word, thus must check for the - * upper-case letter. */ - if (aff_entry->ae_cond != NULL) - { - char_u buf[MAXLINELEN]; -#ifdef FEAT_MBYTE - if (has_mbyte) - { - onecap_copy(items[4], buf, TRUE); - aff_entry->ae_cond = getroom_save( - spin, buf); - } - else -#endif - *aff_entry->ae_cond = c_up; - if (aff_entry->ae_cond != NULL) - { - sprintf((char *)buf, "^%s", - aff_entry->ae_cond); - vim_regfree(aff_entry->ae_prog); - aff_entry->ae_prog = vim_regcomp( - buf, RE_MAGIC + RE_STRING); - } - } - } - } - } - - if (aff_entry->ae_chop == NULL - && aff_entry->ae_flags == NULL) - { - int idx; - char_u **pp; - int n; - - /* Find a previously used condition. */ - for (idx = spin->si_prefcond.ga_len - 1; idx >= 0; - --idx) - { - p = ((char_u **)spin->si_prefcond.ga_data)[idx]; - if (str_equal(p, aff_entry->ae_cond)) - break; - } - if (idx < 0 && ga_grow(&spin->si_prefcond, 1) == OK) - { - /* Not found, add a new condition. */ - idx = spin->si_prefcond.ga_len++; - pp = ((char_u **)spin->si_prefcond.ga_data) - + idx; - if (aff_entry->ae_cond == NULL) - *pp = NULL; - else - *pp = getroom_save(spin, - aff_entry->ae_cond); - } - - /* Add the prefix to the prefix tree. */ - if (aff_entry->ae_add == NULL) - p = (char_u *)""; - else - p = aff_entry->ae_add; - - /* PFX_FLAGS is a negative number, so that - * tree_add_word() knows this is the prefix tree. */ - n = PFX_FLAGS; - if (!cur_aff->ah_combine) - n |= WFP_NC; - if (upper) - n |= WFP_UP; - if (aff_entry->ae_comppermit) - n |= WFP_COMPPERMIT; - if (aff_entry->ae_compforbid) - n |= WFP_COMPFORBID; - tree_add_word(spin, p, spin->si_prefroot, n, - idx, cur_aff->ah_newID); - did_postpone_prefix = TRUE; - } - - /* Didn't actually use ah_newID, backup si_newprefID. */ - if (aff_todo == 0 && !did_postpone_prefix) - { - --spin->si_newprefID; - cur_aff->ah_newID = 0; - } - } - } - } - else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL) - { - fol = vim_strsave(items[1]); - } - else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL) - { - low = vim_strsave(items[1]); - } - else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL) - { - upp = vim_strsave(items[1]); - } - else if (is_aff_rule(items, itemcnt, "REP", 2) - || is_aff_rule(items, itemcnt, "REPSAL", 2)) - { - /* Ignore REP/REPSAL count */; - if (!isdigit(*items[1])) - smsg((char_u *)_("Expected REP(SAL) count in %s line %d"), - fname, lnum); - } - else if ((STRCMP(items[0], "REP") == 0 - || STRCMP(items[0], "REPSAL") == 0) - && itemcnt >= 3) - { - /* REP/REPSAL item */ - /* Myspell ignores extra arguments, we require it starts with - * # to detect mistakes. */ - if (itemcnt > 3 && items[3][0] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); - if (items[0][3] == 'S' ? do_repsal : do_rep) - { - /* Replace underscore with space (can't include a space - * directly). */ - for (p = items[1]; *p != NUL; mb_ptr_adv(p)) - if (*p == '_') - *p = ' '; - for (p = items[2]; *p != NUL; mb_ptr_adv(p)) - if (*p == '_') - *p = ' '; - add_fromto(spin, items[0][3] == 'S' - ? &spin->si_repsal - : &spin->si_rep, items[1], items[2]); - } - } - else if (is_aff_rule(items, itemcnt, "MAP", 2)) - { - /* MAP item or count */ - if (!found_map) - { - /* First line contains the count. */ - found_map = TRUE; - if (!isdigit(*items[1])) - smsg((char_u *)_("Expected MAP count in %s line %d"), - fname, lnum); - } - else if (do_mapline) - { - int c; - - /* Check that every character appears only once. */ - for (p = items[1]; *p != NUL; ) - { -#ifdef FEAT_MBYTE - c = mb_ptr2char_adv(&p); -#else - c = *p++; -#endif - if ((spin->si_map.ga_len > 0 - && vim_strchr(spin->si_map.ga_data, c) - != NULL) - || vim_strchr(p, c) != NULL) - smsg((char_u *)_("Duplicate character in MAP in %s line %d"), - fname, lnum); - } - - /* We simply concatenate all the MAP strings, separated by - * slashes. */ - ga_concat(&spin->si_map, items[1]); - ga_append(&spin->si_map, '/'); - } - } - /* Accept "SAL from to" and "SAL from to #comment". */ - else if (is_aff_rule(items, itemcnt, "SAL", 3)) - { - if (do_sal) - { - /* SAL item (sounds-a-like) - * Either one of the known keys or a from-to pair. */ - if (STRCMP(items[1], "followup") == 0) - spin->si_followup = sal_to_bool(items[2]); - else if (STRCMP(items[1], "collapse_result") == 0) - spin->si_collapse = sal_to_bool(items[2]); - else if (STRCMP(items[1], "remove_accents") == 0) - spin->si_rem_accents = sal_to_bool(items[2]); - else - /* when "to" is "_" it means empty */ - add_fromto(spin, &spin->si_sal, items[1], - STRCMP(items[2], "_") == 0 ? (char_u *)"" - : items[2]); - } - } - else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2) - && sofofrom == NULL) - { - sofofrom = getroom_save(spin, items[1]); - } - else if (is_aff_rule(items, itemcnt, "SOFOTO", 2) - && sofoto == NULL) - { - sofoto = getroom_save(spin, items[1]); - } - else if (STRCMP(items[0], "COMMON") == 0) - { - int i; - - for (i = 1; i < itemcnt; ++i) - { - if (HASHITEM_EMPTY(hash_find(&spin->si_commonwords, - items[i]))) - { - p = vim_strsave(items[i]); - if (p == NULL) - break; - hash_add(&spin->si_commonwords, p); - } - } - } - else - smsg((char_u *)_("Unrecognized or duplicate item in %s line %d: %s"), - fname, lnum, items[0]); - } - } - - if (fol != NULL || low != NULL || upp != NULL) - { - if (spin->si_clear_chartab) - { - /* Clear the char type tables, don't want to use any of the - * currently used spell properties. */ - init_spell_chartab(); - spin->si_clear_chartab = FALSE; - } - - /* - * Don't write a word table for an ASCII file, so that we don't check - * for conflicts with a word table that matches 'encoding'. - * Don't write one for utf-8 either, we use utf_*() and - * mb_get_class(), the list of chars in the file will be incomplete. - */ - if (!spin->si_ascii -#ifdef FEAT_MBYTE - && !enc_utf8 -#endif - ) - { - if (fol == NULL || low == NULL || upp == NULL) - smsg((char_u *)_("Missing FOL/LOW/UPP line in %s"), fname); - else - (void)set_spell_chartab(fol, low, upp); - } - - vim_free(fol); - vim_free(low); - vim_free(upp); - } - - /* Use compound specifications of the .aff file for the spell info. */ - if (compmax != 0) - { - aff_check_number(spin->si_compmax, compmax, "COMPOUNDWORDMAX"); - spin->si_compmax = compmax; - } - - if (compminlen != 0) - { - aff_check_number(spin->si_compminlen, compminlen, "COMPOUNDMIN"); - spin->si_compminlen = compminlen; - } - - if (compsylmax != 0) - { - if (syllable == NULL) - smsg((char_u *)_("COMPOUNDSYLMAX used without SYLLABLE")); - aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); - spin->si_compsylmax = compsylmax; - } - - if (compoptions != 0) - { - aff_check_number(spin->si_compoptions, compoptions, "COMPOUND options"); - spin->si_compoptions |= compoptions; - } - - if (compflags != NULL) - process_compflags(spin, aff, compflags); - - /* Check that we didn't use too many renumbered flags. */ - if (spin->si_newcompID < spin->si_newprefID) - { - if (spin->si_newcompID == 127 || spin->si_newcompID == 255) - MSG(_("Too many postponed prefixes")); - else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) - MSG(_("Too many compound flags")); - else - MSG(_("Too many postponed prefixes and/or compound flags")); - } - - if (syllable != NULL) - { - aff_check_string(spin->si_syllable, syllable, "SYLLABLE"); - spin->si_syllable = syllable; - } - - if (sofofrom != NULL || sofoto != NULL) - { - if (sofofrom == NULL || sofoto == NULL) - smsg((char_u *)_("Missing SOFO%s line in %s"), - sofofrom == NULL ? "FROM" : "TO", fname); - else if (spin->si_sal.ga_len > 0) - smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname); - else - { - aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); - aff_check_string(spin->si_sofoto, sofoto, "SOFOTO"); - spin->si_sofofr = sofofrom; - spin->si_sofoto = sofoto; - } - } - - if (midword != NULL) - { - aff_check_string(spin->si_midword, midword, "MIDWORD"); - spin->si_midword = midword; - } - - vim_free(pc); - fclose(fd); - return aff; -} - -/* - * Return TRUE when items[0] equals "rulename", there are "mincount" items or - * a comment is following after item "mincount". - */ - static int -is_aff_rule(items, itemcnt, rulename, mincount) - char_u **items; - int itemcnt; - char *rulename; - int mincount; -{ - return (STRCMP(items[0], rulename) == 0 - && (itemcnt == mincount - || (itemcnt > mincount && items[mincount][0] == '#'))); -} - -/* - * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from - * ae_flags to ae_comppermit and ae_compforbid. - */ - static void -aff_process_flags(affile, entry) - afffile_T *affile; - affentry_T *entry; -{ - char_u *p; - char_u *prevp; - unsigned flag; - - if (entry->ae_flags != NULL - && (affile->af_compforbid != 0 || affile->af_comppermit != 0)) - { - for (p = entry->ae_flags; *p != NUL; ) - { - prevp = p; - flag = get_affitem(affile->af_flagtype, &p); - if (flag == affile->af_comppermit || flag == affile->af_compforbid) - { - STRMOVE(prevp, p); - p = prevp; - if (flag == affile->af_comppermit) - entry->ae_comppermit = TRUE; - else - entry->ae_compforbid = TRUE; - } - if (affile->af_flagtype == AFT_NUM && *p == ',') - ++p; - } - if (*entry->ae_flags == NUL) - entry->ae_flags = NULL; /* nothing left */ - } -} - -/* - * Return TRUE if "s" is the name of an info item in the affix file. - */ - static int -spell_info_item(s) - char_u *s; -{ - return STRCMP(s, "NAME") == 0 - || STRCMP(s, "HOME") == 0 - || STRCMP(s, "VERSION") == 0 - || STRCMP(s, "AUTHOR") == 0 - || STRCMP(s, "EMAIL") == 0 - || STRCMP(s, "COPYRIGHT") == 0; -} - -/* - * Turn an affix flag name into a number, according to the FLAG type. - * returns zero for failure. - */ - static unsigned -affitem2flag(flagtype, item, fname, lnum) - int flagtype; - char_u *item; - char_u *fname; - int lnum; -{ - unsigned res; - char_u *p = item; - - res = get_affitem(flagtype, &p); - if (res == 0) - { - if (flagtype == AFT_NUM) - smsg((char_u *)_("Flag is not a number in %s line %d: %s"), - fname, lnum, item); - else - smsg((char_u *)_("Illegal flag in %s line %d: %s"), - fname, lnum, item); - } - if (*p != NUL) - { - smsg((char_u *)_(e_affname), fname, lnum, item); - return 0; - } - - return res; -} - -/* - * Get one affix name from "*pp" and advance the pointer. - * Returns zero for an error, still advances the pointer then. - */ - static unsigned -get_affitem(flagtype, pp) - int flagtype; - char_u **pp; -{ - int res; - - if (flagtype == AFT_NUM) - { - if (!VIM_ISDIGIT(**pp)) - { - ++*pp; /* always advance, avoid getting stuck */ - return 0; - } - res = getdigits(pp); - } - else - { -#ifdef FEAT_MBYTE - res = mb_ptr2char_adv(pp); -#else - res = *(*pp)++; -#endif - if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG - && res >= 'A' && res <= 'Z')) - { - if (**pp == NUL) - return 0; -#ifdef FEAT_MBYTE - res = mb_ptr2char_adv(pp) + (res << 16); -#else - res = *(*pp)++ + (res << 16); -#endif - } - } - return res; -} - -/* - * Process the "compflags" string used in an affix file and append it to - * spin->si_compflags. - * The processing involves changing the affix names to ID numbers, so that - * they fit in one byte. - */ - static void -process_compflags(spin, aff, compflags) - spellinfo_T *spin; - afffile_T *aff; - char_u *compflags; -{ - char_u *p; - char_u *prevp; - unsigned flag; - compitem_T *ci; - int id; - int len; - char_u *tp; - char_u key[AH_KEY_LEN]; - hashitem_T *hi; - - /* Make room for the old and the new compflags, concatenated with a / in - * between. Processing it makes it shorter, but we don't know by how - * much, thus allocate the maximum. */ - len = (int)STRLEN(compflags) + 1; - if (spin->si_compflags != NULL) - len += (int)STRLEN(spin->si_compflags) + 1; - p = getroom(spin, len, FALSE); - if (p == NULL) - return; - if (spin->si_compflags != NULL) - { - STRCPY(p, spin->si_compflags); - STRCAT(p, "/"); - } - spin->si_compflags = p; - tp = p + STRLEN(p); - - for (p = compflags; *p != NUL; ) - { - if (vim_strchr((char_u *)"/?*+[]", *p) != NULL) - /* Copy non-flag characters directly. */ - *tp++ = *p++; - else - { - /* First get the flag number, also checks validity. */ - prevp = p; - flag = get_affitem(aff->af_flagtype, &p); - if (flag != 0) - { - /* Find the flag in the hashtable. If it was used before, use - * the existing ID. Otherwise add a new entry. */ - vim_strncpy(key, prevp, p - prevp); - hi = hash_find(&aff->af_comp, key); - if (!HASHITEM_EMPTY(hi)) - id = HI2CI(hi)->ci_newID; - else - { - ci = (compitem_T *)getroom(spin, sizeof(compitem_T), TRUE); - if (ci == NULL) - break; - STRCPY(ci->ci_key, key); - ci->ci_flag = flag; - /* Avoid using a flag ID that has a special meaning in a - * regexp (also inside []). */ - do - { - check_renumber(spin); - id = spin->si_newcompID--; - } while (vim_strchr((char_u *)"/?*+[]\\-^", id) != NULL); - ci->ci_newID = id; - hash_add(&aff->af_comp, ci->ci_key); - } - *tp++ = id; - } - if (aff->af_flagtype == AFT_NUM && *p == ',') - ++p; - } - } - - *tp = NUL; -} - -/* - * Check that the new IDs for postponed affixes and compounding don't overrun - * each other. We have almost 255 available, but start at 0-127 to avoid - * using two bytes for utf-8. When the 0-127 range is used up go to 128-255. - * When that is used up an error message is given. - */ - static void -check_renumber(spin) - spellinfo_T *spin; -{ - if (spin->si_newprefID == spin->si_newcompID && spin->si_newcompID < 128) - { - spin->si_newprefID = 127; - spin->si_newcompID = 255; - } -} - -/* - * Return TRUE if flag "flag" appears in affix list "afflist". - */ - static int -flag_in_afflist(flagtype, afflist, flag) - int flagtype; - char_u *afflist; - unsigned flag; -{ - char_u *p; - unsigned n; - - switch (flagtype) - { - case AFT_CHAR: - return vim_strchr(afflist, flag) != NULL; - - case AFT_CAPLONG: - case AFT_LONG: - for (p = afflist; *p != NUL; ) - { -#ifdef FEAT_MBYTE - n = mb_ptr2char_adv(&p); -#else - n = *p++; -#endif - if ((flagtype == AFT_LONG || (n >= 'A' && n <= 'Z')) - && *p != NUL) -#ifdef FEAT_MBYTE - n = mb_ptr2char_adv(&p) + (n << 16); -#else - n = *p++ + (n << 16); -#endif - if (n == flag) - return TRUE; - } - break; - - case AFT_NUM: - for (p = afflist; *p != NUL; ) - { - n = getdigits(&p); - if (n == flag) - return TRUE; - if (*p != NUL) /* skip over comma */ - ++p; - } - break; - } - return FALSE; -} - -/* - * Give a warning when "spinval" and "affval" numbers are set and not the same. - */ - static void -aff_check_number(spinval, affval, name) - int spinval; - int affval; - char *name; -{ - if (spinval != 0 && spinval != affval) - smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); -} - -/* - * Give a warning when "spinval" and "affval" strings are set and not the same. - */ - static void -aff_check_string(spinval, affval, name) - char_u *spinval; - char_u *affval; - char *name; -{ - if (spinval != NULL && STRCMP(spinval, affval) != 0) - smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); -} - -/* - * Return TRUE if strings "s1" and "s2" are equal. Also consider both being - * NULL as equal. - */ - static int -str_equal(s1, s2) - char_u *s1; - char_u *s2; -{ - if (s1 == NULL || s2 == NULL) - return s1 == s2; - return STRCMP(s1, s2) == 0; -} - -/* - * Add a from-to item to "gap". Used for REP and SAL items. - * They are stored case-folded. - */ - static void -add_fromto(spin, gap, from, to) - spellinfo_T *spin; - garray_T *gap; - char_u *from; - char_u *to; -{ - fromto_T *ftp; - char_u word[MAXWLEN]; - - if (ga_grow(gap, 1) == OK) - { - ftp = ((fromto_T *)gap->ga_data) + gap->ga_len; - (void)spell_casefold(from, (int)STRLEN(from), word, MAXWLEN); - ftp->ft_from = getroom_save(spin, word); - (void)spell_casefold(to, (int)STRLEN(to), word, MAXWLEN); - ftp->ft_to = getroom_save(spin, word); - ++gap->ga_len; - } -} - -/* - * Convert a boolean argument in a SAL line to TRUE or FALSE; - */ - static int -sal_to_bool(s) - char_u *s; -{ - return STRCMP(s, "1") == 0 || STRCMP(s, "true") == 0; -} - -/* - * Free the structure filled by spell_read_aff(). - */ - static void -spell_free_aff(aff) - afffile_T *aff; -{ - hashtab_T *ht; - hashitem_T *hi; - int todo; - affheader_T *ah; - affentry_T *ae; - - vim_free(aff->af_enc); - - /* All this trouble to free the "ae_prog" items... */ - for (ht = &aff->af_pref; ; ht = &aff->af_suff) - { - todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - ah = HI2AH(hi); - for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next) - vim_regfree(ae->ae_prog); - } - } - if (ht == &aff->af_suff) - break; - } - - hash_clear(&aff->af_pref); - hash_clear(&aff->af_suff); - hash_clear(&aff->af_comp); -} - -/* - * Read dictionary file "fname". - * Returns OK or FAIL; - */ - static int -spell_read_dic(spin, fname, affile) - spellinfo_T *spin; - char_u *fname; - afffile_T *affile; -{ - hashtab_T ht; - char_u line[MAXLINELEN]; - char_u *p; - char_u *afflist; - char_u store_afflist[MAXWLEN]; - int pfxlen; - int need_affix; - char_u *dw; - char_u *pc; - char_u *w; - int l; - hash_T hash; - hashitem_T *hi; - FILE *fd; - int lnum = 1; - int non_ascii = 0; - int retval = OK; - char_u message[MAXLINELEN + MAXWLEN]; - int flags; - int duplicate = 0; - - /* - * Open the file. - */ - fd = mch_fopen((char *)fname, "r"); - if (fd == NULL) - { - EMSG2(_(e_notopen), fname); - return FAIL; - } - - /* The hashtable is only used to detect duplicated words. */ - hash_init(&ht); - - vim_snprintf((char *)IObuff, IOSIZE, - _("Reading dictionary file %s ..."), fname); - spell_message(spin, IObuff); - - /* start with a message for the first line */ - spin->si_msg_count = 999999; - - /* Read and ignore the first line: word count. */ - (void)vim_fgets(line, MAXLINELEN, fd); - if (!vim_isdigit(*skipwhite(line))) - EMSG2(_("E760: No word count in %s"), fname); - - /* - * Read all the lines in the file one by one. - * The words are converted to 'encoding' here, before being added to - * the hashtable. - */ - while (!vim_fgets(line, MAXLINELEN, fd) && !got_int) - { - line_breakcheck(); - ++lnum; - if (line[0] == '#' || line[0] == '/') - continue; /* comment line */ - - /* Remove CR, LF and white space from the end. White space halfway - * the word is kept to allow e.g., "et al.". */ - l = (int)STRLEN(line); - while (l > 0 && line[l - 1] <= ' ') - --l; - if (l == 0) - continue; /* empty line */ - line[l] = NUL; - -#ifdef FEAT_MBYTE - /* Convert from "SET" to 'encoding' when needed. */ - if (spin->si_conv.vc_type != CONV_NONE) - { - pc = string_convert(&spin->si_conv, line, NULL); - if (pc == NULL) - { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, line); - continue; - } - w = pc; - } - else -#endif - { - pc = NULL; - w = line; - } - - /* Truncate the word at the "/", set "afflist" to what follows. - * Replace "\/" by "/" and "\\" by "\". */ - afflist = NULL; - for (p = w; *p != NUL; mb_ptr_adv(p)) - { - if (*p == '\\' && (p[1] == '\\' || p[1] == '/')) - STRMOVE(p, p + 1); - else if (*p == '/') - { - *p = NUL; - afflist = p + 1; - break; - } - } - - /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */ - if (spin->si_ascii && has_non_ascii(w)) - { - ++non_ascii; - vim_free(pc); - continue; - } - - /* This takes time, print a message every 10000 words. */ - if (spin->si_verbose && spin->si_msg_count > 10000) - { - spin->si_msg_count = 0; - vim_snprintf((char *)message, sizeof(message), - _("line %6d, word %6d - %s"), - lnum, spin->si_foldwcount + spin->si_keepwcount, w); - msg_start(); - msg_puts_long_attr(message, 0); - msg_clr_eos(); - msg_didout = FALSE; - msg_col = 0; - out_flush(); - } - - /* Store the word in the hashtable to be able to find duplicates. */ - dw = (char_u *)getroom_save(spin, w); - if (dw == NULL) - { - retval = FAIL; - vim_free(pc); - break; - } - - hash = hash_hash(dw); - hi = hash_lookup(&ht, dw, hash); - if (!HASHITEM_EMPTY(hi)) - { - if (p_verbose > 0) - smsg((char_u *)_("Duplicate word in %s line %d: %s"), - fname, lnum, dw); - else if (duplicate == 0) - smsg((char_u *)_("First duplicate word in %s line %d: %s"), - fname, lnum, dw); - ++duplicate; - } - else - hash_add_item(&ht, hi, dw, hash); - - flags = 0; - store_afflist[0] = NUL; - pfxlen = 0; - need_affix = FALSE; - if (afflist != NULL) - { - /* Extract flags from the affix list. */ - flags |= get_affix_flags(affile, afflist); - - if (affile->af_needaffix != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_needaffix)) - need_affix = TRUE; - - if (affile->af_pfxpostpone) - /* Need to store the list of prefix IDs with the word. */ - pfxlen = get_pfxlist(affile, afflist, store_afflist); - - if (spin->si_compflags != NULL) - /* Need to store the list of compound flags with the word. - * Concatenate them to the list of prefix IDs. */ - get_compflags(affile, afflist, store_afflist + pfxlen); - } - - /* Add the word to the word tree(s). */ - if (store_word(spin, dw, flags, spin->si_region, - store_afflist, need_affix) == FAIL) - retval = FAIL; - - if (afflist != NULL) - { - /* Find all matching suffixes and add the resulting words. - * Additionally do matching prefixes that combine. */ - if (store_aff_word(spin, dw, afflist, affile, - &affile->af_suff, &affile->af_pref, - CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) - retval = FAIL; - - /* Find all matching prefixes and add the resulting words. */ - if (store_aff_word(spin, dw, afflist, affile, - &affile->af_pref, NULL, - CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) - retval = FAIL; - } - - vim_free(pc); - } - - if (duplicate > 0) - smsg((char_u *)_("%d duplicate word(s) in %s"), duplicate, fname); - if (spin->si_ascii && non_ascii > 0) - smsg((char_u *)_("Ignored %d word(s) with non-ASCII characters in %s"), - non_ascii, fname); - hash_clear(&ht); - - fclose(fd); - return retval; -} - -/* - * Check for affix flags in "afflist" that are turned into word flags. - * Return WF_ flags. - */ - static int -get_affix_flags(affile, afflist) - afffile_T *affile; - char_u *afflist; -{ - int flags = 0; - - if (affile->af_keepcase != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_keepcase)) - flags |= WF_KEEPCAP | WF_FIXCAP; - if (affile->af_rare != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_rare)) - flags |= WF_RARE; - if (affile->af_bad != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_bad)) - flags |= WF_BANNED; - if (affile->af_needcomp != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_needcomp)) - flags |= WF_NEEDCOMP; - if (affile->af_comproot != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_comproot)) - flags |= WF_COMPROOT; - if (affile->af_nosuggest != 0 && flag_in_afflist( - affile->af_flagtype, afflist, affile->af_nosuggest)) - flags |= WF_NOSUGGEST; - return flags; -} - -/* - * Get the list of prefix IDs from the affix list "afflist". - * Used for PFXPOSTPONE. - * Put the resulting flags in "store_afflist[MAXWLEN]" with a terminating NUL - * and return the number of affixes. - */ - static int -get_pfxlist(affile, afflist, store_afflist) - afffile_T *affile; - char_u *afflist; - char_u *store_afflist; -{ - char_u *p; - char_u *prevp; - int cnt = 0; - int id; - char_u key[AH_KEY_LEN]; - hashitem_T *hi; - - for (p = afflist; *p != NUL; ) - { - prevp = p; - if (get_affitem(affile->af_flagtype, &p) != 0) - { - /* A flag is a postponed prefix flag if it appears in "af_pref" - * and it's ID is not zero. */ - vim_strncpy(key, prevp, p - prevp); - hi = hash_find(&affile->af_pref, key); - if (!HASHITEM_EMPTY(hi)) - { - id = HI2AH(hi)->ah_newID; - if (id != 0) - store_afflist[cnt++] = id; - } - } - if (affile->af_flagtype == AFT_NUM && *p == ',') - ++p; - } - - store_afflist[cnt] = NUL; - return cnt; -} - -/* - * Get the list of compound IDs from the affix list "afflist" that are used - * for compound words. - * Puts the flags in "store_afflist[]". - */ - static void -get_compflags(affile, afflist, store_afflist) - afffile_T *affile; - char_u *afflist; - char_u *store_afflist; -{ - char_u *p; - char_u *prevp; - int cnt = 0; - char_u key[AH_KEY_LEN]; - hashitem_T *hi; - - for (p = afflist; *p != NUL; ) - { - prevp = p; - if (get_affitem(affile->af_flagtype, &p) != 0) - { - /* A flag is a compound flag if it appears in "af_comp". */ - vim_strncpy(key, prevp, p - prevp); - hi = hash_find(&affile->af_comp, key); - if (!HASHITEM_EMPTY(hi)) - store_afflist[cnt++] = HI2CI(hi)->ci_newID; - } - if (affile->af_flagtype == AFT_NUM && *p == ',') - ++p; - } - - store_afflist[cnt] = NUL; -} - -/* - * Apply affixes to a word and store the resulting words. - * "ht" is the hashtable with affentry_T that need to be applied, either - * prefixes or suffixes. - * "xht", when not NULL, is the prefix hashtable, to be used additionally on - * the resulting words for combining affixes. - * - * Returns FAIL when out of memory. - */ - static int -store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags, - pfxlist, pfxlen) - spellinfo_T *spin; /* spell info */ - char_u *word; /* basic word start */ - char_u *afflist; /* list of names of supported affixes */ - afffile_T *affile; - hashtab_T *ht; - hashtab_T *xht; - int condit; /* CONDIT_SUF et al. */ - int flags; /* flags for the word */ - char_u *pfxlist; /* list of prefix IDs */ - int pfxlen; /* nr of flags in "pfxlist" for prefixes, rest - * is compound flags */ -{ - int todo; - hashitem_T *hi; - affheader_T *ah; - affentry_T *ae; - regmatch_T regmatch; - char_u newword[MAXWLEN]; - int retval = OK; - int i, j; - char_u *p; - int use_flags; - char_u *use_pfxlist; - int use_pfxlen; - int need_affix; - char_u store_afflist[MAXWLEN]; - char_u pfx_pfxlist[MAXWLEN]; - size_t wordlen = STRLEN(word); - int use_condit; - - todo = (int)ht->ht_used; - for (hi = ht->ht_array; todo > 0 && retval == OK; ++hi) - { - if (!HASHITEM_EMPTY(hi)) - { - --todo; - ah = HI2AH(hi); - - /* Check that the affix combines, if required, and that the word - * supports this affix. */ - if (((condit & CONDIT_COMB) == 0 || ah->ah_combine) - && flag_in_afflist(affile->af_flagtype, afflist, - ah->ah_flag)) - { - /* Loop over all affix entries with this name. */ - for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next) - { - /* Check the condition. It's not logical to match case - * here, but it is required for compatibility with - * Myspell. - * Another requirement from Myspell is that the chop - * string is shorter than the word itself. - * For prefixes, when "PFXPOSTPONE" was used, only do - * prefixes with a chop string and/or flags. - * When a previously added affix had CIRCUMFIX this one - * must have it too, if it had not then this one must not - * have one either. */ - regmatch.regprog = ae->ae_prog; - regmatch.rm_ic = FALSE; - if ((xht != NULL || !affile->af_pfxpostpone - || ae->ae_chop != NULL - || ae->ae_flags != NULL) - && (ae->ae_chop == NULL - || STRLEN(ae->ae_chop) < wordlen) - && (ae->ae_prog == NULL - || vim_regexec(®match, word, (colnr_T)0)) - && (((condit & CONDIT_CFIX) == 0) - == ((condit & CONDIT_AFF) == 0 - || ae->ae_flags == NULL - || !flag_in_afflist(affile->af_flagtype, - ae->ae_flags, affile->af_circumfix)))) - { - /* Match. Remove the chop and add the affix. */ - if (xht == NULL) - { - /* prefix: chop/add at the start of the word */ - if (ae->ae_add == NULL) - *newword = NUL; - else - vim_strncpy(newword, ae->ae_add, MAXWLEN - 1); - p = word; - if (ae->ae_chop != NULL) - { - /* Skip chop string. */ -#ifdef FEAT_MBYTE - if (has_mbyte) - { - i = mb_charlen(ae->ae_chop); - for ( ; i > 0; --i) - mb_ptr_adv(p); - } - else -#endif - p += STRLEN(ae->ae_chop); - } - STRCAT(newword, p); - } - else - { - /* suffix: chop/add at the end of the word */ - vim_strncpy(newword, word, MAXWLEN - 1); - if (ae->ae_chop != NULL) - { - /* Remove chop string. */ - p = newword + STRLEN(newword); - i = (int)MB_CHARLEN(ae->ae_chop); - for ( ; i > 0; --i) - mb_ptr_back(newword, p); - *p = NUL; - } - if (ae->ae_add != NULL) - STRCAT(newword, ae->ae_add); - } - - use_flags = flags; - use_pfxlist = pfxlist; - use_pfxlen = pfxlen; - need_affix = FALSE; - use_condit = condit | CONDIT_COMB | CONDIT_AFF; - if (ae->ae_flags != NULL) - { - /* Extract flags from the affix list. */ - use_flags |= get_affix_flags(affile, ae->ae_flags); - - if (affile->af_needaffix != 0 && flag_in_afflist( - affile->af_flagtype, ae->ae_flags, - affile->af_needaffix)) - need_affix = TRUE; - - /* When there is a CIRCUMFIX flag the other affix - * must also have it and we don't add the word - * with one affix. */ - if (affile->af_circumfix != 0 && flag_in_afflist( - affile->af_flagtype, ae->ae_flags, - affile->af_circumfix)) - { - use_condit |= CONDIT_CFIX; - if ((condit & CONDIT_CFIX) == 0) - need_affix = TRUE; - } - - if (affile->af_pfxpostpone - || spin->si_compflags != NULL) - { - if (affile->af_pfxpostpone) - /* Get prefix IDS from the affix list. */ - use_pfxlen = get_pfxlist(affile, - ae->ae_flags, store_afflist); - else - use_pfxlen = 0; - use_pfxlist = store_afflist; - - /* Combine the prefix IDs. Avoid adding the - * same ID twice. */ - for (i = 0; i < pfxlen; ++i) - { - for (j = 0; j < use_pfxlen; ++j) - if (pfxlist[i] == use_pfxlist[j]) - break; - if (j == use_pfxlen) - use_pfxlist[use_pfxlen++] = pfxlist[i]; - } - - if (spin->si_compflags != NULL) - /* Get compound IDS from the affix list. */ - get_compflags(affile, ae->ae_flags, - use_pfxlist + use_pfxlen); - - /* Combine the list of compound flags. - * Concatenate them to the prefix IDs list. - * Avoid adding the same ID twice. */ - for (i = pfxlen; pfxlist[i] != NUL; ++i) - { - for (j = use_pfxlen; - use_pfxlist[j] != NUL; ++j) - if (pfxlist[i] == use_pfxlist[j]) - break; - if (use_pfxlist[j] == NUL) - { - use_pfxlist[j++] = pfxlist[i]; - use_pfxlist[j] = NUL; - } - } - } - } - - /* Obey a "COMPOUNDFORBIDFLAG" of the affix: don't - * use the compound flags. */ - if (use_pfxlist != NULL && ae->ae_compforbid) - { - vim_strncpy(pfx_pfxlist, use_pfxlist, use_pfxlen); - use_pfxlist = pfx_pfxlist; - } - - /* When there are postponed prefixes... */ - if (spin->si_prefroot != NULL - && spin->si_prefroot->wn_sibling != NULL) - { - /* ... add a flag to indicate an affix was used. */ - use_flags |= WF_HAS_AFF; - - /* ... don't use a prefix list if combining - * affixes is not allowed. But do use the - * compound flags after them. */ - if (!ah->ah_combine && use_pfxlist != NULL) - use_pfxlist += use_pfxlen; - } - - /* When compounding is supported and there is no - * "COMPOUNDPERMITFLAG" then forbid compounding on the - * side where the affix is applied. */ - if (spin->si_compflags != NULL && !ae->ae_comppermit) - { - if (xht != NULL) - use_flags |= WF_NOCOMPAFT; - else - use_flags |= WF_NOCOMPBEF; - } - - /* Store the modified word. */ - if (store_word(spin, newword, use_flags, - spin->si_region, use_pfxlist, - need_affix) == FAIL) - retval = FAIL; - - /* When added a prefix or a first suffix and the affix - * has flags may add a(nother) suffix. RECURSIVE! */ - if ((condit & CONDIT_SUF) && ae->ae_flags != NULL) - if (store_aff_word(spin, newword, ae->ae_flags, - affile, &affile->af_suff, xht, - use_condit & (xht == NULL - ? ~0 : ~CONDIT_SUF), - use_flags, use_pfxlist, pfxlen) == FAIL) - retval = FAIL; - - /* When added a suffix and combining is allowed also - * try adding a prefix additionally. Both for the - * word flags and for the affix flags. RECURSIVE! */ - if (xht != NULL && ah->ah_combine) - { - if (store_aff_word(spin, newword, - afflist, affile, - xht, NULL, use_condit, - use_flags, use_pfxlist, - pfxlen) == FAIL - || (ae->ae_flags != NULL - && store_aff_word(spin, newword, - ae->ae_flags, affile, - xht, NULL, use_condit, - use_flags, use_pfxlist, - pfxlen) == FAIL)) - retval = FAIL; - } - } - } - } - } - } - - return retval; -} - -/* - * Read a file with a list of words. - */ - static int -spell_read_wordfile(spin, fname) - spellinfo_T *spin; - char_u *fname; -{ - FILE *fd; - long lnum = 0; - char_u rline[MAXLINELEN]; - char_u *line; - char_u *pc = NULL; - char_u *p; - int l; - int retval = OK; - int did_word = FALSE; - int non_ascii = 0; - int flags; - int regionmask; - - /* - * Open the file. - */ - fd = mch_fopen((char *)fname, "r"); - if (fd == NULL) - { - EMSG2(_(e_notopen), fname); - return FAIL; - } - - vim_snprintf((char *)IObuff, IOSIZE, _("Reading word file %s ..."), fname); - spell_message(spin, IObuff); - - /* - * Read all the lines in the file one by one. - */ - while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) - { - line_breakcheck(); - ++lnum; - - /* Skip comment lines. */ - if (*rline == '#') - continue; - - /* Remove CR, LF and white space from the end. */ - l = (int)STRLEN(rline); - while (l > 0 && rline[l - 1] <= ' ') - --l; - if (l == 0) - continue; /* empty or blank line */ - rline[l] = NUL; - - /* Convert from "/encoding={encoding}" to 'encoding' when needed. */ - vim_free(pc); -#ifdef FEAT_MBYTE - if (spin->si_conv.vc_type != CONV_NONE) - { - pc = string_convert(&spin->si_conv, rline, NULL); - if (pc == NULL) - { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, rline); - continue; - } - line = pc; - } - else -#endif - { - pc = NULL; - line = rline; - } - - if (*line == '/') - { - ++line; - if (STRNCMP(line, "encoding=", 9) == 0) - { - if (spin->si_conv.vc_type != CONV_NONE) - smsg((char_u *)_("Duplicate /encoding= line ignored in %s line %d: %s"), - fname, lnum, line - 1); - else if (did_word) - smsg((char_u *)_("/encoding= line after word ignored in %s line %d: %s"), - fname, lnum, line - 1); - else - { -#ifdef FEAT_MBYTE - char_u *enc; - - /* Setup for conversion to 'encoding'. */ - line += 9; - enc = enc_canonize(line); - if (enc != NULL && !spin->si_ascii - && convert_setup(&spin->si_conv, enc, - p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), - fname, line, p_enc); - vim_free(enc); - spin->si_conv.vc_fail = TRUE; -#else - smsg((char_u *)_("Conversion in %s not supported"), fname); -#endif - } - continue; - } - - if (STRNCMP(line, "regions=", 8) == 0) - { - if (spin->si_region_count > 1) - smsg((char_u *)_("Duplicate /regions= line ignored in %s line %d: %s"), - fname, lnum, line); - else - { - line += 8; - if (STRLEN(line) > 16) - smsg((char_u *)_("Too many regions in %s line %d: %s"), - fname, lnum, line); - else - { - spin->si_region_count = (int)STRLEN(line) / 2; - STRCPY(spin->si_region_name, line); - - /* Adjust the mask for a word valid in all regions. */ - spin->si_region = (1 << spin->si_region_count) - 1; - } - } - continue; - } - - smsg((char_u *)_("/ line ignored in %s line %d: %s"), - fname, lnum, line - 1); - continue; - } - - flags = 0; - regionmask = spin->si_region; - - /* Check for flags and region after a slash. */ - p = vim_strchr(line, '/'); - if (p != NULL) - { - *p++ = NUL; - while (*p != NUL) - { - if (*p == '=') /* keep-case word */ - flags |= WF_KEEPCAP | WF_FIXCAP; - else if (*p == '!') /* Bad, bad, wicked word. */ - flags |= WF_BANNED; - else if (*p == '?') /* Rare word. */ - flags |= WF_RARE; - else if (VIM_ISDIGIT(*p)) /* region number(s) */ - { - if ((flags & WF_REGION) == 0) /* first one */ - regionmask = 0; - flags |= WF_REGION; - - l = *p - '0'; - if (l > spin->si_region_count) - { - smsg((char_u *)_("Invalid region nr in %s line %d: %s"), - fname, lnum, p); - break; - } - regionmask |= 1 << (l - 1); - } - else - { - smsg((char_u *)_("Unrecognized flags in %s line %d: %s"), - fname, lnum, p); - break; - } - ++p; - } - } - - /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */ - if (spin->si_ascii && has_non_ascii(line)) - { - ++non_ascii; - continue; - } - - /* Normal word: store it. */ - if (store_word(spin, line, flags, regionmask, NULL, FALSE) == FAIL) - { - retval = FAIL; - break; - } - did_word = TRUE; - } - - vim_free(pc); - fclose(fd); - - if (spin->si_ascii && non_ascii > 0) - { - vim_snprintf((char *)IObuff, IOSIZE, - _("Ignored %d words with non-ASCII characters"), non_ascii); - spell_message(spin, IObuff); - } - - return retval; -} - -/* - * Get part of an sblock_T, "len" bytes long. - * This avoids calling free() for every little struct we use (and keeping - * track of them). - * The memory is cleared to all zeros. - * Returns NULL when out of memory. - */ - static void * -getroom(spin, len, align) - spellinfo_T *spin; - size_t len; /* length needed */ - int align; /* align for pointer */ -{ - char_u *p; - sblock_T *bl = spin->si_blocks; - - if (align && bl != NULL) - /* Round size up for alignment. On some systems structures need to be - * aligned to the size of a pointer (e.g., SPARC). */ - bl->sb_used = (bl->sb_used + sizeof(char *) - 1) - & ~(sizeof(char *) - 1); - - if (bl == NULL || bl->sb_used + len > SBLOCKSIZE) - { - if (len >= SBLOCKSIZE) - bl = NULL; - else - /* Allocate a block of memory. It is not freed until much later. */ - bl = (sblock_T *)alloc_clear( - (unsigned)(sizeof(sblock_T) + SBLOCKSIZE)); - if (bl == NULL) - { - if (!spin->si_did_emsg) - { - EMSG(_("E845: Insufficient memory, word list will be incomplete")); - spin->si_did_emsg = TRUE; - } - return NULL; - } - bl->sb_next = spin->si_blocks; - spin->si_blocks = bl; - bl->sb_used = 0; - ++spin->si_blocks_cnt; - } - - p = bl->sb_data + bl->sb_used; - bl->sb_used += (int)len; - - return p; -} - -/* - * Make a copy of a string into memory allocated with getroom(). - * Returns NULL when out of memory. - */ - static char_u * -getroom_save(spin, s) - spellinfo_T *spin; - char_u *s; -{ - char_u *sc; - - sc = (char_u *)getroom(spin, STRLEN(s) + 1, FALSE); - if (sc != NULL) - STRCPY(sc, s); - return sc; -} - - -/* - * Free the list of allocated sblock_T. - */ - static void -free_blocks(bl) - sblock_T *bl; -{ - sblock_T *next; - - while (bl != NULL) - { - next = bl->sb_next; - vim_free(bl); - bl = next; - } -} - -/* - * Allocate the root of a word tree. - * Returns NULL when out of memory. - */ - static wordnode_T * -wordtree_alloc(spin) - spellinfo_T *spin; -{ - return (wordnode_T *)getroom(spin, sizeof(wordnode_T), TRUE); -} - -/* - * Store a word in the tree(s). - * Always store it in the case-folded tree. For a keep-case word this is - * useful when the word can also be used with all caps (no WF_FIXCAP flag) and - * used to find suggestions. - * For a keep-case word also store it in the keep-case tree. - * When "pfxlist" is not NULL store the word for each postponed prefix ID and - * compound flag. - */ - static int -store_word(spin, word, flags, region, pfxlist, need_affix) - spellinfo_T *spin; - char_u *word; - int flags; /* extra flags, WF_BANNED */ - int region; /* supported region(s) */ - char_u *pfxlist; /* list of prefix IDs or NULL */ - int need_affix; /* only store word with affix ID */ -{ - int len = (int)STRLEN(word); - int ct = captype(word, word + len); - char_u foldword[MAXWLEN]; - int res = OK; - char_u *p; - - (void)spell_casefold(word, len, foldword, MAXWLEN); - for (p = pfxlist; res == OK; ++p) - { - if (!need_affix || (p != NULL && *p != NUL)) - res = tree_add_word(spin, foldword, spin->si_foldroot, ct | flags, - region, p == NULL ? 0 : *p); - if (p == NULL || *p == NUL) - break; - } - ++spin->si_foldwcount; - - if (res == OK && (ct == WF_KEEPCAP || (flags & WF_KEEPCAP))) - { - for (p = pfxlist; res == OK; ++p) - { - if (!need_affix || (p != NULL && *p != NUL)) - res = tree_add_word(spin, word, spin->si_keeproot, flags, - region, p == NULL ? 0 : *p); - if (p == NULL || *p == NUL) - break; - } - ++spin->si_keepwcount; - } - return res; -} - -/* - * Add word "word" to a word tree at "root". - * When "flags" < 0 we are adding to the prefix tree where "flags" is used for - * "rare" and "region" is the condition nr. - * Returns FAIL when out of memory. - */ - static int -tree_add_word(spin, word, root, flags, region, affixID) - spellinfo_T *spin; - char_u *word; - wordnode_T *root; - int flags; - int region; - int affixID; -{ - wordnode_T *node = root; - wordnode_T *np; - wordnode_T *copyp, **copyprev; - wordnode_T **prev = NULL; - int i; - - /* Add each byte of the word to the tree, including the NUL at the end. */ - for (i = 0; ; ++i) - { - /* When there is more than one reference to this node we need to make - * a copy, so that we can modify it. Copy the whole list of siblings - * (we don't optimize for a partly shared list of siblings). */ - if (node != NULL && node->wn_refs > 1) - { - --node->wn_refs; - copyprev = prev; - for (copyp = node; copyp != NULL; copyp = copyp->wn_sibling) - { - /* Allocate a new node and copy the info. */ - np = get_wordnode(spin); - if (np == NULL) - return FAIL; - np->wn_child = copyp->wn_child; - if (np->wn_child != NULL) - ++np->wn_child->wn_refs; /* child gets extra ref */ - np->wn_byte = copyp->wn_byte; - if (np->wn_byte == NUL) - { - np->wn_flags = copyp->wn_flags; - np->wn_region = copyp->wn_region; - np->wn_affixID = copyp->wn_affixID; - } - - /* Link the new node in the list, there will be one ref. */ - np->wn_refs = 1; - if (copyprev != NULL) - *copyprev = np; - copyprev = &np->wn_sibling; - - /* Let "node" point to the head of the copied list. */ - if (copyp == node) - node = np; - } - } - - /* Look for the sibling that has the same character. They are sorted - * on byte value, thus stop searching when a sibling is found with a - * higher byte value. For zero bytes (end of word) the sorting is - * done on flags and then on affixID. */ - while (node != NULL - && (node->wn_byte < word[i] - || (node->wn_byte == NUL - && (flags < 0 - ? node->wn_affixID < (unsigned)affixID - : (node->wn_flags < (unsigned)(flags & WN_MASK) - || (node->wn_flags == (flags & WN_MASK) - && (spin->si_sugtree - ? (node->wn_region & 0xffff) < region - : node->wn_affixID - < (unsigned)affixID))))))) - { - prev = &node->wn_sibling; - node = *prev; - } - if (node == NULL - || node->wn_byte != word[i] - || (word[i] == NUL - && (flags < 0 - || spin->si_sugtree - || node->wn_flags != (flags & WN_MASK) - || node->wn_affixID != affixID))) - { - /* Allocate a new node. */ - np = get_wordnode(spin); - if (np == NULL) - return FAIL; - np->wn_byte = word[i]; - - /* If "node" is NULL this is a new child or the end of the sibling - * list: ref count is one. Otherwise use ref count of sibling and - * make ref count of sibling one (matters when inserting in front - * of the list of siblings). */ - if (node == NULL) - np->wn_refs = 1; - else - { - np->wn_refs = node->wn_refs; - node->wn_refs = 1; - } - if (prev != NULL) - *prev = np; - np->wn_sibling = node; - node = np; - } - - if (word[i] == NUL) - { - node->wn_flags = flags; - node->wn_region |= region; - node->wn_affixID = affixID; - break; - } - prev = &node->wn_child; - node = *prev; - } -#ifdef SPELL_PRINTTREE - smsg("Added \"%s\"", word); - spell_print_tree(root->wn_sibling); -#endif - - /* count nr of words added since last message */ - ++spin->si_msg_count; - - if (spin->si_compress_cnt > 1) - { - if (--spin->si_compress_cnt == 1) - /* Did enough words to lower the block count limit. */ - spin->si_blocks_cnt += compress_inc; - } - - /* - * When we have allocated lots of memory we need to compress the word tree - * to free up some room. But compression is slow, and we might actually - * need that room, thus only compress in the following situations: - * 1. When not compressed before (si_compress_cnt == 0): when using - * "compress_start" blocks. - * 2. When compressed before and used "compress_inc" blocks before - * adding "compress_added" words (si_compress_cnt > 1). - * 3. When compressed before, added "compress_added" words - * (si_compress_cnt == 1) and the number of free nodes drops below the - * maximum word length. - */ -#ifndef SPELL_PRINTTREE - if (spin->si_compress_cnt == 1 - ? spin->si_free_count < MAXWLEN - : spin->si_blocks_cnt >= compress_start) -#endif - { - /* Decrement the block counter. The effect is that we compress again - * when the freed up room has been used and another "compress_inc" - * blocks have been allocated. Unless "compress_added" words have - * been added, then the limit is put back again. */ - spin->si_blocks_cnt -= compress_inc; - spin->si_compress_cnt = compress_added; - - if (spin->si_verbose) - { - msg_start(); - msg_puts((char_u *)_(msg_compressing)); - msg_clr_eos(); - msg_didout = FALSE; - msg_col = 0; - out_flush(); - } - - /* Compress both trees. Either they both have many nodes, which makes - * compression useful, or one of them is small, which means - * compression goes fast. But when filling the soundfold word tree - * there is no keep-case tree. */ - wordtree_compress(spin, spin->si_foldroot); - if (affixID >= 0) - wordtree_compress(spin, spin->si_keeproot); - } - - return OK; -} - -/* - * Check the 'mkspellmem' option. Return FAIL if it's wrong. - * Sets "sps_flags". - */ - int -spell_check_msm() -{ - char_u *p = p_msm; - long start = 0; - long incr = 0; - long added = 0; - - if (!VIM_ISDIGIT(*p)) - return FAIL; - /* block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)*/ - start = (getdigits(&p) * 10) / (SBLOCKSIZE / 102); - if (*p != ',') - return FAIL; - ++p; - if (!VIM_ISDIGIT(*p)) - return FAIL; - incr = (getdigits(&p) * 102) / (SBLOCKSIZE / 10); - if (*p != ',') - return FAIL; - ++p; - if (!VIM_ISDIGIT(*p)) - return FAIL; - added = getdigits(&p) * 1024; - if (*p != NUL) - return FAIL; - - if (start == 0 || incr == 0 || added == 0 || incr > start) - return FAIL; - - compress_start = start; - compress_inc = incr; - compress_added = added; - return OK; -} - - -/* - * Get a wordnode_T, either from the list of previously freed nodes or - * allocate a new one. - * Returns NULL when out of memory. - */ - static wordnode_T * -get_wordnode(spin) - spellinfo_T *spin; -{ - wordnode_T *n; - - if (spin->si_first_free == NULL) - n = (wordnode_T *)getroom(spin, sizeof(wordnode_T), TRUE); - else - { - n = spin->si_first_free; - spin->si_first_free = n->wn_child; - vim_memset(n, 0, sizeof(wordnode_T)); - --spin->si_free_count; - } -#ifdef SPELL_PRINTTREE - if (n != NULL) - n->wn_nr = ++spin->si_wordnode_nr; -#endif - return n; -} - -/* - * Decrement the reference count on a node (which is the head of a list of - * siblings). If the reference count becomes zero free the node and its - * siblings. - * Returns the number of nodes actually freed. - */ - static int -deref_wordnode(spin, node) - spellinfo_T *spin; - wordnode_T *node; -{ - wordnode_T *np; - int cnt = 0; - - if (--node->wn_refs == 0) - { - for (np = node; np != NULL; np = np->wn_sibling) - { - if (np->wn_child != NULL) - cnt += deref_wordnode(spin, np->wn_child); - free_wordnode(spin, np); - ++cnt; - } - ++cnt; /* length field */ - } - return cnt; -} - -/* - * Free a wordnode_T for re-use later. - * Only the "wn_child" field becomes invalid. - */ - static void -free_wordnode(spin, n) - spellinfo_T *spin; - wordnode_T *n; -{ - n->wn_child = spin->si_first_free; - spin->si_first_free = n; - ++spin->si_free_count; -} - -/* - * Compress a tree: find tails that are identical and can be shared. - */ - static void -wordtree_compress(spin, root) - spellinfo_T *spin; - wordnode_T *root; -{ - hashtab_T ht; - int n; - int tot = 0; - int perc; - - /* Skip the root itself, it's not actually used. The first sibling is the - * start of the tree. */ - if (root->wn_sibling != NULL) - { - hash_init(&ht); - n = node_compress(spin, root->wn_sibling, &ht, &tot); - -#ifndef SPELL_PRINTTREE - if (spin->si_verbose || p_verbose > 2) -#endif - { - if (tot > 1000000) - perc = (tot - n) / (tot / 100); - else if (tot == 0) - perc = 0; - else - perc = (tot - n) * 100 / tot; - vim_snprintf((char *)IObuff, IOSIZE, - _("Compressed %d of %d nodes; %d (%d%%) remaining"), - n, tot, tot - n, perc); - spell_message(spin, IObuff); - } -#ifdef SPELL_PRINTTREE - spell_print_tree(root->wn_sibling); -#endif - hash_clear(&ht); - } -} - -/* - * Compress a node, its siblings and its children, depth first. - * Returns the number of compressed nodes. - */ - static int -node_compress(spin, node, ht, tot) - spellinfo_T *spin; - wordnode_T *node; - hashtab_T *ht; - int *tot; /* total count of nodes before compressing, - incremented while going through the tree */ -{ - wordnode_T *np; - wordnode_T *tp; - wordnode_T *child; - hash_T hash; - hashitem_T *hi; - int len = 0; - unsigned nr, n; - int compressed = 0; - - /* - * Go through the list of siblings. Compress each child and then try - * finding an identical child to replace it. - * Note that with "child" we mean not just the node that is pointed to, - * but the whole list of siblings of which the child node is the first. - */ - for (np = node; np != NULL && !got_int; np = np->wn_sibling) - { - ++len; - if ((child = np->wn_child) != NULL) - { - /* Compress the child first. This fills hashkey. */ - compressed += node_compress(spin, child, ht, tot); - - /* Try to find an identical child. */ - hash = hash_hash(child->wn_u1.hashkey); - hi = hash_lookup(ht, child->wn_u1.hashkey, hash); - if (!HASHITEM_EMPTY(hi)) - { - /* There are children we encountered before with a hash value - * identical to the current child. Now check if there is one - * that is really identical. */ - for (tp = HI2WN(hi); tp != NULL; tp = tp->wn_u2.next) - if (node_equal(child, tp)) - { - /* Found one! Now use that child in place of the - * current one. This means the current child and all - * its siblings is unlinked from the tree. */ - ++tp->wn_refs; - compressed += deref_wordnode(spin, child); - np->wn_child = tp; - break; - } - if (tp == NULL) - { - /* No other child with this hash value equals the child of - * the node, add it to the linked list after the first - * item. */ - tp = HI2WN(hi); - child->wn_u2.next = tp->wn_u2.next; - tp->wn_u2.next = child; - } - } - else - /* No other child has this hash value, add it to the - * hashtable. */ - hash_add_item(ht, hi, child->wn_u1.hashkey, hash); - } - } - *tot += len + 1; /* add one for the node that stores the length */ - - /* - * Make a hash key for the node and its siblings, so that we can quickly - * find a lookalike node. This must be done after compressing the sibling - * list, otherwise the hash key would become invalid by the compression. - */ - node->wn_u1.hashkey[0] = len; - nr = 0; - for (np = node; np != NULL; np = np->wn_sibling) - { - if (np->wn_byte == NUL) - /* end node: use wn_flags, wn_region and wn_affixID */ - n = np->wn_flags + (np->wn_region << 8) + (np->wn_affixID << 16); - else - /* byte node: use the byte value and the child pointer */ - n = (unsigned)(np->wn_byte + ((long_u)np->wn_child << 8)); - nr = nr * 101 + n; - } - - /* Avoid NUL bytes, it terminates the hash key. */ - n = nr & 0xff; - node->wn_u1.hashkey[1] = n == 0 ? 1 : n; - n = (nr >> 8) & 0xff; - node->wn_u1.hashkey[2] = n == 0 ? 1 : n; - n = (nr >> 16) & 0xff; - node->wn_u1.hashkey[3] = n == 0 ? 1 : n; - n = (nr >> 24) & 0xff; - node->wn_u1.hashkey[4] = n == 0 ? 1 : n; - node->wn_u1.hashkey[5] = NUL; - - /* Check for CTRL-C pressed now and then. */ - fast_breakcheck(); - - return compressed; -} - -/* - * Return TRUE when two nodes have identical siblings and children. - */ - static int -node_equal(n1, n2) - wordnode_T *n1; - wordnode_T *n2; -{ - wordnode_T *p1; - wordnode_T *p2; - - for (p1 = n1, p2 = n2; p1 != NULL && p2 != NULL; - p1 = p1->wn_sibling, p2 = p2->wn_sibling) - if (p1->wn_byte != p2->wn_byte - || (p1->wn_byte == NUL - ? (p1->wn_flags != p2->wn_flags - || p1->wn_region != p2->wn_region - || p1->wn_affixID != p2->wn_affixID) - : (p1->wn_child != p2->wn_child))) - break; - - return p1 == NULL && p2 == NULL; -} - -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -rep_compare __ARGS((const void *s1, const void *s2)); - -/* - * Function given to qsort() to sort the REP items on "from" string. - */ - static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -rep_compare(s1, s2) - const void *s1; - const void *s2; -{ - fromto_T *p1 = (fromto_T *)s1; - fromto_T *p2 = (fromto_T *)s2; - - return STRCMP(p1->ft_from, p2->ft_from); -} - -/* - * Write the Vim .spl file "fname". - * Return FAIL or OK; - */ - static int -write_vim_spell(spin, fname) - spellinfo_T *spin; - char_u *fname; -{ - FILE *fd; - int regionmask; - int round; - wordnode_T *tree; - int nodecount; - int i; - int l; - garray_T *gap; - fromto_T *ftp; - char_u *p; - int rr; - int retval = OK; - size_t fwv = 1; /* collect return value of fwrite() to avoid - warnings from picky compiler */ - - fd = mch_fopen((char *)fname, "w"); - if (fd == NULL) - { - EMSG2(_(e_notopen), fname); - return FAIL; - } - - /* <HEADER>: <fileID> <versionnr> */ - /* <fileID> */ - fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); - if (fwv != (size_t)1) - /* Catch first write error, don't try writing more. */ - goto theend; - - putc(VIMSPELLVERSION, fd); /* <versionnr> */ - - /* - * <SECTIONS>: <section> ... <sectionend> - */ - - /* SN_INFO: <infotext> */ - if (spin->si_info != NULL) - { - putc(SN_INFO, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - i = (int)STRLEN(spin->si_info); - put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ - fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ - } - - /* SN_REGION: <regionname> ... - * Write the region names only if there is more than one. */ - if (spin->si_region_count > 1) - { - putc(SN_REGION, fd); /* <sectionID> */ - putc(SNF_REQUIRED, fd); /* <sectionflags> */ - l = spin->si_region_count * 2; - put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ - fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); - /* <regionname> ... */ - regionmask = (1 << spin->si_region_count) - 1; - } - else - regionmask = 0; - - /* SN_CHARFLAGS: <charflagslen> <charflags> <folcharslen> <folchars> - * - * The table with character flags and the table for case folding. - * This makes sure the same characters are recognized as word characters - * when generating an when using a spell file. - * Skip this for ASCII, the table may conflict with the one used for - * 'encoding'. - * Also skip this for an .add.spl file, the main spell file must contain - * the table (avoids that it conflicts). File is shorter too. - */ - if (!spin->si_ascii && !spin->si_add) - { - char_u folchars[128 * 8]; - int flags; - - putc(SN_CHARFLAGS, fd); /* <sectionID> */ - putc(SNF_REQUIRED, fd); /* <sectionflags> */ - - /* Form the <folchars> string first, we need to know its length. */ - l = 0; - for (i = 128; i < 256; ++i) - { -#ifdef FEAT_MBYTE - if (has_mbyte) - l += mb_char2bytes(spelltab.st_fold[i], folchars + l); - else -#endif - folchars[l++] = spelltab.st_fold[i]; - } - put_bytes(fd, (long_u)(1 + 128 + 2 + l), 4); /* <sectionlen> */ - - fputc(128, fd); /* <charflagslen> */ - for (i = 128; i < 256; ++i) - { - flags = 0; - if (spelltab.st_isw[i]) - flags |= CF_WORD; - if (spelltab.st_isu[i]) - flags |= CF_UPPER; - fputc(flags, fd); /* <charflags> */ - } - - put_bytes(fd, (long_u)l, 2); /* <folcharslen> */ - fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ - } - - /* SN_MIDWORD: <midword> */ - if (spin->si_midword != NULL) - { - putc(SN_MIDWORD, fd); /* <sectionID> */ - putc(SNF_REQUIRED, fd); /* <sectionflags> */ - - i = (int)STRLEN(spin->si_midword); - put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ - fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); - /* <midword> */ - } - - /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */ - if (spin->si_prefcond.ga_len > 0) - { - putc(SN_PREFCOND, fd); /* <sectionID> */ - putc(SNF_REQUIRED, fd); /* <sectionflags> */ - - l = write_spell_prefcond(NULL, &spin->si_prefcond); - put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ - - write_spell_prefcond(fd, &spin->si_prefcond); - } - - /* SN_REP: <repcount> <rep> ... - * SN_SAL: <salflags> <salcount> <sal> ... - * SN_REPSAL: <repcount> <rep> ... */ - - /* round 1: SN_REP section - * round 2: SN_SAL section (unless SN_SOFO is used) - * round 3: SN_REPSAL section */ - for (round = 1; round <= 3; ++round) - { - if (round == 1) - gap = &spin->si_rep; - else if (round == 2) - { - /* Don't write SN_SAL when using a SN_SOFO section */ - if (spin->si_sofofr != NULL && spin->si_sofoto != NULL) - continue; - gap = &spin->si_sal; - } - else - gap = &spin->si_repsal; - - /* Don't write the section if there are no items. */ - if (gap->ga_len == 0) - continue; - - /* Sort the REP/REPSAL items. */ - if (round != 2) - qsort(gap->ga_data, (size_t)gap->ga_len, - sizeof(fromto_T), rep_compare); - - i = round == 1 ? SN_REP : (round == 2 ? SN_SAL : SN_REPSAL); - putc(i, fd); /* <sectionID> */ - - /* This is for making suggestions, section is not required. */ - putc(0, fd); /* <sectionflags> */ - - /* Compute the length of what follows. */ - l = 2; /* count <repcount> or <salcount> */ - for (i = 0; i < gap->ga_len; ++i) - { - ftp = &((fromto_T *)gap->ga_data)[i]; - l += 1 + (int)STRLEN(ftp->ft_from); /* count <*fromlen> and <*from> */ - l += 1 + (int)STRLEN(ftp->ft_to); /* count <*tolen> and <*to> */ - } - if (round == 2) - ++l; /* count <salflags> */ - put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ - - if (round == 2) - { - i = 0; - if (spin->si_followup) - i |= SAL_F0LLOWUP; - if (spin->si_collapse) - i |= SAL_COLLAPSE; - if (spin->si_rem_accents) - i |= SAL_REM_ACCENTS; - putc(i, fd); /* <salflags> */ - } - - put_bytes(fd, (long_u)gap->ga_len, 2); /* <repcount> or <salcount> */ - for (i = 0; i < gap->ga_len; ++i) - { - /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */ - /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */ - ftp = &((fromto_T *)gap->ga_data)[i]; - for (rr = 1; rr <= 2; ++rr) - { - p = rr == 1 ? ftp->ft_from : ftp->ft_to; - l = (int)STRLEN(p); - putc(l, fd); - if (l > 0) - fwv &= fwrite(p, l, (size_t)1, fd); - } - } - - } - - /* SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> - * This is for making suggestions, section is not required. */ - if (spin->si_sofofr != NULL && spin->si_sofoto != NULL) - { - putc(SN_SOFO, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - l = (int)STRLEN(spin->si_sofofr); - put_bytes(fd, (long_u)(l + STRLEN(spin->si_sofoto) + 4), 4); - /* <sectionlen> */ - - put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */ - fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ - - l = (int)STRLEN(spin->si_sofoto); - put_bytes(fd, (long_u)l, 2); /* <sofotolen> */ - fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ - } - - /* SN_WORDS: <word> ... - * This is for making suggestions, section is not required. */ - if (spin->si_commonwords.ht_used > 0) - { - putc(SN_WORDS, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - /* round 1: count the bytes - * round 2: write the bytes */ - for (round = 1; round <= 2; ++round) - { - int todo; - int len = 0; - hashitem_T *hi; - - todo = (int)spin->si_commonwords.ht_used; - for (hi = spin->si_commonwords.ht_array; todo > 0; ++hi) - if (!HASHITEM_EMPTY(hi)) - { - l = (int)STRLEN(hi->hi_key) + 1; - len += l; - if (round == 2) /* <word> */ - fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); - --todo; - } - if (round == 1) - put_bytes(fd, (long_u)len, 4); /* <sectionlen> */ - } - } - - /* SN_MAP: <mapstr> - * This is for making suggestions, section is not required. */ - if (spin->si_map.ga_len > 0) - { - putc(SN_MAP, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - l = spin->si_map.ga_len; - put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ - fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); - /* <mapstr> */ - } - - /* SN_SUGFILE: <timestamp> - * This is used to notify that a .sug file may be available and at the - * same time allows for checking that a .sug file that is found matches - * with this .spl file. That's because the word numbers must be exactly - * right. */ - if (!spin->si_nosugfile - && (spin->si_sal.ga_len > 0 - || (spin->si_sofofr != NULL && spin->si_sofoto != NULL))) - { - putc(SN_SUGFILE, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - put_bytes(fd, (long_u)8, 4); /* <sectionlen> */ - - /* Set si_sugtime and write it to the file. */ - spin->si_sugtime = time(NULL); - put_time(fd, spin->si_sugtime); /* <timestamp> */ - } - - /* SN_NOSPLITSUGS: nothing - * This is used to notify that no suggestions with word splits are to be - * made. */ - if (spin->si_nosplitsugs) - { - putc(SN_NOSPLITSUGS, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - put_bytes(fd, (long_u)0, 4); /* <sectionlen> */ - } - - /* SN_COMPOUND: compound info. - * We don't mark it required, when not supported all compound words will - * be bad words. */ - if (spin->si_compflags != NULL) - { - putc(SN_COMPOUND, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - l = (int)STRLEN(spin->si_compflags); - for (i = 0; i < spin->si_comppat.ga_len; ++i) - l += (int)STRLEN(((char_u **)(spin->si_comppat.ga_data))[i]) + 1; - put_bytes(fd, (long_u)(l + 7), 4); /* <sectionlen> */ - - putc(spin->si_compmax, fd); /* <compmax> */ - putc(spin->si_compminlen, fd); /* <compminlen> */ - putc(spin->si_compsylmax, fd); /* <compsylmax> */ - putc(0, fd); /* for Vim 7.0b compatibility */ - putc(spin->si_compoptions, fd); /* <compoptions> */ - put_bytes(fd, (long_u)spin->si_comppat.ga_len, 2); - /* <comppatcount> */ - for (i = 0; i < spin->si_comppat.ga_len; ++i) - { - p = ((char_u **)(spin->si_comppat.ga_data))[i]; - putc((int)STRLEN(p), fd); /* <comppatlen> */ - fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); - /* <comppattext> */ - } - /* <compflags> */ - fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), - (size_t)1, fd); - } - - /* SN_NOBREAK: NOBREAK flag */ - if (spin->si_nobreak) - { - putc(SN_NOBREAK, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - /* It's empty, the presence of the section flags the feature. */ - put_bytes(fd, (long_u)0, 4); /* <sectionlen> */ - } - - /* SN_SYLLABLE: syllable info. - * We don't mark it required, when not supported syllables will not be - * counted. */ - if (spin->si_syllable != NULL) - { - putc(SN_SYLLABLE, fd); /* <sectionID> */ - putc(0, fd); /* <sectionflags> */ - - l = (int)STRLEN(spin->si_syllable); - put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ - fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); - /* <syllable> */ - } - - /* end of <SECTIONS> */ - putc(SN_END, fd); /* <sectionend> */ - - - /* - * <LWORDTREE> <KWORDTREE> <PREFIXTREE> - */ - spin->si_memtot = 0; - for (round = 1; round <= 3; ++round) - { - if (round == 1) - tree = spin->si_foldroot->wn_sibling; - else if (round == 2) - tree = spin->si_keeproot->wn_sibling; - else - tree = spin->si_prefroot->wn_sibling; - - /* Clear the index and wnode fields in the tree. */ - clear_node(tree); - - /* Count the number of nodes. Needed to be able to allocate the - * memory when reading the nodes. Also fills in index for shared - * nodes. */ - nodecount = put_node(NULL, tree, 0, regionmask, round == 3); - - /* number of nodes in 4 bytes */ - put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */ - spin->si_memtot += nodecount + nodecount * sizeof(int); - - /* Write the nodes. */ - (void)put_node(fd, tree, 0, regionmask, round == 3); - } - - /* Write another byte to check for errors (file system full). */ - if (putc(0, fd) == EOF) - retval = FAIL; -theend: - if (fclose(fd) == EOF) - retval = FAIL; - - if (fwv != (size_t)1) - retval = FAIL; - if (retval == FAIL) - EMSG(_(e_write)); - - return retval; -} - -/* - * Clear the index and wnode fields of "node", it siblings and its - * children. This is needed because they are a union with other items to save - * space. - */ - static void -clear_node(node) - wordnode_T *node; -{ - wordnode_T *np; - - if (node != NULL) - for (np = node; np != NULL; np = np->wn_sibling) - { - np->wn_u1.index = 0; - np->wn_u2.wnode = NULL; - - if (np->wn_byte != NUL) - clear_node(np->wn_child); - } -} - - -/* - * Dump a word tree at node "node". - * - * This first writes the list of possible bytes (siblings). Then for each - * byte recursively write the children. - * - * NOTE: The code here must match the code in read_tree_node(), since - * assumptions are made about the indexes (so that we don't have to write them - * in the file). - * - * Returns the number of nodes used. - */ - static int -put_node(fd, node, idx, regionmask, prefixtree) - FILE *fd; /* NULL when only counting */ - wordnode_T *node; - int idx; - int regionmask; - int prefixtree; /* TRUE for PREFIXTREE */ -{ - int newindex = idx; - int siblingcount = 0; - wordnode_T *np; - int flags; - - /* If "node" is zero the tree is empty. */ - if (node == NULL) - return 0; - - /* Store the index where this node is written. */ - node->wn_u1.index = idx; - - /* Count the number of siblings. */ - for (np = node; np != NULL; np = np->wn_sibling) - ++siblingcount; - - /* Write the sibling count. */ - if (fd != NULL) - putc(siblingcount, fd); /* <siblingcount> */ - - /* Write each sibling byte and optionally extra info. */ - for (np = node; np != NULL; np = np->wn_sibling) - { - if (np->wn_byte == 0) - { - if (fd != NULL) - { - /* For a NUL byte (end of word) write the flags etc. */ - if (prefixtree) - { - /* In PREFIXTREE write the required affixID and the - * associated condition nr (stored in wn_region). The - * byte value is misused to store the "rare" and "not - * combining" flags */ - if (np->wn_flags == (short_u)PFX_FLAGS) - putc(BY_NOFLAGS, fd); /* <byte> */ - else - { - putc(BY_FLAGS, fd); /* <byte> */ - putc(np->wn_flags, fd); /* <pflags> */ - } - putc(np->wn_affixID, fd); /* <affixID> */ - put_bytes(fd, (long_u)np->wn_region, 2); /* <prefcondnr> */ - } - else - { - /* For word trees we write the flag/region items. */ - flags = np->wn_flags; - if (regionmask != 0 && np->wn_region != regionmask) - flags |= WF_REGION; - if (np->wn_affixID != 0) - flags |= WF_AFX; - if (flags == 0) - { - /* word without flags or region */ - putc(BY_NOFLAGS, fd); /* <byte> */ - } - else - { - if (np->wn_flags >= 0x100) - { - putc(BY_FLAGS2, fd); /* <byte> */ - putc(flags, fd); /* <flags> */ - putc((unsigned)flags >> 8, fd); /* <flags2> */ - } - else - { - putc(BY_FLAGS, fd); /* <byte> */ - putc(flags, fd); /* <flags> */ - } - if (flags & WF_REGION) - putc(np->wn_region, fd); /* <region> */ - if (flags & WF_AFX) - putc(np->wn_affixID, fd); /* <affixID> */ - } - } - } - } - else - { - if (np->wn_child->wn_u1.index != 0 - && np->wn_child->wn_u2.wnode != node) - { - /* The child is written elsewhere, write the reference. */ - if (fd != NULL) - { - putc(BY_INDEX, fd); /* <byte> */ - /* <nodeidx> */ - put_bytes(fd, (long_u)np->wn_child->wn_u1.index, 3); - } - } - else if (np->wn_child->wn_u2.wnode == NULL) - /* We will write the child below and give it an index. */ - np->wn_child->wn_u2.wnode = node; - - if (fd != NULL) - if (putc(np->wn_byte, fd) == EOF) /* <byte> or <xbyte> */ - { - EMSG(_(e_write)); - return 0; - } - } - } - - /* Space used in the array when reading: one for each sibling and one for - * the count. */ - newindex += siblingcount + 1; - - /* Recursively dump the children of each sibling. */ - for (np = node; np != NULL; np = np->wn_sibling) - if (np->wn_byte != 0 && np->wn_child->wn_u2.wnode == node) - newindex = put_node(fd, np->wn_child, newindex, regionmask, - prefixtree); - - return newindex; -} - - -/* - * ":mkspell [-ascii] outfile infile ..." - * ":mkspell [-ascii] addfile" - */ - void -ex_mkspell(eap) - exarg_T *eap; -{ - int fcount; - char_u **fnames; - char_u *arg = eap->arg; - int ascii = FALSE; - - if (STRNCMP(arg, "-ascii", 6) == 0) - { - ascii = TRUE; - arg = skipwhite(arg + 6); - } - - /* Expand all the remaining arguments (e.g., $VIMRUNTIME). */ - if (get_arglist_exp(arg, &fcount, &fnames, FALSE) == OK) - { - mkspell(fcount, fnames, ascii, eap->forceit, FALSE); - FreeWild(fcount, fnames); - } -} - -/* - * Create the .sug file. - * Uses the soundfold info in "spin". - * Writes the file with the name "wfname", with ".spl" changed to ".sug". - */ - static void -spell_make_sugfile(spin, wfname) - spellinfo_T *spin; - char_u *wfname; -{ - char_u *fname = NULL; - int len; - slang_T *slang; - int free_slang = FALSE; - - /* - * Read back the .spl file that was written. This fills the required - * info for soundfolding. This also uses less memory than the - * pointer-linked version of the trie. And it avoids having two versions - * of the code for the soundfolding stuff. - * It might have been done already by spell_reload_one(). - */ - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (fullpathcmp(wfname, slang->sl_fname, FALSE) == FPC_SAME) - break; - if (slang == NULL) - { - spell_message(spin, (char_u *)_("Reading back spell file...")); - slang = spell_load_file(wfname, NULL, NULL, FALSE); - if (slang == NULL) - return; - free_slang = TRUE; - } - - /* - * Clear the info in "spin" that is used. - */ - spin->si_blocks = NULL; - spin->si_blocks_cnt = 0; - spin->si_compress_cnt = 0; /* will stay at 0 all the time*/ - spin->si_free_count = 0; - spin->si_first_free = NULL; - spin->si_foldwcount = 0; - - /* - * Go through the trie of good words, soundfold each word and add it to - * the soundfold trie. - */ - spell_message(spin, (char_u *)_("Performing soundfolding...")); - if (sug_filltree(spin, slang) == FAIL) - goto theend; - - /* - * Create the table which links each soundfold word with a list of the - * good words it may come from. Creates buffer "spin->si_spellbuf". - * This also removes the wordnr from the NUL byte entries to make - * compression possible. - */ - if (sug_maketable(spin) == FAIL) - goto theend; - - smsg((char_u *)_("Number of words after soundfolding: %ld"), - (long)spin->si_spellbuf->b_ml.ml_line_count); - - /* - * Compress the soundfold trie. - */ - spell_message(spin, (char_u *)_(msg_compressing)); - wordtree_compress(spin, spin->si_foldroot); - - /* - * Write the .sug file. - * Make the file name by changing ".spl" to ".sug". - */ - fname = alloc(MAXPATHL); - if (fname == NULL) - goto theend; - vim_strncpy(fname, wfname, MAXPATHL - 1); - len = (int)STRLEN(fname); - fname[len - 2] = 'u'; - fname[len - 1] = 'g'; - sug_write(spin, fname); - -theend: - vim_free(fname); - if (free_slang) - slang_free(slang); - free_blocks(spin->si_blocks); - close_spellbuf(spin->si_spellbuf); -} - -/* - * Build the soundfold trie for language "slang". - */ - static int -sug_filltree(spin, slang) - spellinfo_T *spin; - slang_T *slang; -{ - char_u *byts; - idx_T *idxs; - int depth; - idx_T arridx[MAXWLEN]; - int curi[MAXWLEN]; - char_u tword[MAXWLEN]; - char_u tsalword[MAXWLEN]; - int c; - idx_T n; - unsigned words_done = 0; - int wordcount[MAXWLEN]; - - /* We use si_foldroot for the soundfolded trie. */ - spin->si_foldroot = wordtree_alloc(spin); - if (spin->si_foldroot == NULL) - return FAIL; - - /* let tree_add_word() know we're adding to the soundfolded tree */ - spin->si_sugtree = TRUE; - - /* - * Go through the whole case-folded tree, soundfold each word and put it - * in the trie. - */ - byts = slang->sl_fbyts; - idxs = slang->sl_fidxs; - - arridx[0] = 0; - curi[0] = 1; - wordcount[0] = 0; - - depth = 0; - while (depth >= 0 && !got_int) - { - if (curi[depth] > byts[arridx[depth]]) - { - /* Done all bytes at this node, go up one level. */ - idxs[arridx[depth]] = wordcount[depth]; - if (depth > 0) - wordcount[depth - 1] += wordcount[depth]; - - --depth; - line_breakcheck(); - } - else - { - - /* Do one more byte at this node. */ - n = arridx[depth] + curi[depth]; - ++curi[depth]; - - c = byts[n]; - if (c == 0) - { - /* Sound-fold the word. */ - tword[depth] = NUL; - spell_soundfold(slang, tword, TRUE, tsalword); - - /* We use the "flags" field for the MSB of the wordnr, - * "region" for the LSB of the wordnr. */ - if (tree_add_word(spin, tsalword, spin->si_foldroot, - words_done >> 16, words_done & 0xffff, - 0) == FAIL) - return FAIL; - - ++words_done; - ++wordcount[depth]; - - /* Reset the block count each time to avoid compression - * kicking in. */ - spin->si_blocks_cnt = 0; - - /* Skip over any other NUL bytes (same word with different - * flags). */ - while (byts[n + 1] == 0) - { - ++n; - ++curi[depth]; - } - } - else - { - /* Normal char, go one level deeper. */ - tword[depth++] = c; - arridx[depth] = idxs[n]; - curi[depth] = 1; - wordcount[depth] = 0; - } - } - } - - smsg((char_u *)_("Total number of words: %d"), words_done); - - return OK; -} - -/* - * Make the table that links each word in the soundfold trie to the words it - * can be produced from. - * This is not unlike lines in a file, thus use a memfile to be able to access - * the table efficiently. - * Returns FAIL when out of memory. - */ - static int -sug_maketable(spin) - spellinfo_T *spin; -{ - garray_T ga; - int res = OK; - - /* Allocate a buffer, open a memline for it and create the swap file - * (uses a temp file, not a .swp file). */ - spin->si_spellbuf = open_spellbuf(); - if (spin->si_spellbuf == NULL) - return FAIL; - - /* Use a buffer to store the line info, avoids allocating many small - * pieces of memory. */ - ga_init2(&ga, 1, 100); - - /* recursively go through the tree */ - if (sug_filltable(spin, spin->si_foldroot->wn_sibling, 0, &ga) == -1) - res = FAIL; - - ga_clear(&ga); - return res; -} - -/* - * Fill the table for one node and its children. - * Returns the wordnr at the start of the node. - * Returns -1 when out of memory. - */ - static int -sug_filltable(spin, node, startwordnr, gap) - spellinfo_T *spin; - wordnode_T *node; - int startwordnr; - garray_T *gap; /* place to store line of numbers */ -{ - wordnode_T *p, *np; - int wordnr = startwordnr; - int nr; - int prev_nr; - - for (p = node; p != NULL; p = p->wn_sibling) - { - if (p->wn_byte == NUL) - { - gap->ga_len = 0; - prev_nr = 0; - for (np = p; np != NULL && np->wn_byte == NUL; np = np->wn_sibling) - { - if (ga_grow(gap, 10) == FAIL) - return -1; - - nr = (np->wn_flags << 16) + (np->wn_region & 0xffff); - /* Compute the offset from the previous nr and store the - * offset in a way that it takes a minimum number of bytes. - * It's a bit like utf-8, but without the need to mark - * following bytes. */ - nr -= prev_nr; - prev_nr += nr; - gap->ga_len += offset2bytes(nr, - (char_u *)gap->ga_data + gap->ga_len); - } - - /* add the NUL byte */ - ((char_u *)gap->ga_data)[gap->ga_len++] = NUL; - - if (ml_append_buf(spin->si_spellbuf, (linenr_T)wordnr, - gap->ga_data, gap->ga_len, TRUE) == FAIL) - return -1; - ++wordnr; - - /* Remove extra NUL entries, we no longer need them. We don't - * bother freeing the nodes, the won't be reused anyway. */ - while (p->wn_sibling != NULL && p->wn_sibling->wn_byte == NUL) - p->wn_sibling = p->wn_sibling->wn_sibling; - - /* Clear the flags on the remaining NUL node, so that compression - * works a lot better. */ - p->wn_flags = 0; - p->wn_region = 0; - } - else - { - wordnr = sug_filltable(spin, p->wn_child, wordnr, gap); - if (wordnr == -1) - return -1; - } - } - return wordnr; -} - -/* - * Convert an offset into a minimal number of bytes. - * Similar to utf_char2byters, but use 8 bits in followup bytes and avoid NUL - * bytes. - */ - static int -offset2bytes(nr, buf) - int nr; - char_u *buf; -{ - int rem; - int b1, b2, b3, b4; - - /* Split the number in parts of base 255. We need to avoid NUL bytes. */ - b1 = nr % 255 + 1; - rem = nr / 255; - b2 = rem % 255 + 1; - rem = rem / 255; - b3 = rem % 255 + 1; - b4 = rem / 255 + 1; - - if (b4 > 1 || b3 > 0x1f) /* 4 bytes */ - { - buf[0] = 0xe0 + b4; - buf[1] = b3; - buf[2] = b2; - buf[3] = b1; - return 4; - } - if (b3 > 1 || b2 > 0x3f ) /* 3 bytes */ - { - buf[0] = 0xc0 + b3; - buf[1] = b2; - buf[2] = b1; - return 3; - } - if (b2 > 1 || b1 > 0x7f ) /* 2 bytes */ - { - buf[0] = 0x80 + b2; - buf[1] = b1; - return 2; - } - /* 1 byte */ - buf[0] = b1; - return 1; -} - -/* - * Opposite of offset2bytes(). - * "pp" points to the bytes and is advanced over it. - * Returns the offset. - */ - static int -bytes2offset(pp) - char_u **pp; -{ - char_u *p = *pp; - int nr; - int c; - - c = *p++; - if ((c & 0x80) == 0x00) /* 1 byte */ - { - nr = c - 1; - } - else if ((c & 0xc0) == 0x80) /* 2 bytes */ - { - nr = (c & 0x3f) - 1; - nr = nr * 255 + (*p++ - 1); - } - else if ((c & 0xe0) == 0xc0) /* 3 bytes */ - { - nr = (c & 0x1f) - 1; - nr = nr * 255 + (*p++ - 1); - nr = nr * 255 + (*p++ - 1); - } - else /* 4 bytes */ - { - nr = (c & 0x0f) - 1; - nr = nr * 255 + (*p++ - 1); - nr = nr * 255 + (*p++ - 1); - nr = nr * 255 + (*p++ - 1); - } - - *pp = p; - return nr; -} - -/* - * Write the .sug file in "fname". - */ - static void -sug_write(spin, fname) - spellinfo_T *spin; - char_u *fname; -{ - FILE *fd; - wordnode_T *tree; - int nodecount; - int wcount; - char_u *line; - linenr_T lnum; - int len; - - /* Create the file. Note that an existing file is silently overwritten! */ - fd = mch_fopen((char *)fname, "w"); - if (fd == NULL) - { - EMSG2(_(e_notopen), fname); - return; - } - - vim_snprintf((char *)IObuff, IOSIZE, - _("Writing suggestion file %s ..."), fname); - spell_message(spin, IObuff); - - /* - * <SUGHEADER>: <fileID> <versionnr> <timestamp> - */ - if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) /* <fileID> */ - { - EMSG(_(e_write)); - goto theend; - } - putc(VIMSUGVERSION, fd); /* <versionnr> */ - - /* Write si_sugtime to the file. */ - put_time(fd, spin->si_sugtime); /* <timestamp> */ - - /* - * <SUGWORDTREE> - */ - spin->si_memtot = 0; - tree = spin->si_foldroot->wn_sibling; - - /* Clear the index and wnode fields in the tree. */ - clear_node(tree); - - /* Count the number of nodes. Needed to be able to allocate the - * memory when reading the nodes. Also fills in index for shared - * nodes. */ - nodecount = put_node(NULL, tree, 0, 0, FALSE); - - /* number of nodes in 4 bytes */ - put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */ - spin->si_memtot += nodecount + nodecount * sizeof(int); - - /* Write the nodes. */ - (void)put_node(fd, tree, 0, 0, FALSE); - - /* - * <SUGTABLE>: <sugwcount> <sugline> ... - */ - wcount = spin->si_spellbuf->b_ml.ml_line_count; - put_bytes(fd, (long_u)wcount, 4); /* <sugwcount> */ + /* Everything is fine, store the new b_langp value. */ + ga_clear(&wp->w_s->b_langp); + wp->w_s->b_langp = ga; - for (lnum = 1; lnum <= (linenr_T)wcount; ++lnum) + /* For each language figure out what language to use for sound folding and + * REP items. If the language doesn't support it itself use another one + * with the same name. E.g. for "en-math" use "en". */ + for (i = 0; i < ga.ga_len; ++i) { - /* <sugline>: <sugnr> ... NUL */ - line = ml_get_buf(spin->si_spellbuf, lnum, FALSE); - len = (int)STRLEN(line) + 1; - if (fwrite(line, (size_t)len, (size_t)1, fd) == 0) - { - EMSG(_(e_write)); - goto theend; - } - spin->si_memtot += len; - } + lp = LANGP_ENTRY(ga, i); - /* Write another byte to check for errors. */ - if (putc(0, fd) == EOF) - EMSG(_(e_write)); + /* sound folding */ + if (lp->lp_slang->sl_sal.ga_len > 0) + /* language does sound folding itself */ + lp->lp_sallang = lp->lp_slang; + else + /* find first similar language that does sound folding */ + for (j = 0; j < ga.ga_len; ++j) + { + lp2 = LANGP_ENTRY(ga, j); + if (lp2->lp_slang->sl_sal.ga_len > 0 + && STRNCMP(lp->lp_slang->sl_name, + lp2->lp_slang->sl_name, 2) == 0) + { + lp->lp_sallang = lp2->lp_slang; + break; + } + } - vim_snprintf((char *)IObuff, IOSIZE, - _("Estimated runtime memory use: %d bytes"), spin->si_memtot); - spell_message(spin, IObuff); + /* REP items */ + if (lp->lp_slang->sl_rep.ga_len > 0) + /* language has REP items itself */ + lp->lp_replang = lp->lp_slang; + else + /* find first similar language that has REP items */ + for (j = 0; j < ga.ga_len; ++j) + { + lp2 = LANGP_ENTRY(ga, j); + if (lp2->lp_slang->sl_rep.ga_len > 0 + && STRNCMP(lp->lp_slang->sl_name, + lp2->lp_slang->sl_name, 2) == 0) + { + lp->lp_replang = lp2->lp_slang; + break; + } + } + } theend: - /* close the file */ - fclose(fd); + vim_free(spl_copy); + recursive = FALSE; + redraw_win_later(wp, NOT_VALID); + return ret_msg; } /* - * Open a spell buffer. This is a nameless buffer that is not in the buffer - * list and only contains text lines. Can use a swapfile to reduce memory - * use. - * Most other fields are invalid! Esp. watch out for string options being - * NULL and there is no undo info. - * Returns NULL when out of memory. + * Clear the midword characters for buffer "buf". */ - static buf_T * -open_spellbuf() + static void +clear_midword(win_T *wp) { - buf_T *buf; - - buf = (buf_T *)alloc_clear(sizeof(buf_T)); - if (buf != NULL) - { - buf->b_spell = TRUE; - buf->b_p_swf = TRUE; /* may create a swap file */ -#ifdef FEAT_CRYPT - buf->b_p_key = empty_option; + vim_memset(wp->w_s->b_spell_ismw, 0, 256); +#ifdef FEAT_MBYTE + VIM_CLEAR(wp->w_s->b_spell_ismw_mb); #endif - ml_open(buf); - ml_open_file(buf); /* create swap file now */ - } - return buf; } /* - * Close the buffer used for spell info. + * Use the "sl_midword" field of language "lp" for buffer "buf". + * They add up to any currently used midword characters. */ static void -close_spellbuf(buf) - buf_T *buf; +use_midword(slang_T *lp, win_T *wp) { - if (buf != NULL) - { - ml_close(buf, TRUE); - vim_free(buf); - } -} - + char_u *p; -/* - * Create a Vim spell file from one or more word lists. - * "fnames[0]" is the output file name. - * "fnames[fcount - 1]" is the last input file name. - * Exception: when "fnames[0]" ends in ".add" it's used as the input file name - * and ".spl" is appended to make the output file name. - */ - static void -mkspell(fcount, fnames, ascii, over_write, added_word) - int fcount; - char_u **fnames; - int ascii; /* -ascii argument given */ - int over_write; /* overwrite existing output file */ - int added_word; /* invoked through "zg" */ -{ - char_u *fname = NULL; - char_u *wfname; - char_u **innames; - int incount; - afffile_T *(afile[8]); - int i; - int len; - struct stat st; - int error = FALSE; - spellinfo_T spin; - - vim_memset(&spin, 0, sizeof(spin)); - spin.si_verbose = !added_word; - spin.si_ascii = ascii; - spin.si_followup = TRUE; - spin.si_rem_accents = TRUE; - ga_init2(&spin.si_rep, (int)sizeof(fromto_T), 20); - ga_init2(&spin.si_repsal, (int)sizeof(fromto_T), 20); - ga_init2(&spin.si_sal, (int)sizeof(fromto_T), 20); - ga_init2(&spin.si_map, (int)sizeof(char_u), 100); - ga_init2(&spin.si_comppat, (int)sizeof(char_u *), 20); - ga_init2(&spin.si_prefcond, (int)sizeof(char_u *), 50); - hash_init(&spin.si_commonwords); - spin.si_newcompID = 127; /* start compound ID at first maximum */ - - /* default: fnames[0] is output file, following are input files */ - innames = &fnames[1]; - incount = fcount - 1; - - wfname = alloc(MAXPATHL); - if (wfname == NULL) + if (lp->sl_midword == NULL) /* there aren't any */ return; - if (fcount >= 1) - { - len = (int)STRLEN(fnames[0]); - if (fcount == 1 && len > 4 && STRCMP(fnames[0] + len - 4, ".add") == 0) - { - /* For ":mkspell path/en.latin1.add" output file is - * "path/en.latin1.add.spl". */ - innames = &fnames[0]; - incount = 1; - vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]); - } - else if (fcount == 1) - { - /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */ - innames = &fnames[0]; - incount = 1; - vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, - fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); - } - else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0) - { - /* Name ends in ".spl", use as the file name. */ - vim_strncpy(wfname, fnames[0], MAXPATHL - 1); - } - else - /* Name should be language, make the file name from it. */ - vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, - fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); - - /* Check for .ascii.spl. */ - if (strstr((char *)gettail(wfname), SPL_FNAME_ASCII) != NULL) - spin.si_ascii = TRUE; - - /* Check for .add.spl. */ - if (strstr((char *)gettail(wfname), SPL_FNAME_ADD) != NULL) - spin.si_add = TRUE; - } - - if (incount <= 0) - EMSG(_(e_invarg)); /* need at least output and input names */ - else if (vim_strchr(gettail(wfname), '_') != NULL) - EMSG(_("E751: Output file name must not have region name")); - else if (incount > 8) - EMSG(_("E754: Only up to 8 regions supported")); - else - { - /* Check for overwriting before doing things that may take a lot of - * time. */ - if (!over_write && mch_stat((char *)wfname, &st) >= 0) - { - EMSG(_(e_exists)); - goto theend; - } - if (mch_isdir(wfname)) - { - EMSG2(_(e_isadir2), wfname); - goto theend; - } - - fname = alloc(MAXPATHL); - if (fname == NULL) - goto theend; - - /* - * Init the aff and dic pointers. - * Get the region names if there are more than 2 arguments. - */ - for (i = 0; i < incount; ++i) + for (p = lp->sl_midword; *p != NUL; ) +#ifdef FEAT_MBYTE + if (has_mbyte) { - afile[i] = NULL; + int c, l, n; + char_u *bp; - if (incount > 1) + c = mb_ptr2char(p); + l = (*mb_ptr2len)(p); + if (c < 256 && l <= 2) + wp->w_s->b_spell_ismw[c] = TRUE; + else if (wp->w_s->b_spell_ismw_mb == NULL) + /* First multi-byte char in "b_spell_ismw_mb". */ + wp->w_s->b_spell_ismw_mb = vim_strnsave(p, l); + else { - len = (int)STRLEN(innames[i]); - if (STRLEN(gettail(innames[i])) < 5 - || innames[i][len - 3] != '_') + /* Append multi-byte chars to "b_spell_ismw_mb". */ + n = (int)STRLEN(wp->w_s->b_spell_ismw_mb); + bp = vim_strnsave(wp->w_s->b_spell_ismw_mb, n + l); + if (bp != NULL) { - EMSG2(_("E755: Invalid region in %s"), innames[i]); - goto theend; + vim_free(wp->w_s->b_spell_ismw_mb); + wp->w_s->b_spell_ismw_mb = bp; + vim_strncpy(bp + n, p, l); } - spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]); - spin.si_region_name[i * 2 + 1] = - TOLOWER_ASC(innames[i][len - 1]); } + p += l; } - spin.si_region_count = incount; - - spin.si_foldroot = wordtree_alloc(&spin); - spin.si_keeproot = wordtree_alloc(&spin); - spin.si_prefroot = wordtree_alloc(&spin); - if (spin.si_foldroot == NULL - || spin.si_keeproot == NULL - || spin.si_prefroot == NULL) - { - free_blocks(spin.si_blocks); - goto theend; - } + else +#endif + wp->w_s->b_spell_ismw[*p++] = TRUE; +} - /* When not producing a .add.spl file clear the character table when - * we encounter one in the .aff file. This means we dump the current - * one in the .spl file if the .aff file doesn't define one. That's - * better than guessing the contents, the table will match a - * previously loaded spell file. */ - if (!spin.si_add) - spin.si_clear_chartab = TRUE; +/* + * Find the region "region[2]" in "rp" (points to "sl_regions"). + * Each region is simply stored as the two characters of it's name. + * Returns the index if found (first is 0), REGION_ALL if not found. + */ + static int +find_region(char_u *rp, char_u *region) +{ + int i; - /* - * Read all the .aff and .dic files. - * Text is converted to 'encoding'. - * Words are stored in the case-folded and keep-case trees. - */ - for (i = 0; i < incount && !error; ++i) - { - spin.si_conv.vc_type = CONV_NONE; - spin.si_region = 1 << i; + for (i = 0; ; i += 2) + { + if (rp[i] == NUL) + return REGION_ALL; + if (rp[i] == region[0] && rp[i + 1] == region[1]) + break; + } + return i / 2; +} - vim_snprintf((char *)fname, MAXPATHL, "%s.aff", innames[i]); - if (mch_stat((char *)fname, &st) >= 0) - { - /* Read the .aff file. Will init "spin->si_conv" based on the - * "SET" line. */ - afile[i] = spell_read_aff(&spin, fname); - if (afile[i] == NULL) - error = TRUE; - else - { - /* Read the .dic file and store the words in the trees. */ - vim_snprintf((char *)fname, MAXPATHL, "%s.dic", - innames[i]); - if (spell_read_dic(&spin, fname, afile[i]) == FAIL) - error = TRUE; - } - } - else - { - /* No .aff file, try reading the file as a word list. Store - * the words in the trees. */ - if (spell_read_wordfile(&spin, innames[i]) == FAIL) - error = TRUE; - } +/* + * Return case type of word: + * w word 0 + * Word WF_ONECAP + * W WORD WF_ALLCAP + * WoRd wOrd WF_KEEPCAP + */ + int +captype( + char_u *word, + char_u *end) /* When NULL use up to NUL byte. */ +{ + char_u *p; + int c; + int firstcap; + int allcap; + int past_second = FALSE; /* past second word char */ + /* find first letter */ + for (p = word; !spell_iswordp_nmw(p, curwin); MB_PTR_ADV(p)) + if (end == NULL ? *p == NUL : p >= end) + return 0; /* only non-word characters, illegal word */ #ifdef FEAT_MBYTE - /* Free any conversion stuff. */ - convert_setup(&spin.si_conv, NULL, NULL); + if (has_mbyte) + c = mb_ptr2char_adv(&p); + else #endif - } - - if (spin.si_compflags != NULL && spin.si_nobreak) - MSG(_("Warning: both compounding and NOBREAK specified")); + c = *p++; + firstcap = allcap = SPELL_ISUPPER(c); - if (!error && !got_int) + /* + * Need to check all letters to find a word with mixed upper/lower. + * But a word with an upper char only at start is a ONECAP. + */ + for ( ; end == NULL ? *p != NUL : p < end; MB_PTR_ADV(p)) + if (spell_iswordp_nmw(p, curwin)) { - /* - * Combine tails in the tree. - */ - spell_message(&spin, (char_u *)_(msg_compressing)); - wordtree_compress(&spin, spin.si_foldroot); - wordtree_compress(&spin, spin.si_keeproot); - wordtree_compress(&spin, spin.si_prefroot); + c = PTR2CHAR(p); + if (!SPELL_ISUPPER(c)) + { + /* UUl -> KEEPCAP */ + if (past_second && allcap) + return WF_KEEPCAP; + allcap = FALSE; + } + else if (!allcap) + /* UlU -> KEEPCAP */ + return WF_KEEPCAP; + past_second = TRUE; } - if (!error && !got_int) - { - /* - * Write the info in the spell file. - */ - vim_snprintf((char *)IObuff, IOSIZE, - _("Writing spell file %s ..."), wfname); - spell_message(&spin, IObuff); - - error = write_vim_spell(&spin, wfname) == FAIL; + if (allcap) + return WF_ALLCAP; + if (firstcap) + return WF_ONECAP; + return 0; +} - spell_message(&spin, (char_u *)_("Done!")); - vim_snprintf((char *)IObuff, IOSIZE, - _("Estimated runtime memory use: %d bytes"), spin.si_memtot); - spell_message(&spin, IObuff); +/* + * Like captype() but for a KEEPCAP word add ONECAP if the word starts with a + * capital. So that make_case_word() can turn WOrd into Word. + * Add ALLCAP for "WOrD". + */ + static int +badword_captype(char_u *word, char_u *end) +{ + int flags = captype(word, end); + int c; + int l, u; + int first; + char_u *p; - /* - * If the file is loaded need to reload it. - */ - if (!error) - spell_reload_one(wfname, added_word); + if (flags & WF_KEEPCAP) + { + /* Count the number of UPPER and lower case letters. */ + l = u = 0; + first = FALSE; + for (p = word; p < end; MB_PTR_ADV(p)) + { + c = PTR2CHAR(p); + if (SPELL_ISUPPER(c)) + { + ++u; + if (p == word) + first = TRUE; + } + else + ++l; } - /* Free the allocated memory. */ - ga_clear(&spin.si_rep); - ga_clear(&spin.si_repsal); - ga_clear(&spin.si_sal); - ga_clear(&spin.si_map); - ga_clear(&spin.si_comppat); - ga_clear(&spin.si_prefcond); - hash_clear_all(&spin.si_commonwords, 0); - - /* Free the .aff file structures. */ - for (i = 0; i < incount; ++i) - if (afile[i] != NULL) - spell_free_aff(afile[i]); - - /* Free all the bits and pieces at once. */ - free_blocks(spin.si_blocks); - - /* - * If there is soundfolding info and no NOSUGFILE item create the - * .sug file with the soundfolded word trie. - */ - if (spin.si_sugtime != 0 && !error && !got_int) - spell_make_sugfile(&spin, wfname); + /* If there are more UPPER than lower case letters suggest an + * ALLCAP word. Otherwise, if the first letter is UPPER then + * suggest ONECAP. Exception: "ALl" most likely should be "All", + * require three upper case letters. */ + if (u > l && u > 2) + flags |= WF_ALLCAP; + else if (first) + flags |= WF_ONECAP; + if (u >= 2 && l >= 2) /* maCARONI maCAroni */ + flags |= WF_MIXCAP; } - -theend: - vim_free(fname); - vim_free(wfname); + return flags; } /* - * Display a message for spell file processing when 'verbose' is set or using - * ":mkspell". "str" can be IObuff. + * Delete the internal wordlist and its .spl file. */ - static void -spell_message(spin, str) - spellinfo_T *spin; - char_u *str; + void +spell_delete_wordlist(void) { - if (spin->si_verbose || p_verbose > 2) + char_u fname[MAXPATHL]; + + if (int_wordlist != NULL) { - if (!spin->si_verbose) - verbose_enter(); - MSG(str); - out_flush(); - if (!spin->si_verbose) - verbose_leave(); + mch_remove(int_wordlist); + int_wordlist_spl(fname); + mch_remove(fname); + VIM_CLEAR(int_wordlist); } } +#if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO) /* - * ":[count]spellgood {word}" - * ":[count]spellwrong {word}" - * ":[count]spellundo {word}" + * Free all languages. */ void -ex_spell(eap) - exarg_T *eap; +spell_free_all(void) { - spell_add_word(eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong, - eap->forceit ? 0 : (int)eap->line2, - eap->cmdidx == CMD_spellundo); -} + slang_T *slang; + buf_T *buf; -/* - * Add "word[len]" to 'spellfile' as a good or bad word. - */ - void -spell_add_word(word, len, bad, idx, undo) - char_u *word; - int len; - int bad; - int idx; /* "zG" and "zW": zero, otherwise index in - 'spellfile' */ - int undo; /* TRUE for "zug", "zuG", "zuw" and "zuW" */ -{ - FILE *fd = NULL; - buf_T *buf = NULL; - int new_spf = FALSE; - char_u *fname; - char_u *fnamebuf = NULL; - char_u line[MAXWLEN * 2]; - long fpos, fpos_next = 0; - int i; - char_u *spf; + /* Go through all buffers and handle 'spelllang'. <VN> */ + FOR_ALL_BUFFERS(buf) + ga_clear(&buf->b_s.b_langp); - if (idx == 0) /* use internal wordlist */ + while (first_lang != NULL) { - if (int_wordlist == NULL) - { - int_wordlist = vim_tempname('s'); - if (int_wordlist == NULL) - return; - } - fname = int_wordlist; + slang = first_lang; + first_lang = slang->sl_next; + slang_free(slang); } - else - { - /* If 'spellfile' isn't set figure out a good default value. */ - if (*curwin->w_s->b_p_spf == NUL) - { - init_spellfile(); - new_spf = TRUE; - } - if (*curwin->w_s->b_p_spf == NUL) - { - EMSG2(_(e_notset), "spellfile"); - return; - } - fnamebuf = alloc(MAXPATHL); - if (fnamebuf == NULL) - return; + spell_delete_wordlist(); - for (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i) - { - copy_option_part(&spf, fnamebuf, MAXPATHL, ","); - if (i == idx) - break; - if (*spf == NUL) - { - EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx); - vim_free(fnamebuf); - return; - } - } + VIM_CLEAR(repl_to); + VIM_CLEAR(repl_from); +} +#endif - /* Check that the user isn't editing the .add file somewhere. */ - buf = buflist_findname_exp(fnamebuf); - if (buf != NULL && buf->b_ml.ml_mfp == NULL) - buf = NULL; - if (buf != NULL && bufIsChanged(buf)) - { - EMSG(_(e_bufloaded)); - vim_free(fnamebuf); - return; - } +#if defined(FEAT_MBYTE) || defined(PROTO) +/* + * Clear all spelling tables and reload them. + * Used after 'encoding' is set and when ":mkspell" was used. + */ + void +spell_reload(void) +{ + win_T *wp; - fname = fnamebuf; - } + /* Initialize the table for spell_iswordp(). */ + init_spell_chartab(); + + /* Unload all allocated memory. */ + spell_free_all(); - if (bad || undo) + /* Go through all buffers and handle 'spelllang'. */ + FOR_ALL_WINDOWS(wp) { - /* When the word appears as good word we need to remove that one, - * since its flags sort before the one with WF_BANNED. */ - fd = mch_fopen((char *)fname, "r"); - if (fd != NULL) + /* Only load the wordlists when 'spelllang' is set and there is a + * window for this buffer in which 'spell' is set. */ + if (*wp->w_s->b_p_spl != NUL) { - while (!vim_fgets(line, MAXWLEN * 2, fd)) - { - fpos = fpos_next; - fpos_next = ftell(fd); - if (STRNCMP(word, line, len) == 0 - && (line[len] == '/' || line[len] < ' ')) + if (wp->w_p_spell) { - /* Found duplicate word. Remove it by writing a '#' at - * the start of the line. Mixing reading and writing - * doesn't work for all systems, close the file first. */ - fclose(fd); - fd = mch_fopen((char *)fname, "r+"); - if (fd == NULL) - break; - if (fseek(fd, fpos, SEEK_SET) == 0) - { - fputc('#', fd); - if (undo) - { - home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' removed from %s"), - len, word, NameBuff); - } - } - fseek(fd, fpos_next, SEEK_SET); + (void)did_set_spelllang(wp); + break; } - } - if (fd != NULL) - fclose(fd); } } +} +#endif - if (!undo) - { - fd = mch_fopen((char *)fname, "a"); - if (fd == NULL && new_spf) - { - char_u *p; +/* + * Opposite of offset2bytes(). + * "pp" points to the bytes and is advanced over it. + * Returns the offset. + */ + static int +bytes2offset(char_u **pp) +{ + char_u *p = *pp; + int nr; + int c; - /* We just initialized the 'spellfile' option and can't open the - * file. We may need to create the "spell" directory first. We - * already checked the runtime directory is writable in - * init_spellfile(). */ - if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname) - { - int c = *p; + c = *p++; + if ((c & 0x80) == 0x00) /* 1 byte */ + { + nr = c - 1; + } + else if ((c & 0xc0) == 0x80) /* 2 bytes */ + { + nr = (c & 0x3f) - 1; + nr = nr * 255 + (*p++ - 1); + } + else if ((c & 0xe0) == 0xc0) /* 3 bytes */ + { + nr = (c & 0x1f) - 1; + nr = nr * 255 + (*p++ - 1); + nr = nr * 255 + (*p++ - 1); + } + else /* 4 bytes */ + { + nr = (c & 0x0f) - 1; + nr = nr * 255 + (*p++ - 1); + nr = nr * 255 + (*p++ - 1); + nr = nr * 255 + (*p++ - 1); + } - /* The directory doesn't exist. Try creating it and opening - * the file again. */ - *p = NUL; - vim_mkdir(fname, 0755); - *p = c; - fd = mch_fopen((char *)fname, "a"); - } - } + *pp = p; + return nr; +} - if (fd == NULL) - EMSG2(_(e_notopen), fname); - else - { - if (bad) - fprintf(fd, "%.*s/!\n", len, word); - else - fprintf(fd, "%.*s\n", len, word); - fclose(fd); - home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' added to %s"), len, word, NameBuff); - } - } +/* + * Open a spell buffer. This is a nameless buffer that is not in the buffer + * list and only contains text lines. Can use a swapfile to reduce memory + * use. + * Most other fields are invalid! Esp. watch out for string options being + * NULL and there is no undo info. + * Returns NULL when out of memory. + */ + buf_T * +open_spellbuf(void) +{ + buf_T *buf; - if (fd != NULL) + buf = (buf_T *)alloc_clear(sizeof(buf_T)); + if (buf != NULL) { - /* Update the .add.spl file. */ - mkspell(1, &fname, FALSE, TRUE, TRUE); - - /* If the .add file is edited somewhere, reload it. */ - if (buf != NULL) - buf_reload(buf, buf->b_orig_mode); - - redraw_all_later(SOME_VALID); + buf->b_spell = TRUE; + buf->b_p_swf = TRUE; /* may create a swap file */ +#ifdef FEAT_CRYPT + buf->b_p_key = empty_option; +#endif + ml_open(buf); + ml_open_file(buf); /* create swap file now */ } - vim_free(fnamebuf); + return buf; } /* - * Initialize 'spellfile' for the current buffer. + * Close the buffer used for spell info. */ - static void -init_spellfile() + void +close_spellbuf(buf_T *buf) { - char_u *buf; - int l; - char_u *fname; - char_u *rtp; - char_u *lend; - int aspath = FALSE; - char_u *lstart = curbuf->b_s.b_p_spl; - - if (*curwin->w_s->b_p_spl != NUL && curwin->w_s->b_langp.ga_len > 0) + if (buf != NULL) { - buf = alloc(MAXPATHL); - if (buf == NULL) - return; - - /* Find the end of the language name. Exclude the region. If there - * is a path separator remember the start of the tail. */ - for (lend = curwin->w_s->b_p_spl; *lend != NUL - && vim_strchr((char_u *)",._", *lend) == NULL; ++lend) - if (vim_ispathsep(*lend)) - { - aspath = TRUE; - lstart = lend + 1; - } - - /* Loop over all entries in 'runtimepath'. Use the first one where we - * are allowed to write. */ - rtp = p_rtp; - while (*rtp != NUL) - { - if (aspath) - /* Use directory of an entry with path, e.g., for - * "/dir/lg.utf-8.spl" use "/dir". */ - vim_strncpy(buf, curbuf->b_s.b_p_spl, - lstart - curbuf->b_s.b_p_spl - 1); - else - /* Copy the path from 'runtimepath' to buf[]. */ - copy_option_part(&rtp, buf, MAXPATHL, ","); - if (filewritable(buf) == 2) - { - /* Use the first language name from 'spelllang' and the - * encoding used in the first loaded .spl file. */ - if (aspath) - vim_strncpy(buf, curbuf->b_s.b_p_spl, - lend - curbuf->b_s.b_p_spl); - else - { - /* Create the "spell" directory if it doesn't exist yet. */ - l = (int)STRLEN(buf); - vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell"); - if (filewritable(buf) != 2) - vim_mkdir(buf, 0755); - - l = (int)STRLEN(buf); - vim_snprintf((char *)buf + l, MAXPATHL - l, - "/%.*s", (int)(lend - lstart), lstart); - } - l = (int)STRLEN(buf); - fname = LANGP_ENTRY(curwin->w_s->b_langp, 0) - ->lp_slang->sl_fname; - vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add", - fname != NULL - && strstr((char *)gettail(fname), ".ascii.") != NULL - ? (char_u *)"ascii" : spell_enc()); - set_option_value((char_u *)"spellfile", 0L, buf, OPT_LOCAL); - break; - } - aspath = FALSE; - } - + ml_close(buf, TRUE); vim_free(buf); } } - /* * Init the chartab used for spelling for ASCII. * EBCDIC is not supported! */ - static void -clear_spell_chartab(sp) - spelltab_T *sp; + void +clear_spell_chartab(spelltab_T *sp) { int i; @@ -9690,7 +3019,7 @@ clear_spell_chartab(sp) * locale. For utf-8 we don't use isalpha() but our own functions. */ void -init_spell_chartab() +init_spell_chartab(void) { int i; @@ -9732,166 +3061,16 @@ init_spell_chartab() spelltab.st_isu[i] = TRUE; spelltab.st_fold[i] = MB_TOLOWER(i); } - else if (MB_ISLOWER(i)) - { - spelltab.st_isw[i] = TRUE; - spelltab.st_upper[i] = MB_TOUPPER(i); - } - } - } -} - -/* - * Set the spell character tables from strings in the affix file. - */ - static int -set_spell_chartab(fol, low, upp) - char_u *fol; - char_u *low; - char_u *upp; -{ - /* We build the new tables here first, so that we can compare with the - * previous one. */ - spelltab_T new_st; - char_u *pf = fol, *pl = low, *pu = upp; - int f, l, u; - - clear_spell_chartab(&new_st); - - while (*pf != NUL) - { - if (*pl == NUL || *pu == NUL) - { - EMSG(_(e_affform)); - return FAIL; - } -#ifdef FEAT_MBYTE - f = mb_ptr2char_adv(&pf); - l = mb_ptr2char_adv(&pl); - u = mb_ptr2char_adv(&pu); -#else - f = *pf++; - l = *pl++; - u = *pu++; -#endif - /* Every character that appears is a word character. */ - if (f < 256) - new_st.st_isw[f] = TRUE; - if (l < 256) - new_st.st_isw[l] = TRUE; - if (u < 256) - new_st.st_isw[u] = TRUE; - - /* if "LOW" and "FOL" are not the same the "LOW" char needs - * case-folding */ - if (l < 256 && l != f) - { - if (f >= 256) - { - EMSG(_(e_affrange)); - return FAIL; - } - new_st.st_fold[l] = f; - } - - /* if "UPP" and "FOL" are not the same the "UPP" char needs - * case-folding, it's upper case and the "UPP" is the upper case of - * "FOL" . */ - if (u < 256 && u != f) - { - if (f >= 256) - { - EMSG(_(e_affrange)); - return FAIL; - } - new_st.st_fold[u] = f; - new_st.st_isu[u] = TRUE; - new_st.st_upper[f] = u; - } - } - - if (*pl != NUL || *pu != NUL) - { - EMSG(_(e_affform)); - return FAIL; - } - - return set_spell_finish(&new_st); -} - -/* - * Set the spell character tables from strings in the .spl file. - */ - static void -set_spell_charflags(flags, cnt, fol) - char_u *flags; - int cnt; /* length of "flags" */ - char_u *fol; -{ - /* We build the new tables here first, so that we can compare with the - * previous one. */ - spelltab_T new_st; - int i; - char_u *p = fol; - int c; - - clear_spell_chartab(&new_st); - - for (i = 0; i < 128; ++i) - { - if (i < cnt) - { - new_st.st_isw[i + 128] = (flags[i] & CF_WORD) != 0; - new_st.st_isu[i + 128] = (flags[i] & CF_UPPER) != 0; - } - - if (*p != NUL) - { -#ifdef FEAT_MBYTE - c = mb_ptr2char_adv(&p); -#else - c = *p++; -#endif - new_st.st_fold[i + 128] = c; - if (i + 128 != c && new_st.st_isu[i + 128] && c < 256) - new_st.st_upper[c] = i + 128; - } - } - - (void)set_spell_finish(&new_st); -} - - static int -set_spell_finish(new_st) - spelltab_T *new_st; -{ - int i; - - if (did_set_spelltab) - { - /* check that it's the same table */ - for (i = 0; i < 256; ++i) - { - if (spelltab.st_isw[i] != new_st->st_isw[i] - || spelltab.st_isu[i] != new_st->st_isu[i] - || spelltab.st_fold[i] != new_st->st_fold[i] - || spelltab.st_upper[i] != new_st->st_upper[i]) + else if (MB_ISLOWER(i)) { - EMSG(_("E763: Word characters differ between spell files")); - return FAIL; + spelltab.st_isw[i] = TRUE; + spelltab.st_upper[i] = MB_TOUPPER(i); } } } - else - { - /* copy the new spelltab into the one being used */ - spelltab = *new_st; - did_set_spelltab = TRUE; - } - - return OK; } + /* * Return TRUE if "p" points to a word character. * As a special case we see "midword" characters as word character when it is @@ -9899,9 +3078,9 @@ set_spell_finish(new_st) * Thus this only works properly when past the first character of the word. */ static int -spell_iswordp(p, wp) - char_u *p; - win_T *wp; /* buffer used */ +spell_iswordp( + char_u *p, + win_T *wp) /* buffer used */ { #ifdef FEAT_MBYTE char_u *s; @@ -9910,7 +3089,7 @@ spell_iswordp(p, wp) if (has_mbyte) { - l = MB_BYTE2LEN(*p); + l = MB_PTR2LEN(p); s = p; if (l == 1) { @@ -9941,10 +3120,8 @@ spell_iswordp(p, wp) * Return TRUE if "p" points to a word character. * Unlike spell_iswordp() this doesn't check for "midword" characters. */ - static int -spell_iswordp_nmw(p, wp) - char_u *p; - win_T *wp; + int +spell_iswordp_nmw(char_u *p, win_T *wp) { #ifdef FEAT_MBYTE int c; @@ -9968,9 +3145,7 @@ spell_iswordp_nmw(p, wp) * See also dbcs_class() and utf_class() in mbyte.c. */ static int -spell_mb_isword_class(cl, wp) - int cl; - win_T *wp; +spell_mb_isword_class(int cl, win_T *wp) { if (wp->w_s->b_cjk) /* East Asian characters are not considered word characters. */ @@ -9983,9 +3158,7 @@ spell_mb_isword_class(cl, wp) * Wide version of spell_iswordp(). */ static int -spell_iswordp_w(p, wp) - int *p; - win_T *wp; +spell_iswordp_w(int *p, win_T *wp) { int *s; @@ -10009,59 +3182,18 @@ spell_iswordp_w(p, wp) } #endif -/* - * Write the table with prefix conditions to the .spl file. - * When "fd" is NULL only count the length of what is written. - */ - static int -write_spell_prefcond(fd, gap) - FILE *fd; - garray_T *gap; -{ - int i; - char_u *p; - int len; - int totlen; - size_t x = 1; /* collect return value of fwrite() */ - - if (fd != NULL) - put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ - - totlen = 2 + gap->ga_len; /* length of <prefcondcnt> and <condlen> bytes */ - - for (i = 0; i < gap->ga_len; ++i) - { - /* <prefcond> : <condlen> <condstr> */ - p = ((char_u **)gap->ga_data)[i]; - if (p != NULL) - { - len = (int)STRLEN(p); - if (fd != NULL) - { - fputc(len, fd); - x &= fwrite(p, (size_t)len, (size_t)1, fd); - } - totlen += len; - } - else if (fd != NULL) - fputc(0, fd); - } - - return totlen; -} - /* * Case-fold "str[len]" into "buf[buflen]". The result is NUL terminated. * Uses the character definitions from the .spl file. * When using a multi-byte 'encoding' the length may change! * Returns FAIL when something wrong. */ - static int -spell_casefold(str, len, buf, buflen) - char_u *str; - int len; - char_u *buf; - int buflen; + int +spell_casefold( + char_u *str, + int len, + char_u *buf, + int buflen) { int i; @@ -10116,7 +3248,7 @@ static int sps_limit = 9999; /* max nr of suggestions given */ * Sets "sps_flags" and "sps_limit". */ int -spell_check_sps() +spell_check_sps(void) { char_u *p; char_u *s; @@ -10171,8 +3303,7 @@ spell_check_sps() * When "count" is non-zero use that suggestion. */ void -spell_suggest(count) - int count; +spell_suggest(int count) { char_u *line; pos_T prev_cursor = curwin->w_cursor; @@ -10198,7 +3329,7 @@ spell_suggest(count) * a multi-line selection. */ if (curwin->w_cursor.lnum != VIsual.lnum) { - vim_beep(); + vim_beep(BO_SPELL); return; } badlen = (int)curwin->w_cursor.col - (int)VIsual.col; @@ -10220,10 +3351,10 @@ spell_suggest(count) p = line + curwin->w_cursor.col; /* Backup to before start of word. */ while (p > line && spell_iswordp_nmw(p, curwin)) - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); /* Forward to start of word. */ while (*p != NUL && !spell_iswordp_nmw(p, curwin)) - mb_ptr_adv(p); + MB_PTR_ADV(p); if (!spell_iswordp_nmw(p, curwin)) /* No word found. */ { @@ -10262,10 +3393,8 @@ spell_suggest(count) } else { - vim_free(repl_from); - repl_from = NULL; - vim_free(repl_to); - repl_to = NULL; + VIM_CLEAR(repl_from); + VIM_CLEAR(repl_to); #ifdef FEAT_RIGHTLEFT /* When 'rightleft' is set the list is drawn right-left. */ @@ -10414,9 +3543,7 @@ spell_suggest(count) * capital. This uses 'spellcapcheck' of the current buffer. */ static int -check_need_cap(lnum, col) - linenr_T lnum; - colnr_T col; +check_need_cap(linenr_T lnum, colnr_T col) { int need_cap = FALSE; char_u *line; @@ -10430,7 +3557,7 @@ check_need_cap(lnum, col) line = ml_get_curline(); endcol = 0; - if ((int)(skipwhite(line) - line) >= (int)col) + if (getwhitecols(line) >= (int)col) { /* At start of line, check if previous line is empty or sentence * ends there. */ @@ -10461,7 +3588,7 @@ check_need_cap(lnum, col) p = line + endcol; for (;;) { - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); if (p == line || spell_iswordp_nmw(p, curwin)) break; if (vim_regexec(®match, p, 0) @@ -10471,6 +3598,7 @@ check_need_cap(lnum, col) break; } } + curwin->w_s->b_cap_prog = regmatch.regprog; } vim_free(line_copy); @@ -10483,8 +3611,7 @@ check_need_cap(lnum, col) * ":spellrepall" */ void -ex_spellrepall(eap) - exarg_T *eap UNUSED; +ex_spellrepall(exarg_T *eap UNUSED) { pos_T pos = curwin->w_cursor; char_u *frompat; @@ -10512,7 +3639,7 @@ ex_spellrepall(eap) curwin->w_cursor.lnum = 0; while (!got_int) { - if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0 + if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL, NULL) == 0 || u_save_cursor() == FAIL) break; @@ -10556,12 +3683,12 @@ ex_spellrepall(eap) * a list of allocated strings. */ void -spell_suggest_list(gap, word, maxcount, need_cap, interactive) - garray_T *gap; - char_u *word; - int maxcount; /* maximum nr of suggestions */ - int need_cap; /* 'spellcapcheck' matched */ - int interactive; +spell_suggest_list( + garray_T *gap, + char_u *word, + int maxcount, /* maximum nr of suggestions */ + int need_cap, /* 'spellcapcheck' matched */ + int interactive) { suginfo_T sug; int i; @@ -10601,14 +3728,14 @@ spell_suggest_list(gap, word, maxcount, need_cap, interactive) * This is based on the mechanisms of Aspell, but completely reimplemented. */ static void -spell_find_suggest(badptr, badlen, su, maxcount, banbadword, need_cap, interactive) - char_u *badptr; - int badlen; /* length of bad word or 0 if unknown */ - suginfo_T *su; - int maxcount; - int banbadword; /* don't include badword in suggestions */ - int need_cap; /* word should start with capital */ - int interactive; +spell_find_suggest( + char_u *badptr, + int badlen, /* length of bad word or 0 if unknown */ + suginfo_T *su, + int maxcount, + int banbadword, /* don't include badword in suggestions */ + int need_cap, /* word should start with capital */ + int interactive) { hlf_T attr = HLF_COUNT; char_u buf[MAXPATHL]; @@ -10645,6 +3772,10 @@ spell_find_suggest(badptr, badlen, su, maxcount, banbadword, need_cap, interacti vim_strncpy(su->su_badword, su->su_badptr, su->su_badlen); (void)spell_casefold(su->su_badptr, su->su_badlen, su->su_fbadword, MAXWLEN); + /* TODO: make this work if the case-folded text is longer than the original + * text. Currently an illegal byte causes wrong pointer computations. */ + su->su_fbadword[su->su_badlen] = NUL; + /* get caps flags for bad word */ su->su_badflags = badword_captype(su->su_badptr, su->su_badptr + su->su_badlen); @@ -10734,9 +3865,7 @@ spell_find_suggest(badptr, badlen, su, maxcount, banbadword, need_cap, interacti * Find suggestions by evaluating expression "expr". */ static void -spell_suggest_expr(su, expr) - suginfo_T *su; - char_u *expr; +spell_suggest_expr(suginfo_T *su, char_u *expr) { list_T *list; listitem_T *li; @@ -10772,9 +3901,7 @@ spell_suggest_expr(su, expr) * Find suggestions in file "fname". Used for "file:" in 'spellsuggest'. */ static void -spell_suggest_file(su, fname) - suginfo_T *su; - char_u *fname; +spell_suggest_file(suginfo_T *su, char_u *fname) { FILE *fd; char_u line[MAXWLEN * 2]; @@ -10830,9 +3957,7 @@ spell_suggest_file(su, fname) * Find suggestions for the internal method indicated by "sps_flags". */ static void -spell_suggest_intern(su, interactive) - suginfo_T *su; - int interactive; +spell_suggest_intern(suginfo_T *su, int interactive) { /* * Load the .sug file(s) that are available and not done yet. @@ -10920,216 +4045,11 @@ spell_suggest_intern(su, interactive) } } -/* - * Load the .sug files for languages that have one and weren't loaded yet. - */ - static void -suggest_load_files() -{ - langp_T *lp; - int lpi; - slang_T *slang; - char_u *dotp; - FILE *fd; - char_u buf[MAXWLEN]; - int i; - time_t timestamp; - int wcount; - int wordnr; - garray_T ga; - int c; - - /* Do this for all languages that support sound folding. */ - for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) - { - lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); - slang = lp->lp_slang; - if (slang->sl_sugtime != 0 && !slang->sl_sugloaded) - { - /* Change ".spl" to ".sug" and open the file. When the file isn't - * found silently skip it. Do set "sl_sugloaded" so that we - * don't try again and again. */ - slang->sl_sugloaded = TRUE; - - dotp = vim_strrchr(slang->sl_fname, '.'); - if (dotp == NULL || fnamecmp(dotp, ".spl") != 0) - continue; - STRCPY(dotp, ".sug"); - fd = mch_fopen((char *)slang->sl_fname, "r"); - if (fd == NULL) - goto nextone; - - /* - * <SUGHEADER>: <fileID> <versionnr> <timestamp> - */ - for (i = 0; i < VIMSUGMAGICL; ++i) - buf[i] = getc(fd); /* <fileID> */ - if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) - { - EMSG2(_("E778: This does not look like a .sug file: %s"), - slang->sl_fname); - goto nextone; - } - c = getc(fd); /* <versionnr> */ - if (c < VIMSUGVERSION) - { - EMSG2(_("E779: Old .sug file, needs to be updated: %s"), - slang->sl_fname); - goto nextone; - } - else if (c > VIMSUGVERSION) - { - EMSG2(_("E780: .sug file is for newer version of Vim: %s"), - slang->sl_fname); - goto nextone; - } - - /* Check the timestamp, it must be exactly the same as the one in - * the .spl file. Otherwise the word numbers won't match. */ - timestamp = get8ctime(fd); /* <timestamp> */ - if (timestamp != slang->sl_sugtime) - { - EMSG2(_("E781: .sug file doesn't match .spl file: %s"), - slang->sl_fname); - goto nextone; - } - - /* - * <SUGWORDTREE>: <wordtree> - * Read the trie with the soundfolded words. - */ - if (spell_read_tree(fd, &slang->sl_sbyts, &slang->sl_sidxs, - FALSE, 0) != 0) - { -someerror: - EMSG2(_("E782: error while reading .sug file: %s"), - slang->sl_fname); - slang_clear_sug(slang); - goto nextone; - } - - /* - * <SUGTABLE>: <sugwcount> <sugline> ... - * - * Read the table with word numbers. We use a file buffer for - * this, because it's so much like a file with lines. Makes it - * possible to swap the info and save on memory use. - */ - slang->sl_sugbuf = open_spellbuf(); - if (slang->sl_sugbuf == NULL) - goto someerror; - /* <sugwcount> */ - wcount = get4c(fd); - if (wcount < 0) - goto someerror; - - /* Read all the wordnr lists into the buffer, one NUL terminated - * list per line. */ - ga_init2(&ga, 1, 100); - for (wordnr = 0; wordnr < wcount; ++wordnr) - { - ga.ga_len = 0; - for (;;) - { - c = getc(fd); /* <sugline> */ - if (c < 0 || ga_grow(&ga, 1) == FAIL) - goto someerror; - ((char_u *)ga.ga_data)[ga.ga_len++] = c; - if (c == NUL) - break; - } - if (ml_append_buf(slang->sl_sugbuf, (linenr_T)wordnr, - ga.ga_data, ga.ga_len, TRUE) == FAIL) - goto someerror; - } - ga_clear(&ga); - - /* - * Need to put word counts in the word tries, so that we can find - * a word by its number. - */ - tree_count_words(slang->sl_fbyts, slang->sl_fidxs); - tree_count_words(slang->sl_sbyts, slang->sl_sidxs); - -nextone: - if (fd != NULL) - fclose(fd); - STRCPY(dotp, ".spl"); - } - } -} - - -/* - * Fill in the wordcount fields for a trie. - * Returns the total number of words. - */ - static void -tree_count_words(byts, idxs) - char_u *byts; - idx_T *idxs; -{ - int depth; - idx_T arridx[MAXWLEN]; - int curi[MAXWLEN]; - int c; - idx_T n; - int wordcount[MAXWLEN]; - - arridx[0] = 0; - curi[0] = 1; - wordcount[0] = 0; - depth = 0; - while (depth >= 0 && !got_int) - { - if (curi[depth] > byts[arridx[depth]]) - { - /* Done all bytes at this node, go up one level. */ - idxs[arridx[depth]] = wordcount[depth]; - if (depth > 0) - wordcount[depth - 1] += wordcount[depth]; - - --depth; - fast_breakcheck(); - } - else - { - /* Do one more byte at this node. */ - n = arridx[depth] + curi[depth]; - ++curi[depth]; - - c = byts[n]; - if (c == 0) - { - /* End of word, count it. */ - ++wordcount[depth]; - - /* Skip over any other NUL bytes (same word with different - * flags). */ - while (byts[n + 1] == 0) - { - ++n; - ++curi[depth]; - } - } - else - { - /* Normal char, go one level deeper to count the words. */ - ++depth; - arridx[depth] = idxs[n]; - curi[depth] = 1; - wordcount[depth] = 0; - } - } - } -} - /* * Free the info put in "*su" by spell_find_suggest(). */ static void -spell_find_cleanup(su) - suginfo_T *su; +spell_find_cleanup(suginfo_T *su) { int i; @@ -11150,11 +4070,11 @@ spell_find_cleanup(su) * "wcopy[MAXWLEN]". "word" must not be empty. * The result is NUL terminated. */ - static void -onecap_copy(word, wcopy, upper) - char_u *word; - char_u *wcopy; - int upper; /* TRUE: first letter made upper case */ + void +onecap_copy( + char_u *word, + char_u *wcopy, + int upper) /* TRUE: first letter made upper case */ { char_u *p; int c; @@ -11188,9 +4108,7 @@ onecap_copy(word, wcopy, upper) * "wcopy[MAXWLEN]". The result is NUL terminated. */ static void -allcap_copy(word, wcopy) - char_u *word; - char_u *wcopy; +allcap_copy(char_u *word, char_u *wcopy) { char_u *s; char_u *d; @@ -11242,8 +4160,7 @@ allcap_copy(word, wcopy) * Try finding suggestions by recognizing specific situations. */ static void -suggest_try_special(su) - suginfo_T *su; +suggest_try_special(suginfo_T *su) { char_u *p; size_t len; @@ -11272,12 +4189,61 @@ suggest_try_special(su) } } +/* + * Change the 0 to 1 to measure how much time is spent in each state. + * Output is dumped in "suggestprof". + */ +#if 0 +# define SUGGEST_PROFILE +proftime_T current; +proftime_T total; +proftime_T times[STATE_FINAL + 1]; +long counts[STATE_FINAL + 1]; + + static void +prof_init(void) +{ + for (int i = 0; i <= STATE_FINAL; ++i) + { + profile_zero(×[i]); + counts[i] = 0; + } + profile_start(¤t); + profile_start(&total); +} + +/* call before changing state */ + static void +prof_store(state_T state) +{ + profile_end(¤t); + profile_add(×[state], ¤t); + ++counts[state]; + profile_start(¤t); +} +# define PROF_STORE(state) prof_store(state); + + static void +prof_report(char *name) +{ + FILE *fd = fopen("suggestprof", "a"); + + profile_end(&total); + fprintf(fd, "-----------------------\n"); + fprintf(fd, "%s: %s\n", name, profile_msg(&total)); + for (int i = 0; i <= STATE_FINAL; ++i) + fprintf(fd, "%d: %s (%ld)\n", i, profile_msg(×[i]), counts[i]); + fclose(fd); +} +#else +# define PROF_STORE(state) +#endif + /* * Try finding suggestions by adding/removing/swapping letters. */ static void -suggest_try_change(su) - suginfo_T *su; +suggest_try_change(suginfo_T *su) { char_u fword[MAXWLEN]; /* copy of the bad word, case-folded */ int n; @@ -11303,7 +4269,13 @@ suggest_try_change(su) continue; /* Try it for this language. Will add possible suggestions. */ +#ifdef SUGGEST_PROFILE + prof_init(); +#endif suggest_trie_walk(su, lp, fword, FALSE); +#ifdef SUGGEST_PROFILE + prof_report("try_change"); +#endif } } @@ -11343,11 +4315,11 @@ suggest_try_change(su) * use "slang->sl_repsal" instead of "lp->lp_replang->sl_rep" */ static void -suggest_trie_walk(su, lp, fword, soundfold) - suginfo_T *su; - langp_T *lp; - char_u *fword; - int soundfold; +suggest_trie_walk( + suginfo_T *su, + langp_T *lp, + char_u *fword, + int soundfold) { char_u tword[MAXWLEN]; /* good word collected so far */ trystate_T stack[MAXWLEN]; @@ -11461,6 +4433,7 @@ suggest_trie_walk(su, lp, fword, soundfold) /* Always past NUL bytes now. */ n = (int)sp->ts_state; + PROF_STORE(sp->ts_state) sp->ts_state = STATE_ENDNUL; sp->ts_save_badflags = su->su_badflags; @@ -11504,6 +4477,7 @@ suggest_trie_walk(su, lp, fword, soundfold) if (sp->ts_curi > len || byts[arridx] != 0) { /* Past bytes in node and/or past NUL bytes. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_ENDNUL; sp->ts_save_badflags = su->su_badflags; break; @@ -11522,7 +4496,7 @@ suggest_trie_walk(su, lp, fword, soundfold) fword_ends = (fword[sp->ts_fidx] == NUL || (soundfold - ? vim_iswhite(fword[sp->ts_fidx]) + ? VIM_ISWHITE(fword[sp->ts_fidx]) : !spell_iswordp(fword + sp->ts_fidx, curwin))); tword[sp->ts_twordlen] = NUL; @@ -11638,7 +4612,7 @@ suggest_trie_walk(su, lp, fword, soundfold) /* Get pointer to last char of previous word. */ p = preword + sp->ts_prewordlen; - mb_ptr_back(preword, p); + MB_PTR_BACK(preword, p); } } @@ -11740,11 +4714,11 @@ suggest_trie_walk(su, lp, fword, soundfold) /* Give a penalty when changing non-word char to word * char, e.g., "thes," -> "these". */ p = fword + sp->ts_fidx; - mb_ptr_back(fword, p); + MB_PTR_BACK(fword, p); if (!spell_iswordp(p, curwin)) { p = preword + STRLEN(preword); - mb_ptr_back(preword, p); + MB_PTR_BACK(preword, p); if (spell_iswordp(p, curwin)) newscore += SCORE_NONWORD; } @@ -11819,6 +4793,7 @@ suggest_trie_walk(su, lp, fword, soundfold) */ try_compound = FALSE; if (!soundfold + && !slang->sl_nocompoundsugs && slang->sl_compprog != NULL && ((unsigned)flags >> 24) != 0 && sp->ts_twordlen - sp->ts_splitoff @@ -11843,7 +4818,7 @@ suggest_trie_walk(su, lp, fword, soundfold) /* For NOBREAK we never try splitting, it won't make any word * valid. */ - if (slang->sl_nobreak) + if (slang->sl_nobreak && !slang->sl_nocompoundsugs) try_compound = TRUE; /* If we could add a compound word, and it's also possible to @@ -11903,6 +4878,7 @@ suggest_trie_walk(su, lp, fword, soundfold) #endif /* Save things to be restored at STATE_SPLITUNDO. */ sp->ts_save_badflags = su->su_badflags; + PROF_STORE(sp->ts_state) sp->ts_state = STATE_SPLITUNDO; ++depth; @@ -11929,12 +4905,7 @@ suggest_trie_walk(su, lp, fword, soundfold) { int l; -#ifdef FEAT_MBYTE - if (has_mbyte) - l = MB_BYTE2LEN(fword[sp->ts_fidx]); - else -#endif - l = 1; + l = MB_PTR2LEN(fword + sp->ts_fidx); if (fword_ends) { /* Copy the skipped character to preword. */ @@ -11977,6 +4948,7 @@ suggest_trie_walk(su, lp, fword, soundfold) byts = pbyts; idxs = pidxs; sp->ts_prefixdepth = PFD_PREFIXTREE; + PROF_STORE(sp->ts_state) sp->ts_state = STATE_NOPREFIX; } } @@ -11989,6 +4961,7 @@ suggest_trie_walk(su, lp, fword, soundfold) su->su_badflags = sp->ts_save_badflags; /* Continue looking for NUL bytes. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_START; /* In case we went into the prefix tree. */ @@ -12006,11 +4979,13 @@ suggest_trie_walk(su, lp, fword, soundfold) ) { /* The badword ends, can't use STATE_PLAIN. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_DEL; break; } + PROF_STORE(sp->ts_state) sp->ts_state = STATE_PLAIN; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_PLAIN: /* @@ -12022,6 +4997,7 @@ suggest_trie_walk(su, lp, fword, soundfold) { /* Done all bytes at this node, do next state. When still at * already changed bytes skip the other tricks. */ + PROF_STORE(sp->ts_state) if (sp->ts_fidx >= sp->ts_fidxtry) sp->ts_state = STATE_DEL; else @@ -12096,19 +5072,18 @@ suggest_trie_walk(su, lp, fword, soundfold) /* Correct ts_fidx for the byte length of the * character (we didn't check that before). */ sp->ts_fidx = sp->ts_fcharstart - + MB_BYTE2LEN( - fword[sp->ts_fcharstart]); - + + MB_PTR2LEN( + fword + sp->ts_fcharstart); /* For changing a composing character adjust * the score from SCORE_SUBST to * SCORE_SUBCOMP. */ if (enc_utf8 && utf_iscomposing( - mb_ptr2char(tword + utf_ptr2char(tword + sp->ts_twordlen - sp->ts_tcharlen)) && utf_iscomposing( - mb_ptr2char(fword + utf_ptr2char(fword + sp->ts_fcharstart))) sp->ts_score -= SCORE_SUBST - SCORE_SUBCOMP; @@ -12144,7 +5119,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * to the score. Also for the soundfold * tree (might seem illogical but does * give better scores). */ - mb_ptr_back(tword, p); + MB_PTR_BACK(tword, p); if (c == mb_ptr2char(p)) sp->ts_score -= SCORE_INS - SCORE_INSDUP; @@ -12178,6 +5153,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * delete/insert/swap a character. */ if (has_mbyte && sp->ts_tcharlen > 0) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_FINAL; break; } @@ -12185,6 +5161,7 @@ suggest_trie_walk(su, lp, fword, soundfold) /* * Try skipping one character in the bad word (delete it). */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_INS_PREP; sp->ts_curi = 1; if (soundfold && sp->ts_fidx == 0 && fword[sp->ts_fidx] == '*') @@ -12217,7 +5194,7 @@ suggest_trie_walk(su, lp, fword, soundfold) if (has_mbyte) { c = mb_ptr2char(fword + sp->ts_fidx); - stack[depth].ts_fidx += MB_BYTE2LEN(fword[sp->ts_fidx]); + stack[depth].ts_fidx += MB_PTR2LEN(fword + sp->ts_fidx); if (enc_utf8 && utf_iscomposing(c)) stack[depth].ts_score -= SCORE_DEL - SCORE_DELCOMP; else if (c == mb_ptr2char(fword + stack[depth].ts_fidx)) @@ -12232,13 +5209,14 @@ suggest_trie_walk(su, lp, fword, soundfold) } break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_INS_PREP: if (sp->ts_flags & TSF_DIDDEL) { /* If we just deleted a byte then inserting won't make sense, * a substitute is always cheaper. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_SWAP; break; } @@ -12250,12 +5228,14 @@ suggest_trie_walk(su, lp, fword, soundfold) if (sp->ts_curi > byts[n]) { /* Only NUL bytes at this node, go to next state. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_SWAP; break; } if (byts[n + sp->ts_curi] != NUL) { /* Found a byte to insert. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_INS; break; } @@ -12263,7 +5243,7 @@ suggest_trie_walk(su, lp, fword, soundfold) } break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_INS: /* Insert one byte. Repeat this for each possible byte at this @@ -12272,6 +5252,7 @@ suggest_trie_walk(su, lp, fword, soundfold) if (sp->ts_curi > byts[n]) { /* Done all bytes at this node, go to next state. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_SWAP; break; } @@ -12343,6 +5324,7 @@ suggest_trie_walk(su, lp, fword, soundfold) if (c == NUL) { /* End of word, can't swap or replace. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_FINAL; break; } @@ -12351,6 +5333,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * SWAP3 etc. also don't make sense then. */ if (!soundfold && !spell_iswordp(p, curwin)) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; break; } @@ -12358,7 +5341,7 @@ suggest_trie_walk(su, lp, fword, soundfold) #ifdef FEAT_MBYTE if (has_mbyte) { - n = mb_cptr2len(p); + n = MB_CPTR2LEN(p); c = mb_ptr2char(p); if (p[n] == NUL) c2 = NUL; @@ -12381,6 +5364,7 @@ suggest_trie_walk(su, lp, fword, soundfold) /* When the second character is NUL we can't swap. */ if (c2 == NUL) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; break; } @@ -12389,6 +5373,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * Also get here if the second char is not a word character. */ if (c == c2) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_SWAP3; break; } @@ -12400,6 +5385,7 @@ suggest_trie_walk(su, lp, fword, soundfold) sp->ts_twordlen, tword, fword + sp->ts_fidx, c, c2); #endif + PROF_STORE(sp->ts_state) sp->ts_state = STATE_UNSWAP; ++depth; #ifdef FEAT_MBYTE @@ -12419,8 +5405,11 @@ suggest_trie_walk(su, lp, fword, soundfold) } } else + { /* If this swap doesn't work then SWAP3 won't either. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; + } break; case STATE_UNSWAP: @@ -12429,9 +5418,9 @@ suggest_trie_walk(su, lp, fword, soundfold) #ifdef FEAT_MBYTE if (has_mbyte) { - n = MB_BYTE2LEN(*p); + n = MB_PTR2LEN(p); c = mb_ptr2char(p + n); - mch_memmove(p + MB_BYTE2LEN(p[n]), p, n); + mch_memmove(p + MB_PTR2LEN(p + n), p, n); mb_char2bytes(c, p); } else @@ -12441,7 +5430,7 @@ suggest_trie_walk(su, lp, fword, soundfold) *p = p[1]; p[1] = c; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_SWAP3: /* Swap two bytes, skipping one: "123" -> "321". We change @@ -12450,9 +5439,9 @@ suggest_trie_walk(su, lp, fword, soundfold) #ifdef FEAT_MBYTE if (has_mbyte) { - n = mb_cptr2len(p); + n = MB_CPTR2LEN(p); c = mb_ptr2char(p); - fl = mb_cptr2len(p + n); + fl = MB_CPTR2LEN(p + n); c2 = mb_ptr2char(p + n); if (!soundfold && !spell_iswordp(p + n + fl, curwin)) c3 = c; /* don't swap non-word char */ @@ -12478,6 +5467,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * Second character may any char: "a.b" -> "b.a" */ if (c == c3 || c3 == NUL) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; break; } @@ -12489,6 +5479,7 @@ suggest_trie_walk(su, lp, fword, soundfold) sp->ts_twordlen, tword, fword + sp->ts_fidx, c, c3); #endif + PROF_STORE(sp->ts_state) sp->ts_state = STATE_UNSWAP3; ++depth; #ifdef FEAT_MBYTE @@ -12509,7 +5500,10 @@ suggest_trie_walk(su, lp, fword, soundfold) } } else + { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; + } break; case STATE_UNSWAP3: @@ -12518,11 +5512,11 @@ suggest_trie_walk(su, lp, fword, soundfold) #ifdef FEAT_MBYTE if (has_mbyte) { - n = MB_BYTE2LEN(*p); + n = MB_PTR2LEN(p); c2 = mb_ptr2char(p + n); - fl = MB_BYTE2LEN(p[n]); + fl = MB_PTR2LEN(p + n); c = mb_ptr2char(p + n + fl); - tl = MB_BYTE2LEN(p[n + fl]); + tl = MB_PTR2LEN(p + n + fl); mch_memmove(p + fl + tl, p, n); mb_char2bytes(c, p); mb_char2bytes(c2, p + tl); @@ -12541,6 +5535,7 @@ suggest_trie_walk(su, lp, fword, soundfold) { /* Middle char is not a word char, skip the rotate. First and * third char were already checked at swap and swap3. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; break; } @@ -12556,16 +5551,17 @@ suggest_trie_walk(su, lp, fword, soundfold) sp->ts_twordlen, tword, fword + sp->ts_fidx, p[0], p[1], p[2]); #endif + PROF_STORE(sp->ts_state) sp->ts_state = STATE_UNROT3L; ++depth; p = fword + sp->ts_fidx; #ifdef FEAT_MBYTE if (has_mbyte) { - n = mb_cptr2len(p); + n = MB_CPTR2LEN(p); c = mb_ptr2char(p); - fl = mb_cptr2len(p + n); - fl += mb_cptr2len(p + n + fl); + fl = MB_CPTR2LEN(p + n); + fl += MB_CPTR2LEN(p + n + fl); mch_memmove(p, p + n, fl); mb_char2bytes(c, p + fl); stack[depth].ts_fidxtry = sp->ts_fidx + n + fl; @@ -12581,7 +5577,10 @@ suggest_trie_walk(su, lp, fword, soundfold) } } else + { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; + } break; case STATE_UNROT3L: @@ -12590,10 +5589,10 @@ suggest_trie_walk(su, lp, fword, soundfold) #ifdef FEAT_MBYTE if (has_mbyte) { - n = MB_BYTE2LEN(*p); - n += MB_BYTE2LEN(p[n]); + n = MB_PTR2LEN(p); + n += MB_PTR2LEN(p + n); c = mb_ptr2char(p + n); - tl = MB_BYTE2LEN(p[n]); + tl = MB_PTR2LEN(p + n); mch_memmove(p + tl, p, n); mb_char2bytes(c, p); } @@ -12617,16 +5616,17 @@ suggest_trie_walk(su, lp, fword, soundfold) sp->ts_twordlen, tword, fword + sp->ts_fidx, p[0], p[1], p[2]); #endif + PROF_STORE(sp->ts_state) sp->ts_state = STATE_UNROT3R; ++depth; p = fword + sp->ts_fidx; #ifdef FEAT_MBYTE if (has_mbyte) { - n = mb_cptr2len(p); - n += mb_cptr2len(p + n); + n = MB_CPTR2LEN(p); + n += MB_CPTR2LEN(p + n); c = mb_ptr2char(p + n); - tl = mb_cptr2len(p + n); + tl = MB_CPTR2LEN(p + n); mch_memmove(p + tl, p, n); mb_char2bytes(c, p); stack[depth].ts_fidxtry = sp->ts_fidx + n + tl; @@ -12642,7 +5642,10 @@ suggest_trie_walk(su, lp, fword, soundfold) } } else + { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_INI; + } break; case STATE_UNROT3R: @@ -12652,9 +5655,9 @@ suggest_trie_walk(su, lp, fword, soundfold) if (has_mbyte) { c = mb_ptr2char(p); - tl = MB_BYTE2LEN(*p); - n = MB_BYTE2LEN(p[tl]); - n += MB_BYTE2LEN(p[tl + n]); + tl = MB_PTR2LEN(p); + n = MB_PTR2LEN(p + tl); + n += MB_PTR2LEN(p + tl + n); mch_memmove(p, p + tl, n); mb_char2bytes(c, p + n); } @@ -12666,7 +5669,7 @@ suggest_trie_walk(su, lp, fword, soundfold) p[1] = p[2]; p[2] = c; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_REP_INI: /* Check if matching with REP items from the .aff file would work. @@ -12678,6 +5681,7 @@ suggest_trie_walk(su, lp, fword, soundfold) || sp->ts_score + SCORE_REP >= su->su_maxscore || sp->ts_fidx < sp->ts_fidxtry) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_FINAL; break; } @@ -12691,12 +5695,14 @@ suggest_trie_walk(su, lp, fword, soundfold) if (sp->ts_curi < 0) { + PROF_STORE(sp->ts_state) sp->ts_state = STATE_FINAL; break; } + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_REP: /* Try matching with REP items from the .aff file. For each match @@ -12727,6 +5733,7 @@ suggest_trie_walk(su, lp, fword, soundfold) ftp->ft_from, ftp->ft_to); #endif /* Need to undo this afterwards. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP_UNDO; /* Change the "from" to the "to" string. */ @@ -12748,8 +5755,11 @@ suggest_trie_walk(su, lp, fword, soundfold) } if (sp->ts_curi >= gap->ga_len && sp->ts_state == STATE_REP) + { /* No (more) matches. */ + PROF_STORE(sp->ts_state) sp->ts_state = STATE_FINAL; + } break; @@ -12769,6 +5779,7 @@ suggest_trie_walk(su, lp, fword, soundfold) repextra -= tl - fl; } mch_memmove(p, ftp->ft_from, fl); + PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP; break; @@ -12798,10 +5809,7 @@ suggest_trie_walk(su, lp, fword, soundfold) * Go one level deeper in the tree. */ static void -go_deeper(stack, depth, score_add) - trystate_T *stack; - int depth; - int score_add; +go_deeper(trystate_T *stack, int depth, int score_add) { stack[depth + 1] = stack[depth]; stack[depth + 1].ts_state = STATE_START; @@ -12816,17 +5824,14 @@ go_deeper(stack, depth, score_add) * fword[flen] and return the byte length of that many chars in "word". */ static int -nofold_len(fword, flen, word) - char_u *fword; - int flen; - char_u *word; +nofold_len(char_u *fword, int flen, char_u *word) { char_u *p; int i = 0; - for (p = fword; p < fword + flen; mb_ptr_adv(p)) + for (p = fword; p < fword + flen; MB_PTR_ADV(p)) ++i; - for (p = word; i > 0; mb_ptr_adv(p)) + for (p = word; i > 0; MB_PTR_ADV(p)) --i; return (int)(p - word); } @@ -12839,10 +5844,7 @@ nofold_len(fword, flen, word) * same case-folded word, but we only find one... */ static void -find_keepcap_word(slang, fword, kword) - slang_T *slang; - char_u *fword; - char_u *kword; +find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword) { char_u uword[MAXWLEN]; /* "fword" in upper-case */ int depth; @@ -12915,8 +5917,8 @@ find_keepcap_word(slang, fword, kword) #ifdef FEAT_MBYTE if (has_mbyte) { - flen = mb_cptr2len(fword + fwordidx[depth]); - ulen = mb_cptr2len(uword + uwordidx[depth]); + flen = MB_CPTR2LEN(fword + fwordidx[depth]); + ulen = MB_CPTR2LEN(uword + uwordidx[depth]); } else #endif @@ -12998,8 +6000,7 @@ find_keepcap_word(slang, fword, kword) * su->su_sga. */ static void -score_comp_sal(su) - suginfo_T *su; +score_comp_sal(suginfo_T *su) { langp_T *lp; char_u badsound[MAXWLEN]; @@ -13053,8 +6054,7 @@ score_comp_sal(su) * They are entwined. */ static void -score_combine(su) - suginfo_T *su; +score_combine(suginfo_T *su) { int i; int j; @@ -13166,11 +6166,11 @@ score_combine(su) * badword. */ static int -stp_sal_score(stp, su, slang, badsound) - suggest_T *stp; - suginfo_T *su; - slang_T *slang; - char_u *badsound; /* sound-folded badword */ +stp_sal_score( + suggest_T *stp, + suginfo_T *su, + slang_T *slang, + char_u *badsound) /* sound-folded badword */ { char_u *p; char_u *pbad; @@ -13193,7 +6193,7 @@ stp_sal_score(stp, su, slang, badsound) * sounds like "t h" while "the" sounds like "@". Avoid that by * removing the space. Don't do it when the good word also contains a * space. */ - if (vim_iswhite(su->su_badptr[su->su_badlen]) + if (VIM_ISWHITE(su->su_badptr[su->su_badlen]) && *skiptowhite(stp->st_word) == NUL) for (p = fword; *(p = skiptowhite(p)) != NUL; ) STRMOVE(p, p + 1); @@ -13236,7 +6236,7 @@ static sftword_T dumsft; * Prepare for calling suggest_try_soundalike(). */ static void -suggest_try_soundalike_prep() +suggest_try_soundalike_prep(void) { langp_T *lp; int lpi; @@ -13259,8 +6259,7 @@ suggest_try_soundalike_prep() * Note: This doesn't support postponed prefixes. */ static void -suggest_try_soundalike(su) - suginfo_T *su; +suggest_try_soundalike(suginfo_T *su) { char_u salword[MAXWLEN]; langp_T *lp; @@ -13281,7 +6280,13 @@ suggest_try_soundalike(su) /* try all kinds of inserts/deletes/swaps/etc. */ /* TODO: also soundfold the next words, so that we can try joining * and splitting */ +#ifdef SUGGEST_PROFILE + prof_init(); +#endif suggest_trie_walk(su, lp, salword, TRUE); +#ifdef SUGGEST_PROFILE + prof_report("soundalike"); +#endif } } } @@ -13290,7 +6295,7 @@ suggest_try_soundalike(su) * Finish up after calling suggest_try_soundalike(). */ static void -suggest_try_soundalike_finish() +suggest_try_soundalike_finish(void) { langp_T *lp; int lpi; @@ -13327,11 +6332,11 @@ suggest_try_soundalike_finish() * produce this soundfolded word. */ static void -add_sound_suggest(su, goodword, score, lp) - suginfo_T *su; - char_u *goodword; - int score; /* soundfold score */ - langp_T *lp; +add_sound_suggest( + suginfo_T *su, + char_u *goodword, + int score, /* soundfold score */ + langp_T *lp) { slang_T *slang = lp->lp_slang; /* language for sound folding */ int sfwordnr; @@ -13385,7 +6390,7 @@ add_sound_suggest(su, goodword, score, lp) sfwordnr = soundfold_find(slang, goodword); if (sfwordnr < 0) { - EMSG2(_(e_intern2), "add_sound_suggest()"); + internal_error("add_sound_suggest()"); return; } @@ -13535,9 +6540,7 @@ add_sound_suggest(su, goodword, score, lp) * Find word "word" in fold-case tree for "slang" and return the word number. */ static int -soundfold_find(slang, word) - slang_T *slang; - char_u *word; +soundfold_find(slang_T *slang, char_u *word) { idx_T arridx = 0; int len; @@ -13611,10 +6614,7 @@ soundfold_find(slang, word) * Copy "fword" to "cword", fixing case according to "flags". */ static void -make_case_word(fword, cword, flags) - char_u *fword; - char_u *cword; - int flags; +make_case_word(char_u *fword, char_u *cword, int flags) { if (flags & WF_ALLCAP) /* Make it all upper-case */ @@ -13627,99 +6627,13 @@ make_case_word(fword, cword, flags) STRCPY(cword, fword); } -/* - * Use map string "map" for languages "lp". - */ - static void -set_map_str(lp, map) - slang_T *lp; - char_u *map; -{ - char_u *p; - int headc = 0; - int c; - int i; - - if (*map == NUL) - { - lp->sl_has_map = FALSE; - return; - } - lp->sl_has_map = TRUE; - - /* Init the array and hash tables empty. */ - for (i = 0; i < 256; ++i) - lp->sl_map_array[i] = 0; -#ifdef FEAT_MBYTE - hash_init(&lp->sl_map_hash); -#endif - - /* - * The similar characters are stored separated with slashes: - * "aaa/bbb/ccc/". Fill sl_map_array[c] with the character before c and - * before the same slash. For characters above 255 sl_map_hash is used. - */ - for (p = map; *p != NUL; ) - { -#ifdef FEAT_MBYTE - c = mb_cptr2char_adv(&p); -#else - c = *p++; -#endif - if (c == '/') - headc = 0; - else - { - if (headc == 0) - headc = c; - -#ifdef FEAT_MBYTE - /* Characters above 255 don't fit in sl_map_array[], put them in - * the hash table. Each entry is the char, a NUL the headchar and - * a NUL. */ - if (c >= 256) - { - int cl = mb_char2len(c); - int headcl = mb_char2len(headc); - char_u *b; - hash_T hash; - hashitem_T *hi; - - b = alloc((unsigned)(cl + headcl + 2)); - if (b == NULL) - return; - mb_char2bytes(c, b); - b[cl] = NUL; - mb_char2bytes(headc, b + cl + 1); - b[cl + 1 + headcl] = NUL; - hash = hash_hash(b); - hi = hash_lookup(&lp->sl_map_hash, b, hash); - if (HASHITEM_EMPTY(hi)) - hash_add_item(&lp->sl_map_hash, hi, b, hash); - else - { - /* This should have been checked when generating the .spl - * file. */ - EMSG(_("E783: duplicate char in MAP entry")); - vim_free(b); - } - } - else -#endif - lp->sl_map_array[c] = headc; - } - } -} /* * Return TRUE if "c1" and "c2" are similar characters according to the MAP * lines in the .aff file. */ static int -similar_chars(slang, c1, c2) - slang_T *slang; - int c1; - int c2; +similar_chars(slang_T *slang, int c1, int c2) { int m1, m2; #ifdef FEAT_MBYTE @@ -13764,17 +6678,16 @@ similar_chars(slang, c1, c2) * For a suggestion that is already in the list the lowest score is remembered. */ static void -add_suggestion(su, gap, goodword, badlenarg, score, altscore, had_bonus, - slang, maxsf) - suginfo_T *su; - garray_T *gap; /* either su_ga or su_sga */ - char_u *goodword; - int badlenarg; /* len of bad word replaced with "goodword" */ - int score; - int altscore; - int had_bonus; /* value for st_had_bonus */ - slang_T *slang; /* language for sound folding */ - int maxsf; /* su_maxscore applies to soundfold score, +add_suggestion( + suginfo_T *su, + garray_T *gap, /* either su_ga or su_sga */ + char_u *goodword, + int badlenarg, /* len of bad word replaced with "goodword" */ + int score, + int altscore, + int had_bonus, /* value for st_had_bonus */ + slang_T *slang, /* language for sound folding */ + int maxsf) /* su_maxscore applies to soundfold score, su_sfmaxscore to the total score. */ { int goodlen; /* len of goodword changed */ @@ -13794,8 +6707,8 @@ add_suggestion(su, gap, goodword, badlenarg, score, altscore, had_bonus, badlen = (int)(pbad - su->su_badptr); if (goodlen <= 0 || badlen <= 0) break; - mb_ptr_back(goodword, pgood); - mb_ptr_back(su->su_badptr, pbad); + MB_PTR_BACK(goodword, pgood); + MB_PTR_BACK(su->su_badptr, pbad); #ifdef FEAT_MBYTE if (has_mbyte) { @@ -13901,9 +6814,9 @@ add_suggestion(su, gap, goodword, badlenarg, score, altscore, had_bonus, * for split words, such as "the the". Remove these from the list here. */ static void -check_suggestions(su, gap) - suginfo_T *su; - garray_T *gap; /* either su_ga or su_sga */ +check_suggestions( + suginfo_T *su, + garray_T *gap) /* either su_ga or su_sga */ { suggest_T *stp; int i; @@ -13938,9 +6851,9 @@ check_suggestions(su, gap) * Add a word to be banned. */ static void -add_banned(su, word) - suginfo_T *su; - char_u *word; +add_banned( + suginfo_T *su, + char_u *word) { char_u *s; hash_T hash; @@ -13961,8 +6874,7 @@ add_banned(su, word) * is slow, thus only done for the final results. */ static void -rescore_suggestions(su) - suginfo_T *su; +rescore_suggestions(suginfo_T *su) { int i; @@ -13975,9 +6887,7 @@ rescore_suggestions(su) * Recompute the score for one suggestion if sound-folding is possible. */ static void -rescore_one(su, stp) - suginfo_T *su; - suggest_T *stp; +rescore_one(suginfo_T *su, suggest_T *stp) { slang_T *slang = stp->st_slang; char_u sal_badword[MAXWLEN]; @@ -14007,7 +6917,7 @@ static int #ifdef __BORLANDC__ _RTLENTRYF #endif -sug_compare __ARGS((const void *s1, const void *s2)); +sug_compare(const void *s1, const void *s2); /* * Function given to qsort() to sort the suggestions on st_score. @@ -14017,9 +6927,7 @@ sug_compare __ARGS((const void *s1, const void *s2)); #ifdef __BORLANDC__ _RTLENTRYF #endif -sug_compare(s1, s2) - const void *s1; - const void *s2; +sug_compare(const void *s1, const void *s2) { suggest_T *p1 = (suggest_T *)s1; suggest_T *p2 = (suggest_T *)s2; @@ -14041,10 +6949,10 @@ sug_compare(s1, s2) * Returns the maximum score in the list or "maxscore" unmodified. */ static int -cleanup_suggestions(gap, maxscore, keep) - garray_T *gap; - int maxscore; - int keep; /* nr of suggestions to keep */ +cleanup_suggestions( + garray_T *gap, + int maxscore, + int keep) /* nr of suggestions to keep */ { suggest_T *stp = &SUG(*gap, 0); int i; @@ -14069,8 +6977,7 @@ cleanup_suggestions(gap, maxscore, keep) * Result is in allocated memory, NULL for an error. */ char_u * -eval_soundfold(word) - char_u *word; +eval_soundfold(char_u *word) { langp_T *lp; char_u sound[MAXWLEN]; @@ -14106,12 +7013,12 @@ eval_soundfold(word) * 1. SOFOFROM/SOFOTO do a simple character mapping. * 2. SAL items define a more advanced sound-folding (and much slower). */ - static void -spell_soundfold(slang, inword, folded, res) - slang_T *slang; - char_u *inword; - int folded; /* "inword" is already case-folded */ - char_u *res; + void +spell_soundfold( + slang_T *slang, + char_u *inword, + int folded, /* "inword" is already case-folded */ + char_u *res) { char_u fword[MAXWLEN]; char_u *word; @@ -14144,10 +7051,7 @@ spell_soundfold(slang, inword, folded, res) * SOFOTO lines. */ static void -spell_soundfold_sofo(slang, inword, res) - slang_T *slang; - char_u *inword; - char_u *res; +spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res) { char_u *s; int ri = 0; @@ -14164,7 +7068,7 @@ spell_soundfold_sofo(slang, inword, res) for (s = inword; *s != NUL; ) { c = mb_cptr2char_adv(&s); - if (enc_utf8 ? utf_class(c) == 0 : vim_iswhite(c)) + if (enc_utf8 ? utf_class(c) == 0 : VIM_ISWHITE(c)) c = ' '; else if (c < 256) c = slang->sl_sal_first[c]; @@ -14205,7 +7109,7 @@ spell_soundfold_sofo(slang, inword, res) /* The sl_sal_first[] table contains the translation. */ for (s = inword; (c = *s) != NUL; ++s) { - if (vim_iswhite(c)) + if (VIM_ISWHITE(c)) c = ' '; else c = slang->sl_sal_first[c]; @@ -14218,10 +7122,7 @@ spell_soundfold_sofo(slang, inword, res) } static void -spell_soundfold_sal(slang, inword, res) - slang_T *slang; - char_u *inword; - char_u *res; +spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res) { salitem_T *smp; char_u word[MAXWLEN]; @@ -14246,7 +7147,7 @@ spell_soundfold_sal(slang, inword, res) t = word; while (*s != NUL) { - if (vim_iswhite(*s)) + if (VIM_ISWHITE(*s)) { *t++ = ' '; s = skipwhite(s); @@ -14470,7 +7371,7 @@ spell_soundfold_sal(slang, inword, res) } } } - else if (vim_iswhite(c)) + else if (VIM_ISWHITE(c)) { c = ' '; k = 1; @@ -14499,10 +7400,7 @@ spell_soundfold_sal(slang, inword, res) * Multi-byte version of spell_soundfold(). */ static void -spell_soundfold_wsal(slang, inword, res) - slang_T *slang; - char_u *inword; - char_u *res; +spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res) { salitem_T *smp = (salitem_T *)slang->sl_sal.ga_data; int word[MAXWLEN]; @@ -14538,7 +7436,7 @@ spell_soundfold_wsal(slang, inword, res) c = mb_cptr2char_adv(&s); if (slang->sl_rem_accents) { - if (enc_utf8 ? utf_class(c) == 0 : vim_iswhite(c)) + if (enc_utf8 ? utf_class(c) == 0 : VIM_ISWHITE(c)) { if (did_white) continue; @@ -14779,7 +7677,7 @@ spell_soundfold_wsal(slang, inword, res) } } } - else if (vim_iswhite(c)) + else if (VIM_ISWHITE(c)) { c = ' '; k = 1; @@ -14818,9 +7716,9 @@ spell_soundfold_wsal(slang, inword, res) * avoiding checks that will not be possible. */ static int -soundalike_score(goodstart, badstart) - char_u *goodstart; /* sound-folded good word */ - char_u *badstart; /* sound-folded bad word */ +soundalike_score( + char_u *goodstart, /* sound-folded good word */ + char_u *badstart) /* sound-folded bad word */ { char_u *goodsound = goodstart; char_u *badsound = badstart; @@ -15053,10 +7951,10 @@ soundalike_score(goodstart, badstart) * support multi-byte characters. */ static int -spell_edit_score(slang, badword, goodword) - slang_T *slang; - char_u *badword; - char_u *goodword; +spell_edit_score( + slang_T *slang, + char_u *badword, + char_u *goodword) { int *cnt; int badlen, goodlen; /* lengths including NUL */ @@ -15185,11 +8083,11 @@ typedef struct * for multi-byte characters. */ static int -spell_edit_score_limit(slang, badword, goodword, limit) - slang_T *slang; - char_u *badword; - char_u *goodword; - int limit; +spell_edit_score_limit( + slang_T *slang, + char_u *badword, + char_u *goodword, + int limit) { limitscore_T stack[10]; /* allow for over 3 * 2 edits */ int stackidx; @@ -15367,11 +8265,11 @@ spell_edit_score_limit(slang, badword, goodword, limit) * Keep it in sync with the above! */ static int -spell_edit_score_limit_w(slang, badword, goodword, limit) - slang_T *slang; - char_u *badword; - char_u *goodword; - int limit; +spell_edit_score_limit_w( + slang_T *slang, + char_u *badword, + char_u *goodword, + int limit) { limitscore_T stack[10]; /* allow for over 3 * 2 edits */ int stackidx; @@ -15556,8 +8454,7 @@ spell_edit_score_limit_w(slang, badword, goodword, limit) * ":spellinfo" */ void -ex_spellinfo(eap) - exarg_T *eap UNUSED; +ex_spellinfo(exarg_T *eap UNUSED) { int lpi; langp_T *lp; @@ -15593,8 +8490,7 @@ ex_spellinfo(eap) * ":spelldump" */ void -ex_spelldump(eap) - exarg_T *eap; +ex_spelldump(exarg_T *eap) { char_u *spl; long dummy; @@ -15608,10 +8504,10 @@ ex_spelldump(eap) /* enable spelling locally in the new window */ set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL); - set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL); + set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL); vim_free(spl); - if (!bufempty() || !buf_valid(curbuf)) + if (!BUFEMPTY()) return; spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0); @@ -15630,11 +8526,11 @@ ex_spelldump(eap) * 2. When "pat" is not NULL: add matching words to insert mode completion. */ void -spell_dump_compl(pat, ic, dir, dumpflags_arg) - char_u *pat; /* leading part of the word */ - int ic; /* ignore case */ - int *dir; /* direction for adding matches */ - int dumpflags_arg; /* DUMPFLAG_* */ +spell_dump_compl( + char_u *pat, /* leading part of the word */ + int ic, /* ignore case */ + int *dir, /* direction for adding matches */ + int dumpflags_arg) /* DUMPFLAG_* */ { langp_T *lp; slang_T *slang; @@ -15760,7 +8656,7 @@ spell_dump_compl(pat, ic, dir, dumpflags_arg) /* Done all bytes at this node, go up one level. */ --depth; line_breakcheck(); - ins_compl_check_keys(50); + ins_compl_check_keys(50, FALSE); } else { @@ -15831,14 +8727,14 @@ spell_dump_compl(pat, ic, dir, dumpflags_arg) * When "lnum" is zero add insert mode completion. */ static void -dump_word(slang, word, pat, dir, dumpflags, wordflags, lnum) - slang_T *slang; - char_u *word; - char_u *pat; - int *dir; - int dumpflags; - int wordflags; - linenr_T lnum; +dump_word( + slang_T *slang, + char_u *word, + char_u *pat, + int *dir, + int dumpflags, + int wordflags, + linenr_T lnum) { int keepcap = FALSE; char_u *p; @@ -15921,14 +8817,14 @@ dump_word(slang, word, pat, dir, dumpflags, wordflags, lnum) * Return the updated line number. */ static linenr_T -dump_prefixes(slang, word, pat, dir, dumpflags, flags, startlnum) - slang_T *slang; - char_u *word; /* case-folded word */ - char_u *pat; - int *dir; - int dumpflags; - int flags; /* flags with prefix ID */ - linenr_T startlnum; +dump_prefixes( + slang_T *slang, + char_u *word, /* case-folded word */ + char_u *pat, + int *dir, + int dumpflags, + int flags, /* flags with prefix ID */ + linenr_T startlnum) { idx_T arridx[MAXWLEN]; int curi[MAXWLEN]; @@ -16037,14 +8933,12 @@ dump_prefixes(slang, word, pat, dir, dumpflags, flags, startlnum) * Uses the spell-checking word characters. */ char_u * -spell_to_word_end(start, win) - char_u *start; - win_T *win; +spell_to_word_end(char_u *start, win_T *win) { char_u *p = start; while (*p != NUL && spell_iswordp(p, win)) - mb_ptr_adv(p); + MB_PTR_ADV(p); return p; } @@ -16057,8 +8951,7 @@ spell_to_word_end(start, win) * Returns the column number of the word. */ int -spell_word_start(startcol) - int startcol; +spell_word_start(int startcol) { char_u *line; char_u *p; @@ -16071,7 +8964,7 @@ spell_word_start(startcol) line = ml_get_curline(); for (p = line + startcol; p > line; ) { - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); if (spell_iswordp_nmw(p, curwin)) break; } @@ -16080,7 +8973,7 @@ spell_word_start(startcol) while (p > line) { col = (int)(p - line); - mb_ptr_back(line, p); + MB_PTR_BACK(line, p); if (!spell_iswordp(p, curwin)) break; col = 0; @@ -16096,8 +8989,7 @@ spell_word_start(startcol) static int spell_expand_need_cap; void -spell_expand_check_cap(col) - colnr_T col; +spell_expand_check_cap(colnr_T col) { spell_expand_need_cap = check_need_cap(curwin->w_cursor.lnum, col); } @@ -16109,10 +9001,10 @@ spell_expand_check_cap(col) * allocated strings. */ int -expand_spelling(lnum, pat, matchp) - linenr_T lnum UNUSED; - char_u *pat; - char_u ***matchp; +expand_spelling( + linenr_T lnum UNUSED, + char_u *pat, + char_u ***matchp) { garray_T ga; diff --git a/src/spell.h b/src/spell.h new file mode 100644 index 0000000000..49ec0601e9 --- /dev/null +++ b/src/spell.h @@ -0,0 +1,322 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * spell.h: common code for spell checking, used by spell.c and spellfile.c. + */ + +/* Use SPELL_PRINTTREE for debugging: dump the word tree after adding a word. + * Only use it for small word lists! */ +#if 0 +# define SPELL_PRINTTREE +#endif + +/* Use SPELL_COMPRESS_ALLWAYS for debugging: compress the word tree after + * adding a word. Only use it for small word lists! */ +#if 0 +# define SPELL_COMPRESS_ALLWAYS +#endif + +/* Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk() for a + * specific word. */ +#if 0 +# define DEBUG_TRIEWALK +#endif + +#define MAXWLEN 254 /* Assume max. word len is this many bytes. + Some places assume a word length fits in a + byte, thus it can't be above 255. + Must be >= PFD_NOTSPECIAL. */ + +#define MAXREGIONS 8 /* Number of regions supported. */ + +/* Type used for indexes in the word tree need to be at least 4 bytes. If int + * is 8 bytes we could use something smaller, but what? */ +#if VIM_SIZEOF_INT > 3 +typedef int idx_T; +#else +typedef long idx_T; +#endif + +#ifdef FEAT_MBYTE +typedef int salfirst_T; +#else +typedef short salfirst_T; +#endif + +/* + * Structure used to store words and other info for one language, loaded from + * a .spl file. + * The main access is through the tree in "sl_fbyts/sl_fidxs", storing the + * case-folded words. "sl_kbyts/sl_kidxs" is for keep-case words. + * + * The "byts" array stores the possible bytes in each tree node, preceded by + * the number of possible bytes, sorted on byte value: + * <len> <byte1> <byte2> ... + * The "idxs" array stores the index of the child node corresponding to the + * byte in "byts". + * Exception: when the byte is zero, the word may end here and "idxs" holds + * the flags, region mask and affixID for the word. There may be several + * zeros in sequence for alternative flag/region/affixID combinations. + */ +typedef struct slang_S slang_T; +struct slang_S +{ + slang_T *sl_next; /* next language */ + char_u *sl_name; /* language name "en", "en.rare", "nl", etc. */ + char_u *sl_fname; /* name of .spl file */ + int sl_add; /* TRUE if it's a .add file. */ + + char_u *sl_fbyts; /* case-folded word bytes */ + idx_T *sl_fidxs; /* case-folded word indexes */ + char_u *sl_kbyts; /* keep-case word bytes */ + idx_T *sl_kidxs; /* keep-case word indexes */ + char_u *sl_pbyts; /* prefix tree word bytes */ + idx_T *sl_pidxs; /* prefix tree word indexes */ + + char_u *sl_info; /* infotext string or NULL */ + + char_u sl_regions[MAXREGIONS * 2 + 1]; + /* table with up to 8 region names plus NUL */ + + char_u *sl_midword; /* MIDWORD string or NULL */ + + hashtab_T sl_wordcount; /* hashtable with word count, wordcount_T */ + + int sl_compmax; /* COMPOUNDWORDMAX (default: MAXWLEN) */ + int sl_compminlen; /* COMPOUNDMIN (default: 0) */ + int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */ + int sl_compoptions; /* COMP_* flags */ + garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */ + regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm + * (NULL when no compounding) */ + char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */ + char_u *sl_compstartflags; /* flags for first compound word */ + char_u *sl_compallflags; /* all flags for compound words */ + char_u sl_nobreak; /* When TRUE: no spaces between words */ + char_u *sl_syllable; /* SYLLABLE repeatable chars or NULL */ + garray_T sl_syl_items; /* syllable items */ + + int sl_prefixcnt; /* number of items in "sl_prefprog" */ + regprog_T **sl_prefprog; /* table with regprogs for prefixes */ + + garray_T sl_rep; /* list of fromto_T entries from REP lines */ + short sl_rep_first[256]; /* indexes where byte first appears, -1 if + there is none */ + garray_T sl_sal; /* list of salitem_T entries from SAL lines */ + salfirst_T sl_sal_first[256]; /* indexes where byte first appears, -1 if + there is none */ + int sl_followup; /* SAL followup */ + int sl_collapse; /* SAL collapse_result */ + int sl_rem_accents; /* SAL remove_accents */ + int sl_sofo; /* SOFOFROM and SOFOTO instead of SAL items: + * "sl_sal_first" maps chars, when has_mbyte + * "sl_sal" is a list of wide char lists. */ + garray_T sl_repsal; /* list of fromto_T entries from REPSAL lines */ + short sl_repsal_first[256]; /* sl_rep_first for REPSAL lines */ + int sl_nosplitsugs; /* don't suggest splitting a word */ + int sl_nocompoundsugs; /* don't suggest compounding */ + + /* Info from the .sug file. Loaded on demand. */ + time_t sl_sugtime; /* timestamp for .sug file */ + char_u *sl_sbyts; /* soundfolded word bytes */ + idx_T *sl_sidxs; /* soundfolded word indexes */ + buf_T *sl_sugbuf; /* buffer with word number table */ + int sl_sugloaded; /* TRUE when .sug file was loaded or failed to + load */ + + int sl_has_map; /* TRUE if there is a MAP line */ +#ifdef FEAT_MBYTE + hashtab_T sl_map_hash; /* MAP for multi-byte chars */ + int sl_map_array[256]; /* MAP for first 256 chars */ +#else + char_u sl_map_array[256]; /* MAP for first 256 chars */ +#endif + hashtab_T sl_sounddone; /* table with soundfolded words that have + handled, see add_sound_suggest() */ +}; + +#ifdef VMS +# define SPL_FNAME_TMPL "%s_%s.spl" +# define SPL_FNAME_ADD "_add." +# define SPL_FNAME_ASCII "_ascii." +#else +# define SPL_FNAME_TMPL "%s.%s.spl" +# define SPL_FNAME_ADD ".add." +# define SPL_FNAME_ASCII ".ascii." +#endif + +/* Flags used for a word. Only the lowest byte can be used, the region byte + * comes above it. */ +#define WF_REGION 0x01 /* region byte follows */ +#define WF_ONECAP 0x02 /* word with one capital (or all capitals) */ +#define WF_ALLCAP 0x04 /* word must be all capitals */ +#define WF_RARE 0x08 /* rare word */ +#define WF_BANNED 0x10 /* bad word */ +#define WF_AFX 0x20 /* affix ID follows */ +#define WF_FIXCAP 0x40 /* keep-case word, allcap not allowed */ +#define WF_KEEPCAP 0x80 /* keep-case word */ + +/* for <flags2>, shifted up one byte to be used in wn_flags */ +#define WF_HAS_AFF 0x0100 /* word includes affix */ +#define WF_NEEDCOMP 0x0200 /* word only valid in compound */ +#define WF_NOSUGGEST 0x0400 /* word not to be suggested */ +#define WF_COMPROOT 0x0800 /* already compounded word, COMPOUNDROOT */ +#define WF_NOCOMPBEF 0x1000 /* no compounding before this word */ +#define WF_NOCOMPAFT 0x2000 /* no compounding after this word */ + +/* flags for <pflags> */ +#define WFP_RARE 0x01 /* rare prefix */ +#define WFP_NC 0x02 /* prefix is not combining */ +#define WFP_UP 0x04 /* to-upper prefix */ +#define WFP_COMPPERMIT 0x08 /* prefix with COMPOUNDPERMITFLAG */ +#define WFP_COMPFORBID 0x10 /* prefix with COMPOUNDFORBIDFLAG */ + +/* Flags for postponed prefixes in "sl_pidxs". Must be above affixID (one + * byte) and prefcondnr (two bytes). */ +#define WF_RAREPFX (WFP_RARE << 24) /* rare postponed prefix */ +#define WF_PFX_NC (WFP_NC << 24) /* non-combining postponed prefix */ +#define WF_PFX_UP (WFP_UP << 24) /* to-upper postponed prefix */ +#define WF_PFX_COMPPERMIT (WFP_COMPPERMIT << 24) /* postponed prefix with + * COMPOUNDPERMITFLAG */ +#define WF_PFX_COMPFORBID (WFP_COMPFORBID << 24) /* postponed prefix with + * COMPOUNDFORBIDFLAG */ + +/* flags for <compoptions> */ +#define COMP_CHECKDUP 1 /* CHECKCOMPOUNDDUP */ +#define COMP_CHECKREP 2 /* CHECKCOMPOUNDREP */ +#define COMP_CHECKCASE 4 /* CHECKCOMPOUNDCASE */ +#define COMP_CHECKTRIPLE 8 /* CHECKCOMPOUNDTRIPLE */ + +/* Info from "REP", "REPSAL" and "SAL" entries in ".aff" file used in si_rep, + * si_repsal, sl_rep, and si_sal. Not for sl_sal! + * One replacement: from "ft_from" to "ft_to". */ +typedef struct fromto_S +{ + char_u *ft_from; + char_u *ft_to; +} fromto_T; + +/* Info from "SAL" entries in ".aff" file used in sl_sal. + * The info is split for quick processing by spell_soundfold(). + * Note that "sm_oneof" and "sm_rules" point into sm_lead. */ +typedef struct salitem_S +{ + char_u *sm_lead; /* leading letters */ + int sm_leadlen; /* length of "sm_lead" */ + char_u *sm_oneof; /* letters from () or NULL */ + char_u *sm_rules; /* rules like ^, $, priority */ + char_u *sm_to; /* replacement. */ +#ifdef FEAT_MBYTE + int *sm_lead_w; /* wide character copy of "sm_lead" */ + int *sm_oneof_w; /* wide character copy of "sm_oneof" */ + int *sm_to_w; /* wide character copy of "sm_to" */ +#endif +} salitem_T; + +/* Values for SP_*ERROR are negative, positive values are used by + * read_cnt_string(). */ +#define SP_TRUNCERROR -1 /* spell file truncated error */ +#define SP_FORMERROR -2 /* format error in spell file */ +#define SP_OTHERERROR -3 /* other error while reading spell file */ + +/* + * Structure used in "b_langp", filled from 'spelllang'. + */ +typedef struct langp_S +{ + slang_T *lp_slang; /* info for this language */ + slang_T *lp_sallang; /* language used for sound folding or NULL */ + slang_T *lp_replang; /* language used for REP items or NULL */ + int lp_region; /* bitmask for region or REGION_ALL */ +} langp_T; + +#define LANGP_ENTRY(ga, i) (((langp_T *)(ga).ga_data) + (i)) + +#define VIMSUGMAGIC "VIMsug" /* string at start of Vim .sug file */ +#define VIMSUGMAGICL 6 +#define VIMSUGVERSION 1 + +/* + * The tables used for recognizing word characters according to spelling. + * These are only used for the first 256 characters of 'encoding'. + */ +typedef struct spelltab_S +{ + char_u st_isw[256]; /* flags: is word char */ + char_u st_isu[256]; /* flags: is uppercase char */ + char_u st_fold[256]; /* chars: folded case */ + char_u st_upper[256]; /* chars: upper case */ +} spelltab_T; + +/* + * Use our own character-case definitions, because the current locale may + * differ from what the .spl file uses. + * These must not be called with negative number! + */ +#ifndef FEAT_MBYTE +/* Non-multi-byte implementation. */ +# define SPELL_TOFOLD(c) ((c) < 256 ? (int)spelltab.st_fold[c] : (c)) +# define SPELL_TOUPPER(c) ((c) < 256 ? (int)spelltab.st_upper[c] : (c)) +# define SPELL_ISUPPER(c) ((c) < 256 ? spelltab.st_isu[c] : FALSE) +#else +# if defined(HAVE_WCHAR_H) +# include <wchar.h> /* for towupper() and towlower() */ +# endif +/* Multi-byte implementation. For Unicode we can call utf_*(), but don't do + * that for ASCII, because we don't want to use 'casemap' here. Otherwise use + * the "w" library function for characters above 255 if available. */ +# ifdef HAVE_TOWLOWER +# define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \ + : (c) < 256 ? (int)spelltab.st_fold[c] : (int)towlower(c)) +# else +# define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \ + : (c) < 256 ? (int)spelltab.st_fold[c] : (c)) +# endif + +# ifdef HAVE_TOWUPPER +# define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \ + : (c) < 256 ? (int)spelltab.st_upper[c] : (int)towupper(c)) +# else +# define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \ + : (c) < 256 ? (int)spelltab.st_upper[c] : (c)) +# endif + +# ifdef HAVE_ISWUPPER +# define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \ + : (c) < 256 ? spelltab.st_isu[c] : iswupper(c)) +# else +# define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \ + : (c) < 256 ? spelltab.st_isu[c] : (FALSE)) +# endif +#endif + +#ifdef FEAT_SPELL +/* First language that is loaded, start of the linked list of loaded + * languages. */ +# ifdef IN_SPELL_C +# define SPELL_EXTERN +# define SPELL_INIT(x) x +# else +# define SPELL_EXTERN extern +# define SPELL_INIT(x) +# endif + +SPELL_EXTERN slang_T *first_lang SPELL_INIT(= NULL); + +/* file used for "zG" and "zW" */ +SPELL_EXTERN char_u *int_wordlist SPELL_INIT(= NULL); + + +SPELL_EXTERN char e_format[] SPELL_INIT(= N_("E759: Format error in spell file")); + +SPELL_EXTERN spelltab_T spelltab; +SPELL_EXTERN int did_set_spelltab; + +#endif diff --git a/src/spellfile.c b/src/spellfile.c new file mode 100644 index 0000000000..496e07f8f6 --- /dev/null +++ b/src/spellfile.c @@ -0,0 +1,6752 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * spellfile.c: code for reading and writing spell files. + * + * See spell.c for information about spell checking. + */ + +/* + * Vim spell file format: <HEADER> + * <SECTIONS> + * <LWORDTREE> + * <KWORDTREE> + * <PREFIXTREE> + * + * <HEADER>: <fileID> <versionnr> + * + * <fileID> 8 bytes "VIMspell" + * <versionnr> 1 byte VIMSPELLVERSION + * + * + * Sections make it possible to add information to the .spl file without + * making it incompatible with previous versions. There are two kinds of + * sections: + * 1. Not essential for correct spell checking. E.g. for making suggestions. + * These are skipped when not supported. + * 2. Optional information, but essential for spell checking when present. + * E.g. conditions for affixes. When this section is present but not + * supported an error message is given. + * + * <SECTIONS>: <section> ... <sectionend> + * + * <section>: <sectionID> <sectionflags> <sectionlen> (section contents) + * + * <sectionID> 1 byte number from 0 to 254 identifying the section + * + * <sectionflags> 1 byte SNF_REQUIRED: this section is required for correct + * spell checking + * + * <sectionlen> 4 bytes length of section contents, MSB first + * + * <sectionend> 1 byte SN_END + * + * + * sectionID == SN_INFO: <infotext> + * <infotext> N bytes free format text with spell file info (version, + * website, etc) + * + * sectionID == SN_REGION: <regionname> ... + * <regionname> 2 bytes Up to MAXREGIONS region names: ca, au, etc. Lower + * case. First <regionname> is region 1. + * + * sectionID == SN_CHARFLAGS: <charflagslen> <charflags> + * <folcharslen> <folchars> + * <charflagslen> 1 byte Number of bytes in <charflags> (should be 128). + * <charflags> N bytes List of flags (first one is for character 128): + * 0x01 word character CF_WORD + * 0x02 upper-case character CF_UPPER + * <folcharslen> 2 bytes Number of bytes in <folchars>. + * <folchars> N bytes Folded characters, first one is for character 128. + * + * sectionID == SN_MIDWORD: <midword> + * <midword> N bytes Characters that are word characters only when used + * in the middle of a word. + * + * sectionID == SN_PREFCOND: <prefcondcnt> <prefcond> ... + * <prefcondcnt> 2 bytes Number of <prefcond> items following. + * <prefcond> : <condlen> <condstr> + * <condlen> 1 byte Length of <condstr>. + * <condstr> N bytes Condition for the prefix. + * + * sectionID == SN_REP: <repcount> <rep> ... + * <repcount> 2 bytes number of <rep> items, MSB first. + * <rep> : <repfromlen> <repfrom> <reptolen> <repto> + * <repfromlen> 1 byte length of <repfrom> + * <repfrom> N bytes "from" part of replacement + * <reptolen> 1 byte length of <repto> + * <repto> N bytes "to" part of replacement + * + * sectionID == SN_REPSAL: <repcount> <rep> ... + * just like SN_REP but for soundfolded words + * + * sectionID == SN_SAL: <salflags> <salcount> <sal> ... + * <salflags> 1 byte flags for soundsalike conversion: + * SAL_F0LLOWUP + * SAL_COLLAPSE + * SAL_REM_ACCENTS + * <salcount> 2 bytes number of <sal> items following + * <sal> : <salfromlen> <salfrom> <saltolen> <salto> + * <salfromlen> 1 byte length of <salfrom> + * <salfrom> N bytes "from" part of soundsalike + * <saltolen> 1 byte length of <salto> + * <salto> N bytes "to" part of soundsalike + * + * sectionID == SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> + * <sofofromlen> 2 bytes length of <sofofrom> + * <sofofrom> N bytes "from" part of soundfold + * <sofotolen> 2 bytes length of <sofoto> + * <sofoto> N bytes "to" part of soundfold + * + * sectionID == SN_SUGFILE: <timestamp> + * <timestamp> 8 bytes time in seconds that must match with .sug file + * + * sectionID == SN_NOSPLITSUGS: nothing + * + * sectionID == SN_NOCOMPOUNDSUGS: nothing + * + * sectionID == SN_WORDS: <word> ... + * <word> N bytes NUL terminated common word + * + * sectionID == SN_MAP: <mapstr> + * <mapstr> N bytes String with sequences of similar characters, + * separated by slashes. + * + * sectionID == SN_COMPOUND: <compmax> <compminlen> <compsylmax> <compoptions> + * <comppatcount> <comppattern> ... <compflags> + * <compmax> 1 byte Maximum nr of words in compound word. + * <compminlen> 1 byte Minimal word length for compounding. + * <compsylmax> 1 byte Maximum nr of syllables in compound word. + * <compoptions> 2 bytes COMP_ flags. + * <comppatcount> 2 bytes number of <comppattern> following + * <compflags> N bytes Flags from COMPOUNDRULE items, separated by + * slashes. + * + * <comppattern>: <comppatlen> <comppattext> + * <comppatlen> 1 byte length of <comppattext> + * <comppattext> N bytes end or begin chars from CHECKCOMPOUNDPATTERN + * + * sectionID == SN_NOBREAK: (empty, its presence is what matters) + * + * sectionID == SN_SYLLABLE: <syllable> + * <syllable> N bytes String from SYLLABLE item. + * + * <LWORDTREE>: <wordtree> + * + * <KWORDTREE>: <wordtree> + * + * <PREFIXTREE>: <wordtree> + * + * + * <wordtree>: <nodecount> <nodedata> ... + * + * <nodecount> 4 bytes Number of nodes following. MSB first. + * + * <nodedata>: <siblingcount> <sibling> ... + * + * <siblingcount> 1 byte Number of siblings in this node. The siblings + * follow in sorted order. + * + * <sibling>: <byte> [ <nodeidx> <xbyte> + * | <flags> [<flags2>] [<region>] [<affixID>] + * | [<pflags>] <affixID> <prefcondnr> ] + * + * <byte> 1 byte Byte value of the sibling. Special cases: + * BY_NOFLAGS: End of word without flags and for all + * regions. + * For PREFIXTREE <affixID> and + * <prefcondnr> follow. + * BY_FLAGS: End of word, <flags> follow. + * For PREFIXTREE <pflags>, <affixID> + * and <prefcondnr> follow. + * BY_FLAGS2: End of word, <flags> and <flags2> + * follow. Not used in PREFIXTREE. + * BY_INDEX: Child of sibling is shared, <nodeidx> + * and <xbyte> follow. + * + * <nodeidx> 3 bytes Index of child for this sibling, MSB first. + * + * <xbyte> 1 byte byte value of the sibling. + * + * <flags> 1 byte bitmask of: + * WF_ALLCAP word must have only capitals + * WF_ONECAP first char of word must be capital + * WF_KEEPCAP keep-case word + * WF_FIXCAP keep-case word, all caps not allowed + * WF_RARE rare word + * WF_BANNED bad word + * WF_REGION <region> follows + * WF_AFX <affixID> follows + * + * <flags2> 1 byte Bitmask of: + * WF_HAS_AFF >> 8 word includes affix + * WF_NEEDCOMP >> 8 word only valid in compound + * WF_NOSUGGEST >> 8 word not used for suggestions + * WF_COMPROOT >> 8 word already a compound + * WF_NOCOMPBEF >> 8 no compounding before this word + * WF_NOCOMPAFT >> 8 no compounding after this word + * + * <pflags> 1 byte bitmask of: + * WFP_RARE rare prefix + * WFP_NC non-combining prefix + * WFP_UP letter after prefix made upper case + * + * <region> 1 byte Bitmask for regions in which word is valid. When + * omitted it's valid in all regions. + * Lowest bit is for region 1. + * + * <affixID> 1 byte ID of affix that can be used with this word. In + * PREFIXTREE used for the required prefix ID. + * + * <prefcondnr> 2 bytes Prefix condition number, index in <prefcond> list + * from HEADER. + * + * All text characters are in 'encoding', but stored as single bytes. + */ + +/* + * Vim .sug file format: <SUGHEADER> + * <SUGWORDTREE> + * <SUGTABLE> + * + * <SUGHEADER>: <fileID> <versionnr> <timestamp> + * + * <fileID> 6 bytes "VIMsug" + * <versionnr> 1 byte VIMSUGVERSION + * <timestamp> 8 bytes timestamp that must match with .spl file + * + * + * <SUGWORDTREE>: <wordtree> (see above, no flags or region used) + * + * + * <SUGTABLE>: <sugwcount> <sugline> ... + * + * <sugwcount> 4 bytes number of <sugline> following + * + * <sugline>: <sugnr> ... NUL + * + * <sugnr>: X bytes word number that results in this soundfolded word, + * stored as an offset to the previous number in as + * few bytes as possible, see offset2bytes()) + */ + +#include "vim.h" + +#if defined(FEAT_SPELL) || defined(PROTO) + +#ifndef UNIX /* it's in os_unix.h for Unix */ +# include <time.h> /* for time_t */ +#endif + +#ifndef UNIX /* it's in os_unix.h for Unix */ +# include <time.h> /* for time_t */ +#endif + +/* Special byte values for <byte>. Some are only used in the tree for + * postponed prefixes, some only in the other trees. This is a bit messy... */ +#define BY_NOFLAGS 0 /* end of word without flags or region; for + * postponed prefix: no <pflags> */ +#define BY_INDEX 1 /* child is shared, index follows */ +#define BY_FLAGS 2 /* end of word, <flags> byte follows; for + * postponed prefix: <pflags> follows */ +#define BY_FLAGS2 3 /* end of word, <flags> and <flags2> bytes + * follow; never used in prefix tree */ +#define BY_SPECIAL BY_FLAGS2 /* highest special byte value */ + +/* Flags used in .spl file for soundsalike flags. */ +#define SAL_F0LLOWUP 1 +#define SAL_COLLAPSE 2 +#define SAL_REM_ACCENTS 4 + +#define VIMSPELLMAGIC "VIMspell" /* string at start of Vim spell file */ +#define VIMSPELLMAGICL 8 +#define VIMSPELLVERSION 50 + +/* Section IDs. Only renumber them when VIMSPELLVERSION changes! */ +#define SN_REGION 0 /* <regionname> section */ +#define SN_CHARFLAGS 1 /* charflags section */ +#define SN_MIDWORD 2 /* <midword> section */ +#define SN_PREFCOND 3 /* <prefcond> section */ +#define SN_REP 4 /* REP items section */ +#define SN_SAL 5 /* SAL items section */ +#define SN_SOFO 6 /* soundfolding section */ +#define SN_MAP 7 /* MAP items section */ +#define SN_COMPOUND 8 /* compound words section */ +#define SN_SYLLABLE 9 /* syllable section */ +#define SN_NOBREAK 10 /* NOBREAK section */ +#define SN_SUGFILE 11 /* timestamp for .sug file */ +#define SN_REPSAL 12 /* REPSAL items section */ +#define SN_WORDS 13 /* common words */ +#define SN_NOSPLITSUGS 14 /* don't split word for suggestions */ +#define SN_INFO 15 /* info section */ +#define SN_NOCOMPOUNDSUGS 16 /* don't compound for suggestions */ +#define SN_END 255 /* end of sections */ + +#define SNF_REQUIRED 1 /* <sectionflags>: required section */ + +#define CF_WORD 0x01 +#define CF_UPPER 0x02 + +static int set_spell_finish(spelltab_T *new_st); +static int write_spell_prefcond(FILE *fd, garray_T *gap); +static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *lenp); +static int read_region_section(FILE *fd, slang_T *slang, int len); +static int read_charflags_section(FILE *fd); +static int read_prefcond_section(FILE *fd, slang_T *lp); +static int read_rep_section(FILE *fd, garray_T *gap, short *first); +static int read_sal_section(FILE *fd, slang_T *slang); +static int read_words_section(FILE *fd, slang_T *lp, int len); +static int read_sofo_section(FILE *fd, slang_T *slang); +static int read_compound(FILE *fd, slang_T *slang, int len); +static int set_sofo(slang_T *lp, char_u *from, char_u *to); +static void set_sal_first(slang_T *lp); +#ifdef FEAT_MBYTE +static int *mb_str2wide(char_u *s); +#endif +static int spell_read_tree(FILE *fd, char_u **bytsp, idx_T **idxsp, int prefixtree, int prefixcnt); +static idx_T read_tree_node(FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx_T startidx, int prefixtree, int maxprefcondnr); +static void spell_reload_one(char_u *fname, int added_word); +static void set_spell_charflags(char_u *flags, int cnt, char_u *upp); +static int set_spell_chartab(char_u *fol, char_u *low, char_u *upp); +static void set_map_str(slang_T *lp, char_u *map); + + +static char *e_spell_trunc = N_("E758: Truncated spell file"); +static char *e_afftrailing = N_("Trailing text in %s line %d: %s"); +static char *e_affname = N_("Affix name too long in %s line %d: %s"); +static char *e_affform = N_("E761: Format error in affix file FOL, LOW or UPP"); +static char *e_affrange = N_("E762: Character in FOL, LOW or UPP is out of range"); +static char *msg_compressing = N_("Compressing word tree..."); + +/* + * Load one spell file and store the info into a slang_T. + * + * This is invoked in three ways: + * - From spell_load_cb() to load a spell file for the first time. "lang" is + * the language name, "old_lp" is NULL. Will allocate an slang_T. + * - To reload a spell file that was changed. "lang" is NULL and "old_lp" + * points to the existing slang_T. + * - Just after writing a .spl file; it's read back to produce the .sug file. + * "old_lp" is NULL and "lang" is NULL. Will allocate an slang_T. + * + * Returns the slang_T the spell file was loaded into. NULL for error. + */ + slang_T * +spell_load_file( + char_u *fname, + char_u *lang, + slang_T *old_lp, + int silent) /* no error if file doesn't exist */ +{ + FILE *fd; + char_u buf[VIMSPELLMAGICL]; + char_u *p; + int i; + int n; + int len; + char_u *save_sourcing_name = sourcing_name; + linenr_T save_sourcing_lnum = sourcing_lnum; + slang_T *lp = NULL; + int c = 0; + int res; + + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + { + if (!silent) + EMSG2(_(e_notopen), fname); + else if (p_verbose > 2) + { + verbose_enter(); + smsg((char_u *)e_notopen, fname); + verbose_leave(); + } + goto endFAIL; + } + if (p_verbose > 2) + { + verbose_enter(); + smsg((char_u *)_("Reading spell file \"%s\""), fname); + verbose_leave(); + } + + if (old_lp == NULL) + { + lp = slang_alloc(lang); + if (lp == NULL) + goto endFAIL; + + /* Remember the file name, used to reload the file when it's updated. */ + lp->sl_fname = vim_strsave(fname); + if (lp->sl_fname == NULL) + goto endFAIL; + + /* Check for .add.spl (_add.spl for VMS). */ + lp->sl_add = strstr((char *)gettail(fname), SPL_FNAME_ADD) != NULL; + } + else + lp = old_lp; + + /* Set sourcing_name, so that error messages mention the file name. */ + sourcing_name = fname; + sourcing_lnum = 0; + + /* + * <HEADER>: <fileID> + */ + for (i = 0; i < VIMSPELLMAGICL; ++i) + buf[i] = getc(fd); /* <fileID> */ + if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) + { + EMSG(_("E757: This does not look like a spell file")); + goto endFAIL; + } + c = getc(fd); /* <versionnr> */ + if (c < VIMSPELLVERSION) + { + EMSG(_("E771: Old spell file, needs to be updated")); + goto endFAIL; + } + else if (c > VIMSPELLVERSION) + { + EMSG(_("E772: Spell file is for newer version of Vim")); + goto endFAIL; + } + + + /* + * <SECTIONS>: <section> ... <sectionend> + * <section>: <sectionID> <sectionflags> <sectionlen> (section contents) + */ + for (;;) + { + n = getc(fd); /* <sectionID> or <sectionend> */ + if (n == SN_END) + break; + c = getc(fd); /* <sectionflags> */ + len = get4c(fd); /* <sectionlen> */ + if (len < 0) + goto truncerr; + + res = 0; + switch (n) + { + case SN_INFO: + lp->sl_info = read_string(fd, len); /* <infotext> */ + if (lp->sl_info == NULL) + goto endFAIL; + break; + + case SN_REGION: + res = read_region_section(fd, lp, len); + break; + + case SN_CHARFLAGS: + res = read_charflags_section(fd); + break; + + case SN_MIDWORD: + lp->sl_midword = read_string(fd, len); /* <midword> */ + if (lp->sl_midword == NULL) + goto endFAIL; + break; + + case SN_PREFCOND: + res = read_prefcond_section(fd, lp); + break; + + case SN_REP: + res = read_rep_section(fd, &lp->sl_rep, lp->sl_rep_first); + break; + + case SN_REPSAL: + res = read_rep_section(fd, &lp->sl_repsal, lp->sl_repsal_first); + break; + + case SN_SAL: + res = read_sal_section(fd, lp); + break; + + case SN_SOFO: + res = read_sofo_section(fd, lp); + break; + + case SN_MAP: + p = read_string(fd, len); /* <mapstr> */ + if (p == NULL) + goto endFAIL; + set_map_str(lp, p); + vim_free(p); + break; + + case SN_WORDS: + res = read_words_section(fd, lp, len); + break; + + case SN_SUGFILE: + lp->sl_sugtime = get8ctime(fd); /* <timestamp> */ + break; + + case SN_NOSPLITSUGS: + lp->sl_nosplitsugs = TRUE; + break; + + case SN_NOCOMPOUNDSUGS: + lp->sl_nocompoundsugs = TRUE; + break; + + case SN_COMPOUND: + res = read_compound(fd, lp, len); + break; + + case SN_NOBREAK: + lp->sl_nobreak = TRUE; + break; + + case SN_SYLLABLE: + lp->sl_syllable = read_string(fd, len); /* <syllable> */ + if (lp->sl_syllable == NULL) + goto endFAIL; + if (init_syl_tab(lp) == FAIL) + goto endFAIL; + break; + + default: + /* Unsupported section. When it's required give an error + * message. When it's not required skip the contents. */ + if (c & SNF_REQUIRED) + { + EMSG(_("E770: Unsupported section in spell file")); + goto endFAIL; + } + while (--len >= 0) + if (getc(fd) < 0) + goto truncerr; + break; + } +someerror: + if (res == SP_FORMERROR) + { + EMSG(_(e_format)); + goto endFAIL; + } + if (res == SP_TRUNCERROR) + { +truncerr: + EMSG(_(e_spell_trunc)); + goto endFAIL; + } + if (res == SP_OTHERERROR) + goto endFAIL; + } + + /* <LWORDTREE> */ + res = spell_read_tree(fd, &lp->sl_fbyts, &lp->sl_fidxs, FALSE, 0); + if (res != 0) + goto someerror; + + /* <KWORDTREE> */ + res = spell_read_tree(fd, &lp->sl_kbyts, &lp->sl_kidxs, FALSE, 0); + if (res != 0) + goto someerror; + + /* <PREFIXTREE> */ + res = spell_read_tree(fd, &lp->sl_pbyts, &lp->sl_pidxs, TRUE, + lp->sl_prefixcnt); + if (res != 0) + goto someerror; + + /* For a new file link it in the list of spell files. */ + if (old_lp == NULL && lang != NULL) + { + lp->sl_next = first_lang; + first_lang = lp; + } + + goto endOK; + +endFAIL: + if (lang != NULL) + /* truncating the name signals the error to spell_load_lang() */ + *lang = NUL; + if (lp != NULL && old_lp == NULL) + slang_free(lp); + lp = NULL; + +endOK: + if (fd != NULL) + fclose(fd); + sourcing_name = save_sourcing_name; + sourcing_lnum = save_sourcing_lnum; + + return lp; +} + +/* + * Fill in the wordcount fields for a trie. + * Returns the total number of words. + */ + static void +tree_count_words(char_u *byts, idx_T *idxs) +{ + int depth; + idx_T arridx[MAXWLEN]; + int curi[MAXWLEN]; + int c; + idx_T n; + int wordcount[MAXWLEN]; + + arridx[0] = 0; + curi[0] = 1; + wordcount[0] = 0; + depth = 0; + while (depth >= 0 && !got_int) + { + if (curi[depth] > byts[arridx[depth]]) + { + /* Done all bytes at this node, go up one level. */ + idxs[arridx[depth]] = wordcount[depth]; + if (depth > 0) + wordcount[depth - 1] += wordcount[depth]; + + --depth; + fast_breakcheck(); + } + else + { + /* Do one more byte at this node. */ + n = arridx[depth] + curi[depth]; + ++curi[depth]; + + c = byts[n]; + if (c == 0) + { + /* End of word, count it. */ + ++wordcount[depth]; + + /* Skip over any other NUL bytes (same word with different + * flags). */ + while (byts[n + 1] == 0) + { + ++n; + ++curi[depth]; + } + } + else + { + /* Normal char, go one level deeper to count the words. */ + ++depth; + arridx[depth] = idxs[n]; + curi[depth] = 1; + wordcount[depth] = 0; + } + } + } +} + +/* + * Load the .sug files for languages that have one and weren't loaded yet. + */ + void +suggest_load_files(void) +{ + langp_T *lp; + int lpi; + slang_T *slang; + char_u *dotp; + FILE *fd; + char_u buf[MAXWLEN]; + int i; + time_t timestamp; + int wcount; + int wordnr; + garray_T ga; + int c; + + /* Do this for all languages that support sound folding. */ + for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) + { + lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); + slang = lp->lp_slang; + if (slang->sl_sugtime != 0 && !slang->sl_sugloaded) + { + /* Change ".spl" to ".sug" and open the file. When the file isn't + * found silently skip it. Do set "sl_sugloaded" so that we + * don't try again and again. */ + slang->sl_sugloaded = TRUE; + + dotp = vim_strrchr(slang->sl_fname, '.'); + if (dotp == NULL || fnamecmp(dotp, ".spl") != 0) + continue; + STRCPY(dotp, ".sug"); + fd = mch_fopen((char *)slang->sl_fname, "r"); + if (fd == NULL) + goto nextone; + + /* + * <SUGHEADER>: <fileID> <versionnr> <timestamp> + */ + for (i = 0; i < VIMSUGMAGICL; ++i) + buf[i] = getc(fd); /* <fileID> */ + if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) + { + EMSG2(_("E778: This does not look like a .sug file: %s"), + slang->sl_fname); + goto nextone; + } + c = getc(fd); /* <versionnr> */ + if (c < VIMSUGVERSION) + { + EMSG2(_("E779: Old .sug file, needs to be updated: %s"), + slang->sl_fname); + goto nextone; + } + else if (c > VIMSUGVERSION) + { + EMSG2(_("E780: .sug file is for newer version of Vim: %s"), + slang->sl_fname); + goto nextone; + } + + /* Check the timestamp, it must be exactly the same as the one in + * the .spl file. Otherwise the word numbers won't match. */ + timestamp = get8ctime(fd); /* <timestamp> */ + if (timestamp != slang->sl_sugtime) + { + EMSG2(_("E781: .sug file doesn't match .spl file: %s"), + slang->sl_fname); + goto nextone; + } + + /* + * <SUGWORDTREE>: <wordtree> + * Read the trie with the soundfolded words. + */ + if (spell_read_tree(fd, &slang->sl_sbyts, &slang->sl_sidxs, + FALSE, 0) != 0) + { +someerror: + EMSG2(_("E782: error while reading .sug file: %s"), + slang->sl_fname); + slang_clear_sug(slang); + goto nextone; + } + + /* + * <SUGTABLE>: <sugwcount> <sugline> ... + * + * Read the table with word numbers. We use a file buffer for + * this, because it's so much like a file with lines. Makes it + * possible to swap the info and save on memory use. + */ + slang->sl_sugbuf = open_spellbuf(); + if (slang->sl_sugbuf == NULL) + goto someerror; + /* <sugwcount> */ + wcount = get4c(fd); + if (wcount < 0) + goto someerror; + + /* Read all the wordnr lists into the buffer, one NUL terminated + * list per line. */ + ga_init2(&ga, 1, 100); + for (wordnr = 0; wordnr < wcount; ++wordnr) + { + ga.ga_len = 0; + for (;;) + { + c = getc(fd); /* <sugline> */ + if (c < 0 || ga_grow(&ga, 1) == FAIL) + goto someerror; + ((char_u *)ga.ga_data)[ga.ga_len++] = c; + if (c == NUL) + break; + } + if (ml_append_buf(slang->sl_sugbuf, (linenr_T)wordnr, + ga.ga_data, ga.ga_len, TRUE) == FAIL) + goto someerror; + } + ga_clear(&ga); + + /* + * Need to put word counts in the word tries, so that we can find + * a word by its number. + */ + tree_count_words(slang->sl_fbyts, slang->sl_fidxs); + tree_count_words(slang->sl_sbyts, slang->sl_sidxs); + +nextone: + if (fd != NULL) + fclose(fd); + STRCPY(dotp, ".spl"); + } + } +} + + +/* + * Read a length field from "fd" in "cnt_bytes" bytes. + * Allocate memory, read the string into it and add a NUL at the end. + * Returns NULL when the count is zero. + * Sets "*cntp" to SP_*ERROR when there is an error, length of the result + * otherwise. + */ + static char_u * +read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) +{ + int cnt = 0; + int i; + char_u *str; + + /* read the length bytes, MSB first */ + for (i = 0; i < cnt_bytes; ++i) + cnt = (cnt << 8) + getc(fd); + if (cnt < 0) + { + *cntp = SP_TRUNCERROR; + return NULL; + } + *cntp = cnt; + if (cnt == 0) + return NULL; /* nothing to read, return NULL */ + + str = read_string(fd, cnt); + if (str == NULL) + *cntp = SP_OTHERERROR; + return str; +} + +/* + * Read SN_REGION: <regionname> ... + * Return SP_*ERROR flags. + */ + static int +read_region_section(FILE *fd, slang_T *lp, int len) +{ + int i; + + if (len > MAXREGIONS * 2) + return SP_FORMERROR; + for (i = 0; i < len; ++i) + lp->sl_regions[i] = getc(fd); /* <regionname> */ + lp->sl_regions[len] = NUL; + return 0; +} + +/* + * Read SN_CHARFLAGS section: <charflagslen> <charflags> + * <folcharslen> <folchars> + * Return SP_*ERROR flags. + */ + static int +read_charflags_section(FILE *fd) +{ + char_u *flags; + char_u *fol; + int flagslen, follen; + + /* <charflagslen> <charflags> */ + flags = read_cnt_string(fd, 1, &flagslen); + if (flagslen < 0) + return flagslen; + + /* <folcharslen> <folchars> */ + fol = read_cnt_string(fd, 2, &follen); + if (follen < 0) + { + vim_free(flags); + return follen; + } + + /* Set the word-char flags and fill SPELL_ISUPPER() table. */ + if (flags != NULL && fol != NULL) + set_spell_charflags(flags, flagslen, fol); + + vim_free(flags); + vim_free(fol); + + /* When <charflagslen> is zero then <fcharlen> must also be zero. */ + if ((flags == NULL) != (fol == NULL)) + return SP_FORMERROR; + return 0; +} + +/* + * Read SN_PREFCOND section. + * Return SP_*ERROR flags. + */ + static int +read_prefcond_section(FILE *fd, slang_T *lp) +{ + int cnt; + int i; + int n; + char_u *p; + char_u buf[MAXWLEN + 1]; + + /* <prefcondcnt> <prefcond> ... */ + cnt = get2c(fd); /* <prefcondcnt> */ + if (cnt <= 0) + return SP_FORMERROR; + + lp->sl_prefprog = (regprog_T **)alloc_clear( + (unsigned)sizeof(regprog_T *) * cnt); + if (lp->sl_prefprog == NULL) + return SP_OTHERERROR; + lp->sl_prefixcnt = cnt; + + for (i = 0; i < cnt; ++i) + { + /* <prefcond> : <condlen> <condstr> */ + n = getc(fd); /* <condlen> */ + if (n < 0 || n >= MAXWLEN) + return SP_FORMERROR; + + /* When <condlen> is zero we have an empty condition. Otherwise + * compile the regexp program used to check for the condition. */ + if (n > 0) + { + buf[0] = '^'; /* always match at one position only */ + p = buf + 1; + while (n-- > 0) + *p++ = getc(fd); /* <condstr> */ + *p = NUL; + lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING); + } + } + return 0; +} + +/* + * Read REP or REPSAL items section from "fd": <repcount> <rep> ... + * Return SP_*ERROR flags. + */ + static int +read_rep_section(FILE *fd, garray_T *gap, short *first) +{ + int cnt; + fromto_T *ftp; + int i; + + cnt = get2c(fd); /* <repcount> */ + if (cnt < 0) + return SP_TRUNCERROR; + + if (ga_grow(gap, cnt) == FAIL) + return SP_OTHERERROR; + + /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */ + for (; gap->ga_len < cnt; ++gap->ga_len) + { + ftp = &((fromto_T *)gap->ga_data)[gap->ga_len]; + ftp->ft_from = read_cnt_string(fd, 1, &i); + if (i < 0) + return i; + if (i == 0) + return SP_FORMERROR; + ftp->ft_to = read_cnt_string(fd, 1, &i); + if (i <= 0) + { + vim_free(ftp->ft_from); + if (i < 0) + return i; + return SP_FORMERROR; + } + } + + /* Fill the first-index table. */ + for (i = 0; i < 256; ++i) + first[i] = -1; + for (i = 0; i < gap->ga_len; ++i) + { + ftp = &((fromto_T *)gap->ga_data)[i]; + if (first[*ftp->ft_from] == -1) + first[*ftp->ft_from] = i; + } + return 0; +} + +/* + * Read SN_SAL section: <salflags> <salcount> <sal> ... + * Return SP_*ERROR flags. + */ + static int +read_sal_section(FILE *fd, slang_T *slang) +{ + int i; + int cnt; + garray_T *gap; + salitem_T *smp; + int ccnt; + char_u *p; + int c = NUL; + + slang->sl_sofo = FALSE; + + i = getc(fd); /* <salflags> */ + if (i & SAL_F0LLOWUP) + slang->sl_followup = TRUE; + if (i & SAL_COLLAPSE) + slang->sl_collapse = TRUE; + if (i & SAL_REM_ACCENTS) + slang->sl_rem_accents = TRUE; + + cnt = get2c(fd); /* <salcount> */ + if (cnt < 0) + return SP_TRUNCERROR; + + gap = &slang->sl_sal; + ga_init2(gap, sizeof(salitem_T), 10); + if (ga_grow(gap, cnt + 1) == FAIL) + return SP_OTHERERROR; + + /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */ + for (; gap->ga_len < cnt; ++gap->ga_len) + { + smp = &((salitem_T *)gap->ga_data)[gap->ga_len]; + ccnt = getc(fd); /* <salfromlen> */ + if (ccnt < 0) + return SP_TRUNCERROR; + if ((p = alloc(ccnt + 2)) == NULL) + return SP_OTHERERROR; + smp->sm_lead = p; + + /* Read up to the first special char into sm_lead. */ + for (i = 0; i < ccnt; ++i) + { + c = getc(fd); /* <salfrom> */ + if (vim_strchr((char_u *)"0123456789(-<^$", c) != NULL) + break; + *p++ = c; + } + smp->sm_leadlen = (int)(p - smp->sm_lead); + *p++ = NUL; + + /* Put (abc) chars in sm_oneof, if any. */ + if (c == '(') + { + smp->sm_oneof = p; + for (++i; i < ccnt; ++i) + { + c = getc(fd); /* <salfrom> */ + if (c == ')') + break; + *p++ = c; + } + *p++ = NUL; + if (++i < ccnt) + c = getc(fd); + } + else + smp->sm_oneof = NULL; + + /* Any following chars go in sm_rules. */ + smp->sm_rules = p; + if (i < ccnt) + /* store the char we got while checking for end of sm_lead */ + *p++ = c; + for (++i; i < ccnt; ++i) + *p++ = getc(fd); /* <salfrom> */ + *p++ = NUL; + + /* <saltolen> <salto> */ + smp->sm_to = read_cnt_string(fd, 1, &ccnt); + if (ccnt < 0) + { + vim_free(smp->sm_lead); + return ccnt; + } + +#ifdef FEAT_MBYTE + if (has_mbyte) + { + /* convert the multi-byte strings to wide char strings */ + smp->sm_lead_w = mb_str2wide(smp->sm_lead); + smp->sm_leadlen = mb_charlen(smp->sm_lead); + if (smp->sm_oneof == NULL) + smp->sm_oneof_w = NULL; + else + smp->sm_oneof_w = mb_str2wide(smp->sm_oneof); + if (smp->sm_to == NULL) + smp->sm_to_w = NULL; + else + smp->sm_to_w = mb_str2wide(smp->sm_to); + if (smp->sm_lead_w == NULL + || (smp->sm_oneof_w == NULL && smp->sm_oneof != NULL) + || (smp->sm_to_w == NULL && smp->sm_to != NULL)) + { + vim_free(smp->sm_lead); + vim_free(smp->sm_to); + vim_free(smp->sm_lead_w); + vim_free(smp->sm_oneof_w); + vim_free(smp->sm_to_w); + return SP_OTHERERROR; + } + } +#endif + } + + if (gap->ga_len > 0) + { + /* Add one extra entry to mark the end with an empty sm_lead. Avoids + * that we need to check the index every time. */ + smp = &((salitem_T *)gap->ga_data)[gap->ga_len]; + if ((p = alloc(1)) == NULL) + return SP_OTHERERROR; + p[0] = NUL; + smp->sm_lead = p; + smp->sm_leadlen = 0; + smp->sm_oneof = NULL; + smp->sm_rules = p; + smp->sm_to = NULL; +#ifdef FEAT_MBYTE + if (has_mbyte) + { + smp->sm_lead_w = mb_str2wide(smp->sm_lead); + smp->sm_leadlen = 0; + smp->sm_oneof_w = NULL; + smp->sm_to_w = NULL; + } +#endif + ++gap->ga_len; + } + + /* Fill the first-index table. */ + set_sal_first(slang); + + return 0; +} + +/* + * Read SN_WORDS: <word> ... + * Return SP_*ERROR flags. + */ + static int +read_words_section(FILE *fd, slang_T *lp, int len) +{ + int done = 0; + int i; + int c; + char_u word[MAXWLEN]; + + while (done < len) + { + /* Read one word at a time. */ + for (i = 0; ; ++i) + { + c = getc(fd); + if (c == EOF) + return SP_TRUNCERROR; + word[i] = c; + if (word[i] == NUL) + break; + if (i == MAXWLEN - 1) + return SP_FORMERROR; + } + + /* Init the count to 10. */ + count_common_word(lp, word, -1, 10); + done += i + 1; + } + return 0; +} + +/* + * SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> + * Return SP_*ERROR flags. + */ + static int +read_sofo_section(FILE *fd, slang_T *slang) +{ + int cnt; + char_u *from, *to; + int res; + + slang->sl_sofo = TRUE; + + /* <sofofromlen> <sofofrom> */ + from = read_cnt_string(fd, 2, &cnt); + if (cnt < 0) + return cnt; + + /* <sofotolen> <sofoto> */ + to = read_cnt_string(fd, 2, &cnt); + if (cnt < 0) + { + vim_free(from); + return cnt; + } + + /* Store the info in slang->sl_sal and/or slang->sl_sal_first. */ + if (from != NULL && to != NULL) + res = set_sofo(slang, from, to); + else if (from != NULL || to != NULL) + res = SP_FORMERROR; /* only one of two strings is an error */ + else + res = 0; + + vim_free(from); + vim_free(to); + return res; +} + +/* + * Read the compound section from the .spl file: + * <compmax> <compminlen> <compsylmax> <compoptions> <compflags> + * Returns SP_*ERROR flags. + */ + static int +read_compound(FILE *fd, slang_T *slang, int len) +{ + int todo = len; + int c; + int atstart; + char_u *pat; + char_u *pp; + char_u *cp; + char_u *ap; + char_u *crp; + int cnt; + garray_T *gap; + + if (todo < 2) + return SP_FORMERROR; /* need at least two bytes */ + + --todo; + c = getc(fd); /* <compmax> */ + if (c < 2) + c = MAXWLEN; + slang->sl_compmax = c; + + --todo; + c = getc(fd); /* <compminlen> */ + if (c < 1) + c = 0; + slang->sl_compminlen = c; + + --todo; + c = getc(fd); /* <compsylmax> */ + if (c < 1) + c = MAXWLEN; + slang->sl_compsylmax = c; + + c = getc(fd); /* <compoptions> */ + if (c != 0) + ungetc(c, fd); /* be backwards compatible with Vim 7.0b */ + else + { + --todo; + c = getc(fd); /* only use the lower byte for now */ + --todo; + slang->sl_compoptions = c; + + gap = &slang->sl_comppat; + c = get2c(fd); /* <comppatcount> */ + todo -= 2; + ga_init2(gap, sizeof(char_u *), c); + if (ga_grow(gap, c) == OK) + while (--c >= 0) + { + ((char_u **)(gap->ga_data))[gap->ga_len++] = + read_cnt_string(fd, 1, &cnt); + /* <comppatlen> <comppattext> */ + if (cnt < 0) + return cnt; + todo -= cnt + 1; + } + } + if (todo < 0) + return SP_FORMERROR; + + /* Turn the COMPOUNDRULE items into a regexp pattern: + * "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$". + * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. + * Conversion to utf-8 may double the size. */ + c = todo * 2 + 7; +#ifdef FEAT_MBYTE + if (enc_utf8) + c += todo * 2; +#endif + pat = alloc((unsigned)c); + if (pat == NULL) + return SP_OTHERERROR; + + /* We also need a list of all flags that can appear at the start and one + * for all flags. */ + cp = alloc(todo + 1); + if (cp == NULL) + { + vim_free(pat); + return SP_OTHERERROR; + } + slang->sl_compstartflags = cp; + *cp = NUL; + + ap = alloc(todo + 1); + if (ap == NULL) + { + vim_free(pat); + return SP_OTHERERROR; + } + slang->sl_compallflags = ap; + *ap = NUL; + + /* And a list of all patterns in their original form, for checking whether + * compounding may work in match_compoundrule(). This is freed when we + * encounter a wildcard, the check doesn't work then. */ + crp = alloc(todo + 1); + slang->sl_comprules = crp; + + pp = pat; + *pp++ = '^'; + *pp++ = '\\'; + *pp++ = '('; + + atstart = 1; + while (todo-- > 0) + { + c = getc(fd); /* <compflags> */ + if (c == EOF) + { + vim_free(pat); + return SP_TRUNCERROR; + } + + /* Add all flags to "sl_compallflags". */ + if (vim_strchr((char_u *)"?*+[]/", c) == NULL + && !byte_in_str(slang->sl_compallflags, c)) + { + *ap++ = c; + *ap = NUL; + } + + if (atstart != 0) + { + /* At start of item: copy flags to "sl_compstartflags". For a + * [abc] item set "atstart" to 2 and copy up to the ']'. */ + if (c == '[') + atstart = 2; + else if (c == ']') + atstart = 0; + else + { + if (!byte_in_str(slang->sl_compstartflags, c)) + { + *cp++ = c; + *cp = NUL; + } + if (atstart == 1) + atstart = 0; + } + } + + /* Copy flag to "sl_comprules", unless we run into a wildcard. */ + if (crp != NULL) + { + if (c == '?' || c == '+' || c == '*') + { + VIM_CLEAR(slang->sl_comprules); + crp = NULL; + } + else + *crp++ = c; + } + + if (c == '/') /* slash separates two items */ + { + *pp++ = '\\'; + *pp++ = '|'; + atstart = 1; + } + else /* normal char, "[abc]" and '*' are copied as-is */ + { + if (c == '?' || c == '+' || c == '~') + *pp++ = '\\'; /* "a?" becomes "a\?", "a+" becomes "a\+" */ +#ifdef FEAT_MBYTE + if (enc_utf8) + pp += mb_char2bytes(c, pp); + else +#endif + *pp++ = c; + } + } + + *pp++ = '\\'; + *pp++ = ')'; + *pp++ = '$'; + *pp = NUL; + + if (crp != NULL) + *crp = NUL; + + slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT); + vim_free(pat); + if (slang->sl_compprog == NULL) + return SP_FORMERROR; + + return 0; +} + +/* + * Set the SOFOFROM and SOFOTO items in language "lp". + * Returns SP_*ERROR flags when there is something wrong. + */ + static int +set_sofo(slang_T *lp, char_u *from, char_u *to) +{ + int i; + +#ifdef FEAT_MBYTE + garray_T *gap; + char_u *s; + char_u *p; + int c; + int *inp; + + if (has_mbyte) + { + /* Use "sl_sal" as an array with 256 pointers to a list of wide + * characters. The index is the low byte of the character. + * The list contains from-to pairs with a terminating NUL. + * sl_sal_first[] is used for latin1 "from" characters. */ + gap = &lp->sl_sal; + ga_init2(gap, sizeof(int *), 1); + if (ga_grow(gap, 256) == FAIL) + return SP_OTHERERROR; + vim_memset(gap->ga_data, 0, sizeof(int *) * 256); + gap->ga_len = 256; + + /* First count the number of items for each list. Temporarily use + * sl_sal_first[] for this. */ + for (p = from, s = to; *p != NUL && *s != NUL; ) + { + c = mb_cptr2char_adv(&p); + MB_CPTR_ADV(s); + if (c >= 256) + ++lp->sl_sal_first[c & 0xff]; + } + if (*p != NUL || *s != NUL) /* lengths differ */ + return SP_FORMERROR; + + /* Allocate the lists. */ + for (i = 0; i < 256; ++i) + if (lp->sl_sal_first[i] > 0) + { + p = alloc(sizeof(int) * (lp->sl_sal_first[i] * 2 + 1)); + if (p == NULL) + return SP_OTHERERROR; + ((int **)gap->ga_data)[i] = (int *)p; + *(int *)p = 0; + } + + /* Put the characters up to 255 in sl_sal_first[] the rest in a sl_sal + * list. */ + vim_memset(lp->sl_sal_first, 0, sizeof(salfirst_T) * 256); + for (p = from, s = to; *p != NUL && *s != NUL; ) + { + c = mb_cptr2char_adv(&p); + i = mb_cptr2char_adv(&s); + if (c >= 256) + { + /* Append the from-to chars at the end of the list with + * the low byte. */ + inp = ((int **)gap->ga_data)[c & 0xff]; + while (*inp != 0) + ++inp; + *inp++ = c; /* from char */ + *inp++ = i; /* to char */ + *inp++ = NUL; /* NUL at the end */ + } + else + /* mapping byte to char is done in sl_sal_first[] */ + lp->sl_sal_first[c] = i; + } + } + else +#endif + { + /* mapping bytes to bytes is done in sl_sal_first[] */ + if (STRLEN(from) != STRLEN(to)) + return SP_FORMERROR; + + for (i = 0; to[i] != NUL; ++i) + lp->sl_sal_first[from[i]] = to[i]; + lp->sl_sal.ga_len = 1; /* indicates we have soundfolding */ + } + + return 0; +} + +/* + * Fill the first-index table for "lp". + */ + static void +set_sal_first(slang_T *lp) +{ + salfirst_T *sfirst; + int i; + salitem_T *smp; + int c; + garray_T *gap = &lp->sl_sal; + + sfirst = lp->sl_sal_first; + for (i = 0; i < 256; ++i) + sfirst[i] = -1; + smp = (salitem_T *)gap->ga_data; + for (i = 0; i < gap->ga_len; ++i) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + /* Use the lowest byte of the first character. For latin1 it's + * the character, for other encodings it should differ for most + * characters. */ + c = *smp[i].sm_lead_w & 0xff; + else +#endif + c = *smp[i].sm_lead; + if (sfirst[c] == -1) + { + sfirst[c] = i; +#ifdef FEAT_MBYTE + if (has_mbyte) + { + int n; + + /* Make sure all entries with this byte are following each + * other. Move the ones that are in the wrong position. Do + * keep the same ordering! */ + while (i + 1 < gap->ga_len + && (*smp[i + 1].sm_lead_w & 0xff) == c) + /* Skip over entry with same index byte. */ + ++i; + + for (n = 1; i + n < gap->ga_len; ++n) + if ((*smp[i + n].sm_lead_w & 0xff) == c) + { + salitem_T tsal; + + /* Move entry with same index byte after the entries + * we already found. */ + ++i; + --n; + tsal = smp[i + n]; + mch_memmove(smp + i + 1, smp + i, + sizeof(salitem_T) * n); + smp[i] = tsal; + } + } +#endif + } + } +} + +#ifdef FEAT_MBYTE +/* + * Turn a multi-byte string into a wide character string. + * Return it in allocated memory (NULL for out-of-memory) + */ + static int * +mb_str2wide(char_u *s) +{ + int *res; + char_u *p; + int i = 0; + + res = (int *)alloc(sizeof(int) * (mb_charlen(s) + 1)); + if (res != NULL) + { + for (p = s; *p != NUL; ) + res[i++] = mb_ptr2char_adv(&p); + res[i] = NUL; + } + return res; +} +#endif + +/* + * Read a tree from the .spl or .sug file. + * Allocates the memory and stores pointers in "bytsp" and "idxsp". + * This is skipped when the tree has zero length. + * Returns zero when OK, SP_ value for an error. + */ + static int +spell_read_tree( + FILE *fd, + char_u **bytsp, + idx_T **idxsp, + int prefixtree, /* TRUE for the prefix tree */ + int prefixcnt) /* when "prefixtree" is TRUE: prefix count */ +{ + long len; + int idx; + char_u *bp; + idx_T *ip; + + /* The tree size was computed when writing the file, so that we can + * allocate it as one long block. <nodecount> */ + len = get4c(fd); + if (len < 0) + return SP_TRUNCERROR; + if (len >= LONG_MAX / (long)sizeof(int)) + /* Invalid length, multiply with sizeof(int) would overflow. */ + return SP_FORMERROR; + if (len > 0) + { + /* Allocate the byte array. */ + bp = lalloc((long_u)len, TRUE); + if (bp == NULL) + return SP_OTHERERROR; + *bytsp = bp; + + /* Allocate the index array. */ + ip = (idx_T *)lalloc_clear((long_u)(len * sizeof(int)), TRUE); + if (ip == NULL) + return SP_OTHERERROR; + *idxsp = ip; + + /* Recursively read the tree and store it in the array. */ + idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt); + if (idx < 0) + return idx; + } + return 0; +} + +/* + * Read one row of siblings from the spell file and store it in the byte array + * "byts" and index array "idxs". Recursively read the children. + * + * NOTE: The code here must match put_node()! + * + * Returns the index (>= 0) following the siblings. + * Returns SP_TRUNCERROR if the file is shorter than expected. + * Returns SP_FORMERROR if there is a format error. + */ + static idx_T +read_tree_node( + FILE *fd, + char_u *byts, + idx_T *idxs, + int maxidx, /* size of arrays */ + idx_T startidx, /* current index in "byts" and "idxs" */ + int prefixtree, /* TRUE for reading PREFIXTREE */ + int maxprefcondnr) /* maximum for <prefcondnr> */ +{ + int len; + int i; + int n; + idx_T idx = startidx; + int c; + int c2; +#define SHARED_MASK 0x8000000 + + len = getc(fd); /* <siblingcount> */ + if (len <= 0) + return SP_TRUNCERROR; + + if (startidx + len >= maxidx) + return SP_FORMERROR; + byts[idx++] = len; + + /* Read the byte values, flag/region bytes and shared indexes. */ + for (i = 1; i <= len; ++i) + { + c = getc(fd); /* <byte> */ + if (c < 0) + return SP_TRUNCERROR; + if (c <= BY_SPECIAL) + { + if (c == BY_NOFLAGS && !prefixtree) + { + /* No flags, all regions. */ + idxs[idx] = 0; + c = 0; + } + else if (c != BY_INDEX) + { + if (prefixtree) + { + /* Read the optional pflags byte, the prefix ID and the + * condition nr. In idxs[] store the prefix ID in the low + * byte, the condition index shifted up 8 bits, the flags + * shifted up 24 bits. */ + if (c == BY_FLAGS) + c = getc(fd) << 24; /* <pflags> */ + else + c = 0; + + c |= getc(fd); /* <affixID> */ + + n = get2c(fd); /* <prefcondnr> */ + if (n >= maxprefcondnr) + return SP_FORMERROR; + c |= (n << 8); + } + else /* c must be BY_FLAGS or BY_FLAGS2 */ + { + /* Read flags and optional region and prefix ID. In + * idxs[] the flags go in the low two bytes, region above + * that and prefix ID above the region. */ + c2 = c; + c = getc(fd); /* <flags> */ + if (c2 == BY_FLAGS2) + c = (getc(fd) << 8) + c; /* <flags2> */ + if (c & WF_REGION) + c = (getc(fd) << 16) + c; /* <region> */ + if (c & WF_AFX) + c = (getc(fd) << 24) + c; /* <affixID> */ + } + + idxs[idx] = c; + c = 0; + } + else /* c == BY_INDEX */ + { + /* <nodeidx> */ + n = get3c(fd); + if (n < 0 || n >= maxidx) + return SP_FORMERROR; + idxs[idx] = n + SHARED_MASK; + c = getc(fd); /* <xbyte> */ + } + } + byts[idx++] = c; + } + + /* Recursively read the children for non-shared siblings. + * Skip the end-of-word ones (zero byte value) and the shared ones (and + * remove SHARED_MASK) */ + for (i = 1; i <= len; ++i) + if (byts[startidx + i] != 0) + { + if (idxs[startidx + i] & SHARED_MASK) + idxs[startidx + i] &= ~SHARED_MASK; + else + { + idxs[startidx + i] = idx; + idx = read_tree_node(fd, byts, idxs, maxidx, idx, + prefixtree, maxprefcondnr); + if (idx < 0) + break; + } + } + + return idx; +} + +/* + * Reload the spell file "fname" if it's loaded. + */ + static void +spell_reload_one( + char_u *fname, + int added_word) /* invoked through "zg" */ +{ + slang_T *slang; + int didit = FALSE; + + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + { + if (fullpathcmp(fname, slang->sl_fname, FALSE) == FPC_SAME) + { + slang_clear(slang); + if (spell_load_file(fname, NULL, slang, FALSE) == NULL) + /* reloading failed, clear the language */ + slang_clear(slang); + redraw_all_later(SOME_VALID); + didit = TRUE; + } + } + + /* When "zg" was used and the file wasn't loaded yet, should redo + * 'spelllang' to load it now. */ + if (added_word && !didit) + did_set_spelllang(curwin); +} + + +/* + * Functions for ":mkspell". + */ + +#define MAXLINELEN 500 /* Maximum length in bytes of a line in a .aff + and .dic file. */ +/* + * Main structure to store the contents of a ".aff" file. + */ +typedef struct afffile_S +{ + char_u *af_enc; /* "SET", normalized, alloc'ed string or NULL */ + int af_flagtype; /* AFT_CHAR, AFT_LONG, AFT_NUM or AFT_CAPLONG */ + unsigned af_rare; /* RARE ID for rare word */ + unsigned af_keepcase; /* KEEPCASE ID for keep-case word */ + unsigned af_bad; /* BAD ID for banned word */ + unsigned af_needaffix; /* NEEDAFFIX ID */ + unsigned af_circumfix; /* CIRCUMFIX ID */ + unsigned af_needcomp; /* NEEDCOMPOUND ID */ + unsigned af_comproot; /* COMPOUNDROOT ID */ + unsigned af_compforbid; /* COMPOUNDFORBIDFLAG ID */ + unsigned af_comppermit; /* COMPOUNDPERMITFLAG ID */ + unsigned af_nosuggest; /* NOSUGGEST ID */ + int af_pfxpostpone; /* postpone prefixes without chop string and + without flags */ + int af_ignoreextra; /* IGNOREEXTRA present */ + hashtab_T af_pref; /* hashtable for prefixes, affheader_T */ + hashtab_T af_suff; /* hashtable for suffixes, affheader_T */ + hashtab_T af_comp; /* hashtable for compound flags, compitem_T */ +} afffile_T; + +#define AFT_CHAR 0 /* flags are one character */ +#define AFT_LONG 1 /* flags are two characters */ +#define AFT_CAPLONG 2 /* flags are one or two characters */ +#define AFT_NUM 3 /* flags are numbers, comma separated */ + +typedef struct affentry_S affentry_T; +/* Affix entry from ".aff" file. Used for prefixes and suffixes. */ +struct affentry_S +{ + affentry_T *ae_next; /* next affix with same name/number */ + char_u *ae_chop; /* text to chop off basic word (can be NULL) */ + char_u *ae_add; /* text to add to basic word (can be NULL) */ + char_u *ae_flags; /* flags on the affix (can be NULL) */ + char_u *ae_cond; /* condition (NULL for ".") */ + regprog_T *ae_prog; /* regexp program for ae_cond or NULL */ + char ae_compforbid; /* COMPOUNDFORBIDFLAG found */ + char ae_comppermit; /* COMPOUNDPERMITFLAG found */ +}; + +#ifdef FEAT_MBYTE +# define AH_KEY_LEN 17 /* 2 x 8 bytes + NUL */ +#else +# define AH_KEY_LEN 7 /* 6 digits + NUL */ +#endif + +/* Affix header from ".aff" file. Used for af_pref and af_suff. */ +typedef struct affheader_S +{ + char_u ah_key[AH_KEY_LEN]; /* key for hashtab == name of affix */ + unsigned ah_flag; /* affix name as number, uses "af_flagtype" */ + int ah_newID; /* prefix ID after renumbering; 0 if not used */ + int ah_combine; /* suffix may combine with prefix */ + int ah_follows; /* another affix block should be following */ + affentry_T *ah_first; /* first affix entry */ +} affheader_T; + +#define HI2AH(hi) ((affheader_T *)(hi)->hi_key) + +/* Flag used in compound items. */ +typedef struct compitem_S +{ + char_u ci_key[AH_KEY_LEN]; /* key for hashtab == name of compound */ + unsigned ci_flag; /* affix name as number, uses "af_flagtype" */ + int ci_newID; /* affix ID after renumbering. */ +} compitem_T; + +#define HI2CI(hi) ((compitem_T *)(hi)->hi_key) + +/* + * Structure that is used to store the items in the word tree. This avoids + * the need to keep track of each allocated thing, everything is freed all at + * once after ":mkspell" is done. + * Note: "sb_next" must be just before "sb_data" to make sure the alignment of + * "sb_data" is correct for systems where pointers must be aligned on + * pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc). + */ +#define SBLOCKSIZE 16000 /* size of sb_data */ +typedef struct sblock_S sblock_T; +struct sblock_S +{ + int sb_used; /* nr of bytes already in use */ + sblock_T *sb_next; /* next block in list */ + char_u sb_data[1]; /* data, actually longer */ +}; + +/* + * A node in the tree. + */ +typedef struct wordnode_S wordnode_T; +struct wordnode_S +{ + union /* shared to save space */ + { + char_u hashkey[6]; /* the hash key, only used while compressing */ + int index; /* index in written nodes (valid after first + round) */ + } wn_u1; + union /* shared to save space */ + { + wordnode_T *next; /* next node with same hash key */ + wordnode_T *wnode; /* parent node that will write this node */ + } wn_u2; + wordnode_T *wn_child; /* child (next byte in word) */ + wordnode_T *wn_sibling; /* next sibling (alternate byte in word, + always sorted) */ + int wn_refs; /* Nr. of references to this node. Only + relevant for first node in a list of + siblings, in following siblings it is + always one. */ + char_u wn_byte; /* Byte for this node. NUL for word end */ + + /* Info for when "wn_byte" is NUL. + * In PREFIXTREE "wn_region" is used for the prefcondnr. + * In the soundfolded word tree "wn_flags" has the MSW of the wordnr and + * "wn_region" the LSW of the wordnr. */ + char_u wn_affixID; /* supported/required prefix ID or 0 */ + short_u wn_flags; /* WF_ flags */ + short wn_region; /* region mask */ + +#ifdef SPELL_PRINTTREE + int wn_nr; /* sequence nr for printing */ +#endif +}; + +#define WN_MASK 0xffff /* mask relevant bits of "wn_flags" */ + +#define HI2WN(hi) (wordnode_T *)((hi)->hi_key) + +/* + * Info used while reading the spell files. + */ +typedef struct spellinfo_S +{ + wordnode_T *si_foldroot; /* tree with case-folded words */ + long si_foldwcount; /* nr of words in si_foldroot */ + + wordnode_T *si_keeproot; /* tree with keep-case words */ + long si_keepwcount; /* nr of words in si_keeproot */ + + wordnode_T *si_prefroot; /* tree with postponed prefixes */ + + long si_sugtree; /* creating the soundfolding trie */ + + sblock_T *si_blocks; /* memory blocks used */ + long si_blocks_cnt; /* memory blocks allocated */ + int si_did_emsg; /* TRUE when ran out of memory */ + + long si_compress_cnt; /* words to add before lowering + compression limit */ + wordnode_T *si_first_free; /* List of nodes that have been freed during + compression, linked by "wn_child" field. */ + long si_free_count; /* number of nodes in si_first_free */ +#ifdef SPELL_PRINTTREE + int si_wordnode_nr; /* sequence nr for nodes */ +#endif + buf_T *si_spellbuf; /* buffer used to store soundfold word table */ + + int si_ascii; /* handling only ASCII words */ + int si_add; /* addition file */ + int si_clear_chartab; /* when TRUE clear char tables */ + int si_region; /* region mask */ + vimconv_T si_conv; /* for conversion to 'encoding' */ + int si_memtot; /* runtime memory used */ + int si_verbose; /* verbose messages */ + int si_msg_count; /* number of words added since last message */ + char_u *si_info; /* info text chars or NULL */ + int si_region_count; /* number of regions supported (1 when there + are no regions) */ + char_u si_region_name[MAXREGIONS * 2 + 1]; + /* region names; used only if + * si_region_count > 1) */ + + garray_T si_rep; /* list of fromto_T entries from REP lines */ + garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */ + garray_T si_sal; /* list of fromto_T entries from SAL lines */ + char_u *si_sofofr; /* SOFOFROM text */ + char_u *si_sofoto; /* SOFOTO text */ + int si_nosugfile; /* NOSUGFILE item found */ + int si_nosplitsugs; /* NOSPLITSUGS item found */ + int si_nocompoundsugs; /* NOCOMPOUNDSUGS item found */ + int si_followup; /* soundsalike: ? */ + int si_collapse; /* soundsalike: ? */ + hashtab_T si_commonwords; /* hashtable for common words */ + time_t si_sugtime; /* timestamp for .sug file */ + int si_rem_accents; /* soundsalike: remove accents */ + garray_T si_map; /* MAP info concatenated */ + char_u *si_midword; /* MIDWORD chars or NULL */ + int si_compmax; /* max nr of words for compounding */ + int si_compminlen; /* minimal length for compounding */ + int si_compsylmax; /* max nr of syllables for compounding */ + int si_compoptions; /* COMP_ flags */ + garray_T si_comppat; /* CHECKCOMPOUNDPATTERN items, each stored as + a string */ + char_u *si_compflags; /* flags used for compounding */ + char_u si_nobreak; /* NOBREAK */ + char_u *si_syllable; /* syllable string */ + garray_T si_prefcond; /* table with conditions for postponed + * prefixes, each stored as a string */ + int si_newprefID; /* current value for ah_newID */ + int si_newcompID; /* current value for compound ID */ +} spellinfo_T; + +static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname); +static int is_aff_rule(char_u **items, int itemcnt, char *rulename, int mincount); +static void aff_process_flags(afffile_T *affile, affentry_T *entry); +static int spell_info_item(char_u *s); +static unsigned affitem2flag(int flagtype, char_u *item, char_u *fname, int lnum); +static unsigned get_affitem(int flagtype, char_u **pp); +static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compflags); +static void check_renumber(spellinfo_T *spin); +static int flag_in_afflist(int flagtype, char_u *afflist, unsigned flag); +static void aff_check_number(int spinval, int affval, char *name); +static void aff_check_string(char_u *spinval, char_u *affval, char *name); +static int str_equal(char_u *s1, char_u *s2); +static void add_fromto(spellinfo_T *spin, garray_T *gap, char_u *from, char_u *to); +static int sal_to_bool(char_u *s); +static void spell_free_aff(afffile_T *aff); +static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile); +static int get_affix_flags(afffile_T *affile, char_u *afflist); +static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist); +static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_afflist); +static int store_aff_word(spellinfo_T *spin, char_u *word, char_u *afflist, afffile_T *affile, hashtab_T *ht, hashtab_T *xht, int condit, int flags, char_u *pfxlist, int pfxlen); +static int spell_read_wordfile(spellinfo_T *spin, char_u *fname); +static void *getroom(spellinfo_T *spin, size_t len, int align); +static char_u *getroom_save(spellinfo_T *spin, char_u *s); +static void free_blocks(sblock_T *bl); +static wordnode_T *wordtree_alloc(spellinfo_T *spin); +static int store_word(spellinfo_T *spin, char_u *word, int flags, int region, char_u *pfxlist, int need_affix); +static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *tree, int flags, int region, int affixID); +static wordnode_T *get_wordnode(spellinfo_T *spin); +static int deref_wordnode(spellinfo_T *spin, wordnode_T *node); +static void free_wordnode(spellinfo_T *spin, wordnode_T *n); +static void wordtree_compress(spellinfo_T *spin, wordnode_T *root); +static int node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int *tot); +static int node_equal(wordnode_T *n1, wordnode_T *n2); +static int write_vim_spell(spellinfo_T *spin, char_u *fname); +static void clear_node(wordnode_T *node); +static int put_node(FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree); +static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname); +static int sug_filltree(spellinfo_T *spin, slang_T *slang); +static int sug_maketable(spellinfo_T *spin); +static int sug_filltable(spellinfo_T *spin, wordnode_T *node, int startwordnr, garray_T *gap); +static int offset2bytes(int nr, char_u *buf); +static void sug_write(spellinfo_T *spin, char_u *fname); +static void spell_message(spellinfo_T *spin, char_u *str); +static void init_spellfile(void); + +/* In the postponed prefixes tree wn_flags is used to store the WFP_ flags, + * but it must be negative to indicate the prefix tree to tree_add_word(). + * Use a negative number with the lower 8 bits zero. */ +#define PFX_FLAGS -256 + +/* flags for "condit" argument of store_aff_word() */ +#define CONDIT_COMB 1 /* affix must combine */ +#define CONDIT_CFIX 2 /* affix must have CIRCUMFIX flag */ +#define CONDIT_SUF 4 /* add a suffix for matching flags */ +#define CONDIT_AFF 8 /* word already has an affix */ + +/* + * Tunable parameters for when the tree is compressed. See 'mkspellmem'. + */ +static long compress_start = 30000; /* memory / SBLOCKSIZE */ +static long compress_inc = 100; /* memory / SBLOCKSIZE */ +static long compress_added = 500000; /* word count */ + +/* + * Check the 'mkspellmem' option. Return FAIL if it's wrong. + * Sets "sps_flags". + */ + int +spell_check_msm(void) +{ + char_u *p = p_msm; + long start = 0; + long incr = 0; + long added = 0; + + if (!VIM_ISDIGIT(*p)) + return FAIL; + /* block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)*/ + start = (getdigits(&p) * 10) / (SBLOCKSIZE / 102); + if (*p != ',') + return FAIL; + ++p; + if (!VIM_ISDIGIT(*p)) + return FAIL; + incr = (getdigits(&p) * 102) / (SBLOCKSIZE / 10); + if (*p != ',') + return FAIL; + ++p; + if (!VIM_ISDIGIT(*p)) + return FAIL; + added = getdigits(&p) * 1024; + if (*p != NUL) + return FAIL; + + if (start == 0 || incr == 0 || added == 0 || incr > start) + return FAIL; + + compress_start = start; + compress_inc = incr; + compress_added = added; + return OK; +} + +#ifdef SPELL_PRINTTREE +/* + * For debugging the tree code: print the current tree in a (more or less) + * readable format, so that we can see what happens when adding a word and/or + * compressing the tree. + * Based on code from Olaf Seibert. + */ +#define PRINTLINESIZE 1000 +#define PRINTWIDTH 6 + +#define PRINTSOME(l, depth, fmt, a1, a2) vim_snprintf(l + depth * PRINTWIDTH, \ + PRINTLINESIZE - PRINTWIDTH * depth, fmt, a1, a2) + +static char line1[PRINTLINESIZE]; +static char line2[PRINTLINESIZE]; +static char line3[PRINTLINESIZE]; + + static void +spell_clear_flags(wordnode_T *node) +{ + wordnode_T *np; + + for (np = node; np != NULL; np = np->wn_sibling) + { + np->wn_u1.index = FALSE; + spell_clear_flags(np->wn_child); + } +} + + static void +spell_print_node(wordnode_T *node, int depth) +{ + if (node->wn_u1.index) + { + /* Done this node before, print the reference. */ + PRINTSOME(line1, depth, "(%d)", node->wn_nr, 0); + PRINTSOME(line2, depth, " ", 0, 0); + PRINTSOME(line3, depth, " ", 0, 0); + msg((char_u *)line1); + msg((char_u *)line2); + msg((char_u *)line3); + } + else + { + node->wn_u1.index = TRUE; + + if (node->wn_byte != NUL) + { + if (node->wn_child != NULL) + PRINTSOME(line1, depth, " %c -> ", node->wn_byte, 0); + else + /* Cannot happen? */ + PRINTSOME(line1, depth, " %c ???", node->wn_byte, 0); + } + else + PRINTSOME(line1, depth, " $ ", 0, 0); + + PRINTSOME(line2, depth, "%d/%d ", node->wn_nr, node->wn_refs); + + if (node->wn_sibling != NULL) + PRINTSOME(line3, depth, " | ", 0, 0); + else + PRINTSOME(line3, depth, " ", 0, 0); + + if (node->wn_byte == NUL) + { + msg((char_u *)line1); + msg((char_u *)line2); + msg((char_u *)line3); + } + + /* do the children */ + if (node->wn_byte != NUL && node->wn_child != NULL) + spell_print_node(node->wn_child, depth + 1); + + /* do the siblings */ + if (node->wn_sibling != NULL) + { + /* get rid of all parent details except | */ + STRCPY(line1, line3); + STRCPY(line2, line3); + spell_print_node(node->wn_sibling, depth); + } + } +} + + static void +spell_print_tree(wordnode_T *root) +{ + if (root != NULL) + { + /* Clear the "wn_u1.index" fields, used to remember what has been + * done. */ + spell_clear_flags(root); + + /* Recursively print the tree. */ + spell_print_node(root, 0); + } +} +#endif /* SPELL_PRINTTREE */ + +/* + * Read the affix file "fname". + * Returns an afffile_T, NULL for complete failure. + */ + static afffile_T * +spell_read_aff(spellinfo_T *spin, char_u *fname) +{ + FILE *fd; + afffile_T *aff; + char_u rline[MAXLINELEN]; + char_u *line; + char_u *pc = NULL; +#define MAXITEMCNT 30 + char_u *(items[MAXITEMCNT]); + int itemcnt; + char_u *p; + int lnum = 0; + affheader_T *cur_aff = NULL; + int did_postpone_prefix = FALSE; + int aff_todo = 0; + hashtab_T *tp; + char_u *low = NULL; + char_u *fol = NULL; + char_u *upp = NULL; + int do_rep; + int do_repsal; + int do_sal; + int do_mapline; + int found_map = FALSE; + hashitem_T *hi; + int l; + int compminlen = 0; /* COMPOUNDMIN value */ + int compsylmax = 0; /* COMPOUNDSYLMAX value */ + int compoptions = 0; /* COMP_ flags */ + int compmax = 0; /* COMPOUNDWORDMAX value */ + char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDRULE + concatenated */ + char_u *midword = NULL; /* MIDWORD value */ + char_u *syllable = NULL; /* SYLLABLE value */ + char_u *sofofrom = NULL; /* SOFOFROM value */ + char_u *sofoto = NULL; /* SOFOTO value */ + + /* + * Open the file. + */ + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + { + EMSG2(_(e_notopen), fname); + return NULL; + } + + vim_snprintf((char *)IObuff, IOSIZE, _("Reading affix file %s ..."), fname); + spell_message(spin, IObuff); + + /* Only do REP lines when not done in another .aff file already. */ + do_rep = spin->si_rep.ga_len == 0; + + /* Only do REPSAL lines when not done in another .aff file already. */ + do_repsal = spin->si_repsal.ga_len == 0; + + /* Only do SAL lines when not done in another .aff file already. */ + do_sal = spin->si_sal.ga_len == 0; + + /* Only do MAP lines when not done in another .aff file already. */ + do_mapline = spin->si_map.ga_len == 0; + + /* + * Allocate and init the afffile_T structure. + */ + aff = (afffile_T *)getroom(spin, sizeof(afffile_T), TRUE); + if (aff == NULL) + { + fclose(fd); + return NULL; + } + hash_init(&aff->af_pref); + hash_init(&aff->af_suff); + hash_init(&aff->af_comp); + + /* + * Read all the lines in the file one by one. + */ + while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) + { + line_breakcheck(); + ++lnum; + + /* Skip comment lines. */ + if (*rline == '#') + continue; + + /* Convert from "SET" to 'encoding' when needed. */ + vim_free(pc); +#ifdef FEAT_MBYTE + if (spin->si_conv.vc_type != CONV_NONE) + { + pc = string_convert(&spin->si_conv, rline, NULL); + if (pc == NULL) + { + smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + fname, lnum, rline); + continue; + } + line = pc; + } + else +#endif + { + pc = NULL; + line = rline; + } + + /* Split the line up in white separated items. Put a NUL after each + * item. */ + itemcnt = 0; + for (p = line; ; ) + { + while (*p != NUL && *p <= ' ') /* skip white space and CR/NL */ + ++p; + if (*p == NUL) + break; + if (itemcnt == MAXITEMCNT) /* too many items */ + break; + items[itemcnt++] = p; + /* A few items have arbitrary text argument, don't split them. */ + if (itemcnt == 2 && spell_info_item(items[0])) + while (*p >= ' ' || *p == TAB) /* skip until CR/NL */ + ++p; + else + while (*p > ' ') /* skip until white space or CR/NL */ + ++p; + if (*p == NUL) + break; + *p++ = NUL; + } + + /* Handle non-empty lines. */ + if (itemcnt > 0) + { + if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) + { +#ifdef FEAT_MBYTE + /* Setup for conversion from "ENC" to 'encoding'. */ + aff->af_enc = enc_canonize(items[1]); + if (aff->af_enc != NULL && !spin->si_ascii + && convert_setup(&spin->si_conv, aff->af_enc, + p_enc) == FAIL) + smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), + fname, aff->af_enc, p_enc); + spin->si_conv.vc_fail = TRUE; +#else + smsg((char_u *)_("Conversion in %s not supported"), fname); +#endif + } + else if (is_aff_rule(items, itemcnt, "FLAG", 2) + && aff->af_flagtype == AFT_CHAR) + { + if (STRCMP(items[1], "long") == 0) + aff->af_flagtype = AFT_LONG; + else if (STRCMP(items[1], "num") == 0) + aff->af_flagtype = AFT_NUM; + else if (STRCMP(items[1], "caplong") == 0) + aff->af_flagtype = AFT_CAPLONG; + else + smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), + fname, lnum, items[1]); + if (aff->af_rare != 0 + || aff->af_keepcase != 0 + || aff->af_bad != 0 + || aff->af_needaffix != 0 + || aff->af_circumfix != 0 + || aff->af_needcomp != 0 + || aff->af_comproot != 0 + || aff->af_nosuggest != 0 + || compflags != NULL + || aff->af_suff.ht_used > 0 + || aff->af_pref.ht_used > 0) + smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (spell_info_item(items[0])) + { + p = (char_u *)getroom(spin, + (spin->si_info == NULL ? 0 : STRLEN(spin->si_info)) + + STRLEN(items[0]) + + STRLEN(items[1]) + 3, FALSE); + if (p != NULL) + { + if (spin->si_info != NULL) + { + STRCPY(p, spin->si_info); + STRCAT(p, "\n"); + } + STRCAT(p, items[0]); + STRCAT(p, " "); + STRCAT(p, items[1]); + spin->si_info = p; + } + } + else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) + && midword == NULL) + { + midword = getroom_save(spin, items[1]); + } + else if (is_aff_rule(items, itemcnt, "TRY", 2)) + { + /* ignored, we look in the tree for what chars may appear */ + } + /* TODO: remove "RAR" later */ + else if ((is_aff_rule(items, itemcnt, "RAR", 2) + || is_aff_rule(items, itemcnt, "RARE", 2)) + && aff->af_rare == 0) + { + aff->af_rare = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + /* TODO: remove "KEP" later */ + else if ((is_aff_rule(items, itemcnt, "KEP", 2) + || is_aff_rule(items, itemcnt, "KEEPCASE", 2)) + && aff->af_keepcase == 0) + { + aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if ((is_aff_rule(items, itemcnt, "BAD", 2) + || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2)) + && aff->af_bad == 0) + { + aff->af_bad = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2) + && aff->af_needaffix == 0) + { + aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2) + && aff->af_circumfix == 0) + { + aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2) + && aff->af_nosuggest == 0) + { + aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2) + || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2)) + && aff->af_needcomp == 0) + { + aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2) + && aff->af_comproot == 0) + { + aff->af_comproot = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2) + && aff->af_compforbid == 0) + { + aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + if (aff->af_pref.ht_used > 0) + smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) + && aff->af_comppermit == 0) + { + aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + if (aff->af_pref.ht_used > 0) + smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), + fname, lnum); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) + && compflags == NULL) + { + /* Turn flag "c" into COMPOUNDRULE compatible string "c+", + * "Na" into "Na+", "1234" into "1234+". */ + p = getroom(spin, STRLEN(items[1]) + 2, FALSE); + if (p != NULL) + { + STRCPY(p, items[1]); + STRCAT(p, "+"); + compflags = p; + } + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) + { + /* We don't use the count, but do check that it's a number and + * not COMPOUNDRULE mistyped. */ + if (atoi((char *)items[1]) == 0) + smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) + { + /* Don't use the first rule if it is a number. */ + if (compflags != NULL || *skipdigits(items[1]) != NUL) + { + /* Concatenate this string to previously defined ones, + * using a slash to separate them. */ + l = (int)STRLEN(items[1]) + 1; + if (compflags != NULL) + l += (int)STRLEN(compflags) + 1; + p = getroom(spin, l, FALSE); + if (p != NULL) + { + if (compflags != NULL) + { + STRCPY(p, compflags); + STRCAT(p, "/"); + } + STRCAT(p, items[1]); + compflags = p; + } + } + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) + && compmax == 0) + { + compmax = atoi((char *)items[1]); + if (compmax == 0) + smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) + && compminlen == 0) + { + compminlen = atoi((char *)items[1]); + if (compminlen == 0) + smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) + && compsylmax == 0) + { + compsylmax = atoi((char *)items[1]); + if (compsylmax == 0) + smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) + { + compoptions |= COMP_CHECKDUP; + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) + { + compoptions |= COMP_CHECKREP; + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1)) + { + compoptions |= COMP_CHECKCASE; + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1)) + { + compoptions |= COMP_CHECKTRIPLE; + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) + { + if (atoi((char *)items[1]) == 0) + smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), + fname, lnum, items[1]); + } + else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) + { + garray_T *gap = &spin->si_comppat; + int i; + + /* Only add the couple if it isn't already there. */ + for (i = 0; i < gap->ga_len - 1; i += 2) + if (STRCMP(((char_u **)(gap->ga_data))[i], items[1]) == 0 + && STRCMP(((char_u **)(gap->ga_data))[i + 1], + items[2]) == 0) + break; + if (i >= gap->ga_len && ga_grow(gap, 2) == OK) + { + ((char_u **)(gap->ga_data))[gap->ga_len++] + = getroom_save(spin, items[1]); + ((char_u **)(gap->ga_data))[gap->ga_len++] + = getroom_save(spin, items[2]); + } + } + else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2) + && syllable == NULL) + { + syllable = getroom_save(spin, items[1]); + } + else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) + { + spin->si_nobreak = TRUE; + } + else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) + { + spin->si_nosplitsugs = TRUE; + } + else if (is_aff_rule(items, itemcnt, "NOCOMPOUNDSUGS", 1)) + { + spin->si_nocompoundsugs = TRUE; + } + else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1)) + { + spin->si_nosugfile = TRUE; + } + else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1)) + { + aff->af_pfxpostpone = TRUE; + } + else if (is_aff_rule(items, itemcnt, "IGNOREEXTRA", 1)) + { + aff->af_ignoreextra = TRUE; + } + else if ((STRCMP(items[0], "PFX") == 0 + || STRCMP(items[0], "SFX") == 0) + && aff_todo == 0 + && itemcnt >= 4) + { + int lasti = 4; + char_u key[AH_KEY_LEN]; + + if (*items[0] == 'P') + tp = &aff->af_pref; + else + tp = &aff->af_suff; + + /* Myspell allows the same affix name to be used multiple + * times. The affix files that do this have an undocumented + * "S" flag on all but the last block, thus we check for that + * and store it in ah_follows. */ + vim_strncpy(key, items[1], AH_KEY_LEN - 1); + hi = hash_find(tp, key); + if (!HASHITEM_EMPTY(hi)) + { + cur_aff = HI2AH(hi); + if (cur_aff->ah_combine != (*items[2] == 'Y')) + smsg((char_u *)_("Different combining flag in continued affix block in %s line %d: %s"), + fname, lnum, items[1]); + if (!cur_aff->ah_follows) + smsg((char_u *)_("Duplicate affix in %s line %d: %s"), + fname, lnum, items[1]); + } + else + { + /* New affix letter. */ + cur_aff = (affheader_T *)getroom(spin, + sizeof(affheader_T), TRUE); + if (cur_aff == NULL) + break; + cur_aff->ah_flag = affitem2flag(aff->af_flagtype, items[1], + fname, lnum); + if (cur_aff->ah_flag == 0 || STRLEN(items[1]) >= AH_KEY_LEN) + break; + if (cur_aff->ah_flag == aff->af_bad + || cur_aff->ah_flag == aff->af_rare + || cur_aff->ah_flag == aff->af_keepcase + || cur_aff->ah_flag == aff->af_needaffix + || cur_aff->ah_flag == aff->af_circumfix + || cur_aff->ah_flag == aff->af_nosuggest + || cur_aff->ah_flag == aff->af_needcomp + || cur_aff->ah_flag == aff->af_comproot) + smsg((char_u *)_("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), + fname, lnum, items[1]); + STRCPY(cur_aff->ah_key, items[1]); + hash_add(tp, cur_aff->ah_key); + + cur_aff->ah_combine = (*items[2] == 'Y'); + } + + /* Check for the "S" flag, which apparently means that another + * block with the same affix name is following. */ + if (itemcnt > lasti && STRCMP(items[lasti], "S") == 0) + { + ++lasti; + cur_aff->ah_follows = TRUE; + } + else + cur_aff->ah_follows = FALSE; + + /* Myspell allows extra text after the item, but that might + * mean mistakes go unnoticed. Require a comment-starter. */ + if (itemcnt > lasti && *items[lasti] != '#') + smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + + if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0) + smsg((char_u *)_("Expected Y or N in %s line %d: %s"), + fname, lnum, items[2]); + + if (*items[0] == 'P' && aff->af_pfxpostpone) + { + if (cur_aff->ah_newID == 0) + { + /* Use a new number in the .spl file later, to be able + * to handle multiple .aff files. */ + check_renumber(spin); + cur_aff->ah_newID = ++spin->si_newprefID; + + /* We only really use ah_newID if the prefix is + * postponed. We know that only after handling all + * the items. */ + did_postpone_prefix = FALSE; + } + else + /* Did use the ID in a previous block. */ + did_postpone_prefix = TRUE; + } + + aff_todo = atoi((char *)items[3]); + } + else if ((STRCMP(items[0], "PFX") == 0 + || STRCMP(items[0], "SFX") == 0) + && aff_todo > 0 + && STRCMP(cur_aff->ah_key, items[1]) == 0 + && itemcnt >= 5) + { + affentry_T *aff_entry; + int upper = FALSE; + int lasti = 5; + + /* Myspell allows extra text after the item, but that might + * mean mistakes go unnoticed. Require a comment-starter, + * unless IGNOREEXTRA is used. Hunspell uses a "-" item. */ + if (itemcnt > lasti + && !aff->af_ignoreextra + && *items[lasti] != '#' + && (STRCMP(items[lasti], "-") != 0 + || itemcnt != lasti + 1)) + smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + + /* New item for an affix letter. */ + --aff_todo; + aff_entry = (affentry_T *)getroom(spin, + sizeof(affentry_T), TRUE); + if (aff_entry == NULL) + break; + + if (STRCMP(items[2], "0") != 0) + aff_entry->ae_chop = getroom_save(spin, items[2]); + if (STRCMP(items[3], "0") != 0) + { + aff_entry->ae_add = getroom_save(spin, items[3]); + + /* Recognize flags on the affix: abcd/XYZ */ + aff_entry->ae_flags = vim_strchr(aff_entry->ae_add, '/'); + if (aff_entry->ae_flags != NULL) + { + *aff_entry->ae_flags++ = NUL; + aff_process_flags(aff, aff_entry); + } + } + + /* Don't use an affix entry with non-ASCII characters when + * "spin->si_ascii" is TRUE. */ + if (!spin->si_ascii || !(has_non_ascii(aff_entry->ae_chop) + || has_non_ascii(aff_entry->ae_add))) + { + aff_entry->ae_next = cur_aff->ah_first; + cur_aff->ah_first = aff_entry; + + if (STRCMP(items[4], ".") != 0) + { + char_u buf[MAXLINELEN]; + + aff_entry->ae_cond = getroom_save(spin, items[4]); + if (*items[0] == 'P') + sprintf((char *)buf, "^%s", items[4]); + else + sprintf((char *)buf, "%s$", items[4]); + aff_entry->ae_prog = vim_regcomp(buf, + RE_MAGIC + RE_STRING + RE_STRICT); + if (aff_entry->ae_prog == NULL) + smsg((char_u *)_("Broken condition in %s line %d: %s"), + fname, lnum, items[4]); + } + + /* For postponed prefixes we need an entry in si_prefcond + * for the condition. Use an existing one if possible. + * Can't be done for an affix with flags, ignoring + * COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG. */ + if (*items[0] == 'P' && aff->af_pfxpostpone + && aff_entry->ae_flags == NULL) + { + /* When the chop string is one lower-case letter and + * the add string ends in the upper-case letter we set + * the "upper" flag, clear "ae_chop" and remove the + * letters from "ae_add". The condition must either + * be empty or start with the same letter. */ + if (aff_entry->ae_chop != NULL + && aff_entry->ae_add != NULL +#ifdef FEAT_MBYTE + && aff_entry->ae_chop[(*mb_ptr2len)( + aff_entry->ae_chop)] == NUL +#else + && aff_entry->ae_chop[1] == NUL +#endif + ) + { + int c, c_up; + + c = PTR2CHAR(aff_entry->ae_chop); + c_up = SPELL_TOUPPER(c); + if (c_up != c + && (aff_entry->ae_cond == NULL + || PTR2CHAR(aff_entry->ae_cond) == c)) + { + p = aff_entry->ae_add + + STRLEN(aff_entry->ae_add); + MB_PTR_BACK(aff_entry->ae_add, p); + if (PTR2CHAR(p) == c_up) + { + upper = TRUE; + aff_entry->ae_chop = NULL; + *p = NUL; + + /* The condition is matched with the + * actual word, thus must check for the + * upper-case letter. */ + if (aff_entry->ae_cond != NULL) + { + char_u buf[MAXLINELEN]; +#ifdef FEAT_MBYTE + if (has_mbyte) + { + onecap_copy(items[4], buf, TRUE); + aff_entry->ae_cond = getroom_save( + spin, buf); + } + else +#endif + *aff_entry->ae_cond = c_up; + if (aff_entry->ae_cond != NULL) + { + sprintf((char *)buf, "^%s", + aff_entry->ae_cond); + vim_regfree(aff_entry->ae_prog); + aff_entry->ae_prog = vim_regcomp( + buf, RE_MAGIC + RE_STRING); + } + } + } + } + } + + if (aff_entry->ae_chop == NULL + && aff_entry->ae_flags == NULL) + { + int idx; + char_u **pp; + int n; + + /* Find a previously used condition. */ + for (idx = spin->si_prefcond.ga_len - 1; idx >= 0; + --idx) + { + p = ((char_u **)spin->si_prefcond.ga_data)[idx]; + if (str_equal(p, aff_entry->ae_cond)) + break; + } + if (idx < 0 && ga_grow(&spin->si_prefcond, 1) == OK) + { + /* Not found, add a new condition. */ + idx = spin->si_prefcond.ga_len++; + pp = ((char_u **)spin->si_prefcond.ga_data) + + idx; + if (aff_entry->ae_cond == NULL) + *pp = NULL; + else + *pp = getroom_save(spin, + aff_entry->ae_cond); + } + + /* Add the prefix to the prefix tree. */ + if (aff_entry->ae_add == NULL) + p = (char_u *)""; + else + p = aff_entry->ae_add; + + /* PFX_FLAGS is a negative number, so that + * tree_add_word() knows this is the prefix tree. */ + n = PFX_FLAGS; + if (!cur_aff->ah_combine) + n |= WFP_NC; + if (upper) + n |= WFP_UP; + if (aff_entry->ae_comppermit) + n |= WFP_COMPPERMIT; + if (aff_entry->ae_compforbid) + n |= WFP_COMPFORBID; + tree_add_word(spin, p, spin->si_prefroot, n, + idx, cur_aff->ah_newID); + did_postpone_prefix = TRUE; + } + + /* Didn't actually use ah_newID, backup si_newprefID. */ + if (aff_todo == 0 && !did_postpone_prefix) + { + --spin->si_newprefID; + cur_aff->ah_newID = 0; + } + } + } + } + else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL) + { + fol = vim_strsave(items[1]); + } + else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL) + { + low = vim_strsave(items[1]); + } + else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL) + { + upp = vim_strsave(items[1]); + } + else if (is_aff_rule(items, itemcnt, "REP", 2) + || is_aff_rule(items, itemcnt, "REPSAL", 2)) + { + /* Ignore REP/REPSAL count */; + if (!isdigit(*items[1])) + smsg((char_u *)_("Expected REP(SAL) count in %s line %d"), + fname, lnum); + } + else if ((STRCMP(items[0], "REP") == 0 + || STRCMP(items[0], "REPSAL") == 0) + && itemcnt >= 3) + { + /* REP/REPSAL item */ + /* Myspell ignores extra arguments, we require it starts with + * # to detect mistakes. */ + if (itemcnt > 3 && items[3][0] != '#') + smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); + if (items[0][3] == 'S' ? do_repsal : do_rep) + { + /* Replace underscore with space (can't include a space + * directly). */ + for (p = items[1]; *p != NUL; MB_PTR_ADV(p)) + if (*p == '_') + *p = ' '; + for (p = items[2]; *p != NUL; MB_PTR_ADV(p)) + if (*p == '_') + *p = ' '; + add_fromto(spin, items[0][3] == 'S' + ? &spin->si_repsal + : &spin->si_rep, items[1], items[2]); + } + } + else if (is_aff_rule(items, itemcnt, "MAP", 2)) + { + /* MAP item or count */ + if (!found_map) + { + /* First line contains the count. */ + found_map = TRUE; + if (!isdigit(*items[1])) + smsg((char_u *)_("Expected MAP count in %s line %d"), + fname, lnum); + } + else if (do_mapline) + { + int c; + + /* Check that every character appears only once. */ + for (p = items[1]; *p != NUL; ) + { +#ifdef FEAT_MBYTE + c = mb_ptr2char_adv(&p); +#else + c = *p++; +#endif + if ((spin->si_map.ga_len > 0 + && vim_strchr(spin->si_map.ga_data, c) + != NULL) + || vim_strchr(p, c) != NULL) + smsg((char_u *)_("Duplicate character in MAP in %s line %d"), + fname, lnum); + } + + /* We simply concatenate all the MAP strings, separated by + * slashes. */ + ga_concat(&spin->si_map, items[1]); + ga_append(&spin->si_map, '/'); + } + } + /* Accept "SAL from to" and "SAL from to #comment". */ + else if (is_aff_rule(items, itemcnt, "SAL", 3)) + { + if (do_sal) + { + /* SAL item (sounds-a-like) + * Either one of the known keys or a from-to pair. */ + if (STRCMP(items[1], "followup") == 0) + spin->si_followup = sal_to_bool(items[2]); + else if (STRCMP(items[1], "collapse_result") == 0) + spin->si_collapse = sal_to_bool(items[2]); + else if (STRCMP(items[1], "remove_accents") == 0) + spin->si_rem_accents = sal_to_bool(items[2]); + else + /* when "to" is "_" it means empty */ + add_fromto(spin, &spin->si_sal, items[1], + STRCMP(items[2], "_") == 0 ? (char_u *)"" + : items[2]); + } + } + else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2) + && sofofrom == NULL) + { + sofofrom = getroom_save(spin, items[1]); + } + else if (is_aff_rule(items, itemcnt, "SOFOTO", 2) + && sofoto == NULL) + { + sofoto = getroom_save(spin, items[1]); + } + else if (STRCMP(items[0], "COMMON") == 0) + { + int i; + + for (i = 1; i < itemcnt; ++i) + { + if (HASHITEM_EMPTY(hash_find(&spin->si_commonwords, + items[i]))) + { + p = vim_strsave(items[i]); + if (p == NULL) + break; + hash_add(&spin->si_commonwords, p); + } + } + } + else + smsg((char_u *)_("Unrecognized or duplicate item in %s line %d: %s"), + fname, lnum, items[0]); + } + } + + if (fol != NULL || low != NULL || upp != NULL) + { + if (spin->si_clear_chartab) + { + /* Clear the char type tables, don't want to use any of the + * currently used spell properties. */ + init_spell_chartab(); + spin->si_clear_chartab = FALSE; + } + + /* + * Don't write a word table for an ASCII file, so that we don't check + * for conflicts with a word table that matches 'encoding'. + * Don't write one for utf-8 either, we use utf_*() and + * mb_get_class(), the list of chars in the file will be incomplete. + */ + if (!spin->si_ascii +#ifdef FEAT_MBYTE + && !enc_utf8 +#endif + ) + { + if (fol == NULL || low == NULL || upp == NULL) + smsg((char_u *)_("Missing FOL/LOW/UPP line in %s"), fname); + else + (void)set_spell_chartab(fol, low, upp); + } + + vim_free(fol); + vim_free(low); + vim_free(upp); + } + + /* Use compound specifications of the .aff file for the spell info. */ + if (compmax != 0) + { + aff_check_number(spin->si_compmax, compmax, "COMPOUNDWORDMAX"); + spin->si_compmax = compmax; + } + + if (compminlen != 0) + { + aff_check_number(spin->si_compminlen, compminlen, "COMPOUNDMIN"); + spin->si_compminlen = compminlen; + } + + if (compsylmax != 0) + { + if (syllable == NULL) + smsg((char_u *)_("COMPOUNDSYLMAX used without SYLLABLE")); + aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); + spin->si_compsylmax = compsylmax; + } + + if (compoptions != 0) + { + aff_check_number(spin->si_compoptions, compoptions, "COMPOUND options"); + spin->si_compoptions |= compoptions; + } + + if (compflags != NULL) + process_compflags(spin, aff, compflags); + + /* Check that we didn't use too many renumbered flags. */ + if (spin->si_newcompID < spin->si_newprefID) + { + if (spin->si_newcompID == 127 || spin->si_newcompID == 255) + MSG(_("Too many postponed prefixes")); + else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) + MSG(_("Too many compound flags")); + else + MSG(_("Too many postponed prefixes and/or compound flags")); + } + + if (syllable != NULL) + { + aff_check_string(spin->si_syllable, syllable, "SYLLABLE"); + spin->si_syllable = syllable; + } + + if (sofofrom != NULL || sofoto != NULL) + { + if (sofofrom == NULL || sofoto == NULL) + smsg((char_u *)_("Missing SOFO%s line in %s"), + sofofrom == NULL ? "FROM" : "TO", fname); + else if (spin->si_sal.ga_len > 0) + smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname); + else + { + aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); + aff_check_string(spin->si_sofoto, sofoto, "SOFOTO"); + spin->si_sofofr = sofofrom; + spin->si_sofoto = sofoto; + } + } + + if (midword != NULL) + { + aff_check_string(spin->si_midword, midword, "MIDWORD"); + spin->si_midword = midword; + } + + vim_free(pc); + fclose(fd); + return aff; +} + +/* + * Return TRUE when items[0] equals "rulename", there are "mincount" items or + * a comment is following after item "mincount". + */ + static int +is_aff_rule( + char_u **items, + int itemcnt, + char *rulename, + int mincount) +{ + return (STRCMP(items[0], rulename) == 0 + && (itemcnt == mincount + || (itemcnt > mincount && items[mincount][0] == '#'))); +} + +/* + * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from + * ae_flags to ae_comppermit and ae_compforbid. + */ + static void +aff_process_flags(afffile_T *affile, affentry_T *entry) +{ + char_u *p; + char_u *prevp; + unsigned flag; + + if (entry->ae_flags != NULL + && (affile->af_compforbid != 0 || affile->af_comppermit != 0)) + { + for (p = entry->ae_flags; *p != NUL; ) + { + prevp = p; + flag = get_affitem(affile->af_flagtype, &p); + if (flag == affile->af_comppermit || flag == affile->af_compforbid) + { + STRMOVE(prevp, p); + p = prevp; + if (flag == affile->af_comppermit) + entry->ae_comppermit = TRUE; + else + entry->ae_compforbid = TRUE; + } + if (affile->af_flagtype == AFT_NUM && *p == ',') + ++p; + } + if (*entry->ae_flags == NUL) + entry->ae_flags = NULL; /* nothing left */ + } +} + +/* + * Return TRUE if "s" is the name of an info item in the affix file. + */ + static int +spell_info_item(char_u *s) +{ + return STRCMP(s, "NAME") == 0 + || STRCMP(s, "HOME") == 0 + || STRCMP(s, "VERSION") == 0 + || STRCMP(s, "AUTHOR") == 0 + || STRCMP(s, "EMAIL") == 0 + || STRCMP(s, "COPYRIGHT") == 0; +} + +/* + * Turn an affix flag name into a number, according to the FLAG type. + * returns zero for failure. + */ + static unsigned +affitem2flag( + int flagtype, + char_u *item, + char_u *fname, + int lnum) +{ + unsigned res; + char_u *p = item; + + res = get_affitem(flagtype, &p); + if (res == 0) + { + if (flagtype == AFT_NUM) + smsg((char_u *)_("Flag is not a number in %s line %d: %s"), + fname, lnum, item); + else + smsg((char_u *)_("Illegal flag in %s line %d: %s"), + fname, lnum, item); + } + if (*p != NUL) + { + smsg((char_u *)_(e_affname), fname, lnum, item); + return 0; + } + + return res; +} + +/* + * Get one affix name from "*pp" and advance the pointer. + * Returns zero for an error, still advances the pointer then. + */ + static unsigned +get_affitem(int flagtype, char_u **pp) +{ + int res; + + if (flagtype == AFT_NUM) + { + if (!VIM_ISDIGIT(**pp)) + { + ++*pp; /* always advance, avoid getting stuck */ + return 0; + } + res = getdigits(pp); + } + else + { +#ifdef FEAT_MBYTE + res = mb_ptr2char_adv(pp); +#else + res = *(*pp)++; +#endif + if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG + && res >= 'A' && res <= 'Z')) + { + if (**pp == NUL) + return 0; +#ifdef FEAT_MBYTE + res = mb_ptr2char_adv(pp) + (res << 16); +#else + res = *(*pp)++ + (res << 16); +#endif + } + } + return res; +} + +/* + * Process the "compflags" string used in an affix file and append it to + * spin->si_compflags. + * The processing involves changing the affix names to ID numbers, so that + * they fit in one byte. + */ + static void +process_compflags( + spellinfo_T *spin, + afffile_T *aff, + char_u *compflags) +{ + char_u *p; + char_u *prevp; + unsigned flag; + compitem_T *ci; + int id; + int len; + char_u *tp; + char_u key[AH_KEY_LEN]; + hashitem_T *hi; + + /* Make room for the old and the new compflags, concatenated with a / in + * between. Processing it makes it shorter, but we don't know by how + * much, thus allocate the maximum. */ + len = (int)STRLEN(compflags) + 1; + if (spin->si_compflags != NULL) + len += (int)STRLEN(spin->si_compflags) + 1; + p = getroom(spin, len, FALSE); + if (p == NULL) + return; + if (spin->si_compflags != NULL) + { + STRCPY(p, spin->si_compflags); + STRCAT(p, "/"); + } + spin->si_compflags = p; + tp = p + STRLEN(p); + + for (p = compflags; *p != NUL; ) + { + if (vim_strchr((char_u *)"/?*+[]", *p) != NULL) + /* Copy non-flag characters directly. */ + *tp++ = *p++; + else + { + /* First get the flag number, also checks validity. */ + prevp = p; + flag = get_affitem(aff->af_flagtype, &p); + if (flag != 0) + { + /* Find the flag in the hashtable. If it was used before, use + * the existing ID. Otherwise add a new entry. */ + vim_strncpy(key, prevp, p - prevp); + hi = hash_find(&aff->af_comp, key); + if (!HASHITEM_EMPTY(hi)) + id = HI2CI(hi)->ci_newID; + else + { + ci = (compitem_T *)getroom(spin, sizeof(compitem_T), TRUE); + if (ci == NULL) + break; + STRCPY(ci->ci_key, key); + ci->ci_flag = flag; + /* Avoid using a flag ID that has a special meaning in a + * regexp (also inside []). */ + do + { + check_renumber(spin); + id = spin->si_newcompID--; + } while (vim_strchr((char_u *)"/?*+[]\\-^", id) != NULL); + ci->ci_newID = id; + hash_add(&aff->af_comp, ci->ci_key); + } + *tp++ = id; + } + if (aff->af_flagtype == AFT_NUM && *p == ',') + ++p; + } + } + + *tp = NUL; +} + +/* + * Check that the new IDs for postponed affixes and compounding don't overrun + * each other. We have almost 255 available, but start at 0-127 to avoid + * using two bytes for utf-8. When the 0-127 range is used up go to 128-255. + * When that is used up an error message is given. + */ + static void +check_renumber(spellinfo_T *spin) +{ + if (spin->si_newprefID == spin->si_newcompID && spin->si_newcompID < 128) + { + spin->si_newprefID = 127; + spin->si_newcompID = 255; + } +} + +/* + * Return TRUE if flag "flag" appears in affix list "afflist". + */ + static int +flag_in_afflist(int flagtype, char_u *afflist, unsigned flag) +{ + char_u *p; + unsigned n; + + switch (flagtype) + { + case AFT_CHAR: + return vim_strchr(afflist, flag) != NULL; + + case AFT_CAPLONG: + case AFT_LONG: + for (p = afflist; *p != NUL; ) + { +#ifdef FEAT_MBYTE + n = mb_ptr2char_adv(&p); +#else + n = *p++; +#endif + if ((flagtype == AFT_LONG || (n >= 'A' && n <= 'Z')) + && *p != NUL) +#ifdef FEAT_MBYTE + n = mb_ptr2char_adv(&p) + (n << 16); +#else + n = *p++ + (n << 16); +#endif + if (n == flag) + return TRUE; + } + break; + + case AFT_NUM: + for (p = afflist; *p != NUL; ) + { + n = getdigits(&p); + if (n == flag) + return TRUE; + if (*p != NUL) /* skip over comma */ + ++p; + } + break; + } + return FALSE; +} + +/* + * Give a warning when "spinval" and "affval" numbers are set and not the same. + */ + static void +aff_check_number(int spinval, int affval, char *name) +{ + if (spinval != 0 && spinval != affval) + smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); +} + +/* + * Give a warning when "spinval" and "affval" strings are set and not the same. + */ + static void +aff_check_string(char_u *spinval, char_u *affval, char *name) +{ + if (spinval != NULL && STRCMP(spinval, affval) != 0) + smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); +} + +/* + * Return TRUE if strings "s1" and "s2" are equal. Also consider both being + * NULL as equal. + */ + static int +str_equal(char_u *s1, char_u *s2) +{ + if (s1 == NULL || s2 == NULL) + return s1 == s2; + return STRCMP(s1, s2) == 0; +} + +/* + * Add a from-to item to "gap". Used for REP and SAL items. + * They are stored case-folded. + */ + static void +add_fromto( + spellinfo_T *spin, + garray_T *gap, + char_u *from, + char_u *to) +{ + fromto_T *ftp; + char_u word[MAXWLEN]; + + if (ga_grow(gap, 1) == OK) + { + ftp = ((fromto_T *)gap->ga_data) + gap->ga_len; + (void)spell_casefold(from, (int)STRLEN(from), word, MAXWLEN); + ftp->ft_from = getroom_save(spin, word); + (void)spell_casefold(to, (int)STRLEN(to), word, MAXWLEN); + ftp->ft_to = getroom_save(spin, word); + ++gap->ga_len; + } +} + +/* + * Convert a boolean argument in a SAL line to TRUE or FALSE; + */ + static int +sal_to_bool(char_u *s) +{ + return STRCMP(s, "1") == 0 || STRCMP(s, "true") == 0; +} + +/* + * Free the structure filled by spell_read_aff(). + */ + static void +spell_free_aff(afffile_T *aff) +{ + hashtab_T *ht; + hashitem_T *hi; + int todo; + affheader_T *ah; + affentry_T *ae; + + vim_free(aff->af_enc); + + /* All this trouble to free the "ae_prog" items... */ + for (ht = &aff->af_pref; ; ht = &aff->af_suff) + { + todo = (int)ht->ht_used; + for (hi = ht->ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + ah = HI2AH(hi); + for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next) + vim_regfree(ae->ae_prog); + } + } + if (ht == &aff->af_suff) + break; + } + + hash_clear(&aff->af_pref); + hash_clear(&aff->af_suff); + hash_clear(&aff->af_comp); +} + +/* + * Read dictionary file "fname". + * Returns OK or FAIL; + */ + static int +spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) +{ + hashtab_T ht; + char_u line[MAXLINELEN]; + char_u *p; + char_u *afflist; + char_u store_afflist[MAXWLEN]; + int pfxlen; + int need_affix; + char_u *dw; + char_u *pc; + char_u *w; + int l; + hash_T hash; + hashitem_T *hi; + FILE *fd; + int lnum = 1; + int non_ascii = 0; + int retval = OK; + char_u message[MAXLINELEN + MAXWLEN]; + int flags; + int duplicate = 0; + + /* + * Open the file. + */ + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + { + EMSG2(_(e_notopen), fname); + return FAIL; + } + + /* The hashtable is only used to detect duplicated words. */ + hash_init(&ht); + + vim_snprintf((char *)IObuff, IOSIZE, + _("Reading dictionary file %s ..."), fname); + spell_message(spin, IObuff); + + /* start with a message for the first line */ + spin->si_msg_count = 999999; + + /* Read and ignore the first line: word count. */ + (void)vim_fgets(line, MAXLINELEN, fd); + if (!vim_isdigit(*skipwhite(line))) + EMSG2(_("E760: No word count in %s"), fname); + + /* + * Read all the lines in the file one by one. + * The words are converted to 'encoding' here, before being added to + * the hashtable. + */ + while (!vim_fgets(line, MAXLINELEN, fd) && !got_int) + { + line_breakcheck(); + ++lnum; + if (line[0] == '#' || line[0] == '/') + continue; /* comment line */ + + /* Remove CR, LF and white space from the end. White space halfway + * the word is kept to allow e.g., "et al.". */ + l = (int)STRLEN(line); + while (l > 0 && line[l - 1] <= ' ') + --l; + if (l == 0) + continue; /* empty line */ + line[l] = NUL; + +#ifdef FEAT_MBYTE + /* Convert from "SET" to 'encoding' when needed. */ + if (spin->si_conv.vc_type != CONV_NONE) + { + pc = string_convert(&spin->si_conv, line, NULL); + if (pc == NULL) + { + smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + fname, lnum, line); + continue; + } + w = pc; + } + else +#endif + { + pc = NULL; + w = line; + } + + /* Truncate the word at the "/", set "afflist" to what follows. + * Replace "\/" by "/" and "\\" by "\". */ + afflist = NULL; + for (p = w; *p != NUL; MB_PTR_ADV(p)) + { + if (*p == '\\' && (p[1] == '\\' || p[1] == '/')) + STRMOVE(p, p + 1); + else if (*p == '/') + { + *p = NUL; + afflist = p + 1; + break; + } + } + + /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */ + if (spin->si_ascii && has_non_ascii(w)) + { + ++non_ascii; + vim_free(pc); + continue; + } + + /* This takes time, print a message every 10000 words. */ + if (spin->si_verbose && spin->si_msg_count > 10000) + { + spin->si_msg_count = 0; + vim_snprintf((char *)message, sizeof(message), + _("line %6d, word %6ld - %s"), + lnum, spin->si_foldwcount + spin->si_keepwcount, w); + msg_start(); + msg_puts_long_attr(message, 0); + msg_clr_eos(); + msg_didout = FALSE; + msg_col = 0; + out_flush(); + } + + /* Store the word in the hashtable to be able to find duplicates. */ + dw = (char_u *)getroom_save(spin, w); + if (dw == NULL) + { + retval = FAIL; + vim_free(pc); + break; + } + + hash = hash_hash(dw); + hi = hash_lookup(&ht, dw, hash); + if (!HASHITEM_EMPTY(hi)) + { + if (p_verbose > 0) + smsg((char_u *)_("Duplicate word in %s line %d: %s"), + fname, lnum, dw); + else if (duplicate == 0) + smsg((char_u *)_("First duplicate word in %s line %d: %s"), + fname, lnum, dw); + ++duplicate; + } + else + hash_add_item(&ht, hi, dw, hash); + + flags = 0; + store_afflist[0] = NUL; + pfxlen = 0; + need_affix = FALSE; + if (afflist != NULL) + { + /* Extract flags from the affix list. */ + flags |= get_affix_flags(affile, afflist); + + if (affile->af_needaffix != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_needaffix)) + need_affix = TRUE; + + if (affile->af_pfxpostpone) + /* Need to store the list of prefix IDs with the word. */ + pfxlen = get_pfxlist(affile, afflist, store_afflist); + + if (spin->si_compflags != NULL) + /* Need to store the list of compound flags with the word. + * Concatenate them to the list of prefix IDs. */ + get_compflags(affile, afflist, store_afflist + pfxlen); + } + + /* Add the word to the word tree(s). */ + if (store_word(spin, dw, flags, spin->si_region, + store_afflist, need_affix) == FAIL) + retval = FAIL; + + if (afflist != NULL) + { + /* Find all matching suffixes and add the resulting words. + * Additionally do matching prefixes that combine. */ + if (store_aff_word(spin, dw, afflist, affile, + &affile->af_suff, &affile->af_pref, + CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) + retval = FAIL; + + /* Find all matching prefixes and add the resulting words. */ + if (store_aff_word(spin, dw, afflist, affile, + &affile->af_pref, NULL, + CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) + retval = FAIL; + } + + vim_free(pc); + } + + if (duplicate > 0) + smsg((char_u *)_("%d duplicate word(s) in %s"), duplicate, fname); + if (spin->si_ascii && non_ascii > 0) + smsg((char_u *)_("Ignored %d word(s) with non-ASCII characters in %s"), + non_ascii, fname); + hash_clear(&ht); + + fclose(fd); + return retval; +} + +/* + * Check for affix flags in "afflist" that are turned into word flags. + * Return WF_ flags. + */ + static int +get_affix_flags(afffile_T *affile, char_u *afflist) +{ + int flags = 0; + + if (affile->af_keepcase != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_keepcase)) + flags |= WF_KEEPCAP | WF_FIXCAP; + if (affile->af_rare != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_rare)) + flags |= WF_RARE; + if (affile->af_bad != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_bad)) + flags |= WF_BANNED; + if (affile->af_needcomp != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_needcomp)) + flags |= WF_NEEDCOMP; + if (affile->af_comproot != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_comproot)) + flags |= WF_COMPROOT; + if (affile->af_nosuggest != 0 && flag_in_afflist( + affile->af_flagtype, afflist, affile->af_nosuggest)) + flags |= WF_NOSUGGEST; + return flags; +} + +/* + * Get the list of prefix IDs from the affix list "afflist". + * Used for PFXPOSTPONE. + * Put the resulting flags in "store_afflist[MAXWLEN]" with a terminating NUL + * and return the number of affixes. + */ + static int +get_pfxlist( + afffile_T *affile, + char_u *afflist, + char_u *store_afflist) +{ + char_u *p; + char_u *prevp; + int cnt = 0; + int id; + char_u key[AH_KEY_LEN]; + hashitem_T *hi; + + for (p = afflist; *p != NUL; ) + { + prevp = p; + if (get_affitem(affile->af_flagtype, &p) != 0) + { + /* A flag is a postponed prefix flag if it appears in "af_pref" + * and it's ID is not zero. */ + vim_strncpy(key, prevp, p - prevp); + hi = hash_find(&affile->af_pref, key); + if (!HASHITEM_EMPTY(hi)) + { + id = HI2AH(hi)->ah_newID; + if (id != 0) + store_afflist[cnt++] = id; + } + } + if (affile->af_flagtype == AFT_NUM && *p == ',') + ++p; + } + + store_afflist[cnt] = NUL; + return cnt; +} + +/* + * Get the list of compound IDs from the affix list "afflist" that are used + * for compound words. + * Puts the flags in "store_afflist[]". + */ + static void +get_compflags( + afffile_T *affile, + char_u *afflist, + char_u *store_afflist) +{ + char_u *p; + char_u *prevp; + int cnt = 0; + char_u key[AH_KEY_LEN]; + hashitem_T *hi; + + for (p = afflist; *p != NUL; ) + { + prevp = p; + if (get_affitem(affile->af_flagtype, &p) != 0) + { + /* A flag is a compound flag if it appears in "af_comp". */ + vim_strncpy(key, prevp, p - prevp); + hi = hash_find(&affile->af_comp, key); + if (!HASHITEM_EMPTY(hi)) + store_afflist[cnt++] = HI2CI(hi)->ci_newID; + } + if (affile->af_flagtype == AFT_NUM && *p == ',') + ++p; + } + + store_afflist[cnt] = NUL; +} + +/* + * Apply affixes to a word and store the resulting words. + * "ht" is the hashtable with affentry_T that need to be applied, either + * prefixes or suffixes. + * "xht", when not NULL, is the prefix hashtable, to be used additionally on + * the resulting words for combining affixes. + * + * Returns FAIL when out of memory. + */ + static int +store_aff_word( + spellinfo_T *spin, /* spell info */ + char_u *word, /* basic word start */ + char_u *afflist, /* list of names of supported affixes */ + afffile_T *affile, + hashtab_T *ht, + hashtab_T *xht, + int condit, /* CONDIT_SUF et al. */ + int flags, /* flags for the word */ + char_u *pfxlist, /* list of prefix IDs */ + int pfxlen) /* nr of flags in "pfxlist" for prefixes, rest + * is compound flags */ +{ + int todo; + hashitem_T *hi; + affheader_T *ah; + affentry_T *ae; + char_u newword[MAXWLEN]; + int retval = OK; + int i, j; + char_u *p; + int use_flags; + char_u *use_pfxlist; + int use_pfxlen; + int need_affix; + char_u store_afflist[MAXWLEN]; + char_u pfx_pfxlist[MAXWLEN]; + size_t wordlen = STRLEN(word); + int use_condit; + + todo = (int)ht->ht_used; + for (hi = ht->ht_array; todo > 0 && retval == OK; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + ah = HI2AH(hi); + + /* Check that the affix combines, if required, and that the word + * supports this affix. */ + if (((condit & CONDIT_COMB) == 0 || ah->ah_combine) + && flag_in_afflist(affile->af_flagtype, afflist, + ah->ah_flag)) + { + /* Loop over all affix entries with this name. */ + for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next) + { + /* Check the condition. It's not logical to match case + * here, but it is required for compatibility with + * Myspell. + * Another requirement from Myspell is that the chop + * string is shorter than the word itself. + * For prefixes, when "PFXPOSTPONE" was used, only do + * prefixes with a chop string and/or flags. + * When a previously added affix had CIRCUMFIX this one + * must have it too, if it had not then this one must not + * have one either. */ + if ((xht != NULL || !affile->af_pfxpostpone + || ae->ae_chop != NULL + || ae->ae_flags != NULL) + && (ae->ae_chop == NULL + || STRLEN(ae->ae_chop) < wordlen) + && (ae->ae_prog == NULL + || vim_regexec_prog(&ae->ae_prog, FALSE, + word, (colnr_T)0)) + && (((condit & CONDIT_CFIX) == 0) + == ((condit & CONDIT_AFF) == 0 + || ae->ae_flags == NULL + || !flag_in_afflist(affile->af_flagtype, + ae->ae_flags, affile->af_circumfix)))) + { + /* Match. Remove the chop and add the affix. */ + if (xht == NULL) + { + /* prefix: chop/add at the start of the word */ + if (ae->ae_add == NULL) + *newword = NUL; + else + vim_strncpy(newword, ae->ae_add, MAXWLEN - 1); + p = word; + if (ae->ae_chop != NULL) + { + /* Skip chop string. */ +#ifdef FEAT_MBYTE + if (has_mbyte) + { + i = mb_charlen(ae->ae_chop); + for ( ; i > 0; --i) + MB_PTR_ADV(p); + } + else +#endif + p += STRLEN(ae->ae_chop); + } + STRCAT(newword, p); + } + else + { + /* suffix: chop/add at the end of the word */ + vim_strncpy(newword, word, MAXWLEN - 1); + if (ae->ae_chop != NULL) + { + /* Remove chop string. */ + p = newword + STRLEN(newword); + i = (int)MB_CHARLEN(ae->ae_chop); + for ( ; i > 0; --i) + MB_PTR_BACK(newword, p); + *p = NUL; + } + if (ae->ae_add != NULL) + STRCAT(newword, ae->ae_add); + } + + use_flags = flags; + use_pfxlist = pfxlist; + use_pfxlen = pfxlen; + need_affix = FALSE; + use_condit = condit | CONDIT_COMB | CONDIT_AFF; + if (ae->ae_flags != NULL) + { + /* Extract flags from the affix list. */ + use_flags |= get_affix_flags(affile, ae->ae_flags); + + if (affile->af_needaffix != 0 && flag_in_afflist( + affile->af_flagtype, ae->ae_flags, + affile->af_needaffix)) + need_affix = TRUE; + + /* When there is a CIRCUMFIX flag the other affix + * must also have it and we don't add the word + * with one affix. */ + if (affile->af_circumfix != 0 && flag_in_afflist( + affile->af_flagtype, ae->ae_flags, + affile->af_circumfix)) + { + use_condit |= CONDIT_CFIX; + if ((condit & CONDIT_CFIX) == 0) + need_affix = TRUE; + } + + if (affile->af_pfxpostpone + || spin->si_compflags != NULL) + { + if (affile->af_pfxpostpone) + /* Get prefix IDS from the affix list. */ + use_pfxlen = get_pfxlist(affile, + ae->ae_flags, store_afflist); + else + use_pfxlen = 0; + use_pfxlist = store_afflist; + + /* Combine the prefix IDs. Avoid adding the + * same ID twice. */ + for (i = 0; i < pfxlen; ++i) + { + for (j = 0; j < use_pfxlen; ++j) + if (pfxlist[i] == use_pfxlist[j]) + break; + if (j == use_pfxlen) + use_pfxlist[use_pfxlen++] = pfxlist[i]; + } + + if (spin->si_compflags != NULL) + /* Get compound IDS from the affix list. */ + get_compflags(affile, ae->ae_flags, + use_pfxlist + use_pfxlen); + + /* Combine the list of compound flags. + * Concatenate them to the prefix IDs list. + * Avoid adding the same ID twice. */ + for (i = pfxlen; pfxlist[i] != NUL; ++i) + { + for (j = use_pfxlen; + use_pfxlist[j] != NUL; ++j) + if (pfxlist[i] == use_pfxlist[j]) + break; + if (use_pfxlist[j] == NUL) + { + use_pfxlist[j++] = pfxlist[i]; + use_pfxlist[j] = NUL; + } + } + } + } + + /* Obey a "COMPOUNDFORBIDFLAG" of the affix: don't + * use the compound flags. */ + if (use_pfxlist != NULL && ae->ae_compforbid) + { + vim_strncpy(pfx_pfxlist, use_pfxlist, use_pfxlen); + use_pfxlist = pfx_pfxlist; + } + + /* When there are postponed prefixes... */ + if (spin->si_prefroot != NULL + && spin->si_prefroot->wn_sibling != NULL) + { + /* ... add a flag to indicate an affix was used. */ + use_flags |= WF_HAS_AFF; + + /* ... don't use a prefix list if combining + * affixes is not allowed. But do use the + * compound flags after them. */ + if (!ah->ah_combine && use_pfxlist != NULL) + use_pfxlist += use_pfxlen; + } + + /* When compounding is supported and there is no + * "COMPOUNDPERMITFLAG" then forbid compounding on the + * side where the affix is applied. */ + if (spin->si_compflags != NULL && !ae->ae_comppermit) + { + if (xht != NULL) + use_flags |= WF_NOCOMPAFT; + else + use_flags |= WF_NOCOMPBEF; + } + + /* Store the modified word. */ + if (store_word(spin, newword, use_flags, + spin->si_region, use_pfxlist, + need_affix) == FAIL) + retval = FAIL; + + /* When added a prefix or a first suffix and the affix + * has flags may add a(nother) suffix. RECURSIVE! */ + if ((condit & CONDIT_SUF) && ae->ae_flags != NULL) + if (store_aff_word(spin, newword, ae->ae_flags, + affile, &affile->af_suff, xht, + use_condit & (xht == NULL + ? ~0 : ~CONDIT_SUF), + use_flags, use_pfxlist, pfxlen) == FAIL) + retval = FAIL; + + /* When added a suffix and combining is allowed also + * try adding a prefix additionally. Both for the + * word flags and for the affix flags. RECURSIVE! */ + if (xht != NULL && ah->ah_combine) + { + if (store_aff_word(spin, newword, + afflist, affile, + xht, NULL, use_condit, + use_flags, use_pfxlist, + pfxlen) == FAIL + || (ae->ae_flags != NULL + && store_aff_word(spin, newword, + ae->ae_flags, affile, + xht, NULL, use_condit, + use_flags, use_pfxlist, + pfxlen) == FAIL)) + retval = FAIL; + } + } + } + } + } + } + + return retval; +} + +/* + * Read a file with a list of words. + */ + static int +spell_read_wordfile(spellinfo_T *spin, char_u *fname) +{ + FILE *fd; + long lnum = 0; + char_u rline[MAXLINELEN]; + char_u *line; + char_u *pc = NULL; + char_u *p; + int l; + int retval = OK; + int did_word = FALSE; + int non_ascii = 0; + int flags; + int regionmask; + + /* + * Open the file. + */ + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + { + EMSG2(_(e_notopen), fname); + return FAIL; + } + + vim_snprintf((char *)IObuff, IOSIZE, _("Reading word file %s ..."), fname); + spell_message(spin, IObuff); + + /* + * Read all the lines in the file one by one. + */ + while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) + { + line_breakcheck(); + ++lnum; + + /* Skip comment lines. */ + if (*rline == '#') + continue; + + /* Remove CR, LF and white space from the end. */ + l = (int)STRLEN(rline); + while (l > 0 && rline[l - 1] <= ' ') + --l; + if (l == 0) + continue; /* empty or blank line */ + rline[l] = NUL; + + /* Convert from "/encoding={encoding}" to 'encoding' when needed. */ + vim_free(pc); +#ifdef FEAT_MBYTE + if (spin->si_conv.vc_type != CONV_NONE) + { + pc = string_convert(&spin->si_conv, rline, NULL); + if (pc == NULL) + { + smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + fname, lnum, rline); + continue; + } + line = pc; + } + else +#endif + { + pc = NULL; + line = rline; + } + + if (*line == '/') + { + ++line; + if (STRNCMP(line, "encoding=", 9) == 0) + { + if (spin->si_conv.vc_type != CONV_NONE) + smsg((char_u *)_("Duplicate /encoding= line ignored in %s line %d: %s"), + fname, lnum, line - 1); + else if (did_word) + smsg((char_u *)_("/encoding= line after word ignored in %s line %d: %s"), + fname, lnum, line - 1); + else + { +#ifdef FEAT_MBYTE + char_u *enc; + + /* Setup for conversion to 'encoding'. */ + line += 9; + enc = enc_canonize(line); + if (enc != NULL && !spin->si_ascii + && convert_setup(&spin->si_conv, enc, + p_enc) == FAIL) + smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), + fname, line, p_enc); + vim_free(enc); + spin->si_conv.vc_fail = TRUE; +#else + smsg((char_u *)_("Conversion in %s not supported"), fname); +#endif + } + continue; + } + + if (STRNCMP(line, "regions=", 8) == 0) + { + if (spin->si_region_count > 1) + smsg((char_u *)_("Duplicate /regions= line ignored in %s line %d: %s"), + fname, lnum, line); + else + { + line += 8; + if (STRLEN(line) > MAXREGIONS * 2) + smsg((char_u *)_("Too many regions in %s line %d: %s"), + fname, lnum, line); + else + { + spin->si_region_count = (int)STRLEN(line) / 2; + STRCPY(spin->si_region_name, line); + + /* Adjust the mask for a word valid in all regions. */ + spin->si_region = (1 << spin->si_region_count) - 1; + } + } + continue; + } + + smsg((char_u *)_("/ line ignored in %s line %d: %s"), + fname, lnum, line - 1); + continue; + } + + flags = 0; + regionmask = spin->si_region; + + /* Check for flags and region after a slash. */ + p = vim_strchr(line, '/'); + if (p != NULL) + { + *p++ = NUL; + while (*p != NUL) + { + if (*p == '=') /* keep-case word */ + flags |= WF_KEEPCAP | WF_FIXCAP; + else if (*p == '!') /* Bad, bad, wicked word. */ + flags |= WF_BANNED; + else if (*p == '?') /* Rare word. */ + flags |= WF_RARE; + else if (VIM_ISDIGIT(*p)) /* region number(s) */ + { + if ((flags & WF_REGION) == 0) /* first one */ + regionmask = 0; + flags |= WF_REGION; + + l = *p - '0'; + if (l == 0 || l > spin->si_region_count) + { + smsg((char_u *)_("Invalid region nr in %s line %d: %s"), + fname, lnum, p); + break; + } + regionmask |= 1 << (l - 1); + } + else + { + smsg((char_u *)_("Unrecognized flags in %s line %d: %s"), + fname, lnum, p); + break; + } + ++p; + } + } + + /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */ + if (spin->si_ascii && has_non_ascii(line)) + { + ++non_ascii; + continue; + } + + /* Normal word: store it. */ + if (store_word(spin, line, flags, regionmask, NULL, FALSE) == FAIL) + { + retval = FAIL; + break; + } + did_word = TRUE; + } + + vim_free(pc); + fclose(fd); + + if (spin->si_ascii && non_ascii > 0) + { + vim_snprintf((char *)IObuff, IOSIZE, + _("Ignored %d words with non-ASCII characters"), non_ascii); + spell_message(spin, IObuff); + } + + return retval; +} + +/* + * Get part of an sblock_T, "len" bytes long. + * This avoids calling free() for every little struct we use (and keeping + * track of them). + * The memory is cleared to all zeros. + * Returns NULL when out of memory. + */ + static void * +getroom( + spellinfo_T *spin, + size_t len, /* length needed */ + int align) /* align for pointer */ +{ + char_u *p; + sblock_T *bl = spin->si_blocks; + + if (align && bl != NULL) + /* Round size up for alignment. On some systems structures need to be + * aligned to the size of a pointer (e.g., SPARC). */ + bl->sb_used = (bl->sb_used + sizeof(char *) - 1) + & ~(sizeof(char *) - 1); + + if (bl == NULL || bl->sb_used + len > SBLOCKSIZE) + { + if (len >= SBLOCKSIZE) + bl = NULL; + else + /* Allocate a block of memory. It is not freed until much later. */ + bl = (sblock_T *)alloc_clear( + (unsigned)(sizeof(sblock_T) + SBLOCKSIZE)); + if (bl == NULL) + { + if (!spin->si_did_emsg) + { + EMSG(_("E845: Insufficient memory, word list will be incomplete")); + spin->si_did_emsg = TRUE; + } + return NULL; + } + bl->sb_next = spin->si_blocks; + spin->si_blocks = bl; + bl->sb_used = 0; + ++spin->si_blocks_cnt; + } + + p = bl->sb_data + bl->sb_used; + bl->sb_used += (int)len; + + return p; +} + +/* + * Make a copy of a string into memory allocated with getroom(). + * Returns NULL when out of memory. + */ + static char_u * +getroom_save(spellinfo_T *spin, char_u *s) +{ + char_u *sc; + + sc = (char_u *)getroom(spin, STRLEN(s) + 1, FALSE); + if (sc != NULL) + STRCPY(sc, s); + return sc; +} + + +/* + * Free the list of allocated sblock_T. + */ + static void +free_blocks(sblock_T *bl) +{ + sblock_T *next; + + while (bl != NULL) + { + next = bl->sb_next; + vim_free(bl); + bl = next; + } +} + +/* + * Allocate the root of a word tree. + * Returns NULL when out of memory. + */ + static wordnode_T * +wordtree_alloc(spellinfo_T *spin) +{ + return (wordnode_T *)getroom(spin, sizeof(wordnode_T), TRUE); +} + +/* + * Store a word in the tree(s). + * Always store it in the case-folded tree. For a keep-case word this is + * useful when the word can also be used with all caps (no WF_FIXCAP flag) and + * used to find suggestions. + * For a keep-case word also store it in the keep-case tree. + * When "pfxlist" is not NULL store the word for each postponed prefix ID and + * compound flag. + */ + static int +store_word( + spellinfo_T *spin, + char_u *word, + int flags, /* extra flags, WF_BANNED */ + int region, /* supported region(s) */ + char_u *pfxlist, /* list of prefix IDs or NULL */ + int need_affix) /* only store word with affix ID */ +{ + int len = (int)STRLEN(word); + int ct = captype(word, word + len); + char_u foldword[MAXWLEN]; + int res = OK; + char_u *p; + + (void)spell_casefold(word, len, foldword, MAXWLEN); + for (p = pfxlist; res == OK; ++p) + { + if (!need_affix || (p != NULL && *p != NUL)) + res = tree_add_word(spin, foldword, spin->si_foldroot, ct | flags, + region, p == NULL ? 0 : *p); + if (p == NULL || *p == NUL) + break; + } + ++spin->si_foldwcount; + + if (res == OK && (ct == WF_KEEPCAP || (flags & WF_KEEPCAP))) + { + for (p = pfxlist; res == OK; ++p) + { + if (!need_affix || (p != NULL && *p != NUL)) + res = tree_add_word(spin, word, spin->si_keeproot, flags, + region, p == NULL ? 0 : *p); + if (p == NULL || *p == NUL) + break; + } + ++spin->si_keepwcount; + } + return res; +} + +/* + * Add word "word" to a word tree at "root". + * When "flags" < 0 we are adding to the prefix tree where "flags" is used for + * "rare" and "region" is the condition nr. + * Returns FAIL when out of memory. + */ + static int +tree_add_word( + spellinfo_T *spin, + char_u *word, + wordnode_T *root, + int flags, + int region, + int affixID) +{ + wordnode_T *node = root; + wordnode_T *np; + wordnode_T *copyp, **copyprev; + wordnode_T **prev = NULL; + int i; + + /* Add each byte of the word to the tree, including the NUL at the end. */ + for (i = 0; ; ++i) + { + /* When there is more than one reference to this node we need to make + * a copy, so that we can modify it. Copy the whole list of siblings + * (we don't optimize for a partly shared list of siblings). */ + if (node != NULL && node->wn_refs > 1) + { + --node->wn_refs; + copyprev = prev; + for (copyp = node; copyp != NULL; copyp = copyp->wn_sibling) + { + /* Allocate a new node and copy the info. */ + np = get_wordnode(spin); + if (np == NULL) + return FAIL; + np->wn_child = copyp->wn_child; + if (np->wn_child != NULL) + ++np->wn_child->wn_refs; /* child gets extra ref */ + np->wn_byte = copyp->wn_byte; + if (np->wn_byte == NUL) + { + np->wn_flags = copyp->wn_flags; + np->wn_region = copyp->wn_region; + np->wn_affixID = copyp->wn_affixID; + } + + /* Link the new node in the list, there will be one ref. */ + np->wn_refs = 1; + if (copyprev != NULL) + *copyprev = np; + copyprev = &np->wn_sibling; + + /* Let "node" point to the head of the copied list. */ + if (copyp == node) + node = np; + } + } + + /* Look for the sibling that has the same character. They are sorted + * on byte value, thus stop searching when a sibling is found with a + * higher byte value. For zero bytes (end of word) the sorting is + * done on flags and then on affixID. */ + while (node != NULL + && (node->wn_byte < word[i] + || (node->wn_byte == NUL + && (flags < 0 + ? node->wn_affixID < (unsigned)affixID + : (node->wn_flags < (unsigned)(flags & WN_MASK) + || (node->wn_flags == (flags & WN_MASK) + && (spin->si_sugtree + ? (node->wn_region & 0xffff) < region + : node->wn_affixID + < (unsigned)affixID))))))) + { + prev = &node->wn_sibling; + node = *prev; + } + if (node == NULL + || node->wn_byte != word[i] + || (word[i] == NUL + && (flags < 0 + || spin->si_sugtree + || node->wn_flags != (flags & WN_MASK) + || node->wn_affixID != affixID))) + { + /* Allocate a new node. */ + np = get_wordnode(spin); + if (np == NULL) + return FAIL; + np->wn_byte = word[i]; + + /* If "node" is NULL this is a new child or the end of the sibling + * list: ref count is one. Otherwise use ref count of sibling and + * make ref count of sibling one (matters when inserting in front + * of the list of siblings). */ + if (node == NULL) + np->wn_refs = 1; + else + { + np->wn_refs = node->wn_refs; + node->wn_refs = 1; + } + if (prev != NULL) + *prev = np; + np->wn_sibling = node; + node = np; + } + + if (word[i] == NUL) + { + node->wn_flags = flags; + node->wn_region |= region; + node->wn_affixID = affixID; + break; + } + prev = &node->wn_child; + node = *prev; + } +#ifdef SPELL_PRINTTREE + smsg((char_u *)"Added \"%s\"", word); + spell_print_tree(root->wn_sibling); +#endif + + /* count nr of words added since last message */ + ++spin->si_msg_count; + + if (spin->si_compress_cnt > 1) + { + if (--spin->si_compress_cnt == 1) + /* Did enough words to lower the block count limit. */ + spin->si_blocks_cnt += compress_inc; + } + + /* + * When we have allocated lots of memory we need to compress the word tree + * to free up some room. But compression is slow, and we might actually + * need that room, thus only compress in the following situations: + * 1. When not compressed before (si_compress_cnt == 0): when using + * "compress_start" blocks. + * 2. When compressed before and used "compress_inc" blocks before + * adding "compress_added" words (si_compress_cnt > 1). + * 3. When compressed before, added "compress_added" words + * (si_compress_cnt == 1) and the number of free nodes drops below the + * maximum word length. + */ +#ifndef SPELL_COMPRESS_ALLWAYS + if (spin->si_compress_cnt == 1 + ? spin->si_free_count < MAXWLEN + : spin->si_blocks_cnt >= compress_start) +#endif + { + /* Decrement the block counter. The effect is that we compress again + * when the freed up room has been used and another "compress_inc" + * blocks have been allocated. Unless "compress_added" words have + * been added, then the limit is put back again. */ + spin->si_blocks_cnt -= compress_inc; + spin->si_compress_cnt = compress_added; + + if (spin->si_verbose) + { + msg_start(); + msg_puts((char_u *)_(msg_compressing)); + msg_clr_eos(); + msg_didout = FALSE; + msg_col = 0; + out_flush(); + } + + /* Compress both trees. Either they both have many nodes, which makes + * compression useful, or one of them is small, which means + * compression goes fast. But when filling the soundfold word tree + * there is no keep-case tree. */ + wordtree_compress(spin, spin->si_foldroot); + if (affixID >= 0) + wordtree_compress(spin, spin->si_keeproot); + } + + return OK; +} + +/* + * Get a wordnode_T, either from the list of previously freed nodes or + * allocate a new one. + * Returns NULL when out of memory. + */ + static wordnode_T * +get_wordnode(spellinfo_T *spin) +{ + wordnode_T *n; + + if (spin->si_first_free == NULL) + n = (wordnode_T *)getroom(spin, sizeof(wordnode_T), TRUE); + else + { + n = spin->si_first_free; + spin->si_first_free = n->wn_child; + vim_memset(n, 0, sizeof(wordnode_T)); + --spin->si_free_count; + } +#ifdef SPELL_PRINTTREE + if (n != NULL) + n->wn_nr = ++spin->si_wordnode_nr; +#endif + return n; +} + +/* + * Decrement the reference count on a node (which is the head of a list of + * siblings). If the reference count becomes zero free the node and its + * siblings. + * Returns the number of nodes actually freed. + */ + static int +deref_wordnode(spellinfo_T *spin, wordnode_T *node) +{ + wordnode_T *np; + int cnt = 0; + + if (--node->wn_refs == 0) + { + for (np = node; np != NULL; np = np->wn_sibling) + { + if (np->wn_child != NULL) + cnt += deref_wordnode(spin, np->wn_child); + free_wordnode(spin, np); + ++cnt; + } + ++cnt; /* length field */ + } + return cnt; +} + +/* + * Free a wordnode_T for re-use later. + * Only the "wn_child" field becomes invalid. + */ + static void +free_wordnode(spellinfo_T *spin, wordnode_T *n) +{ + n->wn_child = spin->si_first_free; + spin->si_first_free = n; + ++spin->si_free_count; +} + +/* + * Compress a tree: find tails that are identical and can be shared. + */ + static void +wordtree_compress(spellinfo_T *spin, wordnode_T *root) +{ + hashtab_T ht; + int n; + int tot = 0; + int perc; + + /* Skip the root itself, it's not actually used. The first sibling is the + * start of the tree. */ + if (root->wn_sibling != NULL) + { + hash_init(&ht); + n = node_compress(spin, root->wn_sibling, &ht, &tot); + +#ifndef SPELL_PRINTTREE + if (spin->si_verbose || p_verbose > 2) +#endif + { + if (tot > 1000000) + perc = (tot - n) / (tot / 100); + else if (tot == 0) + perc = 0; + else + perc = (tot - n) * 100 / tot; + vim_snprintf((char *)IObuff, IOSIZE, + _("Compressed %d of %d nodes; %d (%d%%) remaining"), + n, tot, tot - n, perc); + spell_message(spin, IObuff); + } +#ifdef SPELL_PRINTTREE + spell_print_tree(root->wn_sibling); +#endif + hash_clear(&ht); + } +} + +/* + * Compress a node, its siblings and its children, depth first. + * Returns the number of compressed nodes. + */ + static int +node_compress( + spellinfo_T *spin, + wordnode_T *node, + hashtab_T *ht, + int *tot) /* total count of nodes before compressing, + incremented while going through the tree */ +{ + wordnode_T *np; + wordnode_T *tp; + wordnode_T *child; + hash_T hash; + hashitem_T *hi; + int len = 0; + unsigned nr, n; + int compressed = 0; + + /* + * Go through the list of siblings. Compress each child and then try + * finding an identical child to replace it. + * Note that with "child" we mean not just the node that is pointed to, + * but the whole list of siblings of which the child node is the first. + */ + for (np = node; np != NULL && !got_int; np = np->wn_sibling) + { + ++len; + if ((child = np->wn_child) != NULL) + { + /* Compress the child first. This fills hashkey. */ + compressed += node_compress(spin, child, ht, tot); + + /* Try to find an identical child. */ + hash = hash_hash(child->wn_u1.hashkey); + hi = hash_lookup(ht, child->wn_u1.hashkey, hash); + if (!HASHITEM_EMPTY(hi)) + { + /* There are children we encountered before with a hash value + * identical to the current child. Now check if there is one + * that is really identical. */ + for (tp = HI2WN(hi); tp != NULL; tp = tp->wn_u2.next) + if (node_equal(child, tp)) + { + /* Found one! Now use that child in place of the + * current one. This means the current child and all + * its siblings is unlinked from the tree. */ + ++tp->wn_refs; + compressed += deref_wordnode(spin, child); + np->wn_child = tp; + break; + } + if (tp == NULL) + { + /* No other child with this hash value equals the child of + * the node, add it to the linked list after the first + * item. */ + tp = HI2WN(hi); + child->wn_u2.next = tp->wn_u2.next; + tp->wn_u2.next = child; + } + } + else + /* No other child has this hash value, add it to the + * hashtable. */ + hash_add_item(ht, hi, child->wn_u1.hashkey, hash); + } + } + *tot += len + 1; /* add one for the node that stores the length */ + + /* + * Make a hash key for the node and its siblings, so that we can quickly + * find a lookalike node. This must be done after compressing the sibling + * list, otherwise the hash key would become invalid by the compression. + */ + node->wn_u1.hashkey[0] = len; + nr = 0; + for (np = node; np != NULL; np = np->wn_sibling) + { + if (np->wn_byte == NUL) + /* end node: use wn_flags, wn_region and wn_affixID */ + n = np->wn_flags + (np->wn_region << 8) + (np->wn_affixID << 16); + else + /* byte node: use the byte value and the child pointer */ + n = (unsigned)(np->wn_byte + ((long_u)np->wn_child << 8)); + nr = nr * 101 + n; + } + + /* Avoid NUL bytes, it terminates the hash key. */ + n = nr & 0xff; + node->wn_u1.hashkey[1] = n == 0 ? 1 : n; + n = (nr >> 8) & 0xff; + node->wn_u1.hashkey[2] = n == 0 ? 1 : n; + n = (nr >> 16) & 0xff; + node->wn_u1.hashkey[3] = n == 0 ? 1 : n; + n = (nr >> 24) & 0xff; + node->wn_u1.hashkey[4] = n == 0 ? 1 : n; + node->wn_u1.hashkey[5] = NUL; + + /* Check for CTRL-C pressed now and then. */ + fast_breakcheck(); + + return compressed; +} + +/* + * Return TRUE when two nodes have identical siblings and children. + */ + static int +node_equal(wordnode_T *n1, wordnode_T *n2) +{ + wordnode_T *p1; + wordnode_T *p2; + + for (p1 = n1, p2 = n2; p1 != NULL && p2 != NULL; + p1 = p1->wn_sibling, p2 = p2->wn_sibling) + if (p1->wn_byte != p2->wn_byte + || (p1->wn_byte == NUL + ? (p1->wn_flags != p2->wn_flags + || p1->wn_region != p2->wn_region + || p1->wn_affixID != p2->wn_affixID) + : (p1->wn_child != p2->wn_child))) + break; + + return p1 == NULL && p2 == NULL; +} + +static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +rep_compare(const void *s1, const void *s2); + +/* + * Function given to qsort() to sort the REP items on "from" string. + */ + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +rep_compare(const void *s1, const void *s2) +{ + fromto_T *p1 = (fromto_T *)s1; + fromto_T *p2 = (fromto_T *)s2; + + return STRCMP(p1->ft_from, p2->ft_from); +} + +/* + * Write the Vim .spl file "fname". + * Return FAIL or OK; + */ + static int +write_vim_spell(spellinfo_T *spin, char_u *fname) +{ + FILE *fd; + int regionmask; + int round; + wordnode_T *tree; + int nodecount; + int i; + int l; + garray_T *gap; + fromto_T *ftp; + char_u *p; + int rr; + int retval = OK; + size_t fwv = 1; /* collect return value of fwrite() to avoid + warnings from picky compiler */ + + fd = mch_fopen((char *)fname, "w"); + if (fd == NULL) + { + EMSG2(_(e_notopen), fname); + return FAIL; + } + + /* <HEADER>: <fileID> <versionnr> */ + /* <fileID> */ + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); + if (fwv != (size_t)1) + /* Catch first write error, don't try writing more. */ + goto theend; + + putc(VIMSPELLVERSION, fd); /* <versionnr> */ + + /* + * <SECTIONS>: <section> ... <sectionend> + */ + + /* SN_INFO: <infotext> */ + if (spin->si_info != NULL) + { + putc(SN_INFO, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + i = (int)STRLEN(spin->si_info); + put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ + } + + /* SN_REGION: <regionname> ... + * Write the region names only if there is more than one. */ + if (spin->si_region_count > 1) + { + putc(SN_REGION, fd); /* <sectionID> */ + putc(SNF_REQUIRED, fd); /* <sectionflags> */ + l = spin->si_region_count * 2; + put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); + /* <regionname> ... */ + regionmask = (1 << spin->si_region_count) - 1; + } + else + regionmask = 0; + + /* SN_CHARFLAGS: <charflagslen> <charflags> <folcharslen> <folchars> + * + * The table with character flags and the table for case folding. + * This makes sure the same characters are recognized as word characters + * when generating an when using a spell file. + * Skip this for ASCII, the table may conflict with the one used for + * 'encoding'. + * Also skip this for an .add.spl file, the main spell file must contain + * the table (avoids that it conflicts). File is shorter too. + */ + if (!spin->si_ascii && !spin->si_add) + { + char_u folchars[128 * 8]; + int flags; + + putc(SN_CHARFLAGS, fd); /* <sectionID> */ + putc(SNF_REQUIRED, fd); /* <sectionflags> */ + + /* Form the <folchars> string first, we need to know its length. */ + l = 0; + for (i = 128; i < 256; ++i) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + l += mb_char2bytes(spelltab.st_fold[i], folchars + l); + else +#endif + folchars[l++] = spelltab.st_fold[i]; + } + put_bytes(fd, (long_u)(1 + 128 + 2 + l), 4); /* <sectionlen> */ + + fputc(128, fd); /* <charflagslen> */ + for (i = 128; i < 256; ++i) + { + flags = 0; + if (spelltab.st_isw[i]) + flags |= CF_WORD; + if (spelltab.st_isu[i]) + flags |= CF_UPPER; + fputc(flags, fd); /* <charflags> */ + } + + put_bytes(fd, (long_u)l, 2); /* <folcharslen> */ + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */ + } + + /* SN_MIDWORD: <midword> */ + if (spin->si_midword != NULL) + { + putc(SN_MIDWORD, fd); /* <sectionID> */ + putc(SNF_REQUIRED, fd); /* <sectionflags> */ + + i = (int)STRLEN(spin->si_midword); + put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); + /* <midword> */ + } + + /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */ + if (spin->si_prefcond.ga_len > 0) + { + putc(SN_PREFCOND, fd); /* <sectionID> */ + putc(SNF_REQUIRED, fd); /* <sectionflags> */ + + l = write_spell_prefcond(NULL, &spin->si_prefcond); + put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ + + write_spell_prefcond(fd, &spin->si_prefcond); + } + + /* SN_REP: <repcount> <rep> ... + * SN_SAL: <salflags> <salcount> <sal> ... + * SN_REPSAL: <repcount> <rep> ... */ + + /* round 1: SN_REP section + * round 2: SN_SAL section (unless SN_SOFO is used) + * round 3: SN_REPSAL section */ + for (round = 1; round <= 3; ++round) + { + if (round == 1) + gap = &spin->si_rep; + else if (round == 2) + { + /* Don't write SN_SAL when using a SN_SOFO section */ + if (spin->si_sofofr != NULL && spin->si_sofoto != NULL) + continue; + gap = &spin->si_sal; + } + else + gap = &spin->si_repsal; + + /* Don't write the section if there are no items. */ + if (gap->ga_len == 0) + continue; + + /* Sort the REP/REPSAL items. */ + if (round != 2) + qsort(gap->ga_data, (size_t)gap->ga_len, + sizeof(fromto_T), rep_compare); + + i = round == 1 ? SN_REP : (round == 2 ? SN_SAL : SN_REPSAL); + putc(i, fd); /* <sectionID> */ + + /* This is for making suggestions, section is not required. */ + putc(0, fd); /* <sectionflags> */ + + /* Compute the length of what follows. */ + l = 2; /* count <repcount> or <salcount> */ + for (i = 0; i < gap->ga_len; ++i) + { + ftp = &((fromto_T *)gap->ga_data)[i]; + l += 1 + (int)STRLEN(ftp->ft_from); /* count <*fromlen> and <*from> */ + l += 1 + (int)STRLEN(ftp->ft_to); /* count <*tolen> and <*to> */ + } + if (round == 2) + ++l; /* count <salflags> */ + put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ + + if (round == 2) + { + i = 0; + if (spin->si_followup) + i |= SAL_F0LLOWUP; + if (spin->si_collapse) + i |= SAL_COLLAPSE; + if (spin->si_rem_accents) + i |= SAL_REM_ACCENTS; + putc(i, fd); /* <salflags> */ + } + + put_bytes(fd, (long_u)gap->ga_len, 2); /* <repcount> or <salcount> */ + for (i = 0; i < gap->ga_len; ++i) + { + /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */ + /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */ + ftp = &((fromto_T *)gap->ga_data)[i]; + for (rr = 1; rr <= 2; ++rr) + { + p = rr == 1 ? ftp->ft_from : ftp->ft_to; + l = (int)STRLEN(p); + putc(l, fd); + if (l > 0) + fwv &= fwrite(p, l, (size_t)1, fd); + } + } + + } + + /* SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto> + * This is for making suggestions, section is not required. */ + if (spin->si_sofofr != NULL && spin->si_sofoto != NULL) + { + putc(SN_SOFO, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + l = (int)STRLEN(spin->si_sofofr); + put_bytes(fd, (long_u)(l + STRLEN(spin->si_sofoto) + 4), 4); + /* <sectionlen> */ + + put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */ + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */ + + l = (int)STRLEN(spin->si_sofoto); + put_bytes(fd, (long_u)l, 2); /* <sofotolen> */ + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */ + } + + /* SN_WORDS: <word> ... + * This is for making suggestions, section is not required. */ + if (spin->si_commonwords.ht_used > 0) + { + putc(SN_WORDS, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + /* round 1: count the bytes + * round 2: write the bytes */ + for (round = 1; round <= 2; ++round) + { + int todo; + int len = 0; + hashitem_T *hi; + + todo = (int)spin->si_commonwords.ht_used; + for (hi = spin->si_commonwords.ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + l = (int)STRLEN(hi->hi_key) + 1; + len += l; + if (round == 2) /* <word> */ + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); + --todo; + } + if (round == 1) + put_bytes(fd, (long_u)len, 4); /* <sectionlen> */ + } + } + + /* SN_MAP: <mapstr> + * This is for making suggestions, section is not required. */ + if (spin->si_map.ga_len > 0) + { + putc(SN_MAP, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + l = spin->si_map.ga_len; + put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); + /* <mapstr> */ + } + + /* SN_SUGFILE: <timestamp> + * This is used to notify that a .sug file may be available and at the + * same time allows for checking that a .sug file that is found matches + * with this .spl file. That's because the word numbers must be exactly + * right. */ + if (!spin->si_nosugfile + && (spin->si_sal.ga_len > 0 + || (spin->si_sofofr != NULL && spin->si_sofoto != NULL))) + { + putc(SN_SUGFILE, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + put_bytes(fd, (long_u)8, 4); /* <sectionlen> */ + + /* Set si_sugtime and write it to the file. */ + spin->si_sugtime = time(NULL); + put_time(fd, spin->si_sugtime); /* <timestamp> */ + } + + /* SN_NOSPLITSUGS: nothing + * This is used to notify that no suggestions with word splits are to be + * made. */ + if (spin->si_nosplitsugs) + { + putc(SN_NOSPLITSUGS, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + put_bytes(fd, (long_u)0, 4); /* <sectionlen> */ + } + + /* SN_NOCOMPUNDSUGS: nothing + * This is used to notify that no suggestions with compounds are to be + * made. */ + if (spin->si_nocompoundsugs) + { + putc(SN_NOCOMPOUNDSUGS, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + put_bytes(fd, (long_u)0, 4); /* <sectionlen> */ + } + + /* SN_COMPOUND: compound info. + * We don't mark it required, when not supported all compound words will + * be bad words. */ + if (spin->si_compflags != NULL) + { + putc(SN_COMPOUND, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + l = (int)STRLEN(spin->si_compflags); + for (i = 0; i < spin->si_comppat.ga_len; ++i) + l += (int)STRLEN(((char_u **)(spin->si_comppat.ga_data))[i]) + 1; + put_bytes(fd, (long_u)(l + 7), 4); /* <sectionlen> */ + + putc(spin->si_compmax, fd); /* <compmax> */ + putc(spin->si_compminlen, fd); /* <compminlen> */ + putc(spin->si_compsylmax, fd); /* <compsylmax> */ + putc(0, fd); /* for Vim 7.0b compatibility */ + putc(spin->si_compoptions, fd); /* <compoptions> */ + put_bytes(fd, (long_u)spin->si_comppat.ga_len, 2); + /* <comppatcount> */ + for (i = 0; i < spin->si_comppat.ga_len; ++i) + { + p = ((char_u **)(spin->si_comppat.ga_data))[i]; + putc((int)STRLEN(p), fd); /* <comppatlen> */ + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); + /* <comppattext> */ + } + /* <compflags> */ + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), + (size_t)1, fd); + } + + /* SN_NOBREAK: NOBREAK flag */ + if (spin->si_nobreak) + { + putc(SN_NOBREAK, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + /* It's empty, the presence of the section flags the feature. */ + put_bytes(fd, (long_u)0, 4); /* <sectionlen> */ + } + + /* SN_SYLLABLE: syllable info. + * We don't mark it required, when not supported syllables will not be + * counted. */ + if (spin->si_syllable != NULL) + { + putc(SN_SYLLABLE, fd); /* <sectionID> */ + putc(0, fd); /* <sectionflags> */ + + l = (int)STRLEN(spin->si_syllable); + put_bytes(fd, (long_u)l, 4); /* <sectionlen> */ + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); + /* <syllable> */ + } + + /* end of <SECTIONS> */ + putc(SN_END, fd); /* <sectionend> */ + + + /* + * <LWORDTREE> <KWORDTREE> <PREFIXTREE> + */ + spin->si_memtot = 0; + for (round = 1; round <= 3; ++round) + { + if (round == 1) + tree = spin->si_foldroot->wn_sibling; + else if (round == 2) + tree = spin->si_keeproot->wn_sibling; + else + tree = spin->si_prefroot->wn_sibling; + + /* Clear the index and wnode fields in the tree. */ + clear_node(tree); + + /* Count the number of nodes. Needed to be able to allocate the + * memory when reading the nodes. Also fills in index for shared + * nodes. */ + nodecount = put_node(NULL, tree, 0, regionmask, round == 3); + + /* number of nodes in 4 bytes */ + put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */ + spin->si_memtot += nodecount + nodecount * sizeof(int); + + /* Write the nodes. */ + (void)put_node(fd, tree, 0, regionmask, round == 3); + } + + /* Write another byte to check for errors (file system full). */ + if (putc(0, fd) == EOF) + retval = FAIL; +theend: + if (fclose(fd) == EOF) + retval = FAIL; + + if (fwv != (size_t)1) + retval = FAIL; + if (retval == FAIL) + EMSG(_(e_write)); + + return retval; +} + +/* + * Clear the index and wnode fields of "node", it siblings and its + * children. This is needed because they are a union with other items to save + * space. + */ + static void +clear_node(wordnode_T *node) +{ + wordnode_T *np; + + if (node != NULL) + for (np = node; np != NULL; np = np->wn_sibling) + { + np->wn_u1.index = 0; + np->wn_u2.wnode = NULL; + + if (np->wn_byte != NUL) + clear_node(np->wn_child); + } +} + + +/* + * Dump a word tree at node "node". + * + * This first writes the list of possible bytes (siblings). Then for each + * byte recursively write the children. + * + * NOTE: The code here must match the code in read_tree_node(), since + * assumptions are made about the indexes (so that we don't have to write them + * in the file). + * + * Returns the number of nodes used. + */ + static int +put_node( + FILE *fd, /* NULL when only counting */ + wordnode_T *node, + int idx, + int regionmask, + int prefixtree) /* TRUE for PREFIXTREE */ +{ + int newindex = idx; + int siblingcount = 0; + wordnode_T *np; + int flags; + + /* If "node" is zero the tree is empty. */ + if (node == NULL) + return 0; + + /* Store the index where this node is written. */ + node->wn_u1.index = idx; + + /* Count the number of siblings. */ + for (np = node; np != NULL; np = np->wn_sibling) + ++siblingcount; + + /* Write the sibling count. */ + if (fd != NULL) + putc(siblingcount, fd); /* <siblingcount> */ + + /* Write each sibling byte and optionally extra info. */ + for (np = node; np != NULL; np = np->wn_sibling) + { + if (np->wn_byte == 0) + { + if (fd != NULL) + { + /* For a NUL byte (end of word) write the flags etc. */ + if (prefixtree) + { + /* In PREFIXTREE write the required affixID and the + * associated condition nr (stored in wn_region). The + * byte value is misused to store the "rare" and "not + * combining" flags */ + if (np->wn_flags == (short_u)PFX_FLAGS) + putc(BY_NOFLAGS, fd); /* <byte> */ + else + { + putc(BY_FLAGS, fd); /* <byte> */ + putc(np->wn_flags, fd); /* <pflags> */ + } + putc(np->wn_affixID, fd); /* <affixID> */ + put_bytes(fd, (long_u)np->wn_region, 2); /* <prefcondnr> */ + } + else + { + /* For word trees we write the flag/region items. */ + flags = np->wn_flags; + if (regionmask != 0 && np->wn_region != regionmask) + flags |= WF_REGION; + if (np->wn_affixID != 0) + flags |= WF_AFX; + if (flags == 0) + { + /* word without flags or region */ + putc(BY_NOFLAGS, fd); /* <byte> */ + } + else + { + if (np->wn_flags >= 0x100) + { + putc(BY_FLAGS2, fd); /* <byte> */ + putc(flags, fd); /* <flags> */ + putc((unsigned)flags >> 8, fd); /* <flags2> */ + } + else + { + putc(BY_FLAGS, fd); /* <byte> */ + putc(flags, fd); /* <flags> */ + } + if (flags & WF_REGION) + putc(np->wn_region, fd); /* <region> */ + if (flags & WF_AFX) + putc(np->wn_affixID, fd); /* <affixID> */ + } + } + } + } + else + { + if (np->wn_child->wn_u1.index != 0 + && np->wn_child->wn_u2.wnode != node) + { + /* The child is written elsewhere, write the reference. */ + if (fd != NULL) + { + putc(BY_INDEX, fd); /* <byte> */ + /* <nodeidx> */ + put_bytes(fd, (long_u)np->wn_child->wn_u1.index, 3); + } + } + else if (np->wn_child->wn_u2.wnode == NULL) + /* We will write the child below and give it an index. */ + np->wn_child->wn_u2.wnode = node; + + if (fd != NULL) + if (putc(np->wn_byte, fd) == EOF) /* <byte> or <xbyte> */ + { + EMSG(_(e_write)); + return 0; + } + } + } + + /* Space used in the array when reading: one for each sibling and one for + * the count. */ + newindex += siblingcount + 1; + + /* Recursively dump the children of each sibling. */ + for (np = node; np != NULL; np = np->wn_sibling) + if (np->wn_byte != 0 && np->wn_child->wn_u2.wnode == node) + newindex = put_node(fd, np->wn_child, newindex, regionmask, + prefixtree); + + return newindex; +} + + +/* + * ":mkspell [-ascii] outfile infile ..." + * ":mkspell [-ascii] addfile" + */ + void +ex_mkspell(exarg_T *eap) +{ + int fcount; + char_u **fnames; + char_u *arg = eap->arg; + int ascii = FALSE; + + if (STRNCMP(arg, "-ascii", 6) == 0) + { + ascii = TRUE; + arg = skipwhite(arg + 6); + } + + /* Expand all the remaining arguments (e.g., $VIMRUNTIME). */ + if (get_arglist_exp(arg, &fcount, &fnames, FALSE) == OK) + { + mkspell(fcount, fnames, ascii, eap->forceit, FALSE); + FreeWild(fcount, fnames); + } +} + +/* + * Create the .sug file. + * Uses the soundfold info in "spin". + * Writes the file with the name "wfname", with ".spl" changed to ".sug". + */ + static void +spell_make_sugfile(spellinfo_T *spin, char_u *wfname) +{ + char_u *fname = NULL; + int len; + slang_T *slang; + int free_slang = FALSE; + + /* + * Read back the .spl file that was written. This fills the required + * info for soundfolding. This also uses less memory than the + * pointer-linked version of the trie. And it avoids having two versions + * of the code for the soundfolding stuff. + * It might have been done already by spell_reload_one(). + */ + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (fullpathcmp(wfname, slang->sl_fname, FALSE) == FPC_SAME) + break; + if (slang == NULL) + { + spell_message(spin, (char_u *)_("Reading back spell file...")); + slang = spell_load_file(wfname, NULL, NULL, FALSE); + if (slang == NULL) + return; + free_slang = TRUE; + } + + /* + * Clear the info in "spin" that is used. + */ + spin->si_blocks = NULL; + spin->si_blocks_cnt = 0; + spin->si_compress_cnt = 0; /* will stay at 0 all the time*/ + spin->si_free_count = 0; + spin->si_first_free = NULL; + spin->si_foldwcount = 0; + + /* + * Go through the trie of good words, soundfold each word and add it to + * the soundfold trie. + */ + spell_message(spin, (char_u *)_("Performing soundfolding...")); + if (sug_filltree(spin, slang) == FAIL) + goto theend; + + /* + * Create the table which links each soundfold word with a list of the + * good words it may come from. Creates buffer "spin->si_spellbuf". + * This also removes the wordnr from the NUL byte entries to make + * compression possible. + */ + if (sug_maketable(spin) == FAIL) + goto theend; + + smsg((char_u *)_("Number of words after soundfolding: %ld"), + (long)spin->si_spellbuf->b_ml.ml_line_count); + + /* + * Compress the soundfold trie. + */ + spell_message(spin, (char_u *)_(msg_compressing)); + wordtree_compress(spin, spin->si_foldroot); + + /* + * Write the .sug file. + * Make the file name by changing ".spl" to ".sug". + */ + fname = alloc(MAXPATHL); + if (fname == NULL) + goto theend; + vim_strncpy(fname, wfname, MAXPATHL - 1); + len = (int)STRLEN(fname); + fname[len - 2] = 'u'; + fname[len - 1] = 'g'; + sug_write(spin, fname); + +theend: + vim_free(fname); + if (free_slang) + slang_free(slang); + free_blocks(spin->si_blocks); + close_spellbuf(spin->si_spellbuf); +} + +/* + * Build the soundfold trie for language "slang". + */ + static int +sug_filltree(spellinfo_T *spin, slang_T *slang) +{ + char_u *byts; + idx_T *idxs; + int depth; + idx_T arridx[MAXWLEN]; + int curi[MAXWLEN]; + char_u tword[MAXWLEN]; + char_u tsalword[MAXWLEN]; + int c; + idx_T n; + unsigned words_done = 0; + int wordcount[MAXWLEN]; + + /* We use si_foldroot for the soundfolded trie. */ + spin->si_foldroot = wordtree_alloc(spin); + if (spin->si_foldroot == NULL) + return FAIL; + + /* let tree_add_word() know we're adding to the soundfolded tree */ + spin->si_sugtree = TRUE; + + /* + * Go through the whole case-folded tree, soundfold each word and put it + * in the trie. + */ + byts = slang->sl_fbyts; + idxs = slang->sl_fidxs; + + arridx[0] = 0; + curi[0] = 1; + wordcount[0] = 0; + + depth = 0; + while (depth >= 0 && !got_int) + { + if (curi[depth] > byts[arridx[depth]]) + { + /* Done all bytes at this node, go up one level. */ + idxs[arridx[depth]] = wordcount[depth]; + if (depth > 0) + wordcount[depth - 1] += wordcount[depth]; + + --depth; + line_breakcheck(); + } + else + { + + /* Do one more byte at this node. */ + n = arridx[depth] + curi[depth]; + ++curi[depth]; + + c = byts[n]; + if (c == 0) + { + /* Sound-fold the word. */ + tword[depth] = NUL; + spell_soundfold(slang, tword, TRUE, tsalword); + + /* We use the "flags" field for the MSB of the wordnr, + * "region" for the LSB of the wordnr. */ + if (tree_add_word(spin, tsalword, spin->si_foldroot, + words_done >> 16, words_done & 0xffff, + 0) == FAIL) + return FAIL; + + ++words_done; + ++wordcount[depth]; + + /* Reset the block count each time to avoid compression + * kicking in. */ + spin->si_blocks_cnt = 0; + + /* Skip over any other NUL bytes (same word with different + * flags). */ + while (byts[n + 1] == 0) + { + ++n; + ++curi[depth]; + } + } + else + { + /* Normal char, go one level deeper. */ + tword[depth++] = c; + arridx[depth] = idxs[n]; + curi[depth] = 1; + wordcount[depth] = 0; + } + } + } + + smsg((char_u *)_("Total number of words: %d"), words_done); + + return OK; +} + +/* + * Make the table that links each word in the soundfold trie to the words it + * can be produced from. + * This is not unlike lines in a file, thus use a memfile to be able to access + * the table efficiently. + * Returns FAIL when out of memory. + */ + static int +sug_maketable(spellinfo_T *spin) +{ + garray_T ga; + int res = OK; + + /* Allocate a buffer, open a memline for it and create the swap file + * (uses a temp file, not a .swp file). */ + spin->si_spellbuf = open_spellbuf(); + if (spin->si_spellbuf == NULL) + return FAIL; + + /* Use a buffer to store the line info, avoids allocating many small + * pieces of memory. */ + ga_init2(&ga, 1, 100); + + /* recursively go through the tree */ + if (sug_filltable(spin, spin->si_foldroot->wn_sibling, 0, &ga) == -1) + res = FAIL; + + ga_clear(&ga); + return res; +} + +/* + * Fill the table for one node and its children. + * Returns the wordnr at the start of the node. + * Returns -1 when out of memory. + */ + static int +sug_filltable( + spellinfo_T *spin, + wordnode_T *node, + int startwordnr, + garray_T *gap) /* place to store line of numbers */ +{ + wordnode_T *p, *np; + int wordnr = startwordnr; + int nr; + int prev_nr; + + for (p = node; p != NULL; p = p->wn_sibling) + { + if (p->wn_byte == NUL) + { + gap->ga_len = 0; + prev_nr = 0; + for (np = p; np != NULL && np->wn_byte == NUL; np = np->wn_sibling) + { + if (ga_grow(gap, 10) == FAIL) + return -1; + + nr = (np->wn_flags << 16) + (np->wn_region & 0xffff); + /* Compute the offset from the previous nr and store the + * offset in a way that it takes a minimum number of bytes. + * It's a bit like utf-8, but without the need to mark + * following bytes. */ + nr -= prev_nr; + prev_nr += nr; + gap->ga_len += offset2bytes(nr, + (char_u *)gap->ga_data + gap->ga_len); + } + + /* add the NUL byte */ + ((char_u *)gap->ga_data)[gap->ga_len++] = NUL; + + if (ml_append_buf(spin->si_spellbuf, (linenr_T)wordnr, + gap->ga_data, gap->ga_len, TRUE) == FAIL) + return -1; + ++wordnr; + + /* Remove extra NUL entries, we no longer need them. We don't + * bother freeing the nodes, the won't be reused anyway. */ + while (p->wn_sibling != NULL && p->wn_sibling->wn_byte == NUL) + p->wn_sibling = p->wn_sibling->wn_sibling; + + /* Clear the flags on the remaining NUL node, so that compression + * works a lot better. */ + p->wn_flags = 0; + p->wn_region = 0; + } + else + { + wordnr = sug_filltable(spin, p->wn_child, wordnr, gap); + if (wordnr == -1) + return -1; + } + } + return wordnr; +} + +/* + * Convert an offset into a minimal number of bytes. + * Similar to utf_char2byters, but use 8 bits in followup bytes and avoid NUL + * bytes. + */ + static int +offset2bytes(int nr, char_u *buf) +{ + int rem; + int b1, b2, b3, b4; + + /* Split the number in parts of base 255. We need to avoid NUL bytes. */ + b1 = nr % 255 + 1; + rem = nr / 255; + b2 = rem % 255 + 1; + rem = rem / 255; + b3 = rem % 255 + 1; + b4 = rem / 255 + 1; + + if (b4 > 1 || b3 > 0x1f) /* 4 bytes */ + { + buf[0] = 0xe0 + b4; + buf[1] = b3; + buf[2] = b2; + buf[3] = b1; + return 4; + } + if (b3 > 1 || b2 > 0x3f ) /* 3 bytes */ + { + buf[0] = 0xc0 + b3; + buf[1] = b2; + buf[2] = b1; + return 3; + } + if (b2 > 1 || b1 > 0x7f ) /* 2 bytes */ + { + buf[0] = 0x80 + b2; + buf[1] = b1; + return 2; + } + /* 1 byte */ + buf[0] = b1; + return 1; +} + +/* + * Write the .sug file in "fname". + */ + static void +sug_write(spellinfo_T *spin, char_u *fname) +{ + FILE *fd; + wordnode_T *tree; + int nodecount; + int wcount; + char_u *line; + linenr_T lnum; + int len; + + /* Create the file. Note that an existing file is silently overwritten! */ + fd = mch_fopen((char *)fname, "w"); + if (fd == NULL) + { + EMSG2(_(e_notopen), fname); + return; + } + + vim_snprintf((char *)IObuff, IOSIZE, + _("Writing suggestion file %s ..."), fname); + spell_message(spin, IObuff); + + /* + * <SUGHEADER>: <fileID> <versionnr> <timestamp> + */ + if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) /* <fileID> */ + { + EMSG(_(e_write)); + goto theend; + } + putc(VIMSUGVERSION, fd); /* <versionnr> */ + + /* Write si_sugtime to the file. */ + put_time(fd, spin->si_sugtime); /* <timestamp> */ + + /* + * <SUGWORDTREE> + */ + spin->si_memtot = 0; + tree = spin->si_foldroot->wn_sibling; + + /* Clear the index and wnode fields in the tree. */ + clear_node(tree); + + /* Count the number of nodes. Needed to be able to allocate the + * memory when reading the nodes. Also fills in index for shared + * nodes. */ + nodecount = put_node(NULL, tree, 0, 0, FALSE); + + /* number of nodes in 4 bytes */ + put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */ + spin->si_memtot += nodecount + nodecount * sizeof(int); + + /* Write the nodes. */ + (void)put_node(fd, tree, 0, 0, FALSE); + + /* + * <SUGTABLE>: <sugwcount> <sugline> ... + */ + wcount = spin->si_spellbuf->b_ml.ml_line_count; + put_bytes(fd, (long_u)wcount, 4); /* <sugwcount> */ + + for (lnum = 1; lnum <= (linenr_T)wcount; ++lnum) + { + /* <sugline>: <sugnr> ... NUL */ + line = ml_get_buf(spin->si_spellbuf, lnum, FALSE); + len = (int)STRLEN(line) + 1; + if (fwrite(line, (size_t)len, (size_t)1, fd) == 0) + { + EMSG(_(e_write)); + goto theend; + } + spin->si_memtot += len; + } + + /* Write another byte to check for errors. */ + if (putc(0, fd) == EOF) + EMSG(_(e_write)); + + vim_snprintf((char *)IObuff, IOSIZE, + _("Estimated runtime memory use: %d bytes"), spin->si_memtot); + spell_message(spin, IObuff); + +theend: + /* close the file */ + fclose(fd); +} + + +/* + * Create a Vim spell file from one or more word lists. + * "fnames[0]" is the output file name. + * "fnames[fcount - 1]" is the last input file name. + * Exception: when "fnames[0]" ends in ".add" it's used as the input file name + * and ".spl" is appended to make the output file name. + */ + void +mkspell( + int fcount, + char_u **fnames, + int ascii, /* -ascii argument given */ + int over_write, /* overwrite existing output file */ + int added_word) /* invoked through "zg" */ +{ + char_u *fname = NULL; + char_u *wfname; + char_u **innames; + int incount; + afffile_T *(afile[MAXREGIONS]); + int i; + int len; + stat_T st; + int error = FALSE; + spellinfo_T spin; + + vim_memset(&spin, 0, sizeof(spin)); + spin.si_verbose = !added_word; + spin.si_ascii = ascii; + spin.si_followup = TRUE; + spin.si_rem_accents = TRUE; + ga_init2(&spin.si_rep, (int)sizeof(fromto_T), 20); + ga_init2(&spin.si_repsal, (int)sizeof(fromto_T), 20); + ga_init2(&spin.si_sal, (int)sizeof(fromto_T), 20); + ga_init2(&spin.si_map, (int)sizeof(char_u), 100); + ga_init2(&spin.si_comppat, (int)sizeof(char_u *), 20); + ga_init2(&spin.si_prefcond, (int)sizeof(char_u *), 50); + hash_init(&spin.si_commonwords); + spin.si_newcompID = 127; /* start compound ID at first maximum */ + + /* default: fnames[0] is output file, following are input files */ + innames = &fnames[1]; + incount = fcount - 1; + + wfname = alloc(MAXPATHL); + if (wfname == NULL) + return; + + if (fcount >= 1) + { + len = (int)STRLEN(fnames[0]); + if (fcount == 1 && len > 4 && STRCMP(fnames[0] + len - 4, ".add") == 0) + { + /* For ":mkspell path/en.latin1.add" output file is + * "path/en.latin1.add.spl". */ + innames = &fnames[0]; + incount = 1; + vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]); + } + else if (fcount == 1) + { + /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */ + innames = &fnames[0]; + incount = 1; + vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, + fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); + } + else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0) + { + /* Name ends in ".spl", use as the file name. */ + vim_strncpy(wfname, fnames[0], MAXPATHL - 1); + } + else + /* Name should be language, make the file name from it. */ + vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, + fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); + + /* Check for .ascii.spl. */ + if (strstr((char *)gettail(wfname), SPL_FNAME_ASCII) != NULL) + spin.si_ascii = TRUE; + + /* Check for .add.spl. */ + if (strstr((char *)gettail(wfname), SPL_FNAME_ADD) != NULL) + spin.si_add = TRUE; + } + + if (incount <= 0) + EMSG(_(e_invarg)); /* need at least output and input names */ + else if (vim_strchr(gettail(wfname), '_') != NULL) + EMSG(_("E751: Output file name must not have region name")); + else if (incount > MAXREGIONS) + EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS); + else + { + /* Check for overwriting before doing things that may take a lot of + * time. */ + if (!over_write && mch_stat((char *)wfname, &st) >= 0) + { + EMSG(_(e_exists)); + goto theend; + } + if (mch_isdir(wfname)) + { + EMSG2(_(e_isadir2), wfname); + goto theend; + } + + fname = alloc(MAXPATHL); + if (fname == NULL) + goto theend; + + /* + * Init the aff and dic pointers. + * Get the region names if there are more than 2 arguments. + */ + for (i = 0; i < incount; ++i) + { + afile[i] = NULL; + + if (incount > 1) + { + len = (int)STRLEN(innames[i]); + if (STRLEN(gettail(innames[i])) < 5 + || innames[i][len - 3] != '_') + { + EMSG2(_("E755: Invalid region in %s"), innames[i]); + goto theend; + } + spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]); + spin.si_region_name[i * 2 + 1] = + TOLOWER_ASC(innames[i][len - 1]); + } + } + spin.si_region_count = incount; + + spin.si_foldroot = wordtree_alloc(&spin); + spin.si_keeproot = wordtree_alloc(&spin); + spin.si_prefroot = wordtree_alloc(&spin); + if (spin.si_foldroot == NULL + || spin.si_keeproot == NULL + || spin.si_prefroot == NULL) + { + free_blocks(spin.si_blocks); + goto theend; + } + + /* When not producing a .add.spl file clear the character table when + * we encounter one in the .aff file. This means we dump the current + * one in the .spl file if the .aff file doesn't define one. That's + * better than guessing the contents, the table will match a + * previously loaded spell file. */ + if (!spin.si_add) + spin.si_clear_chartab = TRUE; + + /* + * Read all the .aff and .dic files. + * Text is converted to 'encoding'. + * Words are stored in the case-folded and keep-case trees. + */ + for (i = 0; i < incount && !error; ++i) + { + spin.si_conv.vc_type = CONV_NONE; + spin.si_region = 1 << i; + + vim_snprintf((char *)fname, MAXPATHL, "%s.aff", innames[i]); + if (mch_stat((char *)fname, &st) >= 0) + { + /* Read the .aff file. Will init "spin->si_conv" based on the + * "SET" line. */ + afile[i] = spell_read_aff(&spin, fname); + if (afile[i] == NULL) + error = TRUE; + else + { + /* Read the .dic file and store the words in the trees. */ + vim_snprintf((char *)fname, MAXPATHL, "%s.dic", + innames[i]); + if (spell_read_dic(&spin, fname, afile[i]) == FAIL) + error = TRUE; + } + } + else + { + /* No .aff file, try reading the file as a word list. Store + * the words in the trees. */ + if (spell_read_wordfile(&spin, innames[i]) == FAIL) + error = TRUE; + } + +#ifdef FEAT_MBYTE + /* Free any conversion stuff. */ + convert_setup(&spin.si_conv, NULL, NULL); +#endif + } + + if (spin.si_compflags != NULL && spin.si_nobreak) + MSG(_("Warning: both compounding and NOBREAK specified")); + + if (!error && !got_int) + { + /* + * Combine tails in the tree. + */ + spell_message(&spin, (char_u *)_(msg_compressing)); + wordtree_compress(&spin, spin.si_foldroot); + wordtree_compress(&spin, spin.si_keeproot); + wordtree_compress(&spin, spin.si_prefroot); + } + + if (!error && !got_int) + { + /* + * Write the info in the spell file. + */ + vim_snprintf((char *)IObuff, IOSIZE, + _("Writing spell file %s ..."), wfname); + spell_message(&spin, IObuff); + + error = write_vim_spell(&spin, wfname) == FAIL; + + spell_message(&spin, (char_u *)_("Done!")); + vim_snprintf((char *)IObuff, IOSIZE, + _("Estimated runtime memory use: %d bytes"), spin.si_memtot); + spell_message(&spin, IObuff); + + /* + * If the file is loaded need to reload it. + */ + if (!error) + spell_reload_one(wfname, added_word); + } + + /* Free the allocated memory. */ + ga_clear(&spin.si_rep); + ga_clear(&spin.si_repsal); + ga_clear(&spin.si_sal); + ga_clear(&spin.si_map); + ga_clear(&spin.si_comppat); + ga_clear(&spin.si_prefcond); + hash_clear_all(&spin.si_commonwords, 0); + + /* Free the .aff file structures. */ + for (i = 0; i < incount; ++i) + if (afile[i] != NULL) + spell_free_aff(afile[i]); + + /* Free all the bits and pieces at once. */ + free_blocks(spin.si_blocks); + + /* + * If there is soundfolding info and no NOSUGFILE item create the + * .sug file with the soundfolded word trie. + */ + if (spin.si_sugtime != 0 && !error && !got_int) + spell_make_sugfile(&spin, wfname); + + } + +theend: + vim_free(fname); + vim_free(wfname); +} + +/* + * Display a message for spell file processing when 'verbose' is set or using + * ":mkspell". "str" can be IObuff. + */ + static void +spell_message(spellinfo_T *spin, char_u *str) +{ + if (spin->si_verbose || p_verbose > 2) + { + if (!spin->si_verbose) + verbose_enter(); + MSG(str); + out_flush(); + if (!spin->si_verbose) + verbose_leave(); + } +} + +/* + * ":[count]spellgood {word}" + * ":[count]spellwrong {word}" + * ":[count]spellundo {word}" + */ + void +ex_spell(exarg_T *eap) +{ + spell_add_word(eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong, + eap->forceit ? 0 : (int)eap->line2, + eap->cmdidx == CMD_spellundo); +} + +/* + * Add "word[len]" to 'spellfile' as a good or bad word. + */ + void +spell_add_word( + char_u *word, + int len, + int bad, + int idx, /* "zG" and "zW": zero, otherwise index in + 'spellfile' */ + int undo) /* TRUE for "zug", "zuG", "zuw" and "zuW" */ +{ + FILE *fd = NULL; + buf_T *buf = NULL; + int new_spf = FALSE; + char_u *fname; + char_u *fnamebuf = NULL; + char_u line[MAXWLEN * 2]; + long fpos, fpos_next = 0; + int i; + char_u *spf; + + if (idx == 0) /* use internal wordlist */ + { + if (int_wordlist == NULL) + { + int_wordlist = vim_tempname('s', FALSE); + if (int_wordlist == NULL) + return; + } + fname = int_wordlist; + } + else + { + /* If 'spellfile' isn't set figure out a good default value. */ + if (*curwin->w_s->b_p_spf == NUL) + { + init_spellfile(); + new_spf = TRUE; + } + + if (*curwin->w_s->b_p_spf == NUL) + { + EMSG2(_(e_notset), "spellfile"); + return; + } + fnamebuf = alloc(MAXPATHL); + if (fnamebuf == NULL) + return; + + for (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i) + { + copy_option_part(&spf, fnamebuf, MAXPATHL, ","); + if (i == idx) + break; + if (*spf == NUL) + { + EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx); + vim_free(fnamebuf); + return; + } + } + + /* Check that the user isn't editing the .add file somewhere. */ + buf = buflist_findname_exp(fnamebuf); + if (buf != NULL && buf->b_ml.ml_mfp == NULL) + buf = NULL; + if (buf != NULL && bufIsChanged(buf)) + { + EMSG(_(e_bufloaded)); + vim_free(fnamebuf); + return; + } + + fname = fnamebuf; + } + + if (bad || undo) + { + /* When the word appears as good word we need to remove that one, + * since its flags sort before the one with WF_BANNED. */ + fd = mch_fopen((char *)fname, "r"); + if (fd != NULL) + { + while (!vim_fgets(line, MAXWLEN * 2, fd)) + { + fpos = fpos_next; + fpos_next = ftell(fd); + if (STRNCMP(word, line, len) == 0 + && (line[len] == '/' || line[len] < ' ')) + { + /* Found duplicate word. Remove it by writing a '#' at + * the start of the line. Mixing reading and writing + * doesn't work for all systems, close the file first. */ + fclose(fd); + fd = mch_fopen((char *)fname, "r+"); + if (fd == NULL) + break; + if (fseek(fd, fpos, SEEK_SET) == 0) + { + fputc('#', fd); + if (undo) + { + home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); + smsg((char_u *)_("Word '%.*s' removed from %s"), + len, word, NameBuff); + } + } + fseek(fd, fpos_next, SEEK_SET); + } + } + if (fd != NULL) + fclose(fd); + } + } + + if (!undo) + { + fd = mch_fopen((char *)fname, "a"); + if (fd == NULL && new_spf) + { + char_u *p; + + /* We just initialized the 'spellfile' option and can't open the + * file. We may need to create the "spell" directory first. We + * already checked the runtime directory is writable in + * init_spellfile(). */ + if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname) + { + int c = *p; + + /* The directory doesn't exist. Try creating it and opening + * the file again. */ + *p = NUL; + vim_mkdir(fname, 0755); + *p = c; + fd = mch_fopen((char *)fname, "a"); + } + } + + if (fd == NULL) + EMSG2(_(e_notopen), fname); + else + { + if (bad) + fprintf(fd, "%.*s/!\n", len, word); + else + fprintf(fd, "%.*s\n", len, word); + fclose(fd); + + home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); + smsg((char_u *)_("Word '%.*s' added to %s"), len, word, NameBuff); + } + } + + if (fd != NULL) + { + /* Update the .add.spl file. */ + mkspell(1, &fname, FALSE, TRUE, TRUE); + + /* If the .add file is edited somewhere, reload it. */ + if (buf != NULL) + buf_reload(buf, buf->b_orig_mode); + + redraw_all_later(SOME_VALID); + } + vim_free(fnamebuf); +} + +/* + * Initialize 'spellfile' for the current buffer. + */ + static void +init_spellfile(void) +{ + char_u *buf; + int l; + char_u *fname; + char_u *rtp; + char_u *lend; + int aspath = FALSE; + char_u *lstart = curbuf->b_s.b_p_spl; + + if (*curwin->w_s->b_p_spl != NUL && curwin->w_s->b_langp.ga_len > 0) + { + buf = alloc(MAXPATHL); + if (buf == NULL) + return; + + /* Find the end of the language name. Exclude the region. If there + * is a path separator remember the start of the tail. */ + for (lend = curwin->w_s->b_p_spl; *lend != NUL + && vim_strchr((char_u *)",._", *lend) == NULL; ++lend) + if (vim_ispathsep(*lend)) + { + aspath = TRUE; + lstart = lend + 1; + } + + /* Loop over all entries in 'runtimepath'. Use the first one where we + * are allowed to write. */ + rtp = p_rtp; + while (*rtp != NUL) + { + if (aspath) + /* Use directory of an entry with path, e.g., for + * "/dir/lg.utf-8.spl" use "/dir". */ + vim_strncpy(buf, curbuf->b_s.b_p_spl, + lstart - curbuf->b_s.b_p_spl - 1); + else + /* Copy the path from 'runtimepath' to buf[]. */ + copy_option_part(&rtp, buf, MAXPATHL, ","); + if (filewritable(buf) == 2) + { + /* Use the first language name from 'spelllang' and the + * encoding used in the first loaded .spl file. */ + if (aspath) + vim_strncpy(buf, curbuf->b_s.b_p_spl, + lend - curbuf->b_s.b_p_spl); + else + { + /* Create the "spell" directory if it doesn't exist yet. */ + l = (int)STRLEN(buf); + vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell"); + if (filewritable(buf) != 2) + vim_mkdir(buf, 0755); + + l = (int)STRLEN(buf); + vim_snprintf((char *)buf + l, MAXPATHL - l, + "/%.*s", (int)(lend - lstart), lstart); + } + l = (int)STRLEN(buf); + fname = LANGP_ENTRY(curwin->w_s->b_langp, 0) + ->lp_slang->sl_fname; + vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add", + fname != NULL + && strstr((char *)gettail(fname), ".ascii.") != NULL + ? (char_u *)"ascii" : spell_enc()); + set_option_value((char_u *)"spellfile", 0L, buf, OPT_LOCAL); + break; + } + aspath = FALSE; + } + + vim_free(buf); + } +} + + + +/* + * Set the spell character tables from strings in the affix file. + */ + static int +set_spell_chartab(char_u *fol, char_u *low, char_u *upp) +{ + /* We build the new tables here first, so that we can compare with the + * previous one. */ + spelltab_T new_st; + char_u *pf = fol, *pl = low, *pu = upp; + int f, l, u; + + clear_spell_chartab(&new_st); + + while (*pf != NUL) + { + if (*pl == NUL || *pu == NUL) + { + EMSG(_(e_affform)); + return FAIL; + } +#ifdef FEAT_MBYTE + f = mb_ptr2char_adv(&pf); + l = mb_ptr2char_adv(&pl); + u = mb_ptr2char_adv(&pu); +#else + f = *pf++; + l = *pl++; + u = *pu++; +#endif + /* Every character that appears is a word character. */ + if (f < 256) + new_st.st_isw[f] = TRUE; + if (l < 256) + new_st.st_isw[l] = TRUE; + if (u < 256) + new_st.st_isw[u] = TRUE; + + /* if "LOW" and "FOL" are not the same the "LOW" char needs + * case-folding */ + if (l < 256 && l != f) + { + if (f >= 256) + { + EMSG(_(e_affrange)); + return FAIL; + } + new_st.st_fold[l] = f; + } + + /* if "UPP" and "FOL" are not the same the "UPP" char needs + * case-folding, it's upper case and the "UPP" is the upper case of + * "FOL" . */ + if (u < 256 && u != f) + { + if (f >= 256) + { + EMSG(_(e_affrange)); + return FAIL; + } + new_st.st_fold[u] = f; + new_st.st_isu[u] = TRUE; + new_st.st_upper[f] = u; + } + } + + if (*pl != NUL || *pu != NUL) + { + EMSG(_(e_affform)); + return FAIL; + } + + return set_spell_finish(&new_st); +} + +/* + * Set the spell character tables from strings in the .spl file. + */ + static void +set_spell_charflags( + char_u *flags, + int cnt, /* length of "flags" */ + char_u *fol) +{ + /* We build the new tables here first, so that we can compare with the + * previous one. */ + spelltab_T new_st; + int i; + char_u *p = fol; + int c; + + clear_spell_chartab(&new_st); + + for (i = 0; i < 128; ++i) + { + if (i < cnt) + { + new_st.st_isw[i + 128] = (flags[i] & CF_WORD) != 0; + new_st.st_isu[i + 128] = (flags[i] & CF_UPPER) != 0; + } + + if (*p != NUL) + { +#ifdef FEAT_MBYTE + c = mb_ptr2char_adv(&p); +#else + c = *p++; +#endif + new_st.st_fold[i + 128] = c; + if (i + 128 != c && new_st.st_isu[i + 128] && c < 256) + new_st.st_upper[c] = i + 128; + } + } + + (void)set_spell_finish(&new_st); +} + + static int +set_spell_finish(spelltab_T *new_st) +{ + int i; + + if (did_set_spelltab) + { + /* check that it's the same table */ + for (i = 0; i < 256; ++i) + { + if (spelltab.st_isw[i] != new_st->st_isw[i] + || spelltab.st_isu[i] != new_st->st_isu[i] + || spelltab.st_fold[i] != new_st->st_fold[i] + || spelltab.st_upper[i] != new_st->st_upper[i]) + { + EMSG(_("E763: Word characters differ between spell files")); + return FAIL; + } + } + } + else + { + /* copy the new spelltab into the one being used */ + spelltab = *new_st; + did_set_spelltab = TRUE; + } + + return OK; +} + +/* + * Write the table with prefix conditions to the .spl file. + * When "fd" is NULL only count the length of what is written. + */ + static int +write_spell_prefcond(FILE *fd, garray_T *gap) +{ + int i; + char_u *p; + int len; + int totlen; + size_t x = 1; /* collect return value of fwrite() */ + + if (fd != NULL) + put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ + + totlen = 2 + gap->ga_len; /* length of <prefcondcnt> and <condlen> bytes */ + + for (i = 0; i < gap->ga_len; ++i) + { + /* <prefcond> : <condlen> <condstr> */ + p = ((char_u **)gap->ga_data)[i]; + if (p != NULL) + { + len = (int)STRLEN(p); + if (fd != NULL) + { + fputc(len, fd); + x &= fwrite(p, (size_t)len, (size_t)1, fd); + } + totlen += len; + } + else if (fd != NULL) + fputc(0, fd); + } + + return totlen; +} + + +/* + * Use map string "map" for languages "lp". + */ + static void +set_map_str(slang_T *lp, char_u *map) +{ + char_u *p; + int headc = 0; + int c; + int i; + + if (*map == NUL) + { + lp->sl_has_map = FALSE; + return; + } + lp->sl_has_map = TRUE; + + /* Init the array and hash tables empty. */ + for (i = 0; i < 256; ++i) + lp->sl_map_array[i] = 0; +#ifdef FEAT_MBYTE + hash_init(&lp->sl_map_hash); +#endif + + /* + * The similar characters are stored separated with slashes: + * "aaa/bbb/ccc/". Fill sl_map_array[c] with the character before c and + * before the same slash. For characters above 255 sl_map_hash is used. + */ + for (p = map; *p != NUL; ) + { +#ifdef FEAT_MBYTE + c = mb_cptr2char_adv(&p); +#else + c = *p++; +#endif + if (c == '/') + headc = 0; + else + { + if (headc == 0) + headc = c; + +#ifdef FEAT_MBYTE + /* Characters above 255 don't fit in sl_map_array[], put them in + * the hash table. Each entry is the char, a NUL the headchar and + * a NUL. */ + if (c >= 256) + { + int cl = mb_char2len(c); + int headcl = mb_char2len(headc); + char_u *b; + hash_T hash; + hashitem_T *hi; + + b = alloc((unsigned)(cl + headcl + 2)); + if (b == NULL) + return; + mb_char2bytes(c, b); + b[cl] = NUL; + mb_char2bytes(headc, b + cl + 1); + b[cl + 1 + headcl] = NUL; + hash = hash_hash(b); + hi = hash_lookup(&lp->sl_map_hash, b, hash); + if (HASHITEM_EMPTY(hi)) + hash_add_item(&lp->sl_map_hash, hi, b, hash); + else + { + /* This should have been checked when generating the .spl + * file. */ + EMSG(_("E783: duplicate char in MAP entry")); + vim_free(b); + } + } + else +#endif + lp->sl_map_array[c] = headc; + } + } +} + + +#endif /* FEAT_SPELL */ diff --git a/src/structs.h b/src/structs.h index a06c8554f3..57d7806d85 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -68,6 +68,21 @@ typedef struct wininfo_S wininfo_T; typedef struct frame_S frame_T; typedef int scid_T; /* script ID */ typedef struct file_buffer buf_T; /* forward declaration */ +typedef struct terminal_S term_T; + +#ifdef FEAT_MENU +typedef struct VimMenu vimmenu_T; +#endif + +/* + * Reference to a buffer that stores the value of buf_free_count. + * bufref_valid() only needs to check "buf" when the count differs. + */ +typedef struct { + buf_T *br_buf; + int br_fnum; + int br_buf_free_count; +} bufref_T; /* * This is here because regexp.h needs pos_T and below regprog_T is used. @@ -84,8 +99,12 @@ typedef struct file_buffer buf_T; /* forward declaration */ # ifdef FEAT_XCLIPBOARD # include <X11/Intrinsic.h> # endif -# define guicolor_T int /* avoid error in prototypes */ +# define guicolor_T long +# define INVALCOLOR ((guicolor_T)0x1ffffff) + /* only used for cterm.bg_rgb and cterm.fg_rgb: use cterm color */ +# define CTERMCOLOR ((guicolor_T)0x1fffffe) #endif +#define COLOR_INVALID(x) ((x) == INVALCOLOR || (x) == CTERMCOLOR) /* * marks: positions in a file @@ -110,6 +129,9 @@ typedef struct xfilemark { fmark_T fmark; char_u *fname; /* file name, used when fnum == 0 */ +#ifdef FEAT_VIMINFO + time_T time_set; +#endif } xfmark_T; /* @@ -137,7 +159,7 @@ typedef struct #ifdef FEAT_LINEBREAK int wo_bri; # define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */ - char_u *wo_briopt; + char_u *wo_briopt; # define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */ #endif #ifdef FEAT_DIFF @@ -190,13 +212,11 @@ typedef struct long wo_nuw; # define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */ #endif -#if defined(FEAT_WINDOWS) int wo_wfh; # define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */ int wo_wfw; # define w_p_wfw w_onebuf_opt.wo_wfw /* 'winfixwidth' */ -#endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) int wo_pvw; # define w_p_pvw w_onebuf_opt.wo_pvw /* 'previewwindow' */ #endif @@ -224,14 +244,12 @@ typedef struct char_u *wo_stl; #define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */ #endif -#ifdef FEAT_SCROLLBIND int wo_scb; -# define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ +#define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ int wo_diff_saved; /* options were saved for starting diff mode */ -# define w_p_diff_saved w_onebuf_opt.wo_diff_saved +#define w_p_diff_saved w_onebuf_opt.wo_diff_saved int wo_scb_save; /* 'scrollbind' saved for diff mode*/ -# define w_p_scb_save w_onebuf_opt.wo_scb_save -#endif +#define w_p_scb_save w_onebuf_opt.wo_scb_save int wo_wrap; #define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */ #ifdef FEAT_DIFF @@ -244,11 +262,19 @@ typedef struct long wo_cole; /* 'conceallevel' */ # define w_p_cole w_onebuf_opt.wo_cole #endif -#ifdef FEAT_CURSORBIND int wo_crb; -# define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */ +#define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */ int wo_crb_save; /* 'cursorbind' state saved for diff mode*/ -# define w_p_crb_save w_onebuf_opt.wo_crb_save +#define w_p_crb_save w_onebuf_opt.wo_crb_save +#ifdef FEAT_SIGNS + char_u *wo_scl; +# define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */ +#endif +#ifdef FEAT_TERMINAL + char_u *wo_twk; +# define w_p_twk w_onebuf_opt.wo_twk /* 'termwinkey' */ + char_u *wo_tws; +# define w_p_tws w_onebuf_opt.wo_tws /* 'termwinsize' */ #endif #ifdef FEAT_EVAL @@ -353,7 +379,7 @@ struct u_header int uh_flags; /* see below */ pos_T uh_namedm[NMARKS]; /* marks before undo/after redo */ visualinfo_T uh_visual; /* Visual areas before undo/after redo */ - time_t uh_time; /* timestamp when the change was made */ + time_T uh_time; /* timestamp when the change was made */ long uh_save_nr; /* set when the file was saved after the changes in this block */ #ifdef U_DEBUG @@ -499,6 +525,12 @@ struct buffheader int bh_space; /* space in bh_curr for appending */ }; +typedef struct +{ + buffheader_T sr_redobuff; + buffheader_T sr_old_redobuff; +} save_redo_T; + /* * used for completion on the command line */ @@ -539,10 +571,8 @@ typedef struct # ifdef FEAT_BROWSE_CMD int browse; /* TRUE to invoke file dialog */ # endif -# ifdef FEAT_WINDOWS int split; /* flags for win_split() */ int tab; /* > 0 when ":tab" was used */ -# endif # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) int confirm; /* TRUE to invoke yes/no dialog */ # endif @@ -552,9 +582,9 @@ typedef struct int lockmarks; /* TRUE when ":lockmarks" was used */ int keeppatterns; /* TRUE when ":keeppatterns" was used */ int noswapfile; /* TRUE when ":noswapfile" was used */ -# ifdef FEAT_AUTOCMD char_u *save_ei; /* saved value of 'eventignore' */ -# endif + regmatch_T filter_regmatch; /* set by :filter /pat/ */ + int filter_force; /* set for :filter! */ } cmdmod_T; #define MF_SEED_LEN 8 @@ -635,7 +665,7 @@ typedef struct memline int ml_flags; infoptr_T *ml_stack; /* stack of pointer blocks (array of IPTRs) */ - int ml_stack_top; /* current top if ml_stack */ + int ml_stack_top; /* current top of ml_stack */ int ml_stack_size; /* total number of entries in ml_stack */ linenr_T ml_line_lnum; /* line number of cached line, 0 if not valid */ @@ -695,11 +725,7 @@ typedef struct argentry int ae_fnum; /* buffer number with expanded file name */ } aentry_T; -#ifdef FEAT_WINDOWS -# define ALIST(win) (win)->w_alist -#else -# define ALIST(win) (&global_alist) -#endif +#define ALIST(win) (win)->w_alist #define GARGLIST ((aentry_T *)global_alist.al_ga.ga_data) #define ARGLIST ((aentry_T *)ALIST(curwin)->al_ga.ga_data) #define WARGLIST(wp) ((aentry_T *)ALIST(wp)->al_ga.ga_data) @@ -796,6 +822,16 @@ struct msglist struct msglist *next; /* next of several messages in a row */ }; +/* + * The exception types. + */ +typedef enum +{ + ET_USER, // exception caused by ":throw" command + ET_ERROR, // error exception + ET_INTERRUPT, // interrupt exception triggered by Ctrl-C +} except_type_T; + /* * Structure describing an exception. * (don't use "struct exception", it's used by the math library). @@ -803,7 +839,7 @@ struct msglist typedef struct vim_exception except_T; struct vim_exception { - int type; /* exception type */ + except_type_T type; /* exception type */ char_u *value; /* exception value */ struct msglist *messages; /* message(s) causing error exception */ char_u *throw_name; /* name of the throw point */ @@ -811,13 +847,6 @@ struct vim_exception except_T *caught; /* next exception on the caught stack */ }; -/* - * The exception types. - */ -#define ET_USER 0 /* exception caused by ":throw" command */ -#define ET_ERROR 1 /* error exception */ -#define ET_INTERRUPT 2 /* interrupt exception triggered by Ctrl-C */ - /* * Structure to save the error/interrupt/exception state between calls to * enter_cleanup() and leave_cleanup(). Must be allocated as an automatic @@ -911,6 +940,10 @@ typedef struct attr_entry /* These colors need to be > 8 bits to hold 256. */ short_u fg_color; /* foreground color number */ short_u bg_color; /* background color number */ +# ifdef FEAT_TERMGUICOLORS + guicolor_T fg_rgb; /* foreground color RGB */ + guicolor_T bg_rgb; /* background color RGB */ +# endif } cterm; # ifdef FEAT_GUI struct @@ -933,19 +966,12 @@ typedef struct attr_entry # else # if defined(MACOS_X) # include <sys/errno.h> -# define EILSEQ ENOENT /* MacOS X does not have EILSEQ */ +# ifndef EILSEQ +# define EILSEQ ENOENT /* Early MacOS X does not have EILSEQ */ +# endif typedef struct _iconv_t *iconv_t; # else -# if defined(MACOS_CLASSIC) -typedef struct _iconv_t *iconv_t; -# define EINVAL 22 -# define E2BIG 7 -# define ENOENT 2 -# define EFAULT 14 -# define EILSEQ 123 -# else -# include <errno.h> -# endif +# include <errno.h> # endif typedef void *iconv_t; # endif @@ -1008,6 +1034,8 @@ typedef struct #ifdef FEAT_MBYTE vimconv_T vir_conv; /* encoding conversion */ #endif + int vir_version; /* viminfo version detected or -1 */ + garray_T vir_barlines; /* lines starting with | */ } vir_T; #define CONV_NONE 0 @@ -1100,22 +1128,86 @@ typedef struct hashtable_S typedef long_u hash_T; /* Type for hi_hash */ -#if VIM_SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */ -typedef long varnumber_T; +#ifdef FEAT_NUM64 +/* Use 64-bit Number. */ +# ifdef WIN3264 +# ifdef PROTO +typedef long varnumber_T; +typedef unsigned long uvarnumber_T; +#define VARNUM_MIN LONG_MIN +#define VARNUM_MAX LONG_MAX +#define UVARNUM_MAX ULONG_MAX +# else +typedef __int64 varnumber_T; +typedef unsigned __int64 uvarnumber_T; +#define VARNUM_MIN _I64_MIN +#define VARNUM_MAX _I64_MAX +#define UVARNUM_MAX _UI64_MAX +# endif +# elif defined(HAVE_STDINT_H) +typedef int64_t varnumber_T; +typedef uint64_t uvarnumber_T; +#define VARNUM_MIN INT64_MIN +#define VARNUM_MAX INT64_MAX +#define UVARNUM_MAX UINT64_MAX +# else +typedef long varnumber_T; +typedef unsigned long uvarnumber_T; +#define VARNUM_MIN LONG_MIN +#define VARNUM_MAX LONG_MAX +#define UVARNUM_MAX ULONG_MAX +# endif #else -typedef int varnumber_T; +/* Use 32-bit Number. */ +# if VIM_SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */ +typedef long varnumber_T; +typedef unsigned long uvarnumber_T; +#define VARNUM_MIN LONG_MIN +#define VARNUM_MAX LONG_MAX +#define UVARNUM_MAX ULONG_MAX +# else +typedef int varnumber_T; +typedef unsigned int uvarnumber_T; +#define VARNUM_MIN INT_MIN +#define VARNUM_MAX INT_MAX +#define UVARNUM_MAX UINT_MAX +# endif #endif + typedef double float_T; typedef struct listvar_S list_T; typedef struct dictvar_S dict_T; +typedef struct partial_S partial_T; + +typedef struct jobvar_S job_T; +typedef struct readq_S readq_T; +typedef struct writeq_S writeq_T; +typedef struct jsonq_S jsonq_T; +typedef struct cbq_S cbq_T; +typedef struct channel_S channel_T; + +typedef enum +{ + VAR_UNKNOWN = 0, + VAR_NUMBER, // "v_number" is used + VAR_STRING, // "v_string" is used + VAR_FUNC, // "v_string" is function name + VAR_PARTIAL, // "v_partial" is used + VAR_LIST, // "v_list" is used + VAR_DICT, // "v_dict" is used + VAR_FLOAT, // "v_float" is used + VAR_SPECIAL, // "v_number" is used + VAR_JOB, // "v_job" is used + VAR_CHANNEL, // "v_channel" is used +} vartype_T; /* * Structure to hold an internal variable without a name. */ typedef struct { - char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */ + vartype_T v_type; char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */ union { @@ -1126,18 +1218,14 @@ typedef struct char_u *v_string; /* string value (can be NULL!) */ list_T *v_list; /* list value (can be NULL!) */ dict_T *v_dict; /* dict value (can be NULL!) */ + partial_T *v_partial; /* closure: function with args */ +#ifdef FEAT_JOB_CHANNEL + job_T *v_job; /* job value (can be NULL!) */ + channel_T *v_channel; /* channel value (can be NULL!) */ +#endif } vval; } typval_T; -/* Values for "v_type". */ -#define VAR_UNKNOWN 0 -#define VAR_NUMBER 1 /* "v_number" is used */ -#define VAR_STRING 2 /* "v_string" is used */ -#define VAR_FUNC 3 /* "v_string" is function name */ -#define VAR_LIST 4 /* "v_list" is used */ -#define VAR_DICT 5 /* "v_dict" is used */ -#define VAR_FLOAT 6 /* "v_float" is used */ - /* Values for "dv_scope". */ #define VAR_SCOPE 1 /* a:, v:, s:, etc. scope dictionaries */ #define VAR_DEF_SCOPE 2 /* l:, g: scope dictionaries: here funcrefs are not @@ -1172,23 +1260,32 @@ struct listwatch_S /* * Structure to hold info about a list. + * Order of members is optimized to reduce padding. */ struct listvar_S { listitem_T *lv_first; /* first item, NULL if none */ listitem_T *lv_last; /* last item, NULL if none */ - int lv_refcount; /* reference count */ - int lv_len; /* number of items */ listwatch_T *lv_watch; /* first watcher, NULL if none */ - int lv_idx; /* cached index of an item */ listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ - int lv_copyID; /* ID used by deepcopy() */ list_T *lv_copylist; /* copied list used by deepcopy() */ - char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ list_T *lv_used_next; /* next list in used lists list */ list_T *lv_used_prev; /* previous list in used lists list */ + int lv_refcount; /* reference count */ + int lv_len; /* number of items */ + int lv_idx; /* cached index of an item */ + int lv_copyID; /* ID used by deepcopy() */ + char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ }; +/* + * Static list with 10 items. Use init_static_list() to initialize. + */ +typedef struct { + list_T sl_list; /* must be first */ + listitem_T sl_items[10]; +} staticList10_T; + /* * Structure to hold an item of a Dictionary. * Also used for a variable. @@ -1200,13 +1297,22 @@ struct dictitem_S char_u di_flags; /* flags (only used for variable) */ char_u di_key[1]; /* key (actually longer!) */ }; - typedef struct dictitem_S dictitem_T; -#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ -#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */ -#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed variable, not allocated */ -#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */ +/* A dictitem with a 16 character key (plus NUL). */ +struct dictitem16_S +{ + typval_T di_tv; /* type and value of the variable */ + char_u di_flags; /* flags (only used for variable) */ + char_u di_key[17]; /* key */ +}; +typedef struct dictitem16_S dictitem16_T; + +#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ +#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */ +#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed: no :unlet or remove() */ +#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */ +#define DI_FLAGS_ALLOC 16 /* "di_flags" value: separately allocated */ /* * Structure to hold info about a Dictionary. @@ -1223,6 +1329,479 @@ struct dictvar_S dict_T *dv_used_prev; /* previous dict in used dicts list */ }; +#if defined(FEAT_EVAL) || defined(PROTO) +typedef struct funccall_S funccall_T; + +/* + * Structure to hold info for a user function. + */ +typedef struct +{ + int uf_varargs; /* variable nr of arguments */ + int uf_flags; + int uf_calls; /* nr of active calls */ + int uf_cleared; /* func_clear() was already called */ + garray_T uf_args; /* arguments */ + garray_T uf_lines; /* function lines */ +#ifdef FEAT_PROFILE + int uf_profiling; /* TRUE when func is being profiled */ + /* profiling the function as a whole */ + int uf_tm_count; /* nr of calls */ + proftime_T uf_tm_total; /* time spent in function + children */ + proftime_T uf_tm_self; /* time spent in function itself */ + proftime_T uf_tm_children; /* time spent in children this call */ + /* profiling the function per line */ + int *uf_tml_count; /* nr of times line was executed */ + proftime_T *uf_tml_total; /* time spent in a line + children */ + proftime_T *uf_tml_self; /* time spent in a line itself */ + proftime_T uf_tml_start; /* start time for current line */ + proftime_T uf_tml_children; /* time spent in children for this line */ + proftime_T uf_tml_wait; /* start wait time for current line */ + int uf_tml_idx; /* index of line being timed; -1 if none */ + int uf_tml_execed; /* line being timed was executed */ +#endif + scid_T uf_script_ID; /* ID of script where function was defined, + used for s: variables */ + int uf_refcount; /* reference count, see func_name_refcount() */ + funccall_T *uf_scoped; /* l: local variables for closure */ + char_u uf_name[1]; /* name of function (actually longer); can + start with <SNR>123_ (<SNR> is K_SPECIAL + KS_EXTRA KE_SNR) */ +} ufunc_T; + +#define MAX_FUNC_ARGS 20 /* maximum number of function arguments */ +#define VAR_SHORT_LEN 20 /* short variable name length */ +#define FIXVAR_CNT 12 /* number of fixed variables */ + +/* structure to hold info for a function that is currently being executed. */ +struct funccall_S +{ + ufunc_T *func; /* function being called */ + int linenr; /* next line to be executed */ + int returned; /* ":return" used */ + struct /* fixed variables for arguments */ + { + dictitem_T var; /* variable (without room for name) */ + char_u room[VAR_SHORT_LEN]; /* room for the name */ + } fixvar[FIXVAR_CNT]; + dict_T l_vars; /* l: local function variables */ + dictitem_T l_vars_var; /* variable for l: scope */ + dict_T l_avars; /* a: argument variables */ + dictitem_T l_avars_var; /* variable for a: scope */ + list_T l_varlist; /* list for a:000 */ + listitem_T l_listitems[MAX_FUNC_ARGS]; /* listitems for a:000 */ + typval_T *rettv; /* return value */ + linenr_T breakpoint; /* next line with breakpoint or zero */ + int dbg_tick; /* debug_tick when breakpoint was set */ + int level; /* top nesting level of executed function */ +#ifdef FEAT_PROFILE + proftime_T prof_child; /* time spent in a child */ +#endif + funccall_T *caller; /* calling function or NULL */ + + /* for closure */ + int fc_refcount; /* number of user functions that reference this + * funccal */ + int fc_copyID; /* for garbage collection */ + garray_T fc_funcs; /* list of ufunc_T* which keep a reference to + * "func" */ +}; + +/* + * Struct used by trans_function_name() + */ +typedef struct +{ + dict_T *fd_dict; /* Dictionary used */ + char_u *fd_newkey; /* new key in "dict" in allocated memory */ + dictitem_T *fd_di; /* Dictionary item used */ +} funcdict_T; + +#else +/* dummy typedefs for function prototypes */ +typedef struct +{ + int dummy; +} ufunc_T; +typedef struct +{ + int dummy; +} funcdict_T; +#endif + +struct partial_S +{ + int pt_refcount; /* reference count */ + char_u *pt_name; /* function name; when NULL use + * pt_func->uf_name */ + ufunc_T *pt_func; /* function pointer; when NULL lookup function + * with pt_name */ + int pt_auto; /* when TRUE the partial was created for using + dict.member in handle_subscript() */ + int pt_argc; /* number of arguments */ + typval_T *pt_argv; /* arguments in allocated array */ + dict_T *pt_dict; /* dict for "self" */ +}; + +/* Information returned by get_tty_info(). */ +typedef struct { + int backspace; /* what the Backspace key produces */ + int enter; /* what the Enter key produces */ + int interrupt; /* interrupt character */ + int nl_does_cr; /* TRUE when a NL is expanded to CR-NL on output */ +} ttyinfo_T; + +/* Status of a job. Order matters! */ +typedef enum +{ + JOB_FAILED, + JOB_STARTED, + JOB_ENDED, // detected job done + JOB_FINISHED, // job done and cleanup done +} jobstatus_T; + +/* + * Structure to hold info about a Job. + */ +struct jobvar_S +{ + job_T *jv_next; + job_T *jv_prev; +#ifdef UNIX + pid_t jv_pid; +#endif +#ifdef WIN32 + PROCESS_INFORMATION jv_proc_info; + HANDLE jv_job_object; +#endif + char_u *jv_tty_in; /* controlling tty input, allocated */ + char_u *jv_tty_out; /* controlling tty output, allocated */ + jobstatus_T jv_status; + char_u *jv_stoponexit; /* allocated */ + int jv_exitval; + char_u *jv_exit_cb; /* allocated */ + partial_T *jv_exit_partial; + + buf_T *jv_in_buf; /* buffer from "in-name" */ + + int jv_refcount; /* reference count */ + int jv_copyID; + + channel_T *jv_channel; /* channel for I/O, reference counted */ + char **jv_argv; /* command line used to start the job */ +}; + +/* + * Structures to hold info about a Channel. + */ +struct readq_S +{ + char_u *rq_buffer; + long_u rq_buflen; + readq_T *rq_next; + readq_T *rq_prev; +}; + +struct writeq_S +{ + garray_T wq_ga; + writeq_T *wq_next; + writeq_T *wq_prev; +}; + +struct jsonq_S +{ + typval_T *jq_value; + jsonq_T *jq_next; + jsonq_T *jq_prev; + int jq_no_callback; /* TRUE when no callback was found */ +}; + +struct cbq_S +{ + char_u *cq_callback; + partial_T *cq_partial; + int cq_seq_nr; + cbq_T *cq_next; + cbq_T *cq_prev; +}; + +/* mode for a channel */ +typedef enum +{ + MODE_NL = 0, + MODE_RAW, + MODE_JSON, + MODE_JS, +} ch_mode_T; + +typedef enum { + JIO_PIPE, // default + JIO_NULL, + JIO_FILE, + JIO_BUFFER, + JIO_OUT +} job_io_T; + +#define CH_PART_FD(part) ch_part[part].ch_fd + +/* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR + * are polled. */ +typedef enum { + PART_SOCK = 0, +#define CH_SOCK_FD CH_PART_FD(PART_SOCK) +#ifdef FEAT_JOB_CHANNEL + PART_OUT, +# define CH_OUT_FD CH_PART_FD(PART_OUT) + PART_ERR, +# define CH_ERR_FD CH_PART_FD(PART_ERR) + PART_IN, +# define CH_IN_FD CH_PART_FD(PART_IN) +#endif + PART_COUNT, +} ch_part_T; + +#define INVALID_FD (-1) + +/* The per-fd info for a channel. */ +typedef struct { + sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */ + +# if defined(UNIX) && !defined(HAVE_SELECT) + int ch_poll_idx; /* used by channel_poll_setup() */ +# endif + +#ifdef FEAT_GUI_X11 + XtInputId ch_inputHandler; /* Cookie for input */ +#endif +#ifdef FEAT_GUI_GTK + gint ch_inputHandler; /* Cookie for input */ +#endif +#ifdef FEAT_GUI_MACVIM + void *ch_inputHandler; /* Cookie for input */ +#endif + + ch_mode_T ch_mode; + job_io_T ch_io; + int ch_timeout; /* request timeout in msec */ + + readq_T ch_head; /* header for circular raw read queue */ + jsonq_T ch_json_head; /* header for circular json read queue */ + int ch_block_id; /* ID that channel_read_json_block() is + waiting for */ + /* When ch_wait_len is non-zero use ch_deadline to wait for incomplete + * message to be complete. The value is the length of the incomplete + * message when the deadline was set. If it gets longer (something was + * received) the deadline is reset. */ + size_t ch_wait_len; +#ifdef WIN32 + DWORD ch_deadline; +#else + struct timeval ch_deadline; +#endif + int ch_block_write; /* for testing: 0 when not used, -1 when write + * does not block, 1 simulate blocking */ + int ch_nonblocking; /* write() is non-blocking */ + writeq_T ch_writeque; /* header for write queue */ + + cbq_T ch_cb_head; /* dummy node for per-request callbacks */ + char_u *ch_callback; /* call when a msg is not handled */ + partial_T *ch_partial; + + bufref_T ch_bufref; /* buffer to read from or write to */ + int ch_nomodifiable; /* TRUE when buffer can be 'nomodifiable' */ + int ch_nomod_error; /* TRUE when e_modifiable was given */ + int ch_buf_append; /* write appended lines instead top-bot */ + linenr_T ch_buf_top; /* next line to send */ + linenr_T ch_buf_bot; /* last line to send */ +} chanpart_T; + +struct channel_S { + channel_T *ch_next; + channel_T *ch_prev; + + int ch_id; /* ID of the channel */ + int ch_last_msg_id; /* ID of the last message */ + + chanpart_T ch_part[PART_COUNT]; /* info for socket, out, err and in */ + int ch_write_text_mode; /* write buffer lines with CR, not NL */ + + char *ch_hostname; /* only for socket, allocated */ + int ch_port; /* only for socket */ + + int ch_to_be_closed; /* bitset of readable fds to be closed. + * When all readable fds have been closed, + * set to (1 << PART_COUNT). */ + int ch_to_be_freed; /* When TRUE channel must be freed when it's + * safe to invoke callbacks. */ + int ch_error; /* When TRUE an error was reported. Avoids + * giving pages full of error messages when + * the other side has exited, only mention the + * first error until the connection works + * again. */ + + void (*ch_nb_close_cb)(void); + /* callback for Netbeans when channel is + * closed */ + +#ifdef WIN32 + int ch_named_pipe; /* using named pipe instead of pty */ +#endif + char_u *ch_callback; /* call when any msg is not handled */ + partial_T *ch_partial; + char_u *ch_close_cb; /* call when channel is closed */ + partial_T *ch_close_partial; + int ch_drop_never; + int ch_keep_open; /* do not close on read error */ + + job_T *ch_job; /* Job that uses this channel; this does not + * count as a reference to avoid a circular + * reference, the job refers to the channel. */ + int ch_job_killed; /* TRUE when there was a job and it was killed + * or we know it died. */ + + int ch_refcount; /* reference count */ + int ch_copyID; +}; + +#define JO_MODE 0x0001 /* channel mode */ +#define JO_IN_MODE 0x0002 /* stdin mode */ +#define JO_OUT_MODE 0x0004 /* stdout mode */ +#define JO_ERR_MODE 0x0008 /* stderr mode */ +#define JO_CALLBACK 0x0010 /* channel callback */ +#define JO_OUT_CALLBACK 0x0020 /* stdout callback */ +#define JO_ERR_CALLBACK 0x0040 /* stderr callback */ +#define JO_CLOSE_CALLBACK 0x0080 /* "close_cb" */ +#define JO_WAITTIME 0x0100 /* only for ch_open() */ +#define JO_TIMEOUT 0x0200 /* all timeouts */ +#define JO_OUT_TIMEOUT 0x0400 /* stdout timeouts */ +#define JO_ERR_TIMEOUT 0x0800 /* stderr timeouts */ +#define JO_PART 0x1000 /* "part" */ +#define JO_ID 0x2000 /* "id" */ +#define JO_STOPONEXIT 0x4000 /* "stoponexit" */ +#define JO_EXIT_CB 0x8000 /* "exit_cb" */ +#define JO_OUT_IO 0x10000 /* "out_io" */ +#define JO_ERR_IO 0x20000 /* "err_io" (JO_OUT_IO << 1) */ +#define JO_IN_IO 0x40000 /* "in_io" (JO_OUT_IO << 2) */ +#define JO_OUT_NAME 0x80000 /* "out_name" */ +#define JO_ERR_NAME 0x100000 /* "err_name" (JO_OUT_NAME << 1) */ +#define JO_IN_NAME 0x200000 /* "in_name" (JO_OUT_NAME << 2) */ +#define JO_IN_TOP 0x400000 /* "in_top" */ +#define JO_IN_BOT 0x800000 /* "in_bot" */ +#define JO_OUT_BUF 0x1000000 /* "out_buf" */ +#define JO_ERR_BUF 0x2000000 /* "err_buf" (JO_OUT_BUF << 1) */ +#define JO_IN_BUF 0x4000000 /* "in_buf" (JO_OUT_BUF << 2) */ +#define JO_CHANNEL 0x8000000 /* "channel" */ +#define JO_BLOCK_WRITE 0x10000000 /* "block_write" */ +#define JO_OUT_MODIFIABLE 0x20000000 /* "out_modifiable" */ +#define JO_ERR_MODIFIABLE 0x40000000 /* "err_modifiable" (JO_OUT_ << 1) */ +#define JO_ALL 0x7fffffff + +#define JO2_OUT_MSG 0x0001 /* "out_msg" */ +#define JO2_ERR_MSG 0x0002 /* "err_msg" (JO_OUT_ << 1) */ +#define JO2_TERM_NAME 0x0004 /* "term_name" */ +#define JO2_TERM_FINISH 0x0008 /* "term_finish" */ +#define JO2_ENV 0x0010 /* "env" */ +#define JO2_CWD 0x0020 /* "cwd" */ +#define JO2_TERM_ROWS 0x0040 /* "term_rows" */ +#define JO2_TERM_COLS 0x0080 /* "term_cols" */ +#define JO2_VERTICAL 0x0100 /* "vertical" */ +#define JO2_CURWIN 0x0200 /* "curwin" */ +#define JO2_HIDDEN 0x0400 /* "hidden" */ +#define JO2_TERM_OPENCMD 0x0800 /* "term_opencmd" */ +#define JO2_EOF_CHARS 0x1000 /* "eof_chars" */ +#define JO2_NORESTORE 0x2000 /* "norestore" */ +#define JO2_TERM_KILL 0x4000 /* "term_kill" */ +#define JO2_ANSI_COLORS 0x8000 /* "ansi_colors" */ + +#define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE) +#define JO_CB_ALL \ + (JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + JO_CLOSE_CALLBACK) +#define JO_TIMEOUT_ALL (JO_TIMEOUT + JO_OUT_TIMEOUT + JO_ERR_TIMEOUT) + +/* + * Options for job and channel commands. + */ +typedef struct +{ + int jo_set; /* JO_ bits for values that were set */ + int jo_set2; /* JO2_ bits for values that were set */ + + ch_mode_T jo_mode; + ch_mode_T jo_in_mode; + ch_mode_T jo_out_mode; + ch_mode_T jo_err_mode; + + job_io_T jo_io[4]; /* PART_OUT, PART_ERR, PART_IN */ + char_u jo_io_name_buf[4][NUMBUFLEN]; + char_u *jo_io_name[4]; /* not allocated! */ + int jo_io_buf[4]; + int jo_pty; + int jo_modifiable[4]; + int jo_message[4]; + channel_T *jo_channel; + + linenr_T jo_in_top; + linenr_T jo_in_bot; + + char_u *jo_callback; /* not allocated! */ + partial_T *jo_partial; /* not referenced! */ + char_u *jo_out_cb; /* not allocated! */ + partial_T *jo_out_partial; /* not referenced! */ + char_u *jo_err_cb; /* not allocated! */ + partial_T *jo_err_partial; /* not referenced! */ + char_u *jo_close_cb; /* not allocated! */ + partial_T *jo_close_partial; /* not referenced! */ + char_u *jo_exit_cb; /* not allocated! */ + partial_T *jo_exit_partial; /* not referenced! */ + int jo_drop_never; + int jo_waittime; + int jo_timeout; + int jo_out_timeout; + int jo_err_timeout; + int jo_block_write; /* for testing only */ + int jo_part; + int jo_id; + char_u jo_soe_buf[NUMBUFLEN]; + char_u *jo_stoponexit; + dict_T *jo_env; /* environment variables */ + char_u jo_cwd_buf[NUMBUFLEN]; + char_u *jo_cwd; + +#ifdef FEAT_TERMINAL + /* when non-zero run the job in a terminal window of this size */ + int jo_term_rows; + int jo_term_cols; + int jo_vertical; + int jo_curwin; + int jo_hidden; + int jo_term_norestore; + char_u *jo_term_name; + char_u *jo_term_opencmd; + int jo_term_finish; + char_u *jo_eof_chars; + char_u *jo_term_kill; +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + long_u jo_ansi_colors[16]; +# endif +#endif +} jobopt_T; + + +/* structure used for explicit stack while garbage collecting hash tables */ +typedef struct ht_stack_S +{ + hashtab_T *ht; + struct ht_stack_S *prev; +} ht_stack_T; + +/* structure used for explicit stack while garbage collecting lists */ +typedef struct list_stack_S +{ + list_T *list; + struct list_stack_S *prev; +} list_stack_T; + /* values for b_syn_spell: what to do with toplevel text */ #define SYNSPL_DEFAULT 0 /* spell check if @Spell not defined */ #define SYNSPL_TOP 1 /* spell check toplevel text */ @@ -1251,6 +1830,24 @@ typedef struct { } syn_time_T; #endif +#ifdef FEAT_CRYPT +/* + * Structure to hold the type of encryption and the state of encryption or + * decryption. + */ +typedef struct { + int method_nr; + void *method_state; /* method-specific state information */ +} cryptstate_T; + +/* values for method_nr */ +# define CRYPT_M_ZIP 0 +# define CRYPT_M_BF 1 +# define CRYPT_M_BF2 2 +# define CRYPT_M_COUNT 3 /* number of crypt methods */ +#endif + + /* * These are items normally related to a buffer. But when using ":ownsyntax" * a window may have its own instance. @@ -1260,6 +1857,9 @@ typedef struct { hashtab_T b_keywtab; /* syntax keywords hash table */ hashtab_T b_keywtab_ic; /* idem, ignore case */ int b_syn_error; /* TRUE when error occurred in HL */ +# ifdef FEAT_RELTIME + int b_syn_slow; /* TRUE when 'redrawtime' reached */ +# endif int b_syn_ic; /* ignore case for :syn cmds */ int b_syn_spell; /* SYNSPL_ values */ garray_T b_syn_patterns; /* table for syntax patterns */ @@ -1328,6 +1928,8 @@ typedef struct { #if !defined(FEAT_SYN_HL) && !defined(FEAT_SPELL) int dummy; #endif + char_u b_syn_chartab[32]; /* syntax iskeyword option */ + char_u *b_syn_isk; /* iskeyword option */ } synblock_T; @@ -1350,10 +1952,8 @@ struct file_buffer int b_nwindows; /* nr of windows open on this buffer */ int b_flags; /* various BF_ flags */ -#ifdef FEAT_AUTOCMD - int b_closing; /* buffer is being closed, don't let - autocommands close it too. */ -#endif + int b_locked; /* Buffer is being closed or referenced, don't + let autocommands wipe it out. */ /* * b_ffname has the full path of the file (NULL for no name). @@ -1378,15 +1978,24 @@ struct file_buffer char b_fab_rat; /* Record attribute */ unsigned int b_fab_mrs; /* Max record size */ #endif -#ifdef FEAT_SNIFF - int b_sniff; /* file was loaded through Sniff */ -#endif - int b_fnum; /* buffer number for this file. */ + char_u b_key[VIM_SIZEOF_INT * 2 + 1]; + /* key used for buf_hashtab, holds b_fnum as + hex string */ int b_changed; /* 'modified': Set to TRUE if something in the file has been changed and not written out. */ - int b_changedtick; /* incremented for each change, also for undo */ + dictitem16_T b_ct_di; /* holds the b:changedtick value in + b_ct_di.di_tv.vval.v_number; + incremented for each change, also for undo */ +#define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number) + + varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or + TextChangedI was last triggered. */ +#ifdef FEAT_INS_EXPAND + varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was + last triggered. */ +#endif int b_saving; /* Set to TRUE if we are in the middle of saving the buffer. */ @@ -1407,8 +2016,12 @@ struct file_buffer long b_mtime; /* last change time of original file */ long b_mtime_read; /* last change time when reading */ - off_t b_orig_size; /* size of original file in bytes */ + off_T b_orig_size; /* size of original file in bytes */ int b_orig_mode; /* mode of original file */ +#ifdef FEAT_VIMINFO + time_T b_last_used; /* time when the buffer was last used; used + * for viminfo */ +#endif pos_T b_namedm[NMARKS]; /* current named marks (mark.c) */ @@ -1472,7 +2085,7 @@ struct file_buffer long b_u_seq_last; /* last used undo sequence number */ long b_u_save_nr_last; /* counter for last file write */ long b_u_seq_cur; /* hu_seq of header below which we are now */ - time_t b_u_time_cur; /* uh_time of header below which we are now */ + time_T b_u_time_cur; /* uh_time of header below which we are now */ long b_u_save_nr_cur; /* file write nr after which we are now */ /* @@ -1492,12 +2105,8 @@ struct file_buffer #define B_IMODE_USE_INSERT -1 /* Use b_p_iminsert value for search */ #define B_IMODE_NONE 0 /* Input via none */ #define B_IMODE_LMAP 1 /* Input via langmap */ -#ifndef USE_IM_CONTROL -# define B_IMODE_LAST 1 -#else -# define B_IMODE_IM 2 /* Input via input method */ -# define B_IMODE_LAST 2 -#endif +#define B_IMODE_IM 2 /* Input via input method */ +#define B_IMODE_LAST 2 #ifdef FEAT_KEYMAP short b_kmap_state; /* using "lmap" mappings */ @@ -1519,14 +2128,19 @@ struct file_buffer int b_p_ai; /* 'autoindent' */ int b_p_ai_nopaste; /* b_p_ai saved for paste mode */ + char_u *b_p_bkc; /* 'backupcopy' */ + unsigned b_bkc_flags; /* flags for 'backupcopy' */ int b_p_ci; /* 'copyindent' */ int b_p_bin; /* 'binary' */ #ifdef FEAT_MBYTE int b_p_bomb; /* 'bomb' */ #endif -#if defined(FEAT_QUICKFIX) char_u *b_p_bh; /* 'bufhidden' */ char_u *b_p_bt; /* 'buftype' */ +#ifdef FEAT_QUICKFIX +#define BUF_HAS_QF_ENTRY 1 +#define BUF_HAS_LL_ENTRY 2 + int b_has_qf_entry; #endif int b_p_bl; /* 'buflisted' */ #ifdef FEAT_CINDENT @@ -1551,15 +2165,15 @@ struct file_buffer char_u *b_p_ofu; /* 'omnifunc' */ #endif int b_p_eol; /* 'endofline' */ + int b_p_fixeol; /* 'fixendofline' */ int b_p_et; /* 'expandtab' */ int b_p_et_nobin; /* b_p_et saved for binary mode */ + int b_p_et_nopaste; /* b_p_et saved for paste mode */ #ifdef FEAT_MBYTE char_u *b_p_fenc; /* 'fileencoding' */ #endif char_u *b_p_ff; /* 'fileformat' */ -#ifdef FEAT_AUTOCMD char_u *b_p_ft; /* 'filetype' */ -#endif char_u *b_p_fo; /* 'formatoptions' */ char_u *b_p_flp; /* 'formatlistpat' */ int b_p_inf; /* 'infercase' */ @@ -1577,6 +2191,7 @@ struct file_buffer long_u b_p_inde_flags; /* flags for 'indentexpr' */ char_u *b_p_indk; /* 'indentkeys' */ #endif + char_u *b_p_fp; /* 'formatprg' */ #if defined(FEAT_EVAL) char_u *b_p_fex; /* 'formatexpr' */ long_u b_p_fex_flags; /* flags for 'formatexpr' */ @@ -1587,8 +2202,14 @@ struct file_buffer char_u *b_p_kp; /* 'keywordprg' */ #ifdef FEAT_LISP int b_p_lisp; /* 'lisp' */ +#endif +#ifdef FEAT_MBYTE + char_u *b_p_menc; /* 'makeencoding' */ #endif char_u *b_p_mps; /* 'matchpairs' */ +#ifdef USE_MIGEMO + int b_p_migemo; /* 'migemo' */ +#endif int b_p_ml; /* 'modeline' */ int b_p_ml_nobin; /* b_p_ml saved for binary mode */ int b_p_ma; /* 'modifiable' */ @@ -1599,9 +2220,7 @@ struct file_buffer #endif int b_p_ro; /* 'readonly' */ long b_p_sw; /* 'shiftwidth' */ -#ifndef SHORT_FNAME int b_p_sn; /* 'shortname' */ -#endif #ifdef FEAT_SMARTINDENT int b_p_si; /* 'smartindent' */ #endif @@ -1637,6 +2256,8 @@ struct file_buffer char_u *b_p_path; /* 'path' local value */ int b_p_ar; /* 'autoread' local value */ char_u *b_p_tags; /* 'tags' local value */ + char_u *b_p_tc; /* 'tagcase' local value */ + unsigned b_tc_flags; /* flags for 'tagcase' */ #ifdef FEAT_INS_EXPAND char_u *b_p_dict; /* 'dictionary' local value */ char_u *b_p_tsr; /* 'thesaurus' local value */ @@ -1651,6 +2272,9 @@ struct file_buffer #ifdef FEAT_LISP char_u *b_p_lw; /* 'lispwords' local value */ #endif +#ifdef FEAT_TERMINAL + long b_p_twsl; /* 'termwinscroll' */ +#endif /* end of buffer options */ @@ -1691,6 +2315,7 @@ struct file_buffer int b_ind_hash_comment; int b_ind_cpp_namespace; int b_ind_if_for_while; + int b_ind_cpp_extern_c; #endif linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary @@ -1738,10 +2363,17 @@ struct file_buffer access b_spell without #ifdef. */ #endif -#ifndef SHORT_FNAME int b_shortname; /* this file has an 8.3 file name */ -#endif +#ifdef FEAT_JOB_CHANNEL + char_u *b_prompt_text; // set by prompt_setprompt() + char_u *b_prompt_callback; // set by prompt_setcallback() + partial_T *b_prompt_partial; // set by prompt_setcallback() + char_u *b_prompt_interrupt; // set by prompt_setinterrupt() + partial_T *b_prompt_int_partial; // set by prompt_setinterrupt() + int b_prompt_insert; // value for restart_edit when entering + // a prompt buffer window. +#endif #ifdef FEAT_MZSCHEME void *b_mzscheme_ref; /* The MzScheme reference to this buffer */ #endif @@ -1774,26 +2406,47 @@ struct file_buffer #ifdef FEAT_SIGNS signlist_T *b_signlist; /* list of signs to draw */ +# ifdef FEAT_NETBEANS_INTG + int b_has_sign_column; /* Flag that is set when a first sign is + * added and remains set until the end of + * the netbeans session. */ +# endif #endif #ifdef FEAT_NETBEANS_INTG int b_netbeans_file; /* TRUE when buffer is owned by NetBeans */ int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */ #endif +#ifdef FEAT_JOB_CHANNEL + int b_write_to_channel; /* TRUE when appended lines are written to + * a channel. */ +#endif #ifdef FEAT_ODB_EDITOR uint32_t b_odb_server_id; /* FourCC of the ODB server (0 if none) */ void *b_odb_token; /* NSAppleEventDescriptor (optional) */ char_u *b_odb_fname; /* Custom file name (optional) */ #endif -}; + +#ifdef FEAT_CRYPT + cryptstate_T *b_cryptstate; /* Encryption state while reading or writing + * the file. NULL when not using encryption. */ +#endif + int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */ + +#ifdef FEAT_TERMINAL + term_T *b_term; /* When not NULL this buffer is for a terminal + * window. */ +#endif + +}; /* file_buffer */ #ifdef FEAT_DIFF /* * Stuff for diff mode. */ -# define DB_COUNT 4 /* up to four buffers can be diff'ed */ +# define DB_COUNT 8 /* up to eight buffers can be diff'ed */ /* * Each diffblock defines where a block of lines starts in each of the buffers @@ -1819,12 +2472,8 @@ struct diffblock_S #endif #define SNAP_HELP_IDX 0 -#ifdef FEAT_AUTOCMD -# define SNAP_AUCMD_IDX 1 -# define SNAP_COUNT 2 -#else -# define SNAP_COUNT 1 -#endif +#define SNAP_AUCMD_IDX 1 +#define SNAP_COUNT 2 /* * Tab pages point to the top frame of each tab page. @@ -1899,10 +2548,8 @@ typedef struct w_line struct frame_S { char fr_layout; /* FR_LEAF, FR_COL or FR_ROW */ -#ifdef FEAT_VERTSPLIT int fr_width; int fr_newwidth; /* new width used in win_equal_rec() */ -#endif int fr_height; int fr_newheight; /* new height used in win_equal_rec() */ frame_T *fr_parent; /* containing frame or NULL */ @@ -1936,6 +2583,8 @@ typedef struct linenr_T first_lnum; /* first lnum to search for multi-line pat */ colnr_T startcol; /* in win_line() points to char where HL starts */ colnr_T endcol; /* in win_line() points to char where HL ends */ + int is_addpos; /* position specified directly by + matchaddpos(). TRUE/FALSE */ #ifdef FEAT_RELTIME proftime_T tm; /* for a time limit */ #endif @@ -1982,8 +2631,19 @@ struct matchitem regmmatch_T match; /* regexp program for pattern */ posmatch_T pos; /* position matches */ match_T hl; /* struct for doing the actual highlighting */ +#ifdef FEAT_CONCEAL + int conceal_char; /* cchar for Conceal highlighting */ +#endif }; +#ifdef FEAT_MENU +typedef struct { + int wb_startcol; + int wb_endcol; + vimmenu_T *wb_menu; +} winbar_item_T; +#endif + /* * Structure which contains all information that belongs to a window * @@ -1991,6 +2651,8 @@ struct matchitem */ struct window_S { + int w_id; /* unique window ID */ + buf_T *w_buffer; /* buffer we are a window into (used often, keep it the first item!) */ @@ -1998,14 +2660,10 @@ struct window_S synblock_T *w_s; /* for :ownsyntax */ #endif -#ifdef FEAT_WINDOWS win_T *w_prev; /* link to previous window */ win_T *w_next; /* link to next window */ -#endif -#ifdef FEAT_AUTOCMD int w_closing; /* window is being closed, don't let autocommands close it too. */ -#endif frame_T *w_frame; /* frame containing this window */ @@ -2020,7 +2678,7 @@ struct window_S current virtual column */ /* - * the next six are used to update the visual part + * the next seven are used to update the visual part */ char w_old_visual_mode; /* last known VIsual_mode */ linenr_T w_old_cursor_lnum; /* last known end of visual part */ @@ -2036,10 +2694,8 @@ struct window_S */ linenr_T w_topline; /* buffer line number of the line at the top of the window */ -#ifdef FEAT_AUTOCMD char w_topline_was_set; /* flag set to TRUE when topline is set, e.g. by winrestview() */ -#endif #ifdef FEAT_DIFF int w_topfill; /* number of filler lines above w_topline */ int w_old_topfill; /* w_topfill at last redraw */ @@ -2057,22 +2713,13 @@ struct window_S * Layout of the window in the screen. * May need to add "msg_scrolled" to "w_winrow" in rare situations. */ -#ifdef FEAT_WINDOWS int w_winrow; /* first row of window in screen */ -#endif int w_height; /* number of rows in window, excluding - status/command line(s) */ -#ifdef FEAT_WINDOWS + status/command/winbar line(s) */ int w_status_height; /* number of status lines (0 or 1) */ -#endif -#ifdef FEAT_VERTSPLIT - int w_wincol; /* Leftmost column of window in screen. - use W_WINCOL() */ - int w_width; /* Width of window, excluding separation. - use W_WIDTH() */ - int w_vsep_width; /* Number of separator columns (0 or 1). - use W_VSEP_WIDTH() */ -#endif + int w_wincol; /* Leftmost column of window in screen. */ + int w_width; /* Width of window, excluding separation. */ + int w_vsep_width; /* Number of separator columns (0 or 1). */ /* * === start of cached values ==== @@ -2114,7 +2761,7 @@ struct window_S int w_wrow, w_wcol; /* cursor position in window */ linenr_T w_botline; /* number of the line below the bottom of - the screen */ + the window */ int w_empty_rows; /* number of ~ rows in window */ #ifdef FEAT_DIFF int w_filler_rows; /* number of filler rows at the end of the @@ -2155,9 +2802,7 @@ struct window_S w_redr_type is REDRAW_TOP */ linenr_T w_redraw_top; /* when != 0: first line needing redraw */ linenr_T w_redraw_bot; /* when != 0: last line needing redraw */ -#ifdef FEAT_WINDOWS int w_redr_status; /* if TRUE status line must be redrawn */ -#endif #ifdef FEAT_CMDL_INFO /* remember what is shown in the ruler for this window (if 'ruler' set) */ @@ -2173,15 +2818,19 @@ struct window_S int w_alt_fnum; /* alternate file (for # and CTRL-^) */ -#ifdef FEAT_WINDOWS alist_T *w_alist; /* pointer to arglist for this window */ -#endif int w_arg_idx; /* current index in argument list (can be out of range!) */ int w_arg_idx_invalid; /* editing another file than w_arg_idx */ char_u *w_localdir; /* absolute path of local directory or NULL */ +#ifdef FEAT_MENU + vimmenu_T *w_winbar; /* The root of the WinBar menu hierarchy. */ + winbar_item_T *w_winbar_items; /* list of items in the WinBar */ + int w_winbar_height; /* 1 if there is a window toolbar */ +#endif + /* * Options local to a window. * They are local because they influence the layout of the window or @@ -2212,9 +2861,7 @@ struct window_S /* transform a pointer to a "onebuf" option into a "allbuf" option */ #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) -#ifdef FEAT_SCROLLBIND long w_scbind_pos; -#endif #ifdef FEAT_EVAL dictitem_T w_winvar; /* variable for "w:" Dictionary */ @@ -2274,6 +2921,7 @@ struct window_S #ifdef FEAT_LINEBREAK linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width * was computed. */ + long w_nuw_cached; /* 'numberwidth' option cached */ int w_nrwidth_width; /* nr of chars to print line count. */ #endif @@ -2339,10 +2987,8 @@ typedef struct oparg_S int block_mode; /* current operator is Visual block mode */ colnr_T start_vcol; /* start col for block mode operator */ colnr_T end_vcol; /* end col for block mode operator */ -#ifdef FEAT_AUTOCMD long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */ long prev_count0; /* ca.count0 saved for K_CURSORHOLD */ -#endif } oparg_T; /* @@ -2447,8 +3093,6 @@ typedef struct cursor_entry /* Start a menu name with this to not include it on the main menu bar */ #define MNU_HIDDEN_CHAR ']' -typedef struct VimMenu vimmenu_T; - struct VimMenu { int modes; /* Which modes is this menu visible for? */ @@ -2465,7 +3109,7 @@ struct VimMenu char_u *actext; /* accelerator text (after TAB) */ int priority; /* Menu order priority */ #ifdef FEAT_GUI - void (*cb) __ARGS((vimmenu_T *)); /* Call-back routine */ + void (*cb)(vimmenu_T *); /* Call-back routine */ #endif #ifdef FEAT_TOOLBAR char_u *iconfile; /* name of file for icon or NULL */ @@ -2485,7 +3129,9 @@ struct VimMenu #ifdef FEAT_GUI_GTK GtkWidget *id; /* Manage this to enable item */ GtkWidget *submenu_id; /* If this is submenu, add children here */ +# if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0) GtkWidget *tearoff_handle; +# endif GtkWidget *label; /* Used by "set wak=" code. */ #endif #ifdef FEAT_GUI_MOTIF @@ -2499,10 +3145,6 @@ struct VimMenu #ifdef FEAT_BEVAL_TIP BalloonEval *tip; /* tooltip for this menu item */ #endif -#ifdef FEAT_GUI_W16 - UINT id; /* Id of menu item */ - HMENU submenu_id; /* If this is submenu, add children here */ -#endif #ifdef FEAT_GUI_W32 UINT id; /* Id of menu item */ HMENU submenu_id; /* If this is submenu, add children here */ @@ -2537,18 +3179,16 @@ typedef int vimmenu_T; /* * Struct to save values in before executing autocommands for a buffer that is - * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered. + * not the current buffer. */ typedef struct { buf_T *save_curbuf; /* saved curbuf */ -#ifdef FEAT_AUTOCMD int use_aucmd_win; /* using aucmd_win */ win_T *save_curwin; /* saved curwin */ win_T *new_curwin; /* new curwin */ - buf_T *new_curbuf; /* new curbuf */ + bufref_T new_curbuf; /* new curbuf */ char_u *globaldir; /* saved value of globaldir */ -#endif } aco_save_T; /* @@ -2629,14 +3269,194 @@ typedef struct /* * Array indexes used for cptext argument of ins_compl_add(). */ -#define CPT_ABBR 0 /* "abbr" */ -#define CPT_MENU 1 /* "menu" */ -#define CPT_KIND 2 /* "kind" */ -#define CPT_INFO 3 /* "info" */ -#define CPT_COUNT 4 /* Number of entries */ +#define CPT_ABBR 0 /* "abbr" */ +#define CPT_MENU 1 /* "menu" */ +#define CPT_KIND 2 /* "kind" */ +#define CPT_INFO 3 /* "info" */ +#define CPT_USER_DATA 4 /* "user data" */ +#define CPT_COUNT 5 /* Number of entries */ typedef struct { UINT32_T total[2]; UINT32_T state[8]; char_u buffer[64]; } context_sha256_T; + +/* + * types for expressions. + */ +typedef enum +{ + TYPE_UNKNOWN = 0, + TYPE_EQUAL, // == + TYPE_NEQUAL, // != + TYPE_GREATER, // > + TYPE_GEQUAL, // >= + TYPE_SMALLER, // < + TYPE_SEQUAL, // <= + TYPE_MATCH, // =~ + TYPE_NOMATCH, // !~ +} exptype_T; + +/* + * Structure used for reading in json_decode(). + */ +struct js_reader +{ + char_u *js_buf; /* text to be decoded */ + char_u *js_end; /* NUL in js_buf */ + int js_used; /* bytes used from js_buf */ + int (*js_fill)(struct js_reader *); + /* function to fill the buffer or NULL; + * return TRUE when the buffer was filled */ + void *js_cookie; /* can be used by js_fill */ + int js_cookie_arg; /* can be used by js_fill */ +}; +typedef struct js_reader js_read_T; + +typedef struct timer_S timer_T; +struct timer_S +{ + long tr_id; +#ifdef FEAT_TIMERS + timer_T *tr_next; + timer_T *tr_prev; + proftime_T tr_due; /* when the callback is to be invoked */ + char tr_firing; /* when TRUE callback is being called */ + char tr_paused; /* when TRUE callback is not invoked */ + int tr_repeat; /* number of times to repeat, -1 forever */ + long tr_interval; /* msec */ + char_u *tr_callback; /* allocated */ + partial_T *tr_partial; + int tr_emsg_count; +#endif +}; + +/* Maximum number of commands from + or -c arguments. */ +#define MAX_ARG_CMDS 10 + +/* values for "window_layout" */ +#define WIN_HOR 1 /* "-o" horizontally split windows */ +#define WIN_VER 2 /* "-O" vertically split windows */ +#define WIN_TABS 3 /* "-p" windows on tab pages */ + +/* Struct for various parameters passed between main() and other functions. */ +typedef struct +{ + int argc; + char **argv; + + char_u *fname; /* first file to edit */ + + int evim_mode; /* started as "evim" */ + char_u *use_vimrc; /* vimrc from -u argument */ + int clean; /* --clean argument */ + + int n_commands; /* no. of commands from + or -c */ + char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ + char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ + int n_pre_commands; /* no. of commands from --cmd */ + char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */ + + int edit_type; /* type of editing to do */ + char_u *tagname; /* tag from -t argument */ +#ifdef FEAT_QUICKFIX + char_u *use_ef; /* 'errorfile' from -q argument */ +#endif + + int want_full_screen; + int not_a_term; /* no warning for missing term? */ + int tty_fail; /* exit if not a tty */ + char_u *term; /* specified terminal name */ +#ifdef FEAT_CRYPT + int ask_for_key; /* -x argument */ +#endif + int no_swap_file; /* "-n" argument used */ +#ifdef FEAT_EVAL + int use_debug_break_level; +#endif + int window_count; /* number of windows to use */ + int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */ + +#ifdef FEAT_CLIENTSERVER + int serverArg; /* TRUE when argument for a server */ + char_u *serverName_arg; /* cmdline arg for server name */ + char_u *serverStr; /* remote server command */ + char_u *serverStrEnc; /* encoding of serverStr */ + char_u *servername; /* allocated name for our server */ +#endif +#if !defined(UNIX) +# define EXPAND_FILENAMES + int literal; /* don't expand file names */ +#endif +#ifdef MSWIN + int full_path; /* file name argument was full path */ +#endif +#ifdef FEAT_DIFF + int diff_mode; /* start with 'diff' set */ +#endif +} mparm_T; + +/* + * Structure returned by get_lval() and used by set_var_lval(). + * For a plain name: + * "name" points to the variable name. + * "exp_name" is NULL. + * "tv" is NULL + * For a magic braces name: + * "name" points to the expanded variable name. + * "exp_name" is non-NULL, to be freed later. + * "tv" is NULL + * For an index in a list: + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the (first) list item value + * "li" points to the (first) list item + * "range", "n1", "n2" and "empty2" indicate what items are used. + * For an existing Dict item: + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the dict item value + * "newkey" is NULL + * For a non-existing Dict item: + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the Dictionary typval_T + * "newkey" is the key for the new item. + */ +typedef struct lval_S +{ + char_u *ll_name; /* start of variable name (can be NULL) */ + char_u *ll_exp_name; /* NULL or expanded name in allocated memory. */ + typval_T *ll_tv; /* Typeval of item being used. If "newkey" + isn't NULL it's the Dict to which to add + the item. */ + listitem_T *ll_li; /* The list item or NULL. */ + list_T *ll_list; /* The list or NULL. */ + int ll_range; /* TRUE when a [i:j] range was used */ + long ll_n1; /* First index for list */ + long ll_n2; /* Second index for list range */ + int ll_empty2; /* Second index is empty: [i:] */ + dict_T *ll_dict; /* The Dictionary or NULL */ + dictitem_T *ll_di; /* The dictitem or NULL */ + char_u *ll_newkey; /* New key for Dict in alloc. mem or NULL. */ +} lval_T; + +/* Structure used to save the current state. Used when executing Normal mode + * commands while in any other mode. */ +typedef struct { + int save_msg_scroll; + int save_restart_edit; + int save_msg_didout; + int save_State; + int save_insertmode; + int save_finish_op; + int save_opcount; + tasave_T tabuf; +} save_state_T; + +typedef struct { + varnumber_T vv_prevcount; + varnumber_T vv_count; + varnumber_T vv_count1; +} vimvars_save_T; diff --git a/src/swis.s b/src/swis.s deleted file mode 100644 index 562747adba..0000000000 --- a/src/swis.s +++ /dev/null @@ -1,143 +0,0 @@ -; Thomas Leonard -; 24/5/98 - -ar0 rn 0 -ar1 rn 1 -ar2 rn 2 -ar3 rn 3 -ar4 rn 4 -ar5 rn 5 -ar6 rn 6 -ar7 rn 7 -ar10 rn 10 -ar11 rn 11 -lk rn 14 -ar15 rn 15 - - AREA DATA - align 4 - - export |r0| -r0: dcd 0 - - export |r1| -r1: dcd 0 - - export |r2| -r2: dcd 0 - - export |r3| -r3: dcd 0 - - export |r4| -r4: dcd 0 - - export |r5| -r5: dcd 0 - - export |r6| -r6: dcd 0 - - export |r7| -r7: dcd 0 - - export |time_of_last_poll| -time_of_last_poll: dcd 0 - - AREA CODE, READONLY - align 4 - import |r0| - export |swi| - = "swi" - align 4 -swi: - ; r0 = swi number - stmfd sp!,{ar4-ar10,lk} - orr ar10,ar0,#1<<17 ;always use the X form - mov ar0,ar1 - mov ar1,ar2 - mov ar2,ar3 - add ar3,sp,#4*8 - ldmia ar3,{ar3-ar7} - swi 0x6f ; OS_CallASWI - ldr ar10,regs_addr - stmia ar10,{ar0-ar7} - ldmvcfd sp!,{ar4-ar10,pc}^ - ; report the error and quit on Cancel - mov r1,#0x17 - adr r2,s_title - swi 0x400df ; Wimp_ReportError - cmp r1,#1 ;OK selected? - ldmeqfd sp!,{ar4-ar10,pc}^ ;yes - try to continue - swi 0x11 ;no - die (OS_Exit) -s_title: - = "Nasty error - Cancel to quit" - = 0 - - align 4 - export |xswi| - = "xswi" - align 4 -xswi: - ; r0 = swi number - stmfd sp!,{ar4-ar10,lk} - orr ar10,ar0,#1<<17 ;always use the X form - mov ar0,ar1 - mov ar1,ar2 - mov ar2,ar3 - add ar3,sp,#4*8 - ldmia ar3,{ar3-ar7} - swi 0x6f ; OS_CallASWI - ldr ar10,regs_addr - stmia ar10,{ar0-ar7} - mov ar0,#0 - orr ar0,ar0,ar15 - ldmfd sp!,{ar4-ar10,pc}^ - -regs_addr: - dcd r0 - - ; The Wimp_Poll swis have to be done specially because, - ; for some reason, r13 sometimes gets corrupted by Wimp_Poll - ; (eg when running FileFind) - AREA CODE, READONLY - align 4 - import |time_of_last_poll| - export |wimp_poll| - = "wimp_poll" - align 4 -wimp_poll: - mov ar3,sp - swi 0x400c7 ; Wimp_Poll - mov sp,ar3 - - mov ar3,ar0 - swi 0x42 ; OS_ReadMonotonicTime - ldr ar2,addr_time - str ar0,[ar2] - mov ar0,ar3 - - mov ar2,#0 - wfs ar2 ; Write floating point status. Needed? - movs pc,lk - - align 4 - export |wimp_pollidle| - = "wimp_pollidle" - align 4 -wimp_pollidle: - mov ar3,sp - swi 0x400e1 ; Wimp_PollIdle - mov sp,ar3 - - mov ar3,ar0 - swi 0x42 ; OS_ReadMonotonicTime - ldr ar2,addr_time - str ar0,[ar2] - mov ar0,ar3 - - mov ar2,#0 - wfs ar2 ; Write floating point status. Needed? - movs pc,lk - -addr_time: dcd time_of_last_poll diff --git a/src/syntax.c b/src/syntax.c index 6e28c456cc..9d80e79165 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -22,6 +22,7 @@ struct hl_group { char_u *sg_name; /* highlight group name */ char_u *sg_name_u; /* uppercase of sg_name */ + int sg_cleared; /* "hi clear" was used */ /* for normal terminals */ int sg_term; /* "term=" highlighting attributes */ char_u *sg_start; /* terminal string for start highl */ @@ -33,10 +34,12 @@ struct hl_group int sg_cterm_fg; /* terminal fg color number + 1 */ int sg_cterm_bg; /* terminal bg color number + 1 */ int sg_cterm_attr; /* Screen attr for color term mode */ -#ifdef FEAT_GUI /* for when using the GUI */ +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) guicolor_T sg_gui_fg; /* GUI foreground color handle */ guicolor_T sg_gui_bg; /* GUI background color handle */ +#endif +#ifdef FEAT_GUI guicolor_T sg_gui_sp; /* GUI special color handle */ GuiFont sg_font; /* GUI font handle */ #ifdef FEAT_XFONTSET @@ -83,29 +86,31 @@ static int include_link = 0; /* when 2 include "link" and "clear" */ */ static char *(hl_name_table[]) = {"bold", "standout", "underline", "undercurl", - "italic", "reverse", "inverse", "NONE"}; + "italic", "reverse", "inverse", "nocombine", "strikethrough", "NONE"}; static int hl_attr_table[] = - {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, 0}; - -static int get_attr_entry __ARGS((garray_T *table, attrentry_T *aep)); -static void syn_unadd_group __ARGS((void)); -static void set_hl_attr __ARGS((int idx)); -static void highlight_list_one __ARGS((int id)); -static int highlight_list_arg __ARGS((int id, int didh, int type, int iarg, char_u *sarg, char *name)); -static int syn_add_group __ARGS((char_u *name)); -static int syn_list_header __ARGS((int did_header, int outlen, int id)); -static int hl_has_settings __ARGS((int idx, int check_link)); -static void highlight_clear __ARGS((int idx)); - + {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, HL_STRIKETHROUGH, 0}; +#define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? attr_b : (attr_a)) | (attr_b)) + +static int get_attr_entry(garray_T *table, attrentry_T *aep); +static void syn_unadd_group(void); +static void set_hl_attr(int idx); +static void highlight_list_one(int id); +static int highlight_list_arg(int id, int didh, int type, int iarg, char_u *sarg, char *name); +static int syn_add_group(char_u *name); +static int syn_list_header(int did_header, int outlen, int id); +static int hl_has_settings(int idx, int check_link); +static void highlight_clear(int idx); + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +static void gui_do_one_color(int idx, int do_menu, int do_tooltip); +#endif #ifdef FEAT_GUI -static void gui_do_one_color __ARGS((int idx, int do_menu, int do_tooltip)); -static int set_group_colors __ARGS((char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip)); -static guicolor_T color_name2handle __ARGS((char_u *name)); -static GuiFont font_name2handle __ARGS((char_u *name)); +static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); +static GuiFont font_name2handle(char_u *name); # ifdef FEAT_XFONTSET -static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width)); +static GuiFontset fontset_name2handle(char_u *name, int fixed_width); # endif -static void hl_do_font __ARGS((int idx, char_u *arg, int do_normal, int do_menu, int do_tooltip, int free_font)); +static void hl_do_font(int idx, char_u *arg, int do_normal, int do_menu, int do_tooltip, int free_font); #endif /* @@ -140,30 +145,32 @@ static char *(spo_name_tab[SPO_COUNT]) = * * A character offset can be given for the matched text (_m_start and _m_end) * and for the actually highlighted text (_h_start and _h_end). + * + * Note that ordering of members is optimized to reduce padding. */ typedef struct syn_pattern { char sp_type; /* see SPTYPE_ defines below */ char sp_syncing; /* this item used for syncing */ + short sp_syn_match_id; /* highlight group ID of pattern */ + short sp_off_flags; /* see below */ + int sp_offsets[SPO_COUNT]; /* offsets */ int sp_flags; /* see HL_ defines below */ #ifdef FEAT_CONCEAL int sp_cchar; /* conceal substitute character */ #endif + int sp_ic; /* ignore-case flag for sp_prog */ + int sp_sync_idx; /* sync item index (syncing only) */ + int sp_line_id; /* ID of last line where tried */ + int sp_startcol; /* next match in sp_line_id line */ + short *sp_cont_list; /* cont. group IDs, if non-zero */ + short *sp_next_list; /* next group IDs, if non-zero */ struct sp_syn sp_syn; /* struct passed to in_id_list() */ - short sp_syn_match_id; /* highlight group ID of pattern */ char_u *sp_pattern; /* regexp to match, pattern */ regprog_T *sp_prog; /* regexp to match, program */ #ifdef FEAT_PROFILE syn_time_T sp_time; #endif - int sp_ic; /* ignore-case flag for sp_prog */ - short sp_off_flags; /* see below */ - int sp_offsets[SPO_COUNT]; /* offsets */ - short *sp_cont_list; /* cont. group IDs, if non-zero */ - short *sp_next_list; /* next group IDs, if non-zero */ - int sp_sync_idx; /* sync item index (syncing only) */ - int sp_line_id; /* ID of last line where tried */ - int sp_startcol; /* next match in sp_line_id line */ } synpat_T; /* The sp_off_flags are computed like this: @@ -311,7 +318,7 @@ typedef struct state_item but contained groups */ #ifdef FEAT_CONCEAL -static int next_seqnr = 0; /* value to use for si_seqnr */ +static int next_seqnr = 1; /* value to use for si_seqnr */ #endif /* @@ -362,6 +369,9 @@ static reg_extmatch_T *next_match_extmatch = NULL; static win_T *syn_win; /* current window for highlighting */ static buf_T *syn_buf; /* current buffer for highlighting */ static synblock_T *syn_block; /* current buffer for highlighting */ +#ifdef FEAT_RELTIME +static proftime_T *syn_tm; /* timeout limit */ +#endif static linenr_T current_lnum = 0; /* lnum of current state */ static colnr_T current_col = 0; /* column of current state */ static int current_state_stored = 0; /* TRUE if stored current state @@ -375,40 +385,42 @@ static int current_line_id = 0; /* unique number for current line */ #define CUR_STATE(idx) ((stateitem_T *)(current_state.ga_data))[idx] -static void syn_sync __ARGS((win_T *wp, linenr_T lnum, synstate_T *last_valid)); -static int syn_match_linecont __ARGS((linenr_T lnum)); -static void syn_start_line __ARGS((void)); -static void syn_update_ends __ARGS((int startofline)); -static void syn_stack_alloc __ARGS((void)); -static int syn_stack_cleanup __ARGS((void)); -static void syn_stack_free_entry __ARGS((synblock_T *block, synstate_T *p)); -static synstate_T *syn_stack_find_entry __ARGS((linenr_T lnum)); -static synstate_T *store_current_state __ARGS((void)); -static void load_current_state __ARGS((synstate_T *from)); -static void invalidate_current_state __ARGS((void)); -static int syn_stack_equal __ARGS((synstate_T *sp)); -static void validate_current_state __ARGS((void)); -static int syn_finish_line __ARGS((int syncing)); -static int syn_current_attr __ARGS((int syncing, int displaying, int *can_spell, int keep_state)); -static int did_match_already __ARGS((int idx, garray_T *gap)); -static stateitem_T *push_next_match __ARGS((stateitem_T *cur_si)); -static void check_state_ends __ARGS((void)); -static void update_si_attr __ARGS((int idx)); -static void check_keepend __ARGS((void)); -static void update_si_end __ARGS((stateitem_T *sip, int startcol, int force)); -static short *copy_id_list __ARGS((short *list)); -static int in_id_list __ARGS((stateitem_T *item, short *cont_list, struct sp_syn *ssp, int contained)); -static int push_current_state __ARGS((int idx)); -static void pop_current_state __ARGS((void)); +static void syn_sync(win_T *wp, linenr_T lnum, synstate_T *last_valid); +static void save_chartab(char_u *chartab); +static void restore_chartab(char_u *chartab); +static int syn_match_linecont(linenr_T lnum); +static void syn_start_line(void); +static void syn_update_ends(int startofline); +static void syn_stack_alloc(void); +static int syn_stack_cleanup(void); +static void syn_stack_free_entry(synblock_T *block, synstate_T *p); +static synstate_T *syn_stack_find_entry(linenr_T lnum); +static synstate_T *store_current_state(void); +static void load_current_state(synstate_T *from); +static void invalidate_current_state(void); +static int syn_stack_equal(synstate_T *sp); +static void validate_current_state(void); +static int syn_finish_line(int syncing); +static int syn_current_attr(int syncing, int displaying, int *can_spell, int keep_state); +static int did_match_already(int idx, garray_T *gap); +static stateitem_T *push_next_match(stateitem_T *cur_si); +static void check_state_ends(void); +static void update_si_attr(int idx); +static void check_keepend(void); +static void update_si_end(stateitem_T *sip, int startcol, int force); +static short *copy_id_list(short *list); +static int in_id_list(stateitem_T *item, short *cont_list, struct sp_syn *ssp, int contained); +static int push_current_state(int idx); +static void pop_current_state(void); #ifdef FEAT_PROFILE -static void syn_clear_time __ARGS((syn_time_T *tt)); -static void syntime_clear __ARGS((void)); +static void syn_clear_time(syn_time_T *tt); +static void syntime_clear(void); #ifdef __BORLANDC__ -static int _RTLENTRYF syn_compare_syntime __ARGS((const void *v1, const void *v2)); +static int _RTLENTRYF syn_compare_syntime(const void *v1, const void *v2); #else -static int syn_compare_syntime __ARGS((const void *v1, const void *v2)); +static int syn_compare_syntime(const void *v1, const void *v2); #endif -static void syntime_report __ARGS((void)); +static void syntime_report(void); static int syn_time_on = FALSE; # define IF_SYN_TIME(p) (p) #else @@ -416,67 +428,80 @@ static int syn_time_on = FALSE; typedef int syn_time_T; #endif -static void syn_stack_apply_changes_block __ARGS((synblock_T *block, buf_T *buf)); -static void find_endpos __ARGS((int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos, long *flagsp, lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext)); -static void clear_syn_state __ARGS((synstate_T *p)); -static void clear_current_state __ARGS((void)); - -static void limit_pos __ARGS((lpos_T *pos, lpos_T *limit)); -static void limit_pos_zero __ARGS((lpos_T *pos, lpos_T *limit)); -static void syn_add_end_off __ARGS((lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx, int extra)); -static void syn_add_start_off __ARGS((lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx, int extra)); -static char_u *syn_getcurline __ARGS((void)); -static int syn_regexec __ARGS((regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T *st)); -static int check_keyword_id __ARGS((char_u *line, int startcol, int *endcol, long *flags, short **next_list, stateitem_T *cur_si, int *ccharp)); -static void syn_cmd_case __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_spell __ARGS((exarg_T *eap, int syncing)); -static void syntax_sync_clear __ARGS((void)); -static void syn_remove_pattern __ARGS((synblock_T *block, int idx)); -static void syn_clear_pattern __ARGS((synblock_T *block, int i)); -static void syn_clear_cluster __ARGS((synblock_T *block, int i)); -static void syn_cmd_clear __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_conceal __ARGS((exarg_T *eap, int syncing)); -static void syn_clear_one __ARGS((int id, int syncing)); -static void syn_cmd_on __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_enable __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_reset __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_manual __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_off __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_onoff __ARGS((exarg_T *eap, char *name)); -static void syn_cmd_list __ARGS((exarg_T *eap, int syncing)); -static void syn_lines_msg __ARGS((void)); -static void syn_match_msg __ARGS((void)); -static void syn_stack_free_block __ARGS((synblock_T *block)); -static void syn_list_one __ARGS((int id, int syncing, int link_only)); -static void syn_list_cluster __ARGS((int id)); -static void put_id_list __ARGS((char_u *name, short *list, int attr)); -static void put_pattern __ARGS((char *s, int c, synpat_T *spp, int attr)); -static int syn_list_keywords __ARGS((int id, hashtab_T *ht, int did_header, int attr)); -static void syn_clear_keyword __ARGS((int id, hashtab_T *ht)); -static void clear_keywtab __ARGS((hashtab_T *ht)); -static void add_keyword __ARGS((char_u *name, int id, int flags, short *cont_in_list, short *next_list, int conceal_char)); -static char_u *get_group_name __ARGS((char_u *arg, char_u **name_end)); -static char_u *get_syn_options __ARGS((char_u *arg, syn_opt_arg_T *opt, int *conceal_char)); -static void syn_cmd_include __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_keyword __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_match __ARGS((exarg_T *eap, int syncing)); -static void syn_cmd_region __ARGS((exarg_T *eap, int syncing)); +static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf); +static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos, long *flagsp, lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext); +static void clear_syn_state(synstate_T *p); +static void clear_current_state(void); + +static void limit_pos(lpos_T *pos, lpos_T *limit); +static void limit_pos_zero(lpos_T *pos, lpos_T *limit); +static void syn_add_end_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx, int extra); +static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx, int extra); +static char_u *syn_getcurline(void); +static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T *st); +static int check_keyword_id(char_u *line, int startcol, int *endcol, long *flags, short **next_list, stateitem_T *cur_si, int *ccharp); +static void syn_cmd_case(exarg_T *eap, int syncing); +static void syn_cmd_spell(exarg_T *eap, int syncing); +static void syntax_sync_clear(void); +static void syn_remove_pattern(synblock_T *block, int idx); +static void syn_clear_pattern(synblock_T *block, int i); +static void syn_clear_cluster(synblock_T *block, int i); +static void syn_cmd_clear(exarg_T *eap, int syncing); +static void syn_cmd_conceal(exarg_T *eap, int syncing); +static void syn_clear_one(int id, int syncing); +static void syn_cmd_on(exarg_T *eap, int syncing); +static void syn_cmd_enable(exarg_T *eap, int syncing); +static void syn_cmd_reset(exarg_T *eap, int syncing); +static void syn_cmd_manual(exarg_T *eap, int syncing); +static void syn_cmd_off(exarg_T *eap, int syncing); +static void syn_cmd_onoff(exarg_T *eap, char *name); +static void syn_cmd_list(exarg_T *eap, int syncing); +static void syn_lines_msg(void); +static void syn_match_msg(void); +static void syn_stack_free_block(synblock_T *block); +static void syn_list_one(int id, int syncing, int link_only); +static void syn_list_cluster(int id); +static void put_id_list(char_u *name, short *list, int attr); +static void put_pattern(char *s, int c, synpat_T *spp, int attr); +static int syn_list_keywords(int id, hashtab_T *ht, int did_header, int attr); +static void syn_clear_keyword(int id, hashtab_T *ht); +static void clear_keywtab(hashtab_T *ht); +static void add_keyword(char_u *name, int id, int flags, short *cont_in_list, short *next_list, int conceal_char); +static char_u *get_group_name(char_u *arg, char_u **name_end); +static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_char, int skip); +static void syn_cmd_include(exarg_T *eap, int syncing); +static void syn_cmd_iskeyword(exarg_T *eap, int syncing); +static void syn_cmd_keyword(exarg_T *eap, int syncing); +static void syn_cmd_match(exarg_T *eap, int syncing); +static void syn_cmd_region(exarg_T *eap, int syncing); #ifdef __BORLANDC__ -static int _RTLENTRYF syn_compare_stub __ARGS((const void *v1, const void *v2)); +static int _RTLENTRYF syn_compare_stub(const void *v1, const void *v2); #else -static int syn_compare_stub __ARGS((const void *v1, const void *v2)); +static int syn_compare_stub(const void *v1, const void *v2); +#endif +static void syn_cmd_cluster(exarg_T *eap, int syncing); +static int syn_scl_name2id(char_u *name); +static int syn_scl_namen2id(char_u *linep, int len); +static int syn_check_cluster(char_u *pp, int len); +static int syn_add_cluster(char_u *name); +static void init_syn_patterns(void); +static char_u *get_syn_pattern(char_u *arg, synpat_T *ci); +static void syn_cmd_sync(exarg_T *eap, int syncing); +static int get_id_list(char_u **arg, int keylen, short **list, int skip); +static void syn_combine_list(short **clstr1, short **clstr2, int list_op); +static void syn_incl_toplevel(int id, int *flagsp); + +#if defined(FEAT_RELTIME) || defined(PROTO) +/* + * Set the timeout used for syntax highlighting. + * Use NULL to reset, no timeout. + */ + void +syn_set_timeout(proftime_T *tm) +{ + syn_tm = tm; +} #endif -static void syn_cmd_cluster __ARGS((exarg_T *eap, int syncing)); -static int syn_scl_name2id __ARGS((char_u *name)); -static int syn_scl_namen2id __ARGS((char_u *linep, int len)); -static int syn_check_cluster __ARGS((char_u *pp, int len)); -static int syn_add_cluster __ARGS((char_u *name)); -static void init_syn_patterns __ARGS((void)); -static char_u *get_syn_pattern __ARGS((char_u *arg, synpat_T *ci)); -static void syn_cmd_sync __ARGS((exarg_T *eap, int syncing)); -static int get_id_list __ARGS((char_u **arg, int keylen, short **list)); -static void syn_combine_list __ARGS((short **clstr1, short **clstr2, int list_op)); -static void syn_incl_toplevel __ARGS((int id, int *flagsp)); /* * Start the syntax recognition for a line. This function is normally called @@ -486,9 +511,7 @@ static void syn_incl_toplevel __ARGS((int id, int *flagsp)); * window. */ void -syntax_start(wp, lnum) - win_T *wp; - linenr_T lnum; +syntax_start(win_T *wp, linenr_T lnum) { synstate_T *p; synstate_T *last_valid = NULL; @@ -497,7 +520,7 @@ syntax_start(wp, lnum) linenr_T parsed_lnum; linenr_T first_stored; int dist; - static int changedtick = 0; /* remember the last change ID */ + static varnumber_T changedtick = 0; /* remember the last change ID */ #ifdef FEAT_CONCEAL current_sub_char = NUL; @@ -508,13 +531,15 @@ syntax_start(wp, lnum) * Also do this when a change was made, the current state may be invalid * then. */ - if (syn_block != wp->w_s || changedtick != syn_buf->b_changedtick) + if (syn_block != wp->w_s + || syn_buf != wp->w_buffer + || changedtick != CHANGEDTICK(syn_buf)) { invalidate_current_state(); syn_buf = wp->w_buffer; syn_block = wp->w_s; } - changedtick = syn_buf->b_changedtick; + changedtick = CHANGEDTICK(syn_buf); syn_win = wp; /* @@ -665,8 +690,7 @@ syntax_start(wp, lnum) * have to manually release their extmatch pointers first. */ static void -clear_syn_state(p) - synstate_T *p; +clear_syn_state(synstate_T *p) { int i; garray_T *gap; @@ -689,7 +713,7 @@ clear_syn_state(p) * Cleanup the current_state stack. */ static void -clear_current_state() +clear_current_state(void) { int i; stateitem_T *sip; @@ -710,10 +734,10 @@ clear_current_state() * 3. Simply start on a given number of lines above "lnum". */ static void -syn_sync(wp, start_lnum, last_valid) - win_T *wp; - linenr_T start_lnum; - synstate_T *last_valid; +syn_sync( + win_T *wp, + linenr_T start_lnum, + synstate_T *last_valid) { buf_T *curbuf_save; win_T *curwin_save; @@ -984,21 +1008,45 @@ syn_sync(wp, start_lnum, last_valid) validate_current_state(); } + static void +save_chartab(char_u *chartab) +{ + if (syn_block->b_syn_isk != empty_option) + { + mch_memmove(chartab, syn_buf->b_chartab, (size_t)32); + mch_memmove(syn_buf->b_chartab, syn_win->w_s->b_syn_chartab, + (size_t)32); + } +} + + static void +restore_chartab(char_u *chartab) +{ + if (syn_win->w_s->b_syn_isk != empty_option) + mch_memmove(syn_buf->b_chartab, chartab, (size_t)32); +} + /* * Return TRUE if the line-continuation pattern matches in line "lnum". */ static int -syn_match_linecont(lnum) - linenr_T lnum; +syn_match_linecont(linenr_T lnum) { regmmatch_T regmatch; + int r; + char_u buf_chartab[32]; /* chartab array for syn iskyeyword */ if (syn_block->b_syn_linecont_prog != NULL) { + /* use syntax iskeyword option */ + save_chartab(buf_chartab); regmatch.rmm_ic = syn_block->b_syn_linecont_ic; regmatch.regprog = syn_block->b_syn_linecont_prog; - return syn_regexec(®match, lnum, (colnr_T)0, + r = syn_regexec(®match, lnum, (colnr_T)0, IF_SYN_TIME(&syn_block->b_syn_linecont_time)); + syn_block->b_syn_linecont_prog = regmatch.regprog; + restore_chartab(buf_chartab); + return r; } return FALSE; } @@ -1007,7 +1055,7 @@ syn_match_linecont(lnum) * Prepare the current state for the start of a line. */ static void -syn_start_line() +syn_start_line(void) { current_finished = FALSE; current_col = 0; @@ -1024,6 +1072,9 @@ syn_start_line() next_match_idx = -1; ++current_line_id; +#ifdef FEAT_CONCEAL + next_seqnr = 1; +#endif } /* @@ -1032,8 +1083,7 @@ syn_start_line() * When "startofline" is FALSE the item with "keepend" is forcefully updated. */ static void -syn_update_ends(startofline) - int startofline; +syn_update_ends(int startofline) { stateitem_T *cur_si; int i; @@ -1133,8 +1183,7 @@ syn_update_ends(startofline) */ static void -syn_stack_free_block(block) - synblock_T *block; +syn_stack_free_block(synblock_T *block) { synstate_T *p; @@ -1142,8 +1191,7 @@ syn_stack_free_block(block) { for (p = block->b_sst_first; p != NULL; p = p->sst_next) clear_syn_state(p); - vim_free(block->b_sst_array); - block->b_sst_array = NULL; + VIM_CLEAR(block->b_sst_array); block->b_sst_len = 0; } } @@ -1152,14 +1200,14 @@ syn_stack_free_block(block) * Used when syntax items changed to force resyncing everywhere. */ void -syn_stack_free_all(block) - synblock_T *block; +syn_stack_free_all(synblock_T *block) { +#ifdef FEAT_FOLDING win_T *wp; +#endif syn_stack_free_block(block); - #ifdef FEAT_FOLDING /* When using "syntax" fold method, must update all folds. */ FOR_ALL_WINDOWS(wp) @@ -1177,7 +1225,7 @@ syn_stack_free_all(block) * Also used to allocate b_sst_array[] for the first time. */ static void -syn_stack_alloc() +syn_stack_alloc(void) { long len; synstate_T *to, *from; @@ -1256,8 +1304,7 @@ syn_stack_alloc() * displayed buffer. */ void -syn_stack_apply_changes(buf) - buf_T *buf; +syn_stack_apply_changes(buf_T *buf) { win_T *wp; @@ -1271,9 +1318,7 @@ syn_stack_apply_changes(buf) } static void -syn_stack_apply_changes_block(block, buf) - synblock_T *block; - buf_T *buf; +syn_stack_apply_changes_block(synblock_T *block, buf_T *buf) { synstate_T *p, *prev, *np; linenr_T n; @@ -1325,7 +1370,7 @@ syn_stack_apply_changes_block(block, buf) * Returns TRUE if at least one entry was freed. */ static int -syn_stack_cleanup() +syn_stack_cleanup(void) { synstate_T *p, *prev; disptick_T tick; @@ -1389,9 +1434,7 @@ syn_stack_cleanup() * Move the entry into the free list. */ static void -syn_stack_free_entry(block, p) - synblock_T *block; - synstate_T *p; +syn_stack_free_entry(synblock_T *block, synstate_T *p) { clear_syn_state(p); p->sst_next = block->b_sst_firstfree; @@ -1404,8 +1447,7 @@ syn_stack_free_entry(block, p) * Returns NULL when there is no entry or the first entry is after "lnum". */ static synstate_T * -syn_stack_find_entry(lnum) - linenr_T lnum; +syn_stack_find_entry(linenr_T lnum) { synstate_T *p, *prev; @@ -1425,7 +1467,7 @@ syn_stack_find_entry(lnum) * The current state must be valid for the start of the current_lnum line! */ static synstate_T * -store_current_state() +store_current_state(void) { int i; synstate_T *p; @@ -1548,8 +1590,7 @@ store_current_state() * Copy a state stack from "from" in b_sst_array[] to current_state; */ static void -load_current_state(from) - synstate_T *from; +load_current_state(synstate_T *from) { int i; bufstate_T *bp; @@ -1596,8 +1637,7 @@ load_current_state(from) * Return TRUE when they are equal. */ static int -syn_stack_equal(sp) - synstate_T *sp; +syn_stack_equal(synstate_T *sp) { int i, j; bufstate_T *bp; @@ -1669,8 +1709,7 @@ syn_stack_equal(sp) * lnum -> line below window */ void -syntax_end_parsing(lnum) - linenr_T lnum; +syntax_end_parsing(linenr_T lnum) { synstate_T *sp; @@ -1687,7 +1726,7 @@ syntax_end_parsing(lnum) ****************************************/ static void -invalidate_current_state() +invalidate_current_state(void) { clear_current_state(); current_state.ga_itemsize = 0; /* mark current_state invalid */ @@ -1696,7 +1735,7 @@ invalidate_current_state() } static void -validate_current_state() +validate_current_state(void) { current_state.ga_itemsize = sizeof(stateitem_T); current_state.ga_growsize = 3; @@ -1708,8 +1747,7 @@ validate_current_state() * line, to check if the next line needs to be redrawn too. */ int -syntax_check_changed(lnum) - linenr_T lnum; +syntax_check_changed(linenr_T lnum) { int retval = TRUE; synstate_T *sp; @@ -1757,42 +1795,39 @@ syntax_check_changed(lnum) * is valid. */ static int -syn_finish_line(syncing) - int syncing; /* called for syncing */ +syn_finish_line( + int syncing) /* called for syncing */ { stateitem_T *cur_si; colnr_T prev_current_col; - if (!current_finished) + while (!current_finished) { - while (!current_finished) + (void)syn_current_attr(syncing, FALSE, NULL, FALSE); + /* + * When syncing, and found some item, need to check the item. + */ + if (syncing && current_state.ga_len) { - (void)syn_current_attr(syncing, FALSE, NULL, FALSE); /* - * When syncing, and found some item, need to check the item. + * Check for match with sync item. */ - if (syncing && current_state.ga_len) - { - /* - * Check for match with sync item. - */ - cur_si = &CUR_STATE(current_state.ga_len - 1); - if (cur_si->si_idx >= 0 - && (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags - & (HL_SYNC_HERE|HL_SYNC_THERE))) - return TRUE; - - /* syn_current_attr() will have skipped the check for an item - * that ends here, need to do that now. Be careful not to go - * past the NUL. */ - prev_current_col = current_col; - if (syn_getcurline()[current_col] != NUL) - ++current_col; - check_state_ends(); - current_col = prev_current_col; - } - ++current_col; + cur_si = &CUR_STATE(current_state.ga_len - 1); + if (cur_si->si_idx >= 0 + && (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags + & (HL_SYNC_HERE|HL_SYNC_THERE))) + return TRUE; + + /* syn_current_attr() will have skipped the check for an item + * that ends here, need to do that now. Be careful not to go + * past the NUL. */ + prev_current_col = current_col; + if (syn_getcurline()[current_col] != NUL) + ++current_col; + check_state_ends(); + current_col = prev_current_col; } + ++current_col; } return FALSE; } @@ -1807,10 +1842,10 @@ syn_finish_line(syncing) * done. */ int -get_syntax_attr(col, can_spell, keep_state) - colnr_T col; - int *can_spell; - int keep_state; /* keep state of char at "col" */ +get_syntax_attr( + colnr_T col, + int *can_spell, + int keep_state) /* keep state of char at "col" */ { int attr = 0; @@ -1835,6 +1870,7 @@ get_syntax_attr(col, can_spell, keep_state) #endif #ifdef FEAT_CONCEAL current_flags = 0; + current_seqnr = 0; #endif return 0; } @@ -1860,11 +1896,11 @@ get_syntax_attr(col, can_spell, keep_state) * Get syntax attributes for current_lnum, current_col. */ static int -syn_current_attr(syncing, displaying, can_spell, keep_state) - int syncing; /* When 1: called for syncing */ - int displaying; /* result will be displayed */ - int *can_spell; /* return: do spell checking */ - int keep_state; /* keep syntax stack afterwards */ +syn_current_attr( + int syncing, /* When 1: called for syncing */ + int displaying, /* result will be displayed */ + int *can_spell, /* return: do spell checking */ + int keep_state) /* keep syntax stack afterwards */ { int syn_id; lpos_T endpos; /* was: char_u *endp; */ @@ -1888,6 +1924,7 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) lpos_T pos; int lc_col; reg_extmatch_T *cur_extmatch = NULL; + char_u buf_chartab[32]; /* chartab array for syn iskyeyword */ char_u *line; /* current line. NOTE: becomes invalid after looking for a pattern match! */ @@ -1942,6 +1979,9 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) * avoid matching the same item in the same position twice. */ ga_init2(&zero_width_next_ga, (int)sizeof(int), 10); + /* use syntax iskeyword option */ + save_chartab(buf_chartab); + /* * Repeat matching keywords and patterns, to find contained items at the * same column. This stops when there are no extra matches at the current @@ -1953,6 +1993,7 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) keep_next_list = FALSE; syn_id = 0; + /* * 1. Check for a current state. * Only when there is no current state, or if the current state may @@ -2075,6 +2116,8 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) cur_si->si_cont_list, &spp->sp_syn, spp->sp_flags & HL_CONTAINED)))) { + int r; + /* If we already tried matching in this line, and * there isn't a match before next_match_col, skip * this item. */ @@ -2089,10 +2132,12 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) regmatch.rmm_ic = spp->sp_ic; regmatch.regprog = spp->sp_prog; - if (!syn_regexec(®match, + r = syn_regexec(®match, current_lnum, (colnr_T)lc_col, - IF_SYN_TIME(&spp->sp_time))) + IF_SYN_TIME(&spp->sp_time)); + spp->sp_prog = regmatch.regprog; + if (!r) { /* no match in this line, try another one */ spp->sp_startcol = MAXCOL; @@ -2280,7 +2325,7 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) { line = syn_getcurline(); if (((current_next_flags & HL_SKIPWHITE) - && vim_iswhite(line[current_col])) + && VIM_ISWHITE(line[current_col])) || ((current_next_flags & HL_SKIPEMPTY) && *line == NUL)) break; @@ -2302,6 +2347,8 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) } while (found_match); + restore_chartab(buf_chartab); + /* * Use attributes from the current state, if within its highlighting. * If not, use attributes from the current-but-one state, etc. @@ -2313,6 +2360,7 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) #endif #ifdef FEAT_CONCEAL current_flags = 0; + current_seqnr = 0; #endif if (cur_si != NULL) { @@ -2422,7 +2470,8 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) /* nextgroup ends at end of line, unless "skipnl" or "skipempty" present */ if (current_next_list != NULL - && syn_getcurline()[current_col + 1] == NUL + && (line = syn_getcurline())[current_col] != NUL + && line[current_col + 1] == NUL && !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))) current_next_list = NULL; @@ -2442,9 +2491,7 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) * Check if we already matched pattern "idx" at the current column. */ static int -did_match_already(idx, gap) - int idx; - garray_T *gap; +did_match_already(int idx, garray_T *gap) { int i; @@ -2467,8 +2514,7 @@ did_match_already(idx, gap) * Push the next match onto the stack. */ static stateitem_T * -push_next_match(cur_si) - stateitem_T *cur_si; +push_next_match(stateitem_T *cur_si) { synpat_T *spp; #ifdef FEAT_CONCEAL @@ -2561,7 +2607,7 @@ push_next_match(cur_si) * Check for end of current state (and the states before it). */ static void -check_state_ends() +check_state_ends(void) { stateitem_T *cur_si; int had_extend; @@ -2666,8 +2712,7 @@ check_state_ends() * fills in si_attr, si_next_list and si_cont_list. */ static void -update_si_attr(idx) - int idx; +update_si_attr(int idx) { stateitem_T *sip = &CUR_STATE(idx); synpat_T *spp; @@ -2722,7 +2767,7 @@ update_si_attr(idx) * Propagate the match-end to contained items, until a "skipend" item is found. */ static void -check_keepend() +check_keepend(void) { int i; lpos_T maxpos; @@ -2782,10 +2827,10 @@ check_keepend() * Return the flags for the matched END. */ static void -update_si_end(sip, startcol, force) - stateitem_T *sip; - int startcol; /* where to start searching for the end */ - int force; /* when TRUE overrule a previous end */ +update_si_end( + stateitem_T *sip, + int startcol, /* where to start searching for the end */ + int force) /* when TRUE overrule a previous end */ { lpos_T startpos; lpos_T endpos; @@ -2848,8 +2893,7 @@ update_si_end(sip, startcol, force) * Return FAIL if it's not possible (out of memory). */ static int -push_current_state(idx) - int idx; +push_current_state(int idx) { if (ga_grow(¤t_state, 1) == FAIL) return FAIL; @@ -2863,7 +2907,7 @@ push_current_state(idx) * Remove a state from the current_state stack. */ static void -pop_current_state() +pop_current_state(void) { if (current_state.ga_len) { @@ -2888,16 +2932,15 @@ pop_current_state() * computed. */ static void -find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, - end_idx, start_ext) - int idx; /* index of the pattern */ - lpos_T *startpos; /* where to start looking for an END match */ - lpos_T *m_endpos; /* return: end of match */ - lpos_T *hl_endpos; /* return: end of highlighting */ - long *flagsp; /* return: flags of matching END */ - lpos_T *end_endpos; /* return: end of end pattern match */ - int *end_idx; /* return: group ID for end pat. match, or 0 */ - reg_extmatch_T *start_ext; /* submatches from the start pattern */ +find_endpos( + int idx, /* index of the pattern */ + lpos_T *startpos, /* where to start looking for an END match */ + lpos_T *m_endpos, /* return: end of match */ + lpos_T *hl_endpos, /* return: end of highlighting */ + long *flagsp, /* return: flags of matching END */ + lpos_T *end_endpos, /* return: end of end pattern match */ + int *end_idx, /* return: group ID for end pat. match, or 0 */ + reg_extmatch_T *start_ext) /* submatches from the start pattern */ { colnr_T matchcol; synpat_T *spp, *spp_skip; @@ -2908,6 +2951,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, lpos_T pos; char_u *line; int had_match = FALSE; + char_u buf_chartab[32]; /* chartab array for syn option iskyeyword */ /* just in case we are invoked for a keyword */ if (idx < 0) @@ -2954,6 +2998,10 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, matchcol = startpos->col; /* start looking for a match at sstart */ start_idx = idx; /* remember the first END pattern. */ best_regmatch.startpos[0].col = 0; /* avoid compiler warning */ + + /* use syntax iskeyword option */ + save_chartab(buf_chartab); + for (;;) { /* @@ -2963,6 +3011,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; ++idx) { int lc_col = matchcol; + int r; spp = &(SYN_ITEMS(syn_block)[idx]); if (spp->sp_type != SPTYPE_END) /* past last END pattern */ @@ -2973,8 +3022,10 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, regmatch.rmm_ic = spp->sp_ic; regmatch.regprog = spp->sp_prog; - if (syn_regexec(®match, startpos->lnum, lc_col, - IF_SYN_TIME(&spp->sp_time))) + r = syn_regexec(®match, startpos->lnum, lc_col, + IF_SYN_TIME(&spp->sp_time)); + spp->sp_prog = regmatch.regprog; + if (r) { if (best_idx == -1 || regmatch.startpos[0].col < best_regmatch.startpos[0].col) @@ -3000,16 +3051,20 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, if (spp_skip != NULL) { int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF]; + int r; if (lc_col < 0) lc_col = 0; regmatch.rmm_ic = spp_skip->sp_ic; regmatch.regprog = spp_skip->sp_prog; - if (syn_regexec(®match, startpos->lnum, lc_col, - IF_SYN_TIME(&spp_skip->sp_time)) - && regmatch.startpos[0].col + r = syn_regexec(®match, startpos->lnum, lc_col, + IF_SYN_TIME(&spp_skip->sp_time)); + spp_skip->sp_prog = regmatch.regprog; + if (r && regmatch.startpos[0].col <= best_regmatch.startpos[0].col) { + int line_len; + /* Add offset to skip pattern match */ syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1); @@ -3019,6 +3074,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, break; line = ml_get_buf(syn_buf, startpos->lnum, FALSE); + line_len = (int)STRLEN(line); /* take care of an empty match or negative offset */ if (pos.col <= matchcol) @@ -3028,12 +3084,12 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, else /* Be careful not to jump over the NUL at the end-of-line */ for (matchcol = regmatch.endpos[0].col; - line[matchcol] != NUL && matchcol < pos.col; + matchcol < line_len && matchcol < pos.col; ++matchcol) ; /* if the skip pattern includes end-of-line, break here */ - if (line[matchcol] == NUL) + if (matchcol >= line_len) break; continue; /* start with first end pattern again */ @@ -3102,6 +3158,8 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, if (!had_match) m_endpos->lnum = 0; + restore_chartab(buf_chartab); + /* Remove external matches. */ unref_extmatch(re_extmatch_in); re_extmatch_in = NULL; @@ -3111,9 +3169,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, * Limit "pos" not to be after "limit". */ static void -limit_pos(pos, limit) - lpos_T *pos; - lpos_T *limit; +limit_pos(lpos_T *pos, lpos_T *limit) { if (pos->lnum > limit->lnum) *pos = *limit; @@ -3125,9 +3181,9 @@ limit_pos(pos, limit) * Limit "pos" not to be after "limit", unless pos->lnum is zero. */ static void -limit_pos_zero(pos, limit) - lpos_T *pos; - lpos_T *limit; +limit_pos_zero( + lpos_T *pos, + lpos_T *limit) { if (pos->lnum == 0) *pos = *limit; @@ -3139,12 +3195,12 @@ limit_pos_zero(pos, limit) * Add offset to matched text for end of match or highlight. */ static void -syn_add_end_off(result, regmatch, spp, idx, extra) - lpos_T *result; /* returned position */ - regmmatch_T *regmatch; /* start/end of match */ - synpat_T *spp; /* matched pattern */ - int idx; /* index of offset */ - int extra; /* extra chars for offset to start */ +syn_add_end_off( + lpos_T *result, /* returned position */ + regmmatch_T *regmatch, /* start/end of match */ + synpat_T *spp, /* matched pattern */ + int idx, /* index of offset */ + int extra) /* extra chars for offset to start */ { int col; int off; @@ -3174,12 +3230,12 @@ syn_add_end_off(result, regmatch, spp, idx, extra) if (off > 0) { while (off-- > 0 && *p != NUL) - mb_ptr_adv(p); + MB_PTR_ADV(p); } else if (off < 0) { while (off++ < 0 && base < p) - mb_ptr_back(base, p); + MB_PTR_BACK(base, p); } col = (int)(p - base); } @@ -3191,12 +3247,12 @@ syn_add_end_off(result, regmatch, spp, idx, extra) * Avoid resulting column to become negative. */ static void -syn_add_start_off(result, regmatch, spp, idx, extra) - lpos_T *result; /* returned position */ - regmmatch_T *regmatch; /* start/end of match */ - synpat_T *spp; - int idx; - int extra; /* extra chars for offset to end */ +syn_add_start_off( + lpos_T *result, /* returned position */ + regmmatch_T *regmatch, /* start/end of match */ + synpat_T *spp, + int idx, + int extra) /* extra chars for offset to end */ { int col; int off; @@ -3228,12 +3284,12 @@ syn_add_start_off(result, regmatch, spp, idx, extra) if (off > 0) { while (off-- && *p != NUL) - mb_ptr_adv(p); + MB_PTR_ADV(p); } else if (off < 0) { while (off++ && base < p) - mb_ptr_back(base, p); + MB_PTR_BACK(base, p); } col = (int)(p - base); } @@ -3244,7 +3300,7 @@ syn_add_start_off(result, regmatch, spp, idx, extra) * Get current line in syntax buffer. */ static char_u * -syn_getcurline() +syn_getcurline(void) { return ml_get_buf(syn_buf, current_lnum, FALSE); } @@ -3254,13 +3310,16 @@ syn_getcurline() * Returns TRUE when there is a match. */ static int -syn_regexec(rmp, lnum, col, st) - regmmatch_T *rmp; - linenr_T lnum; - colnr_T col; - syn_time_T *st UNUSED; +syn_regexec( + regmmatch_T *rmp, + linenr_T lnum, + colnr_T col, + syn_time_T *st UNUSED) { int r; +#ifdef FEAT_RELTIME + int timed_out = FALSE; +#endif #ifdef FEAT_PROFILE proftime_T pt; @@ -3269,7 +3328,13 @@ syn_regexec(rmp, lnum, col, st) #endif rmp->rmm_maxcol = syn_buf->b_p_smc; - r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL); + r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, +#ifdef FEAT_RELTIME + syn_tm, &timed_out +#else + NULL, NULL +#endif + ); #ifdef FEAT_PROFILE if (syn_time_on) @@ -3283,6 +3348,10 @@ syn_regexec(rmp, lnum, col, st) ++st->match; } #endif +#ifdef FEAT_RELTIME + if (timed_out) + syn_win->w_s->b_syn_slow = TRUE; +#endif if (r > 0) { @@ -3296,17 +3365,17 @@ syn_regexec(rmp, lnum, col, st) /* * Check one position in a line for a matching keyword. * The caller must check if a keyword can start at startcol. - * Return it's ID if found, 0 otherwise. + * Return its ID if found, 0 otherwise. */ static int -check_keyword_id(line, startcol, endcolp, flagsp, next_listp, cur_si, ccharp) - char_u *line; - int startcol; /* position in line to check for keyword */ - int *endcolp; /* return: character after found keyword */ - long *flagsp; /* return: flags of matching keyword */ - short **next_listp; /* return: next_list of matching keyword */ - stateitem_T *cur_si; /* item at the top of the stack */ - int *ccharp UNUSED; /* conceal substitution char */ +check_keyword_id( + char_u *line, + int startcol, /* position in line to check for keyword */ + int *endcolp, /* return: character after found keyword */ + long *flagsp, /* return: flags of matching keyword */ + short **next_listp, /* return: next_list of matching keyword */ + stateitem_T *cur_si, /* item at the top of the stack */ + int *ccharp UNUSED) /* conceal substitution char */ { keyentry_T *kp; char_u *kwp; @@ -3388,9 +3457,7 @@ check_keyword_id(line, startcol, endcolp, flagsp, next_listp, cur_si, ccharp) * Handle ":syntax conceal" command. */ static void -syn_cmd_conceal(eap, syncing) - exarg_T *eap UNUSED; - int syncing UNUSED; +syn_cmd_conceal(exarg_T *eap UNUSED, int syncing UNUSED) { #ifdef FEAT_CONCEAL char_u *arg = eap->arg; @@ -3401,7 +3468,14 @@ syn_cmd_conceal(eap, syncing) return; next = skiptowhite(arg); - if (STRNICMP(arg, "on", 2) == 0 && next - arg == 2) + if (*arg == NUL) + { + if (curwin->w_s->b_syn_conceal) + MSG(_("syntax conceal on")); + else + MSG(_("syntax conceal off")); + } + else if (STRNICMP(arg, "on", 2) == 0 && next - arg == 2) curwin->w_s->b_syn_conceal = TRUE; else if (STRNICMP(arg, "off", 3) == 0 && next - arg == 3) curwin->w_s->b_syn_conceal = FALSE; @@ -3414,9 +3488,7 @@ syn_cmd_conceal(eap, syncing) * Handle ":syntax case" command. */ static void -syn_cmd_case(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_case(exarg_T *eap, int syncing UNUSED) { char_u *arg = eap->arg; char_u *next; @@ -3426,7 +3498,14 @@ syn_cmd_case(eap, syncing) return; next = skiptowhite(arg); - if (STRNICMP(arg, "match", 5) == 0 && next - arg == 5) + if (*arg == NUL) + { + if (curwin->w_s->b_syn_ic) + MSG(_("syntax case ignore")); + else + MSG(_("syntax case match")); + } + else if (STRNICMP(arg, "match", 5) == 0 && next - arg == 5) curwin->w_s->b_syn_ic = FALSE; else if (STRNICMP(arg, "ignore", 6) == 0 && next - arg == 6) curwin->w_s->b_syn_ic = TRUE; @@ -3438,9 +3517,7 @@ syn_cmd_case(eap, syncing) * Handle ":syntax spell" command. */ static void -syn_cmd_spell(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_spell(exarg_T *eap, int syncing UNUSED) { char_u *arg = eap->arg; char_u *next; @@ -3450,29 +3527,98 @@ syn_cmd_spell(eap, syncing) return; next = skiptowhite(arg); - if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8) + if (*arg == NUL) + { + if (curwin->w_s->b_syn_spell == SYNSPL_TOP) + MSG(_("syntax spell toplevel")); + else if (curwin->w_s->b_syn_spell == SYNSPL_NOTOP) + MSG(_("syntax spell notoplevel")); + else + MSG(_("syntax spell default")); + } + else if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8) curwin->w_s->b_syn_spell = SYNSPL_TOP; else if (STRNICMP(arg, "notoplevel", 10) == 0 && next - arg == 10) curwin->w_s->b_syn_spell = SYNSPL_NOTOP; else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7) curwin->w_s->b_syn_spell = SYNSPL_DEFAULT; else + { EMSG2(_("E390: Illegal argument: %s"), arg); + return; + } + + /* assume spell checking changed, force a redraw */ + redraw_win_later(curwin, NOT_VALID); +} + +/* + * Handle ":syntax iskeyword" command. + */ + static void +syn_cmd_iskeyword(exarg_T *eap, int syncing UNUSED) +{ + char_u *arg = eap->arg; + char_u save_chartab[32]; + char_u *save_isk; + + if (eap->skip) + return; + + arg = skipwhite(arg); + if (*arg == NUL) + { + MSG_PUTS("\n"); + MSG_PUTS(_("syntax iskeyword ")); + if (curwin->w_s->b_syn_isk != empty_option) + msg_outtrans(curwin->w_s->b_syn_isk); + else + msg_outtrans((char_u *)"not set"); + } + else + { + if (STRNICMP(arg, "clear", 5) == 0) + { + mch_memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, + (size_t)32); + clear_string_option(&curwin->w_s->b_syn_isk); + } + else + { + mch_memmove(save_chartab, curbuf->b_chartab, (size_t)32); + save_isk = curbuf->b_p_isk; + curbuf->b_p_isk = vim_strsave(arg); + + buf_init_chartab(curbuf, FALSE); + mch_memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, + (size_t)32); + mch_memmove(curbuf->b_chartab, save_chartab, (size_t)32); + clear_string_option(&curwin->w_s->b_syn_isk); + curwin->w_s->b_syn_isk = curbuf->b_p_isk; + curbuf->b_p_isk = save_isk; + } + } + redraw_win_later(curwin, NOT_VALID); } /* * Clear all syntax info for one buffer. */ void -syntax_clear(block) - synblock_T *block; +syntax_clear(synblock_T *block) { int i; block->b_syn_error = FALSE; /* clear previous error */ +#ifdef FEAT_RELTIME + block->b_syn_slow = FALSE; /* clear previous timeout */ +#endif block->b_syn_ic = FALSE; /* Use case, by default */ block->b_syn_spell = SYNSPL_DEFAULT; /* default spell checking */ block->b_syn_containedin = FALSE; +#ifdef FEAT_CONCEAL + block->b_syn_conceal = FALSE; +#endif /* free the keywords */ clear_keywtab(&block->b_keywtab); @@ -3497,11 +3643,11 @@ syntax_clear(block) vim_regfree(block->b_syn_linecont_prog); block->b_syn_linecont_prog = NULL; - vim_free(block->b_syn_linecont_pat); - block->b_syn_linecont_pat = NULL; + VIM_CLEAR(block->b_syn_linecont_pat); #ifdef FEAT_FOLDING block->b_syn_folditems = 0; #endif + clear_string_option(&block->b_syn_isk); /* free the stored states */ syn_stack_free_all(block); @@ -3515,8 +3661,7 @@ syntax_clear(block) * Get rid of ownsyntax for window "wp". */ void -reset_synblock(wp) - win_T *wp; +reset_synblock(win_T *wp) { if (wp->w_s != &wp->w_buffer->b_s) { @@ -3530,7 +3675,7 @@ reset_synblock(wp) * Clear syncing info for one buffer. */ static void -syntax_sync_clear() +syntax_sync_clear(void) { int i; @@ -3546,19 +3691,19 @@ syntax_sync_clear() vim_regfree(curwin->w_s->b_syn_linecont_prog); curwin->w_s->b_syn_linecont_prog = NULL; - vim_free(curwin->w_s->b_syn_linecont_pat); - curwin->w_s->b_syn_linecont_pat = NULL; + VIM_CLEAR(curwin->w_s->b_syn_linecont_pat); + clear_string_option(&curwin->w_s->b_syn_isk); - syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */ + syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */ } /* * Remove one pattern from the buffer's pattern list. */ static void -syn_remove_pattern(block, idx) - synblock_T *block; - int idx; +syn_remove_pattern( + synblock_T *block, + int idx) { synpat_T *spp; @@ -3578,9 +3723,7 @@ syn_remove_pattern(block, idx) * last to first! */ static void -syn_clear_pattern(block, i) - synblock_T *block; - int i; +syn_clear_pattern(synblock_T *block, int i) { vim_free(SYN_ITEMS(block)[i].sp_pattern); vim_regfree(SYN_ITEMS(block)[i].sp_prog); @@ -3597,9 +3740,7 @@ syn_clear_pattern(block, i) * Clear and free one syntax cluster. */ static void -syn_clear_cluster(block, i) - synblock_T *block; - int i; +syn_clear_cluster(synblock_T *block, int i) { vim_free(SYN_CLSTR(block)[i].scl_name); vim_free(SYN_CLSTR(block)[i].scl_name_u); @@ -3610,9 +3751,7 @@ syn_clear_cluster(block, i) * Handle ":syntax clear" command. */ static void -syn_cmd_clear(eap, syncing) - exarg_T *eap; - int syncing; +syn_cmd_clear(exarg_T *eap, int syncing) { char_u *arg = eap->arg; char_u *arg_end; @@ -3671,8 +3810,7 @@ syn_cmd_clear(eap, syncing) */ short scl_id = id - SYNID_CLUSTER; - vim_free(SYN_CLSTR(curwin->w_s)[scl_id].scl_list); - SYN_CLSTR(curwin->w_s)[scl_id].scl_list = NULL; + VIM_CLEAR(SYN_CLSTR(curwin->w_s)[scl_id].scl_list); } } else @@ -3697,9 +3835,7 @@ syn_cmd_clear(eap, syncing) * Clear one syntax group for the current buffer. */ static void -syn_clear_one(id, syncing) - int id; - int syncing; +syn_clear_one(int id, int syncing) { synpat_T *spp; int idx; @@ -3725,9 +3861,7 @@ syn_clear_one(id, syncing) * Handle ":syntax on" command. */ static void -syn_cmd_on(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_on(exarg_T *eap, int syncing UNUSED) { syn_cmd_onoff(eap, "syntax"); } @@ -3736,9 +3870,7 @@ syn_cmd_on(eap, syncing) * Handle ":syntax enable" command. */ static void -syn_cmd_enable(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_enable(exarg_T *eap, int syncing UNUSED) { set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"enable"); syn_cmd_onoff(eap, "syntax"); @@ -3747,11 +3879,10 @@ syn_cmd_enable(eap, syncing) /* * Handle ":syntax reset" command. + * It actually resets highlighting, not syntax. */ static void -syn_cmd_reset(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_reset(exarg_T *eap, int syncing UNUSED) { eap->nextcmd = check_nextcmd(eap->arg); if (!eap->skip) @@ -3766,9 +3897,7 @@ syn_cmd_reset(eap, syncing) * Handle ":syntax manual" command. */ static void -syn_cmd_manual(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_manual(exarg_T *eap, int syncing UNUSED) { syn_cmd_onoff(eap, "manual"); } @@ -3777,17 +3906,13 @@ syn_cmd_manual(eap, syncing) * Handle ":syntax off" command. */ static void -syn_cmd_off(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_off(exarg_T *eap, int syncing UNUSED) { syn_cmd_onoff(eap, "nosyntax"); } static void -syn_cmd_onoff(eap, name) - exarg_T *eap; - char *name; +syn_cmd_onoff(exarg_T *eap, char *name) { char_u buf[100]; @@ -3804,9 +3929,9 @@ syn_cmd_onoff(eap, name) * Handle ":syntax [list]" command: list current syntax words. */ static void -syn_cmd_list(eap, syncing) - exarg_T *eap; - int syncing; /* when TRUE: list syncing items */ +syn_cmd_list( + exarg_T *eap, + int syncing) /* when TRUE: list syncing items */ { char_u *arg = eap->arg; int id; @@ -3897,7 +4022,7 @@ syn_cmd_list(eap, syncing) } static void -syn_lines_msg() +syn_lines_msg(void) { if (curwin->w_s->b_syn_sync_maxlines > 0 || curwin->w_s->b_syn_sync_minlines > 0) @@ -3920,7 +4045,7 @@ syn_lines_msg() } static void -syn_match_msg() +syn_match_msg(void) { if (curwin->w_s->b_syn_sync_linebreaks > 0) { @@ -3938,16 +4063,16 @@ struct name_list char *name; }; -static void syn_list_flags __ARGS((struct name_list *nl, int flags, int attr)); +static void syn_list_flags(struct name_list *nl, int flags, int attr); /* * List one syntax item, for ":syntax" or "syntax list syntax_name". */ static void -syn_list_one(id, syncing, link_only) - int id; - int syncing; /* when TRUE: list syncing items */ - int link_only; /* when TRUE; list link-only too */ +syn_list_one( + int id, + int syncing, /* when TRUE: list syncing items */ + int link_only) /* when TRUE; list link-only too */ { int attr; int idx; @@ -3977,7 +4102,7 @@ syn_list_one(id, syncing, link_only) {0, NULL} }; - attr = hl_attr(HLF_D); /* highlight like directories */ + attr = HL_ATTR(HLF_D); /* highlight like directories */ /* list the keywords for "id" */ if (!syncing) @@ -4055,10 +4180,7 @@ syn_list_one(id, syncing, link_only) } static void -syn_list_flags(nlist, flags, attr) - struct name_list *nlist; - int flags; - int attr; +syn_list_flags(struct name_list *nlist, int flags, int attr) { int i; @@ -4074,8 +4196,7 @@ syn_list_flags(nlist, flags, attr) * List one syntax cluster, for ":syntax" or "syntax list syntax_name". */ static void -syn_list_cluster(id) - int id; +syn_list_cluster(int id) { int endcol = 15; @@ -4092,20 +4213,17 @@ syn_list_cluster(id) if (SYN_CLSTR(curwin->w_s)[id].scl_list != NULL) { put_id_list((char_u *)"cluster", SYN_CLSTR(curwin->w_s)[id].scl_list, - hl_attr(HLF_D)); + HL_ATTR(HLF_D)); } else { - msg_puts_attr((char_u *)"cluster", hl_attr(HLF_D)); + msg_puts_attr((char_u *)"cluster", HL_ATTR(HLF_D)); msg_puts((char_u *)"=NONE"); } } static void -put_id_list(name, list, attr) - char_u *name; - short *list; - int attr; +put_id_list(char_u *name, short *list, int attr) { short *p; @@ -4144,11 +4262,11 @@ put_id_list(name, list, attr) } static void -put_pattern(s, c, spp, attr) - char *s; - int c; - synpat_T *spp; - int attr; +put_pattern( + char *s, + int c, + synpat_T *spp, + int attr) { long n; int mask; @@ -4217,11 +4335,11 @@ put_pattern(s, c, spp, attr) * Return TRUE if the header has been printed. */ static int -syn_list_keywords(id, ht, did_header, attr) - int id; - hashtab_T *ht; - int did_header; /* header has already been printed */ - int attr; +syn_list_keywords( + int id, + hashtab_T *ht, + int did_header, /* header has already been printed */ + int attr) { int outlen; hashitem_T *hi; @@ -4315,9 +4433,7 @@ syn_list_keywords(id, ht, did_header, attr) } static void -syn_clear_keyword(id, ht) - int id; - hashtab_T *ht; +syn_clear_keyword(int id, hashtab_T *ht) { hashitem_T *hi; keyentry_T *kp; @@ -4367,8 +4483,7 @@ syn_clear_keyword(id, ht) * Clear a whole keyword table. */ static void -clear_keywtab(ht) - hashtab_T *ht; +clear_keywtab(hashtab_T *ht) { hashitem_T *hi; int todo; @@ -4398,13 +4513,13 @@ clear_keywtab(ht) * Add a keyword to the list of keywords. */ static void -add_keyword(name, id, flags, cont_in_list, next_list, conceal_char) - char_u *name; /* name of keyword */ - int id; /* group ID for this keyword */ - int flags; /* flags for this keyword */ - short *cont_in_list; /* containedin for this keyword */ - short *next_list; /* nextgroup for this keyword */ - int conceal_char; +add_keyword( + char_u *name, /* name of keyword */ + int id, /* group ID for this keyword */ + int flags, /* flags for this keyword */ + short *cont_in_list, /* containedin for this keyword */ + short *next_list, /* nextgroup for this keyword */ + int conceal_char) { keyentry_T *kp; hashtab_T *ht; @@ -4458,9 +4573,9 @@ add_keyword(name, id, flags, cont_in_list, next_list, conceal_char) * Return NULL if the end of the command was found instead of further args. */ static char_u * -get_group_name(arg, name_end) - char_u *arg; /* start of the argument */ - char_u **name_end; /* pointer to end of the name */ +get_group_name( + char_u *arg, /* start of the argument */ + char_u **name_end) /* pointer to end of the name */ { char_u *rest; @@ -4485,10 +4600,11 @@ get_group_name(arg, name_end) * Return NULL for any error; */ static char_u * -get_syn_options(arg, opt, conceal_char) - char_u *arg; /* next argument to be checked */ - syn_opt_arg_T *opt; /* various things */ - int *conceal_char UNUSED; +get_syn_options( + char_u *arg, /* next argument to be checked */ + syn_opt_arg_T *opt, /* various things */ + int *conceal_char UNUSED, + int skip) /* TRUE if skipping over command */ { char_u *gname_start, *gname; int syn_id; @@ -4547,7 +4663,7 @@ get_syn_options(arg, opt, conceal_char) for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) if (arg[len] != p[i] && arg[len] != p[i + 1]) break; - if (p[i] == NUL && (vim_iswhite(arg[len]) + if (p[i] == NUL && (VIM_ISWHITE(arg[len]) || (flagtab[fidx].argtype > 0 ? arg[len] == '=' : ends_excmd(arg[len])))) @@ -4571,17 +4687,17 @@ get_syn_options(arg, opt, conceal_char) EMSG(_("E395: contains argument not accepted here")); return NULL; } - if (get_id_list(&arg, 8, &opt->cont_list) == FAIL) + if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) return NULL; } else if (flagtab[fidx].argtype == 2) { - if (get_id_list(&arg, 11, &opt->cont_in_list) == FAIL) + if (get_id_list(&arg, 11, &opt->cont_in_list, skip) == FAIL) return NULL; } else if (flagtab[fidx].argtype == 3) { - if (get_id_list(&arg, 9, &opt->next_list) == FAIL) + if (get_id_list(&arg, 9, &opt->next_list, skip) == FAIL) return NULL; } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') @@ -4674,9 +4790,7 @@ get_syn_options(arg, opt, conceal_char) * to the specified top-level group, if any. */ static void -syn_incl_toplevel(id, flagsp) - int id; - int *flagsp; +syn_incl_toplevel(int id, int *flagsp) { if ((*flagsp & HL_CONTAINED) || curwin->w_s->b_syn_topgrp == 0) return; @@ -4701,9 +4815,7 @@ syn_incl_toplevel(id, flagsp) * Handle ":syntax include [@{group-name}] filename" command. */ static void -syn_cmd_include(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_include(exarg_T *eap, int syncing UNUSED) { char_u *arg = eap->arg; int sgl_id = 1; @@ -4768,7 +4880,7 @@ syn_cmd_include(eap, syncing) prev_toplvl_grp = curwin->w_s->b_syn_topgrp; curwin->w_s->b_syn_topgrp = sgl_id; if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL - : source_runtime(eap->arg, TRUE) == FAIL) + : source_runtime(eap->arg, DIP_ALL) == FAIL) EMSG2(_(e_notopen), eap->arg); curwin->w_s->b_syn_topgrp = prev_toplvl_grp; current_syn_inc_tag = prev_syn_inc_tag; @@ -4778,9 +4890,7 @@ syn_cmd_include(eap, syncing) * Handle ":syntax keyword {group-name} [{option}] keyword .." command. */ static void -syn_cmd_keyword(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_keyword(exarg_T *eap, int syncing UNUSED) { char_u *arg = eap->arg; char_u *group_name_end; @@ -4797,7 +4907,10 @@ syn_cmd_keyword(eap, syncing) if (rest != NULL) { - syn_id = syn_check_group(arg, (int)(group_name_end - arg)); + if (eap->skip) + syn_id = -1; + else + syn_id = syn_check_group(arg, (int)(group_name_end - arg)); if (syn_id != 0) /* allocate a buffer, for removing backslashes in the keyword */ keyword_copy = alloc((unsigned)STRLEN(rest) + 1); @@ -4819,11 +4932,12 @@ syn_cmd_keyword(eap, syncing) p = keyword_copy; for ( ; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) { - rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); + rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, + eap->skip); if (rest == NULL || ends_excmd(*rest)) break; /* Copy the keyword, removing backslashes, and add a NUL. */ - while (*rest != NUL && !vim_iswhite(*rest)) + while (*rest != NUL && !VIM_ISWHITE(*rest)) { if (*rest == '\\' && rest[1] != NUL) ++rest; @@ -4855,11 +4969,16 @@ syn_cmd_keyword(eap, syncing) if (p[1] == NUL) { EMSG2(_("E789: Missing ']': %s"), kw); - kw = p + 2; /* skip over the NUL */ - break; + goto error; } if (p[1] == ']') { + if (p[2] != NUL) + { + EMSG3(_("E890: trailing char after ']': %s]%s"), + kw, &p[2]); + goto error; + } kw = p + 1; /* skip over the "]" */ break; } @@ -4880,7 +4999,7 @@ syn_cmd_keyword(eap, syncing) } } } - +error: vim_free(keyword_copy); vim_free(syn_opt_arg.cont_in_list); vim_free(syn_opt_arg.next_list); @@ -4902,9 +5021,9 @@ syn_cmd_keyword(eap, syncing) * Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .." */ static void -syn_cmd_match(eap, syncing) - exarg_T *eap; - int syncing; /* TRUE for ":syntax sync match .. " */ +syn_cmd_match( + exarg_T *eap, + int syncing) /* TRUE for ":syntax sync match .. " */ { char_u *arg = eap->arg; char_u *group_name_end; @@ -4927,7 +5046,7 @@ syn_cmd_match(eap, syncing) syn_opt_arg.cont_list = NULL; syn_opt_arg.cont_in_list = NULL; syn_opt_arg.next_list = NULL; - rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); + rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip); /* get the pattern. */ init_syn_patterns(); @@ -4937,7 +5056,7 @@ syn_cmd_match(eap, syncing) syn_opt_arg.flags |= HL_HAS_EOL; /* Get options after the pattern */ - rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); + rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip); if (rest != NULL) /* all arguments are valid */ { @@ -5006,9 +5125,9 @@ syn_cmd_match(eap, syncing) * start {start} .. [skip {skip}] end {end} .. [{options}]". */ static void -syn_cmd_region(eap, syncing) - exarg_T *eap; - int syncing; /* TRUE for ":syntax sync region .." */ +syn_cmd_region( + exarg_T *eap, + int syncing) /* TRUE for ":syntax sync region .." */ { char_u *arg = eap->arg; char_u *group_name_end; @@ -5063,13 +5182,13 @@ syn_cmd_region(eap, syncing) while (rest != NULL && !ends_excmd(*rest)) { /* Check for option arguments */ - rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); + rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip); if (rest == NULL || ends_excmd(*rest)) break; /* must be a pattern or matchgroup then */ key_end = rest; - while (*key_end && !vim_iswhite(*key_end) && *key_end != '=') + while (*key_end && !VIM_ISWHITE(*key_end) && *key_end != '=') ++key_end; vim_free(key); key = vim_strnsave_up(rest, (int)(key_end - rest)); @@ -5275,9 +5394,7 @@ syn_cmd_region(eap, syncing) #ifdef __BORLANDC__ _RTLENTRYF #endif -syn_compare_stub(v1, v2) - const void *v1; - const void *v2; +syn_compare_stub(const void *v1, const void *v2) { const short *s1 = v1; const short *s2 = v2; @@ -5290,10 +5407,7 @@ syn_compare_stub(v1, v2) * *clstr1 and *clstr2 must both be allocated memory; they will be consumed. */ static void -syn_combine_list(clstr1, clstr2, list_op) - short **clstr1; - short **clstr2; - int list_op; +syn_combine_list(short **clstr1, short **clstr2, int list_op) { int count1 = 0; int count2 = 0; @@ -5413,12 +5527,11 @@ syn_combine_list(clstr1, clstr2, list_op) } /* - * Lookup a syntax cluster name and return it's ID. + * Lookup a syntax cluster name and return its ID. * If it is not found, 0 is returned. */ static int -syn_scl_name2id(name) - char_u *name; +syn_scl_name2id(char_u *name) { int i; char_u *name_u; @@ -5439,9 +5552,7 @@ syn_scl_name2id(name) * Like syn_scl_name2id(), but take a pointer + length argument. */ static int -syn_scl_namen2id(linep, len) - char_u *linep; - int len; +syn_scl_namen2id(char_u *linep, int len) { char_u *name; int id = 0; @@ -5456,15 +5567,13 @@ syn_scl_namen2id(linep, len) } /* - * Find syntax cluster name in the table and return it's ID. + * Find syntax cluster name in the table and return its ID. * The argument is a pointer to the name and the length of the name. * If it doesn't exist yet, a new entry is created. * Return 0 for failure. */ static int -syn_check_cluster(pp, len) - char_u *pp; - int len; +syn_check_cluster(char_u *pp, int len) { int id; char_u *name; @@ -5482,13 +5591,12 @@ syn_check_cluster(pp, len) } /* - * Add new syntax cluster and return it's ID. + * Add new syntax cluster and return its ID. * "name" must be an allocated string, it will be consumed. * Return 0 for failure. */ static int -syn_add_cluster(name) - char_u *name; +syn_add_cluster(char_u *name) { int len; @@ -5537,9 +5645,7 @@ syn_add_cluster(name) * [add={groupname},..] [remove={groupname},..]". */ static void -syn_cmd_cluster(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_cluster(exarg_T *eap, int syncing UNUSED) { char_u *arg = eap->arg; char_u *group_name_end; @@ -5566,19 +5672,19 @@ syn_cmd_cluster(eap, syncing) for (;;) { if (STRNICMP(rest, "add", 3) == 0 - && (vim_iswhite(rest[3]) || rest[3] == '=')) + && (VIM_ISWHITE(rest[3]) || rest[3] == '=')) { opt_len = 3; list_op = CLUSTER_ADD; } else if (STRNICMP(rest, "remove", 6) == 0 - && (vim_iswhite(rest[6]) || rest[6] == '=')) + && (VIM_ISWHITE(rest[6]) || rest[6] == '=')) { opt_len = 6; list_op = CLUSTER_SUBTRACT; } else if (STRNICMP(rest, "contains", 8) == 0 - && (vim_iswhite(rest[8]) || rest[8] == '=')) + && (VIM_ISWHITE(rest[8]) || rest[8] == '=')) { opt_len = 8; list_op = CLUSTER_REPLACE; @@ -5587,13 +5693,16 @@ syn_cmd_cluster(eap, syncing) break; clstr_list = NULL; - if (get_id_list(&rest, opt_len, &clstr_list) == FAIL) + if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) { EMSG2(_(e_invarg2), rest); break; } - syn_combine_list(&SYN_CLSTR(curwin->w_s)[scl_id].scl_list, + if (scl_id >= 0) + syn_combine_list(&SYN_CLSTR(curwin->w_s)[scl_id].scl_list, &clstr_list, list_op); + else + vim_free(clstr_list); got_clstr = TRUE; } @@ -5614,7 +5723,7 @@ syn_cmd_cluster(eap, syncing) * On first call for current buffer: Init growing array. */ static void -init_syn_patterns() +init_syn_patterns(void) { curwin->w_s->b_syn_patterns.ga_itemsize = sizeof(synpat_T); curwin->w_s->b_syn_patterns.ga_growsize = 10; @@ -5626,9 +5735,7 @@ init_syn_patterns() * Returns a pointer to the next argument, or NULL in case of an error. */ static char_u * -get_syn_pattern(arg, ci) - char_u *arg; - synpat_T *ci; +get_syn_pattern(char_u *arg, synpat_T *ci) { char_u *end; int *p; @@ -5636,7 +5743,7 @@ get_syn_pattern(arg, ci) char_u *cpo_save; /* need at least three chars */ - if (arg == NULL || arg[1] == NUL || arg[2] == NUL) + if (arg == NULL || arg[0] == NUL || arg[1] == NUL || arg[2] == NUL) return NULL; end = skip_regexp(arg + 1, *arg, TRUE, NULL); @@ -5718,7 +5825,7 @@ get_syn_pattern(arg, ci) } } while (idx >= 0); - if (!ends_excmd(*end) && !vim_iswhite(*end)) + if (!ends_excmd(*end) && !VIM_ISWHITE(*end)) { EMSG2(_("E402: Garbage after pattern: %s"), arg); return NULL; @@ -5730,9 +5837,7 @@ get_syn_pattern(arg, ci) * Handle ":syntax sync .." command. */ static void -syn_cmd_sync(eap, syncing) - exarg_T *eap; - int syncing UNUSED; +syn_cmd_sync(exarg_T *eap, int syncing UNUSED) { char_u *arg_start = eap->arg; char_u *arg_end; @@ -5807,6 +5912,11 @@ syn_cmd_sync(eap, syncing) } else if (STRCMP(key, "LINECONT") == 0) { + if (*next_arg == NUL) /* missing pattern */ + { + illegal = TRUE; + break; + } if (curwin->w_s->b_syn_linecont_pat != NULL) { EMSG(_("E403: syntax sync: line continuations pattern specified twice")); @@ -5843,8 +5953,7 @@ syn_cmd_sync(eap, syncing) if (curwin->w_s->b_syn_linecont_prog == NULL) { - vim_free(curwin->w_s->b_syn_linecont_pat); - curwin->w_s->b_syn_linecont_pat = NULL; + VIM_CLEAR(curwin->w_s->b_syn_linecont_pat); finished = TRUE; break; } @@ -5886,11 +5995,12 @@ syn_cmd_sync(eap, syncing) * returns FAIL for some error, OK for success. */ static int -get_id_list(arg, keylen, list) - char_u **arg; - int keylen; /* length of keyword */ - short **list; /* where to store the resulting list, if not +get_id_list( + char_u **arg, + int keylen, /* length of keyword */ + short **list, /* where to store the resulting list, if not NULL, the list is silently skipped! */ + int skip) { char_u *p = NULL; char_u *end; @@ -5935,7 +6045,7 @@ get_id_list(arg, keylen, list) count = 0; while (!ends_excmd(*p)) { - for (end = p; *end && !vim_iswhite(*end) && *end != ','; ++end) + for (end = p; *end && !VIM_ISWHITE(*end) && *end != ','; ++end) ; name = alloc((int)(end - p + 3)); /* leave room for "^$" */ if (name == NULL) @@ -5958,7 +6068,8 @@ get_id_list(arg, keylen, list) } if (count != 0) { - EMSG2(_("E408: %s must be first in contains list"), name + 1); + EMSG2(_("E408: %s must be first in contains list"), + name + 1); failed = TRUE; vim_free(name); break; @@ -5973,7 +6084,10 @@ get_id_list(arg, keylen, list) } else if (name[1] == '@') { - id = syn_check_cluster(name + 2, (int)(end - p - 1)); + if (skip) + id = -1; + else + id = syn_check_cluster(name + 2, (int)(end - p - 1)); } else { @@ -6083,8 +6197,7 @@ get_id_list(arg, keylen, list) * Make a copy of an ID list. */ static short * -copy_id_list(list) - short *list; +copy_id_list(short *list) { int len; int count; @@ -6111,11 +6224,11 @@ copy_id_list(list) * This function is called very often, keep it fast!! */ static int -in_id_list(cur_si, list, ssp, contained) - stateitem_T *cur_si; /* current item or NULL */ - short *list; /* id list */ - struct sp_syn *ssp; /* group id and ":syn include" tag of group */ - int contained; /* group id is contained */ +in_id_list( + stateitem_T *cur_si, /* current item or NULL */ + short *list, /* id list */ + struct sp_syn *ssp, /* group id and ":syn include" tag of group */ + int contained) /* group id is contained */ { int retval; short *scl_list; @@ -6210,8 +6323,8 @@ in_id_list(cur_si, list, ssp, contained) struct subcommand { - char *name; /* subcommand name */ - void (*func)__ARGS((exarg_T *, int)); /* function to call */ + char *name; /* subcommand name */ + void (*func)(exarg_T *, int); /* function to call */ }; static struct subcommand subcommands[] = @@ -6222,6 +6335,7 @@ static struct subcommand subcommands[] = {"conceal", syn_cmd_conceal}, {"enable", syn_cmd_enable}, {"include", syn_cmd_include}, + {"iskeyword", syn_cmd_iskeyword}, {"keyword", syn_cmd_keyword}, {"list", syn_cmd_list}, {"manual", syn_cmd_manual}, @@ -6242,8 +6356,7 @@ static struct subcommand subcommands[] = * syntax_subcommand() function to do the rest. */ void -ex_syntax(eap) - exarg_T *eap; +ex_syntax(exarg_T *eap) { char_u *arg = eap->arg; char_u *subcmd_end; @@ -6281,8 +6394,7 @@ ex_syntax(eap) } void -ex_ownsyntax(eap) - exarg_T *eap; +ex_ownsyntax(exarg_T *eap) { char_u *old_value; char_u *new_value; @@ -6291,14 +6403,16 @@ ex_ownsyntax(eap) { curwin->w_s = (synblock_T *)alloc(sizeof(synblock_T)); memset(curwin->w_s, 0, sizeof(synblock_T)); + hash_init(&curwin->w_s->b_keywtab); + hash_init(&curwin->w_s->b_keywtab_ic); #ifdef FEAT_SPELL + /* TODO: keep the spell checking as it was. */ curwin->w_p_spell = FALSE; /* No spell checking */ clear_string_option(&curwin->w_s->b_p_spc); clear_string_option(&curwin->w_s->b_p_spf); - vim_regfree(curwin->w_s->b_cap_prog); - curwin->w_s->b_cap_prog = NULL; clear_string_option(&curwin->w_s->b_p_spl); #endif + clear_string_option(&curwin->w_s->b_syn_isk); } /* save value of b:current_syntax */ @@ -6326,8 +6440,7 @@ ex_ownsyntax(eap) } int -syntax_present(win) - win_T *win; +syntax_present(win_T *win) { return (win->w_s->b_syn_patterns.ga_len != 0 || win->w_s->b_syn_clusters.ga_len != 0 @@ -6340,7 +6453,9 @@ syntax_present(win) static enum { EXP_SUBCMD, /* expand ":syn" sub-commands */ - EXP_CASE /* expand ":syn case" arguments */ + EXP_CASE, /* expand ":syn case" arguments */ + EXP_SPELL, /* expand ":syn spell" arguments */ + EXP_SYNC /* expand ":syn sync" arguments */ } expand_what; /* @@ -6348,7 +6463,7 @@ static enum * Called when we are done expanding. */ void -reset_expand_highlight() +reset_expand_highlight(void) { include_link = include_default = include_none = 0; } @@ -6358,9 +6473,7 @@ reset_expand_highlight() * as highlight group. */ void -set_context_in_echohl_cmd(xp, arg) - expand_T *xp; - char_u *arg; +set_context_in_echohl_cmd(expand_T *xp, char_u *arg) { xp->xp_context = EXPAND_HIGHLIGHT; xp->xp_pattern = arg; @@ -6371,9 +6484,7 @@ set_context_in_echohl_cmd(xp, arg) * Handle command line completion for :syntax command. */ void -set_context_in_syntax_cmd(xp, arg) - expand_T *xp; - char_u *arg; +set_context_in_syntax_cmd(expand_T *xp, char_u *arg) { char_u *p; @@ -6395,6 +6506,10 @@ set_context_in_syntax_cmd(xp, arg) xp->xp_context = EXPAND_NOTHING; else if (STRNICMP(arg, "case", p - arg) == 0) expand_what = EXP_CASE; + else if (STRNICMP(arg, "spell", p - arg) == 0) + expand_what = EXP_SPELL; + else if (STRNICMP(arg, "sync", p - arg) == 0) + expand_what = EXP_SYNC; else if ( STRNICMP(arg, "keyword", p - arg) == 0 || STRNICMP(arg, "region", p - arg) == 0 || STRNICMP(arg, "match", p - arg) == 0 @@ -6406,20 +6521,38 @@ set_context_in_syntax_cmd(xp, arg) } } -static char *(case_args[]) = {"match", "ignore", NULL}; - /* * Function given to ExpandGeneric() to obtain the list syntax names for * expansion. */ char_u * -get_syntax_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_syntax_name(expand_T *xp UNUSED, int idx) { - if (expand_what == EXP_SUBCMD) - return (char_u *)subcommands[idx].name; - return (char_u *)case_args[idx]; + switch (expand_what) + { + case EXP_SUBCMD: + return (char_u *)subcommands[idx].name; + case EXP_CASE: + { + static char *case_args[] = {"match", "ignore", NULL}; + return (char_u *)case_args[idx]; + } + case EXP_SPELL: + { + static char *spell_args[] = + {"toplevel", "notoplevel", "default", NULL}; + return (char_u *)spell_args[idx]; + } + case EXP_SYNC: + { + static char *sync_args[] = + {"ccomment", "clear", "fromstart", + "linebreaks=", "linecont", "lines=", "match", + "maxlines=", "minlines=", "region", NULL}; + return (char_u *)sync_args[idx]; + } + } + return NULL; } #endif /* FEAT_CMDL_COMPL */ @@ -6428,13 +6561,13 @@ get_syntax_name(xp, idx) * Function called for expression evaluation: get syntax ID at file position. */ int -syn_get_id(wp, lnum, col, trans, spellp, keep_state) - win_T *wp; - long lnum; - colnr_T col; - int trans; /* remove transparency */ - int *spellp; /* return: can do spell checking */ - int keep_state; /* keep state of char at "col" */ +syn_get_id( + win_T *wp, + long lnum, + colnr_T col, + int trans, /* remove transparency */ + int *spellp, /* return: can do spell checking */ + int keep_state) /* keep state of char at "col" */ { /* When the position is not after the current position and in the same * line of the same buffer, need to restart parsing. */ @@ -6442,6 +6575,12 @@ syn_get_id(wp, lnum, col, trans, spellp, keep_state) || lnum != current_lnum || col < current_col) syntax_start(wp, lnum); + else if (wp->w_buffer == syn_buf + && lnum == current_lnum + && col > current_col) + /* next_match may not be correct when moving around, e.g. with the + * "skip" expression in searchpair() */ + next_match_idx = -1; (void)get_syntax_attr(col, spellp, keep_state); @@ -6456,8 +6595,7 @@ syn_get_id(wp, lnum, col, trans, spellp, keep_state) * Returns the current flags. */ int -get_syntax_info(seqnrp) - int *seqnrp; +get_syntax_info(int *seqnrp) { *seqnrp = current_seqnr; return current_flags; @@ -6467,7 +6605,7 @@ get_syntax_info(seqnrp) * Return conceal substitution character */ int -syn_get_sub_char() +syn_get_sub_char(void) { return current_sub_char; } @@ -6480,8 +6618,7 @@ syn_get_sub_char() * Returns -1 when "i" is out of range. */ int -syn_get_stack_item(i) - int i; +syn_get_stack_item(int i) { if (i >= current_state.ga_len) { @@ -6500,15 +6637,18 @@ syn_get_stack_item(i) * Function called to get folding level for line "lnum" in window "wp". */ int -syn_get_foldlevel(wp, lnum) - win_T *wp; - long lnum; +syn_get_foldlevel(win_T *wp, long lnum) { int level = 0; int i; /* Return quickly when there are no fold items at all. */ - if (wp->w_s->b_syn_folditems != 0) + if (wp->w_s->b_syn_folditems != 0 + && !wp->w_s->b_syn_error +# ifdef SYN_TIME_LIMIT + && !wp->w_s->b_syn_slow +# endif + ) { syntax_start(wp, lnum); @@ -6526,13 +6666,12 @@ syn_get_foldlevel(wp, lnum) } #endif -#ifdef FEAT_PROFILE +#if defined(FEAT_PROFILE) || defined(PROTO) /* * ":syntime". */ void -ex_syntime(eap) - exarg_T *eap; +ex_syntime(exarg_T *eap) { if (STRCMP(eap->arg, "on") == 0) syn_time_on = TRUE; @@ -6547,8 +6686,7 @@ ex_syntime(eap) } static void -syn_clear_time(st) - syn_time_T *st; +syn_clear_time(syn_time_T *st) { profile_zero(&st->total); profile_zero(&st->slowest); @@ -6560,7 +6698,7 @@ syn_clear_time(st) * Clear the syntax timing for the current buffer. */ static void -syntime_clear() +syntime_clear(void) { int idx; synpat_T *spp; @@ -6583,9 +6721,7 @@ syntime_clear() * ":syntime {on,off,clear,report}" command. */ char_u * -get_syntime_arg(xp, idx) - expand_T *xp UNUSED; - int idx; +get_syntime_arg(expand_T *xp UNUSED, int idx) { switch (idx) { @@ -6613,9 +6749,7 @@ typedef struct #ifdef __BORLANDC__ _RTLENTRYF #endif -syn_compare_syntime(v1, v2) - const void *v1; - const void *v2; +syn_compare_syntime(const void *v1, const void *v2) { const time_entry_T *s1 = v1; const time_entry_T *s2 = v2; @@ -6627,7 +6761,7 @@ syn_compare_syntime(v1, v2) * Clear the syntax timing for the current buffer. */ static void -syntime_report() +syntime_report(void) { int idx; synpat_T *spp; @@ -6653,7 +6787,7 @@ syntime_report() spp = &(SYN_ITEMS(curwin->w_s)[idx]); if (spp->sp_time.count > 0) { - ga_grow(&ga, 1); + (void)ga_grow(&ga, 1); p = ((time_entry_T *)ga.ga_data) + ga.ga_len; p->total = spp->sp_time.total; profile_add(&total_total, &spp->sp_time.total); @@ -6671,15 +6805,16 @@ syntime_report() } } - /* sort on total time */ - qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), + /* Sort on total time. Skip if there are no items to avoid passing NULL + * pointer to qsort(). */ + if (ga.ga_len > 1) + qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), syn_compare_syntime); MSG_PUTS_TITLE(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN")); MSG_PUTS("\n"); for (idx = 0; idx < ga.ga_len && !got_int; ++idx) { - spp = &(SYN_ITEMS(curwin->w_s)[idx]); p = ((time_entry_T *)ga.ga_data) + idx; MSG_PUTS(profile_msg(&p->total)); @@ -6742,229 +6877,242 @@ syntime_report() #else # define CENT(a, b) a #endif -static char *(highlight_init_both[]) = - { - CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White", - "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"), - CENT("IncSearch term=reverse cterm=reverse", - "IncSearch term=reverse cterm=reverse gui=reverse"), - CENT("ModeMsg term=bold cterm=bold", - "ModeMsg term=bold cterm=bold gui=bold"), - CENT("NonText term=bold ctermfg=Blue", - "NonText term=bold ctermfg=Blue gui=bold guifg=Blue"), - CENT("StatusLine term=reverse,bold cterm=reverse,bold", - "StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"), - CENT("StatusLineNC term=reverse cterm=reverse", - "StatusLineNC term=reverse cterm=reverse gui=reverse"), -#ifdef FEAT_VERTSPLIT - CENT("VertSplit term=reverse cterm=reverse", - "VertSplit term=reverse cterm=reverse gui=reverse"), -#endif +static char *(highlight_init_both[]) = { + CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White", + "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"), + CENT("IncSearch term=reverse cterm=reverse", + "IncSearch term=reverse cterm=reverse gui=reverse"), + CENT("ModeMsg term=bold cterm=bold", + "ModeMsg term=bold cterm=bold gui=bold"), + CENT("NonText term=bold ctermfg=Blue", + "NonText term=bold ctermfg=Blue gui=bold guifg=Blue"), + CENT("StatusLine term=reverse,bold cterm=reverse,bold", + "StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"), + CENT("StatusLineNC term=reverse cterm=reverse", + "StatusLineNC term=reverse cterm=reverse gui=reverse"), + "default link EndOfBuffer NonText", + CENT("VertSplit term=reverse cterm=reverse", + "VertSplit term=reverse cterm=reverse gui=reverse"), #ifdef FEAT_CLIPBOARD - CENT("VisualNOS term=underline,bold cterm=underline,bold", - "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold"), + CENT("VisualNOS term=underline,bold cterm=underline,bold", + "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold"), #endif #ifdef FEAT_DIFF - CENT("DiffText term=reverse cterm=bold ctermbg=Red", - "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red"), + CENT("DiffText term=reverse cterm=bold ctermbg=Red", + "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red"), #endif #ifdef FEAT_INS_EXPAND - CENT("PmenuSbar ctermbg=Grey", - "PmenuSbar ctermbg=Grey guibg=Grey"), -#endif -#ifdef FEAT_WINDOWS - CENT("TabLineSel term=bold cterm=bold", - "TabLineSel term=bold cterm=bold gui=bold"), - CENT("TabLineFill term=reverse cterm=reverse", - "TabLineFill term=reverse cterm=reverse gui=reverse"), + CENT("PmenuSbar ctermbg=Grey", + "PmenuSbar ctermbg=Grey guibg=Grey"), #endif + CENT("TabLineSel term=bold cterm=bold", + "TabLineSel term=bold cterm=bold gui=bold"), + CENT("TabLineFill term=reverse cterm=reverse", + "TabLineFill term=reverse cterm=reverse gui=reverse"), #ifdef FEAT_GUI - "Cursor guibg=fg guifg=bg", - "lCursor guibg=fg guifg=bg", /* should be different, but what? */ -#endif - NULL - }; - -static char *(highlight_init_light[]) = - { - CENT("Directory term=bold ctermfg=DarkBlue", - "Directory term=bold ctermfg=DarkBlue guifg=Blue"), - CENT("LineNr term=underline ctermfg=Brown", - "LineNr term=underline ctermfg=Brown guifg=Brown"), - CENT("CursorLineNr term=bold ctermfg=Brown", - "CursorLineNr term=bold ctermfg=Brown gui=bold guifg=Brown"), - CENT("MoreMsg term=bold ctermfg=DarkGreen", - "MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen"), - CENT("Question term=standout ctermfg=DarkGreen", - "Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen"), - CENT("Search term=reverse ctermbg=Yellow ctermfg=NONE", - "Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE"), + "Cursor guibg=fg guifg=bg", + "lCursor guibg=fg guifg=bg", /* should be different, but what? */ +#endif + "default link QuickFixLine Search", + NULL +}; + +/* Default colors only used with a light background. */ +static char *(highlight_init_light[]) = { + CENT("Directory term=bold ctermfg=DarkBlue", + "Directory term=bold ctermfg=DarkBlue guifg=Blue"), + CENT("LineNr term=underline ctermfg=Brown", + "LineNr term=underline ctermfg=Brown guifg=Brown"), + CENT("CursorLineNr term=bold ctermfg=Brown", + "CursorLineNr term=bold ctermfg=Brown gui=bold guifg=Brown"), + CENT("MoreMsg term=bold ctermfg=DarkGreen", + "MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen"), + CENT("Question term=standout ctermfg=DarkGreen", + "Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen"), + CENT("Search term=reverse ctermbg=Yellow ctermfg=NONE", + "Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE"), #ifdef FEAT_SPELL - CENT("SpellBad term=reverse ctermbg=LightRed", - "SpellBad term=reverse ctermbg=LightRed guisp=Red gui=undercurl"), - CENT("SpellCap term=reverse ctermbg=LightBlue", - "SpellCap term=reverse ctermbg=LightBlue guisp=Blue gui=undercurl"), - CENT("SpellRare term=reverse ctermbg=LightMagenta", - "SpellRare term=reverse ctermbg=LightMagenta guisp=Magenta gui=undercurl"), - CENT("SpellLocal term=underline ctermbg=Cyan", - "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl"), + CENT("SpellBad term=reverse ctermbg=LightRed", + "SpellBad term=reverse ctermbg=LightRed guisp=Red gui=undercurl"), + CENT("SpellCap term=reverse ctermbg=LightBlue", + "SpellCap term=reverse ctermbg=LightBlue guisp=Blue gui=undercurl"), + CENT("SpellRare term=reverse ctermbg=LightMagenta", + "SpellRare term=reverse ctermbg=LightMagenta guisp=Magenta gui=undercurl"), + CENT("SpellLocal term=underline ctermbg=Cyan", + "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl"), #endif #ifdef FEAT_INS_EXPAND - CENT("PmenuThumb ctermbg=Black", - "PmenuThumb ctermbg=Black guibg=Black"), - CENT("Pmenu ctermbg=LightMagenta ctermfg=Black", - "Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta"), - CENT("PmenuSel ctermbg=LightGrey ctermfg=Black", - "PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey"), -#endif - CENT("SpecialKey term=bold ctermfg=DarkBlue", - "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue"), - CENT("Title term=bold ctermfg=DarkMagenta", - "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta"), - CENT("WarningMsg term=standout ctermfg=DarkRed", - "WarningMsg term=standout ctermfg=DarkRed guifg=Red"), + CENT("PmenuThumb ctermbg=Black", + "PmenuThumb ctermbg=Black guibg=Black"), + CENT("Pmenu ctermbg=LightMagenta ctermfg=Black", + "Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta"), + CENT("PmenuSel ctermbg=LightGrey ctermfg=Black", + "PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey"), +#endif + CENT("SpecialKey term=bold ctermfg=DarkBlue", + "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue"), + CENT("Title term=bold ctermfg=DarkMagenta", + "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta"), + CENT("WarningMsg term=standout ctermfg=DarkRed", + "WarningMsg term=standout ctermfg=DarkRed guifg=Red"), #ifdef FEAT_WILDMENU - CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", - "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), + CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", + "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), #endif #ifdef FEAT_FOLDING - CENT("Folded term=standout ctermbg=Grey ctermfg=DarkBlue", - "Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue"), - CENT("FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue", - "FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), + CENT("Folded term=standout ctermbg=Grey ctermfg=DarkBlue", + "Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue"), + CENT("FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue", + "FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), #endif #ifdef FEAT_SIGNS - CENT("SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue", - "SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), + CENT("SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue", + "SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), #endif - CENT("Visual term=reverse", - "Visual term=reverse guibg=LightGrey"), + CENT("Visual term=reverse", + "Visual term=reverse guibg=LightGrey"), #ifdef FEAT_DIFF - CENT("DiffAdd term=bold ctermbg=LightBlue", - "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"), - CENT("DiffChange term=bold ctermbg=LightMagenta", - "DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta"), - CENT("DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan", - "DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan"), -#endif -#ifdef FEAT_WINDOWS - CENT("TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey", - "TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey gui=underline guibg=LightGrey"), -#endif + CENT("DiffAdd term=bold ctermbg=LightBlue", + "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"), + CENT("DiffChange term=bold ctermbg=LightMagenta", + "DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta"), + CENT("DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan", + "DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan"), +#endif + CENT("TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey", + "TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey gui=underline guibg=LightGrey"), #ifdef FEAT_SYN_HL - CENT("CursorColumn term=reverse ctermbg=LightGrey", - "CursorColumn term=reverse ctermbg=LightGrey guibg=Grey90"), - CENT("CursorLine term=underline cterm=underline", - "CursorLine term=underline cterm=underline guibg=Grey90"), - CENT("ColorColumn term=reverse ctermbg=LightRed", - "ColorColumn term=reverse ctermbg=LightRed guibg=LightRed"), + CENT("CursorColumn term=reverse ctermbg=LightGrey", + "CursorColumn term=reverse ctermbg=LightGrey guibg=Grey90"), + CENT("CursorLine term=underline cterm=underline", + "CursorLine term=underline cterm=underline guibg=Grey90"), + CENT("ColorColumn term=reverse ctermbg=LightRed", + "ColorColumn term=reverse ctermbg=LightRed guibg=LightRed"), #endif #ifdef FEAT_CONCEAL - CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", - "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), -#endif -#ifdef FEAT_AUTOCMD - CENT("MatchParen term=reverse ctermbg=Cyan", - "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), + CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", + "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), #endif + CENT("MatchParen term=reverse ctermbg=Cyan", + "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), #ifdef FEAT_GUI - "Normal gui=NONE", -#endif - NULL - }; - -static char *(highlight_init_dark[]) = - { - CENT("Directory term=bold ctermfg=LightCyan", - "Directory term=bold ctermfg=LightCyan guifg=Cyan"), - CENT("LineNr term=underline ctermfg=Yellow", - "LineNr term=underline ctermfg=Yellow guifg=Yellow"), - CENT("CursorLineNr term=bold ctermfg=Yellow", - "CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow"), - CENT("MoreMsg term=bold ctermfg=LightGreen", - "MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen"), - CENT("Question term=standout ctermfg=LightGreen", - "Question term=standout ctermfg=LightGreen gui=bold guifg=Green"), - CENT("Search term=reverse ctermbg=Yellow ctermfg=Black", - "Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), - CENT("SpecialKey term=bold ctermfg=LightBlue", - "SpecialKey term=bold ctermfg=LightBlue guifg=Cyan"), + "Normal gui=NONE", +#endif +#ifdef FEAT_TERMINAL + CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen", + "StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen gui=bold guifg=bg guibg=DarkGreen"), + CENT("StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen", + "StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen guifg=bg guibg=DarkGreen"), +#endif +#ifdef FEAT_MENU + CENT("ToolbarLine term=underline ctermbg=LightGrey", + "ToolbarLine term=underline ctermbg=LightGrey guibg=LightGrey"), + CENT("ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey", + "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"), +#endif + NULL +}; + +/* Default colors only used with a dark background. */ +static char *(highlight_init_dark[]) = { + CENT("Directory term=bold ctermfg=LightCyan", + "Directory term=bold ctermfg=LightCyan guifg=Cyan"), + CENT("LineNr term=underline ctermfg=Yellow", + "LineNr term=underline ctermfg=Yellow guifg=Yellow"), + CENT("CursorLineNr term=bold ctermfg=Yellow", + "CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow"), + CENT("MoreMsg term=bold ctermfg=LightGreen", + "MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen"), + CENT("Question term=standout ctermfg=LightGreen", + "Question term=standout ctermfg=LightGreen gui=bold guifg=Green"), + CENT("Search term=reverse ctermbg=Yellow ctermfg=Black", + "Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), + CENT("SpecialKey term=bold ctermfg=LightBlue", + "SpecialKey term=bold ctermfg=LightBlue guifg=Cyan"), #ifdef FEAT_SPELL - CENT("SpellBad term=reverse ctermbg=Red", - "SpellBad term=reverse ctermbg=Red guisp=Red gui=undercurl"), - CENT("SpellCap term=reverse ctermbg=Blue", - "SpellCap term=reverse ctermbg=Blue guisp=Blue gui=undercurl"), - CENT("SpellRare term=reverse ctermbg=Magenta", - "SpellRare term=reverse ctermbg=Magenta guisp=Magenta gui=undercurl"), - CENT("SpellLocal term=underline ctermbg=Cyan", - "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl"), + CENT("SpellBad term=reverse ctermbg=Red", + "SpellBad term=reverse ctermbg=Red guisp=Red gui=undercurl"), + CENT("SpellCap term=reverse ctermbg=Blue", + "SpellCap term=reverse ctermbg=Blue guisp=Blue gui=undercurl"), + CENT("SpellRare term=reverse ctermbg=Magenta", + "SpellRare term=reverse ctermbg=Magenta guisp=Magenta gui=undercurl"), + CENT("SpellLocal term=underline ctermbg=Cyan", + "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl"), #endif #ifdef FEAT_INS_EXPAND - CENT("PmenuThumb ctermbg=White", - "PmenuThumb ctermbg=White guibg=White"), - CENT("Pmenu ctermbg=Magenta ctermfg=Black", - "Pmenu ctermbg=Magenta ctermfg=Black guibg=Magenta"), - CENT("PmenuSel ctermbg=Black ctermfg=DarkGrey", - "PmenuSel ctermbg=Black ctermfg=DarkGrey guibg=DarkGrey"), -#endif - CENT("Title term=bold ctermfg=LightMagenta", - "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta"), - CENT("WarningMsg term=standout ctermfg=LightRed", - "WarningMsg term=standout ctermfg=LightRed guifg=Red"), + CENT("PmenuThumb ctermbg=White", + "PmenuThumb ctermbg=White guibg=White"), + CENT("Pmenu ctermbg=Magenta ctermfg=Black", + "Pmenu ctermbg=Magenta ctermfg=Black guibg=Magenta"), + CENT("PmenuSel ctermbg=Black ctermfg=DarkGrey", + "PmenuSel ctermbg=Black ctermfg=DarkGrey guibg=DarkGrey"), +#endif + CENT("Title term=bold ctermfg=LightMagenta", + "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta"), + CENT("WarningMsg term=standout ctermfg=LightRed", + "WarningMsg term=standout ctermfg=LightRed guifg=Red"), #ifdef FEAT_WILDMENU - CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", - "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), + CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", + "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), #endif #ifdef FEAT_FOLDING - CENT("Folded term=standout ctermbg=DarkGrey ctermfg=Cyan", - "Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan"), - CENT("FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", - "FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), + CENT("Folded term=standout ctermbg=DarkGrey ctermfg=Cyan", + "Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan"), + CENT("FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", + "FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), #endif #ifdef FEAT_SIGNS - CENT("SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", - "SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), + CENT("SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", + "SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), #endif - CENT("Visual term=reverse", - "Visual term=reverse guibg=DarkGrey"), + CENT("Visual term=reverse", + "Visual term=reverse guibg=DarkGrey"), #ifdef FEAT_DIFF - CENT("DiffAdd term=bold ctermbg=DarkBlue", - "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue"), - CENT("DiffChange term=bold ctermbg=DarkMagenta", - "DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta"), - CENT("DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan", - "DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan"), -#endif -#ifdef FEAT_WINDOWS - CENT("TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey", - "TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey gui=underline guibg=DarkGrey"), -#endif + CENT("DiffAdd term=bold ctermbg=DarkBlue", + "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue"), + CENT("DiffChange term=bold ctermbg=DarkMagenta", + "DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta"), + CENT("DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan", + "DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan"), +#endif + CENT("TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey", + "TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey gui=underline guibg=DarkGrey"), #ifdef FEAT_SYN_HL - CENT("CursorColumn term=reverse ctermbg=DarkGrey", - "CursorColumn term=reverse ctermbg=DarkGrey guibg=Grey40"), - CENT("CursorLine term=underline cterm=underline", - "CursorLine term=underline cterm=underline guibg=Grey40"), - CENT("ColorColumn term=reverse ctermbg=DarkRed", - "ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"), -#endif -#ifdef FEAT_AUTOCMD - CENT("MatchParen term=reverse ctermbg=DarkCyan", - "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), -#endif + CENT("CursorColumn term=reverse ctermbg=DarkGrey", + "CursorColumn term=reverse ctermbg=DarkGrey guibg=Grey40"), + CENT("CursorLine term=underline cterm=underline", + "CursorLine term=underline cterm=underline guibg=Grey40"), + CENT("ColorColumn term=reverse ctermbg=DarkRed", + "ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"), +#endif + CENT("MatchParen term=reverse ctermbg=DarkCyan", + "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), #ifdef FEAT_CONCEAL - CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", - "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), + CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", + "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), #endif #ifdef FEAT_GUI - "Normal gui=NONE", + "Normal gui=NONE", +#endif +#ifdef FEAT_TERMINAL + CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen", + "StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen gui=bold guifg=bg guibg=LightGreen"), + CENT("StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen", + "StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen guifg=bg guibg=LightGreen"), #endif - NULL - }; +#ifdef FEAT_MENU + CENT("ToolbarLine term=underline ctermbg=DarkGrey", + "ToolbarLine term=underline ctermbg=DarkGrey guibg=Grey50"), + CENT("ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey", + "ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey gui=bold guifg=Black guibg=LightGrey"), +#endif + NULL +}; void -init_highlight(both, reset) - int both; /* include groups where 'bg' doesn't matter */ - int reset; /* clear group first */ +init_highlight( + int both, /* include groups where 'bg' doesn't matter */ + int reset) /* clear group first */ { int i; char **pp; @@ -6977,8 +7125,22 @@ init_highlight(both, reset) * and 'background' or 't_Co' is changed. */ p = get_var_value((char_u *)"g:colors_name"); - if (p != NULL && load_colors(p) == OK) - return; + if (p != NULL) + { + /* The value of g:colors_name could be freed when sourcing the script, + * making "p" invalid, so copy it. */ + char_u *copy_p = vim_strsave(p); + int r; + + if (copy_p != NULL) + { + r = load_colors(copy_p); + vim_free(copy_p); + if (r == OK) + return; + } + } + #endif /* @@ -7034,7 +7196,7 @@ init_highlight(both, reset) else { ++recursive; - (void)source_runtime((char_u *)"syntax/syncolor.vim", TRUE); + (void)source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL); --recursive; } } @@ -7046,8 +7208,7 @@ init_highlight(both, reset) * Return OK for success, FAIL for failure. */ int -load_colors(name) - char_u *name; +load_colors(char_u *name) { char_u *buf; int retval = FAIL; @@ -7063,28 +7224,143 @@ load_colors(name) buf = alloc((unsigned)(STRLEN(name) + 12)); if (buf != NULL) { + apply_autocmds(EVENT_COLORSCHEMEPRE, name, + curbuf->b_fname, FALSE, curbuf); sprintf((char *)buf, "colors/%s.vim", name); - retval = source_runtime(buf, FALSE); + retval = source_runtime(buf, DIP_START + DIP_OPT); vim_free(buf); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); -#endif } recursive = FALSE; return retval; } +static char *(color_names[28]) = { + "Black", "DarkBlue", "DarkGreen", "DarkCyan", + "DarkRed", "DarkMagenta", "Brown", "DarkYellow", + "Gray", "Grey", "LightGray", "LightGrey", + "DarkGray", "DarkGrey", + "Blue", "LightBlue", "Green", "LightGreen", + "Cyan", "LightCyan", "Red", "LightRed", "Magenta", + "LightMagenta", "Yellow", "LightYellow", "White", "NONE"}; + /* indices: + * 0, 1, 2, 3, + * 4, 5, 6, 7, + * 8, 9, 10, 11, + * 12, 13, + * 14, 15, 16, 17, + * 18, 19, 20, 21, 22, + * 23, 24, 25, 26, 27 */ +static int color_numbers_16[28] = {0, 1, 2, 3, + 4, 5, 6, 6, + 7, 7, 7, 7, + 8, 8, + 9, 9, 10, 10, + 11, 11, 12, 12, 13, + 13, 14, 14, 15, -1}; +/* for xterm with 88 colors... */ +static int color_numbers_88[28] = {0, 4, 2, 6, + 1, 5, 32, 72, + 84, 84, 7, 7, + 82, 82, + 12, 43, 10, 61, + 14, 63, 9, 74, 13, + 75, 11, 78, 15, -1}; +/* for xterm with 256 colors... */ +static int color_numbers_256[28] = {0, 4, 2, 6, + 1, 5, 130, 130, + 248, 248, 7, 7, + 242, 242, + 12, 81, 10, 121, + 14, 159, 9, 224, 13, + 225, 11, 229, 15, -1}; +/* for terminals with less than 16 colors... */ +static int color_numbers_8[28] = {0, 4, 2, 6, + 1, 5, 3, 3, + 7, 7, 7, 7, + 0+8, 0+8, + 4+8, 4+8, 2+8, 2+8, + 6+8, 6+8, 1+8, 1+8, 5+8, + 5+8, 3+8, 3+8, 7+8, -1}; + +/* + * Lookup the "cterm" value to be used for color with index "idx" in + * color_names[]. + * "boldp" will be set to TRUE or FALSE for a foreground color when using 8 + * colors, otherwise it will be unchanged. + */ + int +lookup_color(int idx, int foreground, int *boldp) +{ + int color = color_numbers_16[idx]; + char_u *p; + + /* Use the _16 table to check if it's a valid color name. */ + if (color < 0) + return -1; + + if (t_colors == 8) + { + /* t_Co is 8: use the 8 colors table */ +#if defined(__QNXNTO__) + color = color_numbers_8_qansi[idx]; +#else + color = color_numbers_8[idx]; +#endif + if (foreground) + { + /* set/reset bold attribute to get light foreground + * colors (on some terminals, e.g. "linux") */ + if (color & 8) + *boldp = TRUE; + else + *boldp = FALSE; + } + color &= 7; /* truncate to 8 colors */ + } + else if (t_colors == 16 || t_colors == 88 + || t_colors >= 256) + { + /* + * Guess: if the termcap entry ends in 'm', it is + * probably an xterm-like terminal. Use the changed + * order for colors. + */ + if (*T_CAF != NUL) + p = T_CAF; + else + p = T_CSF; + if (*p != NUL && (t_colors > 256 + || *(p + STRLEN(p) - 1) == 'm')) + { + if (t_colors == 88) + color = color_numbers_88[idx]; + else if (t_colors >= 256) + color = color_numbers_256[idx]; + else + color = color_numbers_8[idx]; + } +#ifdef FEAT_TERMRESPONSE + if (t_colors >= 256 && color == 15 && is_mac_terminal) + /* Terminal.app has a bug: 15 is light grey. Use white + * from the color cube instead. */ + color = 231; +#endif + } + return color; +} + /* * Handle the ":highlight .." command. * When using ":hi clear" this is called recursively for each group with * "forceit" and "init" both TRUE. */ void -do_highlight(line, forceit, init) - char_u *line; - int forceit; - int init; /* TRUE when called for initializing */ +do_highlight( + char_u *line, + int forceit, + int init) /* TRUE when called for initializing */ { char_u *name_end; char_u *p; @@ -7098,12 +7374,17 @@ do_highlight(line, forceit, init) int attr; int id; int idx; + struct hl_group item_before; + int did_change = FALSE; int dodefault = FALSE; int doclear = FALSE; int dolink = FALSE; int error = FALSE; int color; int is_normal_group = FALSE; /* "Normal" group */ +#ifdef FEAT_TERMINAL + int is_terminal_group = FALSE; /* "Terminal" group */ +#endif #ifdef FEAT_GUI_X11 int is_menu_group = FALSE; /* "Menu" group */ int is_scrollbar_group = FALSE; /* "Scrollbar" group */ @@ -7112,6 +7393,9 @@ do_highlight(line, forceit, init) #else # define is_menu_group 0 # define is_tooltip_group 0 +#endif +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + int did_highlight_changed = FALSE; #endif /* @@ -7210,7 +7494,11 @@ do_highlight(line, forceit, init) if (sourcing_name == NULL && !dodefault) EMSG(_("E414: group has settings, highlight link ignored")); } - else + else if (HL_TABLE()[from_id - 1].sg_link != to_id +#ifdef FEAT_EVAL + || HL_TABLE()[from_id - 1].sg_scriptID != current_SID +#endif + || HL_TABLE()[from_id - 1].sg_cleared) { if (!init) HL_TABLE()[from_id - 1].sg_set |= SG_LINK; @@ -7218,13 +7506,14 @@ do_highlight(line, forceit, init) #ifdef FEAT_EVAL HL_TABLE()[from_id - 1].sg_scriptID = current_SID; #endif + HL_TABLE()[from_id - 1].sg_cleared = FALSE; redraw_all_later(SOME_VALID); + + /* Only call highlight_changed() once after multiple changes. */ + need_highlight_changed = TRUE; } } - /* Only call highlight_changed() once, after sourcing a syntax file */ - need_highlight_changed = TRUE; - return; } @@ -7267,7 +7556,7 @@ do_highlight(line, forceit, init) if (gui.in_use) { gui_new_scrollbar_colors(); -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI gui_mch_new_tooltip_colors(); # endif # ifdef FEAT_MENU @@ -7292,11 +7581,12 @@ do_highlight(line, forceit, init) for (idx = 0; idx < highlight_ga.ga_len; ++idx) highlight_clear(idx); init_highlight(TRUE, TRUE); -#ifdef FEAT_GUI - if (gui.in_use) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (USE_24BIT) highlight_gui_started(); + else #endif - highlight_changed(); + highlight_changed(); redraw_later_clear(); return; } @@ -7316,8 +7606,15 @@ do_highlight(line, forceit, init) if (dodefault && hl_has_settings(idx, TRUE)) return; + /* Make a copy so we can check if any attribute actually changed. */ + item_before = HL_TABLE()[idx]; + if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0) is_normal_group = TRUE; +#ifdef FEAT_TERMINAL + else if (STRCMP(HL_TABLE()[idx].sg_name_u, "TERMINAL") == 0) + is_terminal_group = TRUE; +#endif #ifdef FEAT_GUI_X11 else if (STRCMP(HL_TABLE()[idx].sg_name_u, "MENU") == 0) is_menu_group = TRUE; @@ -7350,7 +7647,7 @@ do_highlight(line, forceit, init) * Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" or * "guibg"). */ - while (*linep && !vim_iswhite(*linep) && *linep != '=') + while (*linep && !VIM_ISWHITE(*linep) && *linep != '=') ++linep; vim_free(key); key = vim_strnsave_up(key_start, (int)(linep - key_start)); @@ -7486,11 +7783,17 @@ do_highlight(line, forceit, init) { /* in non-GUI fonts are simply ignored */ #ifdef FEAT_GUI - if (!gui.shell_created) + if (HL_TABLE()[idx].sg_font_name != NULL + && STRCMP(HL_TABLE()[idx].sg_font_name, arg) == 0) + { + /* Font name didn't change, ignore. */ + } + else if (!gui.shell_created) { /* GUI not started yet, always accept the name. */ vim_free(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_font_name = vim_strsave(arg); + did_change = TRUE; } else { @@ -7519,6 +7822,7 @@ do_highlight(line, forceit, init) gui_mch_free_fontset(temp_sg_fontset); vim_free(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_font_name = vim_strsave(arg); + did_change = TRUE; } else HL_TABLE()[idx].sg_fontset = temp_sg_fontset; @@ -7530,6 +7834,7 @@ do_highlight(line, forceit, init) gui_mch_free_font(temp_sg_font); vim_free(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_font_name = vim_strsave(arg); + did_change = TRUE; } else HL_TABLE()[idx].sg_font = temp_sg_font; @@ -7577,45 +7882,8 @@ do_highlight(line, forceit, init) } else { - static char *(color_names[28]) = { - "Black", "DarkBlue", "DarkGreen", "DarkCyan", - "DarkRed", "DarkMagenta", "Brown", "DarkYellow", - "Gray", "Grey", - "LightGray", "LightGrey", "DarkGray", "DarkGrey", - "Blue", "LightBlue", "Green", "LightGreen", - "Cyan", "LightCyan", "Red", "LightRed", "Magenta", - "LightMagenta", "Yellow", "LightYellow", "White", "NONE"}; - static int color_numbers_16[28] = {0, 1, 2, 3, - 4, 5, 6, 6, - 7, 7, - 7, 7, 8, 8, - 9, 9, 10, 10, - 11, 11, 12, 12, 13, - 13, 14, 14, 15, -1}; - /* for xterm with 88 colors... */ - static int color_numbers_88[28] = {0, 4, 2, 6, - 1, 5, 32, 72, - 84, 84, - 7, 7, 82, 82, - 12, 43, 10, 61, - 14, 63, 9, 74, 13, - 75, 11, 78, 15, -1}; - /* for xterm with 256 colors... */ - static int color_numbers_256[28] = {0, 4, 2, 6, - 1, 5, 130, 130, - 248, 248, - 7, 7, 242, 242, - 12, 81, 10, 121, - 14, 159, 9, 224, 13, - 225, 11, 229, 15, -1}; - /* for terminals with less than 16 colors... */ - static int color_numbers_8[28] = {0, 4, 2, 6, - 1, 5, 3, 3, - 7, 7, - 7, 7, 0+8, 0+8, - 4+8, 4+8, 2+8, 2+8, - 6+8, 6+8, 1+8, 1+8, 5+8, - 5+8, 3+8, 3+8, 7+8, -1}; + int bold = MAYBE; + #if defined(__QNXNTO__) static int *color_numbers_8_qansi = color_numbers_8; /* On qnx, the 8 & 16 color arrays are the same */ @@ -7636,60 +7904,19 @@ do_highlight(line, forceit, init) break; } - /* Use the _16 table to check if its a valid color name. */ - color = color_numbers_16[i]; - if (color >= 0) + color = lookup_color(i, key[5] == 'F', &bold); + + /* set/reset bold attribute to get light foreground + * colors (on some terminals, e.g. "linux") */ + if (bold == TRUE) { - if (t_colors == 8) - { - /* t_Co is 8: use the 8 colors table */ -#if defined(__QNXNTO__) - color = color_numbers_8_qansi[i]; -#else - color = color_numbers_8[i]; -#endif - if (key[5] == 'F') - { - /* set/reset bold attribute to get light foreground - * colors (on some terminals, e.g. "linux") */ - if (color & 8) - { - HL_TABLE()[idx].sg_cterm |= HL_BOLD; - HL_TABLE()[idx].sg_cterm_bold = TRUE; - } - else - HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; - } - color &= 7; /* truncate to 8 colors */ - } - else if (t_colors == 16 || t_colors == 88 - || t_colors == 256) - { - /* - * Guess: if the termcap entry ends in 'm', it is - * probably an xterm-like terminal. Use the changed - * order for colors. - */ - if (*T_CAF != NUL) - p = T_CAF; - else - p = T_CSF; - if (*p != NUL && *(p + STRLEN(p) - 1) == 'm') - switch (t_colors) - { - case 16: - color = color_numbers_8[i]; - break; - case 88: - color = color_numbers_88[i]; - break; - case 256: - color = color_numbers_256[i]; - break; - } - } + HL_TABLE()[idx].sg_cterm |= HL_BOLD; + HL_TABLE()[idx].sg_cterm_bold = TRUE; } + else if (bold == FALSE) + HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; } + /* Add one to the argument, to avoid zero. Zero is used for * "NONE", then "color" is -1. */ if (key[5] == 'F') @@ -7724,18 +7951,25 @@ do_highlight(line, forceit, init) must_redraw = CLEAR; if (color >= 0) { + int dark = -1; + if (termcap_active) term_bg_color(color); if (t_colors < 16) - i = (color == 0 || color == 4); - else - i = (color < 7 || color == 8); + dark = (color == 0 || color == 4); + /* Limit the heuristic to the standard 16 colors */ + else if (color < 16) + dark = (color < 7 || color == 8); /* Set the 'background' option if the value is * wrong. */ - if (i != (*p_bg == 'd')) + if (dark != -1 + && dark != (*p_bg == 'd') + && !option_was_set((char_u *)"bg")) + { set_option_value((char_u *)"bg", 0L, - i ? (char_u *)"dark" - : (char_u *)"light", 0); + (char_u *)(dark ? "dark" : "light"), 0); + reset_option_was_set((char_u *)"bg"); + } } } } @@ -7745,34 +7979,48 @@ do_highlight(line, forceit, init) else if (STRCMP(key, "GUIFG") == 0) { #if defined(FEAT_GUI) || defined(FEAT_EVAL) + char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name; + if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) { if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); - if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) + if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) { HL_TABLE()[idx].sg_gui_fg = i; # endif - vim_free(HL_TABLE()[idx].sg_gui_fg_name); - if (STRCMP(arg, "NONE")) - HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); - else - HL_TABLE()[idx].sg_gui_fg_name = NULL; -# ifdef FEAT_GUI + if (*namep == NULL || STRCMP(*namep, arg) != 0) + { + vim_free(*namep); + if (STRCMP(arg, "NONE") != 0) + *namep = vim_strsave(arg); + else + *namep = NULL; + did_change = TRUE; + } +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # ifdef FEAT_GUI_X11 - if (is_menu_group) + if (is_menu_group && gui.menu_fg_pixel != i) + { gui.menu_fg_pixel = i; - if (is_scrollbar_group) + do_colors = TRUE; + } + if (is_scrollbar_group && gui.scroll_fg_pixel != i) + { gui.scroll_fg_pixel = i; -# ifdef FEAT_BEVAL - if (is_tooltip_group) + do_colors = TRUE; + } +# ifdef FEAT_BEVAL_GUI + if (is_tooltip_group && gui.tooltip_fg_pixel != i) + { gui.tooltip_fg_pixel = i; + do_colors = TRUE; + } # endif - do_colors = TRUE; # endif } # endif @@ -7782,34 +8030,48 @@ do_highlight(line, forceit, init) else if (STRCMP(key, "GUIBG") == 0) { #if defined(FEAT_GUI) || defined(FEAT_EVAL) + char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name; + if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) { if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); - if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) + if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) { HL_TABLE()[idx].sg_gui_bg = i; # endif - vim_free(HL_TABLE()[idx].sg_gui_bg_name); - if (STRCMP(arg, "NONE") != 0) - HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); - else - HL_TABLE()[idx].sg_gui_bg_name = NULL; -# ifdef FEAT_GUI + if (*namep == NULL || STRCMP(*namep, arg) != 0) + { + vim_free(*namep); + if (STRCMP(arg, "NONE") != 0) + *namep = vim_strsave(arg); + else + *namep = NULL; + did_change = TRUE; + } +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # ifdef FEAT_GUI_X11 - if (is_menu_group) + if (is_menu_group && gui.menu_bg_pixel != i) + { gui.menu_bg_pixel = i; - if (is_scrollbar_group) + do_colors = TRUE; + } + if (is_scrollbar_group && gui.scroll_bg_pixel != i) + { gui.scroll_bg_pixel = i; -# ifdef FEAT_BEVAL - if (is_tooltip_group) + do_colors = TRUE; + } +# ifdef FEAT_BEVAL_GUI + if (is_tooltip_group && gui.tooltip_bg_pixel != i) + { gui.tooltip_bg_pixel = i; + do_colors = TRUE; + } # endif - do_colors = TRUE; # endif } # endif @@ -7819,6 +8081,8 @@ do_highlight(line, forceit, init) else if (STRCMP(key, "GUISP") == 0) { #if defined(FEAT_GUI) || defined(FEAT_EVAL) + char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name; + if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) { if (!init) @@ -7830,11 +8094,15 @@ do_highlight(line, forceit, init) { HL_TABLE()[idx].sg_gui_sp = i; # endif - vim_free(HL_TABLE()[idx].sg_gui_sp_name); - if (STRCMP(arg, "NONE") != 0) - HL_TABLE()[idx].sg_gui_sp_name = vim_strsave(arg); - else - HL_TABLE()[idx].sg_gui_sp_name = NULL; + if (*namep == NULL || STRCMP(*namep, arg) != 0) + { + vim_free(*namep); + if (STRCMP(arg, "NONE") != 0) + *namep = vim_strsave(arg); + else + *namep = NULL; + did_change = TRUE; + } # ifdef FEAT_GUI } # endif @@ -7897,7 +8165,7 @@ do_highlight(line, forceit, init) */ for (p = arg, off = 0; off < 100 - 6 && *p; ) { - len = trans_special(&p, buf + off, FALSE); + len = trans_special(&p, buf + off, FALSE, FALSE); if (len > 0) /* recognized special char */ off += len; else /* copy as normal char */ @@ -7929,6 +8197,7 @@ do_highlight(line, forceit, init) error = TRUE; break; } + HL_TABLE()[idx].sg_cleared = FALSE; /* * When highlighting has been given for a group, don't link it. @@ -7959,10 +8228,21 @@ do_highlight(line, forceit, init) * Need to update all groups, because they might be using "bg" * and/or "fg", which have been changed now. */ - if (gui.in_use) +#endif +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (USE_24BIT) + { highlight_gui_started(); + did_highlight_changed = TRUE; + redraw_all_later(NOT_VALID); + } #endif } +#ifdef FEAT_TERMINAL + else if (is_terminal_group) + set_terminal_default_colors( + HL_TABLE()[idx].sg_cterm_fg, HL_TABLE()[idx].sg_cterm_bg); +#endif #ifdef FEAT_GUI_X11 # ifdef FEAT_MENU else if (is_menu_group) @@ -7976,7 +8256,7 @@ do_highlight(line, forceit, init) if (gui.in_use && do_colors) gui_new_scrollbar_colors(); } -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI else if (is_tooltip_group) { if (gui.in_use && do_colors) @@ -7989,18 +8269,32 @@ do_highlight(line, forceit, init) #ifdef FEAT_EVAL HL_TABLE()[idx].sg_scriptID = current_SID; #endif - redraw_all_later(NOT_VALID); } + vim_free(key); vim_free(arg); - /* Only call highlight_changed() once, after sourcing a syntax file */ - need_highlight_changed = TRUE; + /* Only call highlight_changed() once, after a sequence of highlight + * commands, and only if an attribute actually changed. */ + if ((did_change + || memcmp(&HL_TABLE()[idx], &item_before, sizeof(item_before)) != 0) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + && !did_highlight_changed +#endif + ) + { + /* Do not trigger a redraw when highlighting is changed while + * redrawing. This may happen when evaluating 'statusline' changes the + * StatusLine group. */ + if (!updating_screen) + redraw_all_later(NOT_VALID); + need_highlight_changed = TRUE; + } } #if defined(EXITFREE) || defined(PROTO) void -free_highlight() +free_highlight(void) { int i; @@ -8019,9 +8313,9 @@ free_highlight() * possible. Otherwise reset them to zero. */ void -restore_cterm_colors() +restore_cterm_colors(void) { -#if defined(MSDOS) || (defined(WIN3264) && !defined(FEAT_GUI_W32)) +#if defined(WIN3264) && !defined(FEAT_GUI_W32) /* Since t_me has been set, this probably means that the user * wants to use this as default colors. Need to reset default * background/foreground colors. */ @@ -8030,6 +8324,10 @@ restore_cterm_colors() cterm_normal_fg_color = 0; cterm_normal_fg_bold = 0; cterm_normal_bg_color = 0; +# ifdef FEAT_TERMGUICOLORS + cterm_normal_fg_gui_color = INVALCOLOR; + cterm_normal_bg_gui_color = INVALCOLOR; +# endif #endif } @@ -8038,9 +8336,7 @@ restore_cterm_colors() * When "check_link" is TRUE also check for an existing link. */ static int -hl_has_settings(idx, check_link) - int idx; - int check_link; +hl_has_settings(int idx, int check_link) { return ( HL_TABLE()[idx].sg_term_attr != 0 || HL_TABLE()[idx].sg_cterm_attr != 0 @@ -8051,7 +8347,7 @@ hl_has_settings(idx, check_link) || HL_TABLE()[idx].sg_gui_fg_name != NULL || HL_TABLE()[idx].sg_gui_bg_name != NULL || HL_TABLE()[idx].sg_gui_sp_name != NULL - || HL_TABLE()[idx].sg_font_name != NUL + || HL_TABLE()[idx].sg_font_name != NULL #endif || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK))); } @@ -8060,14 +8356,13 @@ hl_has_settings(idx, check_link) * Clear highlighting for one group. */ static void -highlight_clear(idx) - int idx; +highlight_clear(int idx) { + HL_TABLE()[idx].sg_cleared = TRUE; + HL_TABLE()[idx].sg_term = 0; - vim_free(HL_TABLE()[idx].sg_start); - HL_TABLE()[idx].sg_start = NULL; - vim_free(HL_TABLE()[idx].sg_stop); - HL_TABLE()[idx].sg_stop = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_start); + VIM_CLEAR(HL_TABLE()[idx].sg_stop); HL_TABLE()[idx].sg_term_attr = 0; HL_TABLE()[idx].sg_cterm = 0; HL_TABLE()[idx].sg_cterm_bold = FALSE; @@ -8076,16 +8371,15 @@ highlight_clear(idx) HL_TABLE()[idx].sg_cterm_attr = 0; #if defined(FEAT_GUI) || defined(FEAT_EVAL) HL_TABLE()[idx].sg_gui = 0; - vim_free(HL_TABLE()[idx].sg_gui_fg_name); - HL_TABLE()[idx].sg_gui_fg_name = NULL; - vim_free(HL_TABLE()[idx].sg_gui_bg_name); - HL_TABLE()[idx].sg_gui_bg_name = NULL; - vim_free(HL_TABLE()[idx].sg_gui_sp_name); - HL_TABLE()[idx].sg_gui_sp_name = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_gui_fg_name); + VIM_CLEAR(HL_TABLE()[idx].sg_gui_bg_name); + VIM_CLEAR(HL_TABLE()[idx].sg_gui_sp_name); #endif -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; +#endif +#ifdef FEAT_GUI HL_TABLE()[idx].sg_gui_sp = INVALCOLOR; gui_mch_free_font(HL_TABLE()[idx].sg_font); HL_TABLE()[idx].sg_font = NOFONT; @@ -8093,8 +8387,7 @@ highlight_clear(idx) gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); HL_TABLE()[idx].sg_fontset = NOFONTSET; # endif - vim_free(HL_TABLE()[idx].sg_font_name); - HL_TABLE()[idx].sg_font_name = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_gui_attr = 0; #endif #ifdef FEAT_EVAL @@ -8105,64 +8398,99 @@ highlight_clear(idx) #endif } -#if defined(FEAT_GUI) || defined(PROTO) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Set the normal foreground and background colors according to the "Normal" * highlighting group. For X11 also set "Menu", "Scrollbar", and * "Tooltip" colors. */ void -set_normal_colors() +set_normal_colors(void) { - if (set_group_colors((char_u *)"Normal", - &gui.norm_pixel, &gui.back_pixel, - FALSE, TRUE, FALSE)) - { - gui_mch_new_colors(); - must_redraw = CLEAR; - } -#ifdef FEAT_GUI_X11 - if (set_group_colors((char_u *)"Menu", - &gui.menu_fg_pixel, &gui.menu_bg_pixel, - TRUE, FALSE, FALSE)) +# ifdef FEAT_GUI +# ifdef FEAT_TERMGUICOLORS + if (gui.in_use) +# endif { -# ifdef FEAT_MENU - gui_mch_new_menu_colors(); -# endif - must_redraw = CLEAR; + if (set_group_colors((char_u *)"Normal", + &gui.norm_pixel, &gui.back_pixel, + FALSE, TRUE, FALSE)) + { + gui_mch_new_colors(); + must_redraw = CLEAR; + } +# ifdef FEAT_GUI_X11 + if (set_group_colors((char_u *)"Menu", + &gui.menu_fg_pixel, &gui.menu_bg_pixel, + TRUE, FALSE, FALSE)) + { +# ifdef FEAT_MENU + gui_mch_new_menu_colors(); +# endif + must_redraw = CLEAR; + } +# ifdef FEAT_BEVAL_GUI + if (set_group_colors((char_u *)"Tooltip", + &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, + FALSE, FALSE, TRUE)) + { +# ifdef FEAT_TOOLBAR + gui_mch_new_tooltip_colors(); +# endif + must_redraw = CLEAR; + } +# endif + if (set_group_colors((char_u *)"Scrollbar", + &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, + FALSE, FALSE, FALSE)) + { + gui_new_scrollbar_colors(); + must_redraw = CLEAR; + } +# endif } -# ifdef FEAT_BEVAL - if (set_group_colors((char_u *)"Tooltip", - &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, - FALSE, FALSE, TRUE)) - { -# ifdef FEAT_TOOLBAR - gui_mch_new_tooltip_colors(); # endif - must_redraw = CLEAR; - } -#endif - if (set_group_colors((char_u *)"Scrollbar", - &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, - FALSE, FALSE, FALSE)) +# ifdef FEAT_TERMGUICOLORS +# ifdef FEAT_GUI + else +# endif { - gui_new_scrollbar_colors(); - must_redraw = CLEAR; + int idx; + + idx = syn_name2id((char_u *)"Normal") - 1; + if (idx >= 0) + { + gui_do_one_color(idx, FALSE, FALSE); + + /* If the normal fg or bg color changed a complete redraw is + * required. */ + if (cterm_normal_fg_gui_color != HL_TABLE()[idx].sg_gui_fg + || cterm_normal_bg_gui_color != HL_TABLE()[idx].sg_gui_bg) + { + /* if the GUI color is INVALCOLOR then we use the default cterm + * color */ + cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; + cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; + must_redraw = CLEAR; + } + } } -#endif +# endif } +#endif +#if defined(FEAT_GUI) || defined(PROTO) /* * Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar". */ static int -set_group_colors(name, fgp, bgp, do_menu, use_norm, do_tooltip) - char_u *name; - guicolor_T *fgp; - guicolor_T *bgp; - int do_menu; - int use_norm; - int do_tooltip; +set_group_colors( + char_u *name, + guicolor_T *fgp, + guicolor_T *bgp, + int do_menu, + int use_norm, + int do_tooltip) { int idx; @@ -8189,7 +8517,7 @@ set_group_colors(name, fgp, bgp, do_menu, use_norm, do_tooltip) * Returns "" when it's not found or not set. */ char_u * -hl_get_font_name() +hl_get_font_name(void) { int id; char_u *s; @@ -8209,8 +8537,7 @@ hl_get_font_name() * actually chosen to be used. */ void -hl_set_font_name(font_name) - char_u *font_name; +hl_set_font_name(char_u *font_name) { int id; @@ -8227,8 +8554,8 @@ hl_set_font_name(font_name) * when the color is known. */ void -hl_set_bg_color_name(name) - char_u *name; /* must have been allocated */ +hl_set_bg_color_name( + char_u *name) /* must have been allocated */ { int id; @@ -8248,8 +8575,8 @@ hl_set_bg_color_name(name) * when the color is known. */ void -hl_set_fg_color_name(name) - char_u *name; /* must have been allocated */ +hl_set_fg_color_name( + char_u *name) /* must have been allocated */ { int id; @@ -8264,32 +8591,12 @@ hl_set_fg_color_name(name) } } -/* - * Return the handle for a color name. - * Returns INVALCOLOR when failed. - */ - static guicolor_T -color_name2handle(name) - char_u *name; -{ - if (STRCMP(name, "NONE") == 0) - return INVALCOLOR; - - if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) - return gui.norm_pixel; - if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) - return gui.back_pixel; - - return gui_get_color(name); -} - /* * Return the handle for a font name. * Returns NOFONT when failed. */ static GuiFont -font_name2handle(name) - char_u *name; +font_name2handle(char_u *name) { if (STRCMP(name, "NONE") == 0) return NOFONT; @@ -8303,9 +8610,7 @@ font_name2handle(name) * Returns NOFONTSET when failed. */ static GuiFontset -fontset_name2handle(name, fixed_width) - char_u *name; - int fixed_width; +fontset_name2handle(char_u *name, int fixed_width) { if (STRCMP(name, "NONE") == 0) return NOFONTSET; @@ -8318,13 +8623,13 @@ fontset_name2handle(name, fixed_width) * Get the font or fontset for one highlight group. */ static void -hl_do_font(idx, arg, do_normal, do_menu, do_tooltip, free_font) - int idx; - char_u *arg; - int do_normal; /* set normal font */ - int do_menu UNUSED; /* set menu font */ - int do_tooltip UNUSED; /* set tooltip font */ - int free_font; /* free current font/fontset */ +hl_do_font( + int idx, + char_u *arg, + int do_normal, /* set normal font */ + int do_menu UNUSED, /* set menu font */ + int do_tooltip UNUSED, /* set tooltip font */ + int free_font) /* free current font/fontset */ { # ifdef FEAT_XFONTSET /* If 'guifontset' is not empty, first try using the name as a @@ -8367,7 +8672,7 @@ hl_do_font(idx, arg, do_normal, do_menu, do_tooltip, free_font) # endif gui_mch_new_menu_font(); } -# ifdef FEAT_BEVAL +# ifdef FEAT_BEVAL_GUI if (do_tooltip) { /* The Athena widget set cannot currently handle switching between @@ -8409,6 +8714,52 @@ hl_do_font(idx, arg, do_normal, do_menu, do_tooltip, free_font) #endif /* FEAT_GUI */ +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) +/* + * Return the handle for a color name. + * Returns INVALCOLOR when failed. + */ + guicolor_T +color_name2handle(char_u *name) +{ + if (STRCMP(name, "NONE") == 0) + return INVALCOLOR; + + if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) + { +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) + if (gui.in_use) +#endif +#ifdef FEAT_GUI + return gui.norm_pixel; +#endif +#ifdef FEAT_TERMGUICOLORS + if (cterm_normal_fg_gui_color != INVALCOLOR) + return cterm_normal_fg_gui_color; + /* Guess that the foreground is black or white. */ + return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "black" : "white")); +#endif + } + if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) + { +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) + if (gui.in_use) +#endif +#ifdef FEAT_GUI + return gui.back_pixel; +#endif +#ifdef FEAT_TERMGUICOLORS + if (cterm_normal_bg_gui_color != INVALCOLOR) + return cterm_normal_bg_gui_color; + /* Guess that the background is white or black. */ + return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "white" : "black")); +#endif + } + + return GUI_GET_COLOR(name); +} +#endif + /* * Table with the specifications for an attribute number. * Note that this table is used by ALL buffers. This is required because the @@ -8435,9 +8786,7 @@ static garray_T gui_attr_table = {0, 0, 0, 0, NULL}; * Return 0 for error (no more room). */ static int -get_attr_entry(table, aep) - garray_T *table; - attrentry_T *aep; +get_attr_entry(garray_T *table, attrentry_T *aep) { int i; attrentry_T *taep; @@ -8486,8 +8835,14 @@ get_attr_entry(table, aep) && aep->ae_u.cterm.fg_color == taep->ae_u.cterm.fg_color && aep->ae_u.cterm.bg_color - == taep->ae_u.cterm.bg_color) - )) + == taep->ae_u.cterm.bg_color +#ifdef FEAT_TERMGUICOLORS + && aep->ae_u.cterm.fg_rgb + == taep->ae_u.cterm.fg_rgb + && aep->ae_u.cterm.bg_rgb + == taep->ae_u.cterm.bg_rgb +#endif + ))) return i + ATTR_OFF; } @@ -8552,16 +8907,86 @@ get_attr_entry(table, aep) { taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; +#ifdef FEAT_TERMGUICOLORS + taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; + taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; +#endif } ++table->ga_len; return (table->ga_len - 1 + ATTR_OFF); } +/* + * Get an attribute index for a cterm entry. + * Uses an existing entry when possible or adds one when needed. + */ + int +get_cterm_attr_idx(int attr, int fg, int bg) +{ + attrentry_T at_en; + + vim_memset(&at_en, 0, sizeof(attrentry_T)); +#ifdef FEAT_TERMGUICOLORS + at_en.ae_u.cterm.fg_rgb = INVALCOLOR; + at_en.ae_u.cterm.bg_rgb = INVALCOLOR; +#endif + at_en.ae_attr = attr; + at_en.ae_u.cterm.fg_color = fg; + at_en.ae_u.cterm.bg_color = bg; + return get_attr_entry(&cterm_attr_table, &at_en); +} + +#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) +/* + * Get an attribute index for a 'termguicolors' entry. + * Uses an existing entry when possible or adds one when needed. + */ + int +get_tgc_attr_idx(int attr, guicolor_T fg, guicolor_T bg) +{ + attrentry_T at_en; + + vim_memset(&at_en, 0, sizeof(attrentry_T)); + at_en.ae_attr = attr; + if (fg == INVALCOLOR && bg == INVALCOLOR) + { + /* If both GUI colors are not set fall back to the cterm colors. Helps + * if the GUI only has an attribute, such as undercurl. */ + at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } + else + { + at_en.ae_u.cterm.fg_rgb = fg; + at_en.ae_u.cterm.bg_rgb = bg; + } + return get_attr_entry(&cterm_attr_table, &at_en); +} +#endif + +#if defined(FEAT_GUI) || defined(PROTO) +/* + * Get an attribute index for a cterm entry. + * Uses an existing entry when possible or adds one when needed. + */ + int +get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg) +{ + attrentry_T at_en; + + vim_memset(&at_en, 0, sizeof(attrentry_T)); + at_en.ae_attr = attr; + at_en.ae_u.gui.fg_color = fg; + at_en.ae_u.gui.bg_color = bg; + return get_attr_entry(&gui_attr_table, &at_en); +} +#endif + /* * Clear all highlight tables. */ void -clear_hl_tables() +clear_hl_tables(void) { int i; attrentry_T *taep; @@ -8590,9 +9015,7 @@ clear_hl_tables() * Return the resulting attributes. */ int -hl_combine_attr(char_attr, prim_attr) - int char_attr; - int prim_attr; +hl_combine_attr(int char_attr, int prim_attr) { attrentry_T *char_aep = NULL; attrentry_T *spell_aep; @@ -8601,7 +9024,7 @@ hl_combine_attr(char_attr, prim_attr) if (char_attr == 0) return prim_attr; if (char_attr <= HL_ALL && prim_attr <= HL_ALL) - return char_attr | prim_attr; + return ATTR_COMBINE(char_attr, prim_attr); #ifdef FEAT_GUI if (gui.in_use) { @@ -8620,13 +9043,14 @@ hl_combine_attr(char_attr, prim_attr) } if (prim_attr <= HL_ALL) - new_en.ae_attr |= prim_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_gui_attr2entry(prim_attr); if (spell_aep != NULL) { - new_en.ae_attr |= spell_aep->ae_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, + spell_aep->ae_attr); if (spell_aep->ae_u.gui.fg_color != INVALCOLOR) new_en.ae_u.gui.fg_color = spell_aep->ae_u.gui.fg_color; if (spell_aep->ae_u.gui.bg_color != INVALCOLOR) @@ -8645,7 +9069,7 @@ hl_combine_attr(char_attr, prim_attr) } #endif - if (t_colors > 1) + if (IS_CTERM) { if (char_attr > HL_ALL) char_aep = syn_cterm_attr2entry(char_attr); @@ -8654,22 +9078,46 @@ hl_combine_attr(char_attr, prim_attr) else { vim_memset(&new_en, 0, sizeof(new_en)); +#ifdef FEAT_TERMGUICOLORS + new_en.ae_u.cterm.bg_rgb = INVALCOLOR; + new_en.ae_u.cterm.fg_rgb = INVALCOLOR; +#endif if (char_attr <= HL_ALL) new_en.ae_attr = char_attr; } if (prim_attr <= HL_ALL) - new_en.ae_attr |= prim_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_cterm_attr2entry(prim_attr); if (spell_aep != NULL) { - new_en.ae_attr |= spell_aep->ae_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, + spell_aep->ae_attr); if (spell_aep->ae_u.cterm.fg_color > 0) new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; if (spell_aep->ae_u.cterm.bg_color > 0) new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; +#ifdef FEAT_TERMGUICOLORS + /* If both fg and bg are not set fall back to cterm colors. + * Helps for SpellBad which uses undercurl in the GUI. */ + if (COLOR_INVALID(spell_aep->ae_u.cterm.fg_rgb) + && COLOR_INVALID(spell_aep->ae_u.cterm.bg_rgb)) + { + if (spell_aep->ae_u.cterm.fg_color > 0) + new_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + if (spell_aep->ae_u.cterm.bg_color > 0) + new_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } + else + { + if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) + new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; + if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) + new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; + } +#endif } } return get_attr_entry(&cterm_attr_table, &new_en); @@ -8687,13 +9135,13 @@ hl_combine_attr(char_attr, prim_attr) } if (prim_attr <= HL_ALL) - new_en.ae_attr |= prim_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_term_attr2entry(prim_attr); if (spell_aep != NULL) { - new_en.ae_attr |= spell_aep->ae_attr; + new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, spell_aep->ae_attr); if (spell_aep->ae_u.term.start != NULL) { new_en.ae_u.term.start = spell_aep->ae_u.term.start; @@ -8708,8 +9156,7 @@ hl_combine_attr(char_attr, prim_attr) #ifdef FEAT_GUI attrentry_T * -syn_gui_attr2entry(attr) - int attr; +syn_gui_attr2entry(int attr) { attr -= ATTR_OFF; if (attr >= gui_attr_table.ga_len) /* did ":syntax clear" */ @@ -8723,8 +9170,7 @@ syn_gui_attr2entry(attr) * Only to be used when "attr" > HL_ALL. */ int -syn_attr2attr(attr) - int attr; +syn_attr2attr(int attr) { attrentry_T *aep; @@ -8733,10 +9179,10 @@ syn_attr2attr(attr) aep = syn_gui_attr2entry(attr); else #endif - if (t_colors > 1) - aep = syn_cterm_attr2entry(attr); - else - aep = syn_term_attr2entry(attr); + if (IS_CTERM) + aep = syn_cterm_attr2entry(attr); + else + aep = syn_term_attr2entry(attr); if (aep == NULL) /* highlighting not set */ return 0; @@ -8745,8 +9191,7 @@ syn_attr2attr(attr) attrentry_T * -syn_term_attr2entry(attr) - int attr; +syn_term_attr2entry(int attr) { attr -= ATTR_OFF; if (attr >= term_attr_table.ga_len) /* did ":syntax clear" */ @@ -8755,8 +9200,7 @@ syn_term_attr2entry(attr) } attrentry_T * -syn_cterm_attr2entry(attr) - int attr; +syn_cterm_attr2entry(int attr) { attr -= ATTR_OFF; if (attr >= cterm_attr_table.ga_len) /* did ":syntax clear" */ @@ -8769,8 +9213,7 @@ syn_cterm_attr2entry(attr) #define LIST_INT 3 static void -highlight_list_one(id) - int id; +highlight_list_one(int id) { struct hl_group *sgp; int didh = FALSE; @@ -8810,7 +9253,7 @@ highlight_list_one(id) { (void)syn_list_header(didh, 9999, id); didh = TRUE; - msg_puts_attr((char_u *)"links to", hl_attr(HLF_D)); + msg_puts_attr((char_u *)"links to", HL_ATTR(HLF_D)); msg_putchar(' '); msg_outtrans(HL_TABLE()[HL_TABLE()[id - 1].sg_link - 1].sg_name); } @@ -8824,13 +9267,13 @@ highlight_list_one(id) } static int -highlight_list_arg(id, didh, type, iarg, sarg, name) - int id; - int didh; - int type; - int iarg; - char_u *sarg; - char *name; +highlight_list_arg( + int id, + int didh, + int type, + int iarg, + char_u *sarg, + char *name) { char_u buf[100]; char_u *ts; @@ -8867,8 +9310,8 @@ highlight_list_arg(id, didh, type, iarg, sarg, name) { if (*name != NUL) { - MSG_PUTS_ATTR(name, hl_attr(HLF_D)); - MSG_PUTS_ATTR("=", hl_attr(HLF_D)); + MSG_PUTS_ATTR(name, HL_ATTR(HLF_D)); + MSG_PUTS_ATTR("=", HL_ATTR(HLF_D)); } msg_outtrans(ts); } @@ -8882,10 +9325,10 @@ highlight_list_arg(id, didh, type, iarg, sarg, name) * Return NULL otherwise. */ char_u * -highlight_has_attr(id, flag, modec) - int id; - int flag; - int modec; /* 'g' for GUI, 'c' for cterm, 't' for term */ +highlight_has_attr( + int id, + int flag, + int modec) /* 'g' for GUI, 'c' for cterm, 't' for term */ { int attr; @@ -8913,10 +9356,10 @@ highlight_has_attr(id, flag, modec) * Return color name of highlight group "id". */ char_u * -highlight_color(id, what, modec) - int id; - char_u *what; /* "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#" */ - int modec; /* 'g' for GUI, 'c' for cterm, 't' for term */ +highlight_color( + int id, + char_u *what, /* "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#" */ + int modec) /* 'g' for GUI, 'c' for cterm, 't' for term */ { static char_u name[20]; int n; @@ -8938,13 +9381,15 @@ highlight_color(id, what, modec) return NULL; if (modec == 'g') { -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# ifdef FEAT_GUI /* return font name */ if (font) return HL_TABLE()[id - 1].sg_font_name; +# endif /* return #RRGGBB form (only possible when GUI is running) */ - if (gui.in_use && what[2] == '#') + if ((USE_24BIT) && what[2] == '#') { guicolor_T color; long_u rgb; @@ -8953,19 +9398,23 @@ highlight_color(id, what, modec) if (fg) color = HL_TABLE()[id - 1].sg_gui_fg; else if (sp) +# ifdef FEAT_GUI color = HL_TABLE()[id - 1].sg_gui_sp; +# else + color = INVALCOLOR; +# endif else color = HL_TABLE()[id - 1].sg_gui_bg; if (color == INVALCOLOR) return NULL; - rgb = gui_mch_get_rgb(color); + rgb = (long_u)GUI_MCH_GET_RGB(color); sprintf((char *)buf, "#%02x%02x%02x", (unsigned)(rgb >> 16), (unsigned)(rgb >> 8) & 255, (unsigned)rgb & 255); return buf; } -#endif +# endif if (fg) return (HL_TABLE()[id - 1].sg_gui_fg_name); if (sp) @@ -8980,6 +9429,8 @@ highlight_color(id, what, modec) n = HL_TABLE()[id - 1].sg_cterm_fg - 1; else n = HL_TABLE()[id - 1].sg_cterm_bg - 1; + if (n < 0) + return NULL; sprintf((char *)name, "%d", n); return name; } @@ -8988,15 +9439,16 @@ highlight_color(id, what, modec) } #endif -#if (defined(FEAT_SYN_HL) && defined(FEAT_GUI) && defined(FEAT_PRINTER)) \ - || defined(PROTO) +#if (defined(FEAT_SYN_HL) \ + && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) \ + && defined(FEAT_PRINTER)) || defined(PROTO) /* * Return color name of highlight group "id" as RGB value. */ long_u -highlight_gui_color_rgb(id, fg) - int id; - int fg; /* TRUE = fg, FALSE = bg */ +highlight_gui_color_rgb( + int id, + int fg) /* TRUE = fg, FALSE = bg */ { guicolor_T color; @@ -9011,7 +9463,7 @@ highlight_gui_color_rgb(id, fg) if (color == INVALCOLOR) return 0L; - return gui_mch_get_rgb(color); + return GUI_MCH_GET_RGB(color); } #endif @@ -9020,10 +9472,10 @@ highlight_gui_color_rgb(id, fg) * Return TRUE when started a new line. */ static int -syn_list_header(did_header, outlen, id) - int did_header; /* did header already */ - int outlen; /* length of string that comes */ - int id; /* highlight group id */ +syn_list_header( + int did_header, /* did header already */ + int outlen, /* length of string that comes */ + int id) /* highlight group id */ { int endcol = 19; int newline = TRUE; @@ -9070,8 +9522,8 @@ syn_list_header(did_header, outlen, id) * Called after one of the attributes has changed. */ static void -set_hl_attr(idx) - int idx; /* index in array */ +set_hl_attr( + int idx) /* index in array */ { attrentry_T at_en; struct hl_group *sgp = HL_TABLE() + idx; @@ -9127,24 +9579,57 @@ set_hl_attr(idx) * For the color term mode: If there are other than "normal" * highlighting attributes, need to allocate an attr number. */ - if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0) + if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 +# ifdef FEAT_TERMGUICOLORS + && sgp->sg_gui_fg == INVALCOLOR + && sgp->sg_gui_bg == INVALCOLOR +# endif + ) sgp->sg_cterm_attr = sgp->sg_cterm; else { at_en.ae_attr = sgp->sg_cterm; at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; +# ifdef FEAT_TERMGUICOLORS +# ifdef WIN3264 + { + int id; + guicolor_T fg, bg; + + id = syn_name2id((char_u *)"Normal"); + if (id > 0) + { + syn_id2colors(id, &fg, &bg); + if (sgp->sg_gui_fg == INVALCOLOR) + sgp->sg_gui_fg = fg; + if (sgp->sg_gui_bg == INVALCOLOR) + sgp->sg_gui_bg = bg; + } + + } +# endif + at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg); + at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); + if (at_en.ae_u.cterm.fg_rgb == INVALCOLOR + && at_en.ae_u.cterm.bg_rgb == INVALCOLOR) + { + /* If both fg and bg are invalid fall back to the cterm colors. + * Helps when the GUI only uses an attribute, e.g. undercurl. */ + at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } +# endif sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); } } /* - * Lookup a highlight group name and return it's ID. + * Lookup a highlight group name and return its ID. * If it is not found, 0 is returned. */ int -syn_name2id(name) - char_u *name; +syn_name2id(char_u *name) { int i; char_u name_u[200]; @@ -9161,13 +9646,26 @@ syn_name2id(name) return i + 1; } +/* + * Lookup a highlight group name and return its attributes. + * Return zero if not found. + */ + int +syn_name2attr(char_u *name) +{ + int id = syn_name2id(name); + + if (id != 0) + return syn_id2attr(id); + return 0; +} + #if defined(FEAT_EVAL) || defined(PROTO) /* * Return TRUE if highlight group "name" exists. */ int -highlight_exists(name) - char_u *name; +highlight_exists(char_u *name) { return (syn_name2id(name) > 0); } @@ -9178,8 +9676,7 @@ highlight_exists(name) * When not a valid ID return an empty string. */ char_u * -syn_id2name(id) - int id; +syn_id2name(int id) { if (id <= 0 || id > highlight_ga.ga_len) return (char_u *)""; @@ -9192,9 +9689,7 @@ syn_id2name(id) * Like syn_name2id(), but take a pointer + length argument. */ int -syn_namen2id(linep, len) - char_u *linep; - int len; +syn_namen2id(char_u *linep, int len) { char_u *name; int id = 0; @@ -9209,15 +9704,13 @@ syn_namen2id(linep, len) } /* - * Find highlight group name in the table and return it's ID. + * Find highlight group name in the table and return its ID. * The argument is a pointer to the name and the length of the name. * If it doesn't exist yet, a new entry is created. * Return 0 for failure. */ int -syn_check_group(pp, len) - char_u *pp; - int len; +syn_check_group(char_u *pp, int len) { int id; char_u *name; @@ -9235,13 +9728,12 @@ syn_check_group(pp, len) } /* - * Add new highlight group and return it's ID. + * Add new highlight group and return its ID. * "name" must be an allocated string, it will be consumed. * Return 0 for failure. */ static int -syn_add_group(name) - char_u *name; +syn_add_group(char_u *name) { char_u *p; @@ -9258,7 +9750,7 @@ syn_add_group(name) { /* This is an error, but since there previously was no check only * give a warning. */ - msg_source(hl_attr(HLF_W)); + msg_source(HL_ATTR(HLF_W)); MSG(_("W18: Invalid character in group name")); break; } @@ -9292,10 +9784,12 @@ syn_add_group(name) vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(struct hl_group)); HL_TABLE()[highlight_ga.ga_len].sg_name = name; HL_TABLE()[highlight_ga.ga_len].sg_name_u = vim_strsave_up(name); -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; +# ifdef FEAT_GUI HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR; +# endif #endif ++highlight_ga.ga_len; @@ -9307,7 +9801,7 @@ syn_add_group(name) * function deletes the new name. */ static void -syn_unadd_group() +syn_unadd_group(void) { --highlight_ga.ga_len; vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name); @@ -9318,8 +9812,7 @@ syn_unadd_group() * Translate a group ID to highlight attributes. */ int -syn_id2attr(hl_id) - int hl_id; +syn_id2attr(int hl_id) { int attr; struct hl_group *sgp; @@ -9335,7 +9828,7 @@ syn_id2attr(hl_id) attr = sgp->sg_gui_attr; else #endif - if (t_colors > 1) + if (IS_CTERM) attr = sgp->sg_cterm_attr; else attr = sgp->sg_term_attr; @@ -9343,16 +9836,13 @@ syn_id2attr(hl_id) return attr; } -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Get the GUI colors and attributes for a group ID. * NOTE: the colors will be INVALCOLOR when not set, the color otherwise. */ int -syn_id2colors(hl_id, fgp, bgp) - int hl_id; - guicolor_T *fgp; - guicolor_T *bgp; +syn_id2colors(int hl_id, guicolor_T *fgp, guicolor_T *bgp) { struct hl_group *sgp; @@ -9365,12 +9855,26 @@ syn_id2colors(hl_id, fgp, bgp) } #endif +#if (defined(WIN3264) \ + && !defined(FEAT_GUI_W32) \ + && defined(FEAT_TERMGUICOLORS)) || defined(PROTO) + void +syn_id2cterm_bg(int hl_id, int *fgp, int *bgp) +{ + struct hl_group *sgp; + + hl_id = syn_get_final_id(hl_id); + sgp = &HL_TABLE()[hl_id - 1]; /* index is ID minus one */ + *fgp = sgp->sg_cterm_fg - 1; + *bgp = sgp->sg_cterm_bg - 1; +} +#endif + /* * Translate a group ID to the final group ID (following links). */ int -syn_get_final_id(hl_id) - int hl_id; +syn_get_final_id(int hl_id) { int count; struct hl_group *sgp; @@ -9393,18 +9897,20 @@ syn_get_final_id(hl_id) return hl_id; } -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Call this function just after the GUI has started. + * Also called when 'termguicolors' was set, gui.in_use will be FALSE then. * It finds the font and color handles for the highlighting groups. */ void -highlight_gui_started() +highlight_gui_started(void) { int idx; /* First get the colors from the "Normal" and "Menu" group, if set */ - set_normal_colors(); + if (USE_24BIT) + set_normal_colors(); for (idx = 0; idx < highlight_ga.ga_len; ++idx) gui_do_one_color(idx, FALSE, FALSE); @@ -9413,19 +9919,24 @@ highlight_gui_started() } static void -gui_do_one_color(idx, do_menu, do_tooltip) - int idx; - int do_menu; /* TRUE: might set the menu font */ - int do_tooltip; /* TRUE: might set the tooltip font */ +gui_do_one_color( + int idx, + int do_menu UNUSED, /* TRUE: might set the menu font */ + int do_tooltip UNUSED) /* TRUE: might set the tooltip font */ { int didit = FALSE; - if (HL_TABLE()[idx].sg_font_name != NULL) - { - hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, +# ifdef FEAT_GUI +# ifdef FEAT_TERMGUICOLORS + if (gui.in_use) +# endif + if (HL_TABLE()[idx].sg_font_name != NULL) + { + hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, do_tooltip, TRUE); - didit = TRUE; - } + didit = TRUE; + } +# endif if (HL_TABLE()[idx].sg_gui_fg_name != NULL) { HL_TABLE()[idx].sg_gui_fg = @@ -9438,16 +9949,84 @@ gui_do_one_color(idx, do_menu, do_tooltip) color_name2handle(HL_TABLE()[idx].sg_gui_bg_name); didit = TRUE; } +# ifdef FEAT_GUI if (HL_TABLE()[idx].sg_gui_sp_name != NULL) { HL_TABLE()[idx].sg_gui_sp = color_name2handle(HL_TABLE()[idx].sg_gui_sp_name); didit = TRUE; } +# endif if (didit) /* need to get a new attr number */ set_hl_attr(idx); } +#endif +#if defined(USER_HIGHLIGHT) && defined(FEAT_STL_OPT) +/* + * Apply difference between User[1-9] and HLF_S to HLF_SNC, HLF_ST or HLF_STNC. + */ + static void +combine_stl_hlt( + int id, + int id_S, + int id_alt, + int hlcnt, + int i, + int hlf, + int *table) +{ + struct hl_group *hlt = HL_TABLE(); + + if (id_alt == 0) + { + vim_memset(&hlt[hlcnt + i], 0, sizeof(struct hl_group)); + hlt[hlcnt + i].sg_term = highlight_attr[hlf]; + hlt[hlcnt + i].sg_cterm = highlight_attr[hlf]; +# if defined(FEAT_GUI) || defined(FEAT_EVAL) + hlt[hlcnt + i].sg_gui = highlight_attr[hlf]; +# endif + } + else + mch_memmove(&hlt[hlcnt + i], + &hlt[id_alt - 1], + sizeof(struct hl_group)); + hlt[hlcnt + i].sg_link = 0; + + hlt[hlcnt + i].sg_term ^= + hlt[id - 1].sg_term ^ hlt[id_S - 1].sg_term; + if (hlt[id - 1].sg_start != hlt[id_S - 1].sg_start) + hlt[hlcnt + i].sg_start = hlt[id - 1].sg_start; + if (hlt[id - 1].sg_stop != hlt[id_S - 1].sg_stop) + hlt[hlcnt + i].sg_stop = hlt[id - 1].sg_stop; + hlt[hlcnt + i].sg_cterm ^= + hlt[id - 1].sg_cterm ^ hlt[id_S - 1].sg_cterm; + if (hlt[id - 1].sg_cterm_fg != hlt[id_S - 1].sg_cterm_fg) + hlt[hlcnt + i].sg_cterm_fg = hlt[id - 1].sg_cterm_fg; + if (hlt[id - 1].sg_cterm_bg != hlt[id_S - 1].sg_cterm_bg) + hlt[hlcnt + i].sg_cterm_bg = hlt[id - 1].sg_cterm_bg; +# if defined(FEAT_GUI) || defined(FEAT_EVAL) + hlt[hlcnt + i].sg_gui ^= + hlt[id - 1].sg_gui ^ hlt[id_S - 1].sg_gui; +# endif +# ifdef FEAT_GUI + if (hlt[id - 1].sg_gui_fg != hlt[id_S - 1].sg_gui_fg) + hlt[hlcnt + i].sg_gui_fg = hlt[id - 1].sg_gui_fg; + if (hlt[id - 1].sg_gui_bg != hlt[id_S - 1].sg_gui_bg) + hlt[hlcnt + i].sg_gui_bg = hlt[id - 1].sg_gui_bg; + if (hlt[id - 1].sg_gui_sp != hlt[id_S - 1].sg_gui_sp) + hlt[hlcnt + i].sg_gui_sp = hlt[id - 1].sg_gui_sp; + if (hlt[id - 1].sg_font != hlt[id_S - 1].sg_font) + hlt[hlcnt + i].sg_font = hlt[id - 1].sg_font; +# ifdef FEAT_XFONTSET + if (hlt[id - 1].sg_fontset != hlt[id_S - 1].sg_fontset) + hlt[hlcnt + i].sg_fontset = hlt[id - 1].sg_fontset; +# endif +# endif + highlight_ga.ga_len = hlcnt + i + 1; + set_hl_attr(hlcnt + i); /* At long last we can apply */ + table[i] = syn_id2attr(hlcnt + i + 1); +} #endif /* @@ -9459,7 +10038,7 @@ gui_do_one_color(idx, do_menu, do_tooltip) * Return FAIL when an invalid flag is found in 'highlight'. OK otherwise. */ int -highlight_changed() +highlight_changed(void) { int hlf; int i; @@ -9470,8 +10049,12 @@ highlight_changed() #ifdef USER_HIGHLIGHT char_u userhl[10]; # ifdef FEAT_STL_OPT - int id_SNC = -1; int id_S = -1; + int id_SNC = 0; +# ifdef FEAT_TERMINAL + int id_ST = 0; + int id_STNC = 0; +# endif int hlcnt; # endif #endif @@ -9514,7 +10097,7 @@ highlight_changed() attr = 0; for ( ; *p && *p != ','; ++p) /* parse upto comma */ { - if (vim_iswhite(*p)) /* ignore white space */ + if (VIM_ISWHITE(*p)) /* ignore white space */ continue; if (attr > HL_ALL) /* Combination with ':' is not allowed. */ @@ -9537,6 +10120,8 @@ highlight_changed() break; case 'c': attr |= HL_UNDERCURL; break; + case 't': attr |= HL_STRIKETHROUGH; + break; case ':': ++p; /* highlight group name */ if (attr || *p == NUL) /* no combinations */ return FAIL; @@ -9551,6 +10136,12 @@ highlight_changed() #if defined(FEAT_STL_OPT) && defined(USER_HIGHLIGHT) if (hlf == (int)HLF_SNC) id_SNC = syn_get_final_id(id); +# ifdef FEAT_TERMINAL + else if (hlf == (int)HLF_ST) + id_ST = syn_get_final_id(id); + else if (hlf == (int)HLF_STNC) + id_STNC = syn_get_final_id(id); +# endif else if (hlf == (int)HLF_S) id_S = syn_get_final_id(id); #endif @@ -9567,18 +10158,25 @@ highlight_changed() #ifdef USER_HIGHLIGHT /* Setup the user highlights * - * Temporarily utilize 10 more hl entries. Have to be in there - * simultaneously in case of table overflows in get_attr_entry() + * Temporarily utilize 28 more hl entries: + * 9 for User1-User9 combined with StatusLineNC + * 9 for User1-User9 combined with StatusLineTerm + * 9 for User1-User9 combined with StatusLineTermNC + * 1 for StatusLine default + * Have to be in there simultaneously in case of table overflows in + * get_attr_entry() */ # ifdef FEAT_STL_OPT - if (ga_grow(&highlight_ga, 10) == FAIL) + if (ga_grow(&highlight_ga, 28) == FAIL) return FAIL; hlcnt = highlight_ga.ga_len; - if (id_S == 0) - { /* Make sure id_S is always valid to simplify code below */ - vim_memset(&HL_TABLE()[hlcnt + 9], 0, sizeof(struct hl_group)); - HL_TABLE()[hlcnt + 9].sg_term = highlight_attr[HLF_S]; - id_S = hlcnt + 10; + if (id_S == -1) + { + /* Make sure id_S is always valid to simplify code below. Use the last + * entry. */ + vim_memset(&HL_TABLE()[hlcnt + 27], 0, sizeof(struct hl_group)); + HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S]; + id_S = hlcnt + 19; } # endif for (i = 0; i < 9; i++) @@ -9590,65 +10188,24 @@ highlight_changed() highlight_user[i] = 0; # ifdef FEAT_STL_OPT highlight_stlnc[i] = 0; +# ifdef FEAT_TERMINAL + highlight_stlterm[i] = 0; + highlight_stltermnc[i] = 0; +# endif # endif } else { -# ifdef FEAT_STL_OPT - struct hl_group *hlt = HL_TABLE(); -# endif - highlight_user[i] = syn_id2attr(id); # ifdef FEAT_STL_OPT - if (id_SNC == 0) - { - vim_memset(&hlt[hlcnt + i], 0, sizeof(struct hl_group)); - hlt[hlcnt + i].sg_term = highlight_attr[HLF_SNC]; - hlt[hlcnt + i].sg_cterm = highlight_attr[HLF_SNC]; -# if defined(FEAT_GUI) || defined(FEAT_EVAL) - hlt[hlcnt + i].sg_gui = highlight_attr[HLF_SNC]; + combine_stl_hlt(id, id_S, id_SNC, hlcnt, i, + HLF_SNC, highlight_stlnc); +# ifdef FEAT_TERMINAL + combine_stl_hlt(id, id_S, id_ST, hlcnt + 9, i, + HLF_ST, highlight_stlterm); + combine_stl_hlt(id, id_S, id_STNC, hlcnt + 18, i, + HLF_STNC, highlight_stltermnc); # endif - } - else - mch_memmove(&hlt[hlcnt + i], - &hlt[id_SNC - 1], - sizeof(struct hl_group)); - hlt[hlcnt + i].sg_link = 0; - - /* Apply difference between UserX and HLF_S to HLF_SNC */ - hlt[hlcnt + i].sg_term ^= - hlt[id - 1].sg_term ^ hlt[id_S - 1].sg_term; - if (hlt[id - 1].sg_start != hlt[id_S - 1].sg_start) - hlt[hlcnt + i].sg_start = hlt[id - 1].sg_start; - if (hlt[id - 1].sg_stop != hlt[id_S - 1].sg_stop) - hlt[hlcnt + i].sg_stop = hlt[id - 1].sg_stop; - hlt[hlcnt + i].sg_cterm ^= - hlt[id - 1].sg_cterm ^ hlt[id_S - 1].sg_cterm; - if (hlt[id - 1].sg_cterm_fg != hlt[id_S - 1].sg_cterm_fg) - hlt[hlcnt + i].sg_cterm_fg = hlt[id - 1].sg_cterm_fg; - if (hlt[id - 1].sg_cterm_bg != hlt[id_S - 1].sg_cterm_bg) - hlt[hlcnt + i].sg_cterm_bg = hlt[id - 1].sg_cterm_bg; -# if defined(FEAT_GUI) || defined(FEAT_EVAL) - hlt[hlcnt + i].sg_gui ^= - hlt[id - 1].sg_gui ^ hlt[id_S - 1].sg_gui; -# endif -# ifdef FEAT_GUI - if (hlt[id - 1].sg_gui_fg != hlt[id_S - 1].sg_gui_fg) - hlt[hlcnt + i].sg_gui_fg = hlt[id - 1].sg_gui_fg; - if (hlt[id - 1].sg_gui_bg != hlt[id_S - 1].sg_gui_bg) - hlt[hlcnt + i].sg_gui_bg = hlt[id - 1].sg_gui_bg; - if (hlt[id - 1].sg_gui_sp != hlt[id_S - 1].sg_gui_sp) - hlt[hlcnt + i].sg_gui_sp = hlt[id - 1].sg_gui_sp; - if (hlt[id - 1].sg_font != hlt[id_S - 1].sg_font) - hlt[hlcnt + i].sg_font = hlt[id - 1].sg_font; -# ifdef FEAT_XFONTSET - if (hlt[id - 1].sg_fontset != hlt[id_S - 1].sg_fontset) - hlt[hlcnt + i].sg_fontset = hlt[id - 1].sg_fontset; -# endif -# endif - highlight_ga.ga_len = hlcnt + i + 1; - set_hl_attr(hlcnt + i); /* At long last we can apply */ - highlight_stlnc[i] = syn_id2attr(hlcnt + i + 1); # endif } } @@ -9663,16 +10220,14 @@ highlight_changed() #if defined(FEAT_CMDL_COMPL) || defined(PROTO) -static void highlight_list __ARGS((void)); -static void highlight_list_two __ARGS((int cnt, int attr)); +static void highlight_list(void); +static void highlight_list_two(int cnt, int attr); /* * Handle command line completion for :highlight command. */ void -set_context_in_highlight_cmd(xp, arg) - expand_T *xp; - char_u *arg; +set_context_in_highlight_cmd(expand_T *xp, char_u *arg) { char_u *p; @@ -9722,20 +10277,18 @@ set_context_in_highlight_cmd(xp, arg) * List highlighting matches in a nice way. */ static void -highlight_list() +highlight_list(void) { int i; for (i = 10; --i >= 0; ) - highlight_list_two(i, hl_attr(HLF_D)); + highlight_list_two(i, HL_ATTR(HLF_D)); for (i = 40; --i >= 0; ) highlight_list_two(99, 0); } static void -highlight_list_two(cnt, attr) - int cnt; - int attr; +highlight_list_two(int cnt, int attr) { msg_puts_attr((char_u *)&("N \bI \b! \b"[cnt / 11]), attr); msg_clr_eos(); @@ -9749,13 +10302,28 @@ highlight_list_two(cnt, attr) || defined(FEAT_SIGNS) || defined(PROTO) /* * Function given to ExpandGeneric() to obtain the list of group names. - * Also used for synIDattr() function. */ char_u * -get_highlight_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_highlight_name(expand_T *xp UNUSED, int idx) { + return get_highlight_name_ext(xp, idx, TRUE); +} + +/* + * Obtain a highlight group name. + * When "skip_cleared" is TRUE don't return a cleared entry. + */ + char_u * +get_highlight_name_ext(expand_T *xp UNUSED, int idx, int skip_cleared) +{ + if (idx < 0) + return NULL; + + /* Items are never removed from the table, skip the ones that were + * cleared. */ + if (skip_cleared && idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared) + return (char_u *)""; + #ifdef FEAT_CMDL_COMPL if (idx == highlight_ga.ga_len && include_none != 0) return (char_u *)"none"; @@ -9768,7 +10336,7 @@ get_highlight_name(xp, idx) && include_link != 0) return (char_u *)"clear"; #endif - if (idx < 0 || idx >= highlight_ga.ga_len) + if (idx >= highlight_ga.ga_len) return NULL; return HL_TABLE()[idx].sg_name; } @@ -9780,7 +10348,7 @@ get_highlight_name(xp, idx) * Used when quitting for systems which need it. */ void -free_highlight_fonts() +free_highlight_fonts(void) { int idx; diff --git a/src/tag.c b/src/tag.c index ba42f158c7..92ed2a7c4c 100644 --- a/src/tag.c +++ b/src/tag.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -35,19 +35,16 @@ typedef struct tag_pointers } tagptrs_T; /* - * The matching tags are first stored in ga_match[]. In which one depends on - * the priority of the match. - * At the end, the matches from ga_match[] are concatenated, to make a list + * The matching tags are first stored in one of the hash tables. In + * which one depends on the priority of the match. + * ht_match[] is used to find duplicates, ga_match[] to keep them in sequence. + * At the end, all the matches from ga_match[] are concatenated, to make a list * sorted on priority. */ #define MT_ST_CUR 0 /* static match in current file */ #define MT_GL_CUR 1 /* global match in current file */ #define MT_GL_OTH 2 /* global match in other file */ #define MT_ST_OTH 3 /* static match in other file */ -#define MT_IC_ST_CUR 4 /* icase static match in current file */ -#define MT_IC_GL_CUR 5 /* icase global match in current file */ -#define MT_IC_GL_OTH 6 /* icase global match in other file */ -#define MT_IC_ST_OTH 7 /* icase static match in other file */ #define MT_IC_OFF 4 /* add for icase match */ #define MT_RE_OFF 8 /* add for regexp match */ #define MT_MASK 7 /* mask for printing priority */ @@ -59,40 +56,31 @@ static char *mt_names[MT_COUNT/2] = #define NOTAGFILE 99 /* return value for jumpto_tag */ static char_u *nofile_fname = NULL; /* fname for NOTAGFILE error */ -static void taglen_advance __ARGS((int l)); +static void taglen_advance(int l); -static int jumpto_tag __ARGS((char_u *lbuf, int forceit, int keep_help)); +static int jumpto_tag(char_u *lbuf, int forceit, int keep_help); #ifdef FEAT_EMACS_TAGS -static int parse_tag_line __ARGS((char_u *lbuf, int is_etag, tagptrs_T *tagp)); +static int parse_tag_line(char_u *lbuf, int is_etag, tagptrs_T *tagp); #else -static int parse_tag_line __ARGS((char_u *lbuf, tagptrs_T *tagp)); +static int parse_tag_line(char_u *lbuf, tagptrs_T *tagp); #endif -static int test_for_static __ARGS((tagptrs_T *)); -static int parse_match __ARGS((char_u *lbuf, tagptrs_T *tagp)); -static char_u *tag_full_fname __ARGS((tagptrs_T *tagp)); -static char_u *expand_tag_fname __ARGS((char_u *fname, char_u *tag_fname, int expand)); +static int test_for_static(tagptrs_T *); +static int parse_match(char_u *lbuf, tagptrs_T *tagp); +static char_u *tag_full_fname(tagptrs_T *tagp); +static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand); #ifdef FEAT_EMACS_TAGS -static int test_for_current __ARGS((int, char_u *, char_u *, char_u *, char_u *)); +static int test_for_current(int, char_u *, char_u *, char_u *, char_u *); #else -static int test_for_current __ARGS((char_u *, char_u *, char_u *, char_u *)); +static int test_for_current(char_u *, char_u *, char_u *, char_u *); #endif -static int find_extra __ARGS((char_u **pp)); +static int find_extra(char_u **pp); static char_u *bottommsg = (char_u *)N_("E555: at bottom of tag stack"); static char_u *topmsg = (char_u *)N_("E556: at top of tag stack"); static char_u *tagmatchname = NULL; /* name of last used tag */ -/* - * We use ftello() here, if available. It returns off_t instead of long, - * which helps if long is 32 bit and off_t is 64 bit. - * We assume that when fseeko() is available then ftello() is too. - */ -#ifdef HAVE_FSEEKO -# define ftell ftello -#endif - -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* * Tag for preview window is remembered separately, to avoid messing up the * normal tagstack. @@ -121,12 +109,12 @@ static taggy_T ptag_entry = {NULL, {INIT_POS_T(0, 0, 0), 0}, 0, 0}; * for cscope, returns TRUE if we jumped to tag or aborted, FALSE otherwise */ int -do_tag(tag, type, count, forceit, verbose) - char_u *tag; /* tag (pattern) to jump to */ - int type; - int count; - int forceit; /* :ta with ! */ - int verbose; /* print "tag not found" message */ +do_tag( + char_u *tag, /* tag (pattern) to jump to */ + int type, + int count, + int forceit, /* :ta with ! */ + int verbose) /* print "tag not found" message */ { taggy_T *tagstack = curwin->w_tagstack; int tagstackidx = curwin->w_tagstackidx; @@ -190,7 +178,7 @@ do_tag(tag, type, count, forceit, verbose) free_string_option(nofile_fname); nofile_fname = NULL; - clearpos(&saved_fmark.mark); /* shutup gcc 4.0 */ + CLEAR_POS(&saved_fmark.mark); /* shutup gcc 4.0 */ saved_fmark.fnum = 0; /* @@ -200,10 +188,18 @@ do_tag(tag, type, count, forceit, verbose) { use_tagstack = FALSE; new_tag = TRUE; +#if defined(FEAT_QUICKFIX) + if (g_do_tagpreview != 0) + { + vim_free(ptag_entry.tagname); + if ((ptag_entry.tagname = vim_strsave(tag)) == NULL) + goto end_do_tag; + } +#endif } else { -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) use_tagstack = FALSE; else @@ -221,7 +217,7 @@ do_tag(tag, type, count, forceit, verbose) #endif )) { -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { if (ptag_entry.tagname != NULL @@ -277,7 +273,7 @@ do_tag(tag, type, count, forceit, verbose) else { if ( -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) g_do_tagpreview != 0 ? ptag_entry.tagname == NULL : #endif tagstacklen == 0) @@ -360,7 +356,7 @@ do_tag(tag, type, count, forceit, verbose) #endif ) { -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { cur_match = ptag_entry.cur_match; @@ -398,7 +394,7 @@ do_tag(tag, type, count, forceit, verbose) /* Save index for when selection is cancelled. */ prevtagstackidx = tagstackidx; -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { cur_match = ptag_entry.cur_match; @@ -436,7 +432,7 @@ do_tag(tag, type, count, forceit, verbose) } } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { if (type != DT_SELECT && type != DT_JUMP) @@ -491,7 +487,7 @@ do_tag(tag, type, count, forceit, verbose) */ if (use_tagstack) name = tagstack[tagstackidx].tagname; -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) else if (g_do_tagpreview != 0) name = ptag_entry.tagname; #endif @@ -508,14 +504,7 @@ do_tag(tag, type, count, forceit, verbose) tagmatchname = vim_strsave(name); } - /* - * If a count is supplied to the ":tag <name>" command, then - * jump to count'th matching tag. - */ - if (type == DT_TAG && *tag != NUL && count > 0) - cur_match = count - 1; - - if (type == DT_SELECT || type == DT_JUMP + if (type == DT_TAG || type == DT_SELECT || type == DT_JUMP #if defined(FEAT_QUICKFIX) || type == DT_LTAG #endif @@ -578,7 +567,7 @@ do_tag(tag, type, count, forceit, verbose) { if (verbose) EMSG2(_("E426: tag not found: %s"), name); -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif } @@ -594,7 +583,13 @@ do_tag(tag, type, count, forceit, verbose) } else #endif - if (type == DT_SELECT || (type == DT_JUMP && num_matches > 1)) + if (type == DT_TAG) + /* + * If a count is supplied to the ":tag <name>" command, then + * jump to count'th matching tag. + */ + cur_match = count > 0 ? count - 1 : 0; + else if (type == DT_SELECT || (type == DT_JUMP && num_matches > 1)) { /* * List all the matching tags. @@ -610,16 +605,16 @@ do_tag(tag, type, count, forceit, verbose) if (msg_col == 0) msg_didout = FALSE; /* overwrite previous message */ msg_start(); - MSG_PUTS_ATTR(_(" # pri kind tag"), hl_attr(HLF_T)); + MSG_PUTS_ATTR(_(" # pri kind tag"), HL_ATTR(HLF_T)); msg_clr_eos(); taglen_advance(taglen); - MSG_PUTS_ATTR(_("file\n"), hl_attr(HLF_T)); + MSG_PUTS_ATTR(_("file\n"), HL_ATTR(HLF_T)); for (i = 0; i < num_matches && !got_int; ++i) { parse_match(matches[i], &tagp); if (!new_tag && ( -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) (g_do_tagpreview != 0 && i == ptag_entry.cur_match) || #endif @@ -638,7 +633,7 @@ do_tag(tag, type, count, forceit, verbose) msg_advance(13); msg_outtrans_len_attr(tagp.tagname, (int)(tagp.tagname_end - tagp.tagname), - hl_attr(HLF_T)); + HL_ATTR(HLF_T)); msg_putchar(' '); taglen_advance(taglen); @@ -647,7 +642,7 @@ do_tag(tag, type, count, forceit, verbose) p = tag_full_fname(&tagp); if (p != NULL) { - msg_puts_long_attr(p, hl_attr(HLF_D)); + msg_puts_long_attr(p, HL_ATTR(HLF_D)); vim_free(p); } if (msg_col > 0) @@ -682,7 +677,7 @@ do_tag(tag, type, count, forceit, verbose) continue; } /* print all other extra fields */ - attr = hl_attr(HLF_CM); + attr = HL_ATTR(HLF_CM); while (*p && *p != '\r' && *p != '\n') { if (msg_col + ptr2cells(p) >= Columns) @@ -744,7 +739,7 @@ do_tag(tag, type, count, forceit, verbose) /* skip backslash used for escaping a command char or * a backslash */ if (*p == '\\' && (*(p + 1) == *tagp.command - || *(p + 1) == '\\')) + || *(p + 1) == '\\')) ++p; if (*p == TAB) @@ -793,7 +788,7 @@ do_tag(tag, type, count, forceit, verbose) vim_free(cmd); vim_free(fname); if (list != NULL) - list_free(list, TRUE); + list_free(list); goto end_do_tag; } @@ -918,9 +913,9 @@ do_tag(tag, type, count, forceit, verbose) } vim_snprintf((char *)IObuff, IOSIZE, "ltag %s", tag); - set_errorlist(curwin, list, ' ', IObuff); + set_errorlist(curwin, list, ' ', IObuff, NULL); - list_free(list, TRUE); + list_free(list); vim_free(fname); vim_free(cmd); @@ -973,7 +968,7 @@ do_tag(tag, type, count, forceit, verbose) tagstack[tagstackidx].cur_fnum = cur_fnum; ++tagstackidx; } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) else if (g_do_tagpreview != 0) { ptag_entry.cur_match = cur_match; @@ -990,7 +985,7 @@ do_tag(tag, type, count, forceit, verbose) ic = (matches[cur_match][0] & MT_IC_OFF); - if (type != DT_SELECT && type != DT_JUMP + if (type != DT_TAG && type != DT_SELECT && type != DT_JUMP #ifdef FEAT_CSCOPE && type != DT_CSCOPE #endif @@ -1008,7 +1003,7 @@ do_tag(tag, type, count, forceit, verbose) && num_matches > 1) { if (ic) - msg_attr(IObuff, hl_attr(HLF_W)); + msg_attr(IObuff, HL_ATTR(HLF_W)); else msg(IObuff); msg_scroll = TRUE; /* don't overwrite this message */ @@ -1022,7 +1017,7 @@ do_tag(tag, type, count, forceit, verbose) } } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* Let the SwapExists event know what tag we are jumping to. */ vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name); set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1); @@ -1033,7 +1028,7 @@ do_tag(tag, type, count, forceit, verbose) */ i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE); -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif @@ -1078,9 +1073,10 @@ do_tag(tag, type, count, forceit, verbose) /* Only store the new index when using the tagstack and it's valid. */ if (use_tagstack && tagstackidx <= curwin->w_tagstacklen) curwin->w_tagstackidx = tagstackidx; -#ifdef FEAT_WINDOWS postponed_split = 0; /* don't split next time */ -#endif +# ifdef FEAT_QUICKFIX + g_do_tagpreview = 0; /* don't do tag preview next time */ +# endif #ifdef FEAT_CSCOPE return jumped_to_tag; @@ -1093,15 +1089,13 @@ do_tag(tag, type, count, forceit, verbose) * Free cached tags. */ void -tag_freematch() +tag_freematch(void) { - vim_free(tagmatchname); - tagmatchname = NULL; + VIM_CLEAR(tagmatchname); } static void -taglen_advance(l) - int l; +taglen_advance(int l) { if (l == MAXCOL) { @@ -1116,8 +1110,7 @@ taglen_advance(l) * Print the tag stack */ void -do_tags(eap) - exarg_T *eap UNUSED; +do_tags(exarg_T *eap UNUSED) { int i; char_u *name; @@ -1136,7 +1129,7 @@ do_tags(eap) continue; msg_putchar('\n'); - sprintf((char *)IObuff, "%c%2d %2d %-15s %5ld ", + vim_snprintf((char *)IObuff, IOSIZE, "%c%2d %2d %-15s %5ld ", i == tagstackidx ? '>' : ' ', i + 1, tagstack[i].cur_match + 1, @@ -1144,7 +1137,7 @@ do_tags(eap) tagstack[i].fmark.mark.lnum); msg_outtrans(IObuff); msg_outtrans_attr(name, tagstack[i].fmark.fnum == curbuf->b_fnum - ? hl_attr(HLF_D) : 0); + ? HL_ATTR(HLF_D) : 0); vim_free(name); } out_flush(); /* show one line at a time */ @@ -1162,7 +1155,7 @@ do_tags(eap) #endif #ifdef FEAT_TAG_BINS -static int tag_strnicmp __ARGS((char_u *s1, char_u *s2, size_t len)); +static int tag_strnicmp(char_u *s1, char_u *s2, size_t len); /* * Compare two strings, for length "len", ignoring case the ASCII way. @@ -1170,10 +1163,7 @@ static int tag_strnicmp __ARGS((char_u *s1, char_u *s2, size_t len)); * Make sure case is folded to uppercase in comparison (like for 'sort -f') */ static int -tag_strnicmp(s1, s2, len) - char_u *s1; - char_u *s2; - size_t len; +tag_strnicmp(char_u *s1, char_u *s2, size_t len) { int i; @@ -1204,15 +1194,13 @@ typedef struct regmatch_T regmatch; /* regexp program, may be NULL */ } pat_T; -static void prepare_pats __ARGS((pat_T *pats, int has_re)); +static void prepare_pats(pat_T *pats, int has_re); /* * Extract info from the tag search pattern "pats->pat". */ static void -prepare_pats(pats, has_re) - pat_T *pats; - int has_re; +prepare_pats(pat_T *pats, int has_re) { pats->head = pats->pat; pats->headlen = pats->len; @@ -1266,16 +1254,17 @@ prepare_pats(pats, has_re) * TAG_REGEXP use "pat" as a regexp * TAG_NOIC don't always ignore case * TAG_KEEP_LANG keep language + * TAG_CSCOPE use cscope results for tags */ int -find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) - char_u *pat; /* pattern to search for */ - int *num_matches; /* return: number of matches found */ - char_u ***matchesp; /* return: array of matches found */ - int flags; - int mincount; /* MAXCOL: find all matches +find_tags( + char_u *pat, /* pattern to search for */ + int *num_matches, /* return: number of matches found */ + char_u ***matchesp, /* return: array of matches found */ + int flags, + int mincount, /* MAXCOL: find all matches other: minimal number of matches */ - char_u *buf_ffname; /* name of buffer for priority */ + char_u *buf_ffname) /* name of buffer for priority */ { FILE *fp; char_u *lbuf; /* line buffer */ @@ -1297,19 +1286,19 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) int tag_file_sorted = NUL; /* !_TAG_FILE_SORTED value */ struct tag_search_info /* Binary search file offsets */ { - off_t low_offset; /* offset for first char of first line that + off_T low_offset; /* offset for first char of first line that could match */ - off_t high_offset; /* offset of char after last line that could + off_T high_offset; /* offset of char after last line that could match */ - off_t curr_offset; /* Current file offset in search range */ - off_t curr_offset_used; /* curr_offset used when skipping back */ - off_t match_offset; /* Where the binary search found a tag */ + off_T curr_offset; /* Current file offset in search range */ + off_T curr_offset_used; /* curr_offset used when skipping back */ + off_T match_offset; /* Where the binary search found a tag */ int low_char; /* first char at low_offset */ int high_char; /* first char at high_offset */ } search_info; - off_t filesize; + off_T filesize; int tagcmp; - off_t offset; + off_T offset; int round; #endif enum @@ -1347,12 +1336,10 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) int is_etag; /* current file is emaces style */ #endif - struct match_found - { - int len; /* nr of chars of match[] to be compared */ - char_u match[1]; /* actually longer */ - } *mfp, *mfp2; - garray_T ga_match[MT_COUNT]; + char_u *mfp; + garray_T ga_match[MT_COUNT]; /* stores matches in sequence */ + hashtab_T ht_match[MT_COUNT]; /* stores matches by key */ + hash_T hash = 0; int match_count = 0; /* number of matches found */ char_u **matches; int mtt; @@ -1362,6 +1349,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) char_u *help_lang_find = NULL; /* lang to be found */ char_u help_lang[3]; /* lang of current tags file */ char_u *saved_pat = NULL; /* copy of pat[] */ + int is_txt = FALSE; /* flag of file extension */ #endif pat_T orgpat; /* holds unconverted pattern info */ @@ -1386,6 +1374,20 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) int use_cscope = (flags & TAG_CSCOPE); #endif int verbose = (flags & TAG_VERBOSE); + int save_p_ic = p_ic; + + /* + * Change the value of 'ignorecase' according to 'tagcase' for the + * duration of this function. + */ + switch (curbuf->b_tc_flags ? curbuf->b_tc_flags : tc_flags) + { + case TC_FOLLOWIC: break; + case TC_IGNORE: p_ic = TRUE; break; + case TC_MATCH: p_ic = FALSE; break; + case TC_FOLLOWSCS: p_ic = ignorecase(pat); break; + case TC_SMART: p_ic = ignorecase_opt(pat, TRUE, TRUE); break; + } help_save = curbuf->b_help; orgpat.pat = pat; @@ -1393,16 +1395,19 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) vimconv.vc_type = CONV_NONE; #endif -/* - * Allocate memory for the buffers that are used - */ + /* + * Allocate memory for the buffers that are used + */ lbuf = alloc(lbuf_size); tag_fname = alloc(MAXPATHL + 1); #ifdef FEAT_EMACS_TAGS ebuf = alloc(LSIZE); #endif for (mtt = 0; mtt < MT_COUNT; ++mtt) - ga_init2(&ga_match[mtt], (int)sizeof(struct match_found *), 100); + { + ga_init2(&ga_match[mtt], (int)sizeof(char_u *), 100); + hash_init(&ht_match[mtt]); + } /* check for out of memory situation */ if (lbuf == NULL || tag_fname == NULL @@ -1421,6 +1426,14 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) */ if (help_only) /* want tags from help file */ curbuf->b_help = TRUE; /* will be restored later */ +#ifdef FEAT_CSCOPE + else if (use_cscope) + { + /* Make sure we don't mix help and cscope, confuses Coverity. */ + help_only = FALSE; + curbuf->b_help = FALSE; + } +#endif orgpat.len = (int)STRLEN(pat); #ifdef FEAT_MULTI_LANG @@ -1468,6 +1481,15 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) * When the tag file is case-fold sorted, it is either one or the other. * Only ignore case when TAG_NOIC not used or 'ignorecase' set. */ +#ifdef FEAT_MULTI_LANG + /* Set a flag if the file extension is .txt */ + if ((flags & TAG_KEEP_LANG) + && help_lang_find == NULL + && curbuf->b_fname != NULL + && (i = (int)STRLEN(curbuf->b_fname)) > 4 + && STRICMP(curbuf->b_fname + i - 4, ".txt") == 0) + is_txt = TRUE; +#endif #ifdef FEAT_TAG_BINS orgpat.regmatch.rm_ic = ((p_ic || !noic) && (findall || orgpat.headlen == 0 || !p_tbs)); @@ -1501,14 +1523,19 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) #ifdef FEAT_MULTI_LANG if (curbuf->b_help) { - /* Prefer help tags according to 'helplang'. Put the - * two-letter language name in help_lang[]. */ - i = (int)STRLEN(tag_fname); - if (i > 3 && tag_fname[i - 3] == '-') - STRCPY(help_lang, tag_fname + i - 2); - else + /* Keep en if the file extension is .txt*/ + if (is_txt) STRCPY(help_lang, "en"); - + else + { + /* Prefer help tags according to 'helplang'. Put the + * two-letter language name in help_lang[]. */ + i = (int)STRLEN(tag_fname); + if (i > 3 && tag_fname[i - 3] == '-') + STRCPY(help_lang, tag_fname + i - 2); + else + STRCPY(help_lang, "en"); + } /* When searching for a specific language skip tags files * for other languages. */ if (help_lang_find != NULL @@ -1570,10 +1597,16 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) */ for (;;) { - line_breakcheck(); /* check for CTRL-C typed */ +#ifdef FEAT_TAG_BINS + /* check for CTRL-C typed, more often when jumping around */ + if (state == TS_BINARY || state == TS_SKIP_BACK) + line_breakcheck(); + else +#endif + fast_breakcheck(); #ifdef FEAT_INS_EXPAND if ((flags & TAG_INS_COMP)) /* Double brackets for gcc */ - ins_compl_check_keys(30); + ins_compl_check_keys(30, FALSE); if (got_int || compl_interrupted) #else if (got_int) @@ -1628,25 +1661,17 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) { /* Adjust the search file offset to the correct position */ search_info.curr_offset_used = search_info.curr_offset; -#ifdef HAVE_FSEEKO - fseeko(fp, search_info.curr_offset, SEEK_SET); -#else - fseek(fp, (long)search_info.curr_offset, SEEK_SET); -#endif + vim_fseek(fp, search_info.curr_offset, SEEK_SET); eof = tag_fgets(lbuf, LSIZE, fp); if (!eof && search_info.curr_offset != 0) { /* The explicit cast is to work around a bug in gcc 3.4.2 * (repeated below). */ - search_info.curr_offset = ftell(fp); + search_info.curr_offset = vim_ftell(fp); if (search_info.curr_offset == search_info.high_offset) { /* oops, gone a bit too far; try from low offset */ -#ifdef HAVE_FSEEKO - fseeko(fp, search_info.low_offset, SEEK_SET); -#else - fseek(fp, (long)search_info.low_offset, SEEK_SET); -#endif + vim_fseek(fp, search_info.low_offset, SEEK_SET); search_info.curr_offset = search_info.low_offset; } eof = tag_fgets(lbuf, LSIZE, fp); @@ -1654,14 +1679,14 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) /* skip empty and blank lines */ while (!eof && vim_isblankline(lbuf)) { - search_info.curr_offset = ftell(fp); + search_info.curr_offset = vim_ftell(fp); eof = tag_fgets(lbuf, LSIZE, fp); } if (eof) { /* Hit end of file. Skip backwards. */ state = TS_SKIP_BACK; - search_info.match_offset = ftell(fp); + search_info.match_offset = vim_ftell(fp); search_info.curr_offset = search_info.curr_offset_used; continue; } @@ -1738,8 +1763,13 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) /* * Emacs tags line with CTRL-L: New file name on next line. * The file name is followed by a ','. + * Remember etag file name in ebuf. */ - if (*lbuf == Ctrl_L) /* remember etag file name in ebuf */ + if (*lbuf == Ctrl_L +# ifdef FEAT_CSCOPE + && !use_cscope +# endif + ) { is_etag = 1; /* in case at the start */ state = TS_LINEAR; @@ -1887,12 +1917,12 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) { /* Get the tag file size (don't use mch_fstat(), it's not * portable). */ - if ((filesize = lseek(fileno(fp), - (off_t)0L, SEEK_END)) <= 0) + if ((filesize = vim_lseek(fileno(fp), + (off_T)0L, SEEK_END)) <= 0) state = TS_LINEAR; else { - lseek(fileno(fp), (off_t)0L, SEEK_SET); + vim_lseek(fileno(fp), (off_T)0L, SEEK_SET); /* Calculate the first read offset in the file. Start * the search in the middle of the file. */ @@ -1919,6 +1949,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) #endif ) { + vim_memset(&tagp, 0, sizeof(tagp)); tagp.tagname = lbuf; #ifdef FEAT_TAG_ANYWHITE tagp.tagname_end = skiptowhite(lbuf); @@ -1944,11 +1975,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) /* Avoid getting stuck. */ linear = TRUE; state = TS_LINEAR; -# ifdef HAVE_FSEEKO - fseeko(fp, search_info.low_offset, SEEK_SET); -# else - fseek(fp, (long)search_info.low_offset, SEEK_SET); -# endif + vim_fseek(fp, search_info.low_offset, SEEK_SET); } #endif continue; @@ -1969,17 +1996,17 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) if (*p == ':') { if (tagp.fname == NULL) -#ifdef FEAT_TAG_ANYWHITE +# ifdef FEAT_TAG_ANYWHITE tagp.fname = skipwhite(tagp.tagname_end); -#else +# else tagp.fname = tagp.tagname_end + 1; -#endif +# endif if ( fnamencmp(lbuf, tagp.fname, p - lbuf) == 0 -#ifdef FEAT_TAG_ANYWHITE - && vim_iswhite(tagp.fname[p - lbuf]) -#else +# ifdef FEAT_TAG_ANYWHITE + && VIM_ISWHITE(tagp.fname[p - lbuf]) +# else && tagp.fname[p - lbuf] == TAB -#endif +# endif ) { /* found one */ @@ -2046,7 +2073,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) } if (tagcmp < 0) { - search_info.curr_offset = ftell(fp); + search_info.curr_offset = vim_ftell(fp); if (search_info.curr_offset < search_info.high_offset) { search_info.low_offset = search_info.curr_offset; @@ -2087,7 +2114,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) { if (MB_STRNICMP(tagp.tagname, orgpat.head, cmplen) != 0) { - if ((off_t)ftell(fp) > search_info.match_offset) + if ((off_T)vim_ftell(fp) > search_info.match_offset) break; /* past last match */ else continue; /* before first match */ @@ -2189,10 +2216,12 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) } /* - * If a match is found, add it to ga_match[]. + * If a match is found, add it to ht_match[] and ga_match[]. */ if (match) { + int len = 0; + #ifdef FEAT_CSCOPE if (use_cscope) { @@ -2245,177 +2274,177 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) } /* - * Add the found match in ga_match[mtt], avoiding duplicates. + * Add the found match in ht_match[mtt] and ga_match[mtt]. * Store the info we need later, which depends on the kind of * tags we are dealing with. */ - if (ga_grow(&ga_match[mtt], 1) == OK) + if (help_only) { - int len; - - if (help_only) - { #ifdef FEAT_MULTI_LANG # define ML_EXTRA 3 #else # define ML_EXTRA 0 #endif - /* - * Append the help-heuristic number after the - * tagname, for sorting it later. - */ - *tagp.tagname_end = NUL; - len = (int)(tagp.tagname_end - tagp.tagname); - mfp = (struct match_found *) - alloc((int)sizeof(struct match_found) + len - + 10 + ML_EXTRA); - if (mfp != NULL) - { - /* "len" includes the language and the NUL, but - * not the priority. */ - mfp->len = len + ML_EXTRA + 1; -#define ML_HELP_LEN 6 - p = mfp->match; - STRCPY(p, tagp.tagname); + /* + * Append the help-heuristic number after the tagname, for + * sorting it later. The heuristic is ignored for + * detecting duplicates. + * The format is {tagname}@{lang}NUL{heuristic}NUL + */ + *tagp.tagname_end = NUL; + len = (int)(tagp.tagname_end - tagp.tagname); + mfp = (char_u *)alloc((int)sizeof(char_u) + + len + 10 + ML_EXTRA + 1); + if (mfp != NULL) + { + int heuristic; + + p = mfp; + STRCPY(p, tagp.tagname); #ifdef FEAT_MULTI_LANG - p[len] = '@'; - STRCPY(p + len + 1, help_lang); + p[len] = '@'; + STRCPY(p + len + 1, help_lang); #endif - sprintf((char *)p + len + 1 + ML_EXTRA, "%06d", - help_heuristic(tagp.tagname, - match_re ? matchoff : 0, !match_no_ic) + + heuristic = help_heuristic(tagp.tagname, + match_re ? matchoff : 0, !match_no_ic); #ifdef FEAT_MULTI_LANG - + help_pri + heuristic += help_pri; #endif - ); - } - *tagp.tagname_end = TAB; + sprintf((char *)p + len + 1 + ML_EXTRA, "%06d", + heuristic); } - else if (name_only) + *tagp.tagname_end = TAB; + } + else if (name_only) + { + if (get_it_again) { - if (get_it_again) - { - char_u *temp_end = tagp.command; + char_u *temp_end = tagp.command; - if (*temp_end == '/') - while (*temp_end && *temp_end != '\r' - && *temp_end != '\n' - && *temp_end != '$') - temp_end++; + if (*temp_end == '/') + while (*temp_end && *temp_end != '\r' + && *temp_end != '\n' + && *temp_end != '$') + temp_end++; - if (tagp.command + 2 < temp_end) - { - len = (int)(temp_end - tagp.command - 2); - mfp = (struct match_found *)alloc( - (int)sizeof(struct match_found) + len); - if (mfp != NULL) - { - mfp->len = len + 1; /* include the NUL */ - p = mfp->match; - vim_strncpy(p, tagp.command + 2, len); - } - } - else - mfp = NULL; - get_it_again = FALSE; - } - else + if (tagp.command + 2 < temp_end) { - len = (int)(tagp.tagname_end - tagp.tagname); - mfp = (struct match_found *)alloc( - (int)sizeof(struct match_found) + len); + len = (int)(temp_end - tagp.command - 2); + mfp = (char_u *)alloc(len + 2); if (mfp != NULL) - { - mfp->len = len + 1; /* include the NUL */ - p = mfp->match; - vim_strncpy(p, tagp.tagname, len); - } - - /* if wanted, re-read line to get long form too */ - if (State & INSERT) - get_it_again = p_sft; + vim_strncpy(mfp, tagp.command + 2, len); } + else + mfp = NULL; + get_it_again = FALSE; } else { - /* Save the tag in a buffer. - * Emacs tag: <mtt><tag_fname><NUL><ebuf><NUL><lbuf> - * other tag: <mtt><tag_fname><NUL><NUL><lbuf> - * without Emacs tags: <mtt><tag_fname><NUL><lbuf> - */ - len = (int)STRLEN(tag_fname) - + (int)STRLEN(lbuf) + 3; + len = (int)(tagp.tagname_end - tagp.tagname); + mfp = (char_u *)alloc((int)sizeof(char_u) + len + 1); + if (mfp != NULL) + vim_strncpy(mfp, tagp.tagname, len); + + /* if wanted, re-read line to get long form too */ + if (State & INSERT) + get_it_again = p_sft; + } + } + else + { +#define TAG_SEP 0x02 + size_t tag_fname_len = STRLEN(tag_fname); #ifdef FEAT_EMACS_TAGS - if (is_etag) - len += (int)STRLEN(ebuf) + 1; - else - ++len; + size_t ebuf_len = 0; #endif - mfp = (struct match_found *)alloc( - (int)sizeof(struct match_found) + len); - if (mfp != NULL) - { - mfp->len = len; - p = mfp->match; - p[0] = mtt; - STRCPY(p + 1, tag_fname); + + /* Save the tag in a buffer. + * Use 0x02 to separate fields (Can't use NUL because the + * hash key is terminated by NUL, or Ctrl_A because that is + * part of some Emacs tag files -- see parse_tag_line). + * Emacs tag: <mtt><tag_fname><0x02><ebuf><0x02><lbuf><NUL> + * other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL> + * without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL> + * Here <mtt> is the "mtt" value plus 1 to avoid NUL. + */ + len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3; +#ifdef FEAT_EMACS_TAGS + if (is_etag) + { + ebuf_len = STRLEN(ebuf); + len += (int)ebuf_len + 1; + } + else + ++len; +#endif + mfp = (char_u *)alloc((int)sizeof(char_u) + len + 1); + if (mfp != NULL) + { + p = mfp; + p[0] = mtt + 1; + STRCPY(p + 1, tag_fname); #ifdef BACKSLASH_IN_FILENAME - /* Ignore differences in slashes, avoid adding - * both path/file and path\file. */ - slash_adjust(p + 1); + /* Ignore differences in slashes, avoid adding + * both path/file and path\file. */ + slash_adjust(p + 1); #endif - s = p + 1 + STRLEN(tag_fname) + 1; + p[tag_fname_len + 1] = TAG_SEP; + s = p + 1 + tag_fname_len + 1; #ifdef FEAT_EMACS_TAGS - if (is_etag) - { - STRCPY(s, ebuf); - s += STRLEN(ebuf) + 1; - } - else - *s++ = NUL; -#endif - STRCPY(s, lbuf); + if (is_etag) + { + STRCPY(s, ebuf); + s[ebuf_len] = TAG_SEP; + s += ebuf_len + 1; } + else + *s++ = TAG_SEP; +#endif + STRCPY(s, lbuf); } + } - if (mfp != NULL) - { - /* - * Don't add identical matches. - * This can take a lot of time when finding many - * matches, check for CTRL-C now and then. - * Add all cscope tags, because they are all listed. - */ + if (mfp != NULL) + { + hashitem_T *hi; + + /* + * Don't add identical matches. + * Add all cscope tags, because they are all listed. + * "mfp" is used as a hash key, there is a NUL byte to end + * the part matters for comparing, more bytes may follow + * after it. E.g. help tags store the priority after the + * NUL. + */ #ifdef FEAT_CSCOPE - if (use_cscope) - i = -1; - else + if (use_cscope) + hash++; + else #endif - for (i = ga_match[mtt].ga_len; --i >= 0 && !got_int; ) - { - mfp2 = ((struct match_found **) - (ga_match[mtt].ga_data))[i]; - if (mfp2->len == mfp->len - && vim_memcmp(mfp2->match, mfp->match, - (size_t)mfp->len) == 0) - break; - line_breakcheck(); - } - if (i < 0) + hash = hash_hash(mfp); + hi = hash_lookup(&ht_match[mtt], mfp, hash); + if (HASHITEM_EMPTY(hi)) + { + if (hash_add_item(&ht_match[mtt], hi, mfp, hash) + == FAIL + || ga_grow(&ga_match[mtt], 1) != OK) { - ((struct match_found **)(ga_match[mtt].ga_data)) - [ga_match[mtt].ga_len++] = mfp; - ++match_count; + /* Out of memory! Just forget about the rest. */ + retval = OK; + stop_searching = TRUE; + break; } else - vim_free(mfp); + { + ((char_u **)(ga_match[mtt].ga_data)) + [ga_match[mtt].ga_len++] = mfp; + ++match_count; + } } - } - else /* Out of memory! Just forget about the rest. */ - { - retval = OK; - stop_searching = TRUE; - break; + else + /* duplicate tag, drop it */ + vim_free(mfp); } } #ifdef FEAT_CSCOPE @@ -2430,7 +2459,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) #ifdef FEAT_CSCOPE if (!use_cscope) #endif - EMSGN(_("Before byte %ld"), (long)ftell(fp)); + EMSGN(_("Before byte %ld"), (long)vim_ftell(fp)); stop_searching = TRUE; line_error = FALSE; } @@ -2529,20 +2558,27 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) { for (i = 0; i < ga_match[mtt].ga_len; ++i) { - mfp = ((struct match_found **)(ga_match[mtt].ga_data))[i]; + mfp = ((char_u **)(ga_match[mtt].ga_data))[i]; if (matches == NULL) vim_free(mfp); else { - /* To avoid allocating memory again we turn the struct - * match_found into a string. For help the priority was not - * included in the length. */ - mch_memmove(mfp, mfp->match, - (size_t)(mfp->len + (help_only ? ML_HELP_LEN : 0))); + if (!name_only) + { + /* Change mtt back to zero-based. */ + *mfp = *mfp - 1; + + /* change the TAG_SEP back to NUL */ + for (p = mfp + 1; *p != NUL; ++p) + if (*p == TAG_SEP) + *p = NUL; + } matches[match_count++] = (char_u *)mfp; } } + ga_clear(&ga_match[mtt]); + hash_clear(&ht_match[mtt]); } *matchesp = matches; @@ -2553,20 +2589,20 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) vim_free(saved_pat); #endif + p_ic = save_p_ic; + return retval; } static garray_T tag_fnames = GA_EMPTY; -static void found_tagfile_cb __ARGS((char_u *fname, void *cookie)); +static void found_tagfile_cb(char_u *fname, void *cookie); /* * Callback function for finding all "tags" and "tags-??" files in * 'runtimepath' doc directories. */ static void -found_tagfile_cb(fname, cookie) - char_u *fname; - void *cookie UNUSED; +found_tagfile_cb(char_u *fname, void *cookie UNUSED) { if (ga_grow(&tag_fnames, 1) == OK) ((char_u **)(tag_fnames.ga_data))[tag_fnames.ga_len++] = @@ -2575,18 +2611,15 @@ found_tagfile_cb(fname, cookie) #if defined(EXITFREE) || defined(PROTO) void -free_tag_stuff() +free_tag_stuff(void) { ga_clear_strings(&tag_fnames); do_tag(NULL, DT_FREE, 0, 0, 0); tag_freematch(); -# if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (ptag_entry.tagname) - { - vim_free(ptag_entry.tagname); - ptag_entry.tagname = NULL; - } + VIM_CLEAR(ptag_entry.tagname); # endif } #endif @@ -2598,10 +2631,10 @@ free_tag_stuff() * Return FAIL if no more tag file names, OK otherwise. */ int -get_tagfname(tnp, first, buf) - tagname_T *tnp; /* holds status info */ - int first; /* TRUE when first file name is wanted */ - char_u *buf; /* pointer to buffer of MAXPATHL chars */ +get_tagfname( + tagname_T *tnp, /* holds status info */ + int first, /* TRUE when first file name is wanted */ + char_u *buf) /* pointer to buffer of MAXPATHL chars */ { char_u *fname = NULL; char_u *r_ptr; @@ -2634,7 +2667,7 @@ get_tagfname(tnp, first, buf) #else "doc/tags" #endif - , TRUE, found_tagfile_cb, NULL); + , DIP_ALL, found_tagfile_cb, NULL); } if (tnp->tn_hf_idx >= tag_fnames.ga_len) @@ -2728,8 +2761,7 @@ get_tagfname(tnp, first, buf) * Free the contents of a tagname_T that was filled by get_tagfname(). */ void -tagname_free(tnp) - tagname_T *tnp; +tagname_free(tagname_T *tnp) { vim_free(tnp->tn_tags); vim_findfile_cleanup(tnp->tn_search_ctx); @@ -2746,16 +2778,12 @@ tagname_free(tnp) * Return FAIL if there is a format error in this line, OK otherwise. */ static int -parse_tag_line(lbuf, +parse_tag_line( + char_u *lbuf, /* line to be parsed */ #ifdef FEAT_EMACS_TAGS - is_etag, + int is_etag, #endif - tagp) - char_u *lbuf; /* line to be parsed */ -#ifdef FEAT_EMACS_TAGS - int is_etag; -#endif - tagptrs_T *tagp; + tagptrs_T *tagp) { char_u *p; @@ -2882,8 +2910,7 @@ parse_tag_line(lbuf, * Return FALSE if it is not a static tag. */ static int -test_for_static(tagp) - tagptrs_T *tagp; +test_for_static(tagptrs_T *tagp) { char_u *p; @@ -2918,6 +2945,22 @@ test_for_static(tagp) return FALSE; } +/* + * Returns the length of a matching tag line. + */ + static size_t +matching_line_len(char_u *lbuf) +{ + char_u *p = lbuf + 1; + + /* does the same thing as parse_match() */ + p += STRLEN(p) + 1; +#ifdef FEAT_EMACS_TAGS + p += STRLEN(p) + 1; +#endif + return (p - lbuf) + STRLEN(p); +} + /* * Parse a line from a matching tag. Does not change the line itself. * @@ -2929,9 +2972,9 @@ test_for_static(tagp) * Return OK or FAIL. */ static int -parse_match(lbuf, tagp) - char_u *lbuf; /* input: matching line */ - tagptrs_T *tagp; /* output: pointers into the line */ +parse_match( + char_u *lbuf, /* input: matching line */ + tagptrs_T *tagp) /* output: pointers into the line */ { int retval; char_u *p; @@ -3009,8 +3052,7 @@ parse_match(lbuf, tagp) * Returns an allocated string or NULL (out of memory). */ static char_u * -tag_full_fname(tagp) - tagptrs_T *tagp; +tag_full_fname(tagptrs_T *tagp) { char_u *fullname; int c; @@ -3040,16 +3082,15 @@ tag_full_fname(tagp) * returns OK for success, NOTAGFILE when file not found, FAIL otherwise. */ static int -jumpto_tag(lbuf, forceit, keep_help) - char_u *lbuf; /* line from the tags file for this tag */ - int forceit; /* :ta with ! */ - int keep_help; /* keep help flag (FALSE for cscope) */ +jumpto_tag( + char_u *lbuf_arg, /* line from the tags file for this tag */ + int forceit, /* :ta with ! */ + int keep_help) /* keep help flag (FALSE for cscope) */ { int save_secure; int save_magic; int save_p_ws, save_p_scs, save_p_ic; linenr_T save_lnum; - int csave = 0; char_u *str; char_u *pbuf; /* search pattern buffer */ char_u *pbuf_end; @@ -3057,30 +3098,38 @@ jumpto_tag(lbuf, forceit, keep_help) char_u *fname; tagptrs_T tagp; int retval = FAIL; - int getfile_result; + int getfile_result = GETFILE_UNUSED; int search_options; #ifdef FEAT_SEARCH_EXTRA int save_no_hlsearch; #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) win_T *curwin_save = NULL; #endif char_u *full_fname = NULL; #ifdef FEAT_FOLDING int old_KeyTyped = KeyTyped; /* getting the file may reset it */ #endif + size_t len; + char_u *lbuf; + + /* Make a copy of the line, it can become invalid when an autocommand calls + * back here recursively. */ + len = matching_line_len(lbuf_arg) + 1; + lbuf = alloc((int)len); + if (lbuf != NULL) + mch_memmove(lbuf, lbuf_arg, len); pbuf = alloc(LSIZE); /* parse the match line into the tagp structure */ - if (pbuf == NULL || parse_match(lbuf, &tagp) == FAIL) + if (pbuf == NULL || lbuf == NULL || parse_match(lbuf, &tagp) == FAIL) { tagp.fname_end = NULL; goto erret; } /* truncate the file name, so it can be used as a string */ - csave = *tagp.fname_end; *tagp.fname_end = NUL; fname = tagp.fname; @@ -3125,11 +3174,7 @@ jumpto_tag(lbuf, forceit, keep_help) * file. Also accept a file name for which there is a matching BufReadCmd * autocommand event (e.g., http://sys/file). */ - if (mch_getperm(fname) < 0 -#ifdef FEAT_AUTOCMD - && !has_autocmd(EVENT_BUFREADCMD, fname, NULL) -#endif - ) + if (mch_getperm(fname) < 0 && !has_autocmd(EVENT_BUFREADCMD, fname, NULL)) { retval = NOTAGFILE; vim_free(nofile_fname); @@ -3145,7 +3190,7 @@ jumpto_tag(lbuf, forceit, keep_help) need_mouse_correct = TRUE; #endif -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { postponed_split = 0; /* don't split again below */ @@ -3171,10 +3216,36 @@ jumpto_tag(lbuf, forceit, keep_help) /* If it was a CTRL-W CTRL-] command split window now. For ":tab tag" * open a new tab page. */ - if (postponed_split || cmdmod.tab != 0) + if (postponed_split && (swb_flags & (SWB_USEOPEN | SWB_USETAB))) { - win_split(postponed_split > 0 ? postponed_split : 0, - postponed_split_flags); + buf_T *existing_buf = buflist_findname_exp(fname); + + if (existing_buf != NULL) + { + win_T *wp = NULL; + + if (swb_flags & SWB_USEOPEN) + wp = buf_jump_open_win(existing_buf); + + /* If 'switchbuf' contains "usetab": jump to first window in any tab + * page containing "existing_buf" if one exists */ + if (wp == NULL && (swb_flags & SWB_USETAB)) + wp = buf_jump_open_tab(existing_buf); + /* We've switched to the buffer, the usual loading of the file must + * be skipped. */ + if (wp != NULL) + getfile_result = GETFILE_SAME_FILE; + } + } + if (getfile_result == GETFILE_UNUSED + && (postponed_split || cmdmod.tab != 0)) + { + if (win_split(postponed_split > 0 ? postponed_split : 0, + postponed_split_flags) == FAIL) + { + --RedrawingDisabled; + goto erret; + } RESET_BINDING(curwin); } #endif @@ -3183,22 +3254,24 @@ jumpto_tag(lbuf, forceit, keep_help) { /* A :ta from a help file will keep the b_help flag set. For ":ptag" * we need to use the flag from the window where we came from. */ -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) - keep_help_flag = curwin_save->w_buffer->b_help; + keep_help_flag = bt_help(curwin_save->w_buffer); else #endif keep_help_flag = curbuf->b_help; } - getfile_result = getfile(0, fname, NULL, TRUE, (linenr_T)0, forceit); + + if (getfile_result == GETFILE_UNUSED) + /* Careful: getfile() may trigger autocommands and call jumpto_tag() + * recursively. */ + getfile_result = getfile(0, fname, NULL, TRUE, (linenr_T)0, forceit); keep_help_flag = FALSE; - if (getfile_result <= 0) /* got to the right file */ + if (GETFILE_SUCCESS(getfile_result)) /* got to the right file */ { curwin->w_set_curswant = TRUE; -#ifdef FEAT_WINDOWS postponed_split = 0; -#endif save_secure = secure; secure = 1; @@ -3250,7 +3323,7 @@ jumpto_tag(lbuf, forceit, keep_help) save_lnum = curwin->w_cursor.lnum; curwin->w_cursor.lnum = 0; /* start search before first line */ if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, - search_options, NULL)) + search_options, NULL, NULL)) retval = OK; else { @@ -3262,7 +3335,7 @@ jumpto_tag(lbuf, forceit, keep_help) */ p_ic = TRUE; if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1, - search_options, NULL)) + search_options, NULL, NULL)) { /* * Failed to find pattern, take a guess: "^func (" @@ -3273,13 +3346,13 @@ jumpto_tag(lbuf, forceit, keep_help) *tagp.tagname_end = NUL; sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname); if (!do_search(NULL, '/', pbuf, (long)1, - search_options, NULL)) + search_options, NULL, NULL)) { /* Guess again: "^char * \<func (" */ sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(", tagp.tagname); if (!do_search(NULL, '/', pbuf, (long)1, - search_options, NULL)) + search_options, NULL, NULL)) found = 0; } *tagp.tagname_end = cc; @@ -3336,13 +3409,11 @@ jumpto_tag(lbuf, forceit, keep_help) #ifdef FEAT_SEARCH_EXTRA /* restore no_hlsearch when keeping the old search pattern */ if (search_options) - { - SET_NO_HLSEARCH(save_no_hlsearch); - } + set_no_hlsearch(save_no_hlsearch); #endif /* Return OK if jumped to another file (at least we found the file!). */ - if (getfile_result == -1) + if (getfile_result == GETFILE_OPEN_OTHER) retval = OK; if (retval == OK) @@ -3359,7 +3430,7 @@ jumpto_tag(lbuf, forceit, keep_help) #endif } -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { @@ -3375,21 +3446,18 @@ jumpto_tag(lbuf, forceit, keep_help) else { --RedrawingDisabled; -#ifdef FEAT_WINDOWS if (postponed_split) /* close the window */ { win_close(curwin, FALSE); postponed_split = 0; } -#endif } erret: -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; /* For next time */ #endif - if (tagp.fname_end != NULL) - *tagp.fname_end = csave; + vim_free(lbuf); vim_free(pbuf); vim_free(tofree_fname); vim_free(full_fname); @@ -3404,10 +3472,7 @@ jumpto_tag(lbuf, forceit, keep_help) * Returns a pointer to allocated memory (or NULL when out of memory). */ static char_u * -expand_tag_fname(fname, tag_fname, expand) - char_u *fname; - char_u *tag_fname; - int expand; +expand_tag_fname(char_u *fname, char_u *tag_fname, int expand) { char_u *p; char_u *retval; @@ -3458,8 +3523,7 @@ expand_tag_fname(fname, tag_fname, expand) * length as that supplied, or shorter. */ void -simplify_filename(filename) - char_u *filename; +simplify_filename(char_u *filename) { #ifndef AMIGA /* Amiga doesn't have "..", it uses "/" */ int components = 0; @@ -3518,7 +3582,7 @@ simplify_filename(filename) tail = p + 1; if (p[1] != NUL) while (vim_ispathsep(*tail)) - mb_ptr_adv(tail); + MB_PTR_ADV(tail); else if (p > start) --p; /* strip preceding path separator */ STRMOVE(p, tail); @@ -3530,13 +3594,13 @@ simplify_filename(filename) /* Skip to after ".." or "../" or "..///". */ tail = p + 2; while (vim_ispathsep(*tail)) - mb_ptr_adv(tail); + MB_PTR_ADV(tail); if (components > 0) /* strip one preceding component */ { int do_strip = FALSE; char_u saved_char; - struct stat st; + stat_T st; /* Don't strip for an erroneous file name. */ if (!stripping_disabled) @@ -3557,7 +3621,7 @@ simplify_filename(filename) --p; /* Skip back to after previous '/'. */ while (p > start && !after_pathsep(start, p)) - mb_ptr_back(start, p); + MB_PTR_BACK(start, p); if (!do_strip) { @@ -3581,7 +3645,7 @@ simplify_filename(filename) #ifdef UNIX if (do_strip) { - struct stat new_st; + stat_T new_st; /* On Unix, the check for the unstripped file name * above works also for a symbolic link pointing to @@ -3671,16 +3735,14 @@ simplify_filename(filename) * file. */ static int +test_for_current( #ifdef FEAT_EMACS_TAGS -test_for_current(is_etag, fname, fname_end, tag_fname, buf_ffname) - int is_etag; -#else -test_for_current(fname, fname_end, tag_fname, buf_ffname) + int is_etag, #endif - char_u *fname; - char_u *fname_end; - char_u *tag_fname; - char_u *buf_ffname; + char_u *fname, + char_u *fname_end, + char_u *tag_fname, + char_u *buf_ffname) { int c; int retval = FALSE; @@ -3717,8 +3779,7 @@ test_for_current(fname, fname_end, tag_fname, buf_ffname) * Return OK if ";\"" is following, FAIL otherwise. */ static int -find_extra(pp) - char_u **pp; +find_extra(char_u **pp) { char_u *str = *pp; @@ -3753,11 +3814,11 @@ find_extra(pp) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) int -expand_tags(tagnames, pat, num_file, file) - int tagnames; /* expand tag names */ - char_u *pat; - int *num_file; - char_u ***file; +expand_tags( + int tagnames, /* expand tag names */ + char_u *pat, + int *num_file, + char_u ***file) { int i; int c; @@ -3802,18 +3863,18 @@ expand_tags(tagnames, pat, num_file, file) #endif #if defined(FEAT_EVAL) || defined(PROTO) -static int add_tag_field __ARGS((dict_T *dict, char *field_name, char_u *start, char_u *end)); +static int add_tag_field(dict_T *dict, char *field_name, char_u *start, char_u *end); /* * Add a tag field to the dictionary "dict". * Return OK or FAIL. */ static int -add_tag_field(dict, field_name, start, end) - dict_T *dict; - char *field_name; - char_u *start; /* start of the value */ - char_u *end; /* after the value; can be NULL */ +add_tag_field( + dict_T *dict, + char *field_name, + char_u *start, /* start of the value */ + char_u *end) /* after the value; can be NULL */ { char_u *buf; int len = 0; @@ -3853,13 +3914,11 @@ add_tag_field(dict, field_name, start, end) } /* - * Add the tags matching the specified pattern to the list "list" - * as a dictionary + * Add the tags matching the specified pattern "pat" to the list "list" + * as a dictionary. Use "buf_fname" for priority, unless NULL. */ int -get_tags(list, pat) - list_T *list; - char_u *pat; +get_tags(list_T *list, char_u *pat, char_u *buf_fname) { int num_matches, i, ret; char_u **matches, *p; @@ -3869,7 +3928,7 @@ get_tags(list, pat) long is_static; ret = find_tags(pat, &num_matches, &matches, - TAG_REGEXP | TAG_NOIC, (int)MAXCOL, NULL); + TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname); if (ret == OK && num_matches > 0) { for (i = 0; i < num_matches; ++i) @@ -3911,7 +3970,7 @@ get_tags(list, pat) else if (STRNCMP(p, "file:", 5) == 0) /* skip "file:" (static tag) */ p += 4; - else if (!vim_iswhite(*p)) + else if (!VIM_ISWHITE(*p)) { char_u *s, *n; int len; diff --git a/src/tee/Make_mvc.mak b/src/tee/Make_mvc.mak new file mode 100644 index 0000000000..950100d3c8 --- /dev/null +++ b/src/tee/Make_mvc.mak @@ -0,0 +1,19 @@ +# A very (if not the most) simplistic Makefile for MSVC + +SUBSYSTEM = console +!if "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) +!endif + +CC=cl +CFLAGS=/O2 /nologo + +tee.exe: tee.obj + $(CC) $(CFLAGS) /Fo$@ $** /link /subsystem:$(SUBSYSTEM) + +tee.obj: tee.c + $(CC) $(CFLAGS) /c $** + +clean: + - del tee.obj + - del tee.exe diff --git a/src/tee/tee.c b/src/tee/tee.c index 6c85766bbc..c668d2d1e3 100644 --- a/src/tee/tee.c +++ b/src/tee/tee.c @@ -4,6 +4,7 @@ * * Author: Paul Slootman * (paul@wurtel.hobby.nl, paul@murphy.nl, paulS@toecompst.nl) + * Modifications for MSVC: Yasuhiro Matsumoto * * This source code is released into the public domain. It is provided on an * as-is basis and no responsibility is accepted for its failure to perform @@ -26,9 +27,16 @@ * precompiled for OS/2. That one probably works better. */ -#include <unistd.h> +#ifndef _MSC_VER +# include <unistd.h> +#endif #include <malloc.h> #include <stdio.h> +#include <fcntl.h> + +#ifdef _WIN32 +# define sysconf(x) -1 +#endif void usage(void) { @@ -79,17 +87,17 @@ main(int argc, char *argv[]) int i; char buf[BUFSIZ]; int n; - extern int optind; + int optind = 1; - while ((opt = getopt(argc, argv, "a")) != EOF) + for (i = 1; i < argc; i++) { - switch (opt) - { - case 'a': append++; - break; - default: usage(); - exit(2); - } + if (argv[i][0] != '-') + break; + if (!strcmp(argv[i], "-a")) + append++; + else + usage(); + optind++; } numfiles = argc - optind; @@ -124,9 +132,9 @@ main(int argc, char *argv[]) exit(1); } } - _fsetmode(stdin, "b"); + setmode(fileno(stdin), O_BINARY); fflush(stdout); /* needed for _fsetmode(stdout) */ - _fsetmode(stdout, "b"); + setmode(fileno(stdout), O_BINARY); while ((n = myfread(buf, sizeof(char), sizeof(buf), stdin)) > 0) { diff --git a/src/term.c b/src/term.c index 95c29ccf48..882d983b9a 100644 --- a/src/term.c +++ b/src/term.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,7 +10,7 @@ * * term.c: functions for controlling the terminal * - * primitive termcap support for Amiga, MSDOS, and Win32 included + * primitive termcap support for Amiga and Win32 included * * NOTE: padding and variable substitution is not performed, * when compiling without HAVE_TGETENT, we use tputs() and tgoto() dummies. @@ -74,56 +74,78 @@ struct builtin_term /* start of keys that are not directly used by Vim but can be mapped */ #define BT_EXTRA_KEYS 0x101 -static struct builtin_term *find_builtin_term __ARGS((char_u *name)); -static void parse_builtin_tcap __ARGS((char_u *s)); -static void term_color __ARGS((char_u *s, int n)); -static void gather_termleader __ARGS((void)); +static struct builtin_term *find_builtin_term(char_u *name); +static void parse_builtin_tcap(char_u *s); +static void gather_termleader(void); #ifdef FEAT_TERMRESPONSE -static void req_codes_from_term __ARGS((void)); -static void req_more_codes_from_term __ARGS((void)); -static void got_code_from_term __ARGS((char_u *code, int len)); -static void check_for_codes_from_term __ARGS((void)); +static void req_codes_from_term(void); +static void req_more_codes_from_term(void); +static void got_code_from_term(char_u *code, int len); +static void check_for_codes_from_term(void); #endif #if defined(FEAT_GUI) \ || (defined(FEAT_MOUSE) && (!defined(UNIX) || defined(FEAT_MOUSE_XTERM) \ || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE))) -static int get_bytes_from_buf __ARGS((char_u *, char_u *, int)); +static int get_bytes_from_buf(char_u *, char_u *, int); #endif -static void del_termcode_idx __ARGS((int idx)); -static int term_is_builtin __ARGS((char_u *name)); -static int term_7to8bit __ARGS((char_u *p)); +static void del_termcode_idx(int idx); +static int term_is_builtin(char_u *name); +static int term_7to8bit(char_u *p); #ifdef FEAT_TERMRESPONSE -static void switch_to_8bit __ARGS((void)); +static void switch_to_8bit(void); #endif #ifdef HAVE_TGETENT -static char_u *tgetent_error __ARGS((char_u *, char_u *)); +static char_u *tgetent_error(char_u *, char_u *); /* * Here is our own prototype for tgetstr(), any prototypes from the include * files have been disabled by the define at the start of this file. */ -char *tgetstr __ARGS((char *, char **)); +char *tgetstr(char *, char **); # ifdef FEAT_TERMRESPONSE /* Change this to "if 1" to debug what happens with termresponse. */ # if 0 # define DEBUG_TERMRESPONSE - static void log_tr(char *msg); -# define LOG_TR(msg) log_tr(msg) +static void log_tr(const char *fmt, ...); +# define LOG_TR(msg) log_tr msg # else -# define LOG_TR(msg) +# define LOG_TR(msg) do { /**/ } while (0) # endif + +# define STATUS_GET 1 /* send request when switching to RAW mode */ +# define STATUS_SENT 2 /* did send request, waiting for response */ +# define STATUS_GOT 3 /* received response */ + /* Request Terminal Version status: */ -# define CRV_GET 1 /* send T_CRV when switched to RAW mode */ -# define CRV_SENT 2 /* did send T_CRV, waiting for answer */ -# define CRV_GOT 3 /* received T_CRV response */ -static int crv_status = CRV_GET; +static int crv_status = STATUS_GET; + /* Request Cursor position report: */ -# define U7_GET 1 /* send T_U7 when switched to RAW mode */ -# define U7_SENT 2 /* did send T_U7, waiting for answer */ -# define U7_GOT 3 /* received T_U7 response */ -static int u7_status = U7_GET; +static int u7_status = STATUS_GET; + +# ifdef FEAT_TERMINAL +/* Request foreground color report: */ +static int rfg_status = STATUS_GET; +static int fg_r = 0; +static int fg_g = 0; +static int fg_b = 0; +static int bg_r = 255; +static int bg_g = 255; +static int bg_b = 255; +# endif + +/* Request background color report: */ +static int rbg_status = STATUS_GET; + +/* Request cursor blinking mode report: */ +static int rbm_status = STATUS_GET; + +/* Request cursor style report: */ +static int rcs_status = STATUS_GET; + +/* Request windos position report: */ +static int winpos_status = STATUS_GET; # endif /* @@ -150,16 +172,24 @@ char *UP, *BC, PC; # define TGETSTR(s, p) vim_tgetstr((s), (p)) # define TGETENT(b, t) tgetent((char *)(b), (char *)(t)) -static char_u *vim_tgetstr __ARGS((char *s, char_u **pp)); +static char_u *vim_tgetstr(char *s, char_u **pp); #endif /* HAVE_TGETENT */ -#if defined(FEAT_TERMRESPONSE) -static int xt_index_in = 0; -static int xt_index_out = 0; -#endif - static int detected_8bit = FALSE; /* detected 8-bit terminal */ +#ifdef FEAT_TERMRESPONSE +/* When the cursor shape was detected these values are used: + * 1: block, 2: underline, 3: vertical bar */ +static int initial_cursor_shape = 0; + +/* The blink flag from the style response may be inverted from the actual + * blinking state, xterm XORs the flags. */ +static int initial_cursor_shape_blink = FALSE; + +/* The blink flag from the blinking-cursor mode response */ +static int initial_cursor_blink = FALSE; +#endif + static struct builtin_term builtin_termcaps[] = { @@ -179,15 +209,11 @@ static struct builtin_term builtin_termcaps[] = # ifdef TERMINFO {(int)KS_CDL, IF_EB("\033|%p1%dD", ESC_STR "|%p1%dD")}, {(int)KS_CS, IF_EB("\033|%p1%d;%p2%dR", ESC_STR "|%p1%d;%p2%dR")}, -# ifdef FEAT_VERTSPLIT {(int)KS_CSV, IF_EB("\033|%p1%d;%p2%dV", ESC_STR "|%p1%d;%p2%dV")}, -# endif # else {(int)KS_CDL, IF_EB("\033|%dD", ESC_STR "|%dD")}, {(int)KS_CS, IF_EB("\033|%d;%dR", ESC_STR "|%d;%dR")}, -# ifdef FEAT_VERTSPLIT {(int)KS_CSV, IF_EB("\033|%d;%dV", ESC_STR "|%d;%dV")}, -# endif # endif {(int)KS_CL, IF_EB("\033|C", ESC_STR "|C")}, /* attributes switched on with 'h', off with * 'H' */ @@ -200,11 +226,14 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_US, IF_EB("\033|8h", ESC_STR "|8h")}, /* HL_UNDERLINE */ {(int)KS_UCE, IF_EB("\033|8C", ESC_STR "|8C")}, /* HL_UNDERCURL */ {(int)KS_UCS, IF_EB("\033|8c", ESC_STR "|8c")}, /* HL_UNDERCURL */ + {(int)KS_STE, IF_EB("\033|4C", ESC_STR "|4C")}, /* HL_STRIKETHROUGH */ + {(int)KS_STS, IF_EB("\033|4c", ESC_STR "|4c")}, /* HL_STRIKETHROUGH */ {(int)KS_CZR, IF_EB("\033|4H", ESC_STR "|4H")}, /* HL_ITALIC */ {(int)KS_CZH, IF_EB("\033|4h", ESC_STR "|4h")}, /* HL_ITALIC */ {(int)KS_VB, IF_EB("\033|f", ESC_STR "|f")}, {(int)KS_MS, "y"}, {(int)KS_UT, "y"}, + {(int)KS_XN, "y"}, {(int)KS_LE, "\b"}, /* cursor-left = BS */ {(int)KS_ND, "\014"}, /* cursor-right = CTRL-L */ # ifdef TERMINFO @@ -381,9 +410,9 @@ static struct builtin_term builtin_termcaps[] = # else {(int)KS_CRI, "\033[%dC"}, # endif -#if defined(BEOS_DR8) +# if defined(BEOS_DR8) {(int)KS_DB, ""}, /* hack! see screen.c */ -#endif +# endif {K_UP, "\033[A"}, {K_DOWN, "\033[B"}, @@ -391,7 +420,7 @@ static struct builtin_term builtin_termcaps[] = {K_RIGHT, "\033[C"}, # endif -# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) +# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) /* * standard ANSI terminal, default for unix */ @@ -427,20 +456,16 @@ static struct builtin_term builtin_termcaps[] = # endif # endif -# if defined(MSDOS) || defined(ALL_BUILTIN_TCAPS) || defined(__EMX__) +# if defined(ALL_BUILTIN_TCAPS) /* * These codes are valid when nansi.sys or equivalent has been installed. * Function keys on a PC are preceded with a NUL. These are converted into * K_NUL '\316' in mch_inchar(), because we cannot handle NULs in key codes. * CTRL-arrow is used instead of SHIFT-arrow. */ -#ifdef __EMX__ - {(int)KS_NAME, "os2ansi"}, -#else {(int)KS_NAME, "pcansi"}, {(int)KS_DL, "\033[M"}, {(int)KS_AL, "\033[L"}, -#endif {(int)KS_CE, "\033[K"}, {(int)KS_CL, "\033[2J"}, {(int)KS_ME, "\033[0m"}, @@ -512,108 +537,7 @@ static struct builtin_term builtin_termcaps[] = {K_PAGEUP, "\316I"}, # endif -# if defined(MSDOS) -/* - * These codes are valid for the pc video. The entries that start with ESC | - * are translated into conio calls in os_msdos.c. Default for MSDOS. - */ - {(int)KS_NAME, "pcterm"}, - {(int)KS_CE, "\033|K"}, - {(int)KS_AL, "\033|L"}, - {(int)KS_DL, "\033|M"}, -# ifdef TERMINFO - {(int)KS_CS, "\033|%i%p1%d;%p2%dr"}, -# ifdef FEAT_VERTSPLIT - {(int)KS_CSV, "\033|%i%p1%d;%p2%dV"}, -# endif -# else - {(int)KS_CS, "\033|%i%d;%dr"}, -# ifdef FEAT_VERTSPLIT - {(int)KS_CSV, "\033|%i%d;%dV"}, -# endif -# endif - {(int)KS_CL, "\033|J"}, - {(int)KS_ME, "\033|0m"}, /* normal */ - {(int)KS_MR, "\033|112m"}, /* reverse: black on lightgrey */ - {(int)KS_MD, "\033|15m"}, /* bold: white text */ - {(int)KS_SE, "\033|0m"}, /* standout end */ - {(int)KS_SO, "\033|31m"}, /* standout: white on blue */ - {(int)KS_CZH, "\033|225m"}, /* italic mode: blue text on yellow */ - {(int)KS_CZR, "\033|0m"}, /* italic mode end */ - {(int)KS_US, "\033|67m"}, /* underscore mode: cyan text on red */ - {(int)KS_UE, "\033|0m"}, /* underscore mode end */ - {(int)KS_CCO, "16"}, /* allow 16 colors */ -# ifdef TERMINFO - {(int)KS_CAB, "\033|%p1%db"}, /* set background color */ - {(int)KS_CAF, "\033|%p1%df"}, /* set foreground color */ -# else - {(int)KS_CAB, "\033|%db"}, /* set background color */ - {(int)KS_CAF, "\033|%df"}, /* set foreground color */ -# endif - {(int)KS_MS, "y"}, - {(int)KS_UT, "y"}, - {(int)KS_LE, "\b"}, -# ifdef TERMINFO - {(int)KS_CM, "\033|%i%p1%d;%p2%dH"}, -# else - {(int)KS_CM, "\033|%i%d;%dH"}, -# endif -#ifdef DJGPP - {(int)KS_VB, "\033|B"}, /* visual bell */ -#endif - {K_UP, "\316H"}, - {K_DOWN, "\316P"}, - {K_LEFT, "\316K"}, - {K_RIGHT, "\316M"}, - {K_S_LEFT, "\316s"}, - {K_S_RIGHT, "\316t"}, - {K_S_TAB, "\316\017"}, - {K_F1, "\316;"}, - {K_F2, "\316<"}, - {K_F3, "\316="}, - {K_F4, "\316>"}, - {K_F5, "\316?"}, - {K_F6, "\316@"}, - {K_F7, "\316A"}, - {K_F8, "\316B"}, - {K_F9, "\316C"}, - {K_F10, "\316D"}, - {K_F11, "\316\205"}, - {K_F12, "\316\206"}, - {K_S_F1, "\316T"}, - {K_S_F2, "\316U"}, - {K_S_F3, "\316V"}, - {K_S_F4, "\316W"}, - {K_S_F5, "\316X"}, - {K_S_F6, "\316Y"}, - {K_S_F7, "\316Z"}, - {K_S_F8, "\316["}, - {K_S_F9, "\316\\"}, - {K_S_F10, "\316]"}, - {K_S_F11, "\316\207"}, - {K_S_F12, "\316\210"}, - {K_INS, "\316R"}, - {K_DEL, "\316S"}, - {K_HOME, "\316G"}, - {K_END, "\316O"}, - {K_PAGEDOWN, "\316Q"}, - {K_PAGEUP, "\316I"}, - {K_KPLUS, "\316N"}, - {K_KMINUS, "\316J"}, - {K_KMULTIPLY, "\3167"}, - {K_K0, "\316\332"}, - {K_K1, "\316\336"}, - {K_K2, "\316\342"}, - {K_K3, "\316\346"}, - {K_K4, "\316\352"}, - {K_K5, "\316\356"}, - {K_K6, "\316\362"}, - {K_K7, "\316\366"}, - {K_K8, "\316\372"}, - {K_K9, "\316\376"}, -# endif - -# if defined(WIN3264) || defined(ALL_BUILTIN_TCAPS) || defined(__EMX__) +# if defined(WIN3264) || defined(ALL_BUILTIN_TCAPS) /* * These codes are valid for the Win32 Console . The entries that start with * ESC | are translated into console calls in os_win32.c. The function keys @@ -663,6 +587,7 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_MS, "y"}, /* save to move cur in reverse mode */ {(int)KS_UT, "y"}, + {(int)KS_XN, "y"}, {(int)KS_LE, "\b"}, # ifdef TERMINFO {(int)KS_CM, "\033|%i%p1%d;%p2%dH"},/* cursor motion */ @@ -677,6 +602,10 @@ static struct builtin_term builtin_termcaps[] = # else {(int)KS_CS, "\033|%i%d;%dr"},/* scroll region */ # endif +# ifdef FEAT_TERMGUICOLORS + {(int)KS_8F, "\033|38;2;%lu;%lu;%lum"}, + {(int)KS_8B, "\033|48;2;%lu;%lu;%lum"}, +# endif {K_UP, "\316H"}, {K_DOWN, "\316P"}, @@ -777,6 +706,7 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_CSF, IF_EB("\033[101;%dm", ESC_STR "[101;%dm")}, /* set screen foreground color */ {(int)KS_MS, "y"}, {(int)KS_UT, "y"}, + {(int)KS_XN, "y"}, {(int)KS_LE, "\b"}, # ifdef TERMINFO {(int)KS_CM, IF_EB("\033[%i%p1%d;%p2%dH", @@ -834,28 +764,33 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_NAME, "vt52"}, {(int)KS_CE, IF_EB("\033K", ESC_STR "K")}, {(int)KS_CD, IF_EB("\033J", ESC_STR "J")}, +# ifdef TERMINFO + {(int)KS_CM, IF_EB("\033Y%p1%' '%+%c%p2%' '%+%c", + ESC_STR "Y%p1%' '%+%c%p2%' '%+%c")}, +# else {(int)KS_CM, IF_EB("\033Y%+ %+ ", ESC_STR "Y%+ %+ ")}, +# endif {(int)KS_LE, "\b"}, -# ifdef __MINT__ + {(int)KS_SR, IF_EB("\033I", ESC_STR "I")}, {(int)KS_AL, IF_EB("\033L", ESC_STR "L")}, {(int)KS_DL, IF_EB("\033M", ESC_STR "M")}, + {K_UP, IF_EB("\033A", ESC_STR "A")}, + {K_DOWN, IF_EB("\033B", ESC_STR "B")}, + {K_LEFT, IF_EB("\033D", ESC_STR "D")}, + {K_RIGHT, IF_EB("\033C", ESC_STR "C")}, + {K_F1, IF_EB("\033P", ESC_STR "P")}, + {K_F2, IF_EB("\033Q", ESC_STR "Q")}, + {K_F3, IF_EB("\033R", ESC_STR "R")}, +# ifdef __MINT__ {(int)KS_CL, IF_EB("\033E", ESC_STR "E")}, - {(int)KS_SR, IF_EB("\033I", ESC_STR "I")}, {(int)KS_VE, IF_EB("\033e", ESC_STR "e")}, {(int)KS_VI, IF_EB("\033f", ESC_STR "f")}, {(int)KS_SO, IF_EB("\033p", ESC_STR "p")}, {(int)KS_SE, IF_EB("\033q", ESC_STR "q")}, - {K_UP, IF_EB("\033A", ESC_STR "A")}, - {K_DOWN, IF_EB("\033B", ESC_STR "B")}, - {K_LEFT, IF_EB("\033D", ESC_STR "D")}, - {K_RIGHT, IF_EB("\033C", ESC_STR "C")}, {K_S_UP, IF_EB("\033a", ESC_STR "a")}, {K_S_DOWN, IF_EB("\033b", ESC_STR "b")}, {K_S_LEFT, IF_EB("\033d", ESC_STR "d")}, {K_S_RIGHT, IF_EB("\033c", ESC_STR "c")}, - {K_F1, IF_EB("\033P", ESC_STR "P")}, - {K_F2, IF_EB("\033Q", ESC_STR "Q")}, - {K_F3, IF_EB("\033R", ESC_STR "R")}, {K_F4, IF_EB("\033S", ESC_STR "S")}, {K_F5, IF_EB("\033T", ESC_STR "T")}, {K_F6, IF_EB("\033U", ESC_STR "U")}, @@ -878,16 +813,12 @@ static struct builtin_term builtin_termcaps[] = {K_PAGEDOWN, IF_EB("\033b", ESC_STR "b")}, {K_PAGEUP, IF_EB("\033a", ESC_STR "a")}, # else - {(int)KS_AL, IF_EB("\033T", ESC_STR "T")}, - {(int)KS_DL, IF_EB("\033U", ESC_STR "U")}, {(int)KS_CL, IF_EB("\033H\033J", ESC_STR "H" ESC_STR_nc "J")}, - {(int)KS_ME, IF_EB("\033SO", ESC_STR "SO")}, - {(int)KS_MR, IF_EB("\033S2", ESC_STR "S2")}, {(int)KS_MS, "y"}, # endif # endif -# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) +# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) {(int)KS_NAME, "xterm"}, {(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")}, {(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")}, @@ -915,9 +846,22 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_MD, IF_EB("\033[1m", ESC_STR "[1m")}, {(int)KS_UE, IF_EB("\033[m", ESC_STR "[m")}, {(int)KS_US, IF_EB("\033[4m", ESC_STR "[4m")}, + {(int)KS_STE, IF_EB("\033[29m", ESC_STR "[29m")}, + {(int)KS_STS, IF_EB("\033[9m", ESC_STR "[9m")}, {(int)KS_MS, "y"}, {(int)KS_UT, "y"}, {(int)KS_LE, "\b"}, + {(int)KS_VI, IF_EB("\033[?25l", ESC_STR "[?25l")}, + {(int)KS_VE, IF_EB("\033[?25h", ESC_STR "[?25h")}, + {(int)KS_VS, IF_EB("\033[?12h", ESC_STR "[?12h")}, + {(int)KS_CVS, IF_EB("\033[?12l", ESC_STR "[?12l")}, +# ifdef TERMINFO + {(int)KS_CSH, IF_EB("\033[%p1%d q", ESC_STR "[%p1%d q")}, +# else + {(int)KS_CSH, IF_EB("\033[%d q", ESC_STR "[%d q")}, +# endif + {(int)KS_CRC, IF_EB("\033[?12$p", ESC_STR "[?12$p")}, + {(int)KS_CRS, IF_EB("\033P$q q\033\\", ESC_STR "P$q q" ESC_STR "\\")}, # ifdef TERMINFO {(int)KS_CM, IF_EB("\033[%i%p1%d;%p2%dH", ESC_STR "[%i%p1%d;%p2%dH")}, @@ -941,17 +885,30 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_CIE, "\007"}, {(int)KS_TS, IF_EB("\033]2;", ESC_STR "]2;")}, {(int)KS_FS, "\007"}, + {(int)KS_CSC, IF_EB("\033]12;", ESC_STR "]12;")}, + {(int)KS_CEC, "\007"}, # ifdef TERMINFO {(int)KS_CWS, IF_EB("\033[8;%p1%d;%p2%dt", ESC_STR "[8;%p1%d;%p2%dt")}, {(int)KS_CWP, IF_EB("\033[3;%p1%d;%p2%dt", ESC_STR "[3;%p1%d;%p2%dt")}, + {(int)KS_CGP, IF_EB("\033[13t", ESC_STR "[13t")}, # else {(int)KS_CWS, IF_EB("\033[8;%d;%dt", ESC_STR "[8;%d;%dt")}, {(int)KS_CWP, IF_EB("\033[3;%d;%dt", ESC_STR "[3;%d;%dt")}, + {(int)KS_CGP, IF_EB("\033[13t", ESC_STR "[13t")}, # endif {(int)KS_CRV, IF_EB("\033[>c", ESC_STR "[>c")}, + {(int)KS_RFG, IF_EB("\033]10;?\007", ESC_STR "]10;?\007")}, + {(int)KS_RBG, IF_EB("\033]11;?\007", ESC_STR "]11;?\007")}, {(int)KS_U7, IF_EB("\033[6n", ESC_STR "[6n")}, +# ifdef FEAT_TERMGUICOLORS + /* These are printf strings, not terminal codes. */ + {(int)KS_8F, IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")}, + {(int)KS_8B, IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")}, +# endif + {(int)KS_CBE, IF_EB("\033[?2004h", ESC_STR "[?2004h")}, + {(int)KS_CBD, IF_EB("\033[?2004l", ESC_STR "[?2004l")}, {K_UP, IF_EB("\033O*A", ESC_STR "O*A")}, {K_DOWN, IF_EB("\033O*B", ESC_STR "O*B")}, @@ -997,13 +954,15 @@ static struct builtin_term builtin_termcaps[] = {K_ZEND, IF_EB("\033[8;*~", ESC_STR "[8;*~")}, {K_PAGEUP, IF_EB("\033[5;*~", ESC_STR "[5;*~")}, {K_PAGEDOWN, IF_EB("\033[6;*~", ESC_STR "[6;*~")}, - {K_KPLUS, IF_EB("\033O*k", ESC_STR "O*k")}, /* keypad plus */ - {K_KMINUS, IF_EB("\033O*m", ESC_STR "O*m")}, /* keypad minus */ - {K_KDIVIDE, IF_EB("\033O*o", ESC_STR "O*o")}, /* keypad / */ - {K_KMULTIPLY, IF_EB("\033O*j", ESC_STR "O*j")}, /* keypad * */ - {K_KENTER, IF_EB("\033O*M", ESC_STR "O*M")}, /* keypad Enter */ - {K_KPOINT, IF_EB("\033O*n", ESC_STR "O*n")}, /* keypad . */ - {K_KDEL, IF_EB("\033[3;*~", ESC_STR "[3;*~")}, /* keypad Del */ + {K_KPLUS, IF_EB("\033O*k", ESC_STR "O*k")}, /* keypad plus */ + {K_KMINUS, IF_EB("\033O*m", ESC_STR "O*m")}, /* keypad minus */ + {K_KDIVIDE, IF_EB("\033O*o", ESC_STR "O*o")}, /* keypad / */ + {K_KMULTIPLY, IF_EB("\033O*j", ESC_STR "O*j")}, /* keypad * */ + {K_KENTER, IF_EB("\033O*M", ESC_STR "O*M")}, /* keypad Enter */ + {K_KPOINT, IF_EB("\033O*n", ESC_STR "O*n")}, /* keypad . */ + {K_KDEL, IF_EB("\033[3;*~", ESC_STR "[3;*~")}, /* keypad Del */ + {K_PS, IF_EB("\033[200~", ESC_STR "[200~")}, /* paste start */ + {K_PE, IF_EB("\033[201~", ESC_STR "[201~")}, /* paste end */ {BT_EXTRA_KEYS, ""}, {TERMCAP2KEY('k', '0'), IF_EB("\033[10;*~", ESC_STR "[10;*~")}, /* F0 */ @@ -1176,12 +1135,10 @@ static struct builtin_term builtin_termcaps[] = # else {(int)KS_CS, "[%dCS%d]"}, # endif -# ifdef FEAT_VERTSPLIT -# ifdef TERMINFO +# ifdef TERMINFO {(int)KS_CSV, "[%p1%dCSV%p2%d]"}, -# else +# else {(int)KS_CSV, "[%dCSV%d]"}, -# endif # endif # ifdef TERMINFO {(int)KS_CAB, "[CAB%p1%d]"}, @@ -1210,8 +1167,11 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_US, "[US]"}, {(int)KS_UCE, "[UCE]"}, {(int)KS_UCS, "[UCS]"}, + {(int)KS_STE, "[STE]"}, + {(int)KS_STS, "[STS]"}, {(int)KS_MS, "[MS]"}, {(int)KS_UT, "[UT]"}, + {(int)KS_XN, "[XN]"}, # ifdef TERMINFO {(int)KS_CM, "[%p1%dCM%p2%d]"}, # else @@ -1230,6 +1190,8 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_TE, "[TE]"}, {(int)KS_CIS, "[CIS]"}, {(int)KS_CIE, "[CIE]"}, + {(int)KS_CSC, "[CSC]"}, + {(int)KS_CEC, "[CEC]"}, {(int)KS_TS, "[TS]"}, {(int)KS_FS, "[FS]"}, # ifdef TERMINFO @@ -1241,6 +1203,8 @@ static struct builtin_term builtin_termcaps[] = # endif {(int)KS_CRV, "[CRV]"}, {(int)KS_U7, "[U7]"}, + {(int)KS_RFG, "[RFG]"}, + {(int)KS_RBG, "[RBG]"}, {K_UP, "[KU]"}, {K_DOWN, "[KD]"}, {K_LEFT, "[KL]"}, @@ -1317,6 +1281,8 @@ static struct builtin_term builtin_termcaps[] = {K_KMULTIPLY, "[KMULTIPLY]"}, {K_KENTER, "[KENTER]"}, {K_KPOINT, "[KPOINT]"}, + {K_PS, "[PASTE-START]"}, + {K_PE, "[PASTE-END]"}, {K_K0, "[K0]"}, {K_K1, "[K1]"}, {K_K2, "[K2]"}, @@ -1351,6 +1317,40 @@ static struct builtin_term builtin_termcaps[] = }; /* end of builtin_termcaps */ +#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) + guicolor_T +termgui_mch_get_color(char_u *name) +{ +# if defined(FEAT_GUI_MACVIM) + guicolor_T t; + t = gui_mch_get_color(name); + if (t != INVALCOLOR) + return t; +# endif + return gui_get_color_cmn(name); +} + + guicolor_T +termgui_get_color(char_u *name) +{ + guicolor_T t; + + if (*name == NUL) + return INVALCOLOR; + t = termgui_mch_get_color(name); + + if (t == INVALCOLOR) + EMSG2(_("E254: Cannot allocate color %s"), name); + return t; +} + + guicolor_T +termgui_mch_get_rgb(guicolor_T color) +{ + return color; +} +#endif + /* * DEFAULT_TERM is used, when no terminal is specified with -T option or $TERM. */ @@ -1362,10 +1362,6 @@ static struct builtin_term builtin_termcaps[] = # define DEFAULT_TERM (char_u *)"win32" #endif -#ifdef MSDOS -# define DEFAULT_TERM (char_u *)"pcterm" -#endif - #if defined(UNIX) && !defined(__MINT__) # define DEFAULT_TERM (char_u *)"ansi" #endif @@ -1374,10 +1370,6 @@ static struct builtin_term builtin_termcaps[] = # define DEFAULT_TERM (char_u *)"vt52" #endif -#ifdef __EMX__ -# define DEFAULT_TERM (char_u *)"os2ansi" -#endif - #ifdef VMS # define DEFAULT_TERM (char_u *)"vt320" #endif @@ -1402,11 +1394,11 @@ static int need_gather = FALSE; /* need to fill termleader[] */ static char_u termleader[256 + 1]; /* for check_termcode() */ #ifdef FEAT_TERMRESPONSE static int check_for_codes = FALSE; /* check for key code response */ +static int is_not_xterm = FALSE; /* recognized not-really-xterm */ #endif static struct builtin_term * -find_builtin_term(term) - char_u *term; +find_builtin_term(char_u *term) { struct builtin_term *p; @@ -1441,8 +1433,7 @@ find_builtin_term(term) * The terminal's name is not set, as this is already done in termcapinit(). */ static void -parse_builtin_tcap(term) - char_u *term; +parse_builtin_tcap(char_u *term) { struct builtin_term *p; char_u name[2]; @@ -1494,8 +1485,6 @@ parse_builtin_tcap(term) } } } -#if defined(HAVE_TGETENT) || defined(FEAT_TERMRESPONSE) -static void set_color_count __ARGS((int nr)); /* * Set number of colors. @@ -1503,8 +1492,7 @@ static void set_color_count __ARGS((int nr)); * Store it as a string in T_CCO (using nr_colors[]). */ static void -set_color_count(nr) - int nr; +set_color_count(int nr) { char_u nr_colors[20]; /* string for number of colors */ @@ -1515,6 +1503,34 @@ set_color_count(nr) *nr_colors = NUL; set_string_option_direct((char_u *)"t_Co", -1, nr_colors, OPT_FREE, 0); } + +#if defined(FEAT_TERMRESPONSE) +/* + * Set the color count to "val" and redraw if it changed. + */ + static void +may_adjust_color_count(int val) +{ + if (val != t_colors) + { + /* Nr of colors changed, initialize highlighting and + * redraw everything. This causes a redraw, which usually + * clears the message. Try keeping the message if it + * might work. */ + set_keep_msg_from_hist(); + set_color_count(val); + init_highlight(TRUE, FALSE); +# ifdef DEBUG_TERMRESPONSE + { + int r = redraw_asap(CLEAR); + + log_tr("Received t_Co, redraw_asap(): %d", r); + } +#else + redraw_asap(CLEAR); +#endif + } +} #endif #ifdef HAVE_TGETENT @@ -1525,9 +1541,6 @@ static char *(key_names[]) = "Co", #endif "ku", "kd", "kr", "kl", -# ifdef ARCHIE - "su", "sd", /* Termcap code made up! */ -# endif "#2", "#4", "%i", "*7", "k1", "k2", "k3", "k4", "k5", "k6", "k7", "k8", "k9", "k;", "F1", "F2", @@ -1537,6 +1550,152 @@ static char *(key_names[]) = }; #endif +#ifdef HAVE_TGETENT + static void +get_term_entries(int *height, int *width) +{ + static struct { + enum SpecialKey dest; /* index in term_strings[] */ + char *name; /* termcap name for string */ + } string_names[] = + { {KS_CE, "ce"}, {KS_AL, "al"}, {KS_CAL,"AL"}, + {KS_DL, "dl"}, {KS_CDL,"DL"}, {KS_CS, "cs"}, + {KS_CL, "cl"}, {KS_CD, "cd"}, + {KS_VI, "vi"}, {KS_VE, "ve"}, {KS_MB, "mb"}, + {KS_ME, "me"}, {KS_MR, "mr"}, + {KS_MD, "md"}, {KS_SE, "se"}, {KS_SO, "so"}, + {KS_CZH,"ZH"}, {KS_CZR,"ZR"}, {KS_UE, "ue"}, + {KS_US, "us"}, {KS_UCE, "Ce"}, {KS_UCS, "Cs"}, + {KS_STE,"Te"}, {KS_STS,"Ts"}, + {KS_CM, "cm"}, {KS_SR, "sr"}, + {KS_CRI,"RI"}, {KS_VB, "vb"}, {KS_KS, "ks"}, + {KS_KE, "ke"}, {KS_TI, "ti"}, {KS_TE, "te"}, + {KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"}, + {KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_LE, "le"}, + {KS_ND, "nd"}, {KS_OP, "op"}, {KS_CRV, "RV"}, + {KS_VS, "vs"}, {KS_CVS, "VS"}, + {KS_CIS, "IS"}, {KS_CIE, "IE"}, + {KS_CSC, "SC"}, {KS_CEC, "EC"}, + {KS_TS, "ts"}, {KS_FS, "fs"}, + {KS_CWP, "WP"}, {KS_CWS, "WS"}, + {KS_CSI, "SI"}, {KS_CEI, "EI"}, + {KS_U7, "u7"}, {KS_RFG, "RF"}, {KS_RBG, "RB"}, + {KS_8F, "8f"}, {KS_8B, "8b"}, + {KS_CBE, "BE"}, {KS_CBD, "BD"}, + {KS_CPS, "PS"}, {KS_CPE, "PE"}, + {(enum SpecialKey)0, NULL} + }; + int i; + char_u *p; + static char_u tstrbuf[TBUFSZ]; + char_u *tp = tstrbuf; + + /* + * get output strings + */ + for (i = 0; string_names[i].name != NULL; ++i) + { + if (TERM_STR(string_names[i].dest) == NULL + || TERM_STR(string_names[i].dest) == empty_option) + TERM_STR(string_names[i].dest) = TGETSTR(string_names[i].name, &tp); + } + + /* tgetflag() returns 1 if the flag is present, 0 if not and + * possibly -1 if the flag doesn't exist. */ + if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms") > 0) + T_MS = (char_u *)"y"; + if ((T_XS == NULL || T_XS == empty_option) && tgetflag("xs") > 0) + T_XS = (char_u *)"y"; + if ((T_XN == NULL || T_XN == empty_option) && tgetflag("xn") > 0) + T_XN = (char_u *)"y"; + if ((T_DB == NULL || T_DB == empty_option) && tgetflag("db") > 0) + T_DB = (char_u *)"y"; + if ((T_DA == NULL || T_DA == empty_option) && tgetflag("da") > 0) + T_DA = (char_u *)"y"; + if ((T_UT == NULL || T_UT == empty_option) && tgetflag("ut") > 0) + T_UT = (char_u *)"y"; + + /* + * get key codes + */ + for (i = 0; key_names[i] != NULL; ++i) + if (find_termcode((char_u *)key_names[i]) == NULL) + { + p = TGETSTR(key_names[i], &tp); + /* if cursor-left == backspace, ignore it (televideo 925) */ + if (p != NULL + && (*p != Ctrl_H + || key_names[i][0] != 'k' + || key_names[i][1] != 'l')) + add_termcode((char_u *)key_names[i], p, FALSE); + } + + if (*height == 0) + *height = tgetnum("li"); + if (*width == 0) + *width = tgetnum("co"); + + /* + * Get number of colors (if not done already). + */ + if (TERM_STR(KS_CCO) == NULL || TERM_STR(KS_CCO) == empty_option) + set_color_count(tgetnum("Co")); + +# ifndef hpux + BC = (char *)TGETSTR("bc", &tp); + UP = (char *)TGETSTR("up", &tp); + p = TGETSTR("pc", &tp); + if (p) + PC = *p; +# endif +} +#endif + + static void +report_term_error(char_u *error_msg, char_u *term) +{ + struct builtin_term *termp; + + mch_errmsg("\r\n"); + if (error_msg != NULL) + { + mch_errmsg((char *)error_msg); + mch_errmsg("\r\n"); + } + mch_errmsg("'"); + mch_errmsg((char *)term); + mch_errmsg(_("' not known. Available builtin terminals are:")); + mch_errmsg("\r\n"); + for (termp = &(builtin_termcaps[0]); termp->bt_string != NULL; ++termp) + { + if (termp->bt_entry == (int)KS_NAME) + { +#ifdef HAVE_TGETENT + mch_errmsg(" builtin_"); +#else + mch_errmsg(" "); +#endif + mch_errmsg(termp->bt_string); + mch_errmsg("\r\n"); + } + } +} + + static void +report_default_term(char_u *term) +{ + mch_errmsg(_("defaulting to '")); + mch_errmsg((char *)term); + mch_errmsg("'\r\n"); + if (emsg_silent == 0) + { + screen_start(); /* don't know where cursor is now */ + out_flush(); + if (!is_not_a_term()) + ui_delay(2000L, TRUE); + } +} + /* * Set terminal options for terminal "term". * Return OK if terminal 'term' was found in a termcap, FAIL otherwise. @@ -1544,8 +1703,7 @@ static char *(key_names[]) = * While doing this, until ttest(), some options may be NULL, be careful. */ int -set_termname(term) - char_u *term; +set_termname(char_u *term) { struct builtin_term *termp; #ifdef HAVE_TGETENT @@ -1589,36 +1747,7 @@ set_termname(term) */ if (try == 1) { - char_u *p; - static char_u tstrbuf[TBUFSZ]; - int i; char_u tbuf[TBUFSZ]; - char_u *tp; - static struct { - enum SpecialKey dest; /* index in term_strings[] */ - char *name; /* termcap name for string */ - } string_names[] = - { {KS_CE, "ce"}, {KS_AL, "al"}, {KS_CAL,"AL"}, - {KS_DL, "dl"}, {KS_CDL,"DL"}, {KS_CS, "cs"}, - {KS_CL, "cl"}, {KS_CD, "cd"}, - {KS_VI, "vi"}, {KS_VE, "ve"}, {KS_MB, "mb"}, - {KS_VS, "vs"}, {KS_ME, "me"}, {KS_MR, "mr"}, - {KS_MD, "md"}, {KS_SE, "se"}, {KS_SO, "so"}, - {KS_CZH,"ZH"}, {KS_CZR,"ZR"}, {KS_UE, "ue"}, - {KS_US, "us"}, {KS_UCE, "Ce"}, {KS_UCS, "Cs"}, - {KS_CM, "cm"}, {KS_SR, "sr"}, - {KS_CRI,"RI"}, {KS_VB, "vb"}, {KS_KS, "ks"}, - {KS_KE, "ke"}, {KS_TI, "ti"}, {KS_TE, "te"}, - {KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"}, - {KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_LE, "le"}, - {KS_ND, "nd"}, {KS_OP, "op"}, {KS_CRV, "RV"}, - {KS_CIS, "IS"}, {KS_CIE, "IE"}, - {KS_TS, "ts"}, {KS_FS, "fs"}, - {KS_CWP, "WP"}, {KS_CWS, "WS"}, - {KS_CSI, "SI"}, {KS_CEI, "EI"}, - {KS_U7, "u7"}, - {(enum SpecialKey)0, NULL} - }; /* * If the external termcap does not have a matching entry, try the @@ -1626,78 +1755,13 @@ set_termname(term) */ if ((error_msg = tgetent_error(tbuf, term)) == NULL) { - tp = tstrbuf; if (!termcap_cleared) { clear_termoptions(); /* clear old options */ termcap_cleared = TRUE; } - /* get output strings */ - for (i = 0; string_names[i].name != NULL; ++i) - { - if (term_str(string_names[i].dest) == NULL - || term_str(string_names[i].dest) == empty_option) - term_str(string_names[i].dest) = - TGETSTR(string_names[i].name, &tp); - } - - /* tgetflag() returns 1 if the flag is present, 0 if not and - * possibly -1 if the flag doesn't exist. */ - if ((T_MS == NULL || T_MS == empty_option) - && tgetflag("ms") > 0) - T_MS = (char_u *)"y"; - if ((T_XS == NULL || T_XS == empty_option) - && tgetflag("xs") > 0) - T_XS = (char_u *)"y"; - if ((T_DB == NULL || T_DB == empty_option) - && tgetflag("db") > 0) - T_DB = (char_u *)"y"; - if ((T_DA == NULL || T_DA == empty_option) - && tgetflag("da") > 0) - T_DA = (char_u *)"y"; - if ((T_UT == NULL || T_UT == empty_option) - && tgetflag("ut") > 0) - T_UT = (char_u *)"y"; - - - /* - * get key codes - */ - for (i = 0; key_names[i] != NULL; ++i) - { - if (find_termcode((char_u *)key_names[i]) == NULL) - { - p = TGETSTR(key_names[i], &tp); - /* if cursor-left == backspace, ignore it (televideo - * 925) */ - if (p != NULL - && (*p != Ctrl_H - || key_names[i][0] != 'k' - || key_names[i][1] != 'l')) - add_termcode((char_u *)key_names[i], p, FALSE); - } - } - - if (height == 0) - height = tgetnum("li"); - if (width == 0) - width = tgetnum("co"); - - /* - * Get number of colors (if not done already). - */ - if (term_str(KS_CCO) == NULL - || term_str(KS_CCO) == empty_option) - set_color_count(tgetnum("Co")); - -# ifndef hpux - BC = (char *)TGETSTR("bc", &tp); - UP = (char *)TGETSTR("up", &tp); - p = TGETSTR("pc", &tp); - if (p) - PC = *p; -# endif /* hpux */ + get_term_entries(&height, &width); } } else /* try == 0 || try == 2 */ @@ -1733,31 +1797,8 @@ set_termname(term) if (termcap_cleared) /* found in external termcap */ break; #endif + report_term_error(error_msg, term); - mch_errmsg("\r\n"); - if (error_msg != NULL) - { - mch_errmsg((char *)error_msg); - mch_errmsg("\r\n"); - } - mch_errmsg("'"); - mch_errmsg((char *)term); - mch_errmsg(_("' not known. Available builtin terminals are:")); - mch_errmsg("\r\n"); - for (termp = &(builtin_termcaps[0]); termp->bt_string != NULL; - ++termp) - { - if (termp->bt_entry == (int)KS_NAME) - { -#ifdef HAVE_TGETENT - mch_errmsg(" builtin_"); -#else - mch_errmsg(" "); -#endif - mch_errmsg(termp->bt_string); - mch_errmsg("\r\n"); - } - } /* when user typed :set term=xxx, quit here */ if (starting != NO_SCREEN) { @@ -1766,15 +1807,7 @@ set_termname(term) return FAIL; } term = DEFAULT_TERM; - mch_errmsg(_("defaulting to '")); - mch_errmsg((char *)term); - mch_errmsg("'\r\n"); - if (emsg_silent == 0) - { - screen_start(); /* don't know where cursor is now */ - out_flush(); - ui_delay(2000L, TRUE); - } + report_default_term(term); set_string_option_direct((char_u *)"term", -1, term, OPT_FREE, 0); display_errors(); @@ -1827,9 +1860,9 @@ set_termname(term) * is being used. * Don't do this when the GUI is active, it uses "t_kb" and "t_kD" directly. */ -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (!gui.in_use) -#endif +# endif get_stty(); #endif @@ -1866,18 +1899,9 @@ set_termname(term) * The termcode for the mouse is added as a side effect in option.c. */ { - char_u *p; + char_u *p = (char_u *)""; - p = (char_u *)""; # ifdef FEAT_MOUSE_XTERM -# ifdef FEAT_CLIPBOARD -# ifdef FEAT_GUI - if (!gui.in_use) -# endif -# ifndef FEAT_CYGWIN_WIN32_CLIPBOARD - clip_init(FALSE); -# endif -# endif if (use_xterm_like_mouse(term)) { if (use_xterm_mouse()) @@ -1906,16 +1930,6 @@ set_termname(term) # endif #endif /* FEAT_MOUSE */ -#ifdef FEAT_SNIFF - { - char_u name[2]; - - name[0] = (int)KS_EXTRA; - name[1] = (int)KE_SNIFF; - add_termcode(name, (char_u *)"\233sniff", FALSE); - } -#endif - #ifdef USE_TERM_CONSOLE /* DEFAULT_TERM indicates that it is the machine console. */ if (STRCMP(term, DEFAULT_TERM) != 0) @@ -1949,8 +1963,8 @@ set_termname(term) full_screen = TRUE; /* we can use termcap codes from now on */ set_term_defaults(); /* use current values as defaults */ #ifdef FEAT_TERMRESPONSE - LOG_TR("setting crv_status to CRV_GET"); - crv_status = CRV_GET; /* Get terminal version later */ + LOG_TR(("setting crv_status to STATUS_GET")); + crv_status = STATUS_GET; /* Get terminal version later */ #endif /* @@ -1976,7 +1990,7 @@ set_termname(term) /* termcap failed to report size */ /* set defaults, in case ui_get_shellsize() also fails */ width = 80; -#if defined(MSDOS) || defined(WIN3264) +#if defined(WIN3264) height = 25; /* console is often 25 lines */ #else height = 24; /* most terminals are 24 lines */ @@ -1989,25 +2003,23 @@ set_termname(term) scroll_region_reset(); /* In case Rows changed */ check_map_keycodes(); /* check mappings for terminal codes used */ -#ifdef FEAT_AUTOCMD { - buf_T *old_curbuf; + bufref_T old_curbuf; /* * Execute the TermChanged autocommands for each buffer that is * loaded. */ - old_curbuf = curbuf; - for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) + set_bufref(&old_curbuf, curbuf); + FOR_ALL_BUFFERS(curbuf) { if (curbuf->b_ml.ml_mfp != NULL) apply_autocmds(EVENT_TERMCHANGED, NULL, NULL, FALSE, curbuf); } - if (buf_valid(old_curbuf)) - curbuf = old_curbuf; + if (bufref_valid(&old_curbuf)) + curbuf = old_curbuf.br_buf; } -#endif } #ifdef FEAT_TERMRESPONSE @@ -2027,14 +2039,15 @@ set_termname(term) # define HMT_PTERM 16 # define HMT_URXVT 32 # define HMT_SGR 64 +# define HMT_SGR_REL 128 static int has_mouse_termcode = 0; # endif # if (!defined(UNIX) || defined(FEAT_MOUSE_TTY)) || defined(PROTO) void -set_mouse_termcode(n, s) - int n; /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */ - char_u *s; +set_mouse_termcode( + int n, /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */ + char_u *s) { char_u name[2]; @@ -2070,6 +2083,8 @@ set_mouse_termcode(n, s) # ifdef FEAT_MOUSE_SGR if (n == KS_SGR_MOUSE) has_mouse_termcode |= HMT_SGR; + else if (n == KS_SGR_MOUSE_RELEASE) + has_mouse_termcode |= HMT_SGR_REL; else # endif has_mouse_termcode |= HMT_NORMAL; @@ -2077,11 +2092,11 @@ set_mouse_termcode(n, s) } # endif -# if ((defined(UNIX) || defined(VMS) || defined(OS2)) \ +# if ((defined(UNIX) || defined(VMS)) \ && defined(FEAT_MOUSE_TTY)) || defined(PROTO) void -del_mouse_termcode(n) - int n; /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */ +del_mouse_termcode( + int n) /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */ { char_u name[2]; @@ -2117,6 +2132,8 @@ del_mouse_termcode(n) # ifdef FEAT_MOUSE_SGR if (n == KS_SGR_MOUSE) has_mouse_termcode &= ~HMT_SGR; + else if (n == KS_SGR_MOUSE_RELEASE) + has_mouse_termcode &= ~HMT_SGR_REL; else # endif has_mouse_termcode &= ~HMT_NORMAL; @@ -2131,9 +2148,7 @@ del_mouse_termcode(n) * Return error message if it fails, NULL if it's OK. */ static char_u * -tgetent_error(tbuf, term) - char_u *tbuf; - char_u *term; +tgetent_error(char_u *tbuf, char_u *term) { int i; @@ -2168,9 +2183,7 @@ tgetent_error(tbuf, term) * Fix that here. */ static char_u * -vim_tgetstr(s, pp) - char *s; - char_u **pp; +vim_tgetstr(char *s, char_u **pp) { char *p; @@ -2181,7 +2194,7 @@ vim_tgetstr(s, pp) } #endif /* HAVE_TGETENT */ -#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(__EMX__) || defined(VMS) || defined(MACOS_X)) +#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(VMS) || defined(MACOS_X)) /* * Get Columns and Rows from the termcap. Used after a window signal if the * ioctl() fails. It doesn't make sense to call tgetent each time if the "co" @@ -2189,9 +2202,9 @@ vim_tgetstr(s, pp) * Errors while getting the entries are ignored. */ void -getlinecol(cp, rp) - long *cp; /* pointer to columns */ - long *rp; /* pointer to rows */ +getlinecol( + long *cp, /* pointer to columns */ + long *rp) /* pointer to rows */ { char_u tbuf[TBUFSZ]; @@ -2213,9 +2226,7 @@ getlinecol(cp, rp) * Return FAIL if the entry was not found, OK if the entry was added. */ int -add_termcap_entry(name, force) - char_u *name; - int force; +add_termcap_entry(char_u *name, int force) { char_u *term; int key; @@ -2267,7 +2278,7 @@ add_termcap_entry(name, force) */ for (i = 0; i < 2; ++i) { - if (!builtin_first == i) + if ((!builtin_first) == i) #endif /* * Search in builtin termcap @@ -2277,6 +2288,7 @@ add_termcap_entry(name, force) if (termp->bt_string != NULL) /* found it */ { key = TERMCAP2KEY(name[0], name[1]); + ++termp; while (termp->bt_entry != (int)KS_NAME) { if ((int)termp->bt_entry == key) @@ -2322,8 +2334,7 @@ add_termcap_entry(name, force) } static int -term_is_builtin(name) - char_u *name; +term_is_builtin(char_u *name) { return (STRNCMP(name, "builtin_", (size_t)8) == 0); } @@ -2334,38 +2345,35 @@ term_is_builtin(name) * "8bit", like in "xterm-8bit". */ int -term_is_8bit(name) - char_u *name; +term_is_8bit(char_u *name) { return (detected_8bit || strstr((char *)name, "8bit") != NULL); } /* * Translate terminal control chars from 7-bit to 8-bit: - * <Esc>[ -> CSI - * <Esc>] -> <M-C-]> + * <Esc>[ -> CSI <M_C_[> + * <Esc>] -> OSC <M-C-]> * <Esc>O -> <M-C-O> */ static int -term_7to8bit(p) - char_u *p; +term_7to8bit(char_u *p) { if (*p == ESC) { if (p[1] == '[') return CSI; if (p[1] == ']') - return 0x9d; + return OSC; if (p[1] == 'O') return 0x8f; } return 0; } -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(PROTO) int -term_is_gui(name) - char_u *name; +term_is_gui(char_u *name) { return (STRCMP(name, "builtin_gui") == 0 || STRCMP(name, "gui") == 0); } @@ -2374,8 +2382,7 @@ term_is_gui(name) #if !defined(HAVE_TGETENT) || defined(AMIGA) || defined(PROTO) char_u * -tltoa(i) - unsigned long i; +tltoa(unsigned long i) { static char_u buf[16]; char_u *p; @@ -2399,12 +2406,10 @@ tltoa(i) * minimal tgoto() implementation. * no padding and we only parse for %i %d and %+char */ -static char *tgoto __ARGS((char *, int, int)); +static char *tgoto(char *, int, int); static char * -tgoto(cm, x, y) - char *cm; - int x, y; +tgoto(char *cm, int x, int y) { static char buf[30]; char *p, *s, *e; @@ -2454,8 +2459,7 @@ tgoto(cm, x, y) * If that fails, use the default terminal name. */ void -termcapinit(name) - char_u *name; +termcapinit(char_u *name) { char_u *term; @@ -2495,15 +2499,7 @@ termcapinit(name) /* * the number of calls to ui_write is reduced by using the buffer "out_buf" */ -#ifdef DOS16 -# define OUT_SIZE 255 /* only have 640K total... */ -#else -# ifdef FEAT_GUI_W16 -# define OUT_SIZE 1023 /* Save precious 1K near data */ -# else -# define OUT_SIZE 2047 -# endif -#endif +#define OUT_SIZE 2047 /* Add one to allow mch_write() in os_win32.c to append a NUL */ static char_u out_buf[OUT_SIZE + 1]; static int out_pos = 0; /* number of chars in out_buf */ @@ -2512,7 +2508,7 @@ static int out_pos = 0; /* number of chars in out_buf */ * out_flush(): flush the output buffer */ void -out_flush() +out_flush(void) { int len; @@ -2525,13 +2521,35 @@ out_flush() } } +/* + * out_flush_cursor(): flush the output buffer and redraw the cursor. + * Does not flush recursively in the GUI to avoid slow drawing. + */ + void +out_flush_cursor( + int force UNUSED, /* when TRUE, update cursor even when not moved */ + int clear_selection UNUSED) /* clear selection under cursor */ +{ + mch_disable_flush(); + out_flush(); + mch_enable_flush(); +#ifdef FEAT_GUI + if (gui.in_use) + { + gui_update_cursor(force, clear_selection); + gui_may_flush(); + } +#endif +} + + #if defined(FEAT_MBYTE) || defined(PROTO) /* * Sometimes a byte out of a multi-byte character is written with out_char(). * To avoid flushing half of the character, call this function first. */ void -out_flush_check() +out_flush_check(void) { if (enc_dbcs != 0 && out_pos >= OUT_SIZE - MB_MAXBYTES) out_flush(); @@ -2543,7 +2561,7 @@ out_flush_check() * out_trash(): Throw away the contents of the output buffer */ void -out_trash() +out_trash(void) { out_pos = 0; } @@ -2556,10 +2574,9 @@ out_trash() * like msg_puts() and screen_putchar() for that). */ void -out_char(c) - unsigned c; +out_char(unsigned c) { -#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X_UNIX) +#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X) if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */ out_char('\r'); #endif @@ -2571,16 +2588,15 @@ out_char(c) out_flush(); } -static void out_char_nf __ARGS((unsigned)); +static void out_char_nf(unsigned); /* * out_char_nf(c): like out_char(), but don't flush when p_wd is set */ static void -out_char_nf(c) - unsigned c; +out_char_nf(unsigned c) { -#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X_UNIX) +#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X) if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */ out_char_nf('\r'); #endif @@ -2603,8 +2619,7 @@ out_char_nf(c) * normal text (use functions like msg_puts() and screen_putchar() for that). */ void -out_str_nf(s) - char_u *s; +out_str_nf(char_u *s) { if (out_pos > OUT_SIZE - 20) /* avoid terminal strings being split up */ out_flush(); @@ -2617,6 +2632,77 @@ out_str_nf(s) } #endif +/* + * A conditional-flushing out_str, mainly for visualbell. + * Handles a delay internally, because termlib may not respect the delay or do + * it at the wrong time. + * Note: Only for terminal strings. + */ + void +out_str_cf(char_u *s) +{ + if (s != NULL && *s) + { +#ifdef HAVE_TGETENT + char_u *p; +#endif + +#ifdef FEAT_GUI + /* Don't use tputs() when GUI is used, ncurses crashes. */ + if (gui.in_use) + { + out_str_nf(s); + return; + } +#endif + if (out_pos > OUT_SIZE - 20) + out_flush(); +#ifdef HAVE_TGETENT + for (p = s; *s; ++s) + { + /* flush just before delay command */ + if (*s == '$' && *(s + 1) == '<') + { + char_u save_c = *s; + int duration = atoi((char *)s + 2); + + *s = NUL; + tputs((char *)p, 1, TPUTSFUNCAST out_char_nf); + *s = save_c; + out_flush(); +# ifdef ELAPSED_FUNC + /* Only sleep here if we can limit this happening in + * vim_beep(). */ + p = vim_strchr(s, '>'); + if (p == NULL || duration <= 0) + { + /* can't parse the time, don't sleep here */ + p = s; + } + else + { + ++p; + do_sleep(duration); + } +# else + /* Rely on the terminal library to sleep. */ + p = s; +# endif + break; + } + } + tputs((char *)p, 1, TPUTSFUNCAST out_char_nf); +#else + while (*s) + out_char_nf(*s++); +#endif + + /* For testing we write one string at a time. */ + if (p_wd) + out_flush(); + } +} + /* * out_str(s): Put a character string a byte at a time into the output buffer. * If HAVE_TGETENT is defined use the termcap parser. (jw) @@ -2624,8 +2710,7 @@ out_str_nf(s) * normal text (use functions like msg_puts() and screen_putchar() for that). */ void -out_str(s) - char_u *s; +out_str(char_u *s) { if (s != NULL && *s) { @@ -2657,39 +2742,32 @@ out_str(s) * cursor positioning using termcap parser. (jw) */ void -term_windgoto(row, col) - int row; - int col; +term_windgoto(int row, int col) { OUT_STR(tgoto((char *)T_CM, col, row)); } void -term_cursor_right(i) - int i; +term_cursor_right(int i) { OUT_STR(tgoto((char *)T_CRI, 0, i)); } void -term_append_lines(line_count) - int line_count; +term_append_lines(int line_count) { OUT_STR(tgoto((char *)T_CAL, 0, line_count)); } void -term_delete_lines(line_count) - int line_count; +term_delete_lines(int line_count) { OUT_STR(tgoto((char *)T_CDL, 0, line_count)); } #if defined(HAVE_TGETENT) || defined(PROTO) void -term_set_winpos(x, y) - int x; - int y; +term_set_winpos(int x, int y) { /* Can't handle a negative value here */ if (x < 0) @@ -2699,77 +2777,179 @@ term_set_winpos(x, y) OUT_STR(tgoto((char *)T_CWP, y, x)); } - void -term_set_winsize(width, height) - int width; - int height; +# if defined(FEAT_TERMRESPONSE) || defined(PROTO) +/* + * Return TRUE if we can request the terminal for a response. + */ + static int +can_get_termresponse() { - OUT_STR(tgoto((char *)T_CWS, height, width)); + return cur_tmode == TMODE_RAW + && termcap_active +# ifdef UNIX + && (is_not_a_term() || (isatty(1) && isatty(read_cmd_fd))) +# endif + && p_ek; } -#endif - void -term_fg_color(n) - int n; +static int winpos_x = -1; +static int winpos_y = -1; +static int did_request_winpos = 0; + +/* + * Try getting the Vim window position from the terminal. + * Returns OK or FAIL. + */ + int +term_get_winpos(int *x, int *y, varnumber_T timeout) { - /* Use "AF" termcap entry if present, "Sf" entry otherwise */ - if (*T_CAF) - term_color(T_CAF, n); - else if (*T_CSF) - term_color(T_CSF, n); + int count = 0; + int prev_winpos_x = winpos_x; + int prev_winpos_y = winpos_y; + + if (*T_CGP == NUL || !can_get_termresponse()) + return FAIL; + winpos_x = -1; + winpos_y = -1; + ++did_request_winpos; + winpos_status = STATUS_SENT; + OUT_STR(T_CGP); + out_flush(); + + /* Try reading the result for "timeout" msec. */ + while (count++ <= timeout / 10 && !got_int) + { + (void)vpeekc_nomap(); + if (winpos_x >= 0 && winpos_y >= 0) + { + *x = winpos_x; + *y = winpos_y; + return OK; + } + ui_delay(10, FALSE); + } + /* Do not reset "did_request_winpos", if we timed out the response might + * still come later and we must consume it. */ + + winpos_x = prev_winpos_x; + winpos_y = prev_winpos_y; + if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0) + { + /* Polling: return previous values if we have them. */ + *x = winpos_x; + *y = winpos_y; + return OK; + } + + return FALSE; } +# endif void -term_bg_color(n) - int n; +term_set_winsize(int height, int width) { - /* Use "AB" termcap entry if present, "Sb" entry otherwise */ - if (*T_CAB) - term_color(T_CAB, n); - else if (*T_CSB) - term_color(T_CSB, n); + OUT_STR(tgoto((char *)T_CWS, width, height)); } +#endif static void -term_color(s, n) - char_u *s; - int n; +term_color(char_u *s, int n) { char buf[20]; - int i = 2; /* index in s[] just after <Esc>[ or CSI */ + int i = *s == CSI ? 1 : 2; + /* index in s[] just after <Esc>[ or CSI */ /* Special handling of 16 colors, because termcap can't handle it */ /* Also accept "\e[3%dm" for TERMINFO, it is sometimes used */ /* Also accept CSI instead of <Esc>[ */ if (n >= 8 && t_colors >= 16 - && ((s[0] == ESC && s[1] == '[') || (s[0] == CSI && (i = 1) == 1)) + && ((s[0] == ESC && s[1] == '[') +#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) + || (s[0] == ESC && s[1] == '|') +#endif + || (s[0] == CSI && (i = 1) == 1)) && s[i] != NUL && (STRCMP(s + i + 1, "%p1%dm") == 0 || STRCMP(s + i + 1, "%dm") == 0) && (s[i] == '3' || s[i] == '4')) { - sprintf(buf, #ifdef TERMINFO - "%s%s%%p1%%dm", + char *format = "%s%s%%p1%%dm"; #else - "%s%s%%dm", + char *format = "%s%s%%dm"; +#endif + char *lead = i == 2 ? ( +#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) + s[1] == '|' ? IF_EB("\033|", ESC_STR "|") : #endif - i == 2 ? IF_EB("\033[", ESC_STR "[") : "\233", - s[i] == '3' ? (n >= 16 ? "38;5;" : "9") - : (n >= 16 ? "48;5;" : "10")); + IF_EB("\033[", ESC_STR "[")) : "\233"; + char *tail = s[i] == '3' ? (n >= 16 ? "38;5;" : "9") + : (n >= 16 ? "48;5;" : "10"); + + sprintf(buf, format, lead, tail); OUT_STR(tgoto(buf, 0, n >= 16 ? n : n - 8)); } else OUT_STR(tgoto((char *)s, 0, n)); } -#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(OS2) || defined(VMS) || defined(MACOS_X))) || defined(PROTO) + void +term_fg_color(int n) +{ + /* Use "AF" termcap entry if present, "Sf" entry otherwise */ + if (*T_CAF) + term_color(T_CAF, n); + else if (*T_CSF) + term_color(T_CSF, n); +} + + void +term_bg_color(int n) +{ + /* Use "AB" termcap entry if present, "Sb" entry otherwise */ + if (*T_CAB) + term_color(T_CAB, n); + else if (*T_CSB) + term_color(T_CSB, n); +} + +#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) + +#define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF) +#define GREEN(rgb) (((long_u)(rgb) >> 8) & 0xFF) +#define BLUE(rgb) (((long_u)(rgb) ) & 0xFF) + + static void +term_rgb_color(char_u *s, guicolor_T rgb) +{ +#define MAX_COLOR_STR_LEN 100 + char buf[MAX_COLOR_STR_LEN]; + + vim_snprintf(buf, MAX_COLOR_STR_LEN, + (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); + OUT_STR(buf); +} + + void +term_fg_rgb_color(guicolor_T rgb) +{ + term_rgb_color(T_8F, rgb); +} + + void +term_bg_rgb_color(guicolor_T rgb) +{ + term_rgb_color(T_8B, rgb); +} +#endif + +#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) \ + || defined(MACOS_X))) || defined(PROTO) /* * Generic function to set window title, using t_ts and t_fs. */ void -term_settitle(title) - char_u *title; +term_settitle(char_u *title) { /* t_ts takes one argument: column in status line */ OUT_STR(tgoto((char *)T_TS, 0, 0)); /* set title start */ @@ -2784,9 +2964,10 @@ term_settitle(title) * Replace all entries that are NULL by empty_option */ void -ttest(pairs) - int pairs; +ttest(int pairs) { + char_u *env_colors; + check_options(); /* make sure no options are NULL */ /* @@ -2873,8 +3054,16 @@ ttest(pairs) } need_gather = TRUE; - /* Set t_colors to the value of t_Co. */ + /* Set t_colors to the value of $COLORS or t_Co. */ t_colors = atoi((char *)T_CCO); + env_colors = mch_getenv((char_u *)"COLORS"); + if (env_colors != NULL && isdigit(*env_colors)) + { + int colors = atoi((char *)env_colors); + + if (colors != t_colors) + set_color_count(colors); + } } #if (defined(FEAT_GUI) && (defined(FEAT_MENU) || !defined(USE_ON_FLY_SCROLL))) \ @@ -2884,9 +3073,7 @@ ttest(pairs) * byte first, and store them in dst. */ void -add_long_to_buf(val, dst) - long_u val; - char_u *dst; +add_long_to_buf(long_u val, char_u *dst) { int i; int shift; @@ -2898,7 +3085,7 @@ add_long_to_buf(val, dst) } } -static int get_long_from_buf __ARGS((char_u *buf, long_u *val)); +static int get_long_from_buf(char_u *buf, long_u *val); /* * Interpret the next string of bytes in buf as a long integer, with the most @@ -2909,9 +3096,7 @@ static int get_long_from_buf __ARGS((char_u *buf, long_u *val)); * were present. */ static int -get_long_from_buf(buf, val) - char_u *buf; - long_u *val; +get_long_from_buf(char_u *buf, long_u *val) { int len; char_u bytes[sizeof(long_u)]; @@ -2942,10 +3127,7 @@ get_long_from_buf(buf, val) * available. */ static int -get_bytes_from_buf(buf, bytes, num_bytes) - char_u *buf; - char_u *bytes; - int num_bytes; +get_bytes_from_buf(char_u *buf, char_u *bytes, int num_bytes) { int len = 0; int i; @@ -2982,7 +3164,7 @@ get_bytes_from_buf(buf, bytes, num_bytes) * too big. */ void -check_shellsize() +check_shellsize(void) { if (Rows < min_rows()) /* need room for one window and command line */ Rows = min_rows(); @@ -2993,7 +3175,7 @@ check_shellsize() * Limit Rows and Columns to avoid an overflow in Rows * Columns. */ void -limit_screen_size() +limit_screen_size(void) { if (Columns < MIN_COLUMNS) Columns = MIN_COLUMNS; @@ -3007,7 +3189,7 @@ limit_screen_size() * Invoked just before the screen structures are going to be (re)allocated. */ void -win_new_shellsize() +win_new_shellsize(void) { static int old_Rows = 0; static int old_Columns = 0; @@ -3025,9 +3207,7 @@ win_new_shellsize() if (old_Columns != Columns) { old_Columns = Columns; -#ifdef FEAT_VERTSPLIT shell_new_columns(); /* update window sizes */ -#endif } } @@ -3036,7 +3216,7 @@ win_new_shellsize() * Will obtain the current size and redraw (also when size didn't change). */ void -shell_resized() +shell_resized(void) { set_shellsize(0, 0, FALSE); } @@ -3046,7 +3226,7 @@ shell_resized() * When the size didn't change, nothing happens. */ void -shell_resized_check() +shell_resized_check(void) { int old_Rows = Rows; int old_Columns = Columns; @@ -3074,9 +3254,7 @@ shell_resized_check() * it fails use 'width' and 'height'. */ void -set_shellsize(width, height, mustset) - int width, height; - int mustset; +set_shellsize(int width, int height, int mustset) { static int busy = FALSE; @@ -3156,10 +3334,8 @@ set_shellsize(width, height, mustset) } else { -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif if (State & CMDLINE) { update_screen(NOT_VALID); @@ -3172,11 +3348,10 @@ set_shellsize(width, height, mustset) if (pum_visible()) { redraw_later(NOT_VALID); - ins_compl_show_pum(); /* This includes the redraw. */ + ins_compl_show_pum(); } - else #endif - update_screen(NOT_VALID); + update_screen(NOT_VALID); if (redrawing()) setcursor(); } @@ -3192,8 +3367,7 @@ set_shellsize(width, height, mustset) * commands and Ex mode). */ void -settmode(tmode) - int tmode; +settmode(int tmode) { #ifdef FEAT_GUI /* don't set the term where gvim was started to any mode */ @@ -3221,23 +3395,34 @@ settmode(tmode) /* May need to check for T_CRV response and termcodes, it * doesn't work in Cooked mode, an external program may get * them. */ - if (tmode != TMODE_RAW && (crv_status == CRV_SENT - || u7_status == U7_SENT)) + if (tmode != TMODE_RAW && (crv_status == STATUS_SENT + || u7_status == STATUS_SENT +#ifdef FEAT_TERMINAL + || rfg_status == STATUS_SENT +#endif + || rbg_status == STATUS_SENT + || rbm_status == STATUS_SENT + || rcs_status == STATUS_SENT + || winpos_status == STATUS_SENT)) (void)vpeekc_nomap(); check_for_codes_from_term(); } #endif #ifdef FEAT_MOUSE_TTY if (tmode != TMODE_RAW) - mch_setmouse(FALSE); /* switch mouse off */ + mch_setmouse(FALSE); /* switch mouse off */ #endif + if (tmode != TMODE_RAW) + out_str(T_BD); /* disable bracketed paste mode */ out_flush(); - mch_settmode(tmode); /* machine specific function */ + mch_settmode(tmode); /* machine specific function */ cur_tmode = tmode; #ifdef FEAT_MOUSE if (tmode == TMODE_RAW) - setmouse(); /* may switch mouse on */ + setmouse(); /* may switch mouse on */ #endif + if (tmode == TMODE_RAW) + out_str(T_BE); /* enable bracketed paste mode */ out_flush(); } #ifdef FEAT_TERMRESPONSE @@ -3247,12 +3432,13 @@ settmode(tmode) } void -starttermcap() +starttermcap(void) { if (full_screen && !termcap_active) { out_str(T_TI); /* start termcap mode */ out_str(T_KS); /* start "keypad transmit" mode */ + out_str(T_BE); /* enable bracketed paste mode */ out_flush(); termcap_active = TRUE; screen_start(); /* don't know where cursor is now */ @@ -3264,7 +3450,7 @@ starttermcap() may_req_termresponse(); /* Immediately check for a response. If t_Co changes, we don't * want to redraw with wrong colors first. */ - if (crv_status == CRV_SENT) + if (crv_status == STATUS_SENT) check_for_codes_from_term(); } #endif @@ -3272,7 +3458,7 @@ starttermcap() } void -stoptermcap() +stoptermcap(void) { screen_stop_highlight(); reset_cterm_colors(); @@ -3283,8 +3469,16 @@ stoptermcap() if (!gui.in_use && !gui.starting) # endif { - /* May need to discard T_CRV or T_U7 response. */ - if (crv_status == CRV_SENT || u7_status == U7_SENT) + /* May need to discard T_CRV, T_U7 or T_RBG response. */ + if (crv_status == STATUS_SENT + || u7_status == STATUS_SENT +# ifdef FEAT_TERMINAL + || rfg_status == STATUS_SENT +# endif + || rbg_status == STATUS_SENT + || rbm_status == STATUS_SENT + || rcs_status == STATUS_SENT + || winpos_status == STATUS_SENT) { # ifdef UNIX /* Give the terminal a chance to respond. */ @@ -3301,6 +3495,7 @@ stoptermcap() check_for_codes_from_term(); } #endif + out_str(T_BD); /* disable bracketed paste mode */ out_str(T_KE); /* stop "keypad transmit" mode */ out_flush(); termcap_active = FALSE; @@ -3312,40 +3507,6 @@ stoptermcap() } #if defined(FEAT_TERMRESPONSE) || defined(PROTO) -# if defined(UNIX) || defined(PROTO) -/* - * Return TRUE when the xterm version was requested or anything else that - * would send an ESC sequence back to Vim. - * If not sent yet, prevent it from being sent soon. - * Used to check whether it is OK to enable checking for DEC mouse codes, - * which conflict with may xterm ESC sequences. - */ - int -did_request_esc_sequence() -{ - if (crv_status == CRV_GET) - crv_status = 0; - if (u7_status == U7_GET) - u7_status = 0; - return crv_status == CRV_SENT || u7_status == U7_SENT - || xt_index_out > xt_index_in; -} - -/* - * If requesting the version was disabled in did_request_esc_sequence(), - * enable it again. - */ - void -resume_get_esc_sequence() -{ - if (crv_status == 0) - crv_status = CRV_GET; - if (u7_status == 0) - u7_status = U7_GET; -} -# endif - - /* * Request version string (for xterm) when needed. * Only do this after switching to raw mode, otherwise the result will be @@ -3358,28 +3519,19 @@ resume_get_esc_sequence() * Insert mode. * On Unix only do it when both output and input are a tty (avoid writing * request to terminal while reading from a file). - * Do not do this when a mouse is being detected that starts with the same ESC - * sequence as the termresponse. * The result is caught in check_termcode(). */ void -may_req_termresponse() +may_req_termresponse(void) { - if (crv_status == CRV_GET - && cur_tmode == TMODE_RAW + if (crv_status == STATUS_GET + && can_get_termresponse() && starting == 0 - && termcap_active - && p_ek -# ifdef UNIX - && isatty(1) - && isatty(read_cmd_fd) - && !xterm_conflict_mouse -# endif && *T_CRV != NUL) { - LOG_TR("Sending CRV"); + LOG_TR(("Sending CRV request")); out_str(T_CRV); - crv_status = CRV_SENT; + crv_status = STATUS_SENT; /* check for the characters now, otherwise they might be eaten by * get_keystroke() */ out_flush(); @@ -3398,33 +3550,35 @@ may_req_termresponse() * it must be called immediately after entering termcap mode. */ void -may_req_ambiguous_char_width() +may_req_ambiguous_char_width(void) { - if (u7_status == U7_GET - && cur_tmode == TMODE_RAW - && termcap_active - && p_ek -# ifdef UNIX - && isatty(1) - && isatty(read_cmd_fd) -# endif + if (u7_status == STATUS_GET + && can_get_termresponse() + && starting == 0 && *T_U7 != NUL && !option_was_set((char_u *)"ambiwidth")) { char_u buf[16]; - LOG_TR("Sending U7 request"); + LOG_TR(("Sending U7 request")); /* Do this in the second row. In the first row the returned sequence * may be CSI 1;2R, which is the same as <S-F3>. */ term_windgoto(1, 0); buf[mb_char2bytes(0x25bd, buf)] = 0; out_str(buf); out_str(T_U7); - u7_status = U7_SENT; + u7_status = STATUS_SENT; out_flush(); + + /* This overwrites a few characters on the screen, a redraw is needed + * after this. Clear them out for now. */ term_windgoto(1, 0); out_str((char_u *)" "); term_windgoto(0, 0); + + /* Need to reset the known cursor position. */ + screen_start(); + /* check for the characters now, otherwise they might be eaten by * get_keystroke() */ out_flush(); @@ -3433,13 +3587,55 @@ may_req_ambiguous_char_width() } # endif +/* + * Similar to requesting the version string: Request the terminal background + * color when it is the right moment. + */ + void +may_req_bg_color(void) +{ + if (can_get_termresponse() && starting == 0) + { + int didit = FALSE; + +# ifdef FEAT_TERMINAL + /* Only request foreground if t_RF is set. */ + if (rfg_status == STATUS_GET && *T_RFG != NUL) + { + LOG_TR(("Sending FG request")); + out_str(T_RFG); + rfg_status = STATUS_SENT; + didit = TRUE; + } +# endif + + /* Only request background if t_RB is set. */ + if (rbg_status == STATUS_GET && *T_RBG != NUL) + { + LOG_TR(("Sending BG request")); + out_str(T_RBG); + rbg_status = STATUS_SENT; + didit = TRUE; + } + + if (didit) + { + /* check for the characters now, otherwise they might be eaten by + * get_keystroke() */ + out_flush(); + (void)vpeekc_nomap(); + } + } +} + # ifdef DEBUG_TERMRESPONSE static void -log_tr(char *msg) +log_tr(const char *fmt, ...) { static FILE *fd_tr = NULL; static proftime_T start; proftime_T now; + va_list ap; if (fd_tr == NULL) { @@ -3448,11 +3644,14 @@ log_tr(char *msg) } now = start; profile_end(&now); - fprintf(fd_tr, "%s: %s %s\n", - profile_msg(&now), - must_redraw == NOT_VALID ? "NV" - : must_redraw == CLEAR ? "CL" : " ", - msg); + fprintf(fd_tr, "%s: %s ", profile_msg(&now), + must_redraw == NOT_VALID ? "NV" + : must_redraw == CLEAR ? "CL" : " "); + va_start(ap, fmt); + vfprintf(fd_tr, fmt, ap); + va_end(ap); + fputc('\n', fd_tr); + fflush(fd_tr); } # endif #endif @@ -3461,17 +3660,17 @@ log_tr(char *msg) * Return TRUE when saving and restoring the screen. */ int -swapping_screen() +swapping_screen(void) { return (full_screen && *T_TI != NUL); } -#ifdef FEAT_MOUSE +#if defined(FEAT_MOUSE) || defined(PROTO) /* * setmouse() - switch mouse on/off depending on current mode and 'mouse' */ void -setmouse() +setmouse(void) { # ifdef FEAT_MOUSE_TTY int checkfor; @@ -3526,8 +3725,7 @@ setmouse() * normal editing mode (not at hit-return message). */ int -mouse_has(c) - int c; +mouse_has(int c) { char_u *p; @@ -3549,7 +3747,7 @@ mouse_has(c) * Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos". */ int -mouse_model_popup() +mouse_model_popup(void) { return (p_mousem[0] == 'p'); } @@ -3561,13 +3759,13 @@ mouse_model_popup() * Used when starting Vim or returning from a shell. */ void -scroll_start() +scroll_start(void) { - if (*T_VS != NUL) + if (*T_VS != NUL && *T_CVS != NUL) { out_str(T_VS); - out_str(T_VE); - screen_start(); /* don't know where cursor is now */ + out_str(T_CVS); + screen_start(); /* don't know where cursor is now */ } } @@ -3577,7 +3775,7 @@ static int cursor_is_off = FALSE; * Enable the cursor. */ void -cursor_on() +cursor_on(void) { if (cursor_is_off) { @@ -3590,39 +3788,123 @@ cursor_on() * Disable the cursor. */ void -cursor_off() +cursor_off(void) { - if (full_screen) + if (full_screen && !cursor_is_off) { - if (!cursor_is_off) - out_str(T_VI); /* disable cursor */ + out_str(T_VI); /* disable cursor */ cursor_is_off = TRUE; } } #if defined(CURSOR_SHAPE) || defined(PROTO) /* - * Set cursor shape to match Insert mode. + * Set cursor shape to match Insert or Replace mode. */ void -term_cursor_shape() +term_cursor_mode(int forced) { - static int showing_insert_mode = MAYBE; + static int showing_mode = -1; + char_u *p; - if (!full_screen || *T_CSI == NUL || *T_CEI == NUL) + /* Only do something when redrawing the screen and we can restore the + * mode. */ + if (!full_screen || *T_CEI == NUL) + { +# ifdef FEAT_TERMRESPONSE + if (forced && initial_cursor_shape > 0) + /* Restore to initial values. */ + term_cursor_shape(initial_cursor_shape, initial_cursor_blink); +# endif return; + } - if (State & INSERT) + if ((State & REPLACE) == REPLACE) + { + if (forced || showing_mode != REPLACE) + { + if (*T_CSR != NUL) + p = T_CSR; /* Replace mode cursor */ + else + p = T_CSI; /* fall back to Insert mode cursor */ + if (*p != NUL) + { + out_str(p); + showing_mode = REPLACE; + } + } + } + else if (State & INSERT) { - if (showing_insert_mode != TRUE) + if ((forced || showing_mode != INSERT) && *T_CSI != NUL) + { out_str(T_CSI); /* Insert mode cursor */ - showing_insert_mode = TRUE; + showing_mode = INSERT; + } + } + else if (forced || showing_mode != NORMAL) + { + out_str(T_CEI); /* non-Insert mode cursor */ + showing_mode = NORMAL; + } +} + +# if defined(FEAT_TERMINAL) || defined(PROTO) + void +term_cursor_color(char_u *color) +{ + if (*T_CSC != NUL) + { + out_str(T_CSC); /* set cursor color start */ + out_str_nf(color); + out_str(T_CEC); /* set cursor color end */ + out_flush(); + } +} +# endif + + int +blink_state_is_inverted() +{ +#ifdef FEAT_TERMRESPONSE + return rbm_status == STATUS_GOT && rcs_status == STATUS_GOT + && initial_cursor_blink != initial_cursor_shape_blink; +#else + return FALSE; +#endif +} + +/* + * "shape": 1 = block, 2 = underline, 3 = vertical bar + */ + void +term_cursor_shape(int shape, int blink) +{ + if (*T_CSH != NUL) + { + OUT_STR(tgoto((char *)T_CSH, 0, shape * 2 - blink)); + out_flush(); } else { - if (showing_insert_mode != FALSE) - out_str(T_CEI); /* non-Insert mode cursor */ - showing_insert_mode = FALSE; + int do_blink = blink; + + /* t_SH is empty: try setting just the blink state. + * The blink flags are XORed together, if the initial blinking from + * style and shape differs, we need to invert the flag here. */ + if (blink_state_is_inverted()) + do_blink = !blink; + + if (do_blink && *T_VS != NUL) + { + out_str(T_VS); + out_flush(); + } + else if (!do_blink && *T_CVS != NUL) + { + out_str(T_CVS); + out_flush(); + } } } #endif @@ -3634,17 +3916,13 @@ term_cursor_shape() * the full width of the window, excluding the vertical separator. */ void -scroll_region_set(wp, off) - win_T *wp; - int off; +scroll_region_set(win_T *wp, int off) { OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1, W_WINROW(wp) + off)); -#ifdef FEAT_VERTSPLIT if (*T_CSV != NUL && wp->w_width != Columns) - OUT_STR(tgoto((char *)T_CSV, W_WINCOL(wp) + wp->w_width - 1, - W_WINCOL(wp))); -#endif + OUT_STR(tgoto((char *)T_CSV, wp->w_wincol + wp->w_width - 1, + wp->w_wincol)); screen_start(); /* don't know where cursor is now */ } @@ -3652,13 +3930,11 @@ scroll_region_set(wp, off) * Reset scrolling region to the whole screen. */ void -scroll_region_reset() +scroll_region_reset(void) { OUT_STR(tgoto((char *)T_CS, (int)Rows - 1, 0)); -#ifdef FEAT_VERTSPLIT if (*T_CSV != NUL) OUT_STR(tgoto((char *)T_CSV, (int)Columns - 1, 0)); -#endif screen_start(); /* don't know where cursor is now */ } @@ -3678,15 +3954,14 @@ static struct termcode static int tc_max_len = 0; /* number of entries that termcodes[] can hold */ static int tc_len = 0; /* current number of entries in termcodes[] */ -static int termcode_star __ARGS((char_u *code, int len)); +static int termcode_star(char_u *code, int len); void -clear_termcodes() +clear_termcodes(void) { while (tc_len > 0) vim_free(termcodes[--tc_len].code); - vim_free(termcodes); - termcodes = NULL; + VIM_CLEAR(termcodes); tc_max_len = 0; #ifdef HAVE_TGETENT @@ -3708,10 +3983,7 @@ clear_termcodes() * "flags" can also be ATC_FROM_TERM for got_code_from_term(). */ void -add_termcode(name, string, flags) - char_u *name; - char_u *string; - int flags; +add_termcode(char_u *name, char_u *string, int flags) { struct termcode *new_tc; int i, j; @@ -3742,8 +4014,8 @@ add_termcode(name, string, flags) #if defined(WIN3264) && !defined(FEAT_GUI) if (s[0] == K_NUL) { - STRMOVE(s + 1, s); - s[1] = 3; + STRMOVE(s + 1, s); + s[1] = 3; } #endif @@ -3835,29 +4107,26 @@ add_termcode(name, string, flags) } /* - * Check termcode "code[len]" for ending in ;*X, <Esc>O*X or <M-O>*X. + * Check termcode "code[len]" for ending in ;*X or *X. * The "X" can be any character. - * Return 0 if not found, 2 for ;*X and 1 for O*X and <M-O>*X. + * Return 0 if not found, 2 for ;*X and 1 for *X. */ static int -termcode_star(code, len) - char_u *code; - int len; +termcode_star(char_u *code, int len) { /* Shortest is <M-O>*X. With ; shortest is <CSI>1;*X */ if (len >= 3 && code[len - 2] == '*') { if (len >= 5 && code[len - 3] == ';') return 2; - if ((len >= 4 && code[len - 3] == 'O') || code[len - 3] == 'O' + 128) + else return 1; } return 0; } char_u * -find_termcode(name) - char_u *name; +find_termcode(char_u *name) { int i; @@ -3869,8 +4138,7 @@ find_termcode(name) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) char_u * -get_termcode(i) - int i; +get_termcode(int i) { if (i >= tc_len) return NULL; @@ -3879,8 +4147,7 @@ get_termcode(i) #endif void -del_termcode(name) - char_u *name; +del_termcode(char_u *name) { int i; @@ -3899,8 +4166,7 @@ del_termcode(name) } static void -del_termcode_idx(idx) - int idx; +del_termcode_idx(int idx) { int i; @@ -3916,7 +4182,7 @@ del_termcode_idx(idx) * Convert all 7-bit codes to their 8-bit equivalent. */ static void -switch_to_8bit() +switch_to_8bit(void) { int i; int c; @@ -3936,7 +4202,7 @@ switch_to_8bit() need_gather = TRUE; /* need to fill termleader[] */ } detected_8bit = TRUE; - LOG_TR("Switching to 8 bit"); + LOG_TR(("Switching to 8 bit")); } #endif @@ -3946,7 +4212,7 @@ static linenr_T orig_topline = 0; static int orig_topfill = 0; # endif #endif -#if (defined(FEAT_WINDOWS) && defined(CHECK_DOUBLE_CLICK)) || defined(PROTO) +#if defined(CHECK_DOUBLE_CLICK) || defined(PROTO) /* * Checking for double clicks ourselves. * "orig_topline" is used to avoid detecting a double-click when the window @@ -3957,8 +4223,7 @@ static int orig_topfill = 0; * click still works. */ void -set_mouse_topline(wp) - win_T *wp; +set_mouse_topline(win_T *wp) { orig_topline = wp->w_topline; # ifdef FEAT_DIFF @@ -3981,11 +4246,11 @@ set_mouse_topline(wp) * inserts and deletes. */ int -check_termcode(max_offset, buf, bufsize, buflen) - int max_offset; - char_u *buf; - int bufsize; - int *buflen; +check_termcode( + int max_offset, + char_u *buf, + int bufsize, + int *buflen) { char_u *tp; char_u *p; @@ -3996,6 +4261,7 @@ check_termcode(max_offset, buf, bufsize, buflen) int offset; char_u key_name[2]; int modifiers; + char_u *modifiers_start = NULL; int key; int new_slen; int extra; @@ -4121,6 +4387,7 @@ check_termcode(max_offset, buf, bufsize, buflen) * But only when the 'K' flag is in 'cpoptions'. */ slen = termcodes[idx].len; + modifiers_start = NULL; if (cpo_koffset && offset && len < slen) continue; if (STRNCMP(termcodes[idx].code, tp, @@ -4181,7 +4448,8 @@ check_termcode(max_offset, buf, bufsize, buflen) { /* Skip over the digits, the final char must * follow. */ - for (j = slen - 2; j < len && isdigit(tp[j]); ++j) + for (j = slen - 2; j < len && (isdigit(tp[j]) + || tp[j] == ';'); ++j) ; ++j; if (len < j) /* got a partial sequence */ @@ -4189,8 +4457,10 @@ check_termcode(max_offset, buf, bufsize, buflen) if (tp[j - 1] != termcodes[idx].code[slen - 1]) continue; /* no match */ + modifiers_start = tp + slen - 2; + /* Match! Convert modifier bits. */ - n = atoi((char *)tp + slen - 2) - 1; + n = atoi((char *)modifiers_start) - 1; if (n & 1) modifiers |= MOD_MASK_SHIFT; if (n & 2) @@ -4212,42 +4482,51 @@ check_termcode(max_offset, buf, bufsize, buflen) #ifdef FEAT_TERMRESPONSE if (key_name[0] == NUL - /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */ - || key_name[0] == KS_URXVT_MOUSE -# ifdef FEAT_MBYTE - || u7_status == U7_SENT + /* Mouse codes of DEC and pterm start with <ESC>[. When + * detecting the start of these mouse codes they might as well be + * another key code or terminal response. */ +# ifdef FEAT_MOUSE_DEC + || key_name[0] == KS_DEC_MOUSE # endif - ) - { - /* Check for some responses from terminal start with "<Esc>[" or - * CSI. +# ifdef FEAT_MOUSE_PTERM + || key_name[0] == KS_PTERM_MOUSE +# endif + ) + { + /* Check for some responses from the terminal starting with + * "<Esc>[" or CSI: * - * - xterm version string: <Esc>[>{x};{vers};{y}c + * - Xterm version string: <Esc>[>{x};{vers};{y}c + * Libvterm returns {x} == 0, {vers} == 100, {y} == 0. * Also eat other possible responses to t_RV, rxvt returns * "<Esc>[?1;2c". Also accept CSI instead of <Esc>[. * mrxvt has been reported to have "+" in the version. Assume * the escape sequence ends with a letter or one of "{|}~". * - * - cursor position report: <Esc>[{row};{col}R - * The final byte is 'R'. now it is only used for checking for + * - Cursor position report: <Esc>[{row};{col}R + * The final byte must be 'R'. It is used for checking the * ambiguous-width character state. + * + * - window position reply: <Esc>[3;{x};{y}t */ - p = tp[0] == CSI ? tp + 1 : tp + 2; - if ((*T_CRV != NUL || *T_U7 != NUL) - && ((tp[0] == ESC && tp[1] == '[' && len >= 3) + char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1; + + if ((*T_CRV != NUL || *T_U7 != NUL || did_request_winpos) + && ((tp[0] == ESC && len >= 3 && tp[1] == '[') || (tp[0] == CSI && len >= 2)) - && (VIM_ISDIGIT(*p) || *p == '>' || *p == '?')) + && (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?')) { + int col = 0; + int semicols = 0; #ifdef FEAT_MBYTE - int col; int row_char = NUL; #endif - j = 0; + extra = 0; for (i = 2 + (tp[0] != CSI); i < len && !(tp[i] >= '{' && tp[i] <= '~') && !ASCII_ISALPHA(tp[i]); ++i) - if (tp[i] == ';' && ++j == 1) + if (tp[i] == ';' && ++semicols == 1) { extra = i + 1; #ifdef FEAT_MBYTE @@ -4256,64 +4535,65 @@ check_termcode(max_offset, buf, bufsize, buflen) } if (i == len) { - LOG_TR("Not enough characters for CRV"); + LOG_TR(("Not enough characters for CRV")); return -1; } -#ifdef FEAT_MBYTE if (extra > 0) col = atoi((char *)tp + extra); - else - col = 0; +#ifdef FEAT_MBYTE /* Eat it when it has 2 arguments and ends in 'R'. Also when * u7_status is not "sent", it may be from a previous Vim that * just exited. But not for <S-F3>, it sends something * similar, check for row and column to make sense. */ - if (j == 1 && tp[i] == 'R' && row_char == '2' && col >= 2) + if (semicols == 1 && tp[i] == 'R') { - char *aw = NULL; - - LOG_TR("Received U7 status"); - u7_status = U7_GOT; -# ifdef FEAT_AUTOCMD - did_cursorhold = TRUE; -# endif - if (col == 2) - aw = "single"; - else if (col == 3) - aw = "double"; - if (aw != NULL && STRCMP(aw, p_ambw) != 0) + if (row_char == '2' && col >= 2) { - /* Setting the option causes a screen redraw. Do that - * right away if possible, keeping any messages. */ - set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0); -# ifdef DEBUG_TERMRESPONSE + char *aw = NULL; + + LOG_TR(("Received U7 status: %s", tp)); + u7_status = STATUS_GOT; + did_cursorhold = TRUE; + if (col == 2) + aw = "single"; + else if (col == 3) + aw = "double"; + if (aw != NULL && STRCMP(aw, p_ambw) != 0) { - char buf[100]; - int r = redraw_asap(CLEAR); + /* Setting the option causes a screen redraw. Do + * that right away if possible, keeping any + * messages. */ + set_option_value((char_u *)"ambw", 0L, + (char_u *)aw, 0); +# ifdef DEBUG_TERMRESPONSE + { + int r = redraw_asap(CLEAR); - sprintf(buf, "set 'ambiwidth', redraw_asap(): %d", - r); - log_tr(buf); - } + log_tr("set 'ambiwidth', redraw_asap(): %d", r); + } # else - redraw_asap(CLEAR); + redraw_asap(CLEAR); # endif + } } key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; slen = i + 1; +# ifdef FEAT_EVAL + set_vim_var_string(VV_TERMU7RESP, tp, slen); +# endif } else #endif /* eat it when at least one digit and ending in 'c' */ if (*T_CRV != NUL && i > 2 + (tp[0] != CSI) && tp[i] == 'c') { - LOG_TR("Received CRV"); - crv_status = CRV_GOT; -# ifdef FEAT_AUTOCMD + int version = col; + + LOG_TR(("Received CRV response: %s", tp)); + crv_status = STATUS_GOT; did_cursorhold = TRUE; -# endif /* If this code starts with CSI, you can bet that the * terminal uses 8-bit codes. */ @@ -4321,76 +4601,383 @@ check_termcode(max_offset, buf, bufsize, buflen) switch_to_8bit(); /* rxvt sends its version number: "20703" is 2.7.3. + * Screen sends 40500. * Ignore it for when the user has set 'term' to xterm, * even though it's an rxvt. */ - if (extra > 0) - extra = atoi((char *)tp + extra); - if (extra > 20000) - extra = 0; + if (version > 20000) + version = 0; - if (tp[1 + (tp[0] != CSI)] == '>' && j == 2) + if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2) { + int need_flush = FALSE; +# ifdef FEAT_MOUSE_SGR + int is_iterm2 = FALSE; +# endif + + /* if xterm version >= 141 try to get termcap codes */ + if (version >= 141) + { + LOG_TR(("Enable checking for XT codes")); + check_for_codes = TRUE; + need_gather = TRUE; + req_codes_from_term(); + } + + /* libvterm sends 0;100;0 */ + if (version == 100 + && STRNCMP(tp + extra - 2, "0;100;0c", 8) == 0) + { + /* If run from Vim $COLORS is set to the number of + * colors the terminal supports. Otherwise assume + * 256, libvterm supports even more. */ + if (mch_getenv((char_u *)"COLORS") == NULL) + may_adjust_color_count(256); +# ifdef FEAT_MOUSE_SGR + /* Libvterm can handle SGR mouse reporting. */ + if (!option_was_set((char_u *)"ttym")) + set_option_value((char_u *)"ttym", 0L, + (char_u *)"sgr", 0); +# endif + } + + if (version == 95) + { + /* Mac Terminal.app sends 1;95;0 */ + if (STRNCMP(tp + extra - 2, "1;95;0c", 7) == 0) + { + is_not_xterm = TRUE; + is_mac_terminal = TRUE; + } +# ifdef FEAT_MOUSE_SGR + /* iTerm2 sends 0;95;0 */ + if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0) + is_iterm2 = TRUE; +# endif + } + /* Only set 'ttymouse' automatically if it was not set * by the user already. */ if (!option_was_set((char_u *)"ttym")) { -# ifdef TTYM_SGR - if (extra >= 277) +# ifdef FEAT_MOUSE_SGR + /* Xterm version 277 supports SGR. Also support + * Terminal.app and iTerm2. */ + if (version >= 277 || is_iterm2 || is_mac_terminal) set_option_value((char_u *)"ttym", 0L, (char_u *)"sgr", 0); else # endif /* if xterm version >= 95 use mouse dragging */ - if (extra >= 95) + if (version >= 95) set_option_value((char_u *)"ttym", 0L, (char_u *)"xterm2", 0); } - /* if xterm version >= 141 try to get termcap codes */ - if (extra >= 141) + /* Detect terminals that set $TERM to something like + * "xterm-256colors" but are not fully xterm + * compatible. */ + + /* Gnome terminal sends 1;3801;0, 1;4402;0 or 1;2501;0. + * xfce4-terminal sends 1;2802;0. + * screen sends 83;40500;0 + * Assuming any version number over 2500 is not an + * xterm (without the limit for rxvt and screen). */ + if (col >= 2500) + is_not_xterm = TRUE; + + /* PuTTY sends 0;136;0 + * vandyke SecureCRT sends 1;136;0 */ + if (version == 136 + && STRNCMP(tp + extra - 1, ";136;0c", 7) == 0) + is_not_xterm = TRUE; + + /* Konsole sends 0;115;0 */ + if (version == 115 + && STRNCMP(tp + extra - 2, "0;115;0c", 8) == 0) + is_not_xterm = TRUE; + + /* Only request the cursor style if t_SH and t_RS are + * set. Only supported properly by xterm since version + * 279 (otherwise it returns 0x18). + * Not for Terminal.app, it can't handle t_RS, it + * echoes the characters to the screen. */ + if (rcs_status == STATUS_GET + && version >= 279 + && !is_not_xterm + && *T_CSH != NUL + && *T_CRS != NUL) { - LOG_TR("Enable checking for XT codes"); - check_for_codes = TRUE; - need_gather = TRUE; - req_codes_from_term(); + LOG_TR(("Sending cursor style request")); + out_str(T_CRS); + rcs_status = STATUS_SENT; + need_flush = TRUE; + } + + /* Only request the cursor blink mode if t_RC set. Not + * for Gnome terminal, it can't handle t_RC, it + * echoes the characters to the screen. */ + if (rbm_status == STATUS_GET + && !is_not_xterm + && *T_CRC != NUL) + { + LOG_TR(("Sending cursor blink mode request")); + out_str(T_CRC); + rbm_status = STATUS_SENT; + need_flush = TRUE; } + + if (need_flush) + out_flush(); } + slen = i + 1; # ifdef FEAT_EVAL - set_vim_var_string(VV_TERMRESPONSE, tp, i + 1); + set_vim_var_string(VV_TERMRESPONSE, tp, slen); # endif -# ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); -# endif + key_name[0] = (int)KS_EXTRA; + key_name[1] = (int)KE_IGNORE; + } + + /* Check blinking cursor from xterm: + * {lead}?12;1$y set + * {lead}?12;2$y not set + * + * {lead} can be <Esc>[ or CSI + */ + else if (rbm_status == STATUS_SENT + && tp[(j = 1 + (tp[0] == ESC))] == '?' + && i == j + 6 + && tp[j + 1] == '1' + && tp[j + 2] == '2' + && tp[j + 3] == ';' + && tp[i - 1] == '$' + && tp[i] == 'y') + { + initial_cursor_blink = (tp[j + 4] == '1'); + rbm_status = STATUS_GOT; + LOG_TR(("Received cursor blinking mode response: %s", tp)); key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; slen = i + 1; +# ifdef FEAT_EVAL + set_vim_var_string(VV_TERMBLINKRESP, tp, slen); +# endif + } + + /* + * Check for a window position response from the terminal: + * {lead}3;{x}:{y}t + */ + else if (did_request_winpos + && ((len >= 4 && tp[0] == ESC && tp[1] == '[') + || (len >= 3 && tp[0] == CSI)) + && tp[(j = 1 + (tp[0] == ESC))] == '3' + && tp[j + 1] == ';') + { + j += 2; + for (i = j; i < len && vim_isdigit(tp[i]); ++i) + ; + if (i < len && tp[i] == ';') + { + winpos_x = atoi((char *)tp + j); + j = i + 1; + for (i = j; i < len && vim_isdigit(tp[i]); ++i) + ; + if (i < len && tp[i] == 't') + { + winpos_y = atoi((char *)tp + j); + /* got finished code: consume it */ + key_name[0] = (int)KS_EXTRA; + key_name[1] = (int)KE_IGNORE; + slen = i + 1; + + if (--did_request_winpos <= 0) + winpos_status = STATUS_GOT; + } + } + if (i == len) + { + LOG_TR(("not enough characters for winpos")); + return -1; + } + } + } + + /* Check for fore/background color response from the terminal: + * + * {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail} + * + * {code} is 10 for foreground, 11 for background + * {lead} can be <Esc>] or OSC + * {tail} can be '\007', <Esc>\ or STERM. + * + * Consume any code that starts with "{lead}11;", it's also + * possible that "rgba" is following. + */ + else if ((*T_RBG != NUL || *T_RFG != NUL) + && ((tp[0] == ESC && len >= 2 && tp[1] == ']') + || tp[0] == OSC)) + { + j = 1 + (tp[0] == ESC); + if (len >= j + 3 && (argp[0] != '1' + || (argp[1] != '1' && argp[1] != '0') + || argp[2] != ';')) + i = 0; /* no match */ + else + for (i = j; i < len; ++i) + if (tp[i] == '\007' || (tp[0] == OSC ? tp[i] == STERM + : (tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\'))) + { + int is_bg = argp[1] == '1'; + + if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0 + && tp[j + 11] == '/' && tp[j + 16] == '/') + { +#ifdef FEAT_TERMINAL + int rval = hexhex2nr(tp + j + 7); + int gval = hexhex2nr(tp + j + 12); + int bval = hexhex2nr(tp + j + 17); +#endif + if (is_bg) + { + char *newval = (3 * '6' < tp[j+7] + tp[j+12] + + tp[j+17]) ? "light" : "dark"; + + LOG_TR(("Received RBG response: %s", tp)); + rbg_status = STATUS_GOT; +#ifdef FEAT_TERMINAL + bg_r = rval; + bg_g = gval; + bg_b = bval; +#endif + if (!option_was_set((char_u *)"bg") + && STRCMP(p_bg, newval) != 0) + { + /* value differs, apply it */ + set_option_value((char_u *)"bg", 0L, + (char_u *)newval, 0); + reset_option_was_set((char_u *)"bg"); + redraw_asap(CLEAR); + } + } +#ifdef FEAT_TERMINAL + else + { + LOG_TR(("Received RFG response: %s", tp)); + rfg_status = STATUS_GOT; + fg_r = rval; + fg_g = gval; + fg_b = bval; + } +#endif + } + + /* got finished code: consume it */ + key_name[0] = (int)KS_EXTRA; + key_name[1] = (int)KE_IGNORE; + slen = i + 1 + (tp[i] == ESC); +# ifdef FEAT_EVAL + set_vim_var_string(is_bg ? VV_TERMRBGRESP + : VV_TERMRFGRESP, tp, slen); +# endif + break; + } + if (i == len) + { + LOG_TR(("not enough characters for RB")); + return -1; } } - /* Check for '<Esc>P1+r<hex bytes><Esc>\'. A "0" instead of the - * "1" means an invalid request. */ - else if (check_for_codes - && ((tp[0] == ESC && tp[1] == 'P' && len >= 2) + /* Check for key code response from xterm: + * {lead}{flag}+r<hex bytes><{tail} + * + * {lead} can be <Esc>P or DCS + * {flag} can be '0' or '1' + * {tail} can be Esc>\ or STERM + * + * Check for cursor shape response from xterm: + * {lead}1$r<digit> q{tail} + * + * {lead} can be <Esc>P or DCS + * {tail} can be Esc>\ or STERM + * + * Consume any code that starts with "{lead}.+r" or "{lead}.$r". + */ + else if ((check_for_codes || rcs_status == STATUS_SENT) + && ((tp[0] == ESC && len >= 2 && tp[1] == 'P') || tp[0] == DCS)) { - j = 1 + (tp[0] != DCS); - for (i = j; i < len; ++i) - if ((tp[i] == ESC && tp[i + 1] == '\\' && i + 1 < len) + j = 1 + (tp[0] == ESC); + if (len < j + 3) + i = len; /* need more chars */ + else if ((argp[1] != '+' && argp[1] != '$') || argp[2] != 'r') + i = 0; /* no match */ + else if (argp[1] == '+') + /* key code response */ + for (i = j; i < len; ++i) + { + if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\') || tp[i] == STERM) { - if (i - j >= 3 && tp[j + 1] == '+' && tp[j + 2] == 'r') + if (i - j >= 3) got_code_from_term(tp + j, i); key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; slen = i + 1 + (tp[i] == ESC); break; } + } + else + { + /* Probably the cursor shape response. Make sure that "i" + * is equal to "len" when there are not sufficient + * characters. */ + for (i = j + 3; i < len; ++i) + { + if (i - j == 3 && !isdigit(tp[i])) + break; + if (i - j == 4 && tp[i] != ' ') + break; + if (i - j == 5 && tp[i] != 'q') + break; + if (i - j == 6 && tp[i] != ESC && tp[i] != STERM) + break; + if ((i - j == 6 && tp[i] == STERM) + || (i - j == 7 && tp[i] == '\\')) + { + int number = argp[3] - '0'; + + /* 0, 1 = block blink, 2 = block + * 3 = underline blink, 4 = underline + * 5 = vertical bar blink, 6 = vertical bar */ + number = number == 0 ? 1 : number; + initial_cursor_shape = (number + 1) / 2; + /* The blink flag is actually inverted, compared to + * the value set with T_SH. */ + initial_cursor_shape_blink = + (number & 1) ? FALSE : TRUE; + rcs_status = STATUS_GOT; + LOG_TR(("Received cursor shape response: %s", tp)); + + key_name[0] = (int)KS_EXTRA; + key_name[1] = (int)KE_IGNORE; + slen = i + 1; +# ifdef FEAT_EVAL + set_vim_var_string(VV_TERMSTYLERESP, tp, slen); +# endif + break; + } + } + } if (i == len) { - LOG_TR("not enough characters for XT"); - return -1; /* not enough characters */ + /* These codes arrive many together, each code can be + * truncated at any point. */ + LOG_TR(("not enough characters for XT")); + return -1; } } } @@ -4446,6 +5033,7 @@ check_termcode(max_offset, buf, bufsize, buflen) # endif # ifdef FEAT_MOUSE_SGR || key_name[0] == KS_SGR_MOUSE + || key_name[0] == KS_SGR_MOUSE_RELEASE # endif ) { @@ -4456,7 +5044,7 @@ check_termcode(max_offset, buf, bufsize, buflen) if (key_name[0] == (int)KS_MOUSE) { /* - * For xterm and MSDOS we get "<t_mouse>scr", where + * For xterm we get "<t_mouse>scr", where * s == encoded button state: * 0x20 = left button down * 0x21 = middle button down @@ -4468,6 +5056,8 @@ check_termcode(max_offset, buf, bufsize, buflen) * add 0x08 for ALT * add 0x10 for CTRL * add 0x20 for mouse drag (0x40 is drag with left button) + * add 0x40 for mouse move (0x80 is move, 0x81 too) + * 0x43 (drag + release) is also move * c == column + ' ' + 1 == column + 33 * r == row + ' ' + 1 == row + 33 * @@ -4529,85 +5119,57 @@ check_termcode(max_offset, buf, bufsize, buflen) # if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR) if (key_name[0] == KS_URXVT_MOUSE - || key_name[0] == KS_SGR_MOUSE) + || key_name[0] == KS_SGR_MOUSE + || key_name[0] == KS_SGR_MOUSE_RELEASE) { - for (;;) - { - /* URXVT 1015 mouse reporting mode: - * Almost identical to xterm mouse mode, except the values - * are decimal instead of bytes. - * - * \033[%d;%d;%dM - * ^-- row - * ^----- column - * ^-------- code - * - * SGR 1006 mouse reporting mode: - * Almost identical to xterm mouse mode, except the values - * are decimal instead of bytes. - * - * \033[<%d;%d;%dM - * ^-- row - * ^----- column - * ^-------- code - * - * \033[<%d;%d;%dm : mouse release event - * ^-- row - * ^----- column - * ^-------- code - */ - p = tp + slen; - - mouse_code = getdigits(&p); - if (*p++ != ';') - return -1; + /* URXVT 1015 mouse reporting mode: + * Almost identical to xterm mouse mode, except the values + * are decimal instead of bytes. + * + * \033[%d;%d;%dM + * ^-- row + * ^----- column + * ^-------- code + * + * SGR 1006 mouse reporting mode: + * Almost identical to xterm mouse mode, except the values + * are decimal instead of bytes. + * + * \033[<%d;%d;%dM + * ^-- row + * ^----- column + * ^-------- code + * + * \033[<%d;%d;%dm : mouse release event + * ^-- row + * ^----- column + * ^-------- code + */ + p = modifiers_start; + if (p == NULL) + return -1; - /* when mouse reporting is SGR, add 32 to mouse code */ - if (key_name[0] == KS_SGR_MOUSE) - mouse_code += 32; + mouse_code = getdigits(&p); + if (*p++ != ';') + return -1; - mouse_col = getdigits(&p) - 1; - if (*p++ != ';') - return -1; + /* when mouse reporting is SGR, add 32 to mouse code */ + if (key_name[0] == KS_SGR_MOUSE + || key_name[0] == KS_SGR_MOUSE_RELEASE) + mouse_code += 32; - mouse_row = getdigits(&p) - 1; - if (key_name[0] == KS_SGR_MOUSE && *p == 'm') - mouse_code |= MOUSE_RELEASE; - else if (*p != 'M') - return -1; - p++; + if (key_name[0] == KS_SGR_MOUSE_RELEASE) + mouse_code |= MOUSE_RELEASE; - slen += (int)(p - (tp + slen)); + mouse_col = getdigits(&p) - 1; + if (*p++ != ';') + return -1; - /* skip this one if next one has same code (like xterm - * case) */ - j = termcodes[idx].len; - if (STRNCMP(tp, tp + slen, (size_t)j) == 0) - { - int slen2; - int cmd_complete = 0; + mouse_row = getdigits(&p) - 1; - /* check if the command is complete by looking for the - * 'M' */ - for (slen2 = slen; slen2 < len; slen2++) - { - if (tp[slen2] == 'M' - || (key_name[0] == KS_SGR_MOUSE - && tp[slen2] == 'm')) - { - cmd_complete = 1; - break; - } - } - p += j; - if (cmd_complete && getdigits(&p) == mouse_code) - { - slen += j; /* skip the \033[ */ - continue; - } - } - break; - } + /* The modifiers were the mouse coordinates, not the + * modifier keys (alt/shift/ctrl/meta) state. */ + modifiers = 0; } # endif @@ -4617,10 +5179,11 @@ check_termcode(max_offset, buf, bufsize, buflen) #endif #ifdef FEAT_MOUSE_SGR || key_name[0] == KS_SGR_MOUSE + || key_name[0] == KS_SGR_MOUSE_RELEASE #endif ) { -# if !defined(MSWIN) && !defined(MSDOS) +# if !defined(MSWIN) /* * Handle mouse events. * Recognize the xterm mouse wheel, but not in the GUI, the @@ -4636,19 +5199,28 @@ check_termcode(max_offset, buf, bufsize, buflen) # endif ) { - /* Keep the mouse_code before it's changed, so that we - * remember that it was a mouse wheel click. */ - wheel_code = mouse_code; +# if defined(UNIX) && defined(FEAT_MOUSE_TTY) + if (use_xterm_mouse() > 1 && mouse_code >= 0x80) + /* mouse-move event, using MOUSE_DRAG works */ + mouse_code = MOUSE_DRAG; + else +# endif + /* Keep the mouse_code before it's changed, so that we + * remember that it was a mouse wheel click. */ + wheel_code = mouse_code; } # ifdef FEAT_MOUSE_XTERM else if (held_button == MOUSE_RELEASE # ifdef FEAT_GUI && !gui.in_use # endif - && (mouse_code == 0x23 || mouse_code == 0x24)) + && (mouse_code == 0x23 || mouse_code == 0x24 + || mouse_code == 0x40 || mouse_code == 0x41)) { - /* Apparently used by rxvt scroll wheel. */ - wheel_code = mouse_code - 0x23 + MOUSEWHEEL_LOW; + /* Apparently 0x23 and 0x24 are used by rxvt scroll wheel. + * And 0x40 and 0x41 are used by some xterm emulator. */ + wheel_code = mouse_code - (mouse_code >= 0x40 ? 0x40 : 0x23) + + MOUSEWHEEL_LOW; } # endif @@ -4974,7 +5546,7 @@ check_termcode(max_offset, buf, bufsize, buflen) button = getdigits(&p); mouse_code = 0; - switch( button ) + switch (button) { case 4: mouse_code = MOUSE_LEFT; break; case 1: mouse_code = MOUSE_RIGHT; break; @@ -4982,7 +5554,7 @@ check_termcode(max_offset, buf, bufsize, buflen) default: return -1; } - switch( action ) + switch (action) { case 31: /* Initial press */ if (*p++ != ';') @@ -5054,12 +5626,25 @@ check_termcode(max_offset, buf, bufsize, buflen) * Compute the time elapsed since the previous mouse click. */ gettimeofday(&mouse_time, NULL); - timediff = (mouse_time.tv_usec - - orig_mouse_time.tv_usec) / 1000; - if (timediff < 0) - --orig_mouse_time.tv_sec; - timediff += (mouse_time.tv_sec - - orig_mouse_time.tv_sec) * 1000; + if (orig_mouse_time.tv_sec == 0) + { + /* + * Avoid computing the difference between mouse_time + * and orig_mouse_time for the first click, as the + * difference would be huge and would cause + * multiplication overflow. + */ + timediff = p_mouset; + } + else + { + timediff = (mouse_time.tv_usec + - orig_mouse_time.tv_usec) / 1000; + if (timediff < 0) + --orig_mouse_time.tv_sec; + timediff += (mouse_time.tv_sec + - orig_mouse_time.tv_sec) * 1000; + } orig_mouse_time = mouse_time; if (mouse_code == orig_mouse_code && timediff < p_mouset @@ -5071,12 +5656,9 @@ check_termcode(max_offset, buf, bufsize, buflen) && orig_topfill == curwin->w_topfill #endif ) -#ifdef FEAT_WINDOWS /* Double click in tab pages line also works * when window contents changes. */ - || (mouse_row == 0 && firstwin->w_winrow > 0) -#endif - ) + || (mouse_row == 0 && firstwin->w_winrow > 0)) ) ++orig_num_clicks; else @@ -5118,9 +5700,11 @@ check_termcode(max_offset, buf, bufsize, buflen) else if (orig_num_clicks == 4) modifiers |= MOD_MASK_4CLICK; - /* Work out our pseudo mouse event */ + /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets + * added, then it's not mouse up/down. */ key_name[0] = (int)KS_EXTRA; - if (wheel_code != 0) + if (wheel_code != 0 + && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE) { if (wheel_code & MOUSE_CTRL) modifiers |= MOD_MASK_CTRL; @@ -5128,10 +5712,18 @@ check_termcode(max_offset, buf, bufsize, buflen) modifiers |= MOD_MASK_ALT; key_name[1] = (wheel_code & 1) ? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN; + held_button = MOUSE_RELEASE; } else key_name[1] = get_pseudo_mouse_code(current_button, is_click, is_drag); + + /* Make sure the mouse position is valid. Some terminals may + * return weird values. */ + if (mouse_col >= Columns) + mouse_col = Columns - 1; + if (mouse_row >= Rows) + mouse_row = Rows - 1; } #endif /* FEAT_MOUSE */ @@ -5337,12 +5929,42 @@ check_termcode(max_offset, buf, bufsize, buflen) } #ifdef FEAT_TERMRESPONSE - LOG_TR("normal character"); + LOG_TR(("normal character")); #endif return 0; /* no match found */ } +#if (defined(FEAT_TERMINAL) && defined(FEAT_TERMRESPONSE)) || defined(PROTO) +/* + * Get the text foreground color, if known. + */ + void +term_get_fg_color(char_u *r, char_u *g, char_u *b) +{ + if (rfg_status == STATUS_GOT) + { + *r = fg_r; + *g = fg_g; + *b = fg_b; + } +} + +/* + * Get the text background color, if known. + */ + void +term_get_bg_color(char_u *r, char_u *g, char_u *b) +{ + if (rbg_status == STATUS_GOT) + { + *r = bg_r; + *g = bg_g; + *b = bg_b; + } +} +#endif + /* * Replace any terminal code strings in from[] with the equivalent internal * vim representation. This is used for the "from" and "to" part of a @@ -5362,12 +5984,12 @@ check_termcode(max_offset, buf, bufsize, buflen) * instead of a CTRL-V. */ char_u * -replace_termcodes(from, bufp, from_part, do_lt, special) - char_u *from; - char_u **bufp; - int from_part; - int do_lt; /* also translate <lt> */ - int special; /* always accept <key> notation */ +replace_termcodes( + char_u *from, + char_u **bufp, + int from_part, + int do_lt, /* also translate <lt> */ + int special) /* always accept <key> notation */ { int i; int slen; @@ -5444,7 +6066,7 @@ replace_termcodes(from, bufp, from_part, do_lt, special) } #endif - slen = trans_special(&src, result + dlen, TRUE); + slen = trans_special(&src, result + dlen, TRUE, FALSE); if (slen) { dlen += slen; @@ -5576,8 +6198,7 @@ replace_termcodes(from, bufp, from_part, do_lt, special) * Return the index in termcodes[], or -1 if not found. */ int -find_term_bykeys(src) - char_u *src; +find_term_bykeys(char_u *src) { int i; int slen = (int)STRLEN(src); @@ -5596,7 +6217,7 @@ find_term_bykeys(src) * Used to speed up check_termcode(). */ static void -gather_termleader() +gather_termleader(void) { int i; int len = 0; @@ -5606,7 +6227,7 @@ gather_termleader() termleader[len++] = CSI; /* the GUI codes are not in termcodes[] */ #endif #ifdef FEAT_TERMRESPONSE - if (check_for_codes) + if (check_for_codes || *T_CRS != NUL) termleader[len++] = DCS; /* the termcode response starts with DCS in 8-bit mode */ #endif @@ -5627,7 +6248,7 @@ gather_termleader() * This code looks a lot like showoptions(), but is different. */ void -show_termcodes() +show_termcodes(void) { int col; int *items; @@ -5713,10 +6334,7 @@ show_termcodes() * Output goes into IObuff[] */ int -show_one_termcode(name, code, printit) - char_u *name; - char_u *code; - int printit; +show_one_termcode(char_u *name, char_u *code, int printit) { char_u *p; int len; @@ -5769,8 +6387,11 @@ show_one_termcode(name, code, printit) * termcap codes from the terminal itself. * We get them one by one to avoid a very long response string. */ +static int xt_index_in = 0; +static int xt_index_out = 0; + static void -req_codes_from_term() +req_codes_from_term(void) { xt_index_out = 0; xt_index_in = 0; @@ -5778,7 +6399,7 @@ req_codes_from_term() } static void -req_more_codes_from_term() +req_more_codes_from_term(void) { char buf[11]; int old_idx = xt_index_out; @@ -5791,15 +6412,10 @@ req_more_codes_from_term() * many, there can be a buffer overflow somewhere. */ while (xt_index_out < xt_index_in + 10 && key_names[xt_index_out] != NULL) { -# ifdef DEBUG_TERMRESPONSE - char dbuf[100]; + char *key_name = key_names[xt_index_out]; - sprintf(dbuf, "Requesting XT %d: %s", - xt_index_out, key_names[xt_index_out]); - log_tr(dbuf); -# endif - sprintf(buf, "\033P+q%02x%02x\033\\", - key_names[xt_index_out][0], key_names[xt_index_out][1]); + LOG_TR(("Requesting XT %d: %s", xt_index_out, key_name)); + sprintf(buf, "\033P+q%02x%02x\033\\", key_name[0], key_name[1]); out_str_nf((char_u *)buf); ++xt_index_out; } @@ -5816,9 +6432,7 @@ req_more_codes_from_term() * "code" points to the "0" or "1". */ static void -got_code_from_term(code, len) - char_u *code; - int len; +got_code_from_term(char_u *code, int len) { #define XT_LEN 100 char_u name[3]; @@ -5844,14 +6458,9 @@ got_code_from_term(code, len) break; } } -# ifdef DEBUG_TERMRESPONSE - { - char buf[100]; - sprintf(buf, "Received XT %d: %s", xt_index_in, (char *)name); - log_tr(buf); - } -# endif + LOG_TR(("Received XT %d: %s", xt_index_in, (char *)name)); + if (key_names[i] != NULL) { for (i = 8; (c = hexhex2nr(code + i)) >= 0; i += 2) @@ -5861,27 +6470,7 @@ got_code_from_term(code, len) { /* Color count is not a key code. */ i = atoi((char *)str); - if (i != t_colors) - { - /* Nr of colors changed, initialize highlighting and - * redraw everything. This causes a redraw, which usually - * clears the message. Try keeping the message if it - * might work. */ - set_keep_msg_from_hist(); - set_color_count(i); - init_highlight(TRUE, FALSE); -#ifdef DEBUG_TERMRESPONSE - { - char buf[100]; - int r = redraw_asap(CLEAR); - - sprintf(buf, "Received t_Co, redraw_asap(): %d", r); - log_tr(buf); - } -#else - redraw_asap(CLEAR); -#endif - } + may_adjust_color_count(i); } else { @@ -5906,7 +6495,7 @@ got_code_from_term(code, len) * handled as typed text. */ static void -check_for_codes_from_term() +check_for_codes_from_term(void) { int c; @@ -5958,9 +6547,9 @@ check_for_codes_from_term() * Returns NULL when there is a problem. */ char_u * -translate_mapping(str, expmap) - char_u *str; - int expmap; /* TRUE when expanding mappings on command-line */ +translate_mapping( + char_u *str, + int expmap) /* TRUE when expanding mappings on command-line */ { garray_T ga; int c; @@ -6048,8 +6637,7 @@ static char ksmd_str[20]; * For Win32 console: update termcap codes for existing console attributes. */ void -update_tcap(attr) - int attr; +update_tcap(int attr) { struct builtin_term *p; @@ -6071,4 +6659,403 @@ update_tcap(attr) ++p; } } + +# ifdef FEAT_TERMGUICOLORS +# define KSSIZE 20 +struct ks_tbl_s +{ + int code; /* value of KS_ */ + char *vtp; /* code in vtp mode */ + char *vtp2; /* code in vtp2 mode */ + char buf[KSSIZE]; /* save buffer in non-vtp mode */ + char vbuf[KSSIZE]; /* save buffer in vtp mode */ + char v2buf[KSSIZE]; /* save buffer in vtp2 mode */ + char arr[KSSIZE]; /* real buffer */ +}; + +static struct ks_tbl_s ks_tbl[] = +{ + {(int)KS_ME, "\033|0m", "\033|0m"}, /* normal */ + {(int)KS_MR, "\033|7m", "\033|7m"}, /* reverse */ + {(int)KS_MD, "\033|1m", "\033|1m"}, /* bold */ + {(int)KS_SO, "\033|91m", "\033|91m"}, /* standout: bright red text */ + {(int)KS_SE, "\033|39m", "\033|39m"}, /* standout end: default color */ + {(int)KS_CZH, "\033|95m", "\033|95m"}, /* italic: bright magenta text */ + {(int)KS_CZR, "\033|0m", "\033|0m"}, /* italic end */ + {(int)KS_US, "\033|4m", "\033|4m"}, /* underscore */ + {(int)KS_UE, "\033|24m", "\033|24m"}, /* underscore end */ +# ifdef TERMINFO + {(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm"}, /* set background color */ + {(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm"}, /* set foreground color */ +# else + {(int)KS_CAB, "\033|%db", "\033|4%dm"}, /* set background color */ + {(int)KS_CAF, "\033|%df", "\033|3%dm"}, /* set foreground color */ +# endif + {(int)KS_CCO, "16", "256"}, /* colors */ + {(int)KS_NAME} /* terminator */ +}; + + static struct builtin_term * +find_first_tcap( + char_u *name, + int code) +{ + struct builtin_term *p; + + for (p = find_builtin_term(name); p->bt_string != NULL; ++p) + if (p->bt_entry == code) + return p; + return NULL; +} +# endif + +/* + * For Win32 console: replace the sequence immediately after termguicolors. + */ + void +swap_tcap(void) +{ +# ifdef FEAT_TERMGUICOLORS + static int init_done = FALSE; + static int curr_mode; + struct ks_tbl_s *ks; + struct builtin_term *bt; + int mode; + enum + { + CMODEINDEX, + CMODE24, + CMODE256 + }; + + /* buffer initialization */ + if (!init_done) + { + for (ks = ks_tbl; ks->code != (int)KS_NAME; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + STRNCPY(ks->buf, bt->bt_string, KSSIZE); + STRNCPY(ks->vbuf, ks->vtp, KSSIZE); + STRNCPY(ks->v2buf, ks->vtp2, KSSIZE); + + STRNCPY(ks->arr, bt->bt_string, KSSIZE); + bt->bt_string = &ks->arr[0]; + } + } + init_done = TRUE; + curr_mode = CMODEINDEX; + } + + if (p_tgc) + mode = CMODE24; + else if (t_colors >= 256) + mode = CMODE256; + else + mode = CMODEINDEX; + + for (ks = ks_tbl; ks->code != (int)KS_NAME; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + switch (curr_mode) + { + case CMODEINDEX: + STRNCPY(&ks->buf[0], bt->bt_string, KSSIZE); + break; + case CMODE24: + STRNCPY(&ks->vbuf[0], bt->bt_string, KSSIZE); + break; + default: + STRNCPY(&ks->v2buf[0], bt->bt_string, KSSIZE); + } + } + } + + if (mode != curr_mode) + { + for (ks = ks_tbl; ks->code != (int)KS_NAME; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + switch (mode) + { + case CMODEINDEX: + STRNCPY(bt->bt_string, &ks->buf[0], KSSIZE); + break; + case CMODE24: + STRNCPY(bt->bt_string, &ks->vbuf[0], KSSIZE); + break; + default: + STRNCPY(bt->bt_string, &ks->v2buf[0], KSSIZE); + } + } + } + + curr_mode = mode; + } +# endif +} + +#endif + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) + static int +hex_digit(int c) +{ + if (isdigit(c)) + return c - '0'; + c = TOLOWER_ASC(c); + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + return 0x1ffffff; +} + + guicolor_T +gui_get_color_cmn(char_u *name) +{ + /* On MS-Windows an RGB macro is available and it produces 0x00bbggrr color + * values as used by the MS-Windows GDI api. It should be used only for + * MS-Windows GDI builds. */ +# if defined(RGB) && defined(WIN32) && !defined(FEAT_GUI) +# undef RGB +# endif +# ifndef RGB +# define RGB(r, g, b) ((r<<16) | (g<<8) | (b)) +# endif +# define LINE_LEN 100 + FILE *fd; + char line[LINE_LEN]; + char_u *fname; + int r, g, b, i; + guicolor_T color; + + struct rgbcolor_table_S { + char_u *color_name; + guicolor_T color; + }; + + /* Only non X11 colors (not present in rgb.txt) and colors in + * color_names[], useful when $VIMRUNTIME is not found,. */ + static struct rgbcolor_table_S rgb_table[] = { + {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, + {(char_u *)"blue", RGB(0x00, 0x00, 0xFF)}, + {(char_u *)"brown", RGB(0xA5, 0x2A, 0x2A)}, + {(char_u *)"cyan", RGB(0x00, 0xFF, 0xFF)}, + {(char_u *)"darkblue", RGB(0x00, 0x00, 0x8B)}, + {(char_u *)"darkcyan", RGB(0x00, 0x8B, 0x8B)}, + {(char_u *)"darkgray", RGB(0xA9, 0xA9, 0xA9)}, + {(char_u *)"darkgreen", RGB(0x00, 0x64, 0x00)}, + {(char_u *)"darkgrey", RGB(0xA9, 0xA9, 0xA9)}, + {(char_u *)"darkmagenta", RGB(0x8B, 0x00, 0x8B)}, + {(char_u *)"darkred", RGB(0x8B, 0x00, 0x00)}, + {(char_u *)"darkyellow", RGB(0x8B, 0x8B, 0x00)}, /* No X11 */ + {(char_u *)"gray", RGB(0xBE, 0xBE, 0xBE)}, + {(char_u *)"green", RGB(0x00, 0xFF, 0x00)}, + {(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)}, + {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, + {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, + {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, + {(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)}, + {(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)}, + {(char_u *)"lightgray", RGB(0xD3, 0xD3, 0xD3)}, + {(char_u *)"lightgreen", RGB(0x90, 0xEE, 0x90)}, + {(char_u *)"lightgrey", RGB(0xD3, 0xD3, 0xD3)}, + {(char_u *)"lightmagenta", RGB(0xFF, 0x8B, 0xFF)}, /* No X11 */ + {(char_u *)"lightred", RGB(0xFF, 0x8B, 0x8B)}, /* No X11 */ + {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xE0)}, + {(char_u *)"magenta", RGB(0xFF, 0x00, 0xFF)}, + {(char_u *)"red", RGB(0xFF, 0x00, 0x00)}, + {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)}, + {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)}, + {(char_u *)"yellow", RGB(0xFF, 0xFF, 0x00)}, + }; + + static struct rgbcolor_table_S *colornames_table; + static int size = 0; + + if (name[0] == '#' && STRLEN(name) == 7) + { + /* Name is in "#rrggbb" format */ + color = RGB(((hex_digit(name[1]) << 4) + hex_digit(name[2])), + ((hex_digit(name[3]) << 4) + hex_digit(name[4])), + ((hex_digit(name[5]) << 4) + hex_digit(name[6]))); + if (color > 0xffffff) + return INVALCOLOR; + return color; + } + + /* Check if the name is one of the colors we know */ + for (i = 0; i < (int)(sizeof(rgb_table) / sizeof(rgb_table[0])); i++) + if (STRICMP(name, rgb_table[i].color_name) == 0) + return rgb_table[i].color; + + /* + * Last attempt. Look in the file "$VIM/rgb.txt". + */ + if (size == 0) + { + int counting; + + /* colornames_table not yet initialized */ + fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); + if (fname == NULL) + return INVALCOLOR; + + fd = fopen((char *)fname, "rt"); + vim_free(fname); + if (fd == NULL) + { + if (p_verbose > 1) + verb_msg((char_u *)_("Cannot open $VIMRUNTIME/rgb.txt")); + return INVALCOLOR; + } + + for (counting = 1; counting >= 0; --counting) + { + if (!counting) + { + colornames_table = (struct rgbcolor_table_S *)alloc( + (unsigned)(sizeof(struct rgbcolor_table_S) * size)); + if (colornames_table == NULL) + { + fclose(fd); + return INVALCOLOR; + } + rewind(fd); + } + size = 0; + + while (!feof(fd)) + { + size_t len; + int pos; + + ignoredp = fgets(line, LINE_LEN, fd); + len = strlen(line); + + if (len <= 1 || line[len - 1] != '\n') + continue; + + line[len - 1] = '\0'; + + i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); + if (i != 3) + continue; + + if (!counting) + { + char_u *s = vim_strsave((char_u *)line + pos); + + if (s == NULL) + { + fclose(fd); + return INVALCOLOR; + } + colornames_table[size].color_name = s; + colornames_table[size].color = (guicolor_T)RGB(r, g, b); + } + size++; + } + } + fclose(fd); + } + + for (i = 0; i < size; i++) + if (STRICMP(name, colornames_table[i].color_name) == 0) + return colornames_table[i].color; + + return INVALCOLOR; +} + + guicolor_T +gui_get_rgb_color_cmn(int r, int g, int b) +{ + guicolor_T color = RGB(r, g, b); + + if (color > 0xffffff) + return INVALCOLOR; + return color; +} +#endif + +#if (defined(WIN3264) && !defined(FEAT_GUI_W32)) || defined(FEAT_TERMINAL) \ + || defined(PROTO) +static int cube_value[] = { + 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF +}; + +static int grey_ramp[] = { + 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, + 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE +}; + +# ifdef FEAT_TERMINAL +# include "libvterm/include/vterm.h" // for VTERM_ANSI_INDEX_NONE +# else +# define VTERM_ANSI_INDEX_NONE 0 +# endif + +static char_u ansi_table[16][4] = { +// R G B idx + { 0, 0, 0, 1}, // black + {224, 0, 0, 2}, // dark red + { 0, 224, 0, 3}, // dark green + {224, 224, 0, 4}, // dark yellow / brown + { 0, 0, 224, 5}, // dark blue + {224, 0, 224, 6}, // dark magenta + { 0, 224, 224, 7}, // dark cyan + {224, 224, 224, 8}, // light grey + + {128, 128, 128, 9}, // dark grey + {255, 64, 64, 10}, // light red + { 64, 255, 64, 11}, // light green + {255, 255, 64, 12}, // yellow + { 64, 64, 255, 13}, // light blue + {255, 64, 255, 14}, // light magenta + { 64, 255, 255, 15}, // light cyan + {255, 255, 255, 16}, // white +}; + + void +cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx) +{ + int idx; + + if (nr < 16) + { + *r = ansi_table[nr][0]; + *g = ansi_table[nr][1]; + *b = ansi_table[nr][2]; + *ansi_idx = ansi_table[nr][3]; + } + else if (nr < 232) + { + /* 216 color cube */ + idx = nr - 16; + *r = cube_value[idx / 36 % 6]; + *g = cube_value[idx / 6 % 6]; + *b = cube_value[idx % 6]; + *ansi_idx = VTERM_ANSI_INDEX_NONE; + } + else if (nr < 256) + { + /* 24 grey scale ramp */ + idx = nr - 232; + *r = grey_ramp[idx]; + *g = grey_ramp[idx]; + *b = grey_ramp[idx]; + *ansi_idx = VTERM_ANSI_INDEX_NONE; + } + else + { + *r = 0; + *g = 0; + *b = 0; + *ansi_idx = 0; + } +} #endif diff --git a/src/term.h b/src/term.h index 22b60b1335..8808f7db18 100644 --- a/src/term.h +++ b/src/term.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -39,7 +39,11 @@ enum SpecialKey KS_DB, /* text may be scrolled up from down */ KS_VI, /* cursor invisible */ KS_VE, /* cursor visible */ - KS_VS, /* cursor very visible */ + KS_VS, /* cursor very visible (blink) */ + KS_CVS, /* cursor normally visible (no blink) */ + KS_CSH, /* cursor shape */ + KS_CRC, /* request cursor blinking */ + KS_CRS, /* request cursor style */ KS_ME, /* normal mode */ KS_MR, /* reverse mode */ KS_MD, /* bold mode */ @@ -51,6 +55,8 @@ enum SpecialKey KS_US, /* underscore (underline) mode */ KS_UCE, /* exit undercurl mode */ KS_UCS, /* undercurl mode */ + KS_STE, /* exit strikethrough mode */ + KS_STS, /* strikethrough mode */ KS_MS, /* save to move cur in reverse mode */ KS_CM, /* cursor motion */ KS_SR, /* scroll reverse (backward) */ @@ -66,6 +72,7 @@ enum SpecialKey KS_CSF, /* set foreground color */ KS_CSB, /* set background color */ KS_XS, /* standout not erased by overwriting (hpterm) */ + KS_XN, /* newline glitch */ KS_MB, /* blink mode */ KS_CAF, /* set foreground color (ANSI) */ KS_CAB, /* set background color (ANSI) */ @@ -73,21 +80,31 @@ enum SpecialKey KS_ND, /* cursor right */ KS_CIS, /* set icon text start */ KS_CIE, /* set icon text end */ + KS_CSC, /* set cursor color start */ + KS_CEC, /* set cursor color end */ KS_TS, /* set window title start (to status line)*/ KS_FS, /* set window title end (from status line) */ KS_CWP, /* set window position in pixels */ + KS_CGP, /* get window position */ KS_CWS, /* set window size in characters */ KS_CRV, /* request version string */ + KS_RFG, /* request foreground color */ + KS_RBG, /* request background color */ KS_CSI, /* start insert mode (bar cursor) */ KS_CEI, /* end insert mode (block cursor) */ -#ifdef FEAT_VERTSPLIT + KS_CSR, /* start replace mode (underline cursor) */ KS_CSV, /* scroll region vertical */ -#endif KS_OP, /* original color pair */ - KS_U7 /* request cursor position */ + KS_U7, /* request cursor position */ + KS_8F, /* set foreground color (RGB) */ + KS_8B, /* set background color (RGB) */ + KS_CBE, /* enable bracketed paste mode */ + KS_CBD, /* disable bracketed paste mode */ + KS_CPS, /* start of bracketed paste */ + KS_CPE /* end of bracketed paste */ }; -#define KS_LAST KS_U7 +#define KS_LAST KS_CPE /* * the terminal capabilities are stored in this array @@ -102,64 +119,83 @@ extern char_u *(term_strings[]); /* current terminal strings */ /* * strings used for terminal */ -#define T_NAME (term_str(KS_NAME)) /* terminal name */ -#define T_CE (term_str(KS_CE)) /* clear to end of line */ -#define T_AL (term_str(KS_AL)) /* add new blank line */ -#define T_CAL (term_str(KS_CAL)) /* add number of blank lines */ -#define T_DL (term_str(KS_DL)) /* delete line */ -#define T_CDL (term_str(KS_CDL)) /* delete number of lines */ -#define T_CS (term_str(KS_CS)) /* scroll region */ -#define T_CSV (term_str(KS_CSV)) /* scroll region vertical */ -#define T_CL (term_str(KS_CL)) /* clear screen */ -#define T_CD (term_str(KS_CD)) /* clear to end of display */ -#define T_UT (term_str(KS_UT)) /* clearing uses background color */ -#define T_DA (term_str(KS_DA)) /* text may be scrolled down from up */ -#define T_DB (term_str(KS_DB)) /* text may be scrolled up from down */ -#define T_VI (term_str(KS_VI)) /* cursor invisible */ -#define T_VE (term_str(KS_VE)) /* cursor visible */ -#define T_VS (term_str(KS_VS)) /* cursor very visible */ -#define T_ME (term_str(KS_ME)) /* normal mode */ -#define T_MR (term_str(KS_MR)) /* reverse mode */ -#define T_MD (term_str(KS_MD)) /* bold mode */ -#define T_SE (term_str(KS_SE)) /* normal mode */ -#define T_SO (term_str(KS_SO)) /* standout mode */ -#define T_CZH (term_str(KS_CZH)) /* italic mode start */ -#define T_CZR (term_str(KS_CZR)) /* italic mode end */ -#define T_UE (term_str(KS_UE)) /* exit underscore (underline) mode */ -#define T_US (term_str(KS_US)) /* underscore (underline) mode */ -#define T_UCE (term_str(KS_UCE)) /* exit undercurl mode */ -#define T_UCS (term_str(KS_UCS)) /* undercurl mode */ -#define T_MS (term_str(KS_MS)) /* save to move cur in reverse mode */ -#define T_CM (term_str(KS_CM)) /* cursor motion */ -#define T_SR (term_str(KS_SR)) /* scroll reverse (backward) */ -#define T_CRI (term_str(KS_CRI)) /* cursor number of chars right */ -#define T_VB (term_str(KS_VB)) /* visual bell */ -#define T_KS (term_str(KS_KS)) /* put term in "keypad transmit" mode */ -#define T_KE (term_str(KS_KE)) /* out of "keypad transmit" mode */ -#define T_TI (term_str(KS_TI)) /* put terminal in termcap mode */ -#define T_TE (term_str(KS_TE)) /* out of termcap mode */ -#define T_BC (term_str(KS_BC)) /* backspace character */ -#define T_CCS (term_str(KS_CCS)) /* cur is relative to scroll region */ -#define T_CCO (term_str(KS_CCO)) /* number of colors */ -#define T_CSF (term_str(KS_CSF)) /* set foreground color */ -#define T_CSB (term_str(KS_CSB)) /* set background color */ -#define T_XS (term_str(KS_XS)) /* standout not erased by overwriting */ -#define T_MB (term_str(KS_MB)) /* blink mode */ -#define T_CAF (term_str(KS_CAF)) /* set foreground color (ANSI) */ -#define T_CAB (term_str(KS_CAB)) /* set background color (ANSI) */ -#define T_LE (term_str(KS_LE)) /* cursor left */ -#define T_ND (term_str(KS_ND)) /* cursor right */ -#define T_CIS (term_str(KS_CIS)) /* set icon text start */ -#define T_CIE (term_str(KS_CIE)) /* set icon text end */ -#define T_TS (term_str(KS_TS)) /* set window title start */ -#define T_FS (term_str(KS_FS)) /* set window title end */ -#define T_CWP (term_str(KS_CWP)) /* window position */ -#define T_CWS (term_str(KS_CWS)) /* window size */ -#define T_CSI (term_str(KS_CSI)) /* start insert mode */ -#define T_CEI (term_str(KS_CEI)) /* end insert mode */ -#define T_CRV (term_str(KS_CRV)) /* request version string */ -#define T_OP (term_str(KS_OP)) /* original color pair */ -#define T_U7 (term_str(KS_U7)) /* request cursor position */ +#define T_NAME (TERM_STR(KS_NAME)) /* terminal name */ +#define T_CE (TERM_STR(KS_CE)) /* clear to end of line */ +#define T_AL (TERM_STR(KS_AL)) /* add new blank line */ +#define T_CAL (TERM_STR(KS_CAL)) /* add number of blank lines */ +#define T_DL (TERM_STR(KS_DL)) /* delete line */ +#define T_CDL (TERM_STR(KS_CDL)) /* delete number of lines */ +#define T_CS (TERM_STR(KS_CS)) /* scroll region */ +#define T_CSV (TERM_STR(KS_CSV)) /* scroll region vertical */ +#define T_CL (TERM_STR(KS_CL)) /* clear screen */ +#define T_CD (TERM_STR(KS_CD)) /* clear to end of display */ +#define T_UT (TERM_STR(KS_UT)) /* clearing uses background color */ +#define T_DA (TERM_STR(KS_DA)) /* text may be scrolled down from up */ +#define T_DB (TERM_STR(KS_DB)) /* text may be scrolled up from down */ +#define T_VI (TERM_STR(KS_VI)) /* cursor invisible */ +#define T_VE (TERM_STR(KS_VE)) /* cursor visible */ +#define T_VS (TERM_STR(KS_VS)) /* cursor very visible (blink) */ +#define T_CVS (TERM_STR(KS_CVS)) /* cursor normally visible (no blink) */ +#define T_CSH (TERM_STR(KS_CSH)) /* cursor shape */ +#define T_CRC (TERM_STR(KS_CRC)) /* request cursor blinking */ +#define T_CRS (TERM_STR(KS_CRS)) /* request cursor style */ +#define T_ME (TERM_STR(KS_ME)) /* normal mode */ +#define T_MR (TERM_STR(KS_MR)) /* reverse mode */ +#define T_MD (TERM_STR(KS_MD)) /* bold mode */ +#define T_SE (TERM_STR(KS_SE)) /* normal mode */ +#define T_SO (TERM_STR(KS_SO)) /* standout mode */ +#define T_CZH (TERM_STR(KS_CZH)) /* italic mode start */ +#define T_CZR (TERM_STR(KS_CZR)) /* italic mode end */ +#define T_UE (TERM_STR(KS_UE)) /* exit underscore (underline) mode */ +#define T_US (TERM_STR(KS_US)) /* underscore (underline) mode */ +#define T_UCE (TERM_STR(KS_UCE)) /* exit undercurl mode */ +#define T_UCS (TERM_STR(KS_UCS)) /* undercurl mode */ +#define T_STE (TERM_STR(KS_STE)) /* exit strikethrough mode */ +#define T_STS (TERM_STR(KS_STS)) /* strikethrough mode */ +#define T_MS (TERM_STR(KS_MS)) /* save to move cur in reverse mode */ +#define T_CM (TERM_STR(KS_CM)) /* cursor motion */ +#define T_SR (TERM_STR(KS_SR)) /* scroll reverse (backward) */ +#define T_CRI (TERM_STR(KS_CRI)) /* cursor number of chars right */ +#define T_VB (TERM_STR(KS_VB)) /* visual bell */ +#define T_KS (TERM_STR(KS_KS)) /* put term in "keypad transmit" mode */ +#define T_KE (TERM_STR(KS_KE)) /* out of "keypad transmit" mode */ +#define T_TI (TERM_STR(KS_TI)) /* put terminal in termcap mode */ +#define T_TE (TERM_STR(KS_TE)) /* out of termcap mode */ +#define T_BC (TERM_STR(KS_BC)) /* backspace character */ +#define T_CCS (TERM_STR(KS_CCS)) /* cur is relative to scroll region */ +#define T_CCO (TERM_STR(KS_CCO)) /* number of colors */ +#define T_CSF (TERM_STR(KS_CSF)) /* set foreground color */ +#define T_CSB (TERM_STR(KS_CSB)) /* set background color */ +#define T_XS (TERM_STR(KS_XS)) /* standout not erased by overwriting */ +#define T_XN (TERM_STR(KS_XN)) /* newline glitch */ +#define T_MB (TERM_STR(KS_MB)) /* blink mode */ +#define T_CAF (TERM_STR(KS_CAF)) /* set foreground color (ANSI) */ +#define T_CAB (TERM_STR(KS_CAB)) /* set background color (ANSI) */ +#define T_LE (TERM_STR(KS_LE)) /* cursor left */ +#define T_ND (TERM_STR(KS_ND)) /* cursor right */ +#define T_CIS (TERM_STR(KS_CIS)) /* set icon text start */ +#define T_CIE (TERM_STR(KS_CIE)) /* set icon text end */ +#define T_TS (TERM_STR(KS_TS)) /* set window title start */ +#define T_FS (TERM_STR(KS_FS)) /* set window title end */ +#define T_CSC (TERM_STR(KS_CSC)) /* set cursor color start */ +#define T_CEC (TERM_STR(KS_CEC)) /* set cursor color end */ +#define T_CWP (TERM_STR(KS_CWP)) /* set window position */ +#define T_CGP (TERM_STR(KS_CGP)) /* get window position */ +#define T_CWS (TERM_STR(KS_CWS)) /* window size */ +#define T_CSI (TERM_STR(KS_CSI)) /* start insert mode */ +#define T_CEI (TERM_STR(KS_CEI)) /* end insert mode */ +#define T_CSR (TERM_STR(KS_CSR)) /* start replace mode */ +#define T_CRV (TERM_STR(KS_CRV)) /* request version string */ +#define T_RFG (TERM_STR(KS_RFG)) /* request foreground RGB */ +#define T_RBG (TERM_STR(KS_RBG)) /* request background RGB */ +#define T_OP (TERM_STR(KS_OP)) /* original color pair */ +#define T_U7 (TERM_STR(KS_U7)) /* request cursor position */ +#define T_8F (TERM_STR(KS_8F)) /* set foreground color (RGB) */ +#define T_8B (TERM_STR(KS_8B)) /* set background color (RGB) */ +#define T_BE (TERM_STR(KS_CBE)) /* enable bracketed paste mode */ +#define T_BD (TERM_STR(KS_CBD)) /* disable bracketed paste mode */ +#define T_PS (TERM_STR(KS_CPS)) /* start of bracketed paste */ +#define T_PE (TERM_STR(KS_CPE)) /* end of bracketed paste */ #define TMODE_COOK 0 /* terminal mode for external cmds and Ex mode */ #define TMODE_SLEEP 1 /* terminal mode for sleeping (cooked but no echo) */ diff --git a/src/terminal.c b/src/terminal.c new file mode 100644 index 0000000000..b622de5cc2 --- /dev/null +++ b/src/terminal.c @@ -0,0 +1,5843 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * Terminal window support, see ":help :terminal". + * + * There are three parts: + * 1. Generic code for all systems. + * Uses libvterm for the terminal emulator. + * 2. The MS-Windows implementation. + * Uses winpty. + * 3. The Unix-like implementation. + * Uses pseudo-tty's (pty's). + * + * For each terminal one VTerm is constructed. This uses libvterm. A copy of + * this library is in the libvterm directory. + * + * When a terminal window is opened, a job is started that will be connected to + * the terminal emulator. + * + * If the terminal window has keyboard focus, typed keys are converted to the + * terminal encoding and writing to the job over a channel. + * + * If the job produces output, it is written to the terminal emulator. The + * terminal emulator invokes callbacks when its screen content changes. The + * line range is stored in tl_dirty_row_start and tl_dirty_row_end. Once in a + * while, if the terminal window is visible, the screen contents is drawn. + * + * When the job ends the text is put in a buffer. Redrawing then happens from + * that buffer, attributes come from the scrollback buffer tl_scrollback. + * When the buffer is changed it is turned into a normal buffer, the attributes + * in tl_scrollback are no longer used. + */ + +#include "vim.h" + +#if defined(FEAT_TERMINAL) || defined(PROTO) + +#ifndef MIN +# define MIN(x,y) ((x) < (y) ? (x) : (y)) +#endif +#ifndef MAX +# define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif + +#include "libvterm/include/vterm.h" + +/* This is VTermScreenCell without the characters, thus much smaller. */ +typedef struct { + VTermScreenCellAttrs attrs; + char width; + VTermColor fg; + VTermColor bg; +} cellattr_T; + +typedef struct sb_line_S { + int sb_cols; /* can differ per line */ + cellattr_T *sb_cells; /* allocated */ + cellattr_T sb_fill_attr; /* for short line */ +} sb_line_T; + +/* typedef term_T in structs.h */ +struct terminal_S { + term_T *tl_next; + + VTerm *tl_vterm; + job_T *tl_job; + buf_T *tl_buffer; +#if defined(FEAT_GUI) + int tl_system; /* when non-zero used for :!cmd output */ + int tl_toprow; /* row with first line of system terminal */ +#endif + + /* Set when setting the size of a vterm, reset after redrawing. */ + int tl_vterm_size_changed; + + int tl_normal_mode; /* TRUE: Terminal-Normal mode */ + int tl_channel_closed; + int tl_channel_recently_closed; // still need to handle tl_finish + + int tl_finish; +#define TL_FINISH_UNSET NUL +#define TL_FINISH_CLOSE 'c' /* ++close or :terminal without argument */ +#define TL_FINISH_NOCLOSE 'n' /* ++noclose */ +#define TL_FINISH_OPEN 'o' /* ++open */ + char_u *tl_opencmd; + char_u *tl_eof_chars; + +#ifdef WIN3264 + void *tl_winpty_config; + void *tl_winpty; + + FILE *tl_out_fd; +#endif +#if defined(FEAT_SESSION) + char_u *tl_command; +#endif + char_u *tl_kill; + + /* last known vterm size */ + int tl_rows; + int tl_cols; + + char_u *tl_title; /* NULL or allocated */ + char_u *tl_status_text; /* NULL or allocated */ + + /* Range of screen rows to update. Zero based. */ + int tl_dirty_row_start; /* MAX_ROW if nothing dirty */ + int tl_dirty_row_end; /* row below last one to update */ + int tl_dirty_snapshot; /* text updated after making snapshot */ +#ifdef FEAT_TIMERS + int tl_timer_set; + proftime_T tl_timer_due; +#endif + int tl_postponed_scroll; /* to be scrolled up */ + + garray_T tl_scrollback; + int tl_scrollback_scrolled; + cellattr_T tl_default_color; + + linenr_T tl_top_diff_rows; /* rows of top diff file or zero */ + linenr_T tl_bot_diff_rows; /* rows of bottom diff file */ + + VTermPos tl_cursor_pos; + int tl_cursor_visible; + int tl_cursor_blink; + int tl_cursor_shape; /* 1: block, 2: underline, 3: bar */ + char_u *tl_cursor_color; /* NULL or allocated */ + + int tl_using_altscreen; +}; + +#define TMODE_ONCE 1 /* CTRL-\ CTRL-N used */ +#define TMODE_LOOP 2 /* CTRL-W N used */ + +/* + * List of all active terminals. + */ +static term_T *first_term = NULL; + +/* Terminal active in terminal_loop(). */ +static term_T *in_terminal_loop = NULL; + +#define MAX_ROW 999999 /* used for tl_dirty_row_end to update all rows */ +#define KEY_BUF_LEN 200 + +/* + * Functions with separate implementation for MS-Windows and Unix-like systems. + */ +static int term_and_job_init(term_T *term, typval_T *argvar, char **argv, jobopt_T *opt, jobopt_T *orig_opt); +static int create_pty_only(term_T *term, jobopt_T *opt); +static void term_report_winsize(term_T *term, int rows, int cols); +static void term_free_vterm(term_T *term); +#ifdef FEAT_GUI +static void update_system_term(term_T *term); +#endif + +/* The character that we know (or assume) that the terminal expects for the + * backspace key. */ +static int term_backspace_char = BS; + +/* "Terminal" highlight group colors. */ +static int term_default_cterm_fg = -1; +static int term_default_cterm_bg = -1; + +/* Store the last set and the desired cursor properties, so that we only update + * them when needed. Doing it unnecessary may result in flicker. */ +static char_u *last_set_cursor_color = NULL; +static char_u *desired_cursor_color = NULL; +static int last_set_cursor_shape = -1; +static int desired_cursor_shape = -1; +static int last_set_cursor_blink = -1; +static int desired_cursor_blink = -1; + + +/************************************** + * 1. Generic code for all systems. + */ + + static int +cursor_color_equal(char_u *lhs_color, char_u *rhs_color) +{ + if (lhs_color != NULL && rhs_color != NULL) + return STRCMP(lhs_color, rhs_color) == 0; + return lhs_color == NULL && rhs_color == NULL; +} + + static void +cursor_color_copy(char_u **to_color, char_u *from_color) +{ + // Avoid a free & alloc if the value is already right. + if (cursor_color_equal(*to_color, from_color)) + return; + vim_free(*to_color); + *to_color = (from_color == NULL) ? NULL : vim_strsave(from_color); +} + + static char_u * +cursor_color_get(char_u *color) +{ + return (color == NULL) ? (char_u *)"" : color; +} + + +/* + * Parse 'termwinsize' and set "rows" and "cols" for the terminal size in the + * current window. + * Sets "rows" and/or "cols" to zero when it should follow the window size. + * Return TRUE if the size is the minimum size: "24*80". + */ + static int +parse_termwinsize(win_T *wp, int *rows, int *cols) +{ + int minsize = FALSE; + + *rows = 0; + *cols = 0; + + if (*wp->w_p_tws != NUL) + { + char_u *p = vim_strchr(wp->w_p_tws, 'x'); + + /* Syntax of value was already checked when it's set. */ + if (p == NULL) + { + minsize = TRUE; + p = vim_strchr(wp->w_p_tws, '*'); + } + *rows = atoi((char *)wp->w_p_tws); + *cols = atoi((char *)p + 1); + } + return minsize; +} + +/* + * Determine the terminal size from 'termwinsize' and the current window. + */ + static void +set_term_and_win_size(term_T *term) +{ +#ifdef FEAT_GUI + if (term->tl_system) + { + /* Use the whole screen for the system command. However, it will start + * at the command line and scroll up as needed, using tl_toprow. */ + term->tl_rows = Rows; + term->tl_cols = Columns; + return; + } +#endif + if (parse_termwinsize(curwin, &term->tl_rows, &term->tl_cols)) + { + if (term->tl_rows != 0) + term->tl_rows = MAX(term->tl_rows, curwin->w_height); + if (term->tl_cols != 0) + term->tl_cols = MAX(term->tl_cols, curwin->w_width); + } + if (term->tl_rows == 0) + term->tl_rows = curwin->w_height; + else + win_setheight_win(term->tl_rows, curwin); + if (term->tl_cols == 0) + term->tl_cols = curwin->w_width; + else + win_setwidth_win(term->tl_cols, curwin); +} + +/* + * Initialize job options for a terminal job. + * Caller may overrule some of them. + */ + void +init_job_options(jobopt_T *opt) +{ + clear_job_options(opt); + + opt->jo_mode = MODE_RAW; + opt->jo_out_mode = MODE_RAW; + opt->jo_err_mode = MODE_RAW; + opt->jo_set = JO_MODE | JO_OUT_MODE | JO_ERR_MODE; +} + +/* + * Set job options mandatory for a terminal job. + */ + static void +setup_job_options(jobopt_T *opt, int rows, int cols) +{ +#ifndef WIN3264 + /* Win32: Redirecting the job output won't work, thus always connect stdout + * here. */ + if (!(opt->jo_set & JO_OUT_IO)) +#endif + { + /* Connect stdout to the terminal. */ + opt->jo_io[PART_OUT] = JIO_BUFFER; + opt->jo_io_buf[PART_OUT] = curbuf->b_fnum; + opt->jo_modifiable[PART_OUT] = 0; + opt->jo_set |= JO_OUT_IO + JO_OUT_BUF + JO_OUT_MODIFIABLE; + } + +#ifndef WIN3264 + /* Win32: Redirecting the job output won't work, thus always connect stderr + * here. */ + if (!(opt->jo_set & JO_ERR_IO)) +#endif + { + /* Connect stderr to the terminal. */ + opt->jo_io[PART_ERR] = JIO_BUFFER; + opt->jo_io_buf[PART_ERR] = curbuf->b_fnum; + opt->jo_modifiable[PART_ERR] = 0; + opt->jo_set |= JO_ERR_IO + JO_ERR_BUF + JO_ERR_MODIFIABLE; + } + + opt->jo_pty = TRUE; + if ((opt->jo_set2 & JO2_TERM_ROWS) == 0) + opt->jo_term_rows = rows; + if ((opt->jo_set2 & JO2_TERM_COLS) == 0) + opt->jo_term_cols = cols; +} + +/* + * Close a terminal buffer (and its window). Used when creating the terminal + * fails. + */ + static void +term_close_buffer(buf_T *buf, buf_T *old_curbuf) +{ + free_terminal(buf); + if (old_curbuf != NULL) + { + --curbuf->b_nwindows; + curbuf = old_curbuf; + curwin->w_buffer = curbuf; + ++curbuf->b_nwindows; + } + + /* Wiping out the buffer will also close the window and call + * free_terminal(). */ + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); +} + +/* + * Start a terminal window and return its buffer. + * Use either "argvar" or "argv", the other must be NULL. + * When "flags" has TERM_START_NOJOB only create the buffer, b_term and open + * the window. + * Returns NULL when failed. + */ + buf_T * +term_start( + typval_T *argvar, + char **argv, + jobopt_T *opt, + int flags) +{ + exarg_T split_ea; + win_T *old_curwin = curwin; + term_T *term; + buf_T *old_curbuf = NULL; + int res; + buf_T *newbuf; + int vertical = opt->jo_vertical || (cmdmod.split & WSP_VERT); + jobopt_T orig_opt; // only partly filled + + if (check_restricted() || check_secure()) + return NULL; + + if ((opt->jo_set & (JO_IN_IO + JO_OUT_IO + JO_ERR_IO)) + == (JO_IN_IO + JO_OUT_IO + JO_ERR_IO) + || (!(opt->jo_set & JO_OUT_IO) && (opt->jo_set & JO_OUT_BUF)) + || (!(opt->jo_set & JO_ERR_IO) && (opt->jo_set & JO_ERR_BUF))) + { + EMSG(_(e_invarg)); + return NULL; + } + + term = (term_T *)alloc_clear(sizeof(term_T)); + if (term == NULL) + return NULL; + term->tl_dirty_row_end = MAX_ROW; + term->tl_cursor_visible = TRUE; + term->tl_cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; + term->tl_finish = opt->jo_term_finish; +#ifdef FEAT_GUI + term->tl_system = (flags & TERM_START_SYSTEM); +#endif + ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300); + + vim_memset(&split_ea, 0, sizeof(split_ea)); + if (opt->jo_curwin) + { + /* Create a new buffer in the current window. */ + if (!can_abandon(curbuf, flags & TERM_START_FORCEIT)) + { + no_write_message(); + vim_free(term); + return NULL; + } + if (do_ecmd(0, NULL, NULL, &split_ea, ECMD_ONE, + ECMD_HIDE + + ((flags & TERM_START_FORCEIT) ? ECMD_FORCEIT : 0), + curwin) == FAIL) + { + vim_free(term); + return NULL; + } + } + else if (opt->jo_hidden || (flags & TERM_START_SYSTEM)) + { + buf_T *buf; + + /* Create a new buffer without a window. Make it the current buffer for + * a moment to be able to do the initialisations. */ + buf = buflist_new((char_u *)"", NULL, (linenr_T)0, + BLN_NEW | BLN_LISTED); + if (buf == NULL || ml_open(buf) == FAIL) + { + vim_free(term); + return NULL; + } + old_curbuf = curbuf; + --curbuf->b_nwindows; + curbuf = buf; + curwin->w_buffer = buf; + ++curbuf->b_nwindows; + } + else + { + /* Open a new window or tab. */ + split_ea.cmdidx = CMD_new; + split_ea.cmd = (char_u *)"new"; + split_ea.arg = (char_u *)""; + if (opt->jo_term_rows > 0 && !vertical) + { + split_ea.line2 = opt->jo_term_rows; + split_ea.addr_count = 1; + } + if (opt->jo_term_cols > 0 && vertical) + { + split_ea.line2 = opt->jo_term_cols; + split_ea.addr_count = 1; + } + + if (vertical) + cmdmod.split |= WSP_VERT; + ex_splitview(&split_ea); + if (curwin == old_curwin) + { + /* split failed */ + vim_free(term); + return NULL; + } + } + term->tl_buffer = curbuf; + curbuf->b_term = term; + + if (!opt->jo_hidden) + { + /* Only one size was taken care of with :new, do the other one. With + * "curwin" both need to be done. */ + if (opt->jo_term_rows > 0 && (opt->jo_curwin || vertical)) + win_setheight(opt->jo_term_rows); + if (opt->jo_term_cols > 0 && (opt->jo_curwin || !vertical)) + win_setwidth(opt->jo_term_cols); + } + + /* Link the new terminal in the list of active terminals. */ + term->tl_next = first_term; + first_term = term; + + if (opt->jo_term_name != NULL) + curbuf->b_ffname = vim_strsave(opt->jo_term_name); + else if (argv != NULL) + curbuf->b_ffname = vim_strsave((char_u *)"!system"); + else + { + int i; + size_t len; + char_u *cmd, *p; + + if (argvar->v_type == VAR_STRING) + { + cmd = argvar->vval.v_string; + if (cmd == NULL) + cmd = (char_u *)""; + else if (STRCMP(cmd, "NONE") == 0) + cmd = (char_u *)"pty"; + } + else if (argvar->v_type != VAR_LIST + || argvar->vval.v_list == NULL + || argvar->vval.v_list->lv_len < 1 + || (cmd = get_tv_string_chk( + &argvar->vval.v_list->lv_first->li_tv)) == NULL) + cmd = (char_u*)""; + + len = STRLEN(cmd) + 10; + p = alloc((int)len); + + for (i = 0; p != NULL; ++i) + { + /* Prepend a ! to the command name to avoid the buffer name equals + * the executable, otherwise ":w!" would overwrite it. */ + if (i == 0) + vim_snprintf((char *)p, len, "!%s", cmd); + else + vim_snprintf((char *)p, len, "!%s (%d)", cmd, i); + if (buflist_findname(p) == NULL) + { + vim_free(curbuf->b_ffname); + curbuf->b_ffname = p; + break; + } + } + } + curbuf->b_fname = curbuf->b_ffname; + + if (opt->jo_term_opencmd != NULL) + term->tl_opencmd = vim_strsave(opt->jo_term_opencmd); + + if (opt->jo_eof_chars != NULL) + term->tl_eof_chars = vim_strsave(opt->jo_eof_chars); + + set_string_option_direct((char_u *)"buftype", -1, + (char_u *)"terminal", OPT_FREE|OPT_LOCAL, 0); + + /* Mark the buffer as not modifiable. It can only be made modifiable after + * the job finished. */ + curbuf->b_p_ma = FALSE; + + set_term_and_win_size(term); +#ifdef WIN3264 + mch_memmove(orig_opt.jo_io, opt->jo_io, sizeof(orig_opt.jo_io)); +#endif + setup_job_options(opt, term->tl_rows, term->tl_cols); + + if (flags & TERM_START_NOJOB) + return curbuf; + +#if defined(FEAT_SESSION) + /* Remember the command for the session file. */ + if (opt->jo_term_norestore || argv != NULL) + { + term->tl_command = vim_strsave((char_u *)"NONE"); + } + else if (argvar->v_type == VAR_STRING) + { + char_u *cmd = argvar->vval.v_string; + + if (cmd != NULL && STRCMP(cmd, p_sh) != 0) + term->tl_command = vim_strsave(cmd); + } + else if (argvar->v_type == VAR_LIST + && argvar->vval.v_list != NULL + && argvar->vval.v_list->lv_len > 0) + { + garray_T ga; + listitem_T *item; + + ga_init2(&ga, 1, 100); + for (item = argvar->vval.v_list->lv_first; + item != NULL; item = item->li_next) + { + char_u *s = get_tv_string_chk(&item->li_tv); + char_u *p; + + if (s == NULL) + break; + p = vim_strsave_fnameescape(s, FALSE); + if (p == NULL) + break; + ga_concat(&ga, p); + vim_free(p); + ga_append(&ga, ' '); + } + if (item == NULL) + { + ga_append(&ga, NUL); + term->tl_command = ga.ga_data; + } + else + ga_clear(&ga); + } +#endif + + if (opt->jo_term_kill != NULL) + { + char_u *p = skiptowhite(opt->jo_term_kill); + + term->tl_kill = vim_strnsave(opt->jo_term_kill, p - opt->jo_term_kill); + } + + /* System dependent: setup the vterm and maybe start the job in it. */ + if (argv == NULL + && argvar->v_type == VAR_STRING + && argvar->vval.v_string != NULL + && STRCMP(argvar->vval.v_string, "NONE") == 0) + res = create_pty_only(term, opt); + else + res = term_and_job_init(term, argvar, argv, opt, &orig_opt); + + newbuf = curbuf; + if (res == OK) + { + /* Get and remember the size we ended up with. Update the pty. */ + vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); + term_report_winsize(term, term->tl_rows, term->tl_cols); +#ifdef FEAT_GUI + if (term->tl_system) + { + /* display first line below typed command */ + term->tl_toprow = msg_row + 1; + term->tl_dirty_row_end = 0; + } +#endif + + /* Make sure we don't get stuck on sending keys to the job, it leads to + * a deadlock if the job is waiting for Vim to read. */ + channel_set_nonblock(term->tl_job->jv_channel, PART_IN); + + if (old_curbuf != NULL) + { + --curbuf->b_nwindows; + curbuf = old_curbuf; + curwin->w_buffer = curbuf; + ++curbuf->b_nwindows; + } + } + else + { + term_close_buffer(curbuf, old_curbuf); + return NULL; + } + + apply_autocmds(EVENT_TERMINALOPEN, NULL, NULL, FALSE, newbuf); + return newbuf; +} + +/* + * ":terminal": open a terminal window and execute a job in it. + */ + void +ex_terminal(exarg_T *eap) +{ + typval_T argvar[2]; + jobopt_T opt; + char_u *cmd; + char_u *tofree = NULL; + + init_job_options(&opt); + + cmd = eap->arg; + while (*cmd == '+' && *(cmd + 1) == '+') + { + char_u *p, *ep; + + cmd += 2; + p = skiptowhite(cmd); + ep = vim_strchr(cmd, '='); + if (ep != NULL && ep < p) + p = ep; + + if ((int)(p - cmd) == 5 && STRNICMP(cmd, "close", 5) == 0) + opt.jo_term_finish = 'c'; + else if ((int)(p - cmd) == 7 && STRNICMP(cmd, "noclose", 7) == 0) + opt.jo_term_finish = 'n'; + else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "open", 4) == 0) + opt.jo_term_finish = 'o'; + else if ((int)(p - cmd) == 6 && STRNICMP(cmd, "curwin", 6) == 0) + opt.jo_curwin = 1; + else if ((int)(p - cmd) == 6 && STRNICMP(cmd, "hidden", 6) == 0) + opt.jo_hidden = 1; + else if ((int)(p - cmd) == 9 && STRNICMP(cmd, "norestore", 9) == 0) + opt.jo_term_norestore = 1; + else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "kill", 4) == 0 + && ep != NULL) + { + opt.jo_set2 |= JO2_TERM_KILL; + opt.jo_term_kill = ep + 1; + p = skiptowhite(cmd); + } + else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "rows", 4) == 0 + && ep != NULL && isdigit(ep[1])) + { + opt.jo_set2 |= JO2_TERM_ROWS; + opt.jo_term_rows = atoi((char *)ep + 1); + p = skiptowhite(cmd); + } + else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "cols", 4) == 0 + && ep != NULL && isdigit(ep[1])) + { + opt.jo_set2 |= JO2_TERM_COLS; + opt.jo_term_cols = atoi((char *)ep + 1); + p = skiptowhite(cmd); + } + else if ((int)(p - cmd) == 3 && STRNICMP(cmd, "eof", 3) == 0 + && ep != NULL) + { + char_u *buf = NULL; + char_u *keys; + + p = skiptowhite(cmd); + *p = NUL; + keys = replace_termcodes(ep + 1, &buf, TRUE, TRUE, TRUE); + opt.jo_set2 |= JO2_EOF_CHARS; + opt.jo_eof_chars = vim_strsave(keys); + vim_free(buf); + *p = ' '; + } + else + { + if (*p) + *p = NUL; + EMSG2(_("E181: Invalid attribute: %s"), cmd); + goto theend; + } + cmd = skipwhite(p); + } + if (*cmd == NUL) + { + /* Make a copy of 'shell', an autocommand may change the option. */ + tofree = cmd = vim_strsave(p_sh); + + /* default to close when the shell exits */ + if (opt.jo_term_finish == NUL) + opt.jo_term_finish = 'c'; + } + + if (eap->addr_count > 0) + { + /* Write lines from current buffer to the job. */ + opt.jo_set |= JO_IN_IO | JO_IN_BUF | JO_IN_TOP | JO_IN_BOT; + opt.jo_io[PART_IN] = JIO_BUFFER; + opt.jo_io_buf[PART_IN] = curbuf->b_fnum; + opt.jo_in_top = eap->line1; + opt.jo_in_bot = eap->line2; + } + + argvar[0].v_type = VAR_STRING; + argvar[0].vval.v_string = cmd; + argvar[1].v_type = VAR_UNKNOWN; + term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0); + vim_free(tofree); + +theend: + vim_free(opt.jo_eof_chars); +} + +#if defined(FEAT_SESSION) || defined(PROTO) +/* + * Write a :terminal command to the session file to restore the terminal in + * window "wp". + * Return FAIL if writing fails. + */ + int +term_write_session(FILE *fd, win_T *wp) +{ + term_T *term = wp->w_buffer->b_term; + + /* Create the terminal and run the command. This is not without + * risk, but let's assume the user only creates a session when this + * will be OK. */ + if (fprintf(fd, "terminal ++curwin ++cols=%d ++rows=%d ", + term->tl_cols, term->tl_rows) < 0) + return FAIL; + if (term->tl_command != NULL && fputs((char *)term->tl_command, fd) < 0) + return FAIL; + + return put_eol(fd); +} + +/* + * Return TRUE if "buf" has a terminal that should be restored. + */ + int +term_should_restore(buf_T *buf) +{ + term_T *term = buf->b_term; + + return term != NULL && (term->tl_command == NULL + || STRCMP(term->tl_command, "NONE") != 0); +} +#endif + +/* + * Free the scrollback buffer for "term". + */ + static void +free_scrollback(term_T *term) +{ + int i; + + for (i = 0; i < term->tl_scrollback.ga_len; ++i) + vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells); + ga_clear(&term->tl_scrollback); +} + +/* + * Free a terminal and everything it refers to. + * Kills the job if there is one. + * Called when wiping out a buffer. + */ + void +free_terminal(buf_T *buf) +{ + term_T *term = buf->b_term; + term_T *tp; + + if (term == NULL) + return; + if (first_term == term) + first_term = term->tl_next; + else + for (tp = first_term; tp->tl_next != NULL; tp = tp->tl_next) + if (tp->tl_next == term) + { + tp->tl_next = term->tl_next; + break; + } + + if (term->tl_job != NULL) + { + if (term->tl_job->jv_status != JOB_ENDED + && term->tl_job->jv_status != JOB_FINISHED + && term->tl_job->jv_status != JOB_FAILED) + job_stop(term->tl_job, NULL, "kill"); + job_unref(term->tl_job); + } + + free_scrollback(term); + + term_free_vterm(term); + vim_free(term->tl_title); +#ifdef FEAT_SESSION + vim_free(term->tl_command); +#endif + vim_free(term->tl_kill); + vim_free(term->tl_status_text); + vim_free(term->tl_opencmd); + vim_free(term->tl_eof_chars); +#ifdef WIN3264 + if (term->tl_out_fd != NULL) + fclose(term->tl_out_fd); +#endif + vim_free(term->tl_cursor_color); + vim_free(term); + buf->b_term = NULL; + if (in_terminal_loop == term) + in_terminal_loop = NULL; +} + +/* + * Get the part that is connected to the tty. Normally this is PART_IN, but + * when writing buffer lines to the job it can be another. This makes it + * possible to do "1,5term vim -". + */ + static ch_part_T +get_tty_part(term_T *term) +{ +#ifdef UNIX + ch_part_T parts[3] = {PART_IN, PART_OUT, PART_ERR}; + int i; + + for (i = 0; i < 3; ++i) + { + int fd = term->tl_job->jv_channel->ch_part[parts[i]].ch_fd; + + if (isatty(fd)) + return parts[i]; + } +#endif + return PART_IN; +} + +/* + * Write job output "msg[len]" to the vterm. + */ + static void +term_write_job_output(term_T *term, char_u *msg, size_t len) +{ + VTerm *vterm = term->tl_vterm; + size_t prevlen = vterm_output_get_buffer_current(vterm); + + vterm_input_write(vterm, (char *)msg, len); + + /* flush vterm buffer when vterm responded to control sequence */ + if (prevlen != vterm_output_get_buffer_current(vterm)) + { + char buf[KEY_BUF_LEN]; + size_t curlen = vterm_output_read(vterm, buf, KEY_BUF_LEN); + + if (curlen > 0) + channel_send(term->tl_job->jv_channel, get_tty_part(term), + (char_u *)buf, (int)curlen, NULL); + } + + /* this invokes the damage callbacks */ + vterm_screen_flush_damage(vterm_obtain_screen(vterm)); +} + + static void +update_cursor(term_T *term, int redraw) +{ + if (term->tl_normal_mode) + return; +#ifdef FEAT_GUI + if (term->tl_system) + windgoto(term->tl_cursor_pos.row + term->tl_toprow, + term->tl_cursor_pos.col); + else +#endif + setcursor(); + if (redraw) + { + if (term->tl_buffer == curbuf && term->tl_cursor_visible) + cursor_on(); + out_flush(); +#ifdef FEAT_GUI + if (gui.in_use) + { + gui_update_cursor(FALSE, FALSE); + gui_mch_flush(); + } +#endif + } +} + +/* + * Invoked when "msg" output from a job was received. Write it to the terminal + * of "buffer". + */ + void +write_to_term(buf_T *buffer, char_u *msg, channel_T *channel) +{ + size_t len = STRLEN(msg); + term_T *term = buffer->b_term; + +#ifdef WIN3264 + /* Win32: Cannot redirect output of the job, intercept it here and write to + * the file. */ + if (term->tl_out_fd != NULL) + { + ch_log(channel, "Writing %d bytes to output file", (int)len); + fwrite(msg, len, 1, term->tl_out_fd); + return; + } +#endif + + if (term->tl_vterm == NULL) + { + ch_log(channel, "NOT writing %d bytes to terminal", (int)len); + return; + } + ch_log(channel, "writing %d bytes to terminal", (int)len); + term_write_job_output(term, msg, len); + +#ifdef FEAT_GUI + if (term->tl_system) + { + /* show system output, scrolling up the screen as needed */ + update_system_term(term); + update_cursor(term, TRUE); + } + else +#endif + /* In Terminal-Normal mode we are displaying the buffer, not the terminal + * contents, thus no screen update is needed. */ + if (!term->tl_normal_mode) + { + /* TODO: only update once in a while. */ + ch_log(term->tl_job->jv_channel, "updating screen"); + if (buffer == curbuf) + { + update_screen(0); + /* update_screen() can be slow, check the terminal wasn't closed + * already */ + if (buffer == curbuf && curbuf->b_term != NULL) + update_cursor(curbuf->b_term, TRUE); +#ifdef FEAT_GUI_MACVIM + /* Force a flush now for better experience of interactive shell. */ + if (gui.in_use) + gui_macvim_force_flush(); +#endif + } + else + redraw_after_callback(TRUE); + } +} + +/* + * Send a mouse position and click to the vterm + */ + static int +term_send_mouse(VTerm *vterm, int button, int pressed) +{ + VTermModifier mod = VTERM_MOD_NONE; + + vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin), + mouse_col - curwin->w_wincol, mod); + if (button != 0) + vterm_mouse_button(vterm, button, pressed, mod); + return TRUE; +} + +static int enter_mouse_col = -1; +static int enter_mouse_row = -1; + +/* + * Handle a mouse click, drag or release. + * Return TRUE when a mouse event is sent to the terminal. + */ + static int +term_mouse_click(VTerm *vterm, int key) +{ +#if defined(FEAT_CLIPBOARD) + /* For modeless selection mouse drag and release events are ignored, unless + * they are preceded with a mouse down event */ + static int ignore_drag_release = TRUE; + VTermMouseState mouse_state; + + vterm_state_get_mousestate(vterm_obtain_state(vterm), &mouse_state); + if (mouse_state.flags == 0) + { + /* Terminal is not using the mouse, use modeless selection. */ + switch (key) + { + case K_LEFTDRAG: + case K_LEFTRELEASE: + case K_RIGHTDRAG: + case K_RIGHTRELEASE: + /* Ignore drag and release events when the button-down wasn't + * seen before. */ + if (ignore_drag_release) + { + int save_mouse_col, save_mouse_row; + + if (enter_mouse_col < 0) + break; + + /* mouse click in the window gave us focus, handle that + * click now */ + save_mouse_col = mouse_col; + save_mouse_row = mouse_row; + mouse_col = enter_mouse_col; + mouse_row = enter_mouse_row; + clip_modeless(MOUSE_LEFT, TRUE, FALSE); + mouse_col = save_mouse_col; + mouse_row = save_mouse_row; + } + /* FALLTHROUGH */ + case K_LEFTMOUSE: + case K_RIGHTMOUSE: + if (key == K_LEFTRELEASE || key == K_RIGHTRELEASE) + ignore_drag_release = TRUE; + else + ignore_drag_release = FALSE; + /* Should we call mouse_has() here? */ + if (clip_star.available) + { + int button, is_click, is_drag; + + button = get_mouse_button(KEY2TERMCAP1(key), + &is_click, &is_drag); + if (mouse_model_popup() && button == MOUSE_LEFT + && (mod_mask & MOD_MASK_SHIFT)) + { + /* Translate shift-left to right button. */ + button = MOUSE_RIGHT; + mod_mask &= ~MOD_MASK_SHIFT; + } + clip_modeless(button, is_click, is_drag); + } + break; + + case K_MIDDLEMOUSE: + if (clip_star.available) + insert_reg('*', TRUE); + break; + } + enter_mouse_col = -1; + return FALSE; + } +#endif + enter_mouse_col = -1; + + switch (key) + { + case K_LEFTMOUSE: + case K_LEFTMOUSE_NM: term_send_mouse(vterm, 1, 1); break; + case K_LEFTDRAG: term_send_mouse(vterm, 1, 1); break; + case K_LEFTRELEASE: + case K_LEFTRELEASE_NM: term_send_mouse(vterm, 1, 0); break; + case K_MOUSEMOVE: term_send_mouse(vterm, 0, 0); break; + case K_MIDDLEMOUSE: term_send_mouse(vterm, 2, 1); break; + case K_MIDDLEDRAG: term_send_mouse(vterm, 2, 1); break; + case K_MIDDLERELEASE: term_send_mouse(vterm, 2, 0); break; + case K_RIGHTMOUSE: term_send_mouse(vterm, 3, 1); break; + case K_RIGHTDRAG: term_send_mouse(vterm, 3, 1); break; + case K_RIGHTRELEASE: term_send_mouse(vterm, 3, 0); break; + } + return TRUE; +} + +/* + * Convert typed key "c" into bytes to send to the job. + * Return the number of bytes in "buf". + */ + static int +term_convert_key(term_T *term, int c, char *buf) +{ + VTerm *vterm = term->tl_vterm; + VTermKey key = VTERM_KEY_NONE; + VTermModifier mod = VTERM_MOD_NONE; + int other = FALSE; + + switch (c) + { + /* don't use VTERM_KEY_ENTER, it may do an unwanted conversion */ + + /* don't use VTERM_KEY_BACKSPACE, it always + * becomes 0x7f DEL */ + case K_BS: c = term_backspace_char; break; + + case ESC: key = VTERM_KEY_ESCAPE; break; + case K_DEL: key = VTERM_KEY_DEL; break; + case K_DOWN: key = VTERM_KEY_DOWN; break; + case K_S_DOWN: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_DOWN; break; + case K_END: key = VTERM_KEY_END; break; + case K_S_END: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_END; break; + case K_C_END: mod = VTERM_MOD_CTRL; + key = VTERM_KEY_END; break; + case K_F10: key = VTERM_KEY_FUNCTION(10); break; + case K_F11: key = VTERM_KEY_FUNCTION(11); break; + case K_F12: key = VTERM_KEY_FUNCTION(12); break; + case K_F1: key = VTERM_KEY_FUNCTION(1); break; + case K_F2: key = VTERM_KEY_FUNCTION(2); break; + case K_F3: key = VTERM_KEY_FUNCTION(3); break; + case K_F4: key = VTERM_KEY_FUNCTION(4); break; + case K_F5: key = VTERM_KEY_FUNCTION(5); break; + case K_F6: key = VTERM_KEY_FUNCTION(6); break; + case K_F7: key = VTERM_KEY_FUNCTION(7); break; + case K_F8: key = VTERM_KEY_FUNCTION(8); break; + case K_F9: key = VTERM_KEY_FUNCTION(9); break; + case K_HOME: key = VTERM_KEY_HOME; break; + case K_S_HOME: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_HOME; break; + case K_C_HOME: mod = VTERM_MOD_CTRL; + key = VTERM_KEY_HOME; break; + case K_INS: key = VTERM_KEY_INS; break; + case K_K0: key = VTERM_KEY_KP_0; break; + case K_K1: key = VTERM_KEY_KP_1; break; + case K_K2: key = VTERM_KEY_KP_2; break; + case K_K3: key = VTERM_KEY_KP_3; break; + case K_K4: key = VTERM_KEY_KP_4; break; + case K_K5: key = VTERM_KEY_KP_5; break; + case K_K6: key = VTERM_KEY_KP_6; break; + case K_K7: key = VTERM_KEY_KP_7; break; + case K_K8: key = VTERM_KEY_KP_8; break; + case K_K9: key = VTERM_KEY_KP_9; break; + case K_KDEL: key = VTERM_KEY_DEL; break; /* TODO */ + case K_KDIVIDE: key = VTERM_KEY_KP_DIVIDE; break; + case K_KEND: key = VTERM_KEY_KP_1; break; /* TODO */ + case K_KENTER: key = VTERM_KEY_KP_ENTER; break; + case K_KHOME: key = VTERM_KEY_KP_7; break; /* TODO */ + case K_KINS: key = VTERM_KEY_KP_0; break; /* TODO */ + case K_KMINUS: key = VTERM_KEY_KP_MINUS; break; + case K_KMULTIPLY: key = VTERM_KEY_KP_MULT; break; + case K_KPAGEDOWN: key = VTERM_KEY_KP_3; break; /* TODO */ + case K_KPAGEUP: key = VTERM_KEY_KP_9; break; /* TODO */ + case K_KPLUS: key = VTERM_KEY_KP_PLUS; break; + case K_KPOINT: key = VTERM_KEY_KP_PERIOD; break; + case K_LEFT: key = VTERM_KEY_LEFT; break; + case K_S_LEFT: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_LEFT; break; + case K_C_LEFT: mod = VTERM_MOD_CTRL; + key = VTERM_KEY_LEFT; break; + case K_PAGEDOWN: key = VTERM_KEY_PAGEDOWN; break; + case K_PAGEUP: key = VTERM_KEY_PAGEUP; break; + case K_RIGHT: key = VTERM_KEY_RIGHT; break; + case K_S_RIGHT: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_RIGHT; break; + case K_C_RIGHT: mod = VTERM_MOD_CTRL; + key = VTERM_KEY_RIGHT; break; + case K_UP: key = VTERM_KEY_UP; break; + case K_S_UP: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_UP; break; + case TAB: key = VTERM_KEY_TAB; break; + case K_S_TAB: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_TAB; break; + + case K_MOUSEUP: other = term_send_mouse(vterm, 5, 1); break; + case K_MOUSEDOWN: other = term_send_mouse(vterm, 4, 1); break; + case K_MOUSELEFT: /* TODO */ return 0; + case K_MOUSERIGHT: /* TODO */ return 0; + + case K_LEFTMOUSE: + case K_LEFTMOUSE_NM: + case K_LEFTDRAG: + case K_LEFTRELEASE: + case K_LEFTRELEASE_NM: + case K_MOUSEMOVE: + case K_MIDDLEMOUSE: + case K_MIDDLEDRAG: + case K_MIDDLERELEASE: + case K_RIGHTMOUSE: + case K_RIGHTDRAG: + case K_RIGHTRELEASE: if (!term_mouse_click(vterm, c)) + return 0; + other = TRUE; + break; + + case K_X1MOUSE: /* TODO */ return 0; + case K_X1DRAG: /* TODO */ return 0; + case K_X1RELEASE: /* TODO */ return 0; + case K_X2MOUSE: /* TODO */ return 0; + case K_X2DRAG: /* TODO */ return 0; + case K_X2RELEASE: /* TODO */ return 0; + + case K_IGNORE: return 0; + case K_NOP: return 0; + case K_UNDO: return 0; + case K_HELP: return 0; + case K_XF1: key = VTERM_KEY_FUNCTION(1); break; + case K_XF2: key = VTERM_KEY_FUNCTION(2); break; + case K_XF3: key = VTERM_KEY_FUNCTION(3); break; + case K_XF4: key = VTERM_KEY_FUNCTION(4); break; + case K_SELECT: return 0; +#ifdef FEAT_GUI + case K_VER_SCROLLBAR: return 0; + case K_HOR_SCROLLBAR: return 0; +#endif +#ifdef FEAT_GUI_TABLINE + case K_TABLINE: return 0; + case K_TABMENU: return 0; +#endif +#ifdef FEAT_NETBEANS_INTG + case K_F21: key = VTERM_KEY_FUNCTION(21); break; +#endif +#ifdef FEAT_DND + case K_DROP: return 0; +#endif + case K_CURSORHOLD: return 0; + case K_PS: vterm_keyboard_start_paste(vterm); + other = TRUE; + break; + case K_PE: vterm_keyboard_end_paste(vterm); + other = TRUE; + break; + } + + /* + * Convert special keys to vterm keys: + * - Write keys to vterm: vterm_keyboard_key() + * - Write output to channel. + * TODO: use mod_mask + */ + if (key != VTERM_KEY_NONE) + /* Special key, let vterm convert it. */ + vterm_keyboard_key(vterm, key, mod); + else if (!other) + /* Normal character, let vterm convert it. */ + vterm_keyboard_unichar(vterm, c, mod); + + /* Read back the converted escape sequence. */ + return (int)vterm_output_read(vterm, buf, KEY_BUF_LEN); +} + +/* + * Return TRUE if the job for "term" is still running. + * If "check_job_status" is TRUE update the job status. + */ + static int +term_job_running_check(term_T *term, int check_job_status) +{ + /* Also consider the job finished when the channel is closed, to avoid a + * race condition when updating the title. */ + if (term != NULL + && term->tl_job != NULL + && channel_is_open(term->tl_job->jv_channel)) + { + if (check_job_status) + job_status(term->tl_job); + return (term->tl_job->jv_status == JOB_STARTED + || term->tl_job->jv_channel->ch_keep_open); + } + return FALSE; +} + +/* + * Return TRUE if the job for "term" is still running. + */ + int +term_job_running(term_T *term) +{ + return term_job_running_check(term, FALSE); +} + +/* + * Return TRUE if "term" has an active channel and used ":term NONE". + */ + int +term_none_open(term_T *term) +{ + /* Also consider the job finished when the channel is closed, to avoid a + * race condition when updating the title. */ + return term != NULL + && term->tl_job != NULL + && channel_is_open(term->tl_job->jv_channel) + && term->tl_job->jv_channel->ch_keep_open; +} + +/* + * Used when exiting: kill the job in "buf" if so desired. + * Return OK when the job finished. + * Return FAIL when the job is still running. + */ + int +term_try_stop_job(buf_T *buf) +{ + int count; + char *how = (char *)buf->b_term->tl_kill; + +#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) + if ((how == NULL || *how == NUL) && (p_confirm || cmdmod.confirm)) + { + char_u buff[DIALOG_MSG_SIZE]; + int ret; + + dialog_msg(buff, _("Kill job in \"%s\"?"), buf->b_fname); + ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); + if (ret == VIM_YES) + how = "kill"; + else if (ret == VIM_CANCEL) + return FAIL; + } +#endif + if (how == NULL || *how == NUL) + return FAIL; + + job_stop(buf->b_term->tl_job, NULL, how); + + /* wait for up to a second for the job to die */ + for (count = 0; count < 100; ++count) + { + /* buffer, terminal and job may be cleaned up while waiting */ + if (!buf_valid(buf) + || buf->b_term == NULL + || buf->b_term->tl_job == NULL) + return OK; + + /* call job_status() to update jv_status */ + job_status(buf->b_term->tl_job); + if (buf->b_term->tl_job->jv_status >= JOB_ENDED) + return OK; + ui_delay(10L, FALSE); + mch_check_messages(); + parse_queued_messages(); + } + return FAIL; +} + +/* + * Add the last line of the scrollback buffer to the buffer in the window. + */ + static void +add_scrollback_line_to_buffer(term_T *term, char_u *text, int len) +{ + buf_T *buf = term->tl_buffer; + int empty = (buf->b_ml.ml_flags & ML_EMPTY); + linenr_T lnum = buf->b_ml.ml_line_count; + +#ifdef WIN3264 + if (!enc_utf8 && enc_codepage > 0) + { + WCHAR *ret = NULL; + int length = 0; + + MultiByteToWideChar_alloc(CP_UTF8, 0, (char*)text, len + 1, + &ret, &length); + if (ret != NULL) + { + WideCharToMultiByte_alloc(enc_codepage, 0, + ret, length, (char **)&text, &len, 0, 0); + vim_free(ret); + ml_append_buf(term->tl_buffer, lnum, text, len, FALSE); + vim_free(text); + } + } + else +#endif + ml_append_buf(term->tl_buffer, lnum, text, len + 1, FALSE); + if (empty) + { + /* Delete the empty line that was in the empty buffer. */ + curbuf = buf; + ml_delete(1, FALSE); + curbuf = curwin->w_buffer; + } +} + + static void +cell2cellattr(const VTermScreenCell *cell, cellattr_T *attr) +{ + attr->width = cell->width; + attr->attrs = cell->attrs; + attr->fg = cell->fg; + attr->bg = cell->bg; +} + + static int +equal_celattr(cellattr_T *a, cellattr_T *b) +{ + /* Comparing the colors should be sufficient. */ + return a->fg.red == b->fg.red + && a->fg.green == b->fg.green + && a->fg.blue == b->fg.blue + && a->bg.red == b->bg.red + && a->bg.green == b->bg.green + && a->bg.blue == b->bg.blue; +} + +/* + * Add an empty scrollback line to "term". When "lnum" is not zero, add the + * line at this position. Otherwise at the end. + */ + static int +add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum) +{ + if (ga_grow(&term->tl_scrollback, 1) == OK) + { + sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + + if (lnum > 0) + { + int i; + + for (i = 0; i < term->tl_scrollback.ga_len - lnum; ++i) + { + *line = *(line - 1); + --line; + } + } + line->sb_cols = 0; + line->sb_cells = NULL; + line->sb_fill_attr = *fill_attr; + ++term->tl_scrollback.ga_len; + return OK; + } + return FALSE; +} + +/* + * Remove the terminal contents from the scrollback and the buffer. + * Used before adding a new scrollback line or updating the buffer for lines + * displayed in the terminal. + */ + static void +cleanup_scrollback(term_T *term) +{ + sb_line_T *line; + garray_T *gap; + + curbuf = term->tl_buffer; + gap = &term->tl_scrollback; + while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled + && gap->ga_len > 0) + { + ml_delete(curbuf->b_ml.ml_line_count, FALSE); + line = (sb_line_T *)gap->ga_data + gap->ga_len - 1; + vim_free(line->sb_cells); + --gap->ga_len; + } + curbuf = curwin->w_buffer; + if (curbuf == term->tl_buffer) + check_cursor(); +} + +/* + * Add the current lines of the terminal to scrollback and to the buffer. + */ + static void +update_snapshot(term_T *term) +{ + VTermScreen *screen; + int len; + int lines_skipped = 0; + VTermPos pos; + VTermScreenCell cell; + cellattr_T fill_attr, new_fill_attr; + cellattr_T *p; + + ch_log(term->tl_job == NULL ? NULL : term->tl_job->jv_channel, + "Adding terminal window snapshot to buffer"); + + /* First remove the lines that were appended before, they might be + * outdated. */ + cleanup_scrollback(term); + + screen = vterm_obtain_screen(term->tl_vterm); + fill_attr = new_fill_attr = term->tl_default_color; + for (pos.row = 0; pos.row < term->tl_rows; ++pos.row) + { + len = 0; + for (pos.col = 0; pos.col < term->tl_cols; ++pos.col) + if (vterm_screen_get_cell(screen, pos, &cell) != 0 + && cell.chars[0] != NUL) + { + len = pos.col + 1; + new_fill_attr = term->tl_default_color; + } + else + /* Assume the last attr is the filler attr. */ + cell2cellattr(&cell, &new_fill_attr); + + if (len == 0 && equal_celattr(&new_fill_attr, &fill_attr)) + ++lines_skipped; + else + { + while (lines_skipped > 0) + { + /* Line was skipped, add an empty line. */ + --lines_skipped; + if (add_empty_scrollback(term, &fill_attr, 0) == OK) + add_scrollback_line_to_buffer(term, (char_u *)"", 0); + } + + if (len == 0) + p = NULL; + else + p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); + if ((p != NULL || len == 0) + && ga_grow(&term->tl_scrollback, 1) == OK) + { + garray_T ga; + int width; + sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + + ga_init2(&ga, 1, 100); + for (pos.col = 0; pos.col < len; pos.col += width) + { + if (vterm_screen_get_cell(screen, pos, &cell) == 0) + { + width = 1; + vim_memset(p + pos.col, 0, sizeof(cellattr_T)); + if (ga_grow(&ga, 1) == OK) + ga.ga_len += utf_char2bytes(' ', + (char_u *)ga.ga_data + ga.ga_len); + } + else + { + width = cell.width; + + cell2cellattr(&cell, &p[pos.col]); + + if (ga_grow(&ga, MB_MAXBYTES) == OK) + { + int i; + int c; + + for (i = 0; (c = cell.chars[i]) > 0 || i == 0; ++i) + ga.ga_len += utf_char2bytes(c == NUL ? ' ' : c, + (char_u *)ga.ga_data + ga.ga_len); + } + } + } + line->sb_cols = len; + line->sb_cells = p; + line->sb_fill_attr = new_fill_attr; + fill_attr = new_fill_attr; + ++term->tl_scrollback.ga_len; + + if (ga_grow(&ga, 1) == FAIL) + add_scrollback_line_to_buffer(term, (char_u *)"", 0); + else + { + *((char_u *)ga.ga_data + ga.ga_len) = NUL; + add_scrollback_line_to_buffer(term, ga.ga_data, ga.ga_len); + } + ga_clear(&ga); + } + else + vim_free(p); + } + } + + term->tl_dirty_snapshot = FALSE; +#ifdef FEAT_TIMERS + term->tl_timer_set = FALSE; +#endif +} + +/* + * If needed, add the current lines of the terminal to scrollback and to the + * buffer. Called after the job has ended and when switching to + * Terminal-Normal mode. + * When "redraw" is TRUE redraw the windows that show the terminal. + */ + static void +may_move_terminal_to_buffer(term_T *term, int redraw) +{ + win_T *wp; + + if (term->tl_vterm == NULL) + return; + + /* Update the snapshot only if something changes or the buffer does not + * have all the lines. */ + if (term->tl_dirty_snapshot || term->tl_buffer->b_ml.ml_line_count + <= term->tl_scrollback_scrolled) + update_snapshot(term); + + /* Obtain the current background color. */ + vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), + &term->tl_default_color.fg, &term->tl_default_color.bg); + + if (redraw) + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == term->tl_buffer) + { + wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; + wp->w_cursor.col = 0; + wp->w_valid = 0; + if (wp->w_cursor.lnum >= wp->w_height) + { + linenr_T min_topline = wp->w_cursor.lnum - wp->w_height + 1; + + if (wp->w_topline < min_topline) + wp->w_topline = min_topline; + } + redraw_win_later(wp, NOT_VALID); + } + } +} + +#if defined(FEAT_TIMERS) || defined(PROTO) +/* + * Check if any terminal timer expired. If so, copy text from the terminal to + * the buffer. + * Return the time until the next timer will expire. + */ + int +term_check_timers(int next_due_arg, proftime_T *now) +{ + term_T *term; + int next_due = next_due_arg; + + for (term = first_term; term != NULL; term = term->tl_next) + { + if (term->tl_timer_set && !term->tl_normal_mode) + { + long this_due = proftime_time_left(&term->tl_timer_due, now); + + if (this_due <= 1) + { + term->tl_timer_set = FALSE; + may_move_terminal_to_buffer(term, FALSE); + } + else if (next_due == -1 || next_due > this_due) + next_due = this_due; + } + } + + return next_due; +} +#endif + + static void +set_terminal_mode(term_T *term, int normal_mode) +{ + term->tl_normal_mode = normal_mode; + VIM_CLEAR(term->tl_status_text); + if (term->tl_buffer == curbuf) + maketitle(); +} + +/* + * Called after the job if finished and Terminal mode is not active: + * Move the vterm contents into the scrollback buffer and free the vterm. + */ + static void +cleanup_vterm(term_T *term) +{ + if (term->tl_finish != TL_FINISH_CLOSE) + may_move_terminal_to_buffer(term, TRUE); + term_free_vterm(term); + set_terminal_mode(term, FALSE); +} + +/* + * Switch from Terminal-Job mode to Terminal-Normal mode. + * Suspends updating the terminal window. + */ + static void +term_enter_normal_mode(void) +{ + term_T *term = curbuf->b_term; + + set_terminal_mode(term, TRUE); + + /* Append the current terminal contents to the buffer. */ + may_move_terminal_to_buffer(term, TRUE); + + /* Move the window cursor to the position of the cursor in the + * terminal. */ + curwin->w_cursor.lnum = term->tl_scrollback_scrolled + + term->tl_cursor_pos.row + 1; + check_cursor(); + if (coladvance(term->tl_cursor_pos.col) == FAIL) + coladvance(MAXCOL); + + /* Display the same lines as in the terminal. */ + curwin->w_topline = term->tl_scrollback_scrolled + 1; +} + +/* + * Returns TRUE if the current window contains a terminal and we are in + * Terminal-Normal mode. + */ + int +term_in_normal_mode(void) +{ + term_T *term = curbuf->b_term; + + return term != NULL && term->tl_normal_mode; +} + +/* + * Switch from Terminal-Normal mode to Terminal-Job mode. + * Restores updating the terminal window. + */ + void +term_enter_job_mode() +{ + term_T *term = curbuf->b_term; + + set_terminal_mode(term, FALSE); + + if (term->tl_channel_closed) + cleanup_vterm(term); + redraw_buf_and_status_later(curbuf, NOT_VALID); +} + +/* + * Get a key from the user with terminal mode mappings. + * Note: while waiting a terminal may be closed and freed if the channel is + * closed and ++close was used. + */ + static int +term_vgetc() +{ + int c; + int save_State = State; + + State = TERMINAL; + got_int = FALSE; +#ifdef WIN3264 + ctrl_break_was_pressed = FALSE; +#endif + c = vgetc(); + got_int = FALSE; + State = save_State; + return c; +} + +static int mouse_was_outside = FALSE; + +/* + * Send keys to terminal. + * Return FAIL when the key needs to be handled in Normal mode. + * Return OK when the key was dropped or sent to the terminal. + */ + int +send_keys_to_term(term_T *term, int c, int typed) +{ + char msg[KEY_BUF_LEN]; + size_t len; + int dragging_outside = FALSE; + + /* Catch keys that need to be handled as in Normal mode. */ + switch (c) + { + case NUL: + case K_ZERO: + if (typed) + stuffcharReadbuff(c); + return FAIL; + + case K_TABLINE: + stuffcharReadbuff(c); + return FAIL; + + case K_IGNORE: + case K_CANCEL: // used for :normal when running out of chars + return FAIL; + + case K_LEFTDRAG: + case K_MIDDLEDRAG: + case K_RIGHTDRAG: + case K_X1DRAG: + case K_X2DRAG: + dragging_outside = mouse_was_outside; + /* FALLTHROUGH */ + case K_LEFTMOUSE: + case K_LEFTMOUSE_NM: + case K_LEFTRELEASE: + case K_LEFTRELEASE_NM: + case K_MOUSEMOVE: + case K_MIDDLEMOUSE: + case K_MIDDLERELEASE: + case K_RIGHTMOUSE: + case K_RIGHTRELEASE: + case K_X1MOUSE: + case K_X1RELEASE: + case K_X2MOUSE: + case K_X2RELEASE: + + case K_MOUSEUP: + case K_MOUSEDOWN: + case K_MOUSELEFT: + case K_MOUSERIGHT: + if (mouse_row < W_WINROW(curwin) + || mouse_row >= (W_WINROW(curwin) + curwin->w_height) + || mouse_col < curwin->w_wincol + || mouse_col >= W_ENDCOL(curwin) + || dragging_outside) + { + /* click or scroll outside the current window or on status line + * or vertical separator */ + if (typed) + { + stuffcharReadbuff(c); + mouse_was_outside = TRUE; + } + return FAIL; + } + } + if (typed) + mouse_was_outside = FALSE; + + /* Convert the typed key to a sequence of bytes for the job. */ + len = term_convert_key(term, c, msg); + if (len > 0) + /* TODO: if FAIL is returned, stop? */ + channel_send(term->tl_job->jv_channel, get_tty_part(term), + (char_u *)msg, (int)len, NULL); + + return OK; +} + + static void +position_cursor(win_T *wp, VTermPos *pos) +{ + wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1)); + wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1)); + wp->w_valid |= (VALID_WCOL|VALID_WROW); +} + +/* + * Handle CTRL-W "": send register contents to the job. + */ + static void +term_paste_register(int prev_c UNUSED) +{ + int c; + list_T *l; + listitem_T *item; + long reglen = 0; + int type; + +#ifdef FEAT_CMDL_INFO + if (add_to_showcmd(prev_c)) + if (add_to_showcmd('"')) + out_flush(); +#endif + c = term_vgetc(); +#ifdef FEAT_CMDL_INFO + clear_showcmd(); +#endif + if (!term_use_loop()) + /* job finished while waiting for a character */ + return; + + /* CTRL-W "= prompt for expression to evaluate. */ + if (c == '=' && get_expr_register() != '=') + return; + if (!term_use_loop()) + /* job finished while waiting for a character */ + return; + + l = (list_T *)get_reg_contents(c, GREG_LIST); + if (l != NULL) + { + type = get_reg_type(c, ®len); + for (item = l->lv_first; item != NULL; item = item->li_next) + { + char_u *s = get_tv_string(&item->li_tv); +#ifdef WIN3264 + char_u *tmp = s; + + if (!enc_utf8 && enc_codepage > 0) + { + WCHAR *ret = NULL; + int length = 0; + + MultiByteToWideChar_alloc(enc_codepage, 0, (char *)s, + (int)STRLEN(s), &ret, &length); + if (ret != NULL) + { + WideCharToMultiByte_alloc(CP_UTF8, 0, + ret, length, (char **)&s, &length, 0, 0); + vim_free(ret); + } + } +#endif + channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN, + s, (int)STRLEN(s), NULL); +#ifdef WIN3264 + if (tmp != s) + vim_free(s); +#endif + + if (item->li_next != NULL || type == MLINE) + channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN, + (char_u *)"\r", 1, NULL); + } + list_free(l); + } +} + +/* + * Return TRUE when waiting for a character in the terminal, the cursor of the + * terminal should be displayed. + */ + int +terminal_is_active() +{ + return in_terminal_loop != NULL; +} + +#if defined(FEAT_GUI) || defined(PROTO) + cursorentry_T * +term_get_cursor_shape(guicolor_T *fg, guicolor_T *bg) +{ + term_T *term = in_terminal_loop; + static cursorentry_T entry; + + vim_memset(&entry, 0, sizeof(entry)); + entry.shape = entry.mshape = + term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_UNDERLINE ? SHAPE_HOR : + term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_BAR_LEFT ? SHAPE_VER : + SHAPE_BLOCK; + entry.percentage = 20; + if (term->tl_cursor_blink) + { + entry.blinkwait = 700; + entry.blinkon = 400; + entry.blinkoff = 250; + } + *fg = gui.back_pixel; + if (term->tl_cursor_color == NULL) + *bg = gui.norm_pixel; + else + *bg = color_name2handle(term->tl_cursor_color); + entry.name = "n"; + entry.used_for = SHAPE_CURSOR; + + return &entry; +} +#endif + + static void +may_output_cursor_props(void) +{ + if (!cursor_color_equal(last_set_cursor_color, desired_cursor_color) + || last_set_cursor_shape != desired_cursor_shape + || last_set_cursor_blink != desired_cursor_blink) + { + cursor_color_copy(&last_set_cursor_color, desired_cursor_color); + last_set_cursor_shape = desired_cursor_shape; + last_set_cursor_blink = desired_cursor_blink; + term_cursor_color(cursor_color_get(desired_cursor_color)); + if (desired_cursor_shape == -1 || desired_cursor_blink == -1) + /* this will restore the initial cursor style, if possible */ + ui_cursor_shape_forced(TRUE); + else + term_cursor_shape(desired_cursor_shape, desired_cursor_blink); + } +} + +/* + * Set the cursor color and shape, if not last set to these. + */ + static void +may_set_cursor_props(term_T *term) +{ +#ifdef FEAT_GUI + /* For the GUI the cursor properties are obtained with + * term_get_cursor_shape(). */ + if (gui.in_use) + return; +#endif + if (in_terminal_loop == term) + { + cursor_color_copy(&desired_cursor_color, term->tl_cursor_color); + desired_cursor_shape = term->tl_cursor_shape; + desired_cursor_blink = term->tl_cursor_blink; + may_output_cursor_props(); + } +} + +/* + * Reset the desired cursor properties and restore them when needed. + */ + static void +prepare_restore_cursor_props(void) +{ +#ifdef FEAT_GUI + if (gui.in_use) + return; +#endif + cursor_color_copy(&desired_cursor_color, NULL); + desired_cursor_shape = -1; + desired_cursor_blink = -1; + may_output_cursor_props(); +} + +/* + * Returns TRUE if the current window contains a terminal and we are sending + * keys to the job. + * If "check_job_status" is TRUE update the job status. + */ + static int +term_use_loop_check(int check_job_status) +{ + term_T *term = curbuf->b_term; + + return term != NULL + && !term->tl_normal_mode + && term->tl_vterm != NULL + && term_job_running_check(term, check_job_status); +} + +/* + * Returns TRUE if the current window contains a terminal and we are sending + * keys to the job. + */ + int +term_use_loop(void) +{ + return term_use_loop_check(FALSE); +} + +/* + * Called when entering a window with the mouse. If this is a terminal window + * we may want to change state. + */ + void +term_win_entered() +{ + term_T *term = curbuf->b_term; + + if (term != NULL) + { + if (term_use_loop_check(TRUE)) + { + reset_VIsual_and_resel(); + if (State & INSERT) + stop_insert_mode = TRUE; + } + mouse_was_outside = FALSE; + enter_mouse_col = mouse_col; + enter_mouse_row = mouse_row; + } +} + +/* + * Wait for input and send it to the job. + * When "blocking" is TRUE wait for a character to be typed. Otherwise return + * when there is no more typahead. + * Return when the start of a CTRL-W command is typed or anything else that + * should be handled as a Normal mode command. + * Returns OK if a typed character is to be handled in Normal mode, FAIL if + * the terminal was closed. + */ + int +terminal_loop(int blocking) +{ + int c; + int termwinkey = 0; + int ret; +#ifdef UNIX + int tty_fd = curbuf->b_term->tl_job->jv_channel + ->ch_part[get_tty_part(curbuf->b_term)].ch_fd; +#endif + int restore_cursor = FALSE; + + /* Remember the terminal we are sending keys to. However, the terminal + * might be closed while waiting for a character, e.g. typing "exit" in a + * shell and ++close was used. Therefore use curbuf->b_term instead of a + * stored reference. */ + in_terminal_loop = curbuf->b_term; + + if (*curwin->w_p_twk != NUL) + { + termwinkey = string_to_key(curwin->w_p_twk, TRUE); + if (termwinkey == Ctrl_W) + termwinkey = 0; + } + position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); + may_set_cursor_props(curbuf->b_term); + + while (blocking || vpeekc_nomap() != NUL) + { +#ifdef FEAT_GUI + if (!curbuf->b_term->tl_system) +#endif + /* TODO: skip screen update when handling a sequence of keys. */ + /* Repeat redrawing in case a message is received while redrawing. + */ + while (must_redraw != 0) + if (update_screen(0) == FAIL) + break; + if (!term_use_loop_check(TRUE) || in_terminal_loop != curbuf->b_term) + /* job finished while redrawing */ + break; + + update_cursor(curbuf->b_term, FALSE); + restore_cursor = TRUE; + + c = term_vgetc(); + if (!term_use_loop_check(TRUE) || in_terminal_loop != curbuf->b_term) + { + /* Job finished while waiting for a character. Push back the + * received character. */ + if (c != K_IGNORE) + vungetc(c); + break; + } + if (c == K_IGNORE) + continue; + +#ifdef UNIX + /* + * The shell or another program may change the tty settings. Getting + * them for every typed character is a bit of overhead, but it's needed + * for the first character typed, e.g. when Vim starts in a shell. + */ + if (isatty(tty_fd)) + { + ttyinfo_T info; + + /* Get the current backspace character of the pty. */ + if (get_tty_info(tty_fd, &info) == OK) + term_backspace_char = info.backspace; + } +#endif + +#ifdef WIN3264 + /* On Windows winpty handles CTRL-C, don't send a CTRL_C_EVENT. + * Use CTRL-BREAK to kill the job. */ + if (ctrl_break_was_pressed) + mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); +#endif + /* Was either CTRL-W (termwinkey) or CTRL-\ pressed? + * Not in a system terminal. */ + if ((c == (termwinkey == 0 ? Ctrl_W : termwinkey) || c == Ctrl_BSL) +#ifdef FEAT_GUI + && !curbuf->b_term->tl_system +#endif + ) + { + int prev_c = c; + +#ifdef FEAT_CMDL_INFO + if (add_to_showcmd(c)) + out_flush(); +#endif + c = term_vgetc(); +#ifdef FEAT_CMDL_INFO + clear_showcmd(); +#endif + if (!term_use_loop_check(TRUE) + || in_terminal_loop != curbuf->b_term) + /* job finished while waiting for a character */ + break; + + if (prev_c == Ctrl_BSL) + { + if (c == Ctrl_N) + { + /* CTRL-\ CTRL-N : go to Terminal-Normal mode. */ + term_enter_normal_mode(); + ret = FAIL; + goto theend; + } + /* Send both keys to the terminal. */ + send_keys_to_term(curbuf->b_term, prev_c, TRUE); + } + else if (c == Ctrl_C) + { + /* "CTRL-W CTRL-C" or 'termwinkey' CTRL-C: end the job */ + mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); + } + else if (c == '.') + { + /* "CTRL-W .": send CTRL-W to the job */ + /* "'termwinkey' .": send 'termwinkey' to the job */ + c = termwinkey == 0 ? Ctrl_W : termwinkey; + } + else if (c == Ctrl_BSL) + { + /* "CTRL-W CTRL-\": send CTRL-\ to the job */ + c = Ctrl_BSL; + } + else if (c == 'N') + { + /* CTRL-W N : go to Terminal-Normal mode. */ + term_enter_normal_mode(); + ret = FAIL; + goto theend; + } + else if (c == '"') + { + term_paste_register(prev_c); + continue; + } + else if (termwinkey == 0 || c != termwinkey) + { + stuffcharReadbuff(Ctrl_W); + stuffcharReadbuff(c); + ret = OK; + goto theend; + } + } +# ifdef WIN3264 + if (!enc_utf8 && has_mbyte && c >= 0x80) + { + WCHAR wc; + char_u mb[3]; + + mb[0] = (unsigned)c >> 8; + mb[1] = c; + if (MultiByteToWideChar(GetACP(), 0, (char*)mb, 2, &wc, 1) > 0) + c = wc; + } +# endif + if (send_keys_to_term(curbuf->b_term, c, TRUE) != OK) + { + if (c == K_MOUSEMOVE) + /* We are sure to come back here, don't reset the cursor color + * and shape to avoid flickering. */ + restore_cursor = FALSE; + + ret = OK; + goto theend; + } + } + ret = FAIL; + +theend: + in_terminal_loop = NULL; + if (restore_cursor) + prepare_restore_cursor_props(); + + /* Move a snapshot of the screen contents to the buffer, so that completion + * works in other buffers. */ + if (curbuf->b_term != NULL && !curbuf->b_term->tl_normal_mode) + may_move_terminal_to_buffer(curbuf->b_term, FALSE); + + return ret; +} + +/* + * Called when a job has finished. + * This updates the title and status, but does not close the vterm, because + * there might still be pending output in the channel. + */ + void +term_job_ended(job_T *job) +{ + term_T *term; + int did_one = FALSE; + + for (term = first_term; term != NULL; term = term->tl_next) + if (term->tl_job == job) + { + VIM_CLEAR(term->tl_title); + VIM_CLEAR(term->tl_status_text); + redraw_buf_and_status_later(term->tl_buffer, VALID); + did_one = TRUE; + } + if (did_one) + redraw_statuslines(); + if (curbuf->b_term != NULL) + { + if (curbuf->b_term->tl_job == job) + maketitle(); + update_cursor(curbuf->b_term, TRUE); + } +} + + static void +may_toggle_cursor(term_T *term) +{ + if (in_terminal_loop == term) + { + if (term->tl_cursor_visible) + cursor_on(); + else + cursor_off(); + } +} + +/* + * Reverse engineer the RGB value into a cterm color index. + * First color is 1. Return 0 if no match found (default color). + */ + static int +color2index(VTermColor *color, int fg, int *boldp) +{ + int red = color->red; + int blue = color->blue; + int green = color->green; + + if (color->ansi_index != VTERM_ANSI_INDEX_NONE) + { + /* First 16 colors and default: use the ANSI index, because these + * colors can be redefined. */ + if (t_colors >= 16) + return color->ansi_index; + switch (color->ansi_index) + { + case 0: return 0; + case 1: return lookup_color( 0, fg, boldp) + 1; /* black */ + case 2: return lookup_color( 4, fg, boldp) + 1; /* dark red */ + case 3: return lookup_color( 2, fg, boldp) + 1; /* dark green */ + case 4: return lookup_color( 6, fg, boldp) + 1; /* brown */ + case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue */ + case 6: return lookup_color( 5, fg, boldp) + 1; /* dark magenta */ + case 7: return lookup_color( 3, fg, boldp) + 1; /* dark cyan */ + case 8: return lookup_color( 8, fg, boldp) + 1; /* light grey */ + case 9: return lookup_color(12, fg, boldp) + 1; /* dark grey */ + case 10: return lookup_color(20, fg, boldp) + 1; /* red */ + case 11: return lookup_color(16, fg, boldp) + 1; /* green */ + case 12: return lookup_color(24, fg, boldp) + 1; /* yellow */ + case 13: return lookup_color(14, fg, boldp) + 1; /* blue */ + case 14: return lookup_color(22, fg, boldp) + 1; /* magenta */ + case 15: return lookup_color(18, fg, boldp) + 1; /* cyan */ + case 16: return lookup_color(26, fg, boldp) + 1; /* white */ + } + } + + if (t_colors >= 256) + { + if (red == blue && red == green) + { + /* 24-color greyscale plus white and black */ + static int cutoff[23] = { + 0x0D, 0x17, 0x21, 0x2B, 0x35, 0x3F, 0x49, 0x53, 0x5D, 0x67, + 0x71, 0x7B, 0x85, 0x8F, 0x99, 0xA3, 0xAD, 0xB7, 0xC1, 0xCB, + 0xD5, 0xDF, 0xE9}; + int i; + + if (red < 5) + return 17; /* 00/00/00 */ + if (red > 245) /* ff/ff/ff */ + return 232; + for (i = 0; i < 23; ++i) + if (red < cutoff[i]) + return i + 233; + return 256; + } + { + static int cutoff[5] = {0x2F, 0x73, 0x9B, 0xC3, 0xEB}; + int ri, gi, bi; + + /* 216-color cube */ + for (ri = 0; ri < 5; ++ri) + if (red < cutoff[ri]) + break; + for (gi = 0; gi < 5; ++gi) + if (green < cutoff[gi]) + break; + for (bi = 0; bi < 5; ++bi) + if (blue < cutoff[bi]) + break; + return 17 + ri * 36 + gi * 6 + bi; + } + } + return 0; +} + +/* + * Convert Vterm attributes to highlight flags. + */ + static int +vtermAttr2hl(VTermScreenCellAttrs cellattrs) +{ + int attr = 0; + + if (cellattrs.bold) + attr |= HL_BOLD; + if (cellattrs.underline) + attr |= HL_UNDERLINE; + if (cellattrs.italic) + attr |= HL_ITALIC; + if (cellattrs.strike) + attr |= HL_STRIKETHROUGH; + if (cellattrs.reverse) + attr |= HL_INVERSE; + return attr; +} + +/* + * Store Vterm attributes in "cell" from highlight flags. + */ + static void +hl2vtermAttr(int attr, cellattr_T *cell) +{ + vim_memset(&cell->attrs, 0, sizeof(VTermScreenCellAttrs)); + if (attr & HL_BOLD) + cell->attrs.bold = 1; + if (attr & HL_UNDERLINE) + cell->attrs.underline = 1; + if (attr & HL_ITALIC) + cell->attrs.italic = 1; + if (attr & HL_STRIKETHROUGH) + cell->attrs.strike = 1; + if (attr & HL_INVERSE) + cell->attrs.reverse = 1; +} + +/* + * Convert the attributes of a vterm cell into an attribute index. + */ + static int +cell2attr(VTermScreenCellAttrs cellattrs, VTermColor cellfg, VTermColor cellbg) +{ + int attr = vtermAttr2hl(cellattrs); + +#ifdef FEAT_GUI + if (gui.in_use) + { + guicolor_T fg, bg; + + fg = gui_mch_get_rgb_color(cellfg.red, cellfg.green, cellfg.blue); + bg = gui_mch_get_rgb_color(cellbg.red, cellbg.green, cellbg.blue); + return get_gui_attr_idx(attr, fg, bg); + } + else +#endif +#ifdef FEAT_TERMGUICOLORS + if (p_tgc) + { + guicolor_T fg, bg; + + fg = gui_get_rgb_color_cmn(cellfg.red, cellfg.green, cellfg.blue); + bg = gui_get_rgb_color_cmn(cellbg.red, cellbg.green, cellbg.blue); + + return get_tgc_attr_idx(attr, fg, bg); + } + else +#endif + { + int bold = MAYBE; + int fg = color2index(&cellfg, TRUE, &bold); + int bg = color2index(&cellbg, FALSE, &bold); + + /* Use the "Terminal" highlighting for the default colors. */ + if ((fg == 0 || bg == 0) && t_colors >= 16) + { + if (fg == 0 && term_default_cterm_fg >= 0) + fg = term_default_cterm_fg + 1; + if (bg == 0 && term_default_cterm_bg >= 0) + bg = term_default_cterm_bg + 1; + } + + /* with 8 colors set the bold attribute to get a bright foreground */ + if (bold == TRUE) + attr |= HL_BOLD; + return get_cterm_attr_idx(attr, fg, bg); + } + return 0; +} + + static void +set_dirty_snapshot(term_T *term) +{ + term->tl_dirty_snapshot = TRUE; +#ifdef FEAT_TIMERS + if (!term->tl_normal_mode) + { + /* Update the snapshot after 100 msec of not getting updates. */ + profile_setlimit(100L, &term->tl_timer_due); + term->tl_timer_set = TRUE; + } +#endif +} + + static int +handle_damage(VTermRect rect, void *user) +{ + term_T *term = (term_T *)user; + + term->tl_dirty_row_start = MIN(term->tl_dirty_row_start, rect.start_row); + term->tl_dirty_row_end = MAX(term->tl_dirty_row_end, rect.end_row); + set_dirty_snapshot(term); + redraw_buf_later(term->tl_buffer, SOME_VALID); + return 1; +} + + static void +term_scroll_up(term_T *term, int start_row, int count) +{ + win_T *wp; + VTermColor fg, bg; + VTermScreenCellAttrs attr; + int clear_attr; + + /* Set the color to clear lines with. */ + vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), + &fg, &bg); + vim_memset(&attr, 0, sizeof(attr)); + clear_attr = cell2attr(attr, fg, bg); + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == term->tl_buffer) + win_del_lines(wp, start_row, count, FALSE, FALSE, clear_attr); + } +} + + static int +handle_moverect(VTermRect dest, VTermRect src, void *user) +{ + term_T *term = (term_T *)user; + int count = src.start_row - dest.start_row; + + /* Scrolling up is done much more efficiently by deleting lines instead of + * redrawing the text. But avoid doing this multiple times, postpone until + * the redraw happens. */ + if (dest.start_col == src.start_col + && dest.end_col == src.end_col + && dest.start_row < src.start_row) + { + if (dest.start_row == 0) + term->tl_postponed_scroll += count; + else + term_scroll_up(term, dest.start_row, count); + } + + term->tl_dirty_row_start = MIN(term->tl_dirty_row_start, dest.start_row); + term->tl_dirty_row_end = MIN(term->tl_dirty_row_end, dest.end_row); + set_dirty_snapshot(term); + + /* Note sure if the scrolling will work correctly, let's do a complete + * redraw later. */ + redraw_buf_later(term->tl_buffer, NOT_VALID); + return 1; +} + + static int +handle_movecursor( + VTermPos pos, + VTermPos oldpos UNUSED, + int visible, + void *user) +{ + term_T *term = (term_T *)user; + win_T *wp; + + term->tl_cursor_pos = pos; + term->tl_cursor_visible = visible; + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == term->tl_buffer) + position_cursor(wp, &pos); + } + if (term->tl_buffer == curbuf && !term->tl_normal_mode) + { + may_toggle_cursor(term); + update_cursor(term, term->tl_cursor_visible); + } + + return 1; +} + + static int +handle_settermprop( + VTermProp prop, + VTermValue *value, + void *user) +{ + term_T *term = (term_T *)user; + + switch (prop) + { + case VTERM_PROP_TITLE: + vim_free(term->tl_title); + /* a blank title isn't useful, make it empty, so that "running" is + * displayed */ + if (*skipwhite((char_u *)value->string) == NUL) + term->tl_title = NULL; +#ifdef WIN3264 + else if (!enc_utf8 && enc_codepage > 0) + { + WCHAR *ret = NULL; + int length = 0; + + MultiByteToWideChar_alloc(CP_UTF8, 0, + (char*)value->string, (int)STRLEN(value->string), + &ret, &length); + if (ret != NULL) + { + WideCharToMultiByte_alloc(enc_codepage, 0, + ret, length, (char**)&term->tl_title, + &length, 0, 0); + vim_free(ret); + } + } +#endif + else + term->tl_title = vim_strsave((char_u *)value->string); + VIM_CLEAR(term->tl_status_text); + if (term == curbuf->b_term) + maketitle(); + break; + + case VTERM_PROP_CURSORVISIBLE: + term->tl_cursor_visible = value->boolean; + may_toggle_cursor(term); + out_flush(); + break; + + case VTERM_PROP_CURSORBLINK: + term->tl_cursor_blink = value->boolean; + may_set_cursor_props(term); + break; + + case VTERM_PROP_CURSORSHAPE: + term->tl_cursor_shape = value->number; + may_set_cursor_props(term); + break; + + case VTERM_PROP_CURSORCOLOR: + cursor_color_copy(&term->tl_cursor_color, (char_u*)value->string); + may_set_cursor_props(term); + break; + + case VTERM_PROP_ALTSCREEN: + /* TODO: do anything else? */ + term->tl_using_altscreen = value->boolean; + break; + + default: + break; + } + /* Always return 1, otherwise vterm doesn't store the value internally. */ + return 1; +} + +/* + * The job running in the terminal resized the terminal. + */ + static int +handle_resize(int rows, int cols, void *user) +{ + term_T *term = (term_T *)user; + win_T *wp; + + term->tl_rows = rows; + term->tl_cols = cols; + if (term->tl_vterm_size_changed) + /* Size was set by vterm_set_size(), don't set the window size. */ + term->tl_vterm_size_changed = FALSE; + else + { + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == term->tl_buffer) + { + win_setheight_win(rows, wp); + win_setwidth_win(cols, wp); + } + } + redraw_buf_later(term->tl_buffer, NOT_VALID); + } + return 1; +} + +/* + * Handle a line that is pushed off the top of the screen. + */ + static int +handle_pushline(int cols, const VTermScreenCell *cells, void *user) +{ + term_T *term = (term_T *)user; + + /* First remove the lines that were appended before, the pushed line goes + * above it. */ + cleanup_scrollback(term); + + /* If the number of lines that are stored goes over 'termscrollback' then + * delete the first 10%. */ + if (term->tl_scrollback.ga_len >= term->tl_buffer->b_p_twsl) + { + int todo = term->tl_buffer->b_p_twsl / 10; + int i; + + curbuf = term->tl_buffer; + for (i = 0; i < todo; ++i) + { + vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells); + ml_delete(1, FALSE); + } + curbuf = curwin->w_buffer; + + term->tl_scrollback.ga_len -= todo; + mch_memmove(term->tl_scrollback.ga_data, + (sb_line_T *)term->tl_scrollback.ga_data + todo, + sizeof(sb_line_T) * term->tl_scrollback.ga_len); + term->tl_scrollback_scrolled -= todo; + } + + if (ga_grow(&term->tl_scrollback, 1) == OK) + { + cellattr_T *p = NULL; + int len = 0; + int i; + int c; + int col; + sb_line_T *line; + garray_T ga; + cellattr_T fill_attr = term->tl_default_color; + + /* do not store empty cells at the end */ + for (i = 0; i < cols; ++i) + if (cells[i].chars[0] != 0) + len = i + 1; + else + cell2cellattr(&cells[i], &fill_attr); + + ga_init2(&ga, 1, 100); + if (len > 0) + p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); + if (p != NULL) + { + for (col = 0; col < len; col += cells[col].width) + { + if (ga_grow(&ga, MB_MAXBYTES) == FAIL) + { + ga.ga_len = 0; + break; + } + for (i = 0; (c = cells[col].chars[i]) > 0 || i == 0; ++i) + ga.ga_len += utf_char2bytes(c == NUL ? ' ' : c, + (char_u *)ga.ga_data + ga.ga_len); + cell2cellattr(&cells[col], &p[col]); + } + } + if (ga_grow(&ga, 1) == FAIL) + add_scrollback_line_to_buffer(term, (char_u *)"", 0); + else + { + *((char_u *)ga.ga_data + ga.ga_len) = NUL; + add_scrollback_line_to_buffer(term, ga.ga_data, ga.ga_len); + } + ga_clear(&ga); + + line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + line->sb_cols = len; + line->sb_cells = p; + line->sb_fill_attr = fill_attr; + ++term->tl_scrollback.ga_len; + ++term->tl_scrollback_scrolled; + } + return 0; /* ignored */ +} + +static VTermScreenCallbacks screen_callbacks = { + handle_damage, /* damage */ + handle_moverect, /* moverect */ + handle_movecursor, /* movecursor */ + handle_settermprop, /* settermprop */ + NULL, /* bell */ + handle_resize, /* resize */ + handle_pushline, /* sb_pushline */ + NULL /* sb_popline */ +}; + +/* + * Do the work after the channel of a terminal was closed. + * Must be called only when updating_screen is FALSE. + * Returns TRUE when a buffer was closed (list of terminals may have changed). + */ + static int +term_after_channel_closed(term_T *term) +{ + /* Unless in Terminal-Normal mode: clear the vterm. */ + if (!term->tl_normal_mode) + { + int fnum = term->tl_buffer->b_fnum; + + cleanup_vterm(term); + + if (term->tl_finish == TL_FINISH_CLOSE) + { + aco_save_T aco; + + /* ++close or term_finish == "close" */ + ch_log(NULL, "terminal job finished, closing window"); + aucmd_prepbuf(&aco, term->tl_buffer); + do_bufdel(DOBUF_WIPE, (char_u *)"", 1, fnum, fnum, FALSE); + aucmd_restbuf(&aco); + return TRUE; + } + if (term->tl_finish == TL_FINISH_OPEN + && term->tl_buffer->b_nwindows == 0) + { + char buf[50]; + + /* TODO: use term_opencmd */ + ch_log(NULL, "terminal job finished, opening window"); + vim_snprintf(buf, sizeof(buf), + term->tl_opencmd == NULL + ? "botright sbuf %d" + : (char *)term->tl_opencmd, fnum); + do_cmdline_cmd((char_u *)buf); + } + else + ch_log(NULL, "terminal job finished"); + } + + redraw_buf_and_status_later(term->tl_buffer, NOT_VALID); + return FALSE; +} + +/* + * Called when a channel has been closed. + * If this was a channel for a terminal window then finish it up. + */ + void +term_channel_closed(channel_T *ch) +{ + term_T *term; + term_T *next_term; + int did_one = FALSE; + + for (term = first_term; term != NULL; term = next_term) + { + next_term = term->tl_next; + if (term->tl_job == ch->ch_job) + { + term->tl_channel_closed = TRUE; + did_one = TRUE; + + VIM_CLEAR(term->tl_title); + VIM_CLEAR(term->tl_status_text); +#ifdef WIN3264 + if (term->tl_out_fd != NULL) + { + fclose(term->tl_out_fd); + term->tl_out_fd = NULL; + } +#endif + + if (updating_screen) + { + /* Cannot open or close windows now. Can happen when + * 'lazyredraw' is set. */ + term->tl_channel_recently_closed = TRUE; + continue; + } + + if (term_after_channel_closed(term)) + next_term = first_term; + } + } + + if (did_one) + { + redraw_statuslines(); + + /* Need to break out of vgetc(). */ + ins_char_typebuf(K_IGNORE); + typebuf_was_filled = TRUE; + + term = curbuf->b_term; + if (term != NULL) + { + if (term->tl_job == ch->ch_job) + maketitle(); + update_cursor(term, term->tl_cursor_visible); + } + } +} + +/* + * To be called after resetting updating_screen: handle any terminal where the + * channel was closed. + */ + void +term_check_channel_closed_recently() +{ + term_T *term; + term_T *next_term; + + for (term = first_term; term != NULL; term = next_term) + { + next_term = term->tl_next; + if (term->tl_channel_recently_closed) + { + term->tl_channel_recently_closed = FALSE; + if (term_after_channel_closed(term)) + // start over, the list may have changed + next_term = first_term; + } + } +} + +/* + * Fill one screen line from a line of the terminal. + * Advances "pos" to past the last column. + */ + static void +term_line2screenline(VTermScreen *screen, VTermPos *pos, int max_col) +{ + int off = screen_get_current_line_off(); + + for (pos->col = 0; pos->col < max_col; ) + { + VTermScreenCell cell; + int c; + + if (vterm_screen_get_cell(screen, *pos, &cell) == 0) + vim_memset(&cell, 0, sizeof(cell)); + + c = cell.chars[0]; + if (c == NUL) + { + ScreenLines[off] = ' '; + if (enc_utf8) + ScreenLinesUC[off] = NUL; + } + else + { + if (enc_utf8) + { + int i; + + /* composing chars */ + for (i = 0; i < Screen_mco + && i + 1 < VTERM_MAX_CHARS_PER_CELL; ++i) + { + ScreenLinesC[i][off] = cell.chars[i + 1]; + if (cell.chars[i + 1] == 0) + break; + } + if (c >= 0x80 || (Screen_mco > 0 + && ScreenLinesC[0][off] != 0)) + { + ScreenLines[off] = ' '; + ScreenLinesUC[off] = c; + } + else + { + ScreenLines[off] = c; + ScreenLinesUC[off] = NUL; + } + } +#ifdef WIN3264 + else if (has_mbyte && c >= 0x80) + { + char_u mb[MB_MAXBYTES+1]; + WCHAR wc = c; + + if (WideCharToMultiByte(GetACP(), 0, &wc, 1, + (char*)mb, 2, 0, 0) > 1) + { + ScreenLines[off] = mb[0]; + ScreenLines[off + 1] = mb[1]; + cell.width = mb_ptr2cells(mb); + } + else + ScreenLines[off] = c; + } +#endif + else + ScreenLines[off] = c; + } + ScreenAttrs[off] = cell2attr(cell.attrs, cell.fg, cell.bg); + + ++pos->col; + ++off; + if (cell.width == 2) + { + if (enc_utf8) + ScreenLinesUC[off] = NUL; + + /* don't set the second byte to NUL for a DBCS encoding, it + * has been set above */ + if (enc_utf8 || !has_mbyte) + ScreenLines[off] = NUL; + + ++pos->col; + ++off; + } + } +} + +#if defined(FEAT_GUI) + static void +update_system_term(term_T *term) +{ + VTermPos pos; + VTermScreen *screen; + + if (term->tl_vterm == NULL) + return; + screen = vterm_obtain_screen(term->tl_vterm); + + /* Scroll up to make more room for terminal lines if needed. */ + while (term->tl_toprow > 0 + && (Rows - term->tl_toprow) < term->tl_dirty_row_end) + { + int save_p_more = p_more; + + p_more = FALSE; + msg_row = Rows - 1; + msg_puts((char_u *)"\n"); + p_more = save_p_more; + --term->tl_toprow; + } + + for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end + && pos.row < Rows; ++pos.row) + { + if (pos.row < term->tl_rows) + { + int max_col = MIN(Columns, term->tl_cols); + + term_line2screenline(screen, &pos, max_col); + } + else + pos.col = 0; + + screen_line(term->tl_toprow + pos.row, 0, pos.col, Columns, FALSE); + } + + term->tl_dirty_row_start = MAX_ROW; + term->tl_dirty_row_end = 0; + update_cursor(term, TRUE); +} +#endif + +/* + * Return TRUE if window "wp" is to be redrawn with term_update_window(). + * Returns FALSE when there is no terminal running in this window or it is in + * Terminal-Normal mode. + */ + int +term_do_update_window(win_T *wp) +{ + term_T *term = wp->w_buffer->b_term; + + return term != NULL && term->tl_vterm != NULL && !term->tl_normal_mode; +} + +/* + * Called to update a window that contains an active terminal. + */ + void +term_update_window(win_T *wp) +{ + term_T *term = wp->w_buffer->b_term; + VTerm *vterm; + VTermScreen *screen; + VTermState *state; + VTermPos pos; + int rows, cols; + int newrows, newcols; + int minsize; + win_T *twp; + + vterm = term->tl_vterm; + screen = vterm_obtain_screen(vterm); + state = vterm_obtain_state(vterm); + + /* We use NOT_VALID on a resize or scroll, redraw everything then. With + * SOME_VALID only redraw what was marked dirty. */ + if (wp->w_redr_type > SOME_VALID) + { + term->tl_dirty_row_start = 0; + term->tl_dirty_row_end = MAX_ROW; + + if (term->tl_postponed_scroll > 0 + && term->tl_postponed_scroll < term->tl_rows / 3) + /* Scrolling is usually faster than redrawing, when there are only + * a few lines to scroll. */ + term_scroll_up(term, 0, term->tl_postponed_scroll); + term->tl_postponed_scroll = 0; + } + + /* + * If the window was resized a redraw will be triggered and we get here. + * Adjust the size of the vterm unless 'termwinsize' specifies a fixed size. + */ + minsize = parse_termwinsize(wp, &rows, &cols); + + newrows = 99999; + newcols = 99999; + FOR_ALL_WINDOWS(twp) + { + /* When more than one window shows the same terminal, use the + * smallest size. */ + if (twp->w_buffer == term->tl_buffer) + { + newrows = MIN(newrows, twp->w_height); + newcols = MIN(newcols, twp->w_width); + } + } + newrows = rows == 0 ? newrows : minsize ? MAX(rows, newrows) : rows; + newcols = cols == 0 ? newcols : minsize ? MAX(cols, newcols) : cols; + + if (term->tl_rows != newrows || term->tl_cols != newcols) + { + + + term->tl_vterm_size_changed = TRUE; + vterm_set_size(vterm, newrows, newcols); + ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines", + newrows); + term_report_winsize(term, newrows, newcols); + } + + /* The cursor may have been moved when resizing. */ + vterm_state_get_cursorpos(state, &pos); + position_cursor(wp, &pos); + + for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end + && pos.row < wp->w_height; ++pos.row) + { + if (pos.row < term->tl_rows) + { + int max_col = MIN(wp->w_width, term->tl_cols); + + term_line2screenline(screen, &pos, max_col); + } + else + pos.col = 0; + + screen_line(wp->w_winrow + pos.row +#ifdef FEAT_MENU + + winbar_height(wp) +#endif + , wp->w_wincol, pos.col, wp->w_width, FALSE); + } + term->tl_dirty_row_start = MAX_ROW; + term->tl_dirty_row_end = 0; +} + +/* + * Return TRUE if "wp" is a terminal window where the job has finished. + */ + int +term_is_finished(buf_T *buf) +{ + return buf->b_term != NULL && buf->b_term->tl_vterm == NULL; +} + +/* + * Return TRUE if "wp" is a terminal window where the job has finished or we + * are in Terminal-Normal mode, thus we show the buffer contents. + */ + int +term_show_buffer(buf_T *buf) +{ + term_T *term = buf->b_term; + + return term != NULL && (term->tl_vterm == NULL || term->tl_normal_mode); +} + +/* + * The current buffer is going to be changed. If there is terminal + * highlighting remove it now. + */ + void +term_change_in_curbuf(void) +{ + term_T *term = curbuf->b_term; + + if (term_is_finished(curbuf) && term->tl_scrollback.ga_len > 0) + { + free_scrollback(term); + redraw_buf_later(term->tl_buffer, NOT_VALID); + + /* The buffer is now like a normal buffer, it cannot be easily + * abandoned when changed. */ + set_string_option_direct((char_u *)"buftype", -1, + (char_u *)"", OPT_FREE|OPT_LOCAL, 0); + } +} + +/* + * Get the screen attribute for a position in the buffer. + * Use a negative "col" to get the filler background color. + */ + int +term_get_attr(buf_T *buf, linenr_T lnum, int col) +{ + term_T *term = buf->b_term; + sb_line_T *line; + cellattr_T *cellattr; + + if (lnum > term->tl_scrollback.ga_len) + cellattr = &term->tl_default_color; + else + { + line = (sb_line_T *)term->tl_scrollback.ga_data + lnum - 1; + if (col < 0 || col >= line->sb_cols) + cellattr = &line->sb_fill_attr; + else + cellattr = line->sb_cells + col; + } + return cell2attr(cellattr->attrs, cellattr->fg, cellattr->bg); +} + +/* + * Convert a cterm color number 0 - 255 to RGB. + * This is compatible with xterm. + */ + static void +cterm_color2vterm(int nr, VTermColor *rgb) +{ + cterm_color2rgb(nr, &rgb->red, &rgb->green, &rgb->blue, &rgb->ansi_index); +} + +/* + * Initialize term->tl_default_color from the environment. + */ + static void +init_default_colors(term_T *term) +{ + VTermColor *fg, *bg; + int fgval, bgval; + int id; + + vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs)); + term->tl_default_color.width = 1; + fg = &term->tl_default_color.fg; + bg = &term->tl_default_color.bg; + + /* Vterm uses a default black background. Set it to white when + * 'background' is "light". */ + if (*p_bg == 'l') + { + fgval = 0; + bgval = 255; + } + else + { + fgval = 255; + bgval = 0; + } + fg->red = fg->green = fg->blue = fgval; + bg->red = bg->green = bg->blue = bgval; + fg->ansi_index = bg->ansi_index = VTERM_ANSI_INDEX_DEFAULT; + + /* The "Terminal" highlight group overrules the defaults. */ + id = syn_name2id((char_u *)"Terminal"); + + /* Use the actual color for the GUI and when 'termguicolors' is set. */ +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (0 +# ifdef FEAT_GUI + || gui.in_use +# endif +# ifdef FEAT_TERMGUICOLORS + || p_tgc +# ifdef FEAT_VTP + /* Finally get INVALCOLOR on this execution path */ + || (!p_tgc && t_colors >= 256) +# endif +# endif + ) + { + guicolor_T fg_rgb = INVALCOLOR; + guicolor_T bg_rgb = INVALCOLOR; + + if (id != 0) + syn_id2colors(id, &fg_rgb, &bg_rgb); + +# ifdef FEAT_GUI + if (gui.in_use) + { + if (fg_rgb == INVALCOLOR) + fg_rgb = gui.norm_pixel; + if (bg_rgb == INVALCOLOR) + bg_rgb = gui.back_pixel; + } +# ifdef FEAT_TERMGUICOLORS + else +# endif +# endif +# ifdef FEAT_TERMGUICOLORS + { + if (fg_rgb == INVALCOLOR) + fg_rgb = cterm_normal_fg_gui_color; + if (bg_rgb == INVALCOLOR) + bg_rgb = cterm_normal_bg_gui_color; + } +# endif + if (fg_rgb != INVALCOLOR) + { + long_u rgb = GUI_MCH_GET_RGB(fg_rgb); + + fg->red = (unsigned)(rgb >> 16); + fg->green = (unsigned)(rgb >> 8) & 255; + fg->blue = (unsigned)rgb & 255; + } + if (bg_rgb != INVALCOLOR) + { + long_u rgb = GUI_MCH_GET_RGB(bg_rgb); + + bg->red = (unsigned)(rgb >> 16); + bg->green = (unsigned)(rgb >> 8) & 255; + bg->blue = (unsigned)rgb & 255; + } + } + else +#endif + if (id != 0 && t_colors >= 16) + { + if (term_default_cterm_fg >= 0) + cterm_color2vterm(term_default_cterm_fg, fg); + if (term_default_cterm_bg >= 0) + cterm_color2vterm(term_default_cterm_bg, bg); + } + else + { +#if defined(WIN3264) && !defined(FEAT_GUI_W32) + int tmp; +#endif + + /* In an MS-Windows console we know the normal colors. */ + if (cterm_normal_fg_color > 0) + { + cterm_color2vterm(cterm_normal_fg_color - 1, fg); +# if defined(WIN3264) && !defined(FEAT_GUI_W32) + tmp = fg->red; + fg->red = fg->blue; + fg->blue = tmp; +# endif + } +# ifdef FEAT_TERMRESPONSE + else + term_get_fg_color(&fg->red, &fg->green, &fg->blue); +# endif + + if (cterm_normal_bg_color > 0) + { + cterm_color2vterm(cterm_normal_bg_color - 1, bg); +# if defined(WIN3264) && !defined(FEAT_GUI_W32) + tmp = bg->red; + bg->red = bg->blue; + bg->blue = tmp; +# endif + } +# ifdef FEAT_TERMRESPONSE + else + term_get_bg_color(&bg->red, &bg->green, &bg->blue); +# endif + } +} + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +/* + * Set the 16 ANSI colors from array of RGB values + */ + static void +set_vterm_palette(VTerm *vterm, long_u *rgb) +{ + int index = 0; + VTermState *state = vterm_obtain_state(vterm); + for (; index < 16; index++) + { + VTermColor color; + color.red = (unsigned)(rgb[index] >> 16); + color.green = (unsigned)(rgb[index] >> 8) & 255; + color.blue = (unsigned)rgb[index] & 255; + vterm_state_set_palette_color(state, index, &color); + } +} + +/* + * Set the ANSI color palette from a list of colors + */ + static int +set_ansi_colors_list(VTerm *vterm, list_T *list) +{ + int n = 0; + long_u rgb[16]; + listitem_T *li = list->lv_first; + + for (; li != NULL && n < 16; li = li->li_next, n++) + { + char_u *color_name; + guicolor_T guicolor; + + color_name = get_tv_string_chk(&li->li_tv); + if (color_name == NULL) + return FAIL; + + guicolor = GUI_GET_COLOR(color_name); + if (guicolor == INVALCOLOR) + return FAIL; + + rgb[n] = GUI_MCH_GET_RGB(guicolor); + } + + if (n != 16 || li != NULL) + return FAIL; + + set_vterm_palette(vterm, rgb); + + return OK; +} + +/* + * Initialize the ANSI color palette from g:terminal_ansi_colors[0:15] + */ + static void +init_vterm_ansi_colors(VTerm *vterm) +{ + dictitem_T *var = find_var((char_u *)"g:terminal_ansi_colors", NULL, TRUE); + + if (var != NULL + && (var->di_tv.v_type != VAR_LIST + || var->di_tv.vval.v_list == NULL + || set_ansi_colors_list(vterm, var->di_tv.vval.v_list) == FAIL)) + EMSG2(_(e_invarg2), "g:terminal_ansi_colors"); +} +#endif + +/* + * Handles a "drop" command from the job in the terminal. + * "item" is the file name, "item->li_next" may have options. + */ + static void +handle_drop_command(listitem_T *item) +{ + char_u *fname = get_tv_string(&item->li_tv); + listitem_T *opt_item = item->li_next; + int bufnr; + win_T *wp; + tabpage_T *tp; + exarg_T ea; + char_u *tofree = NULL; + + bufnr = buflist_add(fname, BLN_LISTED | BLN_NOOPT); + FOR_ALL_TAB_WINDOWS(tp, wp) + { + if (wp->w_buffer->b_fnum == bufnr) + { + /* buffer is in a window already, go there */ + goto_tabpage_win(tp, wp); + return; + } + } + + vim_memset(&ea, 0, sizeof(ea)); + + if (opt_item != NULL && opt_item->li_tv.v_type == VAR_DICT + && opt_item->li_tv.vval.v_dict != NULL) + { + dict_T *dict = opt_item->li_tv.vval.v_dict; + char_u *p; + + p = get_dict_string(dict, (char_u *)"ff", FALSE); + if (p == NULL) + p = get_dict_string(dict, (char_u *)"fileformat", FALSE); + if (p != NULL) + { + if (check_ff_value(p) == FAIL) + ch_log(NULL, "Invalid ff argument to drop: %s", p); + else + ea.force_ff = *p; + } + p = get_dict_string(dict, (char_u *)"enc", FALSE); + if (p == NULL) + p = get_dict_string(dict, (char_u *)"encoding", FALSE); + if (p != NULL) + { + ea.cmd = alloc((int)STRLEN(p) + 12); + if (ea.cmd != NULL) + { + sprintf((char *)ea.cmd, "sbuf ++enc=%s", p); + ea.force_enc = 11; + tofree = ea.cmd; + } + } + + p = get_dict_string(dict, (char_u *)"bad", FALSE); + if (p != NULL) + get_bad_opt(p, &ea); + + if (dict_find(dict, (char_u *)"bin", -1) != NULL) + ea.force_bin = FORCE_BIN; + if (dict_find(dict, (char_u *)"binary", -1) != NULL) + ea.force_bin = FORCE_BIN; + if (dict_find(dict, (char_u *)"nobin", -1) != NULL) + ea.force_bin = FORCE_NOBIN; + if (dict_find(dict, (char_u *)"nobinary", -1) != NULL) + ea.force_bin = FORCE_NOBIN; + } + + /* open in new window, like ":split fname" */ + if (ea.cmd == NULL) + ea.cmd = (char_u *)"split"; + ea.arg = fname; + ea.cmdidx = CMD_split; + ex_splitview(&ea); + + vim_free(tofree); +} + +/* + * Handles a function call from the job running in a terminal. + * "item" is the function name, "item->li_next" has the arguments. + */ + static void +handle_call_command(term_T *term, channel_T *channel, listitem_T *item) +{ + char_u *func; + typval_T argvars[2]; + typval_T rettv; + int doesrange; + + if (item->li_next == NULL) + { + ch_log(channel, "Missing function arguments for call"); + return; + } + func = get_tv_string(&item->li_tv); + + if (STRNCMP(func, "Tapi_", 5) != 0) + { + ch_log(channel, "Invalid function name: %s", func); + return; + } + + argvars[0].v_type = VAR_NUMBER; + argvars[0].vval.v_number = term->tl_buffer->b_fnum; + argvars[1] = item->li_next->li_tv; + if (call_func(func, (int)STRLEN(func), &rettv, + 2, argvars, /* argv_func */ NULL, + /* firstline */ 1, /* lastline */ 1, + &doesrange, /* evaluate */ TRUE, + /* partial */ NULL, /* selfdict */ NULL) == OK) + { + clear_tv(&rettv); + ch_log(channel, "Function %s called", func); + } + else + ch_log(channel, "Calling function %s failed", func); +} + +/* + * Called by libvterm when it cannot recognize an OSC sequence. + * We recognize a terminal API command. + */ + static int +parse_osc(const char *command, size_t cmdlen, void *user) +{ + term_T *term = (term_T *)user; + js_read_T reader; + typval_T tv; + channel_T *channel = term->tl_job == NULL ? NULL + : term->tl_job->jv_channel; + + /* We recognize only OSC 5 1 ; {command} */ + if (cmdlen < 3 || STRNCMP(command, "51;", 3) != 0) + return 0; /* not handled */ + + reader.js_buf = vim_strnsave((char_u *)command + 3, (int)(cmdlen - 3)); + if (reader.js_buf == NULL) + return 1; + reader.js_fill = NULL; + reader.js_used = 0; + if (json_decode(&reader, &tv, 0) == OK + && tv.v_type == VAR_LIST + && tv.vval.v_list != NULL) + { + listitem_T *item = tv.vval.v_list->lv_first; + + if (item == NULL) + ch_log(channel, "Missing command"); + else + { + char_u *cmd = get_tv_string(&item->li_tv); + + /* Make sure an invoked command doesn't delete the buffer (and the + * terminal) under our fingers. */ + ++term->tl_buffer->b_locked; + + item = item->li_next; + if (item == NULL) + ch_log(channel, "Missing argument for %s", cmd); + else if (STRCMP(cmd, "drop") == 0) + handle_drop_command(item); + else if (STRCMP(cmd, "call") == 0) + handle_call_command(term, channel, item); + else + ch_log(channel, "Invalid command received: %s", cmd); + --term->tl_buffer->b_locked; + } + } + else + ch_log(channel, "Invalid JSON received"); + + vim_free(reader.js_buf); + clear_tv(&tv); + return 1; +} + +static VTermParserCallbacks parser_fallbacks = { + NULL, /* text */ + NULL, /* control */ + NULL, /* escape */ + NULL, /* csi */ + parse_osc, /* osc */ + NULL, /* dcs */ + NULL /* resize */ +}; + +/* + * Use Vim's allocation functions for vterm so profiling works. + */ + static void * +vterm_malloc(size_t size, void *data UNUSED) +{ + return alloc_clear((unsigned) size); +} + + static void +vterm_memfree(void *ptr, void *data UNUSED) +{ + vim_free(ptr); +} + +static VTermAllocatorFunctions vterm_allocator = { + &vterm_malloc, + &vterm_memfree +}; + +/* + * Create a new vterm and initialize it. + */ + static void +create_vterm(term_T *term, int rows, int cols) +{ + VTerm *vterm; + VTermScreen *screen; + VTermState *state; + VTermValue value; + + vterm = vterm_new_with_allocator(rows, cols, &vterm_allocator, NULL); + term->tl_vterm = vterm; + screen = vterm_obtain_screen(vterm); + vterm_screen_set_callbacks(screen, &screen_callbacks, term); + /* TODO: depends on 'encoding'. */ + vterm_set_utf8(vterm, 1); + + init_default_colors(term); + + vterm_state_set_default_colors( + vterm_obtain_state(vterm), + &term->tl_default_color.fg, + &term->tl_default_color.bg); + + if (t_colors >= 16) + vterm_state_set_bold_highbright(vterm_obtain_state(vterm), 1); + + /* Required to initialize most things. */ + vterm_screen_reset(screen, 1 /* hard */); + + /* Allow using alternate screen. */ + vterm_screen_enable_altscreen(screen, 1); + + /* For unix do not use a blinking cursor. In an xterm this causes the + * cursor to blink if it's blinking in the xterm. + * For Windows we respect the system wide setting. */ +#ifdef WIN3264 + if (GetCaretBlinkTime() == INFINITE) + value.boolean = 0; + else + value.boolean = 1; +#else + value.boolean = 0; +#endif + state = vterm_obtain_state(vterm); + vterm_state_set_termprop(state, VTERM_PROP_CURSORBLINK, &value); + vterm_state_set_unrecognised_fallbacks(state, &parser_fallbacks, term); +} + +/* + * Return the text to show for the buffer name and status. + */ + char_u * +term_get_status_text(term_T *term) +{ + if (term->tl_status_text == NULL) + { + char_u *txt; + size_t len; + + if (term->tl_normal_mode) + { + if (term_job_running(term)) + txt = (char_u *)_("Terminal"); + else + txt = (char_u *)_("Terminal-finished"); + } + else if (term->tl_title != NULL) + txt = term->tl_title; + else if (term_none_open(term)) + txt = (char_u *)_("active"); + else if (term_job_running(term)) + txt = (char_u *)_("running"); + else + txt = (char_u *)_("finished"); + len = 9 + STRLEN(term->tl_buffer->b_fname) + STRLEN(txt); + term->tl_status_text = alloc((int)len); + if (term->tl_status_text != NULL) + vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", + term->tl_buffer->b_fname, txt); + } + return term->tl_status_text; +} + +/* + * Mark references in jobs of terminals. + */ + int +set_ref_in_term(int copyID) +{ + int abort = FALSE; + term_T *term; + typval_T tv; + + for (term = first_term; term != NULL; term = term->tl_next) + if (term->tl_job != NULL) + { + tv.v_type = VAR_JOB; + tv.vval.v_job = term->tl_job; + abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} + +/* + * Cache "Terminal" highlight group colors. + */ + void +set_terminal_default_colors(int cterm_fg, int cterm_bg) +{ + term_default_cterm_fg = cterm_fg - 1; + term_default_cterm_bg = cterm_bg - 1; +} + +/* + * Get the buffer from the first argument in "argvars". + * Returns NULL when the buffer is not for a terminal window and logs a message + * with "where". + */ + static buf_T * +term_get_buf(typval_T *argvars, char *where) +{ + buf_T *buf; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + if (buf == NULL || buf->b_term == NULL) + { + ch_log(NULL, "%s: invalid buffer argument", where); + return NULL; + } + return buf; +} + + static int +same_color(VTermColor *a, VTermColor *b) +{ + return a->red == b->red + && a->green == b->green + && a->blue == b->blue + && a->ansi_index == b->ansi_index; +} + + static void +dump_term_color(FILE *fd, VTermColor *color) +{ + fprintf(fd, "%02x%02x%02x%d", + (int)color->red, (int)color->green, (int)color->blue, + (int)color->ansi_index); +} + +/* + * "term_dumpwrite(buf, filename, options)" function + * + * Each screen cell in full is: + * |{characters}+{attributes}#{fg-color}{color-idx}#{bg-color}{color-idx} + * {characters} is a space for an empty cell + * For a double-width character "+" is changed to "*" and the next cell is + * skipped. + * {attributes} is the decimal value of HL_BOLD + HL_UNDERLINE, etc. + * when "&" use the same as the previous cell. + * {fg-color} is hex RGB, when "&" use the same as the previous cell. + * {bg-color} is hex RGB, when "&" use the same as the previous cell. + * {color-idx} is a number from 0 to 255 + * + * Screen cell with same width, attributes and color as the previous one: + * |{characters} + * + * To use the color of the previous cell, use "&" instead of {color}-{idx}. + * + * Repeating the previous screen cell: + * @{count} + */ + void +f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_dumpwrite()"); + term_T *term; + char_u *fname; + int max_height = 0; + int max_width = 0; + stat_T st; + FILE *fd; + VTermPos pos; + VTermScreen *screen; + VTermScreenCell prev_cell; + VTermState *state; + VTermPos cursor_pos; + + if (check_restricted() || check_secure()) + return; + if (buf == NULL) + return; + term = buf->b_term; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + dict_T *d; + + if (argvars[2].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + d = argvars[2].vval.v_dict; + if (d != NULL) + { + max_height = get_dict_number(d, (char_u *)"rows"); + max_width = get_dict_number(d, (char_u *)"columns"); + } + } + + fname = get_tv_string_chk(&argvars[1]); + if (fname == NULL) + return; + if (mch_stat((char *)fname, &st) >= 0) + { + EMSG2(_("E953: File exists: %s"), fname); + return; + } + + if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) + { + EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname); + return; + } + + vim_memset(&prev_cell, 0, sizeof(prev_cell)); + + screen = vterm_obtain_screen(term->tl_vterm); + state = vterm_obtain_state(term->tl_vterm); + vterm_state_get_cursorpos(state, &cursor_pos); + + for (pos.row = 0; (max_height == 0 || pos.row < max_height) + && pos.row < term->tl_rows; ++pos.row) + { + int repeat = 0; + + for (pos.col = 0; (max_width == 0 || pos.col < max_width) + && pos.col < term->tl_cols; ++pos.col) + { + VTermScreenCell cell; + int same_attr; + int same_chars = TRUE; + int i; + int is_cursor_pos = (pos.col == cursor_pos.col + && pos.row == cursor_pos.row); + + if (vterm_screen_get_cell(screen, pos, &cell) == 0) + vim_memset(&cell, 0, sizeof(cell)); + + for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i) + { + int c = cell.chars[i]; + int pc = prev_cell.chars[i]; + + /* For the first character NUL is the same as space. */ + if (i == 0) + { + c = (c == NUL) ? ' ' : c; + pc = (pc == NUL) ? ' ' : pc; + } + if (cell.chars[i] != prev_cell.chars[i]) + same_chars = FALSE; + if (cell.chars[i] == NUL || prev_cell.chars[i] == NUL) + break; + } + same_attr = vtermAttr2hl(cell.attrs) + == vtermAttr2hl(prev_cell.attrs) + && same_color(&cell.fg, &prev_cell.fg) + && same_color(&cell.bg, &prev_cell.bg); + if (same_chars && cell.width == prev_cell.width && same_attr + && !is_cursor_pos) + { + ++repeat; + } + else + { + if (repeat > 0) + { + fprintf(fd, "@%d", repeat); + repeat = 0; + } + fputs(is_cursor_pos ? ">" : "|", fd); + + if (cell.chars[0] == NUL) + fputs(" ", fd); + else + { + char_u charbuf[10]; + int len; + + for (i = 0; i < VTERM_MAX_CHARS_PER_CELL + && cell.chars[i] != NUL; ++i) + { + len = utf_char2bytes(cell.chars[i], charbuf); + fwrite(charbuf, len, 1, fd); + } + } + + /* When only the characters differ we don't write anything, the + * following "|", "@" or NL will indicate using the same + * attributes. */ + if (cell.width != prev_cell.width || !same_attr) + { + if (cell.width == 2) + { + fputs("*", fd); + ++pos.col; + } + else + fputs("+", fd); + + if (same_attr) + { + fputs("&", fd); + } + else + { + fprintf(fd, "%d", vtermAttr2hl(cell.attrs)); + if (same_color(&cell.fg, &prev_cell.fg)) + fputs("&", fd); + else + { + fputs("#", fd); + dump_term_color(fd, &cell.fg); + } + if (same_color(&cell.bg, &prev_cell.bg)) + fputs("&", fd); + else + { + fputs("#", fd); + dump_term_color(fd, &cell.bg); + } + } + } + + prev_cell = cell; + } + } + if (repeat > 0) + fprintf(fd, "@%d", repeat); + fputs("\n", fd); + } + + fclose(fd); +} + +/* + * Called when a dump is corrupted. Put a breakpoint here when debugging. + */ + static void +dump_is_corrupt(garray_T *gap) +{ + ga_concat(gap, (char_u *)"CORRUPT"); +} + + static void +append_cell(garray_T *gap, cellattr_T *cell) +{ + if (ga_grow(gap, 1) == OK) + { + *(((cellattr_T *)gap->ga_data) + gap->ga_len) = *cell; + ++gap->ga_len; + } +} + +/* + * Read the dump file from "fd" and append lines to the current buffer. + * Return the cell width of the longest line. + */ + static int +read_dump_file(FILE *fd, VTermPos *cursor_pos) +{ + int c; + garray_T ga_text; + garray_T ga_cell; + char_u *prev_char = NULL; + int attr = 0; + cellattr_T cell; + term_T *term = curbuf->b_term; + int max_cells = 0; + int start_row = term->tl_scrollback.ga_len; + + ga_init2(&ga_text, 1, 90); + ga_init2(&ga_cell, sizeof(cellattr_T), 90); + vim_memset(&cell, 0, sizeof(cell)); + cursor_pos->row = -1; + cursor_pos->col = -1; + + c = fgetc(fd); + for (;;) + { + if (c == EOF) + break; + if (c == '\n') + { + /* End of a line: append it to the buffer. */ + if (ga_text.ga_data == NULL) + dump_is_corrupt(&ga_text); + if (ga_grow(&term->tl_scrollback, 1) == OK) + { + sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + + if (max_cells < ga_cell.ga_len) + max_cells = ga_cell.ga_len; + line->sb_cols = ga_cell.ga_len; + line->sb_cells = ga_cell.ga_data; + line->sb_fill_attr = term->tl_default_color; + ++term->tl_scrollback.ga_len; + ga_init(&ga_cell); + + ga_append(&ga_text, NUL); + ml_append(curbuf->b_ml.ml_line_count, ga_text.ga_data, + ga_text.ga_len, FALSE); + } + else + ga_clear(&ga_cell); + ga_text.ga_len = 0; + + c = fgetc(fd); + } + else if (c == '|' || c == '>') + { + int prev_len = ga_text.ga_len; + + if (c == '>') + { + if (cursor_pos->row != -1) + dump_is_corrupt(&ga_text); /* duplicate cursor */ + cursor_pos->row = term->tl_scrollback.ga_len - start_row; + cursor_pos->col = ga_cell.ga_len; + } + + /* normal character(s) followed by "+", "*", "|", "@" or NL */ + c = fgetc(fd); + if (c != EOF) + ga_append(&ga_text, c); + for (;;) + { + c = fgetc(fd); + if (c == '+' || c == '*' || c == '|' || c == '>' || c == '@' + || c == EOF || c == '\n') + break; + ga_append(&ga_text, c); + } + + /* save the character for repeating it */ + vim_free(prev_char); + if (ga_text.ga_data != NULL) + prev_char = vim_strnsave(((char_u *)ga_text.ga_data) + prev_len, + ga_text.ga_len - prev_len); + + if (c == '@' || c == '|' || c == '>' || c == '\n') + { + /* use all attributes from previous cell */ + } + else if (c == '+' || c == '*') + { + int is_bg; + + cell.width = c == '+' ? 1 : 2; + + c = fgetc(fd); + if (c == '&') + { + /* use same attr as previous cell */ + c = fgetc(fd); + } + else if (isdigit(c)) + { + /* get the decimal attribute */ + attr = 0; + while (isdigit(c)) + { + attr = attr * 10 + (c - '0'); + c = fgetc(fd); + } + hl2vtermAttr(attr, &cell); + } + else + dump_is_corrupt(&ga_text); + + /* is_bg == 0: fg, is_bg == 1: bg */ + for (is_bg = 0; is_bg <= 1; ++is_bg) + { + if (c == '&') + { + /* use same color as previous cell */ + c = fgetc(fd); + } + else if (c == '#') + { + int red, green, blue, index = 0; + + c = fgetc(fd); + red = hex2nr(c); + c = fgetc(fd); + red = (red << 4) + hex2nr(c); + c = fgetc(fd); + green = hex2nr(c); + c = fgetc(fd); + green = (green << 4) + hex2nr(c); + c = fgetc(fd); + blue = hex2nr(c); + c = fgetc(fd); + blue = (blue << 4) + hex2nr(c); + c = fgetc(fd); + if (!isdigit(c)) + dump_is_corrupt(&ga_text); + while (isdigit(c)) + { + index = index * 10 + (c - '0'); + c = fgetc(fd); + } + + if (is_bg) + { + cell.bg.red = red; + cell.bg.green = green; + cell.bg.blue = blue; + cell.bg.ansi_index = index; + } + else + { + cell.fg.red = red; + cell.fg.green = green; + cell.fg.blue = blue; + cell.fg.ansi_index = index; + } + } + else + dump_is_corrupt(&ga_text); + } + } + else + dump_is_corrupt(&ga_text); + + append_cell(&ga_cell, &cell); + } + else if (c == '@') + { + if (prev_char == NULL) + dump_is_corrupt(&ga_text); + else + { + int count = 0; + + /* repeat previous character, get the count */ + for (;;) + { + c = fgetc(fd); + if (!isdigit(c)) + break; + count = count * 10 + (c - '0'); + } + + while (count-- > 0) + { + ga_concat(&ga_text, prev_char); + append_cell(&ga_cell, &cell); + } + } + } + else + { + dump_is_corrupt(&ga_text); + c = fgetc(fd); + } + } + + if (ga_text.ga_len > 0) + { + /* trailing characters after last NL */ + dump_is_corrupt(&ga_text); + ga_append(&ga_text, NUL); + ml_append(curbuf->b_ml.ml_line_count, ga_text.ga_data, + ga_text.ga_len, FALSE); + } + + ga_clear(&ga_text); + vim_free(prev_char); + + return max_cells; +} + +/* + * Return an allocated string with at least "text_width" "=" characters and + * "fname" inserted in the middle. + */ + static char_u * +get_separator(int text_width, char_u *fname) +{ + int width = MAX(text_width, curwin->w_width); + char_u *textline; + int fname_size; + char_u *p = fname; + int i; + size_t off; + + textline = alloc(width + (int)STRLEN(fname) + 1); + if (textline == NULL) + return NULL; + + fname_size = vim_strsize(fname); + if (fname_size < width - 8) + { + /* enough room, don't use the full window width */ + width = MAX(text_width, fname_size + 8); + } + else if (fname_size > width - 8) + { + /* full name doesn't fit, use only the tail */ + p = gettail(fname); + fname_size = vim_strsize(p); + } + /* skip characters until the name fits */ + while (fname_size > width - 8) + { + p += (*mb_ptr2len)(p); + fname_size = vim_strsize(p); + } + + for (i = 0; i < (width - fname_size) / 2 - 1; ++i) + textline[i] = '='; + textline[i++] = ' '; + + STRCPY(textline + i, p); + off = STRLEN(textline); + textline[off] = ' '; + for (i = 1; i < (width - fname_size) / 2; ++i) + textline[off + i] = '='; + textline[off + i] = NUL; + + return textline; +} + +/* + * Common for "term_dumpdiff()" and "term_dumpload()". + */ + static void +term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff) +{ + jobopt_T opt; + buf_T *buf; + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *fname1; + char_u *fname2 = NULL; + char_u *fname_tofree = NULL; + FILE *fd1; + FILE *fd2 = NULL; + char_u *textline = NULL; + + /* First open the files. If this fails bail out. */ + fname1 = get_tv_string_buf_chk(&argvars[0], buf1); + if (do_diff) + fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + if (fname1 == NULL || (do_diff && fname2 == NULL)) + { + EMSG(_(e_invarg)); + return; + } + fd1 = mch_fopen((char *)fname1, READBIN); + if (fd1 == NULL) + { + EMSG2(_(e_notread), fname1); + return; + } + if (do_diff) + { + fd2 = mch_fopen((char *)fname2, READBIN); + if (fd2 == NULL) + { + fclose(fd1); + EMSG2(_(e_notread), fname2); + return; + } + } + + init_job_options(&opt); + if (argvars[do_diff ? 2 : 1].v_type != VAR_UNKNOWN + && get_job_options(&argvars[do_diff ? 2 : 1], &opt, 0, + JO2_TERM_NAME + JO2_TERM_COLS + JO2_TERM_ROWS + + JO2_VERTICAL + JO2_CURWIN + JO2_NORESTORE) == FAIL) + goto theend; + + if (opt.jo_term_name == NULL) + { + size_t len = STRLEN(fname1) + 12; + + fname_tofree = alloc((int)len); + if (fname_tofree != NULL) + { + vim_snprintf((char *)fname_tofree, len, "dump diff %s", fname1); + opt.jo_term_name = fname_tofree; + } + } + + buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB); + if (buf != NULL && buf->b_term != NULL) + { + int i; + linenr_T bot_lnum; + linenr_T lnum; + term_T *term = buf->b_term; + int width; + int width2; + VTermPos cursor_pos1; + VTermPos cursor_pos2; + + init_default_colors(term); + + rettv->vval.v_number = buf->b_fnum; + + /* read the files, fill the buffer with the diff */ + width = read_dump_file(fd1, &cursor_pos1); + + /* position the cursor */ + if (cursor_pos1.row >= 0) + { + curwin->w_cursor.lnum = cursor_pos1.row + 1; + coladvance(cursor_pos1.col); + } + + /* Delete the empty line that was in the empty buffer. */ + ml_delete(1, FALSE); + + /* For term_dumpload() we are done here. */ + if (!do_diff) + goto theend; + + term->tl_top_diff_rows = curbuf->b_ml.ml_line_count; + + textline = get_separator(width, fname1); + if (textline == NULL) + goto theend; + if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) + ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE); + vim_free(textline); + + textline = get_separator(width, fname2); + if (textline == NULL) + goto theend; + if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) + ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE); + textline[width] = NUL; + + bot_lnum = curbuf->b_ml.ml_line_count; + width2 = read_dump_file(fd2, &cursor_pos2); + if (width2 > width) + { + vim_free(textline); + textline = alloc(width2 + 1); + if (textline == NULL) + goto theend; + width = width2; + textline[width] = NUL; + } + term->tl_bot_diff_rows = curbuf->b_ml.ml_line_count - bot_lnum; + + for (lnum = 1; lnum <= term->tl_top_diff_rows; ++lnum) + { + if (lnum + bot_lnum > curbuf->b_ml.ml_line_count) + { + /* bottom part has fewer rows, fill with "-" */ + for (i = 0; i < width; ++i) + textline[i] = '-'; + } + else + { + char_u *line1; + char_u *line2; + char_u *p1; + char_u *p2; + int col; + sb_line_T *sb_line = (sb_line_T *)term->tl_scrollback.ga_data; + cellattr_T *cellattr1 = (sb_line + lnum - 1)->sb_cells; + cellattr_T *cellattr2 = (sb_line + lnum + bot_lnum - 1) + ->sb_cells; + + /* Make a copy, getting the second line will invalidate it. */ + line1 = vim_strsave(ml_get(lnum)); + if (line1 == NULL) + break; + p1 = line1; + + line2 = ml_get(lnum + bot_lnum); + p2 = line2; + for (col = 0; col < width && *p1 != NUL && *p2 != NUL; ++col) + { + int len1 = utfc_ptr2len(p1); + int len2 = utfc_ptr2len(p2); + + textline[col] = ' '; + if (len1 != len2 || STRNCMP(p1, p2, len1) != 0) + /* text differs */ + textline[col] = 'X'; + else if (lnum == cursor_pos1.row + 1 + && col == cursor_pos1.col + && (cursor_pos1.row != cursor_pos2.row + || cursor_pos1.col != cursor_pos2.col)) + /* cursor in first but not in second */ + textline[col] = '>'; + else if (lnum == cursor_pos2.row + 1 + && col == cursor_pos2.col + && (cursor_pos1.row != cursor_pos2.row + || cursor_pos1.col != cursor_pos2.col)) + /* cursor in second but not in first */ + textline[col] = '<'; + else if (cellattr1 != NULL && cellattr2 != NULL) + { + if ((cellattr1 + col)->width + != (cellattr2 + col)->width) + textline[col] = 'w'; + else if (!same_color(&(cellattr1 + col)->fg, + &(cellattr2 + col)->fg)) + textline[col] = 'f'; + else if (!same_color(&(cellattr1 + col)->bg, + &(cellattr2 + col)->bg)) + textline[col] = 'b'; + else if (vtermAttr2hl((cellattr1 + col)->attrs) + != vtermAttr2hl(((cellattr2 + col)->attrs))) + textline[col] = 'a'; + } + p1 += len1; + p2 += len2; + /* TODO: handle different width */ + } + vim_free(line1); + + while (col < width) + { + if (*p1 == NUL && *p2 == NUL) + textline[col] = '?'; + else if (*p1 == NUL) + { + textline[col] = '+'; + p2 += utfc_ptr2len(p2); + } + else + { + textline[col] = '-'; + p1 += utfc_ptr2len(p1); + } + ++col; + } + } + if (add_empty_scrollback(term, &term->tl_default_color, + term->tl_top_diff_rows) == OK) + ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); + ++bot_lnum; + } + + while (lnum + bot_lnum <= curbuf->b_ml.ml_line_count) + { + /* bottom part has more rows, fill with "+" */ + for (i = 0; i < width; ++i) + textline[i] = '+'; + if (add_empty_scrollback(term, &term->tl_default_color, + term->tl_top_diff_rows) == OK) + ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); + ++lnum; + ++bot_lnum; + } + + term->tl_cols = width; + + /* looks better without wrapping */ + curwin->w_p_wrap = 0; + } + +theend: + vim_free(textline); + vim_free(fname_tofree); + fclose(fd1); + if (fd2 != NULL) + fclose(fd2); +} + +/* + * If the current buffer shows the output of term_dumpdiff(), swap the top and + * bottom files. + * Return FAIL when this is not possible. + */ + int +term_swap_diff() +{ + term_T *term = curbuf->b_term; + linenr_T line_count; + linenr_T top_rows; + linenr_T bot_rows; + linenr_T bot_start; + linenr_T lnum; + char_u *p; + sb_line_T *sb_line; + + if (term == NULL + || !term_is_finished(curbuf) + || term->tl_top_diff_rows == 0 + || term->tl_scrollback.ga_len == 0) + return FAIL; + + line_count = curbuf->b_ml.ml_line_count; + top_rows = term->tl_top_diff_rows; + bot_rows = term->tl_bot_diff_rows; + bot_start = line_count - bot_rows; + sb_line = (sb_line_T *)term->tl_scrollback.ga_data; + + /* move lines from top to above the bottom part */ + for (lnum = 1; lnum <= top_rows; ++lnum) + { + p = vim_strsave(ml_get(1)); + if (p == NULL) + return OK; + ml_append(bot_start, p, 0, FALSE); + ml_delete(1, FALSE); + vim_free(p); + } + + /* move lines from bottom to the top */ + for (lnum = 1; lnum <= bot_rows; ++lnum) + { + p = vim_strsave(ml_get(bot_start + lnum)); + if (p == NULL) + return OK; + ml_delete(bot_start + lnum, FALSE); + ml_append(lnum - 1, p, 0, FALSE); + vim_free(p); + } + + if (top_rows == bot_rows) + { + /* rows counts are equal, can swap cell properties */ + for (lnum = 0; lnum < top_rows; ++lnum) + { + sb_line_T temp; + + temp = *(sb_line + lnum); + *(sb_line + lnum) = *(sb_line + bot_start + lnum); + *(sb_line + bot_start + lnum) = temp; + } + } + else + { + size_t size = sizeof(sb_line_T) * term->tl_scrollback.ga_len; + sb_line_T *temp = (sb_line_T *)alloc((int)size); + + /* need to copy cell properties into temp memory */ + if (temp != NULL) + { + mch_memmove(temp, term->tl_scrollback.ga_data, size); + mch_memmove(term->tl_scrollback.ga_data, + temp + bot_start, + sizeof(sb_line_T) * bot_rows); + mch_memmove((sb_line_T *)term->tl_scrollback.ga_data + bot_rows, + temp + top_rows, + sizeof(sb_line_T) * (line_count - top_rows - bot_rows)); + mch_memmove((sb_line_T *)term->tl_scrollback.ga_data + + line_count - top_rows, + temp, + sizeof(sb_line_T) * top_rows); + vim_free(temp); + } + } + + term->tl_top_diff_rows = bot_rows; + term->tl_bot_diff_rows = top_rows; + + update_screen(NOT_VALID); + return OK; +} + +/* + * "term_dumpdiff(filename, filename, options)" function + */ + void +f_term_dumpdiff(typval_T *argvars, typval_T *rettv) +{ + term_load_dump(argvars, rettv, TRUE); +} + +/* + * "term_dumpload(filename, options)" function + */ + void +f_term_dumpload(typval_T *argvars, typval_T *rettv) +{ + term_load_dump(argvars, rettv, FALSE); +} + +/* + * "term_getaltscreen(buf)" function + */ + void +f_term_getaltscreen(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getaltscreen()"); + + if (buf == NULL) + return; + rettv->vval.v_number = buf->b_term->tl_using_altscreen; +} + +/* + * "term_getattr(attr, name)" function + */ + void +f_term_getattr(typval_T *argvars, typval_T *rettv) +{ + int attr; + size_t i; + char_u *name; + + static struct { + char *name; + int attr; + } attrs[] = { + {"bold", HL_BOLD}, + {"italic", HL_ITALIC}, + {"underline", HL_UNDERLINE}, + {"strike", HL_STRIKETHROUGH}, + {"reverse", HL_INVERSE}, + }; + + attr = get_tv_number(&argvars[0]); + name = get_tv_string_chk(&argvars[1]); + if (name == NULL) + return; + + for (i = 0; i < sizeof(attrs)/sizeof(attrs[0]); ++i) + if (STRCMP(name, attrs[i].name) == 0) + { + rettv->vval.v_number = (attr & attrs[i].attr) != 0 ? 1 : 0; + break; + } +} + +/* + * "term_getcursor(buf)" function + */ + void +f_term_getcursor(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getcursor()"); + term_T *term; + list_T *l; + dict_T *d; + + if (rettv_list_alloc(rettv) == FAIL) + return; + if (buf == NULL) + return; + term = buf->b_term; + + l = rettv->vval.v_list; + list_append_number(l, term->tl_cursor_pos.row + 1); + list_append_number(l, term->tl_cursor_pos.col + 1); + + d = dict_alloc(); + if (d != NULL) + { + dict_add_nr_str(d, "visible", term->tl_cursor_visible, NULL); + dict_add_nr_str(d, "blink", blink_state_is_inverted() + ? !term->tl_cursor_blink : term->tl_cursor_blink, NULL); + dict_add_nr_str(d, "shape", term->tl_cursor_shape, NULL); + dict_add_nr_str(d, "color", 0L, cursor_color_get(term->tl_cursor_color)); + list_append_dict(l, d); + } +} + +/* + * "term_getjob(buf)" function + */ + void +f_term_getjob(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getjob()"); + + rettv->v_type = VAR_JOB; + rettv->vval.v_job = NULL; + if (buf == NULL) + return; + + rettv->vval.v_job = buf->b_term->tl_job; + if (rettv->vval.v_job != NULL) + ++rettv->vval.v_job->jv_refcount; +} + + static int +get_row_number(typval_T *tv, term_T *term) +{ + if (tv->v_type == VAR_STRING + && tv->vval.v_string != NULL + && STRCMP(tv->vval.v_string, ".") == 0) + return term->tl_cursor_pos.row; + return (int)get_tv_number(tv) - 1; +} + +/* + * "term_getline(buf, row)" function + */ + void +f_term_getline(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getline()"); + term_T *term; + int row; + + rettv->v_type = VAR_STRING; + if (buf == NULL) + return; + term = buf->b_term; + row = get_row_number(&argvars[1], term); + + if (term->tl_vterm == NULL) + { + linenr_T lnum = row + term->tl_scrollback_scrolled + 1; + + /* vterm is finished, get the text from the buffer */ + if (lnum > 0 && lnum <= buf->b_ml.ml_line_count) + rettv->vval.v_string = vim_strsave(ml_get_buf(buf, lnum, FALSE)); + } + else + { + VTermScreen *screen = vterm_obtain_screen(term->tl_vterm); + VTermRect rect; + int len; + char_u *p; + + if (row < 0 || row >= term->tl_rows) + return; + len = term->tl_cols * MB_MAXBYTES + 1; + p = alloc(len); + if (p == NULL) + return; + rettv->vval.v_string = p; + + rect.start_col = 0; + rect.end_col = term->tl_cols; + rect.start_row = row; + rect.end_row = row + 1; + p[vterm_screen_get_text(screen, (char *)p, len, rect)] = NUL; + } +} + +/* + * "term_getscrolled(buf)" function + */ + void +f_term_getscrolled(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getscrolled()"); + + if (buf == NULL) + return; + rettv->vval.v_number = buf->b_term->tl_scrollback_scrolled; +} + +/* + * "term_getsize(buf)" function + */ + void +f_term_getsize(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getsize()"); + list_T *l; + + if (rettv_list_alloc(rettv) == FAIL) + return; + if (buf == NULL) + return; + + l = rettv->vval.v_list; + list_append_number(l, buf->b_term->tl_rows); + list_append_number(l, buf->b_term->tl_cols); +} + +/* + * "term_setsize(buf, rows, cols)" function + */ + void +f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setsize()"); + term_T *term; + varnumber_T rows, cols; + + if (buf == NULL) + { + EMSG(_("E955: Not a terminal buffer")); + return; + } + if (buf->b_term->tl_vterm == NULL) + return; + term = buf->b_term; + rows = get_tv_number(&argvars[1]); + rows = rows <= 0 ? term->tl_rows : rows; + cols = get_tv_number(&argvars[2]); + cols = cols <= 0 ? term->tl_cols : cols; + vterm_set_size(term->tl_vterm, rows, cols); + /* handle_resize() will resize the windows */ + + /* Get and remember the size we ended up with. Update the pty. */ + vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); + term_report_winsize(term, term->tl_rows, term->tl_cols); +} + +/* + * "term_getstatus(buf)" function + */ + void +f_term_getstatus(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getstatus()"); + term_T *term; + char_u val[100]; + + rettv->v_type = VAR_STRING; + if (buf == NULL) + return; + term = buf->b_term; + + if (term_job_running(term)) + STRCPY(val, "running"); + else + STRCPY(val, "finished"); + if (term->tl_normal_mode) + STRCAT(val, ",normal"); + rettv->vval.v_string = vim_strsave(val); +} + +/* + * "term_gettitle(buf)" function + */ + void +f_term_gettitle(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_gettitle()"); + + rettv->v_type = VAR_STRING; + if (buf == NULL) + return; + + if (buf->b_term->tl_title != NULL) + rettv->vval.v_string = vim_strsave(buf->b_term->tl_title); +} + +/* + * "term_gettty(buf)" function + */ + void +f_term_gettty(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_gettty()"); + char_u *p = NULL; + int num = 0; + + rettv->v_type = VAR_STRING; + if (buf == NULL) + return; + if (argvars[1].v_type != VAR_UNKNOWN) + num = get_tv_number(&argvars[1]); + + switch (num) + { + case 0: + if (buf->b_term->tl_job != NULL) + p = buf->b_term->tl_job->jv_tty_out; + break; + case 1: + if (buf->b_term->tl_job != NULL) + p = buf->b_term->tl_job->jv_tty_in; + break; + default: + EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); + return; + } + if (p != NULL) + rettv->vval.v_string = vim_strsave(p); +} + +/* + * "term_list()" function + */ + void +f_term_list(typval_T *argvars UNUSED, typval_T *rettv) +{ + term_T *tp; + list_T *l; + + if (rettv_list_alloc(rettv) == FAIL || first_term == NULL) + return; + + l = rettv->vval.v_list; + for (tp = first_term; tp != NULL; tp = tp->tl_next) + if (tp != NULL && tp->tl_buffer != NULL) + if (list_append_number(l, + (varnumber_T)tp->tl_buffer->b_fnum) == FAIL) + return; +} + +/* + * "term_scrape(buf, row)" function + */ + void +f_term_scrape(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_scrape()"); + VTermScreen *screen = NULL; + VTermPos pos; + list_T *l; + term_T *term; + char_u *p; + sb_line_T *line; + + if (rettv_list_alloc(rettv) == FAIL) + return; + if (buf == NULL) + return; + term = buf->b_term; + + l = rettv->vval.v_list; + pos.row = get_row_number(&argvars[1], term); + + if (term->tl_vterm != NULL) + { + screen = vterm_obtain_screen(term->tl_vterm); + p = NULL; + line = NULL; + } + else + { + linenr_T lnum = pos.row + term->tl_scrollback_scrolled; + + if (lnum < 0 || lnum >= term->tl_scrollback.ga_len) + return; + p = ml_get_buf(buf, lnum + 1, FALSE); + line = (sb_line_T *)term->tl_scrollback.ga_data + lnum; + } + + for (pos.col = 0; pos.col < term->tl_cols; ) + { + dict_T *dcell; + int width; + VTermScreenCellAttrs attrs; + VTermColor fg, bg; + char_u rgb[8]; + char_u mbs[MB_MAXBYTES * VTERM_MAX_CHARS_PER_CELL + 1]; + int off = 0; + int i; + + if (screen == NULL) + { + cellattr_T *cellattr; + int len; + + /* vterm has finished, get the cell from scrollback */ + if (pos.col >= line->sb_cols) + break; + cellattr = line->sb_cells + pos.col; + width = cellattr->width; + attrs = cellattr->attrs; + fg = cellattr->fg; + bg = cellattr->bg; + len = MB_PTR2LEN(p); + mch_memmove(mbs, p, len); + mbs[len] = NUL; + p += len; + } + else + { + VTermScreenCell cell; + if (vterm_screen_get_cell(screen, pos, &cell) == 0) + break; + for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i) + { + if (cell.chars[i] == 0) + break; + off += (*utf_char2bytes)((int)cell.chars[i], mbs + off); + } + mbs[off] = NUL; + width = cell.width; + attrs = cell.attrs; + fg = cell.fg; + bg = cell.bg; + } + dcell = dict_alloc(); + if (dcell == NULL) + break; + list_append_dict(l, dcell); + + dict_add_nr_str(dcell, "chars", 0, mbs); + + vim_snprintf((char *)rgb, 8, "#%02x%02x%02x", + fg.red, fg.green, fg.blue); + dict_add_nr_str(dcell, "fg", 0, rgb); + vim_snprintf((char *)rgb, 8, "#%02x%02x%02x", + bg.red, bg.green, bg.blue); + dict_add_nr_str(dcell, "bg", 0, rgb); + + dict_add_nr_str(dcell, "attr", + cell2attr(attrs, fg, bg), NULL); + dict_add_nr_str(dcell, "width", width, NULL); + + ++pos.col; + if (width == 2) + ++pos.col; + } +} + +/* + * "term_sendkeys(buf, keys)" function + */ + void +f_term_sendkeys(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_sendkeys()"); + char_u *msg; + term_T *term; + + rettv->v_type = VAR_UNKNOWN; + if (buf == NULL) + return; + + msg = get_tv_string_chk(&argvars[1]); + if (msg == NULL) + return; + term = buf->b_term; + if (term->tl_vterm == NULL) + return; + + while (*msg != NUL) + { + int c; + + if (*msg == K_SPECIAL && msg[1] != NUL && msg[2] != NUL) + { + c = TO_SPECIAL(msg[1], msg[2]); + msg += 3; + } + else + { + c = PTR2CHAR(msg); + msg += MB_CPTR2LEN(msg); + } + send_keys_to_term(term, c, FALSE); + } +} + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) +/* + * "term_getansicolors(buf)" function + */ + void +f_term_getansicolors(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getansicolors()"); + term_T *term; + VTermState *state; + VTermColor color; + char_u hexbuf[10]; + int index; + list_T *list; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + if (buf == NULL) + return; + term = buf->b_term; + if (term->tl_vterm == NULL) + return; + + list = rettv->vval.v_list; + state = vterm_obtain_state(term->tl_vterm); + for (index = 0; index < 16; index++) + { + vterm_state_get_palette_color(state, index, &color); + sprintf((char *)hexbuf, "#%02x%02x%02x", + color.red, color.green, color.blue); + if (list_append_string(list, hexbuf, 7) == FAIL) + return; + } +} + +/* + * "term_setansicolors(buf, list)" function + */ + void +f_term_setansicolors(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setansicolors()"); + term_T *term; + + if (buf == NULL) + return; + term = buf->b_term; + if (term->tl_vterm == NULL) + return; + + if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) + { + EMSG(_(e_listreq)); + return; + } + + if (set_ansi_colors_list(term->tl_vterm, argvars[1].vval.v_list) == FAIL) + EMSG(_(e_invarg)); +} +#endif + +/* + * "term_setrestore(buf, command)" function + */ + void +f_term_setrestore(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#if defined(FEAT_SESSION) + buf_T *buf = term_get_buf(argvars, "term_setrestore()"); + term_T *term; + char_u *cmd; + + if (buf == NULL) + return; + term = buf->b_term; + vim_free(term->tl_command); + cmd = get_tv_string_chk(&argvars[1]); + if (cmd != NULL) + term->tl_command = vim_strsave(cmd); + else + term->tl_command = NULL; +#endif +} + +/* + * "term_setkill(buf, how)" function + */ + void +f_term_setkill(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setkill()"); + term_T *term; + char_u *how; + + if (buf == NULL) + return; + term = buf->b_term; + vim_free(term->tl_kill); + how = get_tv_string_chk(&argvars[1]); + if (how != NULL) + term->tl_kill = vim_strsave(how); + else + term->tl_kill = NULL; +} + +/* + * "term_start(command, options)" function + */ + void +f_term_start(typval_T *argvars, typval_T *rettv) +{ + jobopt_T opt; + buf_T *buf; + + init_job_options(&opt); + if (argvars[1].v_type != VAR_UNKNOWN + && get_job_options(&argvars[1], &opt, + JO_TIMEOUT_ALL + JO_STOPONEXIT + + JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + + JO_EXIT_CB + JO_CLOSE_CALLBACK + JO_OUT_IO, + JO2_TERM_NAME + JO2_TERM_FINISH + JO2_HIDDEN + JO2_TERM_OPENCMD + + JO2_TERM_COLS + JO2_TERM_ROWS + JO2_VERTICAL + JO2_CURWIN + + JO2_CWD + JO2_ENV + JO2_EOF_CHARS + + JO2_NORESTORE + JO2_TERM_KILL + + JO2_ANSI_COLORS) == FAIL) + return; + + buf = term_start(&argvars[0], NULL, &opt, 0); + + if (buf != NULL && buf->b_term != NULL) + rettv->vval.v_number = buf->b_fnum; +} + +/* + * "term_wait" function + */ + void +f_term_wait(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_wait()"); + + if (buf == NULL) + return; + if (buf->b_term->tl_job == NULL) + { + ch_log(NULL, "term_wait(): no job to wait for"); + return; + } + if (buf->b_term->tl_job->jv_channel == NULL) + /* channel is closed, nothing to do */ + return; + + /* Get the job status, this will detect a job that finished. */ + if (!buf->b_term->tl_job->jv_channel->ch_keep_open + && STRCMP(job_status(buf->b_term->tl_job), "dead") == 0) + { + /* The job is dead, keep reading channel I/O until the channel is + * closed. buf->b_term may become NULL if the terminal was closed while + * waiting. */ + ch_log(NULL, "term_wait(): waiting for channel to close"); + while (buf->b_term != NULL && !buf->b_term->tl_channel_closed) + { + mch_check_messages(); + parse_queued_messages(); + ui_delay(10L, FALSE); + if (!buf_valid(buf)) + /* If the terminal is closed when the channel is closed the + * buffer disappears. */ + break; + } + mch_check_messages(); + parse_queued_messages(); + } + else + { + long wait = 10L; + + mch_check_messages(); + parse_queued_messages(); + + /* Wait for some time for any channel I/O. */ + if (argvars[1].v_type != VAR_UNKNOWN) + wait = get_tv_number(&argvars[1]); + ui_delay(wait, TRUE); + mch_check_messages(); + + /* Flushing messages on channels is hopefully sufficient. + * TODO: is there a better way? */ + parse_queued_messages(); + } +} + +/* + * Called when a channel has sent all the lines to a terminal. + * Send a CTRL-D to mark the end of the text. + */ + void +term_send_eof(channel_T *ch) +{ + term_T *term; + + for (term = first_term; term != NULL; term = term->tl_next) + if (term->tl_job == ch->ch_job) + { + if (term->tl_eof_chars != NULL) + { + channel_send(ch, PART_IN, term->tl_eof_chars, + (int)STRLEN(term->tl_eof_chars), NULL); + channel_send(ch, PART_IN, (char_u *)"\r", 1, NULL); + } +# ifdef WIN3264 + else + /* Default: CTRL-D */ + channel_send(ch, PART_IN, (char_u *)"\004\r", 2, NULL); +# endif + } +} + +# if defined(WIN3264) || defined(PROTO) + +/************************************** + * 2. MS-Windows implementation. + */ + +# ifndef PROTO + +#define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul +#define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull +#define WINPTY_MOUSE_MODE_FORCE 2 + +void* (*winpty_config_new)(UINT64, void*); +void* (*winpty_open)(void*, void*); +void* (*winpty_spawn_config_new)(UINT64, void*, LPCWSTR, void*, void*, void*); +BOOL (*winpty_spawn)(void*, void*, HANDLE*, HANDLE*, DWORD*, void*); +void (*winpty_config_set_mouse_mode)(void*, int); +void (*winpty_config_set_initial_size)(void*, int, int); +LPCWSTR (*winpty_conin_name)(void*); +LPCWSTR (*winpty_conout_name)(void*); +LPCWSTR (*winpty_conerr_name)(void*); +void (*winpty_free)(void*); +void (*winpty_config_free)(void*); +void (*winpty_spawn_config_free)(void*); +void (*winpty_error_free)(void*); +LPCWSTR (*winpty_error_msg)(void*); +BOOL (*winpty_set_size)(void*, int, int, void*); +HANDLE (*winpty_agent_process)(void*); + +#define WINPTY_DLL "winpty.dll" + +static HINSTANCE hWinPtyDLL = NULL; +# endif + + static int +dyn_winpty_init(int verbose) +{ + int i; + static struct + { + char *name; + FARPROC *ptr; + } winpty_entry[] = + { + {"winpty_conerr_name", (FARPROC*)&winpty_conerr_name}, + {"winpty_config_free", (FARPROC*)&winpty_config_free}, + {"winpty_config_new", (FARPROC*)&winpty_config_new}, + {"winpty_config_set_mouse_mode", + (FARPROC*)&winpty_config_set_mouse_mode}, + {"winpty_config_set_initial_size", + (FARPROC*)&winpty_config_set_initial_size}, + {"winpty_conin_name", (FARPROC*)&winpty_conin_name}, + {"winpty_conout_name", (FARPROC*)&winpty_conout_name}, + {"winpty_error_free", (FARPROC*)&winpty_error_free}, + {"winpty_free", (FARPROC*)&winpty_free}, + {"winpty_open", (FARPROC*)&winpty_open}, + {"winpty_spawn", (FARPROC*)&winpty_spawn}, + {"winpty_spawn_config_free", (FARPROC*)&winpty_spawn_config_free}, + {"winpty_spawn_config_new", (FARPROC*)&winpty_spawn_config_new}, + {"winpty_error_msg", (FARPROC*)&winpty_error_msg}, + {"winpty_set_size", (FARPROC*)&winpty_set_size}, + {"winpty_agent_process", (FARPROC*)&winpty_agent_process}, + {NULL, NULL} + }; + + /* No need to initialize twice. */ + if (hWinPtyDLL) + return OK; + /* Load winpty.dll, prefer using the 'winptydll' option, fall back to just + * winpty.dll. */ + if (*p_winptydll != NUL) + hWinPtyDLL = vimLoadLib((char *)p_winptydll); + if (!hWinPtyDLL) + hWinPtyDLL = vimLoadLib(WINPTY_DLL); + if (!hWinPtyDLL) + { + if (verbose) + EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll + : (char_u *)WINPTY_DLL); + return FAIL; + } + for (i = 0; winpty_entry[i].name != NULL + && winpty_entry[i].ptr != NULL; ++i) + { + if ((*winpty_entry[i].ptr = (FARPROC)GetProcAddress(hWinPtyDLL, + winpty_entry[i].name)) == NULL) + { + if (verbose) + EMSG2(_(e_loadfunc), winpty_entry[i].name); + return FAIL; + } + } + + return OK; +} + +/* + * Create a new terminal of "rows" by "cols" cells. + * Store a reference in "term". + * Return OK or FAIL. + */ + static int +term_and_job_init( + term_T *term, + typval_T *argvar, + char **argv UNUSED, + jobopt_T *opt, + jobopt_T *orig_opt) +{ + WCHAR *cmd_wchar = NULL; + WCHAR *cwd_wchar = NULL; + WCHAR *env_wchar = NULL; + channel_T *channel = NULL; + job_T *job = NULL; + DWORD error; + HANDLE jo = NULL; + HANDLE child_process_handle; + HANDLE child_thread_handle; + void *winpty_err = NULL; + void *spawn_config = NULL; + garray_T ga_cmd, ga_env; + char_u *cmd = NULL; + + if (dyn_winpty_init(TRUE) == FAIL) + return FAIL; + ga_init2(&ga_cmd, (int)sizeof(char*), 20); + ga_init2(&ga_env, (int)sizeof(char*), 20); + + if (argvar->v_type == VAR_STRING) + { + cmd = argvar->vval.v_string; + } + else if (argvar->v_type == VAR_LIST) + { + if (win32_build_cmd(argvar->vval.v_list, &ga_cmd) == FAIL) + goto failed; + cmd = ga_cmd.ga_data; + } + if (cmd == NULL || *cmd == NUL) + { + EMSG(_(e_invarg)); + goto failed; + } + + cmd_wchar = enc_to_utf16(cmd, NULL); + ga_clear(&ga_cmd); + if (cmd_wchar == NULL) + goto failed; + if (opt->jo_cwd != NULL) + cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL); + + win32_build_env(opt->jo_env, &ga_env, TRUE); + env_wchar = ga_env.ga_data; + + term->tl_winpty_config = winpty_config_new(0, &winpty_err); + if (term->tl_winpty_config == NULL) + goto failed; + + winpty_config_set_mouse_mode(term->tl_winpty_config, + WINPTY_MOUSE_MODE_FORCE); + winpty_config_set_initial_size(term->tl_winpty_config, + term->tl_cols, term->tl_rows); + term->tl_winpty = winpty_open(term->tl_winpty_config, &winpty_err); + if (term->tl_winpty == NULL) + goto failed; + + spawn_config = winpty_spawn_config_new( + WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN | + WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN, + NULL, + cmd_wchar, + cwd_wchar, + env_wchar, + &winpty_err); + if (spawn_config == NULL) + goto failed; + + channel = add_channel(); + if (channel == NULL) + goto failed; + + job = job_alloc(); + if (job == NULL) + goto failed; + if (argvar->v_type == VAR_STRING) + { + int argc; + + build_argv_from_string(cmd, &job->jv_argv, &argc); + } + else + { + int argc; + + build_argv_from_list(argvar->vval.v_list, &job->jv_argv, &argc); + } + + if (opt->jo_set & JO_IN_BUF) + job->jv_in_buf = buflist_findnr(opt->jo_io_buf[PART_IN]); + + if (!winpty_spawn(term->tl_winpty, spawn_config, &child_process_handle, + &child_thread_handle, &error, &winpty_err)) + goto failed; + + channel_set_pipes(channel, + (sock_T)CreateFileW( + winpty_conin_name(term->tl_winpty), + GENERIC_WRITE, 0, NULL, + OPEN_EXISTING, 0, NULL), + (sock_T)CreateFileW( + winpty_conout_name(term->tl_winpty), + GENERIC_READ, 0, NULL, + OPEN_EXISTING, 0, NULL), + (sock_T)CreateFileW( + winpty_conerr_name(term->tl_winpty), + GENERIC_READ, 0, NULL, + OPEN_EXISTING, 0, NULL)); + + /* Write lines with CR instead of NL. */ + channel->ch_write_text_mode = TRUE; + + jo = CreateJobObject(NULL, NULL); + if (jo == NULL) + goto failed; + + if (!AssignProcessToJobObject(jo, child_process_handle)) + { + /* Failed, switch the way to terminate process with TerminateProcess. */ + CloseHandle(jo); + jo = NULL; + } + + winpty_spawn_config_free(spawn_config); + vim_free(cmd_wchar); + vim_free(cwd_wchar); + vim_free(env_wchar); + + create_vterm(term, term->tl_rows, term->tl_cols); + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (opt->jo_set2 & JO2_ANSI_COLORS) + set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); + else + init_vterm_ansi_colors(term->tl_vterm); +#endif + + channel_set_job(channel, job, opt); + job_set_options(job, opt); + + job->jv_channel = channel; + job->jv_proc_info.hProcess = child_process_handle; + job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle); + job->jv_job_object = jo; + job->jv_status = JOB_STARTED; + job->jv_tty_in = utf16_to_enc( + (short_u*)winpty_conin_name(term->tl_winpty), NULL); + job->jv_tty_out = utf16_to_enc( + (short_u*)winpty_conout_name(term->tl_winpty), NULL); + ++job->jv_refcount; + term->tl_job = job; + + /* Redirecting stdout and stderr doesn't work at the job level. Instead + * open the file here and handle it in. opt->jo_io was changed in + * setup_job_options(), use the original flags here. */ + if (orig_opt->jo_io[PART_OUT] == JIO_FILE) + { + char_u *fname = opt->jo_io_name[PART_OUT]; + + ch_log(channel, "Opening output file %s", fname); + term->tl_out_fd = mch_fopen((char *)fname, WRITEBIN); + if (term->tl_out_fd == NULL) + EMSG2(_(e_notopen), fname); + } + + return OK; + +failed: + ga_clear(&ga_cmd); + ga_clear(&ga_env); + vim_free(cmd_wchar); + vim_free(cwd_wchar); + if (spawn_config != NULL) + winpty_spawn_config_free(spawn_config); + if (channel != NULL) + channel_clear(channel); + if (job != NULL) + { + job->jv_channel = NULL; + job_cleanup(job); + } + term->tl_job = NULL; + if (jo != NULL) + CloseHandle(jo); + if (term->tl_winpty != NULL) + winpty_free(term->tl_winpty); + term->tl_winpty = NULL; + if (term->tl_winpty_config != NULL) + winpty_config_free(term->tl_winpty_config); + term->tl_winpty_config = NULL; + if (winpty_err != NULL) + { + char_u *msg = utf16_to_enc( + (short_u *)winpty_error_msg(winpty_err), NULL); + + EMSG(msg); + winpty_error_free(winpty_err); + } + return FAIL; +} + + static int +create_pty_only(term_T *term, jobopt_T *options) +{ + HANDLE hPipeIn = INVALID_HANDLE_VALUE; + HANDLE hPipeOut = INVALID_HANDLE_VALUE; + char in_name[80], out_name[80]; + channel_T *channel = NULL; + + create_vterm(term, term->tl_rows, term->tl_cols); + + vim_snprintf(in_name, sizeof(in_name), "\\\\.\\pipe\\vim-%d-in-%d", + GetCurrentProcessId(), + curbuf->b_fnum); + hPipeIn = CreateNamedPipe(in_name, PIPE_ACCESS_OUTBOUND, + PIPE_TYPE_MESSAGE | PIPE_NOWAIT, + PIPE_UNLIMITED_INSTANCES, + 0, 0, NMPWAIT_NOWAIT, NULL); + if (hPipeIn == INVALID_HANDLE_VALUE) + goto failed; + + vim_snprintf(out_name, sizeof(out_name), "\\\\.\\pipe\\vim-%d-out-%d", + GetCurrentProcessId(), + curbuf->b_fnum); + hPipeOut = CreateNamedPipe(out_name, PIPE_ACCESS_INBOUND, + PIPE_TYPE_MESSAGE | PIPE_NOWAIT, + PIPE_UNLIMITED_INSTANCES, + 0, 0, 0, NULL); + if (hPipeOut == INVALID_HANDLE_VALUE) + goto failed; + + ConnectNamedPipe(hPipeIn, NULL); + ConnectNamedPipe(hPipeOut, NULL); + + term->tl_job = job_alloc(); + if (term->tl_job == NULL) + goto failed; + ++term->tl_job->jv_refcount; + + /* behave like the job is already finished */ + term->tl_job->jv_status = JOB_FINISHED; + + channel = add_channel(); + if (channel == NULL) + goto failed; + term->tl_job->jv_channel = channel; + channel->ch_keep_open = TRUE; + channel->ch_named_pipe = TRUE; + + channel_set_pipes(channel, + (sock_T)hPipeIn, + (sock_T)hPipeOut, + (sock_T)hPipeOut); + channel_set_job(channel, term->tl_job, options); + term->tl_job->jv_tty_in = vim_strsave((char_u*)in_name); + term->tl_job->jv_tty_out = vim_strsave((char_u*)out_name); + + return OK; + +failed: + if (hPipeIn != NULL) + CloseHandle(hPipeIn); + if (hPipeOut != NULL) + CloseHandle(hPipeOut); + return FAIL; +} + +/* + * Free the terminal emulator part of "term". + */ + static void +term_free_vterm(term_T *term) +{ + if (term->tl_winpty != NULL) + winpty_free(term->tl_winpty); + term->tl_winpty = NULL; + if (term->tl_winpty_config != NULL) + winpty_config_free(term->tl_winpty_config); + term->tl_winpty_config = NULL; + if (term->tl_vterm != NULL) + vterm_free(term->tl_vterm); + term->tl_vterm = NULL; +} + +/* + * Report the size to the terminal. + */ + static void +term_report_winsize(term_T *term, int rows, int cols) +{ + if (term->tl_winpty) + winpty_set_size(term->tl_winpty, cols, rows, NULL); +} + + int +terminal_enabled(void) +{ + return dyn_winpty_init(FALSE) == OK; +} + +# else + +/************************************** + * 3. Unix-like implementation. + */ + +/* + * Create a new terminal of "rows" by "cols" cells. + * Start job for "cmd". + * Store the pointers in "term". + * When "argv" is not NULL then "argvar" is not used. + * Return OK or FAIL. + */ + static int +term_and_job_init( + term_T *term, + typval_T *argvar, + char **argv, + jobopt_T *opt, + jobopt_T *orig_opt UNUSED) +{ + create_vterm(term, term->tl_rows, term->tl_cols); + +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (opt->jo_set2 & JO2_ANSI_COLORS) + set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); + else + init_vterm_ansi_colors(term->tl_vterm); +#endif + + /* This may change a string in "argvar". */ + term->tl_job = job_start(argvar, argv, opt, TRUE); + if (term->tl_job != NULL) + ++term->tl_job->jv_refcount; + + return term->tl_job != NULL + && term->tl_job->jv_channel != NULL + && term->tl_job->jv_status != JOB_FAILED ? OK : FAIL; +} + + static int +create_pty_only(term_T *term, jobopt_T *opt) +{ + create_vterm(term, term->tl_rows, term->tl_cols); + + term->tl_job = job_alloc(); + if (term->tl_job == NULL) + return FAIL; + ++term->tl_job->jv_refcount; + + /* behave like the job is already finished */ + term->tl_job->jv_status = JOB_FINISHED; + + return mch_create_pty_channel(term->tl_job, opt); +} + +/* + * Free the terminal emulator part of "term". + */ + static void +term_free_vterm(term_T *term) +{ + if (term->tl_vterm != NULL) + vterm_free(term->tl_vterm); + term->tl_vterm = NULL; +} + +/* + * Report the size to the terminal. + */ + static void +term_report_winsize(term_T *term, int rows, int cols) +{ + /* Use an ioctl() to report the new window size to the job. */ + if (term->tl_job != NULL && term->tl_job->jv_channel != NULL) + { + int fd = -1; + int part; + + for (part = PART_OUT; part < PART_COUNT; ++part) + { + fd = term->tl_job->jv_channel->ch_part[part].ch_fd; + if (isatty(fd)) + break; + } + if (part < PART_COUNT && mch_report_winsize(fd, rows, cols) == OK) + mch_signal_job(term->tl_job, (char_u *)"winch"); + } +} + +# endif + +#endif /* FEAT_TERMINAL */ diff --git a/src/termlib.c b/src/termlib.c index ed605e9061..0dc58942eb 100644 --- a/src/termlib.c +++ b/src/termlib.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: */ +/* vi:set ts=8 sts=4 sw=4 noet: */ /* * The following software is (C) 1984 Peter da Silva, the Mad Australian, in * the public domain. It may be re-distributed for any purpose with the @@ -13,15 +13,15 @@ #include "vim.h" #include "termlib.pro" -#if !defined(AMIGA) && !defined(VMS) && !defined(MACOS) +#if !defined(AMIGA) && !defined(VMS) # include <sgtty.h> #endif -static int getent __ARGS((char *, char *, FILE *, int)); -static int nextent __ARGS((char *, FILE *, int)); -static int _match __ARGS((char *, char *)); -static char *_addfmt __ARGS((char *, char *, int)); -static char *_find __ARGS((char *, char *)); +static int getent(char *, char *, FILE *, int); +static int nextent(char *, FILE *, int); +static int _match(char *, char *); +static char *_addfmt(char *, char *, int); +static char *_find(char *, char *); /* * Global variables for termlib @@ -66,9 +66,9 @@ short ospeed; /* Baud rate (1-16, 1=300, 16=19200), as in stty */ #endif int -tgetent(tbuf, term) - char *tbuf; /* Buffer to hold termcap entry, TBUFSZ bytes max */ - char *term; /* Name of terminal */ +tgetent( + char *tbuf, /* Buffer to hold termcap entry, TBUFSZ bytes max */ + char *term) /* Name of terminal */ { char tcbuf[32]; /* Temp buffer to handle */ char *tcptr = tcbuf; /* extended entries */ @@ -140,10 +140,7 @@ tgetent(tbuf, term) } static int -getent(tbuf, term, termcap, buflen) - char *tbuf, *term; - FILE *termcap; - int buflen; +getent(char *tbuf, char *term, FILE *termcap, int buflen) { char *tptr; int tlen = strlen(term); @@ -171,11 +168,11 @@ getent(tbuf, term, termcap, buflen) return 0; } +/* + * Read 1 entry from TERMCAP file. + */ static int -nextent(tbuf, termcap, buflen) /* Read 1 entry from TERMCAP file */ - char *tbuf; - FILE *termcap; - int buflen; +nextent(char *tbuf, FILE *termcap, int buflen) { char *lbuf = tbuf; /* lbuf=line buffer */ /* read lines straight into buffer */ @@ -218,8 +215,7 @@ nextent(tbuf, termcap, buflen) /* Read 1 entry from TERMCAP file */ */ int -tgetflag(id) - char *id; +tgetflag(char *id) { char buf[256], *ptr = buf; @@ -237,8 +233,7 @@ tgetflag(id) */ int -tgetnum(id) - char *id; +tgetnum(char *id) { char *ptr, buf[256]; ptr = buf; @@ -277,8 +272,7 @@ tgetnum(id) */ char * -tgetstr(id, buf) - char *id, **buf; +tgetstr(char *id, char **buf) { int len = strlen(id); char *tmp=tent; @@ -387,10 +381,10 @@ tgetstr(id, buf) */ char * -tgoto(cm, col, line) - char *cm; /* cm string, from termcap */ - int col, /* column, x position */ - line; /* line, y position */ +tgoto( + char *cm, /* cm string, from termcap */ + int col, /* column, x position */ + int line) /* line, y position */ { char gx, gy, /* x, y */ *ptr, /* pointer in 'cm' */ @@ -533,14 +527,14 @@ long _bauds[16]={ 4800, 9600, 19200, 19200 }; int -tputs(cp, affcnt, outc) - char *cp; /* string to print */ - int affcnt; /* Number of lines affected */ - void (*outc) __ARGS((unsigned int));/* routine to output 1 character */ +tputs( + char *cp, /* string to print */ + int affcnt, /* Number of lines affected */ + void (*outc)(unsigned int)) /* routine to output 1 character */ { long frac, /* 10^(#digits after decimal point) */ counter, /* digits */ - atol __ARGS((const char *)); + atol(const char *); if (VIM_ISDIGIT(*cp)) { counter = 0; @@ -578,11 +572,10 @@ tputs(cp, affcnt, outc) * Module: tutil.c * * Purpose: Utility routines for TERMLIB functions. - * + * Returns length of text common to s1 and s2. */ static int -_match(s1, s2) /* returns length of text common to s1 and s2 */ - char *s1, *s2; +_match(char *s1, char *s2) { int i = 0; @@ -596,8 +589,7 @@ _match(s1, s2) /* returns length of text common to s1 and s2 */ * finds next c in s that's a member of set, returns pointer */ static char * -_find(s, set) - char *s, *set; +_find(char *s, char *set) { for(; *s; s++) { @@ -617,9 +609,7 @@ _find(s, set) * add val to buf according to format fmt */ static char * -_addfmt(buf, fmt, val) - char *buf, *fmt; - int val; +_addfmt(char *buf, char *fmt, int val) { sprintf(buf, fmt, val); while (*buf) diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak new file mode 100644 index 0000000000..6a0126b850 --- /dev/null +++ b/src/testdir/Make_all.mak @@ -0,0 +1,201 @@ +# +# Common Makefile, defines the list of tests to run. +# + +# Options for protecting the tests against undesirable interaction with the +# environment +NO_PLUGINS = --noplugin --not-a-term +NO_INITS = -U NONE $(NO_PLUGINS) + +# The first script creates small.vim. +SCRIPTS_FIRST = \ + test1.out + +# Tests that run on all systems. +SCRIPTS_ALL = \ + test3.out \ + test14.out \ + test29.out \ + test37.out \ + test39.out \ + test42.out \ + test44.out \ + test48.out \ + test64.out \ + test69.out \ + test70.out \ + test88.out \ + test94.out \ + test95.out \ + test99.out \ + test108.out \ + test_eval.out + + +# Tests that run on most systems, but not on Amiga. +SCRIPTS_MORE1 = \ + test11.out \ + test52.out \ + test85.out \ + test86.out \ + test87.out + + +# Tests that run on most systems, but not on Amiga and DOS/Windows. +SCRIPTS_MORE2 = \ + test49.out + + +# Tests that run on most systems, but not on VMS +SCRIPTS_MORE4 = \ + test17.out \ + test30.out \ + test59.out \ + test72.out \ + + +# Tests specifically for MS-Windows. +SCRIPTS_WIN32 = + + +# Tests for the GUI. +SCRIPTS_GUI = + + +# Tests using runtest.vim +# Keep test_alot*.res as the last one, sort the others. +# test_largefile.res is omitted, it uses too much resources to run on CI. +NEW_TESTS = test_arabic.res \ + test_arglist.res \ + test_assert.res \ + test_autochdir.res \ + test_autocmd.res \ + test_autoload.res \ + test_backspace_opt.res \ + test_blockedit.res \ + test_breakindent.res \ + test_bufwintabinfo.res \ + test_cdo.res \ + test_changelist.res \ + test_channel.res \ + test_charsearch.res \ + test_cindent.res \ + test_clientserver.res \ + test_close_count.res \ + test_cmdline.res \ + test_command_count.res \ + test_comparators.res \ + test_crypt.res \ + test_cscope.res \ + test_curswant.res \ + test_diffmode.res \ + test_digraph.res \ + test_display.res \ + test_edit.res \ + test_erasebackword.res \ + test_escaped_glob.res \ + test_eval_stuff.res \ + test_exec_while_if.res \ + test_exists.res \ + test_exists_autocmd.res \ + test_exit.res \ + test_farsi.res \ + test_file_size.res \ + test_find_complete.res \ + test_fixeol.res \ + test_fnameescape.res \ + test_fold.res \ + test_getcwd.res \ + test_getvar.res \ + test_gf.res \ + test_gn.res \ + test_gui.res \ + test_gui_init.res \ + test_hardcopy.res \ + test_help.res \ + test_hide.res \ + test_highlight.res \ + test_history.res \ + test_hlsearch.res \ + test_iminsert.res \ + test_increment.res \ + test_increment_dbcs.res \ + test_ins_complete.res \ + test_job_fails.res \ + test_json.res \ + test_jumplist.res \ + test_langmap.res \ + test_let.res \ + test_lineending.res \ + test_listchars.res \ + test_listdict.res \ + test_listlbr.res \ + test_lua.res \ + test_makeencoding.res \ + test_man.res \ + test_maparg.res \ + test_marks.res \ + test_matchadd_conceal.res \ + test_mksession.res \ + test_nested_function.res \ + test_netbeans.res \ + test_normal.res \ + test_number.res \ + test_options.res \ + test_packadd.res \ + test_paste.res \ + test_perl.res \ + test_plus_arg_edit.res \ + test_preview.res \ + test_prompt_buffer.res \ + test_profile.res \ + test_python2.res \ + test_python3.res \ + test_pyx2.res \ + test_pyx3.res \ + test_quickfix.res \ + test_quotestar.res \ + test_regex_char_classes.res \ + test_registers.res \ + test_retab.res \ + test_ruby.res \ + test_scrollbind.res \ + test_search.res \ + test_shortpathname.res \ + test_signs.res \ + test_smartindent.res \ + test_spell.res \ + test_startup.res \ + test_stat.res \ + test_substitute.res \ + test_swap.res \ + test_syntax.res \ + test_system.res \ + test_tab.res \ + test_tcl.res \ + test_terminal.res \ + test_terminal_fail.res \ + test_textformat.res \ + test_textobjects.res \ + test_undo.res \ + test_user_func.res \ + test_usercommands.res \ + test_viminfo.res \ + test_vimscript.res \ + test_visual.res \ + test_winbar.res \ + test_winbuf_close.res \ + test_window_id.res \ + test_windows_home.res \ + test_wordcount.res \ + test_writefile.res \ + test_xxd.res \ + test_alot_latin.res \ + test_alot_utf8.res \ + test_alot.res + + +# Explicit dependencies. +test49.out: test49.vim + +test_options.res test_alot.res: opt_test.vim diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 46cd6a90de..d894001325 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -5,48 +5,26 @@ VIMPROG = /vim +default: nongui + +include Make_all.mak + # These tests don't work (yet): # test2 "\\tmp" doesn't work # test10 'errorformat' is different # test11 "cat" doesn't work properly -# test12 can't unlink a swap file -# test25 uses symbolic link -# test27 can't edit file with "*" # test52 only for Win32 # test85 no Lua interface # test86, 87 no Python interface -SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out \ - test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out test55.out \ - test56.out test57.out test58.out test59.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out test73.out test74.out test75.out \ - test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out test84.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test97.out test98.out \ - test99.out test100.out test101.out test102.out test103.out \ - test104.out test105.out test106.out test107.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_eval.out \ - test_options.out +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE4) + +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST) .SUFFIXES: .in .out -nongui: /tmp $(SCRIPTS) +nongui: /tmp $(SCRIPTS_FIRST) $(SCRIPTS) csh -c echo ALL DONE clean: @@ -54,7 +32,7 @@ clean: .in.out: copy $*.ok test.ok - $(VIMPROG) -u amiga.vim -U NONE --noplugin -s dotest.in $*.in + $(VIMPROG) -u amiga.vim -U NONE --noplugin --not-a-term -s dotest.in $*.in diff test.out $*.ok rename test.out $*.out -delete X#? ALL QUIET @@ -64,112 +42,5 @@ clean: /tmp: makedir /tmp -# Manx requires all dependencies... -test1.out: test1.in -test2.out: test2.in -test3.out: test3.in -test4.out: test4.in -test5.out: test5.in -test6.out: test6.in -test7.out: test7.in -test8.out: test8.in -test9.out: test9.in -test10.out: test10.in -test11.out: test11.in -test12.out: test12.in -test13.out: test13.in -test14.out: test14.in -test15.out: test15.in -test16.out: test16.in -test17.out: test17.in -test18.out: test18.in -test19.out: test19.in -test20.out: test20.in -test21.out: test21.in -test22.out: test22.in -test23.out: test23.in -test24.out: test24.in -test25.out: test25.in -test26.out: test26.in -test27.out: test27.in -test28.out: test28.in -test29.out: test29.in -test30.out: test30.in -test31.out: test31.in -test32.out: test32.in -test33.out: test33.in -test34.out: test34.in -test35.out: test35.in -test36.out: test36.in -test37.out: test37.in -test38.out: test38.in -test39.out: test39.in -test40.out: test40.in -test41.out: test41.in -test42.out: test42.in -test43.out: test43.in -test44.out: test44.in -test45.out: test45.in -test46.out: test46.in -test47.out: test47.in -test48.out: test48.in -test51.out: test51.in -test53.out: test53.in -test54.out: test54.in -test55.out: test55.in -test56.out: test56.in -test57.out: test57.in -test58.out: test58.in -test59.out: test59.in -test60.out: test60.in -test61.out: test61.in -test62.out: test62.in -test63.out: test63.in -test64.out: test64.in -test65.out: test65.in -test66.out: test66.in -test67.out: test67.in -test68.out: test68.in -test69.out: test69.in -test70.out: test70.in -test71.out: test71.in -test72.out: test72.in -test73.out: test73.in -test74.out: test74.in -test75.out: test75.in -test76.out: test76.in -test77.out: test77.in -test78.out: test78.in -test79.out: test79.in -test80.out: test80.in -test81.out: test81.in -test82.out: test82.in -test83.out: test83.in -test84.out: test84.in -test88.out: test88.in -test89.out: test89.in -test90.out: test90.in -test91.out: test91.in -test92.out: test92.in -test93.out: test93.in -test94.out: test94.in -test95.out: test95.in -test96.out: test96.in -test97.out: test97.in -test98.out: test98.in -test99.out: test99.in -test100.out: test100.in -test101.out: test101.in -test102.out: test102.in -test103.out: test103.in -test104.out: test104.in -test105.out: test105.in -test106.out: test106.in -test107.out: test107.in -test_autoformat_join.out: test_autoformat_join.in -test_breakindent.out: test_breakindent.in -test_listlbr.out: test_listlbr.in -test_listlbr_utf8.out: test_listlbr_utf8.in -test_qf_title.out: test_qf_title.in -test_eval.out: test_eval.in -test_options.out: test_options.in +# Manx requires all dependencies, but we stopped updating them. +# Delete the .out file(s) to run test(s). diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 86176ae481..6cd8de6463 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -5,96 +5,130 @@ VIMPROG = ..\\vim +default: nongui + +!include Make_all.mak + # Omitted: # test2 "\\tmp" doesn't work. # test10 'errorformat' is different -# test12 can't unlink a swap file -# test25 uses symbolic link -# test27 can't edit file with "*" in file name +# test49 fails in various ways # test97 \{ and \$ are not escaped characters. -SCRIPTS16 = test1.out test19.out test20.out test22.out \ - test23.out test24.out test28.out test29.out \ - test35.out test36.out test43.out \ - test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out \ - test55.out test56.out test57.out test58.out test59.out \ - test60.out test61.out test62.out test63.out test64.out - -SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ - test8.out test9.out test11.out test13.out test14.out \ - test15.out test17.out test18.out test21.out test26.out \ - test30.out test31.out test32.out test33.out test34.out \ - test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test100.out test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out\ - test_autoformat_join.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_eval.out \ - test_options.out - -SCRIPTS32 = test50.out test70.out - -SCRIPTS_GUI = test16.out - -.SUFFIXES: .in .out - -nongui: fixff $(SCRIPTS16) $(SCRIPTS) report - -small: report - -gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) report - -win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report - -fixff: - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \ - dotest.in test60.ok test71.ok test74.ok +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) + +TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) +DOSTMP = dostmp +DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) +DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) + +.SUFFIXES: .in .out .res .vim + +nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report + +small: nolog report + +gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report + +win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report + +# Copy the input files to dostmp, changing the fileformat to dos. +$(DOSTMP_INFILES): $(*B).in + if not exist $(DOSTMP)\NUL md $(DOSTMP) + if exist $@ del $@ + $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in + +# For each input file dostmp/test99.in run the tests. +# This moves test99.in to test99.in.bak temporarily. +$(TEST_OUTFILES): $(DOSTMP)\$(*B).in + -@if exist test.out DEL test.out + -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out + move $(*B).in $(*B).in.bak > nul + copy $(DOSTMP)\$(*B).in $(*B).in > nul + copy $(*B).ok test.ok > nul + $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in + -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul + -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul + -@if exist test.ok del test.ok + -@if exist Xdir1 rd /s /q Xdir1 + -@if exist Xfind rd /s /q Xfind + -@if exist XfakeHOME rd /s /q XfakeHOME + -@del X* + -@if exist viminfo del viminfo + $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \ + $(DOSTMP)\$(*B).out + @diff test.out $*.ok & if errorlevel 1 \ + ( move /y test.out $*.failed > nul \ + & del $(DOSTMP)\$(*B).out \ + & echo $* FAILED >> test.log ) \ + else ( move /y test.out $*.out > nul ) + +# Must run test1 first to create small.vim. +# This rule must come after the one that copies the input files to dostmp to +# allow for running an individual test. +$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST) report: @echo "" @echo Test results: - @IF EXIST test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \ - ELSE ( ECHO ALL DONE ) + @if exist test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \ + else ( echo ALL DONE ) clean: -del *.out -del *.failed + -del *.res + -if exist $(DOSTMP) rd /s /q $(DOSTMP) + -if exist test.in del test.in -if exist test.ok del test.ok -if exist small.vim del small.vim -if exist tiny.vim del tiny.vim -if exist mbyte.vim del mbyte.vim -if exist mzscheme.vim del mzscheme.vim -if exist lua.vim del lua.vim - -del X* -if exist Xdir1 rd /s /q Xdir1 -if exist Xfind rd /s /q Xfind - -if exist viminfo del viminfo - -del test.log - -.in.out: - -if exist $*.failed del $*.failed - copy $*.ok test.ok - $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in - @diff test.out $*.ok & if errorlevel 1 \ - ( move /y test.out $*.failed & echo $* FAILED >> test.log ) \ - else ( move /y test.out $*.out ) + -if exist XfakeHOME rd /s /q XfakeHOME -del X* - -del test.ok - -if exist Xdir1 rd /s /q Xdir1 - -if exist Xfind rd /s /q Xfind + -for /d %i in (X*) do @rmdir /s/q %i -if exist viminfo del viminfo + -if exist test.log del test.log + -if exist messages del messages + -if exist benchmark.out del benchmark.out + -if exist opt_test.vim del opt_test.vim nolog: - -del test.log + -if exist test.log del test.log + -if exist messages del messages + +benchmark: + bench_re_freeze.out + +bench_re_freeze.out: bench_re_freeze.vim + -if exist benchmark.out del benchmark.out + $(VIMPROG) -u dos.vim $(NO_INITS) $*.in + @IF EXIST benchmark.out ( type benchmark.out ) + +# New style of tests uses Vim script with assert calls. These are easier +# to write and a lot easier to read and debug. +# Limitation: Only works with the +eval feature. + +newtests: $(NEW_TESTS) + +.vim.res: + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim + @del vimcmd + +test_gui.res: test_gui.vim + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim + @del vimcmd + +test_gui_init.res: test_gui_init.vim + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim + @del vimcmd + +opt_test.vim: ../option.c gen_opt_test.vim + $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index cf10301b22..d66d6678c8 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -4,108 +4,129 @@ # # Author: Bill McCarthy # -# Note that test54 has been removed until it is fixed. -# # Requires a set of Unix tools: echo, diff, etc. ifneq (sh.exe, $(SHELL)) DEL = rm -f +DELDIR = rm -rf MV = mv CP = cp +CAT = cat DIRSLASH = / else DEL = del +DELDIR = rd /s /q MV = rename CP = copy +CAT = type DIRSLASH = \\ endif VIMPROG = ..$(DIRSLASH)vim +default: vimall + +include Make_all.mak + # Omitted: # test2 "\\tmp" doesn't work. # test10 'errorformat' is different -# test12 can't unlink a swap file -# test25 uses symbolic link -# test27 can't edit file with "*" in file name -# test97 \{ and \$ are not escaped characters. - -SCRIPTS16 = test1.out test19.out test20.out test22.out \ - test23.out test24.out test28.out test29.out \ - test35.out test36.out test43.out \ - test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out \ - test55.out test56.out test57.out test58.out test59.out \ - test60.out test61.out test62.out test63.out test64.out - -# Had to remove test54 which doesn't work yet. -# test54.out - -SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ - test8.out test9.out test11.out test13.out test14.out \ - test15.out test17.out test18.out test21.out test26.out \ - test30.out test31.out test32.out test33.out test34.out \ - test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test100.out test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_eval.out \ - test_options.out - -SCRIPTS32 = test50.out test70.out - -SCRIPTS_GUI = test16.out - -.SUFFIXES: .in .out - -vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) - echo ALL DONE - -nongui: fixff $(SCRIPTS16) $(SCRIPTS) - echo ALL DONE - -small: - echo ALL DONE - -gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) - echo ALL DONE - -win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) - echo ALL DONE +# test97 \{ and \$ are not escaped characters + +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32) + +SCRIPTS_BENCH = bench_re_freeze.out + +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST) + +.SUFFIXES: .in .out .res .vim + +vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests + @echo ALL DONE + +nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests + @echo ALL DONE + +benchmark: $(SCRIPTS_BENCH) + +small: nolog + @echo ALL DONE + +gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests + @echo ALL DONE + +win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests + @echo ALL DONE +# TODO: find a way to avoid changing the distributed files. fixff: - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok - -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \ - dotest.in test60.ok test71.ok test74.ok + -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok + -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \ + dotest.in clean: - -$(DEL) *.out - -$(DEL) test.ok - -$(DEL) small.vim - -$(DEL) tiny.vim - -$(DEL) mbyte.vim - -$(DEL) mzscheme.vim - -$(DEL) lua.vim - -$(DEL) X* - -$(DEL) viminfo + -@if exist *.out $(DEL) *.out + -@if exist *.failed $(DEL) *.failed + -@if exist *.res $(DEL) *.res + -@if exist test.in $(DEL) test.in + -@if exist test.ok $(DEL) test.ok + -@if exist small.vim $(DEL) small.vim + -@if exist tiny.vim $(DEL) tiny.vim + -@if exist mbyte.vim $(DEL) mbyte.vim + -@if exist mzscheme.vim $(DEL) mzscheme.vim + -@if exist lua.vim $(DEL) lua.vim + -@if exist Xdir1 $(DELDIR) Xdir1 + -@if exist Xfind $(DELDIR) Xfind + -@if exist XfakeHOME $(DELDIR) XfakeHOME + -@if exist X* $(DEL) X* + -@if exist viminfo $(DEL) viminfo + -@if exist test.log $(DEL) test.log + -@if exist messages $(DEL) messages + -@if exist opt_test.vim $(DEL) opt_test.vim .in.out: - $(CP) $*.ok test.ok - $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in - diff test.out $*.ok - -$(DEL) $*.out - $(MV) test.out $*.out - -$(DEL) X* - -$(DEL) test.ok - -$(DEL) viminfo + -@if exist $*.ok $(CP) $*.ok test.ok + $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in + @diff test.out $*.ok + -@if exist $*.out $(DEL) $*.out + @$(MV) test.out $*.out + -@if exist Xdir1 $(DELDIR) Xdir1 + -@if exist Xfind $(DELDIR) Xfind + -@if exist XfakeHOME $(DELDIR) XfakeHOME + -@if exist X* $(DEL) X* + -@if exist test.ok $(DEL) test.ok + -@if exist viminfo $(DEL) viminfo + +nolog: + -@if exist test.log $(DEL) test.log + -@if exist messages $(DEL) messages + +bench_re_freeze.out: bench_re_freeze.vim + -$(DEL) benchmark.out + $(VIMPROG) -u dos.vim $(NO_INITS) $*.in + $(CAT) benchmark.out + +# New style of tests uses Vim script with assert calls. These are easier +# to write and a lot easier to read and debug. +# Limitation: Only works with the +eval feature. + +newtests: $(NEW_TESTS) + +.vim.res: + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim + @$(DEL) vimcmd + +test_gui.res: test_gui.vim + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $< + @$(DEL) vimcmd + +test_gui_init.res: test_gui_init.vim + @echo $(VIMPROG) > vimcmd + $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $< + @$(DEL) vimcmd + +opt_test.vim: ../option.c gen_opt_test.vim + $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak deleted file mode 100644 index a7f3989f8e..0000000000 --- a/src/testdir/Make_os2.mak +++ /dev/null @@ -1,72 +0,0 @@ -# -# Makefile to run all tests for Vim, on OS/2 -# -# Requires a set of Unix tools: echo, diff, etc. - -VIMPROG = ../vim.exe - -# Omitted: -# test2 "\\tmp" doesn't work. -# test10 'errorformat' is different -# test11 requires sed -# test12 can't unlink a swap file -# test25 uses symbolic link -# test27 can't edit file with "*" in file name -# test52 only for Win32 -# test85 no Lua interface -# test86, 87 no Python interface -# test97 \{ and \$ are not escaped characters. - -SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out \ - test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out test55.out \ - test56.out test57.out test58.out test59.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out test73.out test74.out test75.out \ - test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out test84.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test100.out test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_autoformat_join.out \ - test_eval.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_options.out - -.SUFFIXES: .in .out - -all: /tmp $(SCRIPTS) - @echo ALL DONE - -$(SCRIPTS): $(VIMPROG) - -clean: - -rm -rf *.out Xdotest test.ok tiny.vim small.vim mbyte.vim viminfo - -# Make sure all .in and .out files are in DOS fileformat. -.in.out: - $(VIMPROG) -u NONE -s todos.vim $*.in - $(VIMPROG) -u NONE -s todos.vim $*.ok - copy $*.ok test.ok - $(VIMPROG) -u os2.vim --noplugin -s dotest.in $*.in - $(VIMPROG) -u NONE -s todos.vim test.out - diff test.out $*.ok - rename test.out $*.out - -rm -rf X* viminfo - -del test.ok - -# Create a directory for temp files -/tmp: - -mkdir /tmp diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 9bf395be37..f27a6b4e7b 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, <arpadffy@polarhome.com> # Sandor Kopanyi, <sandor.kopanyi@mailbox.hu> # -# Last change: 2014 Jul 23 +# Last change: 2016 Nov 04 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -45,7 +45,7 @@ # It fails because VMS does not support this feature yet. # WANT_MZSCH = YES -# Comment out if you have ODS-5 file system +# Comment out if you have ODS-5 file system # HAVE_ODS5 = YES # Comment out if you have gzip on your system @@ -54,10 +54,7 @@ # Comment out if you have GNU compatible diff on your system # HAVE_GDIFF = YES -# Comment out if you have GNU compatible cksum on your system -# HAVE_CKSUM = YES - -# Comment out if you have ICONV support +# Comment out if you have ICONV support # HAVE_ICONV = YES # Comment out if you have LUA support @@ -76,52 +73,29 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in -SCRIPT = test1.out test2.out test3.out test4.out test5.out \ - test6.out test7.out test8.out test9.out test10a.out\ - test13.out test14.out test15.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out \ - test48.out test49.out test51.out test53.out test54.out \ - test55.out test56.out test57.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out \ - test71.out test72.out test74.out test75.out test76.out \ - test77a.out test78.out test79.out test80.out test81.out \ - test82.out test84.out test88.out test89.out \ - test90.out test91.out test92.out test93.out test94.out \ - test95.out test96.out test98.out test99.out \ - test100.out test101.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_eval.out \ - test_options.out +SCRIPT = test1.out test3.out \ + test14.out \ + test29.out \ + test30.out test37.out test39.out \ + test42.out test44.out test48.out test49.out \ + test64.out test69.out \ + test72.out test77a.out test88.out \ + test94.out test95.out test99.out test108.out \ + test_eval.out # Known problems: # test17: ? # # test30: bug, most probably - a problem around mac format # -# test32: VMS is not case sensitive and all filenames are lowercase within Vim -# (this should be changed in order to preserve the original filename) - should -# be fixed. VMS allows just one dot in the filename -# -# test58, test59: Failed/Hangs - VMS does not support spell files (file names +# test59: Failed/Hangs - VMS does not support spell files (file names # with too many dots). # # test72: bug - Vim hangs at :rename (while rename works well otherwise) # test78: bug - Vim dies at :recover Xtest -# test83: ? # test85: no Lua interface # test89: bug - findfile() does not work on VMS (just in the current directory) -# test97, test102: Just ODS-5 supports space and special chars in the filename. +# test102: Just ODS-5 supports space and special chars in the filename. # On ODS-2 tests fail. .IFDEF WANT_GUI @@ -130,15 +104,15 @@ GUI_OPTION = -g .ENDIF .IFDEF WANT_UNIX -SCRIPT_UNIX = test10.out test12.out test17.out test25.out test27.out test49.out test73.out +SCRIPT_UNIX = test10.out test17.out test27.out test49.out .ENDIF .IFDEF WANT_WIN -SCRIPT_WIN = test50.out test52.out +SCRIPT_WIN = test52.out .ENDIF .IFDEF WANT_SPELL -SCRIPT_SPELL = test58.out test59.out +SCRIPT_SPELL = test59.out .ENDIF .IFDEF WANT_MZSCH @@ -146,7 +120,7 @@ SCRIPT_MZSCH = test70.out .ENDIF .IFDEF HAVE_ODS5 -SCRIPT_ODS5 = test97.out test102.out +SCRIPT_ODS5 = test102.out .ENDIF .IFDEF HAVE_GZIP @@ -157,14 +131,6 @@ SCRIPT_GZIP = test11.out SCRIPT_GDIFF = test47.out .ENDIF -.IFDEF HAVE_CKSUM -SCRIPT_CKSUM = test77.out -.ENDIF - -.IFDEF HAVE_ICONV -SCRIPT_ICONV = test83.out -.ENDIF - .IFDEF HAVE_LUA SCRIPT_LUA = test85.out .ENDIF @@ -194,7 +160,7 @@ SCRIPT_PYTHON = test86.out test87.out -@ if "''F$SEARCH("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.* all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \ - $(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_CKSUM) $(SCRIPT_ICONV) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog + $(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog -@ write sys$output " " -@ write sys$output "-----------------------------------------------" -@ write sys$output " All done" @@ -225,7 +191,6 @@ nolog : -@ write sys$output " HAVE_ODS5 = ""$(HAVE_ODS5)"" " -@ write sys$output " HAVE_GZIP = ""$(HAVE_GZIP)"" " -@ write sys$output " HAVE_GDIFF = ""$(HAVE_GDIFF)"" " - -@ write sys$output " HAVE_CKSUM = ""$(HAVE_CKSUM)"" " -@ write sys$output " HAVE_ICONV = ""$(HAVE_ICONV)"" " -@ write sys$output " HAVE_LUA = ""$(HAVE_LUA)"" " -@ write sys$output " HAVE_PYTHON= ""$(HAVE_PYTHON)"" " diff --git a/src/testdir/Makefile b/src/testdir/Makefile index b5f5d18030..459b868783 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -2,52 +2,40 @@ # Makefile to run all tests for Vim # +# Use console or GUI. VIMPROG = ../vim +XXDPROG = ../xxd/xxd +# VIMPROG = ../gvim + SCRIPTSOURCE = ../../runtime # Uncomment this line to use valgrind for memory leaks and extra warnings. # The output goes into a file "valgrind.testN" # Vim should be compiled with EXITFREE to avoid false warnings. # This will make testing about 10 times as slow. -# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$* - - -SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out test10.out test11.out \ - test12.out test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test25.out test26.out test27.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test49.out test51.out test52.out test53.out \ - test54.out test55.out test56.out test57.out test58.out \ - test59.out test60.out test61.out test62.out test63.out \ - test64.out test65.out test66.out test67.out test68.out \ - test69.out test70.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test97.out test98.out \ - test99.out test100.out test101.out test102.out test103.out \ - test104.out test105.out test106.out test107.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ - test_eval.out \ - test_options.out - -SCRIPTS_GUI = test16.out - -.SUFFIXES: .in .out - -nongui: nolog $(SCRIPTS) report - -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report +# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind.$* + +default: nongui + +# The list of tests is common to all systems. +# This defines NEW_TESTS, SCRIPTS_ALL, SCRIPTS_MORE* and SCRIPTS_GUI. +include Make_all.mak + + +SCRIPTS = $(SCRIPTS_ALL) \ + $(SCRIPTS_MORE1) \ + $(SCRIPTS_MORE2) \ + $(SCRIPTS_MORE4) + +SCRIPTS_BENCH = bench_re_freeze.out + +.SUFFIXES: .in .out .res .vim + +nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report + +gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report + +benchmark: $(SCRIPTS_BENCH) report: @echo @@ -57,14 +45,17 @@ report: else echo ALL DONE; \ fi" -$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) +$(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(VIMPROG) + +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST) RM_ON_RUN = test.out X* viminfo -RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok -RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in +RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out +RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_INITS) -s dotest.in clean: - -rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.* + -rm -rf *.out *.failed *.res *.rej *.orig opt_test.vim test.log messages $(RM_ON_RUN) $(RM_ON_START) valgrind.* test1.out: test1.in -rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize @@ -87,16 +78,16 @@ test1.out: test1.in # 200 msec is sufficient, but only modern sleep supports a fraction of # a second, fall back to a second if it fails. @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" - -$(RUN_VIM) $*.in + $(RUN_VIM) $*.in - # For flaky tests retry one time. - @/bin/sh -c "if test -f test.out -a $* = test61; then \ - if diff test.out $*.ok; \ - then echo flaky test ok first time; \ - else rm -rf $*.failed $(RM_ON_RUN); \ - $(RUN_VIM) $*.in; \ - fi \ - fi" + # For flaky tests retry one time. No tests at the moment. + #@/bin/sh -c "if test -f test.out -a $* = test61; then \ + # if diff test.out $*.ok; \ + # then echo flaky test ok first time; \ + # else rm -rf $*.failed $(RM_ON_RUN); \ + # $(RUN_VIM) $*.in; \ + # fi \ + # fi" # Check if the test.out file matches test.ok. @/bin/sh -c "if test -f test.out; then \ @@ -111,9 +102,50 @@ test1.out: test1.in fi" -rm -rf X* test.ok viminfo -test49.out: test49.vim - -test60.out: test60.vim +bench_re_freeze.out: bench_re_freeze.vim + -rm -rf benchmark.out $(RM_ON_RUN) + # Sleep a moment to avoid that the xterm title is messed up. + # 200 msec is sufficient, but only modern sleep supports a fraction of + # a second, fall back to a second if it fails. + @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" + $(RUN_VIM) $*.in + @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" nolog: - -rm -f test.log + -rm -f test.log messages + + +# New style of tests uses Vim script with assert calls. These are easier +# to write and a lot easier to read and debug. +# Limitation: Only works with the +eval feature. +RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim + +newtests: newtestssilent + @/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages && if test -f test.log; then cat test.log; fi ; fi" + +newtestssilent: $(NEW_TESTS) + + +.vim.res: writevimcmd + @echo "$(VIMPROG)" > vimcmd + @echo "$(RUN_VIMTEST)" >> vimcmd + $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim + @rm vimcmd + +test_gui.res: test_gui.vim + @echo "$(VIMPROG)" > vimcmd + @echo "$(RUN_GVIMTEST)" >> vimcmd + $(RUN_VIMTEST) -u NONE $(NO_INITS) -S runtest.vim $< + @rm vimcmd + +test_gui_init.res: test_gui_init.vim + @echo "$(VIMPROG)" > vimcmd + @echo "$(RUN_GVIMTEST_WITH_GVIMRC)" >> vimcmd + $(RUN_VIMTEST) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $< + @rm vimcmd + +opt_test.vim: ../option.c gen_opt_test.vim + $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c + +test_xxd.res: + XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim diff --git a/src/testdir/README.txt b/src/testdir/README.txt new file mode 100644 index 0000000000..7aa185f0a8 --- /dev/null +++ b/src/testdir/README.txt @@ -0,0 +1,55 @@ +This directory contains tests for various Vim features. + +If it makes sense, add a new test method to an already existing file. You may +want to separate it from other tests with comment lines. + +The numbered tests are older, we have switched to named tests. Don't add any +more numbered tests. + +And then you can choose between a new style test, which is a Vim script, or an +old style test, which uses Normal mode commands. Use a new style test if you +can. Use an old style test when it needs to run without the +eval feature. + + +TO ADD A NEW STYLE TEST: + +1) Create a test_<subject>.vim file. +2) Add test_<subject>.res to NEW_TESTS in Make_all.mak in alphabetical order. +3) Also add an entry in src/Makefile. +4) Use make test_<subject>.res to run a single test in src/testdir/. + Use make test_<subject> to run a single test in src/. + +What you can use (see test_assert.vim for an example): +- Call assert_equal(), assert_true(), assert_false(), etc. +- Use try/catch to check for exceptions. +- Use alloc_fail() to have memory allocation fail. This makes it possible + to check memory allocation failures are handled gracefully. You need to + change the source code to add an ID to the allocation. Update LAST_ID_USED + above alloc_id() to the highest ID used. +- Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for + a while. E.g. to trigger the CursorMovedI autocommand event. + See test_cursor_func.vim for an example +- If the bug that is being tested isn't fixed yet, you can throw an exception + so that it's clear this still needs work. E.g.: + throw "Skipped: Bug with <c-e> and popupmenu not fixed yet" +- See the start of runtest.vim for more help. + + +TO ADD A SCREEN DUMP TEST: + +Mostly the same as writing a new style test. Additonally, see help on +"terminal-dumptest". Put the reference dump in "dumps/Test_func_name.dump". + + +TO ADD AN OLD STYLE TEST: + +1) Create test_<subject>.in and test_<subject>.ok files. +2) Add test_<subject>.out to SCRIPTS_ALL in Make_all.mak in alphabetical order. +3) Use make test_<subject>.out to run a single test in src/testdir/. + Use make test_<subject> to run a single test in src/. +4) Also add an entry in src/Makefile. + +Keep in mind that the files are used as if everything was typed: +- To add comments use: :" (that's an Ex command comment) +- A line break is like pressing Enter. If that happens on the last line + you'll hear a beep! diff --git a/src/testdir/amiga.vim b/src/testdir/amiga.vim index e0ca47a8ed..79956d7d94 100644 --- a/src/testdir/amiga.vim +++ b/src/testdir/amiga.vim @@ -2,3 +2,5 @@ set shell=csh map! /tmp t: cmap !rm !Delete all + +source setup.vim diff --git a/src/testdir/bench_re_freeze.in b/src/testdir/bench_re_freeze.in new file mode 100644 index 0000000000..7b1bfa3459 --- /dev/null +++ b/src/testdir/bench_re_freeze.in @@ -0,0 +1,13 @@ +Test for Benchmarking RE engine + +STARTTEST +:so small.vim +:if !has("reltime") | qa! | endif +:set nocp cpo&vim +:so bench_re_freeze.vim +:call Measure('samples/re.freeze.txt', '\s\+\%#\@<!$', '+5') +:/^" Benchmark/,$w! benchmark.out +:qa! +ENDTEST + +" Benchmark_results: diff --git a/src/testdir/bench_re_freeze.vim b/src/testdir/bench_re_freeze.vim new file mode 100644 index 0000000000..ee8443825f --- /dev/null +++ b/src/testdir/bench_re_freeze.vim @@ -0,0 +1,13 @@ +"Test for benchmarking the RE engine + +so small.vim +if !has("reltime") | finish | endif +func! Measure(file, pattern, arg) + for re in range(3) + let sstart=reltime() + let cmd=printf("../vim -u NONE -N --cmd ':set re=%d'". + \ " -c 'call search(\"%s\", \"\", \"\", 10000)' -c ':q!' %s", re, escape(a:pattern, '\\'), empty(a:arg) ? '' : a:arg) + call system(cmd. ' '. a:file) + $put =printf('file: %s, re: %d, time: %s', a:file, re, reltimestr(reltime(sstart))) + endfor +endfunc diff --git a/src/testdir/color_ramp.vim b/src/testdir/color_ramp.vim new file mode 100644 index 0000000000..0219f3f567 --- /dev/null +++ b/src/testdir/color_ramp.vim @@ -0,0 +1,41 @@ +" Script to generate a file that shows al 256 xterm colors + +new +call setline(1, 'ANSI') + +" ANSI colors +let s = '' +for nr in range(0, 7) + let s .= "\033[4" . nr . "m " +endfor +for nr in range(8, 15) + let s .= "\033[10" . (nr - 8) . "m " +endfor +" Add | in original color pair to see white background. +let s .= "\033[m|" +call setline(2, s) + +" 6 x 6 x 6 color cube +call setline(3, 'color cube') +for high in range(0, 5) + let s = '' + for low in range(0, 35) + let nr = low + high * 36 + let s .= "\033[48;5;" . (nr + 16) . "m " + endfor + let s .= "\033[m|" + call setline(high + 4, s) +endfor + +" 24 shades of grey +call setline(10, 'grey ramp') +let s = '' +for nr in range(0, 23) + let s .= "\033[48;5;" . (nr + 232) . "m " +endfor +let s .= "\033[m|" +call setline(11, s) + +set binary +write! <sfile>:h/color_ramp.txt +quit diff --git a/src/testdir/dos.vim b/src/testdir/dos.vim index 27764db9d9..3ea6ab2a6d 100644 --- a/src/testdir/dos.vim +++ b/src/testdir/dos.vim @@ -5,3 +5,5 @@ set shell=c:\COMMAND.COM shellquote= shellxquote= shellcmdflag=/c shellredir=> if executable("cmd.exe") set shell=cmd.exe endif + +source setup.vim diff --git a/src/testdir/dumps/Test_incsearch_scrolling_01.dump b/src/testdir/dumps/Test_incsearch_scrolling_01.dump new file mode 100644 index 0000000000..c133d5f519 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_scrolling_01.dump @@ -0,0 +1,9 @@ +|.+0&#ffffff0@69 +@50| @19 +|.@69 +@50| @19 +@70 +|t+1&&|a|r|g|e+0&&|t| @63 +|@+0#4040ff13&@2| @66 +|/+0#0000000&|t|a|r|g> @64 +@70 diff --git a/src/testdir/dumps/Test_popup_command_01.dump b/src/testdir/dumps/Test_popup_command_01.dump new file mode 100644 index 0000000000..8d0cd9cf57 --- /dev/null +++ b/src/testdir/dumps/Test_popup_command_01.dump @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w| +0#0000001#ffd7ff255|U|n|d|o| @12| +0#0000000#ffffff0@45 +|~+0#4040ff13&| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|P|a|s|t|e| @11| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ffffff0@45 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62 diff --git a/src/testdir/dumps/Test_popup_command_02.dump b/src/testdir/dumps/Test_popup_command_02.dump new file mode 100644 index 0000000000..e33ea4df51 --- /dev/null +++ b/src/testdir/dumps/Test_popup_command_02.dump @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w| +0#0000001#ffd7ff255|U|n|d|o| @12| +0#0000000#ffffff0@45 +|~+0#4040ff13&| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#e0e0e08|P|a|s|t|e| @11| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ffffff0@45 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62 diff --git a/src/testdir/dumps/Test_popup_command_03.dump b/src/testdir/dumps/Test_popup_command_03.dump new file mode 100644 index 0000000000..fa2ac70b0e --- /dev/null +++ b/src/testdir/dumps/Test_popup_command_03.dump @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| |X+0&#e0e0e08|t|h|r|e@1> +0&#ffffff0|f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|7| @8|2|,|1|9| @9|A|l@1| diff --git a/src/testdir/dumps/Test_popup_position_01.dump b/src/testdir/dumps/Test_popup_position_01.dump new file mode 100644 index 0000000000..43900fb8a5 --- /dev/null +++ b/src/testdir/dumps/Test_popup_position_01.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a> @30||+1&&|6+0&&|7|8|9|_|a| @30 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| | +0#4040ff13#ffffff0@30 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| | +0#4040ff13#ffffff0@30 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff --git a/src/testdir/dumps/Test_popup_position_02.dump b/src/testdir/dumps/Test_popup_position_02.dump new file mode 100644 index 0000000000..c3613c3513 --- /dev/null +++ b/src/testdir/dumps/Test_popup_position_02.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a| @30||+1&&|6+0&&|7|8|9|_|a> @30 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff --git a/src/testdir/dumps/Test_popup_position_03.dump b/src/testdir/dumps/Test_popup_position_03.dump new file mode 100644 index 0000000000..650cb7f21f --- /dev/null +++ b/src/testdir/dumps/Test_popup_position_03.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a| @30||+1&&|6+0&&|7|8|9|_|a> @30 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @4| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_ +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @4| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_ +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff --git a/src/testdir/dumps/Test_popup_position_04.dump b/src/testdir/dumps/Test_popup_position_04.dump new file mode 100644 index 0000000000..1793b232c4 --- /dev/null +++ b/src/testdir/dumps/Test_popup_position_04.dump @@ -0,0 +1,10 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7 +|8|9|_|a| @32||+1&&|8+0&&|9|_|a| @32 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7 +|8|9|_|b| @32||+1&&|8+0&&|9|_|b| @32 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @20||+1&&|6+0&&|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @20 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff --git a/src/testdir/dumps/Test_syntax_c_01.dump b/src/testdir/dumps/Test_syntax_c_01.dump new file mode 100644 index 0000000000..b411b85920 --- /dev/null +++ b/src/testdir/dumps/Test_syntax_c_01.dump @@ -0,0 +1,20 @@ +>/+0#0000e05#ffffff0|*| |c|o|m@1|e|n|t| |l|i|n|e| |a|t| |t|h|e| |t|o|p| |*|/| +0#0000000&@45 +| @1|i+0#00e0003&|n|t| +0#0000000&@69 +|m|a|i|n|(|i+0#00e0003&|n|t| +0#0000000&|a|r|g|c|,| |c+0#00e0003&|h|a|r| +0#0000000&|*@1|a|r|g|v|)|/+0#0000e05&@1| |a|n|o|t|h|e|r| |c|o|m@1|e|n|t| +0#0000000&@29 +|{| @73 +|#+0#e000e06&|i|f| |0| +0#0000000&@69 +| +0#0000e05&@2|i|n|t| @2|n|o|t|_|u|s|e|d|;| +0#0000000&@56 +|#+0#e000e06&|e|l|s|e| +0#0000000&@69 +| @2|i+0#00e0003&|n|t| +0#0000000&@2|u|s|e|d|;| @60 +|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68 +| @2|p|r|i|n|t|f|(|"+0#e000002&|J|u|s|t| |a|n| |e|x|a|m|p|l|e| |p|i|e|c|e| |o|f| |C| |c|o|d|e|\+0#e000e06&|n|"+0#e000002&|)+0#0000000&|;| @27 +| @2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|0+0#e000002&|x|0|f@1|;+0#0000000&| @58 +|}| @73 +| @2|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60 +|m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000000&|d+0#00e0003&|o|u|b|l|e| +0#0000000&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000000&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000000&|t|h|e|r|e|)| |{| @14 +| @1|/+0#0000e05&@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |r|e|a|d| |h|e|r|e| +0#0000000&@44 +| @1|f+0#af5f00255&|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @39 +| @3|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @64 +| @1|}| @71 +|}| @73 +|"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|4|C| @37|1|,|1| @10|A|l@1| diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim new file mode 100644 index 0000000000..9c2a587364 --- /dev/null +++ b/src/testdir/gen_opt_test.vim @@ -0,0 +1,228 @@ +" Script to generate testdir/opt_test.vim from option.c + +set cpo=&vim + +" Only do this when build with the +eval feature. +if 1 + +set nomore + +" The terminal size is restored at the end. +" Clear out t_WS, we don't want to resize the actual terminal. +let script = [ + \ 'let save_columns = &columns', + \ 'let save_lines = &lines', + \ 'let save_term = &term', + \ 'set t_WS=', + \ ] + +/#define p_term +let end = line('.') + +" font name that works everywhere (hopefully) +let fontname = has('win32') ? 'fixedsys' : 'fixed' + +" Two lists with values: values that work and values that fail. +" When not listed, "othernum" or "otherstring" is used. +let test_values = { + \ 'cmdheight': [[1, 2, 10], [-1, 0]], + \ 'cmdwinheight': [[1, 2, 10], [-1, 0]], + \ 'columns': [[12, 80], [-1, 0, 10]], + \ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]], + \ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]], + \ 'helpheight': [[0, 10, 100], [-1]], + \ 'history': [[0, 1, 100], [-1, 10001]], + \ 'iminsert': [[0, 1], [-1, 3, 999]], + \ 'imsearch': [[-1, 0, 1], [-2, 3, 999]], + \ 'imstyle': [[0, 1], [-1, 2, 999]], + \ 'lines': [[2, 24], [-1, 0, 1]], + \ 'linespace': [[0, 2, 4], ['']], + \ 'numberwidth': [[1, 4, 8, 10], [-1, 0, 11]], + \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]], + \ 'report': [[0, 1, 2, 9999], [-1]], + \ 'scroll': [[0, 1, 2, 20], [-1]], + \ 'scrolljump': [[-50, -1, 0, 1, 2, 20], [999]], + \ 'scrolloff': [[0, 1, 2, 20], [-1]], + \ 'shiftwidth': [[0, 1, 8, 999], [-1]], + \ 'sidescroll': [[0, 1, 8, 999], [-1]], + \ 'sidescrolloff': [[0, 1, 8, 999], [-1]], + \ 'tabstop': [[1, 4, 8, 12], [-1, 0]], + \ 'textwidth': [[0, 1, 8, 99], [-1]], + \ 'timeoutlen': [[0, 8, 99999], [-1]], + \ 'titlelen': [[0, 1, 8, 9999], [-1]], + \ 'updatecount': [[0, 1, 8, 9999], [-1]], + \ 'updatetime': [[0, 1, 8, 9999], [-1]], + \ 'verbose': [[-1, 0, 1, 8, 9999], []], + \ 'wildcharm': [[-1, 0, 100], []], + \ 'winheight': [[1, 10, 999], [-1, 0]], + \ 'winminheight': [[0, 1], [-1]], + \ 'winminwidth': [[0, 1, 10], [-1]], + \ 'winwidth': [[1, 10, 999], [-1, 0]], + \ + \ 'ambiwidth': [['', 'single'], ['xxx']], + \ 'background': [['', 'light', 'dark'], ['xxx']], + \ 'backspace': [[0, 2, '', 'eol', 'eol,start'], ['xxx']], + \ 'backupcopy': [['yes', 'auto'], ['', 'xxx', 'yes,no']], + \ 'backupext': [['xxx'], ['']], + \ 'belloff': [['', 'all', 'copy,error'], ['xxx']], + \ 'breakindentopt': [['', 'min:3', 'sbr'], ['xxx', 'min', 'min:x']], + \ 'browsedir': [['', 'last', '/'], ['xxx']], + \ 'bufhidden': [['', 'hide', 'wipe'], ['xxx', 'hide,wipe']], + \ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']], + \ 'casemap': [['', 'internal'], ['xxx']], + \ 'cedit': [['', '\<Esc>'], ['xxx', 'f']], + \ 'clipboard': [['', 'unnamed', 'autoselect,unnamed'], ['xxx']], + \ 'colorcolumn': [['', '8', '+2'], ['xxx']], + \ 'comments': [['', 'b:#'], ['xxx']], + \ 'commentstring': [['', '/*%s*/'], ['xxx']], + \ 'complete': [['', 'w,b'], ['xxx']], + \ 'concealcursor': [['', 'n', 'nvic'], ['xxx']], + \ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']], + \ 'cryptmethod': [['', 'zip'], ['xxx']], + \ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']], + \ 'debug': [['', 'msg', 'msg', 'beep'], ['xxx']], + \ 'diffopt': [['', 'filler', 'icase,iwhite'], ['xxx']], + \ 'display': [['', 'lastline', 'lastline,uhex'], ['xxx']], + \ 'eadirection': [['', 'both', 'ver'], ['xxx', 'ver,hor']], + \ 'encoding': [['latin1'], ['xxx', '']], + \ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter'], ['xxx']], + \ 'fileencoding': [['', 'latin1', 'xxx'], []], + \ 'fileformat': [['', 'dos', 'unix'], ['xxx']], + \ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']], + \ 'fillchars': [['', 'vert:x'], ['xxx']], + \ 'foldclose': [['', 'all'], ['xxx']], + \ 'foldmethod': [['manual', 'indent'], ['', 'xxx', 'expr,diff']], + \ 'foldopen': [['', 'all', 'hor,jump'], ['xxx']], + \ 'foldmarker': [['((,))'], ['', 'xxx']], + \ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']], + \ 'guicursor': [['', 'n:block-Cursor'], ['xxx']], + \ 'guifont': [['', fontname], []], + \ 'guifontwide': [['', fontname], []], + \ 'guifontset': [['', fontname], []], + \ 'helplang': [['', 'de', 'de,it'], ['xxx']], + \ 'highlight': [['', 'e:Error'], ['xxx']], + \ 'imactivatekey': [['', 'S-space'], ['xxx']], + \ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']], + \ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']], + \ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']], + \ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']], + \ 'keymap': [['', 'accents'], ['xxx']], + \ 'keymodel': [['', 'startsel', 'startsel,stopsel'], ['xxx']], + \ 'langmap': [['', 'xX', 'aA,bB'], ['xxx']], + \ 'listchars': [['', 'eol:x', 'eol:x,space:y'], ['xxx']], + \ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']], + \ 'mkspellmem': [['10000,100,12'], ['', 'xxx']], + \ 'mouse': [['', 'a', 'nvi'], ['xxx', 'n,v,i']], + \ 'mousemodel': [['', 'popup'], ['xxx']], + \ 'mouseshape': [['', 'n:arrow'], ['xxx']], + \ 'nrformats': [['', 'alpha', 'alpha,hex,bin'], ['xxx']], + \ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']], + \ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']], + \ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']], + \ 'renderoptions': [['', 'type:directx'], ['xxx']], + \ 'selection': [['old', 'inclusive'], ['', 'xxx']], + \ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']], + \ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']], + \ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']], + \ 'spellfile': [['', 'file.en.add'], ['xxx', '/tmp/file']], + \ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']], + \ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']], + \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], + \ 'term': [[], []], + \ 'termguicolors': [[], []], + \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']], + \ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], + \ 'toolbar': [['', 'icons', 'text'], ['xxx']], + \ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']], + \ 'ttymouse': [['', 'xterm'], ['xxx']], + \ 'ttytype': [[], []], + \ 'viewoptions': [['', 'cursor', 'unix,slash'], ['xxx']], + \ 'viminfo': [['', '''50', '"30'], ['xxx']], + \ 'virtualedit': [['', 'all', 'all,block'], ['xxx']], + \ 'whichwrap': [['', 'b,s', 'bs'], ['xxx']], + \ 'wildmode': [['', 'full', 'list:full', 'full,longest'], ['xxx']], + \ 'wildoptions': [['', 'tagfile'], ['xxx']], + \ 'winaltkeys': [['menu', 'no'], ['', 'xxx']], + \ + \ 'luadll': [[], []], + \ 'perldll': [[], []], + \ 'pythondll': [[], []], + \ 'pythonthreedll': [[], []], + \ 'pyxversion': [[], []], + \ 'rubydll': [[], []], + \ 'tcldll': [[], []], + \ + \ 'blurradius': [[], [-1]], + \ 'fuoptions': [[], ['xxx']], + \ 'guifont': [[], ['xxx']], + \ 'transparency': [[], ['-1']], + \ + \ 'othernum': [[-1, 0, 100], ['']], + \ 'otherstring': [['', 'xxx'], []], + \} + +1 +/struct vimoption options +while 1 + /{" + if line('.') > end + break + endif + let line = getline('.') + let name = substitute(line, '.*{"\([^"]*\)".*', '\1', '') + let shortname = substitute(line, '.*"\([^"]*\)".*', '\1', '') + + if has_key(test_values, name) + let a = test_values[name] + elseif line =~ 'P_NUM' + let a = test_values['othernum'] + else + let a = test_values['otherstring'] + endif + if len(a[0]) > 0 || len(a[1]) > 0 + if line =~ 'P_BOOL' + call add(script, 'set ' . name) + call add(script, 'set ' . shortname) + call add(script, 'set no' . name) + call add(script, 'set no' . shortname) + else + for val in a[0] + call add(script, 'set ' . name . '=' . val) + call add(script, 'set ' . shortname . '=' . val) + endfor + + " setting an option can only fail when it's implemented. + call add(script, "if exists('+" . name . "')") + for val in a[1] + call add(script, "call assert_fails('set " . name . "=" . val . "')") + call add(script, "call assert_fails('set " . shortname . "=" . val . "')") + endfor + call add(script, "endif") + endif + + " cannot change 'termencoding' in GTK + if name != 'termencoding' || !has('gui_gtk') + call add(script, 'set ' . name . '&') + call add(script, 'set ' . shortname . '&') + endif + if name == 'verbosefile' + call add(script, 'call delete("xxx")') + endif + + if name == 'more' + call add(script, 'set nomore') + elseif name == 'lines' + call add(script, 'let &lines = save_lines') + endif + endif +endwhile + +call add(script, 'let &term = save_term') +call add(script, 'let &columns = save_columns') +call add(script, 'let &lines = save_lines') + +call writefile(script, 'opt_test.vim') + +endif + +qa! diff --git a/src/testdir/gui_init.vim b/src/testdir/gui_init.vim new file mode 100644 index 0000000000..42b2bca7fe --- /dev/null +++ b/src/testdir/gui_init.vim @@ -0,0 +1,6 @@ +" gvimrc for test_gui_init.vim + +if has('gui_athena') || has('gui_motif') || has('gui_gtk2') || has('gui_gtk3') + set guiheadroom=0 + set guioptions+=p +endif diff --git a/src/testdir/gui_preinit.vim b/src/testdir/gui_preinit.vim new file mode 100644 index 0000000000..c351b72461 --- /dev/null +++ b/src/testdir/gui_preinit.vim @@ -0,0 +1,7 @@ +" vimrc for test_gui_init.vim + +" Note that this flag must be added in the .vimrc file, before switching on +" syntax or filetype recognition (when the |gvimrc| file is sourced the system +" menu has already been loaded; the ":syntax on" and ":filetype on" commands +" load the menu too). +set guioptions+=M diff --git a/src/testdir/if_ver-1.vim b/src/testdir/if_ver-1.vim new file mode 100644 index 0000000000..3c94c9e103 --- /dev/null +++ b/src/testdir/if_ver-1.vim @@ -0,0 +1,26 @@ +" Print all interface versions and write the result into if_ver.txt. +" For Ubuntu. Part 1. + +redir! > if_ver.txt +if 1 + echo "*** Interface versions ***" + echo "\nLua:" + lua print(_VERSION) + " echo "\nLuaJIT:" + " lua print(jit.version) + if has('mzscheme') + echo "\nMzScheme:" + mzscheme (display (version)) + endif + echo "\nPerl:" + perl print $^V + echo "\nRuby:" + ruby print RUBY_VERSION + if has('tcl') + echo "\nTcl:" + tcl puts [info patchlevel] + endif + echo "\nPython 2:" + python import sys; print sys.version +endif +redir END diff --git a/src/testdir/if_ver-2.vim b/src/testdir/if_ver-2.vim new file mode 100644 index 0000000000..a6fedb5691 --- /dev/null +++ b/src/testdir/if_ver-2.vim @@ -0,0 +1,10 @@ +" Print py3 interface version and write the result into if_ver.txt. +" For Ubuntu. Part 2. + +redir! >> if_ver.txt +if 1 + echo "\nPython 3:" + python3 import sys; print(sys.version) + echo "\n" +endif +redir END diff --git a/src/testdir/lsan-suppress.txt b/src/testdir/lsan-suppress.txt new file mode 100644 index 0000000000..5166fbf5c7 --- /dev/null +++ b/src/testdir/lsan-suppress.txt @@ -0,0 +1,3 @@ +# Suppress leaks from X libraries on Ubuntu trusty. +leak:libX11.so.6 +leak:libXt.so.6 diff --git a/src/testdir/main.aap b/src/testdir/main.aap index ef2d93cacb..a4d029510b 100644 --- a/src/testdir/main.aap +++ b/src/testdir/main.aap @@ -4,15 +4,14 @@ VimProg ?= ../vim -Scripts = test1.out test2.out test3.out test4.out test5.out test6.out - test7.out test8.out test9.out test10.out test11.out - test12.out test13.out test14.out test15.out test17.out - test18.out test19.out test20.out test21.out test22.out - test23.out test24.out test25.out test26.out test27.out - test28.out test29.out test30.out test31.out test32.out - test33.out test34.out test35.out test36.out test37.out - test38.out test39.out test40.out test41.out test42.out - test43.out test44.out test45.out test46.out test47.out +Scripts = test1.out test2.out test3.out test6.out + test11.out + test13.out test14.out test17.out + test18.out test21.out + test27.out test29.out test30.out + test37.out + test39.out test42.out + test44.out test46.out test47.out test48.out test49.out test74.out ScriptsGUI = test16.out diff --git a/src/testdir/os2.vim b/src/testdir/os2.vim deleted file mode 100644 index c97ba5d005..0000000000 --- a/src/testdir/os2.vim +++ /dev/null @@ -1,3 +0,0 @@ -" Settings for test script execution -" Always use "CMD.EXE", don't use the value of "$SHELL". -set shell=CMD.EXE shellquote= shellxquote= shellcmdflag=/c shellredir=> diff --git a/src/testdir/pyxfile/py2_magic.py b/src/testdir/pyxfile/py2_magic.py new file mode 100644 index 0000000000..819892fd16 --- /dev/null +++ b/src/testdir/pyxfile/py2_magic.py @@ -0,0 +1,4 @@ +# requires python 2.x + +import sys +print(sys.version) diff --git a/src/testdir/pyxfile/py2_shebang.py b/src/testdir/pyxfile/py2_shebang.py new file mode 100644 index 0000000000..13bfc491ec --- /dev/null +++ b/src/testdir/pyxfile/py2_shebang.py @@ -0,0 +1,4 @@ +#!/usr/bin/python2 + +import sys +print(sys.version) diff --git a/src/testdir/pyxfile/py3_magic.py b/src/testdir/pyxfile/py3_magic.py new file mode 100644 index 0000000000..d4b7ee0071 --- /dev/null +++ b/src/testdir/pyxfile/py3_magic.py @@ -0,0 +1,4 @@ +# requires python 3.x + +import sys +print(sys.version) diff --git a/src/testdir/pyxfile/py3_shebang.py b/src/testdir/pyxfile/py3_shebang.py new file mode 100644 index 0000000000..ec05808ca4 --- /dev/null +++ b/src/testdir/pyxfile/py3_shebang.py @@ -0,0 +1,4 @@ +#!/usr/bin/python3 + +import sys +print(sys.version) diff --git a/src/testdir/pyxfile/pyx.py b/src/testdir/pyxfile/pyx.py new file mode 100644 index 0000000000..261a6512c0 --- /dev/null +++ b/src/testdir/pyxfile/pyx.py @@ -0,0 +1,2 @@ +import sys +print(sys.version) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim new file mode 100644 index 0000000000..4f508a4875 --- /dev/null +++ b/src/testdir/runtest.vim @@ -0,0 +1,330 @@ +" This script is sourced while editing the .vim file with the tests. +" When the script is successful the .res file will be created. +" Errors are appended to the test.log file. +" +" To execute only specific test functions, add a second argument. It will be +" matched against the names of the Test_ funtion. E.g.: +" ../vim -u NONE -S runtest.vim test_channel.vim open_delay +" The output can be found in the "messages" file. +" +" The test script may contain anything, only functions that start with +" "Test_" are special. These will be invoked and should contain assert +" functions. See test_assert.vim for an example. +" +" It is possible to source other files that contain "Test_" functions. This +" can speed up testing, since Vim does not need to restart. But be careful +" that the tests do not interfere with each other. +" +" If an error cannot be detected properly with an assert function add the +" error to the v:errors list: +" call add(v:errors, 'test foo failed: Cannot find xyz') +" +" If preparation for each Test_ function is needed, define a SetUp function. +" It will be called before each Test_ function. +" +" If cleanup after each Test_ function is needed, define a TearDown function. +" It will be called after each Test_ function. +" +" When debugging a test it can be useful to add messages to v:errors: +" call add(v:errors, "this happened") + + +" Without the +eval feature we can't run these tests, bail out. +so small.vim + +" Check that the screen size is at least 24 x 80 characters. +if &lines < 24 || &columns < 80 + let error = 'Screen size too small! Tests require at least 24 lines with 80 characters' + echoerr error + split test.log + $put =error + w + cquit +endif + +" Common with all tests on all systems. +source setup.vim + +" For consistency run all tests with 'nocompatible' set. +" This also enables use of line continuation. +set nocp viminfo+=nviminfo + +" Use utf-8 or latin1 by default, instead of whatever the system default +" happens to be. Individual tests can overrule this at the top of the file. +if has('multi_byte') + set encoding=utf-8 +else + set encoding=latin1 +endif + +" Avoid stopping at the "hit enter" prompt +set nomore + +" Output all messages in English. +lang mess C + +" Always use forward slashes. +set shellslash + +let s:srcdir = expand('%:p:h:h') + +" Prepare for calling test_garbagecollect_now(). +let v:testing = 1 + +" Support function: get the alloc ID by name. +function GetAllocId(name) + exe 'split ' . s:srcdir . '/alloc.h' + let top = search('typedef enum') + if top == 0 + call add(v:errors, 'typedef not found in alloc.h') + endif + let lnum = search('aid_' . a:name . ',') + if lnum == 0 + call add(v:errors, 'Alloc ID ' . a:name . ' not defined') + endif + close + return lnum - top - 1 +endfunc + +func RunTheTest(test) + echo 'Executing ' . a:test + + " Avoid stopping at the "hit enter" prompt + set nomore + + " Avoid a three second wait when a message is about to be overwritten by the + " mode message. + set noshowmode + + " Clear any overrides. + call test_override('ALL', 0) + + " Some tests wipe out buffers. To be consistent, always wipe out all + " buffers. + %bwipe! + + " The test may change the current directory. Save and restore the + " directory after executing the test. + let save_cwd = getcwd() + + if exists("*SetUp") + try + call SetUp() + catch + call add(v:errors, 'Caught exception in SetUp() before ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry + endif + + call add(s:messages, 'Executing ' . a:test) + let s:done += 1 + + if a:test =~ 'Test_nocatch_' + " Function handles errors itself. This avoids skipping commands after the + " error. + exe 'call ' . a:test + else + try + let s:test = a:test + au VimLeavePre * call EarlyExit(s:test) + exe 'call ' . a:test + au! VimLeavePre + catch /^\cskipped/ + call add(s:messages, ' Skipped') + call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', '')) + catch + call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry + endif + + if exists("*TearDown") + try + call TearDown() + catch + call add(v:errors, 'Caught exception in TearDown() after ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry + endif + + " Clear any autocommands + au! + + " Close any extra tab pages and windows and make the current one not modified. + while tabpagenr('$') > 1 + quit! + endwhile + + while 1 + let wincount = winnr('$') + if wincount == 1 + break + endif + bwipe! + if wincount == winnr('$') + " Did not manage to close a window. + only! + break + endif + endwhile + + exe 'cd ' . save_cwd +endfunc + +func AfterTheTest() + if len(v:errors) > 0 + let s:fail += 1 + call add(s:errors, 'Found errors in ' . s:test . ':') + call extend(s:errors, v:errors) + let v:errors = [] + endif +endfunc + +func EarlyExit(test) + " It's OK for the test we use to test the quit detection. + if a:test != 'Test_zz_quit_detected()' + call add(v:errors, 'Test caused Vim to exit: ' . a:test) + endif + + call FinishTesting() +endfunc + +" This function can be called by a test if it wants to abort testing. +func FinishTesting() + call AfterTheTest() + + " Don't write viminfo on exit. + set viminfo= + + " Clean up files created by setup.vim + call delete('XfakeHOME', 'rf') + + if s:fail == 0 + " Success, create the .res file so that make knows it's done. + exe 'split ' . fnamemodify(g:testname, ':r') . '.res' + write + endif + + if len(s:errors) > 0 + " Append errors to test.log + split test.log + call append(line('$'), '') + call append(line('$'), 'From ' . g:testname . ':') + call append(line('$'), s:errors) + write + endif + + if s:done == 0 + let message = 'NO tests executed' + else + let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') + endif + echo message + call add(s:messages, message) + if s:fail > 0 + let message = s:fail . ' FAILED:' + echo message + call add(s:messages, message) + call extend(s:messages, s:errors) + endif + + " Add SKIPPED messages + call extend(s:messages, s:skipped) + + " Append messages to the file "messages" + split messages + call append(line('$'), '') + call append(line('$'), 'From ' . g:testname . ':') + call append(line('$'), s:messages) + write + + qall! +endfunc + +" Source the test script. First grab the file name, in case the script +" navigates away. g:testname can be used by the tests. +let g:testname = expand('%') +let s:done = 0 +let s:fail = 0 +let s:errors = [] +let s:messages = [] +let s:skipped = [] +if expand('%') =~ 'test_vimscript.vim' + " this test has intentional s:errors, don't use try/catch. + source % +else + try + source % + catch + let s:fail += 1 + call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint) + endtry +endif + +" Names of flaky tests. +let s:flaky = [ + \ 'Test_client_server()', + \ 'Test_close_and_exit_cb()', + \ 'Test_collapse_buffers()', + \ 'Test_communicate()', + \ 'Test_cwd()', + \ 'Test_exit_callback_interval()', + \ 'Test_nb_basic()', + \ 'Test_oneshot()', + \ 'Test_out_cb()', + \ 'Test_paused()', + \ 'Test_pipe_through_sort_all()', + \ 'Test_pipe_through_sort_some()', + \ 'Test_quoteplus()', + \ 'Test_quotestar()', + \ 'Test_reltime()', + \ 'Test_repeat_three()', + \ 'Test_terminal_composing_unicode()', + \ 'Test_terminal_noblock()', + \ 'Test_terminal_redir_file()', + \ 'Test_terminal_tmap()', + \ 'Test_with_partial_callback()', + \ ] + +" Locate Test_ functions and execute them. +redir @q +silent function /^Test_ +redir END +let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) + +" If there is an extra argument filter the function names against it. +if argc() > 1 + let s:tests = filter(s:tests, 'v:val =~ argv(1)') +endif + +" Execute the tests in alphabetical order. +for s:test in sort(s:tests) + " Silence, please! + set belloff=all + + call RunTheTest(s:test) + + if len(v:errors) > 0 && index(s:flaky, s:test) >= 0 + call add(s:messages, 'Found errors in ' . s:test . ':') + call extend(s:messages, v:errors) + call add(s:messages, 'Flaky test failed, running it again') + let first_run = v:errors + + " Flakiness is often caused by the system being very busy. Sleep a couple + " of seconds to have a higher chance of succeeding the second time. + sleep 2 + + let v:errors = [] + call RunTheTest(s:test) + if len(v:errors) > 0 + let second_run = v:errors + let v:errors = ['First run:'] + call extend(v:errors, first_run) + call add(v:errors, 'Second run:') + call extend(v:errors, second_run) + endif + endif + + call AfterTheTest() +endfor + +call FinishTesting() + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/samples/quickfix.txt b/src/testdir/samples/quickfix.txt new file mode 100644 index 0000000000..2de3835473 --- /dev/null +++ b/src/testdir/samples/quickfix.txt @@ -0,0 +1,4 @@ +samples/quickfix.txt:1:1:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +samples/quickfix.txt:2:1:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +samples/quickfix.txt:3:1:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +samples/quickfix.txt:4:1:dddddddddd diff --git a/src/testdir/samples/re.freeze.txt b/src/testdir/samples/re.freeze.txt new file mode 100644 index 0000000000..d768c23c5e --- /dev/null +++ b/src/testdir/samples/re.freeze.txt @@ -0,0 +1,6 @@ +:set re=0 or 2 +Search for the pattern: /\s\+\%#\@<!$/ +vim should not freeze. + +<td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td><td style="border-bottom windowtext 0.5pt solid; border-left windowtext;" class=abc align=right><font face=arial><font color=#ff0000><b>5</b></font></font></td> + diff --git a/src/testdir/samples/test000 b/src/testdir/samples/test000 new file mode 100644 index 0000000000..af8abe9c7f Binary files /dev/null and b/src/testdir/samples/test000 differ diff --git a/src/testdir/sautest/autoload/foo.vim b/src/testdir/sautest/autoload/foo.vim new file mode 100644 index 0000000000..d7dcd5ce3d --- /dev/null +++ b/src/testdir/sautest/autoload/foo.vim @@ -0,0 +1,7 @@ +let g:loaded_foo_vim += 1 + +let foo#bar = {} + +func foo#bar.echo() + let g:called_foo_bar_echo += 1 +endfunc diff --git a/src/testdir/sautest/autoload/footest.vim b/src/testdir/sautest/autoload/footest.vim index f467bc376d..1e78963a10 100644 --- a/src/testdir/sautest/autoload/footest.vim +++ b/src/testdir/sautest/autoload/footest.vim @@ -1,4 +1,4 @@ -" Autoload script used by test55 and test60 +" Autoload script used by test_listdict.vim, test_exists.vim and test_let.vim let footest#x = 1 func footest#F() return 0 diff --git a/src/testdir/sautest/autoload/globone.vim b/src/testdir/sautest/autoload/globone.vim new file mode 100644 index 0000000000..98c9a10582 --- /dev/null +++ b/src/testdir/sautest/autoload/globone.vim @@ -0,0 +1 @@ +" used by Test_globpath() diff --git a/src/testdir/sautest/autoload/globtwo.vim b/src/testdir/sautest/autoload/globtwo.vim new file mode 100644 index 0000000000..98c9a10582 --- /dev/null +++ b/src/testdir/sautest/autoload/globtwo.vim @@ -0,0 +1 @@ +" used by Test_globpath() diff --git a/src/testdir/sautest/autoload/sourced.vim b/src/testdir/sautest/autoload/sourced.vim new file mode 100644 index 0000000000..f69f00cb53 --- /dev/null +++ b/src/testdir/sautest/autoload/sourced.vim @@ -0,0 +1,3 @@ +let g:loaded_sourced_vim += 1 +func! sourced#something() +endfunc diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim new file mode 100644 index 0000000000..e601ae6cd3 --- /dev/null +++ b/src/testdir/screendump.vim @@ -0,0 +1,117 @@ +" Functions shared by tests making screen dumps. + +" Only load this script once. +if exists('*CanRunVimInTerminal') + finish +endif + +" For most tests we need to be able to run terminal Vim with 256 colors. On +" MS-Windows the console only has 16 colors and the GUI can't run in a +" terminal. +func CanRunVimInTerminal() + return has('terminal') && !has('win32') +endfunc + +" Skip the rest if there is no terminal feature at all. +if !has('terminal') + finish +endif + +source shared.vim + +" Run Vim with "arguments" in a new terminal window. +" By default uses a size of 20 lines and 75 columns. +" Returns the buffer number of the terminal. +" +" Options is a dictionary, these items are recognized: +" "rows" - height of the terminal window (max. 20) +" "cols" - width of the terminal window (max. 78) +func RunVimInTerminal(arguments, options) + " If Vim doesn't exit a swap file remains, causing other tests to fail. + " Remove it here. + call delete(".swp") + + if exists('$COLORFGBG') + " Clear $COLORFGBG to avoid 'background' being set to "dark", which will + " only be corrected if the response to t_RB is received, which may be too + " late. + let $COLORFGBG = '' + endif + + " Make a horizontal and vertical split, so that we can get exactly the right + " size terminal window. Works only when the current window is full width. + call assert_equal(&columns, winwidth(0)) + split + vsplit + + " Always do this with 256 colors and a light background. + set t_Co=256 background=light + hi Normal ctermfg=NONE ctermbg=NONE + + " Make the window 20 lines high and 75 columns, unless told otherwise. + let rows = get(a:options, 'rows', 20) + let cols = get(a:options, 'cols', 75) + + let cmd = GetVimCommandClean() + + " Add -v to have gvim run in the terminal (if possible) + let cmd .= ' -v ' . a:arguments + let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) + if &termwinsize == '' + call assert_equal([rows, cols], term_getsize(buf)) + else + let rows = term_getsize(buf)[0] + let cols = term_getsize(buf)[1] + endif + + " Wait for "All" or "Top" of the ruler to be shown in the last line or in + " the status line of the last window. This can be quite slow (e.g. when + " using valgrind). + " If it fails then show the terminal contents for debugging. + try + call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1 || len(term_getline(buf, rows - 1)) >= cols - 1}) + catch /timed out after/ + let lines = map(range(1, rows), {key, val -> term_getline(buf, val)}) + call assert_report('RunVimInTerminal() failed, screen contents: ' . join(lines, "<NL>")) + endtry + + return buf +endfunc + +" Stop a Vim running in terminal buffer "buf". +func StopVimInTerminal(buf) + call assert_equal("running", term_getstatus(a:buf)) + + " CTRL-O : works both in Normal mode and Insert mode to start a command line. + " In Command-line it's inserted, the CTRL-U removes it again. + call term_sendkeys(a:buf, "\<C-O>:\<C-U>qa!\<cr>") + + call WaitForAssert({-> assert_equal("finished", term_getstatus(a:buf))}) + only! +endfunc + +" Verify that Vim running in terminal buffer "buf" matches the screen dump. +" "options" is passed to term_dumpwrite(). +" The file name used is "dumps/{filename}.dump". +" Will wait for up to a second for the screen dump to match. +func VerifyScreenDump(buf, filename, options) + let reference = 'dumps/' . a:filename . '.dump' + let testfile = a:filename . '.dump.failed' + + let i = 0 + while 1 + call delete(testfile) + call term_dumpwrite(a:buf, testfile, a:options) + if readfile(reference) == readfile(testfile) + call delete(testfile) + break + endif + if i == 100 + " Leave the test file around for inspection. + call assert_report('See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")') + break + endif + sleep 10m + let i += 1 + endwhile +endfunc diff --git a/src/testdir/setup.vim b/src/testdir/setup.vim new file mode 100644 index 0000000000..fca5194abf --- /dev/null +++ b/src/testdir/setup.vim @@ -0,0 +1,33 @@ +" Common preparations for running tests. + +" Only load this once. +if 1 + if exists('s:did_load') + finish + endif + let s:did_load = 1 +endif + +" Make sure 'runtimepath' and 'packpath' does not include $HOME. +set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after +if has('packages') + let &packpath = &rtp +endif + +" Only when the +eval feature is present. +if 1 + " Make sure the .Xauthority file can be found after changing $HOME. + if $XAUTHORITY == '' + let $XAUTHORITY = $HOME . '/.Xauthority' + endif + + " Avoid storing shell history. + let $HISTFILE = "" + + " Make sure $HOME does not get read or written. + " It must exist, gnome tries to create $HOME/.gnome2 + let $HOME = getcwd() . '/XfakeHOME' + if !isdirectory($HOME) + call mkdir($HOME) + endif +endif diff --git a/src/testdir/setup_gui.vim b/src/testdir/setup_gui.vim new file mode 100644 index 0000000000..90ef1f1de1 --- /dev/null +++ b/src/testdir/setup_gui.vim @@ -0,0 +1,32 @@ +" Common preparations for running GUI tests. + +let g:x11_based_gui = has('gui_athena') || has('gui_motif') + \ || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') + +" Reasons for 'skipped'. +let g:not_supported = "Skipped: Feature/Option not supported by this GUI: " +let g:not_implemented = "Skipped: Test not implemented yet for this GUI" +let g:not_hosted = "Skipped: Test not hosted by the system/environment" + +" For KDE set a font, empty 'guifont' may cause a hang. +func GUISetUpCommon() + if has("gui_kde") + set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0 + endif + + " Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the + " actual home directory. But avoid triggering fontconfig by setting the + " cache directory. Only needed for Unix. + if $XDG_CACHE_HOME == '' && exists('g:tester_HOME') + let $XDG_CACHE_HOME = g:tester_HOME . '/.cache' + endif + call mkdir('Xhome') + let $HOME = fnamemodify('Xhome', ':p') +endfunc + +func GUITearDownCommon() + call delete('Xhome', 'rf') +endfunc + +" Ignore the "failed to create input context" error. +call test_ignore_error('E285') diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim new file mode 100644 index 0000000000..21dada4cea --- /dev/null +++ b/src/testdir/shared.vim @@ -0,0 +1,342 @@ +" Functions shared by several tests. + +" Only load this script once. +if exists('*WaitFor') + finish +endif + +" Get the name of the Python executable. +" Also keeps it in s:python. +func PythonProg() + " This test requires the Python command to run the test server. + " This most likely only works on Unix and Windows. + if has('unix') + " We also need the job feature or the pkill command to make sure the server + " can be stopped. + if !(executable('python') && (has('job') || executable('pkill'))) + return '' + endif + let s:python = 'python' + elseif has('win32') + " Use Python Launcher for Windows (py.exe) if available. + if executable('py.exe') + let s:python = 'py.exe' + elseif executable('python.exe') + let s:python = 'python.exe' + else + return '' + endif + else + return '' + endif + return s:python +endfunc + +" Run "cmd". Returns the job if using a job. +func RunCommand(cmd) + let job = 0 + if has('job') + let job = job_start(a:cmd, {"stoponexit": "hup"}) + call job_setoptions(job, {"stoponexit": "kill"}) + elseif has('win32') + exe 'silent !start cmd /c start "test_channel" ' . a:cmd + else + exe 'silent !' . a:cmd . '&' + endif + return job +endfunc + +" Read the port number from the Xportnr file. +func GetPort() + let l = [] + for i in range(200) + try + let l = readfile("Xportnr") + catch + endtry + if len(l) >= 1 + break + endif + sleep 10m + endfor + call delete("Xportnr") + + if len(l) == 0 + " Can't make the connection, give up. + return 0 + endif + return l[0] +endfunc + +" Run a Python server for "cmd" and call "testfunc". +" Always kills the server before returning. +func RunServer(cmd, testfunc, args) + " The Python program writes the port number in Xportnr. + call delete("Xportnr") + + if len(a:args) == 1 + let arg = ' ' . a:args[0] + else + let arg = '' + endif + let pycmd = s:python . " " . a:cmd . arg + + try + let g:currentJob = RunCommand(pycmd) + + " Wait for up to 2 seconds for the port number to be there. + let port = GetPort() + if port == 0 + call assert_false(1, "Can't start " . a:cmd) + return + endif + + call call(function(a:testfunc), [port]) + catch + call assert_false(1, 'Caught exception: "' . v:exception . '" in ' . v:throwpoint) + finally + call s:kill_server(a:cmd) + endtry +endfunc + +func s:kill_server(cmd) + if has('job') + if exists('g:currentJob') + call job_stop(g:currentJob) + unlet g:currentJob + endif + elseif has('win32') + let cmd = substitute(a:cmd, ".py", '', '') + call system('taskkill /IM ' . s:python . ' /T /F /FI "WINDOWTITLE eq ' . cmd . '"') + else + call system("pkill -f " . a:cmd) + endif +endfunc + +" Wait for up to five seconds for "expr" to become true. "expr" can be a +" stringified expression to evaluate, or a funcref without arguments. +" Using a lambda works best. Example: +" call WaitFor({-> status == "ok"}) +" +" A second argument can be used to specify a different timeout in msec. +" +" When successful the time slept is returned. +" When running into the timeout an exception is thrown, thus the function does +" not return. +func WaitFor(expr, ...) + let timeout = get(a:000, 0, 5000) + let slept = s:WaitForCommon(a:expr, v:null, timeout) + if slept < 0 + throw 'WaitFor() timed out after ' . timeout . ' msec' + endif + return slept +endfunc + +" Wait for up to five seconds for "assert" to return zero. "assert" must be a +" (lambda) function containing one assert function. Example: +" call WaitForAssert({-> assert_equal("dead", job_status(job)}) +" +" A second argument can be used to specify a different timeout in msec. +" +" Return zero for success, one for failure (like the assert function). +func WaitForAssert(assert, ...) + let timeout = get(a:000, 0, 5000) + if s:WaitForCommon(v:null, a:assert, timeout) < 0 + return 1 + endif + return 0 +endfunc + +" Common implementation of WaitFor() and WaitForAssert(). +" Either "expr" or "assert" is not v:null +" Return the waiting time for success, -1 for failure. +func s:WaitForCommon(expr, assert, timeout) + " using reltime() is more accurate, but not always available + let slept = 0 + if has('reltime') + let start = reltime() + endif + + while 1 + if type(a:expr) == v:t_func + let success = a:expr() + elseif type(a:assert) == v:t_func + let success = a:assert() == 0 + else + let success = eval(a:expr) + endif + if success + return slept + endif + + if slept >= a:timeout + break + endif + if type(a:assert) == v:t_func + " Remove the error added by the assert function. + call remove(v:errors, -1) + endif + + sleep 10m + if has('reltime') + let slept = float2nr(reltimefloat(reltime(start)) * 1000) + else + let slept += 10 + endif + endwhile + + return -1 " timed out +endfunc + + +" Wait for up to a given milliseconds. +" With the +timers feature this waits for key-input by getchar(), Resume() +" feeds key-input and resumes process. Return time waited in milliseconds. +" Without +timers it uses simply :sleep. +func Standby(msec) + if has('timers') + let start = reltime() + let g:_standby_timer = timer_start(a:msec, function('s:feedkeys')) + call getchar() + return float2nr(reltimefloat(reltime(start)) * 1000) + else + execute 'sleep ' a:msec . 'm' + return a:msec + endif +endfunc + +func Resume() + if exists('g:_standby_timer') + call timer_stop(g:_standby_timer) + call s:feedkeys(0) + unlet g:_standby_timer + endif +endfunc + +func s:feedkeys(timer) + call feedkeys('x', 'nt') +endfunc + +" Get $VIMPROG to run Vim executable. +" The Makefile writes it as the first line in the "vimcmd" file. +func GetVimProg() + if !filereadable('vimcmd') + " Assume the script was sourced instead of running "make". + return '../vim' + endif + return readfile('vimcmd')[0] +endfunc + +let g:valgrind_cnt = 1 + +" Get the command to run Vim, with -u NONE and --not-a-term arguments. +" If there is an argument use it instead of "NONE". +func GetVimCommand(...) + if !filereadable('vimcmd') + echo 'Cannot read the "vimcmd" file, falling back to ../vim.' + let lines = ['../vim'] + else + let lines = readfile('vimcmd') + endif + if a:0 == 0 + let name = 'NONE' + else + let name = a:1 + endif + " For Unix Makefile writes the command to use in the second line of the + " "vimcmd" file, including environment options. + " Other Makefiles just write the executable in the first line, so fall back + " to that if there is no second line or it is empty. + if len(lines) > 1 && lines[1] != '' + let cmd = lines[1] + else + let cmd = lines[0] + endif + + let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') + if cmd !~ '-u '. name + let cmd = cmd . ' -u ' . name + endif + let cmd .= ' --not-a-term' + let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') + + " If using valgrind, make sure every run uses a different log file. + if cmd =~ 'valgrind.*--log-file=' + let cmd = substitute(cmd, '--log-file=\(^\s*\)', '--log-file=\1.' . g:valgrind_cnt, '') + let g:valgrind_cnt += 1 + endif + + return cmd +endfunc + +" Get the command to run Vim, with --clean. +func GetVimCommandClean() + let cmd = GetVimCommand() + let cmd = substitute(cmd, '-u NONE', '--clean', '') + let cmd = substitute(cmd, '--not-a-term', '', '') + return cmd +endfunc + +" Run Vim, using the "vimcmd" file and "-u NORC". +" "before" is a list of Vim commands to be executed before loading plugins. +" "after" is a list of Vim commands to be executed after loading plugins. +" Plugins are not loaded, unless 'loadplugins' is set in "before". +" Return 1 if Vim could be executed. +func RunVim(before, after, arguments) + return RunVimPiped(a:before, a:after, a:arguments, '') +endfunc + +func RunVimPiped(before, after, arguments, pipecmd) + let cmd = GetVimCommand() + let args = '' + if len(a:before) > 0 + call writefile(a:before, 'Xbefore.vim') + let args .= ' --cmd "so Xbefore.vim"' + endif + if len(a:after) > 0 + call writefile(a:after, 'Xafter.vim') + let args .= ' -S Xafter.vim' + endif + + exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments + + if len(a:before) > 0 + call delete('Xbefore.vim') + endif + if len(a:after) > 0 + call delete('Xafter.vim') + endif + return 1 +endfunc + +func CanRunGui() + return has('gui') && ($DISPLAY != "" || has('gui_running') || has('gui_macvim')) +endfunc + +func WorkingClipboard() + if !has('clipboard') + return 0 + endif + if has('x11') + return $DISPLAY != "" + endif + return 1 +endfunc + +" Get line "lnum" as displayed on the screen. +" Trailing white space is trimmed. +func! Screenline(lnum) + let chars = [] + for c in range(1, winwidth(0)) + call add(chars, nr2char(screenchar(a:lnum, c))) + endfor + let line = join(chars, '') + return matchstr(line, '^.\{-}\ze\s*$') +endfunc + +" Stops the shell running in terminal "buf". +func Stop_shell_in_terminal(buf) + call term_sendkeys(a:buf, "exit\r") + let job = term_getjob(a:buf) + call WaitFor({-> job_status(job) == "dead"}) +endfunc diff --git a/src/testdir/test10.in b/src/testdir/test10.in deleted file mode 100644 index 2d0d546606..0000000000 --- a/src/testdir/test10.in +++ /dev/null @@ -1,114 +0,0 @@ -Test for 'errorformat'. This will fail if the quickfix feature was disabled. - -STARTTEST -:so small.vim -:" Also test a BOM is ignored. -:so mbyte.vim -:set encoding=utf-8 -:7/start of errorfile/,/end of errorfile/w! Xerrorfile1 -:7/start of errorfile/,/end of errorfile/-1w! Xerrorfile2 -:/start of testfile/,/end of testfile/w! Xtestfile -:set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m -:set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m -:cf Xerrorfile2 -:clast -:copen -:let a=w:quickfix_title -:wincmd p -lgR=a  -:cf Xerrorfile1 -grA -:cn -gRLINE 6, COL 19 -:cn -gRNO COLUMN SPECIFIED -:cn -gRAGAIN NO COLUMN -:cn -gRCOL 1 -:cn -gRCOL 2 -:cn -gRCOL 10 -:cn -gRVCOL 10 -:cn -grI -:cn -gR. SPACE POINTER -:cn -gR. DOT POINTER -:cn -gR. DASH POINTER -:cn -gR. TAB-SPACE POINTER -:clast -:cprev -:cprev -:wincmd w -:let a=w:quickfix_title -:wincmd p -lgR=a  -:w! test.out " Write contents of this file -:qa! -ENDTEST - -start of errorfile -"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. -"Xtestfile", line 6 col 19; this is an error -gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c -Xtestfile:9: parse error before `asd' -make: *** [vim] Error 1 -in file "Xtestfile" linenr 10: there is an error - -2 returned -"Xtestfile", line 11 col 1; this is an error -"Xtestfile", line 12 col 2; this is another error -"Xtestfile", line 14:10; this is an error in column 10 -=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time -"Xtestfile", linenr 16: yet another problem -Error in "Xtestfile" at line 17: -x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 - ^ -Error in "Xtestfile" at line 18: -x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 -.............^ -Error in "Xtestfile" at line 19: -x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 ---------------^ -Error in "Xtestfile" at line 20: -x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 - ^ - -Does anyone know what is the problem and how to correction it? -"Xtestfile", line 21 col 9: What is the title of the quickfix window? -"Xtestfile", line 22 col 9: What is the title of the quickfix window? -end of errorfile - -start of testfile - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22 -end of testfile diff --git a/src/testdir/test10.ok b/src/testdir/test10.ok deleted file mode 100644 index 76a02f40b4..0000000000 --- a/src/testdir/test10.ok +++ /dev/null @@ -1,23 +0,0 @@ -start of testfile - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 - xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx line 4 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5 - xxxxxxxxxxxxxxxxxLINE 6, COL 19 line 6 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8 - NO COLUMN SPECIFIEDxxxxxxxxxxx line 9 - AGAIN NO COLUMNxxxxxxxxxxxxxxx line 10 -COL 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11 - COL 2xxxxxxxxxxxxxxxxxxxxxxxxx line 12 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13 - xxxxxxxxCOL 10xxxxxxxxxxxxxxxx line 14 - xVCOL 10xxxxxxxxxxxxxxxxxxxxxx line 15 - Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16 - xxxx. SPACE POINTERxxxxxxxxxxx line 17 - xxxxx. DOT POINTERxxxxxxxxxxxx line 18 - xxxxxx. DASH POINTERxxxxxxxxxx line 19 - xxxxxxx. TAB-SPACE POINTERxxxx line 20 - xxxxxxxx:cf Xerrorfile1xxxxxxx line 21 - xxxxxxxx:cf Xerrorfile2xxxxxxx line 22 -end of testfile diff --git a/src/testdir/test100.in b/src/testdir/test100.in deleted file mode 100644 index 61d28c15f0..0000000000 --- a/src/testdir/test100.in +++ /dev/null @@ -1,50 +0,0 @@ -Tests for 'undolevel' and 'lispwords' settings being global-local - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo ul=5 -:fu! FillBuffer() - :for i in range(1,13) - :put=i - :exe "setg ul=" . &g:ul - :endfor -:endfu -:fu! UndoLevel() - :redir @a | setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |redir end - :$put a -:endfu -:new one -:0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' -:call FillBuffer() -:call feedkeys(":earlier 10\n", 't') -:call UndoLevel() -:%w! test.out -:new two -:0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' -:setlocal ul=2 -:call FillBuffer() -:call feedkeys(":earlier 10\n", 't') -:call UndoLevel() -:setlocal ul=10 -:call UndoLevel() -:%w >> test.out -:wincmd p -:redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end -:new three -:setglobal ul=50 -:1put ='global value should be changed to 50' -:2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' -:call UndoLevel() -:%w >> test.out -:"sleep 10 -:" -:" Testing 'lispwords' -:" -:setglobal lispwords=foo,bar,baz -:setlocal lispwords-=foo | setlocal lispwords+=quux -:redir >> test.out | echon "\nTesting 'lispwords' local value" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:setlocal lispwords< -:redir >> test.out | echon "\nTesting 'lispwords' value reset" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:qa! -ENDTEST - diff --git a/src/testdir/test100.ok b/src/testdir/test100.ok deleted file mode 100644 index 477106b8f2..0000000000 --- a/src/testdir/test100.ok +++ /dev/null @@ -1,51 +0,0 @@ -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) -1 -2 -3 -4 -5 -6 -7 - - - undolevels=5 global - undolevels=-123456 local -TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 - - - undolevels=5 global - undolevels=2 local - - undolevels=5 global - undolevels=10 local - -global value shouldn't be changed and still be 5! -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) - undolevels=5 global - undolevels=-123456 local - -global value should be changed to 50 -THREE: expecting global undolevels: 50, local undolevels: -123456 (default) - - undolevels=50 global - undolevels=-123456 local - -Testing 'lispwords' local value - lispwords=foo,bar,baz - lispwords=bar,baz,quux -bar,baz,quux - -Testing 'lispwords' value reset - lispwords=foo,bar,baz - lispwords=foo,bar,baz -foo,bar,baz diff --git a/src/testdir/test101.in b/src/testdir/test101.in deleted file mode 100644 index 04c934f2c5..0000000000 --- a/src/testdir/test101.in +++ /dev/null @@ -1,45 +0,0 @@ -Test for v:hlsearch vim: set ft=vim : - -STARTTEST -:" Last abc: Q -:so small.vim -:new -:call setline(1, repeat(['aaa'], 10)) -:set hlsearch nolazyredraw -:let r=[] -:command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch]) -/aaa -:AddR -:nohlsearch -:AddR -:let v:hlsearch=1 -:AddR -:let v:hlsearch=0 -:AddR -:set hlsearch -:AddR -:let v:hlsearch=0 -:AddR -n:AddR -:let v:hlsearch=0 -:AddR -/ -:AddR -:let r1=r[0][0] -:" I guess it is not guaranteed that screenattr outputs always the same character -:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")') -:try -: let v:hlsearch=[] -:catch -: call add(r, matchstr(v:exception,'^Vim(let):E\d\+:')) -:endtry -:bwipeout! -:$put=r -:call garbagecollect(1) -:" -:/^start:/,$wq! test.out -:" vim: et ts=4 isk-=\: -:call getchar() -ENDTEST - -start: diff --git a/src/testdir/test101.ok b/src/testdir/test101.ok deleted file mode 100644 index 3ed7436cf7..0000000000 --- a/src/testdir/test101.ok +++ /dev/null @@ -1,11 +0,0 @@ -start: -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -Vim(let):E706: diff --git a/src/testdir/test102.in b/src/testdir/test102.in deleted file mode 100644 index 35e9f6c2cf..0000000000 --- a/src/testdir/test102.in +++ /dev/null @@ -1,12 +0,0 @@ -Test if fnameescape is correct for special chars like ! - -STARTTEST -:%d -:let fname = 'Xspa ce' -:try | exe "w! " . fnameescape(fname) | put='Space' | endtry -:let fname = 'Xemark!' -:try | exe "w! " . fnameescape(fname) | put='ExclamationMark' | endtry -:w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test102.ok b/src/testdir/test102.ok deleted file mode 100644 index a25fea192c..0000000000 --- a/src/testdir/test102.ok +++ /dev/null @@ -1,3 +0,0 @@ - -Space -ExclamationMark diff --git a/src/testdir/test103.in b/src/testdir/test103.in deleted file mode 100644 index 7c7591e3b9..0000000000 --- a/src/testdir/test103.in +++ /dev/null @@ -1,37 +0,0 @@ -Test for visual mode not being reset causing E315 error. -STARTTEST -:so small.vim -:enew -:let g:msg="Everything's fine." -:function! TriggerTheProblem() -: " At this point there is no visual selection because :call reset it. -: " Let's restore the selection: -: normal gv -: '<,'>del _ -: try -: exe "normal \<Esc>" -: catch /^Vim\%((\a\+)\)\=:E315/ -: echom 'Snap! E315 error!' -: let g:msg='Snap! E315 error!' -: endtry -:endfunction -:enew -:setl buftype=nofile -:call append(line('$'), 'Delete this line.') -:" -:" -:" NOTE: this has to be done by a call to a function because executing :del the -:" ex-way will require the colon operator which resets the visual mode thus -:" preventing the problem: -:" -GV:call TriggerTheProblem() -:%del _ -:call append(line('$'), g:msg) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/testdir/test103.ok b/src/testdir/test103.ok deleted file mode 100644 index 9ea6dd6eea..0000000000 --- a/src/testdir/test103.ok +++ /dev/null @@ -1,2 +0,0 @@ - -Everything's fine. diff --git a/src/testdir/test104.in b/src/testdir/test104.in deleted file mode 100644 index fd847131e9..0000000000 --- a/src/testdir/test104.in +++ /dev/null @@ -1,30 +0,0 @@ -Tests for :let. vim: set ft=vim ts=8 : - -STARTTEST -:so small.vim -:set runtimepath+=./sautest -:" Test to not autoload when assigning. It causes internal error. -:try -: let Test104#numvar = function('tr') -: $put ='OK: ' . string(Test104#numvar) -:catch -: $put ='FAIL: ' . v:exception -:endtry -:let a = 1 -:let b = 2 -:for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}'] -: try -: redir => messages -: execute 'let' letargs -: redir END -: $put ='OK:' -: $put =split(substitute(messages, '\n', '\0 ', 'g'), '\n') -: catch -: $put ='FAIL: ' . v:exception -: redir END -: endtry -:endfor -:/^Results/,$wq! test.out -ENDTEST - -Results of test104: diff --git a/src/testdir/test104.ok b/src/testdir/test104.ok deleted file mode 100644 index 5fb20945c3..0000000000 --- a/src/testdir/test104.ok +++ /dev/null @@ -1,13 +0,0 @@ -Results of test104: -OK: function('tr') -OK: - a #1 - b #2 -OK: - b #2 -OK: - b #2 - a #1 -OK: - a #1 - b #2 diff --git a/src/testdir/test105.in b/src/testdir/test105.in deleted file mode 100644 index 58c4f84c0d..0000000000 --- a/src/testdir/test105.in +++ /dev/null @@ -1,45 +0,0 @@ -Test filename modifiers vim: set ft=vim : - -STARTTEST -:source small.vim -:%delete _ -:set shell=sh -:set shellslash -:let tab="\t" -:command -nargs=1 Put :let expr=<q-args> | $put =expr.tab.strtrans(string(eval(expr))) -:let $HOME=fnamemodify('.', ':p:h:h') -:Put fnamemodify('.', ':p' )[-1:] -:Put fnamemodify('.', ':p:h' )[-1:] -:Put fnamemodify('test.out', ':p' )[-1:] -:Put fnamemodify('test.out', ':.' ) -:Put fnamemodify('../testdir/a', ':.' ) -:Put fnamemodify('test.out', ':~' ) -:Put fnamemodify('../testdir/a', ':~' ) -:Put fnamemodify('../testdir/a', ':t' ) -:Put fnamemodify('.', ':p:t' ) -:Put fnamemodify('test.out', ':p:t' ) -:Put fnamemodify('test.out', ':p:e' ) -:Put fnamemodify('test.out', ':p:t:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r:r' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) -:Put substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '') -:Put fnamemodify('abc.fb2.tar.gz', ':e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:e:e') -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:r' ) -:Put fnamemodify('abc def', ':S' ) -:Put fnamemodify('abc" "def', ':S' ) -:Put fnamemodify('abc"%"def', ':S' ) -:Put fnamemodify('abc'' ''def', ':S' ) -:Put fnamemodify('abc''%''def', ':S' ) -:Put fnamemodify("abc\ndef", ':S' ) -:set shell=tcsh -:Put fnamemodify("abc\ndef", ':S' ) -:$put ='vim: ts=8' -:1 delete _ -:w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test105.ok b/src/testdir/test105.ok deleted file mode 100644 index 5f1de5f9e6..0000000000 --- a/src/testdir/test105.ok +++ /dev/null @@ -1,29 +0,0 @@ -fnamemodify('.', ':p' )[-1:] '/' -fnamemodify('.', ':p:h' )[-1:] 'r' -fnamemodify('test.out', ':p' )[-1:] 't' -fnamemodify('test.out', ':.' ) 'test.out' -fnamemodify('../testdir/a', ':.' ) 'a' -fnamemodify('test.out', ':~' ) '~/testdir/test.out' -fnamemodify('../testdir/a', ':~' ) '~/testdir/a' -fnamemodify('../testdir/a', ':t' ) 'a' -fnamemodify('.', ':p:t' ) '' -fnamemodify('test.out', ':p:t' ) 'test.out' -fnamemodify('test.out', ':p:e' ) 'out' -fnamemodify('test.out', ':p:t:e' ) 'out' -fnamemodify('abc.fb2.tar.gz', ':r' ) 'abc.fb2.tar' -fnamemodify('abc.fb2.tar.gz', ':r:r' ) 'abc.fb2' -fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) 'abc' -substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '') 'testdir/abc.fb2' -fnamemodify('abc.fb2.tar.gz', ':e' ) 'gz' -fnamemodify('abc.fb2.tar.gz', ':e:e' ) 'tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) 'fb2.tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:e:e') 'fb2.tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:r' ) 'tar' -fnamemodify('abc def', ':S' ) '''abc def''' -fnamemodify('abc" "def', ':S' ) '''abc" "def''' -fnamemodify('abc"%"def', ':S' ) '''abc"%"def''' -fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def''' -fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def''' -fnamemodify("abc\ndef", ':S' ) '''abc^@def''' -fnamemodify("abc\ndef", ':S' ) '''abc\^@def''' -vim: ts=8 diff --git a/src/testdir/test106.in b/src/testdir/test106.in deleted file mode 100644 index eb99e650ae..0000000000 --- a/src/testdir/test106.in +++ /dev/null @@ -1,16 +0,0 @@ -Tests for errorformat. vim: set ft=vim ts=8 : - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif -:set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%# -:cgetexpr ['WWWW', 'EEEE', 'CCCC'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:/^Results/,$wq! test.out -ENDTEST - -Results of test106: diff --git a/src/testdir/test106.ok b/src/testdir/test106.ok deleted file mode 100644 index 0a18cecf1c..0000000000 --- a/src/testdir/test106.ok +++ /dev/null @@ -1,4 +0,0 @@ -Results of test106: -[['W', 1], ['E^@CCCC', 1]] -[['W', 1], ['E^@CCCC', 1]] -[['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]] diff --git a/src/testdir/test107.in b/src/testdir/test107.in deleted file mode 100644 index 9143380f18..0000000000 --- a/src/testdir/test107.in +++ /dev/null @@ -1,38 +0,0 @@ -Tests for adjusting window and contents vim: set ft=vim : - -STARTTEST -:so small.vim -:new -:call setline(1, range(1,256)) -:let r=[] -:func! GetScreenStr(row) -: let str = "" -: for c in range(1,3) -: let str .= nr2char(screenchar(a:row, c)) -: endfor -: return str -:endfunc -: -:exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+" -:let s3=GetScreenStr(1) -:wincmd p -:call add(r, [line("w0"), s3]) -: -:exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+" -:let s3=GetScreenStr(1) -:wincmd p -:call add(r, [line("w0"), s3]) -: -:exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+" -:let s3=GetScreenStr(1) -::wincmd p -:call add(r, [line("w0"), s3]) -: -:bwipeout! -:$put=r -:call garbagecollect(1) -:" -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/testdir/test107.ok b/src/testdir/test107.ok deleted file mode 100644 index 3e0eda1fe7..0000000000 --- a/src/testdir/test107.ok +++ /dev/null @@ -1,4 +0,0 @@ -start: -[1, '1 '] -[50, '50 '] -[59, '59 '] diff --git a/src/testdir/test108.in b/src/testdir/test108.in new file mode 100644 index 0000000000..59c4dfc712 --- /dev/null +++ b/src/testdir/test108.in @@ -0,0 +1,88 @@ +Tests for backtrace debug commands. vim: set ft=vim : + +STARTTEST +:so small.vim +:lang mess C +:function! Foo() +: let var1 = 1 +: let var2 = Bar(var1) + 9 +: return var2 +:endfunction +: +:function! Bar(var) +: let var1 = 2 + a:var +: let var2 = Bazz(var1) + 4 +: return var2 +:endfunction +: +:function! Bazz(var) +: let var1 = 3 + a:var +: let var3 = "another var" +: return var1 +:endfunction +:new +:debuggreedy +:redir => out +:debug echo Foo() +step +step +step +step +step +step +echo "- show backtrace:\n" +backtrace +echo "\nshow variables on different levels:\n" +echo var1 +up +back +echo var1 +u +bt +echo var1 +echo "\n- undefined vars:\n" +step +frame 2 +echo "undefined var3 on former level:" +echo var3 +fr 0 +echo "here var3 is defined with \"another var\":" +echo var3 +step +step +step +up +echo "\nundefined var2 on former level" +echo var2 +down +echo "here var2 is defined with 10:" +echo var2 +echo "\n- backtrace movements:\n" +b +echo "\nnext command cannot go down, we are on bottom\n" +down +up +echo "\nnext command cannot go up, we are on top\n" +up +b +echo "fil is not frame or finish, it is file" +fil +echo "\n- relative backtrace movement\n" +fr -1 +frame +fra +1 +fram +echo "\n- go beyond limits does not crash\n" +fr 100 +fra +frame -40 +fram +echo "\n- final result 19:" +cont +:0debuggreedy +:redir END +:$put =out +:w! test.out +:qa! +ENDTEST + diff --git a/src/testdir/test108.ok b/src/testdir/test108.ok new file mode 100644 index 0000000000..6315edcc21 --- /dev/null +++ b/src/testdir/test108.ok @@ -0,0 +1,84 @@ + + + +- show backtrace: + + 2 function Foo[2] + 1 Bar[2] +->0 Bazz +line 2: let var3 = "another var" + +show variables on different levels: + +6 + 2 function Foo[2] +->1 Bar[2] + 0 Bazz +line 2: let var3 = "another var" +3 +->2 function Foo[2] + 1 Bar[2] + 0 Bazz +line 2: let var3 = "another var" +1 + +- undefined vars: + +undefined var3 on former level: +Error detected while processing function Foo[2]..Bar[2]..Bazz: +line 3: +E121: Undefined variable: var3 +E15: Invalid expression: var3 +here var3 is defined with "another var": +another var + +undefined var2 on former level +Error detected while processing function Foo[2]..Bar: +line 3: +E121: Undefined variable: var2 +E15: Invalid expression: var2 +here var2 is defined with 10: +10 + +- backtrace movements: + + 1 function Foo[2] +->0 Bar +line 3: End of function + +next command cannot go down, we are on bottom + +frame is zero + +next command cannot go up, we are on top + +frame at highest level: 1 +->1 function Foo[2] + 0 Bar +line 3: End of function +fil is not frame or finish, it is file +"[No Name]" --No lines in buffer-- + +- relative backtrace movement + + 1 function Foo[2] +->0 Bar +line 3: End of function +->1 function Foo[2] + 0 Bar +line 3: End of function + +- go beyond limits does not crash + +frame at highest level: 1 +->1 function Foo[2] + 0 Bar +line 3: End of function +frame is zero + 1 function Foo[2] +->0 Bar +line 3: End of function + +- final result 19: +19 + diff --git a/src/testdir/test10a.in b/src/testdir/test10a.in deleted file mode 100644 index 19e8652fe5..0000000000 --- a/src/testdir/test10a.in +++ /dev/null @@ -1,73 +0,0 @@ -Test for 'errorformat'. - -STARTTEST -:so small.vim -:/start of errorfile/,/end of errorfile/w! Xerrorfile -:/start of testfile/,/end of testfile/w! Xtestfile -:cf Xerrorfile -rA -:cn -rB -:cn -rC -:cn -rD -:cn -rE -:w! test.out " Write contents of this file -:qa! -ENDTEST - -start of errorfile - - printf(" %d \n", (number/other)%10 ); -..................^ -%CC-E-NOSEMI, Missing ";". -at line number 4 in file SYS$DISK:XTESTFILE - - other=10000000; -.............^ -%CC-E-UNDECLARED, In this statement, "oszt" is not declared. -at line number 7 in file SYS$DISK:XTESTFILE - - for (i = 0; i<7 ; i++ ){ -..................^ -%CC-E-UNDECLARED, In this statement, "i" is not declared. -at line number 16 in file SYS$DISK:XTESTFILE - -some other error somewhere here. -...........................^ -%CC-W-WARRING, Sorry, but no expalnation for such an warring. -at line number 19 in file SYS$DISK:XTESTFILE - -and finally some other error exactly here. -.....................................^ -%CC-I-INFORMATIONAL, It should be some informational message. -at line number 20 in file SYS$DISK:XTESTFILE - -Does anyone know what is the problem and how to correct ?? :) -end of errorfile - -start of testfile -01234567890123456789012345678901234567 -line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 8 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 10 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 12 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 13 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 14 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 15 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 16 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 17 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 18 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 19 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -end of testfile diff --git a/src/testdir/test10a.ok b/src/testdir/test10a.ok deleted file mode 100644 index 10e78c9239..0000000000 --- a/src/testdir/test10a.ok +++ /dev/null @@ -1,23 +0,0 @@ -start of testfile -01234567890123456789012345678901234567 -line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 4 xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx -line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 7 xxxxxBxxxxxxxxxxxxxxxxxxxxxxxx -line 8 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 10 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 12 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 13 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 14 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 15 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 16 xxxxxxxxxxCxxxxxxxxxxxxxxxxxxx -line 17 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 18 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 19 xxxxxxxxxxxxxxxxxxxDxxxxxxxxxx -line 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxE -line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -line 22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -end of testfile diff --git a/src/testdir/test11.in b/src/testdir/test11.in index 47de470a2d..9e9e257c1d 100644 --- a/src/testdir/test11.in +++ b/src/testdir/test11.in @@ -46,13 +46,13 @@ STARTTEST :w>>test.out " Append it to the output file :set shelltemp " need temp files here :au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t") -:au FilterReadPre *.out exe '!sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>")) -:au FilterReadPre *.out exe '!rm ' . shellescape(expand("<afile>")) . '.t' +:au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>")) +:au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand("<afile>")) . '.t' :au FilterReadPost *.out '[,']s/x/X/g :e! test.out " Edit the output file :23,$!cat :23,$s/\r$// " remove CR for when sed adds them -:au! FileReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>")) +:au! FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand("<afile>")) :au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>")) :au! FileReadPost *.gz '[,']s/l/L/ :$r Xtestfile.gz " Read compressed file diff --git a/src/testdir/test12.in b/src/testdir/test12.in deleted file mode 100644 index 46e9c45b80..0000000000 --- a/src/testdir/test12.in +++ /dev/null @@ -1,52 +0,0 @@ -Tests for 'directory' option. -- ".", in same dir as file -- "./dir", in directory relative to file -- "dir", in directory relative to current dir - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -:set dir=.,~ -:/start of testfile/,/end of testfile/w! Xtest1 -:" do an ls of the current dir to find the swap file (should not be there) -:if has("unix") -: !ls .X*.swp >test.out -:else -: r !ls X*.swp >test.out -:endif -:!echo first line >>test.out -:e Xtest1 -:if has("unix") -:" Do an ls of the current dir to find the swap file, remove the leading dot -:" to make the result the same for all systems. -: r!ls .X*.swp -: s/\.*X/X/ -: .w >>test.out -: undo -:else -: !ls X*.swp >>test.out -:endif -:!echo under Xtest1.swp >>test.out -:!mkdir Xtest2 -:set dir=./Xtest2,.,~ -:e Xtest1 -:!ls X*.swp >>test.out -:!echo under under >>test.out -:!ls Xtest2 >>test.out -:!echo under Xtest1.swp >>test.out -:!mkdir Xtest.je -:/start of testfile/,/end of testfile/w! Xtest2/Xtest3 -:set dir=Xtest.je,~ -:e Xtest2/Xtest3 -:swap -:!ls Xtest2 >>test.out -:!echo under Xtest3 >>test.out -:!ls Xtest.je >>test.out -:!echo under Xtest3.swp >>test.out -:qa! -ENDTEST - -start of testfile -line 2 Abcdefghij -line 3 Abcdefghij -end of testfile diff --git a/src/testdir/test12.ok b/src/testdir/test12.ok deleted file mode 100644 index 605623b117..0000000000 --- a/src/testdir/test12.ok +++ /dev/null @@ -1,10 +0,0 @@ -first line -Xtest1.swp -under Xtest1.swp -under under -Xtest1.swp -under Xtest1.swp -Xtest3 -under Xtest3 -Xtest3.swp -under Xtest3.swp diff --git a/src/testdir/test13.in b/src/testdir/test13.in deleted file mode 100644 index cb8a6fff89..0000000000 --- a/src/testdir/test13.in +++ /dev/null @@ -1,58 +0,0 @@ -Tests for autocommands on :close command - -Write three files and open them, each in a window. -Then go to next window, with autocommand that deletes the previous one. -Do this twice, writing the file. - -Also test deleting the buffer on a Unload event. If this goes wrong there -will be the ATTENTION prompt. - -Also test changing buffers in a BufDel autocommand. If this goes wrong there -are ml_line errors and/or a Crash. - -STARTTEST -:so small.vim -:/^start of testfile/,/^end of testfile/w! Xtestje1 -:/^start of testfile/,/^end of testfile/w! Xtestje2 -:/^start of testfile/,/^end of testfile/w! Xtestje3 -:e Xtestje1 -otestje1 -:w -:sp Xtestje2 -otestje2 -:w -:sp Xtestje3 -otestje3 -:w - -:au WinLeave Xtestje2 bwipe - -:w! test.out -:au WinLeave Xtestje1 bwipe Xtestje3 -:close -:w >>test.out -:e Xtestje1 -:bwipe Xtestje2 Xtestje3 test.out -:au! -:au! BufUnload Xtestje1 bwipe -:e Xtestje3 -:w >>test.out -:e Xtestje2 -:sp Xtestje1 -:e -:w >>test.out -:au! -:only -:e Xtestje1 -:bwipe Xtestje2 Xtestje3 test.out test13.in -:au BufWipeout Xtestje1 buf Xtestje1 -:bwipe -:w >>test.out -:qa! -ENDTEST - -start of testfile - contents - contents - contents -end of testfile diff --git a/src/testdir/test13.ok b/src/testdir/test13.ok deleted file mode 100644 index 0f1fc347a4..0000000000 --- a/src/testdir/test13.ok +++ /dev/null @@ -1,30 +0,0 @@ -start of testfile -testje1 - contents - contents - contents -end of testfile -start of testfile -testje1 - contents - contents - contents -end of testfile -start of testfile -testje3 - contents - contents - contents -end of testfile -start of testfile -testje2 - contents - contents - contents -end of testfile -start of testfile -testje1 - contents - contents - contents -end of testfile diff --git a/src/testdir/test14.in b/src/testdir/test14.in index fb987ebc88..3fc39fe4d9 100644 --- a/src/testdir/test14.in +++ b/src/testdir/test14.in @@ -6,6 +6,7 @@ Also test search() STARTTEST :so small.vim +:set belloff=all /Start cursor here vaBiBD:?Bug?,/Piece/-2w! test.out /^- Bug diff --git a/src/testdir/test15.in b/src/testdir/test15.in deleted file mode 100644 index 366529a550..0000000000 --- a/src/testdir/test15.in +++ /dev/null @@ -1,136 +0,0 @@ -Tests for :right on text with embedded TAB. -Also test formatting a paragraph. -Also test undo after ":%s" and formatting. - -STARTTEST -:so small.vim -:set tw=65 - -:/^\s*test for :left/,/^\s*test for :center/ left -:/^\s*test for :center/,/^\s*test for :right/ center -:/^\s*test for :right/,/^xxx/-1 right -:set fo+=tcroql tw=72 -/xxxxxxxx$ -0gq6kk -:set nocp viminfo+=nviminfo -:" undo/redo here to make the next undo only work on the following changes -u -:map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq -/^aa -ggu -:?test for :left?,$w! test.out -:qa! -ENDTEST - - test for :left - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf -asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx -xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx -xx xxxxxxx. xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx -> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/testdir/test15.ok b/src/testdir/test15.ok deleted file mode 100644 index bc09f5e7db..0000000000 --- a/src/testdir/test15.ok +++ /dev/null @@ -1,111 +0,0 @@ -test for :left -a a -fa a -dfa a -sdfa a -asdfa a -xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf - asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. -xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx -> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/testdir/test16.in b/src/testdir/test16.in deleted file mode 100644 index b2cd159a8c..0000000000 --- a/src/testdir/test16.in +++ /dev/null @@ -1,15 +0,0 @@ -Tests for resetting "secure" flag after GUI has started. -For KDE set a font, empty 'guifont' may cause a hang. - -STARTTEST -:if $DISPLAY == "" | e! test.ok | wq! test.out | endif -:set exrc secure -:if has("gui_kde") -: set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0 -:endif -:gui -f -:.,$w! test.out -:qa! -ENDTEST - - just some text diff --git a/src/testdir/test16.ok b/src/testdir/test16.ok deleted file mode 100644 index 25e2eea5c0..0000000000 --- a/src/testdir/test16.ok +++ /dev/null @@ -1,2 +0,0 @@ - - just some text diff --git a/src/testdir/test17.in b/src/testdir/test17.in index bc542c7625..59b57c2444 100644 --- a/src/testdir/test17.in +++ b/src/testdir/test17.in @@ -9,13 +9,7 @@ STARTTEST :else : set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} :endif -:function! DeleteDirectory(dir) -: if has("win16") || has("win32") || has("win64") || has("dos16") || has("dos32") -: exec "silent !rmdir /Q /S " . a:dir -: else -: exec "silent !rm -rf " . a:dir -: endif -:endfun +:" :if has("unix") :let $CDIR = "." /CDIR @@ -45,21 +39,21 @@ STARTTEST :" check for 'include' without \zs or \ze :lang C :call delete("./Xbase.a") -:call DeleteDirectory("Xdir1") +:call delete("Xdir1", "rf") :!mkdir Xdir1 :!mkdir "Xdir1/dir2" :e! Xdir1/dir2/foo.a -i#include "bar.a" +i#include "bar.a": :w :e Xdir1/dir2/bar.a -i#include "baz.a" +i#include "baz.a": :w :e Xdir1/dir2/baz.a -i#include "foo.a" +i#include "foo.a": :w :e Xbase.a :set path=Xdir1/dir2 -i#include <foo.a> +i#include <foo.a>: :w :redir! >>test.out :checkpath! @@ -70,7 +64,7 @@ ENDTEST STARTTEST :" check for 'include' with \zs and \ze :call delete("./Xbase.b") -:call DeleteDirectory("Xdir1") +:call delete("Xdir1", "rf") :!mkdir Xdir1 :!mkdir "Xdir1/dir2" :let &include='^\s*%inc\s*/\zs[^/]\+\ze' @@ -79,17 +73,17 @@ STARTTEST :endfunction :let &includeexpr='DotsToSlashes()' :e! Xdir1/dir2/foo.b -i%inc /bar/ +i%inc /bar/: :w :e Xdir1/dir2/bar.b -i%inc /baz/ +i%inc /baz/: :w :e Xdir1/dir2/baz.b -i%inc /foo/ +i%inc /foo/: :w :e Xbase.b :set path=Xdir1/dir2 -i%inc /foo/ +i%inc /foo/: :w :redir! >>test.out :checkpath! @@ -100,7 +94,7 @@ ENDTEST STARTTEST :" check for 'include' with \zs and no \ze :call delete("./Xbase.c") -:call DeleteDirectory("Xdir1") +:call delete("Xdir1", "rf") :!mkdir Xdir1 :!mkdir "Xdir1/dir2" :let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' @@ -112,20 +106,20 @@ STARTTEST :endfunction :let &includeexpr='StripNewlineChar()' :e! Xdir1/dir2/foo.c -i%inc bar.c +i%inc bar.c: :w :e Xdir1/dir2/bar.c -i%inc baz.c +i%inc baz.c: :w :e Xdir1/dir2/baz.c -i%inc foo.c +i%inc foo.c: :w :e Xdir1/dir2/FALSE.c -i%inc foo.c +i%inc foo.c: :w :e Xbase.c :set path=Xdir1/dir2 -i%inc FALSE.c foo.c +i%inc FALSE.c foo.c: :w :redir! >>test.out :checkpath! diff --git a/src/testdir/test18.in b/src/testdir/test18.in deleted file mode 100644 index 9bfd922344..0000000000 --- a/src/testdir/test18.in +++ /dev/null @@ -1,16 +0,0 @@ -Tests for not doing smart indenting when it isn't set. - -STARTTEST -:so small.vim -:set nocin nosi ai -/some -2cc#test -:?start?,$w! test.out -:qa! -ENDTEST - -start text - some test text - test text -test text - test text diff --git a/src/testdir/test18.ok b/src/testdir/test18.ok deleted file mode 100644 index e719713785..0000000000 --- a/src/testdir/test18.ok +++ /dev/null @@ -1,4 +0,0 @@ -start text - #test -test text - test text diff --git a/src/testdir/test19.in b/src/testdir/test19.in deleted file mode 100644 index aafa34e521..0000000000 --- a/src/testdir/test19.in +++ /dev/null @@ -1,33 +0,0 @@ -Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. -Also test that dv_ works correctly - -STARTTEST -:so small.vim -:set smarttab expandtab ts=8 sw=4 -:" make sure that backspace works, no matter what termcap is used -:set t_kD=x7f t_kb=x08 -/some -r :set noexpandtab -/other -r -:" Test replacing with Tabs and then backspacing to undo it -0wR  -:" Test replacing with Tabs -0wR  -:" Test that copyindent works with expandtab set -:set expandtab smartindent copyindent ts=8 sw=8 sts=8 -o{ -x:set nosol -/Second line/ -fwdv_:?^start?,$w! test.out -:qa! -ENDTEST - -start text - some test text -test text - other test text - a cde - f ghi -test text - Second line beginning with whitespace diff --git a/src/testdir/test19.ok b/src/testdir/test19.ok deleted file mode 100644 index 4146214919..0000000000 --- a/src/testdir/test19.ok +++ /dev/null @@ -1,10 +0,0 @@ -start text - ome test text -test text - ther test text - a cde - hi -test text -{ - x - with whitespace diff --git a/src/testdir/test2.in b/src/testdir/test2.in deleted file mode 100644 index b7b5a51066..0000000000 --- a/src/testdir/test2.in +++ /dev/null @@ -1,29 +0,0 @@ - -This is a test if a URL is recognized by "gf", with the cursor before and -after the "://". Also test ":\\". - -STARTTEST -:so small.vim -/^first -/tmp -:call append(0, expand("<cfile>")) -/^second -/URL -:call append(1, expand("<cfile>")) -:if has("ebcdic") -: set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ -:else -: set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ -:endif -/^third -/name -:call append(2, expand("<cfile>")) -/^fourth -/URL -:call append(3, expand("<cfile>")) -5GdG:wq! test.out -ENDTEST -first test for URL://machine.name/tmp/vimtest2a and other text -second test for URL://machine.name/tmp/vimtest2b. And other text -third test for URL:\\machine.name\vimtest2c and other text -fourth test for URL:\\machine.name\tmp\vimtest2d, and other text diff --git a/src/testdir/test2.ok b/src/testdir/test2.ok deleted file mode 100644 index 32978825f8..0000000000 --- a/src/testdir/test2.ok +++ /dev/null @@ -1,4 +0,0 @@ -URL://machine.name/tmp/vimtest2a -URL://machine.name/tmp/vimtest2b -URL:\\machine.name\vimtest2c -URL:\\machine.name\tmp\vimtest2d diff --git a/src/testdir/test20.in b/src/testdir/test20.in deleted file mode 100644 index 662a1439f2..0000000000 --- a/src/testdir/test20.in +++ /dev/null @@ -1,28 +0,0 @@ -Tests Blockwise Visual when there are TABs before the text. -First test for undo working properly when executing commands from a register. -Also test this in an empty buffer. - -STARTTEST -:so tiny.vim -G0"ay$k@au -:new -@auY:quit! -GP -/start here$ -"by$jjlld -/456$ -jj"bP -:/56$/,$-1w! test.out -:qa! -ENDTEST - -123456 -234567 -345678 - -test text test tex start here - some text - test text -test text - -OxjAykdd diff --git a/src/testdir/test20.ok b/src/testdir/test20.ok deleted file mode 100644 index 7c50ea8db8..0000000000 --- a/src/testdir/test20.ok +++ /dev/null @@ -1,10 +0,0 @@ -123start here56 -234start here67 -345start here78 - -test text test tex rt here - somext - tesext -test text - - diff --git a/src/testdir/test21.in b/src/testdir/test21.in deleted file mode 100644 index 491b9f7404..0000000000 --- a/src/testdir/test21.in +++ /dev/null @@ -1,19 +0,0 @@ -Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count - -STARTTEST -:so small.vim -/start -6[ :.w! test.out -?start here -6 :.w >>test.out -:qa! -ENDTEST - -#include test21.in - -/* test text test tex start here - some text - test text - start OK if found this line - start found wrong line -test text diff --git a/src/testdir/test21.ok b/src/testdir/test21.ok deleted file mode 100644 index d9f1b759ce..0000000000 --- a/src/testdir/test21.ok +++ /dev/null @@ -1,2 +0,0 @@ - start OK if found this line - start OK if found this line diff --git a/src/testdir/test22.in b/src/testdir/test22.in deleted file mode 100644 index f5cc046c6a..0000000000 --- a/src/testdir/test22.in +++ /dev/null @@ -1,13 +0,0 @@ -Tests for file with some lines ending in CTRL-M, some not - -STARTTEST -:set ta tx -:e! -:$-3,$w! test.out -:qa! -ENDTEST - -this lines ends in a -this one doesn't -this one does -and the last one doesn't diff --git a/src/testdir/test22.ok b/src/testdir/test22.ok deleted file mode 100644 index 38ff89eaf3..0000000000 --- a/src/testdir/test22.ok +++ /dev/null @@ -1,4 +0,0 @@ -this lines ends in a -this one doesn't -this one does -and the last one doesn't diff --git a/src/testdir/test23.in b/src/testdir/test23.in deleted file mode 100644 index 0e0e605531..0000000000 --- a/src/testdir/test23.in +++ /dev/null @@ -1,15 +0,0 @@ -Tests for complicated + argument to :edit command - -STARTTEST -:$-1w! Xfile1 -:$w! Xfile2 -:edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w -:w! test.out -:e Xfile1 -:w >> test.out -:qa! -ENDTEST - -The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" -foo|bar -foo/bar diff --git a/src/testdir/test23.ok b/src/testdir/test23.ok deleted file mode 100644 index f1930abad6..0000000000 --- a/src/testdir/test23.ok +++ /dev/null @@ -1,2 +0,0 @@ -fooSLASHbar -fooPIPEbar diff --git a/src/testdir/test24.in b/src/testdir/test24.in deleted file mode 100644 index 7dfc1afdc6..0000000000 Binary files a/src/testdir/test24.in and /dev/null differ diff --git a/src/testdir/test24.ok b/src/testdir/test24.ok deleted file mode 100644 index cd61210968..0000000000 --- a/src/testdir/test24.ok +++ /dev/null @@ -1,32 +0,0 @@ -start -test text test text -test text test text -test text test text -test text test text -test text test text -test text test text -test text test text x61 -test text test text x60-x64 -test text test text x78 5 -test text test text o143 -test text test text o140-o144 -test text test text o41 7 -test text test text \%x42 -test text test text \%o103 -test text test text [\x00] -test text test text [\x00-\x10] -test text test text [\x-z] -test text test text [\u-z] -xx xx a -xx aaaaa xx a -xx aaaaa xx a -xx Aaa xx -xx Aaaa xx -xx Aaa xx -xx foobar xA xx -xx an A xx -XX 9; -YY 77; - xyz - bcd - BB diff --git a/src/testdir/test25.in b/src/testdir/test25.in deleted file mode 100644 index 4139865daf..0000000000 --- a/src/testdir/test25.in +++ /dev/null @@ -1,31 +0,0 @@ -Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag. -This only works for Unix, because of the symbolic link. - -STARTTEST -:so small.vim -:set hidden -:" Create a link from test25.dir to the current directory. -:!rm -f test25.dir -:!ln -s . test25.dir -:" Create tags.text, with the current directory name inserted. -/tags line -:r !pwd -d$/test -hP:.w! tags.test -:" Try jumping to a tag in the current file, but with a path that contains a -:" symbolic link. When wrong, this will give the ATTENTION message. The next -:" space will then be eaten by hit-return, instead of moving the cursor to 'd'. -:set tags=tags.test -G x:.w! test.out -:!rm -f test25.dir tags.test -:qa! -ENDTEST - -tags line: -SECTION_OFF /test25.dir/test25.in /^#define SECTION_OFF 3$/ - -/*tx.c*/ -#define SECTION_OFF 3 -#define NUM_SECTIONS 3 - -SECTION_OFF diff --git a/src/testdir/test25.ok b/src/testdir/test25.ok deleted file mode 100644 index 08fc070b7b..0000000000 --- a/src/testdir/test25.ok +++ /dev/null @@ -1 +0,0 @@ -#efine SECTION_OFF 3 diff --git a/src/testdir/test26.in b/src/testdir/test26.in deleted file mode 100644 index e7cd757661..0000000000 --- a/src/testdir/test26.in +++ /dev/null @@ -1,44 +0,0 @@ -Test for :execute, :while and :if - -STARTTEST -:so small.vim -mt:let i = 0 -:while i < 12 -: let i = i + 1 -: if has("ebcdic") -: execute "normal o" . i . "\047" -: else -: execute "normal o" . i . "\033" -: endif -: if i % 2 -: normal Ax -: if i == 9 -: break -: endif -: if i == 5 -: continue -: else -: let j = 9 -: while j > 0 -: if has("ebcdic") -: execute "normal" j . "a" . j . "\x27" -: else -: execute "normal" j . "a" . j . "\x1b" -: endif -: let j = j - 1 -: endwhile -: endif -: endif -: if i == 9 -: if has("ebcdic") -: execute "normal Az\047" -: else -: execute "normal Az\033" -: endif -: endif -:endwhile -:unlet i j -:'t,$w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test26.ok b/src/testdir/test26.ok deleted file mode 100644 index bc44761187..0000000000 --- a/src/testdir/test26.ok +++ /dev/null @@ -1,10 +0,0 @@ - -1x999999999888888887777777666666555554444333221 -2 -3x999999999888888887777777666666555554444333221 -4 -5x -6 -7x999999999888888887777777666666555554444333221 -8 -9x diff --git a/src/testdir/test27.in b/src/testdir/test27.in deleted file mode 100644 index 2df16d9eff..0000000000 --- a/src/testdir/test27.in +++ /dev/null @@ -1,20 +0,0 @@ -Test for expanding file names - -STARTTEST -:!mkdir Xdir1 -:!mkdir Xdir2 -:!mkdir Xdir3 -:cd Xdir3 -:!mkdir Xdir4 -:cd .. -:w Xdir1/file -:w Xdir3/Xdir4/file -:n Xdir?/*/file -Go%:.w! test.out -:n! Xdir?/*/nofile -Go%:.w >>test.out -:e! xx -:!rm -rf Xdir1 Xdir2 Xdir3 -:qa! -ENDTEST - diff --git a/src/testdir/test27.ok b/src/testdir/test27.ok deleted file mode 100644 index c35f2438a9..0000000000 --- a/src/testdir/test27.ok +++ /dev/null @@ -1,2 +0,0 @@ -Xdir3/Xdir4/file -Xdir?/*/nofile diff --git a/src/testdir/test28.in b/src/testdir/test28.in deleted file mode 100644 index 5542c92666..0000000000 Binary files a/src/testdir/test28.in and /dev/null differ diff --git a/src/testdir/test28.ok b/src/testdir/test28.ok deleted file mode 100644 index 911d854655..0000000000 --- a/src/testdir/test28.ok +++ /dev/null @@ -1,2 +0,0 @@ -sd -map __2 asdsecondsdsd0map __5 asd0fifth diff --git a/src/testdir/test29.in b/src/testdir/test29.in index 1d6cb6f4d1..366a551a26 100644 --- a/src/testdir/test29.in +++ b/src/testdir/test29.in @@ -103,6 +103,7 @@ if (condition) // Remove the next comment leader! STARTTEST :" Test with backspace set to the non-compatible setting +:set belloff=all /^\d\+ this :set cp bs=2 Avim1 @@ -113,12 +114,12 @@ Avim3 :iunmap <c-u> Avim4 :" Test with backspace set to the compatible setting -:set bs= +:set backspace= visualbell A vim5A A vim6Azweiu :inoremap <c-u> <left><c-u> A vim7 -:set cp +:set compatible novisualbell ENDTEST 1 this shouldn't be deleted 2 this shouldn't be deleted diff --git a/src/testdir/test3.in b/src/testdir/test3.in index de86700380..646fbb35c3 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1,6 +1,7 @@ /* vim: set cin ts=4 sw=4 : */ -Test for 'cindent' +Test for 'cindent'. +For new tests, consider putting them in test_cindent.vim. STARTTEST :so small.vim @@ -464,6 +465,14 @@ label: if (asdf && asdfasdf } +{ +for ( int i = 0; + i < 10; i++ ) +{ +} + i = 0; +} + class bob { int foo() {return 1;} @@ -655,6 +664,13 @@ Constructor::Constructor(int a, { } +A::A(int a, int b) +: aa(a), +bb(b), +cc(c) +{ +} + class CAbc : public BaseClass1, protected BaseClass2 @@ -883,10 +899,79 @@ namespace111111111 111111111111111111; } +void getstring() { +/* Raw strings */ +const char* s = R"( + test { + # comment + field: 123 + } + )"; + } + +void getstring() { +const char* s = R"foo( + test { + # comment + field: 123 + } + )foo"; + } + +{ +int a[4] = { +[0] = 0, +[1] = 1, +[2] = 2, +[3] = 3, +}; +} + +{ +a = b[2] ++ 3; +} + +{ +if (1) +/* aaaaa +* bbbbb +*/ +a = 1; +} + +void func() +{ +switch (foo) +{ +case (bar): +if (baz()) +quux(); +break; +case (shmoo): +if (!bar) +{ +} +case (foo1): +switch (bar) +{ +case baz: +baz_f(); +break; +} +break; +default: +baz(); +baz(); +break; +} +} + /* end of AUTO */ STARTTEST -:set tw=0 wm=60 columns=80 noai fo=croq +:set tw=0 noai fo=croq +:let &wm = &columns - 20 /serious/e a about life, the universe, and the rest ENDTEST @@ -1849,6 +1934,26 @@ namespace test { 111111111111111111; } +namespace test::cpp17 +{ + 111111111111111111; +} +namespace ::incorrectcpp17 +{ + 111111111111111111; +} +namespace test::incorrectcpp17:: +{ + 111111111111111111; +} +namespace test:incorrectcpp17 +{ + 111111111111111111; +} +namespace test:::incorrectcpp17 +{ + 111111111111111111; +} namespace{ 111111111111111111; } @@ -2056,6 +2161,193 @@ return true; })(jQuery); JSEND +STARTTEST +:set cino=j1,J1,+2 +/^JSSTART +=/^JSEND +ENDTEST + +JSSTART +// Results of JavaScript indent +// 1 +(function(){ +var a = [ +'a', +'b', +'c', +'d', +'e', +'f', +'g', +'h', +'i' +]; +}()) + +// 2 +(function(){ +var a = [ +0 + +5 * +9 * +'a', +'b', +0 + +5 * +9 * +'c', +'d', +'e', +'f', +'g', +'h', +'i' +]; +}()) + +// 3 +(function(){ +var a = [ +0 + +// comment 1 +5 * +/* comment 2 */ +9 * +'a', +'b', +0 + +5 * +9 * +'c', +'d', +'e', +'f', +'g', +'h', +'i' +]; +}()) + +// 4 +{ +var a = [ +0, +1 +]; +var b; +var c; +} + +// 5 +{ +var a = [ +[ +0 +], +2, +3 +]; +} + +// 6 +{ +var a = [ +[ +0, +1 +], +2, +3 +]; +} + +// 7 +{ +var a = [ +// [ +0, +// 1 +// ], +2, +3 +]; +} + +// 8 +var x = [ +(function(){ +var a, +b, +c, +d, +e, +f, +g, +h, +i; +}) +]; + +// 9 +var a = [ +0 + +5 * +9 * +'a', +'b', +0 + +5 * +9 * +'c', +'d', +'e', +'f', +'g', +'h', +'i' +]; + +// 10 +var a, +b, +c, +d, +e, +f, +g, +h, +i; +JSEND + +STARTTEST +:set cin cino& +/start of define +=/end of define +ENDTEST + +/* start of define */ +{ +} +#define AAA \ +BBB\ +CCC + +#define CNT \ +1 + \ +2 + \ +4 +/* end of define */ + +STARTTEST +:set cin cino& +/a = second +ox +ENDTEST + +{ + a = second/*bug*/*line; +} + STARTTEST :g/^STARTTEST/.,/^ENDTEST/d :1;/start of AUTO/,$wq! test.out diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 0d0e76fce4..035ea39999 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -452,6 +452,14 @@ label: if (asdf && asdfasdf } +{ + for ( int i = 0; + i < 10; i++ ) + { + } + i = 0; +} + class bob { int foo() {return 1;} @@ -643,6 +651,13 @@ Constructor::Constructor(int a, { } +A::A(int a, int b) + : aa(a), + bb(b), + cc(c) +{ +} + class CAbc : public BaseClass1, protected BaseClass2 @@ -871,6 +886,74 @@ namespace111111111 111111111111111111; } +void getstring() { + /* Raw strings */ + const char* s = R"( + test { + # comment + field: 123 + } + )"; +} + +void getstring() { + const char* s = R"foo( + test { + # comment + field: 123 + } + )foo"; +} + +{ + int a[4] = { + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 3, + }; +} + +{ + a = b[2] + + 3; +} + +{ + if (1) + /* aaaaa + * bbbbb + */ + a = 1; +} + +void func() +{ + switch (foo) + { + case (bar): + if (baz()) + quux(); + break; + case (shmoo): + if (!bar) + { + } + case (foo1): + switch (bar) + { + case baz: + baz_f(); + break; + } + break; + default: + baz(); + baz(); + break; + } +} + /* end of AUTO */ @@ -1647,6 +1730,26 @@ namespace test { 111111111111111111; } +namespace test::cpp17 +{ +111111111111111111; +} +namespace ::incorrectcpp17 +{ + 111111111111111111; +} +namespace test::incorrectcpp17:: +{ + 111111111111111111; +} +namespace test:incorrectcpp17 +{ + 111111111111111111; +} +namespace test:::incorrectcpp17 +{ + 111111111111111111; +} namespace{ 111111111111111111; } @@ -1824,3 +1927,176 @@ JSSTART })(jQuery); JSEND + +JSSTART +// Results of JavaScript indent +// 1 +(function(){ + var a = [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i' + ]; +}()) + +// 2 +(function(){ + var a = [ + 0 + + 5 * + 9 * + 'a', + 'b', + 0 + + 5 * + 9 * + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i' + ]; +}()) + +// 3 +(function(){ + var a = [ + 0 + + // comment 1 + 5 * + /* comment 2 */ + 9 * + 'a', + 'b', + 0 + + 5 * + 9 * + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i' + ]; +}()) + +// 4 +{ + var a = [ + 0, + 1 + ]; + var b; + var c; +} + +// 5 +{ + var a = [ + [ + 0 + ], + 2, + 3 + ]; +} + +// 6 +{ + var a = [ + [ + 0, + 1 + ], + 2, + 3 + ]; +} + +// 7 +{ + var a = [ + // [ + 0, + // 1 + // ], + 2, + 3 + ]; +} + +// 8 +var x = [ + (function(){ + var a, + b, + c, + d, + e, + f, + g, + h, + i; + }) +]; + +// 9 +var a = [ + 0 + + 5 * + 9 * + 'a', + 'b', + 0 + + 5 * + 9 * + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i' +]; + +// 10 +var a, + b, + c, + d, + e, + f, + g, + h, + i; +JSEND + + +/* start of define */ +{ +} +#define AAA \ + BBB\ + CCC + +#define CNT \ + 1 + \ + 2 + \ + 4 +/* end of define */ + + +{ + a = second/*bug*/*line; + x +} + diff --git a/src/testdir/test30.in b/src/testdir/test30.in index 4a8778d2de..df494048ed 100644 --- a/src/testdir/test30.in +++ b/src/testdir/test30.in @@ -4,40 +4,37 @@ Note: This test will fail if "cat" is not available. STARTTEST :so small.vim +:set belloff=all :" first write three test files, one in each format :set fileformat=unix :set fileformats= -:/^1/w! XX1 -:/^2/w! XX2 -:/^3/w! XX3 -:/^4/w! XX4 -:/^5/w! XX5 -:/^6/w! XX6 -:/^7/w! XX7 -:/^8/w! XX8 -:/^9/w! XX9 -:/^10/w! XX10 :/^unix/;/eof/-1w! XXUnix :/^dos/;/eof/-1w! XXDos :set bin noeol :$w! XXMac +Gonoeol +:$w! XXEol :set nobin eol +:enew! :bwipe XXUnix XXDos XXMac :" create mixed format files :if has("vms") : !copy XXUnix,XXDos XXUxDs. : !copy XXUnix,XXMac XXUxMac. : !copy XXDos,XXMac XXDosMac. +: !copy XXMac,XXEol XXMacEol. : !copy XXUnix,XXDos,XXMac XXUxDsMc. :elseif has("win32") : !copy /b XXUnix+XXDos XXUxDs : !copy /b XXUnix+XXMac XXUxMac : !copy /b XXDos+XXMac XXDosMac +: !copy /b XXMac+XXEol XXMacEol : !copy /b XXUnix+XXDos+XXMac XXUxDsMc :else : !cat XXUnix XXDos >XXUxDs : !cat XXUnix XXMac >XXUxMac : !cat XXDos XXMac >XXDosMac +: !cat XXMac XXEol >XXMacEol : !cat XXUnix XXDos XXMac >XXUxDsMc :endif :" @@ -102,26 +99,48 @@ STARTTEST :e! XXDosMac :w! XXtt53 :bwipe XXDosMac +:e! XXEol +ggO=&ffs +:=&ff +:w! XXtt54 +:bwipe XXEol :set fileformats=dos,mac :e! XXUxDs :w! XXtt61 :bwipe XXUxDs :e! XXUxMac -:w! XXtt62 +ggO=&ffs +:=&ff +:w! XXtt62 :bwipe XXUxMac :e! XXUxDsMc :w! XXtt63 :bwipe XXUxDsMc +:e! XXMacEol +ggO=&ffs +:=&ff +:w! XXtt64 +:bwipe XXMacEol :" :" try reading and writing with 'fileformats' set to three formats :set fileformats=unix,dos,mac :e! XXUxDsMc :w! XXtt71 :bwipe XXUxDsMc +:e! XXEol +ggO=&ffs +:=&ff +:w! XXtt72 +:bwipe XXEol :set fileformats=mac,dos,unix :e! XXUxDsMc :w! XXtt81 :bwipe XXUxDsMc +:e! XXEol +ggO=&ffs +:=&ff +:w! XXtt82 +:bwipe XXEol :" try with 'binary' set :set fileformats=mac,unix,dos :set binary @@ -155,11 +174,15 @@ ggdGaEND:w >>XXtt01 :w >>XXtt51 :w >>XXtt52 :w >>XXtt53 +:w >>XXtt54 :w >>XXtt61 :w >>XXtt62 :w >>XXtt63 +:w >>XXtt64 :w >>XXtt71 +:w >>XXtt72 :w >>XXtt81 +:w >>XXtt82 :w >>XXtt91 :w >>XXtt92 :w >>XXtt93 @@ -186,11 +209,15 @@ Go4:$r XXtt41 Go5:$r XXtt51 :$r XXtt52 :$r XXtt53 +:$r XXtt54 Go6:$r XXtt61 :$r XXtt62 :$r XXtt63 +:$r XXtt64 Go7:$r XXtt71 +:$r XXtt72 Go8:$r XXtt81 +:$r XXtt82 Go9:$r XXtt91 :$r XXtt92 :$r XXtt93 @@ -200,17 +227,6 @@ Go10:$r XXUnix :qa! ENDTEST -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 - unix unix eof diff --git a/src/testdir/test30.ok b/src/testdir/test30.ok index 380ce67061..b35f4f5904 100644 --- a/src/testdir/test30.ok +++ b/src/testdir/test30.ok @@ -70,12 +70,16 @@ END dos dos mac mac END +unix,mac:unix +noeol +END 6 unix unix dos dos END +dos,mac:dos unix unix mac mac @@ -86,6 +90,7 @@ dos dos mac mac END +dos,mac:mac mac mac noeol END 7 unix unix @@ -93,6 +98,9 @@ dos dos mac mac END +unix,dos,mac:unix +noeol +END 8 unix unix @@ -100,6 +108,7 @@ dos dos mac mac END +mac,dos,unix:mac noeol END 9 unix unix diff --git a/src/testdir/test31.in b/src/testdir/test31.in deleted file mode 100644 index 7dc2334781..0000000000 --- a/src/testdir/test31.in +++ /dev/null @@ -1,75 +0,0 @@ -Test for commands that close windows and/or buffers: -:quit -:close -:hide -:only -:sall -:all -:ball -:buf -:edit - -STARTTEST -:so tiny.vim -GA 1:$w! Xtest1 -$r2:$w! Xtest2 -$r3:$w! Xtest3 -:n! Xtest1 Xtest2 -A 1:set hidden -:" test for working :n when hidden set; write "testtext 2" -:n -:w! test.out -:" test for failing :rew when hidden not set; write "testtext 2 2" -:set nohidden -A 2:rew -:w >>test.out -:" test for working :rew when hidden set; write "testtext 1 1" -:set hidden -:rew -:w >>test.out -:" test for :all keeping a buffer when it's modified; write "testtext 1 1 1" -:set nohidden -A 1:sp -:n Xtest2 Xtest3 -:all -:1wincmd w -:w >>test.out -:" test abandoning changed buffer, should be unloaded even when 'hidden' set -:" write "testtext 2 2" twice -:set hidden -A 1:q! -:w >>test.out -:unhide -:w >>test.out -:" test ":hide" hides anyway when 'hidden' not set; write "testtext 3" -:set nohidden -A 2:hide -:w >>test.out -:" test ":edit" failing in modified buffer when 'hidden' not set -:" write "testtext 3 3" -A 3:e Xtest1 -:w >>test.out -:" test ":edit" working in modified buffer when 'hidden' set; write "testtext 1" -:set hidden -:e Xtest1 -:w >>test.out -:" test ":close" not hiding when 'hidden' not set in modified buffer; -:" write "testtext 3 3 3" -:sp Xtest3 -:set nohidden -A 3:close -:w >>test.out -:" test ":close!" does hide when 'hidden' not set in modified buffer; -:" write "testtext 1" -A 3:close! -:w >>test.out -:set nohidden -:" test ":all!" hides changed buffer; write "testtext 2 2 2" -:sp Xtest4 -GA 4:all! -:1wincmd w -:w >>test.out -:qa! -ENDTEST - -testtext diff --git a/src/testdir/test31.ok b/src/testdir/test31.ok deleted file mode 100644 index 185bdc768e..0000000000 --- a/src/testdir/test31.ok +++ /dev/null @@ -1,12 +0,0 @@ -testtext 2 -testtext 2 2 -testtext 1 1 -testtext 1 1 1 -testtext 2 2 -testtext 2 2 -testtext 3 -testtext 3 3 -testtext 1 -testtext 3 3 3 -testtext 1 -testtext 2 2 2 diff --git a/src/testdir/test32.in b/src/testdir/test32.in deleted file mode 100644 index 6b399fa6c6..0000000000 --- a/src/testdir/test32.in +++ /dev/null @@ -1,60 +0,0 @@ -Test for insert expansion - -:se cpt=.,w -* add-expands (word from next line) from other window -* add-expands (current buffer first) -* Local expansion, ends in an empty line (unless it becomes a global expansion) -* starts Local and switches to global add-expansion -:se cpt=.,w,i -* i-add-expands and switches to local -* add-expands lines (it would end in an empty line if it didn't ignored it self) -:se cpt=kXtestfile -* checks k-expansion, and file expansion (use Xtest11 instead of test11, -* because TEST11.OUT may match first on DOS) -:se cpt=w -* checks make_cyclic in other window -:se cpt=u nohid -* checks unloaded buffer expansion -* checks adding mode abortion -:se cpt=t,d -* tag expansion, define add-expansion interrupted -* t-expansion - -STARTTEST -:so small.vim -:se nocp viminfo+=nviminfo cpt=.,w ff=unix | $-2,$w!Xtestfile | set ff& -:se cot= -nO#include "Xtestfile" -ru -O - - -:se cpt=.,w,i -kOM -   -:se cpt=kXtestfile -:w Xtest11.one -:w Xtest11.two -OIXA -:" use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use -:" CTRL-X CTRL-F again to verify this doesn't cause trouble. -OXddk -:se cpt=w -OST -:se cpt=u nohid -oOEN -unl -:se cpt=t,d def=^\\k* tags=Xtestfile notagbsearch -O -a -:wq! test.out -ENDTEST - -start of testfile -run1 -run2 -end of testfile - -test11 36Gepeto /Tag/ -asd test11file 36G -Makefile to run diff --git a/src/testdir/test32.ok b/src/testdir/test32.ok deleted file mode 100644 index afc4463fac..0000000000 --- a/src/testdir/test32.ok +++ /dev/null @@ -1,15 +0,0 @@ -#include "Xtestfile" -run1 run3 -run3 run3 - -Makefile to run3 -Makefile to run3 -Makefile to run3 -Xtest11.two -STARTTEST -ENDTEST -unless -test11file 36Gepeto /Tag/ asd -asd -run1 run2 - diff --git a/src/testdir/test33.in b/src/testdir/test33.in deleted file mode 100644 index 5644760402..0000000000 --- a/src/testdir/test33.in +++ /dev/null @@ -1,34 +0,0 @@ -Test for 'lisp' -If the lisp feature is not enabled, this will fail! - -STARTTEST -:so small.vim -:set lisp -/^(defun -=G:/^(defun/,$w! test.out -:q! -ENDTEST - -(defun html-file (base) -(format nil "~(~A~).html" base)) - -(defmacro page (name title &rest body) -(let ((ti (gensym))) -`(with-open-file (*standard-output* -(html-file ,name) -:direction :output -:if-exists :supersede) -(let ((,ti ,title)) -(as title ,ti) -(with center -(as h2 (string-upcase ,ti))) -(brs 3) -,@body)))) - -;;; Utilities for generating links - -(defmacro with-link (dest &rest body) -`(progn -(format t "<a href=\"~A\">" (html-file ,dest)) -,@body -(princ "</a>"))) diff --git a/src/testdir/test33.ok b/src/testdir/test33.ok deleted file mode 100644 index cd1d87a14b..0000000000 --- a/src/testdir/test33.ok +++ /dev/null @@ -1,23 +0,0 @@ -(defun html-file (base) - (format nil "~(~A~).html" base)) - -(defmacro page (name title &rest body) - (let ((ti (gensym))) - `(with-open-file (*standard-output* - (html-file ,name) - :direction :output - :if-exists :supersede) - (let ((,ti ,title)) - (as title ,ti) - (with center - (as h2 (string-upcase ,ti))) - (brs 3) - ,@body)))) - -;;; Utilities for generating links - -(defmacro with-link (dest &rest body) - `(progn - (format t "<a href=\"~A\">" (html-file ,dest)) - ,@body - (princ "</a>"))) diff --git a/src/testdir/test34.in b/src/testdir/test34.in deleted file mode 100644 index 71ee5f63b2..0000000000 --- a/src/testdir/test34.in +++ /dev/null @@ -1,87 +0,0 @@ -Test for user functions. -Also test an <expr> mapping calling a function. -Also test that a builtin function cannot be replaced. -Also test for regression when calling arbitrary expression. - -STARTTEST -:so small.vim -:function Table(title, ...) -: let ret = a:title -: let idx = 1 -: while idx <= a:0 -: exe "let ret = ret . a:" . idx -: let idx = idx + 1 -: endwhile -: return ret -:endfunction -:function Compute(n1, n2, divname) -: if a:n2 == 0 -: return "fail" -: endif -: exe "let g:" . a:divname . " = ". a:n1 / a:n2 -: return "ok" -:endfunction -:func Expr1() -: normal! v -: return "111" -:endfunc -:func Expr2() -: call search('XX', 'b') -: return "222" -:endfunc -:func ListItem() -: let g:counter += 1 -: return g:counter . '. ' -:endfunc -:func ListReset() -: let g:counter = 0 -: return '' -:endfunc -:func FuncWithRef(a) -: unlet g:FuncRef -: return a:a -:endfunc -:let g:FuncRef=function("FuncWithRef") -:let counter = 0 -:inoremap <expr> ( ListItem() -:inoremap <expr> [ ListReset() -:imap <expr> + Expr1() -:imap <expr> * Expr2() -:let retval = "nop" -/^here -C=Table("xxx", 4, "asdf") - =Compute(45, 0, "retval") - =retval - =Compute(45, 5, "retval") - =retval - =g:FuncRef(333) - -XX+-XX ----*--- -(one -(two -[(one again:call append(line('$'), max([1, 2, 3])) -:call extend(g:, {'max': function('min')}) -:call append(line('$'), max([1, 2, 3])) -:try -: " Regression: the first line below used to throw ?E110: Missing ')'? -: " Second is here just to prove that this line is correct when not skipping -: " rhs of &&. -: $put =(0&&(function('tr'))(1, 2, 3)) -: $put =(1&&(function('tr'))(1, 2, 3)) -:catch -: $put ='!!! Unexpected exception:' -: $put =v:exception -:endtry -:$-9,$w! test.out -:delfunc Table -:delfunc Compute -:delfunc Expr1 -:delfunc Expr2 -:delfunc ListItem -:delfunc ListReset -:unlet retval counter -:q! -ENDTEST - -here diff --git a/src/testdir/test34.ok b/src/testdir/test34.ok deleted file mode 100644 index 97995de80e..0000000000 --- a/src/testdir/test34.ok +++ /dev/null @@ -1,10 +0,0 @@ -xxx4asdf fail nop ok 9 333 -XX111-XX ----222--- -1. one -2. two -1. one again -3 -3 -0 -1 diff --git a/src/testdir/test35.in b/src/testdir/test35.in deleted file mode 100644 index ba97911a1d..0000000000 --- a/src/testdir/test35.in +++ /dev/null @@ -1,21 +0,0 @@ -Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal, -and octal numbers. - -STARTTEST -/^start-here -:set nrformats=octal,hex -j102ll64128$ -:set nrformats=octal -0102l2w65129blx6lD -:set nrformats=hex -0101l257Txldt    -:set nrformats= -0200l100w78k -:$-3,$wq! test.out -ENDTEST - -start-here -100 0x100 077 0 -100 0x100 077 -100 0x100 077 0xfF 0xFf -100 0x100 077 diff --git a/src/testdir/test35.ok b/src/testdir/test35.ok deleted file mode 100644 index 093ad958ac..0000000000 --- a/src/testdir/test35.ok +++ /dev/null @@ -1,4 +0,0 @@ -0 0x0ff 0000 -1 -0 1x100 0777777 --1 0x0 078 0xFE 0xfe --100 -100x100 000 diff --git a/src/testdir/test36.in b/src/testdir/test36.in deleted file mode 100644 index 8cdb5262bd..0000000000 --- a/src/testdir/test36.in +++ /dev/null @@ -1,105 +0,0 @@ -Test character classes in regexp using regexpengine 0, 1, 2. - -STARTTEST -/^start-here/+1 -Y:s/\%#=0\d//g -p:s/\%#=1\d//g -p:s/\%#=2\d//g -p:s/\%#=0[0-9]//g -p:s/\%#=1[0-9]//g -p:s/\%#=2[0-9]//g -p:s/\%#=0\D//g -p:s/\%#=1\D//g -p:s/\%#=2\D//g -p:s/\%#=0[^0-9]//g -p:s/\%#=1[^0-9]//g -p:s/\%#=2[^0-9]//g -p:s/\%#=0\o//g -p:s/\%#=1\o//g -p:s/\%#=2\o//g -p:s/\%#=0[0-7]//g -p:s/\%#=1[0-7]//g -p:s/\%#=2[0-7]//g -p:s/\%#=0\O//g -p:s/\%#=1\O//g -p:s/\%#=2\O//g -p:s/\%#=0[^0-7]//g -p:s/\%#=1[^0-7]//g -p:s/\%#=2[^0-7]//g -p:s/\%#=0\x//g -p:s/\%#=1\x//g -p:s/\%#=2\x//g -p:s/\%#=0[0-9A-Fa-f]//g -p:s/\%#=1[0-9A-Fa-f]//g -p:s/\%#=2[0-9A-Fa-f]//g -p:s/\%#=0\X//g -p:s/\%#=1\X//g -p:s/\%#=2\X//g -p:s/\%#=0[^0-9A-Fa-f]//g -p:s/\%#=1[^0-9A-Fa-f]//g -p:s/\%#=2[^0-9A-Fa-f]//g -p:s/\%#=0\w//g -p:s/\%#=1\w//g -p:s/\%#=2\w//g -p:s/\%#=0[0-9A-Za-z_]//g -p:s/\%#=1[0-9A-Za-z_]//g -p:s/\%#=2[0-9A-Za-z_]//g -p:s/\%#=0\W//g -p:s/\%#=1\W//g -p:s/\%#=2\W//g -p:s/\%#=0[^0-9A-Za-z_]//g -p:s/\%#=1[^0-9A-Za-z_]//g -p:s/\%#=2[^0-9A-Za-z_]//g -p:s/\%#=0\h//g -p:s/\%#=1\h//g -p:s/\%#=2\h//g -p:s/\%#=0[A-Za-z_]//g -p:s/\%#=1[A-Za-z_]//g -p:s/\%#=2[A-Za-z_]//g -p:s/\%#=0\H//g -p:s/\%#=1\H//g -p:s/\%#=2\H//g -p:s/\%#=0[^A-Za-z_]//g -p:s/\%#=1[^A-Za-z_]//g -p:s/\%#=2[^A-Za-z_]//g -p:s/\%#=0\a//g -p:s/\%#=1\a//g -p:s/\%#=2\a//g -p:s/\%#=0[A-Za-z]//g -p:s/\%#=1[A-Za-z]//g -p:s/\%#=2[A-Za-z]//g -p:s/\%#=0\A//g -p:s/\%#=1\A//g -p:s/\%#=2\A//g -p:s/\%#=0[^A-Za-z]//g -p:s/\%#=1[^A-Za-z]//g -p:s/\%#=2[^A-Za-z]//g -p:s/\%#=0\l//g -p:s/\%#=1\l//g -p:s/\%#=2\l//g -p:s/\%#=0[a-z]//g -p:s/\%#=1[a-z]//g -p:s/\%#=2[a-z]//g -p:s/\%#=0\L//g -p:s/\%#=1\L//g -p:s/\%#=2\L//g -p:s/\%#=0[^a-z]//g -p:s/\%#=1[^a-z]//g -p:s/\%#=2[^a-z]//g -p:s/\%#=0\u//g -p:s/\%#=1\u//g -p:s/\%#=2\u//g -p:s/\%#=0[A-Z]//g -p:s/\%#=1[A-Z]//g -p:s/\%#=2[A-Z]//g -p:s/\%#=0\U//g -p:s/\%#=1\U//g -p:s/\%#=2\U//g -p:s/\%#=0[^A-Z]//g -p:s/\%#=1[^A-Z]//g -p:s/\%#=2[^A-Z]//g -:/^start-here/+1,$wq! test.out -ENDTEST - -start-here - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ diff --git a/src/testdir/test36.ok b/src/testdir/test36.ok deleted file mode 100644 index f72a74b2b7..0000000000 --- a/src/testdir/test36.ok +++ /dev/null @@ -1,96 +0,0 @@ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ -0123456789 -0123456789 -0123456789 -0123456789 -0123456789 -0123456789 - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~ -01234567 -01234567 -01234567 -01234567 -01234567 -01234567 - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ - !"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~ -0123456789ABCDEFabcdef -0123456789ABCDEFabcdef -0123456789ABCDEFabcdef -0123456789ABCDEFabcdef -0123456789ABCDEFabcdef -0123456789ABCDEFabcdef - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./:;<=>?@[\]^`{|}~ -0123456789ABCDEFGHIXYZ_abcdefghiwxyz -0123456789ABCDEFGHIXYZ_abcdefghiwxyz -0123456789ABCDEFGHIXYZ_abcdefghiwxyz -0123456789ABCDEFGHIXYZ_abcdefghiwxyz -0123456789ABCDEFGHIXYZ_abcdefghiwxyz -0123456789ABCDEFGHIXYZ_abcdefghiwxyz - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~ -ABCDEFGHIXYZ_abcdefghiwxyz -ABCDEFGHIXYZ_abcdefghiwxyz -ABCDEFGHIXYZ_abcdefghiwxyz -ABCDEFGHIXYZ_abcdefghiwxyz -ABCDEFGHIXYZ_abcdefghiwxyz -ABCDEFGHIXYZ_abcdefghiwxyz - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~ -ABCDEFGHIXYZabcdefghiwxyz -ABCDEFGHIXYZabcdefghiwxyz -ABCDEFGHIXYZabcdefghiwxyz -ABCDEFGHIXYZabcdefghiwxyz -ABCDEFGHIXYZabcdefghiwxyz -ABCDEFGHIXYZabcdefghiwxyz - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~ -abcdefghiwxyz -abcdefghiwxyz -abcdefghiwxyz -abcdefghiwxyz -abcdefghiwxyz -abcdefghiwxyz - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ - !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~ -ABCDEFGHIXYZ -ABCDEFGHIXYZ -ABCDEFGHIXYZ -ABCDEFGHIXYZ -ABCDEFGHIXYZ -ABCDEFGHIXYZ diff --git a/src/testdir/test38.in b/src/testdir/test38.in deleted file mode 100644 index 3e0236251b..0000000000 --- a/src/testdir/test38.in +++ /dev/null @@ -1,35 +0,0 @@ - -Test Virtual replace mode. - -STARTTEST -:so small.vim -:" make sure that backspace works, no matter what termcap is used -:set t_kD=x7f t_kb=x08 -ggdGa -abcdefghi -jk lmn - opq rst -uvwxyz -gg:set ai -:set bs=2 -gR0 1 -A -BCDEFGHIJ - KL -MNO -PQRG:ka -o0 -abcdefghi -jk lmn - opq rst -uvwxyz -'ajgR0 1 -A -BCDEFGHIJ - KL -MNO -PQR:$ -iab cdefghi jkl0gRAB......CDEFGHI.Jo: -iabcdefghijklmnopqrst0gRAB IJKLMNO QR:wq! test.out -ENDTEST - diff --git a/src/testdir/test38.ok b/src/testdir/test38.ok deleted file mode 100644 index e10209667b..0000000000 --- a/src/testdir/test38.ok +++ /dev/null @@ -1,13 +0,0 @@ - 1 - A - BCDEFGHIJ - KL - MNO - PQR - 1 -abcdefghi -jk lmn - opq rst -uvwxyz -AB......CDEFGHI.Jkl -AB IJKLMNO QRst diff --git a/src/testdir/test39.in b/src/testdir/test39.in index c1e1cc49a6..fcb935de72 100644 --- a/src/testdir/test39.in +++ b/src/testdir/test39.in @@ -2,6 +2,10 @@ Test Visual block mode commands And test "U" in Visual mode, also on German sharp S. +#define BO_ALL 0x0001 +#define BO_BS 0x0002 +#define BO_CRSR 0x0004 + STARTTEST :so small.vim :so mbyte.vim @@ -23,6 +27,9 @@ G$khhhhhkkcmno /^aaaa/ :exe ":norm! l\<C-V>jjjlllI\<Right>\<Right> \<Esc>" :/^aa/,/^$/w >> test.out +/xaaa$/ +:exe ":norm! \<C-V>jjjI<>\<Left>p\<Esc>" +:/xaaa$/,/^$/w >> test.out :" Test for Visual block was created with the last <C-v>$ /^A23$/ :exe ":norm! l\<C-V>j$Aab\<Esc>" @@ -35,11 +42,14 @@ G$khhhhhkkcmno /^C23$/ :exe ":norm! l\<C-V>j$hhAab\<Esc>" :.,/^$/w >> test.out -:" Test for Visual block insert when virtualedit=all -:set ve=all +:" Test for Visual block insert when virtualedit=all and utf-8 encoding +:set ve=all enc=utf-8 :/\t\tline :exe ":norm! 07l\<C-V>jjIx\<Esc>" -:set ve= +:.,/^$/w >> test.out +:" Test for Visual block append when virtualedit=all +:exe ":norm! 012l\<C-v>jjAx\<Esc>" +:set ve= enc=latin1 :.,/^$/w >> test.out :" gUe must uppercase a whole word, also when changes to SS Gothe youtueuu endYpk0wgUe @@ -64,6 +74,12 @@ G3o987652k02l2jr :exe ":norm! 2k\<C-V>$gj\<Esc>" :let cpos=getpos("'>") :$put ='col:'.cpos[2].' off:'.cpos[3] +:" +:" block_insert when replacing spaces in front of the block with tabs +:set ts=8 sts=4 sw=4 +:4,7y +Gp +:exe ":norm! f0\<C-V>2jI\<tab>\<esc>" :/^the/,$w >> test.out :qa! ENDTEST @@ -77,6 +93,15 @@ bbbbbb cccccc dddddd +xaaa +bbbb +cccc +dddd + +yaaa + +bbb + A23 4567 diff --git a/src/testdir/test39.ok b/src/testdir/test39.ok index ef7a2c6442..349d67fe77 100644 Binary files a/src/testdir/test39.ok and b/src/testdir/test39.ok differ diff --git a/src/testdir/test4.in b/src/testdir/test4.in deleted file mode 100644 index 4aa2fe5a86..0000000000 --- a/src/testdir/test4.in +++ /dev/null @@ -1,31 +0,0 @@ -Test for autocommand that changes current buffer on BufEnter event. -Check if modelines are interpreted for the correct buffer. - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -:au BufEnter Xxx brew -/start of -:.,/end of/w! Xxx " write test file Xxx -:set ai modeline modelines=3 -:sp Xxx " split to Xxx, autocmd will do :brew -G?this is a -othis should be auto-indented -: " Append text with autoindent to this file -:au! BufEnter Xxx -:buf Xxx " go to Xxx, no autocmd anymore -G?this is a -othis should be in column 1:wq " append text without autoindent to Xxx -G:r Xxx " include Xxx in the current file -:?startstart?,$w! test.out -:qa! -ENDTEST - -startstart -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test4.ok b/src/testdir/test4.ok deleted file mode 100644 index dffecda4d2..0000000000 --- a/src/testdir/test4.ok +++ /dev/null @@ -1,17 +0,0 @@ -startstart -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test - this should be auto-indented -end of test file Xxx -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -this should be in column 1 -end of test file Xxx diff --git a/src/testdir/test40.in b/src/testdir/test40.in deleted file mode 100644 index d92a18f3d0..0000000000 --- a/src/testdir/test40.in +++ /dev/null @@ -1,63 +0,0 @@ -Test for "*Cmd" autocommands - -STARTTEST -:so small.vim -:/^start/,$w! Xxx " write lines below to Xxx -:au BufReadCmd XtestA 0r Xxx|$del -:e XtestA " will read text of Xxd instead -:au BufWriteCmd XtestA call append(line("$"), "write") -:w " will append a line to the file -:r XtestA " should not read anything -: " now we have: -: " 1 start of Xxx -: " 2 test40 -: " 3 end of Xxx -: " 4 write -:au FileReadCmd XtestB '[r Xxx -:2r XtestB " will read Xxx below line 2 instead -: " 1 start of Xxx -: " 2 test40 -: " 3 start of Xxx -: " 4 test40 -: " 5 end of Xxx -: " 6 end of Xxx -: " 7 write -:au FileWriteCmd XtestC '[,']copy $ -4GA1 -:4,5w XtestC " will copy lines 4 and 5 to the end -:r XtestC " should not read anything -: " 1 start of Xxx -: " 2 test40 -: " 3 start of Xxx -: " 4 test401 -: " 5 end of Xxx -: " 6 end of Xxx -: " 7 write -: " 8 test401 -: " 9 end of Xxx -:au FILEAppendCmd XtestD '[,']w! test.out -:w >>XtestD " will write all lines to test.out -:$r XtestD " should not read anything -:$w >>test.out " append "end of Xxx" to test.out -:au BufReadCmd XtestE 0r test.out|$del -:sp XtestE " split window with test.out -5Goasdf:" -:au BufWriteCmd XtestE w! test.out -:wall " will write other window to test.out -: " 1 start of Xxx -: " 2 test40 -: " 3 start of Xxx -: " 4 test401 -: " 5 end of Xxx -: " 6 asdf -: " 7 end of Xxx -: " 8 write -: " 9 test401 -: " 10 end of Xxx -: " 11 end of Xxx -:qa! -ENDTEST - -start of Xxx - test40 -end of Xxx diff --git a/src/testdir/test40.ok b/src/testdir/test40.ok deleted file mode 100644 index b6501394f9..0000000000 --- a/src/testdir/test40.ok +++ /dev/null @@ -1,11 +0,0 @@ -start of Xxx - test40 -start of Xxx - test401 -end of Xxx -asdf -end of Xxx -write - test401 -end of Xxx -end of Xxx diff --git a/src/testdir/test41.in b/src/testdir/test41.in deleted file mode 100644 index 2d294cae09..0000000000 --- a/src/testdir/test41.in +++ /dev/null @@ -1,24 +0,0 @@ -Test for writing and reading a file of over 100 Kbyte - -1 line: "This is the start" -3001 lines: "This is the leader" -1 line: "This is the middle" -3001 lines: "This is the trailer" -1 line: "This is the end" - -STARTTEST -:%d -aThis is the start -This is the leader -This is the middle -This is the trailer -This is the endkY3000p2GY3000p -:w! Xtest -:%d -:e! Xtest -:.w! test.out -3003G:.w >>test.out -6005G:.w >>test.out -:qa! -ENDTEST - diff --git a/src/testdir/test41.ok b/src/testdir/test41.ok deleted file mode 100644 index 988e5f24b4..0000000000 --- a/src/testdir/test41.ok +++ /dev/null @@ -1,3 +0,0 @@ -This is the start -This is the middle -This is the end diff --git a/src/testdir/test43.in b/src/testdir/test43.in deleted file mode 100644 index 7c545073da..0000000000 --- a/src/testdir/test43.in +++ /dev/null @@ -1,34 +0,0 @@ -Tests for regexp with various magic settings. - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -/^1 -/a*b\{2}c\+/e -x/\Md\*e\{2}f\+/e -x:set nomagic -/g\*h\{2}i\+/e -x/\mj*k\{2}l\+/e -x/\vm*n{2}o+/e -x/\V^aa$ -x:set magic -/\v(a)(b)\2\1\1/e -x/\V[ab]\(\[xy]\)\1 -x:$ -:set undolevels=100 -dv?bar? -Yup:" -:?^1?,$w! test.out -:qa! -ENDTEST - -1 a aa abb abbccc -2 d dd dee deefff -3 g gg ghh ghhiii -4 j jj jkk jkklll -5 m mm mnn mnnooo -6 x ^aa$ x -7 (a)(b) abbaa -8 axx [ab]xx -9 foobar - diff --git a/src/testdir/test43.ok b/src/testdir/test43.ok deleted file mode 100644 index 0b37a6a61e..0000000000 --- a/src/testdir/test43.ok +++ /dev/null @@ -1,11 +0,0 @@ -1 a aa abb abbcc -2 d dd dee deeff -3 g gg ghh ghhii -4 j jj jkk jkkll -5 m mm mnn mnnoo -6 x aa$ x -7 (a)(b) abba -8 axx ab]xx -9 foobar -9 foo - diff --git a/src/testdir/test44.in b/src/testdir/test44.in index 87de1b95a4..7126392377 100644 --- a/src/testdir/test44.in +++ b/src/testdir/test44.in @@ -24,24 +24,38 @@ x:" Now search for multi-byte with composing char x:" find word by change of word class /ち\<カヨ\>は x:" Test \%u, [\u] and friends +:" c /\%u20ac -x/[\u4f7f\u5929]\+ -x/\%U12345678 -x/[\U1234abcd\u1234\uabcd] -x/\%d21879b -x/ [[=A=]]* [[=B=]]* [[=C=]]* [[=D=]]* [[=E=]]* [[=F=]]* [[=G=]]* [[=H=]]* [[=I=]]* [[=J=]]* [[=K=]]* [[=L=]]* [[=M=]]* [[=N=]]* [[=O=]]* [[=P=]]* [[=Q=]]* [[=R=]]* [[=S=]]* [[=T=]]* [[=U=]]* [[=V=]]* [[=W=]]* [[=X=]]* [[=Y=]]* [[=Z=]]*/e -x/ [[=a=]]* [[=b=]]* [[=c=]]* [[=d=]]* [[=e=]]* [[=f=]]* [[=g=]]* [[=h=]]* [[=i=]]* [[=j=]]* [[=k=]]* [[=l=]]* [[=m=]]* [[=n=]]* [[=o=]]* [[=p=]]* [[=q=]]* [[=r=]]* [[=s=]]* [[=t=]]* [[=u=]]* [[=v=]]* [[=w=]]* [[=x=]]* [[=y=]]* [[=z=]]*/e -x:" Test backwards search from a multi-byte char +x:" d +/[\u4f7f\u5929]\+ +x:" e +/\%U12345678 +x:" f +/[\U1234abcd\u1234\uabcd] +x:" g +/\%d21879b +x:" j Test backwards search from a multi-byte char /x x?. -x:let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g' +x:" k +:let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g' :@w +:" +:" l Test what 7.3.192 fixed +/^l +:s/ \?/ /g :?^1?,$w! test.out :e! test.out G:put =matchstr(\"אבגד\", \".\", 0, 2) " ב :put =matchstr(\"אבגד\", \"..\", 0, 2) " בג :put =matchstr(\"אבגד\", \".\", 0, 0) " א :put =matchstr(\"אבגד\", \".\", 4, -1) " ג +:new +:$put =['dog(a', 'cat('] +/(/e+ +"ayn:bd! +:$put ='' +G"ap :w! :qa! ENDTEST @@ -62,7 +76,6 @@ d 天使x e y f z g a啷bb -h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ -i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ j 0123❤x k combinations +l äö üᾱ̆́ diff --git a/src/testdir/test44.ok b/src/testdir/test44.ok index 0bd0b8ab73..45774d7cbb 100644 --- a/src/testdir/test44.ok +++ b/src/testdir/test44.ok @@ -14,11 +14,12 @@ d 使x e y f z g abb -h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐ -i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑ j 012❤ k œ̄ṣ́m̥̄ᾱ̆́ + l ä ö ü ᾱ̆́ ב בג א ג +a +cat( diff --git a/src/testdir/test45.in b/src/testdir/test45.in deleted file mode 100644 index e5af5073d9..0000000000 --- a/src/testdir/test45.in +++ /dev/null @@ -1,80 +0,0 @@ -Tests for folding. vim: set ft=vim : - -STARTTEST -:so small.vim -:" We also need the +syntax feature here. -:if !has("syntax") - e! test.ok - w! test.out - qa! -:endif -:" basic test if a fold can be created, opened, moving to the end and closed -/^1 -zf2j:call append("$", "manual " . getline(foldclosed("."))) -zo:call append("$", foldclosed(".")) -]z:call append("$", getline(".")) -zc:call append("$", getline(foldclosed("."))) -:" test folding with markers. -:set fdm=marker fdl=1 fdc=3 -/^5 -:call append("$", "marker " . foldlevel(".")) -[z:call append("$", foldlevel(".")) -jo{{ r{jj:call append("$", foldlevel(".")) -kYpj:call append("$", foldlevel(".")) -:" test folding with indent -:set fdm=indent sw=2 -/^2 b -i jI :call append("$", "indent " . foldlevel(".")) -k:call append("$", foldlevel(".")) -:" test syntax folding -:set fdm=syntax fdl=0 -:syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3 -:syn region Fd1 start="ee" end="ff" fold contained -:syn region Fd2 start="gg" end="hh" fold contained -:syn region Fd3 start="commentstart" end="commentend" fold contained -Gzk:call append("$", "folding " . getline(".")) -k:call append("$", getline(".")) -jAcommentstart Acommentend:set fdl=1 -3j:call append("$", getline(".")) -:set fdl=0 -zO j:call append("$", getline(".")) -:" test expression folding -:fun Flvl() - let l = getline(v:lnum) - if l =~ "bb$" - return 2 - elseif l =~ "gg$" - return "s1" - elseif l =~ "ii$" - return ">2" - elseif l =~ "kk$" - return "0" - endif - return "=" -endfun -:set fdm=expr fde=Flvl() -/bb$ -:call append("$", "expr " . foldlevel(".")) -/hh$ -:call append("$", foldlevel(".")) -/ii$ -:call append("$", foldlevel(".")) -/kk$ -:call append("$", foldlevel(".")) -:/^last/+1,$w! test.out -:delfun Flvl -:qa! -ENDTEST - -1 aa -2 bb -3 cc -4 dd {{{ -5 ee {{{ }}} -6 ff }}} -7 gg -8 hh -9 ii -a jj -b kk -last diff --git a/src/testdir/test45.ok b/src/testdir/test45.ok deleted file mode 100644 index f04996e337..0000000000 --- a/src/testdir/test45.ok +++ /dev/null @@ -1,18 +0,0 @@ -manual 1 aa --1 -3 cc -1 aa -marker 2 -1 -1 -0 -indent 2 -1 -folding 9 ii - 3 cc -7 gg -8 hh -expr 2 -1 -2 -0 diff --git a/src/testdir/test46.in b/src/testdir/test46.in deleted file mode 100644 index 9a9db74d62..0000000000 --- a/src/testdir/test46.in +++ /dev/null @@ -1,27 +0,0 @@ -Tests for multi-line regexps with ":s". vim: set ft=vim : - -STARTTEST -:" test if replacing a line break works with a back reference -:/^1/,/^2/s/\n\(.\)/ \1/ -:" test if inserting a line break works with a back reference -:/^3/,/^4/s/\(.\)$/\r\1/ -:" test if replacing a line break with another line break works -:/^5/,/^6/s/\(\_d\{3}\)/x\1x/ -:/^1/,$w! test.out -:qa! -ENDTEST - -1 aa -bb -cc -2 dd -ee -3 ef -gh -4 ij -5 a8 -8b c9 -9d -6 e7 -77f -xxxxx diff --git a/src/testdir/test46.ok b/src/testdir/test46.ok deleted file mode 100644 index 71b353df1d..0000000000 --- a/src/testdir/test46.ok +++ /dev/null @@ -1,13 +0,0 @@ -1 aa bb cc 2 dd ee -3 e -f -g -h -4 i -j -5 ax8 -8xb cx9 -9xd -6 ex7 -7x7f -xxxxx diff --git a/src/testdir/test47.in b/src/testdir/test47.in deleted file mode 100644 index 13ad82462f..0000000000 --- a/src/testdir/test47.in +++ /dev/null @@ -1,62 +0,0 @@ -Tests for vertical splits and filler lines in diff mode - -STARTTEST -:so small.vim -:" Disable the title to avoid xterm keeping the wrong one. -:set notitle noicon -/^1 -yG:new -pkdd:w! Xtest -ddGpkkrXoxxx:w! Xtest2 -:file Nop -ggoyyyjjjozzzz -:vert diffsplit Xtest -:vert diffsplit Xtest2 -:" jump to second window for a moment to have filler line appear at start of -:" first window -ggpgg:let one = winline() -j:let one = one . "-" . winline() -j:let one = one . "-" . winline() -j:let one = one . "-" . winline() -j:let one = one . "-" . winline() -j:let one = one . "-" . winline() -gg:let two = winline() -j:let two = two . "-" . winline() -j:let two = two . "-" . winline() -j:let two = two . "-" . winline() -j:let two = two . "-" . winline() -gg:let three = winline() -j:let three = three . "-" . winline() -j:let three = three . "-" . winline() -j:let three = three . "-" . winline() -j:let three = three . "-" . winline() -j:let three = three . "-" . winline() -j:let three = three . "-" . winline() -:call append("$", one) -:call append("$", two) -:call append("$", three) -:$-2,$w! test.out -:" Test that diffing shows correct filler lines -:diffoff! -:windo :bw! -:enew -:put =range(4,10) -:1d _ -:vnew -:put =range(1,10) -:1d _ -:windo :diffthis -:wincmd h -:let w0=line('w0') -:enew -:put =w0 -:.w >> test.out -:unlet! one two three w0 -:qa! -ENDTEST - -1 aa -2 bb -3 cc -4 dd -5 ee diff --git a/src/testdir/test47.ok b/src/testdir/test47.ok deleted file mode 100644 index b1cba92b1c..0000000000 --- a/src/testdir/test47.ok +++ /dev/null @@ -1,4 +0,0 @@ -2-4-5-6-8-9 -1-2-4-5-8 -2-3-4-5-6-7-8 -1 diff --git a/src/testdir/test48.in b/src/testdir/test48.in index 48f4abbf75..d480f8cc18 100644 --- a/src/testdir/test48.in +++ b/src/testdir/test48.in @@ -44,6 +44,10 @@ $4lDi<-- 'D' should be intact /^"r" $5lrxa<-- should be 'x' :" +:" Test "r" on a tab +:" Note that for this test, 'ts' must be 8 (the default). +^5lrxA<-- should be ' x ' +:" :" Test to make sure 'x' can delete control characters :set display=uhex ^xxxxxxi[This line should contain only the text between the brackets.] @@ -72,6 +76,7 @@ this is a test this is a test this is a test "r" +"r" ab sd abcv6efi.him0kl diff --git a/src/testdir/test48.ok b/src/testdir/test48.ok index 334cb5a29c..14cd9b12ec 100644 --- a/src/testdir/test48.ok +++ b/src/testdir/test48.ok @@ -12,6 +12,7 @@ this is a test this is a test this is a test "r" x<-- should be 'x' +"r" x <-- should be ' x ' [This line should contain only the text between the brackets.] v i m <-- should show the name of a noted text editor 6 . 0 <-- and its version number diff --git a/src/testdir/test49.in b/src/testdir/test49.in index 5e1d6b461e..79f13f6a56 100644 --- a/src/testdir/test49.in +++ b/src/testdir/test49.in @@ -8,7 +8,9 @@ STARTTEST :se nocp nomore viminfo+=nviminfo :lang mess C :so test49.vim -GGGGGGGGGGGGGG"rp:.-,$w! test.out +:" Go back to this file and append the results from register r. +:buf test49.in +G"rp:/^Results/,$w! test.out :" :" make valgrind happy :redir => funclist diff --git a/src/testdir/test49.ok b/src/testdir/test49.ok index bf1ceed9af..50fc5d2cef 100644 --- a/src/testdir/test49.ok +++ b/src/testdir/test49.ok @@ -1,19 +1,4 @@ Results of test49.vim: -*** Test 1: OK (34695) -*** Test 2: OK (34695) -*** Test 3: OK (1384648195) -*** Test 4: OK (32883) -*** Test 5: OK (32883) -*** Test 6: OK (603978947) -*** Test 7: OK (90563) -*** Test 8: OK (562493431) -*** Test 9: OK (363) -*** Test 10: OK (559615) -*** Test 11: OK (2049) -*** Test 12: OK (352256) -*** Test 13: OK (145) -*** Test 14: OK (42413) -*** Test 15: OK (42413) *** Test 16: OK (8722) *** Test 17: OK (285127993) *** Test 18: OK (67224583) diff --git a/src/testdir/test49.vim b/src/testdir/test49.vim index e08da5712d..f50062e7b2 100644 --- a/src/testdir/test49.vim +++ b/src/testdir/test49.vim @@ -1,6 +1,6 @@ " Vim script language tests " Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com> -" Last Change: 2013 Jun 06 +" Last Change: 2016 Feb 07 "------------------------------------------------------------------------------- " Test environment {{{1 @@ -608,850 +608,8 @@ com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>) " END_OF_TEST_ENVIRONMENT - do not change or remove this line. -"------------------------------------------------------------------------------- -" Test 1: :endwhile in function {{{1 -" -" Detect if a broken loop is (incorrectly) reactivated by the -" :endwhile. Use a :return to prevent an endless loop, and make -" this test first to get a meaningful result on an error before other -" tests will hang. -"------------------------------------------------------------------------------- - -XpathINIT - -function! F() - Xpath 1 " X: 1 - let first = 1 - XloopINIT 2 8 - while 1 - Xloop 1 " X: 2 + 0 * 16 - if first - Xloop 2 " X: 4 + 0 * 32 - let first = 0 - XloopNEXT - break - else - Xloop 4 " X: 0 + 0 * 64 - return - endif - endwhile -endfunction - -call F() -Xpath 128 " X: 128 - -function! G() - Xpath 256 " X: 256 + 0 * 2048 - let first = 1 - XloopINIT 512 8 - while 1 - Xloop 1 " X: 512 + 0 * 4096 - if first - Xloop 2 " X: 1024 + 0 * 8192 - let first = 0 - XloopNEXT - break - else - Xloop 4 " X: 0 + 0 * 16384 - return - endif - if 1 " unmatched :if - endwhile -endfunction - -call G() -Xpath 32768 " X: 32768 - -Xcheck 34695 - -" Leave F and G for execution as scripts in the next test. - - -"------------------------------------------------------------------------------- -" Test 2: :endwhile in script {{{1 -" -" Detect if a broken loop is (incorrectly) reactivated by the -" :endwhile. Use a :finish to prevent an endless loop, and place -" this test before others that might hang to get a meaningful result -" on an error. -" -" This test executes the bodies of the functions F and G from the -" previous test as script files (:return replaced by :finish). -"------------------------------------------------------------------------------- - -XpathINIT - -ExecAsScript F " X: 1 + 2 + 4 -Xpath 128 " X: 128 - -ExecAsScript G " X: 256 + 512 + 1024 -Xpath 32768 " X: 32768 - -unlet first -delfunction F -delfunction G - -Xcheck 34695 - - -"------------------------------------------------------------------------------- -" Test 3: :if, :elseif, :while, :continue, :break {{{1 -"------------------------------------------------------------------------------- - -XpathINIT -if 1 - Xpath 1 " X: 1 - let loops = 3 - XloopINIT 2 512 - while loops > -1 " main loop: loops == 3, 2, 1 (which breaks) - if loops <= 0 - let break_err = 1 - let loops = -1 - else " 3: 2: 1: - Xloop 1 " X: 2 + 2*512 + 2*512*512 - endif - if (loops == 2) - while loops == 2 " dummy loop - Xloop 2 " X: 4*512 - let loops = loops - 1 - continue " stop dummy loop - Xloop 4 " X: 0 - endwhile - XloopNEXT - continue " continue main loop - Xloop 8 " X: 0 - elseif (loops == 1) - let p = 1 - while p " dummy loop - Xloop 16 " X: 32*512*512 - let p = 0 - break " break dummy loop - Xloop 32 " X: 0 - endwhile - Xloop 64 " X: 128*512*512 - unlet p - break " break main loop - Xloop 128 " X: 0 - endif - if (loops > 0) - Xloop 256 " X: 512 - endif - while loops == 3 " dummy loop - let loops = loops - 1 - endwhile " end dummy loop - XloopNEXT - endwhile " end main loop - Xpath 268435456 " X: 1024*512*512 -else - Xpath 536870912 " X: 0 -endif -Xpath 1073741824 " X: 4096*512*512 -if exists("break_err") - " The Xpath command does not accept 2^31 (negative); add explicitly: - let Xpath = Xpath + 2147483648 " X: 0 - unlet break_err -endif - -unlet loops - -Xcheck 1384648195 - - -"------------------------------------------------------------------------------- -" Test 4: :return {{{1 -"------------------------------------------------------------------------------- - -XpathINIT - -function! F() - if 1 - Xpath 1 " X: 1 - let loops = 3 - XloopINIT 2 16 - while loops > 0 " 3: 2: 1: - Xloop 1 " X: 2 + 2*16 + 0*16*16 - if (loops == 2) - Xloop 2 " X: 4*16 - return - Xloop 4 " X: 0 - endif - Xloop 8 " X: 16 - let loops = loops - 1 - XloopNEXT - endwhile - Xpath 8192 " X: 0 - else - Xpath 16384 " X: 0 - endif -endfunction - -call F() -Xpath 32768 " X: 8*16*16*16 - -Xcheck 32883 - -" Leave F for execution as a script in the next test. - - -"------------------------------------------------------------------------------- -" Test 5: :finish {{{1 -" -" This test executes the body of the function F from the previous test -" as a script file (:return replaced by :finish). -"------------------------------------------------------------------------------- - -XpathINIT - -ExecAsScript F " X: 1 + 2 + 2*16 + 4*16 + 16 -Xpath 32768 " X: 32768 - -unlet loops -delfunction F - -Xcheck 32883 - - -"------------------------------------------------------------------------------- -" Test 6: Defining functions in :while loops {{{1 -" -" Functions can be defined inside other functions. An inner function -" gets defined when the outer function is executed. Functions may -" also be defined inside while loops. Expressions in braces for -" defining the function name are allowed. -"------------------------------------------------------------------------------- - -XpathINIT - -if ExtraVim() - - " The command CALL collects the argument of all its invocations in "calls" - " when used from a function (that is, when the global variable "calls" needs - " the "g:" prefix). This is to check that the function code is skipped when - " the function is defined. For inner functions, do so only if the outer - " function is not being executed. - " - let calls = "" - com! -nargs=1 CALL - \ if !exists("calls") && !exists("outer") | - \ let g:calls = g:calls . <args> | - \ endif - - - XloopINIT! 1 16 - - let i = 0 - while i < 3 - - XloopNEXT - let i = i + 1 - - if i == 1 - Xloop 1 " X: 1 - function! F1(arg) - CALL a:arg - let outer = 1 - - XloopINIT! 4096 4 - let j = 0 - while j < 1 - XloopNEXT - Xloop 1 " X: 4096 - let j = j + 1 - function! G1(arg) - CALL a:arg - endfunction - Xloop 2 " X: 8192 - endwhile - endfunction - Xloop 2 " X: 2 - - continue - endif - - Xloop 4 " X: 4 * (16 + 256) - function! F{i}(i, arg) - CALL a:arg - let outer = 1 - - XloopINIT! 16384 4 - if a:i == 3 - XloopNEXT - XloopNEXT - XloopNEXT - endif - let k = 0 - while k < 3 - XloopNEXT - Xloop 1 " X: 16384*(1+4+16+64+256+1024) - let k = k + 1 - function! G{a:i}{k}(arg) - CALL a:arg - endfunction - Xloop 2 " X: 32768*(1+4+16+64+256+1024) - endwhile - endfunction - Xloop 8 " X: 8 * (16 + 256) - - endwhile - - if exists("*G1") - Xpath 67108864 " X: 0 - endif - if exists("*F1") - call F1("F1") - if exists("*G1") - call G1("G1") - endif - endif - - if exists("G21") || exists("G21") || exists("G21") - Xpath 134217728 " X: 0 - endif - if exists("*F2") - call F2(2, "F2") - if exists("*G21") - call G21("G21") - endif - if exists("*G22") - call G22("G22") - endif - if exists("*G23") - call G23("G23") - endif - endif - - if exists("G31") || exists("G31") || exists("G31") - Xpath 268435456 " X: 0 - endif - if exists("*F3") - call F3(3, "F3") - if exists("*G31") - call G31("G31") - endif - if exists("*G32") - call G32("G32") - endif - if exists("*G33") - call G33("G33") - endif - endif - - Xpath 536870912 " X: 536870912 - - if calls != "F1G1F2G21G22G23F3G31G32G33" - Xpath 1073741824 " X: 0 - Xout "calls is" calls - endif - - delfunction F1 - delfunction G1 - delfunction F2 - delfunction G21 - delfunction G22 - delfunction G23 - delfunction G31 - delfunction G32 - delfunction G33 - -endif - -Xcheck 603978947 - - -"------------------------------------------------------------------------------- -" Test 7: Continuing on errors outside functions {{{1 -" -" On an error outside a function, the script processing continues -" at the line following the outermost :endif or :endwhile. When not -" inside an :if or :while, the script processing continues at the next -" line. -"------------------------------------------------------------------------------- - -XpathINIT - -if 1 - Xpath 1 " X: 1 - while 1 - Xpath 2 " X: 2 - asdf - Xpath 4 " X: 0 - break - endwhile | Xpath 8 " X: 0 - Xpath 16 " X: 0 -endif | Xpath 32 " X: 0 -Xpath 64 " X: 64 - -while 1 - Xpath 128 " X: 128 - if 1 - Xpath 256 " X: 256 - asdf - Xpath 512 " X: 0 - endif | Xpath 1024 " X: 0 - Xpath 2048 " X: 0 - break -endwhile | Xpath 4096 " X: 0 -Xpath 8192 " X: 8192 - -asdf -Xpath 16384 " X: 16384 - -asdf | Xpath 32768 " X: 0 -Xpath 65536 " X: 65536 - -Xcheck 90563 - - -"------------------------------------------------------------------------------- -" Test 8: Aborting and continuing on errors inside functions {{{1 -" -" On an error inside a function without the "abort" attribute, the -" script processing continues at the next line (unless the error was -" in a :return command). On an error inside a function with the -" "abort" attribute, the function is aborted and the script processing -" continues after the function call; the value -1 is returned then. -"------------------------------------------------------------------------------- - -XpathINIT - -function! F() - if 1 - Xpath 1 " X: 1 - while 1 - Xpath 2 " X: 2 - asdf - Xpath 4 " X: 4 - asdf | Xpath 8 " X: 0 - Xpath 16 " X: 16 - break - endwhile - Xpath 32 " X: 32 - endif | Xpath 64 " X: 64 - Xpath 128 " X: 128 - - while 1 - Xpath 256 " X: 256 - if 1 - Xpath 512 " X: 512 - asdf - Xpath 1024 " X: 1024 - asdf | Xpath 2048 " X: 0 - Xpath 4096 " X: 4096 - endif - Xpath 8192 " X: 8192 - break - endwhile | Xpath 16384 " X: 16384 - Xpath 32768 " X: 32768 - - return novar " returns (default return value 0) - Xpath 65536 " X: 0 - return 1 " not reached -endfunction - -function! G() abort - if 1 - Xpath 131072 " X: 131072 - while 1 - Xpath 262144 " X: 262144 - asdf " returns -1 - Xpath 524288 " X: 0 - break - endwhile - Xpath 1048576 " X: 0 - endif | Xpath 2097152 " X: 0 - Xpath Xpath 4194304 " X: 0 - - return -4 " not reached -endfunction - -function! H() abort - while 1 - Xpath 8388608 " X: 8388608 - if 1 - Xpath 16777216 " X: 16777216 - asdf " returns -1 - Xpath 33554432 " X: 0 - endif - Xpath 67108864 " X: 0 - break - endwhile | Xpath 134217728 " X: 0 - Xpath 268435456 " X: 0 - - return -4 " not reached -endfunction - -" Aborted functions (G and H) return -1. -let sum = (F() + 1) - 4*G() - 8*H() -Xpath 536870912 " X: 536870912 -if sum != 13 - Xpath 1073741824 " X: 0 - Xout "sum is" sum -endif - -unlet sum -delfunction F -delfunction G -delfunction H - -Xcheck 562493431 - - -"------------------------------------------------------------------------------- -" Test 9: Continuing after aborted functions {{{1 -" -" When a function with the "abort" attribute is aborted due to an -" error, the next function back in the call hierarchy without an -" "abort" attribute continues; the value -1 is returned then. -"------------------------------------------------------------------------------- - -XpathINIT - -function! F() abort - Xpath 1 " X: 1 - let result = G() " not aborted - Xpath 2 " X: 2 - if result != 2 - Xpath 4 " X: 0 - endif - return 1 -endfunction - -function! G() " no abort attribute - Xpath 8 " X: 8 - if H() != -1 " aborted - Xpath 16 " X: 0 - endif - Xpath 32 " X: 32 - return 2 -endfunction - -function! H() abort - Xpath 64 " X: 64 - call I() " aborted - Xpath 128 " X: 0 - return 4 -endfunction - -function! I() abort - Xpath 256 " X: 256 - asdf " error - Xpath 512 " X: 0 - return 8 -endfunction - -if F() != 1 - Xpath 1024 " X: 0 -endif - -delfunction F -delfunction G -delfunction H -delfunction I - -Xcheck 363 - - -"------------------------------------------------------------------------------- -" Test 10: :if, :elseif, :while argument parsing {{{1 -" -" A '"' or '|' in an argument expression must not be mixed up with -" a comment or a next command after a bar. Parsing errors should -" be recognized. -"------------------------------------------------------------------------------- - -XpathINIT - -function! MSG(enr, emsg) - let english = v:lang == "C" || v:lang =~ '^[Ee]n' - if a:enr == "" - Xout "TODO: Add message number for:" a:emsg - let v:errmsg = ":" . v:errmsg - endif - let match = 1 - if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg) - let match = 0 - if v:errmsg == "" - Xout "Message missing." - else - let v:errmsg = escape(v:errmsg, '"') - Xout "Unexpected message:" v:errmsg - endif - endif - return match -endfunction - -if 1 || strlen("\"") | Xpath 1 " X: 1 - Xpath 2 " X: 2 -endif -Xpath 4 " X: 4 - -if 0 -elseif 1 || strlen("\"") | Xpath 8 " X: 8 - Xpath 16 " X: 16 -endif -Xpath 32 " X: 32 - -while 1 || strlen("\"") | Xpath 64 " X: 64 - Xpath 128 " X: 128 - break -endwhile -Xpath 256 " X: 256 - -let v:errmsg = "" -if 1 ||| strlen("\"") | Xpath 512 " X: 0 - Xpath 1024 " X: 0 -endif -Xpath 2048 " X: 2048 -if !MSG('E15', "Invalid expression") - Xpath 4096 " X: 0 -endif - -let v:errmsg = "" -if 0 -elseif 1 ||| strlen("\"") | Xpath 8192 " X: 0 - Xpath 16384 " X: 0 -endif -Xpath 32768 " X: 32768 -if !MSG('E15', "Invalid expression") - Xpath 65536 " X: 0 -endif - -let v:errmsg = "" -while 1 ||| strlen("\"") | Xpath 131072 " X: 0 - Xpath 262144 " X: 0 - break -endwhile -Xpath 524288 " X: 524288 -if !MSG('E15', "Invalid expression") - Xpath 1048576 " X: 0 -endif - -delfunction MSG - -Xcheck 559615 - - -"------------------------------------------------------------------------------- -" Test 11: :if, :elseif, :while argument evaluation after abort {{{1 -" -" When code is skipped over due to an error, the boolean argument to -" an :if, :elseif, or :while must not be evaluated. -"------------------------------------------------------------------------------- - -XpathINIT - -let calls = 0 - -function! P(num) - let g:calls = g:calls + a:num " side effect on call - return 0 -endfunction - -if 1 - Xpath 1 " X: 1 - asdf " error - Xpath 2 " X: 0 - if P(1) " should not be called - Xpath 4 " X: 0 - elseif !P(2) " should not be called - Xpath 8 " X: 0 - else - Xpath 16 " X: 0 - endif - Xpath 32 " X: 0 - while P(4) " should not be called - Xpath 64 " X: 0 - endwhile - Xpath 128 " X: 0 -endif - -if calls % 2 - Xpath 256 " X: 0 -endif -if (calls/2) % 2 - Xpath 512 " X: 0 -endif -if (calls/4) % 2 - Xpath 1024 " X: 0 -endif -Xpath 2048 " X: 2048 - -unlet calls -delfunction P - -Xcheck 2049 - - -"------------------------------------------------------------------------------- -" Test 12: Expressions in braces in skipped code {{{1 -" -" In code skipped over due to an error or inactive conditional, -" an expression in braces as part of a variable or function name -" should not be evaluated. -"------------------------------------------------------------------------------- - -XpathINIT - -XloopINIT 1 8 - -function! NULL() - Xloop 1 " X: 0 - return 0 -endfunction - -function! ZERO() - Xloop 2 " X: 0 - return 0 -endfunction - -function! F0() - Xloop 4 " X: 0 -endfunction - -function! F1(arg) - Xpath 4096 " X: 0 -endfunction - -let V0 = 1 - -Xpath 8192 " X: 8192 -echo 0 ? F{NULL() + V{ZERO()}}() : 1 -XloopNEXT - -Xpath 16384 " X: 16384 -if 0 - Xpath 32768 " X: 0 - call F{NULL() + V{ZERO()}}() -endif -XloopNEXT - -Xpath 65536 " X: 65536 -if 1 - asdf " error - Xpath 131072 " X: 0 - call F1(F{NULL() + V{ZERO()}}()) -endif -XloopNEXT - -Xpath 262144 " X: 262144 -if 1 - asdf " error - Xpath 524288 " X: 0 - call F{NULL() + V{ZERO()}}() -endif - -Xcheck 352256 - - -"------------------------------------------------------------------------------- -" Test 13: Failure in argument evaluation for :while {{{1 -" -" A failure in the expression evaluation for the condition of a :while -" causes the whole :while loop until the matching :endwhile being -" ignored. Continuation is at the next following line. -"------------------------------------------------------------------------------- - -XpathINIT - -Xpath 1 " X: 1 -while asdf - Xpath 2 " X: 0 - while 1 - Xpath 4 " X: 0 - break - endwhile - Xpath 8 " X: 0 - break -endwhile -Xpath 16 " X: 16 - -while asdf | Xpath 32 | endwhile | Xpath 64 " X: 0 -Xpath 128 " X: 128 - -Xcheck 145 - - -"------------------------------------------------------------------------------- -" Test 14: Failure in argument evaluation for :if {{{1 -" -" A failure in the expression evaluation for the condition of an :if -" does not cause the corresponding :else or :endif being matched to -" a previous :if/:elseif. Neither of both branches of the failed :if -" are executed. -"------------------------------------------------------------------------------- - -XpathINIT -XloopINIT 1 256 - -function! F() - Xloop 1 " X: 1 + 256 * 1 - let x = 0 - if x " false - Xloop 2 " X: 0 + 256 * 0 - elseif !x " always true - Xloop 4 " X: 4 + 256 * 4 - let x = 1 - if g:boolvar " possibly undefined - Xloop 8 " X: 8 + 256 * 0 - else - Xloop 16 " X: 0 + 256 * 0 - endif - Xloop 32 " X: 32 + 256 * 32 - elseif x " never executed - Xloop 64 " X: 0 + 256 * 0 - endif - Xloop 128 " X: 128 + 256 * 128 -endfunction - -let boolvar = 1 -call F() - -XloopNEXT -unlet boolvar -call F() - -delfunction F - -Xcheck 42413 - - -"------------------------------------------------------------------------------- -" Test 15: Failure in argument evaluation for :if (bar) {{{1 -" -" Like previous test, except that the failing :if ... | ... | :endif -" is in a single line. -"------------------------------------------------------------------------------- - -XpathINIT -XloopINIT 1 256 - -function! F() - Xloop 1 " X: 1 + 256 * 1 - let x = 0 - if x " false - Xloop 2 " X: 0 + 256 * 0 - elseif !x " always true - Xloop 4 " X: 4 + 256 * 4 - let x = 1 - if g:boolvar | Xloop 8 | else | Xloop 16 | endif " X: 8 - Xloop 32 " X: 32 + 256 * 32 - elseif x " never executed - Xloop 64 " X: 0 + 256 * 0 - endif - Xloop 128 " X: 128 + 256 * 128 -endfunction - -let boolvar = 1 -call F() - -XloopNEXT -unlet boolvar -call F() - -delfunction F - -Xcheck 42413 - +" Tests 1 to 15 were moved to test_vimscript.vim +let Xtest = 16 "------------------------------------------------------------------------------- " Test 16: Double :else or :elseif after :else {{{1 @@ -5188,19 +4346,19 @@ catch /.*/ Xpath 65536 " X: 65536 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(1, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(1, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') exec "let exception = v:exception" exec "let throwpoint = v:throwpoint" - call CHECK(2, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(2, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') CmdException CmdThrowpoint - call CHECK(3, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(3, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') call FuncException() call FuncThrowpoint() - call CHECK(4, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(4, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') exec "source" scriptException exec "source" scriptThrowPoint - call CHECK(5, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(5, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') try Xpath 131072 " X: 131072 call G("arrgh", 4) @@ -5208,7 +4366,7 @@ catch /.*/ Xpath 262144 " X: 262144 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(6, "arrgh", '\<G\.\.T\>', '\<4\>') + call CHECK(6, "arrgh", '\<G\[1]\.\.T\>', '\<4\>') try Xpath 524288 " X: 524288 let g:arg = "autsch" @@ -5226,7 +4384,7 @@ catch /.*/ Xpath 2097152 " X: 2097152 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(8, "arrgh", '\<G\.\.T\>', '\<4\>') + call CHECK(8, "arrgh", '\<G\[1]\.\.T\>', '\<4\>') try Xpath 4194304 " X: 4194304 let g:arg = "brrrr" @@ -5242,27 +4400,27 @@ catch /.*/ Xpath 16777216 " X: 16777216 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(10, "arrgh", '\<G\.\.T\>', '\<4\>') + call CHECK(10, "arrgh", '\<G\[1]\.\.T\>', '\<4\>') endtry Xpath 33554432 " X: 33554432 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(11, "arrgh", '\<G\.\.T\>', '\<4\>') + call CHECK(11, "arrgh", '\<G\[1]\.\.T\>', '\<4\>') endtry Xpath 67108864 " X: 67108864 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(12, "arrgh", '\<G\.\.T\>', '\<4\>') + call CHECK(12, "arrgh", '\<G\[1]\.\.T\>', '\<4\>') finally Xpath 134217728 " X: 134217728 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(13, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(13, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') endtry Xpath 268435456 " X: 268435456 let exception = v:exception let throwpoint = v:throwpoint - call CHECK(14, "oops", '\<F\.\.G\.\.T\>', '\<2\>') + call CHECK(14, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>') finally Xpath 536870912 " X: 536870912 let exception = v:exception @@ -6591,8 +5749,7 @@ function! F() if !caught && !$VIMNOERRTHROW Xpath 8192 " X: 0 endif - if caught ? !MSG('E55', 'Unmatched \\)') - \ : !MSG('E475', "Invalid argument") + if !MSG('E475', "Invalid argument") Xpath 16384 " X: 0 endif if !caught diff --git a/src/testdir/test5.in b/src/testdir/test5.in deleted file mode 100644 index e19e20d59b..0000000000 --- a/src/testdir/test5.in +++ /dev/null @@ -1,29 +0,0 @@ -Test for autocommand that deletes the current buffer on BufLeave event. -Also test deleting the last buffer, should give a new, empty buffer. - -STARTTEST -:so small.vim -:au BufLeave Xxx bwipe -/start of -:.,/end of/w! Xxx " write test file Xxx -:sp Xxx " split to Xxx -:bwipe " delete buffer Xxx, now we're back here -G?this is a -othis is some more text -: " Append some text to this file -:?start?,$w! test.out " Write current file contents -:bwipe test.out " delete alternate buffer -:au bufleave test5.in bwipe -:bwipe! " delete current buffer, get an empty one -ithis is another test line:w >>test.out -: " append an extra line to the output file -:qa! -ENDTEST - -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test5.ok b/src/testdir/test5.ok deleted file mode 100644 index 6743060794..0000000000 --- a/src/testdir/test5.ok +++ /dev/null @@ -1,9 +0,0 @@ -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -this is some more text -end of test file Xxx -this is another test line diff --git a/src/testdir/test50.in b/src/testdir/test50.in deleted file mode 100644 index 0cbf4bf6d6..0000000000 --- a/src/testdir/test50.in +++ /dev/null @@ -1,90 +0,0 @@ -Test for shortpathname ':8' extension. -Only for use on Win32 systems! - -STARTTEST -:so small.vim -:fun! TestIt(file, bits, expected) - let res=fnamemodify(a:file,a:bits) - if a:expected == '' - echo "'".a:file."'->(".a:bits.")->'".res."'" - else - if substitute(res,'/','\\', 'g') != substitute( a:expected, '/','\\', 'g') - echo "FAILED: '".a:file."'->(".a:bits.")->'".res."'" - echo "Expected: '".a:expected."'" - else - echo "OK" - endif - endif -endfun -:fun! MakeDir( dirname ) - "exe '!mkdir '.substitute(a:dirname,'/','\\','g') - call system('mkdir '.substitute(a:dirname,'/','\\','g')) -endfun -:fun! RMDir( dirname) - "exe '!rmdir '.substitute(a:dirname,'/','\\','g') - call system('rmdir '.substitute(a:dirname,'/','\\','g')) -endfun -:fun! MakeFile( filename) - "exe '!copy nul '.substitute(a:filename,'/','\\','g') - call system('copy nul '.substitute(a:filename,'/','\\','g')) -endfun -:fun! TestColonEight() - redir! >test.out - " This could change for CygWin to //cygdrive/c - let dir1='c:/x.x.y' - if filereadable(dir1) || isdirectory(dir1) - echo "FATAL: '".dir1."' exists, cannot run test" - return - endif - let file1=dir1.'/zz.y.txt' - let nofile1=dir1.'/z.y.txt' - let dir2=dir1.'/VimIsTheGreatestSinceSlicedBread' - let file2=dir2.'/z.txt' - let nofile2=dir2.'/zz.txt' - call MakeDir( dir1 ) - let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '\\$', '', '') - if resdir1 !~ '\V\^c:/XX\x\x\x\x~1.Y\$' - echo "FATAL: unexpected short name: " . resdir1 - echo "INFO: please report your OS to vim-dev" - return - endif - let resfile1=resdir1.'/ZZY~1.TXT' - let resnofile1=resdir1.'/z.y.txt' - let resdir2=resdir1.'/VIMIST~1' - let resfile2=resdir2.'/z.txt' - let resnofile2=resdir2.'/zz.txt' - call MakeDir( dir2 ) - call MakeFile( file1 ) - call MakeFile( file2 ) - call TestIt(file1, ':p:8', resfile1) - call TestIt(nofile1, ':p:8', resnofile1) - call TestIt(file2, ':p:8', resfile2) - call TestIt(nofile2, ':p:8', resnofile2) - call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2,':h')) - exe 'cd '.dir1 - call TestIt(file1, ':.:8', strpart(resfile1,strlen(resdir1)+1)) - call TestIt(nofile1, ':.:8', strpart(resnofile1,strlen(resdir1)+1)) - call TestIt(file2, ':.:8', strpart(resfile2,strlen(resdir1)+1)) - call TestIt(nofile2, ':.:8', strpart(resnofile2,strlen(resdir1)+1)) - let $HOME=dir1 - call TestIt(file1, ':~:8', '~'.strpart(resfile1,strlen(resdir1))) - call TestIt(nofile1, ':~:8', '~'.strpart(resnofile1,strlen(resdir1))) - call TestIt(file2, ':~:8', '~'.strpart(resfile2,strlen(resdir1))) - call TestIt(nofile2, ':~:8', '~'.strpart(resnofile2,strlen(resdir1))) - cd c:/ - call delete( file2 ) - call delete( file1 ) - call RMDir( dir2 ) - call RMDir( dir1 ) - echo - redir END -endfun -:let dir = getcwd() -:call TestColonEight() -:exe "cd " . dir -:edit! test.out -:set ff=dos -:w -:qa! -ENDTEST - diff --git a/src/testdir/test50.ok b/src/testdir/test50.ok deleted file mode 100644 index 91ef1d6604..0000000000 --- a/src/testdir/test50.ok +++ /dev/null @@ -1,14 +0,0 @@ - -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK diff --git a/src/testdir/test51.in b/src/testdir/test51.in deleted file mode 100644 index b4f45d1f75..0000000000 --- a/src/testdir/test51.in +++ /dev/null @@ -1,36 +0,0 @@ -Tests for ":highlight". vim: set ft=vim : - -STARTTEST -:so small.vim -:" basic test if ":highlight" doesn't crash -:highlight -:hi Search -:" test setting colors. -:" test clearing one color and all doesn't generate error or warning -:hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan -:hi Group2 term= cterm= -:hi Group3 term=underline cterm=bold -:redir! >test.out -:hi NewGroup -:hi Group2 -:hi Group3 -:hi clear NewGroup -:hi NewGroup -:hi Group2 -:hi Group2 NONE -:hi Group2 -:hi clear -:hi Group3 -:hi Crash term='asdf -:redir END -:" filter ctermfg and ctermbg, the numbers depend on the terminal -:e test.out -:%s/ctermfg=\d*/ctermfg=2/ -:%s/ctermbg=\d*/ctermbg=3/ -:" filter out possibly translated error message -:%s/E475: [^:]*:/E475:/ -:" fix the fileformat -:set ff& -:wq! -ENDTEST - diff --git a/src/testdir/test51.ok b/src/testdir/test51.ok deleted file mode 100644 index be9ff7862c..0000000000 --- a/src/testdir/test51.ok +++ /dev/null @@ -1,20 +0,0 @@ - - -NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3 - -Group2 xxx cleared - -Group3 xxx term=underline cterm=bold - - -NewGroup xxx cleared - -Group2 xxx cleared - - -Group2 xxx cleared - - -Group3 xxx cleared - -E475: term='asdf diff --git a/src/testdir/test53.in b/src/testdir/test53.in deleted file mode 100644 index 011c9ae39d..0000000000 --- a/src/testdir/test53.in +++ /dev/null @@ -1,123 +0,0 @@ -Tests for string and html text objects. vim: set ft=vim : - -Note that the end-of-line moves the cursor to the next test line. - -Also test match() and matchstr() - -Also test the gn command and repeating it. - -STARTTEST -:so small.vim -/^start:/ -da" -0va'a'rx -02f`da` -0fXdi" -03f'vi'ry -:set quoteescape=+*- -di` -$F"va"oha"i"rz -:" -/^<begin -jfXdit -0fXdit -fXdat -0fXdat -:" -:put =matchstr(\"abcd\", \".\", 0, 2) " b -:put =matchstr(\"abcd\", \"..\", 0, 2) " bc -:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match) -:put =matchstr(\"abcd\", \".\", 0, -1) " a -:put =match(\"abcd\", \".\", 0, 5) " -1 -:put =match(\"abcd\", \".\", 0, -1) " 0 -:put =match('abc', '.', 0, 1) " 0 -:put =match('abc', '.', 0, 2) " 1 -:put =match('abc', '.', 0, 3) " 2 -:put =match('abc', '.', 0, 4) " -1 -:put =match('abc', '.', 1, 1) " 1 -:put =match('abc', '.', 2, 1) " 2 -:put =match('abc', '.', 3, 1) " -1 -:put =match('abc', '$', 0, 1) " 3 -:put =match('abc', '$', 0, 2) " -1 -:put =match('abc', '$', 1, 1) " 3 -:put =match('abc', '$', 2, 1) " 3 -:put =match('abc', '$', 3, 1) " 3 -:put =match('abc', '$', 4, 1) " -1 -:put =match('abc', '\zs', 0, 1) " 0 -:put =match('abc', '\zs', 0, 2) " 1 -:put =match('abc', '\zs', 0, 3) " 2 -:put =match('abc', '\zs', 0, 4) " 3 -:put =match('abc', '\zs', 0, 5) " -1 -:put =match('abc', '\zs', 1, 1) " 1 -:put =match('abc', '\zs', 2, 1) " 2 -:put =match('abc', '\zs', 3, 1) " 3 -:put =match('abc', '\zs', 4, 1) " -1 -/^foobar -gncsearchmatch/one\_s*two\_s -:1 -gnd -/[a]bcdx -:1 -2gnd/join -/$ -0gnd -/\>\zs -0gnd/^ -gnd$h/\zs -gnd/[u]niquepattern/s -vlgnd -/mother -:set selection=exclusive -$cgNmongoose/i -cgnj -:" Make sure there is no other match y uppercase. -/x59 -gggnd -:" test repeating dgn -/^Johnny -ggdgn. -:" test repeating gUgn -/^Depp -gggUgn. -:/^start:/,/^end:/wq! test.out -ENDTEST - -start: "wo\"rd\\" foo -'foo' 'bar' 'piep' -bla bla `quote` blah -out " in "noXno" -"'" 'blah' rep 'buh' -bla `s*`d-`+++`l**` b`la -voo "nah" sdf " asdf" sdf " sdf" sd - -<begin> --<b>asdf<i>Xasdf</i>asdf</b>- --<b>asdX<i>a<i />sdf</i>asdf</b>- --<b>asdf<i>Xasdf</i>asdf</b>- --<b>asdX<i>as<b />df</i>asdf</b>- -</begin> -SEARCH: -foobar -one -two -abcdx | abcdx | abcdx -join -lines -zero width pattern -delete first and last chars -uniquepattern uniquepattern -my very excellent mother just served us nachos -for (i=0; i<=10; i++) -Y -text -Y ---1 -Johnny ---2 -Johnny ---3 -Depp ---4 -Depp ---5 -end: diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok deleted file mode 100644 index d7ffa6bc51..0000000000 --- a/src/testdir/test53.ok +++ /dev/null @@ -1,64 +0,0 @@ -start: foo -xxxxxxxxxxxx'piep' -bla bla blah -out " in "" -"'" 'blah'yyyyy'buh' -bla `` b`la -voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd - -<begin> --<b>asdf<i></i>asdf</b>- --<b></b>- --<b>asdfasdf</b>- --- -</begin> -b -bc -c -a --1 -0 -0 -1 -2 --1 -1 -2 --1 -3 --1 -3 -3 -3 --1 -0 -1 -2 -3 --1 -1 -2 -3 --1 -SEARCH: -searchmatch -abcdx | | abcdx -join lines -zerowidth pattern -elete first and last char - uniquepattern -my very excellent mongoose just served us nachos -for (j=0; i<=10; i++) - -text -Y ---1 - ---2 - ---3 -DEPP ---4 -DEPP ---5 -end: diff --git a/src/testdir/test54.in b/src/testdir/test54.in deleted file mode 100644 index 9fc6537e08..0000000000 --- a/src/testdir/test54.in +++ /dev/null @@ -1,22 +0,0 @@ -Some tests for buffer-local autocommands - -STARTTEST -:so small.vim -:e xx -:if has("vms") -: !del test.out.* -: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out -:else -: !rm -f test.out -: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out -:endif -:e somefile " here, autocommand for xx shall write test.out -: " but autocommand shall not apply to buffer named <buffer> -:bwipe xx " here, autocommand shall be auto-deleted -:e xx " nothing shall be written -:e somefile " nothing shall be written -:qa! -ENDTEST - -start of test file xx -end of test file xx diff --git a/src/testdir/test54.ok b/src/testdir/test54.ok deleted file mode 100644 index 0fd1dc915b..0000000000 --- a/src/testdir/test54.ok +++ /dev/null @@ -1 +0,0 @@ -buffer-local autommand in xx diff --git a/src/testdir/test55.in b/src/testdir/test55.in deleted file mode 100644 index 8e073f30f2..0000000000 --- a/src/testdir/test55.in +++ /dev/null @@ -1,410 +0,0 @@ -Tests for List and Dictionary types. vim: set ft=vim : - -STARTTEST -:so small.vim -:fun Test(...) -:lang C -:" Creating List directly with different types -:let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] -:$put =string(l) -:$put =string(l[-1]) -:$put =string(l[-4]) -:try -: $put =string(l[-5]) -:catch -: $put =v:exception[:14] -:endtry -:" List slices -:$put =string(l[:]) -:$put =string(l[1:]) -:$put =string(l[:-2]) -:$put =string(l[0:8]) -:$put =string(l[8:-1]) -:" -:" List identity -:let ll = l -:let lx = copy(l) -:try -: $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) . (l is lx) . (l isnot lx) -:catch -: $put =v:exception -:endtry -:" -:" Creating Dictionary directly with different types -:let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} -:$put =string(d) . d.1 -:$put =string(sort(keys(d))) -:$put =string (values(d)) -:for [key, val] in items(d) -: $put =key . ':' . string(val) -: unlet key val -:endfor -:call extend (d, {3:33, 1:99}) -:call extend(d, {'b':'bbb', 'c':'ccc'}, "keep") -:try -: call extend(d, {3:333,4:444}, "error") -:catch -: $put =v:exception[:15] . v:exception[-1:-1] -:endtry -:$put =string(d) -:call filter(d, 'v:key =~ ''[ac391]''') -:$put =string(d) -:" -:" Dictionary identity -:let dd = d -:let dx = copy(d) -:try -: $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) . (d isnot dx) -:catch -: $put =v:exception -:endtry -:" -:" Changing var type should fail -:try -: let d = [] -:catch -: $put =v:exception[:14] . v:exception[-1:-1] -:endtry -:try -: let l = {} -:catch -: $put =v:exception[:14] . v:exception[-1:-1] -:endtry -:" -:" removing items with :unlet -:unlet l[2] -:$put =string(l) -:let l = range(8) -:try -:unlet l[:3] -:unlet l[1:] -:catch -:$put =v:exception -:endtry -:$put =string(l) -:" -:unlet d.c -:unlet d[-1] -:$put =string(d) -:" -:" removing items out of range: silently skip items that don't exist -let l = [0, 1, 2, 3] -:unlet l[2:1] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[2:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[2:3] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[2:4] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[2:5] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-1:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-2:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-3:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-4:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-5:2] -:$put =string(l) -let l = [0, 1, 2, 3] -:unlet l[-6:2] -:$put =string(l) -:" -:" assignment to a list -:let l = [0, 1, 2, 3] -:let [va, vb] = l[2:3] -:$put =va -:$put =vb -:try -: let [va, vb] = l -:catch -: $put =v:exception[:14] -:endtry -:try -: let [va, vb] = l[1:1] -:catch -: $put =v:exception[:14] -:endtry -:" -:" manipulating a big Dictionary (hashtable.c has a border of 1000 entries) -:let d = {} -:for i in range(1500) -: let d[i] = 3000 - i -:endfor -:$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . d[1499] -:try -: let n = d[1500] -:catch -: $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') -:endtry -:" lookup each items -:for i in range(1500) -: if d[i] != 3000 - i -: $put =d[i] -: endif -:endfor -: let i += 1 -:" delete even items -:while i >= 2 -: let i -= 2 -: unlet d[i] -:endwhile -:$put =get(d, 1500 - 100, 'NONE') . ' ' . d[1] -:" delete odd items, checking value, one intentionally wrong -:let d[33] = 999 -:let i = 1 -:while i < 1500 -: if d[i] != 3000 - i -: $put =i . '=' . d[i] -: else -: unlet d[i] -: endif -: let i += 2 -:endwhile -:$put =string(d) " must be almost empty now -:unlet d -:" -:" Dictionary function -:let dict = {} -:func dict.func(a) dict -: $put =a:a . len(self.data) -:endfunc -:let dict.data = [1,2,3] -:call dict.func("len: ") -:let x = dict.func("again: ") -:try -: let Fn = dict.func -: call Fn('xxx') -:catch -: $put =v:exception[:15] -:endtry -:" -:" Function in script-local List or Dict -:let g:dict = {} -:function g:dict.func() dict -: $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf') -:endfunc -:let g:dict.foo = ['-', 2, 3] -:call insert(g:dict.foo, function('strlen')) -:call g:dict.func() -:" -:" Nasty: remove func from Dict that's being called (works) -:let d = {1:1} -:func d.func(a) -: return "a:". a:a -:endfunc -:$put =d.func(string(remove(d, 'func'))) -:" -:" Nasty: deepcopy() dict that refers to itself (fails when noref used) -:let d = {1:1, 2:2} -:let l = [4, d, 6] -:let d[3] = l -:let dc = deepcopy(d) -:try -: let dc = deepcopy(d, 1) -:catch -: $put =v:exception[:14] -:endtry -:let l2 = [0, l, l, 3] -:let l[1] = l2 -:let l3 = deepcopy(l2) -:$put ='same list: ' . (l3[1] is l3[2]) -:" -:" Locked variables -:for depth in range(5) -: $put ='depth is ' . depth -: for u in range(3) -: unlet l -: let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] -: exe "lockvar " . depth . " l" -: if u == 1 -: exe "unlockvar l" -: elseif u == 2 -: exe "unlockvar " . depth . " l" -: endif -: let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]") -: $put =ps -: let ps = '' -: try -: let l[1][1][0] = 99 -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l[1][1] = [99] -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l[1] = [99] -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l[2]['6'][7] = 99 -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l[2][6] = {99: 99} -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l[2] = {99: 99} -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: try -: let l = [99] -: let ps .= 'p' -: catch -: let ps .= 'F' -: endtry -: $put =ps -: endfor -:endfor -:" :lockvar/islocked() triggering script autoloading -:set rtp+=./sautest -:lockvar g:footest#x -:unlockvar g:footest#x -:$put ='locked g:footest#x:'.islocked('g:footest#x') -:$put ='exists g:footest#x:'.exists('g:footest#x') -:$put ='g:footest#x: '.g:footest#x -:" -:" a:000 function argument -:" first the tests that should fail -:try -: let a:000 = [1, 2] -:catch -: $put ='caught a:000' -:endtry -:try -: let a:000[0] = 9 -:catch -: $put ='caught a:000[0]' -:endtry -:try -: let a:000[2] = [9, 10] -:catch -: $put ='caught a:000[2]' -:endtry -:try -: let a:000[3] = {9: 10} -:catch -: $put ='caught a:000[3]' -:endtry -:" now the tests that should pass -:try -: let a:000[2][1] = 9 -: call extend(a:000[2], [5, 6]) -: let a:000[3][5] = 8 -: let a:000[3]['a'] = 12 -: $put =string(a:000) -:catch -: $put ='caught ' . v:exception -:endtry -:" -:" reverse(), sort(), uniq() -:let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5] -:$put =string(uniq(copy(l))) -:$put =string(reverse(l)) -:$put =string(reverse(reverse(l))) -:$put =string(sort(l)) -:$put =string(reverse(sort(l))) -:$put =string(sort(reverse(sort(l)))) -:$put =string(uniq(sort(l))) -:let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four'] -:$put =string(sort(copy(l), 'n')) -:let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] -:$put =string(sort(copy(l), 1)) -:$put =string(sort(copy(l), 'i')) -:$put =string(sort(copy(l))) -:" -:" splitting a string to a List -:$put =string(split(' aa bb ')) -:$put =string(split(' aa bb ', '\W\+', 0)) -:$put =string(split(' aa bb ', '\W\+', 1)) -:$put =string(split(' aa bb ', '\W', 1)) -:$put =string(split(':aa::bb:', ':', 0)) -:$put =string(split(':aa::bb:', ':', 1)) -:$put =string(split('aa,,bb, cc,', ',\s*', 1)) -:$put =string(split('abc', '\zs')) -:$put =string(split('abc', '\zs', 1)) -:" -:" compare recursively linked list and dict -:let l = [1, 2, 3, 4] -:let d = {'1': 1, '2': l, '3': 3} -:let l[1] = d -:$put =(l == l) -:$put =(d == d) -:$put =(l != deepcopy(l)) -:$put =(d != deepcopy(d)) -:" -:" compare complex recursively linked list and dict -:let l = [] -:call add(l, l) -:let dict4 = {"l": l} -:call add(dict4.l, dict4) -:let lcopy = deepcopy(l) -:let dict4copy = deepcopy(dict4) -:$put =(l == lcopy) -:$put =(dict4 == dict4copy) -:" -:" Pass the same List to extend() -:let l = [1, 2, 3, 4, 5] -:call extend(l, l) -:$put =string(l) -:" -:" Pass the same Dict to extend() -:let d = { 'a': {'b': 'B'}} -:call extend(d, d) -:$put =string(d) -:" -:" Pass the same Dict to extend() with "error" -:try -: call extend(d, d, "error") -:catch -: $put =v:exception[:15] . v:exception[-1:-1] -:endtry -:$put =string(d) -:endfun -:" -:call Test(1, 2, [3, 4], {5: 6}) " This may take a while -:" -:delfunc Test -:unlet dict -:call garbagecollect(1) -:" -:" test for patch 7.3.637 -:let a = 'No error caught' -:try|foldopen|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry -o=a :" -:lang C -:redir => a -:try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry -:redir END -o=a :" -:" -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok deleted file mode 100644 index dfd8060db7..0000000000 --- a/src/testdir/test55.ok +++ /dev/null @@ -1,132 +0,0 @@ -start: -[1, 'as''d', [1, 2, function('strlen')], {'a': 1}] -{'a': 1} -1 -Vim(put):E684: -[1, 'as''d', [1, 2, function('strlen')], {'a': 1}] -['as''d', [1, 2, function('strlen')], {'a': 1}] -[1, 'as''d', [1, 2, function('strlen')]] -[1, 'as''d', [1, 2, function('strlen')], {'a': 1}] -[] -101101 -{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd -['-1', '1', 'b'] -['asd', [1, 2, function('strlen')], {'a': 1}] -1:'asd' -b:[1, 2, function('strlen')] --1:{'a': 1} -Vim(call):E737: 3 -{'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}} -{'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}} -101101 -Vim(let):E706: d -Vim(let):E706: l -[1, 'as''d', {'a': 1}] -[4] -{'1': 99, '3': 33} -[0, 1, 2, 3] -[0, 1, 3] -[0, 1] -[0, 1] -[0, 1] -[0, 1, 2, 3] -[0, 1, 3] -[0, 3] -[3] -[3] -[3] -2 -3 -Vim(let):E687: -Vim(let):E688: -3000 2900 2001 1600 1501 -Vim(let):E716: 1500 -NONE 2999 -33=999 -{'33': 999} -len: 3 -again: 3 -Vim(call):E725: -g:dict.func-4 -a:function('3') -Vim(let):E698: -same list: 1 -depth is 0 -0000-000 -ppppppp -0000-000 -ppppppp -0000-000 -ppppppp -depth is 1 -1000-000 -ppppppF -0000-000 -ppppppp -0000-000 -ppppppp -depth is 2 -1100-100 -ppFppFF -0000-000 -ppppppp -0000-000 -ppppppp -depth is 3 -1110-110 -pFFpFFF -0010-010 -pFppFpp -0000-000 -ppppppp -depth is 4 -1111-111 -FFFFFFF -0011-011 -FFpFFpp -0000-000 -ppppppp -locked g:footest#x:-1 -exists g:footest#x:0 -g:footest#x: 1 -caught a:000 -caught a:000[0] -caught a:000[2] -caught a:000[3] -[1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}] -['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5] -[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'] -[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'] -['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]] -[[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'] -['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]] -['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]] -[-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255] -['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}] -['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}] -['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}] -['aa', 'bb'] -['aa', 'bb'] -['', 'aa', 'bb', ''] -['', '', 'aa', '', 'bb', '', ''] -['aa', '', 'bb'] -['', 'aa', '', 'bb', ''] -['aa', '', 'bb', 'cc', ''] -['a', 'b', 'c'] -['', 'a', '', 'b', '', 'c', ''] -1 -1 -0 -0 -1 -1 -[1, 2, 3, 4, 5, 1, 2, 3, 4, 5] -{'a': {'b': 'B'}} -Vim(call):E737: a -{'a': {'b': 'B'}} -Vim(foldopen):E490: - - -Error detected while processing : -E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry - diff --git a/src/testdir/test56.in b/src/testdir/test56.in deleted file mode 100644 index 311a6004ca..0000000000 --- a/src/testdir/test56.in +++ /dev/null @@ -1,21 +0,0 @@ -Test for script-local function. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:set nocp viminfo+=nviminfo -:/^start:/+1,/^end:/-1w! Xtest.vim -:source Xtest.vim -_x -:$-1,$wq! test.out -ENDTEST - -start: -fun <SID>DoLast() - call append(line('$'), "last line") -endfun -fun s:DoNothing() - call append(line('$'), "nothing line") -endfun -nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> -end: diff --git a/src/testdir/test56.ok b/src/testdir/test56.ok deleted file mode 100644 index f2b0d33c8b..0000000000 --- a/src/testdir/test56.ok +++ /dev/null @@ -1,2 +0,0 @@ -nothing line -last line diff --git a/src/testdir/test57.in b/src/testdir/test57.in deleted file mode 100644 index 8d972e4a68..0000000000 --- a/src/testdir/test57.in +++ /dev/null @@ -1,500 +0,0 @@ -Tests for :sort command. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:/^t01:/+1,/^t02/-1sort -:/^t02:/+1,/^t03/-1sort n -:/^t03:/+1,/^t04/-1sort x -:/^t04:/+1,/^t05/-1sort u -:/^t05:/+1,/^t06/-1sort! -:/^t06:/+1,/^t07/-1sort! n -:/^t07:/+1,/^t08/-1sort! u -:/^t08:/+1,/^t09/-1sort o -:/^t09:/+1,/^t10/-1sort! x -:/^t10:/+1,/^t11/-1sort/./ -:/^t11:/+1,/^t12/-1sort/../ -:/^t12:/+1,/^t13/-1sort/../u -:/^t13:/+1,/^t14/-1sort/./n -:/^t14:/+1,/^t15/-1sort/./r -:/^t15:/+1,/^t16/-1sort/../r -:/^t16:/+1,/^t17/-1sort/./rn -:/^t17:/+1,/^t18/-1sort/\d/ -:/^t18:/+1,/^t19/-1sort/\d/r -:/^t19:/+1,/^t20/-1sort/\d/n -:/^t20:/+1,/^t21/-1sort/\d/rn -:/^t21:/+1,/^t22/-1sort/\d\d/ -:/^t22:/+1,/^t23/-1sort/\d\d/n -:/^t23:/+1,/^t24/-1sort/\d\d/x -:/^t24:/+1,/^t25/-1sort/\d\d/r -:/^t25:/+1,/^t26/-1sort/\d\d/rn -:/^t26:/+1,/^t27/-1sort/\d\d/rx -:/^t27:/+1,/^t28/-1sort no -:/^t01:/,$wq! test.out -ENDTEST - -t01: alphebetical -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t02: numeric -abc -ab -a321 -a123 -a122 -a -x-22 -b321 -b123 - -c123d --24 - 123b -c321d -0 -b322b -b321 -b321b - - -t03: hexadecimal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t04: alpha, unique -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t05: alpha, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t06: numeric, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t07: unique, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t08: octal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t09: reverse, hexadecimal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t10: alpha, skip first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t11: alpha, skip first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t12: alpha, unique, skip first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t13: numeric, skip first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t14: alpha, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t15: alpha, sort on first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t16: numeric, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t17: alpha, skip past first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t18: alpha, sort on first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t19: numeric, skip past first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t20: numeric, sort on first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t21: alpha, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t22: numeric, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t23: hexadecimal, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t24: alpha, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t25: numeric, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t26: hexadecimal, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t27: wrong arguments -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t28: done - diff --git a/src/testdir/test57.ok b/src/testdir/test57.ok deleted file mode 100644 index aa3d373183..0000000000 --- a/src/testdir/test57.ok +++ /dev/null @@ -1,459 +0,0 @@ -t01: alphebetical - - - 123b -a -a122 -a123 -a321 -ab -abc -b123 -b321 -b321 -b321b -b322b -c123d -c321d -t02: numeric -abc -ab -a - - - --24 -x-22 -0 -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t03: hexadecimal - - -a -ab -abc - 123b -a122 -a123 -a321 -b123 -b321 -b321 -b321b -b322b -c123d -c321d -t04: alpha, unique - - 123b -a -a122 -a123 -a321 -ab -abc -b123 -b321 -b321b -b322b -c123d -c321d -t05: alpha, reverse -c321d -c123d -b322b -b321b -b321 -b321 -b123 -abc -ab -a321 -a123 -a122 -a - 123b - - -t06: numeric, reverse -b322b -b321b -b321 -c321d -b321 -a321 - 123b -c123d -b123 -a123 -a122 - - -a -ab -abc -t07: unique, reverse -c321d -c123d -b322b -b321b -b321 -b123 -abc -ab -a321 -a123 -a122 -a - 123b - -t08: octal -abc -ab -a - - -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t09: reverse, hexadecimal -c321d -c123d -b322b -b321b -b321 -b321 -b123 -a321 -a123 -a122 - 123b -abc -ab -a - - -t10: alpha, skip first character -a - - -a122 -a123 -b123 - 123b -c123d -a321 -b321 -b321 -b321b -c321d -b322b -ab -abc -t11: alpha, skip first 2 characters -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -abc -t12: alpha, unique, skip first 2 characters -ab -a - -a321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -abc -t13: numeric, skip first character -abc -ab -a - - -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t14: alpha, sort on first character - - - 123b -abc -ab -a -a321 -a123 -a122 -b321 -b123 -b322b -b321 -b321b -c123d -c321d -t15: alpha, sort on first 2 characters -a - - - 123b -a123 -a122 -a321 -abc -ab -b123 -b321 -b322b -b321 -b321b -c123d -c321d -t16: numeric, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t17: alpha, skip past first digit -abc -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -t18: alpha, sort on first digit -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t19: numeric, skip past first digit -abc -ab -a - - -a321 -b321 -c321d -b321 -b321b -a122 -b322b -a123 -b123 -c123d - 123b -t20: numeric, sort on first digit -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t21: alpha, skip past first 2 digits -abc -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -t22: numeric, skip past first 2 digits -abc -ab -a - - -a321 -b321 -c321d -b321 -b321b -a122 -b322b -a123 -b123 -c123d - 123b -t23: hexadecimal, skip past first 2 digits -abc -ab -a - - -a321 -b321 -b321 -a122 -a123 -b123 -b321b -c321d -b322b - 123b -c123d -t24: alpha, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t25: numeric, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t26: hexadecimal, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t27: wrong arguments -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t28: done - diff --git a/src/testdir/test58.in b/src/testdir/test58.in deleted file mode 100644 index cef1cfa1ba..0000000000 --- a/src/testdir/test58.in +++ /dev/null @@ -1,639 +0,0 @@ -Tests for spell checking. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:" Don't want to depend on the locale from the environment -:set enc=latin1 -:e! -:" -:" Check using z= in new buffer (crash fixed by patch 7.4a.028). -:set maxmem=512 spell -iasdz=:" -:" -:" Function to test .aff/.dic with list of good and bad words. -:func TestOne(aff, dic) - set spellfile= - $put ='' - $put ='test '. a:aff . '-' . a:dic - " Generate a .spl file from a .dic and .aff file. - exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff' - exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic' - mkspell! Xtest Xtest - " use that spell file - set spl=Xtest.latin1.spl spell - " list all valid words - spelldump - %yank - quit - $put - $put ='-------' - " find all bad words and suggestions for them - exe '1;/^' . a:aff . 'good:' - normal 0f:]s - let prevbad = '' - while 1 - let [bad, a] = spellbadword() - if bad == '' || bad == prevbad || bad == 'badend' - break - endif - let prevbad = bad - let lst = spellsuggest(bad, 3) - normal mm - $put =bad - $put =string(lst) - normal `m]s - endwhile -endfunc -:" -:call TestOne('1', '1') -:$put =soundfold('goobledygoook') -:$put =soundfold('koprnven') -:$put =soundfold('oeverloos gezwets edale') -:" -:" -:" and now with SAL instead of SOFO items; test automatic reloading -gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff -:mkspell! Xtest Xtest -:$put =soundfold('goobledygoook') -:$put =soundfold('koprnven') -:$put =soundfold('oeverloos gezwets edale') -:" -:" also use an addition file -gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add -:mkspell! Xtest.latin1.add.spl Xtest.latin1.add -:set spellfile=Xtest.latin1.add -/^test2: -]s:let [str, a] = spellbadword() -:$put =str -:set spl=Xtest_us.latin1.spl -/^test2: -]smm:let [str, a] = spellbadword() -:$put =str -`m]s:let [str, a] = spellbadword() -:$put =str -:set spl=Xtest_gb.latin1.spl -/^test2: -]smm:let [str, a] = spellbadword() -:$put =str -`m]s:let [str, a] = spellbadword() -:$put =str -:set spl=Xtest_nz.latin1.spl -/^test2: -]smm:let [str, a] = spellbadword() -:$put =str -`m]s:let [str, a] = spellbadword() -:$put =str -:set spl=Xtest_ca.latin1.spl -/^test2: -]smm:let [str, a] = spellbadword() -:$put =str -`m]s:let [str, a] = spellbadword() -:$put =str -:unlet str a -:" -:" Postponed prefixes -:call TestOne('2', '1') -:" -:" Compound words -:call TestOne('3', '3') -:call TestOne('4', '4') -:call TestOne('5', '5') -:call TestOne('6', '6') -:call TestOne('7', '7') -:" -:" NOSLITSUGS -:call TestOne('8', '8') -:" -:" clean up for valgrind -:delfunc TestOne -:set spl= enc=latin1 -:" -gg:/^test output:/,$wq! test.out -ENDTEST - -1affstart -SET ISO8859-1 -TRY esianrtolcdugmphbyfvkwjkqxz-'ESIANRTOLCDUGMPHBYFVKWJKQXZ - -FOL -LOW -UPP - -SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ޿ -SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep? - -MIDWORD '- - -KEP = -RAR ? -BAD ! - -PFX I N 1 -PFX I 0 in . - -PFX O Y 1 -PFX O 0 out . - -SFX S Y 2 -SFX S 0 s [^s] -SFX S 0 es s - -SFX N N 3 -SFX N 0 en [^n] -SFX N 0 nen n -SFX N 0 n . - -REP 3 -REP g ch -REP ch g -REP svp s.v.p. - -MAP 9 -MAP a -MAP e -MAP i -MAP o -MAP u -MAP n -MAP c -MAP y -MAP s -1affend - -1good: wrong OK puts. Test the end -bad: inputs comment ok Ok. test dl end the -badend - -1dicstart -123456 -test/NO -# comment -wrong -Comment -OK -uk -put/ISO -the end -deol -dr -1dicend - -affstart_sal -SET ISO8859-1 -TRY esianrtolcdugmphbyfvkwjkqxz-'ESIANRTOLCDUGMPHBYFVKWJKQXZ - -FOL -LOW -UPP - -MIDWORD '- - -KEP = -RAR ? -BAD ! - -PFX I N 1 -PFX I 0 in . - -PFX O Y 1 -PFX O 0 out . - -SFX S Y 2 -SFX S 0 s [^s] -SFX S 0 es s - -SFX N N 3 -SFX N 0 en [^n] -SFX N 0 nen n -SFX N 0 n . - -REP 3 -REP g ch -REP ch g -REP svp s.v.p. - -MAP 9 -MAP a -MAP e -MAP i -MAP o -MAP u -MAP n -MAP c -MAP y -MAP s - -SAL AH(AEIOUY)-^ *H -SAL AR(AEIOUY)-^ *R -SAL A(HR)^ * -SAL A^ * -SAL AH(AEIOUY)- H -SAL AR(AEIOUY)- R -SAL A(HR) _ -SAL ^ * -SAL ^ * -SAL BB- _ -SAL B B -SAL CQ- _ -SAL CIA X -SAL CH X -SAL C(EIY)- S -SAL CK K -SAL COUGH^ KF -SAL CC< C -SAL C K -SAL DG(EIY) K -SAL DD- _ -SAL D T -SAL < E -SAL EH(AEIOUY)-^ *H -SAL ER(AEIOUY)-^ *R -SAL E(HR)^ * -SAL ENOUGH^$ *NF -SAL E^ * -SAL EH(AEIOUY)- H -SAL ER(AEIOUY)- R -SAL E(HR) _ -SAL FF- _ -SAL F F -SAL GN^ N -SAL GN$ N -SAL GNS$ NS -SAL GNED$ N -SAL GH(AEIOUY)- K -SAL GH _ -SAL GG9 K -SAL G K -SAL H H -SAL IH(AEIOUY)-^ *H -SAL IR(AEIOUY)-^ *R -SAL I(HR)^ * -SAL I^ * -SAL ING6 N -SAL IH(AEIOUY)- H -SAL IR(AEIOUY)- R -SAL I(HR) _ -SAL J K -SAL KN^ N -SAL KK- _ -SAL K K -SAL LAUGH^ LF -SAL LL- _ -SAL L L -SAL MB$ M -SAL MM M -SAL M M -SAL NN- _ -SAL N N -SAL OH(AEIOUY)-^ *H -SAL OR(AEIOUY)-^ *R -SAL O(HR)^ * -SAL O^ * -SAL OH(AEIOUY)- H -SAL OR(AEIOUY)- R -SAL O(HR) _ -SAL PH F -SAL PN^ N -SAL PP- _ -SAL P P -SAL Q K -SAL RH^ R -SAL ROUGH^ RF -SAL RR- _ -SAL R R -SAL SCH(EOU)- SK -SAL SC(IEY)- S -SAL SH X -SAL SI(AO)- X -SAL SS- _ -SAL S S -SAL TI(AO)- X -SAL TH @ -SAL TCH-- _ -SAL TOUGH^ TF -SAL TT- _ -SAL T T -SAL UH(AEIOUY)-^ *H -SAL UR(AEIOUY)-^ *R -SAL U(HR)^ * -SAL U^ * -SAL UH(AEIOUY)- H -SAL UR(AEIOUY)- R -SAL U(HR) _ -SAL V^ W -SAL V F -SAL WR^ R -SAL WH^ W -SAL W(AEIOU)- W -SAL X^ S -SAL X KS -SAL Y(AEIOU)- Y -SAL ZZ- _ -SAL Z S -affend_sal - -2affstart -SET ISO8859-1 - -FOL -LOW -UPP - -PFXPOSTPONE - -MIDWORD '- - -KEP = -RAR ? -BAD ! - -PFX I N 1 -PFX I 0 in . - -PFX O Y 1 -PFX O 0 out [a-z] - -SFX S Y 2 -SFX S 0 s [^s] -SFX S 0 es s - -SFX N N 3 -SFX N 0 en [^n] -SFX N 0 nen n -SFX N 0 n . - -REP 3 -REP g ch -REP ch g -REP svp s.v.p. - -MAP 9 -MAP a -MAP e -MAP i -MAP o -MAP u -MAP n -MAP c -MAP y -MAP s -2affend - -2good: puts -bad: inputs comment ok Ok end the. test dl -badend - -addstart -/regions=usgbnz -elequint/2 -elekwint/3 -addend - -test2: -elequint test elekwint test elekwent asdf - -Test rules for compounding. - -3affstart -SET ISO8859-1 - -COMPOUNDMIN 3 -COMPOUNDRULE m* -NEEDCOMPOUND x -3affend - -3dicstart -1234 -foo/m -bar/mx -m/m -la/mx -3dicend - -3good: foo m foobar foofoobar barfoo barbarfoo -bad: bar la foom barm mfoo mbar mm lala mla lam foola labar -badend - - -Tests for compounding. - -4affstart -SET ISO8859-1 - -FOL -LOW -UPP - -COMPOUNDRULE m+ -COMPOUNDRULE sm*e -COMPOUNDRULE sm+ -COMPOUNDMIN 3 -COMPOUNDWORDMAX 3 -COMPOUNDFORBIDFLAG t - -COMPOUNDSYLMAX 5 -SYLLABLE aeiouy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui - -MAP 9 -MAP a -MAP e -MAP i -MAP o -MAP u -MAP n -MAP c -MAP y -MAP s - -NEEDAFFIX x - -PFXPOSTPONE - -MIDWORD '- - -SFX q N 1 -SFX q 0 -ok . - -SFX a Y 2 -SFX a 0 s . -SFX a 0 ize/t . - -PFX p N 1 -PFX p 0 pre . - -PFX P N 1 -PFX P 0 nou . -4affend - -4dicstart -1234 -word/mP -util/am -pro/xq -tomato/m -bork/mp -start/s -end/e -4dicend - -4good: word util bork prebork start end wordutil wordutils pro-ok - bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork - tomato tomatotomato startend startword startwordword startwordend - startwordwordend startwordwordwordend prebork preborkbork - preborkborkbork - nouword -bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato - endstart endend startstart wordend wordstart - preborkprebork preborkpreborkbork - startwordwordwordwordend borkpreborkpreborkbork - utilsbork startnouword -badend - -Test affix flags with two characters - -5affstart -SET ISO8859-1 - -FLAG long - -NEEDAFFIX !! - -COMPOUNDRULE ssmm*ee - -NEEDCOMPOUND xx -COMPOUNDPERMITFLAG pp - -SFX 13 Y 1 -SFX 13 0 bork . - -SFX a1 Y 1 -SFX a1 0 a1 . - -SFX a Y 1 -SFX a 0 a . - -PFX zz Y 1 -PFX zz 0 pre/pp . - -PFX yy Y 1 -PFX yy 0 nou . -5affend - -5dicstart -1234 -foo/a1a!! -bar/zz13ee -start/ss -end/eeyy -middle/mmxx -5dicend - -5good: fooa1 fooa bar prebar barbork prebarbork startprebar - start end startend startmiddleend nouend -bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart - startprobar startnouend -badend - -6affstart -SET ISO8859-1 - -FLAG caplong - -NEEDAFFIX A! - -COMPOUNDRULE sMm*Ee - -NEEDCOMPOUND Xx - -COMPOUNDPERMITFLAG p - -SFX N3 Y 1 -SFX N3 0 bork . - -SFX A1 Y 1 -SFX A1 0 a1 . - -SFX A Y 1 -SFX A 0 a . - -PFX Zz Y 1 -PFX Zz 0 pre/p . -6affend - -6dicstart -1234 -mee/A1AA! -bar/ZzN3Ee -lead/s -end/Ee -middle/MmXx -6dicend - -6good: meea1 meea bar prebar barbork prebarbork leadprebar - lead end leadend leadmiddleend -bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead - leadprobar -badend - -7affstart -SET ISO8859-1 - -FLAG num - -NEEDAFFIX 9999 - -COMPOUNDRULE 2,77*123 - -NEEDCOMPOUND 1 -COMPOUNDPERMITFLAG 432 - -SFX 61003 Y 1 -SFX 61003 0 meat . - -SFX 391 Y 1 -SFX 391 0 a1 . - -SFX 111 Y 1 -SFX 111 0 a . - -PFX 17 Y 1 -PFX 17 0 pre/432 . -7affend - -7dicstart -1234 -mee/391,111,9999 -bar/17,61003,123 -lead/2 -tail/123 -middle/77,1 -7dicend - -7good: meea1 meea bar prebar barmeat prebarmeat leadprebar - lead tail leadtail leadmiddletail -bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead - leadprobar -badend - -Test NOSLITSUGS - -8affstart -SET ISO8859-1 - -NOSPLITSUGS -8affend - -8dicstart -1234 -foo -bar -faabar -8dicend - -8good: foo bar faabar -bad: foobar barfoo -badend - - -test output: diff --git a/src/testdir/test58.ok b/src/testdir/test58.ok deleted file mode 100644 index ce05c73322..0000000000 --- a/src/testdir/test58.ok +++ /dev/null @@ -1,283 +0,0 @@ -test output: - -test 1-1 -# file: Xtest.latin1.spl -Comment -deol -dr -input -OK -output -outputs -outtest -put -puts -test -testen -testn -the end -uk -wrong -------- -bad -['put', 'uk', 'OK'] -inputs -['input', 'puts', 'outputs'] -comment -['Comment', 'outtest', 'the end'] -ok -['OK', 'uk', 'put'] -Ok -['OK', 'Uk', 'Put'] -test -['Test', 'testn', 'testen'] -dl -['deol', 'dr', 'test'] -end -['put', 'uk', 'test'] -the -['put', 'uk', 'test'] -gebletegek -kepereneven -everles gesvets etele -kbltykk -kprnfn -*fls kswts tl -elekwent -elequint -elekwint -elekwint -elekwent -elequint -elekwent -elequint -elekwint - -test 2-1 -# file: Xtest.latin1.spl -Comment -deol -dr -OK -put -input -output -puts -outputs -test -outtest -testen -testn -the end -uk -wrong -------- -bad -['put', 'uk', 'OK'] -inputs -['input', 'puts', 'outputs'] -comment -['Comment'] -ok -['OK', 'uk', 'put'] -Ok -['OK', 'Uk', 'Put'] -end -['put', 'uk', 'deol'] -the -['put', 'uk', 'test'] -test -['Test', 'testn', 'testen'] -dl -['deol', 'dr', 'test'] - -test 3-3 -# file: Xtest.latin1.spl -foo -m -------- -bad -['foo', 'm'] -bar -['barfoo', 'foobar', 'foo'] -la -['m', 'foo'] -foom -['foo m', 'foo', 'foofoo'] -barm -['barfoo', 'm', 'barbar'] -mfoo -['m foo', 'foo', 'foofoo'] -mbar -['foobar', 'barbar', 'm'] -mm -['m m', 'm'] -lala -[] -mla -['m', 'm m'] -lam -['m', 'm m'] -foola -['foo', 'foobar', 'foofoo'] -labar -['barbar', 'foobar'] - -test 4-4 -# file: Xtest.latin1.spl -bork -prebork -end -pro-ok -start -tomato -util -utilize -utils -word -nouword -------- -bad -['end', 'bork', 'word'] -wordutilize -['word utilize', 'wordutils', 'wordutil'] -pro -['bork', 'word', 'end'] -borkborkborkborkborkbork -['bork borkborkborkborkbork', 'borkbork borkborkborkbork', 'borkborkbork borkborkbork'] -tomatotomatotomato -['tomato tomatotomato', 'tomatotomato tomato', 'tomato tomato tomato'] -endstart -['end start', 'start'] -endend -['end end', 'end'] -startstart -['start start'] -wordend -['word end', 'word', 'wordword'] -wordstart -['word start', 'bork start'] -preborkprebork -['prebork prebork', 'preborkbork', 'preborkborkbork'] -preborkpreborkbork -['prebork preborkbork', 'preborkborkbork', 'preborkborkborkbork'] -startwordwordwordwordend -['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end'] -borkpreborkpreborkbork -['bork preborkpreborkbork', 'bork prebork preborkbork', 'bork preborkprebork bork'] -utilsbork -['utilbork', 'utils bork', 'util bork'] -startnouword -['start nouword', 'startword', 'startborkword'] - -test 5-5 -# file: Xtest.latin1.spl -bar -barbork -end -fooa1 -fooa -nouend -prebar -prebarbork -start -------- -bad -['bar', 'end', 'fooa1'] -foo -['fooa1', 'fooa', 'bar'] -fooa2 -['fooa1', 'fooa', 'bar'] -prabar -['prebar', 'bar', 'bar bar'] -probarbirk -['prebarbork'] -middle -[] -startmiddle -['startmiddleend', 'startmiddlebar'] -middleend -[] -endstart -['end start', 'start'] -startprobar -['startprebar', 'start prebar', 'startbar'] -startnouend -['start nouend', 'startend'] - -test 6-6 -# file: Xtest.latin1.spl -bar -barbork -end -lead -meea1 -meea -prebar -prebarbork -------- -bad -['bar', 'end', 'lead'] -mee -['meea1', 'meea', 'bar'] -meea2 -['meea1', 'meea', 'lead'] -prabar -['prebar', 'bar', 'leadbar'] -probarbirk -['prebarbork'] -middle -[] -leadmiddle -['leadmiddleend', 'leadmiddlebar'] -middleend -[] -endlead -['end lead', 'lead', 'end end'] -leadprobar -['leadprebar', 'lead prebar', 'leadbar'] - -test 7-7 -# file: Xtest.latin1.spl -bar -barmeat -lead -meea1 -meea -prebar -prebarmeat -tail -------- -bad -['bar', 'lead', 'tail'] -mee -['meea1', 'meea', 'bar'] -meea2 -['meea1', 'meea', 'lead'] -prabar -['prebar', 'bar', 'leadbar'] -probarmaat -['prebarmeat'] -middle -[] -leadmiddle -['leadmiddlebar'] -middletail -[] -taillead -['tail lead', 'tail'] -leadprobar -['leadprebar', 'lead prebar', 'leadbar'] - -test 8-8 -# file: Xtest.latin1.spl -bar -faabar -foo -------- -bad -['bar', 'foo'] -foobar -['faabar', 'foo bar', 'bar'] -barfoo -['bar foo', 'bar', 'foo'] diff --git a/src/testdir/test6.in b/src/testdir/test6.in deleted file mode 100644 index 1ebbe2fa51..0000000000 --- a/src/testdir/test6.in +++ /dev/null @@ -1,24 +0,0 @@ -Test for autocommand that redefines the argument list, when doing ":all". - -STARTTEST -:so small.vim -:au BufReadPost Xxx2 next Xxx2 Xxx1 -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -$r3:.,/end of/w! Xxx3 " write test file Xxx3 -:next! Xxx1 Xxx2 Xxx3 " redefine arglist; go to Xxx1 -:all " open window for all args -:w! test.out " Write contents of Xxx1 -:w >>test.out " Append contents of last window (Xxx1) -:rew " should now be in Xxx2 -:w >>test.out " Append contents of Xxx2 -:qa! -ENDTEST - -start of test file Xxx - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test6.ok b/src/testdir/test6.ok deleted file mode 100644 index b6b0c93e4e..0000000000 --- a/src/testdir/test6.ok +++ /dev/null @@ -1,18 +0,0 @@ -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx2 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test60.in b/src/testdir/test60.in deleted file mode 100644 index 8835df9e0c..0000000000 --- a/src/testdir/test60.in +++ /dev/null @@ -1,610 +0,0 @@ -Tests for the exists() and has() functions. vim: set ft=vim ts=8 sw=2 : - -STARTTEST -:so small.vim -:function! RunTest(str, result) - if exists(a:str) == a:result - echo "OK" - else - echo "FAILED: Checking for " . a:str - endif -endfunction -:function! TestExists() - augroup myagroup - autocmd! BufEnter *.my echo "myfile edited" - autocmd! FuncUndefined UndefFun exec "fu UndefFun()\nendfu" - augroup END - set rtp+=./sautest - - let test_cases = [] - - " valid autocmd group - let test_cases += [['#myagroup', 1]] - " valid autocmd group with garbage - let test_cases += [['#myagroup+b', 0]] - " Valid autocmd group and event - let test_cases += [['#myagroup#BufEnter', 1]] - " Valid autocmd group, event and pattern - let test_cases += [['#myagroup#BufEnter#*.my', 1]] - " Valid autocmd event - let test_cases += [['#BufEnter', 1]] - " Valid autocmd event and pattern - let test_cases += [['#BufEnter#*.my', 1]] - " Non-existing autocmd group or event - let test_cases += [['#xyzagroup', 0]] - " Non-existing autocmd group and valid autocmd event - let test_cases += [['#xyzagroup#BufEnter', 0]] - " Valid autocmd group and event with no matching pattern - let test_cases += [['#myagroup#CmdwinEnter', 0]] - " Valid autocmd group and non-existing autocmd event - let test_cases += [['#myagroup#xyzacmd', 0]] - " Valid autocmd group and event and non-matching pattern - let test_cases += [['#myagroup#BufEnter#xyzpat', 0]] - " Valid autocmd event and non-matching pattern - let test_cases += [['#BufEnter#xyzpat', 0]] - " Empty autocmd group, event and pattern - let test_cases += [['###', 0]] - " Empty autocmd group and event or empty event and pattern - let test_cases += [['##', 0]] - " Valid autocmd event - let test_cases += [['##FileReadCmd', 1]] - " Non-existing autocmd event - let test_cases += [['##MySpecialCmd', 0]] - - " Existing and working option (long form) - let test_cases += [['&textwidth', 1]] - " Existing and working option (short form) - let test_cases += [['&tw', 1]] - " Existing and working option with garbage - let test_cases += [['&tw-', 0]] - " Global option - let test_cases += [['&g:errorformat', 1]] - " Local option - let test_cases += [['&l:errorformat', 1]] - " Negative form of existing and working option (long form) - let test_cases += [['&nojoinspaces', 0]] - " Negative form of existing and working option (short form) - let test_cases += [['&nojs', 0]] - " Non-existing option - let test_cases += [['&myxyzoption', 0]] - - " Existing and working option (long form) - let test_cases += [['+incsearch', 1]] - " Existing and working option with garbage - let test_cases += [['+incsearch!1', 0]] - " Existing and working option (short form) - let test_cases += [['+is', 1]] - " Existing option that is hidden. - let test_cases += [['+autoprint', 0]] - - " Existing environment variable - let $EDITOR_NAME = 'Vim Editor' - let test_cases += [['$EDITOR_NAME', 1]] - " Non-existing environment variable - let test_cases += [['$NON_ENV_VAR', 0]] - - " Valid internal function - let test_cases += [['*bufnr', 1]] - " Valid internal function with () - let test_cases += [['*bufnr()', 1]] - " Non-existing internal function - let test_cases += [['*myxyzfunc', 0]] - " Valid internal function with garbage - let test_cases += [['*bufnr&6', 0]] - - " Valid user defined function - let test_cases += [['*TestExists', 1]] - " Non-existing user defined function - let test_cases += [['*MyxyzFunc', 0]] - - " Function that may be created by FuncUndefined event - let test_cases += [['*UndefFun', 0]] - " Function that may be created by script autoloading - let test_cases += [['*footest#F', 0]] - - redir! > test.out - - for [test_case, result] in test_cases - echo test_case . ": " . result - call RunTest(test_case, result) - endfor - - " Valid internal command (full match) - echo ':edit: 2' - if exists(':edit') == 2 - echo "OK" - else - echo "FAILED" - endif - - " Valid internal command (full match) with garbage - echo ':edit/a: 0' - if exists(':edit/a') == 0 - echo "OK" - else - echo "FAILED" - endif - - " Valid internal command (partial match) - echo ':q: 1' - if exists(':q') == 1 - echo "OK" - else - echo "FAILED" - endif - - " Non-existing internal command - echo ':invalidcmd: 0' - if !exists(':invalidcmd') - echo "OK" - else - echo "FAILED" - endif - - " User defined command (full match) - command! MyCmd :echo 'My command' - echo ':MyCmd: 2' - if exists(':MyCmd') == 2 - echo "OK" - else - echo "FAILED" - endif - - " User defined command (partial match) - command! MyOtherCmd :echo 'Another command' - echo ':My: 3' - if exists(':My') == 3 - echo "OK" - else - echo "FAILED" - endif - - " Command modifier - echo ':rightbelow: 2' - if exists(':rightbelow') == 2 - echo "OK" - else - echo "FAILED" - endif - - " Non-existing user defined command (full match) - delcommand MyCmd - - echo ':MyCmd: 0' - if !exists(':MyCmd') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing user defined command (partial match) - delcommand MyOtherCmd - - echo ':My: 0' - if !exists(':My') - echo "OK" - else - echo "FAILED" - endif - - " Valid local variable - let local_var = 1 - echo 'local_var: 1' - if exists('local_var') - echo "OK" - else - echo "FAILED" - endif - - " Valid local variable with garbage - let local_var = 1 - echo 'local_var%n: 0' - if !exists('local_var%n') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing local variable - unlet local_var - echo 'local_var: 0' - if !exists('local_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing autoload variable that may be autoloaded - echo 'footest#x: 0' - if !exists('footest#x') - echo "OK" - else - echo "FAILED" - endif - - " Valid local list - let local_list = ["blue", "orange"] - echo 'local_list: 1' - if exists('local_list') - echo "OK" - else - echo "FAILED" - endif - - " Valid local list item - echo 'local_list[1]: 1' - if exists('local_list[1]') - echo "OK" - else - echo "FAILED" - endif - - " Valid local list item with garbage - echo 'local_list[1]+5: 0' - if !exists('local_list[1]+5') - echo "OK" - else - echo "FAILED" - endif - - " Invalid local list item - echo 'local_list[2]: 0' - if !exists('local_list[2]') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing local list - unlet local_list - echo 'local_list: 0' - if !exists('local_list') - echo "OK" - else - echo "FAILED" - endif - - " Valid local dictionary - let local_dict = {"xcord":100, "ycord":2} - echo 'local_dict: 1' - if exists('local_dict') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing local dictionary - unlet local_dict - echo 'local_dict: 0' - if !exists('local_dict') - echo "OK" - else - echo "FAILED" - endif - - " Existing local curly-brace variable - let str = "local" - let curly_{str}_var = 1 - echo 'curly_' . str . '_var: 1' - if exists('curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing local curly-brace variable - unlet curly_{str}_var - echo 'curly_' . str . '_var: 0' - if !exists('curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - - " Existing global variable - let g:global_var = 1 - echo 'g:global_var: 1' - if exists('g:global_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing global variable with garbage - echo 'g:global_var-n: 1' - if !exists('g:global_var-n') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing global variable - unlet g:global_var - echo 'g:global_var: 0' - if !exists('g:global_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing global list - let g:global_list = ["blue", "orange"] - echo 'g:global_list: 1' - if exists('g:global_list') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing global list - unlet g:global_list - echo 'g:global_list: 0' - if !exists('g:global_list') - echo "OK" - else - echo "FAILED" - endif - - " Existing global dictionary - let g:global_dict = {"xcord":100, "ycord":2} - echo 'g:global_dict: 1' - if exists('g:global_dict') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing global dictionary - unlet g:global_dict - echo 'g:global_dict: 0' - if !exists('g:global_dict') - echo "OK" - else - echo "FAILED" - endif - - " Existing global curly-brace variable - let str = "global" - let g:curly_{str}_var = 1 - echo 'g:curly_' . str . '_var: 1' - if exists('g:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing global curly-brace variable - unlet g:curly_{str}_var - echo 'g:curly_' . str . '_var: 0' - if !exists('g:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing window variable - echo 'w:window_var: 1' - let w:window_var = 1 - if exists('w:window_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing window variable - unlet w:window_var - echo 'w:window_var: 0' - if !exists('w:window_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing window list - let w:window_list = ["blue", "orange"] - echo 'w:window_list: 1' - if exists('w:window_list') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing window list - unlet w:window_list - echo 'w:window_list: 0' - if !exists('w:window_list') - echo "OK" - else - echo "FAILED" - endif - - " Existing window dictionary - let w:window_dict = {"xcord":100, "ycord":2} - echo 'w:window_dict: 1' - if exists('w:window_dict') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing window dictionary - unlet w:window_dict - echo 'w:window_dict: 0' - if !exists('w:window_dict') - echo "OK" - else - echo "FAILED" - endif - - " Existing window curly-brace variable - let str = "window" - let w:curly_{str}_var = 1 - echo 'w:curly_' . str . '_var: 1' - if exists('w:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing window curly-brace variable - unlet w:curly_{str}_var - echo 'w:curly_' . str . '_var: 0' - if !exists('w:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing buffer variable - echo 'b:buffer_var: 1' - let b:buffer_var = 1 - if exists('b:buffer_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing buffer variable - unlet b:buffer_var - echo 'b:buffer_var: 0' - if !exists('b:buffer_var') - echo "OK" - else - echo "FAILED" - endif - - " Existing buffer list - let b:buffer_list = ["blue", "orange"] - echo 'b:buffer_list: 1' - if exists('b:buffer_list') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing buffer list - unlet b:buffer_list - echo 'b:buffer_list: 0' - if !exists('b:buffer_list') - echo "OK" - else - echo "FAILED" - endif - - " Existing buffer dictionary - let b:buffer_dict = {"xcord":100, "ycord":2} - echo 'b:buffer_dict: 1' - if exists('b:buffer_dict') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing buffer dictionary - unlet b:buffer_dict - echo 'b:buffer_dict: 0' - if !exists('b:buffer_dict') - echo "OK" - else - echo "FAILED" - endif - - " Existing buffer curly-brace variable - let str = "buffer" - let b:curly_{str}_var = 1 - echo 'b:curly_' . str . '_var: 1' - if exists('b:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing buffer curly-brace variable - unlet b:curly_{str}_var - echo 'b:curly_' . str . '_var: 0' - if !exists('b:curly_{str}_var') - echo "OK" - else - echo "FAILED" - endif - - " Script-local tests - source test60.vim - - " Existing Vim internal variable - echo 'v:version: 1' - if exists('v:version') - echo "OK" - else - echo "FAILED" - endif - - " Non-existing Vim internal variable - echo 'v:non_exists_var: 0' - if !exists('v:non_exists_var') - echo "OK" - else - echo "FAILED" - endif - - " Function arguments - function TestFuncArg(func_arg, ...) - echo 'a:func_arg: 1' - if exists('a:func_arg') - echo "OK" - else - echo "FAILED" - endif - - echo 'a:non_exists_arg: 0' - if !exists('a:non_exists_arg') - echo "OK" - else - echo "FAILED" - endif - - echo 'a:1: 1' - if exists('a:1') - echo "OK" - else - echo "FAILED" - endif - - echo 'a:2: 0' - if !exists('a:2') - echo "OK" - else - echo "FAILED" - endif - endfunction - - call TestFuncArg("arg1", "arg2") - - echo ' g:footest#x =' g:footest#x - echo ' footest#F()' footest#F() - echo 'UndefFun()' UndefFun() - - redir END -endfunction -:call TestExists() -:" -:function TestHas() - redir >> test.out - for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1'] - echo 'has patch ' . pl . ': ' . has('patch-' . pl) - endfor - redir END -endfunc -:call TestHas() -:" -:delfunc TestExists -:delfunc RunTest -:delfunc TestFuncArg -:edit! test.out -:set ff=unix -:w -:qa! -:while getchar(1) | call getchar() | endwhile -ENDTEST - diff --git a/src/testdir/test60.ok b/src/testdir/test60.ok deleted file mode 100644 index dabcd0c05d..0000000000 --- a/src/testdir/test60.ok +++ /dev/null @@ -1,211 +0,0 @@ - -#myagroup: 1 -OK -#myagroup+b: 0 -OK -#myagroup#BufEnter: 1 -OK -#myagroup#BufEnter#*.my: 1 -OK -#BufEnter: 1 -OK -#BufEnter#*.my: 1 -OK -#xyzagroup: 0 -OK -#xyzagroup#BufEnter: 0 -OK -#myagroup#CmdwinEnter: 0 -OK -#myagroup#xyzacmd: 0 -OK -#myagroup#BufEnter#xyzpat: 0 -OK -#BufEnter#xyzpat: 0 -OK -###: 0 -OK -##: 0 -OK -##FileReadCmd: 1 -OK -##MySpecialCmd: 0 -OK -&textwidth: 1 -OK -&tw: 1 -OK -&tw-: 0 -OK -&g:errorformat: 1 -OK -&l:errorformat: 1 -OK -&nojoinspaces: 0 -OK -&nojs: 0 -OK -&myxyzoption: 0 -OK -+incsearch: 1 -OK -+incsearch!1: 0 -OK -+is: 1 -OK -+autoprint: 0 -OK -$EDITOR_NAME: 1 -OK -$NON_ENV_VAR: 0 -OK -*bufnr: 1 -OK -*bufnr(): 1 -OK -*myxyzfunc: 0 -OK -*bufnr&6: 0 -OK -*TestExists: 1 -OK -*MyxyzFunc: 0 -OK -*UndefFun: 0 -OK -*footest#F: 0 -OK -:edit: 2 -OK -:edit/a: 0 -OK -:q: 1 -OK -:invalidcmd: 0 -OK -:MyCmd: 2 -OK -:My: 3 -OK -:rightbelow: 2 -OK -:MyCmd: 0 -OK -:My: 0 -OK -local_var: 1 -OK -local_var%n: 0 -OK -local_var: 0 -OK -footest#x: 0 -OK -local_list: 1 -OK -local_list[1]: 1 -OK -local_list[1]+5: 0 -OK -local_list[2]: 0 -OK -local_list: 0 -OK -local_dict: 1 -OK -local_dict: 0 -OK -curly_local_var: 1 -OK -curly_local_var: 0 -OK -g:global_var: 1 -OK -g:global_var-n: 1 -OK -g:global_var: 0 -OK -g:global_list: 1 -OK -g:global_list: 0 -OK -g:global_dict: 1 -OK -g:global_dict: 0 -OK -g:curly_global_var: 1 -OK -g:curly_global_var: 0 -OK -w:window_var: 1 -OK -w:window_var: 0 -OK -w:window_list: 1 -OK -w:window_list: 0 -OK -w:window_dict: 1 -OK -w:window_dict: 0 -OK -w:curly_window_var: 1 -OK -w:curly_window_var: 0 -OK -b:buffer_var: 1 -OK -b:buffer_var: 0 -OK -b:buffer_list: 1 -OK -b:buffer_list: 0 -OK -b:buffer_dict: 1 -OK -b:buffer_dict: 0 -OK -b:curly_buffer_var: 1 -OK -b:curly_buffer_var: 0 -OK -s:script_var: 1 -OK -s:script_var: 0 -OK -s:script_list: 1 -OK -s:script_list: 0 -OK -s:script_dict: 1 -OK -s:script_dict: 0 -OK -s:curly_script_var: 1 -OK -s:curly_script_var: 0 -OK -*s:my_script_func: 1 -OK -*s:my_script_func: 0 -OK -v:version: 1 -OK -v:non_exists_var: 0 -OK -a:func_arg: 1 -OK -a:non_exists_arg: 0 -OK -a:1: 1 -OK -a:2: 0 -OK - g:footest#x = 1 - footest#F() 0 -UndefFun() 0 -has patch 6.9.999: 1 -has patch 7.1.999: 1 -has patch 7.4.123: 1 -has patch 9.1.0: 0 -has patch 9.9.1: 0 diff --git a/src/testdir/test60.vim b/src/testdir/test60.vim deleted file mode 100644 index f1157f73f9..0000000000 --- a/src/testdir/test60.vim +++ /dev/null @@ -1,98 +0,0 @@ -" Vim script for exists() function test -" Script-local variables are checked here - -" Existing script-local variable -let s:script_var = 1 -echo 's:script_var: 1' -if exists('s:script_var') - echo "OK" -else - echo "FAILED" -endif - -" Non-existing script-local variable -unlet s:script_var -echo 's:script_var: 0' -if !exists('s:script_var') - echo "OK" -else - echo "FAILED" -endif - -" Existing script-local list -let s:script_list = ["blue", "orange"] -echo 's:script_list: 1' -if exists('s:script_list') - echo "OK" -else - echo "FAILED" -endif - -" Non-existing script-local list -unlet s:script_list -echo 's:script_list: 0' -if !exists('s:script_list') - echo "OK" -else - echo "FAILED" -endif - -" Existing script-local dictionary -let s:script_dict = {"xcord":100, "ycord":2} -echo 's:script_dict: 1' -if exists('s:script_dict') - echo "OK" -else - echo "FAILED" -endif - -" Non-existing script-local dictionary -unlet s:script_dict -echo 's:script_dict: 0' -if !exists('s:script_dict') - echo "OK" -else - echo "FAILED" -endif - -" Existing script curly-brace variable -let str = "script" -let s:curly_{str}_var = 1 -echo 's:curly_' . str . '_var: 1' -if exists('s:curly_{str}_var') - echo "OK" -else - echo "FAILED" -endif - -" Non-existing script-local curly-brace variable -unlet s:curly_{str}_var -echo 's:curly_' . str . '_var: 0' -if !exists('s:curly_{str}_var') - echo "OK" -else - echo "FAILED" -endif - -" Existing script-local function -function! s:my_script_func() -endfunction - -echo '*s:my_script_func: 1' -if exists('*s:my_script_func') - echo "OK" -else - echo "FAILED" -endif - -" Non-existing script-local function -delfunction s:my_script_func - -echo '*s:my_script_func: 0' -if !exists('*s:my_script_func') - echo "OK" -else - echo "FAILED" -endif -unlet str - diff --git a/src/testdir/test61.in b/src/testdir/test61.in deleted file mode 100644 index dc24ab9804..0000000000 --- a/src/testdir/test61.in +++ /dev/null @@ -1,113 +0,0 @@ -Tests for undo tree. -Since this script is sourced we need to explicitly break changes up in -undo-able pieces. Do that by setting 'undolevels'. -Also tests :earlier and :later. - -STARTTEST -:echo undotree().entries -ENDTEST - -STARTTEST -:" Delete three characters and undo -Gx:set ul=100 -x:set ul=100 -x:.w! test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -:" -:/^111/w >>test.out -:" Delete three other characters and go back in time step by step -$x:set ul=100 -x:set ul=100 -x:.w >>test.out -:sleep 1 -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -g-:.w >>test.out -10g+:.w >>test.out -:" -:/^222/w >>test.out -:" Delay for three seconds and go some seconds forward and backward -:sleep 2 -Aa:set ul=100 -Ab:set ul=100 -Ac:set ul=100 -:.w >>test.out -:ear 1s -:.w >>test.out -:ear 3s -:.w >>test.out -:later 1s -:.w >>test.out -:later 1h -:.w >>test.out -:" -:" test undojoin -Goaaaa:set ul=100 -obbbbu:.w >>test.out -obbbb:set ul=100 -:undojoin -occccu:.w >>test.out -:e! Xtest -ione one one:set ul=100 -:w! -otwo:set ul=100 -otwo:set ul=100 -:w -othree:earlier 1f -:" expect "one one one\ntwo\ntwo" -:%yank a -:earlier 1f -:" expect "one one one" -:%yank b -:earlier 1f -:" expect empty line -:%yank c -:later 1f -:" expect "one one one" -:%yank d -:later 1f -:" expect "one one one\ntwo\ntwo" -:%yank e -:later 1f -:" expect "one one one\ntwo\ntwo\nthree" -ggO---:0put e -ggO---:0put d -ggO---:0put c -ggO---:0put b -ggO---:0put a -ggO---:w >>test.out -:so small.vim -:set nocp viminfo+=nviminfo -:enew! -oa -:set ul=100 -ob -:set ul=100 -o1a2=setline('.','1234') - -uu:" -oc -:set ul=100 -o1a2=setline('.','1234') - -u:" -od -:set ul=100 -o1a2=string(123) -u:" -:%w >>test.out -:qa! -ENDTEST - -1111 ----- -2222 ----- - -123456789 diff --git a/src/testdir/test61.ok b/src/testdir/test61.ok deleted file mode 100644 index ea4b473ad7..0000000000 --- a/src/testdir/test61.ok +++ /dev/null @@ -1,49 +0,0 @@ -456789 -3456789 -23456789 -123456789 -123456789 -1111 ----- -123456 -1234567 -12345678 -456789 -3456789 -23456789 -123456789 -123456789 -123456789 -123456 -2222 ----- -123456abc -123456 -123456789 -123456 -123456abc -aaaa -aaaa ---- -one one one -two -two ---- -one one one ---- - ---- -one one one ---- -one one one -two -two ---- -one one one -two -two -three - -a -b -c -12 -d diff --git a/src/testdir/test62.in b/src/testdir/test62.in deleted file mode 100644 index 93d968b33e..0000000000 --- a/src/testdir/test62.in +++ /dev/null @@ -1,191 +0,0 @@ -Tests for tab pages - -STARTTEST -:so small.vim -:lang C -:" Simple test for opening and closing a tab page -:tabnew -:let nr = tabpagenr() -:q -:call append(line('$'), 'tab page ' . nr) -:unlet nr -:" -:" Open three tab pages and use ":tabdo" -:0tabnew -:1tabnew -:888tabnew -:tabdo call append(line('$'), 'this is tab page ' . tabpagenr()) -:tabclose! 2 -:tabrewind -:let line1 = getline('$') -:undo -:q -:tablast -:let line2 = getline('$') -:q! -:call append(line('$'), line1) -:call append(line('$'), line2) -:unlet line1 line2 -:" -:" Test for settabvar() and gettabvar() functions. Open a new tab page and -:" set 3 variables to a number, string and a list. Verify that the variables -:" are correctly set. -:tabnew -:tabfirst -:call settabvar(2, 'val_num', 100) -:call settabvar(2, 'val_str', 'SetTabVar test') -:call settabvar(2, 'val_list', ['red', 'blue', 'green']) -:" -:let test_status = 'gettabvar: fail' -:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green'] -: let test_status = 'gettabvar: pass' -:endif -:call append(line('$'), test_status) -:" -:tabnext 2 -:let test_status = 'settabvar: fail' -:if t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green'] -: let test_status = 'settabvar: pass' -:endif -:tabclose -:call append(line('$'), test_status) -:" -:if has('gui') || has('clientserver') -:" Test for ":tab drop exist-file" to keep current window. -:sp test1 -:tab drop test1 -:let test_status = 'tab drop 1: fail' -:if tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1 -: let test_status = 'tab drop 1: pass' -:endif -:close -:call append(line('$'), test_status) -:" -:" -:" Test for ":tab drop new-file" to keep current window of tabpage 1. -:split -:tab drop newfile -:let test_status = 'tab drop 2: fail' -:if tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1 -: let test_status = 'tab drop 2: pass' -:endif -:tabclose -:q -:call append(line('$'), test_status) -:" -:" -:" Test for ":tab drop multi-opend-file" to keep current tabpage and window. -:new test1 -:tabnew -:new test1 -:tab drop test1 -:let test_status = 'tab drop 3: fail' -:if tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1 -: let test_status = 'tab drop 3: pass' -:endif -:tabclose -:q -:call append(line('$'), test_status) -:else -:" :drop not supported -:call append(line('$'), 'tab drop 1: pass') -:call append(line('$'), 'tab drop 2: pass') -:call append(line('$'), 'tab drop 3: pass') -:endif -:" -:" -:for i in range(9) | tabnew | endfor -1gt -Go=tabpagenr()  -:tabmove 5 -i=tabpagenr()  -:tabmove -2 -i=tabpagenr()  -:tabmove +4 -i=tabpagenr()  -:tabmove -i=tabpagenr()  -:tabmove -20 -i=tabpagenr()  -:tabmove +20 -i=tabpagenr()  -:3tabmove -i=tabpagenr()  -:7tabmove 5 -i=tabpagenr()  -:let a='No error caught.' -:try -:tabmove foo -:catch E474 -:let a='E474 caught.' -:endtry -i=a  -:" -:" Test autocommands -:tabonly! -:let g:r=[] -:command -nargs=1 -bar C :call add(g:r, '=== ' . <q-args> . ' ===')|<args> -:function Test() - let hasau=has('autocmd') - if hasau - autocmd TabEnter * :call add(g:r, 'TabEnter') - autocmd WinEnter * :call add(g:r, 'WinEnter') - autocmd BufEnter * :call add(g:r, 'BufEnter') - autocmd TabLeave * :call add(g:r, 'TabLeave') - autocmd WinLeave * :call add(g:r, 'WinLeave') - autocmd BufLeave * :call add(g:r, 'BufLeave') - endif - let t:a='a' - C tab split - if !hasau - let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'] - endif - let t:a='b' - C tabnew - if !hasau - let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'] - endif - let t:a='c' - call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")'))) - C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') - call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")'))) - let w:a='a' - C vsplit - if !hasau - let g:r+=['WinLeave', 'WinEnter'] - endif - let w:a='a' - let tabn=tabpagenr() - let winr=range(1, winnr('$')) - C tabnext 1 - if !hasau - let g:r+=['BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'] - endif - call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")'))) - C call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') - call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")'))) - if hasau - augroup TabDestructive - autocmd TabEnter * :C tabnext 2 | C tabclose 3 - augroup END - C tabnext 3 - let g:r+=[tabpagenr().'/'.tabpagenr('$')] - autocmd! TabDestructive TabEnter - C tabnew - C tabnext 1 - autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3 - C tabnext 3 - let g:r+=[tabpagenr().'/'.tabpagenr('$')] - else - let g:r+=["=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","2/2","=== tabnew ===","WinLeave","TabLeave","WinEnter","TabEnter","BufLeave","BufEnter","=== tabnext 1 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","BufEnter","=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","BufEnter","=== tabclose 3 ===","2/2",] - endif -endfunction -:call Test() -:$ put =g:r -:" -:" -:/^Results/,$w! test.out -:qa! -ENDTEST - -Results: diff --git a/src/testdir/test62.ok b/src/testdir/test62.ok deleted file mode 100644 index e35b2b1c67..0000000000 --- a/src/testdir/test62.ok +++ /dev/null @@ -1,88 +0,0 @@ -Results: -tab page 2 -this is tab page 3 -this is tab page 1 -this is tab page 4 -gettabvar: pass -settabvar: pass -tab drop 1: pass -tab drop 2: pass -tab drop 3: pass -1 -6 -4 -8 -10 -1 -10 -4 -6 -E474 caught. -=== tab split === -WinLeave -TabLeave -WinEnter -TabEnter -=== tabnew === -WinLeave -TabLeave -WinEnter -TabEnter -BufLeave -BufEnter -a b c -=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') === -2 4 6 -=== vsplit === -WinLeave -WinEnter -=== tabnext 1 === -BufLeave -WinLeave -TabLeave -WinEnter -TabEnter -BufEnter -a a -=== call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') === -2 4 -=== tabnext 3 === -BufLeave -WinLeave -TabLeave -WinEnter -TabEnter -=== tabnext 2 === -=== tabclose 3 === -2/2 -=== tabnew === -WinLeave -TabLeave -WinEnter -TabEnter -BufLeave -BufEnter -=== tabnext 1 === -BufLeave -WinLeave -TabLeave -WinEnter -TabEnter -BufEnter -=== tabnext 3 === -BufLeave -WinLeave -TabLeave -WinEnter -TabEnter -=== tabnext 2 === -BufLeave -WinLeave -TabLeave -WinEnter -TabEnter -=== tabnext 2 === -=== tabclose 3 === -BufEnter -=== tabclose 3 === -2/2 diff --git a/src/testdir/test63.in b/src/testdir/test63.in deleted file mode 100644 index 5ec315ad7a..0000000000 --- a/src/testdir/test63.in +++ /dev/null @@ -1,174 +0,0 @@ -Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()", -"matchadd()", "matchaddpos", "matcharg()", "matchdelete()", and "setmatches()". - -STARTTEST -:so small.vim -:" --- Check that "matcharg()" returns the correct group and pattern if a match -:" --- is defined. -:let @r = "*** Test 1: " -:highlight MyGroup1 ctermbg=red guibg=red -:highlight MyGroup2 ctermbg=green guibg=green -:highlight MyGroup3 ctermbg=blue guibg=blue -:match MyGroup1 /TODO/ -:2match MyGroup2 /FIXME/ -:3match MyGroup3 /XXX/ -:if matcharg(1) == ['MyGroup1', 'TODO'] && matcharg(2) == ['MyGroup2', 'FIXME'] && matcharg(3) == ['MyGroup3', 'XXX'] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:" --- Check that "matcharg()" returns an empty list if the argument is not 1, -:" --- 2 or 3 (only 0 and 4 are tested). -:let @r .= "*** Test 2: " -:if matcharg(0) == [] && matcharg(4) == [] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:" --- Check that "matcharg()" returns ['', ''] if a match is not defined. -:let @r .= "*** Test 3: " -:match -:2match -:3match -:if matcharg(1) == ['', ''] && matcharg(2) == ['', ''] && matcharg(3) == ['', ''] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:" --- Check that "matchadd()" and "getmatches()" agree on added matches and -:" --- that default values apply. -:let @r .= "*** Test 4: " -:let m1 = matchadd("MyGroup1", "TODO") -:let m2 = matchadd("MyGroup2", "FIXME", 42) -:let m3 = matchadd("MyGroup3", "XXX", 60, 17) -:if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5}, {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:" --- Check that "matchdelete()" deletes the matches defined in the previous -:" --- test correctly. -:let @r .= "*** Test 5: " -:call matchdelete(m1) -:call matchdelete(m2) -:call matchdelete(m3) -:unlet m1 -:unlet m2 -:unlet m3 -:if getmatches() == [] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:" --- Check that "matchdelete()" returns 0 if successful and otherwise -1. -:let @r .= "*** Test 6: " -:let m = matchadd("MyGroup1", "TODO") -:let r1 = matchdelete(m) -:let r2 = matchdelete(42) -:if r1 == 0 && r2 == -1 -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:unlet m -:unlet r1 -:unlet r2 -:" --- Check that "clearmatches()" clears all matches defined by ":match" and -:" --- "matchadd()". -:let @r .= "*** Test 7: " -:let m1 = matchadd("MyGroup1", "TODO") -:let m2 = matchadd("MyGroup2", "FIXME", 42) -:let m3 = matchadd("MyGroup3", "XXX", 60, 17) -:match MyGroup1 /COFFEE/ -:2match MyGroup2 /HUMPPA/ -:3match MyGroup3 /VIM/ -:call clearmatches() -:if getmatches() == [] -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:unlet m1 -:unlet m2 -:unlet m3 -:" --- Check that "setmatches()" restores a list of matches saved by -:" --- "getmatches()" without changes. (Matches with equal priority must also -:" --- remain in the same order.) -:let @r .= "*** Test 8: " -:let m1 = matchadd("MyGroup1", "TODO") -:let m2 = matchadd("MyGroup2", "FIXME", 42) -:let m3 = matchadd("MyGroup3", "XXX", 60, 17) -:match MyGroup1 /COFFEE/ -:2match MyGroup2 /HUMPPA/ -:3match MyGroup3 /VIM/ -:let ml = getmatches() -:call clearmatches() -:call setmatches(ml) -:if getmatches() == ml -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:call clearmatches() -:unlet m1 -:unlet m2 -:unlet m3 -:unlet ml -:" --- Check that "setmatches()" will not add two matches with the same ID. The -:" --- expected behaviour (for now) is to add the first match but not the -:" --- second and to return 0 (even though it is a matter of debate whether -:" --- this can be considered successful behaviour). -:let @r .= "*** Test 9: " -:let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}]) -:if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}] && r1 == 0 -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:call clearmatches() -:unlet r1 -:" --- Check that "setmatches()" returns 0 if successful and otherwise -1. -:" --- (A range of valid and invalid input values are tried out to generate the -:" --- return values.) -:let @r .= "*** Test 10: " -:let rs1 = setmatches([]) -:let rs2 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}]) -:call clearmatches() -:let rf1 = setmatches(0) -:let rf2 = setmatches([0]) -:let rf3 = setmatches([{'wrong key': 'wrong value'}]) -:if rs1 == 0 && rs2 == 0 && rf1 == -1 && rf2 == -1 && rf3 == -1 -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:unlet rs1 -:unlet rs2 -:unlet rf1 -:unlet rf2 -:unlet rf3 -:" --- Check that "matchaddpos()" positions matches correctly -:let @r .= "*** Test 11:\n" -:set nolazyredraw -:call setline(1, 'abcdefghijklmnopq') -:call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3) -:1 -:redraw! -:let v1 = screenattr(1, 1) -:let v5 = screenattr(1, 5) -:let v6 = screenattr(1, 6) -:let v8 = screenattr(1, 8) -:let v10 = screenattr(1, 10) -:let v11 = screenattr(1, 11) -:let @r .= string(getmatches())."\n" -:if v1 != v5 && v6 == v1 && v8 == v5 && v10 == v5 && v11 == v1 -: let @r .= "OK\n" -:else -: let @r .= "FAILED\n" -:endif -:call clearmatches() -G"rp -:/^Results/,$wq! test.out -ENDTEST - -Results of test63: diff --git a/src/testdir/test63.ok b/src/testdir/test63.ok deleted file mode 100644 index f804b693ac..0000000000 --- a/src/testdir/test63.ok +++ /dev/null @@ -1,14 +0,0 @@ -Results of test63: -*** Test 1: OK -*** Test 2: OK -*** Test 3: OK -*** Test 4: OK -*** Test 5: OK -*** Test 6: OK -*** Test 7: OK -*** Test 8: OK -*** Test 9: OK -*** Test 10: OK -*** Test 11: -[{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}] -OK diff --git a/src/testdir/test64.in b/src/testdir/test64.in index 2abdcd1c08..360418c503 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -7,6 +7,7 @@ actually tried. STARTTEST :so small.vim :" tl is a List of Lists with: +:" regexp engine :" regexp pattern :" text to test the pattern on :" expected match (optional) @@ -451,6 +452,9 @@ STARTTEST :"""" Skip adding state twice :call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO']) :" +:""" Test \%V atom +:call add(tl, [2, '\%>70vGesamt', 'Jean-Michel Charlier & Victor Hubinon\Gesamtausgabe [Salleck] Buck Danny {Jean-Michel Charlier & Victor Hubinon}\Gesamtausgabe', 'Gesamt']) +:" :"""" Run the tests :" :for t in tl @@ -459,7 +463,7 @@ STARTTEST : let text = t[2] : let matchidx = 3 : for engine in [0, 1, 2] -: if engine == 2 && re == 0 || engine == 1 && re ==1 +: if engine == 2 && re == 0 || engine == 1 && re == 1 : continue : endif : let ®expengine = engine @@ -574,7 +578,7 @@ Gop:" :" Check patterns matching cursor position. :func! Postest() new - call setline(1, ['ffooooo', 'boboooo', 'zoooooo', 'koooooo', 'moooooo', "\t\t\tfoo", 'abababababababfoo', 'bababababababafoo', '********_']) + call setline(1, ['ffooooo', 'boboooo', 'zoooooo', 'koooooo', 'moooooo', "\t\t\tfoo", 'abababababababfoo', 'bababababababafoo', '********_', ' xxxxxxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx']) call setpos('.', [0, 1, 0, 0]) s/\%>3c.//g call setpos('.', [0, 2, 4, 0]) @@ -586,6 +590,7 @@ Gop:" %s/\%>6l\%3c./!/g %s/\%>7l\%12c./?/g %s/\%>7l\%<9l\%>5v\%<8v./#/g + $s/\%(|\u.*\)\@<=[^|\t]\+$//ge 1,$yank quit! endfunc @@ -608,6 +613,17 @@ yeGopA END:" "ayb20gg/..\%$ "bybGo"apo"bp:" :" +:" Check for detecting error +:set regexpengine=2 +:for pat in [' \ze*', ' \zs*'] +: try +: let l = matchlist('x x', pat) +: $put ='E888 NOT detected for ' . pat +: catch +: $put ='E888 detected for ' . pat +: endtry +:endfor +:" :""""" Write the results """"""""""""" :/\%#=1^Results/,$wq! test.out ENDTEST diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index e7d173141a..c218f8ea17 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -1030,6 +1030,9 @@ OK 2 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12} OK 0 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= OK 1 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= OK 2 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= +OK 0 - \%>70vGesamt +OK 1 - \%>70vGesamt +OK 2 - \%>70vGesamt multi-line tests OK 0 - ^.\(.\).\_..\1. OK 1 - ^.\(.\).\_..\1. @@ -1073,6 +1076,7 @@ moooooo ab!babababababfoo ba!ab##abab?bafoo **!*****_ + ! xxx?xxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx -1- ffo bob @@ -1083,6 +1087,7 @@ moooooo ab!babababababfoo ba!ab##abab?bafoo **!*****_ + ! xxx?xxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx -2- ffo bob @@ -1093,7 +1098,10 @@ moooooo ab!babababababfoo ba!ab##abab?bafoo **!*****_ + ! xxx?xxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx Test Test END EN E +E888 detected for \ze* +E888 detected for \zs* diff --git a/src/testdir/test65.in b/src/testdir/test65.in deleted file mode 100644 index ca53f27555..0000000000 --- a/src/testdir/test65.in +++ /dev/null @@ -1,95 +0,0 @@ -Test for floating point and logical operators. - -STARTTEST -:so small.vim -:if !has("float") -: e! test.ok -: wq! test.out -:endif -:" -:$put =printf('%f', 123.456) -:$put =printf('%e', 123.456) -:$put =printf('%g', 123.456) -:" check we don't crash on division by zero -:echo 1.0 / 0.0 -:$put ='+=' -:let v = 1.234 -:let v += 6.543 -:$put =printf('%g', v) -:let v = 1.234 -:let v += 5 -:$put =printf('%g', v) -:let a = 5 -:let a += 3.333 -:$put =string(a) -:$put ='==' -:let v = 1.234 -:$put =v == 1.234 -:$put =v == 1.2341 -:$put ='add-subtract' -:$put =printf('%g', 4 + 1.234) -:$put =printf('%g', 1.234 - 8) -:$put ='mult-div' -:$put =printf('%g', 4 * 1.234) -:$put =printf('%g', 4.0 / 1234) -:$put ='dict' -:$put =string({'x': 1.234, 'y': -2.0e20}) -:$put ='list' -:$put =string([-123.4, 2.0e-20]) -:$put ='abs' -:$put =printf('%d', abs(1456)) -:$put =printf('%d', abs(-4)) -:$put =printf('%d', abs([1, 2, 3])) -:$put =printf('%g', abs(14.56)) -:$put =printf('%g', abs(-54.32)) -:$put ='ceil' -:$put =printf('%g', ceil(1.456)) -:$put =printf('%g', ceil(-5.456)) -:$put =printf('%g', ceil(-4.000)) -:$put ='floor' -:$put =printf('%g', floor(1.856)) -:$put =printf('%g', floor(-5.456)) -:$put =printf('%g', floor(4.0)) -:$put ='log10' -:$put =printf('%g', log10(1000)) -:$put =printf('%g', log10(0.01000)) -:$put ='pow' -:$put =printf('%g', pow(3, 3.0)) -:$put =printf('%g', pow(2, 16)) -:$put ='round' -:$put =printf('%g', round(0.456)) -:$put =printf('%g', round(4.5)) -:$put =printf('%g', round(-4.50)) -:$put ='sqrt' -:$put =printf('%g', sqrt(100)) -:echo sqrt(-4.01) -:$put ='str2float' -:$put =printf('%g', str2float('1e40')) -:$put ='trunc' -:$put =printf('%g', trunc(1.456)) -:$put =printf('%g', trunc(-5.456)) -:$put =printf('%g', trunc(4.000)) -:$put ='float2nr' -:$put =float2nr(123.456) -:$put =float2nr(-123.456) -:$put ='AND' -:$put =and(127, 127) -:$put =and(127, 16) -:$put =and(127, 128) -:$put ='OR' -:$put =or(16, 7) -:$put =or(8, 7) -:$put =or(0, 123) -:$put ='XOR' -:$put =xor(127, 127) -:$put =xor(127, 16) -:$put =xor(127, 128) -:$put ='invert' -:$put =and(invert(127), 65535) -:$put =and(invert(16), 65535) -:$put =and(invert(128), 65535) -:$put =invert(1.0) -:/^Results/,$wq! test.out -ENDTEST - -Results of test65: diff --git a/src/testdir/test65.ok b/src/testdir/test65.ok deleted file mode 100644 index 7aac326058..0000000000 --- a/src/testdir/test65.ok +++ /dev/null @@ -1,73 +0,0 @@ -Results of test65: -123.456000 -1.234560e+02 -123.456 -+= -7.777 -6.234 -8.333 -== -1 -0 -add-subtract -5.234 --6.766 -mult-div -4.936 -0.003241 -dict -{'x': 1.234, 'y': -2.0e20} -list -[-123.4, 2.0e-20] -abs -1456 -4 --1 -14.56 -54.32 -ceil -2.0 --5.0 --4.0 -floor -1.0 --6.0 -4.0 -log10 -3.0 --2.0 -pow -27.0 -65536.0 -round -0.0 -5.0 --5.0 -sqrt -10.0 -str2float -1.0e40 -trunc -1.0 --5.0 -4.0 -float2nr -123 --123 -AND -127 -16 -0 -OR -23 -15 -123 -XOR -0 -111 -255 -invert -65408 -65519 -65407 -0 diff --git a/src/testdir/test66.in b/src/testdir/test66.in deleted file mode 100644 index f1fdce3792..0000000000 --- a/src/testdir/test66.in +++ /dev/null @@ -1,33 +0,0 @@ - -Test for visual block shift and tab characters. - -STARTTEST -:so small.vim -/^one -fe4jRugvr1:'<,'>w! test.out -/^abcdefgh -4jI j<<11|D -7|a  -7|a  -7|a 4k13|4j< -:$-5,$w >> test.out -:$-4,$s/\s\+//g -4kI j<< -7|a  -7|a  -7|a 4k13|4j3< -:$-4,$w >> test.out -:qa! -ENDTEST - -one two three -one two three -one two three -one two three -one two three - -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz diff --git a/src/testdir/test66.ok b/src/testdir/test66.ok deleted file mode 100644 index 4c3ab0fb56..0000000000 --- a/src/testdir/test66.ok +++ /dev/null @@ -1,16 +0,0 @@ -on1 two three -on1 two three -on1 two three -on1 two three -on1 two three - - abcdefghijklmnopqrstuvwxyz -abcdefghij - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abcdefghijklmnopqrstuvwxyz -abcdefghij - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz diff --git a/src/testdir/test67.in b/src/testdir/test67.in deleted file mode 100644 index 08b4e3701f..0000000000 --- a/src/testdir/test67.in +++ /dev/null @@ -1,33 +0,0 @@ -Test that groups and patterns are tested correctly when calling exists() for -autocommands. - -STARTTEST -:so small.vim -:let results=[] -:augroup auexists -:augroup END -:call add(results, "##BufEnter: " . exists("##BufEnter")) -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:au BufEnter * let g:entered=1 -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:augroup auexists -:au BufEnter * let g:entered=1 -:augroup END -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:au BufEnter *.test let g:entered=1 -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:edit testfile.test -:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) -:au BufEnter <buffer> let g:entered=1 -:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) -:edit testfile2.test -:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) -:e test.out -:call append(0, results) -:$d -:w -:qa! -ENDTEST - diff --git a/src/testdir/test67.ok b/src/testdir/test67.ok deleted file mode 100644 index 51188e5afd..0000000000 --- a/src/testdir/test67.ok +++ /dev/null @@ -1,10 +0,0 @@ -##BufEnter: 1 -#BufEnter: 0 -#BufEnter: 1 -#auexists#BufEnter: 0 -#auexists#BufEnter: 1 -#BufEnter#*.test: 0 -#BufEnter#*.test: 1 -#BufEnter#<buffer>: 0 -#BufEnter#<buffer>: 1 -#BufEnter#<buffer>: 0 diff --git a/src/testdir/test68.in b/src/testdir/test68.in deleted file mode 100644 index ceaf9af1ab..0000000000 --- a/src/testdir/test68.in +++ /dev/null @@ -1,131 +0,0 @@ -Test for text formatting. - -Results of test68: - -STARTTEST -:so small.vim -/^{/+1 -:set noai tw=2 fo=t -gRa b -ENDTEST - -{ - - -} - -STARTTEST -/^{/+1 -:set ai tw=2 fo=tw -gqgqjjllab -ENDTEST - -{ -a b - -a -} - -STARTTEST -/^{/+1 -:set tw=3 fo=t -gqgqo -a  -ENDTEST - -{ -a  -} - -STARTTEST -/^{/+1 -:set tw=2 fo=tcq1 comments=:# -gqgqjgqgqo -a b -#a b -ENDTEST - -{ -a b -#a b -} - -STARTTEST -/^{/+1 -:set tw=5 fo=tcn comments=:# -A bjA b -ENDTEST - -{ - 1 a -# 1 a -} - -STARTTEST -/^{/+3 -:set tw=5 fo=t2a si -i A_ -ENDTEST - -{ - - x a - b - c - -} - -STARTTEST -/^{/+1 -:set tw=5 fo=qn comments=:# -gwap -ENDTEST - -{ -# 1 a b -} - -STARTTEST -/^{/+1 -:set tw=5 fo=q2 comments=:# -gwap -ENDTEST - -{ -# x -# a b -} - -STARTTEST -/^{/+2 -:set tw& fo=a -I^^ -ENDTEST - -{ - 1aa - 2bb -} - -STARTTEST -/mno pqr/ -:setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/ -A vwx yz -ENDTEST - -/* abc def ghi jkl - * mno pqr stu - */ - -STARTTEST -/^#/ -:setl tw=12 fo=tqnc comments=:# -A foobar -ENDTEST - -# 1 xxxxx - -STARTTEST -:g/^STARTTEST/.,/^ENDTEST/d -:1;/^Results/,$wq! test.out -ENDTEST diff --git a/src/testdir/test68.ok b/src/testdir/test68.ok deleted file mode 100644 index b3726a0a27..0000000000 --- a/src/testdir/test68.ok +++ /dev/null @@ -1,77 +0,0 @@ -Results of test68: - - -{ -a -b -} - - -{ -a -b - -a -b -} - - -{ -a - - -a - -} - - -{ -a b -#a b - -a b -#a b -} - - -{ - 1 a - b -# 1 a -# b -} - - -{ - - x a - b_ - c - -} - - -{ -# 1 a -# b -} - - -{ -# x a -# b -} - - -{ 1aa ^^2bb } - - -/* abc def ghi jkl - * mno pqr stu - * vwx yz - */ - - -# 1 xxxxx -# foobar - diff --git a/src/testdir/test7.in b/src/testdir/test7.in deleted file mode 100644 index b9cc0585f6..0000000000 --- a/src/testdir/test7.in +++ /dev/null @@ -1,26 +0,0 @@ -Test for autocommand that changes the buffer list, when doing ":ball". - -STARTTEST -:so small.vim -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -:sp Xxx1 -:close -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -:sp Xxx2 -:close -$r3:.,/end of/w! Xxx3 " write test file Xxx3 -:sp Xxx3 -:close -:au BufReadPost Xxx2 bwipe -$r4:ball " open window for all args, close Xxx2 -:.,$w! test.out " Write contents of this file -:w >>test.out " Append contents of second window (Xxx1) -:/^start of/,$w >>test.out " Append contents of last window (this file) -:qa! -ENDTEST - -start of test file Xxx - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test7.ok b/src/testdir/test7.ok deleted file mode 100644 index a0d1ff94a3..0000000000 --- a/src/testdir/test7.ok +++ /dev/null @@ -1,12 +0,0 @@ -start of test file Xxx4 - this is a test - this is a test -end of test file Xxx -start of test file Xxx1 - this is a test - this is a test -end of test file Xxx -start of test file Xxx4 - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test71.in b/src/testdir/test71.in deleted file mode 100644 index 155fd413bc..0000000000 --- a/src/testdir/test71.in +++ /dev/null @@ -1,67 +0,0 @@ -Test for encryption. -The test data is in another file to avoid problems with 'encoding', especially -cp932. - -STARTTEST -:so small.vim -:set enc=latin1 -:bwipe! -:r test71a.in -:/^start of text/+1 -:let text_lines = getline('.', line('.') + 2) -:/^start of cm=zip bytes/+1 -:let cm0_bytes = getline('.', '.') -:/^start of cm=blowfish bytes/+1 -:let cm1_bytes = getline('.', '.') -:bwipe! -:call append(0, text_lines) -:$d -:X -foobar -foobar -:w! Xtestfile -:bwipe! -:e Xtestfile -foobar -:let cm0_read_back = getline('.', '$') -:set key= -:set cryptmethod=blowfish -:" If the blowfish test fails 'cryptmethod' will be 'zip' now. -:%s/^/\=&cryptmethod == 'blowfish' ? "OK " : "blowfish test failed "/ -:X -barfoo -barfoo -:w! Xtestfile -:bwipe! -:e Xtestfile -barfoo -:let cm1_read_back = getline('.', '$') -:bwipe! -:set bin noeol key= -:call append(0, cm0_bytes) -:$d -:set fenc=latin1 -:w! Xtestfile -:bwipe! -:set nobin -:e Xtestfile -foofoo -:let cm0_read_bin = getline('.', '$') -:bwipe! -:set bin noeol key= -:call append(0, cm1_bytes) -:$d -:set fenc=latin1 -:w! Xtestfile -:bwipe! -:set nobin -:e Xtestfile -barbar -:call append(0, cm0_read_bin) -:call append(0, cm1_read_back) -:call append(0, cm0_read_back) -:set key= fenc=latin1 -:w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test71.ok b/src/testdir/test71.ok deleted file mode 100644 index 24652c4380..0000000000 --- a/src/testdir/test71.ok +++ /dev/null @@ -1,10 +0,0 @@ -01234567890123456789012345678901234567 -line 2 foo bar blah -line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -OK 01234567890123456789012345678901234567 -OK line 2 foo bar blah -OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -1234567890 -abbccddeff -asdfasdfasdf -0001112223333 diff --git a/src/testdir/test71a.in b/src/testdir/test71a.in deleted file mode 100644 index 85bd22cd01..0000000000 --- a/src/testdir/test71a.in +++ /dev/null @@ -1,14 +0,0 @@ - -start of text -01234567890123456789012345678901234567 -line 2 foo bar blah -line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -end of text - -start of cm=zip bytes -VimCrypt~01!lV'}MgVE#32U -end of cm=zip bytes - -start of cm=blowfish bytes -VimCrypt~02!k)#S=#MJAͥM! -end of cm=blowfish bytes diff --git a/src/testdir/test72.in b/src/testdir/test72.in index 3b3a6a4329..961df4c5df 100644 --- a/src/testdir/test72.in +++ b/src/testdir/test72.in @@ -4,6 +4,7 @@ undo-able pieces. Do that by setting 'undolevels'. STARTTEST :so small.vim +:set belloff=all :" :" Test 'undofile': first a simple one-line change. :set nocompatible viminfo+=nviminfo visualbell @@ -25,7 +26,6 @@ u:.w! test.out :set undofile :bwipe! :e Xtestfile -:" TODO: this beeps u:.w >>test.out :" :" Test 'undofile', add 10 lines, delete 6 lines, undo 3 @@ -81,7 +81,8 @@ uu:w >>test.out :" :" With encryption, cryptmethod=blowfish :e! Xtestfile -:set undofile cm=blowfish +rubbish +:set undofile cm=blowfish ff& ggdGijan feb mar @@ -104,6 +105,32 @@ u:.w >>test.out u:.w >>test.out u:.w >>test.out :" +:" With encryption, cryptmethod=blowfish2 +:e! Xtestfile +rubbish +:set undofile cm=blowfish2 ff& +ggdGijan +feb +mar +apr +jun:set ul=100 +kk0ifoo :set ul=100 +dd:set ul=100 +ibar :set ul=100 +:X +foo2bar +foo2bar +:w! +:bwipe! +:e Xtestfile +foo2bar +:set key= +/bar +:.w >>test.out +u:.w >>test.out +u:.w >>test.out +u:.w >>test.out +:" :" Rename the undo file so that it gets cleaned up. :if has("vms") : call rename("_un_Xtestfile", "Xtestundo") diff --git a/src/testdir/test72.ok b/src/testdir/test72.ok index bb267d0d8b..8d30ba10b3 100644 --- a/src/testdir/test72.ok +++ b/src/testdir/test72.ok @@ -25,3 +25,7 @@ bar apr apr foo mar mar +bar apr +apr +foo mar +mar diff --git a/src/testdir/test73.in b/src/testdir/test73.in deleted file mode 100644 index 666e4d2e50..0000000000 --- a/src/testdir/test73.in +++ /dev/null @@ -1,176 +0,0 @@ -Tests for find completion. - -STARTTEST -:so small.vim -:" Do all test in a separate window to avoid E211 when we recursively -:" delete the Xfind directory during cleanup -:" -:" This will cause a few errors, do it silently. -:set visualbell -:set nocp viminfo+=nviminfo -:" -:function! DeleteDirectory(dir) -: if has("win16") || has("win32") || has("win64") || has("dos16") || has("dos32") -: exec "silent !rmdir /Q /S " . a:dir -: else -: exec "silent !rm -rf " . a:dir -: endif -:endfun -:" On windows a stale "Xfind" directory may exist, remove it so that -:" we start from a clean state. -:call DeleteDirectory("Xfind") -:new -:let cwd=getcwd() -:let test_out = cwd . '/test.out' -:call mkdir('Xfind') -:cd Xfind -:set path= -:find -:exec "w! " . test_out -:close -:new -:set path=. -:find -:exec "w >>" . test_out -:close -:new -:set path=.,, -:find -:exec "w >>" . test_out -:close -:new -:set path=./** -:find -:exec "w >>" . test_out -:close -:new -:" We shouldn't find any file at this point, test.out must be empty. -:call mkdir('in') -:cd in -:call mkdir('path') -:exec "cd " . cwd -:e Xfind/file.txt -SHoly Grail:w -:e Xfind/in/file.txt -SJimmy Hoffa:w -:e Xfind/in/stuff.txt -SAnother Holy Grail:w -:e Xfind/in/path/file.txt -SE.T.:w -:set path=Xfind/** -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:" Rerun the previous three find completions, using fullpath in 'path' -:exec "set path=" . cwd . "/Xfind/**" -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:" Same steps again, using relative and fullpath items that point to the same -:" recursive location. -:" This is to test that there are no duplicates in the completion list. -:exec "set path+=Xfind/**" -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:" Test find completion for directory of current buffer, which at this point -:" is Xfind/in/file.txt. -:set path=. -:find st -:exec "w >>" . test_out -:" Test find completion for empty path item ",," which is the current directory -:cd Xfind -:set path=,, -:find f -:exec "w >>" . test_out -:" Test shortening of -:" -:" foo/x/bar/voyager.txt -:" foo/y/bar/voyager.txt -:" -:" When current directory is above foo/ they should be shortened to (in order -:" of appearance): -:" -:" x/bar/voyager.txt -:" y/bar/voyager.txt -:call mkdir('foo') -:cd foo -:call mkdir('x') -:call mkdir('y') -:cd x -:call mkdir('bar') -:cd .. -:cd y -:call mkdir('bar') -:cd .. -:cd .. -:" We should now be in the Xfind directory -:e foo/x/bar/voyager.txt -SVoyager 1:w -:e foo/y/bar/voyager.txt -SVoyager 2:w -:exec "set path=" . cwd . "/Xfind/**" -:find voyager -:exec "w >>" . test_out -:find voyager -:exec "w >>" . test_out -:" -:" When current directory is .../foo/y/bar they should be shortened to (in -:" order of appearance): -:" -:" ./voyager.txt -:" x/bar/voyager.txt -:cd foo -:cd y -:cd bar -:find voyager -:exec "w >> " . test_out -:find voyager -:exec "w >> " . test_out -:" Check the opposite too: -:cd .. -:cd .. -:cd x -:cd bar -:find voyager -:exec "w >> " . test_out -:find voyager -:exec "w >> " . test_out -:" Check for correct handling of shorten_fname()'s behavior on windows -:exec "cd " . cwd . "/Xfind/in" -:find file -:exec "w >>" . test_out -:" Test for relative to current buffer 'path' item -:exec "cd " . cwd . "/Xfind/" -:set path=./path -:" Open the file where Jimmy Hoffa is found -:e in/file.txt -:" Find the file containing 'E.T.' in the Xfind/in/path directory -:find file -:exec "w >>" . test_out -:" -:" Test that completion works when path=.,, -:" -:set path=.,, -:" Open Jimmy Hoffa file -:e in/file.txt -:exec "w >>" . test_out -:" Search for the file containing Holy Grail in same directory as in/path.txt -:find stu -:exec "w >>" . test_out -:q -:exec "cd " . cwd -:call DeleteDirectory("Xfind") -:qa! -ENDTEST - diff --git a/src/testdir/test73.ok b/src/testdir/test73.ok deleted file mode 100644 index 90efab756f..0000000000 --- a/src/testdir/test73.ok +++ /dev/null @@ -1,21 +0,0 @@ -Holy Grail -Jimmy Hoffa -E.T. -Holy Grail -Jimmy Hoffa -E.T. -Holy Grail -Jimmy Hoffa -E.T. -Another Holy Grail -Holy Grail -Voyager 1 -Voyager 2 -Voyager 2 -Voyager 1 -Voyager 1 -Voyager 2 -Jimmy Hoffa -E.T. -Jimmy Hoffa -Another Holy Grail diff --git a/src/testdir/test74.in b/src/testdir/test74.in deleted file mode 100644 index 4fbe5e4d01..0000000000 --- a/src/testdir/test74.in +++ /dev/null @@ -1,36 +0,0 @@ -" Tests for storing global variables in the .viminfo file vim: set ft=vim: - -STARTTEST -:so small.vim -:" Do all test in a separate window to avoid E211 when we recursively -:" delete the Xfind directory during cleanup -:" -:" This will cause a few errors, do it silently. -:set visualbell -:set nocp viminfo+=!,nviminfo -:let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000} -:" store a really long list, so line wrapping will occur in viminfo file -:let MY_GLOBAL_LIST=range(1,100) -:wv! Xviminfo -:unlet MY_GLOBAL_DICT -:unlet MY_GLOBAL_LIST -:rv! Xviminfo -:call delete('Xviminfo') -:if exists("MY_GLOBAL_DICT") -:redir >> test.out -:echo MY_GLOBAL_DICT -:redir end -:endif -:if exists("MY_GLOBAL_LIST") -:redir >> test.out -:echo MY_GLOBAL_LIST -:redir end -:endif -:redir >> test.out -:echo "foobar" -:redir end -:endif -:qa! -ENDTEST - -eof diff --git a/src/testdir/test74.ok b/src/testdir/test74.ok deleted file mode 100644 index b026c33c35..0000000000 --- a/src/testdir/test74.ok +++ /dev/null @@ -1,5 +0,0 @@ - -{'foo': 1, 'longvarible': 1000, 'bar': 0} -[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] - -foobar diff --git a/src/testdir/test75.in b/src/testdir/test75.in deleted file mode 100644 index b7f2783f54..0000000000 --- a/src/testdir/test75.in +++ /dev/null @@ -1,41 +0,0 @@ -Tests for maparg(). -Also test utf8 map with a 0x80 byte. - -STARTTEST -:so small.vim -:so mbyte.vim -:set cpo-=< -:set encoding=utf8 -:" Test maparg() with a string result -:map foo<C-V> is<F4>foo -:vnoremap <script> <buffer> <expr> <silent> bar isbar -:call append('$', maparg('foo<C-V>')) -:call append('$', string(maparg('foo<C-V>', '', 0, 1))) -:call append('$', string(maparg('bar', '', 0, 1))) -:map <buffer> <nowait> foo bar -:call append('$', string(maparg('foo', '', 0, 1))) -:" -:map abc x<char-114>x -:call append('$', maparg('abc')) -:map abc y<S-char-114>y -:call append('$', maparg('abc')) -:" -Go:" -:" Outside of the range, minimum -:inoremap <Char-0x1040> a -:call feedkeys("a\u1040\<Esc>") -:" Inside of the range, minimum -:inoremap <Char-0x103f> b -:call feedkeys("a\u103f\<Esc>") -:" Inside of the range, maximum -:inoremap <Char-0xf03f> c -:call feedkeys("a\uf03f\<Esc>") -:" Outside of the range, maximum -:inoremap <Char-0xf040> d -:call feedkeys("a\uf040\<Esc>") -:" -:/^eof/+1,$w! test.out -:qa! -ENDTEST - -eof diff --git a/src/testdir/test75.ok b/src/testdir/test75.ok deleted file mode 100644 index a2c5c5ac3d..0000000000 --- a/src/testdir/test75.ok +++ /dev/null @@ -1,7 +0,0 @@ -is<F4>foo -{'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>', 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': 0, 'rhs': 'is<F4>foo', 'buffer': 0} -{'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v', 'nowait': 0, 'expr': 1, 'sid': 0, 'rhs': 'isbar', 'buffer': 1} -{'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ', 'nowait': 1, 'expr': 0, 'sid': 0, 'rhs': 'bar', 'buffer': 1} -xrx -yRy -abcd diff --git a/src/testdir/test76.in b/src/testdir/test76.in deleted file mode 100644 index db7ebe2169..0000000000 --- a/src/testdir/test76.in +++ /dev/null @@ -1,46 +0,0 @@ -Tests for completefunc/omnifunc. vim: set ft=vim : - -STARTTEST -:"Test that nothing happens if the 'completefunc' opens -:"a new window (no completion, no crash) -:so small.vim -:function! DummyCompleteOne(findstart, base) -: if a:findstart -: return 0 -: else -: wincmd n -: return ['onedef', 'oneDEF'] -: endif -:endfunction -:setlocal completefunc=DummyCompleteOne -/^one -A:q! -:function! DummyCompleteTwo(findstart, base) -: if a:findstart -: wincmd n -: return 0 -: else -: return ['twodef', 'twoDEF'] -: endif -:endfunction -:setlocal completefunc=DummyCompleteTwo -/^two -A:q! -:"Test that 'completefunc' works when it's OK. -:function! DummyCompleteThree(findstart, base) -: if a:findstart -: return 0 -: else -: return ['threedef', 'threeDEF'] -: endif -:endfunction -:setlocal completefunc=DummyCompleteThree -/^three -A:/^+++/,/^three/w! test.out -:qa! -ENDTEST - -+++ -one -two -three diff --git a/src/testdir/test76.ok b/src/testdir/test76.ok deleted file mode 100644 index 2a70acbade..0000000000 --- a/src/testdir/test76.ok +++ /dev/null @@ -1,4 +0,0 @@ -+++ - -two -threeDEF diff --git a/src/testdir/test77.in b/src/testdir/test77.in deleted file mode 100644 index 0dbc4fcbaf..0000000000 --- a/src/testdir/test77.in +++ /dev/null @@ -1,30 +0,0 @@ -Inserts 2 million lines with consecutive integers starting from 1 -(essentially, the output of GNU's seq 1 2000000), writes them to Xtest -and writes its cksum to test.out. - -We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess -up the lines the checksum would differ. - -cksum is part of POSIX and so should be available on most Unixes. -If it isn't available then the test will be skipped. - -STARTTEST -:so small.vim -:if !executable("cksum") -: e! test.ok -: w! test.out -: qa! -:endif -:set fileformat=unix undolevels=-1 -ggdG -:let i = 1 -:while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile -ggdd -:w! Xtest -:r !cksum Xtest -:s/\s/ /g -:set fileformat& -:.w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test77.ok b/src/testdir/test77.ok deleted file mode 100644 index 11f148c73f..0000000000 --- a/src/testdir/test77.ok +++ /dev/null @@ -1 +0,0 @@ -3678979763 14888896 Xtest diff --git a/src/testdir/test78.in b/src/testdir/test78.in deleted file mode 100644 index 1850bd9236..0000000000 --- a/src/testdir/test78.in +++ /dev/null @@ -1,46 +0,0 @@ -Inserts 10000 lines with text to fill the swap file with two levels of pointer -blocks. Then recovers from the swap file and checks all text is restored. - -We need about 10000 lines of 100 characters to get two levels of pointer -blocks. - -STARTTEST -:so small.vim -:set nocp fileformat=unix undolevels=-1 viminfo+=nviminfo -:e! Xtest -ggdG -:let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789" -:let i = 1 -:let linecount = 10000 -:while i <= linecount | call append(i - 1, i . text) | let i += 1 | endwhile -:preserve -:" get the name of the swap file -:redir => swapname -:swapname -:redir END -:let swapname = substitute(swapname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '') -:" make a copy of the swap file in Xswap -:set bin -:exe 'sp ' . swapname -:w! Xswap -:echo swapname -:set nobin -:new -:only! -:bwipe! Xtest -:call rename('Xswap', swapname) -:recover Xtest -:call delete(swapname) -:new -:call append(0, 'recovery start') -:wincmd w -:let linedollar = line('$') -:if linedollar < linecount | exe 'wincmd w' | call append(line('$'), "expected " . linecount . " lines but found only " . linedollar) | exe 'wincmd w' | let linecount = linedollar | endif -:let i = 1 -:while i <= linecount | if getline(i) != i . text | exe 'wincmd w' | call append(line('$'), i . ' differs') | exe 'wincmd w' | endif | let i += 1 | endwhile -:q! -:call append(line('$'), 'recovery end') -:w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test78.ok b/src/testdir/test78.ok deleted file mode 100644 index 6c3ecefe3c..0000000000 --- a/src/testdir/test78.ok +++ /dev/null @@ -1,3 +0,0 @@ -recovery start - -recovery end diff --git a/src/testdir/test79.in b/src/testdir/test79.in deleted file mode 100644 index 8278bd8000..0000000000 Binary files a/src/testdir/test79.in and /dev/null differ diff --git a/src/testdir/test79.ok b/src/testdir/test79.ok deleted file mode 100644 index e22eee0b71..0000000000 Binary files a/src/testdir/test79.ok and /dev/null differ diff --git a/src/testdir/test8.in b/src/testdir/test8.in deleted file mode 100644 index d9d00d97ae..0000000000 --- a/src/testdir/test8.in +++ /dev/null @@ -1,46 +0,0 @@ -Test for BufWritePre autocommand that deletes or unloads the buffer. -Test for BufUnload autocommand that unloads all other buffers. - -STARTTEST -:so small.vim -:au BufWritePre Xxx1 bunload -:au BufWritePre Xxx2 bwipe -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -:e! Xxx2 " edit Xxx2 -:bdel test8.in " delete this file from the buffer list -:e Xxx1 " edit Xxx1 -:w " write it, will unload it and give an error msg -:w! test.out " Write contents of this file -:e! Xxx2 " start editing Xxx2 -:bwipe test.out " remove test.out from the buffer list -:w " write it, will delete the buffer and give an error msg -:w >>test.out " Append contents of this file -:au! BufWritePre -:func CloseAll() - let i = 0 - while i <= bufnr('$') - if i != bufnr('%') && bufloaded(i) - exe i . "bunload" - endif - let i += 1 - endwhile -endfunc -:func WriteToOut() - edit! test.out - $put ='VimLeave done' - write -endfunc -:set viminfo='100,nviminfo -:au BufUnload * call CloseAll() -:au VimLeave * call WriteToOut() -:e small.vim -:sp mbyte.vim -:q -:qa! -ENDTEST - -start of Xxx - test -end of Xxx diff --git a/src/testdir/test8.ok b/src/testdir/test8.ok deleted file mode 100644 index adecb2f4be..0000000000 --- a/src/testdir/test8.ok +++ /dev/null @@ -1,7 +0,0 @@ -start of Xxx2 - test -end of Xxx -start of Xxx1 - test -end of Xxx -VimLeave done diff --git a/src/testdir/test80.in b/src/testdir/test80.in deleted file mode 100644 index 406fb6dac7..0000000000 --- a/src/testdir/test80.in +++ /dev/null @@ -1,201 +0,0 @@ -Test for *sub-replace-special* and *sub-replace-expression* on substitue(). -Test for submatch() on substitue(). -Test for *:s%* on :substitute. - -STARTTEST -:so small.vim -ENDTEST - -TEST_1: - -STARTTEST -:set magic -:set cpo& -:$put =\"\n\nTEST_1:\" -:$put =substitute('A', 'A', '&&', '') -:$put =substitute('B', 'B', '\&', '') -:$put =substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '') -:$put =substitute('D', 'D', 'd', '') -:$put =substitute('E', 'E', '~', '') -:$put =substitute('F', 'F', '\~', '') -:$put =substitute('G', 'G', '\ugg', '') -:$put =substitute('H', 'H', '\Uh\Eh', '') -:$put =substitute('I', 'I', '\lII', '') -:$put =substitute('J', 'J', '\LJ\EJ', '') -:$put =substitute('K', 'K', '\Uk\ek', '') -:$put =substitute('lLl', 'L', ' ', '') -:$put =substitute('mMm', 'M', '\r', '') -:$put =substitute('nNn', 'N', '\ ', '') -:$put =substitute('oOo', 'O', '\n', '') -:$put =substitute('pPp', 'P', '\b', '') -:$put =substitute('qQq', 'Q', '\t', '') -:$put =substitute('rRr', 'R', '\\', '') -:$put =substitute('sSs', 'S', '\c', '') -:$put =substitute('uUu', 'U', \"\n\", '') -:$put =substitute('vVv', 'V', \"\b\", '') -:$put =substitute('wWw', 'W', \"\\\", '') -:$put =substitute('xXx', 'X', \"\r\", '') -:$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '') -:$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '') -/^TEST_2 -ENDTEST - -TEST_2: - -STARTTEST -:set nomagic -:set cpo& -:$put =\"\n\nTEST_2:\" -:$put =substitute('A', 'A', '&&', '') -:$put =substitute('B', 'B', '\&', '') -:$put =substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '') -:$put =substitute('D', 'D', 'd', '') -:$put =substitute('E', 'E', '~', '') -:$put =substitute('F', 'F', '\~', '') -:$put =substitute('G', 'G', '\ugg', '') -:$put =substitute('H', 'H', '\Uh\Eh', '') -:$put =substitute('I', 'I', '\lII', '') -:$put =substitute('J', 'J', '\LJ\EJ', '') -:$put =substitute('K', 'K', '\Uk\ek', '') -:$put =substitute('lLl', 'L', ' ', '') -:$put =substitute('mMm', 'M', '\r', '') -:$put =substitute('nNn', 'N', '\ ', '') -:$put =substitute('oOo', 'O', '\n', '') -:$put =substitute('pPp', 'P', '\b', '') -:$put =substitute('qQq', 'Q', '\t', '') -:$put =substitute('rRr', 'R', '\\', '') -:$put =substitute('sSs', 'S', '\c', '') -:$put =substitute('tTt', 'T', \"\r\", '') -:$put =substitute('uUu', 'U', \"\n\", '') -:$put =substitute('vVv', 'V', \"\b\", '') -:$put =substitute('wWw', 'W', \"\\\", '') -:$put =substitute('X', 'X', '\L\uxXx\l\EX', '') -:$put =substitute('Y', 'Y', '\U\lYyY\u\Ey', '') -/^TEST_3 -ENDTEST - -TEST_3: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_3:\" -:let y = substitute('aAa', 'A', '\="\\"', '') | $put =y -:let y = substitute('bBb', 'B', '\="\\\\"', '') | $put =y -:let y = substitute('cCc', 'C', '\=" "', '') | $put =y -:let y = substitute('dDd', 'D', '\="\\ "', '') | $put =y -:let y = substitute('eEe', 'E', '\="\\\\ "', '') | $put =y -:let y = substitute('fFf', 'F', '\="\\r"', '') | $put =y -:let y = substitute('jJj', 'J', '\="\\n"', '') | $put =y -:let y = substitute('kKk', 'K', '\="\r"', '') | $put =y -:let y = substitute('lLl', 'L', '\="\n"', '') | $put =y -/^TEST_4 -ENDTEST - -TEST_4: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_4:\" -:let y = substitute('aAa', 'A', '\=substitute(submatch(0), ".", "\\", "")', '') | $put =y -:let y = substitute('bBb', 'B', '\=substitute(submatch(0), ".", "\\\\", "")', '') | $put =y -:let y = substitute('cCc', 'C', '\=substitute(submatch(0), ".", " ", "")', '') | $put =y -:let y = substitute('dDd', 'D', '\=substitute(submatch(0), ".", "\\ ", "")', '') | $put =y -:let y = substitute('eEe', 'E', '\=substitute(submatch(0), ".", "\\\\ ", "")', '') | $put =y -:let y = substitute('fFf', 'F', '\=substitute(submatch(0), ".", "\\r", "")', '') | $put =y -:let y = substitute('jJj', 'J', '\=substitute(submatch(0), ".", "\\n", "")', '') | $put =y -:let y = substitute('kKk', 'K', '\=substitute(submatch(0), ".", "\r", "")', '') | $put =y -:let y = substitute('lLl', 'L', '\=substitute(submatch(0), ".", "\n", "")', '') | $put =y -/^TEST_5 -ENDTEST - -TEST_5: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_5:\" -:$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)', '') -:$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '') -/^TEST_6 -ENDTEST - -TEST_6: - -STARTTEST -:set magic& -:$put =\"\n\nTEST_6:\" -:set cpo+=/ -:$put =substitute('A', 'A', 'a', '') -:$put =substitute('B', 'B', '%', '') -:set cpo-=/ -:$put =substitute('C', 'C', 'c', '') -:$put =substitute('D', 'D', '%', '') -/^TEST_7 -ENDTEST - -TEST_7: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_7:\" -:$put =substitute('A A', 'A.', '\=submatch(0)', '') -:$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '') -:$put =substitute(\"B\nB\", 'B.', '\=string(submatch(0, 1))', '') -:$put =substitute('-bb', '\zeb', 'a', 'g') -:$put =substitute('-bb', '\ze', 'c', 'g') -/^TEST_8 -ENDTEST - -TEST_8: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_8:\" -:$put =',,X' -:s/\(^\|,\)\ze\(,\|X\)/\1N/g -:$put =',,Y' -:s/\(^\|,\)\ze\(,\|Y\)/\1N/gc -a:$put =',,Z' -:s/\(^\|,\)\ze\(,\|Z\)/\1N/gc -yy/^TEST_9: -ENDTEST - -TEST_9: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_9:\" -:$put ='xxx' -:s/x/X/gc -yyq/^TEST_10: -ENDTEST - -TEST_10: - -STARTTEST -:set magic& -:set cpo& -:$put =\"\n\nTEST_10:\" -:let y = substitute('123', '\zs', 'a', 'g') | $put =y -:let y = substitute('123', '\zs.', 'a', 'g') | $put =y -:let y = substitute('123', '.\zs', 'a', 'g') | $put =y -:let y = substitute('123', '\ze', 'a', 'g') | $put =y -:let y = substitute('123', '\ze.', 'a', 'g') | $put =y -:let y = substitute('123', '.\ze', 'a', 'g') | $put =y -:let y = substitute('123', '1\|\ze', 'a', 'g') | $put =y -:let y = substitute('123', '1\zs\|[23]', 'a', 'g') | $put =y -/^TEST_11 -ENDTEST - -TEST_11: - -STARTTEST -:/^Results/,$wq! test.out -ENDTEST - -Results of test72: diff --git a/src/testdir/test80.ok b/src/testdir/test80.ok deleted file mode 100644 index b42f604a07..0000000000 --- a/src/testdir/test80.ok +++ /dev/null @@ -1,131 +0,0 @@ -Results of test72: - - -TEST_1: -AA -& -C123456789987654321 -d -~ -~ -Gg -Hh -iI -jJ -Kk -l l -m m -n n -o -o -pp -q q -r\r -scs -u -u -vv -w\w -x x -YyyY -zZZz - - -TEST_2: -AA -& -C123456789987654321 -d -~ -~ -Gg -Hh -iI -jJ -Kk -l l -m m -n n -o -o -pp -q q -r\r -scs -t t -u -u -vv -w\w -XxxX -yYYy - - -TEST_3: -a\a -b\\b -c c -d\ d -e\\ e -f\rf -j\nj -k k -l -l - - -TEST_4: -a\a -b\b -c c -d d -e\ e -f f -j -j -k k -l -l - - -TEST_5: -A123456789987654321 -[['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], ['2'], ['1']] - - -TEST_6: -a -% -c -% - - -TEST_7: -A A -B -B -['B -']B --abab -c-cbcbc - - -TEST_8: -N,,NX -N,,NY -N,,NZ - - -TEST_9: -XXx - - -TEST_10: -a1a2a3a -aaa -1a2a3a -a1a2a3a -a1a2a3 -aaa -aa2a3a -1aaa diff --git a/src/testdir/test81.in b/src/testdir/test81.in deleted file mode 100644 index 82a6892a1d..0000000000 --- a/src/testdir/test81.in +++ /dev/null @@ -1,22 +0,0 @@ -Test for t movement command and 'cpo-;' setting - -STARTTEST -:set nocompatible viminfo+=nviminfo -:set cpo-=; -/firstline/ -j0tt;D -0fz;D -$Fy;D -$Ty;D:set cpo+=; -j0tt;;D -$Ty;;D:?firstline?+1,$w! test.out -:qa! -ENDTEST - -firstline -aaa two three four - zzz -yyy -bbb yee yoo four -ccc two three four -ddd yee yoo four diff --git a/src/testdir/test81.ok b/src/testdir/test81.ok deleted file mode 100644 index e9f17dc4f8..0000000000 --- a/src/testdir/test81.ok +++ /dev/null @@ -1,6 +0,0 @@ -aaa two - z -y -bbb y -ccc -ddd yee y diff --git a/src/testdir/test82.in b/src/testdir/test82.in deleted file mode 100644 index 8503f5488f..0000000000 --- a/src/testdir/test82.in +++ /dev/null @@ -1,103 +0,0 @@ -Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c) -Also test "g~ap". - -STARTTEST -:so small.vim -:if !has("multi_byte") -: e! test.ok -: w! test.out -: qa! -:endif -:set enc=utf8 -ggdG -: -:function! Ch(a, op, b, expected) -: if eval(printf('"%s" %s "%s"', a:a, a:op, a:b)) != a:expected -: call append(line('$'), printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected)) -: else -: let b:passed += 1 -: endif -:endfunction -: -:function! Chk(a, b, result) -: if a:result == 0 -: call Ch(a:a, '==?', a:b, 1) -: call Ch(a:a, '!=?', a:b, 0) -: call Ch(a:a, '<=?', a:b, 1) -: call Ch(a:a, '>=?', a:b, 1) -: call Ch(a:a, '<?', a:b, 0) -: call Ch(a:a, '>?', a:b, 0) -: elseif a:result > 0 -: call Ch(a:a, '==?', a:b, 0) -: call Ch(a:a, '!=?', a:b, 1) -: call Ch(a:a, '<=?', a:b, 0) -: call Ch(a:a, '>=?', a:b, 1) -: call Ch(a:a, '<?', a:b, 0) -: call Ch(a:a, '>?', a:b, 1) -: else -: call Ch(a:a, '==?', a:b, 0) -: call Ch(a:a, '!=?', a:b, 1) -: call Ch(a:a, '<=?', a:b, 1) -: call Ch(a:a, '>=?', a:b, 0) -: call Ch(a:a, '<?', a:b, 1) -: call Ch(a:a, '>?', a:b, 0) -: endif -:endfunction -: -:function! Check(a, b, result) -: call Chk(a:a, a:b, a:result) -: call Chk(a:b, a:a, -a:result) -:endfunction -: -:function! LT(a, b) -: call Check(a:a, a:b, -1) -:endfunction -: -:function! GT(a, b) -: call Check(a:a, a:b, 1) -:endfunction -: -:function! EQ(a, b) -: call Check(a:a, a:b, 0) -:endfunction -: -:let b:passed=0 -:call EQ('', '') -:call LT('', 'a') -:call EQ('abc', 'abc') -:call EQ('Abc', 'abC') -:call LT('ab', 'abc') -:call LT('AB', 'abc') -:call LT('ab', 'aBc') -:call EQ('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xb9\xd0\xa6\xd0\xa3\xd0\xba\xd0\x95\xd0\xbd') -:call LT('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xaf\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd') -:call EQ('\xe2\x84\xaa', 'k') -:call LT('\xe2\x84\xaa', 'kkkkkk') -:call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk') -:call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa') -:call EQ('\xe2\x84\xaa\xe2\x84\xa6k\xe2\x84\xaak\xcf\x89', 'k\xcf\x89\xe2\x84\xaakk\xe2\x84\xa6') -:call EQ('Abc\x80', 'AbC\x80') -:call LT('Abc\x80', 'AbC\x81') -:call LT('Abc', 'AbC\x80') -:call LT('abc\x80DEF', 'abc\x80def') " case folding stops at the first bad character -:call LT('\xc3XYZ', '\xc3xyz') -:call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower) -:call GT('\xef\xbc\xba', '\xef\xbc\xff') " first string is ok and equals \xef\xbd\x9a after folding, second string is illegal and was left unchanged, then the strings were bytewise compared -:call LT('\xc3', '\xc3\x83') -:call EQ('\xc3\xa3xYz', '\xc3\x83XyZ') -:for n in range(0x60, 0xFF) | call LT(printf('xYz\x%.2X', n-1), printf('XyZ\x%.2X', n)) | endfor -:for n in range(0x80, 0xBF) | call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor -:for n in range(0xC0, 0xFF) | call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor -:call append(0, printf('%d checks passed', b:passed)) -:" -:" test that g~ap changes one paragraph only. -:new -iabcd - -defggg0g~ap:let lns = getline(1,3) -:q! -:call append(line('$'), lns) -:" -:wq! test.out -ENDTEST - diff --git a/src/testdir/test82.ok b/src/testdir/test82.ok deleted file mode 100644 index 3f1866a0fb..0000000000 --- a/src/testdir/test82.ok +++ /dev/null @@ -1,5 +0,0 @@ -3732 checks passed - -ABCD - -defg diff --git a/src/testdir/test83.in b/src/testdir/test83.in deleted file mode 100644 index 297d560d2f..0000000000 --- a/src/testdir/test83.in +++ /dev/null @@ -1,76 +0,0 @@ -Tests for tag search with !_TAG_FILE_ENCODING. - -STARTTEST -:so mbyte.vim -:set enc=utf8 -:if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" -: e! test.ok -: w! test.out -: qa! -:endif - -:/^text for tags1$/,/^text for tags1$/+1w! Xtags1.txt -:/^text for tags2$/,/^text for tags2$/+1w! Xtags2.txt -:/^text for tags3$/,/^text for tags3$/+1w! Xtags3.txt -:/^tags1$/+1,/^tags1-end$/-1w! Xtags1 - -ggdG - -:call setline('.', 'Results of test83') - -:" case1: -:new -:set tags=Xtags1 -:let v:errmsg = '' -:tag abcdefghijklmnopqrs -:if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs' -: close -: put ='case1: failed' -:else -: close -: put ='case1: ok' -:endif - -:" case2: -:new -:set tags=test83-tags2 -:let v:errmsg = '' -:tag /.BC -:if v:errmsg =~ 'E426:' || getline('.') != 'ABC' -: close -: put ='case2: failed' -:else -: close -: put ='case2: ok' -:endif - -:" case3: -:new -:set tags=test83-tags3 -:let v:errmsg = '' -:tag abc50 -:if v:errmsg =~ 'E426:' || getline('.') != 'ABC' -: close -: put ='case3: failed' -:else -: close -: put ='case3: ok' -:endif -:close - -:wq! test.out -ENDTEST - -text for tags1 -abcdefghijklmnopqrs - -text for tags2 -ABC - -text for tags3 -ABC - -tags1 -!_TAG_FILE_ENCODING utf-8 // -abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs -tags1-end diff --git a/src/testdir/test83.ok b/src/testdir/test83.ok deleted file mode 100644 index 61a1a04a18..0000000000 --- a/src/testdir/test83.ok +++ /dev/null @@ -1,4 +0,0 @@ -Results of test83 -case1: ok -case2: ok -case3: ok diff --git a/src/testdir/test84.in b/src/testdir/test84.in deleted file mode 100644 index 25482db54c..0000000000 --- a/src/testdir/test84.in +++ /dev/null @@ -1,35 +0,0 @@ -Tests for curswant not changing when setting an option - -STARTTEST -:so small.vim -:/^start target options$/+1,/^end target options$/-1 yank -:let target_option_names = split(@0) -:function TestCurswant(option_name) -: normal! ggf8j -: let curswant_before = winsaveview().curswant -: execute 'let' '&'.a:option_name '=' '&'.a:option_name -: let curswant_after = winsaveview().curswant -: return [a:option_name, curswant_before, curswant_after] -:endfunction -: -:new -:put =['1234567890', '12345'] -:1 delete _ -:let result = [] -:for option_name in target_option_names -: call add(result, TestCurswant(option_name)) -:endfor -: -:new -:put =map(copy(result), 'join(v:val, '' '')') -:1 delete _ -:write test.out -: -:qall! -ENDTEST - -start target options - tabstop - timeoutlen - ttimeoutlen -end target options diff --git a/src/testdir/test84.ok b/src/testdir/test84.ok deleted file mode 100644 index 8b8e4ee824..0000000000 --- a/src/testdir/test84.ok +++ /dev/null @@ -1,3 +0,0 @@ -tabstop 7 4 -timeoutlen 7 7 -ttimeoutlen 7 7 diff --git a/src/testdir/test85.in b/src/testdir/test85.in index c5ca873a49..0a13394752 100644 --- a/src/testdir/test85.in +++ b/src/testdir/test85.in @@ -2,6 +2,7 @@ Test for Lua interface and luaeval() function STARTTEST :so small.vim +:set belloff=all :so lua.vim :set nocompatible viminfo+=nviminfo :lua l = vim.list():add"item0":add"dictionary with list OK":add"item2" diff --git a/src/testdir/test86.in b/src/testdir/test86.in index b1692939a7..71dd9f1fd8 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -13,6 +13,7 @@ STARTTEST :lang C :fun Test() :py import vim +:py cb = vim.current.buffer :let l = [] :py l=vim.bindeval('l') :py f=vim.bindeval('function("strlen")') @@ -207,7 +208,15 @@ EOF :let l = [0, 1, 2, 3] :py l=vim.bindeval('l') :lockvar! l -:py l[2]='i' +py << EOF +def emsg(ei): + return ei[0].__name__ + ':' + repr(ei[1].args) + +try: + l[2]='i' +except vim.error: + cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info())) +EOF :$put =string(l) :unlockvar! l :" @@ -219,7 +228,7 @@ def ee(expr, g=globals(), l=locals()): exec(expr, g, l) except: ei = sys.exc_info() - msg = sys.exc_info()[0].__name__ + ':' + repr(sys.exc_info()[1].args) + msg = emsg(ei) msg = msg.replace('TypeError:(\'argument 1 ', 'TypeError:(\'') if expr.find('None') > -1: msg = msg.replace('TypeError:(\'iteration over non-sequence\',)', @@ -230,6 +239,14 @@ def ee(expr, g=globals(), l=locals()): 'TypeError:("\'FailingNumber\' object is not iterable",)') if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1: msg = msg.replace('(\'', '("').replace('\',)', '",)') + # Some Python versions say can't, others cannot. + if msg.find('can\'t') > -1: + msg = msg.replace('can\'t', 'cannot') + # Some Python versions use single quote, some double quote + if msg.find('"cannot ') > -1: + msg = msg.replace('"cannot ', '\'cannot ') + if msg.find(' attributes"') > -1: + msg = msg.replace(' attributes"', ' attributes\'') if expr == 'fd(self=[])': # HACK: PyMapping_Check changed meaning msg = msg.replace('AttributeError:(\'keys\',)', @@ -329,6 +346,8 @@ EOF :$put =string(l) :let d=pyeval('{"a": "b", "c": 1, "d": ["e"]}') :$put =sort(items(d)) +:let v:errmsg = '' +:$put ='pyeval(\"None\") = ' . pyeval('None') . v:errmsg :if has('float') : let f=pyeval('0.0') : $put =string(f) @@ -370,7 +389,9 @@ EOF :sleep 1 :py t.running = False :py t.join() -:py l[0] = t.t > 8 # check if the background thread is working +:" Check if the background thread is working. Count should be 10, but on a +:" busy system (AppVeyor) it can be much lower. +:py l[0] = t.t > 4 :py del time :py del threading :py del t @@ -607,7 +628,6 @@ EOF : autocmd BufFilePre * python cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")')) :augroup END py << EOF -cb = vim.current.buffer # Tests BufferAppend and BufferItem cb.append(b[0]) # Tests BufferSlice and BufferAssSlice @@ -861,6 +881,237 @@ EOF :$put =string(pyeval('vim.List()')) :$put =string(pyeval('vim.List(iter(''abc7''))')) :$put =string(pyeval('vim.Function(''tr'')')) +:$put =string(pyeval('vim.Function(''tr'', args=[123, 3, 4])')) +:$put =string(pyeval('vim.Function(''tr'', args=[])')) +:$put =string(pyeval('vim.Function(''tr'', self={})')) +:$put =string(pyeval('vim.Function(''tr'', args=[123, 3, 4], self={})')) +:$put ='auto_rebind' +:$put =string(pyeval('vim.Function(''tr'', auto_rebind=False)')) +:$put =string(pyeval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)')) +:$put =string(pyeval('vim.Function(''tr'', args=[], auto_rebind=False)')) +:$put =string(pyeval('vim.Function(''tr'', self={}, auto_rebind=False)')) +:$put =string(pyeval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)')) +:" +:" Test vim.Function +:function Args(...) +: return a:000 +:endfunction +:function SelfArgs(...) dict +: return [a:000, self] +:endfunction +:" The following four lines should not crash +:let Pt = function('tr', [[]], {'l': []}) +:py Pt = vim.bindeval('Pt') +:unlet Pt +:py del Pt +py << EOF +def ecall(out_prefix, func, *args, **kwargs): + line = out_prefix + ': ' + try: + ret = func(*args, **kwargs) + except Exception: + line += '!exception: ' + emsg(sys.exc_info()) + else: + line += '!result: ' + vim.Function('string')(ret) + cb.append(line) +a = vim.Function('Args') +pa1 = vim.Function('Args', args=['abcArgsPA1']) +pa2 = vim.Function('Args', args=[]) +pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}) +pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'}) +cb.append('a: ' + repr(a)) +cb.append('pa1: ' + repr(pa1)) +cb.append('pa2: ' + repr(pa2)) +cb.append('pa3: ' + repr(pa3)) +cb.append('pa4: ' + repr(pa4)) +sa = vim.Function('SelfArgs') +psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1']) +psa2 = vim.Function('SelfArgs', args=[]) +psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}) +psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}) +psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0) +psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto_rebind=()) +psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[]) +psa8 = vim.Function('SelfArgs', auto_rebind=False) +psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True) +psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=1) +psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'}) +psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC']) +cb.append('sa: ' + repr(sa)) +cb.append('psa1: ' + repr(psa1)) +cb.append('psa2: ' + repr(psa2)) +cb.append('psa3: ' + repr(psa3)) +cb.append('psa4: ' + repr(psa4)) +cb.append('psa5: ' + repr(psa5)) +cb.append('psa6: ' + repr(psa6)) +cb.append('psa7: ' + repr(psa7)) +cb.append('psa8: ' + repr(psa8)) +cb.append('psa9: ' + repr(psa9)) +cb.append('psaA: ' + repr(psaA)) +cb.append('psaB: ' + repr(psaB)) +cb.append('psaC: ' + repr(psaC)) + +psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'abcSelfPSArVal'}) +psar.args[0]['abcArgsPSAr2'] = [psar.self, psar.args[0]] +psar.self['rec'] = psar +psar.self['self'] = psar.self +psar.self['args'] = psar.args + +try: + cb.append('psar: ' + repr(psar)) +except Exception: + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) +EOF +:$put ='s(a): '.string(pyeval('a')) +:$put ='s(pa1): '.string(pyeval('pa1')) +:$put ='s(pa2): '.string(pyeval('pa2')) +:$put ='s(pa3): '.string(pyeval('pa3')) +:$put ='s(pa4): '.string(pyeval('pa4')) +:$put ='s(sa): '.string(pyeval('sa')) +:$put ='s(psa1): '.string(pyeval('psa1')) +:$put ='s(psa2): '.string(pyeval('psa2')) +:$put ='s(psa3): '.string(pyeval('psa3')) +:$put ='s(psa4): '.string(pyeval('psa4')) +:$put ='s(psa5): '.string(pyeval('psa5')) +:$put ='s(psa6): '.string(pyeval('psa6')) +:$put ='s(psa7): '.string(pyeval('psa7')) +:$put ='s(psa8): '.string(pyeval('psa8')) +:$put ='s(psa9): '.string(pyeval('psa9')) +:$put ='s(psaA): '.string(pyeval('psaA')) +:$put ='s(psaB): '.string(pyeval('psaB')) +:$put ='s(psaC): '.string(pyeval('psaC')) +: +:for v in ['sa', 'psa1', 'psa2', 'psa3', 'psa4', 'psa5', 'psa6', 'psa7', 'psa8', 'psa9', 'psaA', 'psaB', 'psaC'] +: let d = {'f': pyeval(v)} +: $put ='d.'.v.'(): '.string(d.f()) +:endfor +: +:py ecall('a()', a, ) +:py ecall('pa1()', pa1, ) +:py ecall('pa2()', pa2, ) +:py ecall('pa3()', pa3, ) +:py ecall('pa4()', pa4, ) +:py ecall('sa()', sa, ) +:py ecall('psa1()', psa1, ) +:py ecall('psa2()', psa2, ) +:py ecall('psa3()', psa3, ) +:py ecall('psa4()', psa4, ) +: +:py ecall('a(42, 43)', a, 42, 43) +:py ecall('pa1(42, 43)', pa1, 42, 43) +:py ecall('pa2(42, 43)', pa2, 42, 43) +:py ecall('pa3(42, 43)', pa3, 42, 43) +:py ecall('pa4(42, 43)', pa4, 42, 43) +:py ecall('sa(42, 43)', sa, 42, 43) +:py ecall('psa1(42, 43)', psa1, 42, 43) +:py ecall('psa2(42, 43)', psa2, 42, 43) +:py ecall('psa3(42, 43)', psa3, 42, 43) +:py ecall('psa4(42, 43)', psa4, 42, 43) +: +:py ecall('a(42, self={"20": 1})', a, 42, self={'20': 1}) +:py ecall('pa1(42, self={"20": 1})', pa1, 42, self={'20': 1}) +:py ecall('pa2(42, self={"20": 1})', pa2, 42, self={'20': 1}) +:py ecall('pa3(42, self={"20": 1})', pa3, 42, self={'20': 1}) +:py ecall('pa4(42, self={"20": 1})', pa4, 42, self={'20': 1}) +:py ecall('sa(42, self={"20": 1})', sa, 42, self={'20': 1}) +:py ecall('psa1(42, self={"20": 1})', psa1, 42, self={'20': 1}) +:py ecall('psa2(42, self={"20": 1})', psa2, 42, self={'20': 1}) +:py ecall('psa3(42, self={"20": 1})', psa3, 42, self={'20': 1}) +:py ecall('psa4(42, self={"20": 1})', psa4, 42, self={'20': 1}) +: +:py ecall('a(self={"20": 1})', a, self={'20': 1}) +:py ecall('pa1(self={"20": 1})', pa1, self={'20': 1}) +:py ecall('pa2(self={"20": 1})', pa2, self={'20': 1}) +:py ecall('pa3(self={"20": 1})', pa3, self={'20': 1}) +:py ecall('pa4(self={"20": 1})', pa4, self={'20': 1}) +:py ecall('sa(self={"20": 1})', sa, self={'20': 1}) +:py ecall('psa1(self={"20": 1})', psa1, self={'20': 1}) +:py ecall('psa2(self={"20": 1})', psa2, self={'20': 1}) +:py ecall('psa3(self={"20": 1})', psa3, self={'20': 1}) +:py ecall('psa4(self={"20": 1})', psa4, self={'20': 1}) +py << EOF +def s(v): + if v is None: + return repr(v) + else: + return vim.Function('string')(v) + +cb.append('a.args: ' + s(a.args)) +cb.append('pa1.args: ' + s(pa1.args)) +cb.append('pa2.args: ' + s(pa2.args)) +cb.append('pa3.args: ' + s(pa3.args)) +cb.append('pa4.args: ' + s(pa4.args)) +cb.append('sa.args: ' + s(sa.args)) +cb.append('psa1.args: ' + s(psa1.args)) +cb.append('psa2.args: ' + s(psa2.args)) +cb.append('psa3.args: ' + s(psa3.args)) +cb.append('psa4.args: ' + s(psa4.args)) + +cb.append('a.self: ' + s(a.self)) +cb.append('pa1.self: ' + s(pa1.self)) +cb.append('pa2.self: ' + s(pa2.self)) +cb.append('pa3.self: ' + s(pa3.self)) +cb.append('pa4.self: ' + s(pa4.self)) +cb.append('sa.self: ' + s(sa.self)) +cb.append('psa1.self: ' + s(psa1.self)) +cb.append('psa2.self: ' + s(psa2.self)) +cb.append('psa3.self: ' + s(psa3.self)) +cb.append('psa4.self: ' + s(psa4.self)) + +cb.append('a.name: ' + s(a.name)) +cb.append('pa1.name: ' + s(pa1.name)) +cb.append('pa2.name: ' + s(pa2.name)) +cb.append('pa3.name: ' + s(pa3.name)) +cb.append('pa4.name: ' + s(pa4.name)) +cb.append('sa.name: ' + s(sa.name)) +cb.append('psa1.name: ' + s(psa1.name)) +cb.append('psa2.name: ' + s(psa2.name)) +cb.append('psa3.name: ' + s(psa3.name)) +cb.append('psa4.name: ' + s(psa4.name)) + +cb.append('a.auto_rebind: ' + s(a.auto_rebind)) +cb.append('pa1.auto_rebind: ' + s(pa1.auto_rebind)) +cb.append('pa2.auto_rebind: ' + s(pa2.auto_rebind)) +cb.append('pa3.auto_rebind: ' + s(pa3.auto_rebind)) +cb.append('pa4.auto_rebind: ' + s(pa4.auto_rebind)) +cb.append('sa.auto_rebind: ' + s(sa.auto_rebind)) +cb.append('psa1.auto_rebind: ' + s(psa1.auto_rebind)) +cb.append('psa2.auto_rebind: ' + s(psa2.auto_rebind)) +cb.append('psa3.auto_rebind: ' + s(psa3.auto_rebind)) +cb.append('psa4.auto_rebind: ' + s(psa4.auto_rebind)) +cb.append('psa5.auto_rebind: ' + s(psa5.auto_rebind)) +cb.append('psa6.auto_rebind: ' + s(psa6.auto_rebind)) +cb.append('psa7.auto_rebind: ' + s(psa7.auto_rebind)) +cb.append('psa8.auto_rebind: ' + s(psa8.auto_rebind)) +cb.append('psa9.auto_rebind: ' + s(psa9.auto_rebind)) +cb.append('psaA.auto_rebind: ' + s(psaA.auto_rebind)) +cb.append('psaB.auto_rebind: ' + s(psaB.auto_rebind)) +cb.append('psaC.auto_rebind: ' + s(psaC.auto_rebind)) + +del s + +del a +del pa1 +del pa2 +del pa3 +del pa4 +del sa +del psa1 +del psa2 +del psa3 +del psa4 +del psa5 +del psa6 +del psa7 +del psa8 +del psa9 +del psaA +del psaB +del psaC +del psar + +del ecall +EOF :" :" Test stdout/stderr :redir => messages @@ -1094,8 +1345,25 @@ cb.append(">> OutputSetattr") ee('del sys.stdout.softspace') number_test('sys.stdout.softspace = %s', unsigned=True) number_test('sys.stderr.softspace = %s', unsigned=True) +ee('assert sys.stdout.isatty()==False') +ee('assert sys.stdout.seekable()==False') +ee('sys.stdout.close()') +ee('sys.stdout.flush()') +ee('assert sys.stderr.isatty()==False') +ee('assert sys.stderr.seekable()==False') +ee('sys.stderr.close()') +ee('sys.stderr.flush()') ee('sys.stdout.attr = None') cb.append(">> OutputWrite") +ee('assert sys.stdout.writable()==True') +ee('assert sys.stdout.readable()==False') +ee('assert sys.stderr.writable()==True') +ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') @@ -1124,7 +1392,7 @@ ee('vim.foreach_rtp(FailingCall())') ee('vim.foreach_rtp(int, 2)') cb.append('> import') old_rtp = vim.options['rtp'] -vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\') +vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,') ee('import xxx_no_such_module_xxx') ee('import failing_import') ee('import failing') @@ -1208,9 +1476,20 @@ ee('l.locked = FailingTrue()') ee('l.xxx = True') cb.append("> Function") cb.append(">> FunctionConstructor") +cb.append(">>> FunctionConstructor") ee('vim.Function("123")') ee('vim.Function("xxx_non_existent_function_xxx")') ee('vim.Function("xxx#non#existent#function#xxx")') +ee('vim.Function("xxx_non_existent_function_xxx2", args=[])') +ee('vim.Function("xxx_non_existent_function_xxx3", self={})') +ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})') +cb.append(">>> FunctionNew") +ee('vim.Function("tr", self="abcFuncSelf")') +ee('vim.Function("tr", args=427423)') +ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function("tr", "")') cb.append(">> FunctionCall") convertfrompyobject_test('f(%s)') convertfrompymapping_test('fd(self=%s)') @@ -1365,7 +1644,7 @@ def test_keyboard_interrupt(): except KeyboardInterrupt: cb.append('Caught KeyboardInterrupt') except Exception: - cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info)) + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) else: cb.append('!!!!!!!! No exception') try: @@ -1373,7 +1652,7 @@ def test_keyboard_interrupt(): except KeyboardInterrupt: cb.append('!!!!!!!! Caught KeyboardInterrupt') except Exception: - cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info)) + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) else: cb.append('No exception') EOF @@ -1384,6 +1663,7 @@ EOF :debug silent! py test_keyboard_interrupt() :redir END :0 debuggreedy +:call inputrestore() :silent $put =output :unlet output :py del test_keyboard_interrupt @@ -1392,6 +1672,7 @@ EOF py << EOF del cb del ee +del emsg del sys del os del vim @@ -1424,7 +1705,7 @@ EOF :" :/^start:/,$wq! test.out :" vim: et ts=4 isk-=\: -:call getchar() +:while getchar(0) isnot 0|endwhile ENDTEST start: diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 8edb749970..f8d4ceb577 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -57,6 +57,7 @@ None [0, 1, 2, 3, 4, 5, 6, 7] [0, 1, 2, 3, 4, 5, 6, 7] [0, 1, 2, 3, 4, 5, 6, 7] +l[2] threw vim.error: error:('list is locked',) [0, 1, 2, 3] [function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd'] [function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}] @@ -86,6 +87,7 @@ ll:[1] ['a', 'b'] ['c', 1] ['d', ['e']] +pyeval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: @@ -441,25 +443,174 @@ vim.current.window:Window:True vim.current.tabpage:TabPage:True current:__dir__,__members__,buffer,line,range,tabpage,window buffer:__dir__,__members__,append,mark,name,number,options,range,valid,vars -window:__dir__,__members__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars +window:__dir__,__members__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars,width tabpage:__dir__,__members__,number,valid,vars,window,windows range:__dir__,__members__,append,end,start dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,__members__,extend,locked -function:__dir__,__members__,softspace -output:__dir__,__members__,flush,softspace,write,writelines +function:__dir__,__members__,args,auto_rebind,self,softspace +output:__dir__,__members__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} [] ['a', 'b', 'c', '7'] function('tr') +function('tr', [123, 3, 4]) +function('tr') +function('tr', {}) +function('tr', [123, 3, 4], {}) +auto_rebind +function('tr') +function('tr', [123, 3, 4]) +function('tr') +function('tr', {}) +function('tr', [123, 3, 4], {}) +a: <vim.Function 'Args'> +pa1: <vim.Function 'Args', args=['abcArgsPA1']> +pa2: <vim.Function 'Args'> +pa3: <vim.Function 'Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}> +pa4: <vim.Function 'Args', self={'abcSelfPA4': 'abcSelfPA4Val'}> +sa: <vim.Function 'SelfArgs'> +psa1: <vim.Function 'SelfArgs', args=['abcArgsPSA1']> +psa2: <vim.Function 'SelfArgs'> +psa3: <vim.Function 'SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}> +psa4: <vim.Function 'SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}> +psa5: <vim.Function 'SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}> +psa6: <vim.Function 'SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}> +psa7: <vim.Function 'SelfArgs', args=['abcArgsPSA7']> +psa8: <vim.Function 'SelfArgs'> +psa9: <vim.Function 'SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True> +psaA: <vim.Function 'SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=True> +psaB: <vim.Function 'SelfArgs', args=['abcArgsPSAB']> +psaC: <vim.Function 'SelfArgs'> +psar: <vim.Function 'SelfArgs', args=[{'abcArgsPSAr2': [{'rec': function('SelfArgs', [{...}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{...}]}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], self={'rec': function('SelfArgs', [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}]}> +s(a): function('Args') +s(pa1): function('Args', ['abcArgsPA1']) +s(pa2): function('Args') +s(pa3): function('Args', ['abcArgsPA3'], {'abcSelfPA3': 'abcSelfPA3Val'}) +s(pa4): function('Args', {'abcSelfPA4': 'abcSelfPA4Val'}) +s(sa): function('SelfArgs') +s(psa1): function('SelfArgs', ['abcArgsPSA1']) +s(psa2): function('SelfArgs') +s(psa3): function('SelfArgs', ['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}) +s(psa4): function('SelfArgs', {'abcSelfPSA4': 'abcSelfPSA4Val'}) +s(psa5): function('SelfArgs', {'abcSelfPSA5': 'abcSelfPSA5Val'}) +s(psa6): function('SelfArgs', ['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}) +s(psa7): function('SelfArgs', ['abcArgsPSA7']) +s(psa8): function('SelfArgs') +s(psa9): function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'}) +s(psaA): function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'}) +s(psaB): function('SelfArgs', ['abcArgsPSAB']) +s(psaC): function('SelfArgs') +d.sa(): [[], {'f': function('SelfArgs')}] +d.psa1(): [['abcArgsPSA1'], {'f': function('SelfArgs', ['abcArgsPSA1'])}] +d.psa2(): [[], {'f': function('SelfArgs')}] +d.psa3(): [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +d.psa4(): [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +d.psa5(): [[], {'abcSelfPSA5': 'abcSelfPSA5Val'}] +d.psa6(): [['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}] +d.psa7(): [['abcArgsPSA7'], {'f': function('SelfArgs', ['abcArgsPSA7'])}] +d.psa8(): [[], {'f': function('SelfArgs')}] +d.psa9(): [[], {'f': function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'})}] +d.psaA(): [['abcArgsPSAA'], {'f': function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'})}] +d.psaB(): [['abcArgsPSAB'], {'f': function('SelfArgs', ['abcArgsPSAB'])}] +d.psaC(): [[], {'f': function('SelfArgs')}] +a(): !result: [] +pa1(): !result: ['abcArgsPA1'] +pa2(): !result: [] +pa3(): !result: ['abcArgsPA3'] +pa4(): !result: [] +sa(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa1(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa2(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa3(): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +psa4(): !result: [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +a(42, 43): !result: [42, 43] +pa1(42, 43): !result: ['abcArgsPA1', 42, 43] +pa2(42, 43): !result: [42, 43] +pa3(42, 43): !result: ['abcArgsPA3', 42, 43] +pa4(42, 43): !result: [42, 43] +sa(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa1(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa2(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa3(42, 43): !result: [['abcArgsPSA3', 42, 43], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +psa4(42, 43): !result: [[42, 43], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +a(42, self={"20": 1}): !result: [42] +pa1(42, self={"20": 1}): !result: ['abcArgsPA1', 42] +pa2(42, self={"20": 1}): !result: [42] +pa3(42, self={"20": 1}): !result: ['abcArgsPA3', 42] +pa4(42, self={"20": 1}): !result: [42] +sa(42, self={"20": 1}): !result: [[42], {'20': 1}] +psa1(42, self={"20": 1}): !result: [['abcArgsPSA1', 42], {'20': 1}] +psa2(42, self={"20": 1}): !result: [[42], {'20': 1}] +psa3(42, self={"20": 1}): !result: [['abcArgsPSA3', 42], {'20': 1}] +psa4(42, self={"20": 1}): !result: [[42], {'20': 1}] +a(self={"20": 1}): !result: [] +pa1(self={"20": 1}): !result: ['abcArgsPA1'] +pa2(self={"20": 1}): !result: [] +pa3(self={"20": 1}): !result: ['abcArgsPA3'] +pa4(self={"20": 1}): !result: [] +sa(self={"20": 1}): !result: [[], {'20': 1}] +psa1(self={"20": 1}): !result: [['abcArgsPSA1'], {'20': 1}] +psa2(self={"20": 1}): !result: [[], {'20': 1}] +psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}] +psa4(self={"20": 1}): !result: [[], {'20': 1}] +a.args: None +pa1.args: ['abcArgsPA1'] +pa2.args: None +pa3.args: ['abcArgsPA3'] +pa4.args: None +sa.args: None +psa1.args: ['abcArgsPSA1'] +psa2.args: None +psa3.args: ['abcArgsPSA3'] +psa4.args: None +a.self: None +pa1.self: None +pa2.self: None +pa3.self: {'abcSelfPA3': 'abcSelfPA3Val'} +pa4.self: {'abcSelfPA4': 'abcSelfPA4Val'} +sa.self: None +psa1.self: None +psa2.self: None +psa3.self: {'abcSelfPSA3': 'abcSelfPSA3Val'} +psa4.self: {'abcSelfPSA4': 'abcSelfPSA4Val'} +a.name: 'Args' +pa1.name: 'Args' +pa2.name: 'Args' +pa3.name: 'Args' +pa4.name: 'Args' +sa.name: 'SelfArgs' +psa1.name: 'SelfArgs' +psa2.name: 'SelfArgs' +psa3.name: 'SelfArgs' +psa4.name: 'SelfArgs' +a.auto_rebind: 1 +pa1.auto_rebind: 1 +pa2.auto_rebind: 1 +pa3.auto_rebind: 0 +pa4.auto_rebind: 0 +sa.auto_rebind: 1 +psa1.auto_rebind: 1 +psa2.auto_rebind: 1 +psa3.auto_rebind: 0 +psa4.auto_rebind: 0 +psa5.auto_rebind: 0 +psa6.auto_rebind: 0 +psa7.auto_rebind: 1 +psa8.auto_rebind: 1 +psa9.auto_rebind: 1 +psaA.auto_rebind: 1 +psaB.auto_rebind: 1 +psaC.auto_rebind: 1 ' abcdef -line : +Error detected while processing function RunTest[]..Test: +line : abcdef abcA -line : +line : abcB' ['a', 'dup_a'] ['a', 'a'] @@ -477,7 +628,7 @@ testdir test86.in > Output >> OutputSetattr -del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",) +del sys.stdout.softspace:AttributeError:('cannot delete OutputObject attributes',) >>> Testing NumberToLong using sys.stdout.softspace = %s sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',) sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',) @@ -488,8 +639,25 @@ sys.stderr.softspace = []:TypeError:('expected int(), long() or something suppor sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',) sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',) <<< Finished +assert sys.stdout.isatty()==False:NOT FAILED +assert sys.stdout.seekable()==False:NOT FAILED +sys.stdout.close():NOT FAILED +sys.stdout.flush():NOT FAILED +assert sys.stderr.isatty()==False:NOT FAILED +assert sys.stderr.seekable()==False:NOT FAILED +sys.stderr.close():NOT FAILED +sys.stderr.flush():NOT FAILED sys.stdout.attr = None:AttributeError:('invalid attribute: attr',) >> OutputWrite +assert sys.stdout.writable()==True:NOT FAILED +assert sys.stdout.readable()==False:NOT FAILED +assert sys.stderr.writable()==True:NOT FAILED +assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) >> OutputWriteLines sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) @@ -600,7 +768,7 @@ d["a"] = {"abcF" : FailingIter()}:TypeError:('unable to convert FailingIter to v d["a"] = {"abcF" : FailingIterNext()}:NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s} -d["a"] = {"abcF" : None}:TypeError:('unable to convert NoneType to vim structure',) +d["a"] = {"abcF" : None}:NOT FAILED d["a"] = {"abcF" : {"": 1}}:ValueError:('empty keys are not allowed',) d["a"] = {"abcF" : {u"": 1}}:ValueError:('empty keys are not allowed',) d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:('keys',) @@ -627,7 +795,7 @@ d["a"] = Mapping({"abcG" : FailingIter()}):TypeError:('unable to convert Failing d["a"] = Mapping({"abcG" : FailingIterNext()}):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s}) -d["a"] = Mapping({"abcG" : None}):TypeError:('unable to convert NoneType to vim structure',) +d["a"] = Mapping({"abcG" : None}):NOT FAILED d["a"] = Mapping({"abcG" : {"": 1}}):ValueError:('empty keys are not allowed',) d["a"] = Mapping({"abcG" : {u"": 1}}):ValueError:('empty keys are not allowed',) d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:('keys',) @@ -639,7 +807,7 @@ d["a"] = FailingIter():TypeError:('unable to convert FailingIter to vim structur d["a"] = FailingIterNext():NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = %s -d["a"] = None:TypeError:('unable to convert NoneType to vim structure',) +d["a"] = None:NOT FAILED d["a"] = {"": 1}:ValueError:('empty keys are not allowed',) d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',) d["a"] = FailingMapping():NotImplementedError:('keys',) @@ -676,7 +844,7 @@ d.update({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to d.update({"abcF" : FailingIterNext()}):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d.update({"abcF" : %s}) -d.update({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +d.update({"abcF" : None}):NOT FAILED d.update({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) d.update({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) d.update({"abcF" : FailingMapping()}):NotImplementedError:('keys',) @@ -703,7 +871,7 @@ d.update(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert Failin d.update(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s})) -d.update(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +d.update(Mapping({"abcG" : None})):NOT FAILED d.update(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) d.update(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',) @@ -747,7 +915,7 @@ d.update((("a", {"abcF" : FailingIter()}),)):TypeError:('unable to convert Faili d.update((("a", {"abcF" : FailingIterNext()}),)):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),)) -d.update((("a", {"abcF" : None}),)):TypeError:('unable to convert NoneType to vim structure',) +d.update((("a", {"abcF" : None}),)):error:("failed to add key 'a' to dictionary",) d.update((("a", {"abcF" : {"": 1}}),)):ValueError:('empty keys are not allowed',) d.update((("a", {"abcF" : {u"": 1}}),)):ValueError:('empty keys are not allowed',) d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:('keys',) @@ -774,7 +942,7 @@ d.update((("a", Mapping({"abcG" : FailingIter()})),)):TypeError:('unable to conv d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),)) -d.update((("a", Mapping({"abcG" : None})),)):TypeError:('unable to convert NoneType to vim structure',) +d.update((("a", Mapping({"abcG" : None})),)):error:("failed to add key 'a' to dictionary",) d.update((("a", Mapping({"abcG" : {"": 1}})),)):ValueError:('empty keys are not allowed',) d.update((("a", Mapping({"abcG" : {u"": 1}})),)):ValueError:('empty keys are not allowed',) d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:('keys',) @@ -786,7 +954,7 @@ d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to v d.update((("a", FailingIterNext()),)):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", %s),)) -d.update((("a", None),)):TypeError:('unable to convert NoneType to vim structure',) +d.update((("a", None),)):error:("failed to add key 'a' to dictionary",) d.update((("a", {"": 1}),)):ValueError:('empty keys are not allowed',) d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',) d.update((("a", FailingMapping()),)):NotImplementedError:('keys',) @@ -825,7 +993,7 @@ vim.List([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter t vim.List([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}]) -vim.List([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',) +vim.List([{"abcF" : None}]):NOT FAILED vim.List([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',) vim.List([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',) vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',) @@ -852,7 +1020,7 @@ vim.List([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert Fail vim.List([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})]) -vim.List([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',) +vim.List([Mapping({"abcG" : None})]):NOT FAILED vim.List([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',) vim.List([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',) vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',) @@ -864,7 +1032,7 @@ vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to vim struc vim.List([FailingIterNext()]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using vim.List([%s]) -vim.List([None]):TypeError:('unable to convert NoneType to vim structure',) +vim.List([None]):NOT FAILED vim.List([{"": 1}]):ValueError:('empty keys are not allowed',) vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',) vim.List([FailingMapping()]):NotImplementedError:('keys',) @@ -910,7 +1078,7 @@ l[:] = [{"abcF" : FailingIter()}]:TypeError:('unable to convert FailingIter to v l[:] = [{"abcF" : FailingIterNext()}]:NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}] -l[:] = [{"abcF" : None}]:TypeError:('unable to convert NoneType to vim structure',) +l[:] = [{"abcF" : None}]:NOT FAILED l[:] = [{"abcF" : {"": 1}}]:ValueError:('empty keys are not allowed',) l[:] = [{"abcF" : {u"": 1}}]:ValueError:('empty keys are not allowed',) l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:('keys',) @@ -937,7 +1105,7 @@ l[:] = [Mapping({"abcG" : FailingIter()})]:TypeError:('unable to convert Failing l[:] = [Mapping({"abcG" : FailingIterNext()})]:NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})] -l[:] = [Mapping({"abcG" : None})]:TypeError:('unable to convert NoneType to vim structure',) +l[:] = [Mapping({"abcG" : None})]:NOT FAILED l[:] = [Mapping({"abcG" : {"": 1}})]:ValueError:('empty keys are not allowed',) l[:] = [Mapping({"abcG" : {u"": 1}})]:ValueError:('empty keys are not allowed',) l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:('keys',) @@ -949,7 +1117,7 @@ l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to vim structur l[:] = [FailingIterNext()]:NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [%s] -l[:] = [None]:TypeError:('unable to convert NoneType to vim structure',) +l[:] = [None]:NOT FAILED l[:] = [{"": 1}]:ValueError:('empty keys are not allowed',) l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',) l[:] = [FailingMapping()]:NotImplementedError:('keys',) @@ -981,7 +1149,7 @@ l.extend([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter t l.extend([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}]) -l.extend([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',) +l.extend([{"abcF" : None}]):NOT FAILED l.extend([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',) l.extend([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',) l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',) @@ -1008,7 +1176,7 @@ l.extend([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert Fail l.extend([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})]) -l.extend([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',) +l.extend([Mapping({"abcG" : None})]):NOT FAILED l.extend([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',) l.extend([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',) l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',) @@ -1020,7 +1188,7 @@ l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to vim struc l.extend([FailingIterNext()]):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using l.extend([%s]) -l.extend([None]):TypeError:('unable to convert NoneType to vim structure',) +l.extend([None]):NOT FAILED l.extend([{"": 1}]):ValueError:('empty keys are not allowed',) l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',) l.extend([FailingMapping()]):NotImplementedError:('keys',) @@ -1033,9 +1201,20 @@ l.locked = FailingTrue():NotImplementedError:('bool',) l.xxx = True:AttributeError:('cannot set attribute xxx',) > Function >> FunctionConstructor +>>> FunctionConstructor vim.Function("123"):ValueError:('unnamed function 123 does not exist',) vim.Function("xxx_non_existent_function_xxx"):ValueError:('function xxx_non_existent_function_xxx does not exist',) vim.Function("xxx#non#existent#function#xxx"):NOT FAILED +vim.Function("xxx_non_existent_function_xxx2", args=[]):ValueError:('function xxx_non_existent_function_xxx2 does not exist',) +vim.Function("xxx_non_existent_function_xxx3", self={}):ValueError:('function xxx_non_existent_function_xxx3 does not exist',) +vim.Function("xxx_non_existent_function_xxx4", args=[], self={}):ValueError:('function xxx_non_existent_function_xxx4 does not exist',) +>>> FunctionNew +vim.Function("tr", self="abcFuncSelf"):TypeError:('unable to convert str to vim dictionary',) +vim.Function("tr", args=427423):TypeError:('unable to convert int to vim list',) +vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to vim dictionary',) +vim.Function(self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to vim dictionary',) +vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to vim dictionary',) +vim.Function("tr", ""):TypeError:('function takes exactly 1 argument (2 given)',) >> FunctionCall >>> Testing StringToChars using f({%s : 1}) f({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) @@ -1057,7 +1236,7 @@ f({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim str f({"abcF" : FailingIterNext()}):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using f({"abcF" : %s}) -f({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +f({"abcF" : None}):NOT FAILED f({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) f({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) f({"abcF" : FailingMapping()}):NotImplementedError:('keys',) @@ -1084,7 +1263,7 @@ f(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter t f(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s})) -f(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +f(Mapping({"abcG" : None})):NOT FAILED f(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) f(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',) @@ -1096,7 +1275,7 @@ f(FailingIter()):TypeError:('unable to convert FailingIter to vim structure',) f(FailingIterNext()):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using f(%s) -f(None):TypeError:('unable to convert NoneType to vim structure',) +f(None):NOT FAILED f({"": 1}):ValueError:('empty keys are not allowed',) f({u"": 1}):ValueError:('empty keys are not allowed',) f(FailingMapping()):NotImplementedError:('keys',) @@ -1123,7 +1302,7 @@ fd(self={"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to v fd(self={"abcF" : FailingIterNext()}):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s}) -fd(self={"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +fd(self={"abcF" : None}):NOT FAILED fd(self={"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) fd(self={"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) fd(self={"abcF" : FailingMapping()}):NotImplementedError:('keys',) @@ -1150,7 +1329,7 @@ fd(self=Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert Failing fd(self=Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',) <<< Finished >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s})) -fd(self=Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +fd(self=Mapping({"abcG" : None})):NOT FAILED fd(self=Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) fd(self=Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',) diff --git a/src/testdir/test87.in b/src/testdir/test87.in index 9111a499bc..ac0410901d 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -7,6 +7,7 @@ STARTTEST :lang C :fun Test() :py3 import vim +:py3 cb = vim.current.buffer :let l = [] :py3 l=vim.bindeval('l') :py3 f=vim.bindeval('function("strlen")') @@ -200,7 +201,15 @@ EOF :let l = [0, 1, 2, 3] :py3 l=vim.bindeval('l') :lockvar! l -:py3 l[2]='i' +py3 << EOF +def emsg(ei): + return ei[0].__name__ + ':' + repr(ei[1].args) + +try: + l[2]='i' +except vim.error: + cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info())) +EOF :$put =string(l) :unlockvar! l :" @@ -221,15 +230,39 @@ def ee(expr, g=globals(), l=locals()): cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1])))) elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0: cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", ''))))) + elif sys.version_info >= (3, 6) and e.__class__ is ModuleNotFoundError: + # Python 3.6 gives ModuleNotFoundError, change it to an ImportError + cb.append(expr + ':' + repr((ImportError, ImportError(str(e).replace("'", ''))))) elif sys.version_info >= (3, 3) and e.__class__ is TypeError: m = py33_type_error_pattern.search(str(e)) if m: msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2)) cb.append(expr + ':' + repr((e.__class__, TypeError(msg)))) else: - cb.append(expr + ':' + repr((e.__class__, e))) + msg = repr((e.__class__, e)) + # Messages changed with Python 3.6, change new to old. + newmsg1 = """'argument must be str, bytes or bytearray, not None'""" + oldmsg1 = '''"Can't convert 'NoneType' object to str implicitly"''' + if msg.find(newmsg1) > -1: + msg = msg.replace(newmsg1, oldmsg1) + newmsg2 = """'argument must be str, bytes or bytearray, not int'""" + oldmsg2 = '''"Can't convert 'int' object to str implicitly"''' + if msg.find(newmsg2) > -1: + msg = msg.replace(newmsg2, oldmsg2) + cb.append(expr + ':' + msg) + elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': + cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null')))) else: - cb.append(expr + ':' + repr((e.__class__, e))) + msg = repr((e.__class__, e)) + # Some Python versions say can't, others cannot. + if msg.find('can\'t') > -1: + msg = msg.replace('can\'t', 'cannot') + # Some Python versions use single quote, some double quote + if msg.find('"cannot ') > -1: + msg = msg.replace('"cannot ', '\'cannot ') + if msg.find(' attributes"') > -1: + msg = msg.replace(' attributes"', ' attributes\'') + cb.append(expr + ':' + msg) else: cb.append(expr + ':NOT FAILED') except Exception as e: @@ -264,13 +297,17 @@ EOF :let messages=[] :delfunction DictNew py3 <<EOF +import sys d=vim.bindeval('{}') m=vim.bindeval('messages') def em(expr, g=globals(), l=locals()): try: exec(expr, g, l) except Exception as e: - m.extend([e.__class__.__name__]) + if sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': + m.extend([TypeError.__name__]) + else: + m.extend([e.__class__.__name__]) em('d["abc1"]') em('d["abc1"]="\\0"') @@ -326,6 +363,8 @@ EOF :$put =string(l) :let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}') :$put =sort(items(d)) +:let v:errmsg = '' +:$put ='py3eval(\"None\") = ' . py3eval('None') . v:errmsg :if has('float') : let f=py3eval('0.0') : $put =string(f) @@ -367,7 +406,9 @@ EOF :sleep 1 :py3 t.running = False :py3 t.join() -:py3 l[0] = t.t > 8 # check if the background thread is working +:" Check if the background thread is working. Count should be 10, but on a +:" busy system (AppVeyor) it can be much lower. +:py3 l[0] = t.t > 4 :py3 del time :py3 del threading :py3 del t @@ -604,7 +645,6 @@ EOF : autocmd BufFilePre * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")')) :augroup END py3 << EOF -cb = vim.current.buffer # Tests BufferAppend and BufferItem cb.append(b[0]) # Tests BufferSlice and BufferAssSlice @@ -849,6 +889,237 @@ EOF :$put =string(py3eval('vim.List()')) :$put =string(py3eval('vim.List(iter(''abc7''))')) :$put =string(py3eval('vim.Function(''tr'')')) +:$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4])')) +:$put =string(py3eval('vim.Function(''tr'', args=[])')) +:$put =string(py3eval('vim.Function(''tr'', self={})')) +:$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], self={})')) +:$put ='auto_rebind' +:$put =string(py3eval('vim.Function(''tr'', auto_rebind=False)')) +:$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)')) +:$put =string(py3eval('vim.Function(''tr'', args=[], auto_rebind=False)')) +:$put =string(py3eval('vim.Function(''tr'', self={}, auto_rebind=False)')) +:$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)')) +:" +:" Test vim.Function +:function Args(...) +: return a:000 +:endfunction +:function SelfArgs(...) dict +: return [a:000, self] +:endfunction +:" The following four lines should not crash +:let Pt = function('tr', [[]], {'l': []}) +:py3 Pt = vim.bindeval('Pt') +:unlet Pt +:py3 del Pt +py3 << EOF +def ecall(out_prefix, func, *args, **kwargs): + line = out_prefix + ': ' + try: + ret = func(*args, **kwargs) + except Exception: + line += '!exception: ' + emsg(sys.exc_info()) + else: + line += '!result: ' + str(vim.Function('string')(ret), 'utf-8') + cb.append(line) +a = vim.Function('Args') +pa1 = vim.Function('Args', args=['abcArgsPA1']) +pa2 = vim.Function('Args', args=[]) +pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}) +pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'}) +cb.append('a: ' + repr(a)) +cb.append('pa1: ' + repr(pa1)) +cb.append('pa2: ' + repr(pa2)) +cb.append('pa3: ' + repr(pa3)) +cb.append('pa4: ' + repr(pa4)) +sa = vim.Function('SelfArgs') +psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1']) +psa2 = vim.Function('SelfArgs', args=[]) +psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}) +psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}) +psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0) +psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto_rebind=()) +psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[]) +psa8 = vim.Function('SelfArgs', auto_rebind=False) +psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True) +psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=1) +psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'}) +psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC']) +cb.append('sa: ' + repr(sa)) +cb.append('psa1: ' + repr(psa1)) +cb.append('psa2: ' + repr(psa2)) +cb.append('psa3: ' + repr(psa3)) +cb.append('psa4: ' + repr(psa4)) +cb.append('psa5: ' + repr(psa5)) +cb.append('psa6: ' + repr(psa6)) +cb.append('psa7: ' + repr(psa7)) +cb.append('psa8: ' + repr(psa8)) +cb.append('psa9: ' + repr(psa9)) +cb.append('psaA: ' + repr(psaA)) +cb.append('psaB: ' + repr(psaB)) +cb.append('psaC: ' + repr(psaC)) + +psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'abcSelfPSArVal'}) +psar.args[0]['abcArgsPSAr2'] = [psar.self, psar.args[0]] +psar.self['rec'] = psar +psar.self['self'] = psar.self +psar.self['args'] = psar.args + +try: + cb.append('psar: ' + repr(psar)) +except Exception: + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) +EOF +:$put ='s(a): '.string(py3eval('a')) +:$put ='s(pa1): '.string(py3eval('pa1')) +:$put ='s(pa2): '.string(py3eval('pa2')) +:$put ='s(pa3): '.string(py3eval('pa3')) +:$put ='s(pa4): '.string(py3eval('pa4')) +:$put ='s(sa): '.string(py3eval('sa')) +:$put ='s(psa1): '.string(py3eval('psa1')) +:$put ='s(psa2): '.string(py3eval('psa2')) +:$put ='s(psa3): '.string(py3eval('psa3')) +:$put ='s(psa4): '.string(py3eval('psa4')) +:$put ='s(psa5): '.string(py3eval('psa5')) +:$put ='s(psa6): '.string(py3eval('psa6')) +:$put ='s(psa7): '.string(py3eval('psa7')) +:$put ='s(psa8): '.string(py3eval('psa8')) +:$put ='s(psa9): '.string(py3eval('psa9')) +:$put ='s(psaA): '.string(py3eval('psaA')) +:$put ='s(psaB): '.string(py3eval('psaB')) +:$put ='s(psaC): '.string(py3eval('psaC')) +: +:for v in ['sa', 'psa1', 'psa2', 'psa3', 'psa4', 'psa5', 'psa6', 'psa7', 'psa8', 'psa9', 'psaA', 'psaB', 'psaC'] +: let d = {'f': py3eval(v)} +: $put ='d.'.v.'(): '.string(d.f()) +:endfor +: +:py3 ecall('a()', a, ) +:py3 ecall('pa1()', pa1, ) +:py3 ecall('pa2()', pa2, ) +:py3 ecall('pa3()', pa3, ) +:py3 ecall('pa4()', pa4, ) +:py3 ecall('sa()', sa, ) +:py3 ecall('psa1()', psa1, ) +:py3 ecall('psa2()', psa2, ) +:py3 ecall('psa3()', psa3, ) +:py3 ecall('psa4()', psa4, ) +: +:py3 ecall('a(42, 43)', a, 42, 43) +:py3 ecall('pa1(42, 43)', pa1, 42, 43) +:py3 ecall('pa2(42, 43)', pa2, 42, 43) +:py3 ecall('pa3(42, 43)', pa3, 42, 43) +:py3 ecall('pa4(42, 43)', pa4, 42, 43) +:py3 ecall('sa(42, 43)', sa, 42, 43) +:py3 ecall('psa1(42, 43)', psa1, 42, 43) +:py3 ecall('psa2(42, 43)', psa2, 42, 43) +:py3 ecall('psa3(42, 43)', psa3, 42, 43) +:py3 ecall('psa4(42, 43)', psa4, 42, 43) +: +:py3 ecall('a(42, self={"20": 1})', a, 42, self={'20': 1}) +:py3 ecall('pa1(42, self={"20": 1})', pa1, 42, self={'20': 1}) +:py3 ecall('pa2(42, self={"20": 1})', pa2, 42, self={'20': 1}) +:py3 ecall('pa3(42, self={"20": 1})', pa3, 42, self={'20': 1}) +:py3 ecall('pa4(42, self={"20": 1})', pa4, 42, self={'20': 1}) +:py3 ecall('sa(42, self={"20": 1})', sa, 42, self={'20': 1}) +:py3 ecall('psa1(42, self={"20": 1})', psa1, 42, self={'20': 1}) +:py3 ecall('psa2(42, self={"20": 1})', psa2, 42, self={'20': 1}) +:py3 ecall('psa3(42, self={"20": 1})', psa3, 42, self={'20': 1}) +:py3 ecall('psa4(42, self={"20": 1})', psa4, 42, self={'20': 1}) +: +:py3 ecall('a(self={"20": 1})', a, self={'20': 1}) +:py3 ecall('pa1(self={"20": 1})', pa1, self={'20': 1}) +:py3 ecall('pa2(self={"20": 1})', pa2, self={'20': 1}) +:py3 ecall('pa3(self={"20": 1})', pa3, self={'20': 1}) +:py3 ecall('pa4(self={"20": 1})', pa4, self={'20': 1}) +:py3 ecall('sa(self={"20": 1})', sa, self={'20': 1}) +:py3 ecall('psa1(self={"20": 1})', psa1, self={'20': 1}) +:py3 ecall('psa2(self={"20": 1})', psa2, self={'20': 1}) +:py3 ecall('psa3(self={"20": 1})', psa3, self={'20': 1}) +:py3 ecall('psa4(self={"20": 1})', psa4, self={'20': 1}) +py3 << EOF +def s(v): + if v is None: + return repr(v) + else: + return str(vim.Function('string')(v), 'utf-8') + +cb.append('a.args: ' + s(a.args)) +cb.append('pa1.args: ' + s(pa1.args)) +cb.append('pa2.args: ' + s(pa2.args)) +cb.append('pa3.args: ' + s(pa3.args)) +cb.append('pa4.args: ' + s(pa4.args)) +cb.append('sa.args: ' + s(sa.args)) +cb.append('psa1.args: ' + s(psa1.args)) +cb.append('psa2.args: ' + s(psa2.args)) +cb.append('psa3.args: ' + s(psa3.args)) +cb.append('psa4.args: ' + s(psa4.args)) + +cb.append('a.self: ' + s(a.self)) +cb.append('pa1.self: ' + s(pa1.self)) +cb.append('pa2.self: ' + s(pa2.self)) +cb.append('pa3.self: ' + s(pa3.self)) +cb.append('pa4.self: ' + s(pa4.self)) +cb.append('sa.self: ' + s(sa.self)) +cb.append('psa1.self: ' + s(psa1.self)) +cb.append('psa2.self: ' + s(psa2.self)) +cb.append('psa3.self: ' + s(psa3.self)) +cb.append('psa4.self: ' + s(psa4.self)) + +cb.append('a.name: ' + s(a.name)) +cb.append('pa1.name: ' + s(pa1.name)) +cb.append('pa2.name: ' + s(pa2.name)) +cb.append('pa3.name: ' + s(pa3.name)) +cb.append('pa4.name: ' + s(pa4.name)) +cb.append('sa.name: ' + s(sa.name)) +cb.append('psa1.name: ' + s(psa1.name)) +cb.append('psa2.name: ' + s(psa2.name)) +cb.append('psa3.name: ' + s(psa3.name)) +cb.append('psa4.name: ' + s(psa4.name)) + +cb.append('a.auto_rebind: ' + s(a.auto_rebind)) +cb.append('pa1.auto_rebind: ' + s(pa1.auto_rebind)) +cb.append('pa2.auto_rebind: ' + s(pa2.auto_rebind)) +cb.append('pa3.auto_rebind: ' + s(pa3.auto_rebind)) +cb.append('pa4.auto_rebind: ' + s(pa4.auto_rebind)) +cb.append('sa.auto_rebind: ' + s(sa.auto_rebind)) +cb.append('psa1.auto_rebind: ' + s(psa1.auto_rebind)) +cb.append('psa2.auto_rebind: ' + s(psa2.auto_rebind)) +cb.append('psa3.auto_rebind: ' + s(psa3.auto_rebind)) +cb.append('psa4.auto_rebind: ' + s(psa4.auto_rebind)) +cb.append('psa5.auto_rebind: ' + s(psa5.auto_rebind)) +cb.append('psa6.auto_rebind: ' + s(psa6.auto_rebind)) +cb.append('psa7.auto_rebind: ' + s(psa7.auto_rebind)) +cb.append('psa8.auto_rebind: ' + s(psa8.auto_rebind)) +cb.append('psa9.auto_rebind: ' + s(psa9.auto_rebind)) +cb.append('psaA.auto_rebind: ' + s(psaA.auto_rebind)) +cb.append('psaB.auto_rebind: ' + s(psaB.auto_rebind)) +cb.append('psaC.auto_rebind: ' + s(psaC.auto_rebind)) + +del s + +del a +del pa1 +del pa2 +del pa3 +del pa4 +del sa +del psa1 +del psa2 +del psa3 +del psa4 +del psa5 +del psa6 +del psa7 +del psa8 +del psa9 +del psaA +del psaB +del psaC +del psar + +del ecall +EOF :" :" Test stdout/stderr :redir => messages @@ -910,8 +1181,19 @@ fnamemodify = vim.Function('fnamemodify') cb.append(str(fnamemodify('.', ':p:h:t'))) cb.append(vim.eval('@%')) os.chdir('..') -cb.append(str(fnamemodify('.', ':p:h:t'))) -cb.append(vim.eval('@%').replace(os.path.sep, '/')) +path = fnamemodify('.', ':p:h:t') +if path != b'src': + # Running tests from a shadow directory, so move up another level + # This will result in @% looking like shadow/testdir/test87.in, hence the + # slicing to remove the leading path and path separator + os.chdir('..') + cb.append(str(fnamemodify('.', ':p:h:t'))) + cb.append(vim.eval('@%')[len(path)+1:].replace(os.path.sep, '/')) + os.chdir(path) +else: + cb.append(str(fnamemodify('.', ':p:h:t'))) + cb.append(vim.eval('@%').replace(os.path.sep, '/')) +del path os.chdir('testdir') cb.append(str(fnamemodify('.', ':p:h:t'))) cb.append(vim.eval('@%')) @@ -1071,8 +1353,25 @@ cb.append(">> OutputSetattr") ee('del sys.stdout.softspace') number_test('sys.stdout.softspace = %s', unsigned=True) number_test('sys.stderr.softspace = %s', unsigned=True) +ee('assert sys.stdout.isatty()==False') +ee('assert sys.stdout.seekable()==False') +ee('sys.stdout.close()') +ee('sys.stdout.flush()') +ee('assert sys.stderr.isatty()==False') +ee('assert sys.stderr.seekable()==False') +ee('sys.stderr.close()') +ee('sys.stderr.flush()') ee('sys.stdout.attr = None') cb.append(">> OutputWrite") +ee('assert sys.stdout.writable()==True') +ee('assert sys.stdout.readable()==False') +ee('assert sys.stderr.writable()==True') +ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') @@ -1101,7 +1400,7 @@ ee('vim.foreach_rtp(FailingCall())') ee('vim.foreach_rtp(int, 2)') cb.append('> import') old_rtp = vim.options['rtp'] -vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\') +vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,') ee('import xxx_no_such_module_xxx') ee('import failing_import') ee('import failing') @@ -1185,9 +1484,20 @@ ee('l.locked = FailingTrue()') ee('l.xxx = True') cb.append("> Function") cb.append(">> FunctionConstructor") +cb.append(">>> FunctionConstructor") ee('vim.Function("123")') ee('vim.Function("xxx_non_existent_function_xxx")') ee('vim.Function("xxx#non#existent#function#xxx")') +ee('vim.Function("xxx_non_existent_function_xxx2", args=[])') +ee('vim.Function("xxx_non_existent_function_xxx3", self={})') +ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})') +cb.append(">>> FunctionNew") +ee('vim.Function("tr", self="abcFuncSelf")') +ee('vim.Function("tr", args=427423)') +ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")') +ee('vim.Function("tr", "")') cb.append(">> FunctionCall") convertfrompyobject_test('f(%s)') convertfrompymapping_test('fd(self=%s)') @@ -1341,16 +1651,16 @@ def test_keyboard_interrupt(): vim.command('while 1 | endwhile') except KeyboardInterrupt: cb.append('Caught KeyboardInterrupt') - except Exception as e: - cb.append('!!!!!!!! Caught exception: ' + repr(e)) + except Exception: + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) else: cb.append('!!!!!!!! No exception') try: vim.command('$ put =\'Running :put\'') except KeyboardInterrupt: cb.append('!!!!!!!! Caught KeyboardInterrupt') - except Exception as e: - cb.append('!!!!!!!! Caught exception: ' + repr(e)) + except Exception: + cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) else: cb.append('No exception') EOF @@ -1361,6 +1671,7 @@ EOF :debug silent! py3 test_keyboard_interrupt() :redir END :0 debuggreedy +:call inputrestore() :silent $put =output :unlet output :py3 del test_keyboard_interrupt @@ -1369,6 +1680,7 @@ EOF py3 << EOF del cb del ee +del emsg del sys del os del vim @@ -1400,8 +1712,9 @@ EOF :call garbagecollect(1) :" :/^start:/,$wq! test.out +:/^start:/,$w! test.out :" vim: et ts=4 isk-=\: -:call getchar() +:while getchar(0) isnot 0|endwhile ENDTEST start: diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index e616544b5b..9ca4b624cf 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -57,6 +57,7 @@ None [0, 1, 2, 3, 4, 5, 6, 7] [0, 1, 2, 3, 4, 5, 6, 7] [0, 1, 2, 3, 4, 5, 6, 7] +l[2] threw vim.error: error:('list is locked',) [0, 1, 2, 3] [function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd'] [function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}] @@ -86,6 +87,7 @@ ll:[1] ['a', 'b'] ['c', 1] ['d', ['e']] +py3eval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: @@ -441,25 +443,174 @@ vim.current.window:Window:True vim.current.tabpage:TabPage:True current:__dir__,buffer,line,range,tabpage,window buffer:__dir__,append,mark,name,number,options,range,valid,vars -window:__dir__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars +window:__dir__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars,width tabpage:__dir__,number,valid,vars,window,windows range:__dir__,append,end,start dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,extend,locked -function:__dir__,softspace -output:__dir__,flush,softspace,write,writelines +function:__dir__,args,auto_rebind,self,softspace +output:__dir__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} [] ['a', 'b', 'c', '7'] function('tr') +function('tr', [123, 3, 4]) +function('tr') +function('tr', {}) +function('tr', [123, 3, 4], {}) +auto_rebind +function('tr') +function('tr', [123, 3, 4]) +function('tr') +function('tr', {}) +function('tr', [123, 3, 4], {}) +a: <vim.Function 'Args'> +pa1: <vim.Function 'Args', args=['abcArgsPA1']> +pa2: <vim.Function 'Args'> +pa3: <vim.Function 'Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}> +pa4: <vim.Function 'Args', self={'abcSelfPA4': 'abcSelfPA4Val'}> +sa: <vim.Function 'SelfArgs'> +psa1: <vim.Function 'SelfArgs', args=['abcArgsPSA1']> +psa2: <vim.Function 'SelfArgs'> +psa3: <vim.Function 'SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}> +psa4: <vim.Function 'SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}> +psa5: <vim.Function 'SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}> +psa6: <vim.Function 'SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}> +psa7: <vim.Function 'SelfArgs', args=['abcArgsPSA7']> +psa8: <vim.Function 'SelfArgs'> +psa9: <vim.Function 'SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True> +psaA: <vim.Function 'SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=True> +psaB: <vim.Function 'SelfArgs', args=['abcArgsPSAB']> +psaC: <vim.Function 'SelfArgs'> +psar: <vim.Function 'SelfArgs', args=[{'abcArgsPSAr2': [{'rec': function('SelfArgs', [{...}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{...}]}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], self={'rec': function('SelfArgs', [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}]}> +s(a): function('Args') +s(pa1): function('Args', ['abcArgsPA1']) +s(pa2): function('Args') +s(pa3): function('Args', ['abcArgsPA3'], {'abcSelfPA3': 'abcSelfPA3Val'}) +s(pa4): function('Args', {'abcSelfPA4': 'abcSelfPA4Val'}) +s(sa): function('SelfArgs') +s(psa1): function('SelfArgs', ['abcArgsPSA1']) +s(psa2): function('SelfArgs') +s(psa3): function('SelfArgs', ['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}) +s(psa4): function('SelfArgs', {'abcSelfPSA4': 'abcSelfPSA4Val'}) +s(psa5): function('SelfArgs', {'abcSelfPSA5': 'abcSelfPSA5Val'}) +s(psa6): function('SelfArgs', ['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}) +s(psa7): function('SelfArgs', ['abcArgsPSA7']) +s(psa8): function('SelfArgs') +s(psa9): function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'}) +s(psaA): function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'}) +s(psaB): function('SelfArgs', ['abcArgsPSAB']) +s(psaC): function('SelfArgs') +d.sa(): [[], {'f': function('SelfArgs')}] +d.psa1(): [['abcArgsPSA1'], {'f': function('SelfArgs', ['abcArgsPSA1'])}] +d.psa2(): [[], {'f': function('SelfArgs')}] +d.psa3(): [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +d.psa4(): [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +d.psa5(): [[], {'abcSelfPSA5': 'abcSelfPSA5Val'}] +d.psa6(): [['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}] +d.psa7(): [['abcArgsPSA7'], {'f': function('SelfArgs', ['abcArgsPSA7'])}] +d.psa8(): [[], {'f': function('SelfArgs')}] +d.psa9(): [[], {'f': function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'})}] +d.psaA(): [['abcArgsPSAA'], {'f': function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'})}] +d.psaB(): [['abcArgsPSAB'], {'f': function('SelfArgs', ['abcArgsPSAB'])}] +d.psaC(): [[], {'f': function('SelfArgs')}] +a(): !result: [] +pa1(): !result: ['abcArgsPA1'] +pa2(): !result: [] +pa3(): !result: ['abcArgsPA3'] +pa4(): !result: [] +sa(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa1(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa2(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa3(): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +psa4(): !result: [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +a(42, 43): !result: [42, 43] +pa1(42, 43): !result: ['abcArgsPA1', 42, 43] +pa2(42, 43): !result: [42, 43] +pa3(42, 43): !result: ['abcArgsPA3', 42, 43] +pa4(42, 43): !result: [42, 43] +sa(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa1(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa2(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) +psa3(42, 43): !result: [['abcArgsPSA3', 42, 43], {'abcSelfPSA3': 'abcSelfPSA3Val'}] +psa4(42, 43): !result: [[42, 43], {'abcSelfPSA4': 'abcSelfPSA4Val'}] +a(42, self={"20": 1}): !result: [42] +pa1(42, self={"20": 1}): !result: ['abcArgsPA1', 42] +pa2(42, self={"20": 1}): !result: [42] +pa3(42, self={"20": 1}): !result: ['abcArgsPA3', 42] +pa4(42, self={"20": 1}): !result: [42] +sa(42, self={"20": 1}): !result: [[42], {'20': 1}] +psa1(42, self={"20": 1}): !result: [['abcArgsPSA1', 42], {'20': 1}] +psa2(42, self={"20": 1}): !result: [[42], {'20': 1}] +psa3(42, self={"20": 1}): !result: [['abcArgsPSA3', 42], {'20': 1}] +psa4(42, self={"20": 1}): !result: [[42], {'20': 1}] +a(self={"20": 1}): !result: [] +pa1(self={"20": 1}): !result: ['abcArgsPA1'] +pa2(self={"20": 1}): !result: [] +pa3(self={"20": 1}): !result: ['abcArgsPA3'] +pa4(self={"20": 1}): !result: [] +sa(self={"20": 1}): !result: [[], {'20': 1}] +psa1(self={"20": 1}): !result: [['abcArgsPSA1'], {'20': 1}] +psa2(self={"20": 1}): !result: [[], {'20': 1}] +psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}] +psa4(self={"20": 1}): !result: [[], {'20': 1}] +a.args: None +pa1.args: ['abcArgsPA1'] +pa2.args: None +pa3.args: ['abcArgsPA3'] +pa4.args: None +sa.args: None +psa1.args: ['abcArgsPSA1'] +psa2.args: None +psa3.args: ['abcArgsPSA3'] +psa4.args: None +a.self: None +pa1.self: None +pa2.self: None +pa3.self: {'abcSelfPA3': 'abcSelfPA3Val'} +pa4.self: {'abcSelfPA4': 'abcSelfPA4Val'} +sa.self: None +psa1.self: None +psa2.self: None +psa3.self: {'abcSelfPSA3': 'abcSelfPSA3Val'} +psa4.self: {'abcSelfPSA4': 'abcSelfPSA4Val'} +a.name: 'Args' +pa1.name: 'Args' +pa2.name: 'Args' +pa3.name: 'Args' +pa4.name: 'Args' +sa.name: 'SelfArgs' +psa1.name: 'SelfArgs' +psa2.name: 'SelfArgs' +psa3.name: 'SelfArgs' +psa4.name: 'SelfArgs' +a.auto_rebind: 1 +pa1.auto_rebind: 1 +pa2.auto_rebind: 1 +pa3.auto_rebind: 0 +pa4.auto_rebind: 0 +sa.auto_rebind: 1 +psa1.auto_rebind: 1 +psa2.auto_rebind: 1 +psa3.auto_rebind: 0 +psa4.auto_rebind: 0 +psa5.auto_rebind: 0 +psa6.auto_rebind: 0 +psa7.auto_rebind: 1 +psa8.auto_rebind: 1 +psa9.auto_rebind: 1 +psaA.auto_rebind: 1 +psaB.auto_rebind: 1 +psaC.auto_rebind: 1 ' abcdef -line : +Error detected while processing function RunTest[]..Test: +line : abcdef abcA -line : +line : abcB' ['a', 'dup_a'] ['a', 'a'] @@ -477,7 +628,7 @@ b'testdir' test87.in > Output >> OutputSetattr -del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",)) +del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError('cannot delete OutputObject attributes',)) >>> Testing NumberToLong using sys.stdout.softspace = %s sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) @@ -488,8 +639,25 @@ sys.stderr.softspace = []:(<class 'TypeError'>, TypeError('expected int() or som sys.stderr.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) sys.stderr.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) <<< Finished +assert sys.stdout.isatty()==False:NOT FAILED +assert sys.stdout.seekable()==False:NOT FAILED +sys.stdout.close():NOT FAILED +sys.stdout.flush():NOT FAILED +assert sys.stderr.isatty()==False:NOT FAILED +assert sys.stderr.seekable()==False:NOT FAILED +sys.stderr.close():NOT FAILED +sys.stderr.flush():NOT FAILED sys.stdout.attr = None:(<class 'AttributeError'>, AttributeError('invalid attribute: attr',)) >> OutputWrite +assert sys.stdout.writable()==True:NOT FAILED +assert sys.stdout.readable()==False:NOT FAILED +assert sys.stderr.writable()==True:NOT FAILED +assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",)) >> OutputWriteLines sys.stdout.writelines(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",)) @@ -600,7 +768,7 @@ d["a"] = {"abcF" : FailingIter()}:(<class 'TypeError'>, TypeError('unable to con d["a"] = {"abcF" : FailingIterNext()}:(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s} -d["a"] = {"abcF" : None}:(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d["a"] = {"abcF" : None}:NOT FAILED d["a"] = {"abcF" : {b"": 1}}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = {"abcF" : {"": 1}}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = {"abcF" : FailingMapping()}:(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -627,7 +795,7 @@ d["a"] = Mapping({"abcG" : FailingIter()}):(<class 'TypeError'>, TypeError('unab d["a"] = Mapping({"abcG" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s}) -d["a"] = Mapping({"abcG" : None}):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d["a"] = Mapping({"abcG" : None}):NOT FAILED d["a"] = Mapping({"abcG" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = Mapping({"abcG" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = Mapping({"abcG" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -639,7 +807,7 @@ d["a"] = FailingIter():(<class 'TypeError'>, TypeError('unable to convert Failin d["a"] = FailingIterNext():(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = %s -d["a"] = None:(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d["a"] = None:NOT FAILED d["a"] = {b"": 1}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = {"": 1}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d["a"] = FailingMapping():(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -676,7 +844,7 @@ d.update({"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to co d.update({"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d.update({"abcF" : %s}) -d.update({"abcF" : None}):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d.update({"abcF" : None}):NOT FAILED d.update({"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -703,7 +871,7 @@ d.update(Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('una d.update(Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s})) -d.update(Mapping({"abcG" : None})):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d.update(Mapping({"abcG" : None})):NOT FAILED d.update(Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -747,7 +915,7 @@ d.update((("a", {"abcF" : FailingIter()}),)):(<class 'TypeError'>, TypeError('un d.update((("a", {"abcF" : FailingIterNext()}),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),)) -d.update((("a", {"abcF" : None}),)):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d.update((("a", {"abcF" : None}),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) d.update((("a", {"abcF" : {b"": 1}}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", {"abcF" : {"": 1}}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", {"abcF" : FailingMapping()}),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -774,7 +942,7 @@ d.update((("a", Mapping({"abcG" : FailingIter()})),)):(<class 'TypeError'>, Type d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),)) -d.update((("a", Mapping({"abcG" : None})),)):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d.update((("a", Mapping({"abcG" : None})),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) d.update((("a", Mapping({"abcG" : {b"": 1}})),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", Mapping({"abcG" : {"": 1}})),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -786,7 +954,7 @@ d.update((("a", FailingIter()),)):(<class 'TypeError'>, TypeError('unable to con d.update((("a", FailingIterNext()),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", %s),)) -d.update((("a", None),)):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +d.update((("a", None),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) d.update((("a", {b"": 1}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", {"": 1}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) d.update((("a", FailingMapping()),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -825,7 +993,7 @@ vim.List([{"abcF" : FailingIter()}]):(<class 'TypeError'>, TypeError('unable to vim.List([{"abcF" : FailingIterNext()}]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}]) -vim.List([{"abcF" : None}]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +vim.List([{"abcF" : None}]):NOT FAILED vim.List([{"abcF" : {b"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -852,7 +1020,7 @@ vim.List([Mapping({"abcG" : FailingIter()})]):(<class 'TypeError'>, TypeError('u vim.List([Mapping({"abcG" : FailingIterNext()})]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})]) -vim.List([Mapping({"abcG" : None})]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +vim.List([Mapping({"abcG" : None})]):NOT FAILED vim.List([Mapping({"abcG" : {b"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -864,7 +1032,7 @@ vim.List([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert Fai vim.List([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using vim.List([%s]) -vim.List([None]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +vim.List([None]):NOT FAILED vim.List([{b"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) vim.List([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -910,7 +1078,7 @@ l[:] = [{"abcF" : FailingIter()}]:(<class 'TypeError'>, TypeError('unable to con l[:] = [{"abcF" : FailingIterNext()}]:(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}] -l[:] = [{"abcF" : None}]:(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l[:] = [{"abcF" : None}]:NOT FAILED l[:] = [{"abcF" : {b"": 1}}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [{"abcF" : {"": 1}}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [{"abcF" : FailingMapping()}]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -937,7 +1105,7 @@ l[:] = [Mapping({"abcG" : FailingIter()})]:(<class 'TypeError'>, TypeError('unab l[:] = [Mapping({"abcG" : FailingIterNext()})]:(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})] -l[:] = [Mapping({"abcG" : None})]:(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l[:] = [Mapping({"abcG" : None})]:NOT FAILED l[:] = [Mapping({"abcG" : {b"": 1}})]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [Mapping({"abcG" : {"": 1}})]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [Mapping({"abcG" : FailingMapping()})]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -949,7 +1117,7 @@ l[:] = [FailingIter()]:(<class 'TypeError'>, TypeError('unable to convert Failin l[:] = [FailingIterNext()]:(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [%s] -l[:] = [None]:(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l[:] = [None]:NOT FAILED l[:] = [{b"": 1}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [{"": 1}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l[:] = [FailingMapping()]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -981,7 +1149,7 @@ l.extend([{"abcF" : FailingIter()}]):(<class 'TypeError'>, TypeError('unable to l.extend([{"abcF" : FailingIterNext()}]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}]) -l.extend([{"abcF" : None}]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l.extend([{"abcF" : None}]):NOT FAILED l.extend([{"abcF" : {b"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1008,7 +1176,7 @@ l.extend([Mapping({"abcG" : FailingIter()})]):(<class 'TypeError'>, TypeError('u l.extend([Mapping({"abcG" : FailingIterNext()})]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})]) -l.extend([Mapping({"abcG" : None})]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l.extend([Mapping({"abcG" : None})]):NOT FAILED l.extend([Mapping({"abcG" : {b"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1020,7 +1188,7 @@ l.extend([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert Fai l.extend([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using l.extend([%s]) -l.extend([None]):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +l.extend([None]):NOT FAILED l.extend([{b"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) l.extend([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1033,9 +1201,20 @@ l.locked = FailingTrue():(<class 'NotImplementedError'>, NotImplementedError('bo l.xxx = True:(<class 'AttributeError'>, AttributeError('cannot set attribute xxx',)) > Function >> FunctionConstructor +>>> FunctionConstructor vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function 123 does not exist',)) vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx does not exist',)) vim.Function("xxx#non#existent#function#xxx"):NOT FAILED +vim.Function("xxx_non_existent_function_xxx2", args=[]):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx2 does not exist',)) +vim.Function("xxx_non_existent_function_xxx3", self={}):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx3 does not exist',)) +vim.Function("xxx_non_existent_function_xxx4", args=[], self={}):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx4 does not exist',)) +>>> FunctionNew +vim.Function("tr", self="abcFuncSelf"):(<class 'AttributeError'>, AttributeError('keys',)) +vim.Function("tr", args=427423):(<class 'TypeError'>, TypeError('unable to convert int to vim list',)) +vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) +vim.Function(self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) +vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) +vim.Function("tr", ""):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',)) >> FunctionCall >>> Testing StringToChars using f({%s : 1}) f({1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) @@ -1057,7 +1236,7 @@ f({"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to convert F f({"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using f({"abcF" : %s}) -f({"abcF" : None}):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +f({"abcF" : None}):NOT FAILED f({"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1084,7 +1263,7 @@ f(Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('unable to f(Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s})) -f(Mapping({"abcG" : None})):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +f(Mapping({"abcG" : None})):NOT FAILED f(Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1096,7 +1275,7 @@ f(FailingIter()):(<class 'TypeError'>, TypeError('unable to convert FailingIter f(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using f(%s) -f(None):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +f(None):NOT FAILED f({b"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f({"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) f(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1123,7 +1302,7 @@ fd(self={"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to con fd(self={"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s}) -fd(self={"abcF" : None}):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +fd(self={"abcF" : None}):NOT FAILED fd(self={"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) fd(self={"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) fd(self={"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) @@ -1150,7 +1329,7 @@ fd(self=Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('unab fd(self=Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) <<< Finished >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s})) -fd(self=Mapping({"abcG" : None})):(<class 'TypeError'>, TypeError('unable to convert NoneType to vim structure',)) +fd(self=Mapping({"abcG" : None})):NOT FAILED fd(self=Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) fd(self=Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) fd(self=Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) diff --git a/src/testdir/test88.in b/src/testdir/test88.in index c2e6a752fa..9e43f703e9 100644 --- a/src/testdir/test88.in +++ b/src/testdir/test88.in @@ -71,6 +71,17 @@ GGk :set lbr :normal $ GGk +:set list listchars=tab:>- +:normal 0 +GGk +:normal W +GGk +:normal W +GGk +:normal W +GGk +:normal $ +GGk :" Display result. :call append('$', 'end:') :call append('$', positions) diff --git a/src/testdir/test88.ok b/src/testdir/test88.ok index e29698b7bd..12949f274a 100644 --- a/src/testdir/test88.ok +++ b/src/testdir/test88.ok @@ -22,3 +22,8 @@ end: 9:25 9:26 9:26 +9:1 +9:9 +9:17 +9:25 +9:26 diff --git a/src/testdir/test89.in b/src/testdir/test89.in deleted file mode 100644 index 1c3079f62f..0000000000 --- a/src/testdir/test89.in +++ /dev/null @@ -1,71 +0,0 @@ -- Some tests for setting 'number' and 'relativenumber' - This is not all that useful now that the options are no longer reset when - setting the other. -- Some tests for findfile() function - -STARTTEST -:so small.vim -:set hidden nocp nu rnu viminfo+=nviminfo -:redir @a | set nu? rnu? | redir END -:e! xx -:redir @b | set nu? rnu? | redir END -:e! # -:$put ='results:' -:$put a -:$put b -:" -:set nonu nornu -:setglobal nu -:setlocal rnu -:redir @c | setglobal nu? | redir END -:set nonu nornu -:setglobal rnu -:setlocal nu -:redir @d | setglobal rnu? | redir END -:$put =':setlocal must NOT reset the other global value' -:$put c -:$put d -:" -:set nonu nornu -:setglobal nu -:setglobal rnu -:redir @e | setglobal nu? | redir END -:set nonu nornu -:setglobal rnu -:setglobal nu -:redir @f | setglobal rnu? | redir END -:$put =':setglobal MUST reset the other global value' -:$put e -:$put f -:" -:set nonu nornu -:set nu -:set rnu -:redir @g | setglobal nu? | redir END -:set nonu nornu -:set rnu -:set nu -:redir @h | setglobal rnu? | redir END -:$put =':set MUST reset the other global value' -:$put g -:$put h -:" -:let cwd=getcwd() -:cd .. -:" Tests may be run from a shadow directory, so an extra cd needs to be done to -:" get above src/ -:if fnamemodify(getcwd(), ':t') != 'src' | cd ../.. | else | cd .. | endif -:$put ='' -:$put ='Testing findfile' -:$put ='' -:set ssl -:$put =findfile('test19.in','src/test*') -:exe "cd" cwd -:cd .. -:$put =findfile('test19.in','test*') -:$put =findfile('test19.in','testdir') -:exe "cd" cwd -:/^results/,$w! test.out -:q! -ENDTEST - diff --git a/src/testdir/test89.ok b/src/testdir/test89.ok deleted file mode 100644 index 90034758d9..0000000000 --- a/src/testdir/test89.ok +++ /dev/null @@ -1,28 +0,0 @@ -results: - - number - relativenumber - - number - relativenumber -:setlocal must NOT reset the other global value - - number - - relativenumber -:setglobal MUST reset the other global value - - number - - relativenumber -:set MUST reset the other global value - - number - - relativenumber - -Testing findfile - -src/testdir/test19.in -testdir/test19.in -testdir/test19.in diff --git a/src/testdir/test9.in b/src/testdir/test9.in deleted file mode 100644 index 84e17943c7..0000000000 --- a/src/testdir/test9.in +++ /dev/null @@ -1,12 +0,0 @@ -Test for Bufleave autocommand that deletes the buffer we are about to edit. - -STARTTEST -:so small.vim -:au BufLeave test9.in bwipe yy -:e yy -:/^start of/,$w! test.out " Write contents of this file -:qa! -ENDTEST - -start of test file xx -end of test file xx diff --git a/src/testdir/test9.ok b/src/testdir/test9.ok deleted file mode 100644 index cccb5f3ef2..0000000000 --- a/src/testdir/test9.ok +++ /dev/null @@ -1,2 +0,0 @@ -start of test file xx -end of test file xx diff --git a/src/testdir/test90.in b/src/testdir/test90.in deleted file mode 100644 index 6bac414f31..0000000000 --- a/src/testdir/test90.in +++ /dev/null @@ -1,53 +0,0 @@ -Tests for sha256() function. vim: set ft=vim et ts=2 sw=2 : - -STARTTEST -:so small.vim -:if !has('cryptv') || !exists('*sha256') - e! test.ok - wq! test.out -:endif -:" -:let testcase='test for empty string: ' -:if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 1 char: ' -:if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 3 chars: ' -:if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains meta char: ' -:if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains non-ascii char: ' -:if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -" -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/testdir/test90.ok b/src/testdir/test90.ok deleted file mode 100644 index 9a8e7fe961..0000000000 --- a/src/testdir/test90.ok +++ /dev/null @@ -1,6 +0,0 @@ -start: -test for empty string: ok -test for 1 char: ok -test for 3 chars: ok -test for contains meta char: ok -test for contains non-ascii char: ok diff --git a/src/testdir/test91.in b/src/testdir/test91.in deleted file mode 100644 index e900a522df..0000000000 --- a/src/testdir/test91.in +++ /dev/null @@ -1,111 +0,0 @@ -Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). -vim: set ft=vim : - -STARTTEST -:so small.vim -:so mbyte.vim -:" -:" Test for getbufvar() -:" Use strings to test for memory leaks. -:let b:var_num = '1234' -:let def_num = '5678' -:$put =string(getbufvar(1, 'var_num')) -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:unlet b:var_num -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:$put =string(getbufvar(9, '')) -:$put =string(getbufvar(9, '', def_num)) -:unlet def_num -:$put =string(getbufvar(1, '&autoindent')) -:$put =string(getbufvar(1, '&autoindent', 1)) -:" -:" Open new window with forced option values -:set fileformats=unix,dos -:new ++ff=dos ++bin ++enc=iso-8859-2 -:let otherff = getbufvar(bufnr('%'), '&fileformat') -:let otherbin = getbufvar(bufnr('%'), '&bin') -:let otherfenc = getbufvar(bufnr('%'), '&fenc') -:close -:$put =otherff -:$put =string(otherbin) -:$put =otherfenc -:unlet otherff otherbin otherfenc -:" test for getwinvar() -:let w:var_str = "Dance" -:let def_str = "Chance" -:$put =string(getwinvar(1, 'var_str')) -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:unlet w:var_str -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:$put =string(getwinvar(9, '')) -:$put =string(getwinvar(9, '', def_str)) -:$put =string(getwinvar(1, '&nu')) -:$put =string(getwinvar(1, '&nu', 1)) -:unlet def_str -:" -:" test for gettabvar() -:tabnew -:tabnew -:let t:var_list = [1, 2, 3] -:let def_list = [4, 5, 6, 7] -:tabrewind -:$put =string(gettabvar(3, 'var_list')) -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(3, '')) -:$put =string(gettabvar(3, '', def_list)) -:tablast -:unlet t:var_list -:tabrewind -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(9, '')) -:$put =string(gettabvar(9, '', def_list)) -:$put =string(gettabvar(3, '&nu')) -:$put =string(gettabvar(3, '&nu', def_list)) -:unlet def_list -:tabonly -:" -:" test for gettabwinvar() -:tabnew -:tabnew -:tabprev -:split -:split -:wincmd w -:vert split -:wincmd w -:let w:var_dict = {'dict': 'tabwin'} -:let def_dict = {'dict2': 'newval'} -:wincmd b -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict')) -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:tabnext -:3wincmd w -:unlet w:var_dict -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:$put =string(gettabwinvar(2, 9, '')) -:$put =string(gettabwinvar(2, 9, '', def_dict)) -:$put =string(gettabwinvar(9, 3, '')) -:$put =string(gettabwinvar(9, 3, '', def_dict)) -:unlet def_dict -:$put =string(gettabwinvar(2, 3, '&nux')) -:$put =string(gettabwinvar(2, 3, '&nux', 1)) -:tabonly -:" -:/^start/,$wq! test.out -ENDTEST - -start: diff --git a/src/testdir/test91.ok b/src/testdir/test91.ok deleted file mode 100644 index 22e1572209..0000000000 --- a/src/testdir/test91.ok +++ /dev/null @@ -1,48 +0,0 @@ -start: -'1234' -'1234' -{'var_num': '1234'} -{'var_num': '1234'} -'5678' -{} -{} -'' -'5678' -0 -0 -dos -1 -iso-8859-2 -'Dance' -'Dance' -{'var_str': 'Dance'} -{'var_str': 'Dance'} -'Chance' -{} -{} -'' -'Chance' -0 -0 -[1, 2, 3] -[1, 2, 3] -'' -[4, 5, 6, 7] -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -{'dict': 'tabwin'} -{'dict': 'tabwin'} -{'var_dict': {'dict': 'tabwin'}} -{'var_dict': {'dict': 'tabwin'}} -{'dict2': 'newval'} -{} -{} -'' -{'dict2': 'newval'} -'' -{'dict2': 'newval'} -'' -1 diff --git a/src/testdir/test92.in b/src/testdir/test92.in deleted file mode 100644 index 9593aec4c7..0000000000 --- a/src/testdir/test92.in +++ /dev/null @@ -1,48 +0,0 @@ -vim: set ft=vim fenc=utf-8: - -Tests if :mksession saves cursor columns correctly in presence of tab and -multibyte characters when fileencoding=utf-8. - -STARTTEST -:so mbyte.vim -:if !has('mksession') -: e! test.ok -: wq! test.out -:endif -:set sessionoptions=buffers splitbelow fileencoding=utf-8 -/^start: -:vsplit -j16|:split -j16|:split -j16|:split -j8|:split -j8|:split -j16|:split -j16|:split -j16|:wincmd l -/^start: -:set nowrap -j16|3zl:split -j016|3zl:split -j016|3zl:split -j08|3zl:split -j08|3zl:split -j016|3zl:split -j016|3zl:split -j016|3zl:split -:mksession! test.out -:new test.out -:v/\(^ *normal! 0\|^ *exe 'normal!\)/d -:w! test.out -:qa! -ENDTEST - -start: -no multibyte chAracter - one leaDing tab - four leadinG spaces -two consecutive tabs -two tabs in one line -one … multibyteCharacter -a “b” two multiByte characters -“c”1€ three mulTibyte characters diff --git a/src/testdir/test92.ok b/src/testdir/test92.ok deleted file mode 100644 index cca5ec487c..0000000000 --- a/src/testdir/test92.ok +++ /dev/null @@ -1,26 +0,0 @@ -normal! 016| -normal! 016| -normal! 016| -normal! 08| -normal! 08| -normal! 016| -normal! 016| -normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 8 . '|' - normal! 08| - exe 'normal! ' . s:c . '|zs' . 8 . '|' - normal! 08| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| diff --git a/src/testdir/test93.in b/src/testdir/test93.in deleted file mode 100644 index 877838ce1b..0000000000 --- a/src/testdir/test93.in +++ /dev/null @@ -1,48 +0,0 @@ -vim: set ft=vim fenc=latin1: - -Tests if :mksession saves cursor columns correctly in presence of tab and -multibyte characters when fileencoding=latin1. - -STARTTEST -:so mbyte.vim -:if !has('mksession') -: e! test.ok -: wq! test.out -:endif -:set sessionoptions=buffers splitbelow fileencoding=latin1 -/^start: -:vsplit -j16|:split -j16|:split -j16|:split -j8|:split -j8|:split -j16|:split -j16|:split -j16|:wincmd l -/^start: -:set nowrap -j16|3zl:split -j016|3zl:split -j016|3zl:split -j08|3zl:split -j08|3zl:split -j016|3zl:split -j016|3zl:split -j016|3zl:split -:mksession! test.out -:new test.out -:v/\(^ *normal! 0\|^ *exe 'normal!\)/d -:w! test.out -:qa! -ENDTEST - -start: -no multibyte chAracter - one leaDing tab - four leadinG spaces -two consecutive tabs -two tabs in one line -one multibyteCharacter -a two multiByte characters -A three mulTibyte characters diff --git a/src/testdir/test93.ok b/src/testdir/test93.ok deleted file mode 100644 index cca5ec487c..0000000000 --- a/src/testdir/test93.ok +++ /dev/null @@ -1,26 +0,0 @@ -normal! 016| -normal! 016| -normal! 016| -normal! 08| -normal! 08| -normal! 016| -normal! 016| -normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 8 . '|' - normal! 08| - exe 'normal! ' . s:c . '|zs' . 8 . '|' - normal! 08| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| - exe 'normal! ' . s:c . '|zs' . 16 . '|' - normal! 016| diff --git a/src/testdir/test94.in b/src/testdir/test94.in index dfa91d8340..447fd2bee4 100644 --- a/src/testdir/test94.in +++ b/src/testdir/test94.in @@ -17,7 +17,8 @@ Test cases: STARTTEST :so small.vim -:set nocp viminfo+=nviminfo +:set belloff=all +:set enc=utf-8 nocp viminfo+=nviminfo : :" User functions :function MoveToCap() @@ -64,6 +65,167 @@ dV: dv: :set noma | let v:errmsg = '' d: :set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed' dv:dV::set noma | let v:errmsg = '' d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok' +: +:$put ='' +:$put ='characterwise visual mode: replace last line' +:$put ='a' +:let @" = 'x' +:let v:errmsg = '' +v$p +:$put ='---' +:$put ='v:errmsg='.v:errmsg +: +:$put ='' +:$put ='characterwise visual mode: delete middle line' +:$put ='a' +:$put ='b' +:$put ='c' +kkv$d +:$put ='---' +: +:$put ='' +:$put ='characterwise visual mode: delete middle two line' +:$put ='a' +:$put ='b' +:$put ='c' +kkvj$d +:$put ='---' +: +:$put ='' +:$put ='characterwise visual mode: delete last line' +:$put ='a' +:$put ='b' +:$put ='c' +v$d +:$put ='---' +: +:$put ='' +:$put ='characterwise visual mode: delete last two line' +:$put ='a' +:$put ='b' +:$put ='c' +kvj$d +:$put ='---' +: +:" Select mode maps +:snoremap <lt>End> <End> +:snoremap <lt>Down> <Down> +:snoremap <lt>Del> <Del> +: +:$put ='' +:$put ='characterwise select mode: delete middle line' +:$put ='a' +:$put ='b' +:$put ='c' +kkgh<End><Del> +:$put ='---' +: +:$put ='' +:$put ='characterwise select mode: delete middle two line' +:$put ='a' +:$put ='b' +:$put ='c' +kkgh<Down><End><Del> +:$put ='---' +: +:$put ='' +:$put ='characterwise select mode: delete last line' +:$put ='a' +:$put ='b' +:$put ='c' +gh<End><Del> +:$put ='---' +: +:$put ='' +:$put ='characterwise select mode: delete last two line' +:$put ='a' +:$put ='b' +:$put ='c' +kgh<Down><End><Del> +:$put ='---' +: +:$put ='' +:$put ='linewise select mode: delete middle line' +:$put ='a' +:$put ='b' +:$put ='c' +kkgH<Del> +:$put ='---' +: +:$put ='' +:$put ='linewise select mode: delete middle two line' +:$put ='a' +:$put ='b' +:$put ='c' +kkgH<Down><Del> +:$put ='---' +: +:$put ='' +:$put ='linewise select mode: delete last line' +:$put ='a' +:$put ='b' +:$put ='c' +gH<Del> +:$put ='---' +: +:$put ='' +:$put ='linewise select mode: delete last two line' +:$put ='a' +:$put ='b' +:$put ='c' +kgH<Down><Del> +:$put ='---' +: +:$put ='' +:$put ='v_p: replace last character with line register at middle line' +:$put ='aaa' +:$put ='bbb' +:$put ='ccc' +:-2yank +k$vp +:$put ='---' +: +:$put ='' +:$put ='v_p: replace last character with line register at middle line selecting newline' +:$put ='aaa' +:$put ='bbb' +:$put ='ccc' +:-2yank +k$v$p +:$put ='---' +: +:$put ='' +:$put ='v_p: replace last character with line register at last line' +:$put ='aaa' +:$put ='bbb' +:$put ='ccc' +:-2yank +$vp +:$put ='---' +: +:$put ='' +:$put ='v_p: replace last character with line register at last line selecting newline' +:$put ='aaa' +:$put ='bbb' +:$put ='ccc' +:-2yank +$v$p +:$put ='---' +: +:$put ='' +:$put ='gv in exclusive select mode after operation' +:$put ='zzz ' +:$put ='äà ' +:set selection=exclusive +kv3lyjv3lpgvcxxx +:$put ='---' +: +:$put ='' +:$put ='gv in exclusive select mode without operation' +:$put ='zzz ' +:set selection=exclusive +0v3lgvcxxx +:$put ='---' :/^start:/+2,$w! test.out :q! ENDTEST diff --git a/src/testdir/test94.ok b/src/testdir/test94.ok index 3996f2a3a4..c023922177 100644 --- a/src/testdir/test94.ok +++ b/src/testdir/test94.ok @@ -18,3 +18,106 @@ LemonNewNewZ zzz ok ok + +characterwise visual mode: replace last line +x +--- +v:errmsg= + +characterwise visual mode: delete middle line +b +c +--- + +characterwise visual mode: delete middle two line +c +--- + +characterwise visual mode: delete last line +a +b + +--- + +characterwise visual mode: delete last two line +a + +--- + +characterwise select mode: delete middle line +b +c +--- + +characterwise select mode: delete middle two line +c +--- + +characterwise select mode: delete last line +a +b + +--- + +characterwise select mode: delete last two line +a + +--- + +linewise select mode: delete middle line +b +c +--- + +linewise select mode: delete middle two line +c +--- + +linewise select mode: delete last line +a +b +--- + +linewise select mode: delete last two line +a +--- + +v_p: replace last character with line register at middle line +aaa +bb +aaa + +ccc +--- + +v_p: replace last character with line register at middle line selecting newline +aaa +bb +aaa +ccc +--- + +v_p: replace last character with line register at last line +aaa +bbb +cc +aaa + +--- + +v_p: replace last character with line register at last line selecting newline +aaa +bbb +cc +aaa + +--- + +gv in exclusive select mode after operation +zzz +xxx +--- + +gv in exclusive select mode without operation +xxx +--- diff --git a/src/testdir/test95.in b/src/testdir/test95.in index 9fac4d27d1..934afdec1b 100644 --- a/src/testdir/test95.in +++ b/src/testdir/test95.in @@ -18,7 +18,7 @@ STARTTEST :" etc. :" When there is no match use only the first two items. :let tl = [] - +: :"""" Multi-byte character tests. These will fail unless vim is compiled :"""" with Multibyte (FEAT_MBYTE) or BIG/HUGE features. :call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) @@ -26,15 +26,15 @@ STARTTEST :call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) :call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) :call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) - +: :" this is not a normal "i" but 0xec :call add(tl, [2, '\p\+', 'ìa', 'ìa']) :call add(tl, [2, '\p*', 'aあ', 'aあ']) - +: :"""" Test recognition of some character classes :call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) :call add(tl, [2, '\f\+', '&*Ÿfname ', 'fname']) - +: :"""" Test composing character matching :call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) :call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) @@ -56,8 +56,8 @@ STARTTEST :call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) :call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) :call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) - - +: +: :"""" Test \Z :call add(tl, [2, 'ú\Z', 'x']) :call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) @@ -75,12 +75,12 @@ STARTTEST :call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) :call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) :call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) - +: :"""" Combining different tests and features :call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) - +: :"""" Run the tests - +: :" :for t in tl : let re = t[0] @@ -124,7 +124,7 @@ STARTTEST : endfor :endfor :unlet t tl e l - +: :" check that 'ambiwidth' does not change the meaning of \p :set regexpengine=1 ambiwidth=single :$put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') @@ -134,7 +134,7 @@ STARTTEST :$put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') :set regexpengine=2 ambiwidth=double :$put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') - +: :/\%#=1^Results/,$wq! test.out ENDTEST diff --git a/src/testdir/test96.in b/src/testdir/test96.in deleted file mode 100644 index 9d1a2c83a5..0000000000 --- a/src/testdir/test96.in +++ /dev/null @@ -1,142 +0,0 @@ -This will test for problems in quickfix: -A. incorrectly copying location lists which caused the location list to show a - different name than the file that was actually being displayed. -B. not reusing the window for which the location list window is opened but - instead creating new windows. -C. make sure that the location list window is not reused instead of the window - it belongs to. - -Note: to debug a problem comment out the last ":b 1" in a test and testing will -stop at this point. - -STARTTEST -:so small.vim -: enew -: w! test.out -: b 1 -: " Set up the test environment: -: function! ReadTestProtocol(name) -: let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '') -: let word = substitute(base, '\v(.*)\..*', '\1', '') -: -: setl modifiable -: setl noreadonly -: setl noswapfile -: setl bufhidden=delete -: %del _ -: " For problem 2: -: " 'buftype' has to be set to reproduce the constant opening of new windows -: setl buftype=nofile -: -: call setline(1, word) -: -: setl nomodified -: setl nomodifiable -: setl readonly -: exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '') -: endfunction -: augroup testgroup -: au! -: autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>")) -: augroup END -: let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ] -: -: let qflist = [] -: for word in words -: call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', }) -: " NOTE: problem 1: -: " intentionally not setting 'lnum' so that the quickfix entries are not -: " valid -: call setloclist(0, qflist, ' ') -: endfor -ENDTEST - -Test A: -STARTTEST -:lrewind -:enew -:lopen -:lnext -:lnext -:lnext -:lnext -:vert split -:wincmd L -:lopen -:wincmd p -:lnext -:"b 1 -:let fileName = expand("%") -:wincmd p -:let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '') -:wincmd n -:wincmd K -:b test.out -:let fileName = substitute(fileName, '\\', '/', 'g') -:let locationListFileName = substitute(locationListFileName, '\\', '/', 'g') -:call append(line('$'), "Test A:") -:call append(line('$'), " - file name displayed: " . fileName) -:call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName) -:w -:wincmd o -:b 1 -ENDTEST - -Test B: -STARTTEST -:lrewind -:lopen -:2 -:exe "normal \<CR>" -:wincmd p -:3 -:exe "normal \<CR>" -:wincmd p -:4 -:exe "normal \<CR>" -:let numberOfWindowsOpen = winnr('$') -:wincmd n -:wincmd K -:b test.out -:call append(line('$'), "Test B:") -:call append(line('$'), " - number of window open: " . numberOfWindowsOpen) -:w -:wincmd o -:b 1 -ENDTEST - -Test C: -STARTTEST -:lrewind -:lopen -:" Let's move the location list window to the top to check whether it (the first -:" window found) will be reused when we try to open new windows: -:wincmd K -:2 -:exe "normal \<CR>" -:wincmd p -:3 -:exe "normal \<CR>" -:wincmd p -:4 -:exe "normal \<CR>" -:1wincmd w -:let locationListWindowBufType = &buftype -:2wincmd w -:let bufferName = expand("%") -:wincmd n -:wincmd K -:b test.out -:let bufferName = substitute(bufferName, '\\', '/', 'g') -:call append(line('$'), "Test C:") -:call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType) -:call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName) -:w -:wincmd o -:b 1 -ENDTEST - -STARTTEST -:qa -ENDTEST - diff --git a/src/testdir/test96.ok b/src/testdir/test96.ok deleted file mode 100644 index 3498e52f73..0000000000 --- a/src/testdir/test96.ok +++ /dev/null @@ -1,9 +0,0 @@ - -Test A: - - file name displayed: test://bar.txt - - quickfix claims that the file name displayed is: test://bar.txt -Test B: - - number of window open: 2 -Test C: - - 'buftype' of the location list window: quickfix - - buffer displayed in the 2nd window: test://quux.txt diff --git a/src/testdir/test97.in b/src/testdir/test97.in deleted file mode 100644 index d4ff6d9295..0000000000 --- a/src/testdir/test97.in +++ /dev/null @@ -1,23 +0,0 @@ -Test whether glob()/globpath() return correct results with certain escaped -characters. - -STARTTEST -:so small.vim -:" make sure glob() doesn't use the shell -:set shell=doesnotexist -:" consistent sorting of file names -:set nofileignorecase -:e test.out -:$put =glob('Xxx\{') -:$put =glob('Xxx\$') -:w! Xxx{ -:w! Xxx\$ -:$put =glob('Xxx\{') -:$put =glob('Xxx\$') -:" -:$put =string(globpath('sautest/autoload', '*.vim')) -:$put =string(globpath('sautest/autoload', '*.vim', 0, 1)) -:w -:qa! -ENDTEST - diff --git a/src/testdir/test97.ok b/src/testdir/test97.ok deleted file mode 100644 index 32cdcbf1be..0000000000 --- a/src/testdir/test97.ok +++ /dev/null @@ -1,8 +0,0 @@ - - - -Xxx{ -Xxx$ -'sautest/autoload/Test104.vim -sautest/autoload/footest.vim' -['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim'] diff --git a/src/testdir/test98.in b/src/testdir/test98.in deleted file mode 100644 index 83ccba09e9..0000000000 --- a/src/testdir/test98.in +++ /dev/null @@ -1,43 +0,0 @@ -Test for 'scrollbind' causing an unexpected scroll of one of the windows. -STARTTEST -:so small.vim -:" We don't want the status line to cause problems: -:set laststatus=0 -:let g:totalLines = &lines * 20 -:let middle = g:totalLines / 2 -:wincmd n -:wincmd o -:for i in range(1, g:totalLines) -: call setline(i, 'LINE ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:aboveleft vert new -:for i in range(1, g:totalLines) -: call setline(i, 'line ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:" Execute the following two command at once to reproduce the problem. -:setl scb | wincmd p -:setl scb -:wincmd w -:let topLineLeft = line('w0') -:wincmd p -:let topLineRight = line('w0') -:setl noscrollbind -:wincmd p -:setl noscrollbind -:q! -:%del _ -:call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/testdir/test98.ok b/src/testdir/test98.ok deleted file mode 100644 index 356ddd8eac..0000000000 --- a/src/testdir/test98.ok +++ /dev/null @@ -1 +0,0 @@ -Difference between the top lines (left - right): 0 diff --git a/src/testdir/test99.in b/src/testdir/test99.in index 77828f4b68..3961244c79 100644 --- a/src/testdir/test99.in +++ b/src/testdir/test99.in @@ -29,13 +29,15 @@ x/[\u4f7f\u5929]\+ x/\%U12345678 x/[\U1234abcd\u1234\uabcd] x/\%d21879b -x/ [[=A=]]* [[=B=]]* [[=C=]]* [[=D=]]* [[=E=]]* [[=F=]]* [[=G=]]* [[=H=]]* [[=I=]]* [[=J=]]* [[=K=]]* [[=L=]]* [[=M=]]* [[=N=]]* [[=O=]]* [[=P=]]* [[=Q=]]* [[=R=]]* [[=S=]]* [[=T=]]* [[=U=]]* [[=V=]]* [[=W=]]* [[=X=]]* [[=Y=]]* [[=Z=]]*/e -x/ [[=a=]]* [[=b=]]* [[=c=]]* [[=d=]]* [[=e=]]* [[=f=]]* [[=g=]]* [[=h=]]* [[=i=]]* [[=j=]]* [[=k=]]* [[=l=]]* [[=m=]]* [[=n=]]* [[=o=]]* [[=p=]]* [[=q=]]* [[=r=]]* [[=s=]]* [[=t=]]* [[=u=]]* [[=v=]]* [[=w=]]* [[=x=]]* [[=y=]]* [[=z=]]*/e x:" Test backwards search from a multi-byte char /x x?. x:let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g' :@w +:" +:" l Test what 7.3.192 fixed +/^l +:s/ \?/ /g :?^1?,$w! test.out :e! test.out G:put =matchstr(\"אבגד\", \".\", 0, 2) " ב @@ -62,7 +64,6 @@ d 天使x e y f z g a啷bb -h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ -i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ j 0123❤x k combinations +l äö üᾱ̆́ diff --git a/src/testdir/test99.ok b/src/testdir/test99.ok index 0bd0b8ab73..dea3665cf6 100644 --- a/src/testdir/test99.ok +++ b/src/testdir/test99.ok @@ -14,10 +14,9 @@ d 使x e y f z g abb -h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐ -i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑ j 012❤ k œ̄ṣ́m̥̄ᾱ̆́ + l ä ö ü ᾱ̆́ ב בג א diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim new file mode 100644 index 0000000000..ac3ca74f53 --- /dev/null +++ b/src/testdir/test_alot.vim @@ -0,0 +1,61 @@ +" A series of tests that can run in one Vim invocation. +" This makes testing go faster, since Vim doesn't need to restart. + +source test_assign.vim +source test_bufline.vim +source test_cd.vim +source test_changedtick.vim +source test_compiler.vim +source test_cursor_func.vim +source test_delete.vim +source test_ex_undo.vim +source test_ex_z.vim +source test_execute_func.vim +source test_expand.vim +source test_expand_dllpath.vim +source test_expr.vim +source test_feedkeys.vim +source test_file_perm.vim +source test_fileformat.vim +source test_filetype.vim +source test_filter_cmd.vim +source test_filter_map.vim +source test_findfile.vim +source test_float_func.vim +source test_fnamemodify.vim +source test_functions.vim +source test_ga.vim +source test_glob2regpat.vim +source test_global.vim +source test_goto.vim +source test_help_tagjump.vim +source test_join.vim +source test_jumps.vim +source test_lambda.vim +source test_lispwords.vim +source test_mapping.vim +source test_match.vim +source test_menu.vim +source test_messages.vim +source test_partial.vim +source test_popup.vim +source test_put.vim +source test_recover.vim +source test_reltime.vim +source test_scroll_opt.vim +source test_searchpos.vim +source test_set.vim +source test_sort.vim +source test_sha256.vim +source test_statusline.vim +source test_syn_attr.vim +source test_tabline.vim +source test_tabpage.vim +source test_tagcase.vim +source test_tagjump.vim +source test_taglist.vim +source test_timers.vim +source test_true_false.vim +source test_unlet.vim +source test_virtualedit.vim +source test_window_cmd.vim diff --git a/src/testdir/test_alot_latin.vim b/src/testdir/test_alot_latin.vim new file mode 100644 index 0000000000..23a404cac1 --- /dev/null +++ b/src/testdir/test_alot_latin.vim @@ -0,0 +1,7 @@ +" A series of tests that can run in one Vim invocation. +" This makes testing go faster, since Vim doesn't need to restart. + +" These tests use latin1 'encoding'. Setting 'encoding' is in the individual +" files, so that they can be run by themselves. + +source test_regexp_latin.vim diff --git a/src/testdir/test_alot_utf8.vim b/src/testdir/test_alot_utf8.vim new file mode 100644 index 0000000000..648d806a94 --- /dev/null +++ b/src/testdir/test_alot_utf8.vim @@ -0,0 +1,17 @@ +" A series of tests that can run in one Vim invocation. +" This makes testing go faster, since Vim doesn't need to restart. + +" These tests use utf8 'encoding'. Setting 'encoding' is already done in +" runtest.vim. Checking for the multi_byte feature is in the individual +" files, so that they can be run by themselves. + +source test_charsearch_utf8.vim +source test_expr_utf8.vim +source test_listlbr_utf8.vim +source test_matchadd_conceal_utf8.vim +source test_mksession_utf8.vim +source test_regexp_utf8.vim +source test_source_utf8.vim +source test_startup_utf8.vim +source test_utf8.vim +source test_utf8_comparisons.vim diff --git a/src/testdir/test_arabic.vim b/src/testdir/test_arabic.vim new file mode 100644 index 0000000000..17e925ee7f --- /dev/null +++ b/src/testdir/test_arabic.vim @@ -0,0 +1,613 @@ +" Simplistic testing of Arabic mode. +" NOTE: This just checks if the code works. If you know Arabic please add +" functional tests that check the shaping works with real text. + +if !has('arabic') || !has('multi_byte') + finish +endif + +source view_util.vim + +" Return list of Unicode characters at line lnum. +" Combining characters are treated as a single item. +func s:get_chars(lnum) + call cursor(a:lnum, 1) + let chars = [] + let numchars = strchars(getline('.'), 1) + for i in range(1, numchars) + exe 'norm ' i . '|' + let c = execute('ascii') + let c = substitute(c, '\n\?<.\{-}Hex\s*', 'U+', 'g') + let c = substitute(c, ',\s*Oct\(al\)\=\s\d*\(, Digr ..\)\=', '', 'g') + call add(chars, c) + endfor + return chars +endfunc + +func Test_arabic_toggle() + set arabic + call assert_equal(1, &rightleft) + call assert_equal(1, &arabicshape) + call assert_equal('arabic', &keymap) + call assert_equal(1, &delcombine) + + set iminsert=1 imsearch=1 + set arabic& + call assert_equal(0, &rightleft) + call assert_equal(1, &arabicshape) + call assert_equal('arabic', &keymap) + call assert_equal(1, &delcombine) + call assert_equal(0, &iminsert) + call assert_equal(-1, &imsearch) + + set arabicshape& keymap= delcombine& +endfunc + +func Test_arabic_input() + new + set arabic + " Typing sghl in Arabic insert mode should show the + " Arabic word 'Salaam' i.e. 'peace', spelled: + " SEEN, LAM, ALEF, MEEM. + " See: https://www.mediawiki.org/wiki/VisualEditor/Typing/Right-to-left + call feedkeys('isghl!', 'tx') + call assert_match("^ *!\uFEE1\uFEFC\uFEB3$", ScreenLines(1, &columns)[0]) + call assert_equal([ + \ 'U+0633', + \ 'U+0644 U+0627', + \ 'U+0645', + \ 'U+21'], s:get_chars(1)) + + " Without shaping, it should give individual Arabic letters. + set noarabicshape + call assert_match("^ *!\u0645\u0627\u0644\u0633$", ScreenLines(1, &columns)[0]) + call assert_equal([ + \ 'U+0633', + \ 'U+0644', + \ 'U+0627', + \ 'U+0645', + \ 'U+21'], s:get_chars(1)) + + set arabic& arabicshape& + bwipe! +endfunc + +func Test_arabic_toggle_keymap() + new + set arabic + call feedkeys("i12\<C-^>12\<C-^>12", 'tx') + call assert_match("^ *٢١21٢١$", ScreenLines(1, &columns)[0]) + call assert_equal('١٢12١٢', getline('.')) + set arabic& + bwipe! +endfunc + +func Test_delcombine() + new + set arabic + call feedkeys("isghl\<BS>\<BS>", 'tx') + call assert_match("^ *\uFEDE\uFEB3$", ScreenLines(1, &columns)[0]) + call assert_equal(['U+0633', 'U+0644'], s:get_chars(1)) + + " Now the same with 'nodelcombine' + set nodelcombine + %d + call feedkeys("isghl\<BS>\<BS>", 'tx') + call assert_match("^ *\uFEB1$", ScreenLines(1, &columns)[0]) + call assert_equal(['U+0633'], s:get_chars(1)) + set arabic& + bwipe! +endfunc + +" Values from src/arabic.h (not all used yet) +let s:a_COMMA = "\u060C" +let s:a_SEMICOLON = "\u061B" +let s:a_QUESTION = "\u061F" +let s:a_HAMZA = "\u0621" +let s:a_ALEF_MADDA = "\u0622" +let s:a_ALEF_HAMZA_ABOVE = "\u0623" +let s:a_WAW_HAMZA = "\u0624" +let s:a_ALEF_HAMZA_BELOW = "\u0625" +let s:a_YEH_HAMZA = "\u0626" +let s:a_ALEF = "\u0627" +let s:a_BEH = "\u0628" +let s:a_TEH_MARBUTA = "\u0629" +let s:a_TEH = "\u062a" +let s:a_THEH = "\u062b" +let s:a_JEEM = "\u062c" +let s:a_HAH = "\u062d" +let s:a_KHAH = "\u062e" +let s:a_DAL = "\u062f" +let s:a_THAL = "\u0630" +let s:a_REH = "\u0631" +let s:a_ZAIN = "\u0632" +let s:a_SEEN = "\u0633" +let s:a_SHEEN = "\u0634" +let s:a_SAD = "\u0635" +let s:a_DAD = "\u0636" +let s:a_TAH = "\u0637" +let s:a_ZAH = "\u0638" +let s:a_AIN = "\u0639" +let s:a_GHAIN = "\u063a" +let s:a_TATWEEL = "\u0640" +let s:a_FEH = "\u0641" +let s:a_QAF = "\u0642" +let s:a_KAF = "\u0643" +let s:a_LAM = "\u0644" +let s:a_MEEM = "\u0645" +let s:a_NOON = "\u0646" +let s:a_HEH = "\u0647" +let s:a_WAW = "\u0648" +let s:a_ALEF_MAKSURA = "\u0649" +let s:a_YEH = "\u064a" + +let s:a_FATHATAN = "\u064b" +let s:a_DAMMATAN = "\u064c" +let s:a_KASRATAN = "\u064d" +let s:a_FATHA = "\u064e" +let s:a_DAMMA = "\u064f" +let s:a_KASRA = "\u0650" +let s:a_SHADDA = "\u0651" +let s:a_SUKUN = "\u0652" + +let s:a_MADDA_ABOVE = "\u0653" +let s:a_HAMZA_ABOVE = "\u0654" +let s:a_HAMZA_BELOW = "\u0655" + +let s:a_ZERO = "\u0660" +let s:a_ONE = "\u0661" +let s:a_TWO = "\u0662" +let s:a_THREE = "\u0663" +let s:a_FOUR = "\u0664" +let s:a_FIVE = "\u0665" +let s:a_SIX = "\u0666" +let s:a_SEVEN = "\u0667" +let s:a_EIGHT = "\u0668" +let s:a_NINE = "\u0669" +let s:a_PERCENT = "\u066a" +let s:a_DECIMAL = "\u066b" +let s:a_THOUSANDS = "\u066c" +let s:a_STAR = "\u066d" +let s:a_MINI_ALEF = "\u0670" + +let s:a_s_FATHATAN = "\ufe70" +let s:a_m_TATWEEL_FATHATAN = "\ufe71" +let s:a_s_DAMMATAN = "\ufe72" + +let s:a_s_KASRATAN = "\ufe74" + +let s:a_s_FATHA = "\ufe76" +let s:a_m_FATHA = "\ufe77" +let s:a_s_DAMMA = "\ufe78" +let s:a_m_DAMMA = "\ufe79" +let s:a_s_KASRA = "\ufe7a" +let s:a_m_KASRA = "\ufe7b" +let s:a_s_SHADDA = "\ufe7c" +let s:a_m_SHADDA = "\ufe7d" +let s:a_s_SUKUN = "\ufe7e" +let s:a_m_SUKUN = "\ufe7f" + +let s:a_s_HAMZA = "\ufe80" +let s:a_s_ALEF_MADDA = "\ufe81" +let s:a_f_ALEF_MADDA = "\ufe82" +let s:a_s_ALEF_HAMZA_ABOVE = "\ufe83" +let s:a_f_ALEF_HAMZA_ABOVE = "\ufe84" +let s:a_s_WAW_HAMZA = "\ufe85" +let s:a_f_WAW_HAMZA = "\ufe86" +let s:a_s_ALEF_HAMZA_BELOW = "\ufe87" +let s:a_f_ALEF_HAMZA_BELOW = "\ufe88" +let s:a_s_YEH_HAMZA = "\ufe89" +let s:a_f_YEH_HAMZA = "\ufe8a" +let s:a_i_YEH_HAMZA = "\ufe8b" +let s:a_m_YEH_HAMZA = "\ufe8c" +let s:a_s_ALEF = "\ufe8d" +let s:a_f_ALEF = "\ufe8e" +let s:a_s_BEH = "\ufe8f" +let s:a_f_BEH = "\ufe90" +let s:a_i_BEH = "\ufe91" +let s:a_m_BEH = "\ufe92" +let s:a_s_TEH_MARBUTA = "\ufe93" +let s:a_f_TEH_MARBUTA = "\ufe94" +let s:a_s_TEH = "\ufe95" +let s:a_f_TEH = "\ufe96" +let s:a_i_TEH = "\ufe97" +let s:a_m_TEH = "\ufe98" +let s:a_s_THEH = "\ufe99" +let s:a_f_THEH = "\ufe9a" +let s:a_i_THEH = "\ufe9b" +let s:a_m_THEH = "\ufe9c" +let s:a_s_JEEM = "\ufe9d" +let s:a_f_JEEM = "\ufe9e" +let s:a_i_JEEM = "\ufe9f" +let s:a_m_JEEM = "\ufea0" +let s:a_s_HAH = "\ufea1" +let s:a_f_HAH = "\ufea2" +let s:a_i_HAH = "\ufea3" +let s:a_m_HAH = "\ufea4" +let s:a_s_KHAH = "\ufea5" +let s:a_f_KHAH = "\ufea6" +let s:a_i_KHAH = "\ufea7" +let s:a_m_KHAH = "\ufea8" +let s:a_s_DAL = "\ufea9" +let s:a_f_DAL = "\ufeaa" +let s:a_s_THAL = "\ufeab" +let s:a_f_THAL = "\ufeac" +let s:a_s_REH = "\ufead" +let s:a_f_REH = "\ufeae" +let s:a_s_ZAIN = "\ufeaf" +let s:a_f_ZAIN = "\ufeb0" +let s:a_s_SEEN = "\ufeb1" +let s:a_f_SEEN = "\ufeb2" +let s:a_i_SEEN = "\ufeb3" +let s:a_m_SEEN = "\ufeb4" +let s:a_s_SHEEN = "\ufeb5" +let s:a_f_SHEEN = "\ufeb6" +let s:a_i_SHEEN = "\ufeb7" +let s:a_m_SHEEN = "\ufeb8" +let s:a_s_SAD = "\ufeb9" +let s:a_f_SAD = "\ufeba" +let s:a_i_SAD = "\ufebb" +let s:a_m_SAD = "\ufebc" +let s:a_s_DAD = "\ufebd" +let s:a_f_DAD = "\ufebe" +let s:a_i_DAD = "\ufebf" +let s:a_m_DAD = "\ufec0" +let s:a_s_TAH = "\ufec1" +let s:a_f_TAH = "\ufec2" +let s:a_i_TAH = "\ufec3" +let s:a_m_TAH = "\ufec4" +let s:a_s_ZAH = "\ufec5" +let s:a_f_ZAH = "\ufec6" +let s:a_i_ZAH = "\ufec7" +let s:a_m_ZAH = "\ufec8" +let s:a_s_AIN = "\ufec9" +let s:a_f_AIN = "\ufeca" +let s:a_i_AIN = "\ufecb" +let s:a_m_AIN = "\ufecc" +let s:a_s_GHAIN = "\ufecd" +let s:a_f_GHAIN = "\ufece" +let s:a_i_GHAIN = "\ufecf" +let s:a_m_GHAIN = "\ufed0" +let s:a_s_FEH = "\ufed1" +let s:a_f_FEH = "\ufed2" +let s:a_i_FEH = "\ufed3" +let s:a_m_FEH = "\ufed4" +let s:a_s_QAF = "\ufed5" +let s:a_f_QAF = "\ufed6" +let s:a_i_QAF = "\ufed7" +let s:a_m_QAF = "\ufed8" +let s:a_s_KAF = "\ufed9" +let s:a_f_KAF = "\ufeda" +let s:a_i_KAF = "\ufedb" +let s:a_m_KAF = "\ufedc" +let s:a_s_LAM = "\ufedd" +let s:a_f_LAM = "\ufede" +let s:a_i_LAM = "\ufedf" +let s:a_m_LAM = "\ufee0" +let s:a_s_MEEM = "\ufee1" +let s:a_f_MEEM = "\ufee2" +let s:a_i_MEEM = "\ufee3" +let s:a_m_MEEM = "\ufee4" +let s:a_s_NOON = "\ufee5" +let s:a_f_NOON = "\ufee6" +let s:a_i_NOON = "\ufee7" +let s:a_m_NOON = "\ufee8" +let s:a_s_HEH = "\ufee9" +let s:a_f_HEH = "\ufeea" +let s:a_i_HEH = "\ufeeb" +let s:a_m_HEH = "\ufeec" +let s:a_s_WAW = "\ufeed" +let s:a_f_WAW = "\ufeee" +let s:a_s_ALEF_MAKSURA = "\ufeef" +let s:a_f_ALEF_MAKSURA = "\ufef0" +let s:a_s_YEH = "\ufef1" +let s:a_f_YEH = "\ufef2" +let s:a_i_YEH = "\ufef3" +let s:a_m_YEH = "\ufef4" +let s:a_s_LAM_ALEF_MADDA_ABOVE = "\ufef5" +let s:a_f_LAM_ALEF_MADDA_ABOVE = "\ufef6" +let s:a_s_LAM_ALEF_HAMZA_ABOVE = "\ufef7" +let s:a_f_LAM_ALEF_HAMZA_ABOVE = "\ufef8" +let s:a_s_LAM_ALEF_HAMZA_BELOW = "\ufef9" +let s:a_f_LAM_ALEF_HAMZA_BELOW = "\ufefa" +let s:a_s_LAM_ALEF = "\ufefb" +let s:a_f_LAM_ALEF = "\ufefc" + +let s:a_BYTE_ORDER_MARK = "\ufeff" + +func Test_shape_initial() + new + set arabicshape + + " Shaping arabic {testchar} non-arabic Tests chg_c_a2i(). + " pair[0] = testchar, pair[1] = next-result, pair[2] = current-result + for pair in [[s:a_YEH_HAMZA, s:a_f_GHAIN, s:a_i_YEH_HAMZA], + \ [s:a_HAMZA, s:a_s_GHAIN, s:a_s_HAMZA], + \ [s:a_ALEF_MADDA, s:a_s_GHAIN, s:a_s_ALEF_MADDA], + \ [s:a_ALEF_HAMZA_ABOVE, s:a_s_GHAIN, s:a_s_ALEF_HAMZA_ABOVE], + \ [s:a_WAW_HAMZA, s:a_s_GHAIN, s:a_s_WAW_HAMZA], + \ [s:a_ALEF_HAMZA_BELOW, s:a_s_GHAIN, s:a_s_ALEF_HAMZA_BELOW], + \ [s:a_ALEF, s:a_s_GHAIN, s:a_s_ALEF], + \ [s:a_TEH_MARBUTA, s:a_s_GHAIN, s:a_s_TEH_MARBUTA], + \ [s:a_DAL, s:a_s_GHAIN, s:a_s_DAL], + \ [s:a_THAL, s:a_s_GHAIN, s:a_s_THAL], + \ [s:a_REH, s:a_s_GHAIN, s:a_s_REH], + \ [s:a_ZAIN, s:a_s_GHAIN, s:a_s_ZAIN], + \ [s:a_TATWEEL, s:a_f_GHAIN, s:a_TATWEEL], + \ [s:a_WAW, s:a_s_GHAIN, s:a_s_WAW], + \ [s:a_ALEF_MAKSURA, s:a_s_GHAIN, s:a_s_ALEF_MAKSURA], + \ [s:a_BEH, s:a_f_GHAIN, s:a_i_BEH], + \ [s:a_TEH, s:a_f_GHAIN, s:a_i_TEH], + \ [s:a_THEH, s:a_f_GHAIN, s:a_i_THEH], + \ [s:a_JEEM, s:a_f_GHAIN, s:a_i_JEEM], + \ [s:a_HAH, s:a_f_GHAIN, s:a_i_HAH], + \ [s:a_KHAH, s:a_f_GHAIN, s:a_i_KHAH], + \ [s:a_SEEN, s:a_f_GHAIN, s:a_i_SEEN], + \ [s:a_SHEEN, s:a_f_GHAIN, s:a_i_SHEEN], + \ [s:a_SAD, s:a_f_GHAIN, s:a_i_SAD], + \ [s:a_DAD, s:a_f_GHAIN, s:a_i_DAD], + \ [s:a_TAH, s:a_f_GHAIN, s:a_i_TAH], + \ [s:a_ZAH, s:a_f_GHAIN, s:a_i_ZAH], + \ [s:a_AIN, s:a_f_GHAIN, s:a_i_AIN], + \ [s:a_GHAIN, s:a_f_GHAIN, s:a_i_GHAIN], + \ [s:a_FEH, s:a_f_GHAIN, s:a_i_FEH], + \ [s:a_QAF, s:a_f_GHAIN, s:a_i_QAF], + \ [s:a_KAF, s:a_f_GHAIN, s:a_i_KAF], + \ [s:a_LAM, s:a_f_GHAIN, s:a_i_LAM], + \ [s:a_MEEM, s:a_f_GHAIN, s:a_i_MEEM], + \ [s:a_NOON, s:a_f_GHAIN, s:a_i_NOON], + \ [s:a_HEH, s:a_f_GHAIN, s:a_i_HEH], + \ [s:a_YEH, s:a_f_GHAIN, s:a_i_YEH], + \ ] + call setline(1, s:a_GHAIN . pair[0] . ' ') + call assert_equal([pair[1] . pair[2] . ' '], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_isolated() + new + set arabicshape + + " Shaping non-arabic {testchar} non-arabic Tests chg_c_a2s(). + " pair[0] = testchar, pair[1] = current-result + for pair in [[s:a_HAMZA, s:a_s_HAMZA], + \ [s:a_ALEF_MADDA, s:a_s_ALEF_MADDA], + \ [s:a_ALEF_HAMZA_ABOVE, s:a_s_ALEF_HAMZA_ABOVE], + \ [s:a_WAW_HAMZA, s:a_s_WAW_HAMZA], + \ [s:a_ALEF_HAMZA_BELOW, s:a_s_ALEF_HAMZA_BELOW], + \ [s:a_YEH_HAMZA, s:a_s_YEH_HAMZA], + \ [s:a_ALEF, s:a_s_ALEF], + \ [s:a_TEH_MARBUTA, s:a_s_TEH_MARBUTA], + \ [s:a_DAL, s:a_s_DAL], + \ [s:a_THAL, s:a_s_THAL], + \ [s:a_REH, s:a_s_REH], + \ [s:a_ZAIN, s:a_s_ZAIN], + \ [s:a_TATWEEL, s:a_TATWEEL], + \ [s:a_WAW, s:a_s_WAW], + \ [s:a_ALEF_MAKSURA, s:a_s_ALEF_MAKSURA], + \ [s:a_BEH, s:a_s_BEH], + \ [s:a_TEH, s:a_s_TEH], + \ [s:a_THEH, s:a_s_THEH], + \ [s:a_JEEM, s:a_s_JEEM], + \ [s:a_HAH, s:a_s_HAH], + \ [s:a_KHAH, s:a_s_KHAH], + \ [s:a_SEEN, s:a_s_SEEN], + \ [s:a_SHEEN, s:a_s_SHEEN], + \ [s:a_SAD, s:a_s_SAD], + \ [s:a_DAD, s:a_s_DAD], + \ [s:a_TAH, s:a_s_TAH], + \ [s:a_ZAH, s:a_s_ZAH], + \ [s:a_AIN, s:a_s_AIN], + \ [s:a_GHAIN, s:a_s_GHAIN], + \ [s:a_FEH, s:a_s_FEH], + \ [s:a_QAF, s:a_s_QAF], + \ [s:a_KAF, s:a_s_KAF], + \ [s:a_LAM, s:a_s_LAM], + \ [s:a_MEEM, s:a_s_MEEM], + \ [s:a_NOON, s:a_s_NOON], + \ [s:a_HEH, s:a_s_HEH], + \ [s:a_YEH, s:a_s_YEH], + \ ] + call setline(1, ' ' . pair[0] . ' ') + call assert_equal([' ' . pair[1] . ' '], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_iso_to_medial() + new + set arabicshape + + " Shaping arabic {testchar} arabic Tests chg_c_a2m(). + " pair[0] = testchar, pair[1] = next-result, pair[2] = current-result, + " pair[3] = previous-result + for pair in [[s:a_HAMZA, s:a_s_GHAIN, s:a_s_HAMZA, s:a_s_BEH], + \[s:a_ALEF_MADDA, s:a_s_GHAIN, s:a_f_ALEF_MADDA, s:a_i_BEH], + \[s:a_ALEF_HAMZA_ABOVE, s:a_s_GHAIN, s:a_f_ALEF_HAMZA_ABOVE, s:a_i_BEH], + \[s:a_WAW_HAMZA, s:a_s_GHAIN, s:a_f_WAW_HAMZA, s:a_i_BEH], + \[s:a_ALEF_HAMZA_BELOW, s:a_s_GHAIN, s:a_f_ALEF_HAMZA_BELOW, s:a_i_BEH], + \[s:a_YEH_HAMZA, s:a_f_GHAIN, s:a_m_YEH_HAMZA, s:a_i_BEH], + \[s:a_ALEF, s:a_s_GHAIN, s:a_f_ALEF, s:a_i_BEH], + \[s:a_BEH, s:a_f_GHAIN, s:a_m_BEH, s:a_i_BEH], + \[s:a_TEH_MARBUTA, s:a_s_GHAIN, s:a_f_TEH_MARBUTA, s:a_i_BEH], + \[s:a_TEH, s:a_f_GHAIN, s:a_m_TEH, s:a_i_BEH], + \[s:a_THEH, s:a_f_GHAIN, s:a_m_THEH, s:a_i_BEH], + \[s:a_JEEM, s:a_f_GHAIN, s:a_m_JEEM, s:a_i_BEH], + \[s:a_HAH, s:a_f_GHAIN, s:a_m_HAH, s:a_i_BEH], + \[s:a_KHAH, s:a_f_GHAIN, s:a_m_KHAH, s:a_i_BEH], + \[s:a_DAL, s:a_s_GHAIN, s:a_f_DAL, s:a_i_BEH], + \[s:a_THAL, s:a_s_GHAIN, s:a_f_THAL, s:a_i_BEH], + \[s:a_REH, s:a_s_GHAIN, s:a_f_REH, s:a_i_BEH], + \[s:a_ZAIN, s:a_s_GHAIN, s:a_f_ZAIN, s:a_i_BEH], + \[s:a_SEEN, s:a_f_GHAIN, s:a_m_SEEN, s:a_i_BEH], + \[s:a_SHEEN, s:a_f_GHAIN, s:a_m_SHEEN, s:a_i_BEH], + \[s:a_SAD, s:a_f_GHAIN, s:a_m_SAD, s:a_i_BEH], + \[s:a_DAD, s:a_f_GHAIN, s:a_m_DAD, s:a_i_BEH], + \[s:a_TAH, s:a_f_GHAIN, s:a_m_TAH, s:a_i_BEH], + \[s:a_ZAH, s:a_f_GHAIN, s:a_m_ZAH, s:a_i_BEH], + \[s:a_AIN, s:a_f_GHAIN, s:a_m_AIN, s:a_i_BEH], + \[s:a_GHAIN, s:a_f_GHAIN, s:a_m_GHAIN, s:a_i_BEH], + \[s:a_TATWEEL, s:a_f_GHAIN, s:a_TATWEEL, s:a_i_BEH], + \[s:a_FEH, s:a_f_GHAIN, s:a_m_FEH, s:a_i_BEH], + \[s:a_QAF, s:a_f_GHAIN, s:a_m_QAF, s:a_i_BEH], + \[s:a_KAF, s:a_f_GHAIN, s:a_m_KAF, s:a_i_BEH], + \[s:a_LAM, s:a_f_GHAIN, s:a_m_LAM, s:a_i_BEH], + \[s:a_MEEM, s:a_f_GHAIN, s:a_m_MEEM, s:a_i_BEH], + \[s:a_NOON, s:a_f_GHAIN, s:a_m_NOON, s:a_i_BEH], + \[s:a_HEH, s:a_f_GHAIN, s:a_m_HEH, s:a_i_BEH], + \[s:a_WAW, s:a_s_GHAIN, s:a_f_WAW, s:a_i_BEH], + \[s:a_ALEF_MAKSURA, s:a_s_GHAIN, s:a_f_ALEF_MAKSURA, s:a_i_BEH], + \[s:a_YEH, s:a_f_GHAIN, s:a_m_YEH, s:a_i_BEH], + \ ] + call setline(1, s:a_GHAIN . pair[0] . s:a_BEH) + call assert_equal([pair[1] . pair[2] . pair[3]], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_final() + new + set arabicshape + + " Shaping arabic {testchar} arabic Tests chg_c_a2f(). + " pair[0] = testchar, pair[1] = current-result, pair[2] = previous-result + for pair in [[s:a_HAMZA, s:a_s_HAMZA, s:a_s_BEH], + \[s:a_ALEF_MADDA, s:a_f_ALEF_MADDA, s:a_i_BEH], + \[s:a_ALEF_HAMZA_ABOVE, s:a_f_ALEF_HAMZA_ABOVE, s:a_i_BEH], + \[s:a_WAW_HAMZA, s:a_f_WAW_HAMZA, s:a_i_BEH], + \[s:a_ALEF_HAMZA_BELOW, s:a_f_ALEF_HAMZA_BELOW, s:a_i_BEH], + \[s:a_YEH_HAMZA, s:a_f_YEH_HAMZA, s:a_i_BEH], + \[s:a_ALEF, s:a_f_ALEF, s:a_i_BEH], + \[s:a_BEH, s:a_f_BEH, s:a_i_BEH], + \[s:a_TEH_MARBUTA, s:a_f_TEH_MARBUTA, s:a_i_BEH], + \[s:a_TEH, s:a_f_TEH, s:a_i_BEH], + \[s:a_THEH, s:a_f_THEH, s:a_i_BEH], + \[s:a_JEEM, s:a_f_JEEM, s:a_i_BEH], + \[s:a_HAH, s:a_f_HAH, s:a_i_BEH], + \[s:a_KHAH, s:a_f_KHAH, s:a_i_BEH], + \[s:a_DAL, s:a_f_DAL, s:a_i_BEH], + \[s:a_THAL, s:a_f_THAL, s:a_i_BEH], + \[s:a_REH, s:a_f_REH, s:a_i_BEH], + \[s:a_ZAIN, s:a_f_ZAIN, s:a_i_BEH], + \[s:a_SEEN, s:a_f_SEEN, s:a_i_BEH], + \[s:a_SHEEN, s:a_f_SHEEN, s:a_i_BEH], + \[s:a_SAD, s:a_f_SAD, s:a_i_BEH], + \[s:a_DAD, s:a_f_DAD, s:a_i_BEH], + \[s:a_TAH, s:a_f_TAH, s:a_i_BEH], + \[s:a_ZAH, s:a_f_ZAH, s:a_i_BEH], + \[s:a_AIN, s:a_f_AIN, s:a_i_BEH], + \[s:a_GHAIN, s:a_f_GHAIN, s:a_i_BEH], + \[s:a_TATWEEL, s:a_TATWEEL, s:a_i_BEH], + \[s:a_FEH, s:a_f_FEH, s:a_i_BEH], + \[s:a_QAF, s:a_f_QAF, s:a_i_BEH], + \[s:a_KAF, s:a_f_KAF, s:a_i_BEH], + \[s:a_LAM, s:a_f_LAM, s:a_i_BEH], + \[s:a_MEEM, s:a_f_MEEM, s:a_i_BEH], + \[s:a_NOON, s:a_f_NOON, s:a_i_BEH], + \[s:a_HEH, s:a_f_HEH, s:a_i_BEH], + \[s:a_WAW, s:a_f_WAW, s:a_i_BEH], + \[s:a_ALEF_MAKSURA, s:a_f_ALEF_MAKSURA, s:a_i_BEH], + \[s:a_YEH, s:a_f_YEH, s:a_i_BEH], + \ ] + call setline(1, ' ' . pair[0] . s:a_BEH) + call assert_equal([' ' . pair[1] . pair[2]], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_final_to_medial() + new + set arabicshape + + " Shaping arabic {testchar} arabic Tests chg_c_f2m(). + " This does not test much... + " pair[0] = testchar, pair[1] = current-result + for pair in [[s:a_f_YEH_HAMZA, s:a_f_BEH], + \[s:a_f_WAW_HAMZA, s:a_s_BEH], + \[s:a_f_ALEF, s:a_s_BEH], + \[s:a_f_TEH_MARBUTA, s:a_s_BEH], + \[s:a_f_DAL, s:a_s_BEH], + \[s:a_f_THAL, s:a_s_BEH], + \[s:a_f_REH, s:a_s_BEH], + \[s:a_f_ZAIN, s:a_s_BEH], + \[s:a_f_WAW, s:a_s_BEH], + \[s:a_f_ALEF_MAKSURA, s:a_s_BEH], + \[s:a_f_BEH, s:a_f_BEH], + \[s:a_f_TEH, s:a_f_BEH], + \[s:a_f_THEH, s:a_f_BEH], + \[s:a_f_JEEM, s:a_f_BEH], + \[s:a_f_HAH, s:a_f_BEH], + \[s:a_f_KHAH, s:a_f_BEH], + \[s:a_f_SEEN, s:a_f_BEH], + \[s:a_f_SHEEN, s:a_f_BEH], + \[s:a_f_SAD, s:a_f_BEH], + \[s:a_f_DAD, s:a_f_BEH], + \[s:a_f_TAH, s:a_f_BEH], + \[s:a_f_ZAH, s:a_f_BEH], + \[s:a_f_AIN, s:a_f_BEH], + \[s:a_f_GHAIN, s:a_f_BEH], + \[s:a_f_FEH, s:a_f_BEH], + \[s:a_f_QAF, s:a_f_BEH], + \[s:a_f_KAF, s:a_f_BEH], + \[s:a_f_LAM, s:a_f_BEH], + \[s:a_f_MEEM, s:a_f_BEH], + \[s:a_f_NOON, s:a_f_BEH], + \[s:a_f_HEH, s:a_f_BEH], + \[s:a_f_YEH, s:a_f_BEH], + \ ] + call setline(1, ' ' . s:a_BEH . pair[0]) + call assert_equal([' ' . pair[1] . pair[0]], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_combination_final() + new + set arabicshape + + " Shaping arabic {testchar} arabic Tests chg_c_laa2f(). + " pair[0] = testchar, pair[1] = current-result + for pair in [[s:a_ALEF_MADDA, s:a_f_LAM_ALEF_MADDA_ABOVE], + \ [s:a_ALEF_HAMZA_ABOVE, s:a_f_LAM_ALEF_HAMZA_ABOVE], + \ [s:a_ALEF_HAMZA_BELOW, s:a_f_LAM_ALEF_HAMZA_BELOW], + \ [s:a_ALEF, s:a_f_LAM_ALEF], + \ ] + " The test char is a composing char, put on s:a_LAM. + call setline(1, ' ' . s:a_LAM . pair[0] . s:a_BEH) + call assert_equal([' ' . pair[1] . s:a_i_BEH], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc + +func Test_shape_combination_isolated() + new + set arabicshape + + " Shaping arabic {testchar} arabic Tests chg_c_laa2i(). + " pair[0] = testchar, pair[1] = current-result + for pair in [[s:a_ALEF_MADDA, s:a_s_LAM_ALEF_MADDA_ABOVE], + \ [s:a_ALEF_HAMZA_ABOVE, s:a_s_LAM_ALEF_HAMZA_ABOVE], + \ [s:a_ALEF_HAMZA_BELOW, s:a_s_LAM_ALEF_HAMZA_BELOW], + \ [s:a_ALEF, s:a_s_LAM_ALEF], + \ ] + " The test char is a composing char, put on s:a_LAM. + call setline(1, ' ' . s:a_LAM . pair[0] . ' ') + call assert_equal([' ' . pair[1] . ' '], ScreenLines(1, 3)) + endfor + + set arabicshape& + bwipe! +endfunc diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim new file mode 100644 index 0000000000..87bda700d1 --- /dev/null +++ b/src/testdir/test_arglist.vim @@ -0,0 +1,395 @@ +" Test argument list commands + +func Test_argidx() + args a b c + last + call assert_equal(2, argidx()) + %argdelete + call assert_equal(0, argidx()) + " doing it again doesn't result in an error + %argdelete + call assert_equal(0, argidx()) + call assert_fails('2argdelete', 'E16:') + + args a b c + call assert_equal(0, argidx()) + next + call assert_equal(1, argidx()) + next + call assert_equal(2, argidx()) + 1argdelete + call assert_equal(1, argidx()) + 1argdelete + call assert_equal(0, argidx()) + 1argdelete + call assert_equal(0, argidx()) +endfunc + +func Test_argadd() + %argdelete + argadd a b c + call assert_equal(0, argidx()) + + %argdelete + argadd a + call assert_equal(0, argidx()) + argadd b c d + call assert_equal(0, argidx()) + + call Init_abc() + argadd x + call Assert_argc(['a', 'b', 'x', 'c']) + call assert_equal(1, argidx()) + + call Init_abc() + 0argadd x + call Assert_argc(['x', 'a', 'b', 'c']) + call assert_equal(2, argidx()) + + call Init_abc() + 1argadd x + call Assert_argc(['a', 'x', 'b', 'c']) + call assert_equal(2, argidx()) + + call Init_abc() + $argadd x + call Assert_argc(['a', 'b', 'c', 'x']) + call assert_equal(1, argidx()) + + call Init_abc() + $argadd x + +2argadd y + call Assert_argc(['a', 'b', 'c', 'x', 'y']) + call assert_equal(1, argidx()) + + %argd + edit d + arga + call assert_equal(1, len(argv())) + call assert_equal('d', get(argv(), 0, '')) + + %argd + edit some\ file + arga + call assert_equal(1, len(argv())) + call assert_equal('some file', get(argv(), 0, '')) + + %argd + new + arga + call assert_equal(0, len(argv())) +endfunc + +func Init_abc() + args a b c + next +endfunc + +func Assert_argc(l) + call assert_equal(len(a:l), argc()) + let i = 0 + while i < len(a:l) && i < argc() + call assert_equal(a:l[i], argv(i)) + let i += 1 + endwhile +endfunc + +" Test for [count]argument and [count]argdelete commands +" Ported from the test_argument_count.in test script +func Test_argument() + " Clean the argument list + arga a | %argd + + let save_hidden = &hidden + set hidden + + let g:buffers = [] + augroup TEST + au BufEnter * call add(buffers, expand('%:t')) + augroup END + + argadd a b c d + $argu + $-argu + -argu + 1argu + +2argu + + augroup TEST + au! + augroup END + + call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers) + + redir => result + args + redir END + call assert_equal('a b [c] d', trim(result)) + + .argd + call assert_equal(['a', 'b', 'd'], argv()) + + -argd + call assert_equal(['a', 'd'], argv()) + + $argd + call assert_equal(['a'], argv()) + + 1arga c + 1arga b + $argu + $arga x + call assert_equal(['a', 'b', 'c', 'x'], argv()) + + 0arga y + call assert_equal(['y', 'a', 'b', 'c', 'x'], argv()) + + %argd + call assert_equal([], argv()) + + arga a b c d e f + 2,$-argd + call assert_equal(['a', 'f'], argv()) + + let &hidden = save_hidden + + " Setting argument list should fail when the current buffer has unsaved + " changes + %argd + enew! + set modified + call assert_fails('args x y z', 'E37:') + args! x y z + call assert_equal(['x', 'y', 'z'], argv()) + call assert_equal('x', expand('%:t')) + + last | enew | argu + call assert_equal('z', expand('%:t')) + + %argdelete + call assert_fails('argument', 'E163:') +endfunc + +func Test_list_arguments() + " Clean the argument list + arga a | %argd + + " four args half the screen width makes two lines with two columns + let aarg = repeat('a', &columns / 2 - 4) + let barg = repeat('b', &columns / 2 - 4) + let carg = repeat('c', &columns / 2 - 4) + let darg = repeat('d', &columns / 2 - 4) + exe 'argadd ' aarg barg carg darg + + redir => result + args + redir END + call assert_match('\[' . aarg . '] \+' . carg . '\n' . barg . ' \+' . darg, trim(result)) + + " if one arg is longer than half the screen make one column + exe 'argdel' aarg + let aarg = repeat('a', &columns / 2 + 2) + exe '0argadd' aarg + redir => result + args + redir END + call assert_match(aarg . '\n\[' . barg . ']\n' . carg . '\n' . darg, trim(result)) + + %argdelete +endfunc + +" Test for 0argadd and 0argedit +" Ported from the test_argument_0count.in test script +func Test_zero_argadd() + " Clean the argument list + arga a | %argd + + arga a b c d + 2argu + 0arga added + call assert_equal(['added', 'a', 'b', 'c', 'd'], argv()) + + 2argu + arga third + call assert_equal(['added', 'a', 'third', 'b', 'c', 'd'], argv()) + + %argd + arga a b c d + 2argu + 0arge edited + call assert_equal(['edited', 'a', 'b', 'c', 'd'], argv()) + + 2argu + arga third + call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv()) + + 2argu + argedit file\ with\ spaces another file + call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv()) + call assert_equal('file with spaces', expand('%')) +endfunc + +func Reset_arglist() + args a | %argd +endfunc + +" Test for argc() +func Test_argc() + call Reset_arglist() + call assert_equal(0, argc()) + argadd a b + call assert_equal(2, argc()) +endfunc + +" Test for arglistid() +func Test_arglistid() + call Reset_arglist() + arga a b + call assert_equal(0, arglistid()) + split + arglocal + call assert_equal(1, arglistid()) + tabnew | tabfirst + call assert_equal(0, arglistid(2)) + call assert_equal(1, arglistid(1, 1)) + call assert_equal(0, arglistid(2, 1)) + call assert_equal(1, arglistid(1, 2)) + tabonly | only | enew! + argglobal + call assert_equal(0, arglistid()) +endfunc + +" Test for argv() +func Test_argv() + call Reset_arglist() + call assert_equal([], argv()) + call assert_equal("", argv(2)) + argadd a b c d + call assert_equal('c', argv(2)) +endfunc + +" Test for the :argedit command +func Test_argedit() + call Reset_arglist() + argedit a + call assert_equal(['a'], argv()) + call assert_equal('a', expand('%:t')) + argedit b + call assert_equal(['a', 'b'], argv()) + call assert_equal('b', expand('%:t')) + argedit a + call assert_equal(['a', 'b', 'a'], argv()) + call assert_equal('a', expand('%:t')) + " When file name case is ignored, an existing buffer with only case + " difference is re-used. + argedit C D + call assert_equal('C', expand('%:t')) + call assert_equal(['a', 'b', 'a', 'C', 'D'], argv()) + argedit c + if has('fname_case') + call assert_equal(['a', 'b', 'a', 'C', 'c', 'D'], argv()) + else + call assert_equal(['a', 'b', 'a', 'C', 'C', 'D'], argv()) + endif + 0argedit x + if has('fname_case') + call assert_equal(['x', 'a', 'b', 'a', 'C', 'c', 'D'], argv()) + else + call assert_equal(['x', 'a', 'b', 'a', 'C', 'C', 'D'], argv()) + endif + enew! | set modified + call assert_fails('argedit y', 'E37:') + argedit! y + if has('fname_case') + call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'c', 'D'], argv()) + else + call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'C', 'D'], argv()) + endif + %argd + bwipe! C + bwipe! D + + " :argedit reuses the current buffer if it is empty + %argd + " make sure to use a new buffer number for x when it is loaded + bw! x + new + let a = bufnr('') + argedit x + call assert_equal(a, bufnr('')) + call assert_equal('x', bufname('')) + %argd + bw! x +endfunc + +" Test for the :argdelete command +func Test_argdelete() + call Reset_arglist() + args aa a aaa b bb + argdelete a* + call assert_equal(['b', 'bb'], argv()) + call assert_equal('aa', expand('%:t')) + last + argdelete % + call assert_equal(['b'], argv()) + call assert_fails('argdelete', 'E471:') + call assert_fails('1,100argdelete', 'E16:') + %argd +endfunc + +" Tests for the :next, :prev, :first, :last, :rewind commands +func Test_argpos() + call Reset_arglist() + args a b c d + last + call assert_equal(3, argidx()) + call assert_fails('next', 'E165:') + prev + call assert_equal(2, argidx()) + Next + call assert_equal(1, argidx()) + first + call assert_equal(0, argidx()) + call assert_fails('prev', 'E164:') + 3next + call assert_equal(3, argidx()) + rewind + call assert_equal(0, argidx()) + %argd +endfunc + +" Test for autocommand that redefines the argument list, when doing ":all". +func Test_arglist_autocmd() + autocmd BufReadPost Xxx2 next Xxx2 Xxx1 + call writefile(['test file Xxx1'], 'Xxx1') + call writefile(['test file Xxx2'], 'Xxx2') + call writefile(['test file Xxx3'], 'Xxx3') + + new + " redefine arglist; go to Xxx1 + next! Xxx1 Xxx2 Xxx3 + " open window for all args + all + call assert_equal('test file Xxx1', getline(1)) + wincmd w + wincmd w + call assert_equal('test file Xxx1', getline(1)) + " should now be in Xxx2 + rewind + call assert_equal('test file Xxx2', getline(1)) + + autocmd! BufReadPost Xxx2 + enew! | only + call delete('Xxx1') + call delete('Xxx2') + call delete('Xxx3') + argdelete Xxx* + bwipe! Xxx1 Xxx2 Xxx3 +endfunc + +func Test_arg_all_expand() + call writefile(['test file Xxx1'], 'Xx x') + next notexist Xx\ x runtest.vim + call assert_equal('notexist Xx\ x runtest.vim', expand('##')) + call delete('Xx x') +endfunc diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim new file mode 100644 index 0000000000..28db289b2a --- /dev/null +++ b/src/testdir/test_assert.vim @@ -0,0 +1,206 @@ +" Test that the methods used for testing work. + +func Test_assert_false() + call assert_equal(0, assert_false(0)) + call assert_equal(0, assert_false(v:false)) + + call assert_equal(1, assert_false(123)) + call assert_match("Expected False but got 123", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_true() + call assert_equal(0, assert_true(1)) + call assert_equal(0, assert_true(123)) + call assert_equal(0, assert_true(v:true)) + + call assert_equal(1, assert_true(0)) + call assert_match("Expected True but got 0", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_equal() + let s = 'foo' + call assert_equal(0, assert_equal('foo', s)) + let n = 4 + call assert_equal(0, assert_equal(4, n)) + let l = [1, 2, 3] + call assert_equal(0, assert_equal([1, 2, 3], l)) + + let s = 'foo' + call assert_equal(1, assert_equal('bar', s)) + call assert_match("Expected 'bar' but got 'foo'", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_equalfile() + call assert_equal(1, assert_equalfile('abcabc', 'xyzxyz')) + call assert_match("E485: Can't read file abcabc", v:errors[0]) + call remove(v:errors, 0) + + let goodtext = ["one", "two", "three"] + call writefile(goodtext, 'Xone') + call assert_equal(1, assert_equalfile('Xone', 'xyzxyz')) + call assert_match("E485: Can't read file xyzxyz", v:errors[0]) + call remove(v:errors, 0) + + call writefile(goodtext, 'Xtwo') + call assert_equal(0, assert_equalfile('Xone', 'Xtwo')) + + call writefile([goodtext[0]], 'Xone') + call assert_equal(1, assert_equalfile('Xone', 'Xtwo')) + call assert_match("first file is shorter", v:errors[0]) + call remove(v:errors, 0) + + call writefile(goodtext, 'Xone') + call writefile([goodtext[0]], 'Xtwo') + call assert_equal(1, assert_equalfile('Xone', 'Xtwo')) + call assert_match("second file is shorter", v:errors[0]) + call remove(v:errors, 0) + + call writefile(['1234X89'], 'Xone') + call writefile(['1234Y89'], 'Xtwo') + call assert_equal(1, assert_equalfile('Xone', 'Xtwo')) + call assert_match("difference at byte 4", v:errors[0]) + call remove(v:errors, 0) + + call delete('Xone') + call delete('Xtwo') +endfunc + +func Test_assert_notequal() + let n = 4 + call assert_equal(0, assert_notequal('foo', n)) + let s = 'foo' + call assert_equal(0, assert_notequal([1, 2, 3], s)) + + call assert_equal(1, assert_notequal('foo', s)) + call assert_match("Expected not equal to 'foo'", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_report() + call assert_equal(1, assert_report('something is wrong')) + call assert_match('something is wrong', v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_exception() + try + nocommand + catch + call assert_equal(0, assert_exception('E492:')) + endtry + + try + nocommand + catch + try + " illegal argument, get NULL for error + call assert_equal(1, assert_exception([])) + catch + call assert_equal(0, assert_exception('E730:')) + endtry + endtry +endfunc + +func Test_wrong_error_type() + let save_verrors = v:errors + let v:['errors'] = {'foo': 3} + call assert_equal('yes', 'no') + let verrors = v:errors + let v:errors = save_verrors + call assert_equal(type([]), type(verrors)) +endfunc + +func Test_compare_fail() + let s:v = {} + let s:x = {"a": s:v} + let s:v["b"] = s:x + let s:w = {"c": s:x, "d": ''} + try + call assert_equal(s:w, '') + catch + call assert_equal(0, assert_exception('E724:')) + call assert_match("Expected NULL but got ''", v:errors[0]) + call remove(v:errors, 0) + endtry +endfunc + +func Test_match() + call assert_equal(0, assert_match('^f.*b.*r$', 'foobar')) + + call assert_equal(1, assert_match('bar.*foo', 'foobar')) + call assert_match("Pattern 'bar.*foo' does not match 'foobar'", v:errors[0]) + call remove(v:errors, 0) + + call assert_equal(1, assert_match('bar.*foo', 'foobar', 'wrong')) + call assert_match('wrong', v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_notmatch() + call assert_equal(0, assert_notmatch('foo', 'bar')) + call assert_equal(0, assert_notmatch('^foobar$', 'foobars')) + + call assert_equal(1, assert_notmatch('foo', 'foobar')) + call assert_match("Pattern 'foo' does match 'foobar'", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_fail_fails() + call assert_equal(1, assert_fails('xxx', {})) + call assert_match("Expected {} but got 'E731:", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_assert_beeps() + new + call assert_equal(0, assert_beeps('normal h')) + + call assert_equal(1, assert_beeps('normal 0')) + call assert_match("command did not beep: normal 0", v:errors[0]) + call remove(v:errors, 0) + bwipe +endfunc + +func Test_assert_inrange() + call assert_equal(0, assert_inrange(7, 7, 7)) + call assert_equal(0, assert_inrange(5, 7, 5)) + call assert_equal(0, assert_inrange(5, 7, 6)) + call assert_equal(0, assert_inrange(5, 7, 7)) + + call assert_equal(1, assert_inrange(5, 7, 4)) + call assert_match("Expected range 5 - 7, but got 4", v:errors[0]) + call remove(v:errors, 0) + call assert_equal(1, assert_inrange(5, 7, 8)) + call assert_match("Expected range 5 - 7, but got 8", v:errors[0]) + call remove(v:errors, 0) + + call assert_fails('call assert_inrange(1, 1)', 'E119:') +endfunc + +func Test_assert_with_msg() + call assert_equal('foo', 'bar', 'testing') + call assert_match("testing: Expected 'foo' but got 'bar'", v:errors[0]) + call remove(v:errors, 0) +endfunc + +func Test_override() + call test_override('char_avail', 1) + call test_override('redraw', 1) + call test_override('ALL', 0) + call assert_fails("call test_override('xxx', 1)", 'E475') + call assert_fails("call test_override('redraw', 'yes')", 'E474') +endfunc + +func Test_user_is_happy() + smile + sleep 300m +endfunc + +" Must be last. +func Test_zz_quit_detected() + " Verify that if a test function ends Vim the test script detects this. + quit +endfunc diff --git a/src/testdir/test_assign.vim b/src/testdir/test_assign.vim new file mode 100644 index 0000000000..317d45867f --- /dev/null +++ b/src/testdir/test_assign.vim @@ -0,0 +1,45 @@ +" Test for assignment + +func Test_no_type_checking() + let v = 1 + let v = [1,2,3] + let v = {'a': 1, 'b': 2} + let v = 3.4 + let v = 'hello' +endfunc + +func Test_let_termcap() + " Terminal code + let old_t_te = &t_te + let &t_te = "\<Esc>[yes;" + call assert_match('t_te.*^[[yes;', execute("set termcap")) + let &t_te = old_t_te + + if exists("+t_k1") + " Key code + let old_t_k1 = &t_k1 + let &t_k1 = "that" + call assert_match('t_k1.*that', execute("set termcap")) + let &t_k1 = old_t_k1 + endif + + call assert_fails('let x = &t_xx', 'E15') + let &t_xx = "yes" + call assert_equal("yes", &t_xx) + let &t_xx = "" + call assert_fails('let x = &t_xx', 'E15') +endfunc + +func Test_let_option_error() + let _w = &tw + let &tw = 80 + call assert_fails('let &tw .= 1', 'E734') + call assert_equal(80, &tw) + let &tw = _w + + let _w = &fillchars + let &fillchars = "vert:|" + call assert_fails('let &fillchars += "diff:-"', 'E734') + call assert_equal("vert:|", &fillchars) + let &fillchars = _w +endfunc diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim new file mode 100644 index 0000000000..05d69631c4 --- /dev/null +++ b/src/testdir/test_autochdir.vim @@ -0,0 +1,19 @@ +" Test 'autochdir' behavior + +if !exists("+autochdir") + finish +endif + +func Test_set_filename() + let cwd = getcwd() + call test_autochdir() + set acd + new + w samples/Xtest + call assert_equal("Xtest", expand('%')) + call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', '')) + bwipe! + set noacd + exe 'cd ' . cwd + call delete('samples/Xtest') +endfunc diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim new file mode 100644 index 0000000000..29ca283270 --- /dev/null +++ b/src/testdir/test_autocmd.vim @@ -0,0 +1,1335 @@ +" Tests for autocommands + +source shared.vim + +func! s:cleanup_buffers() abort + for bnr in range(1, bufnr('$')) + if bufloaded(bnr) && bufnr('%') != bnr + execute 'bd! ' . bnr + endif + endfor +endfunc + +func Test_vim_did_enter() + call assert_false(v:vim_did_enter) + + " This script will never reach the main loop, can't check if v:vim_did_enter + " becomes one. +endfunc + +if has('timers') + func ExitInsertMode(id) + call feedkeys("\<Esc>") + endfunc + + func Test_cursorhold_insert() + " Need to move the cursor. + call feedkeys("ggG", "xt") + + let g:triggered = 0 + au CursorHoldI * let g:triggered += 1 + set updatetime=20 + call timer_start(200, 'ExitInsertMode') + call feedkeys('a', 'x!') + call assert_equal(1, g:triggered) + au! CursorHoldI + set updatetime& + endfunc + + func Test_cursorhold_insert_ctrl_x() + let g:triggered = 0 + au CursorHoldI * let g:triggered += 1 + set updatetime=20 + call timer_start(200, 'ExitInsertMode') + " CursorHoldI does not trigger after CTRL-X + call feedkeys("a\<C-X>", 'x!') + call assert_equal(0, g:triggered) + au! CursorHoldI + set updatetime& + endfunc +endif + +func Test_bufunload() + augroup test_bufunload_group + autocmd! + autocmd BufUnload * call add(s:li, "bufunload") + autocmd BufDelete * call add(s:li, "bufdelete") + autocmd BufWipeout * call add(s:li, "bufwipeout") + augroup END + + let s:li=[] + new + setlocal bufhidden= + bunload + call assert_equal(["bufunload", "bufdelete"], s:li) + + let s:li=[] + new + setlocal bufhidden=delete + bunload + call assert_equal(["bufunload", "bufdelete"], s:li) + + let s:li=[] + new + setlocal bufhidden=unload + bwipeout + call assert_equal(["bufunload", "bufdelete", "bufwipeout"], s:li) + + au! test_bufunload_group + augroup! test_bufunload_group +endfunc + +" SEGV occurs in older versions. (At least 7.4.2005 or older) +func Test_autocmd_bufunload_with_tabnext() + tabedit + tabfirst + + augroup test_autocmd_bufunload_with_tabnext_group + autocmd! + autocmd BufUnload <buffer> tabnext + augroup END + + quit + call assert_equal(2, tabpagenr('$')) + + autocmd! test_autocmd_bufunload_with_tabnext_group + augroup! test_autocmd_bufunload_with_tabnext_group + tablast + quit +endfunc + +func Test_autocmd_bufwinleave_with_tabfirst() + tabedit + augroup sample + autocmd! + autocmd BufWinLeave <buffer> tabfirst + augroup END + call setline(1, ['a', 'b', 'c']) + edit! a.txt + tabclose +endfunc + +" SEGV occurs in older versions. (At least 7.4.2321 or older) +func Test_autocmd_bufunload_avoiding_SEGV_01() + split aa.txt + let lastbuf = bufnr('$') + + augroup test_autocmd_bufunload + autocmd! + exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!' + augroup END + + " Todo: check for E937 generated first + " call assert_fails('edit bb.txt', 'E937:') + call assert_fails('edit bb.txt', 'E517:') + + autocmd! test_autocmd_bufunload + augroup! test_autocmd_bufunload + bwipe! aa.txt + bwipe! bb.txt +endfunc + +" SEGV occurs in older versions. (At least 7.4.2321 or older) +func Test_autocmd_bufunload_avoiding_SEGV_02() + setlocal buftype=nowrite + let lastbuf = bufnr('$') + + augroup test_autocmd_bufunload + autocmd! + exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!' + augroup END + + normal! i1 + call assert_fails('edit a.txt', 'E517:') + call feedkeys("\<CR>") + + autocmd! test_autocmd_bufunload + augroup! test_autocmd_bufunload + bwipe! a.txt +endfunc + +func Test_win_tab_autocmd() + let g:record = [] + + augroup testing + au WinNew * call add(g:record, 'WinNew') + au WinEnter * call add(g:record, 'WinEnter') + au WinLeave * call add(g:record, 'WinLeave') + au TabNew * call add(g:record, 'TabNew') + au TabClosed * call add(g:record, 'TabClosed') + au TabEnter * call add(g:record, 'TabEnter') + au TabLeave * call add(g:record, 'TabLeave') + augroup END + + split + tabnew + close + close + + call assert_equal([ + \ 'WinLeave', 'WinNew', 'WinEnter', + \ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter', + \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter', + \ 'WinLeave', 'WinEnter' + \ ], g:record) + + let g:record = [] + tabnew somefile + tabnext + bwipe somefile + + call assert_equal([ + \ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter', + \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', + \ 'TabClosed' + \ ], g:record) + + augroup testing + au! + augroup END + unlet g:record +endfunc + +func s:AddAnAutocmd() + augroup vimBarTest + au BufReadCmd * echo 'hello' + augroup END + call assert_equal(3, len(split(execute('au vimBarTest'), "\n"))) +endfunc + +func Test_early_bar() + " test that a bar is recognized before the {event} + call s:AddAnAutocmd() + augroup vimBarTest | au! | augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + call s:AddAnAutocmd() + augroup vimBarTest| au!| augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + " test that a bar is recognized after the {event} + call s:AddAnAutocmd() + augroup vimBarTest| au!BufReadCmd| augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + " test that a bar is recognized after the {group} + call s:AddAnAutocmd() + au! vimBarTest|echo 'hello' + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) +endfunc + +func RemoveGroup() + autocmd! StartOK + augroup! StartOK +endfunc + +func Test_augroup_warning() + augroup TheWarning + au VimEnter * echo 'entering' + augroup END + call assert_true(match(execute('au VimEnter'), "TheWarning.*VimEnter") >= 0) + redir => res + augroup! TheWarning + redir END + call assert_true(match(res, "W19:") >= 0) + call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) + + " check "Another" does not take the pace of the deleted entry + augroup Another + augroup END + call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) + augroup! Another + + " no warning for postpone aucmd delete + augroup StartOK + au VimEnter * call RemoveGroup() + augroup END + call assert_true(match(execute('au VimEnter'), "StartOK.*VimEnter") >= 0) + redir => res + doautocmd VimEnter + redir END + call assert_true(match(res, "W19:") < 0) + au! VimEnter +endfunc + +func Test_BufReadCmdHelp() + " This used to cause access to free memory + au BufReadCmd * e +h + help + + au! BufReadCmd +endfunc + +func Test_BufReadCmdHelpJump() + " This used to cause access to free memory + au BufReadCmd * e +h{ + " } to fix highlighting + call assert_fails('help', 'E434:') + + au! BufReadCmd +endfunc + +func Test_augroup_deleted() + " This caused a crash before E936 was introduced + augroup x + call assert_fails('augroup! x', 'E936:') + au VimEnter * echo + augroup end + augroup! x + call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) + au! VimEnter +endfunc + +" Tests for autocommands on :close command. +" This used to be in test13. +func Test_three_windows() + " Clean up buffers, because in some cases this function fails. + call s:cleanup_buffers() + + " Write three files and open them, each in a window. + " Then go to next window, with autocommand that deletes the previous one. + " Do this twice, writing the file. + e! Xtestje1 + call setline(1, 'testje1') + w + sp Xtestje2 + call setline(1, 'testje2') + w + sp Xtestje3 + call setline(1, 'testje3') + w + wincmd w + au WinLeave Xtestje2 bwipe + wincmd w + call assert_equal('Xtestje1', expand('%')) + + au WinLeave Xtestje1 bwipe Xtestje3 + close + call assert_equal('Xtestje1', expand('%')) + + " Test deleting the buffer on a Unload event. If this goes wrong there + " will be the ATTENTION prompt. + e Xtestje1 + au! + au! BufUnload Xtestje1 bwipe + call assert_fails('e Xtestje3', 'E937:') + call assert_equal('Xtestje3', expand('%')) + + e Xtestje2 + sp Xtestje1 + call assert_fails('e', 'E937:') + call assert_equal('Xtestje1', expand('%')) + + " Test changing buffers in a BufWipeout autocommand. If this goes wrong + " there are ml_line errors and/or a Crash. + au! + only + e Xanother + e Xtestje1 + bwipe Xtestje2 + bwipe Xtestje3 + au BufWipeout Xtestje1 buf Xtestje1 + bwipe + call assert_equal('Xanother', expand('%')) + + only + help + wincmd w + 1quit + call assert_equal('Xanother', expand('%')) + + au! + enew + call delete('Xtestje1') + call delete('Xtestje2') + call delete('Xtestje3') +endfunc + +func Test_BufEnter() + au! BufEnter + au Bufenter * let val = val . '+' + let g:val = '' + split NewFile + call assert_equal('+', g:val) + bwipe! + call assert_equal('++', g:val) + + " Also get BufEnter when editing a directory + call mkdir('Xdir') + split Xdir + call assert_equal('+++', g:val) + + " On MS-Windows we can't edit the directory, make sure we wipe the right + " buffer. + bwipe! Xdir + + call delete('Xdir', 'd') + au! BufEnter +endfunc + +" Closing a window might cause an endless loop +" E814 for older Vims +func Test_autocmd_bufwipe_in_SessLoadPost() + edit Xtest + tabnew + file Xsomething + set noswapfile + mksession! + + let content = ['set nocp noswapfile', + \ 'let v:swapchoice="e"', + \ 'augroup test_autocmd_sessionload', + \ 'autocmd!', + \ 'autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"', + \ 'augroup END', + \ '', + \ 'func WriteErrors()', + \ ' call writefile([execute("messages")], "Xerrors")', + \ 'endfunc', + \ 'au VimLeave * call WriteErrors()', + \ ] + call writefile(content, 'Xvimrc') + call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') + let errors = join(readfile('Xerrors')) + call assert_match('E814', errors) + + set swapfile + for file in ['Session.vim', 'Xvimrc', 'Xerrors'] + call delete(file) + endfor +endfunc + +" SEGV occurs in older versions. +func Test_autocmd_bufwipe_in_SessLoadPost2() + tabnew + set noswapfile + mksession! + + let content = ['set nocp noswapfile', + \ 'function! DeleteInactiveBufs()', + \ ' tabfirst', + \ ' let tabblist = []', + \ ' for i in range(1, tabpagenr(''$''))', + \ ' call extend(tabblist, tabpagebuflist(i))', + \ ' endfor', + \ ' for b in range(1, bufnr(''$''))', + \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', + \ ' exec ''bwipeout '' . b', + \ ' endif', + \ ' endfor', + \ ' echomsg "SessionLoadPost DONE"', + \ 'endfunction', + \ 'au SessionLoadPost * call DeleteInactiveBufs()', + \ '', + \ 'func WriteErrors()', + \ ' call writefile([execute("messages")], "Xerrors")', + \ 'endfunc', + \ 'au VimLeave * call WriteErrors()', + \ ] + call writefile(content, 'Xvimrc') + call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') + let errors = join(readfile('Xerrors')) + " This probably only ever matches on unix. + call assert_notmatch('Caught deadly signal SEGV', errors) + call assert_match('SessionLoadPost DONE', errors) + + set swapfile + for file in ['Session.vim', 'Xvimrc', 'Xerrors'] + call delete(file) + endfor +endfunc + +func Test_empty_doau() + doau \| +endfunc + +func s:AutoCommandOptionSet(match) + let item = remove(g:options, 0) + let expected = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", item[0], item[1], item[2], item[3]) + let actual = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", a:match, v:option_old, v:option_new, v:option_type) + let g:opt = [expected, actual] + "call assert_equal(expected, actual) +endfunc + +func Test_OptionSet() + if !has("eval") || !has("autocmd") || !exists("+autochdir") + return + endif + + badd test_autocmd.vim + + call test_override('starting', 1) + set nocp + au OptionSet * :call s:AutoCommandOptionSet(expand("<amatch>")) + + " 1: Setting number option" + let g:options=[['number', 0, 1, 'global']] + set nu + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 2: Setting local number option" + let g:options=[['number', 1, 0, 'local']] + setlocal nonu + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 3: Setting global number option" + let g:options=[['number', 1, 0, 'global']] + setglobal nonu + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 4: Setting local autoindent option" + let g:options=[['autoindent', 0, 1, 'local']] + setlocal ai + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 5: Setting global autoindent option" + let g:options=[['autoindent', 0, 1, 'global']] + setglobal ai + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 6: Setting global autoindent option" + let g:options=[['autoindent', 1, 0, 'global']] + set ai! + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " Should not print anything, use :noa + " 7: don't trigger OptionSet" + let g:options=[['invalid', 1, 1, 'invalid']] + noa set nonu + call assert_equal([['invalid', 1, 1, 'invalid']], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 8: Setting several global list and number option" + let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']] + set list nu + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 9: don't trigger OptionSet" + let g:options=[['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']] + noa set nolist nonu + call assert_equal([['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 10: Setting global acd" + let g:options=[['autochdir', 0, 1, 'local']] + setlocal acd + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 11: Setting global autoread (also sets local value)" + let g:options=[['autoread', 0, 1, 'global']] + set ar + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 12: Setting local autoread" + let g:options=[['autoread', 1, 1, 'local']] + setlocal ar + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 13: Setting global autoread" + let g:options=[['autoread', 1, 0, 'global']] + setglobal invar + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 14: Setting option backspace through :let" + let g:options=[['backspace', '', 'eol,indent,start', 'global']] + let &bs="eol,indent,start" + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 15: Setting option backspace through setbufvar()" + let g:options=[['backup', 0, 1, 'local']] + " try twice, first time, shouldn't trigger because option name is invalid, + " second time, it should trigger + let bnum = bufnr('%') + call assert_fails("call setbufvar(bnum, '&l:bk', 1)", "E355") + " should trigger, use correct option name + call setbufvar(bnum, '&backup', 1) + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 16: Setting number option using setwinvar" + let g:options=[['number', 0, 1, 'local']] + call setwinvar(0, '&number', 1) + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 17: Setting key option, shouldn't trigger" + let g:options=[['key', 'invalid', 'invalid1', 'invalid']] + setlocal key=blah + setlocal key= + call assert_equal([['key', 'invalid', 'invalid1', 'invalid']], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 18: Setting string option" + let oldval = &tags + let g:options=[['tags', oldval, 'tagpath', 'global']] + set tags=tagpath + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " 1l: Resetting string option" + let g:options=[['tags', 'tagpath', oldval, 'global']] + set tags& + call assert_equal([], g:options) + call assert_equal(g:opt[0], g:opt[1]) + + " Cleanup + au! OptionSet + for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp'] + exe printf(":set %s&vi", opt) + endfor + call test_override('starting', 0) + delfunc! AutoCommandOptionSet +endfunc + +func Test_OptionSet_diffmode() + call test_override('starting', 1) + " 18: Changing an option when enetering diff mode + new + au OptionSet diff :let &l:cul=v:option_new + + call setline(1, ['buffer 1', 'line2', 'line3', 'line4']) + call assert_equal(0, &l:cul) + diffthis + call assert_equal(1, &l:cul) + + vnew + call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4']) + call assert_equal(0, &l:cul) + diffthis + call assert_equal(1, &l:cul) + + diffoff + call assert_equal(0, &l:cul) + call assert_equal(1, getwinvar(2, '&l:cul')) + bw! + + call assert_equal(1, &l:cul) + diffoff! + call assert_equal(0, &l:cul) + call assert_equal(0, getwinvar(1, '&l:cul')) + bw! + + " Cleanup + au! OptionSet + call test_override('starting', 0) +endfunc + +func Test_OptionSet_diffmode_close() + call test_override('starting', 1) + " 19: Try to close the current window when entering diff mode + " should not segfault + new + au OptionSet diff close + + call setline(1, ['buffer 1', 'line2', 'line3', 'line4']) + call assert_fails(':diffthis', 'E788') + call assert_equal(1, &diff) + vnew + call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4']) + call assert_fails(':diffthis', 'E788') + call assert_equal(1, &diff) + bw! + call assert_fails(':diffoff!', 'E788') + bw! + + " Cleanup + au! OptionSet + call test_override('starting', 0) + "delfunc! AutoCommandOptionSet +endfunc + +" Test for Bufleave autocommand that deletes the buffer we are about to edit. +func Test_BufleaveWithDelete() + new | edit Xfile1 + + augroup test_bufleavewithdelete + autocmd! + autocmd BufLeave Xfile1 bwipe Xfile2 + augroup END + + call assert_fails('edit Xfile2', 'E143:') + call assert_equal('Xfile1', bufname('%')) + + autocmd! test_bufleavewithdelete BufLeave Xfile1 + augroup! test_bufleavewithdelete + + new + bwipe! Xfile1 +endfunc + +" Test for autocommand that changes the buffer list, when doing ":ball". +func Test_Acmd_BufAll() + enew! + %bwipe! + call writefile(['Test file Xxx1'], 'Xxx1') + call writefile(['Test file Xxx2'], 'Xxx2') + call writefile(['Test file Xxx3'], 'Xxx3') + + " Add three files to the buffer list + split Xxx1 + close + split Xxx2 + close + split Xxx3 + close + + " Wipe the buffer when the buffer is opened + au BufReadPost Xxx2 bwipe + + call append(0, 'Test file Xxx4') + ball + + call assert_equal(2, winnr('$')) + call assert_equal('Xxx1', bufname(winbufnr(winnr('$')))) + wincmd t + + au! BufReadPost + %bwipe! + call delete('Xxx1') + call delete('Xxx2') + call delete('Xxx3') + enew! | only +endfunc + +" Test for autocommand that changes current buffer on BufEnter event. +" Check if modelines are interpreted for the correct buffer. +func Test_Acmd_BufEnter() + %bwipe! + call writefile(['start of test file Xxx1', + \ "\<Tab>this is a test", + \ 'end of test file Xxx1'], 'Xxx1') + call writefile(['start of test file Xxx2', + \ 'vim: set noai :', + \ "\<Tab>this is a test", + \ 'end of test file Xxx2'], 'Xxx2') + + au BufEnter Xxx2 brew + set ai modeline modelines=3 + edit Xxx1 + " edit Xxx2, autocmd will do :brew + edit Xxx2 + exe "normal G?this is a\<CR>" + " Append text with autoindent to this file + normal othis should be auto-indented + call assert_equal("\<Tab>this should be auto-indented", getline('.')) + call assert_equal(3, line('.')) + " Remove autocmd and edit Xxx2 again + au! BufEnter Xxx2 + buf! Xxx2 + exe "normal G?this is a\<CR>" + " append text without autoindent to Xxx + normal othis should be in column 1 + call assert_equal("this should be in column 1", getline('.')) + call assert_equal(4, line('.')) + + %bwipe! + call delete('Xxx1') + call delete('Xxx2') + set ai&vim modeline&vim modelines&vim +endfunc + +" Test for issue #57 +" do not move cursor on <c-o> when autoindent is set +func Test_ai_CTRL_O() + enew! + set ai + let save_fo = &fo + set fo+=r + exe "normal o# abcdef\<Esc>2hi\<CR>\<C-O>d0\<Esc>" + exe "normal o# abcdef\<Esc>2hi\<C-O>d0\<Esc>" + call assert_equal(['# abc', 'def', 'def'], getline(2, 4)) + + set ai&vim + let &fo = save_fo + enew! +endfunc + +" Test for autocommand that deletes the current buffer on BufLeave event. +" Also test deleting the last buffer, should give a new, empty buffer. +func Test_BufLeave_Wipe() + %bwipe! + let content = ['start of test file Xxx', + \ 'this is a test', + \ 'end of test file Xxx'] + call writefile(content, 'Xxx1') + call writefile(content, 'Xxx2') + + au BufLeave Xxx2 bwipe + edit Xxx1 + split Xxx2 + " delete buffer Xxx2, we should be back to Xxx1 + bwipe + call assert_equal('Xxx1', bufname('%')) + call assert_equal(1, winnr('$')) + + " Create an alternate buffer + %write! test.out + call assert_equal('test.out', bufname('#')) + " delete alternate buffer + bwipe test.out + call assert_equal('Xxx1', bufname('%')) + call assert_equal('', bufname('#')) + + au BufLeave Xxx1 bwipe + " delete current buffer, get an empty one + bwipe! + call assert_equal(1, line('$')) + call assert_equal('', bufname('%')) + let g:bufinfo = getbufinfo() + call assert_equal(1, len(g:bufinfo)) + + call delete('Xxx1') + call delete('Xxx2') + call delete('test.out') + %bwipe + au! BufLeave + + " check that bufinfo doesn't contain a pointer to freed memory + call test_garbagecollect_now() +endfunc + +func Test_QuitPre() + edit Xfoo + let winid = win_getid(winnr()) + split Xbar + au! QuitPre * let g:afile = expand('<afile>') + " Close the other window, <afile> should be correct. + exe win_id2win(winid) . 'q' + call assert_equal('Xfoo', g:afile) + + unlet g:afile + bwipe Xfoo + bwipe Xbar +endfunc + +func Test_Cmdline() + au! CmdlineChanged : let g:text = getcmdline() + let g:text = 0 + call feedkeys(":echom 'hello'\<CR>", 'xt') + call assert_equal("echom 'hello'", g:text) + au! CmdlineChanged + + au! CmdlineChanged : let g:entered = expand('<afile>') + let g:entered = 0 + call feedkeys(":echom 'hello'\<CR>", 'xt') + call assert_equal(':', g:entered) + au! CmdlineChanged + + au! CmdlineEnter : let g:entered = expand('<afile>') + au! CmdlineLeave : let g:left = expand('<afile>') + let g:entered = 0 + let g:left = 0 + call feedkeys(":echo 'hello'\<CR>", 'xt') + call assert_equal(':', g:entered) + call assert_equal(':', g:left) + au! CmdlineEnter + au! CmdlineLeave + + let save_shellslash = &shellslash + set noshellslash + au! CmdlineEnter / let g:entered = expand('<afile>') + au! CmdlineLeave / let g:left = expand('<afile>') + let g:entered = 0 + let g:left = 0 + new + call setline(1, 'hello') + call feedkeys("/hello\<CR>", 'xt') + call assert_equal('/', g:entered) + call assert_equal('/', g:left) + bwipe! + au! CmdlineEnter + au! CmdlineLeave + let &shellslash = save_shellslash +endfunc + +" Test for BufWritePre autocommand that deletes or unloads the buffer. +func Test_BufWritePre() + %bwipe + au BufWritePre Xxx1 bunload + au BufWritePre Xxx2 bwipe + + call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1') + call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2') + + edit Xtest + e! Xxx2 + bdel Xtest + e Xxx1 + " write it, will unload it and give an error msg + call assert_fails('w', 'E203') + call assert_equal('Xxx2', bufname('%')) + edit Xtest + e! Xxx2 + bwipe Xtest + " write it, will delete the buffer and give an error msg + call assert_fails('w', 'E203') + call assert_equal('Xxx1', bufname('%')) + au! BufWritePre + call delete('Xxx1') + call delete('Xxx2') +endfunc + +" Test for BufUnload autocommand that unloads all the other buffers +func Test_bufunload_all() + call writefile(['Test file Xxx1'], 'Xxx1')" + call writefile(['Test file Xxx2'], 'Xxx2')" + + let content = [ + \ "func UnloadAllBufs()", + \ " let i = 1", + \ " while i <= bufnr('$')", + \ " if i != bufnr('%') && bufloaded(i)", + \ " exe i . 'bunload'", + \ " endif", + \ " let i += 1", + \ " endwhile", + \ "endfunc", + \ "au BufUnload * call UnloadAllBufs()", + \ "au VimLeave * call writefile(['Test Finished'], 'Xout')", + \ "edit Xxx1", + \ "split Xxx2", + \ "q"] + call writefile(content, 'Xtest') + + call delete('Xout') + call system(v:progpath. ' --clean -N --not-a-term -S Xtest') + call assert_true(filereadable('Xout')) + + call delete('Xxx1') + call delete('Xxx2') + call delete('Xtest') + call delete('Xout') +endfunc + +" Some tests for buffer-local autocommands +func Test_buflocal_autocmd() + let g:bname = '' + edit xx + au BufLeave <buffer> let g:bname = expand("%") + " here, autocommand for xx should trigger. + " but autocommand shall not apply to buffer named <buffer>. + edit somefile + call assert_equal('xx', g:bname) + let g:bname = '' + " here, autocommand shall be auto-deleted + bwipe xx + " autocmd should not trigger + edit xx + call assert_equal('', g:bname) + " autocmd should not trigger + edit somefile + call assert_equal('', g:bname) + enew + unlet g:bname +endfunc + +" Test for "*Cmd" autocommands +func Test_Cmd_Autocmds() + call writefile(['start of Xxx', "\tabc2", 'end of Xxx'], 'Xxx') + + enew! + au BufReadCmd XtestA 0r Xxx|$del + edit XtestA " will read text of Xxd instead + call assert_equal('start of Xxx', getline(1)) + + au BufWriteCmd XtestA call append(line("$"), "write") + write " will append a line to the file + call assert_equal('write', getline('$')) + call assert_fails('read XtestA', 'E484') " should not read anything + call assert_equal('write', getline(4)) + + " now we have: + " 1 start of Xxx + " 2 abc2 + " 3 end of Xxx + " 4 write + + au FileReadCmd XtestB '[r Xxx + 2r XtestB " will read Xxx below line 2 instead + call assert_equal('start of Xxx', getline(3)) + + " now we have: + " 1 start of Xxx + " 2 abc2 + " 3 start of Xxx + " 4 abc2 + " 5 end of Xxx + " 6 end of Xxx + " 7 write + + au FileWriteCmd XtestC '[,']copy $ + normal 4GA1 + 4,5w XtestC " will copy lines 4 and 5 to the end + call assert_equal("\tabc21", getline(8)) + call assert_fails('r XtestC', 'E484') " should not read anything + call assert_equal("end of Xxx", getline(9)) + + " now we have: + " 1 start of Xxx + " 2 abc2 + " 3 start of Xxx + " 4 abc21 + " 5 end of Xxx + " 6 end of Xxx + " 7 write + " 8 abc21 + " 9 end of Xxx + + let g:lines = [] + au FileAppendCmd XtestD call extend(g:lines, getline(line("'["), line("']"))) + w >>XtestD " will add lines to 'lines' + call assert_equal(9, len(g:lines)) + call assert_fails('$r XtestD', 'E484') " should not read anything + call assert_equal(9, line('$')) + call assert_equal('end of Xxx', getline('$')) + + au BufReadCmd XtestE 0r Xxx|$del + sp XtestE " split window with test.out + call assert_equal('end of Xxx', getline(3)) + + let g:lines = [] + exe "normal 2Goasdf\<Esc>\<C-W>\<C-W>" + au BufWriteCmd XtestE call extend(g:lines, getline(0, '$')) + wall " will write other window to 'lines' + call assert_equal(4, len(g:lines), g:lines) + call assert_equal('asdf', g:lines[2]) + + au! BufReadCmd + au! BufWriteCmd + au! FileReadCmd + au! FileWriteCmd + au! FileAppendCmd + %bwipe! + call delete('Xxx') + enew! +endfunc + +func SetChangeMarks(start, end) + exe a:start. 'mark [' + exe a:end. 'mark ]' +endfunc + +" Verify the effects of autocmds on '[ and '] +func Test_change_mark_in_autocmds() + edit! Xtest + call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u", 'xtn') + + call SetChangeMarks(2, 3) + write + call assert_equal([1, 4], [line("'["), line("']")]) + + call SetChangeMarks(2, 3) + au BufWritePre * call assert_equal([1, 4], [line("'["), line("']")]) + write + au! BufWritePre + + if executable('cat') + write XtestFilter + write >> XtestFilter + + call SetChangeMarks(2, 3) + " Marks are set to the entire range of the write + au FilterWritePre * call assert_equal([1, 4], [line("'["), line("']")]) + " '[ is adjusted to just before the line that will receive the filtered + " data + au FilterReadPre * call assert_equal([4, 4], [line("'["), line("']")]) + " The filtered data is read into the buffer, and the source lines are + " still present, so the range is after the source lines + au FilterReadPost * call assert_equal([5, 12], [line("'["), line("']")]) + %!cat XtestFilter + " After the filtered data is read, the original lines are deleted + call assert_equal([1, 8], [line("'["), line("']")]) + au! FilterWritePre,FilterReadPre,FilterReadPost + undo + + call SetChangeMarks(1, 4) + au FilterWritePre * call assert_equal([2, 3], [line("'["), line("']")]) + au FilterReadPre * call assert_equal([3, 3], [line("'["), line("']")]) + au FilterReadPost * call assert_equal([4, 11], [line("'["), line("']")]) + 2,3!cat XtestFilter + call assert_equal([2, 9], [line("'["), line("']")]) + au! FilterWritePre,FilterReadPre,FilterReadPost + undo + + call delete('XtestFilter') + endif + + call SetChangeMarks(1, 4) + au FileWritePre * call assert_equal([2, 3], [line("'["), line("']")]) + 2,3write Xtest2 + au! FileWritePre + + call SetChangeMarks(2, 3) + au FileAppendPre * call assert_equal([1, 4], [line("'["), line("']")]) + write >> Xtest2 + au! FileAppendPre + + call SetChangeMarks(1, 4) + au FileAppendPre * call assert_equal([2, 3], [line("'["), line("']")]) + 2,3write >> Xtest2 + au! FileAppendPre + + call SetChangeMarks(1, 1) + au FileReadPre * call assert_equal([3, 1], [line("'["), line("']")]) + au FileReadPost * call assert_equal([4, 11], [line("'["), line("']")]) + 3read Xtest2 + au! FileReadPre,FileReadPost + undo + + call SetChangeMarks(4, 4) + " When the line is 0, it's adjusted to 1 + au FileReadPre * call assert_equal([1, 4], [line("'["), line("']")]) + au FileReadPost * call assert_equal([1, 8], [line("'["), line("']")]) + 0read Xtest2 + au! FileReadPre,FileReadPost + undo + + call SetChangeMarks(4, 4) + " When the line is 0, it's adjusted to 1 + au FileReadPre * call assert_equal([1, 4], [line("'["), line("']")]) + au FileReadPost * call assert_equal([2, 9], [line("'["), line("']")]) + 1read Xtest2 + au! FileReadPre,FileReadPost + undo + + bwipe! + call delete('Xtest') + call delete('Xtest2') +endfunc + +func Test_Filter_noshelltemp() + if !executable('cat') + return + endif + + enew! + call setline(1, ['a', 'b', 'c', 'd']) + + let shelltemp = &shelltemp + set shelltemp + + let g:filter_au = 0 + au FilterWritePre * let g:filter_au += 1 + au FilterReadPre * let g:filter_au += 1 + au FilterReadPost * let g:filter_au += 1 + %!cat + call assert_equal(3, g:filter_au) + + if has('filterpipe') + set noshelltemp + + let g:filter_au = 0 + au FilterWritePre * let g:filter_au += 1 + au FilterReadPre * let g:filter_au += 1 + au FilterReadPost * let g:filter_au += 1 + %!cat + call assert_equal(0, g:filter_au) + endif + + au! FilterWritePre,FilterReadPre,FilterReadPost + let &shelltemp = shelltemp + bwipe! +endfunc + +func Test_TextYankPost() + enew! + call setline(1, ['foo']) + + let g:event = [] + au TextYankPost * let g:event = copy(v:event) + + call assert_equal({}, v:event) + call assert_fails('let v:event = {}', 'E46:') + call assert_fails('let v:event.mykey = 0', 'E742:') + + norm "ayiw + call assert_equal( + \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v'}, + \g:event) + norm y_ + call assert_equal( + \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V'}, + \g:event) + call feedkeys("\<C-V>y", 'x') + call assert_equal( + \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161"}, + \g:event) + norm "xciwbar + call assert_equal( + \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v'}, + \g:event) + norm "bdiw + call assert_equal( + \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v'}, + \g:event) + + call assert_equal({}, v:event) + + au! TextYankPost + unlet g:event + bwipe! +endfunc + +func Test_nocatch_wipe_all_buffers() + " Real nasty autocommand: wipe all buffers on any event. + au * * bwipe * + " Get E93 first? + " call assert_fails('next x', 'E93:') + call assert_fails('next x', 'E517:') + bwipe + au! +endfunc + +func Test_nocatch_wipe_dummy_buffer() + " Nasty autocommand: wipe buffer on any event. + au * x bwipe + call assert_fails('lv½ /x', 'E480') + au! +endfunc + +function s:Before_test_dirchanged() + augroup test_dirchanged + autocmd! + augroup END + let s:li = [] + let s:dir_this = getcwd() + let s:dir_other = s:dir_this . '/foo' + call mkdir(s:dir_other) +endfunc + +function s:After_test_dirchanged() + exe 'cd' s:dir_this + call delete(s:dir_other, 'd') + augroup test_dirchanged + autocmd! + augroup END +endfunc + +function Test_dirchanged_global() + call s:Before_test_dirchanged() + autocmd test_dirchanged DirChanged global call add(s:li, "cd:") + autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>")) + exe 'cd' s:dir_other + call assert_equal(["cd:", s:dir_other], s:li) + exe 'lcd' s:dir_other + call assert_equal(["cd:", s:dir_other], s:li) + call s:After_test_dirchanged() +endfunc + +function Test_dirchanged_local() + call s:Before_test_dirchanged() + autocmd test_dirchanged DirChanged window call add(s:li, "lcd:") + autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>")) + exe 'cd' s:dir_other + call assert_equal([], s:li) + exe 'lcd' s:dir_other + call assert_equal(["lcd:", s:dir_other], s:li) + call s:After_test_dirchanged() +endfunc + +function Test_dirchanged_auto() + if !exists('+autochdir') + return + endif + call s:Before_test_dirchanged() + call test_autochdir() + autocmd test_dirchanged DirChanged auto call add(s:li, "auto:") + autocmd test_dirchanged DirChanged auto call add(s:li, expand("<afile>")) + set acd + exe 'cd ..' + call assert_equal([], s:li) + exe 'edit ' . s:dir_other . '/Xfile' + call assert_equal(s:dir_other, getcwd()) + call assert_equal(["auto:", s:dir_other], s:li) + set noacd + bwipe! + call s:After_test_dirchanged() +endfunc + +" Test TextChangedI and TextChangedP +func Test_ChangedP() + new + call setline(1, ['foo', 'bar', 'foobar']) + call test_override("char_avail", 1) + set complete=. completeopt=menuone + + func! TextChangedAutocmd(char) + let g:autocmd .= a:char + endfunc + + au! TextChanged <buffer> :call TextChangedAutocmd('N') + au! TextChangedI <buffer> :call TextChangedAutocmd('I') + au! TextChangedP <buffer> :call TextChangedAutocmd('P') + + call cursor(3, 1) + let g:autocmd = '' + call feedkeys("o\<esc>", 'tnix') + call assert_equal('I', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf", 'tnix') + call assert_equal('II', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\<C-N>", 'tnix') + call assert_equal('IIP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\<C-N>\<C-N>", 'tnix') + call assert_equal('IIPP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\<C-N>\<C-N>\<C-N>", 'tnix') + call assert_equal('IIPPP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\<C-N>\<C-N>\<C-N>\<C-N>", 'tnix') + call assert_equal('IIPPPP', g:autocmd) + + call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) + " TODO: how should it handle completeopt=noinsert,noselect? + + " CleanUp + call test_override("char_avail", 0) + au! TextChanged + au! TextChangedI + au! TextChangedP + delfu TextChangedAutocmd + unlet! g:autocmd + set complete&vim completeopt&vim + + bw! +endfunc + +func Test_Changed_FirstTime() + if !has('terminal') || has('gui_running') + return + endif + " Prepare file for TextChanged event. + call writefile([''], 'Xchanged.txt') + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) + call assert_equal('running', term_getstatus(buf)) + " Wait for the ruler (in the status line) to be shown. + call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))}) + " It's only adding autocmd, so that no event occurs. + call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>") + call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>") + call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) + call assert_equal([''], readfile('Xchanged.txt')) + + " clean up + call delete('Xchanged.txt') + bwipe! +endfunc diff --git a/src/testdir/test_autoformat_join.in b/src/testdir/test_autoformat_join.in deleted file mode 100644 index f1e1c868d3..0000000000 --- a/src/testdir/test_autoformat_join.in +++ /dev/null @@ -1,23 +0,0 @@ -Tests for setting the '[,'] marks when joining lines. - -STARTTEST -:so small.vim -:/^\t\t/ -0gqj -:let a=string(getpos("'[")).'/'.string(getpos("']")) -:/^This line/;'}-join -:let b=string(getpos("'[")).'/'.string(getpos("']")) -:$put ='First test: Start/End '.string(a) -:$put ='Second test: Start/End '.string(b) -:/^\t\t/,$wq! test.out -ENDTEST - - - O sodales, ludite, vos qui -attamen consulite per voster honur. Tua pulchra facies me fay planszer milies - -This line. -Should be joined with the next line -and with this line - -Results: diff --git a/src/testdir/test_autoformat_join.ok b/src/testdir/test_autoformat_join.ok deleted file mode 100644 index 3b1df79514..0000000000 --- a/src/testdir/test_autoformat_join.ok +++ /dev/null @@ -1,8 +0,0 @@ - O sodales, ludite, vos qui attamen consulite per voster honur. -Tua pulchra facies me fay planszer milies - -This line. Should be joined with the next line and with this line - -Results: -First test: Start/End '[0, 16, 1, 0]/[0, 17, 1, 0]' -Second test: Start/End '[0, 19, 11, 0]/[0, 19, 67, 0]' diff --git a/src/testdir/test_autoload.vim b/src/testdir/test_autoload.vim new file mode 100644 index 0000000000..7396c227c9 --- /dev/null +++ b/src/testdir/test_autoload.vim @@ -0,0 +1,17 @@ +" Tests for autoload + +set runtimepath=./sautest + +func Test_autoload_dict_func() + let g:loaded_foo_vim = 0 + let g:called_foo_bar_echo = 0 + call g:foo#bar.echo() + call assert_equal(1, g:loaded_foo_vim) + call assert_equal(1, g:called_foo_bar_echo) +endfunc + +func Test_source_autoload() + let g:loaded_sourced_vim = 0 + source sautest/autoload/sourced.vim + call assert_equal(1, g:loaded_sourced_vim) +endfunc diff --git a/src/testdir/test_backspace_opt.vim b/src/testdir/test_backspace_opt.vim new file mode 100644 index 0000000000..fd81f42b66 --- /dev/null +++ b/src/testdir/test_backspace_opt.vim @@ -0,0 +1,59 @@ +" Tests for 'backspace' settings + +:func Exec(expr) + let str='' + try + exec a:expr + catch /.*/ + let str=v:exception + endtry + return str +:endfunc + +func Test_backspace_option() + set backspace= + call assert_equal('', &backspace) + set backspace=indent + call assert_equal('indent', &backspace) + set backspace=eol + call assert_equal('eol', &backspace) + set backspace=start + call assert_equal('start', &backspace) + " Add the value + set backspace= + set backspace=indent + call assert_equal('indent', &backspace) + set backspace+=eol + call assert_equal('indent,eol', &backspace) + set backspace+=start + call assert_equal('indent,eol,start', &backspace) + " Delete the value + set backspace-=indent + call assert_equal('eol,start', &backspace) + set backspace-=start + call assert_equal('eol', &backspace) + set backspace-=eol + call assert_equal('', &backspace) + " Check the error + call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474')) + call assert_equal(0, match(Exec('set backspace+=def'), '.*E474')) + " NOTE: Vim doesn't check following error... + "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474')) + + " Check backwards compatibility with version 5.4 and earlier + set backspace=0 + call assert_equal('0', &backspace) + set backspace=1 + call assert_equal('1', &backspace) + set backspace=2 + call assert_equal('2', &backspace) + call assert_false(match(Exec('set backspace=3'), '.*E474')) + call assert_false(match(Exec('set backspace=10'), '.*E474')) + + " Cleared when 'compatible' is set + set compatible + call assert_equal('', &backspace) + set nocompatible viminfo+=nviminfo +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_blockedit.vim b/src/testdir/test_blockedit.vim new file mode 100644 index 0000000000..527224ccd2 --- /dev/null +++ b/src/testdir/test_blockedit.vim @@ -0,0 +1,33 @@ +" Test for block inserting +" +" TODO: rewrite test39.in into this new style test + +func Test_blockinsert_indent() + new + filetype plugin indent on + setlocal sw=2 et ft=vim + call setline(1, ['let a=[', ' ''eins'',', ' ''zwei'',', ' ''drei'']']) + call cursor(2, 3) + exe "norm! \<c-v>2jI\\ \<esc>" + call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'], + \ getline(1,'$')) + " reset to sane state + filetype off + bwipe! +endfunc + +func Test_blockinsert_delete() + new + let _bs = &bs + set bs=2 + call setline(1, ['case Arg is ', ' when Name_Async,', ' when Name_Num_Gangs,', 'end if;']) + exe "norm! ggjVj\<c-v>$o$A\<bs>\<esc>" + "call feedkeys("Vj\<c-v>$o$A\<bs>\<esc>", 'ti') + call assert_equal(["case Arg is ", " when Name_Async", " when Name_Num_Gangs,", "end if;"], + \ getline(1,'$')) + " reset to sane state + let &bs = _bs + bwipe! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in deleted file mode 100644 index 8f40e4f7e5..0000000000 --- a/src/testdir/test_breakindent.in +++ /dev/null @@ -1,79 +0,0 @@ -Test for breakindent - -STARTTEST -:so small.vim -:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\" -:set ts=4 sw=4 sts=4 breakindent -:fu! ScreenChar(width) -: let c='' -: for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.'), i)) -: endfor -: let c.="\n" -: for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.')+1, i)) -: endfor -: let c.="\n" -: for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.')+2, i)) -: endfor -: return c -:endfu -:fu DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line1 -: wincmd p -:endfu -:let g:test="Test 1: Simple breakindent" -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test="Test 2: Simple breakindent + sbr=>>" -:set sbr=>> -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test ="Test 3: Simple breakindent + briopt:sbr" -:set briopt=sbr,min:0 sbr=++ -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test ="Test 4: Simple breakindent + min width: 18" -:set sbr= briopt=min:18 -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test =" Test 5: Simple breakindent + shift by 2" -:set briopt=shift:2,min:0 -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test=" Test 6: Simple breakindent + shift by -1" -:set briopt=shift:-1,min:0 -:let line1=ScreenChar(8) -:call DoRecordScreen() -:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr" -:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 -:let line1=ScreenChar(10) -:call DoRecordScreen() -:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr" -:set briopt=shift:1,sbr,min:0 nu sbr=# list -:let line1=ScreenChar(10) -:call DoRecordScreen() -:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list" -:set briopt-=sbr -:let line1=ScreenChar(10) -:call DoRecordScreen() -:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n" -:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 -:let line1=ScreenChar(10) -:call DoRecordScreen() -:wincmd p -:let g:test="\n Test 11: strdisplaywidth when breakindent is on" -:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 -:let text=getline(2) "skip leading tab when calculating text width -:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times -:$put =g:test -:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/testdir/test_breakindent.ok b/src/testdir/test_breakindent.ok deleted file mode 100644 index 723cb25012..0000000000 --- a/src/testdir/test_breakindent.ok +++ /dev/null @@ -1,55 +0,0 @@ - - abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP - -Test 1: Simple breakindent - abcd - qrst - GHIJ - -Test 2: Simple breakindent + sbr=>> - abcd - >>qr - >>EF - -Test 3: Simple breakindent + briopt:sbr - abcd -++ qrst -++ GHIJ - -Test 4: Simple breakindent + min width: 18 - abcd - qrstuv - IJKLMN - - Test 5: Simple breakindent + shift by 2 - abcd - qr - EF - - Test 6: Simple breakindent + shift by -1 - abcd - qrstu - HIJKL - - Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr - 2 ab -? m -? x - - Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr - 2 ^Iabcd -# opq -# BCD - - Test 9: breakindent + shift by +1 + 'nu' + sbr=# list - 2 ^Iabcd - #op - #AB - - Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n - 2 ab -~ mn -~ yz - - Test 11: strdisplaywidth when breakindent is on -strdisplaywidth: 46 == calculated: 64 diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim new file mode 100644 index 0000000000..7deffbe452 --- /dev/null +++ b/src/testdir/test_breakindent.vim @@ -0,0 +1,298 @@ +" Test for breakindent +" +" Note: if you get strange failures when adding new tests, it might be that +" while the test is run, the breakindent cacheing gets in its way. +" It helps to change the tabstop setting and force a redraw (e.g. see +" Test_breakindent08()) +if !exists('+breakindent') + finish +endif + +source view_util.vim + +let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + +function s:screen_lines(lnum, width) abort + return ScreenLines([a:lnum, a:lnum + 2], a:width) +endfunction + +function! s:compare_lines(expect, actual) + call assert_equal(join(a:expect, "\n"), join(a:actual, "\n")) +endfunction + +function s:test_windows(...) + call NewWindow(10, 20) + setl ts=4 sw=4 sts=4 breakindent + put =s:input + exe get(a:000, 0, '') +endfunction + +function s:close_windows(...) + call CloseWindow() + exe get(a:000, 0, '') +endfunction + +function Test_breakindent01() + " simple breakindent test + call s:test_windows('setl briopt=min:0') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ " qrst", +\ " GHIJ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction + +function Test_breakindent02() + " simple breakindent test with showbreak set + call s:test_windows('setl briopt=min:0 sbr=>>') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ " >>qr", +\ " >>EF", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent03() + " simple breakindent test with showbreak set and briopt including sbr + call s:test_windows('setl briopt=sbr,min:0 sbr=++') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ "++ qrst", +\ "++ GHIJ", +\ ] + call s:compare_lines(expect, lines) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent04() + " breakindent set with min width 18 + call s:test_windows('setl sbr= briopt=min:18') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ " qrstuv", +\ " IJKLMN", +\ ] + call s:compare_lines(expect, lines) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent05() + " breakindent set and shift by 2 + call s:test_windows('setl briopt=shift:2,min:0') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ " qr", +\ " EF", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction + +function Test_breakindent06() + " breakindent set and shift by -1 + call s:test_windows('setl briopt=shift:-1,min:0') + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ " abcd", +\ " qrstu", +\ " HIJKL", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction + +function Test_breakindent07() + " breakindent set and shift by 1, Number set sbr=? and briopt:sbr + call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n') + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ab", +\ "? m", +\ "? x", +\ ] + call s:compare_lines(expect, lines) + " clean up + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent07a() + " breakindent set and shift by 1, Number set sbr=? and briopt:sbr + call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4') + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ab", +\ " ? m", +\ " ? x", +\ ] + call s:compare_lines(expect, lines) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent08() + " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr + call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4') + " make sure, cache is invalidated! + set ts=8 + redraw! + set ts=4 + redraw! + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ^Iabcd", +\ "# opq", +\ "# BCD", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent08a() + " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr + call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list') + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ^Iabcd", +\ " # opq", +\ " # BCD", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent09() + " breakindent set and shift by 1, Number and list set sbr=# + call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list') + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ^Iabcd", +\ " #op", +\ " #AB", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent10() + " breakindent set, Number set sbr=~ + call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0') + " make sure, cache is invalidated! + set ts=8 + redraw! + set ts=4 + redraw! + let lines=s:screen_lines(line('.'),10) + let expect=[ +\ " 2 ab", +\ "~ mn", +\ "~ yz", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent11() + " test strdisplaywidth() + call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4') + let text=getline(2) + let width = strlen(text[1:])+indent(2)+strlen(&sbr)*3 " text wraps 3 times + call assert_equal(width, strdisplaywidth(text)) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent12() + " test breakindent with long indent + let s:input="\t\t\t\t\t{" + call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>-') + let lines=s:screen_lines(2,16) + let expect=[ +\ " 2 >--->--->--->", +\ " ---{ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('set nuw=4 listchars=') +endfunction + +function Test_breakindent13() + let s:input="" + call s:test_windows('setl breakindent briopt=min:10 ts=8') + vert resize 20 + call setline(1, [" a\tb\tc\td\te", " z y x w v"]) + 1 + norm! fbgj"ayl + 2 + norm! fygj"byl + call assert_equal('d', @a) + call assert_equal('w', @b) + call s:close_windows() +endfunction + +function Test_breakindent14() + let s:input="" + call s:test_windows('setl breakindent briopt= ts=8') + vert resize 30 + norm! 3a1234567890 + norm! a abcde + exec "norm! 0\<C-V>tex" + let lines=s:screen_lines(line('.'),8) + let expect=[ +\ "e ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction + +function Test_breakindent15() + let s:input="" + call s:test_windows('setl breakindent briopt= ts=8 sw=8') + vert resize 30 + norm! 4a1234567890 + exe "normal! >>\<C-V>3f0x" + let lines=s:screen_lines(line('.'),20) + let expect=[ +\ " 1234567890 ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction + +function Test_breakindent16() + " Check that overlong lines are indented correctly. + let s:input="" + call s:test_windows('setl breakindent briopt=min:0 ts=4') + call setline(1, "\t".repeat("1234567890", 10)) + resize 6 + norm! 1gg$ + redraw! + let lines=s:screen_lines(1,10) + let expect=[ +\ " 789012", +\ " 345678", +\ " 901234", +\ ] + call s:compare_lines(expect, lines) + let lines=s:screen_lines(4,10) + let expect=[ +\ " 567890", +\ " 123456", +\ " 7890 ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunction diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim new file mode 100644 index 0000000000..1f83e8b776 --- /dev/null +++ b/src/testdir/test_bufline.vim @@ -0,0 +1,114 @@ +" Tests for setbufline(), getbufline(), appendbufline(), deletebufline() + +source shared.vim + +func Test_setbufline_getbufline() + new + let b = bufnr('%') + hide + call assert_equal(0, setbufline(b, 1, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal([], getbufline(b, 1, 2)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, setbufline(b, 5, ['x'])) + call assert_equal(1, setbufline(1234, 1, ['x'])) + call assert_equal(0, setbufline(b, 4, ['d', 'e'])) + call assert_equal(['c'], getbufline(b, 3)) + call assert_equal(['d'], getbufline(b, 4)) + call assert_equal(['e'], getbufline(b, 5)) + call assert_equal([], getbufline(b, 6)) + exe "bwipe! " . b +endfunc + +func Test_setbufline_getbufline_fold() + split Xtest + setlocal foldmethod=expr foldexpr=0 + let b = bufnr('%') + new + call assert_equal(0, setbufline(b, 1, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bwipe!" b + bwipe! +endfunc + +func Test_setbufline_getbufline_fold_tab() + split Xtest + setlocal foldmethod=expr foldexpr=0 + let b = bufnr('%') + tab new + call assert_equal(0, setbufline(b, 1, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bwipe!" b + bwipe! +endfunc + +func Test_setline_startup() + let cmd = GetVimCommand('Xscript') + if cmd == '' + return + endif + call writefile(['call setline(1, "Hello")', 'silent w Xtest', 'q!'], 'Xscript') + call system(cmd) + call assert_equal(['Hello'], readfile('Xtest')) + + call delete('Xscript') + call delete('Xtest') +endfunc + +func Test_appendbufline() + new + let b = bufnr('%') + hide + call assert_equal(0, appendbufline(b, 0, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal([], getbufline(b, 1, 2)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, appendbufline(b, 4, ['x'])) + call assert_equal(1, appendbufline(1234, 1, ['x'])) + call assert_equal(0, appendbufline(b, 3, ['d', 'e'])) + call assert_equal(['c'], getbufline(b, 3)) + call assert_equal(['d'], getbufline(b, 4)) + call assert_equal(['e'], getbufline(b, 5)) + call assert_equal([], getbufline(b, 6)) + exe "bwipe! " . b +endfunc + +func Test_deletebufline() + new + let b = bufnr('%') + call setline(1, ['aaa', 'bbb', 'ccc']) + hide + call assert_equal(0, deletebufline(b, 2)) + call assert_equal(['aaa', 'ccc'], getbufline(b, 1, 2)) + call assert_equal(0, deletebufline(b, 2, 8)) + call assert_equal(['aaa'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal(1, deletebufline(b, 1)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, deletebufline(b, 4)) + call assert_equal(0, deletebufline(b, 1)) + call assert_equal(['b', 'c'], getbufline(b, 1, 2)) + exe "bwipe! " . b +endfunc diff --git a/src/testdir/test_bufwintabinfo.vim b/src/testdir/test_bufwintabinfo.vim new file mode 100644 index 0000000000..31b4650025 --- /dev/null +++ b/src/testdir/test_bufwintabinfo.vim @@ -0,0 +1,122 @@ +" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions + +function Test_getbufwintabinfo() + edit Xtestfile1 + edit Xtestfile2 + let buflist = getbufinfo() + call assert_equal(2, len(buflist)) + call assert_match('Xtestfile1', buflist[0].name) + call assert_match('Xtestfile2', getbufinfo('Xtestfile2')[0].name) + call assert_equal([], getbufinfo(2016)) + edit Xtestfile1 + hide edit Xtestfile2 + hide enew + call assert_equal(3, len(getbufinfo({'bufloaded':1}))) + + set tabstop&vim + let b:editor = 'vim' + let l = getbufinfo('%') + call assert_equal(bufnr('%'), l[0].bufnr) + call assert_equal('vim', l[0].variables.editor) + call assert_notequal(-1, index(l[0].windows, bufwinid('%'))) + + " Test for getbufinfo() with 'bufmodified' + call assert_equal(0, len(getbufinfo({'bufmodified' : 1}))) + call setbufline('Xtestfile1', 1, ["Line1"]) + let l = getbufinfo({'bufmodified' : 1}) + call assert_equal(1, len(l)) + call assert_equal(bufnr('Xtestfile1'), l[0].bufnr) + + if has('signs') + call append(0, ['Linux', 'Windows', 'Mac']) + sign define Mark text=>> texthl=Search + exe "sign place 2 line=3 name=Mark buffer=" . bufnr('%') + let l = getbufinfo('%') + call assert_equal(2, l[0].signs[0].id) + call assert_equal(3, l[0].signs[0].lnum) + call assert_equal('Mark', l[0].signs[0].name) + sign unplace * + sign undefine Mark + enew! + endif + + only + let w1_id = win_getid() + new + let w2_id = win_getid() + tabnew | let w3_id = win_getid() + new | let w4_id = win_getid() + new | let w5_id = win_getid() + call setwinvar(0, 'signal', 'green') + tabfirst + let winlist = getwininfo() + call assert_equal(5, len(winlist)) + call assert_equal(winbufnr(2), winlist[1].bufnr) + call assert_equal(winheight(2), winlist[1].height) + call assert_equal(1, winlist[2].winnr) + call assert_equal(2, winlist[3].tabnr) + call assert_equal('green', winlist[2].variables.signal) + call assert_equal(winwidth(1), winlist[0].width) + call assert_equal(w4_id, winlist[3].winid) + let winfo = getwininfo(w5_id)[0] + call assert_equal(2, winfo.tabnr) + call assert_equal([], getwininfo(3)) + + call settabvar(1, 'space', 'build') + let tablist = gettabinfo() + call assert_equal(2, len(tablist)) + call assert_equal(3, len(tablist[1].windows)) + call assert_equal(2, tablist[1].tabnr) + call assert_equal('build', tablist[0].variables.space) + call assert_equal(w2_id, tablist[0].windows[0]) + call assert_equal([], gettabinfo(3)) + + tabonly | only + + lexpr '' + lopen + copen + let winlist = getwininfo() + call assert_false(winlist[0].quickfix) + call assert_false(winlist[0].loclist) + call assert_true(winlist[1].quickfix) + call assert_true(winlist[1].loclist) + call assert_true(winlist[2].quickfix) + call assert_false(winlist[2].loclist) + wincmd t | only +endfunction + +function Test_get_buf_options() + let opts = getbufvar(bufnr('%'), '&') + call assert_equal(v:t_dict, type(opts)) + call assert_equal(8, opts.tabstop) +endfunc + +function Test_get_win_options() + if has('folding') + set foldlevel=999 + endif + set list + let opts = getwinvar(1, '&') + call assert_equal(v:t_dict, type(opts)) + call assert_equal(0, opts.linebreak) + call assert_equal(1, opts.list) + if has('folding') + call assert_equal(999, opts.foldlevel) + endif + if has('signs') + call assert_equal('auto', opts.signcolumn) + endif + + let opts = gettabwinvar(1, 1, '&') + call assert_equal(v:t_dict, type(opts)) + call assert_equal(0, opts.linebreak) + call assert_equal(1, opts.list) + if has('signs') + call assert_equal('auto', opts.signcolumn) + endif + set list& + if has('folding') + set foldlevel=0 + endif +endfunc diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim new file mode 100644 index 0000000000..e573419bd0 --- /dev/null +++ b/src/testdir/test_cd.vim @@ -0,0 +1,13 @@ +" Test for :cd + +func Test_cd_large_path() + " This used to crash with a heap write overflow. + call assert_fails('cd ' . repeat('x', 5000), 'E472:') +endfunc + +func Test_cd_up_and_down() + let path = getcwd() + cd .. + exe 'cd ' . path + call assert_equal(path, getcwd()) +endfunc diff --git a/src/testdir/test_cdo.vim b/src/testdir/test_cdo.vim new file mode 100644 index 0000000000..988de1dd26 --- /dev/null +++ b/src/testdir/test_cdo.vim @@ -0,0 +1,205 @@ +" Tests for the :cdo, :cfdo, :ldo and :lfdo commands + +if !has('quickfix') + finish +endif + +" Create the files used by the tests +function SetUp() + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') +endfunction + +" Remove the files used by the tests +function TearDown() + call delete('Xtestfile1') + call delete('Xtestfile2') + call delete('Xtestfile3') +endfunction + +" Returns the current line in '<filename> <linenum>L <column>C' format +function GetRuler() + return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' +endfunction + +" Tests for the :cdo and :ldo commands +function XdoTests(cchar) + enew + + " Shortcuts for calling the cdo and ldo commands + let Xdo = a:cchar . 'do' + let Xgetexpr = a:cchar . 'getexpr' + let Xprev = a:cchar. 'prev' + let XdoCmd = Xdo . ' call add(l, GetRuler())' + + " Try with an empty list + let l = [] + exe XdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Run command only on selected error lines + let l = [] + enew + exe "2,3" . XdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Boundary condition tests + let l = [] + enew + exe "1,1" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C'], l) + + let l = [] + enew + exe "3" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Range test commands + let l = [] + enew + exe "%" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe "1,$" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe Xprev + exe "." . XdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + let l = [] + enew + exe "+" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Invalid error lines test + let l = [] + enew + exe "silent! 27" . XdoCmd + exe "silent! 4,5" . XdoCmd + call assert_equal([], l) + + " Run commands from an unsaved buffer + let v:errmsg='' + let l = [] + enew + setlocal modified + exe "silent! 2,2" . XdoCmd + if v:errmsg !~# 'No write since last change' + call add(v:errors, 'Unsaved file change test failed') + endif + + " If the executed command fails, then the operation should be aborted + enew! + let subst_count = 0 + exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1" + if subst_count != 1 || getline('.') != 'xLine1' + call add(v:errors, 'Abort command on error test failed') + endif + + let l = [] + exe "2,2" . Xdo . "! call add(l, GetRuler())" + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with no valid error entries + let l = [] + edit! +2 Xtestfile1 + exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']" + exe XdoCmd + call assert_equal([], l) + exe "silent! 2" . XdoCmd + call assert_equal([], l) + let v:errmsg='' + exe "%" . XdoCmd + exe "1,$" . XdoCmd + exe "." . XdoCmd + call assert_equal('', v:errmsg) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile3:3:1:Line3']" + exe XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + +endfunction + +" Tests for the :cfdo and :lfdo commands +function XfdoTests(cchar) + enew + + " Shortcuts for calling the cfdo and lfdo commands + let Xfdo = a:cchar . 'fdo' + let Xgetexpr = a:cchar . 'getexpr' + let XfdoCmd = Xfdo . ' call add(l, GetRuler())' + let Xpfile = a:cchar. 'pfile' + + " Clear the quickfix/location list + exe Xgetexpr . " []" + + " Try with an empty list + let l = [] + exe XfdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Run command only on selected error lines + let l = [] + exe "2,3" . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Boundary condition tests + let l = [] + exe "3" . XfdoCmd + call assert_equal(['Xtestfile3 2L 3C'], l) + + " Range test commands + let l = [] + exe "%" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe "1,$" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe Xpfile + exe "." . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile2:2:5:Line2']" + exe XfdoCmd + call assert_equal(['Xtestfile2 2L 5C'], l) + +endfunction + +" Tests for cdo and cfdo +function Test_cdo() + call XdoTests('c') + call XfdoTests('c') +endfunction + +" Tests for ldo and lfdo +function Test_ldo() + call XdoTests('l') + call XfdoTests('l') +endfunction diff --git a/src/testdir/test_changedtick.vim b/src/testdir/test_changedtick.vim new file mode 100644 index 0000000000..3a91bb54aa --- /dev/null +++ b/src/testdir/test_changedtick.vim @@ -0,0 +1,57 @@ +" Tests for b:changedtick + +func Test_changedtick_increments() + new + " New buffer has an empty line, tick starts at 2. + let expected = 2 + call assert_equal(expected, b:changedtick) + call assert_equal(expected, b:['changedtick']) + call setline(1, 'hello') + let expected += 1 + call assert_equal(expected, b:changedtick) + call assert_equal(expected, b:['changedtick']) + undo + " Somehow undo counts as two changes. + let expected += 2 + call assert_equal(expected, b:changedtick) + call assert_equal(expected, b:['changedtick']) + bwipe! +endfunc + +func Test_changedtick_dict_entry() + let d = b: + call assert_equal(b:changedtick, d['changedtick']) +endfunc + +func Test_changedtick_bdel() + new + let bnr = bufnr('%') + let v = b:changedtick + bdel + " Delete counts as a change too. + call assert_equal(v + 1, getbufvar(bnr, 'changedtick')) +endfunc + +func Test_changedtick_islocked() + call assert_equal(0, islocked('b:changedtick')) + let d = b: + call assert_equal(0, islocked('d.changedtick')) +endfunc + +func Test_changedtick_fixed() + call assert_fails('let b:changedtick = 4', 'E46:') + call assert_fails('let b:["changedtick"] = 4', 'E46:') + + call assert_fails('lockvar b:changedtick', 'E940:') + call assert_fails('lockvar b:["changedtick"]', 'E46:') + call assert_fails('unlockvar b:changedtick', 'E940:') + call assert_fails('unlockvar b:["changedtick"]', 'E46:') + call assert_fails('unlet b:changedtick', 'E795:') + call assert_fails('unlet b:["changedtick"]', 'E46:') + + let d = b: + call assert_fails('lockvar d["changedtick"]', 'E46:') + call assert_fails('unlockvar d["changedtick"]', 'E46:') + call assert_fails('unlet d["changedtick"]', 'E46:') + +endfunc diff --git a/src/testdir/test_changelist.vim b/src/testdir/test_changelist.vim new file mode 100644 index 0000000000..dd6ea9600c --- /dev/null +++ b/src/testdir/test_changelist.vim @@ -0,0 +1,48 @@ +" Tests for the changelist functionality + +" Tests for the getchangelist() function +func Test_getchangelist() + if !has("jumplist") + return + endif + + bwipe! + enew + call assert_equal([], getchangelist(10)) + call assert_equal([[], 0], getchangelist('%')) + + call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt') + call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt') + + edit Xfile1.txt + exe "normal 1Goline\<C-G>u1.1" + exe "normal 3Goline\<C-G>u2.1" + exe "normal 5Goline\<C-G>u3.1" + normal g; + call assert_equal([[ + \ {'lnum' : 2, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 4, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 2], + \ getchangelist('%')) + + hide edit Xfile2.txt + exe "normal 1GOline\<C-G>u1.0" + exe "normal 2Goline\<C-G>u2.0" + call assert_equal([[ + \ {'lnum' : 1, 'col' : 6, 'coladd' : 0}, + \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], + \ getchangelist('%')) + hide enew + + call assert_equal([[ + \ {'lnum' : 2, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 4, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 3], getchangelist(2)) + call assert_equal([[ + \ {'lnum' : 1, 'col' : 6, 'coladd' : 0}, + \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], getchangelist(3)) + + bwipe! + call delete('Xfile1.txt') + call delete('Xfile2.txt') +endfunc diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py new file mode 100644 index 0000000000..899263acbf --- /dev/null +++ b/src/testdir/test_channel.py @@ -0,0 +1,270 @@ +#!/usr/bin/python +# +# Server that will accept connections from a Vim channel. +# Used by test_channel.vim. +# +# This requires Python 2.6 or later. + +from __future__ import print_function +import json +import socket +import sys +import time +import threading + +try: + # Python 3 + import socketserver +except ImportError: + # Python 2 + import SocketServer as socketserver + +class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): + + def handle(self): + print("=== socket opened ===") + while True: + try: + received = self.request.recv(4096).decode('utf-8') + except socket.error: + print("=== socket error ===") + break + except IOError: + print("=== socket closed ===") + break + if received == '': + print("=== socket closed ===") + break + print("received: {0}".format(received)) + + # We may receive two messages at once. Take the part up to the + # newline, which should be after the matching "]". + todo = received + while todo != '': + splitidx = todo.find('\n') + if splitidx < 0: + used = todo + todo = '' + else: + used = todo[:splitidx] + todo = todo[splitidx + 1:] + if used != received: + print("using: {0}".format(used)) + + try: + decoded = json.loads(used) + except ValueError: + print("json decoding failed") + decoded = [-1, ''] + + # Send a response if the sequence number is positive. + if decoded[0] >= 0: + if decoded[1] == 'hello!': + # simply send back a string + response = "got it" + elif decoded[1] == 'malformed1': + cmd = '["ex",":"]wrong!["ex","smi"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise it + # sometimes fails on OS X. + time.sleep(0.2) + elif decoded[1] == 'malformed2': + cmd = '"unterminated string' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the double + # quote in the "ok" response terminates the string. + time.sleep(0.2) + elif decoded[1] == 'malformed3': + cmd = '["ex","missing ]"' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the ] + # in the "ok" response terminates the list. + time.sleep(0.2) + elif decoded[1] == 'split': + cmd = '["ex","let ' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + time.sleep(0.01) + cmd = 'g:split = 123"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1].startswith("echo "): + # send back the argument + response = decoded[1][5:] + time.sleep(0.01) + elif decoded[1] == 'make change': + # Send two ex commands at the same time, before + # replying to the request. + cmd = '["ex","call append(\\"$\\",\\"added1\\")"]' + cmd += '["ex","call append(\\"$\\",\\"added2\\")"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'bad command': + cmd = '["ex","foo bar"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'do normal': + # Send a normal command. + cmd = '["normal","G$s more\u001b"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-works': + # Send an eval request. We ignore the response. + cmd = '["expr","\\"foo\\" . 123", -1]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-special': + # Send an eval request. We ignore the response. + cmd = '["expr","\\"foo\x7f\x10\x01bar\\"", -2]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-getline': + # Send an eval request. We ignore the response. + cmd = '["expr","getline(3)", -3]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-fails': + # Send an eval request that will fail. + cmd = '["expr","xxx", -4]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-error': + # Send an eval request that works but the result can't + # be encoded. + cmd = '["expr","function(\\"tr\\")", -5]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-bad': + # Send an eval request missing the third argument. + cmd = '["expr","xxx"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'an expr': + # Send an expr request. + cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'call-func': + cmd = '["call","MyFunction",[1,2,3], 0]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'redraw': + cmd = '["redraw",""]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'redraw!': + cmd = '["redraw","force"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'empty-request': + cmd = '[]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'eval-result': + # Send back the last received eval result. + response = last_eval + elif decoded[1] == 'call me': + cmd = '[0,"we called you"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'call me again': + cmd = '[0,"we did call you"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "" + elif decoded[1] == 'send zero': + cmd = '[0,"zero index"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "sent zero" + elif decoded[1] == 'close me': + print("closing") + self.request.close() + response = "" + elif decoded[1] == 'wait a bit': + time.sleep(0.2) + response = "waited" + elif decoded[1] == '!quit!': + # we're done + self.server.shutdown() + return + elif decoded[1] == '!crash!': + # Crash! + 42 / 0 + else: + response = "what?" + + if response == "": + print("no response") + else: + encoded = json.dumps([decoded[0], response]) + print("sending: {0}".format(encoded)) + self.request.sendall(encoded.encode('utf-8')) + + # Negative numbers are used for "eval" responses. + elif decoded[0] < 0: + last_eval = decoded + +class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + pass + +def writePortInFile(port): + # Write the port number in Xportnr, so that the test knows it. + f = open("Xportnr", "w") + f.write("{0}".format(port)) + f.close() + +if __name__ == "__main__": + HOST, PORT = "localhost", 0 + + # Wait half a second before opening the port to test waittime in ch_open(). + # We do want to get the port number, get that first. We cannot open the + # socket, guess a port is free. + if len(sys.argv) >= 2 and sys.argv[1] == 'delay': + PORT = 13684 + writePortInFile(PORT) + + print("Wait for it...") + time.sleep(0.5) + + server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) + ip, port = server.server_address + + # Start a thread with the server. That thread will then start a new thread + # for each connection. + server_thread = threading.Thread(target=server.serve_forever) + server_thread.start() + + writePortInFile(port) + + print("Listening on port {0}".format(port)) + + # Main thread terminates, but the server continues running + # until server.shutdown() is called. + try: + while server_thread.isAlive(): + server_thread.join(1) + except (KeyboardInterrupt, SystemExit): + server.shutdown() diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim new file mode 100644 index 0000000000..371afc7997 --- /dev/null +++ b/src/testdir/test_channel.vim @@ -0,0 +1,1825 @@ +" Test for channel functions. + +if !has('channel') + finish +endif + +source shared.vim + +let s:python = PythonProg() +if s:python == '' + " Can't run this test without Python. + finish +endif + +" Uncomment the next line to see what happens. Output is in +" src/testdir/channellog. +" call ch_logfile('channellog', 'w') + +let s:chopt = {} + +" Run "testfunc" after sarting the server and stop the server afterwards. +func s:run_server(testfunc, ...) + call RunServer('test_channel.py', a:testfunc, a:000) +endfunc + +" Return a list of open files. +" Can be used to make sure no resources leaked. +" Returns an empty list on systems where this is not supported. +func s:get_resources() + let pid = getpid() + + if has('mac') + return systemlist('lsof -p ' . pid . ' | awk ''$4~/^[0-9]*[rwu]$/&&$5=="REG"{print$NF}''') + elseif isdirectory('/proc/' . pid . '/fd/') + return systemlist('readlink /proc/' . pid . '/fd/* | grep -v ''^/dev/''') + else + return [] + endif +endfunc + +let g:Ch_responseMsg = '' +func Ch_requestHandler(handle, msg) + let g:Ch_responseHandle = a:handle + let g:Ch_responseMsg = a:msg +endfunc + +func Ch_communicate(port) + " Avoid dropping messages, since we don't use a callback here. + let s:chopt.drop = 'never' + let handle = ch_open('localhost:' . a:port, s:chopt) + unlet s:chopt.drop + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + if has('job') + " check that getjob without a job is handled correctly + call assert_equal('no process', string(ch_getjob(handle))) + endif + let dict = ch_info(handle) + call assert_true(dict.id != 0) + call assert_equal('open', dict.status) + call assert_equal(a:port, string(dict.port)) + call assert_equal('open', dict.sock_status) + call assert_equal('socket', dict.sock_io) + + " Simple string request and reply. + call assert_equal('got it', ch_evalexpr(handle, 'hello!')) + + " Malformed command should be ignored. + call assert_equal('ok', ch_evalexpr(handle, 'malformed1')) + call assert_equal('ok', ch_evalexpr(handle, 'malformed2')) + call assert_equal('ok', ch_evalexpr(handle, 'malformed3')) + + " split command should work + call assert_equal('ok', ch_evalexpr(handle, 'split')) + call WaitFor('exists("g:split")') + call assert_equal(123, g:split) + + " string with ][ should work + call assert_equal('this][that', ch_evalexpr(handle, 'echo this][that')) + + " nothing to read now + call assert_equal(0, ch_canread(handle)) + + " sending three messages quickly then reading should work + for i in range(3) + call ch_sendexpr(handle, 'echo hello ' . i) + endfor + call assert_equal('hello 0', ch_read(handle)[1]) + call assert_equal('hello 1', ch_read(handle)[1]) + call assert_equal('hello 2', ch_read(handle)[1]) + + " Request that triggers sending two ex commands. These will usually be + " handled before getting the response, but it's not guaranteed, thus wait a + " tiny bit for the commands to get executed. + call assert_equal('ok', ch_evalexpr(handle, 'make change')) + call WaitForAssert({-> assert_equal("added2", getline("$"))}) + call assert_equal('added1', getline(line('$') - 1)) + + " Request command "foo bar", which fails silently. + call assert_equal('ok', ch_evalexpr(handle, 'bad command')) + call WaitForAssert({-> assert_match("E492:.*foo bar", v:errmsg)}) + + call assert_equal('ok', ch_evalexpr(handle, 'do normal', {'timeout': 100})) + call WaitForAssert({-> assert_equal('added more', getline('$'))}) + + " Send a request with a specific handler. + call ch_sendexpr(handle, 'hello!', {'callback': 'Ch_requestHandler'}) + call WaitFor('exists("g:Ch_responseHandle")') + if !exists('g:Ch_responseHandle') + call assert_report('g:Ch_responseHandle was not set') + else + call assert_equal(handle, g:Ch_responseHandle) + unlet g:Ch_responseHandle + endif + call assert_equal('got it', g:Ch_responseMsg) + + let g:Ch_responseMsg = '' + call ch_sendexpr(handle, 'hello!', {'callback': function('Ch_requestHandler')}) + call WaitFor('exists("g:Ch_responseHandle")') + if !exists('g:Ch_responseHandle') + call assert_report('g:Ch_responseHandle was not set') + else + call assert_equal(handle, g:Ch_responseHandle) + unlet g:Ch_responseHandle + endif + call assert_equal('got it', g:Ch_responseMsg) + + " Using lambda. + let g:Ch_responseMsg = '' + call ch_sendexpr(handle, 'hello!', {'callback': {a, b -> Ch_requestHandler(a, b)}}) + call WaitFor('exists("g:Ch_responseHandle")') + if !exists('g:Ch_responseHandle') + call assert_report('g:Ch_responseHandle was not set') + else + call assert_equal(handle, g:Ch_responseHandle) + unlet g:Ch_responseHandle + endif + call assert_equal('got it', g:Ch_responseMsg) + + " Collect garbage, tests that our handle isn't collected. + call test_garbagecollect_now() + + " check setting options (without testing the effect) + call ch_setoptions(handle, {'callback': 's:NotUsed'}) + call ch_setoptions(handle, {'timeout': 1111}) + call ch_setoptions(handle, {'mode': 'json'}) + call assert_fails("call ch_setoptions(handle, {'waittime': 111})", "E475") + call ch_setoptions(handle, {'callback': ''}) + call ch_setoptions(handle, {'drop': 'never'}) + call ch_setoptions(handle, {'drop': 'auto'}) + call assert_fails("call ch_setoptions(handle, {'drop': 'bad'})", "E475") + + " Send an eval request that works. + call assert_equal('ok', ch_evalexpr(handle, 'eval-works')) + sleep 10m + call assert_equal([-1, 'foo123'], ch_evalexpr(handle, 'eval-result')) + + " Send an eval request with special characters. + call assert_equal('ok', ch_evalexpr(handle, 'eval-special')) + sleep 10m + call assert_equal([-2, "foo\x7f\x10\x01bar"], ch_evalexpr(handle, 'eval-result')) + + " Send an eval request to get a line with special characters. + call setline(3, "a\nb\<CR>c\x01d\x7fe") + call assert_equal('ok', ch_evalexpr(handle, 'eval-getline')) + sleep 10m + call assert_equal([-3, "a\nb\<CR>c\x01d\x7fe"], ch_evalexpr(handle, 'eval-result')) + + " Send an eval request that fails. + call assert_equal('ok', ch_evalexpr(handle, 'eval-fails')) + sleep 10m + call assert_equal([-4, 'ERROR'], ch_evalexpr(handle, 'eval-result')) + + " Send an eval request that works but can't be encoded. + call assert_equal('ok', ch_evalexpr(handle, 'eval-error')) + sleep 10m + call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result')) + + " Send a bad eval request. There will be no response. + call assert_equal('ok', ch_evalexpr(handle, 'eval-bad')) + sleep 10m + call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result')) + + " Send an expr request + call assert_equal('ok', ch_evalexpr(handle, 'an expr')) + call WaitForAssert({-> assert_equal('three', getline('$'))}) + call assert_equal('one', getline(line('$') - 2)) + call assert_equal('two', getline(line('$') - 1)) + + " Request a redraw, we don't check for the effect. + call assert_equal('ok', ch_evalexpr(handle, 'redraw')) + call assert_equal('ok', ch_evalexpr(handle, 'redraw!')) + + call assert_equal('ok', ch_evalexpr(handle, 'empty-request')) + + " Reading while there is nothing available. + call assert_equal(v:none, ch_read(handle, {'timeout': 0})) + let start = reltime() + call assert_equal(v:none, ch_read(handle, {'timeout': 333})) + let elapsed = reltime(start) + call assert_true(reltimefloat(elapsed) > 0.3) + call assert_true(reltimefloat(elapsed) < 0.6) + + " Send without waiting for a response, then wait for a response. + call ch_sendexpr(handle, 'wait a bit') + let resp = ch_read(handle) + call assert_equal(type([]), type(resp)) + call assert_equal(type(11), type(resp[0])) + call assert_equal('waited', resp[1]) + + " make the server quit, can't check if this works, should not hang. + call ch_sendexpr(handle, '!quit!') +endfunc + +func Test_communicate() + call ch_log('Test_communicate()') + call s:run_server('Ch_communicate') +endfunc + +" Test that we can open two channels. +func Ch_two_channels(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + call assert_equal(v:t_channel, type(handle)) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + + call assert_equal('got it', ch_evalexpr(handle, 'hello!')) + + let newhandle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(newhandle) == "fail" + call assert_report("Can't open second channel") + return + endif + call assert_equal('got it', ch_evalexpr(newhandle, 'hello!')) + call assert_equal('got it', ch_evalexpr(handle, 'hello!')) + + call ch_close(handle) + call assert_equal('got it', ch_evalexpr(newhandle, 'hello!')) + + call ch_close(newhandle) +endfunc + +func Test_two_channels() + call ch_log('Test_two_channels()') + call s:run_server('Ch_two_channels') +endfunc + +" Test that a server crash is handled gracefully. +func Ch_server_crash(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + + call ch_evalexpr(handle, '!crash!') + + sleep 10m +endfunc + +func Test_server_crash() + call ch_log('Test_server_crash()') + call s:run_server('Ch_server_crash') +endfunc + +""""""""" + +func Ch_handler(chan, msg) + call ch_log('Ch_handler()') + unlet g:Ch_reply + let g:Ch_reply = a:msg +endfunc + +func Ch_channel_handler(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + + " Test that it works while waiting on a numbered message. + call assert_equal('ok', ch_evalexpr(handle, 'call me')) + call WaitForAssert({-> assert_equal('we called you', g:Ch_reply)}) + + " Test that it works while not waiting on a numbered message. + call ch_sendexpr(handle, 'call me again') + call WaitForAssert({-> assert_equal('we did call you', g:Ch_reply)}) +endfunc + +func Test_channel_handler() + call ch_log('Test_channel_handler()') + let g:Ch_reply = "" + let s:chopt.callback = 'Ch_handler' + call s:run_server('Ch_channel_handler') + let g:Ch_reply = "" + let s:chopt.callback = function('Ch_handler') + call s:run_server('Ch_channel_handler') + unlet s:chopt.callback +endfunc + +""""""""" + +let g:Ch_reply = '' +func Ch_zeroHandler(chan, msg) + unlet g:Ch_reply + let g:Ch_reply = a:msg +endfunc + +let g:Ch_zero_reply = '' +func Ch_oneHandler(chan, msg) + unlet g:Ch_zero_reply + let g:Ch_zero_reply = a:msg +endfunc + +func Ch_channel_zero(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + + " Check that eval works. + call assert_equal('got it', ch_evalexpr(handle, 'hello!')) + + " Check that eval works if a zero id message is sent back. + let g:Ch_reply = '' + call assert_equal('sent zero', ch_evalexpr(handle, 'send zero')) + if s:has_handler + call WaitForAssert({-> assert_equal('zero index', g:Ch_reply)}) + else + sleep 20m + call assert_equal('', g:Ch_reply) + endif + + " Check that handler works if a zero id message is sent back. + let g:Ch_reply = '' + let g:Ch_zero_reply = '' + call ch_sendexpr(handle, 'send zero', {'callback': 'Ch_oneHandler'}) + call WaitForAssert({-> assert_equal('sent zero', g:Ch_zero_reply)}) + if s:has_handler + call assert_equal('zero index', g:Ch_reply) + else + call assert_equal('', g:Ch_reply) + endif +endfunc + +func Test_zero_reply() + call ch_log('Test_zero_reply()') + " Run with channel handler + let s:has_handler = 1 + let s:chopt.callback = 'Ch_zeroHandler' + call s:run_server('Ch_channel_zero') + unlet s:chopt.callback + + " Run without channel handler + let s:has_handler = 0 + call s:run_server('Ch_channel_zero') +endfunc + +""""""""" + +let g:Ch_reply1 = "" +func Ch_handleRaw1(chan, msg) + unlet g:Ch_reply1 + let g:Ch_reply1 = a:msg +endfunc + +let g:Ch_reply2 = "" +func Ch_handleRaw2(chan, msg) + unlet g:Ch_reply2 + let g:Ch_reply2 = a:msg +endfunc + +let g:Ch_reply3 = "" +func Ch_handleRaw3(chan, msg) + unlet g:Ch_reply3 + let g:Ch_reply3 = a:msg +endfunc + +func Ch_raw_one_time_callback(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + call ch_setoptions(handle, {'mode': 'raw'}) + + " The messages are sent raw, we do our own JSON strings here. + call ch_sendraw(handle, "[1, \"hello!\"]\n", {'callback': 'Ch_handleRaw1'}) + call WaitForAssert({-> assert_equal("[1, \"got it\"]", g:Ch_reply1)}) + call ch_sendraw(handle, "[2, \"echo something\"]\n", {'callback': 'Ch_handleRaw2'}) + call ch_sendraw(handle, "[3, \"wait a bit\"]\n", {'callback': 'Ch_handleRaw3'}) + call WaitForAssert({-> assert_equal("[2, \"something\"]", g:Ch_reply2)}) + " wait for the 200 msec delayed reply + call WaitForAssert({-> assert_equal("[3, \"waited\"]", g:Ch_reply3)}) +endfunc + +func Test_raw_one_time_callback() + call ch_log('Test_raw_one_time_callback()') + call s:run_server('Ch_raw_one_time_callback') +endfunc + +""""""""" + +" Test that trying to connect to a non-existing port fails quickly. +func Test_connect_waittime() + call ch_log('Test_connect_waittime()') + let start = reltime() + let handle = ch_open('localhost:9876', s:chopt) + if ch_status(handle) != "fail" + " Oops, port does exists. + call ch_close(handle) + else + let elapsed = reltime(start) + call assert_true(reltimefloat(elapsed) < 1.0) + endif + + " We intend to use a socket that doesn't exist and wait for half a second + " before giving up. If the socket does exist it can fail in various ways. + " Check for "Connection reset by peer" to avoid flakyness. + let start = reltime() + try + let handle = ch_open('localhost:9867', {'waittime': 500}) + if ch_status(handle) != "fail" + " Oops, port does exists. + call ch_close(handle) + else + " Failed connection should wait about 500 msec. Can be longer if the + " computer is busy with other things. + let elapsed = reltime(start) + call assert_true(reltimefloat(elapsed) > 0.3) + call assert_true(reltimefloat(elapsed) < 1.5) + endif + catch + if v:exception !~ 'Connection reset by peer' + call assert_report("Caught exception: " . v:exception) + endif + endtry +endfunc + +""""""""" + +func Test_raw_pipe() + if !has('job') + return + endif + call ch_log('Test_raw_pipe()') + " Add a dummy close callback to avoid that messages are dropped when calling + " ch_canread(). + let job = job_start(s:python . " test_channel_pipe.py", + \ {'mode': 'raw', 'drop': 'never'}) + call assert_equal(v:t_job, type(job)) + call assert_equal("run", job_status(job)) + + call assert_equal("open", ch_status(job)) + call assert_equal("open", ch_status(job), {"part": "out"}) + call assert_equal("open", ch_status(job), {"part": "err"}) + call assert_fails('call ch_status(job, {"in_mode": "raw"})', 'E475:') + call assert_fails('call ch_status(job, {"part": "in"})', 'E475:') + + let dict = ch_info(job) + call assert_true(dict.id != 0) + call assert_equal('open', dict.status) + call assert_equal('open', dict.out_status) + call assert_equal('RAW', dict.out_mode) + call assert_equal('pipe', dict.out_io) + call assert_equal('open', dict.err_status) + call assert_equal('RAW', dict.err_mode) + call assert_equal('pipe', dict.err_io) + + try + " For a change use the job where a channel is expected. + call ch_sendraw(job, "echo something\n") + let msg = ch_readraw(job) + call assert_equal("something\n", substitute(msg, "\r", "", 'g')) + + call ch_sendraw(job, "double this\n") + let g:handle = job_getchannel(job) + call WaitFor('ch_canread(g:handle)') + unlet g:handle + let msg = ch_readraw(job) + call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g')) + + let g:Ch_reply = "" + call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'}) + call WaitForAssert({-> assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 'g'))}) + + let reply = ch_evalraw(job, "quit\n", {'timeout': 100}) + call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g')) + finally + call job_stop(job) + endtry + + let g:Ch_job = job + call WaitForAssert({-> assert_equal("dead", job_status(g:Ch_job))}) + let info = job_info(job) + call assert_equal("dead", info.status) + call assert_equal("term", info.stoponexit) + call assert_equal(2, len(info.cmd)) + call assert_equal("test_channel_pipe.py", info.cmd[1]) + + let found = 0 + for j in job_info() + if j == job + let found += 1 + endif + endfor + call assert_equal(1, found) +endfunc + +func Test_nl_pipe() + if !has('job') + return + endif + call ch_log('Test_nl_pipe()') + let job = job_start([s:python, "test_channel_pipe.py"]) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo something\n") + call assert_equal("something", ch_readraw(handle)) + + call ch_sendraw(handle, "echoerr wrong\n") + call assert_equal("wrong", ch_readraw(handle, {'part': 'err'})) + + call ch_sendraw(handle, "double this\n") + call assert_equal("this", ch_readraw(handle)) + call assert_equal("AND this", ch_readraw(handle)) + + call ch_sendraw(handle, "split this line\n") + call assert_equal("this linethis linethis line", ch_read(handle)) + + let reply = ch_evalraw(handle, "quit\n") + call assert_equal("Goodbye!", reply) + finally + call job_stop(job) + endtry +endfunc + +func Test_nl_err_to_out_pipe() + if !has('job') + return + endif + call ch_logfile('Xlog') + call ch_log('Test_nl_err_to_out_pipe()') + let job = job_start(s:python . " test_channel_pipe.py", {'err_io': 'out'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo something\n") + call assert_equal("something", ch_readraw(handle)) + + call ch_sendraw(handle, "echoerr wrong\n") + call assert_equal("wrong", ch_readraw(handle)) + finally + call job_stop(job) + call ch_logfile('') + let loglines = readfile('Xlog') + call assert_true(len(loglines) > 10) + let found_test = 0 + let found_send = 0 + let found_recv = 0 + let found_stop = 0 + for l in loglines + if l =~ 'Test_nl_err_to_out_pipe' + let found_test = 1 + endif + if l =~ 'SEND on.*echo something' + let found_send = 1 + endif + if l =~ 'RECV on.*something' + let found_recv = 1 + endif + if l =~ 'Stopping job with' + let found_stop = 1 + endif + endfor + call assert_equal(1, found_test) + call assert_equal(1, found_send) + call assert_equal(1, found_recv) + call assert_equal(1, found_stop) + " On MS-Windows need to sleep for a moment to be able to delete the file. + sleep 10m + call delete('Xlog') + endtry +endfunc + +func Stop_g_job() + call job_stop(g:job) + if has('win32') + " On MS-Windows the server must close the file handle before we are able + " to delete the file. + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + sleep 10m + endif +endfunc + +func Test_nl_read_file() + if !has('job') + return + endif + call ch_log('Test_nl_read_file()') + call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput') + let g:job = job_start(s:python . " test_channel_pipe.py", + \ {'in_io': 'file', 'in_name': 'Xinput'}) + call assert_equal("run", job_status(g:job)) + try + let handle = job_getchannel(g:job) + call assert_equal("something", ch_readraw(handle)) + call assert_equal("wrong", ch_readraw(handle, {'part': 'err'})) + call assert_equal("this", ch_readraw(handle)) + call assert_equal("AND this", ch_readraw(handle)) + finally + call Stop_g_job() + call delete('Xinput') + endtry +endfunc + +func Test_nl_write_out_file() + if !has('job') + return + endif + call ch_log('Test_nl_write_out_file()') + let g:job = job_start(s:python . " test_channel_pipe.py", + \ {'out_io': 'file', 'out_name': 'Xoutput'}) + call assert_equal("run", job_status(g:job)) + try + let handle = job_getchannel(g:job) + call ch_sendraw(handle, "echo line one\n") + call ch_sendraw(handle, "echo line two\n") + call ch_sendraw(handle, "double this\n") + call WaitForAssert({-> assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))}) + finally + call Stop_g_job() + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xoutput$')) + call delete('Xoutput') + endtry +endfunc + +func Test_nl_write_err_file() + if !has('job') + return + endif + call ch_log('Test_nl_write_err_file()') + let g:job = job_start(s:python . " test_channel_pipe.py", + \ {'err_io': 'file', 'err_name': 'Xoutput'}) + call assert_equal("run", job_status(g:job)) + try + let handle = job_getchannel(g:job) + call ch_sendraw(handle, "echoerr line one\n") + call ch_sendraw(handle, "echoerr line two\n") + call ch_sendraw(handle, "doubleerr this\n") + call WaitForAssert({-> assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))}) + finally + call Stop_g_job() + call delete('Xoutput') + endtry +endfunc + +func Test_nl_write_both_file() + if !has('job') + return + endif + call ch_log('Test_nl_write_both_file()') + let g:job = job_start(s:python . " test_channel_pipe.py", + \ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'}) + call assert_equal("run", job_status(g:job)) + try + let handle = job_getchannel(g:job) + call ch_sendraw(handle, "echoerr line one\n") + call ch_sendraw(handle, "echo line two\n") + call ch_sendraw(handle, "double this\n") + call ch_sendraw(handle, "doubleerr that\n") + call WaitForAssert({-> assert_equal(['line one', 'line two', 'this', 'AND this', 'that', 'AND that'], readfile('Xoutput'))}) + finally + call Stop_g_job() + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xoutput$')) + call delete('Xoutput') + endtry +endfunc + +func BufCloseCb(ch) + let g:Ch_bufClosed = 'yes' +endfunc + +func Run_test_pipe_to_buffer(use_name, nomod, do_msg) + if !has('job') + return + endif + call ch_log('Test_pipe_to_buffer()') + let g:Ch_bufClosed = 'no' + let options = {'out_io': 'buffer', 'close_cb': 'BufCloseCb'} + let expected = ['', 'line one', 'line two', 'this', 'AND this', 'Goodbye!'] + if a:use_name + let options['out_name'] = 'pipe-output' + if a:do_msg + let expected[0] = 'Reading from channel output...' + else + let options['out_msg'] = 0 + call remove(expected, 0) + endif + else + sp pipe-output + let options['out_buf'] = bufnr('%') + quit + call remove(expected, 0) + endif + if a:nomod + let options['out_modifiable'] = 0 + endif + let job = job_start(s:python . " test_channel_pipe.py", options) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo line one\n") + call ch_sendraw(handle, "echo line two\n") + call ch_sendraw(handle, "double this\n") + call ch_sendraw(handle, "quit\n") + sp pipe-output + call WaitFor('line("$") == ' . len(expected) . ' && g:Ch_bufClosed == "yes"') + call assert_equal(expected, getline(1, '$')) + if a:nomod + call assert_equal(0, &modifiable) + else + call assert_equal(1, &modifiable) + endif + call assert_equal('yes', g:Ch_bufClosed) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_to_buffer_name() + call Run_test_pipe_to_buffer(1, 0, 1) +endfunc + +func Test_pipe_to_buffer_nr() + call Run_test_pipe_to_buffer(0, 0, 1) +endfunc + +func Test_pipe_to_buffer_name_nomod() + call Run_test_pipe_to_buffer(1, 1, 1) +endfunc + +func Test_pipe_to_buffer_name_nomsg() + call Run_test_pipe_to_buffer(1, 0, 1) +endfunc + +func Test_close_output_buffer() + if !has('job') + return + endif + enew! + let test_lines = ['one', 'two'] + call setline(1, test_lines) + call ch_log('Test_close_output_buffer()') + let options = {'out_io': 'buffer'} + let options['out_name'] = 'buffer-output' + let options['out_msg'] = 0 + split buffer-output + let job = job_start(s:python . " test_channel_write.py", options) + call assert_equal("run", job_status(job)) + try + call WaitForAssert({-> assert_equal(3, line('$'))}) + quit! + sleep 100m + " Make sure the write didn't happen to the wrong buffer. + call assert_equal(test_lines, getline(1, line('$'))) + call assert_equal(-1, bufwinnr('buffer-output')) + sbuf buffer-output + call assert_notequal(-1, bufwinnr('buffer-output')) + sleep 100m + close " no more writes + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Run_test_pipe_err_to_buffer(use_name, nomod, do_msg) + if !has('job') + return + endif + call ch_log('Test_pipe_err_to_buffer()') + let options = {'err_io': 'buffer'} + let expected = ['', 'line one', 'line two', 'this', 'AND this'] + if a:use_name + let options['err_name'] = 'pipe-err' + if a:do_msg + let expected[0] = 'Reading from channel error...' + else + let options['err_msg'] = 0 + call remove(expected, 0) + endif + else + sp pipe-err + let options['err_buf'] = bufnr('%') + quit + call remove(expected, 0) + endif + if a:nomod + let options['err_modifiable'] = 0 + endif + let job = job_start(s:python . " test_channel_pipe.py", options) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echoerr line one\n") + call ch_sendraw(handle, "echoerr line two\n") + call ch_sendraw(handle, "doubleerr this\n") + call ch_sendraw(handle, "quit\n") + sp pipe-err + call WaitForAssert({-> assert_equal(expected, getline(1, '$'))}) + if a:nomod + call assert_equal(0, &modifiable) + else + call assert_equal(1, &modifiable) + endif + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_err_to_buffer_name() + call Run_test_pipe_err_to_buffer(1, 0, 1) +endfunc + +func Test_pipe_err_to_buffer_nr() + call Run_test_pipe_err_to_buffer(0, 0, 1) +endfunc + +func Test_pipe_err_to_buffer_name_nomod() + call Run_test_pipe_err_to_buffer(1, 1, 1) +endfunc + +func Test_pipe_err_to_buffer_name_nomsg() + call Run_test_pipe_err_to_buffer(1, 0, 0) +endfunc + +func Test_pipe_both_to_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_both_to_buffer()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_io': 'buffer', 'out_name': 'pipe-err', 'err_io': 'out'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo line one\n") + call ch_sendraw(handle, "echoerr line two\n") + call ch_sendraw(handle, "double this\n") + call ch_sendraw(handle, "doubleerr that\n") + call ch_sendraw(handle, "quit\n") + sp pipe-err + call WaitForAssert({-> assert_equal(['Reading from channel output...', 'line one', 'line two', 'this', 'AND this', 'that', 'AND that', 'Goodbye!'], getline(1, '$'))}) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Run_test_pipe_from_buffer(use_name) + if !has('job') + return + endif + call ch_log('Test_pipe_from_buffer()') + + sp pipe-input + call setline(1, ['echo one', 'echo two', 'echo three']) + let options = {'in_io': 'buffer', 'block_write': 1} + if a:use_name + let options['in_name'] = 'pipe-input' + else + let options['in_buf'] = bufnr('%') + endif + + let job = job_start(s:python . " test_channel_pipe.py", options) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call assert_equal('one', ch_read(handle)) + call assert_equal('two', ch_read(handle)) + call assert_equal('three', ch_read(handle)) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_from_buffer_name() + call Run_test_pipe_from_buffer(1) +endfunc + +func Test_pipe_from_buffer_nr() + call Run_test_pipe_from_buffer(0) +endfunc + +func Run_pipe_through_sort(all, use_buffer) + if !executable('sort') || !has('job') + return + endif + let options = {'out_io': 'buffer', 'out_name': 'sortout'} + if a:use_buffer + split sortin + call setline(1, ['ccc', 'aaa', 'ddd', 'bbb', 'eee']) + let options.in_io = 'buffer' + let options.in_name = 'sortin' + endif + if !a:all + let options.in_top = 2 + let options.in_bot = 4 + endif + let g:job = job_start('sort', options) + call assert_equal("run", job_status(g:job)) + + if !a:use_buffer + call ch_sendraw(g:job, "ccc\naaa\nddd\nbbb\neee\n") + call ch_close_in(g:job) + endif + + call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) + + sp sortout + call WaitFor('line("$") > 3') + call assert_equal('Reading from channel output...', getline(1)) + if a:all + call assert_equal(['aaa', 'bbb', 'ccc', 'ddd', 'eee'], getline(2, 6)) + else + call assert_equal(['aaa', 'bbb', 'ddd'], getline(2, 4)) + endif + + call job_stop(g:job) + unlet g:job + if a:use_buffer + bwipe! sortin + endif + bwipe! sortout +endfunc + +func Test_pipe_through_sort_all() + call ch_log('Test_pipe_through_sort_all()') + call Run_pipe_through_sort(1, 1) +endfunc + +func Test_pipe_through_sort_some() + call ch_log('Test_pipe_through_sort_some()') + call Run_pipe_through_sort(0, 1) +endfunc + +func Test_pipe_through_sort_feed() + call ch_log('Test_pipe_through_sort_feed()') + call Run_pipe_through_sort(1, 0) +endfunc + +func Test_pipe_to_nameless_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_to_nameless_buffer()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_io': 'buffer'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo line one\n") + call ch_sendraw(handle, "echo line two\n") + exe ch_getbufnr(handle, "out") . 'sbuf' + call WaitFor('line("$") >= 3') + call assert_equal(['Reading from channel output...', 'line one', 'line two'], getline(1, '$')) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_to_buffer_json() + if !has('job') + return + endif + call ch_log('Test_pipe_to_buffer_json()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_io': 'buffer', 'out_mode': 'json'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo [0, \"hello\"]\n") + call ch_sendraw(handle, "echo [-2, 12.34]\n") + exe ch_getbufnr(handle, "out") . 'sbuf' + call WaitFor('line("$") >= 3') + call assert_equal(['Reading from channel output...', '[0,"hello"]', '[-2,12.34]'], getline(1, '$')) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +" Wait a little while for the last line, minus "offset", to equal "line". +func s:wait_for_last_line(line, offset) + for i in range(100) + if getline(line('$') - a:offset) == a:line + break + endif + sleep 10m + endfor +endfunc + +func Test_pipe_io_two_buffers() + if !has('job') + return + endif + call ch_log('Test_pipe_io_two_buffers()') + + " Create two buffers, one to read from and one to write to. + split pipe-output + set buftype=nofile + split pipe-input + set buftype=nofile + + let job = job_start(s:python . " test_channel_pipe.py", + \ {'in_io': 'buffer', 'in_name': 'pipe-input', 'in_top': 0, + \ 'out_io': 'buffer', 'out_name': 'pipe-output', + \ 'block_write': 1}) + call assert_equal("run", job_status(job)) + try + exe "normal Gaecho hello\<CR>" + exe bufwinnr('pipe-output') . "wincmd w" + call s:wait_for_last_line('hello', 0) + call assert_equal('hello', getline('$')) + + exe bufwinnr('pipe-input') . "wincmd w" + exe "normal Gadouble this\<CR>" + exe bufwinnr('pipe-output') . "wincmd w" + call s:wait_for_last_line('AND this', 0) + call assert_equal('this', getline(line('$') - 1)) + call assert_equal('AND this', getline('$')) + + bwipe! + exe bufwinnr('pipe-input') . "wincmd w" + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_io_one_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_io_one_buffer()') + + " Create one buffer to read from and to write to. + split pipe-io + set buftype=nofile + + let job = job_start(s:python . " test_channel_pipe.py", + \ {'in_io': 'buffer', 'in_name': 'pipe-io', 'in_top': 0, + \ 'out_io': 'buffer', 'out_name': 'pipe-io', + \ 'block_write': 1}) + call assert_equal("run", job_status(job)) + try + exe "normal Goecho hello\<CR>" + call s:wait_for_last_line('hello', 1) + call assert_equal('hello', getline(line('$') - 1)) + + exe "normal Gadouble this\<CR>" + call s:wait_for_last_line('AND this', 1) + call assert_equal('this', getline(line('$') - 2)) + call assert_equal('AND this', getline(line('$') - 1)) + + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_null() + if !has('job') + return + endif + call ch_log('Test_pipe_null()') + + " We cannot check that no I/O works, we only check that the job starts + " properly. + let job = job_start(s:python . " test_channel_pipe.py something", + \ {'in_io': 'null'}) + call assert_equal("run", job_status(job)) + try + call assert_equal('something', ch_read(job)) + finally + call job_stop(job) + endtry + + let job = job_start(s:python . " test_channel_pipe.py err-out", + \ {'out_io': 'null'}) + call assert_equal("run", job_status(job)) + try + call assert_equal('err-out', ch_read(job, {"part": "err"})) + finally + call job_stop(job) + endtry + + let job = job_start(s:python . " test_channel_pipe.py something", + \ {'err_io': 'null'}) + call assert_equal("run", job_status(job)) + try + call assert_equal('something', ch_read(job)) + finally + call job_stop(job) + endtry + + let job = job_start(s:python . " test_channel_pipe.py something", + \ {'out_io': 'null', 'err_io': 'out'}) + call assert_equal("run", job_status(job)) + call job_stop(job) + + let job = job_start(s:python . " test_channel_pipe.py something", + \ {'in_io': 'null', 'out_io': 'null', 'err_io': 'null'}) + call assert_equal("run", job_status(job)) + call assert_equal('channel fail', string(job_getchannel(job))) + call assert_equal('fail', ch_status(job)) + call job_stop(job) +endfunc + +func Test_pipe_to_buffer_raw() + if !has('job') + return + endif + call ch_log('Test_raw_pipe_to_buffer()') + let options = {'out_mode': 'raw', 'out_io': 'buffer', 'out_name': 'testout'} + split testout + let job = job_start([s:python, '-c', + \ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options) + call assert_equal("run", job_status(job)) + call WaitFor('len(join(getline(1, "$"), "")) >= 10000') + try + let totlen = 0 + for line in getline(1, '$') + call assert_equal('', substitute(line, '^\.*', '', '')) + let totlen += len(line) + endfor + call assert_equal(10000, totlen) + finally + call job_stop(job) + bwipe! + endtry +endfunc + +func Test_reuse_channel() + if !has('job') + return + endif + call ch_log('Test_reuse_channel()') + + let job = job_start(s:python . " test_channel_pipe.py") + call assert_equal("run", job_status(job)) + let handle = job_getchannel(job) + try + call ch_sendraw(handle, "echo something\n") + call assert_equal("something", ch_readraw(handle)) + finally + call job_stop(job) + endtry + + let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle}) + call assert_equal("run", job_status(job)) + let handle = job_getchannel(job) + try + call ch_sendraw(handle, "echo again\n") + call assert_equal("again", ch_readraw(handle)) + finally + call job_stop(job) + endtry +endfunc + +func Test_out_cb() + if !has('job') + return + endif + call ch_log('Test_out_cb()') + + let dict = {'thisis': 'dict: '} + func dict.outHandler(chan, msg) dict + if type(a:msg) == v:t_string + let g:Ch_outmsg = self.thisis . a:msg + else + let g:Ch_outobj = a:msg + endif + endfunc + func dict.errHandler(chan, msg) dict + let g:Ch_errmsg = self.thisis . a:msg + endfunc + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_cb': dict.outHandler, + \ 'out_mode': 'json', + \ 'err_cb': dict.errHandler, + \ 'err_mode': 'json'}) + call assert_equal("run", job_status(job)) + try + let g:Ch_outmsg = '' + let g:Ch_errmsg = '' + call ch_sendraw(job, "echo [0, \"hello\"]\n") + call ch_sendraw(job, "echoerr [0, \"there\"]\n") + call WaitForAssert({-> assert_equal("dict: hello", g:Ch_outmsg)}) + call WaitForAssert({-> assert_equal("dict: there", g:Ch_errmsg)}) + + " Receive a json object split in pieces + unlet! g:Ch_outobj + call ch_sendraw(job, "echosplit [0, {\"one\": 1,| \"tw|o\": 2, \"three\": 3|}]\n") + let g:Ch_outobj = '' + call WaitForAssert({-> assert_equal({'one': 1, 'two': 2, 'three': 3}, g:Ch_outobj)}) + finally + call job_stop(job) + endtry +endfunc + +func Test_out_close_cb() + if !has('job') + return + endif + call ch_log('Test_out_close_cb()') + + let s:counter = 1 + let g:Ch_msg1 = '' + let g:Ch_closemsg = 0 + func! OutHandler(chan, msg) + if s:counter == 1 + let g:Ch_msg1 = a:msg + endif + let s:counter += 1 + endfunc + func! CloseHandler(chan) + let g:Ch_closemsg = s:counter + let s:counter += 1 + endfunc + let job = job_start(s:python . " test_channel_pipe.py quit now", + \ {'out_cb': 'OutHandler', + \ 'close_cb': 'CloseHandler'}) + call assert_equal("run", job_status(job)) + try + call WaitForAssert({-> assert_equal('quit', g:Ch_msg1)}) + call WaitForAssert({-> assert_equal(2, g:Ch_closemsg)}) + finally + call job_stop(job) + delfunc OutHandler + delfunc CloseHandler + endtry +endfunc + +func Test_read_in_close_cb() + if !has('job') + return + endif + call ch_log('Test_read_in_close_cb()') + + let g:Ch_received = '' + func! CloseHandler(chan) + let g:Ch_received = ch_read(a:chan) + endfunc + let job = job_start(s:python . " test_channel_pipe.py quit now", + \ {'close_cb': 'CloseHandler'}) + call assert_equal("run", job_status(job)) + try + call WaitForAssert({-> assert_equal('quit', g:Ch_received)}) + finally + call job_stop(job) + delfunc CloseHandler + endtry +endfunc + +" Use channel in NL mode but received text does not end in NL. +func Test_read_in_close_cb_incomplete() + if !has('job') + return + endif + call ch_log('Test_read_in_close_cb_incomplete()') + + let g:Ch_received = '' + func! CloseHandler(chan) + while ch_status(a:chan, {'part': 'out'}) == 'buffered' + let g:Ch_received .= ch_read(a:chan) + endwhile + endfunc + let job = job_start(s:python . " test_channel_pipe.py incomplete", + \ {'close_cb': 'CloseHandler'}) + call assert_equal("run", job_status(job)) + try + call WaitForAssert({-> assert_equal('incomplete', g:Ch_received)}) + finally + call job_stop(job) + delfunc CloseHandler + endtry +endfunc + +func Test_out_cb_lambda() + if !has('job') + return + endif + call ch_log('Test_out_cb_lambda()') + + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_cb': {ch, msg -> execute("let g:Ch_outmsg = 'lambda: ' . msg")}, + \ 'out_mode': 'json', + \ 'err_cb': {ch, msg -> execute(":let g:Ch_errmsg = 'lambda: ' . msg")}, + \ 'err_mode': 'json'}) + call assert_equal("run", job_status(job)) + try + let g:Ch_outmsg = '' + let g:Ch_errmsg = '' + call ch_sendraw(job, "echo [0, \"hello\"]\n") + call ch_sendraw(job, "echoerr [0, \"there\"]\n") + call WaitForAssert({-> assert_equal("lambda: hello", g:Ch_outmsg)}) + call WaitForAssert({-> assert_equal("lambda: there", g:Ch_errmsg)}) + finally + call job_stop(job) + endtry +endfunc + +func Test_close_and_exit_cb() + if !has('job') + return + endif + call ch_log('Test_close_and_exit_cb') + + let g:retdict = {'ret': {}} + func g:retdict.close_cb(ch) dict + let self.ret['close_cb'] = job_status(ch_getjob(a:ch)) + endfunc + func g:retdict.exit_cb(job, status) dict + let self.ret['exit_cb'] = job_status(a:job) + endfunc + + let g:job = job_start('echo', { + \ 'close_cb': g:retdict.close_cb, + \ 'exit_cb': g:retdict.exit_cb, + \ }) + call assert_equal('run', job_status(g:job)) + unlet g:job + call WaitForAssert({-> assert_equal(2, len(g:retdict.ret))}) + call assert_match('^\%(dead\|run\)', g:retdict.ret['close_cb']) + call assert_equal('dead', g:retdict.ret['exit_cb']) + unlet g:retdict +endfunc + +"""""""""" + +let g:Ch_unletResponse = '' +func s:UnletHandler(handle, msg) + let g:Ch_unletResponse = a:msg + unlet s:channelfd +endfunc + +" Test that "unlet handle" in a handler doesn't crash Vim. +func Ch_unlet_handle(port) + let s:channelfd = ch_open('localhost:' . a:port, s:chopt) + call ch_sendexpr(s:channelfd, "test", {'callback': function('s:UnletHandler')}) + call WaitForAssert({-> assert_equal('what?', g:Ch_unletResponse)}) +endfunc + +func Test_unlet_handle() + call ch_log('Test_unlet_handle()') + call s:run_server('Ch_unlet_handle') +endfunc + +"""""""""" + +let g:Ch_unletResponse = '' +func Ch_CloseHandler(handle, msg) + let g:Ch_unletResponse = a:msg + call ch_close(s:channelfd) +endfunc + +" Test that "unlet handle" in a handler doesn't crash Vim. +func Ch_close_handle(port) + let s:channelfd = ch_open('localhost:' . a:port, s:chopt) + call ch_sendexpr(s:channelfd, "test", {'callback': function('Ch_CloseHandler')}) + call WaitForAssert({-> assert_equal('what?', g:Ch_unletResponse)}) +endfunc + +func Test_close_handle() + call ch_log('Test_close_handle()') + call s:run_server('Ch_close_handle') +endfunc + +"""""""""" + +func Test_open_fail() + call ch_log('Test_open_fail()') + silent! let ch = ch_open("noserver") + echo ch + let d = ch +endfunc + +"""""""""" + +func Ch_open_delay(port) + " Wait up to a second for the port to open. + let s:chopt.waittime = 1000 + let channel = ch_open('localhost:' . a:port, s:chopt) + unlet s:chopt.waittime + if ch_status(channel) == "fail" + call assert_report("Can't open channel") + return + endif + call assert_equal('got it', ch_evalexpr(channel, 'hello!')) + call ch_close(channel) +endfunc + +func Test_open_delay() + call ch_log('Test_open_delay()') + " The server will wait half a second before creating the port. + call s:run_server('Ch_open_delay', 'delay') +endfunc + +""""""""" + +function MyFunction(a,b,c) + let g:Ch_call_ret = [a:a, a:b, a:c] +endfunc + +function Ch_test_call(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + + let g:Ch_call_ret = [] + call assert_equal('ok', ch_evalexpr(handle, 'call-func')) + call WaitForAssert({-> assert_equal([1, 2, 3], g:Ch_call_ret)}) +endfunc + +func Test_call() + call ch_log('Test_call()') + call s:run_server('Ch_test_call') +endfunc + +""""""""" + +let g:Ch_job_exit_ret = 'not yet' +function MyExitCb(job, status) + let g:Ch_job_exit_ret = 'done' +endfunc + +function Ch_test_exit_callback(port) + call job_setoptions(g:currentJob, {'exit_cb': 'MyExitCb'}) + let g:Ch_exit_job = g:currentJob + call assert_equal('MyExitCb', job_info(g:currentJob)['exit_cb']) +endfunc + +func Test_exit_callback() + if has('job') + call ch_log('Test_exit_callback()') + call s:run_server('Ch_test_exit_callback') + + " wait up to a second for the job to exit + for i in range(100) + if g:Ch_job_exit_ret == 'done' + break + endif + sleep 10m + " calling job_status() triggers the callback + call job_status(g:Ch_exit_job) + endfor + + call assert_equal('done', g:Ch_job_exit_ret) + call assert_equal('dead', job_info(g:Ch_exit_job).status) + unlet g:Ch_exit_job + endif +endfunc + +function MyExitTimeCb(job, status) + if job_info(a:job).process == g:exit_cb_val.process + let g:exit_cb_val.end = reltime(g:exit_cb_val.start) + endif + call Resume() +endfunction + +func Test_exit_callback_interval() + if !has('job') + return + endif + + let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} + let job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) + let g:exit_cb_val.process = job_info(job).process + call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') + let elapsed = reltimefloat(g:exit_cb_val.end) + call assert_true(elapsed > 0.5) + call assert_true(elapsed < 1.0) + + " case: unreferenced job, using timer + if !has('timers') + return + endif + + let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} + let g:job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) + let g:exit_cb_val.process = job_info(g:job).process + unlet g:job + call Standby(1000) + if type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0 + let elapsed = reltimefloat(g:exit_cb_val.end) + else + let elapsed = 1.0 + endif + call assert_true(elapsed > 0.5) + call assert_true(elapsed < 1.0) +endfunc + +""""""""" + +let g:Ch_close_ret = 'alive' +function MyCloseCb(ch) + let g:Ch_close_ret = 'closed' +endfunc + +function Ch_test_close_callback(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + call ch_setoptions(handle, {'close_cb': 'MyCloseCb'}) + + call assert_equal('', ch_evalexpr(handle, 'close me')) + call WaitForAssert({-> assert_equal('closed', g:Ch_close_ret)}) +endfunc + +func Test_close_callback() + call ch_log('Test_close_callback()') + call s:run_server('Ch_test_close_callback') +endfunc + +function Ch_test_close_partial(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + let g:Ch_d = {} + func g:Ch_d.closeCb(ch) dict + let self.close_ret = 'closed' + endfunc + call ch_setoptions(handle, {'close_cb': g:Ch_d.closeCb}) + + call assert_equal('', ch_evalexpr(handle, 'close me')) + call WaitForAssert({-> assert_equal('closed', g:Ch_d.close_ret)}) + unlet g:Ch_d +endfunc + +func Test_close_partial() + call ch_log('Test_close_partial()') + call s:run_server('Ch_test_close_partial') +endfunc + +func Test_job_start_invalid() + call assert_fails('call job_start($x)', 'E474:') + call assert_fails('call job_start("")', 'E474:') +endfunc + +func Test_job_stop_immediately() + if !has('job') + return + endif + + let g:job = job_start([s:python, '-c', 'import time;time.sleep(10)']) + try + call job_stop(g:job) + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + finally + call job_stop(g:job, 'kill') + unlet g:job + endtry +endfunc + +" This was leaking memory. +func Test_partial_in_channel_cycle() + let d = {} + let d.a = function('string', [d]) + try + let d.b = ch_open('nowhere:123', {'close_cb': d.a}) + catch + call assert_exception('E901:') + endtry + unlet d +endfunc + +func Test_using_freed_memory() + let g:a = job_start(['ls']) + sleep 10m + call test_garbagecollect_now() +endfunc + +func Test_collapse_buffers() + if !executable('cat') || !has('job') + return + endif + sp test_channel.vim + let g:linecount = line('$') + close + split testout + 1,$delete + call job_start('cat test_channel.vim', {'out_io': 'buffer', 'out_name': 'testout'}) + call WaitForAssert({-> assert_inrange(g:linecount, g:linecount + 1, line('$'))}) + bwipe! +endfunc + +func Test_cmd_parsing() + if !has('unix') + return + endif + call assert_false(filereadable("file with space")) + let job = job_start('touch "file with space"') + call WaitForAssert({-> assert_true(filereadable("file with space"))}) + call delete("file with space") + + let job = job_start('touch file\ with\ space') + call WaitForAssert({-> assert_true(filereadable("file with space"))}) + call delete("file with space") +endfunc + +func Test_raw_passes_nul() + if !executable('cat') || !has('job') + return + endif + + " Test lines from the job containing NUL are stored correctly in a buffer. + new + call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"]) + w! Xtestread + bwipe! + split testout + 1,$delete + call job_start('cat Xtestread', {'out_io': 'buffer', 'out_name': 'testout'}) + call WaitFor('line("$") > 2') + call assert_equal("asdf\nasdf", getline(1)) + call assert_equal("xxx\n", getline(2)) + call assert_equal("\nyyy", getline(3)) + + call delete('Xtestread') + bwipe! + + " Test lines from a buffer with NUL bytes are written correctly to the job. + new mybuffer + call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"]) + let g:Ch_job = job_start('cat', {'in_io': 'buffer', 'in_name': 'mybuffer', 'out_io': 'file', 'out_name': 'Xtestwrite'}) + call WaitForAssert({-> assert_equal("dead", job_status(g:Ch_job))}) + bwipe! + split Xtestwrite + call assert_equal("asdf\nasdf", getline(1)) + call assert_equal("xxx\n", getline(2)) + call assert_equal("\nyyy", getline(3)) + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xtestwrite$')) + + call delete('Xtestwrite') + bwipe! +endfunc + +func MyLineCountCb(ch, msg) + let g:linecount += 1 +endfunc + +func Test_read_nonl_line() + if !has('job') + return + endif + + let g:linecount = 0 + let arg = 'import sys;sys.stdout.write("1\n2\n3")' + call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'}) + call WaitForAssert({-> assert_equal(3, g:linecount)}) +endfunc + +func Test_read_from_terminated_job() + if !has('job') + return + endif + + let g:linecount = 0 + let arg = 'import os,sys;os.close(1);sys.stderr.write("test\n")' + call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'}) + call WaitForAssert({-> assert_equal(1, g:linecount)}) +endfunc + +func Test_env() + if !has('job') + return + endif + + let g:envstr = '' + if has('win32') + let cmd = ['cmd', '/c', 'echo %FOO%'] + else + let cmd = [&shell, &shellcmdflag, 'echo $FOO'] + endif + call assert_fails('call job_start(cmd, {"env": 1})', 'E475:') + call job_start(cmd, {'callback': {ch,msg -> execute(":let g:envstr .= msg")}, 'env': {'FOO': 'bar'}}) + call WaitForAssert({-> assert_equal("bar", g:envstr)}) + unlet g:envstr +endfunc + +func Test_cwd() + if !has('job') + return + endif + + let g:envstr = '' + if has('win32') + let expect = $TEMP + let cmd = ['cmd', '/c', 'echo %CD%'] + else + let expect = $HOME + let cmd = ['pwd'] + endif + let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:envstr .= msg")}, 'cwd': expect}) + try + call WaitForAssert({-> assert_notequal("", g:envstr)}) + let expect = substitute(expect, '[/\\]$', '', '') + let g:envstr = substitute(g:envstr, '[/\\]$', '', '') + if $CI != '' && stridx(g:envstr, '/private/') == 0 + let g:envstr = g:envstr[8:] + endif + call assert_equal(expect, g:envstr) + finally + call job_stop(job) + unlet g:envstr + endtry +endfunc + +function Ch_test_close_lambda(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_report("Can't open channel") + return + endif + let g:Ch_close_ret = '' + call ch_setoptions(handle, {'close_cb': {ch -> execute("let g:Ch_close_ret = 'closed'")}}) + + call assert_equal('', ch_evalexpr(handle, 'close me')) + call WaitForAssert({-> assert_equal('closed', g:Ch_close_ret)}) +endfunc + +func Test_close_lambda() + call ch_log('Test_close_lambda()') + call s:run_server('Ch_test_close_lambda') +endfunc + +func s:test_list_args(cmd, out, remove_lf) + try + let g:out = '' + let job = job_start([s:python, '-c', a:cmd], {'callback': {ch, msg -> execute('let g:out .= msg')}, 'out_mode': 'raw'}) + call WaitFor('"" != g:out') + if has('win32') + let g:out = substitute(g:out, '\r', '', 'g') + endif + if a:remove_lf + let g:out = substitute(g:out, '\n$', '', 'g') + endif + call assert_equal(a:out, g:out) + finally + call job_stop(job) + unlet g:out + endtry +endfunc + +func Test_list_args() + if !has('job') + return + endif + + call s:test_list_args('import sys;sys.stdout.write("hello world")', "hello world", 0) + call s:test_list_args('import sys;sys.stdout.write("hello\nworld")', "hello\nworld", 0) + call s:test_list_args('import sys;sys.stdout.write(''hello\nworld'')', "hello\nworld", 0) + call s:test_list_args('import sys;sys.stdout.write(''hello"world'')', "hello\"world", 0) + call s:test_list_args('import sys;sys.stdout.write(''hello^world'')', "hello^world", 0) + call s:test_list_args('import sys;sys.stdout.write("hello&&world")', "hello&&world", 0) + call s:test_list_args('import sys;sys.stdout.write(''hello\\world'')', "hello\\world", 0) + call s:test_list_args('import sys;sys.stdout.write(''hello\\\\world'')', "hello\\\\world", 0) + call s:test_list_args('import sys;sys.stdout.write("hello\"world\"")', 'hello"world"', 0) + call s:test_list_args('import sys;sys.stdout.write("h\"ello worl\"d")', 'h"ello worl"d', 0) + call s:test_list_args('import sys;sys.stdout.write("h\"e\\\"llo wor\\\"l\"d")', 'h"e\"llo wor\"l"d', 0) + call s:test_list_args('import sys;sys.stdout.write("h\"e\\\"llo world")', 'h"e\"llo world', 0) + call s:test_list_args('import sys;sys.stdout.write("hello\tworld")', "hello\tworld", 0) + + " tests which not contain spaces in the argument + call s:test_list_args('print("hello\nworld")', "hello\nworld", 1) + call s:test_list_args('print(''hello\nworld'')', "hello\nworld", 1) + call s:test_list_args('print(''hello"world'')', "hello\"world", 1) + call s:test_list_args('print(''hello^world'')', "hello^world", 1) + call s:test_list_args('print("hello&&world")', "hello&&world", 1) + call s:test_list_args('print(''hello\\world'')', "hello\\world", 1) + call s:test_list_args('print(''hello\\\\world'')', "hello\\\\world", 1) + call s:test_list_args('print("hello\"world\"")', 'hello"world"', 1) + call s:test_list_args('print("hello\tworld")', "hello\tworld", 1) +endfunc + +" Do this last, it stops any channel log. +func Test_zz_ch_log() + call ch_logfile('Xlog', 'w') + call ch_log('hello there') + call ch_log('%s%s') + call ch_logfile('') + let text = readfile('Xlog') + call assert_match("hello there", text[1]) + call assert_match("%s%s", text[2]) + call delete('Xlog') +endfunc + +func Test_keep_pty_open() + if !has('unix') + return + endif + + let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', {'out_io': 'null', 'err_io': 'null', 'pty': 1}) + let elapsed = WaitFor({-> job_status(job) ==# 'dead'}) + call assert_inrange(200, 1000, elapsed) + call job_stop(job) +endfunc diff --git a/src/testdir/test_channel_pipe.py b/src/testdir/test_channel_pipe.py new file mode 100644 index 0000000000..940378624b --- /dev/null +++ b/src/testdir/test_channel_pipe.py @@ -0,0 +1,59 @@ +#!/usr/bin/python +# +# Server that will communicate over stdin/stderr +# +# This requires Python 2.6 or later. + +from __future__ import print_function +import sys +import time + +if __name__ == "__main__": + + if len(sys.argv) > 1: + if sys.argv[1].startswith("err"): + print(sys.argv[1], file=sys.stderr) + sys.stderr.flush() + elif sys.argv[1].startswith("incomplete"): + print(sys.argv[1], end='') + sys.stdout.flush() + sys.exit(0) + else: + print(sys.argv[1]) + sys.stdout.flush() + if sys.argv[1].startswith("quit"): + sys.exit(0) + + while True: + typed = sys.stdin.readline() + if typed.startswith("quit"): + print("Goodbye!") + sys.stdout.flush() + break + if typed.startswith("echo "): + print(typed[5:-1]) + sys.stdout.flush() + if typed.startswith("echosplit "): + for part in typed[10:-1].split('|'): + sys.stdout.write(part) + sys.stdout.flush() + time.sleep(0.05) + if typed.startswith("double "): + print(typed[7:-1] + "\nAND " + typed[7:-1]) + sys.stdout.flush() + if typed.startswith("split "): + print(typed[6:-1], end='') + sys.stdout.flush() + time.sleep(0.05) + print(typed[6:-1], end='') + sys.stdout.flush() + time.sleep(0.05) + print(typed[6:-1]) + sys.stdout.flush() + if typed.startswith("echoerr "): + print(typed[8:-1], file=sys.stderr) + sys.stderr.flush() + if typed.startswith("doubleerr "): + print(typed[10:-1] + "\nAND " + typed[10:-1], file=sys.stderr) + sys.stderr.flush() + diff --git a/src/testdir/test_channel_write.py b/src/testdir/test_channel_write.py new file mode 100644 index 0000000000..9c8813b5d9 --- /dev/null +++ b/src/testdir/test_channel_write.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +# +# Program that writes a number to stdout repeatedly +# +# This requires Python 2.6 or later. + +from __future__ import print_function +import sys +import time + +if __name__ == "__main__": + + done = 0 + while done < 10: + done = done + 1 + print(done) + sys.stdout.flush() + time.sleep(0.05) # sleep 50 msec diff --git a/src/testdir/test_charsearch.vim b/src/testdir/test_charsearch.vim new file mode 100644 index 0000000000..8b313b5a35 --- /dev/null +++ b/src/testdir/test_charsearch.vim @@ -0,0 +1,62 @@ + +function! Test_charsearch() + enew! + call append(0, ['Xabcdefghijkemnopqretuvwxyz', + \ 'Yabcdefghijkemnopqretuvwxyz', + \ 'Zabcdefghijkemnokqretkvwxyz']) + " check that "fe" and ";" work + 1 + normal! ylfep;;p,,p + call assert_equal('XabcdeXfghijkeXmnopqreXtuvwxyz', getline(1)) + " check that save/restore works + 2 + normal! ylfep + let csave = getcharsearch() + normal! fip + call setcharsearch(csave) + normal! ;p;p + call assert_equal('YabcdeYfghiYjkeYmnopqreYtuvwxyz', getline(2)) + + " check that setcharsearch() changes the settings. + 3 + normal! ylfep + call setcharsearch({'char': 'k'}) + normal! ;p + call setcharsearch({'forward': 0}) + normal! $;p + call setcharsearch({'until': 1}) + set cpo-=; + normal! ;;p + call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3)) + enew! +endfunction + +" Test for t,f,F,T movement commands and 'cpo-;' setting +function! Test_search_cmds() + enew! + call append(0, ["aaa two three four", " zzz", "yyy ", + \ "bbb yee yoo four", "ccc two three four", + \ "ddd yee yoo four"]) + set cpo-=; + 1 + normal! 0tt;D + 2 + normal! 0fz;D + 3 + normal! $Fy;D + 4 + normal! $Ty;D + set cpo+=; + 5 + normal! 0tt;;D + 6 + normal! $Ty;;D + + call assert_equal('aaa two', getline(1)) + call assert_equal(' z', getline(2)) + call assert_equal('y', getline(3)) + call assert_equal('bbb y', getline(4)) + call assert_equal('ccc', getline(5)) + call assert_equal('ddd yee y', getline(6)) + enew! +endfunction diff --git a/src/testdir/test_charsearch_utf8.vim b/src/testdir/test_charsearch_utf8.vim new file mode 100644 index 0000000000..ade7dd408c --- /dev/null +++ b/src/testdir/test_charsearch_utf8.vim @@ -0,0 +1,22 @@ +" Tests for related f{char} and t{char} using utf-8. +if !has('multi_byte') + finish +endif + +" Test for t,f,F,T movement commands +function! Test_search_cmds() + new! + call setline(1, "・最初から最後まで最強のVimは最高") + 1 + normal! f最 + call assert_equal([0, 1, 4, 0], getpos('.')) + normal! ; + call assert_equal([0, 1, 16, 0], getpos('.')) + normal! 2; + call assert_equal([0, 1, 43, 0], getpos('.')) + normal! , + call assert_equal([0, 1, 28, 0], getpos('.')) + bw! +endfunction + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim new file mode 100644 index 0000000000..7c2c5e341c --- /dev/null +++ b/src/testdir/test_cindent.vim @@ -0,0 +1,105 @@ +" Test for cinoptions and cindent +" +" TODO: rewrite test3.in into this new style test + +func Test_cino_hash() + " Test that curbuf->b_ind_hash_comment is correctly reset + new + setlocal cindent cinoptions=#1 + setlocal cinoptions= + call setline(1, ["#include <iostream>"]) + call cursor(1, 1) + norm! o#include + "call feedkeys("o#include\<esc>", 't') + call assert_equal(["#include <iostream>", "#include"], getline(1,2)) + bwipe! +endfunc + +func Test_cino_extern_c() + " Test for cino-E + + let without_ind = [ + \ '#ifdef __cplusplus', + \ 'extern "C" {', + \ '#endif', + \ 'int func_a(void);', + \ '#ifdef __cplusplus', + \ '}', + \ '#endif' + \ ] + + let with_ind = [ + \ '#ifdef __cplusplus', + \ 'extern "C" {', + \ '#endif', + \ "\tint func_a(void);", + \ '#ifdef __cplusplus', + \ '}', + \ '#endif' + \ ] + new + setlocal cindent cinoptions=E0 + call setline(1, without_ind) + call feedkeys("gg=G", 'tx') + call assert_equal(with_ind, getline(1, '$')) + + setlocal cinoptions=E-s + call setline(1, with_ind) + call feedkeys("gg=G", 'tx') + call assert_equal(without_ind, getline(1, '$')) + + setlocal cinoptions=Es + let tests = [ + \ ['recognized', ['extern "C" {'], "\t\t;"], + \ ['recognized', ['extern "C++" {'], "\t\t;"], + \ ['recognized', ['extern /* com */ "C"{'], "\t\t;"], + \ ['recognized', ['extern"C"{'], "\t\t;"], + \ ['recognized', ['extern "C"', '{'], "\t\t;"], + \ ['not recognized', ['extern {'], "\t;"], + \ ['not recognized', ['extern /*"C"*/{'], "\t;"], + \ ['not recognized', ['extern "C" //{'], ";"], + \ ['not recognized', ['extern "C" /*{*/'], ";"], + \ ] + + for pair in tests + let lines = pair[1] + call setline(1, lines) + call feedkeys(len(lines) . "Go;", 'tx') + call assert_equal(pair[2], getline(len(lines) + 1), 'Failed for "' . string(lines) . '"') + endfor + + bwipe! +endfunc + +func Test_cindent_rawstring() + new + setl cindent + call feedkeys("i" . + \ "int main() {\<CR>" . + \ "R\"(\<CR>" . + \ ")\";\<CR>" . + \ "statement;\<Esc>", "x") + call assert_equal("\tstatement;", getline(line('.'))) + bw! +endfunc + +func Test_cindent_expr() + new + func! MyIndentFunction() + return v:lnum == 1 ? shiftwidth() : 0 + endfunc + setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction() + call setline(1, ['var_a = something()', 'b = something()']) + call cursor(1, 1) + call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') + call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$')) + + %d + call setline(1, [' var_a = something()', ' b = something()']) + call cursor(1, 1) + call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') + call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$')) + bw! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim new file mode 100644 index 0000000000..f79e50fbb3 --- /dev/null +++ b/src/testdir/test_clientserver.vim @@ -0,0 +1,104 @@ +" Tests for the +clientserver feature. + +if !has('job') || !has('clientserver') || (has('gui_macvim') && !has('gui_running')) + finish +endif + +source shared.vim + +func Test_client_server() + let cmd = GetVimCommand() + if cmd == '' + return + endif + if has('x11') + if empty($DISPLAY) + throw 'Skipped: $DISPLAY is not set' + endif + try + call remote_send('xxx', '') + catch + if v:exception =~ 'E240:' + throw 'Skipped: no connection to the X server' + endif + " ignore other errors + endtry + endif + + let name = 'XVIMTEST' + let cmd .= ' --servername ' . name + let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) + call WaitForAssert({-> assert_equal("run", job_status(job))}) + + " Takes a short while for the server to be active. + " When using valgrind it takes much longer. + call WaitForAssert({-> assert_match(name, serverlist())}) + + call remote_foreground(name) + + call remote_send(name, ":let testvar = 'yes'\<CR>") + call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"') + call assert_equal('yes', remote_expr(name, "testvar", "", 2)) + + if has('unix') && has('gui') && !has('gui_running') + " Running in a terminal and the GUI is available: Tell the server to open + " the GUI and check that the remote command still works. + " Need to wait for the GUI to start up, otherwise the send hangs in trying + " to send to the terminal window. + if has('gui_athena') || has('gui_motif') + " For those GUIs, ignore the 'failed to create input context' error. + call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>") + else + call remote_send(name, ":gui -f\<CR>") + endif + " Wait for the server to be up and answering requests. + sleep 100m + call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")}) + + call remote_send(name, ":let testvar = 'maybe'\<CR>") + call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))}) + endif + + call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241') + + " Expression evaluated locally. + if v:servername == '' + call remote_startserver('MYSELF') + " May get MYSELF1 when running the test again. + call assert_match('MYSELF', v:servername) + endif + let g:testvar = 'myself' + call assert_equal('myself', remote_expr(v:servername, 'testvar')) + + call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') + call assert_equal('got it', remote_read(g:myserverid, 2)) + + call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid') + let peek_result = 'nothing' + let r = remote_peek(g:myserverid, 'peek_result') + " unpredictable whether the result is already available. + if r > 0 + call assert_equal('another', peek_result) + elseif r == 0 + call assert_equal('nothing', peek_result) + else + call assert_report('remote_peek() failed') + endif + let g:peek_result = 'empty' + call WaitFor('remote_peek(g:myserverid, "g:peek_result") > 0') + call assert_equal('another', g:peek_result) + call assert_equal('another', remote_read(g:myserverid, 2)) + + call remote_send(name, ":qa!\<CR>") + try + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + finally + if job_status(job) != 'dead' + call assert_report('Server did not exit') + call job_stop(job, 'kill') + endif + endtry +endfunc + +" Uncomment this line to get a debugging log +" call ch_logfile('channellog', 'w') diff --git a/src/testdir/test_close_count.vim b/src/testdir/test_close_count.vim new file mode 100644 index 0000000000..1f9adba32d --- /dev/null +++ b/src/testdir/test_close_count.vim @@ -0,0 +1,174 @@ + +" Tests for :[count]close! command +func Test_close_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + 4wincmd w + close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + 1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + $close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + 2close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + 1wincmd w + new + call add(wids, win_getid()) + new + call add(wids, win_getid()) + 2wincmd w + -1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[6], wids[4], wids[1]], ids) + + 2wincmd w + +1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[6], wids[4]], ids) + + only! +endfunc + +" Tests for :[count]hide command +func Test_hide_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + 4wincmd w + .hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + 1hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + $hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + 2hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + 1wincmd w + new + call add(wids, win_getid()) + new + call add(wids, win_getid()) + 3wincmd w + -hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[7], wids[4], wids[1]], ids) + + 2wincmd w + +hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[7], wids[4]], ids) + + only! +endfunc + +" Tests for :[count]close! command with 'hidden' +func Test_hidden_close_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + set hidden + + $ hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[2], wids[1]], ids) + + $-1 close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1]], ids) + + 1wincmd w + .+close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[3], wids[1]], ids) + + set nohidden + only! +endfunc + +" Tests for 'CTRL-W c' command to close windows. +func Test_winclose_command() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + set hidden + + 4wincmd w + exe "normal \<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + exe "normal 1\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + exe "normal 9\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + exe "normal 2\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + set nohidden + only! +endfunc diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim new file mode 100644 index 0000000000..c807364ec3 --- /dev/null +++ b/src/testdir/test_cmdline.vim @@ -0,0 +1,502 @@ +" Tests for editing the command line. + + +func Test_complete_tab() + call writefile(['testfile'], 'Xtestfile') + call feedkeys(":e Xtest\t\r", "tx") + call assert_equal('testfile', getline(1)) + call delete('Xtestfile') +endfunc + +func Test_complete_list() + " We can't see the output, but at least we check the code runs properly. + call feedkeys(":e test\<C-D>\r", "tx") + call assert_equal('test', expand('%:t')) +endfunc + +func Test_complete_wildmenu() + call writefile(['testfile1'], 'Xtestfile1') + call writefile(['testfile2'], 'Xtestfile2') + set wildmenu + call feedkeys(":e Xtest\t\t\r", "tx") + call assert_equal('testfile2', getline(1)) + + call delete('Xtestfile1') + call delete('Xtestfile2') + set nowildmenu +endfunc + +func Test_map_completion() + if !has('cmdline_compl') + return + endif + call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <unique> <silent>', getreg(':')) + call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <script> <unique>', getreg(':')) + call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <expr> <script>', getreg(':')) + call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <buffer> <expr>', getreg(':')) + call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <nowait> <buffer>', getreg(':')) + call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <special> <nowait>', getreg(':')) + call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"map <silent> <special>', getreg(':')) +endfunc + +func Test_match_completion() + if !has('cmdline_compl') + return + endif + hi Aardig ctermfg=green + call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"match Aardig', getreg(':')) + call feedkeys(":match \<S-Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"match none', getreg(':')) +endfunc + +func Test_highlight_completion() + if !has('cmdline_compl') + return + endif + hi Aardig ctermfg=green + call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi Aardig', getreg(':')) + call feedkeys(":hi default \<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi default Aardig', getreg(':')) + call feedkeys(":hi clear Aa\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi clear Aardig', getreg(':')) + call feedkeys(":hi li\<S-Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi link', getreg(':')) + call feedkeys(":hi d\<S-Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi default', getreg(':')) + call feedkeys(":hi c\<S-Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"hi clear', getreg(':')) + + " A cleared group does not show up in completions. + hi Anders ctermfg=green + call assert_equal(['Aardig', 'Anders'], getcompletion('A', 'highlight')) + hi clear Aardig + call assert_equal(['Anders'], getcompletion('A', 'highlight')) + hi clear Anders + call assert_equal([], getcompletion('A', 'highlight')) +endfunc + +func Test_expr_completion() + if !has('cmdline_compl') + return + endif + for cmd in [ + \ 'let a = ', + \ 'if', + \ 'elseif', + \ 'while', + \ 'for', + \ 'echo', + \ 'echon', + \ 'execute', + \ 'echomsg', + \ 'echoerr', + \ 'call', + \ 'return', + \ 'cexpr', + \ 'caddexpr', + \ 'cgetexpr', + \ 'lexpr', + \ 'laddexpr', + \ 'lgetexpr'] + call feedkeys(":" . cmd . " getl\<Tab>\<Home>\"\<CR>", 'xt') + call assert_equal('"' . cmd . ' getline(', getreg(':')) + endfor +endfunc + +func Test_getcompletion() + if !has('cmdline_compl') + return + endif + let groupcount = len(getcompletion('', 'event')) + call assert_true(groupcount > 0) + let matchcount = len(getcompletion('File', 'event')) + call assert_true(matchcount > 0) + call assert_true(groupcount > matchcount) + + if has('menu') + source $VIMRUNTIME/menu.vim + let matchcount = len(getcompletion('', 'menu')) + call assert_true(matchcount > 0) + call assert_equal(['File.'], getcompletion('File', 'menu')) + call assert_true(matchcount > 0) + let matchcount = len(getcompletion('File.', 'menu')) + call assert_true(matchcount > 0) + endif + + let l = getcompletion('v:n', 'var') + call assert_true(index(l, 'v:null') >= 0) + let l = getcompletion('v:notexists', 'var') + call assert_equal([], l) + + args a.c b.c + let l = getcompletion('', 'arglist') + call assert_equal(['a.c', 'b.c'], l) + %argdelete + + let l = getcompletion('', 'augroup') + call assert_true(index(l, 'END') >= 0) + let l = getcompletion('blahblah', 'augroup') + call assert_equal([], l) + + let l = getcompletion('', 'behave') + call assert_true(index(l, 'mswin') >= 0) + let l = getcompletion('not', 'behave') + call assert_equal([], l) + + let l = getcompletion('', 'color') + call assert_true(index(l, 'default') >= 0) + let l = getcompletion('dirty', 'color') + call assert_equal([], l) + + let l = getcompletion('', 'command') + call assert_true(index(l, 'sleep') >= 0) + let l = getcompletion('awake', 'command') + call assert_equal([], l) + + let l = getcompletion('', 'dir') + call assert_true(index(l, 'samples/') >= 0) + let l = getcompletion('NoMatch', 'dir') + call assert_equal([], l) + + let l = getcompletion('exe', 'expression') + call assert_true(index(l, 'executable(') >= 0) + let l = getcompletion('kill', 'expression') + call assert_equal([], l) + + let l = getcompletion('tag', 'function') + call assert_true(index(l, 'taglist(') >= 0) + let l = getcompletion('paint', 'function') + call assert_equal([], l) + + let Flambda = {-> 'hello'} + let l = getcompletion('', 'function') + let l = filter(l, {i, v -> v =~ 'lambda'}) + call assert_equal([], l) + + let l = getcompletion('run', 'file') + call assert_true(index(l, 'runtest.vim') >= 0) + let l = getcompletion('walk', 'file') + call assert_equal([], l) + set wildignore=*.vim + let l = getcompletion('run', 'file', 1) + call assert_true(index(l, 'runtest.vim') < 0) + set wildignore& + + let l = getcompletion('ha', 'filetype') + call assert_true(index(l, 'hamster') >= 0) + let l = getcompletion('horse', 'filetype') + call assert_equal([], l) + + let l = getcompletion('z', 'syntax') + call assert_true(index(l, 'zimbu') >= 0) + let l = getcompletion('emacs', 'syntax') + call assert_equal([], l) + + let l = getcompletion('jikes', 'compiler') + call assert_true(index(l, 'jikes') >= 0) + let l = getcompletion('break', 'compiler') + call assert_equal([], l) + + let l = getcompletion('last', 'help') + call assert_true(index(l, ':tablast') >= 0) + let l = getcompletion('giveup', 'help') + call assert_equal([], l) + + let l = getcompletion('time', 'option') + call assert_true(index(l, 'timeoutlen') >= 0) + let l = getcompletion('space', 'option') + call assert_equal([], l) + + let l = getcompletion('er', 'highlight') + call assert_true(index(l, 'ErrorMsg') >= 0) + let l = getcompletion('dark', 'highlight') + call assert_equal([], l) + + let l = getcompletion('', 'messages') + call assert_true(index(l, 'clear') >= 0) + let l = getcompletion('not', 'messages') + call assert_equal([], l) + + let l = getcompletion('', 'mapclear') + call assert_true(index(l, '<buffer>') >= 0) + let l = getcompletion('not', 'mapclear') + call assert_equal([], l) + + let l = getcompletion('.', 'shellcmd') + call assert_equal(['./', '../'], l[0:1]) + call assert_equal(-1, match(l[2:], '^\.\.\?/$')) + let root = has('win32') ? 'C:\\' : '/' + let l = getcompletion(root, 'shellcmd') + let expected = map(filter(glob(root . '*', 0, 1), + \ 'isdirectory(v:val) || executable(v:val)'), 'isdirectory(v:val) ? v:val . ''/'' : v:val') + call assert_equal(expected, l) + + if has('cscope') + let l = getcompletion('', 'cscope') + let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show'] + call assert_equal(cmds, l) + " using cmdline completion must not change the result + call feedkeys(":cscope find \<c-d>\<c-c>", 'xt') + let l = getcompletion('', 'cscope') + call assert_equal(cmds, l) + let keys = ['a', 'c', 'd', 'e', 'f', 'g', 'i', 's', 't'] + let l = getcompletion('find ', 'cscope') + call assert_equal(keys, l) + endif + + if has('signs') + sign define Testing linehl=Comment + let l = getcompletion('', 'sign') + let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace'] + call assert_equal(cmds, l) + " using cmdline completion must not change the result + call feedkeys(":sign list \<c-d>\<c-c>", 'xt') + let l = getcompletion('', 'sign') + call assert_equal(cmds, l) + let l = getcompletion('list ', 'sign') + call assert_equal(['Testing'], l) + endif + + " For others test if the name is recognized. + let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user'] + if has('cmdline_hist') + call add(names, 'history') + endif + if has('gettext') + call add(names, 'locale') + endif + if has('profile') + call add(names, 'syntime') + endif + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') + + for name in names + let matchcount = len(getcompletion('', name)) + call assert_true(matchcount >= 0, 'No matches for ' . name) + endfor + + call delete('Xtags') + + call assert_fails('call getcompletion("", "burp")', 'E475:') +endfunc + +func Test_expand_star_star() + call mkdir('a/b', 'p') + call writefile(['asdfasdf'], 'a/b/fileXname') + call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') + call assert_equal('find a/b/fileXname', getreg(':')) + bwipe! + call delete('a', 'rf') +endfunc + +func Test_paste_in_cmdline() + let @a = "def" + call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx') + call assert_equal('"abc def ghi', @:) + + new + call setline(1, 'asdf.x /tmp/some verylongword a;b-c*d ') + + call feedkeys(":aaa \<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa asdf bbb', @:) + + call feedkeys("ft:aaa \<C-R>\<C-F> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa /tmp/some bbb', @:) + + call feedkeys(":aaa \<C-R>\<C-L> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa '.getline(1).' bbb', @:) + + set incsearch + call feedkeys("fy:aaa veryl\<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa verylongword bbb', @:) + + call feedkeys("f;:aaa \<C-R>\<C-A> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa a;b-c*d bbb', @:) + + call feedkeys(":\<C-\>etoupper(getline(1))\<CR>\<C-B>\"\<CR>", 'tx') + call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:) + bwipe! + + " Error while typing a command used to cause that it was not executed + " in the end. + new + try + call feedkeys(":file \<C-R>%Xtestfile\<CR>", 'tx') + catch /^Vim\%((\a\+)\)\=:E32/ + " ignore error E32 + endtry + call assert_equal("Xtestfile", bufname("%")) + bwipe! +endfunc + +func Test_remove_char_in_cmdline() + call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx') + call assert_equal('"abc ef', @:) + + call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx') + call assert_equal('"abcdef', @:) + + call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx') + call assert_equal('"abc ghi', @:) + + call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx') + call assert_equal('"def', @:) +endfunc + +func Test_illegal_address1() + new + 2;'( + 2;') + quit +endfunc + +func Test_illegal_address2() + call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim') + new + source Xtest.vim + " Trigger calling validate_cursor() + diffsp Xtest.vim + quit! + bwipe! + call delete('Xtest.vim') +endfunc + +func Test_cmdline_complete_wildoptions() + help + call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx') + let a = join(sort(split(@:)),' ') + set wildoptions=tagfile + call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx') + let b = join(sort(split(@:)),' ') + call assert_equal(a, b) + bw! +endfunc + +func Test_cmdline_complete_user_cmd() + command! -complete=color -nargs=1 Foo : + call feedkeys(":Foo \<Tab>\<Home>\"\<cr>", 'tx') + call assert_equal('"Foo blue', @:) + call feedkeys(":Foo b\<Tab>\<Home>\"\<cr>", 'tx') + call assert_equal('"Foo blue', @:) + delcommand Foo +endfunc + +func Test_cmdline_write_alternatefile() + new + call setline('.', ['one', 'two']) + f foo.txt + new + f #-A + call assert_equal('foo.txt-A', expand('%')) + f #<-B.txt + call assert_equal('foo-B.txt', expand('%')) + f %< + call assert_equal('foo-B', expand('%')) + new + call assert_fails('f #<', 'E95') + bw! + f foo-B.txt + f %<-A + call assert_equal('foo-B-A', expand('%')) + bw! + bw! +endfunc + +" using a leading backslash here +set cpo+=C + +func Test_cmdline_search_range() + new + call setline(1, ['a', 'b', 'c', 'd']) + /d + 1,\/s/b/B/ + call assert_equal('B', getline(2)) + + /a + $ + \?,4s/c/C/ + call assert_equal('C', getline(3)) + + call setline(1, ['a', 'b', 'c', 'd']) + %s/c/c/ + 1,\&s/b/B/ + call assert_equal('B', getline(2)) + + bwipe! +endfunc + +" Tests for getcmdline(), getcmdpos() and getcmdtype() +func Check_cmdline(cmdtype) + call assert_equal('MyCmd a', getcmdline()) + call assert_equal(8, getcmdpos()) + call assert_equal(a:cmdtype, getcmdtype()) + return '' +endfunc + +func Test_getcmdtype() + call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt") + + let cmdtype = '' + debuggreedy + call feedkeys(":debug echo 'test'\<CR>", "t") + call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t") + call feedkeys("cont\<CR>", "xt") + 0debuggreedy + call assert_equal('>', cmdtype) + + call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt") + call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt") + + call feedkeys(":call input('Answer?')\<CR>", "t") + call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<C-C>", "xt") + + call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt") + + cnoremap <expr> <F6> Check_cmdline('=') + call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt") + cunmap <F6> +endfunc + +func Test_verbosefile() + set verbosefile=Xlog + echomsg 'foo' + echomsg 'bar' + set verbosefile= + let log = readfile('Xlog') + call assert_match("foo\nbar", join(log, "\n")) + call delete('Xlog') +endfunc + +func Test_setcmdpos() + func InsertTextAtPos(text, pos) + call assert_equal(0, setcmdpos(a:pos)) + return a:text + endfunc + + " setcmdpos() with position in the middle of the command line. + call feedkeys(":\"12\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt') + call assert_equal('"1ab2', @:) + + call feedkeys(":\"12\<C-R>\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt') + call assert_equal('"1b2a', @:) + + " setcmdpos() with position beyond the end of the command line. + call feedkeys(":\"12\<C-B>\<C-R>=InsertTextAtPos('a', 10)\<CR>b\<CR>", 'xt') + call assert_equal('"12ab', @:) + + " setcmdpos() returns 1 when not editing the command line. + call assert_equal(1, setcmdpos(3)) +endfunc + +set cpo& diff --git a/src/testdir/test_command_count.vim b/src/testdir/test_command_count.vim new file mode 100644 index 0000000000..7262789ab4 --- /dev/null +++ b/src/testdir/test_command_count.vim @@ -0,0 +1,194 @@ +" Test for user command counts. + +func Test_command_count_0() + let bufnr = bufnr('%') + set hidden + set noswapfile + + split DoesNotExistEver + let lastbuf = bufnr('$') + call setline(1, 'asdf') + quit! + + command! -range -addr=loaded_buffers RangeLoadedBuffers :let lines = [<line1>, <line2>] + command! -range=% -addr=loaded_buffers RangeLoadedBuffersAll :let lines = [<line1>, <line2>] + command! -range -addr=buffers RangeBuffers :let lines = [<line1>, <line2>] + command! -range=% -addr=buffers RangeBuffersAll :let lines = [<line1>, <line2>] + + .,$RangeLoadedBuffers + call assert_equal([bufnr, bufnr], lines) + %RangeLoadedBuffers + call assert_equal([bufnr, bufnr], lines) + RangeLoadedBuffersAll + call assert_equal([bufnr, bufnr], lines) + .,$RangeBuffers + call assert_equal([bufnr, lastbuf], lines) + %RangeBuffers + call assert_equal([bufnr, lastbuf], lines) + RangeBuffersAll + call assert_equal([bufnr, lastbuf], lines) + + delcommand RangeLoadedBuffers + delcommand RangeLoadedBuffersAll + delcommand RangeBuffers + delcommand RangeBuffersAll + + set hidden& + set swapfile& +endfunc + +func Test_command_count_1() + silent! %argd + arga a b c d e + argdo echo "loading buffers" + argu 3 + command! -range -addr=arguments RangeArguments :let lines = [<line1>, <line2>] + command! -range=% -addr=arguments RangeArgumentsAll :let lines = [<line1>, <line2>] + .-,$-RangeArguments + call assert_equal([2, 4], lines) + %RangeArguments + call assert_equal([1, 5], lines) + RangeArgumentsAll + call assert_equal([1, 5], lines) + N + .RangeArguments + call assert_equal([2, 2], lines) + delcommand RangeArguments + delcommand RangeArgumentsAll + + split|split|split|split + 3wincmd w + command! -range -addr=windows RangeWindows :let lines = [<line1>, <line2>] + .,$RangeWindows + call assert_equal([3, 5], lines) + %RangeWindows + call assert_equal([1, 5], lines) + delcommand RangeWindows + + command! -range=% -addr=windows RangeWindowsAll :let lines = [<line1>, <line2>] + RangeWindowsAll + call assert_equal([1, 5], lines) + delcommand RangeWindowsAll + only + blast|bd + + tabe|tabe|tabe|tabe + normal 2gt + command! -range -addr=tabs RangeTabs :let lines = [<line1>, <line2>] + .,$RangeTabs + call assert_equal([2, 5], lines) + %RangeTabs + call assert_equal([1, 5], lines) + delcommand RangeTabs + + command! -range=% -addr=tabs RangeTabsAll :let lines = [<line1>, <line2>] + RangeTabsAll + call assert_equal([1, 5], lines) + delcommand RangeTabsAll + 1tabonly + + s/\n/\r\r\r\r\r/ + 2ma< + $-ma> + command! -range=% RangeLines :let lines = [<line1>, <line2>] + '<,'>RangeLines + call assert_equal([2, 5], lines) + delcommand RangeLines + + command! -range=% -buffer LocalRangeLines :let lines = [<line1>, <line2>] + '<,'>LocalRangeLines + call assert_equal([2, 5], lines) + delcommand LocalRangeLines +endfunc + +func Test_command_count_2() + silent! %argd + arga a b c d + call assert_fails('5argu', 'E16:') + + $argu + call assert_equal('d', expand('%:t')) + + 1argu + call assert_equal('a', expand('%:t')) + + call assert_fails('300b', 'E16:') + + split|split|split|split + 0close + + $wincmd w + $close + call assert_equal(3, winnr()) + + call assert_fails('$+close', 'E16:') + + $tabe + call assert_equal(2, tabpagenr()) + + call assert_fails('$+tabe', 'E16:') + + only! + e x + 0tabm + normal 1gt + call assert_equal('x', expand('%:t')) + + tabonly! + only! +endfunc + +func Test_command_count_3() + let bufnr = bufnr('%') + se nohidden + e aaa + let buf_aaa = bufnr('%') + e bbb + let buf_bbb = bufnr('%') + e ccc + let buf_ccc = bufnr('%') + exe bufnr . 'buf' + call assert_equal([1, 1, 1], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)]) + exe buf_bbb . "," . buf_ccc . "bdelete" + call assert_equal([1, 0, 0], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)]) + exe buf_aaa . "bdelete" + call assert_equal([0, 0, 0], [buflisted(buf_aaa), buflisted(buf_bbb), buflisted(buf_ccc)]) +endfunc + +func Test_command_count_4() + %argd + let bufnr = bufnr('$') + arga aa bb cc dd ee ff + 3argu + let args = [] + .,$-argdo call add(args, expand('%')) + call assert_equal(['cc', 'dd', 'ee'], args) + + " create windows to get 5 + split|split|split|split + 2wincmd w + let windows = [] + .,$-windo call add(windows, winnr()) + call assert_equal([2, 3, 4], windows) + only! + + exe bufnr . 'buf' + let bufnr = bufnr('%') + let buffers = [] + .,$-bufdo call add(buffers, bufnr('%')) + call assert_equal([bufnr, bufnr + 1, bufnr + 2, bufnr + 3, bufnr + 4], buffers) + + exe (bufnr + 3) . 'bdel' + let buffers = [] + exe (bufnr + 2) . ',' . (bufnr + 5) . "bufdo call add(buffers, bufnr('%'))" + call assert_equal([bufnr + 2, bufnr + 4, bufnr + 5], buffers) + + " create tabpages to get 5 + tabe|tabe|tabe|tabe + normal! 2gt + let tabpages = [] + .,$-tabdo call add(tabpages, tabpagenr()) + call assert_equal([2, 3, 4], tabpages) + tabonly! + bwipe! +endfunc diff --git a/src/testdir/test_comparators.vim b/src/testdir/test_comparators.vim new file mode 100644 index 0000000000..87be006cf2 --- /dev/null +++ b/src/testdir/test_comparators.vim @@ -0,0 +1,9 @@ +function Test_Comparators() + try + let oldisident=&isident + set isident+=# + call assert_equal(1, 1 is#1) + finally + let &isident=oldisident + endtry +endfunction diff --git a/src/testdir/test_compiler.vim b/src/testdir/test_compiler.vim new file mode 100644 index 0000000000..29d02b213d --- /dev/null +++ b/src/testdir/test_compiler.vim @@ -0,0 +1,49 @@ +" Test the :compiler command + +func Test_compiler() + if !executable('perl') + return + endif + + e Xfoo.pl + compiler perl + call assert_equal('perl', b:current_compiler) + call assert_fails('let g:current_compiler', 'E121:') + + call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1']) + w! + call feedkeys(":make\<CR>\<CR>", 'tx') + call assert_fails('clist', 'E42:') + + call setline(1, ['#!/usr/bin/perl -w', 'use strict;', '$foo=1']) + w! + call feedkeys(":make\<CR>\<CR>", 'tx') + let a=execute('clist') + call assert_match("\n 1 Xfoo.pl:3: Global symbol \"\$foo\" " + \ . "requires explicit package name", a) + + call delete('Xfoo.pl') + bw! +endfunc + +func Test_compiler_without_arg() + let a=split(execute('compiler')) + call assert_match('^.*runtime/compiler/ant.vim$', a[0]) + call assert_match('^.*runtime/compiler/bcc.vim$', a[1]) + call assert_match('^.*runtime/compiler/xmlwf.vim$', a[-1]) +endfunc + +func Test_compiler_completion() + call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"compiler ant bcc .* xmlwf$', @:) + + call feedkeys(":compiler p\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"compiler pbx perl php pylint pyunit', @:) + + call feedkeys(":compiler! p\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"compiler! pbx perl php pylint pyunit', @:) +endfunc + +func Test_compiler_error() + call assert_fails('compiler doesnotexist', 'E666:') +endfunc diff --git a/src/testdir/test_crypt.vim b/src/testdir/test_crypt.vim new file mode 100644 index 0000000000..4d77a9a9bf --- /dev/null +++ b/src/testdir/test_crypt.vim @@ -0,0 +1,83 @@ +" Tests for encryption. + +if !has('cryptv') + finish +endif + +func Common_head_only(text) + " This was crashing Vim + split Xtest.txt + call setline(1, a:text) + wq + call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", "tx") + call delete('Xtest.txt') + call assert_match('VimCrypt', getline(1)) + bwipe! +endfunc + +func Test_head_only_2() + call Common_head_only('VimCrypt~02!abc') +endfunc + +func Test_head_only_3() + call Common_head_only('VimCrypt~03!abc') +endfunc + +func Crypt_uncrypt(method) + exe "set cryptmethod=" . a:method + " If the blowfish test fails 'cryptmethod' will be 'zip' now. + call assert_equal(a:method, &cryptmethod) + + split Xtest.txt + let text = ['01234567890123456789012345678901234567', + \ 'line 2 foo bar blah', + \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] + call setline(1, text) + call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') + w! + bwipe! + call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", 'xt') + call assert_equal(text, getline(1, 3)) + set key= cryptmethod& + bwipe! + call delete('Xtest.txt') +endfunc + +func Test_crypt_zip() + call Crypt_uncrypt('zip') +endfunc + +func Test_crypt_blowfish() + call Crypt_uncrypt('blowfish') +endfunc + +func Test_crypt_blowfish2() + call Crypt_uncrypt('blowfish2') +endfunc + +func Uncrypt_stable(method, crypted_text, key, uncrypted_text) + split Xtest.txt + set bin noeol key= fenc=latin1 + exe "set cryptmethod=" . a:method + call setline(1, a:crypted_text) + w! + bwipe! + set nobin + call feedkeys(":split Xtest.txt\<CR>" . a:key . "\<CR>", 'xt') + call assert_equal(a:uncrypted_text, getline(1, len(a:uncrypted_text))) + bwipe! + call delete('Xtest.txt') + set key= +endfunc + +func Test_uncrypt_zip() + call Uncrypt_stable('zip', "VimCrypt~01!\u0006\u001clV'\u00de}Mg\u00a0\u00ea\u00a3V\u00a9\u00e7\u0007E#3\u008e2U\u00e9\u0097", "foofoo", ["1234567890", "aábbccddeëff"]) +endfunc + +func Test_uncrypt_blowfish() + call Uncrypt_stable('blowfish', "VimCrypt~02!k)\u00be\u0017\u0097#\u0016\u00ddS\u009c\u00f5=\u00ba\u00e0\u00c8#\u00a5M\u00b4\u0086J\u00c3A\u00cd\u00a5M\u00b4\u0086!\u0080\u0015\u009b\u00f5\u000f\u00e1\u00d2\u0019\u0082\u0016\u0098\u00f7\u000d\u00da", "barbar", ["asdfasdfasdf", "0001112223333"]) +endfunc + +func Test_uncrypt_blowfish2() + call Uncrypt_stable('blowfish', "VimCrypt~03!\u001e\u00d1N\u00e3;\u00d3\u00c0\u00a0^C)\u0004\u00f7\u007f.\u00b6\u00abF\u000eS\u0019\u00e0\u008b6\u00d2[T\u00cb\u00a7\u0085\u00d8\u00be9\u000b\u00812\u000bQ\u00b3\u00cc@\u0097\u000f\u00df\u009a\u00adIv\u00aa.\u00d8\u00c9\u00ee\u009e`\u00bd$\u00af%\u00d0", "barburp", ["abcdefghijklmnopqrstuvwxyz", "!@#$%^&*()_+=-`~"]) +endfunc diff --git a/src/testdir/test_cscope.vim b/src/testdir/test_cscope.vim new file mode 100644 index 0000000000..c6e54d73ec --- /dev/null +++ b/src/testdir/test_cscope.vim @@ -0,0 +1,279 @@ +" Test for cscope commands. + +if !has('cscope') || !executable('cscope') || !has('quickfix') + finish +endif + +func CscopeSetupOrClean(setup) + if a:setup + noa sp ../memfile_test.c + saveas! Xmemfile_test.c + call system('cscope -bk -fXcscope.out Xmemfile_test.c') + call system('cscope -bk -fXcscope2.out Xmemfile_test.c') + cscope add Xcscope.out + set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a- + else + cscope kill -1 + for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c'] + call delete(file) + endfo + endif +endfunc + +func Test_cscopeWithCscopeConnections() + call CscopeSetupOrClean(1) + " Test 0: E568: duplicate cscope database not added + try + set nocscopeverbose + cscope add Xcscope.out + set cscopeverbose + catch + call assert_report('exception thrown') + endtry + call assert_fails('cscope add', 'E560') + call assert_fails('cscope add Xcscope.out', 'E568') + call assert_fails('cscope add doesnotexist.out', 'E563') + + " Test 1: Find this C-Symbol + for cmd in ['cs find s main', 'cs find 0 main'] + let a = execute(cmd) + " Test 1.1 test where it moves the cursor + call assert_equal('main(void)', getline('.')) + " Test 1.2 test the output of the :cs command + call assert_match('\n(1 of 1): <<main>> main(void )', a) + endfor + + " Test 2: Find this definition + for cmd in ['cs find g test_mf_hash', 'cs find 1 test_mf_hash'] + exe cmd + call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1)) + endfor + + " Test 3: Find functions called by this function + for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash'] + let a = execute(cmd) + call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a) + call assert_equal(' mf_hash_init(&ht);', getline('.')) + endfor + + " Test 4: Find functions calling this function + for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash'] + let a = execute(cmd) + call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a) + call assert_equal(' test_mf_hash();', getline('.')) + endfor + + " Test 5: Find this text string + for cmd in ['cs find t Bram', 'cs find 4 Bram'] + let a = execute(cmd) + call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a) + call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.')) + endfor + + " Test 6: Find this egrep pattern + " test all matches returned by cscope + for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.'] + let a = execute(cmd) + call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a) + call assert_equal('#include <assert.h>', getline('.')) + cnext + call assert_equal('#include "main.c"', getline('.')) + cnext + call assert_equal('#include "memfile.c"', getline('.')) + call assert_fails('cnext', 'E553:') + endfor + + " Test 7: Find the same egrep pattern using lcscope this time. + let a = execute('lcs find e ^\#includ.') + call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a) + call assert_equal('#include <assert.h>', getline('.')) + lnext + call assert_equal('#include "main.c"', getline('.')) + lnext + call assert_equal('#include "memfile.c"', getline('.')) + call assert_fails('lnext', 'E553:') + + " Test 8: Find this file + for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c'] + enew + let a = execute(cmd) + call assert_true(a =~ '"Xmemfile_test.c" \d\+L, \d\+C') + call assert_equal('Xmemfile_test.c', @%) + endfor + + " Test 9: Find files #including this file + for cmd in ['cs find i assert.h', 'cs find 8 assert.h'] + enew + let a = execute(cmd) + let alines = split(a, '\n', 1) + call assert_equal('', alines[0]) + call assert_true(alines[1] =~ '"Xmemfile_test.c" \d\+L, \d\+C') + call assert_equal('(1 of 1): <<global>> #include <assert.h>', alines[2]) + call assert_equal('#include <assert.h>', getline('.')) + endfor + + " Test 10: Invalid find command + call assert_fails('cs find x', 'E560:') + + " Test 11: Find places where this symbol is assigned a value + " this needs a cscope >= 15.8 + " unfortunately, Travis has cscope version 15.7 + let cscope_version = systemlist('cscope --version')[0] + let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?')) + if cs_version >= 15.8 + for cmd in ['cs find a item', 'cs find 9 item'] + let a = execute(cmd) + call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);'], split(a, '\n', 1)) + call assert_equal(' item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + endfor + endif + + " Test 12: leading whitespace is not removed for cscope find text + let a = execute('cscope find t test_mf_hash') + call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1)) + call assert_equal(' test_mf_hash();', getline('.')) + + " Test 13: test with scscope + let a = execute('scs find t Bram') + call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a) + call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.')) + + " Test 14: cscope help + for cmd in ['cs', 'cs help', 'cs xxx'] + let a = execute(cmd) + call assert_match('^cscope commands:\n', a) + call assert_match('\nadd :', a) + call assert_match('\nfind :', a) + call assert_match('\nhelp : Show this message', a) + call assert_match('\nkill : Kill a connection', a) + call assert_match('\nreset: Reinit all connections', a) + call assert_match('\nshow : Show connections', a) + endfor + let a = execute('scscope help') + call assert_match('This cscope command does not support splitting the window\.', a) + + " Test 15: reset connections + let a = execute('cscope reset') + call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a) + call assert_match('\nAll cscope databases reset', a) + + " Test 16: cscope show + let a = execute('cscope show') + call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a) + + " Test 17: cstag and 'csto' option + set csto=0 + let a = execute('cstag TEST_COUNT') + call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a) + call assert_equal('#define TEST_COUNT 50000', getline('.')) + set csto=1 + let a = execute('cstag index_to_key') + call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a) + call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.')) + call assert_fails('cstag xxx', 'E257:') + call assert_fails('cstag', 'E562:') + + " Test 18: 'cst' option + set nocst + call assert_fails('tag TEST_COUNT', 'E426:') + set cst + let a = execute('tag TEST_COUNT') + call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a) + call assert_equal('#define TEST_COUNT 50000', getline('.')) + let a = execute('tags') + call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a) + + " Test 19: this should trigger call to cs_print_tags() + " Unclear how to check result though, we just exercise the code. + set cst cscopequickfix=s0 + call feedkeys(":cs find s main\<CR>", 't') + + " Test 20: cscope kill + call assert_fails('cscope kill 2', 'E261:') + call assert_fails('cscope kill xxx', 'E261:') + + let a = execute('cscope kill 0') + call assert_match('cscope connection 0 closed', a) + + cscope add Xcscope.out + let a = execute('cscope kill Xcscope.out') + call assert_match('cscope connection Xcscope.out closed', a) + + cscope add Xcscope.out . + let a = execute('cscope kill -1') + call assert_match('cscope connection .*Xcscope.out closed', a) + let a = execute('cscope kill -1') + call assert_equal('', a) + + " Test 21: 'csprg' option + call assert_equal('cscope', &csprg) + set csprg=doesnotexist + call assert_fails('cscope add Xcscope2.out', 'E609:') + set csprg=cscope + + " Test 22: multiple cscope connections + cscope add Xcscope.out + cscope add Xcscope2.out . -C + let a = execute('cscope show') + call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a) + call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a) + + " Test 23: test Ex command line completion + call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"cs add find help kill reset show', @:) + + call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"scs find', @:) + + call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"cs find a c d e f g i s t', @:) + + call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"cs kill -1 0 1', @:) + + call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"cs add Xcscope.out Xcscope2.out', @:) + + " Test 24: cscope_connection() + call assert_equal(cscope_connection(), 1) + call assert_equal(cscope_connection(0, 'out'), 1) + call assert_equal(cscope_connection(0, 'xxx'), 1) + call assert_equal(cscope_connection(1, 'out'), 1) + call assert_equal(cscope_connection(1, 'xxx'), 0) + call assert_equal(cscope_connection(2, 'out'), 0) + call assert_equal(cscope_connection(3, 'xxx', '..'), 0) + call assert_equal(cscope_connection(3, 'out', 'xxx'), 0) + call assert_equal(cscope_connection(3, 'out', '.'), 1) + call assert_equal(cscope_connection(4, 'out', '.'), 0) + + " CleanUp + call CscopeSetupOrClean(0) + +endfunc + +func Test_cscopequickfix() + set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a- + call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix) + + call assert_fails('set cscopequickfix=x-', 'E474:') + call assert_fails('set cscopequickfix=s', 'E474:') + call assert_fails('set cscopequickfix=s7', 'E474:') + call assert_fails('set cscopequickfix=s-a', 'E474:') +endfunc + +func Test_withoutCscopeConnection() + call assert_equal(cscope_connection(), 0) + + call assert_fails('cscope find s main', 'E567:') + let a = execute('cscope show') + call assert_match('no cscope connections', a) +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim new file mode 100644 index 0000000000..d784e3678b --- /dev/null +++ b/src/testdir/test_cursor_func.vim @@ -0,0 +1,48 @@ +" Tests for cursor(). + +func Test_wrong_arguments() + call assert_fails('call cursor(1. 3)', 'E474:') +endfunc + +func Test_move_cursor() + new + call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) + + call cursor([1, 1, 0, 1]) + call assert_equal([1, 1, 0, 1], getcurpos()[1:]) + call cursor([4, 3, 0, 3]) + call assert_equal([4, 3, 0, 3], getcurpos()[1:]) + + call cursor(2, 2) + call assert_equal([2, 2, 0, 2], getcurpos()[1:]) + " line number zero keeps the line number + call cursor(0, 1) + call assert_equal([2, 1, 0, 1], getcurpos()[1:]) + " col number zero keeps the column + call cursor(3, 0) + call assert_equal([3, 1, 0, 1], getcurpos()[1:]) + " below last line goes to last line + call cursor(9, 1) + call assert_equal([4, 1, 0, 1], getcurpos()[1:]) + + quit! +endfunc + +" Very short version of what matchparen does. +function s:Highlight_Matching_Pair() + let save_cursor = getcurpos() + call setpos('.', save_cursor) +endfunc + +func Test_curswant_with_autocommand() + new + call setline(1, ['func()', '{', '}', '----']) + autocmd! CursorMovedI * call s:Highlight_Matching_Pair() + call test_override("char_avail", 1) + exe "normal! 3Ga\<Down>X\<Esc>" + call test_override("char_avail", 0) + call assert_equal('-X---', getline(4)) + autocmd! CursorMovedI * + quit! +endfunc + diff --git a/src/testdir/test_curswant.vim b/src/testdir/test_curswant.vim new file mode 100644 index 0000000000..e54cd4b280 --- /dev/null +++ b/src/testdir/test_curswant.vim @@ -0,0 +1,23 @@ +" Tests for curswant not changing when setting an option + +func Test_curswant() + new + call append(0, ['1234567890', '12345']) + + normal! ggf8j + call assert_equal(7, winsaveview().curswant) + let &tabstop=&tabstop + call assert_equal(4, winsaveview().curswant) + + normal! ggf8j + call assert_equal(7, winsaveview().curswant) + let &timeoutlen=&timeoutlen + call assert_equal(7, winsaveview().curswant) + + normal! ggf8j + call assert_equal(7, winsaveview().curswant) + let &ttimeoutlen=&ttimeoutlen + call assert_equal(7, winsaveview().curswant) + + enew! +endfunc diff --git a/src/testdir/test_delete.vim b/src/testdir/test_delete.vim new file mode 100644 index 0000000000..4686a0dc97 --- /dev/null +++ b/src/testdir/test_delete.vim @@ -0,0 +1,107 @@ +" Test for delete(). + +func Test_file_delete() + split Xfile + call setline(1, ['a', 'b']) + wq + call assert_equal(['a', 'b'], readfile('Xfile')) + call assert_equal(0, delete('Xfile')) + call assert_fails('call readfile("Xfile")', 'E484:') + call assert_equal(-1, delete('Xfile')) + bwipe Xfile +endfunc + +func Test_dir_delete() + call mkdir('Xdir1') + call assert_true(isdirectory('Xdir1')) + call assert_equal(0, delete('Xdir1', 'd')) + call assert_false(isdirectory('Xdir1')) + call assert_equal(-1, delete('Xdir1', 'd')) +endfunc + +func Test_recursive_delete() + call mkdir('Xdir1') + call mkdir('Xdir1/subdir') + call mkdir('Xdir1/empty') + split Xdir1/Xfile + call setline(1, ['a', 'b']) + w + w Xdir1/subdir/Xfile + close + call assert_true(isdirectory('Xdir1')) + call assert_equal(['a', 'b'], readfile('Xdir1/Xfile')) + call assert_true(isdirectory('Xdir1/subdir')) + call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile')) + call assert_true(isdirectory('Xdir1/empty')) + call assert_equal(0, delete('Xdir1', 'rf')) + call assert_false(isdirectory('Xdir1')) + call assert_equal(-1, delete('Xdir1', 'd')) + bwipe Xdir1/Xfile + bwipe Xdir1/subdir/Xfile +endfunc + +func Test_symlink_delete() + if !has('unix') + return + endif + split Xfile + call setline(1, ['a', 'b']) + wq + silent !ln -s Xfile Xlink + " Delete the link, not the file + call assert_equal(0, delete('Xlink')) + call assert_equal(-1, delete('Xlink')) + call assert_equal(0, delete('Xfile')) + bwipe Xfile +endfunc + +func Test_symlink_dir_delete() + if !has('unix') + return + endif + call mkdir('Xdir1') + silent !ln -s Xdir1 Xlink + call assert_true(isdirectory('Xdir1')) + call assert_true(isdirectory('Xlink')) + " Delete the link, not the directory + call assert_equal(0, delete('Xlink')) + call assert_equal(-1, delete('Xlink')) + call assert_equal(0, delete('Xdir1', 'd')) +endfunc + +func Test_symlink_recursive_delete() + if !has('unix') + return + endif + call mkdir('Xdir3') + call mkdir('Xdir3/subdir') + call mkdir('Xdir4') + split Xdir3/Xfile + call setline(1, ['a', 'b']) + w + w Xdir3/subdir/Xfile + w Xdir4/Xfile + close + silent !ln -s ../Xdir4 Xdir3/Xlink + + call assert_true(isdirectory('Xdir3')) + call assert_equal(['a', 'b'], readfile('Xdir3/Xfile')) + call assert_true(isdirectory('Xdir3/subdir')) + call assert_equal(['a', 'b'], readfile('Xdir3/subdir/Xfile')) + call assert_true(isdirectory('Xdir4')) + call assert_true(isdirectory('Xdir3/Xlink')) + call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) + + call assert_equal(0, delete('Xdir3', 'rf')) + call assert_false(isdirectory('Xdir3')) + call assert_equal(-1, delete('Xdir3', 'd')) + " symlink is deleted, not the directory it points to + call assert_true(isdirectory('Xdir4')) + call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) + call assert_equal(0, delete('Xdir4/Xfile')) + call assert_equal(0, delete('Xdir4', 'd')) + + bwipe Xdir3/Xfile + bwipe Xdir3/subdir/Xfile + bwipe Xdir4/Xfile +endfunc diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim new file mode 100644 index 0000000000..d6c5c83fe5 --- /dev/null +++ b/src/testdir/test_diffmode.vim @@ -0,0 +1,631 @@ +" Tests for diff mode + +func Test_diff_fold_sync() + enew! + let l = range(50) + call setline(1, l) + diffthis + let winone = win_getid() + new + let l[25] = 'diff' + call setline(1, l) + diffthis + let wintwo = win_getid() + " line 15 is inside the closed fold + call assert_equal(19, foldclosedend(10)) + call win_gotoid(winone) + call assert_equal(19, foldclosedend(10)) + " open the fold + normal zv + call assert_equal(-1, foldclosedend(10)) + " fold in other window must have opened too + call win_gotoid(wintwo) + call assert_equal(-1, foldclosedend(10)) + + " cursor position is in sync + normal 23G + call win_gotoid(winone) + call assert_equal(23, getcurpos()[1]) + + windo diffoff + close! + set nomodified +endfunc + +func Test_vert_split() + " Disable the title to avoid xterm keeping the wrong one. + set notitle noicon + new + let l = ['1 aa', '2 bb', '3 cc', '4 dd', '5 ee'] + call setline(1, l) + w! Xtest + normal dd + $ + put + normal kkrXoxxx + w! Xtest2 + file Nop + normal ggoyyyjjjozzzz + set foldmethod=marker foldcolumn=4 + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + vert diffsplit Xtest + vert diffsplit Xtest2 + call assert_equal(1, &diff) + call assert_equal('diff', &foldmethod) + call assert_equal(2, &foldcolumn) + call assert_equal(1, &scrollbind) + call assert_equal(1, &cursorbind) + call assert_equal(0, &wrap) + + let diff_fdm = &fdm + let diff_fdc = &fdc + " repeat entering diff mode here to see if this saves the wrong settings + diffthis + " jump to second window for a moment to have filler line appear at start of + " first window + wincmd w + normal gg + wincmd p + normal gg + call assert_equal(2, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(6, winline()) + normal j + call assert_equal(8, winline()) + normal j + call assert_equal(9, winline()) + + wincmd w + normal gg + call assert_equal(1, winline()) + normal j + call assert_equal(2, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(8, winline()) + + wincmd w + normal gg + call assert_equal(2, winline()) + normal j + call assert_equal(3, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(6, winline()) + normal j + call assert_equal(7, winline()) + normal j + call assert_equal(8, winline()) + + " Test diffoff + diffoff! + 1wincmd 2 + let &diff = 1 + let &fdm = diff_fdm + let &fdc = diff_fdc + 4wincmd w + diffoff! + 1wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + call delete('Xtest') + call delete('Xtest2') + windo bw! +endfunc + +func Test_filler_lines() + " Test that diffing shows correct filler lines + enew! + put =range(4,10) + 1d _ + vnew + put =range(1,10) + 1d _ + windo diffthis + wincmd h + call assert_equal(1, line('w0')) + unlet! diff_fdm diff_fdc + windo diffoff + bwipe! + enew! +endfunc + +func Test_diffget_diffput() + enew! + let l = range(50) + call setline(1, l) + call assert_fails('diffget', 'E99:') + diffthis + call assert_fails('diffget', 'E100:') + new + let l[10] = 'one' + let l[20] = 'two' + let l[30] = 'three' + let l[40] = 'four' + call setline(1, l) + diffthis + call assert_equal('one', getline(11)) + 11diffget + call assert_equal('10', getline(11)) + 21diffput + wincmd w + call assert_equal('two', getline(21)) + normal 31Gdo + call assert_equal('three', getline(31)) + call assert_equal('40', getline(41)) + normal 41Gdp + wincmd w + call assert_equal('40', getline(41)) + new + diffthis + call assert_fails('diffget', 'E101:') + + windo diffoff + %bwipe! +endfunc + +func Test_dp_do_buffer() + e! one + let bn1=bufnr('%') + let l = range(60) + call setline(1, l) + diffthis + + new two + let l[10] = 'one' + let l[20] = 'two' + let l[30] = 'three' + let l[40] = 'four' + let l[50] = 'five' + call setline(1, l) + diffthis + + " dp and do with invalid buffer number. + 11 + call assert_fails('norm 99999dp', 'E102:') + call assert_fails('norm 99999do', 'E102:') + call assert_fails('diffput non_existing_buffer', 'E94:') + call assert_fails('diffget non_existing_buffer', 'E94:') + + " dp and do with valid buffer number. + call assert_equal('one', getline('.')) + exe 'norm ' . bn1 . 'do' + call assert_equal('10', getline('.')) + 21 + call assert_equal('two', getline('.')) + diffget one + call assert_equal('20', getline('.')) + + 31 + exe 'norm ' . bn1 . 'dp' + 41 + diffput one + wincmd w + 31 + call assert_equal('three', getline('.')) + 41 + call assert_equal('four', getline('.')) + + " dp and do with buffer number which is not in diff mode. + new not_in_diff_mode + let bn3=bufnr('%') + wincmd w + 51 + call assert_fails('exe "norm" . bn3 . "dp"', 'E103:') + call assert_fails('exe "norm" . bn3 . "do"', 'E103:') + call assert_fails('diffput not_in_diff_mode', 'E94:') + call assert_fails('diffget not_in_diff_mode', 'E94:') + + windo diffoff + %bwipe! +endfunc + +func Test_diffoff() + enew! + call setline(1, ['Two', 'Three']) + redraw + let normattr = screenattr(1, 1) + diffthis + botright vert new + call setline(1, ['One', '', 'Two', 'Three']) + diffthis + redraw + call assert_notequal(normattr, screenattr(1, 1)) + diffoff! + redraw + call assert_equal(normattr, screenattr(1, 1)) + bwipe! + bwipe! +endfunc + +func Test_diffopt_icase() + set diffopt=icase,foldcolumn:0 + + e one + call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve']) + redraw + let normattr = screenattr(1, 1) + diffthis + + botright vert new two + call setline(1, ['one', 'TWO', 'Three ', 'Four', 'fI=VE']) + diffthis + + redraw + call assert_equal(normattr, screenattr(1, 1)) + call assert_equal(normattr, screenattr(2, 1)) + call assert_notequal(normattr, screenattr(3, 1)) + call assert_equal(normattr, screenattr(4, 1)) + + let dtextattr = screenattr(5, 3) + call assert_notequal(dtextattr, screenattr(5, 1)) + call assert_notequal(dtextattr, screenattr(5, 5)) + + diffoff! + %bwipe! + set diffopt& +endfunc + +func Test_diffopt_iwhite() + set diffopt=iwhite,foldcolumn:0 + + e one + " Difference in trailing spaces should be ignored, + " but not other space differences. + call setline(1, ["One \t", 'Two', 'Three', 'Four']) + redraw + let normattr = screenattr(1, 1) + diffthis + + botright vert new two + call setline(1, ["One\t ", "Two\t ", 'Three', ' Four']) + diffthis + + redraw + call assert_equal(normattr, screenattr(1, 1)) + call assert_equal(normattr, screenattr(2, 1)) + call assert_equal(normattr, screenattr(3, 1)) + call assert_notequal(normattr, screenattr(4, 1)) + + diffoff! + %bwipe! + set diffopt& +endfunc + +func Test_diffopt_context() + enew! + call setline(1, ['1', '2', '3', '4', '5', '6', '7']) + diffthis + new + call setline(1, ['1', '2', '3', '4', '5x', '6', '7']) + diffthis + + set diffopt=context:2 + call assert_equal('+-- 2 lines: 1', foldtextresult(1)) + set diffopt=context:1 + call assert_equal('+-- 3 lines: 1', foldtextresult(1)) + + diffoff! + %bwipe! + set diffopt& +endfunc + +func Test_diffopt_horizontal() + set diffopt=horizontal + diffsplit + + call assert_equal(&columns, winwidth(1)) + call assert_equal(&columns, winwidth(2)) + call assert_equal(&lines, winheight(1) + winheight(2) + 3) + call assert_inrange(0, 1, winheight(1) - winheight(2)) + + set diffopt& + diffoff! + %bwipe +endfunc + +func Test_diffopt_vertical() + set diffopt=vertical + diffsplit + + call assert_equal(&lines - 2, winheight(1)) + call assert_equal(&lines - 2, winheight(2)) + call assert_equal(&columns, winwidth(1) + winwidth(2) + 1) + call assert_inrange(0, 1, winwidth(1) - winwidth(2)) + + set diffopt& + diffoff! + %bwipe +endfunc + +func Test_diffopt_hiddenoff() + set diffopt=filler,foldcolumn:0,hiddenoff + e! one + call setline(1, ['Two', 'Three']) + redraw + let normattr = screenattr(1, 1) + diffthis + botright vert new two + call setline(1, ['One', 'Four']) + diffthis + redraw + call assert_notequal(normattr, screenattr(1, 1)) + set hidden + close + redraw + " should not diffing with hidden buffer two while 'hiddenoff' is enabled + call assert_equal(normattr, screenattr(1, 1)) + + bwipe! + bwipe! + set hidden& diffopt& +endfunc + +func Test_diffoff_hidden() + set diffopt=filler,foldcolumn:0 + e! one + call setline(1, ['Two', 'Three']) + redraw + let normattr = screenattr(1, 1) + diffthis + botright vert new two + call setline(1, ['One', 'Four']) + diffthis + redraw + call assert_notequal(normattr, screenattr(1, 1)) + set hidden + close + redraw + " diffing with hidden buffer two + call assert_notequal(normattr, screenattr(1, 1)) + diffoff + redraw + call assert_equal(normattr, screenattr(1, 1)) + diffthis + redraw + " still diffing with hidden buffer two + call assert_notequal(normattr, screenattr(1, 1)) + diffoff! + redraw + call assert_equal(normattr, screenattr(1, 1)) + diffthis + redraw + " no longer diffing with hidden buffer two + call assert_equal(normattr, screenattr(1, 1)) + + bwipe! + bwipe! + set hidden& diffopt& +endfunc + +func Test_setting_cursor() + new Xtest1 + put =range(1,90) + wq + new Xtest2 + put =range(1,100) + wq + + tabe Xtest2 + $ + diffsp Xtest1 + tabclose + + call delete('Xtest1') + call delete('Xtest2') +endfunc + +func Test_diff_move_to() + new + call setline(1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + diffthis + vnew + call setline(1, [1, '2x', 3, 4, 4, 5, '6x', 7, '8x', 9, '10x']) + diffthis + norm ]c + call assert_equal(2, line('.')) + norm 3]c + call assert_equal(9, line('.')) + norm 10]c + call assert_equal(11, line('.')) + norm [c + call assert_equal(9, line('.')) + norm 2[c + call assert_equal(5, line('.')) + norm 10[c + call assert_equal(2, line('.')) + %bwipe! +endfunc + +func Test_diffexpr() + if !executable('diff') + return + endif + + func DiffExpr() + silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>' . v:fname_out + endfunc + set diffexpr=DiffExpr() + set diffopt=foldcolumn:0 + + enew! + call setline(1, ['one', 'two', 'three']) + redraw + let normattr = screenattr(1, 1) + diffthis + + botright vert new + call setline(1, ['one', 'two', 'three.']) + diffthis + + redraw + call assert_equal(normattr, screenattr(1, 1)) + call assert_equal(normattr, screenattr(2, 1)) + call assert_notequal(normattr, screenattr(3, 1)) + + diffoff! + %bwipe! + set diffexpr& diffopt& +endfunc + +func Test_diffpatch() + " The patch program on MS-Windows may fail or hang. + if !executable('patch') || !has('unix') + return + endif + new + insert +*************** +*** 1,3 **** + 1 +! 2 + 3 +--- 1,4 ---- + 1 +! 2x + 3 ++ 4 +. + saveas! Xpatch + bwipe! + new + call assert_fails('diffpatch Xpatch', 'E816:') + + for name in ['Xpatch', 'Xpatch$HOME', 'Xpa''tch'] + call setline(1, ['1', '2', '3']) + if name != 'Xpatch' + call rename('Xpatch', name) + endif + exe 'diffpatch ' . escape(name, '$') + call assert_equal(['1', '2x', '3', '4'], getline(1, '$')) + if name != 'Xpatch' + call rename(name, 'Xpatch') + endif + bwipe! + endfor + + call delete('Xpatch') + bwipe! +endfunc + +func Test_diff_too_many_buffers() + for i in range(1, 8) + exe "new Xtest" . i + diffthis + endfor + new Xtest9 + call assert_fails('diffthis', 'E96:') + %bwipe! +endfunc + +func Test_diff_nomodifiable() + new + call setline(1, [1, 2, 3, 4]) + setl nomodifiable + diffthis + vnew + call setline(1, ['1x', 2, 3, 3, 4]) + diffthis + call assert_fails('norm dp', 'E793:') + setl nomodifiable + call assert_fails('norm do', 'E21:') + %bwipe! +endfunc + +func Test_diff_hlID() + new + call setline(1, [1, 2, 3]) + diffthis + vnew + call setline(1, ['1x', 2, 'x', 3]) + diffthis + redraw + + call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "") + + call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange") + call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText") + call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "") + call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd") + call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "") + + wincmd w + call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange") + call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "") + call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "") + + %bwipe! +endfunc + +func Test_diff_filler() + new + call setline(1, [1, 2, 3, 'x', 4]) + diffthis + vnew + call setline(1, [1, 2, 'y', 'y', 3, 4]) + diffthis + redraw + + call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)')) + wincmd w + call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)')) + + %bwipe! +endfunc + +func Test_diff_lastline() + enew! + only! + call setline(1, ['This is a ', 'line with five ', 'rows']) + diffthis + botright vert new + call setline(1, ['This is', 'a line with ', 'four rows']) + diffthis + 1 + call feedkeys("Je a\<CR>", 'tx') + call feedkeys("Je a\<CR>", 'tx') + let w1lines = winline() + wincmd w + $ + let w2lines = winline() + call assert_equal(w2lines, w1lines) + bwipe! + bwipe! +endfunc diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim new file mode 100644 index 0000000000..d5b0a7b72e --- /dev/null +++ b/src/testdir/test_digraph.vim @@ -0,0 +1,480 @@ +" Tests for digraphs + +if !has("digraphs") || !has("multi_byte") + finish +endif + +func Put_Dig(chars) + exe "norm! o\<c-k>".a:chars +endfu + +func Put_Dig_BS(char1, char2) + exe "norm! o".a:char1."\<bs>".a:char2 +endfu + +func Test_digraphs() + new + call Put_Dig("00") + call assert_equal("∞", getline('.')) + " not a digraph + call Put_Dig("el") + call assert_equal("l", getline('.')) + call Put_Dig("ht") + call assert_equal("þ", getline('.')) + " digraph "ab" is the same as "ba" + call Put_Dig("ab") + call Put_Dig("ba") + call assert_equal(["ば","ば"], getline(line('.')-1,line('.'))) + " Euro sign + call Put_Dig("e=") + call Put_Dig("=e") + call Put_Dig("Eu") + call Put_Dig("uE") + call assert_equal(['е']+repeat(["€"],3), getline(line('.')-3,line('.'))) + " Rouble sign + call Put_Dig("R=") + call Put_Dig("=R") + call Put_Dig("=P") + call Put_Dig("P=") + call assert_equal(['Р']+repeat(["₽"],2)+['П'], getline(line('.')-3,line('.'))) + " Not a digraph + call Put_Dig("a\<bs>") + call Put_Dig("\<bs>a") + call assert_equal(["<BS>", "<BS>a"], getline(line('.')-1,line('.'))) + " Grave + call Put_Dig("a!") + call Put_Dig("!e") + call Put_Dig("b!") " not defined + call assert_equal(["à", "è", "!"], getline(line('.')-2,line('.'))) + " Acute accent + call Put_Dig("a'") + call Put_Dig("'e") + call Put_Dig("b'") " not defined + call assert_equal(["á", "é", "'"], getline(line('.')-2,line('.'))) + " Cicumflex + call Put_Dig("a>") + call Put_Dig(">e") + call Put_Dig("b>") " not defined + call assert_equal(['â', 'ê', '>'], getline(line('.')-2,line('.'))) + " Tilde + call Put_Dig("o~") + call Put_Dig("~u") " not defined + call Put_Dig("z~") " not defined + call assert_equal(['õ', 'u', '~'], getline(line('.')-2,line('.'))) + " Tilde + call Put_Dig("o?") + call Put_Dig("?u") + call Put_Dig("z?") " not defined + call assert_equal(['õ', 'ũ', '?'], getline(line('.')-2,line('.'))) + " Macron + call Put_Dig("o-") + call Put_Dig("-u") + call Put_Dig("z-") " not defined + call assert_equal(['ō', 'ū', '-'], getline(line('.')-2,line('.'))) + " Breve + call Put_Dig("o(") + call Put_Dig("(u") + call Put_Dig("z(") " not defined + call assert_equal(['ŏ', 'ŭ', '('], getline(line('.')-2,line('.'))) + " Dot above + call Put_Dig("b.") + call Put_Dig(".e") + call Put_Dig("a.") " not defined + call assert_equal(['ḃ', 'ė', '.'], getline(line('.')-2,line('.'))) + " Diaresis + call Put_Dig("a:") + call Put_Dig(":u") + call Put_Dig("b:") " not defined + call assert_equal(['ä', 'ü', ':'], getline(line('.')-2,line('.'))) + " Cedilla + call Put_Dig("',") + call Put_Dig(",C") + call Put_Dig("b,") " not defined + call assert_equal(['¸', 'Ç', ','], getline(line('.')-2,line('.'))) + " Underline + call Put_Dig("B_") + call Put_Dig("_t") + call Put_Dig("a_") " not defined + call assert_equal(['Ḇ', 'ṯ', '_'], getline(line('.')-2,line('.'))) + " Stroke + call Put_Dig("j/") + call Put_Dig("/l") + call Put_Dig("b/") " not defined + call assert_equal(['/', 'ł', '/'], getline(line('.')-2,line('.'))) + " Double acute + call Put_Dig('O"') + call Put_Dig('"y') + call Put_Dig('b"') " not defined + call assert_equal(['Ő', 'ÿ', '"'], getline(line('.')-2,line('.'))) + " Ogonek + call Put_Dig('u;') + call Put_Dig(';E') + call Put_Dig('b;') " not defined + call assert_equal(['ų', 'Ę', ';'], getline(line('.')-2,line('.'))) + " Caron + call Put_Dig('u<') + call Put_Dig('<E') + call Put_Dig('b<') " not defined + call assert_equal(['ǔ', 'Ě', '<'], getline(line('.')-2,line('.'))) + " Ring above + call Put_Dig('u0') + call Put_Dig('0E') " not defined + call Put_Dig('b0') " not defined + call assert_equal(['ů', 'E', '0'], getline(line('.')-2,line('.'))) + " Hook + call Put_Dig('u2') + call Put_Dig('2E') + call Put_Dig('b2') " not defined + call assert_equal(['ủ', 'Ẻ', '2'], getline(line('.')-2,line('.'))) + " Horn + call Put_Dig('u9') + call Put_Dig('9E') " not defined + call Put_Dig('b9') " not defined + call assert_equal(['ư', 'E', '9'], getline(line('.')-2,line('.'))) + " Cyrillic + call Put_Dig('u=') + call Put_Dig('=b') + call Put_Dig('=_') + call assert_equal(['у', 'б', '〓'], getline(line('.')-2,line('.'))) + " Greek + call Put_Dig('u*') + call Put_Dig('*b') + call Put_Dig('*_') + call assert_equal(['υ', 'β', '々'], getline(line('.')-2,line('.'))) + " Greek/Cyrillic special + call Put_Dig('u%') + call Put_Dig('%b') " not defined + call Put_Dig('%_') " not defined + call assert_equal(['ύ', 'b', '_'], getline(line('.')-2,line('.'))) + " Arabic + call Put_Dig('u+') + call Put_Dig('+b') + call Put_Dig('+_') " japanese industrial symbol + call assert_equal(['+', 'ب', '〄'], getline(line('.')-2,line('.'))) + " Hebrew + call Put_Dig('Q+') + call Put_Dig('+B') + call Put_Dig('+X') + call assert_equal(['ק', 'ב', 'ח'], getline(line('.')-2,line('.'))) + " Latin + call Put_Dig('a3') + call Put_Dig('A3') + call Put_Dig('3X') + call assert_equal(['ǣ', 'Ǣ', 'X'], getline(line('.')-2,line('.'))) + " Bopomofo + call Put_Dig('a4') + call Put_Dig('A4') + call Put_Dig('4X') + call assert_equal(['ㄚ', '4', 'X'], getline(line('.')-2,line('.'))) + " Hiragana + call Put_Dig('a5') + call Put_Dig('A5') + call Put_Dig('5X') + call assert_equal(['あ', 'ぁ', 'X'], getline(line('.')-2,line('.'))) + " Katakana + call Put_Dig('a6') + call Put_Dig('A6') + call Put_Dig('6X') + call assert_equal(['ァ', 'ア', 'X'], getline(line('.')-2,line('.'))) + " Superscripts + call Put_Dig('1S') + call Put_Dig('2S') + call Put_Dig('3S') + call assert_equal(['¹', '²', '³'], getline(line('.')-2,line('.'))) + " Subscripts + call Put_Dig('1s') + call Put_Dig('2s') + call Put_Dig('3s') + call assert_equal(['₁', '₂', '₃'], getline(line('.')-2,line('.'))) + " Eszet (only lowercase) + call Put_Dig("ss") + call Put_Dig("SS") " start of string + call assert_equal(["ß", "˜"], getline(line('.')-1,line('.'))) + " High bit set + call Put_Dig("a ") + call Put_Dig(" A") + call assert_equal(['á', 'Á'], getline(line('.')-1,line('.'))) + " Escape is not part of a digraph + call Put_Dig("a\<esc>") + call Put_Dig("\<esc>A") + call assert_equal(['', 'A'], getline(line('.')-1,line('.'))) + " define some custom digraphs + " old: 00 ∞ + " old: el l + digraph 00 9216 + digraph el 0252 + call Put_Dig("00") + call Put_Dig("el") + " Reset digraphs + digraph 00 8734 + digraph el 108 + call Put_Dig("00") + call Put_Dig("el") + call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) + bw! +endfunc + +func Test_digraphs_option() + " reset whichwrap option, so that testing <esc><bs>A works, + " without moving up a line + set digraph ww= + new + call Put_Dig_BS("0","0") + call assert_equal("∞", getline('.')) + " not a digraph + call Put_Dig_BS("e","l") + call assert_equal("l", getline('.')) + call Put_Dig_BS("h","t") + call assert_equal("þ", getline('.')) + " digraph "ab" is the same as "ba" + call Put_Dig_BS("a","b") + call Put_Dig_BS("b","a") + call assert_equal(["ば","ば"], getline(line('.')-1,line('.'))) + " Euro sign + call Put_Dig_BS("e","=") + call Put_Dig_BS("=","e") + call Put_Dig_BS("E","u") + call Put_Dig_BS("u","E") + call assert_equal(['е']+repeat(["€"],3), getline(line('.')-3,line('.'))) + " Rouble sign + call Put_Dig_BS("R","=") + call Put_Dig_BS("=","R") + call Put_Dig_BS("=","P") + call Put_Dig_BS("P","=") + call assert_equal(['Р']+repeat(["₽"],2)+['П'], getline(line('.')-3,line('.'))) + " Not a digraph: this is different from <c-k>! + call Put_Dig_BS("a","\<bs>") + call Put_Dig_BS("\<bs>","a") + call assert_equal(['','a'], getline(line('.')-1,line('.'))) + " Grave + call Put_Dig_BS("a","!") + call Put_Dig_BS("!","e") + call Put_Dig_BS("b","!") " not defined + call assert_equal(["à", "è", "!"], getline(line('.')-2,line('.'))) + " Acute accent + call Put_Dig_BS("a","'") + call Put_Dig_BS("'","e") + call Put_Dig_BS("b","'") " not defined + call assert_equal(["á", "é", "'"], getline(line('.')-2,line('.'))) + " Cicumflex + call Put_Dig_BS("a",">") + call Put_Dig_BS(">","e") + call Put_Dig_BS("b",">") " not defined + call assert_equal(['â', 'ê', '>'], getline(line('.')-2,line('.'))) + " Tilde + call Put_Dig_BS("o","~") + call Put_Dig_BS("~","u") " not defined + call Put_Dig_BS("z","~") " not defined + call assert_equal(['õ', 'u', '~'], getline(line('.')-2,line('.'))) + " Tilde + call Put_Dig_BS("o","?") + call Put_Dig_BS("?","u") + call Put_Dig_BS("z","?") " not defined + call assert_equal(['õ', 'ũ', '?'], getline(line('.')-2,line('.'))) + " Macron + call Put_Dig_BS("o","-") + call Put_Dig_BS("-","u") + call Put_Dig_BS("z","-") " not defined + call assert_equal(['ō', 'ū', '-'], getline(line('.')-2,line('.'))) + " Breve + call Put_Dig_BS("o","(") + call Put_Dig_BS("(","u") + call Put_Dig_BS("z","(") " not defined + call assert_equal(['ŏ', 'ŭ', '('], getline(line('.')-2,line('.'))) + " Dot above + call Put_Dig_BS("b",".") + call Put_Dig_BS(".","e") + call Put_Dig_BS("a",".") " not defined + call assert_equal(['ḃ', 'ė', '.'], getline(line('.')-2,line('.'))) + " Diaresis + call Put_Dig_BS("a",":") + call Put_Dig_BS(":","u") + call Put_Dig_BS("b",":") " not defined + call assert_equal(['ä', 'ü', ':'], getline(line('.')-2,line('.'))) + " Cedilla + call Put_Dig_BS("'",",") + call Put_Dig_BS(",","C") + call Put_Dig_BS("b",",") " not defined + call assert_equal(['¸', 'Ç', ','], getline(line('.')-2,line('.'))) + " Underline + call Put_Dig_BS("B","_") + call Put_Dig_BS("_","t") + call Put_Dig_BS("a","_") " not defined + call assert_equal(['Ḇ', 'ṯ', '_'], getline(line('.')-2,line('.'))) + " Stroke + call Put_Dig_BS("j","/") + call Put_Dig_BS("/","l") + call Put_Dig_BS("b","/") " not defined + call assert_equal(['/', 'ł', '/'], getline(line('.')-2,line('.'))) + " Double acute + call Put_Dig_BS('O','"') + call Put_Dig_BS('"','y') + call Put_Dig_BS('b','"') " not defined + call assert_equal(['Ő', 'ÿ', '"'], getline(line('.')-2,line('.'))) + " Ogonek + call Put_Dig_BS('u',';') + call Put_Dig_BS(';','E') + call Put_Dig_BS('b',';') " not defined + call assert_equal(['ų', 'Ę', ';'], getline(line('.')-2,line('.'))) + " Caron + call Put_Dig_BS('u','<') + call Put_Dig_BS('<','E') + call Put_Dig_BS('b','<') " not defined + call assert_equal(['ǔ', 'Ě', '<'], getline(line('.')-2,line('.'))) + " Ring above + call Put_Dig_BS('u','0') + call Put_Dig_BS('0','E') " not defined + call Put_Dig_BS('b','0') " not defined + call assert_equal(['ů', 'E', '0'], getline(line('.')-2,line('.'))) + " Hook + call Put_Dig_BS('u','2') + call Put_Dig_BS('2','E') + call Put_Dig_BS('b','2') " not defined + call assert_equal(['ủ', 'Ẻ', '2'], getline(line('.')-2,line('.'))) + " Horn + call Put_Dig_BS('u','9') + call Put_Dig_BS('9','E') " not defined + call Put_Dig_BS('b','9') " not defined + call assert_equal(['ư', 'E', '9'], getline(line('.')-2,line('.'))) + " Cyrillic + call Put_Dig_BS('u','=') + call Put_Dig_BS('=','b') + call Put_Dig_BS('=','_') + call assert_equal(['у', 'б', '〓'], getline(line('.')-2,line('.'))) + " Greek + call Put_Dig_BS('u','*') + call Put_Dig_BS('*','b') + call Put_Dig_BS('*','_') + call assert_equal(['υ', 'β', '々'], getline(line('.')-2,line('.'))) + " Greek/Cyrillic special + call Put_Dig_BS('u','%') + call Put_Dig_BS('%','b') " not defined + call Put_Dig_BS('%','_') " not defined + call assert_equal(['ύ', 'b', '_'], getline(line('.')-2,line('.'))) + " Arabic + call Put_Dig_BS('u','+') + call Put_Dig_BS('+','b') + call Put_Dig_BS('+','_') " japanese industrial symbol + call assert_equal(['+', 'ب', '〄'], getline(line('.')-2,line('.'))) + " Hebrew + call Put_Dig_BS('Q','+') + call Put_Dig_BS('+','B') + call Put_Dig_BS('+','X') + call assert_equal(['ק', 'ב', 'ח'], getline(line('.')-2,line('.'))) + " Latin + call Put_Dig_BS('a','3') + call Put_Dig_BS('A','3') + call Put_Dig_BS('3','X') + call assert_equal(['ǣ', 'Ǣ', 'X'], getline(line('.')-2,line('.'))) + " Bopomofo + call Put_Dig_BS('a','4') + call Put_Dig_BS('A','4') + call Put_Dig_BS('4','X') + call assert_equal(['ㄚ', '4', 'X'], getline(line('.')-2,line('.'))) + " Hiragana + call Put_Dig_BS('a','5') + call Put_Dig_BS('A','5') + call Put_Dig_BS('5','X') + call assert_equal(['あ', 'ぁ', 'X'], getline(line('.')-2,line('.'))) + " Katakana + call Put_Dig_BS('a','6') + call Put_Dig_BS('A','6') + call Put_Dig_BS('6','X') + call assert_equal(['ァ', 'ア', 'X'], getline(line('.')-2,line('.'))) + " Superscripts + call Put_Dig_BS('1','S') + call Put_Dig_BS('2','S') + call Put_Dig_BS('3','S') + call assert_equal(['¹', '²', '³'], getline(line('.')-2,line('.'))) + " Subscripts + call Put_Dig_BS('1','s') + call Put_Dig_BS('2','s') + call Put_Dig_BS('3','s') + call assert_equal(['₁', '₂', '₃'], getline(line('.')-2,line('.'))) + " Eszet (only lowercase) + call Put_Dig_BS("s","s") + call Put_Dig_BS("S","S") " start of string + call assert_equal(["ß", "˜"], getline(line('.')-1,line('.'))) + " High bit set (different from <c-k>) + call Put_Dig_BS("a"," ") + call Put_Dig_BS(" ","A") + call assert_equal([' ', 'A'], getline(line('.')-1,line('.'))) + " Escape is not part of a digraph (different from <c-k>) + call Put_Dig_BS("a","\<esc>") + call Put_Dig_BS("\<esc>","A") + call assert_equal(['', ''], getline(line('.')-1,line('.'))) + " define some custom digraphs + " old: 00 ∞ + " old: el l + digraph 00 9216 + digraph el 0252 + call Put_Dig_BS("0","0") + call Put_Dig_BS("e","l") + " Reset digraphs + digraph 00 8734 + digraph el 108 + call Put_Dig_BS("0","0") + call Put_Dig_BS("e","l") + call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) + set nodigraph ww&vim + bw! +endfunc + +func Test_digraphs_output() + new + let out = execute(':digraph') + call assert_equal('Eu € 8364', matchstr(out, '\C\<Eu\D*8364\>')) + call assert_equal('=e € 8364', matchstr(out, '\C=e\D*8364\>')) + call assert_equal('=R ₽ 8381', matchstr(out, '\C=R\D*8381\>')) + call assert_equal('=P ₽ 8381', matchstr(out, '\C=P\D*8381\>')) + call assert_equal('o: ö 246', matchstr(out, '\C\<o:\D*246\>')) + call assert_equal('v4 ㄪ 12586', matchstr(out, '\C\<v4\D*12586\>')) + call assert_equal("'0 ˚ 730", matchstr(out, '\C''0\D*730\>')) + call assert_equal('Z% Ж 1046', matchstr(out, '\C\<Z%\D*1046\>')) + call assert_equal('u- ū 363', matchstr(out, '\C\<u-\D*363\>')) + call assert_equal('SH ^A 1', matchstr(out, '\C\<SH\D*1\>')) + bw! +endfunc + +func Test_loadkeymap() + if !has('keymap') + return + endif + new + set keymap=czech + set iminsert=0 + call feedkeys("o|\<c-^>|01234567890|\<esc>", 'tx') + call assert_equal("|'é+ěščřžýáíé'", getline('.')) + " reset keymap and encoding option + set keymap= + bw! +endfunc + +func Test_digraph_cmndline() + " Create digraph on commandline + " This is a hack, to let Vim create the digraph in commandline mode + let s = '' + exe "sil! norm! :let s.='\<c-k>Eu'\<cr>" + call assert_equal("€", s) +endfunc + +func Test_show_digraph() + new + call Put_Dig("e=") + call assert_equal("\n<е> 1077, Hex 0435, Oct 2065, Digr e=", execute('ascii')) + bwipe! +endfunc + +func Test_show_digraph_cp1251() + if !has('multi_byte') + return + endif + new + set encoding=cp1251 + call Put_Dig("='") + call assert_equal("\n<\xfa> <|z> <M-z> 250, Hex fa, Oct 372, Digr ='", execute('ascii')) + set encoding=utf-8 + bwipe! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim new file mode 100644 index 0000000000..48b7a2318e --- /dev/null +++ b/src/testdir/test_display.vim @@ -0,0 +1,69 @@ +" Test for displaying stuff +if !has('gui_running') && has('unix') + set term=ansi +endif + +source view_util.vim + +func! Test_display_foldcolumn() + if !has("folding") + return + endif + new + vnew + vert resize 25 + call assert_equal(25, winwidth(winnr())) + set isprint=@ + + 1put='e more noise blah blah‚ more stuff here' + + let expect = [ + \ "e more noise blah blah<82", + \ "> more stuff here " + \ ] + + call cursor(2, 1) + norm! zt + let lines=ScreenLines([1,2], winwidth(0)) + call assert_equal(expect, lines) + set fdc=2 + let lines=ScreenLines([1,2], winwidth(0)) + let expect = [ + \ " e more noise blah blah<", + \ " 82> more stuff here " + \ ] + call assert_equal(expect, lines) + + quit! + quit! +endfunc + +func! Test_display_foldtext_mbyte() + if !has("folding") || !has("multi_byte") + return + endif + call NewWindow(10, 40) + call append(0, range(1,20)) + exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2" + call cursor(2, 1) + norm! zf13G + let lines=ScreenLines([1,3], winwidth(0)+1) + let expect=[ + \ " 1 \u2502", + \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502", + \ " 14 \u2502", + \ ] + call assert_equal(expect, lines) + + set fillchars=fold:-,vert:\| + let lines=ScreenLines([1,3], winwidth(0)+1) + let expect=[ + \ " 1 |", + \ "+ +-- 12 lines: 2". repeat("-", 23). "|", + \ " 14 |", + \ ] + call assert_equal(expect, lines) + + set foldtext& fillchars& foldmethod& fdc& + bw! +endfunc diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim new file mode 100644 index 0000000000..78f7797280 --- /dev/null +++ b/src/testdir/test_edit.vim @@ -0,0 +1,1403 @@ +" Test for edit functions +" +if exists("+t_kD") + let &t_kD="[3;*~" +endif + +" Needed for testing basic rightleft: Test_edit_rightleft +source view_util.vim + +" Needs to come first until the bug in getchar() is +" fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ +func! Test_edit_00b() + new + call setline(1, ['abc ']) + inoreabbr <buffer> h here some more + call cursor(1, 4) + " <c-l> expands the abbreviation and ends insertmode + call feedkeys(":set im\<cr> h\<c-l>:set noim\<cr>", 'tix') + call assert_equal(['abc here some more '], getline(1,'$')) + iunabbr <buffer> h + bw! +endfunc + +func! Test_edit_01() + " set for Travis CI? + " set nocp noesckeys + new + " 1) empty buffer + call assert_equal([''], getline(1,'$')) + " 2) delete in an empty line + call feedkeys("i\<del>\<esc>", 'tnix') + call assert_equal([''], getline(1,'$')) + %d + " 3) delete one character + call setline(1, 'a') + call feedkeys("i\<del>\<esc>", 'tnix') + call assert_equal([''], getline(1,'$')) + %d + " 4) delete a multibyte character + if has("multi_byte") + call setline(1, "\u0401") + call feedkeys("i\<del>\<esc>", 'tnix') + call assert_equal([''], getline(1,'$')) + %d + endif + " 5.1) delete linebreak with 'bs' option containing eol + let _bs=&bs + set bs=eol + call setline(1, ["abc def", "ghi jkl"]) + call cursor(1, 1) + call feedkeys("A\<del>\<esc>", 'tnix') + call assert_equal(['abc defghi jkl'], getline(1, 2)) + %d + " 5.2) delete linebreak with backspace option w/out eol + set bs= + call setline(1, ["abc def", "ghi jkl"]) + call cursor(1, 1) + call feedkeys("A\<del>\<esc>", 'tnix') + call assert_equal(["abc def", "ghi jkl"], getline(1, 2)) + let &bs=_bs + bw! +endfunc + +func! Test_edit_02() + " Change cursor position in InsertCharPre command + new + call setline(1, 'abc') + call cursor(1, 1) + fu! DoIt(...) + call cursor(1, 4) + if len(a:000) + let v:char=a:1 + endif + endfu + au InsertCharPre <buffer> :call DoIt('y') + call feedkeys("ix\<esc>", 'tnix') + call assert_equal(['abcy'], getline(1, '$')) + " Setting <Enter> in InsertCharPre + au! InsertCharPre <buffer> :call DoIt("\n") + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("ix\<esc>", 'tnix') + call assert_equal(['abc', ''], getline(1, '$')) + %d + au! InsertCharPre + " Change cursor position in InsertEnter command + " 1) when setting v:char, keeps changed cursor position + au! InsertEnter <buffer> :call DoIt('y') + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("ix\<esc>", 'tnix') + call assert_equal(['abxc'], getline(1, '$')) + " 2) when not setting v:char, restores changed cursor position + au! InsertEnter <buffer> :call DoIt() + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("ix\<esc>", 'tnix') + call assert_equal(['xabc'], getline(1, '$')) + au! InsertEnter + delfu DoIt + bw! +endfunc + +func! Test_edit_03() + " Change cursor after <c-o> command to end of line + new + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("i\<c-o>$y\<esc>", 'tnix') + call assert_equal(['abcy'], getline(1, '$')) + %d + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("i\<c-o>80|y\<esc>", 'tnix') + call assert_equal(['abcy'], getline(1, '$')) + %d + call setline(1, 'abc') + call feedkeys("Ad\<c-o>:s/$/efg/\<cr>hij", 'tnix') + call assert_equal(['hijabcdefg'], getline(1, '$')) + bw! +endfunc + +func! Test_edit_04() + " test for :stopinsert + new + call setline(1, 'abc') + call cursor(1, 1) + call feedkeys("i\<c-o>:stopinsert\<cr>$", 'tnix') + call feedkeys("aX\<esc>", 'tnix') + call assert_equal(['abcX'], getline(1, '$')) + %d + bw! +endfunc + +func! Test_edit_05() + " test for folds being opened + new + call setline(1, ['abcX', 'abcX', 'zzzZ']) + call cursor(1, 1) + set foldmethod=manual foldopen+=insert + " create fold for those two lines + norm! Vjzf + call feedkeys("$ay\<esc>", 'tnix') + call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$')) + %d + call setline(1, ['abcX', 'abcX', 'zzzZ']) + call cursor(1, 1) + set foldmethod=manual foldopen-=insert + " create fold for those two lines + norm! Vjzf + call feedkeys("$ay\<esc>", 'tnix') + call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$')) + %d + bw! +endfunc + +func! Test_edit_06() + " Test in diff mode + if !has("diff") || !executable("diff") + return + endif + new + call setline(1, ['abc', 'xxx', 'yyy']) + vnew + call setline(1, ['abc', 'zzz', 'xxx', 'yyy']) + wincmd p + diffthis + wincmd p + diffthis + wincmd p + call cursor(2, 1) + norm! zt + call feedkeys("Ozzz\<esc>", 'tnix') + call assert_equal(['abc', 'zzz', 'xxx', 'yyy'], getline(1,'$')) + bw! + bw! +endfunc + +func! Test_edit_07() + " 1) Test with completion <c-l> when popupmenu is visible + new + call setline(1, 'J') + + func! ListMonths() + call complete(col('.')-1, ['January', 'February', 'March', + \ 'April', 'May', 'June', 'July', 'August', 'September', + \ 'October', 'November', 'December']) + return '' + endfunc + inoremap <buffer> <F5> <C-R>=ListMonths()<CR> + + call feedkeys("A\<f5>\<c-p>". repeat("\<down>", 6)."\<c-l>\<down>\<c-l>\<cr>", 'tx') + call assert_equal(['July'], getline(1,'$')) + " 1) Test completion when InsertCharPre kicks in + %d + call setline(1, 'J') + fu! DoIt() + if v:char=='u' + let v:char='an' + endif + endfu + au InsertCharPre <buffer> :call DoIt() + call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx') + call assert_equal(["Jan\<c-l>",''], getline(1,'$')) + %d + call setline(1, 'J') + call feedkeys("A\<f5>\<c-p>u\<down>\<c-l>\<cr>", 'tx') + call assert_equal(["January"], getline(1,'$')) + + delfu ListMonths + delfu DoIt + iunmap <buffer> <f5> + bw! +endfunc + +func! Test_edit_08() + " reset insertmode from i_ctrl-r_= + let g:bufnr = bufnr('%') + new + call setline(1, ['abc']) + call cursor(1, 4) + call feedkeys(":set im\<cr>ZZZ\<c-r>=setbufvar(g:bufnr,'&im', 0)\<cr>",'tnix') + call assert_equal(['abZZZc'], getline(1,'$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + call assert_false(0, '&im') + bw! + unlet g:bufnr +endfunc + +func! Test_edit_09() + " test i_CTRL-\ combinations + new + call setline(1, ['abc', 'def', 'ghi']) + call cursor(1, 1) + " 1) CTRL-\ CTLR-N + call feedkeys(":set im\<cr>\<c-\>\<c-n>ccABC\<c-l>", 'txin') + call assert_equal(['ABC', 'def', 'ghi'], getline(1,'$')) + call setline(1, ['ABC', 'def', 'ghi']) + " 2) CTRL-\ CTLR-G + call feedkeys("j0\<c-\>\<c-g>ZZZ\<cr>\<c-l>", 'txin') + call assert_equal(['ABC', 'ZZZ', 'def', 'ghi'], getline(1,'$')) + call feedkeys("I\<c-\>\<c-g>YYY\<c-l>", 'txin') + call assert_equal(['ABC', 'ZZZ', 'YYYdef', 'ghi'], getline(1,'$')) + set noinsertmode + " 3) CTRL-\ CTRL-O + call setline(1, ['ABC', 'ZZZ', 'def', 'ghi']) + call cursor(1, 1) + call feedkeys("A\<c-o>ix", 'txin') + call assert_equal(['ABxC', 'ZZZ', 'def', 'ghi'], getline(1,'$')) + call feedkeys("A\<c-\>\<c-o>ix", 'txin') + call assert_equal(['ABxCx', 'ZZZ', 'def', 'ghi'], getline(1,'$')) + " 4) CTRL-\ a (should be inserted literally, not special after <c-\> + call setline(1, ['ABC', 'ZZZ', 'def', 'ghi']) + call cursor(1, 1) + call feedkeys("A\<c-\>a", 'txin') + call assert_equal(["ABC\<c-\>a", 'ZZZ', 'def', 'ghi'], getline(1, '$')) + bw! +endfunc + +func! Test_edit_10() + " Test for starting selectmode + new + set selectmode=key keymodel=startsel + call setline(1, ['abc', 'def', 'ghi']) + call cursor(1, 4) + call feedkeys("A\<s-home>start\<esc>", 'txin') + call assert_equal(['startdef', 'ghi'], getline(1, '$')) + set selectmode= keymodel= + bw! +endfunc + +func! Test_edit_11() + " Test that indenting kicks in + new + set cindent + call setline(1, ['{', '', '']) + call cursor(2, 1) + call feedkeys("i\<c-f>int c;\<esc>", 'tnix') + call cursor(3, 1) + call feedkeys("i/* comment */", 'tnix') + call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$')) + " added changed cindentkeys slightly + set cindent cinkeys+=*/ + call setline(1, ['{', '', '']) + call cursor(2, 1) + call feedkeys("i\<c-f>int c;\<esc>", 'tnix') + call cursor(3, 1) + call feedkeys("i/* comment */", 'tnix') + call assert_equal(['{', "\<tab>int c;", "\<tab>/* comment */"], getline(1, '$')) + set cindent cinkeys+==end + call feedkeys("oend\<cr>\<esc>", 'tnix') + call assert_equal(['{', "\<tab>int c;", "\<tab>/* comment */", "\tend", ''], getline(1, '$')) + set cinkeys-==end + %d + " Use indentexpr instead of cindenting + func! Do_Indent() + if v:lnum == 3 + return 3*shiftwidth() + else + return 2*shiftwidth() + endif + endfunc + setl indentexpr=Do_Indent() indentkeys+=*/ + call setline(1, ['{', '', '']) + call cursor(2, 1) + call feedkeys("i\<c-f>int c;\<esc>", 'tnix') + call cursor(3, 1) + call feedkeys("i/* comment */", 'tnix') + call assert_equal(['{', "\<tab>\<tab>int c;", "\<tab>\<tab>\<tab>/* comment */"], getline(1, '$')) + set cinkeys&vim indentkeys&vim + set nocindent indentexpr= + delfu Do_Indent + bw! +endfunc + +func! Test_edit_11_indentexpr() + " Test that indenting kicks in + new + " Use indentexpr instead of cindenting + func! Do_Indent() + let pline=prevnonblank(v:lnum) + if empty(getline(v:lnum)) + if getline(pline) =~ 'if\|then' + return shiftwidth() + else + return 0 + endif + else + return 0 + endif + endfunc + setl indentexpr=Do_Indent() indentkeys+=0=then,0=fi + call setline(1, ['if [ $this ]']) + call cursor(1, 1) + call feedkeys("othen\<cr>that\<cr>fi", 'tnix') + call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$')) + set cinkeys&vim indentkeys&vim + set nocindent indentexpr= + delfu Do_Indent + bw! +endfunc + +func! Test_edit_12() + " Test changing indent in replace mode + new + call setline(1, ["\tabc", "\tdef"]) + call cursor(2, 4) + call feedkeys("R^\<c-d>", 'tnix') + call assert_equal(["\tabc", "def"], getline(1, '$')) + call assert_equal([0, 2, 2, 0], getpos('.')) + %d + call setline(1, ["\tabc", "\t\tdef"]) + call cursor(2, 2) + call feedkeys("R^\<c-d>", 'tnix') + call assert_equal(["\tabc", "def"], getline(1, '$')) + call assert_equal([0, 2, 1, 0], getpos('.')) + %d + call setline(1, ["\tabc", "\t\tdef"]) + call cursor(2, 2) + call feedkeys("R\<c-t>", 'tnix') + call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$')) + call assert_equal([0, 2, 2, 0], getpos('.')) + bw! + 10vnew + call setline(1, ["\tabc", "\t\tdef"]) + call cursor(2, 2) + call feedkeys("R\<c-t>", 'tnix') + call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$')) + call assert_equal([0, 2, 2, 0], getpos('.')) + %d + set sw=4 + call setline(1, ["\tabc", "\t\tdef"]) + call cursor(2, 2) + call feedkeys("R\<c-t>\<c-t>", 'tnix') + call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$')) + call assert_equal([0, 2, 2, 0], getpos('.')) + %d + call setline(1, ["\tabc", "\t\tdef"]) + call cursor(2, 2) + call feedkeys("R\<c-t>\<c-t>", 'tnix') + call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$')) + call assert_equal([0, 2, 2, 0], getpos('.')) + set et + set sw& et& + %d + call setline(1, ["\t/*"]) + set formatoptions=croql + call cursor(1, 3) + call feedkeys("A\<cr>\<cr>/", 'tnix') + call assert_equal(["\t/*", " *", " */"], getline(1, '$')) + set formatoptions& + bw! +endfunc + +func! Test_edit_13() + " Test smartindenting + if exists("+smartindent") + new + set smartindent autoindent + call setline(1, ["\tabc"]) + call feedkeys("A {\<cr>more\<cr>}\<esc>", 'tnix') + call assert_equal(["\tabc {", "\t\tmore", "\t}"], getline(1, '$')) + set smartindent& autoindent& + bw! + endif +endfunc + +func! Test_edit_CR() + " Test for <CR> in insert mode + " basically only in quickfix mode ist tested, the rest + " has been taken care of by other tests + if !has("quickfix") + return + endif + botright new + call writefile(range(1, 10), 'Xqflist.txt') + call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}]) + copen + set modifiable + call feedkeys("A\<cr>", 'tnix') + call assert_equal('Xqflist.txt', bufname('')) + call assert_equal(2, line('.')) + cclose + botright new + call setloclist(0, [{'filename': 'Xqflist.txt', 'lnum': 10}]) + lopen + set modifiable + call feedkeys("A\<cr>", 'tnix') + call assert_equal('Xqflist.txt', bufname('')) + call assert_equal(10, line('.')) + call feedkeys("A\<Enter>", 'tnix') + call feedkeys("A\<kEnter>", 'tnix') + call feedkeys("A\n", 'tnix') + call feedkeys("A\r", 'tnix') + call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$')) + bw! + lclose + call delete('Xqflist.txt') +endfunc + +func! Test_edit_CTRL_() + " disabled for Windows builds, why? + if !has("multi_byte") || !has("rightleft") || has("win32") + return + endif + let _encoding=&encoding + set encoding=utf-8 + " Test for CTRL-_ + new + call setline(1, ['abc']) + call cursor(1, 1) + call feedkeys("i\<c-_>xyz\<esc>", 'tnix') + call assert_equal(["\<C-_>xyzabc"], getline(1, '$')) + call assert_false(&revins) + set ari + call setline(1, ['abc']) + call cursor(1, 1) + call feedkeys("i\<c-_>xyz\<esc>", 'tnix') + call assert_equal(["æèñabc"], getline(1, '$')) + call assert_true(&revins) + call setline(1, ['abc']) + call cursor(1, 1) + call feedkeys("i\<c-_>xyz\<esc>", 'tnix') + call assert_equal(["xyzabc"], getline(1, '$')) + call assert_false(&revins) + set noari + let &encoding=_encoding + bw! +endfunc + +" needs to come first, to have the @. register empty +func! Test_edit_00a_CTRL_A() + " Test pressing CTRL-A + new + call setline(1, repeat([''], 5)) + call cursor(1, 1) + try + call feedkeys("A\<NUL>", 'tnix') + catch /^Vim\%((\a\+)\)\=:E29/ + call assert_true(1, 'E29 error caught') + endtry + call cursor(1, 1) + call feedkeys("Afoobar \<esc>", 'tnix') + call cursor(2, 1) + call feedkeys("A\<c-a>more\<esc>", 'tnix') + call cursor(3, 1) + call feedkeys("A\<NUL>and more\<esc>", 'tnix') + call assert_equal(['foobar ', 'foobar more', 'foobar morend more', '', ''], getline(1, '$')) + bw! +endfunc + +func! Test_edit_CTRL_EY() + " Ctrl-E/ Ctrl-Y in insert mode completion to scroll + 10new + call setline(1, range(1, 100)) + call cursor(30, 1) + norm! z. + call feedkeys("A\<c-x>\<c-e>\<c-e>\<c-e>\<c-e>\<c-e>", 'tnix') + call assert_equal(30, winsaveview()['topline']) + call assert_equal([0, 30, 2, 0], getpos('.')) + call feedkeys("A\<c-x>\<c-e>\<c-e>\<c-e>\<c-e>\<c-e>", 'tnix') + call feedkeys("A\<c-x>".repeat("\<c-y>", 10), 'tnix') + call assert_equal(21, winsaveview()['topline']) + call assert_equal([0, 30, 2, 0], getpos('.')) + bw! +endfunc + +func! Test_edit_CTRL_G() + new + call setline(1, ['foobar', 'foobar', 'foobar']) + call cursor(2, 4) + call feedkeys("ioooooooo\<c-g>k\<c-r>.\<esc>", 'tnix') + call assert_equal(['foooooooooobar', 'foooooooooobar', 'foobar'], getline(1, '$')) + call assert_equal([0, 1, 11, 0], getpos('.')) + call feedkeys("i\<c-g>k\<esc>", 'tnix') + call assert_equal([0, 1, 10, 0], getpos('.')) + call cursor(2, 4) + call feedkeys("i\<c-g>jzzzz\<esc>", 'tnix') + call assert_equal(['foooooooooobar', 'foooooooooobar', 'foozzzzbar'], getline(1, '$')) + call assert_equal([0, 3, 7, 0], getpos('.')) + call feedkeys("i\<c-g>j\<esc>", 'tnix') + call assert_equal([0, 3, 6, 0], getpos('.')) + bw! +endfunc + +func! Test_edit_CTRL_I() + " Tab in completion mode + let path=expand("%:p:h") + new + call setline(1, [path. "/", '']) + call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix') + call assert_match('runtest\.vim', getline(1)) + %d + call writefile(['one', 'two', 'three'], 'Xinclude.txt') + let include='#include Xinclude.txt' + call setline(1, [include, '']) + call cursor(2, 1) + call feedkeys("A\<c-x>\<tab>\<cr>\<esc>", 'tnix') + call assert_equal([include, 'one', ''], getline(1, '$')) + call feedkeys("2ggC\<c-x>\<tab>\<down>\<cr>\<esc>", 'tnix') + call assert_equal([include, 'two', ''], getline(1, '$')) + call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix') + call assert_equal([include, 'three', ''], getline(1, '$')) + call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix') + call assert_equal([include, '', ''], getline(1, '$')) + call delete("Xinclude.txt") + bw! +endfunc + +func! Test_edit_CTRL_K() + " Test pressing CTRL-K (basically only dictionary completion and digraphs + " the rest is already covered + call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') + set dictionary=Xdictionary.txt + new + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<cr>\<esc>", 'tnix') + call assert_equal(['AA', ''], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<down>\<cr>\<esc>", 'tnix') + call assert_equal(['AAA'], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<cr>\<esc>", 'tnix') + call assert_equal(['AAAA'], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix') + call assert_equal(['A'], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<down>\<cr>\<esc>", 'tnix') + call assert_equal(['AA'], getline(1, '$')) + + " press an unexecpted key after dictionary completion + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<c-]>\<cr>\<esc>", 'tnix') + call assert_equal(['AA', ''], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<c-s>\<cr>\<esc>", 'tnix') + call assert_equal(["AA\<c-s>", ''], getline(1, '$')) + %d + call setline(1, 'A') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-k>\<c-f>\<cr>\<esc>", 'tnix') + call assert_equal(["AA\<c-f>", ''], getline(1, '$')) + + set dictionary= + %d + call setline(1, 'A') + call cursor(1, 1) + let v:testing = 1 + try + call feedkeys("A\<c-x>\<c-k>\<esc>", 'tnix') + catch + " error sleeps 2 seconds, when v:testing is not set + let v:testing = 0 + endtry + call delete('Xdictionary.txt') + + if has("multi_byte") + call test_override("char_avail", 1) + set showcmd + %d + call feedkeys("A\<c-k>a:\<esc>", 'tnix') + call assert_equal(['ä'], getline(1, '$')) + call test_override("char_avail", 0) + set noshowcmd + endif + bw! +endfunc + +func! Test_edit_CTRL_L() + " Test Ctrl-X Ctrl-L (line completion) + new + set complete=. + call setline(1, ['one', 'two', 'three', '', '', '', '']) + call cursor(4, 1) + call feedkeys("A\<c-x>\<c-l>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-n>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-p>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) + call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<c-p>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$')) + set complete= + call cursor(5, 1) + call feedkeys("A\<c-x>\<c-l>\<c-p>\<c-n>\<esc>", 'tnix') + call assert_equal(['one', 'two', 'three', 'three', "\<c-l>\<c-p>\<c-n>", '', ''], getline(1, '$')) + set complete& + %d + if has("conceal") && has("syntax") + call setline(1, ['foo', 'bar', 'foobar']) + call test_override("char_avail", 1) + set conceallevel=2 concealcursor=n + syn on + syn match ErrorMsg "^bar" + call matchadd("Conceal", 'oo', 10, -1, {'conceal': 'X'}) + func! DoIt() + let g:change=1 + endfunc + au! TextChangedI <buffer> :call DoIt() + + call cursor(2, 1) + call assert_false(exists("g:change")) + call feedkeys("A \<esc>", 'tnix') + call assert_equal(['foo', 'bar ', 'foobar'], getline(1, '$')) + call assert_equal(1, g:change) + + call test_override("char_avail", 0) + call clearmatches() + syn off + au! TextChangedI + delfu DoIt + unlet! g:change + endif + bw! +endfunc + +func! Test_edit_CTRL_N() + " Check keyword completion + new + set complete=. + call setline(1, ['INFER', 'loWER', '', '', ]) + call cursor(3, 1) + call feedkeys("Ai\<c-n>\<cr>\<esc>", "tnix") + call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['INFER', 'loWER', 'i', 'LO', '', ''], getline(1, '$')) + %d + call setline(1, ['INFER', 'loWER', '', '', ]) + call cursor(3, 1) + set ignorecase infercase + call feedkeys("Ii\<c-n>\<cr>\<esc>", "tnix") + call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['INFER', 'loWER', 'infer', 'LOWER', '', ''], getline(1, '$')) + + set noignorecase noinfercase complete& + bw! +endfunc + +func! Test_edit_CTRL_O() + " Check for CTRL-O in insert mode + new + inoreabbr <buffer> h here some more + call setline(1, ['abc', 'def']) + call cursor(1, 1) + " Ctrl-O after an abbreviation + exe "norm A h\<c-o>:set nu\<cr> text" + call assert_equal(['abc here some more text', 'def'], getline(1, '$')) + call assert_true(&nu) + set nonu + iunabbr <buffer> h + " Ctrl-O at end of line with 've'=onemore + call cursor(1, 1) + call feedkeys("A\<c-o>:let g:a=getpos('.')\<cr>\<esc>", 'tnix') + call assert_equal([0, 1, 23, 0], g:a) + call cursor(1, 1) + set ve=onemore + call feedkeys("A\<c-o>:let g:a=getpos('.')\<cr>\<esc>", 'tnix') + call assert_equal([0, 1, 24, 0], g:a) + set ve= + unlet! g:a + bw! +endfunc + +func! Test_edit_CTRL_R() + " Insert Register + new + call test_override("ALL", 1) + set showcmd + call feedkeys("AFOOBAR eins zwei\<esc>", 'tnix') + call feedkeys("O\<c-r>.", 'tnix') + call feedkeys("O\<c-r>=10*500\<cr>\<esc>", 'tnix') + call feedkeys("O\<c-r>=getreg('=', 1)\<cr>\<esc>", 'tnix') + call assert_equal(["getreg('=', 1)", '5000', "FOOBAR eins zwei", "FOOBAR eins zwei"], getline(1, '$')) + call test_override("ALL", 0) + set noshowcmd + bw! +endfunc + +func! Test_edit_CTRL_S() + " Test pressing CTRL-S (basically only spellfile completion) + " the rest is already covered + new + if !has("spell") + call setline(1, 'vim') + call feedkeys("A\<c-x>ss\<cr>\<esc>", 'tnix') + call assert_equal(['vims', ''], getline(1, '$')) + bw! + return + endif + call setline(1, 'vim') + " spell option not yet set + try + call feedkeys("A\<c-x>\<c-s>\<cr>\<esc>", 'tnix') + catch /^Vim\%((\a\+)\)\=:E756/ + call assert_true(1, 'error caught') + endtry + call assert_equal(['vim', ''], getline(1, '$')) + %d + setl spell spelllang=en + call setline(1, 'vim') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-s>\<cr>\<esc>", 'tnix') + call assert_equal(['Vim', ''], getline(1, '$')) + %d + call setline(1, 'vim') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-s>\<down>\<cr>\<esc>", 'tnix') + call assert_equal(['Aim'], getline(1, '$')) + %d + call setline(1, 'vim') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-s>\<c-p>\<cr>\<esc>", 'tnix') + call assert_equal(['vim', ''], getline(1, '$')) + %d + " empty buffer + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-s>\<c-p>\<cr>\<esc>", 'tnix') + call assert_equal(['', ''], getline(1, '$')) + setl nospell + bw! +endfunc + +func! Test_edit_CTRL_T() + " Check for CTRL-T and CTRL-X CTRL-T in insert mode + " 1) increase indent + new + call setline(1, "abc") + call cursor(1, 1) + call feedkeys("A\<c-t>xyz", 'tnix') + call assert_equal(["\<tab>abcxyz"], getline(1, '$')) + " 2) also when paste option is set + set paste + call setline(1, "abc") + call cursor(1, 1) + call feedkeys("A\<c-t>xyz", 'tnix') + call assert_equal(["\<tab>abcxyz"], getline(1, '$')) + set nopaste + " CTRL-X CTRL-T (thesaurus complete) + call writefile(['angry furious mad enraged'], 'Xthesaurus') + set thesaurus=Xthesaurus + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<cr>\<esc>", 'tnix') + call assert_equal(['mad', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['angry', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['furious', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['enraged', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['mad', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['mad', ''], getline(1, '$')) + " Using <c-p> <c-n> when 'complete' is empty + set complete= + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['angry', ''], getline(1, '$')) + %d + call setline(1, 'mad') + call cursor(1, 1) + call feedkeys("A\<c-x>\<c-t>\<c-p>\<cr>\<esc>", 'tnix') + call assert_equal(['mad', ''], getline(1, '$')) + set complete& + + set thesaurus= + %d + call setline(1, 'mad') + call cursor(1, 1) + let v:testing = 1 + try + call feedkeys("A\<c-x>\<c-t>\<esc>", 'tnix') + catch + " error sleeps 2 seconds, when v:testing is not set + let v:testing = 0 + endtry + call assert_equal(['mad'], getline(1, '$')) + call delete('Xthesaurus') + bw! +endfunc + +func! Test_edit_CTRL_U() + " Test 'completefunc' + new + " -1, -2 and -3 are special return values + let g:special=0 + fun! CompleteMonths(findstart, base) + if a:findstart + " locate the start of the word + return g:special + else + " find months matching with "a:base" + let res = [] + for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") + if m =~ '^\c'.a:base + call add(res, {'word': m, 'abbr': m.' Month', 'icase': 0}) + endif + endfor + return {'words': res, 'refresh': 'always'} + endif + endfun + set completefunc=CompleteMonths + call setline(1, ['', '']) + call cursor(1, 1) + call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix') + call assert_equal(['X', '', ''], getline(1, '$')) + %d + let g:special=-1 + call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix') + call assert_equal(['XJan', ''], getline(1, '$')) + %d + let g:special=-2 + call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix') + call assert_equal(['X', ''], getline(1, '$')) + %d + let g:special=-3 + call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix') + call assert_equal(['X', ''], getline(1, '$')) + %d + let g:special=0 + call feedkeys("AM\<c-x>\<c-u>\<cr>\<esc>", 'tnix') + call assert_equal(['Mar', ''], getline(1, '$')) + %d + call feedkeys("AM\<c-x>\<c-u>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['May', ''], getline(1, '$')) + %d + call feedkeys("AM\<c-x>\<c-u>\<c-n>\<c-n>\<cr>\<esc>", 'tnix') + call assert_equal(['M', ''], getline(1, '$')) + delfu CompleteMonths + %d + try + call feedkeys("A\<c-x>\<c-u>", 'tnix') + call assert_fails(1, 'unknown completion function') + catch /^Vim\%((\a\+)\)\=:E117/ + call assert_true(1, 'E117 error caught') + endtry + set completefunc= + bw! +endfunc + +func! Test_edit_CTRL_Z() + " Ctrl-Z when insertmode is not set inserts it literally + new + call setline(1, 'abc') + call feedkeys("A\<c-z>\<esc>", 'tnix') + call assert_equal(["abc\<c-z>"], getline(1,'$')) + bw! + " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend? +endfunc + +func! Test_edit_DROP() + if !has("dnd") + return + endif + new + call setline(1, ['abc def ghi']) + call cursor(1, 1) + try + call feedkeys("i\<Drop>\<Esc>", 'tnix') + call assert_fails(1, 'Invalid register name') + catch /^Vim\%((\a\+)\)\=:E353/ + call assert_true(1, 'error caught') + endtry + bw! +endfunc + +func! Test_edit_CTRL_V() + if has("ebcdic") + return + endif + new + call setline(1, ['abc']) + call cursor(2, 1) + " force some redraws + set showmode showcmd + "call test_override_char_avail(1) + call test_override('ALL', 1) + call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix') + call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$')) + + if has("rightleft") && exists("+rl") + set rl + call setline(1, ['abc']) + call cursor(2, 1) + call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix') + call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$')) + set norl + endif + + call test_override('ALL', 0) + set noshowmode showcmd + bw! +endfunc + +func! Test_edit_F1() + " Pressing <f1> + new + call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix') + set noinsertmode + call assert_equal('help', &buftype) + bw + bw +endfunc + +func! Test_edit_F21() + " Pressing <f21> + " sends a netbeans command + if has("netbeans_intg") + new + " I have no idea what this is supposed to do :) + call feedkeys("A\<F21>\<F1>\<esc>", 'tnix') + bw + endif +endfunc + +func! Test_edit_HOME_END() + " Test Home/End Keys + new + set foldopen+=hor + call setline(1, ['abc', 'def']) + call cursor(1, 1) + call feedkeys("AX\<Home>Y\<esc>", 'tnix') + call cursor(2, 1) + call feedkeys("iZ\<End>Y\<esc>", 'tnix') + call assert_equal(['YabcX', 'ZdefY'], getline(1, '$')) + + set foldopen-=hor + bw! +endfunc + +func! Test_edit_INS() + " Test for Pressing <Insert> + new + call setline(1, ['abc', 'def']) + call cursor(1, 1) + call feedkeys("i\<Insert>ZYX>", 'tnix') + call assert_equal(['ZYX>', 'def'], getline(1, '$')) + call setline(1, ['abc', 'def']) + call cursor(1, 1) + call feedkeys("i\<Insert>Z\<Insert>YX>", 'tnix') + call assert_equal(['ZYX>bc', 'def'], getline(1, '$')) + bw! +endfunc + +func! Test_edit_LEFT_RIGHT() + " Left, Shift-Left, Right, Shift-Right + new + call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX']) + let _ww=&ww + set ww= + call cursor(2, 1) + call feedkeys("i\<left>\<esc>", 'tnix') + call assert_equal([0, 2, 1, 0], getpos('.')) + " Is this a bug, <s-left> does not respect whichwrap option + call feedkeys("i\<s-left>\<esc>", 'tnix') + call assert_equal([0, 1, 8, 0], getpos('.')) + call feedkeys("i". repeat("\<s-left>", 3). "\<esc>", 'tnix') + call assert_equal([0, 1, 1, 0], getpos('.')) + call feedkeys("i\<right>\<esc>", 'tnix') + call assert_equal([0, 1, 1, 0], getpos('.')) + call feedkeys("i\<right>\<right>\<esc>", 'tnix') + call assert_equal([0, 1, 2, 0], getpos('.')) + call feedkeys("A\<right>\<esc>", 'tnix') + call assert_equal([0, 1, 11, 0], getpos('.')) + call feedkeys("A\<s-right>\<esc>", 'tnix') + call assert_equal([0, 2, 1, 0], getpos('.')) + call feedkeys("i\<s-right>\<esc>", 'tnix') + call assert_equal([0, 2, 4, 0], getpos('.')) + call cursor(3, 11) + call feedkeys("A\<right>\<esc>", 'tnix') + call feedkeys("A\<s-right>\<esc>", 'tnix') + call assert_equal([0, 3, 11, 0], getpos('.')) + call cursor(2, 11) + " <S-Right> does not respect 'whichwrap' option + call feedkeys("A\<s-right>\<esc>", 'tnix') + call assert_equal([0, 3, 1, 0], getpos('.')) + " Check motion when 'whichwrap' contains cursor keys for insert mode + set ww+=[,] + call cursor(2, 1) + call feedkeys("i\<left>\<esc>", 'tnix') + call assert_equal([0, 1, 11, 0], getpos('.')) + call cursor(2, 11) + call feedkeys("A\<right>\<esc>", 'tnix') + call assert_equal([0, 3, 1, 0], getpos('.')) + call cursor(2, 11) + call feedkeys("A\<s-right>\<esc>", 'tnix') + call assert_equal([0, 3, 1, 0], getpos('.')) + let &ww = _ww + bw! +endfunc + +func! Test_edit_MOUSE() + " This is a simple test, since we not really using the mouse here + if !has("mouse") || (has("gui_macvim") && has("gui_running")) + return + endif + 10new + call setline(1, range(1, 100)) + call cursor(1, 1) + set mouse=a + call feedkeys("A\<ScrollWheelDown>\<esc>", 'tnix') + call assert_equal([0, 4, 1, 0], getpos('.')) + " This should move by one pageDown, but only moves + " by one line when the test is run... + call feedkeys("A\<S-ScrollWheelDown>\<esc>", 'tnix') + call assert_equal([0, 5, 1, 0], getpos('.')) + set nostartofline + call feedkeys("A\<C-ScrollWheelDown>\<esc>", 'tnix') + call assert_equal([0, 6, 1, 0], getpos('.')) + call feedkeys("A\<LeftMouse>\<esc>", 'tnix') + call assert_equal([0, 6, 1, 0], getpos('.')) + call feedkeys("A\<RightMouse>\<esc>", 'tnix') + call assert_equal([0, 6, 1, 0], getpos('.')) + call cursor(1, 100) + norm! zt + " this should move by a screen up, but when the test + " is run, it moves up to the top of the buffer... + call feedkeys("A\<ScrollWheelUp>\<esc>", 'tnix') + call assert_equal([0, 1, 1, 0], getpos('.')) + call cursor(1, 30) + norm! zt + call feedkeys("A\<S-ScrollWheelUp>\<esc>", 'tnix') + call assert_equal([0, 1, 1, 0], getpos('.')) + call cursor(1, 30) + norm! zt + call feedkeys("A\<C-ScrollWheelUp>\<esc>", 'tnix') + call assert_equal([0, 1, 1, 0], getpos('.')) + %d + call setline(1, repeat(["12345678901234567890"], 100)) + call cursor(2, 1) + call feedkeys("A\<ScrollWheelRight>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + call feedkeys("A\<ScrollWheelLeft>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + call feedkeys("A\<S-ScrollWheelRight>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + call feedkeys("A\<S-ScrollWheelLeft>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + call feedkeys("A\<C-ScrollWheelRight>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + call feedkeys("A\<C-ScrollWheelLeft>\<esc>", 'tnix') + call assert_equal([0, 2, 20, 0], getpos('.')) + set mouse& startofline + bw! +endfunc + +func! Test_edit_PAGEUP_PAGEDOWN() + 10new + call setline(1, repeat(['abc def ghi'], 30)) + call cursor(1, 1) + call feedkeys("i\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 9, 1, 0], getpos('.')) + call feedkeys("i\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 17, 1, 0], getpos('.')) + call feedkeys("i\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 25, 1, 0], getpos('.')) + call feedkeys("i\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 30, 1, 0], getpos('.')) + call feedkeys("i\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 30, 1, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 29, 1, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 21, 1, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 13, 1, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 5, 1, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + " <S-Up> is the same as <PageUp> + " <S-Down> is the same as <PageDown> + call cursor(1, 1) + call feedkeys("i\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 9, 1, 0], getpos('.')) + call feedkeys("i\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 17, 1, 0], getpos('.')) + call feedkeys("i\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 25, 1, 0], getpos('.')) + call feedkeys("i\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 30, 1, 0], getpos('.')) + call feedkeys("i\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 30, 1, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 29, 1, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 21, 1, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 13, 1, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 5, 1, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + set nostartofline + call cursor(30, 11) + norm! zt + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 29, 11, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 21, 11, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 13, 11, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + call feedkeys("A\<PageUp>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + call cursor(1, 1) + call feedkeys("A\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 9, 11, 0], getpos('.')) + call feedkeys("A\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 17, 11, 0], getpos('.')) + call feedkeys("A\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 25, 11, 0], getpos('.')) + call feedkeys("A\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 30, 11, 0], getpos('.')) + call feedkeys("A\<PageDown>\<esc>", 'tnix') + call assert_equal([0, 30, 11, 0], getpos('.')) + " <S-Up> is the same as <PageUp> + " <S-Down> is the same as <PageDown> + call cursor(30, 11) + norm! zt + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 29, 11, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 21, 11, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 13, 11, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + call feedkeys("A\<S-Up>\<esc>", 'tnix') + call assert_equal([0, 5, 11, 0], getpos('.')) + call cursor(1, 1) + call feedkeys("A\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 9, 11, 0], getpos('.')) + call feedkeys("A\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 17, 11, 0], getpos('.')) + call feedkeys("A\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 25, 11, 0], getpos('.')) + call feedkeys("A\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 30, 11, 0], getpos('.')) + call feedkeys("A\<S-Down>\<esc>", 'tnix') + call assert_equal([0, 30, 11, 0], getpos('.')) + bw! +endfunc + +func! Test_edit_forbidden() + new + " 1) edit in the sandbox is not allowed + call setline(1, 'a') + com! Sandbox :sandbox call feedkeys("i\<del>\<esc>", 'tnix') + call assert_fails(':Sandbox', 'E48:') + com! Sandbox :sandbox exe "norm! i\<del>" + call assert_fails(':Sandbox', 'E48:') + delcom Sandbox + call assert_equal(['a'], getline(1,'$')) + " 2) edit with textlock set + fu! DoIt() + call feedkeys("i\<del>\<esc>", 'tnix') + endfu + au InsertCharPre <buffer> :call DoIt() + try + call feedkeys("ix\<esc>", 'tnix') + call assert_fails(1, 'textlock') + catch /^Vim\%((\a\+)\)\=:E523/ " catch E523: not allowed here + endtry + " TODO: Might be a bug: should x really be inserted here + call assert_equal(['xa'], getline(1, '$')) + delfu DoIt + try + call feedkeys("ix\<esc>", 'tnix') + call assert_fails(1, 'unknown function') + catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function + endtry + au! InsertCharPre + " 3) edit when completion is shown + fun! Complete(findstart, base) + if a:findstart + return col('.') + else + call feedkeys("i\<del>\<esc>", 'tnix') + return [] + endif + endfun + set completefunc=Complete + try + call feedkeys("i\<c-x>\<c-u>\<esc>", 'tnix') + call assert_fails(1, 'change in complete function') + catch /^Vim\%((\a\+)\)\=:E523/ " catch E523 + endtry + delfu Complete + set completefunc= + if has("rightleft") && exists("+fkmap") + " 4) 'R' when 'fkmap' and 'revins' is set. + set revins fkmap + try + normal Ri + call assert_fails(1, "R with 'fkmap' and 'ri' set") + catch + finally + set norevins nofkmap + endtry + endif + bw! +endfunc + +func! Test_edit_rightleft() + " Cursor in rightleft mode moves differently + if !exists("+rightleft") + return + endif + call NewWindow(10, 20) + call setline(1, ['abc', 'def', 'ghi']) + call cursor(1, 2) + set rightleft + " Screen looks as expected + let lines = ScreenLines([1, 4], winwidth(0)) + let expect = [ + \" cba", + \" fed", + \" ihg", + \" ~"] + call assert_equal(join(expect, "\n"), join(lines, "\n")) + " 2) right moves to the left + call feedkeys("i\<right>\<esc>x", 'txin') + call assert_equal(['bc', 'def', 'ghi'], getline(1,'$')) + call cursor(1, 2) + call feedkeys("i\<s-right>\<esc>", 'txin') + call cursor(1, 2) + call feedkeys("i\<c-right>\<esc>", 'txin') + " Screen looks as expected + let lines = ScreenLines([1, 4], winwidth(0)) + let expect = [ + \" cb", + \" fed", + \" ihg", + \" ~"] + call assert_equal(join(expect, "\n"), join(lines, "\n")) + " 2) left moves to the right + call setline(1, ['abc', 'def', 'ghi']) + call cursor(1, 2) + call feedkeys("i\<left>\<esc>x", 'txin') + call assert_equal(['ac', 'def', 'ghi'], getline(1,'$')) + call cursor(1, 2) + call feedkeys("i\<s-left>\<esc>", 'txin') + call cursor(1, 2) + call feedkeys("i\<c-left>\<esc>", 'txin') + " Screen looks as expected + let lines = ScreenLines([1, 4], winwidth(0)) + let expect = [ + \" ca", + \" fed", + \" ihg", + \" ~"] + call assert_equal(join(expect, "\n"), join(lines, "\n")) + set norightleft + bw! +endfunc + +func Test_edit_complete_very_long_name() + if !has('unix') + " Long directory names only work on Unix. + return + endif + + let dirname = getcwd() . "/Xdir" + let longdirname = dirname . repeat('/' . repeat('d', 255), 4) + try + call mkdir(longdirname, 'p') + catch /E739:/ + " Long directory name probably not supported. + call delete(dirname, 'rf') + return + endtry + + " Try to get the Vim window position before setting 'columns'. + let winposx = getwinposx() + let winposy = getwinposy() + let save_columns = &columns + " Need at least about 1100 columns to reproduce the problem. + set columns=2000 + set noswapfile + + let longfilename = longdirname . '/' . repeat('a', 255) + call writefile(['Totum', 'Table'], longfilename) + new + exe "next Xfile " . longfilename + exe "normal iT\<C-N>" + + bwipe! + exe 'bwipe! ' . longfilename + call delete(dirname, 'rf') + let &columns = save_columns + if winposx >= 0 && winposy >= 0 + exe 'winpos ' . winposx . ' ' . winposy + endif + set swapfile& +endfunc + +func Test_edit_quit() + edit foo.txt + split + new + call setline(1, 'hello') + 3wincmd w + redraw! + call assert_fails('1q', 'E37:') + bwipe! foo.txt + only +endfunc + +func Test_edit_alt() + " Keeping the cursor line didn't happen when the first line has indent. + new + call setline(1, [' one', 'two', 'three']) + w XAltFile + $ + call assert_equal(3, line('.')) + e Xother + e # + call assert_equal(3, line('.')) + + bwipe XAltFile + call delete('XAltFile') +endfunc diff --git a/src/testdir/test_erasebackword.vim b/src/testdir/test_erasebackword.vim new file mode 100644 index 0000000000..098d6edfcb --- /dev/null +++ b/src/testdir/test_erasebackword.vim @@ -0,0 +1,25 @@ + +func Test_erasebackword() + if !has('multi_byte') + return + endif + + set encoding=utf-8 + enew + + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>" + call assert_equal(' wwwこんにちわ世界ワールド', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>" + call assert_equal(' wwwこんにちわ世界', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>" + call assert_equal(' wwwこんにちわ', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal(' www', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal(' ', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal('', getline('.')) + + enew! + set encoding& +endfunc diff --git a/src/testdir/test_escaped_glob.vim b/src/testdir/test_escaped_glob.vim new file mode 100644 index 0000000000..e0723da6f0 --- /dev/null +++ b/src/testdir/test_escaped_glob.vim @@ -0,0 +1,32 @@ +" Test whether glob()/globpath() return correct results with certain escaped +" characters. + +function SetUp() + " make sure glob() doesn't use the shell + set shell=doesnotexist + " consistent sorting of file names + set nofileignorecase +endfunction + +function Test_glob() + if !has('unix') + " This test fails on Windows because of the special characters in the + " filenames. Disable the test on non-Unix systems for now. + return + endif + call assert_equal("", glob('Xxx\{')) + call assert_equal("", glob('Xxx\$')) + w! Xxx{ + w! Xxx\$ + call assert_equal("Xxx{", glob('Xxx\{')) + call assert_equal("Xxx$", glob('Xxx\$')) + call delete('Xxx{') + call delete('Xxx$') +endfunction + +function Test_globpath() + call assert_equal("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim", + \ globpath('sautest/autoload', 'glob*.vim')) + call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'], + \ globpath('sautest/autoload', 'glob*.vim', 0, 1)) +endfunction diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in index cd605af56e..3b61442577 100644 --- a/src/testdir/test_eval.in +++ b/src/testdir/test_eval.in @@ -1,7 +1,11 @@ Test for various eval features. vim: set ft=vim : -Note: system clipboard support is not tested. I do not think anybody will thank -me for messing with clipboard. +NOTE: Do not add more here, use new style test test_eval_stuff.vim + +Note: system clipboard is saved, changed and restored. + +clipboard contents +something else STARTTEST :so small.vim @@ -9,7 +13,10 @@ STARTTEST :set noswapfile :lang C :fun AppendRegContents(reg) - call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1)))) + call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))) +:endfun +:fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1) + call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1)) endfun :command -nargs=? AR :call AppendRegContents(<q-args>) :fun SetReg(...) @@ -122,7 +129,24 @@ call SetReg('/', ['abc/']) call SetReg('/', ["abc/\n"]) call SetReg('=', ['"abc/"']) call SetReg('=', ["\"abc/\n\""]) - +$put ='{{{1 System clipboard' +if has('clipboard') +" Save and restore system clipboard. +" If no connection to X-Server is possible, test should succeed. +let _clipreg = ['*', getreg('*'), getregtype('*')] +let _clipopt = &cb +let &cb='unnamed' +7y +AR * +tabdo :windo :echo "hi" +8y +AR * +let &cb=_clipopt +call call('setreg', _clipreg) +else + call AppendRegParts('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']") + call AppendRegParts('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']") +endif $put ='{{{1 Errors' call ErrExe('call setreg()') call ErrExe('call setreg(1)') @@ -196,6 +220,24 @@ endfun 0:call setpos('.', sp) jyl:$put :" +:" substring and variable name +:let str = 'abcdef' +:let n = 3 +:$put =str[n:] +:$put =str[:n] +:$put =str[n:n] +:unlet n +:let nn = 3 +:$put =str[nn:] +:$put =str[:nn] +:$put =str[nn:nn] +:unlet nn +:let b:nn = 4 +:$put =str[b:nn:] +:$put =str[:b:nn] +:$put =str[b:nn:b:nn] +:unlet b:nn +:" :/^start:/+1,$wq! test.out :" vim: et ts=4 isk-=\: fmr=???,??? :call getchar() diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok index 59112d028e..9ffa54157f 100644 Binary files a/src/testdir/test_eval.ok and b/src/testdir/test_eval.ok differ diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim new file mode 100644 index 0000000000..41ba1374d8 --- /dev/null +++ b/src/testdir/test_eval_stuff.vim @@ -0,0 +1,44 @@ +" Tests for various eval things. + +function s:foo() abort + try + return [] == 0 + catch + return 1 + endtry +endfunction + +func Test_catch_return_with_error() + call assert_equal(1, s:foo()) +endfunc + +func Test_nocatch_restore_silent_emsg() + silent! try + throw 1 + catch + endtry + echoerr 'wrong' + let c1 = nr2char(screenchar(&lines, 1)) + let c2 = nr2char(screenchar(&lines, 2)) + let c3 = nr2char(screenchar(&lines, 3)) + let c4 = nr2char(screenchar(&lines, 4)) + let c5 = nr2char(screenchar(&lines, 5)) + call assert_equal('wrong', c1 . c2 . c3 . c4 . c5) +endfunc + +func Test_mkdir_p() + call mkdir('Xmkdir/nested', 'p') + call assert_true(isdirectory('Xmkdir/nested')) + try + " Trying to make existing directories doesn't error + call mkdir('Xmkdir', 'p') + call mkdir('Xmkdir/nested', 'p') + catch /E739:/ + call assert_report('mkdir(..., "p") failed for an existing directory') + endtry + " 'p' doesn't suppress real errors + call writefile([], 'Xfile') + call assert_fails('call mkdir("Xfile", "p")', 'E739') + call delete('Xfile') + call delete('Xmkdir', 'rf') +endfunc diff --git a/src/testdir/test_ex_undo.vim b/src/testdir/test_ex_undo.vim new file mode 100644 index 0000000000..44feb3680a --- /dev/null +++ b/src/testdir/test_ex_undo.vim @@ -0,0 +1,19 @@ +" Tests for :undo + +func Test_ex_undo() + new ex-undo + setlocal ul=10 + exe "normal ione\n\<Esc>" + setlocal ul=10 + exe "normal itwo\n\<Esc>" + setlocal ul=10 + exe "normal ithree\n\<Esc>" + call assert_equal(4, line('$')) + undo + call assert_equal(3, line('$')) + undo 1 + call assert_equal(2, line('$')) + undo 0 + call assert_equal(1, line('$')) + quit! +endfunc diff --git a/src/testdir/test_ex_z.vim b/src/testdir/test_ex_z.vim new file mode 100644 index 0000000000..6e03b0bff9 --- /dev/null +++ b/src/testdir/test_ex_z.vim @@ -0,0 +1,85 @@ +" Test :z + +func Test_z() + call setline(1, range(1, 100)) + + let a = execute('20z3') + call assert_equal("\n20\n21\n22", a) + call assert_equal(22, line('.')) + " 'window' should be set to the {count} value. + call assert_equal(3, &window) + + " If there is only one window, then twice the amount of 'scroll' is used. + set scroll=2 + let a = execute('20z') + call assert_equal("\n20\n21\n22\n23", a) + call assert_equal(23, line('.')) + + let a = execute('20z+3') + " FIXME: I would expect the same result as '20z3' but it + " gives "\n21\n22\n23" instead. Bug in Vim or in ":help :z"? + "call assert_equal("\n20\n21\n22", a) + "call assert_equal(22, line('.')) + + let a = execute('20z-3') + call assert_equal("\n18\n19\n20", a) + call assert_equal(20, line('.')) + + let a = execute('20z=3') + call assert_match("^\n18\n19\n-\\+\n20\n-\\+\n21\n22$", a) + call assert_equal(20, line('.')) + + let a = execute('20z^3') + call assert_equal("\n14\n15\n16\n17", a) + call assert_equal(17, line('.')) + + let a = execute('20z.3') + call assert_equal("\n19\n20\n21", a) + call assert_equal(21, line('.')) + + let a = execute('20z#3') + call assert_equal("\n 20 20\n 21 21\n 22 22", a) + call assert_equal(22, line('.')) + + let a = execute('20z#-3') + call assert_equal("\n 18 18\n 19 19\n 20 20", a) + call assert_equal(20, line('.')) + + let a = execute('20z#=3') + call assert_match("^\n 18 18\n 19 19\n-\\+\n 20 20\n-\\+\n 21 21\n 22 22$", a) + call assert_equal(20, line('.')) + + " Test with {count} bigger than the number of lines in buffer. + let a = execute('20z1000') + call assert_match("^\n20\n21\n.*\n99\n100$", a) + call assert_equal(100, line('.')) + + let a = execute('20z-1000') + call assert_match("^\n1\n2\n.*\n19\n20$", a) + call assert_equal(20, line('.')) + + let a = execute('20z=1000') + call assert_match("^\n1\n.*\n-\\+\n20\n-\\\+\n.*\n100$", a) + call assert_equal(20, line('.')) + + call assert_fails('20z=a', 'E144:') + + set window& scroll& + bw! +endfunc + +func Test_z_overflow() + " This used to access invalid memory as a result of an integer overflow + " and freeze vim. + normal ox + normal Heat + z777777776666666 + ') +endfunc + +func Test_z_negative_lnum() + new + z^ + call assert_equal(1, line('.')) + bwipe! +endfunc diff --git a/src/testdir/test_exec_while_if.vim b/src/testdir/test_exec_while_if.vim new file mode 100644 index 0000000000..d6afabff45 --- /dev/null +++ b/src/testdir/test_exec_while_if.vim @@ -0,0 +1,53 @@ +" Test for :execute, :while and :if + +function Test_exec_while_if() + new + + let i = 0 + while i < 12 + let i = i + 1 + if has("ebcdic") + execute "normal o" . i . "\047" + else + execute "normal o" . i . "\033" + endif + if i % 2 + normal Ax + if i == 9 + break + endif + if i == 5 + continue + else + let j = 9 + while j > 0 + if has("ebcdic") + execute "normal" j . "a" . j . "\x27" + else + execute "normal" j . "a" . j . "\x1b" + endif + let j = j - 1 + endwhile + endif + endif + if i == 9 + if has("ebcdic") + execute "normal Az\047" + else + execute "normal Az\033" + endif + endif + endwhile + unlet i j + + call assert_equal(["", + \ "1x999999999888888887777777666666555554444333221", + \ "2", + \ "3x999999999888888887777777666666555554444333221", + \ "4", + \ "5x", + \ "6", + \ "7x999999999888888887777777666666555554444333221", + \ "8", + \ "9x"], getline(1, 10)) +endfunction diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim new file mode 100644 index 0000000000..dd07e4a62b --- /dev/null +++ b/src/testdir/test_execute_func.vim @@ -0,0 +1,51 @@ +" test execute() + +func NestedEval() + let nested = execute('echo "nested\nlines"') + echo 'got: "' . nested . '"' +endfunc + +func NestedRedir() + redir => var + echo 'broken' + redir END +endfunc + +func Test_execute_string() + call assert_equal("\nnocompatible", execute('set compatible?')) + call assert_equal("\nsomething\nnice", execute('echo "something\nnice"')) + call assert_equal("noendofline", execute('echon "noendofline"')) + call assert_equal("", execute(123)) + + call assert_equal("\ngot: \"\nnested\nlines\"", execute('call NestedEval()')) + redir => redired + echo 'this' + let evaled = execute('echo "that"') + echo 'theend' + redir END + call assert_equal("\nthis\ntheend", redired) + call assert_equal("\nthat", evaled) + + call assert_fails('call execute("doesnotexist")', 'E492:') + call assert_fails('call execute(3.4)', 'E806:') + call assert_fails('call execute("call NestedRedir()")', 'E930:') + + call assert_equal("\nsomething", execute('echo "something"', '')) + call assert_equal("\nsomething", execute('echo "something"', 'silent')) + call assert_equal("\nsomething", execute('echo "something"', 'silent!')) + call assert_equal("", execute('burp', 'silent!')) + call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:') + + call assert_equal("", execute(test_null_string())) +endfunc + +func Test_execute_list() + call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"'])) + let l = ['for n in range(0, 3)', + \ 'echo n', + \ 'endfor'] + call assert_equal("\n0\n1\n2\n3", execute(l)) + + call assert_equal("", execute([])) + call assert_equal("", execute(test_null_list())) +endfunc diff --git a/src/testdir/test_exists.vim b/src/testdir/test_exists.vim new file mode 100644 index 0000000000..fd34be83b0 --- /dev/null +++ b/src/testdir/test_exists.vim @@ -0,0 +1,321 @@ +" Tests for the exists() function +func Test_exists() + augroup myagroup + autocmd! BufEnter *.my echo "myfile edited" + autocmd! FuncUndefined UndefFun exec "fu UndefFun()\nendfu" + augroup END + set rtp+=./sautest + + " valid autocmd group + call assert_equal(1, exists('#myagroup')) + " valid autocmd group with garbage + call assert_equal(0, exists('#myagroup+b')) + " Valid autocmd group and event + call assert_equal(1, exists('#myagroup#BufEnter')) + " Valid autocmd group, event and pattern + call assert_equal(1, exists('#myagroup#BufEnter#*.my')) + " Valid autocmd event + call assert_equal(1, exists('#BufEnter')) + " Valid autocmd event and pattern + call assert_equal(1, exists('#BufEnter#*.my')) + " Non-existing autocmd group or event + call assert_equal(0, exists('#xyzagroup')) + " Non-existing autocmd group and valid autocmd event + call assert_equal(0, exists('#xyzagroup#BufEnter')) + " Valid autocmd group and event with no matching pattern + call assert_equal(0, exists('#myagroup#CmdwinEnter')) + " Valid autocmd group and non-existing autocmd event + call assert_equal(0, exists('#myagroup#xyzacmd')) + " Valid autocmd group and event and non-matching pattern + call assert_equal(0, exists('#myagroup#BufEnter#xyzpat')) + " Valid autocmd event and non-matching pattern + call assert_equal(0, exists('#BufEnter#xyzpat')) + " Empty autocmd group, event and pattern + call assert_equal(0, exists('###')) + " Empty autocmd group and event or empty event and pattern + call assert_equal(0, exists('##')) + " Valid autocmd event + call assert_equal(1, exists('##FileReadCmd')) + " Non-existing autocmd event + call assert_equal(0, exists('##MySpecialCmd')) + + " Existing and working option (long form) + call assert_equal(1, exists('&textwidth')) + " Existing and working option (short form) + call assert_equal(1, exists('&tw')) + " Existing and working option with garbage + call assert_equal(0, exists('&tw-')) + " Global option + call assert_equal(1, exists('&g:errorformat')) + " Local option + call assert_equal(1, exists('&l:errorformat')) + " Negative form of existing and working option (long form) + call assert_equal(0, exists('&nojoinspaces')) + " Negative form of existing and working option (short form) + call assert_equal(0, exists('&nojs')) + " Non-existing option + call assert_equal(0, exists('&myxyzoption')) + + " Existing and working option (long form) + call assert_equal(1, exists('+incsearch')) + " Existing and working option with garbage + call assert_equal(0, exists('+incsearch!1')) + " Existing and working option (short form) + call assert_equal(1, exists('+is')) + " Existing option that is hidden. + call assert_equal(0, exists('+autoprint')) + + " Existing environment variable + let $EDITOR_NAME = 'Vim Editor' + call assert_equal(1, exists('$EDITOR_NAME')) + " Non-existing environment variable + call assert_equal(0, exists('$NON_ENV_VAR')) + + " Valid internal function + call assert_equal(1, exists('*bufnr')) + " Valid internal function with () + call assert_equal(1, exists('*bufnr()')) + " Non-existing internal function + call assert_equal(0, exists('*myxyzfunc')) + " Valid internal function with garbage + call assert_equal(0, exists('*bufnr&6')) + " Valid user defined function + call assert_equal(1, exists('*Test_exists')) + " Non-existing user defined function + call assert_equal(0, exists('*MyxyzFunc')) + " Function that may be created by FuncUndefined event + call assert_equal(0, exists('*UndefFun')) + " Function that may be created by script autoloading + call assert_equal(0, exists('*footest#F')) + + " Valid internal command (full match) + call assert_equal(2, exists(':edit')) + " Valid internal command (full match) with garbage + call assert_equal(0, exists(':edit/a')) + " Valid internal command (partial match) + call assert_equal(1, exists(':q')) + " Non-existing internal command + call assert_equal(0, exists(':invalidcmd')) + + " User defined command (full match) + command! MyCmd :echo 'My command' + call assert_equal(2, exists(':MyCmd')) + " User defined command (partial match) + command! MyOtherCmd :echo 'Another command' + call assert_equal(3, exists(':My')) + + " Command modifier + call assert_equal(2, exists(':rightbelow')) + + " Non-existing user defined command (full match) + delcommand MyCmd + call assert_equal(0, exists(':MyCmd')) + + " Non-existing user defined command (partial match) + delcommand MyOtherCmd + call assert_equal(0, exists(':My')) + + " Valid local variable + let local_var = 1 + call assert_equal(1, exists('local_var')) + " Valid local variable with garbage + call assert_equal(0, exists('local_var%n')) + " Non-existing local variable + unlet local_var + call assert_equal(0, exists('local_var')) + + " Non-existing autoload variable that may be autoloaded + call assert_equal(0, exists('footest#x')) + + " Valid local list + let local_list = ["blue", "orange"] + call assert_equal(1, exists('local_list')) + " Valid local list item + call assert_equal(1, exists('local_list[1]')) + " Valid local list item with garbage + call assert_equal(0, exists('local_list[1]+5')) + " Invalid local list item + call assert_equal(0, exists('local_list[2]')) + " Non-existing local list + unlet local_list + call assert_equal(0, exists('local_list')) + " Valid local dictionary + let local_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('local_dict')) + " Non-existing local dictionary + unlet local_dict + call assert_equal(0, exists('local_dict')) + " Existing local curly-brace variable + let str = "local" + let curly_{str}_var = 1 + call assert_equal(1, exists('curly_{str}_var')) + " Non-existing local curly-brace variable + unlet curly_{str}_var + call assert_equal(0, exists('curly_{str}_var')) + + " Existing global variable + let g:global_var = 1 + call assert_equal(1, exists('g:global_var')) + " Existing global variable with garbage + call assert_equal(0, exists('g:global_var-n')) + " Non-existing global variable + unlet g:global_var + call assert_equal(0, exists('g:global_var')) + " Existing global list + let g:global_list = ["blue", "orange"] + call assert_equal(1, exists('g:global_list')) + " Non-existing global list + unlet g:global_list + call assert_equal(0, exists('g:global_list')) + " Existing global dictionary + let g:global_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('g:global_dict')) + " Non-existing global dictionary + unlet g:global_dict + call assert_equal(0, exists('g:global_dict')) + " Existing global curly-brace variable + let str = "global" + let g:curly_{str}_var = 1 + call assert_equal(1, exists('g:curly_{str}_var')) + " Non-existing global curly-brace variable + unlet g:curly_{str}_var + call assert_equal(0, exists('g:curly_{str}_var')) + + " Existing window variable + let w:window_var = 1 + call assert_equal(1, exists('w:window_var')) + " Non-existing window variable + unlet w:window_var + call assert_equal(0, exists('w:window_var')) + " Existing window list + let w:window_list = ["blue", "orange"] + call assert_equal(1, exists('w:window_list')) + " Non-existing window list + unlet w:window_list + call assert_equal(0, exists('w:window_list')) + " Existing window dictionary + let w:window_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('w:window_dict')) + " Non-existing window dictionary + unlet w:window_dict + call assert_equal(0, exists('w:window_dict')) + " Existing window curly-brace variable + let str = "window" + let w:curly_{str}_var = 1 + call assert_equal(1, exists('w:curly_{str}_var')) + " Non-existing window curly-brace variable + unlet w:curly_{str}_var + call assert_equal(0, exists('w:curly_{str}_var')) + + " Existing tab variable + let t:tab_var = 1 + call assert_equal(1, exists('t:tab_var')) + " Non-existing tab variable + unlet t:tab_var + call assert_equal(0, exists('t:tab_var')) + " Existing tab list + let t:tab_list = ["blue", "orange"] + call assert_equal(1, exists('t:tab_list')) + " Non-existing tab list + unlet t:tab_list + call assert_equal(0, exists('t:tab_list')) + " Existing tab dictionary + let t:tab_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('t:tab_dict')) + " Non-existing tab dictionary + unlet t:tab_dict + call assert_equal(0, exists('t:tab_dict')) + " Existing tab curly-brace variable + let str = "tab" + let t:curly_{str}_var = 1 + call assert_equal(1, exists('t:curly_{str}_var')) + " Non-existing tab curly-brace variable + unlet t:curly_{str}_var + call assert_equal(0, exists('t:curly_{str}_var')) + + " Existing buffer variable + let b:buffer_var = 1 + call assert_equal(1, exists('b:buffer_var')) + " Non-existing buffer variable + unlet b:buffer_var + call assert_equal(0, exists('b:buffer_var')) + " Existing buffer list + let b:buffer_list = ["blue", "orange"] + call assert_equal(1, exists('b:buffer_list')) + " Non-existing buffer list + unlet b:buffer_list + call assert_equal(0, exists('b:buffer_list')) + " Existing buffer dictionary + let b:buffer_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('b:buffer_dict')) + " Non-existing buffer dictionary + unlet b:buffer_dict + call assert_equal(0, exists('b:buffer_dict')) + " Existing buffer curly-brace variable + let str = "buffer" + let b:curly_{str}_var = 1 + call assert_equal(1, exists('b:curly_{str}_var')) + " Non-existing buffer curly-brace variable + unlet b:curly_{str}_var + call assert_equal(0, exists('b:curly_{str}_var')) + + " Existing Vim internal variable + call assert_equal(1, exists('v:version')) + " Non-existing Vim internal variable + call assert_equal(0, exists('v:non_exists_var')) + + " Existing script-local variable + let s:script_var = 1 + call assert_equal(1, exists('s:script_var')) + " Non-existing script-local variable + unlet s:script_var + call assert_equal(0, exists('s:script_var')) + " Existing script-local list + let s:script_list = ["blue", "orange"] + call assert_equal(1, exists('s:script_list')) + " Non-existing script-local list + unlet s:script_list + call assert_equal(0, exists('s:script_list')) + " Existing script-local dictionary + let s:script_dict = {"xcord":100, "ycord":2} + call assert_equal(1, exists('s:script_dict')) + " Non-existing script-local dictionary + unlet s:script_dict + call assert_equal(0, exists('s:script_dict')) + " Existing script curly-brace variable + let str = "script" + let s:curly_{str}_var = 1 + call assert_equal(1, exists('s:curly_{str}_var')) + " Non-existing script-local curly-brace variable + unlet s:curly_{str}_var + call assert_equal(0, exists('s:curly_{str}_var')) + + " Existing script-local function + function! s:my_script_func() + endfunction + + echo '*s:my_script_func: 1' + call assert_equal(1, exists('*s:my_script_func')) + + " Non-existing script-local function + delfunction s:my_script_func + + call assert_equal(0, exists('*s:my_script_func')) + unlet str + + call assert_equal(1, g:footest#x) + call assert_equal(0, footest#F()) + call assert_equal(0, UndefFun()) +endfunc + +" exists() test for Function arguments +func FuncArg_Tests(func_arg, ...) + call assert_equal(1, exists('a:func_arg')) + call assert_equal(0, exists('a:non_exists_arg')) + call assert_equal(1, exists('a:1')) + call assert_equal(0, exists('a:2')) +endfunc + +func Test_exists_funcarg() + call FuncArg_Tests("arg1", "arg2") +endfunc diff --git a/src/testdir/test_exists_autocmd.vim b/src/testdir/test_exists_autocmd.vim new file mode 100644 index 0000000000..7e44a72653 --- /dev/null +++ b/src/testdir/test_exists_autocmd.vim @@ -0,0 +1,26 @@ +" Test that groups and patterns are tested correctly when calling exists() for +" autocommands. + +function Test_AutoCommands() + let results=[] + augroup auexists + augroup END + call assert_true(exists("##BufEnter")) + call assert_false(exists("#BufEnter")) + au BufEnter * let g:entered=1 + call assert_true(exists("#BufEnter")) + call assert_false(exists("#auexists#BufEnter")) + augroup auexists + au BufEnter * let g:entered=1 + augroup END + call assert_true(exists("#auexists#BufEnter")) + call assert_false(exists("#BufEnter#*.test")) + au BufEnter *.test let g:entered=1 + call assert_true(exists("#BufEnter#*.test")) + edit testfile.test + call assert_false(exists("#BufEnter#<buffer>")) + au BufEnter <buffer> let g:entered=1 + call assert_true(exists("#BufEnter#<buffer>")) + edit testfile2.test + call assert_false(exists("#BufEnter#<buffer>")) +endfunction diff --git a/src/testdir/test_exit.vim b/src/testdir/test_exit.vim new file mode 100644 index 0000000000..8f02fd29e3 --- /dev/null +++ b/src/testdir/test_exit.vim @@ -0,0 +1,57 @@ +" Tests for exiting Vim. + +source shared.vim + +func Test_exiting() + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'help', + \ 'wincmd w', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'split', + \ 'new', + \ 'qall', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'augroup nasty', + \ ' au ExitPre * split', + \ 'augroup END', + \ 'quit', + \ 'augroup nasty', + \ ' au! ExitPre', + \ 'augroup END', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], + \ readfile('Xtestout')) + endif + call delete('Xtestout') +endfunc diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim new file mode 100644 index 0000000000..c099edae1c --- /dev/null +++ b/src/testdir/test_expand.vim @@ -0,0 +1,41 @@ +" Test for expanding file names + +func Test_with_directories() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') + cd Xdir3 + call mkdir('Xdir4') + cd .. + + split Xdir1/file + call setline(1, ['a', 'b']) + w + w Xdir3/Xdir4/file + close + + next Xdir?/*/file + call assert_equal('Xdir3/Xdir4/file', expand('%')) + if has('unix') + next! Xdir?/*/nofile + call assert_equal('Xdir?/*/nofile', expand('%')) + endif + " Edit another file, on MS-Windows the swap file would be in use and can't + " be deleted. + edit foo + + call assert_equal(0, delete('Xdir1', 'rf')) + call assert_equal(0, delete('Xdir2', 'rf')) + call assert_equal(0, delete('Xdir3', 'rf')) +endfunc + +func Test_with_tilde() + let dir = getcwd() + call mkdir('Xdir ~ dir') + call assert_true(isdirectory('Xdir ~ dir')) + cd Xdir\ ~\ dir + call assert_true(getcwd() =~ 'Xdir \~ dir') + exe 'cd ' . fnameescape(dir) + call delete('Xdir ~ dir', 'd') + call assert_false(isdirectory('Xdir ~ dir')) +endfunc diff --git a/src/testdir/test_expand_dllpath.vim b/src/testdir/test_expand_dllpath.vim new file mode 100644 index 0000000000..1542095671 --- /dev/null +++ b/src/testdir/test_expand_dllpath.vim @@ -0,0 +1,32 @@ +func s:test_expand_dllpath(optname) + let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '') + execute 'let dllpath_save = &' . a:optname + try + execute 'set ' . a:optname . '=$TEST_EXPAND_DLLPATH' + execute 'call assert_equal("' . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' + + execute 'set ' . a:optname . '=~' . $TEST_EXPAND_DLLPATH + let home = substitute($HOME, '\\', '/', 'g') + execute 'call assert_equal("' . home . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' + finally + execute 'let &' . a:optname . ' = dllpath_save' + let $TEST_EXPAND_DLLPATH = '' + endtry +endfunc + +func s:generate_test_if_exists(optname) + if exists('+' . a:optname) + execute join([ + \ 'func Test_expand_' . a:optname . '()', + \ ' call s:test_expand_dllpath("' . a:optname . '")', + \ 'endfunc' + \ ], "\n") + endif +endfunc + +call s:generate_test_if_exists('luadll') +call s:generate_test_if_exists('perldll') +call s:generate_test_if_exists('pythondll') +call s:generate_test_if_exists('pythonthreedll') +call s:generate_test_if_exists('rubydll') +call s:generate_test_if_exists('tcldll') diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim new file mode 100644 index 0000000000..c14b6e671a --- /dev/null +++ b/src/testdir/test_expr.vim @@ -0,0 +1,483 @@ +" Tests for expressions. + +func Test_equal() + let base = {} + func base.method() + return 1 + endfunc + func base.other() dict + return 1 + endfunc + let instance = copy(base) + call assert_true(base.method == instance.method) + call assert_true([base.method] == [instance.method]) + call assert_true(base.other == instance.other) + call assert_true([base.other] == [instance.other]) + + call assert_false(base.method == base.other) + call assert_false([base.method] == [base.other]) + call assert_false(base.method == instance.other) + call assert_false([base.method] == [instance.other]) + + call assert_fails('echo base.method > instance.method') +endfunc + +func Test_version() + call assert_true(has('patch-7.4.001')) + call assert_true(has('patch-7.4.01')) + call assert_true(has('patch-7.4.1')) + call assert_true(has('patch-6.9.999')) + call assert_true(has('patch-7.1.999')) + call assert_true(has('patch-7.4.123')) + + call assert_false(has('patch-7')) + call assert_false(has('patch-7.4')) + call assert_false(has('patch-7.4.')) + call assert_false(has('patch-9.1.0')) + call assert_false(has('patch-9.9.1')) +endfunc + +func Test_dict() + let d = {'': 'empty', 'a': 'a', 0: 'zero'} + call assert_equal('empty', d['']) + call assert_equal('a', d['a']) + call assert_equal('zero', d[0]) + call assert_true(has_key(d, '')) + call assert_true(has_key(d, 'a')) + + let d[''] = 'none' + let d['a'] = 'aaa' + call assert_equal('none', d['']) + call assert_equal('aaa', d['a']) +endfunc + +func Test_strgetchar() + call assert_equal(char2nr('a'), strgetchar('axb', 0)) + call assert_equal(char2nr('x'), strgetchar('axb', 1)) + call assert_equal(char2nr('b'), strgetchar('axb', 2)) + + call assert_equal(-1, strgetchar('axb', -1)) + call assert_equal(-1, strgetchar('axb', 3)) + call assert_equal(-1, strgetchar('', 0)) +endfunc + +func Test_strcharpart() + call assert_equal('a', strcharpart('axb', 0, 1)) + call assert_equal('x', strcharpart('axb', 1, 1)) + call assert_equal('b', strcharpart('axb', 2, 1)) + call assert_equal('xb', strcharpart('axb', 1)) + + call assert_equal('', strcharpart('axb', 1, 0)) + call assert_equal('', strcharpart('axb', 1, -1)) + call assert_equal('', strcharpart('axb', -1, 1)) + call assert_equal('', strcharpart('axb', -2, 2)) + + call assert_equal('a', strcharpart('axb', -1, 2)) +endfunc + +func Test_getreg_empty_list() + call assert_equal('', getreg('x')) + call assert_equal([], getreg('x', 1, 1)) + let x = getreg('x', 1, 1) + let y = x + call add(x, 'foo') + call assert_equal(['foo'], y) +endfunc + +func Test_loop_over_null_list() + let null_list = test_null_list() + for i in null_list + call assert_report('should not get here') + endfor +endfunc + +func Test_compare_null_dict() + call assert_fails('let x = test_null_dict()[10]') + call assert_equal({}, {}) + call assert_equal(test_null_dict(), test_null_dict()) + call assert_notequal({}, test_null_dict()) +endfunc + +func Test_set_reg_null_list() + call setreg('x', test_null_list()) +endfunc + +func Test_special_char() + " The failure is only visible using valgrind. + call assert_fails('echo "\<C-">') +endfunc + +func Test_option_value() + " boolean + set bri + call assert_equal(1, &bri) + set nobri + call assert_equal(0, &bri) + + " number + set ts=1 + call assert_equal(1, &ts) + set ts=8 + call assert_equal(8, &ts) + + " string + exe "set cedit=\<Esc>" + call assert_equal("\<Esc>", &cedit) + set cpo= + call assert_equal("", &cpo) + set cpo=abcdefgi + call assert_equal("abcdefgi", &cpo) + set cpo&vim +endfunc + +function Test_printf_misc() + call assert_equal('123', printf('123')) + call assert_fails("call printf('123', 3)", "E767:") + + call assert_equal('123', printf('%d', 123)) + call assert_equal('123', printf('%i', 123)) + call assert_equal('123', printf('%D', 123)) + call assert_equal('123', printf('%U', 123)) + call assert_equal('173', printf('%o', 123)) + call assert_equal('173', printf('%O', 123)) + call assert_equal('7b', printf('%x', 123)) + call assert_equal('7B', printf('%X', 123)) + if has('ebcdic') + call assert_equal('#', printf('%c', 123)) + else + call assert_equal('{', printf('%c', 123)) + endif + call assert_equal('abc', printf('%s', 'abc')) + call assert_equal('abc', printf('%S', 'abc')) + + call assert_equal('+123', printf('%+d', 123)) + call assert_equal('-123', printf('%+d', -123)) + call assert_equal('+123', printf('%+ d', 123)) + call assert_equal(' 123', printf('% d', 123)) + call assert_equal(' 123', printf('% d', 123)) + call assert_equal('-123', printf('% d', -123)) + + call assert_equal('123', printf('%2d', 123)) + call assert_equal(' 123', printf('%6d', 123)) + call assert_equal('000123', printf('%06d', 123)) + call assert_equal('+00123', printf('%+06d', 123)) + call assert_equal(' 00123', printf('% 06d', 123)) + call assert_equal(' +123', printf('%+6d', 123)) + call assert_equal(' 123', printf('% 6d', 123)) + call assert_equal(' -123', printf('% 6d', -123)) + + " Test left adjusted. + call assert_equal('123 ', printf('%-6d', 123)) + call assert_equal('+123 ', printf('%-+6d', 123)) + call assert_equal(' 123 ', printf('%- 6d', 123)) + call assert_equal('-123 ', printf('%- 6d', -123)) + + call assert_equal(' 00123', printf('%7.5d', 123)) + call assert_equal(' -00123', printf('%7.5d', -123)) + call assert_equal(' +00123', printf('%+7.5d', 123)) + " Precision field should not be used when combined with %0 + call assert_equal(' 00123', printf('%07.5d', 123)) + call assert_equal(' -00123', printf('%07.5d', -123)) + + call assert_equal(' 123', printf('%*d', 5, 123)) + call assert_equal('123 ', printf('%*d', -5, 123)) + call assert_equal('00123', printf('%.*d', 5, 123)) + call assert_equal(' 123', printf('% *d', 5, 123)) + call assert_equal(' +123', printf('%+ *d', 5, 123)) + + " Simple quote (thousand grouping char) is ignored. + call assert_equal('+00123456', printf("%+'09d", 123456)) + + " Unrecognized format specifier kept as-is. + call assert_equal('_123', printf("%_%d", 123)) + + " Test alternate forms. + call assert_equal('0x7b', printf('%#x', 123)) + call assert_equal('0X7B', printf('%#X', 123)) + call assert_equal('0173', printf('%#o', 123)) + call assert_equal('0173', printf('%#O', 123)) + call assert_equal('abc', printf('%#s', 'abc')) + call assert_equal('abc', printf('%#S', 'abc')) + call assert_equal(' 0173', printf('%#6o', 123)) + call assert_equal(' 00173', printf('%#6.5o', 123)) + call assert_equal(' 0173', printf('%#6.2o', 123)) + call assert_equal(' 0173', printf('%#6.2o', 123)) + call assert_equal('0173', printf('%#2.2o', 123)) + + call assert_equal(' 00123', printf('%6.5d', 123)) + call assert_equal(' 0007b', printf('%6.5x', 123)) + + call assert_equal('abc', printf('%2s', 'abc')) + call assert_equal('abc', printf('%2S', 'abc')) + call assert_equal('abc', printf('%.4s', 'abc')) + call assert_equal('abc', printf('%.4S', 'abc')) + call assert_equal('ab', printf('%.2s', 'abc')) + call assert_equal('ab', printf('%.2S', 'abc')) + call assert_equal('', printf('%.0s', 'abc')) + call assert_equal('', printf('%.s', 'abc')) + call assert_equal(' abc', printf('%4s', 'abc')) + call assert_equal(' abc', printf('%4S', 'abc')) + call assert_equal('0abc', printf('%04s', 'abc')) + call assert_equal('0abc', printf('%04S', 'abc')) + call assert_equal('abc ', printf('%-4s', 'abc')) + call assert_equal('abc ', printf('%-4S', 'abc')) + + call assert_equal('1%', printf('%d%%', 1)) +endfunc + +function Test_printf_float() + if has('float') + call assert_equal('1.000000', printf('%f', 1)) + call assert_equal('1.230000', printf('%f', 1.23)) + call assert_equal('1.230000', printf('%F', 1.23)) + call assert_equal('9999999.9', printf('%g', 9999999.9)) + call assert_equal('9999999.9', printf('%G', 9999999.9)) + call assert_equal('1.00000001e7', printf('%.8g', 10000000.1)) + call assert_equal('1.00000001E7', printf('%.8G', 10000000.1)) + call assert_equal('1.230000e+00', printf('%e', 1.23)) + call assert_equal('1.230000E+00', printf('%E', 1.23)) + call assert_equal('1.200000e-02', printf('%e', 0.012)) + call assert_equal('-1.200000e-02', printf('%e', -0.012)) + call assert_equal('0.33', printf('%.2f', 1.0/3.0)) + call assert_equal(' 0.33', printf('%6.2f', 1.0/3.0)) + call assert_equal(' -0.33', printf('%6.2f', -1.0/3.0)) + call assert_equal('000.33', printf('%06.2f', 1.0/3.0)) + call assert_equal('-00.33', printf('%06.2f', -1.0/3.0)) + call assert_equal('-00.33', printf('%+06.2f', -1.0/3.0)) + call assert_equal('+00.33', printf('%+06.2f', 1.0/3.0)) + call assert_equal(' 00.33', printf('% 06.2f', 1.0/3.0)) + call assert_equal('000.33', printf('%06.2g', 1.0/3.0)) + call assert_equal('-00.33', printf('%06.2g', -1.0/3.0)) + call assert_equal('0.33', printf('%3.2f', 1.0/3.0)) + call assert_equal('003.33e-01', printf('%010.2e', 1.0/3.0)) + call assert_equal(' 03.33e-01', printf('% 010.2e', 1.0/3.0)) + call assert_equal('+03.33e-01', printf('%+010.2e', 1.0/3.0)) + call assert_equal('-03.33e-01', printf('%010.2e', -1.0/3.0)) + + " When precision is 0, the dot should be omitted. + call assert_equal(' 2', printf('%3.f', 7.0/3.0)) + call assert_equal(' 2', printf('%3.g', 7.0/3.0)) + call assert_equal(' 2e+00', printf('%7.e', 7.0/3.0)) + + " Float zero can be signed. + call assert_equal('+0.000000', printf('%+f', 0.0)) + call assert_equal('0.000000', printf('%f', 1.0/(1.0/0.0))) + call assert_equal('-0.000000', printf('%f', 1.0/(-1.0/0.0))) + call assert_equal('0.0', printf('%s', 1.0/(1.0/0.0))) + call assert_equal('-0.0', printf('%s', 1.0/(-1.0/0.0))) + call assert_equal('0.0', printf('%S', 1.0/(1.0/0.0))) + call assert_equal('-0.0', printf('%S', 1.0/(-1.0/0.0))) + + " Float infinity can be signed. + call assert_equal('inf', printf('%f', 1.0/0.0)) + call assert_equal('-inf', printf('%f', -1.0/0.0)) + call assert_equal('inf', printf('%g', 1.0/0.0)) + call assert_equal('-inf', printf('%g', -1.0/0.0)) + call assert_equal('inf', printf('%e', 1.0/0.0)) + call assert_equal('-inf', printf('%e', -1.0/0.0)) + call assert_equal('INF', printf('%F', 1.0/0.0)) + call assert_equal('-INF', printf('%F', -1.0/0.0)) + call assert_equal('INF', printf('%E', 1.0/0.0)) + call assert_equal('-INF', printf('%E', -1.0/0.0)) + call assert_equal('INF', printf('%E', 1.0/0.0)) + call assert_equal('-INF', printf('%G', -1.0/0.0)) + call assert_equal('+inf', printf('%+f', 1.0/0.0)) + call assert_equal('-inf', printf('%+f', -1.0/0.0)) + call assert_equal(' inf', printf('% f', 1.0/0.0)) + call assert_equal(' inf', printf('%6f', 1.0/0.0)) + call assert_equal(' -inf', printf('%6f', -1.0/0.0)) + call assert_equal(' inf', printf('%6g', 1.0/0.0)) + call assert_equal(' -inf', printf('%6g', -1.0/0.0)) + call assert_equal(' +inf', printf('%+6f', 1.0/0.0)) + call assert_equal(' inf', printf('% 6f', 1.0/0.0)) + call assert_equal(' +inf', printf('%+06f', 1.0/0.0)) + call assert_equal('inf ', printf('%-6f', 1.0/0.0)) + call assert_equal('-inf ', printf('%-6f', -1.0/0.0)) + call assert_equal('+inf ', printf('%-+6f', 1.0/0.0)) + call assert_equal(' inf ', printf('%- 6f', 1.0/0.0)) + call assert_equal('-INF ', printf('%-6F', -1.0/0.0)) + call assert_equal('+INF ', printf('%-+6F', 1.0/0.0)) + call assert_equal(' INF ', printf('%- 6F', 1.0/0.0)) + call assert_equal('INF ', printf('%-6G', 1.0/0.0)) + call assert_equal('-INF ', printf('%-6G', -1.0/0.0)) + call assert_equal('INF ', printf('%-6E', 1.0/0.0)) + call assert_equal('-INF ', printf('%-6E', -1.0/0.0)) + call assert_equal('inf', printf('%s', 1.0/0.0)) + call assert_equal('-inf', printf('%s', -1.0/0.0)) + + " Float nan (not a number) has no sign. + call assert_equal('nan', printf('%f', sqrt(-1.0))) + call assert_equal('nan', printf('%f', 0.0/0.0)) + call assert_equal('nan', printf('%f', -0.0/0.0)) + call assert_equal('nan', printf('%g', 0.0/0.0)) + call assert_equal('nan', printf('%e', 0.0/0.0)) + call assert_equal('NAN', printf('%F', 0.0/0.0)) + call assert_equal('NAN', printf('%G', 0.0/0.0)) + call assert_equal('NAN', printf('%E', 0.0/0.0)) + call assert_equal('NAN', printf('%F', -0.0/0.0)) + call assert_equal('NAN', printf('%G', -0.0/0.0)) + call assert_equal('NAN', printf('%E', -0.0/0.0)) + call assert_equal(' nan', printf('%6f', 0.0/0.0)) + call assert_equal(' nan', printf('%06f', 0.0/0.0)) + call assert_equal('nan ', printf('%-6f', 0.0/0.0)) + call assert_equal('nan ', printf('%- 6f', 0.0/0.0)) + call assert_equal('nan', printf('%s', 0.0/0.0)) + call assert_equal('nan', printf('%s', -0.0/0.0)) + call assert_equal('nan', printf('%S', 0.0/0.0)) + call assert_equal('nan', printf('%S', -0.0/0.0)) + + call assert_fails('echo printf("%f", "a")', 'E807:') + endif +endfunc + +function Test_printf_errors() + call assert_fails('echo printf("%d", {})', 'E728:') + call assert_fails('echo printf("%d", [])', 'E745:') + call assert_fails('echo printf("%d", 1, 2)', 'E767:') + call assert_fails('echo printf("%*d", 1)', 'E766:') + call assert_fails('echo printf("%d", 1.2)', 'E805:') +endfunc + +function Test_max_min_errors() + call assert_fails('call max(v:true)', 'E712:') + call assert_fails('call max(v:true)', 'max()') + call assert_fails('call min(v:true)', 'E712:') + call assert_fails('call min(v:true)', 'min()') +endfunc + +function Test_printf_64bit() + if has('num64') + call assert_equal("123456789012345", printf('%d', 123456789012345)) + endif +endfunc + +function Test_printf_spec_s() + " number + call assert_equal("1234567890", printf('%s', 1234567890)) + + " string + call assert_equal("abcdefgi", printf('%s', "abcdefgi")) + + " float + if has('float') + call assert_equal("1.23", printf('%s', 1.23)) + endif + + " list + let value = [1, 'two', ['three', 4]] + call assert_equal(string(value), printf('%s', value)) + + " dict + let value = {'key1' : 'value1', 'key2' : ['list', 'value'], 'key3' : {'dict' : 'value'}} + call assert_equal(string(value), printf('%s', value)) + + " funcref + call assert_equal('printf', printf('%s', function('printf'))) + + " partial + call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s']))) +endfunc + +function Test_printf_spec_b() + call assert_equal("0", printf('%b', 0)) + call assert_equal("00001100", printf('%08b', 12)) + call assert_equal("11111111", printf('%08b', 0xff)) + call assert_equal(" 1111011", printf('%10b', 123)) + call assert_equal("0001111011", printf('%010b', 123)) + call assert_equal(" 0b1111011", printf('%#10b', 123)) + call assert_equal("0B01111011", printf('%#010B', 123)) + call assert_equal("1001001100101100000001011010010", printf('%b', 1234567890)) + if has('num64') + call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345)) + call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%b', -1)) + else + call assert_equal("11111111111111111111111111111111", printf('%b', -1)) + endif +endfunc + +func Test_substitute_expr() + let g:val = 'XXX' + call assert_equal('XXX', substitute('yyy', 'y*', '\=g:val', '')) + call assert_equal('XXX', substitute('yyy', 'y*', {-> g:val}, '')) + call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)', + \ '\=nr2char("0x" . submatch(1))', 'g')) + call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)', + \ {-> nr2char("0x" . submatch(1))}, 'g')) + + call assert_equal('231', substitute('123', '\(.\)\(.\)\(.\)', + \ {-> submatch(2) . submatch(3) . submatch(1)}, '')) + + func Recurse() + return substitute('yyy', 'y\(.\)y', {-> submatch(1)}, '') + endfunc + " recursive call works + call assert_equal('-y-x-', substitute('xxx', 'x\(.\)x', {-> '-' . Recurse() . '-' . submatch(1) . '-'}, '')) +endfunc + +func Test_invalid_submatch() + " This was causing invalid memory access in Vim-7.4.2232 and older + call assert_fails("call substitute('x', '.', {-> submatch(10)}, '')", 'E935:') +endfunc + +func Test_substitute_expr_arg() + call assert_equal('123456789-123456789=', substitute('123456789', + \ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', + \ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, '')) + + call assert_equal('123456-123456=789', substitute('123456789', + \ '\(.\)\(.\)\(.\)\(a*\)\(n*\)\(.\)\(.\)\(.\)\(x*\)', + \ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, '')) + + call assert_equal('123456789-123456789x=', substitute('123456789', + \ '\(.\)\(.\)\(.*\)', + \ {m -> m[0] . '-' . m[1] . m[2] . m[3] . 'x' . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, '')) + + call assert_fails("call substitute('xxx', '.', {m -> string(add(m, 'x'))}, '')", 'E742:') + call assert_fails("call substitute('xxx', '.', {m -> string(insert(m, 'x'))}, '')", 'E742:') + call assert_fails("call substitute('xxx', '.', {m -> string(extend(m, ['x']))}, '')", 'E742:') + call assert_fails("call substitute('xxx', '.', {m -> string(remove(m, 1))}, '')", 'E742:') +endfunc + +func Test_function_with_funcref() + let s:f = function('type') + let s:fref = function(s:f) + call assert_equal(v:t_string, s:fref('x')) + call assert_fails("call function('s:f')", 'E700:') + + call assert_fails("call function('foo()')", 'E475:') + call assert_fails("call function('foo()')", 'foo()') +endfunc + +func Test_funcref() + func! One() + return 1 + endfunc + let OneByName = function('One') + let OneByRef = funcref('One') + func! One() + return 2 + endfunc + call assert_equal(2, OneByName()) + call assert_equal(1, OneByRef()) + let OneByRef = funcref('One') + call assert_equal(2, OneByRef()) + call assert_fails('echo funcref("{")', 'E475:') +endfunc + +func Test_setmatches() + hi def link 1 Comment + hi def link 2 PreProc + let set = [{"group": 1, "pattern": 2, "id": 3, "priority": 4}] + let exp = [{"group": '1', "pattern": '2', "id": 3, "priority": 4}] + if has('conceal') + let set[0]['conceal'] = 5 + let exp[0]['conceal'] = '5' + endif + call setmatches(set) + call assert_equal(exp, getmatches()) +endfunc + +func Test_empty_concatenate() + call assert_equal('b', 'a'[4:0] . 'b') + call assert_equal('b', 'b' . 'a'[4:0]) +endfunc diff --git a/src/testdir/test_expr_utf8.vim b/src/testdir/test_expr_utf8.vim new file mode 100644 index 0000000000..1737a9f745 --- /dev/null +++ b/src/testdir/test_expr_utf8.vim @@ -0,0 +1,37 @@ +" Tests for expressions using utf-8. +if !has('multi_byte') + finish +endif + +func Test_strgetchar() + call assert_equal(char2nr('á'), strgetchar('áxb', 0)) + call assert_equal(char2nr('x'), strgetchar('áxb', 1)) + + call assert_equal(char2nr('a'), strgetchar('àxb', 0)) + call assert_equal(char2nr('̀'), strgetchar('àxb', 1)) + call assert_equal(char2nr('x'), strgetchar('àxb', 2)) + + call assert_equal(char2nr('あ'), strgetchar('あaい', 0)) + call assert_equal(char2nr('a'), strgetchar('あaい', 1)) + call assert_equal(char2nr('い'), strgetchar('あaい', 2)) +endfunc + +func Test_strcharpart() + call assert_equal('áxb', strcharpart('áxb', 0)) + call assert_equal('á', strcharpart('áxb', 0, 1)) + call assert_equal('x', strcharpart('áxb', 1, 1)) + + call assert_equal('いうeお', strcharpart('あいうeお', 1)) + call assert_equal('い', strcharpart('あいうeお', 1, 1)) + call assert_equal('いう', strcharpart('あいうeお', 1, 2)) + call assert_equal('いうe', strcharpart('あいうeお', 1, 3)) + call assert_equal('いうeお', strcharpart('あいうeお', 1, 4)) + call assert_equal('eお', strcharpart('あいうeお', 3)) + call assert_equal('e', strcharpart('あいうeお', 3, 1)) + + call assert_equal('あ', strcharpart('あいうeお', -3, 4)) + + call assert_equal('a', strcharpart('àxb', 0, 1)) + call assert_equal('̀', strcharpart('àxb', 1, 1)) + call assert_equal('x', strcharpart('àxb', 2, 1)) +endfunc diff --git a/src/testdir/test_farsi.vim b/src/testdir/test_farsi.vim new file mode 100644 index 0000000000..dcfa0248c1 --- /dev/null +++ b/src/testdir/test_farsi.vim @@ -0,0 +1,133 @@ +" Simplistic testing of Farsi mode. +" Note: must be edited with latin1 encoding. + +if !has('farsi') + finish +endif +" Farsi uses a single byte encoding. +set enc=latin1 + +func Test_farsi_toggle() + new + + set altkeymap + call assert_equal(0, &fkmap) + call assert_equal(0, &rl) + call feedkeys("\<F8>", 'x') + call assert_equal(1, &fkmap) + call assert_equal(1, &rl) + call feedkeys("\<F8>", 'x') + call assert_equal(0, &fkmap) + call assert_equal(0, &rl) + + set rl + " conversion from Farsi 3342 to Farsi VIM. + call setline(1, join(map(range(0x80, 0xff), 'nr2char(v:val)'), '')) + call feedkeys("\<F9>", 'x') + let exp = [0xfc, 0xf8, 0xc1, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + \ 0xc8, 0xc9, 0xca, 0xd0, 0xd1, 0xd2, 0xd3, 0xd6, + \ 0xd6, 0xd6, 0xd7, 0xd7, 0xd7, 0xd8, 0xd9, 0xda, + \ 0xdb, 0xdc, 0xdc, 0xc1, 0xdd, 0xde, 0xe0, 0xe0, + \ 0xe1, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, + \ 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, + \ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + \ 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, + \ 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, + \ 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, + \ 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + \ 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, + \ 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + \ 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xfb, 0xfb, 0xfe, + \ 0xfe, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, + \ 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xe1, + \ ] + call assert_equal(join(map(exp, 'nr2char(v:val)'), ''), getline(1)) + + " conversion from Farsi VIM to Farsi 3342. + call setline(1, join(map(range(0x80, 0xff), 'nr2char(v:val)'), '')) + call feedkeys("\<F9>", 'x') + let exp = [0xfc, 0xf8, 0xc1, 0x83, 0x84, 0x85, 0x86, 0x87, + \ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x90, + \ 0x90, 0x90, 0x92, 0x93, 0x93, 0x95, 0x96, 0x97, + \ 0x98, 0xdc, 0x9a, 0x9b, 0x9c, 0x9e, 0x9e, 0xff, + \ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + \ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + \ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + \ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + \ 0xc0, 0xc1, 0xc2, 0x83, 0x84, 0x85, 0x86, 0x87, + \ 0x88, 0x89, 0x8a, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + \ 0x8b, 0x8c, 0x8d, 0x8e, 0xd4, 0xd5, 0x90, 0x93, + \ 0x95, 0x96, 0x97, 0x98, 0x99, 0x9b, 0x9c, 0xdf, + \ 0x9d, 0xff, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + \ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xec, 0xee, 0xef, + \ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + \ 0xf8, 0xf9, 0xfa, 0xec, 0x80, 0xfd, 0xee, 0xff, + \ ] + call assert_equal(join(map(exp, 'nr2char(v:val)'), ''), getline(1)) + + bwipe! +endfunc + +func Test_farsi_map() + new + + set altkeymap + set rl + " RHS of mapping is reversed. + imap xyz abc + call feedkeys("axyz\<Esc>", 'tx') + call assert_equal('cba', getline(1)) + + set norl + iunmap xyz + set noaltkeymap + bwipe! +endfunc + +func Test_input_farsi() + new + setlocal rightleft fkmap + " numbers switch input direction + call feedkeys("aabc0123456789.+-^%#=xyz\<Esc>", 'tx') + call assert_equal("\x8cν\x93", getline('.')) + + " all non-number special chars with spaces + call feedkeys("oB E F H I K L M O P Q R T U W Y ` ! @ # $ % ^ & * () - _ = + \\ | : \" . / < > ? \<Esc>", 'tx') + call assert_equal(" []񠢠蠨頽꠺", getline('.')) + + " all non-number special chars without spaces + call feedkeys("oBEFHIKLMOPQRTUWY`!@#$%^&*()-_=+\\|:\"./<>?\<Esc>",'tx') + call assert_equal("[]񢣧訩齫꺻", getline('.')) + + " all letter chars with spaces + call feedkeys("oa A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \ , [ ] \<Esc>", 'tx') + call assert_equal("Ѡ̠ΠϠƠàܠŠޠݠĠˠˠʠɠӠ٠Рؠ֠͠͠ҠԠԠנՠڠߠǠȠ", getline('.')) + + " all letter chars without spaces + call feedkeys("oaAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\,[]\<Esc>", 'tx') + call assert_equal("\x8c\x9f\x86\x83\x9d\x85\x80\x9c\x9b\x84\x8a\x89\x8e\x96\x8b\x95\x90\x8d\x93\x97\x87\x88", getline('.')) + + bwipe! +endfunc + +func Test_command_line_farsi() + set allowrevins altkeymap + + " letter characters with spaces + call feedkeys(":\"\<C-_>a A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \\ , [ ]\<CR>", 'tx') + call assert_equal("\"\x88ǠߠڠՠՠנԠԠҠ֠͠͠ؠР٠ӠɠʠˠˠĠݠޠŠܠàƠϠΠ̠", getreg(':')) + + " letter characters without spaces + call feedkeys(":\"\<C-_>aAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\\,[]\<CR>", 'tx') + call assert_equal("\"\x88\x87\x93\x8d\x90\x95\x8b\x96\x8e\x89\x8a\x84\x9b\x9c\x80\x85\x9d\x83\x86\x9f\x8c", getreg(':')) + + " other characters with spaces + call feedkeys(":\"\<C-_>0 1 2 3 4 5 6 7 8 9 ` . ! \" $ % ^ & / () = \\ ? + - _ * : # ~ @ < > { } | B E F H I K L M O P Q R T U W Y\<CR>", 'tx') + call assert_equal("\"][ }{~頭렽", getreg(':')) + + " other characters without spaces + call feedkeys(":\"\<C-_>0123456789`.!\"$%^&/()=\\?+-_*:#~@<>{}|BEFHIKLMOPQRTUWY\<CR>", 'tx') + call assert_equal("\"][}{~魫뽩", getreg(':')) + + set noallowrevins noaltkeymap +endfunc diff --git a/src/testdir/test_feedkeys.vim b/src/testdir/test_feedkeys.vim new file mode 100644 index 0000000000..70500f2bb5 --- /dev/null +++ b/src/testdir/test_feedkeys.vim @@ -0,0 +1,14 @@ +" Test feedkeys() function. + +func Test_feedkeys_x_with_empty_string() + new + call feedkeys("ifoo\<Esc>") + call assert_equal('', getline('.')) + call feedkeys('', 'x') + call assert_equal('foo', getline('.')) + + " check it goes back to normal mode immediately. + call feedkeys('i', 'x') + call assert_equal('foo', getline('.')) + quit! +endfunc diff --git a/src/testdir/test_file_perm.vim b/src/testdir/test_file_perm.vim new file mode 100644 index 0000000000..0dba6a708a --- /dev/null +++ b/src/testdir/test_file_perm.vim @@ -0,0 +1,24 @@ +" Test getting and setting file permissions. + +func Test_file_perm() + call assert_equal('', getfperm('Xtest')) + call assert_equal(0, setfperm('Xtest', 'r--------')) + + call writefile(['one'], 'Xtest') + call assert_true(len(getfperm('Xtest')) == 9) + + call assert_equal(1, setfperm('Xtest', 'rwx------')) + if has('win32') + call assert_equal('rw-rw-rw-', getfperm('Xtest')) + else + call assert_equal('rwx------', getfperm('Xtest')) + endif + + call assert_equal(1, setfperm('Xtest', 'r--r--r--')) + call assert_equal('r--r--r--', getfperm('Xtest')) + + call assert_fails("setfperm('Xtest', '---')") + + call assert_equal(1, setfperm('Xtest', 'rwx------')) + call delete('Xtest') +endfunc diff --git a/src/testdir/test_file_size.vim b/src/testdir/test_file_size.vim new file mode 100644 index 0000000000..3e78a7b23c --- /dev/null +++ b/src/testdir/test_file_size.vim @@ -0,0 +1,58 @@ +" Inserts 2 million lines with consecutive integers starting from 1 +" (essentially, the output of GNU's seq 1 2000000), writes them to Xtest +" and writes its cksum to test.out. +" +" We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess +" up the lines the checksum would differ. +" +" cksum is part of POSIX and so should be available on most Unixes. +" If it isn't available then the test will be skipped. +func Test_File_Size() + if !executable('cksum') + return + endif + + new + set fileformat=unix undolevels=-1 + for i in range(1, 2000000, 100) + call append(i, range(i, i + 99)) + endfor + + 1delete + w! Xtest + let res = systemlist('cksum Xtest')[0] + let res = substitute(res, "\r", "", "") + call assert_equal('3678979763 14888896 Xtest', res) + + enew! + call delete('Xtest') + set fileformat& undolevels& +endfunc + +" Test for writing and reading a file of over 100 Kbyte +func Test_File_Read_Write() + enew! + + " Create a file with the following contents + " 1 line: "This is the start" + " 3001 lines: "This is the leader" + " 1 line: "This is the middle" + " 3001 lines: "This is the trailer" + " 1 line: "This is the end" + call append(0, "This is the start") + call append(1, repeat(["This is the leader"], 3001)) + call append(3002, "This is the middle") + call append(3003, repeat(["This is the trailer"], 3001)) + call append(6004, "This is the end") + + write! Xtest + enew! + edit! Xtest + + call assert_equal("This is the start", getline(1)) + call assert_equal("This is the middle", getline(3003)) + call assert_equal("This is the end", getline(6005)) + + enew! + call delete("Xtest") +endfunc diff --git a/src/testdir/test_fileformat.vim b/src/testdir/test_fileformat.vim new file mode 100644 index 0000000000..8dc25f62b1 --- /dev/null +++ b/src/testdir/test_fileformat.vim @@ -0,0 +1,33 @@ +" Test behavior of fileformat after bwipeout of last buffer + +func Test_fileformat_after_bw() + bwipeout + set fileformat& + if &fileformat == 'dos' + let test_fileformats = 'unix' + elseif &fileformat == 'unix' + let test_fileformats = 'mac' + else " must be mac + let test_fileformats = 'dos' + endif + exec 'set fileformats='.test_fileformats + bwipeout! + call assert_equal(test_fileformats, &fileformat) + set fileformats& +endfunc + +func Test_fileformat_autocommand() + let filecnt = ["", "foobar\<CR>", "eins\<CR>", "\<CR>", "zwei\<CR>", "drei", "vier", "fünf", ""] + let ffs = &ffs + call writefile(filecnt, 'Xfile', 'b') + au BufReadPre Xfile set ffs=dos ff=dos + new Xfile + call assert_equal('dos', &l:ff) + call assert_equal('dos', &ffs) + + " cleanup + call delete('Xfile') + let &ffs = ffs + au! BufReadPre Xfile + bw! +endfunc diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim new file mode 100644 index 0000000000..62dbc7473f --- /dev/null +++ b/src/testdir/test_filetype.vim @@ -0,0 +1,597 @@ +" Test :setfiletype + +func Test_detection() + filetype on + augroup filetypedetect + au BufNewFile,BufRead * call assert_equal(1, did_filetype()) + augroup END + new something.vim + call assert_equal('vim', &filetype) + + bwipe! + filetype off +endfunc + +func Test_conf_type() + filetype on + call writefile(['# some comment', 'must be conf'], 'Xfile') + augroup filetypedetect + au BufNewFile,BufRead * call assert_equal(0, did_filetype()) + augroup END + split Xfile + call assert_equal('conf', &filetype) + + bwipe! + call delete('Xfile') + filetype off +endfunc + +func Test_other_type() + filetype on + augroup filetypedetect + au BufNewFile,BufRead * call assert_equal(0, did_filetype()) + au BufNewFile,BufRead Xfile setf testfile + au BufNewFile,BufRead * call assert_equal(1, did_filetype()) + augroup END + call writefile(['# some comment', 'must be conf'], 'Xfile') + split Xfile + call assert_equal('testfile', &filetype) + + bwipe! + call delete('Xfile') + filetype off +endfunc + +" Filetypes detected just from matching the file name. +let s:filename_checks = { + \ 'a2ps': ['/etc/a2ps.cfg', '/etc/a2ps/file.cfg', 'a2psrc', '.a2psrc'], + \ 'a65': ['file.a65'], + \ 'abap': ['file.abap'], + \ 'abc': ['file.abc'], + \ 'abel': ['file.abl'], + \ 'acedb': ['file.wrm'], + \ 'ada': ['file.adb', 'file.ads', 'file.ada', 'file.gpr'], + \ 'ahdl': ['file.tdf'], + \ 'alsaconf': ['.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf'], + \ 'aml': ['file.aml'], + \ 'ampl': ['file.run'], + \ 'ant': ['build.xml'], + \ 'apache': ['.htaccess', '/etc/httpd/file.conf'], + \ 'applescript': ['file.scpt'], + \ 'aptconf': ['apt.conf', '/.aptitude/config'], + \ 'arch': ['.arch-inventory'], + \ 'arduino': ['file.ino', 'file.pde'], + \ 'art': ['file.art'], + \ 'asciidoc': ['file.asciidoc', 'file.adoc'], + \ 'asn': ['file.asn', 'file.asn1'], + \ 'atlas': ['file.atl', 'file.as'], + \ 'autohotkey': ['file.ahk'], + \ 'autoit': ['file.au3'], + \ 'automake': ['GNUmakefile.am'], + \ 'ave': ['file.ave'], + \ 'awk': ['file.awk'], + \ 'b': ['file.mch', 'file.ref', 'file.imp'], + \ 'bc': ['file.bc'], + \ 'bdf': ['file.bdf'], + \ 'bib': ['file.bib'], + \ 'bindzone': ['named.root'], + \ 'blank': ['file.bl'], + \ 'bst': ['file.bst'], + \ 'bzr': ['bzr_log.any'], + \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c'], + \ 'cabal': ['file.cabal'], + \ 'calendar': ['calendar'], + \ 'catalog': ['catalog'], + \ 'cdl': ['file.cdl'], + \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao'], + \ 'cdrtoc': ['file.toc'], + \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'], + \ 'cfengine': ['cfengine.conf'], + \ 'cfg': ['file.cfg', 'file.hgrc', 'filehgrc'], + \ 'ch': ['file.chf'], + \ 'chaiscript': ['file.chai'], + \ 'chaskell': ['file.chs'], + \ 'chill': ['file..ch'], + \ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'], + \ 'cl': ['file.eni'], + \ 'clean': ['file.dcl', 'file.icl'], + \ 'clojure': ['file.clj', 'file.cljs', 'file.cljx', 'file.cljc'], + \ 'cmake': ['CMakeLists.txt', 'file.cmake', 'file.cmake.in'], + \ 'cmusrc': ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme'], + \ 'cobol': ['file.cbl', 'file.cob', 'file.lib'], + \ 'coco': ['file.atg'], + \ 'conaryrecipe': ['file.recipe'], + \ 'conf': ['auto.master'], + \ 'config': ['configure.in', 'configure.ac'], + \ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi'], + \ 'cpp': ['file.cxx', 'file.c++', 'file.hh', 'file.hxx', 'file.hpp', 'file.ipp', 'file.moc', 'file.tcc', 'file.inl', 'file.tlh'], + \ 'crm': ['file.crm'], + \ 'cs': ['file.cs'], + \ 'csc': ['file.csc'], + \ 'csdl': ['file.csdl'], + \ 'csp': ['file.csp', 'file.fdr'], + \ 'css': ['file.css'], + \ 'cterm': ['file.con'], + \ 'cucumber': ['file.feature'], + \ 'cuda': ['file.cu'], + \ 'cupl': ['file.pld'], + \ 'cuplsim': ['file.si'], + \ 'cvs': ['cvs123'], + \ 'cvsrc': ['.cvsrc'], + \ 'cynpp': ['file.cyn'], + \ 'datascript': ['file.ds'], + \ 'dcd': ['file.dcd'], + \ 'debcontrol': ['/debian/control'], + \ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list'], + \ 'def': ['file.def'], + \ 'denyhosts': ['denyhosts.conf'], + \ 'desc': ['file.desc'], + \ 'desktop': ['file.desktop', '.directory'], + \ 'dictconf': ['dict.conf', '.dictrc'], + \ 'dictdconf': ['dictd.conf'], + \ 'diff': ['file.diff', 'file.rej'], + \ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS'], + \ 'dnsmasq': ['/etc/dnsmasq.conf'], + \ 'dockerfile': ['Dockerfile', 'file.Dockerfile'], + \ 'dosbatch': ['file.bat', 'file.sys'], + \ 'dosini': ['.editorconfig', '/etc/yum.conf', 'file.ini'], + \ 'dot': ['file.dot'], + \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe'], + \ 'dsl': ['file.dsl'], + \ 'dtd': ['file.dtd'], + \ 'dts': ['file.dts', 'file.dtsi'], + \ 'dylan': ['file.dylan'], + \ 'dylanintr': ['file.intr'], + \ 'dylanlid': ['file.lid'], + \ 'ecd': ['file.ecd'], + \ 'edif': ['file.edf', 'file.edif', 'file.edo'], + \ 'elinks': ['/etc/elinks.conf', '/.elinks/elinks.conf'], + \ 'elmfilt': ['filter-rules'], + \ 'erlang': ['file.erl', 'file.hrl', 'file.yaws'], + \ 'eruby': ['file.erb', 'file.rhtml'], + \ 'esmtprc': ['anyesmtprc'], + \ 'esqlc': ['file.ec', 'file.EC'], + \ 'esterel': ['file.strl'], + \ 'eterm': ['anyEterm/file.cfg'], + \ 'exim': ['exim.conf'], + \ 'expect': ['file.exp'], + \ 'exports': ['exports'], + \ 'factor': ['file.factor'], + \ 'falcon': ['file.fal'], + \ 'fan': ['file.fan', 'file.fwt'], + \ 'fetchmail': ['.fetchmailrc'], + \ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'], + \ 'focexec': ['file.fex', 'file.focexec'], + \ 'forth': ['file.fs', 'file.ft'], + \ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'], + \ 'framescript': ['file.fsl'], + \ 'freebasic': ['file.fb', 'file.bi'], + \ 'fstab': ['fstab', 'mtab'], + \ 'gdb': ['.gdbinit'], + \ 'gdmo': ['file.mo', 'file.gdmo'], + \ 'gedcom': ['file.ged', 'lltxxxxx.txt'], + \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'], + \ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config'], + \ 'gitolite': ['gitolite.conf'], + \ 'gitrebase': ['git-rebase-todo'], + \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], + \ 'gkrellmrc': ['gkrellmrc', 'gkrellmrc_x'], + \ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'], + \ 'gnuplot': ['file.gpi'], + \ 'go': ['file.go'], + \ 'gp': ['file.gp', '.gprc'], + \ 'gpg': ['/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel'], + \ 'grads': ['file.gs'], + \ 'gretl': ['file.gretl'], + \ 'groovy': ['file.gradle', 'file.groovy'], + \ 'group': ['any/etc/group', 'any/etc/group-', 'any/etc/group.edit', 'any/etc/gshadow', 'any/etc/gshadow-', 'any/etc/gshadow.edit', 'any/var/backups/group.bak', 'any/var/backups/gshadow.bak'], + \ 'grub': ['/boot/grub/menu.lst', '/boot/grub/grub.conf', '/etc/grub.conf'], + \ 'gsp': ['file.gsp'], + \ 'gtkrc': ['.gtkrc', 'gtkrc'], + \ 'haml': ['file.haml'], + \ 'hamster': ['file.hsc', 'file.hsm'], + \ 'haskell': ['file.hs', 'file.hs-boot'], + \ 'haste': ['file.ht'], + \ 'hastepreproc': ['file.htpp'], + \ 'hb': ['file.hb'], + \ 'hercules': ['file.vc', 'file.ev', 'file.sum', 'file.errsum'], + \ 'hex': ['file.hex', 'file.h32'], + \ 'hgcommit': ['hg-editor-file.txt'], + \ 'hog': ['file.hog', 'snort.conf', 'vision.conf'], + \ 'hostconf': ['/etc/host.conf'], + \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny'], + \ 'htmlcheetah': ['file.tmpl'], + \ 'htmlm4': ['file.html.m4'], + \ 'httest': ['file.htt', 'file.htb'], + \ 'ibasic': ['file.iba', 'file.ibi'], + \ 'icemenu': ['/.icewm/menu'], + \ 'icon': ['file.icn'], + \ 'indent': ['.indent.pro', 'indentrc'], + \ 'inform': ['file.inf', 'file.INF'], + \ 'initng': ['/etc/initng/any/file.i', 'file.ii'], + \ 'inittab': ['inittab'], + \ 'ipfilter': ['ipf.conf', 'ipf6.conf', 'ipf.rules'], + \ 'iss': ['file.iss'], + \ 'ist': ['file.ist', 'file.mst'], + \ 'j': ['file.ijs'], + \ 'jal': ['file.jal', 'file.JAL'], + \ 'jam': ['file.jpl', 'file.jpr'], + \ 'java': ['file.java', 'file.jav'], + \ 'javacc': ['file.jj', 'file.jjt'], + \ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.jsx', 'file.mjs'], + \ 'jess': ['file.clp'], + \ 'jgraph': ['file.jgr'], + \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], + \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx'], + \ 'json': ['file.json', 'file.jsonp', 'file.webmanifest'], + \ 'jsp': ['file.jsp'], + \ 'kconfig': ['Kconfig', 'Kconfig.debug'], + \ 'kivy': ['file.kv'], + \ 'kix': ['file.kix'], + \ 'kscript': ['file.ks'], + \ 'kwt': ['file.k'], + \ 'lace': ['file.ace', 'file.ACE'], + \ 'latte': ['file.latte', 'file.lte'], + \ 'ld': ['file.ld'], + \ 'ldif': ['file.ldif'], + \ 'less': ['file.less'], + \ 'lex': ['file.lex', 'file.l', 'file.lxx', 'file.l++'], + \ 'lftp': ['lftp.conf', '.lftprc', 'anylftp/rc'], + \ 'lhaskell': ['file.lhs'], + \ 'libao': ['/etc/libao.conf', '/.libao'], + \ 'lifelines': ['file.ll'], + \ 'lilo': ['lilo.conf'], + \ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf'], + \ 'liquid': ['file.liquid'], + \ 'lisp': ['sbclrc', '.sbclrc'], + \ 'lite': ['file.lite', 'file.lt'], + \ 'litestep': ['/LiteStep/any/file.rc'], + \ 'loginaccess': ['/etc/login.access'], + \ 'logindefs': ['/etc/login.defs'], + \ 'logtalk': ['file.lgt'], + \ 'lotos': ['file.lot', 'file.lotos'], + \ 'lout': ['file.lou', 'file.lout'], + \ 'lprolog': ['file.sig'], + \ 'lsl': ['file.lsl'], + \ 'lss': ['file.lss'], + \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'], + \ 'lynx': ['lynx.cfg'], + \ 'm4': ['file.at'], + \ 'mail': ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml'], + \ 'mailaliases': ['/etc/mail/aliases', '/etc/aliases'], + \ 'mailcap': ['.mailcap', 'mailcap'], + \ 'make': ['file.mk', 'file.mak', 'file.dsp'], + \ 'mallard': ['file.page'], + \ 'man': ['file.man'], + \ 'manconf': ['/etc/man.conf', 'man.config'], + \ 'map': ['file.map'], + \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], + \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'], + \ 'mason': ['file.mason', 'file.mhtml', 'file.comp'], + \ 'master': ['file.mas', 'file.master'], + \ 'mel': ['file.mel'], + \ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user', + \ '/log/auth.log', '/log/cron.log', '/log/daemon.log', '/log/debug.log', '/log/kern.log', '/log/lpr.log', '/log/mail.log', '/log/messages.log', '/log/news/news.log', '/log/syslog.log', '/log/user.log', + \ '/log/auth.err', '/log/cron.err', '/log/daemon.err', '/log/debug.err', '/log/kern.err', '/log/lpr.err', '/log/mail.err', '/log/messages.err', '/log/news/news.err', '/log/syslog.err', '/log/user.err', + \ '/log/auth.info', '/log/cron.info', '/log/daemon.info', '/log/debug.info', '/log/kern.info', '/log/lpr.info', '/log/mail.info', '/log/messages.info', '/log/news/news.info', '/log/syslog.info', '/log/user.info', + \ '/log/auth.warn', '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', '/log/messages.warn', '/log/news/news.warn', '/log/syslog.warn', '/log/user.warn', + \ '/log/auth.crit', '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', '/log/messages.crit', '/log/news/news.crit', '/log/syslog.crit', '/log/user.crit', + \ '/log/auth.notice', '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', '/log/messages.notice', '/log/news/news.notice', '/log/syslog.notice', '/log/user.notice'], + \ 'mf': ['file.mf'], + \ 'mgl': ['file.mgl'], + \ 'mgp': ['file.mgp'], + \ 'mib': ['file.mib', 'file.my'], + \ 'mix': ['file.mix', 'file.mixal'], + \ 'mma': ['file.nb'], + \ 'mmp': ['file.mmp'], + \ 'modconf': ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules'], + \ 'modula2': ['file.m2', 'file.mi'], + \ 'monk': ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'], + \ 'moo': ['file.moo'], + \ 'mp': ['file.mp'], + \ 'mplayerconf': ['mplayer.conf', '/.mplayer/config'], + \ 'mrxvtrc': ['mrxvtrc', '.mrxvtrc'], + \ 'msidl': ['file.odl', 'file.mof'], + \ 'msql': ['file.msql'], + \ 'mupad': ['file.mu'], + \ 'mush': ['file.mush'], + \ 'muttrc': ['Muttngrc', 'Muttrc'], + \ 'mysql': ['file.mysql'], + \ 'n1ql': ['file.n1ql', 'file.nql'], + \ 'named': ['namedfile.conf', 'rndcfile.conf'], + \ 'nanorc': ['/etc/nanorc', 'file.nanorc'], + \ 'ncf': ['file.ncf'], + \ 'netrc': ['.netrc'], + \ 'ninja': ['file.ninja'], + \ 'nqc': ['file.nqc'], + \ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom'], + \ 'nsis': ['file.nsi', 'file.nsh'], + \ 'obj': ['file.obj'], + \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit'], + \ 'occam': ['file.occ'], + \ 'omnimark': ['file.xom', 'file.xin'], + \ 'openroad': ['file.or'], + \ 'ora': ['file.ora'], + \ 'pamconf': ['/etc/pam.conf'], + \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], + \ 'pascal': ['file.pas', 'file.dpr'], + \ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak'], + \ 'pccts': ['file.g'], + \ 'pdf': ['file.pdf'], + \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'], + \ 'perl6': ['file.p6', 'file.pm6', 'file.pl6'], + \ 'pf': ['pf.conf'], + \ 'pfmain': ['main.cf'], + \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'], + \ 'lpc': ['file.lpc', 'file.ulpc'], + \ 'pike': ['file.pike', 'file.pmod'], + \ 'cmod': ['file.cmod'], + \ 'pilrc': ['file.rcp'], + \ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'], + \ 'pinfo': ['/etc/pinforc', '/.pinforc'], + \ 'pli': ['file.pli', 'file.pl1'], + \ 'plm': ['file.plm', 'file.p36', 'file.pac'], + \ 'plp': ['file.plp'], + \ 'plsql': ['file.pls', 'file.plsql'], + \ 'po': ['file.po', 'file.pot'], + \ 'pod': ['file.pod'], + \ 'pod6': ['file.pod6'], + \ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'], + \ 'pov': ['file.pov'], + \ 'povini': ['.povrayrc'], + \ 'ppd': ['file.ppd'], + \ 'ppwiz': ['file.it', 'file.ih'], + \ 'privoxy': ['file.action'], + \ 'proc': ['file.pc'], + \ 'procmail': ['.procmail', '.procmailrc'], + \ 'prolog': ['file.pdb'], + \ 'promela': ['file.pml'], + \ 'proto': ['file.proto'], + \ 'protocols': ['/etc/protocols'], + \ 'psf': ['file.psf'], + \ 'pyrex': ['file.pyx', 'file.pxd'], + \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl'], + \ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg'], + \ 'radiance': ['file.rad', 'file.mat'], + \ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'], + \ 'rc': ['file.rc', 'file.rch'], + \ 'rcs': ['file,v'], + \ 'readline': ['.inputrc', 'inputrc'], + \ 'remind': ['.reminders', 'file.remind', 'file.rem'], + \ 'resolv': ['resolv.conf'], + \ 'reva': ['file.frt'], + \ 'rexx': ['file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'], + \ 'rib': ['file.rib'], + \ 'rnc': ['file.rnc'], + \ 'rng': ['file.rng'], + \ 'robots': ['robots.txt'], + \ 'rpcgen': ['file.x'], + \ 'rpl': ['file.rpl'], + \ 'rst': ['file.rst'], + \ 'rtf': ['file.rtf'], + \ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake'], + \ 'rust': ['file.rs'], + \ 'samba': ['smb.conf'], + \ 'sas': ['file.sas'], + \ 'sass': ['file.sass'], + \ 'sather': ['file.sa'], + \ 'sbt': ['file.sbt'], + \ 'scala': ['file.scala'], + \ 'scheme': ['file.scm', 'file.ss', 'file.rkt'], + \ 'scilab': ['file.sci', 'file.sce'], + \ 'screen': ['.screenrc', 'screenrc'], + \ 'scss': ['file.scss'], + \ 'sd': ['file.sd'], + \ 'sdc': ['file.sdc'], + \ 'sdl': ['file.sdl', 'file.pr'], + \ 'sed': ['file.sed'], + \ 'sensors': ['/etc/sensors.conf', '/etc/sensors3.conf'], + \ 'services': ['/etc/services'], + \ 'setserial': ['/etc/serial.conf'], + \ 'sh': ['/etc/udev/cdsymlinks.conf'], + \ 'sieve': ['file.siv'], + \ 'simula': ['file.sim'], + \ 'sinda': ['file.sin', 'file.s85'], + \ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'], + \ 'skill': ['file.il', 'file.ils', 'file.cdf'], + \ 'slang': ['file.sl'], + \ 'slice': ['file.ice'], + \ 'slpconf': ['/etc/slp.conf'], + \ 'slpreg': ['/etc/slp.reg'], + \ 'slpspi': ['/etc/slp.spi'], + \ 'slrnrc': ['.slrnrc'], + \ 'slrnsc': ['file.score'], + \ 'sm': ['sendmail.cf'], + \ 'smarty': ['file.tpl'], + \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'], + \ 'smith': ['file.smt', 'file.smith'], + \ 'sml': ['file.sml'], + \ 'snobol4': ['file.sno', 'file.spt'], + \ 'spec': ['file.spec'], + \ 'spice': ['file.sp', 'file.spice'], + \ 'spup': ['file.speedup', 'file.spdata', 'file.spd'], + \ 'spyce': ['file.spy', 'file.spi'], + \ 'sql': ['file.tyb', 'file.typ', 'file.tyc', 'file.pkb', 'file.pks'], + \ 'sqlj': ['file.sqlj'], + \ 'sqr': ['file.sqr', 'file.sqi'], + \ 'squid': ['squid.conf'], + \ 'srec': ['file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'], + \ 'sshconfig': ['ssh_config', '/.ssh/config'], + \ 'sshdconfig': ['sshd_config'], + \ 'st': ['file.st'], + \ 'stata': ['file.ado', 'file.do', 'file.imata', 'file.mata'], + \ 'stp': ['file.stp'], + \ 'sudoers': ['any/etc/sudoers', 'sudoers.tmp'], + \ 'svg': ['file.svg'], + \ 'svn': ['svn-commitfile.tmp'], + \ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf'], + \ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.mount', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer'], + \ 'systemverilog': ['file.sv', 'file.svh'], + \ 'tags': ['tags'], + \ 'tak': ['file.tak'], + \ 'taskdata': ['pending.data', 'completed.data', 'undo.data'], + \ 'taskedit': ['file.task'], + \ 'tcl': ['file.tcl', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl'], + \ 'teraterm': ['file.ttl'], + \ 'terminfo': ['file.ti'], + \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'], + \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], + \ 'texmf': ['texmf.cnf'], + \ 'text': ['file.text', 'README'], + \ 'tf': ['file.tf', '.tfrc', 'tfrc'], + \ 'tidy': ['.tidyrc', 'tidyrc'], + \ 'tilde': ['file.t.html'], + \ 'tli': ['file.tli'], + \ 'tmux': ['tmuxfile.conf', '.tmuxfile.conf'], + \ 'tpp': ['file.tpp'], + \ 'treetop': ['file.treetop'], + \ 'trustees': ['trustees.conf'], + \ 'tsalt': ['file.slt'], + \ 'tsscl': ['file.tsscl'], + \ 'tssgm': ['file.tssgm'], + \ 'tssop': ['file.tssop'], + \ 'twig': ['file.twig'], + \ 'uc': ['file.uc'], + \ 'udevconf': ['/etc/udev/udev.conf'], + \ 'udevperm': ['/etc/udev/permissions.d/file.permissions'], + \ 'uil': ['file.uit', 'file.uil'], + \ 'updatedb': ['/etc/updatedb.conf'], + \ 'upstart': ['/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override'], + \ 'upstreamdat': ['upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'], + \ 'upstreaminstalllog': ['upstreaminstall.log', 'UPSTREAMINSTALL.LOG', 'upstreaminstall.file.log', 'UPSTREAMINSTALL.FILE.LOG', 'file.upstreaminstall.log', 'FILE.UPSTREAMINSTALL.LOG'], + \ 'upstreamlog': ['fdrupstream.log', 'upstream.log', 'UPSTREAM.LOG', 'upstream.file.log', 'UPSTREAM.FILE.LOG', 'file.upstream.log', 'FILE.UPSTREAM.LOG', 'UPSTREAM-file.log', 'UPSTREAM-FILE.LOG'], + \ 'usserverlog': ['usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'], + \ 'usw2kagtlog': ['usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'], + \ 'vb': ['file.sba', 'file.vb', 'file.vbs', 'file.dsm', 'file.ctl'], + \ 'vera': ['file.vr', 'file.vri', 'file.vrh'], + \ 'verilog': ['file.v'], + \ 'verilogams': ['file.va', 'file.vams'], + \ 'vgrindefs': ['vgrindefs'], + \ 'vhdl': ['file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst'], + \ 'vim': ['file.vim', 'file.vba', '.exrc', '_exrc'], + \ 'viminfo': ['.viminfo', '_viminfo'], + \ 'vmasm': ['file.mar'], + \ 'voscm': ['file.cm'], + \ 'vrml': ['file.wrl'], + \ 'vroom': ['file.vroom'], + \ 'webmacro': ['file.wm'], + \ 'wget': ['.wgetrc', 'wgetrc'], + \ 'winbatch': ['file.wbt'], + \ 'wml': ['file.wml'], + \ 'wsml': ['file.wsml'], + \ 'wvdial': ['wvdial.conf', '.wvdialrc'], + \ 'xdefaults': ['.Xdefaults', '.Xpdefaults', '.Xresources', 'xdm-config', 'file.ad'], + \ 'xhtml': ['file.xhtml', 'file.xht'], + \ 'xinetd': ['/etc/xinetd.conf'], + \ 'xmath': ['file.msc', 'file.msf'], + \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ts', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul'], + \ 'xmodmap': ['anyXmodmap'], + \ 'xf86conf': ['xorg.conf', 'xorg.conf-4'], + \ 'xpm2': ['file.xpm2'], + \ 'xquery': ['file.xq', 'file.xql', 'file.xqm', 'file.xquery', 'file.xqy'], + \ 'xs': ['file.xs'], + \ 'xsd': ['file.xsd'], + \ 'xslt': ['file.xsl', 'file.xslt'], + \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'], + \ 'yaml': ['file.yaml', 'file.yml'], + \ 'z8a': ['file.z8a'], + \ 'zimbu': ['file.zu'], + \ 'zimbutempl': ['file.zut'], + \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh'], + \ + \ 'aap': ['file.aap'], + \ 'help': [$VIMRUNTIME . '/doc/help.txt'], + \ 'xpm': ['file.xpm'], + \ } + +let s:filename_case_checks = { + \ 'modula2': ['file.DEF', 'file.MOD'], + \ } + +func CheckItems(checks) + for [ft, names] in items(a:checks) + for i in range(0, len(names) - 1) + new + try + exe 'edit ' . names[i] + catch + call assert_report('cannot edit "' . names[i] . '": ' . v:errmsg) + endtry + call assert_equal(ft, &filetype, 'with file name: ' . names[i]) + bwipe! + endfor + endfor +endfunc + +func Test_filetype_detection() + filetype on + call CheckItems(s:filename_checks) + if has('fname_case') + call CheckItems(s:filename_case_checks) + endif + filetype off +endfunc + +" Filetypes detected from the file contents by scripts.vim +let s:script_checks = { + \ 'virata': [['% Virata'], + \ ['', '% Virata'], + \ ['', '', '% Virata'], + \ ['', '', '', '% Virata'], + \ ['', '', '', '', '% Virata']], + \ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'], + \ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'], + \ ['__libc_start_main and something']], + \ 'clojure': [['#!/path/clojure']], + \ 'scala': [['#!/path/scala']], + \ 'tcsh': [['#!/path/tcsh']], + \ 'zsh': [['#!/path/zsh']], + \ 'tcl': [['#!/path/tclsh'], + \ ['#!/path/wish'], + \ ['#!/path/expectk'], + \ ['#!/path/itclsh'], + \ ['#!/path/itkwish']], + \ 'expect': [['#!/path/expect']], + \ 'gnuplot': [['#!/path/gnuplot']], + \ 'make': [['#!/path/make']], + \ 'pike': [['#!/path/pike'], + \ ['#!/path/pike0'], + \ ['#!/path/pike9']], + \ 'lua': [['#!/path/lua']], + \ 'perl6': [['#!/path/perl6']], + \ 'perl': [['#!/path/perl']], + \ 'php': [['#!/path/php']], + \ 'python': [['#!/path/python'], + \ ['#!/path/python2'], + \ ['#!/path/python3']], + \ 'groovy': [['#!/path/groovy']], + \ 'ruby': [['#!/path/ruby']], + \ 'javascript': [['#!/path/node'], + \ ['#!/path/js'], + \ ['#!/path/nodejs'], + \ ['#!/path/rhino']], + \ 'bc': [['#!/path/bc']], + \ 'sed': [['#!/path/sed']], + \ 'ocaml': [['#!/path/ocaml']], + \ 'awk': [['#!/path/awk']], + \ 'wml': [['#!/path/wml']], + \ 'scheme': [['#!/path/scheme']], + \ 'cfengine': [['#!/path/cfengine']], + \ 'erlang': [['#!/path/escript']], + \ 'haskell': [['#!/path/haskell']], + \ } + +func Test_script_detection() + filetype on + for [ft, files] in items(s:script_checks) + for file in files + call writefile(file, 'Xtest') + split Xtest + call assert_equal(ft, &filetype, 'for text: ' . string(file)) + bwipe! + endfor + endfor + call delete('Xtest') + filetype off +endfunc + diff --git a/src/testdir/test_filter_cmd.vim b/src/testdir/test_filter_cmd.vim new file mode 100644 index 0000000000..5aa5fa64df --- /dev/null +++ b/src/testdir/test_filter_cmd.vim @@ -0,0 +1,76 @@ +" Test the :filter command modifier + +func Test_filter() + edit Xdoesnotmatch + edit Xwillmatch + call assert_equal('"Xwillmatch"', substitute(execute('filter willma ls'), '[^"]*\(".*"\)[^"]*', '\1', '')) + bwipe Xdoesnotmatch + bwipe Xwillmatch + + new + call setline(1, ['foo1', 'foo2', 'foo3', 'foo4', 'foo5']) + call assert_equal("\nfoo2\nfoo4", execute('filter /foo[24]/ 1,$print')) + call assert_equal("\n 2 foo2\n 4 foo4", execute('filter /foo[24]/ 1,$number')) + call assert_equal("\nfoo2$\nfoo4$", execute('filter /foo[24]/ 1,$list')) + + call assert_equal("\nfoo1$\nfoo3$\nfoo5$", execute('filter! /foo[24]/ 1,$list')) + bwipe! + + command XTryThis echo 'this' + command XTryThat echo 'that' + command XDoThat echo 'that' + let lines = split(execute('filter XTry command'), "\n") + call assert_equal(3, len(lines)) + call assert_match("XTryThat", lines[1]) + call assert_match("XTryThis", lines[2]) + delcommand XTryThis + delcommand XTryThat + delcommand XDoThat + + map f1 the first key + map f2 the second key + map f3 not a key + let lines = split(execute('filter the map f'), "\n") + call assert_equal(2, len(lines)) + call assert_match("f2", lines[0]) + call assert_match("f1", lines[1]) + unmap f1 + unmap f2 + unmap f3 +endfunc + +func Test_filter_fails() + call assert_fails('filter', 'E471:') + call assert_fails('filter pat', 'E476:') + call assert_fails('filter /pat', 'E476:') + call assert_fails('filter /pat/', 'E476:') + call assert_fails('filter /pat/ asdf', 'E492:') + + call assert_fails('filter!', 'E471:') + call assert_fails('filter! pat', 'E476:') + call assert_fails('filter! /pat', 'E476:') + call assert_fails('filter! /pat/', 'E476:') + call assert_fails('filter! /pat/ asdf', 'E492:') +endfunc + +function s:complete_filter_cmd(filtcmd) + let keystroke = "\<TAB>\<C-R>=execute('let cmdline = getcmdline()')\<CR>\<C-C>" + let cmdline = '' + call feedkeys(':' . a:filtcmd . keystroke, 'ntx') + return cmdline +endfunction + +func Test_filter_cmd_completion() + " Do not complete pattern + call assert_equal("filter \t", s:complete_filter_cmd('filter ')) + call assert_equal("filter pat\t", s:complete_filter_cmd('filter pat')) + call assert_equal("filter /pat\t", s:complete_filter_cmd('filter /pat')) + call assert_equal("filter /pat/\t", s:complete_filter_cmd('filter /pat/')) + + " Complete after string pattern + call assert_equal('filter pat print', s:complete_filter_cmd('filter pat pri')) + + " Complete after regexp pattern + call assert_equal('filter /pat/ print', s:complete_filter_cmd('filter /pat/ pri')) + call assert_equal('filter #pat# print', s:complete_filter_cmd('filter #pat# pri')) +endfunc diff --git a/src/testdir/test_filter_map.vim b/src/testdir/test_filter_map.vim new file mode 100644 index 0000000000..c8d64ce0a4 --- /dev/null +++ b/src/testdir/test_filter_map.vim @@ -0,0 +1,81 @@ +" Test filter() and map() + +" list with expression string +func Test_filter_map_list_expr_string() + " filter() + call assert_equal([2, 3, 4], filter([1, 2, 3, 4], 'v:val > 1')) + call assert_equal([3, 4], filter([1, 2, 3, 4], 'v:key > 1')) + call assert_equal([], filter([1, 2, 3, 4], 0)) + + " map() + call assert_equal([2, 4, 6, 8], map([1, 2, 3, 4], 'v:val * 2')) + call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], 'v:key * 2')) + call assert_equal([9, 9, 9, 9], map([1, 2, 3, 4], 9)) +endfunc + +" dict with expression string +func Test_filter_map_dict_expr_string() + let dict = {"foo": 1, "bar": 2, "baz": 3} + + " filter() + call assert_equal({"bar": 2, "baz": 3}, filter(copy(dict), 'v:val > 1')) + call assert_equal({"foo": 1, "baz": 3}, filter(copy(dict), 'v:key > "bar"')) + call assert_equal({}, filter(copy(dict), 0)) + + " map() + call assert_equal({"foo": 2, "bar": 4, "baz": 6}, map(copy(dict), 'v:val * 2')) + call assert_equal({"foo": "f", "bar": "b", "baz": "b"}, map(copy(dict), 'v:key[0]')) + call assert_equal({"foo": 9, "bar": 9, "baz": 9}, map(copy(dict), 9)) +endfunc + +" list with funcref +func Test_filter_map_list_expr_funcref() + " filter() + func! s:filter1(index, val) abort + return a:val > 1 + endfunc + call assert_equal([2, 3, 4], filter([1, 2, 3, 4], function('s:filter1'))) + + func! s:filter2(index, val) abort + return a:index > 1 + endfunc + call assert_equal([3, 4], filter([1, 2, 3, 4], function('s:filter2'))) + + " map() + func! s:filter3(index, val) abort + return a:val * 2 + endfunc + call assert_equal([2, 4, 6, 8], map([1, 2, 3, 4], function('s:filter3'))) + + func! s:filter4(index, val) abort + return a:index * 2 + endfunc + call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], function('s:filter4'))) +endfunc + +" dict with funcref +func Test_filter_map_dict_expr_funcref() + let dict = {"foo": 1, "bar": 2, "baz": 3} + + " filter() + func! s:filter1(key, val) abort + return a:val > 1 + endfunc + call assert_equal({"bar": 2, "baz": 3}, filter(copy(dict), function('s:filter1'))) + + func! s:filter2(key, val) abort + return a:key > "bar" + endfunc + call assert_equal({"foo": 1, "baz": 3}, filter(copy(dict), function('s:filter2'))) + + " map() + func! s:filter3(key, val) abort + return a:val * 2 + endfunc + call assert_equal({"foo": 2, "bar": 4, "baz": 6}, map(copy(dict), function('s:filter3'))) + + func! s:filter4(key, val) abort + return a:key[0] + endfunc + call assert_equal({"foo": "f", "bar": "b", "baz": "b"}, map(copy(dict), function('s:filter4'))) +endfunc diff --git a/src/testdir/test_find_complete.vim b/src/testdir/test_find_complete.vim new file mode 100644 index 0000000000..a7bc135d47 --- /dev/null +++ b/src/testdir/test_find_complete.vim @@ -0,0 +1,163 @@ +" Tests for the 'find' command completion. + +" Do all the tests in a separate window to avoid E211 when we recursively +" delete the Xfind directory during cleanup +func Test_find_complete() + set belloff=all + + " On windows a stale "Xfind" directory may exist, remove it so that + " we start from a clean state. + call delete("Xfind", "rf") + let cwd = getcwd() + let test_out = cwd . '/test.out' + call mkdir('Xfind') + cd Xfind + + new + set path= + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E345:') + close + + new + set path=. + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + new + set path=.,, + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + new + set path=./** + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + " We shouldn't find any file till this point + + call mkdir('in/path', 'p') + exe 'cd ' . cwd + call writefile(['Holy Grail'], 'Xfind/file.txt') + call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt') + call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt') + call writefile(['E.T.'], 'Xfind/in/path/file.txt') + + new + set path=Xfind/** + call feedkeys(":find file\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + call feedkeys(":find file\t\t\t\n", "xt") + call assert_equal('E.T.', getline(1)) + + " Rerun the previous three find completions, using fullpath in 'path' + exec "set path=" . cwd . "/Xfind/**" + + call feedkeys(":find file\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + call feedkeys(":find file\t\t\t\n", "xt") + call assert_equal('E.T.', getline(1)) + + " Same steps again, using relative and fullpath items that point to the same + " recursive location. + " This is to test that there are no duplicates in the completion list. + set path+=Xfind/** + call feedkeys(":find file\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + call feedkeys(":find file\t\t\t\n", "xt") + call assert_equal('E.T.', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + + " Test find completion for directory of current buffer, which at this point + " is Xfind/in/file.txt. + set path=. + call feedkeys(":find st\t\n", "xt") + call assert_equal('Another Holy Grail', getline(1)) + + " Test find completion for empty path item ",," which is the current + " directory + cd Xfind + set path=,, + call feedkeys(":find f\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + + " Test that find completion on directory appends a slash + call feedkeys(":find in/pa\tfile.txt\n", "xt") + call assert_equal('E.T.', getline(1)) + call feedkeys(":find ./i\tstuff.txt\n", "xt") + call assert_equal('Another Holy Grail', getline(1)) + + " Test shortening of + " + " foo/x/bar/voyager.txt + " foo/y/bar/voyager.txt + " + " When current directory is above foo/ they should be shortened to (in order + " of appearance): + " + " x/bar/voyager.txt + " y/bar/voyager.txt + call mkdir('foo/x/bar', 'p') + call mkdir('foo/y/bar', 'p') + call writefile(['Voyager 1'], 'foo/x/bar/voyager.txt') + call writefile(['Voyager 2'], 'foo/y/bar/voyager.txt') + + exec "set path=" . cwd . "/Xfind/**" + call feedkeys(":find voyager\t\n", "xt") + call assert_equal('Voyager 1', getline(1)) + call feedkeys(":find voyager\t\t\n", "xt") + call assert_equal('Voyager 2', getline(1)) + + " + " When current directory is .../foo/y/bar they should be shortened to (in + " order of appearance): + " + " ./voyager.txt + " x/bar/voyager.txt + cd foo/y/bar + call feedkeys(":find voyager\t\n", "xt") + call assert_equal('Voyager 2', getline(1)) + call feedkeys(":find voyager\t\t\n", "xt") + call assert_equal('Voyager 1', getline(1)) + + " Check the opposite too: + cd ../../x/bar + call feedkeys(":find voyager\t\n", "xt") + call assert_equal('Voyager 1', getline(1)) + call feedkeys(":find voyager\t\t\n", "xt") + call assert_equal('Voyager 2', getline(1)) + + " Check for correct handling of shorten_fname()'s behavior on windows + exec "cd " . cwd . "/Xfind/in" + call feedkeys(":find file\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + + " Test for relative to current buffer 'path' item + exec "cd " . cwd . "/Xfind/" + set path=./path + " Open the file where Jimmy Hoffa is found + e in/file.txt + " Find the file containing 'E.T.' in the Xfind/in/path directory + call feedkeys(":find file\t\n", "xt") + call assert_equal('E.T.', getline(1)) + + " Test that completion works when path=.,, + set path=.,, + " Open Jimmy Hoffa file + e in/file.txt + call assert_equal('Jimmy Hoffa', getline(1)) + + " Search for the file containing Holy Grail in same directory as in/path.txt + call feedkeys(":find stu\t\n", "xt") + call assert_equal('Another Holy Grail', getline(1)) + + enew | only + exe 'cd ' . cwd + call delete('Xfind', 'rf') + set path& +endfunc diff --git a/src/testdir/test_findfile.vim b/src/testdir/test_findfile.vim new file mode 100644 index 0000000000..85e5cd2c9f --- /dev/null +++ b/src/testdir/test_findfile.vim @@ -0,0 +1,25 @@ +" Test for findfile() +" +func Test_findfile() + new + let cwd=getcwd() + cd .. + + " Tests may be run from a shadow directory, so an extra cd needs to be done to + " get above src/ + if fnamemodify(getcwd(), ':t') != 'src' + cd ../.. + else + cd .. + endif + set ssl + + call assert_equal('src/testdir/test_findfile.vim', findfile('test_findfile.vim','src/test*')) + exe "cd" cwd + cd .. + call assert_equal('testdir/test_findfile.vim', findfile('test_findfile.vim','test*')) + call assert_equal('testdir/test_findfile.vim', findfile('test_findfile.vim','testdir')) + + exe "cd" cwd + q! +endfunc diff --git a/src/testdir/test_fixeol.vim b/src/testdir/test_fixeol.vim new file mode 100644 index 0000000000..32cb059e26 --- /dev/null +++ b/src/testdir/test_fixeol.vim @@ -0,0 +1,48 @@ +" Tests for 'fixeol' and 'eol' +func Test_fixeol() + " first write two test files – with and without trailing EOL + " use Unix fileformat for consistency + set ff=unix + enew! + call setline('.', 'with eol') + w! XXEol + enew! + set noeol nofixeol + call setline('.', 'without eol') + w! XXNoEol + set eol fixeol + bwipe XXEol XXNoEol + + " try editing files with 'fixeol' disabled + e! XXEol + normal ostays eol + set nofixeol + w! XXTestEol + e! XXNoEol + normal ostays without + set nofixeol + w! XXTestNoEol + bwipe! XXEol XXNoEol XXTestEol XXTestNoEol + set fixeol + + " Append "END" to each file so that we can see what the last written char + " was. + normal ggdGaEND + w >>XXEol + w >>XXNoEol + w >>XXTestEol + w >>XXTestNoEol + + call assert_equal(['with eol', 'END'], readfile('XXEol')) + call assert_equal(['without eolEND'], readfile('XXNoEol')) + call assert_equal(['with eol', 'stays eol', 'END'], readfile('XXTestEol')) + call assert_equal(['without eol', 'stays withoutEND'], + \ readfile('XXTestNoEol')) + + call delete('XXEol') + call delete('XXNoEol') + call delete('XXTestEol') + call delete('XXTestNoEol') + set ff& fixeol& eol& + enew! +endfunc diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim new file mode 100644 index 0000000000..32b985e1b8 --- /dev/null +++ b/src/testdir/test_float_func.vim @@ -0,0 +1,331 @@ +" test float functions + +if !has('float') + finish +end + +func Test_abs() + call assert_equal('1.23', string(abs(1.23))) + call assert_equal('1.23', string(abs(-1.23))) + call assert_equal('0.0', string(abs(0.0))) + call assert_equal('0.0', string(abs(1.0/(1.0/0.0)))) + call assert_equal('0.0', string(abs(-1.0/(1.0/0.0)))) + call assert_equal('inf', string(abs(1.0/0.0))) + call assert_equal('inf', string(abs(-1.0/0.0))) + call assert_equal('nan', string(abs(0.0/0.0))) + call assert_equal('12', string(abs('-12abc'))) + call assert_fails("call abs([])", 'E745:') + call assert_fails("call abs({})", 'E728:') + call assert_fails("call abs(function('string'))", 'E703:') +endfunc + +func Test_sqrt() + call assert_equal('0.0', string(sqrt(0.0))) + call assert_equal('1.414214', string(sqrt(2.0))) + call assert_equal('inf', string(sqrt(1.0/0.0))) + call assert_equal('nan', string(sqrt(-1.0))) + call assert_equal('nan', string(sqrt(0.0/0.0))) + call assert_fails('call sqrt("")', 'E808:') +endfunc + +func Test_log() + call assert_equal('0.0', string(log(1.0))) + call assert_equal('-0.693147', string(log(0.5))) + call assert_equal('-inf', string(log(0.0))) + call assert_equal('nan', string(log(-1.0))) + call assert_equal('inf', string(log(1.0/0.0))) + call assert_equal('nan', string(log(0.0/0.0))) + call assert_fails('call log("")', 'E808:') +endfunc + +func Test_log10() + call assert_equal('0.0', string(log10(1.0))) + call assert_equal('2.0', string(log10(100.0))) + call assert_equal('2.079181', string(log10(120.0))) + call assert_equal('-inf', string(log10(0.0))) + call assert_equal('nan', string(log10(-1.0))) + call assert_equal('inf', string(log10(1.0/0.0))) + call assert_equal('nan', string(log10(0.0/0.0))) + call assert_fails('call log10("")', 'E808:') +endfunc + +func Test_exp() + call assert_equal('1.0', string(exp(0.0))) + call assert_equal('7.389056', string(exp(2.0))) + call assert_equal('0.367879', string(exp(-1.0))) + call assert_equal('inf', string(exp(1.0/0.0))) + call assert_equal('0.0', string(exp(-1.0/0.0))) + call assert_equal('nan', string(exp(0.0/0.0))) + call assert_fails('call exp("")', 'E808:') +endfunc + +func Test_sin() + call assert_equal('0.0', string(sin(0.0))) + call assert_equal('0.841471', string(sin(1.0))) + call assert_equal('-0.479426', string(sin(-0.5))) + call assert_equal('nan', string(sin(0.0/0.0))) + call assert_equal('nan', string(sin(1.0/0.0))) + call assert_equal('0.0', string(sin(1.0/(1.0/0.0)))) + call assert_equal('-0.0', string(sin(-1.0/(1.0/0.0)))) + call assert_fails('call sin("")', 'E808:') +endfunc + +func Test_asin() + call assert_equal('0.0', string(asin(0.0))) + call assert_equal('1.570796', string(asin(1.0))) + call assert_equal('-0.523599', string(asin(-0.5))) + call assert_equal('nan', string(asin(1.1))) + call assert_equal('nan', string(asin(1.0/0.0))) + call assert_equal('nan', string(asin(0.0/0.0))) + call assert_fails('call asin("")', 'E808:') +endfunc + +func Test_sinh() + call assert_equal('0.0', string(sinh(0.0))) + call assert_equal('0.521095', string(sinh(0.5))) + call assert_equal('-1.026517', string(sinh(-0.9))) + call assert_equal('inf', string(sinh(1.0/0.0))) + call assert_equal('-inf', string(sinh(-1.0/0.0))) + call assert_equal('nan', string(sinh(0.0/0.0))) + call assert_fails('call sinh("")', 'E808:') +endfunc + +func Test_cos() + call assert_equal('1.0', string(cos(0.0))) + call assert_equal('0.540302', string(cos(1.0))) + call assert_equal('0.877583', string(cos(-0.5))) + call assert_equal('nan', string(cos(0.0/0.0))) + call assert_equal('nan', string(cos(1.0/0.0))) + call assert_fails('call cos("")', 'E808:') +endfunc + +func Test_acos() + call assert_equal('1.570796', string(acos(0.0))) + call assert_equal('0.0', string(acos(1.0))) + call assert_equal('3.141593', string(acos(-1.0))) + call assert_equal('2.094395', string(acos(-0.5))) + call assert_equal('nan', string(acos(1.1))) + call assert_equal('nan', string(acos(1.0/0.0))) + call assert_equal('nan', string(acos(0.0/0.0))) + call assert_fails('call acos("")', 'E808:') +endfunc + +func Test_cosh() + call assert_equal('1.0', string(cosh(0.0))) + call assert_equal('1.127626', string(cosh(0.5))) + call assert_equal('inf', string(cosh(1.0/0.0))) + call assert_equal('inf', string(cosh(-1.0/0.0))) + call assert_equal('nan', string(cosh(0.0/0.0))) + call assert_fails('call cosh("")', 'E808:') +endfunc + +func Test_tan() + call assert_equal('0.0', string(tan(0.0))) + call assert_equal('0.546302', string(tan(0.5))) + call assert_equal('-0.546302', string(tan(-0.5))) + call assert_equal('nan', string(tan(1.0/0.0))) + call assert_equal('nan', string(cos(0.0/0.0))) + call assert_equal('0.0', string(tan(1.0/(1.0/0.0)))) + call assert_equal('-0.0', string(tan(-1.0/(1.0/0.0)))) + call assert_fails('call tan("")', 'E808:') +endfunc + +func Test_atan() + call assert_equal('0.0', string(atan(0.0))) + call assert_equal('0.463648', string(atan(0.5))) + call assert_equal('-0.785398', string(atan(-1.0))) + call assert_equal('1.570796', string(atan(1.0/0.0))) + call assert_equal('-1.570796', string(atan(-1.0/0.0))) + call assert_equal('nan', string(atan(0.0/0.0))) + call assert_fails('call atan("")', 'E808:') +endfunc + +func Test_atan2() + call assert_equal('-2.356194', string(atan2(-1, -1))) + call assert_equal('2.356194', string(atan2(1, -1))) + call assert_equal('0.0', string(atan2(1.0, 1.0/0.0))) + call assert_equal('1.570796', string(atan2(1.0/0.0, 1.0))) + call assert_equal('nan', string(atan2(0.0/0.0, 1.0))) + call assert_fails('call atan2("", -1)', 'E808:') + call assert_fails('call atan2(-1, "")', 'E808:') +endfunc + +func Test_tanh() + call assert_equal('0.0', string(tanh(0.0))) + call assert_equal('0.462117', string(tanh(0.5))) + call assert_equal('-0.761594', string(tanh(-1.0))) + call assert_equal('1.0', string(tanh(1.0/0.0))) + call assert_equal('-1.0', string(tanh(-1.0/0.0))) + call assert_equal('nan', string(tanh(0.0/0.0))) + call assert_fails('call tanh("")', 'E808:') +endfunc + +func Test_fmod() + call assert_equal('0.13', string(fmod(12.33, 1.22))) + call assert_equal('-0.13', string(fmod(-12.33, 1.22))) + call assert_equal('nan', string(fmod(1.0/0.0, 1.0))) + " On Windows we get "nan" instead of 1.0, accept both. + let res = string(fmod(1.0, 1.0/0.0)) + if res != 'nan' + call assert_equal('1.0', res) + endif + call assert_equal('nan', string(fmod(1.0, 0.0))) + call assert_fails("call fmod('', 1.22)", 'E808:') + call assert_fails("call fmod(12.33, '')", 'E808:') +endfunc + +func Test_pow() + call assert_equal('1.0', string(pow(0.0, 0.0))) + call assert_equal('8.0', string(pow(2.0, 3.0))) + call assert_equal('nan', string(pow(2.0, 0.0/0.0))) + call assert_equal('nan', string(pow(0.0/0.0, 3.0))) + call assert_equal('nan', string(pow(0.0/0.0, 3.0))) + call assert_equal('inf', string(pow(2.0, 1.0/0.0))) + call assert_equal('inf', string(pow(1.0/0.0, 3.0))) + call assert_fails("call pow('', 2.0)", 'E808:') + call assert_fails("call pow(2.0, '')", 'E808:') +endfunc + +func Test_str2float() + call assert_equal('1.0', string(str2float('1'))) + call assert_equal('1.0', string(str2float(' 1 '))) + call assert_equal('1.0', string(str2float(' 1.0 '))) + call assert_equal('1.23', string(str2float('1.23'))) + call assert_equal('1.23', string(str2float('1.23abc'))) + call assert_equal('1.0e40', string(str2float('1e40'))) + call assert_equal('-1.23', string(str2float('-1.23'))) + call assert_equal('1.23', string(str2float(' + 1.23 '))) + + call assert_equal('1.0', string(str2float('+1'))) + call assert_equal('1.0', string(str2float('+1'))) + call assert_equal('1.0', string(str2float(' +1 '))) + call assert_equal('1.0', string(str2float(' + 1 '))) + + call assert_equal('-1.0', string(str2float('-1'))) + call assert_equal('-1.0', string(str2float('-1'))) + call assert_equal('-1.0', string(str2float(' -1 '))) + call assert_equal('-1.0', string(str2float(' - 1 '))) + + call assert_equal('0.0', string(str2float('+0.0'))) + call assert_equal('-0.0', string(str2float('-0.0'))) + call assert_equal('inf', string(str2float('1e1000'))) + call assert_equal('inf', string(str2float('inf'))) + call assert_equal('-inf', string(str2float('-inf'))) + call assert_equal('inf', string(str2float('+inf'))) + call assert_equal('inf', string(str2float('Inf'))) + call assert_equal('inf', string(str2float(' +inf '))) + call assert_equal('nan', string(str2float('nan'))) + call assert_equal('nan', string(str2float('NaN'))) + call assert_equal('nan', string(str2float(' nan '))) + + call assert_fails("call str2float(1.2)", 'E806:') + call assert_fails("call str2float([])", 'E730:') + call assert_fails("call str2float({})", 'E731:') + call assert_fails("call str2float(function('string'))", 'E729:') +endfunc + +func Test_float2nr() + call assert_equal(1, float2nr(1.234)) + call assert_equal(123, float2nr(1.234e2)) + call assert_equal(12, float2nr(123.4e-1)) + let max_number = 1/0 + let min_number = -max_number + call assert_equal(max_number/2+1, float2nr(pow(2, 62))) + call assert_equal(max_number, float2nr(pow(2, 63))) + call assert_equal(max_number, float2nr(pow(2, 64))) + call assert_equal(min_number/2-1, float2nr(-pow(2, 62))) + call assert_equal(min_number, float2nr(-pow(2, 63))) + call assert_equal(min_number, float2nr(-pow(2, 64))) +endfunc + +func Test_floor() + call assert_equal('2.0', string(floor(2.0))) + call assert_equal('2.0', string(floor(2.11))) + call assert_equal('2.0', string(floor(2.99))) + call assert_equal('-3.0', string(floor(-2.11))) + call assert_equal('-3.0', string(floor(-2.99))) + call assert_equal('nan', string(floor(0.0/0.0))) + call assert_equal('inf', string(floor(1.0/0.0))) + call assert_equal('-inf', string(floor(-1.0/0.0))) + call assert_fails("call floor('')", 'E808:') +endfunc + +func Test_ceil() + call assert_equal('2.0', string(ceil(2.0))) + call assert_equal('3.0', string(ceil(2.11))) + call assert_equal('3.0', string(ceil(2.99))) + call assert_equal('-2.0', string(ceil(-2.11))) + call assert_equal('-2.0', string(ceil(-2.99))) + call assert_equal('nan', string(ceil(0.0/0.0))) + call assert_equal('inf', string(ceil(1.0/0.0))) + call assert_equal('-inf', string(ceil(-1.0/0.0))) + call assert_fails("call ceil('')", 'E808:') +endfunc + +func Test_round() + call assert_equal('2.0', string(round(2.1))) + call assert_equal('3.0', string(round(2.5))) + call assert_equal('3.0', string(round(2.9))) + call assert_equal('-2.0', string(round(-2.1))) + call assert_equal('-3.0', string(round(-2.5))) + call assert_equal('-3.0', string(round(-2.9))) + call assert_equal('nan', string(round(0.0/0.0))) + call assert_equal('inf', string(round(1.0/0.0))) + call assert_equal('-inf', string(round(-1.0/0.0))) + call assert_fails("call round('')", 'E808:') +endfunc + +func Test_trunc() + call assert_equal('2.0', string(trunc(2.1))) + call assert_equal('2.0', string(trunc(2.5))) + call assert_equal('2.0', string(trunc(2.9))) + call assert_equal('-2.0', string(trunc(-2.1))) + call assert_equal('-2.0', string(trunc(-2.5))) + call assert_equal('-2.0', string(trunc(-2.9))) + call assert_equal('nan', string(trunc(0.0/0.0))) + call assert_equal('inf', string(trunc(1.0/0.0))) + call assert_equal('-inf', string(trunc(-1.0/0.0))) + call assert_fails("call trunc('')", 'E808:') +endfunc + +func Test_isnan() + call assert_equal(0, isnan(1.0)) + call assert_equal(1, isnan(0.0/0.0)) + call assert_equal(0, isnan(1.0/0.0)) + call assert_equal(0, isnan('a')) + call assert_equal(0, isnan([])) + call assert_equal(0, isnan({})) +endfunc + +" This was converted from test65 +func Test_float_misc() + call assert_equal('123.456000', printf('%f', 123.456)) + call assert_equal('1.234560e+02', printf('%e', 123.456)) + call assert_equal('123.456', printf('%g', 123.456)) + " += + let v = 1.234 + let v += 6.543 + call assert_equal('7.777', printf('%g', v)) + let v = 1.234 + let v += 5 + call assert_equal('6.234', printf('%g', v)) + let v = 5 + let v += 3.333 + call assert_equal('8.333', string(v)) + " == + let v = 1.234 + call assert_true(v == 1.234) + call assert_false(v == 1.2341) + " add-subtract + call assert_equal('5.234', printf('%g', 4 + 1.234)) + call assert_equal('-6.766', printf('%g', 1.234 - 8)) + " mult-div + call assert_equal('4.936', printf('%g', 4 * 1.234)) + call assert_equal('0.003241', printf('%g', 4.0 / 1234)) + " dict + call assert_equal("{'x': 1.234, 'y': -2.0e20}", string({'x': 1.234, 'y': -2.0e20})) + " list + call assert_equal('[-123.4, 2.0e-20]', string([-123.4, 2.0e-20])) +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_fnameescape.vim b/src/testdir/test_fnameescape.vim new file mode 100644 index 0000000000..cdff0dfbd9 --- /dev/null +++ b/src/testdir/test_fnameescape.vim @@ -0,0 +1,21 @@ + +" Test if fnameescape is correct for special chars like ! +function! Test_fnameescape() + let fname = 'Xspa ce' + let status = v:false + try + exe "w! " . fnameescape(fname) + let status = v:true + endtry + call assert_true(status, "Space") + call delete(fname) + + let fname = 'Xemark!' + let status = v:false + try + exe "w! " . fnameescape(fname) + let status = v:true + endtry + call assert_true(status, "ExclamationMark") + call delete(fname) +endfunction diff --git a/src/testdir/test_fnamemodify.vim b/src/testdir/test_fnamemodify.vim new file mode 100644 index 0000000000..768d31192a --- /dev/null +++ b/src/testdir/test_fnamemodify.vim @@ -0,0 +1,53 @@ +" Test filename modifiers. + +func Test_fnamemodify() + let save_home = $HOME + let save_shell = &shell + let $HOME = fnamemodify('.', ':p:h:h') + set shell=sh + + call assert_equal('/', fnamemodify('.', ':p')[-1:]) + call assert_equal('r', fnamemodify('.', ':p:h')[-1:]) + call assert_equal('t', fnamemodify('test.out', ':p')[-1:]) + call assert_equal('test.out', fnamemodify('test.out', ':.')) + call assert_equal('a', fnamemodify('../testdir/a', ':.')) + call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~')) + call assert_equal('~/testdir/a', fnamemodify('../testdir/a', ':~')) + call assert_equal('a', fnamemodify('../testdir/a', ':t')) + call assert_equal('', fnamemodify('.', ':p:t')) + call assert_equal('test.out', fnamemodify('test.out', ':p:t')) + call assert_equal('out', fnamemodify('test.out', ':p:e')) + call assert_equal('out', fnamemodify('test.out', ':p:t:e')) + call assert_equal('abc.fb2.tar', fnamemodify('abc.fb2.tar.gz', ':r')) + call assert_equal('abc.fb2', fnamemodify('abc.fb2.tar.gz', ':r:r')) + call assert_equal('abc', fnamemodify('abc.fb2.tar.gz', ':r:r:r')) + call assert_equal('testdir/abc.fb2', substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '')) + call assert_equal('gz', fnamemodify('abc.fb2.tar.gz', ':e')) + call assert_equal('tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e')) + call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e')) + call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e:e')) + call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r')) + + call assert_equal('''abc def''', fnamemodify('abc def', ':S')) + call assert_equal('''abc" "def''', fnamemodify('abc" "def', ':S')) + call assert_equal('''abc"%"def''', fnamemodify('abc"%"def', ':S')) + call assert_equal('''abc''\'''' ''\''''def''', fnamemodify('abc'' ''def', ':S')) + call assert_equal('''abc''\''''%''\''''def''', fnamemodify('abc''%''def', ':S')) + sp test_alot.vim + call assert_equal(expand('%:r:S'), shellescape(expand('%:r'))) + call assert_equal('test_alot,''test_alot'',test_alot.vim', join([expand('%:r'), expand('%:r:S'), expand('%')], ',')) + quit + + call assert_equal("'abc\ndef'", fnamemodify("abc\ndef", ':S')) + set shell=tcsh + call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S')) + + let $HOME = save_home + let &shell = save_shell +endfunc + +func Test_expand() + new + call assert_equal("", expand('%:S')) + quit +endfunc diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim new file mode 100644 index 0000000000..de6688365d --- /dev/null +++ b/src/testdir/test_fold.vim @@ -0,0 +1,650 @@ +" Test for folding + +func PrepIndent(arg) + return [a:arg] + repeat(["\t".a:arg], 5) +endfu + +func Test_address_fold() + new + call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/', + \ 'after fold 1', 'after fold 2', 'after fold 3']) + setl fen fdm=marker + " The next commands should all copy the same part of the buffer, + " regardless of the addressing type, since the part to be copied + " is folded away + :1y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :.y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :.+y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :.,.y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :sil .1,.y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .+,.y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :,y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + :,+y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/','after fold 1'], getreg(0,1,1)) + " using .+3 as second address should copy the whole folded line + the next 3 + " lines + :.,+3y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/', + \ 'after fold 1', 'after fold 2', 'after fold 3'], getreg(0,1,1)) + :sil .,-2y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) + + " now test again with folding disabled + set nofoldenable + :1y + call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) + :.y + call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) + :.+y + call assert_equal(['1'], getreg(0,1,1)) + :.,.y + call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .1,.y + call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .+,.y + call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) + :,y + call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) + :,+y + call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) + " using .+3 as second address should copy the whole folded line + the next 3 + " lines + :.,+3y + call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3'], getreg(0,1,1)) + :7 + :sil .,-2y + call assert_equal(['4', '5', '}/*}}}*/'], getreg(0,1,1)) + + quit! +endfunc + +func Test_indent_fold() + new + call setline(1, ['', 'a', ' b', ' c']) + setl fen fdm=indent + 2 + norm! >> + let a=map(range(1,4), 'foldclosed(v:val)') + call assert_equal([-1,-1,-1,-1], a) + bw! +endfunc + +func Test_indent_fold2() + new + call setline(1, ['', '{{{', '}}}', '{{{', '}}}']) + setl fen fdm=marker + 2 + norm! >> + let a=map(range(1,5), 'foldclosed(v:val)') + call assert_equal([-1,-1,-1,4,4], a) + bw! +endfunc + +func Test_manual_fold_with_filter() + if !executable('cat') + return + endif + for type in ['manual', 'marker'] + exe 'set foldmethod=' . type + new + call setline(1, range(1, 20)) + 4,$fold + %foldopen + 10,$fold + %foldopen + " This filter command should not have an effect + 1,8! cat + call feedkeys('5ggzdzMGdd', 'xt') + call assert_equal(['1', '2', '3', '4', '5', '6', '7', '8', '9'], getline(1, '$')) + + bwipe! + set foldmethod& + endfor +endfunc + +func Test_indent_fold_with_read() + new + set foldmethod=indent + call setline(1, repeat(["\<Tab>a"], 4)) + for n in range(1, 4) + call assert_equal(1, foldlevel(n)) + endfor + + call writefile(["a", "", "\<Tab>a"], 'Xfile') + foldopen + 2read Xfile + %foldclose + call assert_equal(1, foldlevel(1)) + call assert_equal(2, foldclosedend(1)) + call assert_equal(0, foldlevel(3)) + call assert_equal(0, foldlevel(4)) + call assert_equal(1, foldlevel(5)) + call assert_equal(7, foldclosedend(5)) + + bwipe! + set foldmethod& + call delete('Xfile') +endfunc + +func Test_combining_folds_indent() + new + let one = "\<Tab>a" + let zero = 'a' + call setline(1, [one, one, zero, zero, zero, one, one, one]) + set foldmethod=indent + 3,5d + %foldclose + call assert_equal(5, foldclosedend(1)) + + set foldmethod& + bwipe! +endfunc + +func Test_combining_folds_marker() + new + call setline(1, ['{{{', '}}}', '', '', '', '{{{', '', '}}}']) + set foldmethod=marker + 3,5d + %foldclose + call assert_equal(2, foldclosedend(1)) + + set foldmethod& + bwipe! +endfunc + +func Test_folds_marker_in_comment() + new + call setline(1, ['" foo', 'bar', 'baz']) + setl fen fdm=marker + setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s + norm! zf2j + setl nofen + :1y + call assert_equal(['" foo{{{'], getreg(0,1,1)) + :+2y + call assert_equal(['baz"}}}'], getreg(0,1,1)) + + set foldmethod& + bwipe! +endfunc + +func s:TestFoldExpr(lnum) + let thisline = getline(a:lnum) + if thisline == 'a' + return 1 + elseif thisline == 'b' + return 0 + elseif thisline == 'c' + return '<1' + elseif thisline == 'd' + return '>1' + endif + return 0 +endfunction + +func Test_update_folds_expr_read() + new + call setline(1, ['a', 'a', 'a', 'a', 'a', 'a']) + set foldmethod=expr + set foldexpr=s:TestFoldExpr(v:lnum) + 2 + foldopen + call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xfile') + read Xfile + %foldclose + call assert_equal(2, foldclosedend(1)) + call assert_equal(0, foldlevel(3)) + call assert_equal(0, foldlevel(4)) + call assert_equal(6, foldclosedend(5)) + call assert_equal(10, foldclosedend(7)) + call assert_equal(14, foldclosedend(11)) + + call delete('Xfile') + bwipe! + set foldmethod& foldexpr& +endfunc + +func Check_foldlevels(expected) + call assert_equal(a:expected, map(range(1, line('$')), 'foldlevel(v:val)')) +endfunc + +func Test_move_folds_around_manual() + new + let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c") + call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) + let folds=[-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14] + " all folds closed + set foldenable foldlevel=0 fdm=indent + " needs a forced redraw + redraw! + set fdm=manual + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + call assert_equal(input, getline(1, '$')) + 7,12m0 + call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + 10,12m0 + call assert_equal(PrepIndent("a")[1:] + PrepIndent("b") + ["a"] + PrepIndent("c"), getline(1, '$')) + call assert_equal([1, 1, 1, 1, 1, -1, 7, 7, 7, 7, 7, -1, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) + " moving should not close the folds + %d + call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) + set fdm=indent + redraw! + set fdm=manual + call cursor(2, 1) + %foldopen + 7,12m0 + let folds=repeat([-1], 18) + call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + norm! zM + " folds are not corrupted and all have been closed + call assert_equal([-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) + %d + call setline(1, ["a", "\tb", "\tc", "\td", "\te"]) + set fdm=indent + redraw! + set fdm=manual + %foldopen + 3m4 + %foldclose + call assert_equal(["a", "\tb", "\td", "\tc", "\te"], getline(1, '$')) + call assert_equal([-1, 5, 5, 5, 5], map(range(1, line('$')), 'foldclosedend(v:val)')) + %d + call setline(1, ["a", "\tb", "\tc", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"]) + set fdm=indent foldlevel=0 + set fdm=manual + %foldopen + 3m1 + %foldclose + call assert_equal(["a", "\tc", "\tb", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"], getline(1, '$')) + call assert_equal(0, foldlevel(2)) + call assert_equal(5, foldclosedend(3)) + call assert_equal([-1, -1, 3, 3, 3, -1, 7, 7, 7, 7], map(range(1, line('$')), 'foldclosed(v:val)')) + 2,6m$ + %foldclose + call assert_equal(5, foldclosedend(2)) + call assert_equal(0, foldlevel(6)) + call assert_equal(9, foldclosedend(7)) + call assert_equal([-1, 2, 2, 2, 2, -1, 7, 7, 7, -1], map(range(1, line('$')), 'foldclosed(v:val)')) + + %d + " Ensure moving around the edges still works. + call setline(1, PrepIndent("a") + repeat(["a"], 3) + ["\ta"]) + set fdm=indent foldlevel=0 + set fdm=manual + %foldopen + 6m$ + " The first fold has been truncated to the 5'th line. + " Second fold has been moved up because the moved line is now below it. + call Check_foldlevels([0, 1, 1, 1, 1, 0, 0, 0, 1, 0]) + + %delete + set fdm=indent foldlevel=0 + call setline(1, [ + \ "a", + \ "\ta", + \ "\t\ta", + \ "\t\ta", + \ "\t\ta", + \ "a", + \ "a"]) + set fdm=manual + %foldopen! + 4,5m6 + call Check_foldlevels([0, 1, 2, 0, 0, 0, 0]) + + %delete + set fdm=indent + call setline(1, [ + \ "\ta", + \ "\t\ta", + \ "\t\ta", + \ "\t\ta", + \ "\ta", + \ "\t\ta", + \ "\t\ta", + \ "\t\ta", + \ "\ta", + \ "\t\ta", + \ "\t\ta", + \ "\t\ta", + \ "\t\ta", + \ "\ta", + \ "a"]) + set fdm=manual + %foldopen! + 13m7 + call Check_foldlevels([1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0]) + + bw! +endfunc + +func Test_move_folds_around_indent() + new + let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c") + call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) + let folds=[-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14] + " all folds closed + set fdm=indent + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + call assert_equal(input, getline(1, '$')) + 7,12m0 + call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + 10,12m0 + call assert_equal(PrepIndent("a")[1:] + PrepIndent("b") + ["a"] + PrepIndent("c"), getline(1, '$')) + call assert_equal([1, 1, 1, 1, 1, -1, 7, 7, 7, 7, 7, -1, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) + " moving should not close the folds + %d + call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) + set fdm=indent + call cursor(2, 1) + %foldopen + 7,12m0 + let folds=repeat([-1], 18) + call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) + call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) + norm! zM + " folds are not corrupted and all have been closed + call assert_equal([-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) + %d + call setline(1, ["a", "\tb", "\tc", "\td", "\te"]) + set fdm=indent + %foldopen + 3m4 + %foldclose + call assert_equal(["a", "\tb", "\td", "\tc", "\te"], getline(1, '$')) + call assert_equal([-1, 5, 5, 5, 5], map(range(1, line('$')), 'foldclosedend(v:val)')) + %d + call setline(1, ["a", "\tb", "\tc", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"]) + set fdm=indent foldlevel=0 + %foldopen + 3m1 + %foldclose + call assert_equal(["a", "\tc", "\tb", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"], getline(1, '$')) + call assert_equal(1, foldlevel(2)) + call assert_equal(5, foldclosedend(3)) + call assert_equal([-1, 2, 2, 2, 2, -1, 7, 7, 7, 7], map(range(1, line('$')), 'foldclosed(v:val)')) + 2,6m$ + %foldclose + call assert_equal(9, foldclosedend(2)) + call assert_equal(1, foldlevel(6)) + call assert_equal(9, foldclosedend(7)) + call assert_equal([-1, 2, 2, 2, 2, 2, 2, 2, 2, -1], map(range(1, line('$')), 'foldclosed(v:val)')) + " Ensure moving around the edges still works. + %d + call setline(1, PrepIndent("a") + repeat(["a"], 3) + ["\ta"]) + set fdm=indent foldlevel=0 + %foldopen + 6m$ + " The first fold has been truncated to the 5'th line. + " Second fold has been moved up because the moved line is now below it. + call Check_foldlevels([0, 1, 1, 1, 1, 0, 0, 0, 1, 1]) + bw! +endfunc + +func Test_folddoopen_folddoclosed() + new + call setline(1, range(1, 9)) + set foldmethod=manual + 1,3 fold + 6,8 fold + + " Test without range. + folddoopen s/$/o/ + folddoclosed s/$/c/ + call assert_equal(['1c', '2c', '3c', + \ '4o', '5o', + \ '6c', '7c', '8c', + \ '9o'], getline(1, '$')) + + " Test with range. + call setline(1, range(1, 9)) + 1,8 folddoopen s/$/o/ + 4,$ folddoclosed s/$/c/ + call assert_equal(['1', '2', '3', + \ '4o', '5o', + \ '6c', '7c', '8c', + \ '9'], getline(1, '$')) + + set foldmethod& + bw! +endfunc + +func Test_fold_error() + new + call setline(1, [1, 2]) + + for fm in ['indent', 'expr', 'syntax', 'diff'] + exe 'set foldmethod=' . fm + call assert_fails('norm zf', 'E350:') + call assert_fails('norm zd', 'E351:') + call assert_fails('norm zE', 'E352:') + endfor + + set foldmethod=manual + call assert_fails('norm zd', 'E490:') + call assert_fails('norm zo', 'E490:') + call assert_fails('3fold', 'E16:') + + set foldmethod=marker + set nomodifiable + call assert_fails('1,2fold', 'E21:') + + set modifiable& + set foldmethod& + bw! +endfunc + +func Test_foldtext_recursive() + new + call setline(1, ['{{{', 'some text', '}}}']) + setlocal foldenable foldmethod=marker foldtext=foldtextresult(v\:foldstart) + " This was crashing because of endless recursion. + 2foldclose + redraw + call assert_equal(1, foldlevel(2)) + call assert_equal(1, foldclosed(2)) + call assert_equal(3, foldclosedend(2)) + bwipe! +endfunc + +" Various fold related tests + +" Basic test if a fold can be created, opened, moving to the end and closed +func Test_fold_manual() + enew! + set fdm=manual + + let content = ['1 aa', '2 bb', '3 cc'] + call append(0, content) + call cursor(1, 1) + normal zf2j + call assert_equal('1 aa', getline(foldclosed('.'))) + normal zo + call assert_equal(-1, foldclosed('.')) + normal ]z + call assert_equal('3 cc', getline('.')) + normal zc + call assert_equal('1 aa', getline(foldclosed('.'))) + + set fdm& + enew! +endfunc + +" test folding with markers. +func Test_fold_marker() + enew! + set fdm=marker fdl=1 fdc=3 + + let content = ['4 dd {{{', '5 ee {{{ }}}', '6 ff }}}'] + call append(0, content) + call cursor(2, 1) + call assert_equal(2, foldlevel('.')) + normal [z + call assert_equal(1, foldlevel('.')) + exe "normal jo{{ \<Esc>r{jj" + call assert_equal(1, foldlevel('.')) + normal kYpj + call assert_equal(0, foldlevel('.')) + + set fdm& fdl& fdc& + enew! +endfunc + +" test folding with indent +func Test_fold_indent() + enew! + set fdm=indent sw=2 + + let content = ['1 aa', '2 bb', '3 cc'] + call append(0, content) + call cursor(2, 1) + exe "normal i \<Esc>jI " + call assert_equal(2, foldlevel('.')) + normal k + call assert_equal(1, foldlevel('.')) + + set fdm& sw& + enew! +endfunc + +" test syntax folding +func Test_fold_syntax() + if !has('syntax') + return + endif + + enew! + set fdm=syntax fdl=0 + + syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3 + syn region Fd1 start="ee" end="ff" fold contained + syn region Fd2 start="gg" end="hh" fold contained + syn region Fd3 start="commentstart" end="commentend" fold contained + let content = ['3 cc', '4 dd {{{', '5 ee {{{ }}}', '{{{{', '6 ff }}}', + \ '6 ff }}}', '7 gg', '8 hh', '9 ii'] + call append(0, content) + normal Gzk + call assert_equal('9 ii', getline('.')) + normal k + call assert_equal('3 cc', getline('.')) + exe "normal jAcommentstart \<Esc>Acommentend" + set fdl=1 + normal 3j + call assert_equal('7 gg', getline('.')) + set fdl=0 + exe "normal zO\<C-L>j" + call assert_equal('8 hh', getline('.')) + syn clear Fd1 Fd2 Fd3 Hup + + set fdm& fdl& + enew! +endfunc + +func Flvl() + let l = getline(v:lnum) + if l =~ "bb$" + return 2 + elseif l =~ "gg$" + return "s1" + elseif l =~ "ii$" + return ">2" + elseif l =~ "kk$" + return "0" + endif + return "=" +endfun + +" test expression folding +func Test_fold_expr() + enew! + set fdm=expr fde=Flvl() + + let content = ['1 aa', + \ '2 bb', + \ '3 cc', + \ '4 dd {{{commentstart commentend', + \ '5 ee {{{ }}}', + \ '{{{', + \ '6 ff }}}', + \ '6 ff }}}', + \ ' 7 gg', + \ ' 8 hh', + \ '9 ii', + \ 'a jj', + \ 'b kk'] + call append(0, content) + call cursor(1, 1) + exe "normal /bb$\<CR>" + call assert_equal(2, foldlevel('.')) + exe "normal /hh$\<CR>" + call assert_equal(1, foldlevel('.')) + exe "normal /ii$\<CR>" + call assert_equal(2, foldlevel('.')) + exe "normal /kk$\<CR>" + call assert_equal(0, foldlevel('.')) + + set fdm& fde& + enew! +endfunc + +" Bug with fdm=indent and moving folds +" Moving a fold a few times, messes up the folds below the moved fold. +" Fixed by 7.4.700 +func Test_fold_move() + enew! + set fdm=indent sw=2 fdl=0 + + let content = ['', '', 'Line1', ' Line2', ' Line3', + \ 'Line4', ' Line5', ' Line6', + \ 'Line7', ' Line8', ' Line9'] + call append(0, content) + normal zM + call cursor(4, 1) + move 2 + move 1 + call assert_equal(7, foldclosed(7)) + call assert_equal(8, foldclosedend(7)) + call assert_equal(0, foldlevel(9)) + call assert_equal(10, foldclosed(10)) + call assert_equal(11, foldclosedend(10)) + call assert_equal('+-- 2 lines: Line2', foldtextresult(2)) + call assert_equal('+-- 2 lines: Line8', foldtextresult(10)) + + set fdm& sw& fdl& + enew! +endfunc + +" test for patch 7.3.637 +" Cannot catch the error caused by a foldopen when there is no fold. +func Test_foldopen_exception() + enew! + let a = 'No error caught' + try + foldopen + catch + let a = matchstr(v:exception,'^[^ ]*') + endtry + call assert_equal('Vim(foldopen):E490:', a) + + let a = 'No error caught' + try + foobar + catch + let a = matchstr(v:exception,'^[^ ]*') + endtry + call assert_match('E492:', a) +endfunc diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim new file mode 100644 index 0000000000..b76bc78e79 --- /dev/null +++ b/src/testdir/test_functions.vim @@ -0,0 +1,950 @@ +" Tests for various functions. + +" Must be done first, since the alternate buffer must be unset. +func Test_00_bufexists() + call assert_equal(0, bufexists('does_not_exist')) + call assert_equal(1, bufexists(bufnr('%'))) + call assert_equal(0, bufexists(0)) + new Xfoo + let bn = bufnr('%') + call assert_equal(1, bufexists(bn)) + call assert_equal(1, bufexists('Xfoo')) + call assert_equal(1, bufexists(getcwd() . '/Xfoo')) + call assert_equal(1, bufexists(0)) + bw + call assert_equal(0, bufexists(bn)) + call assert_equal(0, bufexists('Xfoo')) +endfunc + +func Test_empty() + call assert_equal(1, empty('')) + call assert_equal(0, empty('a')) + + call assert_equal(1, empty(0)) + call assert_equal(1, empty(-0)) + call assert_equal(0, empty(1)) + call assert_equal(0, empty(-1)) + + call assert_equal(1, empty(0.0)) + call assert_equal(1, empty(-0.0)) + call assert_equal(0, empty(1.0)) + call assert_equal(0, empty(-1.0)) + call assert_equal(0, empty(1.0/0.0)) + call assert_equal(0, empty(0.0/0.0)) + + call assert_equal(1, empty([])) + call assert_equal(0, empty(['a'])) + + call assert_equal(1, empty({})) + call assert_equal(0, empty({'a':1})) + + call assert_equal(1, empty(v:null)) + call assert_equal(1, empty(v:none)) + call assert_equal(1, empty(v:false)) + call assert_equal(0, empty(v:true)) + + if has('channel') + call assert_equal(1, empty(test_null_channel())) + endif + if has('job') + call assert_equal(1, empty(test_null_job())) + endif + + call assert_equal(0, empty(function('Test_empty'))) +endfunc + +func Test_len() + call assert_equal(1, len(0)) + call assert_equal(2, len(12)) + + call assert_equal(0, len('')) + call assert_equal(2, len('ab')) + + call assert_equal(0, len([])) + call assert_equal(2, len([2, 1])) + + call assert_equal(0, len({})) + call assert_equal(2, len({'a': 1, 'b': 2})) + + call assert_fails('call len(v:none)', 'E701:') + call assert_fails('call len({-> 0})', 'E701:') +endfunc + +func Test_max() + call assert_equal(0, max([])) + call assert_equal(2, max([2])) + call assert_equal(2, max([1, 2])) + call assert_equal(2, max([1, 2, v:null])) + + call assert_equal(0, max({})) + call assert_equal(2, max({'a':1, 'b':2})) + + call assert_fails('call max(1)', 'E712:') + call assert_fails('call max(v:none)', 'E712:') +endfunc + +func Test_min() + call assert_equal(0, min([])) + call assert_equal(2, min([2])) + call assert_equal(1, min([1, 2])) + call assert_equal(0, min([1, 2, v:null])) + + call assert_equal(0, min({})) + call assert_equal(1, min({'a':1, 'b':2})) + + call assert_fails('call min(1)', 'E712:') + call assert_fails('call min(v:none)', 'E712:') +endfunc + +func Test_strwidth() + for aw in ['single', 'double'] + exe 'set ambiwidth=' . aw + call assert_equal(0, strwidth('')) + call assert_equal(1, strwidth("\t")) + call assert_equal(3, strwidth('Vim')) + call assert_equal(4, strwidth(1234)) + call assert_equal(5, strwidth(-1234)) + + if has('multi_byte') + call assert_equal(2, strwidth('😉')) + call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde')) + call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße')) + endif + + call assert_fails('call strwidth({->0})', 'E729:') + call assert_fails('call strwidth([])', 'E730:') + call assert_fails('call strwidth({})', 'E731:') + call assert_fails('call strwidth(1.2)', 'E806:') + endfor + + set ambiwidth& +endfunc + +func Test_str2nr() + call assert_equal(0, str2nr('')) + call assert_equal(1, str2nr('1')) + call assert_equal(1, str2nr(' 1 ')) + + call assert_equal(1, str2nr('+1')) + call assert_equal(1, str2nr('+ 1')) + call assert_equal(1, str2nr(' + 1 ')) + + call assert_equal(-1, str2nr('-1')) + call assert_equal(-1, str2nr('- 1')) + call assert_equal(-1, str2nr(' - 1 ')) + + call assert_equal(123456789, str2nr('123456789')) + call assert_equal(-123456789, str2nr('-123456789')) + + call assert_equal(5, str2nr('101', 2)) + call assert_equal(5, str2nr('0b101', 2)) + call assert_equal(5, str2nr('0B101', 2)) + call assert_equal(-5, str2nr('-101', 2)) + call assert_equal(-5, str2nr('-0b101', 2)) + call assert_equal(-5, str2nr('-0B101', 2)) + + call assert_equal(65, str2nr('101', 8)) + call assert_equal(65, str2nr('0101', 8)) + call assert_equal(-65, str2nr('-101', 8)) + call assert_equal(-65, str2nr('-0101', 8)) + + call assert_equal(11259375, str2nr('abcdef', 16)) + call assert_equal(11259375, str2nr('ABCDEF', 16)) + call assert_equal(-11259375, str2nr('-ABCDEF', 16)) + call assert_equal(11259375, str2nr('0xabcdef', 16)) + call assert_equal(11259375, str2nr('0Xabcdef', 16)) + call assert_equal(11259375, str2nr('0XABCDEF', 16)) + call assert_equal(-11259375, str2nr('-0xABCDEF', 16)) + + call assert_equal(0, str2nr('0x10')) + call assert_equal(0, str2nr('0b10')) + call assert_equal(1, str2nr('12', 2)) + call assert_equal(1, str2nr('18', 8)) + call assert_equal(1, str2nr('1g', 16)) + + call assert_equal(0, str2nr(v:null)) + call assert_equal(0, str2nr(v:none)) + + call assert_fails('call str2nr([])', 'E730:') + call assert_fails('call str2nr({->2})', 'E729:') + call assert_fails('call str2nr(1.2)', 'E806:') + call assert_fails('call str2nr(10, [])', 'E474:') +endfunc + +func Test_strftime() + if !exists('*strftime') + return + endif + " Format of strftime() depends on system. We assume + " that basic formats tested here are available and + " identical on all systems which support strftime(). + " + " The 2nd parameter of strftime() is a local time, so the output day + " of strftime() can be 17 or 18, depending on timezone. + call assert_match('^2017-01-1[78]$', strftime('%Y-%m-%d', 1484695512)) + " + call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', strftime('%Y-%m-%d %H:%M:%S')) + + call assert_fails('call strftime([])', 'E730:') + call assert_fails('call strftime("%Y", [])', 'E745:') +endfunc + +func Test_simplify() + call assert_equal('', simplify('')) + call assert_equal('/', simplify('/')) + call assert_equal('/', simplify('/.')) + call assert_equal('/', simplify('/..')) + call assert_equal('/...', simplify('/...')) + call assert_equal('./dir/file', simplify('./dir/file')) + call assert_equal('./dir/file', simplify('.///dir//file')) + call assert_equal('./dir/file', simplify('./dir/./file')) + call assert_equal('./file', simplify('./dir/../file')) + call assert_equal('../dir/file', simplify('dir/../../dir/file')) + call assert_equal('./file', simplify('dir/.././file')) + + call assert_fails('call simplify({->0})', 'E729:') + call assert_fails('call simplify([])', 'E730:') + call assert_fails('call simplify({})', 'E731:') + call assert_fails('call simplify(1.2)', 'E806:') +endfunc + +func Test_strpart() + call assert_equal('de', strpart('abcdefg', 3, 2)) + call assert_equal('ab', strpart('abcdefg', -2, 4)) + call assert_equal('abcdefg', strpart('abcdefg', -2)) + call assert_equal('fg', strpart('abcdefg', 5, 4)) + call assert_equal('defg', strpart('abcdefg', 3)) + + if has('multi_byte') + call assert_equal('lép', strpart('éléphant', 2, 4)) + call assert_equal('léphant', strpart('éléphant', 2)) + endif +endfunc + +func Test_tolower() + call assert_equal("", tolower("")) + + " Test with all printable ASCII characters. + call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', + \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) + + if !has('multi_byte') + return + endif + + " Test with a few uppercase diacritics. + call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) + call assert_equal("bḃḇ", tolower("BḂḆ")) + call assert_equal("cçćĉċč", tolower("CÇĆĈĊČ")) + call assert_equal("dďđḋḏḑ", tolower("DĎĐḊḎḐ")) + call assert_equal("eèéêëēĕėęěẻẽ", tolower("EÈÉÊËĒĔĖĘĚẺẼ")) + call assert_equal("fḟ ", tolower("FḞ ")) + call assert_equal("gĝğġģǥǧǵḡ", tolower("GĜĞĠĢǤǦǴḠ")) + call assert_equal("hĥħḣḧḩ", tolower("HĤĦḢḦḨ")) + call assert_equal("iìíîïĩīĭįiǐỉ", tolower("IÌÍÎÏĨĪĬĮİǏỈ")) + call assert_equal("jĵ", tolower("JĴ")) + call assert_equal("kķǩḱḵ", tolower("KĶǨḰḴ")) + call assert_equal("lĺļľŀłḻ", tolower("LĹĻĽĿŁḺ")) + call assert_equal("mḿṁ", tolower("MḾṀ")) + call assert_equal("nñńņňṅṉ", tolower("NÑŃŅŇṄṈ")) + call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ")) + call assert_equal("pṕṗ", tolower("PṔṖ")) + call assert_equal("q", tolower("Q")) + call assert_equal("rŕŗřṙṟ", tolower("RŔŖŘṘṞ")) + call assert_equal("sśŝşšṡ", tolower("SŚŜŞŠṠ")) + call assert_equal("tţťŧṫṯ", tolower("TŢŤŦṪṮ")) + call assert_equal("uùúûüũūŭůűųưǔủ", tolower("UÙÚÛÜŨŪŬŮŰŲƯǓỦ")) + call assert_equal("vṽ", tolower("VṼ")) + call assert_equal("wŵẁẃẅẇ", tolower("WŴẀẂẄẆ")) + call assert_equal("xẋẍ", tolower("XẊẌ")) + call assert_equal("yýŷÿẏỳỷỹ", tolower("YÝŶŸẎỲỶỸ")) + call assert_equal("zźżžƶẑẕ", tolower("ZŹŻŽƵẐẔ")) + + " Test with a few lowercase diacritics, which should remain unchanged. + call assert_equal("aàáâãäåāăąǎǟǡả", tolower("aàáâãäåāăąǎǟǡả")) + call assert_equal("bḃḇ", tolower("bḃḇ")) + call assert_equal("cçćĉċč", tolower("cçćĉċč")) + call assert_equal("dďđḋḏḑ", tolower("dďđḋḏḑ")) + call assert_equal("eèéêëēĕėęěẻẽ", tolower("eèéêëēĕėęěẻẽ")) + call assert_equal("fḟ", tolower("fḟ")) + call assert_equal("gĝğġģǥǧǵḡ", tolower("gĝğġģǥǧǵḡ")) + call assert_equal("hĥħḣḧḩẖ", tolower("hĥħḣḧḩẖ")) + call assert_equal("iìíîïĩīĭįǐỉ", tolower("iìíîïĩīĭįǐỉ")) + call assert_equal("jĵǰ", tolower("jĵǰ")) + call assert_equal("kķǩḱḵ", tolower("kķǩḱḵ")) + call assert_equal("lĺļľŀłḻ", tolower("lĺļľŀłḻ")) + call assert_equal("mḿṁ ", tolower("mḿṁ ")) + call assert_equal("nñńņňʼnṅṉ", tolower("nñńņňʼnṅṉ")) + call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("oòóôõöøōŏőơǒǫǭỏ")) + call assert_equal("pṕṗ", tolower("pṕṗ")) + call assert_equal("q", tolower("q")) + call assert_equal("rŕŗřṙṟ", tolower("rŕŗřṙṟ")) + call assert_equal("sśŝşšṡ", tolower("sśŝşšṡ")) + call assert_equal("tţťŧṫṯẗ", tolower("tţťŧṫṯẗ")) + call assert_equal("uùúûüũūŭůűųưǔủ", tolower("uùúûüũūŭůűųưǔủ")) + call assert_equal("vṽ", tolower("vṽ")) + call assert_equal("wŵẁẃẅẇẘ", tolower("wŵẁẃẅẇẘ")) + call assert_equal("ẋẍ", tolower("ẋẍ")) + call assert_equal("yýÿŷẏẙỳỷỹ", tolower("yýÿŷẏẙỳỷỹ")) + call assert_equal("zźżžƶẑẕ", tolower("zźżžƶẑẕ")) + + " According to https://twitter.com/jifa/status/625776454479970304 + " Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase + " in length (2 to 3 bytes) when lowercased. So let's test them. + call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ")) + + " This call to tolower with invalid utf8 sequence used to cause access to + " invalid memory. + call tolower("\xC0\x80\xC0") + call tolower("123\xC0\x80\xC0") +endfunc + +func Test_toupper() + call assert_equal("", toupper("")) + + " Test with all printable ASCII characters. + call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~', + \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) + + if !has('multi_byte') + return + endif + + " Test with a few lowercase diacritics. + call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả")) + call assert_equal("BḂḆ", toupper("bḃḇ")) + call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč")) + call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ")) + call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("eèéêëēĕėęěẻẽ")) + call assert_equal("FḞ", toupper("fḟ")) + call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("gĝğġģǥǧǵḡ")) + call assert_equal("HĤĦḢḦḨẖ", toupper("hĥħḣḧḩẖ")) + call assert_equal("IÌÍÎÏĨĪĬĮǏỈ", toupper("iìíîïĩīĭįǐỉ")) + call assert_equal("JĴǰ", toupper("jĵǰ")) + call assert_equal("KĶǨḰḴ", toupper("kķǩḱḵ")) + call assert_equal("LĹĻĽĿŁḺ", toupper("lĺļľŀłḻ")) + call assert_equal("MḾṀ ", toupper("mḿṁ ")) + call assert_equal("NÑŃŅŇʼnṄṈ", toupper("nñńņňʼnṅṉ")) + call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("oòóôõöøōŏőơǒǫǭỏ")) + call assert_equal("PṔṖ", toupper("pṕṗ")) + call assert_equal("Q", toupper("q")) + call assert_equal("RŔŖŘṘṞ", toupper("rŕŗřṙṟ")) + call assert_equal("SŚŜŞŠṠ", toupper("sśŝşšṡ")) + call assert_equal("TŢŤŦṪṮẗ", toupper("tţťŧṫṯẗ")) + call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("uùúûüũūŭůűųưǔủ")) + call assert_equal("VṼ", toupper("vṽ")) + call assert_equal("WŴẀẂẄẆẘ", toupper("wŵẁẃẅẇẘ")) + call assert_equal("ẊẌ", toupper("ẋẍ")) + call assert_equal("YÝŸŶẎẙỲỶỸ", toupper("yýÿŷẏẙỳỷỹ")) + call assert_equal("ZŹŻŽƵẐẔ", toupper("zźżžƶẑẕ")) + + " Test that uppercase diacritics, which should remain unchanged. + call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) + call assert_equal("BḂḆ", toupper("BḂḆ")) + call assert_equal("CÇĆĈĊČ", toupper("CÇĆĈĊČ")) + call assert_equal("DĎĐḊḎḐ", toupper("DĎĐḊḎḐ")) + call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("EÈÉÊËĒĔĖĘĚẺẼ")) + call assert_equal("FḞ ", toupper("FḞ ")) + call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("GĜĞĠĢǤǦǴḠ")) + call assert_equal("HĤĦḢḦḨ", toupper("HĤĦḢḦḨ")) + call assert_equal("IÌÍÎÏĨĪĬĮİǏỈ", toupper("IÌÍÎÏĨĪĬĮİǏỈ")) + call assert_equal("JĴ", toupper("JĴ")) + call assert_equal("KĶǨḰḴ", toupper("KĶǨḰḴ")) + call assert_equal("LĹĻĽĿŁḺ", toupper("LĹĻĽĿŁḺ")) + call assert_equal("MḾṀ", toupper("MḾṀ")) + call assert_equal("NÑŃŅŇṄṈ", toupper("NÑŃŅŇṄṈ")) + call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ")) + call assert_equal("PṔṖ", toupper("PṔṖ")) + call assert_equal("Q", toupper("Q")) + call assert_equal("RŔŖŘṘṞ", toupper("RŔŖŘṘṞ")) + call assert_equal("SŚŜŞŠṠ", toupper("SŚŜŞŠṠ")) + call assert_equal("TŢŤŦṪṮ", toupper("TŢŤŦṪṮ")) + call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("UÙÚÛÜŨŪŬŮŰŲƯǓỦ")) + call assert_equal("VṼ", toupper("VṼ")) + call assert_equal("WŴẀẂẄẆ", toupper("WŴẀẂẄẆ")) + call assert_equal("XẊẌ", toupper("XẊẌ")) + call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ")) + call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) + + call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) + + " This call to toupper with invalid utf8 sequence used to cause access to + " invalid memory. + call toupper("\xC0\x80\xC0") + call toupper("123\xC0\x80\xC0") +endfunc + +" Tests for the mode() function +let current_modes = '' +func Save_mode() + let g:current_modes = mode(0) . '-' . mode(1) + return '' +endfunc + +func Test_mode() + new + call append(0, ["Blue Ball Black", "Brown Band Bowl", ""]) + + " Only complete from the current buffer. + set complete=. + + inoremap <F2> <C-R>=Save_mode()<CR> + + normal! 3G + exe "normal i\<F2>\<Esc>" + call assert_equal('i-i', g:current_modes) + " i_CTRL-P: Multiple matches + exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-P: Single match + exe "normal iBro\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X + exe "normal iBa\<C-X>\<F2>\<Esc>u" + call assert_equal('i-ix', g:current_modes) + " i_CTRL-X CTRL-P: Multiple matches + exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P: Single match + exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P + CTRL-P: Single match + exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: Multiple matches + exe "normal i\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: Single match + exe "normal iBlu\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-P: No match + exe "normal iCom\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P: No match + exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: No match + exe "normal iabc\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('i-ic', g:current_modes) + + " R_CTRL-P: Multiple matches + exe "normal RBa\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-P: Single match + exe "normal RBro\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X + exe "normal RBa\<C-X>\<F2>\<Esc>u" + call assert_equal('R-Rx', g:current_modes) + " R_CTRL-X CTRL-P: Multiple matches + exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P: Single match + exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P + CTRL-P: Single match + exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: Multiple matches + exe "normal R\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: Single match + exe "normal RBlu\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-P: No match + exe "normal RCom\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P: No match + exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: No match + exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u" + call assert_equal('R-Rc', g:current_modes) + + call assert_equal('n', mode(0)) + call assert_equal('n', mode(1)) + + " How to test operator-pending mode? + + call feedkeys("v", 'xt') + call assert_equal('v', mode()) + call assert_equal('v', mode(1)) + call feedkeys("\<Esc>V", 'xt') + call assert_equal('V', mode()) + call assert_equal('V', mode(1)) + call feedkeys("\<Esc>\<C-V>", 'xt') + call assert_equal("\<C-V>", mode()) + call assert_equal("\<C-V>", mode(1)) + call feedkeys("\<Esc>", 'xt') + + call feedkeys("gh", 'xt') + call assert_equal('s', mode()) + call assert_equal('s', mode(1)) + call feedkeys("\<Esc>gH", 'xt') + call assert_equal('S', mode()) + call assert_equal('S', mode(1)) + call feedkeys("\<Esc>g\<C-H>", 'xt') + call assert_equal("\<C-S>", mode()) + call assert_equal("\<C-S>", mode(1)) + call feedkeys("\<Esc>", 'xt') + + call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt') + call assert_equal('c-c', g:current_modes) + call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt') + call assert_equal('c-cv', g:current_modes) + " How to test Ex mode? + + bwipe! + iunmap <F2> + set complete& +endfunc + +func Test_getbufvar() + let bnr = bufnr('%') + let b:var_num = '1234' + let def_num = '5678' + call assert_equal('1234', getbufvar(bnr, 'var_num')) + call assert_equal('1234', getbufvar(bnr, 'var_num', def_num)) + + let bd = getbufvar(bnr, '') + call assert_equal('1234', bd['var_num']) + call assert_true(exists("bd['changedtick']")) + call assert_equal(2, len(bd)) + + let bd2 = getbufvar(bnr, '', def_num) + call assert_equal(bd, bd2) + + unlet b:var_num + call assert_equal(def_num, getbufvar(bnr, 'var_num', def_num)) + call assert_equal('', getbufvar(bnr, 'var_num')) + + let bd = getbufvar(bnr, '') + call assert_equal(1, len(bd)) + let bd = getbufvar(bnr, '',def_num) + call assert_equal(1, len(bd)) + + call assert_equal('', getbufvar(9999, '')) + call assert_equal(def_num, getbufvar(9999, '', def_num)) + unlet def_num + + call assert_equal(0, getbufvar(bnr, '&autoindent')) + call assert_equal(0, getbufvar(bnr, '&autoindent', 1)) + + " Open new window with forced option values + set fileformats=unix,dos + new ++ff=dos ++bin ++enc=iso-8859-2 + call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat')) + call assert_equal(1, getbufvar(bufnr('%'), '&bin')) + call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc')) + close + + set fileformats& +endfunc + +func Test_last_buffer_nr() + call assert_equal(bufnr('$'), last_buffer_nr()) +endfunc + +func Test_stridx() + call assert_equal(-1, stridx('', 'l')) + call assert_equal(0, stridx('', '')) + call assert_equal(0, stridx('hello', '')) + call assert_equal(-1, stridx('hello', 'L')) + call assert_equal(2, stridx('hello', 'l', -1)) + call assert_equal(2, stridx('hello', 'l', 0)) + call assert_equal(2, stridx('hello', 'l', 1)) + call assert_equal(3, stridx('hello', 'l', 3)) + call assert_equal(-1, stridx('hello', 'l', 4)) + call assert_equal(-1, stridx('hello', 'l', 10)) + call assert_equal(2, stridx('hello', 'll')) + call assert_equal(-1, stridx('hello', 'hello world')) +endfunc + +func Test_strridx() + call assert_equal(-1, strridx('', 'l')) + call assert_equal(0, strridx('', '')) + call assert_equal(5, strridx('hello', '')) + call assert_equal(-1, strridx('hello', 'L')) + call assert_equal(3, strridx('hello', 'l')) + call assert_equal(3, strridx('hello', 'l', 10)) + call assert_equal(3, strridx('hello', 'l', 3)) + call assert_equal(2, strridx('hello', 'l', 2)) + call assert_equal(-1, strridx('hello', 'l', 1)) + call assert_equal(-1, strridx('hello', 'l', 0)) + call assert_equal(-1, strridx('hello', 'l', -1)) + call assert_equal(2, strridx('hello', 'll')) + call assert_equal(-1, strridx('hello', 'hello world')) +endfunc + +func Test_match_func() + call assert_equal(4, match('testing', 'ing')) + call assert_equal(4, match('testing', 'ing', 2)) + call assert_equal(-1, match('testing', 'ing', 5)) + call assert_equal(-1, match('testing', 'ing', 8)) + call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(-1, match(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchend() + call assert_equal(7, matchend('testing', 'ing')) + call assert_equal(7, matchend('testing', 'ing', 2)) + call assert_equal(-1, matchend('testing', 'ing', 5)) + call assert_equal(-1, matchend('testing', 'ing', 8)) + call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(match(['vim', 'testing', 'execute'], 'img'), matchend(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchlist() + call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')) + call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2)) + call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4)) +endfunc + +func Test_matchstr() + call assert_equal('ing', matchstr('testing', 'ing')) + call assert_equal('ing', matchstr('testing', 'ing', 2)) + call assert_equal('', matchstr('testing', 'ing', 5)) + call assert_equal('', matchstr('testing', 'ing', 8)) + call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing')) + call assert_equal('', matchstr(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchstrpos() + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) + call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) + call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) + call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_nextnonblank_prevnonblank() + new +insert +This + + +is + +a +Test +. + call assert_equal(0, nextnonblank(-1)) + call assert_equal(0, nextnonblank(0)) + call assert_equal(1, nextnonblank(1)) + call assert_equal(4, nextnonblank(2)) + call assert_equal(4, nextnonblank(3)) + call assert_equal(4, nextnonblank(4)) + call assert_equal(6, nextnonblank(5)) + call assert_equal(6, nextnonblank(6)) + call assert_equal(7, nextnonblank(7)) + call assert_equal(0, nextnonblank(8)) + + call assert_equal(0, prevnonblank(-1)) + call assert_equal(0, prevnonblank(0)) + call assert_equal(1, prevnonblank(1)) + call assert_equal(1, prevnonblank(2)) + call assert_equal(1, prevnonblank(3)) + call assert_equal(4, prevnonblank(4)) + call assert_equal(4, prevnonblank(5)) + call assert_equal(6, prevnonblank(6)) + call assert_equal(7, prevnonblank(7)) + call assert_equal(0, prevnonblank(8)) + bw! +endfunc + +func Test_byte2line_line2byte() + new + call setline(1, ['a', 'bc', 'd']) + + set fileformat=unix + call assert_equal([-1, -1, 1, 1, 2, 2, 2, 3, 3, -1], + \ map(range(-1, 8), 'byte2line(v:val)')) + call assert_equal([-1, -1, 1, 3, 6, 8, -1], + \ map(range(-1, 5), 'line2byte(v:val)')) + + set fileformat=mac + call assert_equal([-1, -1, 1, 1, 2, 2, 2, 3, 3, -1], + \ map(range(-1, 8), 'byte2line(v:val)')) + call assert_equal([-1, -1, 1, 3, 6, 8, -1], + \ map(range(-1, 5), 'line2byte(v:val)')) + + set fileformat=dos + call assert_equal([-1, -1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, -1], + \ map(range(-1, 11), 'byte2line(v:val)')) + call assert_equal([-1, -1, 1, 4, 8, 11, -1], + \ map(range(-1, 5), 'line2byte(v:val)')) + + set fileformat& + bw! +endfunc + +func Test_count() + let l = ['a', 'a', 'A', 'b'] + call assert_equal(2, count(l, 'a')) + call assert_equal(1, count(l, 'A')) + call assert_equal(1, count(l, 'b')) + call assert_equal(0, count(l, 'B')) + + call assert_equal(2, count(l, 'a', 0)) + call assert_equal(1, count(l, 'A', 0)) + call assert_equal(1, count(l, 'b', 0)) + call assert_equal(0, count(l, 'B', 0)) + + call assert_equal(3, count(l, 'a', 1)) + call assert_equal(3, count(l, 'A', 1)) + call assert_equal(1, count(l, 'b', 1)) + call assert_equal(1, count(l, 'B', 1)) + call assert_equal(0, count(l, 'c', 1)) + + call assert_equal(1, count(l, 'a', 0, 1)) + call assert_equal(2, count(l, 'a', 1, 1)) + call assert_fails('call count(l, "a", 0, 10)', 'E684:') + + let d = {1: 'a', 2: 'a', 3: 'A', 4: 'b'} + call assert_equal(2, count(d, 'a')) + call assert_equal(1, count(d, 'A')) + call assert_equal(1, count(d, 'b')) + call assert_equal(0, count(d, 'B')) + + call assert_equal(2, count(d, 'a', 0)) + call assert_equal(1, count(d, 'A', 0)) + call assert_equal(1, count(d, 'b', 0)) + call assert_equal(0, count(d, 'B', 0)) + + call assert_equal(3, count(d, 'a', 1)) + call assert_equal(3, count(d, 'A', 1)) + call assert_equal(1, count(d, 'b', 1)) + call assert_equal(1, count(d, 'B', 1)) + call assert_equal(0, count(d, 'c', 1)) + + call assert_fails('call count(d, "a", 0, 1)', 'E474:') + + call assert_equal(0, count("foo", "bar")) + call assert_equal(1, count("foo", "oo")) + call assert_equal(2, count("foo", "o")) + call assert_equal(0, count("foo", "O")) + call assert_equal(2, count("foo", "O", 1)) + call assert_equal(2, count("fooooo", "oo")) + call assert_equal(0, count("foo", "")) +endfunc + +func Test_changenr() + new Xchangenr + call assert_equal(0, changenr()) + norm ifoo + call assert_equal(1, changenr()) + set undolevels=10 + norm Sbar + call assert_equal(2, changenr()) + undo + call assert_equal(1, changenr()) + redo + call assert_equal(2, changenr()) + bw! + set undolevels& +endfunc + +func Test_filewritable() + new Xfilewritable + write! + call assert_equal(1, filewritable('Xfilewritable')) + + call assert_notequal(0, setfperm('Xfilewritable', 'r--r-----')) + call assert_equal(0, filewritable('Xfilewritable')) + + call assert_notequal(0, setfperm('Xfilewritable', 'rw-r-----')) + call assert_equal(1, filewritable('Xfilewritable')) + + call assert_equal(0, filewritable('doesnotexist')) + + call delete('Xfilewritable') + bw! +endfunc + +func Test_hostname() + let hostname_vim = hostname() + if has('unix') + let hostname_system = systemlist('uname -n')[0] + call assert_equal(hostname_vim, hostname_system) + endif +endfunc + +func Test_getpid() + " getpid() always returns the same value within a vim instance. + call assert_equal(getpid(), getpid()) + if has('unix') + call assert_equal(systemlist('echo $PPID')[0], string(getpid())) + endif +endfunc + +func Test_hlexists() + call assert_equal(0, hlexists('does_not_exist')) + call assert_equal(0, hlexists('Number')) + call assert_equal(0, highlight_exists('does_not_exist')) + call assert_equal(0, highlight_exists('Number')) + syntax on + call assert_equal(0, hlexists('does_not_exist')) + call assert_equal(1, hlexists('Number')) + call assert_equal(0, highlight_exists('does_not_exist')) + call assert_equal(1, highlight_exists('Number')) + syntax off +endfunc + +func Test_col() + new + call setline(1, 'abcdef') + norm gg4|mx6|mY2| + call assert_equal(2, col('.')) + call assert_equal(7, col('$')) + call assert_equal(4, col("'x")) + call assert_equal(6, col("'Y")) + call assert_equal(2, col([1, 2])) + call assert_equal(7, col([1, '$'])) + + call assert_equal(0, col('')) + call assert_equal(0, col('x')) + call assert_equal(0, col([2, '$'])) + call assert_equal(0, col([1, 100])) + call assert_equal(0, col([1])) + bw! +endfunc + +func Test_balloon_show() + if has('balloon_eval') + " This won't do anything but must not crash either. + call balloon_show('hi!') + endif +endfunc + +func Test_setbufvar_options() + " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the + " window layout. + call assert_equal(1, winnr('$')) + split dummy_preview + resize 2 + set winfixheight winfixwidth + let prev_id = win_getid() + + wincmd j + let wh = winheight('.') + let dummy_buf = bufnr('dummy_buf1', v:true) + call setbufvar(dummy_buf, '&buftype', 'nofile') + execute 'belowright vertical split #' . dummy_buf + call assert_equal(wh, winheight('.')) + let dum1_id = win_getid() + + wincmd h + let wh = winheight('.') + let dummy_buf = bufnr('dummy_buf2', v:true) + call setbufvar(dummy_buf, '&buftype', 'nofile') + execute 'belowright vertical split #' . dummy_buf + call assert_equal(wh, winheight('.')) + + bwipe! + call win_gotoid(prev_id) + bwipe! + call win_gotoid(dum1_id) + bwipe! +endfunc + +func Test_redo_in_nested_functions() + nnoremap g. :set opfunc=Operator<CR>g@ + function Operator( type, ... ) + let @x = 'XXX' + execute 'normal! g`[' . (a:type ==# 'line' ? 'V' : 'v') . 'g`]' . '"xp' + endfunction + + function! Apply() + 5,6normal! . + endfunction + + new + call setline(1, repeat(['some "quoted" text', 'more "quoted" text'], 3)) + 1normal g.i" + call assert_equal('some "XXX" text', getline(1)) + 3,4normal . + call assert_equal('some "XXX" text', getline(3)) + call assert_equal('more "XXX" text', getline(4)) + call Apply() + call assert_equal('some "XXX" text', getline(5)) + call assert_equal('more "XXX" text', getline(6)) + bwipe! + + nunmap g. + delfunc Operator + delfunc Apply +endfunc + +func Test_shellescape() + let save_shell = &shell + set shell=bash + call assert_equal("'text'", shellescape('text')) + call assert_equal("'te\"xt'", shellescape('te"xt')) + call assert_equal("'te'\\''xt'", shellescape("te'xt")) + + call assert_equal("'te%xt'", shellescape("te%xt")) + call assert_equal("'te\\%xt'", shellescape("te%xt", 1)) + call assert_equal("'te#xt'", shellescape("te#xt")) + call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) + call assert_equal("'te!xt'", shellescape("te!xt")) + call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) + + call assert_equal("'te\nxt'", shellescape("te\nxt")) + call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1)) + set shell=tcsh + call assert_equal("'te\\!xt'", shellescape("te!xt")) + call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1)) + call assert_equal("'te\\\nxt'", shellescape("te\nxt")) + call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1)) + + let &shell = save_shell +endfunc + +func Test_trim() + call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B")) + call assert_equal("Testing", trim(" \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B")) + call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t")) + call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww")) + call assert_equal("abcd\t xxxx tail", trim(" \tabcd\t xxxx tail")) + call assert_equal("\tabcd\t xxxx tail", trim(" \tabcd\t xxxx tail", " ")) + call assert_equal(" \tabcd\t xxxx tail", trim(" \tabcd\t xxxx tail", "abx")) + call assert_equal("RESERVE", trim("你RESERVE好", "你好")) + call assert_equal("您R E SER V E早", trim("你好您R E SER V E早好你你", "你好")) + call assert_equal("你好您R E SER V E早好你你", trim(" \n\r\r 你好您R E SER V E早好你你 \t \x0B", )) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" 你好您R E SER V E早好你你 \t \x0B", " 你好")) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" tteesstttt你好您R E SER V E早好你你 \t \x0B ttestt", " 你好tes")) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" tteesstttt你好您R E SER V E早好你你 \t \x0B ttestt", " 你你你好好好tttsses")) + call assert_equal("留下", trim("这些些不要这些留下这些", "这些不要")) + call assert_equal("", trim("", "")) + call assert_equal("a", trim("a", "")) + call assert_equal("", trim("", "a")) + + let chars = join(map(range(1, 0x20) + [0xa0], {n -> nr2char(n)}), '') + call assert_equal("x", trim(chars . "x" . chars)) +endfunc + +" Test for reg_recording() and reg_executing() +func Test_reg_executing_and_recording() + let s:reg_stat = '' + func s:save_reg_stat() + let s:reg_stat = reg_recording() . ':' . reg_executing() + return '' + endfunc + + new + call s:save_reg_stat() + call assert_equal(':', s:reg_stat) + call feedkeys("qa\"=s:save_reg_stat()\<CR>pq", 'xt') + call assert_equal('a:', s:reg_stat) + call feedkeys("@a", 'xt') + call assert_equal(':a', s:reg_stat) + call feedkeys("qb@aq", 'xt') + call assert_equal('b:a', s:reg_stat) + call feedkeys("q\"\"=s:save_reg_stat()\<CR>pq", 'xt') + call assert_equal('":', s:reg_stat) + + bwipe! + delfunc s:save_reg_stat + unlet s:reg_stat +endfunc diff --git a/src/testdir/test_ga.vim b/src/testdir/test_ga.vim new file mode 100644 index 0000000000..6a7cba28f0 --- /dev/null +++ b/src/testdir/test_ga.vim @@ -0,0 +1,37 @@ +" Test ga normal command, and :ascii Ex command. +func Do_ga(c) + call setline(1, a:c) + let l:a = execute("norm 1goga") + let l:b = execute("ascii") + call assert_equal(l:a, l:b) + return l:a +endfunc + +func Test_ga_command() + new + set display=uhex + call assert_equal("\nNUL", Do_ga('')) + call assert_equal("\n<<01>> 1, Hex 01, Oct 001, Digr SH", Do_ga("\x01")) + call assert_equal("\n<<09>> 9, Hex 09, Oct 011, Digr HT", Do_ga("\t")) + + set display= + call assert_equal("\nNUL", Do_ga('')) + call assert_equal("\n<^A> 1, Hex 01, Oct 001, Digr SH", Do_ga("\x01")) + call assert_equal("\n<^I> 9, Hex 09, Oct 011, Digr HT", Do_ga("\t")) + + call assert_equal("\n<e> 101, Hex 65, Octal 145", Do_ga('e')) + + if !has('multi_byte') + return + endif + + " Test a few multi-bytes characters. + call assert_equal("\n<é> 233, Hex 00e9, Oct 351, Digr e'", Do_ga('é')) + call assert_equal("\n<ẻ> 7867, Hex 1ebb, Oct 17273, Digr e2", Do_ga('ẻ')) + + " Test with combining characters. + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301")) + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331")) + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461 < ̸> 824, Hex 0338, Octal 1470", Do_ga("e\u0301\u0331\u0338")) + bwipe! +endfunc diff --git a/src/testdir/test_getcwd.vim b/src/testdir/test_getcwd.vim new file mode 100644 index 0000000000..334b890772 --- /dev/null +++ b/src/testdir/test_getcwd.vim @@ -0,0 +1,100 @@ +function! GetCwdInfo(win, tab) + let tab_changed = 0 + let mod = ":t" + if a:tab > 0 && a:tab != tabpagenr() + let tab_changed = 1 + exec "tabnext " . a:tab + endif + let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) + if tab_changed + tabprevious + endif + if a:win == 0 && a:tab == 0 + let dirname = fnamemodify(getcwd(), mod) + let lflag = haslocaldir() + elseif a:tab == 0 + let dirname = fnamemodify(getcwd(a:win), mod) + let lflag = haslocaldir(a:win) + else + let dirname = fnamemodify(getcwd(a:win, a:tab), mod) + let lflag = haslocaldir(a:win, a:tab) + endif + return bufname . ' ' . dirname . ' ' . lflag +endfunction + +" Do all test in a separate window to avoid E211 when we recursively +" delete the Xtopdir directory during cleanup +function SetUp() + set visualbell + set nocp viminfo+=nviminfo + + " On windows a swapfile in Xtopdir prevents it from being cleaned up. + set noswapfile + + " On windows a stale "Xtopdir" directory may exist, remove it so that + " we start from a clean state. + call delete("Xtopdir", "rf") + new + call mkdir('Xtopdir') + cd Xtopdir + let g:topdir = getcwd() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') +endfunction + +let g:cwd=getcwd() +function TearDown() + q + exec "cd " . g:cwd + call delete("Xtopdir", "rf") +endfunction + +function Test_GetCwd() + new a + new b + new c + 3wincmd w + lcd Xdir1 + call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) + call assert_equal(g:topdir, getcwd(-1)) + + tabnew x + new y + new z + 3wincmd w + call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir2 + call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) + call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) + call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + let tp_nr = tabpagenr() + tabrewind + call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) + call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) + call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) + call assert_equal(g:topdir, getcwd(-1)) +endfunc diff --git a/src/testdir/test_getvar.vim b/src/testdir/test_getvar.vim new file mode 100644 index 0000000000..d6b6b69aa8 --- /dev/null +++ b/src/testdir/test_getvar.vim @@ -0,0 +1,104 @@ +" Tests for getwinvar(), gettabvar() and gettabwinvar(). +func Test_var() + " Use strings to test for memory leaks. First, check that in an empty + " window, gettabvar() returns the correct value + let t:testvar='abcd' + call assert_equal('abcd', gettabvar(1, 'testvar')) + call assert_equal('abcd', gettabvar(1, 'testvar')) + + " test for getwinvar() + let w:var_str = "Dance" + let def_str = "Chance" + call assert_equal('Dance', getwinvar(1, 'var_str')) + call assert_equal('Dance', getwinvar(1, 'var_str', def_str)) + call assert_equal({'var_str': 'Dance'}, getwinvar(1, '')) + call assert_equal({'var_str': 'Dance'}, getwinvar(1, '', def_str)) + unlet w:var_str + call assert_equal('Chance', getwinvar(1, 'var_str', def_str)) + call assert_equal({}, getwinvar(1, '')) + call assert_equal({}, getwinvar(1, '', def_str)) + call assert_equal('', getwinvar(9, '')) + call assert_equal('Chance', getwinvar(9, '', def_str)) + call assert_equal(0, getwinvar(1, '&nu')) + call assert_equal(0, getwinvar(1, '&nu', 1)) + unlet def_str + + " test for gettabvar() + tabnew + tabnew + let t:var_list = [1, 2, 3] + let t:other = 777 + let def_list = [4, 5, 6, 7] + tabrewind + call assert_equal([1, 2, 3], gettabvar(3, 'var_list')) + call assert_equal([1, 2, 3], gettabvar(3, 'var_list', def_list)) + call assert_equal({'var_list': [1, 2, 3], 'other': 777}, gettabvar(3, '')) + call assert_equal({'var_list': [1, 2, 3], 'other': 777}, + \ gettabvar(3, '', def_list)) + + tablast + unlet t:var_list + tabrewind + call assert_equal([4, 5, 6, 7], gettabvar(3, 'var_list', def_list)) + call assert_equal('', gettabvar(9, '')) + call assert_equal([4, 5, 6, 7], gettabvar(9, '', def_list)) + call assert_equal('', gettabvar(3, '&nu')) + call assert_equal([4, 5, 6, 7], gettabvar(3, '&nu', def_list)) + unlet def_list + tabonly + + " test for gettabwinvar() + tabnew + tabnew + tabprev + split + split + wincmd w + vert split + wincmd w + let w:var_dict = {'dict': 'tabwin'} + let def_dict = {'dict2': 'newval'} + wincmd b + tabrewind + call assert_equal({'dict': 'tabwin'}, gettabwinvar(2, 3, 'var_dict')) + call assert_equal({'dict': 'tabwin'}, + \ gettabwinvar(2, 3, 'var_dict', def_dict)) + call assert_equal({'var_dict': {'dict': 'tabwin'}}, gettabwinvar(2, 3, '')) + call assert_equal({'var_dict': {'dict': 'tabwin'}}, + \ gettabwinvar(2, 3, '', def_dict)) + + tabnext + 3wincmd w + unlet w:var_dict + tabrewind + call assert_equal({'dict2': 'newval'}, + \ gettabwinvar(2, 3, 'var_dict', def_dict)) + call assert_equal({}, gettabwinvar(2, 3, '')) + call assert_equal({}, gettabwinvar(2, 3, '', def_dict)) + call assert_equal("", gettabwinvar(2, 9, '')) + call assert_equal({'dict2': 'newval'}, gettabwinvar(2, 9, '', def_dict)) + call assert_equal('', gettabwinvar(9, 3, '')) + call assert_equal({'dict2': 'newval'}, gettabwinvar(9, 3, '', def_dict)) + + unlet def_dict + + call assert_equal('', gettabwinvar(2, 3, '&nux')) + call assert_equal(1, gettabwinvar(2, 3, '&nux', 1)) + tabonly +endfunc + +" It was discovered that "gettabvar()" would fail if called from within the +" tabline when the user closed a window. This test confirms the fix. +func Test_gettabvar_in_tabline() + let t:var_str = 'value' + + set tabline=%{assert_equal('value',gettabvar(1,'var_str'))} + set showtabline=2 + + " Simulate the user opening a split (which becomes window #1) and then + " closing the split, which triggers the redrawing of the tabline. + leftabove split + redrawstatus! + close + redrawstatus! +endfunc diff --git a/src/testdir/test_gf.vim b/src/testdir/test_gf.vim new file mode 100644 index 0000000000..c352379697 --- /dev/null +++ b/src/testdir/test_gf.vim @@ -0,0 +1,61 @@ + +" This is a test if a URL is recognized by "gf", with the cursor before and +" after the "://". Also test ":\\". +func Test_gf_url() + enew! + call append(0, [ + \ "first test for URL://machine.name/tmp/vimtest2a and other text", + \ "second test for URL://machine.name/tmp/vimtest2b. And other text", + \ "third test for URL:\\\\machine.name\\vimtest2c and other text", + \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text", + \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text", + \ ]) + call cursor(1,1) + call search("^first") + call search("tmp") + call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>")) + call search("^second") + call search("URL") + call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>")) + if has("ebcdic") + set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ + else + set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ + endif + call search("^third") + call search("name") + call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>")) + call search("^fourth") + call search("URL") + call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>")) + + call search("^fifth") + call search("URL") + call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>")) + + set isf&vim + enew! +endfunc + +func Test_gF() + new + call setline(1, ['111', '222', '333', '444']) + w! Xfile + close + new + set isfname-=: + call setline(1, ['one', 'Xfile:3', 'three']) + 2 + call assert_fails('normal gF', 'E37:') + call assert_equal(2, getcurpos()[1]) + w! Xfile2 + normal gF + call assert_equal('Xfile', bufname('%')) + call assert_equal(3, getcurpos()[1]) + + set isfname& + call delete('Xfile') + call delete('Xfile2') + bwipe Xfile + bwipe Xfile2 +endfunc diff --git a/src/testdir/test_glob2regpat.vim b/src/testdir/test_glob2regpat.vim new file mode 100644 index 0000000000..fdf17946b6 --- /dev/null +++ b/src/testdir/test_glob2regpat.vim @@ -0,0 +1,30 @@ +" Test glob2regpat() + +func Test_invalid() + call assert_fails('call glob2regpat(1.33)', 'E806:') + call assert_fails('call glob2regpat("}")', 'E219:') + call assert_fails('call glob2regpat("{")', 'E220:') +endfunc + +func Test_valid() + call assert_equal('^foo\.', glob2regpat('foo.*')) + call assert_equal('^foo.$', glob2regpat('foo?')) + call assert_equal('\.vim$', glob2regpat('*.vim')) + call assert_equal('^[abc]$', glob2regpat('[abc]')) + call assert_equal('^foo bar$', glob2regpat('foo\ bar')) + call assert_equal('^foo,bar$', glob2regpat('foo,bar')) + call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}')) + call assert_equal('.*', glob2regpat('**')) + + if exists('+shellslash') + call assert_equal('^foo[\/].$', glob2regpat('foo\?')) + call assert_equal('^\(foo[\/]\|bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) + call assert_equal('^[\/]\(foo\|bar[\/]\)$', glob2regpat('\{foo,bar\}')) + call assert_equal('^[\/][\/]\(foo\|bar[\/][\/]\)$', glob2regpat('\\{foo,bar\\}')) + else + call assert_equal('^foo?$', glob2regpat('foo\?')) + call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) + call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}')) + call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}')) + endif +endfunc diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim new file mode 100644 index 0000000000..bdeaf8e2cf --- /dev/null +++ b/src/testdir/test_global.vim @@ -0,0 +1,20 @@ + +func Test_yank_put_clipboard() + new + call setline(1, ['a', 'b', 'c']) + set clipboard=unnamed + g/^/normal yyp + call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6)) + + set clipboard& + bwipe! +endfunc + +func Test_nested_global() + new + call setline(1, ['nothing', 'found', 'found bad', 'bad']) + call assert_fails('g/found/3v/bad/s/^/++/', 'E147') + g/found/v/bad/s/^/++/ + call assert_equal(['nothing', '++found', 'found bad', 'bad'], getline(1, 4)) + bwipe! +endfunc diff --git a/src/testdir/test_gn.vim b/src/testdir/test_gn.vim new file mode 100644 index 0000000000..6d48915c15 --- /dev/null +++ b/src/testdir/test_gn.vim @@ -0,0 +1,134 @@ +" Test for gn command + +func Test_gn_command() + noautocmd new + " replace a single char by itsself quoted: + call setline('.', 'abc x def x ghi x jkl') + let @/ = 'x' + exe "norm! cgn'x'\<esc>.." + call assert_equal("abc 'x' def 'x' ghi 'x' jkl", getline('.')) + sil! %d_ + + " simple search match + call setline('.', 'foobar') + let @/ = 'foobar' + exe "norm! gncsearchmatch" + call assert_equal('searchmatch', getline('.')) + sil! %d _ + + " replace a multi-line match + call setline('.', ['', 'one', 'two']) + let @/ = 'one\_s*two\_s' + exe "norm! gnceins\<CR>zwei" + call assert_equal(['','eins','zwei'], getline(1,'$')) + sil! %d _ + + " test count argument + call setline('.', ['', 'abcdx | abcdx | abcdx']) + let @/ = '[a]bcdx' + exe "norm! 2gnd" + call assert_equal(['','abcdx | | abcdx'], getline(1,'$')) + sil! %d _ + + " join lines + call setline('.', ['join ', 'lines']) + let @/ = '$' + exe "norm! 0gnd" + call assert_equal(['join lines'], getline(1,'$')) + sil! %d _ + + " zero-width match + call setline('.', ['', 'zero width pattern']) + let @/ = '\>\zs' + exe "norm! 0gnd" + call assert_equal(['', 'zerowidth pattern'], getline(1,'$')) + sil! %d _ + + " delete first and last chars + call setline('.', ['delete first and last chars']) + let @/ = '^' + exe "norm! 0gnd$" + let @/ = '\zs' + exe "norm! gnd" + call assert_equal(['elete first and last char'], getline(1,'$')) + sil! %d _ + + " using visual mode + call setline('.', ['', 'uniquepattern uniquepattern']) + exe "norm! /[u]niquepattern/s\<cr>vlgnd" + call assert_equal(['', ' uniquepattern'], getline(1,'$')) + sil! %d _ + + " backwards search + call setline('.', ['my very excellent mother just served us nachos']) + let @/ = 'mother' + exe "norm! $cgNmongoose" + call assert_equal(['my very excellent mongoose just served us nachos'], getline(1,'$')) + sil! %d _ + + " search for single char + call setline('.', ['','for (i=0; i<=10; i++)']) + let @/ = 'i' + exe "norm! cgnj" + call assert_equal(['','for (j=0; i<=10; i++)'], getline(1,'$')) + sil! %d _ + + " search hex char + call setline('.', ['','Y']) + set noignorecase + let @/ = '\%x59' + exe "norm! gnd" + call assert_equal(['',''], getline(1,'$')) + sil! %d _ + + " test repeating gdn + call setline('.', ['', '1', 'Johnny', '2', 'Johnny', '3']) + let @/ = 'Johnny' + exe "norm! dgn." + call assert_equal(['','1', '', '2', '', '3'], getline(1,'$')) + sil! %d _ + + " test repeating gUgn + call setline('.', ['', '1', 'Depp', '2', 'Depp', '3']) + let @/ = 'Depp' + exe "norm! gUgn." + call assert_equal(['', '1', 'DEPP', '2', 'DEPP', '3'], getline(1,'$')) + sil! %d _ + + " test using look-ahead assertions + call setline('.', ['a:10', '', 'a:1', '', 'a:20']) + let @/ = 'a:0\@!\zs\d\+' + exe "norm! 2nygno\<esc>p" + call assert_equal(['a:10', '', 'a:1', '1', '', 'a:20'], getline(1,'$')) + sil! %d _ + + " test using nowrapscan + set nowrapscan + call setline(1, 'foo bar baz') + exe "norm! /bar/e\<cr>" + exe "norm! gnd" + call assert_equal(['foo baz'], getline(1,'$')) + sil! %d_ + + " search upwards with nowrapscan set + call setline('.', ['foo', 'bar', 'foo', 'baz']) + set nowrapscan + let @/ = 'foo' + $ + norm! dgN + call assert_equal(['foo', 'bar', '', 'baz'], getline(1,'$')) + sil! %d_ + + " search using the \zs atom + call setline(1, [' nnoremap', '' , 'nnoremap']) + set wrapscan&vim + let @/ = '\_s\zsnnoremap' + $ + norm! cgnmatch + call assert_equal([' nnoremap', '', 'match'], getline(1,'$')) + sil! %d_ + + set wrapscan&vim +endfu + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim new file mode 100644 index 0000000000..c0235b1707 --- /dev/null +++ b/src/testdir/test_goto.vim @@ -0,0 +1,373 @@ +" Test commands that jump somewhere. + +" Create a new buffer using "lines" and place the cursor on the word after the +" first occurrence of return and invoke "cmd". The cursor should now be +" positioned at the given line and col. +func XTest_goto_decl(cmd, lines, line, col) + new + call setline(1, a:lines) + /return/ + normal! W + execute 'norm! ' . a:cmd + call assert_equal(a:line, line('.')) + call assert_equal(a:col, col('.')) + quit! +endfunc + +func Test_gD() + let lines = [ + \ 'int x;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 1, 5) +endfunc + +func Test_gD_too() + let lines = [ + \ 'Filename x;', + \ '', + \ 'int Filename', + \ 'int func() {', + \ ' Filename x;', + \ ' return x;', + \ ] + call XTest_goto_decl('gD', lines, 1, 10) +endfunc + +func Test_gD_comment() + let lines = [ + \ '/* int x; */', + \ 'int x;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 2, 5) +endfunc + +func Test_gD_inline_comment() + let lines = [ + \ 'int y /* , x */;', + \ 'int x;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 2, 5) +endfunc + +func Test_gD_string() + let lines = [ + \ 'char *s[] = "x";', + \ 'int x = 1;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 2, 5) +endfunc + +func Test_gD_string_same_line() + let lines = [ + \ 'char *s[] = "x", int x = 1;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 1, 22) +endfunc + +func Test_gD_char() + let lines = [ + \ "char c = 'x';", + \ 'int x = 1;', + \ '', + \ 'int func(void)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gD', lines, 2, 5) +endfunc + +func Test_gd() + let lines = [ + \ 'int x;', + \ '', + \ 'int func(int x)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 3, 14) +endfunc + +func Test_gd_not_local() + let lines = [ + \ 'int func1(void)', + \ '{', + \ ' return x;', + \ '}', + \ '', + \ 'int func2(int x)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 3, 10) +endfunc + +func Test_gd_kr_style() + let lines = [ + \ 'int func(x)', + \ ' int x;', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 2, 7) +endfunc + +func Test_gd_missing_braces() + let lines = [ + \ 'def func1(a)', + \ ' a + 1', + \ 'end', + \ '', + \ 'a = 1', + \ '', + \ 'def func2()', + \ ' return a', + \ 'end', + \ ] + call XTest_goto_decl('gd', lines, 1, 11) +endfunc + +func Test_gd_comment() + let lines = [ + \ 'int func(void)', + \ '{', + \ ' /* int x; */', + \ ' int x;', + \ ' return x;', + \ '}', + \] + call XTest_goto_decl('gd', lines, 4, 7) +endfunc + +func Test_gd_comment_in_string() + let lines = [ + \ 'int func(void)', + \ '{', + \ ' char *s ="//"; int x;', + \ ' int x;', + \ ' return x;', + \ '}', + \] + call XTest_goto_decl('gd', lines, 3, 22) +endfunc + +func Test_gd_string_in_comment() + set comments= + let lines = [ + \ 'int func(void)', + \ '{', + \ ' /* " */ int x;', + \ ' int x;', + \ ' return x;', + \ '}', + \] + call XTest_goto_decl('gd', lines, 3, 15) + set comments& +endfunc + +func Test_gd_inline_comment() + let lines = [ + \ 'int func(/* x is an int */ int x)', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 1, 32) +endfunc + +func Test_gd_inline_comment_only() + let lines = [ + \ 'int func(void) /* one lonely x */', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 3, 10) +endfunc + +func Test_gd_inline_comment_body() + let lines = [ + \ 'int func(void)', + \ '{', + \ ' int y /* , x */;', + \ '', + \ ' for (/* int x = 0 */; y < 2; y++);', + \ '', + \ ' int x = 0;', + \ '', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 7, 7) +endfunc + +func Test_gd_trailing_multiline_comment() + let lines = [ + \ 'int func(int x) /* x is an int */', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 1, 14) +endfunc + +func Test_gd_trailing_comment() + let lines = [ + \ 'int func(int x) // x is an int', + \ '{', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 1, 14) +endfunc + +func Test_gd_string() + let lines = [ + \ 'int func(void)', + \ '{', + \ ' char *s = "x";', + \ ' int x = 1;', + \ '', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 4, 7) +endfunc + +func Test_gd_string_only() + let lines = [ + \ 'int func(void)', + \ '{', + \ ' char *s = "x";', + \ '', + \ ' return x;', + \ '}', + \ ] + call XTest_goto_decl('gd', lines, 5, 10) +endfunc + +" Check that setting 'cursorline' does not change curswant +func Test_cursorline_keep_col() + new + call setline(1, ['long long long line', 'short line']) + normal ggfi + let pos = getcurpos() + normal j + set cursorline + normal k + call assert_equal(pos, getcurpos()) + bwipe! + set nocursorline +endfunc + +func Test_gd_local_block() + let lines = [ + \ ' int main()', + \ '{', + \ ' char *a = "NOT NULL";', + \ ' if(a)', + \ ' {', + \ ' char *b = a;', + \ ' printf("%s\n", b);', + \ ' }', + \ ' else', + \ ' {', + \ ' char *b = "NULL";', + \ ' return b;', + \ ' }', + \ '', + \ ' return 0;', + \ '}', + \ ] + call XTest_goto_decl('1gd', lines, 11, 11) +endfunc + +func Test_motion_if_elif_else_endif() + new + a +/* Test pressing % on #if, #else #elsif and #endif, + * with nested #if + */ +#if FOO +/* ... */ +# if BAR +/* ... */ +# endif +#elif BAR +/* ... */ +#else +/* ... */ +#endif +. + /#if FOO + norm % + call assert_equal([9, 1], getpos('.')[1:2]) + norm % + call assert_equal([11, 1], getpos('.')[1:2]) + norm % + call assert_equal([13, 1], getpos('.')[1:2]) + norm % + call assert_equal([4, 1], getpos('.')[1:2]) + /# if BAR + norm $% + call assert_equal([8, 1], getpos('.')[1:2]) + norm $% + call assert_equal([6, 1], getpos('.')[1:2]) + + bw! +endfunc + +func Test_motion_c_comment() + new + a +/* + * Test pressing % on beginning/end + * of C comments. + */ +/* Another comment */ +. + norm gg0% + call assert_equal([4, 3], getpos('.')[1:2]) + norm % + call assert_equal([1, 1], getpos('.')[1:2]) + norm gg0l% + call assert_equal([4, 3], getpos('.')[1:2]) + norm h% + call assert_equal([1, 1], getpos('.')[1:2]) + + norm G^ + norm % + call assert_equal([5, 21], getpos('.')[1:2]) + norm % + call assert_equal([5, 1], getpos('.')[1:2]) + + bw! +endfunc diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim new file mode 100644 index 0000000000..2c5b60f583 --- /dev/null +++ b/src/testdir/test_gui.vim @@ -0,0 +1,744 @@ +" Tests specifically for the GUI + +source shared.vim +if !CanRunGui() + finish +endif + +source setup_gui.vim + +func Setup() + call GUISetUpCommon() +endfunc + +func TearDown() + call GUITearDownCommon() +endfunc + +" Test for resetting "secure" flag after GUI has started. +" Must be run first, since it starts the GUI on Unix. +func Test_1_set_secure() + set exrc secure + gui -f + call assert_equal(1, has('gui_running')) +endfunc + +" As for non-GUI, a balloon_show() test was already added with patch 8.0.0401 +func Test_balloon_show() + if has('balloon_eval') + " This won't do anything but must not crash either. + call balloon_show('hi!') + endif +endfunc + +func Test_colorscheme() + let colorscheme_saved = exists('g:colors_name') ? g:colors_name : 'default' + let g:color_count = 0 + augroup TestColors + au! + au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count + au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count + augroup END + + colorscheme torte + redraw! + sleep 200m + call assert_equal('dark', &background) + call assert_equal(1, g:before_colors) + call assert_equal(2, g:after_colors) + + exec 'colorscheme' colorscheme_saved + augroup TestColors + au! + augroup END + unlet g:color_count g:after_colors g:before_colors + redraw! +endfunc + +func Test_getfontname_with_arg() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_implemented + elseif has('gui_athena') || has('gui_motif') + " Invalid font name. The result should be an empty string. + call assert_equal('', getfontname('notexist')) + + " Valid font name. This is usually the real name of 7x13 by default. + let fname = '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1' + call assert_match(fname, getfontname(fname)) + + elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') + " Invalid font name. The result should be the name plus the default size. + call assert_equal('notexist 10', getfontname('notexist')) + + " Valid font name. This is usually the real name of Monospace by default. + let fname = 'Bitstream Vera Sans Mono 12' + call assert_equal(fname, getfontname(fname)) + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_getfontname_without_arg() + let skipped = '' + + let fname = getfontname() + + if !g:x11_based_gui + let skipped = g:not_implemented + elseif has('gui_kde') + " 'expected' is the value specified by SetUp() above. + call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname) + elseif has('gui_athena') || has('gui_motif') + " 'expected' is DFLT_FONT of gui_x11.c or its real name. + let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)' + call assert_match(pat, fname) + elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') + " 'expected' is DEFAULT_FONT of gui_gtk_x11.c. + call assert_equal('Monospace 10', fname) + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_getwinpos() + call assert_match('Window position: X \d\+, Y \d\+', execute('winpos')) + call assert_true(getwinposx() >= 0) + call assert_true(getwinposy() >= 0) + call assert_equal([getwinposx(), getwinposy()], getwinpos()) +endfunc + +func Test_quoteplus() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_supported . 'quoteplus' + else + let quoteplus_saved = @+ + + let test_call = 'Can you hear me?' + let test_response = 'Yes, I can.' + let vim_exe = exepath(v:progpath) + let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;' + \ . vim_exe + \ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s''' + " Ignore the "failed to create input context" error. + let cmd = 'call test_ignore_error("E285") | ' + \ . 'gui -f | ' + \ . 'call feedkeys("' + \ . '\"+p' + \ . ':s/' . test_call . '/' . test_response . '/\<CR>' + \ . '\"+yis' + \ . ':q!\<CR>", "tx")' + let run_vimtest = printf(testee, cmd) + + " Set the quoteplus register to test_call, and another gvim will launched. + " Then, it first tries to paste the content of its own quotedplus register + " onto it. Second, it tries to substitute test_response for the pasted + " sentence. If the sentence is identical to test_call, the substitution + " should succeed. Third, it tries to yank the result of the substitution + " to its own quoteplus register, and last it quits. When system() + " returns, the content of the quoteplus register should be identical to + " test_response if those quoteplus registers are synchronized properly + " with/through the X11 clipboard. + let @+ = test_call + call system(run_vimtest) + call assert_equal(test_response, @+) + + let @+ = quoteplus_saved + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_background() + let background_saved = &background + + set background& + call assert_equal('light', &background) + + set background=dark + call assert_equal('dark', &background) + + let &background = background_saved +endfunc + +func Test_set_balloondelay() + if !exists('+balloondelay') + return + endif + + let balloondelay_saved = &balloondelay + + " Check if the default value is identical to that described in the manual. + set balloondelay& + call assert_equal(600, &balloondelay) + + " Edge cases + + " XXX This fact should be hidden so that people won't be tempted to write + " plugin/TimeMachine.vim. TODO Add reasonable range checks to the source + " code. + set balloondelay=-1 + call assert_equal(-1, &balloondelay) + + " Though it's possible to interpret the zero delay to be 'as soon as + " possible' or even 'indefinite', its actual meaning depends on the GUI + " toolkit in use after all. + set balloondelay=0 + call assert_equal(0, &balloondelay) + + set balloondelay=1 + call assert_equal(1, &balloondelay) + + " Since p_bdelay is of type long currently, the upper bound can be + " impractically huge and machine-dependent. Practically, it's sufficient + " to check if balloondelay works with 0x7fffffff (32 bits) for now. + set balloondelay=2147483647 + call assert_equal(2147483647, &balloondelay) + + let &balloondelay = balloondelay_saved +endfunc + +func Test_set_ballooneval() + if !exists('+ballooneval') + return + endif + + let ballooneval_saved = &ballooneval + + set ballooneval& + call assert_equal(0, &ballooneval) + + set ballooneval + call assert_notequal(0, &ballooneval) + + set noballooneval + call assert_equal(0, &ballooneval) + + let &ballooneval = ballooneval_saved +endfunc + +func Test_set_balloonexpr() + if !exists('+balloonexpr') + return + endif + + let balloonexpr_saved = &balloonexpr + + " Default value + set balloonexpr& + call assert_equal('', &balloonexpr) + + " User-defined function + new + func MyBalloonExpr() + return 'Cursor is at line ' . v:beval_lnum . + \', column ' . v:beval_col . + \ ' of file ' . bufname(v:beval_bufnr) . + \ ' on word "' . v:beval_text . '"' . + \ ' in window ' . v:beval_winid . ' (#' . v:beval_winnr . ')' + endfunc + setl balloonexpr=MyBalloonExpr() + setl ballooneval + call assert_equal('MyBalloonExpr()', &balloonexpr) + " TODO Read non-empty text, place the pointer at a character of a word, + " and check if the content of the balloon is the same as what is expected. + " Also, check if textlock works as expected. + setl balloonexpr& + call assert_equal('', &balloonexpr) + delfunc MyBalloonExpr + bwipe! + + " Multiline support + if has('balloon_multiline') + " Multiline balloon using NL + new + func MyBalloonFuncForMultilineUsingNL() + return "Multiline\nSuppported\nBalloon\nusing NL" + endfunc + setl balloonexpr=MyBalloonFuncForMultilineUsingNL() + setl ballooneval + call assert_equal('MyBalloonFuncForMultilineUsingNL()', &balloonexpr) + " TODO Read non-empty text, place the pointer at a character of a word, + " and check if the content of the balloon is the same as what is + " expected. Also, check if textlock works as expected. + setl balloonexpr& + delfunc MyBalloonFuncForMultilineUsingNL + bwipe! + + " Multiline balloon using List + new + func MyBalloonFuncForMultilineUsingList() + return [ 'Multiline', 'Suppported', 'Balloon', 'using List' ] + endfunc + setl balloonexpr=MyBalloonFuncForMultilineUsingList() + setl ballooneval + call assert_equal('MyBalloonFuncForMultilineUsingList()', &balloonexpr) + " TODO Read non-empty text, place the pointer at a character of a word, + " and check if the content of the balloon is the same as what is + " expected. Also, check if textlock works as expected. + setl balloonexpr& + delfunc MyBalloonFuncForMultilineUsingList + bwipe! + endif + + let &balloonexpr = balloonexpr_saved +endfunc + +" Invalid arguments are tested with test_options in conjunction with segfaults +" caused by them (Patch 8.0.0357, 24922ec233). +func Test_set_guicursor() + let guicursor_saved = &guicursor + + let default = [ + \ "n-v-c:block-Cursor/lCursor", + \ "ve:ver35-Cursor", + \ "o:hor50-Cursor", + \ "i-ci:ver25-Cursor/lCursor", + \ "r-cr:hor20-Cursor/lCursor", + \ "sm:block-Cursor-blinkwait175-blinkoff150-blinkon175" + \ ] + + " Default Value + set guicursor& + call assert_equal(join(default, ','), &guicursor) + + " Argument List Example 1 + let opt_list = copy(default) + let opt_list[0] = "n-c-v:block-nCursor" + exec "set guicursor=" . join(opt_list, ',') + call assert_equal(join(opt_list, ','), &guicursor) + unlet opt_list + + " Argument List Example 2 + let opt_list = copy(default) + let opt_list[3] = "i-ci:ver30-iCursor-blinkwait300-blinkon200-blinkoff150" + exec "set guicursor=" . join(opt_list, ',') + call assert_equal(join(opt_list, ','), &guicursor) + unlet opt_list + + " 'a' Mode + set guicursor& + let &guicursor .= ',a:blinkon0' + call assert_equal(join(default, ',') . ",a:blinkon0", &guicursor) + + let &guicursor = guicursor_saved +endfunc + +func Test_set_guifont() + let skipped = '' + + let guifont_saved = &guifont + if has('xfontset') + " Prevent 'guifontset' from canceling 'guifont'. + let guifontset_saved = &guifontset + set guifontset= + endif + + if !g:x11_based_gui + let skipped = g:not_implemented + elseif has('gui_athena') || has('gui_motif') + " Non-empty font list with invalid font names. + " + " This test is twofold: (1) It checks if the command fails as expected + " when there are no loadable fonts found in the list. (2) It checks if + " 'guifont' remains the same after the command loads none of the fonts + " listed. + let flist = &guifont + call assert_fails('set guifont=-notexist1-*,-notexist2-*') + call assert_equal(flist, &guifont) + + " Non-empty font list with a valid font name. Should pick up the first + " valid font. + set guifont=-notexist1-*,fixed,-notexist2-* + let pat = '\(fixed\)\|\(\c-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1\)' + call assert_match(pat, getfontname()) + + " Empty list. Should fallback to the built-in default. + set guifont= + let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)' + call assert_match(pat, getfontname()) + + elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') + " For GTK, what we refer to as 'font names' in our manual are actually + " 'initial font patterns'. A valid font which matches the 'canonical font + " pattern' constructed from a given 'initial pattern' is to be looked up + " and loaded. That explains why the GTK GUIs appear to accept 'invalid + " font names'. + " + " Non-empty list. Should always pick up the first element, no matter how + " strange it is, as explained above. + set guifont=(´・ω・`)\ 12,Courier\ 12 + call assert_equal('(´・ω・`) 12', getfontname()) + + " Empty list. Should fallback to the built-in default. + set guifont= + call assert_equal('Monospace 10', getfontname()) + endif + + if has('xfontset') + let &guifontset = guifontset_saved + endif + let &guifont = guifont_saved + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_guifontset() + let skipped = '' + + if !has('xfontset') + let skipped = g:not_supported . 'xfontset' + else + let ctype_saved = v:ctype + + " First, since XCreateFontSet(3) is very sensitive to locale, fonts must + " be chosen meticulously. + let font_head = '-misc-fixed-medium-r-normal--14' + + let font_aw70 = font_head . '-130-75-75-c-70' + let font_aw140 = font_head . '-130-75-75-c-140' + + let font_jisx0201 = font_aw70 . '-jisx0201.1976-0' + let font_jisx0208 = font_aw140 . '-jisx0208.1983-0' + + let full_XLFDs = join([ font_jisx0208, font_jisx0201 ], ',') + let short_XLFDs = join([ font_aw140, font_aw70 ], ',') + let singleton = font_head . '-*' + let aliases = 'k14,r14' + + " Second, among 'locales', look up such a locale that gets 'set + " guifontset=' to work successfully with every fontset specified with + " 'fontsets'. + let locales = [ 'ja_JP.UTF-8', 'ja_JP.eucJP', 'ja_JP.SJIS' ] + let fontsets = [ full_XLFDs, short_XLFDs, singleton, aliases ] + + let feasible = 0 + for locale in locales + try + exec 'language ctype' locale + catch /^Vim\%((\a\+)\)\=:E197/ + continue + endtry + let done = 0 + for fontset in fontsets + try + exec 'set guifontset=' . fontset + catch /^Vim\%((\a\+)\)\=:E\%(250\|252\|234\|597\|598\)/ + break + endtry + let done += 1 + endfor + if done == len(fontsets) + let feasible = 1 + break + endif + endfor + + " Third, give a set of tests if it is found feasible. + if !feasible + let skipped = g:not_hosted + else + " N.B. 'v:ctype' has already been set to an appropriate value in the + " previous loop. + for fontset in fontsets + exec 'set guifontset=' . fontset + call assert_equal(fontset, &guifontset) + endfor + endif + + " Finally, restore ctype. + exec 'language ctype' ctype_saved + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_guifontwide() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_implemented + elseif has('gui_gtk') + let guifont_saved = &guifont + let guifontwide_saved = &guifontwide + + let fc_match = exepath('fc-match') + if empty(fc_match) + let skipped = g:not_hosted + else + let &guifont = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=en') + let wide = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=ja') + exec 'set guifontwide=' . fnameescape(wide) + call assert_equal(wide, &guifontwide) + endif + + let &guifontwide = guifontwide_saved + let &guifont = guifont_saved + + elseif has('gui_athena') || has('gui_motif') + " guifontwide is premised upon the xfontset feature. + if !has('xfontset') + let skipped = g:not_supported . 'xfontset' + else + let encoding_saved = &encoding + let guifont_saved = &guifont + let guifontset_saved = &guifontset + let guifontwide_saved = &guifontwide + + let nfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1' + let wfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1' + + set encoding=utf-8 + + " Case 1: guifontset is empty + set guifontset= + + " Case 1-1: Automatic selection + set guifontwide= + exec 'set guifont=' . nfont + call assert_equal(wfont, &guifontwide) + + " Case 1-2: Manual selection + exec 'set guifontwide=' . wfont + exec 'set guifont=' . nfont + call assert_equal(wfont, &guifontwide) + + " Case 2: guifontset is invalid + try + set guifontset=-*-notexist-* + call assert_report("'set guifontset=-*-notexist-*' should have failed") + catch + call assert_exception('E598') + endtry + " Set it to an invalid value brutally for preparation. + let &guifontset = '-*-notexist-*' + + " Case 2-1: Automatic selection + set guifontwide= + exec 'set guifont=' . nfont + call assert_equal(wfont, &guifontwide) + + " Case 2-2: Manual selection + exec 'set guifontwide=' . wfont + exec 'set guifont=' . nfont + call assert_equal(wfont, &guifontwide) + + let &guifontwide = guifontwide_saved + let &guifontset = guifontset_saved + let &guifont = guifont_saved + let &encoding = encoding_saved + endif + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_guiheadroom() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_supported . 'guiheadroom' + else + " Since this script is to be read together with '-U NONE', the default + " value must be preserved. + call assert_equal(50, &guiheadroom) + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_guioptions() + let guioptions_saved = &guioptions + let duration = '200m' + + if has('win32') + " Default Value + set guioptions& + call assert_equal('egmrLtT', &guioptions) + + elseif has('gui_macvim') + " Default Value + set guioptions& + call assert_equal('egmrL', &guioptions) + + else + " Default Value + set guioptions& + call assert_equal('aegimrLtT', &guioptions) + + " To activate scrollbars of type 'L' or 'R'. + wincmd v + redraw! + + " Remove all default GUI ornaments + set guioptions-=T + exec 'sleep' . duration + call assert_equal('aegimrLt', &guioptions) + set guioptions-=t + exec 'sleep' . duration + call assert_equal('aegimrL', &guioptions) + set guioptions-=L + exec 'sleep' . duration + call assert_equal('aegimr', &guioptions) + set guioptions-=r + exec 'sleep' . duration + call assert_equal('aegim', &guioptions) + set guioptions-=m + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + + " Try non-default GUI ornaments + set guioptions+=l + exec 'sleep' . duration + call assert_equal('aegil', &guioptions) + set guioptions-=l + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + + set guioptions+=R + exec 'sleep' . duration + call assert_equal('aegiR', &guioptions) + set guioptions-=R + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + + set guioptions+=b + exec 'sleep' . duration + call assert_equal('aegib', &guioptions) + set guioptions+=h + exec 'sleep' . duration + call assert_equal('aegibh', &guioptions) + set guioptions-=h + exec 'sleep' . duration + call assert_equal('aegib', &guioptions) + set guioptions-=b + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + + set guioptions+=v + exec 'sleep' . duration + call assert_equal('aegiv', &guioptions) + set guioptions-=v + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + + if has('gui_motif') + set guioptions+=F + exec 'sleep' . duration + call assert_equal('aegiF', &guioptions) + set guioptions-=F + exec 'sleep' . duration + call assert_equal('aegi', &guioptions) + endif + + " Restore GUI ornaments to the default state. + set guioptions+=m + exec 'sleep' . duration + call assert_equal('aegim', &guioptions) + set guioptions+=r + exec 'sleep' . duration + call assert_equal('aegimr', &guioptions) + set guioptions+=L + exec 'sleep' . duration + call assert_equal('aegimrL', &guioptions) + set guioptions+=t + exec 'sleep' . duration + call assert_equal('aegimrLt', &guioptions) + set guioptions+=T + exec 'sleep' . duration + call assert_equal("aegimrLtT", &guioptions) + + wincmd o + redraw! + endif + + let &guioptions = guioptions_saved +endfunc + +func Test_set_guipty() + let guipty_saved = &guipty + + " Default Value + set guipty& + call assert_equal(1, &guipty) + + set noguipty + call assert_equal(0, &guipty) + + let &guipty = guipty_saved +endfunc + +func Test_shell_command() + new + r !echo hello + call assert_equal('hello', substitute(getline(2), '\W', '', 'g')) + bwipe! +endfunc + +func Test_syntax_colortest() + runtime syntax/colortest.vim + redraw! + sleep 200m + bwipe! +endfunc + +func Test_set_term() + " It's enough to check the current value since setting 'term' to anything + " other than builtin_gui makes no sense at all. + call assert_equal('builtin_gui', &term) +endfunc + +func Test_windowid_variable() + if g:x11_based_gui || has('win32') + call assert_true(v:windowid > 0) + else + call assert_equal(0, v:windowid) + endif +endfunc + +" Test "vim -g" and also the GUIEnter autocommand. +func Test_gui_dash_g() + let cmd = GetVimCommand('Xscriptgui') + call writefile([""], "Xtestgui") + call writefile([ + \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")', + \ 'au GUIEnter * qall', + \ ], 'Xscriptgui') + call system(cmd . ' -g') + call WaitForAssert({-> assert_equal(['insertmode: 0'], readfile('Xtestgui'))}) + + call delete('Xscriptgui') + call delete('Xtestgui') +endfunc + +" Test "vim -7" and also the GUIEnter autocommand. +func Test_gui_dash_y() + let cmd = GetVimCommand('Xscriptgui') + call writefile([""], "Xtestgui") + call writefile([ + \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")', + \ 'au GUIEnter * qall', + \ ], 'Xscriptgui') + call system(cmd . ' -y') + call WaitForAssert({-> assert_equal(['insertmode: 1'], readfile('Xtestgui'))}) + + call delete('Xscriptgui') + call delete('Xtestgui') +endfunc diff --git a/src/testdir/test_gui_init.vim b/src/testdir/test_gui_init.vim new file mode 100644 index 0000000000..638708f4f1 --- /dev/null +++ b/src/testdir/test_gui_init.vim @@ -0,0 +1,61 @@ +" Tests specifically for the GUI features/options that need to be set up at +" startup to take effect at runtime. + +source shared.vim +if !CanRunGui() + finish +endif + +source setup_gui.vim + +func Setup() + call GUISetUpCommon() +endfunc + +func TearDown() + call GUITearDownCommon() +endfunc + +" Ignore the "failed to create input context" error. +call test_ignore_error('E285:') + +" Start the GUI now, in the foreground. +gui -f + +func Test_set_guiheadroom() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_supported . 'guiheadroom' + else + " The 'expected' value must be consistent with the value specified with + " gui_init.vim. + call assert_equal(0, &guiheadroom) + endif + + if !empty(skipped) + throw skipped + endif +endfunc + +func Test_set_guioptions_for_M() + sleep 200ms + " Check if the 'M' option is included. + call assert_match('.*M.*', &guioptions) +endfunc + +func Test_set_guioptions_for_p() + let skipped = '' + + if !g:x11_based_gui + let skipped = g:not_supported . '''p'' of guioptions' + else + sleep 200ms + " Check if the 'p' option is included. + call assert_match('.*p.*', &guioptions) + endif + + if !empty(skipped) + throw skipped + endif +endfunc diff --git a/src/testdir/test_hardcopy.vim b/src/testdir/test_hardcopy.vim new file mode 100644 index 0000000000..ced13b107c --- /dev/null +++ b/src/testdir/test_hardcopy.vim @@ -0,0 +1,89 @@ +" Test :hardcopy + +func Test_printoptions_parsing() + " Only test that this doesn't throw an error. + set printoptions=left:5in,right:10pt,top:8mm,bottom:2pc + set printoptions=left:2in,top:30pt,right:16mm,bottom:3pc + set printoptions=header:3,syntax:y,number:7,wrap:n + set printoptions=duplex:short,collate:n,jobsplit:y,portrait:n + set printoptions=paper:10x14 + set printoptions=paper:A3 + set printoptions=paper:A4 + set printoptions=paper:A5 + set printoptions=paper:B4 + set printoptions=paper:B5 + set printoptions=paper:executive + set printoptions=paper:folio + set printoptions=paper:ledger + set printoptions=paper:legal + set printoptions=paper:letter + set printoptions=paper:quarto + set printoptions=paper:statement + set printoptions=paper:tabloid + set printoptions=formfeed:y + set printoptions= + set printoptions& + + call assert_fails('set printoptions=paper', 'E550:') + call assert_fails('set printoptions=shredder:on', 'E551:') + call assert_fails('set printoptions=left:no', 'E552:') +endfunc + +func Test_printmbfont_parsing() + " Only test that this doesn't throw an error. + set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no + set printmbfont= + set printmbfont& +endfunc + +func Test_printheader_parsing() + " Only test that this doesn't throw an error. + set printheader=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + set printheader=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P + set printheader=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' + set printheader=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... + set printheader= + set printheader& +endfunc + +" Test that :hardcopy produces a non-empty file. +" We don't check much of the contents. +func Test_with_syntax() + if has('postscript') + edit test_hardcopy.vim + set printoptions=syntax:y + syn on + hardcopy > Xhardcopy + let lines = readfile('Xhardcopy') + call assert_true(len(lines) > 20) + call assert_true(lines[0] =~ 'PS-Adobe') + call delete('Xhardcopy') + set printoptions& + endif +endfunc + +func Test_fname_with_spaces() + if !has('postscript') + return + endif + split t\ e\ s\ t.txt + call setline(1, ['just', 'some', 'text']) + hardcopy > %.ps + call assert_true(filereadable('t e s t.txt.ps')) + call delete('t e s t.txt.ps') + bwipe! +endfunc + +func Test_illegal_byte() + if !has('postscript') || &enc != 'utf-8' + return + endif + new + " conversion of 0xff will fail, this used to cause a crash + call setline(1, "\xff") + hardcopy >Xpstest + + bwipe! + call delete('Xpstest') +endfunc + diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim new file mode 100644 index 0000000000..c550ff09e2 --- /dev/null +++ b/src/testdir/test_help.vim @@ -0,0 +1,51 @@ +" Tests for :help + +func Test_help_restore_snapshot() + help + set buftype= + help + edit x + help + helpclose +endfunc + +func Test_help_errors() + call assert_fails('help doesnotexist', 'E149:') + call assert_fails('help!', 'E478:') + + new + set keywordprg=:help + call setline(1, " ") + call assert_fails('normal VK', 'E349:') + bwipe! +endfunc + +func Test_help_keyword() + new + set keywordprg=:help + call setline(1, " Visual ") + normal VK + call assert_match('^Visual mode', getline('.')) + call assert_equal('help', &ft) + close + bwipe! +endfunc + +func Test_help_local_additions() + call mkdir('Xruntime/doc', 'p') + call writefile(['*mydoc.txt* my awesome doc'], 'Xruntime/doc/mydoc.txt') + call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt') + let rtp_save = &rtp + set rtp+=./Xruntime + help + 1 + call search('mydoc.txt') + call assert_equal('|mydoc.txt| my awesome doc', getline('.')) + 1 + call search('mydoc-ext.txt') + call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.')) + close + + call delete('Xruntime', 'rf') + let &rtp = rtp_save +endfunc diff --git a/src/testdir/test_help_tagjump.vim b/src/testdir/test_help_tagjump.vim new file mode 100644 index 0000000000..51b006c579 --- /dev/null +++ b/src/testdir/test_help_tagjump.vim @@ -0,0 +1,232 @@ +" Tests for :help! {subject} + +func Test_help_tagjump() + help + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*help.txt\*') + helpclose + + help | + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*bar\*') + helpclose + + help "* + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*quotestar\*') + helpclose + + help sm?le + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*:smile\*') + helpclose + + help :? + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*:?\*') + helpclose + + help FileW*Post + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*FileWritePost\*') + helpclose + + help `ls` + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*:ls\*') + helpclose + + help ^X + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*CTRL-X\*') + helpclose + + help i_^_CTRL-D + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*i_^_CTRL-D\*') + helpclose + + exec "help \<C-V>" + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*CTRL-V\*') + helpclose + + + exec "help! ('textwidth'" + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ "\\*'textwidth'\\*") + helpclose + + exec "help! ('buflisted')," + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ "\\*'buflisted'\\*") + helpclose + + exec "help! abs({expr})" + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*abs()\*') + helpclose + + exec "help! arglistid([{winnr}" + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*arglistid()\*') + helpclose + + exec "help! 'autoindent'." + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ "\\*'autoindent'\\*") + helpclose + + exec "help! {address}." + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*{address}\*') + helpclose + + exusage + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*:index\*') + helpclose + + viusage + call assert_equal("help", &filetype) + call assert_true(getline('.') =~ '\*normal-index\*') + helpclose +endfunc + +let s:langs = ['en', 'ab', 'ja'] + +func s:doc_config_setup() + let s:helpfile_save = &helpfile + let &helpfile="Xdir1/doc-en/doc/testdoc.txt" + let s:rtp_save = &rtp + let &rtp="Xdir1/doc-en" + if has('multi_lang') + let s:helplang_save=&helplang + endif + + call delete('Xdir1', 'rf') + + for lang in s:langs + if lang ==# 'en' + let tagfname = 'tags' + let docfname = 'testdoc.txt' + else + let tagfname = 'tags-' . lang + let docfname = 'testdoc.' . lang . 'x' + endif + let docdir = "Xdir1/doc-" . lang . "/doc" + call mkdir(docdir, "p") + call writefile(["\t*test-char*", "\t*test-col*"], docdir . '/' . docfname) + call writefile(["test-char\t" . docfname . "\t/*test-char*", + \ "test-col\t" . docfname . "\t/*test-col*"], + \ docdir . '/' . tagfname) + endfor +endfunc + +func s:doc_config_teardown() + call delete('Xdir1', 'rf') + + let &helpfile = s:helpfile_save + let &rtp = s:rtp_save + if has('multi_lang') + let &helplang = s:helplang_save + endif +endfunc + +func s:get_help_compl_list(cmd) + return getcompletion(a:cmd, 'help') +endfunc + +func Test_help_complete() + try + let list = [] + call s:doc_config_setup() + + " 'helplang=' and help file lang is 'en' + if has('multi_lang') + set helplang= + endif + let list = s:get_help_compl_list("test") + call assert_equal(['test-col', 'test-char'], list) + + if has('multi_lang') + " 'helplang=ab' and help file lang is 'en' + set helplang=ab + let list = s:get_help_compl_list("test") + call assert_equal(['test-col', 'test-char'], list) + + " 'helplang=' and help file lang is 'en' and 'ab' + set rtp+=Xdir1/doc-ab + set helplang= + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col@en', 'test-col@ab', + \ 'test-char@en', 'test-char@ab']), sort(list)) + + " 'helplang=ab' and help file lang is 'en' and 'ab' + set helplang=ab + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@en', + \ 'test-char', 'test-char@en']), sort(list)) + + " 'helplang=' and help file lang is 'en', 'ab' and 'ja' + set rtp+=Xdir1/doc-ja + set helplang= + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col@en', 'test-col@ab', + \ 'test-col@ja', 'test-char@en', + \ 'test-char@ab', 'test-char@ja']), sort(list)) + + " 'helplang=ab' and help file lang is 'en', 'ab' and 'ja' + set helplang=ab + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@en', + \ 'test-col@ja', 'test-char', + \ 'test-char@en', 'test-char@ja']), sort(list)) + + " 'helplang=ab,ja' and help file lang is 'en', 'ab' and 'ja' + set helplang=ab,ja + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@ja', + \ 'test-col@en', 'test-char', + \ 'test-char@ja', 'test-char@en']), sort(list)) + endif + catch + call assert_exception('X') + finally + call s:doc_config_teardown() + endtry +endfunc + +func Test_help_respect_current_file_lang() + try + let list = [] + call s:doc_config_setup() + + if has('multi_lang') + function s:check_help_file_ext(help_keyword, ext) + exec 'help ' . a:help_keyword + call assert_equal(a:ext, expand('%:e')) + call feedkeys("\<C-]>", 'tx') + call assert_equal(a:ext, expand('%:e')) + pop + helpclose + endfunc + + set rtp+=Xdir1/doc-ab + set rtp+=Xdir1/doc-ja + + set helplang=ab + call s:check_help_file_ext('test-char', 'abx') + call s:check_help_file_ext('test-char@ja', 'jax') + set helplang=ab,ja + call s:check_help_file_ext('test-char@ja', 'jax') + call s:check_help_file_ext('test-char@en', 'txt') + endif + catch + call assert_exception('X') + finally + call s:doc_config_teardown() + endtry +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_hide.vim b/src/testdir/test_hide.vim new file mode 100644 index 0000000000..128b8ff945 --- /dev/null +++ b/src/testdir/test_hide.vim @@ -0,0 +1,97 @@ +" Tests for :hide command/modifier and 'hidden' option + +function SetUp() + let s:save_hidden = &hidden + let s:save_bufhidden = &bufhidden + let s:save_autowrite = &autowrite + set nohidden + set bufhidden= + set noautowrite +endfunc + +function TearDown() + let &hidden = s:save_hidden + let &bufhidden = s:save_bufhidden + let &autowrite = s:save_autowrite +endfunc + +function Test_hide() + let orig_bname = bufname('') + let orig_winnr = winnr('$') + + new Xf1 + set modified + call assert_fails('edit Xf2') + bwipeout! Xf1 + + new Xf1 + set modified + edit! Xf2 + call assert_equal(['Xf2', 2], [bufname(''), winnr('$')]) + call assert_equal([1, 0], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + bwipeout! Xf2 + + new Xf1 + set modified + " :hide as a command + hide + call assert_equal([orig_bname, orig_winnr], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + + new Xf1 + set modified + " :hide as a command with trailing comment + hide " comment + call assert_equal([orig_bname, orig_winnr], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + + new Xf1 + set modified + " :hide as a command with bar + hide | new Xf2 " comment + call assert_equal(['Xf2', 2], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + bwipeout! Xf2 + + new Xf1 + set modified + " :hide as a modifier with trailing comment + hide edit Xf2 " comment + call assert_equal(['Xf2', 2], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + bwipeout! Xf2 + + new Xf1 + set modified + " To check that the bar is not recognized to separate commands + hide echo "one|two" + call assert_equal(['Xf1', 2], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + + " set hidden + new Xf1 + set hidden + set modified + edit Xf2 " comment + call assert_equal(['Xf2', 2], [bufname(''), winnr('$')]) + call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf1 + bwipeout! Xf2 + + " set hidden bufhidden=wipe + new Xf1 + set bufhidden=wipe + set modified + hide edit! Xf2 " comment + call assert_equal(['Xf2', 2], [bufname(''), winnr('$')]) + call assert_equal([0, 0], [buflisted('Xf1'), bufloaded('Xf1')]) + bwipeout! Xf2 +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim new file mode 100644 index 0000000000..1e8efea1ad --- /dev/null +++ b/src/testdir/test_highlight.vim @@ -0,0 +1,535 @@ +" Tests for ":highlight" and highlighting. + +source view_util.vim + +func Test_highlight() + " basic test if ":highlight" doesn't crash + highlight + hi Search + + " test setting colors. + " test clearing one color and all doesn't generate error or warning + silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan + silent! hi Group2 term= cterm= + hi Group3 term=underline cterm=bold + + let res = split(execute("hi NewGroup"), "\n")[0] + " filter ctermfg and ctermbg, the numbers depend on the terminal + let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '') + let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '') + call assert_equal("NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3", + \ res) + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + call assert_equal("Group3 xxx term=underline cterm=bold", + \ split(execute("hi Group3"), "\n")[0]) + + hi clear NewGroup + call assert_equal("NewGroup xxx cleared", + \ split(execute("hi NewGroup"), "\n")[0]) + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + hi Group2 NONE + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + hi clear + call assert_equal("Group3 xxx cleared", + \ split(execute("hi Group3"), "\n")[0]) + call assert_fails("hi Crash term='asdf", "E475:") +endfunc + +function! HighlightArgs(name) + return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '') +endfunction + +function! IsColorable() + return has('gui_running') || str2nr(&t_Co) >= 8 +endfunction + +function! HiCursorLine() + let hiCursorLine = HighlightArgs('CursorLine') + if has('gui_running') + let guibg = matchstr(hiCursorLine, 'guibg=\w\+') + let hi_ul = 'hi CursorLine gui=underline guibg=NONE' + let hi_bg = 'hi CursorLine gui=NONE ' . guibg + else + let hi_ul = 'hi CursorLine cterm=underline ctermbg=NONE' + let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray' + endif + return [hiCursorLine, hi_ul, hi_bg] +endfunction + +function! Check_lcs_eol_attrs(attrs, row, col) + let save_lcs = &lcs + set list + + call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0]) + + set nolist + let &lcs = save_lcs +endfunction + +func Test_highlight_eol_with_cursorline() + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 20) + call setline(1, 'abcd') + call matchadd('Search', '\n') + + " expected: + " 'abcd ' + " ^^^^ ^^^^^ no highlight + " ^ 'Search' highlight + let attrs0 = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3]) + call assert_equal(repeat([attrs0[0]], 5), attrs0[5:9]) + call assert_notequal(attrs0[0], attrs0[4]) + + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " 'abcd ' + " ^^^^ underline + " ^ 'Search' highlight with underline + " ^^^^^ underline + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[4], attrs[4]) + call Check_lcs_eol_attrs(attrs, 1, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " 'abcd ' + " ^^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal(repeat([attrs[5]], 5), attrs[5:9]) + call assert_equal(attrs0[4], attrs[4]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[5], attrs[5]) + call Check_lcs_eol_attrs(attrs, 1, 10) + endif + + call CloseWindow() + exe hiCursorLine +endfunc + +func Test_highlight_eol_with_cursorline_vertsplit() + if !has('vertsplit') + return + endif + + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 5) + call setline(1, 'abcd') + call matchadd('Search', '\n') + + let expected = "abcd |abcd " + let actual = ScreenLines(1, 15)[0] + call assert_equal(expected, actual) + + " expected: + " 'abcd |abcd ' + " ^^^^ ^^^^^^^^^ no highlight + " ^ 'Search' highlight + " ^ 'VertSplit' highlight + let attrs0 = ScreenAttrs(1, 15)[0] + call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3]) + call assert_equal(repeat([attrs0[0]], 9), attrs0[6:14]) + call assert_notequal(attrs0[0], attrs0[4]) + call assert_notequal(attrs0[0], attrs0[5]) + call assert_notequal(attrs0[4], attrs0[5]) + + setlocal cursorline + + " expected: + " 'abcd |abcd ' + " ^^^^ underline + " ^ 'Search' highlight with underline + " ^ 'VertSplit' highlight + " ^^^^^^^^^ no highlight + + " underline + exe hi_ul + + let actual = ScreenLines(1, 15)[0] + call assert_equal(expected, actual) + + let attrs = ScreenAttrs(1, 15)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal(repeat([attrs[6]], 9), attrs[6:14]) + call assert_equal(attrs0[5:14], attrs[5:14]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[0], attrs[5]) + call assert_notequal(attrs[0], attrs[6]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs[5], attrs[6]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[4], attrs[4]) + call Check_lcs_eol_attrs(attrs, 1, 15) + + if IsColorable() + " bg-color + exe hi_bg + + let actual = ScreenLines(1, 15)[0] + call assert_equal(expected, actual) + + let attrs = ScreenAttrs(1, 15)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal(repeat([attrs[6]], 9), attrs[6:14]) + call assert_equal(attrs0[5:14], attrs[5:14]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[0], attrs[5]) + call assert_notequal(attrs[0], attrs[6]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs[5], attrs[6]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_equal(attrs0[4], attrs[4]) + call Check_lcs_eol_attrs(attrs, 1, 15) + endif + + call CloseWindow() + exe hiCursorLine +endfunc + +func Test_highlight_eol_with_cursorline_rightleft() + if !has('rightleft') + return + endif + + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 10) + setlocal rightleft + call setline(1, 'abcd') + call matchadd('Search', '\n') + let attrs0 = ScreenAttrs(1, 10)[0] + + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " ' dcba' + " ^^^^ underline + " ^ 'Search' highlight with underline + " ^^^^^ underline + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[9]], 4), attrs[6:9]) + call assert_equal(repeat([attrs[4]], 5) + [attrs[5]], attrs[0:5]) + call assert_notequal(attrs[9], attrs[5]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs0[9], attrs[9]) + call assert_notequal(attrs0[5], attrs[5]) + call Check_lcs_eol_attrs(attrs, 1, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " ' dcba' + " ^^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[9]], 4), attrs[6:9]) + call assert_equal(repeat([attrs[4]], 5), attrs[0:4]) + call assert_equal(attrs0[5], attrs[5]) + call assert_notequal(attrs[9], attrs[5]) + call assert_notequal(attrs[5], attrs[4]) + call assert_notequal(attrs0[9], attrs[9]) + call assert_notequal(attrs0[4], attrs[4]) + call Check_lcs_eol_attrs(attrs, 1, 10) + endif + + call CloseWindow() + exe hiCursorLine +endfunc + +func Test_highlight_eol_with_cursorline_linewrap() + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 10) + call setline(1, [repeat('a', 51) . 'bcd', '']) + call matchadd('Search', '\n') + + setlocal wrap + normal! gg$ + let attrs0 = ScreenAttrs(5, 10)[0] + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " 'abcd ' + " ^^^^ underline + " ^ 'Search' highlight with underline + " ^^^^^ underline + let attrs = ScreenAttrs(5, 10)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[4], attrs[4]) + call Check_lcs_eol_attrs(attrs, 5, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " 'abcd ' + " ^^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(5, 10)[0] + call assert_equal(repeat([attrs[0]], 4), attrs[0:3]) + call assert_equal(repeat([attrs[5]], 5), attrs[5:9]) + call assert_equal(attrs0[4], attrs[4]) + call assert_notequal(attrs[0], attrs[4]) + call assert_notequal(attrs[4], attrs[5]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[5], attrs[5]) + call Check_lcs_eol_attrs(attrs, 5, 10) + endif + + setlocal nocursorline nowrap + normal! gg$ + let attrs0 = ScreenAttrs(1, 10)[0] + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " 'aaabcd ' + " ^^^^^^ underline + " ^ 'Search' highlight with underline + " ^^^ underline + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[0]], 6), attrs[0:5]) + call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9]) + call assert_notequal(attrs[0], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[6], attrs[6]) + call Check_lcs_eol_attrs(attrs, 1, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " 'aaabcd ' + " ^^^^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[0]], 6), attrs[0:5]) + call assert_equal(repeat([attrs[7]], 3), attrs[7:9]) + call assert_equal(attrs0[6], attrs[6]) + call assert_notequal(attrs[0], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[0], attrs[0]) + call assert_notequal(attrs0[7], attrs[7]) + call Check_lcs_eol_attrs(attrs, 1, 10) + endif + + call CloseWindow() + exe hiCursorLine +endfunc + +func Test_highlight_eol_with_cursorline_sign() + if !has('signs') + return + endif + + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 10) + call setline(1, 'abcd') + call matchadd('Search', '\n') + + sign define Sign text=>> + exe 'sign place 1 line=1 name=Sign buffer=' . bufnr('') + let attrs0 = ScreenAttrs(1, 10)[0] + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " '>>abcd ' + " ^^ sign + " ^^^^ underline + " ^ 'Search' highlight with underline + " ^^^ underline + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[2]], 4), attrs[2:5]) + call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9]) + call assert_notequal(attrs[2], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[2], attrs[2]) + call assert_notequal(attrs0[6], attrs[6]) + call Check_lcs_eol_attrs(attrs, 1, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " '>>abcd ' + " ^^ sign + " ^^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[2]], 4), attrs[2:5]) + call assert_equal(repeat([attrs[7]], 3), attrs[7:9]) + call assert_equal(attrs0[6], attrs[6]) + call assert_notequal(attrs[2], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[2], attrs[2]) + call assert_notequal(attrs0[7], attrs[7]) + call Check_lcs_eol_attrs(attrs, 1, 10) + endif + + sign unplace 1 + call CloseWindow() + exe hiCursorLine +endfunc + +func Test_highlight_eol_with_cursorline_breakindent() + if !has('linebreak') + return + endif + + let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() + + call NewWindow('topleft 5', 10) + setlocal breakindent breakindentopt=min:0,shift:1 showbreak=> + call setline(1, ' ' . repeat('a', 9) . 'bcd') + call matchadd('Search', '\n') + let attrs0 = ScreenAttrs(2, 10)[0] + setlocal cursorline + + " underline + exe hi_ul + + " expected: + " ' >bcd ' + " ^^^ breakindent and showbreak + " ^^^ underline + " ^ 'Search' highlight with underline + " ^^^ underline + let attrs = ScreenAttrs(2, 10)[0] + call assert_equal(repeat([attrs[0]], 2), attrs[0:1]) + call assert_equal(repeat([attrs[3]], 3), attrs[3:5]) + call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9]) + call assert_equal(attrs0[0], attrs[0]) + call assert_notequal(attrs[0], attrs[2]) + call assert_notequal(attrs[2], attrs[3]) + call assert_notequal(attrs[3], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[2], attrs[2]) + call assert_notequal(attrs0[3], attrs[3]) + call assert_notequal(attrs0[6], attrs[6]) + call Check_lcs_eol_attrs(attrs, 2, 10) + + if IsColorable() + " bg-color + exe hi_bg + + " expected: + " ' >bcd ' + " ^^^ breakindent and showbreak + " ^^^ bg-color of 'CursorLine' + " ^ 'Search' highlight + " ^^^ bg-color of 'CursorLine' + let attrs = ScreenAttrs(2, 10)[0] + call assert_equal(repeat([attrs[0]], 2), attrs[0:1]) + call assert_equal(repeat([attrs[3]], 3), attrs[3:5]) + call assert_equal(repeat([attrs[7]], 3), attrs[7:9]) + call assert_equal(attrs0[0], attrs[0]) + call assert_equal(attrs0[6], attrs[6]) + call assert_notequal(attrs[0], attrs[2]) + call assert_notequal(attrs[2], attrs[3]) + call assert_notequal(attrs[3], attrs[6]) + call assert_notequal(attrs[6], attrs[7]) + call assert_notequal(attrs0[2], attrs[2]) + call assert_notequal(attrs0[3], attrs[3]) + call assert_notequal(attrs0[7], attrs[7]) + call Check_lcs_eol_attrs(attrs, 2, 10) + endif + + call CloseWindow() + set showbreak= + exe hiCursorLine +endfunc + +func Test_highlight_eol_on_diff() + call setline(1, ['abcd', '']) + call matchadd('Search', '\n') + let attrs0 = ScreenAttrs(1, 10)[0] + + diffthis + botright new + diffthis + + " expected: + " ' abcd ' + " ^^ sign + " ^^^^ ^^^ 'DiffAdd' highlight + " ^ 'Search' highlight + let attrs = ScreenAttrs(1, 10)[0] + call assert_equal(repeat([attrs[0]], 2), attrs[0:1]) + call assert_equal(repeat([attrs[2]], 4), attrs[2:5]) + call assert_equal(repeat([attrs[2]], 3), attrs[7:9]) + call assert_equal(attrs0[4], attrs[6]) + call assert_notequal(attrs[0], attrs[2]) + call assert_notequal(attrs[0], attrs[6]) + call assert_notequal(attrs[2], attrs[6]) + call Check_lcs_eol_attrs(attrs, 1, 10) + + bwipe! + diffoff +endfunc + +func Test_termguicolors() + if !exists('+termguicolors') + return + endif + if has('vtp') && !has('vcon') + " Win32: 'guicolors' doesn't work without virtual console. + call assert_fails('set termguicolors', 'E954:') + return + endif + + " Basic test that setting 'termguicolors' works with one color. + set termguicolors + redraw + set t_Co=1 + redraw + set t_Co=0 + redraw +endfunc diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim new file mode 100644 index 0000000000..ca31e3f06c --- /dev/null +++ b/src/testdir/test_history.vim @@ -0,0 +1,106 @@ +" Tests for the history functions + +if !has('cmdline_hist') + finish +endif + +set history=7 + +function History_Tests(hist) + " First clear the history + call histadd(a:hist, 'dummy') + call assert_true(histdel(a:hist)) + call assert_equal(-1, histnr(a:hist)) + call assert_equal('', histget(a:hist)) + + call assert_true(histadd(a:hist, 'ls')) + call assert_true(histadd(a:hist, 'buffers')) + call assert_equal('buffers', histget(a:hist)) + call assert_equal('ls', histget(a:hist, -2)) + call assert_equal('ls', histget(a:hist, 1)) + call assert_equal('', histget(a:hist, 5)) + call assert_equal('', histget(a:hist, -5)) + call assert_equal(2, histnr(a:hist)) + call assert_true(histdel(a:hist, 2)) + call assert_false(histdel(a:hist, 7)) + call assert_equal(1, histnr(a:hist)) + call assert_equal('ls', histget(a:hist, -1)) + + call assert_true(histadd(a:hist, 'buffers')) + call assert_true(histadd(a:hist, 'ls')) + call assert_equal('ls', histget(a:hist, -1)) + call assert_equal(4, histnr(a:hist)) + + let a=execute('history ' . a:hist) + call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) + let a=execute('history all') + call assert_match("^\n # .* history\n 3 buffers\n> 4 ls", a) + + if len(a:hist) > 0 + let a=execute('history ' . a:hist . ' 2') + call assert_match("^\n # \\S* history$", a) + let a=execute('history ' . a:hist . ' 3') + call assert_match("^\n # \\S* history\n 3 buffers$", a) + let a=execute('history ' . a:hist . ' 4') + call assert_match("^\n # \\S* history\n> 4 ls$", a) + let a=execute('history ' . a:hist . ' 3,4') + call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) + let a=execute('history ' . a:hist . ' -1') + call assert_match("^\n # \\S* history\n> 4 ls$", a) + let a=execute('history ' . a:hist . ' -2') + call assert_match("^\n # \\S* history\n 3 buffers$", a) + let a=execute('history ' . a:hist . ' -2,') + call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) + let a=execute('history ' . a:hist . ' -3') + call assert_match("^\n # \\S* history$", a) + endif + + " Test for removing entries matching a pattern + for i in range(1, 3) + call histadd(a:hist, 'text_' . i) + endfor + call assert_true(histdel(a:hist, 'text_\d\+')) + call assert_equal('ls', histget(a:hist, -1)) + + " Test for freeing the entire history list + for i in range(1, 7) + call histadd(a:hist, 'text_' . i) + endfor + call histdel(a:hist) + for i in range(1, 7) + call assert_equal('', histget(a:hist, i)) + call assert_equal('', histget(a:hist, i - 7 - 1)) + endfor +endfunction + +function Test_History() + for h in ['cmd', ':', '', 'search', '/', '?', 'expr', '=', 'input', '@', 'debug', '>'] + call History_Tests(h) + endfor + + " Negative tests + call assert_false(histdel('abc')) + call assert_equal('', histget('abc')) + call assert_fails('call histdel([])', 'E730:') + call assert_equal('', histget(10)) + call assert_fails('call histget([])', 'E730:') + call assert_equal(-1, histnr('abc')) + call assert_fails('call histnr([])', 'E730:') +endfunction + +function Test_Search_history_window() + new + call setline(1, ['a', 'b', 'a', 'b']) + 1 + call feedkeys("/a\<CR>", 'xt') + call assert_equal('a', getline('.')) + 1 + call feedkeys("/b\<CR>", 'xt') + call assert_equal('b', getline('.')) + 1 + " select the previous /a command + call feedkeys("q/kk\<CR>", 'x!') + call assert_equal('a', getline('.')) + call assert_equal('a', @/) + bwipe! +endfunc diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim new file mode 100644 index 0000000000..db7a937da3 --- /dev/null +++ b/src/testdir/test_hlsearch.vim @@ -0,0 +1,53 @@ +" Test for v:hlsearch + +function! Test_hlsearch() + new + call setline(1, repeat(['aaa'], 10)) + set hlsearch nolazyredraw + let r=[] + " redraw is needed to make hlsearch highlight the matches + exe "normal! /aaa\<CR>" | redraw + let r1 = screenattr(1, 1) + nohlsearch | redraw + call assert_notequal(r1, screenattr(1,1)) + let v:hlsearch=1 | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + set hlsearch | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + exe "normal! n" | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + exe "normal! /\<CR>" | redraw + call assert_equal(r1, screenattr(1,1)) + set nohls + exe "normal! /\<CR>" | redraw + call assert_notequal(r1, screenattr(1,1)) + call assert_fails('let v:hlsearch=[]', 'E745') + call garbagecollect(1) + call getchar(1) + enew! +endfunction + +func Test_hlsearch_hangs() + if !has('reltime') || !has('float') + return + endif + + " This pattern takes a long time to match, it should timeout. + new + call setline(1, ['aaa', repeat('abc ', 1000), 'ccc']) + let start = reltime() + set hlsearch nolazyredraw redrawtime=101 + let @/ = '\%#=1a*.*X\@<=b*' + redraw + let elapsed = reltimefloat(reltime(start)) + call assert_true(elapsed > 0.1) + call assert_true(elapsed < 1.0) + set nohlsearch redrawtime& + bwipe! +endfunc diff --git a/src/testdir/test_iminsert.vim b/src/testdir/test_iminsert.vim new file mode 100644 index 0000000000..142aec0bac --- /dev/null +++ b/src/testdir/test_iminsert.vim @@ -0,0 +1,31 @@ +if !has('multi_byte') + finish +endif + +source view_util.vim + +let s:imactivatefunc_called = 0 +let s:imstatusfunc_called = 0 + +func IM_activatefunc(active) + let s:imactivatefunc_called = 1 +endfunc + +func IM_statusfunc() + let s:imstatusfunc_called = 1 + return 0 +endfunc + +func Test_iminsert2() + set imactivatefunc=IM_activatefunc + set imstatusfunc=IM_statusfunc + set iminsert=2 + normal! i + set iminsert=0 + set imactivatefunc= + set imstatusfunc= + + let expected = has('gui_running') ? 0 : 1 + call assert_equal(expected, s:imactivatefunc_called) + call assert_equal(expected, s:imstatusfunc_called) +endfunc diff --git a/src/testdir/test_increment.vim b/src/testdir/test_increment.vim new file mode 100644 index 0000000000..ad355dce9b --- /dev/null +++ b/src/testdir/test_increment.vim @@ -0,0 +1,781 @@ +" Tests for using Ctrl-A/Ctrl-X on visual selections + +func SetUp() + new dummy + set nrformats&vim +endfunc + +func TearDown() + bwipe! +endfunc + +" 1) Ctrl-A on visually selected number +" Text: +" foobar-10 +" Expected: +" 1) Ctrl-A on start of line: +" foobar-9 +" 2) Ctrl-A on visually selected "-10": +" foobar-9 +" 3) Ctrl-A on visually selected "10": +" foobar-11 +" 4) Ctrl-X on visually selected "-10" +" foobar-11 +" 5) Ctrl-X on visually selected "10" +" foobar-9 +func Test_visual_increment_01() + call setline(1, repeat(["foobaar-10"], 5)) + + call cursor(1, 1) + exec "norm! \<C-A>" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 1, 9, 0], getpos('.')) + + call cursor(2, 1) + exec "norm! f-v$\<C-A>" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 2, 8, 0], getpos('.')) + + call cursor(3, 1) + exec "norm! f1v$\<C-A>" + call assert_equal("foobaar-11", getline('.')) + call assert_equal([0, 3, 9, 0], getpos('.')) + + call cursor(4, 1) + exec "norm! f-v$\<C-X>" + call assert_equal("foobaar-11", getline('.')) + call assert_equal([0, 4, 8, 0], getpos('.')) + + call cursor(5, 1) + exec "norm! f1v$\<C-X>" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 5, 9, 0], getpos('.')) +endfunc + +" 2) Ctrl-A on visually selected lines +" Text: +" 10 +" 20 +" 30 +" 40 +" +" Expected: +" 1) Ctrl-A on visually selected lines: +" 11 +" 21 +" 31 +" 41 +" +" 2) Ctrl-X on visually selected lines: +" 9 +" 19 +" 29 +" 39 +func Test_visual_increment_02() + call setline(1, ["10", "20", "30", "40"]) + exec "norm! GV3k$\<C-A>" + call assert_equal(["11", "21", "31", "41"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["10", "20", "30", "40"]) + exec "norm! GV3k$\<C-X>" + call assert_equal(["9", "19", "29", "39"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 3) g Ctrl-A on visually selected lines, with non-numbers in between +" Text: +" 10 +" +" 20 +" +" 30 +" +" 40 +" +" Expected: +" 1) 2 g Ctrl-A on visually selected lines: +" 12 +" +" 24 +" +" 36 +" +" 48 +" 2) 2 g Ctrl-X on visually selected lines +" 8 +" +" 16 +" +" 24 +" +" 32 +func Test_visual_increment_03() + call setline(1, ["10", "", "20", "", "30", "", "40"]) + exec "norm! GV6k2g\<C-A>" + call assert_equal(["12", "", "24", "", "36", "", "48"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["10", "", "20", "", "30", "", "40"]) + exec "norm! GV6k2g\<C-X>" + call assert_equal(["8", "", "16", "", "24", "", "32"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 4) Ctrl-A on non-number +" Text: +" foobar-10 +" Expected: +" 1) visually select foobar: +" foobar-10 +func Test_visual_increment_04() + call setline(1, ["foobar-10"]) + exec "norm! vf-\<C-A>" + call assert_equal(["foobar-10"], getline(1, '$')) + " NOTE: I think this is correct behavior... + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 5) g<Ctrl-A> on letter +" Test: +" a +" a +" a +" a +" Expected: +" 1) g Ctrl-A on visually selected lines +" b +" c +" d +" e +func Test_visual_increment_05() + set nrformats+=alpha + call setline(1, repeat(["a"], 4)) + exec "norm! GV3kg\<C-A>" + call assert_equal(["b", "c", "d", "e"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 6) g<Ctrl-A> on letter +" Test: +" z +" z +" z +" z +" Expected: +" 1) g Ctrl-X on visually selected lines +" y +" x +" w +" v +func Test_visual_increment_06() + set nrformats+=alpha + call setline(1, repeat(["z"], 4)) + exec "norm! GV3kg\<C-X>" + call assert_equal(["y", "x", "w", "v"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 7) <Ctrl-A> on letter +" Test: +" 2 +" 1 +" 0 +" -1 +" -2 +" +" Expected: +" 1) Ctrl-A on visually selected lines +" 3 +" 2 +" 1 +" 0 +" -1 +" +" 2) Ctrl-X on visually selected lines +" 1 +" 0 +" -1 +" -2 +" -3 +func Test_visual_increment_07() + call setline(1, ["2", "1", "0", "-1", "-2"]) + exec "norm! GV4k\<C-A>" + call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["2", "1", "0", "-1", "-2"]) + exec "norm! GV4k\<C-X>" + call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 8) Block increment on 0x9 +" Text: +" 0x9 +" 0x9 +" Expected: +" 1) Ctrl-A on visually block selected region (cursor at beginning): +" 0xa +" 0xa +" 2) Ctrl-A on visually block selected region (cursor at end) +" 0xa +" 0xa +func Test_visual_increment_08() + call setline(1, repeat(["0x9"], 2)) + exec "norm! \<C-V>j$\<C-A>" + call assert_equal(["0xa", "0xa"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, repeat(["0x9"], 2)) + exec "norm! gg$\<C-V>+\<C-A>" + call assert_equal(["0xa", "0xa"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 9) Increment and redo +" Text: +" 2 +" 2 +" +" 3 +" 3 +" +" Expected: +" 1) 2 Ctrl-A on first 2 visually selected lines +" 4 +" 4 +" 2) redo (.) on 3 +" 5 +" 5 +func Test_visual_increment_09() + call setline(1, ["2", "2", "", "3", "3", ""]) + exec "norm! ggVj2\<C-A>" + call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! 3j." + call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$')) + call assert_equal([0, 4, 1, 0], getpos('.')) +endfunc + +" 10) sequentially decrement 1 +" Text: +" 1 +" 1 +" 1 +" 1 +" Expected: +" 1) g Ctrl-X on visually selected lines +" 0 +" -1 +" -2 +" -3 +func Test_visual_increment_10() + call setline(1, repeat(["1"], 4)) + exec "norm! GV3kg\<C-X>" + call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 11) visually block selected indented lines +" Text: +" 1 +" 1 +" 1 +" 1 +" Expexted: +" 1) g Ctrl-A on block selected indented lines +" 2 +" 1 +" 3 +" 4 +func Test_visual_increment_11() + call setline(1, [" 1", "1", " 1", " 1"]) + exec "norm! f1\<C-V>3jg\<C-A>" + call assert_equal([" 2", "1", " 3", " 4"], getline(1, '$')) + call assert_equal([0, 1, 5, 0], getpos('.')) +endfunc + +" 12) visually selected several columns +" Text: +" 0 0 +" 0 0 +" 0 0 +" Expected: +" 1) 'v' select last zero and first zeroes +" 0 1 +" 1 0 +" 1 0 +func Test_visual_increment_12() + call setline(1, repeat(["0 0"], 3)) + exec "norm! $v++\<C-A>" + call assert_equal(["0 1", "1 0", "1 0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" 13) visually selected part of columns +" Text: +" max: 100px +" max: 200px +" max: 300px +" max: 400px +" Expected: +" 1) 'v' on first two numbers Ctrl-A +" max: 110px +" max: 220px +" max: 330px +" max: 400px +" 2) 'v' on first two numbers Ctrl-X +" max: 90px +" max: 190px +" max: 290px +" max: 400px +func Test_visual_increment_13() + call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) + exec "norm! f1\<C-V>l2j\<C-A>" + call assert_equal(["max: 110px", "max: 210px", "max: 310px", "max: 400px"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) + + call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) + exec "norm! ggf1\<C-V>l2j\<C-X>" + call assert_equal(["max: 90px", "max: 190px", "max: 290px", "max: 400px"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) +endfunc + +" 14) redo in block mode +" Text: +" 1 1 +" 1 1 +" Expected: +" 1) Ctrl-a on first column, redo on second column +" 2 2 +" 2 2 +func Test_visual_increment_14() + call setline(1, repeat(["1 1"], 2)) + exec "norm! G\<C-V>k\<C-A>w." + call assert_equal(["2 2", "2 2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" 15) block select single numbers +" Text: +" 101 +" Expected: +" 1) Ctrl-a on visually selected zero +" 111 +" +" Also: 019 with "01" selected increments to "029". +func Test_visual_increment_15() + call setline(1, ["101"]) + exec "norm! lv\<C-A>" + call assert_equal(["111"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) + + call setline(1, ["019"]) + exec "norm! 0vl\<C-A>" + call assert_equal("029", getline(1)) + + call setline(1, ["01239"]) + exec "norm! 0vlll\<C-A>" + call assert_equal("01249", getline(1)) + + call setline(1, ["01299"]) + exec "norm! 0vlll\<C-A>" + call assert_equal("1309", getline(1)) +endfunc + +" 16) increment right aligned numbers +" Text: +" 1 +" 19 +" 119 +" Expected: +" 1) Ctrl-a on line selected region +" 2 +" 20 +" 120 +func Test_visual_increment_16() + call setline(1, [" 1", " 19", " 119"]) + exec "norm! VG\<C-A>" + call assert_equal([" 2", " 20", " 120"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 17) block-wise increment and redo +" Text: +" 100 +" 1 +" +" 100 +" 1 +" +" Expected: +" 1) Ctrl-V j $ on first block, afterwards '.' on second +" 101 +" 2 +" +" 101 +" 2 +func Test_visual_increment_17() + call setline(1, [" 100", " 1", "", " 100", " 1"]) + exec "norm! \<C-V>j$\<C-A>2j." + call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$')) + call assert_equal([0, 3, 1, 0], getpos('.')) +endfunc + +" 18) repeat of g<Ctrl-a> +" Text: +" 0 +" 0 +" 0 +" 0 +" +" Expected: +" 1) V 4j g<ctrl-a>, repeat twice afterwards with . +" 3 +" 6 +" 9 +" 12 +func Test_visual_increment_18() + call setline(1, repeat(["0"], 4)) + exec "norm! GV3kg\<C-A>" + exec "norm! .." + call assert_equal(["3", "6", "9", "12"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 19) increment on number with nrformat including alpha +" Text: +" 1 +" 1a +" +" Expected: +" 1) <Ctrl-V>j$ <ctrl-a> +" 2 +" 2a +func Test_visual_increment_19() + set nrformats+=alpha + call setline(1, ["1", "1a"]) + exec "norm! \<C-V>G$\<C-A>" + call assert_equal(["2", "2a"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 20) increment a single letter +" Text: +" a +" +" Expected: +" 1) <Ctrl-a> and cursor is on a +" b +func Test_visual_increment_20() + set nrformats+=alpha + call setline(1, ["a"]) + exec "norm! \<C-A>" + call assert_equal(["b"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 21) block-wise increment on part of hexadecimal +" Text: +" 0x123456 +" +" Expected: +" 1) Ctrl-V f3 <ctrl-a> +" 0x124456 +func Test_visual_increment_21() + call setline(1, ["0x123456"]) + exec "norm! \<C-V>f3\<C-A>" + call assert_equal(["0x124456"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 22) Block increment on 0b0 +" Text: +" 0b1 +" 0b1 +" Expected: +" 1) Ctrl-A on visually block selected region (cursor at beginning): +" 0b10 +" 0b10 +" 2) Ctrl-A on visually block selected region (cursor at end) +" 0b10 +" 0b10 +func Test_visual_increment_22() + call setline(1, repeat(["0b1"], 2)) + exec "norm! \<C-V>j$\<C-A>" + call assert_equal(repeat(["0b10"], 2), getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, repeat(["0b1"], 2)) + exec "norm! $\<C-V>+\<C-A>" + call assert_equal(repeat(["0b10"], 2), getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 23) block-wise increment on part of binary +" Text: +" 0b1001 +" +" Expected: +" 1) Ctrl-V 5l <ctrl-a> +" 0b1011 +func Test_visual_increment_23() + call setline(1, ["0b1001"]) + exec "norm! \<C-V>4l\<C-A>" + call assert_equal(["0b1011"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 24) increment hexadecimal +" Text: +" 0x0b1001 +" +" Expected: +" 1) <ctrl-a> +" 0x0b1002 +func Test_visual_increment_24() + call setline(1, ["0x0b1001"]) + exec "norm! \<C-V>$\<C-A>" + call assert_equal(["0x0b1002"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 25) increment binary with nrformats including alpha +" Text: +" 0b1001a +" +" Expected: +" 1) <ctrl-a> +" 0b1010a +func Test_visual_increment_25() + set nrformats+=alpha + call setline(1, ["0b1001a"]) + exec "norm! \<C-V>$\<C-A>" + call assert_equal(["0b1010a"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 26) increment binary with 32 bits +" Text: +" 0b11111111111111111111111111111110 +" +" Expected: +" 1) <ctrl-a> +" 0b11111111111111111111111111111111 +func Test_visual_increment_26() + set nrformats+=alpha + call setline(1, ["0b11111111111111111111111111111110"]) + exec "norm! \<C-V>$\<C-A>" + call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + set nrformats-=alpha +endfunc + +" 27) increment with 'rightreft', if supported +func Test_visual_increment_27() + if exists('+rightleft') + set rightleft + call setline(1, ["1234 56"]) + + exec "norm! $\<C-A>" + call assert_equal(["1234 57"], getline(1, '$')) + call assert_equal([0, 1, 7, 0], getpos('.')) + + exec "norm! \<C-A>" + call assert_equal(["1234 58"], getline(1, '$')) + call assert_equal([0, 1, 7, 0], getpos('.')) + set norightleft + endif +endfunc + +" Tab code and linewise-visual inc/dec +func Test_visual_increment_28() + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! Vj\<C-A>" + call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! ggVj\<C-X>" + call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and linewise-visual inc/dec with 'nrformats'+=alpha +func Test_visual_increment_29() + set nrformats+=alpha + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! Vj\<C-A>" + call assert_equal(["y\<TAB>10", "\<TAB>0"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! ggVj\<C-X>" + call assert_equal(["w\<TAB>10", "\<TAB>-2"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and character-visual inc/dec +func Test_visual_increment_30() + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! f1vjf1\<C-A>" + call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) + + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! ggf1vjf1\<C-X>" + call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual inc/dec +func Test_visual_increment_31() + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! f1\<C-V>jl\<C-A>" + call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) + + call setline(1, ["x\<TAB>10", "\<TAB>-1"]) + exec "norm! ggf1\<C-V>jl\<C-X>" + call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak' +func Test_visual_increment_32() + 28vnew dummy_31 + set linebreak showbreak=+ + call setline(1, ["x\<TAB>\<TAB>\<TAB>10", "\<TAB>\<TAB>\<TAB>\<TAB>-1"]) + exec "norm! ggf0\<C-V>jg_\<C-X>" + call assert_equal(["x\<TAB>\<TAB>\<TAB>1-1", "\<TAB>\<TAB>\<TAB>\<TAB>-2"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) + bwipe! +endfunc + +" Tab code and blockwise-visual increment with $ +func Test_visual_increment_33() + call setline(1, ["\<TAB>123", "456"]) + exec "norm! gg0\<C-V>j$\<C-A>" + call assert_equal(["\<TAB>124", "457"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual increment and redo +func Test_visual_increment_34() + call setline(1, ["\<TAB>123", " 456789"]) + exec "norm! gg0\<C-V>j\<C-A>" + call assert_equal(["\<TAB>123", " 457789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! .." + call assert_equal(["\<TAB>123", " 459789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code, spaces and character-visual increment and redo +func Test_visual_increment_35() + call setline(1, ["\<TAB>123", " 123", "\<TAB>123", "\<TAB>123"]) + exec "norm! ggvjf3\<C-A>..." + call assert_equal(["\<TAB>127", " 127", "\<TAB>123", "\<TAB>123"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) +endfunc + +" Tab code, spaces and blockwise-visual increment and redo +func Test_visual_increment_36() + call setline(1, [" 123", "\<TAB>456789"]) + exec "norm! G0\<C-V>kl\<C-A>" + call assert_equal([" 123", "\<TAB>556789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! ..." + call assert_equal([" 123", "\<TAB>856789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" block-wise increment and dot-repeat +" Text: +" 1 23 +" 4 56 +" +" Expected: +" 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with . +" 1 26 +" 4 59 +" +" Try with and without indent. +func Test_visual_increment_37() + call setline(1, [" 1 23", " 4 56"]) + exec "norm! ggf2\<C-V>jl\<C-A>.." + call assert_equal([" 1 26", " 4 59"], getline(1, 2)) + + call setline(1, ["1 23", "4 56"]) + exec "norm! ggf2\<C-V>jl\<C-A>.." + call assert_equal(["1 26", "4 59"], getline(1, 2)) +endfunc + +" Check redo after the normal mode increment +func Test_visual_increment_38() + exec "norm! i10\<ESC>5\<C-A>." + call assert_equal(["20"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) +endfunc + +" Test what patch 7.3.414 fixed. Ctrl-A on "000" drops the leading zeros. +func Test_normal_increment_01() + call setline(1, "000") + exec "norm! gg0\<C-A>" + call assert_equal("001", getline(1)) + + call setline(1, "000") + exec "norm! gg$\<C-A>" + call assert_equal("001", getline(1)) + + call setline(1, "001") + exec "norm! gg0\<C-A>" + call assert_equal("002", getline(1)) + + call setline(1, "001") + exec "norm! gg$\<C-A>" + call assert_equal("002", getline(1)) +endfunc + +" Test a regression of patch 7.4.1087 fixed. +func Test_normal_increment_02() + call setline(1, ["hello 10", "world"]) + exec "norm! ggl\<C-A>jx" + call assert_equal(["hello 11", "worl"], getline(1, '$')) + call assert_equal([0, 2, 4, 0], getpos('.')) +endfunc + +" The test35 unified to this file. +func Test_normal_increment_03() + call setline(1, ["100 0x100 077 0", + \ "100 0x100 077 ", + \ "100 0x100 077 0xfF 0xFf", + \ "100 0x100 077 "]) + set nrformats=octal,hex + exec "norm! gg\<C-A>102\<C-X>\<C-A>l\<C-X>l\<C-A>64\<C-A>128\<C-X>$\<C-X>" + set nrformats=octal + exec "norm! j0\<C-A>102\<C-X>\<C-A>l\<C-X>2\<C-A>w65\<C-A>129\<C-X>blx6lD" + set nrformats=hex + exec "norm! j0101\<C-X>l257\<C-X>\<C-A>Txldt \<C-A> \<C-X> \<C-X>" + set nrformats= + exec "norm! j0200\<C-X>l100\<C-X>w78\<C-X>\<C-A>k" + call assert_equal(["0 0x0ff 0000 -1", + \ "0 1x100 0777777", + \ "-1 0x0 078 0xFE 0xfe", + \ "-100 -100x100 000 "], getline(1, '$')) + call assert_equal([0, 3, 25, 0], getpos('.')) +endfunc + +func Test_increment_empty_line() + new + call setline(1, ['0', '0', '0', '0', '0', '0', '']) + exe "normal Gvgg\<C-A>" + call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7)) + bwipe! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_increment_dbcs.vim b/src/testdir/test_increment_dbcs.vim new file mode 100644 index 0000000000..dea405c633 --- /dev/null +++ b/src/testdir/test_increment_dbcs.vim @@ -0,0 +1,30 @@ +" Tests for using Ctrl-A/Ctrl-X using DBCS. +if !has('multi_byte') + finish +endif +set encoding=cp932 +scriptencoding cp932 + +func SetUp() + new + set nrformats& +endfunc + +func TearDown() + bwipe! +endfunc + +func Test_increment_dbcs_1() + set nrformats+=alpha + call setline(1, ["R1"]) + exec "norm! 0\<C-A>" + call assert_equal(["R2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) + + call setline(1, ["`ab0xDEe"]) + exec "norm! 0\<C-X>" + call assert_equal(["`ab0xDDe"], getline(1, '$')) + call assert_equal([0, 1, 10, 0], getpos('.')) +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim new file mode 100644 index 0000000000..2cd29b5757 --- /dev/null +++ b/src/testdir/test_ins_complete.vim @@ -0,0 +1,274 @@ + +" Test for insert expansion +func Test_ins_complete() + edit test_ins_complete.vim + " The files in the current directory interferes with the files + " used by this test. So use a separate directory for the test. + call mkdir('Xdir') + cd Xdir + + set ff=unix + call writefile(["test11\t36Gepeto\t/Tag/", + \ "asd\ttest11file\t36G", + \ "Makefile\tto\trun"], 'Xtestfile') + call writefile(['', 'start of testfile', + \ 'ru', + \ 'run1', + \ 'run2', + \ 'STARTTEST', + \ 'ENDTEST', + \ 'end of testfile'], 'Xtestdata') + set ff& + + enew! + edit Xtestdata + new + call append(0, ['#include "Xtestfile"', '']) + call cursor(2, 1) + + set cot= + set cpt=.,w + " add-expands (word from next line) from other window + exe "normal iru\<C-N>\<C-N>\<C-X>\<C-N>\<Esc>\<C-A>" + call assert_equal('run1 run3', getline('.')) + " add-expands (current buffer first) + exe "normal o\<C-P>\<C-X>\<C-N>" + call assert_equal('run3 run3', getline('.')) + " Local expansion, ends in an empty line (unless it becomes a global + " expansion) + exe "normal o\<C-X>\<C-P>\<C-P>\<C-P>\<C-P>\<C-P>" + call assert_equal('', getline('.')) + " starts Local and switches to global add-expansion + exe "normal o\<C-X>\<C-P>\<C-P>\<C-X>\<C-X>\<C-N>\<C-X>\<C-N>\<C-N>" + call assert_equal('run1 run2', getline('.')) + + set cpt=.,w,i + " i-add-expands and switches to local + exe "normal OM\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-X>\<C-X>\<C-P>" + call assert_equal("Makefile\tto\trun3", getline('.')) + " add-expands lines (it would end in an empty line if it didn't ignored + " itself) + exe "normal o\<C-X>\<C-L>\<C-X>\<C-L>\<C-P>\<C-P>" + call assert_equal("Makefile\tto\trun3", getline('.')) + call assert_equal("Makefile\tto\trun3", getline(line('.') - 1)) + + set cpt=kXtestfile + " checks k-expansion, and file expansion (use Xtest11 instead of test11, + " because TEST11.OUT may match first on DOS) + write Xtest11.one + write Xtest11.two + exe "normal o\<C-N>\<Esc>IX\<Esc>A\<C-X>\<C-F>\<C-N>" + call assert_equal('Xtest11.two', getline('.')) + + " use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use CTRL-X + " CTRL-F again to verify this doesn't cause trouble. + exe "normal oXt\<C-X>\<C-F>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<C-X>\<C-F>" + call assert_equal('Xtest11.one', getline('.')) + normal ddk + + set cpt=w + " checks make_cyclic in other window + exe "normal oST\<C-N>\<C-P>\<C-P>\<C-P>\<C-P>" + call assert_equal('STARTTEST', getline('.')) + + set cpt=u nohid + " checks unloaded buffer expansion + only + exe "normal oEN\<C-N>" + call assert_equal('ENDTEST', getline('.')) + " checks adding mode abortion + exe "normal ounl\<C-N>\<C-X>\<C-X>\<C-P>" + call assert_equal('unless', getline('.')) + + set cpt=t,d def=^\\k* tags=Xtestfile notagbsearch + " tag expansion, define add-expansion interrupted + exe "normal o\<C-X>\<C-]>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>" + call assert_equal('test11file 36Gepeto /Tag/ asd', getline('.')) + " t-expansion + exe "normal oa\<C-N>\<Esc>" + call assert_equal('asd', getline('.')) + + %bw! + call delete('Xtestfile') + call delete('Xtest11.one') + call delete('Xtest11.two') + call delete('Xtestdata') + set cpt& cot& def& tags& tagbsearch& hidden& + cd .. + call delete('Xdir', 'rf') +endfunc + +func Test_omni_dash() + func Omni(findstart, base) + if a:findstart + return 5 + else + echom a:base + return ['-help', '-v'] + endif + endfunc + set omnifunc=Omni + new + exe "normal Gofind -\<C-x>\<C-o>" + call assert_equal("\n-\nmatch 1 of 2", execute(':2mess')) + + bwipe! + delfunc Omni + set omnifunc= +endfunc + +func Test_completefunc_args() + let s:args = [] + func! CompleteFunc(findstart, base) + let s:args += [[a:findstart, empty(a:base)]] + endfunc + new + + set completefunc=CompleteFunc + call feedkeys("i\<C-X>\<C-U>\<Esc>", 'x') + call assert_equal([1, 1], s:args[0]) + call assert_equal(0, s:args[1][0]) + set completefunc= + + let s:args = [] + set omnifunc=CompleteFunc + call feedkeys("i\<C-X>\<C-O>\<Esc>", 'x') + call assert_equal([1, 1], s:args[0]) + call assert_equal(0, s:args[1][0]) + set omnifunc= + + bwipe! + unlet s:args + delfunc CompleteFunc +endfunc + +function! s:CompleteDone_CompleteFuncDict( findstart, base ) + if a:findstart + return 0 + endif + + return { + \ 'words': [ + \ { + \ 'word': 'aword', + \ 'abbr': 'wrd', + \ 'menu': 'extra text', + \ 'info': 'words are cool', + \ 'kind': 'W', + \ 'user_data': 'test' + \ } + \ ] + \ } +endfunction + +function! s:CompleteDone_CheckCompletedItemDict() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) + call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) + call assert_equal( 'words are cool', v:completed_item[ 'info' ] ) + call assert_equal( 'W', v:completed_item[ 'kind' ] ) + call assert_equal( 'test', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneDict() + au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict() + + set completefunc=<SID>CompleteDone_CompleteFuncDict + execute "normal a\<C-X>\<C-U>\<C-Y>" + set completefunc& + + call assert_equal( 'test', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) + if a:findstart + return 0 + endif + + return { + \ 'words': [ + \ { + \ 'word': 'aword', + \ 'abbr': 'wrd', + \ 'menu': 'extra text', + \ 'info': 'words are cool', + \ 'kind': 'W' + \ } + \ ] + \ } +endfunction + +function! s:CompleteDone_CheckCompletedItemDictNoUserData() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) + call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) + call assert_equal( 'words are cool', v:completed_item[ 'info' ] ) + call assert_equal( 'W', v:completed_item[ 'kind' ] ) + call assert_equal( '', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneDictNoUserData() + au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDictNoUserData() + + set completefunc=<SID>CompleteDone_CompleteFuncDictNoUserData + execute "normal a\<C-X>\<C-U>\<C-Y>" + set completefunc& + + call assert_equal( '', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +function! s:CompleteDone_CompleteFuncList( findstart, base ) + if a:findstart + return 0 + endif + + return [ 'aword' ] +endfunction + +function! s:CompleteDone_CheckCompletedItemList() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( '', v:completed_item[ 'abbr' ] ) + call assert_equal( '', v:completed_item[ 'menu' ] ) + call assert_equal( '', v:completed_item[ 'info' ] ) + call assert_equal( '', v:completed_item[ 'kind' ] ) + call assert_equal( '', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneList() + au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemList() + + set completefunc=<SID>CompleteDone_CompleteFuncList + execute "normal a\<C-X>\<C-U>\<C-Y>" + set completefunc& + + call assert_equal( '', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +" Check that when using feedkeys() typeahead does not interrupt searching for +" completions. +func Test_compl_feedkeys() + new + set completeopt=menuone,noselect + call feedkeys("ajump ju\<C-X>\<C-N>\<C-P>\<ESC>", "tx") + call assert_equal("jump jump", getline(1)) + bwipe! + set completeopt& +endfunc diff --git a/src/testdir/test_job_fails.vim b/src/testdir/test_job_fails.vim new file mode 100644 index 0000000000..affcb7d0f7 --- /dev/null +++ b/src/testdir/test_job_fails.vim @@ -0,0 +1,16 @@ +" This test is in a separate file, because it usually causes reports for memory +" leaks under valgrind. That is because when fork/exec fails memory is not +" freed. Since the process exists right away it's not a real leak. + +source shared.vim + +func Test_job_start_fails() + if has('job') + let job = job_start('axdfxsdf') + if has('unix') + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + else + call WaitForAssert({-> assert_equal("fail", job_status(job))}) + endif + endif +endfunc diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim new file mode 100644 index 0000000000..1c97414164 --- /dev/null +++ b/src/testdir/test_join.vim @@ -0,0 +1,35 @@ +" Test for joining lines. + +func Test_join_with_count() + new + call setline(1, ['one', 'two', 'three', 'four']) + normal J + call assert_equal('one two', getline(1)) + %del + call setline(1, ['one', 'two', 'three', 'four']) + normal 10J + call assert_equal('one two three four', getline(1)) + quit! +endfunc + +" Tests for setting the '[,'] marks when joining lines. +func Test_join_marks() + enew + call append(0, [ + \ "\t\tO sodales, ludite, vos qui", + \ "attamen consulite per voster honur. Tua pulchra " . + \ "facies me fay planszer milies", + \ "", + \ "This line.", + \ "Should be joined with the next line", + \ "and with this line"]) + + normal gg0gqj + call assert_equal([0, 1, 1, 0], getpos("'[")) + call assert_equal([0, 2, 1, 0], getpos("']")) + + /^This line/;'}-join + call assert_equal([0, 4, 11, 0], getpos("'[")) + call assert_equal([0, 4, 67, 0], getpos("']")) + enew! +endfunc diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim new file mode 100644 index 0000000000..396651e6be --- /dev/null +++ b/src/testdir/test_json.vim @@ -0,0 +1,299 @@ +" Test for JSON functions. + +" JSON requires using utf-8, because conversion breaks the asserts. +if !has('multi_byte') + finish +endif + +let s:json1 = '"str\"in\\g"' +let s:var1 = "str\"in\\g" +let s:json2 = '"\u0001\u0002\u0003\u0004\u0005\u0006\u0007"' +let s:var2 = "\x01\x02\x03\x04\x05\x06\x07" +let s:json3 = '"\b\t\n\u000b\f\r\u000e\u000f"' +let s:var3 = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" +let s:json4 = '"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"' +let s:var4 = "\x10\x11\x12\x13\x14\x15\x16\x17" +let s:json5 = '"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"' +let s:var5 = "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" + +" surrogate pair +let s:jsonsp1 = '"\ud83c\udf63"' +let s:varsp1 = "\xf0\x9f\x8d\xa3" +let s:jsonsp2 = '"\ud83c\u00a0"' +let s:varsp2 = "\ud83c\u00a0" + +let s:jsonmb = '"s¢cĴgё"' +let s:varmb = "s¢cĴgё" +let s:jsonnr = '1234' +let s:varnr = 1234 +if has('float') + let s:jsonfl = '12.34' + let s:varfl = 12.34 + let s:jsoninf = 'Infinity' + let s:varinf = 1.0 / 0.0 + let s:jsonnan = 'NaN' + let s:varnan = 0.0 / 0.0 +endif + +let s:jsonl1 = '[1,"a",3]' +let s:varl1 = [1, "a", 3] +let s:jsonl2 = '[1,["a",[],"c"],3]' +let s:jsonl2s = " [\r1 , [ \"a\" , [ ] , \"c\" ] , 3\<Tab>]\r\n" +let s:varl2 = [1, 2, 3] +let l2 = ['a', s:varl2, 'c'] +let s:varl2[1] = l2 +let s:varl2x = [1, ["a", [], "c"], 3] +let s:jsonl3 = '[[1,2],[1,2]]' +let l3 = [1, 2] +let s:varl3 = [l3, l3] + +let s:jsond1 = '{"a":1,"b":"bee","c":[1,2]}' +let s:jsd1 = '{a:1,b:"bee",c:[1,2]}' +let s:vard1 = {"a": 1, "b": "bee","c": [1,2]} +let s:jsond2 = '{"1":1,"2":{"a":"aa","b":{},"c":"cc"},"3":3}' +let s:jsd2 = '{"1":1,"2":{a:"aa",b:{},c:"cc"},"3":3}' +let s:jsond2s = " { \"1\" : 1 , \"2\" :\n{ \"a\"\r: \"aa\" , \"b\" : {\<Tab>} , \"c\" : \"cc\" } , \"3\" : 3 }\r\n" +let s:jsd2s = " { \"1\" : 1 , \"2\" :\n{ a\r: \"aa\" , b : {\<Tab>} , c : \"cc\" } , \"3\" : 3 }\r\n" +let s:vard2 = {"1": 1, "2": 2, "3": 3} +let d2 = {"a": "aa", "b": s:vard2, "c": "cc"} +let s:vard2["2"] = d2 +let s:vard2x = {"1": 1, "2": {"a": "aa", "b": {}, "c": "cc"}, "3": 3} +let d3 = {"a": 1, "b": 2} +let s:vard3 = {"x": d3, "y": d3} +let s:jsond3 = '{"x":{"a":1,"b":2},"y":{"a":1,"b":2}}' +let s:jsd3 = '{x:{a:1,b:2},y:{a:1,b:2}}' +let s:vard4 = {"key": v:none} +let s:vard4x = {"key": v:null} +let s:jsond4 = '{"key":null}' +let s:jsd4 = '{key:null}' + +let s:jsonvals = '[true,false,null,null]' +let s:varvals = [v:true, v:false, v:null, v:null] + +func Test_json_encode() + call assert_equal(s:json1, json_encode(s:var1)) + call assert_equal(s:json2, json_encode(s:var2)) + call assert_equal(s:json3, json_encode(s:var3)) + call assert_equal(s:json4, json_encode(s:var4)) + call assert_equal(s:json5, json_encode(s:var5)) + + if has('multi_byte') + call assert_equal(s:jsonmb, json_encode(s:varmb)) + " no test for surrogate pair, json_encode() doesn't create them. + endif + + call assert_equal(s:jsonnr, json_encode(s:varnr)) + if has('float') + call assert_equal(s:jsonfl, json_encode(s:varfl)) + call assert_equal(s:jsoninf, json_encode(s:varinf)) + call assert_equal(s:jsonnan, json_encode(s:varnan)) + endif + + call assert_equal(s:jsonl1, json_encode(s:varl1)) + call assert_equal(s:jsonl2, json_encode(s:varl2)) + call assert_equal(s:jsonl3, json_encode(s:varl3)) + + call assert_equal(s:jsond1, json_encode(s:vard1)) + call assert_equal(s:jsond2, json_encode(s:vard2)) + call assert_equal(s:jsond3, json_encode(s:vard3)) + call assert_equal(s:jsond4, json_encode(s:vard4)) + + call assert_equal(s:jsonvals, json_encode(s:varvals)) + + call assert_fails('echo json_encode(function("tr"))', 'E474:') + call assert_fails('echo json_encode([function("tr")])', 'E474:') + + call assert_equal('{"a":""}', json_encode({'a': test_null_string()})) + call assert_equal('{"a":[]}', json_encode({"a": test_null_list()})) + call assert_equal('{"a":{}}', json_encode({"a": test_null_dict()})) + + silent! let res = json_encode(function("tr")) + call assert_equal("", res) +endfunc + +func Test_json_decode() + call assert_equal(s:var1, json_decode(s:json1)) + call assert_equal(s:var2, json_decode(s:json2)) + call assert_equal(s:var3, json_decode(s:json3)) + call assert_equal(s:var4, json_decode(s:json4)) + call assert_equal(s:var5, json_decode(s:json5)) + + if has('multi_byte') + call assert_equal(s:varmb, json_decode(s:jsonmb)) + call assert_equal(s:varsp1, json_decode(s:jsonsp1)) + call assert_equal(s:varsp2, json_decode(s:jsonsp2)) + endif + + call assert_equal(s:varnr, json_decode(s:jsonnr)) + if has('float') + call assert_equal(s:varfl, json_decode(s:jsonfl)) + endif + + call assert_equal(s:varl1, json_decode(s:jsonl1)) + call assert_equal(s:varl2x, json_decode(s:jsonl2)) + call assert_equal(s:varl2x, json_decode(s:jsonl2s)) + call assert_equal(s:varl3, json_decode(s:jsonl3)) + + call assert_equal(s:vard1, json_decode(s:jsond1)) + call assert_equal(s:vard2x, json_decode(s:jsond2)) + call assert_equal(s:vard2x, json_decode(s:jsond2s)) + call assert_equal(s:vard3, json_decode(s:jsond3)) + call assert_equal(s:vard4x, json_decode(s:jsond4)) + + call assert_equal(s:varvals, json_decode(s:jsonvals)) + + call assert_equal(v:true, json_decode('true')) + call assert_equal(type(v:true), type(json_decode('true'))) + call assert_equal(v:none, json_decode('')) + call assert_equal(type(v:none), type(json_decode(''))) + call assert_equal("", json_decode('""')) + + " empty key is OK + call assert_equal({'': 'ok'}, json_decode('{"": "ok"}')) + " but not twice + call assert_fails("call json_decode('{\"\": \"ok\", \"\": \"bad\"}')", 'E938:') + + call assert_equal({'n': 1}, json_decode('{"n":1,}')) + call assert_fails("call json_decode(\"{'n':'1',}\")", 'E474:') + call assert_fails("call json_decode(\"'n'\")", 'E474:') + + call assert_fails('call json_decode("\"")', "E474:") + call assert_fails('call json_decode("blah")', "E474:") + call assert_fails('call json_decode("true blah")', "E488:") + call assert_fails('call json_decode("<foobar>")', "E474:") + call assert_fails('call json_decode("{\"a\":1,\"a\":2}")', "E938:") + + call assert_fails('call json_decode("{")', "E474:") + call assert_fails('call json_decode("{foobar}")', "E474:") + call assert_fails('call json_decode("{\"n\",")', "E474:") + call assert_fails('call json_decode("{\"n\":")', "E474:") + call assert_fails('call json_decode("{\"n\":1")', "E474:") + call assert_fails('call json_decode("{\"n\":1,")', "E474:") + call assert_fails('call json_decode("{\"n\",1}")', "E474:") + call assert_fails('call json_decode("{-}")', "E474:") + + call assert_fails('call json_decode("[foobar]")', "E474:") + call assert_fails('call json_decode("[")', "E474:") + call assert_fails('call json_decode("[1")', "E474:") + call assert_fails('call json_decode("[1,")', "E474:") + call assert_fails('call json_decode("[1 2]")', "E474:") + + call assert_fails('call json_decode("[1,,2]")', "E474:") + + call assert_fails('call json_decode("{{}:42}")', "E474:") + call assert_fails('call json_decode("{[]:42}")', "E474:") +endfunc + +let s:jsl5 = '[7,,,]' +let s:varl5 = [7, v:none, v:none] + +func Test_js_encode() + call assert_equal(s:json1, js_encode(s:var1)) + call assert_equal(s:json2, js_encode(s:var2)) + call assert_equal(s:json3, js_encode(s:var3)) + call assert_equal(s:json4, js_encode(s:var4)) + call assert_equal(s:json5, js_encode(s:var5)) + + if has('multi_byte') + call assert_equal(s:jsonmb, js_encode(s:varmb)) + " no test for surrogate pair, js_encode() doesn't create them. + endif + + call assert_equal(s:jsonnr, js_encode(s:varnr)) + if has('float') + call assert_equal(s:jsonfl, js_encode(s:varfl)) + call assert_equal(s:jsoninf, js_encode(s:varinf)) + call assert_equal(s:jsonnan, js_encode(s:varnan)) + endif + + call assert_equal(s:jsonl1, js_encode(s:varl1)) + call assert_equal(s:jsonl2, js_encode(s:varl2)) + call assert_equal(s:jsonl3, js_encode(s:varl3)) + + call assert_equal(s:jsd1, js_encode(s:vard1)) + call assert_equal(s:jsd2, js_encode(s:vard2)) + call assert_equal(s:jsd3, js_encode(s:vard3)) + call assert_equal(s:jsd4, js_encode(s:vard4)) + + call assert_equal(s:jsonvals, js_encode(s:varvals)) + + call assert_fails('echo js_encode(function("tr"))', 'E474:') + call assert_fails('echo js_encode([function("tr")])', 'E474:') + + silent! let res = js_encode(function("tr")) + call assert_equal("", res) + + call assert_equal(s:jsl5, js_encode(s:varl5)) +endfunc + +func Test_js_decode() + call assert_equal(s:var1, js_decode(s:json1)) + call assert_equal(s:var2, js_decode(s:json2)) + call assert_equal(s:var3, js_decode(s:json3)) + call assert_equal(s:var4, js_decode(s:json4)) + call assert_equal(s:var5, js_decode(s:json5)) + + if has('multi_byte') + call assert_equal(s:varmb, js_decode(s:jsonmb)) + call assert_equal(s:varsp1, js_decode(s:jsonsp1)) + call assert_equal(s:varsp2, js_decode(s:jsonsp2)) + endif + + call assert_equal(s:varnr, js_decode(s:jsonnr)) + if has('float') + call assert_equal(s:varfl, js_decode(s:jsonfl)) + call assert_equal(s:varinf, js_decode(s:jsoninf)) + call assert_true(isnan(js_decode(s:jsonnan))) + endif + + call assert_equal(s:varl1, js_decode(s:jsonl1)) + call assert_equal(s:varl2x, js_decode(s:jsonl2)) + call assert_equal(s:varl2x, js_decode(s:jsonl2s)) + call assert_equal(s:varl3, js_decode(s:jsonl3)) + + call assert_equal(s:vard1, js_decode(s:jsond1)) + call assert_equal(s:vard1, js_decode(s:jsd1)) + call assert_equal(s:vard2x, js_decode(s:jsond2)) + call assert_equal(s:vard2x, js_decode(s:jsd2)) + call assert_equal(s:vard2x, js_decode(s:jsond2s)) + call assert_equal(s:vard2x, js_decode(s:jsd2s)) + call assert_equal(s:vard3, js_decode(s:jsond3)) + call assert_equal(s:vard3, js_decode(s:jsd3)) + call assert_equal(s:vard4x, js_decode(s:jsond4)) + call assert_equal(s:vard4x, js_decode(s:jsd4)) + + call assert_equal(s:varvals, js_decode(s:jsonvals)) + + call assert_equal(v:true, js_decode('true')) + call assert_equal(type(v:true), type(js_decode('true'))) + call assert_equal(v:none, js_decode('')) + call assert_equal(type(v:none), type(js_decode(''))) + call assert_equal("", js_decode('""')) + call assert_equal("", js_decode("''")) + + call assert_equal('n', js_decode("'n'")) + call assert_equal({'n': 1}, js_decode('{"n":1,}')) + call assert_equal({'n': '1'}, js_decode("{'n':'1',}")) + + call assert_fails('call js_decode("\"")', "E474:") + call assert_fails('call js_decode("blah")', "E474:") + call assert_fails('call js_decode("true blah")', "E474:") + call assert_fails('call js_decode("<foobar>")', "E474:") + + call assert_fails('call js_decode("{")', "E474:") + call assert_fails('call js_decode("{foobar}")', "E474:") + call assert_fails('call js_decode("{\"n\",")', "E474:") + call assert_fails('call js_decode("{\"n\":")', "E474:") + call assert_fails('call js_decode("{\"n\":1")', "E474:") + call assert_fails('call js_decode("{\"n\":1,")', "E474:") + call assert_fails('call js_decode("{\"n\",1}")', "E474:") + call assert_fails('call js_decode("{-}")', "E474:") + + call assert_fails('call js_decode("[foobar]")', "E474:") + call assert_fails('call js_decode("[")', "E474:") + call assert_fails('call js_decode("[1")', "E474:") + call assert_fails('call js_decode("[1,")', "E474:") + call assert_fails('call js_decode("[1 2]")', "E474:") + + call assert_equal(s:varl5, js_decode(s:jsl5)) +endfunc diff --git a/src/testdir/test_jumplist.vim b/src/testdir/test_jumplist.vim new file mode 100644 index 0000000000..02dbd76194 --- /dev/null +++ b/src/testdir/test_jumplist.vim @@ -0,0 +1,62 @@ +" Tests for the jumplist functionality + +" Tests for the getjumplist() function +func Test_getjumplist() + if !has("jumplist") + return + endif + + %bwipe + clearjumps + call assert_equal([[], 0], getjumplist()) + call assert_equal([[], 0], getjumplist(1)) + call assert_equal([[], 0], getjumplist(1, 1)) + + call assert_equal([], getjumplist(100)) + call assert_equal([], getjumplist(1, 100)) + + let lines = [] + for i in range(1, 100) + call add(lines, "Line " . i) + endfor + call writefile(lines, "Xtest") + + " Jump around and create a jump list + edit Xtest + let bnr = bufnr('%') + normal 50% + normal G + normal gg + + call assert_equal([[ + \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4], + \ getjumplist()) + + " Traverse the jump list and verify the results + 5 + exe "normal \<C-O>" + call assert_equal(2, getjumplist(1)[1]) + exe "normal 2\<C-O>" + call assert_equal(0, getjumplist(1, 1)[1]) + exe "normal 3\<C-I>" + call assert_equal(3, getjumplist()[1]) + exe "normal \<C-O>" + normal 20% + call assert_equal([[ + \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 5], + \ getjumplist()) + + let l = getjumplist() + call test_garbagecollect_now() + call assert_equal(4, l[1]) + clearjumps + call test_garbagecollect_now() + call assert_equal(4, l[1]) + + call delete("Xtest") +endfunc diff --git a/src/testdir/test_jumps.vim b/src/testdir/test_jumps.vim new file mode 100644 index 0000000000..5a3717d165 --- /dev/null +++ b/src/testdir/test_jumps.vim @@ -0,0 +1,11 @@ +func Test_empty_buffer() + new + insert +a +b +c +d +. + call assert_equal(1, line("''")) + bwipe! +endfunc diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim new file mode 100644 index 0000000000..a9ee52a844 --- /dev/null +++ b/src/testdir/test_lambda.vim @@ -0,0 +1,292 @@ +" Test for lambda and closure + +function! Test_lambda_feature() + call assert_equal(1, has('lambda')) +endfunction + +function! Test_lambda_with_filter() + let s:x = 2 + call assert_equal([2, 3], filter([1, 2, 3], {i, v -> v >= s:x})) +endfunction + +function! Test_lambda_with_map() + let s:x = 1 + call assert_equal([2, 3, 4], map([1, 2, 3], {i, v -> v + s:x})) +endfunction + +function! Test_lambda_with_sort() + call assert_equal([1, 2, 3, 4, 7], sort([3,7,2,1,4], {a, b -> a - b})) +endfunction + +function! Test_lambda_with_timer() + if !has('timers') + return + endif + + let s:n = 0 + let s:timer_id = 0 + function! s:Foo() + "let n = 0 + let s:timer_id = timer_start(50, {-> execute("let s:n += 1 | echo s:n", "")}, {"repeat": -1}) + endfunction + + call s:Foo() + sleep 200ms + " do not collect lambda + call test_garbagecollect_now() + let m = s:n + sleep 200ms + call timer_stop(s:timer_id) + call assert_true(m > 1) + call assert_true(s:n > m + 1) + call assert_true(s:n < 10) +endfunction + +function! Test_lambda_with_partial() + let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two']) + call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three')) +endfunction + +function Test_lambda_fails() + call assert_equal(3, {a, b -> a + b}(1, 2)) + call assert_fails('echo {a, a -> a + a}(1, 2)', 'E15:') + call assert_fails('echo {a, b -> a + b)}(1, 2)', 'E15:') +endfunc + +func Test_not_lamda() + let x = {'>' : 'foo'} + call assert_equal('foo', x['>']) +endfunc + +function! Test_lambda_capture_by_reference() + let v = 1 + let l:F = {x -> x + v} + let v = 2 + call assert_equal(12, l:F(10)) +endfunction + +function! Test_lambda_side_effect() + function! s:update_and_return(arr) + let a:arr[1] = 5 + return a:arr + endfunction + + function! s:foo(arr) + return {-> s:update_and_return(a:arr)} + endfunction + + let arr = [3,2,1] + call assert_equal([3, 5, 1], s:foo(arr)()) +endfunction + +function! Test_lambda_refer_local_variable_from_other_scope() + function! s:foo(X) + return a:X() " refer l:x in s:bar() + endfunction + + function! s:bar() + let x = 123 + return s:foo({-> x}) + endfunction + + call assert_equal(123, s:bar()) +endfunction + +function! Test_lambda_do_not_share_local_variable() + function! s:define_funcs() + let l:One = {-> split(execute("let a = 'abc' | echo a"))[0]} + let l:Two = {-> exists("a") ? a : "no"} + return [l:One, l:Two] + endfunction + + let l:F = s:define_funcs() + + call assert_equal('no', l:F[1]()) + call assert_equal('abc', l:F[0]()) + call assert_equal('no', l:F[1]()) +endfunction + +function! Test_lambda_closure_counter() + function! s:foo() + let x = 0 + return {-> [execute("let x += 1"), x][-1]} + endfunction + + let l:F = s:foo() + call test_garbagecollect_now() + call assert_equal(1, l:F()) + call assert_equal(2, l:F()) + call assert_equal(3, l:F()) + call assert_equal(4, l:F()) +endfunction + +function! Test_lambda_with_a_var() + function! s:foo() + let x = 2 + return {... -> a:000 + [x]} + endfunction + function! s:bar() + return s:foo()(1) + endfunction + + call assert_equal([1, 2], s:bar()) +endfunction + +function! Test_lambda_call_lambda_from_lambda() + function! s:foo(x) + let l:F1 = {-> {-> a:x}} + return {-> l:F1()} + endfunction + + let l:F = s:foo(1) + call assert_equal(1, l:F()()) +endfunction + +function! Test_lambda_delfunc() + function! s:gen() + let pl = l: + let l:Foo = {-> get(pl, "Foo", get(pl, "Bar", {-> 0}))} + let l:Bar = l:Foo + delfunction l:Foo + return l:Bar + endfunction + + let l:F = s:gen() + call assert_fails(':call l:F()', 'E933:') +endfunction + +function! Test_lambda_scope() + function! s:NewCounter() + let c = 0 + return {-> [execute('let c += 1'), c][-1]} + endfunction + + function! s:NewCounter2() + return {-> [execute('let c += 100'), c][-1]} + endfunction + + let l:C = s:NewCounter() + let l:D = s:NewCounter2() + + call assert_equal(1, l:C()) + call assert_fails(':call l:D()', 'E15:') " E121: then E15: + call assert_equal(2, l:C()) +endfunction + +function! Test_lambda_share_scope() + function! s:New() + let c = 0 + let l:Inc0 = {-> [execute('let c += 1'), c][-1]} + let l:Dec0 = {-> [execute('let c -= 1'), c][-1]} + return [l:Inc0, l:Dec0] + endfunction + + let [l:Inc, l:Dec] = s:New() + + call assert_equal(1, l:Inc()) + call assert_equal(2, l:Inc()) + call assert_equal(1, l:Dec()) +endfunction + +function! Test_lambda_circular_reference() + function! s:Foo() + let d = {} + let d.f = {-> d} + return d.f + endfunction + + call s:Foo() + call test_garbagecollect_now() + let i = 0 | while i < 10000 | call s:Foo() | let i+= 1 | endwhile + call test_garbagecollect_now() +endfunction + +function! Test_lambda_combination() + call assert_equal(2, {x -> {x -> x}}(1)(2)) + call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z})) + call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0)) + call assert_equal(6, {x -> {y -> {z -> x + y + z}}}(1)(2)(3)) + + call assert_equal(6, {x -> {f -> f(x)}}(3)({x -> x * 2})) + call assert_equal(6, {f -> {x -> f(x)}}({x -> x * 2})(3)) + + " Z combinator + let Z = {f -> {x -> f({y -> x(x)(y)})}({x -> f({y -> x(x)(y)})})} + let Fact = {f -> {x -> x == 0 ? 1 : x * f(x - 1)}} + call assert_equal(120, Z(Fact)(5)) +endfunction + +function! Test_closure_counter() + function! s:foo() + let x = 0 + function! s:bar() closure + let x += 1 + return x + endfunction + return function('s:bar') + endfunction + + let l:F = s:foo() + call test_garbagecollect_now() + call assert_equal(1, l:F()) + call assert_equal(2, l:F()) + call assert_equal(3, l:F()) + call assert_equal(4, l:F()) +endfunction + +function! Test_closure_unlet() + function! s:foo() + let x = 1 + function! s:bar() closure + unlet x + endfunction + call s:bar() + return l: + endfunction + + call assert_false(has_key(s:foo(), 'x')) + call test_garbagecollect_now() +endfunction + +function! LambdaFoo() + let x = 0 + function! LambdaBar() closure + let x += 1 + return x + endfunction + return function('LambdaBar') +endfunction + +func Test_closure_refcount() + let g:Count = LambdaFoo() + call test_garbagecollect_now() + call assert_equal(1, g:Count()) + let g:Count2 = LambdaFoo() + call test_garbagecollect_now() + call assert_equal(1, g:Count2()) + call assert_equal(2, g:Count()) + call assert_equal(3, g:Count2()) + + delfunc LambdaFoo + delfunc LambdaBar +endfunc + +func Test_named_function_closure() + func! Afoo() + let x = 14 + func! s:Abar() closure + return x + endfunc + call assert_equal(14, s:Abar()) + endfunc + call Afoo() + call assert_equal(14, s:Abar()) + call test_garbagecollect_now() + call assert_equal(14, s:Abar()) +endfunc + +func Test_lambda_with_index() + let List = {x -> [x]} + let Extract = {-> function(List, ['foobar'])()[0]} + call assert_equal('foobar', Extract()) +endfunc diff --git a/src/testdir/test_langmap.vim b/src/testdir/test_langmap.vim new file mode 100644 index 0000000000..572fad78ba --- /dev/null +++ b/src/testdir/test_langmap.vim @@ -0,0 +1,28 @@ +" tests for 'langmap' + +if !has('langmap') + finish +endif + +func Test_langmap() + new + set langmap=}l,^x,%v + + call setline(1, ['abc']) + call feedkeys('gg0}^', 'tx') + call assert_equal('ac', getline(1)) + + " in Replace mode + " need silent! to avoid a delay when entering Insert mode + call setline(1, ['abcde']) + silent! call feedkeys("gg0lR%{z\<Esc>00", 'tx') + call assert_equal('a%{ze', getline(1)) + + " in Select mode + " need silent! to avoid a delay when entering Insert mode + call setline(1, ['abcde']) + silent! call feedkeys("gg0}%}\<C-G>}^\<Esc>00", 'tx') + call assert_equal('a}^de', getline(1)) + + quit! +endfunc diff --git a/src/testdir/test_largefile.vim b/src/testdir/test_largefile.vim new file mode 100644 index 0000000000..1b3e02a0c8 --- /dev/null +++ b/src/testdir/test_largefile.vim @@ -0,0 +1,34 @@ +" Tests for large files +" This is only executed manually: "make test_largefile". +" This is not run as part of "make test". + +func Test_largefile() + let fname = 'Xlarge.txt' + + call delete(fname) + exe "e" fname + " Make sure that a line break is 1 byte (LF). + set ff=unix + set undolevels=-1 + " Input 99 'A's. The line becomes 100 bytes including a line break. + exe "normal 99iA\<Esc>" + yank + " Put 39,999,999 times. The file becomes 4,000,000,000 bytes. + normal 39999999p + " Moving around in the file randomly. + normal G + normal 10% + normal 90% + normal 50% + normal gg + w + " Check if the file size is 4,000,000,000 bytes. + let fsize=getfsize(fname) + if has('num64') + call assert_true(fsize == 4000000000) + else + " getfsize() returns -2 if a Number is 32 bits. + call assert_true(fsize == -2) + endif + call delete(fname) +endfunc diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim new file mode 100644 index 0000000000..24c6ef5e01 --- /dev/null +++ b/src/testdir/test_let.vim @@ -0,0 +1,27 @@ +" Tests for the :let command. + +func Test_let() + " Test to not autoload when assigning. It causes internal error. + set runtimepath+=./sautest + let Test104#numvar = function('tr') + call assert_equal("function('tr')", string(Test104#numvar)) + + let a = 1 + let b = 2 + + let out = execute('let a b') + let s = "\na #1\nb #2" + call assert_equal(s, out) + + let out = execute('let {0 == 1 ? "a" : "b"}') + let s = "\nb #2" + call assert_equal(s, out) + + let out = execute('let {0 == 1 ? "a" : "b"} a') + let s = "\nb #2\na #1" + call assert_equal(s, out) + + let out = execute('let a {0 == 1 ? "a" : "b"}') + let s = "\na #1\nb #2" + call assert_equal(s, out) +endfunc diff --git a/src/testdir/test_lineending.vim b/src/testdir/test_lineending.vim new file mode 100644 index 0000000000..d531b74e6d --- /dev/null +++ b/src/testdir/test_lineending.vim @@ -0,0 +1,19 @@ +" Tests for saving/loading a file with some lines ending in +" CTRL-M, some not +func Test_lineending() + let l = ["this line ends in a\<CR>", + \ "this one doesn't", + \ "this one does\<CR>", + \ "and the last one doesn't"] + set ta tx + enew! + call append(0, l) + $delete + write Xfile1 + bwipe Xfile1 + edit Xfile1 + let t = getline(1, '$') + call assert_equal(l, t) + new | only + call delete('Xfile1') +endfunc diff --git a/src/testdir/test_lispwords.vim b/src/testdir/test_lispwords.vim new file mode 100644 index 0000000000..4c05504cf1 --- /dev/null +++ b/src/testdir/test_lispwords.vim @@ -0,0 +1,82 @@ +" Tests for 'lispwords' settings being global-local + +set nocompatible viminfo+=nviminfo + +func Test_global_local_lispwords() + setglobal lispwords=foo,bar,baz + setlocal lispwords-=foo | setlocal lispwords+=quux + call assert_equal('foo,bar,baz', &g:lispwords) + call assert_equal('bar,baz,quux', &l:lispwords) + call assert_equal('bar,baz,quux', &lispwords) + + setlocal lispwords< + call assert_equal('foo,bar,baz', &g:lispwords) + call assert_equal('foo,bar,baz', &l:lispwords) + call assert_equal('foo,bar,baz', &lispwords) +endfunc + +func Test_lisp_indent() + enew! + + call append(0, [ + \ '(defun html-file (base)', + \ '(format nil "~(~A~).html" base))', + \ '', + \ '(defmacro page (name title &rest body)', + \ '(let ((ti (gensym)))', + \ '`(with-open-file (*standard-output*', + \ '(html-file ,name)', + \ ':direction :output', + \ ':if-exists :supersede)', + \ '(let ((,ti ,title))', + \ '(as title ,ti)', + \ '(with center ', + \ '(as h2 (string-upcase ,ti)))', + \ '(brs 3)', + \ ',@body))))', + \ '', + \ ';;; Utilities for generating links', + \ '', + \ '(defmacro with-link (dest &rest body)', + \ '`(progn', + \ '(format t "<a href=\"~A\">" (html-file ,dest))', + \ ',@body', + \ '(princ "</a>")))' + \ ]) + set lisp + set lispwords& + let save_copt = &cpoptions + set cpoptions+=p + normal 1G=G + + call assert_equal([ + \ '(defun html-file (base)', + \ ' (format nil "~(~A~).html" base))', + \ '', + \ '(defmacro page (name title &rest body)', + \ ' (let ((ti (gensym)))', + \ ' `(with-open-file (*standard-output*', + \ ' (html-file ,name)', + \ ' :direction :output', + \ ' :if-exists :supersede)', + \ ' (let ((,ti ,title))', + \ ' (as title ,ti)', + \ ' (with center ', + \ ' (as h2 (string-upcase ,ti)))', + \ ' (brs 3)', + \ ' ,@body))))', + \ '', + \ ';;; Utilities for generating links', + \ '', + \ '(defmacro with-link (dest &rest body)', + \ ' `(progn', + \ ' (format t "<a href=\"~A\">" (html-file ,dest))', + \ ' ,@body', + \ ' (princ "</a>")))', + \ '' + \ ], getline(1, "$")) + + enew! + let &cpoptions=save_copt + set nolisp +endfunc diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim new file mode 100644 index 0000000000..57ea7ca5a9 --- /dev/null +++ b/src/testdir/test_listchars.vim @@ -0,0 +1,63 @@ +" Tests for 'listchars' display with 'list' and :list + +source view_util.vim + +func Test_listchars() + enew! + set ff=unix + set list + + set listchars+=tab:>-,space:.,trail:< + call append(0, [ + \ ' aa ', + \ ' bb ', + \ ' cccc ', + \ 'dd ee ', + \ ' ' + \ ]) + let expected = [ + \ '>-------aa>-----$', + \ '..bb>---<<$', + \ '...cccc><$', + \ 'dd........ee<<>-$', + \ '<$' + \ ] + redraw! + for i in range(1, 5) + call cursor(i, 1) + call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$'))) + endfor + + set listchars-=trail:< + let expected = [ + \ '>-------aa>-----$', + \ '..bb>---..$', + \ '...cccc>.$', + \ 'dd........ee..>-$', + \ '.$' + \ ] + redraw! + for i in range(1, 5) + call cursor(i, 1) + call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$'))) + endfor + + set listchars+=trail:< + set nolist + normal ggdG + call append(0, [ + \ ' fff ', + \ ' gg ', + \ ' h ', + \ 'iii ', + \ ]) + let l = split(execute("%list"), "\n") + call assert_equal([ + \ '..fff>--<<$', + \ '>-------gg>-----$', + \ '.....h>-$', + \ 'iii<<<<><<$', '$'], l) + + enew! + set listchars& ff& +endfunc diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim new file mode 100644 index 0000000000..023332c90a --- /dev/null +++ b/src/testdir/test_listdict.vim @@ -0,0 +1,603 @@ +" Tests for the List and Dict types + +func TearDown() + " Run garbage collection after every test + call test_garbagecollect_now() +endfunc + +" Tests for List type + +" List creation +func Test_list_create() + " Creating List directly with different types + let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] + call assert_equal("[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]", string(l)) + call assert_equal({'a' : 1}, l[-1]) + call assert_equal(1, l[-4]) + let x = 10 + try + let x = l[-5] + catch + call assert_match('E684:', v:exception) + endtry + call assert_equal(10, x) +endfunc + +" List slices +func Test_list_slice() + let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] + call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[:]) + call assert_equal(['as''d', [1, 2, function('strlen')], {'a': 1}], l[1:]) + call assert_equal([1, 'as''d', [1, 2, function('strlen')]], l[:-2]) + call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[0:8]) + call assert_equal([], l[8:-1]) +endfunc + +" List identity +func Test_list_identity() + let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] + let ll = l + let lx = copy(l) + call assert_true(l == ll) + call assert_false(l isnot ll) + call assert_true(l is ll) + call assert_true(l == lx) + call assert_false(l is lx) + call assert_true(l isnot lx) +endfunc + +" removing items with :unlet +func Test_list_unlet() + let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] + unlet l[2] + call assert_equal([1, 'as''d', {'a': 1}], l) + let l = range(8) + unlet l[:3] + unlet l[1:] + call assert_equal([4], l) + + " removing items out of range: silently skip items that don't exist + let l = [0, 1, 2, 3] + call assert_fails('unlet l[2:1]', 'E684') + let l = [0, 1, 2, 3] + unlet l[2:2] + call assert_equal([0, 1, 3], l) + let l = [0, 1, 2, 3] + unlet l[2:3] + call assert_equal([0, 1], l) + let l = [0, 1, 2, 3] + unlet l[2:4] + call assert_equal([0, 1], l) + let l = [0, 1, 2, 3] + unlet l[2:5] + call assert_equal([0, 1], l) + let l = [0, 1, 2, 3] + call assert_fails('unlet l[-1:2]', 'E684') + let l = [0, 1, 2, 3] + unlet l[-2:2] + call assert_equal([0, 1, 3], l) + let l = [0, 1, 2, 3] + unlet l[-3:2] + call assert_equal([0, 3], l) + let l = [0, 1, 2, 3] + unlet l[-4:2] + call assert_equal([3], l) + let l = [0, 1, 2, 3] + unlet l[-5:2] + call assert_equal([3], l) + let l = [0, 1, 2, 3] + unlet l[-6:2] + call assert_equal([3], l) +endfunc + +" assignment to a list +func Test_list_assign() + let l = [0, 1, 2, 3] + let [va, vb] = l[2:3] + call assert_equal([2, 3], [va, vb]) + call assert_fails('let [va, vb] = l', 'E687') + call assert_fails('let [va, vb] = l[1:1]', 'E688') +endfunc + +" test for range assign +func Test_list_range_assign() + let l = [0] + let l[:] = [1, 2] + call assert_equal([1, 2], l) +endfunc + +" Tests for Dictionary type + +func Test_dict() + " Creating Dictionary directly with different types + let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} + call assert_equal("{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}", string(d)) + call assert_equal('asd', d.1) + call assert_equal(['-1', '1', 'b'], sort(keys(d))) + call assert_equal(['asd', [1, 2, function('strlen')], {'a': 1}], values(d)) + let v = [] + for [key, val] in items(d) + call extend(v, [key, val]) + unlet key val + endfor + call assert_equal(['1','asd','b',[1, 2, function('strlen')],'-1',{'a': 1}], v) + + call extend(d, {3:33, 1:99}) + call extend(d, {'b':'bbb', 'c':'ccc'}, "keep") + call assert_fails("call extend(d, {3:333,4:444}, 'error')", 'E737') + call assert_equal({'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}}, d) + call filter(d, 'v:key =~ ''[ac391]''') + call assert_equal({'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}, d) +endfunc + +" Dictionary identity +func Test_dict_identity() + let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} + let dd = d + let dx = copy(d) + call assert_true(d == dd) + call assert_false(d isnot dd) + call assert_true(d is dd) + call assert_true(d == dx) + call assert_false(d is dx) + call assert_true(d isnot dx) +endfunc + +" removing items with :unlet +func Test_dict_unlet() + let d = {'b':'bbb', '1': 99, '3': 33, '-1': {'a': 1}} + unlet d.b + unlet d[-1] + call assert_equal({'1': 99, '3': 33}, d) +endfunc + +" manipulating a big Dictionary (hashtable.c has a border of 1000 entries) +func Test_dict_big() + let d = {} + for i in range(1500) + let d[i] = 3000 - i + endfor + call assert_equal([3000, 2900, 2001, 1600, 1501], [d[0], d[100], d[999], d[1400], d[1499]]) + let str = '' + try + let n = d[1500] + catch + let str=substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') + endtry + call assert_equal('Vim(let):E716: 1500', str) + + " lookup each items + for i in range(1500) + call assert_equal(3000 - i, d[i]) + endfor + let i += 1 + + " delete even items + while i >= 2 + let i -= 2 + unlet d[i] + endwhile + call assert_equal('NONE', get(d, 1500 - 100, 'NONE')) + call assert_equal(2999, d[1]) + + " delete odd items, checking value, one intentionally wrong + let d[33] = 999 + let i = 1 + while i < 1500 + if i != 33 + call assert_equal(3000 - i, d[i]) + else + call assert_equal(999, d[i]) + endif + unlet d[i] + let i += 2 + endwhile + call assert_equal({}, d) + unlet d +endfunc + +" Dictionary function +func Test_dict_func() + let d = {} + func d.func(a) dict + return a:a . len(self.data) + endfunc + let d.data = [1,2,3] + call assert_equal('len: 3', d.func('len: ')) + let x = d.func('again: ') + call assert_equal('again: 3', x) + let Fn = d.func + call assert_equal('xxx3', Fn('xxx')) +endfunc + +" Function in script-local List or Dict +func Test_script_local_dict_func() + let g:dict = {} + function g:dict.func() dict + return 'g:dict.func' . self.foo[1] . self.foo[0]('asdf') + endfunc + let g:dict.foo = ['-', 2, 3] + call insert(g:dict.foo, function('strlen')) + call assert_equal('g:dict.func-4', g:dict.func()) + unlet g:dict +endfunc + +" Nasty: remove func from Dict that's being called (works) +func Test_dict_func_remove_in_use() + let d = {1:1} + func d.func(a) + return "a:" . a:a + endfunc + let expected = 'a:' . string(get(d, 'func')) + call assert_equal(expected, d.func(string(remove(d, 'func')))) +endfunc + +" Nasty: deepcopy() dict that refers to itself (fails when noref used) +func Test_dict_deepcopy() + let d = {1:1, 2:2} + let l = [4, d, 6] + let d[3] = l + let dc = deepcopy(d) + call assert_fails('call deepcopy(d, 1)', 'E698') + let l2 = [0, l, l, 3] + let l[1] = l2 + let l3 = deepcopy(l2) + call assert_true(l3[1] is l3[2]) +endfunc + +" Locked variables +func Test_list_locked_var() + let expected = [ + \ [['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1000-000', 'ppppppF'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1100-100', 'ppFppFF'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1110-110', 'pFFpFFF'], + \ ['0010-010', 'pFppFpp'], + \ ['0000-000', 'ppppppp']], + \ [['1111-111', 'FFFFFFF'], + \ ['0011-011', 'FFpFFpp'], + \ ['0000-000', 'ppppppp']] + \ ] + for depth in range(5) + for u in range(3) + unlet! l + let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] + exe "lockvar " . depth . " l" + if u == 1 + exe "unlockvar l" + elseif u == 2 + exe "unlockvar " . depth . " l" + endif + let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]") + call assert_equal(expected[depth][u][0], ps) + let ps = '' + try + let l[1][1][0] = 99 + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l[1][1] = [99] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l[1] = [99] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l[2]['6'][7] = 99 + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l[2][6] = {99: 99} + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l[2] = {99: 99} + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + let l = [99] + let ps .= 'p' + catch + let ps .= 'F' + endtry + call assert_equal(expected[depth][u][1], ps) + endfor + endfor +endfunc + +" Unletting locked variables +func Test_list_locked_var_unlet() + let expected = [ + \ [['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1000-000', 'ppFppFp'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1100-100', 'pFFpFFp'], + \ ['0000-000', 'ppppppp'], + \ ['0000-000', 'ppppppp']], + \ [['1110-110', 'FFFFFFp'], + \ ['0010-010', 'FppFppp'], + \ ['0000-000', 'ppppppp']], + \ [['1111-111', 'FFFFFFp'], + \ ['0011-011', 'FppFppp'], + \ ['0000-000', 'ppppppp']] + \ ] + + for depth in range(5) + for u in range(3) + unlet! l + let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] + exe "lockvar " . depth . " l" + if u == 1 + exe "unlockvar l" + elseif u == 2 + exe "unlockvar " . depth . " l" + endif + let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]") + call assert_equal(expected[depth][u][0], ps) + let ps = '' + try + unlet l[2]['6'][7] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l[2][6] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l[2] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l[1][1][0] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l[1][1] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l[1] + let ps .= 'p' + catch + let ps .= 'F' + endtry + try + unlet l + let ps .= 'p' + catch + let ps .= 'F' + endtry + call assert_equal(expected[depth][u][1], ps) + endfor + endfor +endfunc + +" Locked variables and :unlet or list / dict functions + +" No :unlet after lock on dict: +func Test_dict_lock_unlet() + unlet! d + let d = {'a': 99, 'b': 100} + lockvar 1 d + call assert_fails('unlet d.a', 'E741') +endfunc + +" unlet after lock on dict item +func Test_dict_item_lock_unlet() + unlet! d + let d = {'a': 99, 'b': 100} + lockvar d.a + unlet d.a + call assert_equal({'b' : 100}, d) +endfunc + +" filter() after lock on dict item +func Test_dict_lock_filter() + unlet! d + let d = {'a': 99, 'b': 100} + lockvar d.a + call filter(d, 'v:key != "a"') + call assert_equal({'b' : 100}, d) +endfunc + +" map() after lock on dict +func Test_dict_lock_map() + unlet! d + let d = {'a': 99, 'b': 100} + lockvar 1 d + call map(d, 'v:val + 200') + call assert_equal({'a' : 299, 'b' : 300}, d) +endfunc + +" No extend() after lock on dict item +func Test_dict_lock_extend() + unlet! d + let d = {'a': 99, 'b': 100} + lockvar d.a + call assert_fails("call extend(d, {'a' : 123})", 'E741') + call assert_equal({'a': 99, 'b': 100}, d) +endfunc + +" No remove() of write-protected scope-level variable +func! Tfunc(this_is_a_long_parameter_name) + call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E795') +endfun +func Test_dict_scope_var_remove() + call Tfunc('testval') +endfunc + +" No extend() of write-protected scope-level variable +func! Tfunc(this_is_a_long_parameter_name) + call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742') +endfunc +func Test_dict_scope_var_extend() + call Tfunc('testval') +endfunc + +" No :unlet of variable in locked scope +func Test_lock_var_unlet() + let b:testvar = 123 + lockvar 1 b: + call assert_fails('unlet b:testvar', 'E741:') + unlockvar 1 b: + unlet! b:testvar +endfunc + +" No :let += of locked list variable +func Test_let_lock_list() + let l = ['a', 'b', 3] + lockvar 1 l + call assert_fails("let l += ['x']", 'E741:') + call assert_equal(['a', 'b', 3], l) + + unlet l + let l = [1, 2, 3, 4] + lockvar! l + call assert_equal([1, 2, 3, 4], l) + unlockvar l[1] + call assert_fails('unlet l[0:1]', 'E741:') + call assert_equal([1, 2, 3, 4], l) + call assert_fails('unlet l[1:2]', 'E741:') + call assert_equal([1, 2, 3, 4], l) + unlockvar l[1] + call assert_fails('let l[0:1] = [0, 1]', 'E741:') + call assert_equal([1, 2, 3, 4], l) + call assert_fails('let l[1:2] = [0, 1]', 'E741:') + call assert_equal([1, 2, 3, 4], l) + unlet l +endfunc + +" lockvar/islocked() triggering script autoloading +func Test_lockvar_script_autoload() + let old_rtp = &rtp + set rtp+=./sautest + lockvar g:footest#x + unlockvar g:footest#x + call assert_equal(-1, islocked('g:footest#x')) + call assert_equal(0, exists('g:footest#x')) + call assert_equal(1, g:footest#x) + let &rtp = old_rtp +endfunc + +" a:000 function argument test +func s:arg_list_test(...) + call assert_fails('let a:000 = [1, 2]', 'E46:') + call assert_fails('let a:000[0] = 9', 'E742:') + call assert_fails('let a:000[2] = [9, 10]', 'E742:') + call assert_fails('let a:000[3] = {9 : 10}', 'E742:') + + " now the tests that should pass + let a:000[2][1] = 9 + call extend(a:000[2], [5, 6]) + let a:000[3][5] = 8 + let a:000[3]['a'] = 12 + call assert_equal([1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}], a:000) +endfunc + +func Test_func_arg_list() + call s:arg_list_test(1, 2, [3, 4], {5: 6}) +endfunc + +" Tests for reverse(), sort(), uniq() +func Test_reverse_sort_uniq() + let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5] + call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l))) + call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(l)) + call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(reverse(l))) + call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(l)) + call assert_equal([[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'], reverse(sort(l))) + call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(reverse(sort(l)))) + call assert_equal(['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]], uniq(sort(l))) + + let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four'] + call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n')) + + let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] + call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 1)) + call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) + call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l))) +endfunc + +" splitting a string to a List +func Test_str_split() + call assert_equal(['aa', 'bb'], split(' aa bb ')) + call assert_equal(['aa', 'bb'], split(' aa bb ', '\W\+', 0)) + call assert_equal(['', 'aa', 'bb', ''], split(' aa bb ', '\W\+', 1)) + call assert_equal(['', '', 'aa', '', 'bb', '', ''], split(' aa bb ', '\W', 1)) + call assert_equal(['aa', '', 'bb'], split(':aa::bb:', ':', 0)) + call assert_equal(['', 'aa', '', 'bb', ''], split(':aa::bb:', ':', 1)) + call assert_equal(['aa', '', 'bb', 'cc', ''], split('aa,,bb, cc,', ',\s*', 1)) + call assert_equal(['a', 'b', 'c'], split('abc', '\zs')) + call assert_equal(['', 'a', '', 'b', '', 'c', ''], split('abc', '\zs', 1)) +endfunc + +" compare recursively linked list and dict +func Test_listdict_compare() + let l = [1, 2, 3, 4] + let d = {'1': 1, '2': l, '3': 3} + let l[1] = d + call assert_true(l == l) + call assert_true(d == d) + call assert_false(l != deepcopy(l)) + call assert_false(d != deepcopy(d)) +endfunc + + " compare complex recursively linked list and dict +func Test_listdict_compare_complex() + let l = [] + call add(l, l) + let dict4 = {"l": l} + call add(dict4.l, dict4) + let lcopy = deepcopy(l) + let dict4copy = deepcopy(dict4) + call assert_true(l == lcopy) + call assert_true(dict4 == dict4copy) +endfunc + +func Test_listdict_extend() + " Pass the same List to extend() + let l = [1, 2, 3, 4, 5] + call extend(l, l) + call assert_equal([1, 2, 3, 4, 5, 1, 2, 3, 4, 5], l) + + " Pass the same Dict to extend() + let d = { 'a': {'b': 'B'}} + call extend(d, d) + call assert_equal({'a': {'b': 'B'}}, d) + + " Pass the same Dict to extend() with "error" + call assert_fails("call extend(d, d, 'error')", 'E737:') + call assert_equal({'a': {'b': 'B'}}, d) +endfunc diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in deleted file mode 100644 index 0cce4c23a5..0000000000 --- a/src/testdir/test_listlbr.in +++ /dev/null @@ -1,52 +0,0 @@ -Test for linebreak and list option (non-utf8) - -STARTTEST -:so small.vim -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" -:norm! zt -:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap -:fu! ScreenChar(width) -: let c='' -: for j in range(1,4) -: for i in range(1,a:width) -: let c.=nr2char(screenchar(j, i)) -: endfor -: let c.="\n" -: endfor -: return c -:endfu -:fu! DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line -: wincmd p -:endfu -:let g:test="Test 1: set linebreak" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test="Test 2: set linebreak + set list" -:set linebreak list listchars= -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test ="Test 3: set linebreak nolist" -:set nolist linebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" -:set nolist linebreak ts=8 -:let line="1\t".repeat('a', winwidth(0)-2) -:$put =line -:$ -:norm! zt -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok deleted file mode 100644 index be323d4dc7..0000000000 --- a/src/testdir/test_listlbr.ok +++ /dev/null @@ -1,27 +0,0 @@ - - abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP - -Test 1: set linebreak - abcdef -+hijklmn -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP - -Test 2: set linebreak + set list -^Iabcdef hijklmn^I -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP - - -Test 3: set linebreak nolist - abcdef -+hijklmn -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP -1 aaaaaaaaaaaaaaaaaa - -Test 4: set linebreak with tab and 1 line as long as screen: should break! -1 -+aaaaaaaaaaaaaaaaaa -~ -~ diff --git a/src/testdir/test_listlbr.vim b/src/testdir/test_listlbr.vim new file mode 100644 index 0000000000..7856ee82ab --- /dev/null +++ b/src/testdir/test_listlbr.vim @@ -0,0 +1,235 @@ +" Test for linebreak and list option (non-utf8) + +set encoding=latin1 +scriptencoding latin1 + +if !exists("+linebreak") || !has("conceal") + finish +endif + +source view_util.vim + +function s:screen_lines(lnum, width) abort + return ScreenLines(a:lnum, a:width) +endfunction + +function! s:compare_lines(expect, actual) + call assert_equal(join(a:expect, "\n"), join(a:actual, "\n")) +endfunction + +function s:test_windows(...) + call NewWindow(10, 20) + setl ts=8 sw=4 sts=4 linebreak sbr= wrap + exe get(a:000, 0, '') +endfunction + +function s:close_windows(...) + call CloseWindow() + exe get(a:000, 0, '') +endfunction + +func Test_set_linebreak() + call s:test_windows('setl ts=4 sbr=+') + call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ") + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ " abcdef ", +\ "+hijklmn ", +\ "+pqrstuvwxyz_1060ABC", +\ "+DEFGHIJKLMNOP ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_linebreak_with_list() + call s:test_windows('setl ts=4 sbr=+ list listchars=') + call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ") + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "^Iabcdef hijklmn^I ", +\ "+pqrstuvwxyz_1060ABC", +\ "+DEFGHIJKLMNOP ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_linebreak_with_nolist() + call s:test_windows('setl ts=4 sbr=+ nolist') + call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ") + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ " abcdef ", +\ "+hijklmn ", +\ "+pqrstuvwxyz_1060ABC", +\ "+DEFGHIJKLMNOP ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_should_break() + call s:test_windows('setl sbr=+ nolist') + call setline(1, "1\t" . repeat('a', winwidth(0)-2)) + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "1 ", +\ "+aaaaaaaaaaaaaaaaaa ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_linebreak_with_conceal() + call s:test_windows('setl cpo&vim sbr=+ list conceallevel=2 concealcursor=nv listchars=tab:ab') + call setline(1, "_S_\t bla") + syn match ConcealVar contained /_/ conceal + syn match All /.*/ contains=ConcealVar + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "Sabbbbbb bla ", +\ "~ ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_virtual_block() + call s:test_windows('setl sbr=+') + call setline(1, [ +\ "REMOVE: this not", +\ "REMOVE: aaaaaaaaaaaaa", +\ ]) + exe "norm! 1/^REMOVE:" + exe "norm! 0\<C-V>jf x" + $put + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "this not ", +\ "aaaaaaaaaaaaa ", +\ "REMOVE: ", +\ "REMOVE: ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_virtual_block_and_vbA() + call s:test_windows() + call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end") + exe "norm! $3B\<C-v>eAx\<Esc>" + let lines = s:screen_lines([1, 10], winwidth(0)) + let expect = [ +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar foobar ", +\ "foobar TARGETx at ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_virtual_char_and_block() + call s:test_windows() + call setline(1, "1111-1111-1111-11-1111-1111-1111") + exe "norm! 0f-lv3lc2222\<Esc>bgj." + let lines = s:screen_lines([1, 2], winwidth(0)) + let expect = [ +\ "1111-2222-1111-11- ", +\ "1111-2222-1111 ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_undo_after_block_visual() + call s:test_windows() + call setline(1, ["aaa", "aaa", "a"]) + exe "norm! gg\<C-V>2j~e." + let lines = s:screen_lines([1, 3], winwidth(0)) + let expect = [ +\ "AaA ", +\ "AaA ", +\ "A ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_norm_after_block_visual() + call s:test_windows() + call setline(1, ["abcd{ef", "ghijklm", "no}pgrs"]) + exe "norm! ggf{\<C-V>\<C-V>c%" + let lines = s:screen_lines([1, 3], winwidth(0)) + let expect = [ +\ "abcdpgrs ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_block_replace_after_wrapping() + call s:test_windows() + call setline(1, repeat("a", 150)) + exe "norm! 0yypk147|\<C-V>jr0" + call assert_equal(repeat("a", 146) . "0aaa", getline(1)) + call assert_equal(repeat("a", 146) . "0aaa", getline(2)) + let lines = s:screen_lines([1, 10], winwidth(0)) + let expect = [ +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aaaaaa0aaa ", +\ "@ ", +\ "@ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_list_with_listchars() + call s:test_windows('setl list listchars=space:_,trail:-,tab:>-,eol:$') + call setline(1, "a aaaaaaaaaaaaaaaaaaaaaa\ta ") + let lines = s:screen_lines([1, 3], winwidth(0)) + let expect = [ +\ "a_ ", +\ "aaaaaaaaaaaaaaaaaaaa", +\ "aa>-----a-$ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_list_with_tab_and_skipping_first_chars() + call s:test_windows('setl list listchars=tab:>- ts=70 nowrap') + call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"]) + call cursor(4,64) + norm! 2zl + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "---------------aaaaa", +\ "---------------aaaaa", +\ "---------------aaaaa", +\ "iiiiiiiii>-----aaaaa", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfu diff --git a/src/testdir/test_listlbr_utf8.in b/src/testdir/test_listlbr_utf8.in deleted file mode 100644 index f8888d5332..0000000000 --- a/src/testdir/test_listlbr_utf8.in +++ /dev/null @@ -1,41 +0,0 @@ -Test for linebreak and list option in utf-8 mode - -STARTTEST -:so small.vim -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif -:so mbyte.vim -:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" -:norm! zt -:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap -:fu! ScreenChar(width) -: let c='' -: for j in range(1,4) -: for i in range(1,a:width) -: let c.=nr2char(screenchar(j, i)) -: endfor -: let c.="\n" -: endfor -: return c -:endfu -:fu! DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line -: wincmd p -:endfu -:let g:test ="Test 1: set linebreak + set list + fancy listchars" -:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test ="Test 2: set nolinebreak list" -:set list nolinebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/testdir/test_listlbr_utf8.ok b/src/testdir/test_listlbr_utf8.ok deleted file mode 100644 index 576ccfb401..0000000000 --- a/src/testdir/test_listlbr_utf8.ok +++ /dev/null @@ -1,14 +0,0 @@ - - abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP - -Test 1: set linebreak + set list + fancy listchars -▕———abcdef -+hijklmn▕——— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ - -Test 2: set nolinebreak list -▕———abcdef hijklmn▕— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ -¶ diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim new file mode 100644 index 0000000000..b648a3361b --- /dev/null +++ b/src/testdir/test_listlbr_utf8.vim @@ -0,0 +1,271 @@ +" Test for linebreak and list option in utf-8 mode + +set encoding=utf-8 +scriptencoding utf-8 + +if !exists("+linebreak") || !has("conceal") || !has("signs") + finish +endif + +source view_util.vim + +function s:screen_lines(lnum, width) abort + return ScreenLines(a:lnum, a:width) +endfunction + +function! s:compare_lines(expect, actual) + call assert_equal(a:expect, a:actual) +endfunction + +function s:screen_attr(lnum, chars, ...) abort + let line = getline(a:lnum) + let attr = [] + let prefix = get(a:000, 0, 0) + for i in range(a:chars[0], a:chars[1]) + let scol = strdisplaywidth(strcharpart(line, 0, i-1)) + 1 + let attr += [screenattr(a:lnum, scol + prefix)] + endfor + return attr +endfunction + +function s:test_windows(...) + call NewWindow(10, 20) + setl ts=4 sw=4 sts=4 linebreak sbr=+ wrap + exe get(a:000, 0, '') +endfunction + +function s:close_windows(...) + call CloseWindow() + exe get(a:000, 0, '') +endfunction + +func Test_linebreak_with_fancy_listchars() + call s:test_windows("setl list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6") + call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP ") + redraw! + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "▕———abcdef ", +\ "+hijklmn▕——— ", +\ "+pqrstuvwxyz␣1060ABC", +\ "+DEFGHIJKLMNOPˑ¶ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_nolinebreak_with_list() + call s:test_windows("setl nolinebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6") + call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP ") + redraw! + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ "▕———abcdef hijklmn▕—", +\ "+pqrstuvwxyz␣1060ABC", +\ "+DEFGHIJKLMNOPˑ¶ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_linebreak_with_nolist() + call s:test_windows('setl nolist') + call setline(1, "\t*mask = nil;") + redraw! + let lines = s:screen_lines([1, 4], winwidth(0)) + let expect = [ +\ " *mask = nil; ", +\ "~ ", +\ "~ ", +\ "~ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_list_and_concealing1() + call s:test_windows('setl list listchars=tab:>- cole=1') + call setline(1, [ +\ "#define ABCDE\t\t1", +\ "#define ABCDEF\t\t1", +\ "#define ABCDEFG\t\t1", +\ "#define ABCDEFGH\t1", +\ "#define MSG_MODE_FILE\t\t\t1", +\ "#define MSG_MODE_CONSOLE\t\t2", +\ "#define MSG_MODE_FILE_AND_CONSOLE\t3", +\ "#define MSG_MODE_FILE_THEN_CONSOLE\t4", +\ ]) + vert resize 40 + syn match Conceal conceal cchar=>'AB\|MSG_MODE' + redraw! + let lines = s:screen_lines([1, 7], winwidth(0)) + let expect = [ +\ "#define ABCDE>-->---1 ", +\ "#define >CDEF>-->---1 ", +\ "#define >CDEFG>->---1 ", +\ "#define >CDEFGH>----1 ", +\ "#define >_FILE>--------->--->---1 ", +\ "#define >_CONSOLE>---------->---2 ", +\ "#define >_FILE_AND_CONSOLE>---------3 ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_list_and_concealing2() + call s:test_windows('setl nowrap ts=2 list listchars=tab:>- cole=2 concealcursor=n') + call setline(1, "bbeeeeee\t\t;\tsome text") + vert resize 40 + syn clear + syn match meaning /;\s*\zs.*/ + syn match hasword /^\x\{8}/ contains=word + syn match word /\<\x\{8}\>/ contains=beginword,endword contained + syn match beginword /\<\x\x/ contained conceal + syn match endword /\x\{6}\>/ contained + hi meaning guibg=blue + hi beginword guibg=green + hi endword guibg=red + redraw! + let lines = s:screen_lines([1, 1], winwidth(0)) + let expect = [ +\ "eeeeee>--->-;>some text ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_screenattr_for_comment() + call s:test_windows("setl ft=c ts=7 list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6") + call setline(1, " /*\t\t and some more */") + norm! gg0 + syntax on + hi SpecialKey term=underline ctermfg=red guifg=red + redraw! + let line = getline(1) + let attr = s:screen_attr(1, [1, 6]) + call assert_notequal(attr[0], attr[1]) + call assert_notequal(attr[1], attr[3]) + call assert_notequal(attr[3], attr[5]) + call s:close_windows() +endfunc + +func Test_visual_block_and_selection_exclusive() + call s:test_windows('setl selection=exclusive') + call setline(1, "long line: " . repeat("foobar ", 40) . "TARGETÃ' at end") + exe "norm! $3B\<C-v>eAx\<Esc>" + let lines = s:screen_lines([1, 10], winwidth(0)) + let expect = [ +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar foobar ", +\ "+foobar TARGETÃx' ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_multibyte_sign_and_colorcolumn() + call s:test_windows("setl nolinebreak cc=3 list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6") + call setline(1, ["", "a b c", "a b c"]) + exe "sign define foo text=\uff0b" + exe "sign place 1 name=foo line=2 buffer=" . bufnr('%') + redraw! + norm! ggj0 + let signwidth = strdisplaywidth("\uff0b") + let attr1 = s:screen_attr(2, [1, 3], signwidth) + let attr2 = s:screen_attr(3, [1, 3], signwidth) + call assert_equal(attr1[0], attr2[0]) + call assert_equal(attr1[1], attr2[1]) + call assert_equal(attr1[2], attr2[2]) + let lines = s:screen_lines([1, 3], winwidth(0)) + let expect = [ +\ " ¶ ", +\ "+a b c¶ ", +\ " a b c¶ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_colorcolumn_priority() + call s:test_windows('setl cc=4 cuc hls') + call setline(1, ["xxyy", ""]) + norm! gg + exe "normal! /xxyy\<CR>" + norm! G + redraw! + let line_attr = s:screen_attr(1, [1, &cc]) + " Search wins over CursorColumn + call assert_equal(line_attr[1], line_attr[0]) + " Search wins over Colorcolumn + call assert_equal(line_attr[2], line_attr[3]) + call s:close_windows('setl hls&vim') +endfunc + +func Test_illegal_byte_and_breakat() + call s:test_windows("setl sbr= brk+=<") + vert resize 18 + call setline(1, repeat("\x80", 6)) + redraw! + let lines = s:screen_lines([1, 2], winwidth(0)) + let expect = [ +\ "<80><80><80><80><8", +\ "0><80> ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('setl brk&vim') +endfunc + +func Test_multibyte_wrap_and_breakat() + call s:test_windows("setl sbr= brk+=>") + call setline(1, repeat('a', 17) . repeat('あ', 2)) + redraw! + let lines = s:screen_lines([1, 2], winwidth(0)) + let expect = [ +\ "aaaaaaaaaaaaaaaaaあ>", +\ "あ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('setl brk&vim') +endfunc + +func Test_chinese_char_on_wrap_column() + call s:test_windows("setl nolbr wrap sbr=") + syntax off + call setline(1, [ +\ 'aaaaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaaaaa中'. +\ 'hello']) + call cursor(1,1) + norm! $ + redraw! + let expect=[ +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中aaaaaaaaaaaaaaaaa>', +\ '中hello '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call s:close_windows() +endfu diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim new file mode 100644 index 0000000000..944ad903fe --- /dev/null +++ b/src/testdir/test_lua.vim @@ -0,0 +1,22 @@ +" Tests for Lua. +" TODO: move tests from test85.in here. + +if !has('lua') + finish +endif + +func Test_luado() + new + call setline(1, ['one', 'two', 'three']) + luado vim.command("%d_") + bwipe! + + " Check switching to another buffer does not trigger ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + luado vim.command("new") + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc diff --git a/src/testdir/test_makeencoding.py b/src/testdir/test_makeencoding.py new file mode 100644 index 0000000000..041edadc0a --- /dev/null +++ b/src/testdir/test_makeencoding.py @@ -0,0 +1,67 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Test program for :make, :grep and :cgetfile. + +from __future__ import print_function, unicode_literals +import locale +import io +import sys + +def set_output_encoding(enc=None): + """Set the encoding of stdout and stderr + + arguments: + enc -- Encoding name. + If omitted, locale.getpreferredencoding() is used. + """ + if enc is None: + enc = locale.getpreferredencoding() + + def get_text_writer(fo, **kwargs): + kw = dict(kwargs) + kw.setdefault('errors', 'backslashreplace') # use \uXXXX style + kw.setdefault('closefd', False) + + if sys.version_info[0] < 3: + # Work around for Python 2.x + # New line conversion isn't needed here. Done in somewhere else. + writer = io.open(fo.fileno(), mode='w', newline='', **kw) + write = writer.write # save the original write() function + enc = locale.getpreferredencoding() + def convwrite(s): + if isinstance(s, bytes): + write(s.decode(enc)) # convert to unistr + else: + write(s) + try: + writer.flush() # needed on Windows + except IOError: + pass + writer.write = convwrite + else: + writer = io.open(fo.fileno(), mode='w', **kw) + return writer + + sys.stdout = get_text_writer(sys.stdout, encoding=enc) + sys.stderr = get_text_writer(sys.stderr, encoding=enc) + + +def main(): + enc = 'utf-8' + if len(sys.argv) > 1: + enc = sys.argv[1] + set_output_encoding(enc) + + message_tbl = { + 'utf-8': 'ÀÈÌÒÙ こんにちは 你好', + 'latin1': 'ÀÈÌÒÙ', + 'cp932': 'こんにちは', + 'cp936': '你好', + } + + print('Xfoobar.c(10) : %s (%s)' % (message_tbl[enc], enc)) + + +if __name__ == "__main__": + main() diff --git a/src/testdir/test_makeencoding.vim b/src/testdir/test_makeencoding.vim new file mode 100644 index 0000000000..a3d5538a47 --- /dev/null +++ b/src/testdir/test_makeencoding.vim @@ -0,0 +1,106 @@ +" Tests for 'makeencoding'. +if !has('multi_byte') + finish +endif + +source shared.vim + +let s:python = PythonProg() +if s:python == '' + " Can't run this test. + finish +endif + +let s:script = 'test_makeencoding.py' + +let s:message_tbl = { + \ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好', + \ 'latin1': 'ÀÈÌÒÙ', + \ 'cp932': 'こんにちは', + \ 'cp936': '你好', + \} + + +" Tests for :cgetfile and :lgetfile. +func Test_getfile() + set errorfile=Xerror.txt + set errorformat=%f(%l)\ :\ %m + + " :cgetfile + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile + cgetfile + copen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + cclose + endfor + + " :lgetfile + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile + lgetfile + lopen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + lclose + endfor + + call delete(&errorfile) +endfunc + + +" Tests for :grep and :lgrep. +func Test_grep() + let &grepprg = s:python + set grepformat=%f(%l)\ :\ %m + + " :grep + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent grep! " . s:script . " " . enc + copen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + cclose + endfor + + " :lgrep + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent lgrep! " . s:script . " " . enc + lopen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + lclose + endfor +endfunc + + +" Tests for :make and :lmake. +func Test_make() + let &makeprg = s:python + set errorformat=%f(%l)\ :\ %m + + " :make + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent make! " . s:script . " " . enc + copen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + cclose + endfor + + " :lmake + for enc in keys(s:message_tbl) + let &makeencoding = enc + exec "silent lmake! " . s:script . " " . enc + lopen + call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")", + \ getline('.')) + lclose + endfor +endfunc diff --git a/src/testdir/test_man.vim b/src/testdir/test_man.vim new file mode 100644 index 0000000000..1485ec3219 --- /dev/null +++ b/src/testdir/test_man.vim @@ -0,0 +1,60 @@ +runtime ftplugin/man.vim + +function Test_g_ft_man_open_mode() + vnew + let l:h = winheight(1) + q + let l:w = winwidth(1) + + " split horizontally + let wincnt = winnr('$') + Man vim + if wincnt == winnr('$') + " Vim manual page cannot be found. + return + endif + + call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) + call assert_true(l:h > winheight(1)) + call assert_equal(1, tabpagenr('$')) + call assert_equal(1, tabpagenr()) + q + + " split horizontally + let g:ft_man_open_mode = "horz" + Man vim + call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) + call assert_true(l:h > winheight(1)) + call assert_equal(1, tabpagenr('$')) + call assert_equal(1, tabpagenr()) + q + + " split vertically + let g:ft_man_open_mode = "vert" + Man vim + call assert_true(l:w > winwidth(1)) + call assert_equal(l:h, winheight(1)) + call assert_equal(1, tabpagenr('$')) + call assert_equal(1, tabpagenr()) + q + + " separate tab + let g:ft_man_open_mode = "tab" + Man vim + call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) + call assert_inrange(l:h - 1, l:h + 1, winheight(1)) + call assert_equal(2, tabpagenr('$')) + call assert_equal(2, tabpagenr()) + q +endfunction + +function Test_nomodifiable() + let wincnt = winnr('$') + Man vim + if wincnt == winnr('$') + " Vim manual page cannot be found. + return + endif + call assert_false(&l:modifiable) + q +endfunction diff --git a/src/testdir/test_maparg.vim b/src/testdir/test_maparg.vim new file mode 100644 index 0000000000..0fb878b04a --- /dev/null +++ b/src/testdir/test_maparg.vim @@ -0,0 +1,56 @@ +" Tests for maparg(). +" Also test utf8 map with a 0x80 byte. +if !has("multi_byte") + finish +endif + +function s:SID() + return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')) +endfun + +function Test_maparg() + new + set cpo-=< + set encoding=utf8 + " Test maparg() with a string result + map foo<C-V> is<F4>foo + vnoremap <script> <buffer> <expr> <silent> bar isbar + let sid = s:SID() + call assert_equal("is<F4>foo", maparg('foo<C-V>')) + call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>', + \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'rhs': 'is<F4>foo', + \ 'buffer': 0}, maparg('foo<C-V>', '', 0, 1)) + call assert_equal({'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v', + \ 'nowait': 0, 'expr': 1, 'sid': sid, 'rhs': 'isbar', 'buffer': 1}, + \ maparg('bar', '', 0, 1)) + map <buffer> <nowait> foo bar + call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ', + \ 'nowait': 1, 'expr': 0, 'sid': sid, 'rhs': 'bar', 'buffer': 1}, + \ maparg('foo', '', 0, 1)) + + map abc x<char-114>x + call assert_equal("xrx", maparg('abc')) + map abc y<S-char-114>y + call assert_equal("yRy", maparg('abc')) + + map abc <Nop> + call assert_equal("<Nop>", maparg('abc')) + unmap abc +endfunction + +function Test_range_map() + new + " Outside of the range, minimum + inoremap <Char-0x1040> a + execute "normal a\u1040\<Esc>" + " Inside of the range, minimum + inoremap <Char-0x103f> b + execute "normal a\u103f\<Esc>" + " Inside of the range, maximum + inoremap <Char-0xf03f> c + execute "normal a\uf03f\<Esc>" + " Outside of the range, maximum + inoremap <Char-0xf040> d + execute "normal a\uf040\<Esc>" + call assert_equal("abcd", getline(1)) +endfunction diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim new file mode 100644 index 0000000000..fd7e28f798 --- /dev/null +++ b/src/testdir/test_mapping.vim @@ -0,0 +1,232 @@ +" Tests for mappings and abbreviations + +if !has('multi_byte') + finish +endif + +func Test_abbreviation() + " abbreviation with 0x80 should work + inoreab чкпр vim + call feedkeys("Goчкпр \<Esc>", "xt") + call assert_equal('vim ', getline('$')) + iunab чкпр + set nomodified +endfunc + +func Test_map_ctrl_c_insert() + " mapping of ctrl-c in Insert mode + set cpo-=< cpo-=k + inoremap <c-c> <ctrl-c> + cnoremap <c-c> dummy + cunmap <c-c> + call feedkeys("GoTEST2: CTRL-C |\<C-C>A|\<Esc>", "xt") + call assert_equal('TEST2: CTRL-C |<ctrl-c>A|', getline('$')) + unmap! <c-c> + set nomodified +endfunc + +func Test_map_ctrl_c_visual() + " mapping of ctrl-c in Visual mode + vnoremap <c-c> :<C-u>$put ='vmap works' + call feedkeys("GV\<C-C>\<CR>", "xt") + call assert_equal('vmap works', getline('$')) + vunmap <c-c> + set nomodified +endfunc + +func Test_map_langmap() + if !has('langmap') + return + endif + + " check langmap applies in normal mode + set langmap=+- nolangremap + new + call setline(1, ['a', 'b', 'c']) + 2 + call assert_equal('b', getline('.')) + call feedkeys("+", "xt") + call assert_equal('a', getline('.')) + + " check no remapping + map x + + 2 + call feedkeys("x", "xt") + call assert_equal('c', getline('.')) + + " check with remapping + set langremap + 2 + call feedkeys("x", "xt") + call assert_equal('a', getline('.')) + + unmap x + bwipe! + + " 'langnoremap' follows 'langremap' and vise versa + set langremap + set langnoremap + call assert_equal(0, &langremap) + set langremap + call assert_equal(0, &langnoremap) + set nolangremap + call assert_equal(1, &langnoremap) + + " check default values + set langnoremap& + call assert_equal(0, &langnoremap) + call assert_equal(1, &langremap) + set langremap& + call assert_equal(0, &langnoremap) + call assert_equal(1, &langremap) + + " langmap should not apply in insert mode, 'langremap' doesn't matter + set langmap=+{ nolangremap + call feedkeys("Go+\<Esc>", "xt") + call assert_equal('+', getline('$')) + set langmap=+{ langremap + call feedkeys("Go+\<Esc>", "xt") + call assert_equal('+', getline('$')) + + " langmap used for register name in insert mode. + call setreg('a', 'aaaa') + call setreg('b', 'bbbb') + call setreg('c', 'cccc') + set langmap=ab langremap + call feedkeys("Go\<C-R>a\<Esc>", "xt") + call assert_equal('bbbb', getline('$')) + call feedkeys("Go\<C-R>\<C-R>a\<Esc>", "xt") + call assert_equal('bbbb', getline('$')) + " mapping does not apply + imap c a + call feedkeys("Go\<C-R>c\<Esc>", "xt") + call assert_equal('cccc', getline('$')) + imap a c + call feedkeys("Go\<C-R>a\<Esc>", "xt") + call assert_equal('bbbb', getline('$')) + + " langmap should not apply in Command-line mode + set langmap=+{ nolangremap + call feedkeys(":call append(line('$'), '+')\<CR>", "xt") + call assert_equal('+', getline('$')) + + iunmap a + iunmap c + set nomodified +endfunc + +func Test_map_feedkeys() + " issue #212 (feedkeys insert mapping at current position) + nnoremap . :call feedkeys(".", "in")<cr> + call setline('$', ['a b c d', 'a b c d']) + $-1 + call feedkeys("0qqdw.ifoo\<Esc>qj0@q\<Esc>", "xt") + call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$'))) + nunmap . + set nomodified +endfunc + +func Test_map_cursor() + " <c-g>U<cursor> works only within a single line + imapclear + imap ( ()<c-g>U<left> + call feedkeys("G2o\<Esc>ki\<CR>Test1: text with a (here some more text\<Esc>k.", "xt") + call assert_equal('Test1: text with a (here some more text)', getline(line('$') - 2)) + call assert_equal('Test1: text with a (here some more text)', getline(line('$') - 1)) + + " test undo + call feedkeys("G2o\<Esc>ki\<CR>Test2: text wit a (here some more text [und undo]\<C-G>u\<Esc>k.u", "xt") + call assert_equal('', getline(line('$') - 2)) + call assert_equal('Test2: text wit a (here some more text [und undo])', getline(line('$') - 1)) + set nomodified + imapclear +endfunc + +" This isn't actually testing a mapping, but similar use of CTRL-G U as above. +func Test_break_undo() + :set whichwrap=<,>,[,] + call feedkeys("G4o2k", "xt") + exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>." + call assert_equal('new line here', getline(line('$') - 3)) + call assert_equal('Test3: text with a (parenthesis here', getline(line('$') - 2)) + call assert_equal('new line here', getline(line('$') - 1)) + set nomodified +endfunc + +func Test_map_meta_quotes() + imap <M-"> foo + call feedkeys("Go-\<M-\">-\<Esc>", "xt") + call assert_equal("-foo-", getline('$')) + set nomodified + iunmap <M-"> +endfunc + +func Test_abbr_after_line_join() + new + abbr foo bar + set backspace=indent,eol,start + exe "normal o\<BS>foo " + call assert_equal("bar ", getline(1)) + bwipe! + unabbr foo + set backspace& +endfunc + +func Test_map_timeout() + nnoremap aaaa :let got_aaaa = 1<CR> + nnoremap bb :let got_bb = 1<CR> + nmap b aaa + new + func ExitInsert(timer) + let g:line = getline(1) + call feedkeys("\<Esc>", "t") + endfunc + set timeout timeoutlen=200 + call timer_start(300, 'ExitInsert') + " After the 'b' Vim waits for another character to see if it matches 'bb'. + " When it times out it is expanded to "aaa", but there is no wait for + " "aaaa". Can't check that reliably though. + call feedkeys("b", "xt!") + call assert_equal("aa", g:line) + call assert_false(exists('got_aaa')) + call assert_false(exists('got_bb')) + + bwipe! + nunmap aaaa + nunmap bb + nunmap b + set timeoutlen& + delfunc ExitInsert +endfunc + +func Test_abbreviation_CR() + new + func Eatchar(pat) + let c = nr2char(getchar(0)) + return (c =~ a:pat) ? '' : c + endfunc + iabbrev <buffer><silent> ~~7 <c-r>=repeat('~', 7)<CR><c-r>=Eatchar('\s')<cr> + call feedkeys("GA~~7 \<esc>", 'xt') + call assert_equal('~~~~~~~', getline('$')) + %d + call feedkeys("GA~~7\<cr>\<esc>", 'xt') + call assert_equal(['~~~~~~~', ''], getline(1,'$')) + delfunc Eatchar + bw! +endfunc + +func Test_cabbr_visual_mode() + cabbr s su + call feedkeys(":s \<c-B>\"\<CR>", 'itx') + call assert_equal('"su ', getreg(':')) + call feedkeys(":'<,'>s \<c-B>\"\<CR>", 'itx') + let expected = '"'. "'<,'>su " + call assert_equal(expected, getreg(':')) + call feedkeys(": '<,'>s \<c-B>\"\<CR>", 'itx') + let expected = '" '. "'<,'>su " + call assert_equal(expected, getreg(':')) + call feedkeys(":'a,'bs \<c-B>\"\<CR>", 'itx') + let expected = '"'. "'a,'bsu " + call assert_equal(expected, getreg(':')) + cunabbr s +endfunc diff --git a/src/testdir/test_marks.vim b/src/testdir/test_marks.vim new file mode 100644 index 0000000000..d22f9051b5 --- /dev/null +++ b/src/testdir/test_marks.vim @@ -0,0 +1,122 @@ + +" Test that a deleted mark is restored after delete-undo-redo-undo. +function! Test_Restore_DelMark() + enew! + call append(0, [" textline A", " textline B", " textline C"]) + normal! 2gg + set nocp viminfo+=nviminfo + exe "normal! i\<C-G>u\<Esc>" + exe "normal! maddu\<C-R>u" + let pos = getpos("'a") + call assert_equal(2, pos[1]) + call assert_equal(1, pos[2]) + enew! +endfunction + +" Test that CTRL-A and CTRL-X updates last changed mark '[, ']. +function! Test_Incr_Marks() + enew! + call append(0, ["123 123 123", "123 123 123", "123 123 123"]) + normal! gg + execute "normal! \<C-A>`[v`]rAjwvjw\<C-X>`[v`]rX" + call assert_equal("AAA 123 123", getline(1)) + call assert_equal("123 XXXXXXX", getline(2)) + call assert_equal("XXX 123 123", getline(3)) + enew! +endfunction + +func Test_setpos() + new one + let onebuf = bufnr('%') + let onewin = win_getid() + call setline(1, ['aaa', 'bbb', 'ccc']) + new two + let twobuf = bufnr('%') + let twowin = win_getid() + call setline(1, ['aaa', 'bbb', 'ccc']) + + " for the cursor the buffer number is ignored + call setpos(".", [0, 2, 1, 0]) + call assert_equal([0, 2, 1, 0], getpos(".")) + call setpos(".", [onebuf, 3, 3, 0]) + call assert_equal([0, 3, 3, 0], getpos(".")) + + call setpos("''", [0, 1, 3, 0]) + call assert_equal([0, 1, 3, 0], getpos("''")) + call setpos("''", [onebuf, 2, 2, 0]) + call assert_equal([0, 2, 2, 0], getpos("''")) + + " buffer-local marks + for mark in ["'a", "'\"", "'[", "']", "'<", "'>"] + call win_gotoid(twowin) + call setpos(mark, [0, 2, 1, 0]) + call assert_equal([0, 2, 1, 0], getpos(mark), "for mark " . mark) + call setpos(mark, [onebuf, 1, 3, 0]) + call win_gotoid(onewin) + call assert_equal([0, 1, 3, 0], getpos(mark), "for mark " . mark) + endfor + + " global marks + call win_gotoid(twowin) + call setpos("'N", [0, 2, 1, 0]) + call assert_equal([twobuf, 2, 1, 0], getpos("'N")) + call setpos("'N", [onebuf, 1, 3, 0]) + call assert_equal([onebuf, 1, 3, 0], getpos("'N")) + + call win_gotoid(onewin) + bwipe! + call win_gotoid(twowin) + bwipe! +endfunc + +func Test_marks_cmd() + new Xone + call setline(1, ['aaa', 'bbb']) + norm! maG$mB + w! + new Xtwo + call setline(1, ['ccc', 'ddd']) + norm! $mcGmD + w! + + b Xone + let a=split(execute('marks'), "\n") + call assert_equal(9, len(a)) + call assert_equal('mark line col file/text', a[0]) + call assert_equal(" ' 2 0 bbb", a[1]) + call assert_equal(' a 1 0 aaa', a[2]) + call assert_equal(' B 2 2 bbb', a[3]) + call assert_equal(' D 2 0 Xtwo', a[4]) + call assert_equal(' " 1 0 aaa', a[5]) + call assert_equal(' [ 1 0 aaa', a[6]) + call assert_equal(' ] 2 0 bbb', a[7]) + call assert_equal(' . 2 0 bbb', a[8]) + + b Xtwo + let a=split(execute('marks'), "\n") + call assert_equal(9, len(a)) + call assert_equal('mark line col file/text', a[0]) + call assert_equal(" ' 1 0 ccc", a[1]) + call assert_equal(' c 1 2 ccc', a[2]) + call assert_equal(' B 2 2 Xone', a[3]) + call assert_equal(' D 2 0 ddd', a[4]) + call assert_equal(' " 2 0 ddd', a[5]) + call assert_equal(' [ 1 0 ccc', a[6]) + call assert_equal(' ] 2 0 ddd', a[7]) + call assert_equal(' . 2 0 ddd', a[8]) + + b Xone + delmarks aB + let a=split(execute('marks aBcD'), "\n") + call assert_equal(2, len(a)) + call assert_equal('mark line col file/text', a[0]) + call assert_equal(' D 2 0 Xtwo', a[1]) + + b Xtwo + delmarks cD + call assert_fails('marks aBcD', 'E283:') + + call delete('Xone') + call delete('Xtwo') + %bwipe +endfunc diff --git a/src/testdir/test_match.vim b/src/testdir/test_match.vim new file mode 100644 index 0000000000..28dd97c923 --- /dev/null +++ b/src/testdir/test_match.vim @@ -0,0 +1,222 @@ +" Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), +" matchaddpos(), matcharg(), matchdelete(), and setmatches(). + +function Test_match() + highlight MyGroup1 term=bold ctermbg=red guibg=red + highlight MyGroup2 term=italic ctermbg=green guibg=green + highlight MyGroup3 term=underline ctermbg=blue guibg=blue + + " --- Check that "matcharg()" returns the correct group and pattern if a match + " --- is defined. + match MyGroup1 /TODO/ + 2match MyGroup2 /FIXME/ + 3match MyGroup3 /XXX/ + call assert_equal(['MyGroup1', 'TODO'], matcharg(1)) + call assert_equal(['MyGroup2', 'FIXME'], matcharg(2)) + call assert_equal(['MyGroup3', 'XXX'], matcharg(3)) + + " --- Check that "matcharg()" returns an empty list if the argument is not 1, + " --- 2 or 3 (only 0 and 4 are tested). + call assert_equal([], matcharg(0)) + call assert_equal([], matcharg(4)) + + " --- Check that "matcharg()" returns ['', ''] if a match is not defined. + match + 2match + 3match + call assert_equal(['', ''], matcharg(1)) + call assert_equal(['', ''], matcharg(2)) + call assert_equal(['', ''], matcharg(3)) + + " --- Check that "matchadd()" and "getmatches()" agree on added matches and + " --- that default values apply. + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + let ans = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4}, + \ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5}, + \ {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}] + call assert_equal(ans, getmatches()) + + " --- Check that "matchdelete()" deletes the matches defined in the previous + " --- test correctly. + call matchdelete(m1) + call matchdelete(m2) + call matchdelete(m3) + call assert_equal([], getmatches()) + + " --- Check that "matchdelete()" returns 0 if successful and otherwise -1. + let m = matchadd("MyGroup1", "TODO") + call assert_equal(0, matchdelete(m)) + call assert_fails('call matchdelete(42)', 'E803:') + + " --- Check that "clearmatches()" clears all matches defined by ":match" and + " --- "matchadd()". + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + match MyGroup1 /COFFEE/ + 2match MyGroup2 /HUMPPA/ + 3match MyGroup3 /VIM/ + call clearmatches() + call assert_equal([], getmatches()) + + " --- Check that "setmatches()" restores a list of matches saved by + " --- "getmatches()" without changes. (Matches with equal priority must also + " --- remain in the same order.) + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + match MyGroup1 /COFFEE/ + 2match MyGroup2 /HUMPPA/ + 3match MyGroup3 /VIM/ + let ml = getmatches() + call clearmatches() + call setmatches(ml) + call assert_equal(ml, getmatches()) + call clearmatches() + + " --- Check that "setmatches()" will not add two matches with the same ID. The + " --- expected behaviour (for now) is to add the first match but not the + " --- second and to return 0 (even though it is a matter of debate whether + " --- this can be considered successful behaviour). + let data = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, + \ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}] + call assert_fails('call setmatches(data)', 'E801:') + call assert_equal([data[0]], getmatches()) + call clearmatches() + + " --- Check that "setmatches()" returns 0 if successful and otherwise -1. + " --- (A range of valid and invalid input values are tried out to generate the + " --- return values.) + call assert_equal(0, setmatches([])) + call assert_equal(0, setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])) + call clearmatches() + call assert_fails('call setmatches(0)', 'E714:') + call assert_fails('call setmatches([0])', 'E474:') + call assert_fails("call setmatches([{'wrong key': 'wrong value'}])", 'E474:') + + call setline(1, 'abcdefghijklmnopq') + call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3) + 1 + redraw! + let v1 = screenattr(1, 1) + let v5 = screenattr(1, 5) + let v6 = screenattr(1, 6) + let v8 = screenattr(1, 8) + let v10 = screenattr(1, 10) + let v11 = screenattr(1, 11) + call assert_notequal(v1, v5) + call assert_equal(v6, v1) + call assert_equal(v8, v5) + call assert_equal(v10, v5) + call assert_equal(v11, v1) + call assert_equal([{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}], getmatches()) + call clearmatches() + + " + if has('multi_byte') + call setline(1, 'abcdΣabcdef') + call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]]) + 1 + redraw! + let v1 = screenattr(1, 1) + let v4 = screenattr(1, 4) + let v5 = screenattr(1, 5) + let v6 = screenattr(1, 6) + let v7 = screenattr(1, 7) + let v8 = screenattr(1, 8) + let v9 = screenattr(1, 9) + let v10 = screenattr(1, 10) + call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}], getmatches()) + call assert_notequal(v1, v4) + call assert_equal(v5, v4) + call assert_equal(v6, v1) + call assert_equal(v7, v1) + call assert_equal(v8, v4) + call assert_equal(v9, v4) + call assert_equal(v10, v1) + + " Check, that setmatches() can correctly restore the matches from matchaddpos() + call matchadd('MyGroup1', '\%2lmatchadd') + let m=getmatches() + call clearmatches() + call setmatches(m) + call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1,9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}], getmatches()) + endif + + highlight MyGroup1 NONE + highlight MyGroup2 NONE + highlight MyGroup3 NONE +endfunc + +func Test_matchaddpos() + syntax on + set hlsearch + + call setline(1, ['12345', 'NP']) + call matchaddpos('Error', [[1,2], [1,6], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,2)) + call assert_notequal(screenattr(2,2), screenattr(1,6)) + 1 + call matchadd('Search', 'N\|\n') + redraw! + call assert_notequal(screenattr(2,1), 0) + call assert_equal(screenattr(2,1), screenattr(1,6)) + exec "norm! i0\<Esc>" + redraw! + call assert_equal(screenattr(2,2), screenattr(1,6)) + + " Check overlapping pos + call clearmatches() + call setline(1, ['1234567890', 'NH']) + call matchaddpos('Error', [[1,1,5], [1,3,5], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,5)) + call assert_equal(screenattr(2,2), screenattr(1,7)) + call assert_notequal(screenattr(2,2), screenattr(1,8)) + + call clearmatches() + call matchaddpos('Error', [[1], [2,2]]) + redraw! + call assert_equal(screenattr(2,2), screenattr(1,1)) + call assert_equal(screenattr(2,2), screenattr(1,10)) + call assert_notequal(screenattr(2,2), screenattr(1,11)) + + nohl + call clearmatches() + syntax off + set hlsearch& +endfunc + +func Test_matchaddpos_using_negative_priority() + set hlsearch + + call clearmatches() + + call setline(1, 'x') + let @/='x' + redraw! + let search_attr = screenattr(1,1) + + let @/='' + call matchaddpos('Error', [1], 10) + redraw! + let error_attr = screenattr(1,1) + + call setline(2, '-1 match priority') + call matchaddpos('Error', [2], -1) + redraw! + let negative_match_priority_attr = screenattr(2,1) + + call assert_notequal(negative_match_priority_attr, search_attr, "Match with negative priority is incorrectly highlighted with Search highlight.") + call assert_equal(negative_match_priority_attr, error_attr) + + nohl + set hlsearch& +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_matchadd_conceal.vim b/src/testdir/test_matchadd_conceal.vim new file mode 100644 index 0000000000..123bdf0661 --- /dev/null +++ b/src/testdir/test_matchadd_conceal.vim @@ -0,0 +1,279 @@ +" Test for matchadd() and conceal feature +if !has('conceal') + finish +endif + +if !has('gui_running') && has('unix') + set term=ansi +endif + +source shared.vim + +function! Test_simple_matchadd() + new + + 1put='# This is a Test' + " 1234567890123456 + let expect = '# This is a Test' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ') + redraw! + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + quit! +endfunction + +function! Test_simple_matchadd_and_conceal() + new + setlocal concealcursor=n conceallevel=1 + + 1put='# This is a Test' + " 1234567890123456 + let expect = '#XThisXisXaXTest' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'}) + redraw! + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + quit! +endfunction + +function! Test_matchadd_and_conceallevel_3() + new + + setlocal conceallevel=3 + " set filetype and :syntax on to change screenattr() + setlocal filetype=conf + syntax on + + 1put='# This is a Test' + " 1234567890123456 + let expect = '#ThisisaTest' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'}) + redraw! + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 16)) + + " more matchadd() + " 1234567890123456 + let expect = '#Thisisa Test' + + call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'}) + redraw! + call assert_equal(expect, Screenline(lnum)) + call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2) , screenattr(lnum, 7)) + call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 10), screenattr(lnum, 12)) + call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16)) + call assert_notequal(screenattr(lnum, 10), screenattr(lnum, 16)) + + syntax off + quit! +endfunction + +function! Test_default_conceal_char() + new + setlocal concealcursor=n conceallevel=1 + + 1put='# This is a Test' + " 1234567890123456 + let expect = '# This is a Test' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 10, -1, {}) + redraw! + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + " 1234567890123456 + let expect = '#+This+is+a+Test' + let listchars_save = &listchars + set listchars=conceal:+ + redraw! + + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + let &listchars = listchars_save + quit! +endfunction + +function! Test_syn_and_match_conceal() + new + setlocal concealcursor=n conceallevel=1 + + 1put='# This is a Test' + " 1234567890123456 + let expect = '#ZThisZisZaZTest' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'}) + syntax match MyConceal /\%2l / conceal containedin=ALL cchar=* + redraw! + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + " 1234567890123456 + let expect = '#*This*is*a*Test' + call clearmatches() + redraw! + + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + syntax off + quit! +endfunction + +function! Test_clearmatches() + new + setlocal concealcursor=n conceallevel=1 + + 1put='# This is a Test' + " 1234567890123456 + let expect = '# This is a Test' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'}) + let a = getmatches() + call clearmatches() + redraw! + + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + " reset match using setmatches() + " 1234567890123456 + let expect = '#ZThisZisZaZTest' + call setmatches(a) + redraw! + + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0]) + + quit! +endfunction + +function! Test_using_matchaddpos() + new + setlocal concealcursor=n conceallevel=1 + " set filetype and :syntax on to change screenattr() + setlocal filetype=conf + syntax on + + 1put='# This is a Test' + " 1234567890123456 + let expect = '#Pis a Test' + + call cursor(1, 1) + call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'}) + let a = getmatches() + redraw! + + let lnum = 2 + call assert_equal(expect, Screenline(lnum)) + call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 2)) + call assert_notequal(screenattr(lnum, 2) , screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 10)) + call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 12)) + call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16)) + call assert_equal(screenattr(lnum, 12), screenattr(lnum, 16)) + call assert_equal({'group': 'Conceal', 'id': a[0].id, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}, a[0]) + + syntax off + quit! +endfunction + +function! Test_matchadd_repeat_conceal_with_syntax_off() + new + + " To test targets in the same line string is replaced with conceal char + " correctly, repeat 'TARGET' + 1put ='TARGET_TARGETTARGET' + call cursor(1, 1) + redraw + call assert_equal('TARGET_TARGETTARGET', Screenline(2)) + + setlocal conceallevel=2 + call matchadd('Conceal', 'TARGET', 10, -1, {'conceal': 't'}) + + redraw + call assert_equal('t_tt', Screenline(2)) + + quit! +endfunction + +function! Test_matchadd_and_syn_conceal() + new + let cnt='Inductive bool : Type := | true : bool | false : bool.' + let expect = 'Inductive - : Type := | true : - | false : -.' + 0put =cnt + " set filetype and :syntax on to change screenattr() + set cole=1 cocu=nv + hi link CheckedByCoq WarningMsg + syntax on + syntax keyword coqKwd bool conceal cchar=- + redraw! + call assert_equal(expect, Screenline(1)) + call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) + call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) + call assert_equal(screenattr(1, 11) , screenattr(1, 32)) + call matchadd('CheckedByCoq', '\%<2l\%>9c\%<16c') + redraw! + call assert_equal(expect, Screenline(1)) + call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) + call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) + call assert_equal(screenattr(1, 11) , screenattr(1, 32)) +endfunction diff --git a/src/testdir/test_matchadd_conceal_utf8.vim b/src/testdir/test_matchadd_conceal_utf8.vim new file mode 100644 index 0000000000..34d3ee28f0 --- /dev/null +++ b/src/testdir/test_matchadd_conceal_utf8.vim @@ -0,0 +1,43 @@ +" Test for matchadd() and conceal feature using utf-8. +if !has('conceal') || !has('multi_byte') + finish +endif + +if !has('gui_running') && has('unix') + set term=ansi +endif + +function! s:screenline(lnum) abort + let line = [] + for c in range(1, winwidth(0)) + call add(line, nr2char(screenchar(a:lnum, c))) + endfor + return s:trim(join(line, '')) +endfunction + +function! s:trim(str) abort + return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$') +endfunction + +function! Test_match_using_multibyte_conceal_char() + new + setlocal concealcursor=n conceallevel=1 + + 1put='# This is a Test' + " 1234567890123456 + let expect = '#ˑThisˑisˑaˑTest' + + call cursor(1, 1) + call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"}) + redraw! + + let lnum = 2 + call assert_equal(expect, s:screenline(lnum)) + call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) + call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) + call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) + + quit! +endfunction diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim new file mode 100644 index 0000000000..055d944b15 --- /dev/null +++ b/src/testdir/test_menu.vim @@ -0,0 +1,32 @@ +" Test that the system menu can be loaded. + +if !has('menu') + finish +endif + +func Test_load_menu() + try + source $VIMRUNTIME/menu.vim + catch + call assert_report('error while loading menus: ' . v:exception) + endtry + call assert_match('browse confirm w', execute(':menu File.Save')) + source $VIMRUNTIME/delmenu.vim +endfunc + +func Test_translate_menu() + if !has('multi_lang') + return + endif + if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim') + throw 'Skipped: translated menu not found' + endif + + " First delete any English menus. + source $VIMRUNTIME/delmenu.vim + set langmenu=de_de + source $VIMRUNTIME/menu.vim + call assert_match('browse confirm w', execute(':menu Datei.Speichern')) + + source $VIMRUNTIME/delmenu.vim +endfunc diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim new file mode 100644 index 0000000000..384d2aa94f --- /dev/null +++ b/src/testdir/test_messages.vim @@ -0,0 +1,61 @@ +" Tests for :messages + +function Test_messages() + let oldmore = &more + try + set nomore + " Avoid the "message maintainer" line. + let $LANG = '' + + let arr = map(range(10), '"hello" . v:val') + for s in arr + echomsg s | redraw + endfor + let result = '' + + " get last two messages + redir => result + 2messages | redraw + redir END + let msg_list = split(result, "\n") + call assert_equal(["hello8", "hello9"], msg_list) + + " clear messages without last one + 1messages clear + redir => result + redraw | messages + redir END + let msg_list = split(result, "\n") + call assert_equal(['hello9'], msg_list) + + " clear all messages + messages clear + redir => result + redraw | messages + redir END + call assert_equal('', result) + finally + let &more = oldmore + endtry +endfunction + +" Patch 7.4.1696 defined the "clearmode()" command for clearing the mode +" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message +" output could then be disturbed when 'cmdheight' was greater than one. +" This test ensures that the bugfix for this issue remains in place. +function! Test_stopinsert_does_not_break_message_output() + set cmdheight=2 + redraw! + + stopinsert | echo 'test echo' + call assert_equal(116, screenchar(&lines - 1, 1)) + call assert_equal(32, screenchar(&lines, 1)) + redraw! + + stopinsert | echomsg 'test echomsg' + call assert_equal(116, screenchar(&lines - 1, 1)) + call assert_equal(32, screenchar(&lines, 1)) + redraw! + + set cmdheight& +endfunction diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim new file mode 100644 index 0000000000..e81d9b3e32 --- /dev/null +++ b/src/testdir/test_mksession.vim @@ -0,0 +1,268 @@ +" Test for :mksession, :mkview and :loadview in latin1 encoding + +set encoding=latin1 +scriptencoding latin1 + +if !has('multi_byte') || !has('mksession') + finish +endif + +source shared.vim + +func Test_mksession() + tabnew + let wrap_save = &wrap + set sessionoptions=buffers splitbelow fileencoding=latin1 + call setline(1, [ + \ 'start:', + \ 'no multibyte chAracter', + \ ' one leaDing tab', + \ ' four leadinG spaces', + \ 'two consecutive tabs', + \ 'two tabs in one line', + \ 'one multibyteCharacter', + \ 'a two multiByte characters', + \ 'A three mulTibyte characters' + \ ]) + let tmpfile = 'Xtemp' + exec 'w! ' . tmpfile + /^start: + set wrap + vsplit + norm! j16| + split + norm! j16| + split + norm! j16| + split + norm! j8| + split + norm! j8| + split + norm! j16| + split + norm! j16| + split + norm! j16| + wincmd l + + set nowrap + /^start: + norm! j16|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + norm! j08|3zl + split + norm! j08|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + call wincol() + mksession! Xtest_mks.out + let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"') + let expected = [ + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 08|', + \ 'normal! 08|', + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 016|', + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", + \ " normal! 08|", + \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", + \ " normal! 08|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|" + \ ] + call assert_equal(expected, li) + tabclose! + + call delete('Xtest_mks.out') + call delete(tmpfile) + let &wrap = wrap_save + set sessionoptions& +endfunc + +func Test_mksession_winheight() + new + set winheight=10 + set winminheight=2 + mksession! Xtest_mks.out + source Xtest_mks.out + + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_large_winheight() + set winheight=999 + mksession! Xtest_mks_winheight.out + set winheight& + source Xtest_mks_winheight.out + call delete('Xtest_mks_winheight.out') +endfunc + +func Test_mksession_arglist() + argdel * + next file1 file2 file3 file4 + mksession! Xtest_mks.out + source Xtest_mks.out + call assert_equal(['file1', 'file2', 'file3', 'file4'], argv()) + + call delete('Xtest_mks.out') + argdel * +endfunc + +func Test_mksession_one_buffer_two_windows() + edit Xtest1 + new Xtest2 + split + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let count1 = 0 + let count2 = 0 + let count2buf = 0 + for line in lines + if line =~ 'edit \f*Xtest1$' + let count1 += 1 + endif + if line =~ 'edit \f\{-}Xtest2' + let count2 += 1 + endif + if line =~ 'buffer \f\{-}Xtest2' + let count2buf += 1 + endif + endfor + call assert_equal(1, count1, 'Xtest1 count') + call assert_equal(2, count2, 'Xtest2 count') + call assert_equal(2, count2buf, 'Xtest2 buffer count') + + close + bwipe! + call delete('Xtest_mks.out') +endfunc + +if has('terminal') + +func Test_mksession_terminal_shell() + terminal + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + let term_cmd = line + elseif line =~ 'badd.*' . &shell + call assert_report('unexpected shell line: ' . line) + endif + endfor + call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*$', term_cmd) + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_cmdarg() + terminal ++norestore + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_funcarg() + call term_start(&shell, {'norestore': 1}) + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_func() + terminal + call term_setrestore(bufnr('%'), 'NONE') + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_ssop() + terminal + set sessionoptions-=terminal + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') + set sessionoptions& +endfunc + +func Test_mksession_terminal_restore_other() + terminal + call term_setrestore(bufnr('%'), 'other') + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + let term_cmd = line + endif + endfor + call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+ other', term_cmd) + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +endif " has('terminal') + + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_mksession_utf8.vim b/src/testdir/test_mksession_utf8.vim new file mode 100644 index 0000000000..8ffbba2a1c --- /dev/null +++ b/src/testdir/test_mksession_utf8.vim @@ -0,0 +1,105 @@ +" Test for :mksession, :mkview and :loadview in utf-8 encoding + +set encoding=utf-8 +scriptencoding utf-8 + +if !has('multi_byte') || !has('mksession') + finish +endif + +func Test_mksession_utf8() + tabnew + let wrap_save = &wrap + set sessionoptions=buffers splitbelow fileencoding=utf-8 + call setline(1, [ + \ 'start:', + \ 'no multibyte chAracter', + \ ' one leaDing tab', + \ ' four leadinG spaces', + \ 'two consecutive tabs', + \ 'two tabs in one line', + \ 'one … multibyteCharacter', + \ 'a “b” two multiByte characters', + \ '“c”1€ three mulTibyte characters' + \ ]) + let tmpfile = tempname() + exec 'w! ' . tmpfile + /^start: + set wrap + vsplit + norm! j16| + split + norm! j16| + split + norm! j16| + split + norm! j8| + split + norm! j8| + split + norm! j16| + split + norm! j16| + split + norm! j16| + wincmd l + + set nowrap + /^start: + norm! j16|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + norm! j08|3zl + split + norm! j08|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + norm! j016|3zl + split + call wincol() + mksession! test_mks.out + let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"') + let expected = [ + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 08|', + \ 'normal! 08|', + \ 'normal! 016|', + \ 'normal! 016|', + \ 'normal! 016|', + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", + \ " normal! 08|", + \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", + \ " normal! 08|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|", + \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", + \ " normal! 016|" + \ ] + call assert_equal(expected, li) + tabclose! + + call delete('test_mks.out') + call delete(tmpfile) + let &wrap = wrap_save + set sessionoptions& splitbelow& fileencoding& +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_nested_function.vim b/src/testdir/test_nested_function.vim new file mode 100644 index 0000000000..ec48f030c1 --- /dev/null +++ b/src/testdir/test_nested_function.vim @@ -0,0 +1,67 @@ +"Tests for nested functions +" +func NestedFunc() + func! Func1() + let g:text .= 'Func1 ' + endfunc + call Func1() + func! s:func2() + let g:text .= 's:func2 ' + endfunc + call s:func2() + func! s:_func3() + let g:text .= 's:_func3 ' + endfunc + call s:_func3() + let fn = 'Func4' + func! {fn}() + let g:text .= 'Func4 ' + endfunc + call {fn}() + let fn = 'func5' + func! s:{fn}() + let g:text .= 's:func5' + endfunc + call s:{fn}() +endfunc + +func Test_nested_functions() + let g:text = '' + call NestedFunc() + call assert_equal('Func1 s:func2 s:_func3 Func4 s:func5', g:text) +endfunction + +func Test_nested_argument() + func g:X() + let g:Y = function('sort') + endfunc + let g:Y = function('sort') + echo g:Y([], g:X()) + delfunc g:X + unlet g:Y +endfunc + +func Recurse(count) + if a:count > 0 + call Recurse(a:count - 1) + endif +endfunc + +func Test_max_nesting() + " TODO: why does this fail on Windows? Runs out of stack perhaps? + if has('win32') + return + endif + let call_depth_here = 2 + let ex_depth_here = 5 + set mfd& + + call Recurse(99 - call_depth_here) + call assert_fails('call Recurse(' . (100 - call_depth_here) . ')', 'E132:') + + set mfd=210 + call Recurse(209 - ex_depth_here) + call assert_fails('call Recurse(' . (210 - ex_depth_here) . ')', 'E169:') + + set mfd& +endfunc diff --git a/src/testdir/test_netbeans.py b/src/testdir/test_netbeans.py new file mode 100644 index 0000000000..e0d291d60d --- /dev/null +++ b/src/testdir/test_netbeans.py @@ -0,0 +1,91 @@ +#!/usr/bin/python +# +# Server that will communicate with Vim through the netbeans interface. +# Used by test_netbeans.vim. +# +# This requires Python 2.6 or later. + +from __future__ import print_function +import socket +import sys +import time +import threading + +try: + # Python 3 + import socketserver +except ImportError: + # Python 2 + import SocketServer as socketserver + +class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): + + def handle(self): + print("=== socket opened ===") + while True: + try: + received = self.request.recv(4096).decode('utf-8') + except socket.error: + print("=== socket error ===") + break + except IOError: + print("=== socket closed ===") + break + if received == '': + print("=== socket closed ===") + break + print("received: {0}".format(received)) + + # Write the received line into the file, so that the test can check + # what happened. + with open("Xnetbeans", "a") as myfile: + myfile.write(received) + + response = '' + if received.find('README.txt') > 0: + name = received.split('"')[1] + response = '5:putBufferNumber!33 "' + name + '"\n' + response += '5:setDot!1 3/19\n' + elif received.find('disconnect') > 0: + # we're done + self.server.shutdown() + return + + if len(response) > 0: + self.request.sendall(response.encode('utf-8')) + # Write the respoinse into the file, so that the test can knows + # the command was sent. + with open("Xnetbeans", "a") as myfile: + myfile.write('send: ' + response) + +class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + pass + +def writePortInFile(port): + # Write the port number in Xportnr, so that the test knows it. + f = open("Xportnr", "w") + f.write("{0}".format(port)) + f.close() + +if __name__ == "__main__": + HOST, PORT = "localhost", 0 + + server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) + ip, port = server.server_address + + # Start a thread with the server. That thread will then start a new thread + # for each connection. + server_thread = threading.Thread(target=server.serve_forever) + server_thread.start() + + writePortInFile(port) + + print("Listening on port {0}".format(port)) + + # Main thread terminates, but the server continues running + # until server.shutdown() is called. + try: + while server_thread.isAlive(): + server_thread.join(1) + except (KeyboardInterrupt, SystemExit): + server.shutdown() diff --git a/src/testdir/test_netbeans.vim b/src/testdir/test_netbeans.vim new file mode 100644 index 0000000000..aa4e67661a --- /dev/null +++ b/src/testdir/test_netbeans.vim @@ -0,0 +1,84 @@ +" Test the netbeans interface. + +if !has('netbeans_intg') + finish +endif + +source shared.vim + +let s:python = PythonProg() +if s:python == '' + " Can't run this test. + finish +endif + +" Run "testfunc" after sarting the server and stop the server afterwards. +func s:run_server(testfunc, ...) + call RunServer('test_netbeans.py', a:testfunc, a:000) +endfunc + +func Nb_basic(port) + call delete("Xnetbeans") + call writefile([], "Xnetbeans") + exe 'nbstart :localhost:' . a:port . ':bunny' + call assert_true(has("netbeans_enabled")) + + call WaitFor('len(readfile("Xnetbeans")) > 2') + split +$ README.txt + + " Opening README.txt will result in a setDot command + call WaitFor('len(readfile("Xnetbeans")) > 4') + call WaitFor('getcurpos()[1] == 3') + let pos = getcurpos() + call assert_equal(3, pos[1]) + call assert_equal(20, pos[2]) + close + nbclose + + call WaitFor('len(readfile("Xnetbeans")) > 6') + call assert_false(has("netbeans_enabled")) + let lines = readfile("Xnetbeans") + call assert_equal('AUTH bunny', lines[0]) + call assert_equal('0:version=0 "2.5"', lines[1]) + call assert_equal('0:startupDone=0', lines[2]) + call assert_equal('0:fileOpened=0 "README.txt" T F', substitute(lines[3], '".*/', '"', '')) + + call assert_equal('0:disconnect=1', lines[6]) + + call delete("Xnetbeans") +endfunc + +func Test_nb_basic() + call ch_log('Test_nb_basic') + call s:run_server('Nb_basic') +endfunc + +func Nb_file_auth(port) + call delete("Xnetbeans") + call writefile([], "Xnetbeans") + + call assert_fails('nbstart =notexist', 'E660:') + call writefile(['host=localhost', 'port=' . a:port, 'auth=bunny'], 'Xnbauth') + if has('unix') + call setfperm('Xnbauth', "rw-r--r--") + call assert_fails('nbstart =Xnbauth', 'E668:') + endif + call setfperm('Xnbauth', "rw-------") + exe 'nbstart =Xnbauth' + call assert_true(has("netbeans_enabled")) + + call WaitFor('len(readfile("Xnetbeans")) > 2') + nbclose + let lines = readfile("Xnetbeans") + call assert_equal('AUTH bunny', lines[0]) + call assert_equal('0:version=0 "2.5"', lines[1]) + call assert_equal('0:startupDone=0', lines[2]) + + call delete("Xnbauth") + call delete("Xnetbeans") +endfunc + +func Test_nb_file_auth() + call ch_log('Test_nb_file_auth') + call s:run_server('Nb_file_auth') +endfunc diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim new file mode 100644 index 0000000000..857294f066 --- /dev/null +++ b/src/testdir/test_normal.vim @@ -0,0 +1,2452 @@ +" Test for various Normal mode commands + +func! Setup_NewWindow() + 10new + call setline(1, range(1,100)) +endfunc + +func! MyFormatExpr() + " Adds '->$' at lines having numbers followed by trailing whitespace + for ln in range(v:lnum, v:lnum+v:count-1) + let line = getline(ln) + if getline(ln) =~# '\d\s\+$' + call setline(ln, substitute(line, '\s\+$', '', '') . '->$') + endif + endfor +endfunc + +func! CountSpaces(type, ...) + " for testing operatorfunc + " will count the number of spaces + " and return the result in g:a + let sel_save = &selection + let &selection = "inclusive" + let reg_save = @@ + + if a:0 " Invoked from Visual mode, use gv command. + silent exe "normal! gvy" + elseif a:type == 'line' + silent exe "normal! '[V']y" + else + silent exe "normal! `[v`]y" + endif + let g:a=strlen(substitute(@@, '[^ ]', '', 'g')) + let &selection = sel_save + let @@ = reg_save +endfunc + +func! OpfuncDummy(type, ...) + " for testing operatorfunc + let g:opt=&linebreak + + if a:0 " Invoked from Visual mode, use gv command. + silent exe "normal! gvy" + elseif a:type == 'line' + silent exe "normal! '[V']y" + else + silent exe "normal! `[v`]y" + endif + " Create a new dummy window + new + let g:bufnr=bufnr('%') +endfunc + +fun! Test_normal00_optrans() + new + call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line']) + 1 + exe "norm! Sfoobar\<esc>" + call assert_equal(['foobar', '2 This is the second line', '3 this is the third line', ''], getline(1,'$')) + 2 + exe "norm! $vbsone" + call assert_equal(['foobar', '2 This is the second one', '3 this is the third line', ''], getline(1,'$')) + norm! VS Second line here + call assert_equal(['foobar', ' Second line here', '3 this is the third line', ''], getline(1, '$')) + %d + call append(0, ['4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line']) + call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line']) + + 1 + norm! 2D + call assert_equal(['3 this is the third line', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$')) + set cpo+=# + norm! 4D + call assert_equal(['', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$')) + + " clean up + set cpo-=# + bw! +endfunc + +func! Test_normal01_keymodel() + call Setup_NewWindow() + " Test 1: depending on 'keymodel' <s-down> does something different + 50 + call feedkeys("V\<S-Up>y", 'tx') + call assert_equal(['47', '48', '49', '50'], getline("'<", "'>")) + set keymodel=startsel + 50 + call feedkeys("V\<S-Up>y", 'tx') + call assert_equal(['49', '50'], getline("'<", "'>")) + " Start visual mode when keymodel = startsel + 50 + call feedkeys("\<S-Up>y", 'tx') + call assert_equal(['49', '5'], getreg(0, 0, 1)) + " Do not start visual mode when keymodel= + set keymodel= + 50 + call feedkeys("\<S-Up>y$", 'tx') + call assert_equal(['42'], getreg(0, 0, 1)) + " Stop visual mode when keymodel=stopsel + set keymodel=stopsel + 50 + call feedkeys("Vkk\<Up>yy", 'tx') + call assert_equal(['47'], getreg(0, 0, 1)) + + set keymodel= + 50 + call feedkeys("Vkk\<Up>yy", 'tx') + call assert_equal(['47', '48', '49', '50'], getreg(0, 0, 1)) + + " clean up + bw! +endfunc + +func! Test_normal02_selectmode() + " some basic select mode tests + call Setup_NewWindow() + 50 + norm! gHy + call assert_equal('y51', getline('.')) + call setline(1, range(1,100)) + 50 + exe ":norm! V9jo\<c-g>y" + call assert_equal('y60', getline('.')) + " clean up + bw! +endfunc + +func! Test_normal02_selectmode2() + " some basic select mode tests + call Setup_NewWindow() + 50 + call feedkeys(":set im\n\<c-o>gHc\<c-o>:set noim\n", 'tx') + call assert_equal('c51', getline('.')) + " clean up + bw! +endfunc + +func! Test_normal03_join() + " basic join test + call Setup_NewWindow() + 50 + norm! VJ + call assert_equal('50 51', getline('.')) + $ + norm! J + call assert_equal('100', getline('.')) + $ + norm! V9-gJ + call assert_equal('919293949596979899100', getline('.')) + call setline(1, range(1,100)) + $ + :j 10 + call assert_equal('100', getline('.')) + " clean up + bw! +endfunc + +func! Test_normal04_filter() + " basic filter test + " only test on non windows platform + if has('win32') + return + endif + call Setup_NewWindow() + 1 + call feedkeys("!!sed -e 's/^/| /'\n", 'tx') + call assert_equal('| 1', getline('.')) + 90 + :sil :!echo one + call feedkeys('.', 'tx') + call assert_equal('| 90', getline('.')) + 95 + set cpo+=! + " 2 <CR>, 1: for executing the command, + " 2: clear hit-enter-prompt + call feedkeys("!!\n", 'tx') + call feedkeys(":!echo one\n\n", 'tx') + call feedkeys(".", 'tx') + call assert_equal('one', getline('.')) + set cpo-=! + bw! +endfunc + +func! Test_normal05_formatexpr() + " basic formatexpr test + call Setup_NewWindow() + %d_ + call setline(1, ['here: 1 ', '2', 'here: 3 ', '4', 'not here: ']) + 1 + set formatexpr=MyFormatExpr() + norm! gqG + call assert_equal(['here: 1->$', '2', 'here: 3->$', '4', 'not here: '], getline(1,'$')) + set formatexpr= + bw! +endfunc + +func Test_normal05_formatexpr_newbuf() + " Edit another buffer in the 'formatexpr' function + new + func! Format() + edit another + endfunc + set formatexpr=Format() + norm gqG + bw! + set formatexpr= +endfunc + +func Test_normal05_formatexpr_setopt() + " Change the 'formatexpr' value in the function + new + func! Format() + set formatexpr= + endfunc + set formatexpr=Format() + norm gqG + bw! + set formatexpr= +endfunc + +func! Test_normal06_formatprg() + " basic test for formatprg + " only test on non windows platform + if has('win32') + return + endif + + " uses sed to number non-empty lines + call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh') + call system('chmod +x ./Xsed_format.sh') + let text = ['a', '', 'c', '', ' ', 'd', 'e'] + let expected = ['1 a', '', '3 c', '', '5 ', '6 d', '7 e'] + + 10new + call setline(1, text) + set formatprg=./Xsed_format.sh + norm! gggqG + call assert_equal(expected, getline(1, '$')) + bw! + + 10new + call setline(1, text) + set formatprg=donothing + setlocal formatprg=./Xsed_format.sh + norm! gggqG + call assert_equal(expected, getline(1, '$')) + bw! + + " clean up + set formatprg= + setlocal formatprg= + call delete('Xsed_format.sh') +endfunc + +func! Test_normal07_internalfmt() + " basic test for internal formmatter to textwidth of 12 + let list=range(1,11) + call map(list, 'v:val." "') + 10new + call setline(1, list) + set tw=12 + norm! gggqG + call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$')) + " clean up + set tw=0 + bw! +endfunc + +func! Test_normal08_fold() + " basic tests for foldopen/folddelete + if !has("folding") + return + endif + call Setup_NewWindow() + 50 + setl foldenable fdm=marker + " First fold + norm! V4jzf + " check that folds have been created + call assert_equal(['50/*{{{*/', '51', '52', '53', '54/*}}}*/'], getline(50,54)) + " Second fold + 46 + norm! V10jzf + " check that folds have been created + call assert_equal('46/*{{{*/', getline(46)) + call assert_equal('60/*}}}*/', getline(60)) + norm! k + call assert_equal('45', getline('.')) + norm! j + call assert_equal('46/*{{{*/', getline('.')) + norm! j + call assert_equal('61', getline('.')) + norm! k + " open a fold + norm! Vzo + norm! k + call assert_equal('45', getline('.')) + norm! j + call assert_equal('46/*{{{*/', getline('.')) + norm! j + call assert_equal('47', getline('.')) + norm! k + norm! zcVzO + call assert_equal('46/*{{{*/', getline('.')) + norm! j + call assert_equal('47', getline('.')) + norm! j + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51', getline('.')) + " delete folds + :46 + " collapse fold + norm! V14jzC + " delete all folds recursively + norm! VzD + call assert_equal(['46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60'], getline(46,60)) + + " clean up + setl nofoldenable fdm=marker + bw! +endfunc + +func! Test_normal09_operatorfunc() + " Test operatorfunc + call Setup_NewWindow() + " Add some spaces for counting + 50,60s/$/ / + unlet! g:a + let g:a=0 + nmap <buffer><silent> ,, :set opfunc=CountSpaces<CR>g@ + vmap <buffer><silent> ,, :<C-U>call CountSpaces(visualmode(), 1)<CR> + 50 + norm V2j,, + call assert_equal(6, g:a) + norm V,, + call assert_equal(2, g:a) + norm ,,l + call assert_equal(0, g:a) + 50 + exe "norm 0\<c-v>10j2l,," + call assert_equal(11, g:a) + 50 + norm V10j,, + call assert_equal(22, g:a) + + " clean up + unmap <buffer> ,, + set opfunc= + unlet! g:a + bw! +endfunc + +func! Test_normal09a_operatorfunc() + " Test operatorfunc + call Setup_NewWindow() + " Add some spaces for counting + 50,60s/$/ / + unlet! g:opt + set linebreak + nmap <buffer><silent> ,, :set opfunc=OpfuncDummy<CR>g@ + 50 + norm ,,j + exe "bd!" g:bufnr + call assert_true(&linebreak) + call assert_equal(g:opt, &linebreak) + set nolinebreak + norm ,,j + exe "bd!" g:bufnr + call assert_false(&linebreak) + call assert_equal(g:opt, &linebreak) + + " clean up + unmap <buffer> ,, + set opfunc= + bw! + unlet! g:opt +endfunc + +func! Test_normal10_expand() + " Test for expand() + 10new + call setline(1, ['1', 'ifooar,,cbar']) + 2 + norm! $ + call assert_equal('cbar', expand('<cword>')) + call assert_equal('ifooar,,cbar', expand('<cWORD>')) + + call setline(1, ['prx = list[idx];']) + 1 + let expected = ['', 'prx', 'prx', 'prx', + \ 'list', 'list', 'list', 'list', 'list', 'list', 'list', + \ 'idx', 'idx', 'idx', 'idx', + \ 'list[idx]', + \ '];', + \ ] + for i in range(1, 16) + exe 'norm ' . i . '|' + call assert_equal(expected[i], expand('<cexpr>'), 'i == ' . i) + endfor + + if executable('echo') + " Test expand(`...`) i.e. backticks command expansion. + " MS-Windows has a trailing space. + call assert_match('^abcde *$', expand('`echo abcde`')) + endif + + " Test expand(`=...`) i.e. backticks expression expansion + call assert_equal('5', expand('`=2+3`')) + + " clean up + bw! +endfunc + +func! Test_normal11_showcmd() + " test for 'showcmd' + 10new + exe "norm! ofoobar\<esc>" + call assert_equal(2, line('$')) + set showcmd + exe "norm! ofoobar2\<esc>" + call assert_equal(3, line('$')) + exe "norm! VAfoobar3\<esc>" + call assert_equal(3, line('$')) + exe "norm! 0d3\<del>2l" + call assert_equal('obar2foobar3', getline('.')) + bw! +endfunc + +func! Test_normal12_nv_error() + " Test for nv_error + 10new + call setline(1, range(1,5)) + " should not do anything, just beep + exe "norm! <c-k>" + call assert_equal(map(range(1,5), 'string(v:val)'), getline(1,'$')) + bw! +endfunc + +func! Test_normal13_help() + " Test for F1 + call assert_equal(1, winnr()) + call feedkeys("\<f1>", 'txi') + call assert_match('help\.txt', bufname('%')) + call assert_equal(2, winnr('$')) + bw! +endfunc + +func! Test_normal14_page() + " basic test for Ctrl-F and Ctrl-B + call Setup_NewWindow() + exe "norm! \<c-f>" + call assert_equal('9', getline('.')) + exe "norm! 2\<c-f>" + call assert_equal('25', getline('.')) + exe "norm! 2\<c-b>" + call assert_equal('18', getline('.')) + 1 + set scrolloff=5 + exe "norm! 2\<c-f>" + call assert_equal('21', getline('.')) + exe "norm! \<c-b>" + call assert_equal('13', getline('.')) + 1 + set scrolloff=99 + exe "norm! \<c-f>" + call assert_equal('13', getline('.')) + set scrolloff=0 + 100 + exe "norm! $\<c-b>" + call assert_equal('92', getline('.')) + call assert_equal([0, 92, 1, 0, 1], getcurpos()) + 100 + set nostartofline + exe "norm! $\<c-b>" + call assert_equal('92', getline('.')) + call assert_equal([0, 92, 2, 0, 2147483647], getcurpos()) + " cleanup + set startofline + bw! +endfunc + +func! Test_normal14_page_eol() + 10new + norm oxxxxxxx + exe "norm 2\<c-f>" + " check with valgrind that cursor is put back in column 1 + exe "norm 2\<c-b>" + bw! +endfunc + +func! Test_normal15_z_scroll_vert() + " basic test for z commands that scroll the window + call Setup_NewWindow() + 100 + norm! >> + " Test for z<cr> + exe "norm! z\<cr>" + call assert_equal(' 100', getline('.')) + call assert_equal(100, winsaveview()['topline']) + call assert_equal([0, 100, 2, 0, 9], getcurpos()) + + " Test for zt + 21 + norm! >>0zt + call assert_equal(' 21', getline('.')) + call assert_equal(21, winsaveview()['topline']) + call assert_equal([0, 21, 1, 0, 8], getcurpos()) + + " Test for zb + 30 + norm! >>$ztzb + call assert_equal(' 30', getline('.')) + call assert_equal(30, winsaveview()['topline']+winheight(0)-1) + call assert_equal([0, 30, 3, 0, 2147483647], getcurpos()) + + " Test for z- + 1 + 30 + norm! 0z- + call assert_equal(' 30', getline('.')) + call assert_equal(30, winsaveview()['topline']+winheight(0)-1) + call assert_equal([0, 30, 2, 0, 9], getcurpos()) + + " Test for z{height}<cr> + call assert_equal(10, winheight(0)) + exe "norm! z12\<cr>" + call assert_equal(12, winheight(0)) + exe "norm! z10\<cr>" + call assert_equal(10, winheight(0)) + + " Test for z. + 1 + 21 + norm! 0z. + call assert_equal(' 21', getline('.')) + call assert_equal(17, winsaveview()['topline']) + call assert_equal([0, 21, 2, 0, 9], getcurpos()) + + " Test for zz + 1 + 21 + norm! 0zz + call assert_equal(' 21', getline('.')) + call assert_equal(17, winsaveview()['topline']) + call assert_equal([0, 21, 1, 0, 8], getcurpos()) + + " Test for z+ + 11 + norm! zt + norm! z+ + call assert_equal(' 21', getline('.')) + call assert_equal(21, winsaveview()['topline']) + call assert_equal([0, 21, 2, 0, 9], getcurpos()) + + " Test for [count]z+ + 1 + norm! 21z+ + call assert_equal(' 21', getline('.')) + call assert_equal(21, winsaveview()['topline']) + call assert_equal([0, 21, 2, 0, 9], getcurpos()) + + " Test for z^ + norm! 22z+0 + norm! z^ + call assert_equal(' 21', getline('.')) + call assert_equal(12, winsaveview()['topline']) + call assert_equal([0, 21, 2, 0, 9], getcurpos()) + + " Test for [count]z^ + 1 + norm! 30z^ + call assert_equal(' 21', getline('.')) + call assert_equal(12, winsaveview()['topline']) + call assert_equal([0, 21, 2, 0, 9], getcurpos()) + + " cleanup + bw! +endfunc + +func! Test_normal16_z_scroll_hor() + " basic test for z commands that scroll the window + 10new + 15vsp + set nowrap listchars= + let lineA='abcdefghijklmnopqrstuvwxyz' + let lineB='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + $put =lineA + $put =lineB + 1d + + " Test for zl + 1 + norm! 5zl + call assert_equal(lineA, getline('.')) + call assert_equal(6, col('.')) + call assert_equal(5, winsaveview()['leftcol']) + norm! yl + call assert_equal('f', @0) + + " Test for zh + norm! 2zh + call assert_equal(lineA, getline('.')) + call assert_equal(6, col('.')) + norm! yl + call assert_equal('f', @0) + call assert_equal(3, winsaveview()['leftcol']) + + " Test for zL + norm! zL + call assert_equal(11, col('.')) + norm! yl + call assert_equal('k', @0) + call assert_equal(10, winsaveview()['leftcol']) + norm! 2zL + call assert_equal(25, col('.')) + norm! yl + call assert_equal('y', @0) + call assert_equal(24, winsaveview()['leftcol']) + + " Test for zH + norm! 2zH + call assert_equal(25, col('.')) + call assert_equal(10, winsaveview()['leftcol']) + norm! yl + call assert_equal('y', @0) + + " Test for zs + norm! $zs + call assert_equal(26, col('.')) + call assert_equal(25, winsaveview()['leftcol']) + norm! yl + call assert_equal('z', @0) + + " Test for ze + norm! ze + call assert_equal(26, col('.')) + call assert_equal(11, winsaveview()['leftcol']) + norm! yl + call assert_equal('z', @0) + + " cleanup + set wrap listchars=eol:$ + bw! +endfunc + +func! Test_normal17_z_scroll_hor2() + " basic test for z commands that scroll the window + " using 'sidescrolloff' setting + 10new + 20vsp + set nowrap listchars= sidescrolloff=5 + let lineA='abcdefghijklmnopqrstuvwxyz' + let lineB='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + $put =lineA + $put =lineB + 1d + + " Test for zl + 1 + norm! 5zl + call assert_equal(lineA, getline('.')) + call assert_equal(11, col('.')) + call assert_equal(5, winsaveview()['leftcol']) + norm! yl + call assert_equal('k', @0) + + " Test for zh + norm! 2zh + call assert_equal(lineA, getline('.')) + call assert_equal(11, col('.')) + norm! yl + call assert_equal('k', @0) + call assert_equal(3, winsaveview()['leftcol']) + + " Test for zL + norm! 0zL + call assert_equal(16, col('.')) + norm! yl + call assert_equal('p', @0) + call assert_equal(10, winsaveview()['leftcol']) + norm! 2zL + call assert_equal(26, col('.')) + norm! yl + call assert_equal('z', @0) + call assert_equal(15, winsaveview()['leftcol']) + + " Test for zH + norm! 2zH + call assert_equal(15, col('.')) + call assert_equal(0, winsaveview()['leftcol']) + norm! yl + call assert_equal('o', @0) + + " Test for zs + norm! $zs + call assert_equal(26, col('.')) + call assert_equal(20, winsaveview()['leftcol']) + norm! yl + call assert_equal('z', @0) + + " Test for ze + norm! ze + call assert_equal(26, col('.')) + call assert_equal(11, winsaveview()['leftcol']) + norm! yl + call assert_equal('z', @0) + + " cleanup + set wrap listchars=eol:$ sidescrolloff=0 + bw! +endfunc + +func! Test_normal18_z_fold() + " basic tests for foldopen/folddelete + if !has("folding") + return + endif + call Setup_NewWindow() + 50 + setl foldenable fdm=marker foldlevel=5 + + " Test for zF + " First fold + norm! 4zF + " check that folds have been created + call assert_equal(['50/*{{{*/', '51', '52', '53/*}}}*/'], getline(50,53)) + + " Test for zd + 51 + norm! 2zF + call assert_equal(2, foldlevel('.')) + norm! kzd + call assert_equal(['50', '51/*{{{*/', '52/*}}}*/', '53'], getline(50,53)) + norm! j + call assert_equal(1, foldlevel('.')) + + " Test for zD + " also deletes partially selected folds recursively + 51 + norm! zF + call assert_equal(2, foldlevel('.')) + norm! kV2jzD + call assert_equal(['50', '51', '52', '53'], getline(50,53)) + + " Test for zE + 85 + norm! 4zF + 86 + norm! 2zF + 90 + norm! 4zF + call assert_equal(['85/*{{{*/', '86/*{{{*/', '87/*}}}*/', '88/*}}}*/', '89', '90/*{{{*/', '91', '92', '93/*}}}*/'], getline(85,93)) + norm! zE + call assert_equal(['85', '86', '87', '88', '89', '90', '91', '92', '93'], getline(85,93)) + + " Test for zn + 50 + set foldlevel=0 + norm! 2zF + norm! zn + norm! k + call assert_equal('49', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + call assert_equal(0, &foldenable) + + " Test for zN + 49 + norm! zN + call assert_equal('49', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + call assert_equal(1, &foldenable) + + " Test for zi + norm! zi + call assert_equal(0, &foldenable) + norm! zi + call assert_equal(1, &foldenable) + norm! zi + call assert_equal(0, &foldenable) + norm! zi + call assert_equal(1, &foldenable) + + " Test for za + 50 + norm! za + norm! k + call assert_equal('49', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + 50 + norm! za + norm! k + call assert_equal('49', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + + 49 + norm! 5zF + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + 49 + norm! za + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + set nofoldenable + " close fold and set foldenable + norm! za + call assert_equal(1, &foldenable) + + 50 + " have to use {count}za to open all folds and make the cursor visible + norm! 2za + norm! 2k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + + " Test for zA + 49 + set foldlevel=0 + 50 + norm! zA + norm! 2k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + + " zA on a opened fold when foldenable is not set + 50 + set nofoldenable + norm! zA + call assert_equal(1, &foldenable) + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zc + norm! zE + 50 + norm! 2zF + 49 + norm! 5zF + set nofoldenable + 50 + " There most likely is a bug somewhere: + " https://groups.google.com/d/msg/vim_dev/v2EkfJ_KQjI/u-Cvv94uCAAJ + " TODO: Should this only close the inner most fold or both folds? + norm! zc + call assert_equal(1, &foldenable) + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + set nofoldenable + 50 + norm! Vjzc + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zC + set nofoldenable + 50 + norm! zCk + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zx + " 1) close folds at line 49-54 + set nofoldenable + 48 + norm! zx + call assert_equal(1, &foldenable) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " 2) do not close fold under cursor + 51 + set nofoldenable + norm! zx + call assert_equal(1, &foldenable) + norm! 3k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + norm! j + call assert_equal('53', getline('.')) + norm! j + call assert_equal('54/*}}}*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " 3) close one level of folds + 48 + set nofoldenable + set foldlevel=1 + norm! zx + call assert_equal(1, &foldenable) + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + norm! j + call assert_equal('53', getline('.')) + norm! j + call assert_equal('54/*}}}*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zX + " Close all folds + set foldlevel=0 nofoldenable + 50 + norm! zX + call assert_equal(1, &foldenable) + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zm + 50 + set nofoldenable foldlevel=2 + norm! zm + call assert_equal(1, &foldenable) + call assert_equal(1, &foldlevel) + norm! zm + call assert_equal(0, &foldlevel) + norm! zm + call assert_equal(0, &foldlevel) + norm! k + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zM + 48 + set nofoldenable foldlevel=99 + norm! zM + call assert_equal(1, &foldenable) + call assert_equal(0, &foldlevel) + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('55', getline('.')) + + " Test for zr + 48 + set nofoldenable foldlevel=0 + norm! zr + call assert_equal(0, &foldenable) + call assert_equal(1, &foldlevel) + set foldlevel=0 foldenable + norm! zr + call assert_equal(1, &foldenable) + call assert_equal(1, &foldlevel) + norm! zr + call assert_equal(2, &foldlevel) + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + + " Test for zR + 48 + set nofoldenable foldlevel=0 + norm! zR + call assert_equal(0, &foldenable) + call assert_equal(2, &foldlevel) + set foldenable foldlevel=0 + norm! zR + call assert_equal(1, &foldenable) + call assert_equal(2, &foldlevel) + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + call append(50, ['a /*{{{*/', 'b /*}}}*/']) + 48 + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('a /*{{{*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + 48 + norm! zR + call assert_equal(1, &foldenable) + call assert_equal(3, &foldlevel) + call assert_equal('48', getline('.')) + norm! j + call assert_equal('49/*{{{*/', getline('.')) + norm! j + call assert_equal('50/*{{{*/', getline('.')) + norm! j + call assert_equal('a /*{{{*/', getline('.')) + norm! j + call assert_equal('b /*}}}*/', getline('.')) + norm! j + call assert_equal('51/*}}}*/', getline('.')) + norm! j + call assert_equal('52', getline('.')) + + " clean up + setl nofoldenable fdm=marker foldlevel=0 + bw! +endfunc + +func! Test_normal19_z_spell() + if !has("spell") || !has('syntax') + return + endif + new + call append(0, ['1 good', '2 goood', '3 goood']) + set spell spellfile=./Xspellfile.add spelllang=en + let oldlang=v:lang + lang C + + " Test for zg + 1 + norm! ]s + call assert_equal('2 goood', getline('.')) + norm! zg + 1 + let a=execute('unsilent :norm! ]s') + call assert_equal('1 good', getline('.')) + call assert_equal('search hit BOTTOM, continuing at TOP', a[1:]) + let cnt=readfile('./Xspellfile.add') + call assert_equal('goood', cnt[0]) + + " Test for zw + 2 + norm! $zw + 1 + norm! ]s + call assert_equal('2 goood', getline('.')) + let cnt=readfile('./Xspellfile.add') + call assert_equal('#oood', cnt[0]) + call assert_equal('goood/!', cnt[1]) + + " Test for zg in visual mode + let a=execute('unsilent :norm! V$zg') + call assert_equal("Word '2 goood' added to ./Xspellfile.add", a[1:]) + 1 + norm! ]s + call assert_equal('3 goood', getline('.')) + let cnt=readfile('./Xspellfile.add') + call assert_equal('2 goood', cnt[2]) + " Remove "2 good" from spellfile + 2 + let a=execute('unsilent norm! V$zw') + call assert_equal("Word '2 goood' added to ./Xspellfile.add", a[1:]) + let cnt=readfile('./Xspellfile.add') + call assert_equal('2 goood/!', cnt[3]) + + " Test for zG + let a=execute('unsilent norm! V$zG') + call assert_match("Word '2 goood' added to .*", a) + let fname=matchstr(a, 'to\s\+\zs\f\+$') + let cnt=readfile(fname) + call assert_equal('2 goood', cnt[0]) + + " Test for zW + let a=execute('unsilent norm! V$zW') + call assert_match("Word '2 goood' added to .*", a) + let cnt=readfile(fname) + call assert_equal('# goood', cnt[0]) + call assert_equal('2 goood/!', cnt[1]) + + " Test for zuW + let a=execute('unsilent norm! V$zuW') + call assert_match("Word '2 goood' removed from .*", a) + let cnt=readfile(fname) + call assert_equal('# goood', cnt[0]) + call assert_equal('# goood/!', cnt[1]) + + " Test for zuG + let a=execute('unsilent norm! $zG') + call assert_match("Word 'goood' added to .*", a) + let cnt=readfile(fname) + call assert_equal('# goood', cnt[0]) + call assert_equal('# goood/!', cnt[1]) + call assert_equal('goood', cnt[2]) + let a=execute('unsilent norm! $zuG') + let cnt=readfile(fname) + call assert_match("Word 'goood' removed from .*", a) + call assert_equal('# goood', cnt[0]) + call assert_equal('# goood/!', cnt[1]) + call assert_equal('#oood', cnt[2]) + " word not found in wordlist + let a=execute('unsilent norm! V$zuG') + let cnt=readfile(fname) + call assert_match("", a) + call assert_equal('# goood', cnt[0]) + call assert_equal('# goood/!', cnt[1]) + call assert_equal('#oood', cnt[2]) + + " Test for zug + call delete('./Xspellfile.add') + 2 + let a=execute('unsilent norm! $zg') + let cnt=readfile('./Xspellfile.add') + call assert_equal('goood', cnt[0]) + let a=execute('unsilent norm! $zug') + call assert_match("Word 'goood' removed from \./Xspellfile.add", a) + let cnt=readfile('./Xspellfile.add') + call assert_equal('#oood', cnt[0]) + " word not in wordlist + let a=execute('unsilent norm! V$zug') + call assert_match('', a) + let cnt=readfile('./Xspellfile.add') + call assert_equal('#oood', cnt[0]) + + " Test for zuw + call delete('./Xspellfile.add') + 2 + let a=execute('unsilent norm! Vzw') + let cnt=readfile('./Xspellfile.add') + call assert_equal('2 goood/!', cnt[0]) + let a=execute('unsilent norm! Vzuw') + call assert_match("Word '2 goood' removed from \./Xspellfile.add", a) + let cnt=readfile('./Xspellfile.add') + call assert_equal('# goood/!', cnt[0]) + " word not in wordlist + let a=execute('unsilent norm! $zug') + call assert_match('', a) + let cnt=readfile('./Xspellfile.add') + call assert_equal('# goood/!', cnt[0]) + + " add second entry to spellfile setting + set spellfile=./Xspellfile.add,./Xspellfile2.add + call delete('./Xspellfile.add') + 2 + let a=execute('unsilent norm! $2zg') + let cnt=readfile('./Xspellfile2.add') + call assert_match("Word 'goood' added to ./Xspellfile2.add", a) + call assert_equal('goood', cnt[0]) + + " Test for :spellgood! + let temp = execute(':spe!0/0') + call assert_match('Invalid region', temp) + let spellfile = matchstr(temp, 'Invalid region nr in \zs.*\ze line \d: 0') + call assert_equal(['# goood', '# goood/!', '#oood', '0/0'], readfile(spellfile)) + call delete(spellfile) + + " clean up + exe "lang" oldlang + call delete("./Xspellfile.add") + call delete("./Xspellfile2.add") + call delete("./Xspellfile.add.spl") + call delete("./Xspellfile2.add.spl") + + " zux -> no-op + 2 + norm! $zux + call assert_equal([], glob('Xspellfile.add',0,1)) + call assert_equal([], glob('Xspellfile2.add',0,1)) + + set spellfile= + bw! +endfunc + +func! Test_normal20_exmode() + if !has("unix") + " Reading from redirected file doesn't work on MS-Windows + return + endif + call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript') + call writefile(['1', '2'], 'Xfile') + call system(v:progpath .' -e -s < Xscript Xfile') + let a=readfile('Xfile2') + call assert_equal(['1', 'foo', 'bar', '2'], a) + + " clean up + for file in ['Xfile', 'Xfile2', 'Xscript'] + call delete(file) + endfor + bw! +endfunc + +func! Test_normal21_nv_hat() + set hidden + new + " to many buffers opened already, will not work + "call assert_fails(":b#", 'E23') + "call assert_equal('', @#) + e Xfoobar + e Xfile2 + call feedkeys("\<c-^>", 't') + call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t')) + call feedkeys("f\<c-^>", 't') + call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t')) + " clean up + set nohidden + bw! +endfunc + +func! Test_normal22_zet() + " Test for ZZ + " let shell = &shell + " let &shell = 'sh' + call writefile(['1', '2'], 'Xfile') + let args = ' -u NONE -N -U NONE -i NONE --noplugins -X --not-a-term' + call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile') + let a = readfile('Xfile') + call assert_equal([], a) + " Test for ZQ + call writefile(['1', '2'], 'Xfile') + call system(v:progpath . args . ' -c "%d" -c ":norm! ZQ" Xfile') + let a = readfile('Xfile') + call assert_equal(['1', '2'], a) + + " clean up + for file in ['Xfile'] + call delete(file) + endfor + " let &shell = shell +endfunc + +func! Test_normal23_K() + " Test for K command + new + call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd']) + let k = &keywordprg + set keywordprg=:help + 1 + norm! VK + call assert_equal('version8.txt', fnamemodify(bufname('%'), ':t')) + call assert_equal('help', &ft) + call assert_match('\*version8.txt\*', getline('.')) + helpclose + norm! 0K + call assert_equal('version8.txt', fnamemodify(bufname('%'), ':t')) + call assert_equal('help', &ft) + call assert_match('\*version8\.\d\*', getline('.')) + helpclose + + set keywordprg=:new + set iskeyword+=% + set iskeyword+=\| + 2 + norm! K + call assert_equal('man', fnamemodify(bufname('%'), ':t')) + bwipe! + 3 + norm! K + call assert_equal('aa%bb', fnamemodify(bufname('%'), ':t')) + bwipe! + if !has('win32') + 4 + norm! K + call assert_equal('cc|dd', fnamemodify(bufname('%'), ':t')) + bwipe! + endif + set iskeyword-=% + set iskeyword-=\| + + " Only expect "man" to work on Unix + if !has("unix") + let &keywordprg = k + bw! + return + endif + set keywordprg=man\ --pager=cat + " Test for using man + 2 + let a = execute('unsilent norm! K') + call assert_match("man --pager=cat 'man'", a) + + " clean up + let &keywordprg = k + bw! +endfunc + +func! Test_normal24_rot13() + " This test uses multi byte characters + if !has("multi_byte") + return + endif + " Testing for g?? g?g? + new + call append(0, 'abcdefghijklmnopqrstuvwxyzäüö') + 1 + norm! g?? + call assert_equal('nopqrstuvwxyzabcdefghijklmäüö', getline('.')) + norm! g?g? + call assert_equal('abcdefghijklmnopqrstuvwxyzäüö', getline('.')) + + " clean up + bw! +endfunc + +func! Test_normal25_tag() + " Testing for CTRL-] g CTRL-] g] + " CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-] + h + " Test for CTRL-] + call search('\<x\>$') + exe "norm! \<c-]>" + call assert_equal("change.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*x*", @0) + exe ":norm \<c-o>" + + " Test for g_CTRL-] + call search('\<v_u\>$') + exe "norm! g\<c-]>" + call assert_equal("change.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*v_u*", @0) + exe ":norm \<c-o>" + + " Test for g] + call search('\<i_<Esc>$') + let a = execute(":norm! g]") + call assert_match('i_<Esc>.*insert.txt', a) + + if !empty(exepath('cscope')) && has('cscope') + " setting cscopetag changes how g] works + set cst + exe "norm! g]" + call assert_equal("insert.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*i_<Esc>*", @0) + exe ":norm \<c-o>" + " Test for CTRL-W g] + exe "norm! \<C-W>g]" + call assert_equal("insert.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*i_<Esc>*", @0) + call assert_equal(3, winnr('$')) + helpclose + set nocst + endif + + " Test for CTRL-W g] + let a = execute("norm! \<C-W>g]") + call assert_match('i_<Esc>.*insert.txt', a) + + " Test for CTRL-W CTRL-] + exe "norm! \<C-W>\<C-]>" + call assert_equal("insert.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*i_<Esc>*", @0) + call assert_equal(3, winnr('$')) + helpclose + + " Test for CTRL-W g CTRL-] + exe "norm! \<C-W>g\<C-]>" + call assert_equal("insert.txt", fnamemodify(bufname('%'), ':t')) + norm! yiW + call assert_equal("*i_<Esc>*", @0) + call assert_equal(3, winnr('$')) + helpclose + + " clean up + helpclose +endfunc + +func! Test_normal26_put() + " Test for ]p ]P [p and [P + new + call append(0, ['while read LINE', 'do', ' ((count++))', ' if [ $? -ne 0 ]; then', " echo 'Error writing file'", ' fi', 'done']) + 1 + /Error/y a + 2 + norm! "a]pj"a[p + call assert_equal(['do', "echo 'Error writing file'", " echo 'Error writing file'", ' ((count++))'], getline(2,5)) + 1 + /^\s\{4}/ + exe "norm! \"a]P3Eldt'" + exe "norm! j\"a[P2Eldt'" + call assert_equal([' if [ $? -ne 0 ]; then', " echo 'Error writing'", " echo 'Error'", " echo 'Error writing file'", ' fi'], getline(6,10)) + + " clean up + bw! +endfunc + +func! Test_normal27_bracket() + " Test for [' [` ]' ]` + call Setup_NewWindow() + 1,21s/.\+/ & b/ + 1 + norm! $ma + 5 + norm! $mb + 10 + norm! $mc + 15 + norm! $md + 20 + norm! $me + + " Test for [' + 9 + norm! 2[' + call assert_equal(' 1 b', getline('.')) + call assert_equal(1, line('.')) + call assert_equal(3, col('.')) + + " Test for ]' + norm! ]' + call assert_equal(' 5 b', getline('.')) + call assert_equal(5, line('.')) + call assert_equal(3, col('.')) + + " No mark after line 21, cursor moves to first non blank on current line + 21 + norm! $]' + call assert_equal(' 21 b', getline('.')) + call assert_equal(21, line('.')) + call assert_equal(3, col('.')) + + " Test for [` + norm! 2[` + call assert_equal(' 15 b', getline('.')) + call assert_equal(15, line('.')) + call assert_equal(8, col('.')) + + " Test for ]` + norm! ]` + call assert_equal(' 20 b', getline('.')) + call assert_equal(20, line('.')) + call assert_equal(8, col('.')) + + " clean up + bw! +endfunc + +func! Test_normal28_parenthesis() + " basic testing for ( and ) + new + call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here']) + + $ + norm! d( + call assert_equal(['This is a test. With some sentences!', '', 'Even with a question? And one more. ', ''], getline(1, '$')) + norm! 2d( + call assert_equal(['This is a test. With some sentences!', '', ' ', ''], getline(1, '$')) + 1 + norm! 0d) + call assert_equal(['With some sentences!', '', ' ', ''], getline(1, '$')) + + call append('$', ['This is a long sentence', '', 'spanning', 'over several lines. ']) + $ + norm! $d( + call assert_equal(['With some sentences!', '', ' ', '', 'This is a long sentence', ''], getline(1, '$')) + + " clean up + bw! +endfunc + +fun! Test_normal29_brace() + " basic test for { and } movements + let text= ['A paragraph begins after each empty line, and also at each of a set of', + \ 'paragraph macros, specified by the pairs of characters in the ''paragraphs''', + \ 'option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to', + \ 'the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in', + \ 'the first column). A section boundary is also a paragraph boundary.', + \ 'Note that a blank line (only containing white space) is NOT a paragraph', + \ 'boundary.', + \ '', + \ '', + \ 'Also note that this does not include a ''{'' or ''}'' in the first column. When', + \ 'the ''{'' flag is in ''cpoptions'' then ''{'' in the first column is used as a', + \ 'paragraph boundary |posix|.', + \ '{', + \ 'This is no paragraph', + \ 'unless the ''{'' is set', + \ 'in ''cpoptions''', + \ '}', + \ '.IP', + \ 'The nroff macros IP separates a paragraph', + \ 'That means, it must be a ''.''', + \ 'followed by IP', + \ '.LPIt does not matter, if afterwards some', + \ 'more characters follow.', + \ '.SHAlso section boundaries from the nroff', + \ 'macros terminate a paragraph. That means', + \ 'a character like this:', + \ '.NH', + \ 'End of text here'] + new + call append(0, text) + 1 + norm! 0d2} + call assert_equal(['.IP', + \ 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', 'followed by IP', + \ '.LPIt does not matter, if afterwards some', 'more characters follow.', '.SHAlso section boundaries from the nroff', + \ 'macros terminate a paragraph. That means', 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + norm! 0d} + call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', + \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', + \ 'a character like this:', '.NH', 'End of text here', ''], getline(1, '$')) + $ + norm! d{ + call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', + \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', 'a character like this:', ''], getline(1, '$')) + norm! d{ + call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', ''], getline(1,'$')) + " Test with { in cpooptions + %d + call append(0, text) + set cpo+={ + 1 + norm! 0d2} + call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', + \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', + \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', + \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', + \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + $ + norm! d} + call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', + \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', + \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', + \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', + \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + norm! gg} + norm! d5} + call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$')) + + " clean up + set cpo-={ + bw! +endfunc + +fun! Test_normal30_changecase() + " This test uses multi byte characters + if !has("multi_byte") + return + endif + new + call append(0, 'This is a simple test: äüöß') + norm! 1ggVu + call assert_equal('this is a simple test: äüöß', getline('.')) + norm! VU + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + norm! guu + call assert_equal('this is a simple test: äüöss', getline('.')) + norm! gUgU + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + norm! gugu + call assert_equal('this is a simple test: äüöss', getline('.')) + norm! gUU + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + norm! 010~ + call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.')) + norm! V~ + call assert_equal('THIS IS A simple test: äüöss', getline('.')) + + " Turkish ASCII turns to multi-byte. On Mac the Turkish locale is available + " but toupper()/tolower() don't do the right thing. + if !has('mac') && !has('osx') + try + lang tr_TR.UTF-8 + set casemap= + call setline(1, 'iI') + 1normal gUU + call assert_equal("\u0130I", getline(1)) + call assert_equal("\u0130I", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("i\u0131", getline(1)) + call assert_equal("i\u0131", tolower("iI")) + + set casemap& + call setline(1, 'iI') + 1normal gUU + call assert_equal("II", getline(1)) + call assert_equal("II", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("ii", getline(1)) + call assert_equal("ii", tolower("iI")) + + lang en_US.UTF-8 + catch /E197:/ + " can't use Turkish locale + throw 'Skipped: Turkish locale not available' + endtry + endif + + " clean up + bw! +endfunc + +fun! Test_normal31_r_cmd() + " Test for r command + new + call append(0, 'This is a simple test: abcd') + exe "norm! 1gg$r\<cr>" + call assert_equal(['This is a simple test: abc', '', ''], getline(1,'$')) + exe "norm! 1gg2wlr\<cr>" + call assert_equal(['This is a', 'simple test: abc', '', ''], getline(1,'$')) + exe "norm! 2gg0W5r\<cr>" + call assert_equal(['This is a', 'simple ', ' abc', '', ''], getline('1', '$')) + set autoindent + call setline(2, ['simple test: abc', '']) + exe "norm! 2gg0W5r\<cr>" + call assert_equal(['This is a', 'simple ', 'abc', '', '', ''], getline('1', '$')) + exe "norm! 1ggVr\<cr>" + call assert_equal('^M^M^M^M^M^M^M^M^M', strtrans(getline(1))) + call setline(1, 'This is a') + exe "norm! 1gg05rf" + call assert_equal('fffffis a', getline(1)) + + " clean up + set noautoindent + bw! +endfunc + +func! Test_normal32_g_cmd1() + " Test for g*, g# + new + call append(0, ['abc.x_foo', 'x_foobar.abc']) + 1 + norm! $g* + call assert_equal('x_foo', @/) + call assert_equal('x_foobar.abc', getline('.')) + norm! $g# + call assert_equal('abc', @/) + call assert_equal('abc.x_foo', getline('.')) + + " clean up + bw! +endfunc + +fun! Test_normal33_g_cmd2() + if !has("jumplist") + return + endif + " Tests for g cmds + call Setup_NewWindow() + " Test for g` + clearjumps + norm! ma10j + let a=execute(':jumps') + " empty jumplist + call assert_equal('>', a[-1:]) + norm! g`a + call assert_equal('>', a[-1:]) + call assert_equal(1, line('.')) + call assert_equal('1', getline('.')) + + " Test for g; and g, + norm! g; + " there is only one change in the changelist + " currently, when we setup the window + call assert_equal(2, line('.')) + call assert_fails(':norm! g;', 'E662') + call assert_fails(':norm! g,', 'E663') + let &ul=&ul + call append('$', ['a', 'b', 'c', 'd']) + let &ul=&ul + call append('$', ['Z', 'Y', 'X', 'W']) + let a = execute(':changes') + call assert_match('2\s\+0\s\+2', a) + call assert_match('101\s\+0\s\+a', a) + call assert_match('105\s\+0\s\+Z', a) + norm! 3g; + call assert_equal(2, line('.')) + norm! 2g, + call assert_equal(105, line('.')) + + " Test for g& - global substitute + %d + call setline(1, range(1,10)) + call append('$', ['a', 'b', 'c', 'd']) + $s/\w/&&/g + exe "norm! /[1-8]\<cr>" + norm! g& + call assert_equal(['11', '22', '33', '44', '55', '66', '77', '88', '9', '110', 'a', 'b', 'c', 'dd'], getline(1, '$')) + + " Test for gv + %d + call append('$', repeat(['abcdefgh'], 8)) + exe "norm! 2gg02l\<c-v>2j2ly" + call assert_equal(['cde', 'cde', 'cde'], getreg(0, 1, 1)) + " in visual mode, gv swaps current and last selected region + exe "norm! G0\<c-v>4k4lgvd" + call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh'], getline(1,'$')) + exe "norm! G0\<c-v>4k4ly" + exe "norm! gvood" + call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'fgh', 'fgh', 'fgh', 'fgh', 'fgh'], getline(1,'$')) + + " Test for gk/gj + %d + 15vsp + set wrap listchars= sbr= + let lineA='abcdefghijklmnopqrstuvwxyz' + let lineB='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + $put =lineA + $put =lineB + + norm! 3gg0dgk + call assert_equal(['', 'abcdefghijklmno', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'], getline(1, '$')) + set nu + norm! 3gg0gjdgj + call assert_equal(['', 'abcdefghijklmno', '0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) + + " Test for gJ + norm! 2gggJ + call assert_equal(['', 'abcdefghijklmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) + call assert_equal(16, col('.')) + " shouldn't do anything + norm! 10gJ + call assert_equal(1, col('.')) + + " Test for g0 g^ gm g$ + exe "norm! 2gg0gji " + call assert_equal(['', 'abcdefghijk lmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) + norm! g0yl + call assert_equal(12, col('.')) + call assert_equal(' ', getreg(0)) + norm! g$yl + call assert_equal(22, col('.')) + call assert_equal('3', getreg(0)) + norm! gmyl + call assert_equal(17, col('.')) + call assert_equal('n', getreg(0)) + norm! g^yl + call assert_equal(15, col('.')) + call assert_equal('l', getreg(0)) + + " Test for g Ctrl-G + set ff=unix + let a=execute(":norm! g\<c-g>") + call assert_match('Col 15 of 43; Line 2 of 2; Word 2 of 2; Byte 16 of 45', a) + + " Test for gI + norm! gIfoo + call assert_equal(['', 'fooabcdefghijk lmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) + + " Test for gi + wincmd c + %d + set tw=0 + call setline(1, ['foobar', 'new line']) + norm! A next word + $put ='third line' + norm! gi another word + call assert_equal(['foobar next word another word', 'new line', 'third line'], getline(1,'$')) + + " clean up + bw! +endfunc + +fun! Test_normal34_g_cmd3() + if !has("multi_byte") + return + endif + + " Test for g8 + new + let a=execute(':norm! 1G0g8') + call assert_equal("\nNUL", a) + + call setline(1, 'abcdefghijklmnopqrstuvwxyzäüö') + let a=execute(':norm! 1G$g8') + call assert_equal("\nc3 b6 ", a) + + call setline(1, "a\u0302") + let a=execute(':norm! 1G0g8') + call assert_equal("\n61 + cc 82 ", a) + + " clean up + bw! +endfunc + +func Test_normal_8g8() + if !has("multi_byte") + return + endif + new + + " Test 8g8 which finds invalid utf8 at or after the cursor. + + " With invalid byte. + call setline(1, "___\xff___") + norm! 1G08g8g + call assert_equal([0, 1, 4, 0, 1], getcurpos()) + + " With invalid byte before the cursor. + call setline(1, "___\xff___") + norm! 1G$h8g8g + call assert_equal([0, 1, 6, 0, 9], getcurpos()) + + " With truncated sequence. + call setline(1, "___\xE2\x82___") + norm! 1G08g8g + call assert_equal([0, 1, 4, 0, 1], getcurpos()) + + " With overlong sequence. + call setline(1, "___\xF0\x82\x82\xAC___") + norm! 1G08g8g + call assert_equal([0, 1, 4, 0, 1], getcurpos()) + + " With valid utf8. + call setline(1, "café") + norm! 1G08g8 + call assert_equal([0, 1, 1, 0, 1], getcurpos()) + + bw! +endfunc + +fun! Test_normal35_g_cmd4() + " Test for g< + " Cannot capture its output, + " probably a bug, therefore, test disabled: + throw "Skipped: output of g< can't be tested currently" + echo "a\nb\nc\nd" + let b=execute(':norm! g<') + call assert_true(!empty(b), 'failed `execute(g<)`') +endfunc + +fun! Test_normal36_g_cmd5() + new + call append(0, 'abcdefghijklmnopqrstuvwxyz') + set ff=unix + " Test for gp gP + call append(1, range(1,10)) + 1 + norm! 1yy + 3 + norm! gp + call assert_equal([0, 5, 1, 0, 1], getcurpos()) + $ + norm! gP + call assert_equal([0, 14, 1, 0, 1], getcurpos()) + + " Test for go + norm! 26go + call assert_equal([0, 1, 26, 0, 26], getcurpos()) + norm! 27go + call assert_equal([0, 1, 26, 0, 26], getcurpos()) + norm! 28go + call assert_equal([0, 2, 1, 0, 1], getcurpos()) + set ff=dos + norm! 29go + call assert_equal([0, 2, 1, 0, 1], getcurpos()) + set ff=unix + norm! gg0 + norm! 101go + call assert_equal([0, 13, 26, 0, 26], getcurpos()) + norm! 103go + call assert_equal([0, 14, 1, 0, 1], getcurpos()) + " count > buffer content + norm! 120go + call assert_equal([0, 14, 1, 0, 2147483647], getcurpos()) + " clean up + bw! +endfunc + +fun! Test_normal37_g_cmd6() + " basic test for gt and gT + tabnew 1.txt + tabnew 2.txt + tabnew 3.txt + norm! 1gt + call assert_equal(1, tabpagenr()) + norm! 3gt + call assert_equal(3, tabpagenr()) + norm! 1gT + " count gT goes not to the absolute tabpagenumber + " but, but goes to the count previous tabpagenumber + call assert_equal(2, tabpagenr()) + " wrap around + norm! 3gT + call assert_equal(3, tabpagenr()) + " gt does not wrap around + norm! 5gt + call assert_equal(3, tabpagenr()) + + for i in range(3) + tabclose + endfor + " clean up + call assert_fails(':tabclose', 'E784') +endfunc + +fun! Test_normal38_nvhome() + " Test for <Home> and <C-Home> key + new + call setline(1, range(10)) + $ + setl et sw=2 + norm! V10>$ + " count is ignored + exe "norm! 10\<home>" + call assert_equal(1, col('.')) + exe "norm! \<home>" + call assert_equal([0, 10, 1, 0, 1], getcurpos()) + exe "norm! 5\<c-home>" + call assert_equal([0, 5, 1, 0, 1], getcurpos()) + exe "norm! \<c-home>" + call assert_equal([0, 1, 1, 0, 1], getcurpos()) + + " clean up + bw! +endfunc + +fun! Test_normal39_cw() + " Test for cw and cW on whitespace + " and cpo+=w setting + new + set tw=0 + call append(0, 'here are some words') + norm! 1gg0elcwZZZ + call assert_equal('hereZZZare some words', getline('.')) + norm! 1gg0elcWYYY + call assert_equal('hereZZZareYYYsome words', getline('.')) + set cpo+=w + call setline(1, 'here are some words') + norm! 1gg0elcwZZZ + call assert_equal('hereZZZ are some words', getline('.')) + norm! 1gg2elcWYYY + call assert_equal('hereZZZ areYYY some words', getline('.')) + set cpo-=w + norm! 2gg0cwfoo + call assert_equal('foo', getline('.')) + + " clean up + bw! +endfunc + +fun! Test_normal40_ctrl_bsl() + " Basic test for CTRL-\ commands + new + call append(0, 'here are some words') + exe "norm! 1gg0a\<C-\>\<C-N>" + call assert_equal('n', mode()) + call assert_equal(1, col('.')) + call assert_equal('', visualmode()) + exe "norm! 1gg0viw\<C-\>\<C-N>" + call assert_equal('n', mode()) + call assert_equal(4, col('.')) + exe "norm! 1gg0a\<C-\>\<C-G>" + call assert_equal('n', mode()) + call assert_equal(1, col('.')) + "imap <buffer> , <c-\><c-n> + set im + exe ":norm! \<c-\>\<c-n>dw" + set noim + call assert_equal('are some words', getline(1)) + call assert_false(&insertmode) + + " clean up + bw! +endfunc + +fun! Test_normal41_insert_reg() + " Test for <c-r>=, <c-r><c-r>= and <c-r><c-o>= + " in insert mode + new + set sts=2 sw=2 ts=8 tw=0 + call append(0, ["aaa\tbbb\tccc", '', '', '']) + let a=getline(1) + norm! 2gg0 + exe "norm! a\<c-r>=a\<cr>" + norm! 3gg0 + exe "norm! a\<c-r>\<c-r>=a\<cr>" + norm! 4gg0 + exe "norm! a\<c-r>\<c-o>=a\<cr>" + call assert_equal(['aaa bbb ccc', 'aaa bbb ccc', 'aaa bbb ccc', 'aaa bbb ccc', ''], getline(1, '$')) + + " clean up + set sts=0 sw=8 ts=8 + bw! +endfunc + +func! Test_normal42_halfpage() + " basic test for Ctrl-D and Ctrl-U + call Setup_NewWindow() + call assert_equal(5, &scroll) + exe "norm! \<c-d>" + call assert_equal('6', getline('.')) + exe "norm! 2\<c-d>" + call assert_equal('8', getline('.')) + call assert_equal(2, &scroll) + set scroll=5 + exe "norm! \<c-u>" + call assert_equal('3', getline('.')) + 1 + set scrolloff=5 + exe "norm! \<c-d>" + call assert_equal('10', getline('.')) + exe "norm! \<c-u>" + call assert_equal('5', getline('.')) + 1 + set scrolloff=99 + exe "norm! \<c-d>" + call assert_equal('10', getline('.')) + set scrolloff=0 + 100 + exe "norm! $\<c-u>" + call assert_equal('95', getline('.')) + call assert_equal([0, 95, 1, 0, 1], getcurpos()) + 100 + set nostartofline + exe "norm! $\<c-u>" + call assert_equal('95', getline('.')) + call assert_equal([0, 95, 2, 0, 2147483647], getcurpos()) + " cleanup + set startofline + bw! +endfunc + +fun! Test_normal43_textobject1() + " basic tests for text object aw + new + call append(0, ['foobar,eins,foobar', 'foo,zwei,foo ']) + " diw + norm! 1gg0diw + call assert_equal([',eins,foobar', 'foo,zwei,foo ', ''], getline(1,'$')) + " daw + norm! 2ggEdaw + call assert_equal([',eins,foobar', 'foo,zwei,', ''], getline(1, '$')) + %d + call append(0, ["foo\teins\tfoobar", "foo\tzwei\tfoo "]) + " diW + norm! 2ggwd2iW + call assert_equal(['foo eins foobar', 'foo foo ', ''], getline(1,'$')) + " daW + norm! 1ggd2aW + call assert_equal(['foobar', 'foo foo ', ''], getline(1,'$')) + + %d + call append(0, ["foo\teins\tfoobar", "foo\tzwei\tfoo "]) + " aw in visual line mode switches to characterwise mode + norm! 2gg$Vawd + call assert_equal(['foo eins foobar', 'foo zwei foo'], getline(1,'$')) + norm! 1gg$Viwd + call assert_equal(['foo eins ', 'foo zwei foo'], getline(1,'$')) + + " clean up + bw! +endfunc + +func! Test_normal44_textobjects2() + " basic testing for is and as text objects + new + call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here']) + " Test for dis - does not remove trailing whitespace + norm! 1gg0dis + call assert_equal([' With some sentences!', '', 'Even with a question? And one more. And no sentence here', ''], getline(1,'$')) + " Test for das - removes leading whitespace + norm! 3ggf?ldas + call assert_equal([' With some sentences!', '', 'Even with a question? And no sentence here', ''], getline(1,'$')) + " when used in visual mode, is made characterwise + norm! 3gg$Visy + call assert_equal('v', visualmode()) + " reset visualmode() + norm! 3ggVy + norm! 3gg$Vasy + call assert_equal('v', visualmode()) + " basic testing for textobjects a< and at + %d + call setline(1, ['<div> ','<a href="foobar" class="foo">xyz</a>',' </div>', ' ']) + " a< + norm! 1gg0da< + call assert_equal([' ', '<a href="foobar" class="foo">xyz</a>', ' </div>', ' '], getline(1,'$')) + norm! 1pj + call assert_equal([' <div>', '<a href="foobar" class="foo">xyz</a>', ' </div>', ' '], getline(1,'$')) + " at + norm! d2at + call assert_equal([' '], getline(1,'$')) + %d + call setline(1, ['<div> ','<a href="foobar" class="foo">xyz</a>',' </div>', ' ']) + " i< + norm! 1gg0di< + call assert_equal(['<> ', '<a href="foobar" class="foo">xyz</a>', ' </div>', ' '], getline(1,'$')) + norm! 1Pj + call assert_equal(['<div> ', '<a href="foobar" class="foo">xyz</a>', ' </div>', ' '], getline(1,'$')) + norm! d2it + call assert_equal(['<div></div>',' '], getline(1,'$')) + " basic testing for a[ and i[ text object + %d + call setline(1, [' ', '[', 'one [two]', 'thre', ']']) + norm! 3gg0di[ + call assert_equal([' ', '[', ']'], getline(1,'$')) + call setline(1, [' ', '[', 'one [two]', 'thre', ']']) + norm! 3gg0ftd2a[ + call assert_equal([' '], getline(1,'$')) + %d + " Test for i" when cursor is in front of a quoted object + call append(0, 'foo "bar"') + norm! 1gg0di" + call assert_equal(['foo ""', ''], getline(1,'$')) + + " clean up + bw! +endfunc + +func! Test_normal45_drop() + if !has('dnd') + " The ~ register does not exist + call assert_beeps('norm! "~') + return + endif + + " basic test for drag-n-drop + " unfortunately, without a gui, we can't really test much here, + " so simply test that ~p fails (which uses the drop register) + new + call assert_fails(':norm! "~p', 'E353') + call assert_equal([], getreg('~', 1, 1)) + " the ~ register is read only + call assert_fails(':let @~="1"', 'E354') + bw! +endfunc + +func! Test_normal46_ignore() + " This test uses multi byte characters + if !has("multi_byte") + return + endif + + new + " How to test this? + " let's just for now test, that the buffer + " does not change + call feedkeys("\<c-s>", 't') + call assert_equal([''], getline(1,'$')) + + " no valid commands + exe "norm! \<char-0x100>" + call assert_equal([''], getline(1,'$')) + + exe "norm! ä" + call assert_equal([''], getline(1,'$')) + + " clean up + bw! +endfunc + +func! Test_normal47_visual_buf_wipe() + " This was causing a crash or ml_get error. + enew! + call setline(1,'xxx') + normal $ + new + call setline(1, range(1,2)) + 2 + exe "norm \<C-V>$" + bw! + norm yp + set nomodified +endfunc + +func! Test_normal47_autocmd() + " disabled, does not seem to be possible currently + throw "Skipped: not possible to test cursorhold autocmd while waiting for input in normal_cmd" + new + call append(0, repeat('-',20)) + au CursorHold * call feedkeys('2l', '') + 1 + set updatetime=20 + " should delete 12 chars (d12l) + call feedkeys('d1', '!') + call assert_equal('--------', getline(1)) + + " clean up + au! CursorHold + set updatetime=4000 + bw! +endfunc + +func! Test_normal48_wincmd() + new + exe "norm! \<c-w>c" + call assert_equal(1, winnr('$')) + call assert_fails(":norm! \<c-w>c", "E444") +endfunc + +func! Test_normal49_counts() + new + call setline(1, 'one two three four five six seven eight nine ten') + 1 + norm! 3d2w + call assert_equal('seven eight nine ten', getline(1)) + bw! +endfunc + +func! Test_normal50_commandline() + if !has("timers") || !has("cmdline_hist") + return + endif + func! DoTimerWork(id) + call assert_equal('[Command Line]', bufname('')) + " should fail, with E11, but does fail with E23? + "call feedkeys("\<c-^>", 'tm') + + " should also fail with E11 + call assert_fails(":wincmd p", 'E11') + " return from commandline window + call feedkeys("\<cr>") + endfunc + + let oldlang=v:lang + lang C + set updatetime=20 + call timer_start(100, 'DoTimerWork') + try + " throws E23, for whatever reason... + call feedkeys('q:', 'x!') + catch /E23/ + " no-op + endtry + " clean up + set updatetime=4000 + exe "lang" oldlang + bw! +endfunc + +func! Test_normal51_FileChangedRO() + if !has("autocmd") + return + endif + " Don't sleep after the warning message. + call test_settime(1) + call writefile(['foo'], 'Xreadonly.log') + new Xreadonly.log + setl ro + au FileChangedRO <buffer> :call feedkeys("\<c-^>", 'tix') + call assert_fails(":norm! Af", 'E788') + call assert_equal(['foo'], getline(1,'$')) + call assert_equal('Xreadonly.log', bufname('')) + + " cleanup + call test_settime(0) + bw! + call delete("Xreadonly.log") +endfunc + +func! Test_normal52_rl() + if !has("rightleft") + return + endif + new + call setline(1, 'abcde fghij klmnopq') + norm! 1gg$ + set rl + call assert_equal(19, col('.')) + call feedkeys('l', 'tx') + call assert_equal(18, col('.')) + call feedkeys('h', 'tx') + call assert_equal(19, col('.')) + call feedkeys("\<right>", 'tx') + call assert_equal(18, col('.')) + call feedkeys("\<s-right>", 'tx') + call assert_equal(13, col('.')) + call feedkeys("\<c-right>", 'tx') + call assert_equal(7, col('.')) + call feedkeys("\<c-left>", 'tx') + call assert_equal(13, col('.')) + call feedkeys("\<s-left>", 'tx') + call assert_equal(19, col('.')) + call feedkeys("<<", 'tx') + call assert_equal(' abcde fghij klmnopq',getline(1)) + call feedkeys(">>", 'tx') + call assert_equal('abcde fghij klmnopq',getline(1)) + + " cleanup + set norl + bw! +endfunc + +func! Test_normal53_digraph() + if !has('digraphs') + return + endif + new + call setline(1, 'abcdefgh|') + exe "norm! 1gg0f\<c-k>!!" + call assert_equal(9, col('.')) + set cpo+=D + exe "norm! 1gg0f\<c-k>!!" + call assert_equal(1, col('.')) + + set cpo-=D + bw! +endfunc + +func Test_normal54_Ctrl_bsl() + new + call setline(1, 'abcdefghijklmn') + exe "norm! df\<c-\>\<c-n>" + call assert_equal(['abcdefghijklmn'], getline(1,'$')) + exe "norm! df\<c-\>\<c-g>" + call assert_equal(['abcdefghijklmn'], getline(1,'$')) + exe "norm! df\<c-\>m" + call assert_equal(['abcdefghijklmn'], getline(1,'$')) + if !has("multi_byte") + return + endif + call setline(2, 'abcdefghijklmnāf') + norm! 2gg0 + exe "norm! df\<Char-0x101>" + call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$')) + norm! 1gg0 + exe "norm! df\<esc>" + call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$')) + + " clean up + bw! +endfunc + +func Test_normal_large_count() + " This may fail with 32bit long, how do we detect that? + new + normal o + normal 6666666666dL + bwipe! +endfunc + +func Test_delete_until_paragraph() + if !has('multi_byte') + return + endif + new + normal grádv} + call assert_equal('á', getline(1)) + normal grád} + call assert_equal('', getline(1)) + bwipe! +endfunc + +" Test for the gr (virtual replace) command +" Test for the bug fixed by 7.4.387 +func Test_gr_command() + enew! + let save_cpo = &cpo + call append(0, ['First line', 'Second line', 'Third line']) + exe "normal i\<C-G>u" + call cursor(2, 1) + set cpo-=X + normal 4gro + call assert_equal('oooond line', getline(2)) + undo + set cpo+=X + normal 4gro + call assert_equal('ooooecond line', getline(2)) + let &cpo = save_cpo + enew! +endfunc + +" When splitting a window the changelist position is wrong. +" Test the changelist position after splitting a window. +" Test for the bug fixed by 7.4.386 +func Test_changelist() + let save_ul = &ul + enew! + call append('$', ['1', '2']) + exe "normal i\<C-G>u" + exe "normal Gkylpa\<C-G>u" + set ul=100 + exe "normal Gylpa\<C-G>u" + set ul=100 + normal gg + vsplit + normal g; + call assert_equal([3, 2], [line('.'), col('.')]) + normal g; + call assert_equal([2, 2], [line('.'), col('.')]) + call assert_fails('normal g;', 'E662:') + %bwipe! + let &ul = save_ul +endfunc diff --git a/src/testdir/test_number.vim b/src/testdir/test_number.vim new file mode 100644 index 0000000000..59debcea0d --- /dev/null +++ b/src/testdir/test_number.vim @@ -0,0 +1,254 @@ +" Test for 'number' and 'relativenumber' + +source view_util.vim + +func! s:screen_lines(start, end) abort + return ScreenLines([a:start, a:end], 8) +endfunc + +func! s:compare_lines(expect, actual) + call assert_equal(a:expect, a:actual) +endfunc + +func! s:test_windows(h, w) abort + call NewWindow(a:h, a:w) +endfunc + +func! s:close_windows() abort + call CloseWindow() +endfunc + +func! s:validate_cursor() abort + " update skipcol. + " wincol(): + " f_wincol + " -> validate_cursor + " -> curs_columns + call wincol() +endfunc + +func Test_set_options() + set nu rnu + call assert_equal(1, &nu) + call assert_equal(1, &rnu) + + call s:test_windows(10, 20) + call assert_equal(1, &nu) + call assert_equal(1, &rnu) + call s:close_windows() + + set nu& rnu& +endfunc + +func Test_set_global_and_local() + " setlocal must NOT reset the other global value + set nonu nornu + setglobal nu + setlocal rnu + call assert_equal(1, &g:nu) + + set nonu nornu + setglobal rnu + setlocal nu + call assert_equal(1, &g:rnu) + + " setglobal MUST reset the other global value + set nonu nornu + setglobal nu + setglobal rnu + call assert_equal(1, &g:nu) + + set nonu nornu + setglobal rnu + setglobal nu + call assert_equal(1, &g:rnu) + + " set MUST reset the other global value + set nonu nornu + set nu + set rnu + call assert_equal(1, &g:nu) + + set nonu nornu + set rnu + set nu + call assert_equal(1, &g:rnu) + + set nu& rnu& +endfunc + +func Test_number() + call s:test_windows(10, 20) + call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"]) + setl number + let lines = s:screen_lines(1, 4) + let expect = [ +\ " 1 abcd", +\ " 2 klmn", +\ " 3 uvwx", +\ " 4 EFGH", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_relativenumber() + call s:test_windows(10, 20) + call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"]) + 3 + setl relativenumber + let lines = s:screen_lines(1, 6) + let expect = [ +\ " 2 abcd", +\ " 1 klmn", +\ " 0 uvwx", +\ " 1 EFGH", +\ " 2 OPQR", +\ " 3 YZ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_number_with_relativenumber() + call s:test_windows(10, 20) + call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"]) + 4 + setl number relativenumber + let lines = s:screen_lines(1, 6) + let expect = [ +\ " 3 abcd", +\ " 2 klmn", +\ " 1 uvwx", +\ "4 EFGH", +\ " 1 OPQR", +\ " 2 YZ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_number_with_linewrap1() + call s:test_windows(3, 20) + normal! 61ia + setl number wrap + call s:validate_cursor() + let lines = s:screen_lines(1, 3) + let expect = [ +\ "--1 aaaa", +\ " aaaa", +\ " aaaa", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI +func XTest_number_with_linewrap2() + call s:test_windows(3, 20) + normal! 61ia + setl number wrap + call s:validate_cursor() + 0 + call s:validate_cursor() + let lines = s:screen_lines(1, 3) + let expect = [ +\ " 1 aaaa", +\ " aaaa", +\ " aaaa", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI +func XTest_number_with_linewrap3() + call s:test_windows(4, 20) + normal! 81ia + setl number wrap + call s:validate_cursor() + setl nonumber + call s:validate_cursor() + let lines = s:screen_lines(1, 4) + let expect = [ +\ "aaaaaaaa", +\ "aaaaaaaa", +\ "aaaaaaaa", +\ "a ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_numberwidth() + call s:test_windows(10, 20) + call setline(1, repeat(['aaaa'], 10)) + setl number numberwidth=6 + let lines = s:screen_lines(1, 3) + let expect = [ +\ " 1 aa", +\ " 2 aa", +\ " 3 aa", +\ ] + call s:compare_lines(expect, lines) + + set relativenumber + let lines = s:screen_lines(1, 3) + let expect = [ +\ "1 aa", +\ " 1 aa", +\ " 2 aa", +\ ] + call s:compare_lines(expect, lines) + + set nonumber + let lines = s:screen_lines(1, 3) + let expect = [ +\ " 0 aa", +\ " 1 aa", +\ " 2 aa", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc + +func Test_numberwidth_adjusted() + call s:test_windows(10, 20) + call setline(1, repeat(['aaaa'], 10000)) + setl number numberwidth=4 + let lines = s:screen_lines(1, 3) + let expect = [ +\ " 1 aa", +\ " 2 aa", +\ " 3 aa", +\ ] + call s:compare_lines(expect, lines) + + $ + let lines = s:screen_lines(8, 10) + let expect = [ +\ " 9998 aa", +\ " 9999 aa", +\ "10000 aa", +\ ] + call s:compare_lines(expect, lines) + + setl relativenumber + let lines = s:screen_lines(8, 10) + let expect = [ +\ " 2 aa", +\ " 1 aa", +\ "10000 aa", +\ ] + call s:compare_lines(expect, lines) + + setl nonumber + let lines = s:screen_lines(8, 10) + let expect = [ +\ " 2 aaaa", +\ " 1 aaaa", +\ " 0 aaaa", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows() +endfunc diff --git a/src/testdir/test_options.in b/src/testdir/test_options.in deleted file mode 100644 index bf1232a223..0000000000 --- a/src/testdir/test_options.in +++ /dev/null @@ -1,17 +0,0 @@ -Test for ":options". - -STARTTEST -:so small.vim -:let caught = 'ok' -:try - :options -:catch - :let caught = v:throwpoint . "\n" . v:exception -:endtry -:buf 1 -:$put =caught -:/^result/,$w! test.out -:qa! -ENDTEST - -result diff --git a/src/testdir/test_options.ok b/src/testdir/test_options.ok deleted file mode 100644 index a2e1494a1f..0000000000 --- a/src/testdir/test_options.ok +++ /dev/null @@ -1,2 +0,0 @@ -result -ok diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim new file mode 100644 index 0000000000..167cb1ce06 --- /dev/null +++ b/src/testdir/test_options.vim @@ -0,0 +1,402 @@ +" Test for options + +function! Test_whichwrap() + set whichwrap=b,s + call assert_equal('b,s', &whichwrap) + + set whichwrap+=h,l + call assert_equal('b,s,h,l', &whichwrap) + + set whichwrap+=h,l + call assert_equal('b,s,h,l', &whichwrap) + + set whichwrap+=h,l + call assert_equal('b,s,h,l', &whichwrap) + + set whichwrap=h,h + call assert_equal('h', &whichwrap) + + set whichwrap=h,h,h + call assert_equal('h', &whichwrap) + + set whichwrap& +endfunction + +function! Test_isfname() + " This used to cause Vim to access uninitialized memory. + set isfname= + call assert_equal("~X", expand("~X")) + set isfname& +endfunction + +function Test_wildchar() + " Empty 'wildchar' used to access invalid memory. + call assert_fails('set wildchar=', 'E521:') + call assert_fails('set wildchar=abc', 'E521:') + set wildchar=<Esc> + let a=execute('set wildchar?') + call assert_equal("\n wildchar=<Esc>", a) + set wildchar=27 + let a=execute('set wildchar?') + call assert_equal("\n wildchar=<Esc>", a) + set wildchar& +endfunction + +function Test_options() + let caught = 'ok' + try + options + catch + let caught = v:throwpoint . "\n" . v:exception + endtry + call assert_equal('ok', caught) + + " close option-window + close +endfunction + +function Test_path_keep_commas() + " Test that changing 'path' keeps two commas. + set path=foo,,bar + set path-=bar + set path+=bar + call assert_equal('foo,,bar', &path) + + set path& +endfunction + +func Test_signcolumn() + if has('signs') + call assert_equal("auto", &signcolumn) + set signcolumn=yes + set signcolumn=no + call assert_fails('set signcolumn=nope') + endif +endfunc + +func Test_filetype_valid() + if !has('autocmd') + return + endif + set ft=valid_name + call assert_equal("valid_name", &filetype) + set ft=valid-name + call assert_equal("valid-name", &filetype) + + call assert_fails(":set ft=wrong;name", "E474:") + call assert_fails(":set ft=wrong\\\\name", "E474:") + call assert_fails(":set ft=wrong\\|name", "E474:") + call assert_fails(":set ft=wrong/name", "E474:") + call assert_fails(":set ft=wrong\\\nname", "E474:") + call assert_equal("valid-name", &filetype) + + exe "set ft=trunc\x00name" + call assert_equal("trunc", &filetype) +endfunc + +func Test_syntax_valid() + if !has('syntax') + return + endif + set syn=valid_name + call assert_equal("valid_name", &syntax) + set syn=valid-name + call assert_equal("valid-name", &syntax) + + call assert_fails(":set syn=wrong;name", "E474:") + call assert_fails(":set syn=wrong\\\\name", "E474:") + call assert_fails(":set syn=wrong\\|name", "E474:") + call assert_fails(":set syn=wrong/name", "E474:") + call assert_fails(":set syn=wrong\\\nname", "E474:") + call assert_equal("valid-name", &syntax) + + exe "set syn=trunc\x00name" + call assert_equal("trunc", &syntax) +endfunc + +func Test_keymap_valid() + if !has('keymap') + return + endif + call assert_fails(":set kmp=valid_name", "E544:") + call assert_fails(":set kmp=valid_name", "valid_name") + call assert_fails(":set kmp=valid-name", "E544:") + call assert_fails(":set kmp=valid-name", "valid-name") + + call assert_fails(":set kmp=wrong;name", "E474:") + call assert_fails(":set kmp=wrong\\\\name", "E474:") + call assert_fails(":set kmp=wrong\\|name", "E474:") + call assert_fails(":set kmp=wrong/name", "E474:") + call assert_fails(":set kmp=wrong\\\nname", "E474:") + + call assert_fails(":set kmp=trunc\x00name", "E544:") + call assert_fails(":set kmp=trunc\x00name", "trunc") +endfunc + +func Check_dir_option(name) + " Check that it's possible to set the option. + exe 'set ' . a:name . '=/usr/share/dict/words' + call assert_equal('/usr/share/dict/words', eval('&' . a:name)) + exe 'set ' . a:name . '=/usr/share/dict/words,/and/there' + call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name)) + exe 'set ' . a:name . '=/usr/share/dict\ words' + call assert_equal('/usr/share/dict words', eval('&' . a:name)) + + " Check rejecting weird characters. + call assert_fails("set " . a:name . "=/not&there", "E474:") + call assert_fails("set " . a:name . "=/not>there", "E474:") + call assert_fails("set " . a:name . "=/not.*there", "E474:") +endfunc + +func Test_cinkeys() + " This used to cause invalid memory access + set cindent cinkeys=0 + norm a + set cindent& cinkeys& +endfunc + +func Test_dictionary() + call Check_dir_option('dictionary') +endfunc + +func Test_thesaurus() + call Check_dir_option('thesaurus') +endfun + +func Test_complete() + " Trailing single backslash used to cause invalid memory access. + set complete=s\ + new + call feedkeys("i\<C-N>\<Esc>", 'xt') + bwipe! + set complete& +endfun + +func Test_set_completion() + call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:) + + " Expand boolan options. When doing :set no<Tab> + " vim displays the options names without "no" but completion uses "no...". + call feedkeys(":set nodi\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set nodiff digraph', @:) + + call feedkeys(":set invdi\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set invdiff digraph', @:) + + " Expand abbreviation of options. + call feedkeys(":set ts\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set tabstop thesaurus ttyscroll', @:) + + " Expand current value + call feedkeys(":set fileencodings=\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set fileencodings=ucs-bom,utf-8,default,latin1', @:) + + call feedkeys(":set fileencodings:\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:) + + " Expand key codes. + call feedkeys(":set <H\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set <Help> <Home>', @:) + + " Expand terminal options. + call feedkeys(":set t_A\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set t_AB t_AF t_AL', @:) + + " Expand directories. + call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match(' ./samples/ ', @:) + call assert_notmatch(' ./small.vim ', @:) + + " Expand files and directories. + call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match(' ./samples/.* ./small.vim', @:) + + call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:) +endfunc + +func Test_set_errors() + call assert_fails('set scroll=-1', 'E49:') + call assert_fails('set backupcopy=', 'E474:') + call assert_fails('set regexpengine=3', 'E474:') + call assert_fails('set history=10001', 'E474:') + call assert_fails('set numberwidth=11', 'E474:') + call assert_fails('set colorcolumn=-a') + call assert_fails('set colorcolumn=a') + call assert_fails('set colorcolumn=1,') + call assert_fails('set cmdheight=-1', 'E487:') + call assert_fails('set cmdwinheight=-1', 'E487:') + if has('conceal') + call assert_fails('set conceallevel=-1', 'E487:') + call assert_fails('set conceallevel=4', 'E474:') + endif + call assert_fails('set helpheight=-1', 'E487:') + call assert_fails('set history=-1', 'E487:') + call assert_fails('set report=-1', 'E487:') + call assert_fails('set shiftwidth=-1', 'E487:') + call assert_fails('set sidescroll=-1', 'E487:') + call assert_fails('set tabstop=-1', 'E487:') + call assert_fails('set textwidth=-1', 'E487:') + call assert_fails('set timeoutlen=-1', 'E487:') + call assert_fails('set updatecount=-1', 'E487:') + call assert_fails('set updatetime=-1', 'E487:') + call assert_fails('set winheight=-1', 'E487:') + call assert_fails('set tabstop!', 'E488:') + call assert_fails('set xxx', 'E518:') + call assert_fails('set beautify?', 'E519:') + call assert_fails('set undolevels=x', 'E521:') + call assert_fails('set tabstop=', 'E521:') + call assert_fails('set comments=-', 'E524:') + call assert_fails('set comments=a', 'E525:') + call assert_fails('set foldmarker=x', 'E536:') + call assert_fails('set commentstring=x', 'E537:') + call assert_fails('set complete=x', 'E539:') + call assert_fails('set statusline=%{', 'E540:') + call assert_fails('set statusline=' . repeat("%p", 81), 'E541:') + call assert_fails('set statusline=%(', 'E542:') + if has('cursorshape') + " This invalid value for 'guicursor' used to cause Vim to crash. + call assert_fails('set guicursor=i-ci,r-cr:h', 'E545:') + call assert_fails('set guicursor=i-ci', 'E545:') + call assert_fails('set guicursor=x', 'E545:') + call assert_fails('set guicursor=r-cr:horx', 'E548:') + call assert_fails('set guicursor=r-cr:hor0', 'E549:') + endif + call assert_fails('set backupext=~ patchmode=~', 'E589:') + call assert_fails('set winminheight=10 winheight=9', 'E591:') + call assert_fails('set winminwidth=10 winwidth=9', 'E592:') + call assert_fails("set showbreak=\x01", 'E595:') + call assert_fails('set t_foo=', 'E846:') +endfunc + +func Test_set_ttytype() + if !has('gui_running') && has('unix') + " Setting 'ttytype' used to cause a double-free when exiting vim and + " when vim is compiled with -DEXITFREE. + set ttytype=ansi + call assert_equal('ansi', &ttytype) + call assert_equal(&ttytype, &term) + set ttytype=xterm + call assert_equal('xterm', &ttytype) + call assert_equal(&ttytype, &term) + " "set ttytype=" gives E522 instead of E529 + " in travis on some builds. Why? Catch both for now + try + set ttytype= + call assert_report('set ttytype= did not fail') + catch /E529\|E522/ + endtry + + " Some systems accept any terminal name and return dumb settings, + " check for failure of finding the entry and for missing 'cm' entry. + try + set ttytype=xxx + call assert_report('set ttytype=xxx did not fail') + catch /E522\|E437/ + endtry + + set ttytype& + call assert_equal(&ttytype, &term) + endif +endfunc + +func Test_set_all() + set tw=75 + set iskeyword=a-z,A-Z + set nosplitbelow + let out = execute('set all') + call assert_match('textwidth=75', out) + call assert_match('iskeyword=a-z,A-Z', out) + call assert_match('nosplitbelow', out) + set tw& iskeyword& splitbelow& +endfunc + +func Test_set_values() + if filereadable('opt_test.vim') + source opt_test.vim + else + throw 'Skipped: opt_test.vim does not exist' + endif +endfunc + +func ResetIndentexpr() + set indentexpr= +endfunc + +func Test_set_indentexpr() + " this was causing usage of freed memory + set indentexpr=ResetIndentexpr() + new + call feedkeys("i\<c-f>", 'x') + call assert_equal('', &indentexpr) + bwipe! +endfunc + +func Test_backupskip() + if has("mac") + call assert_match('/private/tmp/\*', &bsk) + elseif has("unix") + call assert_match('/tmp/\*', &bsk) + endif + + let bskvalue = substitute(&bsk, '\\', '/', 'g') + for var in ['$TEMPDIR', '$TMP', '$TEMP'] + if exists(var) + let varvalue = substitute(expand(var), '\\', '/', 'g') + call assert_match(varvalue . '.\*', bskvalue) + endif + endfor +endfunc + +func Test_copy_winopt() + set hidden + + " Test copy option from current buffer in window + split + enew + setlocal numberwidth=5 + wincmd w + call assert_equal(4,&numberwidth) + bnext + call assert_equal(5,&numberwidth) + bw! + call assert_equal(4,&numberwidth) + + " Test copy value from window that used to be display the buffer + split + enew + setlocal numberwidth=6 + bnext + wincmd w + call assert_equal(4,&numberwidth) + bnext + call assert_equal(6,&numberwidth) + bw! + + " Test that if buffer is current, don't use the stale cached value + " from the last time the buffer was displayed. + split + enew + setlocal numberwidth=7 + bnext + bnext + setlocal numberwidth=8 + wincmd w + call assert_equal(4,&numberwidth) + bnext + call assert_equal(8,&numberwidth) + bw! + + " Test value is not copied if window already has seen the buffer + enew + split + setlocal numberwidth=9 + bnext + setlocal numberwidth=10 + wincmd w + call assert_equal(4,&numberwidth) + bnext + call assert_equal(4,&numberwidth) + bw! +endfunc diff --git a/src/testdir/test_packadd.vim b/src/testdir/test_packadd.vim new file mode 100644 index 0000000000..64bd8d2b23 --- /dev/null +++ b/src/testdir/test_packadd.vim @@ -0,0 +1,338 @@ +" Tests for 'packpath' and :packadd + + +func SetUp() + let s:topdir = getcwd() . '/Xdir' + exe 'set packpath=' . s:topdir + let s:plugdir = s:topdir . '/pack/mine/opt/mytest' +endfunc + +func TearDown() + call delete(s:topdir, 'rf') +endfunc + +func Test_packadd() + call mkdir(s:plugdir . '/plugin/also', 'p') + call mkdir(s:plugdir . '/ftdetect', 'p') + call mkdir(s:plugdir . '/after', 'p') + set rtp& + let rtp = &rtp + filetype on + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + + exe 'split ' . s:plugdir . '/plugin/also/loaded.vim' + call setline(1, 'let g:plugin_also_works = 77') + wq + + exe 'split ' . s:plugdir . '/ftdetect/test.vim' + call setline(1, 'let g:ftdetect_works = 17') + wq + + packadd mytest + + call assert_equal(42, g:plugin_works) + call assert_equal(77, g:plugin_also_works) + call assert_equal(17, g:ftdetect_works) + call assert_true(len(&rtp) > len(rtp)) + call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) + call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp) + + " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest' + call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p') + let rtp = &rtp + packadd myte + + " Check the path of 'myte' is added + call assert_true(len(&rtp) > len(rtp)) + call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp) + + " Check exception + call assert_fails("packadd directorynotfound", 'E919:') + call assert_fails("packadd", 'E471:') +endfunc + +func Test_packadd_start() + let plugdir = s:topdir . '/pack/mine/start/other' + call mkdir(plugdir . '/plugin', 'p') + set rtp& + let rtp = &rtp + filetype on + + exe 'split ' . plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 24') + wq + + packadd other + + call assert_equal(24, g:plugin_works) + call assert_true(len(&rtp) > len(rtp)) + call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp) +endfunc + +func Test_packadd_noload() + call mkdir(s:plugdir . '/plugin', 'p') + call mkdir(s:plugdir . '/syntax', 'p') + set rtp& + let rtp = &rtp + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + let g:plugin_works = 0 + + packadd! mytest + + call assert_true(len(&rtp) > len(rtp)) + call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) + call assert_equal(0, g:plugin_works) + + " check the path is not added twice + let new_rtp = &rtp + packadd! mytest + call assert_equal(new_rtp, &rtp) +endfunc + +func Test_packadd_symlink_dir() + if !has('unix') + return + endif + let top2_dir = s:topdir . '/Xdir2' + let real_dir = s:topdir . '/Xsym' + call mkdir(real_dir, 'p') + exec "silent !ln -s Xsym" top2_dir + let &rtp = top2_dir . ',' . top2_dir . '/after' + let &packpath = &rtp + + let s:plugdir = top2_dir . '/pack/mine/opt/mytest' + call mkdir(s:plugdir . '/plugin', 'p') + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 44') + wq + let g:plugin_works = 0 + + packadd mytest + + " Must have been inserted in the middle, not at the end + call assert_match('/pack/mine/opt/mytest,', &rtp) + call assert_equal(44, g:plugin_works) + + " No change when doing it again. + let rtp_before = &rtp + packadd mytest + call assert_equal(rtp_before, &rtp) + + set rtp& + let rtp = &rtp + exec "silent !rm" top2_dir +endfunc + +func Test_packadd_symlink_dir2() + if !has('unix') + return + endif + let top2_dir = s:topdir . '/Xdir2' + let real_dir = s:topdir . '/Xsym/pack' + call mkdir(top2_dir, 'p') + call mkdir(real_dir, 'p') + let &rtp = top2_dir . ',' . top2_dir . '/after' + let &packpath = &rtp + + exec "silent !ln -s ../Xsym/pack" top2_dir . '/pack' + let s:plugdir = top2_dir . '/pack/mine/opt/mytest' + call mkdir(s:plugdir . '/plugin', 'p') + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 48') + wq + let g:plugin_works = 0 + + packadd mytest + + " Must have been inserted in the middle, not at the end + call assert_match('/Xdir2/pack/mine/opt/mytest,', &rtp) + call assert_equal(48, g:plugin_works) + + " No change when doing it again. + let rtp_before = &rtp + packadd mytest + call assert_equal(rtp_before, &rtp) + + set rtp& + let rtp = &rtp + exec "silent !rm" top2_dir . '/pack' + exec "silent !rmdir" top2_dir +endfunc + +" Check command-line completion for 'packadd' +func Test_packadd_completion() + let optdir1 = &packpath . '/pack/mine/opt' + let optdir2 = &packpath . '/pack/candidate/opt' + + call mkdir(optdir1 . '/pluginA', 'p') + call mkdir(optdir1 . '/pluginC', 'p') + call mkdir(optdir2 . '/pluginB', 'p') + call mkdir(optdir2 . '/pluginC', 'p') + + let li = [] + call feedkeys(":packadd \<Tab>')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":packadd " . repeat("\<Tab>", 2) . "')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":packadd " . repeat("\<Tab>", 3) . "')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":packadd " . repeat("\<Tab>", 4) . "')\<C-B>call add(li, '\<CR>", 'tx') + call assert_equal("packadd pluginA", li[0]) + call assert_equal("packadd pluginB", li[1]) + call assert_equal("packadd pluginC", li[2]) + call assert_equal("packadd ", li[3]) +endfunc + +func Test_packloadall() + " plugin foo with an autoload directory + let fooplugindir = &packpath . '/pack/mine/start/foo/plugin' + call mkdir(fooplugindir, 'p') + call writefile(['let g:plugin_foo_number = 1234', + \ 'let g:plugin_foo_auto = bbb#value', + \ 'let g:plugin_extra_auto = extra#value'], fooplugindir . '/bar.vim') + let fooautodir = &packpath . '/pack/mine/start/foo/autoload' + call mkdir(fooautodir, 'p') + call writefile(['let bar#value = 77'], fooautodir . '/bar.vim') + + " plugin aaa with an autoload directory + let aaaplugindir = &packpath . '/pack/mine/start/aaa/plugin' + call mkdir(aaaplugindir, 'p') + call writefile(['let g:plugin_aaa_number = 333', + \ 'let g:plugin_aaa_auto = bar#value'], aaaplugindir . '/bbb.vim') + let aaaautodir = &packpath . '/pack/mine/start/aaa/autoload' + call mkdir(aaaautodir, 'p') + call writefile(['let bbb#value = 55'], aaaautodir . '/bbb.vim') + + " plugin extra with only an autoload directory + let extraautodir = &packpath . '/pack/mine/start/extra/autoload' + call mkdir(extraautodir, 'p') + call writefile(['let extra#value = 99'], extraautodir . '/extra.vim') + + packloadall + call assert_equal(1234, g:plugin_foo_number) + call assert_equal(55, g:plugin_foo_auto) + call assert_equal(99, g:plugin_extra_auto) + call assert_equal(333, g:plugin_aaa_number) + call assert_equal(77, g:plugin_aaa_auto) + + " only works once + call writefile(['let g:plugin_bar_number = 4321'], fooplugindir . '/bar2.vim') + packloadall + call assert_false(exists('g:plugin_bar_number')) + + " works when ! used + packloadall! + call assert_equal(4321, g:plugin_bar_number) +endfunc + +func Test_helptags() + let docdir1 = &packpath . '/pack/mine/start/foo/doc' + let docdir2 = &packpath . '/pack/mine/start/bar/doc' + call mkdir(docdir1, 'p') + call mkdir(docdir2, 'p') + call writefile(['look here: *look-here*'], docdir1 . '/bar.txt') + call writefile(['look away: *look-away*'], docdir2 . '/foo.txt') + exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar' + + helptags ALL + + let tags1 = readfile(docdir1 . '/tags') + call assert_match('look-here', tags1[0]) + let tags2 = readfile(docdir2 . '/tags') + call assert_match('look-away', tags2[0]) +endfunc + +func Test_colorscheme() + let colordirrun = &packpath . '/runtime/colors' + let colordirstart = &packpath . '/pack/mine/start/foo/colors' + let colordiropt = &packpath . '/pack/mine/opt/bar/colors' + call mkdir(colordirrun, 'p') + call mkdir(colordirstart, 'p') + call mkdir(colordiropt, 'p') + call writefile(['let g:found_one = 1'], colordirrun . '/one.vim') + call writefile(['let g:found_two = 1'], colordirstart . '/two.vim') + call writefile(['let g:found_three = 1'], colordiropt . '/three.vim') + exe 'set rtp=' . &packpath . '/runtime' + + colorscheme one + call assert_equal(1, g:found_one) + colorscheme two + call assert_equal(1, g:found_two) + colorscheme three + call assert_equal(1, g:found_three) +endfunc + +func Test_colorscheme_completion() + let colordirrun = &packpath . '/runtime/colors' + let colordirstart = &packpath . '/pack/mine/start/foo/colors' + let colordiropt = &packpath . '/pack/mine/opt/bar/colors' + call mkdir(colordirrun, 'p') + call mkdir(colordirstart, 'p') + call mkdir(colordiropt, 'p') + call writefile(['let g:found_one = 1'], colordirrun . '/one.vim') + call writefile(['let g:found_two = 1'], colordirstart . '/two.vim') + call writefile(['let g:found_three = 1'], colordiropt . '/three.vim') + exe 'set rtp=' . &packpath . '/runtime' + + let li=[] + call feedkeys(":colorscheme " . repeat("\<Tab>", 1) . "')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":colorscheme " . repeat("\<Tab>", 2) . "')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":colorscheme " . repeat("\<Tab>", 3) . "')\<C-B>call add(li, '\<CR>", 't') + call feedkeys(":colorscheme " . repeat("\<Tab>", 4) . "')\<C-B>call add(li, '\<CR>", 'tx') + call assert_equal("colorscheme one", li[0]) + call assert_equal("colorscheme three", li[1]) + call assert_equal("colorscheme two", li[2]) + call assert_equal("colorscheme ", li[3]) +endfunc + +func Test_runtime() + let rundir = &packpath . '/runtime/extra' + let startdir = &packpath . '/pack/mine/start/foo/extra' + let optdir = &packpath . '/pack/mine/opt/bar/extra' + call mkdir(rundir, 'p') + call mkdir(startdir, 'p') + call mkdir(optdir, 'p') + call writefile(['let g:sequence .= "run"'], rundir . '/bar.vim') + call writefile(['let g:sequence .= "start"'], startdir . '/bar.vim') + call writefile(['let g:sequence .= "foostart"'], startdir . '/foo.vim') + call writefile(['let g:sequence .= "opt"'], optdir . '/bar.vim') + call writefile(['let g:sequence .= "xxxopt"'], optdir . '/xxx.vim') + exe 'set rtp=' . &packpath . '/runtime' + + let g:sequence = '' + runtime extra/bar.vim + call assert_equal('run', g:sequence) + let g:sequence = '' + runtime START extra/bar.vim + call assert_equal('start', g:sequence) + let g:sequence = '' + runtime OPT extra/bar.vim + call assert_equal('opt', g:sequence) + let g:sequence = '' + runtime PACK extra/bar.vim + call assert_equal('start', g:sequence) + let g:sequence = '' + runtime! PACK extra/bar.vim + call assert_equal('startopt', g:sequence) + let g:sequence = '' + runtime PACK extra/xxx.vim + call assert_equal('xxxopt', g:sequence) + + let g:sequence = '' + runtime ALL extra/bar.vim + call assert_equal('run', g:sequence) + let g:sequence = '' + runtime ALL extra/foo.vim + call assert_equal('foostart', g:sequence) + let g:sequence = '' + runtime! ALL extra/xxx.vim + call assert_equal('xxxopt', g:sequence) + let g:sequence = '' + runtime! ALL extra/bar.vim + call assert_equal('runstartopt', g:sequence) +endfunc diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim new file mode 100644 index 0000000000..3e968dabcd --- /dev/null +++ b/src/testdir/test_partial.vim @@ -0,0 +1,386 @@ +" Test binding arguments to a Funcref. + +func MyFunc(arg1, arg2, arg3) + return a:arg1 . '/' . a:arg2 . '/' . a:arg3 +endfunc + +func MySort(up, one, two) + if a:one == a:two + return 0 + endif + if a:up + return a:one > a:two ? 1 : -1 + endif + return a:one < a:two ? 1 : -1 +endfunc + +func MyMap(sub, index, val) + return a:val - a:sub +endfunc + +func MyFilter(threshold, index, val) + return a:val > a:threshold +endfunc + +func Test_partial_args() + let Cb = function('MyFunc', ["foo", "bar"]) + + call Cb("zzz") + call assert_equal("foo/bar/xxx", Cb("xxx")) + call assert_equal("foo/bar/yyy", call(Cb, ["yyy"])) + let Cb2 = function(Cb) + call assert_equal("foo/bar/zzz", Cb2("zzz")) + let Cb3 = function(Cb, ["www"]) + call assert_equal("foo/bar/www", Cb3()) + + let Cb = function('MyFunc', []) + call assert_equal("a/b/c", Cb("a", "b", "c")) + let Cb2 = function(Cb, []) + call assert_equal("a/b/d", Cb2("a", "b", "d")) + let Cb3 = function(Cb, ["a", "b"]) + call assert_equal("a/b/e", Cb3("e")) + + let Sort = function('MySort', [1]) + call assert_equal([1, 2, 3], sort([3, 1, 2], Sort)) + let Sort = function('MySort', [0]) + call assert_equal([3, 2, 1], sort([3, 1, 2], Sort)) + + let Map = function('MyMap', [2]) + call assert_equal([-1, 0, 1], map([1, 2, 3], Map)) + let Map = function('MyMap', [3]) + call assert_equal([-2, -1, 0], map([1, 2, 3], Map)) + + let Filter = function('MyFilter', [1]) + call assert_equal([2, 3], filter([1, 2, 3], Filter)) + let Filter = function('MyFilter', [2]) + call assert_equal([3], filter([1, 2, 3], Filter)) +endfunc + +func MyDictFunc(arg1, arg2) dict + return self.name . '/' . a:arg1 . '/' . a:arg2 +endfunc + +func Test_partial_dict() + let dict = {'name': 'hello'} + let Cb = function('MyDictFunc', ["foo", "bar"], dict) + call assert_equal("hello/foo/bar", Cb()) + call assert_fails('Cb("xxx")', 'E492:') + + let Cb = function('MyDictFunc', ["foo"], dict) + call assert_equal("hello/foo/xxx", Cb("xxx")) + call assert_fails('Cb()', 'E492:') + + let Cb = function('MyDictFunc', [], dict) + call assert_equal("hello/ttt/xxx", Cb("ttt", "xxx")) + call assert_fails('Cb("yyy")', 'E492:') + + let Cb = function('MyDictFunc', dict) + call assert_equal("hello/xxx/yyy", Cb("xxx", "yyy")) + call assert_fails('Cb("fff")', 'E492:') + + let Cb = function('MyDictFunc', dict) + call assert_equal({"foo": "hello/foo/1", "bar": "hello/bar/2"}, map({"foo": 1, "bar": 2}, Cb)) + + let dict = {"tr": function('tr', ['hello', 'h', 'H'])} + call assert_equal("Hello", dict.tr()) +endfunc + +func Test_partial_implicit() + let dict = {'name': 'foo'} + func dict.MyFunc(arg) dict + return self.name . '/' . a:arg + endfunc + + call assert_equal('foo/bar', dict.MyFunc('bar')) + + call assert_fails('let func = dict.MyFunc', 'E704:') + let Func = dict.MyFunc + call assert_equal('foo/aaa', Func('aaa')) + + let Func = function(dict.MyFunc, ['bbb']) + call assert_equal('foo/bbb', Func()) +endfunc + +fun InnerCall(funcref) + return a:funcref +endfu + +fun OuterCall() + let opt = { 'func' : function('sin') } + call InnerCall(opt.func) +endfu + +func Test_function_in_dict() + call OuterCall() +endfunc + +function! s:cache_clear() dict + return self.name +endfunction + +func Test_script_function_in_dict() + let s:obj = {'name': 'foo'} + let s:obj2 = {'name': 'bar'} + + let s:obj['clear'] = function('s:cache_clear') + + call assert_equal('foo', s:obj.clear()) + let F = s:obj.clear + call assert_equal('foo', F()) + call assert_equal('foo', call(s:obj.clear, [], s:obj)) + call assert_equal('bar', call(s:obj.clear, [], s:obj2)) + + let s:obj2['clear'] = function('s:cache_clear') + call assert_equal('bar', s:obj2.clear()) + let B = s:obj2.clear + call assert_equal('bar', B()) +endfunc + +function! s:cache_arg(arg) dict + let s:result = self.name . '/' . a:arg + return s:result +endfunction + +func Test_script_function_in_dict_arg() + let s:obj = {'name': 'foo'} + let s:obj['clear'] = function('s:cache_arg') + + call assert_equal('foo/bar', s:obj.clear('bar')) + let F = s:obj.clear + let s:result = '' + call assert_equal('foo/bar', F('bar')) + call assert_equal('foo/bar', s:result) + + let s:obj['clear'] = function('s:cache_arg', ['bar']) + call assert_equal('foo/bar', s:obj.clear()) + let s:result = '' + call s:obj.clear() + call assert_equal('foo/bar', s:result) + + let F = s:obj.clear + call assert_equal('foo/bar', F()) + let s:result = '' + call F() + call assert_equal('foo/bar', s:result) + + call assert_equal('foo/bar', call(s:obj.clear, [], s:obj)) +endfunc + +func Test_partial_exists() + let F = function('MyFunc') + call assert_true(exists('*F')) + let lF = [F] + call assert_true(exists('*lF[0]')) + + let F = function('MyFunc', ['arg']) + call assert_true(exists('*F')) + let lF = [F] + call assert_true(exists('*lF[0]')) +endfunc + +func Test_partial_string() + let F = function('MyFunc') + call assert_equal("function('MyFunc')", string(F)) + let F = function('MyFunc', ['foo']) + call assert_equal("function('MyFunc', ['foo'])", string(F)) + let F = function('MyFunc', ['foo', 'bar']) + call assert_equal("function('MyFunc', ['foo', 'bar'])", string(F)) + let d = {'one': 1} + let F = function('MyFunc', d) + call assert_equal("function('MyFunc', {'one': 1})", string(F)) + let F = function('MyFunc', ['foo'], d) + call assert_equal("function('MyFunc', ['foo'], {'one': 1})", string(F)) +endfunc + +func Test_func_unref() + let obj = {} + function! obj.func() abort + endfunction + let funcnumber = matchstr(string(obj.func), '^function(''\zs.\{-}\ze''') + call assert_true(exists('*{' . funcnumber . '}')) + unlet obj + call assert_false(exists('*{' . funcnumber . '}')) +endfunc + +func Test_tostring() + let d = {} + let d.d = d + function d.test3() + echo 42 + endfunction + try + call string(d.test3) + catch + call assert_true(v:false, v:exception) + endtry +endfunc + +func Test_redefine_dict_func() + let d = {} + function d.test4() + endfunction + let d.test4 = d.test4 + try + function! d.test4(name) + endfunction + catch + call assert_true(v:errmsg, v:exception) + endtry +endfunc + +func Test_bind_in_python() + if has('python') + let g:d = {} + function g:d.test2() + endfunction + python import vim + try + call assert_equal(pyeval('vim.bindeval("g:d.test2")'), g:d.test2) + catch + call assert_true(v:false, v:exception) + endtry + endif +endfunc + +" This caused double free on exit if EXITFREE is defined. +func Test_cyclic_list_arg() + let l = [] + let Pt = function('string', [l]) + call add(l, Pt) + unlet l + unlet Pt +endfunc + +" This caused double free on exit if EXITFREE is defined. +func Test_cyclic_dict_arg() + let d = {} + let Pt = function('string', [d]) + let d.Pt = Pt + unlet d + unlet Pt +endfunc + +func Ignored3(job1, job2, status) +endfunc + +func Test_cycle_partial_job() + if has('job') + let job = job_start('echo') + call job_setoptions(job, {'exit_cb': function('Ignored3', [job])}) + unlet job + endif +endfunc + +func Ignored2(job, status) +endfunc + +func Test_ref_job_partial_dict() + if has('job') + let g:ref_job = job_start('echo') + let d = {'a': 'b'} + call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)}) + endif +endfunc + +func Test_auto_partial_rebind() + let dict1 = {'name': 'dict1'} + func! dict1.f1() + return self.name + endfunc + let dict1.f2 = function(dict1.f1, dict1) + + call assert_equal('dict1', dict1.f1()) + call assert_equal('dict1', dict1['f1']()) + call assert_equal('dict1', dict1.f2()) + call assert_equal('dict1', dict1['f2']()) + + let dict2 = {'name': 'dict2'} + let dict2.f1 = dict1.f1 + let dict2.f2 = dict1.f2 + + call assert_equal('dict2', dict2.f1()) + call assert_equal('dict2', dict2['f1']()) + call assert_equal('dict1', dict2.f2()) + call assert_equal('dict1', dict2['f2']()) +endfunc + +func Test_get_partial_items() + let dict = {'name': 'hello'} + let args = ["foo", "bar"] + let Func = function('MyDictFunc') + let Cb = function('MyDictFunc', args, dict) + + call assert_equal(Func, get(Cb, 'func')) + call assert_equal('MyDictFunc', get(Cb, 'name')) + call assert_equal(args, get(Cb, 'args')) + call assert_equal(dict, get(Cb, 'dict')) + call assert_fails('call get(Cb, "xxx")', 'E475:') + + call assert_equal(Func, get(Func, 'func')) + call assert_equal('MyDictFunc', get(Func, 'name')) + call assert_equal([], get(Func, 'args')) + call assert_true(empty( get(Func, 'dict'))) +endfunc + +func Test_compare_partials() + let d1 = {} + let d2 = {} + + function d1.f1() dict + endfunction + + function d1.f2() dict + endfunction + + let F1 = get(d1, 'f1') + let F2 = get(d1, 'f2') + + let F1d1 = function(F1, d1) + let F2d1 = function(F2, d2) + let F1d1a1 = function(F1d1, [1]) + let F1d1a12 = function(F1d1, [1, 2]) + let F1a1 = function(F1, [1]) + let F1a2 = function(F1, [2]) + let F1d2 = function(F1, d2) + let d3 = {'f1': F1, 'f2': F2} + let F1d3 = function(F1, d3) + let F1ad1 = function(F1, [d1]) + let F1ad3 = function(F1, [d3]) + + call assert_match('^function(''\d\+'')$', string(F1)) " Not a partial + call assert_match('^function(''\d\+'')$', string(F2)) " Not a partial + call assert_match('^function(''\d\+'', {.*})$', string(F1d1)) " A partial + call assert_match('^function(''\d\+'', {.*})$', string(F2d1)) " A partial + call assert_match('^function(''\d\+'', \[.*\])$', string(F1a1)) " No dict + + " != + let X = F1 + call assert_false(F1 != X) " same function + let X = F1d1 + call assert_false(F1d1 != X) " same partial + let X = F1d1a1 + call assert_false(F1d1a1 != X) " same partial + let X = F1a1 + call assert_false(F1a1 != X) " same partial + + call assert_true(F1 != F2) " Different functions + call assert_true(F1 != F1d1) " Partial /= non-partial + call assert_true(F1d1a1 != F1d1a12) " Different number of arguments + call assert_true(F1a1 != F1d1a12) " One has no dict + call assert_true(F1a1 != F1a2) " Different arguments + call assert_true(F1d2 != F1d1) " Different dictionaries + call assert_false(F1d1 != F1d3) " Equal dictionaries, even though d1 isnot d3 + + " isnot, option 1 + call assert_true(F1 isnot# F2) " Different functions + call assert_true(F1 isnot# F1d1) " Partial /= non-partial + call assert_true(F1d1 isnot# F1d3) " d1 isnot d3, even though d1 == d3 + call assert_true(F1a1 isnot# F1d1a12) " One has no dict + call assert_true(F1a1 isnot# F1a2) " Different number of arguments + call assert_true(F1ad1 isnot# F1ad3) " In arguments d1 isnot d3 + + " isnot, option 2 + call assert_true(F1 isnot# F2) " Different functions + call assert_true(F1 isnot# F1d1) " Partial /= non-partial + call assert_true(d1.f1 isnot# d1.f1) " handle_subscript creates new partial each time +endfunc diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim new file mode 100644 index 0000000000..65f300cef0 --- /dev/null +++ b/src/testdir/test_paste.vim @@ -0,0 +1,112 @@ +" Tests for bracketed paste and other forms of pasting. + +" Bracketed paste only works with "xterm". Not in GUI. +if has('gui_running') + finish +endif +set term=xterm + +source shared.vim + +func Test_paste_normal_mode() + new + " In first column text is inserted + call setline(1, ['a', 'b', 'c']) + call cursor(2, 1) + call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt') + call assert_equal('foo', getline(2)) + call assert_equal('barb', getline(3)) + call assert_equal('c', getline(4)) + + " When repeating text is appended + normal . + call assert_equal('barfoo', getline(3)) + call assert_equal('barb', getline(4)) + call assert_equal('c', getline(5)) + bwipe! + + " In second column text is appended + call setline(1, ['a', 'bbb', 'c']) + call cursor(2, 2) + call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt') + call assert_equal('bbfoo', getline(2)) + call assert_equal('barb', getline(3)) + call assert_equal('c', getline(4)) + + " In last column text is appended + call setline(1, ['a', 'bbb', 'c']) + call cursor(2, 3) + call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt') + call assert_equal('bbbfoo', getline(2)) + call assert_equal('bar', getline(3)) + call assert_equal('c', getline(4)) +endfunc + +func Test_paste_insert_mode() + new + call setline(1, ['a', 'b', 'c']) + 2 + call feedkeys("i\<Esc>[200~foo\<CR>bar\<Esc>[201~ done\<Esc>", 'xt') + call assert_equal('foo', getline(2)) + call assert_equal('bar doneb', getline(3)) + call assert_equal('c', getline(4)) + + normal . + call assert_equal('bar donfoo', getline(3)) + call assert_equal('bar doneeb', getline(4)) + call assert_equal('c', getline(5)) + + set ai et tw=10 + call setline(1, ['a', ' b', 'c']) + 2 + call feedkeys("A\<Esc>[200~foo\<CR> bar bar bar\<Esc>[201~\<Esc>", 'xt') + call assert_equal(' bfoo', getline(2)) + call assert_equal(' bar bar bar', getline(3)) + call assert_equal('c', getline(4)) + + set ai& et& tw=0 + bwipe! +endfunc + +func Test_paste_clipboard() + if !WorkingClipboard() + return + endif + let @+ = "nasty\<Esc>:!ls\<CR>command" + new + exe "normal i\<C-R>+\<Esc>" + call assert_equal("nasty\<Esc>:!ls\<CR>command", getline(1)) + bwipe! +endfunc + +func Test_paste_cmdline() + call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt') + call assert_equal("\"afoo\<CR>barb", getreg(':')) +endfunc + +func Test_paste_visual_mode() + new + call setline(1, 'here are some words') + call feedkeys("0fsve\<Esc>[200~more\<Esc>[201~", 'xt') + call assert_equal('here are more words', getline(1)) + call assert_equal('some', getreg('-')) + + " include last char in the line + call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt') + call assert_equal('here are more noises', getline(1)) + call assert_equal('words', getreg('-')) + + " exclude last char in the line + call setline(1, 'some words!') + call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt') + call assert_equal('some noises!', getline(1)) + call assert_equal('words', getreg('-')) + + " multi-line selection + call setline(1, ['some words', 'and more']) + call feedkeys("0fwvj0fd\<Esc>[200~letters\<Esc>[201~", 'xt') + call assert_equal('some letters more', getline(1)) + call assert_equal("words\nand", getreg('1')) + + bwipe! +endfunc diff --git a/src/testdir/test_perl.vim b/src/testdir/test_perl.vim new file mode 100644 index 0000000000..6ef17ad8bb --- /dev/null +++ b/src/testdir/test_perl.vim @@ -0,0 +1,238 @@ +" Tests for Perl interface + +if !has('perl') + finish +end + +func Test_change_buffer() + call setline(line('$'), ['1 line 1']) + perl VIM::DoCommand("normal /^1\n") + perl $curline = VIM::Eval("line('.')") + perl $curbuf->Set($curline, "1 changed line 1") + call assert_equal('1 changed line 1', getline('$')) +endfunc + +func Test_evaluate_list() + call setline(line('$'), ['2 line 2']) + perl VIM::DoCommand("normal /^2\n") + perl $curline = VIM::Eval("line('.')") + let l = ["abc", "def"] + perl << EOF + $l = VIM::Eval("l"); + $curbuf->Append($curline, $l); +EOF + normal j + .perldo s|\n|/|g + call assert_equal('abc/def/', getline('$')) +endfunc + +func Test_buffer_Delete() + new + call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']) + perl $curbuf->Delete(7) + perl $curbuf->Delete(2, 5) + perl $curbuf->Delete(10) + call assert_equal(['a', 'f', 'h'], getline(1, '$')) + bwipe! +endfunc + +func Test_buffer_Append() + new + perl $curbuf->Append(1, '1') + perl $curbuf->Append(2, '2', '3', '4') + perl @l = ('5' ..'7') + perl $curbuf->Append(0, @l) + call assert_equal(['5', '6', '7', '', '1', '2', '3', '4'], getline(1, '$')) + bwipe! +endfunc + +func Test_buffer_Set() + new + call setline(1, ['1', '2', '3', '4', '5']) + perl $curbuf->Set(2, 'a', 'b', 'c') + perl $curbuf->Set(4, 'A', 'B', 'C') + call assert_equal(['1', 'a', 'b', 'A', 'B'], getline(1, '$')) + bwipe! +endfunc + +func Test_buffer_Get() + new + call setline(1, ['1', '2', '3', '4']) + call assert_equal('2:3', perleval('join(":", $curbuf->Get(2, 3))')) + bwipe! +endfunc + +func Test_buffer_Count() + new + call setline(1, ['a', 'b', 'c']) + call assert_equal(3, perleval('$curbuf->Count()')) + bwipe! +endfunc + +func Test_buffer_Name() + new + call assert_equal('', perleval('$curbuf->Name()')) + bwipe! + new Xfoo + call assert_equal('Xfoo', perleval('$curbuf->Name()')) + bwipe! +endfunc + +func Test_buffer_Number() + call assert_equal(bufnr('%'), perleval('$curbuf->Number()')) +endfunc + +func Test_window_Cursor() + new + call setline(1, ['line1', 'line2']) + perl $curwin->Cursor(2, 3) + call assert_equal('2:3', perleval('join(":", $curwin->Cursor())')) + " Col is numbered from 0 in Perl, and from 1 in Vim script. + call assert_equal([0, 2, 4, 0], getpos('.')) + bwipe! +endfunc + +func Test_window_SetHeight() + new + perl $curwin->SetHeight(2) + call assert_equal(2, winheight(0)) + bwipe! +endfunc + +func Test_VIM_Windows() + new + " VIM::Windows() without argument in scalar and list context. + perl $winnr = VIM::Windows() + perl @winlist = VIM::Windows() + perl $curbuf->Append(0, $winnr, scalar(@winlist)) + call assert_equal(['2', '2', ''], getline(1, '$')) + + " VIM::Windows() with window number argument. + perl VIM::Windows(VIM::Eval('winnr()'))->Buffer()->Set(1, 'bar') + call assert_equal('bar', getline(1)) + bwipe! +endfunc + +func Test_VIM_Buffers() + new Xbar + " VIM::Buffers() without argument in scalar and list context. + perl $nbuf = VIM::Buffers() + perl @buflist = VIM::Buffers() + + " VIM::Buffers() with argument. + perl $mybuf = (VIM::Buffers('Xbar'))[0] + perl $mybuf->Append(0, $nbuf, scalar(@buflist)) + call assert_equal(['2', '2', ''], getline(1, '$')) + bwipe! +endfunc + +func <SID>catch_peval(expr) + try + call perleval(a:expr) + catch + return v:exception + endtry + call assert_report('no exception for `perleval("'.a:expr.'")`') + return '' +endfunc + +func Test_perleval() + call assert_false(perleval('undef')) + + " scalar + call assert_equal(0, perleval('0')) + call assert_equal(2, perleval('2')) + call assert_equal(-2, perleval('-2')) + if has('float') + call assert_equal(2.5, perleval('2.5')) + else + call assert_equal(2, perleval('2.5')) + end + + sandbox call assert_equal(2, perleval('2')) + + call assert_equal('abc', perleval('"abc"')) + call assert_equal("abc\ndef", perleval('"abc\0def"')) + + " ref + call assert_equal([], perleval('[]')) + call assert_equal(['word', 42, [42],{}], perleval('["word", 42, [42], {}]')) + + call assert_equal({}, perleval('{}')) + call assert_equal({'foo': 'bar'}, perleval('{foo => "bar"}')) + + perl our %h; our @a; + let a = perleval('[\(%h, %h, @a, @a)]') + call assert_true((a[0] is a[1])) + call assert_true((a[2] is a[3])) + perl undef %h; undef @a; + + call assert_true(<SID>catch_peval('{"" , 0}') =~ 'Malformed key Dictionary') + call assert_true(<SID>catch_peval('{"\0" , 0}') =~ 'Malformed key Dictionary') + call assert_true(<SID>catch_peval('{"foo\0bar" , 0}') =~ 'Malformed key Dictionary') + + call assert_equal('*VIM', perleval('"*VIM"')) + call assert_true(perleval('\\0') =~ 'SCALAR(0x\x\+)') +endfunc + +func Test_perldo() + sp __TEST__ + exe 'read ' g:testname + perldo s/perl/vieux_chameau/g + 1 + call assert_false(search('\Cperl')) + bw! + + " Check deleting lines does not trigger ml_get error. + new + call setline(1, ['one', 'two', 'three']) + perldo VIM::DoCommand("%d_") + bwipe! + + " Check switching to another buffer does not trigger ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + perldo VIM::DoCommand("new") + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc + +func Test_VIM_package() + perl VIM::DoCommand('let l:var = "foo"') + call assert_equal(l:var, 'foo') + + set noet + perl VIM::SetOption('et') + call assert_true(&et) +endfunc + +func Test_stdio() + redir =>l:out + perl <<EOF + VIM::Msg("&VIM::Msg"); + print "STDOUT"; + print STDERR "STDERR"; +EOF + redir END + call assert_equal(['&VIM::Msg', 'STDOUT', 'STDERR'], split(l:out, "\n")) +endfunc + +func Test_SvREFCNT() + new t + perl <<--perl + my ($b, $w); + $b = $curbuf for 0 .. 10; + $w = $curwin for 0 .. 10; + VIM::DoCommand('bw! t'); + if (exists &Internals::SvREFCNT) { + my $cb = Internals::SvREFCNT($$b); + my $cw = Internals::SvREFCNT($$w); + VIM::Eval("assert_equal(2, $cb)"); + VIM::Eval("assert_equal(2, $cw)"); + } + VIM::Eval("assert_false($$b)"); + VIM::Eval("assert_false($$w)"); +--perl +endfunc diff --git a/src/testdir/test_plus_arg_edit.vim b/src/testdir/test_plus_arg_edit.vim new file mode 100644 index 0000000000..e91a6e467a --- /dev/null +++ b/src/testdir/test_plus_arg_edit.vim @@ -0,0 +1,38 @@ +" Tests for complicated + argument to :edit command +function Test_edit() + call writefile(["foo|bar"], "Xfile1") + call writefile(["foo/bar"], "Xfile2") + edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w + call assert_equal(["fooPIPEbar"], readfile("Xfile1")) + call assert_equal(["fooSLASHbar"], readfile("Xfile2")) + call delete('Xfile1') + call delete('Xfile2') +endfunction + +func Test_edit_bad() + if !has('multi_byte') + finish + endif + + " Test loading a utf8 file with bad utf8 sequences. + call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xfile") + new + + " Without ++bad=..., the default behavior is like ++bad=? + e! ++enc=utf8 Xfile + call assert_equal('[?][?][???][??]', getline(1)) + + e! ++enc=utf8 ++bad=_ Xfile + call assert_equal('[_][_][___][__]', getline(1)) + + e! ++enc=utf8 ++bad=drop Xfile + call assert_equal('[][][][]', getline(1)) + + e! ++enc=utf8 ++bad=keep Xfile + call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1)) + + call assert_fails('e! ++enc=utf8 ++bad=foo Xfile', 'E474:') + + bw! + call delete('Xfile') +endfunc diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim new file mode 100644 index 0000000000..9c25687ad3 --- /dev/null +++ b/src/testdir/test_popup.vim @@ -0,0 +1,864 @@ +" Test for completion menu + +source shared.vim +source screendump.vim + +let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] +let g:setting = '' + +func ListMonths() + if g:setting != '' + exe ":set" g:setting + endif + let mth = copy(g:months) + let entered = strcharpart(getline('.'),0,col('.')) + if !empty(entered) + let mth = filter(mth, 'v:val=~"^".entered') + endif + call complete(1, mth) + return '' +endfunc + +func Test_popup_complete2() + " Although the popupmenu is not visible, this does not mean completion mode + " has ended. After pressing <f5> to complete the currently typed char, Vim + " still stays in the first state of the completion (:h ins-completion-menu), + " although the popupmenu wasn't shown <c-e> will remove the inserted + " completed text (:h complete_CTRL-E), while the following <c-e> will behave + " like expected (:h i_CTRL-E) + new + inoremap <f5> <c-r>=ListMonths()<cr> + call append(1, ["December2015"]) + :1 + call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx') + call assert_equal(["Dece", "", "December2015"], getline(1,3)) + %d + bw! +endfunc + +func Test_popup_complete() + new + inoremap <f5> <c-r>=ListMonths()<cr> + + " <C-E> - select original typed text before the completion started + call feedkeys("aJu\<f5>\<down>\<c-e>\<esc>", 'tx') + call assert_equal(["Ju"], getline(1,2)) + %d + + " <C-Y> - accept current match + call feedkeys("a\<f5>". repeat("\<down>",7). "\<c-y>\<esc>", 'tx') + call assert_equal(["August"], getline(1,2)) + %d + + " <BS> - Delete one character from the inserted text (state: 1) + " TODO: This should not end the completion, but it does. + " This should according to the documentation: + " January + " but instead, this does + " Januar + " (idea is, C-L inserts the match from the popup menu + " but if the menu is closed, it will insert the character <c-l> + call feedkeys("aJ\<f5>\<bs>\<c-l>\<esc>", 'tx') + call assert_equal(["Januar "], getline(1,2)) + %d + + " any-non special character: Stop completion without changing the match + " and insert the typed character + call feedkeys("a\<f5>20", 'tx') + call assert_equal(["January20"], getline(1,2)) + %d + + " any-non printable, non-white character: Add this character and + " reduce number of matches + call feedkeys("aJu\<f5>\<c-p>l\<c-y>", 'tx') + call assert_equal(["Jul"], getline(1,2)) + %d + + " any-non printable, non-white character: Add this character and + " reduce number of matches + call feedkeys("aJu\<f5>\<c-p>l\<c-n>\<c-y>", 'tx') + call assert_equal(["July"], getline(1,2)) + %d + + " any-non printable, non-white character: Add this character and + " reduce number of matches + call feedkeys("aJu\<f5>\<c-p>l\<c-e>", 'tx') + call assert_equal(["Jul"], getline(1,2)) + %d + + " <BS> - Delete one character from the inserted text (state: 2) + call feedkeys("a\<f5>\<c-n>\<bs>", 'tx') + call assert_equal(["Februar"], getline(1,2)) + %d + + " <c-l> - Insert one character from the current match + call feedkeys("aJ\<f5>".repeat("\<c-n>",3)."\<c-l>\<esc>", 'tx') + call assert_equal(["J "], getline(1,2)) + %d + + " <c-l> - Insert one character from the current match + call feedkeys("aJ\<f5>".repeat("\<c-n>",4)."\<c-l>\<esc>", 'tx') + call assert_equal(["January "], getline(1,2)) + %d + + " <c-y> - Accept current selected match + call feedkeys("aJ\<f5>\<c-y>\<esc>", 'tx') + call assert_equal(["January"], getline(1,2)) + %d + + " <c-e> - End completion, go back to what was there before selecting a match + call feedkeys("aJu\<f5>\<c-e>\<esc>", 'tx') + call assert_equal(["Ju"], getline(1,2)) + %d + + " <PageUp> - Select a match several entries back + call feedkeys("a\<f5>\<PageUp>\<c-y>\<esc>", 'tx') + call assert_equal([""], getline(1,2)) + %d + + " <PageUp><PageUp> - Select a match several entries back + call feedkeys("a\<f5>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx') + call assert_equal(["December"], getline(1,2)) + %d + + " <PageUp><PageUp><PageUp> - Select a match several entries back + call feedkeys("a\<f5>\<PageUp>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx') + call assert_equal(["February"], getline(1,2)) + %d + + " <PageDown> - Select a match several entries further + call feedkeys("a\<f5>\<PageDown>\<c-y>\<esc>", 'tx') + call assert_equal(["November"], getline(1,2)) + %d + + " <PageDown><PageDown> - Select a match several entries further + call feedkeys("a\<f5>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx') + call assert_equal(["December"], getline(1,2)) + %d + + " <PageDown><PageDown><PageDown> - Select a match several entries further + call feedkeys("a\<f5>\<PageDown>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx') + call assert_equal([""], getline(1,2)) + %d + + " <PageDown><PageDown><PageDown><PageDown> - Select a match several entries further + call feedkeys("a\<f5>".repeat("\<PageDown>",4)."\<c-y>\<esc>", 'tx') + call assert_equal(["October"], getline(1,2)) + %d + + " <Up> - Select a match don't insert yet + call feedkeys("a\<f5>\<Up>\<c-y>\<esc>", 'tx') + call assert_equal([""], getline(1,2)) + %d + + " <Up><Up> - Select a match don't insert yet + call feedkeys("a\<f5>\<Up>\<Up>\<c-y>\<esc>", 'tx') + call assert_equal(["December"], getline(1,2)) + %d + + " <Up><Up><Up> - Select a match don't insert yet + call feedkeys("a\<f5>\<Up>\<Up>\<Up>\<c-y>\<esc>", 'tx') + call assert_equal(["November"], getline(1,2)) + %d + + " <Tab> - Stop completion and insert the match + call feedkeys("a\<f5>\<Tab>\<c-y>\<esc>", 'tx') + call assert_equal(["January "], getline(1,2)) + %d + + " <Space> - Stop completion and insert the match + call feedkeys("a\<f5>".repeat("\<c-p>",5)." \<esc>", 'tx') + call assert_equal(["September "], getline(1,2)) + %d + + " <Enter> - Use the text and insert line break (state: 1) + call feedkeys("a\<f5>\<enter>\<esc>", 'tx') + call assert_equal(["January", ''], getline(1,2)) + %d + + " <Enter> - Insert the current selected text (state: 2) + call feedkeys("a\<f5>".repeat("\<Up>",5)."\<enter>\<esc>", 'tx') + call assert_equal(["September"], getline(1,2)) + %d + + " Insert match immediately, if there is only one match + " <c-y> selects a character from the line above + call append(0, ["December2015"]) + call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx') + call assert_equal(["December2015", "December2015", ""], getline(1,3)) + %d + + " use menuone for 'completeopt' + " Since for the first <c-y> the menu is still shown, will only select + " three letters from the line above + set completeopt&vim + set completeopt+=menuone + call append(0, ["December2015"]) + call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx') + call assert_equal(["December2015", "December201", ""], getline(1,3)) + %d + + " use longest for 'completeopt' + set completeopt&vim + call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx') + set completeopt+=longest + call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx') + call assert_equal(["M", "Ma", ""], getline(1,3)) + %d + + " use noselect/noinsert for 'completeopt' + set completeopt&vim + call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') + set completeopt+=noselect + call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') + set completeopt-=noselect completeopt+=noinsert + call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') + call assert_equal(["March", "M", "March"], getline(1,4)) + %d +endfunc + + +func Test_popup_completion_insertmode() + new + inoremap <F5> <C-R>=ListMonths()<CR> + + call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') + call assert_equal('February', getline(1)) + %d + " Set noinsertmode + let g:setting = 'noinsertmode' + call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') + call assert_equal('February', getline(1)) + call assert_false(pumvisible()) + %d + " Go through all matches, until none is selected + let g:setting = '' + call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx') + call assert_equal('', getline(1)) + %d + " select previous entry + call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx') + call assert_equal('', getline(1)) + %d + " select last entry + call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx') + call assert_equal('December', getline(1)) + + iunmap <F5> +endfunc + +func Test_noinsert_complete() + func! s:complTest1() abort + call complete(1, ['source', 'soundfold']) + return '' + endfunc + + func! s:complTest2() abort + call complete(1, ['source', 'soundfold']) + return '' + endfunc + + new + set completeopt+=noinsert + inoremap <F5> <C-R>=s:complTest1()<CR> + call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx') + call assert_equal('soundfold', getline(1)) + call assert_equal('soundfold', getline(2)) + bwipe! + + new + inoremap <F5> <C-R>=s:complTest2()<CR> + call feedkeys("i\<F5>\<CR>\<ESC>", 'tx') + call assert_equal('source', getline(1)) + bwipe! + + set completeopt-=noinsert + iunmap <F5> +endfunc + +func Test_compl_vim_cmds_after_register_expr() + func! s:test_func() + return 'autocmd ' + endfunc + augroup AAAAA_Group + au! + augroup END + + new + call feedkeys("i\<c-r>=s:test_func()\<CR>\<C-x>\<C-v>\<Esc>", 'tx') + call assert_equal('autocmd AAAAA_Group', getline(1)) + autocmd! AAAAA_Group + augroup! AAAAA_Group + bwipe! +endfunc + +func DummyCompleteOne(findstart, base) + if a:findstart + return 0 + else + wincmd n + return ['onedef', 'oneDEF'] + endif +endfunc + +" Test that nothing happens if the 'completefunc' opens +" a new window (no completion, no crash) +func Test_completefunc_opens_new_window_one() + new + let winid = win_getid() + setlocal completefunc=DummyCompleteOne + call setline(1, 'one') + /^one + call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E839:') + call assert_notequal(winid, win_getid()) + q! + call assert_equal(winid, win_getid()) + call assert_equal('', getline(1)) + q! +endfunc + +" Test that nothing happens if the 'completefunc' opens +" a new window (no completion, no crash) +func DummyCompleteTwo(findstart, base) + if a:findstart + wincmd n + return 0 + else + return ['twodef', 'twoDEF'] + endif +endfunc + +" Test that nothing happens if the 'completefunc' opens +" a new window (no completion, no crash) +func Test_completefunc_opens_new_window_two() + new + let winid = win_getid() + setlocal completefunc=DummyCompleteTwo + call setline(1, 'two') + /^two + call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E764:') + call assert_notequal(winid, win_getid()) + q! + call assert_equal(winid, win_getid()) + call assert_equal('two', getline(1)) + q! +endfunc + +func DummyCompleteThree(findstart, base) + if a:findstart + return 0 + else + return ['threedef', 'threeDEF'] + endif +endfunc + +:"Test that 'completefunc' works when it's OK. +func Test_completefunc_works() + new + let winid = win_getid() + setlocal completefunc=DummyCompleteThree + call setline(1, 'three') + /^three + call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x") + call assert_equal(winid, win_getid()) + call assert_equal('threeDEF', getline(1)) + q! +endfunc + +func DummyCompleteFour(findstart, base) + if a:findstart + return 0 + else + call complete_add('four1') + call complete_add('four2') + call complete_check() + call complete_add('four3') + call complete_add('four4') + call complete_check() + call complete_add('four5') + call complete_add('four6') + return [] + endif +endfunc + +" Test that 'omnifunc' works when it's OK. +func Test_omnifunc_with_check() + new + setlocal omnifunc=DummyCompleteFour + call setline(1, 'four') + /^four + call feedkeys("A\<C-X>\<C-O>\<C-N>\<Esc>", "x") + call assert_equal('four2', getline(1)) + + call setline(1, 'four') + /^four + call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<Esc>", "x") + call assert_equal('four3', getline(1)) + + call setline(1, 'four') + /^four + call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<C-N>\<Esc>", "x") + call assert_equal('four5', getline(1)) + + q! +endfunc + +func UndoComplete() + call complete(1, ['January', 'February', 'March', + \ 'April', 'May', 'June', 'July', 'August', 'September', + \ 'October', 'November', 'December']) + return '' +endfunc + +" Test that no undo item is created when no completion is inserted +func Test_complete_no_undo() + set completeopt=menu,preview,noinsert,noselect + inoremap <Right> <C-R>=UndoComplete()<CR> + new + call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt') + call feedkeys("iaaa\<Esc>0", 'xt') + call assert_equal('aaa', getline(2)) + call feedkeys("i\<Right>\<Esc>", 'xt') + call assert_equal('aaa', getline(2)) + call feedkeys("u", 'xt') + call assert_equal('', getline(2)) + + call feedkeys("ibbb\<Esc>0", 'xt') + call assert_equal('bbb', getline(2)) + call feedkeys("A\<Right>\<Down>\<CR>\<Esc>", 'xt') + call assert_equal('January', getline(2)) + call feedkeys("u", 'xt') + call assert_equal('bbb', getline(2)) + + call feedkeys("A\<Right>\<C-N>\<Esc>", 'xt') + call assert_equal('January', getline(2)) + call feedkeys("u", 'xt') + call assert_equal('bbb', getline(2)) + + iunmap <Right> + set completeopt& + q! +endfunc + +func DummyCompleteFive(findstart, base) + if a:findstart + return 0 + else + return [ + \ { 'word': 'January', 'info': "info1-1\n1-2\n1-3" }, + \ { 'word': 'February', 'info': "info2-1\n2-2\n2-3" }, + \ { 'word': 'March', 'info': "info3-1\n3-2\n3-3" }, + \ { 'word': 'April', 'info': "info4-1\n4-2\n4-3" }, + \ { 'word': 'May', 'info': "info5-1\n5-2\n5-3" }, + \ ] + endif +endfunc + +" Test that 'completefunc' on Scratch buffer with preview window works when +" it's OK. +func Test_completefunc_with_scratch_buffer() + new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile + set completeopt+=preview + setlocal completefunc=DummyCompleteFive + call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x") + call assert_equal(['April'], getline(1, '$')) + pclose + q! + set completeopt& +endfunc + +" <C-E> - select original typed text before the completion started without +" auto-wrap text. +func Test_completion_ctrl_e_without_autowrap() + new + let tw_save = &tw + set tw=78 + let li = [ + \ '" zzz', + \ '" zzzyyyyyyyyyyyyyyyyyyy'] + call setline(1, li) + 0 + call feedkeys("A\<C-X>\<C-N>\<C-E>\<Esc>", "tx") + call assert_equal(li, getline(1, '$')) + + let &tw = tw_save + q! +endfunc + +func DummyCompleteSix() + call complete(1, ['Hello', 'World']) + return '' +endfunction + +" complete() correctly clears the list of autocomplete candidates +" See #1411 +func Test_completion_clear_candidate_list() + new + %d + " select first entry from the completion popup + call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>", "tx") + call assert_equal('Hello', getline(1)) + %d + " select second entry from the completion popup + call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>", "tx") + call assert_equal('World', getline(1)) + %d + " select original text + call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>", "tx") + call assert_equal(' xxx', getline(1)) + %d + " back at first entry from completion list + call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>\<C-N>", "tx") + call assert_equal('Hello', getline(1)) + + bw! +endfunc + +func Test_completion_respect_bs_option() + new + let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"] + + set bs=indent,eol + call setline(1, li) + 1 + call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx") + call assert_equal('aaa', getline(1)) + + %d + set bs=indent,eol,start + call setline(1, li) + 1 + call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx") + call assert_equal('', getline(1)) + + bw! +endfunc + +func CompleteUndo() abort + call complete(1, g:months) + return '' +endfunc + +func Test_completion_can_undo() + inoremap <Right> <c-r>=CompleteUndo()<cr> + set completeopt+=noinsert,noselect + + new + call feedkeys("a\<Right>a\<Esc>", 'xt') + call assert_equal('a', getline(1)) + undo + call assert_equal('', getline(1)) + + bwipe! + set completeopt& + iunmap <Right> +endfunc + +func Test_completion_comment_formatting() + new + setl formatoptions=tcqro + call feedkeys("o/*\<cr>\<cr>/\<esc>", 'tx') + call assert_equal(['', '/*', ' *', ' */'], getline(1,4)) + %d + call feedkeys("o/*\<cr>foobar\<cr>/\<esc>", 'tx') + call assert_equal(['', '/*', ' * foobar', ' */'], getline(1,4)) + %d + try + call feedkeys("o/*\<cr>\<cr>\<c-x>\<c-u>/\<esc>", 'tx') + call assert_report('completefunc not set, should have failed') + catch + call assert_exception('E764:') + endtry + call assert_equal(['', '/*', ' *', ' */'], getline(1,4)) + bwipe! +endfunc + +func MessCompleteMonths() + for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep") + call complete_add(m) + if complete_check() + break + endif + endfor + return [] +endfunc + +func MessCompleteMore() + call complete(1, split("Oct Nov Dec")) + return [] +endfunc + +func MessComplete(findstart, base) + if a:findstart + let line = getline('.') + let start = col('.') - 1 + while start > 0 && line[start - 1] =~ '\a' + let start -= 1 + endwhile + return start + else + call MessCompleteMonths() + call MessCompleteMore() + return [] + endif +endfunc + +func Test_complete_func_mess() + " Calling complete() after complete_add() in 'completefunc' is wrong, but it + " should not crash. + set completefunc=MessComplete + new + call setline(1, 'Ju') + call feedkeys("A\<c-x>\<c-u>/\<esc>", 'tx') + call assert_equal('Oct/Oct', getline(1)) + bwipe! + set completefunc= +endfunc + +func Test_complete_CTRLN_startofbuffer() + new + call setline(1, [ 'organize(cupboard, 3, 2);', + \ 'prioritize(bureau, 8, 7);', + \ 'realize(bannister, 4, 4);', + \ 'moralize(railing, 3,9);']) + let expected=['cupboard.organize(3, 2);', + \ 'bureau.prioritize(8, 7);', + \ 'bannister.realize(4, 4);', + \ 'railing.moralize(3,9);'] + call feedkeys("qai\<c-n>\<c-n>.\<esc>3wdW\<cr>q3@a", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc + +func Test_popup_and_window_resize() + if !has('terminal') || has('gui_running') + return + endif + let h = winheight(0) + if h < 15 + return + endif + let rows = h / 3 + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': rows}) + call term_sendkeys(buf, (h / 3 - 1) . "o\<esc>") + " Wait for the nested Vim to exit insert mode, where it will show the ruler. + " Need to trigger a redraw. + call WaitFor({-> execute("redraw") == "" && term_getline(buf, rows) =~ '\<' . rows . ',.*Bot'}) + + call term_sendkeys(buf, "Gi\<c-x>") + call term_sendkeys(buf, "\<c-v>") + call term_wait(buf, 100) + " popup first entry "!" must be at the top + call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))}) + exe 'resize +' . (h - 1) + call term_wait(buf, 100) + redraw! + " popup shifted down, first line is now empty + call WaitForAssert({-> assert_equal('', term_getline(buf, 1))}) + sleep 100m + " popup is below cursor line and shows first match "!" + call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))}) + " cursor line also shows ! + call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) + bwipe! +endfunc + +func Test_popup_and_preview_autocommand() + " This used to crash Vim + if !has('python') + return + endif + let h = winheight(0) + if h < 15 + return + endif + new + augroup MyBufAdd + au! + au BufAdd * nested tab sball + augroup END + set omnifunc=pythoncomplete#Complete + call setline(1, 'import os') + " make the line long + call setline(2, ' os.') + $ + call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<enter>\<esc>", 'tx') + call assert_equal("import os", getline(1)) + call assert_match(' os.\(EX_IOERR\|O_CREAT\)$', getline(2)) + call assert_equal(1, winnr('$')) + " previewwindow option is not set + call assert_equal(0, &previewwindow) + norm! gt + call assert_equal(0, &previewwindow) + norm! gT + call assert_equal(10, tabpagenr('$')) + tabonly + pclose + augroup MyBufAdd + au! + augroup END + augroup! MyBufAdd + bw! +endfunc + +func Test_balloon_split() + if !exists('*balloon_split') + return + endif + call assert_equal([ + \ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"', + \ ], balloon_split( + \ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"')) + call assert_equal([ + \ 'one two three four one two three four one two thre', + \ 'e four', + \ ], balloon_split( + \ 'one two three four one two three four one two three four')) + + call assert_equal([ + \ 'struct = {', + \ ' one = 1,', + \ ' two = 2,', + \ ' three = 3}', + \ ], balloon_split( + \ 'struct = {one = 1, two = 2, three = 3}')) + + call assert_equal([ + \ 'struct = {', + \ ' one = 1,', + \ ' nested = {', + \ ' n1 = "yes",', + \ ' n2 = "no"}', + \ ' two = 2}', + \ ], balloon_split( + \ 'struct = {one = 1, nested = {n1 = "yes", n2 = "no"} two = 2}')) + call assert_equal([ + \ 'struct = 0x234 {', + \ ' long = 2343 "\\"some long string that will be wr', + \ 'apped in two\\"",', + \ ' next = 123}', + \ ], balloon_split( + \ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}')) +endfunc + +func Test_popup_position() + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ '123456789_123456789_123456789_a', + \ '123456789_123456789_123456789_b', + \ ' 123', + \ ], 'Xtest') + let buf = RunVimInTerminal('Xtest', {}) + call term_sendkeys(buf, ":vsplit\<CR>") + + " default pumwidth in left window: overlap in right window + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>u") + + " default pumwidth: fill until right of window + call term_sendkeys(buf, "\<C-W>l") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8}) + + " larger pumwidth: used as minimum width + call term_sendkeys(buf, "\<Esc>u") + call term_sendkeys(buf, ":set pumwidth=30\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8}) + + " completed text wider than the window and 'pumwidth' smaller than available + " space + call term_sendkeys(buf, "\<Esc>u") + call term_sendkeys(buf, ":set pumwidth=20\<CR>") + call term_sendkeys(buf, "ggI123456789_\<Esc>") + call term_sendkeys(buf, "jI123456789_\<Esc>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10}) + + call term_sendkeys(buf, "\<Esc>u") + call StopVimInTerminal(buf) + call delete('Xtest') +endfunc + +func Test_popup_command() + if !CanRunVimInTerminal() || !has('menu') + return + endif + + call writefile([ + \ 'one two three four five', + \ 'and one two Xthree four five', + \ 'one more two three four five', + \ ], 'Xtest') + let buf = RunVimInTerminal('Xtest', {}) + call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>") + call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>") + call VerifyScreenDump(buf, 'Test_popup_command_01', {}) + + " Select a word + call term_sendkeys(buf, "jj") + call VerifyScreenDump(buf, 'Test_popup_command_02', {}) + + " Select a word + call term_sendkeys(buf, "j\<CR>") + call VerifyScreenDump(buf, 'Test_popup_command_03', {}) + + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('Xtest') +endfunc + +func Test_popup_complete_backwards() + new + call setline(1, ['Post', 'Port', 'Po']) + let expected=['Post', 'Port', 'Port'] + call cursor(3,2) + call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<cr>", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc + +func Test_popup_complete_backwards_ctrl_p() + new + call setline(1, ['Post', 'Port', 'Po']) + let expected=['Post', 'Port', 'Port'] + call cursor(3,2) + call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc + +func Test_complete_o_tab() + let s:o_char_pressed = 0 + + fun! s:act_on_text_changed() + if s:o_char_pressed + let s:o_char_pressed = 0 + call feedkeys("\<c-x>\<c-n>", 'i') + endif + endfunc + + set completeopt=menu,noselect + new + imap <expr> <buffer> <tab> pumvisible() ? "\<c-p>" : "X" + autocmd! InsertCharPre <buffer> let s:o_char_pressed = (v:char ==# 'o') + autocmd! TextChangedI <buffer> call <sid>act_on_text_changed() + call setline(1, ['hoard', 'hoax', 'hoarse', '']) + let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax'] + call cursor(4,1) + call test_override("char_avail", 1) + call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx') + call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx') + call assert_equal(l:expected, getline(1,'$')) + + call test_override("char_avail", 0) + bwipe! + set completeopt& + delfunc s:act_on_text_changed +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_preview.vim b/src/testdir/test_preview.vim new file mode 100644 index 0000000000..91923fb1e9 --- /dev/null +++ b/src/testdir/test_preview.vim @@ -0,0 +1,13 @@ +" Tests for the preview window + +func Test_Psearch() + " this used to cause ml_get errors + help + let wincount = winnr('$') + 0f + ps. + call assert_equal(wincount + 1, winnr('$')) + pclose + call assert_equal(wincount, winnr('$')) + bwipe +endfunc diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim new file mode 100644 index 0000000000..ee617760f8 --- /dev/null +++ b/src/testdir/test_profile.vim @@ -0,0 +1,224 @@ +" Test Vim profiler +if !has('profile') + finish +endif + +func Test_profile_func() + let lines = [ + \ "func! Foo1()", + \ "endfunc", + \ "func! Foo2()", + \ " let l:count = 100", + \ " while l:count > 0", + \ " let l:count = l:count - 1", + \ " endwhile", + \ "endfunc", + \ "func! Foo3()", + \ "endfunc", + \ "func! Bar()", + \ "endfunc", + \ "call Foo1()", + \ "call Foo1()", + \ "profile pause", + \ "call Foo1()", + \ "profile continue", + \ "call Foo2()", + \ "call Foo3()", + \ "call Bar()", + \ "if !v:profiling", + \ " delfunc Foo2", + \ "endif", + \ "delfunc Foo3", + \ ] + + call writefile(lines, 'Xprofile_func.vim') + call system(v:progpath + \ . ' -es -u NONE -U NONE -i NONE --noplugin' + \ . ' -c "profile start Xprofile_func.log"' + \ . ' -c "profile func Foo*"' + \ . ' -c "so Xprofile_func.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + let lines = readfile('Xprofile_func.log') + + " - Foo1() is called 3 times but should be reported as called twice + " since one call is in between "profile pause" .. "profile continue". + " - Foo2() should come before Foo1() since Foo1() does much more work. + " - Foo3() is not reported because function is deleted. + " - Unlike Foo3(), Foo2() should not be deleted since there is a check + " for v:profiling. + " - Bar() is not reported since it does not match "profile func Foo*". + call assert_equal(28, len(lines)) + + call assert_equal('FUNCTION Foo1()', lines[0]) + call assert_equal('Called 2 times', lines[1]) + call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) + call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) + call assert_equal('', lines[4]) + call assert_equal('count total (s) self (s)', lines[5]) + call assert_equal('', lines[6]) + call assert_equal('FUNCTION Foo2()', lines[7]) + call assert_equal('Called 1 time', lines[8]) + call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[9]) + call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[10]) + call assert_equal('', lines[11]) + call assert_equal('count total (s) self (s)', lines[12]) + call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[13]) + call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[14]) + call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[15]) + call assert_match('^\s*100\s\+.*\sendwhile$', lines[16]) + call assert_equal('', lines[17]) + call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[18]) + call assert_equal('count total (s) self (s) function', lines[19]) + call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[20]) + call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[21]) + call assert_equal('', lines[22]) + call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[23]) + call assert_equal('count total (s) self (s) function', lines[24]) + call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[25]) + call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[26]) + call assert_equal('', lines[27]) + + call delete('Xprofile_func.vim') + call delete('Xprofile_func.log') +endfunc + +func Test_profile_file() + let lines = [ + \ 'func! Foo()', + \ 'endfunc', + \ 'for i in range(10)', + \ ' " a comment', + \ ' call Foo()', + \ 'endfor', + \ 'call Foo()', + \ ] + + call writefile(lines, 'Xprofile_file.vim') + call system(v:progpath + \ . ' -es -u NONE -U NONE -i NONE --noplugin' + \ . ' -c "profile start Xprofile_file.log"' + \ . ' -c "profile file Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + let lines = readfile('Xprofile_file.log') + + call assert_equal(14, len(lines)) + + call assert_match('^SCRIPT .*Xprofile_file.vim$', lines[0]) + call assert_equal('Sourced 2 times', lines[1]) + call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) + call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) + call assert_equal('', lines[4]) + call assert_equal('count total (s) self (s)', lines[5]) + call assert_match(' 2 0.\d\+ func! Foo()', lines[6]) + call assert_equal(' endfunc', lines[7]) + " Loop iterates 10 times. Since script runs twice, body executes 20 times. + " First line of loop executes one more time than body to detect end of loop. + call assert_match('^\s*22\s\+\d\+\.\d\+\s\+for i in range(10)$', lines[8]) + call assert_equal(' " a comment', lines[9]) + " if self and total are equal we only get one number + call assert_match('^\s*20\s\+\(\d\+\.\d\+\s\+\)\=\d\+\.\d\+\s\+call Foo()$', lines[10]) + call assert_match('^\s*20\s\+\d\+\.\d\+\s\+endfor$', lines[11]) + " if self and total are equal we only get one number + call assert_match('^\s*2\s\+\(\d\+\.\d\+\s\+\)\=\d\+\.\d\+\s\+call Foo()$', lines[12]) + call assert_equal('', lines[13]) + + call delete('Xprofile_file.vim') + call delete('Xprofile_file.log') +endfunc + +func Test_profile_file_with_cont() + let lines = [ + \ 'echo "hello', + \ ' \ world"', + \ 'echo "foo ', + \ ' \bar"', + \ ] + + call writefile(lines, 'Xprofile_file.vim') + call system(v:progpath + \ . ' -es --clean' + \ . ' -c "profile start Xprofile_file.log"' + \ . ' -c "profile file Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + let lines = readfile('Xprofile_file.log') + call assert_equal(11, len(lines)) + + call assert_match('^SCRIPT .*Xprofile_file.vim$', lines[0]) + call assert_equal('Sourced 1 time', lines[1]) + call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) + call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) + call assert_equal('', lines[4]) + call assert_equal('count total (s) self (s)', lines[5]) + call assert_match(' 1 0.\d\+ echo "hello', lines[6]) + call assert_equal(' \ world"', lines[7]) + call assert_match(' 1 0.\d\+ echo "foo ', lines[8]) + call assert_equal(' \bar"', lines[9]) + call assert_equal('', lines[10]) + + call delete('Xprofile_file.vim') + call delete('Xprofile_file.log') +endfunc + +func Test_profile_completion() + call feedkeys(":profile \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"profile continue file func pause start', @:) + + call feedkeys(":profile start test_prof\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"profile start.* test_profile\.vim', @:) +endfunc + +func Test_profile_errors() + call assert_fails("profile func Foo", 'E750:') + call assert_fails("profile pause", 'E750:') + call assert_fails("profile continue", 'E750:') +endfunc + +func Test_profile_truncate_mbyte() + if !has('multi_byte') || &enc !=# 'utf-8' + return + endif + + let lines = [ + \ 'scriptencoding utf-8', + \ 'func! Foo()', + \ ' return [', + \ ' \ "' . join(map(range(0x4E00, 0x4E00 + 340), 'nr2char(v:val)'), '') . '",', + \ ' \ "' . join(map(range(0x4F00, 0x4F00 + 340), 'nr2char(v:val)'), '') . '",', + \ ' \ ]', + \ 'endfunc', + \ 'call Foo()', + \ ] + + call writefile(lines, 'Xprofile_file.vim') + call system(v:progpath + \ . ' -es --clean --cmd "set enc=utf-8"' + \ . ' -c "profile start Xprofile_file.log"' + \ . ' -c "profile file Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + split Xprofile_file.log + if &fenc != '' + call assert_equal('utf-8', &fenc) + endif + /func! Foo() + let lnum = line('.') + call assert_match('^\s*return \[$', getline(lnum + 1)) + call assert_match("\u4F52$", getline(lnum + 2)) + call assert_match("\u5052$", getline(lnum + 3)) + call assert_match('^\s*\\ \]$', getline(lnum + 4)) + bwipe! + + call delete('Xprofile_file.vim') + call delete('Xprofile_file.log') +endfunc diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim new file mode 100644 index 0000000000..a6269dec49 --- /dev/null +++ b/src/testdir/test_prompt_buffer.vim @@ -0,0 +1,103 @@ +" Tests for setting 'buftype' to "prompt" + +if !has('channel') + finish +endif + +source shared.vim +source screendump.vim + +func CanTestPromptBuffer() + " We need to use a terminal window to be able to feed keys without leaving + " Insert mode. + if !has('terminal') + return 0 + endif + if has('win32') + " TODO: make the tests work on MS-Windows + return 0 + endif + return 1 +endfunc + +func WriteScript(name) + call writefile([ + \ 'func TextEntered(text)', + \ ' if a:text == "exit"', + \ ' stopinsert', + \ ' close', + \ ' else', + \ ' " Add the output above the current prompt.', + \ ' call append(line("$") - 1, "Command: \"" . a:text . "\"")', + \ ' " Reset &modified to allow the buffer to be closed.', + \ ' set nomodified', + \ ' call timer_start(20, {id -> TimerFunc(a:text)})', + \ ' endif', + \ 'endfunc', + \ '', + \ 'func TimerFunc(text)', + \ ' " Add the output above the current prompt.', + \ ' call append(line("$") - 1, "Result: \"" . a:text . "\"")', + \ ' " Reset &modified to allow the buffer to be closed.', + \ ' set nomodified', + \ 'endfunc', + \ '', + \ 'call setline(1, "other buffer")', + \ 'set nomodified', + \ 'new', + \ 'set buftype=prompt', + \ 'call prompt_setcallback(bufnr(""), function("TextEntered"))', + \ 'startinsert', + \ ], a:name) +endfunc + +func Test_prompt_basic() + if !CanTestPromptBuffer() + return + endif + let scriptName = 'XpromptscriptBasic' + call WriteScript(scriptName) + + let buf = RunVimInTerminal('-S ' . scriptName, {}) + call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))}) + + call term_sendkeys(buf, "hello\<CR>") + call WaitForAssert({-> assert_equal('% hello', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))}) + call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))}) + + call term_sendkeys(buf, "exit\<CR>") + call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) + + call StopVimInTerminal(buf) + call delete(scriptName) +endfunc + +func Test_prompt_editing() + if !CanTestPromptBuffer() + return + endif + let scriptName = 'XpromptscriptEditing' + call WriteScript(scriptName) + + let buf = RunVimInTerminal('-S ' . scriptName, {}) + call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))}) + + let bs = "\<BS>" + call term_sendkeys(buf, "hello" . bs . bs) + call WaitForAssert({-> assert_equal('% hel', term_getline(buf, 1))}) + + let left = "\<Left>" + call term_sendkeys(buf, left . left . left . bs . '-') + call WaitForAssert({-> assert_equal('% -hel', term_getline(buf, 1))}) + + let end = "\<End>" + call term_sendkeys(buf, end . "x") + call WaitForAssert({-> assert_equal('% -helx', term_getline(buf, 1))}) + + call term_sendkeys(buf, "\<C-U>exit\<CR>") + call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) + + call StopVimInTerminal(buf) + call delete(scriptName) +endfunc diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim new file mode 100644 index 0000000000..0a23a43919 --- /dev/null +++ b/src/testdir/test_put.vim @@ -0,0 +1,60 @@ + +func Test_put_block() + if !has('multi_byte') + return + endif + new + call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x') + call feedkeys("\<C-V>y", 'x') + call feedkeys("gg0p", 'x') + call assert_equal("\u2500x", getline(1)) + bwipe! +endfunc + +func Test_put_char_block() + new + call setline(1, ['Line 1', 'Line 2']) + f Xfile_put + " visually select both lines and put the cursor at the top of the visual + " selection and then put the buffer name over it + exe "norm! G0\<c-v>ke\"%p" + call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2)) + bw! +endfunc + +func Test_put_char_block2() + new + let a = [ getreg('a'), getregtype('a') ] + call setreg('a', ' one ', 'v') + call setline(1, ['Line 1', '', 'Line 3', '']) + " visually select the first 3 lines and put register a over it + exe "norm! ggl\<c-v>2j2l\"ap" + call assert_equal(['L one 1', '', 'L one 3', ''], getline(1,4)) + " clean up + bw! + call setreg('a', a[0], a[1]) +endfunc + +func Test_put_lines() + new + let a = [ getreg('a'), getregtype('a') ] + call setline(1, ['Line 1', 'Line2', 'Line 3', '']) + exe 'norm! gg"add"AddG""p' + call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1,'$')) + " clean up + bw! + call setreg('a', a[0], a[1]) +endfunc + +func Test_put_expr() + new + call setline(1, repeat(['A'], 6)) + exec "1norm! \"=line('.')\<cr>p" + norm! j0. + norm! j0. + exec "4norm! \"=\<cr>P" + norm! j0. + norm! j0. + call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$')) + bw! +endfunc diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim new file mode 100644 index 0000000000..fb98c1eda7 --- /dev/null +++ b/src/testdir/test_python2.vim @@ -0,0 +1,24 @@ +" Test for python 2 commands. +" TODO: move tests from test87.in here. + +if !has('python') + finish +endif + +func Test_pydo() + " Check deleting lines does not trigger ml_get error. + py import vim + new + call setline(1, ['one', 'two', 'three']) + pydo vim.command("%d_") + bwipe! + + " Check switching to another buffer does not trigger ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + pydo vim.command("new") + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim new file mode 100644 index 0000000000..bb241dacb1 --- /dev/null +++ b/src/testdir/test_python3.vim @@ -0,0 +1,24 @@ +" Test for python 2 commands. +" TODO: move tests from test88.in here. + +if !has('python3') + finish +endif + +func Test_py3do() + " Check deleting lines does not trigger an ml_get error. + py3 import vim + new + call setline(1, ['one', 'two', 'three']) + py3do vim.command("%d_") + bwipe! + + " Check switching to another buffer does not trigger an ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + py3do vim.command("new") + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc diff --git a/src/testdir/test_pyx2.vim b/src/testdir/test_pyx2.vim new file mode 100644 index 0000000000..50e57c3bfb --- /dev/null +++ b/src/testdir/test_pyx2.vim @@ -0,0 +1,74 @@ +" Test for pyx* commands and functions with Python 2. + +set pyx=2 +if !has('python') + finish +endif + +let s:py2pattern = '^2\.[0-7]\.\d\+' +let s:py3pattern = '^3\.\d\+\.\d\+' + + +func Test_has_pythonx() + call assert_true(has('pythonx')) +endfunc + + +func Test_pyx() + redir => var + pyx << EOF +import sys +print(sys.version) +EOF + redir END + call assert_match(s:py2pattern, split(var)[0]) +endfunc + + +func Test_pyxdo() + pyx import sys + enew + pyxdo return sys.version.split("\n")[0] + call assert_match(s:py2pattern, split(getline('.'))[0]) +endfunc + + +func Test_pyxeval() + pyx import sys + call assert_match(s:py2pattern, split(pyxeval('sys.version'))[0]) +endfunc + + +func Test_pyxfile() + " No special comments nor shebangs + redir => var + pyxfile pyxfile/pyx.py + redir END + call assert_match(s:py2pattern, split(var)[0]) + + " Python 2 special comment + redir => var + pyxfile pyxfile/py2_magic.py + redir END + call assert_match(s:py2pattern, split(var)[0]) + + " Python 2 shebang + redir => var + pyxfile pyxfile/py2_shebang.py + redir END + call assert_match(s:py2pattern, split(var)[0]) + + if has('python3') + " Python 3 special comment + redir => var + pyxfile pyxfile/py3_magic.py + redir END + call assert_match(s:py3pattern, split(var)[0]) + + " Python 3 shebang + redir => var + pyxfile pyxfile/py3_shebang.py + redir END + call assert_match(s:py3pattern, split(var)[0]) + endif +endfunc diff --git a/src/testdir/test_pyx3.vim b/src/testdir/test_pyx3.vim new file mode 100644 index 0000000000..64546b4688 --- /dev/null +++ b/src/testdir/test_pyx3.vim @@ -0,0 +1,74 @@ +" Test for pyx* commands and functions with Python 3. + +set pyx=3 +if !has('python3') + finish +endif + +let s:py2pattern = '^2\.[0-7]\.\d\+' +let s:py3pattern = '^3\.\d\+\.\d\+' + + +func Test_has_pythonx() + call assert_true(has('pythonx')) +endfunc + + +func Test_pyx() + redir => var + pyx << EOF +import sys +print(sys.version) +EOF + redir END + call assert_match(s:py3pattern, split(var)[0]) +endfunc + + +func Test_pyxdo() + pyx import sys + enew + pyxdo return sys.version.split("\n")[0] + call assert_match(s:py3pattern, split(getline('.'))[0]) +endfunc + + +func Test_pyxeval() + pyx import sys + call assert_match(s:py3pattern, split(pyxeval('sys.version'))[0]) +endfunc + + +func Test_pyxfile() + " No special comments nor shebangs + redir => var + pyxfile pyxfile/pyx.py + redir END + call assert_match(s:py3pattern, split(var)[0]) + + " Python 3 special comment + redir => var + pyxfile pyxfile/py3_magic.py + redir END + call assert_match(s:py3pattern, split(var)[0]) + + " Python 3 shebang + redir => var + pyxfile pyxfile/py3_shebang.py + redir END + call assert_match(s:py3pattern, split(var)[0]) + + if has('python') + " Python 2 special comment + redir => var + pyxfile pyxfile/py2_magic.py + redir END + call assert_match(s:py2pattern, split(var)[0]) + + " Python 2 shebang + redir => var + pyxfile pyxfile/py2_shebang.py + redir END + call assert_match(s:py2pattern, split(var)[0]) + endif +endfunc diff --git a/src/testdir/test_qf_title.in b/src/testdir/test_qf_title.in deleted file mode 100644 index fce0c260e3..0000000000 --- a/src/testdir/test_qf_title.in +++ /dev/null @@ -1,18 +0,0 @@ -Tests for quickfix window's title vim: set ft=vim : - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif -:set efm=%E%f:%l:%c:%m -:cgetexpr ['file:1:1:message'] -:let qflist=getqflist() -:call setqflist(qflist, 'r') -:copen -:let g:quickfix_title=w:quickfix_title -:wincmd p -:$put =g:quickfix_title -:/^Results/,$w test.out -:qa! -ENDTEST - -Results of test_qf_title: diff --git a/src/testdir/test_qf_title.ok b/src/testdir/test_qf_title.ok deleted file mode 100644 index 4ebdbeff3b..0000000000 --- a/src/testdir/test_qf_title.ok +++ /dev/null @@ -1,2 +0,0 @@ -Results of test_qf_title: -:setqflist() diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim new file mode 100644 index 0000000000..eade52f42d --- /dev/null +++ b/src/testdir/test_quickfix.vim @@ -0,0 +1,3364 @@ +" Test for the quickfix commands. + +if !has('quickfix') + finish +endif + +set encoding=utf-8 + +func s:setup_commands(cchar) + if a:cchar == 'c' + command! -nargs=* -bang Xlist <mods>clist<bang> <args> + command! -nargs=* Xgetexpr <mods>cgetexpr <args> + command! -nargs=* Xaddexpr <mods>caddexpr <args> + command! -nargs=* -count Xolder <mods><count>colder <args> + command! -nargs=* Xnewer <mods>cnewer <args> + command! -nargs=* Xopen <mods>copen <args> + command! -nargs=* Xwindow <mods>cwindow <args> + command! -nargs=* Xbottom <mods>cbottom <args> + command! -nargs=* Xclose <mods>cclose <args> + command! -nargs=* -bang Xfile <mods>cfile<bang> <args> + command! -nargs=* Xgetfile <mods>cgetfile <args> + command! -nargs=* Xaddfile <mods>caddfile <args> + command! -nargs=* -bang Xbuffer <mods>cbuffer<bang> <args> + command! -nargs=* Xgetbuffer <mods>cgetbuffer <args> + command! -nargs=* Xaddbuffer <mods>caddbuffer <args> + command! -nargs=* Xrewind <mods>crewind <args> + command! -count -nargs=* -bang Xnext <mods><count>cnext<bang> <args> + command! -count -nargs=* -bang Xprev <mods><count>cprev<bang> <args> + command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args> + command! -nargs=* -bang Xlast <mods>clast<bang> <args> + command! -nargs=* -bang -range Xnfile <mods><count>cnfile<bang> <args> + command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args> + command! -nargs=* Xexpr <mods>cexpr <args> + command! -range -nargs=* Xvimgrep <mods><count>vimgrep <args> + command! -nargs=* Xvimgrepadd <mods>vimgrepadd <args> + command! -nargs=* Xgrep <mods> grep <args> + command! -nargs=* Xgrepadd <mods> grepadd <args> + command! -nargs=* Xhelpgrep helpgrep <args> + command! -nargs=0 -count Xcc <count>cc + let g:Xgetlist = function('getqflist') + let g:Xsetlist = function('setqflist') + call setqflist([], 'f') + else + command! -nargs=* -bang Xlist <mods>llist<bang> <args> + command! -nargs=* Xgetexpr <mods>lgetexpr <args> + command! -nargs=* Xaddexpr <mods>laddexpr <args> + command! -nargs=* -count Xolder <mods><count>lolder <args> + command! -nargs=* Xnewer <mods>lnewer <args> + command! -nargs=* Xopen <mods>lopen <args> + command! -nargs=* Xwindow <mods>lwindow <args> + command! -nargs=* Xbottom <mods>lbottom <args> + command! -nargs=* Xclose <mods>lclose <args> + command! -nargs=* -bang Xfile <mods>lfile<bang> <args> + command! -nargs=* Xgetfile <mods>lgetfile <args> + command! -nargs=* Xaddfile <mods>laddfile <args> + command! -nargs=* -bang Xbuffer <mods>lbuffer<bang> <args> + command! -nargs=* Xgetbuffer <mods>lgetbuffer <args> + command! -nargs=* Xaddbuffer <mods>laddbuffer <args> + command! -nargs=* Xrewind <mods>lrewind <args> + command! -count -nargs=* -bang Xnext <mods><count>lnext<bang> <args> + command! -count -nargs=* -bang Xprev <mods><count>lprev<bang> <args> + command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args> + command! -nargs=* -bang Xlast <mods>llast<bang> <args> + command! -nargs=* -bang -range Xnfile <mods><count>lnfile<bang> <args> + command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args> + command! -nargs=* Xexpr <mods>lexpr <args> + command! -range -nargs=* Xvimgrep <mods><count>lvimgrep <args> + command! -nargs=* Xvimgrepadd <mods>lvimgrepadd <args> + command! -nargs=* Xgrep <mods> lgrep <args> + command! -nargs=* Xgrepadd <mods> lgrepadd <args> + command! -nargs=* Xhelpgrep lhelpgrep <args> + command! -nargs=0 -count Xcc <count>ll + let g:Xgetlist = function('getloclist', [0]) + let g:Xsetlist = function('setloclist', [0]) + call setloclist(0, [], 'f') + endif +endfunc + +" Tests for the :clist and :llist commands +func XlistTests(cchar) + call s:setup_commands(a:cchar) + + if a:cchar == 'l' + call assert_fails('llist', 'E776:') + endif + " With an empty list, command should return error + Xgetexpr [] + silent! Xlist + call assert_true(v:errmsg ==# 'E42: No Errors') + + " Populate the list and then try + Xgetexpr ['non-error 1', 'Xtestfile1:1:3:Line1', + \ 'non-error 2', 'Xtestfile2:2:2:Line2', + \ 'non-error 3', 'Xtestfile3:3:1:Line3'] + + " List only valid entries + let l = split(execute('Xlist', ''), "\n") + call assert_equal([' 2 Xtestfile1:1 col 3: Line1', + \ ' 4 Xtestfile2:2 col 2: Line2', + \ ' 6 Xtestfile3:3 col 1: Line3'], l) + + " List all the entries + let l = split(execute('Xlist!', ''), "\n") + call assert_equal([' 1: non-error 1', ' 2 Xtestfile1:1 col 3: Line1', + \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2', + \ ' 5: non-error 3', ' 6 Xtestfile3:3 col 1: Line3'], l) + + " List a range of errors + let l = split(execute('Xlist 3,6', ''), "\n") + call assert_equal([' 4 Xtestfile2:2 col 2: Line2', + \ ' 6 Xtestfile3:3 col 1: Line3'], l) + + let l = split(execute('Xlist! 3,4', ''), "\n") + call assert_equal([' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l) + + let l = split(execute('Xlist -6,-4', ''), "\n") + call assert_equal([' 2 Xtestfile1:1 col 3: Line1'], l) + + let l = split(execute('Xlist! -5,-3', ''), "\n") + call assert_equal([' 2 Xtestfile1:1 col 3: Line1', + \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l) + + " Test for '+' + let l = split(execute('Xlist! +2', ''), "\n") + call assert_equal([' 2 Xtestfile1:1 col 3: Line1', + \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l) + + " Different types of errors + call g:Xsetlist([{'lnum':10,'col':5,'type':'W', 'text':'Warning','nr':11}, + \ {'lnum':20,'col':10,'type':'e','text':'Error','nr':22}, + \ {'lnum':30,'col':15,'type':'i','text':'Info','nr':33}, + \ {'lnum':40,'col':20,'type':'x', 'text':'Other','nr':44}, + \ {'lnum':50,'col':25,'type':"\<C-A>",'text':'one','nr':55}]) + let l = split(execute('Xlist', ""), "\n") + call assert_equal([' 1:10 col 5 warning 11: Warning', + \ ' 2:20 col 10 error 22: Error', + \ ' 3:30 col 15 info 33: Info', + \ ' 4:40 col 20 x 44: Other', + \ ' 5:50 col 25 55: one'], l) + + " Test for module names, one needs to explicitly set `'valid':v:true` so + call g:Xsetlist([ + \ {'lnum':10,'col':5,'type':'W','module':'Data.Text','text':'ModuleWarning','nr':11,'valid':v:true}, + \ {'lnum':20,'col':10,'type':'W','module':'Data.Text','filename':'Data/Text.hs','text':'ModuleWarning','nr':22,'valid':v:true}, + \ {'lnum':30,'col':15,'type':'W','filename':'Data/Text.hs','text':'FileWarning','nr':33,'valid':v:true}]) + let l = split(execute('Xlist', ""), "\n") + call assert_equal([' 1 Data.Text:10 col 5 warning 11: ModuleWarning', + \ ' 2 Data.Text:20 col 10 warning 22: ModuleWarning', + \ ' 3 Data/Text.hs:30 col 15 warning 33: FileWarning'], l) + + " Error cases + call assert_fails('Xlist abc', 'E488:') +endfunc + +func Test_clist() + call XlistTests('c') + call XlistTests('l') +endfunc + +" Tests for the :colder, :cnewer, :lolder and :lnewer commands +" Note that this test assumes that a quickfix/location list is +" already set by the caller. +func XageTests(cchar) + call s:setup_commands(a:cchar) + + let list = [{'bufnr': bufnr('%'), 'lnum': 1}] + call g:Xsetlist(list) + + " Jumping to a non existent list should return error + silent! Xolder 99 + call assert_true(v:errmsg ==# 'E380: At bottom of quickfix stack') + + silent! Xnewer 99 + call assert_true(v:errmsg ==# 'E381: At top of quickfix stack') + + " Add three quickfix/location lists + Xgetexpr ['Xtestfile1:1:3:Line1'] + Xgetexpr ['Xtestfile2:2:2:Line2'] + Xgetexpr ['Xtestfile3:3:1:Line3'] + + " Go back two lists + Xolder + let l = g:Xgetlist() + call assert_equal('Line2', l[0].text) + + " Go forward two lists + Xnewer + let l = g:Xgetlist() + call assert_equal('Line3', l[0].text) + + " Test for the optional count argument + Xolder 2 + let l = g:Xgetlist() + call assert_equal('Line1', l[0].text) + + Xnewer 2 + let l = g:Xgetlist() + call assert_equal('Line3', l[0].text) +endfunc + +func Test_cage() + call XageTests('c') + call XageTests('l') +endfunc + +" Tests for the :cwindow, :lwindow :cclose, :lclose, :copen and :lopen +" commands +func XwindowTests(cchar) + call s:setup_commands(a:cchar) + + " Opening the location list window without any errors should fail + if a:cchar == 'l' + call assert_fails('lopen', 'E776:') + endif + + " Create a list with no valid entries + Xgetexpr ['non-error 1', 'non-error 2', 'non-error 3'] + + " Quickfix/Location window should not open with no valid errors + Xwindow + call assert_true(winnr('$') == 1) + + " Create a list with valid entries + Xgetexpr ['Xtestfile1:1:3:Line1', 'Xtestfile2:2:2:Line2', + \ 'Xtestfile3:3:1:Line3'] + + " Open the window + Xwindow + call assert_true(winnr('$') == 2 && winnr() == 2 && + \ getline('.') ==# 'Xtestfile1|1 col 3| Line1') + redraw! + + " Close the window + Xclose + call assert_true(winnr('$') == 1) + + " Create a list with no valid entries + Xgetexpr ['non-error 1', 'non-error 2', 'non-error 3'] + + " Open the window + Xopen 5 + call assert_true(winnr('$') == 2 && getline('.') ==# '|| non-error 1' + \ && winheight('.') == 5) + + " Opening the window again, should move the cursor to that window + wincmd t + Xopen 7 + call assert_true(winnr('$') == 2 && winnr() == 2 && + \ winheight('.') == 7 && + \ getline('.') ==# '|| non-error 1') + + + " Calling cwindow should close the quickfix window with no valid errors + Xwindow + call assert_true(winnr('$') == 1) + + if a:cchar == 'c' + " Opening the quickfix window in multiple tab pages should reuse the + " quickfix buffer + Xgetexpr ['Xtestfile1:1:3:Line1', 'Xtestfile2:2:2:Line2', + \ 'Xtestfile3:3:1:Line3'] + Xopen + let qfbufnum = bufnr('%') + tabnew + Xopen + call assert_equal(qfbufnum, bufnr('%')) + new | only | tabonly + endif +endfunc + +func Test_cwindow() + call XwindowTests('c') + call XwindowTests('l') +endfunc + +" Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile +" commands. +func XfileTests(cchar) + call s:setup_commands(a:cchar) + + call writefile(['Xtestfile1:700:10:Line 700', + \ 'Xtestfile2:800:15:Line 800'], 'Xqftestfile1') + + enew! + Xfile Xqftestfile1 + let l = g:Xgetlist() + call assert_true(len(l) == 2 && + \ l[0].lnum == 700 && l[0].col == 10 && l[0].text ==# 'Line 700' && + \ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800') + + " Test with a non existent file + call assert_fails('Xfile non_existent_file', 'E40') + + " Run cfile/lfile from a modified buffer + enew! + silent! put ='Quickfix' + silent! Xfile Xqftestfile1 + call assert_true(v:errmsg ==# 'E37: No write since last change (add ! to override)') + + call writefile(['Xtestfile3:900:30:Line 900'], 'Xqftestfile1') + Xaddfile Xqftestfile1 + let l = g:Xgetlist() + call assert_true(len(l) == 3 && + \ l[2].lnum == 900 && l[2].col == 30 && l[2].text ==# 'Line 900') + + call writefile(['Xtestfile1:222:77:Line 222', + \ 'Xtestfile2:333:88:Line 333'], 'Xqftestfile1') + + enew! + Xgetfile Xqftestfile1 + let l = g:Xgetlist() + call assert_true(len(l) == 2 && + \ l[0].lnum == 222 && l[0].col == 77 && l[0].text ==# 'Line 222' && + \ l[1].lnum == 333 && l[1].col == 88 && l[1].text ==# 'Line 333') + + call delete('Xqftestfile1') +endfunc + +func Test_cfile() + call XfileTests('c') + call XfileTests('l') +endfunc + +" Tests for the :cbuffer, :lbuffer, :caddbuffer, :laddbuffer, :cgetbuffer and +" :lgetbuffer commands. +func XbufferTests(cchar) + call s:setup_commands(a:cchar) + + enew! + silent! call setline(1, ['Xtestfile7:700:10:Line 700', + \ 'Xtestfile8:800:15:Line 800']) + Xbuffer! + let l = g:Xgetlist() + call assert_true(len(l) == 2 && + \ l[0].lnum == 700 && l[0].col == 10 && l[0].text ==# 'Line 700' && + \ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800') + + enew! + silent! call setline(1, ['Xtestfile9:900:55:Line 900', + \ 'Xtestfile10:950:66:Line 950']) + Xgetbuffer + let l = g:Xgetlist() + call assert_true(len(l) == 2 && + \ l[0].lnum == 900 && l[0].col == 55 && l[0].text ==# 'Line 900' && + \ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950') + + enew! + silent! call setline(1, ['Xtestfile11:700:20:Line 700', + \ 'Xtestfile12:750:25:Line 750']) + Xaddbuffer + let l = g:Xgetlist() + call assert_true(len(l) == 4 && + \ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950' && + \ l[2].lnum == 700 && l[2].col == 20 && l[2].text ==# 'Line 700' && + \ l[3].lnum == 750 && l[3].col == 25 && l[3].text ==# 'Line 750') + enew! + + " Check for invalid buffer + call assert_fails('Xbuffer 199', 'E474:') + + " Check for unloaded buffer + edit Xtestfile1 + let bnr = bufnr('%') + enew! + call assert_fails('Xbuffer ' . bnr, 'E681:') + + " Check for invalid range + " Using Xbuffer will not run the range check in the cbuffer/lbuffer + " commands. So directly call the commands. + if (a:cchar == 'c') + call assert_fails('900,999cbuffer', 'E16:') + else + call assert_fails('900,999lbuffer', 'E16:') + endif +endfunc + +func Test_cbuffer() + call XbufferTests('c') + call XbufferTests('l') +endfunc + +func XexprTests(cchar) + call s:setup_commands(a:cchar) + + call assert_fails('Xexpr 10', 'E777:') +endfunc + +func Test_cexpr() + call XexprTests('c') + call XexprTests('l') +endfunc + +" Tests for :cnext, :cprev, :cfirst, :clast commands +func Xtest_browse(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + " Jumping to first or next location list entry without any error should + " result in failure + if a:cchar == 'c' + let err = 'E42:' + else + let err = 'E776:' + endif + call assert_fails('Xnext', err) + call assert_fails('Xprev', err) + call assert_fails('Xnfile', err) + call assert_fails('Xpfile', err) + + call s:create_test_file('Xqftestfile1') + call s:create_test_file('Xqftestfile2') + + Xgetexpr ['Xqftestfile1:5:Line5', + \ 'Xqftestfile1:6:Line6', + \ 'Xqftestfile2:10:Line10', + \ 'Xqftestfile2:11:Line11', + \ 'RegularLine1', + \ 'RegularLine2'] + + Xfirst + call assert_fails('Xprev', 'E553') + call assert_fails('Xpfile', 'E553') + Xnfile + call assert_equal('Xqftestfile2', bufname('%')) + call assert_equal(10, line('.')) + Xpfile + call assert_equal('Xqftestfile1', bufname('%')) + call assert_equal(6, line('.')) + 5Xcc + call assert_equal(5, g:Xgetlist({'idx':0}).idx) + 2Xcc + call assert_equal(2, g:Xgetlist({'idx':0}).idx) + 10Xcc + call assert_equal(6, g:Xgetlist({'idx':0}).idx) + Xlast + Xprev + call assert_equal('Xqftestfile2', bufname('%')) + call assert_equal(11, line('.')) + call assert_fails('Xnext', 'E553') + call assert_fails('Xnfile', 'E553') + Xrewind + call assert_equal('Xqftestfile1', bufname('%')) + call assert_equal(5, line('.')) + + 10Xnext + call assert_equal('Xqftestfile2', bufname('%')) + call assert_equal(11, line('.')) + 10Xprev + call assert_equal('Xqftestfile1', bufname('%')) + call assert_equal(5, line('.')) + + " Jumping to an error from the error window using cc command + Xgetexpr ['Xqftestfile1:5:Line5', + \ 'Xqftestfile1:6:Line6', + \ 'Xqftestfile2:10:Line10', + \ 'Xqftestfile2:11:Line11'] + Xopen + 10Xcc + call assert_equal(11, line('.')) + call assert_equal('Xqftestfile2', bufname('%')) + + " Jumping to an error from the error window (when only the error window is + " present) + Xopen | only + Xlast 1 + call assert_equal(5, line('.')) + call assert_equal('Xqftestfile1', bufname('%')) + + Xexpr "" + call assert_fails('Xnext', 'E42:') + + call delete('Xqftestfile1') + call delete('Xqftestfile2') + + " Should be able to use next/prev with invalid entries + Xexpr "" + call assert_equal(0, g:Xgetlist({'idx' : 0}).idx) + call assert_equal(0, g:Xgetlist({'size' : 0}).size) + Xaddexpr ['foo', 'bar', 'baz', 'quux', 'shmoo'] + call assert_equal(5, g:Xgetlist({'size' : 0}).size) + Xlast + call assert_equal(5, g:Xgetlist({'idx' : 0}).idx) + Xfirst + call assert_equal(1, g:Xgetlist({'idx' : 0}).idx) + 2Xnext + call assert_equal(3, g:Xgetlist({'idx' : 0}).idx) +endfunc + +func Test_browse() + call Xtest_browse('c') + call Xtest_browse('l') +endfunc + +func Test_nomem() + call test_alloc_fail(GetAllocId('qf_dirname_start'), 0, 0) + call assert_fails('vimgrep vim runtest.vim', 'E342:') + + call test_alloc_fail(GetAllocId('qf_dirname_now'), 0, 0) + call assert_fails('vimgrep vim runtest.vim', 'E342:') + + call test_alloc_fail(GetAllocId('qf_namebuf'), 0, 0) + call assert_fails('cfile runtest.vim', 'E342:') + + call test_alloc_fail(GetAllocId('qf_errmsg'), 0, 0) + call assert_fails('cfile runtest.vim', 'E342:') + + call test_alloc_fail(GetAllocId('qf_pattern'), 0, 0) + call assert_fails('cfile runtest.vim', 'E342:') + +endfunc + +func s:test_xhelpgrep(cchar) + call s:setup_commands(a:cchar) + Xhelpgrep quickfix + Xopen + if a:cchar == 'c' + let title_text = ':helpgrep quickfix' + else + let title_text = ':lhelpgrep quickfix' + endif + call assert_true(w:quickfix_title =~ title_text, w:quickfix_title) + + " Jumping to a help topic should open the help window + only + Xnext + call assert_true(&buftype == 'help') + call assert_true(winnr('$') == 2) + " Jumping to the next match should reuse the help window + Xnext + call assert_true(&buftype == 'help') + call assert_true(winnr() == 1) + call assert_true(winnr('$') == 2) + " Jumping to the next match from the quickfix window should reuse the help + " window + Xopen + Xnext + call assert_true(&buftype == 'help') + call assert_true(winnr() == 1) + call assert_true(winnr('$') == 2) + + " This wipes out the buffer, make sure that doesn't cause trouble. + Xclose + + if a:cchar == 'l' + " When a help window is present, running :lhelpgrep should reuse the + " help window and not the current window + new | only + call g:Xsetlist([], 'f') + help index.txt + wincmd w + lhelpgrep quickfix + call assert_equal(1, winnr()) + call assert_notequal([], getloclist(1)) + call assert_equal([], getloclist(2)) + endif + + new | only + + " Search for non existing help string + call assert_fails('Xhelpgrep a1b2c3', 'E480:') +endfunc + +func Test_helpgrep() + call s:test_xhelpgrep('c') + helpclose + call s:test_xhelpgrep('l') +endfunc + +func Test_errortitle() + augroup QfBufWinEnter + au! + au BufWinEnter * :let g:a=get(w:, 'quickfix_title', 'NONE') + augroup END + copen + let a=[{'lnum': 308, 'bufnr': bufnr(''), 'col': 58, 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'pattern': '', 'text': ' au BufWinEnter * :let g:a=get(w:, ''quickfix_title'', ''NONE'')'}] + call setqflist(a) + call assert_equal(':setqflist()', g:a) + augroup QfBufWinEnter + au! + augroup END + augroup! QfBufWinEnter +endfunc + +func Test_vimgreptitle() + augroup QfBufWinEnter + au! + au BufWinEnter * :let g:a=get(w:, 'quickfix_title', 'NONE') + augroup END + try + vimgrep /pattern/j file + catch /E480/ + endtry + copen + call assert_equal(': vimgrep /pattern/j file', g:a) + augroup QfBufWinEnter + au! + augroup END + augroup! QfBufWinEnter +endfunc + +func XqfTitleTests(cchar) + call s:setup_commands(a:cchar) + + Xgetexpr ['file:1:1:message'] + let l = g:Xgetlist() + if a:cchar == 'c' + call setqflist(l, 'r') + else + call setloclist(0, l, 'r') + endif + + Xopen + if a:cchar == 'c' + let title = ':setqflist()' + else + let title = ':setloclist()' + endif + call assert_equal(title, w:quickfix_title) + Xclose +endfunc + +" Tests for quickfix window's title +func Test_qf_title() + call XqfTitleTests('c') + call XqfTitleTests('l') +endfunc + +" Tests for 'errorformat' +func Test_efm() + let save_efm = &efm + set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%# + cgetexpr ['WWWW', 'EEEE', 'CCCC'] + let l = strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) + call assert_equal("[['W', 1], ['E^@CCCC', 1]]", l) + cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC'] + let l = strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) + call assert_equal("[['W', 1], ['E^@CCCC', 1]]", l) + cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY'] + let l = strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) + call assert_equal("[['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]]", l) + let &efm = save_efm +endfunc + +" This will test for problems in quickfix: +" A. incorrectly copying location lists which caused the location list to show +" a different name than the file that was actually being displayed. +" B. not reusing the window for which the location list window is opened but +" instead creating new windows. +" C. make sure that the location list window is not reused instead of the +" window it belongs to. +" +" Set up the test environment: +func ReadTestProtocol(name) + let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '') + let word = substitute(base, '\v(.*)\..*', '\1', '') + + setl modifiable + setl noreadonly + setl noswapfile + setl bufhidden=delete + %del _ + " For problem 2: + " 'buftype' has to be set to reproduce the constant opening of new windows + setl buftype=nofile + + call setline(1, word) + + setl nomodified + setl nomodifiable + setl readonly + exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '') +endfunc + +func Test_locationlist() + enew + + augroup testgroup + au! + autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>")) + augroup END + + let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ] + + let qflist = [] + for word in words + call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', }) + " NOTE: problem 1: + " intentionally not setting 'lnum' so that the quickfix entries are not + " valid + call setloclist(0, qflist, ' ') + endfor + + " Test A + lrewind + enew + lopen + 4lnext + vert split + wincmd L + lopen + wincmd p + lnext + let fileName = expand("%") + wincmd p + let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '') + let fileName = substitute(fileName, '\\', '/', 'g') + let locationListFileName = substitute(locationListFileName, '\\', '/', 'g') + call assert_equal("test://bar.txt", fileName) + call assert_equal("test://bar.txt", locationListFileName) + + wincmd n | only + + " Test B: + lrewind + lopen + 2 + exe "normal \<CR>" + wincmd p + 3 + exe "normal \<CR>" + wincmd p + 4 + exe "normal \<CR>" + call assert_equal(2, winnr('$')) + wincmd n | only + + " Test C: + lrewind + lopen + " Let's move the location list window to the top to check whether it (the + " first window found) will be reused when we try to open new windows: + wincmd K + 2 + exe "normal \<CR>" + wincmd p + 3 + exe "normal \<CR>" + wincmd p + 4 + exe "normal \<CR>" + 1wincmd w + call assert_equal('quickfix', &buftype) + 2wincmd w + let bufferName = expand("%") + let bufferName = substitute(bufferName, '\\', '/', 'g') + call assert_equal('test://quux.txt', bufferName) + + wincmd n | only + + augroup! testgroup +endfunc + +func Test_locationlist_curwin_was_closed() + augroup testgroup + au! + autocmd BufReadCmd test_curwin.txt call R(expand("<amatch>")) + augroup END + + func! R(n) + quit + endfunc + + new + let q = [] + call add(q, {'filename': 'test_curwin.txt' }) + call setloclist(0, q) + call assert_fails('lrewind', 'E924:') + + augroup! testgroup +endfunc + +func Test_locationlist_cross_tab_jump() + call writefile(['loclistfoo'], 'loclistfoo') + call writefile(['loclistbar'], 'loclistbar') + set switchbuf=usetab + + edit loclistfoo + tabedit loclistbar + silent lgrep loclistfoo loclist* + call assert_equal(1, tabpagenr()) + + enew | only | tabonly + set switchbuf&vim + call delete('loclistfoo') + call delete('loclistbar') +endfunc + +" More tests for 'errorformat' +func Test_efm1() + if !has('unix') + " The 'errorformat' setting is different on non-Unix systems. + " This test works only on Unix-like systems. + return + endif + + let l = [ + \ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.', + \ '"Xtestfile", line 6 col 19; this is an error', + \ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c', + \ 'Xtestfile:9: parse error before `asd''', + \ 'make: *** [vim] Error 1', + \ 'in file "Xtestfile" linenr 10: there is an error', + \ '', + \ '2 returned', + \ '"Xtestfile", line 11 col 1; this is an error', + \ '"Xtestfile", line 12 col 2; this is another error', + \ '"Xtestfile", line 14:10; this is an error in column 10', + \ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time', + \ '"Xtestfile", linenr 16: yet another problem', + \ 'Error in "Xtestfile" at line 17:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', + \ ' ^', + \ 'Error in "Xtestfile" at line 18:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', + \ '.............^', + \ 'Error in "Xtestfile" at line 19:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', + \ '--------------^', + \ 'Error in "Xtestfile" at line 20:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', + \ ' ^', + \ '', + \ 'Does anyone know what is the problem and how to correction it?', + \ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?', + \ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?' + \ ] + + call writefile(l, 'Xerrorfile1') + call writefile(l[:-2], 'Xerrorfile2') + + let m = [ + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22' + \ ] + call writefile(m, 'Xtestfile') + + let save_efm = &efm + set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m + set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m + + exe 'cf Xerrorfile2' + clast + copen + call assert_equal(':cf Xerrorfile2', w:quickfix_title) + wincmd p + + exe 'cf Xerrorfile1' + call assert_equal([4, 12], [line('.'), col('.')]) + cn + call assert_equal([6, 19], [line('.'), col('.')]) + cn + call assert_equal([9, 2], [line('.'), col('.')]) + cn + call assert_equal([10, 2], [line('.'), col('.')]) + cn + call assert_equal([11, 1], [line('.'), col('.')]) + cn + call assert_equal([12, 2], [line('.'), col('.')]) + cn + call assert_equal([14, 10], [line('.'), col('.')]) + cn + call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')]) + cn + call assert_equal([16, 2], [line('.'), col('.')]) + cn + call assert_equal([17, 6], [line('.'), col('.')]) + cn + call assert_equal([18, 7], [line('.'), col('.')]) + cn + call assert_equal([19, 8], [line('.'), col('.')]) + cn + call assert_equal([20, 9], [line('.'), col('.')]) + clast + cprev + cprev + wincmd w + call assert_equal(':cf Xerrorfile1', w:quickfix_title) + wincmd p + + let &efm = save_efm + call delete('Xerrorfile1') + call delete('Xerrorfile2') + call delete('Xtestfile') +endfunc + +" Test for quickfix directory stack support +func s:dir_stack_tests(cchar) + call s:setup_commands(a:cchar) + + let save_efm=&efm + set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f' + + let lines = ["Entering dir 'dir1/a'", + \ 'habits2.txt:1:Nine Healthy Habits', + \ "Entering dir 'b'", + \ 'habits3.txt:2:0 Hours of television', + \ 'habits2.txt:7:5 Small meals', + \ "Entering dir 'dir1/c'", + \ 'habits4.txt:3:1 Hour of exercise', + \ "Leaving dir 'dir1/c'", + \ "Leaving dir 'dir1/a'", + \ 'habits1.txt:4:2 Liters of water', + \ "Entering dir 'dir2'", + \ 'habits5.txt:5:3 Cups of hot green tea', + \ "Leaving dir 'dir2'" + \] + + Xexpr "" + for l in lines + Xaddexpr l + endfor + + let qf = g:Xgetlist() + + call assert_equal('dir1/a/habits2.txt', bufname(qf[1].bufnr)) + call assert_equal(1, qf[1].lnum) + call assert_equal('dir1/a/b/habits3.txt', bufname(qf[3].bufnr)) + call assert_equal(2, qf[3].lnum) + call assert_equal('dir1/a/habits2.txt', bufname(qf[4].bufnr)) + call assert_equal(7, qf[4].lnum) + call assert_equal('dir1/c/habits4.txt', bufname(qf[6].bufnr)) + call assert_equal(3, qf[6].lnum) + call assert_equal('habits1.txt', bufname(qf[9].bufnr)) + call assert_equal(4, qf[9].lnum) + call assert_equal('dir2/habits5.txt', bufname(qf[11].bufnr)) + call assert_equal(5, qf[11].lnum) + + let &efm=save_efm +endfunc + +" Tests for %D and %X errorformat options +func Test_efm_dirstack() + " Create the directory stack and files + call mkdir('dir1') + call mkdir('dir1/a') + call mkdir('dir1/a/b') + call mkdir('dir1/c') + call mkdir('dir2') + + let lines = ["Nine Healthy Habits", + \ "0 Hours of television", + \ "1 Hour of exercise", + \ "2 Liters of water", + \ "3 Cups of hot green tea", + \ "4 Short mental breaks", + \ "5 Small meals", + \ "6 AM wake up time", + \ "7 Minutes of laughter", + \ "8 Hours of sleep (at least)", + \ "9 PM end of the day and off to bed" + \ ] + call writefile(lines, 'habits1.txt') + call writefile(lines, 'dir1/a/habits2.txt') + call writefile(lines, 'dir1/a/b/habits3.txt') + call writefile(lines, 'dir1/c/habits4.txt') + call writefile(lines, 'dir2/habits5.txt') + + call s:dir_stack_tests('c') + call s:dir_stack_tests('l') + + call delete('dir1', 'rf') + call delete('dir2', 'rf') + call delete('habits1.txt') +endfunc + +" Test for resync after continuing an ignored message +func Xefm_ignore_continuations(cchar) + call s:setup_commands(a:cchar) + + let save_efm = &efm + + let &efm = + \ '%Eerror %m %l,' . + \ '%-Wignored %m %l,' . + \ '%+Cmore ignored %m %l,' . + \ '%Zignored end' + Xgetexpr ['ignored warning 1', 'more ignored continuation 2', 'ignored end', 'error resync 4'] + let l = map(g:Xgetlist(), '[v:val.text, v:val.valid, v:val.lnum, v:val.type]') + call assert_equal([['resync', 1, 4, 'E']], l) + + let &efm = save_efm +endfunc + +func Test_efm_ignore_continuations() + call Xefm_ignore_continuations('c') + call Xefm_ignore_continuations('l') +endfunc + +" Tests for invalid error format specifies +func Xinvalid_efm_Tests(cchar) + call s:setup_commands(a:cchar) + + let save_efm = &efm + + set efm=%f:%l:%m,%f:%f:%l:%m + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E372:') + + set efm=%f:%l:%m,%f:%l:%r:%m + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E373:') + + set efm=%f:%l:%m,%O:%f:%l:%m + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E373:') + + set efm=%f:%l:%m,%f:%l:%*[^a-z + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E374:') + + set efm=%f:%l:%m,%f:%l:%*c + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E375:') + + set efm=%f:%l:%m,%L%M%N + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E376:') + + set efm=%f:%l:%m,%f:%l:%m:%R + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E377:') + + set efm= + call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E378:') + + set efm=%DEntering\ dir\ abc,%f:%l:%m + call assert_fails('Xexpr ["Entering dir abc", "abc.txt:1:Hello world"]', 'E379:') + + let &efm = save_efm +endfunc + +func Test_invalid_efm() + call Xinvalid_efm_Tests('c') + call Xinvalid_efm_Tests('l') +endfunc + +" TODO: +" Add tests for the following formats in 'errorformat' +" %r %O +func Test_efm2() + let save_efm = &efm + + " Test for %s format in efm + set efm=%f:%s + cexpr 'Xtestfile:Line search text' + let l = getqflist() + call assert_equal(l[0].pattern, '^\VLine search text\$') + call assert_equal(l[0].lnum, 0) + + let l = split(execute('clist', ''), "\n") + call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l) + + " Test for %P, %Q and %t format specifiers + let lines=["[Xtestfile1]", + \ "(1,17) error: ';' missing", + \ "(21,2) warning: variable 'z' not defined", + \ "(67,3) error: end of file found before string ended", + \ "--", + \ "", + \ "[Xtestfile2]", + \ "--", + \ "", + \ "[Xtestfile3]", + \ "NEW compiler v1.1", + \ "(2,2) warning: variable 'x' not defined", + \ "(67,3) warning: 's' already defined", + \ "--" + \] + set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r + " To exercise the push/pop file functionality in quickfix, the test files + " need to be created. + call writefile(['Line1'], 'Xtestfile1') + call writefile(['Line2'], 'Xtestfile2') + call writefile(['Line3'], 'Xtestfile3') + cexpr "" + for l in lines + caddexpr l + endfor + let l = getqflist() + call assert_equal(12, len(l)) + call assert_equal(21, l[2].lnum) + call assert_equal(2, l[2].col) + call assert_equal('w', l[2].type) + call assert_equal('e', l[3].type) + call delete('Xtestfile1') + call delete('Xtestfile2') + call delete('Xtestfile3') + + " Tests for %E, %C and %Z format specifiers + let lines = ["Error 275", + \ "line 42", + \ "column 3", + \ "' ' expected after '--'" + \] + set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m + cgetexpr lines + let l = getqflist() + call assert_equal(275, l[0].nr) + call assert_equal(42, l[0].lnum) + call assert_equal(3, l[0].col) + call assert_equal('E', l[0].type) + call assert_equal("\n' ' expected after '--'", l[0].text) + + " Test for %> + let lines = ["Error in line 147 of foo.c:", + \"unknown variable 'i'" + \] + set efm=unknown\ variable\ %m,%E%>Error\ in\ line\ %l\ of\ %f:,%Z%m + cgetexpr lines + let l = getqflist() + call assert_equal(147, l[0].lnum) + call assert_equal('E', l[0].type) + call assert_equal("\nunknown variable 'i'", l[0].text) + + " Test for %A, %C and other formats + let lines = [ + \"==============================================================", + \"FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)", + \"--------------------------------------------------------------", + \"Traceback (most recent call last):", + \' File "unittests/dbfacadeTest.py", line 89, in testFoo', + \" self.assertEquals(34, dtid)", + \' File "/usr/lib/python2.2/unittest.py", line 286, in', + \" failUnlessEqual", + \" raise self.failureException, \\", + \"AssertionError: 34 != 33", + \"", + \"--------------------------------------------------------------", + \"Ran 27 tests in 0.063s" + \] + set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m + cgetexpr lines + let l = getqflist() + call assert_equal(8, len(l)) + call assert_equal(89, l[4].lnum) + call assert_equal(1, l[4].valid) + call assert_equal('unittests/dbfacadeTest.py', bufname(l[4].bufnr)) + + " Test for %o + set efm=%f(%o):%l\ %m + cgetexpr ['Xotestfile(Language.PureScript.Types):20 Error'] + call writefile(['Line1'], 'Xotestfile') + let l = getqflist() + call assert_equal(1, len(l), string(l)) + call assert_equal('Language.PureScript.Types', l[0].module) + copen + call assert_equal('Language.PureScript.Types|20| Error', getline(1)) + call feedkeys("\<CR>", 'xn') + call assert_equal('Xotestfile', expand('%:t')) + cclose + bd + call delete("Xotestfile") + + " The following sequence of commands used to crash Vim + set efm=%W%m + cgetexpr ['msg1'] + let l = getqflist() + call assert_equal(1, len(l), string(l)) + call assert_equal('msg1', l[0].text) + set efm=%C%m + lexpr 'msg2' + let l = getloclist(0) + call assert_equal(1, len(l), string(l)) + call assert_equal('msg2', l[0].text) + lopen + call setqflist([], 'r') + caddbuf + let l = getqflist() + call assert_equal(1, len(l), string(l)) + call assert_equal('|| msg2', l[0].text) + + " When matching error lines, case should be ignored. Test for this. + set noignorecase + let l=getqflist({'lines' : ['Xtest:FOO10:Line 20'], 'efm':'%f:foo%l:%m'}) + call assert_equal(10, l.items[0].lnum) + call assert_equal('Line 20', l.items[0].text) + set ignorecase& + + new | only + let &efm = save_efm +endfunc + +func XquickfixChangedByAutocmd(cchar) + call s:setup_commands(a:cchar) + if a:cchar == 'c' + let ErrorNr = 'E925' + func! ReadFunc() + colder + cgetexpr [] + endfunc + else + let ErrorNr = 'E926' + func! ReadFunc() + lolder + lgetexpr [] + endfunc + endif + + augroup testgroup + au! + autocmd BufReadCmd test_changed.txt call ReadFunc() + augroup END + + new | only + let words = [ "a", "b" ] + let qflist = [] + for word in words + call add(qflist, {'filename': 'test_changed.txt'}) + call g:Xsetlist(qflist, ' ') + endfor + call assert_fails('Xrewind', ErrorNr . ':') + + augroup! testgroup +endfunc + +func Test_quickfix_was_changed_by_autocmd() + call XquickfixChangedByAutocmd('c') + call XquickfixChangedByAutocmd('l') +endfunc + +func Test_caddbuffer_to_empty() + helpgr quickfix + call setqflist([], 'r') + cad + try + cn + catch + " number of matches is unknown + call assert_true(v:exception =~ 'E553:') + endtry + quit! +endfunc + +func Test_cgetexpr_works() + " this must not crash Vim + cgetexpr [$x] + lgetexpr [$x] +endfunc + +" Tests for the setqflist() and setloclist() functions +func SetXlistTests(cchar, bnum) + call s:setup_commands(a:cchar) + + call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 1}, + \ {'bufnr': a:bnum, 'lnum': 2}]) + let l = g:Xgetlist() + call assert_equal(2, len(l)) + call assert_equal(2, l[1].lnum) + + Xnext + call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 3}], 'a') + let l = g:Xgetlist() + call assert_equal(3, len(l)) + Xnext + call assert_equal(3, line('.')) + + " Appending entries to the list should not change the cursor position + " in the quickfix window + Xwindow + 1 + call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 4}, + \ {'bufnr': a:bnum, 'lnum': 5}], 'a') + call assert_equal(1, line('.')) + close + + call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 3}, + \ {'bufnr': a:bnum, 'lnum': 4}, + \ {'bufnr': a:bnum, 'lnum': 5}], 'r') + let l = g:Xgetlist() + call assert_equal(3, len(l)) + call assert_equal(5, l[2].lnum) + + call g:Xsetlist([]) + let l = g:Xgetlist() + call assert_equal(0, len(l)) + + " Tests for setting the 'valid' flag + call g:Xsetlist([{'bufnr':a:bnum, 'lnum':4, 'valid':0}]) + Xwindow + call assert_equal(1, winnr('$')) + let l = g:Xgetlist() + call g:Xsetlist(l) + call assert_equal(0, g:Xgetlist()[0].valid) + call g:Xsetlist([{'text':'Text1', 'valid':1}]) + Xwindow + call assert_equal(2, winnr('$')) + Xclose + let save_efm = &efm + set efm=%m + Xgetexpr 'TestMessage' + let l = g:Xgetlist() + call g:Xsetlist(l) + call assert_equal(1, g:Xgetlist()[0].valid) + let &efm = save_efm + + " Error cases: + " Refer to a non-existing buffer and pass a non-dictionary type + call assert_fails("call g:Xsetlist([{'bufnr':998, 'lnum':4}," . + \ " {'bufnr':999, 'lnum':5}])", 'E92:') + call g:Xsetlist([[1, 2,3]]) + call assert_equal(0, len(g:Xgetlist())) +endfunc + +func Test_setqflist() + new Xtestfile | only + let bnum = bufnr('%') + call setline(1, range(1,5)) + + call SetXlistTests('c', bnum) + call SetXlistTests('l', bnum) + + enew! + call delete('Xtestfile') +endfunc + +func Xlist_empty_middle(cchar) + call s:setup_commands(a:cchar) + + " create three quickfix lists + let @/ = 'Test_' + Xvimgrep // test_quickfix.vim + let testlen = len(g:Xgetlist()) + call assert_true(testlen > 0) + Xvimgrep empty test_quickfix.vim + call assert_true(len(g:Xgetlist()) > 0) + Xvimgrep matches test_quickfix.vim + let matchlen = len(g:Xgetlist()) + call assert_true(matchlen > 0) + Xolder + " make the middle list empty + call g:Xsetlist([], 'r') + call assert_true(len(g:Xgetlist()) == 0) + Xolder + call assert_equal(testlen, len(g:Xgetlist())) + Xnewer + Xnewer + call assert_equal(matchlen, len(g:Xgetlist())) +endfunc + +func Test_setqflist_empty_middle() + call Xlist_empty_middle('c') + call Xlist_empty_middle('l') +endfunc + +func Xlist_empty_older(cchar) + call s:setup_commands(a:cchar) + + " create three quickfix lists + Xvimgrep one test_quickfix.vim + let onelen = len(g:Xgetlist()) + call assert_true(onelen > 0) + Xvimgrep two test_quickfix.vim + let twolen = len(g:Xgetlist()) + call assert_true(twolen > 0) + Xvimgrep three test_quickfix.vim + let threelen = len(g:Xgetlist()) + call assert_true(threelen > 0) + Xolder 2 + " make the first list empty, check the others didn't change + call g:Xsetlist([], 'r') + call assert_true(len(g:Xgetlist()) == 0) + Xnewer + call assert_equal(twolen, len(g:Xgetlist())) + Xnewer + call assert_equal(threelen, len(g:Xgetlist())) +endfunc + +func Test_setqflist_empty_older() + call Xlist_empty_older('c') + call Xlist_empty_older('l') +endfunc + +func XquickfixSetListWithAct(cchar) + call s:setup_commands(a:cchar) + + let list1 = [{'filename': 'fnameA', 'text': 'A'}, + \ {'filename': 'fnameB', 'text': 'B'}] + let list2 = [{'filename': 'fnameC', 'text': 'C'}, + \ {'filename': 'fnameD', 'text': 'D'}, + \ {'filename': 'fnameE', 'text': 'E'}] + + " {action} is unspecified. Same as specifing ' '. + new | only + silent! Xnewer 99 + call g:Xsetlist(list1) + call g:Xsetlist(list2) + let li = g:Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + silent! Xolder + let li = g:Xgetlist() + call assert_equal(2, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + + " {action} is specified ' '. + new | only + silent! Xnewer 99 + call g:Xsetlist(list1) + call g:Xsetlist(list2, ' ') + let li = g:Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + silent! Xolder + let li = g:Xgetlist() + call assert_equal(2, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + + " {action} is specified 'a'. + new | only + silent! Xnewer 99 + call g:Xsetlist(list1) + call g:Xsetlist(list2, 'a') + let li = g:Xgetlist() + call assert_equal(5, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + call assert_equal('C', li[2]['text']) + call assert_equal('D', li[3]['text']) + call assert_equal('E', li[4]['text']) + + " {action} is specified 'r'. + new | only + silent! Xnewer 99 + call g:Xsetlist(list1) + call g:Xsetlist(list2, 'r') + let li = g:Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + + " Test for wrong value. + new | only + call assert_fails("call g:Xsetlist(0)", 'E714:') + call assert_fails("call g:Xsetlist(list1, '')", 'E927:') + call assert_fails("call g:Xsetlist(list1, 'aa')", 'E927:') + call assert_fails("call g:Xsetlist(list1, ' a')", 'E927:') + call assert_fails("call g:Xsetlist(list1, 0)", 'E928:') +endfunc + +func Test_setqflist_invalid_nr() + " The following command used to crash Vim + call setqflist([], ' ', {'nr' : $XXX_DOES_NOT_EXIST}) +endfunc + +func Test_quickfix_set_list_with_act() + call XquickfixSetListWithAct('c') + call XquickfixSetListWithAct('l') +endfunc + +func XLongLinesTests(cchar) + let l = g:Xgetlist() + + call assert_equal(4, len(l)) + call assert_equal(1, l[0].lnum) + call assert_equal(1, l[0].col) + call assert_equal(1975, len(l[0].text)) + call assert_equal(2, l[1].lnum) + call assert_equal(1, l[1].col) + call assert_equal(4070, len(l[1].text)) + call assert_equal(3, l[2].lnum) + call assert_equal(1, l[2].col) + call assert_equal(4070, len(l[2].text)) + call assert_equal(4, l[3].lnum) + call assert_equal(1, l[3].col) + call assert_equal(10, len(l[3].text)) + + call g:Xsetlist([], 'r') +endfunc + +func s:long_lines_tests(cchar) + call s:setup_commands(a:cchar) + + let testfile = 'samples/quickfix.txt' + + " file + exe 'Xgetfile' testfile + call XLongLinesTests(a:cchar) + + " list + Xexpr readfile(testfile) + call XLongLinesTests(a:cchar) + + " string + Xexpr join(readfile(testfile), "\n") + call XLongLinesTests(a:cchar) + + " buffer + exe 'edit' testfile + exe 'Xbuffer' bufnr('%') + call XLongLinesTests(a:cchar) +endfunc + +func Test_long_lines() + call s:long_lines_tests('c') + call s:long_lines_tests('l') +endfunc + +func s:create_test_file(filename) + let l = [] + for i in range(1, 20) + call add(l, 'Line' . i) + endfor + call writefile(l, a:filename) +endfunc + +func Test_switchbuf() + call s:create_test_file('Xqftestfile1') + call s:create_test_file('Xqftestfile2') + call s:create_test_file('Xqftestfile3') + + new | only + edit Xqftestfile1 + let file1_winid = win_getid() + new Xqftestfile2 + let file2_winid = win_getid() + cgetexpr ['Xqftestfile1:5:Line5', + \ 'Xqftestfile1:6:Line6', + \ 'Xqftestfile2:10:Line10', + \ 'Xqftestfile2:11:Line11', + \ 'Xqftestfile3:15:Line15', + \ 'Xqftestfile3:16:Line16'] + + new + let winid = win_getid() + cfirst | cnext + call assert_equal(winid, win_getid()) + 2cnext + call assert_equal(winid, win_getid()) + 2cnext + call assert_equal(winid, win_getid()) + enew + + set switchbuf=useopen + cfirst | cnext + call assert_equal(file1_winid, win_getid()) + 2cnext + call assert_equal(file2_winid, win_getid()) + 2cnext + call assert_equal(file2_winid, win_getid()) + + enew | only + set switchbuf=usetab + tabedit Xqftestfile1 + tabedit Xqftestfile2 + tabedit Xqftestfile3 + tabfirst + cfirst | cnext + call assert_equal(2, tabpagenr()) + 2cnext + call assert_equal(3, tabpagenr()) + 6cnext + call assert_equal(4, tabpagenr()) + 2cpfile + call assert_equal(2, tabpagenr()) + 2cnfile + call assert_equal(4, tabpagenr()) + tabfirst | tabonly | enew + + set switchbuf=split + cfirst | cnext + call assert_equal(1, winnr('$')) + cnext | cnext + call assert_equal(2, winnr('$')) + cnext | cnext + call assert_equal(3, winnr('$')) + enew | only + + set switchbuf=newtab + cfirst | cnext + call assert_equal(1, tabpagenr('$')) + cnext | cnext + call assert_equal(2, tabpagenr('$')) + cnext | cnext + call assert_equal(3, tabpagenr('$')) + tabfirst | enew | tabonly | only + + set switchbuf= + edit Xqftestfile1 + let file1_winid = win_getid() + new Xqftestfile2 + let file2_winid = win_getid() + copen + exe "normal 1G\<CR>" + call assert_equal(file1_winid, win_getid()) + copen + exe "normal 3G\<CR>" + call assert_equal(file2_winid, win_getid()) + copen | only + exe "normal 5G\<CR>" + call assert_equal(2, winnr('$')) + call assert_equal(1, bufwinnr('Xqftestfile3')) + + " If only quickfix window is open in the current tabpage, jumping to an + " entry with 'switchubf' set to 'usetab' should search in other tabpages. + enew | only + set switchbuf=usetab + tabedit Xqftestfile1 + tabedit Xqftestfile2 + tabedit Xqftestfile3 + tabfirst + copen | only + clast + call assert_equal(4, tabpagenr()) + tabfirst | tabonly | enew | only + + call delete('Xqftestfile1') + call delete('Xqftestfile2') + call delete('Xqftestfile3') + set switchbuf&vim + + enew | only +endfunc + +func Xadjust_qflnum(cchar) + call s:setup_commands(a:cchar) + + enew | only + + let fname = 'Xqftestfile' . a:cchar + call s:create_test_file(fname) + exe 'edit ' . fname + + Xgetexpr [fname . ':5:Line5', + \ fname . ':10:Line10', + \ fname . ':15:Line15', + \ fname . ':20:Line20'] + + 6,14delete + call append(6, ['Buffer', 'Window']) + + let l = g:Xgetlist() + + call assert_equal(5, l[0].lnum) + call assert_equal(6, l[2].lnum) + call assert_equal(13, l[3].lnum) + + enew! + call delete(fname) +endfunc + +func Test_adjust_lnum() + call setloclist(0, []) + call Xadjust_qflnum('c') + call setqflist([]) + call Xadjust_qflnum('l') +endfunc + +" Tests for the :grep/:lgrep and :grepadd/:lgrepadd commands +func s:test_xgrep(cchar) + call s:setup_commands(a:cchar) + + " The following lines are used for the grep test. Don't remove. + " Grep_Test_Text: Match 1 + " Grep_Test_Text: Match 2 + " GrepAdd_Test_Text: Match 1 + " GrepAdd_Test_Text: Match 2 + enew! | only + set makeef&vim + silent Xgrep Grep_Test_Text: test_quickfix.vim + call assert_true(len(g:Xgetlist()) == 3) + Xopen + call assert_true(w:quickfix_title =~ '^:grep') + Xclose + enew + set makeef=Temp_File_## + silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim + call assert_true(len(g:Xgetlist()) == 6) +endfunc + +func Test_grep() + if !has('unix') + " The grepprg may not be set on non-Unix systems + return + endif + + call s:test_xgrep('c') + call s:test_xgrep('l') +endfunc + +func Test_two_windows() + " Use one 'errorformat' for two windows. Add an expression to each of them, + " make sure they each keep their own state. + set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f' + call mkdir('Xone/a', 'p') + call mkdir('Xtwo/a', 'p') + let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] + call writefile(lines, 'Xone/a/one.txt') + call writefile(lines, 'Xtwo/a/two.txt') + + new one + let one_id = win_getid() + lexpr "" + new two + let two_id = win_getid() + lexpr "" + + laddexpr "Entering dir 'Xtwo/a'" + call win_gotoid(one_id) + laddexpr "Entering dir 'Xone/a'" + call win_gotoid(two_id) + laddexpr 'two.txt:5:two two two' + call win_gotoid(one_id) + laddexpr 'one.txt:3:one one one' + + let loc_one = getloclist(one_id) + call assert_equal('Xone/a/one.txt', bufname(loc_one[1].bufnr)) + call assert_equal(3, loc_one[1].lnum) + + let loc_two = getloclist(two_id) + call assert_equal('Xtwo/a/two.txt', bufname(loc_two[1].bufnr)) + call assert_equal(5, loc_two[1].lnum) + + call win_gotoid(one_id) + bwipe! + call win_gotoid(two_id) + bwipe! + call delete('Xone', 'rf') + call delete('Xtwo', 'rf') +endfunc + +func XbottomTests(cchar) + call s:setup_commands(a:cchar) + + " Calling lbottom without any errors should fail + if a:cchar == 'l' + call assert_fails('lbottom', 'E776:') + endif + + call g:Xsetlist([{'filename': 'foo', 'lnum': 42}]) + Xopen + let wid = win_getid() + call assert_equal(1, line('.')) + wincmd w + call g:Xsetlist([{'filename': 'var', 'lnum': 24}], 'a') + Xbottom + call win_gotoid(wid) + call assert_equal(2, line('.')) + Xclose +endfunc + +" Tests for the :cbottom and :lbottom commands +func Test_cbottom() + call XbottomTests('c') + call XbottomTests('l') +endfunc + +func HistoryTest(cchar) + call s:setup_commands(a:cchar) + + " clear all lists after the first one, then replace the first one. + call g:Xsetlist([]) + call assert_fails('Xolder 99', 'E380:') + let entry = {'filename': 'foo', 'lnum': 42} + call g:Xsetlist([entry], 'r') + call g:Xsetlist([entry, entry]) + call g:Xsetlist([entry, entry, entry]) + let res = split(execute(a:cchar . 'hist'), "\n") + call assert_equal(3, len(res)) + let common = 'errors :set' . (a:cchar == 'c' ? 'qf' : 'loc') . 'list()' + call assert_equal(' error list 1 of 3; 1 ' . common, res[0]) + call assert_equal(' error list 2 of 3; 2 ' . common, res[1]) + call assert_equal('> error list 3 of 3; 3 ' . common, res[2]) + + call g:Xsetlist([], 'f') + let l = split(execute(a:cchar . 'hist'), "\n") + call assert_equal('No entries', l[0]) +endfunc + +func Test_history() + call HistoryTest('c') + call HistoryTest('l') +endfunc + +func Test_duplicate_buf() + " make sure we can get the highest buffer number + edit DoesNotExist + edit DoesNotExist2 + let last_buffer = bufnr("$") + + " make sure only one buffer is created + call writefile(['this one', 'that one'], 'Xgrepthis') + vimgrep one Xgrepthis + vimgrep one Xgrepthis + call assert_equal(last_buffer + 1, bufnr("$")) + + call delete('Xgrepthis') +endfunc + +" Quickfix/Location list set/get properties tests +func Xproperty_tests(cchar) + call s:setup_commands(a:cchar) + + " Error cases + call assert_fails('call g:Xgetlist(99)', 'E715:') + call assert_fails('call g:Xsetlist(99)', 'E714:') + call assert_fails('call g:Xsetlist([], "a", [])', 'E715:') + + " Set and get the title + call g:Xsetlist([]) + Xopen + wincmd p + call g:Xsetlist([{'filename':'foo', 'lnum':27}]) + let s = g:Xsetlist([], 'a', {'title' : 'Sample'}) + call assert_equal(0, s) + let d = g:Xgetlist({"title":1}) + call assert_equal('Sample', d.title) + " Try setting title to a non-string value + call assert_equal(-1, g:Xsetlist([], 'a', {'title' : ['Test']})) + call assert_equal('Sample', g:Xgetlist({"title":1}).title) + + Xopen + call assert_equal('Sample', w:quickfix_title) + Xclose + + " Tests for action argument + silent! Xolder 999 + let qfnr = g:Xgetlist({'all':1}).nr + call g:Xsetlist([], 'r', {'title' : 'N1'}) + call assert_equal('N1', g:Xgetlist({'all':1}).title) + call g:Xsetlist([], ' ', {'title' : 'N2'}) + call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr) + + let res = g:Xgetlist({'nr': 0}) + call assert_equal(qfnr + 1, res.nr) + call assert_equal(['nr'], keys(res)) + + call g:Xsetlist([], ' ', {'title' : 'N3'}) + call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title) + + " Changing the title of an earlier quickfix list + call g:Xsetlist([], 'r', {'title' : 'NewTitle', 'nr' : 2}) + call assert_equal('NewTitle', g:Xgetlist({'nr':2, 'title':1}).title) + + " Changing the title of an invalid quickfix list + call assert_equal(-1, g:Xsetlist([], ' ', + \ {'title' : 'SomeTitle', 'nr' : 99})) + call assert_equal(-1, g:Xsetlist([], ' ', + \ {'title' : 'SomeTitle', 'nr' : 'abc'})) + + if a:cchar == 'c' + copen + call assert_equal({'winid':win_getid()}, getqflist({'winid':1})) + cclose + endif + + " Invalid arguments + call assert_fails('call g:Xgetlist([])', 'E715') + call assert_fails('call g:Xsetlist([], "a", [])', 'E715') + let s = g:Xsetlist([], 'a', {'abc':1}) + call assert_equal(-1, s) + + call assert_equal({}, g:Xgetlist({'abc':1})) + call assert_equal('', g:Xgetlist({'nr':99, 'title':1}).title) + call assert_equal('', g:Xgetlist({'nr':[], 'title':1}).title) + + if a:cchar == 'l' + call assert_equal({}, getloclist(99, {'title': 1})) + endif + + " Context related tests + let s = g:Xsetlist([], 'a', {'context':[1,2,3]}) + call assert_equal(0, s) + call test_garbagecollect_now() + let d = g:Xgetlist({'context':1}) + call assert_equal([1,2,3], d.context) + call g:Xsetlist([], 'a', {'context':{'color':'green'}}) + let d = g:Xgetlist({'context':1}) + call assert_equal({'color':'green'}, d.context) + call g:Xsetlist([], 'a', {'context':"Context info"}) + let d = g:Xgetlist({'context':1}) + call assert_equal("Context info", d.context) + call g:Xsetlist([], 'a', {'context':246}) + let d = g:Xgetlist({'context':1}) + call assert_equal(246, d.context) + if a:cchar == 'l' + " Test for copying context across two different location lists + new | only + let w1_id = win_getid() + let l = [1] + call setloclist(0, [], 'a', {'context':l}) + new + let w2_id = win_getid() + call add(l, 2) + call assert_equal([1, 2], getloclist(w1_id, {'context':1}).context) + call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) + unlet! l + call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) + only + call setloclist(0, [], 'f') + call assert_equal('', getloclist(0, {'context':1}).context) + endif + + " Test for changing the context of previous quickfix lists + call g:Xsetlist([], 'f') + Xexpr "One" + Xexpr "Two" + Xexpr "Three" + call g:Xsetlist([], 'r', {'context' : [1], 'nr' : 1}) + call g:Xsetlist([], 'a', {'context' : [2], 'nr' : 2}) + " Also, check for setting the context using quickfix list number zero. + call g:Xsetlist([], 'r', {'context' : [3], 'nr' : 0}) + call test_garbagecollect_now() + let l = g:Xgetlist({'nr' : 1, 'context' : 1}) + call assert_equal([1], l.context) + let l = g:Xgetlist({'nr' : 2, 'context' : 1}) + call assert_equal([2], l.context) + let l = g:Xgetlist({'nr' : 3, 'context' : 1}) + call assert_equal([3], l.context) + + " Test for changing the context through reference and for garbage + " collection of quickfix context + let l = ["red"] + call g:Xsetlist([], ' ', {'context' : l}) + call add(l, "blue") + let x = g:Xgetlist({'context' : 1}) + call add(x.context, "green") + call assert_equal(["red", "blue", "green"], l) + call assert_equal(["red", "blue", "green"], x.context) + unlet l + call test_garbagecollect_now() + let m = g:Xgetlist({'context' : 1}) + call assert_equal(["red", "blue", "green"], m.context) + + " Test for setting/getting items + Xexpr "" + let qfprev = g:Xgetlist({'nr':0}) + let s = g:Xsetlist([], ' ', {'title':'Green', + \ 'items' : [{'filename':'F1', 'lnum':10}]}) + call assert_equal(0, s) + let qfcur = g:Xgetlist({'nr':0}) + call assert_true(qfcur.nr == qfprev.nr + 1) + let l = g:Xgetlist({'items':1}) + call assert_equal('F1', bufname(l.items[0].bufnr)) + call assert_equal(10, l.items[0].lnum) + call g:Xsetlist([], 'a', {'items' : [{'filename':'F2', 'lnum':20}, + \ {'filename':'F2', 'lnum':30}]}) + let l = g:Xgetlist({'items':1}) + call assert_equal('F2', bufname(l.items[2].bufnr)) + call assert_equal(30, l.items[2].lnum) + call g:Xsetlist([], 'r', {'items' : [{'filename':'F3', 'lnum':40}]}) + let l = g:Xgetlist({'items':1}) + call assert_equal('F3', bufname(l.items[0].bufnr)) + call assert_equal(40, l.items[0].lnum) + call g:Xsetlist([], 'r', {'items' : []}) + let l = g:Xgetlist({'items':1}) + call assert_equal(0, len(l.items)) + + call g:Xsetlist([], 'r', {'title' : 'TestTitle'}) + call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) + call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) + call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title) + + " The following used to crash Vim with address sanitizer + call g:Xsetlist([], 'f') + call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]}) + call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum) + + " Try setting the items using a string + call assert_equal(-1, g:Xsetlist([], ' ', {'items' : 'Test'})) + + " Save and restore the quickfix stack + call g:Xsetlist([], 'f') + call assert_equal(0, g:Xgetlist({'nr':'$'}).nr) + Xexpr "File1:10:Line1" + Xexpr "File2:20:Line2" + Xexpr "File3:30:Line3" + let last_qf = g:Xgetlist({'nr':'$'}).nr + call assert_equal(3, last_qf) + let qstack = [] + for i in range(1, last_qf) + let qstack = add(qstack, g:Xgetlist({'nr':i, 'all':1})) + endfor + call g:Xsetlist([], 'f') + for i in range(len(qstack)) + call g:Xsetlist([], ' ', qstack[i]) + endfor + call assert_equal(3, g:Xgetlist({'nr':'$'}).nr) + call assert_equal(10, g:Xgetlist({'nr':1, 'items':1}).items[0].lnum) + call assert_equal(20, g:Xgetlist({'nr':2, 'items':1}).items[0].lnum) + call assert_equal(30, g:Xgetlist({'nr':3, 'items':1}).items[0].lnum) + call g:Xsetlist([], 'f') + + " Swap two quickfix lists + Xexpr "File1:10:Line10" + Xexpr "File2:20:Line20" + Xexpr "File3:30:Line30" + call g:Xsetlist([], 'r', {'nr':1,'title':'Colors','context':['Colors']}) + call g:Xsetlist([], 'r', {'nr':2,'title':'Fruits','context':['Fruits']}) + let l1=g:Xgetlist({'nr':1,'all':1}) + let l2=g:Xgetlist({'nr':2,'all':1}) + let save_id = l1.id + let l1.id=l2.id + let l2.id=save_id + call g:Xsetlist([], 'r', l1) + call g:Xsetlist([], 'r', l2) + let newl1=g:Xgetlist({'nr':1,'all':1}) + let newl2=g:Xgetlist({'nr':2,'all':1}) + call assert_equal('Fruits', newl1.title) + call assert_equal(['Fruits'], newl1.context) + call assert_equal('Line20', newl1.items[0].text) + call assert_equal('Colors', newl2.title) + call assert_equal(['Colors'], newl2.context) + call assert_equal('Line10', newl2.items[0].text) + call g:Xsetlist([], 'f') +endfunc + +func Test_qf_property() + call Xproperty_tests('c') + call Xproperty_tests('l') +endfunc + +" Tests for the QuickFixCmdPre/QuickFixCmdPost autocommands +func QfAutoCmdHandler(loc, cmd) + call add(g:acmds, a:loc . a:cmd) +endfunc + +func Test_Autocmd() + autocmd QuickFixCmdPre * call QfAutoCmdHandler('pre', expand('<amatch>')) + autocmd QuickFixCmdPost * call QfAutoCmdHandler('post', expand('<amatch>')) + + let g:acmds = [] + cexpr "F1:10:Line 10" + caddexpr "F1:20:Line 20" + cgetexpr "F1:30:Line 30" + cexpr "" + caddexpr "" + cgetexpr "" + silent! cexpr non_existing_func() + silent! caddexpr non_existing_func() + silent! cgetexpr non_existing_func() + let l = ['precexpr', + \ 'postcexpr', + \ 'precaddexpr', + \ 'postcaddexpr', + \ 'precgetexpr', + \ 'postcgetexpr', + \ 'precexpr', + \ 'postcexpr', + \ 'precaddexpr', + \ 'postcaddexpr', + \ 'precgetexpr', + \ 'postcgetexpr', + \ 'precexpr', + \ 'precaddexpr', + \ 'precgetexpr'] + call assert_equal(l, g:acmds) + + let g:acmds = [] + enew! | call append(0, "F2:10:Line 10") + cbuffer! + enew! | call append(0, "F2:20:Line 20") + cgetbuffer + enew! | call append(0, "F2:30:Line 30") + caddbuffer + new + let bnum = bufnr('%') + bunload + exe 'silent! cbuffer! ' . bnum + exe 'silent! cgetbuffer ' . bnum + exe 'silent! caddbuffer ' . bnum + enew! + let l = ['precbuffer', + \ 'postcbuffer', + \ 'precgetbuffer', + \ 'postcgetbuffer', + \ 'precaddbuffer', + \ 'postcaddbuffer', + \ 'precbuffer', + \ 'precgetbuffer', + \ 'precaddbuffer'] + call assert_equal(l, g:acmds) + + call writefile(['Xtest:1:Line1'], 'Xtest') + call writefile([], 'Xempty') + let g:acmds = [] + cfile Xtest + caddfile Xtest + cgetfile Xtest + cfile Xempty + caddfile Xempty + cgetfile Xempty + silent! cfile do_not_exist + silent! caddfile do_not_exist + silent! cgetfile do_not_exist + let l = ['precfile', + \ 'postcfile', + \ 'precaddfile', + \ 'postcaddfile', + \ 'precgetfile', + \ 'postcgetfile', + \ 'precfile', + \ 'postcfile', + \ 'precaddfile', + \ 'postcaddfile', + \ 'precgetfile', + \ 'postcgetfile', + \ 'precfile', + \ 'postcfile', + \ 'precaddfile', + \ 'postcaddfile', + \ 'precgetfile', + \ 'postcgetfile'] + call assert_equal(l, g:acmds) + + let g:acmds = [] + helpgrep quickfix + silent! helpgrep non_existing_help_topic + vimgrep test Xtest + vimgrepadd test Xtest + silent! vimgrep non_existing_test Xtest + silent! vimgrepadd non_existing_test Xtest + set makeprg= + silent! make + set makeprg& + let l = ['prehelpgrep', + \ 'posthelpgrep', + \ 'prehelpgrep', + \ 'posthelpgrep', + \ 'previmgrep', + \ 'postvimgrep', + \ 'previmgrepadd', + \ 'postvimgrepadd', + \ 'previmgrep', + \ 'postvimgrep', + \ 'previmgrepadd', + \ 'postvimgrepadd', + \ 'premake', + \ 'postmake'] + call assert_equal(l, g:acmds) + + if has('unix') + " Run this test only on Unix-like systems. The grepprg may not be set on + " non-Unix systems. + " The following lines are used for the grep test. Don't remove. + " Grep_Autocmd_Text: Match 1 + " GrepAdd_Autocmd_Text: Match 2 + let g:acmds = [] + silent grep Grep_Autocmd_Text test_quickfix.vim + silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim + silent grep abc123def Xtest + silent grepadd abc123def Xtest + let l = ['pregrep', + \ 'postgrep', + \ 'pregrepadd', + \ 'postgrepadd', + \ 'pregrep', + \ 'postgrep', + \ 'pregrepadd', + \ 'postgrepadd'] + call assert_equal(l, g:acmds) + endif + + call delete('Xtest') + call delete('Xempty') + au! QuickFixCmdPre + au! QuickFixCmdPost +endfunc + +func Test_Autocmd_Exception() + set efm=%m + lgetexpr '?' + + try + call DoesNotExit() + catch + lgetexpr '1' + finally + lgetexpr '1' + endtry + + call assert_equal('1', getloclist(0)[0].text) + + set efm&vim +endfunc + +func Test_caddbuffer_wrong() + " This used to cause a memory access in freed memory. + let save_efm = &efm + set efm=%EEEE%m,%WWWW,%+CCCC%>%#,%GGGG%.# + cgetexpr ['WWWW', 'EEEE', 'CCCC'] + let &efm = save_efm + caddbuffer + bwipe! +endfunc + +func Test_caddexpr_wrong() + " This used to cause a memory access in freed memory. + cbuffer + cbuffer + copen + let save_efm = &efm + set efm=% + call assert_fails('caddexpr ""', 'E376:') + let &efm = save_efm +endfunc + +func Test_dirstack_cleanup() + " This used to cause a memory access in freed memory. + let save_efm = &efm + lexpr '0' + lopen + fun X(c) + let save_efm=&efm + set efm=%D%f + if a:c == 'c' + caddexpr '::' + else + laddexpr ':0:0' + endif + let &efm=save_efm + endfun + call X('c') + call X('l') + call setqflist([], 'r') + caddbuffer + let &efm = save_efm +endfunc + +" Tests for jumping to entries from the location list window and quickfix +" window +func Test_cwindow_jump() + set efm=%f%%%l%%%m + lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"] + lopen | only + lfirst + call assert_true(winnr('$') == 2) + call assert_true(winnr() == 1) + " Location list for the new window should be set + call assert_true(getloclist(0)[2].text == 'Line 30') + + " Open a scratch buffer + " Open a new window and create a location list + " Open the location list window and close the other window + " Jump to an entry. + " Should create a new window and jump to the entry. The scrtach buffer + " should not be used. + enew | only + set buftype=nofile + below new + lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"] + lopen + 2wincmd c + lnext + call assert_true(winnr('$') == 3) + call assert_true(winnr() == 2) + + " Open two windows with two different location lists + " Open the location list window and close the previous window + " Jump to an entry in the location list window + " Should open the file in the first window and not set the location list. + enew | only + lgetexpr ["F1%5%Line 5"] + below new + lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"] + lopen + 2wincmd c + lnext + call assert_true(winnr() == 1) + call assert_true(getloclist(0)[0].text == 'Line 5') + + enew | only + cgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"] + copen + cnext + call assert_true(winnr('$') == 2) + call assert_true(winnr() == 1) + + enew | only + set efm&vim +endfunc + +func XvimgrepTests(cchar) + call s:setup_commands(a:cchar) + + call writefile(['Editor:VIM vim', + \ 'Editor:Emacs EmAcS', + \ 'Editor:Notepad NOTEPAD'], 'Xtestfile1') + call writefile(['Linux', 'MacOS', 'MS-Windows'], 'Xtestfile2') + + " Error cases + call assert_fails('Xvimgrep /abc *', 'E682:') + + let @/='' + call assert_fails('Xvimgrep // *', 'E35:') + + call assert_fails('Xvimgrep abc', 'E683:') + call assert_fails('Xvimgrep a1b2c3 Xtestfile1', 'E480:') + call assert_fails('Xvimgrep pat Xa1b2c3', 'E480:') + + Xexpr "" + Xvimgrepadd Notepad Xtestfile1 + Xvimgrepadd MacOS Xtestfile2 + let l = g:Xgetlist() + call assert_equal(2, len(l)) + call assert_equal('Editor:Notepad NOTEPAD', l[0].text) + + Xvimgrep #\cvim#g Xtestfile? + let l = g:Xgetlist() + call assert_equal(2, len(l)) + call assert_equal(8, l[0].col) + call assert_equal(12, l[1].col) + + 1Xvimgrep ?Editor? Xtestfile* + let l = g:Xgetlist() + call assert_equal(1, len(l)) + call assert_equal('Editor:VIM vim', l[0].text) + + edit +3 Xtestfile2 + Xvimgrep +\cemacs+j Xtestfile1 + let l = g:Xgetlist() + call assert_equal('Xtestfile2', bufname('')) + call assert_equal('Editor:Emacs EmAcS', l[0].text) + + " Test for unloading a buffer after vimgrep searched the buffer + %bwipe + Xvimgrep /Editor/j Xtestfile* + call assert_equal(0, getbufinfo('Xtestfile1')[0].loaded) + call assert_equal([], getbufinfo('Xtestfile2')) + + call delete('Xtestfile1') + call delete('Xtestfile2') +endfunc + +" Tests for the :vimgrep command +func Test_vimgrep() + call XvimgrepTests('c') + call XvimgrepTests('l') +endfunc + +func XfreeTests(cchar) + call s:setup_commands(a:cchar) + + enew | only + + " Deleting the quickfix stack should work even When the current list is + " somewhere in the middle of the stack + Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15'] + Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25'] + Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35'] + Xolder + call g:Xsetlist([], 'f') + call assert_equal(0, len(g:Xgetlist())) + + " After deleting the stack, adding a new list should create a stack with a + " single list. + Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15'] + call assert_equal(1, g:Xgetlist({'all':1}).nr) + + " Deleting the stack from a quickfix window should update/clear the + " quickfix/location list window. + Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15'] + Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25'] + Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35'] + Xolder + Xwindow + call g:Xsetlist([], 'f') + call assert_equal(2, winnr('$')) + call assert_equal(1, line('$')) + Xclose + + " Deleting the stack from a non-quickfix window should update/clear the + " quickfix/location list window. + Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15'] + Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25'] + Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35'] + Xolder + Xwindow + wincmd p + call g:Xsetlist([], 'f') + call assert_equal(0, len(g:Xgetlist())) + wincmd p + call assert_equal(2, winnr('$')) + call assert_equal(1, line('$')) + + " After deleting the location list stack, if the location list window is + " opened, then a new location list should be created. So opening the + " location list window again should not create a new window. + if a:cchar == 'l' + lexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15'] + wincmd p + lopen + call assert_equal(2, winnr('$')) + endif + Xclose +endfunc + +" Tests for the quickfix free functionality +func Test_qf_free() + call XfreeTests('c') + call XfreeTests('l') +endfunc + +" Test for buffer overflow when parsing lines and adding new entries to +" the quickfix list. +func Test_bufoverflow() + set efm=%f:%l:%m + cgetexpr ['File1:100:' . repeat('x', 1025)] + + set efm=%+GCompiler:\ %.%#,%f:%l:%m + cgetexpr ['Compiler: ' . repeat('a', 1015), 'File1:10:Hello World'] + + set efm=%DEntering\ directory\ %f,%f:%l:%m + cgetexpr ['Entering directory ' . repeat('a', 1006), + \ 'File1:10:Hello World'] + set efm&vim +endfunc + +" Tests for getting the quickfix stack size +func XsizeTests(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + call assert_equal(0, g:Xgetlist({'nr':'$'}).nr) + call assert_equal('', g:Xgetlist({'nr':'$', 'all':1}).title) + call assert_equal(0, g:Xgetlist({'nr':0}).nr) + + Xexpr "File1:10:Line1" + Xexpr "File2:20:Line2" + Xexpr "File3:30:Line3" + Xolder | Xolder + call assert_equal(3, g:Xgetlist({'nr':'$'}).nr) + call g:Xsetlist([], 'f') + + Xexpr "File1:10:Line1" + Xexpr "File2:20:Line2" + Xexpr "File3:30:Line3" + Xolder | Xolder + call g:Xsetlist([], 'a', {'nr':'$', 'title':'Compiler'}) + call assert_equal('Compiler', g:Xgetlist({'nr':3, 'all':1}).title) +endfunc + +func Test_Qf_Size() + call XsizeTests('c') + call XsizeTests('l') +endfunc + +func Test_cclose_from_copen() + augroup QF_Test + au! + au FileType qf :call assert_fails(':cclose', 'E788') + augroup END + copen + augroup QF_Test + au! + augroup END + augroup! QF_Test +endfunc + +func Test_cclose_in_autocmd() + " Problem is only triggered if "starting" is zero, so that the OptionsSet + " event will be triggered. + call test_override('starting', 1) + augroup QF_Test + au! + au FileType qf :call assert_fails(':cclose', 'E788') + augroup END + copen + augroup QF_Test + au! + augroup END + augroup! QF_Test + call test_override('starting', 0) +endfunc + +func Test_resize_from_copen() + augroup QF_Test + au! + au FileType qf resize 5 + augroup END + try + " This should succeed without any exception. No other buffers are + " involved in the autocmd. + copen + finally + augroup QF_Test + au! + augroup END + augroup! QF_Test + endtry +endfunc + +" Tests for the quickfix buffer b:changedtick variable +func Xchangedtick_tests(cchar) + call s:setup_commands(a:cchar) + + new | only + + Xexpr "" | Xexpr "" | Xexpr "" + + Xopen + Xolder + Xolder + Xaddexpr "F1:10:Line10" + Xaddexpr "F2:20:Line20" + call g:Xsetlist([{"filename":"F3", "lnum":30, "text":"Line30"}], 'a') + call g:Xsetlist([], 'f') + call assert_equal(8, getbufvar('%', 'changedtick')) + Xclose +endfunc + +func Test_changedtick() + call Xchangedtick_tests('c') + call Xchangedtick_tests('l') +endfunc + +" Tests for parsing an expression using setqflist() +func Xsetexpr_tests(cchar) + call s:setup_commands(a:cchar) + + let t = ["File1:10:Line10", "File1:20:Line20"] + call g:Xsetlist([], ' ', {'lines' : t}) + call g:Xsetlist([], 'a', {'lines' : ["File1:30:Line30"]}) + + let l = g:Xgetlist() + call assert_equal(3, len(l)) + call assert_equal(20, l[1].lnum) + call assert_equal('Line30', l[2].text) + call g:Xsetlist([], 'r', {'lines' : ["File2:5:Line5"]}) + let l = g:Xgetlist() + call assert_equal(1, len(l)) + call assert_equal('Line5', l[0].text) + call assert_equal(-1, g:Xsetlist([], 'a', {'lines' : 10})) + call assert_equal(-1, g:Xsetlist([], 'a', {'lines' : "F1:10:L10"})) + + call g:Xsetlist([], 'f') + " Add entries to multiple lists + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["File1:10:Line10"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["File2:20:Line20"]}) + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["File1:15:Line15"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["File2:25:Line25"]}) + call assert_equal('Line15', g:Xgetlist({'nr':1, 'items':1}).items[1].text) + call assert_equal('Line25', g:Xgetlist({'nr':2, 'items':1}).items[1].text) + + " Adding entries using a custom efm + set efm& + call g:Xsetlist([], ' ', {'efm' : '%f#%l#%m', + \ 'lines' : ["F1#10#L10", "F2#20#L20"]}) + call assert_equal(20, g:Xgetlist({'items':1}).items[1].lnum) + call g:Xsetlist([], 'a', {'efm' : '%f#%l#%m', 'lines' : ["F3:30:L30"]}) + call assert_equal('F3:30:L30', g:Xgetlist({'items':1}).items[2].text) + call assert_equal(20, g:Xgetlist({'items':1}).items[1].lnum) + call assert_equal(-1, g:Xsetlist([], 'a', {'efm' : [], + \ 'lines' : ['F1:10:L10']})) +endfunc + +func Test_setexpr() + call Xsetexpr_tests('c') + call Xsetexpr_tests('l') +endfunc + +" Tests for per quickfix/location list directory stack +func Xmultidirstack_tests(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + Xexpr "" | Xexpr "" + + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["Entering dir 'Xone/a'"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["Entering dir 'Xtwo/a'"]}) + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["one.txt:3:one one one"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["two.txt:5:two two two"]}) + + let l1 = g:Xgetlist({'nr':1, 'items':1}) + let l2 = g:Xgetlist({'nr':2, 'items':1}) + call assert_equal('Xone/a/one.txt', bufname(l1.items[1].bufnr)) + call assert_equal(3, l1.items[1].lnum) + call assert_equal('Xtwo/a/two.txt', bufname(l2.items[1].bufnr)) + call assert_equal(5, l2.items[1].lnum) +endfunc + +func Test_multidirstack() + call mkdir('Xone/a', 'p') + call mkdir('Xtwo/a', 'p') + let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] + call writefile(lines, 'Xone/a/one.txt') + call writefile(lines, 'Xtwo/a/two.txt') + let save_efm = &efm + set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f' + + call Xmultidirstack_tests('c') + call Xmultidirstack_tests('l') + + let &efm = save_efm + call delete('Xone', 'rf') + call delete('Xtwo', 'rf') +endfunc + +" Tests for per quickfix/location list file stack +func Xmultifilestack_tests(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + Xexpr "" | Xexpr "" + + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["[one.txt]"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["[two.txt]"]}) + call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["(3,5) one one one"]}) + call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["(5,9) two two two"]}) + + let l1 = g:Xgetlist({'nr':1, 'items':1}) + let l2 = g:Xgetlist({'nr':2, 'items':1}) + call assert_equal('one.txt', bufname(l1.items[1].bufnr)) + call assert_equal(3, l1.items[1].lnum) + call assert_equal('two.txt', bufname(l2.items[1].bufnr)) + call assert_equal(5, l2.items[1].lnum) + + " Test for start of a new error line in the same line where a previous + " error line ends with a file stack. + let efm_val = 'Error\ l%l\ in\ %f,' + let efm_val .= '%-P%>(%f%r,Error\ l%l\ in\ %m,%-Q)%r' + let l = g:Xgetlist({'lines' : [ + \ '(one.txt', + \ 'Error l4 in one.txt', + \ ') (two.txt', + \ 'Error l6 in two.txt', + \ ')', + \ 'Error l8 in one.txt' + \ ], 'efm' : efm_val}) + call assert_equal(3, len(l.items)) + call assert_equal('one.txt', bufname(l.items[0].bufnr)) + call assert_equal(4, l.items[0].lnum) + call assert_equal('one.txt', l.items[0].text) + call assert_equal('two.txt', bufname(l.items[1].bufnr)) + call assert_equal(6, l.items[1].lnum) + call assert_equal('two.txt', l.items[1].text) + call assert_equal('one.txt', bufname(l.items[2].bufnr)) + call assert_equal(8, l.items[2].lnum) + call assert_equal('', l.items[2].text) +endfunc + +func Test_multifilestack() + let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] + call writefile(lines, 'one.txt') + call writefile(lines, 'two.txt') + let save_efm = &efm + set efm=%+P[%f],(%l\\,%c)\ %m,%-Q + + call Xmultifilestack_tests('c') + call Xmultifilestack_tests('l') + + let &efm = save_efm + call delete('one.txt') + call delete('two.txt') +endfunc + +" Tests for per buffer 'efm' setting +func Test_perbuf_efm() + call writefile(["File1-10-Line10"], 'one.txt') + call writefile(["File2#20#Line20"], 'two.txt') + set efm=%f#%l#%m + new | only + new + setlocal efm=%f-%l-%m + cfile one.txt + wincmd w + caddfile two.txt + + let l = getqflist() + call assert_equal(10, l[0].lnum) + call assert_equal('Line20', l[1].text) + + set efm& + new | only + call delete('one.txt') + call delete('two.txt') +endfunc + +" Open multiple help windows using ":lhelpgrep +" This test used to crash Vim +func Test_Multi_LL_Help() + new | only + lhelpgrep window + lopen + e# + lhelpgrep buffer + call assert_equal(3, winnr('$')) + call assert_true(len(getloclist(1)) != 0) + call assert_true(len(getloclist(2)) != 0) + new | only +endfunc + +" Tests for adding new quickfix lists using setqflist() +func XaddQf_tests(cchar) + call s:setup_commands(a:cchar) + + " Create a new list using ' ' for action + call g:Xsetlist([], 'f') + call g:Xsetlist([], ' ', {'title' : 'Test1'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(1, l.nr) + call assert_equal('Test1', l.title) + + " Create a new list using ' ' for action and '$' for 'nr' + call g:Xsetlist([], 'f') + call g:Xsetlist([], ' ', {'title' : 'Test2', 'nr' : '$'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(1, l.nr) + call assert_equal('Test2', l.title) + + " Create a new list using 'a' for action + call g:Xsetlist([], 'f') + call g:Xsetlist([], 'a', {'title' : 'Test3'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(1, l.nr) + call assert_equal('Test3', l.title) + + " Create a new list using 'a' for action and '$' for 'nr' + call g:Xsetlist([], 'f') + call g:Xsetlist([], 'a', {'title' : 'Test3', 'nr' : '$'}) + call g:Xsetlist([], 'a', {'title' : 'Test4'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(1, l.nr) + call assert_equal('Test4', l.title) + + " Adding a quickfix list should remove all the lists following the current + " list. + Xexpr "" | Xexpr "" | Xexpr "" + silent! 10Xolder + call g:Xsetlist([], ' ', {'title' : 'Test5'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(2, l.nr) + call assert_equal('Test5', l.title) + + " Add a quickfix list using '$' as the list number. + let lastqf = g:Xgetlist({'nr':'$'}).nr + silent! 99Xolder + call g:Xsetlist([], ' ', {'nr' : '$', 'title' : 'Test6'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(lastqf + 1, l.nr) + call assert_equal('Test6', l.title) + + " Add a quickfix list using 'nr' set to one more than the quickfix + " list size. + let lastqf = g:Xgetlist({'nr':'$'}).nr + silent! 99Xolder + call g:Xsetlist([], ' ', {'nr' : lastqf + 1, 'title' : 'Test7'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(lastqf + 1, l.nr) + call assert_equal('Test7', l.title) + + " Add a quickfix list to a stack with 10 lists using 'nr' set to '$' + exe repeat('Xexpr "" |', 9) . 'Xexpr ""' + silent! 99Xolder + call g:Xsetlist([], ' ', {'nr' : '$', 'title' : 'Test8'}) + let l = g:Xgetlist({'nr' : '$', 'all' : 1}) + call assert_equal(10, l.nr) + call assert_equal('Test8', l.title) + + " Add a quickfix list using 'nr' set to a value greater than 10 + call assert_equal(-1, g:Xsetlist([], ' ', {'nr' : 12, 'title' : 'Test9'})) + + " Try adding a quickfix list with 'nr' set to a value greater than the + " quickfix list size but less than 10. + call g:Xsetlist([], 'f') + Xexpr "" | Xexpr "" | Xexpr "" + silent! 99Xolder + call assert_equal(-1, g:Xsetlist([], ' ', {'nr' : 8, 'title' : 'Test10'})) + + " Add a quickfix list using 'nr' set to a some string or list + call assert_equal(-1, g:Xsetlist([], ' ', {'nr' : [1,2], 'title' : 'Test11'})) +endfunc + +func Test_add_qf() + call XaddQf_tests('c') + call XaddQf_tests('l') +endfunc + +" Test for getting the quickfix list items from some text without modifying +" the quickfix stack +func XgetListFromLines(cchar) + call s:setup_commands(a:cchar) + call g:Xsetlist([], 'f') + + let l = g:Xgetlist({'lines' : ["File2:20:Line20", "File2:30:Line30"]}).items + call assert_equal(2, len(l)) + call assert_equal(30, l[1].lnum) + + call assert_equal({}, g:Xgetlist({'lines' : 10})) + call assert_equal({}, g:Xgetlist({'lines' : 'File1:10:Line10'})) + call assert_equal([], g:Xgetlist({'lines' : []}).items) + call assert_equal([], g:Xgetlist({'lines' : [10, 20]}).items) + + " Parse text using a custom efm + set efm& + let l = g:Xgetlist({'lines':['File3#30#Line30'], 'efm' : '%f#%l#%m'}).items + call assert_equal('Line30', l[0].text) + let l = g:Xgetlist({'lines':['File3:30:Line30'], 'efm' : '%f-%l-%m'}).items + call assert_equal('File3:30:Line30', l[0].text) + let l = g:Xgetlist({'lines':['File3:30:Line30'], 'efm' : [1,2]}) + call assert_equal({}, l) + call assert_fails("call g:Xgetlist({'lines':['abc'], 'efm':'%2'})", 'E376:') + call assert_fails("call g:Xgetlist({'lines':['abc'], 'efm':''})", 'E378:') + + " Make sure that the quickfix stack is not modified + call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) +endfunc + +func Test_get_list_from_lines() + call XgetListFromLines('c') + call XgetListFromLines('l') +endfunc + +" Tests for the quickfix list id +func Xqfid_tests(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + call assert_equal(0, g:Xgetlist({'id':0}).id) + Xexpr '' + let start_id = g:Xgetlist({'id' : 0}).id + Xexpr '' | Xexpr '' + Xolder + call assert_equal(start_id, g:Xgetlist({'id':0, 'nr':1}).id) + call assert_equal(start_id + 1, g:Xgetlist({'id':0, 'nr':0}).id) + call assert_equal(start_id + 2, g:Xgetlist({'id':0, 'nr':'$'}).id) + call assert_equal(0, g:Xgetlist({'id':0, 'nr':99}).id) + call assert_equal(2, g:Xgetlist({'id':start_id + 1, 'nr':0}).nr) + call assert_equal(0, g:Xgetlist({'id':99, 'nr':0}).id) + call assert_equal(0, g:Xgetlist({'id':"abc", 'nr':0}).id) + + call g:Xsetlist([], 'a', {'id':start_id, 'context':[1,2]}) + call assert_equal([1,2], g:Xgetlist({'nr':1, 'context':1}).context) + call g:Xsetlist([], 'a', {'id':start_id+1, 'lines':['F1:10:L10']}) + call assert_equal('L10', g:Xgetlist({'nr':2, 'items':1}).items[0].text) + call assert_equal(-1, g:Xsetlist([], 'a', {'id':999, 'title':'Vim'})) + call assert_equal(-1, g:Xsetlist([], 'a', {'id':'abc', 'title':'Vim'})) + + let qfid = g:Xgetlist({'id':0, 'nr':0}) + call g:Xsetlist([], 'f') + call assert_equal(0, g:Xgetlist({'id':qfid, 'nr':0}).id) +endfunc + +func Test_qf_id() + call Xqfid_tests('c') + call Xqfid_tests('l') +endfunc + +func Xqfjump_tests(cchar) + call s:setup_commands(a:cchar) + + call writefile(["Line1\tFoo", "Line2"], 'F1') + call writefile(["Line1\tBar", "Line2"], 'F2') + call writefile(["Line1\tBaz", "Line2"], 'F3') + + call g:Xsetlist([], 'f') + + " Tests for + " Jumping to a line using a pattern + " Jumping to a column greater than the last column in a line + " Jumping to a line greater than the last line in the file + let l = [] + for i in range(1, 7) + call add(l, {}) + endfor + let l[0].filename='F1' + let l[0].pattern='Line1' + let l[1].filename='F2' + let l[1].pattern='Line1' + let l[2].filename='F3' + let l[2].pattern='Line1' + let l[3].filename='F3' + let l[3].lnum=1 + let l[3].col=9 + let l[3].vcol=1 + let l[4].filename='F3' + let l[4].lnum=99 + let l[5].filename='F3' + let l[5].lnum=1 + let l[5].col=99 + let l[5].vcol=1 + let l[6].filename='F3' + let l[6].pattern='abcxyz' + + call g:Xsetlist([], ' ', {'items' : l}) + Xopen | only + 2Xnext + call assert_equal(3, g:Xgetlist({'idx' : 0}).idx) + call assert_equal('F3', bufname('%')) + Xnext + call assert_equal(7, col('.')) + Xnext + call assert_equal(2, line('.')) + Xnext + call assert_equal(9, col('.')) + 2 + Xnext + call assert_equal(2, line('.')) + + if a:cchar == 'l' + " When jumping to a location list entry in the location list window and + " no usable windows are available, then a new window should be opened. + enew! | new | only + call g:Xsetlist([], 'f') + setlocal buftype=nofile + new + call g:Xsetlist([], ' ', {'lines' : ['F1:1:1:Line1', 'F1:2:2:Line2', 'F2:1:1:Line1', 'F2:2:2:Line2', 'F3:1:1:Line1', 'F3:2:2:Line2']}) + Xopen + let winid = win_getid() + wincmd p + close + call win_gotoid(winid) + Xnext + call assert_equal(3, winnr('$')) + call assert_equal(1, winnr()) + call assert_equal(2, line('.')) + + " When jumping to an entry in the location list window and the window + " associated with the location list is not present and a window containing + " the file is already present, then that window should be used. + close + belowright new + call g:Xsetlist([], 'f') + edit F3 + call win_gotoid(winid) + Xlast + call assert_equal(3, winnr()) + call assert_equal(6, g:Xgetlist({'size' : 1}).size) + call assert_equal(winid, g:Xgetlist({'winid' : 1}).winid) + endif + + " Cleanup + enew! + new | only + + call delete('F1') + call delete('F2') + call delete('F3') +endfunc + +func Test_qfjump() + call Xqfjump_tests('c') + call Xqfjump_tests('l') +endfunc + +" Tests for the getqflist() and getloclist() functions when the list is not +" present or is empty +func Xgetlist_empty_tests(cchar) + call s:setup_commands(a:cchar) + + " Empty quickfix stack + call g:Xsetlist([], 'f') + call assert_equal('', g:Xgetlist({'context' : 0}).context) + call assert_equal(0, g:Xgetlist({'id' : 0}).id) + call assert_equal(0, g:Xgetlist({'idx' : 0}).idx) + call assert_equal([], g:Xgetlist({'items' : 0}).items) + call assert_equal(0, g:Xgetlist({'nr' : 0}).nr) + call assert_equal(0, g:Xgetlist({'size' : 0}).size) + call assert_equal('', g:Xgetlist({'title' : 0}).title) + call assert_equal(0, g:Xgetlist({'winid' : 0}).winid) + call assert_equal(0, g:Xgetlist({'changedtick' : 0}).changedtick) + call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick': 0}, g:Xgetlist({'all' : 0})) + + " Quickfix window with empty stack + silent! Xopen + let qfwinid = (a:cchar == 'c') ? win_getid() : 0 + call assert_equal(qfwinid, g:Xgetlist({'winid' : 0}).winid) + Xclose + + " Empty quickfix list + Xexpr "" + call assert_equal('', g:Xgetlist({'context' : 0}).context) + call assert_notequal(0, g:Xgetlist({'id' : 0}).id) + call assert_equal(0, g:Xgetlist({'idx' : 0}).idx) + call assert_equal([], g:Xgetlist({'items' : 0}).items) + call assert_notequal(0, g:Xgetlist({'nr' : 0}).nr) + call assert_equal(0, g:Xgetlist({'size' : 0}).size) + call assert_notequal('', g:Xgetlist({'title' : 0}).title) + call assert_equal(0, g:Xgetlist({'winid' : 0}).winid) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + + let qfid = g:Xgetlist({'id' : 0}).id + call g:Xsetlist([], 'f') + + " Non-existing quickfix identifier + call assert_equal('', g:Xgetlist({'id' : qfid, 'context' : 0}).context) + call assert_equal(0, g:Xgetlist({'id' : qfid}).id) + call assert_equal(0, g:Xgetlist({'id' : qfid, 'idx' : 0}).idx) + call assert_equal([], g:Xgetlist({'id' : qfid, 'items' : 0}).items) + call assert_equal(0, g:Xgetlist({'id' : qfid, 'nr' : 0}).nr) + call assert_equal(0, g:Xgetlist({'id' : qfid, 'size' : 0}).size) + call assert_equal('', g:Xgetlist({'id' : qfid, 'title' : 0}).title) + call assert_equal(0, g:Xgetlist({'id' : qfid, 'winid' : 0}).winid) + call assert_equal(0, g:Xgetlist({'id' : qfid, 'changedtick' : 0}).changedtick) + call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'id' : qfid, 'all' : 0})) + + " Non-existing quickfix list number + call assert_equal('', g:Xgetlist({'nr' : 5, 'context' : 0}).context) + call assert_equal(0, g:Xgetlist({'nr' : 5}).nr) + call assert_equal(0, g:Xgetlist({'nr' : 5, 'idx' : 0}).idx) + call assert_equal([], g:Xgetlist({'nr' : 5, 'items' : 0}).items) + call assert_equal(0, g:Xgetlist({'nr' : 5, 'id' : 0}).id) + call assert_equal(0, g:Xgetlist({'nr' : 5, 'size' : 0}).size) + call assert_equal('', g:Xgetlist({'nr' : 5, 'title' : 0}).title) + call assert_equal(0, g:Xgetlist({'nr' : 5, 'winid' : 0}).winid) + call assert_equal(0, g:Xgetlist({'nr' : 5, 'changedtick' : 0}).changedtick) + call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'nr' : 5, 'all' : 0})) +endfunc + +func Test_getqflist() + call Xgetlist_empty_tests('c') + call Xgetlist_empty_tests('l') +endfunc + +func Test_getqflist_invalid_nr() + " The following commands used to crash Vim + cexpr "" + call getqflist({'nr' : $XXX_DOES_NOT_EXIST_XXX}) + + " Cleanup + call setqflist([], 'r') +endfunc + +" Tests for the quickfix/location list changedtick +func Xqftick_tests(cchar) + call s:setup_commands(a:cchar) + + call g:Xsetlist([], 'f') + + Xexpr "F1:10:Line10" + let qfid = g:Xgetlist({'id' : 0}).id + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + Xaddexpr "F2:20:Line20\nF2:21:Line21" + call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([], 'a', {'lines' : ["F3:30:Line30", "F3:31:Line31"]}) + call assert_equal(3, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([], 'r', {'lines' : ["F4:40:Line40"]}) + call assert_equal(4, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([], 'a', {'title' : 'New Title'}) + call assert_equal(5, g:Xgetlist({'changedtick' : 0}).changedtick) + + enew! + call append(0, ["F5:50:L50", "F6:60:L60"]) + Xaddbuffer + call assert_equal(6, g:Xgetlist({'changedtick' : 0}).changedtick) + enew! + + call g:Xsetlist([], 'a', {'context' : {'bus' : 'pci'}}) + call assert_equal(7, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([{'filename' : 'F7', 'lnum' : 10, 'text' : 'L7'}, + \ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], 'a') + call assert_equal(8, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([{'filename' : 'F7', 'lnum' : 10, 'text' : 'L7'}, + \ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], ' ') + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + call g:Xsetlist([{'filename' : 'F7', 'lnum' : 10, 'text' : 'L7'}, + \ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], 'r') + call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) + + call writefile(["F8:80:L80", "F8:81:L81"], "Xone") + Xfile Xone + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + Xaddfile Xone + call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) + + " Test case for updating a non-current quickfix list + call g:Xsetlist([], 'f') + Xexpr "F1:1:L1" + Xexpr "F2:2:L2" + call g:Xsetlist([], 'a', {'nr' : 1, "lines" : ["F10:10:L10"]}) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + call assert_equal(2, g:Xgetlist({'nr' : 1, 'changedtick' : 0}).changedtick) + + call delete("Xone") +endfunc + +func Test_qf_tick() + call Xqftick_tests('c') + call Xqftick_tests('l') +endfunc + +" The following test used to crash Vim. +" Open the location list window and close the regular window associated with +" the location list. When the garbage collection runs now, it incorrectly +" marks the location list context as not in use and frees the context. +func Test_ll_window_ctx() + call setloclist(0, [], 'f') + call setloclist(0, [], 'a', {'context' : []}) + lopen | only + call test_garbagecollect_now() + echo getloclist(0, {'context' : 1}).context + enew | only +endfunc + +" The following test used to crash vim +func Test_lfile_crash() + sp Xtest + au QuickFixCmdPre * bw + call assert_fails('lfile', 'E40') + au! QuickFixCmdPre +endfunc + +" The following test used to crash vim +func Test_lbuffer_crash() + sv Xtest + augroup QF_Test + au! + au * * bw + augroup END + lbuffer + augroup QF_Test + au! + augroup END +endfunc + +" The following test used to crash vim +func Test_lexpr_crash() + augroup QF_Test + au! + au * * call setloclist(0, [], 'f') + augroup END + lexpr "" + augroup QF_Test + au! + augroup END + enew | only +endfunc + +" The following test used to crash Vim +func Test_lvimgrep_crash() + sv Xtest + augroup QF_Test + au! + au * * call setloclist(0, [], 'f') + augroup END + lvimgrep quickfix test_quickfix.vim + augroup QF_Test + au! + augroup END + enew | only +endfunc + +" Test for the position of the quickfix and location list window +func Test_qfwin_pos() + " Open two windows + new | only + new + cexpr ['F1:10:L10'] + copen + " Quickfix window should be the bottom most window + call assert_equal(3, winnr()) + close + " Open at the very top + wincmd t + topleft copen + call assert_equal(1, winnr()) + close + " open left of the current window + wincmd t + below new + leftabove copen + call assert_equal(2, winnr()) + close + " open right of the current window + rightbelow copen + call assert_equal(3, winnr()) + close +endfunc + +" Tests for quickfix/location lists changed by autocommands when +" :vimgrep/:lvimgrep commands are running. +func Test_vimgrep_autocmd() + call setqflist([], 'f') + call writefile(['stars'], 'Xtest1.txt') + call writefile(['stars'], 'Xtest2.txt') + + " Test 1: + " When searching for a pattern using :vimgrep, if the quickfix list is + " changed by an autocmd, the results should be added to the correct quickfix + " list. + autocmd BufRead Xtest2.txt cexpr '' | cexpr '' + silent vimgrep stars Xtest*.txt + call assert_equal(1, getqflist({'nr' : 0}).nr) + call assert_equal(3, getqflist({'nr' : '$'}).nr) + call assert_equal('Xtest2.txt', bufname(getqflist()[1].bufnr)) + au! BufRead Xtest2.txt + + " Test 2: + " When searching for a pattern using :vimgrep, if the quickfix list is + " freed, then a error should be given. + silent! %bwipe! + call setqflist([], 'f') + autocmd BufRead Xtest2.txt for i in range(10) | cexpr '' | endfor + call assert_fails('vimgrep stars Xtest*.txt', 'E925:') + au! BufRead Xtest2.txt + + " Test 3: + " When searching for a pattern using :lvimgrep, if the location list is + " freed, then the command should error out. + silent! %bwipe! + let g:save_winid = win_getid() + autocmd BufRead Xtest2.txt call setloclist(g:save_winid, [], 'f') + call assert_fails('lvimgrep stars Xtest*.txt', 'E926:') + au! BufRead Xtest2.txt + + call delete('Xtest1.txt') + call delete('Xtest2.txt') + call setqflist([], 'f') +endfunc + +" The following test used to crash Vim +func Test_lhelpgrep_autocmd() + lhelpgrep quickfix + autocmd QuickFixCmdPost * call setloclist(0, [], 'f') + lhelpgrep buffer + call assert_equal('help', &filetype) + call assert_equal(0, getloclist(0, {'nr' : '$'}).nr) + lhelpgrep tabpage + call assert_equal('help', &filetype) + call assert_equal(1, getloclist(0, {'nr' : '$'}).nr) + au! QuickFixCmdPost + new | only +endfunc + +" Test for shortening/simplifying the file name when opening the +" quickfix window or when displaying the quickfix list +func Test_shorten_fname() + if !has('unix') + return + endif + %bwipe + " Create a quickfix list with a absolute path filename + let fname = getcwd() . '/test_quickfix.vim' + call setqflist([], ' ', {'lines':[fname . ":20:Line20"], 'efm':'%f:%l:%m'}) + call assert_equal(fname, bufname('test_quickfix.vim')) + " Opening the quickfix window should simplify the file path + cwindow + call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim')) + cclose + %bwipe + " Create a quickfix list with a absolute path filename + call setqflist([], ' ', {'lines':[fname . ":20:Line20"], 'efm':'%f:%l:%m'}) + call assert_equal(fname, bufname('test_quickfix.vim')) + " Displaying the quickfix list should simplify the file path + silent! clist + call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim')) +endfunc + +" Quickfix title tests +" In the below tests, 'exe "cmd"' is used to invoke the quickfix commands. +" Otherwise due to indentation, the title is set with spaces at the beginning +" of the command. +func Test_qftitle() + call writefile(["F1:1:Line1"], 'Xerr') + + " :cexpr + exe "cexpr readfile('Xerr')" + call assert_equal(":cexpr readfile('Xerr')", getqflist({'title' : 1}).title) + + " :cgetexpr + exe "cgetexpr readfile('Xerr')" + call assert_equal(":cgetexpr readfile('Xerr')", + \ getqflist({'title' : 1}).title) + + " :caddexpr + call setqflist([], 'f') + exe "caddexpr readfile('Xerr')" + call assert_equal(":caddexpr readfile('Xerr')", + \ getqflist({'title' : 1}).title) + + " :cbuffer + new Xerr + exe "cbuffer" + call assert_equal(':cbuffer (Xerr)', getqflist({'title' : 1}).title) + + " :cgetbuffer + edit Xerr + exe "cgetbuffer" + call assert_equal(':cgetbuffer (Xerr)', getqflist({'title' : 1}).title) + + " :caddbuffer + call setqflist([], 'f') + edit Xerr + exe "caddbuffer" + call assert_equal(':caddbuffer (Xerr)', getqflist({'title' : 1}).title) + + " :cfile + exe "cfile Xerr" + call assert_equal(':cfile Xerr', getqflist({'title' : 1}).title) + + " :cgetfile + exe "cgetfile Xerr" + call assert_equal(':cgetfile Xerr', getqflist({'title' : 1}).title) + + " :caddfile + call setqflist([], 'f') + exe "caddfile Xerr" + call assert_equal(':caddfile Xerr', getqflist({'title' : 1}).title) + + " :grep + set grepprg=internal + exe "grep F1 Xerr" + call assert_equal(':grep F1 Xerr', getqflist({'title' : 1}).title) + + " :grepadd + call setqflist([], 'f') + exe "grepadd F1 Xerr" + call assert_equal(':grepadd F1 Xerr', getqflist({'title' : 1}).title) + set grepprg&vim + + " :vimgrep + exe "vimgrep F1 Xerr" + call assert_equal(':vimgrep F1 Xerr', getqflist({'title' : 1}).title) + + " :vimgrepadd + call setqflist([], 'f') + exe "vimgrepadd F1 Xerr" + call assert_equal(':vimgrepadd F1 Xerr', getqflist({'title' : 1}).title) + + call setqflist(['F1:10:L10'], ' ') + call assert_equal(':setqflist()', getqflist({'title' : 1}).title) + + call setqflist([], 'f') + call setqflist(['F1:10:L10'], 'a') + call assert_equal(':setqflist()', getqflist({'title' : 1}).title) + + call setqflist([], 'f') + call setqflist(['F1:10:L10'], 'r') + call assert_equal(':setqflist()', getqflist({'title' : 1}).title) + + close + call delete('Xerr') + + call setqflist([], ' ', {'title' : 'Errors'}) + copen + call assert_equal('Errors', w:quickfix_title) + call setqflist([], 'r', {'items' : [{'filename' : 'a.c', 'lnum' : 10}]}) + call assert_equal('Errors', w:quickfix_title) + cclose +endfunc + +func Test_lbuffer_with_bwipe() + new + new + augroup nasty + au * * bwipe + augroup END + lbuffer + augroup nasty + au! + augroup END +endfunc diff --git a/src/testdir/test_quotestar.vim b/src/testdir/test_quotestar.vim new file mode 100644 index 0000000000..ce5a9ee827 --- /dev/null +++ b/src/testdir/test_quotestar.vim @@ -0,0 +1,154 @@ +" *-register (quotestar) tests + +if !has('clipboard') + finish +endif + +source shared.vim + +func Do_test_quotestar_for_macunix() + if empty(exepath('pbcopy')) || empty(exepath('pbpaste')) + return 'Test requires pbcopy(1) and pbpaste(1)' + endif + + let @* = '' + + " Test #1: Pasteboard to Vim + let test_msg = "text from pasteboard to vim via quotestar" + " Write a piece of text to the pasteboard. + call system('/bin/echo -n "' . test_msg . '" | pbcopy') + " See if the *-register is changed as expected. + call assert_equal(test_msg, @*) + + " Test #2: Vim to Pasteboard + let test_msg = "text from vim to pasteboard via quotestar" + " Write a piece of text to the *-register. + let @* = test_msg + " See if the pasteboard is changed as expected. + call assert_equal(test_msg, system('pbpaste')) + + return '' +endfunc + +func Do_test_quotestar_for_x11() + if !has('clientserver') || !has('job') + return 'Test requires the client-server and job features' + endif + + let cmd = GetVimCommand() + if cmd == '' + return 'GetVimCommand() failed' + endif + try + call remote_send('xxx', '') + catch + if v:exception =~ 'E240:' + " No connection to the X server, give up. + return + endif + " ignore other errors + endtry + + let name = 'XVIMCLIPBOARD' + + " Make sure a previous server has exited + try + call remote_send(name, ":qa!\<CR>") + catch /E241:/ + endtry + call WaitForAssert({-> assert_notmatch(name, serverlist())}) + + let cmd .= ' --servername ' . name + let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) + call WaitForAssert({-> assert_equal("run", job_status(job))}) + + " Takes a short while for the server to be active. + call WaitForAssert({-> assert_match(name, serverlist())}) + + " Wait for the server to be up and answering requests. One second is not + " always sufficient. + call WaitForAssert({-> assert_notequal('', remote_expr(name, "v:version", "", 2))}) + + " Clear the *-register of this vim instance and wait for it to be picked up + " by the server. + let @* = 'no' + call remote_foreground(name) + call WaitForAssert({-> assert_equal("no", remote_expr(name, "@*", "", 1))}) + + " Set the * register on the server. + call remote_send(name, ":let @* = 'yes'\<CR>") + call WaitForAssert({-> assert_equal("yes", remote_expr(name, "@*", "", 1))}) + + " Check that the *-register of this vim instance is changed as expected. + call WaitForAssert({-> assert_equal("yes", @*)}) + + " Handle the large selection over 262040 byte. + let length = 262044 + let sample = 'a' . repeat('b', length - 2) . 'c' + let @* = sample + call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)') + let res = remote_expr(name, "@*", "", 2) + call assert_equal(length, len(res)) + " Check length to prevent a large amount of output at assertion failure. + if length == len(res) + call assert_equal(sample, res) + endif + + if has('unix') && has('gui') && !has('gui_running') + let @* = '' + + " Running in a terminal and the GUI is avaiable: Tell the server to open + " the GUI and check that the remote command still works. + " Need to wait for the GUI to start up, otherwise the send hangs in trying + " to send to the terminal window. + if has('gui_athena') || has('gui_motif') + " For those GUIs, ignore the 'failed to create input context' error. + call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>") + else + call remote_send(name, ":gui -f\<CR>") + endif + " Wait for the server in the GUI to be up and answering requests. + call WaitForAssert({-> assert_match("1", remote_expr(name, "has('gui_running')", "", 1))}) + + call remote_send(name, ":let @* = 'maybe'\<CR>") + call WaitForAssert({-> assert_equal("maybe", remote_expr(name, "@*", "", 2))}) + + call assert_equal('maybe', @*) + endif + + call remote_send(name, ":qa!\<CR>") + try + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + finally + if job_status(job) != 'dead' + call assert_report('Server did not exit') + call job_stop(job, 'kill') + endif + endtry + + return '' +endfunc + +func Test_quotestar() + let skipped = '' + + let quotestar_saved = @* + + if has('macunix') + let skipped = Do_test_quotestar_for_macunix() + elseif has('x11') + if empty($DISPLAY) + let skipped = "Test can only run when $DISPLAY is set." + else + let skipped = Do_test_quotestar_for_x11() + endif + else + let skipped = "Test is not implemented yet for this platform." + endif + + let @* = quotestar_saved + + if !empty(skipped) + throw 'Skipped: ' . skipped + endif +endfunc diff --git a/src/testdir/test_recover.vim b/src/testdir/test_recover.vim new file mode 100644 index 0000000000..a9934a1624 --- /dev/null +++ b/src/testdir/test_recover.vim @@ -0,0 +1,62 @@ +" Test :recover + +func Test_recover_root_dir() + " This used to access invalid memory. + split Xtest + set dir=/ + call assert_fails('recover', 'E305:') + close! + + if has('win32') || filewritable('/') == 2 + " can write in / directory on MS-Windows + set dir=/notexist/ + endif + call assert_fails('split Xtest', 'E303:') + set dir& +endfunc + +" Inserts 10000 lines with text to fill the swap file with two levels of pointer +" blocks. Then recovers from the swap file and checks all text is restored. +" +" We need about 10000 lines of 100 characters to get two levels of pointer +" blocks. +func Test_swap_file() + set fileformat=unix undolevels=-1 + edit! Xtest + let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789" + let i = 1 + let linecount = 10000 + while i <= linecount + call append(i - 1, i . text) + let i += 1 + endwhile + $delete + preserve + " get the name of the swap file + let swname = split(execute("swapname"))[0] + let swname = substitute(swname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '') + " make a copy of the swap file in Xswap + set binary + exe 'sp ' . swname + w! Xswap + set nobinary + new + only! + bwipe! Xtest + call rename('Xswap', swname) + recover Xtest + call delete(swname) + let linedollar = line('$') + call assert_equal(linecount, linedollar) + if linedollar < linecount + let linecount = linedollar + endif + let i = 1 + while i <= linecount + call assert_equal(i . text, getline(i)) + let i += 1 + endwhile + + set undolevels& + enew! | only +endfunc diff --git a/src/testdir/test_regex_char_classes.vim b/src/testdir/test_regex_char_classes.vim new file mode 100644 index 0000000000..7873502943 --- /dev/null +++ b/src/testdir/test_regex_char_classes.vim @@ -0,0 +1,298 @@ +" Tests for regexp with backslash and other special characters inside [] +" Also test backslash for hex/octal numbered character. +" +if !has('multi_byte') + finish +endif + +scriptencoding utf-8 + +function RunSTest(value, calls, expected) + new + call feedkeys("i" . a:value, "mx") + exec a:calls + call assert_equal(a:expected, getline(1), printf("wrong result for %s", a:calls)) + quit! +endfunction + +function RunXTest(value, search_exp, expected) + new + call feedkeys("i" . a:value, "mx") + call feedkeys("gg" . a:search_exp . "\nx", "mx") + call assert_equal(a:expected, getline(1), printf("wrong result for %s", a:search_exp)) + quit! +endfunction + + +function Test_x_search() + let res = "test text test text" + call RunXTest("test \\text test text", "/[\\x]", res) + call RunXTest("test \ttext test text", "/[\\t\\]]", res) + call RunXTest("test text ]test text", "/[]y]", res) + call RunXTest("test ]text test text", "/[\\]]", res) + call RunXTest("test text te^st text", "/[y^]", res) + call RunXTest("test te$xt test text", "/[$y]", res) + call RunXTest("test taext test text", "/[\\x61]", res) + call RunXTest("test tbext test text","/[\\x60-\\x64]", res) + call RunXTest("test 5text test text","/[\\x785]", res) + call RunXTest("testc text test text","/[\\o143]", res) + call RunXTest("tesdt text test text","/[\\o140-\\o144]", res) + call RunXTest("test7 text test text", "/[\\o417]", res) + call RunXTest("test text tBest text", "/\\%x42", res) + call RunXTest("test text teCst text", "/\\%o103", res) + call RunXTest("test text \<C-V>x00test text", "/[\\x00]", res) +endfunction + +function Test_s_search() + let res = "test text test text" + call RunSTest("test te\<C-V>x00xt t\<C-V>x04est t\<C-V>x10ext", "s/[\\x00-\\x10]//g", res) + call RunSTest("test \\xyztext test text", "s/[\\x-z]\\+//", res) + call RunSTest("test text tev\\uyst text", "s/[\\u-z]\\{2,}//", res) + call RunSTest("xx aaaaa xx a", "s/\\(a\\)\\+//", "xx xx a") + call RunSTest("xx aaaaa xx a", "s/\\(a*\\)\\+//", "xx aaaaa xx a") + call RunSTest("xx aaaaa xx a", "s/\\(a*\\)*//", "xx aaaaa xx a") + call RunSTest("xx aaaaa xx", "s/\\(a\\)\\{2,3}/A/", "xx Aaa xx") + call RunSTest("xx aaaaa xx", "s/\\(a\\)\\{-2,3}/A/", "xx Aaaa xx") + call RunSTest("xx aaa12aa xx", "s/\\(a\\)*\\(12\\)\\@>/A/", "xx Aaa xx") + call RunSTest("xx foobar xbar xx", "s/\\(foo\\)\\@<!bar/A/", "xx foobar xA xx") + call RunSTest("xx an file xx", "s/\\(an\\_s\\+\\)\\@<=file/A/", "xx an A xx") + call RunSTest("x= 9;", "s/^\\(\\h\\w*\\%(->\\|\\.\\)\\=\\)\\+=/XX/", "XX 9;") + call RunSTest("hh= 77;", "s/^\\(\\h\\w*\\%(->\\|\\.\\)\\=\\)\\+=/YY/", "YY 77;") + call RunSTest(" aaa ", "s/aaa/xyz/", " xyz ") + call RunSTest(" xyz", "s/~/bcd/", " bcd") + call RunSTest(" bcdbcdbcd", "s/~\\+/BB/", " BB") +endfunction + +" Test character classes in regexp using regexpengine 0, 1, 2. +func Test_regex_char_classes() + new + let save_enc = &encoding + set encoding=utf-8 + + let input = "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b" + + " Format is [cmd_to_run, expected_output] + let tests = [ + \ [':s/\%#=0\d//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\d//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\d//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[0-9]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[0-9]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[0-9]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\D//g', + \ "0123456789"], + \ [':s/\%#=1\D//g', + \ "0123456789"], + \ [':s/\%#=2\D//g', + \ "0123456789"], + \ [':s/\%#=0[^0-9]//g', + \ "0123456789"], + \ [':s/\%#=1[^0-9]//g', + \ "0123456789"], + \ [':s/\%#=2[^0-9]//g', + \ "0123456789"], + \ [':s/\%#=0\o//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\o//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\o//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[0-7]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[0-7]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[0-7]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\O//g', + \ "01234567"], + \ [':s/\%#=1\O//g', + \ "01234567"], + \ [':s/\%#=2\O//g', + \ "01234567"], + \ [':s/\%#=0[^0-7]//g', + \ "01234567"], + \ [':s/\%#=1[^0-7]//g', + \ "01234567"], + \ [':s/\%#=2[^0-7]//g', + \ "01234567"], + \ [':s/\%#=0\x//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\x//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\x//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[0-9A-Fa-f]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[0-9A-Fa-f]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[0-9A-Fa-f]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\X//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=1\X//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=2\X//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=0[^0-9A-Fa-f]//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=1[^0-9A-Fa-f]//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=2[^0-9A-Fa-f]//g', + \ "0123456789ABCDEFabcdef"], + \ [':s/\%#=0\w//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\w//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\w//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[0-9A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[0-9A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[0-9A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\W//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=1\W//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=2\W//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=0[^0-9A-Za-z_]//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=1[^0-9A-Za-z_]//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=2[^0-9A-Za-z_]//g', + \ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=0\h//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\h//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\h//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[A-Za-z_]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\H//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=1\H//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=2\H//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=0[^A-Za-z_]//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=1[^A-Za-z_]//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=2[^A-Za-z_]//g', + \ "ABCDEFGHIXYZ_abcdefghiwxyz"], + \ [':s/\%#=0\a//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\a//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\a//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[A-Za-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[A-Za-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[A-Za-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\A//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=1\A//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=2\A//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=0[^A-Za-z]//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=1[^A-Za-z]//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=2[^A-Za-z]//g', + \ "ABCDEFGHIXYZabcdefghiwxyz"], + \ [':s/\%#=0\l//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\l//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\l//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[a-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[a-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[a-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\L//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=1\L//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=2\L//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=0[^a-z]//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=1[^a-z]//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=2[^a-z]//g', + \ "abcdefghiwxyz"], + \ [':s/\%#=0\u//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\u//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\u//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[A-Z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[A-Z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[A-Z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0\U//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=1\U//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=2\U//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=0[^A-Z]//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=1[^A-Z]//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=2[^A-Z]//g', + \ "ABCDEFGHIXYZ"], + \ [':s/\%#=0\%' . line('.') . 'l^\t...//g', + \ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1\%' . line('.') . 'l^\t...//g', + \ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2\%' . line('.') . 'l^\t...//g', + \ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[0-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=1[0-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=2[0-z]//g', + \ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b"], + \ [':s/\%#=0[^0-z]//g', + \ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"], + \ [':s/\%#=1[^0-z]//g', + \ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"], + \ [':s/\%#=2[^0-z]//g', + \ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"] + \] + + for [cmd, expected] in tests + call append(0, input) + call cursor(1, 1) + exe cmd + call assert_equal(expected, getline(1), cmd) + endfor + + let &encoding = save_enc + enew! + close +endfunc diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim new file mode 100644 index 0000000000..a8fa64d2a7 --- /dev/null +++ b/src/testdir/test_regexp_latin.vim @@ -0,0 +1,74 @@ +" Tests for regexp in latin1 encoding +set encoding=latin1 +scriptencoding latin1 + +func s:equivalence_test() + let str = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z" + let groups = split(str) + for group1 in groups + for c in split(group1, '\zs') + " next statement confirms that equivalence class matches every + " character in group + call assert_match('^[[=' . c . '=]]*$', group1) + for group2 in groups + if group2 != group1 + " next statement converts that equivalence class doesn't match + " a character in any other group + call assert_equal(-1, match(group2, '[[=' . c . '=]]')) + endif + endfor + endfor + endfor +endfunc + +func Test_equivalence_re1() + set re=1 + call s:equivalence_test() +endfunc + +func Test_equivalence_re2() + set re=2 + call s:equivalence_test() +endfunc + +func Test_recursive_substitute() + new + s/^/\=execute("s#^##gn") + " check we are now not in the sandbox + call setwinvar(1, 'myvar', 1) + bwipe! +endfunc + +func Test_nested_backrefs() + " Check example in change.txt. + new + for re in range(0, 2) + exe 'set re=' . re + call setline(1, 'aa ab x') + 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/ + call assert_equal('-aa ab - -ab - -x-', getline(1)) + + call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', '')) + endfor + bwipe! + set re=0 +endfunc + +func Test_eow_with_optional() + let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', ''] + for re in range(0, 2) + exe 'set re=' . re + let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)') + call assert_equal(expected, actual) + endfor +endfunc + +func Test_backref() + new + call setline(1, ['one', 'two', 'three', 'four', 'five']) + call assert_equal(3, search('\%#=1\(e\)\1')) + call assert_equal(3, search('\%#=2\(e\)\1')) + call assert_fails('call search("\\%#=1\\(e\\1\\)")', 'E65:') + call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:') + bwipe! +endfunc diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim new file mode 100644 index 0000000000..bec5e0ed4f --- /dev/null +++ b/src/testdir/test_regexp_utf8.vim @@ -0,0 +1,156 @@ +" Tests for regexp in utf8 encoding +if !has('multi_byte') + finish +endif + +func s:equivalence_test() + let str = "AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ" + let groups = split(str) + for group1 in groups + for c in split(group1, '\zs') + " next statement confirms that equivalence class matches every + " character in group + call assert_match('^[[=' . c . '=]]*$', group1) + for group2 in groups + if group2 != group1 + " next statement converts that equivalence class doesn't match + " character in any other group + call assert_equal(-1, match(group2, '[[=' . c . '=]]')) + endif + endfor + endfor + endfor +endfunc + +func Test_equivalence_re1() + set re=1 + call s:equivalence_test() + set re=0 +endfunc + +func Test_equivalence_re2() + set re=2 + call s:equivalence_test() + set re=0 +endfunc + +func s:classes_test() + set isprint=@,161-255 + call assert_equal('Motörhead', matchstr('Motörhead', '[[:print:]]\+')) + + let alnumchars = '' + let alphachars = '' + let backspacechar = '' + let blankchars = '' + let cntrlchars = '' + let digitchars = '' + let escapechar = '' + let graphchars = '' + let lowerchars = '' + let printchars = '' + let punctchars = '' + let returnchar = '' + let spacechars = '' + let tabchar = '' + let upperchars = '' + let xdigitchars = '' + let i = 1 + while i <= 255 + let c = nr2char(i) + if c =~ '[[:alpha:]]' + let alphachars .= c + endif + if c =~ '[[:alnum:]]' + let alnumchars .= c + endif + if c =~ '[[:backspace:]]' + let backspacechar .= c + endif + if c =~ '[[:blank:]]' + let blankchars .= c + endif + if c =~ '[[:cntrl:]]' + let cntrlchars .= c + endif + if c =~ '[[:digit:]]' + let digitchars .= c + endif + if c =~ '[[:escape:]]' + let escapechar .= c + endif + if c =~ '[[:graph:]]' + let graphchars .= c + endif + if c =~ '[[:lower:]]' + let lowerchars .= c + endif + if c =~ '[[:print:]]' + let printchars .= c + endif + if c =~ '[[:punct:]]' + let punctchars .= c + endif + if c =~ '[[:return:]]' + let returnchar .= c + endif + if c =~ '[[:space:]]' + let spacechars .= c + endif + if c =~ '[[:tab:]]' + let tabchar .= c + endif + if c =~ '[[:upper:]]' + let upperchars .= c + endif + if c =~ '[[:xdigit:]]' + let xdigitchars .= c + endif + let i += 1 + endwhile + + call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alphachars) + call assert_equal('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alnumchars) + call assert_equal("\b", backspacechar) + call assert_equal("\t ", blankchars) + call assert_equal("\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\e\x1c\x1d\x1e\x1f\x7f", cntrlchars) + call assert_equal("0123456789", digitchars) + call assert_equal("\<Esc>", escapechar) + call assert_equal('!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', graphchars) + call assert_equal('abcdefghijklmnopqrstuvwxyzµßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', lowerchars) + call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', printchars) + call assert_equal('!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~', punctchars) + call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ', upperchars) + call assert_equal("\r", returnchar) + call assert_equal("\t\n\x0b\f\r ", spacechars) + call assert_equal("\t", tabchar) + call assert_equal('0123456789ABCDEFabcdef', xdigitchars) +endfunc + +func Test_classes_re1() + set re=1 + call s:classes_test() + set re=0 +endfunc + +func Test_classes_re2() + set re=2 + call s:classes_test() + set re=0 +endfunc + +func Test_reversed_range() + for re in range(0, 2) + exe 'set re=' . re + call assert_fails('call match("abc def", "[c-a]")', 'E944:') + endfor + set re=0 +endfunc + +func Test_large_class() + set re=1 + call assert_fails('call match("abc def", "[\u3000-\u4000]")', 'E945:') + set re=2 + call assert_equal(0, 'abc def' =~# '[\u3000-\u4000]') + call assert_equal(1, "\u3042" =~# '[\u3000-\u4000]') + set re=0 +endfunc diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim new file mode 100644 index 0000000000..d7b6de5652 --- /dev/null +++ b/src/testdir/test_registers.vim @@ -0,0 +1,65 @@ + +func Test_yank_shows_register() + enew + set report=0 + call setline(1, ['foo', 'bar']) + " Line-wise + exe 'norm! yy' + call assert_equal('1 line yanked', v:statusmsg) + exe 'norm! "zyy' + call assert_equal('1 line yanked into "z', v:statusmsg) + exe 'norm! yj' + call assert_equal('2 lines yanked', v:statusmsg) + exe 'norm! "zyj' + call assert_equal('2 lines yanked into "z', v:statusmsg) + + " Block-wise + exe "norm! \<C-V>y" + call assert_equal('block of 1 line yanked', v:statusmsg) + exe "norm! \<C-V>\"zy" + call assert_equal('block of 1 line yanked into "z', v:statusmsg) + exe "norm! \<C-V>jy" + call assert_equal('block of 2 lines yanked', v:statusmsg) + exe "norm! \<C-V>j\"zy" + call assert_equal('block of 2 lines yanked into "z', v:statusmsg) + + bwipe! +endfunc + +func Test_display_registers() + e file1 + e file2 + call setline(1, ['foo', 'bar']) + /bar + exe 'norm! y2l"axx' + call feedkeys("i\<C-R>=2*4\n\<esc>") + call feedkeys(":ls\n", 'xt') + + let a = execute('display') + let b = execute('registers') + + call assert_equal(a, b) + call assert_match('^\n--- Registers ---\n' + \ . '"" a\n' + \ . '"0 ba\n' + \ . '"1 b\n' + \ . '"a b\n' + \ . '.*' + \ . '"- a\n' + \ . '.*' + \ . '": ls\n' + \ . '"% file2\n' + \ . '"# file1\n' + \ . '"/ bar\n' + \ . '"= 2\*4', a) + + let a = execute('registers a') + call assert_match('^\n--- Registers ---\n' + \ . '"a b', a) + + let a = execute('registers :') + call assert_match('^\n--- Registers ---\n' + \ . '": ls', a) + + bwipe! +endfunc diff --git a/src/testdir/test_reltime.vim b/src/testdir/test_reltime.vim new file mode 100644 index 0000000000..adabf16c1e --- /dev/null +++ b/src/testdir/test_reltime.vim @@ -0,0 +1,26 @@ +" Tests for reltime() + +if !has('reltime') || !has('float') + finish +endif + +func Test_reltime() + let now = reltime() + sleep 10m + let later = reltime() + let elapsed = reltime(now) + call assert_true(reltimestr(elapsed) =~ '0\.0') + call assert_true(reltimestr(elapsed) != '0.0') + call assert_true(reltimefloat(elapsed) < 0.1) + call assert_true(reltimefloat(elapsed) > 0.0) + + let same = reltime(now, now) + call assert_equal('0.000', split(reltimestr(same))[0][:4]) + call assert_equal(0.0, reltimefloat(same)) + + let differs = reltime(now, later) + call assert_true(reltimestr(differs) =~ '0\.0') + call assert_true(reltimestr(differs) != '0.0') + call assert_true(reltimefloat(differs) < 0.1) + call assert_true(reltimefloat(differs) > 0.0) +endfunc diff --git a/src/testdir/test_retab.vim b/src/testdir/test_retab.vim new file mode 100644 index 0000000000..f11a32bade --- /dev/null +++ b/src/testdir/test_retab.vim @@ -0,0 +1,77 @@ +" Test :retab +func SetUp() + new + call setline(1, "\ta \t b c ") +endfunc + +func TearDown() + bwipe! +endfunc + +func Retab(bang, n) + let l:old_tabstop = &tabstop + let l:old_line = getline(1) + exe "retab" . a:bang . a:n + let l:line = getline(1) + call setline(1, l:old_line) + if a:n > 0 + " :retab changes 'tabstop' to n with argument n > 0. + call assert_equal(a:n, &tabstop) + exe 'set tabstop=' . l:old_tabstop + else + " :retab does not change 'tabstop' with empty or n <= 0. + call assert_equal(l:old_tabstop, &tabstop) + endif + return l:line +endfunc + +func Test_retab() + set tabstop=8 noexpandtab + call assert_equal("\ta\t b c ", Retab('', '')) + call assert_equal("\ta\t b c ", Retab('', 0)) + call assert_equal("\ta\t b c ", Retab('', 8)) + call assert_equal("\ta\t b\t c\t ", Retab('!', '')) + call assert_equal("\ta\t b\t c\t ", Retab('!', 0)) + call assert_equal("\ta\t b\t c\t ", Retab('!', 8)) + + call assert_equal("\t\ta\t\t\tb c ", Retab('', 4)) + call assert_equal("\t\ta\t\t\tb\t\t c\t ", Retab('!', 4)) + + call assert_equal(" a\t\tb c ", Retab('', 10)) + call assert_equal(" a\t\tb c ", Retab('!', 10)) + + set tabstop=8 expandtab + call assert_equal(" a b c ", Retab('', '')) + call assert_equal(" a b c ", Retab('', 0)) + call assert_equal(" a b c ", Retab('', 8)) + call assert_equal(" a b c ", Retab('!', '')) + call assert_equal(" a b c ", Retab('!', 0)) + call assert_equal(" a b c ", Retab('!', 8)) + + call assert_equal(" a b c ", Retab(' ', 4)) + call assert_equal(" a b c ", Retab('!', 4)) + + call assert_equal(" a b c ", Retab(' ', 10)) + call assert_equal(" a b c ", Retab('!', 10)) + + set tabstop=4 noexpandtab + call assert_equal("\ta\t\tb c ", Retab('', '')) + call assert_equal("\ta\t\tb\t\t c\t ", Retab('!', '')) + call assert_equal("\t a\t\t\tb c ", Retab('', 3)) + call assert_equal("\t a\t\t\tb\t\t\tc\t ", Retab('!', 3)) + call assert_equal(" a\t b c ", Retab('', 5)) + call assert_equal(" a\t b\t\t c\t ", Retab('!', 5)) + + set tabstop=4 expandtab + call assert_equal(" a b c ", Retab('', '')) + call assert_equal(" a b c ", Retab('!', '')) + call assert_equal(" a b c ", Retab('', 3)) + call assert_equal(" a b c ", Retab('!', 3)) + call assert_equal(" a b c ", Retab('', 5)) + call assert_equal(" a b c ", Retab('!', 5)) +endfunc + +func Test_retab_error() + call assert_fails('retab -1', 'E487:') + call assert_fails('retab! -1', 'E487:') +endfunc diff --git a/src/testdir/test_ruby.vim b/src/testdir/test_ruby.vim new file mode 100644 index 0000000000..0017f73aef --- /dev/null +++ b/src/testdir/test_ruby.vim @@ -0,0 +1,59 @@ +" Tests for ruby interface + +if !has('ruby') + finish +end + +func Test_ruby_change_buffer() + call setline(line('$'), ['1 line 1']) + ruby Vim.command("normal /^1\n") + ruby $curbuf.line = "1 changed line 1" + call assert_equal('1 changed line 1', getline('$')) +endfunc + +func Test_ruby_evaluate_list() + call setline(line('$'), ['2 line 2']) + ruby Vim.command("normal /^2\n") + let l = ["abc", "def"] + ruby << EOF + curline = $curbuf.line_number + l = Vim.evaluate("l"); + $curbuf.append(curline, l.join("\n")) +EOF + normal j + .rubydo $_ = $_.gsub(/\n/, '/') + call assert_equal('abc/def', getline('$')) +endfunc + +func Test_ruby_evaluate_dict() + let d = {'a': 'foo', 'b': 123} + redir => l:out + ruby d = Vim.evaluate("d"); print d + redir END + call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n")) +endfunc + +func Test_rubydo() + " Check deleting lines does not trigger ml_get error. + new + call setline(1, ['one', 'two', 'three']) + rubydo Vim.command("%d_") + bwipe! + + " Check switching to another buffer does not trigger ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + rubydo Vim.command("new") + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc + +func Test_rubyfile() + " Check :rubyfile does not SEGV with Ruby level exception but just fails + let tempfile = tempname() . '.rb' + call writefile(['raise "vim!"'], tempfile) + call assert_fails('rubyfile ' . tempfile) + call delete(tempfile) +endfunc diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim new file mode 100644 index 0000000000..77920eb8b0 --- /dev/null +++ b/src/testdir/test_scroll_opt.vim @@ -0,0 +1,36 @@ +" Test for reset 'scroll' +" + +func Test_reset_scroll() + let scr = &l:scroll + + setlocal scroll=1 + setlocal scroll& + call assert_equal(scr, &l:scroll) + + setlocal scroll=1 + setlocal scroll=0 + call assert_equal(scr, &l:scroll) + + try + execute 'setlocal scroll=' . (winheight(0) + 1) + " not reached + call assert_false(1) + catch + call assert_exception('E49:') + endtry + + split + + let scr = &l:scroll + + setlocal scroll=1 + setlocal scroll& + call assert_equal(scr, &l:scroll) + + setlocal scroll=1 + setlocal scroll=0 + call assert_equal(scr, &l:scroll) + + quit! +endfunc diff --git a/src/testdir/test_scrollbind.vim b/src/testdir/test_scrollbind.vim new file mode 100644 index 0000000000..baa24f1979 --- /dev/null +++ b/src/testdir/test_scrollbind.vim @@ -0,0 +1,32 @@ +" Test for 'scrollbind' causing an unexpected scroll of one of the windows. +func Test_scrollbind() + " We don't want the status line to cause problems: + set laststatus=0 + let totalLines = &lines * 20 + let middle = totalLines / 2 + new | only + for i in range(1, totalLines) + call setline(i, 'LINE ' . i) + endfor + exe string(middle) + normal zt + normal M + aboveleft vert new + for i in range(1, totalLines) + call setline(i, 'line ' . i) + endfor + exe string(middle) + normal zt + normal M + " Execute the following two commands at once to reproduce the problem. + setl scb | wincmd p + setl scb + wincmd w + let topLineLeft = line('w0') + wincmd p + let topLineRight = line('w0') + setl noscrollbind + wincmd p + setl noscrollbind + call assert_equal(0, topLineLeft - topLineRight) +endfunc diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim new file mode 100644 index 0000000000..c923e9d402 --- /dev/null +++ b/src/testdir/test_search.vim @@ -0,0 +1,773 @@ +" Test for the search command + +source shared.vim +source screendump.vim + +func Test_search_cmdline() + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar']) + " Test 1 + " CTRL-N / CTRL-P skips through the previous search history + set noincsearch + :1 + call feedkeys("/foobar\<cr>", 'tx') + call feedkeys("/the\<cr>",'tx') + call assert_equal('the', @/) + call feedkeys("/thes\<C-P>\<C-P>\<cr>",'tx') + call assert_equal('foobar', @/) + + " Test 2 + " Ctrl-G goes from one match to the next + " until the end of the buffer + set incsearch nowrapscan + :1 + " first match + call feedkeys("/the\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + :1 + " second match + call feedkeys("/the\<C-G>\<cr>", 'tx') + call assert_equal(' 3 the', getline('.')) + call assert_equal([0, 0, 0, 0], getpos('"')) + :1 + " third match + call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx') + call assert_equal(' 4 their', getline('.')) + :1 + " fourth match + call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx') + call assert_equal(' 5 there', getline('.')) + :1 + " fifth match + call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx') + call assert_equal(' 6 their', getline('.')) + :1 + " sixth match + call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx') + call assert_equal(' 7 the', getline('.')) + :1 + " seventh match + call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx') + call assert_equal(' 8 them', getline('.')) + :1 + " eigth match + call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + :1 + " no further match + call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + call assert_equal([0, 0, 0, 0], getpos('"')) + + " Test 3 + " Ctrl-G goes from one match to the next + " and continues back at the top + set incsearch wrapscan + :1 + " first match + call feedkeys("/the\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + :1 + " second match + call feedkeys("/the\<C-G>\<cr>", 'tx') + call assert_equal(' 3 the', getline('.')) + :1 + " third match + call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx') + call assert_equal(' 4 their', getline('.')) + :1 + " fourth match + call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx') + call assert_equal(' 5 there', getline('.')) + :1 + " fifth match + call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx') + call assert_equal(' 6 their', getline('.')) + :1 + " sixth match + call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx') + call assert_equal(' 7 the', getline('.')) + :1 + " seventh match + call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx') + call assert_equal(' 8 them', getline('.')) + :1 + " eigth match + call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + :1 + " back at first match + call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + + " Test 4 + " CTRL-T goes to the previous match + set incsearch nowrapscan + $ + " first match + call feedkeys("?the\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + $ + " first match + call feedkeys("?the\<C-G>\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + $ + " second match + call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx') + call assert_equal(' 8 them', getline('.')) + $ + " last match + call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + $ + " last match + call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + + " Test 5 + " CTRL-T goes to the previous match + set incsearch wrapscan + $ + " first match + call feedkeys("?the\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + $ + " first match at the top + call feedkeys("?the\<C-G>\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + $ + " second match + call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx') + call assert_equal(' 8 them', getline('.')) + $ + " last match + call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + $ + " back at the bottom of the buffer + call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + + " Test 6 + " CTRL-L adds to the search pattern + set incsearch wrapscan + 1 + " first match + call feedkeys("/the\<c-l>\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + 1 + " go to next match of 'thes' + call feedkeys("/the\<c-l>\<C-G>\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + 1 + " wrap around + call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + 1 + " wrap around + set nowrapscan + call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + + " Test 7 + " <bs> remove from match, but stay at current match + set incsearch wrapscan + 1 + " first match + call feedkeys("/thei\<cr>", 'tx') + call assert_equal(' 4 their', getline('.')) + 1 + " delete one char, add another + call feedkeys("/thei\<bs>s\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + 1 + " delete one char, add another, go to previous match, add one char + call feedkeys("/thei\<bs>s\<bs>\<C-T>\<c-l>\<cr>", 'tx') + call assert_equal(' 9 these', getline('.')) + 1 + " delete all chars, start from the beginning again + call feedkeys("/them". repeat("\<bs>",4).'the\>'."\<cr>", 'tx') + call assert_equal(' 3 the', getline('.')) + + " clean up + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline2() + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, [' 1', ' 2 these', ' 3 the theother']) + " Test 1 + " Ctrl-T goes correctly back and forth + set incsearch + 1 + " first match + call feedkeys("/the\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + 1 + " go to next match (on next line) + call feedkeys("/the\<C-G>\<cr>", 'tx') + call assert_equal(' 3 the theother', getline('.')) + 1 + " go to next match (still on line 3) + call feedkeys("/the\<C-G>\<C-G>\<cr>", 'tx') + call assert_equal(' 3 the theother', getline('.')) + 1 + " go to next match (still on line 3) + call feedkeys("/the\<C-G>\<C-G>\<C-G>\<cr>", 'tx') + call assert_equal(' 3 the theother', getline('.')) + 1 + " go to previous match (on line 3) + call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<cr>", 'tx') + call assert_equal(' 3 the theother', getline('.')) + 1 + " go to previous match (on line 3) + call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<cr>", 'tx') + call assert_equal(' 3 the theother', getline('.')) + 1 + " go to previous match (on line 2) + call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx') + call assert_equal(' 2 these', getline('.')) + + " Test 2: keep the view, + " after deleting a character from the search cmd + call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar']) + resize 5 + 1 + call feedkeys("/foo\<bs>\<cr>", 'tx') + redraw + call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview()) + + " remove all history entries + for i in range(10) + call histdel('/') + endfor + + " Test 3: reset the view, + " after deleting all characters from the search cmd + norm! 1gg0 + " unfortunately, neither "/foo\<c-w>\<cr>", nor "/foo\<bs>\<bs>\<bs>\<cr>", + " nor "/foo\<c-u>\<cr>" works to delete the commandline. + " In that case Vim should return "E35 no previous regular expression", + " but it looks like Vim still sees /foo and therefore the test fails. + " Therefore, disableing this test + "call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35') + "call assert_equal({'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, winsaveview()) + + " clean up + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_use_sub_pat() + split + let @/ = '' + func X() + s/^/a/ + / + endfunc + call X() + bwipe! +endfunc + +func Test_searchpair() + new + call setline(1, ['other code here', '', '[', '" cursor here', ']']) + 4 + let a=searchpair('\[','',']','bW') + call assert_equal(3, a) + set nomagic + 4 + let a=searchpair('\[','',']','bW') + call assert_equal(3, a) + set magic + q! +endfunc + +func Test_searchpair_skip() + func Zero() + return 0 + endfunc + func Partial(x) + return a:x + endfunc + new + call setline(1, ['{', 'foo', 'foo', 'foo', '}']) + 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '')) + 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0')) + 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 0})) + 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Zero'))) + 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Partial', [0]))) + " invalid argument + 3 | call assert_equal(0, searchpair('{', '', '}', 'bWn', 0)) + bw! +endfunc + +func Test_searchc() + " These commands used to cause memory overflow in searchc(). + new + norm ixx + exe "norm 0t\u93cf" + bw! +endfunc + +func Test_search_cmdline3() + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, [' 1', ' 2 the~e', ' 3 the theother']) + set incsearch + 1 + " first match + call feedkeys("/the\<c-l>\<cr>", 'tx') + call assert_equal(' 2 the~e', getline('.')) + " clean up + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline4() + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) + set incsearch + $ + call feedkeys("?the\<c-g>\<cr>", 'tx') + call assert_equal(' 3 the third', getline('.')) + $ + call feedkeys("?the\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal(' 1 the first', getline('.')) + $ + call feedkeys("?the\<c-g>\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal(' 2 the second', getline('.')) + $ + call feedkeys("?the\<c-t>\<cr>", 'tx') + call assert_equal(' 1 the first', getline('.')) + $ + call feedkeys("?the\<c-t>\<c-t>\<cr>", 'tx') + call assert_equal(' 3 the third', getline('.')) + $ + call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx') + call assert_equal(' 2 the second', getline('.')) + " clean up + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline5() + if !exists('+incsearch') + return + endif + " Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work + " regardless char_avail. + new + call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) + set incsearch + 1 + call feedkeys("/the\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal(' 3 the third', getline('.')) + $ + call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx') + call assert_equal(' 2 the second', getline('.')) + " clean up + set noincsearch + bw! +endfunc + +func Test_search_cmdline6() + " Test that consecutive matches + " are caught by <c-g>/<c-t> + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, [' bbvimb', '']) + set incsearch + " first match + norm! gg0 + call feedkeys("/b\<cr>", 'tx') + call assert_equal([0,1,2,0], getpos('.')) + " second match + norm! gg0 + call feedkeys("/b\<c-g>\<cr>", 'tx') + call assert_equal([0,1,3,0], getpos('.')) + " third match + norm! gg0 + call feedkeys("/b\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal([0,1,7,0], getpos('.')) + " first match again + norm! gg0 + call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal([0,1,2,0], getpos('.')) + set nowrapscan + " last match + norm! gg0 + call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx') + call assert_equal([0,1,7,0], getpos('.')) + " clean up + set wrapscan&vim + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline7() + " Test that an pressing <c-g> in an empty command line + " does not move the cursor + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + let @/='b' + call setline(1, [' bbvimb', '']) + set incsearch + " first match + norm! gg0 + " moves to next match of previous search pattern, just like /<cr> + call feedkeys("/\<c-g>\<cr>", 'tx') + call assert_equal([0,1,2,0], getpos('.')) + " moves to next match of previous search pattern, just like /<cr> + call feedkeys("/\<cr>", 'tx') + call assert_equal([0,1,3,0], getpos('.')) + " moves to next match of previous search pattern, just like /<cr> + call feedkeys("/\<c-t>\<cr>", 'tx') + call assert_equal([0,1,7,0], getpos('.')) + + " using an offset uses the last search pattern + call cursor(1, 1) + call setline(1, ['1 bbvimb', ' 2 bbvimb']) + let @/ = 'b' + call feedkeys("//e\<c-g>\<cr>", 'tx') + call assert_equal('1 bbvimb', getline('.')) + call assert_equal(4, col('.')) + + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline8() + " Highlighting is cleared in all windows + " since hls applies to all windows + if !exists('+incsearch') || !has('terminal') || has('gui_running') || winwidth(0) < 30 + return + endif + if has("win32") + throw "Skipped: Bug with sending <ESC> to terminal window not fixed yet" + endif + let h = winheight(0) + if h < 3 + return + endif + " Prepare buffer text + let lines = ['abb vim vim vi', 'vimvivim'] + call writefile(lines, 'Xsearch.txt') + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) + + call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) + + call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") + call term_sendkeys(buf, ":14vsp\<cr>") + call term_sendkeys(buf, "/vim\<cr>") + call term_sendkeys(buf, "/b\<esc>") + call term_sendkeys(buf, "gg0") + call term_wait(buf, 500) + let screen_line = term_scrape(buf, 1) + let [a0,a1,a2,a3] = [screen_line[3].attr, screen_line[4].attr, + \ screen_line[18].attr, screen_line[19].attr] + call assert_notequal(a0, a1) + call assert_notequal(a0, a3) + call assert_notequal(a1, a2) + call assert_equal(a0, a2) + call assert_equal(a1, a3) + " clean up + call delete('Xsearch.txt') + + bwipe! +endfunc + +" Tests for regexp with various magic settings +func Test_search_regexp() + enew! + + put ='1 a aa abb abbccc' + exe 'normal! /a*b\{2}c\+/e' . "\<CR>" + call assert_equal([0, 2, 17, 0], getpos('.')) + + put ='2 d dd dee deefff' + exe 'normal! /\Md\*e\{2}f\+/e' . "\<CR>" + call assert_equal([0, 3, 17, 0], getpos('.')) + + set nomagic + put ='3 g gg ghh ghhiii' + exe 'normal! /g\*h\{2}i\+/e' . "\<CR>" + call assert_equal([0, 4, 17, 0], getpos('.')) + + put ='4 j jj jkk jkklll' + exe 'normal! /\mj*k\{2}l\+/e' . "\<CR>" + call assert_equal([0, 5, 17, 0], getpos('.')) + + put ='5 m mm mnn mnnooo' + exe 'normal! /\vm*n{2}o+/e' . "\<CR>" + call assert_equal([0, 6, 17, 0], getpos('.')) + + put ='6 x ^aa$ x' + exe 'normal! /\V^aa$' . "\<CR>" + call assert_equal([0, 7, 5, 0], getpos('.')) + + set magic + put ='7 (a)(b) abbaa' + exe 'normal! /\v(a)(b)\2\1\1/e' . "\<CR>" + call assert_equal([0, 8, 14, 0], getpos('.')) + + put ='8 axx [ab]xx' + exe 'normal! /\V[ab]\(\[xy]\)\1' . "\<CR>" + call assert_equal([0, 9, 7, 0], getpos('.')) + + set undolevels=100 + put ='9 foobar' + put ='' + exe "normal! a\<C-G>u\<Esc>" + normal G + exe 'normal! dv?bar?' . "\<CR>" + call assert_equal('9 foo', getline('.')) + call assert_equal([0, 10, 5, 0], getpos('.')) + call assert_equal(10, line('$')) + normal u + call assert_equal('9 foobar', getline('.')) + call assert_equal([0, 10, 6, 0], getpos('.')) + call assert_equal(11, line('$')) + + set undolevels& + enew! +endfunc + +func Test_search_cmdline_incsearch_highlight() + if !exists('+incsearch') + return + endif + set incsearch hlsearch + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + call setline(1, ['aaa 1 the first', ' 2 the second', ' 3 the third']) + + 1 + call feedkeys("/second\<cr>", 'tx') + call assert_equal('second', @/) + call assert_equal(' 2 the second', getline('.')) + + " Canceling search won't change @/ + 1 + let @/ = 'last pattern' + call feedkeys("/third\<C-c>", 'tx') + call assert_equal('last pattern', @/) + call feedkeys("/third\<Esc>", 'tx') + call assert_equal('last pattern', @/) + call feedkeys("/3\<bs>\<bs>", 'tx') + call assert_equal('last pattern', @/) + call feedkeys("/third\<c-g>\<c-t>\<Esc>", 'tx') + call assert_equal('last pattern', @/) + + " clean up + set noincsearch nohlsearch + bw! +endfunc + +func Test_search_cmdline_incsearch_highlight_attr() + if !exists('+incsearch') || !has('terminal') || has('gui_running') + return + endif + let h = winheight(0) + if h < 3 + return + endif + + " Prepare buffer text + let lines = ['abb vim vim vi', 'vimvivim'] + call writefile(lines, 'Xsearch.txt') + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) + + call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) + " wait for vim to complete initialization + call term_wait(buf) + + " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight + call term_sendkeys(buf, ":set incsearch hlsearch\<cr>") + call term_sendkeys(buf, '/b') + call term_wait(buf, 200) + let screen_line1 = term_scrape(buf, 1) + call assert_true(len(screen_line1) > 2) + " a0: attr_normal + let a0 = screen_line1[0].attr + " a1: attr_incsearch + let a1 = screen_line1[1].attr + " a2: attr_hlsearch + let a2 = screen_line1[2].attr + call assert_notequal(a0, a1) + call assert_notequal(a0, a2) + call assert_notequal(a1, a2) + call term_sendkeys(buf, "\<cr>gg0") + + " Test incremental highlight search + call term_sendkeys(buf, "/vim") + call term_wait(buf, 200) + " Buffer: + " abb vim vim vi + " vimvivim + " Search: /vim + let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a2,a2,a2,a0,a0,a0] + let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] + call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) + call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) + + " Test <C-g> + call term_sendkeys(buf, "\<C-g>\<C-g>") + call term_wait(buf, 200) + let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] + let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2] + call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) + call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) + + " Test <C-t> + call term_sendkeys(buf, "\<C-t>") + call term_wait(buf, 200) + let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0] + let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] + call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) + call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) + + " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight) + call term_sendkeys(buf, "\<cr>") + call term_wait(buf, 200) + let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0] + let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2] + call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) + call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) + + " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight) + call term_sendkeys(buf, ":1\<cr>") + call term_sendkeys(buf, ":set nohlsearch\<cr>") + call term_sendkeys(buf, "/vim") + call term_wait(buf, 200) + let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0] + let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] + call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) + call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) + call delete('Xsearch.txt') + + call delete('Xsearch.txt') + bwipe! +endfunc + +func Test_incsearch_scrolling() + if !CanRunVimInTerminal() + return + endif + call assert_equal(0, &scrolloff) + call writefile([ + \ 'let dots = repeat(".", 120)', + \ 'set incsearch cmdheight=2 scrolloff=0', + \ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])', + \ 'normal gg', + \ 'redraw', + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70}) + " Need to send one key at a time to force a redraw + call term_sendkeys(buf, '/') + sleep 100m + call term_sendkeys(buf, 't') + sleep 100m + call term_sendkeys(buf, 'a') + sleep 100m + call term_sendkeys(buf, 'r') + sleep 100m + call term_sendkeys(buf, 'g') + call VerifyScreenDump(buf, 'Test_incsearch_scrolling_01', {}) + + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('Xscript') +endfunc + +func Test_search_undefined_behaviour() + if !has("terminal") + return + endif + let h = winheight(0) + if h < 3 + return + endif + " did cause an undefined left shift + let g:buf = term_start([GetVimProg(), '--clean', '-e', '-s', '-c', 'call search(getline("."))', 'samples/test000'], {'term_rows': 3}) + call assert_equal([''], getline(1, '$')) + call term_sendkeys(g:buf, ":qa!\<cr>") + bwipe! +endfunc + +func Test_search_undefined_behaviour2() + call search("\%UC0000000") +endfunc + +" Test for search('multi-byte char', 'bce') +func Test_search_multibyte() + if !has('multi_byte') + return + endif + let save_enc = &encoding + set encoding=utf8 + enew! + call append('$', 'A') + call cursor(2, 1) + call assert_equal(2, search('A', 'bce', line('.'))) + enew! + let &encoding = save_enc +endfunc + +" This was causing E874. Also causes an invalid read? +func Test_look_behind() + new + call setline(1, '0\|\&\n\@<=') + call search(getline(".")) + bwipe! +endfunc + +func Test_search_sentence() + new + " this used to cause a crash + call assert_fails("/\\%')", 'E486') + call assert_fails("/", 'E486') + /\%'( + / +endfunc diff --git a/src/testdir/test_searchpos.vim b/src/testdir/test_searchpos.vim new file mode 100644 index 0000000000..8dffddc094 --- /dev/null +++ b/src/testdir/test_searchpos.vim @@ -0,0 +1,28 @@ +" Tests for searchpos() + +func Test_searchpos() + new one + 0put ='1a3' + 1put ='123xyz' + call cursor(1, 1) + call assert_equal([1, 1, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + call cursor(1, 2) + call assert_equal([2, 1, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + set cpo-=c + call cursor(1, 2) + call assert_equal([1, 2, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + call cursor(1, 3) + call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + + " Now with \zs, first match is in column 0, "a" is matched. + call cursor(1, 3) + call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW')) + " With z flag start at cursor column, don't see the "a". + call cursor(1, 3) + call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz')) + + set cpo+=c + " close the window + q! + +endfunc diff --git a/src/testdir/test_set.vim b/src/testdir/test_set.vim new file mode 100644 index 0000000000..b98046384b --- /dev/null +++ b/src/testdir/test_set.vim @@ -0,0 +1,27 @@ +" Tests for the :set command + +function Test_set_backslash() + let isk_save = &isk + + set isk=a,b,c + set isk+=d + call assert_equal('a,b,c,d', &isk) + set isk+=\\,e + call assert_equal('a,b,c,d,\,e', &isk) + set isk-=e + call assert_equal('a,b,c,d,\', &isk) + set isk-=\\ + call assert_equal('a,b,c,d', &isk) + + let &isk = isk_save +endfunction + +function Test_set_add() + let wig_save = &wig + + set wildignore=*.png, + set wildignore+=*.jpg + call assert_equal('*.png,*.jpg', &wig) + + let &wig = wig_save +endfunction diff --git a/src/testdir/test_sha256.vim b/src/testdir/test_sha256.vim new file mode 100644 index 0000000000..dd4707977e --- /dev/null +++ b/src/testdir/test_sha256.vim @@ -0,0 +1,22 @@ +" Tests for the sha256() function. + +if !has('cryptv') || !exists('*sha256') + finish +endif + +function Test_sha256() + " test for empty string: + call assert_equal(sha256(""), 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') + + "'test for 1 char: + call assert_equal(sha256("a"), 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb') + " + "test for 3 chars: + call assert_equal(sha256("abc"), 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad') + + " test for contains meta char: + call assert_equal(sha256("foo\nbar"), '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776') + + " test for contains non-ascii char: + call assert_equal(sha256("\xde\xad\xbe\xef"), '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953') +endfunction diff --git a/src/testdir/test_short_sleep.py b/src/testdir/test_short_sleep.py new file mode 100644 index 0000000000..a290443ba4 --- /dev/null +++ b/src/testdir/test_short_sleep.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +# +# Program that sleeps for 100 msec +# +# This requires Python 2.6 or later. + +import time + +if __name__ == "__main__": + + time.sleep(0.1) # sleep 100 msec diff --git a/src/testdir/test_shortpathname.vim b/src/testdir/test_shortpathname.vim new file mode 100644 index 0000000000..f151788ced --- /dev/null +++ b/src/testdir/test_shortpathname.vim @@ -0,0 +1,70 @@ +" Test for shortpathname ':8' extension. +" Only for use on Win32 systems! + +if !has('win32') + finish +endif + +func TestIt(file, bits, expected) + let res = fnamemodify(a:file, a:bits) + if a:expected != '' + call assert_equal(substitute(a:expected, '/', '\\', 'g'), + \ substitute(res, '/', '\\', 'g'), + \ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'") + endif +endfunc + +func Test_ColonEight() + let save_dir = getcwd() + + " This could change for CygWin to //cygdrive/c + let dir1 = 'c:/x.x.y' + if filereadable(dir1) || isdirectory(dir1) + call assert_report("Fatal: '" . dir1 . "' exists, cannot run test") + return + endif + + let file1 = dir1 . '/zz.y.txt' + let nofile1 = dir1 . '/z.y.txt' + let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread' + let file2 = dir2 . '/z.txt' + let nofile2 = dir2 . '/zz.txt' + + call mkdir(dir1) + let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '/$', '', '') + call assert_match('\V\^c:/XX\x\x\x\x~1.Y\$', resdir1) + + let resfile1 = resdir1 . '/ZZY~1.TXT' + let resnofile1 = resdir1 . '/z.y.txt' + let resdir2 = resdir1 . '/VIMIST~1' + let resfile2 = resdir2 . '/z.txt' + let resnofile2 = resdir2 . '/zz.txt' + + call mkdir(dir2) + call writefile([], file1) + call writefile([], file2) + + call TestIt(file1, ':p:8', resfile1) + call TestIt(nofile1, ':p:8', resnofile1) + call TestIt(file2, ':p:8', resfile2) + call TestIt(nofile2, ':p:8', resnofile2) + call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2, ':h')) + exe 'cd ' . dir1 + call TestIt(file1, ':.:8', strpart(resfile1, strlen(resdir1)+1)) + call TestIt(nofile1, ':.:8', strpart(resnofile1, strlen(resdir1)+1)) + call TestIt(file2, ':.:8', strpart(resfile2, strlen(resdir1)+1)) + call TestIt(nofile2, ':.:8', strpart(resnofile2, strlen(resdir1)+1)) + let $HOME=dir1 + call TestIt(file1, ':~:8', '~' . strpart(resfile1, strlen(resdir1))) + call TestIt(nofile1, ':~:8', '~' . strpart(resnofile1, strlen(resdir1))) + call TestIt(file2, ':~:8', '~' . strpart(resfile2, strlen(resdir1))) + call TestIt(nofile2, ':~:8', '~' . strpart(resnofile2, strlen(resdir1))) + + cd c:/ + call delete(file2) + call delete(file1) + call delete(dir2, 'd') + call delete(dir1, 'd') + + exe "cd " . save_dir +endfunc diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim new file mode 100644 index 0000000000..a967435346 --- /dev/null +++ b/src/testdir/test_signs.vim @@ -0,0 +1,199 @@ +" Test for signs + +if !has('signs') + finish +endif + +func Test_sign() + new + call setline(1, ['a', 'b', 'c', 'd']) + + " Define some signs. + " We can specify icons even if not all versions of vim support icons as + " icon is ignored when not supported. "(not supported)" is shown after + " the icon name when listing signs. + sign define Sign1 text=x + try + sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png + catch /E255:/ + " ignore error: E255: Couldn't read in sign data! + " This error can happen when running in gui. + " Some gui like Motif do not support the png icon format. + endtry + + " Test listing signs. + let a=execute('sign list') + call assert_match("^\nsign Sign1 text=x \nsign Sign2 icon=../../pixmaps/stock_vim_find_help.png .*text=xy linehl=Error texthl=Title$", a) + + let a=execute('sign list Sign1') + call assert_equal("\nsign Sign1 text=x ", a) + + " Split the window to the bottom to verify sign jump will stay in the current window + " if the buffer is displayed there. + let bn = bufnr('%') + let wn = winnr() + exe 'sign place 41 line=3 name=Sign1 buffer=' . bn + 1 + bot split + exe 'sign jump 41 buffer=' . bufnr('%') + call assert_equal('c', getline('.')) + call assert_equal(3, winnr()) + call assert_equal(bn, bufnr('%')) + call assert_notequal(wn, winnr()) + + " Create a new buffer and check that ":sign jump" switches to the old buffer. + 1 + new foo + call assert_notequal(bn, bufnr('%')) + exe 'sign jump 41 buffer=' . bn + call assert_equal(bn, bufnr('%')) + call assert_equal('c', getline('.')) + + " Redraw to make sure that screen redraw with sign gets exercised, + " with and without 'rightleft'. + if has('rightleft') + set rightleft + redraw + set norightleft + endif + redraw + + " Check that we can't change sign. + call assert_fails("exe 'sign place 40 name=Sign1 buffer=' . bufnr('%')", 'E885:') + + " Check placed signs + let a=execute('sign place') + call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=41 name=Sign1\n", a) + + " Unplace the sign and try jumping to it again should fail. + sign unplace 41 + 1 + call assert_fails("exe 'sign jump 41 buffer=' . bufnr('%')", 'E157:') + call assert_equal('a', getline('.')) + + " Unplace sign on current line. + exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%') + 4 + sign unplace + let a=execute('sign place') + call assert_equal("\n--- Signs ---\n", a) + + " Try again to unplace sign on current line, it should fail this time. + call assert_fails('sign unplace', 'E159:') + + " Unplace all signs. + exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%') + sign unplace * + let a=execute('sign place') + call assert_equal("\n--- Signs ---\n", a) + + " Check :jump with file=... + edit foo + call setline(1, ['A', 'B', 'C', 'D']) + + try + sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm + catch /E255:/ + " ignore error: E255: it can happens for guis. + endtry + + let fn = expand('%:p') + exe 'sign place 43 line=2 name=Sign3 file=' . fn + edit bar + call assert_notequal(fn, expand('%:p')) + exe 'sign jump 43 file=' . fn + call assert_equal('B', getline('.')) + + " After undefining the sign, we should no longer be able to place it. + sign undefine Sign1 + sign undefine Sign2 + sign undefine Sign3 + call assert_fails("exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')", 'E155:') +endfunc + +" Undefining placed sign is not recommended. +" Quoting :help sign +" +" :sign undefine {name} +" Deletes a previously defined sign. If signs with this {name} +" are still placed this will cause trouble. +func Test_sign_undefine_still_placed() + new foobar + sign define Sign text=x + exe 'sign place 41 line=1 name=Sign buffer=' . bufnr('%') + sign undefine Sign + + " Listing placed sign should show that sign is deleted. + let a=execute('sign place') + call assert_equal("\n--- Signs ---\nSigns for foobar:\n line=1 id=41 name=[Deleted]\n", a) + + sign unplace 41 + let a=execute('sign place') + call assert_equal("\n--- Signs ---\n", a) +endfunc + +func Test_sign_completion() + sign define Sign1 text=x + sign define Sign2 text=y + + call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign define jump list place undefine unplace', @:) + + call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:) + + call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:) + + call writefile(['foo'], 'XsignOne') + call writefile(['bar'], 'XsignTwo') + call feedkeys(":sign define Sign icon=Xsig\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign define Sign icon=XsignOne XsignTwo', @:) + call delete('XsignOne') + call delete('XsignTwo') + + call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign undefine Sign1 Sign2', @:) + + call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign place 1 buffer= file= line= name=', @:) + + call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign place 1 name=Sign1 Sign2', @:) + + call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign unplace 1 buffer= file=', @:) + + call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign list Sign1 Sign2', @:) + + call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"sign jump 1 buffer= file=', @:) + + sign undefine Sign1 + sign undefine Sign2 +endfunc + +func Test_sign_invalid_commands() + call assert_fails('sign', 'E471:') + call assert_fails('sign jump', 'E471:') + call assert_fails('sign xxx', 'E160:') + call assert_fails('sign define', 'E156:') + call assert_fails('sign define Sign1 xxx', 'E475:') + call assert_fails('sign undefine', 'E156:') + call assert_fails('sign list xxx', 'E155:') + call assert_fails('sign place 1 buffer=999', 'E158:') + call assert_fails('sign define Sign2 text=', 'E239:') +endfunc + +func Test_sign_delete_buffer() + new + sign define Sign text=x + let bufnr = bufnr('%') + new + exe 'bd ' . bufnr + exe 'sign place 61 line=3 name=Sign buffer=' . bufnr + call assert_fails('sign jump 61 buffer=' . bufnr, 'E934:') + sign unplace 61 + sign undefine Sign +endfunc diff --git a/src/testdir/test_smartindent.vim b/src/testdir/test_smartindent.vim new file mode 100644 index 0000000000..9e93a55eb0 --- /dev/null +++ b/src/testdir/test_smartindent.vim @@ -0,0 +1,41 @@ +" Tests for smartindent + +" Tests for not doing smart indenting when it isn't set. +function! Test_nosmartindent() + new + call append(0, [" some test text", + \ " test text", + \ "test text", + \ " test text"]) + set nocindent nosmartindent autoindent + exe "normal! gg/some\<CR>" + exe "normal! 2cc#test\<Esc>" + call assert_equal(" #test", getline(1)) + enew! | close +endfunction + +function MyIndent() +endfunction + +" When 'indentexpr' is set, setting 'si' has no effect. +function Test_smartindent_has_no_effect() + new + exe "normal! i\<Tab>one\<Esc>" + set noautoindent + set smartindent + set indentexpr= + exe "normal! Gotwo\<Esc>" + call assert_equal("\ttwo", getline("$")) + + set indentexpr=MyIndent + exe "normal! Gothree\<Esc>" + call assert_equal("three", getline("$")) + + delfunction! MyIndent + set autoindent& + set smartindent& + set indentexpr& + bwipe! +endfunction + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim new file mode 100644 index 0000000000..4fddb47b58 --- /dev/null +++ b/src/testdir/test_sort.vim @@ -0,0 +1,1184 @@ +" Test sort() + +:func Compare1(a, b) abort + call sort(range(3), 'Compare2') + return a:a - a:b +:endfunc + +:func Compare2(a, b) abort + return a:a - a:b +:endfunc + +func Test_sort_strings() + " numbers compared as strings + call assert_equal([1, 2, 3], sort([3, 2, 1])) + call assert_equal([13, 28, 3], sort([3, 28, 13])) +endfunc + +func Test_sort_numeric() + call assert_equal([1, 2, 3], sort([3, 2, 1], 'n')) + call assert_equal([3, 13, 28], sort([13, 28, 3], 'n')) + " strings are not sorted + call assert_equal(['13', '28', '3'], sort(['13', '28', '3'], 'n')) +endfunc + +func Test_sort_numbers() + call assert_equal([3, 13, 28], sort([13, 28, 3], 'N')) + call assert_equal(['3', '13', '28'], sort(['13', '28', '3'], 'N')) +endfunc + +func Test_sort_float() + call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f')) +endfunc + +func Test_sort_nested() + " test ability to call sort() from a compare function + call assert_equal([1, 3, 5], sort([3, 1, 5], 'Compare1')) +endfunc + +func Test_sort_default() + " docs say omitted, empty or zero argument sorts on string representation. + call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"])) + call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], '')) + call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 0)) + call assert_equal(['2', 'A', 'a', 'AA', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 1)) + call assert_fails('call sort([3.3, 1, "2"], 3)', "E474") +endfunc + +" Tests for the :sort command +func Test_sort_cmd() + let tests = [ + \ { + \ 'name' : 'Alphabetical sort', + \ 'cmd' : '%sort', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ ' 123b', + \ 'a', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'ab', + \ 'abc', + \ 'b123', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Numeric sort', + \ 'cmd' : '%sort n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ 'x-22', + \ 'b321', + \ 'b123', + \ '', + \ 'c123d', + \ '-24', + \ ' 123b', + \ 'c321d', + \ '0', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '-24', + \ 'x-22', + \ '0', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'Hexadecimal sort', + \ 'cmd' : '%sort x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'a', + \ 'ab', + \ 'abc', + \ ' 123b', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'b123', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Alphabetical unique sort', + \ 'cmd' : '%sort u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ ' 123b', + \ 'a', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'ab', + \ 'abc', + \ 'b123', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Alphabetical reverse sort', + \ 'cmd' : '%sort!', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b321', + \ 'b123', + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ ' 123b', + \ ] + \ }, + \ { + \ 'name' : 'Numeric reverse sort', + \ 'cmd' : '%sort! n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'a321', + \ ' 123b', + \ 'c123d', + \ 'b123', + \ 'a123', + \ 'a122', + \ 'a', + \ 'ab', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'Unique reverse sort', + \ 'cmd' : 'sort! u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b123', + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ ' 123b', + \ ] + \ }, + \ { + \ 'name' : 'Octal sort', + \ 'cmd' : 'sort o', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'Reverse hexadecimal sort', + \ 'cmd' : 'sort! x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b321', + \ 'b123', + \ 'a321', + \ 'a123', + \ 'a122', + \ ' 123b', + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '' + \ ] + \ }, + \ { + \ 'name' : 'Alpha (skip first character) sort', + \ 'cmd' : 'sort/./', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'b322b', + \ 'ab', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'Alpha (skip first 2 characters) sort', + \ 'cmd' : 'sort/../', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'alpha, unique, skip first 2 characters', + \ 'cmd' : 'sort/../u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'ab', + \ 'a', + \ '', + \ 'a321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip first character', + \ 'cmd' : 'sort/./n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first character', + \ 'cmd' : 'sort/./r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ ' 123b', + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first 2 characters', + \ 'cmd' : 'sort/../r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'a', + \ '', + \ '', + \ ' 123b', + \ 'a123', + \ 'a122', + \ 'a321', + \ 'abc', + \ 'ab', + \ 'b123', + \ 'b321', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first character', + \ 'cmd' : 'sort/./rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ] + \ }, + \ { + \ 'name' : 'alpha, skip past first digit', + \ 'cmd' : 'sort/\d/', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first digit', + \ 'cmd' : 'sort/\d/r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip past first digit', + \ 'cmd' : 'sort/\d/n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first digit', + \ 'cmd' : 'sort/\d/rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'alpha, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b' + \ ] + \ }, + \ { + \ 'name' : 'hexadecimal, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'b321b', + \ 'c321d', + \ 'b322b', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'hexadecimal, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/rx', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'binary', + \ 'cmd' : 'sort b', + \ 'input' : [ + \ '0b111000', + \ '0b101100', + \ '0b101001', + \ '0b101001', + \ '0b101000', + \ '0b000000', + \ '0b001000', + \ '0b010000', + \ '0b101000', + \ '0b100000', + \ '0b101010', + \ '0b100010', + \ '0b100100', + \ '0b100010', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '0b000000', + \ '0b001000', + \ '0b010000', + \ '0b100000', + \ '0b100010', + \ '0b100010', + \ '0b100100', + \ '0b101000', + \ '0b101000', + \ '0b101001', + \ '0b101001', + \ '0b101010', + \ '0b101100', + \ '0b111000' + \ ] + \ }, + \ { + \ 'name' : 'binary with leading characters', + \ 'cmd' : 'sort b', + \ 'input' : [ + \ '0b100010', + \ '0b010000', + \ ' 0b101001', + \ 'b0b101100', + \ '0b100010', + \ ' 0b100100', + \ 'a0b001000', + \ '0b101000', + \ '0b101000', + \ 'a0b101001', + \ 'ab0b100000', + \ '0b101010', + \ '0b000000', + \ 'b0b111000', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '0b000000', + \ 'a0b001000', + \ '0b010000', + \ 'ab0b100000', + \ '0b100010', + \ '0b100010', + \ ' 0b100100', + \ '0b101000', + \ '0b101000', + \ ' 0b101001', + \ 'a0b101001', + \ '0b101010', + \ 'b0b101100', + \ 'b0b111000' + \ ] + \ }, + \ { + \ 'name' : 'float', + \ 'cmd' : 'sort f', + \ 'input' : [ + \ '1.234', + \ '0.88', + \ '123.456', + \ '1.15e-6', + \ '-1.1e3', + \ '-1.01e3', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '-1.1e3', + \ '-1.01e3', + \ '1.15e-6', + \ '0.88', + \ '1.234', + \ '123.456' + \ ] + \ } + \ ] + + for t in tests + enew! + call append(0, t.input) + $delete _ + exe t.cmd + call assert_equal(t.expected, getline(1, '$'), t.name) + endfor + + call assert_fails('sort no', 'E474') + + enew! +endfunc diff --git a/src/testdir/test_source_utf8.vim b/src/testdir/test_source_utf8.vim new file mode 100644 index 0000000000..c29c2ec1f3 --- /dev/null +++ b/src/testdir/test_source_utf8.vim @@ -0,0 +1,63 @@ +" Test the :source! command +if !has('multi_byte') + finish +endif + +func Test_source_utf8() + " check that sourcing a script with 0x80 as second byte works + new + call setline(1, [':%s/àx/--à1234--/g', ':%s/Àx/--À1234--/g']) + write! Xscript + bwipe! + new + call setline(1, [' àx ', ' Àx ']) + source! Xscript | echo + call assert_equal(' --à1234-- ', getline(1)) + call assert_equal(' --À1234-- ', getline(2)) + bwipe! + call delete('Xscript') +endfunc + +func Test_source_latin() + " check that sourcing a latin1 script with a 0xc0 byte works + new + call setline(1, ["call feedkeys('r')", "call feedkeys('\xc0', 'xt')"]) + write! Xscript + bwipe! + new + call setline(1, ['xxx']) + source Xscript + call assert_equal("\u00c0xx", getline(1)) + bwipe! + call delete('Xscript') +endfunc + +" Test for sourcing a file with CTRL-V's at the end of the line +func Test_source_ctrl_v() + call writefile(['map __1 afirst', + \ 'map __2 asecond', + \ 'map __3 athird', + \ 'map __4 afourth', + \ 'map __5 afifth', + \ "map __1 asd\<C-V>", + \ "map __2 asd\<C-V>\<C-V>", + \ "map __3 asd\<C-V>\<C-V>", + \ "map __4 asd\<C-V>\<C-V>\<C-V>", + \ "map __5 asd\<C-V>\<C-V>\<C-V>", + \ ], 'Xtestfile') + source Xtestfile + enew! + exe "normal __1\<Esc>\<Esc>__2\<Esc>__3\<Esc>\<Esc>__4\<Esc>__5\<Esc>" + exe "%s/\<C-J>/0/g" + call assert_equal(['sd', + \ "map __2 asd\<Esc>secondsd\<Esc>sd0map __5 asd0fifth"], + \ getline(1, 2)) + + enew! + call delete('Xtestfile') + unmap __1 + unmap __2 + unmap __3 + unmap __4 + unmap __5 +endfunc diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim new file mode 100644 index 0000000000..3e8ba1defa --- /dev/null +++ b/src/testdir/test_spell.vim @@ -0,0 +1,819 @@ +" Test spell checking + +if !has('spell') + finish +endif + +func TearDown() + set nospell + call delete('Xtest.aff') + call delete('Xtest.dic') + call delete('Xtest.latin1.add') + call delete('Xtest.latin1.add.spl') + call delete('Xtest.latin1.spl') + call delete('Xtest.latin1.sug') +endfunc + +func Test_wrap_search() + new + call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End']) + set spell wrapscan + normal ]s + call assert_equal('plong', expand('<cword>')) + normal ]s + call assert_equal('zpelling', expand('<cword>')) + normal ]s + call assert_equal('plong', expand('<cword>')) + bwipe! + set nospell +endfunc + +func Test_curswant() + new + call setline(1, ['Another plong line', 'abcdefghijklmnopq']) + set spell wrapscan + normal 0]s + call assert_equal('plong', expand('<cword>')) + normal j + call assert_equal(9, getcurpos()[2]) + normal 0[s + call assert_equal('plong', expand('<cword>')) + normal j + call assert_equal(9, getcurpos()[2]) + + normal 0]S + call assert_equal('plong', expand('<cword>')) + normal j + call assert_equal(9, getcurpos()[2]) + normal 0[S + call assert_equal('plong', expand('<cword>')) + normal j + call assert_equal(9, getcurpos()[2]) + + normal 1G0 + call assert_equal('plong', spellbadword()[0]) + normal j + call assert_equal(9, getcurpos()[2]) + + bwipe! + set nospell +endfunc + +func Test_z_equal_on_invalid_utf8_word() + split + set spell + call setline(1, "\xff") + norm z= + set nospell + bwipe! +endfunc + +func Test_spellreall() + new + set spell + call assert_fails('spellrepall', 'E752:') + call setline(1, ['A speling mistake. The same speling mistake.', + \ 'Another speling mistake.']) + call feedkeys(']s1z=', 'tx') + call assert_equal('A spelling mistake. The same speling mistake.', getline(1)) + call assert_equal('Another speling mistake.', getline(2)) + spellrepall + call assert_equal('A spelling mistake. The same spelling mistake.', getline(1)) + call assert_equal('Another spelling mistake.', getline(2)) + call assert_fails('spellrepall', 'E753:') + set spell& + bwipe! +endfunc + +func Test_zz_basic() + call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1) + call RunGoodBad("wrong OK puts. Test the end", + \ "bad: inputs comment ok Ok. test d\xE9\xF4l end the", + \["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts", + \ "test", "testen", "testn", "the end", "uk", "wrong"], + \[ + \ ["bad", ["put", "uk", "OK"]], + \ ["inputs", ["input", "puts", "outputs"]], + \ ["comment", ["Comment", "outtest", "the end"]], + \ ["ok", ["OK", "uk", "put"]], + \ ["Ok", ["OK", "Uk", "Put"]], + \ ["test", ["Test", "testn", "testen"]], + \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]], + \ ["end", ["put", "uk", "test"]], + \ ["the", ["put", "uk", "test"]], + \ ] + \ ) + + call assert_equal("gebletegek", soundfold('goobledygoook')) + call assert_equal("kepereneven", soundfold('koprnven')) + call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale')) +endfunc + +" Postponed prefixes +func Test_zz_prefixes() + call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1) + call RunGoodBad("puts", + \ "bad: inputs comment ok Ok end the. test d\xE9\xF4l", + \ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"], + \ [ + \ ["bad", ["put", "uk", "OK"]], + \ ["inputs", ["input", "puts", "outputs"]], + \ ["comment", ["Comment"]], + \ ["ok", ["OK", "uk", "put"]], + \ ["Ok", ["OK", "Uk", "Put"]], + \ ["end", ["put", "uk", "deol"]], + \ ["the", ["put", "uk", "test"]], + \ ["test", ["Test", "testn", "testen"]], + \ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]], + \ ]) +endfunc + +"Compound words +func Test_zz_compound() + call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3) + call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo", + \ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar", + \ ["foo", "m\xEF"], + \ [ + \ ["bad", ["foo", "m\xEF"]], + \ ["bar", ["barfoo", "foobar", "foo"]], + \ ["la", ["m\xEF", "foo"]], + \ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]], + \ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]], + \ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]], + \ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]], + \ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]], + \ ["lala", []], + \ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]], + \ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]], + \ ["foola", ["foo", "foobar", "foofoo"]], + \ ["labar", ["barbar", "foobar"]], + \ ]) + + call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4) + call RunGoodBad("word util bork prebork start end wordutil wordutils pro-ok bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork tomato tomatotomato startend startword startwordword startwordend startwordwordend startwordwordwordend prebork preborkbork preborkborkbork nouword", + \ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword", + \ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"], + \ [ + \ ["bad", ["end", "bork", "word"]], + \ ["wordutilize", ["word utilize", "wordutils", "wordutil"]], + \ ["pro", ["bork", "word", "end"]], + \ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]], + \ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]], + \ ["endstart", ["end start", "start"]], + \ ["endend", ["end end", "end"]], + \ ["startstart", ["start start"]], + \ ["wordend", ["word end", "word", "wordword"]], + \ ["wordstart", ["word start", "bork start"]], + \ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]], + \ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]], + \ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]], + \ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]], + \ ["utilsbork", ["utilbork", "utils bork", "util bork"]], + \ ["startnouword", ["start nouword", "startword", "startborkword"]], + \ ]) + +endfunc + +"Test affix flags with two characters +func Test_zz_affix() + call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5) + call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend", + \ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend", + \ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"], + \ [ + \ ["bad", ["bar", "end", "fooa1"]], + \ ["foo", ["fooa1", "fooa\xE9", "bar"]], + \ ["fooa2", ["fooa1", "fooa\xE9", "bar"]], + \ ["prabar", ["prebar", "bar", "bar bar"]], + \ ["probarbirk", ["prebarbork"]], + \ ["middle", []], + \ ["startmiddle", ["startmiddleend", "startmiddlebar"]], + \ ["middleend", []], + \ ["endstart", ["end start", "start"]], + \ ["startprobar", ["startprebar", "start prebar", "startbar"]], + \ ["startnouend", ["start nouend", "startend"]], + \ ]) + + call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6) + call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend", + \ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar", + \ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"], + \ [ + \ ["bad", ["bar", "end", "lead"]], + \ ["mee", ["meea1", "meea\xE9", "bar"]], + \ ["meea2", ["meea1", "meea\xE9", "lead"]], + \ ["prabar", ["prebar", "bar", "leadbar"]], + \ ["probarbirk", ["prebarbork"]], + \ ["middle", []], + \ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]], + \ ["middleend", []], + \ ["endlead", ["end lead", "lead", "end end"]], + \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]], + \ ]) + + call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7) + call RunGoodBad("meea1 meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail", + \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar", + \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "prebar", "prebarmeat", "tail"], + \ [ + \ ["bad", ["bar", "lead", "tail"]], + \ ["mee", ["meea1", "meea\xE9", "bar"]], + \ ["meea2", ["meea1", "meea\xE9", "lead"]], + \ ["prabar", ["prebar", "bar", "leadbar"]], + \ ["probarmaat", ["prebarmeat"]], + \ ["middle", []], + \ ["leadmiddle", ["leadmiddlebar"]], + \ ["middletail", []], + \ ["taillead", ["tail lead", "tail"]], + \ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]], + \ ]) +endfunc + +func Test_zz_NOSLITSUGS() + call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8) + call RunGoodBad("foo bar faabar", "bad: foobar barfoo", + \ ["bar", "faabar", "foo"], + \ [ + \ ["bad", ["bar", "foo"]], + \ ["foobar", ["faabar", "foo bar", "bar"]], + \ ["barfoo", ["bar foo", "bar", "foo"]], + \ ]) +endfunc + +" Numbers +func Test_zz_Numbers() + call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9) + call RunGoodBad("0b1011 0777 1234 0x01ff", "", + \ ["bar", "foo"], + \ [ + \ ]) +endfunc + +function FirstSpellWord() + call feedkeys("/^start:\n", 'tx') + normal ]smm + let [str, a] = spellbadword() + return str +endfunc + +function SecondSpellWord() + normal `m]s + let [str, a] = spellbadword() + return str +endfunc + +"Test with SAL instead of SOFO items; test automatic reloading +func Test_zz_sal_and_addition() + set enc=latin1 + set spellfile= + call writefile(g:test_data_dic1, "Xtest.dic") + call writefile(g:test_data_aff_sal, "Xtest.aff") + mkspell! Xtest Xtest + set spl=Xtest.latin1.spl spell + call assert_equal('kbltykk', soundfold('goobledygoook')) + call assert_equal('kprnfn', soundfold('koprnven')) + call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale')) + + "also use an addition file + call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add") + mkspell! Xtest.latin1.add.spl Xtest.latin1.add + + bwipe! + call setline(1, ["start: elequint test elekwint test elekwent asdf"]) + + set spellfile=Xtest.latin1.add + call assert_equal("elekwent", FirstSpellWord()) + + set spl=Xtest_us.latin1.spl + call assert_equal("elequint", FirstSpellWord()) + call assert_equal("elekwint", SecondSpellWord()) + + set spl=Xtest_gb.latin1.spl + call assert_equal("elekwint", FirstSpellWord()) + call assert_equal("elekwent", SecondSpellWord()) + + set spl=Xtest_nz.latin1.spl + call assert_equal("elequint", FirstSpellWord()) + call assert_equal("elekwent", SecondSpellWord()) + + set spl=Xtest_ca.latin1.spl + call assert_equal("elequint", FirstSpellWord()) + call assert_equal("elekwint", SecondSpellWord()) +endfunc + +func Test_region_error() + messages clear + call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add") + mkspell! Xtest.latin1.add.spl Xtest.latin1.add + call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages')) + call delete('Xtest.latin1.add') + call delete('Xtest.latin1.add.spl') +endfunc + +" Check using z= in new buffer (crash fixed by patch 7.4a.028). +func Test_zeq_crash() + new + set maxmem=512 spell + call feedkeys('iasdz=:\"', 'tx') + + bwipe! +endfunc + +func LoadAffAndDic(aff_contents, dic_contents) + set enc=latin1 + set spellfile= + call writefile(a:aff_contents, "Xtest.aff") + call writefile(a:dic_contents, "Xtest.dic") + " Generate a .spl file from a .dic and .aff file. + mkspell! Xtest Xtest + " use that spell file + set spl=Xtest.latin1.spl spell +endfunc + +func ListWords() + spelldump + %yank + quit + return split(@", "\n") +endfunc + +func TestGoodBadBase() + exe '1;/^good:' + normal 0f:]s + let prevbad = '' + let result = [] + while 1 + let [bad, a] = spellbadword() + if bad == '' || bad == prevbad || bad == 'badend' + break + endif + let prevbad = bad + let lst = spellsuggest(bad, 3) + normal mm + + call add(result, [bad, lst]) + normal `m]s + endwhile + return result +endfunc + +func RunGoodBad(good, bad, expected_words, expected_bad_words) + bwipe! + call setline(1, ["good: ", a:good, a:bad, " badend "]) + let words = ListWords() + call assert_equal(a:expected_words, words[1:-1]) + let bad_words = TestGoodBadBase() + call assert_equal(a:expected_bad_words, bad_words) + bwipe! +endfunc + +let g:test_data_aff1 = [ + \"SET ISO8859-1", + \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ", + \"", + \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF", + \"", + \"SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xBF", + \"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?", + \"", + \"MIDWORD\t'-", + \"", + \"KEP =", + \"RAR ?", + \"BAD !", + \"", + \"PFX I N 1", + \"PFX I 0 in .", + \"", + \"PFX O Y 1", + \"PFX O 0 out .", + \"", + \"SFX S Y 2", + \"SFX S 0 s [^s]", + \"SFX S 0 es s", + \"", + \"SFX N N 3", + \"SFX N 0 en [^n]", + \"SFX N 0 nen n", + \"SFX N 0 n .", + \"", + \"REP 3", + \"REP g ch", + \"REP ch g", + \"REP svp s.v.p.", + \"", + \"MAP 9", + \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5", + \"MAP e\xE8\xE9\xEA\xEB", + \"MAP i\xEC\xED\xEE\xEF", + \"MAP o\xF2\xF3\xF4\xF5\xF6", + \"MAP u\xF9\xFA\xFB\xFC", + \"MAP n\xF1", + \"MAP c\xE7", + \"MAP y\xFF\xFD", + \"MAP s\xDF", + \ ] +let g:test_data_dic1 = [ + \"123456", + \"test/NO", + \"# comment", + \"wrong", + \"Comment", + \"OK", + \"uk", + \"put/ISO", + \"the end", + \"deol", + \"d\xE9\xF4r", + \ ] +let g:test_data_aff2 = [ + \"SET ISO8859-1", + \"", + \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF", + \"", + \"PFXPOSTPONE", + \"", + \"MIDWORD\t'-", + \"", + \"KEP =", + \"RAR ?", + \"BAD !", + \"", + \"PFX I N 1", + \"PFX I 0 in .", + \"", + \"PFX O Y 1", + \"PFX O 0 out [a-z]", + \"", + \"SFX S Y 2", + \"SFX S 0 s [^s]", + \"SFX S 0 es s", + \"", + \"SFX N N 3", + \"SFX N 0 en [^n]", + \"SFX N 0 nen n", + \"SFX N 0 n .", + \"", + \"REP 3", + \"REP g ch", + \"REP ch g", + \"REP svp s.v.p.", + \"", + \"MAP 9", + \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5", + \"MAP e\xE8\xE9\xEA\xEB", + \"MAP i\xEC\xED\xEE\xEF", + \"MAP o\xF2\xF3\xF4\xF5\xF6", + \"MAP u\xF9\xFA\xFB\xFC", + \"MAP n\xF1", + \"MAP c\xE7", + \"MAP y\xFF\xFD", + \"MAP s\xDF", + \ ] +let g:test_data_aff3 = [ + \"SET ISO8859-1", + \"", + \"COMPOUNDMIN 3", + \"COMPOUNDRULE m*", + \"NEEDCOMPOUND x", + \ ] +let g:test_data_dic3 = [ + \"1234", + \"foo/m", + \"bar/mx", + \"m\xEF/m", + \"la/mx", + \ ] +let g:test_data_aff4 = [ + \"SET ISO8859-1", + \"", + \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF", + \"", + \"COMPOUNDRULE m+", + \"COMPOUNDRULE sm*e", + \"COMPOUNDRULE sm+", + \"COMPOUNDMIN 3", + \"COMPOUNDWORDMAX 3", + \"COMPOUNDFORBIDFLAG t", + \"", + \"COMPOUNDSYLMAX 5", + \"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui", + \"", + \"MAP 9", + \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5", + \"MAP e\xE8\xE9\xEA\xEB", + \"MAP i\xEC\xED\xEE\xEF", + \"MAP o\xF2\xF3\xF4\xF5\xF6", + \"MAP u\xF9\xFA\xFB\xFC", + \"MAP n\xF1", + \"MAP c\xE7", + \"MAP y\xFF\xFD", + \"MAP s\xDF", + \"", + \"NEEDAFFIX x", + \"", + \"PFXPOSTPONE", + \"", + \"MIDWORD '-", + \"", + \"SFX q N 1", + \"SFX q 0 -ok .", + \"", + \"SFX a Y 2", + \"SFX a 0 s .", + \"SFX a 0 ize/t .", + \"", + \"PFX p N 1", + \"PFX p 0 pre .", + \"", + \"PFX P N 1", + \"PFX P 0 nou .", + \ ] +let g:test_data_dic4 = [ + \"1234", + \"word/mP", + \"util/am", + \"pro/xq", + \"tomato/m", + \"bork/mp", + \"start/s", + \"end/e", + \ ] +let g:test_data_aff5 = [ + \"SET ISO8859-1", + \"", + \"FLAG long", + \"", + \"NEEDAFFIX !!", + \"", + \"COMPOUNDRULE ssmm*ee", + \"", + \"NEEDCOMPOUND xx", + \"COMPOUNDPERMITFLAG pp", + \"", + \"SFX 13 Y 1", + \"SFX 13 0 bork .", + \"", + \"SFX a1 Y 1", + \"SFX a1 0 a1 .", + \"", + \"SFX a\xE9 Y 1", + \"SFX a\xE9 0 a\xE9 .", + \"", + \"PFX zz Y 1", + \"PFX zz 0 pre/pp .", + \"", + \"PFX yy Y 1", + \"PFX yy 0 nou .", + \ ] +let g:test_data_dic5 = [ + \"1234", + \"foo/a1a\xE9!!", + \"bar/zz13ee", + \"start/ss", + \"end/eeyy", + \"middle/mmxx", + \ ] +let g:test_data_aff6 = [ + \"SET ISO8859-1", + \"", + \"FLAG caplong", + \"", + \"NEEDAFFIX A!", + \"", + \"COMPOUNDRULE sMm*Ee", + \"", + \"NEEDCOMPOUND Xx", + \"", + \"COMPOUNDPERMITFLAG p", + \"", + \"SFX N3 Y 1", + \"SFX N3 0 bork .", + \"", + \"SFX A1 Y 1", + \"SFX A1 0 a1 .", + \"", + \"SFX A\xE9 Y 1", + \"SFX A\xE9 0 a\xE9 .", + \"", + \"PFX Zz Y 1", + \"PFX Zz 0 pre/p .", + \ ] +let g:test_data_dic6 = [ + \"1234", + \"mee/A1A\xE9A!", + \"bar/ZzN3Ee", + \"lead/s", + \"end/Ee", + \"middle/MmXx", + \ ] +let g:test_data_aff7 = [ + \"SET ISO8859-1", + \"", + \"FLAG num", + \"", + \"NEEDAFFIX 9999", + \"", + \"COMPOUNDRULE 2,77*123", + \"", + \"NEEDCOMPOUND 1", + \"COMPOUNDPERMITFLAG 432", + \"", + \"SFX 61003 Y 1", + \"SFX 61003 0 meat .", + \"", + \"SFX 391 Y 1", + \"SFX 391 0 a1 .", + \"", + \"SFX 111 Y 1", + \"SFX 111 0 a\xE9 .", + \"", + \"PFX 17 Y 1", + \"PFX 17 0 pre/432 .", + \ ] +let g:test_data_dic7 = [ + \"1234", + \"mee/391,111,9999", + \"bar/17,61003,123", + \"lead/2", + \"tail/123", + \"middle/77,1", + \ ] +let g:test_data_aff8 = [ + \"SET ISO8859-1", + \"", + \"NOSPLITSUGS", + \ ] +let g:test_data_dic8 = [ + \"1234", + \"foo", + \"bar", + \"faabar", + \ ] +let g:test_data_aff9 = [ + \ ] +let g:test_data_dic9 = [ + \"1234", + \"foo", + \"bar", + \ ] +let g:test_data_aff_sal = [ + \"SET ISO8859-1", + \"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ", + \"", + \"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF", + \"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF", + \"", + \"MIDWORD\t'-", + \"", + \"KEP =", + \"RAR ?", + \"BAD !", + \"", + \"PFX I N 1", + \"PFX I 0 in .", + \"", + \"PFX O Y 1", + \"PFX O 0 out .", + \"", + \"SFX S Y 2", + \"SFX S 0 s [^s]", + \"SFX S 0 es s", + \"", + \"SFX N N 3", + \"SFX N 0 en [^n]", + \"SFX N 0 nen n", + \"SFX N 0 n .", + \"", + \"REP 3", + \"REP g ch", + \"REP ch g", + \"REP svp s.v.p.", + \"", + \"MAP 9", + \"MAP a\xE0\xE1\xE2\xE3\xE4\xE5", + \"MAP e\xE8\xE9\xEA\xEB", + \"MAP i\xEC\xED\xEE\xEF", + \"MAP o\xF2\xF3\xF4\xF5\xF6", + \"MAP u\xF9\xFA\xFB\xFC", + \"MAP n\xF1", + \"MAP c\xE7", + \"MAP y\xFF\xFD", + \"MAP s\xDF", + \"", + \"SAL AH(AEIOUY)-^ *H", + \"SAL AR(AEIOUY)-^ *R", + \"SAL A(HR)^ *", + \"SAL A^ *", + \"SAL AH(AEIOUY)- H", + \"SAL AR(AEIOUY)- R", + \"SAL A(HR) _", + \"SAL \xC0^ *", + \"SAL \xC5^ *", + \"SAL BB- _", + \"SAL B B", + \"SAL CQ- _", + \"SAL CIA X", + \"SAL CH X", + \"SAL C(EIY)- S", + \"SAL CK K", + \"SAL COUGH^ KF", + \"SAL CC< C", + \"SAL C K", + \"SAL DG(EIY) K", + \"SAL DD- _", + \"SAL D T", + \"SAL \xC9< E", + \"SAL EH(AEIOUY)-^ *H", + \"SAL ER(AEIOUY)-^ *R", + \"SAL E(HR)^ *", + \"SAL ENOUGH^$ *NF", + \"SAL E^ *", + \"SAL EH(AEIOUY)- H", + \"SAL ER(AEIOUY)- R", + \"SAL E(HR) _", + \"SAL FF- _", + \"SAL F F", + \"SAL GN^ N", + \"SAL GN$ N", + \"SAL GNS$ NS", + \"SAL GNED$ N", + \"SAL GH(AEIOUY)- K", + \"SAL GH _", + \"SAL GG9 K", + \"SAL G K", + \"SAL H H", + \"SAL IH(AEIOUY)-^ *H", + \"SAL IR(AEIOUY)-^ *R", + \"SAL I(HR)^ *", + \"SAL I^ *", + \"SAL ING6 N", + \"SAL IH(AEIOUY)- H", + \"SAL IR(AEIOUY)- R", + \"SAL I(HR) _", + \"SAL J K", + \"SAL KN^ N", + \"SAL KK- _", + \"SAL K K", + \"SAL LAUGH^ LF", + \"SAL LL- _", + \"SAL L L", + \"SAL MB$ M", + \"SAL MM M", + \"SAL M M", + \"SAL NN- _", + \"SAL N N", + \"SAL OH(AEIOUY)-^ *H", + \"SAL OR(AEIOUY)-^ *R", + \"SAL O(HR)^ *", + \"SAL O^ *", + \"SAL OH(AEIOUY)- H", + \"SAL OR(AEIOUY)- R", + \"SAL O(HR) _", + \"SAL PH F", + \"SAL PN^ N", + \"SAL PP- _", + \"SAL P P", + \"SAL Q K", + \"SAL RH^ R", + \"SAL ROUGH^ RF", + \"SAL RR- _", + \"SAL R R", + \"SAL SCH(EOU)- SK", + \"SAL SC(IEY)- S", + \"SAL SH X", + \"SAL SI(AO)- X", + \"SAL SS- _", + \"SAL S S", + \"SAL TI(AO)- X", + \"SAL TH @", + \"SAL TCH-- _", + \"SAL TOUGH^ TF", + \"SAL TT- _", + \"SAL T T", + \"SAL UH(AEIOUY)-^ *H", + \"SAL UR(AEIOUY)-^ *R", + \"SAL U(HR)^ *", + \"SAL U^ *", + \"SAL UH(AEIOUY)- H", + \"SAL UR(AEIOUY)- R", + \"SAL U(HR) _", + \"SAL V^ W", + \"SAL V F", + \"SAL WR^ R", + \"SAL WH^ W", + \"SAL W(AEIOU)- W", + \"SAL X^ S", + \"SAL X KS", + \"SAL Y(AEIOU)- Y", + \"SAL ZZ- _", + \"SAL Z S", + \ ] diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim new file mode 100644 index 0000000000..42e4896186 --- /dev/null +++ b/src/testdir/test_startup.vim @@ -0,0 +1,303 @@ +" Tests for startup. + +source shared.vim + +" Check that loading startup.vim works. +func Test_startup_script() + set compatible + source $VIMRUNTIME/defaults.vim + + call assert_equal(0, &compatible) +endfunc + +" Verify the order in which plugins are loaded: +" 1. plugins in non-after directories +" 2. packages +" 3. plugins in after directories +func Test_after_comes_later() + if !has('packages') + return + endif + let before = [ + \ 'set nocp viminfo+=nviminfo', + \ 'set guioptions+=M', + \ 'let $HOME = "/does/not/exist"', + \ 'set loadplugins', + \ 'set rtp=Xhere,Xafter,Xanother', + \ 'set packpath=Xhere,Xafter', + \ 'set nomore', + \ 'let g:sequence = ""', + \ ] + let after = [ + \ 'redir! > Xtestout', + \ 'scriptnames', + \ 'redir END', + \ 'redir! > Xsequence', + \ 'echo g:sequence', + \ 'redir END', + \ 'quit', + \ ] + call mkdir('Xhere/plugin', 'p') + call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim') + call mkdir('Xanother/plugin', 'p') + call writefile(['let g:sequence .= "another "'], 'Xanother/plugin/another.vim') + call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p') + call writefile(['let g:sequence .= "pack "'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim') + + call mkdir('Xafter/plugin', 'p') + call writefile(['let g:sequence .= "after "'], 'Xafter/plugin/later.vim') + + if RunVim(before, after, '') + + let lines = readfile('Xtestout') + let expected = ['Xbefore.vim', 'here.vim', 'another.vim', 'foo.vim', 'later.vim', 'Xafter.vim'] + let found = [] + for line in lines + for one in expected + if line =~ one + call add(found, one) + endif + endfor + endfor + call assert_equal(expected, found) + endif + + call assert_equal('here another pack after', substitute(join(readfile('Xsequence', 1), ''), '\s\+$', '', '')) + + call delete('Xtestout') + call delete('Xsequence') + call delete('Xhere', 'rf') + call delete('Xanother', 'rf') + call delete('Xafter', 'rf') +endfunc + +func Test_pack_in_rtp_when_plugins_run() + if !has('packages') + return + endif + let before = [ + \ 'set nocp viminfo+=nviminfo', + \ 'set guioptions+=M', + \ 'let $HOME = "/does/not/exist"', + \ 'set loadplugins', + \ 'set rtp=Xhere', + \ 'set packpath=Xhere', + \ 'set nomore', + \ ] + let after = [ + \ 'quit', + \ ] + call mkdir('Xhere/plugin', 'p') + call writefile(['redir! > Xtestout', 'silent set runtimepath?', 'silent! call foo#Trigger()', 'redir END'], 'Xhere/plugin/here.vim') + call mkdir('Xhere/pack/foo/start/foobar/autoload', 'p') + call writefile(['function! foo#Trigger()', 'echo "autoloaded foo"', 'endfunction'], 'Xhere/pack/foo/start/foobar/autoload/foo.vim') + + if RunVim(before, after, '') + + let lines = filter(readfile('Xtestout'), '!empty(v:val)') + call assert_match('Xhere[/\\]pack[/\\]foo[/\\]start[/\\]foobar', get(lines, 0)) + call assert_match('autoloaded foo', get(lines, 1)) + endif + + call delete('Xtestout') + call delete('Xhere', 'rf') +endfunc + +func Test_help_arg() + if !has('unix') && has('gui') + " this doesn't work with gvim on MS-Windows + return + endif + if RunVim([], [], '--help >Xtestout') + let lines = readfile('Xtestout') + call assert_true(len(lines) > 20) + call assert_match('Vi IMproved', lines[0]) + + " check if couple of lines are there + let found = [] + for line in lines + if line =~ '-R.*Readonly mode' + call add(found, 'Readonly mode') + endif + " Watch out for a second --version line in the Gnome version. + if line =~ '--version.*Print version information and exit' + call add(found, "--version") + endif + endfor + call assert_equal(['Readonly mode', '--version'], found) + endif + call delete('Xtestout') +endfunc + +func Test_compatible_args() + let after = [ + \ 'call writefile([string(&compatible)], "Xtestout")', + \ 'set viminfo+=nviminfo', + \ 'quit', + \ ] + if RunVim([], after, '-C') + let lines = readfile('Xtestout') + call assert_equal('1', lines[0]) + endif + + if RunVim([], after, '-N') + let lines = readfile('Xtestout') + call assert_equal('0', lines[0]) + endif + + call delete('Xtestout') +endfunc + +func Test_file_args() + let after = [ + \ 'call writefile(argv(), "Xtestout")', + \ 'qall', + \ ] + if RunVim([], after, '') + let lines = readfile('Xtestout') + call assert_equal(0, len(lines)) + endif + + if RunVim([], after, 'one') + let lines = readfile('Xtestout') + call assert_equal(1, len(lines)) + call assert_equal('one', lines[0]) + endif + + if RunVim([], after, 'one two three') + let lines = readfile('Xtestout') + call assert_equal(3, len(lines)) + call assert_equal('one', lines[0]) + call assert_equal('two', lines[1]) + call assert_equal('three', lines[2]) + endif + + if RunVim([], after, 'one -c echo two') + let lines = readfile('Xtestout') + call assert_equal(2, len(lines)) + call assert_equal('one', lines[0]) + call assert_equal('two', lines[1]) + endif + + if RunVim([], after, 'one -- -c echo two') + let lines = readfile('Xtestout') + call assert_equal(4, len(lines)) + call assert_equal('one', lines[0]) + call assert_equal('-c', lines[1]) + call assert_equal('echo', lines[2]) + call assert_equal('two', lines[3]) + endif + + call delete('Xtestout') +endfunc + +func Test_startuptime() + if !has('startuptime') + return + endif + let after = ['qall'] + if RunVim([], after, '--startuptime Xtestout one') + let lines = readfile('Xtestout') + let expected = ['--- VIM STARTING ---', 'parsing arguments', + \ 'shell init', 'inits 3', 'start termcap', 'opening buffers'] + let found = [] + for line in lines + for exp in expected + if line =~ exp + call add(found, exp) + endif + endfor + endfor + call assert_equal(expected, found) + endif + call delete('Xtestout') +endfunc + +func Test_read_stdin() + let after = [ + \ 'write Xtestout', + \ 'quit!', + \ ] + if RunVimPiped([], after, '-', 'echo something | ') + let lines = readfile('Xtestout') + " MS-Windows adds a space after the word + call assert_equal(['something'], split(lines[0])) + endif + call delete('Xtestout') +endfunc + +func Test_set_shell() + let after = [ + \ 'call writefile([&shell], "Xtestout")', + \ 'quit!', + \ ] + let $SHELL = '/bin/with space/sh' + if RunVimPiped([], after, '', '') + let lines = readfile('Xtestout') + " MS-Windows adds a space after the word + call assert_equal('/bin/with\ space/sh', lines[0]) + endif + call delete('Xtestout') +endfunc + +func Test_progpath() + " Tests normally run with "./vim" or "../vim", these must have been expanded + " to a full path. + if has('unix') + call assert_equal('/', v:progpath[0]) + elseif has('win32') + call assert_equal(':', v:progpath[1]) + call assert_match('[/\\]', v:progpath[2]) + endif + + " Only expect "vim" to appear in v:progname. + call assert_match('vim\c', v:progname) +endfunc + +func Test_silent_ex_mode() + if !has('unix') || has('gui_running') + " can't get output of Vim. + return + endif + + " This caused an ml_get error. + let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq') + call assert_notmatch('E315:', out) +endfunc + +func Test_default_term() + if !has('unix') || has('gui_running') + " can't get output of Vim. + return + endif + + let save_term = $TERM + let $TERM = 'unknownxxx' + let out = system(GetVimCommand() . ' -c''set term'' -c cq') + call assert_match("defaulting to 'ansi'", out) + let $TERM = save_term +endfunc + +func Test_zzz_startinsert() + " Test :startinsert + call writefile(['123456'], 'Xtestout') + let after = [ + \ ':startinsert', + \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' + \ ] + if RunVim([], after, 'Xtestout') + let lines = readfile('Xtestout') + call assert_equal(['foobar123456'], lines) + endif + " Test :startinsert! + call writefile(['123456'], 'Xtestout') + let after = [ + \ ':startinsert!', + \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' + \ ] + if RunVim([], after, 'Xtestout') + let lines = readfile('Xtestout') + call assert_equal(['123456foobar'], lines) + endif + call delete('Xtestout') +endfunc diff --git a/src/testdir/test_startup_utf8.vim b/src/testdir/test_startup_utf8.vim new file mode 100644 index 0000000000..d179a4cc79 --- /dev/null +++ b/src/testdir/test_startup_utf8.vim @@ -0,0 +1,64 @@ +" Tests for startup using utf-8. +if !has('multi_byte') + finish +endif + +source shared.vim + +func Test_read_stdin_utf8() + let linesin = ['テスト', '€ÀÈÌÒÙ'] + call writefile(linesin, 'Xtestin') + let before = [ + \ 'set enc=utf-8', + \ 'set fencs=cp932,utf-8', + \ ] + let after = [ + \ 'write ++enc=utf-8 Xtestout', + \ 'quit!', + \ ] + if has('win32') + let pipecmd = 'type Xtestin | ' + else + let pipecmd = 'cat Xtestin | ' + endif + if RunVimPiped(before, after, '-', pipecmd) + let lines = readfile('Xtestout') + call assert_equal(linesin, lines) + else + call assert_equal('', 'RunVimPiped failed.') + endif + call delete('Xtestout') + call delete('Xtestin') +endfunc + +func Test_read_fifo_utf8() + if !has('unix') + return + endif + " Using bash/zsh's process substitution. + if executable('bash') + set shell=bash + elseif executable('zsh') + set shell=zsh + else + return + endif + let linesin = ['テスト', '€ÀÈÌÒÙ'] + call writefile(linesin, 'Xtestin') + let before = [ + \ 'set enc=utf-8', + \ 'set fencs=cp932,utf-8', + \ ] + let after = [ + \ 'write ++enc=utf-8 Xtestout', + \ 'quit!', + \ ] + if RunVim(before, after, '<(cat Xtestin)') + let lines = readfile('Xtestout') + call assert_equal(linesin, lines) + else + call assert_equal('', 'RunVim failed.') + endif + call delete('Xtestout') + call delete('Xtestin') +endfunc diff --git a/src/testdir/test_stat.vim b/src/testdir/test_stat.vim new file mode 100644 index 0000000000..de5fac46fb --- /dev/null +++ b/src/testdir/test_stat.vim @@ -0,0 +1,92 @@ +" Tests for stat functions and checktime + +func CheckFileTime(doSleep) + let fname = 'Xtest.tmp' + let result = 0 + + let ts = localtime() + if a:doSleep + sleep 1 + endif + let fl = ['Hello World!'] + call writefile(fl, fname) + let tf = getftime(fname) + if a:doSleep + sleep 1 + endif + let te = localtime() + + let time_correct = (ts <= tf && tf <= te) + if a:doSleep || time_correct + call assert_true(time_correct) + call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) + call assert_equal('file', getftype(fname)) + call assert_equal('rw-', getfperm(fname)[0:2]) + let result = 1 + endif + + call delete(fname) + return result +endfunc + +func Test_existent_file() + " On some systems the file timestamp is rounded to a multiple of 2 seconds. + " We need to sleep to handle that, but that makes the test slow. First try + " without the sleep, and if it fails try again with the sleep. + if CheckFileTime(0) == 0 + call CheckFileTime(1) + endif +endfunc + +func Test_existent_directory() + let dname = '.' + + call assert_equal(0, getfsize(dname)) + call assert_equal('dir', getftype(dname)) + call assert_equal('rwx', getfperm(dname)[0:2]) +endfunc + +func Test_checktime() + let fname = 'Xtest.tmp' + + let fl = ['Hello World!'] + call writefile(fl, fname) + set autoread + exec 'e' fname + " FAT has a granularity of 2 seconds, otherwise it's usually 1 second + if has('win32') + sleep 2 + else + sleep 1 + endif + let fl = readfile(fname) + let fl[0] .= ' - checktime' + call writefile(fl, fname) + checktime + call assert_equal(fl[0], getline(1)) + + call delete(fname) +endfunc + +func Test_nonexistent_file() + let fname = 'Xtest.tmp' + + call delete(fname) + call assert_equal(-1, getftime(fname)) + call assert_equal(-1, getfsize(fname)) + call assert_equal('', getftype(fname)) + call assert_equal('', getfperm(fname)) +endfunc + +func Test_win32_symlink_dir() + " On Windows, non-admin users cannot create symlinks. + " So we use an existing symlink for this test. + if has('win32') + " Check if 'C:\Users\All Users' is a symlink to a directory. + let res = system('dir C:\Users /a') + if match(res, '\C<SYMLINKD> *All Users') >= 0 + " Get the filetype of the symlink. + call assert_equal('dir', getftype('C:\Users\All Users')) + endif + endif +endfunc diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim new file mode 100644 index 0000000000..eafbecdf69 --- /dev/null +++ b/src/testdir/test_statusline.vim @@ -0,0 +1,343 @@ +" Test 'statusline' +" +" Not tested yet: +" %a +" %N +" %T +" %X + +source view_util.vim + +func s:get_statusline() + return ScreenLines(&lines - 1, &columns)[0] +endfunc + +func StatuslineWithCaughtError() + let s:func_in_statusline_called = 1 + try + call eval('unknown expression') + catch + endtry + return '' +endfunc + +func StatuslineWithError() + let s:func_in_statusline_called = 1 + call eval('unknown expression') + return '' +endfunc + +" Function used to display syntax group. +func SyntaxItem() + return synIDattr(synID(line("."),col("."),1),"name") +endfunc + +func Test_caught_error_in_statusline() + let s:func_in_statusline_called = 0 + set laststatus=2 + let statusline = '%{StatuslineWithCaughtError()}' + let &statusline = statusline + redrawstatus + call assert_true(s:func_in_statusline_called) + call assert_equal(statusline, &statusline) + set statusline= +endfunc + +func Test_statusline_will_be_disabled_with_error() + let s:func_in_statusline_called = 0 + set laststatus=2 + let statusline = '%{StatuslineWithError()}' + try + let &statusline = statusline + redrawstatus + catch + endtry + call assert_true(s:func_in_statusline_called) + call assert_equal('', &statusline) + set statusline= +endfunc + +func Test_statusline() + new Xstatusline + only + set laststatus=2 + set splitbelow + call setline(1, range(1, 200)) + + " %b: Value of character under cursor. + " %B: As above, in hexadecimal. + call cursor(180, 2) + set statusline=%b,%B + call assert_match('^56,38\s*$', s:get_statusline()) + + " %o: Byte number in file of byte under cursor, first byte is 1. + " %O: As above, in hexadecimal. + set statusline=%o,%O + set fileformat=dos + call assert_match('^789,315\s*$', s:get_statusline()) + set fileformat=mac + call assert_match('^610,262\s*$', s:get_statusline()) + set fileformat=unix + call assert_match('^610,262\s*$', s:get_statusline()) + set fileformat& + + " %f: Path to the file in the buffer, as typed or relative to current dir. + set statusline=%f + call assert_match('^Xstatusline\s*$', s:get_statusline()) + + " %F: Full path to the file in the buffer. + set statusline=%F + call assert_match('/testdir/Xstatusline\s*$', s:get_statusline()) + + " %h: Help buffer flag, text is "[help]". + " %H: Help buffer flag, text is ",HLP". + set statusline=%h,%H + call assert_match('^,\s*$', s:get_statusline()) + help + call assert_match('^\[Help\],HLP\s*$', s:get_statusline()) + helpclose + + " %k: Value of "b:keymap_name" or 'keymap' + " when :lmap mappings are being used: <keymap>" + set statusline=%k + if has('keymap') + set keymap=esperanto + call assert_match('^<Eo>\s*$', s:get_statusline()) + set keymap& + else + call assert_match('^\s*$', s:get_statusline()) + endif + + " %l: Line number. + " %L: Number of line in buffer. + " %c: Column number. + set statusline=%l/%L,%c + call assert_match('^180/200,2\s*$', s:get_statusline()) + + " %m: Modified flag, text is "[+]", "[-]" if 'modifiable' is off. + " %M: Modified flag, text is ",+" or ",-". + set statusline=%m%M + call assert_match('^\[+\],+\s*$', s:get_statusline()) + set nomodifiable + call assert_match('^\[+-\],+-\s*$', s:get_statusline()) + write + call assert_match('^\[-\],-\s*$', s:get_statusline()) + set modifiable& + call assert_match('^\s*$', s:get_statusline()) + + " %n: Buffer number. + set statusline=%n + call assert_match('^'.bufnr('%').'\s*$', s:get_statusline()) + + " %p: Percentage through file in lines as in CTRL-G. + " %P: Percentage through file of displayed window. + set statusline=%p,%P + 0 + call assert_match('^0,Top\s*$', s:get_statusline()) + norm G + call assert_match('^100,Bot\s*$', s:get_statusline()) + 180 + " Don't check the exact percentage as it depends on the window size + call assert_match('^90,\(Top\|Bot\|\d\+%\)\s*$', s:get_statusline()) + + " %q: "[Quickfix List]", "[Location List]" or empty. + set statusline=%q + call assert_match('^\s*$', s:get_statusline()) + copen + call assert_match('^\[Quickfix List\]\s*$', s:get_statusline()) + cclose + lexpr getline(1, 2) + lopen + call assert_match('^\[Location List\]\s*$', s:get_statusline()) + lclose + + " %r: Readonly flag, text is "[RO]". + " %R: Readonly flag, text is ",RO". + set statusline=%r,%R + call assert_match('^,\s*$', s:get_statusline()) + help + call assert_match('^\[RO\],RO\s*$', s:get_statusline()) + helpclose + + " %t: File name (tail) of file in the buffer. + set statusline=%t + call assert_match('^Xstatusline\s*$', s:get_statusline()) + + " %v: Virtual column number. + " %V: Virtual column number as -{num}. Not displayed if equal to 'c'. + call cursor(180, 2) + set statusline=%v,%V + call assert_match('^2,\s*$', s:get_statusline()) + set virtualedit=all + norm 10| + call assert_match('^10,-10\s*$', s:get_statusline()) + set virtualedit& + + " %w: Preview window flag, text is "[Preview]". + " %W: Preview window flag, text is ",PRV". + set statusline=%w%W + call assert_match('^\s*$', s:get_statusline()) + pedit + wincmd j + call assert_match('^\[Preview\],PRV\s*$', s:get_statusline()) + pclose + + " %y: Type of file in the buffer, e.g., "[vim]". See 'filetype'. + " %Y: Type of file in the buffer, e.g., ",VIM". See 'filetype'. + set statusline=%y\ %Y + call assert_match('^\s*$', s:get_statusline()) + setfiletype vim + call assert_match('^\[vim\] VIM\s*$', s:get_statusline()) + + " %=: Separation point between left and right aligned items. + set statusline=foo%=bar + call assert_match('^foo\s\+bar\s*$', s:get_statusline()) + + " Test min/max width, leading zeroes, left/right justify. + set statusline=%04B + call cursor(180, 2) + call assert_match('^0038\s*$', s:get_statusline()) + set statusline=#%4B# + call assert_match('^# 38#\s*$', s:get_statusline()) + set statusline=#%-4B# + call assert_match('^#38 #\s*$', s:get_statusline()) + set statusline=%.6f + call assert_match('^<sline\s*$', s:get_statusline()) + + " %<: Where to truncate. + exe 'set statusline=a%<b' . repeat('c', 1000) . 'd' + call assert_match('^a<c*d$', s:get_statusline()) + exe 'set statusline=a' . repeat('b', 1000) . '%<c' + call assert_match('^ab*>$', s:get_statusline()) + + "%{: Evaluate expression between '%{' and '}' and substitute result. + syntax on + set statusline=%{SyntaxItem()} + call assert_match('^vimNumber\s*$', s:get_statusline()) + s/^/"/ + call assert_match('^vimLineComment\s*$', s:get_statusline()) + syntax off + + "%(: Start of item group. + set statusline=ab%(cd%q%)de + call assert_match('^abde\s*$', s:get_statusline()) + copen + call assert_match('^abcd\[Quickfix List]de\s*$', s:get_statusline()) + cclose + + " %#: Set highlight group. The name must follow and then a # again. + set statusline=ab%#Todo#cd%#Error#ef + call assert_match('^abcdef\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + call assert_notequal(sa1, sa2) + call assert_notequal(sa1, sa3) + call assert_notequal(sa2, sa3) + call assert_equal(sa1, screenattr(&lines - 1, 2)) + call assert_equal(sa2, screenattr(&lines - 1, 4)) + call assert_equal(sa3, screenattr(&lines - 1, 6)) + call assert_equal(sa3, screenattr(&lines - 1, 7)) + + " %*: Set highlight group to User{N} + set statusline=a%1*b%0*c + call assert_match('^abc\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 2) + let sa3=screenattr(&lines - 1, 3) + call assert_equal(sa1, sa3) + call assert_notequal(sa1, sa2) + + " An empty group that contains highlight changes + let g:a = '' + set statusline=ab%(cd%1*%{g:a}%*%)de + call assert_match('^abde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 4) + call assert_equal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + let sa3=screenattr(&lines - 1, 7) + call assert_equal(sa1, sa3) + call assert_notequal(sa1, sa2) + + let g:a = '' + set statusline=ab%1*%(cd%*%{g:a}%1*%)de + call assert_match('^abde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 4) + call assert_notequal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + let sa4=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + call assert_equal(sa2, sa4) + + " An empty group that contains highlight changes and doesn't reset them + let g:a = '' + set statusline=ab%(cd%1*%{g:a}%)de + call assert_match('^abcdde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + call assert_notequal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + let sa3=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa2, sa3) + + let g:a = '' + set statusline=ab%1*%(cd%*%{g:a}%)de + call assert_match('^abcdde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + let sa4=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + call assert_equal(sa1, sa4) + + let g:a = '' + set statusline=%#Error#{%(\ %{g:a}\ %)} + call assert_match('^{}\s*$', s:get_statusline()) + let g:a = 'X' + call assert_match('^{ X }\s*$', s:get_statusline()) + + " %%: a percent sign. + set statusline=10%% + call assert_match('^10%\s*$', s:get_statusline()) + + " %!: evaluated expression is used as the option value + set statusline=%!2*3+1 + call assert_match('7\s*$', s:get_statusline()) + + " Check statusline in current and non-current window + " with the 'fillchars' option. + set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:- + vsplit + set statusline=x%=y + call assert_match('^x^\+y^x=\+y$', s:get_statusline()) + set fillchars& + close + + %bw! + call delete('Xstatusline') + set statusline& + set laststatus& + set splitbelow& +endfunc diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim new file mode 100644 index 0000000000..1c23f8c6a1 --- /dev/null +++ b/src/testdir/test_substitute.vim @@ -0,0 +1,502 @@ +" Tests for multi-line regexps with ":s". + +function! Test_multiline_subst() + enew! + call append(0, ["1 aa", + \ "bb", + \ "cc", + \ "2 dd", + \ "ee", + \ "3 ef", + \ "gh", + \ "4 ij", + \ "5 a8", + \ "8b c9", + \ "9d", + \ "6 e7", + \ "77f", + \ "xxxxx"]) + + 1 + " test if replacing a line break works with a back reference + /^1/,/^2/s/\n\(.\)/ \1/ + " test if inserting a line break works with a back reference + /^3/,/^4/s/\(.\)$/\r\1/ + " test if replacing a line break with another line break works + /^5/,/^6/s/\(\_d\{3}\)/x\1x/ + call assert_equal('1 aa bb cc 2 dd ee', getline(1)) + call assert_equal('3 e', getline(2)) + call assert_equal('f', getline(3)) + call assert_equal('g', getline(4)) + call assert_equal('h', getline(5)) + call assert_equal('4 i', getline(6)) + call assert_equal('j', getline(7)) + call assert_equal('5 ax8', getline(8)) + call assert_equal('8xb cx9', getline(9)) + call assert_equal('9xd', getline(10)) + call assert_equal('6 ex7', getline(11)) + call assert_equal('7x7f', getline(12)) + call assert_equal('xxxxx', getline(13)) + enew! +endfunction + +function! Test_substitute_variants() + " Validate that all the 2-/3-letter variants which embed the flags into the + " command name actually work. + enew! + let ln = 'Testing string' + let variants = [ + \ { 'cmd': ':s/Test/test/c', 'exp': 'testing string', 'prompt': 'y' }, + \ { 'cmd': ':s/foo/bar/ce', 'exp': ln }, + \ { 'cmd': ':s/t/r/cg', 'exp': 'Tesring srring', 'prompt': 'a' }, + \ { 'cmd': ':s/t/r/ci', 'exp': 'resting string', 'prompt': 'y' }, + \ { 'cmd': ':s/t/r/cI', 'exp': 'Tesring string', 'prompt': 'y' }, + \ { 'cmd': ':s/t/r/cn', 'exp': ln }, + \ { 'cmd': ':s/t/r/cp', 'exp': 'Tesring string', 'prompt': 'y' }, + \ { 'cmd': ':s/t/r/cl', 'exp': 'Tesring string', 'prompt': 'y' }, + \ { 'cmd': ':s/t/r/gc', 'exp': 'Tesring srring', 'prompt': 'a' }, + \ { 'cmd': ':s/foo/bar/ge', 'exp': ln }, + \ { 'cmd': ':s/t/r/g', 'exp': 'Tesring srring' }, + \ { 'cmd': ':s/t/r/gi', 'exp': 'resring srring' }, + \ { 'cmd': ':s/t/r/gI', 'exp': 'Tesring srring' }, + \ { 'cmd': ':s/t/r/gn', 'exp': ln }, + \ { 'cmd': ':s/t/r/gp', 'exp': 'Tesring srring' }, + \ { 'cmd': ':s/t/r/gl', 'exp': 'Tesring srring' }, + \ { 'cmd': ':s//r/gr', 'exp': 'Testr strr' }, + \ { 'cmd': ':s/t/r/ic', 'exp': 'resting string', 'prompt': 'y' }, + \ { 'cmd': ':s/foo/bar/ie', 'exp': ln }, + \ { 'cmd': ':s/t/r/i', 'exp': 'resting string' }, + \ { 'cmd': ':s/t/r/iI', 'exp': 'Tesring string' }, + \ { 'cmd': ':s/t/r/in', 'exp': ln }, + \ { 'cmd': ':s/t/r/ip', 'exp': 'resting string' }, + \ { 'cmd': ':s//r/ir', 'exp': 'Testr string' }, + \ { 'cmd': ':s/t/r/Ic', 'exp': 'Tesring string', 'prompt': 'y' }, + \ { 'cmd': ':s/foo/bar/Ie', 'exp': ln }, + \ { 'cmd': ':s/t/r/Ig', 'exp': 'Tesring srring' }, + \ { 'cmd': ':s/t/r/Ii', 'exp': 'resting string' }, + \ { 'cmd': ':s/t/r/I', 'exp': 'Tesring string' }, + \ { 'cmd': ':s/t/r/Ip', 'exp': 'Tesring string' }, + \ { 'cmd': ':s/t/r/Il', 'exp': 'Tesring string' }, + \ { 'cmd': ':s//r/Ir', 'exp': 'Testr string' }, + \ { 'cmd': ':s//r/rc', 'exp': 'Testr string', 'prompt': 'y' }, + \ { 'cmd': ':s//r/rg', 'exp': 'Testr strr' }, + \ { 'cmd': ':s//r/ri', 'exp': 'Testr string' }, + \ { 'cmd': ':s//r/rI', 'exp': 'Testr string' }, + \ { 'cmd': ':s//r/rn', 'exp': 'Testing string' }, + \ { 'cmd': ':s//r/rp', 'exp': 'Testr string' }, + \ { 'cmd': ':s//r/rl', 'exp': 'Testr string' }, + \ { 'cmd': ':s//r/r', 'exp': 'Testr string' }, + \] + + for var in variants + for run in [1, 2] + let cmd = var.cmd + if run == 2 && cmd =~ "/.*/.*/." + " Change :s/from/to/{flags} to :s{flags} + let cmd = substitute(cmd, '/.*/', '', '') + endif + call setline(1, [ln]) + let msg = printf('using "%s"', cmd) + let @/='ing' + let v:errmsg = '' + call feedkeys(cmd . "\<CR>" . get(var, 'prompt', ''), 'ntx') + " No error should exist (matters for testing e flag) + call assert_equal('', v:errmsg, msg) + call assert_equal(var.exp, getline('.'), msg) + endfor + endfor +endfunction + +func Test_substitute_repeat() + " This caused an invalid memory access. + split Xfile + s/^/x + call feedkeys("Qsc\<CR>y", 'tx') + bwipe! +endfunc + +" Test for *sub-replace-special* and *sub-replace-expression* on substitute(). +func Test_sub_replace_1() + " Run the tests with 'magic' on + set magic + set cpo& + call assert_equal('AA', substitute('A', 'A', '&&', '')) + call assert_equal('&', substitute('B', 'B', '\&', '')) + call assert_equal('C123456789987654321', substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '')) + call assert_equal('d', substitute('D', 'D', 'd', '')) + call assert_equal('~', substitute('E', 'E', '~', '')) + call assert_equal('~', substitute('F', 'F', '\~', '')) + call assert_equal('Gg', substitute('G', 'G', '\ugg', '')) + call assert_equal('Hh', substitute('H', 'H', '\Uh\Eh', '')) + call assert_equal('iI', substitute('I', 'I', '\lII', '')) + call assert_equal('jJ', substitute('J', 'J', '\LJ\EJ', '')) + call assert_equal('Kk', substitute('K', 'K', '\Uk\ek', '')) + call assert_equal("l\<C-V>\<C-M>l", + \ substitute('lLl', 'L', "\<C-V>\<C-M>", '')) + call assert_equal("m\<C-M>m", substitute('mMm', 'M', '\r', '')) + call assert_equal("n\<C-V>\<C-M>n", + \ substitute('nNn', 'N', "\\\<C-V>\<C-M>", '')) + call assert_equal("o\no", substitute('oOo', 'O', '\n', '')) + call assert_equal("p\<C-H>p", substitute('pPp', 'P', '\b', '')) + call assert_equal("q\tq", substitute('qQq', 'Q', '\t', '')) + call assert_equal('r\r', substitute('rRr', 'R', '\\', '')) + call assert_equal('scs', substitute('sSs', 'S', '\c', '')) + call assert_equal("u\nu", substitute('uUu', 'U', "\n", '')) + call assert_equal("v\<C-H>v", substitute('vVv', 'V', "\b", '')) + call assert_equal("w\\w", substitute('wWw', 'W', "\\", '')) + call assert_equal("x\<C-M>x", substitute('xXx', 'X', "\r", '')) + call assert_equal("YyyY", substitute('Y', 'Y', '\L\uyYy\l\EY', '')) + call assert_equal("zZZz", substitute('Z', 'Z', '\U\lZzZ\u\Ez', '')) +endfunc + +func Test_sub_replace_2() + " Run the tests with 'magic' off + set nomagic + set cpo& + call assert_equal('AA', substitute('A', 'A', '&&', '')) + call assert_equal('&', substitute('B', 'B', '\&', '')) + call assert_equal('C123456789987654321', substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '')) + call assert_equal('d', substitute('D', 'D', 'd', '')) + call assert_equal('~', substitute('E', 'E', '~', '')) + call assert_equal('~', substitute('F', 'F', '\~', '')) + call assert_equal('Gg', substitute('G', 'G', '\ugg', '')) + call assert_equal('Hh', substitute('H', 'H', '\Uh\Eh', '')) + call assert_equal('iI', substitute('I', 'I', '\lII', '')) + call assert_equal('jJ', substitute('J', 'J', '\LJ\EJ', '')) + call assert_equal('Kk', substitute('K', 'K', '\Uk\ek', '')) + call assert_equal("l\<C-V>\<C-M>l", + \ substitute('lLl', 'L', "\<C-V>\<C-M>", '')) + call assert_equal("m\<C-M>m", substitute('mMm', 'M', '\r', '')) + call assert_equal("n\<C-V>\<C-M>n", + \ substitute('nNn', 'N', "\\\<C-V>\<C-M>", '')) + call assert_equal("o\no", substitute('oOo', 'O', '\n', '')) + call assert_equal("p\<C-H>p", substitute('pPp', 'P', '\b', '')) + call assert_equal("q\tq", substitute('qQq', 'Q', '\t', '')) + call assert_equal('r\r', substitute('rRr', 'R', '\\', '')) + call assert_equal('scs', substitute('sSs', 'S', '\c', '')) + call assert_equal("t\<C-M>t", substitute('tTt', 'T', "\r", '')) + call assert_equal("u\nu", substitute('uUu', 'U', "\n", '')) + call assert_equal("v\<C-H>v", substitute('vVv', 'V', "\b", '')) + call assert_equal('w\w', substitute('wWw', 'W', "\\", '')) + call assert_equal('XxxX', substitute('X', 'X', '\L\uxXx\l\EX', '')) + call assert_equal('yYYy', substitute('Y', 'Y', '\U\lYyY\u\Ey', '')) +endfunc + +func Test_sub_replace_3() + set magic& + set cpo& + call assert_equal('a\a', substitute('aAa', 'A', '\="\\"', '')) + call assert_equal('b\\b', substitute('bBb', 'B', '\="\\\\"', '')) + call assert_equal("c\rc", substitute('cCc', 'C', "\\=\"\r\"", '')) + call assert_equal("d\\\rd", substitute('dDd', 'D', "\\=\"\\\\\r\"", '')) + call assert_equal("e\\\\\re", substitute('eEe', 'E', "\\=\"\\\\\\\\\r\"", '')) + call assert_equal('f\rf', substitute('fFf', 'F', '\="\\r"', '')) + call assert_equal('j\nj', substitute('jJj', 'J', '\="\\n"', '')) + call assert_equal("k\<C-M>k", substitute('kKk', 'K', '\="\r"', '')) + call assert_equal("l\nl", substitute('lLl', 'L', '\="\n"', '')) +endfunc + +" Test for submatch() on substitute(). +func Test_sub_replace_4() + set magic& + set cpo& + call assert_equal('a\a', substitute('aAa', 'A', + \ '\=substitute(submatch(0), ".", "\\", "")', '')) + call assert_equal('b\b', substitute('bBb', 'B', + \ '\=substitute(submatch(0), ".", "\\\\", "")', '')) + call assert_equal("c\<C-V>\<C-M>c", substitute('cCc', 'C', '\=substitute(submatch(0), ".", "\<C-V>\<C-M>", "")', '')) + call assert_equal("d\<C-V>\<C-M>d", substitute('dDd', 'D', '\=substitute(submatch(0), ".", "\\\<C-V>\<C-M>", "")', '')) + call assert_equal("e\\\<C-V>\<C-M>e", substitute('eEe', 'E', '\=substitute(submatch(0), ".", "\\\\\<C-V>\<C-M>", "")', '')) + call assert_equal("f\<C-M>f", substitute('fFf', 'F', '\=substitute(submatch(0), ".", "\\r", "")', '')) + call assert_equal("j\nj", substitute('jJj', 'J', '\=substitute(submatch(0), ".", "\\n", "")', '')) + call assert_equal("k\rk", substitute('kKk', 'K', '\=substitute(submatch(0), ".", "\r", "")', '')) + call assert_equal("l\nl", substitute('lLl', 'L', '\=substitute(submatch(0), ".", "\n", "")', '')) +endfunc + +func Test_sub_replace_5() + set magic& + set cpo& + call assert_equal('A123456789987654321', substitute('A123456789', + \ 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', + \ '\=submatch(0) . submatch(9) . submatch(8) . ' . + \ 'submatch(7) . submatch(6) . submatch(5) . ' . + \ 'submatch(4) . submatch(3) . submatch(2) . submatch(1)', + \ '')) + call assert_equal("[['A123456789'], ['9'], ['8'], ['7'], ['6'], " . + \ "['5'], ['4'], ['3'], ['2'], ['1']]", + \ substitute('A123456789', + \ 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', + \ '\=string([submatch(0, 1), submatch(9, 1), ' . + \ 'submatch(8, 1), submatch(7, 1), submatch(6, 1), ' . + \ 'submatch(5, 1), submatch(4, 1), submatch(3, 1), ' . + \ 'submatch(2, 1), submatch(1, 1)])', + \ '')) +endfunc + +func Test_sub_replace_6() + set magic& + set cpo+=/ + call assert_equal('a', substitute('A', 'A', 'a', '')) + call assert_equal('%', substitute('B', 'B', '%', '')) + set cpo-=/ + call assert_equal('c', substitute('C', 'C', 'c', '')) + call assert_equal('%', substitute('D', 'D', '%', '')) +endfunc + +func Test_sub_replace_7() + set magic& + set cpo& + call assert_equal('AA', substitute('AA', 'A.', '\=submatch(0)', '')) + call assert_equal("B\nB", substitute("B\nB", 'B.', '\=submatch(0)', '')) + call assert_equal("['B\n']B", substitute("B\nB", 'B.', '\=string(submatch(0, 1))', '')) + call assert_equal('-abab', substitute('-bb', '\zeb', 'a', 'g')) + call assert_equal('c-cbcbc', substitute('-bb', '\ze', 'c', 'g')) +endfunc + +" Test for *:s%* on :substitute. +func Test_sub_replace_8() + new + set magic& + set cpo& + $put =',,X' + s/\(^\|,\)\ze\(,\|X\)/\1N/g + call assert_equal('N,,NX', getline("$")) + $put =',,Y' + let cmd = ':s/\(^\|,\)\ze\(,\|Y\)/\1N/gc' + call feedkeys(cmd . "\<CR>a", "xt") + call assert_equal('N,,NY', getline("$")) + :$put =',,Z' + let cmd = ':s/\(^\|,\)\ze\(,\|Z\)/\1N/gc' + call feedkeys(cmd . "\<CR>yy", "xt") + call assert_equal('N,,NZ', getline("$")) + enew! | close +endfunc + +func Test_sub_replace_9() + new + set magic& + set cpo& + $put ='xxx' + call feedkeys(":s/x/X/gc\<CR>yyq", "xt") + call assert_equal('XXx', getline("$")) + enew! | close +endfunc + +func Test_sub_replace_10() + set magic& + set cpo& + call assert_equal('a1a2a3a', substitute('123', '\zs', 'a', 'g')) + call assert_equal('aaa', substitute('123', '\zs.', 'a', 'g')) + call assert_equal('1a2a3a', substitute('123', '.\zs', 'a', 'g')) + call assert_equal('a1a2a3a', substitute('123', '\ze', 'a', 'g')) + call assert_equal('a1a2a3', substitute('123', '\ze.', 'a', 'g')) + call assert_equal('aaa', substitute('123', '.\ze', 'a', 'g')) + call assert_equal('aa2a3a', substitute('123', '1\|\ze', 'a', 'g')) + call assert_equal('1aaa', substitute('123', '1\zs\|[23]', 'a', 'g')) +endfunc + +" Tests for *sub-replace-special* and *sub-replace-expression* on :substitute. + +" Execute a list of :substitute command tests +func Run_SubCmd_Tests(tests) + enew! + for t in a:tests + let start = line('.') + 1 + let end = start + len(t[2]) - 1 + exe "normal o" . t[0] + call cursor(start, 1) + exe t[1] + call assert_equal(t[2], getline(start, end), t[1]) + endfor + enew! +endfunc + +func Test_sub_cmd_1() + set magic + set cpo& + + " List entry format: [input, cmd, output] + let tests = [['A', 's/A/&&/', ['AA']], + \ ['B', 's/B/\&/', ['&']], + \ ['C123456789', 's/C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/', ['C123456789987654321']], + \ ['D', 's/D/d/', ['d']], + \ ['E', 's/E/~/', ['d']], + \ ['F', 's/F/\~/', ['~']], + \ ['G', 's/G/\ugg/', ['Gg']], + \ ['H', 's/H/\Uh\Eh/', ['Hh']], + \ ['I', 's/I/\lII/', ['iI']], + \ ['J', 's/J/\LJ\EJ/', ['jJ']], + \ ['K', 's/K/\Uk\ek/', ['Kk']], + \ ['lLl', "s/L/\<C-V>\<C-M>/", ["l\<C-V>", 'l']], + \ ['mMm', 's/M/\r/', ['m', 'm']], + \ ['nNn', "s/N/\\\<C-V>\<C-M>/", ["n\<C-V>", 'n']], + \ ['oOo', 's/O/\n/', ["o\no"]], + \ ['pPp', 's/P/\b/', ["p\<C-H>p"]], + \ ['qQq', 's/Q/\t/', ["q\tq"]], + \ ['rRr', 's/R/\\/', ['r\r']], + \ ['sSs', 's/S/\c/', ['scs']], + \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], + \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], + \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']] + \ ] + call Run_SubCmd_Tests(tests) +endfunc + +func Test_sub_cmd_2() + set nomagic + set cpo& + + " List entry format: [input, cmd, output] + let tests = [['A', 's/A/&&/', ['&&']], + \ ['B', 's/B/\&/', ['B']], + \ ['C123456789', 's/\mC\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/', ['C123456789987654321']], + \ ['D', 's/D/d/', ['d']], + \ ['E', 's/E/~/', ['~']], + \ ['F', 's/F/\~/', ['~']], + \ ['G', 's/G/\ugg/', ['Gg']], + \ ['H', 's/H/\Uh\Eh/', ['Hh']], + \ ['I', 's/I/\lII/', ['iI']], + \ ['J', 's/J/\LJ\EJ/', ['jJ']], + \ ['K', 's/K/\Uk\ek/', ['Kk']], + \ ['lLl', "s/L/\<C-V>\<C-M>/", ["l\<C-V>", 'l']], + \ ['mMm', 's/M/\r/', ['m', 'm']], + \ ['nNn', "s/N/\\\<C-V>\<C-M>/", ["n\<C-V>", 'n']], + \ ['oOo', 's/O/\n/', ["o\no"]], + \ ['pPp', 's/P/\b/', ["p\<C-H>p"]], + \ ['qQq', 's/Q/\t/', ["q\tq"]], + \ ['rRr', 's/R/\\/', ['r\r']], + \ ['sSs', 's/S/\c/', ['scs']], + \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], + \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], + \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']] + \ ] + call Run_SubCmd_Tests(tests) +endfunc + +func Test_sub_cmd_3() + set nomagic + set cpo& + + " List entry format: [input, cmd, output] + let tests = [['aAa', "s/A/\\='\\'/", ['a\a']], + \ ['bBb', "s/B/\\='\\\\'/", ['b\\b']], + \ ['cCc', "s/C/\\='\<C-V>\<C-M>'/", ["c\<C-V>", 'c']], + \ ['dDd', "s/D/\\='\\\<C-V>\<C-M>'/", ["d\\\<C-V>", 'd']], + \ ['eEe', "s/E/\\='\\\\\<C-V>\<C-M>'/", ["e\\\\\<C-V>", 'e']], + \ ['fFf', "s/F/\\='\r'/", ['f', 'f']], + \ ['gGg', "s/G/\\='\<C-V>\<C-J>'/", ["g\<C-V>", 'g']], + \ ['hHh', "s/H/\\='\\\<C-V>\<C-J>'/", ["h\\\<C-V>", 'h']], + \ ['iIi', "s/I/\\='\\\\\<C-V>\<C-J>'/", ["i\\\\\<C-V>", 'i']], + \ ['jJj', "s/J/\\='\n'/", ['j', 'j']], + \ ['kKk', 's/K/\="\r"/', ['k', 'k']], + \ ['lLl', 's/L/\="\n"/', ['l', 'l']] + \ ] + call Run_SubCmd_Tests(tests) +endfunc + +" Test for submatch() on :substitue. +func Test_sub_cmd_4() + set magic& + set cpo& + + " List entry format: [input, cmd, output] + let tests = [ ['aAa', "s/A/\\=substitute(submatch(0), '.', '\\', '')/", + \ ['a\a']], + \ ['bBb', "s/B/\\=substitute(submatch(0), '.', '\\', '')/", + \ ['b\b']], + \ ['cCc', "s/C/\\=substitute(submatch(0), '.', '\<C-V>\<C-M>', '')/", + \ ["c\<C-V>", 'c']], + \ ['dDd', "s/D/\\=substitute(submatch(0), '.', '\\\<C-V>\<C-M>', '')/", + \ ["d\<C-V>", 'd']], + \ ['eEe', "s/E/\\=substitute(submatch(0), '.', '\\\\\<C-V>\<C-M>', '')/", + \ ["e\\\<C-V>", 'e']], + \ ['fFf', "s/F/\\=substitute(submatch(0), '.', '\\r', '')/", + \ ['f', 'f']], + \ ['gGg', 's/G/\=substitute(submatch(0), ".", "\<C-V>\<C-J>", "")/', + \ ["g\<C-V>", 'g']], + \ ['hHh', 's/H/\=substitute(submatch(0), ".", "\\\<C-V>\<C-J>", "")/', + \ ["h\<C-V>", 'h']], + \ ['iIi', 's/I/\=substitute(submatch(0), ".", "\\\\\<C-V>\<C-J>", "")/', + \ ["i\\\<C-V>", 'i']], + \ ['jJj', "s/J/\\=substitute(submatch(0), '.', '\\n', '')/", + \ ['j', 'j']], + \ ['kKk', "s/K/\\=substitute(submatch(0), '.', '\\r', '')/", + \ ['k', 'k']], + \ ['lLl', "s/L/\\=substitute(submatch(0), '.', '\\n', '')/", + \ ['l', 'l']], + \ ] + call Run_SubCmd_Tests(tests) +endfunc + +func Test_sub_cmd_5() + set magic& + set cpo& + + " List entry format: [input, cmd, output] + let tests = [ ['A123456789', 's/A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)/', ['A123456789987654321']], + \ ['B123456789', 's/B\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])/', ["[['B123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], ['2'], ['1']]"]], + \ ] + call Run_SubCmd_Tests(tests) +endfunc + +" Test for *:s%* on :substitute. +func Test_sub_cmd_6() + set magic& + set cpo+=/ + + " List entry format: [input, cmd, output] + let tests = [ ['A', 's/A/a/', ['a']], + \ ['B', 's/B/%/', ['a']], + \ ] + call Run_SubCmd_Tests(tests) + + set cpo-=/ + let tests = [ ['C', 's/C/c/', ['c']], + \ ['D', 's/D/%/', ['%']], + \ ] + call Run_SubCmd_Tests(tests) + + set cpo& +endfunc + +" Test for :s replacing \n with line break. +func Test_sub_cmd_7() + set magic& + set cpo& + + " List entry format: [input, cmd, output] + let tests = [ ["A\<C-V>\<C-M>A", 's/A./\=submatch(0)/', ['A', 'A']], + \ ["B\<C-V>\<C-J>B", 's/B./\=submatch(0)/', ['B', 'B']], + \ ["C\<C-V>\<C-J>C", 's/C./\=strtrans(string(submatch(0, 1)))/', [strtrans("['C\<C-J>']C")]], + \ ["D\<C-V>\<C-J>\nD", 's/D.\nD/\=strtrans(string(submatch(0, 1)))/', [strtrans("['D\<C-J>', 'D']")]], + \ ["E\<C-V>\<C-J>\n\<C-V>\<C-J>\n\<C-V>\<C-J>\n\<C-V>\<C-J>\n\<C-V>\<C-J>E", 's/E\_.\{-}E/\=strtrans(string(submatch(0, 1)))/', [strtrans("['E\<C-J>', '\<C-J>', '\<C-J>', '\<C-J>', '\<C-J>E']")]], + \ ] + call Run_SubCmd_Tests(tests) + + exe "normal oQ\nQ\<Esc>k" + call assert_fails('s/Q[^\n]Q/\=submatch(0)."foobar"/', 'E486') + enew! +endfunc + +func TitleString() + let check = 'foo' =~ 'bar' + return "" +endfunc + +func Test_sub_cmd_8() + set titlestring=%{TitleString()} + + enew! + call append(0, ['', 'test_one', 'test_two']) + call cursor(1,1) + /^test_one/s/.*/\="foo\nbar"/ + call assert_equal('foo', getline(2)) + call assert_equal('bar', getline(3)) + call feedkeys(':/^test_two/s/.*/\="foo\nbar"/c', "t") + call feedkeys("\<CR>y", "xt") + call assert_equal('foo', getline(4)) + call assert_equal('bar', getline(5)) + + enew! + set titlestring& +endfunc diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim new file mode 100644 index 0000000000..da5da2dbbd --- /dev/null +++ b/src/testdir/test_swap.vim @@ -0,0 +1,99 @@ +" Tests for the swap feature + +" Tests for 'directory' option. +func Test_swap_directory() + if !has("unix") + return + endif + let content = ['start of testfile', + \ 'line 2 Abcdefghij', + \ 'line 3 Abcdefghij', + \ 'end of testfile'] + call writefile(content, 'Xtest1') + + " '.', swap file in the same directory as file + set dir=.,~ + + " Verify that the swap file doesn't exist in the current directory + call assert_equal([], glob(".Xtest1*.swp", 1, 1, 1)) + edit Xtest1 + let swfname = split(execute("swapname"))[0] + call assert_equal([swfname], glob(swfname, 1, 1, 1)) + + " './dir', swap file in a directory relative to the file + set dir=./Xtest2,.,~ + + call mkdir("Xtest2") + edit Xtest1 + call assert_equal([], glob(swfname, 1, 1, 1)) + let swfname = "Xtest2/Xtest1.swp" + call assert_equal(swfname, split(execute("swapname"))[0]) + call assert_equal([swfname], glob("Xtest2/*", 1, 1, 1)) + + " 'dir', swap file in directory relative to the current dir + set dir=Xtest.je,~ + + call mkdir("Xtest.je") + call writefile(content, 'Xtest2/Xtest3') + edit Xtest2/Xtest3 + call assert_equal(["Xtest2/Xtest3"], glob("Xtest2/*", 1, 1, 1)) + let swfname = "Xtest.je/Xtest3.swp" + call assert_equal(swfname, split(execute("swapname"))[0]) + call assert_equal([swfname], glob("Xtest.je/*", 1, 1, 1)) + + set dir& + call delete("Xtest1") + call delete("Xtest2", "rf") + call delete("Xtest.je", "rf") +endfunc + +func Test_swap_group() + if !has("unix") + return + endif + let groups = split(system('groups')) + if len(groups) <= 1 + throw 'Skipped: need at least two groups, got ' . string(groups) + endif + + try + call delete('Xtest') + split Xtest + call setline(1, 'just some text') + wq + if system('ls -l Xtest') !~ ' ' . groups[0] . ' \d' + throw 'Skipped: test file does not have the first group' + else + silent !chmod 640 Xtest + call system('chgrp ' . groups[1] . ' Xtest') + if system('ls -l Xtest') !~ ' ' . groups[1] . ' \d' + throw 'Skipped: cannot set second group on test file' + else + split Xtest + let swapname = substitute(execute('swapname'), '[[:space:]]', '', 'g') + call assert_match('Xtest', swapname) + " Group of swapfile must now match original file. + call assert_match(' ' . groups[1] . ' \d', system('ls -l ' . swapname)) + + bwipe! + endif + endif + finally + call delete('Xtest') + endtry +endfunc + +func Test_missing_dir() + call mkdir('Xswapdir') + exe 'set directory=' . getcwd() . '/Xswapdir' + + call assert_equal('', glob('foo')) + call assert_equal('', glob('bar')) + edit foo/x.txt + " This should not give a warning for an existing swap file. + split bar/x.txt + only + + set directory& + call delete('Xswapdir', 'rf') +endfunc diff --git a/src/testdir/test_syn_attr.vim b/src/testdir/test_syn_attr.vim new file mode 100644 index 0000000000..27f9fc0dde --- /dev/null +++ b/src/testdir/test_syn_attr.vim @@ -0,0 +1,818 @@ +" Test syntax highlighting functions. + +func Test_missing_attr() + hi Mine term=bold cterm=italic + call assert_equal('Mine', synIDattr(hlID("Mine"), "name")) + call assert_equal('', synIDattr(hlID("Mine"), "bg", 'term')) + call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term')) + call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm')) + hi Mine term=reverse cterm=inverse + call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term')) + call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm')) + hi Mine term=underline cterm=standout gui=undercurl + call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term')) + call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm')) + call assert_equal('1', synIDattr(hlID("Mine"), "undercurl", 'gui')) + hi Mine term=NONE cterm=NONE gui=NONE + call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term')) + call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm')) + call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term')) + call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm')) + call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term')) + call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm')) + call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui')) + + if has('gui') + let fontname = getfontname() + if fontname == '' + let fontname = 'something' + endif + exe "hi Mine guifg=blue guibg=red font='" . fontname . "'" + call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui')) + call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui')) + call assert_equal(fontname, synIDattr(hlID("Mine"), "font", 'gui')) + endif +endfunc + +func Test_color_names() + let colors = [ + \ 'AliceBlue', + \ 'AntiqueWhite', + \ 'AntiqueWhite1', + \ 'AntiqueWhite2', + \ 'AntiqueWhite3', + \ 'AntiqueWhite4', + \ 'BlanchedAlmond', + \ 'BlueViolet', + \ 'CadetBlue', + \ 'CadetBlue1', + \ 'CadetBlue2', + \ 'CadetBlue3', + \ 'CadetBlue4', + \ 'CornflowerBlue', + \ 'DarkBlue', + \ 'DarkCyan', + \ 'DarkGoldenrod', + \ 'DarkGoldenrod1', + \ 'DarkGoldenrod2', + \ 'DarkGoldenrod3', + \ 'DarkGoldenrod4', + \ 'DarkGray', + \ 'DarkGreen', + \ 'DarkGrey', + \ 'DarkKhaki', + \ 'DarkMagenta', + \ 'DarkOliveGreen', + \ 'DarkOliveGreen1', + \ 'DarkOliveGreen2', + \ 'DarkOliveGreen3', + \ 'DarkOliveGreen4', + \ 'DarkOrange', + \ 'DarkOrange1', + \ 'DarkOrange2', + \ 'DarkOrange3', + \ 'DarkOrange4', + \ 'DarkOrchid', + \ 'DarkOrchid1', + \ 'DarkOrchid2', + \ 'DarkOrchid3', + \ 'DarkOrchid4', + \ 'DarkRed', + \ 'DarkSalmon', + \ 'DarkSeaGreen', + \ 'DarkSeaGreen1', + \ 'DarkSeaGreen2', + \ 'DarkSeaGreen3', + \ 'DarkSeaGreen4', + \ 'DarkSlateBlue', + \ 'DarkSlateGray', + \ 'DarkSlateGray1', + \ 'DarkSlateGray2', + \ 'DarkSlateGray3', + \ 'DarkSlateGray4', + \ 'DarkSlateGrey', + \ 'DarkTurquoise', + \ 'DarkViolet', + \ 'DeepPink', + \ 'DeepPink1', + \ 'DeepPink2', + \ 'DeepPink3', + \ 'DeepPink4', + \ 'DeepSkyBlue', + \ 'DeepSkyBlue1', + \ 'DeepSkyBlue2', + \ 'DeepSkyBlue3', + \ 'DeepSkyBlue4', + \ 'DimGray', + \ 'DimGrey', + \ 'DodgerBlue', + \ 'DodgerBlue1', + \ 'DodgerBlue2', + \ 'DodgerBlue3', + \ 'DodgerBlue4', + \ 'FloralWhite', + \ 'ForestGreen', + \ 'GhostWhite', + \ 'GreenYellow', + \ 'HotPink', + \ 'HotPink1', + \ 'HotPink2', + \ 'HotPink3', + \ 'HotPink4', + \ 'IndianRed', + \ 'IndianRed1', + \ 'IndianRed2', + \ 'IndianRed3', + \ 'IndianRed4', + \ 'LavenderBlush', + \ 'LavenderBlush1', + \ 'LavenderBlush2', + \ 'LavenderBlush3', + \ 'LavenderBlush4', + \ 'LawnGreen', + \ 'LemonChiffon', + \ 'LemonChiffon1', + \ 'LemonChiffon2', + \ 'LemonChiffon3', + \ 'LemonChiffon4', + \ 'LightBlue', + \ 'LightBlue1', + \ 'LightBlue2', + \ 'LightBlue3', + \ 'LightBlue4', + \ 'LightCoral', + \ 'LightCyan', + \ 'LightCyan1', + \ 'LightCyan2', + \ 'LightCyan3', + \ 'LightCyan4', + \ 'LightGoldenrod', + \ 'LightGoldenrod1', + \ 'LightGoldenrod2', + \ 'LightGoldenrod3', + \ 'LightGoldenrod4', + \ 'LightGoldenrodYellow', + \ 'LightGray', + \ 'LightGreen', + \ 'LightGrey', + \ 'LightPink', + \ 'LightPink1', + \ 'LightPink2', + \ 'LightPink3', + \ 'LightPink4', + \ 'LightSalmon', + \ 'LightSalmon1', + \ 'LightSalmon2', + \ 'LightSalmon3', + \ 'LightSalmon4', + \ 'LightSeaGreen', + \ 'LightSkyBlue', + \ 'LightSkyBlue1', + \ 'LightSkyBlue2', + \ 'LightSkyBlue3', + \ 'LightSkyBlue4', + \ 'LightSlateBlue', + \ 'LightSlateGray', + \ 'LightSlateGrey', + \ 'LightSteelBlue', + \ 'LightSteelBlue1', + \ 'LightSteelBlue2', + \ 'LightSteelBlue3', + \ 'LightSteelBlue4', + \ 'LightYellow', + \ 'LightYellow1', + \ 'LightYellow2', + \ 'LightYellow3', + \ 'LightYellow4', + \ 'LimeGreen', + \ 'MediumAquamarine', + \ 'MediumBlue', + \ 'MediumOrchid', + \ 'MediumOrchid1', + \ 'MediumOrchid2', + \ 'MediumOrchid3', + \ 'MediumOrchid4', + \ 'MediumPurple', + \ 'MediumPurple1', + \ 'MediumPurple2', + \ 'MediumPurple3', + \ 'MediumPurple4', + \ 'MediumSeaGreen', + \ 'MediumSlateBlue', + \ 'MediumSpringGreen', + \ 'MediumTurquoise', + \ 'MediumVioletRed', + \ 'MidnightBlue', + \ 'MintCream', + \ 'MistyRose', + \ 'MistyRose1', + \ 'MistyRose2', + \ 'MistyRose3', + \ 'MistyRose4', + \ 'NavajoWhite', + \ 'NavajoWhite1', + \ 'NavajoWhite2', + \ 'NavajoWhite3', + \ 'NavajoWhite4', + \ 'NavyBlue', + \ 'OldLace', + \ 'OliveDrab', + \ 'OliveDrab1', + \ 'OliveDrab2', + \ 'OliveDrab3', + \ 'OliveDrab4', + \ 'OrangeRed', + \ 'OrangeRed1', + \ 'OrangeRed2', + \ 'OrangeRed3', + \ 'OrangeRed4', + \ 'PaleGoldenrod', + \ 'PaleGreen', + \ 'PaleGreen1', + \ 'PaleGreen2', + \ 'PaleGreen3', + \ 'PaleGreen4', + \ 'PaleTurquoise', + \ 'PaleTurquoise1', + \ 'PaleTurquoise2', + \ 'PaleTurquoise3', + \ 'PaleTurquoise4', + \ 'PaleVioletRed', + \ 'PaleVioletRed1', + \ 'PaleVioletRed2', + \ 'PaleVioletRed3', + \ 'PaleVioletRed4', + \ 'PapayaWhip', + \ 'PeachPuff', + \ 'PeachPuff1', + \ 'PeachPuff2', + \ 'PeachPuff3', + \ 'PeachPuff4', + \ 'PowderBlue', + \ 'RosyBrown', + \ 'RosyBrown1', + \ 'RosyBrown2', + \ 'RosyBrown3', + \ 'RosyBrown4', + \ 'RoyalBlue', + \ 'RoyalBlue1', + \ 'RoyalBlue2', + \ 'RoyalBlue3', + \ 'RoyalBlue4', + \ 'SaddleBrown', + \ 'SandyBrown', + \ 'SeaGreen', + \ 'SeaGreen1', + \ 'SeaGreen2', + \ 'SeaGreen3', + \ 'SeaGreen4', + \ 'SkyBlue', + \ 'SkyBlue1', + \ 'SkyBlue2', + \ 'SkyBlue3', + \ 'SkyBlue4', + \ 'SlateBlue', + \ 'SlateBlue1', + \ 'SlateBlue2', + \ 'SlateBlue3', + \ 'SlateBlue4', + \ 'SlateGray', + \ 'SlateGray1', + \ 'SlateGray2', + \ 'SlateGray3', + \ 'SlateGray4', + \ 'SlateGrey', + \ 'SpringGreen', + \ 'SpringGreen1', + \ 'SpringGreen2', + \ 'SpringGreen3', + \ 'SpringGreen4', + \ 'SteelBlue', + \ 'SteelBlue1', + \ 'SteelBlue2', + \ 'SteelBlue3', + \ 'SteelBlue4', + \ 'VioletRed', + \ 'VioletRed1', + \ 'VioletRed2', + \ 'VioletRed3', + \ 'VioletRed4', + \ 'WhiteSmoke', + \ 'YellowGreen', + \ 'alice blue', + \ 'antique white', + \ 'aquamarine', + \ 'aquamarine1', + \ 'aquamarine2', + \ 'aquamarine3', + \ 'aquamarine4', + \ 'azure', + \ 'azure1', + \ 'azure2', + \ 'azure3', + \ 'azure4', + \ 'beige', + \ 'bisque', + \ 'bisque1', + \ 'bisque2', + \ 'bisque3', + \ 'bisque4', + \ 'black', + \ 'blanched almond', + \ 'blue violet', + \ 'blue', + \ 'blue1', + \ 'blue2', + \ 'blue3', + \ 'blue4', + \ 'brown', + \ 'brown1', + \ 'brown2', + \ 'brown3', + \ 'brown4', + \ 'burlywood', + \ 'burlywood1', + \ 'burlywood2', + \ 'burlywood3', + \ 'burlywood4', + \ 'cadet blue', + \ 'chartreuse', + \ 'chartreuse1', + \ 'chartreuse2', + \ 'chartreuse3', + \ 'chartreuse4', + \ 'chocolate', + \ 'chocolate1', + \ 'chocolate2', + \ 'chocolate3', + \ 'chocolate4', + \ 'coral', + \ 'coral1', + \ 'coral2', + \ 'coral3', + \ 'coral4', + \ 'cornflower blue', + \ 'cornsilk', + \ 'cornsilk1', + \ 'cornsilk2', + \ 'cornsilk3', + \ 'cornsilk4', + \ 'cyan', + \ 'cyan1', + \ 'cyan2', + \ 'cyan3', + \ 'cyan4', + \ 'dark blue', + \ 'dark cyan', + \ 'dark goldenrod', + \ 'dark gray', + \ 'dark green', + \ 'dark grey', + \ 'dark khaki', + \ 'dark magenta', + \ 'dark olive green', + \ 'dark orange', + \ 'dark orchid', + \ 'dark red', + \ 'dark salmon', + \ 'dark sea green', + \ 'dark slate blue', + \ 'dark slate gray', + \ 'dark slate grey', + \ 'dark turquoise', + \ 'dark violet', + \ 'darkblue', + \ 'darkcyan', + \ 'darkgray', + \ 'darkgreen', + \ 'darkgrey', + \ 'darkmagenta', + \ 'darkred', + \ 'darkyellow', + \ 'deep pink', + \ 'deep sky blue', + \ 'dim gray', + \ 'dim grey', + \ 'dodger blue', + \ 'firebrick', + \ 'firebrick1', + \ 'firebrick2', + \ 'firebrick3', + \ 'firebrick4', + \ 'floral white', + \ 'forest green', + \ 'gainsboro', + \ 'ghost white', + \ 'gold', + \ 'gold1', + \ 'gold2', + \ 'gold3', + \ 'gold4', + \ 'goldenrod', + \ 'goldenrod1', + \ 'goldenrod2', + \ 'goldenrod3', + \ 'goldenrod4', + \ 'gray', + \ 'gray0', + \ 'gray1', + \ 'gray10', + \ 'gray100', + \ 'gray11', + \ 'gray12', + \ 'gray13', + \ 'gray14', + \ 'gray15', + \ 'gray16', + \ 'gray17', + \ 'gray18', + \ 'gray19', + \ 'gray2', + \ 'gray20', + \ 'gray21', + \ 'gray22', + \ 'gray23', + \ 'gray24', + \ 'gray25', + \ 'gray26', + \ 'gray27', + \ 'gray28', + \ 'gray29', + \ 'gray3', + \ 'gray30', + \ 'gray31', + \ 'gray32', + \ 'gray33', + \ 'gray34', + \ 'gray35', + \ 'gray36', + \ 'gray37', + \ 'gray38', + \ 'gray39', + \ 'gray4', + \ 'gray40', + \ 'gray41', + \ 'gray42', + \ 'gray43', + \ 'gray44', + \ 'gray45', + \ 'gray46', + \ 'gray47', + \ 'gray48', + \ 'gray49', + \ 'gray5', + \ 'gray50', + \ 'gray51', + \ 'gray52', + \ 'gray53', + \ 'gray54', + \ 'gray55', + \ 'gray56', + \ 'gray57', + \ 'gray58', + \ 'gray59', + \ 'gray6', + \ 'gray60', + \ 'gray61', + \ 'gray62', + \ 'gray63', + \ 'gray64', + \ 'gray65', + \ 'gray66', + \ 'gray67', + \ 'gray68', + \ 'gray69', + \ 'gray7', + \ 'gray70', + \ 'gray71', + \ 'gray72', + \ 'gray73', + \ 'gray74', + \ 'gray75', + \ 'gray76', + \ 'gray77', + \ 'gray78', + \ 'gray79', + \ 'gray8', + \ 'gray80', + \ 'gray81', + \ 'gray82', + \ 'gray83', + \ 'gray84', + \ 'gray85', + \ 'gray86', + \ 'gray87', + \ 'gray88', + \ 'gray89', + \ 'gray9', + \ 'gray90', + \ 'gray91', + \ 'gray92', + \ 'gray93', + \ 'gray94', + \ 'gray95', + \ 'gray96', + \ 'gray97', + \ 'gray98', + \ 'gray99', + \ 'green yellow', + \ 'green', + \ 'green1', + \ 'green2', + \ 'green3', + \ 'green4', + \ 'grey', + \ 'grey0', + \ 'grey1', + \ 'grey10', + \ 'grey100', + \ 'grey11', + \ 'grey12', + \ 'grey13', + \ 'grey14', + \ 'grey15', + \ 'grey16', + \ 'grey17', + \ 'grey18', + \ 'grey19', + \ 'grey2', + \ 'grey20', + \ 'grey21', + \ 'grey22', + \ 'grey23', + \ 'grey24', + \ 'grey25', + \ 'grey26', + \ 'grey27', + \ 'grey28', + \ 'grey29', + \ 'grey3', + \ 'grey30', + \ 'grey31', + \ 'grey32', + \ 'grey33', + \ 'grey34', + \ 'grey35', + \ 'grey36', + \ 'grey37', + \ 'grey38', + \ 'grey39', + \ 'grey4', + \ 'grey40', + \ 'grey41', + \ 'grey42', + \ 'grey43', + \ 'grey44', + \ 'grey45', + \ 'grey46', + \ 'grey47', + \ 'grey48', + \ 'grey49', + \ 'grey5', + \ 'grey50', + \ 'grey51', + \ 'grey52', + \ 'grey53', + \ 'grey54', + \ 'grey55', + \ 'grey56', + \ 'grey57', + \ 'grey58', + \ 'grey59', + \ 'grey6', + \ 'grey60', + \ 'grey61', + \ 'grey62', + \ 'grey63', + \ 'grey64', + \ 'grey65', + \ 'grey66', + \ 'grey67', + \ 'grey68', + \ 'grey69', + \ 'grey7', + \ 'grey70', + \ 'grey71', + \ 'grey72', + \ 'grey73', + \ 'grey74', + \ 'grey75', + \ 'grey76', + \ 'grey77', + \ 'grey78', + \ 'grey79', + \ 'grey8', + \ 'grey80', + \ 'grey81', + \ 'grey82', + \ 'grey83', + \ 'grey84', + \ 'grey85', + \ 'grey86', + \ 'grey87', + \ 'grey88', + \ 'grey89', + \ 'grey9', + \ 'grey90', + \ 'grey91', + \ 'grey92', + \ 'grey93', + \ 'grey94', + \ 'grey95', + \ 'grey96', + \ 'grey97', + \ 'grey98', + \ 'grey99', + \ 'honeydew', + \ 'honeydew1', + \ 'honeydew2', + \ 'honeydew3', + \ 'honeydew4', + \ 'hot pink', + \ 'indian red', + \ 'ivory', + \ 'ivory1', + \ 'ivory2', + \ 'ivory3', + \ 'ivory4', + \ 'khaki', + \ 'khaki1', + \ 'khaki2', + \ 'khaki3', + \ 'khaki4', + \ 'lavender blush', + \ 'lavender', + \ 'lawn green', + \ 'lemon chiffon', + \ 'light blue', + \ 'light coral', + \ 'light cyan', + \ 'light goldenrod yellow', + \ 'light goldenrod', + \ 'light gray', + \ 'light green', + \ 'light grey', + \ 'light pink', + \ 'light salmon', + \ 'light sea green', + \ 'light sky blue', + \ 'light slate blue', + \ 'light slate gray', + \ 'light slate grey', + \ 'light steel blue', + \ 'light yellow', + \ 'lightblue', + \ 'lightcyan', + \ 'lightgray', + \ 'lightgreen', + \ 'lightgrey', + \ 'lightmagenta', + \ 'lightred', + \ 'lightyellow', + \ 'lime green', + \ 'linen', + \ 'magenta', + \ 'magenta1', + \ 'magenta2', + \ 'magenta3', + \ 'magenta4', + \ 'maroon', + \ 'maroon1', + \ 'maroon2', + \ 'maroon3', + \ 'maroon4', + \ 'medium aquamarine', + \ 'medium blue', + \ 'medium orchid', + \ 'medium purple', + \ 'medium sea green', + \ 'medium slate blue', + \ 'medium spring green', + \ 'medium turquoise', + \ 'medium violet red', + \ 'midnight blue', + \ 'mint cream', + \ 'misty rose', + \ 'moccasin', + \ 'navajo white', + \ 'navy blue', + \ 'navy', + \ 'old lace', + \ 'olive drab', + \ 'orange red', + \ 'orange', + \ 'orange1', + \ 'orange2', + \ 'orange3', + \ 'orange4', + \ 'orchid', + \ 'orchid1', + \ 'orchid2', + \ 'orchid3', + \ 'orchid4', + \ 'pale goldenrod', + \ 'pale green', + \ 'pale turquoise', + \ 'pale violet red', + \ 'papaya whip', + \ 'peach puff', + \ 'peru', + \ 'pink', + \ 'pink1', + \ 'pink2', + \ 'pink3', + \ 'pink4', + \ 'plum', + \ 'plum1', + \ 'plum2', + \ 'plum3', + \ 'plum4', + \ 'powder blue', + \ 'purple', + \ 'purple1', + \ 'purple2', + \ 'purple3', + \ 'purple4', + \ 'red', + \ 'red1', + \ 'red2', + \ 'red3', + \ 'red4', + \ 'rosy brown', + \ 'royal blue', + \ 'saddle brown', + \ 'salmon', + \ 'salmon1', + \ 'salmon2', + \ 'salmon3', + \ 'salmon4', + \ 'sandy brown', + \ 'sea green', + \ 'seagreen', + \ 'seashell', + \ 'seashell1', + \ 'seashell2', + \ 'seashell3', + \ 'seashell4', + \ 'sienna', + \ 'sienna1', + \ 'sienna2', + \ 'sienna3', + \ 'sienna4', + \ 'sky blue', + \ 'slate blue', + \ 'slate gray', + \ 'slate grey', + \ 'slateblue', + \ 'snow', + \ 'snow1', + \ 'snow2', + \ 'snow3', + \ 'snow4', + \ 'spring green', + \ 'steel blue', + \ 'tan', + \ 'tan1', + \ 'tan2', + \ 'tan3', + \ 'tan4', + \ 'thistle', + \ 'thistle1', + \ 'thistle2', + \ 'thistle3', + \ 'thistle4', + \ 'tomato', + \ 'tomato1', + \ 'tomato2', + \ 'tomato3', + \ 'tomato4', + \ 'turquoise', + \ 'turquoise1', + \ 'turquoise2', + \ 'turquoise3', + \ 'turquoise4', + \ 'violet red', + \ 'violet', + \ 'wheat', + \ 'wheat1', + \ 'wheat2', + \ 'wheat3', + \ 'wheat4', + \ 'white smoke', + \ 'white', + \ 'yellow green', + \ 'yellow', + \ 'yellow1', + \ 'yellow2', + \ 'yellow3', + \ 'yellow4', + \ ] + for color in colors + " just test that the color name can be found. + exe "hi Mine guifg='" . color . "'" + endfor + + " case is ignored + hi Mine guifg=blanchedalmond + hi Mine guifg=BLANCHEDALMOND +endfunc diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim new file mode 100644 index 0000000000..e49c8ed895 --- /dev/null +++ b/src/testdir/test_syntax.vim @@ -0,0 +1,564 @@ +" Test for syntax and syntax iskeyword option + +if !has("syntax") + finish +endif + +source view_util.vim +source screendump.vim + +func GetSyntaxItem(pat) + let c = '' + let a = ['a', getreg('a'), getregtype('a')] + 0 + redraw! + call search(a:pat, 'W') + let synid = synID(line('.'), col('.'), 1) + while synid == synID(line('.'), col('.'), 1) + norm! v"ay + " stop at whitespace + if @a =~# '\s' + break + endif + let c .= @a + norm! l + endw + call call('setreg', a) + 0 + return c +endfunc + +func Test_syn_iskeyword() + new + call setline(1, [ + \ 'CREATE TABLE FOOBAR(', + \ ' DLTD_BY VARCHAR2(100)', + \ ');', + \ '']) + + syntax on + set ft=sql + syn match SYN /C\k\+\>/ + hi link SYN ErrorMsg + call assert_equal('DLTD_BY', GetSyntaxItem('DLTD')) + /\<D\k\+\>/:norm! ygn + call assert_equal('DLTD_BY', @0) + redir @c + syn iskeyword + redir END + call assert_equal("\nsyntax iskeyword not set", @c) + + syn iskeyword @,48-57,_,192-255 + redir @c + syn iskeyword + redir END + call assert_equal("\nsyntax iskeyword @,48-57,_,192-255", @c) + + setlocal isk-=_ + call assert_equal('DLTD_BY', GetSyntaxItem('DLTD')) + /\<D\k\+\>/:norm! ygn + let b2 = @0 + call assert_equal('DLTD', @0) + + syn iskeyword clear + redir @c + syn iskeyword + redir END + call assert_equal("\nsyntax iskeyword not set", @c) + + quit! +endfunc + +func Test_syntax_after_reload() + split Xsomefile + call setline(1, ['hello', 'there']) + w! + only! + setl filetype=hello + au FileType hello let g:gotit = 1 + call assert_false(exists('g:gotit')) + edit other + buf Xsomefile + call assert_equal('hello', &filetype) + call assert_true(exists('g:gotit')) + call delete('Xsomefile') +endfunc + +func Test_syntime() + if !has('profile') + return + endif + + syntax on + syntime on + let a = execute('syntime report') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + view ../memfile_test.c + setfiletype cpp + redraw + let a = execute('syntime report') + call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) + call assert_match(' \d*\.\d* \+[^0]\d* .* cppRawString ', a) + call assert_match(' \d*\.\d* \+[^0]\d* .* cppNumber ', a) + + syntime off + syntime clear + let a = execute('syntime report') + call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) + call assert_notmatch('.* cppRawString *', a) + call assert_notmatch('.* cppNumber*', a) + call assert_notmatch('[1-9]', a) + + call assert_fails('syntime abc', 'E475') + + syntax clear + let a = execute('syntime report') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + bd +endfunc + +func Test_syntax_list() + syntax on + let a = execute('syntax list') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + view ../memfile_test.c + setfiletype c + + let a = execute('syntax list') + call assert_match('cInclude*', a) + call assert_match('cDefine', a) + + let a = execute('syntax list cDefine') + call assert_notmatch('cInclude*', a) + call assert_match('cDefine', a) + call assert_match(' links to Macro$', a) + + call assert_fails('syntax list ABCD', 'E28:') + call assert_fails('syntax list @ABCD', 'E392:') + + syntax clear + let a = execute('syntax list') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + bd +endfunc + +func Test_syntax_completion() + call feedkeys(":syn \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn case clear cluster conceal enable include iskeyword keyword list manual match off on region reset spell sync', @:) + + call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn case ignore match', @:) + + call feedkeys(":syn spell \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn spell default notoplevel toplevel', @:) + + call feedkeys(":syn sync \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:) + + " Check that clearing "Aap" avoids it showing up before Boolean. + hi Aap ctermfg=blue + call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"syn list Aap Boolean Character ', @:) + hi clear Aap + + call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"syn list Boolean Character ', @:) + + call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"syn match Boolean Character ', @:) +endfunc + +func Test_syntax_arg_skipped() + syn clear + syntax case ignore + if 0 + syntax case match + endif + call assert_match('case ignore', execute('syntax case')) + + syn keyword Foo foo + call assert_match('Foo', execute('syntax')) + syn clear + call assert_match('case match', execute('syntax case')) + call assert_notmatch('Foo', execute('syntax')) + + if has('conceal') + syn clear + syntax conceal on + if 0 + syntax conceal off + endif + call assert_match('conceal on', execute('syntax conceal')) + syn clear + call assert_match('conceal off', execute('syntax conceal')) + + syntax conceal on + syntax conceal off + call assert_match('conceal off', execute('syntax conceal')) + endif + + syntax region Bar start=/</ end=/>/ + if 0 + syntax region NotTest start=/</ end=/>/ contains=@Spell + endif + call assert_match('Bar', execute('syntax')) + call assert_notmatch('NotTest', execute('syntax')) + call assert_notmatch('Spell', execute('syntax')) + + hi Foo ctermfg=blue + let a = execute('hi Foo') + if 0 + syntax rest + endif + call assert_equal(a, execute('hi Foo')) + hi clear Bar + hi clear Foo + + set ft=tags + syn off + if 0 + syntax enable + endif + call assert_match('No Syntax items defined', execute('syntax')) + syntax enable + call assert_match('tagComment', execute('syntax')) + set ft= + + syn clear + if 0 + syntax include @Spell nothing + endif + call assert_notmatch('Spell', execute('syntax')) + + syn clear + syn iskeyword 48-57,$,_ + call assert_match('48-57,$,_', execute('syntax iskeyword')) + if 0 + syn clear + syn iskeyword clear + endif + call assert_match('48-57,$,_', execute('syntax iskeyword')) + syn iskeyword clear + call assert_match('not set', execute('syntax iskeyword')) + syn iskeyword 48-57,$,_ + syn clear + call assert_match('not set', execute('syntax iskeyword')) + + syn clear + syn keyword Foo foo + if 0 + syn keyword NotAdded bar + endif + call assert_match('Foo', execute('syntax')) + call assert_notmatch('NotAdded', execute('highlight')) + + syn clear + syn keyword Foo foo + call assert_match('Foo', execute('syntax')) + call assert_match('Foo', execute('syntax list')) + call assert_notmatch('Foo', execute('if 0 | syntax | endif')) + call assert_notmatch('Foo', execute('if 0 | syntax list | endif')) + + syn clear + syn match Fopi /asdf/ + if 0 + syn match Fopx /asdf/ + endif + call assert_match('Fopi', execute('syntax')) + call assert_notmatch('Fopx', execute('syntax')) + + syn clear + syn spell toplevel + call assert_match('spell toplevel', execute('syntax spell')) + if 0 + syn spell notoplevel + endif + call assert_match('spell toplevel', execute('syntax spell')) + syn spell notoplevel + call assert_match('spell notoplevel', execute('syntax spell')) + syn spell default + call assert_match('spell default', execute('syntax spell')) + + syn clear + if 0 + syntax cluster Spell + endif + call assert_notmatch('Spell', execute('syntax')) + + syn clear + syn keyword Foo foo + syn sync ccomment + syn sync maxlines=5 + if 0 + syn sync maxlines=11 + endif + call assert_match('on C-style comments', execute('syntax sync')) + call assert_match('maximal 5 lines', execute('syntax sync')) + syn sync clear + if 0 + syn sync ccomment + endif + call assert_notmatch('on C-style comments', execute('syntax sync')) + + syn clear +endfunc + +func Test_syntax_invalid_arg() + call assert_fails('syntax case asdf', 'E390:') + if has('conceal') + call assert_fails('syntax conceal asdf', 'E390:') + endif + call assert_fails('syntax spell asdf', 'E390:') + call assert_fails('syntax clear @ABCD', 'E391:') + call assert_fails('syntax include @Xxx', 'E397:') + call assert_fails('syntax region X start="{"', 'E399:') + call assert_fails('syntax sync x', 'E404:') + call assert_fails('syntax keyword Abc a[', 'E789:') + call assert_fails('syntax keyword Abc a[bc]d', 'E890:') +endfunc + +func Test_syn_sync() + syntax region HereGroup start=/this/ end=/that/ + syntax sync match SyncHere grouphere HereGroup "pattern" + call assert_match('SyncHere', execute('syntax sync')) + syn sync clear + call assert_notmatch('SyncHere', execute('syntax sync')) + syn clear +endfunc + +func Test_syn_clear() + syntax keyword Foo foo + syntax keyword Bar tar + call assert_match('Foo', execute('syntax')) + call assert_match('Bar', execute('syntax')) + call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) + syn clear Foo + call assert_notmatch('Foo', execute('syntax')) + call assert_match('Bar', execute('syntax')) + call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) + syn clear Foo Bar + call assert_notmatch('Foo', execute('syntax')) + call assert_notmatch('Bar', execute('syntax')) + hi clear Foo + call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) + hi clear Bar +endfunc + +func Test_invalid_name() + syn clear + syn keyword Nop yes + call assert_fails("syntax keyword Wr\x17ong bar", 'E669:') + syntax keyword @Wrong bar + call assert_match('W18:', execute('1messages')) + syn clear + hi clear Nop + hi clear @Wrong +endfunc + +func Test_ownsyntax() + new Xfoo + call setline(1, '#define FOO') + syntax on + set filetype=c + ownsyntax perl + call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name')) + call assert_equal('c', b:current_syntax) + call assert_equal('perl', w:current_syntax) + + " A new split window should have the original syntax. + split + call assert_equal('cDefine', synIDattr(synID(line('.'), col('.'), 1), 'name')) + call assert_equal('c', b:current_syntax) + call assert_equal(0, exists('w:current_syntax')) + + wincmd x + call assert_equal('perlComment', synIDattr(synID(line("."), col("."), 1), "name")) + + syntax off + set filetype& + %bw! +endfunc + +func Test_ownsyntax_completion() + call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"ownsyntax java javacc javascript', @:) +endfunc + +func Test_highlight_invalid_arg() + if has('gui_running') + call assert_fails('hi XXX guifg=xxx', 'E254:') + endif + call assert_fails('hi DoesNotExist', 'E411:') + call assert_fails('hi link', 'E412:') + call assert_fails('hi link a', 'E412:') + call assert_fails('hi link a b c', 'E413:') + call assert_fails('hi XXX =', 'E415:') + call assert_fails('hi XXX cterm', 'E416:') + call assert_fails('hi XXX cterm=', 'E417:') + call assert_fails('hi XXX cterm=DoesNotExist', 'E418:') + call assert_fails('hi XXX ctermfg=DoesNotExist', 'E421:') + call assert_fails('hi XXX xxx=White', 'E423:') +endfunc + +func Test_bg_detection() + if has('gui_running') + return + endif + " auto-detection of &bg, make sure sure it isn't set anywhere before + " this test + hi Normal ctermbg=0 + call assert_equal('dark', &bg) + hi Normal ctermbg=4 + call assert_equal('dark', &bg) + hi Normal ctermbg=12 + call assert_equal('light', &bg) + hi Normal ctermbg=15 + call assert_equal('light', &bg) + + " manually-set &bg takes precedence over auto-detection + set bg=light + hi Normal ctermbg=4 + call assert_equal('light', &bg) + set bg=dark + hi Normal ctermbg=12 + call assert_equal('dark', &bg) + + hi Normal ctermbg=NONE +endfunc + +func Test_syntax_hangs() + if !has('reltime') || !has('float') || !has('syntax') + return + endif + + " This pattern takes a long time to match, it should timeout. + new + call setline(1, ['aaa', repeat('abc ', 1000), 'ccc']) + let start = reltime() + set nolazyredraw redrawtime=101 + syn match Error /\%#=1a*.*X\@<=b*/ + redraw + let elapsed = reltimefloat(reltime(start)) + call assert_true(elapsed > 0.1) + call assert_true(elapsed < 1.0) + + " second time syntax HL is disabled + let start = reltime() + redraw + let elapsed = reltimefloat(reltime(start)) + call assert_true(elapsed < 0.1) + + " after CTRL-L the timeout flag is reset + let start = reltime() + exe "normal \<C-L>" + redraw + let elapsed = reltimefloat(reltime(start)) + call assert_true(elapsed > 0.1) + call assert_true(elapsed < 1.0) + + set redrawtime& + bwipe! +endfunc + +func Test_conceal() + if !has('conceal') + return + endif + + new + call setline(1, ['', '123456']) + syn match test23 "23" conceal cchar=X + syn match test45 "45" conceal + + set conceallevel=0 + call assert_equal('123456 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) + + set conceallevel=1 + call assert_equal('1X 6 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, ' ', 2], [1, ' ', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) + + set conceallevel=1 + set listchars=conceal:Y + call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, 'Y', 2], [1, 'Y', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) + call assert_equal('1XY6 ', ScreenLines(2, 7)[0]) + + set conceallevel=2 + call assert_match('1X6 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) + + set conceallevel=3 + call assert_match('16 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, '', 0], [1, '', 1], [1, '', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) + + syn clear + set conceallevel& + bw! +endfunc + +func Test_synstack_synIDtrans() + new + setfiletype c + syntax on + call setline(1, ' /* A comment with a TODO */') + + call assert_equal([], synstack(1, 1)) + + norm f/ + call assert_equal(['cComment', 'cCommentStart'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) + call assert_equal(['Comment', 'Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")')) + + norm fA + call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) + call assert_equal(['Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")')) + + norm fT + call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) + call assert_equal(['Comment', 'Todo'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")')) + + syn clear + bw! +endfunc + +" Check highlighting for a small piece of C code with a screen dump. +func Test_syntax_c() + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ '/* comment line at the top */', + \ ' int', + \ 'main(int argc, char **argv)// another comment', + \ '{', + \ '#if 0', + \ ' int not_used;', + \ '#else', + \ ' int used;', + \ '#endif', + \ ' printf("Just an example piece of C code\n");', + \ ' return 0x0ff;', + \ '}', + \ ' static void', + \ 'myFunction(const double count, struct nothing, long there) {', + \ ' // 123: nothing to read here', + \ ' for (int i = 0; i < count; ++i) {', + \ ' break;', + \ ' }', + \ '}', + \ ], 'Xtest.c') + + " This makes the default for 'background' use "dark", check that the + " response to t_RB corrects it to "light". + let $COLORFGBG = '15;0' + + let buf = RunVimInTerminal('Xtest.c', {}) + call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) + call StopVimInTerminal(buf) + + let $COLORFGBG = '' + call delete('Xtest.c') +endfun diff --git a/src/testdir/test_system.vim b/src/testdir/test_system.vim new file mode 100644 index 0000000000..5f766c7623 --- /dev/null +++ b/src/testdir/test_system.vim @@ -0,0 +1,92 @@ +" Tests for system() and systemlist() + +function! Test_System() + if !executable('echo') || !executable('cat') || !executable('wc') + return + endif + let out = system('echo 123') + " On Windows we may get a trailing space. + if out != "123 \n" + call assert_equal("123\n", out) + endif + + let out = systemlist('echo 123') + " On Windows we may get a trailing space and CR. + if out != ["123 \r"] + call assert_equal(['123'], out) + endif + + call assert_equal('123', system('cat', '123')) + call assert_equal(['123'], systemlist('cat', '123')) + call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"])) + + new Xdummy + call setline(1, ['asdf', "pw\<NL>er", 'xxxx']) + let out = system('wc -l', bufnr('%')) + " On OS/X we get leading spaces + let out = substitute(out, '^ *', '', '') + call assert_equal("3\n", out) + + let out = systemlist('wc -l', bufnr('%')) + " On Windows we may get a trailing CR. + if out != ["3\r"] + " On OS/X we get leading spaces + if type(out) == v:t_list + let out[0] = substitute(out[0], '^ *', '', '') + endif + call assert_equal(['3'], out) + endif + + let out = systemlist('cat', bufnr('%')) + " On Windows we may get a trailing CR. + if out != ["asdf\r", "pw\<NL>er\r", "xxxx\r"] + call assert_equal(['asdf', "pw\<NL>er", 'xxxx'], out) + endif + bwipe! + + call assert_fails('call system("wc -l", 99999)', 'E86:') +endfunction + +function! Test_system_exmode() + if has('unix') " echo $? only works on Unix + let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"' + " Need to put this in a script, "catch" isn't found after an unknown + " function. + call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') + let a = system(v:progpath . cmd) + call assert_match('result=0', a) + call assert_equal(0, v:shell_error) + endif + + " Error before try does set error flag. + call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') + if has('unix') " echo $? only works on Unix + let a = system(v:progpath . cmd) + call assert_notequal('0', a[0]) + endif + + let cmd = ' -es -u NONE -c "source Xscript" +q' + let a = system(v:progpath . cmd) + call assert_notequal(0, v:shell_error) + call delete('Xscript') + + if has('unix') " echo $? only works on Unix + let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?' + let a = system(v:progpath. cmd) + call assert_notequal(0, a[0]) + endif + + let cmd = ' -es -u NONE -c "call doesnotexist()" +q' + let a = system(v:progpath. cmd) + call assert_notequal(0, v:shell_error) + + if has('unix') " echo $? only works on Unix + let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q; echo $?' + let a = system(v:progpath. cmd) + call assert_notequal(0, a[0]) + endif + + let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q' + let a = system(v:progpath. cmd) + call assert_notequal(0, v:shell_error) +endfunc diff --git a/src/testdir/test_tab.vim b/src/testdir/test_tab.vim new file mode 100644 index 0000000000..b847dbd962 --- /dev/null +++ b/src/testdir/test_tab.vim @@ -0,0 +1,45 @@ + +" Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. +" Also test that dv_ works correctly +func Test_smarttab() + enew! + set smarttab expandtab ts=8 sw=4 + " make sure that backspace works, no matter what termcap is used + exe "set t_kD=\<C-V>x7f t_kb=\<C-V>x08" + call append(0, ['start text', + \ "\t\tsome test text", + \ 'test text', + \ "\t\tother test text", + \ ' a cde', + \ ' f ghi', + \ 'test text', + \ ' Second line beginning with whitespace' + \ ]) + call cursor(1, 1) + exe "normal /some\<CR>" + exe "normal r\t" + call assert_equal("\t\t ome test text", getline('.')) + set noexpandtab + exe "normal /other\<CR>" + exe "normal r\t" + call assert_equal("\t\t ther test text", getline('.')) + + " Test replacing with Tabs and then backspacing to undo it + exe "normal j0wR\t\t\t\<BS>\<BS>\<BS>" + call assert_equal(" a cde", getline('.')) + " Test replacing with Tabs + exe "normal j0wR\t\t\t" + call assert_equal(" \t\thi", getline('.')) + + " Test that copyindent works with expandtab set + set expandtab smartindent copyindent ts=8 sw=8 sts=8 + exe "normal jo{\<CR>x" + call assert_equal('{', getline(line('.') - 1)) + call assert_equal(' x', getline('.')) + set nosol + exe "normal /Second line/\<CR>" + exe "normal fwdv_" + call assert_equal(' with whitespace', getline('.')) + enew! + set expandtab& smartindent& copyindent& ts& sw& sts& +endfunc diff --git a/src/testdir/test_tabline.vim b/src/testdir/test_tabline.vim new file mode 100644 index 0000000000..b08f299fd0 --- /dev/null +++ b/src/testdir/test_tabline.vim @@ -0,0 +1,49 @@ +function! TablineWithCaughtError() + let s:func_in_tabline_called = 1 + try + call eval('unknown expression') + catch + endtry + return '' +endfunction + +function! TablineWithError() + let s:func_in_tabline_called = 1 + call eval('unknown expression') + return '' +endfunction + +function! Test_caught_error_in_tabline() + if has('gui') + set guioptions-=e + endif + let showtabline_save = &showtabline + set showtabline=2 + let s:func_in_tabline_called = 0 + let tabline = '%{TablineWithCaughtError()}' + let &tabline = tabline + redraw! + call assert_true(s:func_in_tabline_called) + call assert_equal(tabline, &tabline) + set tabline= + let &showtabline = showtabline_save +endfunction + +function! Test_tabline_will_be_disabled_with_error() + if has('gui') + set guioptions-=e + endif + let showtabline_save = &showtabline + set showtabline=2 + let s:func_in_tabline_called = 0 + let tabline = '%{TablineWithError()}' + try + let &tabline = tabline + redraw! + catch + endtry + call assert_true(s:func_in_tabline_called) + call assert_equal('', &tabline) + set tabline= + let &showtabline = showtabline_save +endfunction diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim new file mode 100644 index 0000000000..f4fbf28d19 --- /dev/null +++ b/src/testdir/test_tabpage.vim @@ -0,0 +1,537 @@ +" Tests for tabpage + + +function Test_tabpage() + bw! + " Simple test for opening and closing a tab page + tabnew + call assert_equal(2, tabpagenr()) + quit + + " Open three tab pages and use ":tabdo" + 0tabnew + 1tabnew + $tabnew + %del + tabdo call append(line('$'), tabpagenr()) + tabclose! 2 + tabrewind + let line1 = getline('$') + undo + q + tablast + let line2 = getline('$') + q! + call append(line('$'), line1) + call append(line('$'), line2) + unlet line1 line2 + call assert_equal(['', '3', '1', '4'], getline(1, '$')) + " + " Test for settabvar() and gettabvar() functions. Open a new tab page and + " set 3 variables to a number, string and a list. Verify that the variables + " are correctly set. + tabnew + tabfirst + call settabvar(2, 'val_num', 100) + call settabvar(2, 'val_str', 'SetTabVar test') + call settabvar(2, 'val_list', ['red', 'blue', 'green']) + " + call assert_true(gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green']) + + tabnext 2 + call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green']) + tabclose + + " Test for ":tab drop exist-file" to keep current window. + sp test1 + tab drop test1 + call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1) + close + " + " + " Test for ":tab drop new-file" to keep current window of tabpage 1. + split + tab drop newfile + call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1) + tabclose + q + " + " + " Test for ":tab drop multi-opend-file" to keep current tabpage and window. + new test1 + tabnew + new test1 + tab drop test1 + call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1) + tabclose + q + " + " + " Test for ":tab drop vertical-split-window" to jump test1 buffer + tabedit test1 + vnew + tabfirst + tab drop test1 + call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)]) + 1tabonly + " + " + for i in range(9) | tabnew | endfor + normal! 1gt + call assert_equal(1, tabpagenr()) + tabmove 5 + call assert_equal(5, tabpagenr()) + .tabmove + call assert_equal(5, tabpagenr()) + tabmove - + call assert_equal(4, tabpagenr()) + tabmove + + call assert_equal(5, tabpagenr()) + tabmove -2 + call assert_equal(3, tabpagenr()) + tabmove +4 + call assert_equal(7, tabpagenr()) + tabmove + call assert_equal(10, tabpagenr()) + 0tabmove + call assert_equal(1, tabpagenr()) + $tabmove + call assert_equal(10, tabpagenr()) + tabmove 0 + call assert_equal(1, tabpagenr()) + tabmove $ + call assert_equal(10, tabpagenr()) + 3tabmove + call assert_equal(4, tabpagenr()) + 7tabmove 5 + call assert_equal(5, tabpagenr()) + call assert_fails("99tabmove", 'E16:') + call assert_fails("+99tabmove", 'E16:') + call assert_fails("-99tabmove", 'E16:') + call assert_fails("tabmove foo", 'E474:') + call assert_fails("tabmove 99", 'E474:') + call assert_fails("tabmove +99", 'E474:') + call assert_fails("tabmove -99", 'E474:') + call assert_fails("tabmove -3+", 'E474:') + call assert_fails("tabmove $3", 'E474:') + 1tabonly! +endfunc + +" Test autocommands +function Test_tabpage_with_autocmd() + if !has('autocmd') + return + endif + command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args> + augroup TestTabpageGroup + au! + autocmd TabEnter * call add(s:li, 'TabEnter') + autocmd WinEnter * call add(s:li, 'WinEnter') + autocmd BufEnter * call add(s:li, 'BufEnter') + autocmd TabLeave * call add(s:li, 'TabLeave') + autocmd WinLeave * call add(s:li, 'WinLeave') + autocmd BufLeave * call add(s:li, 'BufLeave') + augroup END + + let s:li = [] + let t:a='a' + C tab split + call assert_equal(['=== tab split ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'], s:li) + let s:li = [] + let t:a='b' + C tabnew + call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li) + let t:a='c' + let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+') + call assert_equal(['a', 'b', 'c'], s:li) + + let s:li = [] + C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') + call assert_equal(["=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ==="], s:li) + let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+') + call assert_equal(['2', '4', '6'], s:li) + + let s:li = [] + let w:a='a' + C vsplit + call assert_equal(['=== vsplit ===', 'WinLeave', 'WinEnter'], s:li) + let s:li = [] + let w:a='a' + let tabn=tabpagenr() + let winr=range(1, winnr('$')) + C tabnext 1 + call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li) + let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+') + call assert_equal(['a', 'a'], s:li) + let s:li = [] + C call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') + let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+') + call assert_equal(['2', '4'], s:li) + + augroup TabDestructive + autocmd TabEnter * :C tabnext 2 | C tabclose 3 + augroup END + let s:li = [] + C tabnext 3 + call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li) + call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')]) + + autocmd! TabDestructive TabEnter + let s:li = [] + C tabnew + call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li) + let s:li = [] + C tabnext 1 + call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li) + + autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3 + let s:li = [] + call assert_equal(3, tabpagenr('$')) + C tabnext 2 + call assert_equal(2, tabpagenr('$')) + call assert_equal(['=== tabnext 2 ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li) + call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')]) + + delcommand C + autocmd! TabDestructive + augroup! TabDestructive + autocmd! TestTabpageGroup + augroup! TestTabpageGroup + 1tabonly! +endfunction + +function Test_tabpage_with_tab_modifier() + for n in range(4) + tabedit + endfor + + function s:check_tab(pre_nr, cmd, post_nr) + exec 'tabnext ' . a:pre_nr + exec a:cmd + call assert_equal(a:post_nr, tabpagenr()) + call assert_equal('help', &buftype) + helpclose + endfunc + + call s:check_tab(1, 'tab help', 2) + call s:check_tab(1, '3tab help', 4) + call s:check_tab(1, '.tab help', 2) + call s:check_tab(1, '.+1tab help', 3) + call s:check_tab(1, '0tab help', 1) + call s:check_tab(2, '+tab help', 4) + call s:check_tab(2, '+2tab help', 5) + call s:check_tab(4, '-tab help', 4) + call s:check_tab(4, '-2tab help', 3) + call s:check_tab(3, '$tab help', 6) + call assert_fails('99tab help', 'E16:') + call assert_fails('+99tab help', 'E16:') + call assert_fails('-99tab help', 'E16:') + + delfunction s:check_tab + 1tabonly! +endfunction + +function Check_tab_count(pre_nr, cmd, post_nr) + exec 'tabnext' a:pre_nr + normal! G + exec a:cmd + call assert_equal(a:post_nr, tabpagenr(), a:cmd) +endfunc + +" Test for [count] of tabnext +function Test_tabpage_with_tabnext() + for n in range(4) + tabedit + call setline(1, ['', '', '3']) + endfor + + call Check_tab_count(1, 'tabnext', 2) + call Check_tab_count(1, '3tabnext', 3) + call Check_tab_count(1, '.tabnext', 1) + call Check_tab_count(1, '.+1tabnext', 2) + call Check_tab_count(2, '+tabnext', 3) + call Check_tab_count(2, '+2tabnext', 4) + call Check_tab_count(4, '-tabnext', 3) + call Check_tab_count(4, '-2tabnext', 2) + call Check_tab_count(3, '$tabnext', 5) + call assert_fails('0tabnext', 'E16:') + call assert_fails('99tabnext', 'E16:') + call assert_fails('+99tabnext', 'E16:') + call assert_fails('-99tabnext', 'E16:') + call Check_tab_count(1, 'tabnext 3', 3) + call Check_tab_count(2, 'tabnext +', 3) + call Check_tab_count(2, 'tabnext +2', 4) + call Check_tab_count(4, 'tabnext -', 3) + call Check_tab_count(4, 'tabnext -2', 2) + call Check_tab_count(3, 'tabnext $', 5) + call assert_fails('tabnext 0', 'E474:') + call assert_fails('tabnext .', 'E474:') + call assert_fails('tabnext -+', 'E474:') + call assert_fails('tabnext +2-', 'E474:') + call assert_fails('tabnext $3', 'E474:') + call assert_fails('tabnext 99', 'E474:') + call assert_fails('tabnext +99', 'E474:') + call assert_fails('tabnext -99', 'E474:') + + 1tabonly! +endfunction + +" Test for [count] of tabprevious +function Test_tabpage_with_tabprevious() + for n in range(5) + tabedit + call setline(1, ['', '', '3']) + endfor + + for cmd in ['tabNext', 'tabprevious'] + call Check_tab_count(6, cmd, 5) + call Check_tab_count(6, '3' . cmd, 3) + call Check_tab_count(6, '8' . cmd, 4) + call Check_tab_count(6, cmd . ' 3', 3) + call Check_tab_count(6, cmd . ' 8', 4) + for n in range(2) + for c in ['0', '.+3', '+', '+2' , '-', '-2' , '$', '+99', '-99'] + if n == 0 " pre count + let entire_cmd = c . cmd + let err_code = 'E16:' + else + let entire_cmd = cmd . ' ' . c + let err_code = 'E474:' + endif + call assert_fails(entire_cmd, err_code) + endfor + endfor + endfor + + 1tabonly! +endfunction + +function s:reconstruct_tabpage_for_test(nr) + let n = (a:nr > 2) ? a:nr - 2 : 1 + 1tabonly! + 0tabedit n0 + for n in range(1, n) + exec '$tabedit n' . n + if n == 1 + call setline(1, ['', '', '3']) + endif + endfor +endfunc + +func Test_tabpage_ctrl_pgup_pgdown() + enew! + tabnew tab1 + tabnew tab2 + + call assert_equal(3, tabpagenr()) + exe "norm! \<C-PageUp>" + call assert_equal(2, tabpagenr()) + exe "norm! \<C-PageDown>" + call assert_equal(3, tabpagenr()) + + " Check wrapping at last or first page. + exe "norm! \<C-PageDown>" + call assert_equal(1, tabpagenr()) + exe "norm! \<C-PageUp>" + call assert_equal(3, tabpagenr()) + + " With a count, <C-PageUp> and <C-PageDown> are not symmetrical somehow: + " - {count}<C-PageUp> goes {count} pages downward (relative count) + " - {count}<C-PageDown> goes to page number {count} (absolute count) + exe "norm! 2\<C-PageUp>" + call assert_equal(1, tabpagenr()) + exe "norm! 2\<C-PageDown>" + call assert_equal(2, tabpagenr()) + + 1tabonly! +endfunc + +" Test for [count] of tabclose +function Test_tabpage_with_tabclose() + + " pre count + call s:reconstruct_tabpage_for_test(6) + call Check_tab_count(3, 'tabclose!', 3) + call Check_tab_count(1, '3tabclose', 1) + call Check_tab_count(4, '4tabclose', 3) + call Check_tab_count(3, '1tabclose', 2) + call Check_tab_count(2, 'tabclose', 1) + call assert_equal(1, tabpagenr('$')) + call assert_equal('', bufname('')) + + call s:reconstruct_tabpage_for_test(6) + call Check_tab_count(2, '$tabclose', 2) + call Check_tab_count(4, '.tabclose', 4) + call Check_tab_count(3, '.+tabclose', 3) + call Check_tab_count(3, '.-2tabclose', 2) + call Check_tab_count(1, '.+1tabclose!', 1) + call assert_equal(1, tabpagenr('$')) + call assert_equal('', bufname('')) + + " post count + call s:reconstruct_tabpage_for_test(6) + call Check_tab_count(3, 'tabclose!', 3) + call Check_tab_count(1, 'tabclose 3', 1) + call Check_tab_count(4, 'tabclose 4', 3) + call Check_tab_count(3, 'tabclose 1', 2) + call Check_tab_count(2, 'tabclose', 1) + call assert_equal(1, tabpagenr('$')) + call assert_equal('', bufname('')) + + call s:reconstruct_tabpage_for_test(6) + call Check_tab_count(2, 'tabclose $', 2) + call Check_tab_count(4, 'tabclose', 4) + call Check_tab_count(3, 'tabclose +', 3) + call Check_tab_count(3, 'tabclose -2', 2) + call Check_tab_count(1, 'tabclose! +1', 1) + call assert_equal(1, tabpagenr('$')) + call assert_equal('', bufname('')) + + call s:reconstruct_tabpage_for_test(6) + for n in range(2) + for c in ['0', '$3', '99', '+99', '-99'] + if n == 0 " pre count + let entire_cmd = c . 'tabclose' + let err_code = 'E16:' + else + let entire_cmd = 'tabclose ' . c + let err_code = 'E474:' + endif + call assert_fails(entire_cmd, err_code) + call assert_equal(6, tabpagenr('$')) + endfor + endfor + + call assert_fails('3tabclose', 'E37:') + call assert_fails('tabclose 3', 'E37:') + call assert_fails('tabclose -+', 'E474:') + call assert_fails('tabclose +2-', 'E474:') + call assert_equal(6, tabpagenr('$')) + + 1tabonly! +endfunction + +" Test for [count] of tabonly +function Test_tabpage_with_tabonly() + + " Test for the normal behavior (pre count only) + let tc = [ [4, '.', '!'], [2, '.+', ''], [3, '.-2', '!'], [1, '.+1', '!'] ] + for c in tc + call s:reconstruct_tabpage_for_test(6) + let entire_cmd = c[1] . 'tabonly' . c[2] + call Check_tab_count(c[0], entire_cmd, 1) + call assert_equal(1, tabpagenr('$')) + endfor + + " Test for the normal behavior + let tc2 = [ [3, '', ''], [1, '3', ''], [4, '4', '!'], [3, '1', '!'], + \ [2, '', '!'], + \ [2, '$', '!'], [3, '+', '!'], [3, '-2', '!'], [3, '+1', '!'] + \ ] + for n in range(2) + for c in tc2 + call s:reconstruct_tabpage_for_test(6) + if n == 0 " pre count + let entire_cmd = c[1] . 'tabonly' . c[2] + else + let entire_cmd = 'tabonly' . c[2] . ' ' . c[1] + endif + call Check_tab_count(c[0], entire_cmd, 1) + call assert_equal(1, tabpagenr('$')) + endfor + endfor + + " Test for the error behavior + for n in range(2) + for c in ['0', '$3', '99', '+99', '-99'] + call s:reconstruct_tabpage_for_test(6) + if n == 0 " pre count + let entire_cmd = c . 'tabonly' + let err_code = 'E16:' + else + let entire_cmd = 'tabonly ' . c + let err_code = 'E474:' + endif + call assert_fails(entire_cmd, err_code) + call assert_equal(6, tabpagenr('$')) + endfor + endfor + + " Test for the error behavior (post count only) + for c in tc + call s:reconstruct_tabpage_for_test(6) + let entire_cmd = 'tabonly' . c[2] . ' ' . c[1] + let err_code = 'E474:' + call assert_fails(entire_cmd, err_code) + call assert_equal(6, tabpagenr('$')) + endfor + + call assert_fails('tabonly -+', 'E474:') + call assert_fails('tabonly +2-', 'E474:') + call assert_equal(6, tabpagenr('$')) + + 1tabonly! + new + only! +endfunction + +func Test_tabnext_on_buf_unload1() + " This once caused a crash + new + tabedit + tabfirst + au BufUnload <buffer> tabnext + q + + while tabpagenr('$') > 1 + bwipe! + endwhile +endfunc + +func Test_tabnext_on_buf_unload2() + " This once caused a crash + tabedit + autocmd BufUnload <buffer> tabnext + file x + edit y + + while tabpagenr('$') > 1 + bwipe! + endwhile +endfunc + +func Test_close_on_quitpre() + " This once caused a crash + edit Xtest + new + only + set bufhidden=delete + au QuitPre <buffer> close + tabnew tab1 + tabnew tab2 + 1tabn + q! + call assert_equal(1, tabpagenr()) + call assert_equal(2, tabpagenr('$')) + " clean up + while tabpagenr('$') > 1 + bwipe! + endwhile + buf Xtest +endfunc + +func Test_tabs() + enew! + tabnew tab1 + norm ixxx + let a=split(execute(':tabs'), "\n") + call assert_equal(['Tab page 1', + \ ' [No Name]', + \ 'Tab page 2', + \ '> + tab1'], a) + + 1tabonly! + bw! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_tagcase.vim b/src/testdir/test_tagcase.vim new file mode 100644 index 0000000000..83e532822d --- /dev/null +++ b/src/testdir/test_tagcase.vim @@ -0,0 +1,73 @@ +" test 'tagcase' option + +func Test_tagcase() + call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags') + set tags=Xtags + e Xtext + + for &ic in [0, 1] + for &scs in [0, 1] + for &g:tc in ["followic", "ignore", "match", "followscs", "smart"] + for &l:tc in ["", "followic", "ignore", "match", "followscs", "smart"] + let smart = 0 + if &l:tc != '' + let tc = &l:tc + else + let tc = &g:tc + endif + if tc == 'followic' + let ic = &ic + elseif tc == 'ignore' + let ic = 1 + elseif tc == 'followscs' + let ic = &ic + let smart = &scs + elseif tc == 'smart' + let ic = 1 + let smart = 1 + else + let ic = 0 + endif + if ic && smart + call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) + elseif ic + call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo', 'foo'], map(taglist("^Foo$"), {i, v -> v.name})) + else + call assert_equal(['foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) + endif + endfor + endfor + endfor + endfor + + call delete('Xtags') + set ic& + setg tc& + setl tc& + set scs& +endfunc + +func Test_set_tagcase() + " Verify default values. + set ic& + setg tc& + setl tc& + call assert_equal(0, &ic) + call assert_equal('followic', &g:tc) + call assert_equal('followic', &l:tc) + call assert_equal('followic', &tc) + + " Verify that the local setting accepts <empty> but that the global setting + " does not. The first of these (setting the local value to <empty>) should + " succeed; the other two should fail. + setl tc= + call assert_fails('setg tc=', 'E474:') + call assert_fails('set tc=', 'E474:') + + set ic& + setg tc& + setl tc& +endfunc diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim new file mode 100644 index 0000000000..9f0accc3d8 --- /dev/null +++ b/src/testdir/test_tagjump.vim @@ -0,0 +1,260 @@ +" Tests for tagjump (tags and special searches) + +" SEGV occurs in older versions. (At least 7.4.1748 or older) +func Test_ptag_with_notagstack() + set notagstack + call assert_fails('ptag does_not_exist_tag_name', 'E426') + set tagstack&vim +endfunc + +func Test_cancel_ptjump() + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "word\tfile1\tcmd1", + \ "word\tfile2\tcmd2"], + \ 'Xtags') + + only! + call feedkeys(":ptjump word\<CR>\<CR>", "xt") + help + call assert_equal(2, winnr('$')) + + call delete('Xtags') + quit +endfunc + +func Test_static_tagjump() + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile1\t/^one/;\"\tf\tfile:\tsignature:(void)", + \ "word\tXfile2\tcmd2"], + \ 'Xtags') + new Xfile1 + call setline(1, ['empty', 'one()', 'empty']) + write + tag one + call assert_equal(2, line('.')) + + bwipe! + set tags& + call delete('Xtags') + call delete('Xfile1') +endfunc + +func Test_duplicate_tagjump() + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "thesame\tXfile1\t1;\"\td\tfile:", + \ "thesame\tXfile1\t2;\"\td\tfile:", + \ "thesame\tXfile1\t3;\"\td\tfile:", + \ ], + \ 'Xtags') + new Xfile1 + call setline(1, ['thesame one', 'thesame two', 'thesame three']) + write + tag thesame + call assert_equal(1, line('.')) + tnext + call assert_equal(2, line('.')) + tnext + call assert_equal(3, line('.')) + + bwipe! + set tags& + call delete('Xtags') + call delete('Xfile1') +endfunc + +func Test_tagjump_switchbuf() + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "second\tXfile1\t2", + \ "third\tXfile1\t3",], + \ 'Xtags') + call writefile(['first', 'second', 'third'], 'Xfile1') + + enew | only + set switchbuf= + stag second + call assert_equal(2, winnr('$')) + call assert_equal(2, line('.')) + stag third + call assert_equal(3, winnr('$')) + call assert_equal(3, line('.')) + + enew | only + set switchbuf=useopen + stag second + call assert_equal(2, winnr('$')) + call assert_equal(2, line('.')) + stag third + call assert_equal(2, winnr('$')) + call assert_equal(3, line('.')) + + enew | only + set switchbuf=usetab + tab stag second + call assert_equal(2, tabpagenr('$')) + call assert_equal(2, line('.')) + 1tabnext | stag third + call assert_equal(2, tabpagenr('$')) + call assert_equal(3, line('.')) + + tabclose! + enew | only + call delete('Xfile1') + call delete('Xtags') + set switchbuf&vim +endfunc + +" Tests for [ CTRL-I and CTRL-W CTRL-I commands +function Test_keyword_jump() + call writefile(["#include Xinclude", "", + \ "", + \ "/* test text test tex start here", + \ " some text", + \ " test text", + \ " start OK if found this line", + \ " start found wrong line", + \ "test text"], 'Xtestfile') + call writefile(["/* test text test tex start here", + \ " some text", + \ " test text", + \ " start OK if found this line", + \ " start found wrong line", + \ "test text"], 'Xinclude') + new Xtestfile + call cursor(1,1) + call search("start") + exe "normal! 5[\<C-I>" + call assert_equal(" start OK if found this line", getline('.')) + call cursor(1,1) + call search("start") + exe "normal! 5\<C-W>\<C-I>" + call assert_equal(" start OK if found this line", getline('.')) + enew! | only + call delete('Xtestfile') + call delete('Xinclude') +endfunction + +" Test for jumping to a tag with 'hidden' set, with symbolic link in path of +" tag. This only works for Unix, because of the symbolic link. +func Test_tag_symbolic() + if !has('unix') + return + endif + set hidden + call delete("Xtest.dir", "rf") + call system("ln -s . Xtest.dir") + " Create a tags file with the current directory name inserted. + call writefile([ + \ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/", + \ '', + \ ], 'Xtags') + call writefile(['#define SECTION_OFF 3', + \ '#define NUM_SECTIONS 3'], 'Xtest.c') + + " Try jumping to a tag, but with a path that contains a symbolic link. When + " wrong, this will give the ATTENTION message. The next space will then be + " eaten by hit-return, instead of moving the cursor to 'd'. + set tags=Xtags + enew! + call append(0, 'SECTION_OFF') + call cursor(1,1) + exe "normal \<C-]> " + call assert_equal('Xtest.c', expand('%:t')) + call assert_equal(2, col('.')) + + set hidden& + set tags& + enew! + call delete('Xtags') + call delete('Xtest.c') + call delete("Xtest.dir", "rf") + %bwipe! +endfunc + +" Tests for tag search with !_TAG_FILE_ENCODING. +" Depends on the test83-tags2 and test83-tags3 files. +func Test_tag_file_encoding() + if has('vms') + return + endif + + if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" + return + endif + + let save_enc = &encoding + set encoding=utf8 + + let content = ['text for tags1', 'abcdefghijklmnopqrs'] + call writefile(content, 'Xtags1.txt') + let content = ['text for tags2', 'ABC'] + call writefile(content, 'Xtags2.txt') + let content = ['text for tags3', 'ABC'] + call writefile(content, 'Xtags3.txt') + let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs'] + call writefile(content, 'Xtags1') + + " case1: + new + set tags=Xtags1 + tag abcdefghijklmnopqrs + call assert_equal('Xtags1.txt', expand('%:t')) + call assert_equal('abcdefghijklmnopqrs', getline('.')) + close + + " case2: + new + set tags=test83-tags2 + tag /.BC + call assert_equal('Xtags2.txt', expand('%:t')) + call assert_equal('ABC', getline('.')) + close + + " case3: + new + set tags=test83-tags3 + tag abc50 + call assert_equal('Xtags3.txt', expand('%:t')) + call assert_equal('ABC', getline('.')) + close + + set tags& + let &encoding = save_enc + call delete('Xtags1.txt') + call delete('Xtags2.txt') + call delete('Xtags3.txt') + call delete('Xtags1') +endfunc + +func Test_tagjump_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "void foo() {}", + \ "int main(int argc, char **argv)", + \ "{", + \ "\tfoo();", + \ "\treturn 0;", + \ "}", + \ ], 'Xmain.c') + + call writefile([ + \ "\x0c", + \ "Xmain.c,64", + \ "void foo() {}\x7ffoo\x011,0", + \ "int main(int argc, char **argv)\x7fmain\x012,14", + \ ], 'Xtags') + set tags=Xtags + ta foo + call assert_equal('void foo() {}', getline('.')) + + call delete('Xtags') + call delete('Xmain.c') + bwipe! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_taglist.vim b/src/testdir/test_taglist.vim new file mode 100644 index 0000000000..3ad2025915 --- /dev/null +++ b/src/testdir/test_taglist.vim @@ -0,0 +1,63 @@ +" test 'taglist' function and :tags command + +func Test_taglist() + call writefile([ + \ "FFoo\tXfoo\t1", + \ "FBar\tXfoo\t2", + \ "BFoo\tXbar\t1", + \ "BBar\tXbar\t2" + \ ], 'Xtags') + set tags=Xtags + split Xtext + + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name})) + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {i, v -> v.name})) + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name})) + call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name})) + + call delete('Xtags') + bwipe +endfunc + +func Test_taglist_native_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "\x0c", + \ "src/os_unix.c,13491", + \ "set_signals(\x7f1335,32699", + \ "reset_signals(\x7f1407,34136", + \ ], 'Xtags') + + set tags=Xtags + + call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], + \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) + + call delete('Xtags') +endfunc + +func Test_taglist_ctags_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "\x0c", + \ "src/os_unix.c,13491", + \ "set_signals(void)\x7fset_signals\x011335,32699", + \ "reset_signals(void)\x7freset_signals\x011407,34136", + \ ], 'Xtags') + + set tags=Xtags + + call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], + \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) + + call delete('Xtags') +endfunc + +func Test_tags_too_long() + call assert_fails('tag ' . repeat('x', 1020), 'E426') + tags +endfunc diff --git a/src/testdir/test_tcl.vim b/src/testdir/test_tcl.vim new file mode 100644 index 0000000000..ac772cc4d7 --- /dev/null +++ b/src/testdir/test_tcl.vim @@ -0,0 +1,23 @@ +" Tests for the Tcl interface. + +if !has('tcl') + finish +end + +function Test_tcldo() + " Check deleting lines does not trigger ml_get error. + new + call setline(1, ['one', 'two', 'three']) + tcldo ::vim::command %d_ + bwipe! + + " Check switching to another buffer does not trigger ml_get error. + new + let wincount = winnr('$') + call setline(1, ['one', 'two', 'three']) + tcldo ::vim::command new + call assert_equal(wincount + 1, winnr('$')) + bwipe! + bwipe! +endfunc + diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim new file mode 100644 index 0000000000..ea4365fd63 --- /dev/null +++ b/src/testdir/test_terminal.vim @@ -0,0 +1,1558 @@ +" Tests for the terminal window. + +if !has('terminal') + finish +endif + +source shared.vim +source screendump.vim + +let s:python = PythonProg() + +" Open a terminal with a shell, assign the job to g:job and return the buffer +" number. +func Run_shell_in_terminal(options) + if has('win32') + let buf = term_start([&shell,'/k'], a:options) + else + let buf = term_start(&shell, a:options) + endif + + let termlist = term_list() + call assert_equal(1, len(termlist)) + call assert_equal(buf, termlist[0]) + + let g:job = term_getjob(buf) + call assert_equal(v:t_job, type(g:job)) + + let string = string({'job': term_getjob(buf)}) + call assert_match("{'job': 'process \\d\\+ run'}", string) + + return buf +endfunc + +func Test_terminal_basic() + au TerminalOpen * let b:done = 'yes' + let buf = Run_shell_in_terminal({}) + + if has("unix") + call assert_match('^/dev/', job_info(g:job).tty_out) + call assert_match('^/dev/', term_gettty('')) + else + call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out) + call assert_match('^\\\\.\\pipe\\', term_gettty('')) + endif + call assert_equal('t', mode()) + call assert_equal('yes', b:done) + call assert_match('%aR[^\n]*running]', execute('ls')) + call assert_match('%aR[^\n]*running]', execute('ls R')) + call assert_notmatch('%[^\n]*running]', execute('ls F')) + call assert_notmatch('%[^\n]*running]', execute('ls ?')) + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + call assert_equal('n', mode()) + call assert_match('%aF[^\n]*finished]', execute('ls')) + call assert_match('%aF[^\n]*finished]', execute('ls F')) + call assert_notmatch('%[^\n]*finished]', execute('ls R')) + call assert_notmatch('%[^\n]*finished]', execute('ls ?')) + + " closing window wipes out the terminal buffer a with finished job + close + call assert_equal("", bufname(buf)) + + au! TerminalOpen + unlet g:job +endfunc + +func Test_terminal_make_change() + let buf = Run_shell_in_terminal({}) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + setlocal modifiable + exe "normal Axxx\<Esc>" + call assert_fails(buf . 'bwipe', 'E517') + undo + + exe buf . 'bwipe' + unlet g:job +endfunc + +func Test_terminal_wipe_buffer() + let buf = Run_shell_in_terminal({}) + call assert_fails(buf . 'bwipe', 'E517') + exe buf . 'bwipe!' + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + call assert_equal("", bufname(buf)) + + unlet g:job +endfunc + +func Test_terminal_split_quit() + let buf = Run_shell_in_terminal({}) + call term_wait(buf) + split + quit! + call term_wait(buf) + sleep 50m + call assert_equal('run', job_status(g:job)) + + quit! + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + + exe buf . 'bwipe' + unlet g:job +endfunc + +func Test_terminal_hide_buffer() + let buf = Run_shell_in_terminal({}) + setlocal bufhidden=hide + quit + for nr in range(1, winnr('$')) + call assert_notequal(winbufnr(nr), buf) + endfor + call assert_true(bufloaded(buf)) + call assert_true(buflisted(buf)) + + exe 'split ' . buf . 'buf' + call Stop_shell_in_terminal(buf) + exe buf . 'bwipe' + + unlet g:job +endfunc + +func! s:Nasty_exit_cb(job, st) + exe g:buf . 'bwipe!' + let g:buf = 0 +endfunc + +func Get_cat_123_cmd() + if has('win32') + return 'cmd /c "cls && color 2 && echo 123"' + else + call writefile(["\<Esc>[32m123"], 'Xtext') + return "cat Xtext" + endif +endfunc + +func Test_terminal_nasty_cb() + let cmd = Get_cat_123_cmd() + let g:buf = term_start(cmd, {'exit_cb': function('s:Nasty_exit_cb')}) + let g:job = term_getjob(g:buf) + + call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) + call WaitForAssert({-> assert_equal(0, g:buf)}) + unlet g:buf + unlet g:job + call delete('Xtext') +endfunc + +func Check_123(buf) + let l = term_scrape(a:buf, 0) + call assert_true(len(l) == 0) + let l = term_scrape(a:buf, 999) + call assert_true(len(l) == 0) + let l = term_scrape(a:buf, 1) + call assert_true(len(l) > 0) + call assert_equal('1', l[0].chars) + call assert_equal('2', l[1].chars) + call assert_equal('3', l[2].chars) + call assert_equal('#00e000', l[0].fg) + if &background == 'light' + call assert_equal('#ffffff', l[0].bg) + else + call assert_equal('#000000', l[0].bg) + endif + + let l = term_getline(a:buf, -1) + call assert_equal('', l) + let l = term_getline(a:buf, 0) + call assert_equal('', l) + let l = term_getline(a:buf, 999) + call assert_equal('', l) + let l = term_getline(a:buf, 1) + call assert_equal('123', l) +endfunc + +func Test_terminal_scrape_123() + let cmd = Get_cat_123_cmd() + let buf = term_start(cmd) + + let termlist = term_list() + call assert_equal(1, len(termlist)) + call assert_equal(buf, termlist[0]) + + " Nothing happens with invalid buffer number + call term_wait(1234) + + call term_wait(buf) + " On MS-Windows we first get a startup message of two lines, wait for the + " "cls" to happen, after that we have one line with three characters. + call WaitForAssert({-> assert_equal(3, len(term_scrape(buf, 1)))}) + call Check_123(buf) + + " Must still work after the job ended. + let job = term_getjob(buf) + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + call term_wait(buf) + call Check_123(buf) + + exe buf . 'bwipe' + call delete('Xtext') +endfunc + +func Test_terminal_scrape_multibyte() + if !has('multi_byte') + return + endif + call writefile(["léttまrs"], 'Xtext') + if has('win32') + " Run cmd with UTF-8 codepage to make the type command print the expected + " multibyte characters. + let buf = term_start("cmd /K chcp 65001") + call term_sendkeys(buf, "type Xtext\<CR>") + call term_sendkeys(buf, "exit\<CR>") + let line = 4 + else + let buf = term_start("cat Xtext") + let line = 1 + endif + + call WaitFor({-> len(term_scrape(buf, line)) >= 7 && term_scrape(buf, line)[0].chars == "l"}) + let l = term_scrape(buf, line) + call assert_true(len(l) >= 7) + call assert_equal('l', l[0].chars) + call assert_equal('é', l[1].chars) + call assert_equal(1, l[1].width) + call assert_equal('t', l[2].chars) + call assert_equal('t', l[3].chars) + call assert_equal('ま', l[4].chars) + call assert_equal(2, l[4].width) + call assert_equal('r', l[5].chars) + call assert_equal('s', l[6].chars) + + let job = term_getjob(buf) + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + call term_wait(buf) + + exe buf . 'bwipe' + call delete('Xtext') +endfunc + +func Test_terminal_scroll() + call writefile(range(1, 200), 'Xtext') + if has('win32') + let cmd = 'cmd /c "type Xtext"' + else + let cmd = "cat Xtext" + endif + let buf = term_start(cmd) + + let job = term_getjob(buf) + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + call term_wait(buf) + if has('win32') + " TODO: this should not be needed + sleep 100m + endif + + let scrolled = term_getscrolled(buf) + call assert_equal('1', getline(1)) + call assert_equal('1', term_getline(buf, 1 - scrolled)) + call assert_equal('49', getline(49)) + call assert_equal('49', term_getline(buf, 49 - scrolled)) + call assert_equal('200', getline(200)) + call assert_equal('200', term_getline(buf, 200 - scrolled)) + + exe buf . 'bwipe' + call delete('Xtext') +endfunc + +func Test_terminal_scrollback() + let buf = Run_shell_in_terminal({'term_rows': 15}) + set termwinscroll=100 + call writefile(range(150), 'Xtext') + if has('win32') + call term_sendkeys(buf, "type Xtext\<CR>") + else + call term_sendkeys(buf, "cat Xtext\<CR>") + endif + let rows = term_getsize(buf)[0] + " On MS-Windows there is an empty line, check both last line and above it. + call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows - 2))}) + let lines = line('$') + call assert_inrange(91, 100, lines) + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + set termwinscroll& +endfunc + +func Test_terminal_size() + let cmd = Get_cat_123_cmd() + + exe 'terminal ++rows=5 ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal(5, size[0]) + + call term_start(cmd, {'term_rows': 6}) + let size = term_getsize('') + bwipe! + call assert_equal(6, size[0]) + + vsplit + exe 'terminal ++rows=5 ++cols=33 ' . cmd + call assert_equal([5, 33], term_getsize('')) + + call term_setsize('', 6, 0) + call assert_equal([6, 33], term_getsize('')) + + call term_setsize('', 0, 35) + call assert_equal([6, 35], term_getsize('')) + + call term_setsize('', 7, 30) + call assert_equal([7, 30], term_getsize('')) + + bwipe! + call assert_fails("call term_setsize('', 7, 30)", "E955:") + + call term_start(cmd, {'term_rows': 6, 'term_cols': 36}) + let size = term_getsize('') + bwipe! + call assert_equal([6, 36], size) + + exe 'vertical terminal ++cols=20 ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal(20, size[1]) + + call term_start(cmd, {'vertical': 1, 'term_cols': 26}) + let size = term_getsize('') + bwipe! + call assert_equal(26, size[1]) + + split + exe 'vertical terminal ++rows=6 ++cols=20 ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal([6, 20], size) + + call term_start(cmd, {'vertical': 1, 'term_rows': 7, 'term_cols': 27}) + let size = term_getsize('') + bwipe! + call assert_equal([7, 27], size) + + call delete('Xtext') +endfunc + +func Test_terminal_curwin() + let cmd = Get_cat_123_cmd() + call assert_equal(1, winnr('$')) + + split dummy + exe 'terminal ++curwin ' . cmd + call assert_equal(2, winnr('$')) + bwipe! + + split dummy + call term_start(cmd, {'curwin': 1}) + call assert_equal(2, winnr('$')) + bwipe! + + split dummy + call setline(1, 'change') + call assert_fails('terminal ++curwin ' . cmd, 'E37:') + call assert_equal(2, winnr('$')) + exe 'terminal! ++curwin ' . cmd + call assert_equal(2, winnr('$')) + bwipe! + + split dummy + call setline(1, 'change') + call assert_fails("call term_start(cmd, {'curwin': 1})", 'E37:') + call assert_equal(2, winnr('$')) + bwipe! + + split dummy + bwipe! + call delete('Xtext') +endfunc + +func s:get_sleep_cmd() + if s:python != '' + let cmd = s:python . " test_short_sleep.py" + " 500 was not enough for Travis + let waittime = 900 + else + echo 'This will take five seconds...' + let waittime = 2000 + if has('win32') + let cmd = $windir . '\system32\timeout.exe 1' + else + let cmd = 'sleep 1' + endif + endif + return [cmd, waittime] +endfunc + +func Test_terminal_finish_open_close() + call assert_equal(1, winnr('$')) + + let [cmd, waittime] = s:get_sleep_cmd() + + " shell terminal closes automatically + terminal + let buf = bufnr('%') + call assert_equal(2, winnr('$')) + " Wait for the shell to display a prompt + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + call Stop_shell_in_terminal(buf) + call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) + + " shell terminal that does not close automatically + terminal ++noclose + let buf = bufnr('%') + call assert_equal(2, winnr('$')) + " Wait for the shell to display a prompt + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + call Stop_shell_in_terminal(buf) + call assert_equal(2, winnr('$')) + quit + call assert_equal(1, winnr('$')) + + exe 'terminal ++close ' . cmd + call assert_equal(2, winnr('$')) + wincmd p + call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) + + call term_start(cmd, {'term_finish': 'close'}) + call assert_equal(2, winnr('$')) + wincmd p + call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) + call assert_equal(1, winnr('$')) + + exe 'terminal ++open ' . cmd + close! + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + bwipe + + call term_start(cmd, {'term_finish': 'open'}) + close! + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + bwipe + + exe 'terminal ++hidden ++open ' . cmd + call assert_equal(1, winnr('$')) + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + bwipe + + call term_start(cmd, {'term_finish': 'open', 'hidden': 1}) + call assert_equal(1, winnr('$')) + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + bwipe + + call assert_fails("call term_start(cmd, {'term_opencmd': 'open'})", 'E475:') + call assert_fails("call term_start(cmd, {'term_opencmd': 'split %x'})", 'E475:') + call assert_fails("call term_start(cmd, {'term_opencmd': 'split %d and %s'})", 'E475:') + call assert_fails("call term_start(cmd, {'term_opencmd': 'split % and %d'})", 'E475:') + + call term_start(cmd, {'term_finish': 'open', 'term_opencmd': '4split | buffer %d'}) + close! + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + call assert_equal(4, winheight(0)) + bwipe +endfunc + +func Test_terminal_cwd() + if !executable('pwd') + return + endif + call mkdir('Xdir') + let buf = term_start('pwd', {'cwd': 'Xdir'}) + call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))}) + + exe buf . 'bwipe' + call delete('Xdir', 'rf') +endfunc + +func Test_terminal_servername() + if !has('clientserver') + return + endif + call s:test_environment("VIM_SERVERNAME", v:servername) +endfunc + +func Test_terminal_version() + call s:test_environment("VIM_TERMINAL", string(v:version)) +endfunc + +func s:test_environment(name, value) + let buf = Run_shell_in_terminal({}) + " Wait for the shell to display a prompt + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + if has('win32') + call term_sendkeys(buf, "echo %" . a:name . "%\r") + else + call term_sendkeys(buf, "echo $" . a:name . "\r") + endif + call term_wait(buf) + call Stop_shell_in_terminal(buf) + call WaitForAssert({-> assert_equal(a:value, getline(2))}) + + exe buf . 'bwipe' + unlet buf +endfunc + +func Test_terminal_env() + let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) + " Wait for the shell to display a prompt + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + if has('win32') + call term_sendkeys(buf, "echo %TESTENV%\r") + else + call term_sendkeys(buf, "echo $TESTENV\r") + endif + call term_wait(buf) + call Stop_shell_in_terminal(buf) + call WaitForAssert({-> assert_equal('correct', getline(2))}) + + exe buf . 'bwipe' +endfunc + +" must be last, we can't go back from GUI to terminal +func Test_zz_terminal_in_gui() + if !CanRunGui() + return + endif + + " Ignore the "failed to create input context" error. + call test_ignore_error('E285:') + + gui -f + + call assert_equal(1, winnr('$')) + let buf = Run_shell_in_terminal({'term_finish': 'close'}) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + " closing window wipes out the terminal buffer a with finished job + call WaitForAssert({-> assert_equal(1, winnr('$'))}) + call assert_equal("", bufname(buf)) + + unlet g:job +endfunc + +func Test_terminal_list_args() + let buf = term_start([&shell, &shellcmdflag, 'echo "123"']) + call assert_fails(buf . 'bwipe', 'E517') + exe buf . 'bwipe!' + call assert_equal("", bufname(buf)) +endfunction + +func Test_terminal_noblock() + let buf = term_start(&shell) + if has('mac') + " The shell or something else has a problem dealing with more than 1000 + " characters at the same time. + if has('gui_running') + " PIPE_BUF is 512 + let len = 512 - 5 - 1 + else + let len = 1000 + endif + else + let len = 5000 + endif + + for c in ['a','b','c','d','e','f','g','h','i','j','k'] + call term_sendkeys(buf, 'echo ' . repeat(c, len) . "\<cr>") + endfor + call term_sendkeys(buf, "echo done\<cr>") + + " On MS-Windows there is an extra empty line below "done". Find "done" in + " the last-but-one or the last-but-two line. + let lnum = term_getsize(buf)[0] - 1 + call WaitFor({-> term_getline(buf, lnum) =~ "done" || term_getline(buf, lnum - 1) =~ "done"}, 10000) + let line = term_getline(buf, lnum) + if line !~ 'done' + let line = term_getline(buf, lnum - 1) + endif + call assert_match('done', line) + + let g:job = term_getjob(buf) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + unlet g:job + bwipe +endfunc + +func Test_terminal_write_stdin() + if !executable('wc') + throw 'skipped: wc command not available' + endif + if has('win32') + " TODO: enable once writing to stdin works on MS-Windows + return + endif + new + call setline(1, ['one', 'two', 'three']) + %term wc + call WaitForAssert({-> assert_match('3', getline("$"))}) + let nrs = split(getline('$')) + call assert_equal(['3', '3', '14'], nrs) + bwipe + + new + call setline(1, ['one', 'two', 'three', 'four']) + 2,3term wc + call WaitForAssert({-> assert_match('2', getline("$"))}) + let nrs = split(getline('$')) + call assert_equal(['2', '2', '10'], nrs) + bwipe + + if executable('python') + new + call setline(1, ['print("hello")']) + 1term ++eof=exit() python + " MS-Windows echoes the input, Unix doesn't. + call WaitFor('getline("$") =~ "exit" || getline(1) =~ "hello"') + if getline(1) =~ 'hello' + call assert_equal('hello', getline(1)) + else + call assert_equal('hello', getline(line('$') - 1)) + endif + bwipe + + if has('win32') + new + call setline(1, ['print("hello")']) + 1term ++eof=<C-Z> python + call WaitForAssert({-> assert_match('Z', getline("$"))}) + call assert_equal('hello', getline(line('$') - 1)) + bwipe + endif + endif + + bwipe! +endfunc + +func Test_terminal_no_cmd() + " Todo: make this work in the GUI + if !has('gui_running') + return + endif + let buf = term_start('NONE', {}) + call assert_notequal(0, buf) + + let pty = job_info(term_getjob(buf))['tty_out'] + call assert_notequal('', pty) + if has('win32') + silent exe '!start cmd /c "echo look here > ' . pty . '"' + else + call system('echo "look here" > ' . pty) + endif + call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))}) + + bwipe! +endfunc + +func Test_terminal_special_chars() + " this file name only works on Unix + if !has('unix') + return + endif + call mkdir('Xdir with spaces') + call writefile(['x'], 'Xdir with spaces/quoted"file') + term ls Xdir\ with\ spaces/quoted\"file + call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) + call term_wait('') + + call delete('Xdir with spaces', 'rf') + bwipe +endfunc + +func Test_terminal_wrong_options() + call assert_fails('call term_start(&shell, { + \ "in_io": "file", + \ "in_name": "xxx", + \ "out_io": "file", + \ "out_name": "xxx", + \ "err_io": "file", + \ "err_name": "xxx" + \ })', 'E474:') + call assert_fails('call term_start(&shell, { + \ "out_buf": bufnr("%") + \ })', 'E474:') + call assert_fails('call term_start(&shell, { + \ "err_buf": bufnr("%") + \ })', 'E474:') +endfunc + +func Test_terminal_redir_file() + let cmd = Get_cat_123_cmd() + let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) + call term_wait(buf) + call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) + call assert_match('123', readfile('Xfile')[0]) + let g:job = term_getjob(buf) + call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) + call delete('Xfile') + bwipe + + if has('unix') + call writefile(['one line'], 'Xfile') + let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) + call term_wait(buf) + call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))}) + let g:job = term_getjob(buf) + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + bwipe + call delete('Xfile') + endif +endfunc + +func TerminalTmap(remap) + let buf = Run_shell_in_terminal({}) + call assert_equal('t', mode()) + + if a:remap + tmap 123 456 + else + tnoremap 123 456 + endif + " don't use abcde, it's an existing command + tmap 456 abxde + call assert_equal('456', maparg('123', 't')) + call assert_equal('abxde', maparg('456', 't')) + call feedkeys("123", 'tx') + call WaitForAssert({-> assert_match('abxde\|456', term_getline(buf, term_getcursor(buf)[0]))}) + let lnum = term_getcursor(buf)[0] + if a:remap + call assert_match('abxde', term_getline(buf, lnum)) + else + call assert_match('456', term_getline(buf, lnum)) + endif + + call term_sendkeys(buf, "\r") + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + tunmap 123 + tunmap 456 + call assert_equal('', maparg('123', 't')) + close + unlet g:job +endfunc + +func Test_terminal_tmap() + call TerminalTmap(1) + call TerminalTmap(0) +endfunc + +func Test_terminal_wall() + let buf = Run_shell_in_terminal({}) + wall + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + +func Test_terminal_wqall() + let buf = Run_shell_in_terminal({}) + call assert_fails('wqall', 'E948') + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + +func Test_terminal_composing_unicode() + let save_enc = &encoding + set encoding=utf-8 + + if has('win32') + let cmd = "cmd /K chcp 65001" + let lnum = [3, 6, 9] + else + let cmd = &shell + let lnum = [1, 3, 5] + endif + + enew + let buf = term_start(cmd, {'curwin': bufnr('')}) + let g:job = term_getjob(buf) + call term_wait(buf, 50) + + if has('win32') + call assert_equal('cmd', job_info(g:job).cmd[0]) + else + call assert_equal(&shell, job_info(g:job).cmd[0]) + endif + + " ascii + composing + let txt = "a\u0308bc" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[0])) + call assert_equal(txt, term_getline(buf, lnum[0] + 1)) + let l = term_scrape(buf, lnum[0] + 1) + call assert_equal("a\u0308", l[0].chars) + call assert_equal("b", l[1].chars) + call assert_equal("c", l[2].chars) + + " multibyte + composing + let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[1])) + call assert_equal(txt, term_getline(buf, lnum[1] + 1)) + let l = term_scrape(buf, lnum[1] + 1) + call assert_equal("\u304b\u3099", l[0].chars) + call assert_equal("\u304e", l[1].chars) + call assert_equal("\u304f\u3099", l[2].chars) + call assert_equal("\u3052", l[3].chars) + call assert_equal("\u3053\u3099", l[4].chars) + + " \u00a0 + composing + let txt = "abc\u00a0\u0308" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[2])) + call assert_equal(txt, term_getline(buf, lnum[2] + 1)) + let l = term_scrape(buf, lnum[2] + 1) + call assert_equal("\u00a0\u0308", l[3].chars) + + call term_sendkeys(buf, "exit\r") + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + bwipe! + unlet g:job + let &encoding = save_enc +endfunc + +func Test_terminal_aucmd_on_close() + fun Nop() + let s:called = 1 + endfun + + aug repro + au! + au BufWinLeave * call Nop() + aug END + + let [cmd, waittime] = s:get_sleep_cmd() + + call assert_equal(1, winnr('$')) + new + call setline(1, ['one', 'two']) + exe 'term ++close ' . cmd + wincmd p + call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) + call assert_equal(1, s:called) + bwipe! + + unlet s:called + au! repro + delfunc Nop +endfunc + +func Test_terminal_term_start_empty_command() + " Workaround: ignore "No Menu" error + if has('gui_macvim') && has('gui_running') + call test_ignore_error('E329') + endif + + let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" + call assert_fails(cmd, 'E474') + let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" + call assert_fails(cmd, 'E474') + let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})" + call assert_fails(cmd, 'E474') + let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" + call assert_fails(cmd, 'E474') +endfunc + +func Test_terminal_response_to_control_sequence() + if !has('unix') + return + endif + + let buf = Run_shell_in_terminal({}) + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + + call term_sendkeys(buf, "cat\<CR>") + call WaitForAssert({-> assert_match('cat', term_getline(buf, 1))}) + + " Request the cursor position. + call term_sendkeys(buf, "\x1b[6n\<CR>") + + " Wait for output from tty to display, below an empty line. + call WaitForAssert({-> assert_match('3;1R', term_getline(buf, 4))}) + + " End "cat" gently. + call term_sendkeys(buf, "\<CR>\<C-D>") + + call Stop_shell_in_terminal(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + +" Run Vim, start a terminal in that Vim with the kill argument, +" :qall works. +func Run_terminal_qall_kill(line1, line2) + " 1. Open a terminal window and wait for the prompt to appear + " 2. set kill using term_setkill() + " 3. make Vim exit, it will kill the shell + let after = [ + \ a:line1, + \ 'let buf = bufnr("%")', + \ 'while term_getline(buf, 1) =~ "^\\s*$"', + \ ' sleep 10m', + \ 'endwhile', + \ a:line2, + \ 'au VimLeavePre * call writefile(["done"], "Xdone")', + \ 'qall', + \ ] + if !RunVim([], after, '') + return + endif + call assert_equal("done", readfile("Xdone")[0]) + call delete("Xdone") +endfunc + +" Run Vim in a terminal, then start a terminal in that Vim with a kill +" argument, check that :qall works. +func Test_terminal_qall_kill_arg() + call Run_terminal_qall_kill('term ++kill=kill', '') +endfunc + +" Run Vim, start a terminal in that Vim, set the kill argument with +" term_setkill(), check that :qall works. +func Test_terminal_qall_kill_func() + call Run_terminal_qall_kill('term', 'call term_setkill(buf, "kill")') +endfunc + +" Run Vim, start a terminal in that Vim without the kill argument, +" check that :qall does not exit, :qall! does. +func Test_terminal_qall_exit() + let after = [ + \ 'term', + \ 'let buf = bufnr("%")', + \ 'while term_getline(buf, 1) =~ "^\\s*$"', + \ ' sleep 10m', + \ 'endwhile', + \ 'set nomore', + \ 'au VimLeavePre * call writefile(["too early"], "Xdone")', + \ 'qall', + \ 'au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")', + \ 'cquit', + \ ] + if !RunVim([], after, '') + return + endif + call assert_equal("done", readfile("Xdone")[0]) + call delete("Xdone") +endfunc + +" Run Vim in a terminal, then start a terminal in that Vim without a kill +" argument, check that :confirm qall works. +func Test_terminal_qall_prompt() + if !CanRunVimInTerminal() + return + endif + let buf = RunVimInTerminal('', {}) + + " Open a terminal window and wait for the prompt to appear + call term_sendkeys(buf, ":term\<CR>") + call WaitForAssert({-> assert_match('\[running]', term_getline(buf, 10))}) + call WaitForAssert({-> assert_notmatch('^\s*$', term_getline(buf, 1))}) + + " make Vim exit, it will prompt to kill the shell + call term_sendkeys(buf, "\<C-W>:confirm qall\<CR>") + call WaitForAssert({-> assert_match('ancel:', term_getline(buf, 20))}) + call term_sendkeys(buf, "y") + call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) + + " close the terminal window where Vim was running + quit +endfunc + +func Test_terminal_open_autocmd() + augroup repro + au! + au TerminalOpen * let s:called += 1 + augroup END + + let s:called = 0 + + " Open a terminal window with :terminal + terminal + call assert_equal(1, s:called) + bwipe! + + " Open a terminal window with term_start() + call term_start(&shell) + call assert_equal(2, s:called) + bwipe! + + " Open a hidden terminal buffer with :terminal + terminal ++hidden + call assert_equal(3, s:called) + for buf in term_list() + exe buf . "bwipe!" + endfor + + " Open a hidden terminal buffer with term_start() + let buf = term_start(&shell, {'hidden': 1}) + call assert_equal(4, s:called) + exe buf . "bwipe!" + + unlet s:called + au! repro +endfunction + +func Check_dump01(off) + call assert_equal('one two three four five', trim(getline(a:off + 1))) + call assert_equal('~ Select Word', trim(getline(a:off + 7))) + call assert_equal(':popup PopUp', trim(getline(a:off + 20))) +endfunc + +func Test_terminal_dumpwrite_composing() + if !CanRunVimInTerminal() + return + endif + let save_enc = &encoding + set encoding=utf-8 + call assert_equal(1, winnr('$')) + + let text = " a\u0300 e\u0302 o\u0308" + call writefile([text], 'Xcomposing') + let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {}) + call WaitForAssert({-> assert_match(text, term_getline(buf, 1))}) + call term_dumpwrite(buf, 'Xdump') + let dumpline = readfile('Xdump')[0] + call assert_match('|à| |ê| |ö', dumpline) + + call StopVimInTerminal(buf) + call delete('Xcomposing') + call delete('Xdump') + let &encoding = save_enc +endfunc + +" just testing basic functionality. +func Test_terminal_dumpload() + call assert_equal(1, winnr('$')) + call term_dumpload('dumps/Test_popup_command_01.dump') + call assert_equal(2, winnr('$')) + call assert_equal(20, line('$')) + call Check_dump01(0) + quit +endfunc + +func Test_terminal_dumpdiff() + call assert_equal(1, winnr('$')) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump') + call assert_equal(2, winnr('$')) + call assert_equal(62, line('$')) + call Check_dump01(0) + call Check_dump01(42) + call assert_equal(' bbbbbbbbbbbbbbbbbb ', getline(26)[0:29]) + quit +endfunc + +func Test_terminal_dumpdiff_options() + set laststatus=0 + call assert_equal(1, winnr('$')) + let height = winheight(0) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 1, 'term_cols': 33}) + call assert_equal(2, winnr('$')) + call assert_equal(height, winheight(winnr())) + call assert_equal(33, winwidth(winnr())) + call assert_equal('dump diff dumps/Test_popup_command_01.dump', bufname('%')) + quit + + call assert_equal(1, winnr('$')) + let width = winwidth(0) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 0, 'term_rows': 13, 'term_name': 'something else'}) + call assert_equal(2, winnr('$')) + call assert_equal(width, winwidth(winnr())) + call assert_equal(13, winheight(winnr())) + call assert_equal('something else', bufname('%')) + quit + + call assert_equal(1, winnr('$')) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1}) + call assert_equal(1, winnr('$')) + bwipe + + set laststatus& +endfunc + +func Api_drop_common(options) + call assert_equal(1, winnr('$')) + + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', + \ 'let &titlestring = ''["drop","Xtextfile"' . a:options . ']''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> bufnr('Xtextfile') > 0}) + call assert_equal('Xtextfile', expand('%:t')) + call assert_true(winnr('$') >= 3) + return buf +endfunc + +func Test_terminal_api_drop_newwin() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common('') + call assert_equal(0, &bin) + call assert_equal('', &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_bin() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"bin":1}') + call assert_equal(1, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_binary() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"binary":1}') + call assert_equal(1, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_nobin() + if !CanRunVimInTerminal() + return + endif + set binary + let buf = Api_drop_common(',{"nobin":1}') + call assert_equal(0, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile + set nobinary +endfunc + +func Test_terminal_api_drop_newwin_nobinary() + if !CanRunVimInTerminal() + return + endif + set binary + let buf = Api_drop_common(',{"nobinary":1}') + call assert_equal(0, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile + set nobinary +endfunc + +func Test_terminal_api_drop_newwin_ff() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"ff":"dos"}') + call assert_equal("dos", &ff) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_fileformat() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"fileformat":"dos"}') + call assert_equal("dos", &ff) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_enc() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"enc":"utf-16"}') + call assert_equal("utf-16", &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_encoding() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"encoding":"utf-16"}') + call assert_equal("utf-16", &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_oldwin() + if !CanRunVimInTerminal() + return + endif + let firstwinid = win_getid() + split Xtextfile + let textfile_winid = win_getid() + call assert_equal(2, winnr('$')) + call win_gotoid(firstwinid) + + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', + \ 'let &titlestring = ''["drop","Xtextfile"]''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) + call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))}) + call assert_equal(textfile_winid, win_getid()) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Tapi_TryThis(bufnum, arg) + let g:called_bufnum = a:bufnum + let g:called_arg = a:arg +endfunc + +func WriteApiCall(funcname) + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', + \ 'let &titlestring = ''["call","' . a:funcname . '",["hello",123]]''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') +endfunc + +func Test_terminal_api_call() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('Tapi_TryThis') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> exists('g:called_bufnum')}) + call assert_equal(buf, g:called_bufnum) + call assert_equal(['hello', 123], g:called_arg) + + call StopVimInTerminal(buf) + call delete('Xscript') + unlet g:called_bufnum + unlet g:called_arg +endfunc + +func Test_terminal_api_call_fails() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('TryThis') + call ch_logfile('Xlog', 'w') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitForAssert({-> assert_match('Invalid function name: TryThis', string(readfile('Xlog')))}) + + call StopVimInTerminal(buf) + call delete('Xscript') + call ch_logfile('', '') + call delete('Xlog') +endfunc + +let s:caught_e937 = 0 + +func Tapi_Delete(bufnum, arg) + try + execute 'bdelete!' a:bufnum + catch /E937:/ + let s:caught_e937 = 1 + endtry +endfunc + +func Test_terminal_api_call_fail_delete() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('Tapi_Delete') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitForAssert({-> assert_equal(1, s:caught_e937)}) + + call StopVimInTerminal(buf) + call delete('Xscript') + call ch_logfile('', '') +endfunc + +func Test_terminal_ansicolors_default() + let colors = [ + \ '#000000', '#e00000', + \ '#00e000', '#e0e000', + \ '#0000e0', '#e000e0', + \ '#00e0e0', '#e0e0e0', + \ '#808080', '#ff4040', + \ '#40ff40', '#ffff40', + \ '#4040ff', '#ff40ff', + \ '#40ffff', '#ffffff', + \] + + let buf = Run_shell_in_terminal({}) + call assert_equal(colors, term_getansicolors(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + exe buf . 'bwipe' +endfunc + +let s:test_colors = [ + \ '#616e64', '#0d0a79', + \ '#6d610d', '#0a7373', + \ '#690d0a', '#6d696e', + \ '#0d0a6f', '#616e0d', + \ '#0a6479', '#6d0d0a', + \ '#617373', '#0d0a69', + \ '#6d690d', '#0a6e6f', + \ '#610d0a', '#6e6479', + \] + +func Test_terminal_ansicolors_global() + let g:terminal_ansi_colors = reverse(copy(s:test_colors)) + let buf = Run_shell_in_terminal({}) + call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + exe buf . 'bwipe' + unlet g:terminal_ansi_colors +endfunc + +func Test_terminal_ansicolors_func() + let g:terminal_ansi_colors = reverse(copy(s:test_colors)) + let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) + call assert_equal(s:test_colors, term_getansicolors(buf)) + + call term_setansicolors(buf, g:terminal_ansi_colors) + call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) + + let colors = [ + \ 'ivory', 'AliceBlue', + \ 'grey67', 'dark goldenrod', + \ 'SteelBlue3', 'PaleVioletRed4', + \ 'MediumPurple2', 'yellow2', + \ 'RosyBrown3', 'OrangeRed2', + \ 'white smoke', 'navy blue', + \ 'grey47', 'gray97', + \ 'MistyRose2', 'DodgerBlue4', + \] + call term_setansicolors(buf, colors) + + let colors[4] = 'Invalid' + call assert_fails('call term_setansicolors(buf, colors)', 'E474:') + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' +endfunc + +func Test_terminal_termwinsize_option_fixed() + if !CanRunVimInTerminal() + return + endif + set termwinsize=6x40 + let text = [] + for n in range(10) + call add(text, repeat(n, 50)) + endfor + call writefile(text, 'Xwinsize') + let buf = RunVimInTerminal('Xwinsize', {}) + let win = bufwinid(buf) + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(6, winheight(win)) + call assert_equal(40, winwidth(win)) + + " resizing the window doesn't resize the terminal. + resize 10 + vertical resize 60 + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(10, winheight(win)) + call assert_equal(60, winwidth(win)) + + call StopVimInTerminal(buf) + call delete('Xwinsize') + + call assert_fails('set termwinsize=40', 'E474') + call assert_fails('set termwinsize=10+40', 'E474') + call assert_fails('set termwinsize=abc', 'E474') + + set termwinsize= +endfunc + +func Test_terminal_termwinsize_option_zero() + set termwinsize=0x0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize=7x0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([7, winwidth(win)], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize=0x33 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), 33], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize= +endfunc + +func Test_terminal_termwinsize_mininmum() + set termwinsize=10*50 + vsplit + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_inrange(10, 1000, winheight(win)) + call assert_inrange(50, 1000, winwidth(win)) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + + resize 15 + vertical resize 60 + redraw + call assert_equal([15, 60], term_getsize(buf)) + call assert_equal(15, winheight(win)) + call assert_equal(60, winwidth(win)) + + resize 7 + vertical resize 30 + redraw + call assert_equal([10, 50], term_getsize(buf)) + call assert_equal(7, winheight(win)) + call assert_equal(30, winwidth(win)) + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize=0*0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize= +endfunc + +func Test_terminal_termwinkey() + call assert_equal(1, winnr('$')) + let thiswin = win_getid() + + let buf = Run_shell_in_terminal({}) + let termwin = bufwinid(buf) + set termwinkey=<C-L> + call feedkeys("\<C-L>w", 'tx') + call assert_equal(thiswin, win_getid()) + call feedkeys("\<C-W>w", 'tx') + + let job = term_getjob(buf) + call feedkeys("\<C-L>\<C-C>", 'tx') + call WaitForAssert({-> assert_equal("dead", job_status(job))}) +endfunc + +func Test_terminal_out_err() + if !has('unix') + return + endif + call writefile([ + \ '#!/bin/sh', + \ 'echo "this is standard error" >&2', + \ 'echo "this is standard out" >&1', + \ ], 'Xechoerrout.sh') + call setfperm('Xechoerrout.sh', 'rwxrwx---') + + let outfile = 'Xtermstdout' + let buf = term_start(['./Xechoerrout.sh'], {'out_io': 'file', 'out_name': outfile}) + call WaitForAssert({-> assert_inrange(1, 2, len(readfile(outfile)))}) + call assert_equal("this is standard out", readfile(outfile)[0]) + call assert_equal('this is standard error', term_getline(buf, 1)) + + call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) + exe buf . 'bwipe' + call delete('Xechoerrout.sh') + call delete(outfile) +endfunc + +func Test_terminwinscroll() + if !has('unix') + return + endif + + " Let the terminal output more than 'termwinscroll' lines, some at the start + " will be dropped. + exe 'set termwinscroll=' . &lines + let buf = term_start('/bin/sh') + for i in range(1, &lines) + call feedkeys("echo " . i . "\<CR>", 'xt') + call WaitForAssert({-> assert_match(string(i), term_getline(buf, term_getcursor(buf)[0] - 1))}) + endfor + " Go to Terminal-Normal mode to update the buffer. + call feedkeys("\<C-W>N", 'xt') + call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$')) + + " Every "echo nr" must only appear once + let lines = getline(1, line('$')) + for i in range(&lines - len(lines) / 2 + 2, &lines) + let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'}) + call assert_equal(1, len(filtered), 'for "echo ' . i . '"') + endfor + + exe buf . 'bwipe!' +endfunc diff --git a/src/testdir/test_terminal_fail.vim b/src/testdir/test_terminal_fail.vim new file mode 100644 index 0000000000..aad4b98cb5 --- /dev/null +++ b/src/testdir/test_terminal_fail.vim @@ -0,0 +1,21 @@ +" This test is in a separate file, because it usually causes reports for memory +" leaks under valgrind. That is because when fork/exec fails memory is not +" freed. Since the process exists right away it's not a real leak. + +if !has('terminal') + finish +endif + +source shared.vim + +func Test_terminal_redir_fails() + if has('unix') + let buf = term_start('xyzabc', {'err_io': 'file', 'err_name': 'Xfile'}) + call term_wait(buf) + call WaitFor('len(readfile("Xfile")) > 0') + call assert_match('executing job failed', readfile('Xfile')[0]) + call WaitFor('!&modified') + call delete('Xfile') + bwipe + endif +endfunc diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim new file mode 100644 index 0000000000..377f761b74 --- /dev/null +++ b/src/testdir/test_textformat.vim @@ -0,0 +1,454 @@ +" Tests for the various 'formatoptions' settings +func Test_text_format() + enew! + + setl noai tw=2 fo=t + call append('$', [ + \ '{', + \ ' ', + \ '', + \ '}']) + exe "normal /^{/+1\n0" + normal gRa b + let lnum = line('.') + call assert_equal([ + \ 'a', + \ 'b'], getline(lnum - 1, lnum)) + + normal ggdG + setl ai tw=2 fo=tw + call append('$', [ + \ '{', + \ 'a b ', + \ '', + \ 'a ', + \ '}']) + exe "normal /^{/+1\n0" + normal gqgqjjllab + let lnum = line('.') + call assert_equal([ + \ 'a ', + \ 'b ', + \ '', + \ 'a ', + \ 'b'], getline(lnum - 4, lnum)) + + normal ggdG + setl tw=3 fo=t + call append('$', [ + \ '{', + \ "a \<C-A>", + \ '}']) + exe "normal /^{/+1\n0" + exe "normal gqgqo\na \<C-V>\<C-A>" + let lnum = line('.') + call assert_equal([ + \ 'a', + \ "\<C-A>", + \ '', + \ 'a', + \ "\<C-A>"], getline(lnum - 4, lnum)) + + normal ggdG + setl tw=2 fo=tcq1 comments=:# + call append('$', [ + \ '{', + \ 'a b', + \ '#a b', + \ '}']) + exe "normal /^{/+1\n0" + exe "normal gqgqjgqgqo\na b\n#a b" + let lnum = line('.') + call assert_equal([ + \ 'a b', + \ '#a b', + \ '', + \ 'a b', + \ '#a b'], getline(lnum - 4, lnum)) + + normal ggdG + setl tw=5 fo=tcn comments=:# + call append('$', [ + \ '{', + \ ' 1 a', + \ '# 1 a', + \ '}']) + exe "normal /^{/+1\n0" + exe "normal A b\<Esc>jA b" + let lnum = line('.') + call assert_equal([ + \ ' 1 a', + \ ' b', + \ '# 1 a', + \ '# b'], getline(lnum - 3, lnum)) + + normal ggdG + setl tw=5 fo=t2a si + call append('$', [ + \ '{', + \ '', + \ ' x a', + \ ' b', + \ ' c', + \ '', + \ '}']) + exe "normal /^{/+3\n0" + exe "normal i \<Esc>A_" + let lnum = line('.') + call assert_equal([ + \ '', + \ ' x a', + \ ' b_', + \ ' c', + \ ''], getline(lnum - 2, lnum + 2)) + + normal ggdG + setl tw=5 fo=qn comments=:# + call append('$', [ + \ '{', + \ '# 1 a b', + \ '}']) + exe "normal /^{/+1\n5|" + normal gwap + call assert_equal(5, col('.')) + let lnum = line('.') + call assert_equal([ + \ '# 1 a', + \ '# b'], getline(lnum, lnum + 1)) + + normal ggdG + setl tw=5 fo=q2 comments=:# + call append('$', [ + \ '{', + \ '# x', + \ '# a b', + \ '}']) + exe "normal /^{/+1\n0" + normal gwap + let lnum = line('.') + call assert_equal([ + \ '# x a', + \ '# b'], getline(lnum, lnum + 1)) + + normal ggdG + setl tw& fo=a + call append('$', [ + \ '{', + \ ' 1aa', + \ ' 2bb', + \ '}']) + exe "normal /^{/+2\n0" + normal I^^ + call assert_equal('{ 1aa ^^2bb }', getline('.')) + + normal ggdG + setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/ + call append('$', [ + \ '/* abc def ghi jkl ', + \ ' * mno pqr stu', + \ ' */']) + exe "normal /mno pqr/\n" + normal A vwx yz + let lnum = line('.') + call assert_equal([ + \ ' * mno pqr stu ', + \ ' * vwx yz', + \ ' */'], getline(lnum - 1, lnum + 1)) + + normal ggdG + setl tw=12 fo=tqnc comments=:# + call setline('.', '# 1 xxxxx') + normal A foobar + call assert_equal([ + \ '# 1 xxxxx', + \ '# foobar'], getline(1, 2)) + + setl ai& tw& fo& si& comments& + enew! +endfunc + +" Tests for :right, :center and :left on text with embedded TAB. +func Test_format_align() + enew! + set tw=65 + + " :left alignment + call append(0, [ + \ " test for :left", + \ " a a", + \ " fa a", + \ " dfa a", + \ " sdfa a", + \ " asdfa a", + \ " xasdfa a", + \ "asxxdfa a", + \ ]) + %left + call assert_equal([ + \ "test for :left", + \ "a a", + \ "fa a", + \ "dfa a", + \ "sdfa a", + \ "asdfa a", + \ "xasdfa a", + \ "asxxdfa a", + \ "" + \ ], getline(1, '$')) + enew! + + " :center alignment + call append(0, [ + \ " test for :center", + \ " a a", + \ " fa afd asdf", + \ " dfa a", + \ " sdfa afd asdf", + \ " asdfa a", + \ " xasdfa asdfasdfasdfasdfasdf", + \ "asxxdfa a" + \ ]) + %center + call assert_equal([ + \ " test for :center", + \ " a a", + \ " fa afd asdf", + \ " dfa a", + \ " sdfa afd asdf", + \ " asdfa a", + \ " xasdfa asdfasdfasdfasdfasdf", + \ " asxxdfa a", + \ "" + \ ], getline(1, '$')) + enew! + + " :right alignment + call append(0, [ + \ " test for :right", + \ " a a", + \ " fa a", + \ " dfa a", + \ " sdfa a", + \ " asdfa a", + \ " xasdfa a", + \ " asxxdfa a", + \ " asxa;ofa a", + \ " asdfaqwer a", + \ " a ax", + \ " fa ax", + \ " dfa ax", + \ " sdfa ax", + \ " asdfa ax", + \ " xasdfa ax", + \ " asxxdfa ax", + \ " asxa;ofa ax", + \ " asdfaqwer ax", + \ " a axx", + \ " fa axx", + \ " dfa axx", + \ " sdfa axx", + \ " asdfa axx", + \ " xasdfa axx", + \ " asxxdfa axx", + \ " asxa;ofa axx", + \ " asdfaqwer axx", + \ " a axxx", + \ " fa axxx", + \ " dfa axxx", + \ " sdfa axxx", + \ " asdfa axxx", + \ " xasdfa axxx", + \ " asxxdfa axxx", + \ " asxa;ofa axxx", + \ " asdfaqwer axxx", + \ " a axxxo", + \ " fa axxxo", + \ " dfa axxxo", + \ " sdfa axxxo", + \ " asdfa axxxo", + \ " xasdfa axxxo", + \ " asxxdfa axxxo", + \ " asxa;ofa axxxo", + \ " asdfaqwer axxxo", + \ " a axxxoi", + \ " fa axxxoi", + \ " dfa axxxoi", + \ " sdfa axxxoi", + \ " asdfa axxxoi", + \ " xasdfa axxxoi", + \ " asxxdfa axxxoi", + \ " asxa;ofa axxxoi", + \ " asdfaqwer axxxoi", + \ " a axxxoik", + \ " fa axxxoik", + \ " dfa axxxoik", + \ " sdfa axxxoik", + \ " asdfa axxxoik", + \ " xasdfa axxxoik", + \ " asxxdfa axxxoik", + \ " asxa;ofa axxxoik", + \ " asdfaqwer axxxoik", + \ " a axxxoike", + \ " fa axxxoike", + \ " dfa axxxoike", + \ " sdfa axxxoike", + \ " asdfa axxxoike", + \ " xasdfa axxxoike", + \ " asxxdfa axxxoike", + \ " asxa;ofa axxxoike", + \ " asdfaqwer axxxoike", + \ " a axxxoikey", + \ " fa axxxoikey", + \ " dfa axxxoikey", + \ " sdfa axxxoikey", + \ " asdfa axxxoikey", + \ " xasdfa axxxoikey", + \ " asxxdfa axxxoikey", + \ " asxa;ofa axxxoikey", + \ " asdfaqwer axxxoikey", + \ ]) + %right + call assert_equal([ + \ "\t\t\t\t test for :right", + \ "\t\t\t\t a a", + \ "\t\t\t\t fa a", + \ "\t\t\t\t dfa a", + \ "\t\t\t\t sdfa a", + \ "\t\t\t\t asdfa a", + \ "\t\t\t\t xasdfa a", + \ "\t\t\t\t asxxdfa a", + \ "\t\t\t\t asxa;ofa a", + \ "\t\t\t\t asdfaqwer a", + \ "\t\t\t\t a ax", + \ "\t\t\t\t fa ax", + \ "\t\t\t\t dfa ax", + \ "\t\t\t\t sdfa ax", + \ "\t\t\t\t asdfa ax", + \ "\t\t\t\t xasdfa ax", + \ "\t\t\t\t asxxdfa ax", + \ "\t\t\t\t asxa;ofa ax", + \ "\t\t\t\t asdfaqwer ax", + \ "\t\t\t\t a axx", + \ "\t\t\t\t fa axx", + \ "\t\t\t\t dfa axx", + \ "\t\t\t\t sdfa axx", + \ "\t\t\t\t asdfa axx", + \ "\t\t\t\t xasdfa axx", + \ "\t\t\t\t asxxdfa axx", + \ "\t\t\t\t asxa;ofa axx", + \ "\t\t\t\t asdfaqwer axx", + \ "\t\t\t\t a axxx", + \ "\t\t\t\t fa axxx", + \ "\t\t\t\t dfa axxx", + \ "\t\t\t\t sdfa axxx", + \ "\t\t\t\t asdfa axxx", + \ "\t\t\t\t xasdfa axxx", + \ "\t\t\t\t asxxdfa axxx", + \ "\t\t\t\t asxa;ofa axxx", + \ "\t\t\t\t asdfaqwer axxx", + \ "\t\t\t\t a axxxo", + \ "\t\t\t\t fa axxxo", + \ "\t\t\t\t dfa axxxo", + \ "\t\t\t\t sdfa axxxo", + \ "\t\t\t\t asdfa axxxo", + \ "\t\t\t\t xasdfa axxxo", + \ "\t\t\t\t asxxdfa axxxo", + \ "\t\t\t\t asxa;ofa axxxo", + \ "\t\t\t\t asdfaqwer axxxo", + \ "\t\t\t\t a axxxoi", + \ "\t\t\t\t fa axxxoi", + \ "\t\t\t\t dfa axxxoi", + \ "\t\t\t\t sdfa axxxoi", + \ "\t\t\t\t asdfa axxxoi", + \ "\t\t\t\t xasdfa axxxoi", + \ "\t\t\t\t asxxdfa axxxoi", + \ "\t\t\t\t asxa;ofa axxxoi", + \ "\t\t\t\t asdfaqwer axxxoi", + \ "\t\t\t\t a axxxoik", + \ "\t\t\t\t fa axxxoik", + \ "\t\t\t\t dfa axxxoik", + \ "\t\t\t\t sdfa axxxoik", + \ "\t\t\t\t asdfa axxxoik", + \ "\t\t\t\t xasdfa axxxoik", + \ "\t\t\t\t asxxdfa axxxoik", + \ "\t\t\t\t asxa;ofa axxxoik", + \ "\t\t\t\t asdfaqwer axxxoik", + \ "\t\t\t\t a axxxoike", + \ "\t\t\t\t fa axxxoike", + \ "\t\t\t\t dfa axxxoike", + \ "\t\t\t\t sdfa axxxoike", + \ "\t\t\t\t asdfa axxxoike", + \ "\t\t\t\t xasdfa axxxoike", + \ "\t\t\t\t asxxdfa axxxoike", + \ "\t\t\t\t asxa;ofa axxxoike", + \ "\t\t\t\t asdfaqwer axxxoike", + \ "\t\t\t\t a axxxoikey", + \ "\t\t\t\t fa axxxoikey", + \ "\t\t\t\t dfa axxxoikey", + \ "\t\t\t\t sdfa axxxoikey", + \ "\t\t\t\t asdfa axxxoikey", + \ "\t\t\t\t xasdfa axxxoikey", + \ "\t\t\t\t asxxdfa axxxoikey", + \ "\t\t\t\t asxa;ofa axxxoikey", + \ "\t\t\t\t asdfaqwer axxxoikey", + \ "" + \ ], getline(1, '$')) + enew! + + set tw& +endfunc + +" Test formatting a paragraph. +func Test_format_para() + enew! + set fo+=tcroql tw=72 + + call append(0, [ + \ "xxxxx xx xxxxxx ", + \ "xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx", + \ "xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx", + \ "xx xxxxxxx. xxxx xxxx.", + \ "", + \ "> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx", + \ "> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx" + \ ]) + exe "normal /xxxxxxxx$\<CR>" + normal 0gq6kk + call assert_equal([ + \ "xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx", + \ "xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.", + \ "xxxx xxxx.", + \ "", + \ "> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx", + \ "> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx", + \ "" + \ ], getline(1, '$')) + + set fo& tw& + enew! +endfunc + +" Test undo after ":%s" and formatting. +func Test_format_undo() + enew! + map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq + + call append(0, [ + \ "aa aa aa aa", + \ "bb bb bb bb", + \ "cc cc cc cc" + \ ]) + " undo/redo here to make the next undo only work on the following changes + exe "normal i\<C-G>u" + call cursor(1,1) + normal ggu + call assert_equal([ + \ "aa aa aa aa", + \ "bb bb bb bb", + \ "cc cc cc cc", + \ "" + \ ], getline(1, '$')) + + unmap gg + enew! +endfunc diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim new file mode 100644 index 0000000000..17602fbe26 --- /dev/null +++ b/src/testdir/test_textobjects.vim @@ -0,0 +1,167 @@ +" Test for textobjects + +if !has('textobjects') + finish +endif + +func CpoM(line, useM, expected) + new + + if a:useM + set cpoptions+=M + else + set cpoptions-=M + endif + + call setline(1, a:line) + + call setreg('"', '') + normal! ggfrmavi)y + call assert_equal(getreg('"'), a:expected[0]) + + call setreg('"', '') + normal! `afbmavi)y + call assert_equal(getreg('"'), a:expected[1]) + + call setreg('"', '') + normal! `afgmavi)y + call assert_equal(getreg('"'), a:expected[2]) + + q! +endfunc + +func Test_inner_block_without_cpo_M() + call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', '']) +endfunc + +func Test_inner_block_with_cpo_M_left_backslash() + call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green']) +endfunc + +func Test_inner_block_with_cpo_M_right_backslash() + call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green']) +endfunc + +func Test_quote_selection_selection_exclusive() + new + call setline(1, "a 'bcde' f") + set selection=exclusive + exe "norm! fdvhi'y" + call assert_equal('bcde', @") + set selection&vim + bw! +endfunc + +" Tests for string and html text objects +func Test_string_html_objects() + enew! + + let t = '"wo\"rd\\" foo' + put =t + normal! da" + call assert_equal('foo', getline('.')) + + let t = "'foo' 'bar' 'piep'" + put =t + normal! 0va'a'rx + call assert_equal("xxxxxxxxxxxx'piep'", getline('.')) + + let t = "bla bla `quote` blah" + put =t + normal! 02f`da` + call assert_equal("bla bla blah", getline('.')) + + let t = 'out " in "noXno"' + put =t + normal! 0fXdi" + call assert_equal('out " in ""', getline('.')) + + let t = "\"'\" 'blah' rep 'buh'" + put =t + normal! 03f'vi'ry + call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.')) + + set quoteescape=+*- + let t = "bla `s*`d-`+++`l**` b`la" + put =t + normal! di` + call assert_equal("bla `` b`la", getline('.')) + + let t = 'voo "nah" sdf " asdf" sdf " sdf" sd' + put =t + normal! $F"va"oha"i"rz + call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.')) + + let t = "-<b>asdf<i>Xasdf</i>asdf</b>-" + put =t + normal! fXdit + call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.')) + + let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-" + put =t + normal! 0fXdit + call assert_equal('-<b></b>-', getline('.')) + + let t = "-<b>asdf<i>Xasdf</i>asdf</b>-" + put =t + normal! fXdat + call assert_equal('-<b>asdfasdf</b>-', getline('.')) + + let t = "-<b>asdX<i>as<b />df</i>asdf</b>-" + put =t + normal! 0fXdat + call assert_equal('--', getline('.')) + + let t = "-<b>\ninnertext object\n</b>" + put =t + normal! dit + call assert_equal('-<b></b>', getline('.')) + + set quoteescape& + enew! +endfunc + +" Tests for match() and matchstr() +func Test_match() + call assert_equal("b", matchstr("abcd", ".", 0, 2)) + call assert_equal("bc", matchstr("abcd", "..", 0, 2)) + call assert_equal("c", matchstr("abcd", ".", 2, 0)) + call assert_equal("a", matchstr("abcd", ".", 0, -1)) + call assert_equal(-1, match("abcd", ".", 0, 5)) + call assert_equal(0 , match("abcd", ".", 0, -1)) + call assert_equal(0 , match('abc', '.', 0, 1)) + call assert_equal(1 , match('abc', '.', 0, 2)) + call assert_equal(2 , match('abc', '.', 0, 3)) + call assert_equal(-1, match('abc', '.', 0, 4)) + call assert_equal(1 , match('abc', '.', 1, 1)) + call assert_equal(2 , match('abc', '.', 2, 1)) + call assert_equal(-1, match('abc', '.', 3, 1)) + call assert_equal(3 , match('abc', '$', 0, 1)) + call assert_equal(-1, match('abc', '$', 0, 2)) + call assert_equal(3 , match('abc', '$', 1, 1)) + call assert_equal(3 , match('abc', '$', 2, 1)) + call assert_equal(3 , match('abc', '$', 3, 1)) + call assert_equal(-1, match('abc', '$', 4, 1)) + call assert_equal(0 , match('abc', '\zs', 0, 1)) + call assert_equal(1 , match('abc', '\zs', 0, 2)) + call assert_equal(2 , match('abc', '\zs', 0, 3)) + call assert_equal(3 , match('abc', '\zs', 0, 4)) + call assert_equal(-1, match('abc', '\zs', 0, 5)) + call assert_equal(1 , match('abc', '\zs', 1, 1)) + call assert_equal(2 , match('abc', '\zs', 2, 1)) + call assert_equal(3 , match('abc', '\zs', 3, 1)) + call assert_equal(-1, match('abc', '\zs', 4, 1)) +endfunc + +" This was causing an illegal memory access +func Test_inner_tag() + new + norm ixxx + call feedkeys("v", 'xt') + insert +x +x +. + norm it + q! +endfunc diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim new file mode 100644 index 0000000000..18c47b497b --- /dev/null +++ b/src/testdir/test_timers.vim @@ -0,0 +1,295 @@ +" Test for timers + +if !has('timers') + finish +endif + +source shared.vim +source screendump.vim + +func MyHandler(timer) + let g:val += 1 +endfunc + +func MyHandlerWithLists(lists, timer) + let x = string(a:lists) +endfunc + +func Test_oneshot() + let g:val = 0 + let timer = timer_start(50, 'MyHandler') + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + if has('reltime') + call assert_inrange(49, 100, slept) + else + call assert_inrange(20, 100, slept) + endif +endfunc + +func Test_repeat_three() + let g:val = 0 + let timer = timer_start(50, 'MyHandler', {'repeat': 3}) + let slept = WaitFor('g:val == 3') + call assert_equal(3, g:val) + if has('reltime') + call assert_inrange(149, 250, slept) + else + call assert_inrange(80, 200, slept) + endif +endfunc + +func Test_repeat_many() + let g:val = 0 + let timer = timer_start(50, 'MyHandler', {'repeat': -1}) + sleep 200m + call timer_stop(timer) + call assert_inrange(2, 4, g:val) +endfunc + +func Test_with_partial_callback() + let g:val = 0 + let meow = {'one': 1} + function meow.bite(...) + let g:val += self.one + endfunction + + call timer_start(50, meow.bite) + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + if has('reltime') + call assert_inrange(49, 200, slept) + else + call assert_inrange(20, 100, slept) + endif +endfunc + +func Test_retain_partial() + call timer_start(50, function('MyHandlerWithLists', [['a']])) + call test_garbagecollect_now() + sleep 100m +endfunc + +func Test_info() + let id = timer_start(1000, 'MyHandler') + let info = timer_info(id) + call assert_equal(id, info[0]['id']) + call assert_equal(1000, info[0]['time']) + call assert_true(info[0]['remaining'] > 500) + call assert_true(info[0]['remaining'] <= 1000) + call assert_equal(1, info[0]['repeat']) + call assert_equal("function('MyHandler')", string(info[0]['callback'])) + + let found = 0 + for info in timer_info() + if info['id'] == id + let found += 1 + endif + endfor + call assert_equal(1, found) + + call timer_stop(id) + call assert_equal([], timer_info(id)) +endfunc + +func Test_stopall() + let id1 = timer_start(1000, 'MyHandler') + let id2 = timer_start(2000, 'MyHandler') + let info = timer_info() + call assert_equal(2, len(info)) + + call timer_stopall() + let info = timer_info() + call assert_equal(0, len(info)) +endfunc + +func Test_paused() + let g:val = 0 + + let id = timer_start(50, 'MyHandler') + let info = timer_info(id) + call assert_equal(0, info[0]['paused']) + + call timer_pause(id, 1) + let info = timer_info(id) + call assert_equal(1, info[0]['paused']) + sleep 100m + call assert_equal(0, g:val) + + call timer_pause(id, 0) + let info = timer_info(id) + call assert_equal(0, info[0]['paused']) + + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + if has('reltime') + if has('mac') + " The travis Mac machines appear to be very busy. + call assert_inrange(0, 50, slept) + else + call assert_inrange(0, 30, slept) + endif + else + call assert_inrange(0, 10, slept) + endif +endfunc + +func StopMyself(timer) + let g:called += 1 + if g:called == 2 + call timer_stop(a:timer) + endif +endfunc + +func Test_delete_myself() + let g:called = 0 + let t = timer_start(10, 'StopMyself', {'repeat': -1}) + call WaitForAssert({-> assert_equal(2, g:called)}) + call assert_equal(2, g:called) + call assert_equal([], timer_info(t)) +endfunc + +func StopTimer1(timer) + let g:timer2 = timer_start(10, 'StopTimer2') + " avoid maxfuncdepth error + call timer_pause(g:timer1, 1) + sleep 40m +endfunc + +func StopTimer2(timer) + call timer_stop(g:timer1) +endfunc + +func Test_stop_in_callback() + let g:timer1 = timer_start(10, 'StopTimer1') + sleep 40m +endfunc + +func StopTimerAll(timer) + call timer_stopall() +endfunc + +func Test_stop_all_in_callback() + let g:timer1 = timer_start(10, 'StopTimerAll') + let info = timer_info() + call assert_equal(1, len(info)) + sleep 40m + let info = timer_info() + call assert_equal(0, len(info)) +endfunc + +func FeedkeysCb(timer) + call feedkeys("hello\<CR>", 'nt') +endfunc + +func InputCb(timer) + call timer_start(10, 'FeedkeysCb') + let g:val = input('?') + call Resume() +endfunc + +func Test_input_in_timer() + let g:val = '' + call timer_start(10, 'InputCb') + call Standby(1000) + call assert_equal('hello', g:val) +endfunc + +func FuncWithError(timer) + let g:call_count += 1 + if g:call_count == 4 + return + endif + doesnotexist +endfunc + +func Test_timer_errors() + let g:call_count = 0 + let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) + " Timer will be stopped after failing 3 out of 3 times. + call WaitForAssert({-> assert_equal(3, g:call_count)}) + sleep 50m + call assert_equal(3, g:call_count) +endfunc + +func FuncWithCaughtError(timer) + let g:call_count += 1 + try + doesnotexist + catch + " nop + endtry +endfunc + +func Test_timer_catch_error() + let g:call_count = 0 + let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) + " Timer will not be stopped. + call WaitForAssert({-> assert_equal(4, g:call_count)}) + sleep 50m + call assert_equal(4, g:call_count) +endfunc + +func FeedAndPeek(timer) + call test_feedinput('a') + call getchar(1) +endfunc + +func Interrupt(timer) + call test_feedinput("\<C-C>") +endfunc + +func Test_peek_and_get_char() + if !has('unix') && !has('gui_running') + return + endif + call timer_start(0, 'FeedAndPeek') + let intr = timer_start(100, 'Interrupt') + let c = getchar() + call assert_equal(char2nr('a'), c) + call timer_stop(intr) +endfunc + +func Test_ex_mode() + " Function with an empty line. + func Foo(...) + + endfunc + let timer = timer_start(40, function('g:Foo'), {'repeat':-1}) + " This used to throw error E749. + exe "normal Qsleep 100m\rvi\r" + call timer_stop(timer) +endfunc + +func Test_restore_count() + if !CanRunVimInTerminal() + return + endif + " Check that v:count is saved and restored, not changed by a timer. + call writefile([ + \ 'nnoremap <expr><silent> L v:count ? v:count . "l" : "l"', + \ 'func Doit(id)', + \ ' normal 3j', + \ 'endfunc', + \ 'call timer_start(100, "Doit")', + \ ], 'Xtrcscript') + call writefile([ + \ '1-1234', + \ '2-1234', + \ '3-1234', + \ ], 'Xtrctext') + let buf = RunVimInTerminal('-S Xtrcscript Xtrctext', {}) + + " Wait for the timer to move the cursor to the third line. + call WaitForAssert({-> assert_equal(3, term_getcursor(buf)[0])}) + call assert_equal(1, term_getcursor(buf)[1]) + " Now check that v:count has not been set to 3 + call term_sendkeys(buf, 'L') + call WaitForAssert({-> assert_equal(2, term_getcursor(buf)[1])}) + + call StopVimInTerminal(buf) + call delete('Xtrcscript') + call delete('Xtrctext') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_true_false.vim b/src/testdir/test_true_false.vim new file mode 100644 index 0000000000..a23f2cc4b1 --- /dev/null +++ b/src/testdir/test_true_false.vim @@ -0,0 +1,150 @@ +" Test behavior of boolean-like values. + +" Test what is explained at ":help TRUE" and ":help FALSE". +func Test_if() + if v:false + call assert_true(false, 'v:false is false') + endif + if 0 + call assert_true(false, 'zero is false') + endif + if "0" + call assert_true(false, 'zero string is false') + endif + if "foo" + call assert_true(false, 'foo is false') + endif + if " " + call assert_true(false, 'space is false') + endif + if empty("foo") + call assert_true(false, 'foo is not empty') + endif + + if v:true + else + call assert_true(false, 'v:true is true') + endif + if 1 + else + call assert_true(false, 'one is true') + endif + if "1" + else + call assert_true(false, 'one string is true') + endif + if "1foo" + else + call assert_true(false, 'one in string is true') + endif + + call assert_fails('if [1]', 'E745') + call assert_fails('if {1: 1}', 'E728') + call assert_fails('if function("string")', 'E703') + call assert_fails('if 1.3")', 'E805') +endfunc + +function Try_arg_true_false(expr, false_val, true_val) + for v in ['v:false', '0', '"0"', '"foo"', '" "'] + let r = eval(substitute(a:expr, '%v%', v, '')) + call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . string(a:false_val) . ' but ' . string(r)) + endfor + for v in ['v:true', '1', '"1"', '"1foo"'] + let r = eval(substitute(a:expr, '%v%', v, '')) + call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . string(a:true_val) . ' but ' . string(r)) + endfor +endfunc + +" Test using TRUE or FALSE values for an argument. +func Test_true_false_arg() + call Try_arg_true_false('count(["a", "A"], "a", %v%)', 1, 2) + + set wildignore=*.swp + call Try_arg_true_false('expand("foo.swp", %v%)', "", "foo.swp") + call Try_arg_true_false('expand("foo.vim", 0, %v%)', "foo.vim", ["foo.vim"]) + + call setreg('a', ['x', 'y']) + call Try_arg_true_false('getreg("a", 1, %v%)', "x\ny\n", ['x', 'y']) + + set wildignore=*.vim + call Try_arg_true_false('glob("runtest.vim", %v%)', "", "runtest.vim") + set wildignore=*.swp + call Try_arg_true_false('glob("runtest.vim", 0, %v%)', "runtest.vim", ["runtest.vim"]) + if has('unix') + silent !ln -s doesntexit Xlink + call Try_arg_true_false('glob("Xlink", 0, 0, %v%)', "", "Xlink") + silent !rm Xlink + endif + + set wildignore=*.vim + call Try_arg_true_false('globpath(".", "runtest.vim", %v%)', "", "./runtest.vim") + set wildignore=*.swp + call Try_arg_true_false('globpath(".", "runtest.vim", 0, %v%)', "./runtest.vim", ["./runtest.vim"]) + if has('unix') + silent !ln -s doesntexit Xlink + call Try_arg_true_false('globpath(".", "Xlink", 0, 0, %v%)', "", "./Xlink") + silent !rm Xlink + endif + + abbr asdf asdff + call Try_arg_true_false('hasmapto("asdff", "i", %v%)', 0, 1) + + call Try_arg_true_false('index(["a", "A"], "A", 0, %v%)', 1, 0) + + function FilterMapArg(d) + if type(a:d) == type({}) + return filter(a:d, 'v:key == "rhs"') + endif + return a:d + endfunction + call Try_arg_true_false('maparg("asdf", "i", %v%)', "", "asdff") + call Try_arg_true_false('FilterMapArg(maparg("asdf", "i", 1, %v%))', "asdff", {'rhs': 'asdff'}) + + call Try_arg_true_false('hasmapto("asdf", "i", %v%)', 0, 1) + + new colored + call setline(1, '<here>') + syn match brackets "<.*>" + syn match here "here" transparent + let brackets_id = synID(1, 1, 0) + let here_id = synID(1, 3, 0) + call Try_arg_true_false('synID(1, 3, %v%)', here_id, brackets_id) + bwipe! +endfunc + +function Try_arg_non_zero(expr, false_val, true_val) + for v in ['v:false', '0', '[1]', '{2:3}', '3.4'] + let r = eval(substitute(a:expr, '%v%', v, '')) + call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r) + endfor + for v in ['v:true', '1', '" "', '"0"'] + let r = eval(substitute(a:expr, '%v%', v, '')) + call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . a:true_val . ' but ' . r) + endfor +endfunc + + +" Test using non-zero-arg for an argument. +func Test_non_zero_arg() + call test_settime(93784) + call Try_arg_non_zero("mode(%v%)", 'x', 'x!') + call test_settime(0) + + call Try_arg_non_zero("shellescape('foo%', %v%)", "'foo%'", "'foo\\%'") + + " visualmode() needs to be called twice to check + for v in [v:false, 0, [1], {2:3}, 3.4] + normal vv + let r = visualmode(v) + call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r) + let r = visualmode(v) + call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r) + endfor + for v in [v:true, 1, " ", "0"] + normal vv + let r = visualmode(v) + call assert_equal('v', r, 'result for ' . v . ' is not "v" but ' . r) + let r = visualmode(v) + call assert_equal('', r, 'result for ' . v . ' is not "" but ' . r) + endfor +endfunc diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim new file mode 100644 index 0000000000..e06abff93b --- /dev/null +++ b/src/testdir/test_undo.vim @@ -0,0 +1,444 @@ +" Tests for the undo tree. +" Since this script is sourced we need to explicitly break changes up in +" undo-able pieces. Do that by setting 'undolevels'. +" Also tests :earlier and :later. + +func Test_undotree() + new + + normal! Aabc + set ul=100 + let d = undotree() + call assert_equal(1, d.seq_last) + call assert_equal(1, d.seq_cur) + call assert_equal(0, d.save_last) + call assert_equal(0, d.save_cur) + call assert_equal(1, len(d.entries)) + call assert_equal(1, d.entries[0].newhead) + call assert_equal(1, d.entries[0].seq) + call assert_true(d.entries[0].time <= d.time_cur) + + normal! Adef + set ul=100 + let d = undotree() + call assert_equal(2, d.seq_last) + call assert_equal(2, d.seq_cur) + call assert_equal(0, d.save_last) + call assert_equal(0, d.save_cur) + call assert_equal(2, len(d.entries)) + call assert_equal(1, d.entries[0].seq) + call assert_equal(1, d.entries[1].newhead) + call assert_equal(2, d.entries[1].seq) + call assert_true(d.entries[1].time <= d.time_cur) + + undo + set ul=100 + let d = undotree() + call assert_equal(2, d.seq_last) + call assert_equal(1, d.seq_cur) + call assert_equal(0, d.save_last) + call assert_equal(0, d.save_cur) + call assert_equal(2, len(d.entries)) + call assert_equal(1, d.entries[0].seq) + call assert_equal(1, d.entries[1].curhead) + call assert_equal(1, d.entries[1].newhead) + call assert_equal(2, d.entries[1].seq) + call assert_true(d.entries[1].time == d.time_cur) + + normal! Aghi + set ul=100 + let d = undotree() + call assert_equal(3, d.seq_last) + call assert_equal(3, d.seq_cur) + call assert_equal(0, d.save_last) + call assert_equal(0, d.save_cur) + call assert_equal(2, len(d.entries)) + call assert_equal(1, d.entries[0].seq) + call assert_equal(2, d.entries[1].alt[0].seq) + call assert_equal(1, d.entries[1].newhead) + call assert_equal(3, d.entries[1].seq) + call assert_true(d.entries[1].time <= d.time_cur) + + undo + set ul=100 + let d = undotree() + call assert_equal(3, d.seq_last) + call assert_equal(1, d.seq_cur) + call assert_equal(0, d.save_last) + call assert_equal(0, d.save_cur) + call assert_equal(2, len(d.entries)) + call assert_equal(1, d.entries[0].seq) + call assert_equal(2, d.entries[1].alt[0].seq) + call assert_equal(1, d.entries[1].curhead) + call assert_equal(1, d.entries[1].newhead) + call assert_equal(3, d.entries[1].seq) + call assert_true(d.entries[1].time == d.time_cur) + + w! Xtest + let d = undotree() + call assert_equal(1, d.save_cur) + call assert_equal(1, d.save_last) + call delete('Xtest') + bwipe! Xtest +endfunc + +func FillBuffer() + for i in range(1,13) + put=i + " Set 'undolevels' to split undo. + exe "setg ul=" . &g:ul + endfor +endfunc + +func Test_global_local_undolevels() + new one + set undolevels=5 + call FillBuffer() + " will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines + earlier 10 + call assert_equal(5, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + call assert_equal('7', getline('$')) + + new two + setlocal undolevels=2 + call FillBuffer() + " will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines + earlier 10 + call assert_equal(5, &g:undolevels) + call assert_equal(2, &l:undolevels) + call assert_equal('10', getline('$')) + + setlocal ul=10 + call assert_equal(5, &g:undolevels) + call assert_equal(10, &l:undolevels) + + " Setting local value in "two" must not change local value in "one" + wincmd p + call assert_equal(5, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + + new three + setglobal ul=50 + call assert_equal(50, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + + " Drop created windows + set ul& + new + only! +endfunc + +func BackOne(expected) + call feedkeys('g-', 'xt') + call assert_equal(a:expected, getline(1)) +endfunc + +func Test_undo_del_chars() + " Setup a buffer without creating undo entries + new + set ul=-1 + call setline(1, ['123-456']) + set ul=100 + 1 + call test_settime(100) + + " Delete three characters and undo with g- + call feedkeys('x', 'xt') + call feedkeys('x', 'xt') + call feedkeys('x', 'xt') + call assert_equal('-456', getline(1)) + call BackOne('3-456') + call BackOne('23-456') + call BackOne('123-456') + call assert_fails("BackOne('123-456')") + + :" Delete three other characters and go back in time with g- + call feedkeys('$x', 'xt') + call feedkeys('x', 'xt') + call feedkeys('x', 'xt') + call assert_equal('123-', getline(1)) + call test_settime(101) + + call BackOne('123-4') + call BackOne('123-45') + " skips '123-456' because it's older + call BackOne('-456') + call BackOne('3-456') + call BackOne('23-456') + call BackOne('123-456') + call assert_fails("BackOne('123-456')") + normal 10g+ + call assert_equal('123-', getline(1)) + + :" Jump two seconds and go some seconds forward and backward + call test_settime(103) + call feedkeys("Aa\<Esc>", 'xt') + call feedkeys("Ab\<Esc>", 'xt') + call feedkeys("Ac\<Esc>", 'xt') + call assert_equal('123-abc', getline(1)) + earlier 1s + call assert_equal('123-', getline(1)) + earlier 3s + call assert_equal('123-456', getline(1)) + later 1s + call assert_equal('123-', getline(1)) + later 1h + call assert_equal('123-abc', getline(1)) + + close! +endfunc + +func Test_undolist() + new + set ul=100 + + let a = execute('undolist') + call assert_equal("\nNothing to undo", a) + + " 1 leaf (2 changes). + call feedkeys('achange1', 'xt') + call feedkeys('achange2', 'xt') + let a = execute('undolist') + call assert_match("^\nnumber changes when *saved\n *2 *2 .*$", a) + + " 2 leaves. + call feedkeys('u', 'xt') + call feedkeys('achange3\<Esc>', 'xt') + let a = execute('undolist') + call assert_match("^\nnumber changes when *saved\n *2 *2 *.*\n *3 *2 .*$", a) + close! +endfunc + +func Test_U_command() + new + set ul=100 + call feedkeys("achange1\<Esc>", 'xt') + call feedkeys("achange2\<Esc>", 'xt') + norm! U + call assert_equal('', getline(1)) + norm! U + call assert_equal('change1change2', getline(1)) + close! +endfunc + +func Test_undojoin() + new + call feedkeys("Goaaaa\<Esc>", 'xt') + call feedkeys("obbbb\<Esc>", 'xt') + call assert_equal(['aaaa', 'bbbb'], getline(2, '$')) + call feedkeys("u", 'xt') + call assert_equal(['aaaa'], getline(2, '$')) + call feedkeys("obbbb\<Esc>", 'xt') + undojoin + " Note: next change must not be as if typed + call feedkeys("occcc\<Esc>", 'x') + call assert_equal(['aaaa', 'bbbb', 'cccc'], getline(2, '$')) + call feedkeys("u", 'xt') + call assert_equal(['aaaa'], getline(2, '$')) + bwipe! +endfunc + +func Test_undojoin_redo() + new + call setline(1, ['first line', 'second line']) + call feedkeys("ixx\<Esc>", 'xt') + call feedkeys(":undojoin | redo\<CR>", 'xt') + call assert_equal('xxfirst line', getline(1)) + call assert_equal('second line', getline(2)) + bwipe! +endfunc + +func Test_undo_write() + call delete('Xtest') + split Xtest + call feedkeys("ione one one\<Esc>", 'xt') + w! + call feedkeys("otwo\<Esc>", 'xt') + call feedkeys("otwo\<Esc>", 'xt') + w + call feedkeys("othree\<Esc>", 'xt') + call assert_equal(['one one one', 'two', 'two', 'three'], getline(1, '$')) + earlier 1f + call assert_equal(['one one one', 'two', 'two'], getline(1, '$')) + earlier 1f + call assert_equal(['one one one'], getline(1, '$')) + earlier 1f + call assert_equal([''], getline(1, '$')) + later 1f + call assert_equal(['one one one'], getline(1, '$')) + later 1f + call assert_equal(['one one one', 'two', 'two'], getline(1, '$')) + later 1f + call assert_equal(['one one one', 'two', 'two', 'three'], getline(1, '$')) + + close! + call delete('Xtest') + bwipe! Xtest +endfunc + +func Test_insert_expr() + new + " calling setline() triggers undo sync + call feedkeys("oa\<Esc>", 'xt') + call feedkeys("ob\<Esc>", 'xt') + set ul=100 + call feedkeys("o1\<Esc>a2\<C-R>=setline('.','1234')\<CR>\<CR>\<Esc>", 'x') + call assert_equal(['a', 'b', '120', '34'], getline(2, '$')) + call feedkeys("u", 'x') + call assert_equal(['a', 'b', '12'], getline(2, '$')) + call feedkeys("u", 'x') + call assert_equal(['a', 'b'], getline(2, '$')) + + call feedkeys("oc\<Esc>", 'xt') + set ul=100 + call feedkeys("o1\<Esc>a2\<C-R>=setline('.','1234')\<CR>\<CR>\<Esc>", 'x') + call assert_equal(['a', 'b', 'c', '120', '34'], getline(2, '$')) + call feedkeys("u", 'x') + call assert_equal(['a', 'b', 'c', '12'], getline(2, '$')) + + call feedkeys("od\<Esc>", 'xt') + set ul=100 + call feedkeys("o1\<Esc>a2\<C-R>=string(123)\<CR>\<Esc>", 'x') + call assert_equal(['a', 'b', 'c', '12', 'd', '12123'], getline(2, '$')) + call feedkeys("u", 'x') + call assert_equal(['a', 'b', 'c', '12', 'd'], getline(2, '$')) + + close! +endfunc + +func Test_undofile_earlier() + " Issue #1254 + " create undofile with timestamps older than Vim startup time. + let t0 = localtime() - 43200 + call test_settime(t0) + new Xfile + call feedkeys("ione\<Esc>", 'xt') + set ul=100 + call test_settime(t0 + 1) + call feedkeys("otwo\<Esc>", 'xt') + set ul=100 + call test_settime(t0 + 2) + call feedkeys("othree\<Esc>", 'xt') + set ul=100 + w + wundo Xundofile + bwipe! + " restore normal timestamps. + call test_settime(0) + new Xfile + rundo Xundofile + earlier 1d + call assert_equal('', getline(1)) + bwipe! + call delete('Xfile') + call delete('Xundofile') +endfunc + +" Test for undo working properly when executing commands from a register. +" Also test this in an empty buffer. +func Test_cmd_in_reg_undo() + enew! + let @a = "Ox\<Esc>jAy\<Esc>kdd" + edit +/^$ test_undo.vim + normal @au + call assert_equal(0, &modified) + return + new + normal @au + call assert_equal(0, &modified) + only! + let @a = '' +endfunc + +" This used to cause an illegal memory access +func Test_undo_append() + new + call feedkeys("axx\<Esc>v", 'xt') + undo + norm o + quit +endfunc + +func Test_undo_0() + new + set ul=100 + normal i1 + undo + normal i2 + undo + normal i3 + + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('3', getline(1)) + call assert_equal(3, d.seq_cur) + + undo 2 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('2', getline(1)) + call assert_equal(2, d.seq_cur) + + undo 1 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('1', getline(1)) + call assert_equal(1, d.seq_cur) + + bwipe! +endfunc + +func Test_redo_empty_line() + new + exe "norm\x16r\x160" + exe "norm." + bwipe! +endfunc + +funct Test_undofile() + " Test undofile() without setting 'undodir'. + if has('persistent_undo') + call assert_equal(fnamemodify('.Xundofoo.un~', ':p'), undofile('Xundofoo')) + else + call assert_equal('', undofile('Xundofoo')) + endif + call assert_equal('', undofile('')) + + " Test undofile() with 'undodir' set to to an existing directory. + call mkdir('Xundodir') + set undodir=Xundodir + let cwd = getcwd() + if has('win32') + " Replace windows drive such as C:... into C%... + let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g') + endif + let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g') + if has('persistent_undo') + call assert_equal('Xundodir/' . cwd, undofile('Xundofoo')) + else + call assert_equal('', undofile('Xundofoo')) + endif + call assert_equal('', undofile('')) + call delete('Xundodir', 'd') + + " Test undofile() with 'undodir' set to a non-existing directory. + call assert_equal('', undofile('Xundofoo')) + + set undodir& +endfunc diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim new file mode 100644 index 0000000000..0a9f3c61b1 --- /dev/null +++ b/src/testdir/test_unlet.vim @@ -0,0 +1,57 @@ +" Tests for :unlet + +func Test_read_only() + " these caused a crash + call assert_fails('unlet count', 'E795:') + call assert_fails('unlet errmsg', 'E795:') +endfunc + +func Test_existing() + let does_exist = 1 + call assert_true(exists('does_exist')) + unlet does_exist + call assert_false(exists('does_exist')) +endfunc + +func Test_not_existing() + unlet! does_not_exist + call assert_fails('unlet does_not_exist', 'E108:') +endfunc + +func Test_unlet_fails() + call assert_fails('unlet v:["count"]', 'E46:') +endfunc + +func Test_unlet_env() + let envcmd = has('win32') ? 'set' : 'env' + + let $FOOBAR = 'test' + let found = 0 + for kv in split(system(envcmd), "\r*\n") + if kv == 'FOOBAR=test' + let found = 1 + endif + endfor + call assert_equal(1, found) + + unlet $FOOBAR + let found = 0 + for kv in split(system(envcmd), "\r*\n") + if kv == 'FOOBAR=test' + let found = 1 + endif + endfor + call assert_equal(0, found) + + unlet $MUST_NOT_BE_AN_ERROR +endfunc + +func Test_unlet_complete() + let g:FOOBAR = 1 + call feedkeys(":unlet g:FOO\t\n", 'tx') + call assert_true(!exists('g:FOOBAR')) + + let $FOOBAR = 1 + call feedkeys(":unlet $FOO\t\n", 'tx') + call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) +endfunc diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim new file mode 100644 index 0000000000..e7a3701386 --- /dev/null +++ b/src/testdir/test_user_func.vim @@ -0,0 +1,96 @@ +" Test for user functions. +" Also test an <expr> mapping calling a function. +" Also test that a builtin function cannot be replaced. +" Also test for regression when calling arbitrary expression. + +func Table(title, ...) + let ret = a:title + let idx = 1 + while idx <= a:0 + exe "let ret = ret . a:" . idx + let idx = idx + 1 + endwhile + return ret +endfunc + +func Compute(n1, n2, divname) + if a:n2 == 0 + return "fail" + endif + exe "let g:" . a:divname . " = ". a:n1 / a:n2 + return "ok" +endfunc + +func Expr1() + silent! normal! v + return "111" +endfunc + +func Expr2() + call search('XX', 'b') + return "222" +endfunc + +func ListItem() + let g:counter += 1 + return g:counter . '. ' +endfunc + +func ListReset() + let g:counter = 0 + return '' +endfunc + +func FuncWithRef(a) + unlet g:FuncRef + return a:a +endfunc + +func Test_user_func() + let g:FuncRef=function("FuncWithRef") + let g:counter = 0 + inoremap <expr> ( ListItem() + inoremap <expr> [ ListReset() + imap <expr> + Expr1() + imap <expr> * Expr2() + let g:retval = "nop" + + call assert_equal('xxx4asdf', Table("xxx", 4, "asdf")) + call assert_equal('fail', Compute(45, 0, "retval")) + call assert_equal('nop', g:retval) + call assert_equal('ok', Compute(45, 5, "retval")) + call assert_equal(9, g:retval) + call assert_equal(333, g:FuncRef(333)) + + enew + + normal oXX+-XX + call assert_equal('XX111-XX', getline('.')) + normal o---*--- + call assert_equal('---222---', getline('.')) + normal o(one + call assert_equal('1. one', getline('.')) + normal o(two + call assert_equal('2. two', getline('.')) + normal o[(one again + call assert_equal('1. one again', getline('.')) + + call assert_equal(3, max([1, 2, 3])) + call assert_fails("call extend(g:, {'max': function('min')})", 'E704') + call assert_equal(3, max([1, 2, 3])) + + " Regression: the first line below used to throw ?E110: Missing ')'? + " Second is here just to prove that this line is correct when not skipping + " rhs of &&. + call assert_equal(0, (0 && (function('tr'))(1, 2, 3))) + call assert_equal(1, (1 && (function('tr'))(1, 2, 3))) + + delfunc Table + delfunc Compute + delfunc Expr1 + delfunc Expr2 + delfunc ListItem + delfunc ListReset + unlet g:retval g:counter + enew! +endfunc diff --git a/src/testdir/test_usercommands.vim b/src/testdir/test_usercommands.vim new file mode 100644 index 0000000000..21b1c4c0fe --- /dev/null +++ b/src/testdir/test_usercommands.vim @@ -0,0 +1,220 @@ +" Tests for user defined commands + +" Test for <mods> in user defined commands +function Test_cmdmods() + let g:mods = '' + + command! -nargs=* MyCmd let g:mods .= '<mods> ' + + MyCmd + aboveleft MyCmd + abo MyCmd + belowright MyCmd + bel MyCmd + botright MyCmd + bo MyCmd + browse MyCmd + bro MyCmd + confirm MyCmd + conf MyCmd + hide MyCmd + hid MyCmd + keepalt MyCmd + keepa MyCmd + keepjumps MyCmd + keepj MyCmd + keepmarks MyCmd + kee MyCmd + keeppatterns MyCmd + keepp MyCmd + leftabove MyCmd " results in :aboveleft + lefta MyCmd + lockmarks MyCmd + loc MyCmd + " noautocmd MyCmd + noswapfile MyCmd + nos MyCmd + rightbelow MyCmd " results in :belowright + rightb MyCmd + " sandbox MyCmd + silent MyCmd + sil MyCmd + tab MyCmd + topleft MyCmd + to MyCmd + " unsilent MyCmd + verbose MyCmd + verb MyCmd + vertical MyCmd + vert MyCmd + + aboveleft belowright botright browse confirm hide keepalt keepjumps + \ keepmarks keeppatterns lockmarks noswapfile silent tab + \ topleft verbose vertical MyCmd + + call assert_equal(' aboveleft aboveleft belowright belowright botright ' . + \ 'botright browse browse confirm confirm hide hide ' . + \ 'keepalt keepalt keepjumps keepjumps keepmarks keepmarks ' . + \ 'keeppatterns keeppatterns aboveleft aboveleft lockmarks lockmarks noswapfile ' . + \ 'noswapfile belowright belowright silent silent tab topleft topleft verbose verbose ' . + \ 'vertical vertical ' . + \ 'aboveleft belowright botright browse confirm hide keepalt keepjumps ' . + \ 'keepmarks keeppatterns lockmarks noswapfile silent tab topleft ' . + \ 'verbose vertical ', g:mods) + + let g:mods = '' + command! -nargs=* MyQCmd let g:mods .= '<q-mods> ' + + vertical MyQCmd + call assert_equal('"vertical" ', g:mods) + + delcommand MyCmd + delcommand MyQCmd + unlet g:mods +endfunction + +func Test_Ambiguous() + command Doit let g:didit = 'yes' + command Dothat let g:didthat = 'also' + call assert_fails('Do', 'E464:') + Doit + call assert_equal('yes', g:didit) + Dothat + call assert_equal('also', g:didthat) + unlet g:didit + unlet g:didthat + + delcommand Doit + Do + call assert_equal('also', g:didthat) + delcommand Dothat +endfunc + +func Test_CmdUndefined() + call assert_fails('Doit', 'E492:') + au CmdUndefined Doit :command Doit let g:didit = 'yes' + Doit + call assert_equal('yes', g:didit) + delcommand Doit + + call assert_fails('Dothat', 'E492:') + au CmdUndefined * let g:didnot = 'yes' + call assert_fails('Dothat', 'E492:') + call assert_equal('yes', g:didnot) +endfunc + +func Test_CmdErrors() + call assert_fails('com! docmd :', 'E183:') + call assert_fails('com! \<Tab> :', 'E182:') + call assert_fails('com! _ :', 'E182:') + call assert_fails('com! X :', 'E841:') + call assert_fails('com! - DoCmd :', 'E175:') + call assert_fails('com! -xxx DoCmd :', 'E181:') + call assert_fails('com! -addr DoCmd :', 'E179:') + call assert_fails('com! -complete DoCmd :', 'E179:') + call assert_fails('com! -complete=xxx DoCmd :', 'E180:') + call assert_fails('com! -complete=custom DoCmd :', 'E467:') + call assert_fails('com! -complete=customlist DoCmd :', 'E467:') + call assert_fails('com! -complete=behave,CustomComplete DoCmd :', 'E468:') + call assert_fails('com! -nargs=x DoCmd :', 'E176:') + call assert_fails('com! -count=1 -count=2 DoCmd :', 'E177:') + call assert_fails('com! -count=x DoCmd :', 'E178:') + call assert_fails('com! -range=x DoCmd :', 'E178:') + + com! -nargs=0 DoCmd : + call assert_fails('DoCmd x', 'E488:') + + com! -nargs=1 DoCmd : + call assert_fails('DoCmd', 'E471:') + + com! -nargs=+ DoCmd : + call assert_fails('DoCmd', 'E471:') + + call assert_fails('com DoCmd :', 'E174:') + comclear + call assert_fails('delcom DoCmd', 'E184:') +endfunc + +func CustomComplete(A, L, P) + return "January\nFebruary\nMars\n" +endfunc + +func CustomCompleteList(A, L, P) + return [ "Monday", "Tuesday", "Wednesday" ] +endfunc + +func Test_CmdCompletion() + call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com -addr bang bar buffer complete count nargs range register', @:) + + call feedkeys(":com -nargs=0 -\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com -nargs=0 -addr bang bar buffer complete count nargs range register', @:) + + call feedkeys(":com -nargs=\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com -nargs=* + 0 1 ?', @:) + + call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com -addr=arguments buffers lines loaded_buffers quickfix tabs windows', @:) + + call feedkeys(":com -complete=co\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com -complete=color command compiler', @:) + + command! DoCmd1 : + command! DoCmd2 : + call feedkeys(":com \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com DoCmd1 DoCmd2', @:) + + call feedkeys(":DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoCmd1 DoCmd2', @:) + + call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"delcom DoCmd1 DoCmd2', @:) + + delcom DoCmd1 + call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"delcom DoCmd2', @:) + + call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com DoCmd2', @:) + + delcom DoCmd2 + call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"delcom DoC', @:) + + call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"com DoC', @:) + + com! -complete=behave DoCmd : + call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoCmd mswin xterm', @:) + + " This does not work. Why? + "call feedkeys(":DoCmd x\<C-A>\<C-B>\"\<CR>", 'tx') + "call assert_equal('"DoCmd xterm', @:) + + com! -complete=custom,CustomComplete DoCmd : + call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoCmd January February Mars', @:) + + com! -complete=customlist,CustomCompleteList DoCmd : + call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoCmd Monday Tuesday Wednesday', @:) + + com! -complete=custom,CustomCompleteList DoCmd : + call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E730:') + + com! -complete=customlist,CustomComp DoCmd : + call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:') +endfunc + +func CallExecute(A, L, P) + " Drop first '\n' + return execute('echo "hi"')[1:] +endfunc + +func Test_use_execute_in_completion() + command! -nargs=* -complete=custom,CallExecute DoExec : + call feedkeys(":DoExec \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoExec hi', @:) + delcommand DoExec +endfunc diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim new file mode 100644 index 0000000000..24e3db86fb --- /dev/null +++ b/src/testdir/test_utf8.vim @@ -0,0 +1,65 @@ +" Tests for Unicode manipulations +if !has('multi_byte') + finish +endif + + +" Visual block Insert adjusts for multi-byte char +func Test_visual_block_insert() + new + call setline(1, ["aaa", "あああ", "bbb"]) + exe ":norm! gg0l\<C-V>jjIx\<Esc>" + call assert_equal(['axaa', 'xあああ', 'bxbb'], getline(1, '$')) + bwipeout! +endfunc + +" Test for built-in function strchars() +func Test_strchars() + let inp = ["a", "あいa", "A\u20dd", "A\u20dd\u20dd", "\u20dd"] + let exp = [[1, 1, 1], [3, 3, 3], [2, 2, 1], [3, 3, 1], [1, 1, 1]] + for i in range(len(inp)) + call assert_equal(exp[i][0], strchars(inp[i])) + call assert_equal(exp[i][1], strchars(inp[i], 0)) + call assert_equal(exp[i][2], strchars(inp[i], 1)) + endfor +endfunc + +" Test for customlist completion +function! CustomComplete1(lead, line, pos) + return ['あ', 'い'] +endfunction + +function! CustomComplete2(lead, line, pos) + return ['あたし', 'あたま', 'あたりめ'] +endfunction + +function! CustomComplete3(lead, line, pos) + return ['Nこ', 'Nん', 'Nぶ'] +endfunction + +func Test_customlist_completion() + command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo + call feedkeys(":Test1 \<C-L>\<C-B>\"\<CR>", 'itx') + call assert_equal('"Test1 ', getreg(':')) + + command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo + call feedkeys(":Test2 \<C-L>\<C-B>\"\<CR>", 'itx') + call assert_equal('"Test2 あた', getreg(':')) + + command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo + call feedkeys(":Test3 \<C-L>\<C-B>\"\<CR>", 'itx') + call assert_equal('"Test3 N', getreg(':')) + + call garbagecollect(1) +endfunc + +" Yank one 3 byte character and check the mark columns. +func Test_getvcol() + new + call setline(1, "x\u2500x") + normal 0lvy + call assert_equal(2, col("'[")) + call assert_equal(4, col("']")) + call assert_equal(2, virtcol("'[")) + call assert_equal(2, virtcol("']")) +endfunc diff --git a/src/testdir/test_utf8_comparisons.vim b/src/testdir/test_utf8_comparisons.vim new file mode 100644 index 0000000000..576e86142f --- /dev/null +++ b/src/testdir/test_utf8_comparisons.vim @@ -0,0 +1,95 @@ +" Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c) +" Also test "g~ap". + +if !has("multi_byte") + finish +endif + +function! Ch(a, op, b, expected) + call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected, + \ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected)) +endfunction + +function! Chk(a, b, result) + if a:result == 0 + call Ch(a:a, '==?', a:b, 1) + call Ch(a:a, '!=?', a:b, 0) + call Ch(a:a, '<=?', a:b, 1) + call Ch(a:a, '>=?', a:b, 1) + call Ch(a:a, '<?', a:b, 0) + call Ch(a:a, '>?', a:b, 0) + elseif a:result > 0 + call Ch(a:a, '==?', a:b, 0) + call Ch(a:a, '!=?', a:b, 1) + call Ch(a:a, '<=?', a:b, 0) + call Ch(a:a, '>=?', a:b, 1) + call Ch(a:a, '<?', a:b, 0) + call Ch(a:a, '>?', a:b, 1) + else + call Ch(a:a, '==?', a:b, 0) + call Ch(a:a, '!=?', a:b, 1) + call Ch(a:a, '<=?', a:b, 1) + call Ch(a:a, '>=?', a:b, 0) + call Ch(a:a, '<?', a:b, 1) + call Ch(a:a, '>?', a:b, 0) + endif +endfunction + +function! Check(a, b, result) + call Chk(a:a, a:b, a:result) + call Chk(a:b, a:a, -a:result) +endfunction + +function! LT(a, b) + call Check(a:a, a:b, -1) +endfunction + +function! GT(a, b) + call Check(a:a, a:b, 1) +endfunction + +function! EQ(a, b) + call Check(a:a, a:b, 0) +endfunction + +function Test_comparisons() + call EQ('', '') + call LT('', 'a') + call EQ('abc', 'abc') + call EQ('Abc', 'abC') + call LT('ab', 'abc') + call LT('AB', 'abc') + call LT('ab', 'aBc') + call EQ('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xb9\xd0\xa6\xd0\xa3\xd0\xba\xd0\x95\xd0\xbd') + call LT('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xaf\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd') + call EQ('\xe2\x84\xaa', 'k') + call LT('\xe2\x84\xaa', 'kkkkkk') + call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk') + call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa') + call EQ('\xe2\x84\xaa\xe2\x84\xa6k\xe2\x84\xaak\xcf\x89', 'k\xcf\x89\xe2\x84\xaakk\xe2\x84\xa6') + call EQ('Abc\x80', 'AbC\x80') + call LT('Abc\x80', 'AbC\x81') + call LT('Abc', 'AbC\x80') + call LT('abc\x80DEF', 'abc\x80def') " case folding stops at the first bad character + call LT('\xc3XYZ', '\xc3xyz') + call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower) + call GT('\xef\xbc\xba', '\xef\xbc\xff') " first string is ok and equals \xef\xbd\x9a after folding, second string is illegal and was left unchanged, then the strings were bytewise compared + call LT('\xc3', '\xc3\x83') + call EQ('\xc3\xa3xYz', '\xc3\x83XyZ') + for n in range(0x60, 0xFF) + call LT(printf('xYz\x%.2X', n-1), printf('XyZ\x%.2X', n)) + endfor + for n in range(0x80, 0xBF) + call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) + endfor + for n in range(0xC0, 0xFF) + call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) + endfor +endfunction + +" test that g~ap changes one paragraph only. +function Test_gap() + new + call feedkeys("iabcd\n\ndefggg0g~ap", "tx") + call assert_equal(["ABCD", "", "defg"], getline(1,3)) +endfunction diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim new file mode 100644 index 0000000000..6c0e533ab9 --- /dev/null +++ b/src/testdir/test_viminfo.vim @@ -0,0 +1,515 @@ +" Test for reading and writing .viminfo + +function Test_viminfo_read_and_write() + call histdel(':') + let lines = [ + \ '# comment line', + \ '*encoding=utf-8', + \ '~MSle0~/asdf', + \ '|copied as-is', + \ '|and one more', + \ ] + call writefile(lines, 'Xviminfo') + rviminfo Xviminfo + call assert_equal('asdf', @/) + + wviminfo Xviminfo + let lines = readfile('Xviminfo') + let done = 0 + for line in lines + if line[0] == '|' && line !~ '^|[234],' && line !~ '^|<' + if done == 0 + call assert_equal('|1,4', line) + elseif done == 1 + call assert_equal('|copied as-is', line) + elseif done == 2 + call assert_equal('|and one more', line) + endif + let done += 1 + endif + endfor + call assert_equal(3, done) + + call delete('Xviminfo') +endfunc + +func Test_global_vars() + let test_dict = {'foo': 1, 'bar': 0, 'longvarible': 1000} + let g:MY_GLOBAL_DICT = test_dict + " store a really long list, so line wrapping will occur in viminfo file + let test_list = range(1,100) + let g:MY_GLOBAL_LIST = test_list + set viminfo='100,<50,s10,h,!,nviminfo + wv! Xviminfo + unlet g:MY_GLOBAL_DICT + unlet g:MY_GLOBAL_LIST + + rv! Xviminfo + call assert_equal(test_dict, g:MY_GLOBAL_DICT) + call assert_equal(test_list, g:MY_GLOBAL_LIST) + + call delete('Xviminfo') + set viminfo-=! +endfunc + +func Test_cmdline_history() + call histdel(':') + call test_settime(11) + call histadd(':', "echo 'one'") + call test_settime(12) + " split into two lines + let long800 = repeat(" 'eight'", 100) + call histadd(':', "echo " . long800) + call test_settime(13) + " split into three lines + let long1400 = repeat(" 'fourteeeeen'", 100) + call histadd(':', "echo " . long1400) + wviminfo Xviminfo + let lines = readfile('Xviminfo') + let done_colon = 0 + let done_bar = 0 + let lnum = 0 + while lnum < len(lines) + let line = lines[lnum] | let lnum += 1 + if line[0] == ':' + if done_colon == 0 + call assert_equal(":\x161408", line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('<echo ' . long1400, line) + elseif done_colon == 1 + call assert_equal(":\x16808", line) + let line = lines[lnum] | let lnum += 1 + call assert_equal("<echo " . long800, line) + elseif done_colon == 2 + call assert_equal(":echo 'one'", line) + endif + let done_colon += 1 + elseif line[0:4] == '|2,0,' + if done_bar == 0 + call assert_equal("|2,0,13,,>1407", line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('|<"echo ' . long1400[0:484], line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('|<' . long1400[485:974], line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('|<' . long1400[975:] . '"', line) + elseif done_bar == 1 + call assert_equal('|2,0,12,,>807', line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('|<"echo ' . long800[0:484], line) + let line = lines[lnum] | let lnum += 1 + call assert_equal('|<' . long800[485:] . '"', line) + elseif done_bar == 2 + call assert_equal("|2,0,11,,\"echo 'one'\"", line) + endif + let done_bar += 1 + endif + endwhile + call assert_equal(3, done_colon) + call assert_equal(3, done_bar) + + call histdel(':') + rviminfo Xviminfo + call assert_equal("echo " . long1400, histget(':', -1)) + call assert_equal("echo " . long800, histget(':', -2)) + call assert_equal("echo 'one'", histget(':', -3)) + + call delete('Xviminfo') +endfunc + +func Test_cmdline_history_order() + call histdel(':') + call test_settime(11) + call histadd(':', "echo '11'") + call test_settime(22) + call histadd(':', "echo '22'") + call test_settime(33) + call histadd(':', "echo '33'") + wviminfo Xviminfo + + call histdel(':') + " items go in between + call test_settime(15) + call histadd(':', "echo '15'") + call test_settime(27) + call histadd(':', "echo '27'") + + rviminfo Xviminfo + call assert_equal("echo '33'", histget(':', -1)) + call assert_equal("echo '27'", histget(':', -2)) + call assert_equal("echo '22'", histget(':', -3)) + call assert_equal("echo '15'", histget(':', -4)) + call assert_equal("echo '11'", histget(':', -5)) + + call histdel(':') + " items go before and after + call test_settime(8) + call histadd(':', "echo '8'") + call test_settime(39) + call histadd(':', "echo '39'") + + rviminfo Xviminfo + call assert_equal("echo '39'", histget(':', -1)) + call assert_equal("echo '33'", histget(':', -2)) + call assert_equal("echo '22'", histget(':', -3)) + call assert_equal("echo '11'", histget(':', -4)) + call assert_equal("echo '8'", histget(':', -5)) + + " Check sorting works when writing with merge. + call histdel(':') + call test_settime(8) + call histadd(':', "echo '8'") + call test_settime(15) + call histadd(':', "echo '15'") + call test_settime(27) + call histadd(':', "echo '27'") + call test_settime(39) + call histadd(':', "echo '39'") + wviminfo Xviminfo + + call histdel(':') + rviminfo Xviminfo + call assert_equal("echo '39'", histget(':', -1)) + call assert_equal("echo '33'", histget(':', -2)) + call assert_equal("echo '27'", histget(':', -3)) + call assert_equal("echo '22'", histget(':', -4)) + call assert_equal("echo '15'", histget(':', -5)) + call assert_equal("echo '11'", histget(':', -6)) + call assert_equal("echo '8'", histget(':', -7)) + + call delete('Xviminfo') +endfunc + +func Test_viminfo_registers() + call test_settime(8) + call setreg('a', "eight", 'c') + call test_settime(20) + call setreg('b', ["twenty", "again"], 'l') + call test_settime(40) + call setreg('c', ["four", "agai"], 'b4') + let l = [] + set viminfo='100,<600,s10,h,!,nviminfo + for i in range(500) + call add(l, 'something') + endfor + call setreg('d', l, 'l') + wviminfo Xviminfo + + call test_settime(10) + call setreg('a', '', 'b10') + call test_settime(15) + call setreg('b', 'drop') + call test_settime(50) + call setreg('c', 'keep', 'l') + call test_settime(30) + call setreg('d', 'drop', 'l') + rviminfo Xviminfo + + call assert_equal("", getreg('a')) + call assert_equal("\<C-V>10", getregtype('a')) + call assert_equal("twenty\nagain\n", getreg('b')) + call assert_equal("V", getregtype('b')) + call assert_equal("keep\n", getreg('c')) + call assert_equal("V", getregtype('c')) + call assert_equal(l, getreg('d', 1, 1)) + call assert_equal("V", getregtype('d')) + + " Length around 440 switches to line continuation. + let len = 434 + while len < 445 + let s = repeat('a', len) + call setreg('"', s) + wviminfo Xviminfo + call setreg('"', '') + rviminfo Xviminfo + call assert_equal(s, getreg('"'), 'wrong register at length: ' . len) + + let len += 1 + endwhile + + call delete('Xviminfo') +endfunc + +func Test_viminfo_marks() + sp bufa + let bufa = bufnr('%') + sp bufb + let bufb = bufnr('%') + + call test_settime(8) + call setpos("'A", [bufa, 1, 1, 0]) + call test_settime(20) + call setpos("'B", [bufb, 9, 1, 0]) + call setpos("'C", [bufa, 7, 1, 0]) + + delmark 0-9 + call test_settime(25) + call setpos("'1", [bufb, 12, 1, 0]) + call test_settime(35) + call setpos("'0", [bufa, 11, 1, 0]) + + call test_settime(45) + wviminfo Xviminfo + + " Writing viminfo inserts the '0 mark. + call assert_equal([bufb, 1, 1, 0], getpos("'0")) + call assert_equal([bufa, 11, 1, 0], getpos("'1")) + call assert_equal([bufb, 12, 1, 0], getpos("'2")) + + call test_settime(4) + call setpos("'A", [bufa, 9, 1, 0]) + call test_settime(30) + call setpos("'B", [bufb, 2, 3, 0]) + delmark C + + delmark 0-9 + call test_settime(30) + call setpos("'1", [bufb, 22, 1, 0]) + call test_settime(55) + call setpos("'0", [bufa, 21, 1, 0]) + + rviminfo Xviminfo + + call assert_equal([bufa, 1, 1, 0], getpos("'A")) + call assert_equal([bufb, 2, 3, 0], getpos("'B")) + call assert_equal([bufa, 7, 1, 0], getpos("'C")) + + " numbered marks are merged + call assert_equal([bufa, 21, 1, 0], getpos("'0")) " time 55 + call assert_equal([bufb, 1, 1, 0], getpos("'1")) " time 45 + call assert_equal([bufa, 11, 1, 0], getpos("'2")) " time 35 + call assert_equal([bufb, 22, 1, 0], getpos("'3")) " time 30 + call assert_equal([bufb, 12, 1, 0], getpos("'4")) " time 25 + + call delete('Xviminfo') + exe 'bwipe ' . bufa + exe 'bwipe ' . bufb +endfunc + +func Test_viminfo_jumplist() + split testbuf + clearjumps + call setline(1, ['time 05', 'time 10', 'time 15', 'time 20', 'time 30', 'last pos']) + call cursor(2, 1) + call test_settime(10) + exe "normal /20\r" + call test_settime(20) + exe "normal /30\r" + call test_settime(30) + exe "normal /last pos\r" + wviminfo Xviminfo + + clearjumps + call cursor(1, 1) + call test_settime(5) + exe "normal /15\r" + call test_settime(15) + exe "normal /last pos\r" + call test_settime(40) + exe "normal ?30\r" + rviminfo Xviminfo + + call assert_equal('time 30', getline('.')) + exe "normal \<C-O>" + call assert_equal('last pos', getline('.')) + exe "normal \<C-O>" + " duplicate for 'time 30' was removed + call assert_equal('time 20', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 15', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 10', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 05', getline('.')) + + clearjumps + call cursor(1, 1) + call test_settime(5) + exe "normal /15\r" + call test_settime(15) + exe "normal /last pos\r" + call test_settime(40) + exe "normal ?30\r" + " Test merge when writing + wviminfo Xviminfo + clearjumps + rviminfo Xviminfo + + let last_line = line('.') + exe "normal \<C-O>" + call assert_equal('time 30', getline('.')) + exe "normal \<C-O>" + call assert_equal('last pos', getline('.')) + exe "normal \<C-O>" + " duplicate for 'time 30' was removed + call assert_equal('time 20', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 15', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 10', getline('.')) + exe "normal \<C-O>" + call assert_equal('time 05', getline('.')) + + " Test with jumplist full. + clearjumps + call setline(1, repeat(['match here'], 101)) + call cursor(1, 1) + call test_settime(10) + for i in range(100) + exe "normal /here\r" + endfor + rviminfo Xviminfo + + " must be newest mark that comes from viminfo. + exe "normal \<C-O>" + call assert_equal(last_line, line('.')) + + bwipe! + call delete('Xviminfo') +endfunc + +func Test_viminfo_encoding() + if !has('multi_byte') + return + endif + set enc=latin1 + call histdel(':') + call histadd(':', "echo '\xe9'") + wviminfo Xviminfo + + set fencs=utf-8,latin1 + set enc=utf-8 + sp Xviminfo + call assert_equal('latin1', &fenc) + close + + call histdel(':') + rviminfo Xviminfo + call assert_equal("echo 'é'", histget(':', -1)) + + call delete('Xviminfo') +endfunc + +func Test_viminfo_bad_syntax() + let lines = [] + call add(lines, '|<') " empty continuation line + call add(lines, '|234234234234234324,nothing') + call add(lines, '|1+"no comma"') + call add(lines, '|1,2,3,4,5,6,7') " too many items + call add(lines, '|1,"string version"') + call add(lines, '|1,>x') " bad continuation line + call add(lines, '|1,"x') " missing quote + call add(lines, '|1,"x\') " trailing backslash + call add(lines, '|1,,,,') "trailing comma + call add(lines, '|1,>234') " trailing continuation line + call writefile(lines, 'Xviminfo') + rviminfo Xviminfo + + call delete('Xviminfo') +endfunc + +func Test_viminfo_file_marks() + silent! bwipe test_viminfo.vim + silent! bwipe Xviminfo + + call test_settime(10) + edit ten + call test_settime(25) + edit again + call test_settime(30) + edit thirty + wviminfo Xviminfo + + call test_settime(20) + edit twenty + call test_settime(35) + edit again + call test_settime(40) + edit fourty + wviminfo Xviminfo + + sp Xviminfo + 1 + for name in ['fourty', 'again', 'thirty', 'twenty', 'ten'] + /^> + call assert_equal(name, substitute(getline('.'), '.*/', '', '')) + endfor + close + + call delete('Xviminfo') +endfunc + +func Test_viminfo_file_mark_tabclose() + tabnew Xtestfileintab + call setline(1, ['a','b','c','d','e']) + 4 + q! + wviminfo Xviminfo + sp Xviminfo + /^> .*Xtestfileintab + let lnum = line('.') + while 1 + if lnum == line('$') + call assert_report('mark not found in Xtestfileintab') + break + endif + let lnum += 1 + let line = getline(lnum) + if line == '' + call assert_report('mark not found in Xtestfileintab') + break + endif + if line =~ "^\t\"" + call assert_equal('4', substitute(line, ".*\"\t\\(\\d\\).*", '\1', '')) + break + endif + endwhile + + call delete('Xviminfo') + silent! bwipe Xtestfileintab +endfunc + +func Test_viminfo_file_mark_zero_time() + let lines = [ + \ '# Viminfo version', + \ '|1,4', + \ '', + \ '*encoding=utf-8', + \ '', + \ '# File marks:', + \ "'B 1 0 /tmp/nothing", + \ '|4,66,1,0,0,"/tmp/nothing"', + \ "", + \ ] + call writefile(lines, 'Xviminfo') + delmark B + rviminfo Xviminfo + call delete('Xviminfo') + call assert_equal(1, line("'B")) + delmark B +endfunc + +func Test_viminfo_oldfiles() + let v:oldfiles = [] + let lines = [ + \ '# comment line', + \ '*encoding=utf-8', + \ '', + \ "> /tmp/file_one.txt", + \ "\t\"\t11\t0", + \ "", + \ "> /tmp/file_two.txt", + \ "\t\"\t11\t0", + \ "", + \ "> /tmp/another.txt", + \ "\t\"\t11\t0", + \ "", + \ ] + call writefile(lines, 'Xviminfo') + rviminfo! Xviminfo + call delete('Xviminfo') + + call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt', '3: /tmp/another.txt'], filter(split(execute('oldfiles'), "\n"), {i, v -> v =~ '/tmp/'})) + call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt'], filter(split(execute('filter file_ oldfiles'), "\n"), {i, v -> v =~ '/tmp/'})) + call assert_equal(['3: /tmp/another.txt'], filter(split(execute('filter /another/ oldfiles'), "\n"), {i, v -> v =~ '/tmp/'})) +endfunc diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim new file mode 100644 index 0000000000..fc002c2ab0 --- /dev/null +++ b/src/testdir/test_vimscript.vim @@ -0,0 +1,1448 @@ +" Test various aspects of the Vim script language. +" Most of this was formerly in test49. + +"------------------------------------------------------------------------------- +" Test environment {{{1 +"------------------------------------------------------------------------------- + +com! XpathINIT let g:Xpath = '' +com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args> + +" Append a message to the "messages" file +func! Xout(text) + split messages + $put =a:text + wq +endfunc + +com! -nargs=1 Xout call Xout(<args>) + +" MakeScript() - Make a script file from a function. {{{2 +" +" Create a script that consists of the body of the function a:funcname. +" Replace any ":return" by a ":finish", any argument variable by a global +" variable, and and every ":call" by a ":source" for the next following argument +" in the variable argument list. This function is useful if similar tests are +" to be made for a ":return" from a function call or a ":finish" in a script +" file. +function! MakeScript(funcname, ...) + let script = tempname() + execute "redir! >" . script + execute "function" a:funcname + redir END + execute "edit" script + " Delete the "function" and the "endfunction" lines. Do not include the + " word "function" in the pattern since it might be translated if LANG is + " set. When MakeScript() is being debugged, this deletes also the debugging + " output of its line 3 and 4. + exec '1,/.*' . a:funcname . '(.*)/d' + /^\d*\s*endfunction\>/,$d + %s/^\d*//e + %s/return/finish/e + %s/\<a:\(\h\w*\)/g:\1/ge + normal gg0 + let cnt = 0 + while search('\<call\s*\%(\u\|s:\)\w*\s*(.*)', 'W') > 0 + let cnt = cnt + 1 + s/\<call\s*\%(\u\|s:\)\w*\s*(.*)/\='source ' . a:{cnt}/ + endwhile + g/^\s*$/d + write + bwipeout + return script +endfunction + +" ExecAsScript - Source a temporary script made from a function. {{{2 +" +" Make a temporary script file from the function a:funcname, ":source" it, and +" delete it afterwards. However, if an exception is thrown the file may remain, +" the caller should call DeleteTheScript() afterwards. +let s:script_name = '' +function! ExecAsScript(funcname) + " Make a script from the function passed as argument. + let s:script_name = MakeScript(a:funcname) + + " Source and delete the script. + exec "source" s:script_name + call delete(s:script_name) + let s:script_name = '' +endfunction + +function! DeleteTheScript() + if s:script_name + call delete(s:script_name) + let s:script_name = '' + endif +endfunc + +com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>) + + +"------------------------------------------------------------------------------- +" Test 1: :endwhile in function {{{1 +" +" Detect if a broken loop is (incorrectly) reactivated by the +" :endwhile. Use a :return to prevent an endless loop, and make +" this test first to get a meaningful result on an error before other +" tests will hang. +"------------------------------------------------------------------------------- + +function! T1_F() + Xpath 'a' + let first = 1 + while 1 + Xpath 'b' + if first + Xpath 'c' + let first = 0 + break + else + Xpath 'd' + return + endif + endwhile +endfunction + +function! T1_G() + Xpath 'h' + let first = 1 + while 1 + Xpath 'i' + if first + Xpath 'j' + let first = 0 + break + else + Xpath 'k' + return + endif + if 1 " unmatched :if + endwhile +endfunction + +func Test_endwhile_function() + XpathINIT + call T1_F() + Xpath 'F' + + try + call T1_G() + catch + " Catch missing :endif + call assert_true(v:exception =~ 'E171') + Xpath 'x' + endtry + Xpath 'G' + + call assert_equal('abcFhijxG', g:Xpath) +endfunc + +"------------------------------------------------------------------------------- +" Test 2: :endwhile in script {{{1 +" +" Detect if a broken loop is (incorrectly) reactivated by the +" :endwhile. Use a :finish to prevent an endless loop, and place +" this test before others that might hang to get a meaningful result +" on an error. +" +" This test executes the bodies of the functions T1_F and T1_G from +" the previous test as script files (:return replaced by :finish). +"------------------------------------------------------------------------------- + +func Test_endwhile_script() + XpathINIT + ExecAsScript T1_F + Xpath 'F' + call DeleteTheScript() + + try + ExecAsScript T1_G + catch + " Catch missing :endif + call assert_true(v:exception =~ 'E171') + Xpath 'x' + endtry + Xpath 'G' + call DeleteTheScript() + + call assert_equal('abcFhijxG', g:Xpath) +endfunc + +"------------------------------------------------------------------------------- +" Test 3: :if, :elseif, :while, :continue, :break {{{1 +"------------------------------------------------------------------------------- + +function Test_if_while() + XpathINIT + if 1 + Xpath 'a' + let loops = 3 + while loops > -1 " main loop: loops == 3, 2, 1 (which breaks) + if loops <= 0 + let break_err = 1 + let loops = -1 + else + Xpath 'b' . loops + endif + if (loops == 2) + while loops == 2 " dummy loop + Xpath 'c' . loops + let loops = loops - 1 + continue " stop dummy loop + Xpath 'd' . loops + endwhile + continue " continue main loop + Xpath 'e' . loops + elseif (loops == 1) + let p = 1 + while p " dummy loop + Xpath 'f' . loops + let p = 0 + break " break dummy loop + Xpath 'g' . loops + endwhile + Xpath 'h' . loops + unlet p + break " break main loop + Xpath 'i' . loops + endif + if (loops > 0) + Xpath 'j' . loops + endif + while loops == 3 " dummy loop + let loops = loops - 1 + endwhile " end dummy loop + endwhile " end main loop + Xpath 'k' + else + Xpath 'l' + endif + Xpath 'm' + if exists("break_err") + Xpath 'm' + unlet break_err + endif + + unlet loops + + call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath) +endfunc + +"------------------------------------------------------------------------------- +" Test 4: :return {{{1 +"------------------------------------------------------------------------------- + +function! T4_F() + if 1 + Xpath 'a' + let loops = 3 + while loops > 0 " 3: 2: 1: + Xpath 'b' . loops + if (loops == 2) + Xpath 'c' . loops + return + Xpath 'd' . loops + endif + Xpath 'e' . loops + let loops = loops - 1 + endwhile + Xpath 'f' + else + Xpath 'g' + endif +endfunction + +function Test_return() + XpathINIT + call T4_F() + Xpath '4' + + call assert_equal('ab3e3b2c24', g:Xpath) +endfunction + + +"------------------------------------------------------------------------------- +" Test 5: :finish {{{1 +" +" This test executes the body of the function T4_F from the previous +" test as a script file (:return replaced by :finish). +"------------------------------------------------------------------------------- + +function Test_finish() + XpathINIT + ExecAsScript T4_F + Xpath '5' + call DeleteTheScript() + + call assert_equal('ab3e3b2c25', g:Xpath) +endfunction + + + +"------------------------------------------------------------------------------- +" Test 6: Defining functions in :while loops {{{1 +" +" Functions can be defined inside other functions. An inner function +" gets defined when the outer function is executed. Functions may +" also be defined inside while loops. Expressions in braces for +" defining the function name are allowed. +" +" The functions are defined when sourcing the script, only the +" resulting path is checked in the test function. +"------------------------------------------------------------------------------- + +XpathINIT + +" The command CALL collects the argument of all its invocations in "calls" +" when used from a function (that is, when the global variable "calls" needs +" the "g:" prefix). This is to check that the function code is skipped when +" the function is defined. For inner functions, do so only if the outer +" function is not being executed. +" +let calls = "" +com! -nargs=1 CALL + \ if !exists("calls") && !exists("outer") | + \ let g:calls = g:calls . <args> | + \ endif + +let i = 0 +while i < 3 + let i = i + 1 + if i == 1 + Xpath 'a' + function! F1(arg) + CALL a:arg + let outer = 1 + + let j = 0 + while j < 1 + Xpath 'b' + let j = j + 1 + function! G1(arg) + CALL a:arg + endfunction + Xpath 'c' + endwhile + endfunction + Xpath 'd' + + continue + endif + + Xpath 'e' . i + function! F{i}(i, arg) + CALL a:arg + let outer = 1 + + if a:i == 3 + Xpath 'f' + endif + let k = 0 + while k < 3 + Xpath 'g' . k + let k = k + 1 + function! G{a:i}{k}(arg) + CALL a:arg + endfunction + Xpath 'h' . k + endwhile + endfunction + Xpath 'i' + +endwhile + +if exists("*G1") + Xpath 'j' +endif +if exists("*F1") + call F1("F1") + if exists("*G1") + call G1("G1") + endif +endif + +if exists("G21") || exists("G22") || exists("G23") + Xpath 'k' +endif +if exists("*F2") + call F2(2, "F2") + if exists("*G21") + call G21("G21") + endif + if exists("*G22") + call G22("G22") + endif + if exists("*G23") + call G23("G23") + endif +endif + +if exists("G31") || exists("G32") || exists("G33") + Xpath 'l' +endif +if exists("*F3") + call F3(3, "F3") + if exists("*G31") + call G31("G31") + endif + if exists("*G32") + call G32("G32") + endif + if exists("*G33") + call G33("G33") + endif +endif + +Xpath 'm' + +let g:test6_result = g:Xpath +let g:test6_calls = calls + +unlet calls +delfunction F1 +delfunction G1 +delfunction F2 +delfunction G21 +delfunction G22 +delfunction G23 +delfunction G31 +delfunction G32 +delfunction G33 + +function Test_defining_functions() + call assert_equal('ade2ie3ibcg0h1g1h2g2h3fg0h1g1h2g2h3m', g:test6_result) + call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls) +endfunc + +"------------------------------------------------------------------------------- +" Test 7: Continuing on errors outside functions {{{1 +" +" On an error outside a function, the script processing continues +" at the line following the outermost :endif or :endwhile. When not +" inside an :if or :while, the script processing continues at the next +" line. +"------------------------------------------------------------------------------- + +XpathINIT + +if 1 + Xpath 'a' + while 1 + Xpath 'b' + asdf + Xpath 'c' + break + endwhile | Xpath 'd' + Xpath 'e' +endif | Xpath 'f' +Xpath 'g' + +while 1 + Xpath 'h' + if 1 + Xpath 'i' + asdf + Xpath 'j' + endif | Xpath 'k' + Xpath 'l' + break +endwhile | Xpath 'm' +Xpath 'n' + +asdf +Xpath 'o' + +asdf | Xpath 'p' +Xpath 'q' + +let g:test7_result = g:Xpath + +func Test_error_in_script() + call assert_equal('abghinoq', g:test7_result) +endfunc + +"------------------------------------------------------------------------------- +" Test 8: Aborting and continuing on errors inside functions {{{1 +" +" On an error inside a function without the "abort" attribute, the +" script processing continues at the next line (unless the error was +" in a :return command). On an error inside a function with the +" "abort" attribute, the function is aborted and the script processing +" continues after the function call; the value -1 is returned then. +"------------------------------------------------------------------------------- + +XpathINIT + +function! T8_F() + if 1 + Xpath 'a' + while 1 + Xpath 'b' + asdf + Xpath 'c' + asdf | Xpath 'd' + Xpath 'e' + break + endwhile + Xpath 'f' + endif | Xpath 'g' + Xpath 'h' + + while 1 + Xpath 'i' + if 1 + Xpath 'j' + asdf + Xpath 'k' + asdf | Xpath 'l' + Xpath 'm' + endif + Xpath 'n' + break + endwhile | Xpath 'o' + Xpath 'p' + + return novar " returns (default return value 0) + Xpath 'q' + return 1 " not reached +endfunction + +function! T8_G() abort + if 1 + Xpath 'r' + while 1 + Xpath 's' + asdf " returns -1 + Xpath 't' + break + endwhile + Xpath 'v' + endif | Xpath 'w' + Xpath 'x' + + return -4 " not reached +endfunction + +function! T8_H() abort + while 1 + Xpath 'A' + if 1 + Xpath 'B' + asdf " returns -1 + Xpath 'C' + endif + Xpath 'D' + break + endwhile | Xpath 'E' + Xpath 'F' + + return -4 " not reached +endfunction + +" Aborted functions (T8_G and T8_H) return -1. +let g:test8_sum = (T8_F() + 1) - 4 * T8_G() - 8 * T8_H() +Xpath 'X' +let g:test8_result = g:Xpath + +func Test_error_in_function() + call assert_equal(13, g:test8_sum) + call assert_equal('abcefghijkmnoprsABX', g:test8_result) + + delfunction T8_F + delfunction T8_G + delfunction T8_H +endfunc + + +"------------------------------------------------------------------------------- +" Test 9: Continuing after aborted functions {{{1 +" +" When a function with the "abort" attribute is aborted due to an +" error, the next function back in the call hierarchy without an +" "abort" attribute continues; the value -1 is returned then. +"------------------------------------------------------------------------------- + +XpathINIT + +function! F() abort + Xpath 'a' + let result = G() " not aborted + Xpath 'b' + if result != 2 + Xpath 'c' + endif + return 1 +endfunction + +function! G() " no abort attribute + Xpath 'd' + if H() != -1 " aborted + Xpath 'e' + endif + Xpath 'f' + return 2 +endfunction + +function! H() abort + Xpath 'g' + call I() " aborted + Xpath 'h' + return 4 +endfunction + +function! I() abort + Xpath 'i' + asdf " error + Xpath 'j' + return 8 +endfunction + +if F() != 1 + Xpath 'k' +endif + +let g:test9_result = g:Xpath + +delfunction F +delfunction G +delfunction H +delfunction I + +func Test_func_abort() + call assert_equal('adgifb', g:test9_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 10: :if, :elseif, :while argument parsing {{{1 +" +" A '"' or '|' in an argument expression must not be mixed up with +" a comment or a next command after a bar. Parsing errors should +" be recognized. +"------------------------------------------------------------------------------- + +XpathINIT + +function! MSG(enr, emsg) + let english = v:lang == "C" || v:lang =~ '^[Ee]n' + if a:enr == "" + Xout "TODO: Add message number for:" a:emsg + let v:errmsg = ":" . v:errmsg + endif + let match = 1 + if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg) + let match = 0 + if v:errmsg == "" + Xout "Message missing." + else + let v:errmsg = escape(v:errmsg, '"') + Xout "Unexpected message:" v:errmsg + endif + endif + return match +endfunction + +if 1 || strlen("\"") | Xpath 'a' + Xpath 'b' +endif +Xpath 'c' + +if 0 +elseif 1 || strlen("\"") | Xpath 'd' + Xpath 'e' +endif +Xpath 'f' + +while 1 || strlen("\"") | Xpath 'g' + Xpath 'h' + break +endwhile +Xpath 'i' + +let v:errmsg = "" +if 1 ||| strlen("\"") | Xpath 'j' + Xpath 'k' +endif +Xpath 'l' +if !MSG('E15', "Invalid expression") + Xpath 'm' +endif + +let v:errmsg = "" +if 0 +elseif 1 ||| strlen("\"") | Xpath 'n' + Xpath 'o' +endif +Xpath 'p' +if !MSG('E15', "Invalid expression") + Xpath 'q' +endif + +let v:errmsg = "" +while 1 ||| strlen("\"") | Xpath 'r' + Xpath 's' + break +endwhile +Xpath 't' +if !MSG('E15', "Invalid expression") + Xpath 'u' +endif + +let g:test10_result = g:Xpath +delfunction MSG + +func Test_expr_parsing() + call assert_equal('abcdefghilpt', g:test10_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 11: :if, :elseif, :while argument evaluation after abort {{{1 +" +" When code is skipped over due to an error, the boolean argument to +" an :if, :elseif, or :while must not be evaluated. +"------------------------------------------------------------------------------- + +XpathINIT + +let calls = 0 + +function! P(num) + let g:calls = g:calls + a:num " side effect on call + return 0 +endfunction + +if 1 + Xpath 'a' + asdf " error + Xpath 'b' + if P(1) " should not be called + Xpath 'c' + elseif !P(2) " should not be called + Xpath 'd' + else + Xpath 'e' + endif + Xpath 'f' + while P(4) " should not be called + Xpath 'g' + endwhile + Xpath 'h' +endif +Xpath 'x' + +let g:test11_calls = calls +let g:test11_result = g:Xpath + +unlet calls +delfunction P + +func Test_arg_abort() + call assert_equal(0, g:test11_calls) + call assert_equal('ax', g:test11_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 12: Expressions in braces in skipped code {{{1 +" +" In code skipped over due to an error or inactive conditional, +" an expression in braces as part of a variable or function name +" should not be evaluated. +"------------------------------------------------------------------------------- + +XpathINIT + +function! NULL() + Xpath 'a' + return 0 +endfunction + +function! ZERO() + Xpath 'b' + return 0 +endfunction + +function! F0() + Xpath 'c' +endfunction + +function! F1(arg) + Xpath 'e' +endfunction + +let V0 = 1 + +Xpath 'f' +echo 0 ? F{NULL() + V{ZERO()}}() : 1 + +Xpath 'g' +if 0 + Xpath 'h' + call F{NULL() + V{ZERO()}}() +endif + +Xpath 'i' +if 1 + asdf " error + Xpath 'j' + call F1(F{NULL() + V{ZERO()}}()) +endif + +Xpath 'k' +if 1 + asdf " error + Xpath 'l' + call F{NULL() + V{ZERO()}}() +endif + +let g:test12_result = g:Xpath + +func Test_braces_skipped() + call assert_equal('fgik', g:test12_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 13: Failure in argument evaluation for :while {{{1 +" +" A failure in the expression evaluation for the condition of a :while +" causes the whole :while loop until the matching :endwhile being +" ignored. Continuation is at the next following line. +"------------------------------------------------------------------------------- + +XpathINIT + +Xpath 'a' +while asdf + Xpath 'b' + while 1 + Xpath 'c' + break + endwhile + Xpath 'd' + break +endwhile +Xpath 'e' + +while asdf | Xpath 'f' | endwhile | Xpath 'g' +Xpath 'h' +let g:test13_result = g:Xpath + +func Test_while_fail() + call assert_equal('aeh', g:test13_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 14: Failure in argument evaluation for :if {{{1 +" +" A failure in the expression evaluation for the condition of an :if +" does not cause the corresponding :else or :endif being matched to +" a previous :if/:elseif. Neither of both branches of the failed :if +" are executed. +"------------------------------------------------------------------------------- + +XpathINIT + +function! F() + Xpath 'a' + let x = 0 + if x " false + Xpath 'b' + elseif !x " always true + Xpath 'c' + let x = 1 + if g:boolvar " possibly undefined + Xpath 'd' + else + Xpath 'e' + endif + Xpath 'f' + elseif x " never executed + Xpath 'g' + endif + Xpath 'h' +endfunction + +let boolvar = 1 +call F() +Xpath '-' + +unlet boolvar +call F() +let g:test14_result = g:Xpath + +delfunction F + +func Test_if_fail() + call assert_equal('acdfh-acfh', g:test14_result) +endfunc + + +"------------------------------------------------------------------------------- +" Test 15: Failure in argument evaluation for :if (bar) {{{1 +" +" Like previous test, except that the failing :if ... | ... | :endif +" is in a single line. +"------------------------------------------------------------------------------- + +XpathINIT + +function! F() + Xpath 'a' + let x = 0 + if x " false + Xpath 'b' + elseif !x " always true + Xpath 'c' + let x = 1 + if g:boolvar | Xpath 'd' | else | Xpath 'e' | endif + Xpath 'f' + elseif x " never executed + Xpath 'g' + endif + Xpath 'h' +endfunction + +let boolvar = 1 +call F() +Xpath '-' + +unlet boolvar +call F() +let g:test15_result = g:Xpath + +delfunction F + +func Test_if_bar_fail() + call assert_equal('acdfh-acfh', g:test15_result) +endfunc + +"------------------------------------------------------------------------------- +" Test 90: Recognizing {} in variable name. {{{1 +"------------------------------------------------------------------------------- + +func Test_curlies() + let s:var = 66 + let ns = 's' + call assert_equal(66, {ns}:var) + + let g:a = {} + let g:b = 't' + let g:a[g:b] = 77 + call assert_equal(77, g:a['t']) +endfunc + +"------------------------------------------------------------------------------- +" Test 91: using type(). {{{1 +"------------------------------------------------------------------------------- + +func Test_type() + call assert_equal(0, type(0)) + call assert_equal(1, type("")) + call assert_equal(2, type(function("tr"))) + call assert_equal(2, type(function("tr", [8]))) + call assert_equal(3, type([])) + call assert_equal(4, type({})) + call assert_equal(5, type(0.0)) + call assert_equal(6, type(v:false)) + call assert_equal(6, type(v:true)) + call assert_equal(7, type(v:none)) + call assert_equal(7, type(v:null)) + call assert_equal(8, v:t_job) + call assert_equal(9, v:t_channel) + call assert_equal(v:t_number, type(0)) + call assert_equal(v:t_string, type("")) + call assert_equal(v:t_func, type(function("tr"))) + call assert_equal(v:t_func, type(function("tr", [8]))) + call assert_equal(v:t_list, type([])) + call assert_equal(v:t_dict, type({})) + call assert_equal(v:t_float, type(0.0)) + call assert_equal(v:t_bool, type(v:false)) + call assert_equal(v:t_bool, type(v:true)) + call assert_equal(v:t_none, type(v:none)) + call assert_equal(v:t_none, type(v:null)) + + + call assert_equal(0, 0 + v:false) + call assert_equal(1, 0 + v:true) + call assert_equal(0, 0 + v:none) + call assert_equal(0, 0 + v:null) + + call assert_equal('v:false', '' . v:false) + call assert_equal('v:true', '' . v:true) + call assert_equal('v:none', '' . v:none) + call assert_equal('v:null', '' . v:null) + + call assert_true(v:false == 0) + call assert_false(v:false != 0) + call assert_true(v:true == 1) + call assert_false(v:true != 1) + call assert_false(v:true == v:false) + call assert_true(v:true != v:false) + + call assert_true(v:null == 0) + call assert_false(v:null != 0) + call assert_true(v:none == 0) + call assert_false(v:none != 0) + + call assert_true(v:false is v:false) + call assert_true(v:true is v:true) + call assert_true(v:none is v:none) + call assert_true(v:null is v:null) + + call assert_false(v:false isnot v:false) + call assert_false(v:true isnot v:true) + call assert_false(v:none isnot v:none) + call assert_false(v:null isnot v:null) + + call assert_false(v:false is 0) + call assert_false(v:true is 1) + call assert_false(v:true is v:false) + call assert_false(v:none is 0) + call assert_false(v:null is 0) + call assert_false(v:null is v:none) + + call assert_true(v:false isnot 0) + call assert_true(v:true isnot 1) + call assert_true(v:true isnot v:false) + call assert_true(v:none isnot 0) + call assert_true(v:null isnot 0) + call assert_true(v:null isnot v:none) + + call assert_equal(v:false, eval(string(v:false))) + call assert_equal(v:true, eval(string(v:true))) + call assert_equal(v:none, eval(string(v:none))) + call assert_equal(v:null, eval(string(v:null))) + + call assert_equal(v:false, copy(v:false)) + call assert_equal(v:true, copy(v:true)) + call assert_equal(v:none, copy(v:none)) + call assert_equal(v:null, copy(v:null)) + + call assert_equal([v:false], deepcopy([v:false])) + call assert_equal([v:true], deepcopy([v:true])) + call assert_equal([v:none], deepcopy([v:none])) + call assert_equal([v:null], deepcopy([v:null])) + + call assert_true(empty(v:false)) + call assert_false(empty(v:true)) + call assert_true(empty(v:null)) + call assert_true(empty(v:none)) + + func ChangeYourMind() + try + return v:true + finally + return 'something else' + endtry + endfunc + + call ChangeYourMind() +endfunc + +"------------------------------------------------------------------------------- +" Test 92: skipping code {{{1 +"------------------------------------------------------------------------------- + +func Test_skip() + let Fn = function('Test_type') + call assert_false(0 && Fn[1]) + call assert_false(0 && string(Fn)) + call assert_false(0 && len(Fn)) + let l = [] + call assert_false(0 && l[1]) + call assert_false(0 && string(l)) + call assert_false(0 && len(l)) + let f = 1.0 + call assert_false(0 && f[1]) + call assert_false(0 && string(f)) + call assert_false(0 && len(f)) + let sp = v:null + call assert_false(0 && sp[1]) + call assert_false(0 && string(sp)) + call assert_false(0 && len(sp)) + +endfunc + +"------------------------------------------------------------------------------- +" Test 93: :echo and string() {{{1 +"------------------------------------------------------------------------------- + +func Test_echo_and_string() + " String + let a = 'foo bar' + redir => result + echo a + echo string(a) + redir END + let l = split(result, "\n") + call assert_equal(["foo bar", + \ "'foo bar'"], l) + + " Float + if has('float') + let a = -1.2e0 + redir => result + echo a + echo string(a) + redir END + let l = split(result, "\n") + call assert_equal(["-1.2", + \ "-1.2"], l) + endif + + " Funcref + redir => result + echo function('string') + echo string(function('string')) + redir END + let l = split(result, "\n") + call assert_equal(["string", + \ "function('string')"], l) + + " Recursive dictionary + let a = {} + let a["a"] = a + redir => result + echo a + echo string(a) + redir END + let l = split(result, "\n") + call assert_equal(["{'a': {...}}", + \ "{'a': {...}}"], l) + + " Recursive list + let a = [0] + let a[0] = a + redir => result + echo a + echo string(a) + redir END + let l = split(result, "\n") + call assert_equal(["[[...]]", + \ "[[...]]"], l) + + " Empty dictionaries in a list + let a = {} + redir => result + echo [a, a, a] + echo string([a, a, a]) + redir END + let l = split(result, "\n") + call assert_equal(["[{}, {}, {}]", + \ "[{}, {}, {}]"], l) + + " Empty dictionaries in a dictionary + let a = {} + let b = {"a": a, "b": a} + redir => result + echo b + echo string(b) + redir END + let l = split(result, "\n") + call assert_equal(["{'a': {}, 'b': {}}", + \ "{'a': {}, 'b': {}}"], l) + + " Empty lists in a list + let a = [] + redir => result + echo [a, a, a] + echo string([a, a, a]) + redir END + let l = split(result, "\n") + call assert_equal(["[[], [], []]", + \ "[[], [], []]"], l) + + " Empty lists in a dictionary + let a = [] + let b = {"a": a, "b": a} + redir => result + echo b + echo string(b) + redir END + let l = split(result, "\n") + call assert_equal(["{'a': [], 'b': []}", + \ "{'a': [], 'b': []}"], l) + + " Dictionaries in a list + let a = {"one": "yes", "two": "yes", "three": "yes"} + redir => result + echo [a, a, a] + echo string([a, a, a]) + redir END + let l = split(result, "\n") + call assert_equal(["[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {...}, {...}]", + \ "[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}]"], l) + + " Dictionaries in a dictionary + let a = {"one": "yes", "two": "yes", "three": "yes"} + let b = {"a": a, "b": a} + redir => result + echo b + echo string(b) + redir END + let l = split(result, "\n") + call assert_equal(["{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {...}}", + \ "{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {'one': 'yes', 'two': 'yes', 'three': 'yes'}}"], l) + + " Lists in a list + let a = [1, 2, 3] + redir => result + echo [a, a, a] + echo string([a, a, a]) + redir END + let l = split(result, "\n") + call assert_equal(["[[1, 2, 3], [...], [...]]", + \ "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]"], l) + + " Lists in a dictionary + let a = [1, 2, 3] + let b = {"a": a, "b": a} + redir => result + echo b + echo string(b) + redir END + let l = split(result, "\n") + call assert_equal(["{'a': [1, 2, 3], 'b': [...]}", + \ "{'a': [1, 2, 3], 'b': [1, 2, 3]}"], l) + +endfunc + +"------------------------------------------------------------------------------- +" Test 94: 64-bit Numbers {{{1 +"------------------------------------------------------------------------------- + +func Test_num64() + if !has('num64') + return + endif + + call assert_notequal( 4294967296, 0) + call assert_notequal(-4294967296, 0) + call assert_equal( 4294967296, 0xFFFFffff + 1) + call assert_equal(-4294967296, -0xFFFFffff - 1) + + call assert_equal( 9223372036854775807, 1 / 0) + call assert_equal(-9223372036854775807, -1 / 0) + call assert_equal(-9223372036854775807 - 1, 0 / 0) + + call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) + call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) + + let rng = range(0xFFFFffff, 0x100000001) + call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) + call assert_equal(0x100000001, max(rng)) + call assert_equal(0xFFFFffff, min(rng)) + call assert_equal(rng, sort(range(0x100000001, 0xFFFFffff, -1), 'N')) +endfunc + +"------------------------------------------------------------------------------- +" Test 95: lines of :append, :change, :insert {{{1 +"------------------------------------------------------------------------------- + +function! DefineFunction(name, body) + let func = join(['function! ' . a:name . '()'] + a:body + ['endfunction'], "\n") + exec func +endfunction + +func Test_script_lines() + " :append + try + call DefineFunction('T_Append', [ + \ 'append', + \ 'py <<EOS', + \ '.', + \ ]) + catch + call assert_report("Can't define function") + endtry + try + call DefineFunction('T_Append', [ + \ 'append', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") + catch + call assert_exception('Vim(function):E126: Missing :endfunction') + endtry + + " :change + try + call DefineFunction('T_Change', [ + \ 'change', + \ 'py <<EOS', + \ '.', + \ ]) + catch + call assert_report("Can't define function") + endtry + try + call DefineFunction('T_Change', [ + \ 'change', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") + catch + call assert_exception('Vim(function):E126: Missing :endfunction') + endtry + + " :insert + try + call DefineFunction('T_Insert', [ + \ 'insert', + \ 'py <<EOS', + \ '.', + \ ]) + catch + call assert_report("Can't define function") + endtry + try + call DefineFunction('T_Insert', [ + \ 'insert', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") + catch + call assert_exception('Vim(function):E126: Missing :endfunction') + endtry +endfunc + +"------------------------------------------------------------------------------- +" Test 96: line continuation {{{1 +" +" Undefined behavior was detected by ubsan with line continuation +" after an empty line. +"------------------------------------------------------------------------------- +func Test_script_emty_line_continuation() + + \ +endfunc + +"------------------------------------------------------------------------------- +" Test 97: bitwise functions {{{1 +"------------------------------------------------------------------------------- +func Test_bitwise_functions() + " and + call assert_equal(127, and(127, 127)) + call assert_equal(16, and(127, 16)) + call assert_equal(0, and(127, 128)) + call assert_fails("call and(1.0, 1)", 'E805:') + call assert_fails("call and([], 1)", 'E745:') + call assert_fails("call and({}, 1)", 'E728:') + call assert_fails("call and(1, 1.0)", 'E805:') + call assert_fails("call and(1, [])", 'E745:') + call assert_fails("call and(1, {})", 'E728:') + " or + call assert_equal(23, or(16, 7)) + call assert_equal(15, or(8, 7)) + call assert_equal(123, or(0, 123)) + call assert_fails("call or(1.0, 1)", 'E805:') + call assert_fails("call or([], 1)", 'E745:') + call assert_fails("call or({}, 1)", 'E728:') + call assert_fails("call or(1, 1.0)", 'E805:') + call assert_fails("call or(1, [])", 'E745:') + call assert_fails("call or(1, {})", 'E728:') + " xor + call assert_equal(0, xor(127, 127)) + call assert_equal(111, xor(127, 16)) + call assert_equal(255, xor(127, 128)) + call assert_fails("call xor(1.0, 1)", 'E805:') + call assert_fails("call xor([], 1)", 'E745:') + call assert_fails("call xor({}, 1)", 'E728:') + call assert_fails("call xor(1, 1.0)", 'E805:') + call assert_fails("call xor(1, [])", 'E745:') + call assert_fails("call xor(1, {})", 'E728:') + " invert + call assert_equal(65408, and(invert(127), 65535)) + call assert_equal(65519, and(invert(16), 65535)) + call assert_equal(65407, and(invert(128), 65535)) + call assert_fails("call invert(1.0)", 'E805:') + call assert_fails("call invert([])", 'E745:') + call assert_fails("call invert({})", 'E728:') +endfunc + +" Test trailing text after :endfunction {{{1 +func Test_endfunction_trailing() + call assert_false(exists('*Xtest')) + + exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'" + call assert_true(exists('*Xtest')) + call assert_equal('yes', done) + delfunc Xtest + unlet done + + exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'" + call assert_true(exists('*Xtest')) + call assert_equal('yes', done) + delfunc Xtest + unlet done + + " trailing line break + exe "func Xtest()\necho 'hello'\nendfunc\n" + call assert_true(exists('*Xtest')) + delfunc Xtest + + set verbose=1 + exe "func Xtest()\necho 'hello'\nendfunc \" garbage" + call assert_notmatch('W22:', split(execute('1messages'), "\n")[0]) + call assert_true(exists('*Xtest')) + delfunc Xtest + + exe "func Xtest()\necho 'hello'\nendfunc garbage" + call assert_match('W22:', split(execute('1messages'), "\n")[0]) + call assert_true(exists('*Xtest')) + delfunc Xtest + set verbose=0 + + function Foo() + echo 'hello' + endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + delfunc Foo +endfunc + +func Test_delfunction_force() + delfunc! Xtest + delfunc! Xtest + func Xtest() + echo 'nothing' + endfunc + delfunc! Xtest + delfunc! Xtest +endfunc + +" Test using bang after user command {{{1 +func Test_user_command_with_bang() + command -bang Nieuw let nieuw = 1 + Ni! + call assert_equal(1, nieuw) + unlet nieuw + delcommand Nieuw +endfunc + +" Test for script-local function +func <SID>DoLast() + call append(line('$'), "last line") +endfunc + +func s:DoNothing() + call append(line('$'), "nothing line") +endfunc + +func Test_script_local_func() + set nocp viminfo+=nviminfo + new + nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> + + normal _x + call assert_equal('nothing line', getline(2)) + call assert_equal('last line', getline(3)) + enew! | close +endfunc + +"------------------------------------------------------------------------------- +" Modelines {{{1 +" vim: ts=8 sw=4 tw=80 fdm=marker +" vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "") +"------------------------------------------------------------------------------- diff --git a/src/testdir/test_virtualedit.vim b/src/testdir/test_virtualedit.vim new file mode 100644 index 0000000000..d49025237b --- /dev/null +++ b/src/testdir/test_virtualedit.vim @@ -0,0 +1,61 @@ +" Tests for 'virtualedit'. + +func Test_yank_move_change() + new + call setline(1, [ + \ "func foo() error {", + \ "\tif n, err := bar();", + \ "\terr != nil {", + \ "\t\treturn err", + \ "\t}", + \ "\tn = n * n", + \ ]) + set virtualedit=all + set ts=4 + function! MoveSelectionDown(count) abort + normal! m` + silent! exe "'<,'>move'>+".a:count + norm! `` + endfunction + + xmap ]e :<C-U>call MoveSelectionDown(v:count1)<CR> + 2 + normal 2gg + normal J + normal jVj + normal ]e + normal ce + bwipe! + set virtualedit= + set ts=8 +endfunc + +func Test_paste_end_of_line() + new + set virtualedit=all + call setline(1, ['456', '123']) + normal! gg0"ay$ + exe "normal! 2G$lllA\<C-O>:normal! \"agP\r" + call assert_equal('123456', getline(2)) + + bwipe! + set virtualedit= +endfunc + +func Test_edit_CTRL_G() + new + set virtualedit=insert + call setline(1, ['123', '1', '12']) + exe "normal! ggA\<c-g>jx\<c-g>jx" + call assert_equal(['123', '1 x', '12 x'], getline(1,'$')) + + set virtualedit=all + %d_ + call setline(1, ['1', '12']) + exe "normal! ggllix\<c-g>jx" + call assert_equal(['1 x', '12x'], getline(1,'$')) + + + bwipe! + set virtualedit= +endfunc diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim new file mode 100644 index 0000000000..5b181d3093 --- /dev/null +++ b/src/testdir/test_visual.vim @@ -0,0 +1,275 @@ +" Tests for various Visual mode. +if !has('visual') + finish +endif + + +func Test_block_shift_multibyte() + " Uses double-wide character. + if !has('multi_byte') + return + endif + split + call setline(1, ['xヹxxx', 'ヹxxx']) + exe "normal 1G0l\<C-V>jl>" + call assert_equal('x ヹxxx', getline(1)) + call assert_equal(' ヹxxx', getline(2)) + q! +endfunc + +func Test_block_shift_overflow() + " This used to cause a multiplication overflow followed by a crash. + new + normal ii + exe "normal \<C-V>876543210>" + q! +endfunc + +func Test_dotregister_paste() + new + exe "norm! ihello world\<esc>" + norm! 0ve".p + call assert_equal('hello world world', getline(1)) + q! +endfunc + +func Test_Visual_ctrl_o() + new + call setline(1, ['one', 'two', 'three']) + call cursor(1,2) + set noshowmode + set tw=0 + call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx') + call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3)) + call assert_equal(88, &tw) + set tw& + bw! +endfu + +func Test_Visual_vapo() + new + normal oxx + normal vapo + bwipe! +endfunc + +func Test_Visual_inner_quote() + new + normal oxX + normal vki' + bwipe! +endfunc + +" Test for Visual mode not being reset causing E315 error. +func TriggerTheProblem() + " At this point there is no visual selection because :call reset it. + " Let's restore the selection: + normal gv + '<,'>del _ + try + exe "normal \<Esc>" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg = 'Snap! E315 error!' + endtry +endfunc + +func Test_visual_mode_reset() + enew + let g:msg = "Everything's fine." + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + + " NOTE: this has to be done by a call to a function because executing :del + " the ex-way will require the colon operator which resets the visual mode + " thus preventing the problem: + exe "normal! GV:call TriggerTheProblem()\<CR>" + call assert_equal("Everything's fine.", g:msg) + +endfunc + +" Test for visual block shift and tab characters. +func Test_block_shift_tab() + enew! + call append(0, repeat(['one two three'], 5)) + call cursor(1,1) + exe "normal i\<C-G>u" + exe "normal fe\<C-V>4jR\<Esc>ugvr1" + call assert_equal('on1 two three', getline(1)) + call assert_equal('on1 two three', getline(2)) + call assert_equal('on1 two three', getline(5)) + + enew! + call append(0, repeat(['abcdefghijklmnopqrstuvwxyz'], 5)) + call cursor(1,1) + exe "normal \<C-V>4jI \<Esc>j<<11|D" + exe "normal j7|a\<Tab>\<Tab>" + exe "normal j7|a\<Tab>\<Tab> " + exe "normal j7|a\<Tab> \<Tab>\<Esc>4k13|\<C-V>4j<" + call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) + call assert_equal('abcdefghij', getline(2)) + call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(3)) + call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(4)) + call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(5)) + + %s/\s\+//g + call cursor(1,1) + exe "normal \<C-V>4jI \<Esc>j<<" + exe "normal j7|a\<Tab>\<Tab>" + exe "normal j7|a\<Tab>\<Tab>\<Tab>\<Tab>\<Tab>" + exe "normal j7|a\<Tab> \<Tab>\<Tab>\<Esc>4k13|\<C-V>4j3<" + call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) + call assert_equal('abcdefghij', getline(2)) + call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(3)) + call assert_equal(" abc\<Tab>\<Tab>defghijklmnopqrstuvwxyz", getline(4)) + call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(5)) + + enew! +endfunc + +" Tests Blockwise Visual when there are TABs before the text. +func Test_blockwise_visual() + enew! + call append(0, ['123456', + \ '234567', + \ '345678', + \ '', + \ 'test text test tex start here', + \ "\t\tsome text", + \ "\t\ttest text", + \ 'test text']) + call cursor(1,1) + exe "normal /start here$\<CR>" + exe 'normal "by$' . "\<C-V>jjlld" + exe "normal /456$\<CR>" + exe "normal \<C-V>jj" . '"bP' + call assert_equal(['123start here56', + \ '234start here67', + \ '345start here78', + \ '', + \ 'test text test tex rt here', + \ "\t\tsomext", + \ "\t\ttesext"], getline(1, 7)) + + enew! +endfunc + +" Test swapping corners in blockwise visual mode with o and O +func Test_blockwise_visual_o_O() + enew! + + exe "norm! 10i.\<Esc>Y4P3lj\<C-V>4l2jr " + exe "norm! gvO\<Esc>ra" + exe "norm! gvO\<Esc>rb" + exe "norm! gvo\<C-c>rc" + exe "norm! gvO\<C-c>rd" + + call assert_equal(['..........', + \ '...c d..', + \ '... ..', + \ '...a b..', + \ '..........'], getline(1, '$')) + + enew! +endfun + +" Test Virtual replace mode. +func Test_virtual_replace() + if exists('&t_kD') + let save_t_kD = &t_kD + endif + if exists('&t_kb') + let save_t_kb = &t_kb + endif + exe "set t_kD=\<C-V>x7f t_kb=\<C-V>x08" + enew! + exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz" + call cursor(1,1) + set ai bs=2 + exe "normal gR0\<C-D> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" + call assert_equal([' 1', + \ ' A', + \ ' BCDEFGHIJ', + \ ' KL', + \ ' MNO', + \ ' PQR', + \ ], getline(1, 6)) + normal G + mark a + exe "normal o0\<C-D>\nabcdefghi\njk\tlmn\n opq\trst\n\<C-D>uvwxyz\n" + exe "normal 'ajgR0\<C-D> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" . repeat("\<BS>", 29) + call assert_equal([' 1', + \ 'abcdefghi', + \ 'jk lmn', + \ ' opq rst', + \ 'uvwxyz'], getline(7, 11)) + normal G + exe "normal iab\tcdefghi\tjkl" + exe "normal 0gRAB......CDEFGHI.J\<Esc>o" + exe "normal iabcdefghijklmnopqrst\<Esc>0gRAB\tIJKLMNO\tQR" + call assert_equal(['AB......CDEFGHI.Jkl', + \ 'AB IJKLMNO QRst'], getline(12, 13)) + enew! + set noai bs&vim + if exists('save_t_kD') + let &t_kD = save_t_kD + endif + if exists('save_t_kb') + let &t_kb = save_t_kb + endif +endfunc + +" Test Virtual replace mode. +func Test_virtual_replace2() + enew! + set bs=2 + exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz" + call cursor(1,1) + " Test 1: Test that del deletes the newline + exe "normal gR0\<del> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" + call assert_equal(['0 1', + \ 'A', + \ 'BCDEFGHIJ', + \ ' KL', + \ 'MNO', + \ 'PQR', + \ ], getline(1, 6)) + " Test 2: + " a newline is not deleted, if no newline has been added in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\<cr>5\<bs>\<bs>\<bs>" + call assert_equal(['abcd', + \ '123h', + \ 'ijkl'], getline(1, '$')) + " Test 3: + " a newline is deleted, if a newline has been inserted before in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\<cr>\<cr>56\<bs>\<bs>\<bs>" + call assert_equal(['abcd', + \ '1234', + \ 'ijkl'], getline(1, '$')) + " Test 4: + " delete add a newline, delete it, add it again and check undo + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + " break undo sequence explicitly + let &ul = &ul + exe "norm! gR1234\<cr>\<bs>\<del>56\<cr>" + let &ul = &ul + call assert_equal(['abcd', + \ '123456', + \ ''], getline(1, '$')) + norm! u + call assert_equal(['abcd', + \ 'efgh', + \ 'ijkl'], getline(1, '$')) + " clean up + %d_ + set bs&vim +endfunc diff --git a/src/testdir/test_winbar.vim b/src/testdir/test_winbar.vim new file mode 100644 index 0000000000..19616073c0 --- /dev/null +++ b/src/testdir/test_winbar.vim @@ -0,0 +1,23 @@ +" Test WinBar + +if !has('menu') + finish +endif + +func Test_add_remove_menu() + new + amenu 1.10 WinBar.Next :let g:did_next = 11<CR> + amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR> + emenu WinBar.Next + call assert_equal(11, g:did_next) + emenu WinBar.Cont + call assert_equal(12, g:did_cont) + + wincmd w + call assert_fails('emenu WinBar.Next', 'E334') + wincmd p + + aunmenu WinBar.Next + aunmenu WinBar.Cont + close +endfunc diff --git a/src/testdir/test_winbuf_close.vim b/src/testdir/test_winbuf_close.vim new file mode 100644 index 0000000000..e4618610cd --- /dev/null +++ b/src/testdir/test_winbuf_close.vim @@ -0,0 +1,160 @@ +" Test for commands that close windows and/or buffers: +" :quit +" :close +" :hide +" :only +" :sall +" :all +" :ball +" :buf +" :edit +" +func Test_winbuf_close() + enew | only + + call writefile(['testtext 1'], 'Xtest1') + call writefile(['testtext 2'], 'Xtest2') + call writefile(['testtext 3'], 'Xtest3') + + next! Xtest1 Xtest2 + call setline(1, 'testtext 1 1') + + " test for working :n when hidden set + set hidden + next + call assert_equal('Xtest2', bufname('%')) + + " test for failing :rew when hidden not set + set nohidden + call setline(1, 'testtext 2 2') + call assert_fails('rewind', 'E37') + call assert_equal('Xtest2', bufname('%')) + call assert_equal('testtext 2 2', getline(1)) + + " test for working :rew when hidden set + set hidden + rewind + call assert_equal('Xtest1', bufname('%')) + call assert_equal('testtext 1 1', getline(1)) + + " test for :all keeping a buffer when it's modified + set nohidden + call setline(1, 'testtext 1 1 1') + split + next Xtest2 Xtest3 + all + 1wincmd w + call assert_equal('Xtest1', bufname('%')) + call assert_equal('testtext 1 1 1', getline(1)) + + " test abandoning changed buffer, should be unloaded even when 'hidden' set + set hidden + call setline(1, 'testtext 1 1 1 1') + quit! + call assert_equal('Xtest2', bufname('%')) + call assert_equal('testtext 2 2', getline(1)) + unhide + call assert_equal('Xtest2', bufname('%')) + call assert_equal('testtext 2 2', getline(1)) + + " test ":hide" hides anyway when 'hidden' not set + set nohidden + call setline(1, 'testtext 2 2 2') + hide + call assert_equal('Xtest3', bufname('%')) + call assert_equal('testtext 3', getline(1)) + + " test ":edit" failing in modified buffer when 'hidden' not set + call setline(1, 'testtext 3 3') + call assert_fails('edit Xtest1', 'E37') + call assert_equal('Xtest3', bufname('%')) + call assert_equal('testtext 3 3', getline(1)) + + " test ":edit" working in modified buffer when 'hidden' set + set hidden + edit Xtest1 + call assert_equal('Xtest1', bufname('%')) + call assert_equal('testtext 1', getline(1)) + + " test ":close" not hiding when 'hidden' not set in modified buffer + split Xtest3 + set nohidden + call setline(1, 'testtext 3 3 3') + call assert_fails('close', 'E37') + call assert_equal('Xtest3', bufname('%')) + call assert_equal('testtext 3 3 3', getline(1)) + + " test ":close!" does hide when 'hidden' not set in modified buffer; + call setline(1, 'testtext 3 3 3 3') + close! + call assert_equal('Xtest1', bufname('%')) + call assert_equal('testtext 1', getline(1)) + + set nohidden + + " test ":all!" hides changed buffer + split Xtest4 + call setline(1, 'testtext 4') + all! + 1wincmd w + call assert_equal('Xtest2', bufname('%')) + call assert_equal('testtext 2 2 2', getline(1)) + + " test ":q!" and hidden buffer. + bwipe! Xtest1 Xtest2 Xtest3 Xtest4 + split Xtest1 + wincmd w + bwipe! + set modified + bot split Xtest2 + set modified + bot split Xtest3 + set modified + wincmd t + hide + call assert_equal('Xtest2', bufname('%')) + quit! + call assert_equal('Xtest3', bufname('%')) + call assert_fails('silent! quit!', 'E162') + call assert_equal('Xtest1', bufname('%')) + + call delete('Xtest1') + call delete('Xtest2') + call delete('Xtest3') +endfunc + +" Test that ":close" will respect 'winfixheight' when possible. +func Test_winfixheight_on_close() + set nosplitbelow nosplitright + + split | split | vsplit + + $wincmd w + setlocal winfixheight + let l:height = winheight(0) + + 3close + + call assert_equal(l:height, winheight(0)) + + %bwipeout! + setlocal nowinfixheight splitbelow& splitright& +endfunc + +" Test that ":close" will respect 'winfixwidth' when possible. +func Test_winfixwidth_on_close() + set nosplitbelow nosplitright + + vsplit | vsplit | split + + $wincmd w + setlocal winfixwidth + let l:width = winwidth(0) + + 3close + + call assert_equal(l:width, winwidth(0)) + + %bwipeout! + setlocal nowinfixwidth splitbelow& splitright& +endfunction diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim new file mode 100644 index 0000000000..423d6f8d2c --- /dev/null +++ b/src/testdir/test_window_cmd.vim @@ -0,0 +1,525 @@ +" Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...) + +func Test_window_cmd_ls0_with_split() + set ls=0 + set splitbelow + split + quit + call assert_equal(0, &lines - &cmdheight - winheight(0)) + new | only! + " + set splitbelow&vim + botright split + quit + call assert_equal(0, &lines - &cmdheight - winheight(0)) + new | only! + set ls&vim +endfunc + +func Test_window_cmd_cmdwin_with_vsp() + let efmt = 'Expected 0 but got %d (in ls=%d, %s window)' + for v in range(0, 2) + exec "set ls=" . v + vsplit + call feedkeys("q:\<CR>") + let ac = &lines - (&cmdheight + winheight(0) + !!v) + let emsg = printf(efmt, ac, v, 'left') + call assert_equal(0, ac, emsg) + wincmd w + let ac = &lines - (&cmdheight + winheight(0) + !!v) + let emsg = printf(efmt, ac, v, 'right') + call assert_equal(0, ac, emsg) + new | only! + endfor + set ls&vim +endfunc + +function Test_window_cmd_wincmd_gf() + let fname = 'test_gf.txt' + let swp_fname = '.' . fname . '.swp' + call writefile([], fname) + call writefile([], swp_fname) + function s:swap_exists() + let v:swapchoice = s:swap_choice + endfunc + augroup test_window_cmd_wincmd_gf + autocmd! + exec "autocmd SwapExists " . fname . " call s:swap_exists()" + augroup END + + call setline(1, fname) + " (E)dit anyway + let s:swap_choice = 'e' + wincmd gf + call assert_equal(2, tabpagenr()) + call assert_equal(fname, bufname("%")) + quit! + + " (Q)uit + let s:swap_choice = 'q' + wincmd gf + call assert_equal(1, tabpagenr()) + call assert_notequal(fname, bufname("%")) + new | only! + + call delete(fname) + call delete(swp_fname) + augroup! test_window_cmd_wincmd_gf +endfunc + +func Test_window_quit() + e Xa + split Xb + call assert_equal(2, winnr('$')) + call assert_equal('Xb', bufname(winbufnr(1))) + call assert_equal('Xa', bufname(winbufnr(2))) + + wincmd q + call assert_equal(1, winnr('$')) + call assert_equal('Xa', bufname(winbufnr(1))) + + bw Xa Xb +endfunc + +func Test_window_horizontal_split() + call assert_equal(1, winnr('$')) + 3wincmd s + call assert_equal(2, winnr('$')) + call assert_equal(3, winheight(0)) + call assert_equal(winwidth(1), winwidth(2)) + + call assert_fails('botright topleft wincmd s', 'E442:') + bw +endfunc + +func Test_window_vertical_split() + call assert_equal(1, winnr('$')) + 3wincmd v + call assert_equal(2, winnr('$')) + call assert_equal(3, winwidth(0)) + call assert_equal(winheight(1), winheight(2)) + + call assert_fails('botright topleft wincmd v', 'E442:') + bw +endfunc + +func Test_window_split_edit_alternate() + e Xa + e Xb + + wincmd ^ + call assert_equal('Xa', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + + bw Xa Xb +endfunc + +func Test_window_preview() + " Open a preview window + pedit Xa + call assert_equal(2, winnr('$')) + call assert_equal(0, &previewwindow) + + " Go to the preview window + wincmd P + call assert_equal(1, &previewwindow) + + " Close preview window + wincmd z + call assert_equal(1, winnr('$')) + call assert_equal(0, &previewwindow) + + call assert_fails('wincmd P', 'E441:') +endfunc + +func Test_window_exchange() + e Xa + + " Nothing happens with window exchange when there is 1 window + wincmd x + call assert_equal(1, winnr('$')) + + split Xb + split Xc + + call assert_equal('Xc', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + call assert_equal('Xa', bufname(winbufnr(3))) + + " Exchange current window 1 with window 3 + 3wincmd x + call assert_equal('Xa', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + call assert_equal('Xc', bufname(winbufnr(3))) + + " Exchange window with next when at the top window + wincmd x + call assert_equal('Xb', bufname(winbufnr(1))) + call assert_equal('Xa', bufname(winbufnr(2))) + call assert_equal('Xc', bufname(winbufnr(3))) + + " Exchange window with next when at the middle window + wincmd j + wincmd x + call assert_equal('Xb', bufname(winbufnr(1))) + call assert_equal('Xc', bufname(winbufnr(2))) + call assert_equal('Xa', bufname(winbufnr(3))) + + " Exchange window with next when at the bottom window. + " When there is no next window, it exchanges with the previous window. + wincmd j + wincmd x + call assert_equal('Xb', bufname(winbufnr(1))) + call assert_equal('Xa', bufname(winbufnr(2))) + call assert_equal('Xc', bufname(winbufnr(3))) + + bw Xa Xb Xc +endfunc + +func Test_window_rotate() + e Xa + split Xb + split Xc + call assert_equal('Xc', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + call assert_equal('Xa', bufname(winbufnr(3))) + + " Rotate downwards + wincmd r + call assert_equal('Xa', bufname(winbufnr(1))) + call assert_equal('Xc', bufname(winbufnr(2))) + call assert_equal('Xb', bufname(winbufnr(3))) + + 2wincmd r + call assert_equal('Xc', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + call assert_equal('Xa', bufname(winbufnr(3))) + + " Rotate upwards + wincmd R + call assert_equal('Xb', bufname(winbufnr(1))) + call assert_equal('Xa', bufname(winbufnr(2))) + call assert_equal('Xc', bufname(winbufnr(3))) + + 2wincmd R + call assert_equal('Xc', bufname(winbufnr(1))) + call assert_equal('Xb', bufname(winbufnr(2))) + call assert_equal('Xa', bufname(winbufnr(3))) + + bot vsplit + call assert_fails('wincmd R', 'E443:') + + bw Xa Xb Xc +endfunc + +func Test_window_height() + e Xa + split Xb + + let [wh1, wh2] = [winheight(1), winheight(2)] + " Active window (1) should have the same height or 1 more + " than the other window. + call assert_inrange(wh2, wh2 + 1, wh1) + + wincmd - + call assert_equal(wh1 - 1, winheight(1)) + call assert_equal(wh2 + 1, winheight(2)) + + wincmd + + call assert_equal(wh1, winheight(1)) + call assert_equal(wh2, winheight(2)) + + 2wincmd _ + call assert_equal(2, winheight(1)) + call assert_equal(wh1 + wh2 - 2, winheight(2)) + + wincmd = + call assert_equal(wh1, winheight(1)) + call assert_equal(wh2, winheight(2)) + + 2wincmd _ + set winfixheight + split Xc + let [wh1, wh2, wh3] = [winheight(1), winheight(2), winheight(3)] + call assert_equal(2, winheight(2)) + call assert_inrange(wh3, wh3 + 1, wh1) + 3wincmd + + call assert_equal(2, winheight(2)) + call assert_equal(wh1 + 3, winheight(1)) + call assert_equal(wh3 - 3, winheight(3)) + wincmd = + call assert_equal(2, winheight(2)) + call assert_equal(wh1, winheight(1)) + call assert_equal(wh3, winheight(3)) + + wincmd j + set winfixheight& + + wincmd = + let [wh1, wh2, wh3] = [winheight(1), winheight(2), winheight(3)] + " Current window (2) should have the same height or 1 more + " than the other windows. + call assert_inrange(wh1, wh1 + 1, wh2) + call assert_inrange(wh3, wh3 + 1, wh2) + + bw Xa Xb Xc +endfunc + +func Test_window_width() + e Xa + vsplit Xb + + let [ww1, ww2] = [winwidth(1), winwidth(2)] + " Active window (1) should have the same width or 1 more + " than the other window. + call assert_inrange(ww2, ww2 + 1, ww1) + + wincmd < + call assert_equal(ww1 - 1, winwidth(1)) + call assert_equal(ww2 + 1, winwidth(2)) + + wincmd > + call assert_equal(ww1, winwidth(1)) + call assert_equal(ww2, winwidth(2)) + + 2wincmd | + call assert_equal(2, winwidth(1)) + call assert_equal(ww1 + ww2 - 2, winwidth(2)) + + wincmd = + call assert_equal(ww1, winwidth(1)) + call assert_equal(ww2, winwidth(2)) + + 2wincmd | + set winfixwidth + vsplit Xc + let [ww1, ww2, ww3] = [winwidth(1), winwidth(2), winwidth(3)] + call assert_equal(2, winwidth(2)) + call assert_inrange(ww3, ww3 + 1, ww1) + 3wincmd > + call assert_equal(2, winwidth(2)) + call assert_equal(ww1 + 3, winwidth(1)) + call assert_equal(ww3 - 3, winwidth(3)) + wincmd = + call assert_equal(2, winwidth(2)) + call assert_equal(ww1, winwidth(1)) + call assert_equal(ww3, winwidth(3)) + + wincmd l + set winfixwidth& + + wincmd = + let [ww1, ww2, ww3] = [winwidth(1), winwidth(2), winwidth(3)] + " Current window (2) should have the same width or 1 more + " than the other windows. + call assert_inrange(ww1, ww1 + 1, ww2) + call assert_inrange(ww3, ww3 + 1, ww2) + + bw Xa Xb Xc +endfunc + +func Test_equalalways_on_close() + set equalalways + vsplit + windo split + split + wincmd J + " now we have a frame top-left with two windows, a frame top-right with two + " windows and a frame at the bottom, full-width. + let height_1 = winheight(1) + let height_2 = winheight(2) + let height_3 = winheight(3) + let height_4 = winheight(4) + " closing the bottom window causes all windows to be resized. + close + call assert_notequal(height_1, winheight(1)) + call assert_notequal(height_2, winheight(2)) + call assert_notequal(height_3, winheight(3)) + call assert_notequal(height_4, winheight(4)) + call assert_equal(winheight(1), winheight(3)) + call assert_equal(winheight(2), winheight(4)) + + 1wincmd w + split + 4wincmd w + resize + 5 + " left column has three windows, equalized heights. + " right column has two windows, top one a bit higher + let height_1 = winheight(1) + let height_2 = winheight(2) + let height_4 = winheight(4) + let height_5 = winheight(5) + 3wincmd w + " closing window in left column equalizes heights in left column but not in + " the right column + close + call assert_notequal(height_1, winheight(1)) + call assert_notequal(height_2, winheight(2)) + call assert_equal(height_4, winheight(3)) + call assert_equal(height_5, winheight(4)) + + only + set equalalways& +endfunc + +func Test_win_screenpos() + call assert_equal(1, winnr('$')) + split + vsplit + 10wincmd _ + 30wincmd | + call assert_equal([1, 1], win_screenpos(1)) + call assert_equal([1, 32], win_screenpos(2)) + call assert_equal([12, 1], win_screenpos(3)) + call assert_equal([0, 0], win_screenpos(4)) + only +endfunc + +func Test_window_jump_tag() + help + /iccf + call assert_match('^|iccf|', getline('.')) + call assert_equal(2, winnr('$')) + 2wincmd } + call assert_equal(3, winnr('$')) + call assert_match('^|iccf|', getline('.')) + wincmd k + call assert_match('\*iccf\*', getline('.')) + call assert_equal(2, winheight(0)) + + wincmd z + set previewheight=4 + help + /bugs + wincmd } + wincmd k + call assert_match('\*bugs\*', getline('.')) + call assert_equal(4, winheight(0)) + set previewheight& + + %bw! +endfunc + +func Test_window_newtab() + e Xa + + call assert_equal(1, tabpagenr('$')) + call assert_equal("\nAlready only one window", execute('wincmd T')) + + split Xb + split Xc + + wincmd T + call assert_equal(2, tabpagenr('$')) + call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)')) + call assert_equal(['Xc' ], map(tabpagebuflist(2), 'bufname(v:val)')) + + %bw! +endfunc + +func Test_next_split_all() + " This was causing an illegal memory access. + n x + norm axxx + split + split + s/x + s/x + all + bwipe! +endfunc + +" Tests for adjusting window and contents +func GetScreenStr(row) + let str = "" + for c in range(1,3) + let str .= nr2char(screenchar(a:row, c)) + endfor + return str +endfunc + +func Test_window_contents() + enew! | only | new + call setline(1, range(1,256)) + + exe "norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+" + redraw + let s3 = GetScreenStr(1) + wincmd p + call assert_equal(1, line("w0")) + call assert_equal('1 ', s3) + + exe "norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+" + redraw + let s3 = GetScreenStr(1) + wincmd p + call assert_equal(50, line("w0")) + call assert_equal('50 ', s3) + + exe "norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+" + redraw + let s3 = GetScreenStr(1) + wincmd p + call assert_equal(59, line("w0")) + call assert_equal('59 ', s3) + + bwipeout! + call test_garbagecollect_now() +endfunc + +func Test_window_colon_command() + " This was reading invalid memory. + exe "norm! v\<C-W>:\<C-U>echo v:version" +endfunc + +func Test_access_freed_mem() + " This was accessing freed memory + au * 0 vs xxx + arg 0 + argadd + all + all + au! + bwipe xxx +endfunc + +func Test_visual_cleared_after_window_split() + new | only! + let smd_save = &showmode + set showmode + let ls_save = &laststatus + set laststatus=1 + call setline(1, ['a', 'b', 'c', 'd', '']) + norm! G + exe "norm! kkvk" + redraw + exe "norm! \<C-W>v" + redraw + " check if '-- VISUAL --' disappeared from command line + let columns = range(1, &columns) + let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))') + let cmdline = join(cmdlinechars, '') + let cmdline_ltrim = substitute(cmdline, '^\s*', "", "") + let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "") + call assert_equal('', mode_shown) + let &showmode = smd_save + let &laststatus = ls_save + bwipe! +endfunc + +func Test_winrestcmd() + 2split + 3vsplit + let a = winrestcmd() + call assert_equal(2, winheight(0)) + call assert_equal(3, winwidth(0)) + wincmd = + call assert_notequal(2, winheight(0)) + call assert_notequal(3, winwidth(0)) + exe a + call assert_equal(2, winheight(0)) + call assert_equal(3, winwidth(0)) + only +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_window_id.vim b/src/testdir/test_window_id.vim new file mode 100644 index 0000000000..b3b506d04d --- /dev/null +++ b/src/testdir/test_window_id.vim @@ -0,0 +1,103 @@ +" Test using the window ID. + +func Test_win_getid() + edit one + let id1 = win_getid() + let w:one = 'one' + split two + let id2 = win_getid() + let bufnr2 = bufnr('%') + let w:two = 'two' + split three + let id3 = win_getid() + let w:three = 'three' + tabnew + edit four + let id4 = win_getid() + let w:four = 'four' + split five + let id5 = win_getid() + let bufnr5 = bufnr('%') + let w:five = 'five' + tabnext + + wincmd w + call assert_equal("two", expand("%")) + call assert_equal(id2, win_getid()) + let nr2 = winnr() + wincmd w + call assert_equal("one", expand("%")) + call assert_equal(id1, win_getid()) + let nr1 = winnr() + wincmd w + call assert_equal("three", expand("%")) + call assert_equal(id3, win_getid()) + let nr3 = winnr() + call assert_equal('one', getwinvar(id1, 'one')) + call assert_equal('two', getwinvar(id2, 'two')) + call assert_equal('three', getwinvar(id3, 'three')) + tabnext + call assert_equal("five", expand("%")) + call assert_equal(id5, win_getid()) + let nr5 = winnr() + wincmd w + call assert_equal("four", expand("%")) + call assert_equal(id4, win_getid()) + let nr4 = winnr() + call assert_equal('four', getwinvar(id4, 'four')) + call assert_equal('five', getwinvar(id5, 'five')) + call settabwinvar(1, id2, 'two', '2') + call setwinvar(id4, 'four', '4') + tabnext + call assert_equal('4', gettabwinvar(2, id4, 'four')) + call assert_equal('five', gettabwinvar(2, id5, 'five')) + call assert_equal('2', getwinvar(id2, 'two')) + + exe nr1 . "wincmd w" + call assert_equal(id1, win_getid()) + exe nr2 . "wincmd w" + call assert_equal(id2, win_getid()) + exe nr3 . "wincmd w" + call assert_equal(id3, win_getid()) + tabnext + exe nr4 . "wincmd w" + call assert_equal(id4, win_getid()) + exe nr5 . "wincmd w" + call assert_equal(id5, win_getid()) + + call win_gotoid(id2) + call assert_equal("two", expand("%")) + call win_gotoid(id4) + call assert_equal("four", expand("%")) + call win_gotoid(id1) + call assert_equal("one", expand("%")) + call win_gotoid(id5) + call assert_equal("five", expand("%")) + + call assert_equal(0, win_id2win(9999)) + call assert_equal(nr5, win_id2win(id5)) + call assert_equal(0, win_id2win(id1)) + tabnext + call assert_equal(nr1, win_id2win(id1)) + + call assert_equal([0, 0], win_id2tabwin(9999)) + call assert_equal([1, nr2], win_id2tabwin(id2)) + call assert_equal([2, nr4], win_id2tabwin(id4)) + + call assert_equal([], win_findbuf(9999)) + call assert_equal([id2], win_findbuf(bufnr2)) + call win_gotoid(id5) + split + call assert_equal(sort([id5, win_getid()]), sort(win_findbuf(bufnr5))) + + only! +endfunc + +func Test_win_getid_curtab() + tabedit X + tabfirst + copen + only + call assert_equal(win_getid(1), win_getid(1, 1)) + tabclose! +endfunc diff --git a/src/testdir/test_windows_home.vim b/src/testdir/test_windows_home.vim new file mode 100644 index 0000000000..2e311b9aa5 --- /dev/null +++ b/src/testdir/test_windows_home.vim @@ -0,0 +1,121 @@ +" Test for $HOME on Windows. + +if !has('win32') + finish +endif + +let s:env = {} + +func s:restore_env() + for i in keys(s:env) + exe 'let ' . i . '=s:env["' . i . '"]' + endfor +endfunc + +func s:save_env(...) + for i in a:000 + exe 'let s:env["' . i . '"]=' . i + endfor +endfunc + +func s:unlet_env(...) + for i in a:000 + exe 'let ' . i . '=""' + endfor +endfunc + +func CheckHomeIsMissingFromSubprocessEnvironment() + silent! let out = system('set') + let env = filter(split(out, "\n"), 'v:val=~"^HOME="') + call assert_equal(0, len(env)) +endfunc + +func CheckHomeIsInSubprocessEnvironment(exp) + silent! let out = system('set') + let env = filter(split(out, "\n"), 'v:val=~"^HOME="') + let home = len(env) == 0 ? "" : substitute(env[0], '[^=]\+=', '', '') + call assert_equal(a:exp, home) +endfunc + +func CheckHome(exp, ...) + call assert_equal(a:exp, $HOME) + call assert_equal(a:exp, expand('~', ':p')) + if !a:0 + call CheckHomeIsMissingFromSubprocessEnvironment() + else + call CheckHomeIsInSubprocessEnvironment(a:1) + endif +endfunc + +func Test_WindowsHome() + command! -nargs=* SaveEnv call <SID>save_env(<f-args>) + command! -nargs=* RestoreEnv call <SID>restore_env() + command! -nargs=* UnletEnv call <SID>unlet_env(<f-args>) + set noshellslash + + let save_home = $HOME + SaveEnv $USERPROFILE $HOMEDRIVE $HOMEPATH + try + " Normal behavior: use $HOMEDRIVE and $HOMEPATH, ignore $USERPROFILE + let $USERPROFILE = 'unused' + let $HOMEDRIVE = 'C:' + let $HOMEPATH = '\foobar' + let $HOME = '' " Force recomputing "homedir" + call CheckHome('C:\foobar') + + " Same, but with $HOMEPATH not set + UnletEnv $HOMEPATH + let $HOME = '' " Force recomputing "homedir" + call CheckHome('C:\') + + " Use $USERPROFILE if $HOMEPATH and $HOMEDRIVE are empty + UnletEnv $HOMEDRIVE $HOMEPATH + let $USERPROFILE = 'C:\foo' + let $HOME = '' " Force recomputing "homedir" + call CheckHome('C:\foo') + + " If $HOME is set the others don't matter + let $HOME = 'C:\bar' + let $USERPROFILE = 'unused' + let $HOMEDRIVE = 'unused' + let $HOMEPATH = 'unused' + call CheckHome('C:\bar', 'C:\bar') + + " If $HOME contains %USERPROFILE% it is expanded + let $USERPROFILE = 'C:\foo' + let $HOME = '%USERPROFILE%\bar' + let $HOMEDRIVE = 'unused' + let $HOMEPATH = 'unused' + call CheckHome('C:\foo\bar', '%USERPROFILE%\bar') + + " Invalid $HOME is kept + let $USERPROFILE = 'C:\foo' + let $HOME = '%USERPROFILE' + let $HOMEDRIVE = 'unused' + let $HOMEPATH = 'unused' + call CheckHome('%USERPROFILE', '%USERPROFILE') + + " %USERPROFILE% not at start of $HOME is not expanded + let $USERPROFILE = 'unused' + let $HOME = 'C:\%USERPROFILE%' + let $HOMEDRIVE = 'unused' + let $HOMEPATH = 'unused' + call CheckHome('C:\%USERPROFILE%', 'C:\%USERPROFILE%') + + if has('channel') + RestoreEnv + let $HOME = save_home + let env = '' + let job = job_start('cmd /c set', {'out_cb': {ch,x->[env,execute('let env=x')]}}) + sleep 1 + let env = filter(split(env, "\n"), 'v:val=="HOME"') + let home = len(env) == 0 ? "" : env[0] + call assert_equal('', home) + endif + finally + RestoreEnv + delcommand SaveEnv + delcommand RestoreEnv + delcommand UnletEnv + endtry +endfunc diff --git a/src/testdir/test_wordcount.vim b/src/testdir/test_wordcount.vim new file mode 100644 index 0000000000..75c4e4bffa --- /dev/null +++ b/src/testdir/test_wordcount.vim @@ -0,0 +1,108 @@ +" Test for wordcount() function + +if !has('multi_byte') + finish +endif + +func Test_wordcount() + let save_enc = &enc + set encoding=utf-8 + set selection=inclusive fileformat=unix fileformats=unix + + new + + " Test 1: empty window + call assert_equal({'chars': 0, 'cursor_chars': 0, 'words': 0, 'cursor_words': 0, + \ 'bytes': 0, 'cursor_bytes': 0}, wordcount()) + + " Test 2: some words, cursor at start + call append(1, 'one two three') + call cursor([1, 1, 0]) + call assert_equal({'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, + \ 'bytes': 15, 'cursor_bytes': 1}, wordcount()) + + " Test 3: some words, cursor at end + %d _ + call append(1, 'one two three') + call cursor([2, 99, 0]) + call assert_equal({'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, + \ 'bytes': 15, 'cursor_bytes': 14}, wordcount()) + + " Test 4: some words, cursor at end, ve=all + set ve=all + %d _ + call append(1, 'one two three') + call cursor([2, 99, 0]) + call assert_equal({'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, + \ 'bytes': 15, 'cursor_bytes': 15}, wordcount()) + set ve= + + " Test 5: several lines with words + %d _ + call append(1, ['one two three', 'one two three', 'one two three']) + call cursor([4, 99, 0]) + call assert_equal({'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, + \ 'bytes': 43, 'cursor_bytes': 42}, wordcount()) + + " Test 6: one line with BOM set + %d _ + call append(1, 'one two three') + set bomb + w! Xtest + call cursor([2, 99, 0]) + call assert_equal({'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, + \ 'bytes': 18, 'cursor_bytes': 14}, wordcount()) + set nobomb + w! + call delete('Xtest') + + " Test 7: one line with multibyte words + %d _ + call append(1, ['Äne M¤ne Müh']) + call cursor([2, 99, 0]) + call assert_equal({'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, + \ 'bytes': 17, 'cursor_bytes': 16}, wordcount()) + + " Test 8: several lines with multibyte words + %d _ + call append(1, ['Äne M¤ne Müh', 'und raus bist dü!']) + call cursor([3, 99, 0]) + call assert_equal({'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, + \ 'bytes': 36, 'cursor_bytes': 35}, wordcount()) + + " Visual map to capture wordcount() in visual mode + vnoremap <expr> <F2> execute("let g:visual_stat = wordcount()") + + " Test 9: visual mode, complete buffer + let g:visual_stat = {} + %d _ + call append(1, ['Äne M¤ne Müh', 'und raus bist dü!']) + " start visual mode and select the complete buffer + 0 + exe "normal V2j\<F2>y" + call assert_equal({'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, + \ 'visual_words': 7, 'visual_bytes': 36}, g:visual_stat) + + " Test 10: visual mode (empty) + %d _ + call append(1, ['Äne M¤ne Müh', 'und raus bist dü!']) + " start visual mode and select the complete buffer + 0 + exe "normal v$\<F2>y" + call assert_equal({'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, + \ 'visual_words': 0, 'visual_bytes': 1}, g:visual_stat) + + " Test 11: visual mode, single line + %d _ + call append(1, ['Äne M¤ne Müh', 'und raus bist dü!']) + " start visual mode and select the complete buffer + 2 + exe "normal 0v$\<F2>y" + call assert_equal({'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, + \ 'visual_words': 3, 'visual_bytes': 16}, g:visual_stat) + + set selection& fileformat& fileformats& + let &enc = save_enc + enew! + close +endfunc diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim new file mode 100644 index 0000000000..672ddd3a74 --- /dev/null +++ b/src/testdir/test_writefile.vim @@ -0,0 +1,114 @@ +" Tests for the writefile() function. + +func Test_writefile() + let f = tempname() + call writefile(["over","written"], f, "b") + call writefile(["hello","world"], f, "b") + call writefile(["!", "good"], f, "a") + call writefile(["morning"], f, "ab") + call writefile(["", "vimmers"], f, "ab") + let l = readfile(f) + call assert_equal("hello", l[0]) + call assert_equal("world!", l[1]) + call assert_equal("good", l[2]) + call assert_equal("morning", l[3]) + call assert_equal("vimmers", l[4]) + call delete(f) +endfunc + +func Test_writefile_fails_gently() + call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile([], "Xfile", [])', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile([], [])', 'E730:') +endfunc + +func Test_writefile_fails_conversion() + if !has('multi_byte') || !has('iconv') + return + endif + set nobackup nowritebackup + new + let contents = ["line one", "line two"] + call writefile(contents, 'Xfile') + edit Xfile + call setline(1, ["first line", "cannot convert \u010b", "third line"]) + call assert_fails('write ++enc=cp932') + call assert_equal(contents, readfile('Xfile')) + + call delete('Xfile') + bwipe! + set backup& writebackup& +endfunc + +func SetFlag(timer) + let g:flag = 1 +endfunc + +func Test_write_quit_split() + " Prevent exiting by splitting window on file write. + augroup testgroup + autocmd BufWritePre * split + augroup END + e! Xfile + call setline(1, 'nothing') + wq + + if has('timers') + " timer will not run if "exiting" is still set + let g:flag = 0 + call timer_start(1, 'SetFlag') + sleep 50m + call assert_equal(1, g:flag) + unlet g:flag + endif + au! testgroup + bwipe Xfile + call delete('Xfile') +endfunc + +func Test_nowrite_quit_split() + " Prevent exiting by opening a help window. + e! Xfile + help + wincmd w + exe winnr() . 'q' + + if has('timers') + " timer will not run if "exiting" is still set + let g:flag = 0 + call timer_start(1, 'SetFlag') + sleep 50m + call assert_equal(1, g:flag) + unlet g:flag + endif + bwipe Xfile +endfunc + +func Test_writefile_sync_arg() + " This doesn't check if fsync() works, only that the argument is accepted. + call writefile(['one'], 'Xtest', 's') + call writefile(['two'], 'Xtest', 'S') + call delete('Xtest') +endfunc + +func Test_writefile_sync_dev_stdout() + if !has('unix') + return + endif + if filewritable('/dev/stdout') + " Just check that this doesn't cause an error. + call writefile(['one'], '/dev/stdout') + else + throw 'Skipped: /dev/stdout is not writable' + endif +endfunc diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim new file mode 100644 index 0000000000..6e6789329a --- /dev/null +++ b/src/testdir/test_xxd.vim @@ -0,0 +1,115 @@ +" Test for the xxd command +if empty($XXD) && executable('..\xxd\xxd.exe') + let s:xxd_cmd = '..\xxd\xxd.exe' +elseif empty($XXD) || !executable($XXD) + finish +else + let s:xxd_cmd = $XXD +endif + +func! PrepareBuffer(lines) + new + call append(0, a:lines) + $d +endfunc + +func! s:Mess(counter) + return printf("Failed xxd test %d:", a:counter) +endfunc + +func! Test_xxd() + call PrepareBuffer(range(1,30)) + set ff=unix + w XXDfile + + " Test 1: simple, filter the result through xxd + let s:test = 1 + exe '%!' . s:xxd_cmd . ' %' + let expected = [ + \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', + \ '00000010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', + \ '00000020: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.', + \ '00000030: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2', + \ '00000040: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30', + \ '00000050: 0a .'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 2: reverse the result + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -r' + call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test)) + + " Test 3: Skip the first 30 bytes + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -s 0x30 %' + call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test)) + + " Test 4: Skip the first 30 bytes + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -s -0x31 %' + call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) + + " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line + let s:test += 1 + %d + let fname = '../../runtime/doc/xxd.1' + if has('win32') && !filereadable(fname) + let fname = '../../doc/xxd.1' + endif + exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c 20 ' . fname + $d + let expected = [ + \ '2e54482058584420312022417567757374203139', + \ '39362220224d616e75616c207061676520666f72', + \ '20787864220a2e5c220a2e5c222032317374204d', + \ '617920313939360a2e5c22204d616e2070616765', + \ '20617574686f723a0a2e5c2220202020546f6e79', + \ '204e7567656e74203c746f6e79407363746e7567'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 6: Print the date from xxd.1 + let s:test += 1 + %d + exe '0r! ' . s:xxd_cmd . ' -s 0x36 -l 13 -c 13 ' . fname + $d + call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) + + " Test 7: Print C include + let s:test += 1 + call writefile(['TESTabcd09'], 'XXDfile') + %d + exe '0r! ' . s:xxd_cmd . ' -i XXDfile' + $d + let expected = ['unsigned char XXDfile[] = {', + \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', + \ 'unsigned int XXDfile_len = 11;'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 8: Print C include capitalized + let s:test += 1 + call writefile(['TESTabcd09'], 'XXDfile') + %d + exe '0r! ' . s:xxd_cmd . ' -i -C XXDfile' + $d + let expected = ['unsigned char XXDFILE[] = {', + \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', + \ 'unsigned int XXDFILE_LEN = 11;'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 9: Create a file with containing a single 'A' + let s:test += 1 + call delete('XXDfile') + bwipe! XXDfile + if has('unix') + call system('echo "010000: 41"|' . s:xxd_cmd . ' -r -s -0x10000 > XXDfile') + else + call writefile(['010000: 41'], 'Xinput') + silent exe '!' . s:xxd_cmd . ' -r -s -0x10000 < Xinput > XXDfile' + call delete('Xinput') + endif + call PrepareBuffer(readfile('XXDfile')[0]) + call assert_equal('A', getline(1), s:Mess(s:test)) + call delete('XXDfile') + %d + bw! +endfunc diff --git a/src/testdir/todos.vim b/src/testdir/todos.vim deleted file mode 100644 index 0256a51c89..0000000000 --- a/src/testdir/todos.vim +++ /dev/null @@ -1,3 +0,0 @@ -:" Script to make sure a file is in "dos" file format. -:set ff=dos -:wq diff --git a/src/testdir/unix.vim b/src/testdir/unix.vim index f766e74c30..b82c63c389 100644 --- a/src/testdir/unix.vim +++ b/src/testdir/unix.vim @@ -1,3 +1,13 @@ " Settings for test script execution " Always use "sh", don't use the value of "$SHELL". set shell=sh + +" Only when the +eval feature is present. +if 1 + " While some tests overwrite $HOME to prevent them from polluting user files, + " we need to remember the original value so that we can tell external systems + " where to ask about their own user settings. + let g:tester_HOME = $HOME +endif + +source setup.vim diff --git a/src/testdir/view_util.vim b/src/testdir/view_util.vim new file mode 100644 index 0000000000..29ea073f97 --- /dev/null +++ b/src/testdir/view_util.vim @@ -0,0 +1,51 @@ +" Functions about view shared by several tests + +" Only load this script once. +if exists('*ScreenLines') + finish +endif + +" ScreenLines(lnum, width) or +" ScreenLines([start, end], width) +function! ScreenLines(lnum, width) abort + redraw! + if type(a:lnum) == v:t_list + let start = a:lnum[0] + let end = a:lnum[1] + else + let start = a:lnum + let end = a:lnum + endif + let lines = [] + for l in range(start, end) + let lines += [join(map(range(1, a:width), 'nr2char(screenchar(l, v:val))'), '')] + endfor + return lines +endfunction + +function! ScreenAttrs(lnum, width) abort + redraw! + if type(a:lnum) == v:t_list + let start = a:lnum[0] + let end = a:lnum[1] + else + let start = a:lnum + let end = a:lnum + endif + let attrs = [] + for l in range(start, end) + let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')] + endfor + return attrs +endfunction + +function! NewWindow(height, width) abort + exe a:height . 'new' + exe a:width . 'vsp' + redraw! +endfunction + +function! CloseWindow() abort + bw! + redraw! +endfunction diff --git a/src/testdir/vms.vim b/src/testdir/vms.vim index 3305a77c23..64b390e285 100644 --- a/src/testdir/vms.vim +++ b/src/testdir/vms.vim @@ -1,4 +1,6 @@ " Settings for test script execution under OpenVMS -" Do not make any swap files +" Do not use any swap files set noswapfile + +source setup.vim diff --git a/src/tools16.bmp b/src/tools16.bmp deleted file mode 100644 index d4fbc511eb..0000000000 Binary files a/src/tools16.bmp and /dev/null differ diff --git a/src/ui.c b/src/ui.c index 46c820b969..4d31ab9217 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -25,16 +25,14 @@ #endif void -ui_write(s, len) - char_u *s; - int len; +ui_write(char_u *s, int len) { #ifdef FEAT_GUI if (gui.in_use && !gui.dying && !gui.starting) { gui_write(s, len); if (p_wd) - gui_wait_for_chars(p_wd); + gui_wait_for_chars(p_wd, typebuf.tb_change_cnt); return; } #endif @@ -42,7 +40,7 @@ ui_write(s, len) /* Don't output anything in silent mode ("ex -s") unless 'verbose' set */ if (!(silent_mode && p_verbose == 0)) { -#ifdef FEAT_MBYTE +#if defined(FEAT_MBYTE) && !defined(WIN3264) char_u *tofree = NULL; if (output_conv.vc_type != CONV_NONE) @@ -56,7 +54,7 @@ ui_write(s, len) mch_write(s, len); -#ifdef FEAT_MBYTE +#if defined(FEAT_MBYTE) && !defined(WIN3264) if (output_conv.vc_type != CONV_NONE) vim_free(tofree); #endif @@ -75,9 +73,7 @@ static int ta_off; /* offset for next char to use when ta_str != NULL */ static int ta_len; /* length of ta_str when it's not NULL*/ void -ui_inchar_undo(s, len) - char_u *s; - int len; +ui_inchar_undo(char_u *s, int len) { char_u *new; int newlen; @@ -117,11 +113,11 @@ ui_inchar_undo(s, len) * otherwise. */ int -ui_inchar(buf, maxlen, wtime, tb_change_cnt) - char_u *buf; - int maxlen; - long wtime; /* don't use "time", MIPS cannot handle it */ - int tb_change_cnt; +ui_inchar( + char_u *buf, + int maxlen, + long wtime, /* don't use "time", MIPS cannot handle it */ + int tb_change_cnt) { int retval = 0; @@ -134,8 +130,7 @@ ui_inchar(buf, maxlen, wtime, tb_change_cnt) if (maxlen >= ta_len - ta_off) { mch_memmove(buf, ta_str + ta_off, (size_t)ta_len); - vim_free(ta_str); - ta_str = NULL; + VIM_CLEAR(ta_str); return ta_len; } mch_memmove(buf, ta_str + ta_off, (size_t)maxlen); @@ -180,24 +175,19 @@ ui_inchar(buf, maxlen, wtime, tb_change_cnt) /* ... there is no need for CTRL-C to interrupt something, don't let * it set got_int when it was mapped. */ - if (mapped_ctrl_c) + if ((mapped_ctrl_c | curbuf->b_mapped_ctrl_c) & get_real_state()) ctrl_c_interrupts = FALSE; } #ifdef FEAT_GUI if (gui.in_use) - { - if (gui_wait_for_chars(wtime) && !typebuf_changed(tb_change_cnt)) - retval = read_from_input_buf(buf, (long)maxlen); - } + retval = gui_inchar(buf, maxlen, wtime, tb_change_cnt); #endif #ifndef NO_CONSOLE # ifdef FEAT_GUI else # endif - { retval = mch_inchar(buf, maxlen, wtime, tb_change_cnt); - } #endif if (wtime == -1 || wtime > 100L) @@ -216,11 +206,57 @@ ui_inchar(buf, maxlen, wtime, tb_change_cnt) return retval; } +#if defined(FEAT_TIMERS) || defined(PROT) +/* + * Wait for a timer to fire or "wait_func" to return non-zero. + * Returns OK when something was read. + * Returns FAIL when it timed out or was interrupted. + */ + int +ui_wait_for_chars_or_timer( + long wtime, + int (*wait_func)(long wtime, int *interrupted, int ignore_input), + int *interrupted, + int ignore_input) +{ + int due_time; + long remaining = wtime; + int tb_change_cnt = typebuf.tb_change_cnt; + + /* When waiting very briefly don't trigger timers. */ + if (wtime >= 0 && wtime < 10L) + return wait_func(wtime, NULL, ignore_input); + + while (wtime < 0 || remaining > 0) + { + /* Trigger timers and then get the time in wtime until the next one is + * due. Wait up to that time. */ + due_time = check_due_timer(); + if (typebuf.tb_change_cnt != tb_change_cnt) + { + /* timer may have used feedkeys() */ + return FAIL; + } + if (due_time <= 0 || (wtime > 0 && due_time > remaining)) + due_time = remaining; + if (wait_func(due_time, interrupted, ignore_input)) + return OK; + if (interrupted != NULL && *interrupted) + /* Nothing available, but need to return so that side effects get + * handled, such as handling a message on a channel. */ + return FAIL; + if (wtime > 0) + remaining -= due_time; + } + return FAIL; +} +#endif + /* * return non-zero if a character is available */ int -ui_char_avail() +ui_char_avail(void) { #ifdef FEAT_GUI if (gui.in_use) @@ -245,13 +281,11 @@ ui_char_avail() * cancel the delay if a key is hit. */ void -ui_delay(msec, ignoreinput) - long msec; - int ignoreinput; +ui_delay(long msec, int ignoreinput) { #ifdef FEAT_GUI if (gui.in_use && !ignoreinput) - gui_wait_for_chars(msec); + gui_wait_for_chars(msec, typebuf.tb_change_cnt); else #endif { @@ -273,7 +307,7 @@ ui_delay(msec, ignoreinput) * When running the GUI iconify the window. */ void -ui_suspend() +ui_suspend(void) { #ifdef FEAT_GUI if (gui.in_use) @@ -291,7 +325,7 @@ ui_suspend() * This is never called in the GUI. */ void -suspend_shell() +suspend_shell(void) { if (*p_sh == NUL) EMSG(_(e_shellempty)); @@ -309,7 +343,7 @@ suspend_shell() * Return OK when size could be determined, FAIL otherwise. */ int -ui_get_shellsize() +ui_get_shellsize(void) { int retval; @@ -343,8 +377,8 @@ ui_get_shellsize() * new size. If this is not possible, it will adjust Rows and Columns. */ void -ui_set_shellsize(mustset) - int mustset UNUSED; /* set by the user */ +ui_set_shellsize( + int mustset UNUSED) /* set by the user */ { #ifdef FEAT_GUI if (gui.in_use) @@ -359,7 +393,7 @@ ui_set_shellsize(mustset) * region. */ void -ui_new_shellsize() +ui_new_shellsize(void) { if (full_screen && !exiting) { @@ -373,14 +407,34 @@ ui_new_shellsize() } void -ui_breakcheck() +ui_breakcheck(void) +{ + ui_breakcheck_force(FALSE); +} + +/* + * When "force" is true also check when the terminal is not in raw mode. + * This is useful to read input on channels. + */ + void +ui_breakcheck_force(int force) { + int save_us = updating_screen; + + /* We do not want gui_resize_shell() to redraw the screen here. */ + ++updating_screen; + #ifdef FEAT_GUI if (gui.in_use) gui_mch_update(); else #endif - mch_breakcheck(); + mch_breakcheck(force); + + if (save_us) + updating_screen = save_us; + else + reset_updating_screen(FALSE); } /***************************************************************************** @@ -397,8 +451,6 @@ ui_breakcheck() #if defined(FEAT_CLIPBOARD) || defined(PROTO) -static void clip_copy_selection __ARGS((VimClipboard *clip)); - /* * Selection stuff using Visual mode, for cutting and pasting text to other * windows. @@ -411,8 +463,7 @@ static void clip_copy_selection __ARGS((VimClipboard *clip)); * the GUI starts. */ void -clip_init(can_use) - int can_use; +clip_init(int can_use) { VimClipboard *cb; @@ -441,15 +492,14 @@ clip_init(can_use) * this is called whenever VIsual mode is ended. */ void -clip_update_selection(clip) - VimClipboard *clip; +clip_update_selection(VimClipboard *clip) { pos_T start, end; /* If visual mode is only due to a redo command ("."), then ignore it */ if (!redo_VIsual_busy && VIsual_active && (State & NORMAL)) { - if (lt(VIsual, curwin->w_cursor)) + if (LT_POS(VIsual, curwin->w_cursor)) { start = VIsual; end = curwin->w_cursor; @@ -463,8 +513,8 @@ clip_update_selection(clip) start = curwin->w_cursor; end = VIsual; } - if (!equalpos(clip->start, start) - || !equalpos(clip->end, end) + if (!EQUAL_POS(clip->start, start) + || !EQUAL_POS(clip->end, end) || clip->vmode != VIsual_mode) { clip_clear_selection(clip); @@ -479,8 +529,7 @@ clip_update_selection(clip) } void -clip_own_selection(cbd) - VimClipboard *cbd; +clip_own_selection(VimClipboard *cbd) { /* * Also want to check somehow that we are reading from the keyboard rather @@ -504,7 +553,7 @@ clip_own_selection(cbd) || get_real_state() == SELECTMODE) && (cbd == &clip_star ? clip_isautosel_star() : clip_isautosel_plus()) - && hl_attr(HLF_V) != hl_attr(HLF_VNC)) + && HL_ATTR(HLF_V) != HL_ATTR(HLF_VNC)) redraw_curbuf_later(INVERTED_ALL); } } @@ -516,8 +565,7 @@ clip_own_selection(cbd) } void -clip_lose_selection(cbd) - VimClipboard *cbd; +clip_lose_selection(VimClipboard *cbd) { #ifdef FEAT_X11 int was_owned = cbd->owned; @@ -543,24 +591,19 @@ clip_lose_selection(cbd) || get_real_state() == SELECTMODE) && (cbd == &clip_star ? clip_isautosel_star() : clip_isautosel_plus()) - && hl_attr(HLF_V) != hl_attr(HLF_VNC)) + && HL_ATTR(HLF_V) != HL_ATTR(HLF_VNC)) { update_curbuf(INVERTED_ALL); setcursor(); cursor_on(); - out_flush(); -# ifdef FEAT_GUI - if (gui.in_use) - gui_update_cursor(TRUE, FALSE); -# endif + out_flush_cursor(TRUE, FALSE); } } #endif } static void -clip_copy_selection(clip) - VimClipboard *clip; +clip_copy_selection(VimClipboard *clip) { if (VIsual_active && (State & NORMAL) && clip->available) { @@ -573,11 +616,81 @@ clip_copy_selection(clip) } } +/* + * Save and restore clip_unnamed before doing possibly many changes. This + * prevents accessing the clipboard very often which might slow down Vim + * considerably. + */ +static int global_change_count = 0; /* if set, inside a start_global_changes */ +static int clipboard_needs_update = FALSE; /* clipboard needs to be updated */ +static int clip_did_set_selection = TRUE; + +/* + * Save clip_unnamed and reset it. + */ + void +start_global_changes(void) +{ + if (++global_change_count > 1) + return; + clip_unnamed_saved = clip_unnamed; + clipboard_needs_update = FALSE; + + if (clip_did_set_selection) + { + clip_unnamed = FALSE; + clip_did_set_selection = FALSE; + } +} + +/* + * Return TRUE if setting the clipboard was postponed, it already contains the + * right text. + */ + int +is_clipboard_needs_update() +{ + return clipboard_needs_update; +} + +/* + * Restore clip_unnamed and set the selection when needed. + */ + void +end_global_changes(void) +{ + if (--global_change_count > 0) + /* recursive */ + return; + if (!clip_did_set_selection) + { + clip_did_set_selection = TRUE; + clip_unnamed = clip_unnamed_saved; + clip_unnamed_saved = FALSE; + if (clipboard_needs_update) + { + /* only store something in the clipboard, + * if we have yanked anything to it */ + if (clip_unnamed & CLIP_UNNAMED) + { + clip_own_selection(&clip_star); + clip_gen_set_selection(&clip_star); + } + if (clip_unnamed & CLIP_UNNAMED_PLUS) + { + clip_own_selection(&clip_plus); + clip_gen_set_selection(&clip_plus); + } + } + } + clipboard_needs_update = FALSE; +} + /* * Called when Visual mode is ended: update the selection. */ void -clip_auto_select() +clip_auto_select(void) { if (clip_isautosel_star()) clip_copy_selection(&clip_star); @@ -590,7 +703,7 @@ clip_auto_select() * register. */ int -clip_isautosel_star() +clip_isautosel_star(void) { return ( #ifdef FEAT_GUI @@ -604,7 +717,7 @@ clip_isautosel_star() * register. */ int -clip_isautosel_plus() +clip_isautosel_plus(void) { return ( #ifdef FEAT_GUI @@ -618,13 +731,13 @@ clip_isautosel_plus() * Stuff for general mouse selection, without using Visual mode. */ -static int clip_compare_pos __ARGS((int row1, int col1, int row2, int col2)); -static void clip_invert_area __ARGS((int, int, int, int, int how)); -static void clip_invert_rectangle __ARGS((int row, int col, int height, int width, int invert)); -static void clip_get_word_boundaries __ARGS((VimClipboard *, int, int)); -static int clip_get_line_end __ARGS((int)); -static void clip_update_modeless_selection __ARGS((VimClipboard *, int, int, - int, int)); +static int clip_compare_pos(int row1, int col1, int row2, int col2); +static void clip_invert_area(int, int, int, int, int how); +static void clip_invert_rectangle(int row, int col, int height, int width, int invert); +static void clip_get_word_boundaries(VimClipboard *, int, int); +static int clip_get_line_end(int); +static void clip_update_modeless_selection(VimClipboard *, int, int, + int, int); /* flags for clip_invert_area() */ #define CLIP_CLEAR 1 @@ -636,10 +749,7 @@ static void clip_update_modeless_selection __ARGS((VimClipboard *, int, int, * command-line and in the cmdline window. */ void -clip_modeless(button, is_click, is_drag) - int button; - int is_click; - int is_drag; +clip_modeless(int button, int is_click, int is_drag) { int repeat; @@ -673,27 +783,24 @@ clip_modeless(button, is_click, is_drag) * Compare two screen positions ala strcmp() */ static int -clip_compare_pos(row1, col1, row2, col2) - int row1; - int col1; - int row2; - int col2; +clip_compare_pos( + int row1, + int col1, + int row2, + int col2) { if (row1 > row2) return(1); if (row1 < row2) return(-1); if (col1 > col2) return(1); if (col1 < col2) return(-1); - return(0); + return(0); } /* * Start the selection */ void -clip_start_selection(col, row, repeated_click) - int col; - int row; - int repeated_click; +clip_start_selection(int col, int row, int repeated_click) { VimClipboard *cb = &clip_star; @@ -763,11 +870,11 @@ clip_start_selection(col, row, repeated_click) * Continue processing the selection */ void -clip_process_selection(button, col, row, repeated_click) - int button; - int col; - int row; - int_u repeated_click; +clip_process_selection( + int button, + int col, + int row, + int_u repeated_click) { VimClipboard *cb = &clip_star; int diff; @@ -948,9 +1055,7 @@ clip_process_selection(button, col, row, repeated_click) * Only used for the GUI. */ void -clip_may_redraw_selection(row, col, len) - int row, col; - int len; +clip_may_redraw_selection(int row, int col, int len) { int start = col; int end = col + len; @@ -973,8 +1078,7 @@ clip_may_redraw_selection(row, col, len) * Called from outside to clear selected region from the display */ void -clip_clear_selection(cbd) - VimClipboard *cbd; +clip_clear_selection(VimClipboard *cbd) { if (cbd->state == SELECT_CLEARED) @@ -989,8 +1093,7 @@ clip_clear_selection(cbd) * Clear the selection if any lines from "row1" to "row2" are inside of it. */ void -clip_may_clear_selection(row1, row2) - int row1, row2; +clip_may_clear_selection(int row1, int row2) { if (clip_star.state == SELECT_DONE && row2 >= clip_star.start.lnum @@ -1003,8 +1106,8 @@ clip_may_clear_selection(row1, row2) * of the selection. Call with big number when clearing the screen. */ void -clip_scroll_selection(rows) - int rows; /* negative for scroll down */ +clip_scroll_selection( + int rows) /* negative for scroll down */ { int lnum; @@ -1037,12 +1140,12 @@ clip_scroll_selection(rows) * 0: invert (GUI only). */ static void -clip_invert_area(row1, col1, row2, col2, how) - int row1; - int col1; - int row2; - int col2; - int how; +clip_invert_area( + int row1, + int col1, + int row2, + int col2, + int how) { int invert = FALSE; @@ -1097,12 +1200,12 @@ clip_invert_area(row1, col1, row2, col2, how) * "invert" is true if the result is inverted. */ static void -clip_invert_rectangle(row, col, height, width, invert) - int row; - int col; - int height; - int width; - int invert; +clip_invert_rectangle( + int row, + int col, + int height, + int width, + int invert) { #ifdef FEAT_GUI if (gui.in_use) @@ -1122,8 +1225,7 @@ clip_invert_rectangle(row, col, height, width, invert) * When "both" is TRUE also copy to the '+' register. */ void -clip_copy_modeless_selection(both) - int both UNUSED; +clip_copy_modeless_selection(int both UNUSED) { char_u *buffer; char_u *bufp; @@ -1306,10 +1408,7 @@ clip_copy_modeless_selection(both) #define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c)) static void -clip_get_word_boundaries(cb, row, col) - VimClipboard *cb; - int row; - int col; +clip_get_word_boundaries(VimClipboard *cb, int row, int col) { int start_class; int temp_col; @@ -1368,8 +1467,7 @@ clip_get_word_boundaries(cb, row, col) * line. */ static int -clip_get_line_end(row) - int row; +clip_get_line_end(int row) { int i; @@ -1386,12 +1484,12 @@ clip_get_line_end(row) * beginning or end and inverting the changed area(s). */ static void -clip_update_modeless_selection(cb, row1, col1, row2, col2) - VimClipboard *cb; - int row1; - int col1; - int row2; - int col2; +clip_update_modeless_selection( + VimClipboard *cb, + int row1, + int col1, + int row2, + int col2) { /* See if we changed at the beginning of the selection */ if (row1 != cb->start.lnum || col1 != (int)cb->start.col) @@ -1413,8 +1511,7 @@ clip_update_modeless_selection(cb, row1, col1, row2, col2) } int -clip_gen_own_selection(cbd) - VimClipboard *cbd; +clip_gen_own_selection(VimClipboard *cbd) { #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI @@ -1429,8 +1526,7 @@ clip_gen_own_selection(cbd) } void -clip_gen_lose_selection(cbd) - VimClipboard *cbd; +clip_gen_lose_selection(VimClipboard *cbd) { #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI @@ -1445,9 +1541,19 @@ clip_gen_lose_selection(cbd) } void -clip_gen_set_selection(cbd) - VimClipboard *cbd; +clip_gen_set_selection(VimClipboard *cbd) { + if (!clip_did_set_selection) + { + /* Updating postponed, so that accessing the system clipboard won't + * hang Vim when accessing it many times (e.g. on a :g comand). */ + if ((cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS)) + || (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED))) + { + clipboard_needs_update = TRUE; + return; + } + } #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI if (gui.in_use) @@ -1461,8 +1567,7 @@ clip_gen_set_selection(cbd) } void -clip_gen_request_selection(cbd) - VimClipboard *cbd; +clip_gen_request_selection(VimClipboard *cbd) { #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI @@ -1477,8 +1582,7 @@ clip_gen_request_selection(cbd) } int -clip_gen_owner_exists(cbd) - VimClipboard *cbd UNUSED; +clip_gen_owner_exists(VimClipboard *cbd UNUSED) { #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI_GTK @@ -1513,7 +1617,7 @@ clip_gen_owner_exists(cbd) * descriptions which would otherwise overflow. The buffer is considered full * when only this extra space (or part of it) remains. */ -#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) \ +#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_JOB_CHANNEL) \ || defined(FEAT_CLIENTSERVER) /* * Sun WorkShop and NetBeans stuff debugger commands into the input buffer. @@ -1535,20 +1639,20 @@ static int inbufcount = 0; /* number of chars in inbuf[] */ */ int -vim_is_input_buf_full() +vim_is_input_buf_full(void) { return (inbufcount >= INBUFLEN); } int -vim_is_input_buf_empty() +vim_is_input_buf_empty(void) { return (inbufcount == 0); } #if defined(FEAT_OLE) || defined(PROTO) int -vim_free_in_input_buf() +vim_free_in_input_buf(void) { return (INBUFLEN - inbufcount); } @@ -1556,19 +1660,18 @@ vim_free_in_input_buf() #if defined(FEAT_GUI_GTK) || defined(PROTO) int -vim_used_in_input_buf() +vim_used_in_input_buf(void) { return inbufcount; } #endif -#if defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) || defined(PROTO) /* * Return the current contents of the input buffer and make it empty. * The returned pointer must be passed to set_input_buf() later. */ char_u * -get_input_buf() +get_input_buf(void) { garray_T *gap; @@ -1591,8 +1694,7 @@ get_input_buf() * The allocated memory is freed, this only works once! */ void -set_input_buf(p) - char_u *p; +set_input_buf(char_u *p) { garray_T *gap = (garray_T *)p; @@ -1607,22 +1709,14 @@ set_input_buf(p) vim_free(gap); } } -#endif -#if defined(FEAT_GUI) \ - || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE) \ - || defined(FEAT_XCLIPBOARD) || defined(VMS) \ - || defined(FEAT_SNIFF) || defined(FEAT_CLIENTSERVER) \ - || defined(PROTO) /* * Add the given bytes to the input buffer * Special keys start with CSI. A real CSI must have been translated to * CSI KS_EXTRA KE_CSI. K_SPECIAL doesn't require translation. */ void -add_to_input_buf(s, len) - char_u *s; - int len; +add_to_input_buf(char_u *s, int len) { if (inbufcount + len > INBUFLEN + MAX_KEY_CODE_LEN) return; /* Shouldn't ever happen! */ @@ -1636,15 +1730,7 @@ add_to_input_buf(s, len) while (len--) inbuf[inbufcount++] = *s++; } -#endif -#if ((defined(FEAT_XIM) || defined(FEAT_DND)) && defined(FEAT_GUI_GTK)) \ - || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_MAC) \ - || (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) \ - || (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \ - || defined(FEAT_MENU))) \ - || defined(PROTO) /* * Add "str[len]" to the input buffer while escaping CSI bytes. */ @@ -1666,38 +1752,46 @@ add_to_input_buf_csi(char_u *str, int len) } } } -#endif #if defined(FEAT_HANGULIN) || defined(PROTO) void -push_raw_key(s, len) - char_u *s; - int len; +push_raw_key(char_u *s, int len) { - while (len--) - inbuf[inbufcount++] = *s++; + char_u *tmpbuf; + char_u *inp = s; + + /* use the conversion result if possible */ + tmpbuf = hangul_string_convert(s, &len); + if (tmpbuf != NULL) + inp = tmpbuf; + + for (; len--; inp++) + { + inbuf[inbufcount++] = *inp; + if (*inp == CSI) + { + /* Turn CSI into K_CSI. */ + inbuf[inbufcount++] = KS_EXTRA; + inbuf[inbufcount++] = (int)KE_CSI; + } + } + vim_free(tmpbuf); } #endif -#if defined(FEAT_GUI) || defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) \ - || defined(PROTO) /* Remove everything from the input buffer. Called when ^C is found */ void -trash_input_buf() +trash_input_buf(void) { inbufcount = 0; } -#endif /* * Read as much data from the input buffer as possible up to maxlen, and store * it in buf. - * Note: this function used to be Read() in unix.c */ int -read_from_input_buf(buf, maxlen) - char_u *buf; - long maxlen; +read_from_input_buf(char_u *buf, long maxlen) { if (inbufcount == 0) /* if the buffer is empty, fill it */ fill_input_buf(TRUE); @@ -1711,10 +1805,9 @@ read_from_input_buf(buf, maxlen) } void -fill_input_buf(exit_on_error) - int exit_on_error UNUSED; +fill_input_buf(int exit_on_error UNUSED) { -#if defined(UNIX) || defined(OS2) || defined(VMS) || defined(MACOS_X_UNIX) +#if defined(UNIX) || defined(VMS) || defined(MACOS_X) int len; int try; static int did_read_something = FALSE; @@ -1738,7 +1831,7 @@ fill_input_buf(exit_on_error) return; } #endif -#if defined(UNIX) || defined(OS2) || defined(VMS) || defined(MACOS_X_UNIX) +#if defined(UNIX) || defined(VMS) || defined(MACOS_X) if (vim_is_input_buf_full()) return; /* @@ -1758,17 +1851,7 @@ fill_input_buf(exit_on_error) inbufcount = 0; # else -# ifdef FEAT_SNIFF - if (sniff_request_waiting) - { - add_to_input_buf((char_u *)"\233sniff",6); /* results in K_SNIFF */ - sniff_request_waiting = 0; - want_sniff_request = 0; - return; - } -# endif - -# ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (rest != NULL) { /* Use remainder of previous call, starts with an invalid character @@ -1779,10 +1862,7 @@ fill_input_buf(exit_on_error) unconverted = restlen; mch_memmove(inbuf + inbufcount, rest, unconverted); if (unconverted == restlen) - { - vim_free(rest); - rest = NULL; - } + VIM_CLEAR(rest); else { restlen -= unconverted; @@ -1792,23 +1872,20 @@ fill_input_buf(exit_on_error) } else unconverted = 0; -#endif +# endif len = 0; /* to avoid gcc warning */ for (try = 0; try < 100; ++try) { -# ifdef VMS - len = vms_read( -# else - len = read(read_cmd_fd, -# endif - (char *)inbuf + inbufcount, (size_t)((INBUFLEN - inbufcount) + size_t readlen = (size_t)((INBUFLEN - inbufcount) # ifdef FEAT_MBYTE - / input_conv.vc_factor + / input_conv.vc_factor # endif - )); -# if 0 - ) /* avoid syntax highlight error */ + ); +# ifdef VMS + len = vms_read((char *)inbuf + inbufcount, readlen); +# else + len = read(read_cmd_fd, (char *)inbuf + inbufcount, readlen); # endif if (len > 0 || got_int) @@ -1882,15 +1959,15 @@ fill_input_buf(exit_on_error) ++inbufcount; } } -#endif /* UNIX or OS2 or VMS*/ +#endif /* UNIX or VMS*/ } -#endif /* defined(UNIX) || defined(FEAT_GUI) || defined(OS2) || defined(VMS) */ +#endif /* defined(UNIX) || defined(FEAT_GUI) || defined(VMS) */ /* * Exit because of an input read error. */ void -read_error_exit() +read_error_exit(void) { if (silent_mode) /* Normal way to exit for "ex -s" */ getout(0); @@ -1903,22 +1980,28 @@ read_error_exit() * May update the shape of the cursor. */ void -ui_cursor_shape() +ui_cursor_shape_forced(int forced) { # ifdef FEAT_GUI if (gui.in_use) gui_update_cursor_later(); else # endif - term_cursor_shape(); + term_cursor_mode(forced); # ifdef MCH_CURSOR_SHAPE mch_update_cursor(); # endif # ifdef FEAT_CONCEAL - conceal_check_cursur_line(); + conceal_check_cursor_line(); # endif +} + + void +ui_cursor_shape(void) +{ + ui_cursor_shape_forced(FALSE); } #endif @@ -1928,8 +2011,7 @@ ui_cursor_shape() * Check bounds for column number */ int -check_col(col) - int col; +check_col(int col) { if (col < 0) return 0; @@ -1942,8 +2024,7 @@ check_col(col) * Check bounds for row number */ int -check_row(row) - int row; +check_row(int row) { if (row < 0) return 0; @@ -1966,7 +2047,7 @@ check_row(row) * Used for Motif and Athena GUI and the xterm clipboard. */ void -open_app_context() +open_app_context(void) { if (app_context == NULL) { @@ -1986,8 +2067,7 @@ static Atom targets_atom; static Atom timestamp_atom; /* Used to get a timestamp */ void -x11_setup_atoms(dpy) - Display *dpy; +x11_setup_atoms(Display *dpy) { vim_atom = XInternAtom(dpy, VIM_ATOM_NAME, False); #ifdef FEAT_MBYTE @@ -2006,20 +2086,21 @@ x11_setup_atoms(dpy) * X Selection stuff, for cutting and pasting text to other windows. */ -static Boolean clip_x11_convert_selection_cb __ARGS((Widget, Atom *, Atom *, Atom *, XtPointer *, long_u *, int *)); -static void clip_x11_lose_ownership_cb __ARGS((Widget, Atom *)); -static void clip_x11_timestamp_cb __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont)); -static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *)); +static Boolean clip_x11_convert_selection_cb(Widget w, Atom *sel_atom, Atom *target, Atom *type, XtPointer *value, long_u *length, int *format); +static void clip_x11_lose_ownership_cb(Widget w, Atom *sel_atom); +static void clip_x11_notify_cb(Widget w, Atom *sel_atom, Atom *target); +static void clip_x11_timestamp_cb(Widget w, XtPointer n, XEvent *event, Boolean *cont); +static void clip_x11_request_selection_cb(Widget w, XtPointer success, Atom *sel_atom, Atom *type, XtPointer value, long_u *length, int *format); /* * Property callback to get a timestamp for XtOwnSelection. */ static void -clip_x11_timestamp_cb(w, n, event, cont) - Widget w; - XtPointer n UNUSED; - XEvent *event; - Boolean *cont UNUSED; +clip_x11_timestamp_cb( + Widget w, + XtPointer n UNUSED, + XEvent *event, + Boolean *cont UNUSED) { Atom actual_type; int format; @@ -2049,7 +2130,7 @@ clip_x11_timestamp_cb(w, n, event, cont) /* Get the selection, using the event timestamp. */ if (XtOwnSelection(w, xproperty->atom, xproperty->time, clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, - NULL) == OK) + clip_x11_notify_cb) == OK) { /* Set the "owned" flag now, there may have been a call to * lose_ownership_cb in between. */ @@ -2061,23 +2142,21 @@ clip_x11_timestamp_cb(w, n, event, cont) } void -x11_setup_selection(w) - Widget w; +x11_setup_selection(Widget w) { XtAddEventHandler(w, PropertyChangeMask, False, /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL); } static void -clip_x11_request_selection_cb(w, success, sel_atom, type, value, length, - format) - Widget w UNUSED; - XtPointer success; - Atom *sel_atom; - Atom *type; - XtPointer value; - long_u *length; - int *format; +clip_x11_request_selection_cb( + Widget w UNUSED, + XtPointer success, + Atom *sel_atom, + Atom *type, + XtPointer value, + long_u *length, + int *format) { int motion_type = MAUTO; long_u len; @@ -2183,10 +2262,10 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length, } void -clip_x11_request_selection(myShell, dpy, cbd) - Widget myShell; - Display *dpy; - VimClipboard *cbd; +clip_x11_request_selection( + Widget myShell, + Display *dpy, + VimClipboard *cbd) { XEvent event; Atom type; @@ -2242,9 +2321,9 @@ clip_x11_request_selection(myShell, dpy, cbd) start_time = time(NULL); while (success == MAYBE) { - if (XCheckTypedEvent(dpy, SelectionNotify, &event) - || XCheckTypedEvent(dpy, SelectionRequest, &event) - || XCheckTypedEvent(dpy, PropertyNotify, &event)) + if (XCheckTypedEvent(dpy, PropertyNotify, &event) + || XCheckTypedEvent(dpy, SelectionNotify, &event) + || XCheckTypedEvent(dpy, SelectionRequest, &event)) { /* This is where clip_x11_request_selection_cb() should be * called. It may actually happen a bit later, so we loop @@ -2288,20 +2367,21 @@ clip_x11_request_selection(myShell, dpy, cbd) } static Boolean -clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) - Widget w UNUSED; - Atom *sel_atom; - Atom *target; - Atom *type; - XtPointer *value; - long_u *length; - int *format; -{ - char_u *string; - char_u *result; - int motion_type; - VimClipboard *cbd; - int i; +clip_x11_convert_selection_cb( + Widget w UNUSED, + Atom *sel_atom, + Atom *target, + Atom *type, + XtPointer *value, + long_u *length, + int *format) +{ + static char_u *save_result = NULL; + static long_u save_length = 0; + char_u *string; + int motion_type; + VimClipboard *cbd; + int i; if (*sel_atom == clip_plus.sel_atom) cbd = &clip_plus; @@ -2314,10 +2394,8 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) /* requestor wants to know what target types we support */ if (*target == targets_atom) { - Atom *array; + static Atom array[7]; - if ((array = (Atom *)XtMalloc((unsigned)(sizeof(Atom) * 7))) == NULL) - return False; *value = (XtPointer)array; i = 0; array[i++] = targets_atom; @@ -2366,13 +2444,17 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) *length += STRLEN(p_enc) + 2; #endif - *value = XtMalloc((Cardinal)*length); - result = (char_u *)*value; - if (result == NULL) + if (save_length < *length || save_length / 2 >= *length) + *value = XtRealloc((char *)save_result, (Cardinal)*length + 1); + else + *value = save_result; + if (*value == NULL) { vim_free(string); return False; } + save_result = (char_u *)*value; + save_length = *length; if (*target == XA_STRING #ifdef FEAT_MBYTE @@ -2380,13 +2462,13 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) #endif ) { - mch_memmove(result, string, (size_t)(*length)); + mch_memmove(save_result, string, (size_t)(*length)); *type = *target; } else if (*target == compound_text_atom || *target == text_atom) { XTextProperty text_prop; - char *string_nt = (char *)alloc((unsigned)*length + 1); + char *string_nt = (char *)save_result; int conv_result; /* create NUL terminated string which XmbTextListToTextProperty wants */ @@ -2394,8 +2476,6 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) string_nt[*length] = NUL; conv_result = XmbTextListToTextProperty(X_DISPLAY, (char **)&string_nt, 1, XCompoundTextStyle, &text_prop); - vim_free(string_nt); - XtFree(*value); /* replace with COMPOUND text */ if (conv_result != Success) { vim_free(string); @@ -2404,24 +2484,25 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) *value = (XtPointer)(text_prop.value); /* from plain text */ *length = text_prop.nitems; *type = compound_text_atom; + XtFree((char *)save_result); + save_result = (char_u *)*value; + save_length = *length; } - #ifdef FEAT_MBYTE else if (*target == vimenc_atom) { int l = STRLEN(p_enc); - result[0] = motion_type; - STRCPY(result + 1, p_enc); - mch_memmove(result + l + 2, string, (size_t)(*length - l - 2)); + save_result[0] = motion_type; + STRCPY(save_result + 1, p_enc); + mch_memmove(save_result + l + 2, string, (size_t)(*length - l - 2)); *type = vimenc_atom; } #endif - else { - result[0] = motion_type; - mch_memmove(result + 1, string, (size_t)(*length - 1)); + save_result[0] = motion_type; + mch_memmove(save_result + 1, string, (size_t)(*length - 1)); *type = vim_atom; } *format = 8; /* 8 bits per char */ @@ -2430,9 +2511,7 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) } static void -clip_x11_lose_ownership_cb(w, sel_atom) - Widget w UNUSED; - Atom *sel_atom; +clip_x11_lose_ownership_cb(Widget w UNUSED, Atom *sel_atom) { if (*sel_atom == clip_plus.sel_atom) clip_lose_selection(&clip_plus); @@ -2441,18 +2520,20 @@ clip_x11_lose_ownership_cb(w, sel_atom) } void -clip_x11_lose_selection(myShell, cbd) - Widget myShell; - VimClipboard *cbd; +clip_x11_lose_selection(Widget myShell, VimClipboard *cbd) { XtDisownSelection(myShell, cbd->sel_atom, XtLastTimestampProcessed(XtDisplay(myShell))); } + static void +clip_x11_notify_cb(Widget w UNUSED, Atom *sel_atom UNUSED, Atom *target UNUSED) +{ + /* To prevent automatically freeing the selection value. */ +} + int -clip_x11_own_selection(myShell, cbd) - Widget myShell; - VimClipboard *cbd; +clip_x11_own_selection(Widget myShell, VimClipboard *cbd) { /* When using the GUI we have proper timestamps, use the one of the last * event. When in the console we don't get events (the terminal gets @@ -2464,7 +2545,7 @@ clip_x11_own_selection(myShell, cbd) if (XtOwnSelection(myShell, cbd->sel_atom, XtLastTimestampProcessed(XtDisplay(myShell)), clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, - NULL) == False) + clip_x11_notify_cb) == False) return FAIL; } else @@ -2484,14 +2565,12 @@ clip_x11_own_selection(myShell, cbd) * will fill in the selection only when requested by another app. */ void -clip_x11_set_selection(cbd) - VimClipboard *cbd UNUSED; +clip_x11_set_selection(VimClipboard *cbd UNUSED) { } int -clip_x11_owner_exists(cbd) - VimClipboard *cbd; +clip_x11_owner_exists(VimClipboard *cbd) { return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None; } @@ -2503,9 +2582,7 @@ clip_x11_owner_exists(cbd) * Get the contents of the X CUT_BUFFER0 and put it in "cbd". */ void -yank_cut_buffer0(dpy, cbd) - Display *dpy; - VimClipboard *cbd; +yank_cut_buffer0(Display *dpy, VimClipboard *cbd) { int nbytes = 0; char_u *buffer = (char_u *)XFetchBuffer(dpy, &nbytes, 0); @@ -2580,14 +2657,15 @@ yank_cut_buffer0(dpy, cbd) * remembered. */ int -jump_to_mouse(flags, inclusive, which_button) - int flags; - int *inclusive; /* used for inclusive operator, can be NULL */ - int which_button; /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */ +jump_to_mouse( + int flags, + int *inclusive, /* used for inclusive operator, can be NULL */ + int which_button) /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */ { static int on_status_line = 0; /* #lines below bottom of window */ -#ifdef FEAT_VERTSPLIT static int on_sep_line = 0; /* on separator right of window */ +#ifdef FEAT_MENU + static int in_winbar = FALSE; #endif static int prev_row = -1; static int prev_col = -1; @@ -2626,9 +2704,22 @@ jump_to_mouse(flags, inclusive, which_button) * line, stop Visual mode */ if (on_status_line) return IN_STATUS_LINE; -#ifdef FEAT_VERTSPLIT if (on_sep_line) return IN_SEP_LINE; +#ifdef FEAT_MENU + if (in_winbar) + { + /* A quick second click may arrive as a double-click, but we use it + * as a second click in the WinBar. */ + if ((mod_mask & MOD_MASK_MULTI_CLICK) && !(flags & MOUSE_RELEASED)) + { + wp = mouse_find_win(&row, &col); + if (wp == NULL) + return IN_UNKNOWN; + winbar_click(wp, col); + } + return IN_OTHER_WIN | MOUSE_WINBAR; + } #endif if (flags & MOUSE_MAY_STOP_VIS) { @@ -2637,7 +2728,7 @@ jump_to_mouse(flags, inclusive, which_button) } #if defined(FEAT_CMDWIN) && defined(FEAT_CLIPBOARD) /* Continue a modeless selection in another window. */ - if (cmdwin_type != 0 && row < W_WINROW(curwin)) + if (cmdwin_type != 0 && row < curwin->w_winrow) return IN_OTHER_WIN; #endif return IN_BUFFER; @@ -2667,13 +2758,24 @@ jump_to_mouse(flags, inclusive, which_button) if (row < 0 || col < 0) /* check if it makes sense */ return IN_UNKNOWN; -#ifdef FEAT_WINDOWS /* find the window where the row is in */ wp = mouse_find_win(&row, &col); -#else - wp = firstwin; -#endif + if (wp == NULL) + return IN_UNKNOWN; dragwin = NULL; + +#ifdef FEAT_MENU + if (row == -1) + { + /* A click in the window toolbar does not enter another window or + * change Visual highlighting. */ + winbar_click(wp, col); + in_winbar = TRUE; + return IN_OTHER_WIN | MOUSE_WINBAR; + } + in_winbar = FALSE; +#endif + /* * winpos and height may change in win_enter()! */ @@ -2684,7 +2786,6 @@ jump_to_mouse(flags, inclusive, which_button) } else on_status_line = 0; -#ifdef FEAT_VERTSPLIT if (col >= wp->w_width) /* In separator line */ { on_sep_line = col - wp->w_width + 1; @@ -2702,20 +2803,16 @@ jump_to_mouse(flags, inclusive, which_button) else on_status_line = 0; } -#endif /* Before jumping to another buffer, or moving the cursor for a left * click, stop Visual mode. */ if (VIsual_active && (wp->w_buffer != curwin->w_buffer - || (!on_status_line -#ifdef FEAT_VERTSPLIT - && !on_sep_line -#endif + || (!on_status_line && !on_sep_line #ifdef FEAT_FOLDING && ( # ifdef FEAT_RIGHTLEFT - wp->w_p_rl ? col < W_WIDTH(wp) - wp->w_p_fdc : + wp->w_p_rl ? col < wp->w_width - wp->w_p_fdc : # endif col >= wp->w_p_fdc # ifdef FEAT_CMDWIN @@ -2733,9 +2830,7 @@ jump_to_mouse(flags, inclusive, which_button) { /* A click outside the command-line window: Use modeless * selection if possible. Allow dragging the status lines. */ -# ifdef FEAT_VERTSPLIT on_sep_line = 0; -# endif # ifdef FEAT_CLIPBOARD if (on_status_line) return IN_STATUS_LINE; @@ -2747,18 +2842,23 @@ jump_to_mouse(flags, inclusive, which_button) # endif } #endif -#ifdef FEAT_WINDOWS /* Only change window focus when not clicking on or dragging the * status line. Do change focus when releasing the mouse button * (MOUSE_FOCUS was set above if we dragged first). */ if (dragwin == NULL || (flags & MOUSE_RELEASED)) win_enter(wp, TRUE); /* can make wp invalid! */ -# ifdef CHECK_DOUBLE_CLICK - /* set topline, to be able to check for double click ourselves */ + if (curwin != old_curwin) + { +#ifdef CHECK_DOUBLE_CLICK + /* set topline, to be able to check for double click ourselves */ set_mouse_topline(curwin); -# endif #endif +#ifdef FEAT_TERMINAL + /* when entering a terminal window may change state */ + term_win_entered(); +#endif + } if (on_status_line) /* In (or below) status line */ { /* Don't use start_arrow() if we're in the same window */ @@ -2767,7 +2867,6 @@ jump_to_mouse(flags, inclusive, which_button) else return IN_STATUS_LINE | CURSOR_MOVED; } -#ifdef FEAT_VERTSPLIT if (on_sep_line) /* In (or below) status line */ { /* Don't use start_arrow() if we're in the same window */ @@ -2776,7 +2875,6 @@ jump_to_mouse(flags, inclusive, which_button) else return IN_SEP_LINE | CURSOR_MOVED; } -#endif curwin->w_cursor.lnum = curwin->w_topline; #ifdef FEAT_GUI @@ -2789,7 +2887,6 @@ jump_to_mouse(flags, inclusive, which_button) } else if (on_status_line && which_button == MOUSE_LEFT) { -#ifdef FEAT_WINDOWS if (dragwin != NULL) { /* Drag the status line */ @@ -2798,10 +2895,8 @@ jump_to_mouse(flags, inclusive, which_button) win_drag_status_line(dragwin, count); did_drag |= count; } -#endif return IN_STATUS_LINE; /* Cursor didn't move */ } -#ifdef FEAT_VERTSPLIT else if (on_sep_line && which_button == MOUSE_LEFT) { if (dragwin != NULL) @@ -2814,6 +2909,12 @@ jump_to_mouse(flags, inclusive, which_button) } return IN_SEP_LINE; /* Cursor didn't move */ } +#ifdef FEAT_MENU + else if (in_winbar) + { + /* After a click on the window toolbar don't start Visual mode. */ + return IN_OTHER_WIN | MOUSE_WINBAR; + } #endif else /* keep_window_focus must be TRUE */ { @@ -2826,14 +2927,12 @@ jump_to_mouse(flags, inclusive, which_button) #if defined(FEAT_CMDWIN) && defined(FEAT_CLIPBOARD) /* Continue a modeless selection in another window. */ - if (cmdwin_type != 0 && row < W_WINROW(curwin)) + if (cmdwin_type != 0 && row < curwin->w_winrow) return IN_OTHER_WIN; #endif row -= W_WINROW(curwin); -#ifdef FEAT_VERTSPLIT - col -= W_WINCOL(curwin); -#endif + col -= curwin->w_wincol; /* * When clicking beyond the end of the window, scroll the screen. @@ -2854,7 +2953,7 @@ jump_to_mouse(flags, inclusive, which_button) break; first = FALSE; #ifdef FEAT_FOLDING - hasFolding(curwin->w_topline, &curwin->w_topline, NULL); + (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif #ifdef FEAT_DIFF if (curwin->w_topfill < diff_check(curwin, curwin->w_topline)) @@ -2933,7 +3032,7 @@ jump_to_mouse(flags, inclusive, which_button) /* Check for position outside of the fold column. */ if ( # ifdef FEAT_RIGHTLEFT - curwin->w_p_rl ? col < W_WIDTH(curwin) - curwin->w_p_fdc : + curwin->w_p_rl ? col < curwin->w_width - curwin->w_p_fdc : # endif col >= curwin->w_p_fdc # ifdef FEAT_CMDWIN @@ -2993,11 +3092,11 @@ jump_to_mouse(flags, inclusive, which_button) * Returns TRUE if the position is below the last line. */ int -mouse_comp_pos(win, rowp, colp, lnump) - win_T *win; - int *rowp; - int *colp; - linenr_T *lnump; +mouse_comp_pos( + win_T *win, + int *rowp, + int *colp, + linenr_T *lnump) { int col = *colp; int row = *rowp; @@ -3008,7 +3107,7 @@ mouse_comp_pos(win, rowp, colp, lnump) #ifdef FEAT_RIGHTLEFT if (win->w_p_rl) - col = W_WIDTH(win) - 1 - col; + col = win->w_width - 1 - col; #endif lnum = win->w_topline; @@ -3052,7 +3151,7 @@ mouse_comp_pos(win, rowp, colp, lnump) off = win_col_off(win) - win_col_off2(win); if (col < off) col = off; - col += row * (W_WIDTH(win) - off); + col += row * (win->w_width - off); /* add skip column (for long wrapping line) */ col += win->w_skipcol; } @@ -3076,17 +3175,16 @@ mouse_comp_pos(win, rowp, colp, lnump) return retval; } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Find the window at screen position "*rowp" and "*colp". The positions are * updated to become relative to the top-left of the window. + * Returns NULL when something is wrong. */ win_T * -mouse_find_win(rowp, colp) - int *rowp; - int *colp UNUSED; +mouse_find_win(int *rowp, int *colp UNUSED) { frame_T *fp; + win_T *wp; fp = topframe; *rowp -= firstwin->w_winrow; @@ -3094,7 +3192,6 @@ mouse_find_win(rowp, colp) { if (fp->fr_layout == FR_LEAF) break; -#ifdef FEAT_VERTSPLIT if (fp->fr_layout == FR_ROW) { for (fp = fp->fr_child; fp->fr_next != NULL; fp = fp->fr_next) @@ -3104,7 +3201,6 @@ mouse_find_win(rowp, colp) *colp -= fp->fr_width; } } -#endif else /* fr_layout == FR_COL */ { for (fp = fp->fr_child; fp->fr_next != NULL; fp = fp->fr_next) @@ -3115,20 +3211,29 @@ mouse_find_win(rowp, colp) } } } - return fp->fr_win; -} + /* When using a timer that closes a window the window might not actually + * exist. */ + FOR_ALL_WINDOWS(wp) + if (wp == fp->fr_win) + { +#ifdef FEAT_MENU + *rowp -= wp->w_winbar_height; #endif + return wp; + } + return NULL; +} #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_PHOTON) || defined(PROTO) \ - || defined(FEAT_GUI_MACVIM) + || defined(FEAT_GUI_PHOTON) || defined(FEAT_TERM_POPUP_MENU) \ + || defined(FEAT_GUI_MACVIM) \ + || defined(PROTO) /* * Translate window coordinates to buffer position without any side effects */ int -get_fpos_of_mouse(mpos) - pos_T *mpos; +get_fpos_of_mouse(pos_T *mpos) { win_T *wp; int row = mouse_row; @@ -3137,21 +3242,17 @@ get_fpos_of_mouse(mpos) if (row < 0 || col < 0) /* check if it makes sense */ return IN_UNKNOWN; -#ifdef FEAT_WINDOWS /* find the window where the row is in */ wp = mouse_find_win(&row, &col); -#else - wp = firstwin; -#endif + if (wp == NULL) + return IN_UNKNOWN; /* * winpos and height may change in win_enter()! */ if (row >= wp->w_height) /* In (or below) status line */ return IN_STATUS_LINE; -#ifdef FEAT_VERTSPLIT if (col >= wp->w_width) /* In vertical separator line */ return IN_SEP_LINE; -#endif if (wp != curwin) return IN_UNKNOWN; @@ -3169,16 +3270,18 @@ get_fpos_of_mouse(mpos) #endif return IN_BUFFER; } +#endif +#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ + || defined(FEAT_GUI_PHOTON) || defined(FEAT_BEVAL) \ + || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) /* * Convert a virtual (screen) column to a character column. * The first column is one. */ int -vcol2col(wp, lnum, vcol) - win_T *wp; - linenr_T lnum; - int vcol; +vcol2col(win_T *wp, linenr_T lnum, int vcol) { /* try to advance to the specified column */ int count = 0; @@ -3189,7 +3292,7 @@ vcol2col(wp, lnum, vcol) while (count < vcol && *ptr != NUL) { count += win_lbr_chartabsize(wp, line, ptr, count, NULL); - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); } return (int)(ptr - line); } @@ -3203,8 +3306,8 @@ vcol2col(wp, lnum, vcol) * be done in the console (Win32). */ void -ui_focus_change(in_focus) - int in_focus; /* TRUE if focus gained. */ +ui_focus_change( + int in_focus) /* TRUE if focus gained. */ { static time_t last_time = (time_t)0; int need_redraw = FALSE; @@ -3224,13 +3327,11 @@ ui_focus_change(in_focus) last_time = time(NULL); } -#ifdef FEAT_AUTOCMD /* * Fire the focus gained/lost autocommand. */ need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED : EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf); -#endif if (need_redraw) { @@ -3250,13 +3351,10 @@ ui_focus_change(in_focus) setcursor(); } cursor_on(); /* redrawing may have switched it off */ - out_flush(); + out_flush_cursor(FALSE, TRUE); # ifdef FEAT_GUI if (gui.in_use) - { - gui_update_cursor(FALSE, TRUE); gui_update_scrollbars(FALSE); - } # endif } #ifdef FEAT_TITLE @@ -3267,14 +3365,24 @@ ui_focus_change(in_focus) } #endif -#if defined(USE_IM_CONTROL) || defined(PROTO) +#if defined(HAVE_INPUT_METHOD) || defined(PROTO) /* * Save current Input Method status to specified place. */ void -im_save_status(psave) - long *psave; +im_save_status(long *psave) { +# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK) + if (!p_imdisable && KeyTyped && !KeyStuffed && p_imsf[0] != NUL) + { + if (vgetc_im_active) + *psave = B_IMODE_IM; + else if (*psave == B_IMODE_IM) + *psave = B_IMODE_NONE; + return; + } +# endif + /* Don't save when 'imdisable' is set or "xic" is NULL, IM is always * disabled then (but might start later). * Also don't save when inside a mapping, vgetc_im_active has not been set diff --git a/src/undo.c b/src/undo.c index 25ecfed0a1..e073eec84e 100644 --- a/src/undo.c +++ b/src/undo.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -81,39 +81,66 @@ #define UH_MAGIC 0x18dade /* value for uh_magic when in use */ #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ +/* Size of buffer used for encryption. */ +#define CRYPT_BUF_SIZE 8192 + #include "vim.h" -static long get_undolevel __ARGS((void)); -static void u_unch_branch __ARGS((u_header_T *uhp)); -static u_entry_T *u_get_headentry __ARGS((void)); -static void u_getbot __ARGS((void)); -static void u_doit __ARGS((int count)); -static void u_undoredo __ARGS((int undo)); -static void u_undo_end __ARGS((int did_undo, int absolute)); -static void u_add_time __ARGS((char_u *buf, size_t buflen, time_t tt)); -static void u_freeheader __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp)); -static void u_freebranch __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp)); -static void u_freeentries __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp)); -static void u_freeentry __ARGS((u_entry_T *, long)); +/* Structure passed around between functions. + * Avoids passing cryptstate_T when encryption not available. */ +typedef struct { + buf_T *bi_buf; + FILE *bi_fp; +#ifdef FEAT_CRYPT + cryptstate_T *bi_state; + char_u *bi_buffer; /* CRYPT_BUF_SIZE, NULL when not buffering */ + size_t bi_used; /* bytes written to/read from bi_buffer */ + size_t bi_avail; /* bytes available in bi_buffer */ +#endif +} bufinfo_T; + + +static long get_undolevel(void); +static void u_unch_branch(u_header_T *uhp); +static u_entry_T *u_get_headentry(void); +static void u_getbot(void); +static void u_doit(int count); +static void u_undoredo(int undo); +static void u_undo_end(int did_undo, int absolute); +static void u_add_time(char_u *buf, size_t buflen, time_t tt); +static void u_freeheader(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); +static void u_freebranch(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); +static void u_freeentries(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); +static void u_freeentry(u_entry_T *, long); #ifdef FEAT_PERSISTENT_UNDO -static void corruption_error __ARGS((char *mesg, char_u *file_name)); -static void u_free_uhp __ARGS((u_header_T *uhp)); -static size_t fwrite_crypt __ARGS((buf_T *buf UNUSED, char_u *ptr, size_t len, FILE *fp)); -static char_u *read_string_decrypt __ARGS((buf_T *buf UNUSED, FILE *fd, int len)); -static int serialize_header __ARGS((FILE *fp, buf_T *buf, char_u *hash)); -static int serialize_uhp __ARGS((FILE *fp, buf_T *buf, u_header_T *uhp)); -static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name)); -static int serialize_uep __ARGS((FILE *fp, buf_T *buf, u_entry_T *uep)); -static u_entry_T *unserialize_uep __ARGS((FILE *fp, int *error, char_u *file_name)); -static void serialize_pos __ARGS((pos_T pos, FILE *fp)); -static void unserialize_pos __ARGS((pos_T *pos, FILE *fp)); -static void serialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp)); -static void unserialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp)); -static void put_header_ptr __ARGS((FILE *fp, u_header_T *uhp)); +static void corruption_error(char *mesg, char_u *file_name); +static void u_free_uhp(u_header_T *uhp); +static int undo_write(bufinfo_T *bi, char_u *ptr, size_t len); +# ifdef FEAT_CRYPT +static int undo_flush(bufinfo_T *bi); +# endif +static int fwrite_crypt(bufinfo_T *bi, char_u *ptr, size_t len); +static int undo_write_bytes(bufinfo_T *bi, long_u nr, int len); +static void put_header_ptr(bufinfo_T *bi, u_header_T *uhp); +static int undo_read_4c(bufinfo_T *bi); +static int undo_read_2c(bufinfo_T *bi); +static int undo_read_byte(bufinfo_T *bi); +static time_t undo_read_time(bufinfo_T *bi); +static int undo_read(bufinfo_T *bi, char_u *buffer, size_t size); +static char_u *read_string_decrypt(bufinfo_T *bi, int len); +static int serialize_header(bufinfo_T *bi, char_u *hash); +static int serialize_uhp(bufinfo_T *bi, u_header_T *uhp); +static u_header_T *unserialize_uhp(bufinfo_T *bi, char_u *file_name); +static int serialize_uep(bufinfo_T *bi, u_entry_T *uep); +static u_entry_T *unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name); +static void serialize_pos(bufinfo_T *bi, pos_T pos); +static void unserialize_pos(bufinfo_T *bi, pos_T *pos); +static void serialize_visualinfo(bufinfo_T *bi, visualinfo_T *info); +static void unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info); #endif #define U_ALLOC_LINE(size) lalloc((long_u)(size), FALSE) -static char_u *u_save_line __ARGS((linenr_T)); +static char_u *u_save_line(linenr_T); /* used in undo_end() to report number of added and deleted lines */ static long u_newcount, u_oldcount; @@ -221,7 +248,7 @@ u_check(int newhead_may_be_NULL) * Returns OK or FAIL. */ int -u_save_cursor() +u_save_cursor(void) { return (u_save((linenr_T)(curwin->w_cursor.lnum - 1), (linenr_T)(curwin->w_cursor.lnum + 1))); @@ -234,8 +261,7 @@ u_save_cursor() * Returns FAIL when lines could not be saved, OK otherwise. */ int -u_save(top, bot) - linenr_T top, bot; +u_save(linenr_T top, linenr_T bot) { if (undo_off) return OK; @@ -258,8 +284,7 @@ u_save(top, bot) * Returns FAIL when lines could not be saved, OK otherwise. */ int -u_savesub(lnum) - linenr_T lnum; +u_savesub(linenr_T lnum) { if (undo_off) return OK; @@ -274,8 +299,7 @@ u_savesub(lnum) * Returns FAIL when lines could not be saved, OK otherwise. */ int -u_inssub(lnum) - linenr_T lnum; +u_inssub(linenr_T lnum) { if (undo_off) return OK; @@ -291,9 +315,7 @@ u_inssub(lnum) * Returns FAIL when lines could not be saved, OK otherwise. */ int -u_savedel(lnum, nlines) - linenr_T lnum; - long nlines; +u_savedel(linenr_T lnum, long nlines) { if (undo_off) return OK; @@ -307,7 +329,7 @@ u_savedel(lnum, nlines) * return FALSE. */ int -undo_allowed() +undo_allowed(void) { /* Don't allow changes when 'modifiable' is off. */ if (!curbuf->b_p_ma) @@ -340,7 +362,7 @@ undo_allowed() * Get the undolevle value for the current buffer. */ static long -get_undolevel() +get_undolevel(void) { if (curbuf->b_p_ul == NO_LOCAL_UNDOLEVEL) return p_ul; @@ -357,10 +379,11 @@ get_undolevel() * Returns FAIL when lines could not be saved, OK otherwise. */ int -u_savecommon(top, bot, newbot, reload) - linenr_T top, bot; - linenr_T newbot; - int reload; +u_savecommon( + linenr_T top, + linenr_T bot, + linenr_T newbot, + int reload) { linenr_T lnum; long i; @@ -396,8 +419,11 @@ u_savecommon(top, bot, newbot, reload) } } #endif +#ifdef FEAT_TERMINAL + /* A change in a terminal buffer removes the highlighting. */ + term_change_in_curbuf(); +#endif -#ifdef FEAT_AUTOCMD /* * Saving text for undo means we are going to make a change. Give a * warning for a read-only file before making the change, so that the @@ -412,7 +438,6 @@ u_savecommon(top, bot, newbot, reload) EMSG(_("E881: Line count changed unexpectedly")); return FAIL; } -#endif } #ifdef U_DEBUG @@ -511,7 +536,7 @@ u_savecommon(top, bot, newbot, reload) uhp->uh_seq = ++curbuf->b_u_seq_last; curbuf->b_u_seq_cur = uhp->uh_seq; - uhp->uh_time = time(NULL); + uhp->uh_time = vim_time(); uhp->uh_save_nr = 0; curbuf->b_u_time_cur = uhp->uh_time + 1; @@ -618,9 +643,9 @@ u_savecommon(top, bot, newbot, reload) u_getbot(); } -#if !defined(UNIX) && !defined(DJGPP) && !defined(WIN32) && !defined(__EMX__) +#if !defined(UNIX) && !defined(WIN32) /* - * With Amiga and MSDOS 16 bit we can't handle big undo's, because + * With Amiga we can't handle big undo's, because * then u_alloc_line would have to allocate a block larger than 32K */ if (size >= 8000) @@ -724,8 +749,7 @@ static char_u e_not_open[] = N_("E828: Cannot open undo file for writing: %s"); * Compute the hash for the current buffer text into hash[UNDO_HASH_SIZE]. */ void -u_compute_hash(hash) - char_u *hash; +u_compute_hash(char_u *hash) { context_sha256_T ctx; linenr_T lnum; @@ -748,9 +772,7 @@ u_compute_hash(hash) * Returns NULL when there is no place to write or no file to read. */ char_u * -u_get_undo_file_name(buf_ffname, reading) - char_u *buf_ffname; - int reading; +u_get_undo_file_name(char_u *buf_ffname, int reading) { char_u *dirp; char_u dir_name[IOSIZE + 1]; @@ -758,7 +780,7 @@ u_get_undo_file_name(buf_ffname, reading) char_u *undo_file_name = NULL; int dir_len; char_u *p; - struct stat st; + stat_T st; char_u *ffname = buf_ffname; #ifdef HAVE_READLINK char_u fname_buf[MAXPATHL]; @@ -813,7 +835,7 @@ u_get_undo_file_name(buf_ffname, reading) munged_name = vim_strsave(ffname); if (munged_name == NULL) return NULL; - for (p = munged_name; *p != NUL; mb_ptr_adv(p)) + for (p = munged_name; *p != NUL; MB_PTR_ADV(p)) if (vim_ispathsep(*p)) *p = '%'; } @@ -825,8 +847,7 @@ u_get_undo_file_name(buf_ffname, reading) if (undo_file_name != NULL && (!reading || mch_stat((char *)undo_file_name, &st) >= 0)) break; - vim_free(undo_file_name); - undo_file_name = NULL; + VIM_CLEAR(undo_file_name); } vim_free(munged_name); @@ -834,16 +855,13 @@ u_get_undo_file_name(buf_ffname, reading) } static void -corruption_error(mesg, file_name) - char *mesg; - char_u *file_name; +corruption_error(char *mesg, char_u *file_name) { EMSG3(_("E825: Corrupted undo file (%s): %s"), mesg, file_name); } static void -u_free_uhp(uhp) - u_header_T *uhp; +u_free_uhp(u_header_T *uhp) { u_entry_T *nuep; u_entry_T *uep; @@ -859,68 +877,276 @@ u_free_uhp(uhp) } /* - * Like fwrite() but crypt the bytes when 'key' is set. - * Returns 1 if successful. + * Write a sequence of bytes to the undo file. + * Buffers and encrypts as needed. + * Returns OK or FAIL. */ - static size_t -fwrite_crypt(buf, ptr, len, fp) - buf_T *buf UNUSED; - char_u *ptr; - size_t len; - FILE *fp; + static int +undo_write(bufinfo_T *bi, char_u *ptr, size_t len) +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + size_t len_todo = len; + char_u *p = ptr; + + while (bi->bi_used + len_todo >= CRYPT_BUF_SIZE) + { + size_t n = CRYPT_BUF_SIZE - bi->bi_used; + + mch_memmove(bi->bi_buffer + bi->bi_used, p, n); + len_todo -= n; + p += n; + bi->bi_used = CRYPT_BUF_SIZE; + if (undo_flush(bi) == FAIL) + return FAIL; + } + if (len_todo > 0) + { + mch_memmove(bi->bi_buffer + bi->bi_used, p, len_todo); + bi->bi_used += len_todo; + } + return OK; + } +#endif + if (fwrite(ptr, len, (size_t)1, bi->bi_fp) != 1) + return FAIL; + return OK; +} + +#ifdef FEAT_CRYPT + static int +undo_flush(bufinfo_T *bi) +{ + if (bi->bi_buffer != NULL && bi->bi_state != NULL && bi->bi_used > 0) + { + crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used); + if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1) + return FAIL; + bi->bi_used = 0; + } + return OK; +} +#endif + +/* + * Write "ptr[len]" and crypt the bytes when needed. + * Returns OK or FAIL. + */ + static int +fwrite_crypt(bufinfo_T *bi, char_u *ptr, size_t len) { #ifdef FEAT_CRYPT char_u *copy; char_u small_buf[100]; size_t i; - if (*buf->b_p_key == NUL) - return fwrite(ptr, len, (size_t)1, fp); - if (len < 100) - copy = small_buf; /* no malloc()/free() for short strings */ - else + if (bi->bi_state != NULL && bi->bi_buffer == NULL) { - copy = lalloc(len, FALSE); - if (copy == NULL) - return 0; + /* crypting every piece of text separately */ + if (len < 100) + copy = small_buf; /* no malloc()/free() for short strings */ + else + { + copy = lalloc(len, FALSE); + if (copy == NULL) + return 0; + } + crypt_encode(bi->bi_state, ptr, len, copy); + i = fwrite(copy, len, (size_t)1, bi->bi_fp); + if (copy != small_buf) + vim_free(copy); + return i == 1 ? OK : FAIL; } - crypt_encode(ptr, len, copy); - i = fwrite(copy, len, (size_t)1, fp); - if (copy != small_buf) - vim_free(copy); - return i; -#else - return fwrite(ptr, len, (size_t)1, fp); #endif + return undo_write(bi, ptr, len); } /* - * Read a string of length "len" from "fd". - * When 'key' is set decrypt the bytes. + * Write a number, MSB first, in "len" bytes. + * Must match with undo_read_?c() functions. + * Returns OK or FAIL. + */ + static int +undo_write_bytes(bufinfo_T *bi, long_u nr, int len) +{ + char_u buf[8]; + int i; + int bufi = 0; + + for (i = len - 1; i >= 0; --i) + buf[bufi++] = (char_u)(nr >> (i * 8)); + return undo_write(bi, buf, (size_t)len); +} + +/* + * Write the pointer to an undo header. Instead of writing the pointer itself + * we use the sequence number of the header. This is converted back to + * pointers when reading. */ + static void +put_header_ptr(bufinfo_T *bi, u_header_T *uhp) +{ + undo_write_bytes(bi, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4); +} + + static int +undo_read_4c(bufinfo_T *bi) +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[4]; + int n; + + undo_read(bi, buf, (size_t)4); + n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; + return n; + } +#endif + return get4c(bi->bi_fp); +} + + static int +undo_read_2c(bufinfo_T *bi) +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[2]; + int n; + + undo_read(bi, buf, (size_t)2); + n = (buf[0] << 8) + buf[1]; + return n; + } +#endif + return get2c(bi->bi_fp); +} + + static int +undo_read_byte(bufinfo_T *bi) +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[1]; + + undo_read(bi, buf, (size_t)1); + return buf[0]; + } +#endif + return getc(bi->bi_fp); +} + + static time_t +undo_read_time(bufinfo_T *bi) +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[8]; + time_t n = 0; + int i; + + undo_read(bi, buf, (size_t)8); + for (i = 0; i < 8; ++i) + n = (n << 8) + buf[i]; + return n; + } +#endif + return get8ctime(bi->bi_fp); +} + +/* + * Read "buffer[size]" from the undo file. + * Return OK or FAIL. + */ + static int +undo_read(bufinfo_T *bi, char_u *buffer, size_t size) +{ + int retval = OK; + +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + int size_todo = (int)size; + char_u *p = buffer; + + while (size_todo > 0) + { + size_t n; + + if (bi->bi_used >= bi->bi_avail) + { + n = fread(bi->bi_buffer, 1, (size_t)CRYPT_BUF_SIZE, bi->bi_fp); + if (n == 0) + { + retval = FAIL; + break; + } + bi->bi_avail = n; + bi->bi_used = 0; + crypt_decode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_avail); + } + n = size_todo; + if (n > bi->bi_avail - bi->bi_used) + n = bi->bi_avail - bi->bi_used; + mch_memmove(p, bi->bi_buffer + bi->bi_used, n); + bi->bi_used += n; + size_todo -= (int)n; + p += n; + } + } + else +#endif + if (fread(buffer, (size_t)size, 1, bi->bi_fp) != 1) + retval = FAIL; + + if (retval == FAIL) + /* Error may be checked for only later. Fill with zeros, + * so that the reader won't use garbage. */ + vim_memset(buffer, 0, size); + return retval; +} + +/* + * Read a string of length "len" from "bi->bi_fd". + * "len" can be zero to allocate an empty line. + * Decrypt the bytes if needed. + * Append a NUL. + * Returns a pointer to allocated memory or NULL for failure. */ static char_u * -read_string_decrypt(buf, fd, len) - buf_T *buf UNUSED; - FILE *fd; - int len; +read_string_decrypt(bufinfo_T *bi, int len) { - char_u *ptr; + char_u *ptr = alloc((unsigned)len + 1); - ptr = read_string(fd, len); + if (ptr != NULL) + { + if (len > 0 && undo_read(bi, ptr, len) == FAIL) + { + vim_free(ptr); + return NULL; + } + ptr[len] = NUL; #ifdef FEAT_CRYPT - if (ptr != NULL && *buf->b_p_key != NUL) - crypt_decode(ptr, len); + if (bi->bi_state != NULL && bi->bi_buffer == NULL) + crypt_decode_inplace(bi->bi_state, ptr, len); #endif + } return ptr; } +/* + * Writes the (not encrypted) header and initializes encryption if needed. + */ static int -serialize_header(fp, buf, hash) - FILE *fp; - buf_T *buf; - char_u *hash; +serialize_header(bufinfo_T *bi, char_u *hash) { - int len; + int len; + buf_T *buf = bi->bi_buf; + FILE *fp = bi->bi_fp; + char_u time_buf[8]; /* Start writing, first the magic marker and undo info version. */ if (fwrite(UF_START_MAGIC, (size_t)UF_START_MAGIC_LEN, (size_t)1, fp) != 1) @@ -934,109 +1160,121 @@ serialize_header(fp, buf, hash) char_u *header; int header_len; - put_bytes(fp, (long_u)UF_VERSION_CRYPT, 2); - header = prepare_crypt_write(buf, &header_len); - if (header == NULL) + undo_write_bytes(bi, (long_u)UF_VERSION_CRYPT, 2); + bi->bi_state = crypt_create_for_writing(crypt_get_method_nr(buf), + buf->b_p_key, &header, &header_len); + if (bi->bi_state == NULL) return FAIL; len = (int)fwrite(header, (size_t)header_len, (size_t)1, fp); vim_free(header); if (len != 1) { - crypt_pop_state(); + crypt_free_state(bi->bi_state); + bi->bi_state = NULL; return FAIL; } + + if (crypt_whole_undofile(crypt_get_method_nr(buf))) + { + bi->bi_buffer = alloc(CRYPT_BUF_SIZE); + if (bi->bi_buffer == NULL) + { + crypt_free_state(bi->bi_state); + bi->bi_state = NULL; + return FAIL; + } + bi->bi_used = 0; + } } else #endif - put_bytes(fp, (long_u)UF_VERSION, 2); + undo_write_bytes(bi, (long_u)UF_VERSION, 2); /* Write a hash of the buffer text, so that we can verify it is still the * same when reading the buffer text. */ - if (fwrite(hash, (size_t)UNDO_HASH_SIZE, (size_t)1, fp) != 1) + if (undo_write(bi, hash, (size_t)UNDO_HASH_SIZE) == FAIL) return FAIL; /* buffer-specific data */ - put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4); + undo_write_bytes(bi, (long_u)buf->b_ml.ml_line_count, 4); len = buf->b_u_line_ptr != NULL ? (int)STRLEN(buf->b_u_line_ptr) : 0; - put_bytes(fp, (long_u)len, 4); - if (len > 0 && fwrite_crypt(buf, buf->b_u_line_ptr, (size_t)len, fp) != 1) + undo_write_bytes(bi, (long_u)len, 4); + if (len > 0 && fwrite_crypt(bi, buf->b_u_line_ptr, (size_t)len) == FAIL) return FAIL; - put_bytes(fp, (long_u)buf->b_u_line_lnum, 4); - put_bytes(fp, (long_u)buf->b_u_line_colnr, 4); + undo_write_bytes(bi, (long_u)buf->b_u_line_lnum, 4); + undo_write_bytes(bi, (long_u)buf->b_u_line_colnr, 4); /* Undo structures header data */ - put_header_ptr(fp, buf->b_u_oldhead); - put_header_ptr(fp, buf->b_u_newhead); - put_header_ptr(fp, buf->b_u_curhead); + put_header_ptr(bi, buf->b_u_oldhead); + put_header_ptr(bi, buf->b_u_newhead); + put_header_ptr(bi, buf->b_u_curhead); - put_bytes(fp, (long_u)buf->b_u_numhead, 4); - put_bytes(fp, (long_u)buf->b_u_seq_last, 4); - put_bytes(fp, (long_u)buf->b_u_seq_cur, 4); - put_time(fp, buf->b_u_time_cur); + undo_write_bytes(bi, (long_u)buf->b_u_numhead, 4); + undo_write_bytes(bi, (long_u)buf->b_u_seq_last, 4); + undo_write_bytes(bi, (long_u)buf->b_u_seq_cur, 4); + time_to_bytes(buf->b_u_time_cur, time_buf); + undo_write(bi, time_buf, 8); /* Optional fields. */ - putc(4, fp); - putc(UF_LAST_SAVE_NR, fp); - put_bytes(fp, (long_u)buf->b_u_save_nr_last, 4); + undo_write_bytes(bi, 4, 1); + undo_write_bytes(bi, UF_LAST_SAVE_NR, 1); + undo_write_bytes(bi, (long_u)buf->b_u_save_nr_last, 4); - putc(0, fp); /* end marker */ + undo_write_bytes(bi, 0, 1); /* end marker */ return OK; } static int -serialize_uhp(fp, buf, uhp) - FILE *fp; - buf_T *buf; - u_header_T *uhp; +serialize_uhp(bufinfo_T *bi, u_header_T *uhp) { int i; u_entry_T *uep; + char_u time_buf[8]; - if (put_bytes(fp, (long_u)UF_HEADER_MAGIC, 2) == FAIL) + if (undo_write_bytes(bi, (long_u)UF_HEADER_MAGIC, 2) == FAIL) return FAIL; - put_header_ptr(fp, uhp->uh_next.ptr); - put_header_ptr(fp, uhp->uh_prev.ptr); - put_header_ptr(fp, uhp->uh_alt_next.ptr); - put_header_ptr(fp, uhp->uh_alt_prev.ptr); - put_bytes(fp, uhp->uh_seq, 4); - serialize_pos(uhp->uh_cursor, fp); + put_header_ptr(bi, uhp->uh_next.ptr); + put_header_ptr(bi, uhp->uh_prev.ptr); + put_header_ptr(bi, uhp->uh_alt_next.ptr); + put_header_ptr(bi, uhp->uh_alt_prev.ptr); + undo_write_bytes(bi, uhp->uh_seq, 4); + serialize_pos(bi, uhp->uh_cursor); #ifdef FEAT_VIRTUALEDIT - put_bytes(fp, (long_u)uhp->uh_cursor_vcol, 4); + undo_write_bytes(bi, (long_u)uhp->uh_cursor_vcol, 4); #else - put_bytes(fp, (long_u)0, 4); + undo_write_bytes(bi, (long_u)0, 4); #endif - put_bytes(fp, (long_u)uhp->uh_flags, 2); + undo_write_bytes(bi, (long_u)uhp->uh_flags, 2); /* Assume NMARKS will stay the same. */ for (i = 0; i < NMARKS; ++i) - serialize_pos(uhp->uh_namedm[i], fp); - serialize_visualinfo(&uhp->uh_visual, fp); - put_time(fp, uhp->uh_time); + serialize_pos(bi, uhp->uh_namedm[i]); + serialize_visualinfo(bi, &uhp->uh_visual); + time_to_bytes(uhp->uh_time, time_buf); + undo_write(bi, time_buf, 8); /* Optional fields. */ - putc(4, fp); - putc(UHP_SAVE_NR, fp); - put_bytes(fp, (long_u)uhp->uh_save_nr, 4); + undo_write_bytes(bi, 4, 1); + undo_write_bytes(bi, UHP_SAVE_NR, 1); + undo_write_bytes(bi, (long_u)uhp->uh_save_nr, 4); - putc(0, fp); /* end marker */ + undo_write_bytes(bi, 0, 1); /* end marker */ /* Write all the entries. */ for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next) { - put_bytes(fp, (long_u)UF_ENTRY_MAGIC, 2); - if (serialize_uep(fp, buf, uep) == FAIL) + undo_write_bytes(bi, (long_u)UF_ENTRY_MAGIC, 2); + if (serialize_uep(bi, uep) == FAIL) return FAIL; } - put_bytes(fp, (long_u)UF_ENTRY_END_MAGIC, 2); + undo_write_bytes(bi, (long_u)UF_ENTRY_END_MAGIC, 2); return OK; } static u_header_T * -unserialize_uhp(fp, file_name) - FILE *fp; - char_u *file_name; +unserialize_uhp(bufinfo_T *bi, char_u *file_name) { u_header_T *uhp; int i; @@ -1051,56 +1289,56 @@ unserialize_uhp(fp, file_name) #ifdef U_DEBUG uhp->uh_magic = UH_MAGIC; #endif - uhp->uh_next.seq = get4c(fp); - uhp->uh_prev.seq = get4c(fp); - uhp->uh_alt_next.seq = get4c(fp); - uhp->uh_alt_prev.seq = get4c(fp); - uhp->uh_seq = get4c(fp); + uhp->uh_next.seq = undo_read_4c(bi); + uhp->uh_prev.seq = undo_read_4c(bi); + uhp->uh_alt_next.seq = undo_read_4c(bi); + uhp->uh_alt_prev.seq = undo_read_4c(bi); + uhp->uh_seq = undo_read_4c(bi); if (uhp->uh_seq <= 0) { corruption_error("uh_seq", file_name); vim_free(uhp); return NULL; } - unserialize_pos(&uhp->uh_cursor, fp); + unserialize_pos(bi, &uhp->uh_cursor); #ifdef FEAT_VIRTUALEDIT - uhp->uh_cursor_vcol = get4c(fp); + uhp->uh_cursor_vcol = undo_read_4c(bi); #else - (void)get4c(fp); + (void)undo_read_4c(bi); #endif - uhp->uh_flags = get2c(fp); + uhp->uh_flags = undo_read_2c(bi); for (i = 0; i < NMARKS; ++i) - unserialize_pos(&uhp->uh_namedm[i], fp); - unserialize_visualinfo(&uhp->uh_visual, fp); - uhp->uh_time = get8ctime(fp); + unserialize_pos(bi, &uhp->uh_namedm[i]); + unserialize_visualinfo(bi, &uhp->uh_visual); + uhp->uh_time = undo_read_time(bi); /* Optional fields. */ for (;;) { - int len = getc(fp); + int len = undo_read_byte(bi); int what; if (len == 0) break; - what = getc(fp); + what = undo_read_byte(bi); switch (what) { case UHP_SAVE_NR: - uhp->uh_save_nr = get4c(fp); + uhp->uh_save_nr = undo_read_4c(bi); break; default: /* field not supported, skip */ while (--len >= 0) - (void)getc(fp); + (void)undo_read_byte(bi); } } /* Unserialize the uep list. */ last_uep = NULL; - while ((c = get2c(fp)) == UF_ENTRY_MAGIC) + while ((c = undo_read_2c(bi)) == UF_ENTRY_MAGIC) { error = FALSE; - uep = unserialize_uep(fp, &error, file_name); + uep = unserialize_uep(bi, &error, file_name); if (last_uep == NULL) uhp->uh_entry = uep; else @@ -1123,41 +1361,37 @@ unserialize_uhp(fp, file_name) } /* - * Serialize "uep" to "fp". + * Serialize "uep". */ static int -serialize_uep(fp, buf, uep) - FILE *fp; - buf_T *buf; - u_entry_T *uep; +serialize_uep( + bufinfo_T *bi, + u_entry_T *uep) { int i; size_t len; - put_bytes(fp, (long_u)uep->ue_top, 4); - put_bytes(fp, (long_u)uep->ue_bot, 4); - put_bytes(fp, (long_u)uep->ue_lcount, 4); - put_bytes(fp, (long_u)uep->ue_size, 4); + undo_write_bytes(bi, (long_u)uep->ue_top, 4); + undo_write_bytes(bi, (long_u)uep->ue_bot, 4); + undo_write_bytes(bi, (long_u)uep->ue_lcount, 4); + undo_write_bytes(bi, (long_u)uep->ue_size, 4); for (i = 0; i < uep->ue_size; ++i) { len = STRLEN(uep->ue_array[i]); - if (put_bytes(fp, (long_u)len, 4) == FAIL) + if (undo_write_bytes(bi, (long_u)len, 4) == FAIL) return FAIL; - if (len > 0 && fwrite_crypt(buf, uep->ue_array[i], len, fp) != 1) + if (len > 0 && fwrite_crypt(bi, uep->ue_array[i], len) == FAIL) return FAIL; } return OK; } static u_entry_T * -unserialize_uep(fp, error, file_name) - FILE *fp; - int *error; - char_u *file_name; +unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name) { int i; u_entry_T *uep; - char_u **array; + char_u **array = NULL; char_u *line; int line_len; @@ -1168,13 +1402,14 @@ unserialize_uep(fp, error, file_name) #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif - uep->ue_top = get4c(fp); - uep->ue_bot = get4c(fp); - uep->ue_lcount = get4c(fp); - uep->ue_size = get4c(fp); + uep->ue_top = undo_read_4c(bi); + uep->ue_bot = undo_read_4c(bi); + uep->ue_lcount = undo_read_4c(bi); + uep->ue_size = undo_read_4c(bi); if (uep->ue_size > 0) { - array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size); + if (uep->ue_size < LONG_MAX / (int)sizeof(char_u *)) + array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size); if (array == NULL) { *error = TRUE; @@ -1182,15 +1417,13 @@ unserialize_uep(fp, error, file_name) } vim_memset(array, 0, sizeof(char_u *) * uep->ue_size); } - else - array = NULL; uep->ue_array = array; for (i = 0; i < uep->ue_size; ++i) { - line_len = get4c(fp); + line_len = undo_read_4c(bi); if (line_len >= 0) - line = read_string_decrypt(curbuf, fp, line_len); + line = read_string_decrypt(bi, line_len); else { line = NULL; @@ -1207,83 +1440,63 @@ unserialize_uep(fp, error, file_name) } /* - * Serialize "pos" to "fp". + * Serialize "pos". */ static void -serialize_pos(pos, fp) - pos_T pos; - FILE *fp; +serialize_pos(bufinfo_T *bi, pos_T pos) { - put_bytes(fp, (long_u)pos.lnum, 4); - put_bytes(fp, (long_u)pos.col, 4); + undo_write_bytes(bi, (long_u)pos.lnum, 4); + undo_write_bytes(bi, (long_u)pos.col, 4); #ifdef FEAT_VIRTUALEDIT - put_bytes(fp, (long_u)pos.coladd, 4); + undo_write_bytes(bi, (long_u)pos.coladd, 4); #else - put_bytes(fp, (long_u)0, 4); + undo_write_bytes(bi, (long_u)0, 4); #endif } /* - * Unserialize the pos_T at the current position in fp. + * Unserialize the pos_T at the current position. */ static void -unserialize_pos(pos, fp) - pos_T *pos; - FILE *fp; +unserialize_pos(bufinfo_T *bi, pos_T *pos) { - pos->lnum = get4c(fp); + pos->lnum = undo_read_4c(bi); if (pos->lnum < 0) pos->lnum = 0; - pos->col = get4c(fp); + pos->col = undo_read_4c(bi); if (pos->col < 0) pos->col = 0; #ifdef FEAT_VIRTUALEDIT - pos->coladd = get4c(fp); + pos->coladd = undo_read_4c(bi); if (pos->coladd < 0) pos->coladd = 0; #else - (void)get4c(fp); + (void)undo_read_4c(bi); #endif } /* - * Serialize "info" to "fp". + * Serialize "info". */ static void -serialize_visualinfo(info, fp) - visualinfo_T *info; - FILE *fp; +serialize_visualinfo(bufinfo_T *bi, visualinfo_T *info) { - serialize_pos(info->vi_start, fp); - serialize_pos(info->vi_end, fp); - put_bytes(fp, (long_u)info->vi_mode, 4); - put_bytes(fp, (long_u)info->vi_curswant, 4); + serialize_pos(bi, info->vi_start); + serialize_pos(bi, info->vi_end); + undo_write_bytes(bi, (long_u)info->vi_mode, 4); + undo_write_bytes(bi, (long_u)info->vi_curswant, 4); } /* - * Unserialize the visualinfo_T at the current position in fp. + * Unserialize the visualinfo_T at the current position. */ static void -unserialize_visualinfo(info, fp) - visualinfo_T *info; - FILE *fp; +unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info) { - unserialize_pos(&info->vi_start, fp); - unserialize_pos(&info->vi_end, fp); - info->vi_mode = get4c(fp); - info->vi_curswant = get4c(fp); -} - -/* - * Write the pointer to an undo header. Instead of writing the pointer itself - * we use the sequence number of the header. This is converted back to - * pointers when reading. */ - static void -put_header_ptr(fp, uhp) - FILE *fp; - u_header_T *uhp; -{ - put_bytes(fp, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4); + unserialize_pos(bi, &info->vi_start); + unserialize_pos(bi, &info->vi_end); + info->vi_mode = undo_read_4c(bi); + info->vi_curswant = undo_read_4c(bi); } /* @@ -1296,11 +1509,11 @@ put_header_ptr(fp, uhp) * "hash[UNDO_HASH_SIZE]" must be the hash value of the buffer text. */ void -u_write_undo(name, forceit, buf, hash) - char_u *name; - int forceit; - buf_T *buf; - char_u *hash; +u_write_undo( + char_u *name, + int forceit, + buf_T *buf, + char_u *hash) { u_header_T *uhp; char_u *file_name; @@ -1314,12 +1527,12 @@ u_write_undo(name, forceit, buf, hash) int write_ok = FALSE; #ifdef UNIX int st_old_valid = FALSE; - struct stat st_old; - struct stat st_new; -#endif -#ifdef FEAT_CRYPT - int do_crypt = FALSE; + stat_T st_old; + stat_T st_new; #endif + bufinfo_T bi; + + vim_memset(&bi, 0, sizeof(bi)); if (name == NULL) { @@ -1360,8 +1573,8 @@ u_write_undo(name, forceit, buf, hash) #endif } - /* strip any s-bit */ - perm = perm & 0777; + /* strip any s-bit and executable bit */ + perm = perm & 0666; /* If the undo file already exists, verify that it actually is an undo * file, and delete it. */ @@ -1474,14 +1687,12 @@ u_write_undo(name, forceit, buf, hash) u_sync(TRUE); /* - * Write the header. + * Write the header. Initializes encryption, if enabled. */ - if (serialize_header(fp, buf, hash) == FAIL) + bi.bi_buf = buf; + bi.bi_fp = fp; + if (serialize_header(&bi, hash) == FAIL) goto write_error; -#ifdef FEAT_CRYPT - if (*buf->b_p_key != NUL) - do_crypt = TRUE; -#endif /* * Iteratively serialize UHPs and their UEPs from the top down. @@ -1497,7 +1708,7 @@ u_write_undo(name, forceit, buf, hash) #ifdef U_DEBUG ++headers_written; #endif - if (serialize_uhp(fp, buf, uhp) == FAIL) + if (serialize_uhp(&bi, uhp) == FAIL) goto write_error; } @@ -1516,7 +1727,7 @@ u_write_undo(name, forceit, buf, hash) uhp = uhp->uh_next.ptr; } - if (put_bytes(fp, (long_u)UF_HEADER_END_MAGIC, 2) == OK) + if (undo_write_bytes(&bi, (long_u)UF_HEADER_END_MAGIC, 2) == OK) write_ok = TRUE; #ifdef U_DEBUG if (headers_written != buf->b_u_numhead) @@ -1526,12 +1737,17 @@ u_write_undo(name, forceit, buf, hash) } #endif +#ifdef FEAT_CRYPT + if (bi.bi_state != NULL && undo_flush(&bi) == FAIL) + write_ok = FALSE; +#endif + write_error: fclose(fp); if (!write_ok) EMSG2(_("E829: write error in undo file: %s"), file_name); -#if defined(MACOS_CLASSIC) || defined(WIN3264) +#if defined(WIN3264) /* Copy file attributes; for systems where this can only be done after * closing the file. */ if (buf->b_ffname != NULL) @@ -1551,8 +1767,9 @@ u_write_undo(name, forceit, buf, hash) theend: #ifdef FEAT_CRYPT - if (do_crypt) - crypt_pop_state(); + if (bi.bi_state != NULL) + crypt_free_state(bi.bi_state); + vim_free(bi.bi_buffer); #endif if (file_name != name) vim_free(file_name); @@ -1566,10 +1783,7 @@ u_write_undo(name, forceit, buf, hash) * "hash[UNDO_HASH_SIZE]" must be the hash value of the buffer text. */ void -u_read_undo(name, hash, orig_name) - char_u *name; - char_u *hash; - char_u *orig_name; +u_read_undo(char_u *name, char_u *hash, char_u *orig_name) { char_u *file_name; FILE *fp; @@ -1578,7 +1792,7 @@ u_read_undo(name, hash, orig_name) linenr_T line_lnum; colnr_T line_colnr; linenr_T line_count; - int num_head = 0; + long num_head = 0; long old_header_seq, new_header_seq, cur_header_seq; long seq_last, seq_cur; long last_save_nr = 0; @@ -1595,13 +1809,12 @@ u_read_undo(name, hash, orig_name) int *uhp_table_used; #endif #ifdef UNIX - struct stat st_orig; - struct stat st_undo; -#endif -#ifdef FEAT_CRYPT - int do_decrypt = FALSE; + stat_T st_orig; + stat_T st_undo; #endif + bufinfo_T bi; + vim_memset(&bi, 0, sizeof(bi)); if (name == NULL) { file_name = u_get_undo_file_name(curbuf->b_ffname, TRUE); @@ -1644,6 +1857,8 @@ u_read_undo(name, hash, orig_name) EMSG2(_("E822: Cannot open undo file for reading: %s"), file_name); goto error; } + bi.bi_buf = curbuf; + bi.bi_fp = fp; /* * Read the undo file header. @@ -1664,12 +1879,24 @@ u_read_undo(name, hash, orig_name) file_name); goto error; } - if (prepare_crypt_read(fp) == FAIL) + bi.bi_state = crypt_create_from_file(fp, curbuf->b_p_key); + if (bi.bi_state == NULL) { EMSG2(_("E826: Undo file decryption failed: %s"), file_name); goto error; } - do_decrypt = TRUE; + if (crypt_whole_undofile(bi.bi_state->method_nr)) + { + bi.bi_buffer = alloc(CRYPT_BUF_SIZE); + if (bi.bi_buffer == NULL) + { + crypt_free_state(bi.bi_state); + bi.bi_state = NULL; + goto error; + } + bi.bi_avail = 0; + bi.bi_used = 0; + } #else EMSG2(_("E827: Undo file is encrypted: %s"), file_name); goto error; @@ -1681,12 +1908,12 @@ u_read_undo(name, hash, orig_name) goto error; } - if (fread(read_hash, UNDO_HASH_SIZE, 1, fp) != 1) + if (undo_read(&bi, read_hash, (size_t)UNDO_HASH_SIZE) == FAIL) { corruption_error("hash", file_name); goto error; } - line_count = (linenr_T)get4c(fp); + line_count = (linenr_T)undo_read_4c(&bi); if (memcmp(hash, read_hash, UNDO_HASH_SIZE) != 0 || line_count != curbuf->b_ml.ml_line_count) { @@ -1703,13 +1930,13 @@ u_read_undo(name, hash, orig_name) } /* Read undo data for "U" command. */ - str_len = get4c(fp); + str_len = undo_read_4c(&bi); if (str_len < 0) goto error; if (str_len > 0) - line_ptr = read_string_decrypt(curbuf, fp, str_len); - line_lnum = (linenr_T)get4c(fp); - line_colnr = (colnr_T)get4c(fp); + line_ptr = read_string_decrypt(&bi, str_len); + line_lnum = (linenr_T)undo_read_4c(&bi); + line_colnr = (colnr_T)undo_read_4c(&bi); if (line_lnum < 0 || line_colnr < 0) { corruption_error("line lnum/col", file_name); @@ -1717,32 +1944,32 @@ u_read_undo(name, hash, orig_name) } /* Begin general undo data */ - old_header_seq = get4c(fp); - new_header_seq = get4c(fp); - cur_header_seq = get4c(fp); - num_head = get4c(fp); - seq_last = get4c(fp); - seq_cur = get4c(fp); - seq_time = get8ctime(fp); + old_header_seq = undo_read_4c(&bi); + new_header_seq = undo_read_4c(&bi); + cur_header_seq = undo_read_4c(&bi); + num_head = undo_read_4c(&bi); + seq_last = undo_read_4c(&bi); + seq_cur = undo_read_4c(&bi); + seq_time = undo_read_time(&bi); /* Optional header fields. */ for (;;) { - int len = getc(fp); + int len = undo_read_byte(&bi); int what; if (len == 0 || len == EOF) break; - what = getc(fp); + what = undo_read_byte(&bi); switch (what) { case UF_LAST_SAVE_NR: - last_save_nr = get4c(fp); + last_save_nr = undo_read_4c(&bi); break; default: /* field not supported, skip */ while (--len >= 0) - (void)getc(fp); + (void)undo_read_byte(&bi); } } @@ -1752,13 +1979,14 @@ u_read_undo(name, hash, orig_name) * When there are no headers uhp_table is NULL. */ if (num_head > 0) { - uhp_table = (u_header_T **)U_ALLOC_LINE( + if (num_head < LONG_MAX / (long)sizeof(u_header_T *)) + uhp_table = (u_header_T **)U_ALLOC_LINE( num_head * sizeof(u_header_T *)); if (uhp_table == NULL) goto error; } - while ((c = get2c(fp)) == UF_HEADER_MAGIC) + while ((c = undo_read_2c(&bi)) == UF_HEADER_MAGIC) { if (num_read_uhps >= num_head) { @@ -1766,7 +1994,7 @@ u_read_undo(name, hash, orig_name) goto error; } - uhp = unserialize_uhp(fp, file_name); + uhp = unserialize_uhp(&bi, file_name); if (uhp == NULL) goto error; uhp_table[num_read_uhps++] = uhp; @@ -1898,8 +2126,9 @@ u_read_undo(name, hash, orig_name) theend: #ifdef FEAT_CRYPT - if (do_decrypt) - crypt_pop_state(); + if (bi.bi_state != NULL) + crypt_free_state(bi.bi_state); + vim_free(bi.bi_buffer); #endif if (fp != NULL) fclose(fp); @@ -1916,8 +2145,7 @@ u_read_undo(name, hash, orig_name) * If 'cpoptions' does not contain 'u': Always undo. */ void -u_undo(count) - int count; +u_undo(int count) { /* * If we get an undo command while executing a macro, we behave like the @@ -1942,8 +2170,7 @@ u_undo(count) * If 'cpoptions' does not contain 'u': Always redo. */ void -u_redo(count) - int count; +u_redo(int count) { if (vim_strchr(p_cpo, CPO_UNDO) == NULL) undo_undoes = FALSE; @@ -1954,8 +2181,7 @@ u_redo(count) * Undo or redo, depending on 'undo_undoes', 'count' times. */ static void -u_doit(startcount) - int startcount; +u_doit(int startcount) { int count = startcount; @@ -2032,18 +2258,18 @@ u_doit(startcount) * "sec" must be FALSE then. */ void -undo_time(step, sec, file, absolute) - long step; - int sec; - int file; - int absolute; +undo_time( + long step, + int sec, + int file, + int absolute) { long target; long closest; long closest_start; long closest_seq = 0; long val; - u_header_T *uhp; + u_header_T *uhp = NULL; u_header_T *last; int mark; int nomark; @@ -2071,10 +2297,8 @@ undo_time(step, sec, file, absolute) } else { - /* When doing computations with time_t subtract starttime, because - * time_t converted to a long may result in a wrong number. */ if (dosec) - target = (long)(curbuf->b_u_time_cur - starttime) + step; + target = (long)(curbuf->b_u_time_cur) + step; else if (dofile) { if (step < 0) @@ -2123,7 +2347,7 @@ undo_time(step, sec, file, absolute) else { if (dosec) - closest = (long)(time(NULL) - starttime + 1); + closest = (long)(vim_time() + 1); else if (dofile) closest = curbuf->b_u_save_nr_last + 2; else @@ -2135,6 +2359,13 @@ undo_time(step, sec, file, absolute) closest_start = closest; closest_seq = curbuf->b_u_seq_cur; + /* When "target" is 0; Back to origin. */ + if (target == 0) + { + mark = lastmark; /* avoid that GCC complains */ + goto target_zero; + } + /* * May do this twice: * 1. Search for "target", update "closest" to the best match found. @@ -2161,7 +2392,7 @@ undo_time(step, sec, file, absolute) { uhp->uh_walk = mark; if (dosec) - val = (long)(uhp->uh_time - starttime); + val = (long)(uhp->uh_time); else if (dofile) val = uhp->uh_save_nr; else @@ -2260,8 +2491,9 @@ undo_time(step, sec, file, absolute) above = TRUE; /* stop above the header */ } +target_zero: /* If we found it: Follow the path to go to where we want to be. */ - if (uhp != NULL) + if (uhp != NULL || target == 0) { /* * First go up the tree as much as needed. @@ -2276,87 +2508,93 @@ undo_time(step, sec, file, absolute) uhp = curbuf->b_u_newhead; else uhp = uhp->uh_next.ptr; - if (uhp == NULL || uhp->uh_walk != mark + if (uhp == NULL || (target > 0 && uhp->uh_walk != mark) || (uhp->uh_seq == target && !above)) break; curbuf->b_u_curhead = uhp; u_undoredo(TRUE); - uhp->uh_walk = nomark; /* don't go back down here */ + if (target > 0) + uhp->uh_walk = nomark; /* don't go back down here */ } - /* - * And now go down the tree (redo), branching off where needed. - */ - while (!got_int) + /* When back to origin, redo is not needed. */ + if (target > 0) { - /* Do the change warning now, for the same reason as above. */ - change_warning(0); + /* + * And now go down the tree (redo), branching off where needed. + */ + while (!got_int) + { + /* Do the change warning now, for the same reason as above. */ + change_warning(0); - uhp = curbuf->b_u_curhead; - if (uhp == NULL) - break; + uhp = curbuf->b_u_curhead; + if (uhp == NULL) + break; - /* Go back to the first branch with a mark. */ - while (uhp->uh_alt_prev.ptr != NULL + /* Go back to the first branch with a mark. */ + while (uhp->uh_alt_prev.ptr != NULL && uhp->uh_alt_prev.ptr->uh_walk == mark) - uhp = uhp->uh_alt_prev.ptr; + uhp = uhp->uh_alt_prev.ptr; - /* Find the last branch with a mark, that's the one. */ - last = uhp; - while (last->uh_alt_next.ptr != NULL + /* Find the last branch with a mark, that's the one. */ + last = uhp; + while (last->uh_alt_next.ptr != NULL && last->uh_alt_next.ptr->uh_walk == mark) - last = last->uh_alt_next.ptr; - if (last != uhp) - { - /* Make the used branch the first entry in the list of - * alternatives to make "u" and CTRL-R take this branch. */ - while (uhp->uh_alt_prev.ptr != NULL) - uhp = uhp->uh_alt_prev.ptr; - if (last->uh_alt_next.ptr != NULL) - last->uh_alt_next.ptr->uh_alt_prev.ptr = + last = last->uh_alt_next.ptr; + if (last != uhp) + { + /* Make the used branch the first entry in the list of + * alternatives to make "u" and CTRL-R take this branch. */ + while (uhp->uh_alt_prev.ptr != NULL) + uhp = uhp->uh_alt_prev.ptr; + if (last->uh_alt_next.ptr != NULL) + last->uh_alt_next.ptr->uh_alt_prev.ptr = last->uh_alt_prev.ptr; - last->uh_alt_prev.ptr->uh_alt_next.ptr = last->uh_alt_next.ptr; - last->uh_alt_prev.ptr = NULL; - last->uh_alt_next.ptr = uhp; - uhp->uh_alt_prev.ptr = last; - - if (curbuf->b_u_oldhead == uhp) - curbuf->b_u_oldhead = last; - uhp = last; - if (uhp->uh_next.ptr != NULL) - uhp->uh_next.ptr->uh_prev.ptr = uhp; - } - curbuf->b_u_curhead = uhp; + last->uh_alt_prev.ptr->uh_alt_next.ptr = + last->uh_alt_next.ptr; + last->uh_alt_prev.ptr = NULL; + last->uh_alt_next.ptr = uhp; + uhp->uh_alt_prev.ptr = last; + + if (curbuf->b_u_oldhead == uhp) + curbuf->b_u_oldhead = last; + uhp = last; + if (uhp->uh_next.ptr != NULL) + uhp->uh_next.ptr->uh_prev.ptr = uhp; + } + curbuf->b_u_curhead = uhp; - if (uhp->uh_walk != mark) - break; /* must have reached the target */ + if (uhp->uh_walk != mark) + break; /* must have reached the target */ - /* Stop when going backwards in time and didn't find the exact - * header we were looking for. */ - if (uhp->uh_seq == target && above) - { - curbuf->b_u_seq_cur = target - 1; - break; - } + /* Stop when going backwards in time and didn't find the exact + * header we were looking for. */ + if (uhp->uh_seq == target && above) + { + curbuf->b_u_seq_cur = target - 1; + break; + } - u_undoredo(FALSE); + u_undoredo(FALSE); - /* Advance "curhead" to below the header we last used. If it - * becomes NULL then we need to set "newhead" to this leaf. */ - if (uhp->uh_prev.ptr == NULL) - curbuf->b_u_newhead = uhp; - curbuf->b_u_curhead = uhp->uh_prev.ptr; - did_undo = FALSE; + /* Advance "curhead" to below the header we last used. If it + * becomes NULL then we need to set "newhead" to this leaf. */ + if (uhp->uh_prev.ptr == NULL) + curbuf->b_u_newhead = uhp; + curbuf->b_u_curhead = uhp->uh_prev.ptr; + did_undo = FALSE; - if (uhp->uh_seq == target) /* found it! */ - break; + if (uhp->uh_seq == target) /* found it! */ + break; - uhp = uhp->uh_prev.ptr; - if (uhp == NULL || uhp->uh_walk != mark) - { - /* Need to redo more but can't find it... */ - EMSG2(_(e_intern2), "undo_time()"); - break; + uhp = uhp->uh_prev.ptr; + if (uhp == NULL || uhp->uh_walk != mark) + { + /* Need to redo more but can't find it... */ + internal_error("undo_time()"); + break; + } } } } @@ -2373,8 +2611,7 @@ undo_time(step, sec, file, absolute) * When "undo" is TRUE we go up in the tree, when FALSE we go down. */ static void -u_undoredo(undo) - int undo; +u_undoredo(int undo) { char_u **newarray = NULL; linenr_T oldsize; @@ -2392,11 +2629,9 @@ u_undoredo(undo) int empty_buffer; /* buffer became empty */ u_header_T *curhead = curbuf->b_u_curhead; -#ifdef FEAT_AUTOCMD /* Don't want autocommands using the undo structures here, they are * invalid till the end. */ block_autocmds(); -#endif #ifdef U_DEBUG u_check(FALSE); @@ -2425,10 +2660,8 @@ u_undoredo(undo) if (top > curbuf->b_ml.ml_line_count || top >= bot || bot > curbuf->b_ml.ml_line_count + 1) { -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif - EMSG(_("E438: u_undo: line numbers wrong")); + IEMSG(_("E438: u_undo: line numbers wrong")); changed(); /* don't want UNCHANGED now */ return; } @@ -2560,7 +2793,7 @@ u_undoredo(undo) curhead->uh_entry = newlist; curhead->uh_flags = new_flags; - if ((old_flags & UH_EMPTYBUF) && bufempty()) + if ((old_flags & UH_EMPTYBUF) && BUFEMPTY()) curbuf->b_ml.ml_flags |= ML_EMPTY; if (old_flags & UH_CHANGED) changed(); @@ -2575,11 +2808,14 @@ u_undoredo(undo) * restore marks from before undo/redo */ for (i = 0; i < NMARKS; ++i) + { if (curhead->uh_namedm[i].lnum != 0) - { curbuf->b_namedm[i] = curhead->uh_namedm[i]; + if (namedm[i].lnum != 0) curhead->uh_namedm[i] = namedm[i]; - } + else + curhead->uh_namedm[i].lnum = 0; + } if (curhead->uh_visual.vi_start.lnum != 0) { curbuf->b_visual = curhead->uh_visual; @@ -2627,9 +2863,14 @@ u_undoredo(undo) /* Remember where we are for "g-" and ":earlier 10s". */ curbuf->b_u_seq_cur = curhead->uh_seq; if (undo) + { /* We are below the previous undo. However, to make ":earlier 1s" * work we compute this as being just above the just undone change. */ - --curbuf->b_u_seq_cur; + if (curhead->uh_next.ptr != NULL) + curbuf->b_u_seq_cur = curhead->uh_next.ptr->uh_seq; + else + curbuf->b_u_seq_cur = 0; + } /* Remember where we are for ":earlier 1f" and ":later 1f". */ if (curhead->uh_save_nr != 0) @@ -2644,9 +2885,7 @@ u_undoredo(undo) * the undone/redone change. */ curbuf->b_u_time_cur = curhead->uh_time; -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif #ifdef U_DEBUG u_check(FALSE); #endif @@ -2658,9 +2897,9 @@ u_undoredo(undo) * in some cases, but it's better than nothing). */ static void -u_undo_end(did_undo, absolute) - int did_undo; /* just did an undo */ - int absolute; /* used ":undo N" */ +u_undo_end( + int did_undo, /* just did an undo */ + int absolute) /* used ":undo N" */ { char *msgstr; u_header_T *uhp; @@ -2741,14 +2980,14 @@ u_undo_end(did_undo, absolute) * u_sync: stop adding to the current entry list */ void -u_sync(force) - int force; /* Also sync when no_u_sync is set. */ +u_sync( + int force) /* Also sync when no_u_sync is set. */ { /* Skip it when already synced or syncing is disabled. */ if (curbuf->b_u_synced || (!force && no_u_sync > 0)) return; #if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) - if (im_is_preediting()) + if (p_imst == IM_ON_THE_SPOT && im_is_preediting()) return; /* XIM is busy, don't break an undo sequence */ #endif if (get_undolevel() < 0) @@ -2764,8 +3003,7 @@ u_sync(force) * ":undolist": List the leafs of the undo tree */ void -ex_undolist(eap) - exarg_T *eap UNUSED; +ex_undolist(exarg_T *eap UNUSED) { garray_T ga; u_header_T *uhp; @@ -2791,7 +3029,7 @@ ex_undolist(eap) { if (ga_grow(&ga, 1) == FAIL) break; - vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7ld ", + vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ", uhp->uh_seq, changes); u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), uhp->uh_time); @@ -2853,7 +3091,7 @@ ex_undolist(eap) msg_start(); msg_puts_attr((char_u *)_("number changes when saved"), - hl_attr(HLF_T)); + HL_ATTR(HLF_T)); for (i = 0; i < ga.ga_len && !got_int; ++i) { msg_putchar('\n'); @@ -2871,18 +3109,15 @@ ex_undolist(eap) * Put the timestamp of an undo header in "buf[buflen]" in a nice format. */ static void -u_add_time(buf, buflen, tt) - char_u *buf; - size_t buflen; - time_t tt; +u_add_time(char_u *buf, size_t buflen, time_t tt) { #ifdef HAVE_STRFTIME struct tm *curtime; - if (time(NULL) - tt >= 100) + if (vim_time() - tt >= 100) { curtime = localtime(&tt); - if (time(NULL) - tt < (60L * 60L * 12L)) + if (vim_time() - tt < (60L * 60L * 12L)) /* within 12 hours */ (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); else @@ -2892,15 +3127,14 @@ u_add_time(buf, buflen, tt) else #endif vim_snprintf((char *)buf, buflen, _("%ld seconds ago"), - (long)(time(NULL) - tt)); + (long)(vim_time() - tt)); } /* * ":undojoin": continue adding to the last entry list */ void -ex_undojoin(eap) - exarg_T *eap UNUSED; +ex_undojoin(exarg_T *eap UNUSED) { if (curbuf->b_u_newhead == NULL) return; /* nothing changed before */ @@ -2914,11 +3148,8 @@ ex_undojoin(eap) if (get_undolevel() < 0) return; /* no entries, nothing to do */ else - { - /* Go back to the last entry */ - curbuf->b_u_curhead = curbuf->b_u_newhead; - curbuf->b_u_synced = FALSE; /* no entries, nothing to do */ - } + /* Append next change to the last entry */ + curbuf->b_u_synced = FALSE; } /* @@ -2926,8 +3157,7 @@ ex_undojoin(eap) * Now an undo means that the buffer is modified. */ void -u_unchanged(buf) - buf_T *buf; +u_unchanged(buf_T *buf) { u_unch_branch(buf->b_u_oldhead); buf->b_did_warn = FALSE; @@ -2938,7 +3168,7 @@ u_unchanged(buf) * line that was changed and set the cursor there. */ void -u_find_first_changed() +u_find_first_changed(void) { u_header_T *uhp = curbuf->b_u_newhead; u_entry_T *uep; @@ -2957,14 +3187,14 @@ u_find_first_changed() if (STRCMP(ml_get_buf(curbuf, lnum, FALSE), uep->ue_array[lnum - 1]) != 0) { - clearpos(&(uhp->uh_cursor)); + CLEAR_POS(&(uhp->uh_cursor)); uhp->uh_cursor.lnum = lnum; return; } if (curbuf->b_ml.ml_line_count != uep->ue_size) { /* lines added or deleted at the end, put the cursor there */ - clearpos(&(uhp->uh_cursor)); + CLEAR_POS(&(uhp->uh_cursor)); uhp->uh_cursor.lnum = lnum; } } @@ -2974,8 +3204,7 @@ u_find_first_changed() * used for "u". */ void -u_update_save_nr(buf) - buf_T *buf; +u_update_save_nr(buf_T *buf) { u_header_T *uhp; @@ -2991,8 +3220,7 @@ u_update_save_nr(buf) } static void -u_unch_branch(uhp) - u_header_T *uhp; +u_unch_branch(u_header_T *uhp) { u_header_T *uh; @@ -3009,11 +3237,11 @@ u_unch_branch(uhp) * If it's not valid, give an error message and return NULL. */ static u_entry_T * -u_get_headentry() +u_get_headentry(void) { if (curbuf->b_u_newhead == NULL || curbuf->b_u_newhead->uh_entry == NULL) { - EMSG(_("E439: undo list corrupt")); + IEMSG(_("E439: undo list corrupt")); return NULL; } return curbuf->b_u_newhead->uh_entry; @@ -3024,7 +3252,7 @@ u_get_headentry() * It is called only when b_u_synced is FALSE. */ static void -u_getbot() +u_getbot(void) { u_entry_T *uep; linenr_T extra; @@ -3045,7 +3273,7 @@ u_getbot() uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra; if (uep->ue_bot < 1 || uep->ue_bot > curbuf->b_ml.ml_line_count) { - EMSG(_("E440: undo line missing")); + IEMSG(_("E440: undo line missing")); uep->ue_bot = uep->ue_top + 1; /* assume all lines deleted, will * get all the old lines back * without deleting the current @@ -3062,10 +3290,10 @@ u_getbot() * Free one header "uhp" and its entry list and adjust the pointers. */ static void -u_freeheader(buf, uhp, uhpp) - buf_T *buf; - u_header_T *uhp; - u_header_T **uhpp; /* if not NULL reset when freeing this header */ +u_freeheader( + buf_T *buf, + u_header_T *uhp, + u_header_T **uhpp) /* if not NULL reset when freeing this header */ { u_header_T *uhap; @@ -3097,10 +3325,10 @@ u_freeheader(buf, uhp, uhpp) * Free an alternate branch and any following alternate branches. */ static void -u_freebranch(buf, uhp, uhpp) - buf_T *buf; - u_header_T *uhp; - u_header_T **uhpp; /* if not NULL reset when freeing this header */ +u_freebranch( + buf_T *buf, + u_header_T *uhp, + u_header_T **uhpp) /* if not NULL reset when freeing this header */ { u_header_T *tofree, *next; @@ -3132,10 +3360,10 @@ u_freebranch(buf, uhp, uhpp) * This means that "uhp" is invalid when returning. */ static void -u_freeentries(buf, uhp, uhpp) - buf_T *buf; - u_header_T *uhp; - u_header_T **uhpp; /* if not NULL reset when freeing this header */ +u_freeentries( + buf_T *buf, + u_header_T *uhp, + u_header_T **uhpp) /* if not NULL reset when freeing this header */ { u_entry_T *uep, *nuep; @@ -3164,9 +3392,7 @@ u_freeentries(buf, uhp, uhpp) * free entry 'uep' and 'n' lines in uep->ue_array[] */ static void -u_freeentry(uep, n) - u_entry_T *uep; - long n; +u_freeentry(u_entry_T *uep, long n) { while (n > 0) vim_free(uep->ue_array[--n]); @@ -3181,8 +3407,7 @@ u_freeentry(uep, n) * invalidate the undo buffer; called when storage has already been released */ void -u_clearall(buf) - buf_T *buf; +u_clearall(buf_T *buf) { buf->b_u_newhead = buf->b_u_oldhead = buf->b_u_curhead = NULL; buf->b_u_synced = TRUE; @@ -3195,8 +3420,7 @@ u_clearall(buf) * save the line "lnum" for the "U" command */ void -u_saveline(lnum) - linenr_T lnum; +u_saveline(linenr_T lnum) { if (lnum == curbuf->b_u_line_lnum) /* line is already saved */ return; @@ -3217,12 +3441,11 @@ u_saveline(lnum) * (this is used externally for crossing a line while in insert mode) */ void -u_clearline() +u_clearline(void) { if (curbuf->b_u_line_ptr != NULL) { - vim_free(curbuf->b_u_line_ptr); - curbuf->b_u_line_ptr = NULL; + VIM_CLEAR(curbuf->b_u_line_ptr); curbuf->b_u_line_lnum = 0; } } @@ -3234,7 +3457,7 @@ u_clearline() * Careful: may trigger autocommands that reload the buffer. */ void -u_undoline() +u_undoline(void) { colnr_T t; char_u *oldp; @@ -3276,8 +3499,7 @@ u_undoline() * Free all allocated memory blocks for the buffer 'buf'. */ void -u_blockfree(buf) - buf_T *buf; +u_blockfree(buf_T *buf) { while (buf->b_u_oldhead != NULL) u_freeheader(buf, buf->b_u_oldhead, NULL); @@ -3289,8 +3511,7 @@ u_blockfree(buf) * Returns NULL when out of memory. */ static char_u * -u_save_line(lnum) - linenr_T lnum; +u_save_line(linenr_T lnum) { return vim_strsave(ml_get(lnum)); } @@ -3299,26 +3520,33 @@ u_save_line(lnum) * Check if the 'modified' flag is set, or 'ff' has changed (only need to * check the first character, because it can only be "dos", "unix" or "mac"). * "nofile" and "scratch" type buffers are considered to always be unchanged. + * Also considers a buffer changed when a terminal window contains a running + * job. */ int -bufIsChanged(buf) - buf_T *buf; +bufIsChanged(buf_T *buf) { - return -#ifdef FEAT_QUICKFIX - !bt_dontwrite(buf) && +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + return TRUE; #endif - (buf->b_changed || file_ff_differs(buf, TRUE)); + return bufIsChangedNotTerm(buf); } +/* + * Like bufIsChanged() but ignoring a terminal window. + */ int -curbufIsChanged() +bufIsChangedNotTerm(buf_T *buf) { - return -#ifdef FEAT_QUICKFIX - !bt_dontwrite(curbuf) && -#endif - (curbuf->b_changed || file_ff_differs(curbuf, TRUE)); + return !bt_dontwrite(buf) + && (buf->b_changed || file_ff_differs(buf, TRUE)); +} + + int +curbufIsChanged(void) +{ + return bufIsChanged(curbuf); } #if defined(FEAT_EVAL) || defined(PROTO) @@ -3327,9 +3555,7 @@ curbufIsChanged() * Recursive. */ void -u_eval_tree(first_uhp, list) - u_header_T *first_uhp; - list_T *list; +u_eval_tree(u_header_T *first_uhp, list_T *list) { u_header_T *uhp = first_uhp; dict_T *dict; diff --git a/src/uninstal.c b/src/uninstal.c index 0532eb9f37..11b6c629ad 100644 --- a/src/uninstal.c +++ b/src/uninstal.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -32,10 +32,8 @@ confirm(void) return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y'); } -#ifdef WIN3264 - static int -reg_delete_key(HKEY hRootKey, const char *key) +reg_delete_key(HKEY hRootKey, const char *key, DWORD flag) { static int did_load = FALSE; static HANDLE advapi_lib = NULL; @@ -52,7 +50,7 @@ reg_delete_key(HKEY hRootKey, const char *key) delete_key_ex = (LONG (WINAPI *)(HKEY, LPCTSTR, REGSAM, DWORD))GetProcAddress(advapi_lib, "RegDeleteKeyExA"); } if (delete_key_ex != NULL) { - return (*delete_key_ex)(hRootKey, key, KEY_WOW64_64KEY, 0); + return (*delete_key_ex)(hRootKey, key, flag, 0); } return RegDeleteKey(hRootKey, key); } @@ -72,7 +70,9 @@ popup_gvim_path(char *buf) /* Open the key where the path to gvim.exe is stored. */ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS) - return 0; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, + KEY_WOW64_32KEY | KEY_READ, &key_handle) != ERROR_SUCCESS) + return 0; /* get the DisplayName out of it to show the user */ r = RegQueryValueEx(key_handle, "path", 0, @@ -111,29 +111,41 @@ openwith_gvim_path(char *buf) remove_popup(void) { int fail = 0; + int i; + int loop = is_64bit_os() ? 2 : 1; + int maxfail = loop * 6; + DWORD flag; HKEY kh; - if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim") != ERROR_SUCCESS) - ++fail; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, - KEY_WOW64_64KEY | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS) - ++fail; - else + for (i = 0; i < loop; i++) { - if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS) + if (i == 0) + flag = KEY_WOW64_32KEY; + else + flag = KEY_WOW64_64KEY; + + if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim", flag) != ERROR_SUCCESS) + ++fail; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, + flag | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS) + ++fail; + else + { + if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS) + ++fail; + RegCloseKey(kh); + } + if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim", flag) != ERROR_SUCCESS) ++fail; - RegCloseKey(kh); } - if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim") != ERROR_SUCCESS) - ++fail; - if (fail == 6) + if (fail == maxfail) printf("No Vim popup registry entries could be removed\n"); else if (fail > 0) printf("Some Vim popup registry entries could not be removed\n"); @@ -145,30 +157,41 @@ remove_popup(void) remove_openwith(void) { int fail = 0; + int i; + int loop = is_64bit_os() ? 2 : 1; + int maxfail = loop * 7; + DWORD flag; + + for (i = 0; i < loop; i++) + { + if (i == 0) + flag = KEY_WOW64_32KEY; + else + flag = KEY_WOW64_64KEY; - if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe") != ERROR_SUCCESS) - ++fail; - if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe") != ERROR_SUCCESS) - ++fail; - - if (fail == 7) + if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS) + ++fail; + if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS) + ++fail; + } + + if (fail == maxfail) printf("No Vim open-with registry entries could be removed\n"); else if (fail > 0) printf("Some Vim open-with registry entries could not be removed\n"); else printf("The Vim open-with registry entries have been removed\n"); } -#endif /* * Check if a batch file is really for the current version. Don't delete a @@ -231,7 +254,6 @@ remove_batfiles(int doit) return found; } -#ifdef WIN3264 static void remove_if_exists(char *path, char *filename) { @@ -284,46 +306,11 @@ remove_start_menu(void) } } } -#endif static void delete_uninstall_key(void) { -#ifdef WIN3264 - reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT); -#else - FILE *fd; - char buf[BUFSIZE]; - - /* - * On DJGPP we delete registry entries by creating a .inf file and - * installing it. - */ - fd = fopen("vim.inf", "w"); - if (fd != NULL) - { - fprintf(fd, "[version]\n"); - fprintf(fd, "signature=\"$CHICAGO$\"\n\n"); - fprintf(fd, "[DefaultInstall]\n"); - fprintf(fd, "DelReg=DeleteMe\n\n"); - fprintf(fd, "[DeleteMe]\n"); - fprintf(fd, "HKLM,\"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT "\"\n"); - fclose(fd); - - /* Don't know how to detect Win NT with DJGPP. Hack: Just try the Win - * 95/98/ME method, since the DJGPP version can't use long filenames - * on Win NT anyway. */ - sprintf(buf, "rundll setupx.dll,InstallHinfSection DefaultInstall 132 %s\\vim.inf", installdir); - run_command(buf); -#if 0 - /* Windows NT method (untested). */ - sprintf(buf, "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %s\\vim.inf", installdir); - run_command(buf); -#endif - - remove("vim.inf"); - } -#endif + reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT, KEY_WOW64_64KEY); } int @@ -331,7 +318,6 @@ main(int argc, char *argv[]) { int found = 0; FILE *fd; -#ifdef WIN3264 int i; struct stat st; char icon[BUFSIZE]; @@ -342,7 +328,6 @@ main(int argc, char *argv[]) if (argc == 2 && stricmp(argv[1], "-nsis") == 0) interactive = FALSE; else -#endif interactive = TRUE; /* Initialize this program. */ @@ -350,7 +335,6 @@ main(int argc, char *argv[]) printf("This program will remove the following items:\n"); -#ifdef WIN3264 if (popup_gvim_path(popup_path)) { printf(" - the \"Edit with Vim\" entry in the popup menu\n"); @@ -404,7 +388,6 @@ main(int argc, char *argv[]) if (!interactive || confirm()) remove_start_menu(); } -#endif printf("\n"); found = remove_batfiles(0); diff --git a/src/userfunc.c b/src/userfunc.c new file mode 100644 index 0000000000..08112689df --- /dev/null +++ b/src/userfunc.c @@ -0,0 +1,3899 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * eval.c: User defined function support + */ + +#include "vim.h" + +#if defined(FEAT_EVAL) || defined(PROTO) +/* function flags */ +#define FC_ABORT 0x01 /* abort function on error */ +#define FC_RANGE 0x02 /* function accepts range */ +#define FC_DICT 0x04 /* Dict function, uses "self" */ +#define FC_CLOSURE 0x08 /* closure, uses outer scope variables */ +#define FC_DELETED 0x10 /* :delfunction used while uf_refcount > 0 */ +#define FC_REMOVED 0x20 /* function redefined while uf_refcount > 0 */ + +/* From user function to hashitem and back. */ +#define UF2HIKEY(fp) ((fp)->uf_name) +#define HIKEY2UF(p) ((ufunc_T *)(p - offsetof(ufunc_T, uf_name))) +#define HI2UF(hi) HIKEY2UF((hi)->hi_key) + +#define FUNCARG(fp, j) ((char_u **)(fp->uf_args.ga_data))[j] +#define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j] + +/* + * All user-defined functions are found in this hashtable. + */ +static hashtab_T func_hashtab; + +/* Used by get_func_tv() */ +static garray_T funcargs = GA_EMPTY; + +/* pointer to funccal for currently active function */ +funccall_T *current_funccal = NULL; + +/* Pointer to list of previously used funccal, still around because some + * item in it is still being used. */ +funccall_T *previous_funccal = NULL; + +static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); +static char *e_funcdict = N_("E717: Dictionary entry already exists"); +static char *e_funcref = N_("E718: Funcref required"); +static char *e_nofunc = N_("E130: Unknown function: %s"); + +#ifdef FEAT_PROFILE +static void func_do_profile(ufunc_T *fp); +static void prof_sort_list(FILE *fd, ufunc_T **sorttab, int st_len, char *title, int prefer_self); +static void prof_func_line(FILE *fd, int count, proftime_T *total, proftime_T *self, int prefer_self); +static int +# ifdef __BORLANDC__ + _RTLENTRYF +# endif + prof_total_cmp(const void *s1, const void *s2); +static int +# ifdef __BORLANDC__ + _RTLENTRYF +# endif + prof_self_cmp(const void *s1, const void *s2); +#endif +static void funccal_unref(funccall_T *fc, ufunc_T *fp, int force); + + void +func_init() +{ + hash_init(&func_hashtab); +} + +/* + * Get function arguments. + */ + static int +get_function_args( + char_u **argp, + char_u endchar, + garray_T *newargs, + int *varargs, + int skip) +{ + int mustend = FALSE; + char_u *arg = *argp; + char_u *p = arg; + int c; + int i; + + if (newargs != NULL) + ga_init2(newargs, (int)sizeof(char_u *), 3); + + if (varargs != NULL) + *varargs = FALSE; + + /* + * Isolate the arguments: "arg1, arg2, ...)" + */ + while (*p != endchar) + { + if (p[0] == '.' && p[1] == '.' && p[2] == '.') + { + if (varargs != NULL) + *varargs = TRUE; + p += 3; + mustend = TRUE; + } + else + { + arg = p; + while (ASCII_ISALNUM(*p) || *p == '_') + ++p; + if (arg == p || isdigit(*arg) + || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0) + || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) + { + if (!skip) + EMSG2(_("E125: Illegal argument: %s"), arg); + break; + } + if (newargs != NULL && ga_grow(newargs, 1) == FAIL) + goto err_ret; + if (newargs != NULL) + { + c = *p; + *p = NUL; + arg = vim_strsave(arg); + if (arg == NULL) + { + *p = c; + goto err_ret; + } + + /* Check for duplicate argument name. */ + for (i = 0; i < newargs->ga_len; ++i) + if (STRCMP(((char_u **)(newargs->ga_data))[i], arg) == 0) + { + EMSG2(_("E853: Duplicate argument name: %s"), arg); + vim_free(arg); + goto err_ret; + } + ((char_u **)(newargs->ga_data))[newargs->ga_len] = arg; + newargs->ga_len++; + + *p = c; + } + if (*p == ',') + ++p; + else + mustend = TRUE; + } + p = skipwhite(p); + if (mustend && *p != endchar) + { + if (!skip) + EMSG2(_(e_invarg2), *argp); + break; + } + } + if (*p != endchar) + goto err_ret; + ++p; /* skip "endchar" */ + + *argp = p; + return OK; + +err_ret: + if (newargs != NULL) + ga_clear_strings(newargs); + return FAIL; +} + +/* + * Register function "fp" as using "current_funccal" as its scope. + */ + static int +register_closure(ufunc_T *fp) +{ + if (fp->uf_scoped == current_funccal) + /* no change */ + return OK; + funccal_unref(fp->uf_scoped, fp, FALSE); + fp->uf_scoped = current_funccal; + current_funccal->fc_refcount++; + + if (ga_grow(¤t_funccal->fc_funcs, 1) == FAIL) + return FAIL; + ((ufunc_T **)current_funccal->fc_funcs.ga_data) + [current_funccal->fc_funcs.ga_len++] = fp; + return OK; +} + +/* + * Parse a lambda expression and get a Funcref from "*arg". + * Return OK or FAIL. Returns NOTDONE for dict or {expr}. + */ + int +get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate) +{ + garray_T newargs; + garray_T newlines; + garray_T *pnewargs; + ufunc_T *fp = NULL; + int varargs; + int ret; + char_u *start = skipwhite(*arg + 1); + char_u *s, *e; + static int lambda_no = 0; + int *old_eval_lavars = eval_lavars_used; + int eval_lavars = FALSE; + + ga_init(&newargs); + ga_init(&newlines); + + /* First, check if this is a lambda expression. "->" must exist. */ + ret = get_function_args(&start, '-', NULL, NULL, TRUE); + if (ret == FAIL || *start != '>') + return NOTDONE; + + /* Parse the arguments again. */ + if (evaluate) + pnewargs = &newargs; + else + pnewargs = NULL; + *arg = skipwhite(*arg + 1); + ret = get_function_args(arg, '-', pnewargs, &varargs, FALSE); + if (ret == FAIL || **arg != '>') + goto errret; + + /* Set up a flag for checking local variables and arguments. */ + if (evaluate) + eval_lavars_used = &eval_lavars; + + /* Get the start and the end of the expression. */ + *arg = skipwhite(*arg + 1); + s = *arg; + ret = skip_expr(arg); + if (ret == FAIL) + goto errret; + e = *arg; + *arg = skipwhite(*arg); + if (**arg != '}') + goto errret; + ++*arg; + + if (evaluate) + { + int len, flags = 0; + char_u *p; + char_u name[20]; + partial_T *pt; + + sprintf((char*)name, "<lambda>%d", ++lambda_no); + + fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); + if (fp == NULL) + goto errret; + pt = (partial_T *)alloc_clear((unsigned)sizeof(partial_T)); + if (pt == NULL) + { + vim_free(fp); + goto errret; + } + + ga_init2(&newlines, (int)sizeof(char_u *), 1); + if (ga_grow(&newlines, 1) == FAIL) + goto errret; + + /* Add "return " before the expression. */ + len = 7 + e - s + 1; + p = (char_u *)alloc(len); + if (p == NULL) + goto errret; + ((char_u **)(newlines.ga_data))[newlines.ga_len++] = p; + STRCPY(p, "return "); + vim_strncpy(p + 7, s, e - s); + + fp->uf_refcount = 1; + STRCPY(fp->uf_name, name); + hash_add(&func_hashtab, UF2HIKEY(fp)); + fp->uf_args = newargs; + fp->uf_lines = newlines; + if (current_funccal != NULL && eval_lavars) + { + flags |= FC_CLOSURE; + if (register_closure(fp) == FAIL) + goto errret; + } + else + fp->uf_scoped = NULL; + +#ifdef FEAT_PROFILE + fp->uf_tml_count = NULL; + fp->uf_tml_total = NULL; + fp->uf_tml_self = NULL; + fp->uf_profiling = FALSE; + if (prof_def_func()) + func_do_profile(fp); +#endif + fp->uf_varargs = TRUE; + fp->uf_flags = flags; + fp->uf_calls = 0; + fp->uf_script_ID = current_SID; + + pt->pt_func = fp; + pt->pt_refcount = 1; + rettv->vval.v_partial = pt; + rettv->v_type = VAR_PARTIAL; + } + + eval_lavars_used = old_eval_lavars; + return OK; + +errret: + ga_clear_strings(&newargs); + ga_clear_strings(&newlines); + vim_free(fp); + eval_lavars_used = old_eval_lavars; + return FAIL; +} + +/* + * Check if "name" is a variable of type VAR_FUNC. If so, return the function + * name it contains, otherwise return "name". + * If "partialp" is not NULL, and "name" is of type VAR_PARTIAL also set + * "partialp". + */ + char_u * +deref_func_name(char_u *name, int *lenp, partial_T **partialp, int no_autoload) +{ + dictitem_T *v; + int cc; + char_u *s; + + if (partialp != NULL) + *partialp = NULL; + + cc = name[*lenp]; + name[*lenp] = NUL; + v = find_var(name, NULL, no_autoload); + name[*lenp] = cc; + if (v != NULL && v->di_tv.v_type == VAR_FUNC) + { + if (v->di_tv.vval.v_string == NULL) + { + *lenp = 0; + return (char_u *)""; /* just in case */ + } + s = v->di_tv.vval.v_string; + *lenp = (int)STRLEN(s); + return s; + } + + if (v != NULL && v->di_tv.v_type == VAR_PARTIAL) + { + partial_T *pt = v->di_tv.vval.v_partial; + + if (pt == NULL) + { + *lenp = 0; + return (char_u *)""; /* just in case */ + } + if (partialp != NULL) + *partialp = pt; + s = partial_name(pt); + *lenp = (int)STRLEN(s); + return s; + } + + return name; +} + +/* + * Give an error message with a function name. Handle <SNR> things. + * "ermsg" is to be passed without translation, use N_() instead of _(). + */ + static void +emsg_funcname(char *ermsg, char_u *name) +{ + char_u *p; + + if (*name == K_SPECIAL) + p = concat_str((char_u *)"<SNR>", name + 3); + else + p = name; + EMSG2(_(ermsg), p); + if (p != name) + vim_free(p); +} + +/* + * Allocate a variable for the result of a function. + * Return OK or FAIL. + */ + int +get_func_tv( + char_u *name, /* name of the function */ + int len, /* length of "name" */ + typval_T *rettv, + char_u **arg, /* argument, pointing to the '(' */ + linenr_T firstline, /* first line of range */ + linenr_T lastline, /* last line of range */ + int *doesrange, /* return: function handled range */ + int evaluate, + partial_T *partial, /* for extra arguments */ + dict_T *selfdict) /* Dictionary for "self" */ +{ + char_u *argp; + int ret = OK; + typval_T argvars[MAX_FUNC_ARGS + 1]; /* vars for arguments */ + int argcount = 0; /* number of arguments found */ + + /* + * Get the arguments. + */ + argp = *arg; + while (argcount < MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) + { + argp = skipwhite(argp + 1); /* skip the '(' or ',' */ + if (*argp == ')' || *argp == ',' || *argp == NUL) + break; + if (eval1(&argp, &argvars[argcount], evaluate) == FAIL) + { + ret = FAIL; + break; + } + ++argcount; + if (*argp != ',') + break; + } + if (*argp == ')') + ++argp; + else + ret = FAIL; + + if (ret == OK) + { + int i = 0; + + if (get_vim_var_nr(VV_TESTING)) + { + /* Prepare for calling test_garbagecollect_now(), need to know + * what variables are used on the call stack. */ + if (funcargs.ga_itemsize == 0) + ga_init2(&funcargs, (int)sizeof(typval_T *), 50); + for (i = 0; i < argcount; ++i) + if (ga_grow(&funcargs, 1) == OK) + ((typval_T **)funcargs.ga_data)[funcargs.ga_len++] = + &argvars[i]; + } + + ret = call_func(name, len, rettv, argcount, argvars, NULL, + firstline, lastline, doesrange, evaluate, partial, selfdict); + + funcargs.ga_len -= i; + } + else if (!aborting()) + { + if (argcount == MAX_FUNC_ARGS) + emsg_funcname(N_("E740: Too many arguments for function %s"), name); + else + emsg_funcname(N_("E116: Invalid arguments for function %s"), name); + } + + while (--argcount >= 0) + clear_tv(&argvars[argcount]); + + *arg = skipwhite(argp); + return ret; +} + +#define FLEN_FIXED 40 + +/* + * Return TRUE if "p" starts with "<SID>" or "s:". + * Only works if eval_fname_script() returned non-zero for "p"! + */ + static int +eval_fname_sid(char_u *p) +{ + return (*p == 's' || TOUPPER_ASC(p[2]) == 'I'); +} + +/* + * In a script change <SID>name() and s:name() to K_SNR 123_name(). + * Change <SNR>123_name() to K_SNR 123_name(). + * Use "fname_buf[FLEN_FIXED + 1]" when it fits, otherwise allocate memory + * (slow). + */ + static char_u * +fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error) +{ + int llen; + char_u *fname; + int i; + + llen = eval_fname_script(name); + if (llen > 0) + { + fname_buf[0] = K_SPECIAL; + fname_buf[1] = KS_EXTRA; + fname_buf[2] = (int)KE_SNR; + i = 3; + if (eval_fname_sid(name)) /* "<SID>" or "s:" */ + { + if (current_SID <= 0) + *error = ERROR_SCRIPT; + else + { + sprintf((char *)fname_buf + 3, "%ld_", (long)current_SID); + i = (int)STRLEN(fname_buf); + } + } + if (i + STRLEN(name + llen) < FLEN_FIXED) + { + STRCPY(fname_buf + i, name + llen); + fname = fname_buf; + } + else + { + fname = alloc((unsigned)(i + STRLEN(name + llen) + 1)); + if (fname == NULL) + *error = ERROR_OTHER; + else + { + *tofree = fname; + mch_memmove(fname, fname_buf, (size_t)i); + STRCPY(fname + i, name + llen); + } + } + } + else + fname = name; + return fname; +} + +/* + * Find a function by name, return pointer to it in ufuncs. + * Return NULL for unknown function. + */ + ufunc_T * +find_func(char_u *name) +{ + hashitem_T *hi; + + hi = hash_find(&func_hashtab, name); + if (!HASHITEM_EMPTY(hi)) + return HI2UF(hi); + return NULL; +} + +/* + * Copy the function name of "fp" to buffer "buf". + * "buf" must be able to hold the function name plus three bytes. + * Takes care of script-local function names. + */ + static void +cat_func_name(char_u *buf, ufunc_T *fp) +{ + if (fp->uf_name[0] == K_SPECIAL) + { + STRCPY(buf, "<SNR>"); + STRCAT(buf, fp->uf_name + 3); + } + else + STRCPY(buf, fp->uf_name); +} + +/* + * Add a number variable "name" to dict "dp" with value "nr". + */ + static void +add_nr_var( + dict_T *dp, + dictitem_T *v, + char *name, + varnumber_T nr) +{ + STRCPY(v->di_key, name); + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; + hash_add(&dp->dv_hashtab, DI2HIKEY(v)); + v->di_tv.v_type = VAR_NUMBER; + v->di_tv.v_lock = VAR_FIXED; + v->di_tv.vval.v_number = nr; +} + +/* + * Free "fc" and what it contains. + */ + static void +free_funccal( + funccall_T *fc, + int free_val) /* a: vars were allocated */ +{ + listitem_T *li; + int i; + + for (i = 0; i < fc->fc_funcs.ga_len; ++i) + { + ufunc_T *fp = ((ufunc_T **)(fc->fc_funcs.ga_data))[i]; + + /* When garbage collecting a funccall_T may be freed before the + * function that references it, clear its uf_scoped field. + * The function may have been redefined and point to another + * funccall_T, don't clear it then. */ + if (fp != NULL && fp->uf_scoped == fc) + fp->uf_scoped = NULL; + } + ga_clear(&fc->fc_funcs); + + /* The a: variables typevals may not have been allocated, only free the + * allocated variables. */ + vars_clear_ext(&fc->l_avars.dv_hashtab, free_val); + + /* free all l: variables */ + vars_clear(&fc->l_vars.dv_hashtab); + + /* Free the a:000 variables if they were allocated. */ + if (free_val) + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) + clear_tv(&li->li_tv); + + func_ptr_unref(fc->func); + vim_free(fc); +} + +/* + * Handle the last part of returning from a function: free the local hashtable. + * Unless it is still in use by a closure. + */ + static void +cleanup_function_call(funccall_T *fc) +{ + current_funccal = fc->caller; + + /* If the a:000 list and the l: and a: dicts are not referenced and there + * is no closure using it, we can free the funccall_T and what's in it. */ + if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT + && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT + && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT + && fc->fc_refcount <= 0) + { + free_funccal(fc, FALSE); + } + else + { + hashitem_T *hi; + listitem_T *li; + int todo; + dictitem_T *v; + + /* "fc" is still in use. This can happen when returning "a:000", + * assigning "l:" to a global variable or defining a closure. + * Link "fc" in the list for garbage collection later. */ + fc->caller = previous_funccal; + previous_funccal = fc; + + /* Make a copy of the a: variables, since we didn't do that above. */ + todo = (int)fc->l_avars.dv_hashtab.ht_used; + for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + v = HI2DI(hi); + copy_tv(&v->di_tv, &v->di_tv); + } + } + + /* Make a copy of the a:000 items, since we didn't do that above. */ + for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next) + copy_tv(&li->li_tv, &li->li_tv); + } +} + +/* + * Call a user function. + */ + static void +call_user_func( + ufunc_T *fp, /* pointer to function */ + int argcount, /* nr of args */ + typval_T *argvars, /* arguments */ + typval_T *rettv, /* return value */ + linenr_T firstline, /* first line of range */ + linenr_T lastline, /* last line of range */ + dict_T *selfdict) /* Dictionary for "self" */ +{ + char_u *save_sourcing_name; + linenr_T save_sourcing_lnum; + scid_T save_current_SID; + funccall_T *fc; + int save_did_emsg; + static int depth = 0; + dictitem_T *v; + int fixvar_idx = 0; /* index in fixvar[] */ + int i; + int ai; + int islambda = FALSE; + char_u numbuf[NUMBUFLEN]; + char_u *name; + size_t len; +#ifdef FEAT_PROFILE + proftime_T wait_start; + proftime_T call_start; +#endif + + /* If depth of calling is getting too high, don't execute the function */ + if (depth >= p_mfd) + { + EMSG(_("E132: Function call depth is higher than 'maxfuncdepth'")); + rettv->v_type = VAR_NUMBER; + rettv->vval.v_number = -1; + return; + } + ++depth; + + line_breakcheck(); /* check for CTRL-C hit */ + + fc = (funccall_T *)alloc(sizeof(funccall_T)); + fc->caller = current_funccal; + current_funccal = fc; + fc->func = fp; + fc->rettv = rettv; + rettv->vval.v_number = 0; + fc->linenr = 0; + fc->returned = FALSE; + fc->level = ex_nesting_level; + /* Check if this function has a breakpoint. */ + fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); + fc->dbg_tick = debug_tick; + /* Set up fields for closure. */ + fc->fc_refcount = 0; + fc->fc_copyID = 0; + ga_init2(&fc->fc_funcs, sizeof(ufunc_T *), 1); + func_ptr_ref(fp); + + if (STRNCMP(fp->uf_name, "<lambda>", 8) == 0) + islambda = TRUE; + + /* + * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables + * with names up to VAR_SHORT_LEN long. This avoids having to alloc/free + * each argument variable and saves a lot of time. + */ + /* + * Init l: variables. + */ + init_var_dict(&fc->l_vars, &fc->l_vars_var, VAR_DEF_SCOPE); + if (selfdict != NULL) + { + /* Set l:self to "selfdict". Use "name" to avoid a warning from + * some compiler that checks the destination size. */ + v = &fc->fixvar[fixvar_idx++].var; + name = v->di_key; + STRCPY(name, "self"); + v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; + hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); + v->di_tv.v_type = VAR_DICT; + v->di_tv.v_lock = 0; + v->di_tv.vval.v_dict = selfdict; + ++selfdict->dv_refcount; + } + + /* + * Init a: variables. + * Set a:0 to "argcount". + * Set a:000 to a list with room for the "..." arguments. + */ + init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", + (varnumber_T)(argcount - fp->uf_args.ga_len)); + /* Use "name" to avoid a warning from some compiler that checks the + * destination size. */ + v = &fc->fixvar[fixvar_idx++].var; + name = v->di_key; + STRCPY(name, "000"); + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); + v->di_tv.v_type = VAR_LIST; + v->di_tv.v_lock = VAR_FIXED; + v->di_tv.vval.v_list = &fc->l_varlist; + vim_memset(&fc->l_varlist, 0, sizeof(list_T)); + fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; + fc->l_varlist.lv_lock = VAR_FIXED; + + /* + * Set a:firstline to "firstline" and a:lastline to "lastline". + * Set a:name to named arguments. + * Set a:N to the "..." arguments. + */ + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", + (varnumber_T)firstline); + add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", + (varnumber_T)lastline); + for (i = 0; i < argcount; ++i) + { + int addlocal = FALSE; + + ai = i - fp->uf_args.ga_len; + if (ai < 0) + { + /* named argument a:name */ + name = FUNCARG(fp, i); + if (islambda) + addlocal = TRUE; + } + else + { + /* "..." argument a:1, a:2, etc. */ + sprintf((char *)numbuf, "%d", ai + 1); + name = numbuf; + } + if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN) + { + v = &fc->fixvar[fixvar_idx++].var; + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; + } + else + { + v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + + STRLEN(name))); + if (v == NULL) + break; + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX | DI_FLAGS_ALLOC; + } + STRCPY(v->di_key, name); + + /* Note: the values are copied directly to avoid alloc/free. + * "argvars" must have VAR_FIXED for v_lock. */ + v->di_tv = argvars[i]; + v->di_tv.v_lock = VAR_FIXED; + + if (addlocal) + { + /* Named arguments should be accessed without the "a:" prefix in + * lambda expressions. Add to the l: dict. */ + copy_tv(&v->di_tv, &v->di_tv); + hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); + } + else + hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); + + if (ai >= 0 && ai < MAX_FUNC_ARGS) + { + list_append(&fc->l_varlist, &fc->l_listitems[ai]); + fc->l_listitems[ai].li_tv = argvars[i]; + fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED; + } + } + + /* Don't redraw while executing the function. */ + ++RedrawingDisabled; + save_sourcing_name = sourcing_name; + save_sourcing_lnum = sourcing_lnum; + sourcing_lnum = 1; + /* need space for function name + ("function " + 3) or "[number]" */ + len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name)) + + STRLEN(fp->uf_name) + 20; + sourcing_name = alloc((unsigned)len); + if (sourcing_name != NULL) + { + if (save_sourcing_name != NULL + && STRNCMP(save_sourcing_name, "function ", 9) == 0) + sprintf((char *)sourcing_name, "%s[%d]..", + save_sourcing_name, (int)save_sourcing_lnum); + else + STRCPY(sourcing_name, "function "); + cat_func_name(sourcing_name + STRLEN(sourcing_name), fp); + + if (p_verbose >= 12) + { + ++no_wait_return; + verbose_enter_scroll(); + + smsg((char_u *)_("calling %s"), sourcing_name); + if (p_verbose >= 14) + { + char_u buf[MSG_BUF_LEN]; + char_u numbuf2[NUMBUFLEN]; + char_u *tofree; + char_u *s; + + msg_puts((char_u *)"("); + for (i = 0; i < argcount; ++i) + { + if (i > 0) + msg_puts((char_u *)", "); + if (argvars[i].v_type == VAR_NUMBER) + msg_outnum((long)argvars[i].vval.v_number); + else + { + /* Do not want errors such as E724 here. */ + ++emsg_off; + s = tv2string(&argvars[i], &tofree, numbuf2, 0); + --emsg_off; + if (s != NULL) + { + if (vim_strsize(s) > MSG_BUF_CLEN) + { + trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); + s = buf; + } + msg_puts(s); + vim_free(tofree); + } + } + } + msg_puts((char_u *)")"); + } + msg_puts((char_u *)"\n"); /* don't overwrite this either */ + + verbose_leave_scroll(); + --no_wait_return; + } + } +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + { + if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) + func_do_profile(fp); + if (fp->uf_profiling + || (fc->caller != NULL && fc->caller->func->uf_profiling)) + { + ++fp->uf_tm_count; + profile_start(&call_start); + profile_zero(&fp->uf_tm_children); + } + script_prof_save(&wait_start); + } +#endif + + save_current_SID = current_SID; + current_SID = fp->uf_script_ID; + save_did_emsg = did_emsg; + did_emsg = FALSE; + + /* call do_cmdline() to execute the lines */ + do_cmdline(NULL, get_func_line, (void *)fc, + DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); + + --RedrawingDisabled; + + /* when the function was aborted because of an error, return -1 */ + if ((did_emsg && (fp->uf_flags & FC_ABORT)) || rettv->v_type == VAR_UNKNOWN) + { + clear_tv(rettv); + rettv->v_type = VAR_NUMBER; + rettv->vval.v_number = -1; + } + +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES && (fp->uf_profiling + || (fc->caller != NULL && fc->caller->func->uf_profiling))) + { + profile_end(&call_start); + profile_sub_wait(&wait_start, &call_start); + profile_add(&fp->uf_tm_total, &call_start); + profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children); + if (fc->caller != NULL && fc->caller->func->uf_profiling) + { + profile_add(&fc->caller->func->uf_tm_children, &call_start); + profile_add(&fc->caller->func->uf_tml_children, &call_start); + } + } +#endif + + /* when being verbose, mention the return value */ + if (p_verbose >= 12) + { + ++no_wait_return; + verbose_enter_scroll(); + + if (aborting()) + smsg((char_u *)_("%s aborted"), sourcing_name); + else if (fc->rettv->v_type == VAR_NUMBER) + smsg((char_u *)_("%s returning #%ld"), sourcing_name, + (long)fc->rettv->vval.v_number); + else + { + char_u buf[MSG_BUF_LEN]; + char_u numbuf2[NUMBUFLEN]; + char_u *tofree; + char_u *s; + + /* The value may be very long. Skip the middle part, so that we + * have some idea how it starts and ends. smsg() would always + * truncate it at the end. Don't want errors such as E724 here. */ + ++emsg_off; + s = tv2string(fc->rettv, &tofree, numbuf2, 0); + --emsg_off; + if (s != NULL) + { + if (vim_strsize(s) > MSG_BUF_CLEN) + { + trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); + s = buf; + } + smsg((char_u *)_("%s returning %s"), sourcing_name, s); + vim_free(tofree); + } + } + msg_puts((char_u *)"\n"); /* don't overwrite this either */ + + verbose_leave_scroll(); + --no_wait_return; + } + + vim_free(sourcing_name); + sourcing_name = save_sourcing_name; + sourcing_lnum = save_sourcing_lnum; + current_SID = save_current_SID; +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + script_prof_restore(&wait_start); +#endif + + if (p_verbose >= 12 && sourcing_name != NULL) + { + ++no_wait_return; + verbose_enter_scroll(); + + smsg((char_u *)_("continuing in %s"), sourcing_name); + msg_puts((char_u *)"\n"); /* don't overwrite this either */ + + verbose_leave_scroll(); + --no_wait_return; + } + + did_emsg |= save_did_emsg; + --depth; + + cleanup_function_call(fc); +} + +/* + * Unreference "fc": decrement the reference count and free it when it + * becomes zero. "fp" is detached from "fc". + * When "force" is TRUE we are exiting. + */ + static void +funccal_unref(funccall_T *fc, ufunc_T *fp, int force) +{ + funccall_T **pfc; + int i; + + if (fc == NULL) + return; + + if (--fc->fc_refcount <= 0 && (force || ( + fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT + && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT + && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT))) + for (pfc = &previous_funccal; *pfc != NULL; pfc = &(*pfc)->caller) + { + if (fc == *pfc) + { + *pfc = fc->caller; + free_funccal(fc, TRUE); + return; + } + } + for (i = 0; i < fc->fc_funcs.ga_len; ++i) + if (((ufunc_T **)(fc->fc_funcs.ga_data))[i] == fp) + ((ufunc_T **)(fc->fc_funcs.ga_data))[i] = NULL; +} + +/* + * Remove the function from the function hashtable. If the function was + * deleted while it still has references this was already done. + * Return TRUE if the entry was deleted, FALSE if it wasn't found. + */ + static int +func_remove(ufunc_T *fp) +{ + hashitem_T *hi = hash_find(&func_hashtab, UF2HIKEY(fp)); + + if (!HASHITEM_EMPTY(hi)) + { + hash_remove(&func_hashtab, hi); + return TRUE; + } + return FALSE; +} + +/* + * Free all things that a function contains. Does not free the function + * itself, use func_free() for that. + * When "force" is TRUE we are exiting. + */ + static void +func_clear(ufunc_T *fp, int force) +{ + if (fp->uf_cleared) + return; + fp->uf_cleared = TRUE; + + /* clear this function */ + ga_clear_strings(&(fp->uf_args)); + ga_clear_strings(&(fp->uf_lines)); +#ifdef FEAT_PROFILE + vim_free(fp->uf_tml_count); + vim_free(fp->uf_tml_total); + vim_free(fp->uf_tml_self); +#endif + funccal_unref(fp->uf_scoped, fp, force); +} + +/* + * Free a function and remove it from the list of functions. Does not free + * what a function contains, call func_clear() first. + */ + static void +func_free(ufunc_T *fp) +{ + /* only remove it when not done already, otherwise we would remove a newer + * version of the function */ + if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0) + func_remove(fp); + + vim_free(fp); +} + +/* + * Free all things that a function contains and free the function itself. + * When "force" is TRUE we are exiting. + */ + static void +func_clear_free(ufunc_T *fp, int force) +{ + func_clear(fp, force); + func_free(fp); +} + +/* + * There are two kinds of function names: + * 1. ordinary names, function defined with :function + * 2. numbered functions and lambdas + * For the first we only count the name stored in func_hashtab as a reference, + * using function() does not count as a reference, because the function is + * looked up by name. + */ + static int +func_name_refcount(char_u *name) +{ + return isdigit(*name) || *name == '<'; +} + +#if defined(EXITFREE) || defined(PROTO) + void +free_all_functions(void) +{ + hashitem_T *hi; + ufunc_T *fp; + long_u skipped = 0; + long_u todo = 1; + long_u used; + + /* Clean up the call stack. */ + while (current_funccal != NULL) + { + clear_tv(current_funccal->rettv); + cleanup_function_call(current_funccal); + } + + /* First clear what the functions contain. Since this may lower the + * reference count of a function, it may also free a function and change + * the hash table. Restart if that happens. */ + while (todo > 0) + { + todo = func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + /* Only free functions that are not refcounted, those are + * supposed to be freed when no longer referenced. */ + fp = HI2UF(hi); + if (func_name_refcount(fp->uf_name)) + ++skipped; + else + { + used = func_hashtab.ht_used; + func_clear(fp, TRUE); + if (used != func_hashtab.ht_used) + { + skipped = 0; + break; + } + } + --todo; + } + } + + /* Now actually free the functions. Need to start all over every time, + * because func_free() may change the hash table. */ + skipped = 0; + while (func_hashtab.ht_used > skipped) + { + todo = func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + --todo; + /* Only free functions that are not refcounted, those are + * supposed to be freed when no longer referenced. */ + fp = HI2UF(hi); + if (func_name_refcount(fp->uf_name)) + ++skipped; + else + { + func_free(fp); + skipped = 0; + break; + } + } + } + if (skipped == 0) + hash_clear(&func_hashtab); +} +#endif + +/* + * Return TRUE if "name" looks like a builtin function name: starts with a + * lower case letter and doesn't contain AUTOLOAD_CHAR. + * "len" is the length of "name", or -1 for NUL terminated. + */ + static int +builtin_function(char_u *name, int len) +{ + char_u *p; + + if (!ASCII_ISLOWER(name[0])) + return FALSE; + p = vim_strchr(name, AUTOLOAD_CHAR); + return p == NULL || (len > 0 && p > name + len); +} + + int +func_call( + char_u *name, + typval_T *args, + partial_T *partial, + dict_T *selfdict, + typval_T *rettv) +{ + listitem_T *item; + typval_T argv[MAX_FUNC_ARGS + 1]; + int argc = 0; + int dummy; + int r = 0; + + for (item = args->vval.v_list->lv_first; item != NULL; + item = item->li_next) + { + if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) + { + EMSG(_("E699: Too many arguments")); + break; + } + /* Make a copy of each argument. This is needed to be able to set + * v_lock to VAR_FIXED in the copy without changing the original list. + */ + copy_tv(&item->li_tv, &argv[argc++]); + } + + if (item == NULL) + r = call_func(name, (int)STRLEN(name), rettv, argc, argv, NULL, + curwin->w_cursor.lnum, curwin->w_cursor.lnum, + &dummy, TRUE, partial, selfdict); + + /* Free the arguments. */ + while (argc > 0) + clear_tv(&argv[--argc]); + + return r; +} + +/* + * Call a function with its resolved parameters + * + * "argv_func", when not NULL, can be used to fill in arguments only when the + * invoked function uses them. It is called like this: + * new_argcount = argv_func(current_argcount, argv, called_func_argcount) + * + * Return FAIL when the function can't be called, OK otherwise. + * Also returns OK when an error was encountered while executing the function. + */ + int +call_func( + char_u *funcname, /* name of the function */ + int len, /* length of "name" */ + typval_T *rettv, /* return value goes here */ + int argcount_in, /* number of "argvars" */ + typval_T *argvars_in, /* vars for arguments, must have "argcount" + PLUS ONE elements! */ + int (* argv_func)(int, typval_T *, int), + /* function to fill in argvars */ + linenr_T firstline, /* first line of range */ + linenr_T lastline, /* last line of range */ + int *doesrange, /* return: function handled range */ + int evaluate, + partial_T *partial, /* optional, can be NULL */ + dict_T *selfdict_in) /* Dictionary for "self" */ +{ + int ret = FAIL; + int error = ERROR_NONE; + int i; + ufunc_T *fp; + char_u fname_buf[FLEN_FIXED + 1]; + char_u *tofree = NULL; + char_u *fname; + char_u *name; + int argcount = argcount_in; + typval_T *argvars = argvars_in; + dict_T *selfdict = selfdict_in; + typval_T argv[MAX_FUNC_ARGS + 1]; /* used when "partial" is not NULL */ + int argv_clear = 0; + + /* Make a copy of the name, if it comes from a funcref variable it could + * be changed or deleted in the called function. */ + name = vim_strnsave(funcname, len); + if (name == NULL) + return ret; + + fname = fname_trans_sid(name, fname_buf, &tofree, &error); + + *doesrange = FALSE; + + if (partial != NULL) + { + /* When the function has a partial with a dict and there is a dict + * argument, use the dict argument. That is backwards compatible. + * When the dict was bound explicitly use the one from the partial. */ + if (partial->pt_dict != NULL + && (selfdict_in == NULL || !partial->pt_auto)) + selfdict = partial->pt_dict; + if (error == ERROR_NONE && partial->pt_argc > 0) + { + for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear) + copy_tv(&partial->pt_argv[argv_clear], &argv[argv_clear]); + for (i = 0; i < argcount_in; ++i) + argv[i + argv_clear] = argvars_in[i]; + argvars = argv; + argcount = partial->pt_argc + argcount_in; + } + } + + + /* + * Execute the function if executing and no errors were detected. + */ + if (!evaluate) + { + // Not evaluating, which means the return value is unknown. This + // matters for giving error messages. + rettv->v_type = VAR_UNKNOWN; + } + else if (error == ERROR_NONE) + { + char_u *rfname = fname; + + /* Ignore "g:" before a function name. */ + if (fname[0] == 'g' && fname[1] == ':') + rfname = fname + 2; + + rettv->v_type = VAR_NUMBER; /* default rettv is number zero */ + rettv->vval.v_number = 0; + error = ERROR_UNKNOWN; + + if (!builtin_function(rfname, -1)) + { + /* + * User defined function. + */ + if (partial != NULL && partial->pt_func != NULL) + fp = partial->pt_func; + else + fp = find_func(rfname); + + /* Trigger FuncUndefined event, may load the function. */ + if (fp == NULL + && apply_autocmds(EVENT_FUNCUNDEFINED, + rfname, rfname, TRUE, NULL) + && !aborting()) + { + /* executed an autocommand, search for the function again */ + fp = find_func(rfname); + } + /* Try loading a package. */ + if (fp == NULL && script_autoload(rfname, TRUE) && !aborting()) + { + /* loaded a package, search for the function again */ + fp = find_func(rfname); + } + + if (fp != NULL && (fp->uf_flags & FC_DELETED)) + error = ERROR_DELETED; + else if (fp != NULL) + { + if (argv_func != NULL) + argcount = argv_func(argcount, argvars, fp->uf_args.ga_len); + + if (fp->uf_flags & FC_RANGE) + *doesrange = TRUE; + if (argcount < fp->uf_args.ga_len) + error = ERROR_TOOFEW; + else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len) + error = ERROR_TOOMANY; + else if ((fp->uf_flags & FC_DICT) && selfdict == NULL) + error = ERROR_DICT; + else + { + int did_save_redo = FALSE; + save_redo_T save_redo; + + /* + * Call the user function. + * Save and restore search patterns, script variables and + * redo buffer. + */ + save_search_patterns(); +#ifdef FEAT_INS_EXPAND + if (!ins_compl_active()) +#endif + { + saveRedobuff(&save_redo); + did_save_redo = TRUE; + } + ++fp->uf_calls; + call_user_func(fp, argcount, argvars, rettv, + firstline, lastline, + (fp->uf_flags & FC_DICT) ? selfdict : NULL); + if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0) + /* Function was unreferenced while being used, free it + * now. */ + func_clear_free(fp, FALSE); + if (did_save_redo) + restoreRedobuff(&save_redo); + restore_search_patterns(); + error = ERROR_NONE; + } + } + } + else + { + /* + * Find the function name in the table, call its implementation. + */ + error = call_internal_func(fname, argcount, argvars, rettv); + } + /* + * The function call (or "FuncUndefined" autocommand sequence) might + * have been aborted by an error, an interrupt, or an explicitly thrown + * exception that has not been caught so far. This situation can be + * tested for by calling aborting(). For an error in an internal + * function or for the "E132" error in call_user_func(), however, the + * throw point at which the "force_abort" flag (temporarily reset by + * emsg()) is normally updated has not been reached yet. We need to + * update that flag first to make aborting() reliable. + */ + update_force_abort(); + } + if (error == ERROR_NONE) + ret = OK; + + /* + * Report an error unless the argument evaluation or function call has been + * cancelled due to an aborting error, an interrupt, or an exception. + */ + if (!aborting()) + { + switch (error) + { + case ERROR_UNKNOWN: + emsg_funcname(N_("E117: Unknown function: %s"), name); + break; + case ERROR_DELETED: + emsg_funcname(N_("E933: Function was deleted: %s"), name); + break; + case ERROR_TOOMANY: + emsg_funcname((char *)e_toomanyarg, name); + break; + case ERROR_TOOFEW: + emsg_funcname(N_("E119: Not enough arguments for function: %s"), + name); + break; + case ERROR_SCRIPT: + emsg_funcname(N_("E120: Using <SID> not in a script context: %s"), + name); + break; + case ERROR_DICT: + emsg_funcname(N_("E725: Calling dict function without Dictionary: %s"), + name); + break; + } + } + + while (argv_clear > 0) + clear_tv(&argv[--argv_clear]); + vim_free(tofree); + vim_free(name); + + return ret; +} + +/* + * List the head of the function: "name(arg1, arg2)". + */ + static void +list_func_head(ufunc_T *fp, int indent) +{ + int j; + + msg_start(); + if (indent) + MSG_PUTS(" "); + MSG_PUTS("function "); + if (fp->uf_name[0] == K_SPECIAL) + { + MSG_PUTS_ATTR("<SNR>", HL_ATTR(HLF_8)); + msg_puts(fp->uf_name + 3); + } + else + msg_puts(fp->uf_name); + msg_putchar('('); + for (j = 0; j < fp->uf_args.ga_len; ++j) + { + if (j) + MSG_PUTS(", "); + msg_puts(FUNCARG(fp, j)); + } + if (fp->uf_varargs) + { + if (j) + MSG_PUTS(", "); + MSG_PUTS("..."); + } + msg_putchar(')'); + if (fp->uf_flags & FC_ABORT) + MSG_PUTS(" abort"); + if (fp->uf_flags & FC_RANGE) + MSG_PUTS(" range"); + if (fp->uf_flags & FC_DICT) + MSG_PUTS(" dict"); + if (fp->uf_flags & FC_CLOSURE) + MSG_PUTS(" closure"); + msg_clr_eos(); + if (p_verbose > 0) + last_set_msg(fp->uf_script_ID); +} + +/* + * Get a function name, translating "<SID>" and "<SNR>". + * Also handles a Funcref in a List or Dictionary. + * Returns the function name in allocated memory, or NULL for failure. + * flags: + * TFN_INT: internal function name OK + * TFN_QUIET: be quiet + * TFN_NO_AUTOLOAD: do not use script autoloading + * TFN_NO_DEREF: do not dereference a Funcref + * Advances "pp" to just after the function name (if no error). + */ + char_u * +trans_function_name( + char_u **pp, + int skip, /* only find the end, don't evaluate */ + int flags, + funcdict_T *fdp, /* return: info about dictionary used */ + partial_T **partial) /* return: partial of a FuncRef */ +{ + char_u *name = NULL; + char_u *start; + char_u *end; + int lead; + char_u sid_buf[20]; + int len; + lval_T lv; + + if (fdp != NULL) + vim_memset(fdp, 0, sizeof(funcdict_T)); + start = *pp; + + /* Check for hard coded <SNR>: already translated function ID (from a user + * command). */ + if ((*pp)[0] == K_SPECIAL && (*pp)[1] == KS_EXTRA + && (*pp)[2] == (int)KE_SNR) + { + *pp += 3; + len = get_id_len(pp) + 3; + return vim_strnsave(start, len); + } + + /* A name starting with "<SID>" or "<SNR>" is local to a script. But + * don't skip over "s:", get_lval() needs it for "s:dict.func". */ + lead = eval_fname_script(start); + if (lead > 2) + start += lead; + + /* Note that TFN_ flags use the same values as GLV_ flags. */ + end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, + lead > 2 ? 0 : FNE_CHECK_START); + if (end == start) + { + if (!skip) + EMSG(_("E129: Function name required")); + goto theend; + } + if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range))) + { + /* + * Report an invalid expression in braces, unless the expression + * evaluation has been cancelled due to an aborting error, an + * interrupt, or an exception. + */ + if (!aborting()) + { + if (end != NULL) + EMSG2(_(e_invarg2), start); + } + else + *pp = find_name_end(start, NULL, NULL, FNE_INCL_BR); + goto theend; + } + + if (lv.ll_tv != NULL) + { + if (fdp != NULL) + { + fdp->fd_dict = lv.ll_dict; + fdp->fd_newkey = lv.ll_newkey; + lv.ll_newkey = NULL; + fdp->fd_di = lv.ll_di; + } + if (lv.ll_tv->v_type == VAR_FUNC && lv.ll_tv->vval.v_string != NULL) + { + name = vim_strsave(lv.ll_tv->vval.v_string); + *pp = end; + } + else if (lv.ll_tv->v_type == VAR_PARTIAL + && lv.ll_tv->vval.v_partial != NULL) + { + name = vim_strsave(partial_name(lv.ll_tv->vval.v_partial)); + *pp = end; + if (partial != NULL) + *partial = lv.ll_tv->vval.v_partial; + } + else + { + if (!skip && !(flags & TFN_QUIET) && (fdp == NULL + || lv.ll_dict == NULL || fdp->fd_newkey == NULL)) + EMSG(_(e_funcref)); + else + *pp = end; + name = NULL; + } + goto theend; + } + + if (lv.ll_name == NULL) + { + /* Error found, but continue after the function name. */ + *pp = end; + goto theend; + } + + /* Check if the name is a Funcref. If so, use the value. */ + if (lv.ll_exp_name != NULL) + { + len = (int)STRLEN(lv.ll_exp_name); + name = deref_func_name(lv.ll_exp_name, &len, partial, + flags & TFN_NO_AUTOLOAD); + if (name == lv.ll_exp_name) + name = NULL; + } + else if (!(flags & TFN_NO_DEREF)) + { + len = (int)(end - *pp); + name = deref_func_name(*pp, &len, partial, flags & TFN_NO_AUTOLOAD); + if (name == *pp) + name = NULL; + } + if (name != NULL) + { + name = vim_strsave(name); + *pp = end; + if (STRNCMP(name, "<SNR>", 5) == 0) + { + /* Change "<SNR>" to the byte sequence. */ + name[0] = K_SPECIAL; + name[1] = KS_EXTRA; + name[2] = (int)KE_SNR; + mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1); + } + goto theend; + } + + if (lv.ll_exp_name != NULL) + { + len = (int)STRLEN(lv.ll_exp_name); + if (lead <= 2 && lv.ll_name == lv.ll_exp_name + && STRNCMP(lv.ll_name, "s:", 2) == 0) + { + /* When there was "s:" already or the name expanded to get a + * leading "s:" then remove it. */ + lv.ll_name += 2; + len -= 2; + lead = 2; + } + } + else + { + /* skip over "s:" and "g:" */ + if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':')) + lv.ll_name += 2; + len = (int)(end - lv.ll_name); + } + + /* + * Copy the function name to allocated memory. + * Accept <SID>name() inside a script, translate into <SNR>123_name(). + * Accept <SNR>123_name() outside a script. + */ + if (skip) + lead = 0; /* do nothing */ + else if (lead > 0) + { + lead = 3; + if ((lv.ll_exp_name != NULL && eval_fname_sid(lv.ll_exp_name)) + || eval_fname_sid(*pp)) + { + /* It's "s:" or "<SID>" */ + if (current_SID <= 0) + { + EMSG(_(e_usingsid)); + goto theend; + } + sprintf((char *)sid_buf, "%ld_", (long)current_SID); + lead += (int)STRLEN(sid_buf); + } + } + else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) + { + EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"), + start); + goto theend; + } + if (!skip && !(flags & TFN_QUIET) && !(flags & TFN_NO_DEREF)) + { + char_u *cp = vim_strchr(lv.ll_name, ':'); + + if (cp != NULL && cp < end) + { + EMSG2(_("E884: Function name cannot contain a colon: %s"), start); + goto theend; + } + } + + name = alloc((unsigned)(len + lead + 1)); + if (name != NULL) + { + if (lead > 0) + { + name[0] = K_SPECIAL; + name[1] = KS_EXTRA; + name[2] = (int)KE_SNR; + if (lead > 3) /* If it's "<SID>" */ + STRCPY(name + 3, sid_buf); + } + mch_memmove(name + lead, lv.ll_name, (size_t)len); + name[lead + len] = NUL; + } + *pp = end; + +theend: + clear_lval(&lv); + return name; +} + +/* + * ":function" + */ + void +ex_function(exarg_T *eap) +{ + char_u *theline; + char_u *line_to_free = NULL; + int j; + int c; + int saved_did_emsg; + int saved_wait_return = need_wait_return; + char_u *name = NULL; + char_u *p; + char_u *arg; + char_u *line_arg = NULL; + garray_T newargs; + garray_T newlines; + int varargs = FALSE; + int flags = 0; + ufunc_T *fp; + int overwrite = FALSE; + int indent; + int nesting; + char_u *skip_until = NULL; + dictitem_T *v; + funcdict_T fudi; + static int func_nr = 0; /* number for nameless function */ + int paren; + hashtab_T *ht; + int todo; + hashitem_T *hi; + int sourcing_lnum_off; + + /* + * ":function" without argument: list functions. + */ + if (ends_excmd(*eap->arg)) + { + if (!eap->skip) + { + todo = (int)func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + fp = HI2UF(hi); + if (!func_name_refcount(fp->uf_name)) + list_func_head(fp, FALSE); + } + } + } + eap->nextcmd = check_nextcmd(eap->arg); + return; + } + + /* + * ":function /pat": list functions matching pattern. + */ + if (*eap->arg == '/') + { + p = skip_regexp(eap->arg + 1, '/', TRUE, NULL); + if (!eap->skip) + { + regmatch_T regmatch; + + c = *p; + *p = NUL; + regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); + *p = c; + if (regmatch.regprog != NULL) + { + regmatch.rm_ic = p_ic; + + todo = (int)func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + fp = HI2UF(hi); + if (!isdigit(*fp->uf_name) + && vim_regexec(®match, fp->uf_name, 0)) + list_func_head(fp, FALSE); + } + } + vim_regfree(regmatch.regprog); + } + } + if (*p == '/') + ++p; + eap->nextcmd = check_nextcmd(p); + return; + } + + /* + * Get the function name. There are these situations: + * func normal function name + * "name" == func, "fudi.fd_dict" == NULL + * dict.func new dictionary entry + * "name" == NULL, "fudi.fd_dict" set, + * "fudi.fd_di" == NULL, "fudi.fd_newkey" == func + * dict.func existing dict entry with a Funcref + * "name" == func, "fudi.fd_dict" set, + * "fudi.fd_di" set, "fudi.fd_newkey" == NULL + * dict.func existing dict entry that's not a Funcref + * "name" == NULL, "fudi.fd_dict" set, + * "fudi.fd_di" set, "fudi.fd_newkey" == NULL + * s:func script-local function name + * g:func global function name, same as "func" + */ + p = eap->arg; + name = trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL); + paren = (vim_strchr(p, '(') != NULL); + if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip) + { + /* + * Return on an invalid expression in braces, unless the expression + * evaluation has been cancelled due to an aborting error, an + * interrupt, or an exception. + */ + if (!aborting()) + { + if (!eap->skip && fudi.fd_newkey != NULL) + EMSG2(_(e_dictkey), fudi.fd_newkey); + vim_free(fudi.fd_newkey); + return; + } + else + eap->skip = TRUE; + } + + /* An error in a function call during evaluation of an expression in magic + * braces should not cause the function not to be defined. */ + saved_did_emsg = did_emsg; + did_emsg = FALSE; + + /* + * ":function func" with only function name: list function. + */ + if (!paren) + { + if (!ends_excmd(*skipwhite(p))) + { + EMSG(_(e_trailing)); + goto ret_free; + } + eap->nextcmd = check_nextcmd(p); + if (eap->nextcmd != NULL) + *p = NUL; + if (!eap->skip && !got_int) + { + fp = find_func(name); + if (fp != NULL) + { + list_func_head(fp, TRUE); + for (j = 0; j < fp->uf_lines.ga_len && !got_int; ++j) + { + if (FUNCLINE(fp, j) == NULL) + continue; + msg_putchar('\n'); + msg_outnum((long)(j + 1)); + if (j < 9) + msg_putchar(' '); + if (j < 99) + msg_putchar(' '); + msg_prt_line(FUNCLINE(fp, j), FALSE); + out_flush(); /* show a line at a time */ + ui_breakcheck(); + } + if (!got_int) + { + msg_putchar('\n'); + msg_puts((char_u *)" endfunction"); + } + } + else + emsg_funcname(N_("E123: Undefined function: %s"), name); + } + goto ret_free; + } + + /* + * ":function name(arg1, arg2)" Define function. + */ + p = skipwhite(p); + if (*p != '(') + { + if (!eap->skip) + { + EMSG2(_("E124: Missing '(': %s"), eap->arg); + goto ret_free; + } + /* attempt to continue by skipping some text */ + if (vim_strchr(p, '(') != NULL) + p = vim_strchr(p, '('); + } + p = skipwhite(p + 1); + + ga_init2(&newlines, (int)sizeof(char_u *), 3); + + if (!eap->skip) + { + /* Check the name of the function. Unless it's a dictionary function + * (that we are overwriting). */ + if (name != NULL) + arg = name; + else + arg = fudi.fd_newkey; + if (arg != NULL && (fudi.fd_di == NULL + || (fudi.fd_di->di_tv.v_type != VAR_FUNC + && fudi.fd_di->di_tv.v_type != VAR_PARTIAL))) + { + if (*arg == K_SPECIAL) + j = 3; + else + j = 0; + while (arg[j] != NUL && (j == 0 ? eval_isnamec1(arg[j]) + : eval_isnamec(arg[j]))) + ++j; + if (arg[j] != NUL) + emsg_funcname((char *)e_invarg2, arg); + } + /* Disallow using the g: dict. */ + if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) + EMSG(_("E862: Cannot use g: here")); + } + + if (get_function_args(&p, ')', &newargs, &varargs, eap->skip) == FAIL) + goto errret_2; + + /* find extra arguments "range", "dict", "abort" and "closure" */ + for (;;) + { + p = skipwhite(p); + if (STRNCMP(p, "range", 5) == 0) + { + flags |= FC_RANGE; + p += 5; + } + else if (STRNCMP(p, "dict", 4) == 0) + { + flags |= FC_DICT; + p += 4; + } + else if (STRNCMP(p, "abort", 5) == 0) + { + flags |= FC_ABORT; + p += 5; + } + else if (STRNCMP(p, "closure", 7) == 0) + { + flags |= FC_CLOSURE; + p += 7; + if (current_funccal == NULL) + { + emsg_funcname(N_("E932: Closure function should not be at top level: %s"), + name == NULL ? (char_u *)"" : name); + goto erret; + } + } + else + break; + } + + /* When there is a line break use what follows for the function body. + * Makes 'exe "func Test()\n...\nendfunc"' work. */ + if (*p == '\n') + line_arg = p + 1; + else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) + EMSG(_(e_trailing)); + + /* + * Read the body of the function, until ":endfunction" is found. + */ + if (KeyTyped) + { + /* Check if the function already exists, don't let the user type the + * whole function before telling him it doesn't work! For a script we + * need to skip the body to be able to find what follows. */ + if (!eap->skip && !eap->forceit) + { + if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) + EMSG(_(e_funcdict)); + else if (name != NULL && find_func(name) != NULL) + emsg_funcname(e_funcexts, name); + } + + if (!eap->skip && did_emsg) + goto erret; + + msg_putchar('\n'); /* don't overwrite the function name */ + cmdline_row = msg_row; + } + + indent = 2; + nesting = 0; + for (;;) + { + if (KeyTyped) + { + msg_scroll = TRUE; + saved_wait_return = FALSE; + } + need_wait_return = FALSE; + sourcing_lnum_off = sourcing_lnum; + + if (line_arg != NULL) + { + /* Use eap->arg, split up in parts by line breaks. */ + theline = line_arg; + p = vim_strchr(theline, '\n'); + if (p == NULL) + line_arg += STRLEN(line_arg); + else + { + *p = NUL; + line_arg = p + 1; + } + } + else + { + vim_free(line_to_free); + if (eap->getline == NULL) + theline = getcmdline(':', 0L, indent); + else + theline = eap->getline(':', eap->cookie, indent); + line_to_free = theline; + } + if (KeyTyped) + lines_left = Rows - 1; + if (theline == NULL) + { + EMSG(_("E126: Missing :endfunction")); + goto erret; + } + + /* Detect line continuation: sourcing_lnum increased more than one. */ + if (sourcing_lnum > sourcing_lnum_off + 1) + sourcing_lnum_off = sourcing_lnum - sourcing_lnum_off - 1; + else + sourcing_lnum_off = 0; + + if (skip_until != NULL) + { + /* between ":append" and "." and between ":python <<EOF" and "EOF" + * don't check for ":endfunc". */ + if (STRCMP(theline, skip_until) == 0) + VIM_CLEAR(skip_until); + } + else + { + /* skip ':' and blanks*/ + for (p = theline; VIM_ISWHITE(*p) || *p == ':'; ++p) + ; + + /* Check for "endfunction". */ + if (checkforcmd(&p, "endfunction", 4) && nesting-- == 0) + { + char_u *nextcmd = NULL; + + if (*p == '|') + nextcmd = p + 1; + else if (line_arg != NULL && *skipwhite(line_arg) != NUL) + nextcmd = line_arg; + else if (*p != NUL && *p != '"' && p_verbose > 0) + give_warning2( + (char_u *)_("W22: Text found after :endfunction: %s"), + p, TRUE); + if (nextcmd != NULL) + { + /* Another command follows. If the line came from "eap" we + * can simply point into it, otherwise we need to change + * "eap->cmdlinep". */ + eap->nextcmd = nextcmd; + if (line_to_free != NULL) + { + vim_free(*eap->cmdlinep); + *eap->cmdlinep = line_to_free; + line_to_free = NULL; + } + } + break; + } + + /* Increase indent inside "if", "while", "for" and "try", decrease + * at "end". */ + if (indent > 2 && STRNCMP(p, "end", 3) == 0) + indent -= 2; + else if (STRNCMP(p, "if", 2) == 0 + || STRNCMP(p, "wh", 2) == 0 + || STRNCMP(p, "for", 3) == 0 + || STRNCMP(p, "try", 3) == 0) + indent += 2; + + /* Check for defining a function inside this function. */ + if (checkforcmd(&p, "function", 2)) + { + if (*p == '!') + p = skipwhite(p + 1); + p += eval_fname_script(p); + vim_free(trans_function_name(&p, TRUE, 0, NULL, NULL)); + if (*skipwhite(p) == '(') + { + ++nesting; + indent += 2; + } + } + + /* Check for ":append", ":change", ":insert". */ + p = skip_range(p, NULL); + if ((p[0] == 'a' && (!ASCII_ISALPHA(p[1]) || p[1] == 'p')) + || (p[0] == 'c' + && (!ASCII_ISALPHA(p[1]) || (p[1] == 'h' + && (!ASCII_ISALPHA(p[2]) || (p[2] == 'a' + && (STRNCMP(&p[3], "nge", 3) != 0 + || !ASCII_ISALPHA(p[6]))))))) + || (p[0] == 'i' + && (!ASCII_ISALPHA(p[1]) || (p[1] == 'n' + && (!ASCII_ISALPHA(p[2]) || (p[2] == 's')))))) + skip_until = vim_strsave((char_u *)"."); + + /* Check for ":python <<EOF", ":tcl <<EOF", etc. */ + arg = skipwhite(skiptowhite(p)); + if (arg[0] == '<' && arg[1] =='<' + && ((p[0] == 'p' && p[1] == 'y' + && (!ASCII_ISALNUM(p[2]) || p[2] == 't' + || ((p[2] == '3' || p[2] == 'x') + && !ASCII_ISALPHA(p[3])))) + || (p[0] == 'p' && p[1] == 'e' + && (!ASCII_ISALPHA(p[2]) || p[2] == 'r')) + || (p[0] == 't' && p[1] == 'c' + && (!ASCII_ISALPHA(p[2]) || p[2] == 'l')) + || (p[0] == 'l' && p[1] == 'u' && p[2] == 'a' + && !ASCII_ISALPHA(p[3])) + || (p[0] == 'r' && p[1] == 'u' && p[2] == 'b' + && (!ASCII_ISALPHA(p[3]) || p[3] == 'y')) + || (p[0] == 'm' && p[1] == 'z' + && (!ASCII_ISALPHA(p[2]) || p[2] == 's')) + )) + { + /* ":python <<" continues until a dot, like ":append" */ + p = skipwhite(arg + 2); + if (*p == NUL) + skip_until = vim_strsave((char_u *)"."); + else + skip_until = vim_strsave(p); + } + } + + /* Add the line to the function. */ + if (ga_grow(&newlines, 1 + sourcing_lnum_off) == FAIL) + goto erret; + + /* Copy the line to newly allocated memory. get_one_sourceline() + * allocates 250 bytes per line, this saves 80% on average. The cost + * is an extra alloc/free. */ + p = vim_strsave(theline); + if (p == NULL) + goto erret; + ((char_u **)(newlines.ga_data))[newlines.ga_len++] = p; + + /* Add NULL lines for continuation lines, so that the line count is + * equal to the index in the growarray. */ + while (sourcing_lnum_off-- > 0) + ((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL; + + /* Check for end of eap->arg. */ + if (line_arg != NULL && *line_arg == NUL) + line_arg = NULL; + } + + /* Don't define the function when skipping commands or when an error was + * detected. */ + if (eap->skip || did_emsg) + goto erret; + + /* + * If there are no errors, add the function + */ + if (fudi.fd_dict == NULL) + { + v = find_var(name, &ht, FALSE); + if (v != NULL && v->di_tv.v_type == VAR_FUNC) + { + emsg_funcname(N_("E707: Function name conflicts with variable: %s"), + name); + goto erret; + } + + fp = find_func(name); + if (fp != NULL) + { + if (!eap->forceit) + { + emsg_funcname(e_funcexts, name); + goto erret; + } + if (fp->uf_calls > 0) + { + emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"), + name); + goto erret; + } + if (fp->uf_refcount > 1) + { + /* This function is referenced somewhere, don't redefine it but + * create a new one. */ + --fp->uf_refcount; + fp->uf_flags |= FC_REMOVED; + fp = NULL; + overwrite = TRUE; + } + else + { + /* redefine existing function */ + ga_clear_strings(&(fp->uf_args)); + ga_clear_strings(&(fp->uf_lines)); + VIM_CLEAR(name); + } + } + } + else + { + char numbuf[20]; + + fp = NULL; + if (fudi.fd_newkey == NULL && !eap->forceit) + { + EMSG(_(e_funcdict)); + goto erret; + } + if (fudi.fd_di == NULL) + { + /* Can't add a function to a locked dictionary */ + if (tv_check_lock(fudi.fd_dict->dv_lock, eap->arg, FALSE)) + goto erret; + } + /* Can't change an existing function if it is locked */ + else if (tv_check_lock(fudi.fd_di->di_tv.v_lock, eap->arg, FALSE)) + goto erret; + + /* Give the function a sequential number. Can only be used with a + * Funcref! */ + vim_free(name); + sprintf(numbuf, "%d", ++func_nr); + name = vim_strsave((char_u *)numbuf); + if (name == NULL) + goto erret; + } + + if (fp == NULL) + { + if (fudi.fd_dict == NULL && vim_strchr(name, AUTOLOAD_CHAR) != NULL) + { + int slen, plen; + char_u *scriptname; + + /* Check that the autoload name matches the script name. */ + j = FAIL; + if (sourcing_name != NULL) + { + scriptname = autoload_name(name); + if (scriptname != NULL) + { + p = vim_strchr(scriptname, '/'); + plen = (int)STRLEN(p); + slen = (int)STRLEN(sourcing_name); + if (slen > plen && fnamecmp(p, + sourcing_name + slen - plen) == 0) + j = OK; + vim_free(scriptname); + } + } + if (j == FAIL) + { + EMSG2(_("E746: Function name does not match script file name: %s"), name); + goto erret; + } + } + + fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); + if (fp == NULL) + goto erret; + + if (fudi.fd_dict != NULL) + { + if (fudi.fd_di == NULL) + { + /* add new dict entry */ + fudi.fd_di = dictitem_alloc(fudi.fd_newkey); + if (fudi.fd_di == NULL) + { + vim_free(fp); + goto erret; + } + if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) + { + vim_free(fudi.fd_di); + vim_free(fp); + goto erret; + } + } + else + /* overwrite existing dict entry */ + clear_tv(&fudi.fd_di->di_tv); + fudi.fd_di->di_tv.v_type = VAR_FUNC; + fudi.fd_di->di_tv.v_lock = 0; + fudi.fd_di->di_tv.vval.v_string = vim_strsave(name); + + /* behave like "dict" was used */ + flags |= FC_DICT; + } + + /* insert the new function in the function list */ + STRCPY(fp->uf_name, name); + if (overwrite) + { + hi = hash_find(&func_hashtab, name); + hi->hi_key = UF2HIKEY(fp); + } + else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) + { + vim_free(fp); + goto erret; + } + fp->uf_refcount = 1; + } + fp->uf_args = newargs; + fp->uf_lines = newlines; + if ((flags & FC_CLOSURE) != 0) + { + if (register_closure(fp) == FAIL) + goto erret; + } + else + fp->uf_scoped = NULL; + +#ifdef FEAT_PROFILE + fp->uf_tml_count = NULL; + fp->uf_tml_total = NULL; + fp->uf_tml_self = NULL; + fp->uf_profiling = FALSE; + if (prof_def_func()) + func_do_profile(fp); +#endif + fp->uf_varargs = varargs; + fp->uf_flags = flags; + fp->uf_calls = 0; + fp->uf_script_ID = current_SID; + goto ret_free; + +erret: + ga_clear_strings(&newargs); +errret_2: + ga_clear_strings(&newlines); +ret_free: + vim_free(skip_until); + vim_free(line_to_free); + vim_free(fudi.fd_newkey); + vim_free(name); + did_emsg |= saved_did_emsg; + need_wait_return |= saved_wait_return; +} + +/* + * Return 5 if "p" starts with "<SID>" or "<SNR>" (ignoring case). + * Return 2 if "p" starts with "s:". + * Return 0 otherwise. + */ + int +eval_fname_script(char_u *p) +{ + /* Use MB_STRICMP() because in Turkish comparing the "I" may not work with + * the standard library function. */ + if (p[0] == '<' && (MB_STRNICMP(p + 1, "SID>", 4) == 0 + || MB_STRNICMP(p + 1, "SNR>", 4) == 0)) + return 5; + if (p[0] == 's' && p[1] == ':') + return 2; + return 0; +} + + int +translated_function_exists(char_u *name) +{ + if (builtin_function(name, -1)) + return find_internal_func(name) >= 0; + return find_func(name) != NULL; +} + +/* + * Return TRUE if a function "name" exists. + * If "no_defef" is TRUE, do not dereference a Funcref. + */ + int +function_exists(char_u *name, int no_deref) +{ + char_u *nm = name; + char_u *p; + int n = FALSE; + int flag; + + flag = TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD; + if (no_deref) + flag |= TFN_NO_DEREF; + p = trans_function_name(&nm, FALSE, flag, NULL, NULL); + nm = skipwhite(nm); + + /* Only accept "funcname", "funcname ", "funcname (..." and + * "funcname(...", not "funcname!...". */ + if (p != NULL && (*nm == NUL || *nm == '(')) + n = translated_function_exists(p); + vim_free(p); + return n; +} + + char_u * +get_expanded_name(char_u *name, int check) +{ + char_u *nm = name; + char_u *p; + + p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL, NULL); + + if (p != NULL && *nm == NUL) + if (!check || translated_function_exists(p)) + return p; + + vim_free(p); + return NULL; +} + +#if defined(FEAT_PROFILE) || defined(PROTO) +/* + * Start profiling function "fp". + */ + static void +func_do_profile(ufunc_T *fp) +{ + int len = fp->uf_lines.ga_len; + + if (len == 0) + len = 1; /* avoid getting error for allocating zero bytes */ + fp->uf_tm_count = 0; + profile_zero(&fp->uf_tm_self); + profile_zero(&fp->uf_tm_total); + if (fp->uf_tml_count == NULL) + fp->uf_tml_count = (int *)alloc_clear((unsigned) (sizeof(int) * len)); + if (fp->uf_tml_total == NULL) + fp->uf_tml_total = (proftime_T *)alloc_clear((unsigned) + (sizeof(proftime_T) * len)); + if (fp->uf_tml_self == NULL) + fp->uf_tml_self = (proftime_T *)alloc_clear((unsigned) + (sizeof(proftime_T) * len)); + fp->uf_tml_idx = -1; + if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL + || fp->uf_tml_self == NULL) + return; /* out of memory */ + + fp->uf_profiling = TRUE; +} + +/* + * Dump the profiling results for all functions in file "fd". + */ + void +func_dump_profile(FILE *fd) +{ + hashitem_T *hi; + int todo; + ufunc_T *fp; + int i; + ufunc_T **sorttab; + int st_len = 0; + + todo = (int)func_hashtab.ht_used; + if (todo == 0) + return; /* nothing to dump */ + + sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T *) * todo)); + + for (hi = func_hashtab.ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + fp = HI2UF(hi); + if (fp->uf_profiling) + { + if (sorttab != NULL) + sorttab[st_len++] = fp; + + if (fp->uf_name[0] == K_SPECIAL) + fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3); + else + fprintf(fd, "FUNCTION %s()\n", fp->uf_name); + if (fp->uf_tm_count == 1) + fprintf(fd, "Called 1 time\n"); + else + fprintf(fd, "Called %d times\n", fp->uf_tm_count); + fprintf(fd, "Total time: %s\n", profile_msg(&fp->uf_tm_total)); + fprintf(fd, " Self time: %s\n", profile_msg(&fp->uf_tm_self)); + fprintf(fd, "\n"); + fprintf(fd, "count total (s) self (s)\n"); + + for (i = 0; i < fp->uf_lines.ga_len; ++i) + { + if (FUNCLINE(fp, i) == NULL) + continue; + prof_func_line(fd, fp->uf_tml_count[i], + &fp->uf_tml_total[i], &fp->uf_tml_self[i], TRUE); + fprintf(fd, "%s\n", FUNCLINE(fp, i)); + } + fprintf(fd, "\n"); + } + } + } + + if (sorttab != NULL && st_len > 0) + { + qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *), + prof_total_cmp); + prof_sort_list(fd, sorttab, st_len, "TOTAL", FALSE); + qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *), + prof_self_cmp); + prof_sort_list(fd, sorttab, st_len, "SELF", TRUE); + } + + vim_free(sorttab); +} + + static void +prof_sort_list( + FILE *fd, + ufunc_T **sorttab, + int st_len, + char *title, + int prefer_self) /* when equal print only self time */ +{ + int i; + ufunc_T *fp; + + fprintf(fd, "FUNCTIONS SORTED ON %s TIME\n", title); + fprintf(fd, "count total (s) self (s) function\n"); + for (i = 0; i < 20 && i < st_len; ++i) + { + fp = sorttab[i]; + prof_func_line(fd, fp->uf_tm_count, &fp->uf_tm_total, &fp->uf_tm_self, + prefer_self); + if (fp->uf_name[0] == K_SPECIAL) + fprintf(fd, " <SNR>%s()\n", fp->uf_name + 3); + else + fprintf(fd, " %s()\n", fp->uf_name); + } + fprintf(fd, "\n"); +} + +/* + * Print the count and times for one function or function line. + */ + static void +prof_func_line( + FILE *fd, + int count, + proftime_T *total, + proftime_T *self, + int prefer_self) /* when equal print only self time */ +{ + if (count > 0) + { + fprintf(fd, "%5d ", count); + if (prefer_self && profile_equal(total, self)) + fprintf(fd, " "); + else + fprintf(fd, "%s ", profile_msg(total)); + if (!prefer_self && profile_equal(total, self)) + fprintf(fd, " "); + else + fprintf(fd, "%s ", profile_msg(self)); + } + else + fprintf(fd, " "); +} + +/* + * Compare function for total time sorting. + */ + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +prof_total_cmp(const void *s1, const void *s2) +{ + ufunc_T *p1, *p2; + + p1 = *(ufunc_T **)s1; + p2 = *(ufunc_T **)s2; + return profile_cmp(&p1->uf_tm_total, &p2->uf_tm_total); +} + +/* + * Compare function for self time sorting. + */ + static int +#ifdef __BORLANDC__ +_RTLENTRYF +#endif +prof_self_cmp(const void *s1, const void *s2) +{ + ufunc_T *p1, *p2; + + p1 = *(ufunc_T **)s1; + p2 = *(ufunc_T **)s2; + return profile_cmp(&p1->uf_tm_self, &p2->uf_tm_self); +} + +/* + * Prepare profiling for entering a child or something else that is not + * counted for the script/function itself. + * Should always be called in pair with prof_child_exit(). + */ + void +prof_child_enter( + proftime_T *tm) /* place to store waittime */ +{ + funccall_T *fc = current_funccal; + + if (fc != NULL && fc->func->uf_profiling) + profile_start(&fc->prof_child); + script_prof_save(tm); +} + +/* + * Take care of time spent in a child. + * Should always be called after prof_child_enter(). + */ + void +prof_child_exit( + proftime_T *tm) /* where waittime was stored */ +{ + funccall_T *fc = current_funccal; + + if (fc != NULL && fc->func->uf_profiling) + { + profile_end(&fc->prof_child); + profile_sub_wait(tm, &fc->prof_child); /* don't count waiting time */ + profile_add(&fc->func->uf_tm_children, &fc->prof_child); + profile_add(&fc->func->uf_tml_children, &fc->prof_child); + } + script_prof_restore(tm); +} + +#endif /* FEAT_PROFILE */ + +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) + +/* + * Function given to ExpandGeneric() to obtain the list of user defined + * function names. + */ + char_u * +get_user_func_name(expand_T *xp, int idx) +{ + static long_u done; + static hashitem_T *hi; + ufunc_T *fp; + + if (idx == 0) + { + done = 0; + hi = func_hashtab.ht_array; + } + if (done < func_hashtab.ht_used) + { + if (done++ > 0) + ++hi; + while (HASHITEM_EMPTY(hi)) + ++hi; + fp = HI2UF(hi); + + if ((fp->uf_flags & FC_DICT) + || STRNCMP(fp->uf_name, "<lambda>", 8) == 0) + return (char_u *)""; /* don't show dict and lambda functions */ + + if (STRLEN(fp->uf_name) + 4 >= IOSIZE) + return fp->uf_name; /* prevents overflow */ + + cat_func_name(IObuff, fp); + if (xp->xp_context != EXPAND_USER_FUNC) + { + STRCAT(IObuff, "("); + if (!fp->uf_varargs && fp->uf_args.ga_len == 0) + STRCAT(IObuff, ")"); + } + return IObuff; + } + return NULL; +} + +#endif /* FEAT_CMDL_COMPL */ + +/* + * ":delfunction {name}" + */ + void +ex_delfunction(exarg_T *eap) +{ + ufunc_T *fp = NULL; + char_u *p; + char_u *name; + funcdict_T fudi; + + p = eap->arg; + name = trans_function_name(&p, eap->skip, 0, &fudi, NULL); + vim_free(fudi.fd_newkey); + if (name == NULL) + { + if (fudi.fd_dict != NULL && !eap->skip) + EMSG(_(e_funcref)); + return; + } + if (!ends_excmd(*skipwhite(p))) + { + vim_free(name); + EMSG(_(e_trailing)); + return; + } + eap->nextcmd = check_nextcmd(p); + if (eap->nextcmd != NULL) + *p = NUL; + + if (!eap->skip) + fp = find_func(name); + vim_free(name); + + if (!eap->skip) + { + if (fp == NULL) + { + if (!eap->forceit) + EMSG2(_(e_nofunc), eap->arg); + return; + } + if (fp->uf_calls > 0) + { + EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg); + return; + } + + if (fudi.fd_dict != NULL) + { + /* Delete the dict item that refers to the function, it will + * invoke func_unref() and possibly delete the function. */ + dictitem_remove(fudi.fd_dict, fudi.fd_di); + } + else + { + /* A normal function (not a numbered function or lambda) has a + * refcount of 1 for the entry in the hashtable. When deleting + * it and the refcount is more than one, it should be kept. + * A numbered function and lambda should be kept if the refcount is + * one or more. */ + if (fp->uf_refcount > (func_name_refcount(fp->uf_name) ? 0 : 1)) + { + /* Function is still referenced somewhere. Don't free it but + * do remove it from the hashtable. */ + if (func_remove(fp)) + fp->uf_refcount--; + fp->uf_flags |= FC_DELETED; + } + else + func_clear_free(fp, FALSE); + } + } +} + +/* + * Unreference a Function: decrement the reference count and free it when it + * becomes zero. + */ + void +func_unref(char_u *name) +{ + ufunc_T *fp = NULL; + + if (name == NULL || !func_name_refcount(name)) + return; + fp = find_func(name); + if (fp == NULL && isdigit(*name)) + { +#ifdef EXITFREE + if (!entered_free_all_mem) +#endif + internal_error("func_unref()"); + } + if (fp != NULL && --fp->uf_refcount <= 0) + { + /* Only delete it when it's not being used. Otherwise it's done + * when "uf_calls" becomes zero. */ + if (fp->uf_calls == 0) + func_clear_free(fp, FALSE); + } +} + +/* + * Unreference a Function: decrement the reference count and free it when it + * becomes zero. + */ + void +func_ptr_unref(ufunc_T *fp) +{ + if (fp != NULL && --fp->uf_refcount <= 0) + { + /* Only delete it when it's not being used. Otherwise it's done + * when "uf_calls" becomes zero. */ + if (fp->uf_calls == 0) + func_clear_free(fp, FALSE); + } +} + +/* + * Count a reference to a Function. + */ + void +func_ref(char_u *name) +{ + ufunc_T *fp; + + if (name == NULL || !func_name_refcount(name)) + return; + fp = find_func(name); + if (fp != NULL) + ++fp->uf_refcount; + else if (isdigit(*name)) + /* Only give an error for a numbered function. + * Fail silently, when named or lambda function isn't found. */ + internal_error("func_ref()"); +} + +/* + * Count a reference to a Function. + */ + void +func_ptr_ref(ufunc_T *fp) +{ + if (fp != NULL) + ++fp->uf_refcount; +} + +/* + * Return TRUE if items in "fc" do not have "copyID". That means they are not + * referenced from anywhere that is in use. + */ + static int +can_free_funccal(funccall_T *fc, int copyID) +{ + return (fc->l_varlist.lv_copyID != copyID + && fc->l_vars.dv_copyID != copyID + && fc->l_avars.dv_copyID != copyID + && fc->fc_copyID != copyID); +} + +/* + * ":return [expr]" + */ + void +ex_return(exarg_T *eap) +{ + char_u *arg = eap->arg; + typval_T rettv; + int returning = FALSE; + + if (current_funccal == NULL) + { + EMSG(_("E133: :return not inside a function")); + return; + } + + if (eap->skip) + ++emsg_skip; + + eap->nextcmd = NULL; + if ((*arg != NUL && *arg != '|' && *arg != '\n') + && eval0(arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) + { + if (!eap->skip) + returning = do_return(eap, FALSE, TRUE, &rettv); + else + clear_tv(&rettv); + } + /* It's safer to return also on error. */ + else if (!eap->skip) + { + /* In return statement, cause_abort should be force_abort. */ + update_force_abort(); + + /* + * Return unless the expression evaluation has been cancelled due to an + * aborting error, an interrupt, or an exception. + */ + if (!aborting()) + returning = do_return(eap, FALSE, TRUE, NULL); + } + + /* When skipping or the return gets pending, advance to the next command + * in this line (!returning). Otherwise, ignore the rest of the line. + * Following lines will be ignored by get_func_line(). */ + if (returning) + eap->nextcmd = NULL; + else if (eap->nextcmd == NULL) /* no argument */ + eap->nextcmd = check_nextcmd(arg); + + if (eap->skip) + --emsg_skip; +} + +/* + * ":1,25call func(arg1, arg2)" function call. + */ + void +ex_call(exarg_T *eap) +{ + char_u *arg = eap->arg; + char_u *startarg; + char_u *name; + char_u *tofree; + int len; + typval_T rettv; + linenr_T lnum; + int doesrange; + int failed = FALSE; + funcdict_T fudi; + partial_T *partial = NULL; + + if (eap->skip) + { + /* trans_function_name() doesn't work well when skipping, use eval0() + * instead to skip to any following command, e.g. for: + * :if 0 | call dict.foo().bar() | endif */ + ++emsg_skip; + if (eval0(eap->arg, &rettv, &eap->nextcmd, FALSE) != FAIL) + clear_tv(&rettv); + --emsg_skip; + return; + } + + tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi, &partial); + if (fudi.fd_newkey != NULL) + { + /* Still need to give an error message for missing key. */ + EMSG2(_(e_dictkey), fudi.fd_newkey); + vim_free(fudi.fd_newkey); + } + if (tofree == NULL) + return; + + /* Increase refcount on dictionary, it could get deleted when evaluating + * the arguments. */ + if (fudi.fd_dict != NULL) + ++fudi.fd_dict->dv_refcount; + + /* If it is the name of a variable of type VAR_FUNC or VAR_PARTIAL use its + * contents. For VAR_PARTIAL get its partial, unless we already have one + * from trans_function_name(). */ + len = (int)STRLEN(tofree); + name = deref_func_name(tofree, &len, + partial != NULL ? NULL : &partial, FALSE); + + /* Skip white space to allow ":call func ()". Not good, but required for + * backward compatibility. */ + startarg = skipwhite(arg); + rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ + + if (*startarg != '(') + { + EMSG2(_("E107: Missing parentheses: %s"), eap->arg); + goto end; + } + + /* + * When skipping, evaluate the function once, to find the end of the + * arguments. + * When the function takes a range, this is discovered after the first + * call, and the loop is broken. + */ + if (eap->skip) + { + ++emsg_skip; + lnum = eap->line2; /* do it once, also with an invalid range */ + } + else + lnum = eap->line1; + for ( ; lnum <= eap->line2; ++lnum) + { + if (!eap->skip && eap->addr_count > 0) + { + curwin->w_cursor.lnum = lnum; + curwin->w_cursor.col = 0; +#ifdef FEAT_VIRTUALEDIT + curwin->w_cursor.coladd = 0; +#endif + } + arg = startarg; + if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg, + eap->line1, eap->line2, &doesrange, + !eap->skip, partial, fudi.fd_dict) == FAIL) + { + failed = TRUE; + break; + } + if (has_watchexpr()) + dbg_check_breakpoint(eap); + + /* Handle a function returning a Funcref, Dictionary or List. */ + if (handle_subscript(&arg, &rettv, !eap->skip, TRUE) == FAIL) + { + failed = TRUE; + break; + } + + clear_tv(&rettv); + if (doesrange || eap->skip) + break; + + /* Stop when immediately aborting on error, or when an interrupt + * occurred or an exception was thrown but not caught. + * get_func_tv() returned OK, so that the check for trailing + * characters below is executed. */ + if (aborting()) + break; + } + if (eap->skip) + --emsg_skip; + + if (!failed) + { + /* Check for trailing illegal characters and a following command. */ + if (!ends_excmd(*arg)) + { + emsg_severe = TRUE; + EMSG(_(e_trailing)); + } + else + eap->nextcmd = check_nextcmd(arg); + } + +end: + dict_unref(fudi.fd_dict); + vim_free(tofree); +} + +/* + * Return from a function. Possibly makes the return pending. Also called + * for a pending return at the ":endtry" or after returning from an extra + * do_cmdline(). "reanimate" is used in the latter case. "is_cmd" is set + * when called due to a ":return" command. "rettv" may point to a typval_T + * with the return rettv. Returns TRUE when the return can be carried out, + * FALSE when the return gets pending. + */ + int +do_return( + exarg_T *eap, + int reanimate, + int is_cmd, + void *rettv) +{ + int idx; + struct condstack *cstack = eap->cstack; + + if (reanimate) + /* Undo the return. */ + current_funccal->returned = FALSE; + + /* + * Cleanup (and inactivate) conditionals, but stop when a try conditional + * not in its finally clause (which then is to be executed next) is found. + * In this case, make the ":return" pending for execution at the ":endtry". + * Otherwise, return normally. + */ + idx = cleanup_conditionals(eap->cstack, 0, TRUE); + if (idx >= 0) + { + cstack->cs_pending[idx] = CSTP_RETURN; + + if (!is_cmd && !reanimate) + /* A pending return again gets pending. "rettv" points to an + * allocated variable with the rettv of the original ":return"'s + * argument if present or is NULL else. */ + cstack->cs_rettv[idx] = rettv; + else + { + /* When undoing a return in order to make it pending, get the stored + * return rettv. */ + if (reanimate) + rettv = current_funccal->rettv; + + if (rettv != NULL) + { + /* Store the value of the pending return. */ + if ((cstack->cs_rettv[idx] = alloc_tv()) != NULL) + *(typval_T *)cstack->cs_rettv[idx] = *(typval_T *)rettv; + else + EMSG(_(e_outofmem)); + } + else + cstack->cs_rettv[idx] = NULL; + + if (reanimate) + { + /* The pending return value could be overwritten by a ":return" + * without argument in a finally clause; reset the default + * return value. */ + current_funccal->rettv->v_type = VAR_NUMBER; + current_funccal->rettv->vval.v_number = 0; + } + } + report_make_pending(CSTP_RETURN, rettv); + } + else + { + current_funccal->returned = TRUE; + + /* If the return is carried out now, store the return value. For + * a return immediately after reanimation, the value is already + * there. */ + if (!reanimate && rettv != NULL) + { + clear_tv(current_funccal->rettv); + *current_funccal->rettv = *(typval_T *)rettv; + if (!is_cmd) + vim_free(rettv); + } + } + + return idx < 0; +} + +/* + * Free the variable with a pending return value. + */ + void +discard_pending_return(void *rettv) +{ + free_tv((typval_T *)rettv); +} + +/* + * Generate a return command for producing the value of "rettv". The result + * is an allocated string. Used by report_pending() for verbose messages. + */ + char_u * +get_return_cmd(void *rettv) +{ + char_u *s = NULL; + char_u *tofree = NULL; + char_u numbuf[NUMBUFLEN]; + + if (rettv != NULL) + s = echo_string((typval_T *)rettv, &tofree, numbuf, 0); + if (s == NULL) + s = (char_u *)""; + + STRCPY(IObuff, ":return "); + STRNCPY(IObuff + 8, s, IOSIZE - 8); + if (STRLEN(s) + 8 >= IOSIZE) + STRCPY(IObuff + IOSIZE - 4, "..."); + vim_free(tofree); + return vim_strsave(IObuff); +} + +/* + * Get next function line. + * Called by do_cmdline() to get the next line. + * Returns allocated string, or NULL for end of function. + */ + char_u * +get_func_line( + int c UNUSED, + void *cookie, + int indent UNUSED) +{ + funccall_T *fcp = (funccall_T *)cookie; + ufunc_T *fp = fcp->func; + char_u *retval; + garray_T *gap; /* growarray with function lines */ + + /* If breakpoints have been added/deleted need to check for it. */ + if (fcp->dbg_tick != debug_tick) + { + fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, + sourcing_lnum); + fcp->dbg_tick = debug_tick; + } +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + func_line_end(cookie); +#endif + + gap = &fp->uf_lines; + if (((fp->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) + || fcp->returned) + retval = NULL; + else + { + /* Skip NULL lines (continuation lines). */ + while (fcp->linenr < gap->ga_len + && ((char_u **)(gap->ga_data))[fcp->linenr] == NULL) + ++fcp->linenr; + if (fcp->linenr >= gap->ga_len) + retval = NULL; + else + { + retval = vim_strsave(((char_u **)(gap->ga_data))[fcp->linenr++]); + sourcing_lnum = fcp->linenr; +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + func_line_start(cookie); +#endif + } + } + + /* Did we encounter a breakpoint? */ + if (fcp->breakpoint != 0 && fcp->breakpoint <= sourcing_lnum) + { + dbg_breakpoint(fp->uf_name, sourcing_lnum); + /* Find next breakpoint. */ + fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, + sourcing_lnum); + fcp->dbg_tick = debug_tick; + } + + return retval; +} + +#if defined(FEAT_PROFILE) || defined(PROTO) +/* + * Called when starting to read a function line. + * "sourcing_lnum" must be correct! + * When skipping lines it may not actually be executed, but we won't find out + * until later and we need to store the time now. + */ + void +func_line_start(void *cookie) +{ + funccall_T *fcp = (funccall_T *)cookie; + ufunc_T *fp = fcp->func; + + if (fp->uf_profiling && sourcing_lnum >= 1 + && sourcing_lnum <= fp->uf_lines.ga_len) + { + fp->uf_tml_idx = sourcing_lnum - 1; + /* Skip continuation lines. */ + while (fp->uf_tml_idx > 0 && FUNCLINE(fp, fp->uf_tml_idx) == NULL) + --fp->uf_tml_idx; + fp->uf_tml_execed = FALSE; + profile_start(&fp->uf_tml_start); + profile_zero(&fp->uf_tml_children); + profile_get_wait(&fp->uf_tml_wait); + } +} + +/* + * Called when actually executing a function line. + */ + void +func_line_exec(void *cookie) +{ + funccall_T *fcp = (funccall_T *)cookie; + ufunc_T *fp = fcp->func; + + if (fp->uf_profiling && fp->uf_tml_idx >= 0) + fp->uf_tml_execed = TRUE; +} + +/* + * Called when done with a function line. + */ + void +func_line_end(void *cookie) +{ + funccall_T *fcp = (funccall_T *)cookie; + ufunc_T *fp = fcp->func; + + if (fp->uf_profiling && fp->uf_tml_idx >= 0) + { + if (fp->uf_tml_execed) + { + ++fp->uf_tml_count[fp->uf_tml_idx]; + profile_end(&fp->uf_tml_start); + profile_sub_wait(&fp->uf_tml_wait, &fp->uf_tml_start); + profile_add(&fp->uf_tml_total[fp->uf_tml_idx], &fp->uf_tml_start); + profile_self(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_start, + &fp->uf_tml_children); + } + fp->uf_tml_idx = -1; + } +} +#endif + +/* + * Return TRUE if the currently active function should be ended, because a + * return was encountered or an error occurred. Used inside a ":while". + */ + int +func_has_ended(void *cookie) +{ + funccall_T *fcp = (funccall_T *)cookie; + + /* Ignore the "abort" flag if the abortion behavior has been changed due to + * an error inside a try conditional. */ + return (((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) + || fcp->returned); +} + +/* + * return TRUE if cookie indicates a function which "abort"s on errors. + */ + int +func_has_abort( + void *cookie) +{ + return ((funccall_T *)cookie)->func->uf_flags & FC_ABORT; +} + + +/* + * Turn "dict.Func" into a partial for "Func" bound to "dict". + * Don't do this when "Func" is already a partial that was bound + * explicitly (pt_auto is FALSE). + * Changes "rettv" in-place. + * Returns the updated "selfdict_in". + */ + dict_T * +make_partial(dict_T *selfdict_in, typval_T *rettv) +{ + char_u *fname; + char_u *tofree = NULL; + ufunc_T *fp; + char_u fname_buf[FLEN_FIXED + 1]; + int error; + dict_T *selfdict = selfdict_in; + + if (rettv->v_type == VAR_PARTIAL && rettv->vval.v_partial->pt_func != NULL) + fp = rettv->vval.v_partial->pt_func; + else + { + fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string + : rettv->vval.v_partial->pt_name; + /* Translate "s:func" to the stored function name. */ + fname = fname_trans_sid(fname, fname_buf, &tofree, &error); + fp = find_func(fname); + vim_free(tofree); + } + + if (fp != NULL && (fp->uf_flags & FC_DICT)) + { + partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T)); + + if (pt != NULL) + { + pt->pt_refcount = 1; + pt->pt_dict = selfdict; + pt->pt_auto = TRUE; + selfdict = NULL; + if (rettv->v_type == VAR_FUNC) + { + /* Just a function: Take over the function name and use + * selfdict. */ + pt->pt_name = rettv->vval.v_string; + } + else + { + partial_T *ret_pt = rettv->vval.v_partial; + int i; + + /* Partial: copy the function name, use selfdict and copy + * args. Can't take over name or args, the partial might + * be referenced elsewhere. */ + if (ret_pt->pt_name != NULL) + { + pt->pt_name = vim_strsave(ret_pt->pt_name); + func_ref(pt->pt_name); + } + else + { + pt->pt_func = ret_pt->pt_func; + func_ptr_ref(pt->pt_func); + } + if (ret_pt->pt_argc > 0) + { + pt->pt_argv = (typval_T *)alloc( + sizeof(typval_T) * ret_pt->pt_argc); + if (pt->pt_argv == NULL) + /* out of memory: drop the arguments */ + pt->pt_argc = 0; + else + { + pt->pt_argc = ret_pt->pt_argc; + for (i = 0; i < pt->pt_argc; i++) + copy_tv(&ret_pt->pt_argv[i], &pt->pt_argv[i]); + } + } + partial_unref(ret_pt); + } + rettv->v_type = VAR_PARTIAL; + rettv->vval.v_partial = pt; + } + } + return selfdict; +} + +/* + * Return the name of the executed function. + */ + char_u * +func_name(void *cookie) +{ + return ((funccall_T *)cookie)->func->uf_name; +} + +/* + * Return the address holding the next breakpoint line for a funccall cookie. + */ + linenr_T * +func_breakpoint(void *cookie) +{ + return &((funccall_T *)cookie)->breakpoint; +} + +/* + * Return the address holding the debug tick for a funccall cookie. + */ + int * +func_dbg_tick(void *cookie) +{ + return &((funccall_T *)cookie)->dbg_tick; +} + +/* + * Return the nesting level for a funccall cookie. + */ + int +func_level(void *cookie) +{ + return ((funccall_T *)cookie)->level; +} + +/* + * Return TRUE when a function was ended by a ":return" command. + */ + int +current_func_returned(void) +{ + return current_funccal->returned; +} + +/* + * Save the current function call pointer, and set it to NULL. + * Used when executing autocommands and for ":source". + */ + void * +save_funccal(void) +{ + funccall_T *fc = current_funccal; + + current_funccal = NULL; + return (void *)fc; +} + + void +restore_funccal(void *vfc) +{ + funccall_T *fc = (funccall_T *)vfc; + + current_funccal = fc; +} + + int +free_unref_funccal(int copyID, int testing) +{ + int did_free = FALSE; + int did_free_funccal = FALSE; + funccall_T *fc, **pfc; + + for (pfc = &previous_funccal; *pfc != NULL; ) + { + if (can_free_funccal(*pfc, copyID)) + { + fc = *pfc; + *pfc = fc->caller; + free_funccal(fc, TRUE); + did_free = TRUE; + did_free_funccal = TRUE; + } + else + pfc = &(*pfc)->caller; + } + if (did_free_funccal) + /* When a funccal was freed some more items might be garbage + * collected, so run again. */ + (void)garbage_collect(testing); + + return did_free; +} + +/* + * Get function call environment based on backtrace debug level + */ + static funccall_T * +get_funccal(void) +{ + int i; + funccall_T *funccal; + funccall_T *temp_funccal; + + funccal = current_funccal; + if (debug_backtrace_level > 0) + { + for (i = 0; i < debug_backtrace_level; i++) + { + temp_funccal = funccal->caller; + if (temp_funccal) + funccal = temp_funccal; + else + /* backtrace level overflow. reset to max */ + debug_backtrace_level = i; + } + } + return funccal; +} + +/* + * Return the hashtable used for local variables in the current funccal. + * Return NULL if there is no current funccal. + */ + hashtab_T * +get_funccal_local_ht() +{ + if (current_funccal == NULL) + return NULL; + return &get_funccal()->l_vars.dv_hashtab; +} + +/* + * Return the l: scope variable. + * Return NULL if there is no current funccal. + */ + dictitem_T * +get_funccal_local_var() +{ + if (current_funccal == NULL) + return NULL; + return &get_funccal()->l_vars_var; +} + +/* + * Return the hashtable used for argument in the current funccal. + * Return NULL if there is no current funccal. + */ + hashtab_T * +get_funccal_args_ht() +{ + if (current_funccal == NULL) + return NULL; + return &get_funccal()->l_avars.dv_hashtab; +} + +/* + * Return the a: scope variable. + * Return NULL if there is no current funccal. + */ + dictitem_T * +get_funccal_args_var() +{ + if (current_funccal == NULL) + return NULL; + return &get_funccal()->l_avars_var; +} + +/* + * Clear the current_funccal and return the old value. + * Caller is expected to invoke restore_current_funccal(). + */ + void * +clear_current_funccal() +{ + funccall_T *f = current_funccal; + + current_funccal = NULL; + return f; +} + + void +restore_current_funccal(void *f) +{ + current_funccal = f; +} + +/* + * List function variables, if there is a function. + */ + void +list_func_vars(int *first) +{ + if (current_funccal != NULL) + list_hashtable_vars(¤t_funccal->l_vars.dv_hashtab, + (char_u *)"l:", FALSE, first); +} + +/* + * If "ht" is the hashtable for local variables in the current funccal, return + * the dict that contains it. + * Otherwise return NULL. + */ + dict_T * +get_current_funccal_dict(hashtab_T *ht) +{ + if (current_funccal != NULL + && ht == ¤t_funccal->l_vars.dv_hashtab) + return ¤t_funccal->l_vars; + return NULL; +} + +/* + * Search hashitem in parent scope. + */ + hashitem_T * +find_hi_in_scoped_ht(char_u *name, hashtab_T **pht) +{ + funccall_T *old_current_funccal = current_funccal; + hashtab_T *ht; + hashitem_T *hi = NULL; + char_u *varname; + + if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) + return NULL; + + /* Search in parent scope which is possible to reference from lambda */ + current_funccal = current_funccal->func->uf_scoped; + while (current_funccal != NULL) + { + ht = find_var_ht(name, &varname); + if (ht != NULL && *varname != NUL) + { + hi = hash_find(ht, varname); + if (!HASHITEM_EMPTY(hi)) + { + *pht = ht; + break; + } + } + if (current_funccal == current_funccal->func->uf_scoped) + break; + current_funccal = current_funccal->func->uf_scoped; + } + current_funccal = old_current_funccal; + + return hi; +} + +/* + * Search variable in parent scope. + */ + dictitem_T * +find_var_in_scoped_ht(char_u *name, int no_autoload) +{ + dictitem_T *v = NULL; + funccall_T *old_current_funccal = current_funccal; + hashtab_T *ht; + char_u *varname; + + if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) + return NULL; + + /* Search in parent scope which is possible to reference from lambda */ + current_funccal = current_funccal->func->uf_scoped; + while (current_funccal) + { + ht = find_var_ht(name, &varname); + if (ht != NULL && *varname != NUL) + { + v = find_var_in_ht(ht, *name, varname, no_autoload); + if (v != NULL) + break; + } + if (current_funccal == current_funccal->func->uf_scoped) + break; + current_funccal = current_funccal->func->uf_scoped; + } + current_funccal = old_current_funccal; + + return v; +} + +/* + * Set "copyID + 1" in previous_funccal and callers. + */ + int +set_ref_in_previous_funccal(int copyID) +{ + int abort = FALSE; + funccall_T *fc; + + for (fc = previous_funccal; fc != NULL; fc = fc->caller) + { + fc->fc_copyID = copyID + 1; + abort = abort || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1, + NULL); + abort = abort || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1, + NULL); + } + return abort; +} + + static int +set_ref_in_funccal(funccall_T *fc, int copyID) +{ + int abort = FALSE; + + if (fc->fc_copyID != copyID) + { + fc->fc_copyID = copyID; + abort = abort || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID, NULL); + abort = abort || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID, NULL); + abort = abort || set_ref_in_func(NULL, fc->func, copyID); + } + return abort; +} + +/* + * Set "copyID" in all local vars and arguments in the call stack. + */ + int +set_ref_in_call_stack(int copyID) +{ + int abort = FALSE; + funccall_T *fc; + + for (fc = current_funccal; fc != NULL; fc = fc->caller) + abort = abort || set_ref_in_funccal(fc, copyID); + return abort; +} + +/* + * Set "copyID" in all functions available by name. + */ + int +set_ref_in_functions(int copyID) +{ + int todo; + hashitem_T *hi = NULL; + int abort = FALSE; + ufunc_T *fp; + + todo = (int)func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + fp = HI2UF(hi); + if (!func_name_refcount(fp->uf_name)) + abort = abort || set_ref_in_func(NULL, fp, copyID); + } + } + return abort; +} + +/* + * Set "copyID" in all function arguments. + */ + int +set_ref_in_func_args(int copyID) +{ + int i; + int abort = FALSE; + + for (i = 0; i < funcargs.ga_len; ++i) + abort = abort || set_ref_in_item(((typval_T **)funcargs.ga_data)[i], + copyID, NULL, NULL); + return abort; +} + +/* + * Mark all lists and dicts referenced through function "name" with "copyID". + * Returns TRUE if setting references failed somehow. + */ + int +set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID) +{ + ufunc_T *fp = fp_in; + funccall_T *fc; + int error = ERROR_NONE; + char_u fname_buf[FLEN_FIXED + 1]; + char_u *tofree = NULL; + char_u *fname; + int abort = FALSE; + + if (name == NULL && fp_in == NULL) + return FALSE; + + if (fp_in == NULL) + { + fname = fname_trans_sid(name, fname_buf, &tofree, &error); + fp = find_func(fname); + } + if (fp != NULL) + { + for (fc = fp->uf_scoped; fc != NULL; fc = fc->func->uf_scoped) + abort = abort || set_ref_in_funccal(fc, copyID); + } + vim_free(tofree); + return abort; +} + +#endif /* FEAT_EVAL */ diff --git a/src/version.c b/src/version.c index 54f39b36cf..f49775e51f 100644 --- a/src/version.c +++ b/src/version.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -17,8 +17,9 @@ * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred) * It has been changed beyond recognition since then. * - * Differences between version 6.x and 7.x can be found with ":help version7". - * Differences between version 5.x and 6.x can be found with ":help version6". + * Differences between version 7.4 and 8.x can be found with ":help version8". + * Differences between version 6.4 and 7.x can be found with ":help version7". + * Differences between version 5.8 and 6.x can be found with ":help version6". * Differences between version 4.x and 5.x can be found with ":help version5". * Differences between version 3.0 and 4.x can be found with ":help version4". * All the remarks about older versions have been removed, they are not very @@ -36,7 +37,7 @@ char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__) + sizeof(__TIME__) + 3]; void -make_version() +make_version(void) { /* * Construct the long version string. Necessary because @@ -55,8 +56,7 @@ char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")"; char *longVersion = VIM_VERSION_LONG; #endif -static void list_features __ARGS((void)); -static void version_msg __ARGS((char *s)); +static void list_features(void); static char *(features[]) = { @@ -77,16 +77,22 @@ static char *(features[]) = #else "-arabic", #endif -#ifdef FEAT_AUTOCMD "+autocmd", +#ifdef FEAT_AUTOSERVERNAME + "+autoservername", #else - "-autocmd", + "-autoservername", #endif -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI "+balloon_eval", #else "-balloon_eval", #endif +#ifdef FEAT_BEVAL_TERM + "+balloon_eval_term", +#else + "-balloon_eval_term", +#endif #ifdef FEAT_BROWSE "+browse", #else @@ -106,6 +112,11 @@ static char *(features[]) = #else "-byte_offset", #endif +#ifdef FEAT_JOB_CHANNEL + "+channel", +#else + "-channel", +#endif #ifdef FEAT_CINDENT "+cindent", #else @@ -156,11 +167,7 @@ static char *(features[]) = #else "-cscope", #endif -#ifdef FEAT_CURSORBIND "+cursorbind", -#else - "-cursorbind", -#endif #ifdef CURSOR_SHAPE "+cursorshape", #else @@ -189,6 +196,13 @@ static char *(features[]) = #else "-digraphs", #endif +#ifdef FEAT_GUI_W32 +# ifdef FEAT_DIRECTX + "+directx", +# else + "-directx", +# endif +#endif #ifdef FEAT_DND "+dnd", #else @@ -209,11 +223,7 @@ static char *(features[]) = #else "-eval", #endif -#ifdef FEAT_EX_EXTRA "+ex_extra", -#else - "-ex_extra", -#endif #ifdef FEAT_SEARCH_EXTRA "+extra_search", #else @@ -267,6 +277,7 @@ static char *(features[]) = #else "-gettext", #endif + "+guess_encode", #ifdef FEAT_HANGULIN "+hangul_input", #else @@ -286,16 +297,27 @@ static char *(features[]) = #else "-insert_expand", #endif +#ifdef FEAT_JOB_CHANNEL + "+job", +#else + "-job", +#endif #ifdef FEAT_JUMPLIST "+jumplist", #else "-jumplist", #endif + "+kaoriya", #ifdef FEAT_KEYMAP "+keymap", #else "-keymap", #endif +#ifdef FEAT_EVAL + "+lambda", +#else + "-lambda", +#endif #ifdef FEAT_LANGMAP "+langmap", #else @@ -316,11 +338,7 @@ static char *(features[]) = #else "-lispindent", #endif -#ifdef FEAT_LISTCMDS "+listcmds", -#else - "-listcmds", -#endif #ifdef FEAT_LOCALMAP "+localmap", #else @@ -340,6 +358,15 @@ static char *(features[]) = #else "-menu", #endif +#ifdef USE_MIGEMO +# ifdef DYNAMIC_MIGEMO + "+migemo/dyn", +# else + "+migemo", +# endif +#else + "-migemo", +#endif #ifdef FEAT_SESSION "+mksession", #else @@ -447,6 +474,11 @@ static char *(features[]) = #else "-netbeans_intg", #endif +#ifdef FEAT_NUM64 + "+num64", +#else + "-num64", +#endif #ifdef FEAT_ODB_EDITOR "+odbeditor", #else @@ -459,6 +491,7 @@ static char *(features[]) = "-ole", # endif #endif + "+packages", #ifdef FEAT_PATH_EXTRA "+path_extra", #else @@ -535,11 +568,7 @@ static char *(features[]) = #else "-ruby", #endif -#ifdef FEAT_SCROLLBIND "+scrollbind", -#else - "-scrollbind", -#endif #ifdef FEAT_SIGNS "+signs", #else @@ -550,11 +579,6 @@ static char *(features[]) = #else "-smartindent", #endif -#ifdef FEAT_SNIFF - "+sniff", -#else - "-sniff", -#endif #ifdef STARTUPTIME "+startuptime", #else @@ -576,7 +600,7 @@ static char *(features[]) = "-syntax", #endif /* only interesting on Unix systems */ -#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__)) +#if defined(USE_SYSTEM) && defined(UNIX) "+system()", #endif #ifdef FEAT_TAG_BINS @@ -603,8 +627,18 @@ static char *(features[]) = #else "-tcl", #endif -#if defined(UNIX) || defined(__EMX__) -/* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */ +#ifdef FEAT_TERMGUICOLORS + "+termguicolors", +#else + "-termguicolors", +#endif +#ifdef FEAT_TERMINAL + "+terminal", +#else + "-terminal", +#endif +#if defined(UNIX) +/* only Unix can have terminfo instead of termcap */ # ifdef TERMINFO "+terminfo", # else @@ -627,6 +661,11 @@ static char *(features[]) = #else "-textobjects", #endif +#ifdef FEAT_TIMERS + "+timers", +#else + "-timers", +#endif #ifdef FEAT_TITLE "+title", #else @@ -647,11 +686,7 @@ static char *(features[]) = #else "-user_commands", #endif -#ifdef FEAT_VERTSPLIT "+vertsplit", -#else - "-vertsplit", -#endif #ifdef FEAT_VIRTUALEDIT "+virtualedit", #else @@ -673,6 +708,13 @@ static char *(features[]) = #else "-vreplace", #endif +#ifdef WIN3264 +# ifdef FEAT_VTP + "+vtp", +# else + "-vtp", +# endif +#endif #ifdef FEAT_WILDIGN "+wildignore", #else @@ -683,11 +725,7 @@ static char *(features[]) = #else "-wildmenu", #endif -#ifdef FEAT_WINDOWS "+windows", -#else - "-windows", -#endif #ifdef FEAT_WRITEBACKUP "+writebackup", #else @@ -710,6 +748,19 @@ static char *(features[]) = #else "-xim", #endif +#ifdef WIN3264 +# ifdef FEAT_XPM_W32 + "+xpm_w32", +# else + "-xpm_w32", +# endif +#else +# ifdef HAVE_XPM + "+xpm", +# else + "-xpm", +# endif +#endif #if defined(UNIX) || defined(VMS) # ifdef USE_XSMP_INTERACT "+xsmp_interact", @@ -730,647 +781,12 @@ static char *(features[]) = "+xterm_save", #else "-xterm_save", -#endif -#ifdef WIN3264 -# ifdef FEAT_XPM_W32 - "+xpm_w32", -# else - "-xpm_w32", -# endif -#else -# ifdef HAVE_XPM - "+xpm", -# else - "-xpm", -# endif #endif NULL }; static int included_patches[] = { /* Add new patch number below this line */ -/**/ - 383, -/**/ - 382, -/**/ - 381, -/**/ - 380, -/**/ - 379, -/**/ - 378, -/**/ - 377, -/**/ - 376, -/**/ - 375, -/**/ - 374, -/**/ - 373, -/**/ - 372, -/**/ - 371, -/**/ - 370, -/**/ - 369, -/**/ - 368, -/**/ - 367, -/**/ - 366, -/**/ - 365, -/**/ - 364, -/**/ - 363, -/**/ - 362, -/**/ - 361, -/**/ - 360, -/**/ - 359, -/**/ - 358, -/**/ - 357, -/**/ - 356, -/**/ - 355, -/**/ - 354, -/**/ - 353, -/**/ - 352, -/**/ - 351, -/**/ - 350, -/**/ - 349, -/**/ - 348, -/**/ - 347, -/**/ - 346, -/**/ - 345, -/**/ - 344, -/**/ - 343, -/**/ - 342, -/**/ - 341, -/**/ - 340, -/**/ - 339, -/**/ - 338, -/**/ - 337, -/**/ - 336, -/**/ - 335, -/**/ - 334, -/**/ - 333, -/**/ - 332, -/**/ - 331, -/**/ - 330, -/**/ - 329, -/**/ - 328, -/**/ - 327, -/**/ - 326, -/**/ - 325, -/**/ - 324, -/**/ - 323, -/**/ - 322, -/**/ - 321, -/**/ - 320, -/**/ - 319, -/**/ - 318, -/**/ - 317, -/**/ - 316, -/**/ - 315, -/**/ - 314, -/**/ - 313, -/**/ - 312, -/**/ - 311, -/**/ - 310, -/**/ - 309, -/**/ - 308, -/**/ - 307, -/**/ - 306, -/**/ - 305, -/**/ - 304, -/**/ - 303, -/**/ - 302, -/**/ - 301, -/**/ - 300, -/**/ - 299, -/**/ - 298, -/**/ - 297, -/**/ - 296, -/**/ - 295, -/**/ - 294, -/**/ - 293, -/**/ - 292, -/**/ - 291, -/**/ - 290, -/**/ - 289, -/**/ - 288, -/**/ - 287, -/**/ - 286, -/**/ - 285, -/**/ - 284, -/**/ - 283, -/**/ - 282, -/**/ - 281, -/**/ - 280, -/**/ - 279, -/**/ - 278, -/**/ - 277, -/**/ - 276, -/**/ - 275, -/**/ - 274, -/**/ - 273, -/**/ - 272, -/**/ - 271, -/**/ - 270, -/**/ - 269, -/**/ - 268, -/**/ - 267, -/**/ - 266, -/**/ - 265, -/**/ - 264, -/**/ - 263, -/**/ - 262, -/**/ - 261, -/**/ - 260, -/**/ - 259, -/**/ - 258, -/**/ - 257, -/**/ - 256, -/**/ - 255, -/**/ - 254, -/**/ - 253, -/**/ - 252, -/**/ - 251, -/**/ - 250, -/**/ - 249, -/**/ - 248, -/**/ - 247, -/**/ - 246, -/**/ - 245, -/**/ - 244, -/**/ - 243, -/**/ - 242, -/**/ - 241, -/**/ - 240, -/**/ - 239, -/**/ - 238, -/**/ - 237, -/**/ - 236, -/**/ - 235, -/**/ - 234, -/**/ - 233, -/**/ - 232, -/**/ - 231, -/**/ - 230, -/**/ - 229, -/**/ - 228, -/**/ - 227, -/**/ - 226, -/**/ - 225, -/**/ - 224, -/**/ - 223, -/**/ - 222, -/**/ - 221, -/**/ - 220, -/**/ - 219, -/**/ - 218, -/**/ - 217, -/**/ - 216, -/**/ - 215, -/**/ - 214, -/**/ - 213, -/**/ - 212, -/**/ - 211, -/**/ - 210, -/**/ - 209, -/**/ - 208, -/**/ - 207, -/**/ - 206, -/**/ - 205, -/**/ - 204, -/**/ - 203, -/**/ - 202, -/**/ - 201, -/**/ - 200, -/**/ - 199, -/**/ - 198, -/**/ - 197, -/**/ - 196, -/**/ - 195, -/**/ - 194, -/**/ - 193, -/**/ - 192, -/**/ - 191, -/**/ - 190, -/**/ - 189, -/**/ - 188, -/**/ - 187, -/**/ - 186, -/**/ - 185, -/**/ - 184, -/**/ - 183, -/**/ - 182, -/**/ - 181, -/**/ - 180, -/**/ - 179, -/**/ - 178, -/**/ - 177, -/**/ - 176, -/**/ - 175, -/**/ - 174, -/**/ - 173, -/**/ - 172, -/**/ - 171, -/**/ - 170, -/**/ - 169, -/**/ - 168, -/**/ - 167, -/**/ - 166, -/**/ - 165, -/**/ - 164, -/**/ - 163, -/**/ - 162, -/**/ - 161, -/**/ - 160, -/**/ - 159, -/**/ - 158, -/**/ - 157, -/**/ - 156, -/**/ - 155, -/**/ - 154, -/**/ - 153, -/**/ - 152, -/**/ - 151, -/**/ - 150, -/**/ - 149, -/**/ - 148, -/**/ - 147, -/**/ - 146, -/**/ - 145, -/**/ - 144, -/**/ - 143, -/**/ - 142, -/**/ - 141, -/**/ - 140, -/**/ - 139, -/**/ - 138, -/**/ - 137, -/**/ - 136, -/**/ - 135, -/**/ - 134, -/**/ - 133, -/**/ - 132, -/**/ - 131, -/**/ - 130, -/**/ - 129, -/**/ - 128, -/**/ - 127, -/**/ - 126, -/**/ - 125, -/**/ - 124, -/**/ - 123, -/**/ - 122, -/**/ - 121, -/**/ - 120, -/**/ - 119, -/**/ - 118, -/**/ - 117, -/**/ - 116, -/**/ - 115, -/**/ - 114, -/**/ - 113, -/**/ - 112, -/**/ - 111, -/**/ - 110, -/**/ - 109, -/**/ - 108, -/**/ - 107, -/**/ - 106, -/**/ - 105, -/**/ - 104, -/**/ - 103, -/**/ - 102, -/**/ - 101, -/**/ - 100, -/**/ - 99, -/**/ - 98, -/**/ - 97, -/**/ - 96, -/**/ - 95, -/**/ - 94, -/**/ - 93, -/**/ - 92, -/**/ - 91, -/**/ - 90, -/**/ - 89, -/**/ - 88, -/**/ - 87, -/**/ - 86, -/**/ - 85, -/**/ - 84, -/**/ - 83, -/**/ - 82, -/**/ - 81, -/**/ - 80, -/**/ - 79, -/**/ - 78, -/**/ - 77, -/**/ - 76, -/**/ - 75, -/**/ - 74, -/**/ - 73, /**/ 72, /**/ @@ -1533,7 +949,7 @@ static char *(extra_patches[]) = }; int -highest_patch() +highest_patch(void) { int i; int h = 0; @@ -1549,8 +965,7 @@ highest_patch() * Return TRUE if patch "n" has been included. */ int -has_patch(n) - int n; +has_patch(int n) { int i; @@ -1562,8 +977,7 @@ has_patch(n) #endif void -ex_version(eap) - exarg_T *eap; +ex_version(exarg_T *eap) { /* * Ignore a ":version 9.99" command. @@ -1575,36 +989,76 @@ ex_version(eap) } } +/* + * Output a string for the version message. If it's going to wrap, output a + * newline, unless the message is too long to fit on the screen anyway. + * When "wrap" is TRUE wrap the string in []. + */ + static void +version_msg_wrap(char_u *s, int wrap) +{ + int len = (int)vim_strsize(s) + (wrap ? 2 : 0); + + if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns + && *s != '\n') + msg_putchar('\n'); + if (!got_int) + { + if (wrap) + MSG_PUTS("["); + MSG_PUTS(s); + if (wrap) + MSG_PUTS("]"); + } +} + + static void +version_msg(char *s) +{ + version_msg_wrap((char_u *)s, FALSE); +} + /* * List all features aligned in columns, dictionary style. */ static void -list_features() +list_features(void) +{ + list_in_columns((char_u **)features, -1, -1); +} + +/* + * List string items nicely aligned in columns. + * When "size" is < 0 then the last entry is marked with NULL. + * The entry with index "current" is inclosed in []. + */ + void +list_in_columns(char_u **items, int size, int current) { int i; int ncol; int nrow; - int nfeat = 0; + int item_count = 0; int width = 0; - /* Find the length of the longest feature name, use that + 1 as the column - * width */ - for (i = 0; features[i] != NULL; ++i) + /* Find the length of the longest item, use that + 1 as the column + * width. */ + for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i) { - int l = (int)STRLEN(features[i]); + int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0); if (l > width) width = l; - ++nfeat; + ++item_count; } width += 1; if (Columns < width) { /* Not enough screen columns - show one per line */ - for (i = 0; features[i] != NULL; ++i) + for (i = 0; items[i] != NULL; ++i) { - version_msg(features[i]); + version_msg_wrap(items[i], i == current); if (msg_col > 0) msg_putchar('\n'); } @@ -1614,18 +1068,22 @@ list_features() /* The rightmost column doesn't need a separator. * Sacrifice it to fit in one more column if possible. */ ncol = (int) (Columns + 1) / width; - nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0); + nrow = item_count / ncol + (item_count % ncol ? 1 : 0); /* i counts columns then rows. idx counts rows then columns. */ for (i = 0; !got_int && i < nrow * ncol; ++i) { int idx = (i / ncol) + (i % ncol) * nrow; - if (idx < nfeat) + if (idx < item_count) { int last_col = (i + 1) % ncol == 0; - msg_puts((char_u *)features[idx]); + if (idx == current) + msg_putchar('['); + msg_puts(items[idx]); + if (idx == current) + msg_putchar(']'); if (last_col) { if (msg_col > 0) @@ -1646,7 +1104,7 @@ list_features() } void -list_version() +list_version(void) { int i; int first; @@ -1659,18 +1117,11 @@ list_version() MSG(longVersion); #ifdef WIN3264 # ifdef FEAT_GUI_W32 -# if defined(_MSC_VER) && (_MSC_VER <= 1010) - /* Only MS VC 4.1 and earlier can do Win32s */ - MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version")); -# else -# ifdef _WIN64 +# ifdef _WIN64 MSG_PUTS(_("\nMS-Windows 64-bit GUI version")); -# else +# else MSG_PUTS(_("\nMS-Windows 32-bit GUI version")); -# endif # endif - if (gui_is_win32s()) - MSG_PUTS(_(" in Win32s mode")); # ifdef FEAT_OLE MSG_PUTS(_(" with OLE support")); # endif @@ -1682,25 +1133,11 @@ list_version() # endif # endif #endif -#ifdef WIN16 - MSG_PUTS(_("\nMS-Windows 16-bit version")); -#endif -#ifdef MSDOS -# ifdef DJGPP - MSG_PUTS(_("\n32-bit MS-DOS version")); +#if defined(MACOS_X) +# if defined(MACOS_X_DARWIN) + MSG_PUTS(_("\nmacOS version")); # else - MSG_PUTS(_("\n16-bit MS-DOS version")); -# endif -#endif -#ifdef MACOS -# ifdef MACOS_X -# ifdef MACOS_X_UNIX - MSG_PUTS(_("\nMacOS X (unix) version")); -# else - MSG_PUTS(_("\nMacOS X version")); -# endif -#else - MSG_PUTS(_("\nMacOS version")); + MSG_PUTS(_("\nmacOS version w/o darwin feat.")); # endif #endif @@ -1801,11 +1238,15 @@ list_version() MSG_PUTS(_("without GUI.")); #else # ifdef FEAT_GUI_GTK -# ifdef FEAT_GUI_GNOME - MSG_PUTS(_("with GTK2-GNOME GUI.")); +# ifdef USE_GTK3 + MSG_PUTS(_("with GTK3 GUI.")); # else - MSG_PUTS(_("with GTK2 GUI.")); -# endif +# ifdef FEAT_GUI_GNOME + MSG_PUTS(_("with GTK2-GNOME GUI.")); +# else + MSG_PUTS(_("with GTK2 GUI.")); +# endif +# endif # else # ifdef FEAT_GUI_MOTIF MSG_PUTS(_("with X11-Motif GUI.")); @@ -1829,13 +1270,6 @@ list_version() # if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON MSG_PUTS(_("with Carbon GUI.")); # else -# if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX - MSG_PUTS(_("with Cocoa GUI.")); -# else -# if defined(MACOS) - MSG_PUTS(_("with (classic) GUI.")); -# endif -# endif # endif # endif # endif @@ -1898,6 +1332,9 @@ list_version() version_msg("\"\n"); # endif #endif + version_msg(_(" defaults file: \"")); + version_msg(VIM_DEFAULTS_FILE); + version_msg("\"\n"); #ifdef FEAT_GUI # ifdef SYS_MENU_FILE version_msg(_(" system menu file: \"")); @@ -1938,36 +1375,17 @@ list_version() #endif } -/* - * Output a string for the version message. If it's going to wrap, output a - * newline, unless the message is too long to fit on the screen anyway. - */ - static void -version_msg(s) - char *s; -{ - int len = (int)STRLEN(s); - - if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns - && *s != '\n') - msg_putchar('\n'); - if (!got_int) - MSG_PUTS(s); -} - -static void do_intro_line __ARGS((int row, char_u *mesg, int add_version, int attr)); +static void do_intro_line(int row, char_u *mesg, int add_version, int attr); /* * Show the intro message when not editing a file. */ void -maybe_intro_message() +maybe_intro_message(void) { - if (bufempty() + if (BUFEMPTY() && curbuf->b_fname == NULL -#ifdef FEAT_WINDOWS && firstwin->w_next == NULL -#endif && vim_strchr(p_shm, SHM_INTRO) == NULL) intro_message(FALSE); } @@ -1978,8 +1396,8 @@ maybe_intro_message() * Or with the ":intro" command (for Sven :-). */ void -intro_message(colon) - int colon; /* TRUE for ":intro" */ +intro_message( + int colon) /* TRUE for ":intro" */ { int i; int row; @@ -2003,10 +1421,10 @@ intro_message(colon) N_("type :q<Enter> to exit "), N_("type :help<Enter> or <F1> for on-line help"), #ifdef FEAT_GUI_MACVIM - // TODO: Don't steal the show from version7 help? + // TODO: Don't steal the show from version8 help? N_("type :help macvim<Enter> for MacVim help "), #else - N_("type :help version7<Enter> for version info"), + N_("type :help version8<Enter> for version info"), #endif NULL, "", @@ -2044,16 +1462,10 @@ intro_message(colon) blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1); if (!p_cp) blanklines += 4; /* add 4 for not showing "Vi compatible" message */ -#if defined(WIN3264) && !defined(FEAT_GUI_W32) - if (mch_windows95()) - blanklines -= 3; /* subtract 3 for showing "Windows 95" message */ -#endif -#ifdef FEAT_WINDOWS /* Don't overwrite a statusline. Depends on 'cmdheight'. */ if (p_ls > 1) blanklines -= Rows - topframe->fr_height; -#endif if (blanklines < 0) blanklines = 0; @@ -2096,17 +1508,6 @@ intro_message(colon) do_intro_line(row, (char_u *)_(p), i == 2, 0); ++row; } -#if defined(WIN3264) && !defined(FEAT_GUI_W32) - if (mch_windows95()) - { - do_intro_line(++row, - (char_u *)_("WARNING: Windows 95/98/ME detected"), - FALSE, hl_attr(HLF_E)); - do_intro_line(++row, - (char_u *)_("type :help windows95<Enter> for info on this"), - FALSE, 0); - } -#endif } /* Make the wait-return message appear just below the text. */ @@ -2115,11 +1516,11 @@ intro_message(colon) } static void -do_intro_line(row, mesg, add_version, attr) - int row; - char_u *mesg; - int add_version; - int attr; +do_intro_line( + int row, + char_u *mesg, + int add_version, + int attr) { char_u vers[20]; int col; @@ -2133,7 +1534,7 @@ do_intro_line(row, mesg, add_version, attr) if (*mesg == ' ') { vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1); - l = STRLEN(modby); + l = (int)STRLEN(modby); vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1); mesg = modby; } @@ -2179,7 +1580,7 @@ do_intro_line(row, mesg, add_version, attr) #endif clen += byte2cells(p[l]); } - screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr); + screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr); col += clen; } @@ -2192,8 +1593,7 @@ do_intro_line(row, mesg, add_version, attr) * ":intro": clear screen, display intro screen and wait for return. */ void -ex_intro(eap) - exarg_T *eap UNUSED; +ex_intro(exarg_T *eap UNUSED) { screenclear(); intro_message(TRUE); diff --git a/src/version.h b/src/version.h index 173d3b0ccc..d3e575d950 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -13,15 +13,15 @@ * This doesn't use string concatenation, some compilers don't support it. */ -#define VIM_VERSION_MAJOR 7 -#define VIM_VERSION_MAJOR_STR "7" -#define VIM_VERSION_MINOR 4 -#define VIM_VERSION_MINOR_STR "4" +#define VIM_VERSION_MAJOR 8 +#define VIM_VERSION_MAJOR_STR "8" +#define VIM_VERSION_MINOR 1 +#define VIM_VERSION_MINOR_STR "1" #define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR) -#define VIM_VERSION_BUILD 280 -#define VIM_VERSION_BUILD_BCD 0x118 -#define VIM_VERSION_BUILD_STR "280" +#define VIM_VERSION_BUILD 282 +#define VIM_VERSION_BUILD_BCD 0x11a +#define VIM_VERSION_BUILD_STR "282" #define VIM_VERSION_PATCHLEVEL 0 #define VIM_VERSION_PATCHLEVEL_STR "0" /* Used by MacOS port should be one of: development, alpha, beta, final */ @@ -33,8 +33,8 @@ * VIM_VERSION_MEDIUM is used for the startup-screen. * VIM_VERSION_LONG is used for the ":version" command and "Vim -h". */ -#define VIM_VERSION_NODOT "vim74" -#define VIM_VERSION_SHORT "7.4" -#define VIM_VERSION_MEDIUM "7.4" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.4 (2013 Aug 10)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.4 (2013 Aug 10, compiled " +#define VIM_VERSION_NODOT "vim81" +#define VIM_VERSION_SHORT "8.1" +#define VIM_VERSION_MEDIUM "8.1" +#define VIM_VERSION_LONG "VIM - Vi IMproved 8.1 (2018 May 17)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 8.1 (2018 May 17, compiled " diff --git a/src/vim.def b/src/vim.def index a3edae95b9..e0368fce12 100644 --- a/src/vim.def +++ b/src/vim.def @@ -1,4 +1,4 @@ CODE PRELOAD EXECUTEONLY DATA MULTIPLE SHARED -DESCRIPTION 'Vim 7.4' +DESCRIPTION 'Vim 8.1' HEAPSIZE 0,0 diff --git a/src/vim.h b/src/vim.h index 730c63a1b1..fcd05716eb 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -9,7 +9,12 @@ #ifndef VIM__H # define VIM__H -/* use fastcall for Borland, when compiling for Win32 (not for DOS16) */ +#ifdef PROTO +/* cproto runs into trouble when this type is missing */ +typedef double _Float128; +#endif + +/* use fastcall for Borland, when compiling for Win32 */ #if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG) #if defined(FEAT_PERL) || \ defined(FEAT_PYTHON) || \ @@ -27,8 +32,13 @@ # endif #endif -#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) \ - || defined(__EMX__) +#if !defined(FEAT_RUBY) && defined(FEAT_RUBY19) + Error: !FEAT_RUBY && FEAT_RUBY19 is not supported. +#endif +#if defined(FEAT_RUBY19) && !defined(DYNAMIC_RUBY) + Error: FEAT_RUBY19 && !DYNAMIC_RUBY is not supported. +#endif +#if defined(WIN32) || defined(_WIN64) # include "vimio.h" #endif @@ -85,39 +95,16 @@ # define ROOT_UID 0 #endif -#ifdef __EMX__ /* hand-edited config.h for OS/2 with EMX */ -# include "os_os2_cfg.h" -#endif - /* - * MACOS_CLASSIC compiling for MacOS prior to MacOS X - * MACOS_X_UNIX compiling for MacOS X (using os_unix.c) - * MACOS_X compiling for MacOS X (using os_unix.c) - * MACOS compiling for either one + * MACOS_X compiling for Mac OS X + * MACOS_X_DARWIN integrating the darwin feature into MACOS_X */ -#if defined(macintosh) && !defined(MACOS_CLASSIC) -# define MACOS_CLASSIC -#endif -#if defined(MACOS_X_UNIX) +#if defined(MACOS_X_DARWIN) && !defined(MACOS_X) # define MACOS_X -# ifndef HAVE_CONFIG_H -# define UNIX -# endif -# ifndef FEAT_CLIPBOARD -# define FEAT_CLIPBOARD -# if defined(FEAT_SMALL) && !defined(FEAT_MOUSE) -# define FEAT_MOUSE -# endif -# endif -#endif -#if defined(MACOS_X) || defined(MACOS_CLASSIC) -# define MACOS -#endif -#if defined(MACOS_X) && defined(MACOS_CLASSIC) - Error: To compile for both MACOS X and Classic use a Classic Carbon #endif /* Unless made through the Makefile enforce GUI on Mac */ -#if defined(MACOS) && !defined(HAVE_CONFIG_H) +#if defined(MACOS_X) && !defined(HAVE_CONFIG_H) +# define UNIX # define FEAT_GUI_MAC #endif @@ -127,7 +114,6 @@ || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_MACVIM) \ || defined(FEAT_GUI_W32) \ - || defined(FEAT_GUI_W16) \ || defined(FEAT_GUI_PHOTON) # define FEAT_GUI_ENABLED /* also defined with NO_X11_INCLUDES */ # if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES) @@ -135,16 +121,23 @@ # endif #endif +/* Check support for rendering options */ +#ifdef FEAT_GUI +# if defined(FEAT_DIRECTX) +# define FEAT_RENDER_OPTIONS +# endif +#endif + /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ #if _MSC_VER >= 1400 # define _CRT_SECURE_NO_DEPRECATE # define _CRT_NONSTDC_NO_DEPRECATE #endif -#if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16) +#if defined(FEAT_GUI_W32) # define FEAT_GUI_MSWIN #endif -#if defined(WIN16) || defined(WIN32) || defined(_WIN64) +#if defined(WIN32) || defined(_WIN64) # define MSWIN #endif /* Practically everything is common to both Win32 and Win64 */ @@ -159,21 +152,6 @@ #ifdef WIN3264 # define VIM_SIZEOF_INT 4 #endif -#ifdef MSDOS -# ifdef DJGPP -# ifndef FEAT_GUI_GTK /* avoid problems when generating prototypes */ -# define VIM_SIZEOF_INT 4 /* 32 bit ints */ -# endif -# define DOS32 -# define FEAT_CLIPBOARD -# else -# ifndef FEAT_GUI_GTK /* avoid problems when generating prototypes */ -# define VIM_SIZEOF_INT 2 /* 16 bit ints */ -# endif -# define SMALL_MALLOC /* 16 bit storage allocation */ -# define DOS16 -# endif -#endif #ifdef AMIGA /* Be conservative about sizeof(int). It could be 4 too. */ @@ -185,17 +163,24 @@ # endif # endif #endif -#ifdef MACOS -# if defined(__POWERPC__) || defined(MACOS_X) || defined(__fourbyteints__) \ - || defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)/* MPW Compilers */ -# define VIM_SIZEOF_INT 4 -# else -# define VIM_SIZEOF_INT 2 -# endif +#if defined(MACOS_X) && !defined(HAVE_CONFIG_H) +# define VIM_SIZEOF_INT __SIZEOF_INT__ #endif +/* + * #defines for optionals and features + * Also defines FEAT_TINY, FEAT_SMALL, etc. when FEAT_HUGE is defined. + */ +#include "feature.h" -#include "feature.h" /* #defines for optionals and features */ +#if defined(MACOS_X_DARWIN) +# if defined(FEAT_SMALL) && !defined(FEAT_CLIPBOARD) +# define FEAT_CLIPBOARD +# endif +# if defined(FEAT_SMALL) && !defined(FEAT_MOUSE) +# define FEAT_MOUSE +# endif +#endif /* +x11 is only enabled when it's both available and wanted. */ #if defined(HAVE_X11) && defined(WANT_X11) @@ -235,7 +220,7 @@ #endif /* The Mac conversion stuff doesn't work under X11. */ -#if defined(FEAT_MBYTE) && defined(MACOS_X) +#if defined(FEAT_MBYTE) && defined(MACOS_X_DARWIN) # define MACOS_CONVERT #endif @@ -249,50 +234,25 @@ */ #ifdef AZTEC_C # include <functions.h> -# define __ARGS(x) x #endif #ifdef SASC # include <clib/exec_protos.h> -# define __ARGS(x) x #endif #ifdef _DCC # include <clib/exec_protos.h> -# define __ARGS(x) x -#endif - -#ifdef __TURBOC__ -# define __ARGS(x) x #endif #ifdef __BEOS__ # include "os_beos.h" -# define __ARGS(x) x #endif -#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) \ +#if (defined(UNIX) || defined(VMS)) \ && (!defined(MACOS_X) || defined(HAVE_CONFIG_H)) # include "os_unix.h" /* bring lots of system header files */ #endif -#if defined(MACOS) && (defined(__MRC__) || defined(__SC__)) - /* Apple's Compilers support prototypes */ -# define __ARGS(x) x -#endif -#ifndef __ARGS -# if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264) -# define __ARGS(x) x -# else -# define __ARGS(x) () -# endif -#endif - -/* __ARGS and __PARMS are the same thing. */ -#ifndef __PARMS -# define __PARMS(x) __ARGS(x) -#endif - /* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter * can be used to check for mistakes. */ #ifdef HAVE_ATTRIBUTE_UNUSED @@ -301,6 +261,11 @@ # define UNUSED #endif +/* Used to check for "sun", "__sun" is used by newer compilers. */ +#if defined(__sun) +# define SUN_SYSTEM +#endif + /* if we're compiling in C++ (currently only KVim), the system * headers must have the correct prototypes or nothing will build. * conversely, our prototypes might clash due to throw() specifiers and @@ -313,24 +278,10 @@ # include "auto/osdef.h" /* bring missing declarations in */ #endif -#ifdef __EMX__ -# define getcwd _getcwd2 -# define chdir _chdir2 -# undef CHECK_INODE -#endif - #ifdef AMIGA # include "os_amiga.h" #endif -#ifdef MSDOS -# include "os_msdos.h" -#endif - -#ifdef WIN16 -# include "os_win16.h" -#endif - #ifdef WIN3264 # include "os_win32.h" #endif @@ -339,10 +290,7 @@ # include "os_mint.h" #endif -#if defined(MACOS) -# if defined(__MRC__) || defined(__SC__) /* MPW Compilers */ -# define HAVE_SETENV -# endif +#if defined(MACOS_X) # include "os_mac.h" #endif @@ -386,7 +334,15 @@ # endif #endif -#define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */ +/* length of a buffer to store a number in ASCII (64 bits binary + NUL) */ +#define NUMBUFLEN 65 + +/* flags for vim_str2nr() */ +#define STR2NR_BIN 1 +#define STR2NR_OCT 2 +#define STR2NR_HEX 4 +#define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) +#define STR2NR_FORCE 8 /* only when ONE of the above is used */ /* * Shorthand for unsigned variables. Many systems, but not all, have u_char @@ -431,17 +387,46 @@ typedef long __w64 long_i; # define LONG_LONG_OFF_T #endif +/* + * We use 64-bit file functions here, if available. E.g. ftello() returns + * off_t instead of long, which helps if long is 32 bit and off_t is 64 bit. + * We assume that when fseeko() is available then ftello() is too. + * Note that Windows has different function names. + */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) +typedef __int64 off_T; +# ifdef __MINGW32__ +# define vim_lseek lseek64 +# define vim_fseek fseeko64 +# define vim_ftell ftello64 +# else +# define vim_lseek _lseeki64 +# define vim_fseek _fseeki64 +# define vim_ftell _ftelli64 +# endif +#else +# ifdef PROTO +typedef long off_T; +# else +typedef off_t off_T; +# endif +# ifdef HAVE_FSEEKO +# define vim_lseek lseek +# define vim_ftell ftello +# define vim_fseek fseeko +# else +# define vim_lseek lseek +# define vim_ftell ftell +# define vim_fseek(a, b, c) fseek(a, (long)b, c) +# endif +#endif + /* * The characters and attributes cached for the screen. */ typedef char_u schar_T; -#ifdef FEAT_SYN_HL typedef unsigned short sattr_T; -# define MAX_TYPENR 65535 -#else -typedef unsigned char sattr_T; -# define MAX_TYPENR 255 -#endif +#define MAX_TYPENR 65535 /* * The u8char_T can hold one decoded UTF-8 character. @@ -478,15 +463,18 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ #ifdef _DCC # include <sys/stat.h> #endif -#if defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) # include <sys/stat.h> #endif -#if defined(HAVE_ERRNO_H) || defined(DJGPP) || defined(WIN16) \ - || defined(WIN32) || defined(_WIN64) || defined(__EMX__) +#if defined(HAVE_ERRNO_H) \ + || defined(WIN32) || defined(_WIN64) # include <errno.h> #endif +/* for INT_MAX et al. */ +#include <limits.h> + /* * Allow other (non-unix) systems to configure themselves now * These are also in os_unix.h, because osdef.sh needs them there. @@ -519,9 +507,10 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ #ifdef HAVE_WCTYPE_H # include <wctype.h> #endif -#ifdef HAVE_STDARG_H -# include <stdarg.h> -#endif +#include <stdarg.h> + +/* for offsetof() */ +#include <stddef.h> #if defined(HAVE_SYS_SELECT_H) && \ (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME)) @@ -531,11 +520,11 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ #ifndef HAVE_SELECT # ifdef HAVE_SYS_POLL_H # include <sys/poll.h> -# define HAVE_POLL +# elif defined(WIN32) +# define HAVE_SELECT # else # ifdef HAVE_POLL_H # include <poll.h> -# define HAVE_POLL # endif # endif #endif @@ -551,16 +540,6 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ # endif #endif -/* - * Check input method control. - */ -#if defined(FEAT_XIM) \ - || (defined(FEAT_GUI) && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ - || (defined(FEAT_GUI_MAC) && defined(FEAT_MBYTE)) \ - || defined(FEAT_GUI_MACVIM) -# define USE_IM_CONTROL -#endif - /* * For dynamically loaded gettext library. Currently, only for Win32. */ @@ -570,9 +549,11 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ # endif /* These are in os_win32.c */ extern char *(*dyn_libintl_gettext)(const char *msgid); +extern char *(*dyn_libintl_ngettext)(const char *msgid, const char *msgid_plural, unsigned long n); extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *dirname); extern char *(*dyn_libintl_bind_textdomain_codeset)(const char *domainname, const char *codeset); extern char *(*dyn_libintl_textdomain)(const char *domainname); +extern int (*dyn_libintl_putenv)(const char *envstring); #endif @@ -583,6 +564,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #ifdef FEAT_GETTEXT # ifdef DYNAMIC_GETTEXT # define _(x) (*dyn_libintl_gettext)((char *)(x)) +# define NGETTEXT(x, xs, n) (*dyn_libintl_ngettext)((char *)(x), (char *)(xs), (n)) # define N_(x) x # define bindtextdomain(domain, dir) (*dyn_libintl_bindtextdomain)((domain), (dir)) # define bind_textdomain_codeset(domain, codeset) (*dyn_libintl_bind_textdomain_codeset)((domain), (codeset)) @@ -590,9 +572,12 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); # define HAVE_BIND_TEXTDOMAIN_CODESET 1 # endif # define textdomain(domain) (*dyn_libintl_textdomain)(domain) +# define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring) +# define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring) # else # include <libintl.h> # define _(x) gettext((char *)(x)) +# define NGETTEXT(x, xs, n) ngettext((x), (xs), (n)) # ifdef gettext_noop # define N_(x) gettext_noop(x) # else @@ -601,6 +586,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); # endif #else # define _(x) ((char *)(x)) +# define NGETTEXT(x, xs, n) (((n) == 1) ? (char *)(x) : (char *)(xs)) # define N_(x) x # ifdef bindtextdomain # undef bindtextdomain @@ -620,6 +606,8 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); * flags for update_screen() * The higher the value, the higher the priority */ +#define VALID_NO_UPDATE 5 /* no new changes, keep the command line if + possible */ #define VALID 10 /* buffer not changed, or changes marked with b_mod_* */ #define INVERTED 20 /* redisplay inverted part that changed */ @@ -668,7 +656,14 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define HL_UNDERLINE 0x08 #define HL_UNDERCURL 0x10 #define HL_STANDOUT 0x20 -#define HL_ALL 0x3f +#define HL_NOCOMBINE 0x40 +#define HL_STRIKETHROUGH 0x80 +#if defined(FEAT_GUI_MACVIM) +# define HL_THICKUNDERLINE 0x100 +# define HL_ALL 0x1ff +#else +# define HL_ALL 0xff +#endif /* special attribute addition: Put message in history */ #define MSG_HIST 0x1000 @@ -707,9 +702,10 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define SHOWMATCH (0x700 + INSERT) /* show matching paren */ #define CONFIRM 0x800 /* ":confirm" prompt */ #define SELECTMODE 0x1000 /* Select mode, only for mappings */ +#define TERMINAL 0x2000 /* Terminal mode */ -#define MAP_ALL_MODES (0x3f | SELECTMODE) /* all mode bits used for - * mapping */ +/* all mode bits used for mapping */ +#define MAP_ALL_MODES (0x3f | SELECTMODE | TERMINAL) /* directions */ #define FORWARD 1 @@ -793,7 +789,12 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EXPAND_HISTORY 41 #define EXPAND_USER 42 #define EXPAND_SYNTIME 43 -#define EXPAND_MACACTION 44 +#define EXPAND_USER_ADDR_TYPE 44 +#define EXPAND_PACKADD 45 +#define EXPAND_MESSAGES 46 +#define EXPAND_MAPCLEAR 47 +#define EXPAND_ARGLIST 48 +#define EXPAND_MACACTION 49 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 @@ -809,15 +810,16 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define WILD_LONGEST 7 #define WILD_ALL_KEEP 8 -#define WILD_LIST_NOTFOUND 1 -#define WILD_HOME_REPLACE 2 -#define WILD_USE_NL 4 -#define WILD_NO_BEEP 8 -#define WILD_ADD_SLASH 16 -#define WILD_KEEP_ALL 32 -#define WILD_SILENT 64 -#define WILD_ESCAPE 128 -#define WILD_ICASE 256 +#define WILD_LIST_NOTFOUND 0x01 +#define WILD_HOME_REPLACE 0x02 +#define WILD_USE_NL 0x04 +#define WILD_NO_BEEP 0x08 +#define WILD_ADD_SLASH 0x10 +#define WILD_KEEP_ALL 0x20 +#define WILD_SILENT 0x40 +#define WILD_ESCAPE 0x80 +#define WILD_ICASE 0x100 +#define WILD_ALLLINKS 0x200 /* Flags for expand_wildcards() */ #define EW_DIR 0x01 /* include directory names */ @@ -831,31 +833,25 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EW_ICASE 0x100 /* ignore case */ #define EW_NOERROR 0x200 /* no error for bad regexp */ #define EW_NOTWILD 0x400 /* add match with literal name if exists */ +#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */ /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND * is used when executing commands and EW_SILENT for interactive expanding. */ +#define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */ +#define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check + * if executable is in $PATH */ +#define EW_DODOT 0x4000 /* also files starting with a dot */ +#define EW_EMPTYOK 0x8000 /* no matches is not an error */ /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ #define FINDFILE_DIR 1 /* only directories */ #define FINDFILE_BOTH 2 /* files and directories */ -#ifdef FEAT_VERTSPLIT -# define W_WINCOL(wp) (wp->w_wincol) -# define W_WIDTH(wp) (wp->w_width) -# define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -# define W_VSEP_WIDTH(wp) (wp->w_vsep_width) +#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) +#ifdef FEAT_MENU +# define W_WINROW(wp) (wp->w_winrow + wp->w_winbar_height) #else -# define W_WINCOL(wp) 0 -# define W_WIDTH(wp) Columns -# define W_ENDCOL(wp) Columns -# define W_VSEP_WIDTH(wp) 0 -#endif -#ifdef FEAT_WINDOWS -# define W_STATUS_HEIGHT(wp) (wp->w_status_height) # define W_WINROW(wp) (wp->w_winrow) -#else -# define W_STATUS_HEIGHT(wp) 0 -# define W_WINROW(wp) 0 #endif #ifdef NO_EXPANDPATH @@ -877,11 +873,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #ifdef FEAT_SYN_HL # define SST_MIN_ENTRIES 150 /* minimal size for state stack array */ -# ifdef FEAT_GUI_W16 -# define SST_MAX_ENTRIES 500 /* (only up to 64K blocks) */ -# else -# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ -# endif +# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ # define SST_FIX_STATES 7 /* size of sst_stack[]. */ # define SST_DIST 16 /* normal distance between entries */ # define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */ @@ -920,6 +912,10 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define SEARCH_MARK 0x200 /* set previous context mark */ #define SEARCH_KEEP 0x400 /* keep previous search pattern */ #define SEARCH_PEEK 0x800 /* peek for typed char, cancel search */ +#define SEARCH_COL 0x1000 /* start at specified column instead of zero */ +#ifdef USE_MIGEMO +# define SEARCH_MIGEMO 0x2000 /* use migemo for search */ +#endif /* Values for find_ident_under_cursor() */ #define FIND_IDENT 1 /* find identifier (word) */ @@ -933,16 +929,28 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define FNAME_INCL 8 /* apply 'includeexpr' */ #define FNAME_REL 16 /* ".." and "./" are relative to the (current) file instead of the current directory */ +#define FNAME_UNESC 32 /* remove backslashes used for escaping */ /* Values for buflist_getfile() */ #define GETF_SETMARK 0x01 /* set pcmark before jumping */ #define GETF_ALT 0x02 /* jumping to alternate file (not buf num) */ #define GETF_SWITCH 0x04 /* respect 'switchbuf' settings when jumping */ +/* Return values of getfile() */ +#define GETFILE_ERROR 1 /* normal error */ +#define GETFILE_NOT_WRITTEN 2 /* "not written" error */ +#define GETFILE_SAME_FILE 0 /* success, same file */ +#define GETFILE_OPEN_OTHER -1 /* success, opened another file */ +#define GETFILE_UNUSED 8 +#define GETFILE_SUCCESS(x) ((x) <= 0) + /* Values for buflist_new() flags */ -#define BLN_CURBUF 1 /* May re-use curbuf for new buffer */ -#define BLN_LISTED 2 /* Put new buffer in buffer list */ -#define BLN_DUMMY 4 /* Allocating dummy buffer */ +#define BLN_CURBUF 1 /* may re-use curbuf for new buffer */ +#define BLN_LISTED 2 /* put new buffer in buffer list */ +#define BLN_DUMMY 4 /* allocating dummy buffer */ +#define BLN_NEW 8 /* create a new buffer */ +#define BLN_NOOPT 16 /* don't copy options to existing buffer */ +#define BLN_DUMMY_OK 32 /* also find an existing dummy buffer */ /* Values for in_cinkeys() */ #define KEY_OPEN_FORW 0x101 @@ -977,7 +985,8 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define READ_STDIN 0x04 /* read from stdin */ #define READ_BUFFER 0x08 /* read from curbuf (converting stdin) */ #define READ_DUMMY 0x10 /* reading into a dummy buffer */ -#define READ_KEEP_UNDO 0x20 /* keep undo info*/ +#define READ_KEEP_UNDO 0x20 /* keep undo info */ +#define READ_FIFO 0x40 /* read from fifo or socket */ /* Values for change_indent() */ #define INDENT_SET 1 /* set indent */ @@ -1014,6 +1023,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define RE_MAGIC 1 /* 'magic' option */ #define RE_STRING 2 /* match in string instead of buffer text */ #define RE_STRICT 4 /* don't allow [abc] without ] */ +#define RE_AUTO 8 /* automatic engine selection */ #ifdef FEAT_SYN_HL /* values for reg_do_extmatch */ @@ -1094,7 +1104,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define OPENLINE_COM_LIST 16 /* format comments with list/2nd line indent */ /* - * There are four history tables: + * There are five history tables: */ #define HIST_CMD 0 /* colon commands */ #define HIST_SEARCH 1 /* search commands */ @@ -1103,13 +1113,30 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define HIST_DEBUG 4 /* debug commands */ #define HIST_COUNT 5 /* number of history tables */ -/* - * Flags for chartab[]. - */ -#define CT_CELL_MASK 0x07 /* mask: nr of display cells (1, 2 or 4) */ -#define CT_PRINT_CHAR 0x10 /* flag: set for printable chars */ -#define CT_ID_CHAR 0x20 /* flag: set for ID chars */ -#define CT_FNAME_CHAR 0x40 /* flag: set for file name chars */ +/* The type numbers are fixed for backwards compatibility. */ +#define BARTYPE_VERSION 1 +#define BARTYPE_HISTORY 2 +#define BARTYPE_REGISTER 3 +#define BARTYPE_MARK 4 + +#define VIMINFO_VERSION 4 +#define VIMINFO_VERSION_WITH_HISTORY 2 +#define VIMINFO_VERSION_WITH_REGISTERS 3 +#define VIMINFO_VERSION_WITH_MARKS 4 + +typedef enum { + BVAL_NR, + BVAL_STRING, + BVAL_EMPTY +} btype_T; + +typedef struct { + btype_T bv_type; + long bv_nr; + char_u *bv_string; + int bv_len; /* length of bv_string */ + int bv_allocated; /* bv_string was allocated */ +} bval_T; /* * Values for do_tag(). @@ -1241,62 +1268,93 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); enum auto_event { EVENT_BUFADD = 0, /* after adding a buffer to the buffer list */ - EVENT_BUFNEW, /* after creating any buffer */ EVENT_BUFDELETE, /* deleting a buffer from the buffer list */ - EVENT_BUFWIPEOUT, /* just before really deleting a buffer */ EVENT_BUFENTER, /* after entering a buffer */ EVENT_BUFFILEPOST, /* after renaming a buffer */ EVENT_BUFFILEPRE, /* before renaming a buffer */ + EVENT_BUFHIDDEN, /* just after buffer becomes hidden */ EVENT_BUFLEAVE, /* before leaving a buffer */ + EVENT_BUFNEW, /* after creating any buffer */ EVENT_BUFNEWFILE, /* when creating a buffer for a new file */ + EVENT_BUFREADCMD, /* read buffer using command */ EVENT_BUFREADPOST, /* after reading a buffer */ EVENT_BUFREADPRE, /* before reading a buffer */ - EVENT_BUFREADCMD, /* read buffer using command */ EVENT_BUFUNLOAD, /* just before unloading a buffer */ - EVENT_BUFHIDDEN, /* just after buffer becomes hidden */ EVENT_BUFWINENTER, /* after showing a buffer in a window */ EVENT_BUFWINLEAVE, /* just after buffer removed from window */ + EVENT_BUFWIPEOUT, /* just before really deleting a buffer */ + EVENT_BUFWRITECMD, /* write buffer using command */ EVENT_BUFWRITEPOST, /* after writing a buffer */ EVENT_BUFWRITEPRE, /* before writing a buffer */ - EVENT_BUFWRITECMD, /* write buffer using command */ + EVENT_CMDLINECHANGED, /* command line was modified*/ + EVENT_CMDLINEENTER, /* after entering the command line */ + EVENT_CMDLINELEAVE, /* before leaving the command line */ + EVENT_CMDUNDEFINED, /* command undefined */ EVENT_CMDWINENTER, /* after entering the cmdline window */ EVENT_CMDWINLEAVE, /* before leaving the cmdline window */ EVENT_COLORSCHEME, /* after loading a colorscheme */ + EVENT_COLORSCHEMEPRE, /* before loading a colorscheme */ EVENT_COMPLETEDONE, /* after finishing insert complete */ + EVENT_CURSORHOLD, /* cursor in same position for a while */ + EVENT_CURSORHOLDI, /* idem, in Insert mode */ + EVENT_CURSORMOVED, /* cursor was moved */ + EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */ + EVENT_DIRCHANGED, /* after user changed directory */ + EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */ + EVENT_EXITPRE, /* before exiting */ + EVENT_FILEAPPENDCMD, /* append to a file using command */ EVENT_FILEAPPENDPOST, /* after appending to a file */ EVENT_FILEAPPENDPRE, /* before appending to a file */ - EVENT_FILEAPPENDCMD, /* append to a file using command */ + EVENT_FILECHANGEDRO, /* before first change to read-only file */ EVENT_FILECHANGEDSHELL, /* after shell command that changed file */ EVENT_FILECHANGEDSHELLPOST, /* after (not) reloading changed file */ - EVENT_FILECHANGEDRO, /* before first change to read-only file */ + EVENT_FILEREADCMD, /* read from a file using command */ EVENT_FILEREADPOST, /* after reading a file */ EVENT_FILEREADPRE, /* before reading a file */ - EVENT_FILEREADCMD, /* read from a file using command */ EVENT_FILETYPE, /* new file type detected (user defined) */ + EVENT_FILEWRITECMD, /* write to a file using command */ EVENT_FILEWRITEPOST, /* after writing a file */ EVENT_FILEWRITEPRE, /* before writing a file */ - EVENT_FILEWRITECMD, /* write to a file using command */ EVENT_FILTERREADPOST, /* after reading from a filter */ EVENT_FILTERREADPRE, /* before reading from a filter */ EVENT_FILTERWRITEPOST, /* after writing to a filter */ EVENT_FILTERWRITEPRE, /* before writing to a filter */ EVENT_FOCUSGAINED, /* got the focus */ EVENT_FOCUSLOST, /* lost the focus to another app */ + EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */ EVENT_GUIENTER, /* after starting the GUI */ EVENT_GUIFAILED, /* after starting the GUI failed */ EVENT_INSERTCHANGE, /* when changing Insert/Replace mode */ + EVENT_INSERTCHARPRE, /* before inserting a char */ EVENT_INSERTENTER, /* when entering Insert mode */ EVENT_INSERTLEAVE, /* when leaving Insert mode */ EVENT_MENUPOPUP, /* just before popup menu is displayed */ + EVENT_OPTIONSET, /* option was set */ EVENT_QUICKFIXCMDPOST, /* after :make, :grep etc. */ EVENT_QUICKFIXCMDPRE, /* before :make, :grep etc. */ EVENT_QUITPRE, /* before :quit */ + EVENT_REMOTEREPLY, /* upon string reception from a remote vim */ EVENT_SESSIONLOADPOST, /* after loading a session file */ + EVENT_SHELLCMDPOST, /* after ":!cmd" */ + EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ + EVENT_SOURCECMD, /* sourcing a Vim script using command */ + EVENT_SOURCEPRE, /* before sourcing a Vim script */ + EVENT_SPELLFILEMISSING, /* spell file missing */ EVENT_STDINREADPOST, /* after reading from stdin */ EVENT_STDINREADPRE, /* before reading from stdin */ + EVENT_SWAPEXISTS, /* found existing swap file */ EVENT_SYNTAX, /* syntax selected */ + EVENT_TABCLOSED, /* after closing a tab page */ + EVENT_TABENTER, /* after entering a tab page */ + EVENT_TABLEAVE, /* before leaving a tab page */ + EVENT_TABNEW, /* when entering a new tab page */ EVENT_TERMCHANGED, /* after changing 'term' */ + EVENT_TERMINALOPEN, /* after a terminal buffer was created */ EVENT_TERMRESPONSE, /* after setting "v:termresponse" */ + EVENT_TEXTCHANGED, /* text was modified not in Insert mode */ + EVENT_TEXTCHANGEDI, /* text was modified in Insert mode */ + EVENT_TEXTCHANGEDP, /* TextChangedI with popup menu visible */ + EVENT_TEXTYANKPOST, /* after some text was yanked */ EVENT_USER, /* user defined autocommand */ EVENT_VIMENTER, /* after starting Vim */ EVENT_VIMLEAVE, /* before exiting Vim */ @@ -1304,24 +1362,8 @@ enum auto_event EVENT_VIMRESIZED, /* after Vim window was resized */ EVENT_WINENTER, /* after entering a window */ EVENT_WINLEAVE, /* before leaving a window */ - EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */ - EVENT_INSERTCHARPRE, /* before inserting a char */ - EVENT_CURSORHOLD, /* cursor in same position for a while */ - EVENT_CURSORHOLDI, /* idem, in Insert mode */ - EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */ - EVENT_REMOTEREPLY, /* upon string reception from a remote vim */ - EVENT_SWAPEXISTS, /* found existing swap file */ - EVENT_SOURCEPRE, /* before sourcing a Vim script */ - EVENT_SOURCECMD, /* sourcing a Vim script using command */ - EVENT_SPELLFILEMISSING, /* spell file missing */ - EVENT_CURSORMOVED, /* cursor was moved */ - EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */ - EVENT_TABLEAVE, /* before leaving a tab page */ - EVENT_TABENTER, /* after entering a tab page */ - EVENT_SHELLCMDPOST, /* after ":!cmd" */ - EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ - EVENT_TEXTCHANGED, /* text was modified */ - EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/ + EVENT_WINNEW, /* when entering a new window */ + NUM_EVENTS /* MUST be the last one */ }; @@ -1336,7 +1378,8 @@ typedef enum { HLF_8 = 0 /* Meta & special keys listed with ":map", text that is displayed different from what it is */ - , HLF_AT /* @ and ~ characters at end of screen, characters that + , HLF_EOB /* after the last line in the buffer */ + , HLF_AT /* @ characters at end of screen, characters that don't really exist in the text */ , HLF_D /* directories in CTRL-D listing */ , HLF_E /* error messages */ @@ -1375,19 +1418,23 @@ typedef enum , HLF_TP /* tabpage line */ , HLF_TPS /* tabpage line selected */ , HLF_TPF /* tabpage line filler */ - , HLF_CUC /* 'cursurcolumn' */ - , HLF_CUL /* 'cursurline' */ + , HLF_CUC /* 'cursorcolumn' */ + , HLF_CUL /* 'cursorline' */ , HLF_MC /* 'colorcolumn' */ + , HLF_QFL /* quickfix window line currently selected */ + , HLF_ST /* status lines of terminal windows */ + , HLF_STNC /* status lines of not-current terminal windows */ , HLF_COUNT /* MUST be the last one */ } hlf_T; /* The HL_FLAGS must be in the same order as the HLF_ enums! * When changing this also adjust the default for 'highlight'. */ -#define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ +#define HL_FLAGS {'8', '~', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ 'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ 'B', 'P', 'R', 'L', \ - '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o'} + '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', \ + 'z', 'Z'} /* * Boolean constants @@ -1434,6 +1481,10 @@ typedef UINT32_TYPEDEF UINT32_T; #define OP_FOLDDELREC 25 /* "zD" delete folds recursively */ #define OP_FORMAT2 26 /* "gw" format operator, keeps cursor pos */ #define OP_FUNCTION 27 /* "g@" call 'operatorfunc' */ +#define OP_NR_ADD 28 /* "<C-A>" Add to the number or alphabetic + character (OP_ADD conflicts with Perl) */ +#define OP_NR_SUB 29 /* "<C-X>" Subtract from the number or + alphabetic character */ /* * Motion types, used for operators and for yank/delete registers. @@ -1450,6 +1501,13 @@ typedef UINT32_TYPEDEF UINT32_T; #define MIN_COLUMNS 12 /* minimal columns for screen */ #define MIN_LINES 2 /* minimal lines for screen */ #define STATUS_HEIGHT 1 /* height of a status line under a window */ +#ifdef FEAT_MENU /* height of a status line under a window */ +# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height +# define VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height) +#else +# define WINBAR_HEIGHT(wp) 0 +# define VISIBLE_HEIGHT(wp) (wp)->w_height +#endif #define QF_WINHEIGHT 10 /* default height for quickfix window */ /* @@ -1474,6 +1532,8 @@ typedef UINT32_TYPEDEF UINT32_T; # define MSG_BUF_CLEN MSG_BUF_LEN /* cell length */ #endif +#define FOLD_TEXT_LEN 51 /* buffer size for get_foldtext() */ + /* Size of the buffer used for tgetent(). Unfortunately this is largely * undocumented, some systems use 1024. Using a buffer that is too small * causes a buffer overrun and a crash. Use the maximum known value to stay @@ -1507,7 +1567,7 @@ typedef UINT32_TYPEDEF UINT32_T; * EMX doesn't have a global way of making open() use binary I/O. * Use O_BINARY for all open() calls. */ -#if defined(__EMX__) || defined(__CYGWIN32__) +#if defined(__CYGWIN32__) # define O_EXTRA O_BINARY #else # define O_EXTRA 0 @@ -1584,6 +1644,9 @@ typedef UINT32_TYPEDEF UINT32_T; #define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q)) #define EMSGN(s, n) emsgn((char_u *)(s), (long)(n)) #define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n)) +#define IEMSG(s) iemsg((char_u *)(s)) +#define IEMSG2(s, p) iemsg2((char_u *)(s), (char_u *)(p)) +#define IEMSGN(s, n) iemsgn((char_u *)(s), (long)(n)) #define OUT_STR(s) out_str((char_u *)(s)) #define OUT_STR_NF(s) out_str_nf((char_u *)(s)) #define MSG_PUTS(s) msg_puts((char_u *)(s)) @@ -1592,12 +1655,47 @@ typedef UINT32_TYPEDEF UINT32_T; #define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0) #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a)) +#ifdef FEAT_GUI +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termgui_##f) +# define GUI_FUNCTION2(f, pixel) (gui.in_use \ + ? ((pixel) != INVALCOLOR \ + ? gui_##f((pixel)) \ + : INVALCOLOR) \ + : termgui_##f((pixel))) +# define USE_24BIT (gui.in_use || p_tgc) +# else +# define GUI_FUNCTION(f) gui_##f +# define GUI_FUNCTION2(f,pixel) ((pixel) != INVALCOLOR \ + ? gui_##f((pixel)) \ + : INVALCOLOR) +# define USE_24BIT gui.in_use +# endif +#else +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) termgui_##f +# define GUI_FUNCTION2(f, pixel) termgui_##f((pixel)) +# define USE_24BIT p_tgc +# endif +#endif +#ifdef FEAT_TERMGUICOLORS +# define IS_CTERM (t_colors > 1 || p_tgc) +#else +# define IS_CTERM (t_colors > 1) +#endif +#ifdef GUI_FUNCTION +# define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb) +# define GUI_MCH_GET_RGB2(pixel) GUI_FUNCTION2(mch_get_rgb, (pixel)) +# define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color) +# define GUI_GET_COLOR GUI_FUNCTION(get_color) +#endif + /* Prefer using emsg3(), because perror() may send the output to the wrong * destination and mess up the screen. */ #ifdef HAVE_STRERROR # define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno)) #else -# define PERROR(msg) perror(msg) +# define PERROR(msg) do_perror(msg) #endif typedef long linenr_T; /* line number type */ @@ -1630,15 +1728,8 @@ typedef unsigned short disptick_T; /* display tick type */ typedef void *vim_acl_T; /* dummy to pass an ACL to a function */ -/* - * Include a prototype for mch_memmove(), it may not be in alloc.pro. - */ -#ifdef VIM_MEMMOVE -void mch_memmove __ARGS((void *, void *, size_t)); -#else -# ifndef mch_memmove -# define mch_memmove(to, from, len) memmove(to, from, len) -# endif +#ifndef mch_memmove +# define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (size_t)(len)) #endif /* @@ -1653,21 +1744,10 @@ void mch_memmove __ARGS((void *, void *, size_t)); #ifdef HAVE_MEMSET # define vim_memset(ptr, c, size) memset((ptr), (c), (size)) #else -void *vim_memset __ARGS((void *, int, size_t)); -#endif - -#ifdef HAVE_MEMCMP -# define vim_memcmp(p1, p2, len) memcmp((p1), (p2), (len)) -#else -# ifdef HAVE_BCMP -# define vim_memcmp(p1, p2, len) bcmp((p1), (p2), (len)) -# else -int vim_memcmp __ARGS((void *, void *, size_t)); -# define VIM_MEMCMP -# endif +void *vim_memset(void *, int, size_t); #endif -#if defined(UNIX) || defined(FEAT_GUI) || defined(OS2) || defined(VMS) \ +#if defined(UNIX) || defined(FEAT_GUI) || defined(VMS) \ || defined(FEAT_CLIENTSERVER) # define USE_INPUT_BUF #endif @@ -1690,14 +1770,8 @@ int vim_memcmp __ARGS((void *, void *, size_t)); /* * Enums need a typecast to be used as array index (for Ultrix). */ -#define hl_attr(n) highlight_attr[(int)(n)] -#define term_str(n) term_strings[(int)(n)] - -/* - * vim_iswhite() is used for "^" and the like. It differs from isspace() - * because it doesn't include <CR> and <LF> and the like. - */ -#define vim_iswhite(x) ((x) == ' ' || (x) == '\t') +#define HL_ATTR(n) highlight_attr[(int)(n)] +#define TERM_STR(n) term_strings[(int)(n)] /* * EXTERN is only defined in main.c. That's where global variables are @@ -1710,6 +1784,7 @@ int vim_memcmp __ARGS((void *, void *, size_t)); # ifndef INIT # define INIT(x) x # define DO_INIT +# define COMMA , # endif #endif @@ -1734,13 +1809,38 @@ typedef struct timeval proftime_T; typedef int proftime_T; /* dummy for function prototypes */ #endif +/* + * When compiling with 32 bit Perl time_t is 32 bits in the Perl code but 64 + * bits elsewhere. That causes memory corruption. Define time_T and use it + * for global variables to avoid that. + */ +#ifdef PROTO +typedef long time_T; +#else +# ifdef WIN3264 +typedef __time64_t time_T; +# else +typedef time_t time_T; +# endif +#endif + +#ifdef _WIN64 +typedef __int64 sock_T; +#else +typedef int sock_T; +#endif + /* Include option.h before structs.h, because the number of window-local and * buffer-local options is used there. */ -#include "option.h" /* options and default values */ +#include "option.h" /* options and default values */ + +#include "beval.h" /* BalloonEval */ /* Note that gui.h is included by structs.h */ -#include "structs.h" /* file that defines many structures */ +#include "structs.h" /* defines many structures */ + +#include "alloc.h" /* Values for "do_profiling". */ #define PROF_NONE 0 /* profiling not started */ @@ -1806,6 +1906,7 @@ typedef int proftime_T; /* dummy for function prototypes */ # define CURSOR_MOVED 0x100 # define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */ # define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */ +# define MOUSE_WINBAR 0x800 /* in window toolbar */ /* flags for jump_to_mouse() */ # define MOUSE_FOCUS 0x01 /* need to stay in this window */ @@ -1867,24 +1968,71 @@ typedef int proftime_T; /* dummy for function prototypes */ #define VV_FCS_CHOICE 38 #define VV_BEVAL_BUFNR 39 #define VV_BEVAL_WINNR 40 -#define VV_BEVAL_LNUM 41 -#define VV_BEVAL_COL 42 -#define VV_BEVAL_TEXT 43 -#define VV_SCROLLSTART 44 -#define VV_SWAPNAME 45 -#define VV_SWAPCHOICE 46 -#define VV_SWAPCOMMAND 47 -#define VV_CHAR 48 -#define VV_MOUSE_WIN 49 -#define VV_MOUSE_LNUM 50 -#define VV_MOUSE_COL 51 -#define VV_OP 52 -#define VV_SEARCHFORWARD 53 -#define VV_HLSEARCH 54 -#define VV_OLDFILES 55 -#define VV_WINDOWID 56 -#define VV_PROGPATH 57 -#define VV_LEN 58 /* number of v: vars */ +#define VV_BEVAL_WINID 41 +#define VV_BEVAL_LNUM 42 +#define VV_BEVAL_COL 43 +#define VV_BEVAL_TEXT 44 +#define VV_SCROLLSTART 45 +#define VV_SWAPNAME 46 +#define VV_SWAPCHOICE 47 +#define VV_SWAPCOMMAND 48 +#define VV_CHAR 49 +#define VV_MOUSE_WIN 50 +#define VV_MOUSE_WINID 51 +#define VV_MOUSE_LNUM 52 +#define VV_MOUSE_COL 53 +#define VV_OP 54 +#define VV_SEARCHFORWARD 55 +#define VV_HLSEARCH 56 +#define VV_OLDFILES 57 +#define VV_WINDOWID 58 +#define VV_PROGPATH 59 +#define VV_COMPLETED_ITEM 60 +#define VV_OPTION_NEW 61 +#define VV_OPTION_OLD 62 +#define VV_OPTION_TYPE 63 +#define VV_ERRORS 64 +#define VV_FALSE 65 +#define VV_TRUE 66 +#define VV_NULL 67 +#define VV_NONE 68 +#define VV_VIM_DID_ENTER 69 +#define VV_TESTING 70 +#define VV_TYPE_NUMBER 71 +#define VV_TYPE_STRING 72 +#define VV_TYPE_FUNC 73 +#define VV_TYPE_LIST 74 +#define VV_TYPE_DICT 75 +#define VV_TYPE_FLOAT 76 +#define VV_TYPE_BOOL 77 +#define VV_TYPE_NONE 78 +#define VV_TYPE_JOB 79 +#define VV_TYPE_CHANNEL 80 +#define VV_TERMRFGRESP 81 +#define VV_TERMRBGRESP 82 +#define VV_TERMU7RESP 83 +#define VV_TERMSTYLERESP 84 +#define VV_TERMBLINKRESP 85 +#define VV_EVENT 86 +#define VV_LEN 87 /* number of v: vars */ + +/* used for v_number in VAR_SPECIAL */ +#define VVAL_FALSE 0L +#define VVAL_TRUE 1L +#define VVAL_NONE 2L +#define VVAL_NULL 3L + +/* Type values for type(). */ +#define VAR_TYPE_NUMBER 0 +#define VAR_TYPE_STRING 1 +#define VAR_TYPE_FUNC 2 +#define VAR_TYPE_LIST 3 +#define VAR_TYPE_DICT 4 +#define VAR_TYPE_FLOAT 5 +#define VAR_TYPE_BOOL 6 +#define VAR_TYPE_NONE 7 +#define VAR_TYPE_JOB 8 +#define VAR_TYPE_CHANNEL 9 #ifdef FEAT_CLIPBOARD @@ -1907,10 +2055,6 @@ typedef int proftime_T; /* dummy for function prototypes */ # ifdef FEAT_OLE # define WM_OLE (WM_APP+0) # endif -# ifdef FEAT_NETBEANS_INTG - /* message for Netbeans socket event */ -# define WM_NETBEANS (WM_APP+1) -# endif # endif /* Info about selected text */ @@ -1950,14 +2094,38 @@ typedef struct VimClipboard typedef int VimClipboard; /* This is required for the prototypes. */ #endif -#ifdef __BORLANDC__ -/* work around a bug in the Borland 'stat' function: */ -# include <io.h> /* for access() */ +/* Use 64-bit stat structure if available. */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) +# define HAVE_STAT64 +typedef struct _stat64 stat_T; +#else +typedef struct stat stat_T; +#endif -# define stat(a,b) (access(a,0) ? -1 : stat(a,b)) +#if defined(__GNUC__) && !defined(__MINGW32__) +# define USE_PRINTF_FORMAT_ATTRIBUTE #endif +typedef enum +{ + ASSERT_EQUAL, + ASSERT_NOTEQUAL, + ASSERT_MATCH, + ASSERT_NOTMATCH, + ASSERT_OTHER +} assert_type_T; + +/* Mode for bracketed_paste(). */ +typedef enum { + PASTE_INSERT, /* insert mode */ + PASTE_CMDLINE, /* command line */ + PASTE_EX, /* ex mode line */ + PASTE_ONE_CHAR /* return first character */ +} paste_mode_T; + #include "ex_cmds.h" /* Ex command defines */ +#include "spell.h" /* spell checking stuff */ + #include "proto.h" /* function prototypes */ /* This has to go after the include of proto.h, as proto/gui.pro declares @@ -1965,7 +2133,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */ * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ #if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \ - && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) + && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) # define display_errors() fflush(stderr) # define mch_msg(str) printf("%s", (str)) @@ -1973,6 +2141,26 @@ typedef int VimClipboard; /* This is required for the prototypes. */ # define USE_MCH_ERRMSG #endif +# if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \ + && (!defined(FEAT_GUI_W32) \ + || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ + && !(defined(FEAT_GUI_MAC) && defined(MACOS_CONVERT)) +/* Whether IME is supported by im_get_status() defined in mbyte.c. + * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is defined. + * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when + * MACOS_CONVERT is defined. */ +# define IME_WITHOUT_XIM +#endif + +#if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \ + || defined(IME_WITHOUT_XIM) \ + || (defined(FEAT_GUI_W32) \ + && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ + || defined(FEAT_GUI_MAC)) +/* im_set_active() is available */ +# define HAVE_INPUT_METHOD +#endif + #ifndef FEAT_MBYTE # define after_pathsep(b, p) vim_ispathsep(*((p) - 1)) # define transchar_byte(c) transchar(c) @@ -1983,16 +2171,18 @@ typedef int VimClipboard; /* This is required for the prototypes. */ # define number_width(x) 7 #endif +/* This must come after including proto.h. + * For VMS this is defined in macros.h. */ +#if !(defined(FEAT_MBYTE) && defined(WIN3264)) && !defined(VMS) +# define mch_open(n, m, p) open((n), (m), (p)) +# define mch_fopen(n, p) fopen((n), (p)) +#endif #include "globals.h" /* global variables and messages */ -#ifdef FEAT_SNIFF -# include "if_sniff.h" -#endif - #ifndef FEAT_VIRTUALEDIT -# define getvvcol(w, p, s, c, e) getvcol(w, p, s, c, e) -# define virtual_active() 0 +# define getvvcol(w, p, s, c, e) getvcol((w), (p), (s), (c), (e)) +# define virtual_active() FALSE # define virtual_op FALSE #endif @@ -2013,16 +2203,16 @@ typedef int VimClipboard; /* This is required for the prototypes. */ #ifdef FEAT_BROWSE # ifdef BACKSLASH_IN_FILENAME # define BROWSE_FILTER_MACROS \ - (char_u *)"Vim macro files (*.vim)\t*.vim\nAll Files (*.*)\t*.*\n" -# define BROWSE_FILTER_ALL_FILES (char_u *)"All Files (*.*)\t*.*\n" + (char_u *)N_("Vim macro files (*.vim)\t*.vim\nAll Files (*.*)\t*.*\n") +# define BROWSE_FILTER_ALL_FILES (char_u *)N_("All Files (*.*)\t*.*\n") # define BROWSE_FILTER_DEFAULT \ - (char_u *)"All Files (*.*)\t*.*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVB code (*.bas, *.frm)\t*.bas;*.frm\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + (char_u *)N_("All Files (*.*)\t*.*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVB code (*.bas, *.frm)\t*.bas;*.frm\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n") # else # define BROWSE_FILTER_MACROS \ - (char_u *)"Vim macro files (*.vim)\t*.vim\nAll Files (*)\t*\n" -# define BROWSE_FILTER_ALL_FILES (char_u *)"All Files (*)\t*\n" + (char_u *)N_("Vim macro files (*.vim)\t*.vim\nAll Files (*)\t*\n") +# define BROWSE_FILTER_ALL_FILES (char_u *)N_("All Files (*)\t*\n") # define BROWSE_FILTER_DEFAULT \ - (char_u *)"All Files (*)\t*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + (char_u *)N_("All Files (*)\t*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n") # endif # define BROWSE_SAVE 1 /* flag for do_browse() */ # define BROWSE_DIR 2 /* flag for do_browse() */ @@ -2036,6 +2226,20 @@ typedef int VimClipboard; /* This is required for the prototypes. */ #ifdef _MSC_VER /* Avoid useless warning "conversion from X to Y of greater size". */ #pragma warning(disable : 4312) +/* Avoid warning for old style function declarators */ + #pragma warning(disable : 4131) +/* Avoid warning for conversion to type with smaller range */ + #pragma warning(disable : 4244) +/* Avoid warning for conversion to larger size */ + #pragma warning(disable : 4306) +/* Avoid warning for unreferenced formal parameter */ + #pragma warning(disable : 4100) +/* Avoid warning for differs in indirection to slightly different base type */ + #pragma warning(disable : 4057) +/* Avoid warning for constant conditional expression */ + #pragma warning(disable : 4127) +/* Avoid warning for assignment within conditional */ + #pragma warning(disable : 4706) #endif /* Note: a NULL argument for vim_realloc() is not portable, don't use it. */ @@ -2188,9 +2392,10 @@ typedef int VimClipboard; /* This is required for the prototypes. */ # ifdef instr # undef instr # endif - /* bool may cause trouble on MACOS but is required on a few other systems - * and for Perl */ -# if defined(bool) && defined(MACOS) && !defined(FEAT_PERL) + /* bool may cause trouble on some old versions of Mac OS X but is required + * on a few other systems and for Perl */ +# if (defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) \ + && defined(bool) && !defined(FEAT_PERL) # undef bool # endif @@ -2203,7 +2408,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */ /* values for vim_handle_signal() that are not a signal */ #define SIGNAL_BLOCK -1 #define SIGNAL_UNBLOCK -2 -#if !defined(UNIX) && !defined(VMS) && !defined(OS2) +#if !defined(UNIX) && !defined(VMS) # define vim_handle_signal(x) 0 #endif @@ -2270,10 +2475,94 @@ typedef int VimClipboard; /* This is required for the prototypes. */ /* Character used as separated in autoload function/variable names. */ #define AUTOLOAD_CHAR '#' -#ifdef FEAT_EVAL -# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch) +#ifdef FEAT_JOB_CHANNEL +# define MAX_OPEN_CHANNELS 10 +#else +# define MAX_OPEN_CHANNELS 0 +#endif + +/* Options for json_encode() and json_decode. */ +#define JSON_JS 1 /* use JS instead of JSON */ +#define JSON_NO_NONE 2 /* v:none item not allowed */ +#define JSON_NL 4 /* append a NL */ + +/* Used for flags of do_in_path() */ +#define DIP_ALL 0x01 /* all matches, not just the first one */ +#define DIP_DIR 0x02 /* find directories instead of files. */ +#define DIP_ERR 0x04 /* give an error message when none found. */ +#define DIP_START 0x08 /* also use "start" directory in 'packpath' */ +#define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */ +#define DIP_NORTP 0x20 /* do not use 'runtimepath' */ +#define DIP_NOAFTER 0x40 /* skip "after" directories */ +#define DIP_AFTER 0x80 /* only use "after" directories */ + +/* Lowest number used for window ID. Cannot have this many windows. */ +#define LOWEST_WIN_ID 1000 + +/* Used by the garbage collector. */ +#define COPYID_INC 2 +#define COPYID_MASK (~0x1) + +/* Values for trans_function_name() argument: */ +#define TFN_INT 1 /* internal function name OK */ +#define TFN_QUIET 2 /* no error messages */ +#define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ +#define TFN_NO_DEREF 8 /* do not dereference a Funcref */ +#define TFN_READ_ONLY 16 /* will not change the var */ + +/* Values for get_lval() flags argument: */ +#define GLV_QUIET TFN_QUIET /* no error messages */ +#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ +#define GLV_READ_ONLY TFN_READ_ONLY /* will not change the var */ + +#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not + be freed. */ + +/* errors for when calling a function */ +#define ERROR_UNKNOWN 0 +#define ERROR_TOOMANY 1 +#define ERROR_TOOFEW 2 +#define ERROR_SCRIPT 3 +#define ERROR_DICT 4 +#define ERROR_NONE 5 +#define ERROR_OTHER 6 +#define ERROR_DELETED 7 + +/* flags for find_name_end() */ +#define FNE_INCL_BR 1 /* include [] in name */ +#define FNE_CHECK_START 2 /* check name starts with valid character */ + +/* BSD is supposed to cover FreeBSD and similar systems. */ +#if (defined(SUN_SYSTEM) || defined(BSD) || defined(__FreeBSD_kernel__)) \ + && defined(S_ISCHR) +# define OPEN_CHR_FILES +#endif + +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# define ELAPSED_TIMEVAL +# define ELAPSED_INIT(v) gettimeofday(&v, NULL) +# define ELAPSED_FUNC(v) elapsed(&v) +# define ELAPSED_TYPE struct timeval + long elapsed(struct timeval *start_tv); #else -# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag) +# if defined(WIN32) +# define ELAPSED_TICKCOUNT +# define ELAPSED_INIT(v) v = GetTickCount() +# define ELAPSED_FUNC(v) elapsed(v) +# define ELAPSED_TYPE DWORD +# ifndef PROTO + long elapsed(DWORD start_tick); +# endif +# endif #endif +/* Replacement for nchar used by nv_replace(). */ +#define REPLACE_CR_NCHAR -1 +#define REPLACE_NL_NCHAR -2 + +/* flags for term_start() */ +#define TERM_START_NOJOB 1 +#define TERM_START_FORCEIT 2 +#define TERM_START_SYSTEM 4 + #endif /* VIM__H */ diff --git a/src/vim.rc b/src/vim.rc index 50a2bb17c4..8ef5f924b6 100644 --- a/src/vim.rc +++ b/src/vim.rc @@ -1,4 +1,4 @@ -// vim:ts=8:sw=4:sts=4: +// vi:set ts=8 sts=4 sw=4 noet: // // VIM - Vi IMproved by Bram Moolenaar // @@ -21,7 +21,7 @@ // // Icons // -IDR_VIM ICON "vim.ico" +IDR_VIM ICON "vim2.ico" #ifdef FEAT_GUI_W32 IDR_VIM_ERROR ICON "vim_error.ico" diff --git a/src/vim16.def b/src/vim16.def deleted file mode 100644 index c982c0fae4..0000000000 --- a/src/vim16.def +++ /dev/null @@ -1,5 +0,0 @@ -CODE PRELOAD EXECUTEONLY -DATA MULTIPLE SHARED -DESCRIPTION 'Vim 7.4' -STACKSIZE 16000 -HEAPSIZE 10000 diff --git a/src/vim16.rc b/src/vim16.rc deleted file mode 100644 index 00395e861d..0000000000 --- a/src/vim16.rc +++ /dev/null @@ -1,81 +0,0 @@ -// vim:ts=8:sw=4:sts=4: -// -// VIM - Vi IMproved by Bram Moolenaar -// -// Do ":help uganda" in Vim to read copying and usage conditions. -// Do ":help credits" in Vim to see a list of people who contributed. - -// vim.rc -// Icon and version information for the Win32 version of Vim -// Must be in DOS format <CR><NL>! - -#include "version.h" -#include "gui_w3~1.h" -#include "guiw16rc.h" - -// -// Icons -// -IDR_VIM ICON "VIM.ICO" - -#ifndef FEAT_TINY -IDR_VIM_ERROR ICON "VIM_ER~1.ICO" -IDR_VIM_ALERT ICON "VIM_AL~1.ICO" -IDR_VIM_INFO ICON "VIM_INFO.ICO" -IDR_VIM_QUESTION ICON "VIM_QU~1.ICO" -#endif - -// -// Bitmaps -// -#ifdef FEAT_TOOLBAR -IDR_TOOLBAR1 BITMAP DISCARDABLE "tools16.bmp" -#endif -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VIM_VERSION_MAJOR,VIM_VERSION_MINOR,VIM_VERSION_BUILD,VIM_VERSION_PATCHLEVEL - PRODUCTVERSION VIM_VERSION_MAJOR,VIM_VERSION_MINOR,VIM_VERSION_BUILD,VIM_VERSION_PATCHLEVEL - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - -#if VIM_VERSION_PATCHLEVEL > 0 - #ifdef _DEBUG - FILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG | VS_FF_PATCHED - #else - FILEFLAGS VS_FF_PRERELEASE | VS_FF_PATCHED - #endif -#else - #ifdef _DEBUG - FILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG - #else - FILEFLAGS VS_FF_PRERELEASE - #endif -#endif - - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - // 0x0409 == U.S. English; 0x04E4 => Windows Multilingual - BLOCK "040904E4" - BEGIN - VALUE "CompanyName", "Vim Developers\0" - VALUE "FileDescription", "Vi Improved - A Text Editor\0" - VALUE "FileVersion", VIM_VERSION_MAJOR_STR ", " VIM_VERSION_MINOR_STR ", " VIM_VERSION_BUILD_STR ", " VIM_VERSION_PATCHLEVEL_STR "\0" - VALUE "InternalName", "VIM\0" - VALUE "LegalCopyright", "Copyright \251 1996\0" - VALUE "LegalTrademarks", "Vim\0" - VALUE "OriginalFilename", "VIM.EXE\0" - VALUE "ProductName", "Vim\0" - VALUE "ProductVersion", VIM_VERSION_MAJOR_STR ", " VIM_VERSION_MINOR_STR ", " VIM_VERSION_BUILD_STR ", " VIM_VERSION_PATCHLEVEL_STR "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 0x4E4 - END -END diff --git a/src/vimio.h b/src/vimio.h index a4dd03096e..9b031ede97 100644 --- a/src/vimio.h +++ b/src/vimio.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * diff --git a/src/vimrun.c b/src/vimrun.c index c423e6cc5f..13efd911e5 100644 --- a/src/vimrun.c +++ b/src/vimrun.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * this file by Vince Negri @@ -17,87 +17,66 @@ #include <stdio.h> #include <stdlib.h> -#ifndef __CYGWIN__ -# include <conio.h> +#include <conio.h> +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN #endif +#include <windows.h> #ifdef __BORLANDC__ -extern char * -#ifdef _RTLDLL -__import -#endif -_oscmd; # define _kbhit kbhit # define _getch getch -#else -# ifdef __MINGW32__ -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include <windows.h> -# else -# ifdef __CYGWIN__ -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include <windows.h> -# define _getch getchar -# else -extern char *_acmdln; -# endif -# endif #endif int main(void) { - const char *p; - int retval; - int inquote = 0; - int silent = 0; + const wchar_t *p; + int retval; + int inquote = 0; + int silent = 0; + HANDLE hstdout; + DWORD written; + + p = (const wchar_t *)GetCommandLineW(); -#ifdef __BORLANDC__ - p = _oscmd; -#else -# if defined(__MINGW32__) || defined(__CYGWIN__) - p = (const char *)GetCommandLine(); -# else - p = _acmdln; -# endif -#endif /* * Skip the executable name, which might be in "". */ while (*p) { - if (*p == '"') + if (*p == L'"') inquote = !inquote; - else if (!inquote && *p == ' ') + else if (!inquote && *p == L' ') { ++p; break; } ++p; } + while (*p == L' ') + ++p; /* * "-s" argument: don't wait for a key hit. */ - if (p[0] == '-' && p[1] == 's' && p[2] == ' ') + if (p[0] == L'-' && p[1] == L's' && p[2] == L' ') { silent = 1; p += 3; - while (*p == ' ') + while (*p == L' ') ++p; } /* Print the command, including quotes and redirection. */ - puts(p); + hstdout = GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsoleW(hstdout, p, wcslen(p), &written, NULL); + WriteConsoleW(hstdout, L"\r\n", 2, &written, NULL); /* * Do it! */ - retval = system(p); + retval = _wsystem(p); if (retval == -1) perror("vimrun system(): "); @@ -108,10 +87,8 @@ main(void) { puts("Hit any key to close this window..."); -#ifndef __CYGWIN__ while (_kbhit()) (void)_getch(); -#endif (void)_getch(); } diff --git a/src/vimtbar.dll b/src/vimtbar.dll deleted file mode 100755 index 6a8dfc95a0..0000000000 Binary files a/src/vimtbar.dll and /dev/null differ diff --git a/src/vimtbar.h b/src/vimtbar.h deleted file mode 100644 index 7427f64776..0000000000 --- a/src/vimtbar.h +++ /dev/null @@ -1,185 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * Win16 Toolbar by Vince Negri - External Header - * (Based on MS Sample Code) - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ -// -// Button Structure -// -typedef struct tagTBBUTTON -{ - int iBitmap; // index into bitmap of this button's picture - int idCommand; // WM_COMMAND menu ID that this button sends - BYTE fsState; // button's state - BYTE fsStyle; // button's style -} TBBUTTON; - -typedef TBBUTTON NEAR* PTBBUTTON; -typedef TBBUTTON FAR* LPTBBUTTON; -typedef const TBBUTTON FAR* LPCTBBUTTON; - - -// -// Styles -// -#define TBSTYLE_BUTTON 0x00 // this entry is button -#define TBSTYLE_SEP 0x01 // this entry is a separator -#define TBSTYLE_CHECK 0x02 // this is a check button (it stays down) -#define TBSTYLE_GROUP 0x04 // this is a check button (it stays down) -#define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) // this group is a member of a group radio group - -// -// States -// -#define TBSTATE_CHECKED 0x01 // radio button is checked -#define TBSTATE_PRESSED 0x02 // button is being depressed (any style) -#define TBSTATE_ENABLED 0x04 // button is enabled -#define TBSTATE_HIDDEN 0x08 // button is hidden -#define TBSTATE_INDETERMINATE 0x10 // button is indeterminate -#define TBSTATE_SELECTED 0x20 // mouse hovering over button (for coolbar look) - - - -typedef struct tagADJUSTINFO -{ - TBBUTTON tbButton; - char szDescription[1]; -} ADJUSTINFO; - -typedef ADJUSTINFO NEAR* PADJUSTINFO; -typedef ADJUSTINFO FAR* LPADJUSTINFO; - - -HWND WINAPI CreateToolbar(HWND hwnd, DWORD ws, WORD wID, int nBitmaps, - HINSTANCE hBMInst, WORD wBMID, - LPCTBBUTTON lpButtons, int iNumButtons); - -#define CMB_DISCARDABLE 0x01 // create bitmap as discardable -#define CMB_MASKED 0x02 // create image/mask pair in bitmap - - -#define TB_ENABLEBUTTON (WM_USER + 1) -// wParam: UINT, button ID -// lParam: BOOL LOWORD, enable if nonzero; HIWORD not used, 0 -// return: not used -// - -#define TB_CHECKBUTTON (WM_USER + 2) -// wParam: UINT, button ID -// lParam: BOOL LOWORD, check if nonzero; HIWORD not used, 0 -// return: not used -// - -#define TB_PRESSBUTTON (WM_USER + 3) -// wParam: UINT, button ID -// lParam: BOOL LOWORD, press if nonzero; HIWORD not used, 0 -// return: not used -// - -#define TB_HIDEBUTTON (WM_USER + 4) -// wParam: UINT, button ID -// lParam: BOOL LOWORD, hide if nonzero; HIWORD not used, 0 -// return: not used -// -#define TB_INDETERMINATE (WM_USER + 5) -// wParam: UINT, button ID -// lParam: BOOL LOWORD, make indeterminate if nonzero; HIWORD not used, 0 -// return: not used -// - -#define TB_ISBUTTONENABLED (WM_USER + 9) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: BOOL LOWORD, enabled if nonzero; HIWORD not used -// - -#define TB_ISBUTTONCHECKED (WM_USER + 10) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: BOOL LOWORD, checked if nonzero; HIWORD not used -// - -#define TB_ISBUTTONPRESSED (WM_USER + 11) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: BOOL LOWORD, pressed if nonzero; HIWORD not used -// - -#define TB_ISBUTTONHIDDEN (WM_USER + 12) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: BOOL LOWORD, hidden if nonzero; HIWORD not used -// - -#define TB_ISBUTTONINDETERMINATE (WM_USER + 13) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: BOOL LOWORD, indeterminate if nonzero; HIWORD not used -// - -#define TB_SETSTATE (WM_USER + 17) -// wParam: UINT, button ID -// lParam: UINT LOWORD, state bits; HIWORD not used, 0 -// return: not used -// - -#define TB_GETSTATE (WM_USER + 18) -// wParam: UINT, button ID -// lParam: not used, 0 -// return: UINT LOWORD, state bits; HIWORD not used -// - -#define TB_ADDBITMAP (WM_USER + 19) -// wParam: UINT, number of button graphics in bitmap -// lParam: one of: -// HINSTANCE LOWORD, module handle; UINT HIWORD, resource id -// HINSTANCE LOWORD, NULL; HBITMAP HIWORD, bitmap handle -// return: one of: -// int LOWORD, index for first new button; HIWORD not used -// int LOWORD, -1 indicating error; HIWORD not used -// - -#define TB_ADDBUTTONS (WM_USER + 20) -// wParam: UINT, number of buttons to add -// lParam: LPTBBUTTON, pointer to array of TBBUTTON structures -// return: not used -// - -#define TB_INSERTBUTTON (WM_USER + 21) -// wParam: UINT, index for insertion (appended if index doesn't exist) -// lParam: LPTBBUTTON, pointer to one TBBUTTON structure -// return: not used -// - -#define TB_DELETEBUTTON (WM_USER + 22) -// wParam: UINT, index of button to delete -// lParam: not used, 0 -// return: not used -// - -#define TB_GETBUTTON (WM_USER + 23) -// wParam: UINT, index of button to get -// lParam: LPTBBUTTON, pointer to TBBUTTON buffer to receive button -// return: not used -// - -#define TB_BUTTONCOUNT (WM_USER + 24) -// wParam: not used, 0 -// lParam: not used, 0 -// return: UINT LOWORD, number of buttons; HIWORD not used -// - -#define TB_COMMANDTOINDEX (WM_USER + 25) -// wParam: UINT, command id -// lParam: not used, 0 -// return: UINT LOWORD, index of button (-1 if command not found); -// HIWORD not used -// - - -#define TBN_BEGINDRAG 0x0201 -#define TBN_ENDDRAG 0x0203 diff --git a/src/vimtbar.lib b/src/vimtbar.lib deleted file mode 100644 index 413b7dac98..0000000000 Binary files a/src/vimtbar.lib and /dev/null differ diff --git a/src/vimtutor b/src/vimtutor index 70d9ec7412..1e8769b257 100755 --- a/src/vimtutor +++ b/src/vimtutor @@ -11,12 +11,12 @@ # Vim could be called "vim" or "vi". Also check for "vimN", for people who # have Vim installed with its version number. -# We anticipate up to a future Vim 8 version :-). -seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi" +# We anticipate up to a future Vim 8.1 version :-). +seq="vim vim81 vim80 vim8 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi" if test "$1" = "-g"; then # Try to use the GUI version of Vim if possible, it will fall back # on Vim if Gvim is not installed. - seq="gvim gvim8 gvim75 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq" + seq="gvim gvim81 gvim80 gvim8 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq" shift fi @@ -70,5 +70,5 @@ fi # The script tutor.vim tells Vim which file to copy $VIM -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim' -# Start vim without any .vimrc, set 'nocompatible' -$VIM -f -u NONE -c "set nocp" $TUTORCOPY +# Start vim without any .vimrc, set 'nocompatible' and 'showcmd' +$VIM -f -u NONE -c "set nocp showcmd" $TUTORCOPY diff --git a/src/winclip.c b/src/winclip.c index f34c7d97ff..4bafa8d737 100644 --- a/src/winclip.c +++ b/src/winclip.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -10,19 +10,10 @@ /* * winclip.c * - * Routines common to both Win16 and Win32 for clipboard handling. + * Routines for Win32 clipboard handling. * Also used by Cygwin, using os_unix.c. */ -#ifdef WIN16 -# ifdef __BORLANDC__ -# pragma warn -par -# pragma warn -ucp -# pragma warn -use -# pragma warn -aus -# endif -#endif - #include "vimio.h" #include "vim.h" @@ -223,9 +214,8 @@ typedef struct /* * Make vim the owner of the current selection. Return OK upon success. */ -/*ARGSUSED*/ int -clip_mch_own_selection(VimClipboard *cbd) +clip_mch_own_selection(VimClipboard *cbd UNUSED) { /* * Never actually own the clipboard. If another application sets the @@ -237,9 +227,8 @@ clip_mch_own_selection(VimClipboard *cbd) /* * Make vim NOT the owner of the current selection. */ -/*ARGSUSED*/ void -clip_mch_lose_selection(VimClipboard *cbd) +clip_mch_lose_selection(VimClipboard *cbd UNUSED) { /* Nothing needs to be done here */ } @@ -779,11 +768,11 @@ utf16_to_enc(short_u *str, int *lenp) * The result is in allocated memory: "out[outlen]". With terminating NUL. */ void -acp_to_enc(str, str_size, out, outlen) - char_u *str; - int str_size; - char_u **out; - int *outlen; +acp_to_enc( + char_u *str, + int str_size, + char_u **out, + int *outlen) { LPWSTR widestr; @@ -804,11 +793,11 @@ acp_to_enc(str, str_size, out, outlen) * The result is in allocated memory: "out[outlen]". With terminating NUL. */ void -enc_to_acp(str, str_size, out, outlen) - char_u *str; - int str_size; - char_u **out; - int *outlen; +enc_to_acp( + char_u *str, + int str_size, + char_u **out, + int *outlen) { LPWSTR widestr; diff --git a/src/window.c b/src/window.c index d9cd6991bd..1d9c3b0d4b 100644 --- a/src/window.c +++ b/src/window.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -9,85 +9,66 @@ #include "vim.h" -static int path_is_url __ARGS((char_u *p)); -#if defined(FEAT_WINDOWS) || defined(PROTO) -static void win_init __ARGS((win_T *newp, win_T *oldp, int flags)); -static void win_init_some __ARGS((win_T *newp, win_T *oldp)); -static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col)); -static void frame_setheight __ARGS((frame_T *curfrp, int height)); -#ifdef FEAT_VERTSPLIT -static void frame_setwidth __ARGS((frame_T *curfrp, int width)); -#endif -static void win_exchange __ARGS((long)); -static void win_rotate __ARGS((int, int)); -static void win_totop __ARGS((int size, int flags)); -static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height)); -static int last_window __ARGS((void)); -static int close_last_window_tabpage __ARGS((win_T *win, int free_buf, tabpage_T *prev_curtab)); -static win_T *win_free_mem __ARGS((win_T *win, int *dirp, tabpage_T *tp)); -static frame_T *win_altframe __ARGS((win_T *win, tabpage_T *tp)); -static tabpage_T *alt_tabpage __ARGS((void)); -static win_T *frame2win __ARGS((frame_T *frp)); -static int frame_has_win __ARGS((frame_T *frp, win_T *wp)); -static void frame_new_height __ARGS((frame_T *topfrp, int height, int topfirst, int wfh)); -static int frame_fixed_height __ARGS((frame_T *frp)); -#ifdef FEAT_VERTSPLIT -static int frame_fixed_width __ARGS((frame_T *frp)); -static void frame_add_statusline __ARGS((frame_T *frp)); -static void frame_new_width __ARGS((frame_T *topfrp, int width, int leftfirst, int wfw)); -static void frame_add_vsep __ARGS((frame_T *frp)); -static int frame_minwidth __ARGS((frame_T *topfrp, win_T *next_curwin)); -static void frame_fix_width __ARGS((win_T *wp)); -#endif -#endif -static int win_alloc_firstwin __ARGS((win_T *oldwin)); -static void new_frame __ARGS((win_T *wp)); -#if defined(FEAT_WINDOWS) || defined(PROTO) -static tabpage_T *alloc_tabpage __ARGS((void)); -static int leave_tabpage __ARGS((buf_T *new_curbuf, int trigger_leave_autocmds)); -static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds)); -static void frame_fix_height __ARGS((win_T *wp)); -static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin)); -static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin, int trigger_enter_autocmds, int trigger_leave_autocmds)); -static void win_free __ARGS((win_T *wp, tabpage_T *tp)); -static void frame_append __ARGS((frame_T *after, frame_T *frp)); -static void frame_insert __ARGS((frame_T *before, frame_T *frp)); -static void frame_remove __ARGS((frame_T *frp)); -# ifdef FEAT_VERTSPLIT -static void win_goto_ver __ARGS((int up, long count)); -static void win_goto_hor __ARGS((int left, long count)); -# endif -static void frame_add_height __ARGS((frame_T *frp, int n)); -static void last_status_rec __ARGS((frame_T *fr, int statusline)); - -static void make_snapshot_rec __ARGS((frame_T *fr, frame_T **frp)); -static void clear_snapshot __ARGS((tabpage_T *tp, int idx)); -static void clear_snapshot_rec __ARGS((frame_T *fr)); -static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); -static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); - -static int frame_check_height __ARGS((frame_T *topfrp, int height)); -#ifdef FEAT_VERTSPLIT -static int frame_check_width __ARGS((frame_T *topfrp, int width)); -#endif - -#endif /* FEAT_WINDOWS */ - -static win_T *win_alloc __ARGS((win_T *after, int hidden)); -static void set_fraction __ARGS((win_T *wp)); +static int path_is_url(char_u *p); +static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize, long Prenum); +static void win_init(win_T *newp, win_T *oldp, int flags); +static void win_init_some(win_T *newp, win_T *oldp); +static void frame_comp_pos(frame_T *topfrp, int *row, int *col); +static void frame_setheight(frame_T *curfrp, int height); +static void frame_setwidth(frame_T *curfrp, int width); +static void win_exchange(long); +static void win_rotate(int, int); +static void win_totop(int size, int flags); +static void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height); +static int last_window(void); +static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_curtab); +static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp); +static frame_T *win_altframe(win_T *win, tabpage_T *tp); +static tabpage_T *alt_tabpage(void); +static win_T *frame2win(frame_T *frp); +static int frame_has_win(frame_T *frp, win_T *wp); +static void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh); +static int frame_fixed_height(frame_T *frp); +static int frame_fixed_width(frame_T *frp); +static void frame_add_statusline(frame_T *frp); +static void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw); +static void frame_add_vsep(frame_T *frp); +static int frame_minwidth(frame_T *topfrp, win_T *next_curwin); +static void frame_fix_width(win_T *wp); +static int win_alloc_firstwin(win_T *oldwin); +static void new_frame(win_T *wp); +static tabpage_T *alloc_tabpage(void); +static int leave_tabpage(buf_T *new_curbuf, int trigger_leave_autocmds); +static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds); +static void frame_fix_height(win_T *wp); +static int frame_minheight(frame_T *topfrp, win_T *next_curwin); +static void win_enter_ext(win_T *wp, int undo_sync, int no_curwin, int trigger_new_autocmds, int trigger_enter_autocmds, int trigger_leave_autocmds); +static void win_free(win_T *wp, tabpage_T *tp); +static void frame_append(frame_T *after, frame_T *frp); +static void frame_insert(frame_T *before, frame_T *frp); +static void frame_remove(frame_T *frp); +static void win_goto_ver(int up, long count); +static void win_goto_hor(int left, long count); +static void frame_add_height(frame_T *frp, int n); +static void last_status_rec(frame_T *fr, int statusline); + +static void make_snapshot_rec(frame_T *fr, frame_T **frp); +static void clear_snapshot(tabpage_T *tp, int idx); +static void clear_snapshot_rec(frame_T *fr); +static int check_snapshot_rec(frame_T *sn, frame_T *fr); +static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr); + +static int frame_check_height(frame_T *topfrp, int height); +static int frame_check_width(frame_T *topfrp, int width); + +static win_T *win_alloc(win_T *after, int hidden); #define URL_SLASH 1 /* path_is_url() has found "://" */ #define URL_BACKSLASH 2 /* path_is_url() has found ":\\" */ #define NOWIN (win_T *)-1 /* non-existing window */ -#ifdef FEAT_WINDOWS -# define ROWS_AVAIL (Rows - p_ch - tabline_height()) -#else -# define ROWS_AVAIL (Rows - p_ch) -#endif - -#if defined(FEAT_WINDOWS) || defined(PROTO) +#define ROWS_AVAIL (Rows - p_ch - tabline_height()) static char *m_onlyone = N_("Already only one window"); @@ -95,10 +76,10 @@ static char *m_onlyone = N_("Already only one window"); * all CTRL-W window commands are handled here, called from normal_cmd(). */ void -do_window(nchar, Prenum, xchar) - int nchar; - long Prenum; - int xchar; /* extra char from ":wincmd gx" or NUL */ +do_window( + int nchar, + long Prenum, + int xchar) /* extra char from ":wincmd gx" or NUL */ { long Prenum1; win_T *wp; @@ -118,9 +99,16 @@ do_window(nchar, Prenum, xchar) Prenum1 = Prenum; #ifdef FEAT_CMDWIN -# define CHECK_CMDWIN if (cmdwin_type != 0) { EMSG(_(e_cmdwin)); break; } +# define CHECK_CMDWIN \ + do { \ + if (cmdwin_type != 0) \ + { \ + EMSG(_(e_cmdwin)); \ + return; \ + } \ + } while (0) #else -# define CHECK_CMDWIN +# define CHECK_CMDWIN do { /**/ } while (0) #endif switch (nchar) @@ -129,7 +117,7 @@ do_window(nchar, Prenum, xchar) case 'S': case Ctrl_S: case 's': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ #ifdef FEAT_QUICKFIX /* When splitting the quickfix window open a new buffer in it, @@ -140,44 +128,39 @@ do_window(nchar, Prenum, xchar) #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif - win_split((int)Prenum, 0); + (void)win_split((int)Prenum, 0); break; -#ifdef FEAT_VERTSPLIT /* split current window in two parts, vertically */ case Ctrl_V: case 'v': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX /* When splitting the quickfix window open a new buffer in it, * don't replicate the quickfix buffer. */ if (bt_quickfix(curbuf)) goto newwindow; -# endif -# ifdef FEAT_GUI +#endif +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif - win_split((int)Prenum, WSP_VERT); - break; #endif + (void)win_split((int)Prenum, WSP_VERT); + break; /* split current window and edit alternate file */ case Ctrl_HAT: case '^': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ - STRCPY(cbuf, "split #"); - if (Prenum) - vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7, - "%ld", Prenum); + cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; /* open new window */ case Ctrl_N: case 'n': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ #ifdef FEAT_QUICKFIX newwindow: @@ -187,7 +170,7 @@ do_window(nchar, Prenum, xchar) vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum); else cbuf[0] = NUL; -#if defined(FEAT_VERTSPLIT) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) if (nchar == 'v' || nchar == Ctrl_V) STRCAT(cbuf, "v"); #endif @@ -199,28 +182,30 @@ do_window(nchar, Prenum, xchar) case Ctrl_Q: case 'q': reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"quit"); + cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum); + do_cmdline_cmd(cbuf); break; /* close current window */ case Ctrl_C: case 'c': reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"close"); + cmd_with_count("close", cbuf, sizeof(cbuf), Prenum); + do_cmdline_cmd(cbuf); break; -#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* close preview window */ case Ctrl_Z: case 'z': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ do_cmdline_cmd((char_u *)"pclose"); break; /* cursor to preview window */ case 'P': - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_p_pvw) break; if (wp == NULL) @@ -233,9 +218,10 @@ do_window(nchar, Prenum, xchar) /* close all but current window */ case Ctrl_O: case 'o': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"only"); + cmd_with_count("only", cbuf, sizeof(cbuf), Prenum); + do_cmdline_cmd(cbuf); break; /* cursor to next window with wrap around */ @@ -243,8 +229,8 @@ do_window(nchar, Prenum, xchar) case 'w': /* cursor to previous window with wrap around */ case 'W': - CHECK_CMDWIN - if (firstwin == lastwin && Prenum != 1) /* just one window */ + CHECK_CMDWIN; + if (ONE_WINDOW && Prenum != 1) /* just one window */ beep_flush(); else { @@ -281,39 +267,24 @@ do_window(nchar, Prenum, xchar) case 'j': case K_DOWN: case Ctrl_J: - CHECK_CMDWIN -#ifdef FEAT_VERTSPLIT + CHECK_CMDWIN; win_goto_ver(FALSE, Prenum1); -#else - for (wp = curwin; wp->w_next != NULL && Prenum1-- > 0; - wp = wp->w_next) - ; - win_goto(wp); -#endif break; /* cursor to window above */ case 'k': case K_UP: case Ctrl_K: - CHECK_CMDWIN -#ifdef FEAT_VERTSPLIT + CHECK_CMDWIN; win_goto_ver(TRUE, Prenum1); -#else - for (wp = curwin; wp->w_prev != NULL && Prenum1-- > 0; - wp = wp->w_prev) - ; - win_goto(wp); -#endif break; -#ifdef FEAT_VERTSPLIT /* cursor to left window */ case 'h': case K_LEFT: case Ctrl_H: case K_BS: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_hor(TRUE, Prenum1); break; @@ -321,10 +292,9 @@ do_window(nchar, Prenum, xchar) case 'l': case K_RIGHT: case Ctrl_L: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_hor(FALSE, Prenum1); break; -#endif /* move window to new tab page */ case 'T': @@ -366,7 +336,7 @@ do_window(nchar, Prenum, xchar) /* cursor to last accessed (previous) window */ case 'p': case Ctrl_P: - if (prevwin == NULL) + if (!win_valid(prevwin)) beep_flush(); else win_goto(prevwin); @@ -375,21 +345,21 @@ do_window(nchar, Prenum, xchar) /* exchange current and next window */ case 'x': case Ctrl_X: - CHECK_CMDWIN + CHECK_CMDWIN; win_exchange(Prenum); break; /* rotate windows downwards */ case Ctrl_R: case 'r': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ win_rotate(FALSE, (int)Prenum1); /* downwards */ break; /* rotate windows upwards */ case 'R': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ win_rotate(TRUE, (int)Prenum1); /* upwards */ break; @@ -397,11 +367,9 @@ do_window(nchar, Prenum, xchar) /* move window to the very top/bottom/left/right */ case 'K': case 'J': -#ifdef FEAT_VERTSPLIT case 'H': case 'L': -#endif - CHECK_CMDWIN + CHECK_CMDWIN; win_totop((int)Prenum, ((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0) | ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT)); @@ -440,7 +408,6 @@ do_window(nchar, Prenum, xchar) win_setheight(Prenum ? (int)Prenum : 9999); break; -#ifdef FEAT_VERTSPLIT /* increase current window width */ case '>': #ifdef FEAT_GUI @@ -464,29 +431,32 @@ do_window(nchar, Prenum, xchar) #endif win_setwidth(Prenum != 0 ? (int)Prenum : 9999); break; -#endif /* jump to tag and split window if tag exists (in preview window) */ #if defined(FEAT_QUICKFIX) case '}': - CHECK_CMDWIN + CHECK_CMDWIN; if (Prenum) g_do_tagpreview = Prenum; else g_do_tagpreview = p_pvh; - /*FALLTHROUGH*/ #endif + /* FALLTHROUGH */ case ']': case Ctrl_RSB: - CHECK_CMDWIN - reset_VIsual_and_resel(); /* stop Visual mode */ + CHECK_CMDWIN; + /* keep Visual mode, can select words to use as a tag */ if (Prenum) postponed_split = Prenum; else postponed_split = -1; +#ifdef FEAT_QUICKFIX + if (nchar != '}') + g_do_tagpreview = 0; +#endif - /* Execute the command right here, required when - * "wincmd ]" was used in a function. */ + /* Execute the command right here, required when "wincmd ]" + * was used in a function. */ do_nv_ident(Ctrl_RSB, NUL); break; @@ -496,11 +466,13 @@ do_window(nchar, Prenum, xchar) case 'F': case Ctrl_F: wingotofile: - CHECK_CMDWIN + CHECK_CMDWIN; ptr = grab_file_name(Prenum1, &lnum); if (ptr != NULL) { + tabpage_T *oldtab = curtab; + win_T *oldwin = curwin; # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif @@ -508,9 +480,15 @@ do_window(nchar, Prenum, xchar) if (win_split(0, 0) == OK) { RESET_BINDING(curwin); - (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, - ECMD_HIDE, NULL); - if (nchar == 'F' && lnum >= 0) + if (do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, + ECMD_HIDE, NULL) == FAIL) + { + /* Failed to open the file, close the window + * opened for it. */ + win_close(curwin, FALSE); + goto_tabpage_win(oldtab, oldwin); + } + else if (nchar == 'F' && lnum >= 0) { curwin->w_cursor.lnum = lnum; check_cursor_lnum(); @@ -532,7 +510,7 @@ do_window(nchar, Prenum, xchar) /* FALLTHROUGH */ case 'd': /* Go to definition, using 'define' */ case Ctrl_D: - CHECK_CMDWIN + CHECK_CMDWIN; if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) break; find_pattern_in_path(ptr, 0, len, TRUE, @@ -563,7 +541,7 @@ do_window(nchar, Prenum, xchar) /* CTRL-W g extended commands */ case 'g': case Ctrl_G: - CHECK_CMDWIN + CHECK_CMDWIN; #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ #endif @@ -586,11 +564,11 @@ do_window(nchar, Prenum, xchar) g_do_tagpreview = Prenum; else g_do_tagpreview = p_pvh; - /*FALLTHROUGH*/ #endif + /* FALLTHROUGH */ case ']': case Ctrl_RSB: - reset_VIsual_and_resel(); /* stop Visual mode */ + /* keep Visual mode, can select words to use as a tag */ if (Prenum) postponed_split = Prenum; else @@ -619,6 +597,120 @@ do_window(nchar, Prenum, xchar) } } +/* + * Figure out the address type for ":wnncmd". + */ + void +get_wincmd_addr_type(char_u *arg, exarg_T *eap) +{ + switch (*arg) + { + case 'S': + case Ctrl_S: + case 's': + case Ctrl_N: + case 'n': + case 'j': + case Ctrl_J: + case 'k': + case Ctrl_K: + case 'T': + case Ctrl_R: + case 'r': + case 'R': + case 'K': + case 'J': + case '+': + case '-': + case Ctrl__: + case '_': + case '|': + case ']': + case Ctrl_RSB: + case 'g': + case Ctrl_G: + case Ctrl_V: + case 'v': + case 'h': + case Ctrl_H: + case 'l': + case Ctrl_L: + case 'H': + case 'L': + case '>': + case '<': +#if defined(FEAT_QUICKFIX) + case '}': +#endif +#ifdef FEAT_SEARCHPATH + case 'f': + case 'F': + case Ctrl_F: +#endif +#ifdef FEAT_FIND_ID + case 'i': + case Ctrl_I: + case 'd': + case Ctrl_D: +#endif + /* window size or any count */ + eap->addr_type = ADDR_LINES; + break; + + case Ctrl_HAT: + case '^': + /* buffer number */ + eap->addr_type = ADDR_BUFFERS; + break; + + case Ctrl_Q: + case 'q': + case Ctrl_C: + case 'c': + case Ctrl_O: + case 'o': + case Ctrl_W: + case 'w': + case 'W': + case 'x': + case Ctrl_X: + /* window number */ + eap->addr_type = ADDR_WINDOWS; + break; + +#if defined(FEAT_QUICKFIX) + case Ctrl_Z: + case 'z': + case 'P': +#endif + case 't': + case Ctrl_T: + case 'b': + case Ctrl_B: + case 'p': + case Ctrl_P: + case '=': + case CAR: + /* no count */ + eap->addr_type = 0; + break; + } +} + + static void +cmd_with_count( + char *cmd, + char_u *bufp, + size_t bufsize, + long Prenum) +{ + size_t len = STRLEN(cmd); + + STRCPY(bufp, cmd); + if (Prenum > 0) + vim_snprintf((char *)bufp + len, bufsize - len, "%ld", Prenum); +} + /* * split the current window, implements CTRL-W s and :split * @@ -635,9 +727,7 @@ do_window(nchar, Prenum, xchar) * return FAIL for failure, OK otherwise */ int -win_split(size, flags) - int size; - int flags; +win_split(int size, int flags) { /* When the ":tab" modifier was used open a new tab page instead. */ if (may_open_tabpage() == OK) @@ -668,11 +758,11 @@ win_split(size, flags) * return FAIL for failure, OK otherwise */ int -win_split_ins(size, flags, new_wp, dir) - int size; - int flags; - win_T *new_wp; - int dir; +win_split_ins( + int size, + int flags, + win_T *new_wp, + int dir) { win_T *wp = new_wp; win_T *oldwin; @@ -688,6 +778,7 @@ win_split_ins(size, flags, new_wp, dir) int before; int minheight; int wmh1; + int did_set_fraction = FALSE; if (flags & WSP_TOP) oldwin = firstwin; @@ -697,9 +788,9 @@ win_split_ins(size, flags, new_wp, dir) oldwin = curwin; /* add a status line when p_ls == 1 and splitting the first window */ - if (lastwin == firstwin && p_ls == 1 && oldwin->w_status_height == 0) + if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0) { - if (oldwin->w_height <= p_wmh && new_wp == NULL) + if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) { EMSG(_(e_noroom)); return FAIL; @@ -713,7 +804,6 @@ win_split_ins(size, flags, new_wp, dir) out_flush(); #endif -#ifdef FEAT_VERTSPLIT if (flags & WSP_VERT) { int wmw1; @@ -777,9 +867,9 @@ win_split_ins(size, flags, new_wp, dir) /* We don't like to take lines for the new window from a * 'winfixwidth' window. Take them from a window to the left or right - * instead, if possible. */ + * instead, if possible. Add one for the separator. */ if (oldwin->w_p_wfw) - win_setwidth_win(oldwin->w_width + new_size, oldwin); + win_setwidth_win(oldwin->w_width + new_size + 1, oldwin); /* Only make all windows the same width if one of them (except oldwin) * is wider than one of the split windows. */ @@ -792,7 +882,7 @@ win_split_ins(size, flags, new_wp, dir) if (frp->fr_win != oldwin && frp->fr_win != NULL && (frp->fr_win->w_width > new_size || frp->fr_win->w_width > oldwin->w_width - - new_size - STATUS_HEIGHT)) + - new_size - 1)) { do_equal = TRUE; break; @@ -802,7 +892,6 @@ win_split_ins(size, flags, new_wp, dir) } } else -#endif { layout = FR_COL; @@ -811,7 +900,7 @@ win_split_ins(size, flags, new_wp, dir) * height. */ /* Current window requires at least 1 space. */ - wmh1 = (p_wmh == 0 ? 1 : p_wmh); + wmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin); needed = wmh1 + STATUS_HEIGHT; if (flags & WSP_ROOM) needed += p_wh - wmh1; @@ -871,6 +960,11 @@ win_split_ins(size, flags, new_wp, dir) * instead, if possible. */ if (oldwin->w_p_wfh) { + /* Set w_fraction now so that the cursor keeps the same relative + * vertical position using the old height. */ + set_fraction(oldwin); + did_set_fraction = TRUE; + win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT, oldwin); oldwin_height = oldwin->w_height; @@ -880,10 +974,7 @@ win_split_ins(size, flags, new_wp, dir) /* Only make all windows the same height if one of them (except oldwin) * is higher than one of the split windows. */ - if (!do_equal && p_ea && size == 0 -#ifdef FEAT_VERTSPLIT - && *p_ead != 'h' -#endif + if (!do_equal && p_ea && size == 0 && *p_ead != 'h' && oldwin->w_frame->fr_parent != NULL) { frp = oldwin->w_frame->fr_parent->fr_child; @@ -909,11 +1000,7 @@ win_split_ins(size, flags, new_wp, dir) && ((flags & WSP_BOT) || (flags & WSP_BELOW) || (!(flags & WSP_ABOVE) - && ( -#ifdef FEAT_VERTSPLIT - (flags & WSP_VERT) ? p_spr : -#endif - p_sb)))) + && ( (flags & WSP_VERT) ? p_spr : p_sb)))) { /* new window below/right of current one */ if (new_wp == NULL) @@ -950,12 +1037,8 @@ win_split_ins(size, flags, new_wp, dir) */ if (flags & (WSP_TOP | WSP_BOT)) { -#ifdef FEAT_VERTSPLIT if ((topframe->fr_layout == FR_COL && (flags & WSP_VERT) == 0) || (topframe->fr_layout == FR_ROW && (flags & WSP_VERT) != 0)) -#else - if (topframe->fr_layout == FR_COL) -#endif { curfrp = topframe->fr_child; if (flags & WSP_BOT) @@ -973,12 +1056,9 @@ win_split_ins(size, flags, new_wp, dir) before = FALSE; else if (flags & WSP_ABOVE) before = TRUE; - else -#ifdef FEAT_VERTSPLIT - if (flags & WSP_VERT) + else if (flags & WSP_VERT) before = !p_spr; else -#endif before = !p_sb; } if (curfrp->fr_parent == NULL || curfrp->fr_parent->fr_layout != layout) @@ -1014,11 +1094,10 @@ win_split_ins(size, flags, new_wp, dir) /* Set w_fraction now so that the cursor keeps the same relative * vertical position. */ - if (oldwin->w_height > 0) + if (!did_set_fraction) set_fraction(oldwin); wp->w_fraction = oldwin->w_fraction; -#ifdef FEAT_VERTSPLIT if (flags & WSP_VERT) { wp->w_p_scr = curwin->w_p_scr; @@ -1032,14 +1111,15 @@ win_split_ins(size, flags, new_wp, dir) { /* set height and row of new window to full height */ wp->w_winrow = tabline_height(); - win_new_height(wp, curfrp->fr_height - (p_ls > 0)); + win_new_height(wp, curfrp->fr_height - (p_ls > 0) + - WINBAR_HEIGHT(wp)); wp->w_status_height = (p_ls > 0); } else { /* height and row of new window is same as current window */ wp->w_winrow = oldwin->w_winrow; - win_new_height(wp, oldwin->w_height); + win_new_height(wp, VISIBLE_HEIGHT(oldwin)); wp->w_status_height = oldwin->w_status_height; } frp->fr_height = curfrp->fr_height; @@ -1076,10 +1156,8 @@ win_split_ins(size, flags, new_wp, dir) frame_fix_width(wp); } else -#endif { /* width and column of new window is same as current window */ -#ifdef FEAT_VERTSPLIT if (flags & (WSP_TOP | WSP_BOT)) { wp->w_wincol = 0; @@ -1093,14 +1171,19 @@ win_split_ins(size, flags, new_wp, dir) wp->w_vsep_width = oldwin->w_vsep_width; } frp->fr_width = curfrp->fr_width; -#endif /* "new_size" of the current window goes to the new window, use * one row for the status line */ win_new_height(wp, new_size); if (flags & (WSP_TOP | WSP_BOT)) - frame_new_height(curfrp, curfrp->fr_height - - (new_size + STATUS_HEIGHT), flags & WSP_TOP, FALSE); + { + int new_fr_height = curfrp->fr_height - new_size + + WINBAR_HEIGHT(wp) ; + + if (!((flags & WSP_BOT) && p_ls == 0)) + new_fr_height -= STATUS_HEIGHT; + frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE); + } else win_new_height(oldwin, oldwin_height - (new_size + STATUS_HEIGHT)); if (before) /* new window above current one */ @@ -1111,14 +1194,14 @@ win_split_ins(size, flags, new_wp, dir) } else /* new window below current one */ { - wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT; + wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin) + + STATUS_HEIGHT; wp->w_status_height = oldwin->w_status_height; - oldwin->w_status_height = STATUS_HEIGHT; + if (!(flags & WSP_BOT)) + oldwin->w_status_height = STATUS_HEIGHT; } -#ifdef FEAT_VERTSPLIT if (flags & WSP_BOT) frame_add_statusline(curfrp); -#endif frame_fix_height(wp); frame_fix_height(oldwin); } @@ -1154,15 +1237,11 @@ win_split_ins(size, flags, new_wp, dir) */ if (do_equal || dir != 0) win_equal(wp, TRUE, -#ifdef FEAT_VERTSPLIT (flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h') - : dir == 'h' ? 'b' : -#endif - 'v'); + : dir == 'h' ? 'b' : 'v'); /* Don't change the window height/width to 'winheight' / 'winwidth' if a * size was given. */ -#ifdef FEAT_VERTSPLIT if (flags & WSP_VERT) { i = p_wiw; @@ -1176,22 +1255,24 @@ win_split_ins(size, flags, new_wp, dir) # endif } else -#endif { i = p_wh; if (size != 0) p_wh = size; } +#ifdef FEAT_JUMPLIST + /* Keep same changelist position in new window. */ + wp->w_changelistidx = oldwin->w_changelistidx; +#endif + /* * make the new window the current window */ - win_enter(wp, FALSE); -#ifdef FEAT_VERTSPLIT + win_enter_ext(wp, FALSE, FALSE, TRUE, TRUE, TRUE); if (flags & WSP_VERT) p_wiw = i; else -#endif p_wh = i; return OK; @@ -1206,10 +1287,7 @@ win_split_ins(size, flags, new_wp, dir) * being copied. */ static void -win_init(newp, oldp, flags) - win_T *newp; - win_T *oldp; - int flags UNUSED; +win_init(win_T *newp, win_T *oldp, int flags UNUSED) { int i; @@ -1271,13 +1349,11 @@ win_init(newp, oldp, flags) } /* - * Initialize window "newp" from window"old". + * Initialize window "newp" from window "old". * Only the essential things are copied. */ static void -win_init_some(newp, oldp) - win_T *newp; - win_T *oldp; +win_init_some(win_T *newp, win_T *oldp) { /* Use the same argument list. */ newp->w_alist = oldp->w_alist; @@ -1288,36 +1364,55 @@ win_init_some(newp, oldp) win_copy_options(oldp, newp); } -#endif /* FEAT_WINDOWS */ -#if defined(FEAT_WINDOWS) || defined(PROTO) /* - * Check if "win" is a pointer to an existing window. + * Check if "win" is a pointer to an existing window in the current tab page. */ int -win_valid(win) - win_T *win; +win_valid(win_T *win) { win_T *wp; if (win == NULL) return FALSE; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp == win) return TRUE; return FALSE; } +/* + * Check if "win" is a pointer to an existing window in any tab page. + */ + int +win_valid_any_tab(win_T *win) +{ + win_T *wp; + tabpage_T *tp; + + if (win == NULL) + return FALSE; + FOR_ALL_TABPAGES(tp) + { + FOR_ALL_WINDOWS_IN_TAB(tp, wp) + { + if (wp == win) + return TRUE; + } + } + return FALSE; +} + /* * Return the number of windows. */ int -win_count() +win_count(void) { win_T *wp; int count = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) ++count; return count; } @@ -1329,14 +1424,13 @@ win_count() * (excluding the command line). */ int -make_windows(count, vertical) - int count; - int vertical UNUSED; /* split windows vertically if TRUE */ +make_windows( + int count, + int vertical UNUSED) /* split windows vertically if TRUE */ { int maxcount; int todo; -#ifdef FEAT_VERTSPLIT if (vertical) { /* Each windows needs at least 'winminwidth' lines and a separator @@ -1345,10 +1439,9 @@ make_windows(count, vertical) - (p_wiw - p_wmw)) / (p_wmw + 1); } else -#endif { /* Each window needs at least 'winminheight' lines and a status line. */ - maxcount = (curwin->w_height + curwin->w_status_height + maxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height - (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT); } @@ -1363,17 +1456,14 @@ make_windows(count, vertical) if (count > 1) last_status(TRUE); -#ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the windows. Must do that * when putting the buffers in the windows. */ block_autocmds(); -#endif /* todo is number of windows left to create */ for (todo = count - 1; todo > 0; --todo) -#ifdef FEAT_VERTSPLIT if (vertical) { if (win_split(curwin->w_width - (curwin->w_width - todo) @@ -1381,7 +1471,6 @@ make_windows(count, vertical) break; } else -#endif { if (win_split(curwin->w_height - (curwin->w_height - todo * STATUS_HEIGHT) / (todo + 1) @@ -1389,9 +1478,7 @@ make_windows(count, vertical) break; } -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif /* return actual number of windows */ return (count - todo); @@ -1401,8 +1488,7 @@ make_windows(count, vertical) * Exchange current and next window */ static void -win_exchange(Prenum) - long Prenum; +win_exchange(long Prenum) { frame_T *frp; frame_T *frp2; @@ -1410,7 +1496,7 @@ win_exchange(Prenum) win_T *wp2; int temp; - if (lastwin == firstwin) /* just one window */ + if (ONE_WINDOW) /* just one window */ { beep_flush(); return; @@ -1470,7 +1556,6 @@ win_exchange(Prenum) temp = curwin->w_status_height; curwin->w_status_height = wp->w_status_height; wp->w_status_height = temp; -#ifdef FEAT_VERTSPLIT temp = curwin->w_vsep_width; curwin->w_vsep_width = wp->w_vsep_width; wp->w_vsep_width = temp; @@ -1493,7 +1578,6 @@ win_exchange(Prenum) frame_fix_width(curwin); frame_fix_width(wp); } -#endif (void)win_comp_pos(); /* recompute window positions */ @@ -1506,16 +1590,14 @@ win_exchange(Prenum) * if upwards FALSE the first window becomes the second one */ static void -win_rotate(upwards, count) - int upwards; - int count; +win_rotate(int upwards, int count) { win_T *wp1; win_T *wp2; frame_T *frp; int n; - if (firstwin == lastwin) /* nothing to do */ + if (ONE_WINDOW) /* nothing to do */ { beep_flush(); return; @@ -1525,7 +1607,6 @@ win_rotate(upwards, count) need_mouse_correct = TRUE; #endif -#ifdef FEAT_VERTSPLIT /* Check if all frames in this row/col have one window. */ for (frp = curwin->w_frame->fr_parent->fr_child; frp != NULL; frp = frp->fr_next) @@ -1534,7 +1615,6 @@ win_rotate(upwards, count) EMSG(_("E443: Cannot rotate when another window is split")); return; } -#endif while (count--) { @@ -1576,15 +1656,13 @@ win_rotate(upwards, count) wp1->w_status_height = n; frame_fix_height(wp1); frame_fix_height(wp2); -#ifdef FEAT_VERTSPLIT n = wp2->w_vsep_width; wp2->w_vsep_width = wp1->w_vsep_width; wp1->w_vsep_width = n; frame_fix_width(wp1); frame_fix_width(wp2); -#endif - /* recompute w_winrow and w_wincol for all windows */ + /* recompute w_winrow and w_wincol for all windows */ (void)win_comp_pos(); } @@ -1595,14 +1673,12 @@ win_rotate(upwards, count) * Move the current window to the very top/bottom/left/right of the screen. */ static void -win_totop(size, flags) - int size; - int flags; +win_totop(int size, int flags) { int dir; int height = curwin->w_height; - if (lastwin == firstwin) + if (ONE_WINDOW) { beep_flush(); return; @@ -1623,7 +1699,7 @@ win_totop(size, flags) win_equal(curwin, TRUE, 'v'); } -#if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT) +#if defined(FEAT_GUI) /* When 'guioptions' includes 'L' or 'R' may have to remove or add * scrollbars. Have to update them anyway. */ gui_may_update_scrollbars(); @@ -1635,8 +1711,7 @@ win_totop(size, flags) * window. Only works within the same frame! */ void -win_move_after(win1, win2) - win_T *win1, *win2; +win_move_after(win_T *win1, win_T *win2) { int height; @@ -1654,7 +1729,6 @@ win_move_after(win1, win2) height = win1->w_prev->w_status_height; win1->w_prev->w_status_height = win1->w_status_height; win1->w_status_height = height; -#ifdef FEAT_VERTSPLIT if (win1->w_prev->w_vsep_width == 1) { /* Remove the vertical separator from the last-but-one window, @@ -1664,14 +1738,12 @@ win_move_after(win1, win2) win1->w_vsep_width = 1; win1->w_frame->fr_width += 1; } -#endif } else if (win2 == lastwin) { height = win1->w_status_height; win1->w_status_height = win2->w_status_height; win2->w_status_height = height; -#ifdef FEAT_VERTSPLIT if (win1->w_vsep_width == 1) { /* Remove the vertical separator from win1, add it to the last @@ -1681,7 +1753,6 @@ win_move_after(win1, win2) win1->w_vsep_width = 0; win1->w_frame->fr_width -= 1; } -#endif } win_remove(win1, NULL); frame_remove(win1->w_frame); @@ -1700,18 +1771,14 @@ win_move_after(win1, win2) * rows. */ void -win_equal(next_curwin, current, dir) - win_T *next_curwin; /* pointer to current window to be or NULL */ - int current; /* do only frame with current window */ - int dir; /* 'v' for vertically, 'h' for horizontally, +win_equal( + win_T *next_curwin, /* pointer to current window to be or NULL */ + int current, /* do only frame with current window */ + int dir) /* 'v' for vertically, 'h' for horizontally, 'b' for both, 0 for using p_ead */ { if (dir == 0) -#ifdef FEAT_VERTSPLIT dir = *p_ead; -#else - dir = 'b'; -#endif win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current, topframe, dir, 0, tabline_height(), (int)Columns, topframe->fr_height); @@ -1724,15 +1791,15 @@ win_equal(next_curwin, current, dir) * 'winheight' and 'winwidth' if possible. */ static void -win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) - win_T *next_curwin; /* pointer to current window to be or NULL */ - int current; /* do only frame with current window */ - frame_T *topfr; /* frame to set size off */ - int dir; /* 'v', 'h' or 'b', see win_equal() */ - int col; /* horizontal position for frame */ - int row; /* vertical position for frame */ - int width; /* new width of frame */ - int height; /* new height of frame */ +win_equal_rec( + win_T *next_curwin, /* pointer to current window to be or NULL */ + int current, /* do only frame with current window */ + frame_T *topfr, /* frame to set size off */ + int dir, /* 'v', 'h' or 'b', see win_equal() */ + int col, /* horizontal position for frame */ + int row, /* vertical position for frame */ + int width, /* new width of frame */ + int height) /* new height of frame */ { int n, m; int extra_sep = 0; @@ -1749,21 +1816,16 @@ win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) /* Set the width/height of this frame. * Redraw when size or position changes */ if (topfr->fr_height != height || topfr->fr_win->w_winrow != row -#ifdef FEAT_VERTSPLIT || topfr->fr_width != width || topfr->fr_win->w_wincol != col -#endif ) { topfr->fr_win->w_winrow = row; frame_new_height(topfr, height, FALSE, FALSE); -#ifdef FEAT_VERTSPLIT topfr->fr_win->w_wincol = col; frame_new_width(topfr, width, FALSE, FALSE); -#endif redraw_all_later(CLEAR); } } -#ifdef FEAT_VERTSPLIT else if (topfr->fr_layout == FR_ROW) { topfr->fr_width = width; @@ -1852,7 +1914,6 @@ win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ @@ -1905,12 +1966,9 @@ win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) totwincount -= wincount; } } -#endif else /* topfr->fr_layout == FR_COL */ { -#ifdef FEAT_VERTSPLIT topfr->fr_width = width; -#endif topfr->fr_height = height; if (dir != 'h') /* equalize frame heights */ @@ -1997,7 +2055,6 @@ win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ @@ -2051,29 +2108,74 @@ win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height) } } +#ifdef FEAT_JOB_CHANNEL + static void +leaving_window(win_T *win) +{ + // Only matters for a prompt window. + if (!bt_prompt(win->w_buffer)) + return; + + // When leaving a prompt window stop Insert mode and perhaps restart + // it when entering that window again. + win->w_buffer->b_prompt_insert = restart_edit; + if (restart_edit != 0 && mode_displayed) + clear_cmdline = TRUE; /* unshow mode later */ + restart_edit = NUL; + + // When leaving the window (or closing the window) was done from a + // callback we need to break out of the Insert mode loop and restart Insert + // mode when entering the window again. + if (State & INSERT) + { + stop_insert_mode = TRUE; + if (win->w_buffer->b_prompt_insert == NUL) + win->w_buffer->b_prompt_insert = 'A'; + } +} + + static void +entering_window(win_T *win) +{ + // Only matters for a prompt window. + if (!bt_prompt(win->w_buffer)) + return; + + // When switching to a prompt buffer that was in Insert mode, don't stop + // Insert mode, it may have been set in leaving_window(). + if (win->w_buffer->b_prompt_insert != NUL) + stop_insert_mode = FALSE; + + // When entering the prompt window restart Insert mode if we were in Insert + // mode when we left it. + restart_edit = win->w_buffer->b_prompt_insert; +} +#endif + /* - * close all windows for buffer 'buf' + * Close all windows for buffer "buf". */ void -close_windows(buf, keep_curwin) - buf_T *buf; - int keep_curwin; /* don't close "curwin" */ +close_windows( + buf_T *buf, + int keep_curwin) /* don't close "curwin" */ { win_T *wp; tabpage_T *tp, *nexttp; int h = tabline_height(); + int count = tabpage_index(NULL); ++RedrawingDisabled; - for (wp = firstwin; wp != NULL && lastwin != firstwin; ) + for (wp = firstwin; wp != NULL && !ONE_WINDOW; ) { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_closing) -#endif - ) + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { - win_close(wp, FALSE); + if (win_close(wp, FALSE) == FAIL) + /* If closing the window fails give up, to avoid looping + * forever. */ + break; /* Start all over, autocommands may change the window layout. */ wp = firstwin; @@ -2089,10 +2191,7 @@ close_windows(buf, keep_curwin) if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) if (wp->w_buffer == buf -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_closing) -#endif - ) + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close_othertab(wp, FALSE, tp); @@ -2105,6 +2204,9 @@ close_windows(buf, keep_curwin) --RedrawingDisabled; + if (count != tabpage_index(NULL)) + apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); + redraw_tabline = TRUE; if (h != tabline_height()) shell_new_rows(); @@ -2116,7 +2218,7 @@ close_windows(buf, keep_curwin) * Returns FALSE if there is a window, possibly in another tab page. */ static int -last_window() +last_window(void) { return (one_window() && first_tabpage->tp_next == NULL); } @@ -2126,9 +2228,8 @@ last_window() * current tab page. */ int -one_window() +one_window(void) { -#ifdef FEAT_AUTOCMD win_T *wp; int seen_one = FALSE; @@ -2142,9 +2243,6 @@ one_window() } } return TRUE; -#else - return firstwin == lastwin; -#endif } /* @@ -2152,16 +2250,14 @@ one_window() * Returns TRUE when the window was closed already. */ static int -close_last_window_tabpage(win, free_buf, prev_curtab) - win_T *win; - int free_buf; - tabpage_T *prev_curtab; +close_last_window_tabpage( + win_T *win, + int free_buf, + tabpage_T *prev_curtab) { - if (firstwin == lastwin) + if (ONE_WINDOW) { -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif /* * Closing the last window in a tab page. First go to another tab @@ -2184,14 +2280,16 @@ close_last_window_tabpage(win, free_buf, prev_curtab) if (h != tabline_height()) shell_new_rows(); } +#ifdef FEAT_JOB_CHANNEL + entering_window(curwin); +#endif /* Since goto_tabpage_tp above did not trigger *Enter autocommands, do * that now. */ -#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -#endif return TRUE; } return FALSE; @@ -2205,18 +2303,15 @@ close_last_window_tabpage(win, free_buf, prev_curtab) * Returns FAIL when the window was not closed. */ int -win_close(win, free_buf) - win_T *win; - int free_buf; +win_close(win_T *win, int free_buf) { win_T *wp; -#ifdef FEAT_AUTOCMD int other_buffer = FALSE; -#endif int close_curwin = FALSE; int dir; int help_window = FALSE; tabpage_T *prev_curtab = curtab; + frame_T *win_frame = win->w_frame->fr_parent; if (last_window()) { @@ -2224,8 +2319,8 @@ win_close(win, free_buf) return FAIL; } -#ifdef FEAT_AUTOCMD - if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing)) + if (win->w_closing || (win->w_buffer != NULL + && win->w_buffer->b_locked > 0)) return FAIL; /* window is already being closed */ if (win == aucmd_win) { @@ -2237,7 +2332,6 @@ win_close(win, free_buf) EMSG(_("E814: Cannot close window, only autocmd window would remain")); return FAIL; } -#endif /* When closing the last window in a tab page first go to another tab page * and then close the window and the tab page to avoid that curwin and @@ -2247,14 +2341,16 @@ win_close(win, free_buf) /* When closing the help window, try restoring a snapshot after closing * the window. Otherwise clear the snapshot, it's now invalid. */ - if (win->w_buffer != NULL && win->w_buffer->b_help) + if (bt_help(win->w_buffer)) help_window = TRUE; else clear_snapshot(curtab, SNAP_HELP_IDX); -#ifdef FEAT_AUTOCMD if (win == curwin) { +#ifdef FEAT_JOB_CHANNEL + leaving_window(curwin); +#endif /* * Guess which window is going to be the new current window. * This may change because of the autocommands (sigh). @@ -2283,13 +2379,12 @@ win_close(win, free_buf) win->w_closing = FALSE; if (last_window()) return FAIL; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return FAIL; -# endif - } #endif + } #ifdef FEAT_GUI /* Avoid trouble with scrollbars that are going to be deleted in @@ -2309,30 +2404,42 @@ win_close(win, free_buf) */ if (win->w_buffer != NULL) { -#ifdef FEAT_AUTOCMD + bufref_T bufref; + + set_bufref(&bufref, curbuf); win->w_closing = TRUE; -#endif close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE); -#ifdef FEAT_AUTOCMD - if (win_valid(win)) + if (win_valid_any_tab(win)) win->w_closing = FALSE; -#endif + /* Make sure curbuf is valid. It can become invalid if 'bufhidden' is + * "wipe". */ + if (!bufref_valid(&bufref)) + curbuf = firstbuf; } if (only_one_window() && win_valid(win) && win->w_buffer == NULL && (last_window() || curtab != prev_curtab || close_last_window_tabpage(win, free_buf, prev_curtab))) { - /* Autocommands have close all windows, quit now. Restore + /* Autocommands have closed all windows, quit now. Restore * curwin->w_buffer, otherwise writing viminfo may fail. */ if (curwin->w_buffer == NULL) curwin->w_buffer = curbuf; getout(0); } - /* Autocommands may have closed the window already, or closed the only - * other window or moved to another tab page. */ - else if (!win_valid(win) || last_window() || curtab != prev_curtab + /* Autocommands may have moved to another tab page. */ + if (curtab != prev_curtab && win_valid_any_tab(win) + && win->w_buffer == NULL) + { + /* Need to close the window anyway, since the buffer is NULL. */ + win_close_othertab(win, FALSE, prev_curtab); + return FAIL; + } + + /* Autocommands may have closed the window already or closed the only + * other window. */ + if (!win_valid(win) || last_window() || close_last_window_tabpage(win, free_buf, prev_curtab)) return FAIL; @@ -2371,29 +2478,23 @@ win_close(win, free_buf) #endif curbuf = curwin->w_buffer; close_curwin = TRUE; + + /* The cursor position may be invalid if the buffer changed after last + * using the window. */ + check_cursor(); } - if (p_ea -#ifdef FEAT_VERTSPLIT - && (*p_ead == 'b' || *p_ead == dir) -#endif - ) - win_equal(curwin, TRUE, -#ifdef FEAT_VERTSPLIT - dir -#else - 0 -#endif - ); + if (p_ea && (*p_ead == 'b' || *p_ead == dir)) + /* If the frame of the closed window contains the new current window, + * only resize that frame. Otherwise resize all windows. */ + win_equal(curwin, curwin->w_frame->fr_parent == win_frame, dir); else win_comp_pos(); if (close_curwin) { - win_enter_ext(wp, FALSE, TRUE, TRUE, TRUE); -#ifdef FEAT_AUTOCMD + win_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE); if (other_buffer) /* careful: after this wp and win may be invalid! */ apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -#endif } /* @@ -2407,7 +2508,7 @@ win_close(win, free_buf) if (help_window) restore_snapshot(SNAP_HELP_IDX, close_curwin); -#if defined(FEAT_GUI) && defined(FEAT_VERTSPLIT) +#if defined(FEAT_GUI) /* When 'guioptions' includes 'L' or 'R' may have to remove scrollbars. */ if (gui.in_use && !win_hasvertsplit()) gui_init_which_components(NULL); @@ -2425,23 +2526,22 @@ win_close(win, free_buf) * updated. */ void -win_close_othertab(win, free_buf, tp) - win_T *win; - int free_buf; - tabpage_T *tp; +win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) { win_T *wp; int dir; tabpage_T *ptp = NULL; int free_tp = FALSE; -#ifdef FEAT_AUTOCMD - if (win->w_closing || win->w_buffer->b_closing) + /* Get here with win->w_buffer == NULL when win_close() detects the tab + * page changed. */ + if (win->w_closing || (win->w_buffer != NULL + && win->w_buffer->b_locked > 0)) return; /* window is already being closed */ -#endif - /* Close the link to the buffer. */ - close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, FALSE); + if (win->w_buffer != NULL) + /* Close the link to the buffer. */ + close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, FALSE); /* Careful: Autocommands may have closed the tab page or made it the * current tab page. */ @@ -2457,7 +2557,7 @@ win_close_othertab(win, free_buf, tp) return; /* When closing the last window in a tab page remove the tab page. */ - if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin) + if (tp->tp_firstwin == tp->tp_lastwin) { if (tp == first_tabpage) first_tabpage = tp->tp_next; @@ -2468,7 +2568,7 @@ win_close_othertab(win, free_buf, tp) ; if (ptp == NULL) { - EMSG2(_(e_intern2), "win_close_othertab()"); + internal_error("win_close_othertab()"); return; } ptp->tp_next = tp->tp_next; @@ -2488,10 +2588,10 @@ win_close_othertab(win, free_buf, tp) * Returns a pointer to the window that got the freed up space. */ static win_T * -win_free_mem(win, dirp, tp) - win_T *win; - int *dirp; /* set to 'v' or 'h' for direction if 'ea' */ - tabpage_T *tp; /* tab page "win" is in, NULL for current */ +win_free_mem( + win_T *win, + int *dirp, /* set to 'v' or 'h' for direction if 'ea' */ + tabpage_T *tp) /* tab page "win" is in, NULL for current */ { frame_T *frp; win_T *wp; @@ -2512,22 +2612,18 @@ win_free_mem(win, dirp, tp) #if defined(EXITFREE) || defined(PROTO) void -win_free_all() +win_free_all(void) { int dummy; -# ifdef FEAT_WINDOWS while (first_tabpage->tp_next != NULL) tabpage_close(TRUE); -# endif -# ifdef FEAT_AUTOCMD if (aucmd_win != NULL) { (void)win_free_mem(aucmd_win, &dummy, NULL); aucmd_win = NULL; } -# endif while (firstwin != NULL) (void)win_free_mem(firstwin, &dummy, NULL); @@ -2543,10 +2639,10 @@ win_free_all() * Returns a pointer to the window that got the freed up space. */ win_T * -winframe_remove(win, dirp, tp) - win_T *win; - int *dirp UNUSED; /* set to 'v' or 'h' for direction if 'ea' */ - tabpage_T *tp; /* tab page "win" is in, NULL for current */ +winframe_remove( + win_T *win, + int *dirp UNUSED, /* set to 'v' or 'h' for direction if 'ea' */ + tabpage_T *tp) /* tab page "win" is in, NULL for current */ { frame_T *frp, *frp2, *frp3; frame_T *frp_close = win->w_frame; @@ -2555,7 +2651,7 @@ winframe_remove(win, dirp, tp) /* * If there is only one window there is nothing to remove. */ - if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin) + if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin) return NULL; /* @@ -2567,10 +2663,8 @@ winframe_remove(win, dirp, tp) /* Remove this frame from the list of frames. */ frame_remove(frp_close); -#ifdef FEAT_VERTSPLIT if (frp_close->fr_parent->fr_layout == FR_COL) { -#endif /* When 'winfixheight' is set, try to find another frame in the column * (as close to the closed frame as possible) to distribute the height * to. */ @@ -2604,7 +2698,6 @@ winframe_remove(win, dirp, tp) } frame_new_height(frp2, frp2->fr_height + frp_close->fr_height, frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); -#ifdef FEAT_VERTSPLIT *dirp = 'v'; } else @@ -2644,14 +2737,13 @@ winframe_remove(win, dirp, tp) frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); *dirp = 'h'; } -#endif /* If rows/columns go to a window below/right its positions need to be * updated. Can only be done after the sizes have been updated. */ if (frp2 == frp_close->fr_next) { int row = win->w_winrow; - int col = W_WINCOL(win); + int col = win->w_wincol; frame_comp_pos(frp2, &row, &col); } @@ -2668,6 +2760,8 @@ winframe_remove(win, dirp, tp) if (frp2->fr_win != NULL) frp2->fr_win->w_frame = frp2->fr_parent; frp = frp2->fr_parent; + if (topframe->fr_child == frp2) + topframe->fr_child = frp; vim_free(frp2); frp2 = frp->fr_parent; @@ -2691,6 +2785,8 @@ winframe_remove(win, dirp, tp) break; } } + if (topframe->fr_child == frp) + topframe->fr_child = frp2; vim_free(frp); } } @@ -2699,42 +2795,62 @@ winframe_remove(win, dirp, tp) } /* - * Find out which frame is going to get the freed up space when "win" is - * closed. - * if 'splitbelow'/'splitleft' the space goes to the window above/left. - * if 'nosplitbelow'/'nosplitleft' the space goes to the window below/right. - * This makes opening a window and closing it immediately keep the same window - * layout. + * Return a pointer to the frame that will receive the empty screen space that + * is left over after "win" is closed. + * + * If 'splitbelow' or 'splitright' is set, the space goes above or to the left + * by default. Otherwise, the free space goes below or to the right. The + * result is that opening a window and then immediately closing it will + * preserve the initial window layout. The 'wfh' and 'wfw' settings are + * respected when possible. */ static frame_T * -win_altframe(win, tp) - win_T *win; - tabpage_T *tp; /* tab page "win" is in, NULL for current */ +win_altframe( + win_T *win, + tabpage_T *tp) /* tab page "win" is in, NULL for current */ { frame_T *frp; - int b; + frame_T *other_fr, *target_fr; - if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin) - /* Last window in this tab page, will go to next tab page. */ + if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin) return alt_tabpage()->tp_curwin->w_frame; frp = win->w_frame; -#ifdef FEAT_VERTSPLIT + + if (frp->fr_prev == NULL) + return frp->fr_next; + if (frp->fr_next == NULL) + return frp->fr_prev; + + target_fr = frp->fr_next; + other_fr = frp->fr_prev; + if (p_spr || p_sb) + { + target_fr = frp->fr_prev; + other_fr = frp->fr_next; + } + + /* If 'wfh' or 'wfw' is set for the target and not for the alternate + * window, reverse the selection. */ if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW) - b = p_spr; + { + if (frame_fixed_width(target_fr) && !frame_fixed_width(other_fr)) + target_fr = other_fr; + } else -#endif - b = p_sb; - if ((!b && frp->fr_next != NULL) || frp->fr_prev == NULL) - return frp->fr_next; - return frp->fr_prev; + { + if (frame_fixed_height(target_fr) && !frame_fixed_height(other_fr)) + target_fr = other_fr; + } + + return target_fr; } /* * Return the tabpage that will be used if the current one is closed. */ static tabpage_T * -alt_tabpage() +alt_tabpage(void) { tabpage_T *tp; @@ -2752,8 +2868,7 @@ alt_tabpage() * Find the left-upper window in frame "frp". */ static win_T * -frame2win(frp) - frame_T *frp; +frame2win(frame_T *frp) { while (frp->fr_win == NULL) frp = frp->fr_child; @@ -2764,9 +2879,7 @@ frame2win(frp) * Return TRUE if frame "frp" contains window "wp". */ static int -frame_has_win(frp, wp) - frame_T *frp; - win_T *wp; +frame_has_win(frame_T *frp, win_T *wp) { frame_T *p; @@ -2784,11 +2897,11 @@ frame_has_win(frp, wp) * frames and windows. Caller must take care of positions. */ static void -frame_new_height(topfrp, height, topfirst, wfh) - frame_T *topfrp; - int height; - int topfirst; /* resize topmost contained frame first */ - int wfh; /* obey 'winfixheight' when there is a choice; +frame_new_height( + frame_T *topfrp, + int height, + int topfirst, /* resize topmost contained frame first */ + int wfh) /* obey 'winfixheight' when there is a choice; may cause the height not to be set */ { frame_T *frp; @@ -2799,9 +2912,9 @@ frame_new_height(topfrp, height, topfirst, wfh) { /* Simple case: just one window. */ win_new_height(topfrp->fr_win, - height - topfrp->fr_win->w_status_height); + height - topfrp->fr_win->w_status_height + - WINBAR_HEIGHT(topfrp->fr_win)); } -#ifdef FEAT_VERTSPLIT else if (topfrp->fr_layout == FR_ROW) { do @@ -2820,7 +2933,6 @@ frame_new_height(topfrp, height, topfirst, wfh) } while (frp != NULL); } -#endif else /* fr_layout == FR_COL */ { /* Complicated case: Resize a column of frames. Resize the bottom @@ -2895,8 +3007,7 @@ frame_new_height(topfrp, height, topfirst, wfh) * the 'winfixheight' option. */ static int -frame_fixed_height(frp) - frame_T *frp; +frame_fixed_height(frame_T *frp) { /* frame with one window: fixed height if 'winfixheight' set. */ if (frp->fr_win != NULL) @@ -2920,14 +3031,12 @@ frame_fixed_height(frp) return TRUE; } -#ifdef FEAT_VERTSPLIT /* * Return TRUE if width of frame "frp" should not be changed because of * the 'winfixwidth' option. */ static int -frame_fixed_width(frp) - frame_T *frp; +frame_fixed_width(frame_T *frp) { /* frame with one window: fixed width if 'winfixwidth' set. */ if (frp->fr_win != NULL) @@ -2956,8 +3065,7 @@ frame_fixed_width(frp) * Note: Does not check if there is room! */ static void -frame_add_statusline(frp) - frame_T *frp; +frame_add_statusline(frame_T *frp) { win_T *wp; @@ -2991,11 +3099,11 @@ frame_add_statusline(frp) * May remove separator line for windows at the right side (for win_close()). */ static void -frame_new_width(topfrp, width, leftfirst, wfw) - frame_T *topfrp; - int width; - int leftfirst; /* resize leftmost contained frame first */ - int wfw; /* obey 'winfixwidth' when there is a choice; +frame_new_width( + frame_T *topfrp, + int width, + int leftfirst, /* resize leftmost contained frame first */ + int wfw) /* obey 'winfixwidth' when there is a choice; may cause the width not to be set */ { frame_T *frp; @@ -3106,8 +3214,7 @@ frame_new_width(topfrp, width, leftfirst, wfw) * Note: Does not check if there is room! */ static void -frame_add_vsep(frp) - frame_T *frp; +frame_add_vsep(frame_T *frp) { win_T *wp; @@ -3141,21 +3248,18 @@ frame_add_vsep(frp) * Set frame width from the window it contains. */ static void -frame_fix_width(wp) - win_T *wp; +frame_fix_width(win_T *wp) { wp->w_frame->fr_width = wp->w_width + wp->w_vsep_width; } -#endif /* * Set frame height from the window it contains. */ static void -frame_fix_height(wp) - win_T *wp; +frame_fix_height(win_T *wp) { - wp->w_frame->fr_height = wp->w_height + wp->w_status_height; + wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height; } /* @@ -3166,15 +3270,11 @@ frame_fix_height(wp) * window. */ static int -frame_minheight(topfrp, next_curwin) - frame_T *topfrp; - win_T *next_curwin; +frame_minheight(frame_T *topfrp, win_T *next_curwin) { frame_T *frp; int m; -#ifdef FEAT_VERTSPLIT int n; -#endif if (topfrp->fr_win != NULL) { @@ -3184,12 +3284,16 @@ frame_minheight(topfrp, next_curwin) { /* window: minimal height of the window plus status line */ m = p_wmh + topfrp->fr_win->w_status_height; - /* Current window is minimal one line high */ - if (p_wmh == 0 && topfrp->fr_win == curwin && next_curwin == NULL) - ++m; + if (topfrp->fr_win == curwin && next_curwin == NULL) + { + /* Current window is minimal one line high and WinBar is + * visible. */ + if (p_wmh == 0) + ++m; + m += WINBAR_HEIGHT(curwin); + } } } -#ifdef FEAT_VERTSPLIT else if (topfrp->fr_layout == FR_ROW) { /* get the minimal height from each frame in this row */ @@ -3201,7 +3305,6 @@ frame_minheight(topfrp, next_curwin) m = n; } } -#endif else { /* Add up the minimal heights for all frames in this column. */ @@ -3213,7 +3316,6 @@ frame_minheight(topfrp, next_curwin) return m; } -#ifdef FEAT_VERTSPLIT /* * Compute the minimal width for frame "topfrp". * When "next_curwin" isn't NULL, use p_wiw for this window. @@ -3221,9 +3323,9 @@ frame_minheight(topfrp, next_curwin) * window. */ static int -frame_minwidth(topfrp, next_curwin) - frame_T *topfrp; - win_T *next_curwin; /* use p_wh and p_wiw for next_curwin */ +frame_minwidth( + frame_T *topfrp, + win_T *next_curwin) /* use p_wh and p_wiw for next_curwin */ { frame_T *frp; int m, n; @@ -3262,7 +3364,6 @@ frame_minwidth(topfrp, next_curwin) return m; } -#endif /* @@ -3273,9 +3374,9 @@ frame_minwidth(topfrp, next_curwin) * Used by ":bdel" and ":only". */ void -close_others(message, forceit) - int message; - int forceit; /* always hide all other windows */ +close_others( + int message, + int forceit) /* always hide all other windows */ { win_T *wp; win_T *nextwp; @@ -3283,11 +3384,7 @@ close_others(message, forceit) if (one_window()) { - if (message -#ifdef FEAT_AUTOCMD - && !autocmd_busy -#endif - ) + if (message && !autocmd_busy) MSG(_(m_onlyone)); return; } @@ -3301,54 +3398,48 @@ close_others(message, forceit) /* Check if it's allowed to abandon this window */ r = can_abandon(wp->w_buffer, forceit); -#ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } -#endif if (!r) { #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (message && (p_confirm || cmdmod.confirm) && p_write) { dialog_changed(wp->w_buffer, FALSE); -# ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } -# endif } if (bufIsChanged(wp->w_buffer)) #endif continue; } - win_close(wp, !P_HID(wp->w_buffer) && !bufIsChanged(wp->w_buffer)); + win_close(wp, !buf_hide(wp->w_buffer) + && !bufIsChanged(wp->w_buffer)); } } - if (message && lastwin != firstwin) + if (message && !ONE_WINDOW) EMSG(_("E445: Other window contains changes")); } -#endif /* FEAT_WINDOWS */ - /* * Init the current window "curwin". * Called when a new file is being edited. */ void -curwin_init() +curwin_init(void) { win_init_empty(curwin); } void -win_init_empty(wp) - win_T *wp; +win_init_empty(win_T *wp) { redraw_win_later(wp, NOT_VALID); wp->w_lines_valid = 0; @@ -3383,29 +3474,26 @@ win_init_empty(wp) * Return FAIL when something goes wrong (out of memory). */ int -win_alloc_first() +win_alloc_first(void) { if (win_alloc_firstwin(NULL) == FAIL) return FAIL; -#ifdef FEAT_WINDOWS first_tabpage = alloc_tabpage(); if (first_tabpage == NULL) return FAIL; first_tabpage->tp_topframe = topframe; curtab = first_tabpage; -#endif return OK; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Init "aucmd_win". This can only be done after the first * window is fully initialized, thus it can't be in win_alloc_first(). */ void -win_alloc_aucmd_win() +win_alloc_aucmd_win(void) { aucmd_win = win_alloc(NULL, TRUE); if (aucmd_win != NULL) @@ -3415,18 +3503,15 @@ win_alloc_aucmd_win() new_frame(aucmd_win); } } -#endif /* * Allocate the first window or the first window in a new tab page. * When "oldwin" is NULL create an empty buffer for it. - * When "oldwin" is not NULL copy info from it to the new window (only with - * FEAT_WINDOWS). + * When "oldwin" is not NULL copy info from it to the new window. * Return FAIL when something goes wrong (out of memory). */ static int -win_alloc_firstwin(oldwin) - win_T *oldwin; +win_alloc_firstwin(win_T *oldwin) { curwin = win_alloc(NULL, FALSE); if (oldwin == NULL) @@ -3441,12 +3526,9 @@ win_alloc_firstwin(oldwin) curwin->w_s = &(curbuf->b_s); #endif curbuf->b_nwindows = 1; /* there is one window */ -#ifdef FEAT_WINDOWS curwin->w_alist = &global_alist; -#endif curwin_init(); /* init current window */ } -#ifdef FEAT_WINDOWS else { /* First window in new tab page, initialize it from "oldwin". */ @@ -3455,17 +3537,13 @@ win_alloc_firstwin(oldwin) /* We don't want cursor- and scroll-binding in the first window. */ RESET_BINDING(curwin); } -#endif new_frame(curwin); if (curwin->w_frame == NULL) return FAIL; topframe = curwin->w_frame; -#ifdef FEAT_VERTSPLIT topframe->fr_width = Columns; -#endif topframe->fr_height = Rows - p_ch; - topframe->fr_win = curwin; return OK; } @@ -3490,24 +3568,20 @@ new_frame(win_T *wp) * Initialize the window and frame size to the maximum. */ void -win_init_size() +win_init_size(void) { firstwin->w_height = ROWS_AVAIL; topframe->fr_height = ROWS_AVAIL; -#ifdef FEAT_VERTSPLIT firstwin->w_width = Columns; topframe->fr_width = Columns; -#endif } -#if defined(FEAT_WINDOWS) || defined(PROTO) - /* * Allocate a new tabpage_T and init the values. * Returns NULL when out of memory. */ static tabpage_T * -alloc_tabpage() +alloc_tabpage(void) { tabpage_T *tp; # ifdef FEAT_GUI @@ -3543,8 +3617,7 @@ alloc_tabpage() } void -free_tabpage(tp) - tabpage_T *tp; +free_tabpage(tabpage_T *tp) { int idx; @@ -3578,8 +3651,7 @@ free_tabpage(tp) * Return FAIL or OK. */ int -win_new_tabpage(after) - int after; +win_new_tabpage(int after) { tabpage_T *tp = curtab; tabpage_T *newtp; @@ -3632,12 +3704,15 @@ win_new_tabpage(after) * scrollbars. Have to update them anyway. */ gui_may_update_scrollbars(); #endif +#ifdef FEAT_JOB_CHANNEL + entering_window(curwin); +#endif redraw_all_later(CLEAR); -#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); + apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); -#endif return OK; } @@ -3652,7 +3727,7 @@ win_new_tabpage(after) * Returns OK if a new tab page was created, FAIL otherwise. */ int -may_open_tabpage() +may_open_tabpage(void) { int n = (cmdmod.tab == 0) ? postponed_split_tab : cmdmod.tab; @@ -3670,8 +3745,7 @@ may_open_tabpage() * Returns the number of resulting tab pages. */ int -make_tabpages(maxcount) - int maxcount; +make_tabpages(int maxcount) { int count = maxcount; int todo; @@ -3680,21 +3754,17 @@ make_tabpages(maxcount) if (count > p_tpm) count = p_tpm; -#ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the tab pages. Must do that * when putting the buffers in the windows. */ block_autocmds(); -#endif for (todo = count - 1; todo > 0; --todo) if (win_new_tabpage(0) == FAIL) break; -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif /* return actual number of tab pages */ return (count - todo); @@ -3704,23 +3774,74 @@ make_tabpages(maxcount) * Return TRUE when "tpc" points to a valid tab page. */ int -valid_tabpage(tpc) - tabpage_T *tpc; +valid_tabpage(tabpage_T *tpc) { tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) if (tp == tpc) return TRUE; return FALSE; } +/* + * Return TRUE when "tpc" points to a valid tab page and at least one window is + * valid. + */ + int +valid_tabpage_win(tabpage_T *tpc) +{ + tabpage_T *tp; + win_T *wp; + + FOR_ALL_TABPAGES(tp) + { + if (tp == tpc) + { + FOR_ALL_WINDOWS_IN_TAB(tp, wp) + { + if (win_valid_any_tab(wp)) + return TRUE; + } + return FALSE; + } + } + /* shouldn't happen */ + return FALSE; +} + +/* + * Close tabpage "tab", assuming it has no windows in it. + * There must be another tabpage or this will crash. + */ + void +close_tabpage(tabpage_T *tab) +{ + tabpage_T *ptp; + + if (tab == first_tabpage) + { + first_tabpage = tab->tp_next; + ptp = first_tabpage; + } + else + { + for (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tab; + ptp = ptp->tp_next) + ; + assert(ptp != NULL); + ptp->tp_next = tab->tp_next; + } + + goto_tabpage_tp(ptp, FALSE, FALSE); + free_tabpage(tab); +} + /* * Find tab page "n" (first one is 1). Returns NULL when not found. */ tabpage_T * -find_tabpage(n) - int n; +find_tabpage(int n) { tabpage_T *tp; int i = 1; @@ -3735,8 +3856,7 @@ find_tabpage(n) * When not found returns number of tab pages plus one. */ int -tabpage_index(ftp) - tabpage_T *ftp; +tabpage_index(tabpage_T *ftp) { int i = 1; tabpage_T *tp; @@ -3753,15 +3873,17 @@ tabpage_index(ftp) * Careful: When OK is returned need to get a new tab page very very soon! */ static int -leave_tabpage(new_curbuf, trigger_leave_autocmds) - buf_T *new_curbuf UNUSED; /* what is going to be the new curbuf, +leave_tabpage( + buf_T *new_curbuf UNUSED, /* what is going to be the new curbuf, NULL if unknown */ - int trigger_leave_autocmds UNUSED; + int trigger_leave_autocmds UNUSED) { tabpage_T *tp = curtab; +#ifdef FEAT_JOB_CHANNEL + leaving_window(curwin); +#endif reset_VIsual_and_resel(); /* stop Visual mode */ -#ifdef FEAT_AUTOCMD if (trigger_leave_autocmds) { if (new_curbuf != curbuf) @@ -3777,7 +3899,6 @@ leave_tabpage(new_curbuf, trigger_leave_autocmds) if (curtab != tp) return FAIL; } -#endif #if defined(FEAT_GUI) /* Remove the scrollbars. They may be added back later. */ if (gui.in_use) @@ -3801,11 +3922,11 @@ leave_tabpage(new_curbuf, trigger_leave_autocmds) * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE. */ static void -enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) - tabpage_T *tp; - buf_T *old_curbuf UNUSED; - int trigger_enter_autocmds UNUSED; - int trigger_leave_autocmds UNUSED; +enter_tabpage( + tabpage_T *tp, + buf_T *old_curbuf UNUSED, + int trigger_enter_autocmds, + int trigger_leave_autocmds) { int old_off = tp->tp_firstwin->w_winrow; win_T *next_prevwin = tp->tp_prevwin; @@ -3818,7 +3939,7 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) /* We would like doing the TabEnter event first, but we don't have a * valid current window yet, which may break some commands. * This triggers autocommands, thus may make "tp" invalid. */ - win_enter_ext(tp->tp_curwin, FALSE, TRUE, + win_enter_ext(tp->tp_curwin, FALSE, TRUE, FALSE, trigger_enter_autocmds, trigger_leave_autocmds); prevwin = next_prevwin; @@ -3840,10 +3961,8 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) #endif )) shell_new_rows(); -#ifdef FEAT_VERTSPLIT if (curtab->tp_old_Columns != Columns && starting == 0) shell_new_columns(); /* update window widths */ -#endif #if defined(FEAT_GUI) /* When 'guioptions' includes 'L' or 'R' may have to remove or add @@ -3851,7 +3970,6 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) gui_may_update_scrollbars(); #endif -#ifdef FEAT_AUTOCMD /* Apply autocommands after updating the display, when 'rows' and * 'columns' have been set correctly. */ if (trigger_enter_autocmds) @@ -3860,7 +3978,6 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } -#endif redraw_all_later(CLEAR); } @@ -3870,8 +3987,7 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds) * When "n" is 9999 go to the last tab page. */ void -goto_tabpage(n) - int n; +goto_tabpage(int n) { tabpage_T *tp; tabpage_T *ttp; @@ -3880,12 +3996,7 @@ goto_tabpage(n) if (text_locked()) { /* Not allowed when editing the command line. */ -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) - EMSG(_(e_cmdwin)); - else -#endif - EMSG(_(e_secure)); + text_locked_msg(); return; } @@ -3950,10 +4061,10 @@ goto_tabpage(n) * Note: doesn't update the GUI tab. */ void -goto_tabpage_tp(tp, trigger_enter_autocmds, trigger_leave_autocmds) - tabpage_T *tp; - int trigger_enter_autocmds; - int trigger_leave_autocmds; +goto_tabpage_tp( + tabpage_T *tp, + int trigger_enter_autocmds, + int trigger_leave_autocmds) { /* Don't repeat a message in another tab page. */ set_keep_msg(NULL, 0); @@ -3975,9 +4086,7 @@ goto_tabpage_tp(tp, trigger_enter_autocmds, trigger_leave_autocmds) * Also updates the GUI tab. */ void -goto_tabpage_win(tp, wp) - tabpage_T *tp; - win_T *wp; +goto_tabpage_win(tabpage_T *tp, win_T *wp) { goto_tabpage_tp(tp, TRUE, TRUE); if (curtab == tp && win_valid(wp)) @@ -3991,24 +4100,32 @@ goto_tabpage_win(tp, wp) } /* - * Move the current tab page to before tab page "nr". + * Move the current tab page to after tab page "nr". */ void -tabpage_move(nr) - int nr; +tabpage_move(int nr) { - int n = nr; - tabpage_T *tp; + int n = 1; + tabpage_T *tp, *tp_dst; if (first_tabpage->tp_next == NULL) return; + for (tp = first_tabpage; tp->tp_next != NULL && n < nr; tp = tp->tp_next) + ++n; + + if (tp == curtab || (nr > 0 && tp->tp_next != NULL + && tp->tp_next == curtab)) + return; + + tp_dst = tp; + /* Remove the current tab page from the list of tab pages. */ if (curtab == first_tabpage) first_tabpage = curtab->tp_next; else { - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) if (tp->tp_next == curtab) break; if (tp == NULL) /* "cannot happen" */ @@ -4017,17 +4134,15 @@ tabpage_move(nr) } /* Re-insert it at the specified position. */ - if (n <= 0) + if (nr <= 0) { curtab->tp_next = first_tabpage; first_tabpage = curtab; } else { - for (tp = first_tabpage; tp->tp_next != NULL && n > 1; tp = tp->tp_next) - --n; - curtab->tp_next = tp->tp_next; - tp->tp_next = curtab; + curtab->tp_next = tp_dst->tp_next; + tp_dst->tp_next = curtab; } /* Need to redraw the tabline. Tab page contents doesn't change. */ @@ -4043,8 +4158,7 @@ tabpage_move(nr) * position to keep the same Visual area. */ void -win_goto(wp) - win_T *wp; +win_goto(win_T *wp) { #ifdef FEAT_CONCEAL win_T *owp = curwin; @@ -4056,10 +4170,8 @@ win_goto(wp) text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return; -#endif if (wp->w_buffer != curbuf) reset_VIsual_and_resel(); @@ -4085,51 +4197,41 @@ win_goto(wp) * Find window number "winnr" (counting top to bottom). */ win_T * -win_find_nr(winnr) - int winnr; +win_find_nr(int winnr) { win_T *wp; -# ifdef FEAT_WINDOWS - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (--winnr == 0) break; return wp; -# else - return curwin; -# endif } #endif -#if (defined(FEAT_WINDOWS) && (defined(FEAT_PYTHON) || defined(FEAT_PYTHON3))) \ - || defined(PROTO) +#if ((defined(FEAT_PYTHON) || defined(FEAT_PYTHON3))) || defined(PROTO) /* * Find the tabpage for window "win". */ tabpage_T * -win_find_tabpage(win) - win_T *win; +win_find_tabpage(win_T *win) { win_T *wp; tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) - for (wp = (tp == curtab ? firstwin : tp->tp_firstwin); - wp != NULL; wp = wp->w_next) + FOR_ALL_TAB_WINDOWS(tp, wp) if (wp == win) return tp; return NULL; } #endif -#ifdef FEAT_VERTSPLIT /* * Move to window above or below "count" times. */ static void -win_goto_ver(up, count) - int up; /* TRUE to go to win above */ - long count; +win_goto_ver( + int up, /* TRUE to go to win above */ + long count) { frame_T *fr; frame_T *nfr; @@ -4190,9 +4292,9 @@ win_goto_ver(up, count) * Move to left or right window. */ static void -win_goto_hor(left, count) - int left; /* TRUE to go to left win */ - long count; +win_goto_hor( + int left, /* TRUE to go to left win */ + long count) { frame_T *fr; frame_T *nfr; @@ -4248,17 +4350,14 @@ win_goto_hor(left, count) if (foundfr != NULL) win_goto(foundfr->fr_win); } -#endif /* * Make window "wp" the current window. */ void -win_enter(wp, undo_sync) - win_T *wp; - int undo_sync; +win_enter(win_T *wp, int undo_sync) { - win_enter_ext(wp, undo_sync, FALSE, TRUE, TRUE); + win_enter_ext(wp, undo_sync, FALSE, FALSE, TRUE, TRUE); } /* @@ -4267,21 +4366,24 @@ win_enter(wp, undo_sync) * been closed and isn't valid. */ static void -win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_leave_autocmds) - win_T *wp; - int undo_sync; - int curwin_invalid; - int trigger_enter_autocmds UNUSED; - int trigger_leave_autocmds UNUSED; +win_enter_ext( + win_T *wp, + int undo_sync, + int curwin_invalid, + int trigger_new_autocmds, + int trigger_enter_autocmds, + int trigger_leave_autocmds) { -#ifdef FEAT_AUTOCMD int other_buffer = FALSE; -#endif if (wp == curwin && !curwin_invalid) /* nothing to do */ return; -#ifdef FEAT_AUTOCMD +#ifdef FEAT_JOB_CHANNEL + if (!curwin_invalid) + leaving_window(curwin); +#endif + if (!curwin_invalid && trigger_leave_autocmds) { /* @@ -4297,13 +4399,12 @@ win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_lea apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); if (!win_valid(wp)) return; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return; -# endif - } #endif + } /* sync undo before leaving the current buffer */ if (undo_sync && curbuf != wp->w_buffer) @@ -4350,19 +4451,21 @@ win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_lea /* Window doesn't have a local directory and we are not in the global * directory: Change to the global directory. */ ignored = mch_chdir((char *)globaldir); - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(globaldir); shorten_fnames(TRUE); } -#ifdef FEAT_AUTOCMD +#ifdef FEAT_JOB_CHANNEL + entering_window(curwin); +#endif + if (trigger_new_autocmds) + apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); if (trigger_enter_autocmds) { apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); if (other_buffer) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } -#endif #ifdef FEAT_TITLE maketitle(); @@ -4378,45 +4481,37 @@ win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_lea else if (curwin->w_height == 0) win_setheight(1); -#ifdef FEAT_VERTSPLIT /* set window width to desired minimal value */ if (curwin->w_width < p_wiw && !curwin->w_p_wfw) win_setwidth((int)p_wiw); -#endif #ifdef FEAT_MOUSE setmouse(); /* in case jumped to/from help buffer */ #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; } -#endif /* FEAT_WINDOWS */ -#if defined(FEAT_WINDOWS) || defined(FEAT_SIGNS) || defined(PROTO) /* * Jump to the first open window that contains buffer "buf", if one exists. * Returns a pointer to the window found, otherwise NULL. */ win_T * -buf_jump_open_win(buf) - buf_T *buf; +buf_jump_open_win(buf_T *buf) { -# ifdef FEAT_WINDOWS - win_T *wp; + win_T *wp = NULL; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - if (wp->w_buffer == buf) - break; + if (curwin->w_buffer == buf) + wp = curwin; + else + FOR_ALL_WINDOWS(wp) + if (wp->w_buffer == buf) + break; if (wp != NULL) win_enter(wp, FALSE); return wp; -# else - if (curwin->w_buffer == buf) - return curwin; - return NULL; -# endif } /* @@ -4425,19 +4520,15 @@ buf_jump_open_win(buf) * Returns a pointer to the window found, otherwise NULL. */ win_T * -buf_jump_open_tab(buf) - buf_T *buf; +buf_jump_open_tab(buf_T *buf) { -# ifdef FEAT_WINDOWS - win_T *wp; + win_T *wp = buf_jump_open_win(buf); tabpage_T *tp; - /* First try the current tab page. */ - wp = buf_jump_open_win(buf); if (wp != NULL) return wp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) if (tp != curtab) { for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) @@ -4451,24 +4542,17 @@ buf_jump_open_tab(buf) break; } } - return wp; -# else - if (curwin->w_buffer == buf) - return curwin; - return NULL; -# endif } -#endif + +static int last_win_id = LOWEST_WIN_ID - 1; /* * Allocate a window structure and link it in the window list when "hidden" is * FALSE. */ static win_T * -win_alloc(after, hidden) - win_T *after UNUSED; - int hidden UNUSED; +win_alloc(win_T *after UNUSED, int hidden UNUSED) { win_T *new_wp; @@ -4485,6 +4569,8 @@ win_alloc(after, hidden) return NULL; } + new_wp->w_id = ++last_win_id; + #ifdef FEAT_EVAL /* init w: variables */ new_wp->w_vars = dict_alloc(); @@ -4497,23 +4583,18 @@ win_alloc(after, hidden) init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE); #endif -#ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is not properly * initialized yet. gui_create_scrollbar() may trigger a FocusGained * event. */ block_autocmds(); -#endif + /* * link the window in the window list */ -#ifdef FEAT_WINDOWS if (!hidden) win_append(after, new_wp); -#endif -#ifdef FEAT_VERTSPLIT new_wp->w_wincol = 0; new_wp->w_width = Columns; -#endif /* position the display and the cursor at the top of the file. */ new_wp->w_topline = 1; @@ -4522,9 +4603,7 @@ win_alloc(after, hidden) #endif new_wp->w_botline = 2; new_wp->w_cursor.lnum = 1; -#ifdef FEAT_SCROLLBIND new_wp->w_scbind_pos = 1; -#endif /* We won't calculate w_fraction until resizing the window */ new_wp->w_fraction = 0; @@ -4542,9 +4621,7 @@ win_alloc(after, hidden) #ifdef FEAT_FOLDING foldInitWin(new_wp); #endif -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif #ifdef FEAT_SEARCH_EXTRA new_wp->w_match_head = NULL; new_wp->w_next_match_id = 4; @@ -4552,15 +4629,13 @@ win_alloc(after, hidden) return new_wp; } -#if defined(FEAT_WINDOWS) || defined(PROTO) - /* * Remove window 'wp' from the window list and free the structure. */ static void -win_free(wp, tp) - win_T *wp; - tabpage_T *tp; /* tab page "win" is in, NULL for current */ +win_free( + win_T *wp, + tabpage_T *tp) /* tab page "win" is in, NULL for current */ { int i; buf_T *buf; @@ -4573,11 +4648,9 @@ win_free(wp, tp) /* reduce the reference count to the argument list. */ alist_unlink(wp->w_alist); -#ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is halfway being deleted. * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ block_autocmds(); -#endif #ifdef FEAT_LUA lua_window_free(wp); @@ -4616,8 +4689,15 @@ win_free(wp, tp) unref_var_dict(wp->w_vars); #endif - if (prevwin == wp) - prevwin = NULL; + { + tabpage_T *ttp; + + if (prevwin == wp) + prevwin = NULL; + FOR_ALL_TABPAGES(ttp) + if (ttp->tp_prevwin == wp) + ttp->tp_prevwin = NULL; + } win_free_lsize(wp); for (i = 0; i < wp->w_tagstacklen; ++i) @@ -4627,7 +4707,7 @@ win_free(wp, tp) /* Remove the window from the b_wininfo lists, it may happen that the * freed memory is re-used for another window. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) if (wip->wi_win == wp) wip->wi_win = NULL; @@ -4652,35 +4732,32 @@ win_free(wp, tp) } #endif /* FEAT_GUI */ +#ifdef FEAT_MENU + remove_winbar(wp); +#endif + #ifdef FEAT_SYN_HL vim_free(wp->w_p_cc_cols); #endif -#ifdef FEAT_AUTOCMD if (wp != aucmd_win) -#endif win_remove(wp, tp); -#ifdef FEAT_AUTOCMD if (autocmd_busy) { wp->w_next = au_pending_free_win; au_pending_free_win = wp; } else -#endif vim_free(wp); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif } /* * Append window "wp" in the window list after window "after". */ void -win_append(after, wp) - win_T *after, *wp; +win_append(win_T *after, win_T *wp) { win_T *before; @@ -4705,20 +4782,21 @@ win_append(after, wp) * Remove a window from the window list. */ void -win_remove(wp, tp) - win_T *wp; - tabpage_T *tp; /* tab page "win" is in, NULL for current */ +win_remove( + win_T *wp, + tabpage_T *tp) /* tab page "win" is in, NULL for current */ { if (wp->w_prev != NULL) wp->w_prev->w_next = wp->w_next; else if (tp == NULL) - firstwin = wp->w_next; + firstwin = curtab->tp_firstwin = wp->w_next; else tp->tp_firstwin = wp->w_next; + if (wp->w_next != NULL) wp->w_next->w_prev = wp->w_prev; else if (tp == NULL) - lastwin = wp->w_prev; + lastwin = curtab->tp_lastwin = wp->w_prev; else tp->tp_lastwin = wp->w_prev; } @@ -4727,8 +4805,7 @@ win_remove(wp, tp) * Append frame "frp" in a frame list after frame "after". */ static void -frame_append(after, frp) - frame_T *after, *frp; +frame_append(frame_T *after, frame_T *frp) { frp->fr_next = after->fr_next; after->fr_next = frp; @@ -4741,8 +4818,7 @@ frame_append(after, frp) * Insert frame "frp" in a frame list before frame "before". */ static void -frame_insert(before, frp) - frame_T *before, *frp; +frame_insert(frame_T *before, frame_T *frp) { frp->fr_next = before; frp->fr_prev = before->fr_prev; @@ -4757,26 +4833,27 @@ frame_insert(before, frp) * Remove a frame from a frame list. */ static void -frame_remove(frp) - frame_T *frp; +frame_remove(frame_T *frp) { if (frp->fr_prev != NULL) frp->fr_prev->fr_next = frp->fr_next; else + { frp->fr_parent->fr_child = frp->fr_next; + /* special case: topframe->fr_child == frp */ + if (topframe->fr_child == frp) + topframe->fr_child = frp->fr_next; + } if (frp->fr_next != NULL) frp->fr_next->fr_prev = frp->fr_prev; } -#endif /* FEAT_WINDOWS */ - /* * Allocate w_lines[] for window "wp". * Return FAIL for failure, OK for success. */ int -win_alloc_lines(wp) - win_T *wp; +win_alloc_lines(win_T *wp) { wp->w_lines_valid = 0; wp->w_lines = (wline_T *)alloc_clear((unsigned)(Rows * sizeof(wline_T))); @@ -4789,15 +4866,11 @@ win_alloc_lines(wp) * free lsize arrays for a window */ void -win_free_lsize(wp) - win_T *wp; +win_free_lsize(win_T *wp) { /* TODO: why would wp be NULL here? */ if (wp != NULL) - { - vim_free(wp->w_lines); - wp->w_lines = NULL; - } + VIM_CLEAR(wp->w_lines); } /* @@ -4805,13 +4878,12 @@ win_free_lsize(wp) * This only does the current tab page, others must be done when made active. */ void -shell_new_rows() +shell_new_rows(void) { int h = (int)ROWS_AVAIL; if (firstwin == NULL) /* not initialized yet */ return; -#ifdef FEAT_WINDOWS if (h < frame_minheight(topframe, NULL)) h = frame_minheight(topframe, NULL); @@ -4822,15 +4894,8 @@ shell_new_rows() frame_new_height(topframe, h, FALSE, FALSE); (void)win_comp_pos(); /* recompute w_winrow and w_wincol */ -#else - if (h < 1) - h = 1; - win_new_height(firstwin, h); -#endif compute_cmdrow(); -#ifdef FEAT_WINDOWS curtab->tp_ch_used = p_ch; -#endif #if 0 /* Disabled: don't want making the screen smaller make a window larger. */ @@ -4839,12 +4904,11 @@ shell_new_rows() #endif } -#if defined(FEAT_VERTSPLIT) || defined(PROTO) /* * Called from win_new_shellsize() after Columns changed. */ void -shell_new_columns() +shell_new_columns(void) { if (firstwin == NULL) /* not initialized yet */ return; @@ -4862,22 +4926,20 @@ shell_new_columns() win_equal(curwin, FALSE, 'h'); #endif } -#endif #if defined(FEAT_CMDWIN) || defined(PROTO) /* * Save the size of all windows in "gap". */ void -win_size_save(gap) - garray_T *gap; +win_size_save(garray_T *gap) { win_T *wp; ga_init2(gap, (int)sizeof(int), 1); if (ga_grow(gap, win_count() * 2) == OK) - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { ((int *)gap->ga_data)[gap->ga_len++] = wp->w_width + wp->w_vsep_width; @@ -4890,8 +4952,7 @@ win_size_save(gap) * Does not free the growarray. */ void -win_size_restore(gap) - garray_T *gap; +win_size_restore(garray_T *gap) { win_T *wp; int i, j; @@ -4903,7 +4964,7 @@ win_size_restore(gap) for (j = 0; j < 2; ++j) { i = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]); win_setheight_win(((int *)gap->ga_data)[i++], wp); @@ -4915,14 +4976,13 @@ win_size_restore(gap) } #endif /* FEAT_CMDWIN */ -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Update the position for all windows, using the width and height of the * frames. * Returns the row just after the last window. */ int -win_comp_pos() +win_comp_pos(void) { int row = tabline_height(); int col = 0; @@ -4938,68 +4998,51 @@ win_comp_pos() * to the bottom-right position plus one. */ static void -frame_comp_pos(topfrp, row, col) - frame_T *topfrp; - int *row; - int *col; +frame_comp_pos(frame_T *topfrp, int *row, int *col) { win_T *wp; frame_T *frp; -#ifdef FEAT_VERTSPLIT int startcol; int startrow; -#endif + int h; wp = topfrp->fr_win; if (wp != NULL) { - if (wp->w_winrow != *row -#ifdef FEAT_VERTSPLIT - || wp->w_wincol != *col -#endif - ) + if (wp->w_winrow != *row || wp->w_wincol != *col) { /* position changed, redraw */ wp->w_winrow = *row; -#ifdef FEAT_VERTSPLIT wp->w_wincol = *col; -#endif redraw_win_later(wp, NOT_VALID); wp->w_redr_status = TRUE; } - *row += wp->w_height + wp->w_status_height; -#ifdef FEAT_VERTSPLIT + /* WinBar will not show if the window height is zero */ + h = VISIBLE_HEIGHT(wp) + wp->w_status_height; + *row += h > topfrp->fr_height ? topfrp->fr_height : h; *col += wp->w_width + wp->w_vsep_width; -#endif } else { -#ifdef FEAT_VERTSPLIT startrow = *row; startcol = *col; -#endif for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) { -#ifdef FEAT_VERTSPLIT if (topfrp->fr_layout == FR_ROW) *row = startrow; /* all frames are at the same row */ else *col = startcol; /* all frames are at the same col */ -#endif frame_comp_pos(frp, row, col); } } } -#endif /* FEAT_WINDOWS */ - /* * Set current window height and take care of repositioning other windows to * fit around it. */ void -win_setheight(height) - int height; +win_setheight(int height) { win_setheight_win(height, curwin); } @@ -5009,9 +5052,7 @@ win_setheight(height) * windows to fit around it. */ void -win_setheight_win(height, win) - int height; - win_T *win; +win_setheight_win(int height, win_T *win) { int row; @@ -5019,25 +5060,17 @@ win_setheight_win(height, win) { /* Always keep current window at least one line high, even when * 'winminheight' is zero. */ -#ifdef FEAT_WINDOWS if (height < p_wmh) height = p_wmh; -#endif if (height == 0) height = 1; + height += WINBAR_HEIGHT(curwin); } -#ifdef FEAT_WINDOWS frame_setheight(win->w_frame, height + win->w_status_height); /* recompute the window positions */ row = win_comp_pos(); -#else - if (height > topframe->fr_height) - height = topframe->fr_height; - win->w_height = height; - row = height; -#endif /* * If there is extra space created between the last window and the command @@ -5052,8 +5085,6 @@ win_setheight_win(height, win) redraw_all_later(NOT_VALID); } -#if defined(FEAT_WINDOWS) || defined(PROTO) - /* * Set the height of a frame to "height" and take care that all frames and * windows inside it are resized. Also resize frames on the left and right if @@ -5068,9 +5099,7 @@ win_setheight_win(height, win) * At the top level we can also use change the command line height. */ static void -frame_setheight(curfrp, height) - frame_T *curfrp; - int height; +frame_setheight(frame_T *curfrp, int height) { int room; /* total number of lines available */ int take; /* number of lines taken from other windows */ @@ -5106,7 +5135,6 @@ frame_setheight(curfrp, height) /* * Column of frames: try to change only frames in this column. */ -#ifdef FEAT_VERTSPLIT /* * Do this twice: * 1: compute room available, if it's not enough try resizing the @@ -5115,9 +5143,6 @@ frame_setheight(curfrp, height) * Try not to reduce the height of a window with 'winfixheight' set. */ for (run = 1; run <= 2; ++run) -#else - for (;;) -#endif { room = 0; room_reserved = 0; @@ -5132,33 +5157,27 @@ frame_setheight(curfrp, height) if (frp != curfrp) room -= frame_minheight(frp, NULL); } -#ifdef FEAT_VERTSPLIT if (curfrp->fr_width != Columns) room_cmdline = 0; else -#endif { room_cmdline = Rows - p_ch - (lastwin->w_winrow - + lastwin->w_height + lastwin->w_status_height); + + VISIBLE_HEIGHT(lastwin) + + lastwin->w_status_height); if (room_cmdline < 0) room_cmdline = 0; } if (height <= room + room_cmdline) break; -#ifdef FEAT_VERTSPLIT if (run == 2 || curfrp->fr_width == Columns) -#endif { if (height > room + room_cmdline) height = room + room_cmdline; break; } -#ifdef FEAT_VERTSPLIT frame_setheight(curfrp->fr_parent, height + frame_minheight(curfrp->fr_parent, NOWIN) - (int)p_wmh - 1); -#endif - /*NOTREACHED*/ } /* @@ -5242,22 +5261,18 @@ frame_setheight(curfrp, height) } } -#if defined(FEAT_VERTSPLIT) || defined(PROTO) /* * Set current window width and take care of repositioning other windows to * fit around it. */ void -win_setwidth(width) - int width; +win_setwidth(int width) { win_setwidth_win(width, curwin); } void -win_setwidth_win(width, wp) - int width; - win_T *wp; +win_setwidth_win(int width, win_T *wp) { /* Always keep current window at least one column wide, even when * 'winminwidth' is zero. */ @@ -5285,9 +5300,7 @@ win_setwidth_win(width, wp) * Strategy is similar to frame_setheight(). */ static void -frame_setwidth(curfrp, width) - frame_T *curfrp; - int width; +frame_setwidth(frame_T *curfrp, int width) { int room; /* total number of lines available */ int take; /* number of lines taken from other windows */ @@ -5422,26 +5435,23 @@ frame_setwidth(curfrp, width) } } } -#endif /* FEAT_VERTSPLIT */ /* - * Check 'winminheight' for a valid value. + * Check 'winminheight' for a valid value and reduce it if needed. */ void -win_setminheight() +win_setminheight(void) { int room; + int needed; int first = TRUE; - win_T *wp; - /* loop until there is a 'winminheight' that is possible */ + // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { - /* TODO: handle vertical splits */ - room = -p_wh; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - room += wp->w_height - p_wmh; - if (room >= 0) + room = Rows - p_ch; + needed = frame_minheight(topframe, NULL); + if (room >= needed) break; --p_wmh; if (first) @@ -5452,15 +5462,39 @@ win_setminheight() } } -#ifdef FEAT_MOUSE +/* + * Check 'winminwidth' for a valid value and reduce it if needed. + */ + void +win_setminwidth(void) +{ + int room; + int needed; + int first = TRUE; + + // loop until there is a 'winminheight' that is possible + while (p_wmw > 0) + { + room = Columns; + needed = frame_minwidth(topframe, NULL); + if (room >= needed) + break; + --p_wmw; + if (first) + { + EMSG(_(e_noroom)); + first = FALSE; + } + } +} + +#if defined(FEAT_MOUSE) || defined(PROTO) /* * Status line of dragwin is dragged "offset" lines down (negative is up). */ void -win_drag_status_line(dragwin, offset) - win_T *dragwin; - int offset; +win_drag_status_line(win_T *dragwin, int offset) { frame_T *curfr; frame_T *fr; @@ -5585,14 +5619,11 @@ win_drag_status_line(dragwin, offset) showmode(); } -#ifdef FEAT_VERTSPLIT /* * Separator line of dragwin is dragged "offset" lines right (negative is left). */ void -win_drag_vsep_line(dragwin, offset) - win_T *dragwin; - int offset; +win_drag_vsep_line(win_T *dragwin, int offset) { frame_T *curfr; frame_T *fr; @@ -5657,6 +5688,8 @@ win_drag_vsep_line(dragwin, offset) offset = room; /* Move as far as we can */ if (offset <= 0) /* No room at all, quit. */ return; + if (fr == NULL) + return; /* Safety check, should not happen. */ /* grow frame fr by offset lines */ frame_new_width(fr, fr->fr_width + offset, left, FALSE); @@ -5688,36 +5721,31 @@ win_drag_vsep_line(dragwin, offset) (void)win_comp_pos(); redraw_all_later(NOT_VALID); } -#endif /* FEAT_VERTSPLIT */ #endif /* FEAT_MOUSE */ -#endif /* FEAT_WINDOWS */ - #define FRACTION_MULT 16384L /* * Set wp->w_fraction for the current w_wrow and w_height. + * Has no effect when the window is less than two lines. */ - static void -set_fraction(wp) - win_T *wp; + void +set_fraction(win_T *wp) { - wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT + if (wp->w_height > 1) + wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT + wp->w_height / 2) / (long)wp->w_height; } /* * Set the height of a window. + * "height" excludes any window toolbar. * This takes care of the things inside the window, not what happens to the * window position, the frame or to other windows. */ void -win_new_height(wp, height) - win_T *wp; - int height; +win_new_height(win_T *wp, int height) { - linenr_T lnum; - int sline, line_size; int prev_height = wp->w_height; /* Don't want a negative height. Happens when splitting a tiny window. @@ -5743,13 +5771,22 @@ win_new_height(wp, height) wp->w_height = height; wp->w_skipcol = 0; + /* There is no point in adjusting the scroll position when exiting. Some + * values might be invalid. */ + if (!exiting) + scroll_to_fraction(wp, prev_height); +} + + void +scroll_to_fraction(win_T *wp, int prev_height) +{ + linenr_T lnum; + int sline, line_size; + int height = wp->w_height; + /* Don't change w_topline when height is zero. Don't set w_topline when * 'scrollbind' is set and this isn't the current window. */ - if (height > 0 -#ifdef FEAT_SCROLLBIND - && (!wp->w_p_scb || wp == curwin) -#endif - ) + if (height > 0 && (!wp->w_p_scb || wp == curwin)) { /* * Find a value for w_topline that shows the cursor at the same @@ -5784,13 +5821,13 @@ win_new_height(wp, height) */ wp->w_wrow = line_size; if (wp->w_wrow >= wp->w_height - && (W_WIDTH(wp) - win_col_off(wp)) > 0) + && (wp->w_width - win_col_off(wp)) > 0) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp); + wp->w_skipcol += wp->w_width - win_col_off(wp); --wp->w_wrow; while (wp->w_wrow >= wp->w_height) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp) + wp->w_skipcol += wp->w_width - win_col_off(wp) + win_col_off2(wp); --wp->w_wrow; } @@ -5856,21 +5893,19 @@ win_new_height(wp, height) win_comp_scroll(wp); redraw_win_later(wp, SOME_VALID); -#ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; -#endif invalidate_botline_win(wp); } -#ifdef FEAT_VERTSPLIT /* * Set the width of a window. */ void -win_new_width(wp, width) - win_T *wp; - int width; +win_new_width(win_T *wp, int width) { +#ifdef FEAT_GUI_MACVIM + int resized = wp->w_width != width; +#endif wp->w_width = width; wp->w_lines_valid = 0; changed_line_abv_curs_win(wp); @@ -5882,17 +5917,15 @@ win_new_width(wp, width) } #ifdef FEAT_GUI_MACVIM /* The view may have moved, so clear all or display may get corrupted. */ - redraw_win_later(wp, gui.in_use ? CLEAR : NOT_VALID); + redraw_win_later(wp, resized && gui.in_use ? CLEAR : NOT_VALID); #else redraw_win_later(wp, NOT_VALID); #endif wp->w_redr_status = TRUE; } -#endif void -win_comp_scroll(wp) - win_T *wp; +win_comp_scroll(win_T *wp) { wp->w_p_scr = ((unsigned)wp->w_height >> 1); if (wp->w_p_scr == 0) @@ -5903,9 +5936,8 @@ win_comp_scroll(wp) * command_height: called whenever p_ch has been changed */ void -command_height() +command_height(void) { -#ifdef FEAT_WINDOWS int h; frame_T *frp; int old_p_ch = curtab->tp_ch_used; @@ -5917,10 +5949,8 @@ command_height() /* Find bottom frame with width of screen. */ frp = lastwin->w_frame; -# ifdef FEAT_VERTSPLIT while (frp->fr_width != Columns && frp->fr_parent != NULL) frp = frp->fr_parent; -# endif /* Avoid changing the height of a window with 'winfixheight' set. */ while (frp->fr_prev != NULL && frp->fr_layout == FR_LEAF @@ -5972,21 +6002,14 @@ command_height() /* Recompute window positions. */ if (frp != lastwin->w_frame) (void)win_comp_pos(); -#else - cmdline_row = Rows - p_ch; - win_setheight(cmdline_row); -#endif } -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * Resize frame "frp" to be "n" lines higher (negative for less high). * Also resize the frames it is contained in. */ static void -frame_add_height(frp, n) - frame_T *frp; - int n; +frame_add_height(frame_T *frp, int n) { frame_new_height(frp, frp->fr_height + n, FALSE, FALSE); for (;;) @@ -6003,18 +6026,16 @@ frame_add_height(frp, n) * value of 'laststatus'. */ void -last_status(morewin) - int morewin; /* pretend there are two or more windows */ +last_status( + int morewin) /* pretend there are two or more windows */ { /* Don't make a difference between horizontal or vertical split. */ last_status_rec(topframe, (p_ls == 2 - || (p_ls == 1 && (morewin || lastwin != firstwin)))); + || (p_ls == 1 && (morewin || !ONE_WINDOW)))); } static void -last_status_rec(fr, statusline) - frame_T *fr; - int statusline; +last_status_rec(frame_T *fr, int statusline) { frame_T *fp; win_T *wp; @@ -6060,14 +6081,12 @@ last_status_rec(fr, statusline) redraw_all_later(SOME_VALID); } } -#ifdef FEAT_VERTSPLIT else if (fr->fr_layout == FR_ROW) { /* vertically split windows, set status line for each one */ for (fp = fr->fr_child; fp != NULL; fp = fp->fr_next) last_status_rec(fp, statusline); } -#endif else { /* horizontally split window, set status line for last one */ @@ -6081,7 +6100,7 @@ last_status_rec(fr, statusline) * Return the number of lines used by the tab page line. */ int -tabline_height() +tabline_height(void) { #ifdef FEAT_GUI_TABLINE /* When the GUI has the tabline then this always returns zero. */ @@ -6096,8 +6115,6 @@ tabline_height() return 1; } -#endif /* FEAT_WINDOWS */ - #if defined(FEAT_SEARCHPATH) || defined(PROTO) /* * Get the file name at the cursor. @@ -6105,10 +6122,10 @@ tabline_height() * Returns the name in allocated memory, NULL for failure. */ char_u * -grab_file_name(count, file_lnum) - long count; - linenr_T *file_lnum; +grab_file_name(long count, linenr_T *file_lnum) { + int options = FNAME_MESS|FNAME_EXP|FNAME_REL|FNAME_UNESC; + if (VIsual_active) { int len; @@ -6116,12 +6133,10 @@ grab_file_name(count, file_lnum) if (get_visual_text(NULL, &ptr, &len) == FAIL) return NULL; - return find_file_name_in_path(ptr, len, - FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname); + return find_file_name_in_path(ptr, len, options, + count, curbuf->b_ffname); } - return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count, - file_lnum); - + return file_name_at_cursor(options | FNAME_HYP, count, file_lnum); } /* @@ -6138,10 +6153,7 @@ grab_file_name(count, file_lnum) * FNAME_INCL apply "includeexpr" */ char_u * -file_name_at_cursor(options, count, file_lnum) - int options; - long count; - linenr_T *file_lnum; +file_name_at_cursor(int options, long count, linenr_T *file_lnum) { return file_name_in_line(ml_get_curline(), curwin->w_cursor.col, options, count, curbuf->b_ffname, @@ -6153,23 +6165,25 @@ file_name_at_cursor(options, count, file_lnum) * Otherwise like file_name_at_cursor(). */ char_u * -file_name_in_line(line, col, options, count, rel_fname, file_lnum) - char_u *line; - int col; - int options; - long count; - char_u *rel_fname; /* file we are searching relative to */ - linenr_T *file_lnum; /* line number after the file name */ +file_name_in_line( + char_u *line, + int col, + int options, + long count, + char_u *rel_fname, /* file we are searching relative to */ + linenr_T *file_lnum) /* line number after the file name */ { char_u *ptr; int len; + int in_type = TRUE; + int is_url = FALSE; /* * search forward for what could be the start of a file name */ ptr = line + col; while (*ptr != NUL && !vim_isfilec(*ptr)) - mb_ptr_adv(ptr); + MB_PTR_ADV(ptr); if (*ptr == NUL) /* nothing found */ { if (options & FNAME_MESS) @@ -6200,14 +6214,30 @@ file_name_in_line(line, col, options, count, rel_fname, file_lnum) * Also allow "://" when ':' is not in 'isfname'. */ len = 0; - while (vim_isfilec(ptr[len]) - || ((options & FNAME_HYP) && path_is_url(ptr + len))) + while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ') + || ((options & FNAME_HYP) && path_is_url(ptr + len)) + || (is_url && vim_strchr((char_u *)"?&=", ptr[len]) != NULL)) + { + /* After type:// we also include ?, & and = as valid characters, so that + * http://google.com?q=this&that=ok works. */ + if ((ptr[len] >= 'A' && ptr[len] <= 'Z') || (ptr[len] >= 'a' && ptr[len] <= 'z')) + { + if (in_type && path_is_url(ptr + len + 1)) + is_url = TRUE; + } + else + in_type = FALSE; + + if (ptr[len] == '\\') + /* Skip over the "\" in "\ ". */ + ++len; #ifdef FEAT_MBYTE if (has_mbyte) len += (*mb_ptr2len)(ptr + len); else #endif ++len; + } /* * If there is trailing punctuation, remove it. @@ -6238,12 +6268,10 @@ file_name_in_line(line, col, options, count, rel_fname, file_lnum) } # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) -static char_u *eval_includeexpr __ARGS((char_u *ptr, int len)); +static char_u *eval_includeexpr(char_u *ptr, int len); static char_u * -eval_includeexpr(ptr, len) - char_u *ptr; - int len; +eval_includeexpr(char_u *ptr, int len) { char_u *res; @@ -6260,12 +6288,12 @@ eval_includeexpr(ptr, len) * Otherwise like file_name_at_cursor(). */ char_u * -find_file_name_in_path(ptr, len, options, count, rel_fname) - char_u *ptr; - int len; - int options; - long count; - char_u *rel_fname; /* file we are searching relative to */ +find_file_name_in_path( + char_u *ptr, + int len, + int options, + long count, + char_u *rel_fname) /* file we are searching relative to */ { char_u *file_name; int c; @@ -6339,8 +6367,7 @@ find_file_name_in_path(ptr, len, options, count, rel_fname) * URL_BACKSLASH. */ static int -path_is_url(p) - char_u *p; +path_is_url(char_u *p) { if (STRNCMP(p, "://", (size_t)3) == 0) return URL_SLASH; @@ -6355,8 +6382,7 @@ path_is_url(p) * Return zero otherwise. */ int -path_with_url(fname) - char_u *fname; +path_with_url(char_u *fname) { char_u *p; @@ -6369,8 +6395,7 @@ path_with_url(fname) * Return TRUE if "name" is a full (absolute) path name or URL. */ int -vim_isAbsName(name) - char_u *name; +vim_isAbsName(char_u *name) { return (path_with_url(name) != 0 || mch_isFullName(name)); } @@ -6381,10 +6406,11 @@ vim_isAbsName(name) * return FAIL for failure, OK otherwise */ int -vim_FullName(fname, buf, len, force) - char_u *fname, *buf; - int len; - int force; /* force expansion even when already absolute */ +vim_FullName( + char_u *fname, + char_u *buf, + int len, + int force) /* force expansion even when already absolute */ { int retval = OK; int url; @@ -6401,7 +6427,7 @@ vim_FullName(fname, buf, len, force) /* something failed; use the file name (truncate when too long) */ vim_strncpy(buf, fname, len - 1); } -#if defined(MACOS_CLASSIC) || defined(OS2) || defined(MSDOS) || defined(MSWIN) +#if defined(MSWIN) slash_adjust(buf); #endif return retval; @@ -6412,29 +6438,23 @@ vim_FullName(fname, buf, len, force) * the current number of windows. */ int -min_rows() +min_rows(void) { int total; -#ifdef FEAT_WINDOWS tabpage_T *tp; int n; -#endif if (firstwin == NULL) /* not initialized yet */ return MIN_LINES; -#ifdef FEAT_WINDOWS total = 0; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) { n = frame_minheight(tp->tp_topframe, NULL); if (total < n) total = n; } total += tabline_height(); -#else - total = 1; /* at least one window should have a line! */ -#endif total += 1; /* count the room for the command line */ return total; } @@ -6445,9 +6465,8 @@ min_rows() * Does not count "aucmd_win". */ int -only_one_window() +only_one_window(void) { -#ifdef FEAT_WINDOWS int count = 0; win_T *wp; @@ -6455,45 +6474,30 @@ only_one_window() if (first_tabpage->tp_next != NULL) return FALSE; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) if (wp->w_buffer != NULL - && (!((wp->w_buffer->b_help && !curbuf->b_help) + && (!((bt_help(wp->w_buffer) && !bt_help(curbuf)) # ifdef FEAT_QUICKFIX || wp->w_p_pvw # endif - ) || wp == curwin) -# ifdef FEAT_AUTOCMD - && wp != aucmd_win -# endif - ) + ) || wp == curwin) && wp != aucmd_win) ++count; return (count <= 1); -#else - return TRUE; -#endif } -#if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD) || defined(PROTO) /* * Correct the cursor line number in other windows. Used after changing the * current buffer, and before applying autocommands. * When "do_curwin" is TRUE, also check current window. */ void -check_lnums(do_curwin) - int do_curwin; +check_lnums(int do_curwin) { win_T *wp; - -#ifdef FEAT_WINDOWS tabpage_T *tp; FOR_ALL_TAB_WINDOWS(tp, wp) if ((do_curwin || wp != curwin) && wp->w_buffer == curbuf) -#else - wp = curwin; - if (do_curwin) -#endif { if (wp->w_cursor.lnum > curbuf->b_ml.ml_line_count) wp->w_cursor.lnum = curbuf->b_ml.ml_line_count; @@ -6501,9 +6505,6 @@ check_lnums(do_curwin) wp->w_topline = curbuf->b_ml.ml_line_count; } } -#endif - -#if defined(FEAT_WINDOWS) || defined(PROTO) /* * A snapshot of the window sizes, to restore them after closing the help @@ -6521,25 +6522,20 @@ check_lnums(do_curwin) * Create a snapshot of the current frame sizes. */ void -make_snapshot(idx) - int idx; +make_snapshot(int idx) { clear_snapshot(curtab, idx); make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]); } static void -make_snapshot_rec(fr, frp) - frame_T *fr; - frame_T **frp; +make_snapshot_rec(frame_T *fr, frame_T **frp) { *frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T)); if (*frp == NULL) return; (*frp)->fr_layout = fr->fr_layout; -# ifdef FEAT_VERTSPLIT (*frp)->fr_width = fr->fr_width; -# endif (*frp)->fr_height = fr->fr_height; if (fr->fr_next != NULL) make_snapshot_rec(fr->fr_next, &((*frp)->fr_next)); @@ -6553,17 +6549,14 @@ make_snapshot_rec(fr, frp) * Remove any existing snapshot. */ static void -clear_snapshot(tp, idx) - tabpage_T *tp; - int idx; +clear_snapshot(tabpage_T *tp, int idx) { clear_snapshot_rec(tp->tp_snapshot[idx]); tp->tp_snapshot[idx] = NULL; } static void -clear_snapshot_rec(fr) - frame_T *fr; +clear_snapshot_rec(frame_T *fr) { if (fr != NULL) { @@ -6579,16 +6572,14 @@ clear_snapshot_rec(fr) * still the same. */ void -restore_snapshot(idx, close_curwin) - int idx; - int close_curwin; /* closing current window */ +restore_snapshot( + int idx, + int close_curwin) /* closing current window */ { win_T *wp; if (curtab->tp_snapshot[idx] != NULL -# ifdef FEAT_VERTSPLIT && curtab->tp_snapshot[idx]->fr_width == topframe->fr_width -# endif && curtab->tp_snapshot[idx]->fr_height == topframe->fr_height && check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK) { @@ -6603,12 +6594,10 @@ restore_snapshot(idx, close_curwin) /* * Check if frames "sn" and "fr" have the same layout, same following frames - * and same children. + * and same children. And the window pointer is valid. */ static int -check_snapshot_rec(sn, fr) - frame_T *sn; - frame_T *fr; +check_snapshot_rec(frame_T *sn, frame_T *fr) { if (sn->fr_layout != fr->fr_layout || (sn->fr_next == NULL) != (fr->fr_next == NULL) @@ -6616,7 +6605,8 @@ check_snapshot_rec(sn, fr) || (sn->fr_next != NULL && check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL) || (sn->fr_child != NULL - && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL)) + && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL) + || (sn->fr_win != NULL && !win_valid(sn->fr_win))) return FAIL; return OK; } @@ -6627,23 +6617,17 @@ check_snapshot_rec(sn, fr) * Returns a pointer to the old current window, or NULL. */ static win_T * -restore_snapshot_rec(sn, fr) - frame_T *sn; - frame_T *fr; +restore_snapshot_rec(frame_T *sn, frame_T *fr) { win_T *wp = NULL; win_T *wp2; fr->fr_height = sn->fr_height; -# ifdef FEAT_VERTSPLIT fr->fr_width = sn->fr_width; -# endif if (fr->fr_layout == FR_LEAF) { frame_new_height(fr, fr->fr_height, FALSE, FALSE); -# ifdef FEAT_VERTSPLIT frame_new_width(fr, fr->fr_width, FALSE, FALSE); -# endif wp = sn->fr_win; } if (sn->fr_next != NULL) @@ -6661,30 +6645,25 @@ restore_snapshot_rec(sn, fr) return wp; } -#endif - #if defined(FEAT_EVAL) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ || defined(PROTO) /* * Set "win" to be the curwin and "tp" to be the current tab page. - * restore_win() MUST be called to undo. - * No autocommands will be executed. + * restore_win() MUST be called to undo, also when FAIL is returned. + * No autocommands will be executed until restore_win() is called. * When "no_display" is TRUE the display won't be affected, no redraw is * triggered, another tabpage access is limited. * Returns FAIL if switching to "win" failed. */ int -switch_win(save_curwin, save_curtab, win, tp, no_display) - win_T **save_curwin UNUSED; - tabpage_T **save_curtab UNUSED; - win_T *win UNUSED; - tabpage_T *tp UNUSED; - int no_display UNUSED; -{ -# ifdef FEAT_AUTOCMD +switch_win( + win_T **save_curwin, + tabpage_T **save_curtab, + win_T *win, + tabpage_T *tp, + int no_display) +{ block_autocmds(); -# endif -# ifdef FEAT_WINDOWS *save_curwin = curwin; if (tp != NULL) { @@ -6701,15 +6680,9 @@ switch_win(save_curwin, save_curtab, win, tp, no_display) goto_tabpage_tp(tp, FALSE, FALSE); } if (!win_valid(win)) - { -# ifdef FEAT_AUTOCMD - unblock_autocmds(); -# endif return FAIL; - } curwin = win; curbuf = curwin->w_buffer; -# endif return OK; } @@ -6719,12 +6692,11 @@ switch_win(save_curwin, save_curtab, win, tp, no_display) * triggered. */ void -restore_win(save_curwin, save_curtab, no_display) - win_T *save_curwin UNUSED; - tabpage_T *save_curtab UNUSED; - int no_display UNUSED; +restore_win( + win_T *save_curwin UNUSED, + tabpage_T *save_curtab UNUSED, + int no_display UNUSED) { -# ifdef FEAT_WINDOWS if (save_curtab != NULL && valid_tabpage(save_curtab)) { if (no_display) @@ -6743,10 +6715,7 @@ restore_win(save_curwin, save_curtab, no_display) curwin = save_curwin; curbuf = curwin->w_buffer; } -# endif -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif } /* @@ -6754,14 +6723,10 @@ restore_win(save_curwin, save_curtab, no_display) * No autocommands will be executed. Use aucmd_prepbuf() if there are any. */ void -switch_buffer(save_curbuf, buf) - buf_T *buf; - buf_T **save_curbuf; +switch_buffer(bufref_T *save_curbuf, buf_T *buf) { -# ifdef FEAT_AUTOCMD block_autocmds(); -# endif - *save_curbuf = curbuf; + set_bufref(save_curbuf, curbuf); --curbuf->b_nwindows; curbuf = buf; curwin->w_buffer = buf; @@ -6772,29 +6737,26 @@ switch_buffer(save_curbuf, buf) * Restore the current buffer after using switch_buffer(). */ void -restore_buffer(save_curbuf) - buf_T *save_curbuf; +restore_buffer(bufref_T *save_curbuf) { -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif /* Check for valid buffer, just in case. */ - if (buf_valid(save_curbuf)) + if (bufref_valid(save_curbuf)) { --curbuf->b_nwindows; - curwin->w_buffer = save_curbuf; - curbuf = save_curbuf; + curwin->w_buffer = save_curbuf->br_buf; + curbuf = save_curbuf->br_buf; ++curbuf->b_nwindows; } } #endif -#if (defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)) || defined(PROTO) +#if defined(FEAT_GUI) || defined(PROTO) /* * Return TRUE if there is any vertically split window. */ int -win_hasvertsplit() +win_hasvertsplit(void) { frame_T *fr; @@ -6819,13 +6781,14 @@ win_hasvertsplit() * Return ID of added match, -1 on failure. */ int -match_add(wp, grp, pat, prio, id, pos_list) - win_T *wp; - char_u *grp; - char_u *pat; - int prio; - int id; - list_T *pos_list; +match_add( + win_T *wp, + char_u *grp, + char_u *pat, + int prio, + int id, + list_T *pos_list, + char_u *conceal_char UNUSED) /* pointer to conceal replacement char */ { matchitem_T *cur; matchitem_T *prev; @@ -6838,7 +6801,7 @@ match_add(wp, grp, pat, prio, id, pos_list) return -1; if (id < -1 || id == 0) { - EMSGN("E799: Invalid ID: %ld (must be greater than or equal to 1)", id); + EMSGN(_("E799: Invalid ID: %ld (must be greater than or equal to 1)"), id); return -1; } if (id != -1) @@ -6848,7 +6811,7 @@ match_add(wp, grp, pat, prio, id, pos_list) { if (cur->id == id) { - EMSGN("E801: ID already taken: %ld", id); + EMSGN(_("E801: ID already taken: %ld"), id); return -1; } cur = cur->next; @@ -6885,6 +6848,11 @@ match_add(wp, grp, pat, prio, id, pos_list) m->match.regprog = regprog; m->match.rmm_ic = FALSE; m->match.rmm_maxcol = 0; +# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE) + m->conceal_char = 0; + if (conceal_char != NULL) + m->conceal_char = (*mb_ptr2char)(conceal_char); +# endif /* Set up position matches */ if (pos_list != NULL) @@ -7011,10 +6979,7 @@ match_add(wp, grp, pat, prio, id, pos_list) * Print error messages if 'perr' is TRUE. */ int -match_delete(wp, id, perr) - win_T *wp; - int id; - int perr; +match_delete(win_T *wp, int id, int perr) { matchitem_T *cur = wp->w_match_head; matchitem_T *prev = cur; @@ -7023,7 +6988,7 @@ match_delete(wp, id, perr) if (id < 1) { if (perr == TRUE) - EMSGN("E802: Invalid ID: %ld (must be greater than or equal to 1)", + EMSGN(_("E802: Invalid ID: %ld (must be greater than or equal to 1)"), id); return -1; } @@ -7035,7 +7000,7 @@ match_delete(wp, id, perr) if (cur == NULL) { if (perr == TRUE) - EMSGN("E803: ID not found: %ld", id); + EMSGN(_("E803: ID not found: %ld"), id); return -1; } if (cur == prev) @@ -7071,8 +7036,7 @@ match_delete(wp, id, perr) * Delete all matches in the match list of window 'wp'. */ void -clear_matches(wp) - win_T *wp; +clear_matches(win_T *wp) { matchitem_T *m; @@ -7092,9 +7056,7 @@ clear_matches(wp) * Return NULL if match not found. */ matchitem_T * -get_match(wp, id) - win_T *wp; - int id; +get_match(win_T *wp, int id) { matchitem_T *cur = wp->w_match_head; @@ -7124,7 +7086,6 @@ get_win_number(win_T *wp, win_T *first_win) get_tab_number(tabpage_T *tp UNUSED) { int i = 1; -# ifdef FEAT_WINDOWS tabpage_T *t; for (t = first_tabpage; t != NULL && t != tp; t = t->tp_next) @@ -7133,19 +7094,15 @@ get_tab_number(tabpage_T *tp UNUSED) if (t == NULL) return 0; else -# endif return i; } #endif -#ifdef FEAT_WINDOWS /* * Return TRUE if "topfrp" and its children are at the right height. */ static int -frame_check_height(topfrp, height) - frame_T *topfrp; - int height; +frame_check_height(frame_T *topfrp, int height) { frame_T *frp; @@ -7159,16 +7116,12 @@ frame_check_height(topfrp, height) return TRUE; } -#endif -#ifdef FEAT_VERTSPLIT /* * Return TRUE if "topfrp" and its children are at the right width. */ static int -frame_check_width(topfrp, width) - frame_T *topfrp; - int width; +frame_check_width(frame_T *topfrp, int width) { frame_T *frp; @@ -7182,5 +7135,127 @@ frame_check_width(topfrp, width) return TRUE; } -#endif +#if defined(FEAT_EVAL) || defined(PROTO) + int +win_getid(typval_T *argvars) +{ + int winnr; + win_T *wp; + + if (argvars[0].v_type == VAR_UNKNOWN) + return curwin->w_id; + winnr = get_tv_number(&argvars[0]); + if (winnr > 0) + { + if (argvars[1].v_type == VAR_UNKNOWN) + wp = firstwin; + else + { + tabpage_T *tp; + int tabnr = get_tv_number(&argvars[1]); + + FOR_ALL_TABPAGES(tp) + if (--tabnr == 0) + break; + if (tp == NULL) + return -1; + if (tp == curtab) + wp = firstwin; + else + wp = tp->tp_firstwin; + } + for ( ; wp != NULL; wp = wp->w_next) + if (--winnr == 0) + return wp->w_id; + } + return 0; +} + + int +win_gotoid(typval_T *argvars) +{ + win_T *wp; + tabpage_T *tp; + int id = get_tv_number(&argvars[0]); + + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_id == id) + { + goto_tabpage_win(tp, wp); + return 1; + } + return 0; +} + + void +win_id2tabwin(typval_T *argvars, list_T *list) +{ + win_T *wp; + tabpage_T *tp; + int winnr = 1; + int tabnr = 1; + int id = get_tv_number(&argvars[0]); + + FOR_ALL_TABPAGES(tp) + { + FOR_ALL_WINDOWS_IN_TAB(tp, wp) + { + if (wp->w_id == id) + { + list_append_number(list, tabnr); + list_append_number(list, winnr); + return; + } + ++winnr; + } + ++tabnr; + winnr = 1; + } + list_append_number(list, 0); + list_append_number(list, 0); +} + + win_T * +win_id2wp(typval_T *argvars) +{ + win_T *wp; + tabpage_T *tp; + int id = get_tv_number(&argvars[0]); + + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_id == id) + return wp; + + return NULL; +} + + int +win_id2win(typval_T *argvars) +{ + win_T *wp; + int nr = 1; + int id = get_tv_number(&argvars[0]); + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_id == id) + return nr; + ++nr; + } + return 0; +} + + void +win_findbuf(typval_T *argvars, list_T *list) +{ + win_T *wp; + tabpage_T *tp; + int bufnr = get_tv_number(&argvars[0]); + + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer->b_fnum == bufnr) + list_append_number(list, wp->w_id); +} + +#endif diff --git a/src/workshop.c b/src/workshop.c index e0db10ec78..143f77914a 100644 --- a/src/workshop.c +++ b/src/workshop.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -33,7 +33,6 @@ #include "vim.h" #include "version.h" -#include "gui_beval.h" #include "workshop.h" void workshop_hotkeys(Boolean); @@ -48,7 +47,7 @@ static char *append_selection(int, char *, int *, int *); static void load_buffer_by_name(char *, int); static void load_window(char *, int lnum); static void warp_to_pc(int); -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI void workshop_beval_cb(BalloonEval *, int); static int computeIndex(int, char_u *, int); #endif @@ -71,7 +70,7 @@ static Boolean workshopHotKeysEnabled = False; /* * The following enum is from <gp_dbx/gp_dbx_common.h>. We can't include it - * here because its C++. + * here because it's C++. */ enum { @@ -98,7 +97,7 @@ static char *initialFileCmd; /* save command but defer doing it */ void -workshop_init() +workshop_init(void) { char_u buf[64]; int is_dirty = FALSE; @@ -148,7 +147,7 @@ workshop_init() } void -workshop_postinit() +workshop_postinit(void) { do_cmdline_cmd((char_u *)initialFileCmd); ALT_INPUT_LOCK_OFF; @@ -170,7 +169,7 @@ ex_wsverb(exarg_T *eap) * of NEdit, for example, when the connection is initiated from the editor. */ char * -workshop_get_editor_name() +workshop_get_editor_name(void) { return "gvim"; } @@ -181,7 +180,7 @@ workshop_get_editor_name() * version to the application. */ char * -workshop_get_editor_version() +workshop_get_editor_version(void) { return Version; } @@ -208,7 +207,7 @@ workshop_load_file( wstrace("workshop_load_file(%s, %d)\n", filename, line); #endif -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI bevalServers |= BEVAL_WORKSHOP; #endif @@ -288,7 +287,7 @@ workshop_save_file( } void -workshop_save_files() +workshop_save_files(void) { /* Save the given file */ #ifdef WSDEBUG_TRACE @@ -300,7 +299,7 @@ workshop_save_files() } void -workshop_quit() +workshop_quit(void) { #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE)) @@ -311,7 +310,7 @@ workshop_quit() } void -workshop_minimize() +workshop_minimize(void) { #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE)) @@ -320,7 +319,7 @@ workshop_minimize() workshop_minimize_shell(vimShell); } void -workshop_maximize() +workshop_maximize(void) { #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE)) @@ -510,7 +509,7 @@ workshop_moved_marks(char *filename UNUSED) } int -workshop_get_font_height() +workshop_get_font_height(void) { XmFontList fontList; /* fontList made from gui.norm_font */ XmString str; @@ -623,7 +622,7 @@ workshop_submenu_begin( */ void -workshop_submenu_end() +workshop_submenu_end(void) { char *p; @@ -720,7 +719,7 @@ workshop_menu_item( */ void -workshop_menu_end() +workshop_menu_end(void) { Boolean using_tearoff; /* set per current option setting */ @@ -734,7 +733,7 @@ workshop_menu_end() } void -workshop_toolbar_begin() +workshop_toolbar_begin(void) { #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE)) @@ -746,7 +745,7 @@ workshop_toolbar_begin() } void -workshop_toolbar_end() +workshop_toolbar_end(void) { char_u buf[64]; @@ -1087,7 +1086,7 @@ workshop_get_positions( *curCol = curwin->w_cursor.col; if (curbuf->b_visual.vi_mode == 'v' && - equalpos(curwin->w_cursor, curbuf->b_visual.vi_end)) + EQUAL_POS(curwin->w_cursor, curbuf->b_visual.vi_end)) { *selStartLine = curbuf->b_visual.vi_start.lnum; *selStartCol = curbuf->b_visual.vi_start.col; @@ -1265,7 +1264,6 @@ load_window( } else { -#ifdef FEAT_WINDOWS /* buf is in a window */ if (win != curwin) { @@ -1273,7 +1271,6 @@ load_window( /* wsdebug("load_window: window enter %s\n", win->w_buffer->b_sfname); */ } -#endif if (lnum > 0 && win->w_cursor.lnum != lnum) { warp_to_pc(lnum); @@ -1319,7 +1316,7 @@ get_window( { win_T *wp = NULL; /* window filename is in */ - for (wp = firstwin; wp != NULL; wp = W_NEXT(wp)) + FOR_ALL_WINDOWS(wp) if (buf == wp->w_buffer) break; return wp; @@ -1405,7 +1402,7 @@ fixup( /* For the NoHands test suite */ char * -workshop_test_getcurrentfile() +workshop_test_getcurrentfile(void) { char *filename, *selection; int curLine, curCol, selStartLine, selStartCol, selEndLine; @@ -1421,13 +1418,13 @@ workshop_test_getcurrentfile() } int -workshop_test_getcursorrow() +workshop_test_getcursorrow(void) { return 0; } int -workshop_test_getcursorcol() +workshop_test_getcursorcol(void) { char *filename, *selection; int curLine, curCol, selStartLine, selStartCol, selEndLine; @@ -1443,13 +1440,13 @@ workshop_test_getcursorcol() } char * -workshop_test_getcursorrowtext() +workshop_test_getcursorrowtext(void) { return NULL; } char * -workshop_test_getselectedtext() +workshop_test_getselectedtext(void) { char *filename, *selection; int curLine, curCol, selStartLine, selStartCol, selEndLine; @@ -1499,7 +1496,7 @@ fixAccelText( return NULL; } -#ifdef FEAT_BEVAL +#ifdef FEAT_BEVAL_GUI void workshop_beval_cb( BalloonEval *beval, @@ -1752,7 +1749,7 @@ setDollarVim( * directory. This is a Sun Visual WorkShop requirement! * * Note: We override a user's $VIM because it won't have the - * WorkShop specific files. S/he may not like this but its + * WorkShop specific files. S/he may not like this but it's * better than getting the wrong files (especially as the * user is likely to have $VIM set to 5.4 or later). */ diff --git a/src/workshop.h b/src/workshop.h index 06b125720b..ead227eea9 100644 --- a/src/workshop.h +++ b/src/workshop.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur diff --git a/src/wsdebug.c b/src/wsdebug.c index e8fd094819..4bb7205fe3 100644 --- a/src/wsdebug.c +++ b/src/wsdebug.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=8 sw=8: +/* vi:set ts=8 sw=8 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur @@ -47,7 +47,7 @@ static int errorHandler(Display *, XErrorEvent *); /* * wsdebug_wait - This function can be used to delay or stop execution of vim. - * Its normally used to delay startup while attaching a + * It's normally used to delay startup while attaching a * debugger to a running process. Since workshop starts gvim * from a background process this is the only way to debug * startup problems. diff --git a/src/wsdebug.h b/src/wsdebug.h index 03da5697c5..a29063c628 100644 --- a/src/wsdebug.h +++ b/src/wsdebug.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=8 sw=8: +/* vi:set ts=8 sw=8 noet: * * VIM - Vi IMproved by Bram Moolenaar * Visual Workshop integration by Gordon Prieur diff --git a/src/xpm/README.txt b/src/xpm/README.txt index 586de6c817..25f3831eb3 100644 --- a/src/xpm/README.txt +++ b/src/xpm/README.txt @@ -4,6 +4,10 @@ This is XPM library compiled for Windows which is intended for use with Vim Libraries in x86 directory were compiled with MSVC6 and MinGW. Proposed commands to compile Vim are: +If you want to build XPM library by yourself, you may want to use the +following Win32 port: +https://github.com/koron/libXpm-win32 + Any version of MSVC starting from version 6.0: nmake -f Make_mvc.mak GUI=yes CSCOPE=yes NETBEANS=yes XPM=e:\hg\xpm\x86 diff --git a/src/xpm/x64/lib-vc14/libXpm.lib b/src/xpm/x64/lib-vc14/libXpm.lib new file mode 100644 index 0000000000..db79b4a89f Binary files /dev/null and b/src/xpm/x64/lib-vc14/libXpm.lib differ diff --git a/src/xpm/x86/lib-vc14/libXpm.lib b/src/xpm/x86/lib-vc14/libXpm.lib new file mode 100644 index 0000000000..7010d30eea Binary files /dev/null and b/src/xpm/x86/lib-vc14/libXpm.lib differ diff --git a/src/xpm_w32.c b/src/xpm_w32.c index 7241fb6a94..20612c51eb 100644 --- a/src/xpm_w32.c +++ b/src/xpm_w32.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * Load XPM image. * @@ -14,15 +14,6 @@ #endif #include <windows.h> -/* reduced def from Vim.h */ -#ifndef __ARGS -# if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264) -# define __ARGS(x) x -# else -# define __ARGS(x) () -# endif -#endif - #include "xpm_w32.h" /* Engage Windows support in libXpm */ @@ -37,10 +28,10 @@ * "hShape". */ int -LoadXpmImage(filename, hImage, hShape) - char *filename; - HBITMAP *hImage; - HBITMAP *hShape; +LoadXpmImage( + char *filename, + HBITMAP *hImage, + HBITMAP *hShape) { XImage *img; /* loaded image */ XImage *shp; /* shapeimage */ diff --git a/src/xpm_w32.h b/src/xpm_w32.h index 3fe447586d..914739b9fa 100644 --- a/src/xpm_w32.h +++ b/src/xpm_w32.h @@ -3,5 +3,5 @@ */ #ifndef XPM_W32__H -int LoadXpmImage __ARGS((char *filename, HBITMAP *hImage, HBITMAP *hShape)); +int LoadXpmImage(char *filename, HBITMAP *hImage, HBITMAP *hShape); #endif diff --git a/src/xxd/Make_bc3.mak b/src/xxd/Make_bc3.mak deleted file mode 100644 index dee2521712..0000000000 --- a/src/xxd/Make_bc3.mak +++ /dev/null @@ -1,31 +0,0 @@ -# Simple makefile for Borland C++ 4.0 -# 3.1 can NOT be used, it has problems with the fileno() define. - -# Command line variables: -# BOR path to root of Borland C (E:\BORLANDC) -# DEBUG set to "yes" for debugging (no) - -!ifndef BOR -BOR = e:\bc4 -!endif - -!if ("$(DEBUG)" == "yes") -DEBUG_FLAG = -v -DDEBUG -!else -DEBUG_FLAG = -!endif - -CC = $(BOR)\bin\bcc -INC = -I$(BOR)\include -LIB = -L$(BOR)\lib - -# The following compile options can be changed for better machines. -# replace -1- with -2 to produce code for a 80286 or higher -# replace -1- with -3 to produce code for a 80386 or higher -# add -v for source debugging -OPTIMIZE= -1- -Ox - -CFLAGS = -A -mc -DMSDOS $(DEBUG_FLAG) $(OPTIMIZE) $(INC) $(LIB) - -xxd.exe: xxd.c - $(CC) $(CFLAGS) xxd.c diff --git a/src/xxd/Make_cyg.mak b/src/xxd/Make_cyg.mak deleted file mode 100644 index 4f344f0383..0000000000 --- a/src/xxd/Make_cyg.mak +++ /dev/null @@ -1,28 +0,0 @@ -# The most simplistic Makefile, for Cygnus gcc on MS-DOS - -ifndef USEDLL -USEDLL = no -endif - -ifeq (yes, $(USEDLL)) -DEFINES = -LIBS = -lc -else -DEFINES = -LIBS = -endif - -CC = gcc -CFLAGS = -O2 -Wall -DWIN32 $(DEFINES) - -ifneq (sh.exe, $(SHELL)) -DEL = rm -else -DEL = del -endif - -xxd.exe: xxd.c - $(CC) $(CFLAGS) -s -o xxd.exe xxd.c $(LIBS) - -clean: - -$(DEL) xxd.exe diff --git a/src/xxd/Make_djg.mak b/src/xxd/Make_djg.mak deleted file mode 100644 index f6eed31305..0000000000 --- a/src/xxd/Make_djg.mak +++ /dev/null @@ -1,9 +0,0 @@ -# The most simplistic Makefile, for DJGPP on MS-DOS - -CFLAGS = -O2 -Wall - -xxd.exe: xxd.c - gcc $(CFLAGS) -s -o xxd.exe xxd.c -lpc - -clean: - del xxd.exe diff --git a/src/xxd/Make_ming.mak b/src/xxd/Make_ming.mak index 5147e89c15..2d32261314 100644 --- a/src/xxd/Make_ming.mak +++ b/src/xxd/Make_ming.mak @@ -1,4 +1,4 @@ -# The most simplistic Makefile, for MinGW gcc on MS-DOS +# The most simplistic Makefile, for MinGW and Cygwin gcc on MS-DOS ifndef USEDLL USEDLL = no diff --git a/src/xxd/Make_mvc.mak b/src/xxd/Make_mvc.mak index 3227f0c864..dd71468af4 100644 --- a/src/xxd/Make_mvc.mak +++ b/src/xxd/Make_mvc.mak @@ -1,14 +1,20 @@ # The most simplistic Makefile for Win32 using Microsoft Visual C++ # (NT and Windows 95) +SUBSYSTEM = console +!if "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) +!endif + xxd: xxd.exe xxd.exe: xxd.c - cl /nologo -DWIN32 xxd.c + cl /nologo -DWIN32 xxd.c -link -subsystem:$(SUBSYSTEM) + IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 # This was for an older compiler # cl /nologo -DWIN32 xxd.c /link setargv.obj clean: - - if exist xxd.obj del xxd.obj - - if exist xxd.exe del xxd.exe + - if exist xxd.obj del xxd.obj + - if exist xxd.exe del xxd.exe diff --git a/src/xxd/Make_os2.mak b/src/xxd/Make_os2.mak deleted file mode 100644 index cb6694e1cf..0000000000 --- a/src/xxd/Make_os2.mak +++ /dev/null @@ -1,11 +0,0 @@ -# A very (if most the most) simplistic Makefile for OS/2 - -CC=gcc -CFLAGS=-O2 -fno-strength-reduce -DOS2 - -xxd.exe: xxd.c - $(CC) $(CFLAGS) -s -o $@ $< - -clean: - - del xxd.o - - del xxd.exe diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index e19874ad79..d102db451b 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -51,9 +51,13 @@ * 16.05.00 Improved MMS file and merge for VMS by Zoltan Arpadffy * 2011 March Better error handling by Florian Zumbiehl. * 2011 April Formatting by Bram Moolenaar + * 08.06.2013 Little-endian hexdump (-e) and offset (-o) by Vadim Vygonets. * * (c) 1990-1998 by Juergen Weigert (jnweiger@informatik.uni-erlangen.de) * + * I hereby grant permission to distribute and use xxd + * under X11-MIT or GPL-2.0 (at the user's choice). + * * Small changes made afterwards by Bram Moolenaar et al. * * Distribute freely and credit me, @@ -76,14 +80,7 @@ #else # include <fcntl.h> #endif -#ifdef __TSC__ -# define MSDOS -#endif -#if !defined(OS2) && defined(__EMX__) -# define OS2 -#endif -#if defined(MSDOS) || defined(WIN32) || defined(OS2) || defined(__BORLANDC__) \ - || defined(CYGWIN) +#if defined(WIN32) || defined(__BORLANDC__) || defined(CYGWIN) # include <io.h> /* for setmode() */ #else # ifdef UNIX @@ -145,18 +142,10 @@ char version[] = "xxd V1.10 27oct98 by Juergen Weigert"; #ifdef WIN32 char osver[] = " (Win32)"; #else -# ifdef DJGPP -char osver[] = " (dos 32 bit)"; -# else -# ifdef MSDOS -char osver[] = " (dos 16 bit)"; -# else char osver[] = ""; -# endif -# endif #endif -#if defined(MSDOS) || defined(WIN32) || defined(OS2) +#if defined(WIN32) # define BIN_READ(yes) ((yes) ? "rb" : "rt") # define BIN_WRITE(yes) ((yes) ? "wb" : "wt") # define BIN_CREAT(yes) ((yes) ? (O_CREAT|O_BINARY) : O_CREAT) @@ -199,8 +188,7 @@ char osver[] = ""; #endif #ifndef __P -# if defined(__STDC__) || defined(MSDOS) || defined(WIN32) || defined(OS2) \ - || defined(__BORLANDC__) +# if defined(__STDC__) || defined(WIN32) || defined(__BORLANDC__) # define __P(a) a # else # define __P(a) () @@ -216,7 +204,7 @@ static void xxdline __P((FILE *, char *, int)); #define TRY_SEEK /* attempt to use lseek, or skip forward by reading */ #define COLS 256 /* change here, if you ever need more columns */ -#define LLEN (11 + (9*COLS-1)/1 + COLS + 2) +#define LLEN (12 + (9*COLS-1) + COLS + 2) char hexxa[] = "0123456789abcdef0123456789ABCDEF", *hexx = hexxa; @@ -225,23 +213,29 @@ char hexxa[] = "0123456789abcdef0123456789ABCDEF", *hexx = hexxa; #define HEX_POSTSCRIPT 1 #define HEX_CINCLUDE 2 #define HEX_BITS 3 /* not hex a dump, but bits: 01111001 */ +#define HEX_LITTLEENDIAN 4 + +#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((int)c) : c) static char *pname; static void -exit_with_usage() +exit_with_usage(void) { fprintf(stderr, "Usage:\n %s [options] [infile [outfile]]\n", pname); fprintf(stderr, " or\n %s -r [-s [-]offset] [-c cols] [-ps] [infile [outfile]]\n", pname); fprintf(stderr, "Options:\n"); fprintf(stderr, " -a toggle autoskip: A single '*' replaces nul-lines. Default off.\n"); fprintf(stderr, " -b binary digit dump (incompatible with -ps,-i,-r). Default hex.\n"); + fprintf(stderr, " -C capitalize variable names in C include file style (-i).\n"); fprintf(stderr, " -c cols format <cols> octets per line. Default 16 (-i: 12, -ps: 30).\n"); fprintf(stderr, " -E show characters in EBCDIC. Default ASCII.\n"); - fprintf(stderr, " -g number of octets per group in normal output. Default 2.\n"); + fprintf(stderr, " -e little-endian dump (incompatible with -ps,-i,-r).\n"); + fprintf(stderr, " -g number of octets per group in normal output. Default 2 (-e: 4).\n"); fprintf(stderr, " -h print this summary.\n"); fprintf(stderr, " -i output in C include file style.\n"); fprintf(stderr, " -l len stop after <len> octets.\n"); + fprintf(stderr, " -o off add <off> to the displayed file position.\n"); fprintf(stderr, " -ps output in postscript plain hexdump style.\n"); fprintf(stderr, " -r reverse operation: convert (or patch) hexdump into binary.\n"); fprintf(stderr, " -r -s off revert with <off> added to file positions found in hexdump.\n"); @@ -257,8 +251,7 @@ exit_with_usage() } static void -die(ret) - int ret; +die(int ret) { fprintf(stderr, "%s: ", pname); perror(NULL); @@ -273,10 +266,13 @@ die(ret) * The name is historic and came from 'undo type opt h'. */ static int -huntype(fpi, fpo, fperr, cols, hextype, base_off) - FILE *fpi, *fpo, *fperr; - int cols, hextype; - long base_off; +huntype( + FILE *fpi, + FILE *fpo, + FILE *fperr, + int cols, + int hextype, + long base_off) { int c, ign_garb = 1, n1 = -1, n2 = 0, n3, p = cols; long have_off = 0, want_off = 0; @@ -402,10 +398,7 @@ huntype(fpi, fpo, fperr, cols, hextype, base_off) * If nz is always positive, lines are never suppressed. */ static void -xxdline(fp, l, nz) - FILE *fp; - char *l; - int nz; +xxdline(FILE *fp, char *l, int nz) { static char z[LLEN+1]; static int zero_seen = 0; @@ -465,17 +458,15 @@ static unsigned char etoa64[] = }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *fp, *fpo; int c, e, p = 0, relseek = 1, negseek = 0, revert = 0; - int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL; + int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL, capitalize = 0; int ebcdic = 0; int octspergrp = -1; /* number of octets grouped in output */ int grplen; /* total chars per octet group */ - long length = -1, n = 0, seekoff = 0; + long length = -1, n = 0, seekoff = 0, displayoff = 0; static char l[LLEN+1]; /* static because it may be too big for stack */ char *pp; @@ -503,9 +494,11 @@ main(argc, argv) pp = argv[1] + (!STRNCMP(argv[1], "--", 2) && argv[1][2]); if (!STRNCMP(pp, "-a", 2)) autoskip = 1 - autoskip; else if (!STRNCMP(pp, "-b", 2)) hextype = HEX_BITS; + else if (!STRNCMP(pp, "-e", 2)) hextype = HEX_LITTLEENDIAN; else if (!STRNCMP(pp, "-u", 2)) hexx = hexxa + 16; else if (!STRNCMP(pp, "-p", 2)) hextype = HEX_POSTSCRIPT; else if (!STRNCMP(pp, "-i", 2)) hextype = HEX_CINCLUDE; + else if (!STRNCMP(pp, "-C", 2)) capitalize = 1; else if (!STRNCMP(pp, "-r", 2)) revert++; else if (!STRNCMP(pp, "-E", 2)) ebcdic++; else if (!STRNCMP(pp, "-v", 2)) @@ -517,6 +510,8 @@ main(argc, argv) { if (pp[2] && STRNCMP("ols", pp + 2, 3)) cols = (int)strtol(pp + 2, NULL, 0); + else if (pp[2] && STRNCMP("apitalize", pp + 2, 9)) + capitalize = 1; else { if (!argv[2]) @@ -539,6 +534,19 @@ main(argc, argv) argc--; } } + else if (!STRNCMP(pp, "-o", 2)) + { + if (pp[2] && STRNCMP("ffset", pp + 2, 5)) + displayoff = (int)strtol(pp + 2, NULL, 0); + else + { + if (!argv[2]) + exit_with_usage(); + displayoff = (int)strtol(argv[2], NULL, 0); + argv++; + argc--; + } + } else if (!STRNCMP(pp, "-s", 2)) { relseek = 0; @@ -603,6 +611,7 @@ main(argc, argv) case HEX_CINCLUDE: cols = 12; break; case HEX_BITS: cols = 6; break; case HEX_NORMAL: + case HEX_LITTLEENDIAN: default: cols = 16; break; } @@ -611,20 +620,28 @@ main(argc, argv) { case HEX_BITS: octspergrp = 1; break; case HEX_NORMAL: octspergrp = 2; break; + case HEX_LITTLEENDIAN: octspergrp = 4; break; case HEX_POSTSCRIPT: case HEX_CINCLUDE: default: octspergrp = 0; break; } - if (cols < 1 || ((hextype == HEX_NORMAL || hextype == HEX_BITS) + if (cols < 1 || ((hextype == HEX_NORMAL || hextype == HEX_BITS || hextype == HEX_LITTLEENDIAN) && (cols > COLS))) { fprintf(stderr, "%s: invalid number of columns (max. %d).\n", pname, COLS); exit(1); } - if (octspergrp < 1) + if (octspergrp < 1 || octspergrp > cols) octspergrp = cols; + else if (hextype == HEX_LITTLEENDIAN && (octspergrp & (octspergrp-1))) + { + fprintf(stderr, + "%s: number of octets per group must be a power of 2 with -e.\n", + pname); + exit(1); + } if (argc > 3) exit_with_usage(); @@ -711,7 +728,7 @@ main(argc, argv) if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) - if (putc(isalnum(c) ? c : '_', fpo) == EOF) + if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); if (fputs("[] = {\n", fpo) == EOF) die(3); @@ -739,9 +756,9 @@ main(argc, argv) if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) - if (putc(isalnum(c) ? c : '_', fpo) == EOF) + if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); - if (fprintf(fpo, "_len = %d;\n", p) < 0) + if (fprintf(fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p) < 0) die(3); } @@ -781,9 +798,9 @@ main(argc, argv) return 0; } - /* hextype: HEX_NORMAL or HEX_BITS */ + /* hextype: HEX_NORMAL or HEX_BITS or HEX_LITTLEENDIAN */ - if (hextype == HEX_NORMAL) + if (hextype != HEX_BITS) grplen = octspergrp + octspergrp + 1; /* chars per octet group */ else /* hextype == HEX_BITS */ grplen = 8 * octspergrp + 1; @@ -793,38 +810,45 @@ main(argc, argv) { if (p == 0) { - sprintf(l, "%07lx: ", n + seekoff); + sprintf(l, "%08lx:", + ((unsigned long)(n + seekoff + displayoff)) & 0xffffffff); for (c = 9; c < LLEN; l[c++] = ' '); } if (hextype == HEX_NORMAL) { - l[c = (9 + (grplen * p) / octspergrp)] = hexx[(e >> 4) & 0xf]; - l[++c] = hexx[ e & 0xf]; + l[c = (10 + (grplen * p) / octspergrp)] = hexx[(e >> 4) & 0xf]; + l[++c] = hexx[ e & 0xf]; + } + else if (hextype == HEX_LITTLEENDIAN) + { + int x = p ^ (octspergrp-1); + l[c = (10 + (grplen * x) / octspergrp)] = hexx[(e >> 4) & 0xf]; + l[++c] = hexx[ e & 0xf]; } else /* hextype == HEX_BITS */ { int i; - c = (9 + (grplen * p) / octspergrp) - 1; + c = (10 + (grplen * p) / octspergrp) - 1; for (i = 7; i >= 0; i--) l[++c] = (e & (1 << i)) ? '1' : '0'; } + if (e) + nonzero++; if (ebcdic) e = (e < 64) ? '.' : etoa64[e-64]; /* When changing this update definition of LLEN above. */ - l[11 + (grplen * cols - 1)/octspergrp + p] = + l[12 + (grplen * cols - 1)/octspergrp + p] = #ifdef __MVS__ (e >= 64) #else (e > 31 && e < 127) #endif ? e : '.'; - if (e) - nonzero++; n++; if (++p == cols) { - l[c = (11 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; + l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; xxdline(fpo, l, autoskip ? nonzero : 1); nonzero = 0; p = 0; @@ -834,7 +858,7 @@ main(argc, argv) die(2); if (p) { - l[c = (11 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; + l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; xxdline(fpo, l, 1); } else if (autoskip) diff --git a/switches/catalog/disable-go-extra.vim b/switches/catalog/disable-go-extra.vim new file mode 100644 index 0000000000..cb8df7f05f --- /dev/null +++ b/switches/catalog/disable-go-extra.vim @@ -0,0 +1,4 @@ +scriptencoding utf-8 +" Disable bundled vim-go-extra (was go-vim). +" +" 同梱された vim-go-extra (旧名:go-vim) を無効化します。 diff --git a/switches/catalog/disable-vimdoc-ja.vim b/switches/catalog/disable-vimdoc-ja.vim new file mode 100644 index 0000000000..c11e34bd8e --- /dev/null +++ b/switches/catalog/disable-vimdoc-ja.vim @@ -0,0 +1,4 @@ +scriptencoding utf-8 +" Disable vimdoc-ja help files. +" +" vimdoc-jaの日本語ファイルを無効化し、表示しないようにします。 diff --git a/switches/catalog/disable-vimproc.vim b/switches/catalog/disable-vimproc.vim new file mode 100644 index 0000000000..48c047b1e2 --- /dev/null +++ b/switches/catalog/disable-vimproc.vim @@ -0,0 +1,4 @@ +scriptencoding utf-8 +" Disable bundled vimproc. +" +" 同梱された vimproc を無効化します。 diff --git a/switches/catalog/utf-8.vim b/switches/catalog/utf-8.vim new file mode 100644 index 0000000000..a60946edc0 --- /dev/null +++ b/switches/catalog/utf-8.vim @@ -0,0 +1,4 @@ +scriptencoding utf-8 +" Set internal encoding as UTF-8 at startup. +" +" 起動時に内部エンコーディングをUTF-8に設定します。 diff --git a/tools/rename.bat b/tools/rename.bat new file mode 100644 index 0000000000..d66b0d33f8 --- /dev/null +++ b/tools/rename.bat @@ -0,0 +1,6 @@ +mv vim.exe vimw32.exe +mv tee/tee.exe teew32.exe +mv xxd/xxd.exe xxdw32.exe +mv vim.pdb vimw32.pdb +mv install.exe installw32.exe +mv uninstal.exe uninstalw32.exe diff --git a/uninstal.txt b/uninstal.txt index 9d0801026a..3b57921ff4 100644 --- a/uninstal.txt +++ b/uninstal.txt @@ -5,7 +5,7 @@ There are three ways to remove Vim: 1. With the GUI uninstaller. This is only available when Vim was installed with the self-installing executable. This has a minimal number of questions. It can delete - everything that was installed. This also unregisters the VisVim.dll + everything that was installed. This also unregisters the VisVim.dll. 2. With uninstal.exe. This removes most installed items, but does not delete the files you @@ -17,7 +17,7 @@ There are three ways to remove Vim: have to use uninstal.exe. It's recommended to use the method that matches with how you installed Vim. -Thus if you installed Vim by hand, deleted it by hand. +Thus if you installed Vim by hand, delete it by hand. The first two methods should be available from the Add/Remove software window and the Vim entry in the Start menu. If these have been removed already, find @@ -33,8 +33,8 @@ Here are guidelines for removing Vim by hand: menu entry. You only need to run uninstal.exe when you have installed the menu entry. You can also run uninstal.exe from the Control panel with the Add/Remove programs application. - Note that uninstal.exe offers you to uninstal other items. You can skip - this. + Note that uninstal.exe offers you the option to uninstal other items. You + can skip this. 2. Only if you have used the OLE version of gvim: Remove the registration of this program by running "gvim -unregister" in a console window. @@ -46,7 +46,7 @@ Here are guidelines for removing Vim by hand: If you created .bat files when installing Vim, also search for vim.bat, gvim.bat, etc. -4. If you completely want to delete vim, and are not going to install another +4. If you want to completely delete vim, and are not going to install another version, you can delete the vimrc files that you created. These are normally located in a directory like "C:\vim". If the $VIM environment variable is set, it will tell the name of the directory. Normally you can @@ -55,8 +55,8 @@ Here are guidelines for removing Vim by hand: skip the next step. 5. Delete the distributed files. If you followed the directions, these will - be located in a directory like "C:\vim\vim74". If the $VIM environment - variable is set, the directory will be $VIM\vim74. Delete the "vim74" + be located in a directory like "C:\vim\vim80". If the $VIM environment + variable is set, the directory will be $VIM\vim80. Delete the "vim80" directory and all that is in it. Warning: If you changed any of the distributed files, or added some of your own files, you might want to save these first. But normally you would not have changed or added files here. diff --git a/vimrc b/vimrc new file mode 100644 index 0000000000..b415d14594 --- /dev/null +++ b/vimrc @@ -0,0 +1,247 @@ +scriptencoding utf-8 +" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照) +" +" An example for a Japanese version vimrc file. +" 日本語版のデフォルト設定ファイル(vimrc) - Vim 7.4 +" +" Last Change: 23-Mar-2016. +" Maintainer: MURAOKA Taro <koron.kaoriya@gmail.com> +" +" 解説: +" このファイルにはVimの起動時に必ず設定される、編集時の挙動に関する設定が書 +" かれています。GUIに関する設定はgvimrcに書かかれています。 +" +" 個人用設定は_vimrcというファイルを作成しそこで行ないます。_vimrcはこのファ +" イルの後に読込まれるため、ここに書かれた内容を上書きして設定することが出来 +" ます。_vimrcは$HOMEまたは$VIMに置いておく必要があります。$HOMEは$VIMよりも +" 優先され、$HOMEでみつかった場合$VIMは読込まれません。 +" +" 管理者向けに本設定ファイルを直接書き換えずに済ませることを目的として、サイ +" トローカルな設定を別ファイルで行なえるように配慮してあります。Vim起動時に +" サイトローカルな設定ファイル($VIM/vimrc_local.vim)が存在するならば、本設定 +" ファイルの主要部分が読み込まれる前に自動的に読み込みます。 +" +" 読み込み後、変数g:vimrc_local_finishが非0の値に設定されていた場合には本設 +" 定ファイルに書かれた内容は一切実行されません。デフォルト動作を全て差し替え +" たい場合に利用して下さい。 +" +" 参考: +" :help vimrc +" :echo $HOME +" :echo $VIM +" :version + +"--------------------------------------------------------------------------- +" サイトローカルな設定($VIM/vimrc_local.vim)があれば読み込む。読み込んだ後に +" 変数g:vimrc_local_finishに非0な値が設定されていた場合には、それ以上の設定 +" ファイルの読込を中止する。 +if 1 && filereadable($VIM . '/vimrc_local.vim') + unlet! g:vimrc_local_finish + source $VIM/vimrc_local.vim + if exists('g:vimrc_local_finish') && g:vimrc_local_finish != 0 + finish + endif +endif + +"--------------------------------------------------------------------------- +" ユーザ優先設定($HOME/.vimrc_first.vim)があれば読み込む。読み込んだ後に変数 +" g:vimrc_first_finishに非0な値が設定されていた場合には、それ以上の設定ファ +" イルの読込を中止する。 +if 1 && exists('$HOME') && filereadable($HOME . '/.vimrc_first.vim') + unlet! g:vimrc_first_finish + source $HOME/.vimrc_first.vim + if exists('g:vimrc_first_finish') && g:vimrc_first_finish != 0 + finish + endif +endif + +" plugins下のディレクトリをruntimepathへ追加する。 +for s:path in split(glob($VIM.'/plugins/*'), '\n') + if s:path !~# '\~$' && isdirectory(s:path) + let &runtimepath = &runtimepath.','.s:path + end +endfor +unlet s:path + +"--------------------------------------------------------------------------- +" 日本語対応のための設定: +" +" ファイルを読込む時にトライする文字エンコードの順序を確定する。漢字コード自 +" 動判別機能を利用する場合には別途iconv.dllが必要。iconv.dllについては +" README_w32j.txtを参照。ユーティリティスクリプトを読み込むことで設定される。 +source $VIM/plugins/kaoriya/encode_japan.vim +" メッセージを日本語にする (Windowsでは自動的に判断・設定されている) +if !(has('win32') || has('mac')) && has('multi_lang') + if !exists('$LANG') || $LANG.'X' ==# 'X' + if !exists('$LC_CTYPE') || $LC_CTYPE.'X' ==# 'X' + language ctype ja_JP.eucJP + endif + if !exists('$LC_MESSAGES') || $LC_MESSAGES.'X' ==# 'X' + language messages ja_JP.eucJP + endif + endif +endif +" MacOS Xメニューの日本語化 (メニュー表示前に行なう必要がある) +if has('mac') + set langmenu=japanese +endif +" 日本語入力用のkeymapの設定例 (コメントアウト) +if has('keymap') + " ローマ字仮名のkeymap + "silent! set keymap=japanese + "set iminsert=0 imsearch=0 +endif +" 非GUI日本語コンソールを使っている場合の設定 +if !has('gui_running') && &encoding != 'cp932' && &term == 'win32' + set termencoding=cp932 +endif + +"--------------------------------------------------------------------------- +" メニューファイルが存在しない場合は予め'guioptions'を調整しておく +if 1 && !filereadable($VIMRUNTIME . '/menu.vim') && has('gui_running') + set guioptions+=M +endif + +"--------------------------------------------------------------------------- +" Bram氏の提供する設定例をインクルード (別ファイル:vimrc_example.vim)。これ +" 以前にg:no_vimrc_exampleに非0な値を設定しておけばインクルードはしない。 +if 1 && (!exists('g:no_vimrc_example') || g:no_vimrc_example == 0) + if &guioptions !~# "M" + " vimrc_example.vimを読み込む時はguioptionsにMフラグをつけて、syntax on + " やfiletype plugin onが引き起こすmenu.vimの読み込みを避ける。こうしない + " とencに対応するメニューファイルが読み込まれてしまい、これの後で読み込 + " まれる.vimrcでencが設定された場合にその設定が反映されずメニューが文字 + " 化けてしまう。 + set guioptions+=M + source $VIMRUNTIME/vimrc_example.vim + set guioptions-=M + else + source $VIMRUNTIME/vimrc_example.vim + endif +endif + +"--------------------------------------------------------------------------- +" 検索の挙動に関する設定: +" +" 検索時に大文字小文字を無視 (noignorecase:無視しない) +set ignorecase +" 大文字小文字の両方が含まれている場合は大文字小文字を区別 +set smartcase + +"--------------------------------------------------------------------------- +" 編集に関する設定: +" +" タブの画面上での幅 +set tabstop=8 +" タブをスペースに展開しない (expandtab:展開する) +set noexpandtab +" 自動的にインデントする (noautoindent:インデントしない) +set autoindent +" バックスペースでインデントや改行を削除できるようにする +set backspace=indent,eol,start +" 検索時にファイルの最後まで行ったら最初に戻る (nowrapscan:戻らない) +set wrapscan +" 括弧入力時に対応する括弧を表示 (noshowmatch:表示しない) +set showmatch +" コマンドライン補完するときに強化されたものを使う(参照 :help wildmenu) +set wildmenu +" テキスト挿入中の自動折り返しを日本語に対応させる +set formatoptions+=mM + +"--------------------------------------------------------------------------- +" GUI固有ではない画面表示の設定: +" +" 行番号を非表示 (number:表示) +set nonumber +" ルーラーを表示 (noruler:非表示) +set ruler +" タブや改行を表示 (list:表示) +set nolist +" どの文字でタブや改行を表示するかを設定 +"set listchars=tab:>-,extends:<,trail:-,eol:< +" 長い行を折り返して表示 (nowrap:折り返さない) +set wrap +" 常にステータス行を表示 (詳細は:he laststatus) +set laststatus=2 +" コマンドラインの高さ (Windows用gvim使用時はgvimrcを編集すること) +set cmdheight=2 +" コマンドをステータス行に表示 +set showcmd +" タイトルを表示 +set title +" 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる) +"colorscheme evening " (Windows用gvim使用時はgvimrcを編集すること) + +"--------------------------------------------------------------------------- +" ファイル操作に関する設定: +" +" バックアップファイルを作成しない (次行の先頭の " を削除すれば有効になる) +"set nobackup + + +"--------------------------------------------------------------------------- +" ファイル名に大文字小文字の区別がないシステム用の設定: +" (例: DOS/Windows/MacOS) +" +if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC') + " tagsファイルの重複防止 + set tags=./tags,tags +endif + +"--------------------------------------------------------------------------- +" コンソールでのカラー表示のための設定(暫定的にUNIX専用) +if has('unix') && !has('gui_running') + let s:uname = system('uname') + if s:uname =~? "linux" + set term=builtin_linux + elseif s:uname =~? "freebsd" + set term=builtin_cons25 + elseif s:uname =~? "Darwin" + set term=beos-ansi + else + set term=builtin_xterm + endif + unlet s:uname +endif + +"--------------------------------------------------------------------------- +" コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応 +if !has('gui_running') && has('xterm_clipboard') + set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen +endif + +"--------------------------------------------------------------------------- +" プラットホーム依存の特別な設定 + +" WinではPATHに$VIMが含まれていないときにexeを見つけ出せないので修正 +if has('win32') && $PATH !~? '\(^\|;\)' . escape($VIM, '\\') . '\(;\|$\)' + let $PATH = $VIM . ';' . $PATH +endif + +if has('mac') + " Macではデフォルトの'iskeyword'がcp932に対応しきれていないので修正 + set iskeyword=@,48-57,_,128-167,224-235 +endif + +"--------------------------------------------------------------------------- +" KaoriYaでバンドルしているプラグインのための設定 + +" autofmt: 日本語文章のフォーマット(折り返し)プラグイン. +set formatexpr=autofmt#japanese#formatexpr() + +" vimdoc-ja: 日本語ヘルプを無効化する. +if kaoriya#switch#enabled('disable-vimdoc-ja') + let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]vimdoc-ja"'), ',') +endif + +" vimproc: 同梱のvimprocを無効化する +if kaoriya#switch#enabled('disable-vimproc') + let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]vimproc$"'), ',') +endif + +" go-extra: 同梱の vim-go-extra を無効化する +if kaoriya#switch#enabled('disable-go-extra') + let &rtp = join(filter(split(&rtp, ','), 'v:val !~ "[/\\\\]plugins[/\\\\]golang$"'), ',') +endif + +" Copyright (C) 2009-2016 KaoriYa/MURAOKA Taro diff --git a/vimtutor.bat b/vimtutor.bat index b147a8c44f..0cab3c3bb8 100644 --- a/vimtutor.bat +++ b/vimtutor.bat @@ -10,7 +10,7 @@ :: When that also fails, it uses the English version. :: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME -FOR %%d in (. %TMP% %TEMP%) DO IF EXIST %%d\nul SET TUTORCOPY=%%d\$tutor$ +FOR %%d in (. "%TMP%" "%TEMP%") DO IF EXIST %%d\nul SET TUTORCOPY=%%d\$tutor$ SET xx=%1 @@ -47,11 +47,11 @@ GOTO end :use_vim :: The script tutor.vim tells Vim which file to copy -vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" +call vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" IF ERRORLEVEL 1 GOTO no_executable :: Start vim without any .vimrc, set 'nocompatible' -vim -u NONE -c "set nocp" %TUTORCOPY% +call vim -u NONE -c "set nocp" %TUTORCOPY% GOTO end diff --git a/vimtutor.com b/vimtutor.com index 71fdba427a..778b8293fa 100755 --- a/vimtutor.com +++ b/vimtutor.com @@ -6,9 +6,9 @@ $ ! $ ! Author: Tom Wyant <Thomas.R.Wyant-III@usa.dupont.com> $ ! $ ! This DCL command procedure executes the vimtutor command -$ ! (suprise, suprise!) which gives you a brief tutorial on the VIM -$ ! editor. Languages other than the default are supported in the -$ ! usual way, as are at least some of the command qualifiers, +$ ! (surprise, surprise!) which gives you a brief tutorial on the +$ ! VIM editor. Languages other than the default are supported in +$ ! the usual way, as are at least some of the command qualifiers, $ ! though you'll need to play some fairly serious games with DCL $ ! to specify ones that need quoting. $ !